# HG changeset patch # User jlarmour # Date 1021933166 0 # Node ID e0c0827131d1e1137248d9d66feedfa0a476dec4 # Parent 74c807ddde34681ce3ebb91106a4f6f595d527f5 Merge from eCos master repository on 2002-05-20-20:11:54-BST diff --git a/COPYING b/COPYING new file mode 100644 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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. + + + Copyright (C) + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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. + + , 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 Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,93 @@ +1999-11-10 Bart Veer + + * configure.in + * configure + Added host/tools/configtool/standalone/common + +1999-11-09 Bart Veer + + * configure: + * configure.in: + Added host/tools/ecostest/common, suppressed the configtool + support for now. + +1999-08-12 Bart Veer + + * Makefile.in: + * acinclude.m4: + * aclocal.m4: + * configure.in: + * configure: + First attempt at autoconfiscation of the configtool. + +1999-06-03 Bart Veer + + * acinclude.m4: + Trying to sort out the compiler flags a bit better. + +1999-06-02 Bart Veer + + * acinclude.m4: + Added -enable-debuginfo flag which will do the right thing + for both gcc/g++ (add -g) and VC++ (add -MDd or -MD) + +1999-03-25 Bart Veer + + * configure.in: + * aclocal.m4: + * acinclude.m4: + * Makefile.am: + Sorting out the banner. + +1999-01-26 Bart Veer + + * configure.in: + * configure: + * aclocal.m4: + * Makefile.in + Update to use autoconf 2.13 and automake 1.4 + + * acinclude.m4 (CYG_AC_PATH_TCL): + Improve the support for linking with Tcl + +1999-01-21 Bart Veer + + * acinclude.m4: + Added new macro CYG_AC_SUBST_VERSION so that different packages + can use different symbols for versioning. + +1999-01-19 Bart Veer + + * acinclude.m4: + * aclocal.m4: + * Makefile.in: + Added new macros: CYG_AC_MSVC_PATH for handling pathname + problems between cygwin and VC++; and CYG_AC_PATH_TCL so + that the user can specify the location of a suitable Tcl + installation. + +1998-12-24 Bart Veer + + * configure.in: + * configure: + * aclocal.m4: + * acinclude.m4: + * Makefile.in: + * Makefile.am: + Provide support for building all host-side packages. + +1998-07-13 Bart Veer + + * ltconfig + * ltmain-sh + Merge with latest versions from devo + + * missing + * mkinstalldirs + * config.guess + * config.sub + * install-sh + * ltconfig + * ltmain-sh + Restore files that had been removed prematurely + diff --git a/Makefile.am b/Makefile.am new file mode 100644 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,53 @@ +## Process this file with automake to produce Makefile.in +## ===================================================================== +## +## Makefile.am +## +## eCos host-side software toplevel makefile +## +## ===================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +## ===================================================================== +#######DESCRIPTIONBEGIN#### +## +## Author(s): bartv +## Contact(s): bartv +## Date: 1998/12/17 +## Version: 0.01 +## +######DESCRIPTIONEND#### +## ===================================================================== + +AUTOMAKE_OPTIONS = 1.3 cygnus +SUBDIRS = host diff --git a/Makefile.in b/Makefile.in new file mode 100644 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,359 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +#######DESCRIPTIONBEGIN#### +######DESCRIPTIONEND#### + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +CC = @CC@ +CXX = @CXX@ +EXEEXT = @EXEEXT@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +AUTOMAKE_OPTIONS = 1.3 cygnus +SUBDIRS = host +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/host/mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_COMMON = ChangeLog Makefile.am Makefile.in aclocal.m4 configure \ +configure.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive install-info-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-info-am: +install-info: install-info-recursive +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-tags distclean-generic clean-am + +distclean: distclean-recursive + -rm -f config.status + +maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + -rm -f config.status + +.PHONY: install-data-recursive uninstall-data-recursive \ +install-exec-recursive uninstall-exec-recursive installdirs-recursive \ +uninstalldirs-recursive all-recursive check-recursive \ +installcheck-recursive info-recursive dvi-recursive \ +mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-info-am \ +install-info install-exec-am install-exec install-data-am install-data \ +install-am install uninstall-am uninstall all-redirect all-am all \ +installdirs-am installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,137 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + diff --git a/configure b/configure new file mode 100644 --- /dev/null +++ b/configure @@ -0,0 +1,1714 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -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 ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$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) + # 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 << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --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 +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$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" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + 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) + 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" ;; + + -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 ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=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" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=host/COPYING + +# 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 its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + 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 + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +ac_aux_dir= +for ac_dir in host $srcdir/host; 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 + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in host $srcdir/host" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:554: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +# 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 +# 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" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:586: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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 + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +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. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&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_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:639: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +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" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:696: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=eCos + +VERSION=2.0 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi + + + +missing_dir=`cd $ac_aux_dir && pwd` +echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 +echo "configure:735: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:748: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:761: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:774: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:787: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:801: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + MAINT=$MAINTAINER_MODE_TRUE + + + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:825: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:854: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:884: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:935: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:967: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 978 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1009: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1014: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1042: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&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 + +for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1078: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1110: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext << EOF + +#line 1121 "configure" +#include "confdefs.h" + +int main(){return(0);} +EOF +if { (eval echo configure:1126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cxx_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_works = no; then + { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1152: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 +cross_compiling=$ac_cv_prog_cxx_cross + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +echo "configure:1157: checking whether we are using GNU C++" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +ac_test_CXXFLAGS="${CXXFLAGS+set}" +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= +echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +echo "configure:1185: checking whether ${CXX-g++} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi + +echo $ac_n "checking for object suffix""... $ac_c" 1>&6 +echo "configure:1217: checking for object suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftest* +echo 'int i = 1;' > conftest.$ac_ext +if { (eval echo configure:1223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_objext" 1>&6 +OBJEXT=$ac_cv_objext +ac_objext=$ac_cv_objext + +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:1241: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:1274: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1305: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:1315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + + +subdirs="host" + +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# 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. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g +s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g +s%@MAINT@%$MAINT%g +s%@CC@%$CC%g +s%@CXX@%$CXX%g +s%@OBJEXT@%$OBJEXT%g +s%@EXEEXT@%$EXEEXT%g +s%@subdirs@%$subdirs%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case "$ac_arg" in + -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=*) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_config_dir in host; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$ac_sub_srcdir/configure + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + + # Make the cache file name correct relative to the subdirectory. + case "$cache_file" in + /*) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file="$ac_dots$cache_file" ;; + esac + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } + fi + fi + + cd $ac_popdir + done +fi + diff --git a/configure.in b/configure.in new file mode 100644 --- /dev/null +++ b/configure.in @@ -0,0 +1,76 @@ +dnl Process this file with autoconf to produce a configure script. +dnl ==================================================================== +dnl +dnl configure.in +dnl +dnl Top-level configure script for eCos host-side software. +dnl +dnl ==================================================================== +dnl ####ECOSGPLCOPYRIGHTBEGIN#### +dnl ------------------------------------------- +dnl This file is part of eCos, the Embedded Configurable Operating System. +dnl Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +dnl +dnl eCos is free software; you can redistribute it and/or modify it under +dnl the terms of the GNU General Public License as published by the Free +dnl Software Foundation; either version 2 or (at your option) any later version. +dnl +dnl eCos is distributed in the hope that it will be useful, but WITHOUT ANY +dnl WARRANTY; without even the implied warranty of MERCHANTABILITY or +dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with eCos; if not, write to the Free Software Foundation, Inc., +dnl 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +dnl +dnl As a special exception, if other files instantiate templates or use macros +dnl or inline functions from this file, or you compile this file and link it +dnl with other works to produce a work based on this file, this file does not +dnl by itself cause the resulting work to be covered by the GNU General Public +dnl License. However the source code for this file must still be made available +dnl in accordance with section (3) of the GNU General Public License. +dnl +dnl This exception does not invalidate any other reasons why a work based on +dnl this file might be covered by the GNU General Public License. +dnl +dnl Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +dnl at http://sources.redhat.com/ecos/ecos-license +dnl ------------------------------------------- +dnl ####ECOSGPLCOPYRIGHTEND#### +dnl ==================================================================== +dnl#####DESCRIPTIONBEGIN#### +dnl +dnl Author(s): bartv +dnl Contact(s): bartv +dnl Date: 1998/12/17 +dnl Version: 0.01 +dnl +dnl####DESCRIPTIONEND#### +dnl ==================================================================== + +dnl For now the only work done via configure/make/make install is the +dnl host-side libs and tools. At some point this work may be extended +dnl to process the generic (non-package) documentation, and possibly +dnl to make releases of the target-side. +dnl +dnl The support files are all kept in the host sub-directory, allowing +dnl that to be distributed as a coherent set of sources. + +AC_INIT(host/COPYING) +AC_CONFIG_AUX_DIR(host) +AC_CANONICAL_HOST +AM_INIT_AUTOMAKE(eCos,2.0,0) +AM_MAINTAINER_MODE + +dnl The automake options include cygnus, so AC_EXEEXT is required and +dnl hence it is a good idea to include all of the compiler-selection +dnl tests. +AC_PROG_MAKE_SET +AC_PROG_CC +AC_PROG_CXX +AC_OBJEXT +AC_EXEEXT + +AC_CONFIG_SUBDIRS(host) +AC_OUTPUT(Makefile) diff --git a/doc/sgml/doclist b/doc/sgml/doclist new file mode 100644 --- /dev/null +++ b/doc/sgml/doclist @@ -0,0 +1,21 @@ +kernel/current/doc/kernel.sgml +compat/uitron/current/doc/uitron.sgml +hal/common/current/doc/hal.sgml +io/common/current/doc/io.sgml +io/pci/current/doc/pci.sgml +language/c/libc/common/current/doc/libc.sgml +compat/posix/current/doc/posix.sgml +io/fileio/current/doc/fileio.sgml +redboot/current/doc/redboot.sgml +redboot/current/doc/redboot_cmds.sgml +redboot/current/doc/redboot_rebuilding.sgml +redboot/current/doc/redboot_installing.sgml +redboot/current/doc/redboot_epilogue.sgml +net/common/current/doc/tcpip.sgml +net/common/current/doc/tcpip-manpages.sgml +net/tcpip/current/doc/openbsd.sgml +net/bsd_tcpip/current/doc/freebsd.sgml +io/eth/current/doc/ethdrv.sgml +net/snmp/agent/current/doc/snmp.sgml +net/ns/dns/current/doc/dns.sgml +net/ftpclient/current/doc/ftpclient.sgml diff --git a/doc/sgml/makemakefile b/doc/sgml/makemakefile new file mode 100644 --- /dev/null +++ b/doc/sgml/makemakefile @@ -0,0 +1,193 @@ +#!/bin/sh + +touch ecos.sgml +touch makefile +chmod +w ecos.sgml +chmod +w makefile + +cat > makefile <> makefile + +cat >ecos.sgml < + + + + +EOF + +for i in `cat doclist`; do + line="`echo $i | sed 's/#.*//;'`" + if (test ! -z $line); then + /bin/echo -n " ../../ecc/$i" >> makefile + entityi="`echo $i | sed 's@/@-@g; s@\.@-@g; s@_@-@g'`" + echo "" >> ecos.sgml + fi +done +echo "" >> ecos.sgml + +cat >> makefile <> ecos.sgml < +]> + + + + eCos + + + 1998 + 1999 + 2000 + 2001 + 2002 + Red Hat, Inc. + + + + Documentation licensing terms +This material may be distributed only subject to the terms +and conditions set forth in the Open Publication License, v1.0 +or later (the latest version is presently available at +http://www.opencontent.org/openpub/). + + +Distribution of substantively modified versions of this +document is prohibited without the explicit permission of the +copyright holder. + +Distribution of the work or derivative of the work in any +standard (paper) book form is prohibited unless prior +permission is obtained from the copyright holder. + + + + Trademarks + Red Hat, the Red Hat Shadow Man logo®, eCos™, RedBoot™, +GNUPro®, and Insight™ are trademarks of Red Hat, Inc. +Sun Microsystems® and Solaris® are registered trademarks of +Sun Microsystems, Inc. +SPARC® is a registered trademark of SPARC International, Inc., and +is used under license by Sun Microsystems, Inc. +Intel® is a registered trademark of Intel Corporation. +Motorola™ is a trademark of Motorola, Inc. +ARM® is a registered trademark of Advanced RISC Machines, Ltd. +MIPS™ is a trademark of MIPS Technologies, Inc. +Toshiba® is a registered trademark of the Toshiba Corporation. +NEC® is a registered trademark if the NEC Corporation. +Cirrus Logic® is a registered trademark of Cirrus Logic, Inc. +Compaq® is a registered trademark of the Compaq Computer Corporation. + +Matsushita™ is a trademark of the Matsushita Electric Corporation. + +Samsung® and CalmRISC™ are trademarks or registered trademarks +of Samsung, Inc. +Linux® is a registered trademark of Linus Torvalds. +UNIX® is a registered trademark of The Open Group. +Microsoft®, Windows®, and Windows NT® are registered trademarks +of Microsoft Corporation, Inc. +All other brand and product names, trademarks, and copyrights are the +property of their respective owners. + + +Warranty +eCos and RedBoot are open source software, covered by the Red Hat eCos Public License, +and you are welcome to change it and/or distribute copies of it under certain +conditions. The supplied version of eCos and/or RedBoot is supported for customers of Red Hat. See http://sources.redhat.com/ecos/license-overview.html + +For non-customers, eCos and RedBoot software has NO WARRANTY. +Because this software is licensed free of charge, there are no warranties +for it, to the extent permitted by applicable law. Except when otherwise stated +in writing, the copyright holders and/or other parties provide the software +“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 software is with you. Should the software prove defective, you assume +the cost of all necessary servicing, repair or correction. + 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. + + + + +EOF + +for i in `cat doclist`; do + line="`echo $i | sed 's/#.*//;'`" + if (test ! -z $line); then + entityi="`echo $i | sed 's@/@-@g; s@\.@-@g; s@_@-@g'`" + # special kludge + if [ "`basename $i`" != "tcpip-manpages.sgml" ]; then + echo "&$entityi;" >> ecos.sgml + fi + fi +done + +echo '' >> ecos.sgml diff --git a/doc/sgml/tutorials/ChangeLog b/doc/sgml/tutorials/ChangeLog new file mode 100644 --- /dev/null +++ b/doc/sgml/tutorials/ChangeLog @@ -0,0 +1,118 @@ +2002-05-20 Jonathan Larmour + + * ecos-tutorial.sgml: RHEPL -> GPL. A few minor other tweaks, but + resisted fixing more. + +2002-03-11 Hugo Tyson + + * ecos-tutorial.sgml: Document Cirrus/Maverick EP7312 at all, as + part of adding notes about the 90MHz option that some boards have. + +2002-02-14 Julian Smart + + * ecos-tutorial.sgml: Added some spacing, created new GIFs for + Configuration Tool, altered text to reflect presence of tool + on both platforms. + +2002-02-05 Jonathan Larmour + + * ecos-tutorial.sgml: add id tags to all sect1 stuff. + +2002-01-06 Mark Galassi + + * ecos-tutorial.sgml: more corrections based on a visual scan + through the document. Looks good. + +2002-01-05 Mark Galassi + + * ecos-tutorial.sgml: shortened an id attribute so that + docbook2html does not complain on redhat. + + * ecos-tutorial.sgml: finished adding all the conditional text, + and it validates. Things remaining to be done: (1) visual-check + HTML for new stuff, (2) normalize it. + +2002-01-04 Mark Galassi + + * ecos-tutorial.sgml: put in a lot more of the conditional text. + Some is still missing. Also restored some conditional figures. + + * ecos-tutorial.sgml: put in more conditional text, up to the + package description. + + * ecos-tutorial.sgml: added the class="monospaced" attribute to + the tags for the real time characterization + appendices. + + * ecos-tutorial.sgml: restored a bunch of the conditional text. + There is probably still some more. + +2001-12-22 Jonathan Larmour + + * ecos-tutorial.sgml: Move all pictures to pix/ subdirectory. + Fix copyright year format. + Give every chapter/part an ID. And some sect1's (not finished). + A few other tagging fixes. + +2001-12-17 Mark Galassi + + * ecos-tutorial.sgml: renormalized. since this can be tricky I + tagged this directory before committing with the tag + "before-new-normalization". + + * ecos-tutorial.sgml: yay: imported all the missing hardware setup + sections from the FrameMaker docs. This somehow had gotten lost + the first time. + + * ecos-tutorial.sgml: little typo fix in the copyright notice. + + * ecos-tutorial.sgml: added legal stuff and contact information. + +2001-12-16 Mark Galassi + + * ecos-tutorial.sgml: added some preface material ("contact Red + Hat" and legal stuff) that Jonathan sent. + + * ecos-tutorial.sgml: put titles on all the board-specific real + time characterization appendices. + +2001-12-10 Mark Galassi + + * ecos-tutorial.sgml: reintroduced the appendices. They need more + work from me. + +2001-11-28 Jonathan Larmour + + * ecos-tutorial.sgml: Get it to verify. + +2001-11-21 Mark Galassi + + * foreword.sgml: new file with Paul Beskeen's foreword. + + * ecos-tutorial.sgml: added the documentation roadmap chapter and + added inclusion of foreword.sgml. + + * ecos-tutorial.sgml: took care of all the and + cross-reference issues. This is mostly complete now. + +2001-11-20 Mark Galassi + + * ecos-tutorial.sgml: lots more work to clean it up, including + reinstating the table. + +2001-11-16 Mark Galassi + + * ecos-tutorial-not-normalized.sgml: this is the one I was editing + before. It is now deprecated. + + * ecos-tutorial.sgml: now this is the new normalized document + produced with: + +sgmlnorm -d -m -n ecos-tutorial-not-normalized.sgml > ecos-tutorial.sgml + + * ecos-tutorial.sgml (monitor): have done a lot of the fixup. + +2001-10-29 Mark Galassi + + * replaced graphic11.cgm with graphic11.cgm.bz2 which is *way* + smaller. diff --git a/doc/sgml/tutorials/ecos-tutorial.sgml b/doc/sgml/tutorials/ecos-tutorial.sgml new file mode 100644 --- /dev/null +++ b/doc/sgml/tutorials/ecos-tutorial.sgml @@ -0,0 +1,10523 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + + +eCos Tutorial + +1998 +1999 +2000 +2001 +2002 +Red Hat, Inc. + + +Documentation licensing terms +This material may be distributed only subject to the terms +and conditions set forth in the Open Publication License, v1.0 +or later (the latest version is presently available at +http://www.opencontent.org/openpub/). +Distribution of substantively modified versions of this +document is prohibited without the explicit permission of the +copyright holder. +Distribution of the work or derivative of the work in any +standard (paper) book form is prohibited unless prior +permission is obtained from the copyright holder. + + +Trademarks +Red Hat, the Red Hat Shadow Man logo®, eCos™, RedBoot™, +GNUPro®, and Insight™ are trademarks of Red Hat, Inc. +Sun Microsystems® and Solaris® are registered trademarks of +Sun Microsystems, Inc. +SPARC® is a registered trademark of SPARC International, Inc., and +is used under license by Sun Microsystems, Inc. +Intel® is a registered trademark of Intel Corporation. +Motorola™ is a trademark of Motorola, Inc. +ARM® is a registered trademark of Advanced RISC Machines, Ltd. +MIPS™ is a trademark of MIPS Technologies, Inc. +Toshiba® is a registered trademark of the Toshiba Corporation. +NEC® is a registered trademark if the NEC Corporation. +Cirrus Logic® is a registered trademark of Cirrus Logic, Inc. +Compaq® is a registered trademark of the Compaq Computer Corporation. +Matsushita™ is a trademark of the Matsushita Electric Corporation. +Samsung® and CalmRISC™ are trademarks or registered trademarks +of Samsung, Inc. +Linux® is a registered trademark of Linus Torvalds. +UNIX® is a registered trademark of The Open Group. +Microsoft®, Windows®, and Windows NT® are registered trademarks +of Microsoft Corporation, Inc. +All other brand and product names, trademarks, and copyrights are the +property of their respective owners. + + +Warranty + eCos is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 or (at your option) any later version, + although individual files may be covered by exceptions to this licence. + + + eCos is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details; this is supplied in an appendix to this manual. + + + + +Preliminaries + +How to Contact Red Hat +
Red Hat Corporate Headquarters + 2600 Meridian Parkway + DurhamNC 27713 USA + Telephone (toll free): +1 888 REDHAT 1 (+1 888 733 4281) + Telephone (main line): +1 919 547 0012 + Telephone (FAX line): +1 919 547 0024
+ Website: http://www.redhat.com/ +
+
+ +Foreword +Welcome to the latest release of Red Hat eCos(TM) - the Embedded + Configurable Operating System. + + + + +What's New? +In the fourth major public release of eCos, starting with +version 1.4, we have added a wealth of new features, enhancements, +and have further extended the target platform coverage. +Major new elements include: + + +Package management that supports the extension of eCos + functionality via third party add-on packages. + + +A standardized configuration save file format that is +human readable and editable, and compatible between both GUI and +command line configuration tools. + + +Enhanced web based help and component documentation system +integrated into the GUI configuration tool. + + +The Component Definition Language (CDL) has been radically +revised and has now been implemented as a TCL extension for maximum +flexibility. CDL is now fully documented in the Component Writers +Guide. + + +Template support for straightforward control of multiple +configuration elements, which can be used to provide easy access +to standard eCos configurations such as a debug stub boot ROM. + + +Best of all, the source of the new configuration tools +and underlying libCDL technology has been open sourced under the +GNU Public License (GPL). + + +A companion beta version of the eCos TCP/IP stack +has been released in conjunction with this release. The stack is +derived from the OpenBSD source base and provides UDP, TCP, ICMP, +BOOTP and DHCP protocol support on an IPv4 standards base. Device +driver support for Cirrus Logic EP72xx evaluation boards, Motorola +MBX, and StrongARM EBSA285 with Intel 82559 is included. The stack +and ethernet core support are distributed as configurable eCos packages. Platform +ethernet device drivers are distributed with the associated platform +HAL, but are naturally not useful without the ethernet core support +package. +A PCI bus support library has also been added that provides +generic PCI bus based device initialization, discovery, and configuration. +The library has been ported to both the VR4300 DDB-VRC4373 and StrongARM +EBSA285 development boards. +eCos also contains support for the POSIX Specification (ISO/IEC +9945-1)[POSIX]. This support follows EL/IX +level 1 in the functionality supplied [ELIX]. +POSIX support is divided between the POSIX and the FILEIO +packages. The POSIX package provides support for threads, signals, +synchronization, timers and message queues. The FILEIO package provides +support for file and device I/O. The two packages may be +used together or separately, depending on configuration. +Also supplied with eCos is RedBoot; the standard bootstrap +and debugging environment for embedded systems from Red Hat. It +provides a wide set of tools for downloading and executing programs +on embedded target systems, as well as tools for manipulating the +target system's environment. +RedBoot's capabilities include: + + +Serial and network (Ethernet) based debugging + + +FLASH management + + +Simple command line interface, available via serial or +Ethernet + + +Configurable and extensible, specifically adapted to the +target environment + + +New architectures and platforms added in this release include: + + + +ARM Thumb + + +ARM9 + + +Cirrus Logic CL-PS7111 and EP72xx + + +Cogent CMA222 and CMA230 ARM boards + + +Hitachi SH3 + + +Intel StrongARM + + +Intel x86 PC + + +Matsushita AM33 + + +Motorola MBX evaluation board + + +NEC MIPS VR4300 + + +NEC V8xx + + +For further details of all the changes see the NEWS file in +the eCos sources. +Red Hat is dedicated to continued enhancement and maintenance +of the eCos system. Developers can look forward to upcoming releases +that further expand the architectural and board coverage, extend +the functionality of the TCP/IP stack, add a Linux version +of the GUI configuration tool, and add major new features such as a +Linux/Posix compatibility layer based on the upcoming EL/IX +standard - see http://sources.redhat.com/elix/ +for more details. + + + + + +eCos in a Nutshell +eCos is an open source, configurable, portable, and + royalty-free embedded real-time operating system. The + following text expands on these core aspects that define + eCos. +eCos is provided as an open source runtime system + supported by the Red Hat GNUPro and GNU open source + development tools. Developers have full and unfettered access + to all aspects of the runtime system. No parts of it are + proprietary or hidden, and you are at liberty to examine, add + to, and modify the code as you deem necessary. These rights + are granted to you and protected by the Red Hat eCos Public + License (RHEPL). It also grants you the right to freely + develop and distribute applications based on eCos. You are not + expected or required to make your embedded applications or any + additional components that you develop freely available, + although we do require that you make publicly available any + modifications to the eCos code itself. Red Hat of course + welcomes all contributions back to eCos such as board ports, + device drivers and other components, as this helps the growth + and development of eCos, and is of benefit to the entire eCos + community. +One of the key technological innovations in eCos is our + configuration system. The configuration system allows the + application writer to impose their requirements on the + run-time components, both in terms of their functionality and + implementation, whereas traditionally the operating system has + constrained the application's own implementation. Essentially, + this enables eCos developers to create their own + application-specific operating system and makes eCos suitable + for a wide range of embedded uses. Configuration also ensures + that the resource footprint of eCos is minimized as all + unnecessary functionality and features are removed. The + configuration system also presents eCos as a component + architecture. This provides a standardized mechanism for + component suppliers to extend the functionality of eCos and + allows applications to be built from a wide set of optional + configurable run-time components. Components can be provided + from a variety of sources including: the standard eCos + release; commercial third party developers; open source + contributors; or additional optional components from Red + Hat. +The royalty-free nature of eCos means that you can develop +and deploy your application using the standard eCos release without +incurring any royalty charges. In addition, there are no up-front +license charges for the eCos runtime source code and associated +tools. We provide, without charge, everything necessary for basic embedded +applications development. +eCos is designed to be portable to a wide range of target +architectures and target platforms including 16, 32, and 64 bit +architectures, MPUs, MCUs and DSPs. The eCos kernel, libraries and +runtime components are layered on the Hardware Abstraction Layer +(HAL), and thus will run on any target once the HAL and relevant +device drivers have been ported to the target's processor +architecture and board. Currently eCos supports a large range of +different target architectures (ARM, Hitachi SH3, Intel x86, MIPS, +Matsushita AM3x, Intel StrongARM, NEC V850, Motorola PowerPC, and +SPARC) including many of the popular variants of these architectures +and evaluation boards. Many new ports are in development and will +be released as they become available. +eCos has been designed to support applications with real-time +requirements, providing features such as full preemptability, minimal +interrupt latencies, and all the necessary synchronization primitives, +scheduling policies, and interrupt handling mechanisms needed for +these type of applications. eCos also provides all the functionality +required for general embedded application support including device +drivers, memory management, exception handling, C, math libraries, +etc. In addition to runtime support, the eCos system includes all +the tools necessary to develop embedded applications, including +eCos software configuration and build tools, and GNU based compilers, +assemblers, linkers, debuggers, and simulators. +To get the most out of eCos you should visit the eCos open +source developers site: http://sources.redhat.com/ecos/ +The site is dedicated to the eCos developer community and + contains a rich set of resources including news, FAQ, online + documentation, installation guide, discussion and announcement + mailing lists, online problem report form, and runtime and + development tools downloads. We also support anonymous CVS and + WEBCVS access to provide you with direct access to the very + latest eCos source base. Complementing the open source + developers site is an eCos product site, featuring news, press + releases, details of our commercial engineering and support + services, products, and third party partner offerings. This is + located at http://www.redhat.com/embedded/technologies/ecos/ +We have released eCos as open source software because we + believe that this is the most effective software development + model, and that it provides the greatest benefit to the embedded + developer community as a whole. As part of this endeavor, we + seek the input and participation of eCos developers in its + continuing evolution. Participation can take many forms + including: + + +providing us with feedback on how eCos might be made more +useful to you - by taking part in the ongoing mailing list discussions +and by submitting problem reports covering bugs, documentation issues, +and missing features + + +contributing bug fixes and enhancement patches + + +contributing new code including device drivers, board +ports, libraries, and other runtime components + + +Our long term aim is to make eCos a rich and ubiquitous standard +infrastructure for the development of deeply embedded applications. +This will be achieved in part by Red Hat's own efforts, +but also with the assistance of the eCos developer community cooperating +to improve eCos for all. I would like to take this opportunity to +extend our thanks to the many eCos developers who have already contributed +feedback, ideas, patches, and code that have augmented and improved this +release. +On behalf of the eCos team, welcome to the eCos developer + community. +Paul Beskeen, +Director of Engineering, eCos +November 2000 + + + +Documentation Roadmap + + + + +Getting Started with eCos + + +Release Notes + +Description of this release. + + + +Installation Guide + +Hardware and software installation instructions, + including instructions on how to execute some prebuilt + tests to verify the installation. + + + +Programming Tutorial + +A tutorial that gets you started running programs with + eCos. + + + +Appendixes + +Extra information about the licensing terms + for eCos. + + + + + + + + +eCos User's Guide + + +The eCos Configuration Tool + +A description of all features of the Configuration Tool. + + + +Programming concepts and + techniques + +An explanation of the + eCos programming cycle, and a + description of some debugging facilities that + eCos offers. + + + +Configuration and the Package + Repository + +Information on how to configure + eCos manually, including a reference + on the ecosconfig command, memory layouts, and information + on how to manage a package repository using the + eCos Package Administration Tool. + + + + + + + + + +eCos Reference Manual + + +Preliminaries + +An overview of the eCos + kernel and configurability system. + + + +Kernel APIs + +In-depth description of + eCos"s native C kernel API, the + µITRON API, the ISO standard C + library, and the eCos Hardware + Abstraction Layer (HAL). Important considerations are + given for programming the eCos + kernel. The semantics for each kernel function are + described, including how they are affected by + configuration. + + + +eCos Device Drivers + +A description of the philosophy behind + eCos device drivers, as well as a + presentation of the C language API for using the current + device drivers. + + + +The ISO Standard C and Math Libraries + +eCos comes with an + implementation of the ISO C library specification. This + section gives details about the implementation, lists the + few functions that are not yet implemented, and gives a + complete reference for configuring the C library. + + + + + + +
+ +Release Notes + +This release of eCos supports the following + architectures: + + +Matsushita MN10300 (AM31) + + +Matsushita AM33 + + +Toshiba TX39 (MIPS R3900 derivative) + + +Toshiba TX49 (MIPS R4900 derivative) + + +PMC-Sierra RM7000A (MIPS IV ISA) + + +Motorola PowerPC MPC823, MPC850, and MPC860 + + +Fujitsu SPARClite MB86831, MB86832, and MB86833 + + +Advanced RISC Machines ARM7 and ARM9 +(including Thumb support on the appropriate cores) + + +Intel StrongARM + + +Intel XScale + + +MIPS 4Kc and 5Kc + + + +NEC VR4100 + + +NEC VR4300 + + +Hitachi SH3 + + +Hitachi SH4 + + +NEC V850 family (SA1 and SB1) + + +i386 PC and compatibles + + +Linux i386—synthetic Linux target + + +and supports the following target platforms: + + +Matsushita MN10300 stdevall (AM31) + + +Matsushita STB System reference Board (AM33) + + +Toshiba JMR3904 (TX39) + + +Toshiba REF4955 (TX49) + + +Momentum Computer Inc. Ocelot (PMC-Sierra RM7000A) + + +Cogent CMA 101/102 evaluation boards with a CMA287-23 +(MPC823), CMA287-50 (MPC850), or CMA 286-60 (MPC860) daughterboard + + +Motorola MBX860 + + +Motorola FADS (MPC860) This board is not supported by +Red Hat. See the file hal/powerpc/fads/&Version;/README + for details. + + +Fujitsu SPARClite Evaluation Board (SPARClite MB86831, +MB86832, and MB86833) + + +ARM PID (ARM7/ARM7t/ARM9) + + +ARM AEB-1 (revision B and C) evaluation boards + + +Cirrus Logic CL-PS7111 (ARM710A CPU) evaluation board, +also known as EB7111 + + +Cirrus Logic EP7209, EP7211 and EP7212 development boards +(ARM720T CPU) also known as EDB7209, EDB7211 and EDB7212 respectively. + + Cirrus Logic EP7312 development board (ARM720T CPU core) +also known as EDB7312 “Maverick” + + +Cogent CMA 101/102 evaluation boards with CMA230 +(ARM7tdmi) and CMA222 (ARM710) daughterboards —support +for this platform is still “beta” + + +ARM Evaluator7T + + +Intel StrongARM SA110 EBSA-285 evaluation board + + +Intel StrongARM SA1100 Evaluation Platform (Brutus) + + +Intel StrongARM SA1100 Multimedia Board + + +Intel StrongARM SA1110 Microprocessor Evaluation Platform +(Assabet) + + +Compaq iPAQ PocketPC (Intel StrongARM SA1110) + + +Bright Star Engineering nanoEngine and commEngine (Intel +StrongARM SA1110) + + +Intel XScale IQ80310 Software Development +and Processor Evaluation Kit + + +MIPS Malta and Atlas boards + + +NEC DDB-VRC4373 (VR4300) + + +NEC V850 Cosmo evaluation boards (CEB-V850/SA1 +and CEB-V850/SB1) + + +Hitachi EDK7708 + + +Hitachi HS7729PCI + + +Hitachi Solution Engine 77x9 + + +Hitachi Solution Engine 7751 + + +CQ SH-3 evaluation board (CqREEK 7708) + + +CQ SH-4 evaluation board (7750) + + +Standard PC motherboard + + +Linux (i386) - synthetic Linux target (i386 +and compatibles) + + +This release also supports the following host +operating systems: + + +UNIX (Redhat Linux, and Solaris + are the only tested UNIX variants). + + +Microsoft® Windows NT®, Windows 95®, +Windows 98®, Windows 2000®. Note that support +for Windows 95, 98 and 2000 is still “beta”. + + + + +Notation and Conventions +Since there are many supported target architectures, +notation conventions are used in this manual to avoid repeating +instructions that are very similar. + + + + +GDB and <!-- <index></index> --> +GCC Command Notation +Cross-development commands like gcc and gdb will +be shown without prefixed information about the platform for which +you are cross-compiling. You need to add the necessary prefix before +you execute the commands, so instead of simply typing gcc and gdb, +as illustrated in the various example in this manual, use: + +arm-elf-gcc/thumb-elf-gcc and arm-elf-gdb/thumb-elf-gdb for +ARM, Thumb and Intel StrongARM +xscale-elf-gcc and xscale-elf-gdb for +Intel XScale +mips64vr4300-elf-gcc and mips64vr4300-elf-gdb for +MIPS vr4300 +mips64vr4100el-elf-gcc and mips64vr4100el-elf-gdb for +MIPS vr4100 +mips-tx39-elf-gcc and mips-tx39-elf-gdb for +MIPS tx39 +mips-tx49-elf-gcc and mips-tx49-elf-gdb for +MIPS tx49 +mipsisa32-elf-gcc and mipsisa32-elf-gdb for +PMC-Sierra RM7000A, MIPS 4Kc & 5Kc, +mn10300-elf-gcc and mn10300-elf-gdb for +MN10300 +powerpc-eabi-gcc and powerpc-eabi-gdb for +PowerPC +sh-elf-gcc and sh-elf-gdb for +SH +sparclite-elf-gcc and sparclite-elf-gdb for +SPARClite +v850-elf-gcc and v850-elf-gdb for +NEC V850 +i386-elf-gcc and i386-elf-gdb +for standard PC +i686-pc-linux-gnu-gcc and i686-pc-linux-gnu-gdb for +Synthetic Linux. +Note that the GCC cross compiler generates executable + files with the .exe suffix on Windows, + but not on UNIX. The suffix .exe will + be omitted from executable file names, so you will see + hello instead of + hello.exe. + + + + + +Directory and File System Conventions +The default directory for installing eCos on Windows (usually C:/Program Files/Red Hat/eCos) is different +from that on UNIX (usually /usr/local/ecos-1.5.x). +Since many command line examples in the tutorials use these paths, +this default (base) directory will be cited as BASE_DIR. +Windows and UNIX have a similar file system syntax, but the +MS-DOS command interpreter on Windows uses the backslash character +(\) as a path separator, while UNIX and POSIX shells (including +the Cygwin bash shell for windows) use the forward slash (/). +This document will use the POSIX shell convention of forward +slashes throughout. + + + + + +Version Conventions +This manual outlines the features of eCos version 1.5.x. +The initial release version was 1.4, and additional 1.4 releases +will incorporate one or more additional numbers, represented in +this manual by “x”. Please note the exact version +number of the version that you are using, because it is incorporated +in certain file paths. + + + +<!-- <index></index> -->Release Overview +The Embedded Configurable Operating System (eCos) software +consists of +a set of tools and a run-time environment +for developing embedded applications. It is a configurable, open +source framework that allows you to build a run-time system that +closely matching the needs of your application. +eCos is aimed at embedded software developers who use architectures +with tight memory constraints, who want a portable framework for +developing their applications. +If you want to start programming eCos immediately, see and . + + + + +Hardware Abstraction +eCos includes a Hardware Abstraction Layer +(HAL) that hides the specific features of each supported CPU and +platform, so that the kernel and other run-time components can be +implemented in a portable fashion. +The eCos HAL has now been ported to numerous architectures, +and to one synthetic target, Linux i386. Notes on porting the HAL +to new platforms are provided in the eCos Reference +Manual under Kernel porting notes in The eCos Hardware Abstraction +Layer section. + + + + + +<!-- <index></index> -->Embedded Kernel +The core of eCos is a full-featured, flexible, and configurable +embedded kernel. +The kernel provides, among other features, multi-threading, +a choice of schedulers, a full set of synchronization primitives, +memory allocation primitives, and thread manipulation functions +(see the eCos Reference Manual for the full +kernel API). +The kernel is designed such that some parts of it can be changed +or replaced without affecting other kernel components. +The following is a partial list of +kernel features: + + +choice of memory allocation algorithm + + +choice of scheduling algorithm + + +a rich set of synchronization primitives + + +timers, counters, and alarms + + +interrupt handling + + +exception handling + + +cache control + + +thread support + + +kernel support for multi-threaded debugging with GDB + + +trace buffers + + +infrastructure and instrumentation + + +The kernel API and configuration are described in the + eCos Reference Manual. + + + + + +<!-- <index></index> -->Configurability + +The eCos kernel and other components can be configured in +great detail at compile time, which avoids the need to add unwanted +code to the library to be linked with your application code. There +is no performance penalty for configuration. + + +Configuration is fine-grained, so that very +small details of eCos' behavior can be tuned by selecting +different configuration options + +eCos is organized as a component architecture, with a language +to describe the constraints between the components and individual +configuration options. These constraints are necessary to resolve +inconsistent configurations, such as disabling the code which handles +the real-time clock, while enabling per-thread timers. + +The designer of a component or general-purpose +library should write configurable code using a component +definition language (CDL). Once that has been done there is no additional +burden on the end user (i.e. an embedded systems developer), who +will be able to use eCos' graphical Configuration Tool +to configure the kernel and basic libraries without needing to understand +how the configuration infrastructure works. + +A tutorial explaining how to configure eCos is located in . +The eCos User's Guide has more detailed +information on running the Configuration Tool and +CDL. + + + + + +µITRON and Other Operating Systems + +eCos' configurability is the key to simulating different +operating systems by using compatibility layers on top of eCos' kernel, +because the semantics of basic kernel functions can be configured +to match the semantics of other operating systems. + +The specification for the µITRON +operating system has been implemented on top of eCos. µITRON +is configured by selecting appropriate options in the kernel (a +real-time clock, the scheduler, +and no timeslicing); and writing a thin layer to map the µITRON +system calls. + +The µITRON port implements the +complete µITRON 3.02 “Standard +functionality” (level S) specification, as well as some +of the “Extended” (level E) functions. The µITRON +implementation is described in more detail in the eCos Reference +Manual. + + + + + +<!-- <index></index> -->ISO C Library +The ISO C and math library shipped +with eCos was written to be configurable and tightly integrated +with the kernel and the HAL. +By carefully selecting configuration options in the C library, +you can significantly reduce the size of the final executable image. + + + + + +Serial Device Drivers +eCos provides serial device drivers for all +supported eCos platforms, with the exception of the i386 Linux synthetic +target and most simulator platforms. The serial drivers provide +an API (documented in the eCos Reference Manual) to control serial +ports directly. The standard I/O library +can be configured to use them as a transport layer. + + + + + +<!-- <xref> -->Monitor Image + +RedBoot +The new standard bootstrap and debugging environment for Red +Hat embedded systems is RedBoot, a configurable and extensible command +line application which provides serial and network debugging and +FLASH management. Based on the eCos HAL, RedBoot supports eCos, +GNUPro applications and embedded Linux systems on a wide range of +architectures, including ARM, MIPS, MN10300, PowerPC, SHx, v850 and +x86. +Redboot provides a GDB stub allowing debugging with the GDB +debugger, and is supplied as a standalone application with the eCos +distribution. See also the RedBoot User's Guide. +RedBoot is recommended for all platforms. Only those platforms +mentioned below where there is (presently) no RedBoot support, should +CygMon or bare GDB stubs be used. + + +CygMon + + +eCos ships with a CygMon ROM +monitor for the MN10300, TX39, SPARClite, EP7209, EP7211 and EP7212 Development +Boards. This includes a GDB stub, thus allowing GDB +to be used to debug eCos applications on these evaluation boards. For +the Brutus board, two stubs are provided: one with the high FLASH portion +and the other with the low FLASH portion. In addition to shipping +the actual ROM, the image of that ROM is provided in case you need +to burn identical copies for additional boards (see ). + +The TCP stack in the SPARClite version of CygMon uses timer1 +of the 86940 as a freerunning millisecond counter. This means timer1 +cannot be used by the application. + +For the MN10300, TX39 and SPARClite port of CygMon, the source +code to it is included as part of the GNUPro package, so that you +may recompile it as described in the GNUPro documentation. +For the port of CygMon to the EP7211 and +EP7212 Development Boards, the source code to CygMon is included +as an integral part of eCos. See for +information on how to rebuild CygMon for the EP7211.Please note that releases of CygMon previous to the one currently +supplied with eCos are incompatible with eCos. + + +<!-- <conditionaltext> -->GDB +Stubs +For the AM33 STB and MN10300 stdeval1, PowerPC MBX860, PowerPC +Cogent, EBSA 285, EDK7708, CQ7708, CQ7750, +VRC4373, +and ARM PID, ARM Cogent, ARM AEB, Cirrus Logic EDB7211 and EDB7209/7212, +TX39 jmr3904, CEB-V850/SA1 +and CEB-V850/SB1 targets, the ROM images include a GDB +stub. This allows GDB to connect to the board and download eCos +programs. +For the TX49 REF4955, eCos ships with a GDB stub image in +SREC format which must be programmed into the board’s FLASH +memory. +For the AM33 STB, ARM AEB-1 EBSA 285, SA1100 (Brutus) and +SA1110 (Assabet), the ROM image includes a GDB stub that can be +installed in the FLASH ROM on the board. +No monitor image is required for the synthetic Linux target. + + + + + + +Tests and Examples +Test suites are included for every portion of eCos shipped +in this release. These are brief programs that test the behavior +of most system calls and libraries in eCos. describes +how to build and run these test suites. +The last chapters of provide examples +that guide you the steps required for running eCos applications, +starting from a “Hello world” program and then +moving on to more complex programs that use additional kernel features. + + + + + +GNU Tools and their Documentation +Red Hat's GNUPro Toolkit, which includes +the GCC and G++ compilers +and the GDB debugger, is needed to build eCos applications. +It is bundled with the CD-ROM distribution of the eCos Developer's +Kit, and is also available on the net at +http://sources.redhat.com/ecos/ + +Online HTML versions of the full GNUPro documentation are +included with eCos, as well as a specific GNUPro tools reference +guide for your hardware architecture, customized for use with eCos. +The full GNUPro documentation can also be found on the web at: + http://www.redhat.com/support/manuals/gnupro.html + +The Linux synthetic i386 target is an exception, as there +is (currently) no GNUPro manual. However, the GNUPro source archive +contains documentation for the tools. This documentation is usually +also included as part of a default Red Hat Linux installation, accessible +with the info program. + + + + + + +eCos Documentation +The eCos documentation set includes Getting Started with eCos, +the eCos User's Guide, the eCos Reference +Manual, and a GNUPro Reference Manual for your specific +architecture. +For users of the eCos Net releases, these are available online +in HTML format at + http://sources.redhat.com/ecos/ + + + +<!-- <index></index> -->Package Contents + + + + +<!-- <conditionaltext> --><!-- <index></index> -->eCos Net Release +The eCos Net Release consists of the archive files for + GNUPro and eCos, which are located on the Red Hat eCos web + site: http://sources.redhat.com/ecos/ +The eCos Net Release, because it is digitally distributed +only, does not provide ROM images for the various development +boards. However, the ROM images for the supported hardware +platforms are included in the distribution, so you can burn your +own Flash ICs to work with eCos. +HTML versions of the GNUPro and eCos manuals are included +in the distribution, and are also available online. + + + + + +eCos Developer’s Kit +If you have a CD distribution of the eCos + Developer’s Kit, you will find the following items in + your package: + + +A card to request printed eCos documentation (Getting +Started with eCos, the eCos User’s +Guide, and the eCos Reference Manual), and +the complete GNUPro documentation suite, including an eCos-specific +reference manual for your architecture. +With this card you can also request a copy of a book by Dr. +Ken Sakamura: µITRON 3.0 An Open and +Portable Real-Time Operating System for Embedded + Systems. + + +eCos version 1.5.x CD-ROM with source code and precompiled +binaries. + + + +MN10300 Package +The MN10300 package contains eCos-specific +monitor PROMs for the Matsushita stdeval1 evaluation board. There +are no extras for the Matsushita AM33 System Reference Board in +the Developers’ Kit. + + +TX39 Package +The TX39 package contains eCos-specific monitor +PROMs for the Toshiba JMR3904 evaluation board. + + +TX49 Package +The TX49 package does not contain anything in addition to +the installation CD. + + +PowerPC Package +The PowerPC package contains an eCos-specific +PROM for either the Motorola PowerPC MBX860 evaluation board or +the Cogent evaluation board. +The PROM for the Cogent board can be used in all three types +of daughterboards (CMA287-50, CMA287-23 and CMA286-60). + + +SPARClite Package +The SPARClite package contains an eCos-specific +monitor PROM for the Fujitsu SPARClite Evaluation Board. + + +<!-- <conditionaltext> -->ARM Package +The ARM package contains an eCos-specific PROM +for the PID evaluation board or the Cogent evaluation board. This +PROM contains a Thumb-aware stub. There are no extras for the AEB-1, +EDB7111 or EDB7211 boards in the Developer's Kit. + + +StrongARM Package +The StrongARM package contains no extras for +any StrongARM boards in the developers’ kit. + + +VR4100 Package +The VR4100 package contains no extras in the +developers’ kit. + + +VR4300 Package +The VR4300 package contains an eCos-specific +PROM for the NEC VRC4373 evaluation board. + + +CEB-V850 Package +The CEB-V850 package contains no extras in +the developers’ kit. + + +SH3 Package +The SH package contains both big-endian and +little-endian versions of the eCos stub PLCC ROM for the Hitachi +SH3 EDK7708 board. +For the CQ CQ7708 board, a GDB stub image suitable for programming +into ROM or EPROM is provided. + + + + +<!-- <index></index> -->System Requirements + + + + +Required + + +Standard Intel + architecture PC running Linux (tested on Red Hat Linux distributions +5.0-7.0), and English or Japanese versions of Microsoft Windows +NT version 4.0 (service pack 3 or above must be installed), Windows +95, Windows 98, or Windows 2000. Other versions of Red Hat distributions, +or Linux distributions from other vendors should work as well. + + +Windows NT users must install Internet + Explorer 4.0 or later, since this will ensure correct + operation of the Configuration + Tool . +Sun workstation running Solaris 2.5.1 +or later for the SPARC. +Support for any platform except for Windows NT 4.0, Solaris +2.5.1 and Linux is beta. In particular, rebuilding the GNUPro compiler +toolchain is only supported and tested on Windows NT 4.0, Solaris +2.5.1, and Red Hat Linux. + + +Enough +disk space for the installed distribution. The eCos installation +process will detail the various components of eCos and the GNUPro +toolkit that can be installed, and their disk space requirements. + + +64MB of RAM and a 350MHz or faster Pentium processor. + + +If you are downloading the eCos Net Release distribution from +Red Hat's sources.redhat.com site, you will also need space +to store that image and to compile GNUPro and eCos from source. +If you will be using the MN10300 stdeval1 board, +you will also need: + + +One 16550-based serial port on the PC + + +A Matsushita MN10300 standard evaluation board with eCos + CygMon Debug PROMs +installed + + +One standard modem (straight connection) serial cable +to connect the serial port on the PC to the evaluation board. An +optional second serial cable can be used for diagnostic I/O. + + +If you will be using the AM33 STB system reference +board, you will also need: + + +One 16550-based serial port on the PC + + +A Matsushita AM33 STB System Reference Board, with the +ability to download using the JTAG debugger. To enable debugging +using GDB, the eCos “GDB stubs ROM” will need to have +been programmed into the Flash ROM. + + +Connection to the host computer should be made using a +null modem RS232 serial cable. A gender changer may also be required. + + +If you will be using the TX39 JMR3904 board, +you will also need: + + +One 16550-based serial port on the PC + + +JMR-TX3904 RISC Processor Reference Board with eCos + CygMon Debug EPROMs installed + + +A null modem cable to connect the serial port on the PC +to the evaluation board + + +If you will be using the TX49 REF4955 board, you will also +need: + + +One 16550-based serial port on the PC + + +TX49 REF4955 board with eCos GDB stubs programmed into +the FLASH + + +If you will be using the PowerPC Cogent board, +you will also need: + + +One 16550-based serial port on the PC + + +Cogent CMA101/102 evaluation board with a CMA287-23 +(MPC823), CMA287-50 (MPC850), or CMA286-60 (MPC860) daughterboard +and eCos “GDB stubs” ROM +installed. Information and online manuals for the Cogent board can +be found at http://www.cogcomp.com/. + + +Serial cable to connect the serial port on the PC to the +RJ-11 serial I/O connector, P12 (CMA101) or P3 (CMA102), +on the evaluation board. + + +If you will be using the PowerPC MBX860 board, +you will also need: + + +One 16550-based serial port on the PC + + +Motorola PowerPC MBX860 evaluation board and eCos +GDB stubs” ROM installed. + + +Suitable serial cable to connect the serial port on the +PC to the SMC1/COM1 connector on the evaluation board. + + +If you will be using the Fujitsu SPARClite +Evaluation Board, you will also need: + + +One 16550-based serial port on the PC (only required if +using the serial connection). + + +Fujitsu SPARClite Evaluation Board with a CygMon ROM + installed. + + + +Null modem cable to connect the serial port on the PC +to the CON1 serial I/O connector on the evaluation board. + + +An ethernet connection between the PC and the evaluation +board (possibly via a LAN). The ethernet connection is not necessary +if you have a serial connection, but it does improve download speeds +immensely. + + +If you will be using the ARM +PID evaluation board, you will also need: + + +One (16550 based) serial port on the PC + + +ARM PID evaluation board with eCos + +GDB stubs ROM installed, or GDB stubs programmed in the FLASH ROM +(see ). + + +Null modem cable to connect the serial port on the PC +to the SerialA serial I/O connector on the evaluation board. + + +If you will be using the ARM AEB-1 evaluation +board, you will also need: + + +One (16550 based) serial port on the PC + + +ARM AEB-1 evaluation board with eCos +GDB stubs ROM image installed in the FLASH ROM. + + +Null modem cable to connect the serial port on the PC +to the serial I/O connector on the evaluation board. + + +If you will be using the ARM Evaluator-7T evaluation +board, you will also need: + + +One (16550 based) serial port on the PC + + +ARM E7T evaluation board with RedBoot image installed +in the FLASH ROM. + + +Null modem cable to connect the serial port on the PC +to the serial I/O connector on the evaluation board. + + +If you will be using the Cogent CMA230 evaluation +board, you will also need: + + +One (16550 based) serial port on the PC + + +Cogent CMA101/102 evaluation board with a CMA +(ARM7tdmi) daughterboard and eCos + +GDB stubs ROM installed. Information and online manuals for the +Cogent board can be found at http://www.cogcomp.com/ + + + +Serial cable to connect the serial port on the PC to the +RJ-11 serial I/O connector, P11 (CMA101) or P3 (CMA102), +on the evaluation board. + + +If you will be using the Cirrus Logic CL-PS7111 +Evaluation Board, you will also need: + + +One 16550-based serial port on the PC. + + +A Cirrus Logic CL-PS7111 Evaluation Board with an eCos +GDB stubs ROM image installed in the FLASH ROM. + + +Custom cable that is supplied with the CL-PS7111 Evaluation +Board connected from a serial port on the PC to the serial I/O +connector labelled “Serial Port 1”. + + +If you will be using the Cirrus Logic EP7209, +EP7211 or EP7212 Development Boards, you will also need: + + +One 16550-based serial port on the PC. + + +A Cirrus Logic ARM EP7211 or EP7212 Development Board, +with either a RedBoot, CygMon or GDB stub ROM image installed in +the FLASH ROM. + + +If connecting with a serial cable, use a null modem cable +to connect the serial port on the PC to the serial I/O +connector labelled “UART 1” on the EP7211 Development +Board, and “Serial Port 0” on the EP7209 and EP7212 +Development Boards. A gender changer may also be required. + + +If you will be using the Cirrus Logic +EP7312 Development Boards, you will also need: + + + +One 16550-based serial port on the PC. + + +A Cirrus Logic ARM EP7312 Development System +with RedBoot installed in +the FLASH ROM. + + +If connecting with a serial cable, use a null modem cable +to connect the serial port on the PC to either serial I/O +connector on the EP7312 Development Board. +A gender changer may also be required. +Alternatively you can connect using the standard ethernet +connector on the board. + + + +If you will be using the Intel StrongARM EBSA-285 +evaluation board, you will also need: + + +Intel StrongARM EBSA-285 evaluation board with RedBoot +or eCos GDB stubs ROM image installed +in the FLASH ROM. + + +If serial debugging is to be used: + + +One (16550 based) serial port on the PC + + +Null modem cable to connect the serial port on the PC +to the serial I/O connector on the evaluation board. A +gender changer may also be required. + + +If network debugging is to be used: + + +Suitable network interface card on the development PC +and connecting cables + + +If you will be using the Bright Star Engineering commEngine +or nanoEngine boards, you will also need: + + +BSE commEngine or nanoEngine board with RedBoot image +installed in the FLASH ROM. + + +If serial debugging is to be used: + + +One (16550 based) serial port on the PC + + +Null modem cable to connect the serial port on the PC +to the serial I/O connector on the evaluation board. A +gender changer may also be required. + + +If network debugging is to be used: + + +Suitable network interface card on the development PC +and connecting cables + + +If you will be using the Intel SA1100 Evaluation Platform +(Brutus), you will need: + + +One 16550-based serial port on the PC + + +Intel SA1100 board with RedBoot, CygMon or eCos GDB stubs +programmed into the FLASH + + +If you will be using the Intel SA1100 Multimedia Board, you +will need: + + +One 16550-based serial port on the PC + + +Intel SA1100MM board with RedBoot installed into FLASH + + +If you will be using the Intel SA1110 Evaluation Platform +(Assabet), you will need: + + +Intel SA1110 board with RedBoot, CygMon, or eCos GDB stubs +programmed into the FLASH + + +If serial debugging is to be used: + + +One 16550-based serial port on the PC + + +If network debugging is to be used: + + +A Compact Flash ethernet card for the platform for use +with network debugging under RedBoot + + +A suitable network interface card on the development PC +and connecting cables + + +If you will be using the Compaq iPAQ PocketPC, you will need: + + +Compaq iPAQ with RedBoot programmed into the FLASH + + +If serial debugging is to be used: + + +One 16550-based serial port on the PC + + +Cradle or cable to connect to the host PC + + +If network debugging is to be used: + + +A Compact Flash ethernet card for the platform for use +with network debugging under RedBoot + + +Cradle and connectors for the CF ethernet card. + + +A suitable network interface card on the development PC +and connecting cables + + +If you will be using the Intel XScale IQ80310 +Evaluation Kit, you will also need: + + +Intel IQ80310 board with RedBoot installed in the FLASH. + + +If serial debugging is to be used: + + +One (16550 based) serial port on the PC + + +Null modem cable to connect the serial port on the PC +to the serial I/O connector on the evaluation board. A +gender changer may also be required. + + +If network debugging is to be used: + + +Suitable network interface card on the development PC +and connecting cables + + +If you will be using the NEC VRC4373 evaluation +board, you will also need: + + +One (16550 based) serial port on the PC + + +NEC4373 evaluation board with eCosGDB +stubs” ROM installed. + + +Straight-thru cable to connect the serial port on the +PC to the serial I/O connector J1 on the evaluation board + + +If you will be using the Momentum Computer +Inc. PMC-Sierra RM7000A based Ocelot board, you will also need: + + + +One (16550 based) serial port on the PC + + +Ocelot board with RedBoot image installed in FLASH ROM. + + +Null modem cable to connect the serial port on the PC +to the serial I/O connector on the evaluation board. A +gender changer may also be required. + + +If you will be using the Hitachi EDK7708 board, +you will also need: + + +One (16550 based) serial port on the PC + + +Hitachi EDK7708 board with a SH3/7708 CPU and +eCosGDB stubs” installed in +FLASH. + + +Serial cable (provided with the board) to connect the +serial port on the board. + + +If you will be using the SH3 CQ7708 board, you will also + need: + + +One 16550-based serial port on the PC. + + +CQ CQ7708 board with a SH3/7708 CPU and eCos +GDB stubs installed. + + +If you will be using the SH3 HS7729 board, you will also + need: + + +One 16550-based serial port on the PC. + + +Hitachi HS7729PCI board with a SH3/7729 CPU and +RedBoot installed. + + +If you will be using the SH3 SE77x9 board, you will also + need: + + +One 16550-based serial port on the PC. + + +Hiatchi Solution Engine 7709/7729 board with +a SH3/7709 or SH3/7729 CPU and RedBoot installed. + + +If you will be using the SH4 SE7751 board, you will also + need: + + +One 16550-based serial port on the PC. + + +Hitachi Solution Engine 7751 board with a SH4/7751 +CPU and RedBoot installed. + + +If you will be using the SH4 CQ7750 board, you will also + need: + + +One 16550-based serial port on the PC. + + +CQ CQ7750 board with a SH4/7750 CPU and eCos +GDB stubs installed. + + +If you will be using the NEC V850 Cosmo Evaluation +Board, you will also need: + + +NEC CEB-V850/SA1 or NEC CEB-V850/SB1 +board with eCos GDB stubs installed in the EPROM. + + +Serial cable to connect the serial port on the PC to the +DB-9 connector on the CEB-V850 + + +If using the NEC V850 I.C.E. kit for development, you will +also need: + + +a PC running Microsoft Windows, to run the Windows-only +NEC software + + +The +v850ice.exe +”libremote” application to provide an interface +between the NEC software and the GDB debugger. + + +If you will be using an x86 board, you will also need: + + +A standard PC motherboard with an i386 or better processor +and a 3.5” floppy disk drive. Optionally, a color text-mode-only +display card with monitor or keyboard may also be provided. Any +standard PC will provide all the hardware required to run eCos. + + +If serial debugging is to be used: + + +A null modem cable to connect the COM1 port on the target +motherboard to a serial port on the host system. + + +If network debugging is to be used: + + +Suitable network interface card on the development PC +and connecting cables + + +An Intel i82559 based PCI ethernet card (for example an +Intel EtherExpress Pro 10/100) may be installed for use +by the eCos network stack or for network debugging. + + +If you will be using the Linux +synthetic target, you will also need: + + +An x86 PC with an installed Linux distribution (tested +with Red Hat Linux distributions 5.0 - 7.0). + + + + + + + +Recommended + + +A Pentium II computer and 64MB or more of RAM are recommended +for best build performance. + + +The system has been tested only in the recommended configuration +above, although other configurations are expected to work. + + + +Reporting Problems +Reporting bugs and other problems is very important: it allows +Red Hat to solve your problem quickly, and improves the eCos product. +The effort you make in reporting problems is appreciated. +To submit a problem report, please use the +web interface. If you have a CD distribution of the eCos Developer's +Kit, you should use the address: http://support.cygnus.com/ +You will need a login name and an ID, provided by your administrator. +If you are using the eCos Net release you should use the address +http://sources.redhat.com/ecos/problemreport.html + + + + +Known Bugs in eCos and GNUPro +Before filing bug reports, however, please read the README +provided with this release. It describes known problems and possible +workarounds in eCos or with the GNUPro Toolkit. The file is at the +base of the distribution. + + + + + +How to Report Problems +For documentation discussing methods of reporting on, +editing and querying, see the following Accessing Red Hat Web Support +to Report Problems, or Additional Options in this chapter. +This documentation serves only as a guide and it is not meant +to supercede the Help documentation on the Web Support site. We +have tried to make our software as trouble-free as possible. If +you do encounter problems, we'd like to diagnose and fix +the problem as quickly as possible. + +<!-- <xref> --><!-- <xref> --><!-- <xref> --><!-- <xref> -->Accessing Red Hat Web Support to +Report Problems +If you have a CD distribution, use the following instructions +to access the Red Hat Support website. + + +Use the following URL in your web browser's +address or location dialog box. +http://support.cygnus.com/ + + +Click on the Case Management System icon, enter +your ID and password, and the Welcome page will be displayed. + + +
+Welcome page for the Red Hat web support site + +
+Access the Welcome page at any time +by using the Welcome link (in the +navigation bar on the left side of each Web Support page). +If you have the CD distribution, your details will have been +entered in the database, and will be displayed on the Welcome page. +If you wish to alter these details, select the Profile link in the +navigation bar on the left side of the page. + + +Use the links included in the navigation bar on +the left side of the page to perform any of the following Red Hat +Web Support activities. + + +New Case +(see , , and the Red Hat Support website) + + + Query Case +(see Additional options, and the Red Hat Support +website) + + + +Add Notes +(see Additional options, and the Red Hat Support +website) + + + Find Solutions +(see Additional options, and the Red Hat Support +website) + + + +Profile +(see Additional options, and the Red Hat Support +website) + + + Help +documentation see Additional options, and the +Red Hat Support website) + + + Close Case +(see Additional options, and the Red Hat Support +website) + + +
+ +<!-- <xref> --><!-- <xref> -->Submitting a Support Request +Use the following instructions to submit a support request, +once you have a valid ID established. + + +Click on +New Case +to create a new reported problem case. + + +The New Case page allows you to complete the creation of a +new case. If there is more than one site, select the site relating +to your problem. + + +Click on + Use This Site ID +button to display a list of the relevant products. + + +Select a product from the list and then click on +the +Create Case for Selected Product +button. +
+New case web page + +
+(Each customer has a valid list of parts of Red + Hat products for which they can submit problem + reports. These components are part of the Web Support + database.) +
+ +Type a brief description of the case in the +Case Title +field. You can enter up to 80 characters in this field. + + +Select a case type from the +Type +drop-down menu that best describes the case. + + +Select a customer severity level from the +Severity +drop-down menu that best describes how severe you view this problem. + + +Select a case priority level from the +Priority +drop-down menu that best describes the priority of this case to +Red Hat. + + +Type a complete description of your case in the +Problem Description +field. + + +Use the scrollbars to scroll text in this field. +You can add up to 30 kilobytes of text in this field. + + +Click on the +Create Case +button at the bottom of the page to create the case in the Red +Hat Web Support database. Alternatively, clear the input fields +on the New Case page, using the +Clear +button. + +
+After you create your case, the Case Details page displays, +which includes the Case ID number that the support database assigns +to your case. +To create a new case for a different site and/or +part, click the New Case link in +the navigation bar; then use the previous instructions. +
+ +<!-- <xref> --><!-- <xref> -->Additional Options +The following documentation discusses the other features +for the Red Hat Web Support site. Red Hat has a database to +help in determining when problems developed, tracking the problems +case from their first report through analysis and resolution. The +database can also be used for correlation with other products as well +as to other related problems. + + + Click on +Query Case +to find an existing problem case in our database. + + +You may examine problem cases in the Red Hat Web Support +database, searching by solution ID or by entering keywords and/or +a key phrase. There are options on this page enabling you to control +how your search works. +At this point, view a problem case's details, +check its status, add notes or close a problem. + + + Click on +Add Notes +to add additional data to an existing case in our database. + + + Click on +Find Solutions +to search for problem solutions in the database. The search +will provide a list of the current problem cases in the Red Hat +Web Support database. + + + Click on +Profile +to change your profile information and/or your Web Support +password in our database. A Profile page will be displayed. + + + Click on +Help +for questions about using the Web Support page. The online help +documentation for the Web Support site supercedes this guide; it +is not meant to supercede the more updated Help documentation for +the Web Support site. + + + Click on +Close Case +link to close a case. Closing a case brings the problem to +its resolution. + + + +Updating your profile +
+Clicking on Profile allows you to Changing your profile +for updating the Red Hat Web support database + +
+Clicking on Profile allows you to enter +the following details (in , + ficticious details were created for the example + problem's reported case). + + + Your contact name + + + The primary phone number where Red Hat Support +can contact you + + + FAX number Red Hat Support can use to send you +information + + + Your e-mail address + + + Your site ID, used to identify your primary site +in the Web Support database +(a Red Hat representative will provide this information) + + + Your site name + + + +
+
+
+
+
+ +<!-- <xref> -->Installation Guide + +<!-- <xref> -->Software Installation + + + + +Software <!-- <index></index> --> +Installation on Windows + + If you have a CD distribution of the eCos +Developer's Kit, you have received the eCos software and +its supporting utilities on a single CD-ROM for installation on +a PC-compatible computer running Windows NT 4.0, Windows 95, Windows +98 or Windows 2000. If you use NT you must apply the NT 4.0 Service +Pack 3 or above before installing eCos. Support is only for Windows +NT 4.0. Installations on other Windows platforms are beta. +The following components are provided on the eCos CD-ROM: + + +eCos source code + + +Prebuilt eCos libraries and tests + + +eCos documentation + + +Red Hat +GNUPro compiler toolchain for eCos source code compilation + + +Red Hat +Cygwin environment: this product provides a POSIX compatibility +layer on top of Windows NT, and supports the GNUPro tools on Windows +NT. + + +The +GNU user tools—a collection of utilities that developers, +particularly those with a UNIX background, will find useful. However, +they are not supported by Red Hat. + + +Documentation for the GNUPro tools, including +a Reference Manual for the particular evaluation board being used +to run eCos. + + +If you have obtained the Net release of eCos +for Windows, you will have the distribution in a self-extracting archive. +Apart from the difference in medium, the installation procedure +for eCos itself will be the same as for the CD-ROM-based distribution. +The software installation process involves a number of installation +utilities. Some familiarity with Windows is assumed. + + + Invoke the file Setup.exe on the CD-ROM. This will +start the installation procedure. If you have the + +feature enabled, Windows will run Setup.exe automatically when +the CD-ROM is inserted into the drive. + + +The setup program will offer to install + the GNU user tools. Click OK. + + + +You will be prompted for a file path in which to install +the GNU user tools. The default will be in the +/cygnus/gnupro/i686-cygwin32/i686-cygwin32 +hierarchy (usually on drive C). It will then offer to install the +source code and documentation for the GNU user tools. It is recommended +that you install the documentation, but not the source code, unless +you are interested in modifying or recompiling the GNU user tools. + + +At this point the setup program will begin installing +eCos. Click +OK. + + +The default path offered for eCos installation will be +in the +/Program Files/Red Hat +hierarchy (usually on drive C). You may change this path, and indeed +you will need to change it if that partition does not have sufficient +free disk space available. It is recommended that you accept the +default selection of software components for installation. + + +You will be asked to select the program folder under which +the eCos menu items will be placed. The default folder name is +Red Hat eCos. + + +The installation should finish normally, offering to show +you the +README +file that contains any last minute information and a list of known +problems detected after this document was printed. Once the installation +is finished, you can start eCos or view the online documentation +by selecting +Start +-> +Programs +-> + Red Hat eCos +, and then choosing an option within this folder, e.g +Configuration Tool +, +Package Administration Tool +, etc. + + +At this point you are ready to configure and build a +customized eCos kernel as described in . + +The order of directories in the PATH is very important, and +build failures may result if the PATH is not set correctly. If you +are having difficulties in building eCos, please make sure you have +set the PATH exactly as above. + + + + + + +<!-- <xref> -->Software <!-- <index></index> --> +Installation on UNIX +Installation and build instructions for the eCos Net release +are available on the Red Hat eCos web site + http://sources.redhat.com/ecos/ + +<!-- <index></index> -->Installing the eCos Developer's Kit under Linux +Users of the eCos Developer's Kit under Red Hat Linux +should use the following instructions, for most of which you will +normally need to be the root user. + + + The CD-ROM must be “mounted” before +installation can proceed. Execute the command: + +# mount /dev/cdrom/ /mnt/cdrom +Install the eCos repository from the RPM file ecos15x.rpm +(where x or xx are final digits of the current version number), +located in the root directory of the CD-ROM using the following +command: + +# rpm -i /mnt/cdrom/ecos15x.rpm + +Note that root privileges are required to perform this installation. +On completion, the eCos repository may be found in the directory /opt/ecos/ecos-1.5.x. + + +Extract the eCos development tools from the compressed +tar archive tool-bin.tgz, located in the root directory of the CD-ROM, +using the following commands: +# mkdir /usr/cygnus +# cd /usr/cygnus +# gunzip -c < /mnt/cdrom/tool-bin.tgz | tar xvf - + + +On completion, the eCos development tools may be found +in the directory +/usr/cygnus/ecos-DEVTOOLSVERSION. The source code for the development tools may optionally be installed +in the same way: + +# gunzip -c < /mnt/cdrom/tool-src.tgz | tar xvf - + + +Add the eCos host tools and development tools to the front +of your path. Under Linux, you should modify the PATH environment +variable as follows. +Using sh, ksh, or bash: + +$ PATH=/opt/ecos/ecos-1.5.x/tools/bin:/usr/cygnus/DEVTOOLSVERSION/H-i686-pc-linux-gnu/bin:$PATH +$ export PATH +Using csh or tcsh: Note that csh also requires the shell command “rehash” after modifying +the path for the path change to take effect. +$ setenv PATH /opt/ecos/ecos-1.5.x/tools/bin:/usr/cygnus/DEVTOOLSVERSION/H-i686-pc-linux-gnu/bin:$PATH +Set the ECOS_REPOSITORY environment variable as follows. +Using sh, ksh or bash: + +$ ECOS_REPOSITORY=/opt/ecos/ecos-1.5.x/packages +$ export ECOS_REPOSITORY +Using csh or tcsh: +$ setenv ECOS_REPOSITORY /opt/ecos/ecos-1.5.x/packages + + +At this point you are ready to configure and build a customized +eCos kernel as shown in . + +The order of directories in the PATH is very important, and +build failures may result if the PATH is not set correctly. If you +are having difficulties in building eCos, please make sure you have +set the PATH exactly as above. + + + +<!-- <index></index> -->Installing the eCos Developer's Kit under Solaris +Users of the eCos Developer's Kit under Solaris should +use the following instructions, which assume that the CD-ROM is +available at /cdrom/cdrom0. + + + Extract the eCos repository from the compressed tar +archive ecos15x.taz (where x or xx are the final digits of +the version number), located in the root directory of the CD-ROM +using the following commands: + +# mkdir /usr/local +# cd /usr/local +# zcat < /cdrom/cdrom0/ecos15x.taz | tar xvf - +On completion, the eCos repository may be found in the directory +/usr/local/ecos-1.5.x. + + +Extract the eCos development tools from the compressed +tar archive tool-bin.taz, located in the root + directory of the CD-ROM, using the following commands: + +# mkdir /usr/cygnus +# cd /usr/cygnus +# zcat < /cdrom/cdrom0/tool-bin.taz | tar xvf - +On completion, the executable files of the eCos development tools +may be found in the directory +/usr/cygnus/ecos-DEVTOOLSVERSION/H-host-triplet/bin +The source code for the development tools may optionally be installed +in the same way: + +# zcat < /cdrom/cdrom0/tool-src.taz | tar xvf - + + +Add the eCos host tools, development tools and any native +tools supporting the eCos build process to the front of your path. +Under Solaris you should modify the PATH environment variable as +follows. + +Using sh, ksh, or bash: + +$ PATH=/usr/local/ecos-1.5.x/tools/bin:/usr/xpg4/bin/usr/ucb:$PATH +$ export PATH +Using csh or tcsh: + +Note that csh also requires the shell command "rehash" after modifying +the path for the path change to take effect. + +% setenv PATH /usr/local/ecos-1.5.x/tools/bin:/usr/xpg4/bin:/usr/ucb:$PATH + + +Set the ECOS_REPOSITORY environment varable as +follows: +Using sh, ksh or bash: + +$ ECOS_REPOSITORY=/usr/local/ecos-1.5.x/packages +$ export ECOS_REPOSITORY +Using csh or tcsh: +% setenv ECOS_REPOSITORY /usr/local/ecos-1.5.x/packages + + +At this point you are ready to configure and build a customized +eCos kernel as shown in . + + +The order of directories in the PATH is very important, and +build failures may result if the PATH is not set correctly. If you +are having difficulties in building eCos, please make sure you have +set the PATH exactly as above. + + + + + +<!-- <index></index> --><!-- <xref> --><!-- <index></index> -->Target Setup + + + + +<!-- <index></index> -->Connecting To A Target Via Serial +While eCos supports a variety of targets, communication with +all the targets happens in one of four ways. These are descibed +in general below. +The descriptions are followed by descriptions of each target, +providing specific details of how to set up the target (if hardware) +and the necessary communication information (such as baud rate for +hardware targets, or special connection options for simulator targets). +Most targets will have eCos GDB stubs or RedBoot installed. +These normally wait for GDB to connect at 38400 baud, using 8 data +bit, no parity bit and 1 stop-bit (no hardware flow control). Check +the section for your target to ensure it uses this speed. If not, +adjust the following instructions accordingly. +The following instructions depend on your having selected +the appropriate serial port on the host. That is, the serial port +which connects to the target's (primary) serial port. On +Linux this could be /dev/ttyS0, +while the same port on Windows would be named COM1, or /dev/ttya on +Solaris. Substitute the proper serial port name in the below. +Connect to the target by issuing the following commands in +GDB console mode: +(gdb) set remotebaud 38400 +(gdb) set mips saved-gpreg-size 32 (for VR4300) +(gdb) target remote /dev/ttyS0 +In Insight, connect by opening the File->Target +Settings window and enter: +Target: Remote/Serial +Baud Rate: 38400 +Port: /dev/ttyS0 +Set other options according to preference, close the window +and select +Run->Connect to target. + + + + + +<!-- <index></index> -->Connecting To A Target Via Ethernet +Some targets allow GDB to connect via Ethernet - if so, it +will be mentioned in the section describing the target. Substitute +the target's assigned IP address or hostname for <hostname> in +the following. The <port> is the TCP port which +the eCos GDB stub or CygWin is listening on. It is also listed in +the section describing the target. +Connect to the target by issuing the following command in +GDB console mode: +(gdb) target remote <hostname>:<port> +In Insight, connect by opening the File->Target +Settings window and enter: +Target: Remote/TCP +Hostname: <hostname> +Port: <port> +You will also need to open the GDB console window with View->Console and +enter “set mips saved-gpreg-size 32” at the prompt +Set other options according to preference, +close the window and select +Run->Connect to target. + + + + + +<!-- <index></index> -->Connecting To A Simulator Target +GDB connects to all simulator targets using the same basic +command, although each simulator may require additional options. +These are listed in the section describing the target, and should +be used when connecting. +Connect to the target by issuing the following command in +GDB console mode: +(gdb) target sim [target specific options] +In Insight, connect by opening the File->Target +Settings window and enter: +Target: Simulator +Options: [target specific options] +Set other options according to preference, close the window +and select +Run->Connect to target. + + + + + +Connecting To A Synthetic Target +Synthetic targets are special in that the built tests and +applications actually run as native applications on the host. This +means that there is no target to connect to. The test or application +can be run directly from the GDB console using: +(gdb) run +or from Insight by pressing the Run icon. +There is therefore no need to connect to the target or download +the application, so you should ignore GDB “target” and “load” commands +in any instructions found in other places in the documentation. + + + + + +MN10300 stdeval1 Hardware Setup +The eCos Developer’s Kit package comes with a pair +of EPROMs which provide GDB support for the Matsushita MN10300 (AM31) +series evaluation board using CygMon, the Cygnus ROM monitor. Images +of these EPROMs are also provided at BASE_DIR/loaders/mn10300-stdeval1/cygmon.bin. +The LSB EPROM (LROM) is installed to socket IC8 on the board and +the MSB EPROM (UROM) is installed to socket IC9. Attention should +be paid to the correct orientation of these EPROMs during installation. +The CygMon stubs allows communication with GDB by way of the +serial port at connector CN2. The communication parameters are fixed +at 38400 baud, 8 data bits, no parity bit, and 1 stop bit (8-N-1). +No flow control is employed. Connection to the host computer should +be made using a standard RS232C serial cable (not a null modem cable). +A gender changer may also be required. + + + + + +MN10300 Architectural Simulator Setup +The MN10300 simulator is an architectural simulator for the +Matsushita MN10300 that implements all features of the microprocessor + necessary to run eCos. The current implementation provides accurate +simulation of the instruction set, interrupt controller, timers, +and serial I/O. +In this release, you can run the same eCos binaries in the +simulator that can run on target hardware, if built for ROM start-up, +with the exception of those that use the watchdog timer. +However, note that AM33 devices required to run eCos are not +simulated; therefore you cannot run eCos binaries built for the +AM33 under the simulator. For the AM33, the simulator is effectively +an instruction-set only simulator. +To simplify connection to the simulator, you are advised to +create a GDB macro by putting the following code in your personal +GDB start-up file (gdb.ini on Windows and .gdbinit on UNIX). +define msim + target sim --board=stdeval1 --memory-region 0x34004000,0x8 + + rbreak cyg_test_exit + rbreak cyg_assert_fail +end +You can then connect to the simulator by invoking the command msim on +the command line: +(gdb) msim +You can achieve the same effect by typing out the macro’s +content on the command line if necessary. + + + + + +AM33 STB Hardware Setup +The Matsushita AM33 STB System Reference Board may be used +in two modes: via a JTAG debugger, or by means of a GDB stub ROM. + +Use with GDB Stub ROM +The eCos Developer’s Kit package comes with a ROM +image which provides GDB support for +the Matsushita(R) AM33 STB System Reference Board. To install the +GDB stub ROM requires the use of the JTAG debugger and the Flash ROM +programming code available from Matsushita. An image of this ROM +is also provided at loaders/am33-stb/gdbload.bin under +the root of your eCos installation. +Ensure that there is a Flash ROM card in MAIN MEMORY SLOT <0>. +Follow the directions for programming a Flash ROM supplied with +the programming software. +The final programming of the ROM will need to be done with +a command similar to the following: +fdown "gdbload.bin",0x80000000,16,1 +Once the ROM has been programmed, close down the JTAG debugger, +turn the STB off, and disconnect the JTAG cable. Ensure that the +hardware switches are in the following configuration: +U U D D D U D D + +D = lower part of rocker switch pushed in +U = upper part of rocker switch pushed in +This is also the configuration required by the Flash programming +code, so it should not be necessary to change these. +Restart the STB and the stub ROM will now be able to communicate +with GDB. eCos programs should be built +with RAM startup. +Programs can then be downloaded via a standard RS232 null +modem serial cable connected to the SERIAL1 connector on the STB +front panel (the AM33"s serial port 0). This line is programmed +to run at 38400 baud, 8 data bits, no parity and 1 stop bit (8-N-1) +with no flow control. A gender changer may also be required. Diagnostic +output will be output to GDB using the same connection. +This procedure also applies for programming ROM startup eCos +programs into ROM, given a binary format image of the program from mn10300-elf-objcopy. + + +Use with the JTAG debugger +To use eCos from the JTAG debugger, executables must be built +with ROM startup and then downloaded via the JTAG debugger. For +this to work there must be an SDRAM memory card in SUB MEMORY SLOT <0> and +the hardware switches on the front panel set to the following: +D U D D D U D D + +D = lower part of rocker switch pushed in +U = upper part of rocker switch pushed in +Connect the JTAG unit and run the debugger as described in +the documentation that comes with it. +eCos executables should be renamed to have a “.out” extension +and may then be loaded using the debugger"s “l” or “lp” commands. +Diagnostic output generated by the program will be sent out +of the AM33"s serial port 0 which is connected to the SERIAL1 +connector on the STB front panel. This line is programmed to run +at 38400 baud, 8 data bits, no parity, and one stop bit (8-N-1) +with no flow control. Connection to the host computer should be +using a standard RS232 null modem serial cable. A gender changer +may also be required. + + +Building the GDB stub ROM image +eCos comes with a pre-built GDB stub ROM image for the AM33-STB +platform. This can be found at loaders/am33-stb/gdbload.bin relative +to the eCos installation directory. +If necessary, the ROM image can be re-built as follows: + + + On Windows hosts, open a Bash session using +Start->Programs->Red Hat eCos->eCos +Development Environment + + +Create a build directory and cd into it + + +Run (all as one line): + +cygtclsh80 BASE_DIR/packages/pkgconf.tcl \ + --target=mn10300_am33 --platform stb --startup rom \ + --disable-kernel --disable-uitron --disable-libc --disable-libm \ + --disable-io --disable-io_serial --disable-wallclock +--disable-watchdog + +where BASE_DIR is the path to the eCos installation +directory. + + +Edit the configuration file +pkgconf/hal.h + in the build directory tree by ensuring the following configuration +options are set as follows: + +#define CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +#define CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT +#undef CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT +#define CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT +#define CYG_HAL_ROM_MONITOR + + + +Run: make + + +Run: make -C hal/common/current/current/src/stubrom + + +The file +hal/common/current/src/stubrom + will be an ELF format executable of the ROM image. Use mn10300-elf-objcopy to +convert this to the appropriate format for loading into the Matsushita +FLASH ROM programmer, mode “binary” in this case: + +$ mn10300-elf-objcopy -O binary hal/common/current/src/stubrom/ \ + stubrom stubrom.img + + + + + + + + +TX39 Hardware Setup +The eCos Developer’s Kit package comes with a pair +of ROMs that provide GDB support for +the Toshiba JMR-TX3904 RISC processor reference board by way of CygMon. +Images of these ROMs are also provided at BASE_DIR/loaders/tx39-jmr3904/cygmon50.bin and BASE_DIR/loaders/tx39-jmr3904/cygmon66.bin for +50 MHz and 66 MHz boards respectively. The ROMs are installed to +sockets IC6 and IC7 on the memory daughterboard according to their +labels. Attention should be paid to the correct orientation of these +ROMs during installation. +The GDB stub allows communication with GDB using the serial +port (channel C) at connector PJ1. The communication parameters +are fixed at 38400 baud, 8 data bits, no parity bit, and 1 stop +bit (8-N-1). No handshaking is employed. Connection to the host +computer should be made using an RS232C null modem cable. +CygMon and eCos currently provide support for a 16Mbyte 60ns +72pin DRAM SIMM fitted to the PJ21 connector. Different size DRAMs +may require changes in the value stored in the DCCR0 register. This +value may be found near line 211 in hal/mips/arch/&Version;/src/vectors.S +in eCos, and near line 99 in + libstub/mips/tx39jmr/tx39jmr-power.S in +Cygmon. eCos does not currently use the DRAM for any purpose itself, +so it is entirely available for application use. + + + + + +TX39 Architectural Simulator Setup +The TX39 simulator is an architectural simulator which implements +all the features of the Toshiba TX39 needed to run eCos. The current +implementation provides accurate simulation of the instruction set, + interrupt controller, and timers, as well as having generic support +for diagnostic output, serial I/O, and exceptions. +In this release, you can run the same eCos binaries in the +simulator that can run on target hardware, if it is built for ROM +start-up. +To simplify connection to the simulator, you are advised to +create a GDB macro by putting the following code in your personal +GDB start-up file (gdb.ini on Windows and .gdbinit on UNIX). +define tsim + target sim --board=jmr3904pal --memory-region 0xffff8000,0x900 \ + --memory-region 0xffffe000,0x4 \ + --memory-region 0xb2100000,0x4 + rbreak cyg_test_exit + rbreak cyg_assert_fail +end +You can then connect to the simulator by invoking the command tsim on +the command line: +(gdb) tsim +You can achieve the same effect by typing out the macro’s +content on the command line if necessary. + + + + + +TX49 Hardware Setup +The eCos installation CD contains a copy of the eCos GDB stubs +in SREC format which must be programmed into the board’s +FLASH memory. + +Preparing the GDB stubs +These stub preparation steps are not strictly necessary as +the eCos distribution ships with precompiled stubs in the directory loaders/tx49-ref4955 relative +to the installation root. + +Building the GDB stub image with the eCos Configuration Tool + + + Start with a new document - selecting the +File->New + menu item if necessary to do this. + + +Choose the +Build->Templates + menu item, and then select the TX49 REF4955 hardware. + + +While still displaying the +Build->Templates + dialog box, select the stubs package template to build a GDB stub. +Click +OK. + + +Build eCos stubs using +Build->Library. + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +images have the prefix gdb_module. + + + + + Building the GDB stub image with ecosconfig + + + Make an empty directory to contain the build tree, + and cd into it. + + +To build a GDB stub ROM image, enter the command: +$ ecosconfig new ref4955 stubs + + +Enter the commands: +$ ecosconfig tree +$ make + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +images have the prefix gdb_module. + + + + + + Installing GDB stubs into FLASH +Boot into the board’s firmware in little-endian mode: +Set the switches like this: +SW1: 10000000 (first lever up, the rest down) +SW2: 10000010 +Connect serial cable on the lower connector, configure terminal +emulator for 38400, 8-N-1. +When booting the board, you should get this prompt: +HCP5 rev 0.9B . +HCP5? +Select o (option), a (FLASH) and b (boot write). You should +see this: +Boot ROM Write +ROM address-ffffffffbd000000, Boot Bus-[32bit] +ID2 0 4 ffffffffa002ad40 +zzz SS-40000 IV-1 CS-20000 CC-2 +Flash ROM-[28F640J5], [16bit chip] * 2 * 1 +Block size-00040000 count-64 +ROM adr ffffffffbd000000-ffffffffbe000000 mask-00fc0000 +Send Srecord file sa=00000000 size=ffffffffffffffff +ra=fffffffffe000000 + +Now send the stub SREC data down to the board using the terminal + emulator’s ‘send ASCII’ (or similar) +functionality. +Red Hat has experienced some sensitivity to how fast the data +is written to the board. Under Windows you should configure Minicom +to use a line delay of 100 millisecs. Under Linux, use the slow_cat.tcl + script: +% cd BASE_DIR/packages/hal/mips/ref4955/&Version;/misc +% slow_cat.tcl < [path]/gdb_module.srec > /dev/ttyS0 +Power off the board, and change it to boot the GDB stubs in +big-endian mode by setting the switches like this: +SW1: 00000000 (all levers down) +SW2: 10001010 +The GDB stubs allow communication with GDB using the serial +port at connector PJ7A (lower connector). The communication parameters +are fixed at 38400 baud, 8 data bits, no parity bit and 1 stop +bit (8-N-1). No flow control is employed. Connection to the host +computer should be made using a straight through serial cable. + + + + + + +VR4300 Hardware Setup +The eCos Developer’s Kit package comes with an EPROM +which provides GDB support for the NEC +VRC4373 evaluation board. An image of this EPROM is also provided +at loaders/vr4300-vrc4373/gdbload.bin under +the root of your eCos installation. +The EPROM is installed to socket U12 on the board. Attention +should be paid to the correct orientation of the EPROM during installation. +Only replace the board"s existing ROM using a proper PLCC +extraction tool, as the socket would otherwise risk getting damaged. +The GDB stub in the EPROM allows communication with GDB using +the serial port at connector J1. The communication parameters are +fixed at 38400 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1). +No flow control is employed. Connection to the host computer should +be made using a straight-through serial cable. + + +VRC4375 Hardware Setup +For information about setting up the VRC4375 to run with RedBoot, +consult the RedBoot User"s Guide. If using serial debugging, +the serial line runs at 38400 baud 8-N-1 and should be connected +to the debug host using the cable supplied with the board. + + +Atlas/Malta Hardware Setup +For information about setting up the Atlas and Malta boards to +run with RedBoot, consult the RedBoot User"s Guide. + + +PowerPC Cogent Hardware Setup +The eCos Developer’s Kit package comes with an EPROM +which provides GDB support for the Cogent +evaluation board. An image of this EPROM is also provided at + loaders/powerpc-cogent/gdbload.bin under +the root of your eCos installation. The same EPROM and image can +be used on all three supported daughterboards: CMA287-23 (MPC823), +CMA287-50 (MPC850), and CMA286-60 (MPC860). +The EPROM is installed to socket U4 on the board. Attention +should be paid to the correct orientation of the EPROM during installation. +If you are going to burn a new EPROM using the binary image, +be careful to get the byte order correct. It needs to be big-endian. +If the EPROM burner software has a hex-editor, check that the first +few bytes of the image look like: +00000000: 3c60 fff0 6063 2000 7c68 03a6 4e80 0020 <`..`c.|h..N.. +If the byte order is wrong you will see 603c instead of 3c60 +etc. Use the EPROM burner software to make a byte-swap before you +burn to image to the EPROM. +If the GDB stub EPROM you burn does not work, try reversing +the byte-order, even if you think you have it the right way around. +At least one DOS-based EPROM burner program is known to have the +byte-order upside down. +The GDB stub in the EPROM allows communication with GDB using +the serial port at connector P12 (CMA101) or P3 (CMA102). The communication parameters +are fixed at 38400 baud, 8 data bits, no parity bit and 1 stop bit +(8-N-1). No flow control is employed. Connection to the host computer +should be made using a dedicated serial cable as specified in the +Cogent CMA manual. + +Installing the Stubs into ROM + +Preparing the Binaries +These two binary preparation steps are not strictly necessary +as the eCos distribution ships with precompiled binaries in the +directory loaders/powerpc-cogent relative to the installation +root. + +Building the ROM images with the eCos Configuration Tool + + +Start with a new document - selecting the +File->New + menu item if necessary to do this. + + +Choose the +Build->Templates + menu item, and then select the PowerPC CMA28x hardware. + + +While still displaying the +Build->Templates + dialog box, select the “stubs” package template +to build a GDB stub. Click +OK. + + +Build eCos using +Build->Library. + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix “gdb_module”. + + + + +Building the ROM images with ecosconfig + + +Make an empty directory to contain the build tree, +and cd into it. + + +To build a GDB stub ROM image, enter the command: + +$ ecosconfig new cma28x stubs + + +Enter the commands: + +$ ecosconfig tree +$ make + + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix “gdb_module”. + + + + + + Installing the Stubs into ROM or FLASH + + +Program the binary image file gdb_module.bin +into ROM or FLASH referring to the instructions of your ROM programmer. + + + Plug the ROM/FLASH into socket U4 as described +at the beginning of this Hardware Setup section. + + + + + + +PowerPC MBX860 Hardware Setup +The eCos Developer’s Kit package comes with an EPROM +which provides GDB support for the Motorola +PowerPC MBX860 evaluation board. An image of this EPROM is also +provided at loaders/powerpc-mbx/gdbload.bin under +the root of your eCos installation. +The EPROM is installed to socket XU1 on the board. Attention +should be paid to the correct orientation of the EPROM during installation. +Only replace the board"s existing ROM using a proper PLCC +extraction tool, as the socket would otherwise risk getting damaged. +The GDB stub in the EPROM allows communication with GDB using +the serial port at connector SMC1/COM1. The communication +parameters are fixed at 38400 baud, 8 data bits, no parity bit and +1 stop bit (8-N-1). No flow control is employed. Connection to the +host computer should be made using a suitable serial cable. +In order to make the board execute the EPROM that you just +installed (rather than the on-board FLASH memory), it may be necessary +move some links on the board. Specifically, ensure that link J4 +is in position 1-2. If in doubt, refer to the MBX documentation +from Motorola, ensuring that Boot Port Size=8 Bits/ROM +for BOOT (CS#7), in their terminology. + +Installing the Stubs into FLASH + +Preparing the Binaries +These two binary preparation steps are not strictly necessary +as the eCos distribution ships with precompiled binaries in the +directory loaders/powerpc-mbx relative to the installation +root. + +Building the ROM images with the eCos Configuration Tool + + +Start with a new document - selecting the +File->New + menu item if necessary to do this. + + +Choose the +Build->Templates + menu item, and then select the PowerPC Motorola MBX860/821 +hardware. + + +While still displaying the +Build->Templates + dialog box, select the “stubs” package template +to build a GDB stub. Click +OK. + + +Build eCos using +Build->Library. + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix “gdb_module”. + + + + +Building the ROM images with ecosconfig + + +Make an empty directory to contain the build tree, +and cd into it. + + +To build a GDB stub ROM image, enter the command: + +$ ecosconfig new mbx stubs + + +Enter the commands: + +$ ecosconfig tree +$ make + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix “gdb_module”. + + + + + + Installing the Stubs into ROM + + + Program the binary image file gdb_module.bin +into ROM or FLASH referring to the instructions of your ROM programmer. + + + Plug the ROM/FLASH into socket XU1 as described +near the beginning of this Hardware Setup section. + + + + +Installing the Stubs into FLASH +This assumes you have EPPC-Bug in the on-board FLASH. This +can be determined by setting up the board according to the below +instructions and powering up the board. The EPPC-Bug prompt should +appear on the SMC1 connector at 9600 baud, 8N1. + + +Set jumper 3 to 2-3 [allow XU2 FLASH to +be programmed] + + +Set jumper 4 to 2-3 [boot EPPC-Bug] + + + + Program FLASH + + + Prepare EPPC-Bug for download: +EPPC-Bug>lo 0 +At this point the monitor is ready for input. It will not return +the prompt until the file has been downloaded. + + +Use the terminal emulator’s ASCII download feature +(or a simple clipboard copy/paste operation) to download +the gdb_module.srec data. + +Note that on Linux, Minicom’s ASCII download feature seems +to be broken. A workaround is to load the file into emacs (or another +editor) and copy the full contents to the clipboard. Then press +the mouse paste-button (usually the middle one) over the Minicom +window. + + +Program the FLASH with the downloaded data: + +EPPC-Bug>pflash 40000 60000 fc000000 + + +Switch off the power, and change jumper 4 to 1-2. Turn +on the power again. The board should now boot using the newly programmed +stubs. + + + + + + + +PowerPC Architectural Simulator Setup +The PowerPC simulator is an architectural simulator which +implements all the features of the PowerPC needed to run eCos. The +current implementation provides accurate simulation of the instruction +set and timers, as well as having generic support for diagnostic +output and exceptions. +The simulator also allows devices to be simulated, but no +device simulation support has been defined for the serial device +drivers in this release. +To simplify connection to the simulator, you are advised to +create a GDB macro by putting the following code in your personal +GDB start-up file (gdb.ini on Windows and .gdbinit on UNIX). +define psim + target sim -o ’/iobus/pal@0xf0001000/reg 0xf0001000 32’ + rbreak cyg_test_exit + rbreak cyg_assert_fail +end +You can then connect to the simulator by invoking the command psim on +the command line: +(gdb) psim +You can achieve the same effect by typing out the macro’s +content on the command line if necessary. + +The PowerPC simulator cannot execute binaries built for any +of the supported hardware targets. You must generate a configuration +using the PowerPC simulator platform: +$ ecosconfig new psim + or some such. + + + +SPARClite Hardware Setup +The eCos Developer’s Kit package comes with a ROM +which provides GDB support for the Fujitsu SPARClite Evaluation +Board by way of CygMon. +An image of this ROM is also provided at + BASE_DIR/loaders/sparclite-sleb/cygmon.bin. The +ROM is installed in socket IC9 on the evaluation board. Attention +should be paid to the correct orientation of the ROM during installation. +The GDB stub allows communication with GDB using a TCP channel +via the ethernet port at connector J5. + +<!-- <index></index> --><!-- <xref> -->Ethernet Setup +The ethernet setup is described in the board’s manual, +but here is a recapitulation. +Set the board’s ethernet address using SW1 on the +motherboard: + SW1-4 SW1-3 SW1-2 SW1-1 Ethernet Address + ----- ----- ----- ----- ---------------- + OFF OFF OFF OFF No ethernet, use serial + OFF OFF OFF ON 00:00:0E:31:00:01 + OFF OFF ON OFF 00:00:0E:31:00:02 + OFF OFF ON ON 00:00:0E:31:00:03 + OFF ON OFF OFF 00:00:0E:31:00:04 + OFF ON OFF ON 00:00:0E:31:00:05 + OFF ON ON OFF 00:00:0E:31:00:06 + OFF ON ON ON 00:00:0E:31:00:07 + ON OFF OFF OFF 00:00:0E:31:00:08 + ON OFF OFF ON 00:00:0E:31:00:09 + ON OFF ON OFF 00:00:0E:31:00:0A + ON OFF ON ON 00:00:0E:31:00:0B + ON ON OFF OFF 00:00:0E:31:00:0C + ON ON OFF ON 00:00:0E:31:00:0D + ON ON ON OFF 00:00:0E:31:00:0E + ON ON ON ON 00:00:0E:31:00:0F + +BOOTP/DHCP service on Linux +Configure the BOOTP or DHCP server on the network to recognize +the evaluation board’s ethernet address so it can assign +the board an IP address. Below is a sample DHCP server configuration +from a Linux system (/etc/dhcpd.conf). +It shows a setup for three evaluation boards. +# +# DHCP server configuration. +# +allow bootp; + +subnet 192.168.1.0 netmask 255.255.255.0 { + host mb831evb { + hardware ethernet 00:00:0e:31:00:01; + fixed-address mb831evb; + } + host mb832evb { + hardware ethernet 00:00:0e:31:00:02; + fixed-address mb832evb; + } + host mb833evb { + hardware ethernet 00:00:0e:31:00:03; + fixed-address mb833evb; + } +} + + +BOOTP/DHCP boot process +Even when configured to use a TCP channel, CygMon will still +print a boot message to the serial channel. If the BOOTP process +was successful and an IP address was found, a message “BOOTP +found xxx.xxx.xxx.xxx” will be printed where xxx.xxx.xxx.xxx +is the IP address assigned by the BOOTP or DHCP server. If the BOOTP +process fails, a message indicating failure will be printed and +the serial port will be used as the debug channel. +Once the board finds an IP address it will respond to ICMP +echo request packets (ping). This gives a simple means to test the +health of the board. +As described in “Ethernet Setup” on page 72, +it should now be possible to connect to the SPARCLite board from +within GDB by using the command: +(gdb) target remote <host>:1000 + + + +Serial Setup +The CygMon stubs also allow communication with GDB by way +of the serial port at connector CON1. The communication parameters +are fixed at 19200 baud, 8 data bits, no parity bit and 1 stop bit +(8-N-1). No flow control is employed. Connection to the host computer +should be made using a null modem cable. A gender changer may also +be required. + + + +SPARClite Architectural Simulator Setup +The ESA SPARClite simulator is an architectural simulator +which implements all the features of the SPARClite needed to run +eCos. The current implementation provides accurate simulation of +the instruction set, interrupt controller, and timers, as well as +having generic support for diagnostic output and exceptions. +Note that the ESA SPARClite simulator is unsupported, but +is included in the release as a convenience. +To simplify connection to the simulator, you are advised to +create a GDB macro by putting the following code in your personal +GDB start-up file (gdb.ini on Windows and .gdbinit on UNIX). +define ssim + target sim -nfp -sparclite -dumbio + rbreak cyg_test_exit + rbreak cyg_assert_fail +end +You can then connect to the simulator by invoking the command ssim on +the command line: +(gdb) ssim +You can achieve the same effect by typing out the macro’s +content on the command line if necessary. + + +<!-- <index></index> --><!-- <xref> -->ARM PID Hardware Setup +eCos comes with two ROM images that provide GDB support for +the ARM PID board. The first ROM image provides a port of the CygMon +ROM monitor, which includes a command-line interface and a GDB remote +stub. The second ROM image provides a remote GDB stub only, which +is a minimal environment for downloading and debugging eCos programs +solely using GDB. +eCos, CygMon and the GDB stubs all support the PID fitted +with both ARM7T and ARM9 daughterboards. CygMon and the stubs can +be programmed into either the programmable ROM (U12) or the FLASH +(U13). Prebuilt forms of both ROM images are provided in the directory +loaders/arm-pid under the root of your eCos installation, +along with a tool that will program the stubs into the FLASH memory on +the board. CygMon images are prefixed with the name 'cygmon' and +GDB stub ROM images are given the prefix 'gdb_module'. +Images may be provided in a number of formats including ELF (.img +extension), binary (.bin extension) and SREC (.srec extension). +Note that some unreliability has been experienced in downloading +files using Angel 1.00. Angel 1.02 appears to be more robust in +this application. + +Installing the Stubs into FLASH + +Preparing the Binaries +These two binary preparation steps are not strictly necessary +as the eCos distribution ships with precompiled binaries in the +directory loaders/arm-pid relative to the installation +root. + + +Building the ROM images with the eCos Configuration Tool + + +Start with a new document - selecting the +File->New + menu item if necessary to do this. + + +Choose the +Build +-> +Templates + menu item, and then select the ARM PID hardware. + + +While still displaying the +Build +-> +Templates + dialog box, select either the "stubs" package template to build +a GDB stub image, or the "cygmon" template to build the CygMon ROM +Monitor. Click +OK. + + +Build eCos using +Build +-> +Library + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix "gdb_module". CygMon images +have the prefix "cygmon". + + + + +Building the ROM images with ecosconfig +(See ) + + + Make an empty directory to contain the build tree, +and cd into it. + + +To build a GDB stub ROM image, enter the command: +$ ecosconfig new pid stubs +or to build a CygMon ROM monitor image, enter the command: +$ ecosconfig new pid cygmon + + +Enter the commands: +$ ecosconfig tree +$ make + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix "gdb_module". CygMon images +have the prefix "cygmon". + + + + +Building the FLASH Tool with the eCos Configuration Tool + + +Start with a new document - selecting the +File->New + menu item if necessary to do this. + + +Choose the +Build->Templates + menu item, and then select the ARM PID hardware. + + +Enable the "Build flash programming tool" option in the +ARM PID HAL (CYGBLD_BUILD_FLASH_TOOL) +and resolve any resulting configuration conflicts. + + +Build eCos using +Build +-> +Library + + +When the build completes, the FLASH tool image file can +be found in the bin/ subdirectory of the install tree, +with the prefix "prog_flash" + + + + +Building the FLASH Tool with ecosconfig +(See ) + + + Make an empty directory to contain the build tree, +and cd into it + + + +Enter the command: +$ ecosconfig new pid + + +Edit the file ecos.ecc and enable the option CYGBLD_BUILD_FLASH_TOOL +by uncommenting its user_value property and setting it +to 1. + + +Enter the commands: +$ ecosconfig resolve +[there will be some output] +$ ecosconfig tree +$ make + + +When the build completes, the FLASH tool image file can +be found in the bin/ subdirectory of the install tree, +with the prefix "prog_flash" + + + + +Prepare the Board for FLASH Programming +Each time a new image is to be programmed in the FLASH, the +jumpers on the board must be set to allow Angel to run: + + + Set jumper 7-8 on LK6 [using the Angel code +in the 16 bit EPROM] + + +Set jumper 5-6 on LK6 [select 8bit ROM mode] + + +Set jumper LK18 [ROM remap - this is +also required for eCos] + + +Set S1 to 0-0-1-1 [20MHz operation] + + +Open jumper LK4 [enable little-endian operation] + +Attach a serial cable from Serial A on the PID board to connector +1 on the development system. This is the cable through which the +binaries will be downloaded. Attach a serial cable from Serial B +on the PID board to connector 2 on the development system (or any +system that will work as a terminal). Through this cable, the FLASH +tool will write its instructions (at 38400 baud). + + + + +Program the FLASH + + +Download the FLASH ROM image onto the PID board. For +example. for the GDB stubs image: + +bash$ arm-elf-gdb -nw gdb_module.img +GNU gdb 4.18-DEVTOOLSVERSION +Copyright 1998 Free Software Foundation, Inc. +GDB is free software, covered by the GNU General Public License, +and you are welcome to change it and/or distribute copies +of it under certain conditions. Type "show copying" to see the conditions. +There is absolutely no warranty for GDB. Type "show warranty" for details. +This GDB was configured as "--host=i586-pc-cygwin32 --target=arm-elf". +(no debugging symbols found)... +(gdb) target rdi s=com1 +Angel Debug Monitor for PID (Built with Serial(x1), Parallel, DCC) 1.00 +(Advanced RISC Machines SDT 2.10) +Angel Debug Monitor rebuilt on Jan 20 1997 at 02:33:43 +Connected to ARM RDI target. +(gdb) load +Loading section .rom_vectors, size 0x44 lma 0x60000 +Loading section .text, size 0x1f3c lma 0x60044 +Loading section .rodata, size 0x2c lma 0x61f80 +Loading section .data, size 0x124 lma 0x61fac +Start address 0x60044 , load size 8400 +Transfer rate: 5169 bits/sec. +(gdb) q +The program is running. Exit anyway? (y or n) y + + + On a UNIX or Linux system, the serial port must be + /dev/ttyS0 instead of COM1. + You need to make sure that the /dev/ttyS0 files +have the right permissions: +$ su + Password: + # chmod o+rw /dev/ttyS0* + # exit + +If you are programming the GDB stub image, it will now be located +at 0x60000..0x64000. If you are programming the Cygmon ROM Monitor, +it will be located at 0x60000..0x80000. + + + +Now download the FLASH programmer tool +bash$ arm-elf-gdb prog_flash.img +GNU gdb 4.18-DEVTOOLSVERSION +Copyright 1998 Free Software Foundation, Inc. +GDB is free software, covered by the GNU General Public License, +and you are welcome to change it and/or distribute +copies of it under certain conditions. Type "show copying" to see +the conditions. There is absolutely no warranty for GDB. Type "show +warranty" for details. +This GDB was configured as "--host=i586-pc-cygwin32 --target=arm-elf". +(gdb) target rdi s=com1 +Angel Debug Monitor for PID (Built with Serial(x1), Parallel, DCC) 1.00 +(Advanced RISC Machines SDT 2.10) +Angel Debug Monitor rebuilt on Jan 20 1997 at 02:33:43 +Connected to ARM RDI target. +(gdb) load +Loading section .rom_vectors, size 0x44 lma 0x40000 +Loading section .text, size 0x44a4 lma 0x40044 +Loading section .rodata, size 0x318 lma 0x444e8 +Loading section .data, size 0x1c8 lma 0x44800 +Start address 0x40044 , load size 18888 +Transfer rate: 5596 bits/sec. +(gdb) c + + +The FLASH tool will output some text on the board serial +port B at 38400 baud: +ARM +eCos + +FLASH here! +manuf: 8, device: 40 +Error: Wrong Manufaturer: 08 +... Please change FLASH jumper + + +This text is repeated until you remove the jumper 7-8 +on LK6. Then the output will be: +manuf: 1F, device: A4 +AT29C040A recognised +About to program FLASH using data at 60000..64000 +*** Press RESET now to abort! + + + You have about 10 seconds to abort the operation by pressing +reset. After this timeout, the FLASH programming happens: +...Programming FLASH +All done! + + +Quit/kill the GDB process, which will hang. + + +Next time you reset the board, the stub will be in control, +communicating on Serial A at 38400 baud. + + + +If you do not have two serial ports available on your host +computer, you may still verify the FLASH programming completed successfully +by quitting/killing the GDB process after running "c" in +step 2 above. Then switch the serial cable on the PID from Serial +A to Serial B and run a terminal emulator on the host computer. +In a few seconds you should see the the repeated text described +in step 2 above and you may continue the remaining steps as normal. + + + +Programming the FLASH for big-endian mode +The process is almost identical to the previous instructions +which apply to a PID board running in little-endian mode only. +The only adjustments to make are that if programming a GDB stub +ROM image (or CygMon ROM monitor image), you must enable the option "Use +Big-endian mode" in the eCos Configuration Tool (CYGHWR_HAL_ARM_BIGENDIAN +if using ecosconfig and editing ecos.ecc). +When programming the FLASH there are two options: + + +Program FLASH using the little-endian FLASH tool. After +powering off, replace the ROM controller with the special big-endian +version which can be acquired from ARM. (This has not been tested +by Red Hat). + + +Use a specied big-endian version of the FLASH tool which +byte-swaps all the words as they are written to the FLASH. + + +Build this tool by enabling the "Build flash programming tool +for BE images on LE boards" option (CYGBLD_BUILD_FLASH_TOOL_BE), +resulting in a utility with the prefix "prog_flash_BE_image_LE_system" +which should be used instead of "prog_flash". +Note that there is a limitation to this method: no sub-word +data can be read from the ROM. To work around this, the .rodata +section is folded into the .data section and thus copied to RAM +before the system starts. +Given that Thumb instructions are 16 bit, it is not possible +to run ROM-startup Thumb binaries on the PID board using this method. +When the image has been programmed, power off the board, and +set jumper LK4 to enable big-endian operation. + + + +Installing the Stubs into ROM + + +Program the binary image file gdb_module.bin +into ROM referring to the instructions of your ROM programmer. + + +Plug the ROM into socket U12 and install jumper LK6 pins +7-8 to enable the ROM. + + + + + +<!-- <index></index> -->ARM AEB-1 Hardware Setup + +Overview +The ARM AEB-1 comes with tools in ROM. These include a simple +FLASH management tool and the Angel® monitor. eCos for +the ARM AEB-1 comes with GDB stubs suitable for programming into +the onboard FLASH. GDB is the preferred debug environment for GDB, +and while Angel provides a subset of the features in the eCos GDB +stub, Angel is unsupported. +Both eCos and the stubs support both Revision B and Revision +C of the AEB-1 board. Stub ROM images for both types of board can +be found in the loaders/arm-aeb directory under the root +of your eCos installation. You can select which board you are using +by selecting either the aeb or aebC platform by selecting the appropriate +platform HAL in the eCos Configuration Tool. +The GDB stub can be downloaded to the board for programming +in the FLASH using the board's on-board ROM monitor: + + +talk to the AEB-1 board with a terminal emulator (or +a real terminal!) + + +use the board's rom menu to download a UU-encoded +version of the GDB stubs which will act as a ROM monitor + + +tell the board to use this new monitor, and then hook +GDB up to it for real debugging + + + + +Talking to the Board +Connect a terminal or computer's serial port to the +ARM AEB-1. On a PC with a 9-pin serial port, you can use the cable +shipped by ARM with no modification. +Set the terminal or terminal emulator to 9600N1 (9600 baud, +no parity, 1 stop bit). +Reset the board by pressing the little reset button on the +top. You will see the following text: + ARM Evaluation Board Boot Monitor 0.01 (19 APR 1998) + Press ENTER within 2 seconds to stop autoboot +Press ENTER quickly, and you will get the boot prompt: + Boot: + + +Downloading the Stubs via the Rom Menu +Using the AEB-1 rom menu to download the GDB stubs from the +provided ".UU" file. + +This is an annotated 'terminal' session +with the AEB-1 monitor: + ++Boot: help +Module is BootStrap 1.00 (14 Aug 1998) +Help is available on: +Help Modules ROMModules UnPlug PlugIn +Kill SetEnv UnSetEnv PrintEnv DownLoad +Go GoS Boot PC FlashWrite +FlashLoad FlashErase +Boot: download c000 +Ready to download. Use 'transmit' option on terminal +emulator to download file. +... at this point, download the ASCII file "loaders/arm-aeb/ + gdb_module.img.UU". The details of this operation differ + depending on which terminal emulator is used. It may be + necessary to enter "^D" (control+D) when the download completes + to get the monitor to return to command mode. +Loaded file gdb_module.img.bin at address +0000c000, size = 19392 + + +Activating the GDB Stubs +Commit the GDB stubs module to FLASH: + Boot: flashwrite 4018000 C000 8000 + +Verify that the eCos/"GDB stubs" module is now added +in the list of modules in the board: + Boot: rommodules + +You should see output similar to the following: + Header Base Limit + 04000004 04000000 040034a8 BootStrap 1.00 (14 Aug 1998) + 04003a74 04003800 04003bc0 Production Test 1.00 (13 Aug 1998) + 0400e4f4 04004000 0400e60f Angel 1.02 (12 MAY 1998) + 0401c810 04018000 0401cbc0 eCos 1.3 (27 Jan 2000) +GDB stubs + +Now make the eCos/"GDB stubs" module be the default +monitor: + Boot: plugin eCos + + +Since the GDB stubs are always linked at the same address +(0x4018000), the operation of writing to the FLASH and selecting +the stubs as default monitor is an idempotent operation. You can +download a new set of stubs following the same procedure - you do +not have to unregister or delete anything. + + + +Building the GDB Stub FLASH ROM Images +Prebuilt GDB stubs images are provided in the directory loaders/arm-aeb +relative to the root of your eCos installation, but here are instructions +on how to rebuild them if you should ever need to. + + +Building the GDB Stubs with the eCos Configuration Tool + + +Start with a new document - selecting the +File +-> +New + menu item if necessary to do this. + + +Choose the +Build +-> +Templates + menu item, and then select the ARM AEB-1 hardware. + + +While still displaying the +Build->Templates + dialog box, select the "stubs" package template to build a GDB +stub image. Click +OK. + + +If applicable, set the "AEB board revision" option to +"C" from "B" depending on the board revision being used. + + +Build eCos using +Build +-> +Library. + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. The GDB stub +ROM images have the prefix "gdb_module". + + + + +Building the GDB Stub ROMs with ecosconfig +(See ) + + +Make an empty directory to contain the build tree, +and cd into it. + + +To build a GDB stub ROM image, enter the command: +$ ecosconfig new aeb stubs + + +If applicable, edit ecos.ecc and set the AEB board revision. (CYGHWR_HAL_ARM_AEB_REVISION) +from the default "B" to "C" by uncommenting the user_value +property and setting it to "C". + + +Enter the commands + +$ ecosconfig tree +$ make + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. The GDB stub +ROM images have the prefix "gdb_module". + + + + + +<!-- <index></index> -->ARM Cogent CMA230 Hardware Setup +The eCos Developer's Kit package comes with an EPROM +which provides GDB support for the Cogent evaluation board. An image +of this EPROM is also provided at loaders/arm-cma230/gdbload.bin +under the root of your eCos installation. +The EPROM is installed to socket U3 on the board. Attention +should be paid to the correct orientation of the EPROM during installation. +If you are going to burn a new EPROM using the binary image, +be careful to get the byte order correct. It needs to be little-endian, +which is usually the default in PC based programmer software. +If the GDB stub EPROM you burn does not work, try reversing +the byte-order, even if you think you have it the right way around. +At least one DOS-based EPROM burner program is known to have the +byte-order upside down. +The GDB stub in the EPROM allows communication with GDB using +the serial port at connector P12 (CMA101) or P3 (CMA102). The communication parameters +are fixed at 38400 baud, 8 data bits, no parity bit and 1 stop bit +(8-N-1). No flow control is employed. Connection to the host computer +should be made using a dedicated serial cable as specified in the +Cogent CMA manual. + +Building the GDB Stub FLASH ROM images +Prebuilt GDB stubs images are provided in the directory loaders/arm-cma230 relative +to the root of your eCos installation, but here are instructions +on how to rebuild them if you should ever need to. +CygMon images are prefixed with the name 'cygmon' and +GDB stub ROM images +are given the prefix 'gdb_module'. +Images may be provided in a number of formats including ELF (.img +extension), binary (.bin extension) and SREC (.srec extension). + + +Building the GDB Stubs with the eCos Configuration Tool + + +1. Start with a new document - selecting the File->New +menu item if necessary to do this. + + +Choose the +Build->Templates + menu item, and then select the ARM CMA230 hardware. + + +While still displaying the +Build +-> +Templates + dialog box, select the "stubs" package template to build a GDB +stub image. Click +OK. + + +Build eCos using +Build +-> +Library + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. The GDB stub +ROM images have the prefix "gdb_module". + + + + +Building the GDB Stub ROMs with ecosconfig +(See ) + + +1. Make an empty directory to contain the build tree, +and cd into it. + + +To build a GDB stub ROM image, enter the command: +$ ecosconfig new cma230 stubs + + +Enter the commands: + +$ ecosconfig tree +$ make + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. The GDB stub +ROM images have the prefix "gdb_module". + + + + + +<!-- <index></index> --><!-- <xref> -->Cirrus Logic ARM EP7211 Development +Board Hardware Setup +eCos comes with two Flash ROM images that provide GDB support +for the Cirrus Logic EP7211 Development Board (also known as the +EDB7211).. Note that on some board revisions, the board is silk-screened +as EDB7111-2. The first Flash ROM image provides a port of the CygMon +ROM monitor, which includes a command-line interface and a GDB remote +stub. The second Flash ROM image provides a remote GDB stub only. +Both ROM images are provided in the directory loaders/arm-edb7211 +under the root of your eCos installation. CygMon images are prefixed +with the name 'edb7211_cygmon' and are +provided in a number of formats including binary (.bin extension) +and SREC (.srec) extension. GDB stub ROM images are given the prefix 'edb7211_gdb_module'. +The ROM images provided for the EP7211 Development Board must +be programmed into the FLASH. Please refer to the section titled +"Loading the ROM image into On-Board flash" on how to program the +ROM onto the board. +Both Cygmon and GDB Stub ROMS allow communication with GDB +via the serial connector labelled 'UART 1'. The +communication parameters are fixed at 38400 baud, 8 data bits, no +parity bit and 1 stop bit (8-N-1). No flow control is employed. +Connection to the host computer should be made using a null modem cable. +A gender changer may also be required. Note that the GDB Configuration tool +uses the serial port identifiers 0 and 1 to identify the EB7211 +serial ports UART1 and UART2 respectively. +Both eCos and the ROM images assume the core clock is generated +with a 3.6864 MHz PLL input. The CPU will be configured to run at +73.728MHz. +Note: The EP7211 CPU needs a two step RESET process. After +pressing the `URESET' pushbutton, the `WAKEUP' pushbutton +must be pressed to complete the process. + +When an eCos program is run on an EDB7211 board fitted with +either CygMon or a GDB stub ROM, then the code in ROM loses control. +This means that if you require the ability to remotely stop execution +on the target, or want thread debugging capabilities, you must include +GDB stub support when configuring eCos. + + +Building programs for programming into FLASH +If your application is to be run directly from FLASH, you +must configure eCos appropriately for "ROM" startup. This can be +done in the eCos Configuration Tool by setting +the "Startup type" HAL option to "ROM". If using the ecosconfig utility, +set the user_value of the CYG_HAL_STARTUP +option in ecos.ecc to "ROM". +When you have linked your application with eCos, you will +then have an ELF executable. To convert this into a format appropriate +for the Cirrus Logic FLASH download utility, or the dl_7xxx +utility on linux, you can use the utility arm-elf-objcopy, as in +the following example: +$ arm-elf-objcopy -O binary helloworld.exe helloworld.bin +This will produce a binary format image helloworld.bin which +can be downloaded into FLASH. + + +Building the GDB Stub FLASH ROM images +Prebuilt GDB stubs images are provided in the directory loaders/arm-edb7211 relative +to the root of your eCos installation, but here are instructions +on how to rebuild them if you should ever need to. +CygMon images are prefixed with the name 'cygmon' and +GDB stub ROM images are given the prefix 'gdb_module'. +Images may be provided in a number of formats including ELF (.img +extension), binary (.bin extension) and SREC (.srec extension). + + +Building the ROM images with the eCos Configuration Tool + + +Start with a new document - selecting the +File->New + menu item if necessary to do this. + + +Choose the +Build->Templates + menu item, and then select the "Cirrus Logic development board" +hardware. + + +While still displaying the +Build +-> +Templates + dialog box, select either the "stubs" package template to build +a GDB stub image, or the "cygmon" template to build the CygMon ROM +Monitor. Click +OK. + + +Build eCos using +Build +-> +Library + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix "gdb_module". CygMon images +have the prefix "cygmon". + + + + +Building the ROM images with ecosconfig +(See ) + + +Make an empty directory to contain the build tree, +and cd into it. + + +To build a GDB stub ROM image, enter the command: +$ ecosconfig new edb7xxx stubs +or to build a CygMon ROM monitor image, enter the command: +$ ecosconfig new edb7xxx cygmon + + +Enter the commands: +$ ecosconfig tree +$ make + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix "gdb_module". CygMon images +have the prefix "cygmon". + + + + +<!-- <xref> -->Loading the ROM Image into On-board Flash +Program images can be written into Flash memory by means of +a bootstrap program which is built into the EDB7211. This program +communicates with a support program on your host to download and +program an image into the Flash memory. +Cirrus Logic provides such a program for use with Windows/DOS. + eCos comes with a similar program which will run under Linux. The +basic operation of both programs is the same. + + +Connect a serial line to 'UART 1'. + + +Power off the EDB7211. + + +Install jumper 'PROGRAM ENABLE' which +enables this special mode for downloading Flash images. Note that +some board revisions have this jumper labelled “BOOT ENABLE”. + + +Power on the EDB7211. + + +Execute the Flash writing program on your host. On Linux, +this would be: + # dl_edb7xxx <PATH>/gdb_module.bin +where '<PATH>' is the path to +the binary format version of the ROM image you wish to load, either +as built in the previous section or the "loaders/arm-edb7211/" subdirectory +of your eCos installation. The download tool defaults to 38400 baud and +device /dev/ttyS1 for communication. To change +these, specify them as parameters, e.g. + +# dl_edb7xxx <PATH>/gdb_module.bin 9600 /dev/ttyS0 + + +The download program will indicate that it is waiting +for the board to come alive. At this point, press 'RESET' and +then 'WAKEUP' switches in order. There should be +some indication of progress, first of the code being downloaded, +then of the programming process. + + +Upon completion of the programming, power off the EDB7211. + + +Remove the 'PROGRAM ENABLE/BOOT ENABLE' jumper. + + +Power on the EDB7211, press 'RESET' and 'WAKEUP'. + The new ROM image should now be running on the board. + + +The GDB debugger will now be able to communicate with +the board to download and debug RAM based programs. + +This procedure also applies for loading ROM-startup eCos programs +into the on-board FLASH memory, given a binary format image of the +program from arm-elf-objcopy. Loading a ROM-startup eCos program +into Flash will overwrite the GDB Stub ROM/CygMon in Flash, +so you would have to reload the GDB Stub ROM/CygMon to +return to normal RAM-startup program development. + + + + +Building the Flash Downloader on Linux +eCos provides a Flash download program suitable for use with +the EP7211 Development Board which will run on Linux. Follow these +steps to build this program. Note: at the time of the writing of +these instructions, the download program is built directly within +the eCos source repository since it is +not configuration specific. + # cd <eCos install dir>/packages/hal/arm/edb7xxx/&Version;/support + # make +(where '# ' is your shell prompt) +Note: this program was adapted from the Cirrus Logic original +DOS program and still contains some vestiges of that environment. + + +Developing eCos Programs with the ARM Multi-ICE +The EP7211 Development Board supports use of the ARM + Multi-processor EmbeddedICE(tm), also known as the + Multi-ICE. Full instructions on how to install and use the + Multi-ICE in conjunction with GDB are provided in the + "GNUPro Toolkit Reference for eCos + ARM/Thumb" manual. However, the following + platform-specific details should be noted. +You will need an ARM Multi-ICE Server configuration + file for the EP7211 Development Board. Here is a suggested + configuration file to use: +======== File "720T.cfg" ======== +;Total IR length = 4 +[TITLE] +Multi-ICE configuration for EP7211 + +[TAP 0] +ARM720T + +[TAPINFO] +YES + +[Timing] +Low=0 +High=0 +Adaptive=OFF +================================== +You must ensure that the board has the appropriate soldered +connections. For the EP7211 this involves connecting TEST0 and TEST1 +of the EP7211 to ground. To do this you must solder a wire from +ground at JP33 to TP8 and TP9. +With respect to using multiple devices simultaneously, note +that the EP7211 is not ID sensitive. +If you wish to view diagnostic output from your program that +was downloaded via the Multi-ICE, you will note that by default +the output on the serial line (as viewed by a terminal such as Hyperterm +in Windows, or cu in Unix) is in the form of GDB packets. +To get legible output, the solution is to set the "GDB Serial +port" to a different device from the "Diagnostic serial port", and +you should use the Diagnostic serial port to view the diagnostic +output. +Warning: The multi-ice-gdb-server will fail on startup if +the board has not been both reset and awakened before running the +server. +To resolve this, it is necessary to free up the connection +from within the ARM Multi-ICE server itself. However when this happens, +the next time you use GDB to load the program into the board, you +will see lots of "Readback did not match original data" messages +in the output of the multi-ice-gdb-server program. This indicates +your program did not load correctly, and you should restart the +multi-ice-gdb-server program, taking care to reset the board correctly +before reconnecting. +As a reminder, you must specify --config-dialog to the + multi-ice-gdb-server program to connect to the board + correctly. If you do not, the multi-ice-gdb-server program + will not be able to connect. + + + + +<!-- <conditionaltext> -->Cirrus Logic ARM EP7212 Development Board +Hardware Setup +The Cirrus Logic EP7212 Development Board is almost identical +to the EP7211 Development Board from a hardware setup viewpoint, +and is based on the same port of eCos. Therefore the earlier documentation +for the EP7211 Development Board can be considered equivalent, but +with the following changes: + + +The first serial port is silk screened as "UART 1" on +the EP7211 Development Board, but is silk screened as "Serial Port +0" on the EP7212 Development Board. Similarly "UART 2" is silk screened +as "Serial Port 1" on the EP7212 Development Board. + + +JP2 (used to control reprogramming of the FLASH) is not +silkscreened with "Boot Enable". + + +To setup the EP7212 Development Board for use with the +ARM Multi-ICE JTAG debugging interface unit, it is necessary to +connect TEST0 and TEST1 of the EP7212 to ground. On the Development +Board, this is accomplished by placing shorting blocks on JP47 and +JP48. When the shorting blocks are fitted, the board can only be +operated through the Multi-ICE - debugging over a serial line is +not possible. + + +Prebuilt GDB stubs are + provided in the directory + loaders/arm-edb7212 relative to the + root of your eCos installation + + +When rebuilding the GDB stub ROM image, change the "Cirrus +Logic processor variant" option (CYGHWR_HAL_ARM_EDB7XXX_VARIANT) +from the EP7211 to the EP7212. This can be selected in the +eCos Configuration Tool +, or if using ecosconfig, can be set by uncommenting the user_value +property of this option in ecos.ecc and setting it to "EP7212". + + + + +<!-- <conditionaltext> -->Cirrus Logic ARM EP7312 Development Board +Hardware Setup +The Cirrus Logic EP7312 Development Board is similar +to the EP7212 Development Board from a hardware setup viewpoint, +and is based on the same port of eCos. +When rebuilding the RedBoot ROM image or an eCos application, +change the "Cirrus Logic processor variant" option +(CYGHWR_HAL_ARM_EDB7XXX_VARIANT) +from the EP7211 to the EP7312. This can be selected in the +eCos Configuration Tool +, or if using ecosconfig, can be set by uncommenting the user_value +property of this option in ecos.ecc and setting it to "EP7312". + + +See the RedBoot documentation for building and installing RedBoot for this +target. Only RedBoot is supported as a boot image; ROMRAM startup is +recommended. + + +90MHz Operation + +The EP7xxx targets offer a choice of clock speeds, from 18MHz to a maximum, +normally, of 72MHz. These are described as kHz values 18432 36864 49152 +and 73728 within the configuration tool. If you have a release which +supports it, you will also see 90317 as an available option here, for 90MHz +operation. + + +This option only applies to certain EP7312 hardware, not all EP7312 boards +support it. Do not select 90MHz when building RedBoot or your eCos +application unless you are absolutely sure that your board supports it. + + +If you do have a 90MHz board and wish to execute at 90MHz, it is in fact +not necessary to build RedBoot specially, if you build your eCos +application configured for 90MHz. RedBoot will run at 72MHz and your +application will run at 90Mhz. If you do install a 90MHz RedBoot, then you +must build eCos for 90Mhz or timing and baud rates on serial I/O will be +wrong. + + +In other words, code (either eCos app or RedBoot) built for 90MHz will +“change up a gear” when it starts up; but code built for 72MHz, +because it needs to run correctly on boards without the +“gearbox” does not change back down, so if you mix the two, +unexpected timing can result. To run a non-eCos application without any +hardware initialization code at 90MHz, you must install a specially-built +RedBoot. + + + + +Cirrus Logic ARM EP7209 Development Board Hardware Setup +Note: At time of writing, no EP7209 Development Board is available, +and consequently eCos has not been verified for use with the EP7209 +Development Board. +The Cirrus Logic EP7209 Development Board is almost identical +to the EP7212 Board in all respects, except that it is not fitted +with DRAM, nor has it a DRAM controller. +The only valid configuration for the EDB7209 is ROM based. +The STUBS and RAM startup modes are not available as no DRAM is +fitted. + + +<!-- <index></index> -->Cirrus Logic ARM CL-PS7111 Evaluation Board Hardware Setup +The implementation of the port of eCos to the Cirrus Logic +ARM CL-PS7111 Evaluation Board (also known as EB7111) is based on +the EP7211 Development Board port. +For that reason, the setup required is identical to the EP7211 +Development Board as described above, with the following exceptions: + + +The Cygmon ROM monitor is not supported + + +The ARM Multi-ICE is not supported + + +Prebuilt GDB stubs are provided in the +directory loaders/arm-eb7111 relative to the root of your +eCos installation + + +If rebuilding the GDB stub ROM image, change the "Cirrus +Logic processor variant" option (CYGHWR_HAL_ARM_EDB7XXX_VARIANT) +from the EP7211 to the CL_PS7111. This can be selected +in the +eCos Configuration Tool +, or if using ecosconfig, can be set by uncommenting the user_value +property of this option in ecos.ecc and setting it to "CL_PS7111" + + +All remote serial communication is done with the serial I/O +connector +/misc +% slow_cat.tcl < [path]/gdb_module.srec > /dev/ttyS0 +Power off the board, and change it to boot the GDB stubs in +big-endian mode by setting the switches like this: +SW1: 00000000 (all levers down) +SW2: 10001010 +The GDB stubs allow communication with GDB using the serial +port at connector PJ7A (lower connector). The communication parameters +are fixed at 38400 baud, 8 data bits, no parity bit and 1 stop +bit (8-N-1). No flow control is employed. Connection to the host +computer should be made using a straight through serial cable. + (See ) + + +StrongARM EBSA-285 Hardware Setup +The eCos Developer’s Kit package comes with a ROM +image which provides GDB support for +the Intel® StrongARM® Evaluation Board EBSA-285. + Both eCos and the Stub ROM image assume the clocks are: 3.6864 +MHz PLL input for generating the core clock, and 50MHz osc input +for external clocks. An image of this ROM is also provided at loaders/arm-ebsa285/gdbload.bin under +the root of your eCos installation. +The ROM monitor image (an eCos GDB +stub) provided for the EBSA-285 board must be programmed into the +flash, replacing the Angel monitor on the board. Please refer to +the section titled "Loading the ROM Image into On-Board flash" on how +to program the ROM onto the board. +The Stub ROM allows communication with GDB via the serial +connector on the bulkhead mounting bracket COM0. The communication +parameters are fixed at 38400 baud, 8 data bits, no parity bit and +1 stop bit (8-N-1). No flow control is employed. + +Building the GDB Stub FLASH ROM images +Prebuilt GDB stubs images are provided in the directory loaders/arm-ebsa285 relative +to the root of your eCos installation, but here are instructions +on how to rebuild them if you should ever need to. + + +Building the GDB Stubs with the eCos Configuration Tool + + +Start with a new document - selecting the +File +-> +New + menu item if necessary to do this. + + +Choose the +Build +-> +Templates + menu item, and then select the StrongARM EBSA285 hardware. + + +While still displaying the +Build +-> +Templates + dialog box, select the "stubs" package template to build a GDB +stub image. Click +OK. + + +Build eCos using +Build +-> +Library + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. The GDB stub +ROM images have the prefix "gdb_module". + + + + +Building the GDB Stub ROMs with ecosconfig +(See “Using ecosconfig on UNIX” on page 72) + + +Make an empty directory to contain the build tree, +and cd into it. + + +To build a GDB stub ROM image, enter the command: + +$ ecosconfig new ebsa285 stubs + + +Enter the commands: + +$ ecosconfig tree +$ make + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. The GDB stub +ROM images have the prefix "gdb_module". + + + + +Loading the ROM Image into On-board Flash +There are several ways to install the eCos gdb stub ROM image +in the EBSA board’s flash memory. Once installed, the gdb +stub ROM provides standard eCos download and debug via the EBSA +board"s serial port. The options available include the +Linux based EBSA flash upgrade utility provided by Red Hat, direct writing +of the flash via MultiICE (JTAG) hardware debugger, and other flash management +utilities from Intel (these only support DOS, and proprietary ARM tools +and image formats). Only the Red Hat flash upgrade tool is supported +and tested in this release. +The flash upgrade tool requires the EBSA board to be configured +as a PCI slave (rather than a master, its normal operating mode) +and plugged into a Linux host computer"s PCI bus. +Configuring the board for flash loading: Follow the instructions +in the EBSA-285 Reference Manual, pages A-2 and A-3 to configure +the board as an add-in card, and enable flash blank programming. + Briefly: assuming the board was in the default setting to execute +as a bus master ("Host Bridge") make jumper 9 (J9), move jumper +10 (J10) to external reset (PCI_RST), and move jumper 15 +(J15) link 4-6-5 to connect 5-6 instead of 4-6. +Configuring the board for execution of eCos programs: Follow +the instructions in the EBSA-285 Reference Manual, pages A-2 and +A-3 to configure the board as a "Host Bridge" with "Central Function". + Briefly: unset J9, move J10 to on-board reset (BRD_RST), +and set J15 to make 4-6 instead of 5-6 (see page A-8 also). Plug +the card into its own PCI bus, not the Linux PC used for the flash-programming +process. +Building the Linux software: the Linux software sources are +in directory + <BASEDIR>/packages/hal/arm/ebsa285/v1_3/support/linux/safl_util +in the eCos source repository. There are two parts to the +system: a loadable kernel module and the flash utility. The loadable +kernel module is safl.o and the utility is sa_flash. To +build: + cd to this directory, or a copy of it. + make +This builds safl.o and sa_flash. The kernel module +must be installed, and a device file created for it. Both of these +operations require root permissions. Create the device file by: + % mknod /dev/safl c 10 178 +Programming the flash: switch off the EBSA-285, and remove +the EBSA-285 board from its PCI bus. Take appropriate anti-static +precautions. Configure it for flash loading as above, halt your +Linux system and turn it off. Install the EBSA-285 board in the +PCI bus of the Linux system and boot it up. (Single user is good enough, +assuming your image and safl_util build dir are on a local +disc partition.) Change directory to the safl_util directory, +then, to load the kernel module and flash an image onto the eval +board (as root): + % insmod safl.o + % sa_flash <image_file> +Halt and turn off the Linux machine and remove the EBSA-285 +card. Take appropriate anti-static precautions. Configure it for +execution of eCos programs as above, and plug it into its own PCI +bus. Restart the Linux machine however you wish. +This information is replicated in the README file within the +safl_util directory and its parents, and in the EBSA-285 +Reference Manual from Intel, appendix A "Configuration Guide". +If in doubt, please refer to those documents also. +This procedure also applies for loading ROM-startup eCos programs +into the on-board flash memory, given a binary format image of the +program from arm-elf-objcopy. Loading a ROM-startup eCos program +into flash will overwrite the StubROM in flash, so you would have +to reload the StubROM to return to normal RAM-startup program development. + + +Running your eCos Program Using GDB and the StubROM + +You must first load the StubROM image into the flash memory +on the EBSA-285 board before doing this. See “Loading +the ROM Image into On-board Flash”, page 93 for details. + +Connect to the StubROM in the board and run your eCos program <PROGRAM> as +follows: + $ arm-elf-gdb -nw <PROGRAM> + (gdb) set remotebaud 38400 + (gdb) target remote <DEVICE> +Where <DEVICE> is /dev/ttyS0 +or COM1: or similar, depending on your environment and how you connected +your serial line to the host computer. Expect some output here, +for example: + Remote debugging using /dev/ttyS0 + 0x410026a4 in ?? () +then, to load the program + (gdb) load + +which will report locations and sizes of sections as they +load, then begin execution using + (gdb) continue +If you have no eCos program yet, but you want to connect to +the board just to verify serial communications, tell gdb "set endian +little" before anything else, so that it understands the board (GDB +normally infers this from information within the eCos program). + +When an eCos program is run on the EBSA-285 board, the GDB +stub in ROM loses control. This means that if you require the ability +to stop execution on the target remotely, or want thread debugging +capabilities, you must include GDB stub support when configuring +eCos. + + + + +<!-- <conditionaltext> --> <!-- NOTE: could not find it --><!-- <index></index> -->Compaq iPAQ PocketPC Hardware Setup +For setting up the iPAQ to run with RedBoot, see the the RedBoot +User's Guide. Connections may be made using +the Compact Flash Ethernet interface. A serial cable may be connected +directly, or via the cradle. Serial communication uses the parameters +38400,8,N,1. The LCD/Touchscreen may also be used as an +interface to RedBoot and eCos applications. + + +SH3/EDK7708 Hardware Setup +The eCos Developer’s Kit package comes with a ROM +which provides GDB support for the Hitachi EDK7708 board (a big-endian +and a little-endian version). Images of these ROMs are also provided +at loaders/sh-edk7708/gdbload.bin and + loaders/sh-edk7708le/gdbload.bin under +the root of your eCos installation. +The ROM is installed to socket U6 on the board. When using +the big-endian ROM, jumper 9 must be set to 2-3. When using the +little-endian ROM, jumper 9 must be set to 1-2. Attention should +be paid to the correct orientation of the ROM during installation. +Only replace the board"s existing ROM using a proper PLCC extraction +tool, as the socket would otherwise risk being damaged. +If you are going to program a new ROM or FLASH using the binary +image, you may have to experiment to get the right byte-order in +the device. Depending on the programming software you use, it might +be necessary to enable byte-swapping. If the GDB stub ROM/FLASH +you program does not work, try reversing the byte-order. +The GDB stub in the EPROM allows communication with GDB using +the serial port at connector J1. The communication parameters are +fixed at 38400 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1). +No flow control is employed. Connection to the host computer should +be made using the dedicated serial cable included in the EDK package. + +Installing the Stubs into FLASH + +Preparing the Binaries +These two binary preparation steps are not strictly necessary +as the eCos distribution ships with precompiled binaries in the +directory loaders/sh-edk7708 and loaders/sh-edk7708le +relative to the installation root. + +Building the ROM images with the eCos Configuration Tool + + +Start with a new document - selecting the +File->New + menu item if necessary to do this. + + +Choose the +Build->Templates + menu item, and then select the SH EDK7708 hardware. + + +While still displaying the +Build->Templates + dialog box, select the “stubs” package template +to build a GDB stub. Click +OK. + + +If building a little-endian image, disable the “Use +big-endian mode” option in the SH EDK7708 HAL (CYGHWR_HAL_SH_BIGENDIAN). + + +Build eCos using +Build->Library. + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix “gdb_module”. + + + + +Building the ROM images with ecosconfig + + +Make an empty directory to contain the build tree, +and cd into it. + + +To build a GDB stub ROM image, enter the command: + +$ ecosconfig new edk7708 stubs + + + +If building a little-endian image, uncomment the user +value in ecos.ecc for CYGHWR_HAL_SH_BIGENDIAN +and change it to 0. + + +Enter the commands: + +$ ecosconfig tree +$ make + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix “gdb_module”. + + + + + + Installing the Stubs into ROM or FLASH + + +Program the binary image file gdb_module.bin +into ROM or FLASH referring to the instructions of your ROM programmer. + + +Plug the ROM/FLASH into socket U6. If the image +is little-endian set jumper 9 to 1-2. If the image is big-endian +set jumper 9 to 2-3. + + + + + + +SH3/CQ7708 Hardware Setup + +Preparing the board +Make sure the DIP switches on the board are set as follows: + +SW1-1 ON +SW1-2 OFF +SW1-3 ON +SW1-4 OFF +SW2-1 ON +SW2-2 ON +SW2-3 OFF +SW2-4 OFF +If you are using a straight through serial cable which has +flow control lines, you will also need to cut JP12 (5-6) as the +flow control lines can cause NMIs. + + +eCos GDB Stubs +The eCos installation CD contains a copy of the eCos GDB stubs +in binary format which must be programmed into an EPROM or FLASH +and installed on the board. + + Preparing the GDB stubs +These stub preparation steps are not strictly necessary as +the eCos distribution ships with precompiled stubs in the directory +loaders/sh3-cq7708 relative to the installation root. + + +Building the GDB stub image with the eCos Configuration Tool + + +Start with a new document - selecting the +File->New + menu item if necessary to do this. + + +Choose the +Build->Templates + menu item, and then select the SH3 cq7708 hardware. + + +While still displaying the +Build->Templates + dialog box, select the stubs package template to build a GDB stub. +Click +OK. + + + Build eCos stubs using +Build->Library. + + + When the build completes, the image files can be found +in the +bin/ + subdirectory of the install tree. GDB stub images have the prefix +gdb_module. + + + + + Building the GDB stub image with ecosconfig + + +Make an empty directory to contain the build tree, +and cd into it. + + + To build a GDB stub ROM image, enter the command: + +$ ecosconfig new cq7708 stubs + + + Enter the commands: + +$ ecosconfig tree +$ make + + +When the build completes, the image files can be found +in the +bin/ + subdirectory of the install tree. GDB stub images have the prefix +gdb_module. + + + + + +Programming the stubs in EPROM/FLASH +The board can use different sizes of ROMs. Use this table +to adjust the board’s jumpers to the ROM sizes you are +using. +size(kbit) JP7 JP9 JP10 JP11 +256 2-3 2-3 open open +512 1-2 2-3 open open +1000 1-2 open open 2-3 +2000 1-2 1-2 open 2-3 +4000 1-2 1-2 short 2-3 +8000 1-2 1-2 short 1-2 +There are two ways to program the stubs. We advise you to +use method 1, since it is simpler. Method 2 is unsupported and requires +a bit of fiddling. +Method 1: +Program the binary stub image into two EPROMs, E and O. EPROM +E should contain the even bytes, and O the odd bytes (your EPROM +programmer should have the ability to split the image). +EPROM E should be installed in socket IC8, and EPROM O should +be installed in socket IC4. +Set JP6 to 16 bit mode (1-2 soldered, 2-3 cut) Set SW1-4 +to ON and SW2-1 to OFF. + +Method2: +Assuming that the stub binary is smaller than 32 kB, you can +install it in a single EPROM. +Compile the mkcqrom.c program +found in the misc directory. +Use it to convert the binary image to the required format. +See the mkcqrom.c source for a +description of what is done, and why it is necessary. + % mkcqrom gdb_module.bin gdb_mangled.bin +Program the gdb_mangled.bin file +into an EPROM and install it in socket IC4 +Set JP6 to 8 bit mode (cut 1-2, solder 2-3) +The GDB stubs allow communication with GDB using the serial +port at connector CN7. The communication parameters are fixed at +38400 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1). No +flow control is employed. Connection to the host computer should +be made using a straight through serial cable. + + + +SH3/HS7729PCI Hardware Setup +Please see the RedBoot manual for instructions on how to prepare +the board for use with eCos. + + +SH3/SE77x9 Hardware Setup +Please see the RedBoot manual for instructions on how to prepare +the board for use with eCos. + + +SH4/CQ7750 Hardware Setup + +Preparing the board +Make sure the DIP switches on the board are set as follows: + +SW1-1 ON +SW1-2 OFF +SW1-3 ON +SW1-4 OFF +SW2-1 ON +SW2-2 ON +SW2-3 OFF +SW2-4 OFF +If you are using a straight through serial cable which has +flow control lines, you will also need to cut JP12 (5-6) as the +flow control lines can cause NMIs. + + +eCos GDB Stubs +The eCos installation CD contains a copy of the eCos GDB stubs +in binary format which must be programmed into an EPROM or FLASH +and installed on the board. + + Preparing the GDB stubs +These stub preparation steps are not strictly necessary as +the eCos distribution ships with precompiled stubs in the directory +loaders/sh3-cq7708 relative to the installation root. + + +Building the GDB stub image with the eCos Configuration Tool + + +Start with a new document - selecting the +File->New + menu item if necessary to do this. + + +Choose the +Build->Templates + menu item, and then select the SH3 cq7708 hardware. + + +While still displaying the +Build->Templates + dialog box, select the stubs package template to build a GDB stub. +Click +OK. + + + Build eCos stubs using +Build->Library. + + + When the build completes, the image files can be found +in the +bin/ + subdirectory of the install tree. GDB stub images have the prefix +gdb_module. + + + + + Building the GDB stub image with ecosconfig + + +Make an empty directory to contain the build tree, +and cd into it. + + + To build a GDB stub ROM image, enter the command: + +$ ecosconfig new cq7708 stubs + + + Enter the commands: + +$ ecosconfig tree +$ make + + +When the build completes, the image files can be found +in the +bin/ + subdirectory of the install tree. GDB stub images have the prefix +gdb_module. + + + + + +Programming the stubs in EPROM/FLASH +The board can use different sizes of ROMs. Use this table +to adjust the board’s jumpers to the ROM sizes you are +using. +size(kbit) JP7 JP9 JP10 JP11 +256 2-3 2-3 open open +512 1-2 2-3 open open +1000 1-2 open open 2-3 +2000 1-2 1-2 open 2-3 +4000 1-2 1-2 short 2-3 +8000 1-2 1-2 short 1-2 +There are two ways to program the stubs. We advise you to +use method 1, since it is simpler. Method 2 is unsupported and requires +a bit of fiddling. +Method 1: +Program the binary stub image into two EPROMs, E and O. EPROM +E should contain the even bytes, and O the odd bytes (your EPROM +programmer should have the ability to split the image). +EPROM E should be installed in socket IC8, and EPROM O should +be installed in socket IC4. +Set JP6 to 16 bit mode (1-2 soldered, 2-3 cut) Set SW1-4 +to ON and SW2-1 to OFF. + +Method2: +Assuming that the stub binary is smaller than 32 kB, you can +install it in a single EPROM. +Compile the mkcqrom.c program +found in the misc directory. +Use it to convert the binary image to the required format. +See the mkcqrom.c source for a +description of what is done, and why it is necessary. + % mkcqrom gdb_module.bin gdb_mangled.bin +Program the gdb_mangled.bin file +into an EPROM and install it in socket IC4 +Set JP6 to 8 bit mode (cut 1-2, solder 2-3) +The GDB stubs allow communication with GDB using the serial +port at connector CN7. The communication parameters are fixed at +38400 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1). No +flow control is employed. Connection to the host computer should +be made using a straight through serial cable. + + + +SH4/SE7751 Hardware Setup +Please see the RedBoot manual for instructions on how to repare +the board for use with eCos. + + +NEC CEB-V850/SA1 Hardware Setup +The CEB-V850 board is fitted with a socketed EPROM. The internal +Flash of the V850 supplied with the CEB-V850 boards defaults to +vectoring into this EPROM. A GDB stub image should be programmed +into an EPROM fitted to this board, and a prebuilt image is provided +at loaders/v850-ceb_v850/v850sa1/gdb_module.bin under +the root of your eCos installation. +The EPROM is installed to the socket labelled U7 on the board. +Attention should be paid to the correct orientation of the EPROM +during installation. +When programming an EPROM using the binary image, be careful +to get the byte order correct. It needs to be little-endian. If +the EPROM burner software has a hex-editor, check that the first +few bytes of the image look similar to: +00000000: 0018 8007 5e02 0000 0000 0000 0000 0000 +If the byte order is wrong you will see 1800 instead of 0018 +etc. Use the EPROM burner software to make a byte-swap before you +burn to image to the EPROM. +If the GDB stub EPROM you burn does not work, try reversing +the byte-order, even if you think you have it the right way around. +At least one DOS-based EPROM burner program is known to have the +byte-order upside down. +The GDB stub in the EPROM allows communication with GDB using +the serial port. The communication parameters are fixed at 38400 +baud, 8 data bits, no parity bit and 1 stop bit (8-N-1). No flow +control is employed. Connection to the host computer should be made +using a dedicated serial cable as specified in the CEB-V850/SA1 +manual. + +Installing the Stubs into ROM + +Preparing the Binaries +These two binary preparation steps are not strictly necessary +as the eCos distribution ships with precompiled binaries in the +directory loaders/v850-ceb_v850 relative to the +installation root. + +Building the ROM images with the eCos Configuration Tool + + +Start with a new document - selecting the +File->New + menu item if necessary to do this. + + +Choose the +Build->Templates + menu item, and then select the NEC CEB-V850/SA1 hardware. + + +While still displaying the +Build->Templates + dialog box, select the “stubs” package template +to build a GDB stub. Click +OK. + + +Build eCos using +Build->Library. + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix “gdb_module”. + + + + +Building the ROM images with ecosconfig + + +Make an empty directory to contain the build tree, +and cd into it. + + +To build a GDB stub ROM image, enter the command: + +$ ecosconfig new ceb-v850 stubs + + +Enter the commands: + +$ ecosconfig tree +$ make + + + +When the build completes, the image files can be found +in the bin/ subdirectory of the install tree. GDB stub +ROM images have the prefix “gdb_module”. + + + + + + Installing the Stubs into ROM or FLASH + + + Program the binary image file gdb_module.bin +into ROM or FLASH referring to the instructions of your ROM + programmer. + + + Plug the ROM/FLASH into the socket as described +at the beginning of this section. + + + + + +Debugging with the NEC V850 I.C.E. +eCos applications may be debugged using the NEC V850 In Circuit +Emulator (I.C.E.) A PC running Microsoft Windows is required in +order to run the NEC ICE software and drivers. In addition Red Hat +have developed a “libremote” server application +named v850ice.exe which is used on the PC connected to the I.C.E. +in order to allow connections from GDB. +The I.C.E. must be physically connected to a Windows NT system +through NEC"s PCI or PC Card interface. A driver, DLLs, +and application are provided by NEC to control the I.C.E. +v850ice is a Cygwin based server that runs on the NT system +and provides an interface between the gdb client and the I.C.E. +software. v850-elf-gdb may be run on the Windows NT system or on +a remote system. v850-elf-gdb communicates with the libremote server +using the gdb remote protocol over a TCP/IP socket. v850ice +communicates with the I.C.E. by calling functions in the NECMSG.DLL provided +by NEC. + +INITIAL SETUP + + +Configure the hardware including the I.C.E., SA1 or +SB1 Option Module, and target board. Install the interface card +in the Windows NT system. Reference NEC"s documentation +for interface installation, jumper settings, etc. + + +Install the Windows NT device driver provided by NEC. + + +Copy the NEC DLLs, MDI application, and other support +files to a directory on the Windows NT system. The standard location +is C:\NecTools32. This directory will be refered to as +the "libremote server directory" in this document. v850ice.exe must +also be copied to this directory after being built. The required +files are: cpu.cfg, Nec.cfg, MDI.EXE, NECMSG.DLL, EX85032.DLL, +V850E.DLL, IE850.MON, IE850E.MON, and D3037A.800. + + +Make certain the file cpu.cfg contains the line: +CpuOption=SA1 +if using a V850/SA1 module, or: +CpuOption=SB1 +if using a V850/SB1 module. + + +Set the environment variable IEPATH to point to the libremote +server +directory. + + + + +BUILD PROCEDURES +A prebuilt v850ice.exe executable is supplied in the loaders/v850-ceb_v850 directory +relative to the root of the eCos installation. However the following process +will allow the rebuilding of this executable if required: +For this example assume the v850ice libremote tree has been +copied to a directory named "server". The directory structure will +be similar to the following diagram: + server + | + devo + / \ + config libremote + / \ + lib v850ice +Build the v850ice source as follows. Be sure to use the native +Cygwin compiler tools that were supplied alongside eCos. +cd server +mkdir build +cd build +../devo/configure --target=v850-elf --host=i686-pc-cygwin +make +The resultant libremote server image (v850ice.exe) can be +found in build/libremote/v850ice. Copy v850ice.exe +to the lib remote server directory. + + +V850ICE.EXE EXECUTION +The v850ice command line syntax is: +v850ice [-d] [-t addr] [port number] +The optional -d option enables debug output. The -t option +is associated with thread debugging - see the "eCos thread debugging" +section below for details. By default v850ice listens on port 2345 +for an attach request from a gdb client. A different port number +may be specified on the command line. +To run the libremote server: + + +Power on the I.C.E. and target board. + + +Open a Cygwin window. + + +Run v850ice. + + +You will see the MDI interface window appear. In this +window you should see the "Connected to In-Circuit Emulator" message. + In the Cygwin window, the libremote server will indicate it is +ready to accept a gdb client connection with the message "v850ice: + listening on port 2345." + + + + +V850-ELF-GDB EXECUTION +Run the v850-elf-gdb client to debug the V850 target. It +is necessary to issue certain configuration commands to the I.C.E. +software. These commands may be issued directly in the MDI window +or they may be issued from the gdb client through the "monitor" +command. +On the Cosmo CEB-V850 board, on-chip Flash is mapped at address +0x0, the on-board EPROM at 0x100000 and the on-board RAM at 0xfc0000. +Since a standalone V850 will start executing from address 0x0 on +reset, it is normal to load either an application or a bootstrap +loader for Flash at this address. eCos programs may be built to +boot from Flash or the on-board EPROM. If building for the on-board +EPROM, it would be expected that the Flash will contain the default +CEB-V850 flash contents. An ELF format version of the default contents +may be found in the eCos distribution with the name v850flash.img. +In standalone operation, normally the code in this flash image +would have been programmed into the V850 on the Cosmo board, and +this would cause it to vector into the on-board EPROM to run the +application located there. In the case of eCos, this application +may be a GDB stub ROM application, allowing the further download +to RAM over serial of actual applications to debug. +As an example, we shall demonstrate how to use the I.C.E. +to download the v850flash.img and GDB stub EPROM image using I.C.E. +emulator memory only, and not requiring any actual programming of +devices. +v850-elf-gdb -nw +(gdb) file v850flash.img +(gdb) target remote localhost:2345 +(gdb) monitor reset +(gdb) monitor cpu r=256 a=16 +(gdb) monitor map r=0x100000-L 0x80000 +(gdb) monitor map u=0xfc0000-L 0x40000 +(gdb) monitor pinmask k +(gdb) monitor step +(gdb) monitor step +(gdb) monitor step +(gdb) monitor step +(gdb) load +(gdb) detach +(gdb) file gdb_module.img +(gdb) target remote localhost:2345 +(gdb) load +(gdb) continue +NOTE: The four "monitor step" commands are only required the +first time the board is connected to the I.C.E., otherwise the program +will fail. +This is because of a limitation of the I.C.E. hardware that +means that the first time it is used, the "map" commands are not +acted on and the addresses "0x100000" and "0xfc0000" are not mapped. +This can be observed using the command "td e-20" in the MDI application"s +console to display the trace buffer, which will show that the contents +of address 0x100000 are not valid. Subsequent runs do not require +the "monitor step" commands. +It is unusual to load two executable images to a target through +gdb. From the example above notice that this is accomplished by +attaching to the libremote server, loading the flash image, detaching, +reattaching, and loading the ROM/RAM image. It is more +normal to build an executable image that can be executed directly. +In eCos this is achieved by selecting either the ROM or ROMRAM startup +type, and optionally enable building for the internal FLASH. The +I.C.E. emulator memory can emulate both the internal FLASH and the +EPROM, so real hardware programming is not required. +Upon running this example you will notice that the libremote +server does not exit upon detecting a detach request, but simply +begins listening for the next attach request. To cause v850ice +to terminate, issue the "monitor quit" or "monitor exit" command +from the gdb client. v850ice will then terminate with the next +detach request. (You can also enter control-c in the Cygwin/DOS +window where v850ice is running.) + + +MDI INTERFACE VS. GDB INTERFACE +If a filename is referenced in an MDI command, whether the +command is entered in the MDI window or issued from the gdb client +with the monitor command, the file must reside on the Windows NT +libremote server system. When specifying a filename when entering +a command in the MDI window it is obvious that a server local file +is being referenced. When issuing an MDI command from the gdb client, the +user must remember that the command line is simply passed to the +I.C.E. software on the server system. The command is executed by +the I.C.E. software as though it were entered locally. +Executable images may be loaded into the V850 target by entering +the "load" command in the MDI window or with the gdb "load" command. + If the MDI load command is used, the executable image must be located +on the server system and must be in S Record format. If the gdb +load command is used, the executable image must be located on the +client system and must be in ELF format. +Be aware that the gdb client is not aware of debugger commands +issued from the MDI window. It is possible to cause the gdb client +and the I.C.E. software to get out of sync by issuing commands from +both interfaces during the same debugging session. + + +eCos THREAD DEBUGGING +eCos and the V850 I.C.E. libremote server have been written +to work together to allow debugging of eCos threads. This is an +optional feature, disabled by default because of the overheads trying +to detect a threaded program involves. +Obviously thread debugging is not possible for programs with +"RAM" startup type, as they are expected to operate underneath a +separate ROM monitor (such as a GDB stub ROM), that itself would +provide its own thread debugging capabilities over the serial line. +Thread debugging is relevant only for programs built for Flash, ROM, +or ROMRAM startup. +To configure the libremote server to support thread debugging, +use the command: +(gdb) monitor syscallinfo ADDRESS +at the GDB console prompt, where ADDRESS is the address of +the syscall information structure included in the applications. +In eCos this has been designed to be located at a consistent address +for each CPU model (V850/SA1 or V850/SB1). It +may be determined from an eCos executable using the following command +at a cygwin bash prompt: +v850-elf-nm EXECUTABLE | grep hal_v85x_ice_syscall_info +At the current time, this address is 0xfc0400 for a Cosmo +board fitted with a V850/SA1, or 0xfc0540 for a Cosmo board +fitted with a V850/SB1. +So for example, the GDB command for the SB1 would be: +(gdb) monitor syscallinfo 0xfc0540 +Given that the syscallinfo address is fixed over all eCos +executables for a given target, it is possible to define it on the +libremote command line as well using the "-t" option, for example: +bash$ v850ice -t 0xfc0400 +v850ice: listening on port 2345 + + + + +NEC CEB-V850/SB1 Hardware Setup +The instructions for setting up the CEB-V850/SB1 +are virtually identical to those of the CEB-V850/SA1 above. +The only significant differences are that prebuilt loaders are available +at loaders/v850-ceb_v850/v850sb1 within +the eCos installation. Binaries supporting boards with both 16MHz +and 8MHz clock speeds are supplied. Also when building applications, +or rebuilding the stubs for a V850/SB1 target, then the +V850 CPU variant must be changed in the CEB-V850 HAL to the SB1. + + +i386 PC Hardware Setup +For information about setting up the PC to run with RedBoot, +consult the RedBoot User"s Guide. If using serial debugging, +the serial line runs at 38400 baud 8-N-1 and should be connected +to the debug host using a null modem cable. If ethernet debugging +is required, an i82559 compatible network interface card, such as +an Intel EtherExpress Pro 10/100, should be installed +on the target PC and connected to the development PC running GDB. +When RedBoot is configured appropriately to have an IP address set, +then GDB will be able to debug directly over TCP/IP to the +target PC. + + +<!-- <conditionaltext> --><!-- <index></index> -->i386/Linux Synthetic Target Setup +When building for the synthetic Linux target, the resulting +binaries are native Linux applications with the HAL providing suitable +bindings between the eCos kernel and the Linux kernel. + +Please be aware that the current implementation of the Linux +synthetic target does not allow thread-aware debugging. + +These Linux applications cannot be run on a Windows system. +However, it is possible to write a similar HAL emulation for the +Windows kernel if such a testing target is desired. + +Tools +For the synthetic target, eCos relies on features not available +in native compilers earlier than gcc-2.95.1. It also requires version +2.9.5 or later of the GNU linker. If you have gcc-2.95.1 or later +and ld version 2.9.5 or later, then you do not need to build new +tools. eCos does not support earlier versions. You can check the compiler +version using gcc -v or egcs +-v, and the linker version using ld +-v. +If you have native tools that are sufficiently recent for +use with eCos, you should be aware that by default eCos assumes +that the tools i686-pc-linux-gnu-gcc, i686-pc-linux-gnu-ar, + i686-pc-linux-gnu-ld, and i686-pc-linux-gnu-objcopy are +on your system and are the correct versions for use with eCos. But +instead, you can tell eCos to use your native tools by editing the +configuration value "Global command prefix" (CYGBLD_GLOBAL_COMMAND_PREFIX) +in your eCos configuration. If left empty (i.e. set to the empty +string) eCos will use your native tools when building. +If you have any difficulties, it is almost certainly easiest +overall to rebuild the tools as described on: http://sources.redhat.com/ecos/getstart.html + + + + +<!-- <index></index> --><!-- <xref> -->Running <!-- <index></index> -->Applications +on the Target +At this point you should have installed the eCos software +on your system (see ), +and connected to a hardware target (see ). +To verify both that a hardware target is properly set up, +and that the GDB commands used to connect to the target (hardware, +simulator or synthetic) work properly on your system, you will now +be guided through downloading and executing a prebuilt eCos test. +The procedure is exactly the same when you want to download and +run applications or tests that you have built yourself. +On Windows you must have the bash command line interpreter +running with some environment variables that are useful for eCos +work. If you have purchased the eCos Developer's +Kit, you can select this by selecting Start->Programs->Red +Hat eCos->eCos Development Environment. If +you are using the eCos Net Release, you should +set the environment variables as shown in the GNUPro Toolkit Reference +Manual. On Linux, simply open a new shell window. +You will need to change directory to the prebuilt tests that +are provided in the eCos installation, as follows: +for the SHARP LH77790A-based AEB-1 boards: + $ cd BASE_DIR/prebuilt/aeb/tests/kernel/&Version;/tests +for the ARM7-based Cogent CMA230 board: + $ cd BASE_DIR/prebuilt/cma230/tests/kernel/&Version;/tests +for the StrongARM based Intel EBSA board: + $ cd BASE_DIR/prebuilt/ebsa285/tests/kernel/&Version;/tests +for the ARM-based Cirrus Logic EP72xx Development boards: + $ cd BASE_DIR/prebuilt/edb7xxx/tests/kernel/&Version;/tests +for the ARM-based ARM PID board: + $ cd BASE_DIR/prebuilt/pid/tests/kernel/&Version;/tests +for the StrongARM-based ARM Brutus board: + $ cd BASE_DIR/prebuilt/brutus/tests/kernel/&Version;/tests +for the StrongARM-based ARM Assabet board: + $ cd BASE_DIR/prebuilt/assabet/tests/kernel/&Version;/tests +for the AM31 simulator target: + $ cd BASE_DIR/prebuilt/am31_sim/tests/kernel/&Version;/tests +for the AM33-based Matsushita STB board: + $ cd BASE_DIR/prebuilt/stb/tests/kernel/&Version;/tests +for the AM31-based Matsushita stdeval1 board: + $ cd BASE_DIR/prebuilt/stdeval1/tests/kernel/&Version;/tests +for the MPC8xx-based Cogent CMA28x boards: + $ cd BASE_DIR/prebuilt/cma28x/tests/kernel/&Version;/tests +for the MPC8xx-based Motorola FADS board: + $ cd BASE_DIR/prebuilt/fads/tests/kernel/&Version;/tests +for the MPC8xx-based Motorola MBX boards: + $ cd BASE_DIR/prebuilt/mbx/tests/kernel/&Version;/tests +for the PowerPC minimal simulator target: + $ cd BASE_DIR/prebuilt/psim/tests/kernel/&Version;/tests +for the TX3904-based Toshiba JMR-TX3904 board: + $ cd BASE_DIR/prebuilt/jmr3904/tests/kernel/&Version;/tests +for the TX39 simulator target: + $ cd BASE_DIR/prebuilt/tx39_sim/tests/kernel/&Version;/tests +for the TX49based Toshiba REF4995 board: + $ cd BASE_DIR/prebuilt/ref4955/tests/kernel/&Version;/tests +for the VR4300-based NEC VRC4373 board: + $ cd BASE_DIR/prebuilt/vrc4373/tests/kernel/&Version;/tests +for the SH7708-based Hitachi EDK/SH7708 board: + $ cd BASE_DIR/prebuilt/sh7708/tests/kernel/&Version;/tests +for the SH3-based CQ cq7708 board a prebuilt test is provided in: + $ cd BASE_DIR/prebuilt/cq7708/tests/kernel/tests +for the SH4-based CQ cq7750 board a prebuilt test is provided in: + $ cd BASE_DIR/prebuilt/cq7750/tests/kernel/tests +for the SE7751-based Hitachi Solutions Engine board: + $ cd BASE_DIR/prebuilt/se7751/tests/kernel/&Version;/tests +for the SE77x9-based Hitachi Solutions Engine board: + $ cd BASE_DIR/prebuilt/se77x9/tests/kernel/&Version;/tests +for the SPARClite-based Fujitsu MB86800-MA01 board: + $ cd BASE_DIR/prebuilt/sleb/tests/kernel/&Version;/tests +for the SPARClite minimal simulator target: + $ cd BASE_DIR/prebuilt/sparclite_sim/tests/kernel/&Version;/tests +for the i386 PC target: + $ cd BASE_DIR/prebuilt/pc/tests/kernel/&Version;/tests +for the NEC CEB-V850SA1 + $ cd BASE_DIR/prebuilt/ceb_v850/tests/kernel/&Version;/tests + +for the i386-based Linux synthetic +target: + $ cd BASE_DIR/prebuilt/linux/tests/kernel/&Version;/tests +To execute the thread_gdb test +case on the desired target, + + +Run GDB in command line mode using the following command, +remembering to substitute the appropriate name for the architecture's +gdb, eg. <target>-gdb: +$ gdb -nw thread_gdb +GDB will display a copyright banner and then display a prompt (gdb). + + +Connect to the target according to the instructions given +earlier (in ) +- via serial or ethernet to hardware targets, or directly, for simulator and synthetic +targets. + + +Depending on the target type, you will be notified about a successful + connection, and possibly see some output informing you of the current +program counter of the target. + + +Download the test - effectively loading the test case +executable into the memory of the target - by typing this command: +(gdb) load +Again, depending on the target, you may see some output describing +how much data was downloaded, and at what speed. + + +Start the test case running. For hardware targets this +is done with the +continue + command, while +run + must be used on simulators and synthetic targets: +(gdb) continue +or +(gdb) run +You should now see a number of text messages appear, such +as: +PASS:<GDB Thread test OK> +EXIT:<done> + +eCos has no concept of the application exiting. All eCos test +cases complete and then run in a continuous tight loop. To return +control to GDB you must stop the application. +The usual method of stopping an application is with +Ctrl+C +, but +Ctrl+C + may not work on your platform for the prebuilts. First, make default +tests and check that they work the same way as prebuilts, then modify +your config to enable GDB stubs (if applicable) and break support, +so that a +Ctrl+C + character will interrupt the application. + Another way to stop the application is by means of a breakpoint. +Before running the application, breakpoint +cyg_test_exit() + to stop an eCos test case at its end. + + +When an eCos program is run on ARM or SH3 boards, the GDB + +stub in ROM does not provide thread debugging or asynchronous GDB +interrupt support. If you require full debugging capabilities, you +must include GDB stub support when configuring eCos. + +The usual method of stopping an application is with Ctrl+C, +but Ctrl+C may not work on your platform +for the prebuilts. First, make default tests and check that they +work the same way as prebuilts, then modify your config to enable GDB +stubs (if applicable) and break support, so that a Ctrl+C character +will interrupt the application. +Another way to stop the application is by means of a breakpoint. +Before running the application, breakpoint cyg_test_exit() to +stop an eCos test case at its end. +The full functionality of GDB is now available to you, including +breakpoints and watchpoints. Please consult the GNUPro GDB +documentation for further information. + + + + +Test Suites +The eCos kernel and other packages have test suites which +rigorously exercise the available features and confirm correct execution. +The tests are run on many different possible configurations, but +the high number of configuration permutations makes it impossible +to test them all. The use of test suites is particularly important +for embedded systems, where software robustness is a priority. All +eCos software is tested prior to shipping, but if you define your +own configuration, you will probably want to verify that the test +cases work for it. +This release includes test suites for the eCos +kernel, kernel C API, C library, µITRON compatibility, +and device driver packages. The use of the test suites is similar +for all packages. The tests are supplied as source code for building +with specific eCos configurations. +Each test suite consists of a number of test cases which can +be executed individually, as shown below for the TX39, AM31 and +AM33 PowerPC StrongARM SH3, VR4300 SPARClite hardware target, and +all supported ARM platforms, including the Cirrus Logic EP7211 and +EP7212 Development Boards if connecting via a serial line. +Using the eCos Configuration +Tool it is possible to automate the downloading and execution +of tests with the appropriately configured eCos packages. To do +so, compile and link the test cases by using the Build->Tests menu +item, after which the tests can be downloaded and executed by selecting Tools->Run +Tests. See . +To compile and run tests using the command line: + + +Type “make tests”. + + +Start GDB, using the correct command prefix for your platform +(see “GDB and GCC Command Notation” on page 19). + + +Set up the baud rate, usually with +(gdb) set remotebaud 38400 (19200). + + +Select the target board, usually with +(gdb) target remote com1 + on Windows or +(gdb) target remote /dev/ttyS0 +on Linux. + + +download the test program, usually with +(gdb) load +. This can take some time. + + +execute the test program, usually with +(gdb) continue. + + +When executing +test cases on the Fujitsu SPARClite +Evaluation Board via an TCP connection to the board, the following +steps are required: + + +Start GDB using the test case file name as an argument. + + +connect to the target board with +(gdb) target remote xxx:1000 + where xxx is the IP address or hostname assigned to the board. + + +download the test program with +(gdb) load. + + +execute the test program with +(gdb) continue. + + +When executing test cases on the Cirrus Logic EP7211 or EP7212 +Development Boards and connecting with the ARM Multi-ICE Interface +Unit, follow the instructions in the manual GNUPro Toolkit reference +for eCos ARM/Thumb. +When executing test cases on the Linux synthetic target, it +is possible to run them directly from the command line. If debugging +is needed, only the following steps are required: + + +start GDB using the test case file name as an argument + + +execute the test program with (gdb) run + + +Each test case runs without further intervention. A test case +may involve one or more individual tests. Successful completion +of each test within the test case is reported as a line of text +that is sent to the diagnostic channel (usually the serial port) +for display on a terminal or terminal emulator. +Each test case runs only once and usually requires the target +hardware to be reset on completion. Note that certain test cases +may not terminate immediately, especially if they involve delays +and run on the target simulators. +In the CD distribution of the eCos Developer’s Kit, +the test cases are located as follows: + + +one prebuilt “thread_gdb” test +compiled for +RAM start-up (needs CygMon or an eCos GDB stub in ROM, and will +only run on real hardware): +BASE_DIR/prebuilt/&Version;/mn10300_am31-stdeval-ram for the MN10300 AM31 standard evaluation board. +BASE_DIR/prebuilt/&Version;/mn10300_am33-stb-ram for the AM33 STB system reference board. +BASE_DIR/prebuilt/&Version;/tx39-jmr3904-ram for the TX39. +BASE_DIR/prebuilt/&Version;/powerpc-cogent-ram for the PowerPC Cogent board. +BASE_DIR/prebuilt/&Version;/powerpc-mbx-ram for the PowerPC MBX860 board. +BASE_DIR/prebuilt/&Version;/sparclite-sleb-ram for the SPARClite. +BASE_DIR/prebuilt/&Version;/arm-pid-ram for the ARM PID board. +BASE_DIR/prebuilt/&Version;/arm-pidT-ram for the ARM PID in Thumb mode. +BASE_DIR/prebuilt/&Version;/arm-aeb-ram for the ARM AEB-1 board. +BASE_DIR/prebuilt/&Version;/arm-cma230-ram for the Cogent CMA230 board. +BASE_DIR/prebuilt/&Version;/arm-edb7xxx-ram for the Cirrus Logic EP7211 development board +BASE_DIR/prebuilt/&Version;/arm-pid-ram for the VR4300. +BASE_DIR/prebuilt/&Version;/sh-edk7708-ram for the SH3 in big-endian mode. +BASE_DIR/prebuilt/&Version;/sh-edk7708le-ram for the SH3 in little-endian mode. + + + +one prebuilt “thread_gdb” test +compiled for +ROM start-up: +BASE_DIR/prebuilt/&Version;/mn10300_am31-stdeval-rom for the MN10300 AM31 standard evaluation board. +BASE_DIR/prebuilt/&Version;/mn10300_am33-stb-rom for the AM33 STB system reference board. +BASE_DIR/prebuilt/&Version;/tx39-jmr3904-rom for the TX39. +BASE_DIR/prebuilt/&Version;/powerpc-cogent-rom for the PowerPC Cogent board. +BASE_DIR/prebuilt/&Version;/powerpc-mbx-rom for the PowerPC MBX860 board. +BASE_DIR/prebuilt/&Version;/sparclite-sleb-rom for the SPARClite. +BASE_DIR/prebuilt/&Version;/arm-pid-rom for the ARM PID board. +BASE_DIR/prebuilt/&Version;/arm-pidT-rom for the ARM in Thumb mode. +BASE_DIR/prebuilt/&Version;/arm-aeb-rom for the ARM AEB-1 board. +BASE_DIR/prebuilt/&Version;/arm-cma230-rom for the ARM CMA230 board. +BASE_DIR/prebuilt/&Version;/arm-edb7xxx-rom for the Cirrus Logic EP7211 development board +BASE_DIR/prebuilt/&Version;/mips_vr4300-vrc4373-rom for the VR4300. +BASE_DIR/prebuilt/&Version;/sh-edk7708-rom for the SH3 in big-endian mode. +BASE_DIR/prebuilt/&Version;/sh-edk7708le-rom for the SH3 in little-endian mode. + +For targets that do not have simulator support, the ROM tests + will work if programmed into ROM/FLASH, or if using a PROM + emulator. + + + +one prebuilt +synthetic target test (will work on Linux only): +BASE_DIR/prebuilt/&Version;/i386-linux +for i386. +test case source code is under the base source directory BASE_DIR/packages +/ + + +compat/uitron/&Version;/tests + + +io/serial/&Version;/tests + + + + +hal/powerpc/arch/&Version;/test + + +devs/wallclock/&Version;/tests + + +devs/watchdog/&Version;/tests + + +kernel/&Version;/tests + + +language/c/libc/&Version;/tests + + +language/c/libm/&Version;/tests + + + + +In you + will find detailed instructions on running a test case to + verify that your hardware board is working with the supplied + software. Instructions for testing on a simulator are in . + + + +<!-- <conditionaltext> --><!-- <xref> --><!-- <index></index> -->Programming Tutorial + +Programming with eCos +The remaining chapters of this manual comprise a simple tutorial +for configuring and building eCos, building and running eCos tests, +and finally building three stand-alone example programs which use +the eCos API to perform some simple tasks. +You will need a properly installed eCos system, with the accompanying +versions of the GNUPro tools. +On Windows you will +be using the bash command line interpreter that comes with Cygwin, +with the environment variables set as described in the GNUPro documentation. + +The Development Process +Most development projects using eCos would contain some (or +most) of the following: + +eCos Configuration +eCos is configured to provide the desired API (the inclusion +of libc, uitron, and the disabling of certain undesired funtions, +etc.), and semantics (selecting scheduler, mutex behavior, etc.). +See . +It would normally make sense to enable eCos assertion checking +at this time as well, to catch as many programming errors during +the development phase as possible. +Note that it should not be necessary to spend much time on +eCos configuration initially. It may be important to perform fine +tuning to reduce the memory footprint and to improve performance +later when the product reaches a testable state. + + + Integrity check of the eCos configuration +While Red Hat strive to thoroughly test eCos, the vast number +of configuration permutations mean that the particular configuration +parameters used for your project may not have been tested. Therefore, +we advise running all the eCos tests after the project's +eCos configuration has been determined. See . +Obviously, this should be repeated if the configuration changes +later on in the development process. + + + Application Development - Target Neutral Part +While your project is probably targeting a specific architecture +and platform, possibly custom hardware, part of the application +development may be possible to perform using simulated or synthetic +targets. +There are two primary reasons for doing this: + + +It may be possible by this means to perform application +development in parallel with the design/implementation +of the target hardware, thus providing more time for developing +and testing functionality, and reducing time-to-market. + + +The build-run-debug-cycle may be faster when the application +does not have to be downloaded to a target via a serial interface. +Debugging is also likely to be more responsive when you do not have +to to communicate with a stub via serial. It also removes the need +for manually or automatically resetting the target hardware. + + +This is approach is possible because all targets (including +simulators and synthetic ones) provide the same basic API: that +is, kernel, libc, libm, uitron, infra, and to some extent, HAL and +IO. +Synthetic targets are especially suitable as they allow you +to jury-rig simulations of elaborate devices by interaction with +the host system, where an IO device API can hide the details from +the application. When switching to hardware later in the development +cycle, the IO driver is properly implemented. While this is possible +to do, and has been done, it is not specifically documented or supported +by Red Hat. It may become so later. +Therefore, select a simulator or synthetic target and use +it for as long as possible doing application development. That is, +configure for the selected target, build eCos, build the application +and link with eCos, run and debug. Repeat the latter two steps. +Obviously, at some time you will have to switch to the intended +target hardware, for example when adding target specific feature +support, for memory footprint/performance characterization, +and for final tuning of eCos and the application. + + + Application Development - Target Specific Part +Repeat the build-run-debug-cycle while performing final tuning +and debugging of application. Remember to disable eCos assertion +checking, as it reduces performance. +It may be useful to switch between this and the previous step +repeatedly through the development process; use the simulator/synthetic +target for actual development, and use the target hardware to continually +check memory footprint and performance. There should be little cost +in switching between the two targets when using two separate build +trees. + + + + + + + +<!-- <xref> --><!-- <index></index> -->Configuring and Building eCos from Source + +This chapter documents the configuration of eCos, using the +ARM PID board as an example. The process is the same for any of +the other supported targets: you may select a hardware target (if +you have a board available), any one of the simulators, or a synthetic +target (if your host platform has synthetic target support). + +At the end of the chapter is a section describing special +issues for this architecture which may affect the way you should +configure eCos for your target. + + + + + +<!-- <xref> -->eCos Start-up Configurations + +There are various ways to download an executable image to +a target board, and these involve different ways of preparing the +executable image. In the eCos Hardware Abstraction Layer (HAL package) +there are configuration options to support the different download +methods. The following table summarizes the ways in which an eCos +image can be prepared for different types of download. + + + + +Configuration for various download methods + + + +Download method +HAL configuration + + + + +Burn hardware ROM + ROM start-up + + +Download to ROM emulator + ROM start-up + + +Download to board with CygMon or GDB stub ROM + RAM start-up + + +Download to simulator without CygMon or GDB stub ROM + ROM start-up + + +Download to simulator with CygMon + RAM start-up + + +Download to simulator ignoring devices + SIM configuration + + +Run synthetic target + RAM start-up + + + +
+ + +You cannot run an application configured for RAM start-up +on the simulator directly: it will fail during start-up. You can +only download it to the simulator if +you are already running CygMon (or a GDB stub) in the simulator, +as described in the GNUPro documentation +or you load through the +SID +GDB debugging component. This is not the same as the simulated +stub, since it does not require a target program to be running to +get GDB to talk to it. It can be done before letting the simulator +run +or you use the ELF loader component to get a program into memory. + + + +Configuring eCos' HAL package for simulation should +rarely be needed for real development; binaries built with such +a kernel will not run on target boards at all, +and the MN10300 and +TX39 simulators can run binaries built for stdeval1 and jmr3904 +target boards. +The main use for a ``simulation'' configuration +is if you are trying to work around problems with the device drivers +or with the simulator. Also note that when using a TX39 system configured +for simulator start-up you should then invoke the simulator with +the +option instead of + + + + +If your chosen architecture does not have simulator support, +then the combinations above that refer to the simulator do not apply. +Similarly, if your chosen platform does not have CygMon or GDB stub +ROM support, the combinations listed above that use CygMon or GDB +stub ROMs do not apply. + + +The debugging environment for most developers will be either +a hardware board or the simulator, in which case they will be able +to select a single HAL configuration. +More information on the interactions between CygMon, the simulators, and GDB's +thread-aware debugging features is available in the GNUPro Reference Manual +for your specific architecture. +
+ + + + +<!-- <xref> -->Using the <!-- <index></index> --> +Configuration Tool on Windows and UNIX + + +Note that the use of the Configuration +Tool is described in detail in the eCos User's +Guide. + +The Configuration Tool (see ) +has five main elements: the configuration window, +the conflicts window, +the properties window, the short +description window, +and the output window. + +
+Configuration Tool + +
+ +Start by opening the templates window via Build->Templates. +Select the desired target (see ). + +
+Template selection + +
+ +Make sure that the configuration is correct for the target +in terms of endianness, CPU model, Startup type, etc. (see ). + +
+<!-- <conditionaltext> --><!-- <xref> -->Configuring +for the target + +
+ +Next, select the Build->Library menu +item to start building eCos (see ). +The application will +configure the sources, prepare a build tree, and build the libtarget.a library, +which contains the eCos kernel and other packages. + +The output from the configuration process and the building +of libtarget.a will be shown in the output +window. + +Once the build process has finished you will have a kernel +with other packages in libtarget.a. You should +now build the eCos tests for your particular configuration. + +Select Build->Batch +Build->Build to build the +test project. +
+Selecting the Build Library menu item + +
+ +The Save As dialog box will appear, asking +you to specify a directory in which to place your save file. You +can use the default, but it is a good idea to make a subdirectory, +called ecos-work for example. + +
+Save file dialog + +
+ +The first time you build an eCos library for a specific architecture, +the Configuration Tool may prompt you for the +location of the appropriate build tools (including make and gcc) +using a Build Tools dialog box (as shown in ). You can select a location from the drop down list, +browse to the directory using the Browse button, +or type in the location of the build tools manually. + +
+Build tools dialog + +
+ +The Configuration Tool may also prompt +you for the location of the user tools (such as cat and ls) using +a User Tools dialog box (as shown in ). As with +the Build Tools dialog, you can select a location +from the drop down list, browse to the directory using the Browse button, +or type in the location of the user tools manually. Note that on UNIX, this will often be unnecessary +as the tools will already be on your PATH. + +
+User tools dialog + +
+ +When the tool locations have been entered, the Configuration +Tool will configure the sources, prepare a build tree, +and build the libtarget.a library, which contains +the eCos kernel and other packages. + +The output from the configuration process and the building +of libtarget.a will be shown in the output +window. + +Once the build process has finished you will have a kernel +with other packages in libtarget.a. You should +now build the eCos tests for your particular configuration. + +You can do this by selecting Build -> Tests. +Notice that you could have selected Tests instead +of Library in the earlier step and it would +have built both the library and the tests, +but this would increase the build time substantially, and if you +do not need to build the tests it is unnecessary. + +
+Selecting the Build Tests menu item + +
+ will + guide you through running one of the test cases you just + built on the selected target, using GDB. +
+ + + + +<!-- <xref> -->Using <!-- <index></index> --> +ecosconfig on Windows and UNIX + +As an alternative to using the graphical Configuration Tool, +it is still possible to configure and build +a kernel by editing a configuration file manually and using the ecosconfig command. + +The following instructions assume that the PATH and ECOS_REPOSITORY environment +variables have been setup correctly as described in . +They also assume UNIX usage but equally well apply to Windows running Cygwin. + +Before invoking ecosconfig you need to +choose a directory in which to work. For the purposes of this tutorial, +the default path will be BASE_DIR/ecos-work. +Create this directory and change to it by typing: + +$ mkdir BASE_DIR/ecos-work +$ cd BASE_DIR/ecos-work + +To see what options can be used with ecosconfig, +type: + +$ ecosconfig --help + +The available packages, targets and templates may be listed +as follows: + +$ ecosconfig list + +Here is sample output from ecosconfig showing +the usage message. + + +Getting <!-- <index></index> --> +help from ecosconfig + +$ ecosconfig --help +Usage: ecosconfig [ qualifier ... ] [ command ] + commands are: + list : list repository contents + new TARGET [ TEMPLATE [ VERSION ] ] : create a configuration + target TARGET : change the target hardware + template TEMPLATE [ VERSION ] : change the template + add PACKAGE [ PACKAGE ... ] : add package(s) + remove PACKAGE [ PACKAGE ... ] : remove package(s) + version VERSION PACKAGE [ PACKAGE ... ] : change version of package(s) + export FILE : export minimal config info + import FILE : import additional config info + check : check the configuration + resolve : resolve conflicts + tree : create a build tree + qualifiers are: + --config=FILE : the configuration file + --prefix=DIRECTORY : the install prefix + --srcdir=DIRECTORY : the source repository + --no-resolve : disable conflict +resolution + --version : show version and copyright +$ + + + + +ecosconfig output — <!-- <index></index> --> +list of available packages, targets and templates + +$ ecosconfig list +Package CYGPKG_CYGMON (CygMon support via eCos): +aliases: cygmon +versions: &Version; +Package CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS1742 (Wallclock driver for Dallas 1742): +aliases: devices_wallclock_ds1742 device_wallclock_ds1742 +versions: &Version; +Package CYGPKG_DEVICES_WALLCLOCK_SH3 (Wallclock driver for SH3 RTC module): +aliases: devices_wallclock_sh3 device_wallclock_sh3 +versions: &Version; +Package CYGPKG_DEVICES_WATCHDOG_ARM_AEB (Watchdog driver for ARM/AEB board): +aliases: devices_watchdog_aeb device_watchdog_aeb +versions: &Version; +Package CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285 (Watchdog driver for ARM/EBSA285 board): +aliases: devices_watchdog_ebsa285 device_watchdog_ebsa285 +versions: &Version; +… + + + +For detailed information about how to edit the ecos.ecc file, +see the CDL Writer's Guide and Editing +an eCos Savefile in the eCos User's +Guide. + + +Selecting a <!-- <index></index> --> +Target + +To select the MN10300 (AM31) target, building for running +under the simulator, type: + +$ tclsh BASE_DIR/packages/pkgconf.tcl --target=mn10300 --platform=stdeval1 --startup=rom + +To select the AM33 target, the STB reference board platform, +and RAM start-up, type: + +$ tclsh BASE_DIR/packages/pkgconf.tcl --target=am33 --platform=stb --startup=ram +To select the TX39 target, building for running under the +simulator, type: + +$ tclsh BASE_DIR/packages/pkgconf.tcl --target=tx39 --platform=jmr3904 --startup=rom +To configure for a PowerPC target, building for running under +the simulator, type: + +$ tclsh BASE_DIR/packages/pkgconf.tcl --target=powerpc --platform=sim --startup=ram +To configure for a SPARClite target, building for running +under the simulator, type: + +$ tclsh BASE_DIR/packages/pkgconf.tcl --target=sparclite --platform=sim --startup=ram +To configure for a listed target, type: + +$ ecosconfig new <target> +For example, to configure for the ARM PID development board, +type: + +$ ecosconfig new pid + +Then edit the generated file, ecos.ecc, +setting the options as required for the target (endianess, CPU model, +Startup type, etc.) + +Create a build tree for the configured target by typing: + +$ ecosconfig tree + +You can now run the command make or make +tests, after which you will be at the same point you +would be after running the Configuration Tool on +Windows— you can start developing your own applications, +following the steps in . + +The procedure shown above allows you to do very coarse-grained +configuration of the eCos kernel: you can select which packages +to include in your kernel, and give target and start-up options. +But you cannot select components within a package, or set the very +fine-grained options. + +To select fine-grained configuration options you will need +to edit the configuration file ecos.ecc in the current directory +and regenerate the build tree. + + +You should follow the manual configuration process described +above very carefully, and you should read the comments in each file +to see when one option depends on other options or packages being +enabled or disabled. If you do not, you might end up with an inconsistently +configured kernel which could fail to build or might execute + incorrectly. + + + + + + + + +Architectural Notes + +ARM and Thumb Interworking +While GNUPro tools allow ARM and Thumb code to be mixed on +a per-object basis, the eCos library (libtarget.a) must be compiled +in whole for either ARM or Thumb. This is controlled by the "Enable +Thumb instruction set" (CYGHWR_THUMB) switch. Note that +not all targets have support for Thumb mode execution. +Adding to +the architecture options will allow the library to be linked with +the application code of either ARM or Thumb type - or a mix. See +the ARM GNUPro manuals for details about ARM and Thumb mode interworking. + + +CPU Family Model +Some targets can be equipped with either an ARM7 or an ARM9 +daughter CPU module. The "ARM CPU family" (CYGHWR_HAL_ARM_CPU_FAMILY) option + should be set accordingly. +Changing this option primarily affects compiler optimization +in this release. + + +CPU Endian Mode +Some targets support either little or big endian operation. +The "Use big-endian mode" (CYGHWR_HAL_ARM_BIGENDIAN) +option should be set accordingly. + + + + + +
+ +<!-- <xref> -->Test <!-- <index></index> -->Suites +The eCos kernel and other packages have test suites that rigorously +exercise the available features and confirm correct execution. The + tests are run on many different possible configurations, but the +high number of configuration permutations makes it impossible to +test them all. The use of test suites is particularly important +for embedded systems, where software robustness is a priority. All +eCos software is tested prior to shipping, but if you define your +own configuration, you will probably want to verify that the test +cases work for it. +This release includes test suites for the eCos kernel, kernel +C API, C library, ITRON compatibility, and device driver packages. +The use of the test suites is similar for all packages. The tests +are supplied as source code for building with your specific eCos + configurations. The test case source code is located under the base +source directory BASE_DIR/packages/: + + +compat/uitron/&Version;/tests + + + +hal/common/&Version;/tests + + + +io/serial/&Version;/tests + + + +io/wallclock/&Version;/tests + + + +devs/watchdog/&Version;/tests + + + +kernel/&Version;/tests + + +language/c/libc/&Version;/tests + + + +language/c/libm/&Version;/tests + + + There may be additional tests found in other packages. +Each test suite consists of a number of test cases which can +be executed individually. A test case may involve one or more individual + tests of the package's features. Successful completion +of each test within the test case is reported as a line of text +that is sent to the diagnostic channel (usually the serial port) +for display on a terminal or terminal emulator. +Each test case runs only once and usually requires target +hardware to be reset on completion. Note that certain test cases +may not terminate immediately, especially if they involve delays +and run on a target simulator. + + + + +Using the Configuration Tool + +Using the eCos Configuration Tool it is possible to automate +the downloading and execution of tests with the appropriately configured +eCos packages. To do so, compile and link the test cases by using +the Build->Tests menu item, after +which the tests can be downloaded and executed by selecting Tools->Run +Tests. +When a test run is invoked, a resizable property sheet is +displayed, comprising three tabs: Executables, Output and Summary. +Three buttons appear on the property sheet itself: Run/Stop, Close and Properties. +The Run button is used to initiate a +test run. Those tests selected on the Executables tab are run, +and the output recorded on the Output and Summary tabs. +During the course of a run, the Run button +changes to Stop. This button may be used to +interrupt a test run at any point. +See the eCos User's Guide for +further details. + + + + + +Using the command line +It may be necessary to run tests by hand if the automated +tool finds any failing tests: it may be necessary to diagnose the +problem by debugging the test. +Build the tests by typing ‘make tests' in +the root of the build directory. This will cause the tests to be +built and installed under <install-path>/tests/. +Running the test manually is done simply by invoking GDB, +connecting to the target, downloading the test, optionally setting +some breakpoints, and then running the test. All this was covered +in . + + + + + +Testing Filters +While most test cases today run solely in the target environment, +some packages may require external testing infrastructure and/or +feedback from the external environment to do complete testing. +The serial package is an example of this. It is the first +package to require external testing infrastructure, but it will +certainly not be the last. +Since the serial line is also used for communication with +GDB, a filter is inserted in the communication pathway between +GDB and the serial device which is connected to the hardware target. +The filter forwards all communication between the two, but also +listens for special commands embedded in the data stream from the +target. +When such a command is seen, the filter stops forwarding data +to GDB from the target and enters a special mode. In this mode +the test case running on the target is able to control the filter, +commanding it to run various tests. While these tests run, GDB is +isolated from the target. +As the test completes (or if the filter detects a target crash) +the communication path between GDB and the hardware target is re-established, +allowing GDB to resume control. +In theory, it is possible to extend the filter to provide +a generic framework for other target-external testing components, +thus decoupling the testing infrastructure from the (possibly limited) +communication means provided by the target (serial, JTAG, Ethernet, +etc). +Another advantage is that the host tools will not need to +know about the various testing environments required by the eCos +packages, since all contact with the target will continue to happen +via GDB. +It remains to be seen if it will be possible, or sensible, +to implement all target-external testing infrastructure via filters. + + + + + + +Running an eCos Test Case +In you +ran the prebuilt test case on real hardware; now you are ready to +run one of the test programs in the simulated environment or as +a Linux application. + +If the architecture you use does not have simulator support, +you need to run the following tests on the evaluation boards. Make +sure you have configured and built eCos for the correct board and +for RAM start-up instead of ROM start-up as described previously. +Consult “Test Suites” on page 112 for +details about downloading the test to the board. Otherwise, the +program behavior as described below should be the same. + + + + + +Using the Configuration Tool +Test executables that have been linked using the Build/Tests +operation against the current configuration can be executed by selecting + Tools->Run Tests. +When a test run is invoked, a property sheet is displayed, +comprising three tabs: Executables, Output and Summary. +Note that the property sheet is resizable. +Three buttons appear on the property sheet itself: Run/Stop, Close and Properties. +The Run button is used to initiate a +test run. Those tests selected on the Executables tab +are run, and the output recorded on the Output and Summary tabs. +During the course of a run, the Run button +changes to “Stop”. The button may be used to interrupt +a test run at any point. +See the eCos User’s Guide for +further details. + + + + + +Using the command line +Start a command shell (such as an MS-DOS window in Windows +NT) with the environment variables set as described in the GNUPro +documentation. If using a simulator, define the appropriate GDB +macro described in “ROM Monitor Image” on page 22. +Change to the directory in which you set up your build tree, and + invoke GDB +on the test program. +To run the bin_sem0 test +(which will test the kernel for the correct creation and destruction +of binary semaphores) type: +$ gdb -nw install/tests/kernel/&Version;/tests/bin_sem0 + + + + + +Starting up GDB +You should see output similar to the following in the command +window: +GNU gdb THIS-GDB-VERSION +Copyright 1998 Free Software Foundation, Inc. +GDB is free software, covered by the GNU General Public License, and you are +welcome to change it and/or distribute copies of it under certain conditions. +Type "show copying" to see the conditions. This version of GDB is supported +for customers of Red Hat. Type "show warranty" for details. +This GDB was configured as "--host=THIS-HOST --target=THIS-TARGET". +(gdb) +If you are trying to run a synthetic target test on Linux, +skip the simulator connection and download steps. Otherwise, specify +that you are using the simulator target (rather than real hardware) +by typing: +(gdb) msim +for the MN10300 AM31 +(gdb) tsim +for the TX39 +(gdb) psim +for the PowerPC. +(gdb) ssim +for the SPARClite. +At this point, if you are using the simulator, enter the appropriate +GDB macro to initialize it. You will then see output similar to +the following: +Connected to the simulator. +(gdb) +Now download the program to the (simulator) target with +(gdb) load +You should see output similar to the following on your screen: +Loading section .rom_vectors, size 0xc0 +lma 0x40000000 +Loading section .text, size 0x1b3b lma 0x400000c0 +Loading section .rodata, size 0x2f4 lma 0x40001bfc +Loading section .data, size 0x7c lma 0x40001ef0 +Start address 0x40000000 +Transfer rate: 64344 bits in <1 sec. +(gdb) +You are now ready to run your program as if this were an ordinary +debugging session with GDB. If you type +(gdb) run +you will see output similar to the following: +Starting program: /ecos-work/./install/tests/kernel/bin_sem0.exe +PASS:<Binary Semaphore 0 OK> +EXIT:<done> + + If you are using real hardware rather than a simulator, + you must use the GDB command “continue” rather + than “run” to start your program. + +You must kill your GDB session with Control+C, +or it will sit in the “idle” thread and use up +CPU time. Type quit and you are +done. +See also “Running Applications on the Target” on page 108. + + + + + + + + +<!-- <xref> -->Building and <!-- <index></index> -->Running Sample Applications +The example programs in this tutorial are included, along +with a Makefile, in the examples directory +of the eCos distribution. The first program you will run is a hello +world-style application, then you will run a more complex +application that demonstrates the creation of threads and the use +of cyg_thread_delay(), and finally you will run +one that uses clocks and alarm handlers. +The Makefile has two variables you will +need to adjust: PKG_INSTALL_DIR and XCC. +Edit the Makefile, setting PKG_INSTALL_DIR to +the install tree previously created by ecosconfig and +uncommenting the relevant XCC line for your +architecture. + + + + +eCos Hello World +The following code is found in the file hello.c +in the examples directory: + +eCos<!-- <index></index> --> +hello world program listing +/* this is a simple hello world program */ +#include <stdio.h> +int main(void) +{ + printf("Hello, eCos world!\n"); + return 0; +} +To compile this or any other program that is not part of the +eCos distribution, you can follow the procedures described below. Type +this explicit compilation instruction (assuming your current working +directory is also where you built the eCos kernel): +$ gcc -g -IBASE_DIR/ecos-work/install/include hello.c -LBASE_DIR/ecos-work/install/lib -Ttarget.ld -nostdlib +The compilation instruction above contains some standard GCC +options (for example, enables +debugging), as well as some mention of paths ( allows +files like cyg/kernel/kapi.h to +be found, and allows +the linker to find ). +The executable program will be called a.out. + +Some target systems require special options to be passed to +gcc to compile correctly for that system. Please examine the Makefile +in the examples directory to see if this applies to your target. + +You can now run the resulting program in the simulator using +GDB the way you ran the test case. The procedure will be the same, +but this time run "gdb" specifying "-nw a.out" on the command line: +$ gdb -nw a.out +For targets other than the synthetic linux target, you should +now run the usual GDB commands described earlier. Once this is done, +typing the command "run" at the (gdb) prompt ("continue" for real +hardware) will allow the program to execute and print the string +"Hello, eCos world!" on your screen. +On the synthetic linux target, you may use the "run" command +immediately - you do not need to invoke simulator macros, nor the +"load" command. + + + + + + + +A Sample Program with Two Threads +Below is a program that uses some of eCos' system +calls. It creates two threads, each of which goes into an infinite +loop in which it sleeps for a while (using cyg_thread_delay()). +This code is found in the file twothreads.c +in the examples directory. + +eCos <!-- <index></index> --> +two-threaded program listing +#include <cyg/kernel/kapi.h> +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +/* now declare (and allocate space for) some kernel objects, + like the two threads we will use */ +cyg_thread thread_s[2]; /* space for two thread objects */ + +char stack[2][4096]; /* space for two 4K stacks */ + +/* now the handles for the threads */ +cyg_handle_t simple_threadA, simple_threadB; + +/* and now variables for the procedure which is the thread */ +cyg_thread_entry_t simple_program; + +/* and now a mutex to protect calls to the C library */ +cyg_mutex_t cliblock; + +/* we install our own startup routine which sets up threads */ +void cyg_user_start(void) +{ + printf("Entering twothreads' cyg_user_start() function\n"); + + cyg_mutex_init(&cliblock); + + cyg_thread_create(4, simple_program, (cyg_addrword_t) 0, + "Thread A", (void *) stack[0], 4096, + &simple_threadA, &thread_s[0]); + cyg_thread_create(4, simple_program, (cyg_addrword_t) 1, + "Thread B", (void *) stack[1], 4096, + &simple_threadB, &thread_s[1]); + + cyg_thread_resume(simple_threadA); + cyg_thread_resume(simple_threadB); +} + +/* this is a simple program which runs in a thread */ +void simple_program(cyg_addrword_t data) +{ + int message = (int) data; + int delay; + + printf("Beginning execution; thread data is %d\n", message); + + cyg_thread_delay(200); + + for (;;) { + delay = 200 + (rand() % 50); + + /* note: printf() must be protected by a + call to cyg_mutex_lock() */ + cyg_mutex_lock(&cliblock); { + printf("Thread %d: and now a delay of %d clock ticks\n", + message, delay); + } + cyg_mutex_unlock(&cliblock); + cyg_thread_delay(delay); + } +} +When you run the program (by typing run at +the (gdb) prompt) the output should look like +this: +Starting program: BASE_DIR/examples/twothreads.exe +Entering twothreads' cyg_user_start() +function +Beginning execution; thread data is 0 +Beginning execution; thread data is 1 +Thread 0: and now a delay of 240 clock ticks +Thread 1: and now a delay of 225 clock ticks +Thread 1: and now a delay of 234 clock ticks +Thread 0: and now a delay of 231 clock ticks +Thread 1: and now a delay of 224 clock ticks +Thread 0: and now a delay of 249 clock ticks +Thread 1: and now a delay of 202 clock ticks +Thread 0: and now a delay of 235 clock ticks + +When running in a simulator the +delays might be quite long. On a hardware board (where the clock +speed is 100 ticks/second) the delays should average to +about 2.25 seconds. In simulation, the delay will depend on the +speed of the processor and will almost always be much slower than +the actual board. You might want to reduce the delay parameter when running +in simulation. + + shows how this multitasking program executes. +Note that apart from the thread creation system calls, this program +also creates and uses a mutex for synchronization +between the printf() calls in the two threads. This is because +the C library standard I/O (by default) is configured not +to be thread-safe, which means that if more than one thread is using +standard I/O they might corrupt each other. This is fixed +by a mutual exclusion (or mutex) lockout mechanism: the threads +do not call printf() until cyg_mutex_lock() +has returned, which only happens when the other thread calls cyg_mutex_unlock(). +You could avoid using the mutex by configuring the C library +to be thread-safe (by selecting the component CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS). +Keep in mind that if the C library is thread-safe, you can no longer +use printf() in cyg_user_start(). +
+Two threads with simple print statements after random +delays + +
+
+
+
+ +More Features — <!-- <index></index> -->Clocks and Alarm +Handlers +If a program wanted to execute a task at a given time, or +periodically, it could do it in an inefficient way by sitting in +an infinite loop and checking the real-time clock to see if the +proper amount of time has elapsed. But operating systems usually provide +system calls which allow the program to be interrupted at the desired +time. +eCos provides a rich timekeeping formalism, involving counters, clocks, alarms, and timers. +The precise definition, relationship, and motivation of these features +is beyond the scope of this tutorial, but these examples illustrate +how to set up basic periodic tasks. +Alarms are events that happen at +a given time, either once or periodically. A thread associates an +alarm handling function with the alarm, so that the function will +be invoked every time the alarm “goes off”. + + + + +A Sample Program with Alarms +simple-alarm.c (in the examples +directory) is a short program that creates a thread that creates an +alarm. The alarm is handled by the function test_alarm_func(), +which sets a global variable. When the main thread of execution +sees that the variable has changed, it prints a message. + +A sample <!-- <index></index> --> +program that creates an alarm + /* this is a very simple program meant to demonstrate + a basic use of time, alarms and alarm-handling functions in eCos */ + +#include <cyg/kernel/kapi.h> + +#include <stdio.h> + +#define NTHREADS 1 +#define STACKSIZE 4096 + +static cyg_handle_t thread[NTHREADS]; + +static cyg_thread thread_obj[NTHREADS]; +static char stack[NTHREADS][STACKSIZE]; + +static void alarm_prog( cyg_addrword_t data ); + +/* we install our own startup routine which sets up + threads and starts the scheduler */ +void cyg_user_start(void) +{ + cyg_thread_create(4, alarm_prog, (cyg_addrword_t) 0, + "alarm_thread", (void *) stack[0], + STACKSIZE, &thread[0], &thread_obj[0]); + cyg_thread_resume(thread[0]); +} + +/* we need to declare the alarm handling function (which is + defined below), so that we can pass it to cyg_alarm_initialize() */ +cyg_alarm_t test_alarm_func; + +/* alarm_prog() is a thread which sets up an alarm which is then + handled by test_alarm_func() */ +static void alarm_prog(cyg_addrword_t data) +{ + cyg_handle_t test_counterH, system_clockH, test_alarmH; + cyg_tick_count_t ticks; + cyg_alarm test_alarm; + unsigned how_many_alarms = 0, prev_alarms = 0, tmp_how_many; + + system_clockH = cyg_real_time_clock(); + cyg_clock_to_counter(system_clockH, &test_counterH); + cyg_alarm_create(test_counterH, test_alarm_func, + (cyg_addrword_t) &how_many_alarms, + &test_alarmH, &test_alarm); + cyg_alarm_initialize(test_alarmH, cyg_current_time()+200, 200); + + /* get in a loop in which we read the current time and + print it out, just to have something scrolling by */ + for (;;) { + ticks = cyg_current_time(); + printf("Time is %llu\n", ticks); + /* note that we must lock access to how_many_alarms, since the + alarm handler might change it. this involves using the + annoying temporary variable tmp_how_many so that I can keep the + critical region short */ + cyg_scheduler_lock(); + tmp_how_many = how_many_alarms; + cyg_scheduler_unlock(); + if (prev_alarms != tmp_how_many) { + printf(" --- alarm calls so far: %u\n", tmp_how_many); + prev_alarms = tmp_how_many; + } + cyg_thread_delay(30); + } +} + +/* test_alarm_func() is invoked as an alarm handler, so + it should be quick and simple. in this case it increments + the data that is passed to it. */ +void test_alarm_func(cyg_handle_t alarmH, cyg_addrword_t data) +{ + ++*((unsigned *) data); +} + +When you run this program (by typing run at +the (gdb) prompt) the output should look like +this: +Starting program: BASE_DIR/examples/simple-alarm.exe +Time is 0 +Time is 30 +Time is 60 +Time is 90 +Time is 120 +Time is 150 +Time is 180 +Time is 210 + --- alarm calls so far: 1 +Time is 240 +Time is 270 +Time is 300 +Time is 330 +Time is 360 +Time is 390 +Time is 420 + --- alarm calls so far: 2 +Time is 450 +Time is 480 + +When running in a simulator the +delays might be quite long. On a hardware board (where the clock +speed is 100 ticks/second) the delays should average to +about 0.3 seconds (and 2 seconds between alarms). In simulation, +the delay will depend on the speed of the processor and will almost +always be much slower than the actual board. You might want to reduce +the delay parameter when running in simulation. + +Here are a few things you might notice about this program: + + +It used the cyg_real_time_clock(); +this always returns a handle to the default system real-time +clock. + + +Alarms are based on +counters, so the function cyg_alarm_create() uses +a counter handle. The program used the function cyg_clock_to_counter() +to strip the clock handle to the underlying counter handle. + + +Once the alarm is created it is +initialized with cyg_alarm_initialize(), which +sets the time at which the alarm should go off, as well as the period +for repeating alarms. It is set to go off at the current time and +then to repeat every 200 ticks. + + +The alarm handler function test_alarm_func() +conforms to the guidelines for writing alarm handlers and other +delayed service routines: +it does not invoke any functions which might lock the scheduler. +This is discussed in detail in the eCos Reference Manual, in the chapter Requirements for programs. + + +There is a critical region in this +program: the variable how_many_alarms is accessed +in the main thread of control and is also modified in the alarm +handler. To prevent a possible (though unlikely) race condition +on this variable, access to how_many_alarms in +the principal thread is protected by calls to cyg_scheduler_lock() +and cyg_scheduler_unlock(). When the scheduler +is locked, the alarm handler will not be invoked, so the problem +is averted. + + + + +
+ +Appendices + +Real-time characterization +For a discussion of real-time performance measurement for eCos, see the eCos +Users' Guide. + + Sample numbers: + + + + + +Board: ARM AEB-1 Revision B Evaluation Board + + +Board: ARM AEB-1 Revision B Evaluation Board + +CPU : Sharp LH77790A 24MHz + + + +Startup, main stack : stack used 404 size 2400 +Startup : Interrupt stack used 128 size 2048 +Startup : Idlethread stack used 80 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 13 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 193.49 microseconds (290 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 7 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 110.19 104.67 116.00 3.26 42% 28% Create thread + 34.00 34.00 34.00 0.00 100% 100% Yield thread [all suspended] + 24.67 24.67 24.67 0.00 100% 100% Suspend [suspended] thread + 25.05 24.67 25.33 0.33 57% 42% Resume thread + 37.14 36.67 37.33 0.27 71% 28% Set priority + 3.81 3.33 4.00 0.27 71% 28% Get priority + 80.00 80.00 80.00 0.00 100% 100% Kill [suspended] thread + 33.90 33.33 34.00 0.16 85% 14% Yield [no other] thread + 45.90 44.00 46.67 0.54 57% 14% Resume [suspended low prio] thread + 24.57 24.00 24.67 0.16 85% 14% Resume [runnable low prio] thread + 42.29 36.67 43.33 1.61 85% 14% Suspend [runnable] thread + 33.90 33.33 34.00 0.16 85% 14% Yield [only low prio] thread + 24.67 24.67 24.67 0.00 100% 100% Suspend [runnable->not runnable] + 80.00 80.00 80.00 0.00 100% 100% Kill [runnable] thread + 43.33 43.33 43.33 0.00 100% 100% Destroy [dead] thread + 106.29 101.33 107.33 1.41 85% 14% Destroy [runnable] thread + 144.95 141.33 166.00 6.01 85% 85% Resume [high priority] thread + 78.31 76.67 254.67 2.75 99% 99% Thread switch + + 4.00 4.00 4.00 0.00 100% 100% Scheduler lock + 16.37 16.00 16.67 0.33 56% 43% Scheduler unlock [0 threads] + 16.37 16.00 16.67 0.33 56% 43% Scheduler unlock [1 suspended] + 16.37 16.00 16.67 0.33 56% 43% Scheduler unlock [many suspended] + 16.37 16.00 16.67 0.33 56% 43% Scheduler unlock [many low prio] + + 10.67 10.67 10.67 0.00 100% 100% Init mutex + 28.67 28.67 28.67 0.00 100% 100% Lock [unlocked] mutex + 30.44 30.00 31.33 0.33 59% 37% Unlock [locked] mutex + 25.42 25.33 26.00 0.15 87% 87% Trylock [unlocked] mutex + 22.50 22.00 22.67 0.25 75% 25% Trylock [locked] mutex + 5.75 5.33 6.00 0.31 62% 37% Destroy mutex + 185.33 185.33 185.33 0.00 100% 100% Unlock/Lock mutex + + 20.17 20.00 20.67 0.25 75% 75% Create mbox + 2.92 2.67 3.33 0.31 62% 62% Peek [empty] mbox + 32.42 32.00 32.67 0.31 62% 37% Put [first] mbox + 3.00 2.67 3.33 0.33 100% 50% Peek [1 msg] mbox + 32.50 32.00 32.67 0.25 75% 25% Put [second] mbox + 2.92 2.67 3.33 0.31 62% 62% Peek [2 msgs] mbox + 32.83 32.67 33.33 0.25 75% 75% Get [first] mbox + 32.67 32.67 32.67 0.00 100% 100% Get [second] mbox + 31.33 31.33 31.33 0.00 100% 100% Tryput [first] mbox + 27.58 27.33 28.00 0.31 62% 62% Peek item [non-empty] mbox + 32.83 32.67 33.33 0.25 75% 75% Tryget [non-empty] mbox + 26.50 26.00 26.67 0.25 75% 25% Peek item [empty] mbox + 28.00 28.00 28.00 0.00 100% 100% Tryget [empty] mbox + 3.25 2.67 3.33 0.15 87% 12% Waiting to get mbox + 3.25 2.67 3.33 0.15 87% 12% Waiting to put mbox + 30.83 30.67 31.33 0.25 75% 75% Delete mbox + 101.08 100.67 101.33 0.31 62% 37% Put/Get mbox + + 11.17 10.67 11.33 0.25 75% 25% Init semaphore + 24.17 24.00 24.67 0.25 75% 75% Post [0] semaphore + 27.08 26.67 27.33 0.31 62% 37% Wait [1] semaphore + 22.75 22.67 23.33 0.15 87% 87% Trywait [0] semaphore + 22.21 22.00 22.67 0.29 68% 68% Trywait [1] semaphore + 7.33 7.33 7.33 0.00 100% 100% Peek semaphore + 5.92 5.33 6.00 0.15 87% 12% Destroy semaphore + 110.04 110.00 110.67 0.08 93% 93% Post/Wait semaphore + + 9.54 9.33 10.00 0.29 68% 68% Create counter + 3.92 3.33 4.00 0.15 87% 12% Get counter value + 4.00 4.00 4.00 0.00 100% 100% Set counter value + 30.92 30.67 31.33 0.31 62% 62% Tick counter + 5.75 5.33 6.00 0.31 62% 37% Delete counter + + 13.83 13.33 14.00 0.25 75% 25% Create alarm + 46.67 46.67 46.67 0.00 100% 100% Initialize alarm + 3.67 3.33 4.00 0.33 100% 50% Disable alarm + 45.67 45.33 46.00 0.33 100% 50% Enable alarm + 8.33 8.00 8.67 0.33 100% 50% Delete alarm + 36.33 36.00 36.67 0.33 100% 50% Tick counter [1 alarm] + 214.67 214.67 214.67 0.00 100% 100% Tick counter [many alarms] + 62.67 62.67 62.67 0.00 100% 100% Tick & fire counter [1 alarm] + 1087.04 1075.33 1278.67 21.91 93% 93% Tick & fire counters [>1 together] + 246.35 240.67 412.00 10.35 96% 96% Tick & fire counters [>1 separately] + 168.01 167.33 237.33 1.08 99% 99% Alarm latency [0 threads] + 187.36 168.00 234.67 3.60 86% 1% Alarm latency [2 threads] + 187.37 167.33 235.33 3.59 85% 1% Alarm latency [many threads] + 303.12 280.00 508.67 3.21 98% 0% Alarm -> thread resume latency + + 36.65 36.00 38.67 0.00 Clock/interrupt latency + + 65.79 52.00 152.67 0.00 Clock DSR latency + + 316 316 316 (main stack: 752) Thread stack used (1120 total) +All done, main stack : stack used 752 size 2400 +All done : Interrupt stack used 280 size 2048 +All done : Idlethread stack used 268 size 2048 + +Timing complete - 30390 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: Atmel AT91/EB40 + +Board: Atmel AT91/EB40 +CPU : AT91R40807 (ARM7TDMI core), 32MHz +512KB RAM, 64K Flash + +Startup, main stack : stack used 420 size 2400 +Startup : Interrupt stack used 144 size 4096 +Startup : Idlethread stack used 84 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 3 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 127.53 microseconds (130 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 25 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 86.48 71.29 101.56 7.99 48% 28% Create thread + 20.70 20.51 21.48 0.31 80% 80% Yield thread [all suspended] + 17.15 16.60 17.58 0.48 56% 44% Suspend [suspended] thread + 17.07 16.60 17.58 0.49 52% 52% Resume thread + 25.51 25.39 26.37 0.21 88% 88% Set priority + 3.16 2.93 3.91 0.36 76% 76% Get priority + 52.34 51.76 52.73 0.47 60% 40% Kill [suspended] thread + 20.70 20.51 21.48 0.31 80% 80% Yield [no other] thread + 28.98 28.32 30.27 0.48 60% 36% Resume [suspended low prio] thread + 17.11 16.60 17.58 0.49 52% 48% Resume [runnable low prio] thread + 27.85 26.37 28.32 0.52 96% 4% Suspend [runnable] thread + 20.70 20.51 21.48 0.31 80% 80% Yield [only low prio] thread + 17.23 16.60 17.58 0.45 64% 36% Suspend [runnable->not runnable] + 52.34 51.76 52.73 0.47 60% 40% Kill [runnable] thread + 33.01 32.23 33.20 0.31 80% 20% Destroy [dead] thread + 72.03 70.31 72.27 0.38 80% 4% Destroy [runnable] thread + 96.99 95.70 112.30 1.22 64% 96% Resume [high priority] thread + 51.48 49.80 164.06 1.76 99% 99% Thread switch + + 2.78 1.95 2.93 0.26 84% 15% Scheduler lock + 11.81 11.72 12.70 0.17 90% 90% Scheduler unlock [0 threads] + 11.81 11.72 12.70 0.17 90% 90% Scheduler unlock [1 suspended] + 11.81 11.72 12.70 0.17 90% 90% Scheduler unlock [many suspended] + 11.81 11.72 12.70 0.17 90% 90% Scheduler unlock [many low prio] + + 5.49 4.88 5.86 0.46 62% 37% Init mutex + 20.20 19.53 20.51 0.42 68% 31% Lock [unlocked] mutex + 24.44 24.41 25.39 0.06 96% 96% Unlock [locked] mutex + 18.25 17.58 18.55 0.42 68% 31% Trylock [unlocked] mutex + 16.11 15.63 16.60 0.49 100% 50% Trylock [locked] mutex + 6.10 5.86 6.84 0.37 75% 75% Destroy mutex + 124.21 124.02 125.00 0.30 81% 81% Unlock/Lock mutex + + 9.28 8.79 9.77 0.49 100% 50% Create mbox + 2.93 2.93 2.93 0.00 100% 100% Peek [empty] mbox + 22.58 22.46 23.44 0.21 87% 87% Put [first] mbox + 2.44 1.95 2.93 0.49 100% 50% Peek [1 msg] mbox + 22.58 22.46 23.44 0.21 87% 87% Put [second] mbox + 2.44 1.95 2.93 0.49 100% 50% Peek [2 msgs] mbox + 22.71 22.46 23.44 0.37 75% 75% Get [first] mbox + 22.71 22.46 23.44 0.37 75% 75% Get [second] mbox + 21.18 20.51 21.48 0.42 68% 31% Tryput [first] mbox + 18.98 18.55 19.53 0.48 56% 56% Peek item [non-empty] mbox + 22.46 22.46 22.46 0.00 100% 100% Tryget [non-empty] mbox + 18.31 17.58 18.55 0.37 75% 25% Peek item [empty] mbox + 19.53 19.53 19.53 0.00 100% 100% Tryget [empty] mbox + 2.69 1.95 2.93 0.37 75% 25% Waiting to get mbox + 2.93 2.93 2.93 0.00 100% 100% Waiting to put mbox + 23.86 23.44 24.41 0.48 56% 56% Delete mbox + 67.60 67.38 68.36 0.33 78% 78% Put/Get mbox + + 5.37 4.88 5.86 0.49 100% 50% Init semaphore + 16.97 16.60 17.58 0.46 62% 62% Post [0] semaphore + 18.98 18.55 19.53 0.48 56% 56% Wait [1] semaphore + 15.81 15.63 16.60 0.30 81% 81% Trywait [0] semaphore + 15.29 14.65 15.63 0.44 65% 34% Trywait [1] semaphore + 5.62 4.88 5.86 0.37 75% 25% Peek semaphore + 6.35 5.86 6.84 0.49 100% 50% Destroy semaphore + 72.36 72.27 73.24 0.17 90% 90% Post/Wait semaphore + + 7.08 6.84 7.81 0.37 75% 75% Create counter + 3.17 2.93 3.91 0.37 75% 75% Get counter value + 3.05 2.93 3.91 0.21 87% 87% Set counter value + 24.11 23.44 24.41 0.42 68% 31% Tick counter + 5.49 4.88 5.86 0.46 62% 37% Delete counter + + 10.92 10.74 11.72 0.30 81% 81% Create alarm + 31.46 31.25 32.23 0.33 78% 78% Initialize alarm + 3.05 2.93 3.91 0.21 87% 87% Disable alarm + 31.49 31.25 32.23 0.37 75% 75% Enable alarm + 7.02 6.84 7.81 0.30 81% 81% Delete alarm + 31.16 30.27 31.25 0.17 90% 9% Tick counter [1 alarm] + 309.26 304.69 425.78 7.28 96% 96% Tick counter [many alarms] + 44.83 43.95 44.92 0.17 90% 9% Tick & fire counter [1 alarm] + 781.68 774.41 893.55 13.62 93% 93% Tick & fire counters [>1 together] + 324.16 320.31 433.59 6.84 96% 96% Tick & fire counters [>1 separately] + 114.26 113.28 167.97 0.84 57% 42% Alarm latency [0 threads] + 126.91 113.28 159.18 8.20 50% 31% Alarm latency [2 threads] + 127.11 113.28 158.20 8.09 51% 28% Alarm latency [many threads] + 196.49 189.45 331.05 2.10 98% 0% Alarm -> thread resume latency + + 23.50 23.44 25.39 0.00 Clock/interrupt latency + + 40.31 33.20 514.65 0.00 Clock DSR latency + + 300 271 312 (main stack: 832) Thread stack used (1120 total) +All done, main stack : stack used 832 size 2400 +All done : Interrupt stack used 288 size 4096 +All done : Idlethread stack used 272 size 2048 + +Timing complete - 30350 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + +Board: Intel StrongARM EBSA-285 Evaluation Board +Board: Intel StrongARM EBSA-285 Evaluation Board + +CPU : Intel StrongARM SA-110 228MHz + + +Startup, main stack : stack used 404 size 2400 +Startup : Interrupt stack used 136 size 4096 +Startup : Idlethread stack used 80 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 1 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 4.61 microseconds (16 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 4.97 3.26 7.34 0.60 50% 4% Create thread + 0.73 0.54 2.17 0.14 60% 37% Yield thread [all suspended] + 0.98 0.82 2.99 0.23 81% 68% Suspend [suspended] thread + 0.54 0.27 1.63 0.03 92% 6% Resume thread + 0.83 0.54 1.90 0.10 73% 14% Set priority + 0.21 0.00 0.54 0.21 25% 48% Get priority + 2.25 1.90 10.05 0.37 96% 67% Kill [suspended] thread + 0.70 0.54 1.09 0.14 53% 45% Yield [no other] thread + 0.96 0.82 1.36 0.14 50% 48% Resume [suspended low prio] thread + 0.53 0.27 0.82 0.03 92% 6% Resume [runnable low prio] thread + 0.90 0.82 1.63 0.13 70% 70% Suspend [runnable] thread + 0.70 0.54 0.82 0.13 57% 42% Yield [only low prio] thread + 0.55 0.54 0.82 0.01 98% 98% Suspend [runnable->not runnable] + 1.64 1.63 2.17 0.02 98% 98% Kill [runnable] thread + 0.97 0.82 4.62 0.20 98% 64% Destroy [dead] thread + 2.17 1.90 2.17 0.01 98% 1% Destroy [runnable] thread + 6.06 5.16 10.60 0.53 59% 31% Resume [high priority] thread + 1.69 1.63 5.98 0.11 90% 90% Thread switch + + 0.14 0.00 1.36 0.14 99% 50% Scheduler lock + 0.37 0.27 0.54 0.13 62% 62% Scheduler unlock [0 threads] + 0.38 0.27 0.54 0.13 60% 60% Scheduler unlock [1 suspended] + 0.37 0.27 0.54 0.13 63% 63% Scheduler unlock [many suspended] + 0.37 0.27 0.54 0.13 63% 63% Scheduler unlock [many low prio] + + 0.34 0.00 1.90 0.15 78% 6% Init mutex + 0.88 0.54 4.62 0.37 93% 71% Lock [unlocked] mutex + 0.79 0.54 4.35 0.26 93% 53% Unlock [locked] mutex + 0.59 0.27 2.17 0.10 93% 3% Trylock [unlocked] mutex + 0.50 0.27 0.82 0.09 78% 18% Trylock [locked] mutex + 0.18 0.00 0.54 0.13 59% 37% Destroy mutex + 3.85 3.80 5.16 0.08 96% 96% Unlock/Lock mutex + + 0.64 0.27 3.53 0.24 81% 15% Create mbox + 0.61 0.27 2.17 0.21 68% 18% Peek [empty] mbox + 0.87 0.54 5.16 0.31 59% 87% Put [first] mbox + 0.08 0.00 0.54 0.12 71% 71% Peek [1 msg] mbox + 0.71 0.54 1.09 0.14 56% 40% Put [second] mbox + 0.08 0.00 0.27 0.12 68% 68% Peek [2 msgs] mbox + 0.89 0.54 4.89 0.31 62% 81% Get [first] mbox + 0.76 0.54 1.09 0.17 43% 37% Get [second] mbox + 0.76 0.54 3.26 0.21 96% 50% Tryput [first] mbox + 0.65 0.54 2.45 0.17 81% 81% Peek item [non-empty] mbox + 0.76 0.54 2.72 0.19 53% 43% Tryget [non-empty] mbox + 0.58 0.54 0.82 0.06 87% 87% Peek item [empty] mbox + 0.61 0.54 0.82 0.10 75% 75% Tryget [empty] mbox + 0.10 0.00 0.54 0.13 65% 65% Waiting to get mbox + 0.10 0.00 0.54 0.13 65% 65% Waiting to put mbox + 0.77 0.54 3.26 0.20 53% 43% Delete mbox + 2.10 1.90 6.25 0.30 93% 93% Put/Get mbox + + 0.34 0.27 1.09 0.11 81% 81% Init semaphore + 0.60 0.27 1.09 0.12 68% 6% Post [0] semaphore + 0.59 0.54 0.82 0.08 81% 81% Wait [1] semaphore + 0.59 0.54 2.17 0.10 96% 96% Trywait [0] semaphore + 0.48 0.27 0.82 0.11 71% 25% Trywait [1] semaphore + 0.24 0.00 0.82 0.09 78% 18% Peek semaphore + 0.19 0.00 0.54 0.13 62% 34% Destroy semaphore + 2.28 2.17 4.08 0.18 93% 90% Post/Wait semaphore + + 0.43 0.00 2.72 0.23 90% 6% Create counter + 0.40 0.00 1.63 0.25 68% 28% Get counter value + 0.13 0.00 0.82 0.15 96% 59% Set counter value + 0.71 0.54 1.63 0.16 50% 46% Tick counter + 0.16 0.00 0.54 0.14 53% 43% Delete counter + + 0.47 0.27 1.36 0.15 59% 37% Create alarm + 1.58 1.09 7.07 0.44 71% 68% Initialize alarm + 0.12 0.00 1.09 0.16 96% 65% Disable alarm + 1.01 0.82 2.45 0.17 53% 43% Enable alarm + 0.21 0.00 0.27 0.09 78% 21% Delete alarm + 0.78 0.54 1.90 0.12 71% 25% Tick counter [1 alarm] + 3.90 3.80 4.35 0.13 68% 68% Tick counter [many alarms] + 1.25 1.09 1.63 0.14 53% 43% Tick & fire counter [1 alarm] + 19.88 19.84 20.11 0.07 84% 84% Tick & fire counters [>1 together] + 4.37 4.35 4.62 0.05 90% 90% Tick & fire counters [>1 separately] + 3.83 3.80 7.61 0.06 99% 99% Alarm latency [0 threads] + 4.46 3.80 7.88 0.27 71% 24% Alarm latency [2 threads] + 16.06 13.59 26.36 1.05 54% 10% Alarm latency [many threads] + 6.67 6.52 22.83 0.29 98% 98% Alarm -> thread resume latency + + 1.89 0.82 9.78 0.00 Clock/interrupt latency + + 2.17 1.09 7.34 0.00 Clock DSR latency + + 11 0 316 (main stack: 744) Thread stack used (1120 total) +All done, main stack : stack used 744 size 2400 +All done : Interrupt stack used 288 size 4096 +All done : Idlethread stack used 268 size 2048 + +Timing complete - 30210 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + +Board: Cirrus Logic EDB7111-2 Development Board + +CPU : Cirrus Logic EP7211 73MHz +Board: Cirrus Logic EDB7111-2 Development Board + +CPU : Cirrus Logic EP7211 73MHz + + + +Startup, main stack : stack used 404 size 2400 +Startup : Interrupt stack used 136 size 4096 +Startup : Idlethread stack used 88 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 0 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 356.69 microseconds (182 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 22.71 17.58 37.11 3.07 46% 34% Create thread + 4.36 3.91 5.86 0.70 76% 76% Yield thread [all suspended] + 4.24 3.91 7.81 0.56 84% 84% Suspend [suspended] thread + 4.09 1.95 7.81 0.45 85% 3% Resume thread + 5.31 3.91 11.72 0.92 65% 32% Set priority + 2.11 1.95 3.91 0.28 92% 92% Get priority + 11.54 9.77 25.39 0.99 62% 28% Kill [suspended] thread + 4.46 3.91 9.77 0.82 75% 75% Yield [no other] thread + 7.57 5.86 13.67 0.69 75% 20% Resume [suspended low prio] thread + 3.94 1.95 5.86 0.18 92% 3% Resume [runnable low prio] thread + 7.02 5.86 13.67 1.05 53% 45% Suspend [runnable] thread + 4.42 3.91 9.77 0.79 76% 76% Yield [only low prio] thread + 4.24 1.95 5.86 0.61 79% 1% Suspend [runnable->not runnable] + 11.29 9.77 27.34 1.14 57% 37% Kill [runnable] thread + 6.29 3.91 11.72 0.84 71% 4% Destroy [dead] thread + 13.52 11.72 31.25 0.90 70% 25% Destroy [runnable] thread + 24.50 21.48 42.97 1.69 79% 12% Resume [high priority] thread + 8.79 7.81 19.53 1.05 99% 53% Thread switch + + 1.66 0.00 3.91 0.52 83% 15% Scheduler lock + 2.59 1.95 3.91 0.86 67% 67% Scheduler unlock [0 threads] + 2.62 1.95 3.91 0.88 65% 65% Scheduler unlock [1 suspended] + 2.61 1.95 3.91 0.87 66% 66% Scheduler unlock [many suspended] + 2.58 1.95 3.91 0.85 67% 67% Scheduler unlock [many low prio] + + 2.69 1.95 5.86 0.96 65% 65% Init mutex + 4.88 3.91 9.77 1.10 96% 56% Lock [unlocked] mutex + 4.64 3.91 11.72 1.05 71% 71% Unlock [locked] mutex + 3.97 1.95 7.81 0.47 81% 9% Trylock [unlocked] mutex + 3.48 1.95 3.91 0.67 78% 21% Trylock [locked] mutex + 1.77 0.00 3.91 0.44 84% 12% Destroy mutex + 31.92 29.30 42.97 1.65 71% 18% Unlock/Lock mutex + + 4.09 3.91 9.77 0.35 96% 96% Create mbox + 1.83 0.00 3.91 0.34 87% 9% Peek [empty] mbox + 5.31 3.91 9.77 0.96 62% 34% Put [first] mbox + 1.59 0.00 1.95 0.60 81% 18% Peek [1 msg] mbox + 5.19 3.91 9.77 1.04 56% 40% Put [second] mbox + 1.65 0.00 3.91 0.62 78% 18% Peek [2 msgs] mbox + 5.43 3.91 9.77 0.86 68% 28% Get [first] mbox + 5.31 3.91 7.81 0.96 59% 34% Get [second] mbox + 4.76 3.91 9.77 1.07 62% 62% Tryput [first] mbox + 4.82 1.95 9.77 1.15 93% 3% Peek item [non-empty] mbox + 5.55 3.91 11.72 0.82 71% 25% Tryget [non-empty] mbox + 3.97 1.95 7.81 0.59 75% 12% Peek item [empty] mbox + 4.33 3.91 7.81 0.69 81% 81% Tryget [empty] mbox + 1.59 0.00 3.91 0.79 68% 25% Waiting to get mbox + 1.71 0.00 3.91 0.53 81% 15% Waiting to put mbox + 5.25 3.91 9.77 1.01 59% 37% Delete mbox + 17.82 15.63 29.30 1.14 65% 18% Put/Get mbox + + 2.69 1.95 5.86 0.96 65% 65% Init semaphore + 3.78 1.95 7.81 0.46 84% 12% Post [0] semaphore + 4.27 3.91 7.81 0.62 84% 84% Wait [1] semaphore + 3.72 1.95 7.81 0.66 75% 18% Trywait [0] semaphore + 3.29 1.95 5.86 0.92 62% 34% Trywait [1] semaphore + 2.32 1.95 3.91 0.59 81% 81% Peek semaphore + 1.89 0.00 3.91 0.24 90% 6% Destroy semaphore + 15.75 13.67 29.30 1.07 68% 21% Post/Wait semaphore + + 2.69 1.95 5.86 0.96 65% 65% Create counter + 1.83 0.00 1.95 0.23 93% 6% Get counter value + 1.53 0.00 3.91 0.76 71% 25% Set counter value + 4.82 3.91 5.86 0.97 53% 53% Tick counter + 1.89 0.00 1.95 0.12 96% 3% Delete counter + + 3.78 1.95 7.81 0.46 84% 12% Create alarm + 7.99 5.86 15.63 0.70 81% 9% Initialize alarm + 1.71 0.00 1.95 0.43 87% 12% Disable alarm + 7.14 5.86 11.72 1.04 56% 40% Enable alarm + 2.50 1.95 3.91 0.79 71% 71% Delete alarm + 4.94 3.91 7.81 1.04 96% 50% Tick counter [1 alarm] + 19.47 17.58 23.44 0.36 87% 9% Tick counter [many alarms] + 7.63 5.86 11.72 0.55 81% 15% Tick & fire counter [1 alarm] + 99.06 97.66 105.47 1.05 59% 37% Tick & fire counters [>1 together] + 22.15 21.48 27.34 0.96 71% 71% Tick & fire counters [>1 separately] + 359.16 357.42 378.91 0.87 71% 25% Alarm latency [0 threads] + 364.03 357.42 402.34 3.03 58% 15% Alarm latency [2 threads] + 408.25 402.34 416.02 2.89 53% 24% Alarm latency [many threads] + 381.16 376.95 492.19 2.48 95% 46% Alarm -> thread resume latency + + 9.79 5.86 19.53 0.00 Clock/interrupt latency + + 12.13 5.86 31.25 0.00 Clock DSR latency + + 12 0 316 (main stack: 752) Thread stack used (1120 total) +All done, main stack : stack used 752 size 2400 +All done : Interrupt stack used 288 size 4096 +All done : Idlethread stack used 276 size 2048 + +Timing complete - 30450 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + +CPU : Cirrus Logic EP7212 73MHz +Board: Cirrus Logic EDB7111-2 Development Board + +CPU : Cirrus Logic EP7212 73MHz + + + +Startup, main stack : stack used 404 size 2400 +Startup : Interrupt stack used 136 size 4096 +Startup : Idlethread stack used 88 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 0 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 356.32 microseconds (182 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 22.43 15.63 33.20 3.02 68% 18% Create thread + 4.48 3.91 5.86 0.81 70% 70% Yield thread [all suspended] + 4.42 3.91 7.81 0.78 75% 75% Suspend [suspended] thread + 4.12 1.95 5.86 0.49 82% 3% Resume thread + 5.62 3.91 11.72 0.64 78% 18% Set priority + 2.17 1.95 3.91 0.38 89% 89% Get priority + 11.54 9.77 27.34 0.88 70% 25% Kill [suspended] thread + 4.64 3.91 9.77 0.96 65% 65% Yield [no other] thread + 7.51 5.86 15.63 0.72 76% 21% Resume [suspended low prio] thread + 3.88 1.95 9.77 0.42 82% 10% Resume [runnable low prio] thread + 7.14 5.86 13.67 1.00 59% 39% Suspend [runnable] thread + 4.52 3.91 7.81 0.86 70% 70% Yield [only low prio] thread + 4.15 1.95 7.81 0.49 85% 1% Suspend [runnable->not runnable] + 11.26 9.77 27.34 1.17 56% 39% Kill [runnable] thread + 6.22 3.91 13.67 0.88 70% 7% Destroy [dead] thread + 13.64 11.72 33.20 1.02 64% 26% Destroy [runnable] thread + 24.17 21.48 41.02 1.49 82% 12% Resume [high priority] thread + 8.80 7.81 21.48 1.08 98% 54% Thread switch + + 1.60 0.00 1.95 0.58 82% 17% Scheduler lock + 2.61 1.95 3.91 0.87 66% 66% Scheduler unlock [0 threads] + 2.59 1.95 3.91 0.86 67% 67% Scheduler unlock [1 suspended] + 2.61 1.95 3.91 0.87 66% 66% Scheduler unlock [many suspended] + 2.59 1.95 3.91 0.86 67% 67% Scheduler unlock [many low prio] + + 2.62 1.95 3.91 0.88 65% 65% Init mutex + 4.82 3.91 9.77 1.09 96% 59% Lock [unlocked] mutex + 4.39 3.91 9.77 0.79 81% 81% Unlock [locked] mutex + 3.84 1.95 7.81 0.36 87% 9% Trylock [unlocked] mutex + 3.54 1.95 5.86 0.69 75% 21% Trylock [locked] mutex + 1.83 0.00 3.91 0.34 87% 9% Destroy mutex + 34.61 31.25 46.88 1.68 78% 9% Unlock/Lock mutex + + 3.97 1.95 7.81 0.24 93% 3% Create mbox + 1.83 0.00 3.91 0.34 87% 9% Peek [empty] mbox + 4.76 3.91 9.77 1.07 62% 62% Put [first] mbox + 1.71 0.00 3.91 0.64 75% 18% Peek [1 msg] mbox + 5.00 3.91 9.77 1.10 96% 50% Put [second] mbox + 1.65 0.00 1.95 0.52 84% 15% Peek [2 msgs] mbox + 5.31 3.91 11.72 1.05 59% 37% Get [first] mbox + 5.13 3.91 7.81 0.99 56% 40% Get [second] mbox + 4.76 3.91 11.72 1.12 96% 65% Tryput [first] mbox + 4.46 3.91 7.81 0.82 75% 75% Peek item [non-empty] mbox + 5.55 3.91 9.77 0.82 68% 25% Tryget [non-empty] mbox + 4.03 1.95 7.81 0.58 78% 9% Peek item [empty] mbox + 4.27 3.91 5.86 0.59 81% 81% Tryget [empty] mbox + 1.77 0.00 3.91 0.44 84% 12% Waiting to get mbox + 1.59 0.00 1.95 0.60 81% 18% Waiting to put mbox + 5.37 3.91 9.77 0.91 65% 31% Delete mbox + 16.66 13.67 27.34 1.42 90% 3% Put/Get mbox + + 2.62 1.95 5.86 0.92 68% 68% Init semaphore + 3.84 1.95 7.81 0.47 81% 12% Post [0] semaphore + 4.21 3.91 7.81 0.53 87% 87% Wait [1] semaphore + 3.48 1.95 5.86 0.76 71% 25% Trywait [0] semaphore + 3.60 1.95 5.86 0.62 78% 18% Trywait [1] semaphore + 2.26 1.95 5.86 0.53 87% 87% Peek semaphore + 1.89 0.00 1.95 0.12 96% 3% Destroy semaphore + 16.05 13.67 29.30 1.40 59% 18% Post/Wait semaphore + + 2.38 1.95 3.91 0.67 78% 78% Create counter + 2.01 0.00 3.91 0.35 84% 6% Get counter value + 1.89 0.00 3.91 0.24 90% 6% Set counter value + 4.58 3.91 5.86 0.88 65% 65% Tick counter + 1.71 0.00 1.95 0.43 87% 12% Delete counter + + 3.84 1.95 7.81 0.36 87% 9% Create alarm + 7.99 5.86 15.63 0.47 93% 3% Initialize alarm + 2.01 0.00 3.91 0.35 84% 6% Disable alarm + 6.53 5.86 13.67 1.01 75% 75% Enable alarm + 2.32 1.95 3.91 0.59 81% 81% Delete alarm + 4.76 3.91 7.81 1.01 59% 59% Tick counter [1 alarm] + 19.53 17.58 23.44 0.24 90% 6% Tick counter [many alarms] + 7.57 5.86 13.67 0.75 75% 21% Tick & fire counter [1 alarm] + 98.57 97.66 105.47 1.14 96% 62% Tick & fire counters [>1 together] + 22.15 21.48 27.34 0.96 71% 71% Tick & fire counters [>1 separately] + 359.18 357.42 384.77 1.10 65% 31% Alarm latency [0 threads] + 362.63 357.42 396.48 2.55 43% 27% Alarm latency [2 threads] + 408.22 402.34 416.02 2.73 55% 21% Alarm latency [many threads] + 378.63 375.00 494.14 2.56 93% 71% Alarm -> thread resume latency + + 9.78 5.86 19.53 0.00 Clock/interrupt latency + + 12.21 5.86 31.25 0.00 Clock DSR latency + + 12 0 316 (main stack: 752) Thread stack used (1120 total) +All done, main stack : stack used 752 size 2400 +All done : Interrupt stack used 288 size 4096 +All done : Idlethread stack used 276 size 2048 + +Timing complete - 30550 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + + +Board: ARM PID Evaluation Board + +CPU : ARM 7TDMI 20 MHz +Board: ARM PID Evaluation Board + +CPU : ARM 7TDMI 20 MHz + + + +Startup, main stack : stack used 404 size 2400 +Startup : Interrupt stack used 136 size 4096 +Startup : Idlethread stack used 84 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 6 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 120.74 microseconds (150 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 50 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 99.01 68.00 129.60 15.62 50% 26% Create thread + 21.60 21.60 21.60 0.00 100% 100% Yield thread [all suspended] + 15.65 15.20 16.00 0.39 56% 44% Suspend [suspended] thread + 15.79 15.20 16.00 0.31 74% 26% Resume thread + 23.65 23.20 24.00 0.39 56% 44% Set priority + 2.26 1.60 2.40 0.24 82% 18% Get priority + 51.39 51.20 52.00 0.29 76% 76% Kill [suspended] thread + 21.60 21.60 21.60 0.00 100% 100% Yield [no other] thread + 29.47 28.00 29.60 0.22 86% 2% Resume [suspended low prio] thread + 15.60 15.20 16.00 0.40 100% 50% Resume [runnable low prio] thread + 27.73 24.00 28.00 0.40 74% 2% Suspend [runnable] thread + 21.60 21.60 21.60 0.00 100% 100% Yield [only low prio] thread + 15.65 15.20 16.00 0.39 56% 44% Suspend [runnable->not runnable] + 51.39 51.20 52.00 0.29 76% 76% Kill [runnable] thread + 27.66 27.20 28.80 0.41 54% 44% Destroy [dead] thread + 68.93 64.80 69.60 0.35 72% 2% Destroy [runnable] thread + 91.26 90.40 107.20 0.64 66% 32% Resume [high priority] thread + 49.14 48.80 49.60 0.39 57% 57% Thread switch + + 2.20 1.60 2.40 0.30 75% 25% Scheduler lock + 10.20 9.60 10.40 0.30 75% 25% Scheduler unlock [0 threads] + 10.20 9.60 10.40 0.30 75% 25% Scheduler unlock [1 suspended] + 10.20 9.60 10.40 0.30 75% 25% Scheduler unlock [many suspended] + 10.20 9.60 10.40 0.30 75% 25% Scheduler unlock [many low prio] + + 6.85 6.40 7.20 0.39 56% 43% Init mutex + 18.40 18.40 18.40 0.00 100% 100% Lock [unlocked] mutex + 19.57 19.20 20.00 0.40 53% 53% Unlock [locked] mutex + 16.55 16.00 16.80 0.34 68% 31% Trylock [unlocked] mutex + 14.55 14.40 15.20 0.24 81% 81% Trylock [locked] mutex + 3.55 3.20 4.00 0.39 56% 56% Destroy mutex + 119.85 119.20 120.00 0.24 81% 18% Unlock/Lock mutex + + 12.85 12.80 13.60 0.09 93% 93% Create mbox + 1.65 1.60 2.40 0.09 93% 93% Peek [empty] mbox + 20.70 20.00 20.80 0.17 87% 12% Put [first] mbox + 1.65 1.60 2.40 0.09 93% 93% Peek [1 msg] mbox + 20.70 20.00 20.80 0.17 87% 12% Put [second] mbox + 1.65 1.60 2.40 0.09 93% 93% Peek [2 msgs] mbox + 20.85 20.80 21.60 0.09 93% 93% Get [first] mbox + 20.85 20.80 21.60 0.09 93% 93% Get [second] mbox + 19.90 19.20 20.00 0.17 87% 12% Tryput [first] mbox + 17.60 17.60 17.60 0.00 100% 100% Peek item [non-empty] mbox + 20.90 20.80 21.60 0.17 87% 87% Tryget [non-empty] mbox + 16.80 16.80 16.80 0.00 100% 100% Peek item [empty] mbox + 17.65 17.60 18.40 0.09 93% 93% Tryget [empty] mbox + 1.85 1.60 2.40 0.34 68% 68% Waiting to get mbox + 1.85 1.60 2.40 0.34 68% 68% Waiting to put mbox + 19.40 19.20 20.00 0.30 75% 75% Delete mbox + 65.05 64.80 65.60 0.34 68% 68% Put/Get mbox + + 7.05 6.40 7.20 0.24 81% 18% Init semaphore + 15.55 15.20 16.00 0.39 56% 56% Post [0] semaphore + 17.35 16.80 17.60 0.34 68% 31% Wait [1] semaphore + 14.60 14.40 15.20 0.30 75% 75% Trywait [0] semaphore + 14.20 13.60 14.40 0.30 75% 25% Trywait [1] semaphore + 4.55 4.00 4.80 0.34 68% 31% Peek semaphore + 3.75 3.20 4.00 0.34 68% 31% Destroy semaphore + 70.85 70.40 71.20 0.39 56% 43% Post/Wait semaphore + + 6.05 5.60 6.40 0.39 56% 43% Create counter + 2.25 1.60 2.40 0.24 81% 18% Get counter value + 2.25 1.60 2.40 0.24 81% 18% Set counter value + 19.70 19.20 20.00 0.37 62% 37% Tick counter + 3.45 3.20 4.00 0.34 68% 68% Delete counter + + 9.05 8.80 9.60 0.34 68% 68% Create alarm + 29.60 29.60 29.60 0.00 100% 100% Initialize alarm + 2.15 1.60 2.40 0.34 68% 31% Disable alarm + 29.35 28.80 29.60 0.34 68% 31% Enable alarm + 5.10 4.80 5.60 0.37 62% 62% Delete alarm + 23.20 23.20 23.20 0.00 100% 100% Tick counter [1 alarm] + 138.00 137.60 138.40 0.40 100% 50% Tick counter [many alarms] + 40.40 40.00 40.80 0.40 100% 50% Tick & fire counter [1 alarm] + 704.25 697.60 804.00 12.47 93% 93% Tick & fire counters [>1 together] + 155.20 155.20 155.20 0.00 100% 100% Tick & fire counters [>1 separately] + 105.20 104.80 151.20 0.76 99% 94% Alarm latency [0 threads] + 117.57 104.80 149.60 7.13 57% 25% Alarm latency [2 threads] + 117.49 104.80 148.80 7.10 58% 26% Alarm latency [many threads] + 192.59 177.60 316.00 1.93 98% 0% Alarm -> thread resume latency + + 22.10 21.60 24.00 0.00 Clock/interrupt latency + + 38.69 32.80 61.60 0.00 Clock DSR latency + + 297 276 316 (main stack: 752) Thread stack used (1120 total) +All done, main stack : stack used 752 size 2400 +All done : Interrupt stack used 288 size 4096 +All done : Idlethread stack used 272 size 2048 + +Timing complete - 30350 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + +CPU : ARM 920T 20 MHz + + +Board: ARM PID Evaluation Board + +CPU : ARM 920T 20 MHz + + +Startup, main stack : stack used 404 size 2400 +Startup : Interrupt stack used 136 size 4096 +Startup : Idlethread stack used 84 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 15 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 291.41 microseconds (364 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 50 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 257.78 168.00 568.00 48.70 56% 28% Create thread + 50.21 49.60 50.40 0.29 76% 24% Yield thread [all suspended] + 36.26 36.00 36.80 0.35 68% 68% Suspend [suspended] thread + 37.20 36.80 37.60 0.40 100% 50% Resume thread + 56.24 56.00 56.80 0.34 70% 70% Set priority + 5.20 4.80 5.60 0.40 100% 50% Get priority + 122.75 122.40 123.20 0.39 56% 56% Kill [suspended] thread + 50.19 49.60 50.40 0.31 74% 26% Yield [no other] thread + 69.49 66.40 69.60 0.21 92% 2% Resume [suspended low prio] thread + 37.01 36.80 37.60 0.31 74% 74% Resume [runnable low prio] thread + 64.75 55.20 65.60 0.38 80% 2% Suspend [runnable] thread + 50.19 49.60 50.40 0.31 74% 26% Yield [only low prio] thread + 36.24 36.00 36.80 0.34 70% 70% Suspend [runnable->not runnable] + 122.75 122.40 123.20 0.39 56% 56% Kill [runnable] thread + 67.76 67.20 68.00 0.34 70% 30% Destroy [dead] thread + 167.07 158.40 168.00 0.35 92% 2% Destroy [runnable] thread + 213.49 212.00 249.60 1.46 84% 90% Resume [high priority] thread + 122.81 120.00 389.60 4.17 99% 99% Thread switch + + 4.70 4.00 4.80 0.17 87% 12% Scheduler lock + 23.70 23.20 24.00 0.37 62% 37% Scheduler unlock [0 threads] + 23.60 23.20 24.00 0.40 100% 50% Scheduler unlock [1 suspended] + 23.70 23.20 24.00 0.37 62% 37% Scheduler unlock [many suspended] + 23.60 23.20 24.00 0.40 100% 50% Scheduler unlock [many low prio] + + 15.65 15.20 16.00 0.39 56% 43% Init mutex + 42.40 42.40 42.40 0.00 100% 100% Lock [unlocked] mutex + 45.37 44.80 46.40 0.36 65% 31% Unlock [locked] mutex + 39.20 39.20 39.20 0.00 100% 100% Trylock [unlocked] mutex + 34.45 34.40 35.20 0.09 93% 93% Trylock [locked] mutex + 8.00 8.00 8.00 0.00 100% 100% Destroy mutex + 284.42 284.00 284.80 0.40 53% 46% Unlock/Lock mutex + + 29.40 28.80 29.60 0.30 75% 25% Create mbox + 3.35 3.20 4.00 0.24 81% 81% Peek [empty] mbox + 49.35 48.80 49.60 0.34 68% 31% Put [first] mbox + 3.35 3.20 4.00 0.24 81% 81% Peek [1 msg] mbox + 49.35 48.80 49.60 0.34 68% 31% Put [second] mbox + 3.35 3.20 4.00 0.24 81% 81% Peek [2 msgs] mbox + 49.15 48.80 49.60 0.39 56% 56% Get [first] mbox + 49.15 48.80 49.60 0.39 56% 56% Get [second] mbox + 47.80 47.20 48.00 0.30 75% 25% Tryput [first] mbox + 41.40 40.80 41.60 0.30 75% 25% Peek item [non-empty] mbox + 49.40 48.80 49.60 0.30 75% 25% Tryget [non-empty] mbox + 40.15 40.00 40.80 0.24 81% 81% Peek item [empty] mbox + 40.95 40.80 41.60 0.24 81% 81% Tryget [empty] mbox + 4.05 4.00 4.80 0.09 93% 93% Waiting to get mbox + 4.05 4.00 4.80 0.09 93% 93% Waiting to put mbox + 45.60 45.60 45.60 0.00 100% 100% Delete mbox + 153.27 152.80 153.60 0.39 59% 40% Put/Get mbox + + 16.80 16.80 16.80 0.00 100% 100% Init semaphore + 36.60 36.00 36.80 0.30 75% 25% Post [0] semaphore + 39.60 39.20 40.00 0.40 100% 50% Wait [1] semaphore + 34.80 34.40 35.20 0.40 100% 50% Trywait [0] semaphore + 33.35 32.80 33.60 0.34 68% 31% Trywait [1] semaphore + 10.30 9.60 10.40 0.17 87% 12% Peek semaphore + 8.80 8.80 8.80 0.00 100% 100% Destroy semaphore + 166.92 166.40 167.20 0.36 65% 34% Post/Wait semaphore + + 13.60 13.60 13.60 0.00 100% 100% Create counter + 4.85 4.80 5.60 0.09 93% 93% Get counter value + 4.80 4.80 4.80 0.00 100% 100% Set counter value + 45.25 44.80 45.60 0.39 56% 43% Tick counter + 7.75 7.20 8.00 0.34 68% 31% Delete counter + + 20.80 20.80 20.80 0.00 100% 100% Create alarm + 69.30 68.80 69.60 0.37 62% 37% Initialize alarm + 4.80 4.80 4.80 0.00 100% 100% Disable alarm + 67.35 67.20 68.00 0.24 81% 81% Enable alarm + 11.80 11.20 12.00 0.30 75% 25% Delete alarm + 54.80 54.40 55.20 0.40 100% 50% Tick counter [1 alarm] + 372.35 363.20 652.80 17.53 96% 96% Tick counter [many alarms] + 95.50 95.20 96.00 0.37 62% 62% Tick & fire counter [1 alarm] + 1757.92 1707.20 1996.80 81.43 81% 81% Tick & fire counters [>1 together] + 404.37 404.00 404.80 0.40 53% 53% Tick & fire counters [>1 separately] + 256.57 254.40 395.20 2.17 98% 97% Alarm latency [0 threads] + 296.60 255.20 359.20 23.53 53% 31% Alarm latency [2 threads] + 307.49 265.60 357.60 27.52 53% 53% Alarm latency [many threads] + 467.04 432.00 788.80 5.03 97% 1% Alarm -> thread resume latency + + 55.63 54.40 60.80 0.00 Clock/interrupt latency + + 101.23 80.80 1433.60 0.00 Clock DSR latency + + 316 316 316 (main stack: 752) Thread stack used (1120 total) +All done, main stack : stack used 752 size 2400 +All done : Interrupt stack used 288 size 4096 +All done : Idlethread stack used 272 size 2048 + +Timing complete - 30780 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: Intel IQ80310 XScale Development Kit +Board: Intel IQ80310 XScale Development Kit + +CPU: Intel XScale 600MHz + + +Startup, main stack : stack used 388 size 2400 +Startup : Interrupt stack used 148 size 4096 +Startup : Idlethread stack used 76 size 1120 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 73 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 12.11 microseconds (399 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 6.53 5.48 8.55 0.50 53% 23% Create thread + 0.37 0.03 3.24 0.18 87% 1% Yield thread [all suspended] + 0.24 0.00 2.06 0.12 87% 1% Suspend [suspended] thread + 0.25 0.00 0.73 0.06 71% 1% Resume thread + 0.36 0.09 0.82 0.10 89% 1% Set priority + 0.03 0.00 0.42 0.05 90% 90% Get priority + 1.07 0.52 6.39 0.18 92% 1% Kill [suspended] thread + 0.33 0.06 0.91 0.08 78% 3% Yield [no other] thread + 0.55 0.03 1.06 0.09 85% 1% Resume [suspended low prio] thread + 0.28 0.00 1.79 0.11 84% 4% Resume [runnable low prio] thread + 0.43 0.00 1.00 0.12 76% 1% Suspend [runnable] thread + 0.31 0.00 1.24 0.09 82% 4% Yield [only low prio] thread + 0.21 0.00 0.42 0.04 73% 1% Suspend [runnable->not runnable] + 1.00 0.88 1.45 0.04 78% 4% Kill [runnable] thread + 0.59 0.42 3.97 0.13 81% 87% Destroy [dead] thread + 1.43 1.27 1.94 0.07 78% 7% Destroy [runnable] thread + 3.12 2.58 5.09 0.33 56% 34% Resume [high priority] thread + 0.87 0.36 1.39 0.07 86% 0% Thread switch + + 0.15 0.00 1.39 0.21 81% 81% Scheduler lock + 0.16 0.00 0.64 0.08 85% 7% Scheduler unlock [0 threads] + 0.16 0.00 0.64 0.08 75% 8% Scheduler unlock [1 suspended] + 0.16 0.00 0.70 0.08 78% 6% Scheduler unlock [many suspended] + 0.16 0.00 0.64 0.07 81% 4% Scheduler unlock [many low prio] + + 0.45 0.00 1.39 0.34 56% 46% Init mutex + 0.43 0.18 3.27 0.23 87% 87% Lock [unlocked] mutex + 0.48 0.09 3.88 0.26 84% 71% Unlock [locked] mutex + 0.35 0.21 2.24 0.21 87% 84% Trylock [unlocked] mutex + 0.26 0.00 0.67 0.13 78% 9% Trylock [locked] mutex + 0.21 0.00 1.27 0.24 78% 75% Destroy mutex + 2.58 2.09 3.09 0.13 75% 9% Unlock/Lock mutex + + 0.99 0.21 2.48 0.41 65% 28% Create mbox + 0.04 0.00 0.39 0.07 90% 87% Peek [empty] mbox + 0.47 0.27 3.48 0.29 90% 78% Put [first] mbox + 0.02 0.00 0.39 0.03 90% 90% Peek [1 msg] mbox + 0.29 0.15 0.58 0.04 68% 3% Put [second] mbox + 0.02 0.00 0.45 0.04 93% 93% Peek [2 msgs] mbox + 0.48 0.21 3.67 0.26 84% 87% Get [first] mbox + 0.35 0.09 0.82 0.11 75% 3% Get [second] mbox + 0.50 0.21 3.18 0.33 90% 68% Tryput [first] mbox + 0.39 0.15 1.39 0.19 78% 68% Peek item [non-empty] mbox + 0.43 0.18 3.33 0.23 87% 90% Tryget [non-empty] mbox + 0.28 0.03 0.79 0.06 68% 3% Peek item [empty] mbox + 0.28 0.21 0.58 0.05 71% 65% Tryget [empty] mbox + 0.01 0.00 0.36 0.02 96% 90% Waiting to get mbox + 0.05 0.00 0.45 0.09 87% 84% Waiting to put mbox + 0.42 0.09 2.88 0.20 84% 12% Delete mbox + 1.39 1.27 2.39 0.14 87% 87% Put/Get mbox + + 0.35 0.00 1.36 0.45 75% 68% Init semaphore + 0.19 0.00 0.45 0.04 81% 3% Post [0] semaphore + 0.25 0.21 0.88 0.06 84% 81% Wait [1] semaphore + 0.32 0.06 1.79 0.21 78% 68% Trywait [0] semaphore + 0.20 0.00 0.52 0.06 62% 3% Trywait [1] semaphore + 0.07 0.00 0.45 0.10 84% 81% Peek semaphore + 0.06 0.00 0.52 0.06 71% 78% Destroy semaphore + 1.45 1.42 1.79 0.04 87% 87% Post/Wait semaphore + + 0.70 0.00 2.88 0.47 43% 34% Create counter + 0.05 0.00 0.42 0.09 87% 84% Get counter value + 0.02 0.00 0.45 0.04 93% 93% Set counter value + 0.38 0.12 0.58 0.06 59% 3% Tick counter + 0.03 0.00 0.48 0.05 93% 78% Delete counter + + 1.10 0.39 4.30 0.47 62% 53% Create alarm + 0.58 0.03 3.12 0.18 87% 3% Initialize alarm + 0.04 0.00 0.42 0.07 90% 90% Disable alarm + 0.54 0.36 1.36 0.12 84% 43% Enable alarm + 0.03 0.00 0.70 0.06 84% 84% Delete alarm + 0.50 0.24 0.97 0.08 84% 6% Tick counter [1 alarm] + 5.30 5.12 5.97 0.14 84% 75% Tick counter [many alarms] + 0.82 0.64 1.36 0.11 78% 43% Tick & fire counter [1 alarm] + 14.13 13.85 14.55 0.09 78% 3% Tick & fire counters [>1 together] + 5.56 5.45 6.00 0.09 78% 71% Tick & fire counters [>1 separately] + 9.69 9.45 12.52 0.22 64% 71% Alarm latency [0 threads] + 9.98 9.48 12.76 0.23 69% 14% Alarm latency [2 threads] + 10.38 9.48 24.67 0.59 74% 45% Alarm latency [many threads] + 11.72 11.30 21.33 0.32 81% 58% Alarm -> thread resume latency + + 1.87 1.82 10.42 0.00 Clock/interrupt latency + + 3.02 2.58 7.67 0.00 Clock DSR latency + + 9 0 260 (main stack: 776) Thread stack used (1120 total) +All done, main stack : stack used 776 size 2400 +All done : Interrupt stack used 268 size 4096 +All done : Idlethread stack used 244 size 1120 + +Timing complete - 30300 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: Toshiba JMR3904 Evaluation Board + + +Board: Toshiba JMR3904 Evaluation Board + +CPU : TMPR3904F 50MHz + + +eCOS Kernel Timings +Note: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 0 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 29.68 microseconds (45 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 24 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 13.62 11.72 27.99 1.51 79% 54% Create thread + 2.77 2.60 3.91 0.26 79% 79% Yield thread [all suspended] + 3.31 2.60 6.51 0.27 83% 12% Suspend [suspended] thread + 2.58 1.95 7.81 0.47 58% 37% Resume thread + 4.94 4.56 11.07 0.60 95% 79% Set priority + 0.71 0.65 1.95 0.10 95% 95% Get priority + 14.97 14.32 25.39 0.87 95% 95% Kill [suspended] thread + 2.25 1.95 9.11 0.57 95% 95% Yield [no other] thread + 7.27 6.51 12.37 0.42 79% 16% Resume [suspended low prio] thread + 2.28 1.95 7.16 0.51 95% 79% Resume [runnable low prio] thread + 4.31 3.26 12.37 0.75 87% 79% Suspend [runnable] thread + 2.17 1.95 7.16 0.42 95% 95% Yield [only low prio] thread + 2.39 1.95 6.51 0.51 95% 58% Suspend [runnable->not runnable] + 13.43 12.37 22.79 0.80 91% 91% Kill [runnable] thread + 22.30 20.83 37.76 1.76 91% 91% Resume [high priority] thread + 4.62 4.56 11.07 0.13 98% 98% Thread switch + + 1.51 1.30 2.60 0.29 68% 68% Scheduler lock + 2.36 1.95 3.26 0.31 61% 37% Scheduler unlock [0 threads] + 2.39 1.95 5.21 0.32 62% 36% Scheduler unlock [1 suspended] + 2.38 1.95 4.56 0.32 61% 37% Scheduler unlock [many suspended] + 2.38 1.95 5.21 0.32 61% 37% Scheduler unlock [many low prio] + + 0.90 0.65 3.26 0.35 71% 71% Init mutex + 2.48 1.95 8.46 0.50 50% 46% Lock [unlocked] mutex + 2.83 2.60 9.11 0.42 93% 93% Unlock [locked] mutex + 2.30 1.95 6.51 0.45 96% 65% Trylock [unlocked] mutex + 1.99 1.30 5.86 0.24 84% 12% Trylock [locked] mutex + 0.04 0.00 1.30 0.08 96% 96% Destroy mutex + 42.40 42.32 44.92 0.16 96% 96% Unlock/Lock mutex + + 1.44 1.30 5.86 0.28 96% 96% Create mbox + 0.51 0.00 1.30 0.25 71% 25% Peek [empty] mbox + 2.93 2.60 9.11 0.51 96% 78% Put [first] mbox + 0.51 0.00 1.30 0.25 71% 25% Peek [1 msg] mbox + 4.19 3.91 5.21 0.34 59% 59% Put [second] mbox + 0.45 0.00 0.65 0.28 68% 31% Peek [2 msgs] mbox + 3.28 2.60 10.42 0.45 65% 31% Get [first] mbox + 3.34 2.60 9.77 0.40 78% 18% Get [second] mbox + 2.69 1.95 9.11 0.40 78% 18% Tryput [first] mbox + 2.75 1.95 7.81 0.32 93% 3% Peek item [non-empty] mbox + 3.15 2.60 9.11 0.48 53% 43% Tryget [non-empty] mbox + 2.22 1.95 6.51 0.41 96% 78% Peek item [empty] mbox + 2.40 1.95 5.86 0.42 50% 46% Tryget [empty] mbox + 0.47 0.00 0.65 0.26 71% 28% Waiting to get mbox + 0.59 0.00 1.30 0.15 84% 12% Waiting to put mbox + 4.01 3.26 10.42 0.40 81% 15% Delete mbox + 26.18 26.04 30.60 0.28 96% 96% Put/Get mbox + + 0.92 0.65 3.91 0.38 71% 71% Init semaphore + 2.24 1.95 6.51 0.43 96% 75% Post [0] semaphore + 2.32 1.95 7.16 0.48 96% 65% Wait [1] semaphore + 2.03 1.30 5.86 0.24 90% 6% Trywait [0] semaphore + 1.91 1.30 4.56 0.23 78% 18% Trywait [1] semaphore + 0.77 0.00 1.95 0.30 65% 9% Peek semaphore + 0.61 0.00 1.95 0.15 84% 12% Destroy semaphore + 22.62 22.14 30.60 0.61 96% 62% Post/Wait semaphore + + 0.92 0.65 3.91 0.38 71% 71% Create counter + 0.69 0.65 1.95 0.08 96% 96% Get counter value + 0.41 0.00 1.30 0.33 56% 40% Set counter value + 3.21 2.60 5.86 0.27 71% 21% Tick counter + 0.65 0.00 3.26 0.16 84% 12% Delete counter + + 1.57 1.30 4.56 0.38 71% 71% Create alarm + 4.52 3.91 13.02 0.57 50% 46% Initialize alarm + 0.61 0.00 1.95 0.15 84% 12% Disable alarm + 4.43 3.91 9.11 0.43 56% 40% Enable alarm + 0.87 0.65 2.60 0.32 71% 71% Delete alarm + 2.93 2.60 6.51 0.43 96% 65% Tick counter [1 alarm] + 14.83 14.32 22.79 0.60 96% 59% Tick counter [many alarms] + 4.88 4.56 11.07 0.51 96% 78% Tick & fire counter [1 alarm] + 83.25 82.03 102.86 1.23 96% 93% Tick & fire counters [>1 together] + 17.58 16.93 27.34 0.61 50% 46% Tick & fire counters [>1 separately] + 26.18 24.74 40.36 0.30 97% 0% Alarm latency [0 threads] + 33.88 29.30 56.64 1.70 85% 6% Alarm latency [2 threads] + 36.37 29.30 61.20 3.25 53% 24% Alarm latency [many threads] + + 7.85 6.51 14.97 0.00 Clock/interrupt latency + +Timing complete - 23540 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: Toshiba REF 4955 + + +Board: Toshiba REF 4955 + +CPU : Toshiba TX4955 66MHz + +Startup, main stack : stack used 960 size 2936 +Startup : Interrupt stack used 168 size 4096 +Startup : Idlethread stack used 372 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 3 `ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 4.00 microseconds (264 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 11.21 9.58 14.11 0.95 48% 34% Create thread + 0.66 0.65 1.29 0.02 98% 98% Yield thread [all suspended] + 0.63 0.53 3.06 0.17 82% 82% Suspend [suspended] thread + 0.54 0.53 1.06 0.02 98% 98% Resume thread + 0.78 0.74 1.39 0.05 93% 93% Set priority + 0.05 0.05 0.36 0.01 98% 98% Get priority + 2.06 1.89 6.65 0.25 95% 79% Kill [suspended] thread + 0.65 0.65 0.68 0.00 98% 98% Yield [no other] thread + 1.15 1.02 3.03 0.20 81% 81% Resume [suspended low prio] thread + 0.54 0.52 1.18 0.03 96% 96% Resume [runnable low prio] thread + 0.94 0.88 1.27 0.01 95% 1% Suspend [runnable] thread + 0.65 0.65 0.68 0.00 98% 98% Yield [only low prio] thread + 0.54 0.53 0.86 0.01 98% 96% Suspend [runnable->not runnable] + 1.97 1.89 2.98 0.12 84% 84% Kill [runnable] thread + 1.03 0.92 4.94 0.17 89% 89% Destroy [dead] thread + 2.55 2.33 4.38 0.24 89% 70% Destroy [runnable] thread + 5.62 4.11 13.23 0.99 65% 40% Resume [high priority] thread + 1.84 1.83 2.79 0.02 98% 98% Thread switch + + 0.12 0.02 0.65 0.15 74% 74% Scheduler lock + 0.35 0.35 0.35 0.00 100% 100% Scheduler unlock [0 threads] + 0.35 0.35 0.35 0.00 100% 100% Scheduler unlock [1 suspended] + 0.43 0.35 1.17 0.13 78% 78% Scheduler unlock [many suspended] + 0.45 0.35 1.17 0.15 75% 75% Scheduler unlock [many low prio] + + 0.46 0.15 3.38 0.30 62% 50% Init mutex + 0.73 0.64 3.27 0.16 96% 96% Lock [unlocked] mutex + 0.77 0.65 4.50 0.23 96% 96% Unlock [locked] mutex + 0.58 0.55 1.42 0.05 96% 96% Trylock [unlocked] mutex + 0.51 0.50 0.83 0.02 96% 96% Trylock [locked] mutex + 0.12 0.11 0.41 0.02 96% 96% Destroy mutex + 4.72 4.70 5.58 0.05 96% 96% Unlock/Lock mutex + + 1.01 0.67 3.48 0.40 71% 71% Create mbox + 0.02 0.00 0.53 0.03 96% 96% Peek [empty] mbox + 0.89 0.68 4.20 0.29 96% 71% Put [first] mbox + 0.02 0.00 0.33 0.02 96% 96% Peek [1 msg] mbox + 0.69 0.68 0.76 0.01 50% 46% Put [second] mbox + 0.02 0.00 0.30 0.02 96% 96% Peek [2 msgs] mbox + 0.81 0.71 3.83 0.19 96% 96% Get [first] mbox + 0.72 0.71 1.02 0.02 96% 96% Get [second] mbox + 0.81 0.65 2.74 0.22 96% 71% Tryput [first] mbox + 0.67 0.62 2.27 0.10 96% 96% Peek item [non-empty] mbox + 0.77 0.71 2.41 0.10 96% 96% Tryget [non-empty] mbox + 0.59 0.58 0.88 0.02 96% 96% Peek item [empty] mbox + 0.62 0.62 0.67 0.00 96% 96% Tryget [empty] mbox + 0.03 0.02 0.32 0.02 96% 96% Waiting to get mbox + 0.02 0.02 0.06 0.01 50% 46% Waiting to put mbox + 0.75 0.65 3.59 0.18 96% 96% Delete mbox + 2.80 2.77 3.59 0.05 96% 96% Put/Get mbox + + 0.37 0.18 0.88 0.28 71% 71% Init semaphore + 0.48 0.47 0.80 0.02 96% 96% Post [0] semaphore + 0.60 0.59 0.67 0.01 50% 46% Wait [1] semaphore + 0.53 0.50 1.41 0.06 96% 96% Trywait [0] semaphore + 0.51 0.50 0.71 0.01 96% 50% Trywait [1] semaphore + 0.09 0.09 0.15 0.00 96% 96% Peek semaphore + 0.12 0.11 0.41 0.02 96% 96% Destroy semaphore + 3.05 3.05 3.05 0.00 100% 100% Post/Wait semaphore + + 0.57 0.17 2.76 0.24 59% 25% Create counter + 0.06 0.05 0.58 0.03 96% 96% Get counter value + 0.06 0.03 0.64 0.04 96% 96% Set counter value + 0.73 0.71 1.02 0.02 96% 96% Tick counter + 0.12 0.11 0.15 0.01 50% 46% Delete counter + + 0.89 0.64 3.15 0.34 84% 71% Create alarm + 1.00 0.95 2.41 0.09 96% 96% Initialize alarm + 0.09 0.06 0.68 0.04 96% 96% Disable alarm + 1.05 1.00 2.48 0.09 96% 96% Enable alarm + 0.18 0.17 0.50 0.02 96% 96% Delete alarm + 0.90 0.89 1.11 0.01 96% 96% Tick counter [1 alarm] + 5.60 5.59 5.88 0.02 96% 96% Tick counter [many alarms] + 1.53 1.52 2.11 0.04 96% 96% Tick & fire counter [1 alarm] + 25.48 25.47 25.76 0.02 96% 96% Tick & fire counters [>1 together] + 6.22 6.21 6.44 0.01 96% 96% Tick & fire counters [>1 separately] + 2.59 2.56 6.17 0.07 98% 98% Alarm latency [0 threads] + 4.06 3.95 6.24 0.08 78% 57% Alarm latency [2 threads] + 5.03 2.56 9.03 0.89 59% 10% Alarm latency [many threads] + 5.68 5.59 15.45 0.15 99% 99% Alarm -> thread resume latency + + 2.52 1.41 8.12 0.00 Clock/interrupt latency + + 2.05 1.17 6.00 0.00 Clock DSR latency + + 34 0 1072 (main stack: 1320) Thread stack used (1912 total) +All done, main stack : stack used 1320 size 2936 +All done : Interrupt stack used 136 size 4096 +All done : Idlethread stack used 996 size 2048 + +Timing complete - 30360 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: Matsushita STDEVAL1 Board + + +Board: Matsushita STDEVAL1 Board + +CPU : MN103002A 60MHz + +eCOS Kernel Timings +Note: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 18 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 13.73 microseconds (205 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 24 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 14.36 11.53 23.53 1.81 54% 33% Create thread + 2.64 2.53 5.07 0.20 95% 95% Yield thread [all suspended] + 2.25 1.93 4.80 0.31 45% 83% Suspend [suspended] thread + 2.19 2.00 4.93 0.28 91% 91% Resume thread + 3.42 3.00 8.40 0.47 95% 87% Set priority + 0.31 0.13 1.20 0.19 79% 58% Get priority + 8.26 7.40 18.80 0.93 95% 87% Kill [suspended] thread + 2.58 2.47 5.13 0.21 95% 95% Yield [no other] thread + 5.07 4.53 8.67 0.44 62% 50% Resume [suspended low prio] thread + 2.27 2.07 4.53 0.23 87% 87% Resume [runnable low prio] thread + 4.76 4.07 9.40 0.65 66% 75% Suspend [runnable] thread + 2.63 2.53 4.73 0.18 95% 95% Yield [only low prio] thread + 2.09 1.87 4.27 0.27 91% 79% Suspend [runnable->not runnable] + 10.79 10.00 18.20 0.81 95% 79% Kill [runnable] thread + 20.30 18.40 28.80 1.42 79% 54% Resume [high priority] thread + 5.53 5.47 12.13 0.11 98% 97% Thread switch + + 0.28 0.27 2.20 0.03 97% 97% Scheduler lock + 1.14 1.13 2.00 0.01 99% 99% Scheduler unlock [0 threads] + 1.14 1.13 2.40 0.02 99% 99% Scheduler unlock [1 suspended] + 1.16 1.13 3.33 0.06 95% 95% Scheduler unlock [many suspended] + 1.23 1.20 3.13 0.05 95% 95% Scheduler unlock [many low prio] + + 1.29 1.00 4.20 0.25 65% 50% Init mutex + 2.65 2.47 5.27 0.23 93% 87% Lock [unlocked] mutex + 3.26 3.07 6.80 0.28 93% 87% Unlock [locked] mutex + 2.48 2.33 5.07 0.21 90% 87% Trylock [unlocked] mutex + 2.20 2.07 4.67 0.21 93% 87% Trylock [locked] mutex + 0.23 0.20 1.00 0.05 96% 93% Destroy mutex + 25.11 24.73 27.53 0.21 65% 31% Unlock/Lock mutex + + 2.49 2.00 5.73 0.32 81% 37% Create mbox + 0.11 0.00 1.60 0.15 84% 81% Peek [empty] mbox + 3.01 2.60 9.47 0.52 96% 78% Put [first] mbox + 0.10 0.00 1.67 0.15 87% 81% Peek [1 msg] mbox + 3.09 2.60 8.33 0.50 93% 75% Put [second] mbox + 0.06 0.00 1.13 0.08 96% 87% Peek [2 msgs] mbox + 3.10 2.80 7.93 0.40 93% 84% Get [first] mbox + 3.13 2.80 7.53 0.43 90% 78% Get [second] mbox + 2.99 2.60 8.53 0.52 93% 75% Tryput [first] mbox + 2.65 2.33 6.80 0.42 90% 78% Peek item [non-empty] mbox + 3.05 2.73 7.60 0.42 93% 78% Tryget [non-empty] mbox + 3.16 2.93 6.27 0.31 84% 84% Peek item [empty] mbox + 2.48 2.27 5.73 0.30 84% 84% Tryget [empty] mbox + 0.23 0.13 2.07 0.14 96% 87% Waiting to get mbox + 0.22 0.13 1.93 0.13 96% 75% Waiting to put mbox + 3.08 2.80 7.93 0.42 84% 84% Delete mbox + 16.01 15.53 19.00 0.52 78% 59% Put/Get mbox + + 0.85 0.67 3.27 0.19 96% 50% Init semaphore + 2.00 1.93 3.87 0.12 96% 90% Post [0] semaphore + 2.05 2.00 3.47 0.09 96% 96% Wait [1] semaphore + 1.85 1.80 3.47 0.10 96% 96% Trywait [0] semaphore + 1.82 1.80 2.53 0.04 96% 96% Trywait [1] semaphore + 0.36 0.33 1.33 0.06 96% 96% Peek semaphore + 0.38 0.33 1.87 0.09 96% 96% Destroy semaphore + 12.38 12.20 16.27 0.30 93% 87% Post/Wait semaphore + + 1.18 0.73 4.07 0.24 78% 18% Create counter + 0.20 0.13 1.40 0.11 87% 87% Get counter value + 0.24 0.20 1.40 0.08 93% 93% Set counter value + 3.17 3.13 4.20 0.07 93% 93% Tick counter + 0.44 0.40 1.73 0.08 96% 96% Delete counter + + 2.24 1.67 5.13 0.47 68% 65% Create alarm + 3.86 3.40 9.67 0.51 90% 78% Initialize alarm + 0.15 0.07 1.60 0.12 96% 68% Disable alarm + 3.76 3.47 7.67 0.35 93% 75% Enable alarm + 0.57 0.47 2.73 0.16 96% 84% Delete alarm + 3.64 3.60 4.73 0.07 96% 96% Tick counter [1 alarm] + 21.72 21.67 23.27 0.10 96% 96% Tick counter [many alarms] + 6.13 6.07 8.07 0.12 96% 96% Tick & fire counter [1 alarm] + 101.40 99.53 132.73 2.75 93% 93% Tick & fire counters [>1 together] + 24.21 24.13 26.40 0.14 96% 96% Tick & fire counters [>1 separately] + 11.74 11.60 22.67 0.26 98% 98% Alarm latency [0 threads] + 14.58 11.73 24.93 1.59 54% 28% Alarm latency [2 threads] + 18.18 15.20 41.07 1.96 60% 43% Alarm latency [many threads] + + 3.06 2.13 10.33 0.00 Clock/interrupt latency + +Timing complete - 23480 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: Fujitsu SPARClite Evaluation Board + + +Board: Fujitsu SPARClite Evaluation Board + +CPU : Fujitsu SPARClite MB8683X 100MHz + + +eCOS Kernel Timings +Note: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 0 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 17.19 microseconds (17 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 24 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 48.59 47.00 63.01 1.41 66% 70% Create thread + 2.13 2.00 5.00 0.24 95% 95% Yield thread [all suspended] + 2.92 2.00 10.00 0.69 58% 37% Suspend [suspended] thread + 2.13 1.00 10.00 0.66 75% 20% Resume thread + 2.79 2.00 11.00 0.86 95% 54% Set priority + 1.00 0.00 5.00 0.33 79% 16% Get priority + 7.17 5.00 34.00 2.24 95% 95% Kill [suspended] thread + 2.42 2.00 12.00 0.80 95% 95% Yield [no other] thread + 3.46 2.00 14.00 1.10 75% 83% Resume [suspended low prio] thread + 2.00 1.00 9.00 0.58 66% 29% Resume [runnable low prio] thread + 4.21 3.00 20.00 1.38 95% 91% Suspend [runnable] thread + 2.33 2.00 10.00 0.64 95% 95% Yield [only low prio] thread + 2.00 1.00 9.00 0.67 58% 33% Suspend [runnable->not runnable] + 5.79 4.00 30.00 2.07 95% 95% Kill [runnable] thread + 39.34 37.00 75.01 3.36 91% 91% Resume [high priority] thread + 15.20 15.00 31.00 0.40 97% 97% Thread switch + + 1.04 1.00 4.00 0.08 97% 97% Scheduler lock + 1.42 1.00 5.00 0.51 60% 60% Scheduler unlock [0 threads] + 1.41 1.00 5.00 0.50 61% 61% Scheduler unlock [1 suspended] + 1.41 1.00 5.00 0.50 60% 60% Scheduler unlock [many suspended] + 1.40 1.00 5.00 0.50 62% 62% Scheduler unlock [many low prio] + + 1.19 1.00 6.00 0.35 93% 93% Init mutex + 2.34 2.00 12.00 0.64 93% 93% Lock [unlocked] mutex + 3.41 3.00 13.00 0.71 96% 87% Unlock [locked] mutex + 2.16 1.00 10.00 0.49 87% 9% Trylock [unlocked] mutex + 1.78 1.00 7.00 0.59 59% 37% Trylock [locked] mutex + 0.72 0.00 2.00 0.45 65% 31% Destroy mutex + 25.25 24.00 41.00 0.98 71% 25% Unlock/Lock mutex + + 1.44 1.00 9.00 0.68 96% 78% Create mbox + 0.94 0.00 3.00 0.23 84% 12% Peek [empty] mbox + 3.06 2.00 13.00 0.62 71% 25% Put [first] mbox + 0.69 0.00 3.00 0.52 59% 37% Peek [1 msg] mbox + 2.44 2.00 10.00 0.68 96% 78% Put [second] mbox + 0.78 0.00 3.00 0.44 68% 28% Peek [2 msgs] mbox + 3.78 3.00 14.00 0.83 96% 53% Get [first] mbox + 2.97 2.00 9.00 0.61 56% 31% Get [second] mbox + 2.53 2.00 12.00 0.80 96% 75% Tryput [first] mbox + 2.72 2.00 12.00 0.81 96% 56% Peek item [non-empty] mbox + 2.63 2.00 13.00 0.94 90% 75% Tryget [non-empty] mbox + 1.97 1.00 6.00 0.42 68% 21% Peek item [empty] mbox + 2.09 1.00 9.00 0.49 78% 15% Tryget [empty] mbox + 0.84 0.00 4.00 0.42 71% 25% Waiting to get mbox + 0.81 0.00 4.00 0.46 68% 28% Waiting to put mbox + 2.38 2.00 11.00 0.66 96% 87% Delete mbox + 23.41 22.00 47.00 1.47 96% 96% Put/Get mbox + + 1.03 0.00 6.00 0.31 84% 12% Init semaphore + 2.66 2.00 8.00 0.66 96% 50% Post [0] semaphore + 1.97 1.00 10.00 0.55 68% 28% Wait [1] semaphore + 1.78 1.00 8.00 0.63 56% 40% Trywait [0] semaphore + 1.84 1.00 8.00 0.58 62% 34% Trywait [1] semaphore + 1.00 0.00 5.00 0.25 84% 12% Peek semaphore + 0.81 0.00 4.00 0.46 68% 28% Destroy semaphore + 19.03 18.00 41.00 1.37 96% 96% Post/Wait semaphore + + 1.38 1.00 6.00 0.56 75% 75% Create counter + 1.09 1.00 3.00 0.18 93% 93% Get counter value + 1.00 0.00 5.00 0.31 78% 15% Set counter value + 3.09 2.00 6.00 0.35 78% 9% Tick counter + 0.91 0.00 5.00 0.40 75% 21% Delete counter + + 2.53 2.00 9.00 0.70 96% 65% Create alarm + 6.03 5.00 22.00 1.00 50% 46% Initialize alarm + 0.78 0.00 4.00 0.49 65% 31% Disable alarm + 2.91 2.00 13.00 0.91 87% 50% Enable alarm + 0.97 0.00 5.00 0.30 81% 15% Delete alarm + 2.69 2.00 9.00 0.69 96% 50% Tick counter [1 alarm] + 12.00 11.00 23.00 0.69 62% 34% Tick counter [many alarms] + 4.16 3.00 13.00 0.55 84% 12% Tick & fire counter [1 alarm] + 72.69 72.01 87.01 1.03 96% 96% Tick & fire counters [>1 together] + 13.66 13.00 23.00 0.82 96% 62% Tick & fire counters [>1 separately] + 13.26 13.00 42.00 0.51 98% 98% Alarm latency [0 threads] + 16.75 11.00 53.01 2.78 64% 16% Alarm latency [2 threads] + 24.06 18.00 58.01 3.55 67% 25% Alarm latency [many threads] + + 3.61 2.00 13.00 0.00 Clock/interrupt latency + +Timing complete - 23590 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: Cogent CMA MPC860 (PowerPC) Evaluation +Board: Cogent CMA MPC860 (PowerPC) Evaluation +CPU : MPC860, revision A3 33MHz + + +eCOS Kernel Timings +Note: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 0 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 14.46 microseconds (30 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 24 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 26.78 23.52 41.76 1.97 66% 37% Create thread + 4.00 3.84 4.80 0.23 70% 70% Yield thread [all suspended] + 3.78 3.36 7.68 0.38 50% 45% Suspend [suspended] thread + 3.56 3.36 7.68 0.37 95% 91% Resume thread + 5.28 4.32 12.96 0.76 83% 66% Set priority + 0.84 0.48 3.84 0.39 91% 54% Get priority + 11.76 10.08 32.16 1.70 95% 95% Kill [suspended] thread + 4.14 3.84 8.64 0.45 95% 75% Yield [no other] thread + 7.14 5.76 17.76 1.07 79% 70% Resume [suspended low prio] thread + 3.60 3.36 8.16 0.42 95% 87% Resume [runnable low prio] thread + 6.10 5.28 14.88 0.80 62% 70% Suspend [runnable] thread + 4.00 3.84 5.76 0.25 79% 79% Yield [only low prio] thread + 3.66 3.36 8.64 0.47 95% 79% Suspend [runnable->not runnable] + 11.66 10.08 30.24 1.58 79% 91% Kill [runnable] thread + 31.12 27.84 53.28 2.35 87% 50% Resume [high priority] thread + 7.52 7.20 15.84 0.30 50% 48% Thread switch + + 1.00 0.48 2.88 0.21 63% 14% Scheduler lock + 2.57 2.40 3.84 0.23 65% 65% Scheduler unlock [0 threads] + 2.58 2.40 4.32 0.23 64% 64% Scheduler unlock [1 suspended] + 2.59 2.40 4.32 0.24 62% 62% Scheduler unlock [many suspended] + 2.59 2.40 4.32 0.24 61% 61% Scheduler unlock [many low prio] + + 1.69 1.44 5.76 0.37 96% 71% Init mutex + 4.15 3.84 10.56 0.47 96% 75% Lock [unlocked] mutex + 5.82 5.28 10.56 0.38 62% 28% Unlock [locked] mutex + 3.70 3.36 8.64 0.41 96% 59% Trylock [unlocked] mutex + 3.42 2.88 6.72 0.26 75% 15% Trylock [locked] mutex + 0.36 0.00 1.92 0.25 62% 34% Destroy mutex + 43.41 42.72 45.12 0.34 81% 3% Unlock/Lock mutex + + 3.27 2.88 8.16 0.39 96% 50% Create mbox + 0.57 0.00 2.40 0.34 50% 21% Peek [empty] mbox + 6.16 5.76 11.04 0.48 87% 87% Put [first] mbox + 0.48 0.00 1.92 0.27 50% 28% Peek [1 msg] mbox + 5.92 5.28 10.56 0.35 90% 6% Put [second] mbox + 0.60 0.00 2.40 0.30 62% 12% Peek [2 msgs] mbox + 4.69 4.32 12.00 0.54 93% 93% Get [first] mbox + 4.68 4.32 11.52 0.52 93% 93% Get [second] mbox + 5.86 5.28 11.04 0.47 62% 31% Tryput [first] mbox + 4.00 3.36 9.12 0.38 87% 9% Peek item [non-empty] mbox + 4.59 3.84 12.48 0.61 71% 75% Tryget [non-empty] mbox + 3.75 3.36 7.68 0.34 53% 43% Peek item [empty] mbox + 3.93 3.36 9.60 0.45 65% 31% Tryget [empty] mbox + 0.63 0.00 2.40 0.28 68% 6% Waiting to get mbox + 0.54 0.00 1.92 0.19 75% 9% Waiting to put mbox + 4.84 4.32 12.00 0.47 56% 40% Delete mbox + 24.18 23.52 29.76 0.66 81% 75% Put/Get mbox + + 1.72 0.96 3.84 0.33 90% 6% Init semaphore + 3.15 2.88 6.24 0.34 96% 62% Post [0] semaphore + 3.85 3.36 8.64 0.30 68% 28% Wait [1] semaphore + 3.24 2.88 6.24 0.34 46% 46% Trywait [0] semaphore + 3.22 2.88 6.24 0.32 50% 46% Trywait [1] semaphore + 0.96 0.48 2.88 0.12 84% 12% Peek semaphore + 0.99 0.96 1.92 0.06 96% 96% Destroy semaphore + 24.71 24.00 28.80 0.40 87% 6% Post/Wait semaphore + + 2.31 1.44 6.24 0.77 46% 56% Create counter + 0.45 0.00 0.96 0.08 87% 9% Get counter value + 0.42 0.00 0.96 0.16 75% 18% Set counter value + 4.14 3.84 4.80 0.26 50% 43% Tick counter + 0.91 0.48 2.40 0.19 71% 21% Delete counter + + 5.23 4.32 7.68 0.61 65% 53% Create alarm + 5.58 4.80 12.96 0.72 68% 84% Initialize alarm + 0.75 0.48 1.92 0.30 90% 56% Disable alarm + 8.02 7.20 14.40 0.53 84% 68% Enable alarm + 1.32 0.96 3.84 0.29 56% 40% Delete alarm + 4.63 4.32 6.24 0.28 53% 43% Tick counter [1 alarm] + 23.67 23.52 25.44 0.23 78% 78% Tick counter [many alarms] + 7.24 6.72 10.56 0.21 84% 12% Tick & fire counter [1 alarm] + 106.83 106.56 110.40 0.35 96% 65% Tick & fire counters [>1 together] + 26.18 25.44 29.76 0.46 81% 9% Tick & fire counters [>1 separately] + 10.79 10.08 29.28 0.66 53% 55% Alarm latency [0 threads] + 17.20 13.92 35.52 1.48 67% 21% Alarm latency [2 threads] + 29.69 22.56 47.04 3.58 57% 17% Alarm latency [many threads] + + 7.66 3.84 19.20 0.00 Clock/interrupt latency + +Timing complete - 23530 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: NEC VR4373 + + +Board: NEC VR4373 + +CPU : NEC VR4300 133MHz + + +Startup, main stack : stack used 1304 size 3576 +Startup : Interrupt stack used 980 size 4096 +Startup : Idlethread stack used 494 size 2552 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 3 `ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 6.49 microseconds (431 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 16 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 17.21 16.18 22.14 0.88 75% 68% Create thread + 0.84 0.78 1.29 0.10 81% 81% Yield thread [all suspended] + 0.90 0.62 3.20 0.35 87% 87% Suspend [suspended] thread + 0.74 0.65 1.16 0.12 81% 68% Resume thread + 1.11 0.90 1.70 0.25 75% 68% Set priority + 0.11 0.05 0.35 0.09 75% 75% Get priority + 2.93 2.24 8.27 0.78 93% 75% Kill [suspended] thread + 0.88 0.78 1.92 0.16 93% 81% Yield [no other] thread + 1.82 1.20 4.71 0.62 87% 62% Resume [suspended low prio] thread + 0.70 0.63 0.86 0.09 68% 68% Resume [runnable low prio] thread + 1.21 1.07 1.61 0.13 81% 68% Suspend [runnable] thread + 0.86 0.78 1.58 0.13 81% 81% Yield [only low prio] thread + 0.69 0.62 0.84 0.09 68% 68% Suspend [runnable->not runnable] + 2.64 2.24 4.35 0.43 81% 62% Kill [runnable] thread + 1.50 1.07 5.82 0.56 93% 87% Destroy [dead] thread + 3.66 2.75 7.74 0.82 50% 56% Destroy [runnable] thread + 13.65 8.33 27.88 3.70 50% 43% Resume [high priority] thread + 2.04 1.89 3.32 0.15 46% 49% Thread switch + + 0.19 0.05 0.83 0.13 48% 44% Scheduler lock + 0.50 0.41 1.59 0.13 89% 73% Scheduler unlock [0 threads] + 0.52 0.41 1.29 0.14 89% 64% Scheduler unlock [1 suspended] + 0.56 0.41 1.49 0.15 42% 47% Scheduler unlock [many suspended] + 0.56 0.41 1.41 0.15 43% 47% Scheduler unlock [many low prio] + + 0.57 0.20 2.33 0.27 65% 50% Init mutex + 0.89 0.75 3.35 0.20 96% 75% Lock [unlocked] mutex + 0.90 0.74 4.38 0.25 96% 93% Unlock [locked] mutex + 0.77 0.65 2.63 0.17 96% 75% Trylock [unlocked] mutex + 0.66 0.59 1.16 0.10 75% 75% Trylock [locked] mutex + 0.07 0.00 0.45 0.09 75% 75% Destroy mutex + 7.95 7.71 9.49 0.19 50% 46% Unlock/Lock mutex + + 1.04 0.81 3.44 0.27 93% 68% Create mbox + 0.10 0.02 0.57 0.11 71% 68% Peek [empty] mbox + 1.15 0.83 4.71 0.31 53% 71% Put [first] mbox + 0.10 0.02 0.57 0.12 68% 68% Peek [1 msg] mbox + 1.01 0.83 3.83 0.22 93% 75% Put [second] mbox + 0.09 0.02 0.57 0.10 71% 71% Peek [2 msgs] mbox + 1.03 0.81 5.02 0.27 96% 87% Get [first] mbox + 0.93 0.81 1.61 0.14 84% 62% Get [second] mbox + 1.07 0.77 4.18 0.23 68% 50% Tryput [first] mbox + 0.89 0.72 3.49 0.21 93% 71% Peek item [non-empty] mbox + 1.04 0.83 4.09 0.26 90% 81% Tryget [non-empty] mbox + 0.79 0.68 1.97 0.15 87% 68% Peek item [empty] mbox + 0.84 0.72 2.36 0.17 93% 68% Tryget [empty] mbox + 0.13 0.02 0.59 0.13 87% 62% Waiting to get mbox + 0.13 0.02 0.90 0.13 90% 62% Waiting to put mbox + 0.93 0.77 3.23 0.21 90% 71% Delete mbox + 4.74 4.51 8.80 0.32 93% 78% Put/Get mbox + + 0.50 0.21 1.95 0.29 90% 50% Init semaphore + 0.86 0.57 2.87 0.29 93% 56% Post [0] semaphore + 1.01 0.74 3.62 0.28 93% 56% Wait [1] semaphore + 0.87 0.60 3.17 0.28 90% 59% Trywait [0] semaphore + 0.74 0.62 1.70 0.14 93% 56% Trywait [1] semaphore + 0.36 0.11 1.11 0.26 65% 56% Peek semaphore + 0.25 0.12 1.19 0.14 93% 56% Destroy semaphore + 7.85 7.52 8.93 0.21 62% 43% Post/Wait semaphore + + 0.90 0.44 3.08 0.29 65% 28% Create counter + 0.07 0.05 0.89 0.05 96% 96% Get counter value + 0.06 0.05 0.33 0.02 96% 96% Set counter value + 0.88 0.86 1.62 0.05 96% 96% Tick counter + 0.13 0.12 0.41 0.02 96% 96% Delete counter + + 1.37 0.81 2.95 0.27 62% 25% Create alarm + 1.35 1.17 6.03 0.31 96% 93% Initialize alarm + 0.11 0.08 0.65 0.05 90% 90% Disable alarm + 1.23 1.14 3.05 0.15 93% 87% Enable alarm + 0.21 0.18 0.47 0.04 90% 90% Delete alarm + 1.03 0.99 2.11 0.07 96% 96% Tick counter [1 alarm] + 4.96 4.96 4.96 0.00 100% 100% Tick counter [many alarms] + 1.70 1.67 2.51 0.05 96% 96% Tick & fire counter [1 alarm] + 26.39 26.38 26.71 0.02 96% 96% Tick & fire counters [>1 together] + 5.65 5.64 5.91 0.02 96% 96% Tick & fire counters [>1 separately] + 2.55 2.38 9.86 0.19 96% 54% Alarm latency [0 threads] + 5.37 3.80 9.73 0.95 50% 34% Alarm latency [2 threads] + 8.79 5.83 16.12 1.29 57% 14% Alarm latency [many threads] + + 5.85 2.26 16.24 0.00 Clock/interrupt latency + + 1540 1536 1544 (main stack: 1664) Thread stack used (2552 total) +All done, main stack : stack used 1664 size 3576 +All done : Interrupt stack used 312 size 4096 +All done : Idlethread stack used 1440 size 2552 + +Timing complete - 23810 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + +Board: Intel SA1110 (Assabet) +Board: Intel SA1110 (Assabet) + +CPU : StrongARM 221.2 MHz + + + +Microseconds for one run through Dhrystone: 3.3 +Dhrystones per Second: 306748.5 +VAX MIPS rating = 174.586 + +Startup, main stack : stack used 420 size 2400 +Startup : Interrupt stack used 136 size 4096 +Startup : Idlethread stack used 84 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 0 `ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 3.20 microseconds (11 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 5.98 4.88 14.38 0.70 57% 35% Create thread + 0.86 0.81 1.90 0.08 87% 87% Yield thread [all suspended] + 1.05 0.81 3.53 0.19 46% 39% Suspend [suspended] thread + 1.07 0.81 3.80 0.18 48% 35% Resume thread + 1.36 1.09 5.97 0.22 45% 39% Set priority + 0.73 0.54 1.90 0.19 85% 50% Get priority + 2.93 2.44 13.56 0.39 79% 70% Kill [suspended] thread + 0.89 0.81 4.34 0.14 89% 89% Yield [no other] thread + 1.63 1.36 4.61 0.17 57% 29% Resume [suspended low prio] thread + 1.03 0.81 3.53 0.19 46% 42% Resume [runnable low prio] thread + 1.74 1.36 6.51 0.22 87% 6% Suspend [runnable] thread + 0.93 0.81 4.61 0.18 98% 78% Yield [only low prio] thread + 1.06 0.81 3.26 0.19 42% 39% Suspend [runnable->not runnable] + 2.56 1.90 13.02 0.41 87% 34% Kill [runnable] thread + 2.02 1.63 7.05 0.22 92% 3% Destroy [dead] thread + 3.09 2.44 15.19 0.51 78% 46% Destroy [runnable] thread + 6.77 5.43 13.02 0.59 75% 17% Resume [high priority] thread + 1.81 1.63 7.87 0.18 49% 49% Thread switch + + 0.25 0.00 1.36 0.05 89% 10% Scheduler lock + 0.51 0.27 1.36 0.06 85% 13% Scheduler unlock [0 threads] + 0.51 0.27 1.09 0.06 85% 13% Scheduler unlock [1 suspended] + 0.51 0.27 1.09 0.07 85% 14% Scheduler unlock [many suspended] + 0.51 0.27 1.09 0.06 85% 13% Scheduler unlock [many low prio] + + 0.52 0.27 2.17 0.15 62% 31% Init mutex + 0.97 0.54 4.34 0.28 84% 65% Lock [unlocked] mutex + 1.05 0.81 5.15 0.28 96% 96% Unlock [locked] mutex + 0.86 0.54 3.26 0.24 65% 31% Trylock [unlocked] mutex + 0.79 0.54 3.53 0.23 43% 46% Trylock [locked] mutex + 0.33 0.27 1.63 0.11 90% 90% Destroy mutex + 4.16 3.80 8.95 0.30 75% 96% Unlock/Lock mutex + + 0.70 0.54 2.98 0.21 96% 65% Create mbox + 0.59 0.27 1.63 0.14 75% 9% Peek [empty] mbox + 1.33 1.09 5.70 0.31 96% 93% Put [first] mbox + 0.61 0.27 1.63 0.13 81% 3% Peek [1 msg] mbox + 1.35 1.09 5.43 0.31 96% 87% Put [second] mbox + 0.58 0.27 1.36 0.11 78% 6% Peek [2 msgs] mbox + 1.38 1.09 4.88 0.25 59% 37% Get [first] mbox + 1.40 1.09 5.15 0.26 62% 34% Get [second] mbox + 1.27 0.81 4.88 0.28 90% 65% Tryput [first] mbox + 1.34 0.81 4.61 0.22 59% 6% Peek item [non-empty] mbox + 1.47 1.09 5.15 0.27 84% 12% Tryget [non-empty] mbox + 1.12 0.81 4.34 0.23 59% 31% Peek item [empty] mbox + 1.14 0.81 4.07 0.24 71% 25% Tryget [empty] mbox + 0.59 0.27 1.36 0.12 78% 6% Waiting to get mbox + 0.59 0.27 1.36 0.12 78% 6% Waiting to put mbox + 1.28 0.81 5.43 0.32 87% 78% Delete mbox + 2.64 2.17 10.31 0.48 96% 96% Put/Get mbox + + 0.47 0.27 2.17 0.19 46% 46% Init semaphore + 0.77 0.54 3.80 0.26 90% 56% Post [0] semaphore + 0.90 0.54 4.07 0.26 75% 21% Wait [1] semaphore + 0.85 0.54 3.26 0.21 56% 28% Trywait [0] semaphore + 0.69 0.54 2.17 0.18 96% 62% Trywait [1] semaphore + 0.44 0.27 2.17 0.19 96% 56% Peek semaphore + 0.38 0.27 1.90 0.17 96% 75% Destroy semaphore + 2.74 2.44 9.49 0.42 96% 96% Post/Wait semaphore + + 0.43 0.27 1.90 0.18 96% 56% Create counter + 0.49 0.00 2.17 0.18 56% 3% Get counter value + 0.33 0.00 1.63 0.13 78% 6% Set counter value + 1.03 0.81 2.44 0.22 84% 50% Tick counter + 0.42 0.27 1.90 0.20 90% 65% Delete counter + + 0.70 0.54 2.44 0.20 93% 62% Create alarm + 1.65 1.36 6.78 0.40 96% 81% Initialize alarm + 0.75 0.54 1.63 0.18 43% 43% Disable alarm + 1.75 1.36 7.05 0.38 65% 81% Enable alarm + 0.81 0.54 2.44 0.15 62% 28% Delete alarm + 1.01 0.81 2.17 0.16 56% 40% Tick counter [1 alarm] + 4.19 4.07 5.43 0.16 96% 68% Tick counter [many alarms] + 1.48 1.36 3.80 0.20 96% 78% Tick & fire counter [1 alarm] + 20.23 20.07 22.52 0.21 96% 65% Tick & fire counters [>1 together] + 4.70 4.61 6.78 0.16 87% 87% Tick & fire counters [>1 separately] + 2.81 2.71 14.38 0.20 98% 98% Alarm latency [0 threads] + 3.19 2.71 13.56 0.38 73% 59% Alarm latency [2 threads] + 9.71 7.87 18.17 1.25 59% 53% Alarm latency [many threads] + 5.77 5.43 45.57 0.68 97% 97% Alarm -> thread resume latency + + 2.38 0.81 9.49 0.00 Clock/interrupt latency + + 2.02 1.09 7.32 0.00 Clock DSR latency + + 11 0 316 (main stack: 764) Thread stack used (1120 total) +All done, main stack : stack used 764 size 2400 +All done : Interrupt stack used 287 size 4096 +All done : Idlethread stack used 272 size 2048 + +Timing complete - 30220 ms total + + + + + + +Board: Intel SA1100 (Brutus) +Board: Intel SA1100 (Brutus) + +CPU : StrongARM 221.2 MHz + +Microseconds for one run through Dhrystone: 3.3 +Dhrystones per Second: 306748.5 +VAX MIPS rating = 174.586 + +Startup, main stack : stack used 404 size 2400 +Startup : Interrupt stack used 136 size 4096 +Startup : Idlethread stack used 87 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 0 `ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 3.09 microseconds (11 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 6.63 5.43 18.99 0.77 70% 37% Create thread + 0.83 0.81 2.17 0.04 98% 98% Yield thread [all suspended] + 1.27 0.81 5.15 0.30 68% 73% Suspend [suspended] thread + 1.25 0.81 5.15 0.25 82% 1% Resume thread + 1.52 1.09 7.87 0.30 78% 75% Set priority + 0.97 0.54 2.71 0.28 64% 51% Get priority + 3.45 2.71 19.53 0.66 84% 76% Kill [suspended] thread + 0.90 0.81 6.24 0.17 98% 98% Yield [no other] thread + 1.86 1.36 6.24 0.33 68% 50% Resume [suspended low prio] thread + 1.25 0.81 5.15 0.25 82% 1% Resume [runnable low prio] thread + 2.01 1.63 10.04 0.32 70% 84% Suspend [runnable] thread + 0.90 0.81 6.24 0.17 98% 98% Yield [only low prio] thread + 1.25 0.81 5.15 0.24 84% 1% Suspend [runnable->not runnable] + 2.92 1.90 18.72 0.57 85% 43% Kill [runnable] thread + 2.45 1.90 10.31 0.33 95% 54% Destroy [dead] thread + 3.95 2.71 23.60 0.89 68% 54% Destroy [runnable] thread + 8.55 6.24 19.53 1.15 60% 23% Resume [high priority] thread + 1.85 1.63 11.94 0.21 49% 49% Thread switch + + 0.25 0.00 1.63 0.05 89% 10% Scheduler lock + 0.52 0.27 1.90 0.07 85% 13% Scheduler unlock [0 threads] + 0.51 0.27 1.36 0.06 85% 13% Scheduler unlock [1 suspended] + 0.51 0.27 1.36 0.06 85% 13% Scheduler unlock [many suspended] + 0.51 0.27 1.63 0.06 85% 13% Scheduler unlock [many low prio] + + 0.58 0.27 3.53 0.20 71% 21% Init mutex + 1.07 0.54 5.70 0.35 87% 59% Lock [unlocked] mutex + 1.14 0.81 6.51 0.40 96% 81% Unlock [locked] mutex + 0.96 0.54 5.15 0.34 68% 65% Trylock [unlocked] mutex + 0.94 0.54 4.88 0.34 65% 65% Trylock [locked] mutex + 0.33 0.27 2.17 0.11 96% 96% Destroy mutex + 4.21 3.80 10.85 0.41 71% 96% Unlock/Lock mutex + 0.76 0.54 4.07 0.25 96% 56% Create mbox + 0.75 0.54 1.90 0.20 84% 50% Peek [empty] mbox + 1.56 1.09 6.78 0.39 68% 59% Put [first] mbox + 0.75 0.54 1.90 0.20 84% 50% Peek [1 msg] mbox + 1.55 1.09 6.78 0.40 68% 62% Put [second] mbox + 0.77 0.54 1.63 0.17 46% 37% Peek [2 msgs] mbox + 1.67 1.09 6.24 0.31 87% 34% Get [first] mbox + 1.63 1.09 6.24 0.31 75% 34% Get [second] mbox + 1.50 1.09 6.51 0.40 56% 62% Tryput [first] mbox + 1.58 1.09 5.43 0.37 68% 53% Peek item [non-empty] mbox + 1.79 1.09 7.05 0.43 71% 25% Tryget [non-empty] mbox + 1.29 1.09 5.15 0.32 87% 87% Peek item [empty] mbox + 1.33 1.09 5.97 0.37 96% 84% Tryget [empty] mbox + 0.73 0.54 1.90 0.21 84% 56% Waiting to get mbox + 0.76 0.54 1.90 0.19 40% 43% Waiting to put mbox + 1.47 1.09 6.78 0.39 59% 84% Delete mbox + 2.70 2.17 12.75 0.63 96% 96% Put/Get mbox + + 0.47 0.27 2.71 0.20 96% 50% Init semaphore + 0.89 0.54 4.88 0.33 56% 75% Post [0] semaphore + 0.96 0.54 5.15 0.33 71% 75% Wait [1] semaphore + 0.86 0.54 4.88 0.32 96% 81% Trywait [0] semaphore + 0.69 0.54 3.26 0.22 96% 75% Trywait [1] semaphore + 0.49 0.27 3.26 0.28 84% 84% Peek semaphore + 0.39 0.27 2.44 0.19 96% 78% Destroy semaphore + 2.83 2.44 11.66 0.55 96% 96% Post/Wait semaphore + + 0.52 0.27 3.26 0.20 56% 40% Create counter + 0.59 0.00 2.71 0.34 81% 46% Get counter value + 0.36 0.00 2.44 0.21 81% 9% Set counter value + 1.13 0.81 2.98 0.26 59% 37% Tick counter + 0.39 0.27 1.90 0.19 90% 78% Delete counter + + 0.86 0.54 4.07 0.24 65% 31% Create alarm + 1.86 1.36 9.77 0.54 96% 90% Initialize alarm + 0.77 0.54 2.71 0.23 84% 50% Disable alarm + 1.86 1.36 9.22 0.51 96% 75% Enable alarm + 0.89 0.54 3.26 0.25 65% 21% Delete alarm + 0.99 0.81 3.26 0.21 96% 59% Tick counter [1 alarm] + 4.22 4.07 6.78 0.22 96% 71% Tick counter [many alarms] + 1.51 1.36 4.61 0.24 96% 78% Tick & fire counter [1 alarm] + 20.29 20.07 23.33 0.23 96% 53% Tick & fire counters [>1 together] + 4.71 4.61 7.87 0.20 96% 96% Tick & fire counters [>1 separately] + 2.88 2.71 23.87 0.33 99% 99% Alarm latency [0 threads] + 3.24 2.71 17.36 0.40 79% 58% Alarm latency [2 threads] + 15.71 12.48 27.40 1.47 53% 17% Alarm latency [many threads] + 5.95 5.43 64.56 1.02 97% 97% Alarm -> thread resume latency + + 3.25 0.81 14.11 0.00 Clock/interrupt latency + + 2.68 1.09 12.75 0.00 Clock DSR latency + + 29 0 316 (main stack: 764) Thread stack used (1120 total) +All done, main stack : stack used 764 size 2400 +All done : Interrupt stack used 288 size 4096 +All done : Idlethread stack used 260 size 2048 + + +Timing complete - 30280 ms total + + + + + + + +Board: Motorola MBX + + +Board: Motorola MBX + +CPU : Motorola MPC860 66MHZ + + +Startup, main stack : stack used 643 size 5664 +Startup : Interrupt stack used 427 size 4096 +Startup : Idlethread stack used 236 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 0 `ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 25.36 microseconds (79 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 16 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 27.58 25.60 44.16 2.07 93% 93% Create thread + 5.94 5.76 7.04 0.22 93% 62% Yield thread [all suspended] + 6.06 5.44 10.56 0.57 75% 75% Suspend [suspended] thread + 5.42 4.80 9.60 0.53 87% 81% Resume thread + 7.10 6.40 14.08 0.90 93% 87% Set priority + 0.86 0.64 1.92 0.22 93% 50% Get priority + 16.74 15.04 36.48 2.47 93% 93% Kill [suspended] thread + 6.14 5.76 10.56 0.55 93% 93% Yield [no other] thread + 9.74 8.96 18.56 1.10 93% 93% Resume [suspended low prio] thread + 5.28 4.80 9.28 0.54 93% 81% Resume [runnable low prio] thread + 9.40 8.32 18.56 1.14 93% 93% Suspend [runnable] thread + 6.04 5.76 8.96 0.38 93% 93% Yield [only low prio] thread + 5.68 5.12 9.60 0.52 68% 75% Suspend [runnable->not runnable] + 16.10 14.40 35.20 2.39 93% 93% Kill [runnable] thread + 8.54 7.68 16.00 0.94 93% 87% Destroy [dead] thread + 20.20 18.56 40.64 2.55 93% 93% Destroy [runnable] thread + 39.02 36.48 57.28 3.28 87% 87% Resume [high priority] thread + 13.13 12.80 22.08 0.15 78% 20% Thread switch + + 0.59 0.32 1.60 0.09 82% 16% Scheduler lock + 3.67 3.52 5.12 0.17 99% 54% Scheduler unlock [0 threads] + 3.67 3.52 4.80 0.17 99% 53% Scheduler unlock [1 suspended] + 3.67 3.52 4.80 0.17 54% 54% Scheduler unlock [many suspended] + 3.69 3.52 5.12 0.17 99% 50% Scheduler unlock [many low prio] + + 2.41 2.24 5.44 0.25 96% 75% Init mutex + 6.83 6.40 11.84 0.34 75% 90% Lock [unlocked] mutex + 6.74 6.40 13.12 0.40 96% 96% Unlock [locked] mutex + 5.53 5.12 9.60 0.25 84% 12% Trylock [unlocked] mutex + 4.84 4.48 7.36 0.17 78% 15% Trylock [locked] mutex + 0.34 0.00 0.96 0.06 90% 3% Destroy mutex + 56.10 55.68 59.52 0.21 93% 3% Unlock/Lock mutex + + 4.72 4.48 10.24 0.37 96% 96% Create mbox + 0.75 0.64 1.92 0.16 75% 75% Peek [empty] mbox + 6.79 6.40 12.80 0.41 96% 90% Put [first] mbox + 0.46 0.32 1.60 0.19 93% 68% Peek [1 msg] mbox + 6.68 6.40 12.16 0.37 96% 96% Put [second] mbox + 0.50 0.32 1.60 0.20 93% 56% Peek [2 msgs] mbox + 7.13 6.40 14.08 0.49 90% 46% Get [first] mbox + 6.97 6.40 13.44 0.47 84% 78% Get [second] mbox + 6.24 5.76 11.52 0.38 78% 81% Tryput [first] mbox + 5.98 5.44 11.20 0.39 78% 62% Peek item [non-empty] mbox + 6.52 6.08 13.12 0.49 93% 81% Tryget [non-empty] mbox + 5.50 5.12 10.24 0.30 68% 28% Peek item [empty] mbox + 5.76 5.44 10.88 0.32 96% 96% Tryget [empty] mbox + 0.50 0.32 1.60 0.19 96% 53% Waiting to get mbox + 0.50 0.32 1.60 0.19 96% 53% Waiting to put mbox + 7.45 7.04 15.04 0.49 96% 93% Delete mbox + 37.47 36.80 48.64 0.70 96% 96% Put/Get mbox + + 2.49 2.24 6.08 0.28 96% 56% Init semaphore + 5.09 4.80 8.64 0.27 46% 46% Post [0] semaphore + 6.25 5.76 10.88 0.32 93% 3% Wait [1] semaphore + 4.84 4.48 8.32 0.23 68% 25% Trywait [0] semaphore + 4.98 4.80 8.00 0.26 96% 71% Trywait [1] semaphore + 1.66 1.28 3.84 0.20 68% 15% Peek semaphore + 1.24 0.96 3.20 0.17 65% 31% Destroy semaphore + 40.74 40.32 49.28 0.53 96% 96% Post/Wait semaphore + + 2.65 2.24 6.08 0.23 84% 9% Create counter + 0.85 0.64 2.24 0.22 90% 53% Get counter value + 0.68 0.64 1.92 0.08 96% 96% Set counter value + 7.13 6.72 8.64 0.24 78% 18% Tick counter + 1.30 0.96 3.20 0.12 84% 12% Delete counter + + 3.69 3.52 7.68 0.29 96% 84% Create alarm + 8.98 8.32 17.60 0.61 68% 62% Initialize alarm + 0.96 0.64 2.88 0.14 71% 21% Disable alarm + 8.76 8.32 17.60 0.59 96% 87% Enable alarm + 1.99 1.60 5.12 0.21 81% 12% Delete alarm + 7.44 7.36 9.92 0.15 96% 96% Tick counter [1 alarm] + 21.68 21.44 24.64 0.25 96% 53% Tick counter [many alarms] + 10.95 10.56 15.04 0.26 78% 18% Tick & fire counter [1 alarm] + 132.79 132.48 136.32 0.23 59% 37% Tick & fire counters [>1 together] + 25.18 24.96 28.80 0.29 96% 65% Tick & fire counters [>1 separately] + 23.06 22.72 47.36 0.40 98% 98% Alarm latency [0 threads] + 31.53 27.20 56.00 0.63 96% 0% Alarm latency [2 threads] + 36.86 30.40 58.88 4.15 50% 28% Alarm latency [many threads] + + 11.41 8.96 16.32 0.00 Clock/interrupt latency + + 609 603 651 (main stack: 1059) Thread stack used (1704 total) +All done, main stack : stack used 1059 size 5664 +All done : Interrupt stack used 251 size 4096 +All done : Idlethread stack used 587 size 2048 + +Timing complete - 23690 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: Hitachi EDK7708 + + + +Board: Hitachi EDK7708 + +CPU: Hitachi SH3/7708 60MHz + + + +Startup, main stack : stack used 444 size 4112 +Startup : Interrupt stack used 76 size 4096 +Startup : Idlethread stack used 96 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 2 `ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 14.75 microseconds (55 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 16 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 15.43 13.60 24.00 1.29 62% 50% Create thread + 3.33 3.20 4.27 0.18 93% 68% Yield thread [all suspended] + 2.90 2.40 5.33 0.36 81% 62% Suspend [suspended] thread + 2.93 2.67 4.80 0.27 93% 87% Resume thread + 4.30 3.73 10.13 0.73 93% 93% Set priority + 0.65 0.27 2.13 0.28 68% 62% Get priority + 9.72 8.53 21.33 1.45 93% 93% Kill [suspended] thread + 3.33 3.20 4.53 0.20 93% 75% Yield [no other] thread + 5.30 4.80 10.13 0.65 93% 87% Resume [suspended low prio] thread + 2.80 2.40 4.53 0.27 81% 75% Resume [runnable low prio] thread + 4.82 4.00 8.27 0.49 68% 25% Suspend [runnable] thread + 3.32 3.20 4.00 0.16 93% 68% Yield [only low prio] thread + 2.82 2.40 4.27 0.25 81% 12% Suspend [runnable->not runnable] + 9.45 8.53 19.47 1.25 93% 93% Kill [runnable] thread + 5.30 4.53 11.20 0.74 87% 93% Destroy [dead] thread + 11.83 10.67 25.07 1.65 93% 93% Destroy [runnable] thread + 19.53 17.33 31.20 1.88 75% 75% Resume [high priority] thread + 6.70 6.67 11.47 0.07 99% 99% Thread switch + + 0.33 0.27 0.80 0.10 75% 75% Scheduler lock + 1.74 1.60 2.67 0.14 99% 50% Scheduler unlock [0 threads] + 1.72 1.60 3.20 0.14 99% 57% Scheduler unlock [1 suspended] + 1.81 1.60 3.20 0.10 75% 23% Scheduler unlock [many suspended] + 1.86 1.60 3.20 0.02 94% 4% Scheduler unlock [many low prio] + + 1.22 1.07 3.20 0.20 96% 65% Init mutex + 3.21 2.93 5.87 0.17 68% 28% Lock [unlocked] mutex + 3.36 2.93 7.47 0.30 84% 75% Unlock [locked] mutex + 2.83 2.67 5.33 0.22 96% 65% Trylock [unlocked] mutex + 2.53 2.40 2.93 0.14 96% 53% Trylock [locked] mutex + 0.28 0.27 0.80 0.03 96% 96% Destroy mutex + 20.09 19.73 23.20 0.23 84% 12% Unlock/Lock mutex + + 2.38 2.13 4.53 0.17 59% 34% Create mbox + 0.45 0.27 1.33 0.15 56% 40% Peek [empty] mbox + 3.70 3.20 7.20 0.29 84% 59% Put [first] mbox + 0.45 0.27 0.80 0.13 62% 34% Peek [1 msg] mbox + 3.67 3.20 5.60 0.23 81% 6% Put [second] mbox + 0.42 0.27 0.53 0.13 59% 40% Peek [2 msgs] mbox + 3.98 3.47 7.47 0.24 59% 9% Get [first] mbox + 3.97 3.47 4.80 0.24 59% 12% Get [second] mbox + 3.51 3.20 6.67 0.28 56% 78% Tryput [first] mbox + 3.29 2.93 5.60 0.29 59% 65% Peek item [non-empty] mbox + 4.06 3.47 7.20 0.26 68% 3% Tryget [non-empty] mbox + 3.03 2.67 5.33 0.19 93% 3% Peek item [empty] mbox + 3.36 3.20 4.80 0.18 96% 56% Tryget [empty] mbox + 0.57 0.27 1.33 0.09 84% 3% Waiting to get mbox + 0.52 0.27 1.07 0.11 62% 21% Waiting to put mbox + 3.88 3.47 7.47 0.30 78% 65% Delete mbox + 12.04 11.73 17.33 0.33 96% 96% Put/Get mbox + + 1.17 1.07 2.40 0.16 71% 71% Init semaphore + 2.67 2.40 4.27 0.15 62% 25% Post [0] semaphore + 3.00 2.67 4.53 0.17 65% 12% Wait [1] semaphore + 2.54 2.40 4.80 0.20 96% 71% Trywait [0] semaphore + 2.42 2.40 2.93 0.03 96% 96% Trywait [1] semaphore + 0.79 0.53 2.13 0.15 59% 28% Peek semaphore + 0.77 0.53 1.87 0.12 71% 25% Destroy semaphore + 12.64 12.27 17.07 0.28 84% 96% Post/Wait semaphore + + 1.27 1.07 2.93 0.17 53% 43% Create counter + 0.54 0.27 1.33 0.13 59% 21% Get counter value + 0.47 0.27 1.60 0.17 46% 43% Set counter value + 3.47 3.20 4.80 0.16 53% 28% Tick counter + 0.80 0.53 2.13 0.13 62% 25% Delete counter + + 1.86 1.60 4.00 0.21 43% 40% Create alarm + 5.12 4.80 9.07 0.36 93% 75% Initialize alarm + 0.44 0.27 1.33 0.19 87% 53% Disable alarm + 4.77 4.27 9.60 0.35 87% 62% Enable alarm + 1.02 0.80 2.67 0.18 53% 40% Delete alarm + 3.56 3.47 5.33 0.15 84% 84% Tick counter [1 alarm] + 15.04 14.93 16.27 0.16 71% 71% Tick counter [many alarms] + 5.75 5.60 8.00 0.21 96% 68% Tick & fire counter [1 alarm] + 79.60 79.47 81.07 0.17 96% 65% Tick & fire counters [>1 together] + 17.04 16.80 18.93 0.15 65% 31% Tick & fire counters [>1 separately] + 12.44 12.27 29.60 0.31 96% 96% Alarm latency [0 threads] + 14.06 12.27 27.20 0.53 82% 4% Alarm latency [2 threads] + 19.62 17.07 38.40 1.44 57% 34% Alarm latency [many threads] + + 2.79 2.40 6.13 0.00 Clock/interrupt latency + + 376 376 376 (main stack: 764) Thread stack used (992 total) +All done, main stack : stack used 764 size 4112 +All done : Interrupt stack used 176 size 4096 +All done : Idlethread stack used 352 size 2048 + +Timing complete - 23860 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: CQ CqREEK SH3 Evaluation Board (cq7708) + + +Board: CQ CqREEK SH3 Evaluation Board (cq7708) + +CPU: Hitachi SH3/7708 60MHz + +Startup, main stack : stack used 448 size 4112 +Startup : Interrupt stack used 80 size 4096 +Startup : Idlethread stack used 96 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 2 `ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 19.17 microseconds (71 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 20.62 14.40 26.93 3.23 48% 26% Create thread + 3.16 2.93 4.27 0.09 78% 20% Yield thread [all suspended] + 2.91 2.40 5.87 0.17 57% 1% Suspend [suspended] thread + 2.73 2.40 6.40 0.19 64% 15% Resume thread + 4.05 3.73 11.47 0.27 62% 90% Set priority + 0.82 0.27 2.67 0.17 56% 3% Get priority + 9.07 8.53 24.27 0.51 78% 71% Kill [suspended] thread + 3.19 2.93 7.20 0.14 70% 28% Yield [no other] thread + 5.45 4.53 17.87 0.49 78% 17% Resume [suspended low prio] thread + 2.67 2.40 5.07 0.15 56% 28% Resume [runnable low prio] thread + 4.95 4.27 11.47 0.28 82% 14% Suspend [runnable] thread + 3.15 2.93 4.53 0.11 73% 25% Yield [only low prio] thread + 2.82 2.40 5.60 0.21 84% 10% Suspend [runnable->not runnable] + 8.92 8.00 24.27 0.51 84% 14% Kill [runnable] thread + 5.10 4.53 12.00 0.27 59% 39% Destroy [dead] thread + 11.81 10.93 37.33 0.81 87% 95% Destroy [runnable] thread + 22.15 20.80 54.67 1.27 92% 92% Resume [high priority] thread + 6.85 6.67 13.60 0.19 99% 50% Thread switch + + 0.27 0.27 1.07 0.01 99% 99% Scheduler lock + 1.74 1.60 2.67 0.14 99% 50% Scheduler unlock [0 threads] + 1.74 1.60 2.93 0.14 99% 50% Scheduler unlock [1 suspended] + 1.81 1.60 4.27 0.11 72% 26% Scheduler unlock [many suspended] + 1.75 1.60 4.00 0.15 50% 49% Scheduler unlock [many low prio] + + 1.22 1.07 4.27 0.23 96% 78% Init mutex + 3.18 2.93 7.20 0.27 96% 53% Lock [unlocked] mutex + 3.40 3.20 8.00 0.31 96% 96% Unlock [locked] mutex + 2.77 2.40 5.87 0.22 87% 9% Trylock [unlocked] mutex + 2.35 2.13 3.47 0.14 65% 31% Trylock [locked] mutex + 0.78 0.53 2.67 0.14 68% 28% Destroy mutex + 22.80 22.40 28.80 0.51 96% 71% Unlock/Lock mutex + + 2.61 2.40 6.13 0.26 96% 62% Create mbox + 0.52 0.27 1.60 0.19 40% 37% Peek [empty] mbox + 3.54 3.20 7.73 0.35 93% 78% Put [first] mbox + 0.50 0.27 1.60 0.17 46% 37% Peek [1 msg] mbox + 3.62 3.20 6.93 0.34 59% 65% Put [second] mbox + 0.52 0.27 2.13 0.23 31% 43% Peek [2 msgs] mbox + 3.93 3.47 10.13 0.43 65% 65% Get [first] mbox + 3.92 3.47 7.47 0.40 56% 56% Get [second] mbox + 3.37 2.93 6.93 0.36 59% 68% Tryput [first] mbox + 3.30 2.67 6.93 0.38 84% 40% Peek item [non-empty] mbox + 3.93 3.47 9.33 0.44 65% 71% Tryget [non-empty] mbox + 2.94 2.67 6.13 0.25 43% 43% Peek item [empty] mbox + 3.23 2.93 6.67 0.27 56% 84% Tryget [empty] mbox + 0.58 0.27 2.67 0.20 62% 21% Waiting to get mbox + 0.55 0.27 1.87 0.14 62% 21% Waiting to put mbox + 3.82 3.47 9.87 0.39 96% 93% Delete mbox + 13.35 12.80 21.33 0.50 87% 78% Put/Get mbox + + 1.22 1.07 2.93 0.19 96% 59% Init semaphore + 2.42 2.13 4.27 0.12 81% 15% Post [0] semaphore + 2.96 2.67 5.07 0.16 68% 21% Wait [1] semaphore + 2.37 2.13 4.53 0.17 62% 34% Trywait [0] semaphore + 2.29 2.13 3.47 0.17 96% 53% Trywait [1] semaphore + 0.66 0.53 2.13 0.17 96% 68% Peek semaphore + 0.81 0.53 2.93 0.13 75% 21% Destroy semaphore + 14.47 14.13 21.33 0.43 96% 96% Post/Wait semaphore + + 1.44 1.07 3.47 0.29 56% 71% Create counter + 0.62 0.27 1.07 0.14 62% 3% Get counter value + 0.56 0.27 1.60 0.17 50% 25% Set counter value + 3.39 3.20 4.27 0.16 53% 40% Tick counter + 0.83 0.53 1.87 0.14 68% 15% Delete counter + + 2.02 1.87 4.00 0.21 93% 68% Create alarm + 5.06 4.27 11.73 0.46 78% 18% Initialize alarm + 0.73 0.27 2.40 0.22 84% 3% Disable alarm + 4.82 4.27 11.47 0.48 81% 65% Enable alarm + 1.19 0.80 3.47 0.22 87% 9% Delete alarm + 3.63 3.47 5.60 0.20 96% 59% Tick counter [1 alarm] + 15.01 14.93 16.53 0.13 87% 87% Tick counter [many alarms] + 5.50 5.33 8.00 0.22 96% 65% Tick & fire counter [1 alarm] + 74.27 74.13 76.80 0.21 96% 78% Tick & fire counters [>1 together] + 16.90 16.53 19.47 0.23 81% 15% Tick & fire counters [>1 separately] + 16.70 16.53 36.27 0.33 98% 98% Alarm latency [0 threads] + 17.85 16.53 34.40 0.47 73% 0% Alarm latency [2 threads] + 63.26 58.40 80.00 2.64 52% 32% Alarm latency [many threads] + 30.37 29.33 124.80 1.68 98% 97% Alarm -> thread resume latency + + 7.37 5.07 17.87 0.00 Clock/interrupt latency + + 9.00 4.53 26.93 0.00 Clock DSR latency + + 106 0 376 (main stack: 764) Thread stack used (992 total) +All done, main stack : stack used 764 size 4112 +All done : Interrupt stack used 176 size 4096 +All done : Idlethread stack used 352 size 2048 + +Timing complete - 30310 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + +Board: Hitachi HS7729PCI HS7729 SH3 + + +Board: Hitachi HS7729PCI HS7729 SH3 + +CPU: Hitachi SH3/7729 132MHz + + +Startup, main stack : stack used 464 size 4112 +Startup : Interrupt stack used 92 size 4096 +Startup : Idlethread stack used 94 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 3 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 18.10 microseconds (149 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 18.33 15.52 28.24 1.47 53% 28% Create thread + 3.08 2.91 6.79 0.13 78% 89% Yield thread [all suspended] + 3.23 3.03 6.18 0.16 59% 70% Suspend [suspended] thread + 2.70 2.55 6.18 0.15 54% 82% Resume thread + 4.12 4.00 7.52 0.16 96% 81% Set priority + 0.61 0.48 1.33 0.07 57% 28% Get priority + 9.14 8.61 18.91 0.42 85% 57% Kill [suspended] thread + 3.04 2.91 4.48 0.07 68% 20% Yield [no other] thread + 5.12 4.73 7.88 0.29 60% 53% Resume [suspended low prio] thread + 2.54 2.42 3.03 0.09 39% 40% Resume [runnable low prio] thread + 5.00 4.36 9.45 0.21 75% 1% Suspend [runnable] thread + 3.04 2.91 4.61 0.07 65% 21% Yield [only low prio] thread + 2.91 2.79 3.27 0.08 43% 31% Suspend [runnable->not runnable] + 8.82 8.12 15.39 0.36 68% 29% Kill [runnable] thread + 5.07 4.48 12.73 0.37 76% 50% Destroy [dead] thread + 11.17 10.55 22.91 0.52 78% 67% Destroy [runnable] thread + 22.43 21.45 32.73 0.61 81% 50% Resume [high priority] thread + 7.99 7.88 13.58 0.14 98% 86% Thread switch + + 0.37 0.36 1.33 0.02 97% 97% Scheduler lock + 1.74 1.70 2.06 0.06 70% 70% Scheduler unlock [0 threads] + 1.75 1.70 2.06 0.07 92% 64% Scheduler unlock [1 suspended] + 1.71 1.70 2.42 0.03 89% 89% Scheduler unlock [many suspended] + 1.76 1.70 3.64 0.08 96% 64% Scheduler unlock [many low prio] + + 4.23 3.88 10.67 0.41 96% 93% Unlock [locked] mutex + 3.12 2.91 6.91 0.29 96% 87% Trylock [unlocked] mutex + 2.54 2.42 2.91 0.11 18% 46% Trylock [locked] mutex + 0.88 0.73 3.15 0.14 65% 96% Destroy mutex + 22.33 22.06 25.94 0.23 81% 62% Unlock/Lock mutex + + 1.92 1.82 4.73 0.19 96% 93% Create mbox + 0.61 0.48 1.70 0.15 84% 75% Peek [empty] mbox + 4.00 3.64 9.45 0.36 96% 87% Put [first] mbox + 0.30 0.24 0.73 0.09 84% 75% Peek [1 msg] mbox + 3.82 3.64 6.67 0.22 90% 84% Put [second] mbox + 0.32 0.24 1.33 0.12 81% 81% Peek [2 msgs] mbox + 4.19 3.76 9.21 0.34 84% 50% Get [first] mbox + 3.91 3.76 5.21 0.16 84% 75% Get [second] mbox + 3.51 3.27 8.12 0.34 93% 87% Tryput [first] mbox + 3.25 2.91 7.15 0.30 62% 56% Peek item [non-empty] mbox + 3.86 3.52 8.73 0.37 93% 84% Tryget [non-empty] mbox + 2.87 2.79 3.76 0.12 84% 71% Peek item [empty] mbox + 3.15 3.03 4.24 0.10 46% 40% Tryget [empty] mbox + 0.34 0.24 1.33 0.10 43% 46% Waiting to get mbox + 0.36 0.24 1.45 0.09 53% 37% Waiting to put mbox + 4.49 4.24 10.91 0.41 96% 96% Delete mbox + 12.67 12.36 19.52 0.43 96% 96% Put/Get mbox + + 0.87 0.85 1.45 0.05 93% 93% Init semaphore + 2.74 2.55 4.48 0.18 50% 50% Post [0] semaphore + 3.39 3.15 4.24 0.14 78% 50% Wait [1] semaphore + 2.62 2.42 5.33 0.21 96% 65% Trywait [0] semaphore + 2.76 2.67 3.27 0.08 46% 43% Trywait [1] semaphore + 1.09 0.85 2.91 0.19 68% 56% Peek semaphore + 0.97 0.73 3.39 0.17 90% 65% Destroy semaphore + 13.09 12.85 16.12 0.19 84% 65% Post/Wait semaphore + + 1.57 1.45 3.88 0.15 96% 93% Create counter + 0.91 0.73 2.18 0.16 46% 68% Get counter value + 0.55 0.48 0.97 0.09 90% 62% Set counter value + 4.19 4.00 5.82 0.13 84% 75% Tick counter + 0.87 0.73 3.15 0.16 93% 93% Delete counter + + 2.50 2.30 5.21 0.18 81% 90% Create alarm + 6.16 5.70 12.97 0.47 96% 71% Initialize alarm + 0.50 0.36 1.70 0.11 62% 34% Disable alarm + 5.16 4.85 8.73 0.29 78% 78% Enable alarm + 1.18 1.09 2.30 0.12 84% 65% Delete alarm + 5.22 5.09 7.39 0.14 96% 93% Tick counter [1 alarm] + 52.37 52.12 52.73 0.20 37% 56% Tick counter [many alarms] + 6.73 6.55 8.24 0.13 78% 68% Tick & fire counter [1 alarm] + 108.65 108.61 109.21 0.07 87% 87% Tick & fire counters [>1 together] + 54.25 54.06 54.79 0.11 65% 18% Tick & fire counters [>1 separately] + 17.36 17.09 29.82 0.23 82% 57% Alarm latency [0 threads] + 19.75 17.09 28.00 1.65 46% 40% Alarm latency [2 threads] + 39.02 34.06 50.67 2.00 53% 15% Alarm latency [many threads] + 29.31 28.36 105.09 1.27 98% 97% Alarm -> thread resume latency + + 5.08 3.88 11.15 0.00 Clock/interrupt latency + + 7.32 5.09 16.73 0.00 Clock DSR latency + + 6 0 380 (main stack: 820) Thread stack used (992 total) +All done, main stack : stack used 820 size 4112 +All done : Interrupt stack used 196 size 4096 +All done : Idlethread stack used 360 size 2048 + +Timing complete - 29960 ms total +PASS:<Basic timing OK> +EXIT:<done> + + + + + +Board: Hitachi Solution Engine 7751 SH4 (se7751) +Board: Hitachi Solution Engine 7751 SH4 (se7751) + +CPU: Hitachi SH4/7751 162MHz + + +Startup, main stack : stack used 464 size 4112 +Startup : Interrupt stack used 92 size 4096 +Startup : Idlethread stack used 94 size 2048 + + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + + +Reading the hardware clock takes 1 `ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 14.27 microseconds (96 raw clock ticks) + + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 8.06 5.63 12.15 1.37 46% 29% Create thread + 1.15 1.04 5.19 0.15 98% 98% Yield thread [all suspended] + 1.13 0.89 5.04 0.27 89% 62% Suspend [suspended] thread + 1.11 0.89 5.19 0.26 89% 71% Resume thread + 1.45 1.19 3.56 0.23 53% 53% Set priority + 0.21 0.15 1.19 0.10 90% 79% Get priority + 4.15 3.56 13.04 0.53 68% 64% Kill [suspended] thread + 1.12 1.04 3.70 0.12 98% 70% Yield [no other] thread + 1.75 1.33 8.00 0.38 59% 65% Resume [suspended low prio] thread + 1.10 0.89 4.59 0.25 87% 73% Resume [runnable low prio] thread + 1.59 1.33 5.93 0.33 81% 79% Suspend [runnable] thread + 1.13 1.04 4.30 0.13 98% 71% Yield [only low prio] thread + 1.09 0.89 3.56 0.21 89% 70% Suspend [runnable->not runnable] + 4.96 4.30 11.70 0.44 68% 39% Kill [runnable] thread + 1.95 1.48 8.00 0.34 75% 57% Destroy [dead] thread + 4.41 3.85 10.37 0.47 53% 57% Destroy [runnable] thread + 13.15 11.41 23.85 1.11 73% 39% Resume [high priority] thread + 3.10 2.96 6.22 0.11 41% 39% Thread switch + + 0.13 0.00 1.33 0.06 74% 21% Scheduler lock + 0.76 0.74 1.78 0.03 96% 96% Scheduler unlock [0 threads] + 0.76 0.74 1.78 0.03 96% 96% Scheduler unlock [1 suspended] + 0.77 0.74 2.67 0.05 95% 95% Scheduler unlock [many suspended] + 0.76 0.74 2.37 0.04 95% 95% Scheduler unlock [many low prio] + + 0.52 0.15 2.67 0.26 65% 34% Init mutex + 1.23 1.04 5.63 0.32 93% 93% Lock [unlocked] mutex + 1.45 1.19 5.33 0.31 90% 87% Unlock [locked] mutex + 1.13 0.89 4.15 0.28 90% 84% Trylock [unlocked] mutex + 1.00 0.89 2.96 0.17 87% 87% Trylock [locked] mutex + 0.37 0.30 1.78 0.13 90% 84% Destroy mutex + 9.09 8.59 12.59 0.43 71% 71% Unlock/Lock mutex + 0.93 0.59 4.30 0.40 84% 71% Create mbox + 0.26 0.00 1.19 0.17 71% 59% Peek [empty] mbox + 3.03 2.52 6.37 0.47 50% 59% Put [first] mbox + 0.23 0.00 0.74 0.14 68% 15% Peek [1 msg] mbox + 2.93 2.52 4.74 0.46 71% 59% Put [second] mbox + 0.22 0.00 0.59 0.13 68% 15% Peek [2 msgs] mbox + 2.07 1.63 5.93 0.37 84% 59% Get [first] mbox + 2.06 1.63 4.74 0.34 78% 59% Get [second] mbox + 1.48 1.04 5.48 0.37 62% 53% Tryput [first] mbox + 1.31 1.04 4.89 0.32 96% 75% Peek item [non-empty] mbox + 1.47 1.04 5.78 0.38 84% 65% Tryget [non-empty] mbox + 1.15 0.89 3.11 0.18 71% 56% Peek item [empty] mbox + 1.20 1.04 3.85 0.21 93% 84% Tryget [empty] mbox + 0.21 0.00 0.74 0.14 68% 18% Waiting to get mbox + 0.19 0.00 0.44 0.10 43% 15% Waiting to put mbox + 2.19 1.93 5.78 0.27 93% 71% Delete mbox + 10.23 9.93 11.56 0.15 53% 37% Put/Get mbox + + 0.37 0.15 1.33 0.26 71% 71% Init semaphore + 0.98 0.89 2.52 0.13 96% 68% Post [0] semaphore + 1.08 0.89 3.26 0.15 68% 93% Wait [1] semaphore + 0.98 0.89 3.41 0.16 93% 93% Trywait [0] semaphore + 0.73 0.59 1.63 0.07 71% 25% Trywait [1] semaphore + 0.33 0.30 1.33 0.07 93% 93% Peek semaphore + 0.34 0.30 1.78 0.09 96% 96% Destroy semaphore + 9.36 8.74 10.37 0.33 56% 31% Post/Wait semaphore + + 0.54 0.15 3.26 0.23 59% 37% Create counter + 0.13 0.00 0.59 0.07 68% 25% Get counter value + 0.14 0.00 0.59 0.07 68% 25% Set counter value + 3.74 3.56 5.33 0.17 53% 75% Tick counter + 0.32 0.15 2.07 0.12 71% 21% Delete counter + + 1.59 1.19 3.11 0.29 71% 43% Create alarm + 1.89 1.48 6.37 0.44 87% 78% Initialize alarm + 0.20 0.15 0.74 0.09 87% 84% Disable alarm + 1.62 1.33 5.63 0.41 87% 84% Enable alarm + 0.40 0.30 1.33 0.13 87% 62% Delete alarm + + 4.03 3.70 5.78 0.27 68% 56% Tick counter [1 alarm] + 14.18 13.93 15.70 0.27 81% 75% Tick counter [many alarms] + 4.81 4.59 5.93 0.13 81% 15% Tick & fire counter [1 alarm] + 30.77 30.52 33.63 0.20 75% 65% Tick & fire counters [>1 together] + 15.10 14.52 17.04 0.23 71% 3% Tick & fire counters [>1 separately] + 8.78 8.59 18.22 0.20 97% 89% Alarm latency [0 threads] + 11.29 9.33 17.48 1.02 56% 22% Alarm latency [2 threads] + 18.70 15.70 26.37 1.45 54% 22% Alarm latency [many threads] + 19.40 18.81 57.48 0.65 97% 97% Alarm -> thread resume latency + + 4.18 2.81 8.89 0.00 Clock/interrupt latency + + 3.98 2.52 11.56 0.00 Clock DSR latency + + 6 0 380 (main stack: 728) Thread stack used (992 total) +All done, main stack : stack used 728 size 4112 +All done : Interrupt stack used 196 size 4096 +All done : Idlethread stack used 360 size 2048 + +Timing complete - 29790 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + +Board: PC +Board: PC + +CPU: 433MHz Celeron + +Startup, main stack : stack used 124 size 2912 +Startup : Interrupt stack used 280 size 4108 +Startup : Idlethread stack used 62 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 8 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 6.75 microseconds (8 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 64 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 3.93 1.68 8.38 0.93 68% 3% Create thread + 0.71 0.00 3.35 0.84 59% 59% Yield thread [all suspended] + 0.65 0.00 5.03 0.84 64% 64% Suspend [suspended] thread + 0.63 0.00 1.68 0.79 62% 62% Resume thread + 0.76 0.00 1.68 0.83 54% 54% Set priority + 0.39 0.00 1.68 0.60 76% 76% Get priority + 1.34 0.00 6.70 0.67 73% 25% Kill [suspended] thread + 0.68 0.00 1.68 0.81 59% 59% Yield [no other] thread + 0.92 0.00 1.68 0.83 54% 45% Resume [suspended low prio] thread + 0.63 0.00 1.68 0.79 62% 62% Resume [runnable low prio] thread + 0.84 0.00 1.68 0.84 100% 50% Suspend [runnable] thread + 0.73 0.00 1.68 0.82 56% 56% Yield [only low prio] thread + 0.58 0.00 1.68 0.76 65% 65% Suspend [runnable->not runnable] + 1.26 0.00 3.35 0.67 71% 26% Kill [runnable] thread + 0.86 0.00 3.35 0.86 98% 50% Destroy [dead] thread + 1.44 0.00 1.68 0.40 85% 14% Destroy [runnable] thread + 4.45 3.35 6.70 0.89 53% 40% Resume [high priority] thread + 1.62 0.00 1.68 0.10 96% 3% Thread switch + + 0.41 0.00 1.68 0.61 75% 75% Scheduler lock + 0.48 0.00 1.68 0.69 71% 71% Scheduler unlock [0 threads] + 0.59 0.00 1.68 0.76 64% 64% Scheduler unlock [1 suspended] + 0.45 0.00 1.68 0.65 73% 73% Scheduler unlock [many suspended] + 0.45 0.00 1.68 0.65 73% 73% Scheduler unlock [many low prio] + + 0.52 0.00 1.68 0.72 68% 68% Init mutex + 0.79 0.00 5.03 0.93 96% 59% Lock [unlocked] mutex + 0.84 0.00 5.03 0.94 96% 56% Unlock [locked] mutex + 0.63 0.00 1.68 0.79 62% 62% Trylock [unlocked] mutex + 0.52 0.00 1.68 0.72 68% 68% Trylock [locked] mutex + 0.58 0.00 1.68 0.76 65% 65% Destroy mutex + 3.40 3.35 5.03 0.10 96% 96% Unlock/Lock mutex + + 0.99 0.00 1.68 0.81 59% 40% Create mbox + 0.47 0.00 1.68 0.68 71% 71% Peek [empty] mbox + 0.79 0.00 5.03 0.93 96% 59% Put [first] mbox + 0.42 0.00 1.68 0.63 75% 75% Peek [1 msg] mbox + 0.79 0.00 1.68 0.83 53% 53% Put [second] mbox + 0.37 0.00 1.68 0.57 78% 78% Peek [2 msgs] mbox + 0.73 0.00 3.35 0.87 59% 59% Get [first] mbox + 0.73 0.00 1.68 0.82 56% 56% Get [second] mbox + 0.79 0.00 3.35 0.88 56% 56% Tryput [first] mbox + 0.68 0.00 3.35 0.85 62% 62% Peek item [non-empty] mbox + 0.73 0.00 3.35 0.87 59% 59% Tryget [non-empty] mbox + 0.63 0.00 1.68 0.79 62% 62% Peek item [empty] mbox + 0.68 0.00 1.68 0.81 59% 59% Tryget [empty] mbox + 0.26 0.00 1.68 0.44 84% 84% Waiting to get mbox + 0.63 0.00 1.68 0.79 62% 62% Waiting to put mbox + 0.73 0.00 3.35 0.87 59% 59% Delete mbox + 3.25 1.68 3.35 0.20 93% 6% Put/Get mbox + + 0.63 0.00 1.68 0.79 62% 62% Init semaphore + 0.63 0.00 1.68 0.79 62% 62% Post [0] semaphore + 0.63 0.00 1.68 0.79 62% 62% Wait [1] semaphore + 0.52 0.00 1.68 0.72 68% 68% Trywait [0] semaphore + 0.52 0.00 1.68 0.72 68% 68% Trywait [1] semaphore + 0.52 0.00 1.68 0.72 68% 68% Peek semaphore + 0.21 0.00 1.68 0.37 87% 87% Destroy semaphore + 3.30 1.68 3.35 0.10 96% 3% Post/Wait semaphore + + 0.79 0.00 3.35 0.88 56% 56% Create counter + 0.42 0.00 1.68 0.63 75% 75% Get counter value + 0.37 0.00 1.68 0.57 78% 78% Set counter value + 0.73 0.00 1.68 0.82 56% 56% Tick counter + 0.63 0.00 1.68 0.79 62% 62% Delete counter + + 0.89 0.00 3.35 0.89 96% 50% Create alarm + 0.84 0.00 1.68 0.84 100% 50% Initialize alarm + 0.52 0.00 1.68 0.72 68% 68% Disable alarm + 0.89 0.00 3.35 0.89 96% 50% Enable alarm + 0.58 0.00 1.68 0.76 65% 65% Delete alarm + 0.63 0.00 1.68 0.79 62% 62% Tick counter [1 alarm] + 5.03 3.35 6.70 0.10 93% 3% Tick counter [many alarms] + 0.94 0.00 1.68 0.82 56% 43% Tick & fire counter [1 alarm] + 11.16 10.06 11.73 0.76 65% 34% Tick & fire counters [>1 together] + 5.19 5.03 6.70 0.28 90% 90% Tick & fire counters [>1 separately] + 0.01 0.00 1.68 0.03 99% 99% Alarm latency [0 threads] + 0.13 0.00 1.68 0.24 92% 92% Alarm latency [2 threads] + 0.94 0.00 3.35 0.85 53% 45% Alarm latency [many threads] + 1.75 1.68 6.70 0.15 96% 96% Alarm -> thread resume latency + + 41 0 368 (main stack: 1036) Thread stack used (1712 total) +All done, main stack : stack used 1036 size 2912 +All done : Interrupt stack used 368 size 4108 +All done : Idlethread stack used 288 size 2048 + +Timing complete - 28520 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + +Board: NEC V850 Cosmo Evaluation Board +Board: NEC V850 Cosmo Evaluation Board + +CPU: NEC CEB-V850/SA1 17MHz + +Startup, main stack : stack used 552 size 2936 +Startup : Interrupt stack used 120 size 4096 +Startup : Idlethread stack used 206 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 27 `ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 280.04 microseconds (1190 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 7 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 288.71 280.24 297.18 4.84 42% 28% Create thread + 70.76 70.59 70.82 0.10 71% 28% Yield thread [all suspended] + 59.06 59.06 59.06 0.00 100% 100% Suspend [suspended] thread + 60.00 60.00 60.00 0.00 100% 100% Resume thread + 77.38 77.18 77.41 0.06 85% 14% Set priority + 3.13 3.06 3.29 0.10 71% 71% Get priority + 187.46 187.29 187.53 0.10 71% 28% Kill [suspended] thread + 70.76 70.59 70.82 0.10 71% 28% Yield [no other] thread + 104.40 103.29 104.71 0.32 85% 14% Resume [suspended low prio] thread + 59.06 59.06 59.06 0.00 100% 100% Resume [runnable low prio] thread + 97.11 91.06 98.12 1.73 85% 14% Suspend [runnable] thread + 70.76 70.59 70.82 0.10 71% 28% Yield [only low prio] thread + 59.06 59.06 59.06 0.00 100% 100% Suspend [runnable->not runnable] + 187.46 187.29 187.53 0.10 71% 28% Kill [runnable] thread + 95.63 95.29 97.18 0.44 85% 85% Destroy [dead] thread + 241.28 236.94 242.12 1.24 85% 14% Destroy [runnable] thread + 378.55 370.35 427.06 13.86 85% 85% Resume [high priority] thread + 198.77 183.76 452.94 18.77 96% 96% Thread switch + + 2.59 2.59 2.59 0.00 100% 100% Scheduler lock + 41.29 41.18 41.41 0.12 100% 50% Scheduler unlock [0 threads] + 40.82 40.71 40.94 0.12 100% 50% Scheduler unlock [1 suspended] + 41.29 41.18 41.41 0.12 100% 50% Scheduler unlock [many suspended] + 41.29 41.18 41.41 0.12 100% 50% Scheduler unlock [many low prio] + + 17.94 17.88 18.12 0.09 75% 75% Init mutex + 68.71 68.71 68.71 0.00 100% 100% Lock [unlocked] mutex + 72.10 72.00 73.41 0.15 96% 71% Unlock [locked] mutex + 57.88 57.88 57.88 0.00 100% 100% Trylock [unlocked] mutex + 52.24 52.24 52.24 0.00 100% 100% Trylock [locked] mutex + 12.41 12.24 12.47 0.09 75% 25% Destroy mutex + 427.06 427.06 427.06 0.00 100% 100% Unlock/Lock mutex + + + 34.94 34.82 35.06 0.12 100% 50% Create mbox + 0.76 0.71 0.94 0.09 75% 75% Peek [empty] mbox + 75.29 75.29 75.29 0.00 100% 100% Put [first] mbox + 1.24 1.18 1.41 0.09 75% 75% Peek [1 msg] mbox + 75.76 75.76 75.76 0.00 100% 100% Put [second] mbox + 0.76 0.71 0.94 0.09 75% 75% Peek [2 msgs] mbox + 80.12 80.00 80.24 0.12 100% 50% Get [first] mbox + 79.65 79.53 79.76 0.12 100% 50% Get [second] mbox + 70.12 70.12 70.12 0.00 100% 100% Tryput [first] mbox + 65.76 65.65 65.88 0.12 100% 50% Peek item [non-empty] mbox + 78.00 77.88 78.12 0.12 100% 50% Tryget [non-empty] mbox + 63.12 63.06 63.29 0.09 75% 75% Peek item [empty] mbox + 67.82 67.76 68.00 0.09 75% 75% Tryget [empty] mbox + 1.94 1.88 2.12 0.09 75% 75% Waiting to get mbox + 1.47 1.41 1.65 0.09 75% 75% Waiting to put mbox + 75.59 75.53 75.76 0.09 75% 75% Delete mbox + 252.76 252.71 252.94 0.09 75% 75% Put/Get mbox + + 20.24 20.24 20.24 0.00 100% 100% Init semaphore + 54.35 54.35 54.35 0.00 100% 100% Post [0] semaphore + 66.59 66.59 66.59 0.00 100% 100% Wait [1] semaphore + 52.24 52.24 52.24 0.00 100% 100% Trywait [0] semaphore + 53.41 53.41 53.41 0.00 100% 100% Trywait [1] semaphore + 10.65 10.59 10.82 0.09 75% 75% Peek semaphore + 12.65 12.47 12.71 0.09 75% 25% Destroy semaphore + 276.94 276.94 276.94 0.00 100% 100% Post/Wait semaphore + + 14.94 14.82 15.06 0.12 100% 50% Create counter + 2.18 2.12 2.35 0.09 75% 75% Get counter value + 3.06 3.06 3.06 0.00 100% 100% Set counter value + 78.12 78.12 78.12 0.00 100% 100% Tick counter + 13.82 13.65 13.88 0.09 75% 25% Delete counter + + 26.94 26.82 27.06 0.12 100% 50% Create alarm + 104.18 104.00 104.24 0.09 75% 25% Initialize alarm + 7.65 7.53 7.76 0.12 100% 50% Disable alarm + 104.94 104.94 104.94 0.00 100% 100% Enable alarm + 19.47 19.29 19.53 0.09 75% 25% Delete alarm + 88.53 88.47 88.71 0.09 75% 75% Tick counter [1 alarm] + 418.61 411.29 645.41 14.17 96% 96% Tick counter [many alarms] + 139.59 139.53 139.76 0.09 75% 75% Tick & fire counter [1 alarm] + 2150.21 2096.71 2367.53 83.59 78% 78% Tick & fire counters [>1 together] + 478.15 462.35 733.41 29.61 93% 93% Tick & fire counters [>1 separately] + 219.89 218.59 369.88 2.34 99% 99% Alarm latency [0 threads] + 292.11 218.59 371.53 37.85 50% 25% Alarm latency [2 threads] + 292.96 218.59 370.59 38.12 49% 25% Alarm latency [many threads] + 540.90 495.76 1677.41 17.76 98% 0% Alarm -> thread resume latency + + 79.01 78.59 104.71 0.00 Clock/interrupt latency + + 123.41 85.88 1982.82 0.00 Clock DSR latency + + 522 516 536 (main stack: 1124) Thread stack used (1912 total) +All done, main stack : stack used 1124 size 2936 +All done : Interrupt stack used 288 size 4096 +All done : Idlethread stack used 488 size 2048 + +Timing complete - 32540 ms total + + + + +Board: NEC V850 Cosmo Evaluation Board +Board: NEC V850 Cosmo Evaluation Board + +CPU: NEC CEB-V850/SB1 16MHz (in internal Flash) + + +Startup, main stack : stack used 572 size 2936 +Startup : Interrupt stack used 132 size 4096 +Startup : Idlethread stack used 210 size 2048 + +eCos Kernel Timings +Notes: all times are in microseconds (.000001) unless otherwise stated + +Reading the hardware clock takes 8 'ticks' overhead +... this value will be factored out of all other measurements +Clock interrupt took 118.15 microseconds (472 raw clock ticks) + +Testing parameters: + Clock samples: 32 + Threads: 7 + Thread switches: 128 + Mutexes: 32 + Mailboxes: 32 + Semaphores: 32 + Scheduler operations: 128 + Counters: 32 + Alarms: 32 + + + Confidence + Ave Min Max Var Ave Min Function + ====== ====== ====== ====== ========== ======== + 113.68 111.00 116.50 1.63 42% 28% Create thread + 30.00 30.00 30.00 0.00 100% 100% Yield thread [all suspended] + 29.57 29.50 29.75 0.10 71% 71% Suspend [suspended] thread + 27.43 27.25 27.50 0.10 71% 28% Resume thread + 34.11 34.00 34.25 0.12 57% 57% Set priority + 1.57 1.50 1.75 0.10 71% 71% Get priority + 72.96 72.75 73.00 0.06 85% 14% Kill [suspended] thread + 30.00 30.00 30.00 0.00 100% 100% Yield [no other] thread + 42.75 42.75 42.75 0.00 100% 100% Resume [suspended low prio] thread + 27.00 27.00 27.00 0.00 100% 100% Resume [runnable low prio] thread + 43.64 41.25 44.25 0.68 85% 14% Suspend [runnable] thread + 30.00 30.00 30.00 0.00 100% 100% Yield [only low prio] thread + 29.57 29.50 29.75 0.10 71% 71% Suspend [runnable->not runnable] + 72.93 72.75 73.00 0.10 71% 28% Kill [runnable] thread + 44.89 44.75 45.75 0.24 85% 85% Destroy [dead] thread + 103.00 101.50 103.25 0.43 85% 14% Destroy [runnable] thread + 175.21 171.50 197.50 6.37 85% 85% Resume [high priority] thread + 84.11 79.50 197.25 1.77 98% 0% Thread switch + + 1.00 1.00 1.00 0.00 100% 100% Scheduler lock + 20.06 20.00 20.25 0.09 75% 75% Scheduler unlock [0 threads] + 20.00 20.00 20.00 0.00 100% 100% Scheduler unlock [1 suspended] + 20.06 20.00 20.25 0.09 75% 75% Scheduler unlock [many suspended] + 20.06 20.00 20.25 0.09 75% 75% Scheduler unlock [many low prio] + + 4.00 4.00 4.00 0.00 100% 100% Init mutex + 33.00 33.00 33.00 0.00 100% 100% Lock [unlocked] mutex + 36.77 36.75 37.25 0.03 96% 96% Unlock [locked] mutex + 28.13 28.00 28.25 0.13 100% 50% Trylock [unlocked] mutex + 25.13 25.00 25.25 0.13 100% 50% Trylock [locked] mutex + 4.88 4.75 5.00 0.13 100% 50% Destroy mutex + 187.00 187.00 187.00 0.00 100% 100% Unlock/Lock mutex + + 10.00 10.00 10.00 0.00 100% 100% Create mbox + 0.69 0.50 0.75 0.09 75% 25% Peek [empty] mbox + 34.75 34.75 34.75 0.00 100% 100% Put [first] mbox + 0.69 0.50 0.75 0.09 75% 25% Peek [1 msg] mbox + 35.00 35.00 35.00 0.00 100% 100% Put [second] mbox + 0.69 0.50 0.75 0.09 75% 25% Peek [2 msgs] mbox + 36.00 36.00 36.00 0.00 100% 100% Get [first] mbox + 36.00 36.00 36.00 0.00 100% 100% Get [second] mbox + 31.00 31.00 31.00 0.00 100% 100% Tryput [first] mbox + 29.50 29.50 29.50 0.00 100% 100% Peek item [non-empty] mbox + 35.25 35.25 35.25 0.00 100% 100% Tryget [non-empty] mbox + 27.69 27.50 27.75 0.09 75% 25% Peek item [empty] mbox + 31.06 31.00 31.25 0.09 75% 75% Tryget [empty] mbox + 0.94 0.75 1.00 0.09 75% 25% Waiting to get mbox + 0.94 0.75 1.00 0.09 75% 25% Waiting to put mbox + 37.81 37.75 38.00 0.09 75% 75% Delete mbox + 112.00 112.00 112.00 0.00 100% 100% Put/Get mbox + + 3.19 3.00 3.25 0.09 75% 25% Init semaphore + 25.38 25.25 25.50 0.13 100% 50% Post [0] semaphore + 32.63 32.50 32.75 0.13 100% 50% Wait [1] semaphore + 24.25 24.25 24.25 0.00 100% 100% Trywait [0] semaphore + 25.00 25.00 25.00 0.00 100% 100% Trywait [1] semaphore + 4.00 4.00 4.00 0.00 100% 100% Peek semaphore + 4.88 4.75 5.00 0.13 100% 50% Destroy semaphore + 124.50 124.50 124.50 0.00 100% 100% Post/Wait semaphore + + 6.50 6.50 6.50 0.00 100% 100% Create counter + 1.25 1.25 1.25 0.00 100% 100% Get counter value + 1.44 1.25 1.50 0.09 75% 25% Set counter value + 36.25 36.25 36.25 0.00 100% 100% Tick counter + 5.25 5.25 5.25 0.00 100% 100% Delete counter + + 12.25 12.25 12.25 0.00 100% 100% Create alarm + 49.13 49.00 49.25 0.13 100% 50% Initialize alarm + 2.81 2.75 3.00 0.09 75% 75% Disable alarm + 48.50 48.50 48.50 0.00 100% 100% Enable alarm + 8.25 8.25 8.25 0.00 100% 100% Delete alarm + 46.50 46.50 46.50 0.00 100% 100% Tick counter [1 alarm] + 485.42 482.25 580.00 5.91 96% 96% Tick counter [many alarms] + 64.00 64.00 64.00 0.00 100% 100% Tick & fire counter [1 alarm] + 1109.76 1100.50 1198.00 16.53 90% 90% Tick & fire counters [>1 together] + 505.85 502.00 621.00 7.20 96% 96% Tick & fire counters [>1 separately] + 96.26 95.75 161.25 1.02 99% 99% Alarm latency [0 threads] + 159.20 95.75 160.75 2.52 97% 0% Alarm latency [2 threads] + 159.73 110.50 161.75 1.53 97% 0% Alarm latency [many threads] + 218.45 211.25 445.75 3.55 97% 1% Alarm -> thread resume latency + + 28.24 25.25 43.25 0.00 Clock/interrupt latency + + 60.15 40.50 221.50 0.00 Clock DSR latency + + 472 424 572 (main stack: 1052) Thread stack used (1912 total) +All done, main stack : stack used 1052 size 2936 +All done : Interrupt stack used 280 size 4096 +All done : Idlethread stack used 516 size 2048 + +Timing complete - 30590 ms total + +PASS:<Basic timing OK> +EXIT:<done> + + + + + + + Version 2, June 1991 + + 1989 + 1991 + Free Software Foundation, Inc. + +
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+GNU General Public License + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library General +Public License instead of this License. + +
+ + + Revision 1.2 + + The eCos Copyright Assignment Form +
+ Rationale + + This preamble describes how to use the standard eCos copyright assignment +form. The rationale behind this assignment is to avoid any possible confusion +over the legal ownership of eCos, and to indemnify Red Hat and all eCos users +against copyright or patent claims on contributed code used within eCos. +Red Hat would be especially vulnerable, but all users and their eCos based +applications could be affected. + + In virtually all cases, all contributions to eCos for which there are +copyright assignments will be made available publically covered by the +GNU General Public License +plus an exception permitting linking eCos with proprietary code in order to make +the license more appropriate for embedded systems. The license provides a +guarantee that the contribution will remain freely available to all. + + This agreement gives Red Hat ownership of your changes but promises that +you will retain the right to use your contributed changes as you see fit. For convenience, +signing this agreement allows you to make further changes and additions and contribute +them as well if you so desire, without the necessity of signing a separate agreement. +There is however no requirement for you to do so. + + + Because employers often can claim ownership over things that employees +write, you may also have to get your employer to sign a disclaimer that says that +they have no claim to the changes you are contributing. + + Please read everything, and if you have any questions, email +ecos-assign@redhat.com for help. + + Thanks for your contribution to eCos! +
+ + +
+
+
diff --git a/doc/sgml/tutorials/makefile b/doc/sgml/tutorials/makefile new file mode 100644 --- /dev/null +++ b/doc/sgml/tutorials/makefile @@ -0,0 +1,55 @@ +#============================================================================= +# +# makefile +# +# For building the eCos RedBoot docs +# +#============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license/ +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +#============================================================================= +#####DESCRIPTIONBEGIN#### +# +# Author(s): bartv, jlarmour +# Date: 2001-01-11 +#####DESCRIPTIONEND#### +#============================================================================= + +TOPLEVEL := ../../../ecc +MAIN_SGML := ecos-tutorial.sgml +MAIN_HTML := ecos-tutorial.html +MAIN_PDF := +OTHER_SGML := +PICTURES := + +include $(TOPLEVEL)/pkgconf/rules.doc diff --git a/doc/sgml/tutorials/pix/ARMStartup01.gif b/doc/sgml/tutorials/pix/ARMStartup01.gif new file mode 100644 index 0000000000000000000000000000000000000000..9682e8c35f11826531643abef50a6b25683c2c14 GIT binary patch literal 10936 zc%1FmQ+FH;7bxJEjm^f5(b%@Fnb@|I#ztdJY}@uk)1 zySxAX%l`LY{D1%7|MOV?SO5R(1sD`43@RhBLUZv*1PUHA0Nh+M7K2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1+AC`otg!`iG?FqD7+ukf-%{GsnCMC z(Sl{rf)!%H7IH{+WAPc&h#bQo*!VgILM(q02tfb37h8F&(#>9lcSd=_gwshaMYdS-%$_8=qt-=n0zK zSertRO>L}O1&#%2t>PJvbFoiye#hsy9k2P>V27P>g(cZ%**FZ^IA)!c4O^Mr*tkMZ z3e2r-Fwrd@8L}IAz0_>0@?oqA(XG^CeFl@7+-!^|tpgivgP@Jp!I0w#P8c_+Z77nR zJLRcAq=i1IB;v++%*ocn#Cp)c#^2>ceEP($@ywyq&S}yvo&m3H|0EP@_dPl{jKMB~ z@l?rrA(DX!)7q}t&lU#zWSjAMVK< zh~#pCNs`5WCe8OLz58ZE?c~JddMnxG&tPV9qsw1C;v4qMt7zhKIrMC`V|GdlhCmYAJiPe>4tt= b91-e0KBm92=P>u|Z diff --git a/doc/sgml/tutorials/pix/ARMstartup.gif b/doc/sgml/tutorials/pix/ARMstartup.gif new file mode 100644 index 0000000000000000000000000000000000000000..c514649d2bd81d6c4baa1245b37c9dfbce34d7a2 GIT binary patch literal 37071 zc%0RJeQ*@lwdb9lo>6NUiIy1Qu~0}$7RrEx-++)K=kfAdLJ*m?-;TXxR;Ywl$V4k! zaaQ(oc-ptA+8Ie;jO|2D%r2r*TLb28@z(kPBDQ3sKSmfFLgZbUic2Y1{t(W(ikFJ3 z;1oGmP{1p``QMk6!&m@&?b1!fr7Fg6Ws!OKwFz<%(rud#8wv2mfX z(ZFuuUwwUzedCRN3ypmSjskuh?`s?%ZyaA}95--KP44eV>1WiL*@Unpu!hgfxcwgT_U!Q^VgKptp%&)(90o1|&ae+#!a*CjCOD2hY#5t1aEY*XANGTP2CNtm66Ocp!oL;_!ys-jXuS|bB=Prs+)bQ5OlF`Ae&s zp^%h3vc#fe>7=}_a+iWbF7io=oYE2_evhO^)E+JAEiRX17klQDOpzkZDog89QF%lE zigs-@@X*e0-(9J`exm#<&rI}xaZYDNo+ss$n$}r~CnP5>K^H6}84+c!o2X4ra~R~ zv-kCED?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(lq@W*RN8o!{d2t>Ro+jK=xG4 zNSdp^#8~BSh{VTNhQav%(@b6g{SeP~-OCLx^cG8jdOP9zjj&m&T(Ea6TzYRGN&(-b zhzOI5RqQ^)>1lffzcE7xLz%D^Y(l65H-d^EmHrbk1DebD&FI_Rv5!$I zVg8T!?62caasGLpevNv1IG(7vdu_MrIW46x(LTa_u~H`^W7sQ1+c`Ip$50=6lxnYumnNplwH9}&+P>-%f#bgE_5TglwMGF0H(bU*$6%=+n)nVoK@eVt$3 zdmTR>n=F(Fcj@h){y^Jvvg(P;=YRI2$iMj?T|c}04?q8}(PwY{_=!gG5!%(=8^7(} Pv6ipzJ$oa;{__6;aZ0fu diff --git a/doc/sgml/tutorials/pix/MNstart.gif b/doc/sgml/tutorials/pix/MNstart.gif new file mode 100644 index 0000000000000000000000000000000000000000..bcd2491539dfd8bed07ca3d204ca1972e960541f GIT binary patch literal 14585 zc$@+GI0nZ@Nk%w1VWa_70rVUI000000Dk~~0A>IHW`6)?W@cu8e|L9x006%L0RNc) z0GWRPnSX!(009600RR6#|Nno8h=`f0zpARLySuxY)W6KCzs%IX|Np)tdtG;lYvT_Z#^v%uqZvQ|XESA0Qjhni%cd!K|rf~AapqMfUupmmRmfND8hS}vHFd9_}-Ja(3|v$(fI#K&Bc z!@Gu=zQ4RKR=j|HY{$M{JJHO|%1+mA%&gQ|;+M4D)!D{*y4AZTkfyfo)c4!@?92SW z!lUWR;p+!YACzeZ?df|ar5C=0{2Jog*DKdRiw+kCtLQJ|7KL;?`sqyZWUv?LkaTaOHwmQ(q!1qrm~Ygatf1ZQ|7*BQD%xXda)cZB}9*g(i0TvP@z95 z)?`{!SFZsI9?dJ^@}JYIQk!mFD2bERqg>I7{5f}|RFxX@rd=h_WZa_8?!I-33ZPxI z|FWvpy0dRC69ZV1Ffrz)+_gaU`keUGRn*0f>snoEl3=vU5k))B{0=loPmCM0mBlgc z!9=cQw^phTvgFBSd8UKc%o|*6i31)^X?7yi;t+2G49~&ldp2xrfP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s0;G|=kTcEXYy`}V<}P$=#*!oN0MX^7R+`u jiok?a)R(QZI;%66VACNM$&T4n0)IJ3u$Gt{5CQ-@%;9sv diff --git a/doc/sgml/tutorials/pix/TXstart.gif b/doc/sgml/tutorials/pix/TXstart.gif new file mode 100644 index 0000000000000000000000000000000000000000..34b014f4b40d6d357f12afa420673b4e1b9cdfee GIT binary patch literal 14471 zc$@);IC#fLNk%w1VWa_50rVRH000000Dk~~0A>IHW`6)?W@cu8e|L9x0094)005bP z0GWS({{R60{{a90KmY%Kh=_=ps=unLs=K?pnbg0`s=v(CzyJTg%*@Qp|Nrjp?*IS) z000000000000000A^8LV000~SA^s8|Lvm$dbY)~9VtF7*ZER^`3IHqs0001_0aF10 z1^!?ljsai-WU8)g>%MR-&vb3yc&_h!@Bcs=fWbhuHppZ!fb=DsE2!uxUB0LrX140$ zQmsd27{;ZQRbO!QiA&F#XWy{c%}(vh_}hN2O7&`5EPy0_c!WPtdU1#`gnxKfVm6SJ zhmn$jBPT|Kmtc)`BV~r8n3|@ZGNq_!r)#P_kFSojwL77%V4QoYcZzJkmwa2m#)4j- zf_J{i#=~&W!jsL+(!b55#nW11z}P8$-rLUP!ETd=->#6vq35r`-MZ}V$Is@)_9Szi zWaz|}MYFbTpul{~vc-e8?wi9?0}YxQ=ZxUNY8D?B3@CA;vWOf*65M!^S;cT7{&V^2 zXc8n!deKOpG{`bxzZL!zPD9x6Q_qXZFs_6ca3;BKE`t`@2=8UWR5W=Ooz+riRG?Ea z;X69iWF4(vv{i-W^y)*4Cz0X-FdzXh5kqn&T-TNES*&Pvk`;^BXhyD2D~em{6{=LU zmB!$`Yqsc9x`oF^UIiAWGQwpK`(^BS&Hy4t=Fq`hvhiQPX{kw8#g}twl1dFPjwJC| zUyw4p&YtJ`Y^l4O0pCh}IJW8Fe-YXw@_BR#=X#NH6E;zD)5&T{=T+FQHXE1Pjke32 zj`sJg;})tz&-v#(%<=$^zY)Lwe3a#X_Dt`65?i+k48V(AHK>$>fuPv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%2e;x=9xVlY3U#()mkc;~^p}^xXmFO(0`#9}I>2#%bl^WA=%@!h z`T>9d5rF=ue+4Lj2grX2IDiYNfCyL+jRt8Ecui(QfzkkemJ?EO^=pyuSQ~E@Y!(%KfUpGFw}zU~S7illTD1NF3m{lz_hUk5dbyK7 zRCFGEqGBeohiV{H*V1jnMH+H=S<%LNo`rIL_bDRMDfPt&dWc3)uzk-4SPvqICsA{( zwFcfnU?Bo@nBpn0cwmSp2m1qGqt#s`sD8cZh$8TY2V??JU;v*KG|iADSXU%}r#peC za$%=RkC+J~7BLw2JAW8hl!te%2wUB#cV5>(`yzZU=YhOeWW0!uC76q>aVMD=eZNCt zln94wFnexbdr)|BZvr2ompdh=DGE1NS6GG8Xai1mhYd1r))S1t2muRV01oMpToef# z1^{(bN(8wir3hgcctq_zYaak@vSePym4j22ipp6j6;Dlu~4Y1RESs>Fq)j z-RMCpqf;1S8Z#If2`Y$CLjx(mfi{+h-L33Nu&S%3N?GfSEOv2<3JVvT)m=T+3Muyv zYr1A?WR4y!vDBq0DU_qZq|MT_6b0F2Xk&R;5tQ7~|W=}%Cn2oePuXQ$()^E_dx7J0q zZl-k=E#I}A)$&fu9WDJ@3biz7vDD(BwMh$0t6P8bf5u_O?e9+y-yiY({_y`|{}MmW wF5aEv`gn4-!`0n(eZ+ouvVGis9#-jY`+7WmvcvoPUspJN`t0({iw$r706IH=(*OVf diff --git a/doc/sgml/tutorials/pix/botclear.gif b/doc/sgml/tutorials/pix/botclear.gif new file mode 100644 index 0000000000000000000000000000000000000000..0b907f94585297d0f8b40d04c8459a9db4a0b857 GIT binary patch literal 194 zc$@*k06qUlNk%w1VE_aW0FeLy|NsA#t=<3t00000EC2ui000CK06+qpjE||y?GK}z zwAzca-n{z{hT=$;=82~2%C_zc$MQ_q_KoNI&iDQg3<`(DqVb4KDwoWr^9hYgr_`$T zip^@b+^+Wv4vWX+viXcotJmzd`wfrF=k&V$j?e4&{J#GW7$`VMSZH{Nn5ekO*y#8O w87VnQS!sERnW?$S+3EQS8Y((UT55WVnyR|W+UoiW8!J0YTWfoZD^>siI~0Io=>Px# diff --git a/doc/sgml/tutorials/pix/build-dialog.gif b/doc/sgml/tutorials/pix/build-dialog.gif new file mode 100644 index 0000000000000000000000000000000000000000..755865508a37f344c3ff15d870a5643ae6416d52 GIT binary patch literal 6702 zc$@()8qwuPNk%v~VVwby0P+9;0001YcXx=0h`YPH%*@RH|Nj60e*gdgEC2ui0G$Dm z000C2IJ(^aFv>}*y*TU5yZ>M)j-&$&MXIiB>%MR-&vb3yc&_h!@BhG{aJUkj3WPy& zscbTz&M0&$tx~VnEOx8ya=+d%cq}fH&*n6Gt!}fagTQfMsN3)OynfH``~QG}f`f#G zhKGoWii?bmj*kWdMksWUmY0~Bnwy-Ro}ZYKbD*T9rl+W>s-!jmb#bGsva__cwzroB z6>_hWx_2vdFO6-KXely<`g(T>x}*4NnCxe5dTCrjQ6ypg_@(gm2o+UxA? z?s~cl;RE4G%#qH&b=A-+`{?KX@e>G8;Jbqe6VlR^M1i+?3hs$|)^A|IXu~iT{Kx+B z;zoraLy8o(pdmzYuJFaeGmQm7g8Vf08%eXK%|r3zJ#;c|qCS=YWu6lX&*jXUNRukv z=VTtlp83oPCE7CR#%dYSSzOAsYrCBDlGKwJ6_~$@Rn5k{YW1Vnw{WlJl+d$W+`D-5 z`eB$w3DlK(0}F;*Ab(eMq@7>yA*4o15QnfC~>!e7N!A$d4;e&U|?q22o}2o=&~G z_3PMIGwIDhw)c|YeT#20{(JfGRRkk$s3M3f zrpV%pF2+b=i!;Jlql`3OxZoUpW#{9MKn5vfZA_eqqI1n9iR6+>Hp%3ZPDTmkZw&ZC z0297RH{_OFcIoAp4K!rrcsG`rqm5_ch~}DVwrM7tZ@QT#nFMebCY*ETiRYej@)_r! zdiE(Op!uN}U4z{bI%uGZHp=LuenL8-Wt3KG>7|%vnkjf%5-?_oV1_E{sHg!z#HlpY zb7w=nHKe6OlqClM7_ln9&kt-IvN-^uMy%qLUXZN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vlNz>@din3cN0Dn4&u^jcvYb?#LpO zEOX2>hio&eY^wUm94fWJgS55WRR%ea% z)>?PXwR=U+SM+*cd%d2~XOAtmdikC0wuNxVEfx3Nbk}Y7-FWA%_uhQ>?f2h+_niO$ EJDx~zqW}N^ diff --git a/doc/sgml/tutorials/pix/build-lib.gif b/doc/sgml/tutorials/pix/build-lib.gif new file mode 100644 index 0000000000000000000000000000000000000000..2bec1e81597f3f496f98834ece59f5bcb3d8f79c GIT binary patch literal 2784 zc%1Fii9Ztz1Hkdg5z&(?SMqp>j3LRG>!HVH;DPp zpZ@=O0l<3-;N+Et*A=x#^NJ`tGwX^w;sxcErHv@BJ|s(M`c5z@C0*&Veno>Wn#aU+^D=3*|cd`#_6zbwli*@ChhpLa-r>6`>cNoI1tgF-em|yAu3k-v%b-(0y@{G+iLiQ zHz%4Kmc~6H>4yG#RC7AzKK}*7N8rsNs*NU0RSbfjx)Rx_sI33zdS6feE@^USGjO1% z_%yxLB41^3CA(I;RYEdo`NJgSP3@%XkHZ3ijr88iwmGNvg;vZ6`bU|GY}opKj_|W1 z;PSMUfZE=4%uOg>Fjj(L@-9vqyF3#w8wY;}xRiBQE?$xJWHv#if;pS4NayuPzQID4 zB&T%!?`t*rkp+z_BVr_bhm^i9K_+wEm3EZHF_pn7w z6r364scsmwRYsw@9KQ>eugEo2SEFZfDuw;mKRPxK!6!z=x$#H2 zMHJoQH4V5El!|VC)P)%XF4l`$_afVk>7ued zl!_GcyXI=MU6#<;#75*bwhj!K7ErY_1v$v`b>rxu(;sqO*ZvDoauU-`C& z*&6#N6I0RJ1*3Bh>l5vQgH*gAu@7?(Bo?&M&*P+b`8L&>m)8+2 z;;e76+DS<2*{$RKM>*<4Yania!_Q2Ww$tzMOXq(6$kem^c@nF+YIyqNX~pxc6aMLs zP25Ht2kI8v*NZp?UmKljTno>fapmkcr7vi~qC`;LoQMZ+1i0PStwd*#z3}FDIaSQ|-lqyF3&* zDUB$k>UsvDrcOl7ee`k$!B*m zI~V|pcP%M%*YfPq zz+39Q)SVRVO97BW0+f4{fr))6SB+fi=~pkq@f9*TFs5*yxCEY~TIq8PCmGKsK+Y$! z+^zhJITVIKLP@0wi&yYs8)GJ#1XJxGd(@>9B{-GOCes!3;ulM@`JJ9mxR$-LYpG-l zKdKq%%N|Lmk8Bmvax05quWzmEVfH+fnIXK7;uc)BvGdR=R70p+wl3LaRt%HnM#y26 z7qHip2KN%T{v))pY7V<&keQSnH!k0|XZzX!%+R>Prt~eAYTv0lw^LJaf1@`Ke*wfV``Yow+(q1mGX>qx>D3CFoUz zx^_C0fYz*XUkJiC_MdETf34YyNBUc3m1YAVUP?`Rcah(}Liy z-|AB)c0!xqf>~+3yYyRLN_h}6lBfQ0z5rBiZu8wiS)pVOk#P3=VW%z!!E37ALwx9K zR~*foDAHP8t3mh>@eBhL%13&=|2zy3}IIS*Bq zdN3w_->qUz(HUIpP3LE!OV8@dvOLwF(n;3&o~rIs*&`74Wz>CWYTLa#P2Dz&0rlgR zeumbuqjfyaT#f$Iy~nvXS)0L99VfmshC%`MVU?v9!+peGICbJ&8`qRleU$q4*oUk} M`nT$>2mnCuZ&vQ{-~a#s diff --git a/doc/sgml/tutorials/pix/build-lib01.gif b/doc/sgml/tutorials/pix/build-lib01.gif new file mode 100644 index 0000000000000000000000000000000000000000..ea9ac9291ddd6febc0344c3e63d9ecd2591c3835 GIT binary patch literal 3147 zc%1FihdUGw1Hkc12u1d4SRr@WbR0z}d;DxdvhO0!rs$BpIqPutzRTwAtV;Gyi0hEU zS(%5d^FBTAfAK!Q&)@LJ0>W*d>(#g}RFYbxwmWBQ7 zXDN=L=2wrqt=&*Mka9z*+Ge1kY$%IE1)ZnexQswb`E2|gNG}^ksY2(sw3{j?id7go4#rL4K`yU_>f|vLW5R*Md@Hkb1Wiqj&{C8a-{9d~(B5co z%AFd65r{Z`FhVwBzTKYeo>}0r@ZpYm{d$JeNStp6N@0^aoGsoC{ib#BKPbPM@<$h~ z2H$%dHAAs`2V1L!Arw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bjn$=YDWzY^Zese9S4yU1dZr}Vq-iQy zC(5R)7p8A&9&Re9lV_%NI;VJAk!z}_(MYF#ns;#usB>|kgBoXdYN&+zr-^EHe9EYw zwWyDpbb>0WV^OG;ie-q3sg@e4o4Rt2>ZyX(siEp|luD|2F{-CJahj^CsM@N|2&%8j zTB$0l{${GR`V^Ont0cy%yPB)C>Z|7#tHGKSx=O4NcB{vldcdlz)z+)cx~$Mzio+_c zxy7v2>TAi0t%h-}+Zt=n>aE-wu8l~o<60BOYOdg=t?4?4-O8?+2CnbguJVe9lwgtFkN0vMuYfFAK9VE3-38vo-4+0RaFzE9S~6 diff --git a/doc/sgml/tutorials/pix/build-processalt.gif b/doc/sgml/tutorials/pix/build-processalt.gif new file mode 100644 index 0000000000000000000000000000000000000000..ed375a9ca3daa2be6097d4dd52baf7c0aa4dc076 GIT binary patch literal 29833 zc%03BZE#%Ib=ZAx-!9%Ru#1NU2tptPyD4b{y+agxb`{lj#k z7IN}~(?750ocr`d-!p>pG{A*=~Xtp!KOWIyV}oIr`hT%Tisx* z9(LX6XB*ROW0h@euniAJVqQP5cwr521jMtJD3ftNp7R{i_}V1#LH``!`nmH#Yh=Jb)3p_IuO)-fF+M z(eHT(GOhuD1}Fh64_AOQ!O$=kboOvT_&5Apou1y9p7wBkFfIJGx;nkOF}>>HasdkX zxUo9Du`#{j!Ri4hXglq#PJ0{Eo`=XlWI=C02dv*i+~AU6FaR2$^bl1zF^mmE!&n|- z4nM=+@NZ*v)k8$W`e0i4Yhz<|!vnm+asdkXxaw`JdLE(~cV!yeBBDLSI^u2`yCOO~ z+yq?VG>(Kod$=bE$21O%LwmSI*m@f0!G9j?7$6eX2h+k|8=mLUY4B*jJ=#%^_ROPQ z@d)o8Vb&wud4wI0*6+~@Jz9fDPBaemPf5U{`dc*f40Z2$2&%EtleI)n-5RC zcVqqTCFk*HUmJb<>L31kTmKjS?7g>N|D&(FBVX&7w=HVB<|NGzk@$Zej{_Jl( z`_3DG{O0&~zVPSYf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!| zG@59WK*&D$M$tk$d9I(JXzCE6-oGnkea+pHc1E&ebApzKECm? zqoIfD7c87uoQ%fosy^#odP5EjR9(+D@6KWu7)q3%c9mS3=su7Xw}Um~_$j0=c#}^- zVbeda_#iG#*;VLVeWeWnj9qJ8jl4f$T`2x=Wa-nxhrTk#t}vZpdw#mtm)SAB4e!xq zmehvt{1jgzM0hUb;K@HSThW6}b5|Q5wTx1K21j9r8DvE38g=>|j5IuXt*nhlgWE;I zXR*UA;bWP4T~g{)FODwWaZVb>xJm{LY^!gWj=u`%f{8|q z8hGq+*8_XM&*pG}C?~I_s=A#~&*pEpkF6UYh5AMl)blQ;*N^uBj|TToH}QJvUS@&^ zCWFt6JVI3#c$kzY&IWovw+Ajb%IS@LuYi9hX4yN3s(qc2J*W~P{d8|tYrCxRqf+Fg zlMQh&YQw*jF$ZbqrudbnYCPMOJCnt46b-r zz^u3Hlp1@3ZQi{LpKI^DLR!z~cQrmw`Vod$S#5(XCqRNSA}AA62$9vre8M4hOkz4d z$B&Ac{cRtmG2s!q5@s-e^fvVP*D1F7RN!&ua*&0>Yrt)~4VQ!IWh z=Ty1V<#$upE42ES{3-0}Z%osT>GkmkY2DU~>HhkUd^)<`KK|%WbqaeO<)x(!Ri-*{ z=>@XazU8Hb2&6k$+PmtEhx&|LH;o26n}%(VBh>SPC+mZxCW2%RgXC@od-yp$cp0Je eE<%~rN=ru{I1!<77@>LdgVsxNW=>83K<&RcBHXY5 diff --git a/doc/sgml/tutorials/pix/build-tools.gif b/doc/sgml/tutorials/pix/build-tools.gif new file mode 100644 index 0000000000000000000000000000000000000000..9b4b43deca197bb519302c3e52ee1c63414711e2 GIT binary patch literal 4312 zc$^(p2{csg8^3)LpEhko;Z~MxX&r;|zZ6ACG?T5mvdxf`${zPqma!+>jO}KuWi4bY z7txR=IzWKH|(RT;nnKrCeCLRKEg${QwF z@3GvrpAZPZAb@}X3IZ4i;2;1%00;pP1i%o0KmZB>7zE%D0KfnU0}u?rFo3`S3IiAn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$I}qJC}CV^F*( PDJf`2L=fO%VEFzI2Wc8( diff --git a/doc/sgml/tutorials/pix/buildready.gif b/doc/sgml/tutorials/pix/buildready.gif new file mode 100644 index 0000000000000000000000000000000000000000..042d9143f5c3341971f2b788bc2f23775210f0b3 GIT binary patch literal 21711 zc%02#Z)_XKl^-sb)QX~*l}szLthy^lc9=@(F{b4zsoO4P$C2H%rv^Pi7G!~T6oRdi z0~;hcwRb2;$+8_cP8IiDgh5frO>*d6tUvb2fZ*r@<;1BIFn}6dp&+;qbdwK8(Ex67 zAM&BV+7+4=M4&3nJ!doz6G@S*On9RG{*Jo_icIvM<7`7{<- zgt0hd8OCyqar|E-!Xj}N$*@R{ML52UM_4@0;u#jtu{g)NnF!0oSti3WIhNu0X)eNY zahA)lT#n^9w8VIX@i^ld#&e8wY#5t{w%}u^&9NW+i$@}vNF*1DaO@WT7mr8cnMgbr ziE|tUyv)QSnM@>;i)1(s3hL(Kkz6K{%SCb=#t5HAcs#;05uS^1jzh*dz@TB2Ff5KU zz@DIKXbV2(I3fH${AJ?tTs+Qke$XxaFO!L9a`6nu>B1=BWiAuX<>EOGvxh-J-8j$0 zc`nX53Il}&UxPSc{v2h4Q-a1|&@f7lqQZ`$ZD<^0@b|osa%H+4k0{z!!U72>oE^jk8UEcOv)eAKdes z7k7MP+<)KG?eCu7eXrLyvP(CaQq$O(xMN&D>AQQ+leh1*y?v(f-p4K_{7JWYJ0CgU`Msx4Oq>18+t@u7i%!%u?EdcJ)bRtS?`k{ruiY=5c=#uGKM?<~ z#g`s`>ha*MenZlEhwqqT^;ZDd9S_WV=T>>dPOm(x5}aByO`=~?$ol=(Ft#T%ihEa2wE1H zc+zLEapn)G#iDOfSM=0@(>(Bnhg!Al#kVF|t4~epEXrzK-H&S1ZR{j#edtLoWw6tV zi?J0wYqC05s~X17;HzhDuUs_yS4mxAo!P*#j>PM+>CsDAo2B51I%qBUusc>58IHA9 z35$ZOSv*-~&3k)wmK|NQSq7jlMt#9FP6zH*k|8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piJX*C5EjPp6(y<;N*c(6N446 z9MVh+Y0{__)JZ%J!lV$HP(`#xATn{>#*!VVbP8cyh2H}C0nP_e={dtGJEctI4`r7E zN4tLnP}A0vHu~aVX|^XGHp~tMl&T$91BDk_D?EoP;w#WwR7C^p2=pdS;LCH%RLG8k z6i7Ku%)pX>++de1RnoN>LK?4iHAb;sVXT(&2q*=Tls5pRU)*N3bkpAo4iY&J#-pGz zJfRD-__-1$NWQV&^-8_t*ZOr5%>1=OxDU%D7&UNx>up*;ny#(s{!47JpX{85cCLl& z+aK43P+emndbh{77ZyX3g+d)XvyJLT znuL+EtT=ZgE+c`uF}k_owF;^tEFS=QR~X}c&<>b8JpW=_MSRDI%&m`nRo74*kruBj zNK_PLraY)au=Mf%Tks^C;1w9-T4y~NMFoA{LP!K*Z<%qtf9jb(u7%z^@;ON_W zPP(lE{vJyLRwYfpwXy~~mSyPeU`p}+BViJl4_c9uyHF>dJqK9euA|2~5}sR5IOqi+ z^)Pv_wgn5WMCF1vlh4ESu|;f1thjP=KjUFh69F#^?AYIH6~^dyVFEh<6dNf_rB>m6 znk?`0z($MlPI>*UpBdn;!PqmdIL1P60H{X{5U$qGmH0PmI5Q$3TKM3Ebip9%0xSCrINu$MJ>?B^fK z+uN<3_+vJ-bT(kbBuhRRPuTS2M=ZdqhM(H6jz1Ccs0s6u7)Ihjiq-19~$d3oYSal0?Gv%R3)Vi z7X5m<^J*$J7upkwmc?c5KWz%5ZRX&9y`xJ?mF9l*?@_)5Q!AwhA@F zsoIo@h$9%@@L0W+-HBazllSZ8)V}ru-@7la28OYYCFmoMl%4#kg`O)PcTK>2YM+r4 z+m@ItvjB%*?C*VUso#=s<83IYGgD=1zS{t{Y@whqb1oqT&rG%Az#lnW*Sb19Q-uV{ S2knROm_U`4Ke>@&U;STtiHRiu diff --git a/doc/sgml/tutorials/pix/configtool.gif b/doc/sgml/tutorials/pix/configtool.gif new file mode 100644 index 0000000000000000000000000000000000000000..8ef1d323be993e998166a853dc131478ed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z>;2d6X$-#;`423l>{L_^@MvL4<=;x^V78(UpS*W9V4Jf;Rbn+tRdv^!Cj0aM56Cn7 A>;M1& diff --git a/doc/sgml/tutorials/pix/configtool01.gif b/doc/sgml/tutorials/pix/configtool01.gif new file mode 100644 index 0000000000000000000000000000000000000000..6add8790123d7cd4716460ec8f794ecf50b48bf1 GIT binary patch literal 42236 zc$_SD19V-@`*o5Vr!gC&v2ELF(Ac)k#&(-DHX9o^ws~XQc5?Ie{r$f^d!GHwKC_-# zXPr5-Mp{;ihu3%%3JvNB;{U*kN5)D^#*0VGOGe8}OZzVoBcm1LWhG-}W#wgMrDf&i zV&~%J<%I}^AYhVarIo{DRfT{ErRPme2#hWFSeR)lDS#_Y&CQxeCW@^(>R@G)+ z%XSrTvkG`rHFT9V_4x?_F;q-8R9rk&MYdT*HdIC1RK@$R(p(cIsEKx}iFLDywzr9Q zt%-fLNo=sm7YKv^0m(o>)}4N)^&Wxk0oA!dv%^uNp&{4JAy3d$==fl6(?0;4fWW39 zU{lLK{g(lUfWV<4VDCR2`j11vsef^5XsYSI@NYCV1R4T@{+Uz%0W>w$1Ox%6{_}>0 zK>r^8^FTu&&=ja?YIA66vuWrEG? z|Kio=6zB-_kDEvTCjI9f9bNt7)6vt_(dXw8aO!FkbhY_E@9664fBov}>0i5g`WHX1 z{!jnI=hNrs|Cj&uPlo^Y|9}4i1Uwi*1D;T(Hm^4X9+OUQq&B}l0*yj0OQx=1Fb0p^ zW__fta5#ZfJep9peqRiRMy*0`w7z&ejm2~IysJ8vjq%%K)gh1z22_V$D}uyXsz2DR5jOFGd=p8oJ9PfnVnZTQb6Gtx_N8;zm zkVjLNJm*JK48iZkGPi5(#Zk4(z+ijst43hCMY={{y0u~|3mg;DPV-9-Q79)XjD-{> zE6^bnr>OC17pG{-{VDpbDD+i1Rh#LnMVh$-E!7{x4C{k*t>$v743`{)(lqteQHvbM zO9YEt=iAYPZ0pmn$GIV|Cl&<}Ozjqht{6Jhd0ynNR>kpiw8zC^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YS9!Hpef3mJ rHCTmpSc$b*jrCZOHCdH)S(&w2o%LCvHCm;0TB)^Kt+iMK0ssIzJ*}&@ diff --git a/doc/sgml/tutorials/pix/during-build.gif b/doc/sgml/tutorials/pix/during-build.gif new file mode 100644 index 0000000000000000000000000000000000000000..fe1806dbb1de3d7711abeaae9cfb74f740cd30f4 GIT binary patch literal 2031 zc$}?N`&Sc(5+1@v*L2HGbtQsUB8Z3t7qtYmihEm20%B40q9Q7&0fPvN;ZfwELICxG zFBAk(dB{^M1Qigd%d6Z(pxWaD3W#kI^n#=WuyH|QZ*2P~-1%Y7{4jIAnQy)sk%zmh zOW+QZ?eGph8g~w#Tt_xEG|(UD#gV|00T~W-1Q1fd0|5<%fFp<-0r(+6r7#pj3kd?> zhoh0`(FlYz=7a$m484xDZVzD*iIY+^F7#r+J~ekKg9cMFDO($4%h<7~wIm;gw1kks zaSBCcGTh5ejpGc7QnI;-wh9;k3Lp-V2LQ$e4hrN^nhqccE{#MyNSBBYw)(YHS&XMN#Acdyc@?rG(z-EL5W?<+KG6Y5->drHr+57GMAz z08%ceF^u4Fa2ZW&38IUZ2r4md?4*21i)k1RLy?p@ zEzcn^Q=CJhB%coKCu|s;O`+sMnQ6b*a(==-sVIU;1WP1z$+TG5x_`+k^x%+wtR*q zp~#pfrL<3YgpJFLa;a($JD~{%h7VMb2_gju1>nDx+nHblaP}K@_Le?qLP!87fDQ-Z z$lrpKNx>};h9sal1WY(k#2Y&ax_B?J_JWbP|Emc;x{tR2=oHLA=ZPzF8xvtB%T-yC z*POz&@yrn`@_+m{VlI4IvuQ!=S+m)(h)3lORr=!1W&Wzl!nRDOy$^Fd?i6)gag|1V zQFABwoAd0Izhl{(av$ZJI-lO+dC0ycY2)>b)Q5KllqbKo3p!YPp{)J;mFZ!(LPkn9 zDX`K->*@>wzv@Hhi~1+Hf^X`AbTbPbB11ikB*fsS4sRV_*2Vv3?%tg-qOJ+*w_d$E zb75a|qQ=uqHC`TcD$6cqLw$_n(~{!!T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f=Bp|MVQhuk3$M5@ z;cugU>oIoIU%m4d(ZtlkrC}M$(cEDAKzJ>24rTQCjhbhsNAj20Y~Kjd@zW3=U3;4Y zQBW&!m?jX(<7oUMiUinT^YP!t+Yu~lUrww`Xr`%74q^jA&G+50{$+EA2U8F+9?pC1 zV{NELCqyfgk^_=XVF&roMx2O#gz=*~gELS>BIjv7=MY=NN$T+?>9@rs*olakI1cib zPUr*vsVKlK>YZIesI_NAuD2$Hx#Lx|s>dl0dH6X8QJ8`T=*n$IGbamCm>UJ+mEfu%RIJ zQyyv>pqZm+6lFXEaZnZL_$*Y`1#ynZ=Lof`P(W#ktR*{7Tiy$X06$8|M%?U_c@in@ zAgvKdCo16@mB`@f0e3ht(0h**?J0s-GBAOGilV5V?9zyrAp-}{nb}ZWV=jv62T->9 zH5`l7Mz-b)5!2S(*tqKk+Uu_H?_+jJDu+!t`j*Q{2$)TuKAW8u``MB}<)6z8p@Jm9 z2?unP5WFZFXfqBfAIwYPFc@&~K*rN{$R=LpDi%0*G&jv@PbWwXXJ8JRp{=AT%LxIO zj%rxRKnF2$Ep%s<#fMZ(S{4liZM$GRJMr}2Q9hRpP<}-A3G#z`d4&98w?^wHIYfIN zA(#ywW`pTZ;FCs>Yarw!MwzgY%o(I3j4^Bgbe8<1qzGlP9za2uFb<&`(aHcC(neZe zfehK`APO8{cE+;UL zoZ^o);r~h^)XdneHJ_cgWnK!;Ql2*W?=vssh&SVqAKXc&lPW;+&KDho9t-P#f348r zguo}2D3yTERiZMY0)NPd@Sw8)V&!sIC1s*=Yw0fSrL diff --git a/doc/sgml/tutorials/pix/initial.gif b/doc/sgml/tutorials/pix/initial.gif new file mode 100644 index 0000000000000000000000000000000000000000..9fb99c40d65dab19369eb0e1fae9e7d707444471 GIT binary patch literal 38896 zc$@$}K*7I9Nk%v~VITuO0`&j@0000H5fLIHA~Q2HL_|bYRaItYW_NdYh=_=pnVG7p zs=K?p%*@Q)-QDi)?*IS)004gg0KWhL{{VjgGb#WxDnB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LAAXs_|}7 zT@ns%)nrQ_LhEUQKw?Lc5yay Uu~5<$h67*n@py|DK@b1{JDNbe>;M1& diff --git a/doc/sgml/tutorials/pix/menu-build-library.gif b/doc/sgml/tutorials/pix/menu-build-library.gif new file mode 100644 index 0000000000000000000000000000000000000000..2af220d6a00e58316d49c2e30182e4b612807b90 GIT binary patch literal 6192 zc$@(+7|-WNNk%w1VFdx70Q43B000000Dk~~0A>IHW`6)?e}8v(cK`tYnE(Kpe*l?( zfBygg|Nj7ph=`f0zq`A;nbg0`s=v(CzyJTg%*@R0?(YBp{{R30000000000000000 z000000000000000A^8LV000*NA^s8|Lvm$dbY)~9VtF7*ZER^`3IHqs000050iOT> z1^!?lj$~<`XsWJk>%MR-&vb3yc&_h!@Bcu65CAM1kI1Bw1z0SIDT{RKlj^3{Q&xoC zF1g)+)vF?hm)Np}MGiEd>QVc;wq@tu?Hsw^oAPyHfk$_PC4Gh^Lr^GsiF7xPe}j@= zV2zJjl$nH_B#4SbFO`CYRA7#EW2UOBf`@^Hau4cRE%{{RJU*c2>Q#0uGp${zs5NnND<&cO~mYR126!=q7hB@byJ40Vn&nP{u;Jp z))y?~x9{J;V>}p6ytwh>$dfBy&b+zv=g^}|pH98H_3PNPYu`Tn2>0*c!&|5D zfV}zg=+CQ9&wjo8_VC}!k5B)B_xbqg=ijftKmY&!1$dr#1ae1#cLgT?s9=HQ4c8!g z4ifj^gc4R5;e`-pNFjzBYG@&Z4IhwS}HlEmk&Ni!JuZp*bDmNpuzLn;S*m@_#Pa5m>dM(*p`I#AE|2CqcU!k+Ui;{%-+@{xy)<4)ZkeId3o3@q zdP^g~wzm1lo4fY9YrDXPo9(=xnhIo{DV}*Ovj&s9<)3{53Mr=NF$^n zW6J=aTAZ$`tUEEp6;rz@z6J9c<)K}!8SkoPdOIM=BbzKHoyIXNuEkIansmmOX6o_0 z;&O~`oDr|HGp`kss;AJh(wk<-K{lJG%$hnacgZWpTCKUSz87_?OM-lH+&|;3bjI%% z=?=Sfx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kI=~(0!KV#5ho` z-6x!Y5_!F%-K9R~)~{XB$MsnP%ta{fMDRV2Vu~eW%iSuBCS>@&HEzxTOCH}%)ULZ; zdW_1}T8POUy!mRl2V9>KO+8OO*R^conybK0($2E3xdd6VJS+aY|tHqO@l)1Su?=W!b4vKtNCdFi)| zpT1nqSm}?lr!S&NsX0`=*B8sFO&Xj|)cbK)uy5 z2)Y(7b%I!gYo)rR>E=ugob-vD-X7WcF5XV0-Un*eY})#J4SEEsC^q zD(7OeG7aMlyoa)$?%-~}j{U23{Mw2PsUiC2Tz8U%sW$rZEz^CDd-Bl8%&9Pqsl8wk&}d?g!>%3KH$3Z${O*g_mIb3G&Q~v-joAZN5A6W7b%dEP_FXR~i8hEkIG64bt#X|L_9d1&dGM2W8-Rec*Vl zR13b~e=qRGVvZZ%i+S%<86z*_GSlb$r4agcg8#=fM7JKk9cBw8HC5@-!SppS<7d zX};YQeE|@F!I;D=Q1zD2un66w>rhdm$a`-Z4f8X8y zk-^cQ+fR||7QV_~BtBc;WpW#vRgrG-QVP8|)-4JqB)o~WK)-Rcf#Uh1Bz zY)k8iPhu`mp>A&?Z%`q?!UC}GG0=lSL&NeiGjy}`^YgT|^R+ZHwgES^x3_jSwY9i7 zIr_LdH}-ZQvY|2jF~9*ZfB?Y6aPg*ve+5X!23p|d&ym1{3KueL=x@c${+IN z4s}ZQF5bLUGvZ8WL2ZzI5*)^>xz;Y-tzCuH)$8~%QnR_xYOHBS!UG5ZFfVm`m{;OR Oa;1`nZ2C0J5CA)I#7f!# diff --git a/doc/sgml/tutorials/pix/menu-build-tests.gif b/doc/sgml/tutorials/pix/menu-build-tests.gif new file mode 100644 index 0000000000000000000000000000000000000000..fbb23e6c40ea287ee300c47b417341db1228a6f7 GIT binary patch literal 5356 zc$@+36cg)5Nk%w1VfFx;0Q46C000000Dk~~0A>IHW`6)?e}8v(cK`tYnE(Kpe*l?( zfBygg|Nj7ph=`f0zq`A;nbg0`s=v(CzyJTg%*@Qp|Nrjp?*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sgml/tutorials/pix/program-menu-shot.gif new file mode 100644 index 0000000000000000000000000000000000000000..c162cf371a80292ff9c94246542fcf37d5aa04d4 GIT binary patch literal 25794 zc$@$xK-s@XNk%w1VSNGz0rVdL000000Dk~~004h~W&i+Y0DoqG0A_!GcXxLH0KWhL z{{a600RO)L|Nof)0GR-PnSTJ8e}De~0RR60h=_=ps=unLs=K?pnbg0`s=v(CzyJTg z%*@Qp|Nrjp?*IS)A^8LV001BWA^s8|Lvm$dbY)~9VtF7*ZER^`3IHqs0001e0tW#A z1^(b5j$~<`XsWJk>%Q=aeN~2B7k2?U&g(qft_RQnGMLP9nQ3N>LSXLa69$FYUQegX z;<{RH)JxWy!B~x2oz!?a9~>on6$hV2Wp$^i9Fav88W=`Ne}))-8h}kpZdgA-S9@UBGLE zgrR+X8G@|4(rCHN%(;thG27hT-rwIE8)^q#lchTxT$($=02oC@gzxO9>GxEwoxNzr zyZUGTk*Og_7px0$F3eelX;hI5795#cRD`0iMidDt$rkSkJwvNZ?YU&>UaC!1{u1y zteJ}K2{dqE!-^g2;(`YpH+%qC3joMkFKpGWrC5WllekmRy~P=@rA~fV1?JodP^ea- zSrRTBWo7SO}g2_wl*May7AatJ+?axR)yXY3zDW zWrl+bH!Up0>(nuR{|Z@Ftf^pqU3w0!O2%lGMZ}qLwkjOB5DOL{3gRqmRx!?*!zUUq zzC8K!=F_9cFrK~p_weJ(pHIKO{rm5sdHU;IXESDMNT(4Y<12p7BWU4Ryk3al~!#a z$P_P#rI=tDUj0{GNc{u{T@xYpNZ>0!3bEXg(CPQVlv8d{<&_^;nI)E5cFEyeIEVu0P%Pu4I z>%e2Uq2Hwq3u~OtsZI#6KtDd{v!+J%r|!L*E@i409#-<}(8CtF>C^kYLO~D*qPilD zJX2j_c3*7$Ep`8L+E0iySIv{G*UY*fFH)CFae%B^3-a9|!>sq-eE045-`0Ywle}+? z-KydA`a`wD^{SJ&G})Poc;ODmq@UrFSMvCRmLdQEr2e2kx@YL51KKF*h>l)*p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wc_4T1M z&;SuYU?<4tf*SmdjHAe;B$>IjNe*M}6|?-ah$Z!P#CGyvviZ#^<#wJhjpl^%H>W9e zdArxX)lp&dO{0B@&GC$H1vsGyg5LRY82)cR6Z#C^>4*;~pn(R!^#BGqx&{`0j6N{^ z7*ZI@IiNm{EPvtR$e8S?*{)tL!#84sb+hR2yI_<9P~|Ii{+x>yD8^MU^y(a@Y;|RT zzv(F9?s&f-6n?(WIzc9m_URt1Cz`Pqv_RtI`ngVl`2nrjAhR@ zh|y&*$#(shVrDs}M!fZ}nypsu=KAQ@A9GH(Jiw)%cPBc*f!hNhWw>w2#Cd-b-#2?0 zfyY+}kaz|_fChjBN&o@KHXY116wEeZ#2|UfAZ^f~Vf?frFqKs7H!7Z&GsQv`t;Tt0 zHZ`y(D@Btxr50J6HgjNgX5Hs{5+rsdXllAJRAoR4PGEN=fpF)7Hyb!mV=z>bHyKp~GY3N_3}Xxm6H>>dLp6kenx^nOqXGT#$a=cjezmn!YIjv?8Q=Vpunp@$<@F++I4&Uo06T|Jfmi?l diff --git a/doc/sgml/tutorials/pix/save-dialog01.gif b/doc/sgml/tutorials/pix/save-dialog01.gif new file mode 100644 index 0000000000000000000000000000000000000000..cc35cc59c90dd6099e0ad3ad82c02008f9e220cc GIT binary patch literal 15115 zc%1E*RaYEL7o{N(9D=(9cXti$65L%Hcemi~?(WdIL*uT&39gMxfZ%i{?>B#9F6KG4 z_de&gR@GWnGIG*<{HBM{TF_5W{}*;Bs4#MN`u|`jr)OvX*ZvdxfAF*O^YhdHv;UHx zU;JP3i;MqX6PFj4=jWFf=a>K2$jhsV%d4sVTmR5g)05ZJ(=%7oGuKlyH!#D(7$Q}f&OPe z(0|N<#z3I4oiR|`*gyVFb7OP=u{yW9x;nP{zW}ZN$Ii~`$ zR-gXa)5+7*KmW(y|J8r?_b=4n|Ih!EF#UJ_|GNuN2oNYN1Y+67qQOuEECz###^T{f zbV~U=*`|`wSbR>~t%;`6@o1NW-e9asrHN!}l@u;|*Y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};nu zwsB=ToJGHPEkXyu8VoPZbO&$2;def~pR0q4uQe7hVdBJ@7pm=DLWA8`SKT^ zZ|kIn{pIt5e6|nLr1p50lhzcR^PJPA-+F-_W8DJV_Tp9)z1I&|F&QM N^^X5kS7Wko{ePULs=@#O diff --git a/doc/sgml/tutorials/pix/supp_newcase.gif b/doc/sgml/tutorials/pix/supp_newcase.gif new file mode 100644 index 0000000000000000000000000000000000000000..71fe0d51bba1c20f113b4c6dfdb8b80658c64e6e GIT binary patch literal 16374 zc${^0Wl$Up&+W1-6ff@XuEn7&6f17Uo#HOVo#JlA-QC?5cXxLv?oOBQdGG&wW|B!} za&jg!nMCTlBpt=jSJuUNVtp_F={a;1&8G z8DIwZ0C0VzeV9!E{y$*;pZnh|0C*_a-$9z0Fm|NSY1Bp_XQtFerb@eJrP6i$!n0?m z)?H2#Y3gsI=cHZ7_I0bbLe2WsbEoh0)!T=EKw!}C;E>R;a7!35ASgC2J|QtF`ARmuX%2)z(FdTb>;}TZd@0u*tuGo+ zVK*5Y7-0ZU+Vbi+$kG1Pfrh{$AZDY~g6T)oq!StS#v04!OU@8R@@TlxSTa>rPeB0o z^IKVc?*XF#vM~%+LYEbGAi%j}1&xlnHl!n)w zaOaS!3~jm`SaRNhs|DL~3Y@85Z1?3nMJ$CbXKc-#yeB{-JsaERtZ$lqNdy}$*MB>o zZOPAGV-7?Rartiawd_+2*VtWXul`&?ruU-+341o%Y`mD^)%;WN627V)?;Rr5-?Y44 z_oy(K&UV?`=D}KKRFQ479~6smPVUSp0T;jkf>i*pjqG~nCp4{kw#UjTq-c3Uz0c3-k$(!FBn zEy3``O|f5d z5A=sInP4vCl(af6{u1bUlla-|`8?`t5I%!|nk0hhv{CvhdrPgrzxz4q`L!>jx^9y( zqhe^i1rGha@6{O3W4dWd^t+vq?+OY7dCM-b+E1JAQV(a@H+@ef)$fOII5HosU`#QX zA(Gh*kNqmU{Wv#yKw^@HU7P$La|QmmbZgSqwGWJ`Xe}6X+?SKmlImCSp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SV#`xYaj0-l3Q#(BhzaSpc%<7Qmp&VhAY7WT$@6kYk>kirS>y>f{)`82En zw%vj{fS#-Y1a+>0q4qZrvfJbImy`lXnm0;naKegT-K(?FO5Iv{*MBOJkg>0!t^I;n zQjZmBPt)o=J=B1-{6)B*gN5#k%H1!6mQePF0ex8Tt{7y8)oDS61&9wZ)_5>v_g7QA zTT*w1+4ury&MMt91j7u0$-U<*koa5NV9+#@QUBO2TzJDwx^-J`~zqo(-)AQ*t){{d+&g(m<2 diff --git a/doc/sgml/tutorials/pix/supp_profile.gif b/doc/sgml/tutorials/pix/supp_profile.gif new file mode 100644 index 0000000000000000000000000000000000000000..55bcc2290e69019b72a353d5aa3a3cfab526a4f4 GIT binary patch literal 21495 zc$@%8K)1g~Nk%v~VWI*B1El}}z`(!&007_L-++LC|Ns9pGiG;pcmMwYW@gNpng4(Q z0Dyo1%*_8_V8B2ifFK}1%*@OpA|i%{hNjB!fPldN|IDBOfB*ph{{R30fPerqGXQ`9 z05fJ)8jCY#nP!=pnVHO)nVHQ0|1)N0W@ee0%*T>)W@i7)|1+7H|NHO& z0Dymge?pq4%$a8YW-|acJeg*hnE+-0{{S=png3?Y0000000000000000000000000 z00000EC2ui0HOi~0{{m8K!9*aEE41ejE#aTQ8`mPk1&0t91b9f%p}~t7Giuz(v7^V2AVZ2ANfIG3h2qFP3;^*00G1RN90)+N zrp=o;bL!m5v#0*ZRRMsK6WYQgH6i3O9FXWxW`G4vU;3O%wW`&tShH%SMG0nD6jBsCyMPJU)2nx@;lqd%lkCdmtALjQ zB1?{Ja%|(WM#CX(cwz0*pqu2LBP`fpVRNU;rB+>fbwAfbOSgc{dbI3$d}rUbt+==E z-@tJ{Ug8+?WXY9h52rkYxmdGkQ?`i7_QFi166fx&+q(NY*tGr8ChhKY`0seZZx7DC zz5A_FhC30p|)LMvGGNhZm~6}U4#%e*j;W4 zP6*+H5B}*eL3Y$bXqp@pn{h+&KG)oA05`Q(>GarHHqoQ{(b z@myvoZT1jcE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TLeH;+(Jae!D{@+N36xRfyPuMLRM@@M8rdiskCPx zGvGl!B&qw$ZWL9pyI|^*+-yk%KAG3ru;Uf?8a^>$VvXP$KLZF zr8E`U>PoNt%ECDWuv9INyp(=$zoRTmvZFw4c`mnnOSlvrhKtM5AxeGHMYY^Uw(PsA z1IcC(Nxp10zhnl$49pf=$$R9(y);as131CK%PRyw#;iMtBfQ7EOw7zo&D>1R>`c%6 zOwbHX(Hu?EG$*l}Ow=S5X>&@}Y)#jEP1uZ0*_=&rBP`myP29{)-P}#y?9H0It<)Nv zY8Xr6RGi@~PUK8ZUJ*0SGADoKCZ;2HzYT?95K?>`w0tsOZ$E@5DXp ze4FY_lm7lRe*L~)jnm}ail~KG(uXHKY3L^d`&|II;HC%%g8zPv|L2X*61T(L>kBQRX)onGm!T+0m`Ev?ogu-F1HRO&?=(Pes;M( z?N8TT+qSiUx1C*g!pN2pc4=&d22~ATZg#aTx+6u)`1TX+1eqgj=00y4i53Sq+5LY#jT21BN zfI5H$H~{h;T__;a)YVS)rJXfp-vWIAF&<+mfK$Mo;qRnf9A0BKmSJ~7V*udRLnYV+ z#?T@*Vzg1>5UpS*epDsS+O}B$0!Y`eHBwa_TgUCTrYSyk%Ve z8|nm3N$zD|{$*fpJzfrGVlHN5KIZq+lU!bAW^QI@er9NnW@(;gYOZF&@khGMW^LYP iZtiAp{$_9vXK@~9axQ0cJ{@FEXLVj@c5Z_p0027|H?i3O diff --git a/doc/sgml/tutorials/pix/supp_welcome.gif b/doc/sgml/tutorials/pix/supp_welcome.gif new file mode 100644 index 0000000000000000000000000000000000000000..8bbebe328d966f839161d4a0da0228c274912b94 GIT binary patch literal 17229 zc${>1V{j!5)9i_D8=GuwZfx7eZfqMT$;P&A+qP}n8(Sye^WOirt7dAZYP!4T-;AWR z1UHv)9yls^F#yol*9QOqc6WDyK;ZZHHyfLoySw}MH^9tnDn0!h2mk->U-)xkMF5(w*PECZvP|u`}>Pzluo6aeVefXxcL4@2ABc90c_vt z-)2*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N%%h4nf!r!r{x|x`!MQ4MOcT>T@1g1<4KT_y9$m+K1eUYu z!GmB2!}J69%aO%T3lK)>V)jG&|M2L_Sxu4tBBy`TL(29Q)we~o6TDHpPbA8$=O6O( zoO=P#-0SFjti2DWP<5hD>0EehJDBA4#!vBARUg8sm2=xRTMjR_o>HZs&9Y9^yd2UC zhVFGS{dc!^CG1UW@g{1H?jz%Ruvh`0IB(wC&++~T)MxVlZ-3+X06P@Q#t^EM`Z4|2 S%+kMx8aeRZ<6(pS+5Z7_?>s{Q diff --git a/doc/sgml/tutorials/pix/templates01.gif b/doc/sgml/tutorials/pix/templates01.gif new file mode 100644 index 0000000000000000000000000000000000000000..8342a5d7562d70455117b30df91a9c4850322261 GIT binary patch literal 16458 zc%1E;(|;Yz7w(fbjoGBJZQC{)+uF&F)7WWj+vbjK+je8y+C6W7=btzi=ey>4p0zIK zGdDALBPAor&10MmNdWl_@qb|3K8 z1A$Th*?-~eZ0hXn?DdZ*ub`-)Am^YUub_WqMg2!oRMJ1Pva8|0f zuHo(BuBPGt_-~pXp8m)3^z!oZ@bdqnYxy7B+snt>|2RJWpN{`=eSQ5;*U!t(|Jn2L z^YefHAAkQ>|Lp(s|2Xvj?*G5H009ezK!e4XuFdQF4U0~zH(HxN5Q<7BnkUvWxS{d}ofODF>EB_s-)6);nv(2-)R+XUQgkKS0e z(Qk9z+1{#bVbbq${(Af=r^UQI;EjO7nU%)!XDAL$D5WZ`et$fg%(A)4-c^&GV(L&`wV{ zD=*J4;H|(euJ^2{1ef=>TUR!A>j0}-rmfFGt#=i`nqDw%RmI@Ajtyw!4A6@YC^N>z zF?PuRhN;TFyB>nPctY~UO5O8Rf7?34sG=ZhHWoUv=H= z@zr#_K6Ti4K7N_J?s5*V=RF#1<^Nv3@>bb zr1#*;ciK{xfsZv_TXEqu&fJ2}Ho=~2b3e}2Lw`Tbv47DpE$}t_ep2jS@7JvO->k-2 zS-dUwc||sc$9a~-00;t$DiTRlGP4_DXhv>F2~=M8j7z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5wyMy1fB*gQo$wiq9-{-^uE*LRqk5Z?RJAu<7dH z21+(&_jhv~UgoYHkjHw&slv|ed-w+-<8a}ZQ7nTs8-xB|IBoVT=cy+`g zq}vsxBQ6MG{-XE-+9RQ>r+{H4v8*QnvJz>sQrfdpyRlNiP#MfSkj=ypJu56fDr*-M zWWmRF`qWd0-cfkfGsM=@udp)iurgdbE{xmzXBc%Q?L2NDLuN>Vzxa_|E!XYl9ghgI z!J5(!DmJidvW7v#XfSc8%soR7X#G$Rkp$PZv|z zT{qz^y68-}XdE{grE(bbG-*q@7#ThqwYV4$JQ|Tb8RkBk)VQeeahl?}n!R%v?YNkp zyQqn|8iu->Y&01)Z~%Z$fZwiKO3i8=oZ5UGYDyd?a!(dsoIoK?bv#$i`$sE7S4$LE zm3C)Gz&Y&mM0d#Rif+y@)h<+Au5?^3hHfrBju5WT6^d?i z^Js3sa}_p+2-smX`~b8@H?JNp?+G{Wffm%+7Ow#}-DesoYWfZecC%Q7zAYh1}6SEuoRE-dKHT7y)P>{&9bWQBd1ZieM$E+7g&} p61mzEg?N&r+LDxbk~Q0s4S7;5+fwX#Qr+58{a%w`pdcXl{tt>hzo`HK diff --git a/doc/sgml/tutorials/pix/twothreads.gif b/doc/sgml/tutorials/pix/twothreads.gif new file mode 100644 index 0000000000000000000000000000000000000000..106c69b6e2e8988ed71d14b859500706e3e5d1a8 GIT binary patch literal 41444 zc%1B(({~(<8?7gHGHJ}lcD_apCbn&-u^VGz+qP}9vDMgiV<&Td=ifN%Ja_x%-4}a3 zYrT@v5+&UgW+$LMw7-?WJ=X?tx;d(<3x+_Y?I|; zrT%1V%|@H!!98@wJwcemAIF|1A z+k>$rM#GtIUfKPbqP$?1p3cXM)h3&rnJwza>)r2u5DdlM?$`U%#i}@dKi}7<>x0QW z#lGIpceuTSwp#x_2m}C6w+l{wlq7S8CoSI%MCCf&4RW7`ClCClV7V89Z&AMIi)25h z9Yz{Tw;xWG`eGbHvjA@r$<%tfAH~+&Y!dA}Ep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Gz~Q9&huZS-w zsQkFN00@d3pcHTb3bkiDHC9oD+9{k0QS8M!W(#|coD>PYXvbRgu?#JoWi4-+%T&Se zV;2V#syZvQEU{{r(VS*AuNfm>hOqHqVpu1=IV5Lh^PTaW=R3Rke>P$WVQOM$JrA1D zg=lAm1j0O<-q&MJBIq(L2OQERfRR#9~Sq$nv{ z;pEe!cJ-@aooG5=EVTn}^zjy800|A4$T?|stbrYDVIvOAUH;zyQJL~ ze)qiboo{`&x!G&J_r3uhaDgAB-WC4$z!9GCc^90*2UqyRAs%jqPuSrRxA?`EJ#h(F z9OE7L_^UO}T#kR7fX+wXfZ1XV+@l*&cVf-^=Y;h5Ov`p7$8l9jkZO``-b7s(!24?}0b`;Z4K$s}>&d zjdy%v6wgw|Kc4cHC->mfJbBA+p7Udg{7N<7dC~umewmXFJ?T-O`kQ=SrKeZ@>tR0< z)~D3z^=G^Mkx761?|H14$6|ScabPOfNvN1X=L=I_=H`K(<HvjAhD<26=Gv!ef^1OfYb; z2Z<2yXr<6X<^_vz2?38aHn8EuhzX?-@pi!luhc9&Zfy#+5bt1uxbSSUhHwkTaO{5N z&boz)#xM=z4qKFv!ny?r)i4grjt#>Qx!zC?@o?_2Wn#DtwSp=S0g>$>CIFrgs{|>s z0x=QSj->WN0qT&Ya3dx_N)ahh?G#`$)55kue#SaT%Gh R8J+PNp)nezaR~zg06UG=lq>)M diff --git a/doc/sgml/tutorials/pix/twothreads2.gif b/doc/sgml/tutorials/pix/twothreads2.gif new file mode 100644 index 0000000000000000000000000000000000000000..183bae755704dc3098bb115af56c3936103eaa6a GIT binary patch literal 28563 zc%0pRZ%|uTmgm)zo-7_{pH1&|CaniIxniTxl(?oiDNY6OwSs^_NmK|>*<2_`2 zoQ$uKaRsZcG?A4avNBFqR>+D1EfJ-OC_O|OC&~&@6l@rqhPI$Glvc1G{MXaeG~U#- z($u72xA0p}PgBo$Q_o6MkAhUd$MK$~@$shdm8Nk8iGs2#Jxwd)O)D!+D+QDF2y6qM~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!6!T-P!}LBaFVu9O zX$!f<3ThU3mN1O@J>PR441akchtTDd11zit!0?le_zoO%1kHkUY)9M&nEjd;l>77f z!p8>Mbh9Abc1fb205upOKWDHiZf#Ip58%5kZ!yFeq{p=p!A>$+Ee5ns@?@MpOUY0u9qEhoTaoGU(u+ukqx3NAaBYJcb5v1X5KKiwu+FL> zSRa3=MKitpCtXJmo!bHER40zYgbK!d0&B9a7Dp^OiC5QoZp|5 zthsxj&leM>6i{Y78Oq;lNWNUy30}n50P(+_3*!uX&AcCvcc&NH)!Sj(O4TUU)p&EE z2=muNeMc&MhF+6_5%G5dcnKX1i&d|h(=e*ulF{#;V?ZT+Bs2Uf=p!#43jaP^#5xD^ zXG1hfx#YrWxs|QUaC0$`n|@0u4X{_n7*xDZ0%F@YPoG<2lK4@1&P?r!f3QVS+VribD!M=esKk<&sGv0NPNtT zf5BiH)=9uFUO9`mV0>(<>P`S{vm_Hblcul8?8@N%BSnOTTDr352S0oG`>*^yLlb-O zq7A-P09woyMZ6&TTs9255^bqKGNR^m%`ih?wnQl!AEtlW3Ax~B%EOPCjeqINyNh1w*ek{XoL<75b7piy&UP!inJH+;g*kXGX)OHv z%%L#mJoP|h(`Ie(_h@$(bozUA9{lW^5KczOD~>+~~k z?tZA?Ty~@2T=x9e|D#`@{HJ68?(Xk?`@!G*_y6L(z&+AFef`$EC;xi?spaXv{rkV^ zc(?sOx6iz{I_dkM?|(1POs>5jT8usNuRoOk=Lfxi|K6#;`!N2${@cK3b(IeCul^q! C>7C60 diff --git a/doc/sgml/tutorials/pix/user-tools.gif b/doc/sgml/tutorials/pix/user-tools.gif new file mode 100644 index 0000000000000000000000000000000000000000..91eb7572b8a71688971d43ff45bcea0bc1d3e8a5 GIT binary patch literal 4303 zc$^(p2{;t}AD`X|rT#^ELulM*$D1N_Omc-(-RjnGtc+={l1^;JM)b8RjqT%HlsUIfn|WbknJC`eL=SGFxDEv zvfAe$5P(4d0Ra>QFc82&0Du4x0w4&0Apn5@6ap{^z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*fEcuh2S~%V9sQyp*6o_I9}(b7d>l z`_utBXJ2o-1BuQ}f2XG?QLOGeDg3q_;c)z{Ww)_P32MH7Ob%U;b^Q7z9o5pbzLloX z?##!0Fvur5SCzWE?uwcxs?tu8B&4YbUb(K3_A}rC$kbG;qe?hYCFH0UYnq!XRNWXy z134#Rv&Lx&%~x4=f61M67PRLHclP}|%W{os)q66Z7I@X^A8!+Ck6rpBj_eB`GpbD} z6&zXa18Gz{jhDlvo>(|~COWBEHomF9kg{BeGkt%m7A2Y%jXU{HCKg3k7fmyL bezD%Us>Q!8ikAq*D~ZKxdBr<+0BZjSIDv2B diff --git a/doc/sgml/tutorials/pix/user-tools01.gif b/doc/sgml/tutorials/pix/user-tools01.gif new file mode 100644 index 0000000000000000000000000000000000000000..b591e8236cf11be4b9da73dde535f95bab296d2c GIT binary patch literal 12030 zc%1E%WkVEf7p*C2P(T`$knSA1yQQVOyN2%W&Y`=zhLEnIq`PxyP(WflkMH>t=fk=f+u|6r$}XJ`L!{Lk$F;A7|GsC{xu(;_b7e}F)se+GfdKxK8Hy0S7* zTG{`Wvj4fPtnNRR)z#I3{@4Gef3B-*tE=m+Yinx*{TKhbt*!Szwe|M?FY0>#G1EKR z+dH~F+S@kzAOCGLqci_lo>^XA9$o%l^)CNodwcn0`yVGK|MST|uCK5E`TBAB@xORH zd3^jY|Ksof^e_HD|Bu7;@Bjb11vpd~91bd(Y-8a-C@LO<{&-{2P~-Q0Z%!SOUn@>iu|CU4iTkaPxvQN^_snyDOCi+xb`LitRtXdwD;xz>tr z`LaL;EL|@8g%X8Gaet_W?Na%-Cben)C5Dw6gEpTndC%JKP1Zxz@$}NWq#UN>@YPyo)Ofgo>_*=PtAX}~7YojD|i(Jlj&&1o^4C1SKK zNWyhCQ>I>G$eiPGx>BJh5|N4=PuykHZah#NCYSsL;Mhs+b{LhsKN62B769_TJ(^CX z62Ue1aX*mBFayF~!NALnGMLqSl|Fvp*?KP(VR1g+)5Bby3V`*q|J%*QQMbqs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4&Q;Xm+r`ye%jXo!0TXx@352K2y5x& z)T5`&%TS=-n3W%7)^BR(b@JpDHgfGZ_t&qhfZSq?21y65i`O5CEof2ZZBhGe1^Bic z=)YR|ZTHw5NRx|&qGEg|8+R@ekHo>_DMfACmxv~!wQQ}tr5sPB6iT_U zPNABNXOPHHoVYujOlC6zr+sg+Py}(g&9qM3TdL#<193m`x9;YqBkWa*sYhUDv+6Y( z+YBO&Cz1j_kb5EGSHrRzOhy9U>19mmG+Qj>82Dx|uXng^&1>3qTyAxG+}RE9z8H^$%{p{E2vOg9>!I^LWox^f0hsvoQMC`Oar@B`vW`TuouDGYG6(G|Xd&GOajdIKDdw-QhG=X$?Cl2#?a&*%1N$wgpH zSb+b23sSJr$0GFd=Xk?A)JSBz`_GMZYw8!nzumywJIGFj(idOg*{7eMy|2p%cRc^* z5gL0TDO-`dp$bVceF|IttzBR*Mf7w1y~wY*q4$E;Blt1&)t!{F%-|==IQB_i hs(9{oFRBDSXy<#XM4{&=sw6RVzOTtF$VhMk{|C|xux$VU diff --git a/doc/sgml/user-guide/ChangeLog b/doc/sgml/user-guide/ChangeLog new file mode 100644 --- /dev/null +++ b/doc/sgml/user-guide/ChangeLog @@ -0,0 +1,90 @@ +2002-02-26 Julian Smart + + * config-tool.sgml: updated further text and graphics + for Windows/Unix configtool. + +2002-02-15 Julian Smart + + * user-guide.sgml: added further GIF files + * config-tool.sgml: started to updated text and graphics + to encompass Windows and Linux tools. + +2002-02-07 Jonathan Larmour + + * user-guide.sgml: Move special topics to kernel doc. + * special-topics.sgml: delete. + + * config-tool.sgml: Add ids to all s and s + * configuration.sgml: ditto. + * programming-concepts-techniques.sgml: ditto. + * special-topics.sgml: ditto. + +2001-12-21 Jonathan Larmour + + * user-guide.sgml: Move pictures to pix/ subdirectory. + +2001-12-17 Mark Galassi + + * added legal stuff and contact information. + +2001-11-28 Jonathan Larmour + + * configuration.sgml: Many cosmetic fixes, to bring the document in + line with the version on sources.redhat.com, including adding a little + missing content. + * config-tool.sgml: Ditto. + * programming-concepts-techniques.sgml: Ditto. + + * config-tool.sgml: Fix fig1 title. + +2001-11-23 Mark Galassi + + * configuration.sgml: took care of the tags. + +2001-11-21 Mark Galassi + + * programming-concepts-techniques.sgml: restored the two tables in + this part. + + * config-tool.sgml: reinstated the keyboard shortcut table. + + * config-tool.sgml, configuration.sgml, + programming-concepts-techniques.sgml, special-topics.sgml: the new + files with the individual parts. + + * user-guide.sgml: split each part into its own file to make + editing more manageable. + +2001-10-31 Mark Galassi + + * user-guide-not-normalized.sgml: this is the deprecated + original hand-edited file. + + * user-guide.sgml: this is now the normalized file and the active + one. + + * user-duide-normalized.sgml: removed this file. + + * user-guide.sgml: last change (update the DTD) before I replace + this had-edited version with the normalized one. + +2001-10-29 Mark Galassi + + * user-guide-normalized.sgml: put this in because it satisfies all + the little nitpicks on other systems. + +2001-10-21 Mark Galassi + + * user-guide.sgml: more fixes; the HTML seems quite correct. + + * *.gif: added all .gif files to CVS. + + * user-guide.sgml: validates!! + + * user-guide.sgml: 85% validates now. + +2001-10-20 Mark Galassi + + * user-guide.sgml: now into part III for the touch-up work. + + * user-guide.sgml: did more fixing up. diff --git a/doc/sgml/user-guide/config-tool.sgml b/doc/sgml/user-guide/config-tool.sgml new file mode 100644 --- /dev/null +++ b/doc/sgml/user-guide/config-tool.sgml @@ -0,0 +1,1428 @@ + +The eCos Configuration Tool + +Getting Started + +Introduction +The eCos Configuration Tool is used + to tailor eCos at source level, prior to compilation or + assembly, and provides a configuration file and a set of + files used to build user applications. The sources and other + files used for building a configuration are provided in a + component repository, which is loaded + when the eCos Configuration Tool + is invoked. The component repository includes a set of files + defining the structure of relationships between the + Configuration Tool and other components, and is written in a + Component Definition Language (CDL). + For a description of the concepts underlying component + configuration, see . + + +Invoking the eCos Configuration Tool + + +On Linux + +Add the eCos Configuration Tool install directory to your PATH, for example: + + +export PATH=/opt/ecos/ecos1.5.0/bin:$PATH + + +You may run configtool with zero, one or two arguments. You can specify the eCos repository + location, and/or an eCos save file (extension .ecc) on the command line. The ordering of these +two arguments is not significant. For example: + + +configtool /opt/ecos/ecos1.5.0/packages myfile.ecc + + +The Configuration Tool will be displayed (see ). + + + +On Windows + +There are two ways in which to invoke the eCos Configuration Tool: + + + from the desktop explorer or program set up at installation + time (by default + Start + -> + Programs + -> + Red Hat eCos + -> + Configuration Tool + ). + + +type (at a command prompt or in the + Start + menu’s + Run + item): <foldername>\ConfigTool.exe where <foldername> is + the full path of the directory in which you installed the eCos + + Configuration Tool + . + + +The + Configuration Tool + will be displayed (see ). + + + + +You may run configtool with zero, one or two arguments. You can specify the eCos repository +location, and/or an eCos save file (extension .ecc) on the command line. The ordering of these +two arguments is not significant. For example: + + +configtool "c:\Program Files\Red Hat\eCos\packages" myfile.ecc + + +If you invoke the configuration tool from the command line with +--help, you will see this output: + + +Usage: eCos Configuration Tool [-h] [-e] [-v] [-c] [input file 1] [input file 2] + -h --help displays help on the command line parameters + -e --edit-only edit save file only + -v --version print version + -c --compile-help compile online help only + + +This summarizes valid parameters and switches. Switches are shown with +both short form and long form. + +--help shows valid options and parameters, as above. + +--edit-only runs the Configuration Tool in a mode that +suppresses creation of a build tree, in case you only want to create and edit save files. + +--version shows version and build date information, and exits. + +--compile-help compiles help contents files from the HTML documentation +files that the tool finds in the eCos repository, and exits. + +

+Configuration Tool + +
+ + + +The Component Repository +When you invoke the eCos Configuration Tool, it accesses the Component + Repository, a read-only location of configuration + information. For an explanation of “Component + Repository” see . +The eCos Configuration Tool will look + for a component repository using (in descending order of preference): + + +A location specified on the command line + + + +The component repository most recently used by the +current user + + +An eCos distribution under /opt/ecos (under Linux) or a default location set by the installation procedure +(under Windows) + + +User input + + +The final case above will normally only occur if the previous + repository has been moved or (under Windows) installation information stored in + the Windows registry has been modified; it will result in a dialog box +being displayed that allows you to specify the repository location: +
+Repository relocation dialog box + +
+Note that in order to use the eCos Configuration Tool you are obliged to provide a + valid repository location. +In the rare event that you subsequently wish to change + the component location, select + Build->Repository + and the above dialog box will then be displayed. +You can check the location of the current repository, the current save file +path, and the current hardware template and default package, +by selecting Help->Repository Information.... +A summary will be displayed. +
+ +eCos Configuration Tool Documents + +Configuration Save File +eCos configuration settings and other information + (such as disabled conflicts) that are set using the + eCos Configuration Tool are saved to + a file between sessions. By default, when the + eCos Configuration Tool is first + invoked, it reads and displays information from the + Component Registry and displays the information in an + untitled blank document. You can perform the following + operations on a document: + +Save the currently active document +Use the “File->Save” menu + item or click the Save Document icon on the + toolbar; if the current document is unnamed, you will be prompted + to supply a name for the configuration save file. +
+Save As dialog box + +
+
+ +Open an existing document +Select File->Open, + or click the Open Document icon on the toolbar. + You will be prompted to supply a name for the configuration save + file. +
+Open dialog box + +
+
+ +Open a document you have used recently +Click its name at the bottom of the + File menu. +Documents may also be opened by: + + +double-clicking a Configuration Save File in the desktop +explorer (Windows only); + + +invoking the eCos +Configuration Tool +with the name of a Configuration File as command-line argument, +or by creating a shortcut to the eCos Configuration Tool with such an argument +(under Windows or a suitable Linux desktop environment). + + + + +Create a new blank document based on the Component + Registry +Select File->New, +or click the New Document icon on the toolbar. + + +Save to a different file name +Select File->Save + As. You will be prompted to supply a new + name for the configuration save file. + +
+ +Build and Install Trees +The location of the build and install trees are + derived from the eCos save file name as illustrated in the + following example: +Save file name = “c:\My + eCos\config1.ecc” +Install tree folder = “c:\My + eCos\config1_install” +Build tree folder = “c:\My + eCos\config1_build” +These names are automatically generated from the name + of the save file. +See also . + +
+ + + + + +Getting Help + +The eCos Configuration Tool contains +several methods for accessing online help. + + + + + +Context-sensitive Help for Dialogs +Most dialogs displayed by the eCos Configuration Tool are supplied +with context-sensitive help. You can then get help relating +to any control within the current dialog box by + + + +Right-clicking the control (or pressing + F1 + ) +A “What’s This?” popup menu will + be displayed. Click the menu to display a brief description of the + function of the selected control. + + +Clicking the question mark icon in the dialog + caption bar (Windows) or the question mark button on the dialog (Linux). +A question mark cursor will be displayed. Click on + any control to display a brief description of its + function. + + +Some dialogs may have a Help + button. You can press this to display a more general + description of the function of the dialog box as a whole. + This help will be in HTML form; for more information, see + below. + + + + + +Context-sensitive Help for Other Windows +In the Help menu, click + Help On... + +and then click on a window (or click on the arrow/question mark button +on the toolbar, then click on a window). A small popup window page describing the +window will be displayed. The same thing can be achieved by right-clicking +on a window and clicking on What's This?. + + + + +Context-sensitive Help for Configuration Items +In the configuration window, right-click on a configuration +item (or use Shift+F10). A context +menu will be displayed; select Visit Documentation +to display the page in the eCos documentation that most closely +corresponds to the selected item. + + + +Methods of Displaying HTML Help + + + + + +Using the internal help system. This will show an internal viewer similar to Microsoft HTML Help, with a contents +hierarchy on the left and HTML pages on the right; see . The index is regenerated for each repository. If the documentation in +the repository has changed but the contents does not reflect this, please use the Tools Regenerate Help Index menu +item. + + + + + +Using the default HTML browser. On Unix, you will need a .mailcap entry similar to this: + + + + +text/html; netscape -no-about-splash %s + + + + + + +Using the specified browser. + + + + + + +
+HTML Help viewer + +
+If you wish, you may choose to have HTML Help displayed +in a browser of your choice. To do this, select View->Settings and +use the controls in the View Documentation group to select the replacement browser. +Note that the Navigation facilities of the built-in HTML +Help system will be unavailable if you choose this method +of displaying help. +
+
+ +Customization +The following visual aspects of the eCos Configuration Tool can be changed to suit + individual preferences. These aspects are saved on a per-user + basis, so that when the eCos Configuration Tool is next invoked by the same + user, the appearance will be as set in the previous + session. + +Window Placement +The relative sizes of all windows in the eCos Configuration Tool may be adjusted by dragging + the splitter bars that separate the windows. The chosen + sizes will be used the next time the eCos Configuration Tool is invoked by the current + user. +All windows except the Configuration + Window may be shown or hidden by using the + commands under the View menu (for + example, View->Output) or the + corresponding keyboard accelerators + (Alt+1 to + Alt+4). + + +Your chosen set of windows (and their relative sizes) will +be preserved between invocations of the eCos Configuration +Tool. + + + +Settings +To change other visual aspects, select + View->Settings + and then select the Display and + View tabs depending on the settings + you wish to alter.. + The options are as follows: + + + + +Settings: Display tab + +
+Settings dialog, Display tab + +
+ + +Labels + +In the configuration window, you can choose to have + either descriptive names (the + default) or macro names displayed as + tree item labels. Descriptive names are generally more + comprehensible, but macro names are used in some contexts + such as conflict resolution and may be directly related to + the source code of the configuration. Note that it is + possible to search for an item in the configuration view + by selecting + Find->Edit + (see ). Both + descriptive names and macro names can be searched. + + + +Integer Items +You can choose to have integer items in the + Configuration Window displayed in decimal or hexadecimal + format. + + + +Font + + +Change the font for a particular window by selecting the window name using the drop-down list, +then clicking on Change Font to select a font for that +window. The changes will be applied when the press OK to dismiss the Settings dialog. +If you never make font changes, then the windows will take +the default setting determined by your current Windows or Unix environment. + + + + +Miscellaneous + + +If the Splash Screen checkbox is checked, a splash +window will appear as the application is loading. Uncheck this to eliminate the splash screen. + + + +
+ + +Settings: Viewers tab + +
+Settings dialog, Viewers tab + +
+ + +View header files + +You can change the viewer used to display header files. + + + +View documentation + +You can change the viewer used to display HTML files. +See . + + + + + + +
+ +
+
+ + + + +Screen Layout +The following windows are available within the eCos Configuration +Tool: + + + Configuration Window + + + Properties Window + + + Short Description + + + Conflicts + + + Output + + + +The layout of the windows may be adjusted to suit your + preferences: see . + + +Configuration Window +This is the principal window used to configure eCos. It + takes the form of a tree-based representation of the + configuration items within the currently loaded eCos + packages. +In the case of items whose values may be changed, + controls are available to set the item values. These either + take the form of check boxes or radio buttons within the + tree itself or cells to the right of the thin vertical + splitter bar. Controls in the tree may be used in the usual + way; cells, however, must first be activated. +To activate a cell, simply click on it: it will assume a sunken +appearance and data can then be edited in the cell. To terminate +in-cell editing, click elsewhere in the configuration window or +press ENTER. To discard the partial results +of in-cell editing and revert to the previous value, press ESCAPE. + + + +Cells come in three varieties, according to the type of + data they accept: + +Cell types + + + +Cell Type +Data Accepted + + + + +Integer +Decimal or hexadecimal values + + +Floating Point +Floating point values + + +String +Any + + + +
+In the case of string cells, you can double-click the cell +to display a dialog box containing a larger region in which to edit +the string value. This is useful in the case of long strings, or +those spanning multiple lines. + +Disabled items +Some items will appear disabled. In this case the item + label and any associated controls and cells will be + grayed. It is not be possible to change the values of + disabled items. + +Right-Clicking +You can right-click on an item in the configuration + window item to display a pop-up menu which (depending on + the type of the item selected) allows you to: + + + Properties – + information relating to the currently selected item + is displayed. The information is equivalent to that + displayed in the Properties + Window. + + + Restore Defaults - + the default value of the currently selected item is + restored. + + +Visit Documentation + - causes the HTML page most closely relating to the + currently selected item to be displayed. This has + the same effect as double-clicking the URL property + in the Properties Window. + + + View Header File + – this causes the file containing the items to + be displayed. This is equivalent to double-clicking + on the File property in the Properties Window. The + viewer used for this purpose may be changed using + the View->Settings menu item + (see ). + Note that this operation is only possible when the + current configuration is saved, in order to avoid + the possibility of changing the source + repository. + + +Unload Package - + this is equivalent to using the + Build->Packages menu item to + select and unload the package in + question. + + + + + +Conflicts Window +This window exists to display any configuration item + conflicts. Conflicts are the result of failures to meet + the requirements between configuration items expressed in + the CDL. See . +The window comprises three columns: + + + Item +This is the macro name of the first item involved + in the conflict. + + + + Conflict +This is a description of the conflict type. The currently + supported types are “unresolved”, “illegal + value”, “evaluation exception”, “goal + unsatisfied” and “bad data”. + + + + Property +This contains a description of the configuration + item’s property that caused the conflict. +Within the conflicts window you can right-click on + any item to display a context menu which allows you to + choose from one of the following options: + + + +To locate the item involved in the +conflict, double-click in the first or third column, or +right-click over the item and choose Locate +from the popup menu. + + +You can use the Tools->Resolve Conflicts menu +item, or right-click over the item and select Resolve from the popup menu, +to resolve conflicts — . + +Output Window +This window displays any output generated by + execution of external tools and any error messages that + are not suitable for display in other forms (for + example, as message boxes). +Within the output window you can right-click to display a +context menu which allows you to: + + +Save the contents of the window to a + file + + +Clear the contents of the + window + + + + +Properties Window +This window displays the CDL properties of the item + currently selected in the configuration window. The same + information may be displayed by right-clicking the item + and selecting “properties”. + +Two properties may be double-clicked as + follows: + + +URL – + double-clicking on a URL property causes the + referenced HTML page to be displayed. This has the + same effect as right-clicking on the item and + choosing “Visit + Documentation”. + + +File – + double-clicking on a File property in a saved + configuration causes the File to be displayed. The + viewer used for this purpose may be changed using + the View->Settings menu + item. Note that this operation is only possible when + the current configuration is saved, in order to + avoid the possibility of changing the source + repository. + + + + +Short Description Window +This window displays a short description of the item + currently selected in the configuration window. More + extensive documentation may be available by + right-clicking on the item and choosing “Visit + Documentation”. + + +
+
+ + +Updating the Configuration + +Adding and Removing Packages +To add or remove packages from the configuration, select + Build->Packages. + The following dialog box will be displayed: +
+Packages dialog box + +
+The left-hand list shows those packages that are available to + be loaded. The right-hand list shows those that are + currently loaded. In order to transfer packages from one + list to another (that is, to load or unload packages) + double-click the selection or click the + Add or Remove + buttons. + +The version drop-down list displays the versions of the + selected packages. When loading packages, this control may + be used to load versions other than the most recent + (current). Note that if more than one package is selected, + the version drop-down list will display only the versions + common to all the selected packages. + +The window under the version displays a brief + description of the selected package. If more than one + package is selected, this window will be blank. + + + Under the description window there is a Keywords +control into which you can type a string to be matched against +package names, macro names and descriptions. The lists are updated +a second or so after typing has stopped. +If you type several separate words, +all of these words must be associated with a given package +for that package to be displayed. If you select +the Match exactly checkbox, then the string +is taken to be a complete fragment and matched against the beginning +of a name, macro name or descriptions. All matches are done +case-insensitively. + + +If you check Omit hardware packages, only +non-hardware packages will be shown. + + +
+ +Platform Selection +To add, modify or remove entries in the list of + platforms used for running tests, select + Tools->Platforms. The following + dialog will be displayed: +
+Platforms dialog box + +
+You may add, modify or remove platform entries as you + wish, but in order to run tests, a platform must be defined + to correspond to the currently loaded hardware template. The + information associated with each platform name is used to + run tests. +To modify a platform, click the + Modify button with the appropriate + platform selected, or double-click on an entry in the list. + A dialog will be displayed that allows you to change the + command prefix, platform type and arguments for + GDB. +
+Platform Modify dialog box + +
+To add a new platform, click the + Add button. A similar dialog will be + displayed that allows you to define a new platform. To + remove a platform, click the Delete + button or press the DEL key with the + appropriate platform selected. + +The command prefix is used when running tests in order + to determine the names of the executables (such as gdb) to + be used. For example, if the gdb executable name is + “arm-elf-gdb.exe” the prefix should be set to + “arm-elf”. +The platform type indicates the capabilities of the platform +- whether it is hardware or a simulator, and whether breakpoints +are supported. +The arguments for the GDB field allow +additional arguments to be passed to gdb when it is used to run +a test. This is typically used in the case of simulators linked +to gdb in order to define memory layout. +
+ +Using Templates +To load a configuration based on a template, select + Build->Templates. +The following dialog box will be displayed: +
+Templates dialog box + +
+Change the hardware template, the packages template, or + both. To select a hardware template, choose from the first + drop-list. To choose a packages template, choose from the + second. Brief descriptions of each kind of template are + provided in the corresponding edit boxes. + +Resolving conflicts +During the process of configuring eCos it is possible + that conflicts will be created. For more details of the + meaning of conflicts, see . +The Conflicts Window displays all conflicts in the + current configuration. Additionally, a window in the + status bar displays a count of the conflicts. Because the + resolution of conflicts can be time-consuming, a mechanism + exists whereby conflicts can be resolved + automatically. +You can choose to have a conflicts resolution dialog + box displayed by means of the View->Settings... + menu item, on the Conflict Resolution +tab of the dialog. +
+Options + +
+You can choose to have conflicts checked under the + following circumstances: + + +After any item is changed (in other words, + as soon as the conflict is created) + + +Before saving the configuration (including + building) + + +Never + + +The method you chose depends on how much you need + your configuration to be free of conflicts. You may + want to avoid having to clean up all the conflicts at + once, or you may want to keep the configuration + consistent at all times. If you have major changes to + implement, which may resolve the conflicts, then you + might want to wait until after you have completed + these changes before you check for conflicts. + + +If you choose to check conflicts after any item + is changed, only newly arising conflicts are displayed. + If you choose to check for conflicts before saving the + configuration, the complete set is + displayed. + +
+ +Automatic resolution +If you check the “Automatically suggest + fixes” check box, a conflicts resolution dialog box + will be displayed whenever new conflicts are created. The + same dialog box may be displayed at any stage by means of + the Tools->Resolve Conflicts + menu item. + +The conflicts resolution dialog box contains two major windows. +
+Resolve conflicts window + +
+The upper contains the set of conflicts to be addressed; the +format of the data being as that of the Conflicts Window. The lower +window contains a set of proposed resolutions – each entry +is a suggested configuration item value change that as a whole may +be expected to lead to the currently selected conflict being resolved. +Note that there is no guarantee: + + +that automatic resolutions will be determinable for every +conflict. + + + that the resolutions for separate conflicts will be independent. +In other words, the resolution of one conflict may serve to prevent +the resolution of another. + + + that the resolution conflicts will not create further +conflicts. + + +The above warnings are, however, conservative. In practice +(so long as the number and extent of conflicts are limited) automatic +conflict resolution may be used to good effect to correct problems +without undue amounts of programmer intervention. +In order to select the conflicts to be applied, select or +clear the check boxes against the resolutions for each proposed +resolution. By default all resolutions are selected; you can return +to the default state (in other words, cause all check boxes for +each conflict to again become checked) by pressing the “Reset” button. +Note that multiple selection may be used in the resolutions control +to allow ranges of check boxes to be toggled in one gesture. +When you are happy to apply the selected resolutions for each +conflict displayed, click Apply; this will +apply the resolutions. Alternatively you may cancel from the dialog +box without any resolutions being applied. +
+
+
+ +Searching +Select Edit --> Find. +You will be presented with a Find dialog box: +
+Find dialog box + +
+Using this dialog box you can search for an exact text string +in any one of three ways, as specified by your selection in the “Search +in” drop-list: + + +Macro names - the search is for a text match within +configuration item macro names + + + Item names - the search is for a text match within +configuration item descriptive names + + + Short descriptions - the search is for a text match +within configuration item short descriptions + + +Note that to invoke Find you can also +click the Find icon on the toolbar. +
+ +Building +When you have configured eCos, you may build the configuration. +On the Build menu, click: + + + +Library + (or click the Build Library icon on the toolbar) – this +causes the eCos configuration to be built. The result of a successful +build will be (among other things) a library against which user +code can be linked + + + +Tests + – this causes the eCos configuration to be built, and +additionally builds the relevant test cases linked against the eCos library + + + +Clean + – this removes all intermediate files, thus causing a +subsequent build/library or build/tests operation +to cause recompilation of all relevant files. + + + +Stop + – this causes a currently executing build (any of the +above steps) to be interrupted + + +Build options may be displayed by using the Build->Options menu +item. This displays a dialog box containing a drop-list control +and two windows. The drop-list control allows you to select the +type of build option to be displayed (for example “LDFLAGS” are +the options applied at link-time. The left-hand window is a tree +view of the packages loaded in the current configuration. The right-hand +window is a list of the build options that will be used for the +currently selected package. +Note that this dialog box currently affords only read-only +access to the build options. In order to change build options you +must edit the relevant string configuration item. +A single level of inheritance is supported: each package’s +build options are combined with the global options (these are to +be found in the “Global build options” folder +in the configuration view). + + +Selecting Build Tools +Normally the installation process will supply the information +required for the eCosConfiguration Tool to +locate the build tools (compiler, linker, etc.) necessary +to perform a build. However if this information is not registered, +or it is necessary to specify the location manually (for example, +when a new toolchain installation has been made), select Tools->Paths->Build +Tools. The following dialog box will be displayed: +
+Build tools + +
+This dialog box allows you to locate the folder containing +the build tools. +
+ +Selecting User Tools +Normally the installation process will supply the information +required for the eCosConfiguration Tool to +locate the user tools (cat, ls, etc.) necessary to perform +a build. However if this information is not registered, or it is +necessary to specify the location manually (for example, when a +new toolchain installation has been made), select Tools->Paths->User +Tools. The following dialog box will be displayed: +
+User tools + +
+
+
+ +Execution +Test executables that have been linked using the Build/Tests +operation against the current configuration can be executed by selecting Tools->Run +Tests. +When tests are run, the Configuration Tool looks +for a platform name corresponding to the currently loaded hardware template. +If no such platform is found, a dialog will be displayed for you +to define one; this dialog is similar to that displayed by the Add function +in the Tools->Platforms dialog, but +in this case the platform name cannot be changed. +When a test run is invoked, a property sheet is displayed, +comprising three tabs: Executables, Output and Summary. +Note that the property sheet is resizable. +Three buttons appear on the property sheet itself: Run/Stop, Close and Properties. +The Run button is used to initiate a +test run. Those tests selected on the Executables tab +are run, and the output recorded on the Output and Summary tabs. +During the course of a run, the Run button +changes to “Stop”. The button may be used to interrupt +a test run at any point. + +Properties +The Properties button is used to change +the connectivity properties for the test run. +
+Properties dialog box + +
+ +Download Timeout + This group of controls serves to set the maximum time that + is allowed for downloading a test to the target board. If + the time is exceeded, the test will be deemed to have + failed for reason of “Download Timeout” and + the execution of that particular test will be abandoned. + This option only applies to tests run on hardware, not to + those executed in a simulator. Times are in units of + elapsed seconds. +Three options are available using the drop-down + list: + + +Calculated from file size - an estimate of the maximum +time required for download is made using the (stripped) executable +size and the currently used baud rate + + + Specified - a user-specified value may be entered in +the adjacent edit box + + + None - no maximum download time is to be applied. + + + + +Run time Timeout +This group of controls serves to set the maximum time + that is allowed for executing a test on the target board + or in a simulator. If the time is exceeded, the test will + be deemed to have failed for reason of + “Timeout” and the execution of that particular + test will be abandoned. In the case of hardware, the time + is measured in elapsed seconds: in the case of a simulator + it is in CPU seconds. +Three options are available using the drop-down + list: + + +None - no maximum download time is to be + applied. + + +Specified - a user-specified value may be + entered in the adjacent edit box + + +Default - a default value of 30 seconds is + used + + + + +Connection +The Connection controls may be used + to specify how the target board is to be accessed. + +If the target board is connected using a serial cable, the Serial radio +button should be checked. In this case you can select a port (COM1, +COM2, …) and an appropriate baud rate using drop-list boxes. +If the target board is accessed remotely using GDB remote +protocol, the “TCP/IP” radio button should +be checked. In this case you can select a host name and TCP/IP port +number using edit boxes. + + +Executables Tab +This is used to adjust the set of tests available for execution. +A check box against each executable name indicates whether that +executable will be included when the Run button +is pressed. The Check All and Uncheck +All buttons may be used to check or uncheck all items. +When the property sheet is first displayed, it will be pre-populated +with those test executables that have been linked using the Build/Tests +operation against the current configuration. +
+Run tests + +
+You can right-click in the window to display a context menu +containing Add and Remove items. +Clicking Remove will remove those executables +selected. Clicking Add will display a dialog +box that allows you to add to the set of items. Equivalently the Add button +may be used to add executables, and the DEL key +may be used to remove them. +You can use the Add from Folder button +to add a number of executables in a specified folder (optionally +including subfolders, if you click on Yes when +asked). +
+Add files from folder + +
+ + +
+ +Output Tab +This tab is used to display the output from running tests. +The output can be saved to a file or cleared by means of the popup +menu displayed when you right-click in the window. + + +Summary Tab +This tab is used to display a record, in summary form, of +those tests executed. For each execution, the following information +is displayed: + + + Time - the date and time of execution + + + Host - the host name of the machine +from which the test was downloaded + + + Platform - the platform on which +the test was executed + + + Executable - the executable (file +name) of the test executed + + + Status - the result of executing +the test. This will be one of the following: + + + Not started + + +No result + + +Inapplicable + + + Pass + + +DTimeout + + +Timeout + + +Cancelled + + + Fail + + +Assert fail + + + Size - the size [stripped/unstripped] of +the test executed + + + Download - the download time [mm:ss/mm:ss] used. +The first of the two times displayed represents the actual time +used: the second the limit time. + + + Elapsed - the elapsed time [mm:ss] used. + + + Execution - the execution time + [mm:ss/mm:ss] used. The first of the +two times displayed represents the actual time used: the second +the limit time. + + +The output can be saved to a file or cleared by means of the +popup menu displayed when you right-click in the window. + +
+
+ +Creating a Shell +To call up a shell window, select Tools->Shell. +Under Windows, you will get a Cygwin shell similar to the one below. On Linux, you will +get a standard Linux shell window. + + +Keyboard Accelerators +The following table presents the list of keyboard accelerators +that can be used with the Configuration Tool. + +Keyboard accelerators + + + + Accelerator + Action + Remarks + + + + + +Alt+1 +hide/show properties window + + + + +Alt+2 +hide/show output window + + + +Alt+3 +hide/show short description window + + + +Alt+4 +hide/show conflicts window + + + + +Ctrl+A +select alloutput +window and in-cell editing + +Ctrl+C +copyoutput window +and in-cell editing + +Ctrl+F +Edit->Find + +Ctrl+N +File->New + +Ctrl+O +File->Open + +Ctrl+S +File->Save + +Ctrl+V +Pastein-cell editing +only + +Ctrl+X +Cutin-cell-editing +only + +Ctrl+Z +Undoin-cell editing +only + +F1 +Context-sensitive help + +F3 +Find next + +F7 +Build->Library + +Shift+F7 +Build->Tests + +Alt+F6 +View->Next window + + +Shift+Alt+0 +View->Previous window + + +Shift+Ins +Pastein-cell editing +only + +Shift+F10 +Display context menuConfiguration +window + +Alt+Enter +Display properties dialog box +Configuration window + +> +Increment item valueConfiguration +window + +<Decrement +item valueConfiguration window + +Space +Toggle item valueConfiguration +window + + +
+ +
+
+ + diff --git a/doc/sgml/user-guide/configuration.sgml b/doc/sgml/user-guide/configuration.sgml new file mode 100644 --- /dev/null +++ b/doc/sgml/user-guide/configuration.sgml @@ -0,0 +1,1987 @@ + +Configuration and the Package Repository + +The following chapters contain information on running + ecosconfig (the command line tool that + manipulates configurations and constructs build trees) and on + managing a source repository across multiple versions of + eCos. + + +Manual Configuration +eCos developers using a Windows NT host will generally use + the graphical Configuration Tool for configuring an eCos + system and building the target library. At present there is no + equivalent to this tool available for developers using a UNIX + host, so command line tools have to be used instead. These + command line tools can also be used for batch operations on + all platforms, for example as part of a nightly rebuild + procedure. + +In the current release of the system the command line tools + do not provide exactly the same functionality as the graphical + tool. Most importantly, there is no facility to resolve + configuration conflicts interactively. +The eCos configuration system, both graphical and command + line tools, are under constant development and enhancement. + Developers should note that the procedures described may change + considerably in future releases. + +Directory Tree Structure +When building eCos there are three main directory trees to + consider: the source tree, the build tree, and the install + tree. +The source tree, also known as the component repository, + is read-only. It is possible to use a single component + repository for any number of different configurations, and + it is also possible to share a component repository between + multiple users by putting it on a network drive. +The build tree contains everything that is specific to a + particular configuration, including header and other files + that contain configuration data, and the object files that + result from compiling the system sources for this + configuration. +The install tree is usually located in the install subdirectory +of the build tree. Once an eCos system has been built, the install +tree contains all the files needed for application development including +the header files and the target library. By making copies of the +install tree after a build it is possible to separate application +development and system configuration, which may be desirable for +some organizations. + + +Creating the Build Tree +Generating a build tree is a non-trivial operation and + should not be attempted manually. Instead, eCos is shipped + with a tool called ecosconfig that should + be used to create a build tree. +Usually ecosconfig will be +run inside the build tree itself. If you are creating a new build +tree then typically you will create a new empty directory using +the mkdir command, cd into +that directory, and then invoke ecosconfig to +create a configuration. By default, the configuration is stored +in a file ecos.ecc in the current +directory. The configuration may be modified by editing this file directly. ecosconfig itself +deals with a number of coarse-grained configuration options such +as the target platform and the packages that should be used. +The ecosconfig tool is also +used subsequently to generate a build tree for a configuration. +Once a build tree exists, it is possible to run ecosconfig again +inside the same build tree. This will be neccessary if your wish +to change some of the configuration options. +ecosconfig does not generate +the top-level directory of the build tree; you must do this + yourself. +$ mkdir ecos-work +$ cd ecos-work +The next step is to run ecosconfig: +$ ecosconfig <qualifiers> <command> + +ecosconfig qualifiers +The available command line qualifiers for + ecosconfig are as follows. Multiple + qualifiers may be used on the command line: + + + + + +Provides basic usage guidelines for the + available commands and qualifiers. + + + + + +Specifies an eCos configuration save file for + use by the tool. By default, the file + ecos.ecc in the + current directory is used. Developers may prefer to + use a common location for all their eCos + configurations rather than keep the configuration + information in the base of the build tree. + + + + + +Specifies an alternative location for the + install tree. By default, the install tree resides + inside the install + directory in the build tree. Developers may prefer + to locate the build tree in a temporary file + hierarchy but keep the install tree in a more + permanent location. + + + + + +Specifies the location of the component + repository. By default, the tool uses the location + specified in the + ECOS_REPOSITORY + environment variable. Developers may prefer to use + of this qualifier if they are working with more than + one repository. + + + + + +Disables the implicit resolution of conflicts + while manipulating the configuration data. + developers may prefer to reslove conflicts by + editing the eCos configuration save file + manually. + + + + + + + +By default, ecosconfig will exit with an error code if the current +configuration contains any conflicts, and it is not possible to +generate or update a build tree for such configurations. This +qualifier causes ecosconfig to ignore such problems, and hence it is +possible to generate a build tree even if there are still +conflicts. Of course, there are no guarantees that the resulting +system will actually do anything. + + + + + + + + +Display more information. + + + + + + + + +Display less information. + + + + + +The , and + qualifiers can also be written with two arguments, +for example: + +ecosconfig --srcdir <dir> ... + +This simplifies filename completion with some shells. + + + +ecosconfig commands +The available commands for + ecosconfig are as + follows: + + +list + +Lists the available packages, targets and + templates as installed in the eCos repository. + Aliases and package versions are also + reported. + + + +new <target> [<template> [<version>]] + +Creates a new eCos configuration for + the specified target hardware and saves it. A + software template may also be specified. By default, + the template named ‘default’ is used. If + the template version is not specified, the latest + version is used. + + + +target <target> + +Changes the target hardware selection + for the eCos configuration. This has the effect of + unloading packages supporting the target selected + previously and loading the packages which support + the new hardware. This command will be used + typically when switching between a simulator and + real hardware. + + + +template <template> [<version>] + +Changes the template selection for the eCos + configuration. This has the effect of unloading + packages specified by the template selected + previously and loading the packages specified by the + new template. By default, the latest version of the + specified template is used. + + + +remove <packages> + +Removes the specified packages from the eCos + configuration. This command will be used typically + when the template on which a configuration is based + contains packages which are not required. + + + +add <packages> + +Adds the specified packages to the eCos configuration. This +command will be used typically when the template on which a +configuration is based does not contain all the packages which are +required.For example, add-on packages provided by third parties will +not be known to the standard templates, so they will have to be added +explicitly. + + + +version <version> <packages> + +Selects the specified version of a + number of packages in the eCos configuration. By + default, the most recent version of each package is + used. This command will be used typically when an + older version of a package is required. + + + +check + +Presents the following information + concerning the current configuration: + + +the selected target hardware + + +the selected template + + +additional packages + + +removed packages + + +the selected version of packages + where this is not the most recent + version + + +conflicts in the current configuration + + + + + +resolve + +Resolves conflicts identified in the + current eCos configuration by invoking an inference + capability. Resolved conflicts are reported, but not + all conflicts may be resolvable. This command will + be used typically following manual editing of the + configuration. + + + +export <file> + +Exports a minimal eCos configurastion + save file with the specified name. This file + contains only those options which do not have their + default value. Such files are used typically to + transfer option values from one configuration to + another. + + + +import <file> + +Imports a minimal eCos configuration + save file with the specified name. The values of + those options specified in the file are applied to + the current configuration. + + + +tree + +Generates a build tree based on the current eCos + configuration. This command will be used typically + just before building eCos.Normally a build tree can +only be generated if if the configuration has no unresolved +conflicts, but can be used to override +this. + + + + + + +Conflicts and constraints +Configuration options are not completely independent. For example +the C library's strtod() and atof() +functions rely on the math library package to provide certain functionality. If the math library package is removed then the C +library can no longer provide these functions. Each package describes constraints like these in CDL "requires" properties. If a constraint is not satisfied, then the configuration contains a conflict. For any given conflict there can +be several resolution options. For example, it would be possible to add the math library package back to the +configuration, or to disable the strtod() and atof() functions. + +The eCos configuration tools will report any conflicts in the current configuration. If there are any such conflicts +then the configuration is usually unsafe and it makes no sense to build and run eCos in such circumstances. In fact, +any attempt at building eCos is likely to fail. In exceptional cases it is possible to override this by using e.g. the + qualifier with ecosconfig. + + +Many constraints are fairly simple in nature, and the configuration tools contain an inference engine which can +resolve the associated conflicts automatically. For example, if the math library package is removed then the +inference engine can resolve the resulting conflict by disabling the configuration option for strtod() and atof(). All +such changes will be reported. Sometimes the inference engine cannot resolve a conflict, for example it is not +allowed to override a change that has been made explicitly by the user. Sometimes it will find a solution which does +not match the application's requirements. + + +A typical session involving conflicts would look something like this: + +$ ecosconfig new pid +This creates a new configuration with the default template. For most targets this will not result in any conflicts, +because the default settings for the various options meet the requirements of the default template. + For some targets +there may be conflicts and the inference engine would come into play. + +$ ecosconfig remove libm +U CYGSEM_LIBC_STDIO_SCANF_FLOATING_POINT, new inferred value 0 +U CYGFUN_LIBC_strtod, new inferred value 0 +U CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT, new inferred value 0 + +ecosconfig reports that this change caused three conflicts, all in the C library. The inference engine was able to +resolve all the conflicts and update the relevant configuration options accordingly. +To suppress the inference engine can be used: + +$ ecosconfig new pid +$ ecosconfig --no-resolve remove libm +C CYGSEM_LIBC_STDIO_SCANF_FLOATING_POINT, "requires" constraint not satisfied: CYGPKG_LIBM +C CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT, "requires" constraint not satisfied: CYGPKG_LIBM +C CYGFUN_LIBC_strtod, "requires" constraint not satisfied: CYGPKG_LIBM + +Three unresolved conflicts are reported. + +The check command can be used to get the current state of the +configuration, and the qualifier will provide additional information: + +$ ecosconfig --srcdir /home/bartv/ecc/ecc --verbose check +Target: pid +Template: default +Removed: + CYGPKG_LIBM +3 conflict(s): +C CYGFUN_LIBC_strtod, "requires" constraint not satisfied: CYGPKG_LIBM + Possible solution: + CYGFUN_LIBC_strtod -> 0 + CYGSEM_LIBC_STDIO_SCANF_FLOATING_POINT -> 0 +C CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT, "requires" constraint not satisfied: CYGPKG_LIBM + Possible solution: + CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT -> 0 +C CYGSEM_LIBC_STDIO_SCANF_FLOATING_POINT, "requires" constraint not satisfied: CYGPKG_LIBM + Possible solution: + CYGSEM_LIBC_STDIO_SCANF_FLOATING_POINT -> 0 + + +If the proposed solutions are acceptable, the resolve command can be used to apply them: + +$ ecosconfig resolve +U CYGSEM_LIBC_STDIO_SCANF_FLOATING_POINT, new inferred value 0 +U CYGFUN_LIBC_strtod, new inferred value 0 +U CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT, new inferred value 0 + +The current configuration is again conflict-free and it is possible to generate a build tree. The qualifier can +be used to suppress the change messages, if desired. + +When changing individual configuration options by editing the ecos.ecc file (as described below), the resulting +system should be checked and any problems should be resolved. For example, if CYGFUN_LIBC_strtod is +explicitly enabled in the savefile: + +$ edit ecos.ecc +$ ecosconfig check +Target: pid +Template: default +Removed: + CYGPKG_LIBM +1 conflict(s): +C CYGFUN_LIBC_strtod, "requires" constraint not satisfied: CYGPKG_LIBM +$ ecosconfig resolve +C CYGFUN_LIBC_strtod, "requires" constraint not satisfied: CYGPKG_LIBM + +In this case the inference engine cannot resolve the conflict automatically because that would involve changing a +user setting. Any attempt to generate a build tree will fail: + +$ ecosconfig --srcdir /home/bartv/ecc/ecc tree +C CYGFUN_LIBC_strtod, "requires" constraint not satisfied: CYGPKG_LIBM +Unable to generate build tree, this configuration still contains conflicts. +Either resolve the conflicts or use --ignore-errors + + +It is still possible to generate a build tree: + +$ ecosconfig --srcdir /home/bartv/ecc/ecc --ignore-errors tree +C CYGFUN_LIBC_strtod, "requires" constraint not satisfied: CYGPKG_LIBM +$ make + +In this case eCos will fail to build. In other cases of unresolved conflicts eCos may build, but may not run. In +general all conflicts should be resolved by editing the ecos.ecc file, by letting the inference engine make appropriate +changes, or by other means, before any attempt is made to build or run eCos. + + + +Building the System +Once a build tree has been generated with + ecosconfig, building eCos is straightforward: +$ make +The build tree contains the subdirectories, makefiles, + and everything else that is needed to generate the default + configuration for the selected architecture and platform. + The only requirement is that the tools needed for that + architecture, for example + powerpc-eabi-g++, + are available using the standard search path. If this is not + the case then the make will + fail with an error message. If you have a multiprocessor + system then it may be more efficient to use: +$ make -j n +where n is equal to the + number of processors on your system. +Once the make process + has completed, the install tree will contain the header + files and the target library that are needed for application + development. +It is also possible to build the system’s test cases +for the current configuration: +$ make tests +The resulting test executables will end up in a + tests subdirectory of the + install tree. +If disk space is scarce then it is possible to make the copy +of the install tree for application development purposes, and then +use: +$ make clean +The build tree will now use up a minimum of disk space — the +bulk of what is left consists of configuration header files that +you may have edited and hence should not be deleted automatically. +However, it is possible to rebuild the system at any time without +reinvoking ecosconfig, just by +running make again. +Under exceptional circumstances it may be necessary to run make +clean for other reasons, such as when a new release +of the toolchain is installed. The toolchain includes a number of +header files which are closely tied to the compiler, for example limits.h, +and these header files are not and should not be duplicated by eCos. +The makefiles perform header file dependency analysis, so that when +a header file is changed all affected sources will be rebuilt during +the next make. This is very useful +when the configuration header files are changed, but it also means +that a build tree containing information about the locations of +header files must be rebuilt. If a new version of the toolchain +is installed and the old version is removed then this location information +is no longer accurate, and make will +complain that certain dependencies cannot be satisfied. Under such circumstances +it is necessary to do a make clean first. + + +Packages +eCos is a component architecture. The system comes as a + number of packages which can be + enabled or disabled as required, and new packages can be + added as they become available. Unfortunately, the packages + are not completely independent: for example the µITRON + compatibility package relies almost entirely on + functionality provided by the kernel package, and it would + not make sense to try to build µITRON if the kernel + was disabled. The C library has fewer dependencies: some + parts of the C library rely on kernel functionality, but it + is possible to disable these parts and thus build a system + that has the C library but no kernel. The + ecosconfig tool has the capability of + checking that all the dependencies are satisfied, but it + may still be possible to produce configurations that will + not build or (conceivably) that will build but not run. + Developers should be aware of this and take appropriate + care. +By default, ecosconfig will +include all packages that are appropriate for the specified hardware +in the configuration. The common HAL package and +the eCos infrastructure must be present in every configuration. In +addition, it is always necessary to have one architectural HAL package +and one platform HAL package. Other packages are optional, and can +be added or removed from a configuration as required. +The application may not require all of the packages; for example, +it might not need the µITRON compatibility +package, or the floating point support provided by the math library. +There is a slight overhead when eCos is built because the packages +will get compiled, and there is also a small disk space penalty. +However, any unused facilities will get stripped out at link-time, +so having redundant packages will not affect the final executable. + + +Coarse-grained Configuration +Coarse-grained configuration of + an eCos system means making configuration changes using the + ecosconfig tool. These changes + include: + + +switching to different target hardware + + +switching to a different template + + +adding or removing a package + + +changing the version of a package + + +Whenever ecosconfig generates or + updates an eCos configuration, it generates a configuration + save file. +Suppose that the configuration was first created using + the following command line: +$ ecosconfig new stdeval1 +To change the target hardware to the Cogent CMA28x + PowerPC board, the following command would be needed: + +$ ecosconfig target cma28x +To switch to the PowerPC simulator instead: +$ ecosconfig target psim +As the hardware changes, hardware-related packages such as +the HAL packages and device drivers will be added to and removed +from the configuration as appropriate. +To remove any package from the current configuration, use +the remove command: +$ ecosconfig remove uitron +You can disable multiple packages using multiple arguments, +for example: +$ ecosconfig remove uitron libm +If this turns out to have been a mistake then you can + reenable one or more packages with the + add command: +$ ecosconfig add libm +Changing the desired version for a package is also + straightforward: +$ ecosconfig version v1_3_1 kernel +It is necessary to regenerate the build tree and header + files following any changes to the configuration before + rebuilding eCos: +$ ecosconfig tree + + +Fine-grained Configuration +ecosconfig only provides + coarse-grained control over the configuration: the hardware, + the template and the packages that should be built. Unlike + the Configuration Tool, + ecosconfig does not provide + any facilities for manipulating finer-grained configuration options such as how many + priority levels the scheduler should support. There are + hundreds of these options, and manipulating them by means of + command line arguments would not be sensible. +In the current system fine-grained configuration options may +be manipulated by manual editing of the configuration file. When +a file has been edited in this way, the ecosconfig tool +should be used to check the configuration for any conflicts which +may have been introduced: +$ ecosconfig check +The check command will list +all conflicts and will also rewrite the configuration file, propagating +any changes which affect other options. The user may choose to resolve +the conflicts either by re-editing the configuration file manually +or by invoking the inference engine using the resolve command: +$ ecosconfig resolve +The resolve command will +list all conflicts which can be resolved and save the resulting changes +to the configuration. +It is necessary to regenerate the build tree and header files +following any changes to the configuration before rebuilding eCos: +$ ecosconfig tree +All the configuration options and their descriptions are listed +in the eCos Reference Manual. + + +Editing an eCos Savefile +The eCos configuration information is held in a single + savefile, typically ecos.ecc, which can + be generated by either the GUI configuration tool or by the + command line ecosconfig tool. The file + normally exists at the top level of the build tree. It is a + text file, allowing the various configurations options to be + edited inside a suitable text editor or by other programs or + scripts, as well as in the GUI config tool. +An eCos savefile is actually a script in the Tcl programming +language, so any modifications to the file need to preserve Tcl +syntax. For most configuration options, any modifications will be +trivial and there is no need to worry about Tcl syntax. For example, +changing a 1 to a 0 to disable an option. For more complicated +options, for example CYGDAT_UITRON_TASK_EXTERNS +, which involves some lines of C code, more care has +to be taken. If an edited savefile is no longer a valid Tcl script +then the configuration tools will be unable to read back the data +for further processing, for example to generate a build tree. An +outline of Tcl syntax is given below. One point worth noting here +is that a line that begins with a “#” is +usually a comment, and the bulk of an eCos savefile actually consists +of such comments, to make it easier to edit. + +Header +An eCos savefile begins with a header, which typically + looks something like this: +# eCos saved configuration +# ---- commands -------------------------------------------------------- +# This section contains information about the savefile format. +# It should not be edited. Any modifications made to this section +# may make it impossible for the configuration tools to read +# the savefile. + +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command +cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +This section of the savefile is intended for use by the + configuration system, and should not be edited. If this + section is edited then the various configuration tools may no + longer be able to read in the modified savefile. + + +Toplevel Section +The header is followed by a section that defines the + configuration as a whole. A typical example would + be: +# ---- toplevel -------------------------------------------------------- +# This section defines the toplevel configuration object. The only +# values that can be changed are the name of the configuration and +# the description field. It is not possible to modify the target, +# the template or the set of packages simply by editing the lines +# below because these changes have wide-ranging effects. Instead +# the appropriate tools should be used to make such modifications. + +cdl_configuration eCos { +description ““ ; + +# These fields should not be modified. +hardware pid ; +template uitron ; +package -hardware CYGPKG_HAL_ARM current ; +package -hardware CYGPKG_HAL_ARM_PID current ; +package -hardware CYGPKG_IO_SERIAL current ; +package -template CYGPKG_HAL current ; +package -template CYGPKG_IO current ; +package -template CYGPKG_INFRA current ; +package -template CYGPKG_KERNEL current ; +package -template CYGPKG_UITRON current ; +package -template CYGPKG_LIBC current ; +package -template CYGPKG_LIBM current ; +package -template CYGPKG_DEVICES_WALLCLOCK current ; +package -template CYGPKG_ERROR current ; +}; + +This section allows the configuration tools to reload the +various packages that make up the configuration. Most of the information +should not be edited. If it is necessary to add a new package or +to remove an existing one then the appropriate tools should be used +for this, for example: +$ ecosconfig remove CYGPKG_LIBM +There are two fields which can be edited. Configurations have +a name; in this case eCos. They can also have a description, which +is some arbitrary text. The configuration tools do not make use +of these fields, they exist so that users can store additional information +about a configuration. + + +Conflicts Section +The toplevel section is followed by details of all the + conflicts (if any) in the configuration, for + example: +# ---- conflicts ------------------------------------------------------- +# There are 2 conflicts. +# +# option CYGNUM_LIBC_TIME_DST_DEFAULT_OFFSET +# Property LegalValues +# Illegal current value 100000 +# Legal values are: -90000 to 90000 +# +# option CYGSEM_LIBC_TIME_CLOCK_WORKING +# Property Requires +# Requires constraint not satisfied: CYGFUN_KERNEL_THREADS_TIMER + +When editing a configuration you may end up with something +that is invalid. Any problems in the configuration will be reported +in the conflicts section. In this case there are two conflicts. +The option CYGNUM_LIBC_TIME_DST_DEFAULT_OFFSET has +been given an illegal value: typically this would be fixed by searching +for the definition of that option later on in the savefile and modifying +the value. The second conflict is more interesting, an unsatisfied requires constraint. +Configuration options are not independent: disabling some functionality +in, say, the kernel, can have an impact elsewhere; in this case +the C library. The various dependencies between the options are +specified by the component developers and checked by the configuration +system. In this case there are two obvious ways in which the conflict could +be resolved: re-enabling CYGFUN_KERNEL_THREADS_TIMER, +or disabling CYGSEM_LIBC_TIME_CLOCK_WORKING. +Both of these options will be listed later on in the file. +Some care has to be taken when modifying configuration options, +to avoid introducing new conflict. For instance it is possible that +there might be other options in the system which have a dependency +on CYGSEM_LIBC_TIME_CLOCK_WORKING, +so disabling that option may not be the best way to resolve the +conflict. Details of all such dependencies are provided in the appropriate +places in the savefile. +It is not absolutely required that a configuration be conflict-free +before generating a build tree and building eCos. It is up to the +developers of each component to decide what would happen if an attempt +is made to build eCos while there are still conflicts. In serious +cases there is likely to be a compile-time failure, or possibly +a link-time failure. In less serious cases the system may build +happily and the application can be linked with the resulting library, +but the component may not quite function as intended - although +it may still be good enough for the specific needs of the application. +It is also possible that everything builds and links, but once in +a while the system will unaccountably crash. Using a configuration +that still has conflicts is done entirely at the user’s +risk. + + +Data Section +The bulk of the savefile lists the various packages, + components, and options, including their values and the + various dependencies. A number of global options come + first, especially those related to the build process such + as compiler flags. These are followed by the various + packages, and the components and options within those + packages, in order. +Packages, components and options are organized in a + hierarchy. If a particular component is disabled then all + options and sub-components below it will be inactive: any + changes made to these will have no effect. The savefile + contains information about the hierarchy in the form of + comments, for example: +cdl_package CYGPKG_KERNEL ... +# > +cdl_component CYGPKG_KERNEL_EXCEPTIONS ... +# > +cdl_option CYGSEM_KERNEL_EXCEPTIONS_DECODE ... +cdl_option CYGSEM_KERNEL_EXCEPTIONS_GLOBAL ... +# < +cdl_component CYGPKG_KERNEL_SCHED ... +# > +cdl_option CYGSEM_KERNEL_SCHED_MLQUEUE ... +cdl_option CYGSEM_KERNEL_SCHED_BITMAP ... +# < +# < + +This corresponds to the following hierarchy: + CYGPKG_KERNEL + CYGPKG_KERNEL_EXCEPTIONS + CYGSEM_KERNEL_EXCEPTIONS_DECODE + CYGSEM_KERNEL_EXCEPTIONS_GLOBAL + CYGPKG_KERNEL_SCHED + CYGSEM_KERNEL_SCHED_MLQUEUE + CYGSEM_KERNEL_SCHED_BITMAP + +Providing the hierarchy information in this way allows + programs or scripts to analyze the savefile and readily + determine the hierarchy. It could also be used by a + sufficiently powerful editor to support structured editing + of eCos savefiles. The information is not used by the + configuration tools themselves since they obtain the + hierarchy from the original CDL scripts. +Each configurable entity is preceded by a comment, of + the following form: +# Kernel schedulers +# doc: ref/ecos-ref/ecos-kernel-overview.html#THE-SCHEDULER +# The eCos kernel provides a choice of schedulers. In addition +# there are a number of configuration options to control the +# detailed behaviour of these schedulers. +cdl_component CYGPKG_KERNEL_SCHED { +... +}; + +This provides a short textual alias + Kernel schedulers for the + component. If online documentation is available for the + configurable entity then this will come next. Finally + there is a short description of the entity as a whole. All + this information is provided by the component + developers. +Each configurable entity takes the form: +<type> <name> { + <data> +}; +Configurable entities may not be active. This can be either +because the parent is disabled or inactive, or because there are +one or more active_if properties. Modifying +the value of an inactive entity has no effect on the configuration, +so this information is provided first: + +cdl_option CYGSEM_KERNEL_EXCEPTIONS_DECODE { +# This option is not active +# The parent CYGPKG_KERNEL_EXCEPTIONS is disabled +... +}; + +... + +cdl_option CYGIMP_IDLE_THREAD_YIELD { +# This option is not active +# ActiveIf constraint: (CYGNUM_KERNEL_SCHED_PRIORITIES == 1) +# CYGNUM_KERNEL_SCHED_PRIORITIES == 32 +# --> 0 +... +}; + + +For CYGIMP_IDLE_THREAD_YIELD the +savefile lists the expression that must be satisfied if the option +is to be active, followed by the current value of all entities that +are referenced in the expression, and finally the result of evaluating +that expression. +Not all options are directly modifiable in the savefile. First, +the value of packages (which is the version of that package loaded +into the configuration) cannot be modified here. + + +cdl_package CYGPKG_KERNEL { +# Packages cannot be added or removed, nor can their version be changed, +# simply by editing their value. Instead the appropriate configuration +# should be used to perform these actions. +... +}; + + +The version of a package can be changed using e.g.: +$ ecosconfig version 1.3 CYGPKG_KERNEL +Even though a package’s value cannot be modified +here, it is still important for the savefile to contain the details. +In particular packages may impose constraints on other configurable +entities and may be referenced by other configurable entities. Also +it would be difficult to understand or extract the configuration’s +hierarchy if the packages were not listed in the appropriate places +in the savefile. +Some components (or, conceivably, options) do not have any +associated data. Typically they serve only to introduce another +level in the hierarchy, which can be useful in the context of the +GUI configuration tool. + + +cdl_component CYGPKG_HAL_COMMON_INTERRUPTS { +# There is no associated value. +}; + + +Other components or options have a calculated value. These +are not user-modifiable, but typically the value will depend on +other options which can be modified. Such calculated options can +be useful when controlling what gets built or what ends up in the +generated configuration header files. A calculated value may also +effect other parts of the configuration, for instance, via a requires constraint. + + +cdl_option BUFSIZ { +# Calculated value: CYGSEM_LIBC_STDIO_WANT_BUFFERED_IO ? CYGNUM_LIBC_STDIO_BUFSIZE : 0 +# CYGSEM_LIBC_STDIO_WANT_BUFFERED_IO == 1 +# CYGNUM_LIBC_STDIO_BUFSIZE == 256 +# Current_value: 256 +}; + + +A special type of calculated value is the interface. +The value of an interface is the number of active and enabled options +which implement that interface. Again the value +of an interface cannot be modified directly; only by modifying the +options which implement the interface. However, an interface can +be referenced by other parts of the configuration. +cdl_interface CYGINT_KERNEL_SCHEDULER { +# Implemented by CYGSEM_KERNEL_SCHED_MLQUEUE, active, enabled +# Implemented by CYGSEM_KERNEL_SCHED_BITMAP, active, disabled +# This value cannot be modified here. +# Current_value: 1 +# Requires: 1 == CYGINT_KERNEL_SCHEDULER +# CYGINT_KERNEL_SCHEDULER == 1 +# --> 1 + + +# The following properties are affected by this value +# interface CYGINT_KERNEL_SCHEDULER +# Requires: 1 == CYGINT_KERNEL_SCHEDULER +}; +If the configurable entity is modifiable then there will be +lines like the following: + +cdl_option CYGSEM_KERNEL_SCHED_MLQUEUE { +... +# Flavor: bool +# No user value, uncomment the following line to provide one. +# user_value 1 +# value_source default +# Default value: 1 +... +}; + + +Configurable entities can have one of four different flavors: +none, bool, data and booldata. Flavor none indicates that there +is no data associated with the entity, typically it just acts as +a placeholder in the overall hierarchy. Flavor bool is the most +common, it is a simple yes-or-no choice. Flavor data is for more +complicated configuration choices, for instance the size of an array +or the name of a device. Flavor booldata is a combination of bool +and data: the option can be enabled or disabled, and there is some +additional data associated with the option as well. +In the above example the user has not modified this particular +option, as indicated by the comment and by the commented-out user_value line. +To disable this option the file should be edited to: + + +cdl_option CYGSEM_KERNEL_SCHED_MLQUEUE { +... +# Flavor: bool +# No user value, uncomment the following line to provide one. +user_value 0 +# value_source default +# Default value: 1 +... +} + + +The comment preceding the user_value +0 line can be removed if desired, otherwise it +will be removed automatically the next time the file is read and +updated by the configuration tools. +Much the same process should be used for options with the +data flavor, for example: + +cdl_option CYGNUM_LIBC_TIME_DST_DEFAULT_OFFSET { +# Flavor: data +# No user value, uncomment the following line to provide one. +# user_value 3600 +# value_source default +# Default value: 3600 +# Legal values: -90000 to 90000 +}; + + +can be changed to: + + +cdl_option CYGNUM_LIBC_TIME_DST_DEFAULT_OFFSET { +# Flavor: data +user_value 7200 +# value_source default +# Default value: 3600 +# Legal values: -90000 to 90000 }; + + +Note that the original text provides the default value in +the user_value comment, +on the assumption that the desired new value is likely to be similar +to the default value. The value_source comment +does not need to be updated, it will be fixed up if the savefile +is fed back into the configuration system and regenerated. +For options with the booldata flavor, the user_value line +needs take two arguments. The first argument is for the boolean +part, the second for the data part. For example: + +cdl_component CYGNUM_LIBM_COMPATIBILITY { +# Flavor: booldata +# No user value, uncomment the following line to provide one. +# user_value 1 POSIX +# value_source default +# Default value: 1 POSIX +# Legal values: “POSIX” “IEEE” “XOPEN” “SVID” +... +}; + + +could be changed to: + +cdl_component CYGNUM_LIBM_COMPATIBILITY { +# Flavor: booldata +user_value 1 IEEE +# value_source default +# Default value: 1 POSIX +# Legal values: “POSIX” “IEEE” “XOPEN” “SVID” +... +}; + + +or alternatively, if the whole component should be disabled, +to: + +cdl_component CYGNUM_LIBM_COMPATIBILITY { +# Flavor: booldata +user_value 0 POSIX +# value_source default +# Default value: 1 POSIX +# Legal values: “POSIX” “IEEE” “XOPEN” “SVID” +... +}; + + +Some options take values that span multiple lines. An example +would be: + + +cdl_option CYGDAT_UITRON_MEMPOOLVAR_INITIALIZERS { +# Flavor: data +# No user value, uncomment the following line to provide one. +# user_value \ +# “CYG_UIT_MEMPOOLVAR( vpool1, 2000 ), \\ +# CYG_UIT_MEMPOOLVAR( vpool2, 2000 ), \\ +# CYG_UIT_MEMPOOLVAR( vpool3, 2000 ),” +# value_source default +# Default value: \ +# “CYG_UIT_MEMPOOLVAR( vpool1, 2000 ), \\ +# CYG_UIT_MEMPOOLVAR( vpool2, 2000 ), \\ +# CYG_UIT_MEMPOOLVAR( vpool3, 2000 ),” +}; + + +Setting a user value for this option involves uncommenting +and modifying all relevant lines, for example: + + +cdl_option CYGDAT_UITRON_MEMPOOLVAR_INITIALIZERS { +# Flavor: data +user_value \ +“CYG_UIT_MEMPOOLVAR( vpool1, 4000 ), \\ +CYG_UIT_MEMPOOLVAR( vpool2, 4000 ),” +# value_source default +# Default value: \ +# “CYG_UIT_MEMPOOLVAR( vpool1, 2000 ), \\ +# CYG_UIT_MEMPOOLVAR( vpool2, 2000 ), \\ +# CYG_UIT_MEMPOOLVAR( vpool3, 2000 ),” +}; + + +In such cases appropriate care has to be taken to preserve +Tcl syntax, as discussed below. +The configuration system has the ability to keep track of + several different values for any given option. All options + start off with a default value, in other words their value + source is set to default. If a + configuration involves conflicts and the configuration + system’s inference engine is allowed to resolve these + automatically then it may provide an + inferred value instead, for + example: + + +cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT { +# Flavor: bool +# No user value, uncomment the following line to provide one. +# user_value 1 +# The inferred value should not be edited directly. +inferred_value 0 +# value_source inferred +# Default value: 1 +... +}; + + +Inferred values are calculated by the configuration system +and should not be edited by the user. If the inferred value is not +correct then a user value should be substituted instead: + + +cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT { +# Flavor: bool +user_value 1 +# The inferred value should not be edited directly. +inferred_value 0 +# value_source inferred +# Default value: 1 +... +}; +The inference engine will not override a user value with an +inferred one. Making a change like this may well re-introduce a +conflict, since the inferred value was only calculated to resolve +a conflict. Another run of the inference engine may find a different +and more acceptable way of resolving the conflict, but this is not guaranteed +and it may be up to the user to examine the various dependencies +and work out an acceptable solution. +Inferred values are listed in the savefile because the exact +inferred value may depend on the order in which changes were made +and conflicts were resolved. If the inferred values were absent +then it is possible that reloading a savefile would not exactly +restore the configuration. Default values on the other hand are +entirely deterministic so there is no actual need for the values +to be listed in the savefile. However, the default value can be +very useful information so it is provided in a comment. +Occasionally the user will want to do some experimentation, +and temporarily switch an option from a user value back to a default +or inferred one to see what the effect would be. This could be achieved +by simply commenting out the user value. For instance, if the current +savefile contains: + +cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT { +# Flavor: bool +user_value 1 +# The inferred value should not be edited directly. +inferred_value 0 +# value_source user +# Default value: 1 +... +}; + + +then the inferred value could be restored by commenting out +or removing the user_value line: + +cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT { +# Flavor: bool +# user_value 1 +# The inferred value should not be edited directly. +inferred_value 0 +# value_source user +# Default value: 1 +... +}; + + +This is fine for simple values. However if the value is complicated +then there is a problem: commenting out the user_value line +or lines means that the user value becomes invisible to the configuration system, +so if the savefile is loaded and then regenerated the information +will be lost. An alternative approach is to keep the user_value but +explicitly set the value_source line, +for example: + + +cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT { +# Flavor: bool +user_value 1 +# The inferred value should not be edited directly. +inferred_value 0 +value_source inferred +# Default value: 1 +... +}; + + +In this case the configuration system will use the inferred +value for the purposes of dependency analysis etc., even though +a user value is present. To restore the user value the value_source line +can be commented out again. If there is no explicit value_source then +the configuration system will just use the highest priority one: +the user value if it exists; otherwise the inferred value if it +exists; otherwise the default value which always exists. +The default value for an option can be a simple constant, +or it can be an expression involving other options. In the latter +case the expression will be listed, together with the values for +all options referenced in the expression and the current result +of evaluating that expression. This is for informational purposes +only, the default value is always recalculated deterministically +when loading in a savefile. + + +cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { +# Flavor: data +# No user value, uncomment the following line to provide one. +# user_value arm-elf +# value_source default +# Default value: CYGHWR_THUMB ? “thumb-elf” : “arm-elf” +# CYGHWR_THUMB == 0 +# --> arm-elf +}; + + +For options with the data or booldata flavor, there are likely +to be constraints on the possible values. If the value is supposed +to be a number in a given range and a user value of “hello +world” is provided instead then there +are likely to be compile-time failures. Component developers can +specify constraints on the legal values, and these will be listed +in the savefile. + +cdl_option X_TLOSS { +# Flavor: data +# No user value, uncomment the following line to provide one. +# user_value 1.41484755040569E+16 +# value_source default +# Default value: 1.41484755040569E+16 +# Legal values: 1 to 1e308 +}; + + +cdl_component CYGNUM_LIBM_COMPATIBILITY { +# Flavor: booldata +# No user value, uncomment the following line to provide one. +# user_value 1 POSIX +# value_source default +# Default value: 1 POSIX +# Legal values: “POSIX” “IEEE” “XOPEN” “SVID” +... +}; + + +In some cases the legal values list may be an expression involving +other options. If so then the current values of the referenced options +will be listed, together with the result of evaluating the list +expression, just as for default value expressions. +If an illegal value is provided then this will result in a +conflict, listed in the conflicts section of the savefile. For more +complicated options a simple legal values list is not sufficient +to allow the current value to be validated, and the configuration +system will be unable to flag conflicts. This issue will be addressed in +future releases of the configuration system. +Following the value-related fields for a given option, any requires constraints belonging +to this option will be listed. These constraints are only effective +if the option is active and, for bool and booldata flavors, enabled. +If some aspect of eCos functionality is inactive or disabled then +it cannot impose any constraints on the rest of the system. As usual, +the full expression will be listed followed by the current values +of all options that are referenced and the result of evaluating +the expression: + + +cdl_option CYGSEM_LIBC_TIME_TIME_WORKING { +... +# Requires: CYGPKG_DEVICES_WALLCLOCK +# CYGPKG_DEVICES_WALLCLOCK == current +# --> 1 +}; + + +When modifying the value of an option it is useful to know +not only what constraints the option imposes on the rest of the +system but also what other options in the system depend in some +way on this one. The savefile provides this information: +cdl_option CYGFUN_KERNEL_THREADS_TIMER { +... +# The following properties are affected by this value +# option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT +# Requires: CYGFUN_KERNEL_THREADS_TIMER +# option CYGIMP_UITRON_STRICT_CONFORMANCE +# Requires: CYGFUN_KERNEL_THREADS_TIMER +# option CYGSEM_LIBC_TIME_CLOCK_WORKING +# Requires: CYGFUN_KERNEL_THREADS_TIMER +}; + + + + +Tcl Syntax +eCos savefiles are implemented as Tcl scripts, and are read +in by running the data through a standard Tcl interpreter that has +been extended with a small number of additional commands such as cdl_option and cdl_configuration. +In many cases this is an implementation detail that can be safely +ignored while editing a savefile: simply replacing a 1 with +a 0 to disable some functionality +is not going to affect whether or not the savefile is still a valid +Tcl script and can be processed by a Tcl interpreter. However, there +are more complicated cases where an understanding of Tcl syntax +is at least desirable, for example: + + +cdl_option CYGDAT_UITRON_MEMPOOLVAR_EXTERNS { + # Flavor: data + user_value \ + “static char vpool1\[ 2000 \], \\ + vpool2\[ 2000 \], \\ + vpool3\[ 2000 \];” +# value_source default +# Default value: \ + # “static char vpool1\[ 2000 \], \\ + # vpool2\[ 2000 \], \\ + # vpool3\[ 2000 \];” +}; + + +The backslash at the end of the user_value line +is processed by the Tcl interpreter as a line continuation character. +The quote marks around the user data are also interpreted by the +Tcl interpreter and serve to turn the entire data field into a single +argument. The backslashes preceding the opening and closing square +brackets prevent the Tcl interpreter from treating these characters +specially, otherwise there would be an attempt at command +substitution as described below. The double backslashes +at the end of each line of the data will be turned into a single +backslash by the Tcl interpreter, rather than escaping the newline +character, so that the actual data seen by the configuration system +is: + + +static char vpool1[ 2000 ], \ + vpool2[ 2000 ], \ + vpool3[ 2000 ]; + + +This is of course the data that should end up in the µITRON +configuration header file. The opening and closing braces surrounding +the entire body of the option data are also significant and cause +this body to be passed as a single argument to the cdl_option command. +The closing semicolon is optional in this example, but provides +a small amount of additional robustness if the savefile is edited +such that it is no longer a valid Tcl script. If the data contained +any $ characters then +these would have to be treated specially as well, via a backslash escape. +In spite of what all the above might seem to suggest, Tcl +is actually a very simple yet powerful scripting language: the syntax +is defined by just eleven rules. On occasion this simplicity means +that Tcl’s behaviour is subtly different from other languages, +which can confuse newcomers. +When the Tcl interpreter is passed some data such as puts +Hello, it splits this data into a command and its +arguments. The command will be terminated by a newline or by a semicolon, +unless one of the quoting mechanisms is used. The command and each +of its arguments are separated by white space. So in the following +example: +puts Hello +set x 42 +will result in two separate commands being executed. The first +command is puts and is passed a +single argument, Hello. The second +command is set and is passed two +arguments, x and 42. +The intervening newline character serves to terminate the first +command, and a semi-colon separator could be used instead: +puts Hello;set x 42 +Any white space surrounding the semicolon is just ignored +because it does not serve to separate arguments. +Now consider the following: +set x Hello world +This is not valid Tcl. It is an attempt to invoke the set command +with three arguments: x, Hello, +and world. The set only +takes two arguments, a variable name and a value, so it is necessary +to combine the data into a single argument by quoting: +set x “Hello world” +When the Tcl interpreter encounters the first quote character +it treats all subsequent data up to but not including the closing +quote as part of the current argument. The quote marks are removed +by the interpreter, so the second argument passed to the set command +is just Hello world without the +quote characters. This can be significant in the context of eCos savefiles. +For instance, consider the following configuration option: + + +cdl_option CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE { +# Flavor: data +# No user value, uncomment the following line to provide one. +# user_value “\”/dev/ttydiag\”” +# value_source default +# Default value: “\”/dev/ttydiag\”” +}; + + +The desired value of the configuration option should be a +valid C string, complete with quote characters. If the savefile +was edited to: + + +cdl_option CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE { +# Flavor: data +user_value “/dev/ttydiag” +# value_source default +# Default value: “\”/dev/ttydiag\”” +}; + + +then the Tcl interpreter would remove the quote marks when +the savefile is read back in, so the option’s value would +not have any quote marks and would not be a valid C string. The +configuration system is not yet able to perform the required validation +so the following #define would +be generated in the configuration header file: +#define CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE /dev/ttydiag +This is likely to cause a compile-time failure when building +eCos. +A quoted argument continues until the closing quote character +is encountered, which means that it can span multiple lines. This +can also be encountered in eCos savefiles, for instance, in the CYGDAT_UITRON_MEMPOOLVAR_EXTERNS example +mentioned earlier. Newline or semicolon characters do not terminate +the current command in such cases. +The Tcl interpreter supports much the same forms of backslash +substitution as other common programming languages. Some backslash +sequences such as \n will +be replaced by the appropriate character. The sequence \\ will +be replaced by a single backslash. A backslash at the very end of +a line will cause that backslash, the newline character, and any +white space at the start of the next line to be replaced by a single +space. Hence the following two Tcl commands are equivalent: +puts “Hello\nworld\n” +puts \ +“Hello +world +“ +In addition to quote and backslash characters, the Tcl interpreter +treats square brackets, the $ character, +and braces specially. Square brackets are used for command substitution, +for example: +puts “The answer is [expr 6 * 9]” +When the Tcl interpreter encounters the square brackets it +will treat the contents as another command that should be executed +first, and the result of executing that is used when continuing +to process the script. In this case the Tcl interpreter will execute +the command expr 6 * 9, +yielding a result of 54, and then the Tcl interpreter will execute +puts “The answer is 54”. It should be noted that +the interpreter contains only one level of substitution: if the +result of performing command substitution performs further special +characters such as square brackets then these will not be treated +specially. +Command line substitution is very unlikely to prove useful +in the context of an eCos savefile, but it is part of the Tcl language +and hence cannot be easily suppressed while reading in a savefile. +As a result care has to be taken when savefile data involves square +brackets. Consider the following: + + +cdl_option CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS { + ... + user_value \ +“static char fpool1[ 2000 ], +fpool2[ 2000 ];” + ... +}; + +The Tcl interpreter will interpret the square brackets as +an attempt at command substitution and hence it will attempt to +execute the command 2000 with no +arguments. No such command is defined by the Tcl language or by +the savefile-related extensions provided by the configuration system, +so this will result in an error when an attempt is made to read +back the savefile. Instead it is necessary to backslash-escape the +square brackets and thus suppress command substitution: + + +cdl_option CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS { + ... + user_value \ +“static char fpool1\[ 2000 \], +fpool2\[ 2000 \];” + ... +}; +Similarly the $ character +is used in Tcl scripts to perform variable substitution: +set x [expr 6 * 9] +puts “The answer is $x” +Variable substitution, like command substitution, is very +unlikely to prove useful in the context of an eCos savefile. Should +it be necessary to have a $ character +in configuration data then again a backslash escape needs to be +used. +cdl_option FOODAT_MONITOR_PROMPT { + ... + user_value “\$ “ + ... +}; +Braces are used to collect a sequence of characters into a +single argument, just like quotes. The difference is that variable, +command and backslash substitution do not occur inside braces (with +the sole exception of backslash substitution at the end of a line). +So, for example, the CYGDAT_UITRON_MEMPOOL_EXTERNFIXED_EXTERNS value +could be written as: +cdl_option CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS { + ... + user_value \ +{static char fpool1[ 2000 ], +fpool2[ 2000 ];} + ... +}; +The configuration system does not use this when generating +savefiles because for simple edits of a savefile by inexperienced +users the use of brace characters is likely to be a little bit more +confusing than the use of quotes. +At this stage it is worth noting that the basic format of +each configuration option in the savefile makes use of braces: +cdl_option <name> { + ... +}; +The configuration system extends the Tcl language with a small +number of additional commands such as cdl_option. +These commands take two arguments, a name and a body, where the +body consists of all the text between the braces. First a check +is made that the specified option is actually present in the configuration. +Then the body is executed in a recursive invocation of the Tcl interpreter, +this time with additional commands such as user_value and value_source. +If, after editing, the braces are not correctly matched up then +the savefile will no longer be a valid Tcl script and errors will +be reported when the savefile is loaded again. +Comments in Tcl scripts are introduced by a hash character #. +However, a hash character only introduces a comment if it occurs +where a command is expected. Consider the following: +# This is a comment +puts “Hello” # world +The first line is a valid comment, since the hash character +occurs right at the start where a command name is expected. The +second line does not contain a comment. Instead it is an attempt +to invoke the puts command with +three arguments: Hello, # and world. +These are not valid arguments for the puts command +so an error will be raised. +If the second line was rewritten as: +puts “Hello”; # world +then this is a valid Tcl script. The semicolon identifies +the end of the current command, so the hash character occurs at +a point where the next command would start and hence it is interpreted +as the start of a comment. +This handling of comments can lead to subtle behaviour. Consider +the following: +cdl_option WHATEVER { + # This is a comment } + user_value 42 + ... +} +Consider the way the Tcl interpreter processes this. The command +name and the first argument do not pose any special difficulties. +The opening brace is interpreted as the start of the next argument, +which continues until a closing brace is encountered. In this case +the closing brace occurs on the second line, so the second argument +passed to cdl_option is \n # This is a comment . This second argument +is processed in a recursive invocation of the Tcl interpreter and +does not contain any commands, just a comment. Toplevel savefile +processing then resumes, and the next command that is encountered +is user_value. Since the +relevant savefile code is not currently processing a configuration +option this is an error. Later on the Tcl interpreter would encounter +a closing brace by itself, which is also an error. Fortunately this +sequence of events is very unlikely to occur when editing generated +savefiles. +This should be sufficient information about Tcl to allow for +safe editing of eCos savefiles. Further information is available +from a wide variety of sources, for example the book Tcl +and the Tk Toolkit by John K Ousterhout. + + + +Editing the Sources +For many users, controlling the packages and + manipulating the available configuration options will be + sufficient to create an embedded operating system that meets + the application's requirements. However, since eCos is + shipped entirely in source form, it is possible to go + further when necessary: you can edit the eCos sources themselves. This requires some + understanding of the way the eCos build system works. + +The most obvious place to edit the source code is directly +in the component repository. For example, you could +edit the file kernel/v1_3_x/src/sync/mutex.cxx +to change the way kernel mutexes work, or possibly just to add some +extra diagnostics or assertions. Once the file has been edited, +it is possible to invoke make at +the top level of the build tree and the target library will be rebuilt +as required. A small optimization is possible: the build tree is +largely a mirror of the component repository, so it too will contain +a subdirectory kernel/v1_3_x; +if make is invoked in this directory +then it will only check for changes to the kernel sources, which +is a bit more efficient than checking for changes throughout the component +repository. +Editing a file in the component repository is fine if this +tree is used for only one eCos configuration. If the repository +is used for several different configurations, however, and especially +if it is shared by multiple users, then making what may be experimental +changes to the master sources would be a bad idea. The build system provides +an alternative. It is possible to make a copy of the file in the +build tree, in other words copy mutex.cxx from +the kernel/v1_3_x/src/sync directory +in the component repository to kernel/v1_3_x/src/sync in +the build tree, and edit the file in the build tree. When make is +invoked it will pick up local copies of any of the sources in preference +to the master versions in the component repository. Once you have +finished modifying the eCos sources you can install the final version +back in the component repository. If the changes were temporary +in nature and only served to aid the debugging process, then you +can discard the modified version of the sources. +The situation is slightly more complicated for the header +files that a package may export, such as the C library’s stdio.h header +file, which can be found in the directory language/c/libc/v1_3_x/include. +If such a header file is changed, either directly in the component +repository or after copying it to the build tree, then make must +be invoked at the top level of the build tree. In cases like this +it is not safe to rebuild just the C library because other packages +may depend on the contents of stdio.h. + + +Modifying the Memory Layout +Each eCos platform package is supplied with linker script +fragments which describe the location of memory regions on the evaluation +board and the location of memory sections within these regions. +The correct linker script fragment is selected and included in the +eCos linker script target.ld when +eCos is built. +It is not necessary to modify the default memory +layouts in order to start development with eCos. However, it will +be necessary to edit a linker script fragment when the memory map +of the evaluation board is changed. For example, if additional memory +is added, the linker must be notified that the new memory is available +for use. As a minimum, this would involve modifying the length of +the corresponding memory region. Where the available memory is non-contiguous, +it may be necessary to declare a new memory region and reassign +certain linker output sections to the new region. +Linker script fragments and memory layout header files should +be edited within the eCos install tree. They are +located at include/pkgconf/mlt_*.*. +Where multiple start-up types are in use, it will be necessary to +edit multiple linker script fragments and header files. The information +provided in the header file and the corresponding linker script +fragment must always match. A typical linker script fragment is +shown below: + +eCos linker script fragment +MEMORY +{ + rom : ORIGIN = 0x40000000, LENGTH = 0x80000 + ram : ORIGIN = 0x48000000, LENGTH = 0x200000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x40000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, 0x48000000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTIONS_END +} + +The file consists of two blocks, the MEMORY block +contains lines describing the address (ORIGIN) +and the size (LENGTH) of each memory +region. The MEMORY block is followed +by the SECTIONS block which contains +lines describing each of the linker output sections. Each section +is represented by a macro call. The arguments of these macros are +ordered as follows: + + +The memory region in which the section will finally + reside. + + +The final address ( +VMA +) of the section. This is expressed using one of the following forms: + + +n + +at the absolute address specified by the + unsigned integer n + + + +ALIGN (n) + +following the final location of the previous section + with alignment to the next n-byte + boundary + + + + + +The initial address (LMA) + of the section. This is expressed using one of the + following forms: + + +LMA_EQ_VMA + +the LMA + equals the VMA (no relocation) + + + +AT (n) + +at the absolute address specified by the + unsigned integer n + + + +FOLLOWING (.name) + +following the initial location of section + name + + + + + +In order to maintain compatibility with linker script + fragments and header files exported by the + eCos Configuration Tool, the use + of other expressions within these files is not + recommended. +Note that the names of the linker output sections will vary +between target architectures. A description of these sections can +be found in the specific GNUPro Toolkit Reference manual for +your architecture. + + + +Managing the <!-- <index></index> -->Package Repository +A source distribution of eCos consists of a number of + packages, such as the kernel, the C library, and the + µITRON subsystems. These are + individually versioned in the tree structure of the source + code, to support distribution on a per-package basis and to + support third party packages whose versioning systems might be + different. The eCos Package + Administration Tool is used to manage the + installation and removal of packages from a variety of sources + with potentially multiple versions. +The presence of the version information in the source tree + structure might be a hindrance to the use of a separate source + control system such as CVS or + SourceSafe. To work + in this way, you can rename all the version components to some + common name (such as “current”) thus unifying the + structure of source trees from distinct eCos releases. +The eCos build system will treat any such name as just another +version of the package(s), and support building in exactly the same +way. However, performing this rename invalidates any existing build +trees that referred to the versioned source tree, so do the rename +first, before any other work, and do a complete rebuild afterwards. + +Package Installation +Package installation and removal is performed using the + eCos Package Adminstration Tool. This + tool is a Tcl script named + ecosadmin.tcl which allows + the user to add new eCos packages and new versions of + existing packages to an eCos repository. Such packages must + be distributed as a single file in the eCos package + distribution format. Unwanted packages may also be removed + from the repository using this tool. A graphical version of + the tool is provided as part of the + eCos Developer’s + Kit. + +Using the Administration Tool +The graphical version of the eCos Package Administration +Tool, provided as part of the eCos Developer's +Kit, provides functions equivalent to the command-line +version for those who prefer a Windows-based interface. +It may be invoked in one of two ways: + + +from the start menu (by default + Start->Programs->Red Hat + eCos->Package Administration + Tool) + + +from the eCos Configuration + Tool via the + Tools->Administration + menu item + + + +The main window of the tool displays the packages which are +currently installed in the form of a tree. The installed versions +of each package may be examined by expanding the tree. +Packages may be added to the eCos repository by clicking on +the Add button. The eCos package distribution +file to be added is then selected via a File Open dialog +box. +Packages may be removed by selecting a package in the tree +and then clicking on the Remove button. If +a package node is selected, all versions of the selected package +will be removed. If a package version node is selected, only the +selected version of the package will be removed. + + +Using the command line +The ecosadmin.tcl + script is located in the base of the eCos repository. Use + a command of the following form under versions of + UNIX: +$ tclsh ecosadmin.tcl <command> +Under Windows, a command of the following form may be used +at the Cygwin command line prompt: +$ cygtclsh80 ecosadmin.tcl <command> +The following commands are available: + + +add <file> + +Adds the packages contained with the specified package distribution +file to the eCos repository and updates the package database accordingly. +By convention, eCos package distribution files are given the .epk suffix. + + + +remove <package> [ --version=<version> ] + +Removes the specified package from the eCos + repository and updates the package database + accordingly. Where the optional version qualifier is + used, only the specified version of the package is + removed. + + + +list + +Produces a list of the packages which + are currently installed and their versions. The + available templates and hardware targets are also + listed. + + + +Note that is is possible to remove critical packages + such as the common HAL package using this tool. Users + should take care to avoid such errors since core eCos + packages may only be re-installed in the context of a + complete re-installation of eCos. + + + +Package Structure +The files in an installed eCos source tree are organized in +a natural tree structure, grouping together files which work together +into Packages. For example, the kernel files +are all together in: + +BASE_DIR/kernel/v1_3_x/include/ + BASE_DIR/kernel/v1_3_x/src/ + BASE_DIR/kernel/v1_3_x/tests/ + +and µITRON compatibility layer files are in: + + + BASE_DIR/compat/uitron/v1_3_x/include/ + BASE_DIR/compat/uitron/v1_3_x/src/ + BASE_DIR/compat/uitron/v1_3_x/tests/ + +The feature of these names which is of interest here is + the v1_3_x near the end. If you start using + eCos after the Version 1.2 release, you might see a + different name here, e.g. v1_4 for version 1.4; if + you received pre-release Beta versions you might have seen + v0_2 or v0_3 for versions 0.2 and 0.3. +It may seem odd to place a version number deep in the + path, rather than having something like + BASE_DIR/v1_3_x/...everything... +or leaving it up to you to choose a different + install-place when a new release of the system arrives. + +There is a rationale for this organization: as + indicated, the kernel and the + µITRON compatibility subsystem + are examples of software packages. For the first few + releases of eCos, all the Red Hat packages will move along + in step, i.e. Release 1.3.x will feature Version + 1.3.x of every package, and so forth. But in future, + especially when third party packages become available, it is + intended that the package be the unit of software + distribution, so it will be possible to build a system from + a selection of packages with different version numbers, and + even differing versioning schemes. A + Tcl script ecosadmin.tcl is + provided in the eCos repository to manage the installation + and removal of packages in this way. +Many users will have their own source code control system, +version control system or equivalent, and will want to use it with +eCos sources. In that case, since a new release of eCos comes with +different pathnames for all the source files, a bit of work is necessary +to import a new release into your source repository. +One way of handling the import is to rename all the version +parts to some common name, for example “current”, +and continue to work. “current” is suggested because ecosconfig recognizes +it and places it first in any list of versions. In the future, Red +Hat may provide a tool to help with this, or an option in the install +wizard. Alternatively, in a POSIX shell environment (Linux or Cygwin +on Windows) use the following command: +find . -name v1_3_x -type d -printf 'mv %p %h/current\n' | sh +Having carried out such a renaming operation, your + source tree will now look like this: +BASE_DIR/kernel/current/include/ +BASE_DIR/kernel/current/src/ +BASE_DIR/kernel/current/tests/ + ... +BASE_DIR/compat/uitron/current/include/ +BASE_DIR/compat/uitron/current/src/ +BASE_DIR/compat/uitron/current/tests/ + +which is a suitable format for import into your own + source code control system. When you get a subsequent + release of eCos, do the same thing and use your own source + code control system to manage the new source base, by + importing the new version from +NEW_BASE_DIR/kernel/current/include/ +and so on. +The eCos build tool will now offer only the + “current” version of each package; select this + for the packages you wish to use. +Making such a change has implications for any build + trees you already have in use. A configured build tree + contains information about the selected packages and their + selected versions. Changing the name of the + “versioning” folder in the source tree + invalidates this information, and in consequence it also + invalidates any local configuration options you have set up + in this build tree. So if you want to change the version + information in the source tree, do it first, before + investing any serious time in configuring and building your + system. When you create a new build tree to deal with the + new source layout, it will contain default settings for all + the configuration options, just like the old build tree did + before you configured it. You will need to redo that + configuration work in the new tree. +Moving source code around also invalidates debugging information +in any programs or libraries built from the old tree; these will +need to be rebuilt. + + + + diff --git a/doc/sgml/user-guide/makefile b/doc/sgml/user-guide/makefile new file mode 100644 --- /dev/null +++ b/doc/sgml/user-guide/makefile @@ -0,0 +1,55 @@ +#============================================================================= +# +# makefile +# +# For building the eCos RedBoot docs +# +#============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license/ +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +#============================================================================= +#####DESCRIPTIONBEGIN#### +# +# Author(s): bartv, jlarmour +# Date: 2001-01-11 +#####DESCRIPTIONEND#### +#============================================================================= + +TOPLEVEL := ../../../ecc +MAIN_SGML := user-guide.sgml +MAIN_HTML := ecos-user-guide.html +MAIN_PDF := +OTHER_SGML := +PICTURES := + +include $(TOPLEVEL)/pkgconf/rules.doc diff --git a/doc/sgml/user-guide/pix/BuildPackages.gif b/doc/sgml/user-guide/pix/BuildPackages.gif new file mode 100644 index 0000000000000000000000000000000000000000..cd6e9c460fe8803ec27899ceb5ea96acc1791e5f GIT binary patch literal 16324 zc%1E+MNk~v7v&)Y2^Inbl3>BzU4y&3yEg9b?gV#t8u!NC-Q62#+$}Wo{dcpS{hZya zd+JyB-g<9wo`jS*7q=1dr$yLf7#Le<18lXG)ug#axr0NU zhr0i>6&L3eXJ;gH^9eoPUS8fVEiG>smjJc3w3S7r0cy$s+h}7oZD~GkXGiCy;iaY) zU~x@xQx1?@P>7j{`|dvNMW-CI8Ky&CEpocne-y?s9fCc6N0R4h+`T`>#E1Wi4s&{$+4r zc6I@fn~(eP@^Wc;{F;2juUT$25pjr!^B30TwR?Het`#T^|R%}vML z1p)>KdT0OFz<*17{qXkmmX?(k5)?{KNlyNo46p?#D=I(UJ{lVt8=DyeONu}Kzy9Av z_uqAg`QKZBL4v}-BH>Hc<@W_6VbSQ0))fqdV~|Q`OV$?-MgL$0Y>w6!jl};ZNBAMt zP&}4IrBbOo)=)B$#$+;{E!9{$mBr-@*&J&uo5>Rl?#BMj6cA7(nM9*E-c+$rrdTAM zBi&rNRHfMn*cxxHTB$W0h$4`2qYFkrCltiM5bFPo{GCp>H-T702^Q`avNh3KyVDZ@ zhe9aZR<}10fkmr7*;aorl0YhxE8E^+Hg2&{WBbN&xe0Pd48fNJHJvV$t5oSvftt@E zGL{-#Q8XCzI$&a=7$!PeuXcKaQHbO_+inhwUHvq%eG>572P4&TKa#4nyif(^ymtWM)BWzi zSHXW6qNu{C#BkrlelYJx2_jG*CWw+~^na5iD;UI-W!oFXQWPZ~!d6vP3iTuQaH%~A^b$c0FjCwaWTOjT4BCf}P}1q`aP;m}!*k<_&N5n?B88?O}zzLHZsHY zL8pa9)1Id`E4;12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K$g?tuafH$}#rWCZ;1qLPqWp`P>EwEawvKpUQ z(=1d@VqSX+G7*2R;H#zW`92bT;w*FDAkTFcuxR`EdRIZ=P>;@nWo?h`d zoT{TYDOntqBO?nJxyXHW6$*!Br&bV`v8jGksGd=)9XBW%u&bMl%JfK9cs(?myXM=m z%ek{_aaJNo?P=B?vFjcT>Wr}K%?#?UuK(Hilnv@Xu^T$O2>)?4#BGt~BbFp< zF=pg2;cPMa!(l4XVyeJlrqN<%z+rCDVs6i2;of55&tVzfVj0h2mDXZOYXwu>0;uJ% zZf&vd;jkHLv6M+;BY`}b@)kT5RRio9_fYZ&Q)yI?U?0)$fYa|EbmggEIiJE#NCxAnvm<;%6A%{{xjFx7q*z diff --git a/doc/sgml/user-guide/pix/Conflicts.gif b/doc/sgml/user-guide/pix/Conflicts.gif new file mode 100644 index 0000000000000000000000000000000000000000..c16281faa6e1b7c96dfca38f35bd3bcbdc02652e GIT binary patch literal 8067 zc%1E%^;;8;_x9;VLO`VDjS>O^A}yiBq`O0rm`F$p45VSwEiroZ=#gXe=x#=LNXHP6 z@%8gBJU>78kLTRi>$=am&QbZGEFt;n8dn{67Y9dJNEm}TUO}(GDq+bf5F8wwhlhuM zWz4_o!ST*NZS1V9tjtW#jEs(;dQqq@6ubcruZ6?PV9-1$Bnu)eDtvtW&v`sEJ2Nsl zgBnC3yO8h}B((5fH(63bQkb9j;eWK9k{6=)gM!O2wDKvhyvG9=6$)%MQ@g=Rq^ z>B*8Z3YhcbF~u}^?$$+Ng3g&lqh7|2rLWAD?>l)}3KJ49HB7jwQdGmCV0wRZP(4+#n}wfGm$RM$jxXX7{|2m;B2Nyrbkx>I&{o4xpeYXd#3{l=u4X8diw}`9~>8NJhm(N%9LLTVNqUAjrP}|CV<9 z0P+E;s;ertfC^)}O4cZLO`-M}%!5kkJQNA@t$@>;Fmo|1KWq zf4_i3g2lllVF6UfF&g+h#{!bMGsL4k~F}`+K>aQv2izC4YvwWz94kYpD zm6;FJ77qOq`aB5v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-vA1kSD{fIV=Zpm6WrCD8qO)n8*V<%czDsAuV zmND0}vtIUL(9vruQxE+@pj}eaO_fqvfu&Gls9DqN_!wdgvE^8l)bh3Dft=; zLC0=64+OxVTi)S7hUwhDPk|y-E#rYNJQ69wfU>M)BVa=h$m4pT^5RdO7_ZCx6ZK8L zvwfXJ<)nh=N~IqZRQtSdUl+c*+WzoKO3!jIxk%iwu2Y}K2$f+_#Yvk^#roA0A;nb| z1}`Kq_-gJ{XwW>H^1-A2tL4Z5))3XH_v_ot*N-Qrvj9`Q>If%VOB%#HEpKW~Ts`-v zHv<~|hGKw3ja`5M!i2=y5GuIs2o%^do=BaQhrV%gzz;Q@X<*39_Wx>ZA-#xSliE;P zf8?Z=X|^1m+K5~}bO|yuS$}k0gL-pposhZIE%>WB$n)6!LQ3aGf39T?TvWeFD2cx%{|7toBY{m-lbE1QN=8 z#9QrYw_~*qqHq03Bregq_g+YmQREYu(R|mF-f!V=T0cGdKHtqw)HC5?RvgXj>s)OOvZ-u$wI%1vRh(GtIZ4X zg#oQ_k%Z5Gt%!{l294NGlWA_^aXl7>tccvxP%?HRzZQn=mEALDTJ6Ld7e-vd-67jD z_EK{Tqu+bovsYzsWgpgP*>FS&31Y(6Tj$3kls)q4kw9f}^h8{^2ULxP8b|v70DPMF AzyJUM diff --git a/doc/sgml/user-guide/pix/CorrectFailingRules2.gif b/doc/sgml/user-guide/pix/CorrectFailingRules2.gif new file mode 100644 index 0000000000000000000000000000000000000000..e43e71ea0ecee285860a8fadafc97efdc9e4b3dd GIT binary patch literal 6148 zc%1Fi=RX??!^UylW(OU%F0Bz19d=LKbJXr}jH2k#ZPRHL)s`#~BRlp^Vy`5USV6>y zy|=amiJ~P|Joo*1{*34OzW%+uuKSke28Lc`2ew5vMgG^9|7dAxnVg*5|9}7Q{}RA| z_y6B7h=>YB#6%S>N;4Whi^^!Yvr03Y;!a+&!dsMOHA7_eea2b#mqZR8xeHdbEYE36 zR&yY@x0UC%qpm$=<1H)lI&lVX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#@)E`|U74NAyoBv# zO%2}Q@hZVF&JcrV>Aq~p=1rTmj(CD+Jo$iA%Rd;rg*5&kgTJiI;|uv6$}4M;%fCEV z8Y5Q({H1Ni3T1LdXtyMy^0UGyKYPLoD+1?Rc5X6>+@uyfNq_RHCp(Ro2TbQKesxAFM9XQZ z@!GDl9AS?ly26v?VynMshHQ&zKh)b@nisJt@Z+t$+U2jprp4*Miq$B361=PVrpAg9%$cv}@XRc{*fpmlqVcGjxw-w$arj6 z(9q1tprUhP!@|Ri?5rv=KQ<&eGcXwjZHW*}KGx67Q1Rr1;iDrHRdi>CbQnE7JXJb& zpUa7$WnQxkbDMa68YX(rWwy=w!x^IBv&gkyEO$l8O2;`Kjb^1*1zMr=Y>H2boD6+( zd|hBHm+XSlm7%NB=Ponl{+e}lTb|;f(%oh+@2oCede3!tc<%ijsoj0NJS7I9>lIp+ yuI;SIIdRmF_xMq(k|M`LR-e=UWrru7-7zb-ZJOn+)R$A1doI&EIWxh5!5RSDePxdT diff --git a/doc/sgml/user-guide/pix/Image24.gif b/doc/sgml/user-guide/pix/Image24.gif new file mode 100644 index 0000000000000000000000000000000000000000..6852b1c03af37eb379840bee6c9af7d7b5052ada GIT binary patch literal 5169 zc%1E%^;Z)B*T)eM5U_{=15~6_dZcux>rVT`4|7{zZUtgrb?!&N)|~X zQ~jHf{)t2y92_K({Z0Przef63j{Mt?B>hK!7ygd^kN@%i1g=xc|G3D%@b4#7X-H(8 zG}5Z3#i%Ii>-Ra_RM%8vDcSF6>Nb}Sqi?bS^9A0PXvc7Zw1>yjzUZLuJ+S4ehCfzM z6XnN0k%yN|WBH_(+a@G239{a{t^VJaKNtiaIJ}6UD6+?4n?AonGYUIQ zcQt<wYjxb(NWLZ1xh>2r9Yl3H0tfx9~MI> z1~r{`eE&3vn!54Br1R(3@eEt#N9Vdmqogk$p@!Kg*i6_whI=+2|qNx!`R7 zakxFlP~-qP*d2PePnBa*6ux?NTwD3+COGW8cX4OzQzRvz>V5D}%WS|EN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kT_XQj)n+OHE! zZzXQw6rEqpni(Ead{Og8P)%p(jd*u~d)MV_7EfglZRXmvbzxww>~f_j{-w(#(?74( RP%bjQmZ997$I8NB4FLZ+y$%2X diff --git a/doc/sgml/user-guide/pix/Image27.gif b/doc/sgml/user-guide/pix/Image27.gif new file mode 100644 index 0000000000000000000000000000000000000000..d9b6a0d89d2c52f6ca39c28560dfbd7009312186 GIT binary patch literal 1239 zc${fpmlqVcG{xh(1$arj6 zaIl#}SS#klhJ}aQ*_at5I1&~)Ff#E)sYDbeyEe)zcInKRn0&lfIe1mf$xjI1|w zw%jOO;?g2vDz!$k$ia8ML$p>6=cgrp3q2;QsY+dW;y%kL(2mE!wBgcfzL`m(6_b~Q zO)$`8o4d30Mc@YClZ$*KuV&rcuJTatjhDgm$XOXznXX1pTX}Iq)>p5o-a9sU^>hep z$DP@+@$vBq%HH#QZt6L98Zy@8-YVE|=WNUFe_PKKKKJi$W3T(VXKP{Bn$_ORpPt#U z>Fw^m#gl*`L`?aN51QSpSUaK-~O*ZDmLHe^W3e|%8qeH zT*=vgwLE}fiK5t?OvSHH7L;0_Y>TSaRt=jMz}2^PL4kZ-M|`J-SxHjejLhSuR+sb++PaSH#VT1#V)`SZ5Sl-%5YrWp{7Kg`$dFk0n8MfiuEG1ROo4v>asB qOlnSvt(Y+}Chz3Z>7PGNPYQFhx~Wo@&UWM3?1E#O&z%_=8LR>2$KzxG diff --git a/doc/sgml/user-guide/pix/Image28.gif b/doc/sgml/user-guide/pix/Image28.gif new file mode 100644 index 0000000000000000000000000000000000000000..f0403e00b825502754303386f869a905f2613334 GIT binary patch literal 1262 zc${u<95`^`|Ns9CqhJ(_B%t_{1x)LJ2vDAI;P}tL$syyh zVZp&>4q>gB6B`yDZWmBilTrA%kb#MjiRVOzp@VxP15X=|XM@VgNve!JCM!Rscu!DI z+@x}&NX>h;X5cFp&B@EpPqzvUv+)Q_IXFYCl}{w#^P_VM0~UMD^_rS+aTV)aHIW6P ztFNz5*ciuJJ#lelugv^kXCzCWoS&OlsZ_dh+B(l2jt|cr-F+?Z-pXY5d%WH|HatAs zA;=eTX2-_I$0sOz&-2;2>FMbi#@YAIR2n)im$a?pIS``hyNiFKR|xOatq;1^E$(BT zW%TXPI6;3wiClX7Rt@MJi2vT^Hm& z5zM#}{x{V1uG>{t4OyS{mEu#IcojLMBf@{0E_7ZHslKr6#MiIa^EJ5AV_NsFjaZb= zT6H6-@Eq?|`NGS+YEc6kf`z_~P6>O0|_GD7D z0o!%qPWyS+p8Dqh4Nb^R&a)H_m6hY1+Q4oqIe)g&!Jl!>Uotr_xfZ=!uAW%(?&b6O Rx4&|}SkNLC72v>N4FK8I?J58O diff --git a/doc/sgml/user-guide/pix/Image29.gif b/doc/sgml/user-guide/pix/Image29.gif new file mode 100644 index 0000000000000000000000000000000000000000..197ecb8070700eda6d43b7125ab89b68458ef45d GIT binary patch literal 1333 zc${rEMQs(M1b;y1IK>`P7WE5 z4GRu7a|mn2oY=7NaJzuAoQ%T8MMt|?SUGqO6e=HQU}lsMku*|an551+&m}S_#j8o% zcTw;IL9yUG75|a32;`9qS z9BL~bH1U|dc+kA$srthfiMQ?x!_re%ENl}m(^%Llm*f)fDAk+sApg|f)cF-$Yk!D# zC`Oqm<&|F5nA6>`vGsA0xYYEB8n2HhB6@uk%>|+^H@e*Qc=hzhyaeY%;y02X+}ts* zEJ7+WvD^A-$(;l})~9g|nv7SU*089|TsBGJ$Es;*b2%E^tk(%?Wk+wmmi2lq)5@;b>-K!>%5q?^1^_(|7sUVo diff --git a/doc/sgml/user-guide/pix/Image30.gif b/doc/sgml/user-guide/pix/Image30.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e9e7a62c9c8dddb5aca1794a7856de22915a303 GIT binary patch literal 1129 zc${}L>V_|5fpmlqVcG{xh(1$arj6 zaIl#}SS#klhK0_JOmbc+91MxBP2z@9ECmyjk9Wzir?9*%T;$m*XjpYdV}h#pM4@;- z7J&t6zBAQ}U(K0OwCvb)1@1>a7E=~CELJSnioLZ#{c^iXcvsBKkmS>=4c3<(kt%u; zJlSvgv?H@jGcK&pxV(yY_qP?dw--D+2hmcdPpD zHgmZx&G>p<*Y58J4sY$2lGUEF{r#2$neXq-jd*eB;&E^H@VCJX42-?}Li{n)bW&e* z`2Kd2@!w|S+HIDvHD!;5sn5ZSN2}+bkz5tO`lzw?ygQe4KK?k@t3D(0%G&4COK&tT gpWL+Muam7#bNF4YJP62xMSrmgi>Tu$=Vd_(T?`Wj>KYDqhp{ z181q6EPCMGWx?-v=H%w(=jS^#dx>NPFu3=Kb!x?)GI@AzshGLf+ZC6VU7Z>ce(8wT z=T#0<)z@BPnQfYLZ5h}6MX{&1tqs^}%YI_6_x5#ncUOFVb@%l4_4oHTFf;3&x}bbw zbtu2uznwR7?<@=K_mWGnco;S#O@Fqn_qNa1H!V1CrNFMU~6QvAqDQFw;VPNRcI&(9CO!e?t0 z+>Ru=Vxx^G{aYog-Ot=JVm+-z@f_HJ{hcdzk(8Ra{Qh{}-LdX4lwW6pv$g ze6vJ2TzBR5P|q7juUx7(V9gLJVfn`LuuXd1(YXzG1E(Z*s7!k?rBh?si3=TC+d2{h I7#SI?0YD+U#Q*>R diff --git a/doc/sgml/user-guide/pix/Image32.gif b/doc/sgml/user-guide/pix/Image32.gif new file mode 100644 index 0000000000000000000000000000000000000000..98e2e73ceb3428bf54d8eb3f47d4c9298254c471 GIT binary patch literal 1984 zc%1Fi|3A|S0LSr>e2Fw_jysiao0>0mmbShqD``z5Wn)r?e3!@h8pS=x@;#YV^KEQw zF;lk{pP56x6q!mA*fod>}8~RvS+FtiE3sfHzcMlQJa#xEQ*jetF2G^Or;D=>msPIdo zI?e^MQ#p1g_}}2TUQf*C_wdX=-1g<@svRLjc;57DE{2oPeryO~7)7fEHapuV-;$d|xH?3UPa|oDSnk zt>MY*@uP!J-IT{&%Sa^2L~zjVUX&uTKmc{oZ7ls|qg_#?e7UqgaV@(FwYzCQL6I$JBqdWMn19rorge0w}(Q`;a_K26kHz}B9E4*>|*ybj_HZd zGooL|m!T)=JNn}s(JPe%7a{Sdge(y-gLC-wF8Bc>y|}VkOOE2?JQ&T~oxAcDX~x-w zQ)WYI7_$naV2dq7#7B_$1k+46|NG&*i}9HfU%+|CV6sct4BMkXgsm#zQVT0 zD#)XKZb9INv#R1y+=DD5z(pJ|P>X%GNT0ETMV96<4X-8v0F2G6l!zk2v1Y?dIi*{h z#JnYM7CYZm-)OkG3I?%=oDj#`l1B-(%bkv|Tqt!W8P>8F7PJUi_nxX+naEl&Z}$Qz zwnB6rP=4m0vO67OQWEy}K?>Wsjfn6^da@SjM~`<^Vy_)i>FU3}-@$u(6v|y= z_6?ez5sG%Cg*5_&k zi|bO}o!s%M!x@o(P8(B?Fz8zS>mEzX@XbfZ!H^C1;@x&D_LGxAtA1Hvv%x0n9}e5@ z7c{%-1o|3ZcJrrJN$iuq=-68F||t9yM!2!p4Kg4SeCP-?9oi9hYh^VXAkDYz3~rqvvRqFhqpkF)FG0NUdo z_^eo#&v#Au-JrnomaZy830$KL4t+^Sy=3ZM!#o~(n|I50q;Q!YAM2R(3S++6$(KG- zk2LvsHK4I1SI>S^i=lTYcCzF0*N_mVt=(Sx(M{!w>?;oHft)ngXLs;0^Kv=#T&gUF zq1GL83enf=w8EWesX5RkmHdo%B^FkzzU!Pa)$!U0&rzquakXvrZ>j~b+E(?^GW)#b u7#2>CUf^81nV(en?7ijbBAc`6ONk~DCfu`IL})yJg_ZkBo2?H99r*{)<7U_Z diff --git a/doc/sgml/user-guide/pix/Image33.gif b/doc/sgml/user-guide/pix/Image33.gif new file mode 100644 index 0000000000000000000000000000000000000000..06323fb94b31700235ed0ff47254021f69afd08f GIT binary patch literal 1786 zc${W<6(JlC20-1Nj}weIqNJ(5#j zpI&1&xhq%7EX#3o^5s>rr^Ph`Ql6ZBh@~YdgQ`=<4$9n|m~W zOZ9Z#$O}JGvC+xS!#wBq=^4h^brF#{ZpX{4{nhSV_~^T3c5u8%Zb_!=rb>4sK1HN39*-;PEF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#S;ve)Nct%Z9k68_^)UX#I+~v?zLk3T^1i2Rl4Ta>vbGt$y?E^z{azX!&pRs!5RQy CH3X{w diff --git a/doc/sgml/user-guide/pix/Image35.gif b/doc/sgml/user-guide/pix/Image35.gif new file mode 100644 index 0000000000000000000000000000000000000000..234edac941db26916f7682b2f12bde34be0dbb88 GIT binary patch literal 1328 zc${u<95`^`|Ns9CqhJ(_B%t_{1x)LJ2vDAI;P}tL$syyh zVZp&>4q>gB6B`yDZWrL?>+sm9)Y!?)%E5D>Fqwf#mXkrkVu4Bnqk7;hos~vQy{Bpi zZ%fJCxXibMnWcy2K=Bjb*}{fmS8h&LVCc2e-xPCd%gW2k{p!8udKsu+SsgK3O;p2p zRlur*!(Fo8VM`+C#hhLhdwSd2XeKGqtRC$Nsn^#uLAA7UVl^Yui8W@&u8s~t#xOYvF_fy@WJT?&fR7|uD^J3c}4K#dph9_udi>2^*-aZ zdt2&N`@dfI&hFm+{{8{kcp08g8y-Gd^VV!ztfh9|hMC^Y|8ypNI6gtfUM)WJQ>xFq ziQ_H=k z+L!76|5aZ+XwFdma<4@sEaPFT$gyP)+hodKB(^iGyB_5zvFrN-=g$k5#l_sLWDyE{ zyKu{#+$zV?Ma~yJ)oyhiRV=&Pf7|w1tao3a+RP%or6r5gtuo7``gxE3xHRFRV_0O0 z`=sqpoG$WSc@SkIcYI>MqaRz`)Znh=X`azVH&v=aTu%hdaA;y_DD#_kB4#$%-0+YH zo^z5)fz6&`;XPGW$JL!Qzpr=iCbSR`_q{^zjkh(mR9rEMQs(M1b;y1IK>`P7WE5 z4GRu7a|mn2oY=7NaJv9MUx&v=rN&M+RskM?1_t+jSxyECiv>>@7&LsD3|4+hIXP83 zep8F2@Uqjhb#tHHsWe`8biO!iPm1RjjdL?Ka+jH8g}iX-;b>J;<#2fH(de@|>+Y$o ztHW0~DDw$?*!t$$YS!8&-qYLG-ripDILKF9;H_gXm+7OUtBNwO&+uV9FB228{N|)0 z$v)Yt9UH@zi@&#W=?*D4yTnMJyNokpdHNYI!}&3{Bnuw3cI(&O?Fr6&(Ac23-qv^b zwzs$WFUD={-o5?({R1mM>1iz3@$vC7UaPosf3iOu^<3;d-*4}((%1f~(tj+bzYm=0 z7CHOB=>17Qix;liJBj^&?dqJ9@{h}(`0X_KanAO3`n|}_rs>~iN2Xn>>{*$9zwSxz zmYda*zHULq0&X56jVuc34_hVDI%M)g4JGchE7+Mx=N&#M7TKY(Y{jBZu6NrWbsHRd zkyZN;J%i)Sky_vvK5c--%hRH0PJEgCM+?_tFrlcl}RM8&Z>S7cJi*PqMpPhFk4 zbzZp0G}XDa(MC@dr!WBrrX_e|6RYt7|3o`hkuFsnIZTpHu zrbo|Ltor}++i?=l1?GWQtm)-ed+3N)!#;abx+s&?Ny=viy bYuW2Nzua5Be)rpVuix)yVE0LOV6X-Nhn78$ diff --git a/doc/sgml/user-guide/pix/Image37.gif b/doc/sgml/user-guide/pix/Image37.gif new file mode 100644 index 0000000000000000000000000000000000000000..d4f0a9fc6dfad39b6352eb856b0ef85dce8e6987 GIT binary patch literal 1818 zc${IeFRH8RogGuADShJvYxGGD}9GL8W0a$3!6uuSp9oE%RpADwUeL>gp=**-oZb zL0Vz!m=3z#{k2smvdw32o37^q<%9ja3)$v+Z(nzJx6RCdN2<#+F7~n?Ws>u$C~)82 zDy$uMX2-_l_5fbDI-i}Jo}QjzoV{#K>E`raCZ}#W-CGLxFRut*9e3AUIdJcWduMllOYCQHViVVlu?U-gqI}npouAZ;XBs6hDv^`jSu*YNRP+0udw&(Z zzq2;`fA~Bbn~E1svHxRli)PWT+VLW;|7q)ax{c<9LIm+`Pwg6Y`RV9Bx<58D;mG#+)ROv`xGsSy>X7{gh6Bq>_m zaB5U}`P-?Jdtbb4QLeO{d3=^I)6_RR6+NZDzYMefV`wOK9YLnm(KoFCP6(0xI}`$p0GbG~#gT^`AB&2nlr zo6wir(G#X#Q7QI2_F{5Lr`_@uQ_iYNr7nKjdR%pCcUGtDbfY-Wr9JJF#5ETiu8dre z5`J)}T3yYz@>Mnecm9`py{7t;d-m!^DUIn9 ziD~cm{&=?f{k}inUccYZz|Lc^MPE)N%JGZZnu1NscKv?1z`bcpN?@>U=d8u0Z*MH_ zlR1B4L)Dr~>@UJ!W~nOVFx!Q03eh@mDcZ=qY0uTuCg;!O2KoKv+~`oyx@F0EZzIjD zW!++TQ~La>v@}obckSIvQ;K}Eym*U$tG8@8cW2&?@R_}@ zcWk?MEB!WqtImaUEMMMyE~wzHjlJfRd|`U#<&%|F_bQq`OQ=1x;oBSjaDv-Ri~GI7 zyjeG{?&5rK`rX6l-)i$uNhO>$65sK2ZNX;U;*^rxykG9JMy=UVKJoY7udg>;&fD>L z+BFl4X+75We!o8%Xg6uSnR2Q6ysMic@1M+`^zYl}dF$`)d6u&_;>8{A^!>Ar$tQog zRg=;0z3Jr6LplFWB{t66cXr|W`*mmD9p|?{_g;R-qxmB8tl=AOeScpc%j-P-hs-qv ziNEg~ID8cL-db{iZ5K-vOHV?ZQi(BV)Q2WDA!#=A6OKZG7s6%LcouRlU25SHu91WuY diff --git a/doc/sgml/user-guide/pix/Image38.gif b/doc/sgml/user-guide/pix/Image38.gif new file mode 100644 index 0000000000000000000000000000000000000000..0fd9bdc334902ad3121c12ce5e67ae38a6bfc9b7 GIT binary patch literal 4397 zc%1Fi`9BkY?IB*( zCtLzIl!5V_JknfeuDi51z@|Qxr$Z`idsN!LqiU=q4Q&Z&# z*`gGZ4{4^1RzVv*e|&1L8n1QfB3w3Yq0$@SBRL`*Q5F5AC~;Xw^#GWChxaDPaN^sB z2sed8a;mIz+wv4h}-r7uPL@e=pjn^s2RMFd~= zZ6m*rA72uLgF9N*r&0pdUEt(wh1X_O_@6d z|NHLsrwPC@xDcMJ4L+B2hY?%ir5*ZV7OfdEUVt%>p#KcJ-Mkv;?*G)nU|x^0~>9ucgk zMK1r0my7SbTp4+!sZ3Zd6+6WTu*BJcm%@A-0N3)*uWA6&k)eEWvZy~ny1W9$T%!C* z%mI=s$4D!yl)8V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~zU_+rov;6?WuSgu<|URlTsB}{H_rJXZ6_veUR5RXh7ApcujUNws_ znvqk(bJG~$+PLKF587|ZHf_BxH$}ra`h;iL z?R58EQgLrV$8y1bH-0S(z9H(8qAsh#KT;%>jh(41JkTg$Lo?E-2#;d0!f{0YKy>y< zm$x#k*oc+hLz8O+`5r;@-&`b?R%E}1m7M=jxCu_p%qUa^O5e^Y($Xl@6DtEi3tfT> z&yq{ELhZFZjT7L+Tl6#zf~zc{$c$1f%PQmY%t)~HXxPTC_on-pywv$x_C2fg^vV32 z?K!u~3!jJuxDkl3(5RNC{5@vAuq^>eQBk);nBYTWac2wtTmGm-YC@5hC zht$IRiuO`FR;Y95krH#60+dRqK_UfMx@)LakEn)oQbX-1E@@c?<>g9rYc4{}wr9;K zrY4iG>e+s7BSinJN#1vQ$2~AYrC)}~AtBlDQe<)R8s?H#oYGPZ*YoC@usaw#f z=gp~Ge&H`V6)VzF|9rCk&t83taD!BTpmaY*_IZO=X2Vo{gS>r!LI+k!yirlDQC8>- Hht_`p(D_LL diff --git a/doc/sgml/user-guide/pix/Image39.gif b/doc/sgml/user-guide/pix/Image39.gif new file mode 100644 index 0000000000000000000000000000000000000000..b584af079d6b926fb6691a4e5a54274b2c27ae30 GIT binary patch literal 1377 zc${aw!!&U|_Uk z6*uPdX<%4%h($qI`*LwXLr>Wj3Ryw-9 zKy#bPt1WpRD}s8b`L1esAGq1zwO4LeFyrx-blI|{yCOb@uW1)_%5m7a>FMcd@k#f3 zB8{J)=e23RCo@ysXTG?gnV#0A1#!(a{{P-&ZO^;7mHGCuyRm`>4{s@&+x@#8z97EQ zyZyGE8@p1r-aUDW z-+JEP(u2**mFAq^zaJQAY#Ivn9f|1=8rjQQ9yDW zH`^yxamhTGm%WO2xm@k`xvVkShe}t3Z=KL87 zj$cD^oA;VcU|^CEU)I<1v^6X-L~P0p7ll(1ab0nGm2)O1O^cj8+vV%YY3)a3uRL}C zsTld#$=dgn)STOvv!s`BXJ$=Z5jyddSlPP3A6FRHYfpmlqVcG{xh(0$arj6 zaIl#}SS#kl1%(Di0cAdhf(c27yCsapcoYsiI?yi6%_QM@N!f9-vgxXj6NL74BoTsSM%dxG+bPJydzUw?d64&Iuxz3j+ovDNqH@qJg*J-KE5!ToK# z%Ii*SE{NUL$6dZx`=`#$BQx0b&c&2{_B>}{tF3!e!o+R6qVIQC-HG~%SCj60^}OEl zEqHf=g;R;B-y0 zA};oU>a>K+^`6TXG_%NAOpV_3bNRzInIaB_sFjfw!r5CoE#le~ZylT0s&dXuJlSLI z_M|w4ZDJ3LE_Z&9tySm?NlM^$+crH*qVCIMe+Rp8#X_}h&o4~$)e}jW(jL0wLbf$m zda9GY8)t07gxYDTVewW^gZsR8J)hgNU(|G2e6-NlWqE}`l~Hrc%uG_}g+0ui9m5)? zvaBXci$!$yS=rKMB`xbj7SC>4x+SA(%GsS0=TDjSJz|0ZZ&qgXj8B~jD;9-CW~}6S zdotaZam%Y$t2Z2T(t5pS%eAc6Yvt#4X?ZVscWe2&eR4~(=B1viNZ9zw_gluSzPc^< l7Jt;dmOUepD>Em3?=P!0b8iQoytwv3oA$dM+u2wctO54@C+q+K diff --git a/doc/sgml/user-guide/pix/Image41.gif b/doc/sgml/user-guide/pix/Image41.gif new file mode 100644 index 0000000000000000000000000000000000000000..bf25ec20a23b5d131088199ce3bbcd6798e9acdd GIT binary patch literal 952 zc${IG&CGIaNs|XH3~+-NCJvKS-`XohydjY2ac%>oE$P9 z8x}Y+F>vri>@aX(XcJK86POV22&lqP?+Ay3vTLibY+Fsn#E0%3OhH9&ZWt~;-lCa& zYL4gUl#{c$bC=0<8mGHXRx&oq$^4Y=GRS|9nD=>jVJg5;3UC>xkmI0CS{P<#)yKNy4)XstbDJAsM9$TKq~QW|5Yz>@_pcKwkQgcQ0N{BST)h19ZBSU)&tP zMi;Xqi!mFQSCeWz+kE4G++2AP9;v_HR>F4o79tcw~{D5|MH>@dj1u}BM2Hvgig%Gpfx5k5V0M2%%fN~XVjmJNG^mkP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bQ<{KfoNVwRWqO(VBAYI9cB{Yd=2z_aTE>OP9Zw@~sxKB;o_~tWmMwz9gMM}Rj zlqsR>fsq}Dvtq=4`S~K6G|c&NHpNd+PBJKRwS<4Sc#%^Be<;l=!vbm*Z4~uN1Zgkd zV0j|HQJMCb@`8$YFp=TC|o%BRn95nlrE) zsUDqfR5(dhu&h2XFnNG*n50KIK8cg8FYKo%CYL=3bhrfm33-6;JA+UDd!f-OTsq(dlrie{Zc=b86?{^jL{JTGyNyykFA zptjoP8Hrx6|HNr!$UmztY&DVUcn0K@V*IRAIQXOPFNZmDl&Zf316S`yOM@WwSQhKo z{5PIXwF#G855Y<@lLHPHE`3(+N1EEDl8+ZBvQ-8=?+u1wKgIZ@B Vhht243xt0z8<>S`u(Jbh{SBK`IM4t9 diff --git a/doc/sgml/user-guide/pix/Image43.gif b/doc/sgml/user-guide/pix/Image43.gif new file mode 100644 index 0000000000000000000000000000000000000000..c446167c71902fa153d1c7df52e70764e2b62b30 GIT binary patch literal 2486 zc%1FicS8~g1IKYknKRSOZRZvjdN?YtF0)+ZL_$S#hmhOcqepY(;VMl{$U%zY1h?Qe z^*~%{?uq2gOS#HXdOXiP&&zo3^T+r13V!C6X4kKImUEPI9C7?l!hiJk_OjV*j(_~) z|B1rMx&N-#-}(C!#=L9}K3-W1QfXfj?_~{FDhc=Q`6VTwtgd{*U^*wSM<*eq%p5JR z&c$mP+H3Jr#i95d8HA@70K6&wC{a~QjA6*Luhb?rTdZ*szZ|%k@V-opPyXR>bJbL( z)p-s(OxQNC$b~G$fnRVxmzsErPq(m+zEQCB# z2w&#}C?(7mA(&Y}*tvC6B_8z;sd`rc$`0C|M@279Eu%i>T7QE{-nk7!;XR=Fa}N3W z2G^xLT~pO3ywpI5%{*l2D=)8vymmx^jfr}teaKj{cVg5SN4yPDn{g1jR99W zsuekp@vg1Oi7d{J%5&K)H0J5p&MaX$6({P3V~}lyHpuOSeMtFUqoCo|ehr`S@4!mZ!_Jjuwulr=Uz(@!f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me0Zvdp3EA-b8uR?r}Vt^2@i+2qQm!F8I3I=*oGUT;|hYrFUeiUT12+ zBg+X=&u-Sr(%Q=meD#pYxXch<61!yT4{rZUWKJYC&jK zf?X;#u&i{JsD{`rPHieut$w^sSn5nkxABkWGa&Lb9u#UGj>|rYl3ZGx3IR7lByB9U zR}gg1anTr`XjQ&jn7A^0bF^cS1shnq7&u$l*)n`Ladi4;G&DvO{(lGm_I$j&XyX45 DfUWw1 diff --git a/doc/sgml/user-guide/pix/Image46.gif b/doc/sgml/user-guide/pix/Image46.gif new file mode 100644 index 0000000000000000000000000000000000000000..532ad0d82a3dab11bed58b1082d29b8546a13ab6 GIT binary patch literal 16018 zc%1Fib3+{t!1nR1Ra@q2+19doawpriZ5t=sb|=@CPHy33+gonc&hLKi*YVt+KfbTv zy5tq*z6+XL!@I!0!2K^@U*EX6xc>hB+1c6u{`(IOE)?$n{Gb0nu>NoU_X}`nFgR2+ za)s8?pOI*I%tn)~WuviQXp{;S+RDchiFq7Y(aa>mQ@=?kkSn%VPGvG`)f-K2xM^YX4=8ImP!{su6df%9tOjfxSsAAz)cwjcSW`l%@7 z01K(ecA0P8EP~tw)i8ooj`1*VC%AjhPt3Sy(~LCYwJa8s6s;nFcGd34?eAZFlW3x1 zNO=&?bgoIP^n~A0xtz*PFT9^%D^kQfMei&y5aZm2g0@M52VjdZo_Dw3f+D_ zJRe(1VaU(6j-hG|xQ*l4Cf!XC`8wS}Hdk5n^v1KD?xz@Q2EM3&mcGV^1OEKDpHZIr zAn?@u+349Ua<%!eAcl(Nl~4VEl+`gry+SDsU@_KM#*w^vl+ct0K1u2}G(N3jU#xKt z-b(E_WnLZ{{aJ#0S#w^tcwjMU-z#rwgLp>Hw(WTB{cD7^PZD}{_Rd};@r3RV8u$1` z(XjiB{C``xX)$DTd4Tebv0 zZ@c~ue%TM@2zfnDbq)D@UXnVPqxgcw=1-&O+Hswa!Da_hr`X&l{{+s||OCyjpjfF$^2=oO&{(VqThIfs!^#D14nOX=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wdiUbEI{6Dhw0!9D; diff --git a/doc/sgml/user-guide/pix/Image47.gif b/doc/sgml/user-guide/pix/Image47.gif new file mode 100644 index 0000000000000000000000000000000000000000..b992e11fb6e592fbab292ab82d9a112bbf6348a2 GIT binary patch literal 7511 zc%1E%^-~lI+lB!F0Z~zuSP%?Sx>;H}7Lbq*$%REaq&t@G?(Sw;VCim(3kD)7cp$9MU!NY~Ka=FQBAMwKPGFKr0F5*hkEL>&jbW|ekoi7u{Et5 zHCoM97>+epufQF)MzfXRHERg>i-WbXX4Z`^|3^<~KrMB@`=HrwyqPWaTSIXllyX3e zwT6XXxpL>*QyYI3v&dA?g?}yDpDojIjYPwScr(;e~b$wm*;q=pkPzgSMRav-#}BArEcs7 z+^w^KDD2jkzGh)<&_CY)+qj;-15R{|fI$iuB=vObr`-;Z;E^FFXyh86sNVFWL2mBxKw{Rdy%s3RIS&& zPf`%d5iDne)Ec2@1Fs{|^%}r+4?w=!OYg6>#ES>qH3Avm0HZgQiyQVGz2D5@Zlk50 z{oC=64652IAeVXX(SlAxAc6a(8M^Bbj$tRr-^+QO3p~ELtx2%!!q>1hip3>$wyR|; zIoYc@%F-h@eM|bc-*MPSk2Z0vxk9gTh)yv_xk>JY19Uhj&J2O1;qU>gVWX}i)NiQ? zLwHm`?f^w{=o2xE%?O)L-RylfcG!TexSeMrVM$Hffm6+~&|zQ~yRh&61Uq6+UcmSE zxP42|b7nV?=52$Ub zWuN1PE}e(lzwp|%o2Z74JLK`AJ?6f$$G+xVtupqX*}CLDtmBDb@J{^+#@DfWhPvWM zSOZ9+e!N^k;I11ZMeHZi$#-5^f_0mS(P6aAkcd~qHhK>0+i8j@eL<9u17@`=H- zy*0(pgL%gDpIyjtoveM96DBSo!8kiNp*p7hr9hiRHag8Szdwh6e)W!2bg%nV<}BiI z*5->`=m7is&yi%f1>{3%12hG-&<>?Szy+*}v*s+iLn(*qxBSr1NPUd^_?CV~*^t;m ze5@~V5deF?R1$C=2L%`OW(%QAT@EcY}G0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{z-M~Zh$^7F0U2fDjc?K`^3q_VE`sag>YPV;&m|>tAC9YcM zr;RjlXD1Nf$ZZ2JA+0};3h+-+ql)lJKaZ;D^>(AGI0l#Z^QXu3O`oMO`>dpr0!qR) zYI3w8yy^;!#ZBr;90R->$^yksa2X&TpQf4|Jxo(WRR$>*GReyEMcX)pPfHi$UZ-Q9rdFM2VrRXP#Zfdq z8gtC0K5H|=r7l+>HNT{bKt1@}Dgz%<6uI_fGdpjahwXs_ZMvxW9p4V_a}(en=5o_v zQ|jxrV-L@9V08aI@z?tY*>Kd|DPgbJ_wBAf>t4GXV5}5HDS&Wsak1V#ya8!hTYP`} o*~$K`jGM_fR}&X&d%L$<7EaFp7z^ti=E;8#|Mc9PoLIvD2UWekSpWb4 diff --git a/doc/sgml/user-guide/pix/Image47new.gif b/doc/sgml/user-guide/pix/Image47new.gif new file mode 100644 index 0000000000000000000000000000000000000000..c3f9532970fef5d7d2bdd43ae74fcfcde23f3c89 GIT binary patch literal 6543 zc%1E%^-~m#_i#Z`QW_rxK|w)UMJWmCmJUe~1Y}92cLC|{T)KOSW$EtPr5l!|Sy*7{ zhUI-e&wugGe9z3Cb7t;ucjn3~$_WYou)xp7zrgz+KL3r+fAaaS{)K>mAb^12_Ld+Z zAfTtG=l0(s2tXo{c>l-$@&6$m9Ub@o>K^a@Ki&UV|HA#h<^O&Gj|hkNlIVp(Rd%O8 z5e=u&Kvhn6Fy(8dbOmT`Z}_v10Pc_#N&o0q(qS(YtMdor*|kcI2CEC;$?wgF(iLHa z!)dQ5oNYU@i$=2~{7D#syn>T4nagt8FX71PTX!v1a_Ai)Bu`sNqFBo5w_y zw`ATre0yW=jAOb{4133@u{`DFJB9|wUGeYzPmR;K>?RO)xW9z@X`WX*+mmI%hD)E1 z_WDTmu&RGWPq62MX{cq-)_;!%yuedG=oCybMlR{Sw7*^L&vvJn_-7@6Hh0#<@zD_B zf+qqypRXZy@RNfmJ&tISva46_V-o_#ceIn@L6nGaV01gE$JoN6@*=l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z<4b-c_ z)mta%jrqZd@rJ^A;Hr+C?{El90Bq)*LTYc)=~Oy+Rbq8<^LWv1azhNw|0v}IVslDU zXa0g;gGti^M|SJm#xnsNLP@AcrTII^?u_rnf}QVjGUfctbwm97FW&EC#Dw#xaO<;x z>tyt=b?8o2V_VlfPT#GGc1T@2Ig`N_D*hvT$n`r}S^&Q#pF7Pa@SnPyZ09=~;nh{o zGme83AHVcd+!*lFo+zG^n7@8cx|?I0HR~D(p*`jj&#@MZf%Qb`>(l*lUp6zh+uwh# zv6C4)Y7dgu4^mza(#Gzcc}~F#Ze;DZA8mV|PYH6We?tfF_uC$B937CycSo-u)TJN4 z>P~1t+S^rbEU15H84w=n-lS6q@9=WFF1Fd}aD%vQNn{Y7Or&c|zCM|8drmYz`Ul(k z0aO_KEpDI2A8MTCFYg4?oM#w2xF|f4ez*gV>E$ZLc^(fe0wy1Ao$ba1k zg*mmjPt8y#KiGyF+w;2D=w3I&d*3}hhV(aUV6(A(Yqet^|5H`v%-&~KL*ct;t8EOb zr1ltfO!373W$w#qCoi-*J<{UiC4fRNWByo#k(uZFG3FS?(hU z!HTRJf2+w?D>qiHsLwQDeJeimseAMhdVH)Sdv6)H;urEgW%O;0@J$%Cw>YY1!lZx=1$?>*EXn&EOk57YO4V?R)U zWiO>q0cpqDYYT$7nyQ+r z=D*dEu6JUGJr;1V7Qn|6z)-uY{R@2Sg{4wwdoK*xQHE@v1sKj(f&O`?Lq$U2L&0NF z@)YcgLLng#D^xUmABn`GQLC{r_)9SsOT_I8I{*7)B9Vdynb`J@QWgqY3(q<7j!Get z%6zHD_MUn!m(Oi(`=YsEAPrg%nF;VfyHp~V!RB!JK(|t%R<6eRc25ti(e?$LR3?{B Q*XedfGogI{4#off0PM}Pm;e9( diff --git a/doc/sgml/user-guide/pix/Image50new.gif b/doc/sgml/user-guide/pix/Image50new.gif new file mode 100644 index 0000000000000000000000000000000000000000..debd88618008616534f32eb62d9e1f14ac65aa10 GIT binary patch literal 4897 zc%1F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8%J1G_yG;D+=Eu72%sVde)X1#iv4WT^ diff --git a/doc/sgml/user-guide/pix/Image51.gif b/doc/sgml/user-guide/pix/Image51.gif new file mode 100644 index 0000000000000000000000000000000000000000..28ab8d6f490b651f67dac0ff0803b720ff9be3ec GIT binary patch literal 10956 zc%1E*6Gr09tNa4q+tjpq*1!N8M+x5ngNEPySqaqrMvTd-?@yl z&a>8z_X6G@TR}-)NYG3OnH%L6>A$@GNB&6u{z$L?ZLj|R{+*qjum5}eKmX7FZD{Y& z{x{kGYybTTDfCw)dRfDMWu!EGAkFB?{#N z81C_l`hx_jiTQ?M6${nk34xR&L@ZsYzzUaa5gyP)iRc_%{D@}NT9Vt)!P>}e(PF#5 zD_CU&ze>H4MVIauSg>YmApZI#hQhOEx;rL_&V6L&^WbQPYbdb_yuq%c6xmST2YzVX z7X>NFQSrIiUN+U`a%@XI1|Yo&)O|xE)v16qsPMZVOUui3bu!{ltdo|Yb#=8f3XQ+N zs0R{imgXz<*FXQR;Gau}C!$AVz~GP&*`lf>^v+cKkMTA_7U{bt{(v z;bEO}WgOvGAWJ-NRBK{CfxzfOkKhW>sdu1ID~yERxng^wPzl1#8> zJT^>xXRZ9xC?m7tY`5MHJI%=p{CRCBl%{;OL_>WHLdaP-R@7@8&hGoZ!M0g9x-%xF zpjmQ31>P<%!rO9#*5$&T|281|)zs*|614A*+;gg2?pW4R&Su$}GQ+czd2^2XC=$ni zPX7KSVY`>w^s=}}ZQ!~4*QDCv+hD0(Ed5ZdroQV|dHqwZxp`)^Nc&*ad+y_4KaN%{ z^{%z*lK>ABleLD8_XePvIKi9r7oOi4mreCKhzkX~7?JImw-b{qMU!Z^q%(?T15d=}Q7hwo;Rw1IJkJ_~#UTxn9&!{0?k*N2#lRqc z6i+na{tCi<;=$6{42+1+th9@f%&)R^#P~uuvg>-PDa@@>=SFXpNEZLf>o` zoVs;OwB3C+sZTWD2p!-=a>w)IIx@I)_$MjS!fpr5#6hhmRb&i|h#%Q9#np7}HqF?T z{~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)k!g#p|4}QYC-lMzCl(Ckwp`V3Ay+VLBrM>EsJy}4U?{;vmdI$o@Sd!4J zGZ%*x#~$7g`+9aKi?aFg@=T zM?u&aC*O!)2@$O|5y_(wtW@JF_M^j&pMZX;j36V6xuFEZZvM=X3rC2Vd*8em?qhFn z)X9Lg?x^nEuIFmrL=x znc=s~hU_*6g)_sSM;reE8nVp~y?rndzdg>igPU~>&C}>h?hSXCA9OGr%bA~!0EXpa zCS?_8K*Hm?l%r#LRXDHT%syRhjE*j_UU_$KJyBvCprI&$~c| zCdv{9*eg}Z_4B>+^K=d~OY?Jk+f$3C3(o`=hE*2`e)HQJ^Rbr;0G7q+orOQ9iyMBh zp^U}Ika=X(;$Kq}it_gHS4(=jOCNLRsWq35f5i>WFOe^oA{^%Kl`GH=oR^=LzY~i2{k-L!sB^z~`ETy>WuBB3k(L!s z;)+Vlp8ALG!n{ zoSE*zs+HVZi|@JAJ}t}PEpMPA>(L@_A{SQTiJMN}HZRj}4xeHS#!!*c$GzV?eMAJ-5 z|9qf2GUPlmYCSS`88Xm1x?s1VsT2U3ADg-y+mcg*SfoSK*1*_*pZT$y|FOqwl8F@T zAv5Wd=mhQ-Nmq{);6j4DK5+>rX@ukUtS5oKVj(IgF`_4NGgEP%9_r!R$LwESJX!jJ6ebzooQQ&{-&mq~(dS3ndyw?1@-v1n(ecokq^!TEk z-x1SN(aOnoAw+l4Nyc>eU+`pH;5ggMv7JMlmm{w)$ILG${4b}nFK1dWUrSM^6h6I~V6i`ZjLv|4c!_MZWppz`wrOvu6}C{||RPZ!Q1; diff --git a/doc/sgml/user-guide/pix/Image53.gif b/doc/sgml/user-guide/pix/Image53.gif new file mode 100644 index 0000000000000000000000000000000000000000..3b7609078b02549104e3ecbb54ee8324ccb6b832 GIT binary patch literal 8829 zc%1E)1ydY=vaGS-!Cito1b0nvcXwT!KyY_=S=`-yfyLe3-Q6KL$=-AB`xme7SJl%! zKVYU>T2_jW*R%m<9O?z?zd-(@K&Ze#D9HayP>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z&kvw#eC(~Qle zm)npGhNg_&ITgZr2GzsNLsyk!%S`fs%=1>|%ht?`>C9_QWipnmeaWnw^Dihvv$k`y zsO4VJ&S!}|%%H!St#F+6utMokX!cBQHtUY!sUM3UcKzIh=jDEKRv8ZSt?=@>(`>`QGN;GtJY!Bd (ICMP) and networking support
//
//========================================================================== -
//####COPYRIGHTBEGIN#### -
// -
// ------------------------------------------- -
// The contents of this file are subject to the Red -Hat eCos Public License -
// Version 1.1 (the "License"); you may not use this -file except in -
// compliance with the License.  You may obtain -a copy of the License at -
// http://www.redhat.com/ -
// -
// Software distributed under the License is distributed -on an "AS IS" -
// basis, WITHOUT WARRANTY OF ANY KIND, either express -or implied.  See the -
// License for the specific language governing rights -and limitations under -
// the License. -
// -
// The Original Code is eCos - Embedded Configurable -Operating System, -
// released September 30, 1998. -
// -
// The Initial Developer of the Original Code is -Red Hat. -
// Portions created by Red Hat are -
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -
// All Rights Reserved. -
// ------------------------------------------- -
// -
//####COPYRIGHTEND####
//####BSDCOPYRIGHTBEGIN####
//
// ------------------------------------------- diff --git a/packages/net/tcpip/current/include/arpa/ftp.h b/packages/net/tcpip/current/include/arpa/ftp.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/arpa/ftp.h +++ /dev/null @@ -1,163 +0,0 @@ -//========================================================================== -// -// include/arpa/ftp.h -// -// FTP protocol description -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -/* - * Copyright (c) 1983, 1989 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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. - * - * @(#)ftp.h 5.6 (Berkeley) 4/3/91 - */ - -#ifndef _ARPA_FTP_H_ -#define _ARPA_FTP_H_ - -/* Definitions for FTP; see RFC-765. */ - -/* - * Reply codes. - */ -#define PRELIM 1 /* positive preliminary */ -#define COMPLETE 2 /* positive completion */ -#define CONTINUE 3 /* positive intermediate */ -#define TRANSIENT 4 /* transient negative completion */ -#define ERROR 5 /* permanent negative completion */ - -/* - * Type codes - */ -#define TYPE_A 1 /* ASCII */ -#define TYPE_E 2 /* EBCDIC */ -#define TYPE_I 3 /* image */ -#define TYPE_L 4 /* local byte size */ - -#ifdef FTP_NAMES -char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; -#endif - -/* - * Form codes - */ -#define FORM_N 1 /* non-print */ -#define FORM_T 2 /* telnet format effectors */ -#define FORM_C 3 /* carriage control (ASA) */ -#ifdef FTP_NAMES -char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; -#endif - -/* - * Structure codes - */ -#define STRU_F 1 /* file (no record structure) */ -#define STRU_R 2 /* record structure */ -#define STRU_P 3 /* page structure */ -#ifdef FTP_NAMES -char *strunames[] = {"0", "File", "Record", "Page" }; -#endif - -/* - * Mode types - */ -#define MODE_S 1 /* stream */ -#define MODE_B 2 /* block */ -#define MODE_C 3 /* compressed */ -#ifdef FTP_NAMES -char *modenames[] = {"0", "Stream", "Block", "Compressed" }; -#endif - -/* - * Record Tokens - */ -#define REC_ESC '\377' /* Record-mode Escape */ -#define REC_EOR '\001' /* Record-mode End-of-Record */ -#define REC_EOF '\002' /* Record-mode End-of-File */ - -/* - * Block Header - */ -#define BLK_EOR 0x80 /* Block is End-of-Record */ -#define BLK_EOF 0x40 /* Block is End-of-File */ -#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ -#define BLK_RESTART 0x10 /* Block is Restart Marker */ - -#define BLK_BYTECOUNT 2 /* Bytes in this block */ - -#endif /* !_ARPA_FTP_H_ */ diff --git a/packages/net/tcpip/current/include/arpa/inet.h b/packages/net/tcpip/current/include/arpa/inet.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/arpa/inet.h +++ /dev/null @@ -1,107 +0,0 @@ -//========================================================================== -// -// include/arpa/inet.h -// -// INET support functions -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -/* - * Copyright (c) 1983 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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. - * - * @(#)inet.h 5.7 (Berkeley) 4/3/91 - */ - -#ifndef _ARPA_INET_H_ -#define _ARPA_INET_H_ - -/* External definitions for functions in inet(3) */ - -#include - -__BEGIN_DECLS -extern in_addr_t inet_addr __P((const char *)); -extern int inet_aton __P((const char *, struct in_addr *)); -extern unsigned long inet_lnaof __P((struct in_addr)); -extern struct in_addr inet_makeaddr __P((u_long , u_long)); -extern unsigned long inet_netof __P((struct in_addr)); -extern unsigned long inet_network __P((const char *)); -extern char *inet_ntoa __P((struct in_addr)); -__END_DECLS - -#endif /* !_ARPA_INET_H_ */ diff --git a/packages/net/tcpip/current/include/arpa/nameser.h b/packages/net/tcpip/current/include/arpa/nameser.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/arpa/nameser.h +++ /dev/null @@ -1,287 +0,0 @@ -//========================================================================== -// -// include/arpa/nameser.h -// -// Name server (DNS) protocol description -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -/* - * Copyright (c) 1983, 1989 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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. - * - * @(#)nameser.h 5.25 (Berkeley) 4/3/91 - */ - -#ifndef _ARPA_NAMESER_H_ -#define _ARPA_NAMESER_H_ - -/* - * Define constants based on rfc883 - */ -#define PACKETSZ 512 /* maximum packet size */ -#define MAXDNAME 256 /* maximum domain name */ -#define MAXCDNAME 255 /* maximum compressed domain name */ -#define MAXLABEL 63 /* maximum length of domain label */ - /* Number of bytes of fixed size data in query structure */ -#define QFIXEDSZ 4 - /* number of bytes of fixed size data in resource record */ -#define RRFIXEDSZ 10 - -/* - * Internet nameserver port number - */ -#define NAMESERVER_PORT 53 - -/* - * Currently defined opcodes - */ -#define QUERY 0x0 /* standard query */ -#define IQUERY 0x1 /* inverse query */ -#define STATUS 0x2 /* nameserver status query */ -/*#define xxx 0x3 /* 0x3 reserved */ - /* non standard */ -#define UPDATEA 0x9 /* add resource record */ -#define UPDATED 0xa /* delete a specific resource record */ -#define UPDATEDA 0xb /* delete all nemed resource record */ -#define UPDATEM 0xc /* modify a specific resource record */ -#define UPDATEMA 0xd /* modify all named resource record */ - -#define ZONEINIT 0xe /* initial zone transfer */ -#define ZONEREF 0xf /* incremental zone referesh */ - -/* - * Currently defined response codes - */ -#define NOERROR 0 /* no error */ -#define FORMERR 1 /* format error */ -#define SERVFAIL 2 /* server failure */ -#define NXDOMAIN 3 /* non existent domain */ -#define NOTIMP 4 /* not implemented */ -#define REFUSED 5 /* query refused */ - /* non standard */ -#define NOCHANGE 0xf /* update failed to change db */ - -/* - * Type values for resources and queries - */ -#define T_A 1 /* host address */ -#define T_NS 2 /* authoritative server */ -#define T_MD 3 /* mail destination */ -#define T_MF 4 /* mail forwarder */ -#define T_CNAME 5 /* connonical name */ -#define T_SOA 6 /* start of authority zone */ -#define T_MB 7 /* mailbox domain name */ -#define T_MG 8 /* mail group member */ -#define T_MR 9 /* mail rename name */ -#define T_NULL 10 /* null resource record */ -#define T_WKS 11 /* well known service */ -#define T_PTR 12 /* domain name pointer */ -#define T_HINFO 13 /* host information */ -#define T_MINFO 14 /* mailbox information */ -#define T_MX 15 /* mail routing information */ -#define T_TXT 16 /* text strings */ - /* non standard */ -#define T_UINFO 100 /* user (finger) information */ -#define T_UID 101 /* user ID */ -#define T_GID 102 /* group ID */ -#define T_UNSPEC 103 /* Unspecified format (binary data) */ - /* Query type values which do not appear in resource records */ -#define T_AXFR 252 /* transfer zone of authority */ -#define T_MAILB 253 /* transfer mailbox records */ -#define T_MAILA 254 /* transfer mail agent records */ -#define T_ANY 255 /* wildcard match */ - -/* - * Values for class field - */ - -#define C_IN 1 /* the arpa internet */ -#define C_CHAOS 3 /* for chaos net at MIT */ -#define C_HS 4 /* for Hesiod name server at MIT */ - /* Query class values which do not appear in resource records */ -#define C_ANY 255 /* wildcard match */ - -/* - * Status return codes for T_UNSPEC conversion routines - */ -#define CONV_SUCCESS 0 -#define CONV_OVERFLOW -1 -#define CONV_BADFMT -2 -#define CONV_BADCKSUM -3 -#define CONV_BADBUFLEN -4 - -#include - -/* - * Structure for query header, the order of the fields is machine and - * compiler dependent, in our case, the bits within a byte are assignd - * least significant first, while the order of transmition is most - * significant first. This requires a somewhat confusing rearrangement. - */ - -typedef struct { - u_short id; /* query identification number */ -#if BYTE_ORDER == BIG_ENDIAN - /* fields in third byte */ - u_char qr:1; /* response flag */ - u_char opcode:4; /* purpose of message */ - u_char aa:1; /* authoritive answer */ - u_char tc:1; /* truncated message */ - u_char rd:1; /* recursion desired */ - /* fields in fourth byte */ - u_char ra:1; /* recursion available */ - u_char pr:1; /* primary server required (non standard) */ - u_char unused:2; /* unused bits */ - u_char rcode:4; /* response code */ -#endif -#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN - /* fields in third byte */ - u_char rd:1; /* recursion desired */ - u_char tc:1; /* truncated message */ - u_char aa:1; /* authoritive answer */ - u_char opcode:4; /* purpose of message */ - u_char qr:1; /* response flag */ - /* fields in fourth byte */ - u_char rcode:4; /* response code */ - u_char unused:2; /* unused bits */ - u_char pr:1; /* primary server required (non standard) */ - u_char ra:1; /* recursion available */ -#endif - /* remaining bytes */ - u_short qdcount; /* number of question entries */ - u_short ancount; /* number of answer entries */ - u_short nscount; /* number of authority entries */ - u_short arcount; /* number of resource entries */ -} HEADER; - -/* - * Defines for handling compressed domain names - */ -#define INDIR_MASK 0xc0 - -/* - * Structure for passing resource records around. - */ -struct rrec { - short r_zone; /* zone number */ - short r_class; /* class number */ - short r_type; /* type number */ - u_long r_ttl; /* time to live */ - int r_size; /* size of data area */ - char *r_data; /* pointer to data */ -}; - -extern u_short _getshort(); -extern u_long _getlong(); - -/* - * Inline versions of get/put short/long. - * Pointer is advanced; we assume that both arguments - * are lvalues and will already be in registers. - * cp MUST be u_char *. - */ -#define GETSHORT(s, cp) { \ - (s) = *(cp)++ << 8; \ - (s) |= *(cp)++; \ -} - -#define GETLONG(l, cp) { \ - (l) = *(cp)++ << 8; \ - (l) |= *(cp)++; (l) <<= 8; \ - (l) |= *(cp)++; (l) <<= 8; \ - (l) |= *(cp)++; \ -} - - -#define PUTSHORT(s, cp) { \ - *(cp)++ = (s) >> 8; \ - *(cp)++ = (s); \ -} - -/* - * Warning: PUTLONG destroys its first argument. - */ -#define PUTLONG(l, cp) { \ - (cp)[3] = l; \ - (cp)[2] = (l >>= 8); \ - (cp)[1] = (l >>= 8); \ - (cp)[0] = l >> 8; \ - (cp) += sizeof(u_long); \ -} - -#endif /* !_ARPA_NAMESER_H_ */ diff --git a/packages/net/tcpip/current/include/arpa/telnet.h b/packages/net/tcpip/current/include/arpa/telnet.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/arpa/telnet.h +++ /dev/null @@ -1,364 +0,0 @@ -//========================================================================== -// -// include/arpa/telnet.h -// -// TELNET protocol description -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -/* - * Copyright (c) 1983 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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. - * - * @(#)telnet.h 5.14 (Berkeley) 4/3/91 - */ - -#ifndef _ARPA_TELNET_H_ -#define _ARPA_TELNET_H_ - -/* - * Definitions for the TELNET protocol. - */ -#define IAC 255 /* interpret as command: */ -#define DONT 254 /* you are not to use option */ -#define DO 253 /* please, you use option */ -#define WONT 252 /* I won't use option */ -#define WILL 251 /* I will use option */ -#define SB 250 /* interpret as subnegotiation */ -#define GA 249 /* you may reverse the line */ -#define EL 248 /* erase the current line */ -#define EC 247 /* erase the current character */ -#define AYT 246 /* are you there */ -#define AO 245 /* abort output--but let prog finish */ -#define IP 244 /* interrupt process--permanently */ -#define BREAK 243 /* break */ -#define DM 242 /* data mark--for connect. cleaning */ -#define NOP 241 /* nop */ -#define SE 240 /* end sub negotiation */ -#define EOR 239 /* end of record (transparent mode) */ -#define ABORT 238 /* Abort process */ -#define SUSP 237 /* Suspend process */ -#define xEOF 236 /* End of file: EOF is already used... */ - -#define SYNCH 242 /* for telfunc calls */ - -#ifdef TELCMDS -char *telcmds[] = { - "EOF", "SUSP", "ABORT", "EOR", - "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", - "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, -}; -#else -extern char *telcmds[]; -#endif - -#define TELCMD_FIRST xEOF -#define TELCMD_LAST IAC -#define TELCMD_OK(x) ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST) -#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] - -/* telnet options */ -#define TELOPT_BINARY 0 /* 8-bit data path */ -#define TELOPT_ECHO 1 /* echo */ -#define TELOPT_RCP 2 /* prepare to reconnect */ -#define TELOPT_SGA 3 /* suppress go ahead */ -#define TELOPT_NAMS 4 /* approximate message size */ -#define TELOPT_STATUS 5 /* give status */ -#define TELOPT_TM 6 /* timing mark */ -#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ -#define TELOPT_NAOL 8 /* negotiate about output line width */ -#define TELOPT_NAOP 9 /* negotiate about output page size */ -#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ -#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ -#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ -#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ -#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ -#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ -#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ -#define TELOPT_XASCII 17 /* extended ascic character set */ -#define TELOPT_LOGOUT 18 /* force logout */ -#define TELOPT_BM 19 /* byte macro */ -#define TELOPT_DET 20 /* data entry terminal */ -#define TELOPT_SUPDUP 21 /* supdup protocol */ -#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ -#define TELOPT_SNDLOC 23 /* send location */ -#define TELOPT_TTYPE 24 /* terminal type */ -#define TELOPT_EOR 25 /* end or record */ -#define TELOPT_TUID 26 /* TACACS user identification */ -#define TELOPT_OUTMRK 27 /* output marking */ -#define TELOPT_TTYLOC 28 /* terminal location number */ -#define TELOPT_3270REGIME 29 /* 3270 regime */ -#define TELOPT_X3PAD 30 /* X.3 PAD */ -#define TELOPT_NAWS 31 /* window size */ -#define TELOPT_TSPEED 32 /* terminal speed */ -#define TELOPT_LFLOW 33 /* remote flow control */ -#define TELOPT_LINEMODE 34 /* Linemode option */ -#define TELOPT_XDISPLOC 35 /* X Display Location */ -#define TELOPT_ENVIRON 36 /* Environment variables */ -#define TELOPT_AUTHENTICATION 37/* Authenticate */ -#define TELOPT_ENCRYPT 38 /* Encryption option */ -#define TELOPT_EXOPL 255 /* extended-options-list */ - - -#define NTELOPTS (1+TELOPT_ENCRYPT) -#ifdef TELOPTS -char *telopts[NTELOPTS+1] = { - "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", - "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", - "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", - "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", - "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", - "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", - "TACACS UID", "OUTPUT MARKING", "TTYLOC", - "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", - "LINEMODE", "XDISPLOC", "ENVIRON", "AUTHENTICATION", - "ENCRYPT", - 0, -}; -#define TELOPT_FIRST TELOPT_BINARY -#define TELOPT_LAST TELOPT_ENCRYPT -#define TELOPT_OK(x) ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST) -#define TELOPT(x) telopts[(x)-TELOPT_FIRST] -#endif - -/* sub-option qualifiers */ -#define TELQUAL_IS 0 /* option is... */ -#define TELQUAL_SEND 1 /* send option */ -#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ -#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ -#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ - -/* - * LINEMODE suboptions - */ - -#define LM_MODE 1 -#define LM_FORWARDMASK 2 -#define LM_SLC 3 - -#define MODE_EDIT 0x01 -#define MODE_TRAPSIG 0x02 -#define MODE_ACK 0x04 -#define MODE_SOFT_TAB 0x08 -#define MODE_LIT_ECHO 0x10 - -#define MODE_MASK 0x1f - -/* Not part of protocol, but needed to simplify things... */ -#define MODE_FLOW 0x0100 -#define MODE_ECHO 0x0200 -#define MODE_INBIN 0x0400 -#define MODE_OUTBIN 0x0800 -#define MODE_FORCE 0x1000 - -#define SLC_SYNCH 1 -#define SLC_BRK 2 -#define SLC_IP 3 -#define SLC_AO 4 -#define SLC_AYT 5 -#define SLC_EOR 6 -#define SLC_ABORT 7 -#define SLC_EOF 8 -#define SLC_SUSP 9 -#define SLC_EC 10 -#define SLC_EL 11 -#define SLC_EW 12 -#define SLC_RP 13 -#define SLC_LNEXT 14 -#define SLC_XON 15 -#define SLC_XOFF 16 -#define SLC_FORW1 17 -#define SLC_FORW2 18 - -#define NSLC 18 - -/* - * For backwards compatability, we define SLC_NAMES to be the - * list of names if SLC_NAMES is not defined. - */ -#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ - "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ - "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, -#ifdef SLC_NAMES -char *slc_names[] = { - SLC_NAMELIST -}; -#else -extern char *slc_names[]; -#define SLC_NAMES SLC_NAMELIST -#endif - -#define SLC_NAME_OK(x) ((x) >= 0 && (x) < NSLC) -#define SLC_NAME(x) slc_names[x] - -#define SLC_NOSUPPORT 0 -#define SLC_CANTCHANGE 1 -#define SLC_VARIABLE 2 -#define SLC_DEFAULT 3 -#define SLC_LEVELBITS 0x03 - -#define SLC_FUNC 0 -#define SLC_FLAGS 1 -#define SLC_VALUE 2 - -#define SLC_ACK 0x80 -#define SLC_FLUSHIN 0x40 -#define SLC_FLUSHOUT 0x20 - -#define ENV_VALUE 0 -#define ENV_VAR 1 -#define ENV_ESC 2 - -/* - * AUTHENTICATION suboptions - */ - -/* - * Who is authenticating who ... - */ -#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ -#define AUTH_WHO_SERVER 1 /* Server authenticating client */ -#define AUTH_WHO_MASK 1 - -/* - * amount of authentication done - */ -#define AUTH_HOW_ONE_WAY 0 -#define AUTH_HOW_MUTUAL 2 -#define AUTH_HOW_MASK 2 - -#define AUTHTYPE_NULL 0 -#define AUTHTYPE_KERBEROS_V4 1 -#define AUTHTYPE_KERBEROS_V5 2 -#define AUTHTYPE_SPX 3 -#define AUTHTYPE_MINK 4 -#define AUTHTYPE_CNT 5 - -#define AUTHTYPE_TEST 99 - -#ifdef AUTH_NAMES -char *authtype_names[] = { - "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, -}; -#else -extern char *authtype_names[]; -#endif - -#define AUTHTYPE_NAME_OK(x) ((x) >= 0 && (x) < AUTHTYPE_CNT) -#define AUTHTYPE_NAME(x) authtype_names[x] - -/* - * ENCRYPTion suboptions - */ -#define ENCRYPT_IS 0 /* I pick encryption type ... */ -#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ -#define ENCRYPT_REPLY 2 /* Initial setup response */ -#define ENCRYPT_START 3 /* Am starting to send encrypted */ -#define ENCRYPT_END 4 /* Am ending encrypted */ -#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ -#define ENCRYPT_REQEND 6 /* Request you send encrypting */ -#define ENCRYPT_ENC_KEYID 7 -#define ENCRYPT_DEC_KEYID 8 -#define ENCRYPT_CNT 9 - -#define ENCTYPE_ANY 0 -#define ENCTYPE_DES_CFB64 1 -#define ENCTYPE_DES_OFB64 2 -#define ENCTYPE_CNT 3 - -#ifdef ENCRYPT_NAMES -char *encrypt_names[] = { - "IS", "SUPPORT", "REPLY", "START", "END", - "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", - 0, -}; -char *enctype_names[] = { - "ANY", "DES_CFB64", "DES_OFB64", 0, -}; -#else -extern char *encrypt_names[]; -extern char *enctype_names[]; -#endif - - -#define ENCRYPT_NAME_OK(x) ((x) >= 0 && (x) < ENCRYPT_CNT) -#define ENCRYPT_NAME(x) encrypt_names[x] - -#define ENCTYPE_NAME_OK(x) ((x) >= 0 && (x) < ENCTYPE_CNT) -#define ENCTYPE_NAME(x) enctype_names[x] - -#endif /* !_ARPA_TELNET_H_ */ diff --git a/packages/net/tcpip/current/include/arpa/tftp.h b/packages/net/tcpip/current/include/arpa/tftp.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/arpa/tftp.h +++ /dev/null @@ -1,134 +0,0 @@ -//========================================================================== -// -// include/arpa/tftp.h -// -// TFTP protocol description -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -/* - * Copyright (c) 1983 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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. - * - * @(#)tftp.h 5.4 (Berkeley) 4/3/91 - */ - -#ifndef _ARPA_TFTP_H_ -#define _ARPA_TFTP_H_ - -/* - * Trivial File Transfer Protocol (IEN-133) - */ -#define SEGSIZE 512 /* data segment size */ - -/* - * Packet types. - */ -#define RRQ 01 /* read request */ -#define WRQ 02 /* write request */ -#define DATA 03 /* data packet */ -#define ACK 04 /* acknowledgement */ -#define ERROR 05 /* error code */ - -struct tftphdr { - short th_opcode; /* packet type */ - union { - short tu_block; /* block # */ - short tu_code; /* error code */ - char tu_stuff[1]; /* request packet stuff */ - } __attribute__ ((packed)) th_u; - char th_data[1]; /* data or error string */ -} __attribute__ ((packed)); - -#define th_block th_u.tu_block -#define th_code th_u.tu_code -#define th_stuff th_u.tu_stuff -#define th_msg th_data - -/* - * Error codes. - */ -#define EUNDEF 0 /* not defined */ -#define ENOTFOUND 1 /* file not found */ -#define EACCESS 2 /* access violation */ -#define ENOSPACE 3 /* disk full or allocation exceeded */ -#define EBADOP 4 /* illegal TFTP operation */ -#define EBADID 5 /* unknown transfer ID */ -#define EEXISTS 6 /* file already exists */ -#define ENOUSER 7 /* no such user */ - -#endif /* !_ARPA_TFTP_H_ */ diff --git a/packages/net/tcpip/current/include/bootp.h b/packages/net/tcpip/current/include/bootp.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/bootp.h +++ /dev/null @@ -1,391 +0,0 @@ -//========================================================================== -// -// include/bootp.h -// -// BOOTP protocol description -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -/************************************************************************ - Copyright 1988, 1991 by Carnegie Mellon University - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, provided -that the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation, and that the name of Carnegie Mellon University not be used -in advertising or publicity pertaining to distribution of the software -without specific, written prior permission. - -CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. -************************************************************************/ - -#ifndef _BOOTP_H_ -#define _BOOTP_H_ - -/* - * Bootstrap Protocol (BOOTP). RFC951 and RFC1395. - * - * This file specifies the "implementation-independent" BOOTP protocol - * information which is common to both client and server. - * - */ - -#ifdef __ECOS - -#include -#include - -#include -#else -#include "bptypes.h" /* for int32, u_int32 */ -#endif - -#define BP_CHADDR_LEN 16 -#define BP_SNAME_LEN 64 -#define BP_FILE_LEN 128 - -/* std min packet size to transmit for DHCP relays to work */ -#define BP_STD_TX_MINPKTSZ (300) - -#ifdef CYGPKG_NET_DHCP -// The standard requires only 312 bytes here -#define BP_VEND_LEN (312 + 32) -#define BP_MINPKTSZ 576 -#else -#define BP_VEND_LEN 64 -#define BP_MINPKTSZ 300 /* to check sizeof(struct bootp) */ -#endif - -#define BP_MAX_OPTION_LEN 256 - -struct bootp { - unsigned char bp_op; /* packet opcode type */ - unsigned char bp_htype; /* hardware addr type */ - unsigned char bp_hlen; /* hardware addr length */ - unsigned char bp_hops; /* gateway hops */ -#ifdef __ECOS - u_int32_t bp_xid; /* transaction ID */ -#else - unsigned int bp_xid; /* transaction ID */ -#endif - unsigned short bp_secs; /* seconds since boot began */ - unsigned short bp_flags; /* RFC1532 broadcast, etc. */ - struct in_addr bp_ciaddr; /* client IP address */ - struct in_addr bp_yiaddr; /* 'your' IP address */ - struct in_addr bp_siaddr; /* server IP address */ - struct in_addr bp_giaddr; /* gateway IP address */ - unsigned char bp_chaddr[BP_CHADDR_LEN]; /* client hardware address */ - char bp_sname[BP_SNAME_LEN]; /* server host name */ - char bp_file[BP_FILE_LEN]; /* boot file name */ - unsigned char bp_vend[BP_VEND_LEN]; /* vendor-specific area */ - /* note that bp_vend can be longer, extending to end of packet. */ -}; - -/* - * UDP port numbers, server and client. - */ -#define IPPORT_BOOTPS 67 -#define IPPORT_BOOTPC 68 - -#define BOOTREPLY 2 -#define BOOTREQUEST 1 - -/* - * Hardware types from Assigned Numbers RFC. - */ -#define HTYPE_ETHERNET 1 -#define HTYPE_EXP_ETHERNET 2 -#define HTYPE_AX25 3 -#define HTYPE_PRONET 4 -#define HTYPE_CHAOS 5 -#define HTYPE_IEEE802 6 -#define HTYPE_ARCNET 7 - -/* - * Vendor magic cookie (v_magic) for CMU - */ -#define VM_CMU "CMU" - -/* - * Vendor magic cookie (v_magic) for RFC1048 - */ -#define VM_RFC1048 { 99, 130, 83, 99 } - - - -/* - * Tag values used to specify what information is being supplied in - * the vendor (options) data area of the packet. - */ -/* RFC 1048 */ -/* End of cookie */ -#define TAG_END ((unsigned char) 255) -/* padding for alignment */ -#define TAG_PAD ((unsigned char) 0) -/* Subnet mask */ -#define TAG_SUBNET_MASK ((unsigned char) 1) -/* Time offset from UTC for this system */ -#define TAG_TIME_OFFSET ((unsigned char) 2) -/* List of routers on this subnet */ -#define TAG_GATEWAY ((unsigned char) 3) -/* List of rfc868 time servers available to client */ -#define TAG_TIME_SERVER ((unsigned char) 4) -/* List of IEN 116 name servers */ -#define TAG_NAME_SERVER ((unsigned char) 5) -/* List of DNS name servers */ -#define TAG_DOMAIN_SERVER ((unsigned char) 6) -/* List of MIT-LCS UDL log servers */ -#define TAG_LOG_SERVER ((unsigned char) 7) -/* List of rfc865 cookie servers */ -#define TAG_COOKIE_SERVER ((unsigned char) 8) -/* List of rfc1179 printer servers (in order to try) */ -#define TAG_LPR_SERVER ((unsigned char) 9) -/* List of Imagen Impress servers (in prefered order) */ -#define TAG_IMPRESS_SERVER ((unsigned char) 10) -/* List of rfc887 Resourse Location servers */ -#define TAG_RLP_SERVER ((unsigned char) 11) -/* Hostname of client */ -#define TAG_HOST_NAME ((unsigned char) 12) -/* boot file size */ -#define TAG_BOOT_SIZE ((unsigned char) 13) -/* RFC 1395 */ -/* path to dump to in case of crash */ -#define TAG_DUMP_FILE ((unsigned char) 14) -/* domain name for use with the DNS */ -#define TAG_DOMAIN_NAME ((unsigned char) 15) -/* IP address of the swap server for this machine */ -#define TAG_SWAP_SERVER ((unsigned char) 16) -/* The path name to the root filesystem for this machine */ -#define TAG_ROOT_PATH ((unsigned char) 17) -/* RFC 1497 */ -/* filename to tftp with more options in it */ -#define TAG_EXTEN_FILE ((unsigned char) 18) -/* RFC 1533 */ -/* The following are in rfc1533 and may be used by BOOTP/DHCP */ -/* IP forwarding enable/disable */ -#define TAG_IP_FORWARD ((unsigned char) 19) -/* Non-Local source routing enable/disable */ -#define TAG_IP_NLSR ((unsigned char) 20) -/* List of pairs of addresses/masks to allow non-local source routing to */ -#define TAG_IP_POLICY_FILTER ((unsigned char) 21) -/* Maximum size of datagrams client should be prepared to reassemble */ -#define TAG_IP_MAX_DRS ((unsigned char) 22) -/* Default IP TTL */ -#define TAG_IP_TTL ((unsigned char) 23) -/* Timeout in seconds to age path MTU values found with rfc1191 */ -#define TAG_IP_MTU_AGE ((unsigned char) 24) -/* Table of MTU sizes to use when doing rfc1191 MTU discovery */ -#define TAG_IP_MTU_PLAT ((unsigned char) 25) -/* MTU to use on this interface */ -#define TAG_IP_MTU ((unsigned char) 26) -/* All subnets are local option */ -#define TAG_IP_SNARL ((unsigned char) 27) -/* broadcast address */ -#define TAG_IP_BROADCAST ((unsigned char) 28) -/* perform subnet mask discovery using ICMP */ -#define TAG_IP_SMASKDISC ((unsigned char) 29) -/* act as a subnet mask server using ICMP */ -#define TAG_IP_SMASKSUPP ((unsigned char) 30) -/* perform rfc1256 router discovery */ -#define TAG_IP_ROUTERDISC ((unsigned char) 31) -/* address to send router solicitation requests */ -#define TAG_IP_ROUTER_SOL_ADDR ((unsigned char) 32) -/* list of static routes to addresses (addr, router) pairs */ -#define TAG_IP_STATIC_ROUTES ((unsigned char) 33) -/* use trailers (rfc893) when using ARP */ -#define TAG_IP_TRAILER_ENC ((unsigned char) 34) -/* timeout in seconds for ARP cache entries */ -#define TAG_ARP_TIMEOUT ((unsigned char) 35) -/* use either Ethernet version 2 (rfc894) or IEEE 802.3 (rfc1042) */ -#define TAG_ETHER_IEEE ((unsigned char) 36) -/* default TCP TTL when sending TCP segments */ -#define TAG_IP_TCP_TTL ((unsigned char) 37) -/* time for client to wait before sending a keepalive on a TCP connection */ -#define TAG_IP_TCP_KA_INT ((unsigned char) 38) -/* don't send keepalive with an octet of garbage for compatability */ -#define TAG_IP_TCP_KA_GARBAGE ((unsigned char) 39) -/* NIS domainname */ -#define TAG_NIS_DOMAIN ((unsigned char) 40) -/* list of NIS servers */ -#define TAG_NIS_SERVER ((unsigned char) 41) -/* list of NTP servers */ -#define TAG_NTP_SERVER ((unsigned char) 42) -/* and stuff vendors may want to add */ -#define TAG_VEND_SPECIFIC ((unsigned char) 43) -/* NetBios over TCP/IP name server */ -#define TAG_NBNS_SERVER ((unsigned char) 44) -/* NetBios over TCP/IP NBDD servers (rfc1001/1002) */ -#define TAG_NBDD_SERVER ((unsigned char) 45) -/* NetBios over TCP/IP node type option for use with above */ -#define TAG_NBOTCP_OTPION ((unsigned char) 46) -/* NetBios over TCP/IP scopt option for use with above */ -#define TAG_NB_SCOPE ((unsigned char) 47) -/* list of X Window system font servers */ -#define TAG_XFONT_SERVER ((unsigned char) 48) -/* list of systems running X Display Manager (xdm) available to this client */ -#define TAG_XDISPLAY_SERVER ((unsigned char) 49) - -/* While the following are only allowed for DHCP */ -/* DHCP requested IP address */ -#define TAG_DHCP_REQ_IP ((unsigned char) 50) -/* DHCP time for lease of IP address */ -#define TAG_DHCP_LEASE_TIME ((unsigned char) 51) -/* DHCP options overload */ -#define TAG_DHCP_OPTOVER ((unsigned char) 52) -/* DHCP message type */ -#define TAG_DHCP_MESS_TYPE ((unsigned char) 53) -/* DHCP server identification */ -#define TAG_DHCP_SERVER_ID ((unsigned char) 54) -/* DHCP ordered list of requested parameters */ -#define TAG_DHCP_PARM_REQ_LIST ((unsigned char) 55) -/* DHCP reply message */ -#define TAG_DHCP_TEXT_MESSAGE ((unsigned char) 56) -/* DHCP maximum packet size willing to accept */ -#define TAG_DHCP_MAX_MSGSZ ((unsigned char) 57) -/* DHCP time 'til client needs to renew */ -#define TAG_DHCP_RENEWAL_TIME ((unsigned char) 58) -/* DHCP time 'til client needs to rebind */ -#define TAG_DHCP_REBIND_TIME ((unsigned char) 59) -/* DHCP class identifier */ -#define TAG_DHCP_CLASSID ((unsigned char) 60) -/* DHCP client unique identifier */ -#define TAG_DHCP_CLIENTID ((unsigned char) 61) - -/* XXX - Add new tags here */ - - -/* - * "vendor" data permitted for CMU bootp clients. - */ - -struct cmu_vend { - char v_magic[4]; /* magic number */ -#ifdef __ECOS - u_int32_t v_flags; /* flags/opcodes, etc. */ -#else - unsigned int32 v_flags; /* flags/opcodes, etc. */ -#endif - struct in_addr v_smask; /* Subnet mask */ - struct in_addr v_dgate; /* Default gateway */ - struct in_addr v_dns1, v_dns2; /* Domain name servers */ - struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */ - struct in_addr v_ts1, v_ts2; /* Time servers */ -#ifdef __ECOS - int32_t v_unused[6]; /* currently unused */ -#else - int32 v_unused[6]; /* currently unused */ -#endif -}; - - -/* v_flags values */ -#define VF_SMASK 1 /* Subnet mask field contains valid data */ - -#ifdef __ECOS -#ifdef CYGHWR_NET_DRIVER_ETH0 -extern struct bootp eth0_bootp_data; -extern cyg_bool_t eth0_up; -extern const char *eth0_name; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 -extern struct bootp eth1_bootp_data; -extern cyg_bool_t eth1_up; -extern const char *eth1_name; -#endif - -// ------------------------------------------------------------------------ -// Initialize your own bootp record however you like, as far as is needed -// to bring up an interface. -__externC void -build_bootp_record(struct bootp *bp, - const char *addrs_ip, - const char *addrs_netmask, - const char *addrs_broadcast, - const char *addrs_gateway, - const char *addrs_server); - -// Do bootp to fill in the bootp record from the net (other interfaces must -// be down for this to work, because of the "half-up" state of the -// interface in use) -__externC cyg_bool_t do_bootp(const char *interface, struct bootp *res); - -// Initialize an interface (which is down) according to a bootp structure -__externC cyg_bool_t init_net(const char *interface, struct bootp *res); - -// Dump contents to diag_printf -__externC void show_bootp(const char *interface, struct bootp *res); - -// Interrogate a bootp record for a particular option -__externC cyg_bool_t get_bootp_option(struct bootp *bp, unsigned char tag, void *res, unsigned int * length); - -// ------------------------------------------------------------------------ -// This isn't exactly the right place for this since bootp is not involved -// BUT you will only be using this API if you are using bootp-style -// initialization of the other interfaces; it fits here in a documentation -// sense. -__externC cyg_bool_t init_loopback_interface(int lo); - -// ------------------------------------------------------------------------ -// Do all the above automatically according to the configuration. Do not -// mix using this and making the above calls yourself. -// (this is also declared in the much simpler API in network.h) -__externC void init_all_network_interfaces(void); - -#endif - -#endif // _BOOTP_H_ diff --git a/packages/net/tcpip/current/include/dhcp.h b/packages/net/tcpip/current/include/dhcp.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/dhcp.h +++ /dev/null @@ -1,263 +0,0 @@ -#ifndef CYGONCE_NET_TCPIP_DHCP_H -#define CYGONCE_NET_TCPIP_DHCP_H - -//========================================================================== -// -// include/dhcp.h -// -// DHCP protocol support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): hmt -// Contributors: gthomas -// Date: 2000-07-01 -// Purpose: Support DHCP initialization in eCos TCPIP stack -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// -// DHCP. RFC2131, RFC1533, RFC1534 -// See also bootp.h -// - -#include -#include - -#ifdef CYGPKG_NET_DHCP - -#include - -#include - -#include - -// DHCP messages; these are sent in the tag TAG_DHCP_MESS_TYPE already -// defined in bootp.h - -#define DHCPDISCOVER 1 -#define DHCPOFFER 2 -#define DHCPREQUEST 3 -#define DHCPDECLINE 4 -#define DHCPACK 5 -#define DHCPNAK 6 -#define DHCPRELEASE 7 - -// DHCP interface state machine states; these are published so that app -// code can know what to do... (see page 35 of RFC2131) - -// These we will use in the normal course of events -#define DHCPSTATE_INIT 1 -#define DHCPSTATE_SELECTING 2 // wait for replies to b/c DISCOVER -#define DHCPSTATE_REQUESTING 3 -#define DHCPSTATE_REQUEST_RECV 4 // wait for replies to b/c REQUEST -#define DHCPSTATE_BOUND 5 -#define DHCPSTATE_RENEWING 6 // wait for replies to u/c REQUEST -#define DHCPSTATE_RENEW_RECV 7 -#define DHCPSTATE_REBINDING 8 // wait for replies to b/c REQUEST -#define DHCPSTATE_REBIND_RECV 9 -#define DHCPSTATE_BOOTP_FALLBACK 10 // fall back to plain bootp -#define DHCPSTATE_NOTBOUND 11 // To let app tidy up -#define DHCPSTATE_FAILED 12 // Net is down -#define DHCPSTATE_DO_RELEASE 13 // Force release of the current lease -// These we don't use -//#define DHCPSTATE_INITREBOOT -//#define DHCPSTATE_REBOOTING - -// These are to let the app inspect the state of the interfaces when -// managing them itself, by analogy with eth0_up &c; eth0_bootp_data and so -// on will still be used with DHCP. -#ifdef CYGHWR_NET_DRIVER_ETH0 -extern cyg_uint8 eth0_dhcpstate; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 -extern cyg_uint8 eth1_dhcpstate; -#endif - -// This is public so the app can wait on it or poll it when managing DHCP -// itself. It will be zero while the app should wait, and posted when a -// call to do_dhcp() is needed. If, instead, the app wishes to manage DHCP -// with a thread per interface somehow, then separate semaphores may be used. -// See the dhcp_lease structure definition below. -extern cyg_sem_t dhcp_needs_attention; - -// This routine is used at startup time, and after relinquishing leases or -// after a lease timeout: it does DHCP or bootp or static setup according -// to configuration. -extern void init_all_network_interfaces(void); - -// This routine does the work of renewing leases &c. -// return value: 1 => everything OK, no change. -// 0 => close your connections, then call do_dhcp_halt() to halt the -// interface(s) in question (it knows because the state will be NOTBOUND). -// After that you can return to the start and use -// init_all_network_interfaces() as usual. -extern int dhcp_bind( void ); - -// Shutdown any interface which is not already shut down - whether -// initialized by DHCP or not. Reason: because of the broadcast-while-not- -// -fully-initialized nature of the DHCP conversation, all other interfaces -// must be shut down during that. So one down, all down, is required. -extern int dhcp_halt( void ); - -// Release (and set state to DHCPSTATE_NOTBOUND) all interfaces - we are -// closing down. (unlikely but useful for testing) -// Interfaces are left up; use dhcp_halt() to bring them right down, then -// call init_all_network_interfaces() as usual to restart all. -extern int dhcp_release( void ); - -// The intent with this API is that a simple DHCP client thread, which -// maintains the state of the interfaces, can go as follows: -// (after init_all_networks is called from elsewhere) -// -// while ( 1 ) { -// while ( 1 ) { -// cyg_semaphore_wait( &dhcp_needs_attention ); -// if ( ! dhcp_bind() ) // a lease expired -// break; // If we need to re-bind -// } -// dhcp_halt(); // tear everything down -// init_all_network_interfaces(); // re-initialize -// } -// -// and if the application does not want to suffer the overhead of a -// separate thread and its stack for this, this functionality can be placed -// in the app's server loop in an obvious fashion. That is the goal of -// breaking out these internal elements. For example, some server might -// be arranged to poll DHCP from time to time like this: -// -// while ( 1 ) { -// init_all_network_interfaces(); -// open-my-listen-sockets(); -// while ( 1 ) { -// serve-one-request(); -// // sleeps if no connections, but not forever; so this loop is -// // polled a few times a minute... -// if ( cyg_semaphore_trywait( &dhcp_needs_attention )) { -// if ( ! dhcp_bind() ) { -// close-my-listen-sockets(); -// dhcp_halt(); -// break; -// } -// } -// } -// } -// -// ------------------------------------------------------------------------ - -#ifdef CYGOPT_NET_DHCP_DHCP_THREAD -// Then we provide such a thread... - -// Provide a separate thread to renew DHCP leases; otherwise the -// application MUST periodically examine the semaphore dhcp_needs_attention -// and call dhcp_bind() if it is signalled. If enabled, this thread does -// all that for you. Independent of this option, initialization of the -// interfaces still occurs in init_all_network_interfaces() and your -// startup code must call that. It will start the DHCP management thread -// if necessary. If a lease fails to be renewed, the management thread -// will shut down all interfaces and attempt to initialize all the -// interfaces again from scratch. This may cause chaos in the app, which -// is why managing the DHCP state in an application aware thread is -// actually better, just far less convenient for testing. - -extern cyg_handle_t dhcp_mgt_thread_h; // To allow its external manipulation. -extern cyg_thread dhcp_mgt_thread; // The object itself - -extern void dhcp_start_dhcp_mgt_thread( void ); - -#endif - -// The function is provided unconditionally so that the app can put it in a -// thread of its own. If the parameter is true, it loops forever; if -// false, the call returns if a lease expires, and the caller must tidy up -// or reboot the whole machine. -extern cyg_thread_entry_t dhcp_mgt_entry; -extern void dhcp_mgt_entry( cyg_addrword_t loop_on_failure ); // the function - -// --------------------------------------------------------------------------- -// These are rather more internal routines, internal to the protocol engine -// in dhcp_prot.c - those above are in dhcp_support.c - -#define DHCP_LEASE_T1 1 -#define DHCP_LEASE_T2 2 -#define DHCP_LEASE_EX 4 - -struct dhcp_lease { - // Client settable: Semaphore to signal when attention is needed: - cyg_sem_t *needs_attention; - // Initialize all the rest to zero: - cyg_tick_count_t t1, t2, expiry; - volatile cyg_uint8 next; - volatile cyg_uint8 which; - cyg_handle_t alarm; - // except this one, which is just some space: - cyg_alarm alarm_obj; -}; - -// These dhcp_lease objects are initialized to use -// extern cyg_sem_t dhcp_needs_attention; -// for the semaphore. -#ifdef CYGHWR_NET_DRIVER_ETH0 -extern struct dhcp_lease eth0_lease; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 -extern struct dhcp_lease eth1_lease; -#endif - -extern int -do_dhcp(const char *interface, struct bootp *res, - cyg_uint8 *pstate, struct dhcp_lease *lease); -// NB *res and *pstate and *lease are all INOUT; *res must point to a valid -// record from "last time". - -extern int -do_dhcp_down_net(const char *intf, struct bootp *res, - cyg_uint8 *pstate, struct dhcp_lease *lease); - -extern int -do_dhcp_release(const char *intf, struct bootp *res, - cyg_uint8 *pstate, struct dhcp_lease *lease); - -#endif // CYGPKG_NET_DHCP - -#endif // CYGONCE_NET_TCPIP_DHCP_H -// EOF dhcp.h diff --git a/packages/net/tcpip/current/include/lib/libkern/libkern.h b/packages/net/tcpip/current/include/lib/libkern/libkern.h --- a/packages/net/tcpip/current/include/lib/libkern/libkern.h +++ b/packages/net/tcpip/current/include/lib/libkern/libkern.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/machine/ansi.h b/packages/net/tcpip/current/include/machine/ansi.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/machine/ansi.h +++ /dev/null @@ -1,64 +0,0 @@ -//========================================================================== -// -// include/machine/ansi.h -// -// Architecture/platform specifics -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#ifndef _MACHINE_ANSI_H_ -#define _MACHINE_ANSI_H_ - -// Mappings of BSD-style functions used in networking code to those provided -// by the eCos environment. - -// Nothing to do here any more. - -#endif // _MACHINE_ANSI_H_ - diff --git a/packages/net/tcpip/current/include/machine/cdefs.h b/packages/net/tcpip/current/include/machine/cdefs.h --- a/packages/net/tcpip/current/include/machine/cdefs.h +++ b/packages/net/tcpip/current/include/machine/cdefs.h @@ -5,29 +5,6 @@ // Architecture/platform specific parameters // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/machine/cpu.h b/packages/net/tcpip/current/include/machine/cpu.h --- a/packages/net/tcpip/current/include/machine/cpu.h +++ b/packages/net/tcpip/current/include/machine/cpu.h @@ -5,29 +5,6 @@ // Architecture/platform specific parameters // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/machine/endian.h b/packages/net/tcpip/current/include/machine/endian.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/machine/endian.h +++ /dev/null @@ -1,70 +0,0 @@ -//========================================================================== -// -// include/machine/endian.h -// -// Architecture/platform specific byte ordering support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - - -#ifndef _MACHINE_ENDIAN_H_ -#define _MACHINE_ENDIAN_H_ - -#include - -#if CYG_BYTEORDER == CYG_MSBFIRST -#define BYTE_ORDER BIG_ENDIAN -#else -#define BYTE_ORDER LITTLE_ENDIAN -#endif -#include - -#endif // _MACHINE_ENDIAN_H_ - - diff --git a/packages/net/tcpip/current/include/machine/limits.h b/packages/net/tcpip/current/include/machine/limits.h --- a/packages/net/tcpip/current/include/machine/limits.h +++ b/packages/net/tcpip/current/include/machine/limits.h @@ -5,29 +5,6 @@ // Architecture/platform specific limits // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/machine/param.h b/packages/net/tcpip/current/include/machine/param.h --- a/packages/net/tcpip/current/include/machine/param.h +++ b/packages/net/tcpip/current/include/machine/param.h @@ -5,29 +5,6 @@ // Architecture/platform specific parameters // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/machine/signal.h b/packages/net/tcpip/current/include/machine/signal.h --- a/packages/net/tcpip/current/include/machine/signal.h +++ b/packages/net/tcpip/current/include/machine/signal.h @@ -5,29 +5,6 @@ // Architecture specific 'signal' support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/machine/stdarg.h b/packages/net/tcpip/current/include/machine/stdarg.h --- a/packages/net/tcpip/current/include/machine/stdarg.h +++ b/packages/net/tcpip/current/include/machine/stdarg.h @@ -5,29 +5,6 @@ // Architecture/compiler specifics // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/machine/types.h b/packages/net/tcpip/current/include/machine/types.h --- a/packages/net/tcpip/current/include/machine/types.h +++ b/packages/net/tcpip/current/include/machine/types.h @@ -5,29 +5,6 @@ // Architecture/platform specific support for data types // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/bpf.h b/packages/net/tcpip/current/include/net/bpf.h --- a/packages/net/tcpip/current/include/net/bpf.h +++ b/packages/net/tcpip/current/include/net/bpf.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/bpfdesc.h b/packages/net/tcpip/current/include/net/bpfdesc.h --- a/packages/net/tcpip/current/include/net/bpfdesc.h +++ b/packages/net/tcpip/current/include/net/bpfdesc.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/if.h b/packages/net/tcpip/current/include/net/if.h --- a/packages/net/tcpip/current/include/net/if.h +++ b/packages/net/tcpip/current/include/net/if.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/if_arp.h b/packages/net/tcpip/current/include/net/if_arp.h --- a/packages/net/tcpip/current/include/net/if_arp.h +++ b/packages/net/tcpip/current/include/net/if_arp.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/if_bridge.h b/packages/net/tcpip/current/include/net/if_bridge.h --- a/packages/net/tcpip/current/include/net/if_bridge.h +++ b/packages/net/tcpip/current/include/net/if_bridge.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/if_dl.h b/packages/net/tcpip/current/include/net/if_dl.h --- a/packages/net/tcpip/current/include/net/if_dl.h +++ b/packages/net/tcpip/current/include/net/if_dl.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/if_gif.h b/packages/net/tcpip/current/include/net/if_gif.h --- a/packages/net/tcpip/current/include/net/if_gif.h +++ b/packages/net/tcpip/current/include/net/if_gif.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/if_llc.h b/packages/net/tcpip/current/include/net/if_llc.h --- a/packages/net/tcpip/current/include/net/if_llc.h +++ b/packages/net/tcpip/current/include/net/if_llc.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/if_tun.h b/packages/net/tcpip/current/include/net/if_tun.h --- a/packages/net/tcpip/current/include/net/if_tun.h +++ b/packages/net/tcpip/current/include/net/if_tun.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/if_types.h b/packages/net/tcpip/current/include/net/if_types.h --- a/packages/net/tcpip/current/include/net/if_types.h +++ b/packages/net/tcpip/current/include/net/if_types.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/netdb.h b/packages/net/tcpip/current/include/net/netdb.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/net/netdb.h +++ /dev/null @@ -1,89 +0,0 @@ -//========================================================================== -// -// include/netdb.h -// -// eCos implementations of network "database" functions -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// -// Support for various "network databases" -// - -#ifndef _NETDB_H_ -#define _NETDB_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -// Internet protocols -struct protoent { - char *p_name; - int p_proto; -}; - -struct protoent *getprotobyname(const char *); -struct protoent *getprotobynumber(const int); - -// Internet services -struct servent { - char *s_name; /* official service name */ - char **s_aliases; /* alias list */ - int s_port; /* port number */ - char *s_proto; /* protocol to use */ -}; - -struct servent *getservbyname(const char *name, const char *proto); -struct servent *getservbyport(int port, const char *proto); - -#ifdef __cplusplus -} -#endif -#endif // _NETDB_H_ diff --git a/packages/net/tcpip/current/include/net/netisr.h b/packages/net/tcpip/current/include/net/netisr.h --- a/packages/net/tcpip/current/include/net/netisr.h +++ b/packages/net/tcpip/current/include/net/netisr.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/radix.h b/packages/net/tcpip/current/include/net/radix.h --- a/packages/net/tcpip/current/include/net/radix.h +++ b/packages/net/tcpip/current/include/net/radix.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/raw_cb.h b/packages/net/tcpip/current/include/net/raw_cb.h --- a/packages/net/tcpip/current/include/net/raw_cb.h +++ b/packages/net/tcpip/current/include/net/raw_cb.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/net/route.h b/packages/net/tcpip/current/include/net/route.h --- a/packages/net/tcpip/current/include/net/route.h +++ b/packages/net/tcpip/current/include/net/route.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/icmp6.h b/packages/net/tcpip/current/include/netinet/icmp6.h --- a/packages/net/tcpip/current/include/netinet/icmp6.h +++ b/packages/net/tcpip/current/include/netinet/icmp6.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/icmp_var.h b/packages/net/tcpip/current/include/netinet/icmp_var.h --- a/packages/net/tcpip/current/include/netinet/icmp_var.h +++ b/packages/net/tcpip/current/include/netinet/icmp_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/if_arc.h b/packages/net/tcpip/current/include/netinet/if_arc.h --- a/packages/net/tcpip/current/include/netinet/if_arc.h +++ b/packages/net/tcpip/current/include/netinet/if_arc.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/if_atm.h b/packages/net/tcpip/current/include/netinet/if_atm.h --- a/packages/net/tcpip/current/include/netinet/if_atm.h +++ b/packages/net/tcpip/current/include/netinet/if_atm.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/if_ether.h b/packages/net/tcpip/current/include/netinet/if_ether.h --- a/packages/net/tcpip/current/include/netinet/if_ether.h +++ b/packages/net/tcpip/current/include/netinet/if_ether.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/igmp.h b/packages/net/tcpip/current/include/netinet/igmp.h --- a/packages/net/tcpip/current/include/netinet/igmp.h +++ b/packages/net/tcpip/current/include/netinet/igmp.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/igmp_var.h b/packages/net/tcpip/current/include/netinet/igmp_var.h --- a/packages/net/tcpip/current/include/netinet/igmp_var.h +++ b/packages/net/tcpip/current/include/netinet/igmp_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/in.h b/packages/net/tcpip/current/include/netinet/in.h --- a/packages/net/tcpip/current/include/netinet/in.h +++ b/packages/net/tcpip/current/include/netinet/in.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/in_gif.h b/packages/net/tcpip/current/include/netinet/in_gif.h --- a/packages/net/tcpip/current/include/netinet/in_gif.h +++ b/packages/net/tcpip/current/include/netinet/in_gif.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/in_pcb.h b/packages/net/tcpip/current/include/netinet/in_pcb.h --- a/packages/net/tcpip/current/include/netinet/in_pcb.h +++ b/packages/net/tcpip/current/include/netinet/in_pcb.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/in_systm.h b/packages/net/tcpip/current/include/netinet/in_systm.h --- a/packages/net/tcpip/current/include/netinet/in_systm.h +++ b/packages/net/tcpip/current/include/netinet/in_systm.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/in_var.h b/packages/net/tcpip/current/include/netinet/in_var.h --- a/packages/net/tcpip/current/include/netinet/in_var.h +++ b/packages/net/tcpip/current/include/netinet/in_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip.h b/packages/net/tcpip/current/include/netinet/ip.h --- a/packages/net/tcpip/current/include/netinet/ip.h +++ b/packages/net/tcpip/current/include/netinet/ip.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip6.h b/packages/net/tcpip/current/include/netinet/ip6.h --- a/packages/net/tcpip/current/include/netinet/ip6.h +++ b/packages/net/tcpip/current/include/netinet/ip6.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_ah.h b/packages/net/tcpip/current/include/netinet/ip_ah.h --- a/packages/net/tcpip/current/include/netinet/ip_ah.h +++ b/packages/net/tcpip/current/include/netinet/ip_ah.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_auth.h b/packages/net/tcpip/current/include/netinet/ip_auth.h --- a/packages/net/tcpip/current/include/netinet/ip_auth.h +++ b/packages/net/tcpip/current/include/netinet/ip_auth.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_blf.h b/packages/net/tcpip/current/include/netinet/ip_blf.h --- a/packages/net/tcpip/current/include/netinet/ip_blf.h +++ b/packages/net/tcpip/current/include/netinet/ip_blf.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_cast.h b/packages/net/tcpip/current/include/netinet/ip_cast.h --- a/packages/net/tcpip/current/include/netinet/ip_cast.h +++ b/packages/net/tcpip/current/include/netinet/ip_cast.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_castsb.h b/packages/net/tcpip/current/include/netinet/ip_castsb.h --- a/packages/net/tcpip/current/include/netinet/ip_castsb.h +++ b/packages/net/tcpip/current/include/netinet/ip_castsb.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_ecn.h b/packages/net/tcpip/current/include/netinet/ip_ecn.h --- a/packages/net/tcpip/current/include/netinet/ip_ecn.h +++ b/packages/net/tcpip/current/include/netinet/ip_ecn.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_esp.h b/packages/net/tcpip/current/include/netinet/ip_esp.h --- a/packages/net/tcpip/current/include/netinet/ip_esp.h +++ b/packages/net/tcpip/current/include/netinet/ip_esp.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_ether.h b/packages/net/tcpip/current/include/netinet/ip_ether.h --- a/packages/net/tcpip/current/include/netinet/ip_ether.h +++ b/packages/net/tcpip/current/include/netinet/ip_ether.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_fil.h b/packages/net/tcpip/current/include/netinet/ip_fil.h --- a/packages/net/tcpip/current/include/netinet/ip_fil.h +++ b/packages/net/tcpip/current/include/netinet/ip_fil.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_fil_compat.h b/packages/net/tcpip/current/include/netinet/ip_fil_compat.h --- a/packages/net/tcpip/current/include/netinet/ip_fil_compat.h +++ b/packages/net/tcpip/current/include/netinet/ip_fil_compat.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_frag.h b/packages/net/tcpip/current/include/netinet/ip_frag.h --- a/packages/net/tcpip/current/include/netinet/ip_frag.h +++ b/packages/net/tcpip/current/include/netinet/ip_frag.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_icmp.h b/packages/net/tcpip/current/include/netinet/ip_icmp.h --- a/packages/net/tcpip/current/include/netinet/ip_icmp.h +++ b/packages/net/tcpip/current/include/netinet/ip_icmp.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_ip4.h b/packages/net/tcpip/current/include/netinet/ip_ip4.h --- a/packages/net/tcpip/current/include/netinet/ip_ip4.h +++ b/packages/net/tcpip/current/include/netinet/ip_ip4.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_ipsp.h b/packages/net/tcpip/current/include/netinet/ip_ipsp.h --- a/packages/net/tcpip/current/include/netinet/ip_ipsp.h +++ b/packages/net/tcpip/current/include/netinet/ip_ipsp.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_mroute.h b/packages/net/tcpip/current/include/netinet/ip_mroute.h --- a/packages/net/tcpip/current/include/netinet/ip_mroute.h +++ b/packages/net/tcpip/current/include/netinet/ip_mroute.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_nat.h b/packages/net/tcpip/current/include/netinet/ip_nat.h --- a/packages/net/tcpip/current/include/netinet/ip_nat.h +++ b/packages/net/tcpip/current/include/netinet/ip_nat.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_proxy.h b/packages/net/tcpip/current/include/netinet/ip_proxy.h --- a/packages/net/tcpip/current/include/netinet/ip_proxy.h +++ b/packages/net/tcpip/current/include/netinet/ip_proxy.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_rmd160.h b/packages/net/tcpip/current/include/netinet/ip_rmd160.h --- a/packages/net/tcpip/current/include/netinet/ip_rmd160.h +++ b/packages/net/tcpip/current/include/netinet/ip_rmd160.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_sha1.h b/packages/net/tcpip/current/include/netinet/ip_sha1.h --- a/packages/net/tcpip/current/include/netinet/ip_sha1.h +++ b/packages/net/tcpip/current/include/netinet/ip_sha1.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_skipjack.h b/packages/net/tcpip/current/include/netinet/ip_skipjack.h --- a/packages/net/tcpip/current/include/netinet/ip_skipjack.h +++ b/packages/net/tcpip/current/include/netinet/ip_skipjack.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_state.h b/packages/net/tcpip/current/include/netinet/ip_state.h --- a/packages/net/tcpip/current/include/netinet/ip_state.h +++ b/packages/net/tcpip/current/include/netinet/ip_state.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/ip_var.h b/packages/net/tcpip/current/include/netinet/ip_var.h --- a/packages/net/tcpip/current/include/netinet/ip_var.h +++ b/packages/net/tcpip/current/include/netinet/ip_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -217,7 +194,10 @@ struct ipstat { #define IP_ENCAPSULATED 0x0800 /* encapsulated already */ #endif -struct ipstat ipstat; +extern struct ipstat ipstat; +#ifndef RANDOM_IP_ID +extern u_short ip_id; /* ip packet ctr, for ids */ +#endif LIST_HEAD(ipqhead, ipq) ipq; /* ip reass. queue */ extern int ip_defttl; /* default IP ttl */ extern int ipforwarding; /* IPforwarding state */ diff --git a/packages/net/tcpip/current/include/netinet/ipl.h b/packages/net/tcpip/current/include/netinet/ipl.h --- a/packages/net/tcpip/current/include/netinet/ipl.h +++ b/packages/net/tcpip/current/include/netinet/ipl.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/tcp.h b/packages/net/tcpip/current/include/netinet/tcp.h --- a/packages/net/tcpip/current/include/netinet/tcp.h +++ b/packages/net/tcpip/current/include/netinet/tcp.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/tcp_debug.h b/packages/net/tcpip/current/include/netinet/tcp_debug.h --- a/packages/net/tcpip/current/include/netinet/tcp_debug.h +++ b/packages/net/tcpip/current/include/netinet/tcp_debug.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -96,6 +73,7 @@ #include +#ifdef TCPDEBUG struct tcp_debug { n_time td_time; short td_act; @@ -113,13 +91,12 @@ struct tcp_debug { #define TA_RESPOND 3 #define TA_DROP 4 -#ifdef TCPDEBUG char *tanames[] = { "input", "output", "user", "respond", "drop" }; -#endif #define TCP_NDEBUG 100 struct tcp_debug tcp_debug[TCP_NDEBUG]; int tcp_debx; +#endif #endif // _NETINET_TCP_DEBUG_H_ diff --git a/packages/net/tcpip/current/include/netinet/tcp_fsm.h b/packages/net/tcpip/current/include/netinet/tcp_fsm.h --- a/packages/net/tcpip/current/include/netinet/tcp_fsm.h +++ b/packages/net/tcpip/current/include/netinet/tcp_fsm.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/tcp_seq.h b/packages/net/tcpip/current/include/netinet/tcp_seq.h --- a/packages/net/tcpip/current/include/netinet/tcp_seq.h +++ b/packages/net/tcpip/current/include/netinet/tcp_seq.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/tcp_timer.h b/packages/net/tcpip/current/include/netinet/tcp_timer.h --- a/packages/net/tcpip/current/include/netinet/tcp_timer.h +++ b/packages/net/tcpip/current/include/netinet/tcp_timer.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/tcp_var.h b/packages/net/tcpip/current/include/netinet/tcp_var.h --- a/packages/net/tcpip/current/include/netinet/tcp_var.h +++ b/packages/net/tcpip/current/include/netinet/tcp_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/tcpip.h b/packages/net/tcpip/current/include/netinet/tcpip.h --- a/packages/net/tcpip/current/include/netinet/tcpip.h +++ b/packages/net/tcpip/current/include/netinet/tcpip.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/udp.h b/packages/net/tcpip/current/include/netinet/udp.h --- a/packages/net/tcpip/current/include/netinet/udp.h +++ b/packages/net/tcpip/current/include/netinet/udp.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet/udp_var.h b/packages/net/tcpip/current/include/netinet/udp_var.h --- a/packages/net/tcpip/current/include/netinet/udp_var.h +++ b/packages/net/tcpip/current/include/netinet/udp_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/debug.h b/packages/net/tcpip/current/include/netinet6/debug.h --- a/packages/net/tcpip/current/include/netinet6/debug.h +++ b/packages/net/tcpip/current/include/netinet6/debug.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/debug_inet6.h b/packages/net/tcpip/current/include/netinet6/debug_inet6.h --- a/packages/net/tcpip/current/include/netinet6/debug_inet6.h +++ b/packages/net/tcpip/current/include/netinet6/debug_inet6.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/icmp6.h b/packages/net/tcpip/current/include/netinet6/icmp6.h --- a/packages/net/tcpip/current/include/netinet6/icmp6.h +++ b/packages/net/tcpip/current/include/netinet6/icmp6.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/icmpv6.h b/packages/net/tcpip/current/include/netinet6/icmpv6.h --- a/packages/net/tcpip/current/include/netinet6/icmpv6.h +++ b/packages/net/tcpip/current/include/netinet6/icmpv6.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/icmpv6_var.h b/packages/net/tcpip/current/include/netinet6/icmpv6_var.h --- a/packages/net/tcpip/current/include/netinet6/icmpv6_var.h +++ b/packages/net/tcpip/current/include/netinet6/icmpv6_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/in6.h b/packages/net/tcpip/current/include/netinet6/in6.h --- a/packages/net/tcpip/current/include/netinet6/in6.h +++ b/packages/net/tcpip/current/include/netinet6/in6.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -656,6 +633,8 @@ struct in6_pktinfo { #ifdef _KERNEL struct cmsghdr; +struct mbuf; +struct ifnet; int in6_canforward __P((struct in6_addr *, struct in6_addr *)); int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t)); diff --git a/packages/net/tcpip/current/include/netinet6/in6_gif.h b/packages/net/tcpip/current/include/netinet6/in6_gif.h --- a/packages/net/tcpip/current/include/netinet6/in6_gif.h +++ b/packages/net/tcpip/current/include/netinet6/in6_gif.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/in6_ifattach.h b/packages/net/tcpip/current/include/netinet6/in6_ifattach.h --- a/packages/net/tcpip/current/include/netinet6/in6_ifattach.h +++ b/packages/net/tcpip/current/include/netinet6/in6_ifattach.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/in6_pcb.h b/packages/net/tcpip/current/include/netinet6/in6_pcb.h --- a/packages/net/tcpip/current/include/netinet6/in6_pcb.h +++ b/packages/net/tcpip/current/include/netinet6/in6_pcb.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/in6_prefix.h b/packages/net/tcpip/current/include/netinet6/in6_prefix.h --- a/packages/net/tcpip/current/include/netinet6/in6_prefix.h +++ b/packages/net/tcpip/current/include/netinet6/in6_prefix.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/in6_var.h b/packages/net/tcpip/current/include/netinet6/in6_var.h --- a/packages/net/tcpip/current/include/netinet6/in6_var.h +++ b/packages/net/tcpip/current/include/netinet6/in6_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/ip6.h b/packages/net/tcpip/current/include/netinet6/ip6.h --- a/packages/net/tcpip/current/include/netinet6/ip6.h +++ b/packages/net/tcpip/current/include/netinet6/ip6.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/ip6_mroute.h b/packages/net/tcpip/current/include/netinet6/ip6_mroute.h --- a/packages/net/tcpip/current/include/netinet6/ip6_mroute.h +++ b/packages/net/tcpip/current/include/netinet6/ip6_mroute.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/ip6_var.h b/packages/net/tcpip/current/include/netinet6/ip6_var.h --- a/packages/net/tcpip/current/include/netinet6/ip6_var.h +++ b/packages/net/tcpip/current/include/netinet6/ip6_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/ip6protosw.h b/packages/net/tcpip/current/include/netinet6/ip6protosw.h --- a/packages/net/tcpip/current/include/netinet6/ip6protosw.h +++ b/packages/net/tcpip/current/include/netinet6/ip6protosw.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/ipv6.h b/packages/net/tcpip/current/include/netinet6/ipv6.h --- a/packages/net/tcpip/current/include/netinet6/ipv6.h +++ b/packages/net/tcpip/current/include/netinet6/ipv6.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/ipv6_addrconf.h b/packages/net/tcpip/current/include/netinet6/ipv6_addrconf.h --- a/packages/net/tcpip/current/include/netinet6/ipv6_addrconf.h +++ b/packages/net/tcpip/current/include/netinet6/ipv6_addrconf.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/ipv6_icmp.h b/packages/net/tcpip/current/include/netinet6/ipv6_icmp.h --- a/packages/net/tcpip/current/include/netinet6/ipv6_icmp.h +++ b/packages/net/tcpip/current/include/netinet6/ipv6_icmp.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/ipv6_trans.h b/packages/net/tcpip/current/include/netinet6/ipv6_trans.h --- a/packages/net/tcpip/current/include/netinet6/ipv6_trans.h +++ b/packages/net/tcpip/current/include/netinet6/ipv6_trans.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/ipv6_var.h b/packages/net/tcpip/current/include/netinet6/ipv6_var.h --- a/packages/net/tcpip/current/include/netinet6/ipv6_var.h +++ b/packages/net/tcpip/current/include/netinet6/ipv6_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/mld6_var.h b/packages/net/tcpip/current/include/netinet6/mld6_var.h --- a/packages/net/tcpip/current/include/netinet6/mld6_var.h +++ b/packages/net/tcpip/current/include/netinet6/mld6_var.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/nd6.h b/packages/net/tcpip/current/include/netinet6/nd6.h --- a/packages/net/tcpip/current/include/netinet6/nd6.h +++ b/packages/net/tcpip/current/include/netinet6/nd6.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/nd6_protocol.h b/packages/net/tcpip/current/include/netinet6/nd6_protocol.h --- a/packages/net/tcpip/current/include/netinet6/nd6_protocol.h +++ b/packages/net/tcpip/current/include/netinet6/nd6_protocol.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/osdep.h b/packages/net/tcpip/current/include/netinet6/osdep.h --- a/packages/net/tcpip/current/include/netinet6/osdep.h +++ b/packages/net/tcpip/current/include/netinet6/osdep.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/pim6.h b/packages/net/tcpip/current/include/netinet6/pim6.h --- a/packages/net/tcpip/current/include/netinet6/pim6.h +++ b/packages/net/tcpip/current/include/netinet6/pim6.h @@ -5,29 +5,6 @@ // IPv6 protocol independent multicast // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/pim6_var.h b/packages/net/tcpip/current/include/netinet6/pim6_var.h --- a/packages/net/tcpip/current/include/netinet6/pim6_var.h +++ b/packages/net/tcpip/current/include/netinet6/pim6_var.h @@ -5,29 +5,6 @@ // IPv6 protocol independent multicast // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/netinet6/tcpipv6.h b/packages/net/tcpip/current/include/netinet6/tcpipv6.h --- a/packages/net/tcpip/current/include/netinet6/tcpipv6.h +++ b/packages/net/tcpip/current/include/netinet6/tcpipv6.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/network.h b/packages/net/tcpip/current/include/network.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/network.h +++ /dev/null @@ -1,108 +0,0 @@ -//========================================================================== -// -// include/network.h -// -// Misc network support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#ifndef _NETWORK_H_ -#define _NETWORK_H_ - -#define NO_LIBKERN_INLINE // Avoid kernel inline functions - -#include -#include -#undef _KERNEL -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#ifdef CYGHWR_NET_DRIVER_ETH0 -extern struct bootp eth0_bootp_data; -extern cyg_bool_t eth0_up; -extern const char *eth0_name; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 -extern struct bootp eth1_bootp_data; -extern cyg_bool_t eth1_up; -extern const char *eth1_name; -#endif - -__externC void init_all_network_interfaces(void); - -__externC void route_reinit(void); -__externC void perror(const char *); -__externC int close(int); -__externC ssize_t read(int, void *, size_t); -__externC ssize_t write(int, const void *, size_t); -__externC char *inet_ntoa(struct in_addr); -__externC int select(int, fd_set *, fd_set *, fd_set *, struct timeval *tv); - -// This API is for our own automated network tests. -// It's not at all supported. -#define CYG_NET_GET_MEM_STATS_MISC 0 // Misc mpool -#define CYG_NET_GET_MEM_STATS_MBUFS 1 // Mbufs pool -#define CYG_NET_GET_MEM_STATS_CLUST 2 // Clust pool -int cyg_net_get_mem_stats( int which, cyg_mempool_info *p ); - -#endif // _NETWORK_H_ diff --git a/packages/net/tcpip/current/include/sys/bsdselect.h b/packages/net/tcpip/current/include/sys/bsdselect.h --- a/packages/net/tcpip/current/include/sys/bsdselect.h +++ b/packages/net/tcpip/current/include/sys/bsdselect.h @@ -5,29 +5,6 @@ // Support for 'select()' system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/bsdtypes.h b/packages/net/tcpip/current/include/sys/bsdtypes.h --- a/packages/net/tcpip/current/include/sys/bsdtypes.h +++ b/packages/net/tcpip/current/include/sys/bsdtypes.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/cdefs.h b/packages/net/tcpip/current/include/sys/cdefs.h --- a/packages/net/tcpip/current/include/sys/cdefs.h +++ b/packages/net/tcpip/current/include/sys/cdefs.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/domain.h b/packages/net/tcpip/current/include/sys/domain.h --- a/packages/net/tcpip/current/include/sys/domain.h +++ b/packages/net/tcpip/current/include/sys/domain.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/endian.h b/packages/net/tcpip/current/include/sys/endian.h --- a/packages/net/tcpip/current/include/sys/endian.h +++ b/packages/net/tcpip/current/include/sys/endian.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/errno.h b/packages/net/tcpip/current/include/sys/errno.h --- a/packages/net/tcpip/current/include/sys/errno.h +++ b/packages/net/tcpip/current/include/sys/errno.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/ioccom.h b/packages/net/tcpip/current/include/sys/ioccom.h --- a/packages/net/tcpip/current/include/sys/ioccom.h +++ b/packages/net/tcpip/current/include/sys/ioccom.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/ioctl.h b/packages/net/tcpip/current/include/sys/ioctl.h --- a/packages/net/tcpip/current/include/sys/ioctl.h +++ b/packages/net/tcpip/current/include/sys/ioctl.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/kernel.h b/packages/net/tcpip/current/include/sys/kernel.h --- a/packages/net/tcpip/current/include/sys/kernel.h +++ b/packages/net/tcpip/current/include/sys/kernel.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/malloc.h b/packages/net/tcpip/current/include/sys/malloc.h --- a/packages/net/tcpip/current/include/sys/malloc.h +++ b/packages/net/tcpip/current/include/sys/malloc.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/mbuf.h b/packages/net/tcpip/current/include/sys/mbuf.h --- a/packages/net/tcpip/current/include/sys/mbuf.h +++ b/packages/net/tcpip/current/include/sys/mbuf.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -456,13 +433,13 @@ struct mbstat { #ifdef _KERNEL extern struct mbuf *mbutl; /* virtual address of mclusters */ extern char *mclrefcnt; /* cluster reference counts */ -struct mbstat mbstat; +extern struct mbstat mbstat; extern int nmbclusters; union mcluster *mclfree; -int max_linkhdr; /* largest link-level header */ -int max_protohdr; /* largest protocol header */ -int max_hdr; /* largest link+protocol header */ -int max_datalen; /* MHLEN - max_hdr */ +extern int max_linkhdr; /* largest link-level header */ +extern int max_protohdr; /* largest protocol header */ +extern int max_hdr; /* largest link+protocol header */ +extern int max_datalen; /* MHLEN - max_hdr */ extern int mbtypes[]; /* XXX */ extern int needqueuedrain; /* True if allocation failed at */ /* interrupt level */ @@ -494,29 +471,6 @@ void m_zero __P((struct mbuf *)); int m_apply __P((struct mbuf *, int, int, int (*)(caddr_t, caddr_t, unsigned int), caddr_t)); -#ifdef MBTYPES -int mbtypes[] = { /* XXX */ - M_FREE, /* MT_FREE 0 should be on free list */ - M_MBUF, /* MT_DATA 1 dynamic (data) allocation */ - M_MBUF, /* MT_HEADER 2 packet header */ - M_SOCKET, /* MT_SOCKET 3 socket structure */ - M_PCB, /* MT_PCB 4 protocol control block */ - M_RTABLE, /* MT_RTABLE 5 routing tables */ - M_HTABLE, /* MT_HTABLE 6 IMP host tables */ - 0, /* MT_ATABLE 7 address resolution tables */ - M_MBUF, /* MT_SONAME 8 socket name */ - 0, /* 9 */ - M_SOOPTS, /* MT_SOOPTS 10 socket options */ - M_FTABLE, /* MT_FTABLE 11 fragment reassembly header */ - M_MBUF, /* MT_RIGHTS 12 access rights */ - M_IFADDR, /* MT_IFADDR 13 interface address */ - M_MBUF, /* MT_CONTROL 14 extra-data protocol message */ - M_MBUF, /* MT_OOBDATA 15 expedited data */ -#ifdef DATAKIT - 25, 26, 27, 28, 29, 30, 31, 32 /* datakit ugliness */ -#endif -}; -#endif #endif #endif // _SYS_MBUF_H_ diff --git a/packages/net/tcpip/current/include/sys/param.h b/packages/net/tcpip/current/include/sys/param.h --- a/packages/net/tcpip/current/include/sys/param.h +++ b/packages/net/tcpip/current/include/sys/param.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -162,10 +139,6 @@ #include #endif -/* Machine type dependent parameters. */ -#include -#include - #ifndef __ECOS /* * Priorities. Note that with 32 run queues, differences less than 4 are @@ -361,6 +334,14 @@ extern void cyg_splx(cyg_uint32); extern void cyg_panic(const char *msg, ...); #define panic cyg_panic + +// Namespace changes +#define route_reinit cyg_route_reinit +#define arc4random cyg_arc4random #endif +/* Machine type dependent parameters. */ +#include +#include + #endif // __SYS_PARAM_H_ diff --git a/packages/net/tcpip/current/include/sys/protosw.h b/packages/net/tcpip/current/include/sys/protosw.h --- a/packages/net/tcpip/current/include/sys/protosw.h +++ b/packages/net/tcpip/current/include/sys/protosw.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/queue.h b/packages/net/tcpip/current/include/sys/queue.h --- a/packages/net/tcpip/current/include/sys/queue.h +++ b/packages/net/tcpip/current/include/sys/queue.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/socket.h b/packages/net/tcpip/current/include/sys/socket.h --- a/packages/net/tcpip/current/include/sys/socket.h +++ b/packages/net/tcpip/current/include/sys/socket.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/socketvar.h b/packages/net/tcpip/current/include/sys/socketvar.h --- a/packages/net/tcpip/current/include/sys/socketvar.h +++ b/packages/net/tcpip/current/include/sys/socketvar.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/sockio.h b/packages/net/tcpip/current/include/sys/sockio.h --- a/packages/net/tcpip/current/include/sys/sockio.h +++ b/packages/net/tcpip/current/include/sys/sockio.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/syscallargs.h b/packages/net/tcpip/current/include/sys/syscallargs.h --- a/packages/net/tcpip/current/include/sys/syscallargs.h +++ b/packages/net/tcpip/current/include/sys/syscallargs.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/sys/time.h b/packages/net/tcpip/current/include/sys/time.h --- a/packages/net/tcpip/current/include/sys/time.h +++ b/packages/net/tcpip/current/include/sys/time.h @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/include/tftp_support.h b/packages/net/tcpip/current/include/tftp_support.h deleted file mode 100644 --- a/packages/net/tcpip/current/include/tftp_support.h +++ /dev/null @@ -1,114 +0,0 @@ -//========================================================================== -// -// include/tftp_support.h -// -// TFTP support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-04-06 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#ifndef _TFTP_SUPPORT_H_ -#define _TFTP_SUPPORT_H_ - -/* - * File transfer modes - */ -#define TFTP_NETASCII 0 // Text files -#define TFTP_OCTET 1 // Binary files - -/* - * Errors - */ - -// These initial 7 are passed across the net in "ERROR" packets. -#define TFTP_ENOTFOUND 1 /* file not found */ -#define TFTP_EACCESS 2 /* access violation */ -#define TFTP_ENOSPACE 3 /* disk full or allocation exceeded */ -#define TFTP_EBADOP 4 /* illegal TFTP operation */ -#define TFTP_EBADID 5 /* unknown transfer ID */ -#define TFTP_EEXISTS 6 /* file already exists */ -#define TFTP_ENOUSER 7 /* no such user */ -// These extensions are return codes in our API, *never* passed on the net. -#define TFTP_TIMEOUT 8 /* operation timed out */ -#define TFTP_NETERR 9 /* some sort of network error */ -#define TFTP_INVALID 10 /* invalid parameter */ -#define TFTP_PROTOCOL 11 /* protocol violation */ -#define TFTP_TOOLARGE 12 /* file is larger than buffer */ - -/* - * Server support - */ - -struct tftpd_fileops { - int (*open)(const char *, int); - int (*close)(int); - int (*write)(int, const void *, int); - int (*read)(int, void *, int); -}; - -// Flags - passed to "open" -#ifndef O_RDONLY -#define O_RDONLY 1 -#define O_WRONLY 2 -#endif - -__externC int tftpd_start(int, struct tftpd_fileops *); -__externC int tftpd_stop(int); - -/* - * Client support - */ - -__externC int tftp_get(char *, struct sockaddr_in *, char *, int, int, int *); -__externC int tftp_put(char *, struct sockaddr_in *, char *, int, int, int *); - -#define TFTP_TIMEOUT_PERIOD 5 // Seconds between retries -#define TFTP_TIMEOUT_MAX 50 // Max timeouts over all blocks -#define TFTP_RETRIES_MAX 5 // retries per block before giving up - -#endif // _TFTP_SUPPORT_H_ diff --git a/packages/net/tcpip/current/src/ecos/init.cxx b/packages/net/tcpip/current/src/ecos/init.cxx --- a/packages/net/tcpip/current/src/ecos/init.cxx +++ b/packages/net/tcpip/current/src/ecos/init.cxx @@ -5,29 +5,15 @@ // Networking package initializer class // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSPDCOPYRIGHTBEGIN#### +// +// Copyright (C) 2000, 2001, 2002 Red Hat, Inc. +// All Rights Reserved. +// +// Permission is granted to use, copy, modify and redistribute this +// file. +// +//####ECOSPDCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/net/tcpip/current/src/ecos/support.c b/packages/net/tcpip/current/src/ecos/support.c --- a/packages/net/tcpip/current/src/ecos/support.c +++ b/packages/net/tcpip/current/src/ecos/support.c @@ -5,29 +5,6 @@ // eCos wrapper and support functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -84,7 +61,7 @@ #if !CYGPKG_NET_DRIVER_FRAMEWORK // Interface #error At least one network driver framework must be defined! #else -#include +#include // Define table boundaries CYG_HAL_TABLE_BEGIN( __NETDEVTAB__, netdev ); diff --git a/packages/net/tcpip/current/src/ecos/synch.c b/packages/net/tcpip/current/src/ecos/synch.c --- a/packages/net/tcpip/current/src/ecos/synch.c +++ b/packages/net/tcpip/current/src/ecos/synch.c @@ -5,29 +5,6 @@ // eCos wrapper and synch functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -81,7 +58,7 @@ #include -#include +#include //---------------------------- splx() emulation ------------------------------ // This contains both the SPLX stuff and tsleep/wakeup - because those must diff --git a/packages/net/tcpip/current/src/ecos/timeout.c b/packages/net/tcpip/current/src/ecos/timeout.c --- a/packages/net/tcpip/current/src/ecos/timeout.c +++ b/packages/net/tcpip/current/src/ecos/timeout.c @@ -5,29 +5,6 @@ // timeout support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/accept.c b/packages/net/tcpip/current/src/lib/accept.c --- a/packages/net/tcpip/current/src/lib/accept.c +++ b/packages/net/tcpip/current/src/lib/accept.c @@ -5,29 +5,6 @@ // accept() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/bind.c b/packages/net/tcpip/current/src/lib/bind.c --- a/packages/net/tcpip/current/src/lib/bind.c +++ b/packages/net/tcpip/current/src/lib/bind.c @@ -5,29 +5,6 @@ // bind() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/bootp_support.c b/packages/net/tcpip/current/src/lib/bootp_support.c deleted file mode 100644 --- a/packages/net/tcpip/current/src/lib/bootp_support.c +++ /dev/null @@ -1,536 +0,0 @@ -//========================================================================== -// -// lib/bootp_support.c -// -// Minimal BOOTP functions -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// BOOTP support (and a little DHCP support also) - -#include -#include -#include - -#include - -#ifdef CYGINT_ISO_DNS -#include -#endif - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif - -// This function sets up the interface it the simplest configuration. -// Just enough to broadcast a BOOTP request and get a response. -// It returns 'true' if a response was obtained. -cyg_bool_t -do_bootp(const char *intf, struct bootp *recv) -{ - struct sockaddr_in *addrp; - struct ifreq ifr; - struct sockaddr_in cli_addr, serv_addr, bootp_server_addr; - struct ecos_rtentry route; - int s, addrlen; - int one = 1; - struct bootp bootp_xmit; - unsigned char mincookie[] = {99,130,83,99,255} ; - struct timeval tv; - cyg_bool_t retcode = true; - - // Ensure clean slate - route_reinit(); // Force any existing routes to be forgotten - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - perror("socket"); - return false; - } - - if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { - perror("setsockopt"); - return false; - } - - addrp = (struct sockaddr_in *) &ifr.ifr_addr; - memset(addrp, 0, sizeof(*addrp)); - addrp->sin_family = AF_INET; - addrp->sin_len = sizeof(*addrp); - addrp->sin_port = 0; - addrp->sin_addr.s_addr = INADDR_ANY; - - strcpy(ifr.ifr_name, intf); - if (ioctl(s, SIOCSIFADDR, &ifr)) { - perror("SIOCSIFADDR"); - return false; - } - - if (ioctl(s, SIOCSIFNETMASK, &ifr)) { - perror("SIOCSIFNETMASK"); - return false; - } - - /* the broadcast address is 255.255.255.255 */ - memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr)); - if (ioctl(s, SIOCSIFBRDADDR, &ifr)) { - perror("SIOCSIFBRDADDR"); - return false; - } - - ifr.ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; - if (ioctl(s, SIOCSIFFLAGS, &ifr)) { - perror("SIOCSIFFLAGS"); - return false; - } - - if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) { - perror("SIOCGIFHWADDR"); - return false; - } - - // Set up routing - /* the broadcast address is 255.255.255.255 */ - memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr)); - memset(&route, 0, sizeof(route)); - memcpy(&route.rt_gateway, addrp, sizeof(*addrp)); - - addrp->sin_family = AF_INET; - addrp->sin_port = 0; - addrp->sin_addr.s_addr = INADDR_ANY; - memcpy(&route.rt_dst, addrp, sizeof(*addrp)); - memcpy(&route.rt_genmask, addrp, sizeof(*addrp)); - - route.rt_dev = ifr.ifr_name; - route.rt_flags = RTF_UP|RTF_GATEWAY; - route.rt_metric = 0; - - if (ioctl(s, SIOCADDRT, &route)) { - if (errno != EEXIST) { - perror("SIOCADDRT 3"); - return false; - } - } - - memset((char *) &cli_addr, 0, sizeof(cli_addr)); - cli_addr.sin_family = AF_INET; - cli_addr.sin_addr.s_addr = htonl(INADDR_ANY); - cli_addr.sin_port = htons(IPPORT_BOOTPC); - - if(bind(s, (struct sockaddr *) &cli_addr, sizeof(cli_addr)) < 0) { - perror("bind error"); - return false; - } - if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { - perror("setsockopt SO_REUSEADDR"); - return false; - } - if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { - perror("setsockopt SO_REUSEPORT"); - return false; - } - - memset((char *) &serv_addr, 0, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); - serv_addr.sin_port = htons(IPPORT_BOOTPS); - - // Fill in the BOOTP request - bzero(&bootp_xmit, sizeof(bootp_xmit)); - if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) { - perror("SIOCGIFHWADDR"); - return false; - } - bootp_xmit.bp_htype = HTYPE_ETHERNET; - bootp_xmit.bp_hlen = IFHWADDRLEN; - bcopy(ifr.ifr_hwaddr.sa_data, &bootp_xmit.bp_chaddr, bootp_xmit.bp_hlen); - - bootp_xmit.bp_secs = 0; - bcopy(mincookie, bootp_xmit.bp_vend, sizeof(mincookie)); - - bootp_xmit.bp_op = BOOTREQUEST; - - if(sendto(s, &bootp_xmit, sizeof(struct bootp), 0, - (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { - perror("sendto error"); - return false; - } - - tv.tv_sec = 5; - tv.tv_usec = 0; - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - - addrlen = sizeof(bootp_server_addr); - if (recvfrom(s, recv, sizeof(struct bootp), 0, - (struct sockaddr *)&bootp_server_addr, &addrlen) < 0) { - // This is an "acceptable" error, it means there is no server for - // us: do not initialize the interface. - retcode = false; - } - - // Shut things down regardless of success of rx, otherwise other - // interfaces cannot be initialised! - memset(addrp, 0, sizeof(*addrp)); - addrp->sin_family = AF_INET; - addrp->sin_len = sizeof(*addrp); - addrp->sin_port = 0; - addrp->sin_addr.s_addr = INADDR_ANY; - - strcpy(ifr.ifr_name, intf); - if (ioctl(s, SIOCDIFADDR, &ifr)) { - perror("SIOCDIFADDR"); - } - - // Shut down interface so it can be reinitialized - ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING); - if (ioctl(s, SIOCSIFFLAGS, &ifr)) { - perror("SIOCSIFFLAGS"); - return false; - } - - // All done with socket - close(s); - return retcode; -} - -static char *_bootp_op[] = {"", "REQUEST", "REPLY"}; -static char *_bootp_hw_type[] = {"", "Ethernet", "Exp Ethernet", "AX25", - "Pronet", "Chaos", "IEEE802", "Arcnet"}; - -static char *_dhcpmsgs[] = {"","DISCOVER", "OFFER", "REQUEST", "DECLINE", - "ACK", "NAK", "RELEASE" }; - -void -show_bootp(const char *intf, struct bootp *bp) -{ - int i, len; - unsigned char *op, *ap = 0, optover; - unsigned char name[128]; - struct in_addr addr[32]; - unsigned int length; - - diag_printf("BOOTP[%s] op: %s\n", intf, _bootp_op[bp->bp_op]); - diag_printf(" htype: %s\n", _bootp_hw_type[bp->bp_htype]); - diag_printf(" hlen: %d\n", bp->bp_hlen ); - diag_printf(" hops: %d\n", bp->bp_hops ); - diag_printf(" xid: 0x%x\n", bp->bp_xid ); - diag_printf(" secs: %d\n", bp->bp_secs ); - diag_printf(" flags: 0x%x\n", bp->bp_flags ); - diag_printf(" hw_addr: "); - for (i = 0; i < bp->bp_hlen; i++) { - diag_printf("%02x", bp->bp_chaddr[i]); - if (i != (bp->bp_hlen-1)) diag_printf(":"); - } - diag_printf("\n"); - diag_printf(" client IP: %s\n", inet_ntoa(bp->bp_ciaddr)); - diag_printf(" my IP: %s\n", inet_ntoa(bp->bp_yiaddr)); - diag_printf(" server IP: %s\n", inet_ntoa(bp->bp_siaddr)); - diag_printf(" gateway IP: %s\n", inet_ntoa(bp->bp_giaddr)); - - optover = 0; // See whether sname and file are overridden for options - length = sizeof(optover); - (void)get_bootp_option( bp, TAG_DHCP_OPTOVER, &optover, &length ); - if ( !(1 & optover) && bp->bp_sname[0] ) - diag_printf(" server: %s\n", bp->bp_sname); - if ( ! (2 & optover) && bp->bp_file[0] ) - diag_printf(" file: %s\n", bp->bp_file); - if (bp->bp_vend[0]) { - diag_printf(" options:\n"); - op = &bp->bp_vend[4]; - while (*op != TAG_END) { - switch (*op) { - case TAG_SUBNET_MASK: - case TAG_GATEWAY: - case TAG_IP_BROADCAST: - case TAG_DOMAIN_SERVER: - ap = (unsigned char *)&addr[0]; - len = *(op+1); - for (i = 0; i < len; i++) { - *ap++ = *(op+i+2); - } - if (*op == TAG_SUBNET_MASK) ap = " subnet mask"; - if (*op == TAG_GATEWAY) ap = " gateway"; - if (*op == TAG_IP_BROADCAST) ap = " IP broadcast"; - if (*op == TAG_DOMAIN_SERVER) ap = "domain server"; - diag_printf(" %s: ", ap); - ap = (unsigned char *)&addr[0]; - while (len > 0) { - diag_printf("%s", inet_ntoa(*(struct in_addr *)ap)); - len -= sizeof(struct in_addr); - ap += sizeof(struct in_addr); - if (len) diag_printf(", "); - } - diag_printf("\n"); - break; - case TAG_DOMAIN_NAME: - case TAG_HOST_NAME: - for (i = 0; i < *(op+1); i++) { - name[i] = *(op+i+2); - } - name[*(op+1)] = '\0'; - if (*op == TAG_DOMAIN_NAME) ap = " domain name"; - if (*op == TAG_HOST_NAME) ap = " host name"; - diag_printf(" %s: %s\n", ap, name); - break; - case TAG_DHCP_MESS_TYPE: - diag_printf(" DHCP message: %d %s\n", - op[2], _dhcpmsgs[op[2]] ); - break; - case TAG_DHCP_REQ_IP: - diag_printf(" DHCP requested ip: %d.%d.%d.%d\n", - op[2], op[3], op[4], op[5] ); - break; - case TAG_DHCP_LEASE_TIME : - case TAG_DHCP_RENEWAL_TIME : - case TAG_DHCP_REBIND_TIME : - diag_printf(" DHCP time %d: %d\n", - *op, ((((((op[2]<<8)+op[3])<<8)+op[4])<<8)+op[5]) ); - - break; - case TAG_DHCP_SERVER_ID : - diag_printf(" DHCP server id: %d.%d.%d.%d\n", - op[2], op[3], op[4], op[5] ); - break; - - case TAG_DHCP_OPTOVER : - case TAG_DHCP_PARM_REQ_LIST: - case TAG_DHCP_TEXT_MESSAGE : - case TAG_DHCP_MAX_MSGSZ : - case TAG_DHCP_CLASSID : - case TAG_DHCP_CLIENTID : - diag_printf(" DHCP option: %x/%d.%d:", *op, *op, *(op+1)); - if ( 1 == op[1] ) - diag_printf( " %d", op[2] ); - else if ( 2 == op[1] ) - diag_printf( " %d", (op[2]<<8)+op[3] ); - else if ( 4 == op[1] ) - diag_printf( " %d", ((((((op[2]<<8)+op[3])<<8)+op[4])<<8)+op[5]) ); - else - for ( i = 2; i < 2 + op[1]; i++ ) - diag_printf(" %d",op[i]); - diag_printf("\n"); - break; - - default: - diag_printf("Unknown option: %x/%d.%d:", *op, *op, *(op+1)); - for ( i = 2; i < 2 + op[1]; i++ ) - diag_printf(" %d",op[i]); - diag_printf("\n"); - break; - } - op += *(op+1)+2; - } - } -} - -cyg_bool_t -get_bootp_option(struct bootp *bp, unsigned char tag, void *opt, - unsigned int *length) -{ - unsigned char *val = (unsigned char *)opt; - int i; - cyg_uint8 optover; - -#define SCANTAG( ptr ) CYG_MACRO_START \ - unsigned int max; \ - unsigned char *op = (ptr); \ - while (*op != TAG_END) { \ - if (*op == tag) { \ - max=(*(op+1)>*length ? *length : *(op+1)); \ - for (i = 0; i < max; i++) { \ - *val++ = *(op+i+2); \ - } \ - *length=max; \ - return true; \ - } \ - op += *(op+1)+2; \ - } \ -CYG_MACRO_END - - SCANTAG( &bp->bp_vend[4] ); - - if ( TAG_DHCP_OPTOVER == tag ) // prevent recursion > once - return false; - // else, look for that tag to see if there's more... - optover = 0; - if ( ! get_bootp_option( bp, TAG_DHCP_OPTOVER, &optover, length) ) - return false; - - if ( 1 & optover ) // then the file field also holds options - SCANTAG( &bp->bp_file[0] ); - - if ( 2 & optover ) // then the sname field also holds options - SCANTAG( &bp->bp_sname[0] ); - - return false; -} - -// [Re]initialize the network interface with the info passed from BOOTP -cyg_bool_t -init_net(const char *intf, struct bootp *bp) -{ - struct sockaddr_in *addrp; - struct ifreq ifr; - int s; - int one = 1; - struct ecos_rtentry route; - struct in_addr netmask, gateway; - unsigned int length; - - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - perror("socket"); - return false; - } - - if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { - perror("setsockopt"); - return false; - } - - addrp = (struct sockaddr_in *) &ifr.ifr_addr; - memset(addrp, 0, sizeof(*addrp)); - addrp->sin_family = AF_INET; - addrp->sin_len = sizeof(*addrp); - addrp->sin_port = 0; - addrp->sin_addr = bp->bp_yiaddr; // The address BOOTP gave us - - // Must do this temporarily with default route and netmask so that - // [sub]netmask can be set. - strcpy(ifr.ifr_name, intf); - if (ioctl(s, SIOCSIFADDR, &ifr)) { - perror("SIOCIFADDR"); - return false; - } - - length = sizeof(addrp->sin_addr); - if (get_bootp_option(bp, TAG_SUBNET_MASK, &addrp->sin_addr,&length)) { - netmask = addrp->sin_addr; - if (ioctl(s, SIOCSIFNETMASK, &ifr)) { - perror("SIOCSIFNETMASK"); - return false; - } - // Must do this again so that [sub]netmask (and so default route) - // is taken notice of. - addrp->sin_addr = bp->bp_yiaddr; // The address BOOTP gave us - if (ioctl(s, SIOCSIFADDR, &ifr)) { - perror("SIOCIFADDR 2"); - return false; - } - } - - length = sizeof(addrp->sin_addr); - if (get_bootp_option(bp, TAG_IP_BROADCAST, &addrp->sin_addr,&length)) { - if (ioctl(s, SIOCSIFBRDADDR, &ifr)) { - perror("SIOCSIFBRDADDR"); - return false; - } - // Do not re-set the IFADDR after this; doing *that* resets the - // BRDADDR to the default! - } - - ifr.ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; - if (ioctl(s, SIOCSIFFLAGS, &ifr)) { - perror("SIOCSIFFLAGS"); - return false; - } - - // Set up routing - length = sizeof(addrp->sin_addr); - if (get_bootp_option(bp, TAG_GATEWAY, &gateway,&length)) { - // ...and it's a nonzero address... - if ( 0 != gateway.s_addr ) { - memset(&route, 0, sizeof(route)); - addrp->sin_family = AF_INET; - addrp->sin_port = 0; - addrp->sin_len = sizeof(*addrp); - addrp->sin_addr.s_addr = 0; // Use 0,0,GATEWAY for the default route - memcpy(&route.rt_dst, addrp, sizeof(*addrp)); - addrp->sin_addr.s_addr = 0; - memcpy(&route.rt_genmask, addrp, sizeof(*addrp)); - addrp->sin_addr = gateway; - memcpy(&route.rt_gateway, addrp, sizeof(*addrp)); - - route.rt_dev = ifr.ifr_name; - route.rt_flags = RTF_UP|RTF_GATEWAY; - route.rt_metric = 0; - - if (ioctl(s, SIOCADDRT, &route)) { - diag_printf("Route - dst: %s", - inet_ntoa(((struct sockaddr_in *)&route.rt_dst)->sin_addr)); - diag_printf(", mask: %s", - inet_ntoa(((struct sockaddr_in *)&route.rt_genmask)->sin_addr)); - diag_printf(", gateway: %s\n", - inet_ntoa(((struct sockaddr_in *)&route.rt_gateway)->sin_addr)); - if (errno != EEXIST) { - perror("SIOCADDRT 3"); - return false; - } - } - } - } -#ifdef CYGINT_ISO_DNS - { -#define MAX_IP_ADDR_LEN 16 - char buf[BP_MAX_OPTION_LEN+1]; - memset(buf,0,sizeof(buf)); - length = sizeof(buf); - if (get_bootp_option(bp, TAG_DOMAIN_NAME, buf, &length)) { - setdomainname(buf, length); - } - length = sizeof(buf); - if (get_bootp_option(bp, TAG_DOMAIN_SERVER, buf, &length)) { - cyg_dns_res_init((struct in_addr *)buf); - } - } -#endif - close(s); - return true; -} diff --git a/packages/net/tcpip/current/src/lib/close.c b/packages/net/tcpip/current/src/lib/close.c --- a/packages/net/tcpip/current/src/lib/close.c +++ b/packages/net/tcpip/current/src/lib/close.c @@ -5,29 +5,6 @@ // close() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/connect.c b/packages/net/tcpip/current/src/lib/connect.c --- a/packages/net/tcpip/current/src/lib/connect.c +++ b/packages/net/tcpip/current/src/lib/connect.c @@ -5,29 +5,6 @@ // connect() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/dhcp_prot.c b/packages/net/tcpip/current/src/lib/dhcp_prot.c deleted file mode 100644 --- a/packages/net/tcpip/current/src/lib/dhcp_prot.c +++ /dev/null @@ -1,1227 +0,0 @@ -/*========================================================================== -// -// dhcp_prot.c -// -// DHCP protocol implementation for DHCP client -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): hmt -// Contributors: gthomas -// Date: 2000-07-01 -// Purpose: DHCP support -// Description: -// -//####DESCRIPTIONEND#### -// -//========================================================================*/ - -#include -#include - -#ifdef CYGPKG_NET_DHCP - -#if 0 -#define perror( txt ) // nothing -#endif - -#include -#include - -#include - -// ------------------------------------------------------------------------ -// Returns a pointer to the end of dhcp message (or NULL if invalid) -// meaning the address of the byte *after* the TAG_END token in the vendor -// data. - -static unsigned char * -scan_dhcp_size( struct bootp *ppkt ) -{ - unsigned char *op; - - op = &ppkt->bp_vend[0]; - // First check for the cookie! - if ( op[0] != 99 || - op[1] != 130 || - op[2] != 83 || - op[3] != 99 ) { - CYG_FAIL( "Bad DHCP cookie" ); - return NULL; - } - op += 4; - while (*op != TAG_END) { - op += *(op+1)+2; - if ( op > &ppkt->bp_vend[BP_VEND_LEN-1] ) { - CYG_FAIL( "Oversize DHCP packet in dhcp_size" ); - return NULL; - } - } - // Check op has not gone wild - CYG_ASSERT( op > (unsigned char *)(&ppkt[0]), "op pointer underflow!" ); - // Compare op with non-existent "next" struct bootp in the array. - CYG_ASSERT( op < (unsigned char *)(&ppkt[1]), "op pointer overflow!" ); - return op + 1; // Address of first invalid byte -} - -// ------------------------------------------------------------------------ -// Get the actual packet size of an initialized buffer - -static int -dhcp_size( struct bootp *ppkt ) -{ - unsigned char *op; - - op = scan_dhcp_size( ppkt ); - if ( !op ) return 0; - return (op - (unsigned char *)ppkt); -} - - -// ------------------------------------------------------------------------ -// Get the actual packet size of an initialized buffer -// This will also pad the packet with 0 if length is less -// than BP_STD_TX_MINPKTSZ. - -static int -dhcp_size_for_send( struct bootp *ppkt ) -{ - unsigned char *op; - - op = scan_dhcp_size( ppkt ); - if ( !op ) return 0; // Better not scribble! - // Zero extra bytes until the packet is large enough. - for ( ; op < (((unsigned char *)ppkt) + BP_STD_TX_MINPKTSZ); op++ ) - *op = 0; - return (op - (unsigned char *)ppkt); -} - -// ------------------------------------------------------------------------ -// Insert/set an option value in an initialized buffer - -static int -set_fixed_tag( struct bootp *ppkt, - unsigned char tag, - cyg_uint32 value, - int len) -{ - unsigned char *op; - - // Initially this will only scan the options field. - - op = &ppkt->bp_vend[4]; - while (*op != TAG_END) { - if ( op > &ppkt->bp_vend[BP_VEND_LEN-1] ) { - CYG_FAIL( "Oversize DHCP packet in set_fixed_tag" ); - return false; - } - if (*op == tag) // Found it... - break; - op += *(op+1)+2; - } - - if (*op == tag) { // Found it... - if ( *(op+1) != len ) { - CYG_FAIL( "Wrong size in set_fixed_tag" ); - return false; // wrong size - } - } - else { // overwrite the end tag and install a new one - if ( op + len + 2 > &ppkt->bp_vend[BP_VEND_LEN-1] ) { - CYG_FAIL( "Oversize DHCP packet in set_fixed_tag append" ); - return false; - } - *op = tag; - *(op+1) = len; - *(op + len + 2) = TAG_END; - } - // and insert the value. Net order is BE. - op += len + 2 - 1; // point to end of value - while ( len-- > 0 ) { - *op-- = (unsigned char)(value & 255); - value >>= 8; - } - return true; -} - -// Note that this does not permit changing the size of an extant tag. -static int -set_variable_tag( struct bootp *ppkt, - unsigned char tag, - cyg_uint8 *pvalue, - int len) -{ - unsigned char *op; - - // Initially this will only scan the options field. - op = &ppkt->bp_vend[4]; - while (*op != TAG_END) { - if ( op > &ppkt->bp_vend[BP_VEND_LEN-1] ) { - CYG_FAIL( "Oversize DHCP packet in set_variable_tag" ); - return false; - } - if (*op == tag) // Found it... - break; - op += *(op+1)+2; - } - - if (*op == tag) { // Found it... - if ( *(op+1) != len ) { - CYG_FAIL( "Wrong size in set_variable_tag" ); - return false; // wrong size - } - } - else { // overwrite the end tag and install a new one - if ( op + len + 2 > &ppkt->bp_vend[BP_VEND_LEN-1] ) { - CYG_FAIL( "Oversize DHCP packet in set_variable_tag append" ); - return false; - } - *op = tag; - *(op+1) = len; - *(op + len + 2) = TAG_END; - } - // and insert the value. No order is implied. - op += 2; // point to start of value - while ( len-- > 0 ) { - *op++ = *pvalue++; - } - return true; -} - -// ------------------------------------------------------------------------ -// Bring up an interface enough to broadcast, before we know who we are - -static int -bring_half_up(const char *intf, struct ifreq *ifrp ) -{ - int s; - int one = 1; - - struct sockaddr_in *addrp; - struct ecos_rtentry route; - - // Ensure clean slate - route_reinit(); // Force any existing routes to be forgotten - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - perror("socket"); - return false; - } - - if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { - perror("setsockopt"); - return false; - } - - addrp = (struct sockaddr_in *) &ifrp->ifr_addr; - memset(addrp, 0, sizeof(*addrp)); - addrp->sin_family = AF_INET; - addrp->sin_len = sizeof(*addrp); - addrp->sin_port = 0; - addrp->sin_addr.s_addr = INADDR_ANY; - - strcpy(ifrp->ifr_name, intf); - if (ioctl(s, SIOCSIFADDR, ifrp)) { /* set ifnet address */ - perror("SIOCSIFADDR"); - return false; - } - - if (ioctl(s, SIOCSIFNETMASK, ifrp)) { /* set net addr mask */ - perror("SIOCSIFNETMASK"); - return false; - } - - /* the broadcast address is 255.255.255.255 */ - memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr)); - if (ioctl(s, SIOCSIFBRDADDR, ifrp)) { /* set broadcast addr */ - perror("SIOCSIFBRDADDR"); - return false; - } - - ifrp->ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; - if (ioctl(s, SIOCSIFFLAGS, ifrp)) { /* set ifnet flags */ - perror("SIOCSIFFLAGS up"); - return false; - } - - if (ioctl(s, SIOCGIFHWADDR, ifrp) < 0) { /* get MAC address */ - perror("SIOCGIFHWADDR 1"); - return false; - } - - // Set up routing - /* the broadcast address is 255.255.255.255 */ - memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr)); - memset(&route, 0, sizeof(route)); - memcpy(&route.rt_gateway, addrp, sizeof(*addrp)); - - addrp->sin_family = AF_INET; - addrp->sin_port = 0; - addrp->sin_addr.s_addr = INADDR_ANY; - memcpy(&route.rt_dst, addrp, sizeof(*addrp)); - memcpy(&route.rt_genmask, addrp, sizeof(*addrp)); - - route.rt_dev = ifrp->ifr_name; - route.rt_flags = RTF_UP|RTF_GATEWAY; - route.rt_metric = 0; - - if (ioctl(s, SIOCADDRT, &route)) { /* add route */ - if (errno != EEXIST) { - perror("SIOCADDRT 3"); - return false; - } - } - - close(s); - - return true; -} - - -// ------------------------------------------------------------------------ -// DHCP retransmission timeouts and number of tries -// -// To work better with simulated failures (or real ones!) so that the rest -// of the system is tested, rather than DHCP renewal failures pulling -// everything down, we try a little more zealously than the RFC suggests. - -static unsigned char timeout_random = 0; - -struct timeout_state { - unsigned int secs; - int countdown; -}; - -static inline void reset_timeout( struct timeval *ptv, struct timeout_state *pstate ) -{ - timeout_random++; - pstate->countdown = 4; // initial fast retries - pstate->secs = 3 + (timeout_random & 3); - ptv->tv_sec = 0; - ptv->tv_usec = 65536 * (2 + (timeout_random & 3)); // 0.1 - 0.3S, about -} - -static inline int next_timeout( struct timeval *ptv, struct timeout_state *pstate ) -{ - if ( 0 < pstate->countdown-- ) - return true; - if ( 0 == ptv->tv_sec ) - ptv->tv_sec = pstate->secs; - else { - timeout_random++; - pstate->secs = ptv->tv_sec * 2 - 2 + (timeout_random & 3); - pstate->countdown = 2; // later fast retries - ptv->tv_sec = 0; - } - return pstate->secs < 100; // If longer, too many tries... -} - -// ------------------------------------------------------------------------ -// Lease expiry and alarms to notify it - -static cyg_alarm_t alarm_function; - -static void alarm_function(cyg_handle_t alarm, cyg_addrword_t data) -{ - struct dhcp_lease *lease = (struct dhcp_lease *)data; - lease->which |= lease->next; - if ( lease->needs_attention ) - cyg_semaphore_post( lease->needs_attention ); - - // Step the lease on into its next state of being alarmed ;-) - if ( lease->next & DHCP_LEASE_EX ) { - cyg_alarm_disable( alarm ); - } - else if ( lease->next & DHCP_LEASE_T2 ) { - lease->next = DHCP_LEASE_EX; - cyg_alarm_initialize( lease->alarm, lease->expiry, 0 ); - cyg_alarm_enable( lease->alarm ); - } - else if ( lease->next & DHCP_LEASE_T1 ) { - lease->next = DHCP_LEASE_T2; - cyg_alarm_initialize( lease->alarm, lease->t2, 0 ); - cyg_alarm_enable( lease->alarm ); - } -} - -static inline void no_lease( struct dhcp_lease *lease ) -{ - if ( lease->alarm ) { - // Already set: delete this. - cyg_alarm_disable( lease->alarm ); - cyg_alarm_delete( lease->alarm ); - lease->alarm = 0; - } -} - -static inline void new_lease( struct bootp *bootp, struct dhcp_lease *lease ) -{ - cyg_tick_count_t now = cyg_current_time(); - cyg_tick_count_t then; - cyg_uint32 tag = 0; - cyg_uint32 expiry_then; - cyg_resolution_t resolution = - cyg_clock_get_resolution(cyg_real_time_clock()); - cyg_handle_t h; - unsigned int length; - - // Silence any jabbering from past lease on this interface - no_lease( lease ); - lease->which = lease->next = 0; - cyg_clock_to_counter(cyg_real_time_clock(), &h); - cyg_alarm_create( h, alarm_function, (cyg_addrword_t)lease, - &lease->alarm, &lease->alarm_obj ); - - // extract the lease time and scale it &c to now. - length = sizeof(tag); - if(!get_bootp_option( bootp, TAG_DHCP_LEASE_TIME, &tag ,&length)) - tag = 0xffffffff; - - if ( 0xffffffff == tag ) { - lease->expiry = 0xffffffffffffffff; - lease->t2 = 0xffffffffffffffff; - lease->t1 = 0xffffffffffffffff; - return; // it's an infinite lease, hurrah! - } - - then = (cyg_uint64)(ntohl(tag)); - expiry_then = then; - - then *= 1000000000; // into nS - we know there is room in a tick_count_t - then = (then / resolution.dividend) * resolution.divisor; // into system ticks - lease->expiry = now + then; - length = sizeof(tag); - if (get_bootp_option( bootp, TAG_DHCP_REBIND_TIME, &tag, &length )) - then = (cyg_uint64)(ntohl(tag)); - else - then = expiry_then - expiry_then/4; - then *= 1000000000; // into nS - we know there is room in a tick_count_t - then = (then / resolution.dividend) * resolution.divisor; // into system ticks - lease->t2 = now + then; - - length = sizeof(tag); - if (get_bootp_option( bootp, TAG_DHCP_RENEWAL_TIME, &tag, &length )) - then = (cyg_uint64)(ntohl(tag)); - else - then = expiry_then/2; - then *= 1000000000; // into nS - we know there is room in a tick_count_t - then = (then / resolution.dividend) * resolution.divisor; // into system ticks - lease->t1 = now + then; - -#if 0 // for testing this mechanism - lease->expiry = now + 5000; // 1000 here makes for failure in the DHCP test - lease->t2 = now + 3500; - lease->t1 = now + 2500; -#endif - -#ifdef CYGDBG_NET_DHCP_CHATTER - diag_printf("new_lease:\n"); - diag_printf(" expiry = %d\n",lease->expiry); - diag_printf(" t1 = %d\n",lease->t1); - diag_printf(" t2 = %d\n",lease->t2); -#endif - - lease->next = DHCP_LEASE_T1; - - cyg_alarm_initialize( lease->alarm, lease->t1, 0 ); - cyg_alarm_enable( lease->alarm ); -} - -// ------------------------------------------------------------------------ -// Set all the tags we want to use when sending a packet. -// This has expanded to a large, explicit set to interwork better -// with a variety of DHCP servers. - -static void set_default_dhcp_tags( struct bootp *xmit ) -{ - // Explicitly request full set of params that are default for LINUX - // dhcp servers, but not default for others. This is rather arbitrary, - // but it preserves behaviour for people using those servers. - // Perhaps configury of this set will be needed in future? - // - // Here's the set: - static cyg_uint8 req_list[] = { -#ifdef CYGOPT_NET_DHCP_PARM_REQ_LIST_REPLACE - CYGOPT_NET_DHCP_PARM_REQ_LIST_REPLACE , -#else - TAG_DHCP_SERVER_ID , // DHCP server id: 10.16.19.66 - TAG_DHCP_LEASE_TIME , // DHCP time 51: 60 - TAG_DHCP_RENEWAL_TIME , // DHCP time 58: 30 - TAG_DHCP_REBIND_TIME , // DHCP time 59: 52 - TAG_SUBNET_MASK , // subnet mask: 255.255.255.0 - TAG_GATEWAY , // gateway: 10.16.19.66 - TAG_DOMAIN_SERVER , // domain server: 10.16.19.66 - TAG_DOMAIN_NAME , // domain name: hmt10.cambridge.redhat.com - TAG_IP_BROADCAST , // IP broadcast: 10.16.19.255 -#endif -#ifdef CYGOPT_NET_DHCP_PARM_REQ_LIST_ADDITIONAL - CYGOPT_NET_DHCP_PARM_REQ_LIST_ADDITIONAL , -#endif - }; - - if ( req_list[0] ) // So that one may easily turn it all off by configury - set_variable_tag( xmit, TAG_DHCP_PARM_REQ_LIST, - &req_list[0], sizeof( req_list ) ); - - // Explicitly specify our max message size. - set_fixed_tag( xmit, TAG_DHCP_MAX_MSGSZ, BP_MINPKTSZ, 2 ); -} - -// ------------------------------------------------------------------------ -// the DHCP state machine - this does all the work - -int -do_dhcp(const char *intf, struct bootp *res, - cyg_uint8 *pstate, struct dhcp_lease *lease) -{ - struct ifreq ifr; - struct sockaddr_in cli_addr, broadcast_addr, server_addr, rx_addr; - int s, addrlen; - int one = 1; - unsigned char mincookie[] = {99,130,83,99,255} ; - struct timeval tv; - struct timeout_state timeout_scratch; - cyg_uint8 oldstate = *pstate; - cyg_uint8 msgtype = 0, seen_bootp_reply = 0; - unsigned int length; - - cyg_uint32 xid; - - // IMPORTANT: xmit is the same as res throughout this; *received is a - // scratch buffer for reception; its contents are always copied to res - // when we are happy with them. So we always transmit from the - // existing state. - struct bootp rx_local; - struct bootp *received = &rx_local; - struct bootp *xmit = res; - - // First, get a socket on the interface in question. But Zeroth, if - // needs be, bring it to the half-up broadcast only state if needs be. - - if ( DHCPSTATE_INIT == oldstate - || DHCPSTATE_FAILED == oldstate - || 0 == oldstate ) { - // either explicit init state or the beginning of time or retry - if ( ! bring_half_up( intf, &ifr ) ) - return false; - - *pstate = DHCPSTATE_INIT; - } - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - perror("socket"); - return false; - } - - if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { - perror("setsockopt"); - return false; - } - - memset((char *) &cli_addr, 0, sizeof(cli_addr)); - cli_addr.sin_family = AF_INET; - cli_addr.sin_addr.s_addr = htonl(INADDR_ANY); - cli_addr.sin_port = htons(IPPORT_BOOTPC); - - memset((char *) &broadcast_addr, 0, sizeof(broadcast_addr)); - broadcast_addr.sin_family = AF_INET; - broadcast_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); - broadcast_addr.sin_port = htons(IPPORT_BOOTPS); - - memset((char *) &server_addr, 0, sizeof(server_addr)); - server_addr.sin_family = AF_INET; - server_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); // overwrite later - server_addr.sin_port = htons(IPPORT_BOOTPS); - - if(bind(s, (struct sockaddr *) &cli_addr, sizeof(cli_addr)) < 0) { - perror("bind error"); - return false; - } - if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { - perror("setsockopt SO_REUSEADDR"); - return false; - } - if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { - perror("setsockopt SO_REUSEPORT"); - return false; - } - - // Now, we can launch into the DHCP state machine. I think this will - // be the neatest way to do it; it returns from within the switch arms - // when all is well, or utterly failed. - - reset_timeout( &tv, &timeout_scratch ); - - xid = res->bp_xid; // default to what's there already; - - // generates a new XID - { - unsigned char* xp = (unsigned char*)&xid; - - *xp++ = ifr.ifr_hwaddr.sa_data[5]; - *xp++ = ifr.ifr_hwaddr.sa_data[4]; - *((cyg_uint16*)xp) = (cyg_uint16)(arc4random() & 0xffff); - } - - while ( 1 ) { - - // If we are active rather than in the process of shutting down, - // check for any lease expiry every time round, so that alarms - // *can* change the course of events even when already renewing, - // for example. - if ( DHCPSTATE_DO_RELEASE != *pstate - && DHCPSTATE_NOTBOUND != *pstate - && DHCPSTATE_FAILED != *pstate ) { - cyg_uint8 lease_state; - - cyg_scheduler_lock(); - lease_state = lease->which; - lease->which = 0; // flag that we have noticed it - cyg_scheduler_unlock(); - - if ( lease_state & DHCP_LEASE_EX ) { - // then the lease has expired completely! - *pstate = DHCPSTATE_NOTBOUND; - } - else if ( lease_state & DHCP_LEASE_T2 ) { - // Time to renew - reset_timeout( &tv, &timeout_scratch ); // next conversation - *pstate = DHCPSTATE_REBINDING; - } - else if ( lease_state & DHCP_LEASE_T1 ) { - // Time to renew - reset_timeout( &tv, &timeout_scratch ); // next conversation - *pstate = DHCPSTATE_RENEWING; - } - } - - switch ( *pstate ) { - - case DHCPSTATE_INIT: - - // Send the DHCPDISCOVER packet - - if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) { /* get MAC address */ - perror("SIOCGIFHWADDR 2"); - return false; - } - - // Fill in the BOOTP request - DHCPDISCOVER packet - bzero(xmit, sizeof(*xmit)); - xmit->bp_op = BOOTREQUEST; - xmit->bp_htype = HTYPE_ETHERNET; - xmit->bp_hlen = IFHWADDRLEN; - xmit->bp_xid = xid; - xmit->bp_secs = 0; - xmit->bp_flags = htons(0x8000); // BROADCAST FLAG - bcopy(ifr.ifr_hwaddr.sa_data, &xmit->bp_chaddr, xmit->bp_hlen); - bcopy(mincookie, xmit->bp_vend, sizeof(mincookie)); - - // remove the next line to test ability to handle bootp packets. - set_fixed_tag( xmit, TAG_DHCP_MESS_TYPE, DHCPDISCOVER, 1 ); - // Set all the tags we want to use when sending a packet - set_default_dhcp_tags( xmit ); - -#ifdef CYGDBG_NET_DHCP_CHATTER - diag_printf( "---------DHCPSTATE_INIT sending:\n" ); - show_bootp( intf, xmit ); -#endif - if(sendto(s, xmit, dhcp_size_for_send(xmit), 0, - (struct sockaddr *)&broadcast_addr, sizeof(broadcast_addr)) < 0) { - *pstate = DHCPSTATE_FAILED; - break; - } - - seen_bootp_reply = 0; - *pstate = DHCPSTATE_SELECTING; - break; - - case DHCPSTATE_SELECTING: - // This is a separate state so that we can listen again - // *without* retransmitting. - - // listen for the DHCPOFFER reply - - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - - addrlen = sizeof(rx_addr); - if (recvfrom(s, received, sizeof(struct bootp), 0, - (struct sockaddr *)&rx_addr, &addrlen) < 0) { - // No packet arrived (this time) - if ( seen_bootp_reply ) { // then already have a bootp reply - // Save the good packet in *xmit - bcopy( received, xmit, dhcp_size(received) ); - *pstate = DHCPSTATE_BOOTP_FALLBACK; - reset_timeout( &tv, &timeout_scratch ); - break; - } - // go to the next larger timeout and re-send: - if ( ! next_timeout( &tv, &timeout_scratch ) ) { - *pstate = DHCPSTATE_FAILED; - break; - } - *pstate = DHCPSTATE_INIT; // to retransmit - break; - } - -#ifdef CYGDBG_NET_DHCP_CHATTER - diag_printf( "---------DHCPSTATE_SELECTING received:\n" ); - diag_printf( "...rx_addr is family %d, addr %08x, port %d\n", - rx_addr.sin_family, - rx_addr.sin_addr.s_addr, - rx_addr.sin_port ); - show_bootp( intf, received ); -#endif - if ( received->bp_xid != xid ) // not the same transaction; - break; // listen again... - - if ( 0 == received->bp_siaddr.s_addr ) { - // then fill in from the options... - length = sizeof(received->bp_siaddr.s_addr); - get_bootp_option( received, TAG_DHCP_SERVER_ID, - &received->bp_siaddr.s_addr, - &length); - } - - // see if it was a DHCP reply or a bootp reply; it could be - // either. - length = sizeof(msgtype); - if ( get_bootp_option( received, TAG_DHCP_MESS_TYPE, &msgtype, - &length) ) { - if ( DHCPOFFER == msgtype ) { // all is well - // Save the good packet in *xmit - bcopy( received, xmit, dhcp_size(received) ); - // we like the packet, so reset the timeout for next time - reset_timeout( &tv, &timeout_scratch ); - *pstate = DHCPSTATE_REQUESTING; - } - } - else // No TAG_DHCP_MESS_TYPE entry so it's a bootp reply - seen_bootp_reply = 1; // (keep the bootp packet in received) - - // If none of the above state changes occurred, we got a packet - // that "should not happen", OR we have a bootp reply in our - // hand; so listen again with the same timeout, without - // retrying the send, in the hope of getting a DHCP reply. - break; - - case DHCPSTATE_REQUESTING: - // Just send what you got with a DHCPREQUEST in the message type. - // then wait for an ACK in DHCPSTATE_REQUEST_RECV. - - // Fill in the BOOTP request - DHCPREQUEST packet - xmit->bp_xid = xid; - xmit->bp_op = BOOTREQUEST; - xmit->bp_flags = htons(0x8000); // BROADCAST FLAG - - set_fixed_tag( xmit, TAG_DHCP_MESS_TYPE, DHCPREQUEST, 1 ); - // Set all the tags we want to use when sending a packet - set_default_dhcp_tags( xmit ); - // And this will be a new one: - set_fixed_tag( xmit, TAG_DHCP_REQ_IP, ntohl(xmit->bp_yiaddr.s_addr), 4 ); - -#ifdef CYGDBG_NET_DHCP_CHATTER - diag_printf( "---------DHCPSTATE_REQUESTING sending:\n" ); - show_bootp( intf, xmit ); -#endif - if(sendto(s, xmit, dhcp_size_for_send(xmit), 0, - (struct sockaddr *)&broadcast_addr, sizeof(broadcast_addr)) < 0) { - *pstate = DHCPSTATE_FAILED; - break; - } - - *pstate = DHCPSTATE_REQUEST_RECV; - break; - - case DHCPSTATE_REQUEST_RECV: - // wait for an ACK or a NACK - retry by going back to - // DHCPSTATE_REQUESTING; NACK means go back to INIT. - - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - - addrlen = sizeof(rx_addr); - if (recvfrom(s, received, sizeof(struct bootp), 0, - (struct sockaddr *)&rx_addr, &addrlen) < 0) { - // No packet arrived - // go to the next larger timeout and re-send: - if ( ! next_timeout( &tv, &timeout_scratch ) ) { - *pstate = DHCPSTATE_FAILED; - break; - } - *pstate = DHCPSTATE_REQUESTING; - break; - } - -#ifdef CYGDBG_NET_DHCP_CHATTER - diag_printf( "---------DHCPSTATE_REQUEST_RECV received:\n" ); - diag_printf( "...rx_addr is family %d, addr %08x, port %d\n", - rx_addr.sin_family, - rx_addr.sin_addr.s_addr, - rx_addr.sin_port ); - show_bootp( intf, received ); -#endif - if ( received->bp_xid != xid ) // not the same transaction; - break; // listen again... - - if ( 0 == received->bp_siaddr.s_addr ) { - // then fill in from the options... - length = sizeof(received->bp_siaddr.s_addr ); - get_bootp_option( received, TAG_DHCP_SERVER_ID, - &received->bp_siaddr.s_addr, - &length); - } - - // check it was a DHCP reply - length = sizeof(msgtype); - if ( get_bootp_option( received, TAG_DHCP_MESS_TYPE, &msgtype, - &length) ) { - if ( DHCPACK == msgtype // Same offer & server? - && received->bp_yiaddr.s_addr == xmit->bp_yiaddr.s_addr - && received->bp_siaddr.s_addr == xmit->bp_siaddr.s_addr) { - // Save the good packet in *xmit - bcopy( received, xmit, dhcp_size(received) ); - // we like the packet, so reset the timeout for next time - reset_timeout( &tv, &timeout_scratch ); - // Record the new lease and set up timers &c - new_lease( received, lease ); - *pstate = DHCPSTATE_BOUND; - break; - } - if ( DHCPNAK == msgtype // Same server? - && received->bp_siaddr.s_addr == xmit->bp_siaddr.s_addr) { - // we're bounced! - *pstate = DHCPSTATE_INIT; // So back the start of the rigmarole. - reset_timeout( &tv, &timeout_scratch ); - break; - } - // otherwise it's something else, maybe another offer, or a bogus - // NAK from someone we are not asking! - // Just listen again, which implicitly discards it. - } - break; - - case DHCPSTATE_BOUND: - - // We are happy now, we have our address. - - // All done with socket - close(s); - - // Re-initialize the interface with the new state - if ( DHCPSTATE_BOUND != oldstate ) { - // Then need to go down and up - do_dhcp_down_net( intf, res, &oldstate, lease ); // oldstate used - if ( 0 != oldstate ) { - // Then not called from init_all_network_interfaces() - // so we must initialize the interface ourselves - if (!init_net(intf, res)) { - do_dhcp_down_net( intf, res, pstate, lease ); - *pstate = DHCPSTATE_FAILED; - return false; - } - } - } - - // Otherwise, nothing whatsoever to do... - return true; - - case DHCPSTATE_RENEWING: - // Just send what you got with a DHCPREQUEST in the message - // type UNICAST straight to the server. Then wait for an ACK. - - // Fill in the BOOTP request - DHCPREQUEST packet - xmit->bp_xid = xid; - xmit->bp_op = BOOTREQUEST; - xmit->bp_flags = htons(0); // No BROADCAST FLAG - // Use the *client* address here: - xmit->bp_ciaddr.s_addr = xmit->bp_yiaddr.s_addr; - - set_fixed_tag( xmit, TAG_DHCP_MESS_TYPE, DHCPREQUEST, 1 ); - // Set all the tags we want to use when sending a packet - set_default_dhcp_tags( xmit ); - // And this will be a new one: - set_fixed_tag( xmit, TAG_DHCP_REQ_IP, ntohl(xmit->bp_yiaddr.s_addr), 4 ); - - // Set unicast address to *server* - server_addr.sin_addr.s_addr = res->bp_siaddr.s_addr; - -#ifdef CYGDBG_NET_DHCP_CHATTER - diag_printf( "---------DHCPSTATE_RENEWING sending:\n" ); - diag_printf( "UNICAST to family %d, addr %08x, port %d\n", - server_addr.sin_family, - server_addr.sin_addr.s_addr, - server_addr.sin_port ); - show_bootp( intf, xmit ); -#endif - - if(sendto(s, xmit, dhcp_size_for_send(xmit), 0, - // UNICAST address of the server: - (struct sockaddr *)&server_addr, - sizeof(server_addr)) < 0) { - *pstate = DHCPSTATE_FAILED; - break; - } - - *pstate = DHCPSTATE_RENEW_RECV; - break; - - case DHCPSTATE_RENEW_RECV: - // wait for an ACK or a NACK - retry by going back to - // DHCPSTATE_RENEWING; NACK means go to NOTBOUND. - - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - - addrlen = sizeof(rx_addr); - if (recvfrom(s, received, sizeof(struct bootp), 0, - (struct sockaddr *)&rx_addr, &addrlen) < 0) { - // No packet arrived - // go to the next larger timeout and re-send: - if ( ! next_timeout( &tv, &timeout_scratch ) ) { - reset_timeout( &tv, &timeout_scratch ); - *pstate = DHCPSTATE_REBINDING; - break; - } - *pstate = DHCPSTATE_RENEWING; - break; - } - -#ifdef CYGDBG_NET_DHCP_CHATTER - diag_printf( "---------DHCPSTATE_RENEW_RECV received:\n" ); - diag_printf( "...rx_addr is family %d, addr %08x, port %d\n", - rx_addr.sin_family, - rx_addr.sin_addr.s_addr, - rx_addr.sin_port ); - show_bootp( intf, received ); -#endif - if ( received->bp_xid != xid ) // not the same transaction; - break; // listen again... - - if ( 0 == received->bp_siaddr.s_addr ) { - // then fill in from the options... - length = sizeof(received->bp_siaddr.s_addr); - get_bootp_option( received, TAG_DHCP_SERVER_ID, - &received->bp_siaddr.s_addr, - &length); - } - - // check it was a DHCP reply - length = sizeof(msgtype); - if ( get_bootp_option( received, TAG_DHCP_MESS_TYPE, &msgtype, - &length) ) { - if ( DHCPACK == msgtype // Same offer? - && received->bp_yiaddr.s_addr == xmit->bp_yiaddr.s_addr) { - // Save the good packet in *xmit - bcopy( received, xmit, dhcp_size(received) ); - // we like the packet, so reset the timeout for next time - reset_timeout( &tv, &timeout_scratch ); - // Record the new lease and set up timers &c - new_lease( received, lease ); - *pstate = DHCPSTATE_BOUND; - break; - } - if ( DHCPNAK == msgtype ) { // we're bounced! - *pstate = DHCPSTATE_NOTBOUND; // So quit out. - reset_timeout( &tv, &timeout_scratch ); - break; - } - // otherwise it's something else, maybe another offer. - // Just listen again, which implicitly discards it. - } - break; - - case DHCPSTATE_REBINDING: - // Just send what you got with a DHCPREQUEST in the message type. - // Then wait for an ACK. This one is BROADCAST. - - // Fill in the BOOTP request - DHCPREQUEST packet - xmit->bp_xid = xid; - xmit->bp_op = BOOTREQUEST; - xmit->bp_flags = htons(0); // no BROADCAST FLAG - // Use the *client* address here: - xmit->bp_ciaddr.s_addr = xmit->bp_yiaddr.s_addr; - - set_fixed_tag( xmit, TAG_DHCP_MESS_TYPE, DHCPREQUEST, 1 ); - // Set all the tags we want to use when sending a packet - set_default_dhcp_tags( xmit ); - // And this will be a new one: - set_fixed_tag( xmit, TAG_DHCP_REQ_IP, ntohl(xmit->bp_yiaddr.s_addr), 4 ); - -#ifdef CYGDBG_NET_DHCP_CHATTER - diag_printf( "---------DHCPSTATE_REBINDING sending:\n" ); - show_bootp( intf, xmit ); -#endif - if(sendto(s, xmit, dhcp_size_for_send(xmit), 0, - (struct sockaddr *)&broadcast_addr, sizeof(broadcast_addr)) < 0) { - *pstate = DHCPSTATE_FAILED; - break; - } - - *pstate = DHCPSTATE_REBIND_RECV; - break; - - case DHCPSTATE_REBIND_RECV: - // wait for an ACK or a NACK - retry by going back to - // DHCPSTATE_REBINDING; NACK means go to NOTBOUND. - - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - - addrlen = sizeof(rx_addr); - if (recvfrom(s, received, sizeof(struct bootp), 0, - (struct sockaddr *)&rx_addr, &addrlen) < 0) { - // No packet arrived - // go to the next larger timeout and re-send: - if ( ! next_timeout( &tv, &timeout_scratch ) ) { - reset_timeout( &tv, &timeout_scratch ); - *pstate = DHCPSTATE_FAILED; - break; - } - *pstate = DHCPSTATE_REBINDING; - break; - } - -#ifdef CYGDBG_NET_DHCP_CHATTER - diag_printf( "---------DHCPSTATE_REBIND_RECV received:\n" ); - diag_printf( "...rx_addr is family %d, addr %08x, port %d\n", - rx_addr.sin_family, - rx_addr.sin_addr.s_addr, - rx_addr.sin_port ); - show_bootp( intf, received ); -#endif - if ( received->bp_xid != xid ) // not the same transaction; - break; // listen again... - - if ( 0 == received->bp_siaddr.s_addr ) { - // then fill in from the options... - int length = sizeof(received->bp_siaddr.s_addr ); - get_bootp_option( received, TAG_DHCP_SERVER_ID, - &received->bp_siaddr.s_addr, - &length); - } - - // check it was a DHCP reply - length = sizeof(msgtype); - if ( get_bootp_option( received, TAG_DHCP_MESS_TYPE, &msgtype, - &length) ) { - if ( DHCPACK == msgtype // Same offer? - && received->bp_yiaddr.s_addr == xmit->bp_yiaddr.s_addr) { - // Save the good packet in *xmit - bcopy( received, xmit, dhcp_size(received) ); - // we like the packet, so reset the timeout for next time - reset_timeout( &tv, &timeout_scratch ); - // Record the new lease and set up timers &c - new_lease( received, lease ); - *pstate = DHCPSTATE_BOUND; - break; - } - else if ( DHCPNAK == msgtype ) { // we're bounced! - *pstate = DHCPSTATE_NOTBOUND; // So back the start of the rigmarole. - reset_timeout( &tv, &timeout_scratch ); - break; - } - // otherwise it's something else, maybe another offer. - // Just listen again, which implicitly discards it. - } - break; - - case DHCPSTATE_BOOTP_FALLBACK: - // All done with socket - close(s); - // And no lease should have become active, but JIC - no_lease( lease ); - // Re-initialize the interface with the new state - if ( DHCPSTATE_BOOTP_FALLBACK != oldstate ) { - // Then need to go down and up - do_dhcp_down_net( intf, res, &oldstate, lease ); // oldstate used - if ( 0 != oldstate ) { - // Then not called from init_all_network_interfaces() - // so we must initialize the interface ourselves - if (!init_net(intf, res)) { - do_dhcp_down_net( intf, res, pstate, lease ); - *pstate = DHCPSTATE_FAILED; - return false; - } - } - } - - // Otherwise, nothing whatsoever to do... - return true; - - case DHCPSTATE_NOTBOUND: - // All done with socket - close(s); - // No lease active - no_lease( lease ); - // Leave interface up so app can tidy. - return false; - - case DHCPSTATE_FAILED: - // All done with socket - close(s); - // No lease active - no_lease( lease ); - // Unconditionally down the interface. - do_dhcp_down_net( intf, res, &oldstate, lease ); - return false; - - case DHCPSTATE_DO_RELEASE: - // We have been forced here by external means, to release the - // lease for graceful shutdown. - - // Just send what you got with a DHCPRELEASE in the message - // type UNICAST straight to the server. No ACK. Then go to - // NOTBOUND state. - xmit->bp_xid = xid; - xmit->bp_op = BOOTREQUEST; - xmit->bp_flags = htons(0); // no BROADCAST FLAG - // Use the *client* address here: - xmit->bp_ciaddr.s_addr = xmit->bp_yiaddr.s_addr; - - set_fixed_tag( xmit, TAG_DHCP_MESS_TYPE, DHCPRELEASE, 1 ); - - // Set unicast address to *server* - server_addr.sin_addr.s_addr = res->bp_siaddr.s_addr; - -#ifdef CYGDBG_NET_DHCP_CHATTER - diag_printf( "---------DHCPSTATE_DO_RELEASE sending:\n" ); - diag_printf( "UNICAST to family %d, addr %08x, port %d\n", - server_addr.sin_family, - server_addr.sin_addr.s_addr, - server_addr.sin_port ); - show_bootp( intf, xmit ); -#endif - if(sendto(s, xmit, dhcp_size_for_send(xmit), 0, - // UNICAST address of the server: - (struct sockaddr *)&server_addr, - sizeof(server_addr)) < 0) { - *pstate = DHCPSTATE_FAILED; - break; - } - - *pstate = DHCPSTATE_NOTBOUND; - break; - - default: - no_lease( lease ); - close(s); - return false; - } - } - /* NOTREACHED */ - return false; -} - -// ------------------------------------------------------------------------ -// Bring an interface down, failed to initialize it or lease is expired -// Also part of normal startup, bring down for proper reinitialization - -int -do_dhcp_down_net(const char *intf, struct bootp *res, - cyg_uint8 *pstate, struct dhcp_lease *lease) -{ - struct sockaddr_in *addrp; - struct ifreq ifr; - int s; - - // Ensure clean slate - route_reinit(); // Force any existing routes to be forgotten - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - perror("socket"); - return false; - } - - addrp = (struct sockaddr_in *) &ifr.ifr_addr; - - // Remove any existing address - if ( DHCPSTATE_FAILED == *pstate - || DHCPSTATE_INIT == *pstate - || 0 == *pstate ) { - // it was configured for broadcast only, "half-up" - memset(addrp, 0, sizeof(*addrp)); - addrp->sin_family = AF_INET; - addrp->sin_len = sizeof(*addrp); - addrp->sin_port = 0; - addrp->sin_addr.s_addr = INADDR_ANY; - } - else { - // get the specific address that was used - strcpy(ifr.ifr_name, intf); - if (ioctl(s, SIOCGIFADDR, &ifr)) { - perror("SIOCGIFADDR 1"); - return false; - } - } - - strcpy(ifr.ifr_name, intf); - if (ioctl(s, SIOCDIFADDR, &ifr)) { /* delete IF addr */ - perror("SIOCDIFADDR1"); - } - - // Shut down interface so it can be reinitialized - ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING); - if (ioctl(s, SIOCSIFFLAGS, &ifr)) { /* set ifnet flags */ - perror("SIOCSIFFLAGS down"); - return false; - } - - // All done with socket - close(s); - - if ( 0 != *pstate ) // preserve initial state - *pstate = DHCPSTATE_INIT; - - return true; -} - -// ------------------------------------------------------------------------ -// Release (relinquish) a leased address - if we have one - and bring down -// the interface. -int -do_dhcp_release(const char *intf, struct bootp *res, - cyg_uint8 *pstate, struct dhcp_lease *lease) -{ - if ( 0 != *pstate - && DHCPSTATE_INIT != *pstate - && DHCPSTATE_NOTBOUND != *pstate - && DHCPSTATE_FAILED != *pstate - && DHCPSTATE_BOOTP_FALLBACK != *pstate ) { - *pstate = DHCPSTATE_DO_RELEASE; - do_dhcp( intf, res, pstate, lease ); // to send the release packet - cyg_thread_delay( 100 ); // to let it leave the building - } - return true; -} - -// ------------------------------------------------------------------------ - -#endif // CYGPKG_NET_DHCP - -// EOF dhcp_prot.c diff --git a/packages/net/tcpip/current/src/lib/dhcp_support.c b/packages/net/tcpip/current/src/lib/dhcp_support.c deleted file mode 100644 --- a/packages/net/tcpip/current/src/lib/dhcp_support.c +++ /dev/null @@ -1,243 +0,0 @@ -/*========================================================================== -// -// dhcp_support.c -// -// Support code == friendly API for DHCP client -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): hmt -// Contributors: gthomas -// Date: 2000-07-01 -// Purpose: DHCP support -// Description: -// -//####DESCRIPTIONEND#### -// -//========================================================================*/ - -#include -#include - -#ifdef CYGPKG_NET_DHCP - -#include -#include - -// --------------------------------------------------------------------------- -#ifdef CYGHWR_NET_DRIVER_ETH0 -cyg_uint8 eth0_dhcpstate = 0; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 -cyg_uint8 eth1_dhcpstate = 0; -#endif - -cyg_sem_t dhcp_needs_attention; - -#ifdef CYGHWR_NET_DRIVER_ETH0 -struct dhcp_lease eth0_lease = { &dhcp_needs_attention, 0,0,0,0,0,0 }; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 -struct dhcp_lease eth1_lease = { &dhcp_needs_attention, 0,0,0,0,0,0 }; -#endif - -// --------------------------------------------------------------------------- -// -// The point of this module is to deal with all the horrid written out in -// full stuff of having two interfaces; it's ugly but it's also most -// flexible. The dhcp_prot.c module should do all the work... -// -// --------------------------------------------------------------------------- - -// return value: 1 => everything OK, no change. -// 0 => close your connections, then call do_dhcp_halt() to halt the -// interface(s) in question (it knows because the state will be NOTBOUND). -// After that you can return to the start and use -// init_all_network_interfaces(); as usual, or call do_dhcp_bind() by hand, -// or whatever... -int dhcp_bind( void ) -{ -#ifdef CYGHWR_NET_DRIVER_ETH0 - cyg_uint8 old_eth0_dhcpstate = eth0_dhcpstate; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - cyg_uint8 old_eth1_dhcpstate = eth1_dhcpstate; -#endif - - // If there are no interfaces at all, init it every time, doesn't - // matter. In case we are called from elsewhere... - if ( 1 -#ifdef CYGHWR_NET_DRIVER_ETH0 - && eth0_dhcpstate == 0 -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - && eth1_dhcpstate == 0 -#endif - ) - cyg_semaphore_init( &dhcp_needs_attention, 0 ); - - // Run the state machine... -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up - && DHCPSTATE_FAILED != eth0_dhcpstate ) - eth0_up = do_dhcp(eth0_name, ð0_bootp_data, ð0_dhcpstate, ð0_lease); -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if (eth1_up - && DHCPSTATE_FAILED != eth1_dhcpstate ) - eth1_up = do_dhcp(eth1_name, ð1_bootp_data, ð1_dhcpstate, ð1_lease); -#endif - - // If the interface newly came up, initialize it: - // (this duplicates the code in init_all_network_interfaces() really). -#ifdef CYGHWR_NET_DRIVER_ETH0 - if ( eth0_up - && eth0_dhcpstate == DHCPSTATE_BOUND - && old_eth0_dhcpstate != eth0_dhcpstate ) { - if (!init_net(eth0_name, ð0_bootp_data)) { - eth0_up = false; - } - } -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if ( eth1_up - && eth1_dhcpstate == DHCPSTATE_BOUND - && old_eth1_dhcpstate != eth1_dhcpstate ) { - if (!init_net(eth1_name, ð1_bootp_data)) { - eth1_up = false; - } - } -#endif - -#ifdef CYGHWR_NET_DRIVER_ETH0 - if ( old_eth0_dhcpstate == DHCPSTATE_BOUND && - eth0_dhcpstate == DHCPSTATE_NOTBOUND ) - return 0; // a lease timed out; we became unbound -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if ( old_eth1_dhcpstate == DHCPSTATE_BOUND && - eth1_dhcpstate == DHCPSTATE_NOTBOUND ) - return 0; // a lease timed out; we became unbound -#endif - return 1; // all is well -} - - -// Shutdown any interface whose state is DHCPSTATE_NOTBOUND. -int dhcp_halt( void ) -{ -#ifdef CYGHWR_NET_DRIVER_ETH0 - if ( eth0_up - && eth0_dhcpstate != DHCPSTATE_FAILED ) { - do_dhcp_down_net(eth0_name, ð0_bootp_data, ð0_dhcpstate, ð0_lease); - } - eth0_up = false; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if ( eth1_up - && eth1_dhcpstate != DHCPSTATE_FAILED ) { - do_dhcp_down_net(eth1_name, ð1_bootp_data, ð1_dhcpstate, ð1_lease); - } - eth1_up = false; -#endif - return 1; -} - - -// Release (and set state to DHCPSTATE_NOTBOUND) all interfaces - we are -// closing down. (unlikely but maybe useful for testing) -int dhcp_release( void ) -{ -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up) - do_dhcp_release(eth0_name, ð0_bootp_data, ð0_dhcpstate, ð0_lease); -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if (eth1_up) - do_dhcp_release(eth1_name, ð1_bootp_data, ð1_dhcpstate, ð1_lease); -#endif - return 1; -} - - -// ------------------------------------------------------------------------ -// The management thread function -void dhcp_mgt_entry( cyg_addrword_t loop_on_failure ) -{ - int j; - while ( 1 ) { - while ( 1 ) { - cyg_semaphore_wait( &dhcp_needs_attention ); - if ( ! dhcp_bind() ) // a lease expired - break; // If we need to re-bind - } - dhcp_halt(); // tear everything down - if ( !loop_on_failure ) - return; // exit the thread/return - init_all_network_interfaces(); // re-initialize - for ( j = 0; j < CYGPKG_NET_NLOOP; j++ ) - init_loopback_interface( j ); -#ifdef CYGPKG_SNMPAGENT - SnmpdShutDown(0); // Cycle the snmpd state -#endif - } -} - -#ifdef CYGOPT_NET_DHCP_DHCP_THREAD -// Then we provide such a thread... -cyg_handle_t dhcp_mgt_thread_h = 0; -cyg_thread dhcp_mgt_thread; - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + sizeof(struct bootp)) -static cyg_uint8 dhcp_mgt_stack[ STACK_SIZE ]; - -void dhcp_start_dhcp_mgt_thread( void ) -{ - if ( ! dhcp_mgt_thread_h ) { - cyg_semaphore_init( &dhcp_needs_attention, 0 ); - cyg_thread_create( - CYGPKG_NET_DHCP_THREAD_PRIORITY, /* scheduling info (eg pri) */ - dhcp_mgt_entry, /* entry point function */ - CYGOPT_NET_DHCP_DHCP_THREAD_PARAM, /* entry data */ - "DHCP lease mgt", /* optional thread name */ - dhcp_mgt_stack, /* stack base, NULL = alloc */ - STACK_SIZE, /* stack size, 0 = default */ - &dhcp_mgt_thread_h, /* returned thread handle */ - &dhcp_mgt_thread /* put thread here */ - ); - - cyg_thread_resume(dhcp_mgt_thread_h); - } -} - - -#endif // CYGOPT_NET_DHCP_DHCP_THREAD - -#endif // CYGPKG_NET_DHCP - -// EOF dhcp_support.c diff --git a/packages/net/tcpip/current/src/lib/getpeername.c b/packages/net/tcpip/current/src/lib/getpeername.c --- a/packages/net/tcpip/current/src/lib/getpeername.c +++ b/packages/net/tcpip/current/src/lib/getpeername.c @@ -5,29 +5,6 @@ // getpeername() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/getproto.c b/packages/net/tcpip/current/src/lib/getproto.c deleted file mode 100644 --- a/packages/net/tcpip/current/src/lib/getproto.c +++ /dev/null @@ -1,110 +0,0 @@ -//========================================================================== -// -// lib/getproto.c -// -// getprotobyname(), getprotobynumber() -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include -#include - -static struct protoent protocols[] = { - { "ip", 0}, // internet protocol, pseudo protocol number - { "icmp", 1}, // internet control message protocol - { "igmp", 2}, // Internet Group Management - { "ggp", 3}, // gateway-gateway protocol - { "ipencap", 4}, // IP encapsulated in IP (officially ``IP'') - { "st", 5}, // ST datagram mode - { "tcp", 6}, // transmission control protocol - { "egp", 8}, // exterior gateway protocol - { "pup", 12}, // PARC universal packet protocol - { "udp", 17}, // user datagram protocol - { "hmp", 20}, // host monitoring protocol - { "xns-idp", 22}, // Xerox NS IDP - { "rdp", 27}, // "reliable datagram" protocol - { "iso-tp4", 29}, // ISO Transport Protocol class 4 - { "xtp", 36}, // Xpress Tranfer Protocol - { "ddp", 37}, // Datagram Delivery Protocol - { "idpr-cmtp", 39}, // IDPR Control Message Transport - { "rspf", 73}, //Radio Shortest Path First. - { "vmtp", 81}, // Versatile Message Transport - { "ospf", 89}, // Open Shortest Path First IGP - { "ipip", 94}, // Yet Another IP encapsulation - { "encap", 98}, // Yet Another IP encapsulation - { 0, 0} -}; - -struct protoent * -getprotobyname(const char *name) -{ - struct protoent *p = protocols; - while (p->p_name) { - if (strcmp(name, p->p_name) == 0) { - return p; - } - p++; - } - errno = ENOENT; - return (struct protoent *)0; -} - -struct protoent * -getprotobynumber(const int num) -{ - struct protoent *p = protocols; - while (p->p_name) { - if (p->p_proto == num) { - return p; - } - p++; - } - errno = ENOENT; - return (struct protoent *)0; -} diff --git a/packages/net/tcpip/current/src/lib/getserv.c b/packages/net/tcpip/current/src/lib/getserv.c deleted file mode 100644 --- a/packages/net/tcpip/current/src/lib/getserv.c +++ /dev/null @@ -1,121 +0,0 @@ -//========================================================================== -// -// lib/getserv.c -// -// getservbyname(), getservbyport() -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - - -#include -#include - -// These must return the port in network byte order. -// -// This means treated as a short, because it's a port, despite the types in -// the API and the struct being ints. -// -// The argument to getservbyport() is also network byte order, so that code -// must change to flip before comparing. - -static struct servent services[] = { - { "ftp", 0, 21 , "tcp" }, - { "ftp-data", 0, 20 , "tcp" }, - { "domain", 0, 53 , "udp" }, - { "tftp", 0, 69 , "udp" }, - { "snmp", 0, 161 , "udp" }, - - { NULL, 0, 0 , NULL } -}; - -// Note that this contains no interlocking between clients of the -// interface; but this is completely typical of such APIs. - -static struct servent * -setreturned( struct servent *p ) -{ - static struct servent returned; - - returned.s_name = p->s_name; - returned.s_aliases = p->s_aliases; - returned.s_port = htons(p->s_port); // return in net order - returned.s_proto = p->s_proto; - return &returned; -} - -struct servent * -getservbyname(const char *name, const char *proto) -{ - struct servent *p = services; - while (p->s_name) { - if ((strcmp(name, p->s_name) == 0) && - (strcmp(proto, p->s_proto) == 0)) { - return setreturned(p); - } - p++; - } - errno = ENOENT; - return (struct servent *)0; -} - -struct servent * -getservbyport(const int num, const char *proto) -{ - struct servent *p = services; - int port = ntohs(num); - while (p->s_name) { - if ((p->s_port == port) && - (strcmp(proto, p->s_proto) == 0)) { - return setreturned(p); - } - p++; - } - errno = ENOENT; - return (struct servent *)0; -} diff --git a/packages/net/tcpip/current/src/lib/getsockname.c b/packages/net/tcpip/current/src/lib/getsockname.c --- a/packages/net/tcpip/current/src/lib/getsockname.c +++ b/packages/net/tcpip/current/src/lib/getsockname.c @@ -5,29 +5,6 @@ // getsockname() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/getsockopt.c b/packages/net/tcpip/current/src/lib/getsockopt.c --- a/packages/net/tcpip/current/src/lib/getsockopt.c +++ b/packages/net/tcpip/current/src/lib/getsockopt.c @@ -5,29 +5,6 @@ // getsockopt() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/inet_addr.c b/packages/net/tcpip/current/src/lib/inet_addr.c deleted file mode 100644 --- a/packages/net/tcpip/current/src/lib/inet_addr.c +++ /dev/null @@ -1,257 +0,0 @@ -//========================================================================== -// -// lib/inet_addr.c -// -// INET address parse functions -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -/* $OpenBSD: inet_addr.c,v 1.6 1999/05/03 22:31:14 yanick Exp $ */ - -/* - * ++Copyright++ 1983, 1990, 1993 - * - - * Copyright (c) 1983, 1990, 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; -static char rcsid[] = "$From: inet_addr.c,v 8.5 1996/08/05 08:31:35 vixie Exp $"; -#else -static char rcsid[] = "$OpenBSD: inet_addr.c,v 1.6 1999/05/03 22:31:14 yanick Exp $"; -#endif -#endif /* LIBC_SCCS and not lint */ - -#ifdef __ECOS -#include -#undef _KERNEL -#include -#include -#include -#include - -#include -#include -#else -#include -#include -#include -#endif -#include -#include - -#ifdef __ECOS -#define isascii(c) (((c) >= 0x20) && ((c) <= 0x7F)) -#endif - -/* - * Ascii internet address interpretation routine. - * The value returned is in network order. - */ -in_addr_t -inet_addr(cp) - register const char *cp; -{ - struct in_addr val; - - if (inet_aton(cp, &val)) - return (val.s_addr); - return (INADDR_NONE); -} - -/* - * Check whether "cp" is a valid ascii representation - * of an Internet address and convert to a binary address. - * Returns 1 if the address is valid, 0 if not. - * This replaces inet_addr, the return value from which - * cannot distinguish between failure and a local broadcast address. - */ -int -inet_aton(cp, addr) - register const char *cp; - struct in_addr *addr; -{ - register in_addr_t val; - register int base, n; - register char c; - u_int parts[4]; - register u_int *pp = parts; - - c = *cp; - for (;;) { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, isdigit=decimal. - */ - if (!isdigit(c)) - return (0); - val = 0; base = 10; - if (c == '0') { - c = *++cp; - if (c == 'x' || c == 'X') - base = 16, c = *++cp; - else - base = 8; - } - for (;;) { - if (isascii(c) && isdigit(c)) { - val = (val * base) + (c - '0'); - c = *++cp; - } else if (base == 16 && isascii(c) && isxdigit(c)) { - val = (val << 4) | - (c + 10 - (islower(c) ? 'a' : 'A')); - c = *++cp; - } else - break; - } - if (c == '.') { - /* - * Internet format: - * a.b.c.d - * a.b.c (with c treated as 16 bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 3) - return (0); - *pp++ = val; - c = *++cp; - } else - break; - } - /* - * Check for trailing characters. - */ - if (c != '\0' && (!isascii(c) || !isspace(c))) - return (0); - /* - * Concoct the address according to - * the number of parts specified. - */ - n = pp - parts + 1; - switch (n) { - - case 0: - return (0); /* initial nondigit */ - - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if ((val > 0xffffff) || (parts[0] > 0xff)) - return (0); - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if ((val > 0xffff) || (parts[0] > 0xff) || (parts[1] > 0xff)) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if ((val > 0xff) || (parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xff)) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - if (addr) - addr->s_addr = htonl(val); - return (1); -} diff --git a/packages/net/tcpip/current/src/lib/ioctl.c b/packages/net/tcpip/current/src/lib/ioctl.c --- a/packages/net/tcpip/current/src/lib/ioctl.c +++ b/packages/net/tcpip/current/src/lib/ioctl.c @@ -5,29 +5,6 @@ // ioctl() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/listen.c b/packages/net/tcpip/current/src/lib/listen.c --- a/packages/net/tcpip/current/src/lib/listen.c +++ b/packages/net/tcpip/current/src/lib/listen.c @@ -5,29 +5,6 @@ // listen() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/network_support.c b/packages/net/tcpip/current/src/lib/network_support.c deleted file mode 100644 --- a/packages/net/tcpip/current/src/lib/network_support.c +++ /dev/null @@ -1,420 +0,0 @@ -//========================================================================== -// -// lib/net_support.c -// -// Misc network support functions -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas, sorin@netappi.com ("Sorin Babeanu"), hmt -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// BOOTP support - -#include -#undef _KERNEL -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include // for 'sprintf()' - -#include -#include -#include - -#include - -#ifdef CYGPKG_NET_DHCP -#include -#endif - -#ifdef CYGHWR_NET_DRIVER_ETH0 -struct bootp eth0_bootp_data; -cyg_bool_t eth0_up = false; -const char *eth0_name = "eth0"; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 -struct bootp eth1_bootp_data; -cyg_bool_t eth1_up = false; -const char *eth1_name = "eth1"; -#endif - -#define _string(s) #s -#define string(s) _string(s) - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif - -#ifdef CYGPKG_NET_NLOOP -#if 0 < CYGPKG_NET_NLOOP -// -// Initialize loopback interface ---------- Added by sorin@netappi.com -// -cyg_bool_t init_loopback_interface(int lo) -{ - struct sockaddr_in *addrp; - struct ifreq ifr; - int s; - int one = 1; - struct ecos_rtentry route; - struct in_addr netmask, gateway; - - //diag_printf("Init_loopback_interface\n"); - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - perror("socket"); - return false; - } - if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { - perror("setsockopt"); - return false; - } - - addrp = (struct sockaddr_in *) &ifr.ifr_addr; - memset(addrp, 0, sizeof(*addrp)); - addrp->sin_family = AF_INET; - addrp->sin_len = sizeof(*addrp); - addrp->sin_port = 0; - // Make an address 127.0..1 to manage multiple loopback ifs. - // (There is normally only 1, so it's the standard 127.0.0.1) - addrp->sin_addr.s_addr = htonl((0x100 * lo) + INADDR_LOOPBACK) ; - -#if CYGPKG_NET_NLOOP > 1 - // Init the one we were told to - sprintf(ifr.ifr_name, "lo%d", lo); -#else - strcpy(ifr.ifr_name, "lo0"); -#endif - - if (ioctl(s, SIOCSIFADDR, &ifr)) { - perror("SIOCIFADDR"); - return false; - } - -#if 1 < CYGPKG_NET_NLOOP - // We cheat to make different nets for multiple loopback devs - addrp->sin_addr.s_addr = netmask.s_addr = htonl(IN_CLASSC_NET); -#else - // - addrp->sin_addr.s_addr = netmask.s_addr = htonl(IN_CLASSA_NET); -#endif - if (ioctl(s, SIOCSIFNETMASK, &ifr)) { - perror("SIOCSIFNETMASK"); - return false; - } - ifr.ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; - if (ioctl(s, SIOCSIFFLAGS, &ifr)) { - perror("SIOCSIFFLAGS"); - return false; - } - - gateway.s_addr = htonl(INADDR_LOOPBACK); - memset(&route, 0, sizeof(route)); - addrp->sin_family = AF_INET; - addrp->sin_port = 0; - addrp->sin_addr.s_addr = htonl((0x100 * lo) + INADDR_LOOPBACK) & netmask.s_addr; - memcpy(&route.rt_dst, addrp, sizeof(*addrp)); - addrp->sin_addr = netmask; - memcpy(&route.rt_genmask, addrp, sizeof(*addrp)); - addrp->sin_addr = gateway; - memcpy(&route.rt_gateway, addrp, sizeof(*addrp)); - - route.rt_dev = ifr.ifr_name; - route.rt_flags = RTF_UP|RTF_GATEWAY; - route.rt_metric = 0; - - if (ioctl(s, SIOCADDRT, &route)) { - diag_printf("Route - dst: %s", inet_ntoa(((struct sockaddr_in *)&route.rt_dst)->sin_addr)); - diag_printf(", mask: %s", inet_ntoa(((struct sockaddr_in *)&route.rt_genmask)->sin_addr)); - diag_printf(", gateway: %s\n", inet_ntoa(((struct sockaddr_in *)&route.rt_gateway)->sin_addr)); - if (errno != EEXIST) { - perror("SIOCADDRT 3"); - return false; - } - } - close(s); - return true; -} -#endif -#endif - - -// -// Internal function which builds up a fake BOOTP database for -// an interface. -// - -static unsigned char * -add_tag(unsigned char *vp, - unsigned char tag, - void *val, - int len) -{ - int i; - unsigned char *xp = (unsigned char *)val; - *vp++ = tag; - *vp++ = len; - for (i = 0; i < len; i++) { - *vp++ = *xp++; - } - return vp; -} - -void -build_bootp_record(struct bootp *bp, - const char *addrs_ip, - const char *addrs_netmask, - const char *addrs_broadcast, - const char *addrs_gateway, - const char *addrs_server) -{ - int i; - in_addr_t addr; - unsigned char *vp; - unsigned char cookie[] = VM_RFC1048; - - bzero(bp, sizeof(struct bootp)); - bp->bp_op = BOOTREPLY; - bp->bp_htype = HTYPE_ETHERNET; - bp->bp_hlen = 6; - for (i = 0; i < bp->bp_hlen; i++) { - bp->bp_chaddr[i] = 0xFF; - } - bp->bp_ciaddr.s_addr = inet_addr(addrs_ip); - bp->bp_yiaddr.s_addr = inet_addr(addrs_ip); - bp->bp_siaddr.s_addr = inet_addr(addrs_server); - bp->bp_giaddr.s_addr = inet_addr(addrs_gateway); - vp = &bp->bp_vend[0]; - bcopy(&cookie, vp, sizeof(cookie)); - vp += sizeof(cookie); - addr = inet_addr(addrs_netmask); - vp = add_tag(vp, TAG_SUBNET_MASK, &addr, sizeof(in_addr_t)); - addr = inet_addr(addrs_broadcast); - vp = add_tag(vp, TAG_IP_BROADCAST, &addr, sizeof(in_addr_t)); - addr = inet_addr(addrs_gateway); - vp = add_tag(vp, TAG_GATEWAY, &addr, sizeof(in_addr_t)); - *vp = TAG_END; -} - - -// -// Initialize network interface[s] using BOOTP/DHCP -// -void -init_all_network_interfaces(void) -{ - static volatile int in_init_all_network_interfaces = 0; -#ifdef CYGPKG_IO_PCMCIA - cyg_netdevtab_entry_t *t; -#endif // CYGPKG_IO_PCMCIA - - cyg_scheduler_lock(); - while ( in_init_all_network_interfaces ) { - // Another thread is doing this... - cyg_scheduler_unlock(); - cyg_thread_delay( 10 ); - cyg_scheduler_lock(); - } - in_init_all_network_interfaces = 1; - cyg_scheduler_unlock(); - -#ifdef CYGHWR_NET_DRIVER_ETH0 - if ( ! eth0_up ) { // Make this call idempotent -#ifdef CYGPKG_IO_PCMCIA - if ((t = eth_drv_netdev("eth0")) != (cyg_netdevtab_entry_t *)NULL) { - int tries = 0; - while (t->status != CYG_NETDEVTAB_STATUS_AVAIL) { - if (tries == 0) { - diag_printf("... Waiting for PCMCIA device 'eth0'\n"); - } - if (++tries == 5) { - diag_printf("... Giving up on PCMCIA device 'eth0'\n"); - goto bail_eth0; - } - cyg_thread_delay(100); - } - } -#endif // CYGPKG_IO_PCMCIA -#ifdef CYGHWR_NET_DRIVER_ETH0_BOOTP - // Perform a complete initialization, using BOOTP/DHCP - eth0_up = true; -#ifdef CYGHWR_NET_DRIVER_ETH0_DHCP - eth0_dhcpstate = 0; // Says that initialization is external to dhcp - if (do_dhcp(eth0_name, ð0_bootp_data, ð0_dhcpstate, ð0_lease)) -#else -#ifdef CYGPKG_NET_DHCP - eth0_dhcpstate = DHCPSTATE_BOOTP_FALLBACK; - // so the dhcp machine does no harm if called -#endif - if (do_bootp(eth0_name, ð0_bootp_data)) -#endif - { -#ifdef CYGHWR_NET_DRIVER_ETH0_BOOTP_SHOW - show_bootp(eth0_name, ð0_bootp_data); -#endif - } else { - diag_printf("BOOTP/DHCP failed on eth0\n"); - eth0_up = false; - } -#elif defined(CYGHWR_NET_DRIVER_ETH0_ADDRS_IP) - eth0_up = true; - build_bootp_record(ð0_bootp_data, - string(CYGHWR_NET_DRIVER_ETH0_ADDRS_IP), - string(CYGHWR_NET_DRIVER_ETH0_ADDRS_NETMASK), - string(CYGHWR_NET_DRIVER_ETH0_ADDRS_BROADCAST), - string(CYGHWR_NET_DRIVER_ETH0_ADDRS_GATEWAY), - string(CYGHWR_NET_DRIVER_ETH0_ADDRS_SERVER)); - show_bootp(eth0_name, ð0_bootp_data); -#endif - bail_eth0: - } -#endif // CYGHWR_NET_DRIVER_ETH0 -#ifdef CYGHWR_NET_DRIVER_ETH1 - if ( ! eth1_up ) { // Make this call idempotent -#ifdef CYGPKG_IO_PCMCIA - if ((t = eth_drv_netdev("eth1")) != (cyg_netdevtab_entry_t *)NULL) { - int tries = 0; - while (t->status != CYG_NETDEVTAB_STATUS_AVAIL) { - if (tries == 0) { - diag_printf("... Waiting for PCMCIA device 'eth1'\n"); - } - if (++tries == 5) { - diag_printf("... Giving up on PCMCIA device 'eth1'\n"); - goto bail_eth1; - } - cyg_thread_delay(100); - } - } -#endif // CYGPKG_IO_PCMCIA -#ifdef CYGHWR_NET_DRIVER_ETH1_BOOTP - // Perform a complete initialization, using BOOTP/DHCP - eth1_up = true; -#ifdef CYGHWR_NET_DRIVER_ETH1_DHCP - eth1_dhcpstate = 0; // Says that initialization is external to dhcp - if (do_dhcp(eth1_name, ð1_bootp_data, ð1_dhcpstate, ð1_lease)) -#else -#ifdef CYGPKG_NET_DHCP - eth1_dhcpstate = DHCPSTATE_BOOTP_FALLBACK; - // so the dhcp machine does no harm if called -#endif - if (do_bootp(eth1_name, ð1_bootp_data)) -#endif - { -#ifdef CYGHWR_NET_DRIVER_ETH1_BOOTP_SHOW - show_bootp(eth1_name, ð1_bootp_data); -#endif - } else { - diag_printf("BOOTP/DHCP failed on eth1\n"); - eth1_up = false; - } -#elif defined(CYGHWR_NET_DRIVER_ETH1_ADDRS_IP) - eth1_up = true; - build_bootp_record(ð1_bootp_data, - string(CYGHWR_NET_DRIVER_ETH1_ADDRS_IP), - string(CYGHWR_NET_DRIVER_ETH1_ADDRS_NETMASK), - string(CYGHWR_NET_DRIVER_ETH1_ADDRS_BROADCAST), - string(CYGHWR_NET_DRIVER_ETH1_ADDRS_GATEWAY), - string(CYGHWR_NET_DRIVER_ETH1_ADDRS_SERVER)); - show_bootp(eth1_name, ð1_bootp_data); -#endif - bail_eth1: - } -#endif // CYGHWR_NET_DRIVER_ETH1 -#ifdef CYGHWR_NET_DRIVER_ETH0 -#ifndef CYGHWR_NET_DRIVER_ETH0_MANUAL - if (eth0_up) { - if (!init_net(eth0_name, ð0_bootp_data)) { - diag_printf("Network initialization failed for eth0\n"); - eth0_up = false; - } - } -#endif -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 -#ifndef CYGHWR_NET_DRIVER_ETH1_MANUAL - if (eth1_up) { - if (!init_net(eth1_name, ð1_bootp_data)) { - diag_printf("Network initialization failed for eth1\n"); - eth1_up = false; - } - } -#endif -#endif - -#ifdef CYGPKG_NET_NLOOP -#if 0 < CYGPKG_NET_NLOOP - { - static int loop_init = 0; - int i; - if ( 0 == loop_init++ ) - for ( i = 0; i < CYGPKG_NET_NLOOP; i++ ) - init_loopback_interface( i ); - } -#endif -#endif - -#ifdef CYGOPT_NET_DHCP_DHCP_THREAD - dhcp_start_dhcp_mgt_thread(); -#endif - - // Open the monitor to other threads. - in_init_all_network_interfaces = 0; - -} - -// EOF network_support.c diff --git a/packages/net/tcpip/current/src/lib/read.c b/packages/net/tcpip/current/src/lib/read.c --- a/packages/net/tcpip/current/src/lib/read.c +++ b/packages/net/tcpip/current/src/lib/read.c @@ -5,29 +5,6 @@ // read() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/recv.c b/packages/net/tcpip/current/src/lib/recv.c --- a/packages/net/tcpip/current/src/lib/recv.c +++ b/packages/net/tcpip/current/src/lib/recv.c @@ -5,29 +5,6 @@ // recv() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/recvfrom.c b/packages/net/tcpip/current/src/lib/recvfrom.c --- a/packages/net/tcpip/current/src/lib/recvfrom.c +++ b/packages/net/tcpip/current/src/lib/recvfrom.c @@ -5,29 +5,6 @@ // recvfrom() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/select.c b/packages/net/tcpip/current/src/lib/select.c --- a/packages/net/tcpip/current/src/lib/select.c +++ b/packages/net/tcpip/current/src/lib/select.c @@ -5,29 +5,6 @@ // 'select()' system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/sendto.c b/packages/net/tcpip/current/src/lib/sendto.c --- a/packages/net/tcpip/current/src/lib/sendto.c +++ b/packages/net/tcpip/current/src/lib/sendto.c @@ -5,29 +5,6 @@ // sendto() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/setsockopt.c b/packages/net/tcpip/current/src/lib/setsockopt.c --- a/packages/net/tcpip/current/src/lib/setsockopt.c +++ b/packages/net/tcpip/current/src/lib/setsockopt.c @@ -5,29 +5,6 @@ // setsockopt() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/shutdown.c b/packages/net/tcpip/current/src/lib/shutdown.c --- a/packages/net/tcpip/current/src/lib/shutdown.c +++ b/packages/net/tcpip/current/src/lib/shutdown.c @@ -5,29 +5,6 @@ // shutdown() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/socket.c b/packages/net/tcpip/current/src/lib/socket.c --- a/packages/net/tcpip/current/src/lib/socket.c +++ b/packages/net/tcpip/current/src/lib/socket.c @@ -5,29 +5,6 @@ // socket() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/lib/tftp_client.c b/packages/net/tcpip/current/src/lib/tftp_client.c deleted file mode 100644 --- a/packages/net/tcpip/current/src/lib/tftp_client.c +++ /dev/null @@ -1,421 +0,0 @@ -//========================================================================== -// -// lib/tftp_client.c -// -// TFTP client support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-04-06 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// TFTP client support - -#include -#include -#include - -#define min(x,y) (xth_opcode = htons(RRQ); // Read file - cp = (char *)&hdr->th_stuff; - fp = filename; - while (*fp) *cp++ = *fp++; - *cp++ = '\0'; - if (mode == TFTP_NETASCII) { - fp = "NETASCII"; - } else if (mode == TFTP_OCTET) { - fp = "OCTET"; - } else { - *err = TFTP_INVALID; - return -1; - } - while (*fp) *cp++ = *fp++; - *cp++ = '\0'; - server_info = getservbyname("tftp", "udp"); - if (server_info == (struct servent *)0) { - *err = TFTP_NETERR; - return -1; - } - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - // Couldn't open a communications channel - *err = TFTP_NETERR; - return -1; - } - memset((char *)&local_addr, 0, sizeof(local_addr)); - local_addr.sin_family = AF_INET; - local_addr.sin_addr.s_addr = htonl(INADDR_ANY); - local_addr.sin_port = htons(get_port++); - if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) { - // Problem setting up my end - *err = TFTP_NETERR; - close(s); - return -1; - } - memset((char *)&server_addr, 0, sizeof(server_addr)); - server_addr.sin_family = AF_INET; - server_addr.sin_addr = server->sin_addr; - if (server->sin_port == 0) { - server_addr.sin_port = server_info->s_port; // Network order already - } else { - server_addr.sin_port = server->sin_port; - } - - // Send request - if (sendto(s, data, sizeof(data), 0, - (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { - // Problem sending request - *err = TFTP_NETERR; - close(s); - return -1; - } - - // Read data - fp = buf; - while (true) { - timeout.tv_sec = TFTP_TIMEOUT_PERIOD; - timeout.tv_usec = 0; - FD_ZERO(&fds); - FD_SET(s, &fds); - if (select(s+1, &fds, 0, 0, &timeout) <= 0) { - if ((++total_timeouts > TFTP_TIMEOUT_MAX) || (last_good_block == 0)) { - // Timeout - no data received - *err = TFTP_TIMEOUT; - close(s); - return -1; - } - // Try resending last ACK - hdr->th_opcode = htons(ACK); - hdr->th_block = htons(last_good_block); - if (sendto(s, data, 4 /* FIXME */, 0, - (struct sockaddr *)&from_addr, from_len) < 0) { - // Problem sending request - *err = TFTP_NETERR; - close(s); - return -1; - } - } else { - recv_len = sizeof(data); - from_len = sizeof(from_addr); - if ((data_len = recvfrom(s, &data, recv_len, 0, - (struct sockaddr *)&from_addr, &from_len)) < 0) { - // What happened? - *err = TFTP_NETERR; - close(s); - return -1; - } - if (ntohs(hdr->th_opcode) == DATA) { - actual_len = 0; - if (ntohs(hdr->th_block) == (last_good_block+1)) { - // Consume this data - cp = hdr->th_data; - data_len -= 4; /* Sizeof TFTP header */ - actual_len = data_len; - res += actual_len; - while (data_len-- > 0) { - if (len-- > 0) { - *fp++ = *cp++; - } else { - // Buffer overflow - *err = TFTP_TOOLARGE; - close(s); - return -1; - } - } - last_good_block++; - } - // Send out the ACK - hdr->th_opcode = htons(ACK); - hdr->th_block = htons(last_good_block); - if (sendto(s, data, 4 /* FIXME */, 0, - (struct sockaddr *)&from_addr, from_len) < 0) { - // Problem sending request - *err = TFTP_NETERR; - close(s); - return -1; - } - if ((actual_len >= 0) && (actual_len < SEGSIZE)) { - // End of data - close(s); - return res; - } - } else - if (ntohs(hdr->th_opcode) == ERROR) { - *err = ntohs(hdr->th_code); - close(s); - return -1; - } else { - // What kind of packet is this? - *err = TFTP_PROTOCOL; - close(s); - return -1; - } - } - } -} - -// -// Send data to a file on a server via TFTP. -// -int -tftp_put(char *filename, - struct sockaddr_in *server, - char *buf, - int len, - int mode, - int *err) -{ - int res = 0; - int s, actual_len, data_len, recv_len, from_len; - static int put_port = 7800; - struct sockaddr_in local_addr, server_addr, from_addr; - char data[SEGSIZE+sizeof(struct tftphdr)]; - struct tftphdr *hdr = (struct tftphdr *)data; - char *cp, *fp, *sfp; - struct timeval timeout; - int last_good_block = 0; - struct servent *server_info; - fd_set fds; - int total_timeouts = 0; - - *err = 0; // Just in case - - server_info = getservbyname("tftp", "udp"); - if (server_info == (struct servent *)0) { - *err = TFTP_NETERR; - return -1; - } - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - // Couldn't open a communications channel - *err = TFTP_NETERR; - return -1; - } - memset((char *)&local_addr, 0, sizeof(local_addr)); - local_addr.sin_family = AF_INET; - local_addr.sin_addr.s_addr = htonl(INADDR_ANY); - local_addr.sin_port = htons(put_port++); - if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) { - // Problem setting up my end - *err = TFTP_NETERR; - close(s); - return -1; - } - memset((char *)&server_addr, 0, sizeof(server_addr)); - server_addr.sin_family = AF_INET; - server_addr.sin_addr = server->sin_addr; - if (server->sin_port == 0) { - server_addr.sin_port = server_info->s_port; // Network order already - } else { - server_addr.sin_port = server->sin_port; - } - - while (1) { - // Create initial request - hdr->th_opcode = htons(WRQ); // Create/write file - cp = (char *)&hdr->th_stuff; - fp = filename; - while (*fp) *cp++ = *fp++; - *cp++ = '\0'; - if (mode == TFTP_NETASCII) { - fp = "NETASCII"; - } else if (mode == TFTP_OCTET) { - fp = "OCTET"; - } else { - *err = TFTP_INVALID; - return -1; - } - while (*fp) *cp++ = *fp++; - *cp++ = '\0'; - // Send request - if (sendto(s, data, sizeof(data), 0, - (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { - // Problem sending request - *err = TFTP_NETERR; - close(s); - return -1; - } - // Wait for ACK - timeout.tv_sec = TFTP_TIMEOUT_PERIOD; - timeout.tv_usec = 0; - FD_ZERO(&fds); - FD_SET(s, &fds); - if (select(s+1, &fds, 0, 0, &timeout) <= 0) { - if (++total_timeouts > TFTP_TIMEOUT_MAX) { - // Timeout - no ACK received - *err = TFTP_TIMEOUT; - close(s); - return -1; - } - } else { - recv_len = sizeof(data); - from_len = sizeof(from_addr); - if ((data_len = recvfrom(s, &data, recv_len, 0, - (struct sockaddr *)&from_addr, &from_len)) < 0) { - // What happened? - *err = TFTP_NETERR; - close(s); - return -1; - } - if (ntohs(hdr->th_opcode) == ACK) { - // Write request accepted - start sending data - break; - } else - if (ntohs(hdr->th_opcode) == ERROR) { - *err = ntohs(hdr->th_code); - close(s); - return -1; - } else { - // What kind of packet is this? - *err = TFTP_PROTOCOL; - close(s); - return -1; - } - } - } - - // Send data - sfp = buf; - last_good_block = 1; - while (res < len) { - // Build packet of data to send - data_len = min(SEGSIZE, len-res); - hdr->th_opcode = htons(DATA); - hdr->th_block = htons(last_good_block); - cp = hdr->th_data; - fp = sfp; - actual_len = data_len + 4; - // FIXME - what about "netascii" data? - while (data_len-- > 0) *cp++ = *fp++; - // Send data packet - if (sendto(s, data, actual_len, 0, - (struct sockaddr *)&from_addr, from_len) < 0) { - // Problem sending request - *err = TFTP_NETERR; - close(s); - return -1; - } - // Wait for ACK - timeout.tv_sec = TFTP_TIMEOUT_PERIOD; - timeout.tv_usec = 0; - FD_ZERO(&fds); - FD_SET(s, &fds); - if (select(s+1, &fds, 0, 0, &timeout) <= 0) { - if (++total_timeouts > TFTP_TIMEOUT_MAX) { - // Timeout - no data received - *err = TFTP_TIMEOUT; - close(s); - return -1; - } - } else { - recv_len = sizeof(data); - from_len = sizeof(from_addr); - if ((data_len = recvfrom(s, &data, recv_len, 0, - (struct sockaddr *)&from_addr, &from_len)) < 0) { - // What happened? - *err = TFTP_NETERR; - close(s); - return -1; - } - if (ntohs(hdr->th_opcode) == ACK) { - if (ntohs(hdr->th_block) == last_good_block) { - // Advance pointers, etc - sfp = fp; - res += (actual_len - 4); - last_good_block++; - } else { - diag_printf("Send block #%d, got ACK for #%d\n", - last_good_block, ntohs(hdr->th_block)); - } - } else - if (ntohs(hdr->th_opcode) == ERROR) { - *err = ntohs(hdr->th_code); - close(s); - return -1; - } else { - // What kind of packet is this? - *err = TFTP_PROTOCOL; - close(s); - return -1; - } - } - } - close(s); - return res; -} - diff --git a/packages/net/tcpip/current/src/lib/tftp_dummy_file.c b/packages/net/tcpip/current/src/lib/tftp_dummy_file.c deleted file mode 100644 --- a/packages/net/tcpip/current/src/lib/tftp_dummy_file.c +++ /dev/null @@ -1,221 +0,0 @@ -//========================================================================== -// -// lib/tftp_dummy_file.c -// -// Dummy [in memory] file I/O functions -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-04-06 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// TFTP file support - minimal "dummy" version - -#include -#include - -static int dummy_open(const char *, int); -static int dummy_close(int); -static int dummy_write(int, const void *, int); -static int dummy_read(int, void *, int); - -struct tftpd_fileops dummy_fileops = { - dummy_open, dummy_close, dummy_write, dummy_read -}; - -struct _file_info; -struct _file { - unsigned char *pos, *eof; - int flags; - int mode; - struct _file_info *file; -}; -#define FILE_OPEN 0x0001 - -#define NUM_FILES 8 -static struct _file files[NUM_FILES]; - -struct _file_info { - char *name; - unsigned char *data; - int length, size; -}; - -// TEMP -static char _uu_data[] = "This is a test -Four score and seven years ago, -our forefathers brought forth a new nation, -conceived in liberty and dedicated to the -proposition that all men are created equal. -Now we are engaged in a great civil war, testing -whether that nation, or any nation so conceived -and so dedicated, can long endure. -1111111111111111111111111111111111 -2222222222222222222222222222222222 -3333333333333333333333333333333333 -4444444444444444444444444444444444 -5555555555555555555555555555555555 -6666666666666666666666666666666666 -"; - -static char _f0_data[1024*1024]; -static char _f1_data[1024*1024]; -static char _f2_data[1024*1024]; - -static char _name0[256] = "", _name1[256] = "", _name2[256] = ""; - -static struct _file_info file_list[] = { - { "uu", _uu_data, sizeof(_uu_data)-1, sizeof(_uu_data)-1}, - { _name0, _f0_data, 0, sizeof(_f0_data)}, // Empty file - { _name1, _f1_data, 0, sizeof(_f1_data)}, // Empty file - { _name2, _f2_data, 0, sizeof(_f2_data)}, // Empty file - { 0, 0, 0} // End of list -}; - -static inline struct _file * -dummy_fp(int fd) -{ - struct _file *fp; - if ((fd < 0) || (fd >= NUM_FILES)) return (struct _file *)0; - fp = &files[fd]; - if (!(fp->flags & FILE_OPEN)) return (struct _file *)0; - return fp; -} - -static int -dummy_open(const char *fn, int flags) -{ - int res = -1; - int fd; - struct _file *fp; - struct _file_info *fi; - - fp = files; - for (fd = 0; fd < NUM_FILES; fd++, fp++) { - if (!(fp->flags & FILE_OPEN)) break; - } - if (fd == NUM_FILES) { - return -1; // No free files - } - if (flags & O_RDONLY) { - // Search for an extant file - fi = file_list; - while (fi->name) { - if (strcmp(fi->name, fn) == 0) { - // Found it! - fp->pos = fi->data; - fp->eof = fi->data + fi->length; - fp->flags = FILE_OPEN; - fp->mode = flags; - return fd; - } - fi++; - } - } else { - // Search for a non-existant file - fi = file_list; - while (fi->name) { - if (fi->name[0] == '\0' || strcmp(fi->name, fn) == 0) { - if ( !fi->name[0] ) - // Empty slot found - strcpy(fi->name, fn); - fp->pos = fi->data; - fp->eof = fi->data + fi->size; - fp->file = fi; // So we can update file info later - fp->mode = flags; - fp->flags = FILE_OPEN; - return fd; - } - fi++; - } - } - // No such file - return res; -} - -static int -dummy_close(int fd) -{ - struct _file *fp = dummy_fp(fd); - if (!fp) return -1; - if (fp->mode & O_WRONLY) { - // Clean up - update file info for later - fp->file->length = fp->pos - fp->file->data; - } - fp->flags = 0; // No longer open - return 0; -} - -static int -dummy_write(int fd, const void *buf, int len) -{ - struct _file *fp = dummy_fp(fd); - int res; - if (!fp) return -1; - res = fp->eof - fp->pos; // Space left in file - if (res <= 0) return 0; // End of file - if (res > len) res = len; - bcopy(buf, fp->pos, res); - fp->pos += res; - return res; -} - -static int -dummy_read(int fd, void *buf, int len) -{ - struct _file *fp = dummy_fp(fd); - int res; - if (!fp) return -1; - res = fp->eof - fp->pos; // Number of bytes left in "file" - if (res > len) res = len; - if (res <= 0) return 0; // End of file - bcopy(fp->pos, buf, res); - fp->pos += res; - return res; -} - - -// EOF tftp_dummy_file.c diff --git a/packages/net/tcpip/current/src/lib/tftp_server.c b/packages/net/tcpip/current/src/lib/tftp_server.c deleted file mode 100644 --- a/packages/net/tcpip/current/src/lib/tftp_server.c +++ /dev/null @@ -1,612 +0,0 @@ -//========================================================================== -// -// lib/tftp_server.c -// -// TFTP server support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas, hmt, andrew.lunn@ascom.ch (Andrew Lunn) -// Date: 2000-04-06 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// TFTP server support - -#include // Basic networking support -#include // TFTP protocol definitions -#include // TFTPD structures -#include -#include // For malloc - -#define nCYGOPT_NET_TFTP_SERVER_INSTRUMENT -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - -struct subinfo { - int rx; - int rx_repeat; - int rx_skip; - int send; - int resend; -}; - -struct info { - struct subinfo ack, data; - int err_send; - int total_transactions; -}; - - -static struct info tftp_server_instrument = { - { 0,0,0,0,0 }, - { 0,0,0,0,0 }, - 0, 0, -}; - -#endif // CYGOPT_NET_TFTP_SERVER_INSTRUMENT - -#define STACK_SIZE (((CYGNUM_HAL_STACK_SIZE_TYPICAL+(3*(SEGSIZE+sizeof(struct tftphdr)))) + CYGARC_ALIGNMENT-1) & ~(CYGARC_ALIGNMENT-1)) -static char *TFTP_tag = "TFTPD"; -struct tftp_server { - char *tag; - char stack[STACK_SIZE]; - cyg_thread thread_data; - cyg_handle_t thread_handle; - int port; - struct tftpd_fileops *ops; -}; - -static char * errmsg[] = { - "Undefined error code", // 0 nothing defined - "File not found", // 1 TFTP_ENOTFOUND - "Access violation", // 2 TFTP_EACCESS - "Disk full or allocation exceeded", // 3 TFTP_ENOSPACE - "Illegal TFTP operation", // 4 TFTP_EBADOP - "Unknown transfer ID", // 5 TFTP_EBADID - "File already exists", // 6 TFTP_EEXISTS - "No such user", // 7 TFTP_ENOUSER -}; - -/* Send an error packet to the client */ -static void -tftpd_send_error(int s, struct tftphdr * reply, int err, - struct sockaddr_in *from_addr, int from_len) -{ - CYG_ASSERT( 0 <= err, "err underflow" ); - CYG_ASSERT( sizeof(errmsg)/sizeof(errmsg[0]) > err, "err overflow" ); - - reply->th_opcode = htons(ERROR); - reply->th_code = htons(err); - if ( (0 > err) || (sizeof(errmsg)/sizeof(errmsg[0]) <= err) ) - err = 0; // Do not copy a random string from hyperspace - strcpy(reply->th_msg, errmsg[err]); - sendto(s, reply, 4+strlen(reply->th_msg)+1, 0, - (struct sockaddr *)from_addr, from_len); -} - -// -// Receive a file from the client -// -static void -tftpd_write_file(struct tftp_server *server, - struct tftphdr *hdr, - struct sockaddr_in *from_addr, int from_len) -{ - char data_out[SEGSIZE+sizeof(struct tftphdr)]; - char data_in[SEGSIZE+sizeof(struct tftphdr)]; - struct tftphdr *reply = (struct tftphdr *)data_out; - struct tftphdr *response = (struct tftphdr *)data_in; - int fd, block, len, ok, tries, closed, data_len, s; - struct timeval timeout; - fd_set fds; - int total_timeouts = 0; - struct sockaddr_in client_addr, local_addr; - int client_len; - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - diag_printf("TFTPD: can't open socket for 'write_file'\n"); - return; - } - memset((char *)&local_addr, 0, sizeof(local_addr)); - local_addr.sin_family = AF_INET; - local_addr.sin_addr.s_addr = htonl(INADDR_ANY); - local_addr.sin_port = htons(INADDR_ANY); - if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) { - // Problem setting up my end - diag_printf("TFTPD: can't bind to reply port for 'write_file'\n"); - close(s); - return; - } - if ((fd = (server->ops->open)(hdr->th_stuff, O_WRONLY)) < 0) { - tftpd_send_error(s,reply,TFTP_ENOTFOUND,from_addr, from_len); - close(s); - return; - } - ok = true; - closed = false; - block = 0; - while (ok) { - // Send ACK telling client he can send data - reply->th_opcode = htons(ACK); - reply->th_block = htons(block++); // postincrement - for (tries = 0; tries < TFTP_RETRIES_MAX; tries++) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.ack.send++; -#endif - sendto(s, reply, 4, 0, (struct sockaddr *)from_addr, from_len); - repeat_select: - timeout.tv_sec = TFTP_TIMEOUT_PERIOD; - timeout.tv_usec = 0; - FD_ZERO(&fds); - FD_SET(s, &fds); - if (select(s+1, &fds, 0, 0, &timeout) <= 0) { - if (++total_timeouts > TFTP_TIMEOUT_MAX) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.err_send++; -#endif - tftpd_send_error(s,reply,TFTP_EBADOP,from_addr, from_len); - ok = false; - break; - } -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.ack.resend++; -#endif - continue; // retry the send, using up one retry. - } - // Some data has arrived - data_len = sizeof(data_in); - client_len = sizeof(client_addr); - if ((data_len = recvfrom(s, data_in, data_len, 0, - (struct sockaddr *)&client_addr, &client_len)) < 0) { - // What happened? No data here! -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.ack.resend++; -#endif - continue; // retry the send, using up one retry. - } - if (ntohs(response->th_opcode) == DATA && - ntohs(response->th_block) < block) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.data.rx_repeat++; -#endif - // Then it is repeat DATA with an old block; listen again, - // but do not repeat sending the current ack, and do not - // use up a retry count. (we do re-send the ack if - // subsequently we time out) - goto repeat_select; - } - if (ntohs(response->th_opcode) == DATA && - ntohs(response->th_block) == block) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.data.rx++; -#endif - // Good data - write to file - len = (server->ops->write)(fd, response->th_data, data_len-4); - if (len < (data_len-4)) { - // File is "full" - tftpd_send_error(s,reply,TFTP_ENOSPACE, - from_addr, from_len); - ok = false; // Give up - break; // out of the retries loop - } - if (data_len < (SEGSIZE+4)) { - // End of file - closed = true; - ok = false; - if ((server->ops->close)(fd) == -1) { - tftpd_send_error(s,reply,TFTP_EACCESS, - from_addr, from_len); - break; // out of the retries loop - } - // Exception to the loop structure: we must ACK the last - // packet, the one that implied EOF: -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.ack.send++; -#endif - reply->th_opcode = htons(ACK); - reply->th_block = htons(block++); // postincrement - sendto(s, reply, 4, 0, (struct sockaddr *)from_addr, from_len); - break; // out of the retries loop - } - // Happy! Break out of the retries loop. - break; - } - // Otherwise, we got something we do not understand! So repeat - // sending the current ACK, and use up a retry count. -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - if ( (ntohs(response->th_opcode) == DATA) ) - tftp_server_instrument.data.rx_skip++; - tftp_server_instrument.ack.resend++; -#endif - } // End of the retries loop. - if (TFTP_RETRIES_MAX <= tries) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.err_send++; -#endif - tftpd_send_error(s,reply,TFTP_EBADOP,from_addr, from_len); - ok = false; - } - } - close(s); - if (!closed) { - (server->ops->close)(fd); - } -} - -// -// Send a file to the client -// -static void -tftpd_read_file(struct tftp_server *server, - struct tftphdr *hdr, - struct sockaddr_in *from_addr, int from_len) -{ - char data_out[SEGSIZE+sizeof(struct tftphdr)]; - char data_in[SEGSIZE+sizeof(struct tftphdr)]; - struct tftphdr *reply = (struct tftphdr *)data_out; - struct tftphdr *response = (struct tftphdr *)data_in; - int fd, block, len, tries, ok, data_len, s; - struct timeval timeout; - fd_set fds; - int total_timeouts = 0; - struct sockaddr_in client_addr, local_addr; - int client_len; - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - diag_printf("TFTPD: can't open socket for 'read_file'\n"); - return; - } - memset((char *)&local_addr, 0, sizeof(local_addr)); - local_addr.sin_family = AF_INET; - local_addr.sin_addr.s_addr = htonl(INADDR_ANY); - local_addr.sin_port = htons(INADDR_ANY); - if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) { - // Problem setting up my end - diag_printf("TFTPD: can't bind to reply port for 'read_file'\n"); - close(s); - return; - } - if ((fd = (server->ops->open)(hdr->th_stuff, O_RDONLY)) < 0) { - tftpd_send_error(s,reply,TFTP_ENOTFOUND,from_addr, from_len); - close(s); - return; - } - block = 0; - ok = true; - while (ok) { - // Read next chunk of file - len = (server->ops->read)(fd, reply->th_data, SEGSIZE); - reply->th_block = htons(++block); // preincrement - reply->th_opcode = htons(DATA); - for (tries = 0; tries < TFTP_RETRIES_MAX; tries++) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.data.send++; -#endif - if (sendto(s, reply, 4+len, 0, - (struct sockaddr *)from_addr, from_len) < 0) { - // Something went wrong with the network! - ok = false; - break; - } - repeat_select: - timeout.tv_sec = TFTP_TIMEOUT_PERIOD; - timeout.tv_usec = 0; - FD_ZERO(&fds); - FD_SET(s, &fds); - if (select(s+1, &fds, 0, 0, &timeout) <= 0) { - if (++total_timeouts > TFTP_TIMEOUT_MAX) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.err_send++; -#endif - tftpd_send_error(s,reply,TFTP_EBADOP,from_addr, from_len); - ok = false; - break; - } -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.data.resend++; -#endif - continue; // retry the send, using up one retry. - } - data_len = sizeof(data_in); - client_len = sizeof(client_addr); - if ((data_len = recvfrom(s, data_in, data_len, 0, - (struct sockaddr *)&client_addr, - &client_len)) < 0) { - // What happened? Maybe someone lied to us... -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.data.resend++; -#endif - continue; // retry the send, using up one retry. - } - if ((ntohs(response->th_opcode) == ACK) && - (ntohs(response->th_block) < block)) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.ack.rx_repeat++; -#endif - // Then it is a repeat ACK for an old block; listen again, - // but do not repeat sending the current block, and do not - // use up a retry count. (we do re-send the data if - // subsequently we time out) - goto repeat_select; - } - if ((ntohs(response->th_opcode) == ACK) && - (ntohs(response->th_block) == block)) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.ack.rx++; -#endif - // Happy! Break out of the retries loop. - break; - } - // Otherwise, we got something we do not understand! So repeat - // sending the current block, and use up a retry count. -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - if ( (ntohs(response->th_opcode) == ACK) ) - tftp_server_instrument.ack.rx_skip++; - tftp_server_instrument.data.resend++; -#endif - } // End of the retries loop. - if (TFTP_RETRIES_MAX <= tries) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.err_send++; -#endif - tftpd_send_error(s,reply,TFTP_EBADOP,from_addr, from_len); - ok = false; - } - if (len < SEGSIZE) { - break; // That's end of file then. - } - } - close(s); - (server->ops->close)(fd); -} - -// -// Actual TFTP server -// -#define CYGSEM_TFTP_SERVER_MULTITHREADED -#ifdef CYGSEM_TFTP_SERVER_MULTITHREADED -static cyg_sem_t tftp_server_sem; -#endif - -static void -tftpd_server(cyg_addrword_t p) -{ - struct tftp_server *server = (struct tftp_server *)p; - int s; - int data_len, recv_len, from_len; - struct sockaddr_in local_addr, from_addr; - struct servent *server_info; - char data[SEGSIZE+sizeof(struct tftphdr)]; - struct tftphdr *hdr = (struct tftphdr *)data; - -#ifndef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS -#ifndef CYGPKG_NET_AUTOTEST // cut the chatter if automated testing - // Otherwise routine printfs fail the test - interrupts disabled too long. - diag_printf("TFTPD [%x]: port %d\n", p, server->port); -#endif // !CYGPKG_NET_AUTOTEST -#endif - - // Set up port - if (server->port == 0) { - server_info = getservbyname("tftp", "udp"); - if (server_info == (struct servent *)0) { - diag_printf("TFTPD: can't get TFTP service information\n"); - return; - } - // Network order in info; host order in server: - server->port = ntohs( server_info->s_port ); - } - - while (true) { -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - struct info o = tftp_server_instrument; -#endif - // Create socket - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - diag_printf("TFTPD [%x]: can't open socket\n", p); - return; - } - memset((char *)&local_addr, 0, sizeof(local_addr)); - local_addr.sin_family = AF_INET; - local_addr.sin_addr.s_addr = htonl(INADDR_ANY); - local_addr.sin_port = htons(server->port); - if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) { - // Problem setting up my end - close(s); -#ifdef CYGSEM_TFTP_SERVER_MULTITHREADED -#ifndef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS -#ifndef CYGPKG_NET_AUTOTEST // cut the chatter if automated testing - diag_printf("TFTPD [%x]: waiting to bind to service port\n", p); -#endif // !CYGPKG_NET_AUTOTEST -#endif - // Wait until the socket is free... - cyg_semaphore_wait( &tftp_server_sem ); - continue; // try re-opening and rebinding the socket. -#else - diag_printf("TFTPD [%x]: can't bind to service port\n", p); - return; -#endif - } - - recv_len = sizeof(data); - from_len = sizeof(from_addr); - data_len = recvfrom(s, hdr, recv_len, 0, - (struct sockaddr *)&from_addr, &from_len); - close(s); // so that other servers can bind to the TFTP socket -#ifdef CYGSEM_TFTP_SERVER_MULTITHREADED - // The socket is free... - cyg_semaphore_post( &tftp_server_sem ); -#endif - - if ( data_len < 0) { - diag_printf("TFTPD [%x]: can't read request\n", p); - } else { -#ifndef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS -#ifndef CYGPKG_NET_AUTOTEST // cut the chatter if automated testing - diag_printf("TFTPD [%x]: received %x from %s:%d\n", p, - ntohs(hdr->th_opcode), inet_ntoa(from_addr.sin_addr), - from_addr.sin_port); -#endif // !CYGPKG_NET_AUTOTEST -#endif - switch (ntohs(hdr->th_opcode)) { - case WRQ: - tftpd_write_file(server, hdr, &from_addr, from_len); - break; - case RRQ: - tftpd_read_file(server, hdr, &from_addr, from_len); - break; - case ACK: - case DATA: - case ERROR: - // Ignore - break; - default: - diag_printf("TFTPD [%x]: bogus request %x from %s:%d\n", p, - ntohs(hdr->th_opcode), - inet_ntoa(from_addr.sin_addr), - from_addr.sin_port ); - tftpd_send_error(s,hdr,TFTP_EBADOP,&from_addr,from_len); - } - } -#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT - tftp_server_instrument.total_transactions++; - - o.data.rx -= tftp_server_instrument.data.rx ; - o.data.rx_repeat -= tftp_server_instrument.data.rx_repeat; - o.data.rx_skip -= tftp_server_instrument.data.rx_skip ; - o.data.send -= tftp_server_instrument.data.send ; - o.data.resend -= tftp_server_instrument.data.resend ; - - o.ack.rx -= tftp_server_instrument.ack.rx ; - o.ack.rx_repeat -= tftp_server_instrument.ack.rx_repeat ; - o.ack.rx_skip -= tftp_server_instrument.ack.rx_skip ; - o.ack.send -= tftp_server_instrument.ack.send ; - o.ack.resend -= tftp_server_instrument.ack.resend ; - - o.err_send -= tftp_server_instrument.err_send ; - -#ifndef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS - if ( o.data.rx ) diag_printf( "data rx %4d\n", -o.data.rx ); - if ( o.data.rx_repeat ) diag_printf( "data rx_repeat%4d\n", -o.data.rx_repeat ); - if ( o.data.rx_skip ) diag_printf( "data rx_skip %4d\n", -o.data.rx_skip ); - if ( o.data.send ) diag_printf( "data send %4d\n", -o.data.send ); - if ( o.data.resend ) diag_printf( "data resend %4d\n", -o.data.resend ); - - if ( o.ack.rx ) diag_printf( " ack rx %4d\n", -o.ack.rx ); - if ( o.ack.rx_repeat ) diag_printf( " ack rx_repeat%4d\n", -o.ack.rx_repeat ); - if ( o.ack.rx_skip ) diag_printf( " ack rx_skip %4d\n", -o.ack.rx_skip ); - if ( o.ack.send ) diag_printf( " ack send %4d\n", -o.ack.send ); - if ( o.ack.resend ) diag_printf( " ack resend %4d\n", -o.ack.resend ); - - if ( o.err_send ) diag_printf( "*error sends %4d\n", -o.err_send ); -#endif // CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS -#endif // CYGOPT_NET_TFTP_SERVER_INSTRUMENT - } -} - -// -// This function is used to create a new server [thread] which supports -// the TFTP protocol on the given port. A server 'id' will be returned -// which can later be used to destroy the server. -// -// Note: all [memory] resources for the server thread will be allocated -// dynamically. If there are insufficient resources, an error will be -// returned. -// -int -tftpd_start(int port, struct tftpd_fileops *ops) -{ - struct tftp_server *server; -#ifdef CYGSEM_TFTP_SERVER_MULTITHREADED - static char init = 0; - if ( 0 == init ) { - init++; - cyg_semaphore_init( &tftp_server_sem, 0 ); - } -#endif - - if ((server = malloc(sizeof(struct tftp_server)))) { - server->tag = TFTP_tag; - server->port = port; - server->ops = ops; - cyg_thread_create(CYGPKG_NET_TFTPD_THREAD_PRIORITY, // Priority - tftpd_server, // entry - (cyg_addrword_t)server, // entry parameter - "TFTP server", // Name - &server->stack[0], // Stack - STACK_SIZE, // Size - &server->thread_handle, // Handle - &server->thread_data // Thread data structure - ); - cyg_thread_resume(server->thread_handle); // Start it - - } - return (int)server; -} - -// -// Destroy a TFTP server, using a previously created server 'id'. -// -int -tftpd_stop(int p) -{ - struct tftp_server *server = (struct tftp_server *)p; - // Simple sanity check - if (server->tag == TFTP_tag) { - cyg_thread_kill(server->thread_handle); - cyg_thread_set_priority(server->thread_handle, 0); - cyg_thread_delay(1); // Make sure it gets to die... - if (cyg_thread_delete(server->thread_handle)) { - // Success shutting down the thread - free(server); // Give up memory - return 1; - } - } - return 0; -} - -// EOF tftp_server.c diff --git a/packages/net/tcpip/current/src/lib/write.c b/packages/net/tcpip/current/src/lib/write.c --- a/packages/net/tcpip/current/src/lib/write.c +++ b/packages/net/tcpip/current/src/lib/write.c @@ -5,29 +5,6 @@ // write() system call // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/kern/kern_subr.c b/packages/net/tcpip/current/src/sys/kern/kern_subr.c --- a/packages/net/tcpip/current/src/sys/kern/kern_subr.c +++ b/packages/net/tcpip/current/src/sys/kern/kern_subr.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/kern/sockio.c b/packages/net/tcpip/current/src/sys/kern/sockio.c --- a/packages/net/tcpip/current/src/sys/kern/sockio.c +++ b/packages/net/tcpip/current/src/sys/kern/sockio.c @@ -5,29 +5,6 @@ // Socket interface to Fileio subsystem // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -146,8 +123,8 @@ static int bsd_select (struct CYG_FIL static int bsd_fsync (struct CYG_FILE_TAG *fp, int mode ); static int bsd_close (struct CYG_FILE_TAG *fp); static int bsd_fstat (struct CYG_FILE_TAG *fp, struct stat *buf ); -static int bsd_getinfo (struct CYG_FILE_TAG *fp, int key, char *buf, int len ); -static int bsd_setinfo (struct CYG_FILE_TAG *fp, int key, char *buf, int len ); +static int bsd_getinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ); +static int bsd_setinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ); static int bsd_recvit(cyg_file *fp, struct msghdr *mp, socklen_t *namelenp, ssize_t *retsize); @@ -675,14 +652,14 @@ static int bsd_fstat (struct CYG_FIL // ------------------------------------------------------------------------- -static int bsd_getinfo (struct CYG_FILE_TAG *fp, int key, char *buf, int len ) +static int bsd_getinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ) { return ENOSYS; } // ------------------------------------------------------------------------- -static int bsd_setinfo (struct CYG_FILE_TAG *fp, int key, char *buf, int len ) +static int bsd_setinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ) { return ENOSYS; } diff --git a/packages/net/tcpip/current/src/sys/kern/sys_generic.c b/packages/net/tcpip/current/src/sys/kern/sys_generic.c --- a/packages/net/tcpip/current/src/sys/kern/sys_generic.c +++ b/packages/net/tcpip/current/src/sys/kern/sys_generic.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/kern/sys_socket.c b/packages/net/tcpip/current/src/sys/kern/sys_socket.c --- a/packages/net/tcpip/current/src/sys/kern/sys_socket.c +++ b/packages/net/tcpip/current/src/sys/kern/sys_socket.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/kern/uipc_domain.c b/packages/net/tcpip/current/src/sys/kern/uipc_domain.c --- a/packages/net/tcpip/current/src/sys/kern/uipc_domain.c +++ b/packages/net/tcpip/current/src/sys/kern/uipc_domain.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/kern/uipc_mbuf.c b/packages/net/tcpip/current/src/sys/kern/uipc_mbuf.c --- a/packages/net/tcpip/current/src/sys/kern/uipc_mbuf.c +++ b/packages/net/tcpip/current/src/sys/kern/uipc_mbuf.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -143,6 +120,39 @@ extern void setsoftnet(void); extern void *cyg_net_cluster_alloc(void); #endif +/* Declarations of variables move from mbuf.h to keep g++ happy */ +#ifdef __ECOS +struct mbstat mbstat; +union mcluster *mclfree; +int max_linkhdr; /* largest link-level header */ +int max_protohdr; /* largest protocol header */ +int max_hdr; /* largest link+protocol header */ +int max_datalen; /* MHLEN - max_hdr */ +#ifdef MBTYPES +int mbtypes[] = { /* XXX */ + M_FREE, /* MT_FREE 0 should be on free list */ + M_MBUF, /* MT_DATA 1 dynamic (data) allocation */ + M_MBUF, /* MT_HEADER 2 packet header */ + M_SOCKET, /* MT_SOCKET 3 socket structure */ + M_PCB, /* MT_PCB 4 protocol control block */ + M_RTABLE, /* MT_RTABLE 5 routing tables */ + M_HTABLE, /* MT_HTABLE 6 IMP host tables */ + 0, /* MT_ATABLE 7 address resolution tables */ + M_MBUF, /* MT_SONAME 8 socket name */ + 0, /* 9 */ + M_SOOPTS, /* MT_SOOPTS 10 socket options */ + M_FTABLE, /* MT_FTABLE 11 fragment reassembly header */ + M_MBUF, /* MT_RIGHTS 12 access rights */ + M_IFADDR, /* MT_IFADDR 13 interface address */ + M_MBUF, /* MT_CONTROL 14 extra-data protocol message */ + M_MBUF, /* MT_OOBDATA 15 expedited data */ +#ifdef DATAKIT + 25, 26, 27, 28, 29, 30, 31, 32 /* datakit ugliness */ +#endif +}; +#endif +#endif // __ECOS + void mbinit() { diff --git a/packages/net/tcpip/current/src/sys/kern/uipc_proto.c b/packages/net/tcpip/current/src/sys/kern/uipc_proto.c --- a/packages/net/tcpip/current/src/sys/kern/uipc_proto.c +++ b/packages/net/tcpip/current/src/sys/kern/uipc_proto.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/kern/uipc_socket.c b/packages/net/tcpip/current/src/sys/kern/uipc_socket.c --- a/packages/net/tcpip/current/src/sys/kern/uipc_socket.c +++ b/packages/net/tcpip/current/src/sys/kern/uipc_socket.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/kern/uipc_socket2.c b/packages/net/tcpip/current/src/sys/kern/uipc_socket2.c --- a/packages/net/tcpip/current/src/sys/kern/uipc_socket2.c +++ b/packages/net/tcpip/current/src/sys/kern/uipc_socket2.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -378,7 +355,7 @@ sb_lock(sb) int sblock(struct sockbuf *sb, int wf) { - int flags, res; + int res; cyg_scheduler_safe_lock(); if (sb->sb_flags & SB_LOCK) { // Already locked by another thread diff --git a/packages/net/tcpip/current/src/sys/kern/uipc_syscalls.c b/packages/net/tcpip/current/src/sys/kern/uipc_syscalls.c --- a/packages/net/tcpip/current/src/sys/kern/uipc_syscalls.c +++ b/packages/net/tcpip/current/src/sys/kern/uipc_syscalls.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/net/if.c b/packages/net/tcpip/current/src/sys/net/if.c --- a/packages/net/tcpip/current/src/sys/net/if.c +++ b/packages/net/tcpip/current/src/sys/net/if.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/net/if_bridge.c b/packages/net/tcpip/current/src/sys/net/if_bridge.c --- a/packages/net/tcpip/current/src/sys/net/if_bridge.c +++ b/packages/net/tcpip/current/src/sys/net/if_bridge.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/net/if_ethersubr.c b/packages/net/tcpip/current/src/sys/net/if_ethersubr.c --- a/packages/net/tcpip/current/src/sys/net/if_ethersubr.c +++ b/packages/net/tcpip/current/src/sys/net/if_ethersubr.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -631,6 +608,9 @@ ether_input(ifp, eh, m) int s, llcfound = 0; register struct llc *l; struct arpcom *ac = (struct arpcom *)ifp; +#ifdef __ECOS + unsigned int sched_what; +#endif if ((ifp->if_flags & IFF_UP) == 0) { m_freem(m); @@ -681,14 +661,22 @@ decapsulate: switch (etype) { #ifdef INET case ETHERTYPE_IP: +#ifdef __ECOS + sched_what = NETISR_IP; +#else schednetisr(NETISR_IP); +#endif inq = &ipintrq; break; case ETHERTYPE_ARP: if (ifp->if_flags & IFF_NOARP) goto dropanyway; +#ifdef __ECOS + sched_what = NETISR_ARP; +#else schednetisr(NETISR_ARP); +#endif inq = &arpintrq; break; @@ -704,25 +692,41 @@ decapsulate: * Schedule IPv6 software interrupt for incoming IPv6 packet. */ case ETHERTYPE_IPV6: +#ifdef __ECOS + sched_what = NETISR_IPV6; +#else schednetisr(NETISR_IPV6); +#endif inq = &ip6intrq; break; #endif /* INET6 */ #ifdef IPX case ETHERTYPE_IPX: +#ifdef __ECOS + sched_what = NETISR_IPX; +#else schednetisr(NETISR_IPX); +#endif inq = &ipxintrq; break; #endif #ifdef NS case ETHERTYPE_NS: +#ifdef __ECOS + sched_what = NETISR_NS; +#else schednetisr(NETISR_NS); +#endif inq = &nsintrq; break; #endif #ifdef NETATALK case ETHERTYPE_AT: +#ifdef __ECOS + sched_what = NETISR_ATALK; +#else schednetisr(NETISR_ATALK); +#endif inq = &atintrq1; break; case ETHERTYPE_AARP: @@ -753,7 +757,11 @@ decapsulate: ntohs(l->llc_snap_ether_type) == ETHERTYPE_AT) { inq = &atintrq2; m_adj(m, AT_LLC_SIZE); +#ifdef __ECOS + sched_what = NETISR_ATALK; +#else schednetisr(NETISR_ATALK); +#endif break; } @@ -805,7 +813,11 @@ decapsulate: if (argo_debug[D_ETHER]) printf("clnp packet"); #endif +#ifdef __ECOS + sched_what = NETISR_ISO; +#else schednetisr(NETISR_ISO); +#endif inq = &clnlintrq; break; } @@ -863,7 +875,11 @@ decapsulate: #ifdef LLC_DEBUG printf("llc packet\n"); #endif /* LLC_DEBUG */ +#ifdef __ECOS + sched_what = NETISR_CCITT; +#else schednetisr(NETISR_CCITT); +#endif inq = &llcintrq; break; #endif /* CCITT */ @@ -881,6 +897,9 @@ decapsulate: } else IF_ENQUEUE(inq, m); splx(s); +#ifdef __ECOS + schednetisr(sched_what); +#endif } /* diff --git a/packages/net/tcpip/current/src/sys/net/if_loop.c b/packages/net/tcpip/current/src/sys/net/if_loop.c --- a/packages/net/tcpip/current/src/sys/net/if_loop.c +++ b/packages/net/tcpip/current/src/sys/net/if_loop.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -376,7 +353,7 @@ looutput(ifp, m, dst, rt) ifq = &atintrq2; isr = NETISR_ATALK; break; -#endif NETATALK +#endif default: #ifdef __ECOS diag_printf("%s: can't handle af%d\n", ifp->if_xname, diff --git a/packages/net/tcpip/current/src/sys/net/radix.c b/packages/net/tcpip/current/src/sys/net/radix.c --- a/packages/net/tcpip/current/src/sys/net/radix.c +++ b/packages/net/tcpip/current/src/sys/net/radix.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/net/raw_cb.c b/packages/net/tcpip/current/src/sys/net/raw_cb.c --- a/packages/net/tcpip/current/src/sys/net/raw_cb.c +++ b/packages/net/tcpip/current/src/sys/net/raw_cb.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/net/raw_usrreq.c b/packages/net/tcpip/current/src/sys/net/raw_usrreq.c --- a/packages/net/tcpip/current/src/sys/net/raw_usrreq.c +++ b/packages/net/tcpip/current/src/sys/net/raw_usrreq.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/net/route.c b/packages/net/tcpip/current/src/sys/net/route.c --- a/packages/net/tcpip/current/src/sys/net/route.c +++ b/packages/net/tcpip/current/src/sys/net/route.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -206,15 +183,30 @@ route_init() // incredibly sticky, i.e. can't be deleted. BOOTP uses this to // achieve a generic broadcast. Sadly it seems that BOOTP servers will // only work this way, thus the hack. +// +// This version enumerates all routes and deletes them - this leaks less +// store than the previous version. + +static int +rt_reinit_rtdelete( struct radix_node *rn, void *vifp ) +{ + struct rtentry *rt = (struct rtentry *)rn; + rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt), + 0, NULL); + return (0); +} + void -route_reinit(void) +cyg_route_reinit(void) { int i; for (i = 0; i < AF_MAX+1; i++) { - rt_tables[i] = NULL; + struct radix_node_head *rnh; + rnh = rt_tables[i]; + if (rnh) { + (*rnh->rnh_walktree)(rnh, rt_reinit_rtdelete, NULL); + } } - rn_init(); /* initialize all zeroes, all ones, mask table */ - rtable_init((void **)rt_tables); } void @@ -489,7 +481,6 @@ rtioctl(req, data, p) { #ifdef __ECOS struct ecos_rtentry *rt; - struct rtentry *rt_res = 0; int res; switch (req) { @@ -500,7 +491,7 @@ rtioctl(req, data, p) &rt->rt_gateway, &rt->rt_genmask, rt->rt_flags, - &rt_res); + NULL); return (res); case SIOCDELRT: rt = (struct ecos_rtentry *)data; @@ -509,7 +500,7 @@ rtioctl(req, data, p) &rt->rt_gateway, &rt->rt_genmask, rt->rt_flags, - &rt_res); + NULL); return (res); default: return (EOPNOTSUPP); @@ -626,8 +617,12 @@ rtrequest(req, dst, gateway, netmask, fl rt = (struct rtentry *)rn; rt->rt_flags &= ~RTF_UP; if (rt->rt_gwroute) { - rt = rt->rt_gwroute; RTFREE(rt); - (rt = (struct rtentry *)rn)->rt_gwroute = NULL; + if (rt != rt->rt_gwroute) + RTFREE( rt->rt_gwroute ); // Free it up as normal + else + rt->rt_refcnt--; // Just dec the refcount - freeing + // it here would be premature + rt->rt_gwroute = NULL; } if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest) ifa->ifa_rtrequest(RTM_DELETE, rt, SA(NULL)); diff --git a/packages/net/tcpip/current/src/sys/net/rtsock.c b/packages/net/tcpip/current/src/sys/net/rtsock.c --- a/packages/net/tcpip/current/src/sys/net/rtsock.c +++ b/packages/net/tcpip/current/src/sys/net/rtsock.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/netinet/if_ether.c b/packages/net/tcpip/current/src/sys/netinet/if_ether.c --- a/packages/net/tcpip/current/src/sys/netinet/if_ether.c +++ b/packages/net/tcpip/current/src/sys/netinet/if_ether.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/netinet/igmp.c b/packages/net/tcpip/current/src/sys/netinet/igmp.c --- a/packages/net/tcpip/current/src/sys/netinet/igmp.c +++ b/packages/net/tcpip/current/src/sys/netinet/igmp.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/netinet/in.c b/packages/net/tcpip/current/src/sys/netinet/in.c --- a/packages/net/tcpip/current/src/sys/netinet/in.c +++ b/packages/net/tcpip/current/src/sys/netinet/in.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -294,6 +271,10 @@ in_control(so, cmd, data, ifp) case SIOCAIFADDR: case SIOCDIFADDR: + + case SIOCSIFADDR: // Moved from after this search, otherwise repeated + // identical SIOCSIFADDRs leaked the previously allocated record. + if (ifra->ifra_addr.sin_family == AF_INET) for (; ia != 0; ia = ia->ia_list.tqe_next) { if (ia->ia_ifp == ifp && @@ -304,7 +285,6 @@ in_control(so, cmd, data, ifp) if (cmd == SIOCDIFADDR && ia == 0) return (EADDRNOTAVAIL); /* FALLTHROUGH */ - case SIOCSIFADDR: case SIOCSIFNETMASK: case SIOCSIFDSTADDR: if ((so->so_state & SS_PRIV) == 0) @@ -314,7 +294,7 @@ in_control(so, cmd, data, ifp) panic("in_control"); if (ia == (struct in_ifaddr *)0) { ia = (struct in_ifaddr *) - malloc(sizeof *ia, M_IFADDR, M_WAITOK); + malloc(sizeof *ia, M_IFADDR, M_WAITOK); // This alloc was leaked if (ia == (struct in_ifaddr *)0) return (ENOBUFS); bzero((caddr_t)ia, sizeof *ia); diff --git a/packages/net/tcpip/current/src/sys/netinet/in_cksum.c b/packages/net/tcpip/current/src/sys/netinet/in_cksum.c --- a/packages/net/tcpip/current/src/sys/netinet/in_cksum.c +++ b/packages/net/tcpip/current/src/sys/netinet/in_cksum.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/netinet/in_pcb.c b/packages/net/tcpip/current/src/sys/netinet/in_pcb.c --- a/packages/net/tcpip/current/src/sys/netinet/in_pcb.c +++ b/packages/net/tcpip/current/src/sys/netinet/in_pcb.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/netinet/in_proto.c b/packages/net/tcpip/current/src/sys/netinet/in_proto.c --- a/packages/net/tcpip/current/src/sys/netinet/in_proto.c +++ b/packages/net/tcpip/current/src/sys/netinet/in_proto.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/netinet/ip_icmp.c b/packages/net/tcpip/current/src/sys/netinet/ip_icmp.c --- a/packages/net/tcpip/current/src/sys/netinet/ip_icmp.c +++ b/packages/net/tcpip/current/src/sys/netinet/ip_icmp.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/netinet/ip_id.c b/packages/net/tcpip/current/src/sys/netinet/ip_id.c --- a/packages/net/tcpip/current/src/sys/netinet/ip_id.c +++ b/packages/net/tcpip/current/src/sys/netinet/ip_id.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/netinet/ip_input.c b/packages/net/tcpip/current/src/sys/netinet/ip_input.c --- a/packages/net/tcpip/current/src/sys/netinet/ip_input.c +++ b/packages/net/tcpip/current/src/sys/netinet/ip_input.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -183,6 +160,7 @@ u_char ip_protox[IPPROTO_MAX]; int ipqmaxlen = IFQ_MAXLEN; struct in_ifaddrhead in_ifaddr; struct ifqueue ipintrq; +struct ipstat ipstat; #if defined(IPFILTER) || defined(IPFILTER_LKM) int (*fr_checkp) __P((struct ip *, int, struct ifnet *, int, struct mbuf **)); @@ -219,6 +197,8 @@ ipq_unlock() splx(s); } +#if 0 // Now in common layer + static char *ui8tod( cyg_uint8 n, char *p ) { if( n > 99 ) *p++ = (n/100) + '0'; @@ -249,6 +229,7 @@ inet_ntoa(ina) return (buf); } +#endif /* * We need to save the IP options in case a protocol wants to respond diff --git a/packages/net/tcpip/current/src/sys/netinet/ip_output.c b/packages/net/tcpip/current/src/sys/netinet/ip_output.c --- a/packages/net/tcpip/current/src/sys/netinet/ip_output.c +++ b/packages/net/tcpip/current/src/sys/netinet/ip_output.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -161,6 +138,10 @@ extern int ipsec_esp_network_default_lev extern int pfkeyv2_acquire(struct tdb *, int); #endif +#ifndef RAMDOM_IP_ID +u_short ip_id; +#endif + /* * IP output. The packet in mbuf chain m contains a skeletal IP * header (with len, off, ttl, proto, tos, src, dst). @@ -232,8 +213,11 @@ ip_output(m0, va_alist) if ((flags & (IP_FORWARDING|IP_RAWOUTPUT)) == 0) { ip->ip_v = IPVERSION; ip->ip_off &= IP_DF; +#ifdef RANDOM_IP_ID ip->ip_id = ip_randomid(); - HTONS(ip->ip_id); +#else + ip->ip_id = htons(ip_id++); +#endif ip->ip_hl = hlen >> 2; ipstat.ips_localout++; } else { diff --git a/packages/net/tcpip/current/src/sys/netinet/raw_ip.c b/packages/net/tcpip/current/src/sys/netinet/raw_ip.c --- a/packages/net/tcpip/current/src/sys/netinet/raw_ip.c +++ b/packages/net/tcpip/current/src/sys/netinet/raw_ip.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -281,8 +258,11 @@ rip_output(m, va_alist) return (EINVAL); } if (ip->ip_id == 0) { +#ifdef RANDOM_IP_ID ip->ip_id = ip_randomid(); - HTONS(ip->ip_id); +#else + ip->ip_id = htons(ip_id++); +#endif } /* XXX prevent ip_output from overwriting header fields */ flags |= IP_RAWOUTPUT; diff --git a/packages/net/tcpip/current/src/sys/netinet/tcp_debug.c b/packages/net/tcpip/current/src/sys/netinet/tcp_debug.c --- a/packages/net/tcpip/current/src/sys/netinet/tcp_debug.c +++ b/packages/net/tcpip/current/src/sys/netinet/tcp_debug.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -109,7 +86,6 @@ didn't get a copy, you may request one f #define TCPSTATES #define TCPTIMERS #define TANAMES -#endif #include #ifndef __ECOS @@ -259,3 +235,4 @@ tcp_trace(act, ostate, tp, headers, req, tp->snd_wl1, tp->snd_wl2, tp->snd_wnd); #endif /* TCPDEBUG */ } +#endif diff --git a/packages/net/tcpip/current/src/sys/netinet/tcp_input.c b/packages/net/tcpip/current/src/sys/netinet/tcp_input.c --- a/packages/net/tcpip/current/src/sys/netinet/tcp_input.c +++ b/packages/net/tcpip/current/src/sys/netinet/tcp_input.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -2070,6 +2047,7 @@ dodata: /* XXX */ break; } } +#ifdef TCPDEBUG if (so->so_options & SO_DEBUG) { #ifdef INET6 if (tp->pf == PF_INET6) @@ -2078,6 +2056,7 @@ dodata: /* XXX */ #endif /* INET6 */ tcp_trace(TA_INPUT, ostate, tp, (caddr_t) &tcp_saveti, 0, tlen); } +#endif /* TCPDEBUG */ /* * Return any desired output. @@ -2137,6 +2116,7 @@ drop: /* * Drop space held by incoming segment and return. */ +#ifdef TCPDEBUG if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) { #ifdef INET6 if (tp->pf == PF_INET6) @@ -2145,6 +2125,7 @@ drop: #endif /* INET6 */ tcp_trace(TA_DROP, ostate, tp, (caddr_t) &tcp_saveti, 0, tlen); } +#endif /* TCPDEBUG */ m_freem(m); /* destroy temporarily created socket */ @@ -2644,7 +2625,7 @@ tcp_sack_partialack(tp, th) } return 0; } -#endif TCP_SACK +#endif /* TCP_SACK */ /* * Pull out of band byte out of a segment so diff --git a/packages/net/tcpip/current/src/sys/netinet/tcp_output.c b/packages/net/tcpip/current/src/sys/netinet/tcp_output.c --- a/packages/net/tcpip/current/src/sys/netinet/tcp_output.c +++ b/packages/net/tcpip/current/src/sys/netinet/tcp_output.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -1034,9 +1011,11 @@ send: /* * Trace. */ +#ifdef TCPDEBUG if (so->so_options & SO_DEBUG) tcp_trace(TA_OUTPUT, tp->t_state, tp, mtod(m, caddr_t), 0, len); +#endif /* TCPDEBUG */ /* * Fill in IP length and desired time to live and diff --git a/packages/net/tcpip/current/src/sys/netinet/tcp_subr.c b/packages/net/tcpip/current/src/sys/netinet/tcp_subr.c --- a/packages/net/tcpip/current/src/sys/netinet/tcp_subr.c +++ b/packages/net/tcpip/current/src/sys/netinet/tcp_subr.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/netinet/tcp_timer.c b/packages/net/tcpip/current/src/sys/netinet/tcp_timer.c --- a/packages/net/tcpip/current/src/sys/netinet/tcp_timer.c +++ b/packages/net/tcpip/current/src/sys/netinet/tcp_timer.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/src/sys/netinet/tcp_usrreq.c b/packages/net/tcpip/current/src/sys/netinet/tcp_usrreq.c --- a/packages/net/tcpip/current/src/sys/netinet/tcp_usrreq.c +++ b/packages/net/tcpip/current/src/sys/netinet/tcp_usrreq.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -577,8 +554,10 @@ tcp_usrreq(so, req, m, nam, control) default: panic("tcp_usrreq"); } +#ifdef TCPDEBUG if (tp && (so->so_options & SO_DEBUG)) tcp_trace(TA_USER, ostate, tp, (caddr_t)0, req, 0); +#endif /* TCPDEBUG */ splx(s); return (error); } diff --git a/packages/net/tcpip/current/src/sys/netinet/udp_usrreq.c b/packages/net/tcpip/current/src/sys/netinet/udp_usrreq.c --- a/packages/net/tcpip/current/src/sys/netinet/udp_usrreq.c +++ b/packages/net/tcpip/current/src/sys/netinet/udp_usrreq.c @@ -5,29 +5,6 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/net/tcpip/current/tests/bridge.c b/packages/net/tcpip/current/tests/bridge.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/bridge.c +++ /dev/null @@ -1,1009 +0,0 @@ -//========================================================================== -// -// tests/bridge.c -// -// -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): Jason L. Wright (jason@thought.net) -// Contributors: andrew.lunn@ascom.ch (Andrew Lunn), hmt -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - - -/* $OpenBSD: brconfig.c,v 1.6 2000/02/04 06:32:04 deraadt Exp $ */ - -/* - * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) - * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jason L. Wright - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void bridge_usage __P((void)); -int main __P((int, char **)); -int bridge_setflag __P((int, char *, short)); -int bridge_clrflag __P((int, char *, short)); -int bridge_ifsetflag __P((int, char *, char *, u_int32_t)); -int bridge_ifclrflag __P((int, char *, char *, u_int32_t)); -int bridge_list __P((int, char *, char *)); -int bridge_addrs __P((int, char *, char *)); -int bridge_addaddr __P((int, char *, char *, char *)); -int bridge_deladdr __P((int, char *, char *)); -int bridge_maxaddr __P((int, char *, char *)); -int bridge_timeout __P((int, char *, char *)); -int bridge_flush __P((int, char *)); -int bridge_flushall __P((int, char *)); -int bridge_add __P((int, char *, char *)); -int bridge_delete __P((int, char *, char *)); -int bridge_status __P((int, char *)); -int is_bridge __P((int, char *)); -int bridge_show_all __P((int)); -void printb __P((char *, unsigned short, char *)); -int bridge_rule __P((int, char *, int, char **, int)); -int bridge_rules __P((int, char *, char *, char *)); -int bridge_flush_rule __P((int, char *, char *)); -void bridge_badrule __P((int, char **, int)); -void bridge_showrule __P((struct ifbrlreq *, char *)); -int bridge_rulefile __P((int, char *, char *)); - -/* if_flags bits: borrowed from ifconfig.c */ -#define IFFBITS \ -"\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS\7RUNNING\10NOARP\ -\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2\20MULTICAST" - -#define IFBAFBITS "\020\1STATIC" -#define IFBIFBITS "\020\1LEARNING\2DISCOVER\3BLOCKNONIP\4BLOCKARP" - -#define warnx(x) diag_printf(x); -#define warnx2(x,y) diag_printf(x,y) -#define warnx3(x,y,z) diag_printf(x,y,z) -#define err(x,y) assert(0); -extern int cyg_kmem_print_stats(void); - -static char * _ether_aton __P((char *, struct ether_addr *)); - -char * -ether_ntoa(e) - struct ether_addr *e; -{ - static char a[] = "xx:xx:xx:xx:xx:xx"; - - if (e->ether_addr_octet[0] > 0xFF || e->ether_addr_octet[1] > 0xFF || - e->ether_addr_octet[2] > 0xFF || e->ether_addr_octet[3] > 0xFF || - e->ether_addr_octet[4] > 0xFF || e->ether_addr_octet[5] > 0xFF) { - errno = EINVAL; - return (NULL); - } - - (void)sprintf(a, "%02x:%02x:%02x:%02x:%02x:%02x", - e->ether_addr_octet[0], e->ether_addr_octet[1], - e->ether_addr_octet[2], e->ether_addr_octet[3], - e->ether_addr_octet[4], e->ether_addr_octet[5]); - - return (a); -} - -static char * -_ether_aton(s, e) - char *s; - struct ether_addr *e; -{ - int i; - long l; - char *pp; - - while (isspace(*s)) - s++; - - /* expect 6 hex octets separated by ':' or space/NUL if last octet */ - for (i = 0; i < 6; i++) { - l = strtol(s, &pp, 16); - if (pp == s || l > 0xFF || l < 0) - return (NULL); - if (!(*pp == ':' || (i == 5 && (isspace(*pp) || *pp == '\0')))) - return (NULL); - e->ether_addr_octet[i] = (u_char)l; - s = pp + 1; - } - - /* return character after the octets ala strtol(3) */ - return (pp); -} - -struct ether_addr * -ether_aton(s) - char *s; -{ - static struct ether_addr n; - - return (_ether_aton(s, &n) ? &n : NULL); -} - -void -bridge_usage() -{ - diag_printf("usage: brconfig -a\n"); - diag_printf( - "usage: brconfig interface [up] [down] [add if] [del if] ...\n"); -} - - -int -bridge_ifsetflag(s, brdg, ifsname, flag) - int s; - char *brdg, *ifsname; - u_int32_t flag; -{ - struct ifbreq req; - - strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); - strncpy(req.ifbr_ifsname, ifsname, sizeof(req.ifbr_ifsname)); - if (ioctl(s, SIOCBRDGGIFFLGS, (caddr_t)&req) < 0) { - return (1); - } - - req.ifbr_ifsflags |= flag; - - if (ioctl(s, SIOCBRDGSIFFLGS, (caddr_t)&req) < 0) { - warnx3("%s: %s", brdg, ifsname); - return (1); - } - return (0); -} - -int -bridge_ifclrflag(s, brdg, ifsname, flag) - int s; - char *brdg, *ifsname; - u_int32_t flag; -{ - struct ifbreq req; - - strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); - strncpy(req.ifbr_ifsname, ifsname, sizeof(req.ifbr_ifsname)); - - if (ioctl(s, SIOCBRDGGIFFLGS, (caddr_t)&req) < 0) { - warnx3("%s: %s", brdg, ifsname); - return (1); - } - - req.ifbr_ifsflags &= ~flag; - - if (ioctl(s, SIOCBRDGSIFFLGS, (caddr_t)&req) < 0) { - warnx3("%s: %s", brdg, ifsname); - return (1); - } - return (0); -} - -int -bridge_show_all(s) - int s; -{ - char *inbuf = NULL; - struct ifconf ifc; - struct ifreq *ifrp, ifreq; - int len = 8192, i; - - while (1) { - ifc.ifc_len = len; - ifc.ifc_buf = inbuf = realloc(inbuf, len); - if (inbuf == NULL) - err(1, "malloc"); - if (ioctl(s, SIOCGIFCONF, &ifc) < 0) - err(1, "ioctl(SIOCGIFCONF)"); - if (ifc.ifc_len + sizeof(struct ifreq) < len) - break; - len *= 2; - } - ifrp = ifc.ifc_req; - ifreq.ifr_name[0] = '\0'; - for (i = 0; i < ifc.ifc_len; ) { - ifrp = (struct ifreq *)((caddr_t)ifc.ifc_req + i); - i += sizeof(ifrp->ifr_name) + - (ifrp->ifr_addr.sa_len > sizeof(struct sockaddr) ? - ifrp->ifr_addr.sa_len : sizeof(struct sockaddr)); - if (ifrp->ifr_addr.sa_family != AF_LINK) - continue; - if (!is_bridge(s, ifrp->ifr_name)) - continue; - bridge_status(s, ifrp->ifr_name); - } - free(ifc.ifc_buf); - return (0); -} - -int -bridge_setflag(s, brdg, f) - int s; - char *brdg; - short f; -{ - struct ifreq ifr; - - strncpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name)); - - if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { - warnx2("%s", brdg); - if (errno == EPERM) - return (1); - return (1); - } - - ifr.ifr_flags |= f; - - if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) { - warnx2("%s", brdg); - if (errno == EPERM) - return (1); - return (1); - } - - return (0); -} - -int -bridge_clrflag(s, brdg, f) - int s; - char *brdg; - short f; -{ - struct ifreq ifr; - - strncpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name)); - - if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { - warnx2("%s", brdg); - if (errno == EPERM) - return (1); - return (1); - } - - ifr.ifr_flags &= ~(f); - - if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) { - warnx2("%s", brdg); - if (errno == EPERM) - return (1); - return (1); - } - - return (0); -} - -int -bridge_flushall(s, brdg) - int s; - char *brdg; -{ - struct ifbreq req; - - strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); - req.ifbr_ifsflags = IFBF_FLUSHALL; - if (ioctl(s, SIOCBRDGFLUSH, &req) < 0) { - warnx2("%s", brdg); - return (1); - } - return (0); -} - -int -bridge_flush(s, brdg) - int s; - char *brdg; -{ - struct ifbreq req; - - strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); - req.ifbr_ifsflags = IFBF_FLUSHDYN; - if (ioctl(s, SIOCBRDGFLUSH, &req) < 0) { - warnx2("%s", brdg); - return (1); - } - return (0); -} - -int -bridge_list(s, brdg, delim) - int s; - char *brdg, *delim; -{ - struct ifbreq *reqp; - struct ifbifconf bifc; - int i, len = 8192; - char buf[sizeof(reqp->ifbr_ifsname) + 1], *inbuf = NULL; - - while (1) { - strncpy(bifc.ifbic_name, brdg, sizeof(bifc.ifbic_name)); - bifc.ifbic_len = len; - bifc.ifbic_buf = inbuf = realloc(inbuf, len); - if (inbuf == NULL) - err(1, "malloc"); - if (ioctl(s, SIOCBRDGIFS, &bifc) < 0) - err(1, brdg); - if (bifc.ifbic_len + sizeof(*reqp) < len) - break; - len *= 2; - } - for (i = 0; i < bifc.ifbic_len / sizeof(*reqp); i++) { - reqp = bifc.ifbic_req + i; - strncpy(buf, reqp->ifbr_ifsname, sizeof(buf)); - diag_printf("%s%s ", delim, buf); - printb("flags", reqp->ifbr_ifsflags, IFBIFBITS); - diag_printf("\n"); - bridge_rules(s, brdg, buf, delim); - } - free(bifc.ifbic_buf); - return (0); /* NOTREACHED */ -} - -int -bridge_add(s, brdg, ifn) - int s; - char *brdg, *ifn; -{ - struct ifbreq req; - - strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); - strncpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname)); - if (ioctl(s, SIOCBRDGADD, &req) < 0) { - warnx3("%s: %s", brdg, ifn); - if (errno == EPERM) - return (1); - return (1); - } - return (0); -} - -int -bridge_delete(s, brdg, ifn) - int s; - char *brdg, *ifn; -{ - struct ifbreq req; - - strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); - strncpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname)); - if (ioctl(s, SIOCBRDGDEL, &req) < 0) { - warnx3("%s: %s", brdg, ifn); - if (errno == EPERM) - return (1); - return (1); - } - return (0); -} - -int -bridge_timeout(s, brdg, arg) - int s; - char *brdg, *arg; -{ - struct ifbcachetoreq ifbct; - u_int32_t newtime; - char *endptr; - - newtime = strtoul(arg, &endptr, 0); - if (arg[0] == '\0' || endptr[0] != '\0') { - diag_printf("invalid arg for timeout: %s\n", arg); - return (1); - } - - strncpy(ifbct.ifbct_name, brdg, sizeof(ifbct.ifbct_name)); - ifbct.ifbct_time = newtime; - if (ioctl(s, SIOCBRDGSTO, (caddr_t)&ifbct) < 0) { - warnx2("%s", brdg); - return (1); - } - return (0); -} - -int -bridge_maxaddr(s, brdg, arg) - int s; - char *brdg, *arg; -{ - struct ifbcachereq ifbc; - u_int32_t newsize; - char *endptr; - - newsize = strtoul(arg, &endptr, 0); - if (arg[0] == '\0' || endptr[0] != '\0') { - diag_printf("invalid arg for maxaddr: %s\n", arg); - return (1); - } - - strncpy(ifbc.ifbc_name, brdg, sizeof(ifbc.ifbc_name)); - ifbc.ifbc_size = newsize; - if (ioctl(s, SIOCBRDGSCACHE, (caddr_t)&ifbc) < 0) { - warnx2("%s", brdg); - return (1); - } - return (0); -} - -int -bridge_deladdr(s, brdg, addr) - int s; - char *brdg, *addr; -{ - struct ifbareq ifba; - struct ether_addr *ea; - - strncpy(ifba.ifba_name, brdg, sizeof(ifba.ifba_name)); - ea = ether_aton(addr); - if (ea == NULL) { - warnx2("Invalid address: %s", addr); - return (1); - } - bcopy(ea, &ifba.ifba_dst, sizeof(struct ether_addr)); - - if (ioctl(s, SIOCBRDGDADDR, &ifba) < 0) { - warnx3("%s: %s", brdg, addr); - return (1); - } - - return (0); -} - -int -bridge_addaddr(s, brdg, ifname, addr) - int s; - char *brdg, *ifname, *addr; -{ - struct ifbareq ifba; - struct ether_addr *ea; - - strncpy(ifba.ifba_name, brdg, sizeof(ifba.ifba_name)); - strncpy(ifba.ifba_ifsname, ifname, sizeof(ifba.ifba_ifsname)); - - ea = ether_aton(addr); - if (ea == NULL) { - warnx2("Invalid address: %s", addr); - return (1); - } - bcopy(ea, &ifba.ifba_dst, sizeof(struct ether_addr)); - ifba.ifba_flags = IFBAF_STATIC; - - if (ioctl(s, SIOCBRDGSADDR, &ifba) < 0) { - warnx3("%s: %s", brdg, addr); - return (1); - } - - return (0); -} - -int -bridge_addrs(s, brdg, delim) - int s; - char *brdg, *delim; -{ - struct ifbaconf ifbac; - struct ifbareq *ifba; - char *inbuf = NULL, buf[sizeof(ifba->ifba_ifsname) + 1]; - int i, len = 8192; - - while (1) { - ifbac.ifbac_len = len; - ifbac.ifbac_buf = inbuf = realloc(inbuf, len); - strncpy(ifbac.ifbac_name, brdg, sizeof(ifbac.ifbac_name)); - if (inbuf == NULL) - err(1, "malloc"); - if (ioctl(s, SIOCBRDGRTS, &ifbac) < 0) { - if (errno == ENETDOWN) - return (0); - err(1, brdg); - } - if (ifbac.ifbac_len + sizeof(*ifba) < len) - break; - len *= 2; - } - - for (i = 0; i < ifbac.ifbac_len / sizeof(*ifba); i++) { - ifba = ifbac.ifbac_req + i; - strncpy(buf, ifba->ifba_ifsname, sizeof(buf)); - diag_printf("%s%s %s %d ", delim, ether_ntoa(&ifba->ifba_dst), - buf, ifba->ifba_age); - printb("flags", ifba->ifba_flags, IFBAFBITS); - diag_printf("\n"); - } - free(ifbac.ifbac_buf); - return (0); -} - -/* - * Check to make sure 'brdg' is really a bridge interface. - */ -int -is_bridge(s, brdg) - int s; - char *brdg; -{ - struct ifreq ifr; - struct ifbaconf ifbac; - - strncpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name)); - - if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) - return (0); - - ifbac.ifbac_len = 0; - strncpy(ifbac.ifbac_name, brdg, sizeof(ifbac.ifbac_name)); - if (ioctl(s, SIOCBRDGRTS, (caddr_t)&ifbac) < 0) { - if (errno == ENETDOWN) - return (1); - return (0); - } - return (1); -} - -int -bridge_status(s, brdg) - int s; - char *brdg; -{ - struct ifreq ifr; - struct ifbcachereq ifbc; - struct ifbcachetoreq ifbct; - int err; - - strncpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name)); - if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { - warnx2("%s", brdg); - if (errno == EPERM) - return (1); - return (1); - } - - diag_printf("%s: ", brdg); - printb("flags", ifr.ifr_flags, IFFBITS); - diag_printf("\n"); - - diag_printf("Interfaces:\n"); - err = bridge_list(s, brdg, " "); - if (err) - return (err); - - strncpy(ifbc.ifbc_name, brdg, sizeof(ifbc.ifbc_name)); - if (ioctl(s, SIOCBRDGGCACHE, (caddr_t)&ifbc) < 0) { - warnx2("%s", brdg); - return (1); - } - - strncpy(ifbct.ifbct_name, brdg, sizeof(ifbct.ifbct_name)); - if (ioctl(s, SIOCBRDGGTO, (caddr_t)&ifbct) < 0) { - warnx2("%s", brdg); - return (1); - } - - diag_printf("Addresses (max cache: %d, timeout: %d):\n", - ifbc.ifbc_size, ifbct.ifbct_time); - - err = bridge_addrs(s, brdg, " "); - return (err); -} - -int -bridge_flush_rule(s, brdg, ifname) - int s; - char *brdg, *ifname; -{ - struct ifbrlreq req; - - strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); - strncpy(req.ifbr_ifsname, ifname, sizeof(req.ifbr_ifsname)); - if (ioctl(s, SIOCBRDGFRL, &req) < 0) { - warnx3("%s: %s", brdg, ifname); - return (1); - } - return (0); -} - -int -bridge_rules(s, brdg, ifname, delim) - int s; - char *brdg, *ifname; - char *delim; -{ - char *inbuf = NULL; - struct ifbrlconf ifc; - struct ifbrlreq *ifrp, ifreq; - int len = 8192, i; - - while (1) { - ifc.ifbrl_len = len; - ifc.ifbrl_buf = inbuf = realloc(inbuf, len); - strncpy(ifc.ifbrl_name, brdg, sizeof(ifc.ifbrl_name)); - strncpy(ifc.ifbrl_ifsname, ifname, sizeof(ifc.ifbrl_ifsname)); - if (inbuf == NULL) - err(1, "malloc"); - if (ioctl(s, SIOCBRDGGRL, &ifc) < 0) - err(1, "ioctl(SIOCBRDGGRL)"); - if (ifc.ifbrl_len + sizeof(ifreq) < len) - break; - len *= 2; - } - ifrp = ifc.ifbrl_req; - for (i = 0; i < ifc.ifbrl_len; i += sizeof(ifreq)) { - ifrp = (struct ifbrlreq *)((caddr_t)ifc.ifbrl_req + i); - bridge_showrule(ifrp, delim); - } - free(ifc.ifbrl_buf); - return (0); -} - -void -bridge_showrule(r, delim) - struct ifbrlreq *r; - char *delim; -{ - if (delim) - diag_printf("%s ", delim); - else - diag_printf("%s: ", r->ifbr_name); - - if (r->ifbr_action == BRL_ACTION_BLOCK) - diag_printf("block "); - else if (r->ifbr_action == BRL_ACTION_PASS) - diag_printf("pass "); - else - diag_printf("[neither block nor pass?]\n"); - - if ((r->ifbr_flags & (BRL_FLAG_IN | BRL_FLAG_OUT)) == - (BRL_FLAG_IN | BRL_FLAG_OUT)) - diag_printf("in/out "); - else if (r->ifbr_flags & BRL_FLAG_IN) - diag_printf("in "); - else if (r->ifbr_flags & BRL_FLAG_OUT) - diag_printf("out "); - else - diag_printf("[neither in nor out?]\n"); - - diag_printf("on %s", r->ifbr_ifsname); - - if (r->ifbr_flags & BRL_FLAG_SRCVALID) - diag_printf(" src %s", ether_ntoa(&r->ifbr_src)); - if (r->ifbr_flags & BRL_FLAG_DSTVALID) - diag_printf(" dst %s", ether_ntoa(&r->ifbr_dst)); - - diag_printf("\n"); -} - -/* - * Parse a rule definition and send it upwards. - * - * Syntax: - * {block|pass} {in|out|in/out} on {ifs} [src {mac}] [dst {mac}] - */ -int -bridge_rule(int s, char *brdg, int targc, char **targv, int ln) -{ - char **argv = targv; - int argc = targc; - struct ifbrlreq rule; - struct ether_addr *ea, *dea; - - if (argc == 0) { - diag_printf( "invalid rule\n"); - return (1); - } - rule.ifbr_flags = 0; - rule.ifbr_action = 0; - strncpy(rule.ifbr_name, brdg, sizeof(rule.ifbr_name)); - - if (strcmp(argv[0], "block") == 0) - rule.ifbr_action = BRL_ACTION_BLOCK; - else if (strcmp(argv[0], "pass") == 0) - rule.ifbr_action = BRL_ACTION_PASS; - else - goto bad_rule; - argc--; argv++; - - if (argc == 0) { - bridge_badrule(targc, targv, ln); - return (1); - } - if (strcmp(argv[0], "in") == 0) - rule.ifbr_flags |= BRL_FLAG_IN; - else if (strcmp(argv[0], "out") == 0) - rule.ifbr_flags |= BRL_FLAG_OUT; - else if (strcmp(argv[0], "in/out") == 0) - rule.ifbr_flags |= BRL_FLAG_IN | BRL_FLAG_OUT; - else - goto bad_rule; - argc--; argv++; - - if (argc == 0 || strcmp(argv[0], "on")) - goto bad_rule; - argc--; argv++; - - if (argc == 0) - goto bad_rule; - strncpy(rule.ifbr_ifsname, argv[0], sizeof(rule.ifbr_ifsname)); - argc--; argv++; - - while (argc) { - if (strcmp(argv[0], "dst") == 0) { - if (rule.ifbr_flags & BRL_FLAG_DSTVALID) - goto bad_rule; - rule.ifbr_flags |= BRL_FLAG_DSTVALID; - dea = &rule.ifbr_dst; - } - else if (strcmp(argv[0], "src") == 0) { - if (rule.ifbr_flags & BRL_FLAG_SRCVALID) - goto bad_rule; - rule.ifbr_flags |= BRL_FLAG_SRCVALID; - dea = &rule.ifbr_src; - } - else - goto bad_rule; - - argc--; argv++; - - if (argc == 0) - goto bad_rule; - ea = ether_aton(argv[0]); - if (ea == NULL) { - warnx2("Invalid address: %s", argv[0]); - return (1); - } - bcopy(ea, dea, sizeof(*dea)); - argc--; argv++; - } - - if (ioctl(s, SIOCBRDGARL, &rule) < 0) { - warnx2("%s", brdg); - return (1); - } - return (0); - -bad_rule: - bridge_badrule(targc, targv, ln); - return (1); -} - -#define MAXRULEWORDS 8 -#ifdef ZAP -int -bridge_rulefile(s, brdg, fname) - int s; - char *brdg, *fname; -{ - FILE *f; - char *str, *argv[MAXRULEWORDS], buf[1024], xbuf[1024]; - int ln = 1, argc = 0, err = 0, xerr; - - f = fopen(fname, "r"); - if (f == NULL) { - warnx2("%s", fname); - return (1); - } - - while (1) { - fgets(buf, sizeof(buf), f); - if (feof(f)) - break; - ln++; - if (buf[0] == '#') - continue; - - argc = 0; - str = strtok(buf, "\n\r "); - strncpy(xbuf, buf, sizeof(xbuf)); - while (str != NULL) { - argv[argc++] = str; - if (argc > MAXRULEWORDS) { - diag_printf( "invalid rule: %d: %s\n", - ln, xbuf); - break; - } - str = strtok(NULL, "\n\r "); - } - - if (argc > MAXRULEWORDS) - continue; - - xerr = bridge_rule(s, brdg, argc, argv, ln); - if (xerr) - err = xerr; - } - fclose(f); - return (err); -} -#endif -void -bridge_badrule(argc, argv, ln) - int argc, ln; - char **argv; -{ - int i; - - diag_printf( "invalid rule: "); - if (ln != -1) - diag_printf( "%d: ", ln); - for (i = 0; i < argc; i++) { - diag_printf( "%s ", argv[i]); - } - diag_printf( "\n"); -} - -/* - * Print a value ala the %b format of the kernel's printf - * (borrowed from ifconfig.c) - */ -void -printb(s, v, bits) - char *s; - char *bits; - unsigned short v; -{ - register int i, any = 0; - register char c; - - if (bits && *bits == 8) - diag_printf("%s=%o", s, v); - else - diag_printf("%s=%x", s, v); - bits++; - if (bits) { - diag_printf("<"); - while ((i = *bits++)) { - if (v & (1 << (i-1))) { - if (any) - diag_printf(","); - any = 1; - for (; (c = *bits) > 32; bits++) - diag_printf("%c",c); - } else - for (; *bits > 32; bits++) - ; - } - diag_printf(">"); - } -} - -static void -interface_up(const char *intf) -{ - struct ifreq ifr; - int s; - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - perror("socket"); - return; - } - - strcpy(ifr.ifr_name, intf); - ifr.ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; - if (ioctl(s, SIOCSIFFLAGS, &ifr)) { - perror("SIOCSIFFLAGS"); - } - close(s); -} - -static void -main_fn(cyg_addrword_t data) { - - int sock; - char brdg[] = "bridge0"; - - sock = socket(AF_INET, SOCK_DGRAM, 0); - assert(sock >= 0); - -#ifdef CYGHWR_NET_DRIVER_ETH0 - interface_up("eth0"); - eth0_up = 1; - bridge_add(sock,brdg,"eth0"); -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - interface_up("eth1"); - eth1_up = 1; - bridge_add(sock,brdg,"eth1"); -#endif - - bridge_status(sock,brdg); - bridge_setflag(sock,brdg, IFF_UP); - - while(1) { - cyg_kmem_print_stats(); - cyg_thread_delay(500); - } -} - -static char main_stack[8192]; -static cyg_handle_t main_handle; -static cyg_thread main_thread; - -void -cyg_user_start(void) { - printf("cyg_user_start starting\n"); - cyg_thread_create(4, &main_fn, 0, "main", &main_stack, sizeof(main_stack), - &main_handle, &main_thread); - cyg_thread_resume(main_handle); - printf("cyg_user_start done\n"); -} - - diff --git a/packages/net/tcpip/current/tests/dhcp_test.c b/packages/net/tcpip/current/tests/dhcp_test.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/dhcp_test.c +++ /dev/null @@ -1,343 +0,0 @@ -//========================================================================== -// -// tests/dhcp_test.c -// -// Simple test of DHCP (ICMP) and networking support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// DHCP test code - -#include - -#include -#include - -#include - -#include - -#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists -#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME -#endif - -#ifdef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS // do we use the rt test? -# ifdef CYGTST_DEVS_ETH_TEST_NET_REALTIME // Get the test ancilla if it exists -# include CYGTST_DEVS_ETH_TEST_NET_REALTIME -# endif -#endif - -// Fill in the blanks if necessary -#ifndef TNR_OFF -# define TNR_OFF() -#endif -#ifndef TNR_ON -# define TNR_ON() -#endif -#ifndef TNR_INIT -# define TNR_INIT() -#endif -#ifndef TNR_PRINT_ACTIVITY -# define TNR_PRINT_ACTIVITY() -#endif - - - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -#define NUM_PINGS 16 -#define MAX_PACKET 4096 -#define MIN_PACKET 64 -#define MAX_SEND 4000 - -#define PACKET_ADD ((MAX_SEND - MIN_PACKET)/NUM_PINGS) -#define nPACKET_ADD 1 - -static unsigned char pkt1[MAX_PACKET], pkt2[MAX_PACKET]; - -#define UNIQUEID 0x1234 - -void -pexit(char *s) -{ - CYG_TEST_FAIL_FINISH(s); -} - -// Compute INET checksum -int -inet_cksum(u_short *addr, int len) -{ - register int nleft = len; - register u_short *w = addr; - register u_short answer; - register u_int sum = 0; - u_short odd_byte = 0; - - /* - * Our algorithm is simple, using a 32 bit accumulator (sum), - * we add sequential 16 bit words to it, and at the end, fold - * back all the carry bits from the top 16 bits into the lower - * 16 bits. - */ - while( nleft > 1 ) { - sum += *w++; - nleft -= 2; - } - - /* mop up an odd byte, if necessary */ - if( nleft == 1 ) { - *(u_char *)(&odd_byte) = *(u_char *)w; - sum += odd_byte; - } - - /* - * add back carry outs from top 16 bits to low 16 bits - */ - sum = (sum >> 16) + (sum & 0x0000ffff); /* add hi 16 to low 16 */ - sum += (sum >> 16); /* add carry */ - answer = ~sum; /* truncate to 16 bits */ - return (answer); -} - -static int -show_icmp(unsigned char *pkt, int len, - struct sockaddr_in *from, struct sockaddr_in *to) -{ - cyg_tick_count_t *tp, tv; - struct ip *ip; - struct icmp *icmp; - tv = cyg_current_time(); - ip = (struct ip *)pkt; - if ((len < sizeof(*ip)) || ip->ip_v != IPVERSION) { - diag_printf("%s: Short packet or not IP! - Len: %d, Version: %d\n", - inet_ntoa(from->sin_addr), len, ip->ip_v); - return 0; - } - icmp = (struct icmp *)(pkt + sizeof(*ip)); - len -= (sizeof(*ip) + 8); - tp = (cyg_tick_count_t *)&icmp->icmp_data; - if (icmp->icmp_type != ICMP_ECHOREPLY) { - diag_printf("%s: Invalid ICMP - type: %d\n", - inet_ntoa(from->sin_addr), icmp->icmp_type); - return 0; - } - if (icmp->icmp_id != UNIQUEID) { - diag_printf("%s: ICMP received for wrong id - sent: %x, recvd: %x\n", - inet_ntoa(from->sin_addr), UNIQUEID, icmp->icmp_id); - } - diag_printf("%d bytes from %s: ", len, inet_ntoa(from->sin_addr)); - diag_printf("icmp_seq=%d", icmp->icmp_seq); - diag_printf(", time=%dms\n", (int)(tv - *tp)*10); - return (from->sin_addr.s_addr == to->sin_addr.s_addr); -} - -static void -ping_host(int s, struct sockaddr_in *host) -{ - struct icmp *icmp = (struct icmp *)pkt1; - int icmp_len = MIN_PACKET; - int seq, ok_recv, bogus_recv; - cyg_tick_count_t *tp; - long *dp; - struct sockaddr_in from; - int i, len, fromlen; - - ok_recv = 0; - bogus_recv = 0; - diag_printf("PING server %s\n", inet_ntoa(host->sin_addr)); - for (seq = 0; seq < NUM_PINGS; seq++, icmp_len += PACKET_ADD ) { - TNR_ON(); - // Build ICMP packet - icmp->icmp_type = ICMP_ECHO; - icmp->icmp_code = 0; - icmp->icmp_cksum = 0; - icmp->icmp_seq = seq; - icmp->icmp_id = 0x1234; - // Set up ping data - tp = (cyg_tick_count_t *)&icmp->icmp_data; - *tp++ = cyg_current_time(); - dp = (long *)tp; - for (i = sizeof(*tp); i < icmp_len; i += sizeof(*dp)) { - *dp++ = i; - } - // Add checksum - icmp->icmp_cksum = inet_cksum( (u_short *)icmp, icmp_len+8); - // Send it off - if (sendto(s, icmp, icmp_len+8, 0, (struct sockaddr *)host, sizeof(*host)) < 0) { - TNR_OFF(); - perror("sendto"); - continue; - } - // Wait for a response - fromlen = sizeof(from); - len = recvfrom(s, pkt2, sizeof(pkt2), 0, (struct sockaddr *)&from, &fromlen); - TNR_OFF(); - if (len < 0) { - perror("recvfrom"); - icmp_len = MIN_PACKET - PACKET_ADD; // go back to small packet size - seq+=4; - } else { - if (show_icmp(pkt2, len, &from, host)) { - ok_recv++; - } else { - bogus_recv++; - } - } - } - TNR_OFF(); -} - -static void -ping_test(struct bootp *bp) -{ - struct protoent *p; - struct timeval tv; - struct sockaddr_in host; - int s; - - if ((p = getprotobyname("icmp")) == (struct protoent *)0) { - pexit("getprotobyname"); - return; - } - s = socket(AF_INET, SOCK_RAW, p->p_proto); - if (s < 0) { - pexit("socket"); - return; - } - tv.tv_sec = 1; - tv.tv_usec = 0; - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - // Set up host address - host.sin_family = AF_INET; - host.sin_addr = bp->bp_siaddr; - host.sin_port = 0; - ping_host(s, &host); - // Now try a bogus host - host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + 32); - ping_host(s, &host); - close(s); -} - -void -net_test(cyg_addrword_t p) -{ -#ifndef CYGPKG_NET_DHCP - CYG_TEST_NA( "DHCP is not enabled" ); - CYG_TEST_EXIT( "DHCP is not enabled" ); -#else - int i; - diag_printf("Start DHCP test\n"); - TNR_INIT(); - init_all_network_interfaces(); - - for ( i = 10; i > 0; i-- ) { -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up) { - ping_test(ð0_bootp_data); - } -#endif - // Now do the DHCP renewal ritual... - if ( cyg_semaphore_trywait( &dhcp_needs_attention )) { - if ( ! dhcp_bind() ) { - // All done - dhcp_halt(); - CYG_TEST_FAIL_FINISH( "Rebind after lease failed"); - break; - } - } -#ifdef CYGHWR_NET_DRIVER_ETH1 - if (eth1_up) { - ping_test(ð1_bootp_data); - } -#endif - -#ifndef CYGOPT_NET_DHCP_DHCP_THREAD - // Now do the DHCP renewal ritual... - if ( cyg_semaphore_trywait( &dhcp_needs_attention )) { - if ( ! dhcp_bind() ) { - // All done - dhcp_halt(); - CYG_TEST_FAIL_FINISH( "Rebind after lease failed"); - break; - } - } -#endif // not CYGOPT_NET_DHCP_DHCP_THREAD - - if ( 1 == (i & 3) ) { - dhcp_release(); // relinquish leases - dhcp_halt(); - init_all_network_interfaces(); - } - } - dhcp_release(); - - TNR_PRINT_ACTIVITY(); - CYG_TEST_PASS_FINISH("Dhcp test OK"); -#endif -} - -void -cyg_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - net_test, // entry - 0, // entry parameter - "Network test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it - cyg_scheduler_start(); -} diff --git a/packages/net/tcpip/current/tests/flood.c b/packages/net/tcpip/current/tests/flood.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/flood.c +++ /dev/null @@ -1,414 +0,0 @@ -//========================================================================== -// -// tests/flood.c -// -// Flood PING test -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas, hmt -// Contributors: gthomas -// Date: 2000-05-03 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include -#include - -#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists -#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME -#endif - -#ifdef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS // do we use the rt test? -# ifdef CYGTST_DEVS_ETH_TEST_NET_REALTIME // Get the test ancilla if it exists -# include CYGTST_DEVS_ETH_TEST_NET_REALTIME -# endif -#endif - - -// Fill in the blanks if necessary -#ifndef TNR_OFF -# define TNR_OFF() -#endif -#ifndef TNR_ON -# define TNR_ON() -#endif -#ifndef TNR_INIT -# define TNR_INIT() -#endif -#ifndef TNR_PRINT_ACTIVITY -# define TNR_PRINT_ACTIVITY() -#endif - - -// FLOOD PING test code - -#include - -#define MAX_PACKET 4096 - -#define NUMTHREADS 3 -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + MAX_PACKET + MAX_PACKET + 0x1000) -static char thread_stack[NUMTHREADS][STACK_SIZE]; -static cyg_thread thread_data[NUMTHREADS]; -static cyg_handle_t thread_handle[NUMTHREADS]; - -#define DO_DUMPSTATS( seq ) (0 == (0xffff & seq)) - -#ifdef CYGHWR_NET_DRIVER_ETH0 -struct sockaddr_in host0; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 -struct sockaddr_in host1; -#endif -static int sock; - -static int uniqueid[3] = { 0x1234, 0x4321, 0xdead }; - -static int ok_recv[3] = { 0,0,0 }; -static int bogus_recv[3] = { 0,0,0 }; -static int pings_sent[3] = { 0,0,0 }; - -extern void cyg_kmem_print_stats( void ); - -extern void -cyg_test_exit(void); - -void -pexit(char *s) -{ - perror(s); - cyg_test_exit(); -} - -// ------------------------------------------------------------------------ -static void dumpstats(void) -{ - TNR_OFF(); - diag_printf( "------------------------\n" ); -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up) { - diag_printf("%16s: Sent %d packets, received %d OK, %d bad\n", - inet_ntoa(host0.sin_addr), pings_sent[0], - ok_recv[0], bogus_recv[0]); - } -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if (eth1_up) { - diag_printf("%16s: Sent %d packets, received %d OK, %d bad\n", - inet_ntoa(host1.sin_addr), pings_sent[1], - ok_recv[1], bogus_recv[1]); - } -#endif - if ( pings_sent[2] ) - diag_printf("Wierd! %d unknown sends!\n", pings_sent[2] ); - if ( ok_recv[2] ) - diag_printf("Wierd! %d unknown good recvs!\n", ok_recv[2] ); - if ( bogus_recv[2] ) - diag_printf("Wierd! %d unknown bogus recvs!\n", bogus_recv[2] ); - cyg_kmem_print_stats(); - diag_printf( "------------------------\n" ); - TNR_ON(); -} - - -// ------------------------------------------------------------------------ -// Compute INET checksum -int -inet_cksum(u_short *addr, int len) -{ - register int nleft = len; - register u_short *w = addr; - register u_short answer; - register u_int sum = 0; - u_short odd_byte = 0; - - /* - * Our algorithm is simple, using a 32 bit accumulator (sum), - * we add sequential 16 bit words to it, and at the end, fold - * back all the carry bits from the top 16 bits into the lower - * 16 bits. - */ - while( nleft > 1 ) { - sum += *w++; - nleft -= 2; - } - - /* mop up an odd byte, if necessary */ - if( nleft == 1 ) { - *(u_char *)(&odd_byte) = *(u_char *)w; - sum += odd_byte; - } - - /* - * add back carry outs from top 16 bits to low 16 bits - */ - sum = (sum >> 16) + (sum & 0x0000ffff); /* add hi 16 to low 16 */ - sum += (sum >> 16); /* add carry */ - answer = ~sum; /* truncate to 16 bits */ - return (answer); -} - -// ------------------------------------------------------------------------ -static void -show_icmp(unsigned char *pkt, int len, struct sockaddr_in *from) -{ - cyg_tick_count_t *tp, tv; - struct ip *ip; - struct icmp *icmp; - int which = 2; - tv = cyg_current_time(); -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up && (from->sin_addr.s_addr == host0.sin_addr.s_addr) ) - which = 0; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if (eth1_up && (from->sin_addr.s_addr == host1.sin_addr.s_addr) ) - which = 1; -#endif - - ip = (struct ip *)pkt; - if ((len < sizeof(*ip)) || ip->ip_v != IPVERSION) { - diag_printf("%s: Short packet or not IP! - Len: %d, Version: %d\n", - inet_ntoa(from->sin_addr), len, ip->ip_v); - bogus_recv[which]++; - return; - } - icmp = (struct icmp *)(pkt + sizeof(*ip)); - len -= (sizeof(*ip) + 8); - tp = (cyg_tick_count_t *)&icmp->icmp_data; - if (icmp->icmp_type != ICMP_ECHOREPLY) { - diag_printf("%s: Invalid ICMP - type: %d\n", - inet_ntoa(from->sin_addr), icmp->icmp_type); - bogus_recv[which]++; - return; - } - ok_recv[which]++; - if (icmp->icmp_id != uniqueid[which]) { - diag_printf("%s: ICMP received for wrong id - sent: %x, recvd: %x\n", - inet_ntoa(from->sin_addr), uniqueid[which], icmp->icmp_id); - } -// diag_printf("%d bytes from %s: ", len, inet_ntoa(from->sin_addr)); -// diag_printf("icmp_seq=%d", icmp->icmp_seq); -// diag_printf(", time=%dms\n", (int)(tv - *tp)*10); -} - -// ------------------------------------------------------------------------ -static void -floodrecv(cyg_addrword_t p) -{ - unsigned char pkt[MAX_PACKET]; - struct sockaddr_in from; - int len, fromlen; - - diag_printf("PING listener...\n" ); - for (;;) { - // Wait for a response - fromlen = sizeof(from); - len = recvfrom(sock, pkt, sizeof(pkt), 0, - (struct sockaddr *)&from, &fromlen); - if (len < 0) - perror("recvfrom"); - else - show_icmp(pkt, len, &from); - } -} - -// ------------------------------------------------------------------------ -static void -pingsend( int seq, struct sockaddr_in *host, - struct icmp *icmp, int icmp_len, int which ) -{ - cyg_tick_count_t *tp; - long *dp; - int i; - // Build ICMP packet for interface - icmp->icmp_type = ICMP_ECHO; - icmp->icmp_code = 0; - icmp->icmp_cksum = 0; - icmp->icmp_seq = seq; - icmp->icmp_id = uniqueid[which]; - // Set up ping data - tp = (cyg_tick_count_t *)&icmp->icmp_data; - *tp++ = cyg_current_time(); - dp = (long *)tp; - for (i = sizeof(*tp); i < icmp_len; i += sizeof(*dp)) - *dp++ = i; - - // Add checksum - icmp->icmp_cksum = inet_cksum( (u_short *)icmp, icmp_len+8); - // Send it off - if (sendto(sock, icmp, icmp_len+8, MSG_DONTWAIT, - (struct sockaddr *)host, sizeof(*host)) < 0) { - perror("sendto"); - } - pings_sent[which]++; -} - -// ------------------------------------------------------------------------ -static void -floodsend(cyg_addrword_t param) -{ - unsigned char pkt0[MAX_PACKET], pkt1[MAX_PACKET]; - - struct icmp *icmp0 = (struct icmp *)pkt0; - struct icmp *icmp1 = (struct icmp *)pkt1; - - int icmp_len = 64; - int seq; - - for (seq = 0; 1 ; seq++) { - if ( DO_DUMPSTATS( seq ) ) - dumpstats(); - -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up) - pingsend( seq, &host0, icmp0, icmp_len, 0 ); -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if (eth1_up) - pingsend( seq, &host1, icmp1, icmp_len, 1 ); -#endif - } -} - - -// ------------------------------------------------------------------------ -void -net_test(cyg_addrword_t param) -{ - struct protoent *p; - - diag_printf("Start Flood PING test\n"); - init_all_network_interfaces(); - diag_printf("Interfaces up:\n"); - cyg_kmem_print_stats(); - - TNR_INIT(); - - if ((p = getprotobyname("icmp")) == (struct protoent *)0) { - perror("getprotobyname"); - return; - } - sock = socket(AF_INET, SOCK_RAW, p->p_proto); - if (sock < 0) { - perror("tx socket"); - return; - } - -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up) { - host0.sin_family = AF_INET; - host0.sin_addr = eth0_bootp_data.bp_siaddr; - host0.sin_port = 0; - diag_printf("PING server %16s\n", inet_ntoa(host0.sin_addr)); - } -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if (eth1_up) { - host1.sin_family = AF_INET; - host1.sin_addr = eth1_bootp_data.bp_siaddr; - host1.sin_port = 0; - diag_printf("PING server %16s\n", inet_ntoa(host1.sin_addr)); - } -#endif - - cyg_thread_resume(thread_handle[1]); - cyg_thread_resume(thread_handle[2]); - - cyg_thread_delay( 100 ); // let the other threads start and print - - TNR_ON(); // then enable the test - - cyg_thread_delay( 12000 ); // run for a couple of minutes - - TNR_OFF(); - - diag_printf("After running:\n"); - dumpstats(); - TNR_PRINT_ACTIVITY(); - cyg_test_exit(); -} - -// ------------------------------------------------------------------------ -void -cyg_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - net_test, // entry - 0, // entry parameter - "Network test", // Name - &thread_stack[0][0], // Stack - STACK_SIZE, // Size - &thread_handle[0], // Handle - &thread_data[0] // Thread data structure - ); - cyg_thread_resume(thread_handle[0]); // Start it - - // Create the secondary threads - cyg_thread_create(11, // Priority - just a number - floodrecv, // entry - 0, // entry parameter - "Flood Ping Recv", // Name - &thread_stack[1][0], // Stack - STACK_SIZE, // Size - &thread_handle[1], // Handle - &thread_data[1] // Thread data structure - ); - cyg_thread_create(12, // Priority - just a number - floodsend, // entry - 0, // entry parameter - "Flood Ping Send", // Name - &thread_stack[2][0], // Stack - STACK_SIZE, // Size - &thread_handle[2], // Handle - &thread_data[2] // Thread data structure - ); - - - cyg_scheduler_start(); -} - -// EOF flood.c - diff --git a/packages/net/tcpip/current/tests/ftp_test.c b/packages/net/tcpip/current/tests/ftp_test.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/ftp_test.c +++ /dev/null @@ -1,192 +0,0 @@ -//========================================================================== -// -// tests/ftp_test.c -// -// Simple FTP test -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== -// FTP test code - -#include - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -extern void -cyg_test_exit(void); - -void -pexit(char *s) -{ - perror(s); - cyg_test_exit(); -} - -static void -ftp_test(struct bootp *bp) -{ - int s, len, slen; - struct sockaddr_in host, local; - struct servent *sent; - char buf[256]; - char _USER[] = "USER anonymous\r\n"; - char _PASS[] = "PASS none@abc.com\r\n"; - char _QUIT[] = "QUIT\r\n"; - - s = socket(AF_INET, SOCK_STREAM, 0); - if (s < 0) { - pexit("stream socket"); - } - sent = getservbyname("ftp", "tcp"); - if (sent == (struct servent *)0) { - pexit("getservbyname"); - } - // Set up host address - host.sin_family = AF_INET; - host.sin_addr = bp->bp_siaddr; - host.sin_port = sent->s_port; // Network order already - if (connect(s, (struct sockaddr *)&host, sizeof(host)) < 0) { - pexit("connect"); - } - len = sizeof(local); - if (getsockname(s, (struct sockaddr *)&local, &len) < 0) { - pexit("getsockname"); - } - diag_printf("connected to %s.%d", inet_ntoa(host.sin_addr), ntohs(host.sin_port)); - diag_printf(" as %s.%d\n", inet_ntoa(local.sin_addr), ntohs(local.sin_port)); - if ((len = read(s, buf, sizeof(buf))) < 0) { - pexit("read 1"); - } - buf[len] = '\0'; - diag_printf(">> %s", buf); - // Try and log in as 'anonymous' - slen = strlen(_USER); - if ((len = write(s, _USER, slen)) != slen) { - if (len < 0) { - pexit("write 1"); - } else { - diag_printf("wrote only %d bytes\n", len); - } - } - if ((len = read(s, buf, sizeof(buf))) < 0) { - pexit("read 1"); - } - buf[len] = '\0'; - diag_printf(">> %s", buf); - slen = strlen(_PASS); - if ((len = write(s, _PASS, slen)) != slen) { - if (len < 0) { - pexit("write 1"); - } else { - diag_printf("wrote only %d bytes\n", len); - } - } - if ((len = read(s, buf, sizeof(buf))) < 0) { - pexit("read 2"); - } - buf[len] = '\0'; - diag_printf(">> %s", buf); - slen = strlen(_QUIT); - if ((len = write(s, _QUIT, slen)) != slen) { - if (len < 0) { - pexit("write 1"); - } else { - diag_printf("wrote only %d bytes\n", len); - } - } - while ((len = read(s, buf, sizeof(buf))) > 0) { - buf[len] = '\0'; - diag_printf(">> %s", buf); - } - if (len < 0) { - perror("read 3"); - } - close(s); -} - -void -net_test(cyg_addrword_t param) -{ - diag_printf("Start FTP test\n"); - init_all_network_interfaces(); -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up) { - ftp_test(ð0_bootp_data); - } -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if (eth1_up) { - ftp_test(ð1_bootp_data); - } -#endif - cyg_test_exit(); -} - -void -cyg_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - net_test, // entry - 0, // entry parameter - "Network test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it - cyg_scheduler_start(); -} diff --git a/packages/net/tcpip/current/tests/linux_echo.c b/packages/net/tcpip/current/tests/linux_echo.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/linux_echo.c +++ /dev/null @@ -1,304 +0,0 @@ -//========================================================================== -// -// tests/linux_echo.c -// -// Simple TCP throughput test - echo component FOR LINUX HOST -// * CAUTION: host, i.e. non eCos, only * -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: This is the middle part of a three part test. The idea is -// to test the throughput of box in a configuration like this: -// -// +------+ port +----+ port +----+ -// |SOURCE|=========>|ECHO|============>|SINK| -// +------+ 9990 +----+ 9991 +----+ -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#undef _KERNEL -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#define true 1 -#define false 1 - -#define TNR_ON() -#define TNR_OFF() - -#define diag_printf printf - -void -pexit(char *s) -{ - perror(s); - exit(1); -} - - -#define SOURCE_PORT 9990 -#define SINK_PORT 9991 - -#define MAX_BUF 8192 -static unsigned char data_buf[MAX_BUF]; - -struct test_params { - long nbufs; - long bufsize; - long load; -}; - -struct test_status { - long ok; -}; - -int max( int a, int b ) { return (a>b)?a:b; } -int min( int a, int b ) { return (a -#include - -#include -#include - -void -cyg_start(void) -{ - int i; - struct mbuf *m[32]; - diag_printf("Start mbuf test\n"); - - for (i = 0; i < 32; i++) { - m[i] = m_get(M_DONTWAIT, MT_DATA); - diag_printf("allocate mbuf = %x\n", m[i]); - } - - cyg_test_exit(); -} diff --git a/packages/net/tcpip/current/tests/multi_lo_select.c b/packages/net/tcpip/current/tests/multi_lo_select.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/multi_lo_select.c +++ /dev/null @@ -1,468 +0,0 @@ -//========================================================================== -// -// tests/multi_lo_test.c -// -// Multiple selects-at-one-time test, using lo for portability. -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): sorin@netappi.com, hmt -// Contributors: gthomas,sorin@netappi.com -// Date: 2000-05-24 -// Description: -// -// This test is to test that the internal producer operation to select -// truly has broadcast semantics; there was a bug in there whereby it -// doesn't, so events get lost and/or the wrong thread is awakened. -// -// We need to create N threads selecting on different sockets -// (different ports) (including one or two selecting on several -// sockets) and have a further thread or threads which send data to -// the those sockets in an order "random" with respect to the order in -// which the N selectors entered the wait, and their thread -// priorities. -// -// If this all works, then we know that select always wakes the right -// thread in the right order. I think... -// -// I think 10 threads 0-9 where #2,#3,#6,#7 wait for multiple threads -// will do it. #0-4 will be prio HI, #5-9 will be prio LO. Sender -// thread A at prio MID will send to sockets 1,3,5,7,9. Sender thread -// B at prio LOWEST will send to sockets 0,2,4,6,8. -// -// Each sender thread will wait for a different semaphore signal -// before doing their next send, thus confirming correct ordering. -// Two common semaphores will also be signalled, one when a send -// occurs, the other when a recv happens. -// -// The master thread will start off VERYHIGHPRI, then drop after -// starting all the others, to VERYLOW... when it next runs, those -// common semaphores should both have value 10 == NLISTENERS. -// -// -//#####DESCRIPTIONEND##### -// -//========================================================================== - -#include - -#include - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif - -#define SOURCE_PORT1 9900 -#define SOURCE_PORT2 9800 // for those who listen to multiple ports -#define SOURCE_PORT3 9700 // for the dummy consumers of events - -#define PRIO_DUMMY 4 // Really high, so they're always right back there - -#define PRIO_LISTENER_HI 10 -#define PRIO_LISTENER_LO 15 - -#define PRIO_SENDER_MID 12 -#define PRIO_SENDER_LOW 17 - -#define PRIO_MASTERHIGH 3 -#define PRIO_MASTERLOW 25 - -#ifndef CYGPKG_IO_FILEIO -#if CYGPKG_IO_NFILE > 30 -#define NLISTENERS 10 -#else -// fewer threads if not many sockets available -#define NLISTENERS (CYGPKG_IO_NFILE/3) -#endif -#else -#if CYGNUM_FILEIO_NFD > 30 -#define NLISTENERS 10 -#else -// fewer threads if not many sockets available -#define NLISTENERS (CYGNUM_FILEIO_NFD/3) -#endif -#endif - -#define NDUMMIES 10 - -#define NSENDERS 2 - -#define NUM_BUF NLISTENERS -#define MAX_BUF 100 - -// buffers for receiving into: -static unsigned char data_buf1[NUM_BUF][MAX_BUF]; - -static unsigned char data_buf_write1[]="Client is alive"; - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL) -#define MASTER_STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) - -static char stack_master[MASTER_STACK_SIZE]; -static cyg_thread master_thread_data; -static cyg_handle_t master_thread_handle; - -static char stack_dummy[NDUMMIES][STACK_SIZE]; -static cyg_thread dummy_thread_data[NDUMMIES]; -static cyg_handle_t dummy_thread_handle[NDUMMIES]; - -static char stack_listener[NLISTENERS][STACK_SIZE]; -static cyg_thread listener_thread_data[NLISTENERS]; -static cyg_handle_t listener_thread_handle[NLISTENERS]; - -static char stack_sender[NSENDERS][STACK_SIZE]; -static cyg_thread sender_thread_data[NSENDERS]; -static cyg_handle_t sender_thread_handle[NSENDERS]; - -static cyg_sem_t listen_sema[NLISTENERS]; - -static cyg_sem_t send_sema; -static cyg_sem_t recv_sema; - -static cyg_thread_entry_t master; -static cyg_thread_entry_t listener; -static cyg_thread_entry_t sender; - -// ------------------------------------------------------------------------ - -void -pexit(char *s) -{ - CYG_TEST_FAIL_FINISH( s ); -} - - -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -// ------------------------------------------------------------------------ - -void dummy( cyg_addrword_t which ) -{ - // Share the same socket... we appear to run out otherwise. - static int s_s1 = -1; - static struct sockaddr_in local; - - // locals... - fd_set in_fds; - int num; - - CYG_TEST_CHECK( 0 <= which, "which under" ); - CYG_TEST_CHECK( NDUMMIES > which, "which over" ); - - diag_printf( "Dummy %d alive\n", which ); - - if ( s_s1 < 0 ) { - s_s1 = socket(AF_INET, SOCK_STREAM, 0); - if (s_s1 < 0) { - pexit("stream socket 1"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_len = sizeof(local); - local.sin_port = ntohs(SOURCE_PORT3 + which); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - if(bind(s_s1, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("dummy bind /source_1/ error"); - } - listen(s_s1, SOMAXCONN); - } - - while (true) { - FD_ZERO(&in_fds); - FD_SET(s_s1, &in_fds); - num = select( s_s1+1, &in_fds,0,0,0); - - if (FD_ISSET(s_s1,&in_fds)) { - CYG_TEST_FAIL( "Activity on dummy port!" ); - } - } /* while (true) */ -} - -// ------------------------------------------------------------------------ - -void listener( cyg_addrword_t which ) -{ - int s_s1 = -1, e_s1 = 0, s_s2 = -1, e_s2 = 0; - struct sockaddr_in e_s1_addr,e_s2_addr,local; - fd_set in_fds; - int len; - int num; - - // do we select on multiple sources? - int dual = (3 == (which & 3)) || (2 == (which & 3)); - // then which is 2,3,6,7 so set up a 2nd listener - - CYG_TEST_CHECK( 0 <= which, "which under" ); - CYG_TEST_CHECK( NLISTENERS > which, "which over" ); - - diag_printf( "Listener %d alive [%s]\n", which, dual ? "dual" : "single" ); - - s_s1 = socket(AF_INET, SOCK_STREAM, 0); - if (s_s1 < 0) { - pexit("stream socket 1"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_len = sizeof(local); - local.sin_port = ntohs(SOURCE_PORT1 + which); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - if(bind(s_s1, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind /source_1/ error"); - } - listen(s_s1, SOMAXCONN); - - if ( dual ) { - s_s2 = socket(AF_INET, SOCK_STREAM, 0); - if (s_s2 < 0) { - pexit("stream socket 2"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_len = sizeof(local); - local.sin_port = ntohs(SOURCE_PORT2 + which); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - if(bind(s_s2, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind /source_2/ error"); - } - listen(s_s2, SOMAXCONN); - } - - while (true) { - FD_ZERO(&in_fds); - FD_SET(s_s1, &in_fds); - if ( dual ) - FD_SET(s_s2, &in_fds); - num = select ( max(s_s1,s_s2)+1, &in_fds,0,0,0); - - if (FD_ISSET(s_s1,&in_fds)) { - len = sizeof(e_s1_addr); - if ((e_s1 = accept(s_s1,(struct sockaddr *)&e_s1_addr,&len))<0) { - pexit("accept /source_1/"); - } - diag_printf("TCP SERVER connection from %s: %d\n", - inet_ntoa(e_s1_addr.sin_addr),ntohs(e_s1_addr.sin_port)); - } - - if ( dual ) { - if (FD_ISSET(s_s2,&in_fds)) { - len = sizeof(e_s2_addr); - if ((e_s2 = accept(s_s2,(struct sockaddr *)&e_s2_addr,&len))<0) { - pexit("accept /source_2/"); - } - diag_printf("TCP SERVER connection from %s: %d\n", - inet_ntoa(e_s2_addr.sin_addr), ntohs(e_s2_addr.sin_port)); - } - } - if ((e_s1 != 0) || ( e_s2 != 0)) { - break; - } - } /* while (true) */ - - CYG_TEST_CHECK( 0 != e_s1, "No connection made on s1!" ); - - if ((len = read(e_s1, data_buf1[which], MAX_BUF)) < 0 ) { - perror("I/O error s1"); - CYG_TEST_FAIL( "Read s1 failed" ); - } - diag_printf("Listener %d: %s\n", which, data_buf1[which]); - - close( s_s1 ); - if ( dual ) - close( s_s2 ); - if ( 0 != e_s1 ) - close ( e_s1 ); - if ( 0 != e_s2 ) - close ( e_s2 ); - - cyg_semaphore_post( &listen_sema[which] ); // Verify that I was here - cyg_semaphore_post( &recv_sema ); // Count receptions - - cyg_thread_exit(); // explicitly -} - -// ------------------------------------------------------------------------ -static void sender( cyg_addrword_t which ) // which means which set (odd/even) here... -{ - int s_source; - struct sockaddr_in local; - int len; - - diag_printf("client %d [%s] :started\n", which, (which & 1) ? "odd" : "even" ); - - for ( /* which as is */; which < NLISTENERS; which += 2 ) { - - s_source = socket(AF_INET, SOCK_STREAM, 0); - if (s_source < 0) { - pexit("stream socket"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = htons( SOURCE_PORT1 + which ); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (connect(s_source, (struct sockaddr *)&local, sizeof(local)) < 0) { - pexit("Can't connect to target"); - } - - if ((len = write(s_source,data_buf_write1,sizeof(data_buf_write1) )) < 0) { - CYG_TEST_FAIL_FINISH("Error writing buffer"); - } - cyg_semaphore_wait( &listen_sema[which] ); // wait for the appropriate semaphore "reply" - cyg_semaphore_post( &send_sema ); // count up successful sends - - close ( s_source ); - } - cyg_thread_exit(); // explicitly -} - - -static void -master(cyg_addrword_t param) -{ - int i; - cyg_handle_t self = cyg_thread_self(); - - cyg_semaphore_init( &send_sema, 0 ); - cyg_semaphore_init( &recv_sema, 0 ); - - for ( i = 0 ; i < NLISTENERS; i++ ) - cyg_semaphore_init( &listen_sema[i], 0 ); - - init_all_network_interfaces(); - CYG_TEST_INFO("Start multiple loopback select test"); -#if NLOOP > 0 - // We are currently running at high prio, so we can just go and make - // loads of threads: - - // Some at higher prio - for ( i = 0; i < NLISTENERS/2; i++ ) - cyg_thread_create(PRIO_LISTENER_HI, // Priority - listener, // entry - i, // entry parameter - "listener", // Name - &stack_listener[i][0], // Stack - STACK_SIZE, // Size - &listener_thread_handle[i], // Handle - &listener_thread_data[i] // Thread data structure - ); - // the rest at lower prio - for ( ; i < NLISTENERS ; i++ ) - cyg_thread_create(PRIO_LISTENER_LO, // Priority - listener, // entry - i, // entry parameter - "listener", // Name - &stack_listener[i][0], // Stack - STACK_SIZE, // Size - &listener_thread_handle[i], // Handle - &listener_thread_data[i] // Thread data structure - ); - - // make the dummy event-grabber threads - for ( i = 0; i < NDUMMIES; i++ ) - cyg_thread_create(PRIO_DUMMY, // Priority - dummy, // entry - i, // entry parameter - "dummy", // Name - &stack_dummy[i][0], // Stack - STACK_SIZE, // Size - &dummy_thread_handle[i], // Handle - &dummy_thread_data[i] // Thread data structure - ); - - // Start those threads - for ( i = 0; i < NLISTENERS; i++ ) - cyg_thread_resume(listener_thread_handle[i]); - for ( i = 0; i < NDUMMIES; i++ ) - cyg_thread_resume( dummy_thread_handle[i]); - - // and let them start up and start listening... - cyg_thread_set_priority( self, PRIO_MASTERLOW ); - CYG_TEST_INFO("All listeners should be go now"); - cyg_thread_set_priority( self, PRIO_MASTERHIGH ); - - for ( i = 0; i < NSENDERS; i++ ) { - cyg_thread_create( (0 == i) - ?PRIO_SENDER_MID - : PRIO_SENDER_LOW, // Priority - sender, // entry - i, // entry parameter - "sender", // Name - &stack_sender[i][0], // Stack - STACK_SIZE, // Size - &sender_thread_handle[i], // Handle - &sender_thread_data[i] // Thread data structure - ); - cyg_thread_resume(sender_thread_handle[i]); - } - - // Now we are still higher priority; so go low and let everyone else - // have their head. When we next run after this, it should all be - // over. - cyg_thread_set_priority( self, PRIO_MASTERLOW ); - - cyg_semaphore_peek( &recv_sema, &i ); - CYG_TEST_CHECK( NLISTENERS == i, "Not enough recvs occurred!" ); - - cyg_semaphore_peek( &send_sema, &i ); - CYG_TEST_CHECK( NLISTENERS == i, "Not enough sends occurred!" ); - - CYG_TEST_PASS_FINISH("Master returned OK"); -#endif - CYG_TEST_NA( "No loopback devs" ); -} - -void -cyg_user_start(void) -{ - CYG_TEST_INIT(); - - cyg_thread_create(PRIO_MASTERHIGH, // Priority - master, // entry - 0, // entry parameter - "master", // Name - &stack_master[0], // Stack - MASTER_STACK_SIZE, // Size - &master_thread_handle, // Handle - &master_thread_data // Thread data structure - ); - cyg_thread_resume(master_thread_handle); // Start it -} - -// EOF multi_lo_select.c diff --git a/packages/net/tcpip/current/tests/nc_test_framework.h b/packages/net/tcpip/current/tests/nc_test_framework.h deleted file mode 100644 --- a/packages/net/tcpip/current/tests/nc_test_framework.h +++ /dev/null @@ -1,187 +0,0 @@ -//========================================================================== -// -// tests/nc_test_framework.h -// -// Network characterization tests framework -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#ifndef _TESTS_NC_TEST_FRAMEWORK_H_ -#define _TESTS_NC_TEST_FRAMEWORK_H_ - -#ifdef __ECOS -#include -#else -#undef _KERNEL -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#endif - -#ifdef __ECOS -#define test_printf diag_printf -typedef cyg_addrword_t test_param_t; -#else -#define test_printf printf -typedef void *test_param_t; -#endif - -#ifndef true -#define false 0 -#define true 1 -#endif - -#define NC_SLAVE_PORT 7777 -#define NC_MASTER_PORT 7776 - -#define NC_TESTING_SLAVE_PORT 8770 -#define NC_TESTING_MASTER_PORT 8771 - -// -// The basic idea behind this test structure is that one end will run -// in "slave" mode and the other in "master" mode. Typically, the slave -// will run on a target platform with the master running on a host. -// -// The slave starts up by listening for a connection on the "SLAVE_PORT". -// In order for the testing to require the minimum stack support, this -// connection (and the protocol) will use UDP. -// -// The master will connect to the slave and send it a request over this -// connection. Once the slave accepts the request, then master and slave -// will execute the operation, typically a test. The control connection -// will remain active until the master sends a 'disconnect' request. The -// control connection will be broken after the reply to this request has -// been sent. -// - -#define MAX_ERRORS 5 // Give up after this many errors - -#define NC_REPLY_TIMEOUT 10 // The slave may be slow -#define NC_TEST_TIMEOUT 3 // More generous for tests -#define NC_RESULTS_TIMEOUT (MAX_ERRORS+2)*NC_TEST_TIMEOUT - -struct nc_request { - int type; // Description of request - int seq; // Sequence number, used to build response - int nbufs; // Number of "buffers" to send - int buflen; // Length of each buffer - int slave_port; // Network ports to use - int master_port; - int timeout; // Max time to wait for any packet -}; - -#define NC_REQUEST_DISCONNECT 0x0001 -#define NC_REQUEST_UDP_SEND 0x0010 // Slave to send UDP data -#define NC_REQUEST_UDP_RECV 0x0011 // Slave to receive UDP data -#define NC_REQUEST_UDP_ECHO 0x0012 // Master->slave->master -#define NC_REQUEST_TCP_SEND 0x0020 // Slave to send TCP data -#define NC_REQUEST_TCP_RECV 0x0021 // Slave to receive TCP data -#define NC_REQUEST_TCP_ECHO 0x0022 // Master->slave->master -#define NC_REQUEST_START_IDLE 0x0100 // Start some idle processing -#define NC_REQUEST_STOP_IDLE 0x0101 // Stop idle processing -#define NC_REQUEST_SET_LOAD 0x0200 // Set the background load level - -struct nc_reply { - int response; // ACK or NAK - int seq; // Must match request - int reason; // If NAK, why request turned down - union { // Miscellaneous data, depending on request - struct { - long elapsed_time; // In 10ms "ticks" - long count[2]; // Result - } idle_results; - } misc; -}; - -#define NC_REPLY_ACK 0x0001 // Request accepted -#define NC_REPLY_NAK 0x0000 // Request denied - -#define NC_REPLY_NAK_UNKNOWN_REQUEST 0x0001 -#define NC_REPLY_NAK_BAD_REQUEST 0x0002 // Slave can't handle -#define NC_REPLY_NAK_NO_BACKGROUND 0x0003 // Slave can't do background/idle - -// -// Test data 'packets' look like this - -struct nc_test_data { - long key1; - int seq; - int len; - long key2; - char data[0]; // Actual data -}; - -#define NC_TEST_DATA_KEY1 0xC0DEADC0 -#define NC_TEST_DATA_KEY2 0xC0DEADC1 - -struct nc_test_results { - long key1; // Identify uniquely as a response record - int seq; // Matches request - int nsent; - int nrecvd; - long key2; // Additional verification -}; - -#define NC_TEST_RESULT_KEY1 0xDEADC0DE -#define NC_TEST_RESULT_KEY2 0xDEADC1DE - -#endif // _TESTS_NC_TEST_FRAMEWORK_H_ - - - diff --git a/packages/net/tcpip/current/tests/nc_test_master.c b/packages/net/tcpip/current/tests/nc_test_master.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/nc_test_master.c +++ /dev/null @@ -1,728 +0,0 @@ -//========================================================================== -// -// tests/nc_test_master.c -// -// Network characterizations test (master portion) -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// Network characterization test code - master portion - -#include "nc_test_framework.h" - -#ifdef __ECOS -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; -#endif - -struct test_params { - int argc; - char **argv; -}; - -#define MAX_BUF 8192 -static unsigned char in_buf[MAX_BUF], out_buf[MAX_BUF]; - -static int test_seq = 1; -static long long idle_count; -static long idle_ticks; -#define IDLE_TEST_TIME 10 - -struct pause { - int pause_ticks; - int pause_threshold; -}; -#define LENGTH(x) (sizeof(x)/sizeof(x[0])) - -#ifdef __ECOS -extern void -cyg_test_exit(void); -#else -void -cyg_test_exit(void) -{ - test_printf("... Done\n"); - exit(1); -} -#endif - -#ifdef __ECOS -static void -test_delay(int ticks) -{ - cyg_thread_delay(ticks); -} - -#else - -static void -test_delay(int ticks) -{ - usleep(ticks * 10000); -} -#endif - -void -pexit(char *s) -{ - perror(s); - cyg_test_exit(); -} - -#ifdef __ECOS -#ifndef CYGPKG_SNMPLIB -int -gettimeofday(struct timeval *tv, struct timezone *tz) -{ - cyg_tick_count_t cur_time; - cur_time = cyg_current_time(); - tv->tv_sec = cur_time / 100; - tv->tv_usec = (cur_time % 100) * 10000; -} -#else -int -gettimeofday(struct timeval *tv, struct timezone *tz); -#endif -#endif -void -show_results(const char *msg, struct timeval *start, - struct timeval *end, int nbufs, int buflen, - int lost, int seq_errors) -{ - struct timeval tot_time; -#ifndef __ECOS - double real_time, thru; - long tot_bytes = nbufs * buflen; -#endif - timersub(end, start, &tot_time); - test_printf("%s - %d bufs of %d bytes in %d.%02d seconds", - msg, nbufs, buflen, - tot_time.tv_sec, tot_time.tv_usec / 10000); -#ifndef __ECOS - real_time = tot_time.tv_sec + ((tot_time.tv_usec / 10000) * .01); - // Compute bytes / second (rounded up) - thru = tot_bytes / real_time; - // Convert to Mb / second - test_printf(" - %.2f KB/S", thru / 1024.0); - test_printf(" - %.4f Mbit/S (M = 10^6)", thru * 8.0 / 1000000.0); -#endif - if (lost) { - test_printf(", %d lost", lost); - } - if (seq_errors) { - test_printf(", %d out of sequence", seq_errors); - } - test_printf("\n"); -} - -void -new_test(void) -{ - test_seq++; -} - -int -nc_message(int s, struct nc_request *req, - struct nc_reply *reply, struct sockaddr_in *slave) -{ - int len; - fd_set fds; - struct timeval timeout; - len = sizeof(*slave); - req->seq = htonl(test_seq); - if (sendto(s, req, sizeof(*req), 0, (struct sockaddr *)slave, len) < 0) { - perror("sendto"); - return false; - } - FD_ZERO(&fds); - FD_SET(s, &fds); - timeout.tv_sec = NC_REPLY_TIMEOUT; - timeout.tv_usec = 0; - if (select(s+1, &fds, 0, 0, &timeout) <= 0) { - test_printf("No response to command\n"); - return false; - } - if (recvfrom(s, reply, sizeof(*reply), 0, 0, 0) < 0) { - perror("recvfrom"); - return false; - } - if (reply->seq != req->seq) { - test_printf("Response out of order - sent: %d, recvd: %d\n", - ntohl(req->seq), ntohl(reply->seq)); - return false; - } - return true; -} - -void -show_test_results(struct nc_test_results *results) -{ - if ((ntohl(results->key1) == NC_TEST_RESULT_KEY1) && - (ntohl(results->key2) == NC_TEST_RESULT_KEY2) && - (ntohl(results->seq) == test_seq)) { - test_printf(" slave sent %d, recvd %d\n", - ntohl(results->nsent), ntohl(results->nrecvd)); - } else { - test_printf(" ... invalid results - keys: %x/%x, seq: %d/%d\n", - ntohl(results->key1), ntohl(results->key2), - ntohl(results->seq), test_seq); - } -} - -void -do_udp_test(int s1, int type, struct sockaddr_in *slave, - int nbufs, int buflen, int pause_time, int pause_threshold) -{ - int i, s, td_len, seq, seq_errors, total_packets; - struct sockaddr_in test_chan_master, test_chan_slave; - struct timeval start_time, end_time; - struct nc_request req; - struct nc_reply reply; - struct nc_test_results results; - struct nc_test_data *tdp; - fd_set fds; - struct timeval timeout; - int lost_packets = 0; - int need_send, need_recv; - const char *type_name; - int pkt_ctr = 0; - - need_recv = true; need_send = true; type_name = "UDP echo"; - switch (type) { - case NC_REQUEST_UDP_RECV: - need_recv = false; - need_send = true; - type_name = "UDP recv"; - break; - case NC_REQUEST_UDP_SEND: - need_recv = true; - need_send = false; - type_name = "UDP send"; - break; - case NC_REQUEST_UDP_ECHO: - break; - } - - new_test(); - req.type = htonl(type); - req.nbufs = htonl(nbufs); - req.buflen = htonl(buflen); - req.slave_port = htonl(NC_TESTING_SLAVE_PORT); - req.master_port = htonl(NC_TESTING_MASTER_PORT); - nc_message(s1, &req, &reply, slave); - if (reply.response != ntohl(NC_REPLY_ACK)) { - test_printf("Slave denied %s [%d,%d] test\n", type_name, nbufs, buflen); - return; - } - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - pexit("datagram socket"); - } - - memset(&test_chan_master, 0, sizeof(test_chan_master)); - test_chan_master.sin_family = AF_INET; -#ifdef __ECOS - test_chan_master.sin_len = sizeof(test_chan_master); -#endif - test_chan_master.sin_port = htons(ntohl(req.master_port)); - test_chan_master.sin_addr.s_addr = INADDR_ANY; - - if (bind(s, (struct sockaddr *) &test_chan_master, sizeof(test_chan_master)) < 0) { - perror("bind"); - close(s); - return; - } - test_printf("Start %s [%d,%d]", type_name, nbufs, buflen); - if (pause_time) { - test_printf(" - %dms delay after %d packet%s\n", pause_time*10, - pause_threshold, pause_threshold > 1 ? "s" : ""); - } else { - test_printf(" - no delays\n"); - } - - gettimeofday(&start_time, 0); - memcpy(&test_chan_slave, slave, sizeof(*slave)); - test_chan_slave.sin_port = htons(ntohl(req.slave_port)); - seq = 0; seq_errors = 0; total_packets = 0; - for (i = 0; i < nbufs; i++) { - td_len = buflen + sizeof(struct nc_test_data); - if (need_send) { - tdp = (struct nc_test_data *)out_buf; - tdp->key1 = htonl(NC_TEST_DATA_KEY1); - tdp->key2 = htonl(NC_TEST_DATA_KEY2); - tdp->seq = htonl(i); - tdp->len = htonl(td_len); - if (sendto(s, tdp, td_len, 0, - (struct sockaddr *)&test_chan_slave, sizeof(test_chan_slave)) < 0) { - perror("sendto"); - close(s); - return; - } - total_packets++; - } - if (need_recv) { - FD_ZERO(&fds); - FD_SET(s, &fds); - timeout.tv_sec = NC_TEST_TIMEOUT; - timeout.tv_usec = 0; - if (select(s+1, &fds, 0, 0, &timeout) <= 0) { - test_printf("Slave timed out after %d buffers\n", i); - lost_packets++; - } else { - tdp = (struct nc_test_data *)in_buf; - if (recvfrom(s, tdp, td_len, 0, 0, 0) < 0) { - perror("recvfrom"); - close(s); - return; - } - if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && - (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { - if (ntohl(tdp->seq) != seq) { - test_printf("Packets out of sequence - recvd: %d, expected: %d\n", - ntohl(tdp->seq), seq); - seq_errors++; - if (!need_send) { - // Reset sequence to what the slave wants - seq = ntohl(tdp->seq); - } - } - } else { - test_printf("Bad data packet - key: %x/%x, seq: %d\n", - ntohl(tdp->key1), ntohl(tdp->key2), - ntohl(tdp->seq)); - } - total_packets++; - } - seq++; - if (seq == nbufs) { - break; - } - if (pause_time && (++pkt_ctr == pause_threshold)) { - pkt_ctr = 0; - test_delay(pause_time); - } - } - } - gettimeofday(&end_time, 0); - show_results(type_name, &start_time, &end_time, total_packets, buflen, - lost_packets, seq_errors); - // Fetch results record - FD_ZERO(&fds); - FD_SET(s, &fds); - timeout.tv_sec = NC_RESULTS_TIMEOUT; - timeout.tv_usec = 0; - if (select(s+1, &fds, 0, 0, &timeout) <= 0) { - test_printf("No results record sent\n"); - } else { - if (recvfrom(s, &results, sizeof(results), 0, 0, 0) < 0) { - perror("recvfrom"); - } - show_test_results(&results); - } - close(s); -} - -// -// Read data from a stream, accounting for the fact that packet 'boundaries' -// are not preserved. This can also timeout (which would probably wreck the -// data boundaries). -// - -int -do_read(int fd, void *buf, int buflen) -{ - char *p = (char *)buf; - int len = buflen; - int res; - while (len) { - res = read(fd, p, len); - if (res < 0) { - perror("read"); - } else { - len -= res; - p += res; - if (res == 0) { - break; - } - } - } - return (buflen - len); -} - -void -do_tcp_test(int s1, int type, struct sockaddr_in *slave, - int nbufs, int buflen, int pause_time, int pause_threshold) -{ - int i, s, td_len, seq, seq_errors, total_packets, res; - struct sockaddr_in test_chan_slave; - struct timeval start_time, end_time; - struct nc_request req; - struct nc_reply reply; - struct nc_test_results results; - struct nc_test_data *tdp; - int lost_packets = 0; - int conn_failures = 0; - int need_send, need_recv; - const char *type_name; - int pkt_ctr = 0; - - need_recv = true; need_send = true; type_name = "TCP echo"; - switch (type) { - case NC_REQUEST_TCP_RECV: - need_recv = false; - need_send = true; - type_name = "TCP recv"; - break; - case NC_REQUEST_TCP_SEND: - need_recv = true; - need_send = false; - type_name = "TCP send"; - break; - case NC_REQUEST_TCP_ECHO: - break; - } - - new_test(); - req.type = htonl(type); - req.nbufs = htonl(nbufs); - req.buflen = htonl(buflen); - req.slave_port = htonl(NC_TESTING_SLAVE_PORT); - req.master_port = htonl(NC_TESTING_MASTER_PORT); - nc_message(s1, &req, &reply, slave); - if (reply.response != ntohl(NC_REPLY_ACK)) { - test_printf("Slave denied %s [%d,%d] test\n", type_name, nbufs, buflen); - return; - } - - s = socket(AF_INET, SOCK_STREAM, 0); - if (s < 0) { - pexit("datagram socket"); - } - - test_printf("Start %s [%d,%d]", type_name, nbufs, buflen); - if (pause_time) { - test_printf(" - %dms delay after %d packet%s\n", pause_time*10, - pause_threshold, pause_threshold > 1 ? "s" : ""); - } else { - test_printf(" - no delays\n"); - } - - test_delay(3*100); - memcpy(&test_chan_slave, slave, sizeof(*slave)); - test_chan_slave.sin_port = htons(ntohl(req.slave_port)); - while (connect(s, (struct sockaddr *)&test_chan_slave, sizeof(*slave)) < 0) { - perror("Can't connect to slave"); - if (++conn_failures > MAX_ERRORS) { - test_printf("Too many connection failures - giving up\n"); - return; - } - if (errno == ECONNREFUSED) { - // Give the slave a little time - test_delay(100); // 1 second - } else { - return; - } - } - - gettimeofday(&start_time, 0); - seq = 0; seq_errors = 0; total_packets = 0; - for (i = 0; i < nbufs; i++) { - td_len = buflen + sizeof(struct nc_test_data); - if (need_send) { - tdp = (struct nc_test_data *)out_buf; - tdp->key1 = htonl(NC_TEST_DATA_KEY1); - tdp->key2 = htonl(NC_TEST_DATA_KEY2); - tdp->seq = htonl(i); - tdp->len = htonl(td_len); - if (write(s, tdp, td_len) != td_len) { - perror("sendto"); - close(s); - return; - } - total_packets++; - } - if (need_recv) { - tdp = (struct nc_test_data *)in_buf; - res = do_read(s, tdp, td_len); - if (res != td_len) { - test_printf("Slave timed out after %d buffers\n", i); - lost_packets++; - } else { - if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && - (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { - if (ntohl(tdp->seq) != seq) { - test_printf("Packets out of sequence - recvd: %d, expected: %d\n", - ntohl(tdp->seq), seq); - seq_errors++; - if (!need_send) { - // Reset sequence to what the slave wants - seq = ntohl(tdp->seq); - } - } - } else { - test_printf("Bad data packet - key: %x/%x, seq: %d\n", - ntohl(tdp->key1), ntohl(tdp->key2), - ntohl(tdp->seq)); - } - total_packets++; - } - seq++; - if (seq == nbufs) { - break; - } - if (pause_time && (++pkt_ctr == pause_threshold)) { - pkt_ctr = 0; - test_delay(pause_time); - } - } - } - gettimeofday(&end_time, 0); - show_results(type_name, &start_time, &end_time, total_packets, buflen, - lost_packets, seq_errors); - // Fetch results record - if (do_read(s, &results, sizeof(results)) != sizeof(results)) { - test_printf("No results record sent\n"); - } else { - show_test_results(&results); - } - close(s); -} - -int -do_set_load(int s, struct sockaddr_in *slave, int load_level) -{ - struct nc_request req; - struct nc_reply reply; - req.type = htonl(NC_REQUEST_SET_LOAD); - req.nbufs = htonl(load_level); - nc_message(s, &req, &reply, slave); - return (reply.response == ntohl(NC_REPLY_ACK)); -} - -int -do_start_idle(int s, struct sockaddr_in *slave) -{ - struct nc_request req; - struct nc_reply reply; - req.type = htonl(NC_REQUEST_START_IDLE); - nc_message(s, &req, &reply, slave); - return (reply.response == ntohl(NC_REPLY_ACK)); -} - -void -do_stop_idle(int s, struct sockaddr_in *slave, int calibrate) -{ - struct nc_request req; - struct nc_reply reply; - long long res_idle_count; - long long adj_count; - int idle, res_idle_ticks; - req.type = htonl(NC_REQUEST_STOP_IDLE); - nc_message(s, &req, &reply, slave); - if (reply.response == ntohl(NC_REPLY_ACK)) { - res_idle_ticks = ntohl(reply.misc.idle_results.elapsed_time); - res_idle_count = ((long long)ntohl(reply.misc.idle_results.count[0]) << 32) | - ntohl(reply.misc.idle_results.count[1]); - test_printf("IDLE - ticks: %d, count: %ld", - res_idle_ticks, res_idle_count); - if (calibrate) { - idle_count = res_idle_count; - idle_ticks = res_idle_ticks; - } else { - adj_count = res_idle_count / res_idle_ticks; - adj_count *= idle_ticks; - idle = (int) ((adj_count * 100) / idle_count); - test_printf(", %d%% idle", idle); - } - test_printf("\n"); - } else { - test_printf("Slave failed on IDLE\n"); - } -} - -void -do_disconnect(int s, struct sockaddr_in *slave) -{ - struct nc_request req; - struct nc_reply reply; - req.type = htonl(NC_REQUEST_DISCONNECT); - nc_message(s, &req, &reply, slave); -} - -static void -nc_master(struct test_params *p) -{ - int s, i; - struct sockaddr_in slave, my_addr; - struct hostent *host; - struct pause pause_times[] = { - {0,0}, {1,10}, {5,10}, {10,10}, {1,1} }; - - if (p->argc != 2) { - test_printf("Need exactly 'master '\n"); - return; - } - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - pexit("datagram socket"); - } - - memset(&my_addr, 0, sizeof(my_addr)); - my_addr.sin_family = AF_INET; -#ifdef __ECOS - my_addr.sin_len = sizeof(my_addr); -#endif - my_addr.sin_port = htons(NC_MASTER_PORT); - my_addr.sin_addr.s_addr = INADDR_ANY; - - if (bind(s, (struct sockaddr *) &my_addr, sizeof(my_addr)) < 0) { - pexit("bind"); - } - - host = gethostbyname(p->argv[1]); - if (host == (struct hostent *)NULL) { - pexit("gethostbyname"); - } - - memset(&slave, 0, sizeof(slave)); - slave.sin_family = AF_INET; -#ifdef __ECOS - slave.sin_len = sizeof(slave); -#endif - slave.sin_port = htons(NC_SLAVE_PORT); - memcpy(&slave.sin_addr.s_addr, host->h_addr, host->h_length); - - test_printf("================== No load, master at 100%% ========================\n"); - do_udp_test(s, NC_REQUEST_UDP_ECHO, &slave, 640, 1024, 0, 0); - do_udp_test(s, NC_REQUEST_UDP_SEND, &slave, 640, 1024, 0, 0); - do_udp_test(s, NC_REQUEST_UDP_RECV, &slave, 640, 1024, 0, 0); - do_tcp_test(s, NC_REQUEST_TCP_ECHO, &slave, 640, 1024, 0, 0); - do_tcp_test(s, NC_REQUEST_TCP_SEND, &slave, 640, 1024, 0, 0); - do_tcp_test(s, NC_REQUEST_TCP_RECV, &slave, 640, 1024, 0, 0); - do_tcp_test(s, NC_REQUEST_TCP_ECHO, &slave, 64, 10240, 0, 0); - - if (do_set_load(s, &slave, 0)) { - test_printf("\n====================== Various slave compute loads ===================\n"); - for (i = 0; i < 60; i += 10) { - test_printf(">>>>>>>>>>>> slave processing load at %d%%\n", i); - do_set_load(s, &slave, i); - do_udp_test(s, NC_REQUEST_UDP_ECHO, &slave, 2048, 1024, 0, 0); - do_tcp_test(s, NC_REQUEST_TCP_ECHO, &slave, 2048, 1024, 0, 0); - } - } - - if (do_start_idle(s, &slave)) { - test_printf("\n====================== Various master loads ===================\n"); - test_printf("Testing IDLE for %d seconds\n", IDLE_TEST_TIME); - test_delay(IDLE_TEST_TIME*100); - do_stop_idle(s, &slave, true); - for (i = 0; i < LENGTH(pause_times); i++) { - do_start_idle(s, &slave); - do_udp_test(s, NC_REQUEST_UDP_ECHO, &slave, 2048, 1024, - pause_times[i].pause_ticks, pause_times[i].pause_threshold); - do_stop_idle(s, &slave, false); - do_start_idle(s, &slave); - do_tcp_test(s, NC_REQUEST_TCP_ECHO, &slave, 2048, 1024, - pause_times[i].pause_ticks, pause_times[i].pause_threshold); - do_stop_idle(s, &slave, false); - } - } - - do_disconnect(s, &slave); - close(s); -} - -void -net_test(test_param_t p) -{ - test_printf("Start Network Characterization - MASTER\n"); -#ifdef __ECOS - init_all_network_interfaces(); -#endif - nc_master((struct test_params *)p); - cyg_test_exit(); -} - -#ifdef __ECOS -void -cyg_start(void) -{ - static struct test_params p; - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - net_test, // entry - (cyg_addrword_t)&p,// entry parameter - "Network test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it - cyg_scheduler_start(); -} - -#else - -int -main(int argc, char *argv[]) -{ - struct test_params p; - p.argc = argc; - p.argv = argv; - net_test(&p); -} -#endif diff --git a/packages/net/tcpip/current/tests/nc_test_slave.c b/packages/net/tcpip/current/tests/nc_test_slave.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/nc_test_slave.c +++ /dev/null @@ -1,781 +0,0 @@ -//========================================================================== -// -// tests/nc_test_slave.c -// -// Network characterizations test (slave portion) -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// Network characterization test code - slave portion - -#include "nc_test_framework.h" -#include - -#ifdef __ECOS -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -#define MAX_LOAD_THREAD_LEVEL 20 -#define MIN_LOAD_THREAD_LEVEL 0 -#define NUM_LOAD_THREADS 10 -#define IDLE_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY+3 -#define LOAD_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-1 -#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-2 -#define DESIRED_BACKGROUND_LOAD 20 -static char main_thread_stack[CYGHWR_NET_DRIVERS][STACK_SIZE]; -static cyg_thread main_thread_data[CYGHWR_NET_DRIVERS]; -static cyg_handle_t main_thread_handle[CYGHWR_NET_DRIVERS]; -static char idle_thread_stack[STACK_SIZE]; -static cyg_thread idle_thread_data; -static cyg_handle_t idle_thread_handle; -static cyg_sem_t idle_thread_sem; -volatile static long long idle_thread_count; -static cyg_tick_count_t idle_thread_start_time; -static cyg_tick_count_t idle_thread_stop_time; -static char load_thread_stack[NUM_LOAD_THREADS][STACK_SIZE]; -static cyg_thread load_thread_data[NUM_LOAD_THREADS]; -static cyg_handle_t load_thread_handle[NUM_LOAD_THREADS]; -static cyg_sem_t load_thread_sem[NUM_LOAD_THREADS]; -static long load_thread_level; -static void calibrate_load(int load); -static void start_load(int load); -static void do_some_random_computation(int p); -#define abs(n) ((n) < 0 ? -(n) : (n)) -#endif - -#ifdef __ECOS -#define test_param_t cyg_addrword_t -#ifdef CYGDBG_NET_TIMING_STATS -extern void show_net_times(void); -#endif -#else -#define test_param_t int -#endif - -#define MAX_BUF 8192 -static unsigned char in_buf[MAX_BUF], out_buf[MAX_BUF]; - -#ifdef __ECOS -extern void -cyg_test_exit(void); -#else -void -cyg_test_exit(void) -{ - test_printf("... Done\n"); - exit(1); -} - -static void -show_net_times(void) -{ -} -#endif - -#ifdef __ECOS -static void -test_delay(int ticks) -{ - cyg_thread_delay(ticks); -} - -#else - -static void -test_delay(int ticks) -{ - usleep(ticks * 10000); -} -#endif - -void -pexit(char *s) -{ - perror(s); -#ifdef CYGDBG_NET_TIMING_STATS - show_net_times(); -#endif - cyg_test_exit(); -} - -// -// Generic UDP test -// - -static void -do_udp_test(int s1, struct nc_request *req, struct sockaddr_in *master) -{ - int i, s, td_len, seq, seq_errors, lost; - struct sockaddr_in test_chan_slave, test_chan_master; - fd_set fds; - struct timeval timeout; - struct nc_test_results results; - struct nc_test_data *tdp; - int nsent, nrecvd; - int need_recv, need_send; - - need_recv = true; need_send = true; - switch (ntohl(req->type)) { - case NC_REQUEST_UDP_SEND: - need_recv = false; - need_send = true; - break; - case NC_REQUEST_UDP_RECV: - need_recv = true; - need_send = false; - break; - case NC_REQUEST_UDP_ECHO: - break; - } - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - pexit("datagram socket"); - } - - memset((char *) &test_chan_slave, 0, sizeof(test_chan_slave)); - test_chan_slave.sin_family = AF_INET; - test_chan_slave.sin_addr.s_addr = htonl(INADDR_ANY); - test_chan_slave.sin_port = htons(ntohl(req->slave_port)); - - if (bind(s, (struct sockaddr *) &test_chan_slave, sizeof(test_chan_slave)) < 0) { - perror("bind"); - close(s); - } - - memcpy(&test_chan_master, master, sizeof(*master)); - test_chan_master.sin_port = htons(ntohl(req->master_port)); - nsent = 0; nrecvd = 0; seq = 0; seq_errors = 0; lost = 0; - for (i = 0; i < ntohl(req->nbufs); i++) { - if (need_recv) { - FD_ZERO(&fds); - FD_SET(s, &fds); - timeout.tv_sec = NC_TEST_TIMEOUT; - timeout.tv_usec = 0; - if (select(s+1, &fds, 0, 0, &timeout) <= 0) { - test_printf("recvfrom timeout, expecting seq #%d\n", seq); - if (++lost > MAX_ERRORS) { - test_printf("... giving up\n"); - break; - } - } else { - nrecvd++; - tdp = (struct nc_test_data *)in_buf; - td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); - if (recvfrom(s, tdp, td_len, 0, 0, 0) < 0) { - perror("recvfrom"); - close(s); - return; - } - if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && - (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { - if (ntohl(tdp->seq) != seq) { - test_printf("Packets out of sequence - recvd: %d, expected: %d\n", - ntohl(tdp->seq), seq); - seq = ntohl(tdp->seq); - seq_errors++; - } - } else { - test_printf("Bad data packet - key: %x/%x, seq: %d\n", - ntohl(tdp->key1), ntohl(tdp->key2), - ntohl(tdp->seq)); - } - } - } - if (need_send) { - tdp = (struct nc_test_data *)out_buf; - tdp->key1 = htonl(NC_TEST_DATA_KEY1); - tdp->key2 = htonl(NC_TEST_DATA_KEY2); - tdp->seq = htonl(seq); - td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); - tdp->len = htonl(td_len); - if (sendto(s, tdp, td_len, 0, - (struct sockaddr *)&test_chan_master, sizeof(test_chan_master)) < 0) { - perror("sendto"); - if (errno == ENOBUFS) { - // Saturated the system - test_delay(10); // Time for 200 500 byte 10-baseT packets - } else { - // What else to do? - close(s); - return; - } - } else { - nsent++; - } - } - seq++; - } - results.key1 = htonl(NC_TEST_RESULT_KEY1); - results.key2 = htonl(NC_TEST_RESULT_KEY2); - results.seq = req->seq; - results.nsent = htonl(nsent); - results.nrecvd = htonl(nrecvd); - if (sendto(s, &results, sizeof(results), 0, - (struct sockaddr *)&test_chan_master, sizeof(test_chan_master)) < 0) { - perror("sendto"); - } - close(s); -} - -// -// Read data from a stream, accounting for the fact that packet 'boundaries' -// are not preserved. This can also timeout (which would probably wreck the -// data boundaries). -// - -int -do_read(int fd, void *buf, int buflen) -{ - char *p = (char *)buf; - int len = buflen; - int res; - while (len) { - res = read(fd, p, len); - if (res < 0) { - perror("read"); - } else { - len -= res; - p += res; - if (res == 0) { - break; - } - } - } - return (buflen - len); -} - -// -// Generic TCP test -// - -static void -do_tcp_test(int s1, struct nc_request *req, struct sockaddr_in *master) -{ - int i, s, len, td_len, seq, seq_errors, lost, test_chan, res; - struct sockaddr_in test_chan_slave, test_chan_master; - struct nc_test_results results; - struct nc_test_data *tdp; - int nsent, nrecvd; - int need_recv, need_send; - int one = 1; - static int slave_tcp_port = -1; - - need_recv = true; need_send = true; - switch (ntohl(req->type)) { - case NC_REQUEST_TCP_SEND: - need_recv = false; - need_send = true; - break; - case NC_REQUEST_TCP_RECV: - need_recv = true; - need_send = false; - break; - case NC_REQUEST_TCP_ECHO: - break; - } - - if (slave_tcp_port < 0) { - s = socket(AF_INET, SOCK_STREAM, 0); - if (s < 0) { - pexit("datagram socket"); - } - - if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { - perror("setsockopt SO_REUSEADDR"); - return; - } -#ifdef SO_REUSEPORT - if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { - perror("setsockopt SO_REUSEPORT"); - return; - } -#endif - memset((char *) &test_chan_slave, 0, sizeof(test_chan_slave)); - test_chan_slave.sin_family = AF_INET; - test_chan_slave.sin_addr.s_addr = htonl(INADDR_ANY); - test_chan_slave.sin_port = htons(ntohl(req->slave_port)); - - if (bind(s, (struct sockaddr *) &test_chan_slave, sizeof(test_chan_slave)) < 0) { - perror("bind"); - close(s); - } - listen(s, SOMAXCONN); - slave_tcp_port = s; - } - - s = slave_tcp_port; - len = sizeof(test_chan_master); - if ((test_chan = accept(s, (struct sockaddr *)&test_chan_master, &len)) < 0) { - pexit("accept"); - } - len = sizeof(test_chan_master); - getpeername(test_chan, (struct sockaddr *)&test_chan_master, &len); - test_printf("connection from %s.%d\n", inet_ntoa(test_chan_master.sin_addr), - ntohs(test_chan_master.sin_port)); - - nsent = 0; nrecvd = 0; seq = 0; seq_errors = 0; lost = 0; - for (i = 0; i < ntohl(req->nbufs); i++) { - if (need_recv) { - tdp = (struct nc_test_data *)in_buf; - td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); - res = do_read(test_chan, tdp, td_len); - if (res != td_len) { - test_printf("recvfrom timeout, expecting seq #%d\n", seq); - if (++lost > MAX_ERRORS) { - test_printf("... giving up\n"); - break; - } - } else { - nrecvd++; - if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && - (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { - if (ntohl(tdp->seq) != seq) { - test_printf("Packets out of sequence - recvd: %d, expected: %d\n", - ntohl(tdp->seq), seq); - seq = ntohl(tdp->seq); - seq_errors++; - } - } else { - test_printf("Bad data packet - key: %x/%x, seq: %d\n", - ntohl(tdp->key1), ntohl(tdp->key2), - ntohl(tdp->seq)); - } - } - } - if (need_send) { - tdp = (struct nc_test_data *)out_buf; - tdp->key1 = htonl(NC_TEST_DATA_KEY1); - tdp->key2 = htonl(NC_TEST_DATA_KEY2); - tdp->seq = htonl(seq); - td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); - tdp->len = htonl(td_len); - if (write(test_chan, tdp, td_len) != td_len) { - perror("write"); - if (errno == ENOBUFS) { - // Saturated the system - test_delay(25); - } else { - // What else to do? - close(test_chan); - return; - } - } else { - nsent++; - } - } - seq++; - } - results.key1 = htonl(NC_TEST_RESULT_KEY1); - results.key2 = htonl(NC_TEST_RESULT_KEY2); - results.seq = req->seq; - results.nsent = htonl(nsent); - results.nrecvd = htonl(nrecvd); - if (write(test_chan, &results, sizeof(results)) != sizeof(results)) { - perror("write"); - } - close(test_chan); -} - -// -// Protocol driver for testing slave. -// -// This function is the main routine running here, handling requests sent from -// the master and providing various responses. -// -static void -nc_slave(test_param_t param) -{ - int s, masterlen; - struct sockaddr_in my_addr, master; - struct nc_request req; - struct nc_reply reply; - int done = false; - - test_printf("Start test for eth%d\n", param); - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - pexit("datagram socket"); - } - - memset((char *) &my_addr, 0, sizeof(my_addr)); - my_addr.sin_family = AF_INET; - my_addr.sin_addr.s_addr = htonl(INADDR_ANY); - my_addr.sin_port = htons(NC_SLAVE_PORT); - - if (bind(s, (struct sockaddr *) &my_addr, sizeof(my_addr)) < 0) { - pexit("bind"); - } - - while (!done) { - masterlen = sizeof(master); - if (recvfrom(s, &req, sizeof(req), 0, (struct sockaddr *)&master, &masterlen) < 0) { - pexit("recvfrom"); - } -#if 0 - test_printf("Request %d from %s:%d\n", ntohl(req.type), - inet_ntoa(master.sin_addr), ntohs(master.sin_port)); -#endif - reply.response = htonl(NC_REPLY_ACK); - reply.seq = req.seq; - switch (ntohl(req.type)) { - case NC_REQUEST_DISCONNECT: - done = true; - break; - case NC_REQUEST_UDP_SEND: - test_printf("UDP send - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_UDP_RECV: - test_printf("UDP recv - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_UDP_ECHO: - test_printf("UDP echo - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_TCP_SEND: - test_printf("TCP send - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_TCP_RECV: - test_printf("TCP recv - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_TCP_ECHO: - test_printf("TCP echo - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; -#ifdef __ECOS - case NC_REQUEST_SET_LOAD: - start_load(ntohl(req.nbufs)); - break; - case NC_REQUEST_START_IDLE: - test_printf("Start IDLE thread\n"); - idle_thread_count = 0; - idle_thread_start_time = cyg_current_time(); - cyg_semaphore_post(&idle_thread_sem); - break; - case NC_REQUEST_STOP_IDLE: - cyg_semaphore_wait(&idle_thread_sem); - idle_thread_stop_time = cyg_current_time(); - test_printf("Stop IDLE thread\n"); - reply.misc.idle_results.elapsed_time = htonl(idle_thread_stop_time - idle_thread_start_time); - reply.misc.idle_results.count[0] = htonl(idle_thread_count >> 32); - reply.misc.idle_results.count[1] = htonl((long)idle_thread_count); - break; -#endif - default: - test_printf("Unrecognized request: %d\n", ntohl(req.type)); - reply.response = htonl(NC_REPLY_NAK); - reply.reason = htonl(NC_REPLY_NAK_UNKNOWN_REQUEST); - break; - } - if (sendto(s, &reply, sizeof(reply), 0, (struct sockaddr *)&master, masterlen) < 0) { - pexit("sendto"); - } - if (reply.response == ntohl(NC_REPLY_NAK)) { - continue; - } - switch (ntohl(req.type)) { - case NC_REQUEST_UDP_SEND: - case NC_REQUEST_UDP_RECV: - case NC_REQUEST_UDP_ECHO: - do_udp_test(s, &req, &master); - break; - case NC_REQUEST_TCP_SEND: - case NC_REQUEST_TCP_RECV: - case NC_REQUEST_TCP_ECHO: - do_tcp_test(s, &req, &master); - break; - case NC_REQUEST_START_IDLE: - case NC_REQUEST_STOP_IDLE: - case NC_REQUEST_SET_LOAD: - default: - break; - } - } - close(s); -} - -void -net_test(test_param_t param) -{ -// int i; - if (param == 0) { - test_printf("Start Network Characterization - SLAVE\n"); -#ifdef __ECOS - init_all_network_interfaces(); - calibrate_load(DESIRED_BACKGROUND_LOAD); -#if 0 -// I can see what this is trying to do, but I get "bind: Address already in -// use" errors from the 2nd interface - and the parameter is not used -// anyway, so one thread does quite well enough (but only tests one i/f at -// once). - -// Comment in the 'int i' above too. - for (i = 1; i < CYGHWR_NET_DRIVERS; i++) { - cyg_thread_resume(main_thread_handle[i]); // Start other threads - } -#endif -#endif - } - nc_slave(param); -#ifdef CYGDBG_NET_TIMING_STATS - show_net_times(); -#endif - cyg_test_exit(); -} - -#ifdef __ECOS - -// -// This function is called to calibrate the "background load" which can be -// applied during testing. It will be called before any commands from the -// host are managed. -// -static void -calibrate_load(int desired_load) -{ - long long no_load_idle, load_idle; - int percent_load; - int high, low; - - // Set limits - high = MAX_LOAD_THREAD_LEVEL; - low = MIN_LOAD_THREAD_LEVEL; - - // Compute the "no load" idle value - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - no_load_idle = idle_thread_count; - diag_printf("No load = %d\n", (int)idle_thread_count); - - // First ensure that the HIGH level is indeed higher - while (true) { - load_thread_level = high; - start_load(desired_load); // Start up a given load - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - load_idle = idle_thread_count; - start_load(0); // Shut down background load - percent_load = 100 - ((load_idle * 100) / no_load_idle); - diag_printf("High Load[%d] = %d => %d%%\n", load_thread_level, - (int)idle_thread_count, percent_load); - if ( percent_load > desired_load ) - break; // HIGH level is indeed higher - low = load_thread_level; // known to be lower - high *= 2; // else double it and try again - } - - // Now chop down to the level required - while (true) { - load_thread_level = (high + low) / 2; - start_load(desired_load); // Start up a given load - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - load_idle = idle_thread_count; - start_load(0); // Shut down background load - percent_load = 100 - ((load_idle * 100) / no_load_idle); - diag_printf("Load[%d] = %d => %d%%\n", load_thread_level, - (int)idle_thread_count, percent_load); - if (((high-low) <= 1) || (abs(desired_load-percent_load) <= 2)) break; - if (percent_load < desired_load) { - low = load_thread_level; - } else { - high = load_thread_level; - } - } - - // Now we are within a few percent of the target; scale the load - // factor to get a better fit, and test it, print the answer. - load_thread_level *= desired_load; - load_thread_level /= percent_load; - start_load(desired_load); // Start up a given load - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - load_idle = idle_thread_count; - start_load(0); // Shut down background load - percent_load = 100 - ((load_idle * 100) / no_load_idle); - diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level, - (int)idle_thread_count, percent_load); -// no_load_idle_count_1_second = no_load_idle; -} - -// -// This function is called to set up a load level of 'load' percent (given -// as a whole number, e.g. start_load(20) would mean initiate a background -// load of 20%, leaving the cpu 80% idle). -// -static void -start_load(int load) -{ - static int prev_load = 0; - int i; - test_printf("Set background load = %d%%\n", load); - if (load == 0) { - if (prev_load == 0) return; // Nothing out there to stop - for (i = 0; i < prev_load/10; i++) { - cyg_semaphore_wait(&load_thread_sem[i]); - } - prev_load = 0; - } else { - for (i = 0; i < load/10; i++) { - cyg_semaphore_post(&load_thread_sem[i]); - } - prev_load = load; - } -} - -// -// These thread(s) do some amount of "background" computing. This is used -// to simulate a given load level. They need to be run at a higher priority -// than the network code itself. -// -// Like the "idle" thread, they run as long as their "switch" (aka semaphore) -// is enabled. -// -void -net_load(cyg_addrword_t who) -{ - int i; - while (true) { - cyg_semaphore_wait(&load_thread_sem[who]); - for (i = 0; i < load_thread_level; i++) { - do_some_random_computation(i); - } - cyg_thread_delay(1); // Wait until the next 'tick' - cyg_semaphore_post(&load_thread_sem[who]); - } -} - -// -// Some arbitrary computation, designed to use up the CPU and cause associated -// cache "thrash" behaviour - part of background load modelling. -// -static void -do_some_random_computation(int p) -{ - // Just something that might be "hard" - volatile double x; - x = ((p * 10) * 3.14159) / 180.0; // radians -} - -// -// This thread does nothing but count. It will be allowed to count -// as long as the semaphore is "free". -// -void -net_idle(cyg_addrword_t param) -{ - while (true) { - cyg_semaphore_wait(&idle_thread_sem); - idle_thread_count++; - cyg_semaphore_post(&idle_thread_sem); - } -} - -void -cyg_start(void) -{ - int i; - // Create processing threads - for (i = 0; i < CYGHWR_NET_DRIVERS; i++) { - cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority - net_test, // entry - i, // entry parameter - "Network test", // Name - &main_thread_stack[i][0], // Stack - STACK_SIZE, // Size - &main_thread_handle[i], // Handle - &main_thread_data[i] // Thread data structure - ); - } - cyg_thread_resume(main_thread_handle[0]); // Start first one - // Create the idle thread environment - cyg_semaphore_init(&idle_thread_sem, 0); - cyg_thread_create(IDLE_THREAD_PRIORITY, // Priority - net_idle, // entry - 0, // entry parameter - "Network idle", // Name - &idle_thread_stack[0], // Stack - STACK_SIZE, // Size - &idle_thread_handle, // Handle - &idle_thread_data // Thread data structure - ); - cyg_thread_resume(idle_thread_handle); // Start it - // Create the load threads and their environment(s) - for (i = 0; i < NUM_LOAD_THREADS; i++) { - cyg_semaphore_init(&load_thread_sem[i], 0); - cyg_thread_create(LOAD_THREAD_PRIORITY, // Priority - net_load, // entry - i, // entry parameter - "Background load", // Name - &load_thread_stack[i][0], // Stack - STACK_SIZE, // Size - &load_thread_handle[i], // Handle - &load_thread_data[i] // Thread data structure - ); - cyg_thread_resume(load_thread_handle[i]); // Start it - } - cyg_scheduler_start(); -} - -#else - -int -main(int argc, char *argv[]) -{ - net_test(0); -} -#endif diff --git a/packages/net/tcpip/current/tests/ping_lo_test.c b/packages/net/tcpip/current/tests/ping_lo_test.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/ping_lo_test.c +++ /dev/null @@ -1,264 +0,0 @@ -//========================================================================== -// -// tests/ping_lo_test.c -// -// Simple test of PING (ICMP) and networking support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas, sorin@netappi.com -// Contributors: gthomas, sorin@netappi.com -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// PING test code - -#include - -#include - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -#define NUM_PINGS 16 -#define MAX_PACKET 4096 -static unsigned char pkt1[MAX_PACKET], pkt2[MAX_PACKET]; - -#define UNIQUEID 0x1234 - -void -pexit(char *s) -{ - CYG_TEST_FAIL_FINISH( s ); -} - -// Compute INET checksum -int -inet_cksum(u_short *addr, int len) -{ - register int nleft = len; - register u_short *w = addr; - register u_short answer; - register u_int sum = 0; - u_short odd_byte = 0; - - /* - * Our algorithm is simple, using a 32 bit accumulator (sum), - * we add sequential 16 bit words to it, and at the end, fold - * back all the carry bits from the top 16 bits into the lower - * 16 bits. - */ - while( nleft > 1 ) { - sum += *w++; - nleft -= 2; - } - - /* mop up an odd byte, if necessary */ - if( nleft == 1 ) { - *(u_char *)(&odd_byte) = *(u_char *)w; - sum += odd_byte; - } - - /* - * add back carry outs from top 16 bits to low 16 bits - */ - sum = (sum >> 16) + (sum & 0x0000ffff); /* add hi 16 to low 16 */ - sum += (sum >> 16); /* add carry */ - answer = ~sum; /* truncate to 16 bits */ - return (answer); -} - -static int -show_icmp(unsigned char *pkt, int len, - struct sockaddr_in *from, struct sockaddr_in *to) -{ - cyg_tick_count_t *tp, tv; - struct ip *ip; - struct icmp *icmp; - tv = cyg_current_time(); - ip = (struct ip *)pkt; - if ((len < sizeof(*ip)) || ip->ip_v != IPVERSION) { - diag_printf("%s: Short packet or not IP! - Len: %d, Version: %d\n", - inet_ntoa(from->sin_addr), len, ip->ip_v); - return 0; - } - icmp = (struct icmp *)(pkt + sizeof(*ip)); - len -= (sizeof(*ip) + 8); - tp = (cyg_tick_count_t *)&icmp->icmp_data; - if (icmp->icmp_type != ICMP_ECHOREPLY) { - diag_printf("%s: Invalid ICMP - type: %d\n", - inet_ntoa(from->sin_addr), icmp->icmp_type); - return 0; - } - if (icmp->icmp_id != UNIQUEID) { - diag_printf("%s: ICMP received for wrong id - sent: %x, recvd: %x\n", - inet_ntoa(from->sin_addr), UNIQUEID, icmp->icmp_id); - } - diag_printf("%d bytes from %s: ", len, inet_ntoa(from->sin_addr)); - diag_printf("icmp_seq=%d", icmp->icmp_seq); - diag_printf(", time=%dms\n", (int)(tv - *tp)*10); - return (from->sin_addr.s_addr == to->sin_addr.s_addr); -} - -static void -ping_host(int s, struct sockaddr_in *host) -{ - struct icmp *icmp = (struct icmp *)pkt1; - int icmp_len = 64; - int seq, ok_recv, bogus_recv; - cyg_tick_count_t *tp; - long *dp; - struct sockaddr_in from; - int i, len, fromlen; - - ok_recv = 0; - bogus_recv = 0; - diag_printf("PING server %s\n", inet_ntoa(host->sin_addr)); - for (seq = 0; seq < NUM_PINGS; seq++) { - // Build ICMP packet - icmp->icmp_type = ICMP_ECHO; - icmp->icmp_code = 0; - icmp->icmp_cksum = 0; - icmp->icmp_seq = seq; - icmp->icmp_id = 0x1234; - // Set up ping data - tp = (cyg_tick_count_t *)&icmp->icmp_data; - *tp++ = cyg_current_time(); - dp = (long *)tp; - for (i = sizeof(*tp); i < icmp_len; i += sizeof(*dp)) { - *dp++ = i; - } - // Add checksum - icmp->icmp_cksum = inet_cksum( (u_short *)icmp, icmp_len+8); - // Send it off - if (sendto(s, icmp, icmp_len+8, 0, (struct sockaddr *)host, sizeof(*host)) < 0) { - perror("sendto"); - continue; - } - // Wait for a response - fromlen = sizeof(from); - len = recvfrom(s, pkt2, sizeof(pkt2), 0, (struct sockaddr *)&from, &fromlen); - if (len < 0) { - perror("recvfrom"); - } else { - if (show_icmp(pkt2, len, &from, host)) { - ok_recv++; - } else { - bogus_recv++; - } - } - } - diag_printf("Sent %d packets, received %d OK, %d bad\n", NUM_PINGS, ok_recv, bogus_recv); -} - -static void -ping_test_loopback( int lo ) -{ - struct protoent *p; - struct timeval tv; - struct sockaddr_in host; - int s; - - if ((p = getprotobyname("icmp")) == (struct protoent *)0) { - perror("getprotobyname"); - return; - } - s = socket(AF_INET, SOCK_RAW, p->p_proto); - if (s < 0) { - perror("socket"); - return; - } - tv.tv_sec = 1; - tv.tv_usec = 0; - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - // Set up host address - host.sin_family = AF_INET; - host.sin_addr.s_addr = htonl(INADDR_LOOPBACK + (0x100 * lo)); - host.sin_port = 0; - ping_host(s, &host); - // Now try a bogus host - host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + 32); - ping_host(s, &host); -} - -void -net_test(cyg_addrword_t p) -{ - int i; - diag_printf("Start PING test\n"); - init_all_network_interfaces(); -#if NLOOP > 0 - for ( i = 0; i < NLOOP; i++ ) - ping_test_loopback( i ); - for ( i = 0; i < NLOOP; i++ ) - ping_test_loopback( i ); - CYG_TEST_PASS_FINISH( "Done pinging loopback" ); -#endif - CYG_TEST_NA( "No loopback devs" ); -} - -void -cyg_start(void) -{ - CYG_TEST_INIT(); - - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(CYGPKG_NET_THREAD_PRIORITY-4,// Priority - just a number - net_test, // entry - 0, // entry parameter - "Loopback ping test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it - cyg_scheduler_start(); -} diff --git a/packages/net/tcpip/current/tests/ping_test.c b/packages/net/tcpip/current/tests/ping_test.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/ping_test.c +++ /dev/null @@ -1,306 +0,0 @@ -//========================================================================== -// -// tests/ping_test.c -// -// Simple test of PING (ICMP) and networking support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// PING test code - -#include - -#include -#include - -#include - -#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists -#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME -#endif - -#ifdef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS // do we use the rt test? -# ifdef CYGTST_DEVS_ETH_TEST_NET_REALTIME // Get the test ancilla if it exists -# include CYGTST_DEVS_ETH_TEST_NET_REALTIME -# endif -#endif - -// Fill in the blanks if necessary -#ifndef TNR_OFF -# define TNR_OFF() -#endif -#ifndef TNR_ON -# define TNR_ON() -#endif -#ifndef TNR_INIT -# define TNR_INIT() -#endif -#ifndef TNR_PRINT_ACTIVITY -# define TNR_PRINT_ACTIVITY() -#endif - - - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -#define NUM_PINGS 16 -#define MAX_PACKET 4096 -#define MIN_PACKET 64 -#define MAX_SEND 4000 - -#define PACKET_ADD ((MAX_SEND - MIN_PACKET)/NUM_PINGS) -#define nPACKET_ADD 1 - -static unsigned char pkt1[MAX_PACKET], pkt2[MAX_PACKET]; - -#define UNIQUEID 0x1234 - -void -pexit(char *s) -{ - CYG_TEST_FAIL_FINISH(s); -} - -// Compute INET checksum -int -inet_cksum(u_short *addr, int len) -{ - register int nleft = len; - register u_short *w = addr; - register u_short answer; - register u_int sum = 0; - u_short odd_byte = 0; - - /* - * Our algorithm is simple, using a 32 bit accumulator (sum), - * we add sequential 16 bit words to it, and at the end, fold - * back all the carry bits from the top 16 bits into the lower - * 16 bits. - */ - while( nleft > 1 ) { - sum += *w++; - nleft -= 2; - } - - /* mop up an odd byte, if necessary */ - if( nleft == 1 ) { - *(u_char *)(&odd_byte) = *(u_char *)w; - sum += odd_byte; - } - - /* - * add back carry outs from top 16 bits to low 16 bits - */ - sum = (sum >> 16) + (sum & 0x0000ffff); /* add hi 16 to low 16 */ - sum += (sum >> 16); /* add carry */ - answer = ~sum; /* truncate to 16 bits */ - return (answer); -} - -static int -show_icmp(unsigned char *pkt, int len, - struct sockaddr_in *from, struct sockaddr_in *to) -{ - cyg_tick_count_t *tp, tv; - struct ip *ip; - struct icmp *icmp; - tv = cyg_current_time(); - ip = (struct ip *)pkt; - if ((len < sizeof(*ip)) || ip->ip_v != IPVERSION) { - diag_printf("%s: Short packet or not IP! - Len: %d, Version: %d\n", - inet_ntoa(from->sin_addr), len, ip->ip_v); - return 0; - } - icmp = (struct icmp *)(pkt + sizeof(*ip)); - len -= (sizeof(*ip) + 8); - tp = (cyg_tick_count_t *)&icmp->icmp_data; - if (icmp->icmp_type != ICMP_ECHOREPLY) { - diag_printf("%s: Invalid ICMP - type: %d\n", - inet_ntoa(from->sin_addr), icmp->icmp_type); - return 0; - } - if (icmp->icmp_id != UNIQUEID) { - diag_printf("%s: ICMP received for wrong id - sent: %x, recvd: %x\n", - inet_ntoa(from->sin_addr), UNIQUEID, icmp->icmp_id); - } - diag_printf("%d bytes from %s: ", len, inet_ntoa(from->sin_addr)); - diag_printf("icmp_seq=%d", icmp->icmp_seq); - diag_printf(", time=%dms\n", (int)(tv - *tp)*10); - return (from->sin_addr.s_addr == to->sin_addr.s_addr); -} - -static void -ping_host(int s, struct sockaddr_in *host) -{ - struct icmp *icmp = (struct icmp *)pkt1; - int icmp_len = MIN_PACKET; - int seq, ok_recv, bogus_recv; - cyg_tick_count_t *tp; - long *dp; - struct sockaddr_in from; - int i, len, fromlen; - - ok_recv = 0; - bogus_recv = 0; - diag_printf("PING server %s\n", inet_ntoa(host->sin_addr)); - for (seq = 0; seq < NUM_PINGS; seq++, icmp_len += PACKET_ADD ) { - TNR_ON(); - // Build ICMP packet - icmp->icmp_type = ICMP_ECHO; - icmp->icmp_code = 0; - icmp->icmp_cksum = 0; - icmp->icmp_seq = seq; - icmp->icmp_id = 0x1234; - // Set up ping data - tp = (cyg_tick_count_t *)&icmp->icmp_data; - *tp++ = cyg_current_time(); - dp = (long *)tp; - for (i = sizeof(*tp); i < icmp_len; i += sizeof(*dp)) { - *dp++ = i; - } - // Add checksum - icmp->icmp_cksum = inet_cksum( (u_short *)icmp, icmp_len+8); - // Send it off - if (sendto(s, icmp, icmp_len+8, 0, (struct sockaddr *)host, sizeof(*host)) < 0) { - TNR_OFF(); - perror("sendto"); - continue; - } - // Wait for a response - fromlen = sizeof(from); - len = recvfrom(s, pkt2, sizeof(pkt2), 0, (struct sockaddr *)&from, &fromlen); - TNR_OFF(); - if (len < 0) { - perror("recvfrom"); - icmp_len = MIN_PACKET - PACKET_ADD; // just in case - long routes - } else { - if (show_icmp(pkt2, len, &from, host)) { - ok_recv++; - } else { - bogus_recv++; - } - } - } - TNR_OFF(); - diag_printf("Sent %d packets, received %d OK, %d bad\n", NUM_PINGS, ok_recv, bogus_recv); -} - -static void -ping_test(struct bootp *bp) -{ - struct protoent *p; - struct timeval tv; - struct sockaddr_in host; - int s; - - if ((p = getprotobyname("icmp")) == (struct protoent *)0) { - pexit("getprotobyname"); - return; - } - s = socket(AF_INET, SOCK_RAW, p->p_proto); - if (s < 0) { - pexit("socket"); - return; - } - tv.tv_sec = 1; - tv.tv_usec = 0; - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - // Set up host address - host.sin_family = AF_INET; - host.sin_addr = bp->bp_siaddr; - host.sin_port = 0; - ping_host(s, &host); - // Now try a bogus host - host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + 32); - ping_host(s, &host); -} - -void -net_test(cyg_addrword_t p) -{ - diag_printf("Start PING test\n"); - TNR_INIT(); - init_all_network_interfaces(); -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up) { - ping_test(ð0_bootp_data); - } -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if (eth1_up) { - ping_test(ð1_bootp_data); - } -#endif - TNR_PRINT_ACTIVITY(); - CYG_TEST_PASS_FINISH("Ping test OK"); -} - -void -cyg_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - net_test, // entry - 0, // entry parameter - "Network test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it - cyg_scheduler_start(); -} diff --git a/packages/net/tcpip/current/tests/server_test.c b/packages/net/tcpip/current/tests/server_test.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/server_test.c +++ /dev/null @@ -1,173 +0,0 @@ -//========================================================================== -// -// tests/server_test.c -// -// Simple TCP 'server' test -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== -// Network server test code -#include -#include -#include - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -extern void -cyg_test_exit(void); - -void -pexit(char *s) -{ - perror(s); - cyg_test_exit(); -} - -static void -server_test(struct bootp *bp) -{ - int s, client, client_len; - struct sockaddr_in client_addr, local; - char buf[256]; - int one = 1; - fd_set in_fds; - int num, len; - struct timeval tv; - - s = socket(AF_INET, SOCK_STREAM, 0); - if (s < 0) { - pexit("stream socket"); - } - if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { - pexit("setsockopt SO_REUSEADDR"); - } - if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { - pexit("setsockopt SO_REUSEPORT"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_len = sizeof(local); - local.sin_port = htons(7734); - local.sin_addr.s_addr = INADDR_ANY; - if(bind(s, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind error"); - } - listen(s, SOMAXCONN); - while (true) { - client_len = sizeof(client_addr); - if ((client = accept(s, (struct sockaddr *)&client_addr, &client_len)) < 0) { - pexit("accept"); - } - client_len = sizeof(client_addr); - getpeername(client, (struct sockaddr *)&client_addr, &client_len); - diag_printf("connection from %s:%d\n", inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port)); - -#ifdef CYGPKG_LIBC_STDIO - sprintf(buf, "Hello %s:%d\n", inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port)); -#else - strcpy(buf, "Hello "); - strcat(buf, inet_ntoa(client_addr.sin_addr)); - strcat(buf,":"); - strcat(buf, atoi(ntohs(client_addr.sin_port))); - strcat(buf,"\n"); -#endif - - write(client, buf, strlen(buf)); - tv.tv_sec = 5; - tv.tv_usec = 0; - FD_ZERO(&in_fds); - FD_SET(client, &in_fds); - num = select(client+1, &in_fds, 0, 0, &tv); - if (num > 0) { - len = read(client, buf, sizeof(buf)-1); - buf[len] = '\0'; - diag_printf("buf = '%s'\n", buf); - } else { - perror("select"); - } - close(client); - } - close(s); -} - -void -net_test(cyg_addrword_t param) -{ - diag_printf("Start SERVER test\n"); - init_all_network_interfaces(); -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up) { - server_test(ð0_bootp_data); - } -#endif - cyg_test_exit(); -} - -void -cyg_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - net_test, // entry - 0, // entry parameter - "Network test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it - cyg_scheduler_start(); -} diff --git a/packages/net/tcpip/current/tests/set_mac_address.c b/packages/net/tcpip/current/tests/set_mac_address.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/set_mac_address.c +++ /dev/null @@ -1,195 +0,0 @@ -//========================================================================== -// -// tests/set_mac_address.c -// -// Set_Mac_Address Utility - this carefully does NOTHING unless you -// edit this source file to confirm that you really want to do it. -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): hmt -// Contributors: -// Date: 2000-05-03 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include -#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists -#include CYGBLD_DEVS_ETH_DEVICE_H -#endif - - -// SET_MAC_ADDRESS test code - -#include - -#include - -#define NUMTHREADS 1 -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -static char thread_stack[NUMTHREADS][STACK_SIZE]; -static cyg_thread thread_data[NUMTHREADS]; -static cyg_handle_t thread_handle[NUMTHREADS]; - -extern void -cyg_test_exit(void); - -void -pexit(char *s) -{ - perror(s); - cyg_test_exit(); -} - -// ------------------------------------------------------------------------ -// remove NT to make this utility be useful ;-) -#define DONT_SET_ETH0 -#define DONT_SET_ETH1 - -// These are commented out to make sure you choose a value: -#ifdef DO_SET_ETH0 -//static cyg_uint8 new_eth0_addr[6]={ 0x0,0x90,0x27,0x8c,0x57,0xdd}; -//static cyg_uint8 new_eth0_addr[6]={ 0x0,0x90,0x27,0x8c,0x57,0xdb}; -#endif -#ifdef DO_SET_ETH1 -//static cyg_uint8 new_eth1_addr[6]={ 0x0,0x90,0x27,0x8c,0x57,0xde}; -//static cyg_uint8 new_eth1_addr[6]={ 0x0,0x90,0x27,0x8c,0x57,0xdc}; -#endif - -// ------------------------------------------------------------------------ - -int -set_mac_address( const char *interface, char *mac_address ) -{ - int s, i; - struct ifreq ifr; - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - perror("socket"); - return false; - } - - diag_printf( "%s socket is %d:\n", interface, s ); - - strcpy(ifr.ifr_name, interface); - - for ( i = 0; i < ETHER_ADDR_LEN; i++ ) - ifr.ifr_hwaddr.sa_data[i] = mac_address[i]; - - diag_printf( "Mac addr %02x:%02x:%02x:%02x:%02x:%02x\n", - ifr.ifr_hwaddr.sa_data[0], - ifr.ifr_hwaddr.sa_data[1], - ifr.ifr_hwaddr.sa_data[2], - ifr.ifr_hwaddr.sa_data[3], - ifr.ifr_hwaddr.sa_data[4], - ifr.ifr_hwaddr.sa_data[5] ); - - if (ioctl(s, SIOCSIFHWADDR, &ifr)) { - perror("SIOCSIFHWADDR"); - close( s ); - return false; - } - - diag_printf( "%s ioctl(SIOCSIFHWADDR) succeeded\n", interface ); - - close( s ); - - return true; -} - -// ------------------------------------------------------------------------ -void -net_test(cyg_addrword_t param) -{ - int results = 0; - diag_printf("Start set_mac_address\n"); -#ifdef CYGHWR_NET_DRIVER_ETH0 -#ifdef DO_SET_ETH0 - diag_printf("Setting MAC of eth0 to %02x:%02x:%02x:%02x:%02x:%02x\n", - new_eth0_addr[0],new_eth0_addr[1], - new_eth0_addr[2],new_eth0_addr[3], - new_eth0_addr[4],new_eth0_addr[5] ); - results += set_mac_address( "eth0", new_eth0_addr ); -#endif -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 -#ifdef DO_SET_ETH1 - diag_printf("Setting MAC of eth1 to %02x:%02x:%02x:%02x:%02x:%02x\n", - new_eth1_addr[0],new_eth1_addr[1], - new_eth1_addr[2],new_eth1_addr[3], - new_eth1_addr[4],new_eth1_addr[5] ); - results += set_mac_address( "eth1", new_eth1_addr ); -#endif -#endif - - if ( 0 == results ) - diag_printf( "**** Did not set any MAC addresses ****\n" ); - - diag_printf("Init Network Interfaces\n"); - init_all_network_interfaces(); - diag_printf("After init.\n"); - - cyg_test_exit(); -} - -// ------------------------------------------------------------------------ -void -cyg_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - net_test, // entry - 0, // entry parameter - "Network test", // Name - &thread_stack[0][0], // Stack - STACK_SIZE, // Size - &thread_handle[0], // Handle - &thread_data[0] // Thread data structure - ); - cyg_thread_resume(thread_handle[0]); // Start it - - cyg_scheduler_start(); -} - -// EOF set_mac_address.c diff --git a/packages/net/tcpip/current/tests/socket_test.c b/packages/net/tcpip/current/tests/socket_test.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/socket_test.c +++ /dev/null @@ -1,106 +0,0 @@ -//========================================================================== -// -// tests/socket_test.c -// -// Test network socket functions -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: HLD -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// socket test code - -#include - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif - -#define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -extern void -cyg_test_exit(void); - -void -net_test(cyg_addrword_t param) -{ - int s; - int one = 1; - - diag_printf("Start socket test\n"); - - s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - diag_printf("socket() = %d\n", s); - s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - diag_printf("socket() = %d\n", s); - - if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { - perror("setsockopt"); - } - - cyg_test_exit(); -} - -void -cyg_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - net_test, // entry - 0, // entry parameter - "Network test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it - cyg_scheduler_start(); -} diff --git a/packages/net/tcpip/current/tests/tcp_echo.c b/packages/net/tcpip/current/tests/tcp_echo.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/tcp_echo.c +++ /dev/null @@ -1,614 +0,0 @@ -//========================================================================== -// -// tests/tcp_echo.c -// -// Simple TCP throughput test - echo component -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: This is the middle part of a three part test. The idea is -// to test the throughput of box in a configuration like this: -// -// +------+ port +----+ port +----+ -// |SOURCE|=========>|ECHO|============>|SINK| -// +------+ 9990 +----+ 9991 +----+ -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include -#include - -#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists -#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME -#endif - -#ifdef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS // do we use the rt test? -# ifdef CYGTST_DEVS_ETH_TEST_NET_REALTIME // Get the test ancilla if it exists -# include CYGTST_DEVS_ETH_TEST_NET_REALTIME -# endif -#endif - - -// Fill in the blanks if necessary -#ifndef TNR_OFF -# define TNR_OFF() -#endif -#ifndef TNR_ON -# define TNR_ON() -#endif -#ifndef TNR_INIT -# define TNR_INIT() -#endif -#ifndef TNR_PRINT_ACTIVITY -# define TNR_PRINT_ACTIVITY() -#endif - - -// Network throughput test code - -#include - -#include - -#define SOURCE_PORT 9990 -#define SINK_PORT 9991 - -#define MAX_BUF 8192 -static unsigned char data_buf[MAX_BUF]; - -struct test_params { - long nbufs; - long bufsize; - long load; -}; - -struct test_status { - long ok; -}; - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -// Background load stuff -#define NUM_LOAD_THREADS 20 // Get 5% granularity -#define IDLE_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY+3 -#define LOAD_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-3 -#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-4 -#define DESIRED_BACKGROUND_LOAD 50 // should be accurate enough over range - -// starting points for load calculation -#define MAX_LOAD_THREAD_LEVEL 100 -#define MIN_LOAD_THREAD_LEVEL 0 - -static char idle_thread_stack[STACK_SIZE]; -static cyg_thread idle_thread_data; -static cyg_handle_t idle_thread_handle; -static cyg_sem_t idle_thread_sem; -volatile static long long idle_thread_count; -static char load_thread_stack[NUM_LOAD_THREADS][STACK_SIZE]; -static cyg_thread load_thread_data[NUM_LOAD_THREADS]; -static cyg_handle_t load_thread_handle[NUM_LOAD_THREADS]; -static cyg_sem_t load_thread_sem[NUM_LOAD_THREADS]; -static long load_thread_level; -static void calibrate_load(int load); -static void start_load(int load); -static void do_some_random_computation(int p,int id); -#define abs(n) ((n) < 0 ? -(n) : (n)) - -static long long no_load_idle_count_1_second; - -extern void -cyg_test_exit(void); - -void -pexit(char *s) -{ - TNR_OFF(); - perror(s); - cyg_test_exit(); -} - -int -do_read(int s, void *_buf, int len) -{ - int total, slen, rlen; - unsigned char *buf = (unsigned char *)_buf; - total = 0; - rlen = len; - while (total < len) { - slen = read(s, buf, rlen); - if (slen != rlen) { - if (slen < 0) { - diag_printf("Error after reading %d bytes\n", total); - return -1; - } - rlen -= slen; - buf += slen; - } - total += slen; - } - return total; -} - -int -do_write(int s, void *_buf, int len) -{ - int total, slen, rlen; - unsigned char *buf = (unsigned char *)_buf; - total = 0; - rlen = len; - while (total < len) { - slen = write(s, buf, rlen); - if (slen != rlen) { - if (slen < 0) { - diag_printf("Error after writing %d bytes\n", total); - return -1; - } - rlen -= slen; - buf += slen; - } - total += slen; - } - return total; -} - -// -// This function is called to calibrate the "background load" which can be -// applied during testing. It will be called before any commands from the -// host are managed. -// -static void -calibrate_load(int desired_load) -{ - long long no_load_idle, load_idle; - int percent_load; - int high, low; - - // Set limits - high = MAX_LOAD_THREAD_LEVEL; - low = MIN_LOAD_THREAD_LEVEL; - - // Compute the "no load" idle value - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - no_load_idle = idle_thread_count; - diag_printf("No load = %d\n", (int)idle_thread_count); - - // First ensure that the HIGH level is indeed higher - while (true) { - load_thread_level = high; - start_load(desired_load); // Start up a given load - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - load_idle = idle_thread_count; - start_load(0); // Shut down background load - percent_load = 100 - ((load_idle * 100) / no_load_idle); - diag_printf("High Load[%d] = %d => %d%%\n", load_thread_level, - (int)idle_thread_count, percent_load); - if ( percent_load > desired_load ) - break; // HIGH level is indeed higher - low = load_thread_level; // known to be lower - high *= 2; // else double it and try again - } - - // Now chop down to the level required - while (true) { - load_thread_level = (high + low) / 2; - start_load(desired_load); // Start up a given load - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - load_idle = idle_thread_count; - start_load(0); // Shut down background load - percent_load = 100 - ((load_idle * 100) / no_load_idle); - diag_printf("Load[%d] = %d => %d%%\n", load_thread_level, - (int)idle_thread_count, percent_load); - if (((high-low) <= 1) || (abs(desired_load-percent_load) <= 2)) break; - if (percent_load < desired_load) { - low = load_thread_level; - } else { - high = load_thread_level; - } - } - - // Now we are within a few percent of the target; scale the load - // factor to get a better fit, and test it, print the answer. - load_thread_level *= desired_load; - load_thread_level /= percent_load; - start_load(desired_load); // Start up a given load - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - load_idle = idle_thread_count; - start_load(0); // Shut down background load - percent_load = 100 - ((load_idle * 100) / no_load_idle); - diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level, - (int)idle_thread_count, percent_load); - no_load_idle_count_1_second = no_load_idle; -} - -// -// This function is called to set up a load level of 'load' percent (given -// as a whole number, e.g. start_load(20) would mean initiate a background -// load of 20%, leaving the cpu 80% idle). -// -static void -start_load(int load) -{ - static int prev_load = 0; - int i; - if (load == 0) { - diag_printf("Set no background load\n"); - if (prev_load == 0) return; // Nothing out there to stop - for (i = 0; i < prev_load * NUM_LOAD_THREADS/100; i++) { - cyg_semaphore_wait(&load_thread_sem[i]); - } - prev_load = 0; - } else { - diag_printf("Set background load = %d%% starting %d threads\n", - load, load * NUM_LOAD_THREADS/100 ); - for (i = 0; i < load * NUM_LOAD_THREADS/100; i++) { - cyg_semaphore_post(&load_thread_sem[i]); - } - prev_load = load; - } -} - -// -// These thread(s) do some amount of "background" computing. This is used -// to simulate a given load level. They need to be run at a higher priority -// than the network code itself. -// -// Like the "idle" thread, they run as long as their "switch" (aka semaphore) -// is enabled. -// -void -net_load(cyg_addrword_t who) -{ - int i; - while (true) { - cyg_semaphore_wait(&load_thread_sem[who]); - for (i = 0; i < load_thread_level; i++) { - do_some_random_computation(i,who); - } - cyg_thread_delay(1); // Wait until the next 'tick' - cyg_semaphore_post(&load_thread_sem[who]); - } -} - -// -// Some arbitrary computation, designed to use up the CPU and cause associated -// cache "thrash" behaviour - part of background load modelling. -// -static void -do_some_random_computation(int p,int id) -{ - // Just something that might be "hard" -#if 0 - { - volatile double x; - x = ((p * 10) * 3.14159) / 180.0; // radians - } -#endif -#if 1 - { - static int footle[0x10001]; - static int counter = 0; - register int i; - - i = (p << 8) + id + counter++; - i &= 0xffff; - footle[ i+1 ] += footle[ i ] + 1; - } -#endif -} - -// -// This thread does nothing but count. It will be allowed to count -// as long as the semaphore is "free". -// -void -net_idle(cyg_addrword_t param) -{ - while (true) { - cyg_semaphore_wait(&idle_thread_sem); - idle_thread_count++; - cyg_semaphore_post(&idle_thread_sem); - } -} - -static void -echo_test(cyg_addrword_t p) -{ - int s_source, s_sink, e_source, e_sink; - struct sockaddr_in e_source_addr, e_sink_addr, local; - int one = 1; - fd_set in_fds; - int i, num, len; - struct test_params params,nparams; - struct test_status status,nstatus; - - cyg_tick_count_t starttime, stoptime; - - s_source = socket(AF_INET, SOCK_STREAM, 0); - if (s_source < 0) { - pexit("stream socket"); - } - if (setsockopt(s_source, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { - pexit("setsockopt /source/ SO_REUSEADDR"); - } - if (setsockopt(s_source, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { - pexit("setsockopt /source/ SO_REUSEPORT"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_len = sizeof(local); - local.sin_port = ntohs(SOURCE_PORT); - local.sin_addr.s_addr = INADDR_ANY; - if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind /source/ error"); - } - listen(s_source, SOMAXCONN); - - s_sink = socket(AF_INET, SOCK_STREAM, 0); - if (s_sink < 0) { - pexit("stream socket"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_len = sizeof(local); - local.sin_port = ntohs(SINK_PORT); - local.sin_addr.s_addr = INADDR_ANY; - if(bind(s_sink, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind /sink/ error"); - } - if (setsockopt(s_sink, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { - pexit("setsockopt /sink/ SO_REUSEADDR"); - } - if (setsockopt(s_sink, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { - pexit("setsockopt /sink/ SO_REUSEPORT"); - } - listen(s_sink, SOMAXCONN); - - e_source = 0; e_sink = 0; - while (true) { - // Wait for a connection on either of the ports - FD_ZERO(&in_fds); - FD_SET(s_source, &in_fds); - FD_SET(s_sink, &in_fds); - num = select(max(s_sink,s_source)+1, &in_fds, 0, 0, 0); - if (FD_ISSET(s_source, &in_fds)) { - len = sizeof(e_source_addr); - if ((e_source = accept(s_source, (struct sockaddr *)&e_source_addr, &len)) < 0) { - pexit("accept /source/"); - } - diag_printf("SOURCE connection from %s:%d\n", - inet_ntoa(e_source_addr.sin_addr), ntohs(e_source_addr.sin_port)); - } - if (FD_ISSET(s_sink, &in_fds)) { - len = sizeof(e_sink_addr); - if ((e_sink = accept(s_sink, (struct sockaddr *)&e_sink_addr, &len)) < 0) { - pexit("accept /sink/"); - } - diag_printf("SINK connection from %s:%d\n", - inet_ntoa(e_sink_addr.sin_addr), ntohs(e_sink_addr.sin_port)); - } - // Continue with test once a connection is established in both directions - if ((e_source != 0) && (e_sink != 0)) { - break; - } - } - - // Wait for "source" to tell us the testing paramters - if (do_read(e_source, &nparams, sizeof(nparams)) != sizeof(nparams)) { - pexit("Can't read initialization parameters"); - } - - params.nbufs = ntohl(nparams.nbufs); - params.bufsize = ntohl(nparams.bufsize); - params.load = ntohl(nparams.load); - - diag_printf("Using %d buffers of %d bytes each, %d%% background load\n", - params.nbufs, params.bufsize, params.load); - - // Tell the sink what the parameters are - if (do_write(e_sink, &nparams, sizeof(nparams)) != sizeof(nparams)) { - pexit("Can't write initialization parameters"); - } - - status.ok = 1; - nstatus.ok = htonl(status.ok); - - // Tell the "source" to start - we're all connected and ready to go! - if (do_write(e_source, &nstatus, sizeof(nstatus)) != sizeof(nstatus)) { - pexit("Can't send ACK to 'source' host"); - } - - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - starttime = cyg_current_time(); - start_load(params.load); - - TNR_ON(); - - // Echo the data from the source to the sink hosts - for (i = 0; i < params.nbufs; i++) { - if ((len = do_read(e_source, data_buf, params.bufsize)) != params.bufsize) { - TNR_OFF(); - diag_printf("Can't read buf #%d: ", i+1); - if (len < 0) { - perror("I/O error"); - } else { - diag_printf("short read - only %d bytes\n", len); - } - TNR_ON(); - } - if ((len = do_write(e_sink, data_buf, params.bufsize)) != params.bufsize) { - TNR_OFF(); - diag_printf("Can't write buf #%d: ", i+1); - if (len < 0) { - perror("I/O error"); - } else { - diag_printf("short write - only %d bytes\n", len); - } - TNR_ON(); - } - } - - TNR_OFF(); - - // Wait for the data to drain and the "sink" to tell us all is OK. - if (do_read(e_sink, &status, sizeof(status)) != sizeof(status)) { - pexit("Can't receive ACK from 'sink' host"); - } - - start_load(0); - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - stoptime = cyg_current_time(); - stoptime -= starttime; // time taken in cS - // expected idle loops in that time period for an idle system: - starttime = no_load_idle_count_1_second * stoptime / 100; - diag_printf( "%d ticks elapsed, %d kloops predicted for an idle system\n", - (int)stoptime, (int)(starttime/1000) ); - diag_printf( "actual kloops %d, CPU was %d%% idle during transfer\n", - (int)(idle_thread_count/1000), - (int)(idle_thread_count * 100 / starttime) ); - - // Now examine how close that loading actually was: - start_load(params.load); // Start up a given load - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - start_load(0); // Shut down background load - i = 100 - ((idle_thread_count * 100) / no_load_idle_count_1_second ); - diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level, - (int)idle_thread_count, i); - -//#ifdef CYGDBG_USE_ASSERTS -#ifdef CYGDBG_NET_TIMING_STATS - { - extern void show_net_times(void); - show_net_times(); - } -#endif -//#endif -} - -void -net_test(cyg_addrword_t param) -{ - diag_printf("Start TCP test - ECHO mode\n"); - init_all_network_interfaces(); - calibrate_load(DESIRED_BACKGROUND_LOAD); - TNR_INIT(); -#ifdef CYGPKG_SNMPAGENT - { - extern void cyg_net_snmp_init(void); - cyg_net_snmp_init(); - } -#endif - echo_test(param); - TNR_PRINT_ACTIVITY(); - cyg_test_exit(); -} - -void -cyg_start(void) -{ - int i; - // Create a main thread which actually runs the test - cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority - net_test, // entry - 0, // entry parameter - "Network test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it - // Create the idle thread environment - cyg_semaphore_init(&idle_thread_sem, 0); - cyg_thread_create(IDLE_THREAD_PRIORITY, // Priority - net_idle, // entry - 0, // entry parameter - "Network idle", // Name - &idle_thread_stack[0], // Stack - STACK_SIZE, // Size - &idle_thread_handle, // Handle - &idle_thread_data // Thread data structure - ); - cyg_thread_resume(idle_thread_handle); // Start it - // Create the load threads and their environment(s) - for (i = 0; i < NUM_LOAD_THREADS; i++) { - cyg_semaphore_init(&load_thread_sem[i], 0); - cyg_thread_create(LOAD_THREAD_PRIORITY, // Priority - net_load, // entry - i, // entry parameter - "Background load", // Name - &load_thread_stack[i][0], // Stack - STACK_SIZE, // Size - &load_thread_handle[i], // Handle - &load_thread_data[i] // Thread data structure - ); - cyg_thread_resume(load_thread_handle[i]); // Start it - } - cyg_scheduler_start(); -} - -// EOF tcp_echo.c diff --git a/packages/net/tcpip/current/tests/tcp_lo_select.c b/packages/net/tcpip/current/tests/tcp_lo_select.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/tcp_lo_select.c +++ /dev/null @@ -1,310 +0,0 @@ -//========================================================================== -// -// tests/tcp_lo_test.c -// -// Simple TCP throughput test -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): sorin@netappi.com -// Contributors: gthomas,sorin@netappi.com -// Date: 2000-05-24 - - -// Network throughput test code - -#include - -#include - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif - -#define SOURCE_PORT1 9990 -#define SOURCE_PORT2 9991 - -#define NUM_BUF 1024 -#define MAX_BUF 8192 -static unsigned char data_buf1[MAX_BUF]; -static unsigned char data_buf2[MAX_BUF]; -static unsigned char data_buf_write1[MAX_BUF]="Client 1 is alive. You may continue ...."; -static unsigned char data_buf_write2[MAX_BUF]="Client 2 is alive. You may continue ...."; - - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x10000) - -static char stack_server[STACK_SIZE]; -static cyg_thread server_thread_data; -static cyg_handle_t server_thread_handle; - -static char stack_client1[STACK_SIZE]; -static cyg_thread client1_thread_data; -static cyg_handle_t client1_thread_handle; - -static char stack_client2[STACK_SIZE]; -static cyg_thread client2_thread_data; -static cyg_handle_t client2_thread_handle; - - -#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-4 - -void -pexit(char *s) -{ - CYG_TEST_FAIL_FINISH( s ); -} - - -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -void server(void) -{ - int s_s1, e_s1, s_s2, e_s2; - struct sockaddr_in e_s1_addr,e_s2_addr,local; - fd_set in_fds; - int len; - int num; - - char *hello_string=" Hello eCos network \n"; - diag_printf("TCP SERVER:"); - diag_printf(hello_string); - - s_s1 = socket(AF_INET, SOCK_STREAM, 0); - if (s_s1 < 0) { - pexit("stream socket"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_len = sizeof(local); - local.sin_port = ntohs(SOURCE_PORT1); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - if(bind(s_s1, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind /source_1/ error"); - } - listen(s_s1, SOMAXCONN); - - s_s2 = socket(AF_INET, SOCK_STREAM, 0); - if (s_s2 < 0) { - pexit("stream socket"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_len = sizeof(local); - local.sin_port = ntohs(SOURCE_PORT2); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - if(bind(s_s2, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind /source_2/ error"); - } - listen(s_s2, SOMAXCONN); - - - e_s1 = 0; e_s2 = 0; - - - while (true) { - FD_ZERO(&in_fds); - FD_SET(s_s1, &in_fds); - FD_SET(s_s2, &in_fds); - num = select ( max(s_s1,s_s2)+1, &in_fds,0,0,0); - if (FD_ISSET(s_s1,&in_fds)) { - len = sizeof(e_s1_addr); - if ((e_s1 = accept(s_s1,(struct sockaddr *)&e_s1_addr,&len))<0) - { - pexit("accept /source_1/"); - } - diag_printf("TCP SERVER connection from %s: %d\n", - inet_ntoa(e_s1_addr.sin_addr),ntohs(e_s1_addr.sin_port)); - } - if (FD_ISSET(s_s2,&in_fds)) { - len = sizeof(e_s2_addr); - if ((e_s2 = accept(s_s2,(struct sockaddr *)&e_s2_addr,&len))<0) - { - pexit("accept /source_2/"); - } - diag_printf("TCP SERVER connection from %s: %d\n", - inet_ntoa(e_s2_addr.sin_addr), ntohs(e_s2_addr.sin_port)); - } - - if ((e_s1 != 0) && ( e_s2 != 0)) { - break; - } - - } /* while (true) */ - - if ((len = read(e_s1, data_buf1, MAX_BUF)) < 0 ) - { - perror("I/O error"); - } - diag_printf("SERVER : %s\n",data_buf1); - - if ((len = read(e_s2, data_buf2, MAX_BUF)) < 0 ) - { - perror("I/O error"); - } - diag_printf("SERVER : %s\n",data_buf2); - -} - -void client1(void) -{ - int s_source; - struct sockaddr_in local; - int len; - - diag_printf("client 1 :started\n"); - - s_source = socket(AF_INET, SOCK_STREAM, 0); - if (s_source < 0) { - pexit("stream socket"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = htons(SOURCE_PORT1); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (connect(s_source, (struct sockaddr *)&local, sizeof(local)) < 0) { - pexit("Can't connect to target"); - } - - if ((len = write(s_source,data_buf_write1,40)) < 0) { - CYG_TEST_FAIL_FINISH("Error writing buffer"); - } -} - -void client2(void) -{ - int s_source; - struct sockaddr_in local; - int len; - - diag_printf("client 2 :started\n"); - - s_source = socket(AF_INET, SOCK_STREAM, 0); - if (s_source < 0) { - pexit("stream socket"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = htons(SOURCE_PORT2); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (connect(s_source, (struct sockaddr *)&local, sizeof(local)) < 0) { - pexit("Can't connect to target"); - } - - if ((len = write(s_source,data_buf_write2,40)) < 0) { - CYG_TEST_FAIL_FINISH("Error writing buffer"); - } -} - - -void -tcp_server(cyg_addrword_t param) -{ - init_all_network_interfaces(); - diag_printf("Start TCP server - test\n"); - cyg_thread_resume(client1_thread_handle); // Start it - cyg_thread_resume(client2_thread_handle); // Start it -#if NLOOP > 0 - server(); - CYG_TEST_PASS_FINISH("Server returned OK"); -#endif - CYG_TEST_NA( "No loopback devs" ); -} - -void -tcp_client_1(cyg_addrword_t param) -{ - diag_printf("Start TCP client 1 - test\n"); -#if NLOOP > 0 - client1(); -#endif -} - -void -tcp_client_2(cyg_addrword_t param) -{ - diag_printf("Start TCP client 2 - test\n"); -#if NLOOP > 0 - client2(); -#endif -} - - -void -cyg_start(void) -{ - CYG_TEST_INIT(); - - cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority - tcp_server, // entry - 0, // entry parameter - "TCP loopback server", // Name - &stack_server[0], // Stack - STACK_SIZE, // Size - &server_thread_handle, // Handle - &server_thread_data // Thread data structure - ); - cyg_thread_resume(server_thread_handle); // Start it - - cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority - tcp_client_1, // entry - 0, // entry parameter - "TCP loopback client1", // Name - &stack_client1[0], // Stack - STACK_SIZE, // Size - &client1_thread_handle, // Handle - &client1_thread_data // Thread data structure - ); - - cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority - tcp_client_2, // entry - 0, // entry parameter - "TCP llopback client2", // Name - &stack_client2[0], // Stack - STACK_SIZE, // Size - &client2_thread_handle, // Handle - &client2_thread_data // Thread data structure - ); - - cyg_scheduler_start(); -} - diff --git a/packages/net/tcpip/current/tests/tcp_lo_test.c b/packages/net/tcpip/current/tests/tcp_lo_test.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/tcp_lo_test.c +++ /dev/null @@ -1,215 +0,0 @@ -//========================================================================== -// -// tests/tcp_lo_test.c -// -// Simple TCP throughput test -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): sorin@netappi.com -// Contributors: gthomas,sorin@netappi.com, hmt -// Date: 2000-05-24 - - -// Network throughput test code - -#include - -#include - -#define SOURCE_PORT 9990 -#define SINK_PORT 9991 - -#define NUM_BUF 1024 -#define MAX_BUF 8192 -static unsigned char data_buf[MAX_BUF]; -static unsigned char data_buf_write[MAX_BUF]="Client is alive. You may continue ...."; - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x10000) -static char stack_server[STACK_SIZE]; -static cyg_thread server_thread_data; -static cyg_handle_t server_thread_handle; - -static char stack_client[STACK_SIZE]; -static cyg_thread client_thread_data; -static cyg_handle_t client_thread_handle; - - -#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-4 - -void -pexit(char *s) -{ - CYG_TEST_FAIL_FINISH( s ); -} - - -void server(void) -{ - int s_source, e_source; - struct sockaddr_in e_source_addr, local; - int one = 1; - fd_set in_fds; - int len; - - char *hello_string=" Hello eCos network \n"; - diag_printf("TCP SERVER:"); - diag_printf(hello_string); - - s_source = socket(AF_INET, SOCK_STREAM, 0); - if (s_source < 0) { - pexit("stream socket"); - } - if (setsockopt(s_source, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { - pexit("setsockopt /source/ SO_REUSEADDR"); - } - if (setsockopt(s_source, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { - pexit("setsockopt /source/ SO_REUSEPORT"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_len = sizeof(local); - local.sin_port = ntohs(SOURCE_PORT); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind /source/ error"); - } - listen(s_source, SOMAXCONN); - - e_source = 0; - while (true) { - FD_ZERO(&in_fds); - FD_SET(s_source, &in_fds); - if ((e_source = accept(s_source,(struct sockaddr *)&e_source_addr,&len))<0) { - pexit("accept /source/"); - } - diag_printf("TCP SERVER connection from %s: %d\n", - inet_ntoa(e_source_addr.sin_addr),ntohs(e_source_addr.sin_port)); - - if (e_source != 0) { - break; - } - } /* while (true) */ - - if ((len = read(e_source, data_buf, MAX_BUF)) < 0 ) { - CYG_TEST_FAIL_FINISH( "I/O error" ); - } - diag_printf("SERVER : %s\n",data_buf); - -} - -void client(void) -{ - int s_source; - struct sockaddr_in local; - int len; - - diag_printf("client:started\n"); - - s_source = socket(AF_INET, SOCK_STREAM, 0); - if (s_source < 0) { - pexit("stream socket"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = htons(SOURCE_PORT); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (connect(s_source, (struct sockaddr *)&local, sizeof(local)) < 0) { - pexit("Can't connect to target"); - } - - if ((len = write(s_source,data_buf_write,40)) < 0){ - CYG_TEST_FAIL_FINISH( "Error writing buffer"); - } -} - -void -tcp_server(cyg_addrword_t param) -{ - init_all_network_interfaces(); - diag_printf("Start TCP server - test\n"); - cyg_thread_resume(client_thread_handle); // Start it -#if NLOOP > 0 - server(); - CYG_TEST_PASS_FINISH( "server returned OK" ); -#endif - CYG_TEST_NA( "No loopback devs" ); -} - -void -tcp_client(cyg_addrword_t param) -{ - diag_printf("Start TCP client - test\n"); -#if NLOOP > 0 - client(); -#endif -} - - - -void -cyg_start(void) -{ - CYG_TEST_INIT(); - - cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority - tcp_server, // entry - 0, // entry parameter - "TCP loopback server", // Name - &stack_server[0], // Stack - STACK_SIZE, // Size - &server_thread_handle, // Handle - &server_thread_data // Thread data structure - ); - cyg_thread_resume(server_thread_handle); // Start it - - cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority - tcp_client, // entry - 0, // entry parameter - "TCP loopback client", // Name - &stack_client[0], // Stack - STACK_SIZE, // Size - &client_thread_handle, // Handle - &client_thread_data // Thread data structure - ); - cyg_scheduler_start(); -} - - - diff --git a/packages/net/tcpip/current/tests/tcp_sink.c b/packages/net/tcpip/current/tests/tcp_sink.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/tcp_sink.c +++ /dev/null @@ -1,255 +0,0 @@ -//========================================================================== -// -// tests/tcp_sink.c -// -// Simple TCP throughput test - sink component -// * CAUTION: host, i.e. non eCos, only * -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: This is the middle part of a three part test. The idea is -// to test the throughput of box in a configuration like this: -// -// +------+ port +----+ port +----+ -// |SOURCE|=========>|ECHO|============>|SINK| -// +------+ 9990 +----+ 9991 +----+ -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// Network throughput test code - -#undef _KERNEL -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#define SOURCE_PORT 9990 -#define SINK_PORT 9991 - -struct test_params { - long nbufs; - long bufsize; - long load; -}; - -struct test_status { - long ok; -}; - -#define NUM_BUF 128 -#define MAX_BUF 32 * 8192 -static unsigned char data_buf[MAX_BUF]; - -void -pexit(char *s) -{ - perror(s); - exit(1); -} - -void -show_results(struct timeval *start, struct timeval *end, - int nbufs, int buflen) -{ - struct timeval tot_time; - long tot_bytes = nbufs * buflen; - double real_time, thru; - timersub(end, start, &tot_time); - printf("SINK complete - %d bufs of %d bytes in %ld.%02ld seconds", - nbufs, buflen, - tot_time.tv_sec, tot_time.tv_usec / 10000); - real_time = tot_time.tv_sec + ((tot_time.tv_usec / 10000) * .01); - // Compute bytes / second (rounded up) - thru = tot_bytes / real_time; - // Convert to Mb / second - printf(" - %.2f KB/S", thru / 1024.0); - printf(" - %.4f Mbit/S (M = 10^6)", thru * 8.0 / 1000000.0); - printf("\n"); -} - -int -do_read(int s, unsigned char *buf, int len) -{ - int total, slen, rlen; - total = 0; - rlen = len; - while (total < len) { - slen = read(s, buf, rlen); - if (slen != rlen) { - if (slen < 0) { - printf("Error after reading %d bytes\n", total); - return -1; - } - rlen -= slen; - buf += slen; - } - total += slen; - } - return total; -} - -int -do_write(int s, unsigned char *buf, int len) -{ - int total, slen, rlen; - total = 0; - rlen = len; - while (total < len) { - slen = write(s, buf, rlen); - if (slen != rlen) { - if (slen < 0) { - printf("Error after writing %d bytes\n", total); - return -1; - } - rlen -= slen; - buf += slen; - } - total += slen; - } - return total; -} - -static void -sink_test(char *echo_node) -{ - int s_sink; - struct sockaddr_in slave, local; - int one = 1; - int len; - struct hostent *host; - struct test_params params, nparams; - struct test_status status, nstatus; - struct timeval start_time, end_time; - int i; - - printf("Start TCP test - SINK mode to %s\n", echo_node); - - host = gethostbyname(echo_node); - if (host == (struct hostent *)NULL) { - pexit("gethostbyname"); - } - - memset(&slave, 0, sizeof(slave)); - slave.sin_family = AF_INET; - slave.sin_port = htons(SINK_PORT); - memcpy(&slave.sin_addr.s_addr, host->h_addr, host->h_length); - - s_sink = socket(AF_INET, SOCK_STREAM, 0); - if (s_sink < 0) { - pexit("stream socket"); - } - if (setsockopt(s_sink, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { - pexit("setsockopt /sink/ SO_REUSEADDR"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = INADDR_ANY; - local.sin_addr.s_addr = INADDR_ANY; - if(bind(s_sink, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind /sink/ error"); - } - - if (connect(s_sink, (struct sockaddr *)&slave, sizeof(slave)) < 0) { - pexit("Can't connect to target"); - } - - // Get testing paramters from middleman - if (do_read(s_sink, (unsigned char *)&nparams, sizeof(nparams)) - != sizeof(nparams)) { - pexit("Can't read initialization parameters"); - } - - params.nbufs = ntohl(nparams.nbufs); - params.bufsize = ntohl(nparams.bufsize); - params.load = ntohl(nparams.load); - - printf("Using %ld buffers of %ld bytes each\n", params.nbufs, params.bufsize); - - // Actual test - gettimeofday(&start_time, 0); - for (i = 0; i < params.nbufs; i++) { - if ((len = do_read(s_sink, data_buf, params.bufsize)) != params.bufsize) { - printf("Error reading buffer #%d:", i+1); - if (len < 0) { - perror("can't read data"); - } else { - printf(" short data, only read %d bytes\n", len); - } - } - } - gettimeofday(&end_time, 0); - show_results(&start_time, &end_time, params.nbufs, params.bufsize); - - // Tell the middleman - - nstatus.ok = htonl(status.ok); - - if (do_write(s_sink, (unsigned char *)&nstatus, sizeof(nstatus)) - != sizeof(nstatus)) { - pexit("Can't send ACK to 'echo' host"); - } -} - -int -main(int argc, char *argv[]) -{ - sink_test(argv[1]); - return 0; -} - diff --git a/packages/net/tcpip/current/tests/tcp_source.c b/packages/net/tcpip/current/tests/tcp_source.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/tcp_source.c +++ /dev/null @@ -1,259 +0,0 @@ -//========================================================================== -// -// tests/tcp_source.c -// -// Simple TCP throughput test - source component -// * CAUTION: host, i.e. non eCos, only * -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: This is the middle part of a three part test. The idea is -// to test the throughput of box in a configuration like this: -// -// +------+ port +----+ port +----+ -// |SOURCE|=========>|ECHO|============>|SINK| -// +------+ 9990 +----+ 9991 +----+ -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// Network throughput test code - -#undef _KERNEL -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#define SOURCE_PORT 9990 -#define SINK_PORT 9991 - -struct test_params { - long nbufs; - long bufsize; - long load; -}; - -struct test_status { - long ok; -}; - -#define NUM_BUF 1024 -#define MAX_BUF 8192 -static unsigned char data_buf[MAX_BUF]; - -void -pexit(char *s) -{ - perror(s); - exit(1); -} - -void -show_results(struct timeval *start, struct timeval *end, - int nbufs, int buflen) -{ - struct timeval tot_time; - long tot_bytes = nbufs * buflen; - double real_time, thru; - timersub(end, start, &tot_time); - printf("SOURCE complete - %d bufs of %d bytes in %ld.%02ld seconds", - nbufs, buflen, - tot_time.tv_sec, tot_time.tv_usec / 10000); - real_time = tot_time.tv_sec + ((tot_time.tv_usec / 10000) * .01); - // Compute bytes / second (rounded up) - thru = tot_bytes / real_time; - // Convert to Mb / second - printf(" - %.2f KB/S", thru / 1024.0); - printf(" - %.4f Mbit/S (M = 10^6)", thru * 8.0 / 1000000.0); - printf("\n"); -} - -int -do_read(int s, unsigned char *buf, int len) -{ - int total, slen, rlen; - total = 0; - rlen = len; - while (total < len) { - slen = read(s, buf, rlen); - if (slen != rlen) { - if (slen < 0) { - printf("Error after reading %d bytes\n", total); - return -1; - } - rlen -= slen; - buf += slen; - } - total += slen; - } - return total; -} - -int -do_write(int s, unsigned char *buf, int len) -{ - int total, slen, rlen; - total = 0; - rlen = len; - while (total < len) { - slen = write(s, buf, rlen); - if (slen != rlen) { - if (slen < 0) { - printf("Error after writing %d bytes\n", total); - return -1; - } - rlen -= slen; - buf += slen; - } - total += slen; - } - return total; -} - -static void -source_test(char *echo_node, int load) -{ - int s_source; - struct sockaddr_in slave, local; - int one = 1; - int len; - struct hostent *host; - struct test_params params; - struct test_params nparams; - struct test_status status; - struct test_status nstatus; - struct timeval start_time, end_time; - int i; - - printf("Start TCP test - SOURCE mode to %s\n", echo_node); - - host = gethostbyname(echo_node); - if (host == (struct hostent *)NULL) { - pexit("gethostbyname"); - } - - memset(&slave, 0, sizeof(slave)); - slave.sin_family = AF_INET; - slave.sin_port = htons(SOURCE_PORT); - memcpy(&slave.sin_addr.s_addr, host->h_addr, host->h_length); - - s_source = socket(AF_INET, SOCK_STREAM, 0); - if (s_source < 0) { - pexit("stream socket"); - } - if (setsockopt(s_source, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { - pexit("setsockopt /source/ SO_REUSEADDR"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = INADDR_ANY; - local.sin_addr.s_addr = INADDR_ANY; - if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind /source/ error"); - } - - if (connect(s_source, (struct sockaddr *)&slave, sizeof(slave)) < 0) { - pexit("Can't connect to target"); - } - - params.nbufs = NUM_BUF; - params.bufsize = MAX_BUF; - params.load = load; - - nparams.nbufs = htonl(params.nbufs); - nparams.bufsize = htonl(params.bufsize); - nparams.load = htonl(params.load); - - if ( do_write(s_source, (unsigned char *)&nparams, sizeof(nparams)) - != sizeof(params)) { - pexit("Can't send initialization parameters"); - } - if (do_read(s_source, (unsigned char *)&nstatus, sizeof(nstatus)) - != sizeof(status)) { - pexit("Can't get status from 'echo' client"); - } - - status.ok = ntohl(nstatus.ok); - - // Actual test - gettimeofday(&start_time, 0); - for (i = 0; i < params.nbufs; i++) { - if ((len = do_write(s_source, data_buf, params.bufsize)) != params.bufsize) { - printf("Error writing buffer #%d:", i+1); - if (len < 0) { - perror("can't write data"); - } else { - printf(" short data, only wrote %d bytes\n", len); - } - } - } - gettimeofday(&end_time, 0); - show_results(&start_time, &end_time, params.nbufs, params.bufsize); -} - -int -main(int argc, char *argv[]) -{ - int load = 0; - if (argc > 2) { - load = atoi(argv[2]); - } - source_test(argv[1], load); - return 0; -} - diff --git a/packages/net/tcpip/current/tests/tftp_client_test.c b/packages/net/tcpip/current/tests/tftp_client_test.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/tftp_client_test.c +++ /dev/null @@ -1,140 +0,0 @@ -//========================================================================== -// -// tests/tftp_client_test.c -// -// Simple TFTP client test -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-04-07 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== -// TFTP test code - -#include -#include - -// Note: the TFTP client calls need at least (SEGSIZE==512)+4 -// additional bytes of workspace, thus the padding. -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL+0x1000) -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -#define min(x,y) (xbp_siaddr; - host.sin_port = 0; - diag_printf("Trying tftp_get %s %16s...\n", GETFILE, inet_ntoa(host.sin_addr)); - res = tftp_get( GETFILE, &host, buf, sizeof(buf), TFTP_OCTET, &err); - diag_printf("res = %d, err = %d\n", res, err); - if (res > 0) { - diag_dump_buf(buf, min(res,1024)); - } - len = res; - diag_printf("Trying tftp_put %d %16s, length %d\n", - PUTFILE, inet_ntoa(host.sin_addr), len); - res = tftp_put( PUTFILE, &host, buf, len, TFTP_OCTET, &err); - diag_printf("put - res: %d\n", res); -} - -void -net_test(cyg_addrword_t param) -{ - diag_printf("Start TFTP test\n"); - init_all_network_interfaces(); -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up) { - tftp_test(ð0_bootp_data); - } -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - if (eth1_up) { - tftp_test(ð1_bootp_data); - } -#endif - cyg_test_exit(); -} - -void -cyg_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - net_test, // entry - 0, // entry parameter - "Network test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it - cyg_scheduler_start(); -} diff --git a/packages/net/tcpip/current/tests/tftp_server_test.c b/packages/net/tcpip/current/tests/tftp_server_test.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/tftp_server_test.c +++ /dev/null @@ -1,163 +0,0 @@ -//========================================================================== -// -// tests/tftp_server_test.c -// -// Simple TFTP server test -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-04-07 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== -// TFTP test code - -#include -#include - -#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists -#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME -#endif - -#ifdef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS // do we use the rt test? -# ifdef CYGTST_DEVS_ETH_TEST_NET_REALTIME // Get the test ancilla if it exists -# include CYGTST_DEVS_ETH_TEST_NET_REALTIME -# endif -#endif - - -// Fill in the blanks if necessary -#ifndef TNR_OFF -# define TNR_OFF() -#endif -#ifndef TNR_ON -# define TNR_ON() -#endif -#ifndef TNR_INIT -# define TNR_INIT() -#endif -#ifndef TNR_PRINT_ACTIVITY -# define TNR_PRINT_ACTIVITY() -#endif - -// ------------------------------------------------------------------------ - -#include -#include - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -extern void -cyg_test_exit(void); - -void -pexit(char *s) -{ - perror(s); - cyg_test_exit(); -} - -static void -tftp_test(struct bootp *bp) -{ - int server_id, res; - extern struct tftpd_fileops dummy_fileops; - server_id = tftpd_start(0, &dummy_fileops); - if (server_id > 0) { - diag_printf("TFTP server created - id: %x\n", server_id); - // Only let the server run for 5 minutes - cyg_thread_delay(2*100); // let the tftpd start up first - TNR_ON(); - cyg_thread_delay(5*60*100); - TNR_OFF(); - res = tftpd_stop(server_id); - diag_printf("TFTP server stopped - res: %d\n", res); - } else { - diag_printf("Couldn't create a server!\n"); - } -} - -void -net_test(cyg_addrword_t param) -{ - diag_printf("Start TFTP server test\n"); - init_all_network_interfaces(); - TNR_INIT(); -#ifdef CYGHWR_NET_DRIVER_ETH0 - if (eth0_up) { - tftp_test(ð0_bootp_data); - } -#else - if ( 0 ) ; -#endif -#ifdef CYGHWR_NET_DRIVER_ETH1 - else if (eth1_up) { - tftp_test(ð1_bootp_data); - } -#endif - TNR_PRINT_ACTIVITY(); - cyg_test_exit(); -} - -void -cyg_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - net_test, // entry - 0, // entry parameter - "Network test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it - cyg_scheduler_start(); -} - -// EOF tftp_server_test.c diff --git a/packages/net/tcpip/current/tests/udp_lo_test.c b/packages/net/tcpip/current/tests/udp_lo_test.c deleted file mode 100644 --- a/packages/net/tcpip/current/tests/udp_lo_test.c +++ /dev/null @@ -1,190 +0,0 @@ -//========================================================================== -// -// tests/udp_lo_test.c -// -// Simple UDP throughput test -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): sorin@netappi.com -// Contributors: gthomas,sorin@netappi.com, hmt -// Date: 2000-05-24 - - -// Network throughput test code - -#include - -#include - -#define SOURCE_PORT 9990 -#define SINK_PORT 9991 - -#define NUM_BUF 1024 -#define MAX_BUF 8192 -static unsigned char data_buf[MAX_BUF]; -static unsigned char data_buf_write[MAX_BUF]="Client UDP is alive. You may continue ...."; - -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x10000) -static char stack_server[STACK_SIZE]; -static cyg_thread server_thread_data; -static cyg_handle_t server_thread_handle; - -static char stack_client[STACK_SIZE]; -static cyg_thread client_thread_data; -static cyg_handle_t client_thread_handle; - - -#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-4 - -void -pexit(char *s) -{ - CYG_TEST_FAIL_FINISH( s ); -} - - -void server(void) -{ - int s_source; - struct sockaddr_in local,c_addr; - int c_len; - int len; - - char *hello_string=" Hello eCos network \n"; - diag_printf("UDP SERVER:"); - diag_printf(hello_string); - - s_source = socket(AF_INET, SOCK_DGRAM, 0); - if (s_source < 0) { - pexit("stream socket"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_len = sizeof(local); - local.sin_port = ntohs(SOURCE_PORT); - local.sin_addr.s_addr = htonl(INADDR_ANY); //accepts everyone... - if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) { - pexit("bind /source/ error"); - } - c_len = sizeof(c_addr); - - if ((len = recvfrom(s_source, data_buf, sizeof(data_buf),0, - (struct sockaddr *)&c_addr,&c_len)) < 0 ) { - CYG_TEST_FAIL_FINISH("I/O error"); - } - diag_printf("SERVER : message arrived from %s\n",inet_ntoa(c_addr.sin_addr)); - diag_printf("SERVER : Message : %s\n",data_buf); - close(s_source); -} - -void client(void) -{ - int s_source; - struct sockaddr_in local; - int len; - - diag_printf("client:started\n"); - - s_source = socket(AF_INET, SOCK_DGRAM, 0); - if (s_source < 0) { - pexit("stream socket"); - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = htons(SOURCE_PORT); - local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - if ( (len= sendto(s_source,data_buf_write,sizeof(data_buf_write), - 0,(struct sockaddr *)&local,sizeof(local))) < 0 ) { - CYG_TEST_FAIL_FINISH("Error writing buffer"); - } - close(s_source); -} - -void -udp_server(cyg_addrword_t param) -{ - init_all_network_interfaces(); - diag_printf("Start UDP server - test\n"); - cyg_thread_resume(client_thread_handle); // Start the other one -#if NLOOP > 0 - server(); - CYG_TEST_PASS_FINISH("Server returned OK"); -#endif - CYG_TEST_NA( "No loopback devs" ); -} - -void -udp_client(cyg_addrword_t param) -{ - diag_printf("Start UDP client - test\n"); -#if NLOOP > 0 - client(); -#endif -} - - - -void -cyg_start(void) -{ - CYG_TEST_INIT(); - - cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority - udp_server, // entry - 0, // entry parameter - "UDP loopback server", // Name - &stack_server[0], // Stack - STACK_SIZE, // Size - &server_thread_handle, // Handle - &server_thread_data // Thread data structure - ); - cyg_thread_resume(server_thread_handle); // Start it - - cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority - udp_client, // entry - 0, // entry parameter - "UDP loopback client", // Name - &stack_client[0], // Stack - STACK_SIZE, // Size - &client_thread_handle, // Handle - &client_thread_data // Thread data structure - ); - cyg_scheduler_start(); -} - diff --git a/packages/pkgconf/fixhtml.tcl b/packages/pkgconf/fixhtml.tcl --- a/packages/pkgconf/fixhtml.tcl +++ b/packages/pkgconf/fixhtml.tcl @@ -9,31 +9,38 @@ # Patch HTML files generated from DocBook sources. # #=============================================================================== -#####COPYRIGHTBEGIN#### -# -# =============================================================== -# Copyright (C) 2000, 2001 Red Hat, Inc. +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. # -# This file is part of the eCos host tools. +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. # -# 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 eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. # -# 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. # -# =============================================================== +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. # -#####COPYRIGHTEND#### +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### #=============================================================================== ######DESCRIPTIONBEGIN#### # @@ -119,6 +126,8 @@ foreach file $files { regsub -all "$" $data "\\$" data regsub -all "│" $data "\\│" data regsub -all "\" $data "\\\" data + regsub -all "█" $data "\\█" data + regsub -all "▮" $data "\\▮" data # Now write the data back to the file. Do not bother to # keep an old version lying around, the html files can be diff --git a/packages/pkgconf/rules.doc b/packages/pkgconf/rules.doc --- a/packages/pkgconf/rules.doc +++ b/packages/pkgconf/rules.doc @@ -5,29 +5,38 @@ # Additional rules for processing documentation written in DocBook/SGML # #============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### #============================================================================= #####DESCRIPTIONBEGIN#### # diff --git a/packages/pkgconf/rules.mak b/packages/pkgconf/rules.mak --- a/packages/pkgconf/rules.mak +++ b/packages/pkgconf/rules.mak @@ -5,29 +5,38 @@ # Generic rules for inclusion by all package makefiles. # #============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### #============================================================================= #####DESCRIPTIONBEGIN#### # @@ -74,6 +83,16 @@ endif @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.o.d=.tmp) +%.o.d : %.cpp +ifeq ($(HOST),CYGWIN) + @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"` +else + @mkdir -p $(dir $@) +endif + $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $< + @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ + @rm $(@:.o.d=.tmp) + %.o.d : %.S ifeq ($(HOST),CYGWIN) @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"` @@ -107,6 +126,16 @@ endif @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.d=.tmp) > $@ @rm $(@:.d=.tmp) +%.d : %.cpp +ifeq ($(HOST),CYGWIN) + @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"` +else + @mkdir -p $(dir $@) +endif + $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $< + @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.d=.tmp) > $@ + @rm $(@:.d=.tmp) + %.d : %.S ifeq ($(HOST),CYGWIN) @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"` @@ -135,6 +164,7 @@ endif # generated during compilation tests: tests.stamp +TESTS := $(TESTS:.cpp=) TESTS := $(TESTS:.cxx=) TESTS := $(TESTS:.c=) TESTS := $(TESTS:.S=) diff --git a/packages/pkgconf/stylesheet.dsl b/packages/pkgconf/stylesheet.dsl --- a/packages/pkgconf/stylesheet.dsl +++ b/packages/pkgconf/stylesheet.dsl @@ -7,31 +7,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -110,7 +115,13 @@ ;; Boring admonitions (define %admon-graphics% #f) +;; Nicely decorated program listing (in boxes) (define %shade-verbatim% #t) +(define ($shade-verbatim-attr$) + (list + (list "BORDER" "5") + (list "BGCOLOR" "#E0E0F0") + (list "WIDTH" "70%"))) ;; Use ID attributes as name for component HTML files? (define %use-id-as-filename% #t) diff --git a/packages/redboot/current/ChangeLog b/packages/redboot/current/ChangeLog --- a/packages/redboot/current/ChangeLog +++ b/packages/redboot/current/ChangeLog @@ -1,9 +1,398 @@ +2002-05-18 Gary Thomas + + * src/main.c (do_baud_rate): Improve safety by asking for verification + after actually changing the rate, before updating fconfig data. This + reduces the chance of making a "brick" by setting a bad baud rate. + + * src/flash.c (load_flash_config): Fix set_console_baud_rate prototype. + + * src/io.c (verify_action_with_timeout): + * include/redboot.h: New function verify_action_with_timeout(). + Returns false if no response within XX ms (or ^C). + +2002-05-17 Gary Thomas + + * src/main.c (do_help): + * src/flash.c: + * include/redboot.h: Support nested command structures, like "fis", + better. + +2002-05-17 Jesper Skov + + * doc/redboot_rebuilding.sgml: Rewrote update procedure to become + truly generic. Some minor tweaks. + + * doc/redboot_cmds.sgml: Added id to cksum command. + + * src/shex.c (load_shex_image): Set entry address to be base + address. + * src/load.c (do_load): Same. + + * src/flash.c (fis_create): Infer correct exec and entry + addresses. + + * src/load.c (load_elf_image): Save load_address/end. + + * src/flash.c: Made fis lock/unlock support optional image name + instead of addresses. Made a few places of the code use fis_lookup + instead of scanning the table by steam. + (do_flash_config): Update flash after configuration has been + initialized. + +2002-05-16 Jesper Skov + + * doc/redboot_cmds.sgml: Updated text on cksum to show the new + output format. + + * src/xyzModem.c (xyzModem_stream_read): Fix build breakage. + + * doc/redboot.sgml: Some minor tweaks. + + * src/alias.c (lookup_alias): Renamed freemem aliases. + +2002-05-15 Jesper Skov + + * src/io.c (verify_action): Replaced 'are you sure' with + 'continue'. + * doc/redboot.sgml: Same. + + * src/xyzModem.c: Let Y-modem load correct length. Don't remove + assumed padding bytes since they may well be actual data. Don't + read anything after the EOF package is received. + Disabled the Y-modem header stuff again; it still needs the + padding culling code. So in the end, only the EOF-package read + was at fault. + + * src/main.c: Tweak cksum output. + + * src/flash.c (fis_create): language tweaks. + + * src/main.c: Always call expand_aliases - leave it to that + function to look for flash aliases when appropriate. + + * src/flash.c: Moved basic alias expansion into separate file. + * src/alias.c: New file. Always provide FREE_LOW & FREE_HIGH + aliases, but also call flash_lookup_alias when defined. + + * include/redboot.h: Added declarations for alias functions. Added + getc_t and terminate_t types. + + * src/load.c: Use getc_t/terminate_t types. Made raw load abort if + user tries to load a file too big for memory. + + * cdl/redboot.cdl: Compile alias.c. + +2002-05-14 Jonathan Larmour + + * src/version.c: Clarify comments. + +2002-05-14 Gary Thomas + + * include/redboot.h: + * src/net/net_io.c: + * src/net/dns.c: Merge generic "ip" command with "dns" for + more homogenous interface. + +2002-05-13 Gary Thomas + + * cdl/redboot.cdl: Disable CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP + by default, since its use is currently unclear. + + * src/flash.c (load_flash_config): Check for adequate FIS space + was incorrect [when FIS directory and FCONFIG are combined]. + (fis_lookup): Image name lookup is case insensitive. + +2002-05-10 Gary Thomas + + * src/flash.c: Lots of restructuring in support of combined + FIS and FCONFIG data. + + * cdl/redboot.cdl: + Add new option CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG + to allow FIS directory and FCONFIG data to share the same + physical FLASH block. + +2002-05-03 Gary Thomas + + * src/flash.c (load_flash_config): Adjust fconfig database + address - necessary if FLASH blocks are very small. + +2002-05-02 Gary Thomas + + * src/load.c: Rework how decompression is done (with changes + noted below). Now turning on decompression works by pushing + the decompress code into the stream I/O. + + * src/flash.c (fis_load): + * src/decompress.c (gzip_inflate): + * include/redboot.h: Make decompression code more generalized. + +2002-05-01 Gary Thomas + + * include/elf.h: New file. + + * cdl/redboot.cdl: + * src/load.c (load_elf_image): Support [simple] ELF images. + +2002-04-24 Yoshinori Sato + + * src/xyzModem.c (xyzModem_stream_terminate): Increase time for + cleanup from 100ms to 250ms. + +2002-04-23 Jonathan Larmour + + * src/syscall.c (__do_syscall): Rename EIO to NEWLIB_EIO to + pre-empt any potential conflict. Add definition of + NEWLIB_ENOSYS and use it in place of ENOSYS. + +2002-04-22 Jonathan Larmour + + * doc/redboot.sgml: Document iq80321 switch settings. + + * include/redboot.h: Add gettimeofday, rename, isatty and system + syscall numbers. + + * src/syscall.c (__do_syscall): Handle above new syscalls in a + "default" way. + Take new extra signal argument. + When required, handle file I/O syscalls, by passing into HAL. + +2002-04-21 Paul Fine + + * src/flash.c (flash_get_config, load_flash_config): Save a + pointer to the configuration structure in FLASH. If + flash_get_config fails to find a config item, check to make sure + that the config structure in RAM has not been trashed. If it has + been trashed, set the pointer to the "readonly" version in FLASH + and try to read the config item again. + + * cdl/redboot.cdl (CYGSEM_REDBOOT_FLASH_CONFIG_READONLY_FALLBACK): + Added this flash config option to control the readonly fallback in + flash.c + +2002-04-16 Yoshinori Sato +2002-04-16 Jonathan Larmour + + * src/xyzModem.c: Don't return ACKs too early. + +2002-04-16 Gary Thomas + + * src/net/bootp.c: Readjust timeouts - more, shorter. Better response. + +2002-04-12 Gary Thomas + + * src/net/bootp.c: Increase timeouts for slower networks. + +2002-04-11 Nick Garnett + + * doc/redboot.sgml: Changed some misplaced s into + s. + +2002-04-08 Nick Garnett + + * doc/redboot.sgml: Added full LED code desription, revised memory + layout and miscellaneous other fixes for 80321. + +2002-04-03 Gary Thomas + + * src/main.c (do_mfill): + (do_mcmp): New routines for fill/compare random buffers. + + * cdl/redboot.cdl: CDL to control mfill, mcmp, cksum commands. + + * src/net/net_io.c (do_ip_addr): + * doc/redboot.sgml: Add new command 'ip_addr', used to set/show the + local and host [server] addresses. + +2002-04-02 Jesper Skov + + * redboot.sgml: excalibur: Updated memory map details, added + information about REDBOOT startup mode. + +2002-03-07 Mark Salter + + * src/net/tcp.c: Fix missing acks of resent segments pointed out + by Hendrik Ruijter. + +2002-03-06 Nick Garnett + + * doc/redboot.sgml: Added Integrator details. + +2002-03-06 Mark Salter + + * src/net/tcp.c (__tcp_handler): Slight rework of Hendrik Ruijter's + fix for FIN_WAIT_1 to TIME_WAIT transition. + +2002-03-06 Jesper Skov + + * doc/redboot.sgml: Updated iq80310 details. + Updated iq80321 details. + Updated e7t details. + +2002-03-05 Jesper Skov + + * doc/redboot.sgml: Updated ebsa285 details. + Updated ipaq details. + Updated edb7312 details. + +2002-03-05 Gary Thomas +2002-02-25  Hendrik Ruijter  + + * include/net/net.h: Add 'reuse' flag. + + * src/net/tcp.c + (tcp_send): Adjust socket close time to allow for faster re-use. + (__tcp_handler): State transitions to TIME_WAIT on active close + when FIN,ACK received simultaneously. + (__tcp_so_reuseaddr): New function - select fast re-use. + +2002-03-05 Jesper Skov + + * doc/redboot.sgml: Add something about updating RedBoot on + platforms using ROMRAM-startup type RedBoot. Also mention that fis + create can get some of its information from the fis directory. + Updated assabet details. + +2002-03-01 Mark Salter + + * redboot.sgml: Add diag docs and switch setting info for 80321. + +2002-02-28 Hugo Tyson + + * src/flash.c (do_flash_config): Add "-d" to the help info. + + * doc/redboot.sgml: Docuement the "-d" option for dumb terminals + with fconfig - so you're not forced to use line editing. + +2002-02-28 Jesper Skov + + * src/syscall.c: Moved SYS_ value definitions to the header file. + * include/redboot.h: Same. + +2002-02-27 David Howells + + * sgml/redboot.sgml: Removed extraneous . + +2002-02-26 David Howells + + * doc/redboot.sgml: Updated the ASB2305 notes to be more complete + with respect to having two flash chips. + +2002-02-19 Mark Salter + + * src/net/net_io.c (net_io_init): Remove ISR installation. This + was wrong way to fix problem. + +2002-02-15 Mark Salter + + * src/net/net_io.c (net_io_init): Install default ISR for ethernet. + +2002-02-14 Patrick Doyle + + * src/fs/disk.c (disk_stream_read): Modified to return the number + of bytes read instead of -1 when such number is less than was + requested. + +2002-02-06 Mark Salter + + * src/syscall.c (sys_write): Call __flush after last __putc. + (__flush): New function to flush console output. + +2002-02-05 Jonathan Larmour + + * src/net/net_io.c (net_init): Set use_bootp and net_debug defaults + properly. + +2002-01-31 Gary Thomas + + * src/fs/ide.c (ide_packet_read_sectors): Pass errors on read. + (ide_init): Ignore ATAPI devices that are not CDROM (like ZIP). + +2002-01-30 Hugo Tyson + + * src/net/net_io.c (start_console): Pick up config items to choose + a console for special debug messages. If it's not set, select + channel 0 regardless, like it used to. + (info_console_force, info_console_number): New fconfig options to + control this channel *plus* forcing application special debug out + to a particular serial. This is crucial for debugging debugging + itself, or debugging a networked app over the network when you're + liable to get such messages popping out from the app as well as + from RedBoot. + + * cdl/redboot.cdl (CYGDBG_REDBOOT_NET_DEBUG_CONSOLE_NUMBER): + Option deleted, because this is now controlled by fconfig items. + +2002-01-25 Hugo Tyson + + * src/syscall.c (sys_profile_reset): New routine - doesn't do + much, just NULLs the callback. Useful placeholder in case more is + needed in future, eg. reset the clock also. + (__do_syscall): Calls the reset on syscall 2003. + +2002-01-21 Hugo Tyson + + * src/flash.c (do_flash_config): Enable a "dumb terminal" mode for + fconfig, which does not pre-fill the buffer for editing, but + merely prompts for a new value (or RET for old, for non-string + values). This is because telnet/kermit-like network terminal apps + are not by default configured to pass all characters through. + +2002-01-18 Hugo Tyson + + * src/syscall.c (sys_timer_ticks): Change this to a cyg_uint64 to + give better range for times() sanity in case we run the hardware + clock ticking at a faster rate, or want to last > 8 days. + +2002-01-16 Hugo Tyson + + * src/syscall.c (sys_profile_frequency): Change frequency that is + passed around to signed, so that we can enquire using -ve values. + Re-order the logic a little so as to permit enquiries which do not + modify what's set up in the hardware. Adjust the times() counter + when its HZ rate changes so it tells the truth. + +2002-01-15 David Woodhouse + + * src/flash.c: Better default for 'fis cr' - if we're programming + an existing flash image, take img_size from the last-loaded image + but length from the one that's already on the flash. + +2002-01-14 David Woodhouse + + * src/main.c: Useful defaults for cksum command. + * src/flash.c: Useful defaults for fis create command. + * src/load.c: Slight cleanup of file type detection. + +2002-01-14 Jesper Skov + + * src/net/cksum.c: Added volatile keyword to union members to + prevent compiler optimization messing things up. + +2002-01-10 Hugo Tyson + + * src/syscall.c (sys_timer_isr): Add CYGARC_HAL_SAVE_GP(); and + CYGARC_HAL_RESTORE_GP(); around the callback invocation to protect + ourselves from whatever the app routine might do along those lines. + 2002-01-10 Hugo Tyson * src/syscall.c (sys_timer_ticks): Explicitly initialize this. + (sys_timer_isr): Call periodic callback function, with PC and SP + of interrupted context, if set. + (sys_profile_call_back): New routine to support + gprof profiling of GNUPro/newlib apps via BSP_SYSCALLS. Sets the + periodic callback function, returning the old value. + (sys_profile_frequency): Ditto, sets the frequency of the call, if + possible, or zero => a mere inquiry. + (sys_timer_init, sys_times): Be prepared for a dynamic non-default + clock rate. + (__do_syscall): Handle new case arms. * cdl/redboot.cdl (CYGSEM_REDBOOT_BSP_SYSCALLS): Changed to a component; want to add stuff in here later. + (CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF): New option + to control inclusion of histogram profiling callback syscalls. 2002-01-10 Jesper Skov @@ -326,6 +715,41 @@ 2001-09-28 Gary Thomas + + * src/net/dns.c: Include tracing header. + +2001-09-26 Jesper Skov + + * src/net/dns.c: Removed errno hacks. + Reduce size of string buffers. Make sure they suffice (or fail). + + * include/redboot.h: Added DNS h_errno definitions. + + * include/redboot.h: Fix for building on targets wo network. + + * src/load.c (do_load): Make sure host can be reached - and print + appropriate error message if not. + + * src/net/net_io.c (net_init): Call DNS init when appropriate. + + * src/net/inet_addr.c (inet_aton): Made s argument const. + + * src/net/dns.c: Added UDP driven DNS support. + + * src/net/bootp.c: Fixed warnings. + + * src/flash.c: Replaced inet_aton with _gethostbyname. + * src/load.c: Same. + * src/net/ping.c: Same. + + * include/net/net.h: Fix warning. + + * include/redboot.h: Added DNS stuff, including some string + helpers. + + * cdl/redboot.cdl: Added DNS support options. + 2001-09-14 Jonathan Larmour * src/version.c: Simplify _CERTIFICATE handling. @@ -1942,27 +2366,36 @@ 2000-07-12 Gary Thomas " } + cdl_option CYGSEM_REDBOOT_ELF { + flavor bool + display "Include support for ELF file format" + default_value 1 + } + cdl_component CYGBLD_BUILD_REDBOOT { display "Build Redboot ROM ELF image" default_value 0 @@ -114,6 +129,21 @@ cdl_package CYGPKG_REDBOOT { enable rudimentary editting of the lines themselves." } + cdl_option CYGBLD_BUILD_REDBOOT_WITH_CKSUM { + display "Include POSIX checksum command" + default_value 1 + } + + cdl_option CYGBLD_BUILD_REDBOOT_WITH_MFILL { + display "Include memory fill command" + default_value 1 + } + + cdl_option CYGBLD_BUILD_REDBOOT_WITH_MCMP { + display "Include memory compare command" + default_value 1 + } + no_define description "This option enables the building of the Redboot ELF image. The image may require further relocation or symbol @@ -121,7 +151,7 @@ cdl_package CYGPKG_REDBOOT { This is handled by a rule in the target CDL." compile main.c crc.c - compile misc_funs.c io.c parse.c ticks.c xyzModem.c syscall.c + compile misc_funs.c io.c parse.c ticks.c xyzModem.c syscall.c alias.c compile -library=libextras.a load.c make -priority 320 { @@ -154,16 +184,6 @@ cdl_package CYGPKG_REDBOOT { This option is overriden by the configuration stored in flash." } - cdl_option CYGDBG_REDBOOT_NET_DEBUG_CONSOLE_NUMBER { - display "Console number for net debug information" - flavor data - default_value 0 - description " - 0 is normally serial port 0, 1 is serial port 1. Some boards don't - have a serial 0, or it may not be brought out to a connector, - so this option is available to change things." - } - cdl_component CYGDAT_REDBOOT_DEFAULT_IP_ADDR { display "Default IP address" flavor booldata @@ -212,6 +232,37 @@ cdl_package CYGPKG_REDBOOT { than the default." } + cdl_component CYGPKG_REDBOOT_NETWORKING_DNS { + display "DNS support" + default_value 1 + requires CYGPKG_NS_DNS + requires !CYGPKG_NS_DNS_BUILD + compile net/dns.c + description " + When this option is enabled, RedBoot will be built with + support for DNS, allowing use of hostnames on the command + line." + + cdl_option CYGPKG_REDBOOT_NETWORKING_DNS_IP { + display "Default DNS IP" + flavor data + active_if !CYGSEM_REDBOOT_FLASH_CONFIG + default_value { "0.0.0.0" } + description " + This option sets the IP of the default DNS. The IP can be + changed at runtime as well." + } + + cdl_option CYGNUM_REDBOOT_NETWORKING_DNS_TIMEOUT { + display "Timeout in DNS lookup" + flavor data + default_value 10 + description " + This option sets the timeout used when looking up an + address via the DNS. Default is 10 seconds." + } + + } } cdl_option CYGPKG_REDBOOT_ANY_CONSOLE { @@ -408,7 +459,7 @@ cdl_package CYGPKG_REDBOOT { cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP { display "File to describe RedBoot backup image" - default_value 1 + default_value 0 description " This option controls creation of an entry describing a backup RedBoot image in the fis init command. @@ -446,6 +497,17 @@ cdl_package CYGPKG_REDBOOT { to be used for configuration options (persistent storage)." } + cdl_option CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG { + display "Merged config data and FIS directory" + flavor bool + active_if CYGOPT_REDBOOT_FIS + default_value 0 + description " + If this option is set, then the FIS directory and FLASH + configuration database will be stored in the same physical + FLASH block." + } + cdl_option CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK { display "Which block of flash to use" flavor data @@ -484,6 +546,21 @@ cdl_package CYGPKG_REDBOOT { This option is used to control the amount of memory and FLASH to be used for configuration options (persistent storage)." } + + cdl_option CYGSEM_REDBOOT_FLASH_CONFIG_READONLY_FALLBACK { + display "Fallback to read-only FLASH configuration" + flavor bool + default_value 1 + description " + This option will cause the configuration information to + revert to the readonly information stored in the FLASH. + The option only takes effect after + 1) the config_ok flag has been set to be true, + indicating that at one time the copy in RAM was valid; + and + 2) the information in RAM has been verified to be invalid" + + } } cdl_option CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL { @@ -645,6 +722,25 @@ cdl_package CYGPKG_REDBOOT { description " If this option is enabled then RedBoot will install a syscall handler to support debugging of applications based on GNUPro newlib/bsp." + + cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF { + display "Support additional syscalls for 'gprof' profiling" + flavor bool + default_value 1 + active_if { 0 < CYGINT_REDBOOT_BSP_SYSCALLS_GPROF_SUPPORT } + description " + Support additional syscalls to support a periodic callback + function for histogram-style profiling, and an enquire/set + of the tick rate. + The application must use the GNUPro newlib facilities + to set this up." + } + + cdl_interface CYGINT_REDBOOT_BSP_SYSCALLS_GPROF_SUPPORT { + display "Does the HAL support 'gprof' profiling?" + no_define + } } } +# EOF redboot.cdl diff --git a/packages/redboot/current/doc/redboot.sgml b/packages/redboot/current/doc/redboot.sgml new file mode 100644 --- /dev/null +++ b/packages/redboot/current/doc/redboot.sgml @@ -0,0 +1,416 @@ + +RedBoot™ User's Guide + + +Getting Started with RedBoot +Red Bootgetting started +RedBoot™ is an acronym for "Red Hat Embedded Debug and Bootstrap", +and is the standard embedded system debug/bootstrap environment from Red Hat, +replacing the previous generation of debug firmware: CygMon +CygMon and GDB stubsGDB +stubs. It provides a complete bootstrap environment for a range of embedded +operating systems, such as embedded Linux™ and eCos™, and includes facilities +such as network downloading and debugging. It also provides a simple flash +file system for boot images. +RedBoot provides a wide set of tools for downloading and executing programs +on embedded target systems, as well as tools for manipulating the target system's +environment. It can be used for both product development (debug support) and +for end product deployment (flash and network booting). +Here are some highlights of RedBoot's capabilities +RedBoot’s capabilities: + +Boot scripting support + +Simple command line interface for RedBoot configuration and +management, accessible via serial (terminal) or Ethernet (telnet) + +Integrated GDB stubs for connection to a host-based debugger +via serial or ethernet. (Ethernet connectivity is limited to local network +only) + +Attribute Configuration - user control of aspects such as +system time and date (if applicable), default Flash image to boot from, default +failsafe image, static IP address, etc. + +Configurable and extensible, specifically adapted to the target +environment + +Network bootstrap support including setup and download, via +BOOTP, DHCP and TFTP + +X/YModem support for image download via serial + +Power On Self Test + + +Although RedBoot is derived from eCos, it may be used as a generalized +system debug and bootstrap control software for any embedded system and any +operating system. For example, with appropriate additions, RedBoot could replace +the commonly used BIOS of PC (and certain other) architectures. Red Hat is +currently installing RedBoot on all embedded platforms as a standard practice, +and RedBoot is now generally included as part of all Red Hat Embedded Linux +and eCos ports. Users who specifically wish to use RedBoot with the eCos operating +system should refer to the Getting Started with eCos +document, which provides information about the portability and extendability +of RedBoot in an eCos environment. + +More information about RedBoot on the web + +Information about the RedBoot product, including information about +details of porting, +customization, training and technical support services from Red Hat, is +available from the +RedBoot +Product web site. +The RedBoot Net +Distribution web site contains downloadable sources and documentation +for all publically released targets, including the latest features and updates. + + + +Installing RedBoot +installing RedBootgeneral procedures +RedBoot installation +general proceduresTo install the RedBoot +package, follow the procedures detailed in the accompanying README. +Although there are other possible configurations, RedBoot is usually +run from the target platform’s flash boot sector or boot ROM, and is +designed to run when your system is initially powered on. The method used +to install the RedBoot image into non-volatile storage varies from platform +to platform. In general, it requires that the image be programmed into flash +in situ or programmed into the flash or ROM using a device programmer. In +some cases this will be done at manufacturing time; the platform being delivered +with RedBoot already in place. In other cases, you will have to program RedBoot +into the appropriate device(s) yourself. Installing to flash in situ may require +special cabling or interface devices and software provided by the board manufacturer. +The details of this installation process for a given platform will be found +in Installation and Testing. Once installed, user-specific configuration options +may be applied, using the fconfig command, +providing that persistent data storage in flash is present in the relevant +RedBoot version. See +for details. + + +User Interface +user interface +uicliRedBoot +provides a command line user interface (CLI). At the minimum, this interface +is normally available on a serial port on the platform. If more than one serial +interface is available, RedBoot is normally configured to try to use any one +of the ports for the CLI. Once command input has been received on one port, +that port is used exclusively until the board is reset or the channel +is manually changed by the +user. If the platform has networking +capabilities, the RedBoot CLI is also accessible using the +telnet access protocol. By default, RedBoot runs +telnettelnet on port TCP/9000, +but this is configurable and/or settable by the user. +RedBoot also contains a set of GDB stubs +GDB "stubs", consisting of code which supports the GDB remote +protocol. GDB stub mode is automatically invoked when the '$' character appears +anywhere on a command line unless escaped using the '\' character. +The platform will remain in GDB +stub mode until explicitly disconnected (via the GDB protocol). The GDB stub +mode is available regardless of the connection method; either serial or network. +Note that if a GDB connection is made via the network, then special care must +be taken to preserve that connection when running user code. eCos contains +special network sharing code to allow for this situation, and can be used +as a model if this methodology is required in other OS environments. + + +Configuring the RedBoot Environment +configuring the RedBoot environment +RedBoot environment configuration +environment configuration +Once installed, RedBoot will operate fairly generically. However, +there are some features that can be configured for a particular installation. +These depend primarily on whether flash and/or networking +supportnetworking and/or flash support +flash and/or networking support are available. The remainder +of this discussion assumes that support for both of these options is included +in RedBoot. + +Target Network Configuration +target network configuration +network configurationconfiguration +secondaryEach node in a networked +system needs to have a unique address. Since the network support in RedBoot +is based on TCP/IPTCP/IP, this address +is an IP (Internet Protocol) address. IP address type +There are two ways for a system to “know” +its IP address. First, it can be stored locally on the platform. This is known +as having a static IP address. Second, the system can use the network itself +to discover its IP address. This is known as a dynamic IP address. RedBoot +supports this dynamic IP address mode by use of the BOOTP +BOOTP (a subset of DHCP +DHCP) protocol. In this case, RedBoot will ask the network (actually +some generic server on the network) for the IP address to use. +NOTE +Currently, RedBoot only supports BOOTP. In future releases, DHCP may +also be supported, but such support will be limited to additional data items, +not lease-based address allocation. + +The choice of IP address typeIP +address type is made via the fconfig command +fconfig command. Once a selection +is made, it will be stored in flash memory. RedBoot only queries the flash +configuration information at reset, so any changes will require restarting +the platform. +Here is an example of the RedBoot fconfig +command, showing network addressing: +RedBoot> fconfig -l +Run script at boot: false +Use BOOTP for network configuration: false +Local IP address: 192.168.1.29 +Default server IP address: 192.168.1.101 +DNS server IP address: 192.168.1.1 +GDB connection port: 9000 +Network debug at boot time: false +In this case, the board has been configured with a static IP address +listed as the Local IP address. The default server IP address specifies which +network node to communicate with for TFTP service. This address can be overridden +directly in the TFTP commandsTFTP +commands. +The DNS server IP address option +controls where RedBoot should make DNS lookupsDNS +lookups. A setting of 0.0.0.0 will disable DNS +lookups. The DNS server IP address can also be set at runtime. +If the selection for Use BOOTP for network configuration + had been true, these IP +addresses would be determined at boot time, via the BOOTP protocol. The final +number which needs to be configured, regardless of IP address selection mode, +is the GDB connection port +GDB connection port. RedBoot allows for incoming commands +on either the available serial ports or via the network. This port number +is the TCP port that RedBoot will use to accept incoming connections. +These connections can be used for GDB sessions, but they can also be +used for generic RedBoot commands. In particular, it is possible to communicate +with RedBoot via the telnettelnet +protocol. For example, on Linux®: +% telnet redboot_board 9000 +Connected to redboot_board +Escape character is ‘^]’. +RedBoot> + + +Host Network Configuration +host network configuration +network configurationhost +configurationnetworkRedBoot +may require three different classes of service from a network host: + +dynamic IP address allocation, using BOOTP + +TFTP service for file downloading + +DNS server for hostname lookups + + +Depending on the host system, these services may or may not be available +or enabled by default. See your system documentation for more details. +In particular, on Red Hat Linux, neither of these services will be configured +out of the box. The following will provide a limited explanation of how to +set them up. These configuration setups must be done as root + on the host or server machine. + +Enable TFTP on Red Hat Linux 6.2 + +TFTPenabling on Red Hat +Linux 6.2Red Hat Linux +enabling TFTP on version 6.2Ensure that +you have the tftp-server RPM package installed. By default, this installs +the TFTP server in a disabled state. These steps will enable it: + +Make sure that the following line is uncommented in the control +file /etc/inetd.conf tftp dgram udp wait root /usr/sbin/tcpd /usr/sbin/in.tftpd + + + +If it was necessary to change the line in Step 2, then the inetd +server must be restarted, which can be done via the command: +# service inet reload + + + + +Enable TFTP on Red Hat Linux 7 (or newer) + +TFTPenabling on Red Hat +Linux 7Red Hat Linux +enabling TFTP on version 7Ensure that the +xinetd RPM is installed. + +Ensure that the tftp-server RPM is installed. + +Enable TFTP by means of the following: /sbin/chkconfig tftp on +Reload the xinetd configuration using the command: + /sbin/service xinetd reload Create the directory /tftpboot +using the command mkdir /tftpboot + + +NOTE +Under Red Hat 7 you must address files by absolute pathnames, for example: +/tftpboot/boot.img not /boot.img, as you may have done with +other implementations. +On systems newer than Red Hat 7 (7.1 and beyond), filenames are once again relative to the +/tftpboot directory. + + + + +Enable BOOTP/DHCP server on Red Hat Linux +DHCPenabling on Red Hat Linux +BOOTP +enabling on Red Hat LinuxFirst, ensure that you have +the proper package, dhcp (not +dhcpd) installed. The DHCP server provides Dynamic Host Configuration, +that is, IP address and other data to hosts on a network. It does this in +different ways. Next, there can be a fixed relationship between a certain +node and the data, based on that node’s unique Ethernet Station Address +(ESA, sometimes called a MAC address). The other possibility is simply to +assign addresses that are free. The sample DHCP configuration file shown does +both. Refer to the DHCP documentation for more details. +Sample DHCP configuration file +--------------- /etc/dhcpd.conf ----------------------------- +default-lease-time 600; +max-lease-time 7200; +option subnet-mask 255.255.255.0; +option broadcast-address 192.168.1.255; +option domain-name-servers 198.41.0.4, 128.9.0.107; +option domain-name “bogus.com”; +allow bootp; +shared-network BOGUS { +subnet 192.168.1.0 netmask 255.255.255.0 { + option routers 192.168.1.101; + range 192.168.1.1 192.168.1.254; +} + } +host mbx { + hardware ethernet 08:00:3E:28:79:B8; + fixed-address 192.168.1.20; + filename “/tftpboot/192.168.1.21/zImage”; + default-lease-time -1; + server-name “srvr.bugus.com”; + server-identifier 192.168.1.101; + option host-name “mbx”; +} +Once the DHCP package has been installed and the configuration file +set up, type: +# service dhcpd start + + +Enable DNS server on Red Hat Linux +DNSenabling on Red Hat +LinuxFirst, ensure that you have the proper +RPM package, caching-nameserver +installed. Then change the configuration +(in /etc/named.conf) so that the +forwarders point to the primary +nameservers for your machine, normally using the nameservers listed in +/etc/resolv.conf. + + +Sample <filename>/etc/named.conf</filename> for Red Hat Linux 7.x + + +--------------- /etc/named.conf ----------------------------- +// generated by named-bootconf.pl + +options { + directory "/var/named"; + /* + * If there is a firewall between you and nameservers you want + * to talk to, you might need to uncomment the query-source + * directive below. Previous versions of BIND always asked + * questions using port 53, but BIND 8.1 uses an unprivileged + * port by default. + */ + // query-source address * port 53; + + + forward first; + forwarders { + 212.242.40.3; + 212.242.40.51; + }; +}; + +// +// a caching only nameserver config +// +// Uncomment the following for Red Hat Linux 7.2 or above: +// controls { +// inet 127.0.0.1 allow { localhost; } keys { rndckey; }; +// }; +// include "/etc/rndc.key"; +zone "." IN { + type hint; + file "named.ca"; +}; + +zone "localhost" IN { + type master; + file "localhost.zone"; + allow-update { none; }; +}; + +zone "0.0.127.in-addr.arpa" IN { + type master; + file "named.local"; + allow-update { none; }; +}; + + + +Make sure the server is started with the command: +# service named start and is +started on next reboot with the command +# chkconfig named on +Finally, you may wish to change +/etc/resolv.conf to use +127.0.0.1 as the nameserver for your +local machine. + + +RedBoot network gateway +RedBoot network gateway +network gatewayRedBoot cannot communicate with +machines on different subnets because it does not support routing. It always +assumes that it can get to an address directly, therefore it always tries +to ARP and then send packets directly to that unit. This means that whatever +it talks to must be on the same subnet. If you need to talk to a host on a +different subnet (even if it's on the same ‘wire’), you need to +go through an ARP proxy, providing that there is a Linux box connected to +the network which is able to route to the TFTP server. For example: +/proc/sys/net/ipv4/conf/<interface>/proxy_arp where +<interface>should be replaced with whichever network interface +is directly connected to the board. + + +Verification +verification (network) +network verificationOnce your network setup +has been configured, perform simple verification tests as follows: +Reboot your system, to enable the setup, and then try to ‘ping’ +the target board from a host. + +Once communication has been established, try to ping +a host using the RedBoot ping command - both by IP address and hostname. + +Try using the RedBoot load command to download a file +from a host. + + + + + + + + + + + + + + + diff --git a/packages/redboot/current/doc/redboot_cmds.sgml b/packages/redboot/current/doc/redboot_cmds.sgml new file mode 100644 --- /dev/null +++ b/packages/redboot/current/doc/redboot_cmds.sgml @@ -0,0 +1,2357 @@ + +RedBoot Commands and Examples + +Introduction +RedBootcommands and examples +commands and examples +RedBoot provides three basic classes of commands: +Program loading and execution + +Flash image and configuration management + +Miscellaneous commands + +Given the extensible and configurable nature of eCos and RedBoot, +there may be extended or enhanced sets of commands available. +The basic format for commands is: RedBoot> COMMAND [-S] [-s val] operand +Commands may require additional information beyond the basic +command name. In most cases this additional information is optional, with +suitable default values provided if they are not present. The type of information +required affects how it is specified: [-S]An +optional switch. If this switch is present, then some particular action will +take place. For example in the command +RedBoot> fis init -f + the -f switch indicates to perform a full file system +initialization. [-s val]An optional switch +which requires an associated value. For example the command: +RedBoot> load -b 0x00100000 data_filespecifies downloading +a file (via TFTP) into memory, relocating it to location 0x00100000. +operandThis format is used in a case where a command has +one operand which must always be present (no -s is required since it is always +implied). For example the command +RedBoot> go 0x10044 +specifies executing the code starting at location 0x10044. + +The list of available commands, and their syntax, can be obtained by +typing help at the command line: +RedBoot> help +Manage aliases kept in FLASH memory + alias name [value] +Set/Query the system console baud rate + baudrate [-b <rate>] +Manage machine caches + cache [ON | OFF] +Display/switch console channel + channel [-1|<channel number>] +Display disk partitions + disks +Display (hex dump) a range of memory + dump -b <location> [-l <length>] [-s] +Manage flash images + fis {cmds} +Manage configuration kept in FLASH memory + fconfig [-i] [-l] [-n] [-f] [-d] | [-d] nickname [value] +Execute code at a location + go [-w <timeout>] [entry] +Help about help? + help [<topic>] +Set/change IP addresses + ip_address [-l <local_ip_address>] [-h <server_address>] +Load a file + load [-r] [-v] [-d] [-c <channel>] [-h <host>] [-m {TFTP | xyzMODEM | disk}] + [-b <base_address>] <file_name> +Network connectivity test + ping [-v] [-n <count>] [-t <timeout>] [-i <IP_addr] + -h <host> +Reset the system + reset +Display RedBoot version information + version +Display (hex dump) a range of memory + x -b <location> [-l <length>] [-s] + + + +Commands can be abbreviated to their shortest +unique string. Thus in the list above, d,du,dum +and dump are all valid for the dump command. The fconfig +command can be abbreviated fc, but +f would be ambiguous with fis. + +There is one additional, special command. When RedBoot detects '$' or '+' +(unless escaped via '\') in a command, it switches to GDB protocol mode. At this +point, the eCos GDB stubs take over, allowing connections from a GDB host. +The only way to get back to RedBoot from GDB mode is to restart the platform. + +NOTE + +Multiple commands may be entered on a single line, separated by the semi-colon “;” character. + + +The standard RedBoot command set is structured around the bootstrap +environment. These commands are designed to be simple to use and remember, +while still providing sufficient power and flexibility to be useful. No attempt +has been made to render RedBoot as the end-all product. As such, things such +as the debug environment are left to other modules, such as GDB stubs, which +are typically included in RedBoot. +The command set may be also be extended on a platform basis. + + + +RedBoot Editing Commands +RedBootediting commands +editing commands +commandseditingRedBoot +uses the following line editing commands. +NOTE + +In this description, ^A means the character formed +by typing the letter “A” while holding down the control key. + + +Delete (0x7F) or +Backspace (0x08) +erases the character to the left of the cursor. + + +^A +moves the cursor (insertion point) to the beginning of the line. + + +^K +erases all characters on the line from the cursor to the end. + + +^E +positions the cursor to the end of the line. + + +^D +erases the character under the cursor. + + +^F +moves the cursor one character to the right. + + +^B +moves the cursor one character to the left. + + +^P +replaces the current line by a previous line from the history buffer. +A small number of lines +can be kept as history. Using ^P (and ^N), the current line can be replaced +by any one of the previously typed lines. + + +^N +replaces the current line by the next line from the history buffer. + + +In the case of the fconfig +command, additional editing commands are possible. +As data are entered for this command, the current/previous value +will be displayed and the cursor placed at the end of that data. +The user may use the editing keys (above) to move around in the data +to modify it as appropriate. +Additionally, when certain +characters are entered at the end of the current value, +i.e. entered separately, certain behavior is elicited. + + +^ (caret) switch to editing the previous item in the +fconfig list. If fconfig edits item A, followed by item B, +pressing ^ when changing item B, allows you to change item A. This is similar +to the up arrow. +Note: ^P and ^N do not have the same meaning while editing +fconfig data and should not be used. + + +. (period) stop editing any further items. This does not change +the current item. + +Return leaves the value +for this item unchanged. Currently it is not possible to step through the +value for the start-up script; it must always be retyped. + + + + + +Common Commands + + commandscommon + + + + + + + alias + Manipulate command line aliases + + + + alias + name + value + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + name + Name + The name for this alias. + none + + + value + String + Replacement value for the alias. + none + + + + + + + Description + The alias command is used to maintain simple command +line aliases. These aliases are shorthand for longer expressions. +When the pattern %{name} appears in a command line, including in a script, +the corresponding value will be substituted. Aliases may be nested. + + +If no value is provided, then the current value of the alias is displayed. + + +If the system supports non-volatile configuration data via the +fconfig command (see ), +then the value will be saved and used when the system is reset. + + + + Examples + +Set an alias. + +RedBoot> alias joe "This is Joe" +Update RedBoot non-volatile configuration - continue (y/n)? n + + + +Display an alias. + +RedBoot> alias joe +'joe' = 'This is Joe' + + + +Use an alias. Note: the "=" command simply echoes the command to to console. + +RedBoot> = %{joe} +This is Joe + + + +Aliases can be nested. + +RedBoot> alias frank "Who are you? %{joe}" +Update RedBoot non-volatile configuration - continue (y/n)? n +RedBoot> = %{frank} +Who are you? This is Joe + + + +Notice how the value of %{frank} changes when %{joe} is changed since +the value of %{joe} is not evaluated until %{frank} is evaluated. + +RedBoot> alias joe "This is now Josephine" +Update RedBoot non-volatile configuration - continue (y/n)? n +RedBoot> = %{frank} +Who are you? This is now Josephine + + + + + + + + + baudrate + Set the baud rate for the system serial console + + + + baudrate + -b rate + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -b rate + Number + The baud rate to use for the serial console. + none + + + + + + + Description + The baudrate command sets the baud rate for the system serial console. + + +If no value is provided, then the current value of the console baud rate is displayed. + + +If the system supports non-volatile configuration data via the +fconfig command (see ), +then the value will be saved and used when the system is reset. + + + + Examples + +Show the current baud rate. + +RedBoot> baudrate +Baud rate = 38400 + + + +Change the console baud rate. In order to make this operation safer, +there will be a slight pause after the +first message to give you time to change to the new baud rate. +If it doesn't work, or a less than affirmative answer is given to the +"continue" prompt, then the baud rate will revert to the current value. +Only after the baud rate has been firmly established will RedBoot +give you an opportunity to save the value in persistent storage. + +RedBoot> baudrate -b 57600 +Baud rate will be changed to 57600 - update your settings +Device baud rate changed at this point +Baud rate changed to 57600 - continue (y/n)? y +Update RedBoot non-volatile configuration - continue (y/n)? n + + + + + + + + + cache + Control hardware caches + + + + cache + + on + off + + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + on + + Turn the caches on + none + + + off + + Turn the caches off + none + + + + + + + Description + The cache command is used to manipulate the caches on the processor. + With no options, this command specifies the state of the system caches. + When an option is given, the caches are turned off or on appropriately. + + + Examples + +Show the current cache state. + +RedBoot> cache +Data cache: On, Instruction cache: On + + + +Disable the caches. + +RedBoot> cache off +RedBoot> cache +Data cache: Off, Instruction cache: Off + + + +Enable the caches. + +RedBoot> cache on +RedBoot> cache +Data cache: On, Instruction cache: On + + + + + + + + + channel + Select the system console channel + + + + channel + + -1 + channel_number + + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -1 + + Reset the console channel + none + + + channel_number + Number + Select a channel + none + + + + + + + Description + +With no arguments, the channel command displays the current console channel number. + +When passed an argument of 0 upwards, this command switches the console +channel to that channel number. The mapping between channel numbers and +physical channels is platform specific but will typically be something like +channel 0 is the first serial port, channel 1 is the second, etc. + +When passed an argument of -1, this command reverts RedBoot to responding +to whatever channel receives input first, as happens when RedBoot initially +starts execution. + + + + Examples + +Show the current channel. + +RedBoot> channel +Current console channel id: 0 + + + +Change to an invalid channel. + +RedBoot> channel 99 +**Error: bad channel number '99' + + + +Revert to the default channel setting (any console mode). + +RedBoot> channel -1 + + + + + + + + + cksum + Compute POSIX checksums + + + + cksum + -b location + -l length + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -b location + Memory address + Location in memory for stat of data. + none + + + -l length + Number + Length of data + none + + + + + + + Description + Computes the POSIX checksum on a range of memory (either RAM or FLASH). +The values printed (decimal cksum, decimal length, hexadecimal cksum, + hexadecimal length) can be compared with the output from the Linux program 'cksum'. + + + + Examples + +Checksum a buffer. + +RedBoot> cksum -b 0x100000 -l 0x100 +POSIX cksum = 3286483632 256 (0xc3e3c2b0 0x00000100) + + + +Checksum an area of memory after loading a file. Note that the base +address and length parameters are provided by the preceding +load command. + +RedBoot> load -r -b %{FREEMEMLO} redboot.bin +Raw file loaded 0x06012800-0x0602f0a8 +RedBoot> cksum +Computing cksum for area 0x06012800-0x0602f0a8 +POSIX cksum = 2092197813 116904 (0x7cb467b5 0x0001c8a8) + + + + + + + + + disks + List available disk partitions. + + + + disks + + + + Arguments +None. + + + Description + The disks command is used to list disk partitions recognized by RedBoot. + + + Examples + +Show what disk partitions are available. + +RedBoot> disks +00100000: 00 3E 00 06 00 06 00 06 00 00 00 00 00 00 00 00 |.>..............| +00100010: 00 00 00 78 00 70 00 60 00 60 00 60 00 60 00 60 |...x.p.`.`.`.`.`| + + + + + + + + + dump + Display memory. + + + + dump + -b location + -l length + -s + + -1 + -2 + -4 + + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -b location + Memory address + Location in memory for start of data. + none + + + -l length + Number + Length of data + 32 + + + -s + Boolean + Format data using Motorola S-records. + + + + -1 + + Access one byte (8 bits) at a time. +Only the least significant 8 bits of the pattern will be used. + -1 + + + -2 + + Access two bytes (16 bits) at a time. +Only the least significant 16 bits of the pattern will be used. + -1 + + + -4 + + Access one word (32 bits) at a time. + -1 + + + + + + + Description + Display a range of memory on the system console. + The x is a synonym for dump. + Note that this command could +be detrimental if used on memory mapped hardware registers. + The memory is displayed at most sixteen bytes per line, first as the +raw hex value, followed by an ASCII interpretation of the data. + + + Examples + +Display a buffer, one byte at a time. + +RedBoot> mfill -b 0x100000 -l 0x20 -p 0xDEADFACE +RedBoot> x -b 0x100000 +00100000: CE FA AD DE CE FA AD DE CE FA AD DE CE FA AD DE |................| +00100010: CE FA AD DE CE FA AD DE CE FA AD DE CE FA AD DE |................| + + + +Display a buffer, one short (16 bit) word at a time. Note in this case that +the ASCII interpretation is suppressed. + +RedBoot> dump -b 0x100000 -2 +00100000: FACE DEAD FACE DEAD FACE DEAD FACE DEAD +00100010: FACE DEAD FACE DEAD FACE DEAD FACE DEAD + + + +Display a buffer, one word (32 bit) word at a time. Note in this case that +the ASCII interpretation is suppressed. + +RedBoot> dump -b 0x100000 -4 +00100000: DEADFACE DEADFACE DEADFACE DEADFACE +00100010: DEADFACE DEADFACE DEADFACE DEADFACE + + + +Display the same buffer, using Motorola S-record format. + +RedBoot> dump -b 0x100000 -s +S31500100000CEFAADDECEFAADDECEFAADDECEFAADDE8E +S31500100010CEFAADDECEFAADDECEFAADDECEFAADDE7E + + + +Display a buffer, with visible ASCII strings. + +RedBoot> d -b 0xfe00b000 -l 0x80 +0xFE00B000: 20 25 70 0A 00 00 00 00 41 74 74 65 6D 70 74 20 | %p.....Attempt | +0xFE00B010: 74 6F 20 6C 6F 61 64 20 53 2D 72 65 63 6F 72 64 |to load S-record| +0xFE00B020: 20 64 61 74 61 20 74 6F 20 61 64 64 72 65 73 73 | data to address| +0xFE00B030: 3A 20 25 70 20 5B 6E 6F 74 20 69 6E 20 52 41 4D |: %p [not in RAM| +0xFE00B040: 5D 0A 00 00 2A 2A 2A 20 57 61 72 6E 69 6E 67 21 |]...*** Warning!| +0xFE00B050: 20 43 68 65 63 6B 73 75 6D 20 66 61 69 6C 75 72 | Checksum failur| +0xFE00B060: 65 20 2D 20 41 64 64 72 3A 20 25 6C 78 2C 20 25 |e - Addr: %lx, %| +0xFE00B070: 30 32 6C 58 20 3C 3E 20 25 30 32 6C 58 0A 00 00 |02lX <> %02lX...| +0xFE00B080: 45 6E 74 72 79 20 70 6F 69 6E 74 3A 20 25 70 2C |Entry point: %p,| + + + + + + + + + help + Display help on available commands + + + + help + topic + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + topic + String + Which command to provide help for. + All commands + + + + + + + Description + +The help command displays information about the available +RedBoot commands. If a topic is given, then the display +is restricted to information about that specific command. + + +If the command has sub-commands, e.g. fis, then the topic +specific display will print additional information about the available sub-commands. +special (ICMP) packets to a specific host. These packets should be automatically +returned by that host. The command will indicate how many of these round-trips +were successfully completed. + + + + Examples + +Show generic help. Note that the contents of this display will depend on the various configuration +options for RedBoot when it was built. + +RedBoot> help +Manage aliases kept in FLASH memory + alias name [value] +Manage machine caches + cache [ON | OFF] +Display/switch console channel + channel [-1|<channel number>] +Compute a 32bit checksum [POSIX algorithm] for a range of memory + cksum -b <location> -l <length> +Display (hex dump) a range of memory + dump -b <location> [-l <length>] [-s] [-1|2|4] +Manage FLASH images + fis {cmds} +Manage configuration kept in FLASH memory + fconfig [-i] [-l] [-n] [-f] [-d] | [-d] nickname [value] +Execute code at a location + go [-w <timeout>] [entry] +Help about help? + help [<topic>] +Set/change IP addresses + ip_address [-l <local_ip_address>] [-h <server_address>] +Load a file + load [-r] [-v] [-d] [-h <host>] [-m {TFTP | xyzMODEM -c <channel_number>}] + [-b <base_address>] <file_name> +Compare two blocks of memory + mcmp -s <location> -d <location> -l <length> [-1|-2|-4] +Fill a block of memory with a pattern + mfill -b <location> -l <length> -p <pattern> [-1|-2|-4] +Network connectivity test + ping [-v] [-n <count>] [-l <length>] [-t <timeout>] [-r <rate>] + [-i <IP_addr>] -h <IP_addr> +Reset the system + reset +Display RedBoot version information + version +Display (hex dump) a range of memory + x -b <location> [-l <length>] [-s] [-1|2|4] + + + +Help about a command with sub-commands. + +RedBoot> help fis +Manage FLASH images + fis {cmds} +Create an image + fis create -b <mem_base> -l <image_length> [-s <data_length>] + [-f <flash_addr>] [-e <entry_point>] [-r <ram_addr>] [-n] <name> +Display an image from FLASH Image System [FIS] + fis delete name +Erase FLASH contents + fis erase -f <flash_addr> -l <length> +Display free [available] locations within FLASH Image System [FIS] + fis free +Initialize FLASH Image System [FIS] + fis init [-f] +Display contents of FLASH Image System [FIS] + fis list [-c] [-d] +Load image from FLASH Image System [FIS] into RAM + fis load [-d] [-b <memory_load_address>] [-c] name +Write raw data directly to FLASH + fis write -f <flash_addr> -b <mem_base> -l <image_length> + + + + + + + + + ip_address + Set IP addresses + + + + ip_address + -l local_IP_address + -h server_IP_address + -d +DNS_server_IP_address + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -l +local_IP_address + Numeric IP or DNS name + The IP address RedBoot should use. + none + + + -h +server_IP_address + Numeric IP or DNS name + The IP address of the default server. Use of this +address is implied by other commands, such as +load. + none + + + -d +DNS_server_IP_address + Numeric IP or DNS name + The IP address of the DNS server. + none + + + + + + + Description + The ip_address command is used to show and/or change the basic IP +addresses used by RedBoot. IP addresses may be given as numeric +values, e.g. 192.168.1.67, or as symbolic names such as www.redhat.com +if DNS support is enabled. + + +The option is used to set the IP address used by +the target device. + + +The option is used to set the default server +address, such as is used by the load command. + + +The option is used to set the default DNS server +address which is used for resolving symbolic network addresses. Note +that an address of 0.0.0.0 will disable DNS lookups. + + + + Examples + +Display the current network settings. + +RedBoot> ip_address +IP: 192.168.1.31, Default server: 192.168.1.101, DNS server IP: 0.0.0.0 + + + +Change the DNS server address. + +RedBoot> ip_address -d 192.168.1.101 +IP: 192.168.1.31, Default server: 192.168.1.101, DNS server IP: 192.168.1.101 + + + +Change the default server address. + +RedBoot> ip_address -h 192.168.1.104 +IP: 192.168.1.31, Default server: 192.168.1.104, DNS server IP: 192.168.1.101 + + + + + + + + + load + Download programs or data to the RedBoot platform + + + + load + -v + -d + -r + -m + + xmodem + ymodem + tftp + disk + + + -h server_IP_address + -b location + -c channel + file_name + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -v + Boolean + Display a small spinner (indicator) +while the download is in progress. This is just for feedback, especially +during long loads. Note that the option has no effect when using a +serial download method since it would interfere with the protocol. + quiet + + + -d + Boolean + Decompress data stream (gzip data) + non-compressed data + + + -r + Boolean + Raw (or binary) data + formatted (S-records, ELF image, etc) + + + -m tftp + + Transfer data via the network using tftp protocol. + tftp + + + -m xmodem + + Transfer data using X-modem protocol. + tftp + + + -m ymodem + + Transfer data using Y-modem protocol. + tftp + + + -m disk + + Transfer data from a local disk. + tftp + + + -h server_IP_address + Numeric IP or DNS name + The IP address of the tftp server. + Value set by ip_address + + + -b location + Number + Address in memory to load the data. Formatted data streams will have +an implied load address which this option may override. + Depends on data format + + + -c channel + Number + Specify which I/O channel to +use for download. This option is only supported when using either +xmodem or ymodem protocol. + Depends on data format + + + file_name + String + The name of the file on the TFTP +server or the local disk. Details of how this is specified for TFTP are +host-specific. For local disk files, the name must be in disk: +filename format. The disk portion must match one of the disk +names listed by the disks command. + None + + + + + + + Description + +The load command is used to download +data into the target system. Data can be loaded via a network connection, +using either the TFTP protocol, or the console serial connection using the +X/Y modem protocol. Files may also be loaded directly from local filesystems +on disk. Files to be downloaded may either be executable images in +ELF executable program format, +Motorola S-record (SREC) +format or raw data. + + + + Examples + +Download a Motorola S-record (or ELF) image, using TFTP, specifying the +base memory address. + +RedBoot> lo redboot.ROM -b 0x8c400000 +Address offset = 0x0c400000 +Entry point: 0x80000000, address range: 0x80000000-0x8000fe80 + + + + + + + + + mcmp + Compare two segments of memory + + + + mcmp + -s location1 + -d location1 + -l length + + -1 + -2 + -4 + + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -s location1 + Memory address + Location for start of data. + none + + + -d location2 + Memory address + Location for start of data. + none + + + -l length + Number + Length of data + none + + + -1 + + Access one byte (8 bits) at a time. +Only the least significant 8 bits of the pattern will be used. + -4 + + + -2 + + Access two bytes (16 bits) at a time. +Only the least significant 16 bits of the pattern will be used. + -4 + + + -4 + + Access one word (32 bits) at a time. + -4 + + + + + + + Description + Compares the contents of two ranges of memory (RAM, ROM, FLASH, etc). + + + Examples + +Compare two buffers which match (result is quiet). + +RedBoot> mfill -b 0x100000 -l 0x20 -p 0xDEADFACE +RedBoot> mfill -b 0x200000 -l 0x20 -p 0xDEADFACE +RedBoot> mcmp -s 0x100000 -d 0x200000 -l 0x20 + + + +Compare two buffers which don't match. +Only the first non-matching element is displayed. + +RedBoot> mcmp -s 0x100000 -d 0x200000 -l 0x30 -2 +Buffers don't match - 0x00100020=0x6000, 0x00200020=0x0000 + + + + + + + + + mfill + Fill RAM with a specified pattern + + + + mfill + -b location + -l length + -p value + + -1 + -2 + -4 + + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -b location + Memory address + Location in memory for start of data. + none + + + -l length + Number + Length of data + none + + + -p pattern + Number + Data value to fill with + 0 + + + -1 + + Access one byte (8 bits) at a time. +Only the least significant 8 bits of the pattern will be used. + -4 + + + -2 + + Access two bytes (16 bits) at a time. +Only the least significant 16 bits of the pattern will be used. + -4 + + + -4 + + Access one word (32 bits) at a time. + -4 + + + + + + + Description + Fills a range of memory with the given pattern. + + + Examples + +Fill a buffer with zeros. + +RedBoot> x -b 0x100000 -l 0x20 +00100000: 00 3E 00 06 00 06 00 06 00 00 00 00 00 00 00 00 |.>..............| +00100010: 00 00 00 78 00 70 00 60 00 60 00 60 00 60 00 60 |...x.p.`.`.`.`.`| +RedBoot> mfill -b 0x100000 -l 0x20 +RedBoot> x -b 0x100000 -l 0x20 +00100000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00100010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + + + +Fill a buffer with a pattern. + +RedBoot> mfill -b 0x100000 -l 0x20 -p 0xDEADFACE +RedBoot> x -b 0x100000 -l 0x20 +00100000: CE FA AD DE CE FA AD DE CE FA AD DE CE FA AD DE |................| +00100010: CE FA AD DE CE FA AD DE CE FA AD DE CE FA AD DE |................| + + + + + + + + + ping + Verify network connectivity + + + + ping + -v + -i local_IP_address + -l length + -n count + -t timeout + -r rate + -h server_IP_address + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -v + Boolean + Be verbose, displaying information about each packet sent. + quiet + + + -n local_IP_address + Number + Controls the number of packets to be sent. + 10 + + + -i local_IP_address + Numeric IP or DNS name + The IP address RedBoot should use. + Value set by ip_address + + + -h server_IP_address + Numeric IP or DNS name + The IP address of the host to contact. + none + + + -l length + Number + The length of the ICMP data payload. + 64 + + + -r length + Number + How fast to deliver packets, i.e. time between successive sends. +A value of 0 sends packets as quickly as possible. + 1000ms (1 second) + + + -t length + Number + How long to wait for the round-trip to complete, specified in milliseconds. + 1000ms (1 second) + + + + + + + Description + +The ping command checks the connectivity of the local network by sending +special (ICMP) packets to a specific host. These packets should be automatically +returned by that host. The command will indicate how many of these round-trips +were successfully completed. + + + + Examples + +Test connectivity to host 192.168.1.101. + +RedBoot> ping -h 192.168.1.101 +Network PING - from 192.168.1.31 to 192.168.1.101 +PING - received 10 of 10 expected + + + +Test connectivity to host 192.168.1.101, with verbose reporting. + +RedBoot> ping -h 192.168.1.101 -v -n 4 +Network PING - from 192.168.1.31 to 192.168.1.101 + seq: 1, time: 1 (ticks) + seq: 2, time: 1 (ticks) + seq: 3, time: 1 (ticks) + seq: 4, time: 1 (ticks) +PING - received 10 of 10 expected + + + +Test connectivity to a non-existant host (192.168.1.109). + +RedBoot> ping -h 192.168.1.109 -v -n 4 +PING: Cannot reach server '192.168.1.109' (192.168.1.109) + + + + + + + + + reset + Reset the device + + + + reset + + + + Arguments +None + + + Description + +The reset command causes the target platform to be reset. +Where possible (hardware support permitting), this will be +equivalent to a power-on reset condition. + + + + Examples + +Reset the platform. + +RedBoot> reset +... Resetting.+... Waiting for network card: . +Socket Communications, Inc: Low Power Ethernet CF Revision C 5V/3.3V 08/27/98 +Ethernet eth0: MAC address 00:c0:1b:00:ba:28 +IP: 192.168.1.29, Default server: 192.168.1.101 + +RedBoot(tm) bootstrap and debug environment [ROM] +Non-certified release, version UNKNOWN - built 10:41:41, May 14 2002 + +Platform: Compaq iPAQ Pocket PC (StrongARM 1110) +Copyright (C) 2000, 2001, 2002, Red Hat, Inc. + +RAM: 0x00000000-0x01fc0000, 0x00014748-0x01f71000 available +FLASH: 0x50000000 - 0x51000000, 64 blocks of 0x00040000 bytes each. +RedBoot> + + + + + + + + + + version + Display RedBoot version information + + + + version + + + + Arguments + None + + + Description + The version command simply displays version information about RedBoot. + + + + Examples + +Display RedBoot's version. + +RedBoot> version +RedBoot(tm) debug environment - built 09:12:03, Feb 12 2001 +Platform: XYZ (PowerPC 860) +Copyright (C) 2000, 2001, Red Hat, Inc. +RAM: 0x00000000-0x00400000 + + + + + + + + +Flash Image System (FIS) +commandsflash image system +flash image system commands +commandsfis +fis commandsIf the platform +has flash memory, RedBoot can use this for image storage. Executable images, +as well as data, can be stored in flash in a simple file store. The +fis command is used to manipulate and maintain flash images. + +The available fis commands are: + +fis init [-f] + +This command is used to initialize the flash Image System (FIS). It +should only be executed once, when RedBoot is first installed on the hardware. +Subsequent executions will cause loss of data in the flash (previously saved +images will no longer be accessible). +If the -f option is specified, all +blocks of flash memory will be erased as part of this process. + + + + +RedBoot> fis init -f +About to initialize [format] flash image system - continue (y/n)? n + + +fis [-c] [-d] list + +This command lists the images currently available in the FIS. Certain +images used by RedBoot have fixed names. Other images can be manipulated by +the user. +If the -c option is specified, the image checksum +is displayed instead of the Mem Addr field. + +If the -d option is specified, the image +datalength is displayed instead of the +length [amount of flash used]. The datalength +is the length of data within the allocated flash image actually being +used for data. + + + + + +RedBoot> fis list +Name flash addr Mem addr Length Entry point +RedBoot 0xA0000000 0xA0000000 0x020000 0x80000000 +RedBoot config 0xA0FC0000 0xA0FC0000 0x020000 0x00000000 +FIS directory 0xA0FE0000 0xA0FE0000 0x020000 0x00000000 +RedBoot> fis list -c +Name flash addr Checksum Length Entry point +RedBoot 0xA0000000 0x34C94A57 0x020000 0x80000000 +RedBoot config 0xA0FC0000 0x00000000 0x020000 0x00000000 +RedBoot config 0xA0FE0000 0x00000000 0x020000 0x00000000 + + +fis free + +This command shows which areas of the flash memory are currently not +in use. In use means that the block contains non-erased contents. Since it +is possible to force an image to be loaded at a particular flash location, +this command can be used to check whether that location is in use by any other +image. +NOTE +There is currently no cross-checking between actual flash contents and +the image directory, which mans that there could be a segment of flash which +is not erased that does not correspond to a named image, or vice-versa. + + + + + + +RedBoot> fis free + 0xA0040000 .. 0xA07C0000 + 0xA0840000 .. 0xA0FC0000 + + +fis create -b <mem_base> -l <length> [-f <flash_addr>] +[-e <entry_point>] [-r <ram_addr>] [-s <data_length>] [-n] <name> + + +This command creates an image in the FIS directory. The data for the +image must exist in RAM memory before the copy. Typically, you would use the +RedBoot load command to load an image into +RAM and then the fis create command to write +it to flash. + + + +Arguments + + + + +name +The name of the file, as shown +in the FIS directory. + +-b +The location in RAM used to obtain +the image. This is a required option. + +-l +The length of the image. If the +image already exists, then the length is inferred from when the image was +previously created. If specified, and the image exists, it must match the +original value. + +-f +The location in flash for the +image, which will be inferred for extant images if not specified. If this +is not provided, the first freeVblock which is large enough will be used. +See fis free. + +-e +The execution entry address. This +is used if the starting address for an image is not known, or needs to be +overridden. + +-r +The location in RAM when the image +is loaded via fis load. This only needs to +be specified for images which will eventually loaded via +fis load. Fixed images, such as RedBoot itself, will not +need this. + + -s +The length of the actual data +to be written to flash. If not present then the image length (-1) value is +assumed. If the value given by -s is less than -1, the remainder of the image +in flash will be left in an erased state. Note that by using this option it +is possible to create a completely empty flash image, for example to reserve +space for use by applications other than RedBoot. + +-n +If -n is specified, then only +the FIS directory is updated, and no data is copied from RAM to flash. This +feature can be used to recreate the FIS entry if it has been destroyed. + + +RedBoot> fis create RedBoot -f 0xa0000000 -b 0x8c400000 -l 0x20000 +An image named ‘RedBoot’ exists - continue (y/n)? n +RedBoot> fis create junk -b 0x8c400000 -l 0x20000 +... Erase from 0xa0040000-0xa0060000: . +... Program from 0x8c400000-0x8c420000 at 0xa0040000: . +... Erase from 0xa0fe0000-0xa1000000: . +... Program from 0x8c7d0000-0x8c7f0000 at 0xa0fe0000: . +If +you are loading an existing file, then the fis create command will provide +some values automatically, such as the flash address and flash length. + +fis load [-b <memory load address>] [-c] [-d] name + + +This command is used to transfer an image from flash memory to RAM. + +Once loaded, it may be executed using the go command. If -b is specified, +then the image is copied from flash to the specified address in RAM. If -b +is not specified, the image is copied from flash to the load address given +when the image was created. + + + +Arguments + + + + + +name +The name of the file, as shown +in the FIS directory + +-b +Specify the location in memory +to which the file should be loaded. Executable images normally load at the +location to which the file was linked. This option allows the file to be loaded +to a specific memory location, possibly overriding any assumed location. + +-c +Compute and print the checksum +of the image data after it has been loaded into memory. + +-d +Decompress gzipped image while +copying it from flash to RAM. + + + +RedBoot> fis load RedBoot[RAM] +RedBoot> go + + + +fis delete name + +This command removes an image from the FIS. The flash memory will be +erased as part of the execution of this command, as well as removal of the +name from the FIS directory. + + + + +RedBoot> fis list +Name flash addr Mem addr Length Entry point +RedBoot 0xA0000000 0xA0000000 0x020000 0x80000000 +RedBoot config 0xA0FC0000 0xA0FC0000 0x020000 0x00000000 +FIS directory 0xA0FE0000 0xA0FE0000 0x020000 0x00000000 +junk 0xA0040000 0x8C400000 0x020000 0x80000000 +RedBoot> fis delete junk +Delete image ‘junk’ - continue (y/n)? y +... Erase from 0xa0040000-0xa0060000: . +... Erase from 0xa0fe0000-0xa1000000: . +... Program from 0x8c7d0000-0x8c7f0000 at 0xa0fe0000: . + + +NOTE +Certain images are reserved by RedBoot and cannot be deleted. +RedBoot will issue a warning if this is attempted. + + + +fis lock -f <flash_addr> -l <length> + +This command is used to write-protect (lock) a portion of flash memory, +to prevent accidental overwriting of images. In order to make make any modifications +to the flash, a matching unlock command must be issued. This command is optional +and will only be provided on hardware which can support write-protection of +the flash space. +NOTE +Depending on the system, attempting to write to write-protected flash +may generate errors or warnings, or be benignly quiet. + + + + + +RedBoot> fis lock -f 0xa0040000 -l 0x20000 +... Lock from 0xa0040000-0xa0060000: . + + + +fis unlock -f <flash_addr> -l <length> + +This command is used to unlock a portion of flash memory forcibly, allowing +it to be updated. It must be issued for regions which have been locked before +the FIS can reuse those portions of flash. + + + + +RedBoot> fis unlock -f 0xa0040000 -l 0x20000 +... Unlock from 0xa0040000-0xa0060000: . + + + +fis erase -f <flash_addr> -l <length> + +This command is used to erase a portion of flash memory forcibly. There +is no cross-checking to ensure that the area being erased does not correspond +to a loaded image. + + + + +RedBoot> fis erase -f 0xa0040000 -l 0x20000 +... Erase from 0xa0040000-0xa0060000: . + + + +fis write -b <location> -l <length> -f <flash +addr> + +Writes data from RAM at <location> to flash. + + + + + +Persistent State Flash-based Configuration and Control +persistent state flash-based configuration and control +flash-based configuration and control +configuration and control +flash-based +RedBoot provides flash management support for storage in the flash memory +of multiple executable images and of non-volatile information such as IP addresses +and other network information. +RedBoot on platforms that support flash based configuration information +will report the following message the first time that RedBoot is booted on +the target: +flash configuration checksum error or invalid key +This error can be ignored if no flash based configuration is desired, +or can be silenced by running the fconfig +command as described below. At this point you may also wish to run the +fis init command. See other fis commands in . + +Certain control and configuration information used by RedBoot can be +stored in flash. +The details of what information is maintained in flash differ, based +on the platform and the configuration. However, the basic operation used to +maintain this information is the same. Using the fconfig -l + command, the information may be displayed and/or changed. + +If the optional flag -i is specified, +then the configuration database will be reset to its default +state. This is also needed the first time RedBoot is installed on the +target, or when updating to a newer RedBoot with different +configuration keys. + +If the optional flag -l is specified, +the configuration data is simply listed. Otherwise, each configuration parameter +will be displayed and you are given a chance to change it. The entire value +must be typed - typing just carriage return will leave a value unchanged. +Boolean values may be entered using the first letter (t +for true, f for false). At any time the editing +process may be stopped simply by entering a period (.) on the line. Entering +the caret (^) moves the editing back to the previous item. See “RedBoot +Editing Commands”, . +If any changes are made in the configuration, then the updated data +will be written back to flash after getting acknowledgement from the user. + + +If the optional flag -n is specified +(with or without -l) then “nicknames” +of the entries are used. These are shorter and less descriptive than +“full” names. The full name may also be displayed by adding the +-f flag. +The reason for telling you nicknames is that a quick way to set a single +entry is provided, using the format + + RedBoot> fconfig nickname value + +If no +value is supplied, the command will list and prompt for only that entry. +If a value is supplied, then the entry will be set to that value. You will +be prompted whether to write the new information into flash if any change +was made. For example + + RedBoot> fconfig -l -n + boot_script: false + bootp: false + bootp_my_ip: 10.16.19.176 + bootp_server_ip: 10.16.19.66 + dns_ip: 10.16.19.1 + gdb_port: 9000 + net_debug: false + RedBoot> fconfig bootp_my_ip 10.16.19.177 + bootp_my_ip: 10.16.19.176 Setting to 10.16.19.177 + Update RedBoot non-volatile configuration - continue (y/n)? y + ... Unlock from 0x507c0000-0x507e0000: . + ... Erase from 0x507c0000-0x507e0000: . + ... Program from 0x0000a8d0-0x0000acd0 at 0x507c0000: . + ... Lock from 0x507c0000-0x507e0000: . + RedBoot> + + +Additionally, nicknames can be used like aliases via the format %{nickname}. +This allows the values stored by fconfig to be used +directly by scripts and commands. + +Depending on how your terminal program is connected and its +capabilities, you might find that you are unable to use line-editing to +delete the ‘old’ value when using the default behaviour of +fconfig nickname or just +plain fconfig, as shown in this example: + +RedBoot> fco bootp +bootp: false_ + +The user deletes the word “false;&rdquo and enters “true” +so the display looks like this: + +RedBoot> fco bootp +bootp: true +Update RedBoot non-volatile configuration - continue (y/n)? y +... Unlock from ... +RedBoot> _ + + +To edit when you cannot backspace, use the optional flag +-d (for “dumb terminal”) +to provide a simpler interface thus: + +RedBoot> fco -d bootp +bootp: false ? _ + +and you enter the value in the obvious manner thus: + +RedBoot> fco -d bootp +bootp: false ? true +Update RedBoot non-volatile configuration - continue (y/n)? y +... Unlock from ... +RedBoot> _ + + +One item which is always present in the configuration data is the ability +to execute a script at boot time. A sequence of RedBoot commands can be entered +which will be executed when the system starts up. Optionally, a time-out period +can be provided which allows the user to abort the startup script and proceed +with normal command processing from the console. + +RedBoot> fconfig -l +Run script at boot: false +Use BOOTP for network configuration: false +Local IP address: 192.168.1.29 +Default server IP address: 192.168.1.101 +DNS server IP address: 192.168.1.1 +GDB connection port: 9000 +Network debug at boot time: false + +The following example sets a boot script and then shows it running. + + + +RedBoot> fconfig +Run script at boot: false t + Boot script: +Enter script, terminate with empty line +>> fi li + Boot script timeout: 0 10 +Use BOOTP for network configuration: false . +Update RedBoot non-volatile configuration - continue (y/n)? y +... Erase from 0xa0fc0000-0xa0fe0000: . +... Program from 0x8c021f60-0x8c022360 at 0xa0fc0000: . +RedBoot> +RedBoot(tm) debug environment - built 08:22:24, Aug 23 2000 +Copyright (C) 2000, Red Hat, Inc. + + +RAM: 0x8c000000-0x8c800000 +flash: 0xa0000000 - 0xa1000000, 128 blocks of 0x00020000 bytes ea. +Socket Communications, Inc: Low Power Ethernet CF Revision C \ +5V/3.3V 08/27/98 IP: 192.168.1.29, Default server: 192.168.1.101 \ +== Executing boot script in 10 seconds - enter ^C to abort +RedBoot> fi li +Name flash addr Mem addr Length Entry point +RedBoot 0xA0000000 0xA0000000 0x020000 0x80000000 +RedBoot config 0xA0FC0000 0xA0FC0000 0x020000 0x00000000 +FIS directory 0xA0FE0000 0xA0FE0000 0x020000 0x00000000 +RedBoot> + + +NOTE +The bold characters above indicate where something was entered on the +console. As you can see, the fi li command +at the end came from the script, +not the console. Once the script is executed, command processing reverts to +the console. + + +NOTE + +RedBoot supports the notion of a boot script timeout, i.e. a period of +time that RedBoot waits before executing the boot time script. This period +is primarily to allow the possibility of cancelling the script. Since +a timeout value of zero (0) seconds would never allow the script to +be aborted or cancelled, this value is not allowed. If the timeout +value is zero, then RedBoot will abort the script execution immediately. + + +On many targets, RedBoot may be configured to run from ROM or it may be +configured to run from RAM. Other configurations are also possible. All +RedBoot configurations will execute the boot script, but in certain cases +it may be desirable to limit the execution of certain script commands to +one RedBoot configuration or the other. This can be accomplished by +prepending {<startup type>} to the +commands which should be executed only by the RedBoot configured for the +specified startup type. The following boot script illustrates this concept +by having the ROM based RedBoot load and run the RAM based RedBoot. The RAM +based RedBoot will then list flash images. + +RedBoot> fco +Run script at boot: false t +Boot script: +Enter script, terminate with empty line +>> {ROM}fis load RedBoot[RAM] +>> {ROM}go +>> {RAM}fis li +>> +Boot script timeout (1000ms resolution): 2 +Use BOOTP for network configuration: false + ... +Update RedBoot non-volatile configuration - continue (y/n)? y +... Unlock from 0x007c0000-0x007e0000: . +... Erase from 0x007c0000-0x007e0000: . +... Program from 0xa0015030-0xa0016030 at 0x007df000: . +... Lock from 0x007c0000-0x007e0000: . +RedBoot> reset +... Resetting. ++Ethernet eth0: MAC address 00:80:4d:46:01:05 +IP: 192.168.1.153, Default server: 192.168.1.10 + +RedBoot(tm) bootstrap and debug environment [ROM] +Red Hat certified release, version R1.xx - built 17:37:36, Aug 14 2001 + +Platform: IQ80310 (XScale) +Copyright (C) 2000, 2001, Red Hat, Inc. + +RAM: 0xa0000000-0xa2000000, 0xa001b088-0xa1fdf000 available +FLASH: 0x00000000 - 0x00800000, 64 blocks of 0x00020000 bytes each. +== Executing boot script in 2.000 seconds - enter ^C to abort +RedBoot> fis load RedBoot[RAM] +RedBoot> go ++Ethernet eth0: MAC address 00:80:4d:46:01:05 +IP: 192.168.1.153, Default server: 192.168.1.10 + +RedBoot(tm) bootstrap and debug environment [RAM] +Red Hat certified release, version R1.xx - built 13:03:47, Aug 14 2001 + +Platform: IQ80310 (XScale) +Copyright (C) 2000, 2001, Red Hat, Inc. + +RAM: 0xa0000000-0xa2000000, 0xa0057fe8-0xa1fdf000 available +FLASH: 0x00000000 - 0x00800000, 64 blocks of 0x00020000 bytes each. +== Executing boot script in 2.000 seconds - enter ^C to abort +RedBoot> fis li +Name FLASH addr Mem addr Length Entry point +RedBoot 0x00000000 0x00000000 0x00040000 0x00002000 +RedBoot config 0x007DF000 0x007DF000 0x00001000 0x00000000 +FIS directory 0x007E0000 0x007E0000 0x00020000 0x00000000 +RedBoot> + + + +Executing Programs from RedBoot +executing programs +RedBootexecuting programsOnce +an image has been loaded into memory, either via the load + command or the fis load +command, execution may be transfered to that image. + NOTE +The image is assumed to be a stand-alone entity, as RedBoot gives the +entire platform over to it. Typical examples would be an eCos application +or a Linux kernel. + + + + + + + go + Execute a program + + + + go + -w timeout + start_address + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -w timeout + Number + How long to wait before starting execution. + 0 + + + start_address + Number + Address in memory to begin execution. + Value set by last load or fis load command. + + + + + + + Description + +The go command causes RedBoot to give control of the target platform to +another program. This program must execute stand alone, e.g. an eCos +application or a Linux kernel. + + +If the -w option is used, RedBoot will print a message and then +wait for a period of time before starting the execution. This is +most useful in a script, giving the user a chance to abort executing +a program and move on in the script. + + + + Examples + +Execute a program - no explicit output from RedBoot. + +RedBoot> go 0x40040 + + + +Execute a program with a timeout. + +RedBoot> go -w 10 +About to start execution at 0x00000000 - abort with ^C within 10 seconds +^C +RedBoot> + +Note that the starting address was implied (0x00000000 in this example). +The user is prompted that execution will commence in 10 seconds. At +anytime within that 10 seconds the user may type Ctrl+C +on the console and RedBoot will abort execution and return for the next +command, either from a script or the console. + + + + + + + + exec + Execute a Linux kernel + + + + exec + -w timeout + -r ramdisk_address + -s ramdisk_length + -b load_address + -l load_length + + -c kernel_command_line + entry_point + + + + Arguments + + + + + + + + + Name + Type + Description + Default + + + + + -w timeout + Number + Time to wait before starting execution. + 0 + + + -r ramdisk_address + Number + Address in memory of "initrd"-style ramdisk - passed to Linux kernel. + None + + + -s ramdisk_length + Number + Length of ramdisk image - passed to Linux kernel. + None + + + -b load_address + Number + Address in memory of the Linux kernel image. + Value set by load or fis load + + + -l load_length + Number + Length of Linux kernel image. + none + + + -c kernel_command_line + String + Command line to pass to the Linux kernel. + None + + + entry_address + Number + Starting address for Linux kernel execution + Implied by architecture + + + + + + + Description + +The exec command is used to execute a non-eCos application, typically a +Linux kernel. Additional information may be passed to the kernel at startup +time. This command is quite special (and unique from the go command) in +that the program being executed may expect certain environmental setups, for +example that the MMU is turned off, etc. +The Linux kernel expects to have been loaded to a particular memory +location which is architecture dependent(0xC0008000 in the case of the SA1110). +Since this memory is used +by RedBoot internally, it is not possible to load the kernel to that location +directly. Thus the requirement for the "-b" option which tells the command +where the kernel has been loaded. When the exec command runs, the image will +be relocated to the appropriate location before being started. The "-r" and +"-s" options are used to pass information to the kernel about where a statically +loaded ramdisk (initrd) is located. +The "-c" option can be used to pass textual "command line" information +to the kernel. If the command line data contains any puncuation (spaces, +etc), then it must be quoted using the double-quote character '"'. If the +quote character is required, it should be written as '\"'. + + + + Examples + +Execute a Linux kernel, passing a command line, which needs relocation. +The result from RedBoot is normally quiet, with the target platform being +passed over to Linux immediately. + +RedBoot> exec -b 0x100000 -l 0x80000 -c "noinitrd root=/dev/mtdblock3 console=ttySA0" + + + +Execute a Linux kernel, default entry address and no relocation required, with a timeout. +The emphasized lines are output from the loaded kernel. + +RedBoot> exec -c "console=ttyS0,38400 ip=dhcp nfsroot=/export/elfs-sh" -w 5 +Now booting linux kernel: +Base address 0x8c001000 Entry 0x8c210000 +Cmdline : console=ttyS0,38400 ip=dhcp nfsroot=/export/elfs-sh +About to start execution at 0x8x210000 - abort with ^C within 5 seconds + +Linux version 2.4.10-pre6 (...) (gcc version 3.1-stdsh-010931) #3 Thu Sep 27 11:04:23 BST 2001 + + + + + + + + diff --git a/packages/redboot/current/doc/redboot_epilogue.sgml b/packages/redboot/current/doc/redboot_epilogue.sgml new file mode 100644 --- /dev/null +++ b/packages/redboot/current/doc/redboot_epilogue.sgml @@ -0,0 +1,3 @@ + + + diff --git a/packages/redboot/current/doc/redboot_installing.sgml b/packages/redboot/current/doc/redboot_installing.sgml new file mode 100644 --- /dev/null +++ b/packages/redboot/current/doc/redboot_installing.sgml @@ -0,0 +1,5160 @@ + +Installation and Testing +installing and testing RedBoot +RedBootinstalling and testing + +Cyclone IQ80310 + +Overview +Cyclone IQ80310installing and +testinginstalling and testing +Cyclone IQ80310RedBoot supports +both serial ports and the built-in ethernet port for communication and downloads. +The default serial port settings are 115200,8,N,1. RedBoot also supports flash +management for the onboard 8MB flash. Several basic RedBoot configurations +are supported: + +RedBoot running from the board's flash boot sector. + +RedBoot running from flash address 0x40000, with ARM bootloader +in flash boot sector. + +RedBoot running from RAM with RedBoot in the flash boot sector. + + +RedBoot running from RAM with ARM bootloader in flash boot +sector. + + +A special RedBoot command: diag is +used to access a set of hardware diagnostics provided by the board manufacturer. + + + +Initial Installation Method +The board manufacturer provides a DOS application which is capable of +programming the flash over the PCI bus, and this is required for initial installations +of RedBoot. Please see the board manual for information on using this utility. +In general, the process involves programming one of the two flash based RedBoot +configurations to flash. The RedBoot which runs from the flash boot sector +should be programmed to flash address 0x00000000. RedBoot that has been configured +to be started by the ARM bootloader should be programmed to flash address +0x00004000. +Four sets of prebuilt files are provided in a tarball and zip format. +Each set corresponds to one of the four supported configurations and includes +an ELF file (.elf), a binary image (.bin), and an S-record file (.srec). +For RedBoot running from the flash boot sector: +bins/cyclone-rom.bin +bins/cyclone-rom.elf +bins/cyclone-rom.srec + + +For RedBoot running from flash address 0x40000: +bins/cyclone-roma.bin +bins/cyclone-roma.elf +bins/cyclone-roma.srec + + +For RedBoot running from RAM with RedBoot in the flash boot sector: +bins/cyclone-ram.bin +bins/cyclone-ram.elf +bins/cyclone-ram.srec + + +For RedBoot running from RAM with ARM bootloader in the flash boot sector: +bins/cyclone-rama.bin +bins/cyclone-rama.elf +bins/cyclone-rama.srecInitial installations deal with the +flash-based RedBoots. Installation and use of RAM based RedBoots is documented +elsewhere. + To install RedBoot to run from the flash boot sector, use the manufacturer's +flash utility to install the bins/cyclone-rom.bin image at address zero. + +To install RedBoot to run from address 0x40000 with the ARM bootloader +in the flash boot sector, use the manufacturer's flash utility to install +the bins/cyclone-roma.bin image at address 0x40000. +After booting the initial installation of RedBoot, this warning may +be printed: flash configuration checksum error or invalid key +This is normal, and indicates that the flash must be configured +for use by RedBoot. Even if the above message is not printed, it may be a +good idea to reinitialize the flash anyway. Do this with the +fis command: RedBoot> fis init +About to initialize [format] flash image system - continue (y/n)? y +*** Initialize flash Image System +Warning: device contents not erased, some blocks may not be usable +... Unlock from 0x007e0000-0x00800000: . +... Erase from 0x007e0000-0x00800000: . +... Program from 0xa1fd0000-0xa1fd0400 at 0x007e0000: . +... Lock from 0x007e0000-0x00800000: . +Followed by the fconfig command: + RedBoot> fconfig + Run script at boot: false + Use BOOTP for network configuration: false + Local IP address: 192.168.1.153 + Default server IP address: 192.168.1.10 + GDB connection port: 1000 + Network debug at boot time: false + Update RedBoot non-volatile configuration - continue (y/n)? y + ... Unlock from 0x007c0000-0x007e0000: . + ... Erase from 0x007c0000-0x007e0000: . + ... Program from 0xa0013018-0xa0013418 at 0x007c0000: . + ... Lock from 0x007c0000-0x007e0000: . + + +Error codes +RedBoot uses the two digit LED display to indicate errors during board +initialization. Possible error codes are: 88 - Unknown Error +55 - I2C Error +FF - SDRAM Error +01 - No Error + + +Using RedBoot with ARM Bootloader +RedBoot can coexist with ARM tools in flash on the IQ80310 board. In +this configuration, the ARM bootloader will occupy the flash boot sector while +RedBoot is located at flash address 0x40000. The sixteen position rotary switch +is used to tell the ARM bootloader to jump to the RedBoot image located at +address 0x40000. RedBoot is selected by switch position 0 or 1. Other switch +positions are used by the ARM firmware and RedBoot will not be started. + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: +ARM bootloader in flash boot sector +-f 0x40000 +-b 0xa0100000 +-l 0x40000 +RedBoot in flash boot sector +-f 0 +-b 0xa0100000 +-l 0x40000 + + +Updating the secondary RedBoot image +ARM bootloader in flash boot sector +-f 0x80000 +-b 0xa0020000 +-r 0xa0020000 +-l 0x40000 +RedBoot in flash boot sector +-f 0x40000 +-b 0xa0020000 +-r 0xa0020000 +-l 0x40000 + + +Special RedBoot Commands +A special RedBoot command, diag, is used to access a set of hardware +diagnostics provided by the board manufacturer. To access the diagnostic menu, +enter diag at the RedBoot prompt: + +RedBoot> diag +Entering Hardware Diagnostics - Disabling Data Cache! +1 - Memory Tests +2 - Repeating Memory Tests +3 - 16C552 DUART Serial Port Tests +4 - Rotary Switch S1 Test for positions 0-3 +5 - seven Segment LED Tests +6 - Backplane Detection Test +7 - Battery Status Test +8 - External Timer Test +9 - i82559 Ethernet Configuration +10 - i82559 Ethernet Test +11 - Secondary PCI Bus Test +12 - Primary PCI Bus Test +13 - i960Rx/303 PCI Interrupt Test +14 - Internal Timer Test +15 - GPIO Test +0 - quit Enter the menu item number (0 to quit): + +Tests for various hardware subsystems are provided, and some +tests require special hardware in order to execute normally. The Ethernet +Configuration item may be used to set the board ethernet address. + + +IQ80310 Hardware Tests +1 - Memory Tests +2 - Repeating Memory Tests +3 - 16C552 DUART Serial Port Tests +4 - Rotary Switch S1 Test for positions 0-3 +5 - 7 Segment LED Tests +6 - Backplane Detection Test +7 - Battery Status Test +8 - External Timer Test +9 - i82559 Ethernet Configuration +10 - i82559 Ethernet Test +11 - i960Rx/303 PCI Interrupt Test +12 - Internal Timer Test +13 - Secondary PCI Bus Test +14 - Primary PCI Bus Test +15 - Battery Backup SDRAM Memory Test +16 - GPIO Test +17 - Repeat-On-Fail Memory Test +18 - Coyonosa Cache Loop (No return) +19 - Show Software and Hardware Revision +0 - quit +Enter the menu item number (0 to quit): +Tests for various hardware subsystems are provided, and some tests require +special hardware in order to execute normally. The Ethernet Configuration +item may be used to set the board ethernet address. + + +Rebuilding RedBoot +The build process is nearly identical for the four supported configurations. +Assuming that the provided RedBoot source tree is located in the current directory +and that we want to build a RedBoot that runs from the flash boot sector, +the build process is: % export TOPDIR=`pwd` +% export ECOS_REPOSITORY=\ + ${TOPDIR}/src/ecos-monitors/redboot-DATE-intel/packages +% mkdir ${TOPDIR}/build +% cd ${TOPDIR}/build +% ecosconfig new iq80310 redboot +% ecosconfig import \ + ${ECOS_REPOSITORY}/hal/arm/iq80310/VERSION/misc/redboot_ROM.ecm +% ecosconfig tree +% makeIf a different configuration is desired, +simply use the above build process but substitute an alternate configuration +file for the ecosconfig import command, e.g.: +For a RedBoot that runs from flash address 0x40000 with the ARM booloader +in the flash boot sector, use: % ecosconfig import \ + ${ECOS_REPOSITORY}/hal/arm/iq80310/VERSION/misc/redboot_ROMA.ecmFor +a RedBoot which runs from RAM with RedBoot located in the flash boot sector, +use:% ecosconfig import \ + ${ECOS_REPOSITORY}/hal/arm/iq80310/VERSION/misc/redboot_RAM.ecmFor +a RedBoot which runs from RAM with ARM bootloader located in the flash boot +sector, use: % ecosconfig import \ + ${ECOS_REPOSITORY}/hal/arm/iq80310/VERSION/misc/redboot_RAMA.ecm + + +Interrupts +RedBoot uses an interrupt vector table which is located at address 0xA000A004. +Entries in this table are pointers to functions with this protoype:: +int irq_handler( unsigned vector, unsigned data )On an IQ80310 +board, the vector argument is one of 49 interrupts defined in +hal/arm/iq80310/current/include/hal_platform_ints.h:: +// *** 80200 CPU *** +#define CYGNUM_HAL_INTERRUPT_reserved0 0 +#define CYGNUM_HAL_INTERRUPT_PMU_PMN0_OVFL 1 // See Ch.12 - Performance Mon. +#define CYGNUM_HAL_INTERRUPT_PMU_PMN1_OVFL 2 // PMU counter 0/1 overflow +#define CYGNUM_HAL_INTERRUPT_PMU_CCNT_OVFL 3 // PMU clock overflow +#define CYGNUM_HAL_INTERRUPT_BCU_INTERRUPT 4 // See Ch.11 - Bus Control Unit +#define CYGNUM_HAL_INTERRUPT_NIRQ 5 // external IRQ +#define CYGNUM_HAL_INTERRUPT_NFIQ 6 // external FIQ + + +// *** XINT6 interrupts *** +#define CYGNUM_HAL_INTERRUPT_DMA_0 7 +#define CYGNUM_HAL_INTERRUPT_DMA_1 8 +#define CYGNUM_HAL_INTERRUPT_DMA_2 9 +#define CYGNUM_HAL_INTERRUPT_GTSC 10 // Global Time Stamp Counter +#define CYGNUM_HAL_INTERRUPT_PEC 11 // Performance Event Counter +#define CYGNUM_HAL_INTERRUPT_AAIP 12 // application accelerator unit + + +// *** XINT7 interrupts *** +// I2C interrupts +#define CYGNUM_HAL_INTERRUPT_I2C_TX_EMPTY 13 +#define CYGNUM_HAL_INTERRUPT_I2C_RX_FULL 14 +#define CYGNUM_HAL_INTERRUPT_I2C_BUS_ERR 15 +#define CYGNUM_HAL_INTERRUPT_I2C_STOP 16 +#define CYGNUM_HAL_INTERRUPT_I2C_LOSS 17 +#define CYGNUM_HAL_INTERRUPT_I2C_ADDRESS 18 + + +// Messaging Unit interrupts +#define CYGNUM_HAL_INTERRUPT_MESSAGE_0 19 +#define CYGNUM_HAL_INTERRUPT_MESSAGE_1 20 +#define CYGNUM_HAL_INTERRUPT_DOORBELL 21 +#define CYGNUM_HAL_INTERRUPT_NMI_DOORBELL 22 +#define CYGNUM_HAL_INTERRUPT_QUEUE_POST 23 +#define CYGNUM_HAL_INTERRUPT_OUTBOUND_QUEUE_FULL 24 +#define CYGNUM_HAL_INTERRUPT_INDEX_REGISTER 25 +// PCI Address Translation Unit +#define CYGNUM_HAL_INTERRUPT_BIST 26 + + +// *** External board interrupts (XINT3) *** +#define CYGNUM_HAL_INTERRUPT_TIMER 27 // external timer +#define CYGNUM_HAL_INTERRUPT_ETHERNET 28 // onboard enet +#define CYGNUM_HAL_INTERRUPT_SERIAL_A 29 // 16x50 uart A +#define CYGNUM_HAL_INTERRUPT_SERIAL_B 30 // 16x50 uart B +#define CYGNUM_HAL_INTERRUPT_PCI_S_INTD 31 // secondary PCI INTD +// The hardware doesn't (yet?) provide masking or status for these +// even though they can trigger cpu interrupts. ISRs will need to +// poll the device to see if the device actually triggered the +// interrupt. +#define CYGNUM_HAL_INTERRUPT_PCI_S_INTC 32 // secondary PCI INTC +#define CYGNUM_HAL_INTERRUPT_PCI_S_INTB 33 // secondary PCI INTB +#define CYGNUM_HAL_INTERRUPT_PCI_S_INTA 34 // secondary PCI INTA + + +// *** NMI Interrupts go to FIQ *** +#define CYGNUM_HAL_INTERRUPT_MCU_ERR 35 +#define CYGNUM_HAL_INTERRUPT_PATU_ERR 36 +#define CYGNUM_HAL_INTERRUPT_SATU_ERR 37 +#define CYGNUM_HAL_INTERRUPT_PBDG_ERR 38 +#define CYGNUM_HAL_INTERRUPT_SBDG_ERR 39 +#define CYGNUM_HAL_INTERRUPT_DMA0_ERR 40 +#define CYGNUM_HAL_INTERRUPT_DMA1_ERR 41 +#define CYGNUM_HAL_INTERRUPT_DMA2_ERR 42 +#define CYGNUM_HAL_INTERRUPT_MU_ERR 43 +#define CYGNUM_HAL_INTERRUPT_reserved52 44 +#define CYGNUM_HAL_INTERRUPT_AAU_ERR 45 +#define CYGNUM_HAL_INTERRUPT_BIU_ERR 46 + + +// *** ATU FIQ sources *** +#define CYGNUM_HAL_INTERRUPT_P_SERR 47 +#define CYGNUM_HAL_INTERRUPT_S_SERR 48The data passed +to the ISR is pulled from a data table (hal_interrupt_data) + which immediately follows the interrupt vector table. With +49 interrupts, the data table starts at address 0xA000A0C8. +An application may create a normal C function with the above prototype +to be an ISR. Just poke its address into the table at the correct index and +enable the interrupt at its source. The return value of the ISR is ignored +by RedBoot. + + +Memory Maps +The first level page table is located at 0xa0004000. Two second level +tables are also used. One second level table is located at 0xa0008000 and +maps the first 1MB of flash. The other second level table is at 0xa0008400, +and maps the first 1MB of SDRAM. NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). + +Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x00000fff flash Memory +0x00001000 - 0x00001fff 80312 Internal Registers +0x00002000 - 0x007fffff flash Memory +0x00800000 - 0x7fffffff PCI ATU Outbound Direct Window +0x80000000 - 0x83ffffff Primary PCI 32-bit Memory +0x84000000 - 0x87ffffff Primary PCI 64-bit Memory +0x88000000 - 0x8bffffff Secondary PCI 32-bit Memory +0x8c000000 - 0x8fffffff Secondary PCI 64-bit Memory +0x90000000 - 0x9000ffff Primary PCI IO Space +0x90010000 - 0x9001ffff Secondary PCI IO Space +0x90020000 - 0x9fffffff Unused +0xa0000000 - 0xbfffffff SDRAM +0xc0000000 - 0xefffffff Unused +0xf0000000 - 0xffffffff 80200 Internal Registers + + +Virtual Address Range C B Description +----------------------- - - ---------------------------------- +0x00000000 - 0x00000fff Y Y SDRAM +0x00001000 - 0x00001fff N N 80312 Internal Registers +0x00002000 - 0x007fffff Y N flash Memory +0x00800000 - 0x7fffffff N N PCI ATU Outbound Direct Window +0x80000000 - 0x83ffffff N N Primary PCI 32-bit Memory +0x84000000 - 0x87ffffff N N Primary PCI 64-bit Memory +0x88000000 - 0x8bffffff N N Secondary PCI 32-bit Memory +0x8c000000 - 0x8fffffff N N Secondary PCI 64-bit Memory +0x90000000 - 0x9000ffff N N Primary PCI IO Space +0x90010000 - 0x9001ffff N N Secondary PCI IO Space +0xa0000000 - 0xbfffffff Y Y SDRAM +0xc0000000 - 0xcfffffff Y Y Cache Flush Region +0xd0000000 - 0xd0000fff Y N first 4k page of flash +0xf0000000 - 0xffffffff N N 80200 Internal Registers + + +Resource Usage +The standalone flash based RedBoot image (no ARM bootloader) occupies +flash addresses 0x00000000 - 0x0003ffff. +The flash based RedBoot configured to be booted by the ARM bootloader +occupies flash addresses 0x00040000 - 0x0007ffff. Both of these also reserve +RAM (0xa0000000 - 0xa001ffff) for RedBoot runtime uses. +Both RAM based RedBoot configurations are designed to run from RAM at +addresses 0xa0020000 - 0xa005ffff. RAM addresses from 0xa0060000 to the end +of RAM are available for general use, such as a temporary scratchpad for downloaded +images before they are written to flash. +The external timer is used as a polled timer to provide timeout support +for networking and XModem file transfers. + + + +Intel IQ80321 + +Overview +Intel IQ80321installing and +testinginstalling and testing +Intel IQ80321RedBoot supports +the serial port and the built-in ethernet port for communication and downloads. +The default serial port settings are 115200,8,N,1. RedBoot also supports flash +management for the onboard 8MB flash. Several basic RedBoot configurations +are supported: + +RedBoot running from the board's flash boot sector. + +RedBoot running from RAM with RedBoot in the flash boot sector. + + + +A special RedBoot command: diag is +used to access a set of hardware diagnostics. + + + +Initial Installation Method +The board manufacturer provides a DOS application which is capable of +programming the flash over the PCI bus, and this is required for initial installations +of RedBoot. Please see the board manual for information on using this utility. +In general, the process involves programming the flash based RedBoot to flash. +RedBoot should be programmed to flash address 0x00000000 using the DOS utility. + +Two sets of prebuilt files are provided in a tarball and zip format. +Each set corresponds to one of the supported configurations and includes +an ELF file (.elf), a binary image (.bin), and an S-record file (.srec). +For RedBoot running from the flash boot sector: +loaders/iq80321/iq80321-rom.bin +loaders/iq80321/iq80321-rom.elf +loaders/iq80321/iq80321-rom.srec + +For RedBoot running from RAM with RedBoot in the flash boot sector: +loaders/iq80321/iq80321-ram.bin +loaders/iq80321/iq80321-ram.elf +loaders/iq80321/iq80321-ram.srec + +Initial installations deal with the +flash-based RedBoots. Installation and use of RAM based RedBoots is documented +elsewhere. + To install RedBoot to run from the flash boot sector, use the manufacturer's +flash utility to install the +loaders/iq80321/iq80321-rom.bin +image at address zero. + +After booting the initial installation of RedBoot, this warning may +be printed: flash configuration checksum error or invalid key +This is normal, and indicates that the flash must be configured +for use by RedBoot. Even if the above message is not printed, it may be a +good idea to reinitialize the flash anyway. Do this with the +fis command: RedBoot> fis init +About to initialize [format] FLASH image system - continue (y/n)? y +*** Initialize FLASH Image System + Warning: device contents not erased, some blocks may not be usable + ... Unlock from 0xf07e0000-0xf0800000: . + ... Erase from 0xf07e0000-0xf0800000: . + ... Program from 0x01ddf000-0x01ddf400 at 0xf07e0000: . + ... Lock from 0xf07e0000-0xf0800000: . + + +Switch Settings +The 80321 board is highly configurable through a number of switches and jumpers. +RedBoot makes some assumptions about board configuration and attention must be paid +to these assumptions for reliable RedBoot operation: + +The onboard ethernet and the secondary slot may be placed in a +private space so that they are not seen by a PC BIOS. If the board is to be used +in a PC with BIOS, then the ethernet should be placed in this private space so that +RedBoot and the BIOS do not conflict. + +RedBoot assumes that the board is plugged into a PC with BIOS. This +requires RedBoot to detect when the BIOS has configured the PCI-X secondary bus. If +the board is placed in a backplane, RedBoot will never see the BIOS configure the +secondary bus. To prevent this wait, set switch S7E1-3 to ON when using the board +in a backplane. +For the remaining switch settings, the following is a known good +configuration: + + + +S1D1All OFF +S7E17 is ON, all others OFF +S8E12,3,5,6 are ON, all others OFF +S8E22,3 are ON, all others OFF +S9E13 is ON, all others OFF +S4D11,3 are ON, all others OFF +J9E12,3 jumpered +J9F12,3 jumpered +J3F1Nothing jumpered +J3G12,3 jumpered +J1G22,3 jumpered + + + + + +LED Codes +RedBoot uses the two digit LED display to indicate status during board +initialization. Possible codes are: + + +LED Actions +------------------------------------------------------------- + Power-On/Reset +88 + Set the CPSR + Enable coprocessor access + Drain write and fill buffer + Setup PBIU chip selects +A1 + Enable the Icache +A2 + Move FLASH chip select from 0x0 to 0xF0000000 + Jump to new FLASH location +A3 + Setup and enable the MMU +A4 + I2C interface initialization +90 + Wait for I2C initialization to complete +91 + Send address (via I2C) to the DIMM +92 + Wait for transmit complete +93 + Read SDRAM PD data from DIMM +94 + Read remainder of EEPROM data. + An error will result in one of the following + error codes on the LEDs: + 77 BAD EEPROM checksum + 55 I2C protocol error + FF bank size error +A5 + Setup DDR memory interface +A6 + Enable branch target buffer + Drain the write & fill buffers + Flush Icache, Dcache and BTB + Flush instuction and data TLBs + Drain the write & fill buffers +SL + ECC Scrub Loop +SE +A7 + Clean, drain, flush the main Dcache +A8 + Clean, drain, flush the mini Dcache + Flush Dcache + Drain the write & fill buffers +A9 + Enable ECC +AA + Save SDRAM size + Move MMU tables into RAM +AB + Clean, drain, flush the main Dcache + Clean, drain, flush the mini Dcache + Drain the write & fill buffers +AC + Set the TTB register to DRAM mmu_table +AD + Set mode to IRQ mode +A7 + Move SWI & Undefined "vectors" to RAM (at 0x0) +A6 + Switch to supervisor mode +A5 + Move remaining "vectors" to RAM (at 0x0) +A4 + Copy DATA to RAM + Initialize interrupt exception environment + Initialize stack + Clear BSS section +A3 + Call platform specific hardware initialization +A2 + Run through static constructors +A1 + Start up the eCos kernel or RedBoot + + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: +-f 0xf0000000 +-b 0x100000 +-l 0x40000 + + +Updating the secondary RedBoot image +To update the secondary RedBoot image, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: +-f 0xf0040000 +-b 0x20000 +-r 0x20000 +-l 0x40000 + + +Special RedBoot Commands +A special RedBoot command, diag, is used to access a set of hardware +diagnostics. To access the diagnostic menu, enter diag at the RedBoot prompt: + +RedBoot> diag +Entering Hardware Diagnostics - Disabling Data Cache! + + IQ80321 Hardware Tests + + 1 - Memory Tests + 2 - Repeating Memory Tests + 3 - Repeat-On-Fail Memory Tests + 4 - Rotary Switch S1 Test + 5 - 7 Segment LED Tests + 6 - i82544 Ethernet Configuration + 7 - Baterry Status Test + 8 - Battery Backup SDRAM Memory Test + 9 - Timer Test +10 - PCI Bus test +11 - CPU Cache Loop (No Return) + 0 - quit +Enter the menu item number (0 to quit): + +Tests for various hardware subsystems are provided, and some tests require +special hardware in order to execute normally. The Ethernet Configuration +item may be used to set the board ethernet address. + +Memory Tests +This test is used to test installed DDR SDRAM memory. Five different +tests are run over the given address ranges. If errors are encountered, the +test is aborted and information about the failure is printed. When selected, +the user will be prompted to enter the base address of the test range and its +size. The numbers must be in hex with no leading “0x” + + +Enter the menu item number (0 to quit): 1 + +Base address of memory to test (in hex): 100000 + +Size of memory to test (in hex): 200000 + +Testing memory from 0x00100000 to 0x002fffff. + +Walking 1's test: +0000000100000002000000040000000800000010000000200000004000000080 +0000010000000200000004000000080000001000000020000000400000008000 +0001000000020000000400000008000000100000002000000040000000800000 +0100000002000000040000000800000010000000200000004000000080000000 +passed +32-bit address test: passed +32-bit address bar test: passed +8-bit address test: passed +Byte address bar test: passed +Memory test done. + + + +Repeating Memory Tests +The repeating memory tests are exactly the same as the above memory tests, +except that the tests are automatically rerun after completion. The only way out +of this test is to reset the board. + + + +Repeat-On-Fail Memory Tests +This is similar to the repeating memory tests except that when an error +is found, the failing test continuously retries on the failing address. + + + +Rotary Switch S1 Test +This tests the operation of the sixteen position rotary switch. When run, +this test will display the current position of the rotary switch on the LED +display. Slowly dial through each position and confirm reading on LED. + + + +7 Segment LED Tests +This tests the operation of the seven segment displays. When run, each +LED cycles through 0 through F and a decimal point. + + + +i82544 Ethernet Configuration +This test initializes the ethernet controller’s serial EEPROM if +the current contents are invalid. In any case, this test will also allow the +user to enter a six byte ethernet MAC address into the serial EEPROM. + + +Enter the menu item number (0 to quit): 6 + + +Current MAC address: 00:80:4d:46:00:02 +Enter desired MAC address: 00:80:4d:46:00:01 +Writing to the Serial EEPROM... Done + +******** Reset The Board To Have Changes Take Effect ******** + + + +Battery Status Test +This tests the current status of the battery. First, the test checks to +see if the battery is installed and reports that finding. If the battery is +installed, the test further determines whether the battery status is one or +more of the following: + +Battery is charging. +Battery is fully discharged. +Battery voltage measures within normal operating range. + + + + + +Battery Backup SDRAM Memory Test +This tests the battery backup of SDRAM memory. This test is a three +step process: + +Select Battery backup test from main diag menu, then write +data to SDRAM. +Turn off power for 60 seconds, then repower the board. + +Select Battery backup test from main diag menu, then check +data that was written in step 1. + + + + +Timer Test +This tests the internal timer by printing a number of dots at one +second intervals. + + +PCI Bus Test +This tests the secondary PCI-X bus and socket. This test requires that +an IQ80310 board be plugged into the secondary slot of the IOP80321 board. +The test assumes at least 32MB of installed memory on the IQ80310. That memory +is mapped into the IOP80321 address space and the memory tests are run on that +memory. + + + +CPU Cache Loop +This test puts the CPU into a tight loop run entirely from the ICache. +This should prevent all external bus accesses. + + + + +Rebuilding RedBoot +The build process is nearly identical for the supported configurations. +Assuming that the provided RedBoot source tree is located in the current directory +and that we want to build a RedBoot that runs from the flash boot sector, +the build process is: % export TOPDIR=`pwd` +% export ECOS_REPOSITORY=\ + ${TOPDIR}/src/ecos-monitors/redboot-DATE-intel/packages +% mkdir ${TOPDIR}/build +% cd ${TOPDIR}/build +% ecosconfig new iq80321 redboot +% ecosconfig import \ + ${ECOS_REPOSITORY}/hal/arm/xscale/iq80321/VERSION/misc/redboot_ROM.ecm +% ecosconfig tree +% makeIf a RedBoot that runs from RAM is desired, +simply use the above build process but substitute an alternate configuration +file for the ecosconfig import command, e.g.: +% ecosconfig import \ + ${ECOS_REPOSITORY}/hal/arm/xscale/iq80321/VERSION/misc/redboot_RAM.ecm + + + +Interrupts +RedBoot uses an interrupt vector table which is located at address 0x8004. +Entries in this table are pointers to functions with this protoype:: +int irq_handler( unsigned vector, unsigned data )On an IQ80321 +board, the vector argument is one of 32 interrupts defined in +hal/arm/xscale/verde/current/include/hal_var_ints.h:: +// *** 80200 CPU *** +#define CYGNUM_HAL_INTERRUPT_DMA0_EOT 0 +#define CYGNUM_HAL_INTERRUPT_DMA0_EOC 1 +#define CYGNUM_HAL_INTERRUPT_DMA1_EOT 2 +#define CYGNUM_HAL_INTERRUPT_DMA1_EOC 3 +#define CYGNUM_HAL_INTERRUPT_RSVD_4 4 +#define CYGNUM_HAL_INTERRUPT_RSVD_5 5 +#define CYGNUM_HAL_INTERRUPT_AA_EOT 6 +#define CYGNUM_HAL_INTERRUPT_AA_EOC 7 +#define CYGNUM_HAL_INTERRUPT_CORE_PMON 8 +#define CYGNUM_HAL_INTERRUPT_TIMER0 9 +#define CYGNUM_HAL_INTERRUPT_TIMER1 10 +#define CYGNUM_HAL_INTERRUPT_I2C_0 11 +#define CYGNUM_HAL_INTERRUPT_I2C_1 12 +#define CYGNUM_HAL_INTERRUPT_MESSAGING 13 +#define CYGNUM_HAL_INTERRUPT_ATU_BIST 14 +#define CYGNUM_HAL_INTERRUPT_PERFMON 15 +#define CYGNUM_HAL_INTERRUPT_CORE_PMU 16 +#define CYGNUM_HAL_INTERRUPT_BIU_ERR 17 +#define CYGNUM_HAL_INTERRUPT_ATU_ERR 18 +#define CYGNUM_HAL_INTERRUPT_MCU_ERR 19 +#define CYGNUM_HAL_INTERRUPT_DMA0_ERR 20 +#define CYGNUM_HAL_INTERRUPT_DMA1_ERR 22 +#define CYGNUM_HAL_INTERRUPT_AA_ERR 23 +#define CYGNUM_HAL_INTERRUPT_MSG_ERR 24 +#define CYGNUM_HAL_INTERRUPT_SSP 25 +#define CYGNUM_HAL_INTERRUPT_RSVD_26 26 +#define CYGNUM_HAL_INTERRUPT_XINT0 27 +#define CYGNUM_HAL_INTERRUPT_XINT1 28 +#define CYGNUM_HAL_INTERRUPT_XINT2 29 +#define CYGNUM_HAL_INTERRUPT_XINT3 30 +#define CYGNUM_HAL_INTERRUPT_HPI 31 + +The data passed to the ISR is pulled from a data table (hal_interrupt_data) + which immediately follows the interrupt vector table. With +32 interrupts, the data table starts at address 0x8084. +An application may create a normal C function with the above prototype +to be an ISR. Just poke its address into the table at the correct index and +enable the interrupt at its source. The return value of the ISR is ignored +by RedBoot. + + +Memory Maps +The RAM based page table is located at RAM start + 0x4000. RedBoot may be configured +for one of two memory maps. The difference between them is the location of RAM and the +PCI outbound windows. The alternative memory map may be used when +building RedBoot or eCos by using the RAM_ALTMAP +and ROM_ALTMAP startup types in the configuration. +NOTE +The virtual memory maps in this section use a C, B, and X column to indicate +the caching policy for the region.. + + +X C B Description +- - - --------------------------------------------- +0 0 0 Uncached/Unbuffered +0 0 1 Uncached/Buffered +0 1 0 Cached/Buffered Write Through, Read Allocate +0 1 1 Cached/Buffered Write Back, Read Allocate +1 0 0 Invalid -- not used +1 0 1 Uncached/Buffered No write buffer coalescing +1 1 0 Mini DCache - Policy set by Aux Ctl Register +1 1 1 Cached/Buffered Write Back, Read/Write Allocate + +Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x7fffffff ATU Outbound Direct Window +0x80000000 - 0x900fffff ATU Outbound Translate Windows +0xa0000000 - 0xbfffffff SDRAM +0xf0000000 - 0xf0800000 FLASH (PBIU CS0) +0xfe800000 - 0xfe800fff UART (PBIU CS1) +0xfe840000 - 0xfe840fff Left 7-segment LED (PBIU CS3) +0xfe850000 - 0xfe850fff Right 7-segment LED (PBIU CS2) +0xfe8d0000 - 0xfe8d0fff Rotary Switch (PBIU CS4) +0xfe8f0000 - 0xfe8f0fff Baterry Status (PBIU CS5) +0xfff00000 - 0xffffffff Verde Memory mapped Registers + + +Default Virtual Map X C B Description +----------------------- - - - ---------------------------------- +0x00000000 - 0x1fffffff 1 1 1 SDRAM +0x20000000 - 0x9fffffff 0 0 0 ATU Outbound Direct Window +0xa0000000 - 0xb00fffff 0 0 0 ATU Outbound Translate Windows +0xc0000000 - 0xdfffffff 0 0 0 Uncached alias for SDRAM +0xe0000000 - 0xe00fffff 1 1 1 Cache flush region (no phys mem) +0xf0000000 - 0xf0800000 0 1 0 FLASH (PBIU CS0) +0xfe800000 - 0xfe800fff 0 0 0 UART (PBIU CS1) +0xfe840000 - 0xfe840fff 0 0 0 Left 7-segment LED (PBIU CS3) +0xfe850000 - 0xfe850fff 0 0 0 Right 7-segment LED (PBIU CS2) +0xfe8d0000 - 0xfe8d0fff 0 0 0 Rotary Switch (PBIU CS4) +0xfe8f0000 - 0xfe8f0fff 0 0 0 Baterry Status (PBIU CS5) +0xfff00000 - 0xffffffff 0 0 0 Verde Memory mapped Registers + +Alternate Virtual Map X C B Description +----------------------- - - - ---------------------------------- +0x00000000 - 0x000fffff 1 1 1 Alias for 1st MB of SDRAM +0x00100000 - 0x7fffffff 0 0 0 ATU Outbound Direct Window +0x80000000 - 0x900fffff 0 0 0 ATU Outbound Translate Windows +0xa0000000 - 0xbfffffff 1 1 1 SDRAM +0xc0000000 - 0xdfffffff 0 0 0 Uncached alias for SDRAM +0xe0000000 - 0xe00fffff 1 1 1 Cache flush region (no phys mem) +0xf0000000 - 0xf0800000 0 1 0 FLASH (PBIU CS0) +0xfe800000 - 0xfe800fff 0 0 0 UART (PBIU CS1) +0xfe840000 - 0xfe840fff 0 0 0 Left 7-segment LED (PBIU CS3) +0xfe850000 - 0xfe850fff 0 0 0 Right 7-segment LED (PBIU CS2) +0xfe8d0000 - 0xfe8d0fff 0 0 0 Rotary Switch (PBIU CS4) +0xfe8f0000 - 0xfe8f0fff 0 0 0 Baterry Status (PBIU CS5) +0xfff00000 - 0xffffffff 0 0 0 Verde Memory mapped Registers + + + + +Resource Usage +The flash based RedBoot image occupies flash addresses +0xf0000000 - 0xf003ffff and RAM addresses (0x00000000 - 0x0001ffff). +The RAM based RedBoot configuration is designed to run from RAM at +addresses 0x00020000 - 0x0005ffff. RAM addresses from 0x00060000 to the end +of RAM are available for general use, such as a temporary scratchpad for +downloaded images before they are written to flash. +The Verde programmable timer0 is used for timeout support +for networking and XModem file transfers. + + + +Intel SA1100 (Brutus) + +Overview +Intel-SA1100 (Brutus)installing +and testinginstalling and testing +Intel SA1100 (Brutus)RedBoot +supports both board serial ports on the Brutus board. The default serial port +settings are 38400,8,N,1. flash management is not currently supported. +Two basic RedBoot configurations are supported: +RedBoot running from the board's flash boot sector. + +RedBoot running from RAM with RedBoot in the flash boot sector. + + + + + +Initial Installation Method +Device programmer is used to program socketecflash parts. + + +Special RedBoot Commands +None. + + +Memory Maps +The first level page table is located at physical address 0xc0004000. +No second level tables are used.NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). +Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x000fffff Boot ROM +0x08000000 - 0x083fffff Application flash +0x10000000 - 0x100fffff SRAM +0x18000000 - 0x180fffff Chip Select 3 +0x20000000 - 0x3fffffff PCMCIA +0x80000000 - 0xbfffffff SA-1100 Internal Registers +0xc0000000 - 0xc7ffffff DRAM Bank 0 +0xc8000000 - 0xcfffffff DRAM Bank 1 +0xd0000000 - 0xd7ffffff DRAM Bank 2 +0xd8000000 - 0xdfffffff DRAM Bank 3 +0xe0000000 - 0xe7ffffff Cache Clean + + +Virtual Address Range C B Description +----------------------- - - ---------------------------------- +0x00000000 - 0x003fffff Y Y DRAM Bank 0 +0x00400000 - 0x007fffff Y Y DRAM Bank 1 +0x00800000 - 0x00bfffff Y Y DRAM Bank 2 +0x00c00000 - 0x00ffffff Y Y DRAM Bank 3 +0x08000000 - 0x083fffff Y Y Application flash +0x10000000 - 0x100fffff Y N SRAM +0x20000000 - 0x3fffffff N N PCMCIA +0x40000000 - 0x400fffff Y Y Boot ROM +0x80000000 - 0xbfffffff N N SA-1100 Internal Registers +0xe0000000 - 0xe7ffffff Y Y Cache Clean + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x40000000 - +0x4000ffff. The RAM based RedBoot image occupies RAM addresses 0x10000 - 0x2ffff. +RAM addresses from 0x30000 to the end of RAM are available for general use +such as a temporary scratchpad for downloaded images before they are written +to flash. The SA11x0 OS timer is used as a polled timer to provide timeout +support for XModem file transfers. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“brutus”, “arm” and “sa11x0/brutus” respectively. +Note that the configuration export files supplied in the +hal/arm/sa11x0/brutus/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +Intel StrongArm EBSA 285 + +Overview +Intel StrongArm EBSA 285installing +and testinginstalling and testing +Intel StrongArm EBSA 285RedBoot +uses the single EBSA-285 serial port. The default serial port settings are +38400,8,N,1. If the EBSA-285 is used as a host on a PCI backplane, ethernet +is supported using an Intel PRO/100+ ethernet adapter. +Management of onboard flash is also supported. Two basic RedBoot configurations +are supported: +RedBoot running from the board's flash boot sector. + +RedBoot running from RAM with RedBoot in the flash boot sector. + + + + + +Initial Installation Method +A linux application is used to program the flash over the PCI bus. Sources +and build instructions for this utility are located in the RedBoot sources +in: .../packages/hal/arm/ebsa285/current/support/linux/safl_util + + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: -f 0x41000000 +-b 0x100000 +-l 0x40000 + + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: -f 0x41040000 +-b 0x20000 +-r 0x20000 +-l 0x40000 + + + +Communication Channels +Serial, Intel PRO 10/100+ 82559 PCI ethernet card. + + +Special RedBoot Commands +None. + + +Memory Maps +Physical and virtual mapping are mapped one to one on the EBSA-285 using +a first level page table located at address 0x4000. No second level tables +are used. NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). +Address Range C B Description +----------------------- - - ---------------------------------- +0x00000000 - 0x01ffffff Y Y SDRAM +0x40000000 - 0x400fffff N N 21285 Registers +0x41000000 - 0x413fffff Y N flash +0x42000000 - 0x420fffff N N 21285 CSR Space +0x50000000 - 0x50ffffff Y Y Cache Clean +0x78000000 - 0x78ffffff N N Outbound Write Flush +0x79000000 - 0x7c0fffff N N PCI IACK/Config/IO +0x80000000 - 0xffffffff N Y PCI Memory + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x41000000 - +0x4103ffff. It also reserves the first 192K bytes of RAM for runtime uses. +The RAM based RedBoot image occupies RAM addresses 0x30000 - 0x5ffff. RAM +addresses from 0x60000 to the end of RAM are available for general use such +as a temporary scratchpad for downloaded images before they are written to +flash. +Timer3 is used as a polled timer to provide timeout support for networking +and XModem file transfers. + + +Building eCos Test Cases to run with old RedBoots +If using older versions of RedBoot, the default configuration for +EBSA-285 will send diagnostic output to the serial line only, not over an ethernet +connection. To allow eCos programs to use RedBoot to channel diagnostic output to +GDB whether connected by net or serial, enable the configuration option +CYGSEM_HAL_VIRTUAL_VECTOR_DIAG +"Do diagnostic IO via virtual vector table" located here +in the common HAL configuration tree: "eCos HAL" + "ROM monitor support" + "Enable use of virtual vector calling interface" + "Do diagnostic IO via virtual vector table"Other +than that, no special configuration is required to use RedBoot. +If you have been using built-in stubs to acquire support for thread-aware +debugging, you can still do that, but you must only use the serial device +for GDB connection and you must not enable the option mentioned above. However, +it is no longer necessary to do that to get thread-awareness; RedBoot is thread +aware. + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“ebsa285”, “arm” and “ebsa285” respectively. +Note that the configuration export files supplied in the +hal/arm/ebsa285/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +Intel SA1100 Multimedia Board + +Overview +Intel SA1100 Multimedia Board +installing and testinginstalling +and testingIntel SA1100 Multimedia Board +RedBoot supports both board serial ports. The default serial port +settings are 38400,8,N,1. flash management is also supported. Two basic RedBoot +configurations are supported: n +RedBoot running from the board's flash boot sector. + +RedBoot running from RAM with RedBoot in the flash boot sector. + + + + + +Initial Installation Method +A device programmer is used to program socketed flash parts. + + +Special RedBoot Commands +None. + + +Memory Maps +The first level page table is located at physical address 0xc0004000. +No second level tables are used.NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). +Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x000fffff Boot flash +0x08000000 - 0x083fffff Application flash +0x10000000 - 0x107fffff SA-1101 Board Registers +0x18000000 - 0x180fffff Ct8020 DSP +0x18400000 - 0x184fffff XBusReg +0x18800000 - 0x188fffff SysRegA +0x18c00000 - 0x18cfffff SysRegB +0x19000000 - 0x193fffff Spare CPLD A +0x19400000 - 0x197fffff Spare CPLD B +0x20000000 - 0x3fffffff PCMCIA +0x80000000 - 0xbfffffff SA1100 Internal Registers +0xc0000000 - 0xc07fffff DRAM Bank 0 +0xe0000000 - 0xe7ffffff Cache Clean +Virtual Address Range C B Description + + +----------------------- - - ---------------------------------- +0x00000000 - 0x007fffff Y Y DRAM Bank 0 +0x08000000 - 0x083fffff Y Y Application flash +0x10000000 - 0x100fffff N N SA-1101 Registers +0x18000000 - 0x180fffff N N Ct8020 DSP +0x18400000 - 0x184fffff N N XBusReg +0x18800000 - 0x188fffff N N SysRegA +0x18c00000 - 0x18cfffff N N SysRegB +0x19000000 - 0x193fffff N N Spare CPLD A +0x19400000 - 0x197fffff N N Spare CPLD B +0x20000000 - 0x3fffffff N N PCMCIA +0x50000000 - 0x500fffff Y Y Boot flash +0x80000000 - 0xbfffffff N N SA1100 Internal Registers +0xc0000000 - 0xc07fffff N Y DRAM Bank 0 +0xe0000000 - 0xe7ffffff Y Y Cache Clean + + +Resource Usage +The flash based RedBoot image occupies virtual addresses 0x50000000 +- 0x5000ffff. The RAM based RedBoot image occupies virtual addresses 0x10000 +- 0x2ffff. RAM addresses from 0x30000 to the end of RAM are available for +general use such as a temporary scratchpad for downloaded images before they +are written to flash. + The SA11x0 OS timer is used as a polled timer to provide timeout support +for XModem file transfers. + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“sa1100mm”, “arm” and “sa11x0/sa1100mm” respectively. +Note that the configuration export files supplied in the +hal/arm/sa11x0/sa1100mm/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +Intel SA1110 (Assabet) + +Overview +Intel SA1110 (Assabet)installing +and testinginstalling and testing +Intel SA1110 (Assabet)RedBoot +supports the board serial port and the compact flash ethernet port. The default +serial port settings are 38400,8,N,1. RedBoot also supports flash management +on the Assabet. Two basic RedBoot configurations are supported: +RedBoot running from the board's flash boot sector. + +RedBoot running from RAM with RedBoot in the flash boot sector. + + + + + +Initial Installation Method +A Windows or Linux utility is used to program flash over parallel port +driven JTAG interface. See board documentation for details on in situ flash +programming. +The flash parts are also socketed and may be programmed in a suitable +device programmer. + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: -f 0x50000000 +-b 0x60000 +-l 0x40000 + + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: -f 0x50040000 +-b 0x20000 +-r 0x20000 +-l 0x40000 + + +Special RedBoot Commands +None. + + +Memory Maps +The first level page table is located at physical address 0xc0004000. +No second level tables are used.NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). +Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x07ffffff flash +0x08000000 - 0x0fffffff SA-1111 Board flash +0x10000000 - 0x17ffffff Board Registers +0x18000000 - 0x1fffffff Ethernet +0x20000000 - 0x2fffffff SA-1111 Board PCMCIA +0x30000000 - 0x3fffffff Compact Flash +0x40000000 - 0x47ffffff SA-1111 Board +0x48000000 - 0x4bffffff GFX +0x80000000 - 0xbfffffff SA-1110 Internal Registers +0xc0000000 - 0xc7ffffff DRAM Bank 0 +0xc8000000 - 0xcfffffff DRAM Bank 1 +0xd0000000 - 0xd7ffffff DRAM Bank 2 +0xd8000000 - 0xdfffffff DRAM Bank 3 +0xe0000000 - 0xe7ffffff Cache Clean + + +Virtual Address Range C B Description +----------------------- - - ---------------------------------- +0x00000000 - 0x01ffffff Y Y DRAM Bank 0 +0x08000000 - 0x0fffffff Y Y SA-1111 Board flash +0x10000000 - 0x17ffffff N N Board Registers +0x18000000 - 0x1fffffff N N Ethernet +0x20000000 - 0x2fffffff N N SA-1111 Board PCMCIA +0x30000000 - 0x3fffffff N N Compact Flash +0x40000000 - 0x47ffffff N N SA-1111 Board +0x48000000 - 0x4bffffff N N GFX +0x50000000 - 0x57ffffff Y Y flash +0x80000000 - 0xbfffffff N N SA-1110 Internal Registers +0xc0000000 - 0xc1ffffff N Y DRAM Bank 0 +0xe0000000 - 0xe7ffffff Y Y Cache Clean +The flash based RedBoot image occupies virtual addresses 0x50000000 - 0x5003ffff. + + + +Resource Usage +The RAM based RedBoot image occupies RAM addresses 0x20000 - 0x5ffff. +RAM addresses from 0x60000 to the end of RAM are available for general use +such as a temporary scratchpad for downloaded images before they are written +to flash. +The SA11x0 OS timer is used as a polled timer to provide timeout support +for network and XModem file transfers. + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“assabet”, “arm” and “sa11x0/assabet” respectively. +Note that the configuration export files supplied in the +hal/arm/sa11x0/assabet/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +MIPS Atlas Board with CoreLV 4Kc and CoreLV 5Kc + +Overview +MIPS Atlas Board with CoreLV 4KC and CoreLV 5KC +installing and testing +installing and testingMIPS Atlas Board with +CoreLV 4KC and CoreLV 5KCRedBoot supports the DgbSer +serial port and the built in ethernet port for communication and downloads. +The default serial port settings are 115200,8,N,1. RedBoot runs from and supports +flash management for the system flash region. These configurations are supported: +RedBoot running from the system flash boot sector. + +RedBoot running from RAM with RedBoot in the system flash +boot sector. + + + + +Initial Installation +RedBoot is installed using the code download facility built into the +Atlas board. See the Atlas User manual for details, and also the Atlas download +format in . + +Quick download instructions +Here are quick start instructions for downloading the prebuilt RedBoot +image. + +Locate the prebuilt files in the bin directory: +deleteall.dl and redboot.dl. + + +Make sure switch S1-1 is OFF and switch S5-1 is ON. Reset +the board and verify that the LED display reads Flash DL. + + +Make sure your parallel port is connected to the 1284 port +Of the Atlas board. + +Send the deleteall.dl file to the parallel port to erase previous +images: % cat deleteall.dl >/dev/lp0 When +this is complete, the LED display should read “Deleted.” + +Send the RedBoot image to the board: % cat redboot.dl >/dev/lp0 +When this is complete, the LED display should show the last +address programmed. This will be something like: 1fc17000 +. + +Change switch S5-1 to OFF and reset the board. The LED display +should read “RedBoot”. + +Run the RedBoot fis init +and fconfig commands to initialize the flash. +See , +and for details. + + + + +Atlas download format +In order to download RedBoot to the Atlas board, it must be converted +to the Atlas download format. There are different ways of doing this depending +on which version of the developer's kit is shipped with the board. +The Atlas Developer's Kit CD contains an +srec2flash utility. The source code for this utility is part +of the yamon/yamon-src-01.01.tar.gz tarball +on the Dev Kit CD. The path in the expanded tarball is yamon/bin/tools +. To use srec2flash to +convert the S-record file: % srec2flash -EL -S29 redboot.srec >redboot.dl + The Atlas/Malta Developer's Kit CD +contains an srecconv.pl utility which requires +Perl. This utilty is part of the yamon/yamon-src-02.00.tar.gz + tarball on the Dev Kit CD. The path in the expanded tarball +is yamon/bin/tools. To use +srecconv to convert the S-record file: +% cp redboot_ROM.srec redboot_ROM.rec +% srecconv.pl -ES L -A 29 redboot_ROM The resulting file is +named redboot_ROM.fl. + + +Flash management + +Additional config options +The ethernet MAC address is stored in flash manually using the +fconfig command. You can use the YAMON setenv +ethaddr command to print out the board ethernet address. +Typically, it is: 00:0d:a0:00:xx:xx where +xx.xx is the hex representation of the board serial number. + + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: -f 0x9dc40000 +-b 0x80020000 +-r 0x80020000 +-l 0x40000 + + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: -f 0x9dc00000 +-b 0x80080000 +-l 0x40000 + + + +Additional commands +The exec command which allows the +loading and execution of Linux kernels, is supported for this architecture + (see ). The +exec parameters used for MIPS boards are: + +-b <addr> +Location to store command line and environment passed to kernel + +-w <time> +Wait time in seconds before starting kernel + +-c "params" +Parameters passed to kernel +<addr> +Kernel entry point, defaulting to the entry point of the last image +loaded + +Linux kernels on MIPS platforms expect the entry point to be called with arguments +in the registers equivalent to a C call with prototype: +void Linux(int argc, char **argv, char **envp); +RedBoot will place the appropriate data at the offset specified by the +-b parameter, or by default at address 0x80080000, and will set the +arguments accordingly when calling into the kernel. + +The default entry point, if no image with explicit entry point has been loaded and +none is specified, is 0x80000750. + + + + +Interrupts +RedBoot uses an interrupt vector table which is located at address 0x80000400. +Entries in this table are pointers to functions with this protoype: +int irq_handler( unsigned vector, unsigned data )On an atlas +board, the vector argument is one of 25 interrupts defined in +hal/mips/atlas/VERSION/include/plf_intr.h: +#define CYGNUM_HAL_INTERRUPT_SER 0 +#define CYGNUM_HAL_INTERRUPT_TIM0 1 +#define CYGNUM_HAL_INTERRUPT_2 2 +#define CYGNUM_HAL_INTERRUPT_3 3 +#define CYGNUM_HAL_INTERRUPT_RTC 4 +#define CYGNUM_HAL_INTERRUPT_COREHI 5 +#define CYGNUM_HAL_INTERRUPT_CORELO 6 +#define CYGNUM_HAL_INTERRUPT_7 7 +#define CYGNUM_HAL_INTERRUPT_PCIA 8 +#define CYGNUM_HAL_INTERRUPT_PCIB 9 +#define CYGNUM_HAL_INTERRUPT_PCIC 10 +#define CYGNUM_HAL_INTERRUPT_PCID 11 +#define CYGNUM_HAL_INTERRUPT_ENUM 12 +#define CYGNUM_HAL_INTERRUPT_DEG 13 +#define CYGNUM_HAL_INTERRUPT_ATXFAIL 14 +#define CYGNUM_HAL_INTERRUPT_INTA 15 +#define CYGNUM_HAL_INTERRUPT_INTB 16 +#define CYGNUM_HAL_INTERRUPT_INTC 17 +#define CYGNUM_HAL_INTERRUPT_INTD 18 +#define CYGNUM_HAL_INTERRUPT_SERR 19 +#define CYGNUM_HAL_INTERRUPT_HW1 20 +#define CYGNUM_HAL_INTERRUPT_HW2 21 +#define CYGNUM_HAL_INTERRUPT_HW3 22 +#define CYGNUM_HAL_INTERRUPT_HW4 23 +#define CYGNUM_HAL_INTERRUPT_HW5 24The data +passed to the ISR is pulled from a data table (hal_interrupt_data +) which immediately follows the interrupt vector table. With +25 interrupts, the data table starts at address 0x80000464 on atlas. +An application may create a normal C function with the above prototype +to be an ISR. Just poke its address into the table at the correct index and +enable the interrupt at its source. The return value of the ISR is ignored +by RedBoot. + + +Memory Maps +Memory Maps RedBoot sets up the following memory map on the Atlas board. +Physical Address Range Description +----------------------- ------------- +0x00000000 - 0x07ffffff SDRAM +0x08000000 - 0x17ffffff PCI Memory Space +0x18000000 - 0x1bdfffff PCI I/O Space +0x1be00000 - 0x1bffffff System Controller +0x1c000000 - 0x1dffffff System flash +0x1e000000 - 0x1e3fffff Monitor flash +0x1f000000 - 0x1fbfffff FPGA + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x1fc00000 - +0x1fc1ffff. RedBoot also reserves RAM (0x00000000 - 0x0001ffff) for RedBoot +runtime uses. RAM based RedBoot configurations are designed to run from RAM +at physical addresses 0x00020000 - 0x0003ffff. RAM physical addresses from +0x00040000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“atlas_mips32_4kc” or “atlas_mips64_5kc”, “mips” +and “atlas” respectively. +Note that the configuration export files supplied in the +hal/mips/atlas/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +MIPS Malta Board with CoreLV 4Kc and CoreLV 5Kc + +Overview +MIPS Malta Board with CoreLV 4KC and CoreLV 5KC +installing and testing +installing and testingMIPS Malta Board with +CoreLV 4KC and CoreLV 5KCRedBoot supports both front +facing serial ports and the built in ethernet port for communication and downloads. +The default serial port settings are 38400,8,N,1. RedBoot runs from and supports +flash management for the system flash region. These configurations are supported: +RedBoot running from the system flash boot sector. + +RedBoot running from RAM with RedBoot in the system flash +boot sector. + + + + +Initial Installation +RedBoot is installed using the code download facility built into the +Malta board. See the Malta User manual for details, and also the Malta download +format in . + +Quick download instructions +Here are quick start instructions for downloading the prebuilt RedBoot +image. + +Locate the prebuilt files in the bin directory: +deleteall.fl and redboot_ROM.fl. + +Make sure switch S5-1 is ON. Reset the board and verify that +the LED display reads Flash DL. + +Make sure your parallel port is connected to the 1284 port +Of the Atlas board. + +Send the deleteall.fl file to the parallel port to erase previous +images: % cat deleteall.fl >/dev/lp0 When +this is complete, the LED display should read Deleted. + +Send the RedBoot image to the board: % cat redboot_ROM.fl >/dev/lp0 + When this is complete, the LED display should show the last +address programmed. This will be something like: 1fc17000 +. + +Change switch S5-1 to OFF and reset the board. The LED display +should read “RedBoot”. + +Run the RedBoot fis init and +fconfig commands to initialize the flash. See +and for details. + + + + +Malta download format +In order to download RedBoot to the Malta board, it must be converted +to the Malta download format. +The Atlas/Malta Developer's Kit CD contains an +srecconv.pl utility which requires Perl. This utility is part +of the yamon/yamon-src-02.00.tar.gz tarball +on the Dev Kit CD. The path in the expanded tarball is yamon/bin/tools +. To use srecconv to convert +the S-record file: % cp redboot_ROM.srec redboot_ROM.rec +% srecconv.pl -ES L -A 29 redboot_ROM The resulting file +is named redboot_ROM.fl. + + +Flash management + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: -f 0xBE020000 +-b 0x80020000 +-r 0x80020000 +-l 0x20000 + + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: -f 0xBE000000 +-b 0x80080000 +-l 0x20000 + + + +Additional commands +The exec command which allows the +loading and execution of Linux kernels, is supported for this architecture + (see ). The +exec parameters used for MIPS boards are: + +-b <addr> +Location to store command line and environment passed to kernel + +-w <time> +Wait time in seconds before starting kernel + +-c "params" +Parameters passed to kernel +<addr> +Kernel entry point, defaulting to the entry point of the last image +loaded + +Linux kernels on MIPS platforms expect the entry point to be called with arguments +in the registers equivalent to a C call with prototype: +void Linux(int argc, char **argv, char **envp); +RedBoot will place the appropriate data at the offset specified by the +-b parameter, or by default at address 0x80080000, and will set the +arguments accordingly when calling into the kernel. + +The default entry point, if no image with explicit entry point has been loaded and +none is specified, is 0x80000750. + + + + +Interrupts +RedBoot uses an interrupt vector table which is located at address 0x80000200. +Entries in this table are pointers to functions with this protoype: +int irq_handler( unsigned vector, unsigned data )On the malta +board, the vector argument is one of 22 interrupts defined in +hal/mips/malta/VERSION/include/plf_intr.h: + +#define CYGNUM_HAL_INTERRUPT_SOUTH_BRIDGE_INTR 0 +#define CYGNUM_HAL_INTERRUPT_SOUTH_BRIDGE_SMI 1 +#define CYGNUM_HAL_INTERRUPT_CBUS_UART 2 +#define CYGNUM_HAL_INTERRUPT_COREHI 3 +#define CYGNUM_HAL_INTERRUPT_CORELO 4 +#define CYGNUM_HAL_INTERRUPT_COMPARE 5 +#define CYGNUM_HAL_INTERRUPT_TIMER 6 +#define CYGNUM_HAL_INTERRUPT_KEYBOARD 7 +#define CYGNUM_HAL_INTERRUPT_CASCADE 8 +#define CYGNUM_HAL_INTERRUPT_TTY1 9 +#define CYGNUM_HAL_INTERRUPT_TTY0 10 +#define CYGNUM_HAL_INTERRUPT_11 11 +#define CYGNUM_HAL_INTERRUPT_FLOPPY 12 +#define CYGNUM_HAL_INTERRUPT_PARALLEL 13 +#define CYGNUM_HAL_INTERRUPT_REAL_TIME_CLOCK 14 +#define CYGNUM_HAL_INTERRUPT_I2C 15 +#define CYGNUM_HAL_INTERRUPT_PCI_AB 16 +#define CYGNUM_HAL_INTERRUPT_PCI_CD 17 +#define CYGNUM_HAL_INTERRUPT_MOUSE 18 +#define CYGNUM_HAL_INTERRUPT_19 19 +#define CYGNUM_HAL_INTERRUPT_IDE_PRIMARY 20 +#define CYGNUM_HAL_INTERRUPT_IDE_SECONDARY 21The data +passed to the ISR is pulled from a data table (hal_interrupt_data +) which immediately follows the interrupt vector table. With +22 interrupts, the data table starts at address 0x80000258. +An application may create a normal C function with the above prototype +to be an ISR. Just poke its address into the table at the correct index and +enable the interrupt at its source. The return value of the ISR is ignored +by RedBoot. + + +Memory Maps +Memory Maps RedBoot sets up the following memory map on the Malta board. +NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). +Physical Address Range C B Description +----------------------- - - ----------- +0x80000000 - 0x81ffffff Y Y SDRAM +0x9e000000 - 0x9e3fffff Y N System flash (cached) +0x9fc00000 - 0x9fffffff Y N System flash (mirrored) +0xa8000000 - 0xb7ffffff N N PCI Memory Space +0xb4000000 - 0xb40fffff N N Galileo System Controller +0xb8000000 - 0xb80fffff N N Southbridge / ISA +0xb8100000 - 0xbbdfffff N N PCI I/O Space +0xbe000000 - 0xbe3fffff N N System flash (noncached) +0xbf000000 - 0xbfffffff N N Board logic FPGA + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0xbe000000 - +0xbe01ffff. RedBoot also reserves RAM (0x00000000 - 0x0001ffff) for RedBoot +runtime uses. RAM based RedBoot configurations are designed to run from RAM +at physical addresses 0x00020000 - 0x0004ffff. RAM physical addresses from +0x00050000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“malta_mips32_4kc”, “mips” and “malta” respectively. +Note that the configuration export files supplied in the +hal/mips/malta/VERSION/misc +directory in the RedBoot source tree should be used. + + + +PMC-Sierra MIPS RM7000 Ocelot + +Overview +PMC-Sierra MIPS RM7000 Ocelotinstalling +and testinginstalling and testing +PMC-Sierra MIPS RM7000 OcelotRedBoot +uses the front facing serial port. The default serial port settings are 38400,8,N,1. +RedBoot also supports ethernet. Management of onboard flash is also supported. +Two basic RedBoot configurations are supported: +RedBoot running from the board's flash boot sector. + +RedBoot running from RAM with RedBoot in the flash boot sector. + + + + + +Initial Installation Method +Device programmer is used to program socketed flash parts. + + +Flash Management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , loading the primary image into +RAM at 0x80100000. The actual numbers used with +the flags in the sample commands are then: + +-f 0xbfc00000 +-b 0x80100000 +-l 0x20000 + + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: + +-f 0xbfc20000 +-b 0x80020000 +-r 0x80020000 +-l 0x20000 + + + + +Additional commands +The exec command which allows the +loading and execution of Linux kernels, is supported for this architecture + (see ). The +exec parameters used for MIPS boards are: + +-b <addr> +Location to store command line and environment passed to kernel + +-w <time> +Wait time in seconds before starting kernel + +-c "params" +Parameters passed to kernel +<addr> +Kernel entry point, defaulting to the entry point of the last image +loaded + +Linux kernels on MIPS platforms expect the entry point to be called with arguments +in the registers equivalent to a C call with prototype: +void Linux(int argc, char **argv, char **envp); +RedBoot will place the appropriate data at the offset specified by the +-b parameter, or by default at address 0x80080000, and will set the +arguments accordingly when calling into the kernel. + +The default entry point, if no image with explicit entry point has been loaded and +none is specified, is 0x80000750. + + + + +Memory Maps +RedBoot sets up the following memory map on the Ocelot board. +Note that these addresses are accessed through kseg0/1 and thus translate +to the actual address range 0x80000000-0xbfffffff, depending on the need for +caching/non-caching access to the bus.NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). +Physical Address Range Description +----------------------- ----------- +0x00000000 - 0x0fffffff SDRAM +0x10000000 - 0x10ffffff PCI I/O space +0x12000000 - 0x13ffffff PCI Memory space +0x14000000 - 0x1400ffff Galileo system controller +0x1c000000 - 0x1c0000ff PLD (board logic) +0x1fc00000 - 0x1fc7ffff flash + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x1fc00000 - +0x1fc1ffff. RedBoot also reserves RAM (0x00000000 - 0x0001ffff) for RedBoot +runtime uses. +RAM based RedBoot configurations are designed to run from RAM at physical +addresses 0x00020000 - 0x0003ffff. RAM physical addresses from 0x00040000 +to the end of RAM are available for general use, such as a temporary scratchpad +for downloaded images, before they are written to flash. + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“ocelot”, “mips” and “rm7000/ocelot” respectively. +Note that the configuration export files supplied in the +hal/mips/rm7000/ocelot/VERSION/misc +directory in the RedBoot source tree should be used. + + + +Motorola PowerPC MBX + +Overview +Motorola PowerPC MBXinstalling +and testinginstalling and testing +Motorola PowerPC MBXRedBoot uses +the SMC1/COM1 serial port. The default serial port settings are 38400,8,N,1. +Ethernet is also supported using the 10-base T connector. +Management of onboard flash is also supported. Two basic RedBoot configurations +are supported: +RedBoot running from RAM with RedBoot in the flash boot sector. + + +RedBoot running from the board's flash boot sector. + + + + +Initial Installation Method +Device programmer is used to program the XU1 socketed flash part (AM29F040B) +with the ROM version of RedBoot. - Use the on-board EPPC-Bug monitor to update +RedBoot. +This assumes that you have EPPC-Bug in the on-board flash. This can +be determined by setting up the board according to the following instructions +and powering up the board. +The EPPC-Bug prompt should appear on the SMC1 connector at 9600 baud, +8N1. + +Set jumper 3 to 2-3 [allow XU1 flash to be programmed] + +Set jumper 4 to 2-3 [boot EPPC-Bug] + + +If it is available, program the flash by following these steps: + +Prepare EPPC-Bug for download: EPPC-Bug>lo 0 +At this point the monitor is ready for input. It will not +return the prompt until the file has been downloaded. + +Use the terminal emulator's ASCII download feature (or a simple +clipboard copy/paste operation) to download the redboot.ppcbug file. +Note that on Linux, Minicom's ASCII download feature seems to be broken. +A workaround is to load the file into emacs (or another editor) and copy the +full contents to the clipboard. Then press the mouse paste-button (usually +the middle one) over the Minicom window. + +Program the flash with the downloaded data: +EPPC-Bug>pflash 40000 60000 fc000000 + +Switch off the power, and change jumper 4 to 1-2. Turn on +the power again. The board should now boot using the newly programmed RedBoot. + + + +To install RedBoot on a target that already has eCos GDB stubs, download +the RAM version of RedBoot and run it. Initialize the flash image directory: +RedBoot> fi initThen download the ROM version of RedBoot +and program it into flash: + +RedBoot> load redboot_ROM.srec -b 0x80100000 +RedBoot> fi cr RedBoot -f 0xFE000000 -b 0x00040000 -l 0x20000 + + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: -f 0xfe000000 +-b 0x50000 +-l 0x20000 + + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: + +-f 0xfe020000 +-b 0x20000 +-r 0x20000 +-l 0x20000 + + + +Special RedBoot Commands +None. + + +Memory Maps +Memory Maps RedBoot sets up the following memory map on the MBX board. +Physical Address Range Description +----------------------- ----------- +0x00000000 - 0x003fffff DRAM +0xfa100000 - 0xfa100003 LEDs +0xfe000000 - 0xfe07ffff flash (AMD29F040B) +0xff000000 - 0xff0fffff MPC registers + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0xfe000000 - + 0xfe01ffff. RedBoot also reserves RAM (0x00000000 - 0x0001ffff) for RedBoot +runtime uses. RAM based RedBoot configurations are designed to run from RAM +at physical addresses 0x00020000 - 0x0004ffff. RAM physical addresses from +0x00050000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“mbx”, “powerpc” and “mbx” respectively. +Note that the configuration export files supplied in the +hal/powerpc/mbx/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +Analogue & Micro PowerPC 860T + +Overview +Analogue & Micro PowerPC 860Tinstalling +and testinginstalling and testing +Analogue & Micro PowerPC 860TRedBoot uses +the SMC1 serial port. The default serial port settings are 38400,8,N,1. +Ethernet is also supported using the RJ-45 connector. +Management of onboard flash is also supported. +A single RedBoot configuration is supported: +RedBoot running from RAM using an image copied from the flash boot sector (ROMRAM mode). + + + + + +Initial Installation Method +RedBoot must be installed at the A & M factory. + + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: + +-f 0xfe000000 +-b 0x50000 +-l 0x30000 + + + + +Special RedBoot Commands +None. + + +Memory Maps +Memory Maps RedBoot sets up the following memory map on the MBX board. +Physical Address Range Description +----------------------- ----------- +0x00000000 - 0x007fffff DRAM +0xfe000000 - 0xfe0fffff flash (AMD29LV8008B) +0xff000000 - 0xff0fffff MPC registers + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0xfe000000 - + 0xfe02ffff. RedBoot also reserves RAM (0x00000000 - 0x0003ffff) for RedBoot +runtime uses. RAM physical addresses from +0x00040000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“viper”, “powerpc” and “viper” respectively. +Note that the configuration export files supplied in the +hal/powerpc/viper/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +ARM Evaluator7T (e7t) board with ARM7TDMI + +Overview +ARM Evaluator7Tinstalling and +testinginstalling and testing +ARM Evaluator7TRedBoot supports +both serial ports for communication and downloads. The default serial port +settings are 38400,8,N,1. + + +Initial Installation +RedBoot is installed using the on-board boot environment. See the user +manual for full details. + + +Quick download instructions +Here are quick start instructions for downloading the prebuilt Redboot +image: + +Boot the board and press ENTER: + + + ARM Evaluator7T Boot Monitor PreRelease 1.00 + Press ENTER within 2 seconds to stop autoboot + Boot: + +Erase the part of the flash where RedBoot will get programmed: + + Boot: flasherase 01820000 10000 + +Prepare to download the UU-encoded version of the RedBoot +image: + Boot: download 10000 + Ready to download. Use 'transmit' option on terminal emulator to download file. + + +Either use ASCII transmit option in the terminal emulator, +or on Linux, simply cat the file to the serial port: $ +cat redboot.UU > /dev/ttyS0When complete, you should +see: Loaded file redboot.bin at address 000100000, size = 41960 + Boot: + +Program the flash: Boot: flashwrite 01820000 10000 10000 + + +And verify that the module is available: Boot: +rommodules + Header Base Limit + 018057c8 01800000 018059e7 BootStrapLoader v1.0 Apr 27 2000 10:33:58 + 01828f24 01820000 0182a3e8 RedBoot Apr 5 2001 + +Reboot the board and you should see the RedBoot banner. + + + + +Special RedBoot Commands +None. + + +Memory Maps +RedBoot sets up the following memory map on the E7T board. +NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). + Physical Address Range C B Description +----------------------- - - ----------- +0x00000000 - 0x0007ffff Y N SDRAM +0x03ff0000 - 0x03ffffff N N Microcontroller registers +0x01820000 - 0x0187ffff N N System flash (mirrored) + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x0182000 - 0x0182ffff. + +RedBoot also reserves RAM (0x00000000 - 0x0000ffff) for RedBoot runtime +uses. +RAM physical addresses from 0x00010000 to the end of RAM are available +for general use. + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“e7t”, “arm” and “e7t” respectively. +Note that the configuration export files supplied in the +hal/arm/e7t/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +ARM Integrator board with ARM7TDMI or ARM966E + +Overview +ARM Integratorinstalling and +testinginstalling and testing +ARM IntegratorRedBoot supports +both serial ports for communication and downloads. The default serial port +settings are 38400,8,N,1. + + +Initial Installation +RedBoot is installed using the on-board bootPROM environment. See the user +manual for full details. + + +Quick download instructions +Here are quick start instructions for downloading the prebuilt Redboot +image: + +Set DIP switch S1[1] to the ON position and reset or +power the board up. You will see the bootPROM startup message on +serial port A (J14): + +Initialising... + + +ARM bootPROM [Version 1.3] Rebuilt on Jun 26 2001 at 22:04:10 +Running on a Integrator Evaluation Board +Board Revision V1.0, ARM966E-S Processor +Memory Size is 16MBytes, Flash Size is 32MBytes +Copyright (c) ARM Limited 1999 - 2001. All rights reserved. +Board designed by ARM Limited +Hardware support provided at http://www.arm.com/ +For help on the available commands type ? or h +boot Monitor > + + + +Issue the FLASH ROM load command: + + +boot Monitor > L +Load Motorola S-Records into flash + +Deleting Image 0 + +The S-Record loader only accepts input on the serial port. +Type Ctrl/C to exit loader. + + +Either use the ASCII transmit option in the terminal emulator, +or on Linux, simply cat the file to the serial port: + + +$ cat redboot.srec > /dev/ttyS0 + + +When complete, type Ctrl-C and you should see something similar to: + + +................................ +................................ +.................... +Downloaded 5,394 records in 81 seconds. + +Overwritten block/s + 0 + +boot Monitor > + + +Set DIP switch S1[1] to the OFF position and reboot +the board and you should see the RedBoot banner. + + + + +Special RedBoot Commands +None. + + +Memory Maps +RedBoot sets up the following memory map on the Integrator board. +NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). + + + +ARM7TDMI +-------- + +Physical Address Range C B Description +----------------------- - - ----------- +0x00000000 - 0x0007ffff N N SSRAM +0x00080000 - 0x0fffffff N N SDRAM (depends on part fitted) +0x10000000 - 0x1fffffff N N System control and peripheral registers +0x20000000 - 0x23ffffff N N Boot ROM (contains boot Monitor) +0x24000000 - 0x27ffffff N N FLASH ROM (contains RedBoot) +0x28000000 - 0x2bffffff N N SSRAM echo area +0x40000000 - 0x5fffffff N N PCI Memory access windows +0x60000000 - 0x60ffffff N N PCI IO access window +0x61000000 - 0x61ffffff N N PCI config space window +0x62000000 - 0x6200ffff N N PCI bridge register window +0x80000000 - 0x8fffffff N N SDRAM echo area (used for PCI accesses) + + +ARM966E +------- + +Physical Address Range C B Description +----------------------- - - ----------- +0x00000000 - 0x000fffff N N SSRAM +0x00100000 - 0x0fffffff N N SDRAM (depends on part fitted) +0x10000000 - 0x1fffffff N N System control and peripheral registers +0x20000000 - 0x23ffffff N N Boot ROM (contains boot Monitor) +0x24000000 - 0x27ffffff N N FLASH ROM (contains RedBoot) +0x28000000 - 0x2bffffff N N SSRAM echo area +0x40000000 - 0x5fffffff N N PCI Memory access windows +0x60000000 - 0x60ffffff N N PCI IO access window +0x61000000 - 0x61ffffff N N PCI config space window +0x62000000 - 0x6200ffff N N PCI bridge register window +0x80000000 - 0x8fffffff N N SDRAM echo area (used for PCI accesses) + + + + + +Resource Usage + +The flash based RedBoot image occupies flash addresses +0x24000000 - 0x2401ffff. + + +RedBoot also reserves RAM (0x00000000 - 0x0003ffff) for RedBoot runtime +uses. If ethernet support is included, then the address range +0x00f00000 to 0x00ffffff are reserved for use by the driver. This may +be moved using the MLT. + +RAM physical addresses from 0x00040000 to 0x00efffff and from +0x00100000 to the end of SDRAM are available for general use. + +Rebuilding RedBoot +The instructions in should +be followed. The values for TARGET, ARCH_DIR and PLATFORM_DIR on this +platform are “integrator” or +“integrator_arm9”, “arm” and +“integrator” respectively. Note that the configuration +export files supplied in the +hal/arm/integrator/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +ARM ARM7 PID, Dev7 and Dev9 + +Overview +ARM ARM7 PID, Dev7 and Dev9 +installing and testinginstalling +and testingARM ARM7 PID, Dev7 and Dev9RedBoot +uses either of the serial ports. The default serial port settings are 38400,8,N,1. +Management of onboard flash is also supported. Two basic RedBoot configurations +are supported: +RedBoot running from the board's flash boot sector. + +RedBoot running from RAM with RedBoot in the flash boot sector. + + + + + +Initial Installation Method +Device programmer is used to program socketed flash parts with ROM version +of RedBoot. +Alternatively, to install RedBoot on a target that already has eCos +GDB stubs, download the RAM version of RedBoot and run it. Initialize the +flash image directory: fi init Then +download the ROM version of RedBoot and program it into flash: +RedBoot> load -b 0x00040000 -m ymodem +RedBoot> fi cr RedBoot -f 0x04000000 -b 0x00040000 -l 0x20000 + + + +Special RedBoot Commands +None. + + +Memory Maps +RedBoot sets up the following memory map on the PID board. +Physical Address Range Description +----------------------- ----------- +0x00000000 - 0x0007ffff DRAM +0x04000000 - 0x04080000 flash +0x08000000 - 0x09ffffff ASB Expansion +0x0a000000 - 0x0bffffff APB Reference Peripheral +0x0c000000 - 0x0fffffff NISA Serial, Parallel and PC Card ports + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x04000000 - + 0x0401ffff. +RedBoot also reserves RAM (0x00000000 - 0x00007fff) for RedBoot runtime +uses. +RAM based RedBoot configurations are designed to run from RAM at physical +addresses 0x00008000 - 0x0003ffff. RAM physical addresses from 0x00040000 +to the end of RAM are available for general use, such as a temporary scratchpad +for downloaded images, before they are written to flash. + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“pid”, “arm” and “pid” respectively. +Note that the configuration export files supplied in the +hal/arm/pid/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +Compaq iPAQ PocketPC +Compaq iPAQ PocketPCinstalling and +testinginstalling and testing +Compaq iPAQ PocketPC + +Overview +RedBoot supports the serial port via cradle or cable, and Compact Flash +ethernet cards if fitted for communication and downloads. The LCD touchscreen +may also be used for the console, although by default RedBoot will switch +exclusively to one channel once input arrives. +The default serial port settings are 38400,8,N,1. RedBoot runs from +and supports flash management for the system flash region. + + +Initial Installation +Prebuilt images for the OSloader, redboot_ROM.bin +and redboot_WinCE.bin images mentioned in the instructions below are provided. + + +Installing RedBoot on the iPAQ using Windows/CE + +The Windows/CE environment originally shipped with the iPAQ contains a hidden +mini-loader, sometimes referred to as the "Parrot" loader. This loader can +be started by holding down the action button (the joypad) while resetting +the unit or when powering on. At this point, a blue bird will appear on +the LCD screen. Also at this point, a simple loader can be accessed over the +serial port at 115200/8N1. Using this loader, the contents of the iPAQ flash +memory can be saved to a Compact Flash memory card. +NOTEWe have only tested this operation with a 32Mbyte CF memory card. +Given that the backup will take 16MBytes + 1KByte, something more than a 16MByte +card will be required. + + +Use the "r2c" command to dump Flash contents to the CF memory card. Once this +completes, RedBoot can be installed with no fear since the Parrot loader can +be used to restore the Flash contents at a later time. + + +If you expect to completely recover the state of the iPAQ Win/CE environment, then +HotSync should be run to backup all "RAM" files as well before installing RedBoot. + +The next step in installing RedBoot on the iPAQ actually involves Windows/CE, +which is the native environment on the unit. Using WinCE, you need to +install an application which will run a RAM based version of RedBoot. Once +this is installed and running, RedBoot can be used to update the flash with +a native/ROM version of RedBoot. +Using ActiveSync, copy the file OSloader to your iPAQ. + +Using ActiveSync, copy the file redboot_WinCE.bin to the iPAQ +as bootldr in its root directory. Note: this is not the top level folder +displayed by Windows (Mobile Device), but rather the 'My Pocket PC' folder +within it. + +Execute OSloader. If you didn't create a shortcut, then you +will have to poke around for it using the WinCE file explorer. + +Choose the Tools->BootLdr->Run after loading +from file menu item. + +At this point, the RAM based version of RedBoot should be running. + You should be able to return to this point by just executing the last two +steps of the previous process if necessary. + + +Installing RedBoot on the iPAQ - using the Compaq boot loader +This method of installation is no longer supported. +If you have previously installed either the Compaq boot loader or older +versions of RedBoot, restore the Win/CE environment and proceed as outlined +above. + + + +Setting up and testing RedBoot +When RedBoot first comes up, it will want to initialize its LCD touch +screen parameters. It does this by displaying a keyboard graphic and asks +you to press certain keys. Using the stylus, press and hold until the prompt +is withdrawn. When you lift the stylus, RedBoot will continue with the next +calibration. +Once the LCD touchscreen has been calibrated, RedBoot will start. The +calibration step can be skipped by pressing the return/abort +button on the unit (right most button with a curved arrow icon). Additionally, +the unit will assume default values if the screen is not touched within about +15 seconds. +Once RedBoot has started, you should get information similar to this +on the LCD screen. It will also appear on the serial port at 38400,8,N,1. + RedBoot(tm) bootstrap and debug environment [ROM] +Red Hat certified release, version R1.xx - built 06:17:41, Mar 19 2001 +Platform: Compaq iPAQ Pocket PC (StrongARM 1110) + +Copyright (C) 2000, 2001, Red Hat, Inc. + +RAM: 0x00000000-0x01fc0000, 0x0001f200-0x01f70000 available +FLASH: 0x50000000 - 0x51000000, 64 blocks of 0x00040000 bytes each.Since +the LCD touchscreen is only 30 characters wide, some of this data will be +off the right hand side of the display. The joypad may be used to pan left +and right in order to see the full lines. +If you have a Compact Flash ethernet card, RedBoot should find it. +You'll need to have BOOTP enabled for this unit (see your sysadmin for details). + If it does, it will print a message like: ... Waiting for network card: .Ready! +Socket Communications Inc: CF+ LPE Revision E 08/04/99 +IP: 192.168.1.34, Default server: 192.168.1.101 + + +Installing RedBoot permanently +Once you are satisfied with the setup and that RedBoot is operating +properly in your environment, you can set up your iPAQ unit to have RedBoot +be the bootstrap application. CAUTION +This step will destroy your Windows/CE environment. +Before you take this step, it is strongly recommended you save your WinCE FLASH contents +as outlined above using the "parrot" loader, or +by using the Compaq OSloader: +Using OSloader on the iPAQ, select the Tools->Flash->Save +to files.... menu item. + +Four (4) files, 4MB each in size will be created. + +After each file is created, copy the file to your computer, +then delete the file from the iPAQ to make room in the WinCE ramdisk for the +next file. + + +You will need to download the version of RedBoot designed as the +ROM bootstrap. Then install it permanently using these commands: + +RedBoot> lo -r -b 0x100000 /tftpboot/redboot_ROM.bin +RedBoot> fi loc -f 0x50000000 -l 0x40000 +RedBoot> fis init +RedBoot> fi unl -f 0x50040000 -l 0x40000 +RedBoot> fi cr RedBoot -b 0x100000 +RedBoot> fi loc -f 0x50040000 -l 0x40000 +RedBoot> reset + WARNING +You must type these commands exactly! Failure to do so may render your +iPAQ totally useless. Once you've done this, RedBoot should come up every +time you reset. + + + +Restoring Windows/CE +To restore Windows/CE from the backup taken in , +visit http://www.handhelds.org/projects/wincerestoration.html +for directions. + + + +Flash Management + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , relying on default location +and size of the image. It is also possible to explicitly specify the options +- the appropriate options for the iPAQ are: -f 0x50080000 +-b 0x00020000 +-r 0x00020000 +-e 0x00020040 +-l 0x40000When updating the image, the flash should be unlocked +before programming, and relocked afterwards. This is done with the commands: + fis unlock -f 0x50080000 -l 0x40000and +fis lock -f 0x50080000 -l 0x40000 + + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , relying on default location and +size of the image. It is also possible to explicitly specify the options - +the appropriate options for the iPAQ are: -f 0x50040000 +-b 0x00100000 +-l 0x40000 When updating the image, the flash should be unlocked +before programming, and relocked afterwards. This is done with the commands: + fis unlock -f 0x50040000 -l 0x40000and +fis lock -f 0x50040000 -l 0x40000 + + +Additional commands +The exec command which allows the loading +and execution of Linux kernels, +is supported for this board (see ). The +exec parameters used for the iPAQ are: + +-b <addr> +Location Linux kernel was loaded to + +-l <len> +Length of kernel + +-c "params" +Parameters passed to kernel +-r <addr> +'initrd' ramdisk location +-s <len> +Length of initrd ramdisk + +Linux kernels may be run on the iPAQ using the sources from the anonymous +CVS repository at the Handhelds project ( +http://www.handhelds.org/) with +the elinux.patch patch file applied. This file can be +found in the +misc/ subdirectory of the iPAQ platform HAL in the +RedBoot sources, normally +hal/arm/sa11x0/ipaq/VERSION/misc/ + + +On the iPAQ (and indeed all SA11x0 platforms), Linux expects to be loaded +at address 0xC0008000 and the entry point is also at 0xC0008000. + + + + +Memory Maps +RedBoot sets up the following memory map on the iPAQ: The first level +page table is located at physical address 0xC0004000. No second level tables +are used. NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). + Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x01ffffff 16Mb to 32Mb FLASH (nCS0) [organized as below] + 0x000000 - 0x0003ffff Parrot Loader + 0x040000 - 0x0007ffff RedBoot + 0xf80000 - 0x00fbffff Fconfig data + 0xfc0000 - 0x00ffffff FIS directory +0x30000000 - 0x3fffffff Compact Flash +0x48000000 - 0x4bffffff iPAQ internal registers +0x80000000 - 0xbfffffff SA-1110 Internal Registers +0xc0000000 - 0xc1ffffff DRAM Bank 0 - 32Mb SDRAM +0xe0000000 - 0xe7ffffff Cache Clean + + +Virtual Address Range C B Description +----------------------- - - ---------------------------------- +0x00000000 - 0x01ffffff Y Y DRAM - 32Mb +0x30000000 - 0x3fffffff N N Compact Flash +0x48000000 - 0x4bffffff N N iPAQ internal registers +0x50000000 - 0x51ffffff Y Y Up to 32Mb FLASH (nCS0) +0x80000000 - 0xbfffffff N N SA-1110 Internal Registers +0xc0000000 - 0xc1ffffff N Y DRAM Bank 0: 32Mb +0xe0000000 - 0xe7ffffff Y Y Cache Clean + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x50040000 - +0x5007ffff. RedBoot also reserves RAM (0x00000000 - 0x0001ffff) for RedBoot +runtime uses. RAM based RedBoot configurations are designed to run from RAM +at virtual addresses 0x00020000 - 0x0005ffff. RAM virtual addresses from +0x00060000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. An exception +is RAM from 0x01F70000 - 0x01FFFFFF which is reserved for use by the LCD +display. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“ipaq”, “arm” and “sa11x0/ipaq” respectively. +Note that the configuration export files supplied in the +hal/arm/sa11x0/ipaq/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +Intrinsyc CerfCube +Intrinsyc CerfCubeinstalling and +testinginstalling and testing +Intrinsyc CerfCube + +Overview +RedBoot supports the serial port and the builtin +ethernet connection for communication and downloads. + +The default serial port settings are 38400,8,N,1. RedBoot runs from +and supports flash management for the system flash region. + + +Initial Installation +Prebuilt images for redboot_ROM.bin +mentioned in the instructions below are provided. + + +Installing RedBoot on the CerfCube using the Intrinsyc loader + +The original boot loader supplied with the CerfCube can be used to install +RedBoot. Connect to the device using a serial port at 38400/8N1. +Copy the redboot_ROM.bin image to an available TFTP server. +Issue these commands to the Instrinsyc loader. + + download tftp:xxx.x.x.xx redboot_ROM.bin 0xc0000000 + flashloader 0x00000000 0xc0000000 0x20000 + +where xxx.x.x.xx is the IP address of the TFTP server. + +NOTE + +Other installation methods may be available via the Intrinsyc loader. +Contact Intrinsyc for details. + + + + + +Setting up and testing RedBoot +Once RedBoot has started, you should get information similar to this +on the serial port at 38400,8,N,1. +RedBoot(tm) bootstrap and debug environment [ROM] +Red Hat certified release, version R1.xx - built 06:17:41, Mar 19 2001 +Platform: Intrinsyc CerfCube (StrongARM 1110) + +Copyright (C) 2000, 2001, 2002, Red Hat, Inc. + +RAM: 0x00000000-0x02000000, 0x00012708-0x01fd1000 available +FLASH: 0x50000000 - 0x51000000, 128 blocks of 0x00020000 bytes each. + + + + + +Flash Management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , relying on default location and +size of the image. It is also possible to explicitly specify the options - +the appropriate options for the CerfCube are: -f 0x50000000 +-b 0x00100000 +-l 0x40000 When updating the image, the flash should be unlocked +before programming, and relocked afterwards. This is done with the commands: + fis unlock -f 0x50000000 -l 0x20000and +fis lock -f 0x50000000 -l 0x20000 + + +Additional commands +The exec command which allows the loading +and execution of Linux kernels, +is supported for this board (see ). The +exec parameters used for the CerfCube are: + +-b <addr> +Location Linux kernel was loaded to + +-l <len> +Length of kernel + +-c "params" +Parameters passed to kernel +-r <addr> +'initrd' ramdisk location +-s <len> +Length of initrd ramdisk + + + + +Memory Maps +RedBoot sets up the following memory map on the CerfCube: The first level +page table is located at physical address 0xC0004000. No second level tables +are used. NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). + Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x01ffffff 16Mb to 32Mb FLASH (nCS0) [organized as below] + 0x000000 - 0x0001ffff RedBoot + 0x020000 - 0x0003ffff RedBoot [RAM version] + 0xfc0000 - 0x00fdffff Fconfig data + 0xfe0000 - 0x00ffffff FIS directory +0x0f000000 - 0x0fffffff Onboard ethernet +0x10000000 - 0x17ffffff CerfCube internal registers +0x20000000 - 0x3fffffff PCMCIA / Compact Flash +0x80000000 - 0xbfffffff SA-1110 Internal Registers +0xc0000000 - 0xc1ffffff DRAM Bank 0 - 32Mb SDRAM +0xe0000000 - 0xe7ffffff Cache Clean + + +Virtual Address Range C B Description +----------------------- - - ---------------------------------- +0x00000000 - 0x01ffffff Y Y DRAM - 32Mb +0x08000000 - 0x0fffffff N N Onboard ethernet controller +0x10000000 - 0x17ffffff N N CerfCube internal registers +0x20000000 - 0x3fffffff N N PCMCIA / Compact Flash +0x50000000 - 0x51ffffff Y Y Up to 32Mb FLASH (nCS0) +0x80000000 - 0xbfffffff N N SA-1110 Internal Registers +0xc0000000 - 0xc1ffffff N Y DRAM Bank 0: 32Mb +0xe0000000 - 0xe7ffffff Y Y Cache Clean + + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x50000000 - +0x5001ffff. RedBoot also reserves RAM (0x00000000 - 0x0001ffff) for RedBoot +runtime uses. RAM based RedBoot configurations are designed to run from RAM +at virtual addresses 0x00020000 - 0x0005ffff. RAM virtual addresses from +0x00060000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“cerf”, “arm” and “sa11x0/ipaq” respectively. +Note that the configuration export files supplied in the +hal/arm/sa11x0/cerf/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +Cirrus Logic EP7xxx (EDB7211, EDB7212, EDB7312) + +Overview +Cirrus Logic EP7xxx (EDB7211, EDB7212, EDB7312) +installing and testing +installing and testingCirrus Logic EP7xxx (EDB7211, EDB7212, EDB7312) +RedBoot supports both serial ports on the board and +the ethernet port. The default serial port settings are 38400,8,N,1. RedBoot +also supports flash management on the EDB7xxx for the NOR flash only. Two +basic RedBoot configurations are supported: +RedBoot running from the board's flash boot sector. + +RedBoot running from RAM with RedBoot in the flash boot sector. + + +EDB7312 only: RedBoot running from RAM copied directly from the +flash boot sector. + + + + + +Initial Installation Method +A Windows or Linux utility is used to program flash using serial port +#1 via on-chip programming firmware. See board documentation for details on +in situ flash programming. + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: + +-f 0xE0000000 +-b 0x40000 +-l 0x40000 + + + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: +-f 0xE0040000 +-b 0x40000 +-r 0x40000 +-l 0x40000 + +NOTE + +On the EDB7312, because the primary RedBoot image runs in RAM and not +FLASH, it can be updated directly without +use of the separate RAM based version. + + + + +Special RedBoot Commands +None. + + +Memory Maps +The MMU page tables and LCD display buffer, if enabled, are located +at the end of DRAM. NOTE + +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). + +Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x01ffffff NOR Flash (EDB7211, EDB7212) +0x00000000 - 0x00ffffff NOR Flash (EDB7312) +0x10000000 - 0x11ffffff NAND Flash +0x20000000 - 0x2fffffff Expansion 2 +0x30000000 - 0x3fffffff Expansion 3 +0x40000000 - 0x4fffffff PCMCIA 0 +0x50000000 - 0x5fffffff PCMCIA 1 +0x60000000 - 0x600007ff On-chip SRAM +0x80000000 - 0x8fffffff I/O registers +0xc0000000 - 0xc1ffffff DRAM (EDB7211, EDB7212) +0xc0000000 - 0xc0ffffff DRAM (EDB7312) + +Virtual Address Range C B Description +----------------------- - - ---------------------------------- +0x00000000 - 0x01ffffff Y Y DRAM +0x00000000 - 0x00fcffff Y Y DRAM (EDB7312) +0x20000000 - 0x2fffffff N N Expansion 2 +0x30000000 - 0x3fffffff N N Expansion 3 +0x40000000 - 0x4fffffff N N PCMCIA 0 +0x50000000 - 0x5fffffff N N PCMCIA 1 +0x60000000 - 0x600007ff Y Y On-chip SRAM +0x80000000 - 0x8fffffff N N I/O registers +0xc0000000 - 0xc001ffff N Y LCD buffer (if configured) +0xe0000000 - 0xe1ffffff Y Y NOR Flash (EDB7211, EDB7212) +0xe0000000 - 0xe0ffffff Y Y NOR Flash (EDB7312) +0xf0000000 - 0xf1ffffff Y Y NAND Flash + +The flash based RedBoot image occupies virtual addresses 0xe0000000 - 0xe003ffff. + + + +Resource Usage + +The RAM based RedBoot image occupies RAM addresses +0x40000 - 0x7ffff. +The ROMRAM based RedBoot image (EDB7312 only) occupies RAM addresses +0x1000 - 0x3ffff. +RAM addresses start at +0x80000 +and continue up to the top of the installed +physical RAM size, less the memory reserved for MMU page tables +(0x9000 bytes) and the LCD display buffer, if enabled (0x20000 bytes). The +RAM is available for general use such as a temporary scratchpad +for downloaded images before they are written to flash. +The EP7xxx timer #2 is used as a polled timer to provide timeout support +for network and XModem file transfers. + +Rebuilding RedBoot +The instructions in should be followed. +The values for ARCH_DIR and PLATFORM_DIR on this platform are +“arm” and “edb7xxx” respectively. +The value for TARGET is either “edb7211” or “edb7212” + or “edb7312”, +depending on the desired platform. +Note that the configuration export files supplied in the +hal/arm/edb7xxx/VERSION/misc +directory in the RedBoot source tree should be used, and the correct +edb7XXX variant chosen. + + + + +Bright Star Engineering commEngine and nanoEngine + +Overview +commEngineinstalling and testing +nanoEngine +installing and testinginstalling +and testingcommEngine +installing and testingnanoEngine +RedBoot supports a serial port and the built in ethernet port +for communication and downloads. The default serial port settings are 38400,8,N,1. +RedBoot runs from and supports flash management for the system flash region. +These configurations are supported: +RedBoot running from the first free block at 0x40000 + +RedBoot running from RAM + + + + +Initial Installation +Unlike other targets, the nanoEngine comes equipped with boot firmware +which you cannot modify. See chapter 5, "nanoEngine Firmware" of the +nanoEngine Hardware Reference Manual (we refer to "July 17, 2000 +Rev 0.6") from Bright Star Engineering. +Because of this, eCos, and therefore Redboot, only supports RAM and +POST startup types, rather than the more usual ROM, RAM and optionally, POST. + +Briefly, the POST-startup RedBoot image lives in flash following the +BSE firmware. The BSE firmware is configured, using its standard +bootcmd parameter, to jump into the RedBoot image at startup. + + + +Download Instructions +You can perform the initial load of the POST-startup RedBoot image into +flash using the BSE firmware's load command. +This will load a binary file, using TFTP, and program it into flash in one +operation. Because no memory management is used in the BSE firmware, flash +is mapped from address zero upwards, so the address for the RedBoot POST image +is 0x40000. You must use the binary version of RedBoot for this, +redboot-post.bin. +This assumes you have set up the other BSE firmware config parameters +such that it can communicate over your network to your TFTP server. + +>load /tftpboot/redboot-post.bin 40000 +loading ... erasing blk at 00040000 +erasing blk at 00050000 +94168 bytes loaded cksum 00008579 +done +> +> set bootcmd "go 40000" +> get +myip = 10.16.19.198 +netmask = 255.255.255.0 +eth = 0 +gateway = 10.16.19.66 +serverip = 10.16.19.66 +bootcmd = go 40000 +> NOTE +the BSE firmware runs its serial IO at 9600 Baud; RedBoot runs instead +at 38400 Baud. You must select the right baud rate in your terminal program +to be able to set up the BSE firmware. + After a reset, the BSE firmware will print Boot: BSE 2000 Sep 12 2000 14:00:30 +autoboot: "go 40000" [hit ESC to abort]and then RedBoot starts, switching +to 38400 Baud. +Once you have installed a bootable RedBoot in the system in this manner, +we advise re-installing using the generic method described in +in order that the Flash Image System contains an appropriate description of +the flash entries. + + +Cohabiting with POST in Flash +The configuration export file named redboot_POST.ecm +configures redboot to build for execution at address 0x50040000 (or, during +bootup, 0x00040000). This is to allow power-on self-test (POST) code or immutable +firmware to live in the lower addresses of the flash and to run before RedBoot +gets control. The assumption is that RedBoot will be entered at its base address +in physical memory, that is 0x00040000. +Alternatively, for testing, you can call it in an already running system +by using go 0x50040040 at another RedBoot prompt, or +a branch to that address. The address is where the reset vector points, and +is reported by RedBoot's tftp load command and listed +by the fis list command, amongst other places. +Using the POST configuration enables a normal config option which causes +linking and initialization against memory layout files called "...post..." +rather than "...rom..." or "...ram..." in the include/pkgconf + directory. Specifically: 665 Feb 9 17:57 include/pkgconf/mlt_arm_sa11x0_nano_post.h +839 Feb 9 17:57 include/pkgconf/mlt_arm_sa11x0_nano_post.ldi +585 Feb 9 17:57 include/pkgconf/mlt_arm_sa11x0_nano_post.mltIt +is these you should edit if you wish to move that execution address from 0x50040000 +in the POST configuration. Startup type naturally remains ROM in this configuration. + +Because the nanoEngine contains immutable boot firmware at the start +of flash, RedBoot for this target is configured to reserve that area in the +Flash Image System, and to create by default an entry for the POST startup +RedBoot. + +RedBoot> fis list +Name FLASH addr Mem addr Length Entry point +(reserved) 0x50000000 0x50000000 0x00040000 0x00000000 +RedBoot[post] 0x50040000 0x00100000 0x00020000 0x50040040 +RedBoot config 0x503E0000 0x503E0000 0x00010000 0x00000000 +FIS directory 0x503F0000 0x503F0000 0x00010000 0x00000000 +RedBoot> + +The entry "(reserved)" ensures that the FIS cannot attempt +to overwrite the BSE firmware, thus ensuring that the board remains bootable +and recoverable even after installing a broken RedBoot image. + + +Special RedBoot Commands +The nanoEngine/commEngine has one or two Intel i82559 Ethernet controllers +installed, but these have no associated serial EEPROM in which to record their +Ethernet Station Address (ESA, or MAC address). The BSE firmware records an +ESA for the device it uses, but this information is not available to RedBoot; +we cannot share it. +To keep the ESAs for the two ethernet interfaces, two new items of RedBoot +configuration data are introduced. You can list them with the RedBoot command +fconfig -l thus: + +RedBoot> fconfig -l +Run script at boot: false +Use BOOTP for network configuration: false +Local IP address: 10.16.19.91 +Default server IP address: 10.16.19.66 +Network hardware address [MAC] for eth0: 0x00:0xB5:0xE0:0xB5:0xE0:0x99 +Network hardware address [MAC] for eth1: 0x00:0xB5:0xE0:0xB5:0xE0:0x9A +GDB connection port: 9000 +Network debug at boot time: false +RedBoot>You should set them before running RedBoot or eCos +applications with the board connected to a network. The fconfig + command can be used as for any configuration data item; +the entire ESA is entered in one line. + + +Memory Maps +The first level page table is located at physical address 0xc0004000. + No second level tables are used. NOTE +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). +Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x003fffff 4Mb FLASH (nCS0) +0x18000000 - 0x18ffffff Internal PCI bus - 2 x i82559 ethernet +0x40000000 - 0x4fffffff External IO or PCI bus +0x80000000 - 0xbfffffff SA-1110 Internal Registers +0xc0000000 - 0xc7ffffff DRAM Bank 0 - 32Mb SDRAM +0xc8000000 - 0xcfffffff DRAM Bank 1 - empty +0xe0000000 - 0xe7ffffff Cache Clean + +Virtual Address Range C B Description +----------------------- - - ---------------------------------- +0x00000000 - 0x001fffff Y Y DRAM - 8Mb to 32Mb +0x18000000 - 0x180fffff N N Internal PCI bus - 2 x i82559 ethernet +0x40000000 - 0x4fffffff N N External IO or PCI bus +0x50000000 - 0x51ffffff Y Y Up to 32Mb FLASH (nCS0) +0x80000000 - 0xbfffffff N N SA-1110 Internal Registers +0xc0000000 - 0xc0ffffff N Y DRAM Bank 0: 8 or 16Mb +0xc8000000 - 0xc8ffffff N Y DRAM Bank 1: 8 or 16Mb or absent +0xe0000000 - 0xe7ffffff Y Y Cache CleanThe FLASH based +RedBoot POST-startup image occupies virtual addresses 0x50040000 - 0x5005ffff. + +The ethernet devices use a "PCI window" to communicate with the CPU. +This is 1Mb of SDRAM which is shared with the ethernet devices that are on +the PCI bus. It is neither cached nor buffered, to ensure that CPU and PCI +accesses see correct data in the correct order. By default it is configured +to be megabyte number 30, at addresses 0x01e00000-0x01efffff. This can be +modified, and indeed must be, if less than 32Mb of SDRAM is installed, via +the memory layout tool, or by moving the section __pci_window + referred to by symbols CYGMEM_SECTION_pci_window* + in the linker script. +Though the nanoEngine ships with 32Mb of SDRAM all attached to DRAM +bank 0, the code can cope with any of these combinations also; "2 x " in this +context means one device in each DRAM Bank. 1 x 8Mb = 8Mb 2 x 8Mb = 16Mb +1 x 16Mb = 16Mb 2 x 16Mb = 32MbAll are programmed the same +in the memory controller. +Startup code detects which is fitted and programs the memory map accordingly. +If the device(s) is 8Mb, then there are gaps in the physical memory map, because +a high order address bit is not connected. The gaps are the higher 2Mb out +of every 4Mb. The SA11x0 OS timer is used as a polled timer to provide timeout +support within RedBoot. + + +Nano Platform Port +The nano is in the set of SA11X0-based platforms. It uses the arm architectural +HAL, the sa11x0 variant HAL, plus the nano platform hal. These are components + CYGPKG_HAL_ARM hal/arm/arch/ +CYGPKG_HAL_ARM_SA11X0 hal/arm/sa11x0/var +CYGPKG_HAL_ARM_SA11X0_NANO hal/arm/sa11x0/nano respectively. + +The target name is "nano" which includes all these, plus the ethernet +driver packages, flash driver, and so on. + + +Ethernet Driver +The ethernet driver is in two parts: +A generic ether driver for Intel i8255x series devices, specifically +the i82559, is devs/eth/intel/i82559. Its +package name is CYGPKG_DEVS_ETH_INTEL_I82559. + +The platform-specific ether driver is devs/eth/arm/nano +. Its package is CYGPKG_DEVS_ETH_ARM_NANO +. This tells the generic driver the address in IO memory +of the chip, for example, and other configuration details. This driver picks +up the ESA from RedBoot's configuration data - unless configured to use a +static ESA in the usual manner. + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“nano”, “arm” and “sa11x0/nano” respectively. +Note that the configuration export files supplied in the +hal/arm/sa11x0/nano/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +x86 Based PC + +Overview +x86 Based PCinstalling and +testinginstalling and testing +x86 Based PCRedBoot supports +two serial ports and an Intel i82559 based ethernet card (for example an Intel +EtherExpress Pro 10/100) for communication and downloads. The default serial +port settings are 38400,8,N,1. RedBoot runs from a boot floppy disk installed +in the A: drive of the PC. + + +Initial Installation +RedBoot takes the form of a self-booting image that must be written +onto a formatted floppy disk. The process will erase any file system or data +that already exists on that disk, so proceed with caution. +For Red Hat Linux users, this can be done by: + $ dd conv=sync if=install/bin/redboot.bin of=/dev/fd0H1440 + +For NT Cygwin users, this can be done by first ensuring that the raw +floppy device is mounted as /dev/fd0. To check if this +is the case, type the command mount at the Cygwin bash +prompt. If the floppy drive is already mounted, it will be listed as something +similar to the following line: + \\.\a: /dev/fd0 user binmode +If this line is not listed, then mount the floppy drive using the command: + + $ mount -f -b //./a: /dev/fd0 +To actually install the boot image on the floppy, use the command: + $ dd conv=sync if=install/bin/redboot.bin of=/dev/fd0 + +Insert this floppy in the A: drive of the PC to be used as a target +and ensure that the BIOS is configured to boot from A: by default. On reset, +the PC will boot from the floppy and be ready to be debugged via either serial +line, or via the ethernet interface if it is installed. +NOTE +Unreliable floppy media may cause the write to silently fail. This +can be determined if the RedBoot image does not correctly +boot. In such cases, the floppy should be (unconditionally) reformatted +using the fdformat command on Linux, or +format a: /u on DOS/Windows. + + + +Flash management +PC RedBoot does not support any FLASH commands. + + +Special RedBoot Commands +None. + + +Memory Maps +All selectors are initialized to map the entire 32-bit address space +in the familiar protected mode flat model. Page translation is not used. +RAM up to 640K is mapped to 0x0 to 0xa0000. RAM above 640K is mapped +from address 0x100000 upwards. Space is reserved between 0xa0000 and +0x100000 for option ROMs and the BIOS. + + + +Resource Usage +RedBoot is loaded into RAM at address 0x2000 and reserves all RAM below +0xa0000 for its own use. RAM applications should load from address 0x100000 +upwards. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“pc”, “i386” and “pc” respectively. +Note that the configuration export files supplied in the +hal/i386/pc/VERSION/misc +directory in the RedBoot source tree should be used. In particular, the +redboot_FLOPPY.ecm file is used for building a version +of RedBoot suitable for booting off a floppy disk. + + + + +Samsung CalmRISC16 Core Evaluation Board + +Overview +Samsung CalmRISC16 Core EVBinstalling +and testinginstalling and testing +Samsung CalmRISC16 Core EVB The +Samsung CalmRISC16 evaluation platform consists of two boards connected by a +ribbon cable. One board contains the CPU core and memory. The other board is +called the MDSChip board and provides the host interface. The calmRISC16 is a +harvard architecture with separate 22-bit program and data addresses. The +instruction set provides no instruction for writing to program memory. The +MDSChip board firmware (called CalmBreaker) provides a pseudo register interface +so that code running on the core has access to a serial channel and a mechanism +to write to program memory. The serial channel is fixed at 57600-8-N-1 by the +firmware. The CalmBreaker firmware also provides a serial protocol which +allows a host to download a program and to start or stop the core board. +Only a ROM startup RedBoot configuration is supported. + + +Initial Installation Method +The CalmRISC16 core is controlled through the MDSChip board. There is +no non-volatile storage available for RedBoot, so RedBoot must be downloaded +to the board on every power cycle. A small utility program is used to download +S-record files to the eval board. Sources and build instructions for this +utility are located in the RedBoot sources in: + .../packages/hal/calmrisc16/ceb/current/support + +To download the RedBoot image, first press the reset button on the MDSChip +board. The green 'Run' LED on the core board should go off. Now, use the +utility to download the RedBoot image with: + % calmbreaker -p /dev/term/b --reset --srec-code -f redboot.elf + +Note that the '-p /dev/term/b' specifies the serial port to use and will vary +from system to syetm. The download will take about two minutes. After it +finishes, start RedBoot with: + % calmbreaker -p /dev/term/b --run +The 'Run' LED on the core board should be on. Connecting to the MDSboard with +a terminal and typing enter should result in RedBoot reprinting the command +prompt. + + + +Special RedBoot Commands +None. + + +Special Note on Serial Channel +The MDSChip board uses a relatively slow microcontroller to provide +the pseudo-register interface to the core board. This pseudo-register +interface provides access to the serial channel and write access to program +memory. Those interfaces are slow and the serial channel is easily overrun +by a fast host. For this reason, GDB must be told to limit the size of code +download packets to avoid serial overrun. This is done with the following +GDB command: + (gdb) set download-write-size 25 + + + +Resource Usage +The RedBoot image occupies program addresses 0x000000 - 0x00ffff +and data addresses 0x000000 - 0x00ffff. + + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“calm16_ceb”, “calmrisc16” and “ceb” respectively. +Note that the configuration export files supplied in the +hal/calmrisc16/ceb/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +Samsung CalmRISC32 Core Evaluation Board + +Overview +Samsung CalmRISC32 Core EVBinstalling +and testinginstalling and testing +Samsung CalmRISC32 Core EVB The +Samsung CalmRISC32 evaluation platform consists of two boards connected by a +ribbon cable. One board contains the CPU core and memory. The other board is +called the MDSChip board and provides the host interface. The calmRISC32 is a +harvard architecture with separate 32-bit program and data addresses. The +instruction set provides no instruction for writing to program memory. The +MDSChip board firmware (called CalmBreaker) provides a pseudo register interface +so that code running on the core has access to a serial channel and a mechanism +to write to program memory. The serial channel is fixed at 57600-8-N-1 by the +firmware. The CalmBreaker firmware also provides a serial protocol which +allows a host to download a program and to start or stop the core board. +Only a ROM startup RedBoot configuration is supported. + + +Initial Installation Method +The calmRISC32 core is controlled through the MDSChip board. There is +no non-volatile storage available for RedBoot, so RedBoot must be downloaded +to the board on every power cycle. A small utility program is used to download +S-record files to the eval board. Sources and build instructions for this +utility are located in the RedBoot sources in: + .../packages/hal/calmrisc32/ceb/current/support + +To download the RedBoot image, first press the reset button on the MDSChip +board. The green 'Run' LED on the core board should go off. Now, use the +utility to download the RedBoot image with: + % calmbreaker -p /dev/term/b --reset --srec-code -f redboot.elf + +Note that the '-p /dev/term/b' specifies the serial port to use and will vary +from system to syetm. The download will take about two minutes. After it +finishes, start RedBoot with: + % calmbreaker -p /dev/term/b --run +The 'Run' LED on the core board should be on. Connecting to the MDSboard with +a terminal and typing enter should result in RedBoot reprinting the command +prompt. + + + +Special RedBoot Commands +None. + + +Special Note on Serial Channel +The MDSChip board uses a relatively slow microcontroller to provide +the pseudo-register interface to the core board. This pseudo-register +interface provides access to the serial channel and write access to program +memory. Those interfaces are slow and the serial channel is easily overrun +by a fast host. For this reason, GDB must be told to limit the size of code +download packets to avoid serial overrun. This is done with the following +GDB command: + (gdb) set download-write-size 25 + + + +Resource Usage +The RedBoot image occupies program addresses 0x00000000 - 0x0000ffff +and data addresses 0x00000000 - 0x0000ffff. + + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“calm32_ceb”, “calmrisc32” and “ceb” respectively. +Note that the configuration export files supplied in the +hal/calmrisc32/ceb/VERSION/misc +directory in the RedBoot source tree should be used. + + + + + +Hitachi EDK7708 (edk7708) + +Overview +Hitachi SH EDK7708installing +and testinginstalling and testing +Hitachi SH EDK7708RedBoot uses +the serial port. The default serial port settings are 38400,8,N,1. +Management of onboard flash is also supported. Two basic RedBoot configurations +are supported: +RedBoot running from RAM with RedBoot in the flash boot sector. + + +RedBoot running from the board's flash boot sector. + + + + +Initial Installation Method +Program the ROM RedBoot image into flash using an eprom programmer. + + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: -f 0x80000000 +-b 0x88040000 +-l 0x20000 + + + + +Memory Maps +RedBoot sets up the following memory map on the EDK7708 board. +Physical Address Range Description +----------------------- ----------- +0x80000000 - 0x8001ffff Flash (AT29LV1024) +0x88000000 - 0x881fffff DRAM +0xa4000000 - 0xa40000ff LED ON +0xb8000000 - 0xb80000ff LED ON + + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x80000000 - + 0x8001ffff. RedBoot also reserves RAM (0x88000000 - 0x8800ffff) for RedBoot +runtime uses. RAM based RedBoot configurations are designed to run from RAM +at physical addresses 0x88010000 - 0x8803ffff. RAM physical addresses from +0x88040000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“edk7708”, “sh” and “edk7708” respectively. +Note that the configuration export files supplied in the +hal/sh/edk7708/VERSION/misc +directory in the RedBoot source tree should be used. + + + + + +Hitachi Solution Engine 77X9 (SE77X9) + +Overview +Hitachi SH SE77X9installing +and testinginstalling and testing +Hitachi SH SE77X9This +description covers the MS7729SE01 and MS7709SSE0101 variants. See +for instructions for the MS7709SE01 variant. + +RedBoot uses +the COM1 and COM2 serial ports. The default serial port settings are 38400,8,N,1. +Ethernet is also supported using the 10-base T connector. +Management of onboard flash is also supported. Two basic RedBoot configurations +are supported: +RedBoot running from RAM with RedBoot in the flash boot sector. + + +RedBoot running from the board's flash boot sector. + + + + +Initial Installation Method +The Solution Engine ships with the Hitachi boot monitor in EPROM +which allows for initial programming of RedBoot: + + +Set switches SW4-3 and SW4-4 to ON [boot from EPROM] + +Connect a serial cable to COM2 and power up the board. + +After the boot monitor banner, invoke the flash +download/program command:Ready >fl + +The monitor should now ask for input: +Flash ROM data copy to RAM +Please Send A S-format RecordAt this point copy the +RedBoot ROM SREC file to the serial port: +$ cat redboot_ROM.eprom.srec > /dev/ttyS0Eventually you +should see something likeStart Addrs = A1000000 +End Addrs = A1xxxxxx +Transfer complete from the monitor. + +Set switch SW4-3 to OFF [boot from flash] and reboot the board. You +should now see the RedBoot banner. + + + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: -f 0x80000000 +-b 0x8c080000 +-l 0x20000 + + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: + +-f 0x80020000 +-b 0x8c020000 +-r 0x8c020000 +-l 0x20000 + + + +Special RedBoot Commands +The exec command which allows the loading +and execution of Linux kernels +is supported for this board (see ). The +exec parameters used for the SE77x9 are: + + +-b <addr> +Parameter block address. This is normally the first +page of the kernel image and defaults to 0x8c101000 + +-i <addr> +Start address of initrd +image + +-j <size> +Size of initrd image + +-c "args" +Kernel arguments string + + +-m <flags> +Mount rdonly flags. If set to a non-zero value the +root partition will be mounted read-only. + + +-f <flags> +RAM disk flags. Should normally be 0x4000 + +-r <device number> +Root device specification. /dev/ram is 0x0101 + +-l <type> +Loader type + + + +Finally the kernel entry address can be specified as an optional +argument. The default is 0x8c102000 + + +On the SE77x9, Linux expects to be loaded at address 0x8c101000 with +the entry point at 0x8c102000. This is configurable in the kernel +using the CONFIG_MEMORY_START option. + + + + +Memory Maps +RedBoot sets up the following memory map on the SE77x9 board. +Physical Address Range Description +----------------------- ----------- +0x80000000 - 0x803fffff Flash (MBM29LV160) +0x81000000 - 0x813fffff EPROM (M27C800) +0x8c000000 - 0x8dffffff SDRAM +0xb0000000 - 0xb03fffff Ethernet (DP83902A) +0xb0400000 - 0xb07fffff SuperIO (FDC37C935A) +0xb0800000 - 0xb0bfffff Switches +0xb0c00000 - 0xbfffffff LEDs +0xb1800000 - 0xb1bfffff PCMCIA (MaruBun) + + + +Ethernet Driver +The ethernet driver uses a hardwired ESA which can, at present, +only be changed in CDL. + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x80000000 - + 0x8001ffff. RedBoot also reserves RAM (0x8c000000 - 0x8c01ffff) for RedBoot +runtime uses. RAM based RedBoot configurations are designed to run from RAM +at physical addresses 0x8c020000 - 0x8c07ffff. RAM physical addresses from +0x8c080000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“se77x9”, “sh” and “se77x9” respectively. +Note that the configuration export files supplied in the +hal/sh/se77x9/VERSION/misc +directory in the RedBoot source tree should be used. + + + + + +Hitachi Solution Engine 7709 (SE77X9) + +Overview +Hitachi SH SE7709installing +and testinginstalling and testing +Hitachi SH SE7709This +description covers the MS7709SE01 variant. See +for instructions for the MS7729SE01 and MS7709SSE0101 variants. + +RedBoot uses +the COM1 and COM2 serial ports. The default serial port settings are 38400,8,N,1. +Ethernet is also supported using the 10-base T connector. +Management of onboard flash is also supported. Two basic RedBoot configurations +are supported: +RedBoot running from RAM with RedBoot in the flash boot sector. + + +RedBoot running from the board's flash boot sector. + + + + +Initial Installation Method +The Solution Engine ships with the Hitachi boot monitor in EPROM +which allows for initial programming of RedBoot: + + +Set switch SW4-1 to ON [boot from EPROM] + +Connect a serial cable to CN1 (SCI) and power up the board. + +After the boot monitor banner, invoke the flash +download/program command:Ready >fl + +The monitor should now ask for input: +Flash ROM data copy to RAM +Please Send A S-format RecordAt this point copy the +RedBoot ROM SREC file to the serial port: +$ cat redboot_SE7709RP_ROM.eprom.srec > /dev/ttyS0Eventually you +should see something likeStart Addrs = A1000000 +End Addrs = A1xxxxxx +Transfer complete from the monitor. + +Set switch SW4-1 to OFF [boot from flash] and reboot the board. You +should now see the RedBoot banner. + + + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: -f 0x80000000 +-b 0x8c080000 +-l 0x20000 + + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: + +-f 0x80020000 +-b 0x8c020000 +-r 0x8c020000 +-l 0x20000 + + + +Special RedBoot Commands +The exec command which allows the loading +and execution of Linux kernels +is supported for this board (see ). The +exec parameters used for the SE77x9 are: + + +-b <addr> +Parameter block address. This is normally the first +page of the kernel image and defaults to 0x8c101000 + +-i <addr> +Start address of initrd +image + +-j <size> +Size of initrd image + +-c "args" +Kernel arguments string + + +-m <flags> +Mount rdonly flags. If set to a non-zero value the +root partition will be mounted read-only. + + +-f <flags> +RAM disk flags. Should normally be 0x4000 + +-r <device number> +Root device specification. /dev/ram is 0x0101 + +-l <type> +Loader type + + + +Finally the kernel entry address can be specified as an optional +argument. The default is 0x8c102000 + + +For the the SE77x9, Linux by default expects to be loaded at +0x8c001000 which conflicts with the data space used by RedBoot. +To work around this, either change the CONFIG_MEMORY_START kernel +option to a higher address, or use the compressed kernel image and load +it at a higher address. For example, setting CONFIG_MEMORY_START to +0x8c100000, the kernel expects to be loaded at address 0x8c101000 with +the entry point at 0x8c102000. + + + + +Memory Maps +RedBoot sets up the following memory map on the SE77x9 board. +Physical Address Range Description +----------------------- ----------- +0x80000000 - 0x803fffff Flash (MBM29LV160) +0x81000000 - 0x813fffff EPROM (M27C800) +0x8c000000 - 0x8dffffff DRAM +0xb0000000 - 0xb03fffff Ethernet (DP83902A) +0xb0800000 - 0xb08fffff 16C552A +0xb1000000 - 0xb100ffff Switches +0xb1800000 - 0xb18fffff LEDs +0xb8000000 - 0xbbffffff PCMCIA (MaruBun) + + + +Ethernet Driver +The ethernet driver uses a hardwired ESA which can, at present, +only be changed in CDL. + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x80000000 - + 0x8001ffff. RedBoot also reserves RAM (0x8c000000 - 0x8c01ffff) for RedBoot +runtime uses. RAM based RedBoot configurations are designed to run from RAM +at physical addresses 0x8c020000 - 0x8c07ffff. RAM physical addresses from +0x8c080000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“se77x9”, “sh” and “se77x9” respectively. +Note that the configuration export files (containing SE7709RP +substring) supplied in the +hal/sh/se77x9/VERSION/misc +directory in the RedBoot source tree should be used. + + + + + +Hitachi Solution Engine 7751 (SE7751) + +Overview +Hitachi SH SE7751installing +and testinginstalling and testing +Hitachi SH SE7751RedBoot uses +the COM1 serial port. The default serial port settings are 38400,8,N,1. +Ethernet is also supported using the 10-base T connector. +Management of onboard flash is also supported. Two basic RedBoot configurations +are supported: +RedBoot running from RAM with RedBoot in the flash boot sector. + + +RedBoot running from the board's flash boot sector. + + + + +Initial Installation Method +The Solution Engine ships with the Hitachi boot monitor in EPROM +which allows for initial programming of RedBoot: + + +Set switches SW5-3 and SW5-4 to ON [boot from EPROM] + +Connect a serial cable to COM1 and power up the board. + +After the boot monitor banner, invoke the flash +download/program command:Ready >fl + +The monitor should now ask for input: +Flash ROM data copy to RAM +Please Send A S-format RecordAt this point copy the +RedBoot ROM SREC file to the serial port: +$ cat redboot_ROM.eprom.srec > /dev/ttyS0Eventually you +should see something likeStart Addrs = A1000000 +End Addrs = A1xxxxxx +Transfer complete from the monitor. + +Set switch SW5-3 to OFF [boot from flash] and reboot the board. You +should now see the RedBoot banner. + + + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: -f 0x80000000 +-b 0x8c080000 +-l 0x20000 + + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: + +-f 0x80020000 +-b 0x8c020000 +-r 0x8c020000 +-l 0x20000 + + + +Special RedBoot Commands +The exec command which allows the loading +and execution of Linux kernels +is supported for this board (see ). The +exec parameters used for the SE7751 are: + + +-b <addr> +Parameter block address. This is normally the first +page of the kernel image and defaults to 0x8c101000 + +-i <addr> +Start address of initrd +image + +-j <size> +Size of initrd image + +-c "args" +Kernel arguments string + + +-m <flags> +Mount rdonly flags. If set to a non-zero value the +root partition will be mounted read-only. + + +-f <flags> +RAM disk flags. Should normally be 0x4000 + +-r <device number> +Root device specification. /dev/ram is 0x0101 + +-l <type> +Loader type + + + +Finally the kernel entry address can be specified as an optional +argument. The default is 0x8c102000 + + +On the SE7751, Linux expects to be loaded at address 0x8c101000 with +the entry point at 0x8c102000. This is configurable in the kernel +using the CONFIG_MEMORY_START option. + + + + +Memory Maps +RedBoot sets up the following memory map on the SE7751 board. +Physical Address Range Description +----------------------- ----------- +0x80000000 - 0x803fffff Flash (MBM29LV160) +0x81000000 - 0x813fffff EPROM (M27C800) +0x8c000000 - 0x8fffffff SDRAM +0xb8000000 - 0xb8ffffff PCMCIA (MaruBun) +0xb9000000 - 0xb9ffffff Switches +0xba000000 - 0xbaffffff LEDs +0xbd000000 - 0xbdffffff PCI MEM space +0xbe200000 - 0xbe23ffff PCI Ctrl space +0xbe240000 - 0xbe27ffff PCI IO space + + + +Ethernet Driver +The ethernet driver uses a hardwired ESA which can, at present, +only be changed in CDL. + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x80000000 - + 0x8001ffff. RedBoot also reserves RAM (0x8c000000 - 0x8c01ffff) for RedBoot +runtime uses. RAM based RedBoot configurations are designed to run from RAM +at physical addresses 0x8c020000 - 0x8c07ffff. RAM physical addresses from +0x8c080000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“se7751”, “sh” and “se7751” respectively. +Note that the configuration export files supplied in the +hal/sh/se7751/VERSION/misc +directory in the RedBoot source tree should be used. + + + + + +Hitachi HS7729PCI + +Overview +Hitachi SH HS7729PCIinstalling +and testinginstalling and testing +Hitachi SH HS7729PCIRedBoot uses +the COM1 and COM2 serial ports (and the debug port on the +motherboard). +The default serial port settings are 38400,8,N,1. +Ethernet is also supported using a D-Link DFE-530TX PCI plugin card. +Management of onboard flash is also supported. Two basic RedBoot configurations +are supported: +RedBoot running from RAM with RedBoot in the flash boot sector. + + +RedBoot running from the board's flash boot sector. + + + + +Initial Installation Method +A copy of the ROM startup version of RedBoot must be programmed +into the two EPROMs. Two files with a split version of the ROM image is +provided: it is also possible to recreate these from the redboot.bin +file, but requires the split_word.c program in +hal/sh/hs7729pci/VERSION/misc to be built +and executed with the redboot.bin filename as sole argument. + +After doing this it is advised that another ROM version of +RedBoot is programmed into the flash, and that copy be used for +booting the board. This allows for software programmed updates of +RedBoot instead of having to reprogram the EPROMs. + + +Program the EPROMs with RedBoot. The .lo image should +go in socket M1 and the .hi image in socket M2. + + +Set switch SW1-6 to ON [boot from EPROM] + +Follow the instructions under Flash management for +updating the flash copy of RedBoot, but use +-f 0x80400000 due to setting of +the SW1-6 switch. + +Set switch SW1-6 to OFF [boot from flash] and reboot the board. You +should now see the RedBoot banner. At this time you may want to issue +the command fis init to initialize +the flash table with the correct addresses. + + + + + + +Flash management + +Updating the primary RedBoot image +To update the primary RedBoot images, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: -f 0x80000000 +-b 0x8c080000 +-l 0x20000 + + +Updating the secondary RedBoot image +To update the secondary RedBoot images, follow the procedures detailed +in , but the actual numbers used +with the flags in the sample commands should be: + +-f 0x80020000 +-b 0x8c020000 +-r 0x8c020000 +-l 0x20000 + + + +Special RedBoot Commands +The exec command which allows the loading +and execution of Linux kernels +is supported for this board (see ). The +exec parameters used for the HS7729PCI are: + + +-b <addr> +Parameter block address. This is normally the first +page of the kernel image and defaults to 0x8c101000 + +-i <addr> +Start address of initrd +image + +-j <size> +Size of initrd image + +-c "args" +Kernel arguments string + + +-m <flags> +Mount rdonly flags. If set to a non-zero value the +root partition will be mounted read-only. + + +-f <flags> +RAM disk flags. Should normally be 0x4000 + +-r <device number> +Root device specification. /dev/ram is 0x0101 + +-l <type> +Loader type + + + +Finally the kernel entry address can be specified as an optional +argument. The default is 0x8c102000 + + +On the HS7729PCI, Linux expects to be loaded at address 0x8c101000 with +the entry point at 0x8c102000. This is configurable in the kernel +using the CONFIG_MEMORY_START option. + + + + +Memory Maps +RedBoot sets up the following memory map on the HS7729PCI board. +Physical Address Range Description +----------------------- ----------- +0x80000000 - 0x803fffff Flash (MBM29LV160) +0x80400000 - 0x807fffff EPROM (M27C800) +0x82000000 - 0x82ffffff SRAM +0x89000000 - 0x89ffffff SRAM +0x8c000000 - 0x8fffffff SDRAM +0xa8000000 - 0xa800ffff SuperIO (FDC37C935A) +0xa8400000 - 0xa87fffff USB function (ML60851C) +0xa8800000 - 0xa8bfffff USB host (SL11HT) +0xa8c00000 - 0xa8c3ffff Switches +0xa8c40000 - 0xa8c7ffff LEDs +0xa8c80000 - 0xa8cfffff Interrupt controller +0xb0000000 - 0xb3ffffff PCI (SD0001) +0xb8000000 - 0xbbffffff PCMCIA (MaruBun) + + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x80000000 - + 0x8001ffff. RedBoot also reserves RAM (0x8c000000 - 0x8c01ffff) for RedBoot +runtime uses. RAM based RedBoot configurations are designed to run from RAM +at physical addresses 0x8c020000 - 0x8c07ffff. RAM physical addresses from +0x8c080000 to the end of RAM are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for TARGET, ARCH_DIR and PLATFORM_DIR on this platform are +“hs7729pci”, “sh” and “hs7729pci” respectively. +Note that the configuration export files supplied in the +hal/sh/hs7729pci/VERSION/misc +directory in the RedBoot source tree should be used. + + + + + + +Atmel AT91 Evaluation Board (EB40) + +Overview +Atmel AT91/EB40 +installing and testing +installing and testingAtmel AT91/EB40 +RedBoot supports both serial ports. +The default serial port settings are 38400,8,N,1. RedBoot +also supports minimal flash management on the EB40. +However, since the flash device (AT29LV1024) is so small (only the upper 64K is +available for general use), only 'fconfig' is +supported, along with the simple flash write command, 'fis write'. +Two +basic RedBoot configurations are supported: +RedBoot running from RAM, but contained in the board's flash boot sector +(ROMRAM mode). + +RedBoot running from RAM with RedBoot in the flash boot sector. + + + +The RAM version is only used during the initialization of RedBoot the first time. + + + + +Initial Installation Method + +This development board comes with ARM's debug tool, Angel, installed in flash. +At this time, Angel will not be replaced. Rather, RedBoot will be placed in +the alternate half of flash. Switch SW1 is used which monitor to boot. Selecting +SW1 to "lower mem" will choose Angel. Select SW1 to "Upper mem" for RedBoot once +it has been installed. + + +Set SW1 to "lower mem" and connect serial port A to a host computer. Using GDB +from the host and Angel on the board, download the RAM based version of RedBoot +to the board. Once this is started, the Angel session must be interrupted (on +Linux this can be done using ^Z). Follow this by connecting to the board using +minicom at 38400-8N1. At this point, RedBoot will be running on the board in +RAM. Now, download the ROMRAM version and program it to flash. Be sure and +first set SW1 to "upper mem". + +arm-elf-gdb redboot_RAM.elf +(gdb) tar rdi s=/dev/ttyS0 +Angel Debug Monitor (serial) 1.04 (Advanced RISC Machines SDT 2.5) for +AT91EB40 (2.00) +Angel Debug Monitor rebuilt on Apr 07 2000 at 12:40:31 +Serial Rate: 9600 +Connected to ARM RDI target. +(gdb) set $ps=0xd3 +(gdb) lo +Loading section .rom_vectors, size 0x40 lma 0x2020000 +Loading section .text, size 0x7fd8 lma 0x2020040 +Loading section .rodata, size 0x15a0 lma 0x2028018 +Loading section .data, size 0x2e4 lma 0x20295b8 +Start address 0x2020040 , load size 39068 +Transfer rate: 6250 bits/sec, 500 bytes/write. +(gdb) c +Continuing. + +At this point, interrupt the Angel session and start minicom. + +RedBoot> ve + +RedBoot(tm) bootstrap and debug environment [RAM] +Red Hat certified release, version R1.xx - built 14:09:27, Jul 20 2001 + +Platform: Atmel AT91/EB40 (ARM7TDMI) +Copyright (C) 2000, 2001, Red Hat, Inc. + +RAM: 0x02000000-0x02080000, 0x020116d8-0x0207fd00 available +FLASH: 0x01010000 - 0x01020000, 256 blocks of 0x00000100 bytes each. + +RedBoot> load -m ymodem -b 0x02040000 + +Use minicom to send the file redboot_ROMRAM.srec via YModem. + +RedBoot> fi wr -f 0x01010000 -b 0x02040000 -l 0xe000 + +Set switch SW1 to "upper mem", press the "reset" pushbutton and RedBoot +should come up on the board. + + + +Flash management + +Updating the RedBoot image in flash + +Since the primary RedBoot runs from RAM, it can be used to update itself directly. +Simply follow the steps above, starting with a connection to RedBoot running on +the board. + + + + +Special RedBoot Commands +None. + + +Memory Maps +This processor has no MMU, so the only memory map is for physical addresses. + +Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x00000fff On-chip SRAM +0x01000000 - 0x0101ffff Flash +0x02000000 - 0x0207ffff RAM +0xffe00000 - 0xffffffff I/O registers + +The flash based RedBoot image occupies virtual addresses 0x01010000 - 0x0101dfff + + + + +Resource Usage +The RAM based RedBoot image occupies RAM addresses 0x02020000 - 0x0203ffff. +RAM addresses from 0x02040000 to the end of RAM are available for general use +such as a temporary scratchpad for downloaded images before they are written +to flash. + +Rebuilding RedBoot +The instructions in should be followed. +The values for PLATFORM_DIR on this platform is +“at91”. +The value for TARGET is “eb40”. +Note that the configuration export files supplied in the +hal/arm/at91/VERSION/misc +directory in the RedBoot source tree should be used. +The ROMRAM configuration should be used to build the RedBoot image to be +programmed into flash. The RAM configuration is used for the initial download +of RedBoot. + + + + + +Matsushita MN103E010 (AM33/2.0) ASB2305 Board + +Overview + + +Matsushita MN103E010 (AM33/2.0) ASB2305 Board +installing and testing + + +installing and testing +Matsushita MN103E010 (AM33/2.0) ASB2305 Board + +RedBoot supports the debug serial port and the built in ethernet port for communication and +downloads. The default serial port settings are 115200,8,N,1 with RTS/CTS flow control. RedBoot can +run from either flash, and can support flash management for either the boot PROM or the system +flash regions. These configurations are supported: + +RedBoot running from the boot PROM and able to access the system flash (the +redboot_ROM.bin image should be used for this). + +RedBoot running from the system flash and able to access the boot PROM (the +redboot_FLASH.bin image should be used for this). + +RedBoot running from RAM and able to access the boot PROM (the +redboot_RAM.bin image should be used for this). + + + + +Initial Installation +Unless a pre-programmed system flash module is available to be plugged into a new board, +RedBoot must be installed with the aid of a JTAG interface unit. To achieve this, the RAM based +RedBoot must be loaded directly into RAM by JTAG and started, and then that +must be used to store the ROM based RedBoot into the boot PROM. +These instructions assume that you have binary images of the RAM-based and boot PROM-based +RedBoot images available. + +Preparing to program the board +If the board is to be programmed, whether via JTAG or RedBoot, some hardware settings need to +be changed: + + +Jumper across ST18 on the board to allow write access to the boot PROM. + + +Set DIP switch S1-3 to OFF to allow RedBoot to write to the system flash. + + +Set the switch S5 (on the front of the board) to boot from whichever flash is +not being programmed. Note that the RedBoot image cannot access the flash from +which it is currently executing (it can only access the other flash). + + + +The RedBoot binary image files should also be copied to the TFTP pickup area on the host providing +TFTP services if that is how RedBoot should pick up the images it is going to program into the +flash. Alternatively, the images can be passed by YMODEM over the serial link. + + + +Preparing to use the JTAG debugger +The JTAG debugger will also need setting up: + +Install the JTAG debugger software (WICE103E) on a PC running Windows (WinNT is +probably the best choice for this) in “C:/PanaX”. + +Install the Matsushita provided “project” into the +“C:/Panax/wice103e/prj” directory. + +Install the RedBoot image files into the “C:/Panax/wice103e/prj” +directory under the names redboot.ram and redboot.prom. + +Make sure the PC's BIOS has the parallel port set to full bidirectional +mode. + +Connect the JTAG debugger to the PC's parallel port. + +Connect the JTAG debugger to the board. + +Set the switch on the front of the board to boot from “boot +PROM”. + +Power up the JTAG debugger and then power up the board. + +Connect the board's Debug Serial port to a computer by a null modem cable. + +Start minicom or some other serial communication software and set for 115200 baud, +1-N-8 with hardware (RTS/CTS) flow control. + + + + +Loading the RAM-based RedBoot via JTAG +To perform the first half of the operation, the following steps should be followed: + +Start the JTAG debugger software. + + +Run the following commands at the JTAG debugger's prompt to set up the MMU registers on the +CPU. + +ed 0xc0002000, 0x12000580 + +ed 0xd8c00100, 0x8000fe01 +ed 0xd8c00200, 0x21111000 +ed 0xd8c00204, 0x00100200 +ed 0xd8c00208, 0x00000004 + +ed 0xd8c00110, 0x8400fe01 +ed 0xd8c00210, 0x21111000 +ed 0xd8c00214, 0x00100200 +ed 0xd8c00218, 0x00000004 + +ed 0xd8c00120, 0x8600ff81 +ed 0xd8c00220, 0x21111000 +ed 0xd8c00224, 0x00100200 +ed 0xd8c00228, 0x00000004 + +ed 0xd8c00130, 0x8680ff81 +ed 0xd8c00230, 0x21111000 +ed 0xd8c00234, 0x00100200 +ed 0xd8c00238, 0x00000004 + +ed 0xd8c00140, 0x9800f801 +ed 0xd8c00240, 0x00140000 +ed 0xd8c00244, 0x11011100 +ed 0xd8c00248, 0x01000001 + +ed 0xda000000, 0x55561645 +ed 0xda000004, 0x000003c0 +ed 0xda000008, 0x9000fe01 +ed 0xda00000c, 0x9200fe01 +ed 0xda000000, 0xa89b0654 + + + +Run the following commands at the JTAG debugger's prompt to tell it what regions of the CPU's +address space it can access: + +ex 0x80000000,0x81ffffff,/mexram +ex 0x84000000,0x85ffffff,/mexram +ex 0x86000000,0x867fffff,/mexram +ex 0x86800000,0x87ffffff,/mexram +ex 0x8c000000,0x8cffffff,/mexram +ex 0x90000000,0x93ffffff,/mexram + + +Instruct the debugger to load the RAM RedBoot image into RAM: + +_pc=90000000 +u_pc +rd redboot.ram,90000000 + + +Load the boot PROM RedBoot into RAM: + +rd redboot.prom,91020000 + + +Start RedBoot in RAM: + +g + +Note that RedBoot may take some time to start up, as it will attempt to query a BOOTP or DHCP +server to try and automatically get an IP address for the board. Note, however, that it should send +a plus over the serial port immediately, and the 7-segment LEDs should display “rh +8”. + + + + +Loading the boot PROM-based RedBoot via the RAM RedBoot +Once the RAM RedBoot is up and running, it can be communicated with by way of the serial +port. Commands can now be entered directly to RedBoot for flashing the boot PROM. + +Instruct RedBoot to initialise the boot PROM: + +fi init + + +Write the previously loaded redboot.prom image into the boot PROM: + +fi write -f 0x80000000 -b 0x91020000 -l 0x00020000 + + +Check that RedBoot has written the image: + +dump -b 0x91020000 +dump -b 0x80000000 + +Barring the difference in address, the two dumps should be the same. + +Close the JTAG software and power-cycle the board. The RedBoot banners should be +displayed again over the serial port, followed by the RedBoot prompt. The boot PROM-based RedBoot +will now be running. + +Power off the board and unjumper ST18 to write-protect the contents of the boot +PROM. Then power the board back up. + +Run the following command to initialise the system flash: + +fi init + +Then program the system flash based RedBoot into the system flash: + +load -r -b 0x91020000 /tftpboot/redboot_FLASH.bin +fi write -f 0x84000000 -b 0x91020000 -l 0x00020000 + + +NOTE +RedBoot arranges the flashes on booting such that they always appear at the same addresses, +no matter which one was booted from. + + + +A similar sequence of commands can be used to program the boot PROM when RedBoot has been +booted from an image stored in the system flash. + + +load -r -b 0x91020000 /tftpboot/redboot_ROM.bin +fi write -f 0x80000000 -b 0x91020000 -l 0x00020000 + +See for details on configuring the RedBoot in +general, and also for more details on programming the system +flash. + + + + + +Additional Commands +The exec command which allows the loading and execution of +Linux kernels, is supported for this architecture (see ). The +exec parameters used for ASB2305 board are: + + +-w <time> +Wait time in seconds before starting kernel + +-c "params" +Parameters passed to kernel +<addr> +Kernel entry point, defaulting to the entry point of the last image +loaded + +The parameter string is stored in the on-chip memory at location 0x8C001000, and is prefixed +by “cmdline:” if it was supplied. + + +Memory Maps +RedBoot sets up the following memory map on the ASB2305 board. + +NOTE +The regions mapped between 0x80000000-0x9FFFFFFF are cached by the CPU. However, all those +regions can be accessed uncached by adding 0x20000000 to the address. + + +Physical Address Range Description +----------------------- ----------- +0x80000000 - 0x9FFFFFFF Cached Region +0x80000000 - 0x81FFFFFF Boot PROM +0x84000000 - 0x85FFFFFF System Flash +0x86000000 - 0x86007FFF 64Kbit Sys Config EEPROM +0x86F90000 - 0x86F90003 4x 7-segment LEDs +0x86FA0000 - 0x86FA0003 Software DIP Switches +0x86FB0000 - 0x86FB001F PC16550 Debug Serial Port +0x8C000000 - 0x8FFFFFFF On-Chip Memory (repeated 16Kb SRAM) +0x90000000 - 0x93FFFFFF SDRAM +0x98000000 - 0x9BFFFFFF Paged PCI Memory Space (64Mb) +0x9C000000 - 0x9DFFFFFF PCI Local SRAM (32Mb) +0x9E000000 - 0x9E03FFFF PCI I/O Space +0x9E040000 - 0x9E0400FF AM33-PCI Bridge Registers +0x9FFFFFF4 - 0x9FFFFFF7 PCI Memory Page Register +0x9FFFFFF8 - 0x9FFFFFFF PCI Config Registers +0xA0000000 - 0xBFFFFFFF Uncached Mirror Region +0xC0000000 - 0xDFFFFFFF CPU Control Registers + +The ASB2305 HAL makes use of the on-chip memory in the following way: + +0x8C000000 - 0x8C0000FF hal_vsr_table +0x8C000100 - 0x8C0001FF hal_virtual_vector_table +0x8C001000 - Linux command line (RedBoot exec command) + - 0x8C003FFF Emergency DoubleFault Exception Stack + +Currently the CPU's interrupt table lies at the beginning of the RedBoot image, which must +therefore be aligned to a 0xFF000000 mask. + + +Resource Usage +The flash based RedBoot image occupies flash addresses 0x80000000 - 0x8001ffff. RedBoot also +reserves RAM (0x90000000 - 0x9001ffff) for RedBoot runtime uses. RAM based RedBoot configurations +are designed to run from RAM at physical addresses 0x90000000 - 0x9001ffff. RAM physical addresses +from 0x90050000 to the end of RAM are available for general use, such as a temporary scratchpad for +downloaded images, before they are written to flash. + +NOTE +The location at which RedBoot can be started is highly restricted due to the way in which the +address of the Trap Vector Table is specified to the CPU. + + +Rebuilding RedBoot +The instructions in should be followed. The values for +TARGET, ARCH_DIR and PLATFORM_DIR on this platform are “asb2305”, “mn10300” +and “asb2305” respectively. Note that the configuration export files supplied in the + hal/mn10300/asb2305/VERSION/misc +directory in the RedBoot source tree should be used. + + + + +Agilent AAED2000 ARM9 (aaed) + +Overview +Agilent AAED2000 ARM9 (aaed) +installing and testing +installing and testingAgilent AAED2000 ARM9 (aaed) +RedBoot supports the serial and ethernet ports +on the board. The default serial port settings are 38400,8,N,1. +RedBoot also supports flash management on the AAED2000. +Two basic RedBoot configurations are supported: +RedBoot being automatically executed by the on-board +ARM Boot Monitor, running from RAM. + +RedBoot running from RAM with RedBoot in the flash boot sector. + + + + + + + +Initial Installation Method +It is possible to install RedBoot in one of two ways. Either as +the primary bootmonitor on the board (installed to blocks 0-1 of the +flash) or as the secondary bootmonitor on the board (installed to +blocks 1-2 of the flash). + +Presently, only the former method is supported. + + +RedBoot as Primary Bootmonitor + +RedBoot is installed in flash using the on-board ARM Boot +Monitor. +Boot the board while pressing SPACE. This should bring up the +Boot Monitor: +ARM bootPROM [Version 1.3] Rebuilt on Jul 16 2001 at 16:21:36 +Running on a P920 board Evaluation Board +Board Revision V1.0, ARM920T processor Processor +Memory Size is 32MBytes, Flash Size is 32MBytes +Copyright (c) ARM Limited 1999 - 2001. All rights reserved. +Board designed by ARM Limited +Hardware support provided at http://www.arm.com/ +For help on the available commands type ? or h +boot Monitor > + + +Download the RAM startup version of RedBoot configured as a primary +bootmonitor using the ARM bootmonitor's SREC-download command: + +boot Monitor > m +Load Motorola S-Record image into memory and execute it +The S-Record loader only accepts input on the serial port. +Record addresses must be between 0x00008000 and 0x01E0F510. +Type Ctrl/C to exit loader. + + +Use the terminal emulator's ASCII upload command, or (on Linux) simply +cat the file to the serial port: + +$ cat redboot_primary_RAM/redboot.srec >/dev/ttyS1 + + +You should see RedBoot start up: + +FLASH configuration checksum error or invalid key +Ethernet eth0: MAC address 00:30:d3:03:04:99 +IP: 192.168.42.111, Default server: 192.168.42.3 + +RedBoot(tm) bootstrap and debug environment [RAM] +Non-certified release, version UNKNOWN - built 13:15:40, Nov 9 2001 + +Platform: AAED2000 system (ARM9) [Primary] +Copyright (C) 2000, 2001, Red Hat, Inc. + +RAM: 0x00000000-0x01f80000, 0x0006f208-0x01f51000 available +FLASH: 0x60000000 - 0x62000000, 256 blocks of 0x00020000 bytes each. +RedBoot> + +As can be seen from the output above, the network has been configured +to give the board an IP address and information about the default +server. If things are not set up on your network, you can still +continue, but use the Y-modem download method when loading the RedBoot +ROMRAM image. + +Now initialize RedBoot's FIS: + +RedBoot> fi init +About to initialize [format] FLASH image system - continue (y/n)? y +*** Initialize FLASH Image System + Warning: device contents not erased, some blocks may not be usable +... Erase from 0x61fe0000-0x62000000: . +... Program from 0x01f5f000-0x01f5f300 at 0x61fe0000: . + + +Download the ROMRAM version of RedBoot via ethernet: + +RedBoot> load -b 0x100000 redboot_primary_ROMRAM/redboot.srec + + +or using serial Y-modem protocol: + +RedBoot> load -mode ymodem -b 0x100000 + + +(Use the terminal emulator's Y-modem upload command to send the file +redboot_primary_ROMRAM/redboot.srec.) + +When the image has been downloaded, program it into flash: + +Address offset = 0x00ff8000 +Entry point: 0x00008040, address range: 0x00008000-0x0002da80 +RedBoot> fi cr RedBoot -b 0x100000 +An image named 'RedBoot' exists - continue (y/n)? y +* CAUTION * about to program 'RedBoot' + at 0x60000000..0x6003ffff from 0x00100000 - continue (y/n)? y +... Erase from 0x60000000-0x60040000: .. +... Program from 0x00100000-0x00140000 at 0x60000000: .. +... Erase from 0x61fe0000-0x62000000: . +... Program from 0x01f5f000-0x01f7f000 at 0x61fe0000: . + + +Now reset the board. You should see the RedBoot banner. + + + + + + + +Flash management + +Updating the RedBoot image + Since the RedBoot image is a ROMRAM-startup +type, it is not necessary to load and run the RAM startup RedBoot +image to update the image in flash. Doing so causes no harm though - +but ignoring the step saves some time. + + +To update the primary RedBoot image, follow the procedures +detailed in , but let RedBoot +find the correct flash address (the -f option) since this is different +between the bootmonitor configurations. If +specifying it, be sure to get it right - the actual numbers used with +the flags in the sample commands should for a RedBoot image configured +to be the primary bootmonitor be: + +-f 0x60000000 +-b 0x100000 +-l 0x40000 + + + + + + + + +Special RedBoot Commands +The exec command which allows the loading +and execution of Linux kernels, +is supported for this board (see ). The +exec parameters used for the AAED2000 are: + +-b <addr> +Location Linux kernel was loaded to + +-l <len> +Length of kernel + +-c "params" +Parameters passed to kernel +-r <addr> +'initrd' ramdisk location +-s <len> +Length of initrd ramdisk + + +The parameters for kernel image base and size are automatically +set after a load operation. So one way of starting the kernel would +be: + +RedBoot> load -r -b 0x100000 zImage +Raw file loaded 0x00100000-0x001a3d6c +RedBoot> exec -c "console=ttyAC0,38400" +Using base address 0x00100000 and length 0x000a3d6c +Uncompressing Linux..... + + +An image could also be put in flash and started directly: + +RedBoot> exec -b 0x60040000 -l 0xc0000 -c "console=ttyAC0,38400" +Uncompressing Linux..... + + + + + + +Memory Maps +The MMU page tables are located at 0x4000. NOTE + +The virtual memory maps in this section use a C and B column to indicate +whether or not the region is cached (C) or buffered (B). +Physical Address Range Description +----------------------- ---------------------------------- +0x00000000 - 0x01ffffff Flash +0x10000000 - 0x100fffff Ethernet +0x30000000 - 0x300fffff Board registers +0x40000000 - 0x4fffffff PCMCIA Slot (0) +0x50000000 - 0x5fffffff Compact Flash Slot (1) +0x80000000 - 0x800037ff I/O registers +0xb0060000 - 0xb00fffff On-chip SRAM +0xf0000000 - 0xfd3fffff SDRAM + +Virtual Address Range C B Description +----------------------- - - ---------------------------------- +0x00000000 - 0x01f7ffff Y Y SDRAM +0x01f80000 - 0x01ffffff Y Y SDRAM (used for LCD frame buffer) +0x10000000 - 0x100fffff N N Ethernet +0x30000000 - 0x300fffff N N Board registers +0x40000000 - 0x4fffffff N N PCMCIA Slot (0) +0x50000000 - 0x5fffffff N N Compact Flash Slot (1) +0x60000000 - 0x61ffffff N N Flash +0x80000000 - 0x800037ff N N I/O registers +0xf0000000 - 0xffffffff N N SDRAM (uncached) + + + + + +Resource Usage +The RAM based RedBoot image occupies RAM addresses +0x40000 - 0x7ffff. +The flash based RedBoot image occupies RAM addresses +0x00000000 - 0x0003ffff. +RAM addresses from 0x80000 to the end of RAM are available for general use +such as a temporary scratchpad for downloaded images before they are written +to flash. +If configured to use the LCD screen, additional DRAM from +0x01f80000 - 0x01ffffff +is used for the LCD frame buffer. + + +Rebuilding RedBoot +The instructions in should be followed. +The values for ARCH_DIR and PLATFORM_DIR on this platform are +“arm” and “arm9/aaed2000” respectively. +The value for TARGET is “aaed”. +Note that the configuration export files supplied in the +hal/arm/arm9/aaed2000/VERSION/misc +directory in the RedBoot source tree should be used. + + + + + +NEC DDB-VRC4375 + +Overview + +NEC DDB-VRC4375 +installing and testing +installing and testingNEC DDB-VRC4375 +RedBoot supports only serial port 1, which is connected to the upper +of the stacked serial connectors on the board. The default serial +port settings are 38400,8,N,1. FLASH management is also supported. Two +basic RedBoot configurations are supported: + + +RedBoot running from RAM which has been relocated from the board's +flash boot sector. +RedBoot running from RAM with RedBoot in the flash boot sector. + + +Since the normal RedBoot configuration does not use the FLASH ROM +except during startup, it is unnecessary to load a RAM-based RedBoot +before reprogramming the FLASH. + + + + +Initial Installation Method + +A device programmer should be used to program a socketed FLASH part +(AMD 29F040). The board as delivered is configured for a 512K +EPROM. To install a FLASH ROM, Jumpers J30, J31 and J36 need to be +changed as described in the board's User Manual. + + +Since RedBoot for this board relocates itself from ROM to RAM at +startup, it is not necessary to run a secondary RAM based version of +RedBoot to update the main FLASH image. Instead this can be done from +the primary version of RedBoot. + + + +Updating the primary RedBoot image +To update the primary RedBoot image, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: + +-b 0x80100000 + +Flash locking and unlocking is not required. +Note that these values are inferred when updating the RedBoot image once +the fis create has been run. + + + + + + +Special RedBoot Commands + +None. + + + +Memory Maps + +RedBoot sets up the memory map primarily as described in the board's +User Manual. There are some minor differences, noted in the following +table: + +Physical Virtual Resource +Addresses Addresses +00000000-01FFFFFF 80000000-81FFFFFF Base SDRAM (cached) +00000000-01FFFFFF A0000000-A1FFFFFF Base SDRAM (uncached) +0C000000-0C0BFFFF AC000000-AC0B0000 PCI IO space +0F000000-0F0001FF AF000000-AF0001FF VRC4375 Registers +1C000000-1C0FFFFF BC000000-BC0FFFFF VRC4372 Registers +1C100000-1DFFFFFF BC100000-BDFFFFFF PCI Memory space +1FC00000-1FC7FFFF BFC00000-BFC7FFFF FLASH ROM +80000000-8000000D C0000000-C000000D RTC +8000000E-80007FFF C000000E-C0007FFF NVRAM +81000000-81FFFFFF C1000000-C1FFFFFF Z85C30 DUART +82000000-82FFFFFF C2000000-C2FFFFFF Z8536 Timer +83000000-83FFFFFF C3000000-C3FFFFFF 8255 Parallel port +87000000-87FFFFFF C7000000-C7FFFFFF Seven segment display + + + NOTE + +By default the VRC4375 SIMM control registers are not programmed +since the values used must depend on the SIMMs installed. If SIMMs +are to be used, correct values must be placed in these registers +before accessing the SIMM address range. + + + + NOTE + +The allocation of address ranges to devices in the PCI IO and +memory spaces is handled by the eCos PCI support library. They do +not correspond to those described in the board User Manual. + + + + NOTE + +The MMU has been set up to relocate the VRC4372 supported devices +mapped at physical addresses 0x8xxxxxxx to virtual addresses +0xCxxxxxxx. + + + + + + +Resource Usage + + +The RedBoot image occupies flash addresses 0x1fc00000 - 0x1fc1ffff. To +execute it copies itself out of there to RAM at 0x80000000. RedBoot +reserves 1MB of RAM from 0x80000000 to 0x800FFFFF for its own use. +The top 1MB of RAM from 0x81F00000 to 0x81FFFFFF is reserved for use +by the PCI Ethernet device. RAM based RedBoot configurations are +designed to run from RAM at virtual addresses 0x80100000 - +0x8011ffff. RAM virtual addresses from 0x80020000 to the start of the +PCI window are available for general use, such as a temporary +scratchpad for downloaded images, before they are written to flash. + + + + +Ethernet Driver + + +The ethernet driver is in two parts: + + + +A generic ether driver for the Intel i21143 device is located in +devs/eth/intel/i21143. Its package name is CYGPKG_DEVS_ETH_INTEL_I21143. + + + +The platform-specific ether driver is devs/eth/mips/vrc4375. Its package is +CYGPKG_DEVS_ETH_MIPS_VRC4375. This tells the generic driver the address in +IO memory of the chip, for example, and other configuration details. The +ESA (MAC address) is by default collected from on-board serial EEPROM, +unless configured statically within this package. + + + + +Rebuilding RedBoot + + +The instructions in should be followed. The values for +TARGET, ARCH_DIR and PLATFORM_DIR on this platform are “vrc4375”, +“mips” and “vrc4375” respectively. The configuration export files +supplied in the hal/mips/vrc4375/VERSION/misc directory in the RedBoot +source tree should be used. In general only the ROMRAM variant should +need to be used. + + + + + + +Fujitsu FR-V 400 (MB-93091) + +Overview + +Fujitsu FR-V 400 +installing and testing +installing and testing +Fujitsu FR-V 400 +RedBoot supports both serial ports, which are available via +the stacked serial connectors on the mother board. +The topmost port is the default and is considered to be port 0 by RedBoot. +The bottommost port is serial port 1. +The default serial port settings are 38400,8,N,1. + + +FLASH management is also supported, but only for the FLASH device in IC7. +This arrangement allows for IC8 to retain either the original Fujitsu board +firmware, or some application specific contents. +Two basic RedBoot configurations are supported: + + + + + RedBoot running from RAM which has been relocated from the board's + flash boot sector. This mode is known as ROMRAM. + + + + + RedBoot running from RAM, loaded by some other means. + + + + + + +Since the normal RedBoot configuration does not use the FLASH ROM +except during startup, it is unnecessary to load a RAM-based RedBoot +before reprogramming the FLASH. + + + + +Initial Installation Method + + +RedBoot can be installed by directly programming the FLASH device in IC7 +or by using the Fujitsu provided software to download and install a +version into the FLASH device. Complete instructions are provided +separately. + + + +Updating the primary RedBoot image +To update the primary RedBoot image, follow the procedures detailed +in , but the actual numbers used with +the flags in the sample commands should be: + +-f 0xFF000000 +-b 0x100000 +-l 0x40000 + +Note that these values are inferred when updating the RedBoot image once +the fis create has been run. + + + + + + +Special RedBoot Commands + +None. + + + +Memory Maps + +The memory map of this platform is fixed by the hardware (cannot +be changed by software). The only attributes which can be modified are +control over cacheability, as noted below. + +Address Cache? Resource +00000000-03EFFFFF Yes SDRAM (via plugin DIMM) +03F00000-03FFFFFF No SDRAM (used for PCI window) +10000000-1FFFFFFF No MB86943 PCI bridge +20000000-201FFFFF No SRAM +21000000-23FFFFFF No Motherboard resources +24000000-25FFFFFF No PCI I/O space +26000000-2FFFFFFF No PCI Memory space +30000000-FDFFFFFF ?? Unused +FE000000-FEFFFFFF No I/O devices +FF000000-FF1FFFFF No IC7 - RedBoot FLASH +FF200000-FF3FFFFF No IC8 - unused FLASH +FF400000-FFFFFFFF No Misc other I/O + + + + NOTE + +The only configuration currently suppored requires a 64MB SDRAM +DIMM to be present on the CPU card. No other memory configuration +is supported at this time. + + + + + + +Resource Usage + + +The RedBoot image occupies flash addresses 0xFF000000 - 0xFF03FFFF. To +execute it copies itself out of there to RAM at 0x03E00000. RedBoot +reserves memory from 0x00000000 to 0x0001FFFF for its own use. +User programs can use memory from 0x00020000 to 0x03DFFFFF. +RAM based RedBoot configurations are +designed to run from RAM at 0x00020000. + + + + +Rebuilding RedBoot + + +The instructions in should be followed. The values for +TARGET, ARCH_DIR and PLATFORM_DIR on this platform are “frv400”, +“frv” and “frv400” respectively. The configuration export files +supplied in the hal/frv/frv400/VERSION/misc directory in the RedBoot +source tree should be used. In general only the ROMRAM variant should +need to be used. + + + + + + diff --git a/packages/redboot/current/doc/redboot_rebuilding.sgml b/packages/redboot/current/doc/redboot_rebuilding.sgml new file mode 100644 --- /dev/null +++ b/packages/redboot/current/doc/redboot_rebuilding.sgml @@ -0,0 +1,361 @@ + +Rebuilding RedBoot + +Introduction +rebuilding RedBoot +RedBootrebuildingIn +normal circumstances it is only necessary to rebuild RedBoot if it has been +modified, for example if you have extended the command set or applied patches. +See the Getting Started with eCos document, which provides +information about the portability and extendability of RedBoot in an eCos +environment. +Most platform HALs provide configuration export files. Before proceding +with the following procedures, see first, which may simplify the process +for your platform. + ecosconfigRedBoot is configured +and built using configuration technology based on Configuration Description +Language (CDL). The detailed instructions for building the command-line tool +ecosconfig on Linux can be found in host/README. For example: + mkdir $TEMP/redboot-build +cd $TEMP/redboot-build +$ECOSDIR/host/configure --prefix=$TEMP/redboot-build --with-tcl=/usr +make +The simplest version of RedBoot can be built by setting the +environment variable ECOS_REPOSITORY to point at the eCos/RedBoot source +tree, and then typing: +ecosconfig new TARGET redboot +ecosconfig tree +makewhere TARGET is the eCos name for the desired platform, +for example assabet. You will need to +have set the environment variable ECOS_REPOSITORY to point at the +eCos/RedBoot source tree. Values of TARGET for each board are given in the +specific installation details for each board in +. + + +The above command sequence would build a very simple version of +RedBoot, and would not include, for example, networking, FLASH or Compact Flash +Ethernet support on targets that supported those. Such features could +be included with the following commands: +ecosconfig new TARGET redboot +ecosconfig add flash +ecosconfig add pcmcia net_drivers cf_eth_drivers +ecosconfig tree +make +In practice, most platform HALs include configuration export files, +described in , to ensure that +the correct configuration of RedBoot +has been chosen to avoid needing to worry about which extra packages +to add. +The above commands would build a version of RedBoot +suitable for testing. In particular, the result will run from RAM. Since RedBoot +normally needs to be installed in ROM/flash, type the following: +cat >RedBoot_ROM.ecm <<EOF +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; +EOF +ecosconfig import RedBoot_ROM.ecm +ecosconfig tree +make +This set of commands will adjust the configuration to be ROM oriented. + +Each of these command sequences creates multiple versions of RedBoot +in different file formats. The choice of which file to use will depend upon +the actual target hardware and the tools available for programming ROM/flash. +The files produced (typically) are: +install/bin/redboot.elf This is the +complete version of RedBoot, represented in ELF format. It is most useful +for testing with tools such as embedded ICE, or other debug tools. +install/bin/redboot.srec This version +has been converted to Motorola S-record format. +install/bin/redboot.bin This version +has been flattened; that is, all formatting information removed and just the +raw image which needs to be placed in ROM/flash remains. +The details of putting the RedBoot code into ROM/flash are target specific. +Once complete, the system should come up with the RedBoot prompt. For example, +the version built using the commands above looks like: RedBoot(tm) debug environment [ROM] +Red Hat certified release, version R1.xx - built 07:54:25, Oct 16 2000 +Platform: Assabet development system (StrongARM 1110) +Copyright (C) 2000, Red Hat, Inc. +RAM: 0x00000000-0x02000000 +flash: 0x50000000 - 0x50400000, 32 blocks of 0x00020000 bytes ea. +Socket Communications, Inc: Low Power Ethernet CF Revision C +5V/3.3V 08/27/98 +IP: 192.168.1.29, Default server: 192.168.1.101 +RedBoot> + +Configuration export files +configuration export filesTo +help with rebuilding RedBoot from source, some platforms HALs provide configuration +export files. First locate the configuration export files for your platform +in the eCos source repository. The RAM and ROM startup configuration exports +can usually be found in a directory named "misc" in the platform HAL in the +eCos source repository, named: misc/redboot_RAM.ecm +misc/redboot_ROM.ecm + +Making RedBoot for RAM startup + +Throughout the following instructions, several environmental variables +are referred to: + +$REDBOOTDIR +Full path to the toplevel RedBoot source release. + +$BUILDDIR +Full path to where RedBoot will be built, +e.g. redboot.RAM. + +$ECOS_REPOSITORY +Full path to the RedBoot package source. Typically, this should +be $REDBOOTDIR/packages. + +$TARGET +e.g.atlas_mips32_4kc. +$ARCH_DIR +The directory for the architecture, e.g. mips. + +$PLATFORM_DIR +The directory for the platform, e.g. atlas. + +$VERSION +The version of the release, e.g. current. + +You must make sure these variables are correctly set in your environment +before proceeding, or the build will fail. The values for +$TARGET, $ARCH_DIR and +$PLATFORM_DIR for each board are given in the +specific installation details for each board +in . The value for +$VERSION is the name of the package subdirectories - +usually 'current' for sources checked out of CVS, or something like +'vX_Y' for a regular X.Y release. + +With the environment variables set, use the following sequence of commands to +build a RedBoot image suitable for loading into RAM: +$ mkdir $BUILDDIR +$ cd $BUILDDIR +$ ecosconfig new $TARGET redboot +$ ecosconfig import \ + ${ECOS_REPOSITORY}/hal/${ARCH_DIR}/${PLATFORM_DIR}/${VERSION}/misc/redboot_RAM.ecm +$ ecosconfig tree +$ make +To build a ROM or ROMRAM version, in a different build/config directory, just +use the configuration export file redboot_ROM.ecm +or redboot_ROMRAM.ecm instead. + +The resulting files will be, in each of the ROM, ROMRAM and RAM + startup build places: + $BUILDDIR/install/bin/redboot.bin + $BUILDDIR/install/bin/redboot.elf + $BUILDDIR/install/bin/redboot.img + $BUILDDIR/install/bin/redboot.srec +Some targets may have variations, or extra files generated in addition. + + +Platform specific instructions + +The platform specific information in +should be consulted, as there may be other special instructions +required to build RedBoot for particular boards. + + +Updating RedBoot + +Introduction +updating +RedBoot +RedBootupdatingRedBoot +normally resides in an EPROM or, more common these days, a flash +on the board. In the former case, updating RedBoot necessitates +physically removing the part and +reprogramming a new RedBoot image into it using prommer hardware. In +the latter case, it is often possible to update RedBoot in situ using +Redboot's flash management commands. The process of updating RedBoot +in situ is documented in +this section. + +The addresses and sizes included in the below are examples +only, and will differ from those you will see. This is normal and +should not cause concern. + + +Startup Modes + +While the RedBoot image which is used as the board's primary +boot monitor resides in flash, it may run from either flash (ROM mode) +or from RAM (ROMRAM mode). + +In ROM mode, RedBoot runs from flash memory, and the flash +commands cannot update the region of flash where the RedBoot image +resides. In order to update the RedBoot image, it is necessary to run +a different instance of RedBoot from RAM. + +In ROMRAM mode, the RedBoot image is copied to RAM when the +board is powered up or reset, and the code runs from there. The RAM +footprint is larger, but there are two advantages to make up for this: +it normally runs faster (relevant only on slower boards) and it is +able to update the flash region where the image originated +from. + +The following is a more detailed look at the necessary steps for +updating RedBoot in situ. For this process, it is assumed that the target is +connected to a host system and that there is a serial connection +giving access to the RedBoot CLI. For platforms with a ROMRAM +mode RedBoot, skip to . + + + +Load and start a RedBoot RAM instance +There are a number of choices here. The basic case is where a RAM +mode image has been stored in the FIS (flash Image System). To load and +execute this image, use the commands: +RedBoot> fis load RedBoot[RAM] +RedBoot> go +If this image is not available, or does not work, +then an alternate RAM mode image must be loaded: + +RedBoot> load redboot_RAM.img +Entry point: 0x060213c0, address range: 0x06020000-0x060369c8 +RedBoot> go + + +This command loads the RedBoot image using the TFTP +protocol via a network connection. Other methods of loading are +available, refer to the load command for more +details. + +If you expect to be doing this more than once, it is a +good idea to program the RAM mode image into the flash. You do this +using the fis create command after having +downloaded the RAM mode image, but before you start it. +Some platforms support locking (write protecting) certain regions of +the flash, while others do not. If your platform does not support +locking, simply ignore the fis unlock and +fis lock steps (the commands will not be +recognized by RedBoot). + + +RedBoot> fis unlock RedBoot[RAM] + ... Unlock from 0x00000000-0x00020000: .. +RedBoot> fis create RedBoot[RAM] +No memory address set. +Inferring base 0x06020000, length 0x20000, image size 0x169c8, entry 0x060213c0 + - continue (y/n)? y +An image named 'RedBoot[RAM]' exists - continue (y/n)? y +* CAUTION * about to program 'RedBoot[RAM]' + at 0x00020000..0x000369c7 from 0x06020000 - continue (y/n)?y +... Erase from 0x00020000-0x00040000: .. +... Program from 0x06020000-0x060369c8 at 0x00020000: .. +... Erase from 0x00070000-0x00080000: . +... Program from 0x0606f000-0x0607f000 at 0x00070000: . +RedBoot> fis lock RedBoot[RAM] + ... Lock from 0x00000000-0x00020000: .. + + + + + + +Update the primary RedBoot flash image An +instance of RedBoot should now be running on the target from RAM. This +can be verified by looking for the mode identifier in the banner. It +should be either [RAM] or [ROMRAM]. + +If this is the first time RedBoot is running on the board or if +the flash contents has been damaged, initialize the FIS directory: +RedBoot> fis init -f +About to initialize [format] FLASH image system - continue (y/n)? y +*** Initialize FLASH Image System +... Erase from 0x00020000-0x00070000: ..... +... Erase from 0x00080000-0x00080000: +... Erase from 0x00070000-0x00080000: . +... Program from 0x0606f000-0x0607f000 at 0x00070000: . + + + +It is important to understand that the presense of a correctly +initialized FIS directory allows RedBoot to automatically determine +the flash parameters. Additionally, executing the steps below as +stated without loading other data or using other flash commands (than +possibly fis list) allows RedBoot to automatically +determine the image location and size parameters. This greatly reduces +the risk of potential critical mistakes due to typographical errors. It is +still always possible to explicitly specify parameters, and indeed +override these, but it is not advised. + +Using the load command, download the +new flash based image from the host, relocating the image to RAM:: +RedBoot> load -r -b %{FREEMEMLO} redboot_ROM.bin +Raw file loaded 0x06046800-0x06062fe8, assumed entry at 0x06046800 + + +This command loads the RedBoot image using the TFTP +protocol via a network connection. Other methods of loading are +available, refer to the command for +more details. + +Note that the binary version of the image is being +downloaded. This is to ensure that the memory after the image is +loaded should match the contents of the file on the host. Loading SREC +or ELF versions of the image does not guarantee this since these +formats may contain holes, leaving bytes in these holes in an unknown +state after the load, and thus causing a likely cksum difference. It +is possible to use these, but then the step verifying the cksum below +may fail. + + +Once the image is loaded into RAM, it should be checksummed, +thus verifying that the image on the target is indeed the image +intended to be loaded, and that no corruption of the image has +happened. This is done using the +command: +RedBoot> cksum +Computing cksum for area 0x06046800-0x06062fe8 +POSIX cksum = 2535322412 116712 (0x971df32c 0x0001c7e8) + +Compare the numbers with those for the binary version of the image on +the host. If they do not match, try downloading the image again. + + +Assuming the cksum matches, the next step is programming the +image into flash using the FIS commands. + +Some platforms support locking (write protecting) certain +regions of the flash, while others do not. If your platform does not +support locking, simply ignore the fis unlock and +fis lock steps (the commands will not be recognized +by RedBoot). + +RedBoot> fis unlock RedBoot + ... Unlock from 0x00000000-0x00020000: .. +RedBoot> fis create RedBoot +Inferring base 0x06046800, length 0x20000, image size 0x1c7e8, entry 0x00000000 + - continue (y/n)? y +An image named 'RedBoot' exists - continue (y/n)? y +* CAUTION * about to program 'RedBoot' + at 0x00000000..0x0001c7e7 from 0x06046800 - continue (y/n)? y +... Erase from 0x00000000-0x00020000: .. +... Program from 0x06046800-0x06062fe8 at 0x00000000: .. +... Erase from 0x00070000-0x00080000: . +... Program from 0x0606f000-0x0607f000 at 0x00070000: . +RedBoot> fis lock RedBoot + ... Lock from 0x00000000-0x00020000: .. + + + + +Reboot; run the new RedBoot image +Once the image has been successfully written into the flash, simply +reset the target and the new version of RedBoot should be running. +When installing RedBoot for the first time, or after updating to +a newer RedBoot with different configuration keys, it is necessary to +update the configuration directory in the flash using the +fconfig command. See . + + + diff --git a/packages/redboot/current/include/elf.h b/packages/redboot/current/include/elf.h new file mode 100644 --- /dev/null +++ b/packages/redboot/current/include/elf.h @@ -0,0 +1,704 @@ +#ifndef CYGONCE_REDBOOT_ELF_H +#define CYGONCE_REDBOOT_ELF_H + +//========================================================================== +// +// elf.h +// +// ELF file format definitions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 2000-11-15 +// Purpose: Define ELF file format +// Description: The types defined here describe the ELF file format. +// +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//========================================================================== +// +// Quite a lot of this file was taken from the BSD exec_elf.h header file. +// Hence we should show you this... +// +/* $OpenBSD: exec_elf.h,v 1.20 1999/09/19 16:16:49 kstailey Exp $ */ +/* + * Copyright (c) 1995, 1996 Erik Theisen. 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 + +// ------------------------------------------------------------------------- +// Basic types: + +typedef cyg_uint32 Elf32_Addr; +typedef cyg_uint32 Elf32_Off; +typedef cyg_uint16 Elf32_Half; +typedef cyg_uint32 Elf32_Word; +typedef cyg_int32 Elf32_Sword; + +typedef cyg_uint64 Elf64_Addr; +typedef cyg_uint64 Elf64_Off; +typedef cyg_uint16 Elf64_Half; +typedef cyg_uint32 Elf64_Word; +typedef cyg_int32 Elf64_Sword; +typedef cyg_uint64 Elf64_Xword; +typedef cyg_int64 Elf64_Sxword; + +// ------------------------------------------------------------------------- +// ELF header + +#define EI_NIDENT 16 + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shtrndx; +} Elf32_Ehdr; + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shtrndx; +} Elf64_Ehdr; + +// ------------------------------------------------------------------------- +/* e_ident[] identification indexes */ + +#define EI_MAG0 0 /* file ID */ +#define EI_MAG1 1 /* file ID */ +#define EI_MAG2 2 /* file ID */ +#define EI_MAG3 3 /* file ID */ +#define EI_CLASS 4 /* file class */ +#define EI_DATA 5 /* data encoding */ +#define EI_VERSION 6 /* ELF header version */ +#define EI_OSABI 7 /* Operating system/ABI identification */ +#define EI_ABIVERSION 8 /* ABI version */ +#define EI_PAD 9 /* start of pad bytes */ + +// ------------------------------------------------------------------------- +/* e_ident[] magic number */ + +#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ +#define ELFMAG1 'E' /* e_ident[EI_MAG1] */ +#define ELFMAG2 'L' /* e_ident[EI_MAG2] */ +#define ELFMAG3 'F' /* e_ident[EI_MAG3] */ +#define ELFMAG "\177ELF" /* magic */ +#define SELFMAG 4 /* size of magic */ + +// ------------------------------------------------------------------------- +/* e_ident[] file class */ + +#define ELFCLASSNONE 0 /* invalid */ +#define ELFCLASS32 1 /* 32-bit objs */ +#define ELFCLASS64 2 /* 64-bit objs */ +#define ELFCLASSNUM 3 /* number of classes */ + +// ------------------------------------------------------------------------- +/* e_ident[] data encoding */ + +#define ELFDATANONE 0 /* invalid */ +#define ELFDATA2LSB 1 /* Little-Endian */ +#define ELFDATA2MSB 2 /* Big-Endian */ +#define ELFDATANUM 3 /* number of data encode defines */ + +// ------------------------------------------------------------------------- +/* e_ident */ + +#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ + (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ + (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ + (ehdr).e_ident[EI_MAG3] == ELFMAG3) + +// ------------------------------------------------------------------------- +/* e_type */ + +#define ET_NONE 0 /* No file type */ +#define ET_REL 1 /* relocatable file */ +#define ET_EXEC 2 /* executable file */ +#define ET_DYN 3 /* shared object file */ +#define ET_CORE 4 /* core file */ +#define ET_NUM 5 /* number of types */ +#define ET_LOOS 0xfe00 /* Operating system-specific */ +#define ET_HIOS 0xfeff /* Operating system-specific */ +#define ET_LOPROC 0xff00 /* reserved range for processor */ +#define ET_HIPROC 0xffff /* specific e_type */ + +// ------------------------------------------------------------------------- +/* e_machine */ +// The following values taken from 22 June 2000 SysV ABI spec, updated with +// extra values from binutils elf/common.h. + +#define EM_NONE 0 // No machine +#define EM_M32 1 // AT&T WE 32100 +#define EM_SPARC 2 // SPARC +#define EM_386 3 // Intel 80386 +#define EM_68K 4 // Motorola 68000 +#define EM_88K 5 // Motorola 88000 +#define EM_860 7 // Intel 80860 +#define EM_MIPS 8 // MIPS I Architecture +#define EM_S370 9 // IBM System/370 Processor +#define EM_MIPS_RS3_LE 10 // MIPS RS3000 Little-endian +#define EM_PARISC 15 // Hewlett-Packard PA-RISC +#define EM_VPP500 17 // Fujitsu VPP500 +#define EM_SPARC32PLUS 18 // Enhanced instruction set SPARC +#define EM_960 19 // Intel 80960 +#define EM_PPC 20 // PowerPC +#define EM_PPC64 21 // 64-bit PowerPC +#define EM_V800 36 // NEC V800 +#define EM_FR20 37 // Fujitsu FR20 +#define EM_RH32 38 // TRW RH-32 +#define EM_RCE 39 // Motorola RCE +#define EM_ARM 40 // Advanced RISC Machines ARM +#define EM_ALPHA 41 // Digital Alpha +#define EM_SH 42 // Hitachi SH +#define EM_SPARCV9 43 // SPARC Version 9 +#define EM_TRICORE 44 // Siemens Tricore embedded processor +#define EM_ARC 45 // Argonaut RISC Core, Argonaut Technologies Inc. +#define EM_H8_300 46 // Hitachi H8/300 +#define EM_H8_300H 47 // Hitachi H8/300H +#define EM_H8S 48 // Hitachi H8S +#define EM_H8_500 49 // Hitachi H8/500 +#define EM_IA_64 50 // Intel IA-64 processor architecture +#define EM_MIPS_X 51 // Stanford MIPS-X +#define EM_COLDFIRE 52 // Motorola ColdFire +#define EM_68HC12 53 // Motorola M68HC12 +#define EM_MMA 54 // Fujitsu MMA Multimedia Accelerator +#define EM_PCP 55 // Siemens PCP +#define EM_NCPU 56 // Sony nCPU embedded RISC processor +#define EM_NDR1 57 // Denso NDR1 microprocessor +#define EM_STARCORE 58 // Motorola Star*Core processor +#define EM_ME16 59 // Toyota ME16 processor +#define EM_ST100 60 // STMicroelectronics ST100 processor +#define EM_TINYJ 61 // Advanced Logic Corp. TinyJ embedded processor family +#define EM_FX66 66 // Siemens FX66 microcontroller +#define EM_ST9PLUS 67 // STMicroelectronics ST9+ 8/16 bit microcontroller +#define EM_ST7 68 // STMicroelectronics ST7 8-bit microcontroller +#define EM_68HC16 69 // Motorola MC68HC16 Microcontroller +#define EM_68HC11 70 // Motorola MC68HC11 Microcontroller +#define EM_68HC08 71 // Motorola MC68HC08 Microcontroller +#define EM_68HC05 72 // Motorola MC68HC05 Microcontroller +#define EM_SVX 73 // Silicon Graphics SVx +#define EM_ST19 74 // STMicroelectronics ST19 8-bit microcontroller +#define EM_VAX 75 // Digital VAX +#define EM_CRIS 76 // Axis Communications 32-bit embedded processor +#define EM_JAVELIN 77 // Infineon Technologies 32-bit embedded processor +#define EM_FIREPATH 78 // Element 14 64-bit DSP Processor +#define EM_ZSP 79 // LSI Logic 16-bit DSP Processor +#define EM_MMIX 80 // Donald Knuth's educational 64-bit processor +#define EM_HUANY 81 // Harvard University machine-independent object files +#define EM_PRISM 82 // SiTera Prism + +/* Cygnus PowerPC ELF backend. Written in the absence of an ABI. */ +#define EM_CYGNUS_POWERPC 0x9025 + +/* Old version of Sparc v9, from before the ABI; this should be + removed shortly. */ +#define EM_OLD_SPARCV9 11 + +/* Old version of PowerPC, this should be removed shortly. */ +#define EM_PPC_OLD 17 + +/* Cygnus ARC ELF backend. Written in the absence of an ABI. */ +#define EM_CYGNUS_ARC 0x9040 + +/* Cygnus M32R ELF backend. Written in the absence of an ABI. */ +#define EM_CYGNUS_M32R 0x9041 + +/* Alpha backend magic number. Written in the absence of an ABI. */ +//#define EM_ALPHA 0x9026 + +/* D10V backend magic number. Written in the absence of an ABI. */ +#define EM_CYGNUS_D10V 0x7650 + +/* D30V backend magic number. Written in the absence of an ABI. */ +#define EM_CYGNUS_D30V 0x7676 + +/* V850 backend magic number. Written in the absense of an ABI. */ +#define EM_CYGNUS_V850 0x9080 + +/* mn10200 and mn10300 backend magic numbers. + Written in the absense of an ABI. */ +#define EM_CYGNUS_MN10200 0xdead +#define EM_CYGNUS_MN10300 0xbeef + +/* FR30 magic number - no EABI available. */ +#define EM_CYGNUS_FR30 0x3330 + +/* AVR magic number + Written in the absense of an ABI. */ +#define EM_AVR 0x1057 + +// ------------------------------------------------------------------------- +/* Version */ + +#define EV_NONE 0 /* Invalid */ +#define EV_CURRENT 1 /* Current */ +#define EV_NUM 2 /* number of versions */ + +// ------------------------------------------------------------------------- +/* Section Header */ + +typedef struct { + Elf32_Word sh_name; /* name - index into section header + string table section */ + Elf32_Word sh_type; /* type */ + Elf32_Word sh_flags; /* flags */ + Elf32_Addr sh_addr; /* address */ + Elf32_Off sh_offset; /* file offset */ + Elf32_Word sh_size; /* section size */ + Elf32_Word sh_link; /* section header table index link */ + Elf32_Word sh_info; /* extra information */ + Elf32_Word sh_addralign; /* address alignment */ + Elf32_Word sh_entsize; /* section entry size */ +} Elf32_Shdr; + +typedef struct { + Elf64_Word sh_name; /* section name */ + Elf64_Word sh_type; /* section type */ + Elf64_Xword sh_flags; /* section flags */ + Elf64_Addr sh_addr; /* virtual address */ + Elf64_Off sh_offset; /* file offset */ + Elf64_Xword sh_size; /* section size */ + Elf64_Word sh_link; /* link to another */ + Elf64_Word sh_info; /* misc info */ + Elf64_Xword sh_addralign; /* memory alignment */ + Elf64_Xword sh_entsize; /* table entry size */ +} Elf64_Shdr; + +// ------------------------------------------------------------------------- +/* Special Section Indexes */ + +#define SHN_UNDEF 0 /* undefined */ +#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ +#define SHN_LOPROC 0xff00 /* reserved range for processor */ +#define SHN_HIPROC 0xff1f /* specific section indexes */ +#define SHN_LOOS 0xff20 /* reserved range for operating */ +#define SHN_HIOS 0xff3f /* system specific section indexes */ +#define SHN_ABS 0xfff1 /* absolute value */ +#define SHN_COMMON 0xfff2 /* common symbol */ +#define SHN_XINDEX 0xffff /* escape value for oversize index */ +#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ + +// ------------------------------------------------------------------------- +/* sh_type */ + +#define SHT_NULL 0 /* inactive */ +#define SHT_PROGBITS 1 /* program defined information */ +#define SHT_SYMTAB 2 /* symbol table section */ +#define SHT_STRTAB 3 /* string table section */ +#define SHT_RELA 4 /* relocation section with addends*/ +#define SHT_HASH 5 /* symbol hash table section */ +#define SHT_DYNAMIC 6 /* dynamic section */ +#define SHT_NOTE 7 /* note section */ +#define SHT_NOBITS 8 /* no space section */ +#define SHT_REL 9 /* relation section without addends */ +#define SHT_SHLIB 10 /* reserved - purpose unknown */ +#define SHT_DYNSYM 11 /* dynamic symbol table section */ +#define SHT_INIT_ARRAY 14 /* init procedure array */ +#define SHT_FINI_ARRAY 15 /* fini procedure array */ +#define SHT_PREINIT_ARRAY 16 /* preinit procedure array */ +#define SHT_GROUP 17 /* section group */ +#define SHT_SYMTAB_SHNDX 18 /* oversize index table */ +#define SHT_NUM 19 /* number of section types */ +#define SHT_LOOS 0x60000000 /* reserved range for O/S */ +#define SHT_HIOS 0x6fffffff /* specific section header types */ +#define SHT_LOPROC 0x70000000 /* reserved range for processor */ +#define SHT_HIPROC 0x7fffffff /* specific section header types */ +#define SHT_LOUSER 0x80000000 /* reserved range for application */ +#define SHT_HIUSER 0xffffffff /* specific indexes */ + +// ------------------------------------------------------------------------- +/* Section names */ + +#define ELF_BSS ".bss" /* uninitialized data */ +#define ELF_DATA ".data" /* initialized data */ +#define ELF_DEBUG ".debug" /* debug */ +#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ +#define ELF_DYNSTR ".dynstr" /* dynamic string table */ +#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ +#define ELF_FINI ".fini" /* termination code */ +#define ELF_GOT ".got" /* global offset table */ +#define ELF_HASH ".hash" /* symbol hash table */ +#define ELF_INIT ".init" /* initialization code */ +#define ELF_REL_DATA ".rel.data" /* relocation data */ +#define ELF_REL_FINI ".rel.fini" /* relocation termination code */ +#define ELF_REL_INIT ".rel.init" /* relocation initialization code */ +#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ +#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ +#define ELF_REL_TEXT ".rel.text" /* relocation code */ +#define ELF_RODATA ".rodata" /* read-only data */ +#define ELF_SHSTRTAB ".shstrtab" /* section header string table */ +#define ELF_STRTAB ".strtab" /* string table */ +#define ELF_SYMTAB ".symtab" /* symbol table */ +#define ELF_TEXT ".text" /* code */ + +// ------------------------------------------------------------------------- +/* Section Attribute Flags - sh_flags */ + +#define SHF_WRITE 0x001 /* Writable */ +#define SHF_ALLOC 0x002 /* occupies memory */ +#define SHF_EXECINSTR 0x004 /* executable */ +#define SHF_MERGE 0x010 /* merge data */ +#define SHF_STRINGS 0x020 /* contains strings */ +#define SHF_INFO_LINK 0x040 /* link in sh_info field */ +#define SHF_LINK_ORDER 0x080 /* preserve link order */ +#define SHF_OS_NONCONFORMING 0x100 /* special OS-specific */ + /* processing needed */ +#define SHF_GROUP 0x200 /* member of group */ +#define SHF_MASKOS 0x0ff00000 /* reserved bits for OS */ + /* specific section attributes */ +#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ + /* specific section attributes */ + +// ------------------------------------------------------------------------- +/* Symbol Table Entry */ + +typedef struct { + Elf32_Word st_name; /* name - index into string table */ + Elf32_Addr st_value; /* symbol value */ + Elf32_Word st_size; /* symbol size */ + unsigned char st_info; /* type and binding */ + unsigned char st_other; /* visibility */ + Elf32_Half st_shndx; /* section header index */ +} Elf32_Sym; + +typedef struct { + Elf64_Word st_name; /* Symbol name index in str table */ + unsigned char st_info; /* type / binding attrs */ + unsigned char st_other; /* visibility */ + Elf64_Half st_shndx; /* section index of symbol */ + Elf64_Addr st_value; /* value of symbol */ + Elf64_Xword st_size; /* size of symbol */ +} Elf64_Sym; + +// ------------------------------------------------------------------------- +/* Symbol table index */ + +#define STN_UNDEF 0 /* undefined */ + +/* Extract symbol info - st_info */ +#define ELF32_ST_BIND(x) ((x) >> 4) +#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) +#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) + +#define ELF64_ST_BIND(x) ((x) >> 4) +#define ELF64_ST_TYPE(x) (((unsigned int) x) & 0xf) +#define ELF64_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) + +#define ELF32_ST_VISIBILITY(o) ((o)&0x3) +#define ELF64_ST_VISIBILITY(o) ((o)&0x3) + +// ------------------------------------------------------------------------- +/* Symbol Binding - ELF32_ST_BIND - st_info */ + +#define STB_LOCAL 0 /* Local symbol */ +#define STB_GLOBAL 1 /* Global symbol */ +#define STB_WEAK 2 /* like global - lower precedence */ +#define STB_NUM 3 /* number of symbol bindings */ +#define STB_LOOS 10 /* reserved range for OS */ +#define STB_HIOS 12 /* specific symbol bindings */ +#define STB_LOPROC 13 /* reserved range for processor */ +#define STB_HIPROC 15 /* specific symbol bindings */ + +// ------------------------------------------------------------------------- +/* Symbol type - ELF32_ST_TYPE - st_info */ + +#define STT_NOTYPE 0 /* not specified */ +#define STT_OBJECT 1 /* data object */ +#define STT_FUNC 2 /* function */ +#define STT_SECTION 3 /* section */ +#define STT_FILE 4 /* file */ +#define STT_COMMON 5 /* common block */ +#define STT_NUM 6 /* number of symbol types */ +#define STT_LOOS 10 /* reserved range for OS */ +#define STT_HIOS 12 /* specific symbol types */ +#define STT_LOPROC 13 /* reserved range for processor */ +#define STT_HIPROC 15 /* specific symbol types */ + +// ------------------------------------------------------------------------- +// symbol visibility in st_other + +#define STV_DEFAULT 0 /* default to binding type */ +#define STV_INTERNAL 1 /* processor specific */ +#define STV_HIDDEN 2 /* invisible */ +#define STV_PROTECTED 3 /* non-premptable */ + +// ------------------------------------------------------------------------- +// 32 bit relocation records + +/* Relocation entry with implicit addend */ +typedef struct +{ + Elf32_Addr r_offset; /* offset of relocation */ + Elf32_Word r_info; /* symbol table index and type */ +} Elf32_Rel; + +/* Relocation entry with explicit addend */ +typedef struct +{ + Elf32_Addr r_offset; /* offset of relocation */ + Elf32_Word r_info; /* symbol table index and type */ + Elf32_Sword r_addend; +} Elf32_Rela; + +/* Extract relocation info - r_info */ +#define ELF32_R_SYM(i) ((i) >> 8) +#define ELF32_R_TYPE(i) ((unsigned char) (i)) +#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) + +// ------------------------------------------------------------------------- +// 64 bit equivalents of above structures and macros. + +typedef struct { + Elf64_Addr r_offset; /* where to do it */ + Elf64_Xword r_info; /* index & type of relocation */ +} Elf64_Rel; + +typedef struct { + Elf64_Addr r_offset; /* where to do it */ + Elf64_Xword r_info; /* index & type of relocation */ + Elf64_Sxword r_addend; /* adjustment value */ +} Elf64_RelA; + +#define ELF64_R_SYM(info) ((info) >> 32) +#define ELF64_R_TYPE(info) ((info) & 0xFFFFFFFF) +#define ELF64_R_INFO(s,t) (((s) << 32) + (u_int32_t)(t)) + +// ------------------------------------------------------------------------- +/* Program Header */ + +typedef struct { + Elf32_Word p_type; /* segment type */ + Elf32_Off p_offset; /* segment offset */ + Elf32_Addr p_vaddr; /* virtual address of segment */ + Elf32_Addr p_paddr; /* physical address - ignored? */ + Elf32_Word p_filesz; /* number of bytes in file for seg. */ + Elf32_Word p_memsz; /* number of bytes in mem. for seg. */ + Elf32_Word p_flags; /* flags */ + Elf32_Word p_align; /* memory alignment */ +} Elf32_Phdr; + +typedef struct { + Elf64_Word p_type; /* entry type */ + Elf64_Word p_flags; /* flags */ + Elf64_Off p_offset; /* offset */ + Elf64_Addr p_vaddr; /* virtual address */ + Elf64_Addr p_paddr; /* physical address */ + Elf64_Xword p_filesz; /* file size */ + Elf64_Xword p_memsz; /* memory size */ + Elf64_Xword p_align; /* memory & file alignment */ +} Elf64_Phdr; + +// ------------------------------------------------------------------------- +/* Segment types - p_type */ + +#define PT_NULL 0 /* unused */ +#define PT_LOAD 1 /* loadable segment */ +#define PT_DYNAMIC 2 /* dynamic linking section */ +#define PT_INTERP 3 /* the RTLD */ +#define PT_NOTE 4 /* auxiliary information */ +#define PT_SHLIB 5 /* reserved - purpose undefined */ +#define PT_PHDR 6 /* program header */ +#define PT_NUM 7 /* Number of segment types */ +#define PT_LOOS 0x60000000 /* reserved range for OS */ +#define PT_HIOS 0x6fffffff /* specific segment types */ +#define PT_LOPROC 0x70000000 /* reserved range for processor */ +#define PT_HIPROC 0x7fffffff /* specific segment types */ + +// ------------------------------------------------------------------------- +/* Segment flags - p_flags */ + +#define PF_X 0x1 /* Executable */ +#define PF_W 0x2 /* Writable */ +#define PF_R 0x4 /* Readable */ +#define PF_MASKOS 0x0ff00000 /* reserved bits for OS */ + /* specific segment flags */ +#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ + /* specific segment flags */ + +// ------------------------------------------------------------------------- +/* Dynamic structure */ + +typedef struct { + Elf32_Sword d_tag; /* controls meaning of d_val */ + union { + Elf32_Word d_val; /* Multiple meanings - see d_tag */ + Elf32_Addr d_ptr; /* program virtual address */ + } d_un; +} Elf32_Dyn; + +extern Elf32_Dyn _DYNAMIC[]; /* XXX not 64-bit clean */ + +typedef struct { + Elf64_Sxword d_tag; /* controls meaning of d_val */ + union { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; +} Elf64_Dyn; + +// ------------------------------------------------------------------------- +/* Dynamic Array Tags - d_tag */ + +#define DT_NULL 0 /* marks end of _DYNAMIC array */ +#define DT_NEEDED 1 /* string table offset of needed lib */ +#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */ +#define DT_PLTGOT 3 /* address PLT/GOT */ +#define DT_HASH 4 /* address of symbol hash table */ +#define DT_STRTAB 5 /* address of string table */ +#define DT_SYMTAB 6 /* address of symbol table */ +#define DT_RELA 7 /* address of relocation table */ +#define DT_RELASZ 8 /* size of relocation table */ +#define DT_RELAENT 9 /* size of relocation entry */ +#define DT_STRSZ 10 /* size of string table */ +#define DT_SYMENT 11 /* size of symbol table entry */ +#define DT_INIT 12 /* address of initialization func. */ +#define DT_FINI 13 /* address of termination function */ +#define DT_SONAME 14 /* string table offset of shared obj */ +#define DT_RPATH 15 /* string table offset of library + search path */ +#define DT_SYMBOLIC 16 /* start sym search in shared obj. */ +#define DT_REL 17 /* address of rel. tbl. w addends */ +#define DT_RELSZ 18 /* size of DT_REL relocation table */ +#define DT_RELENT 19 /* size of DT_REL relocation entry */ +#define DT_PLTREL 20 /* PLT referenced relocation entry */ +#define DT_DEBUG 21 /* bugger */ +#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ +#define DT_JMPREL 23 /* add. of PLT's relocation entries */ +#define DT_BIND_NOW 24 /* Bind now regardless of env setting */ +#define DT_INIT_ARRAY 25 /* init array address */ +#define DT_FINI_ARRAY 26 /* fini array address */ +#define DT_INIT_ARRAYSZ 27 /* init array size */ +#define DT_FINI_ARRAYSZ 28 /* fini array size */ +#define DT_RUNPATH 29 /* library search path */ +#define DT_FLAGS 30 /* flags */ +#define DT_ENCODING 32 /* encoding rules start here */ +#define DT_PREINIT_ARRAY 32 /* preinit array address */ +#define DT_PREINIT_ARRAYSZ 33 /* preinit array size */ +#define DT_NUM 26 /* Number used. */ +#define DT_LOOS 0x60000000 /* reserved range for OS */ +#define DT_HIOS 0x6fffffff /* specific dynamic array tags */ +#define DT_LOPROC 0x70000000 /* reserved range for processor */ +#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ + +// ------------------------------------------------------------------------- +// Values for DT_FLAGS entry + +#define DF_ORIGIN 0x1 /* Uses $ORIGIN substitution string */ +#define DF_SYMBOLIC 0x2 /* search for symbols here first */ +#define DF_TEXTREL 0x4 /* text may be relocatable */ +#define DF_BIND_NOW 0x8 /* bind references now, dammit */ + +// ------------------------------------------------------------------------- +/* Note Definitions */ + +typedef struct { + Elf32_Word namesz; + Elf32_Word descsz; + Elf32_Word type; +} Elf32_Note; + +typedef struct { + Elf64_Word namesz; + Elf64_Word descsz; + Elf64_Word type; +} Elf64_Note; + +// ------------------------------------------------------------------------- +// Hash table structure +// The same structure is used by both 32 and 64 bit formats + +typedef struct { + Elf32_Word nbucket; /* number of buckets */ + Elf32_Word nchain; /* number of chains */ + + /* The buckets follow this structure in memory and the chains + follow those. */ +} Elf_Hash; + +// ------------------------------------------------------------------------- +#endif // ifndef CYGONCE_REDBOOT_ELF_H +// EOF elf.h diff --git a/packages/redboot/current/include/fis.h b/packages/redboot/current/include/fis.h --- a/packages/redboot/current/include/fis.h +++ b/packages/redboot/current/include/fis.h @@ -7,29 +7,38 @@ // RedBoot - FLASH image directory layout // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -57,6 +66,6 @@ struct fis_image_desc { unsigned long file_cksum; // Checksum over image data }; -struct fis_image_desc *fis_lookup(char *name); +struct fis_image_desc *fis_lookup(char *name, int *num); #endif // _FIS_H_ diff --git a/packages/redboot/current/include/flash_config.h b/packages/redboot/current/include/flash_config.h --- a/packages/redboot/current/include/flash_config.h +++ b/packages/redboot/current/include/flash_config.h @@ -5,29 +5,38 @@ // Flash configuration data tables for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/include/fs/disk.h b/packages/redboot/current/include/fs/disk.h --- a/packages/redboot/current/include/fs/disk.h +++ b/packages/redboot/current/include/fs/disk.h @@ -5,29 +5,38 @@ // Stand-alone disk support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/include/fs/e2fs.h b/packages/redboot/current/include/fs/e2fs.h --- a/packages/redboot/current/include/fs/e2fs.h +++ b/packages/redboot/current/include/fs/e2fs.h @@ -5,29 +5,38 @@ // Second extended filesystem defines. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/include/fs/ide.h b/packages/redboot/current/include/fs/ide.h --- a/packages/redboot/current/include/fs/ide.h +++ b/packages/redboot/current/include/fs/ide.h @@ -5,29 +5,38 @@ // IDE Interface Driver Tables for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/include/net/bootp.h b/packages/redboot/current/include/net/bootp.h --- a/packages/redboot/current/include/net/bootp.h +++ b/packages/redboot/current/include/net/bootp.h @@ -5,29 +5,38 @@ // Stand-alone BOOTP support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/include/net/net.h b/packages/redboot/current/include/net/net.h --- a/packages/redboot/current/include/net/net.h +++ b/packages/redboot/current/include/net/net.h @@ -5,29 +5,38 @@ // Stand-alone networking support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -326,13 +335,12 @@ typedef struct _tcp_socket { word our_port; word his_port; word data_bytes; /* number of data bytes in pkt */ + char reuse; /* SO_REUSEADDR, no 2MSL */ timer_t timer; pktbuf_t pkt; /* dedicated xmit packet */ pktbuf_t *rxlist; /* list of unread incoming data packets */ char *rxptr; /* pointer to next byte to read */ int rxcnt; /* bytes left in current read packet */ - word ack_pending; /* true if outgoing ack is deferred while - awaiting incoming ack */ dword ack; dword seq; char pktbuf[ETH_MAX_PKTLEN]; @@ -502,6 +510,10 @@ extern void __tcp_poll(void); */ extern int __tcp_listen(tcp_socket_t *s, word port); +/* + * SO_REUSEADDR, no 2MSL. + */ +extern void __tcp_so_reuseaddr(tcp_socket_t *s); /* * Block while waiting for all outstanding socket data to diff --git a/packages/redboot/current/include/net/tftp.h b/packages/redboot/current/include/net/tftp.h --- a/packages/redboot/current/include/net/tftp.h +++ b/packages/redboot/current/include/net/tftp.h @@ -5,29 +5,38 @@ // Stand-alone TFTP support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/redboot/current/include/net/tftp_support.h b/packages/redboot/current/include/net/tftp_support.h --- a/packages/redboot/current/include/net/tftp_support.h +++ b/packages/redboot/current/include/net/tftp_support.h @@ -5,29 +5,38 @@ // Stand-alone TFTP support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/include/redboot.h b/packages/redboot/current/include/redboot.h --- a/packages/redboot/current/include/redboot.h +++ b/packages/redboot/current/include/redboot.h @@ -5,29 +5,38 @@ // Standard interfaces for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -113,9 +122,7 @@ externC int strncasecmp(const char *s1, externC void mon_write_char(char c); externC bool verify_action(char *fmt, ...); -//void dump_buf(void *, CYG_ADDRWORD); -//void dump_buf_with_offset(void *, CYG_ADDRWORD, void *); -//void vdump_buf_with_offset(_printf_fun *pf, void *, CYG_ADDRWORD, void *); +externC bool verify_action_with_timeout(int timeout, char *fmt, ...); // Read a single line of input from the console, possibly with timeout externC int _rb_gets(char *line, int len, int timeout); @@ -136,6 +143,15 @@ externC void end_console(int old_console unsigned short crc16(unsigned char *buf, int len); unsigned long crc32(unsigned char *buf, int len); +// Alias functions +#ifdef CYGSEM_REDBOOT_FLASH_ALIASES +externC char *flash_lookup_alias(char *alias, char *alias_buf); +#endif +externC void expand_aliases(char *line, int len); + +typedef int (*getc_t)(void); +typedef void (*terminate_t)(int method, getc_t get_c); + #ifdef CYGPKG_COMPRESS_ZLIB // Decompression support typedef struct _pipe { @@ -143,6 +159,7 @@ typedef struct _pipe { int in_avail; // only changed by producer unsigned char* out_buf; // only changed by consumer (init by producer) int out_size; // only changed by consumer (init by producer) + int out_max; // set by producer const char* msg; // message from consumer void* priv; // handler's data } _pipe_t; @@ -166,17 +183,19 @@ struct cmd { char *help; char *usage; cmd_fun *fun; + struct cmd *sub_cmds, *sub_cmds_end; } CYG_HAL_TABLE_TYPE; externC struct cmd *cmd_search(struct cmd *tab, struct cmd *tabend, char *arg); externC void cmd_usage(struct cmd *tab, struct cmd *tabend, char *prefix); -#define RedBoot_cmd(_s_,_h_,_u_,_f_) cmd_entry(_s_,_h_,_u_,_f_,RedBoot_commands) -#define _cmd_entry(_s_,_h_,_u_,_f_,_n_) \ +#define RedBoot_cmd(_s_,_h_,_u_,_f_) cmd_entry(_s_,_h_,_u_,_f_,0,0,RedBoot_commands) +#define RedBoot_nested_cmd(_s_,_h_,_u_,_f_,_subs_,_sube_) cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,RedBoot_commands) +#define _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) \ cmd_fun _f_; \ -struct cmd _cmd_tab_##_f_ CYG_HAL_TABLE_QUALIFIED_ENTRY(_n_,_f_) = {_s_, _h_, _u_, _f_}; -#define cmd_entry(_s_,_h_,_u_,_f_,_n_) \ -extern _cmd_entry(_s_,_h_,_u_,_f_,_n_) +struct cmd _cmd_tab_##_f_ CYG_HAL_TABLE_QUALIFIED_ENTRY(_n_,_f_) = {_s_, _h_, _u_, _f_, _subs_, _sube_}; +#define cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) \ +extern _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) #define local_cmd_entry(_s_,_h_,_u_,_f_,_n_) \ -static _cmd_entry(_s_,_h_,_u_,_f_,_n_) +static _cmd_entry(_s_,_h_,_u_,_f_,0,0,_n_) // Initialization functions #define RedBoot_INIT_FIRST 0000 @@ -238,18 +257,10 @@ externC bool scan_opts(int argc, char *a void **def_arg, int def_arg_type, char *def_descr); externC int redboot_getc(void); -externC void redboot_getc_init(int (*fun)(char *, int, int *), int verbose); +externC void redboot_getc_init(int (*fun)(char *, int, int *), + int verbose, int decompress); externC void redboot_getc_rewind(void); - -#define BUF_SIZE 256 -typedef struct { - int (*fun)(char *, int len, int *err); - unsigned char buf[BUF_SIZE]; - unsigned char *bufp; - int avail, len, err; - int verbose, tick; -} getc_info_t; - +externC void redboot_getc_close(void); #ifdef CYGNUM_HAL_VIRTUAL_VECTOR_AUX_CHANNELS #define CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS \ @@ -278,6 +289,8 @@ struct hostent { #define h_addr h_addr_list[0] /* for backward compatibility */ externC int redboot_dns_res_init(void); +externC void set_dns(char* new_ip); +externC void show_dns(void); externC struct hostent *gethostbyname(const char *host); // Error reporting @@ -372,4 +385,53 @@ isalnum(int c) return (isalpha(c) || isdigit(c)); } +//---------------------------------------------------------------------------- +// syscall values +#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) + +// These are required by the ANSI C part of newlib (excluding system() of +// course). +#define SYS_exit 1 +#define SYS_open 2 +#define SYS_close 3 +#define SYS_read 4 +#define SYS_write 5 +#define SYS_lseek 6 +#define SYS_unlink 7 +#define SYS_getpid 8 +#define SYS_kill 9 +#define SYS_fstat 10 +//#define SYS_sbrk 11 - not currently a system call, but reserved. + +// ARGV support. +#define SYS_argvlen 12 +#define SYS_argv 13 + +// These are extras added for one reason or another. +#define SYS_chdir 14 +#define SYS_stat 15 +#define SYS_chmod 16 +#define SYS_utime 17 +#define SYS_time 18 +#define SYS_gettimeofday 19 +#define SYS_times 20 + +#define SYS_interrupt 1000 +#define SYS_meminfo 1001 + +#define __GET_SHARED 0xbaad // 47789 decimal + +#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF + +#define SYS_timer_call_back 2001 +#define SYS_timer_frequency 2002 +#define SYS_timer_reset 2003 + +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF +#define SYS_rename 3001 +#define SYS_isatty 3002 +#define SYS_system 3003 + +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS + #endif // _REDBOOT_H_ diff --git a/packages/redboot/current/include/sib.h b/packages/redboot/current/include/sib.h --- a/packages/redboot/current/include/sib.h +++ b/packages/redboot/current/include/sib.h @@ -7,29 +7,38 @@ // RedBoot - structure of ARM flash file format // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/misc/redboot_XXX.ecm b/packages/redboot/current/misc/redboot_XXX.ecm --- a/packages/redboot/current/misc/redboot_XXX.ecm +++ b/packages/redboot/current/misc/redboot_XXX.ecm @@ -8,8 +8,13 @@ cdl_savefile_command cdl_option { value_ cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; cdl_configuration eCos { + package -template CYGPKG_NS_DNS current ; package -template CYGPKG_COMPRESS_ZLIB current ; package -template CYGPKG_IO_FLASH current; package -template CYGPKG_IO_ETH_DRIVERS current; }; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; diff --git a/packages/redboot/current/src/alias.c b/packages/redboot/current/src/alias.c new file mode 100644 --- /dev/null +++ b/packages/redboot/current/src/alias.c @@ -0,0 +1,173 @@ +//========================================================================== +// +// alias.c +// +// RedBoot - alias support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Date: 2002-05-15 +// Purpose: +// Description: +// +// This code is part of RedBoot (tm). +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#ifdef CYGNUM_REDBOOT_FLASH_STRING_SIZE +# define MAX_STRING_LENGTH CYGNUM_REDBOOT_FLASH_STRING_SIZE +#else +# define MAX_STRING_LENGTH 32 +#endif + +// Lookup an alias. First try plain string aliases. If that fails try +// other types so allowing access to all configured values. This allows +// for alias (macro) expansion of normal 'fconfig' data, such as the +// board IP address. +static char * +lookup_alias(char *alias, char *alias_buf) +{ + if (0 == strcasecmp("FREEMEMLO", alias)) { + diag_sprintf(alias_buf,"%p", ((CYG_ADDRWORD)user_ram_start + 0x03ff) & ~0x03ff); + return alias_buf; + } else if (0 == strcasecmp("FREEMEMHI", alias)) { + diag_sprintf(alias_buf,"%p", ((CYG_ADDRWORD)user_ram_end - 0x03ff) & ~0x03ff); + return alias_buf; + } + +#ifdef CYGSEM_REDBOOT_FLASH_ALIASES + return flash_lookup_alias(alias, alias_buf); +#else + return NULL; +#endif +} + +// Expand aliases, this is recursive. ie if one alias contains other +// aliases, these will also be expanded from the insertion point +// onwards. +// +// If 'iter' is zero, then quoted strings are not expanded +// +static bool +_expand_aliases(char *line, int len, int iter) +{ + char *lp = line; + char *ms, *me, *ep; + char *alias; + char c; + int offset, line_len, alias_len; + char alias_buf[MAX_STRING_LENGTH]; + bool macro_found = false; + + if ((line_len = strlen(line)) != 0) { + while (*lp) { + c = *lp++; + if ((c == '%') && (*lp == '{')) { + // Found a macro/alias to expand + ms = lp+1; + lp += 2; + while (*lp && (*lp != '}')) lp++; + if (!*lp) { + diag_printf("Invalid macro/alias '%s'\n", ms); + line[0] = '\0'; // Destroy line + return false; + } + me = lp; + *me = '\0'; + lp++; + if ((alias = lookup_alias(ms,alias_buf)) != (char *)NULL) { + alias_len = strlen(alias); + // See if there is room in the line to expand this macro/alias + if ((line_len+alias_len) < len) { + // Make a hole by moving data within the line + offset = alias_len-strlen(ms)-2; // Number of bytes being inserted + ep = &lp[strlen(lp)-1]; + if (offset > 1) { + ep[offset] = '\0'; + while (ep != (lp-1)) { + ep[offset-1] = *ep; + ep--; + } + } else { + if (offset <=0) { + while ((lp-1) != ep) { + lp[offset-1] = *lp; + lp++; + } + lp[offset-1]='\0'; + } + } + // Insert the macro/alias data + lp = ms-2; + while (*alias) { + if ((alias[0] == '%') && (alias[1] == '{')) macro_found = true; + *lp++ = *alias++; + } + line_len = strlen(line); + lp = lp - alias_len; + } else { + diag_printf("No room to expand '%s'\n", ms); + line[0] = '\0'; // Destroy line + return false; + } + } else { + diag_printf("Alias '%s' not defined\n", ms); + *me = '|'; + } + } else if ((c == '"') && (iter == 0)) { + // Skip quoted strings + while (*lp && (*lp != '"')) lp++; + } + } + } + return macro_found; +} + +void +expand_aliases(char *line, int len) +{ + int iter = 0; + + while (_expand_aliases(line, len, iter++)) { + } +} diff --git a/packages/redboot/current/src/crc.c b/packages/redboot/current/src/crc.c --- a/packages/redboot/current/src/crc.c +++ b/packages/redboot/current/src/crc.c @@ -5,29 +5,38 @@ // RedBoot CRC-16 calculations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/decompress.c b/packages/redboot/current/src/decompress.c --- a/packages/redboot/current/src/decompress.c +++ b/packages/redboot/current/src/decompress.c @@ -5,29 +5,38 @@ // RedBoot decompress support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -259,11 +268,13 @@ gzip_inflate(_pipe_t* p) stream.next_in = p->in_buf; stream.avail_in = p->in_avail; stream.next_out = p->out_buf; - stream.avail_out = -1; // no limits + stream.avail_out = p->out_max; err = inflate(&stream, Z_SYNC_FLUSH); p->out_size += (stream.next_out - p->out_buf); p->out_buf = stream.next_out; p->msg = stream.msg; + p->in_avail = stream.avail_in; + p->in_buf = stream.next_in; return err; } diff --git a/packages/redboot/current/src/flash.c b/packages/redboot/current/src/flash.c --- a/packages/redboot/current/src/flash.c +++ b/packages/redboot/current/src/flash.c @@ -5,29 +5,38 @@ // RedBoot - FLASH memory support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -48,13 +57,29 @@ #include #include -// CLI function -static cmd_fun do_fis; -RedBoot_cmd("fis", - "Manage FLASH images", - "{cmds}", - do_fis - ); +#ifdef CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG +// Note horrid intertwining of functions, to save precious FLASH +#endif + +// Round a quantity up +#define _rup(n,s) ((((n)+(s-1))/s)*s) + +#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +#include + +// Configuration data, saved in FLASH, used to set/update RedBoot +// normal "configuration" data items. +static struct _config { + unsigned long len; + unsigned long key1; + unsigned char config_data[MAX_CONFIG_DATA-(4*4)]; + unsigned long key2; + unsigned long cksum; +} *config, *backup_config; +#ifdef CYGSEM_REDBOOT_FLASH_CONFIG_READONLY_FALLBACK +static struct _config *readonly_config; +#endif +#endif #ifdef CYGOPT_REDBOOT_FIS // Image management functions @@ -119,13 +144,13 @@ local_cmd_entry("erase", #ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING local_cmd_entry("lock", "LOCK FLASH contents", - "-f -l ", + "[-f -l ] [name]", fis_lock, FIS_cmds ); local_cmd_entry("unlock", "UNLOCK FLASH contents", - "-f -l ", + "[-f -l ] [name]", fis_unlock, FIS_cmds ); @@ -143,9 +168,18 @@ CYG_HAL_TABLE_END( __FIS_cmds_TAB_END__, extern struct cmd __FIS_cmds_TAB__[], __FIS_cmds_TAB_END__; +// CLI function +static cmd_fun do_fis; +RedBoot_nested_cmd("fis", + "Manage FLASH images", + "{cmds}", + do_fis, + __FIS_cmds_TAB__, &__FIS_cmds_TAB_END__ + ); + // Local data used by these routines static void *flash_start, *flash_end; -static int block_size, blocks; +static int flash_block_size, flash_num_blocks; #ifdef CYGOPT_REDBOOT_FIS static void *fis_work_block; static void *fis_addr; @@ -174,14 +208,16 @@ static void #ifdef CYGOPT_REDBOOT_FIS struct fis_image_desc * -fis_lookup(char *name) +fis_lookup(char *name, int *num) { int i; struct fis_image_desc *img; img = (struct fis_image_desc *)fis_work_block; - for (i = 0; i < block_size/sizeof(*img); i++, img++) { - if ((img->name[0] != (unsigned char)0xFF) && (strcmp(name, img->name) == 0)) { + for (i = 0; i < fisdir_size/sizeof(*img); i++, img++) { + if ((img->name[0] != (unsigned char)0xFF) && + (strcasecmp(name, img->name) == 0)) { + if (num) *num = i; return img; } } @@ -189,6 +225,34 @@ fis_lookup(char *name) } static void +fis_update_directory(void) +{ + int stat; + void *err_addr; + +#ifdef CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG + memcpy((char *)fis_work_block+fisdir_size, config, cfg_size); +#endif +#ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL + // Ensure [quietly] that the directory is unlocked before trying to update + flash_unlock((void *)fis_addr, flash_block_size, (void **)&err_addr); +#endif + if ((stat = flash_erase(fis_addr, flash_block_size, (void **)&err_addr)) != 0) { + diag_printf("Error erasing FIS directory at %p: %s\n", err_addr, flash_errmsg(stat)); + } else { + if ((stat = flash_program(fis_addr, fis_work_block, flash_block_size, + (void **)&err_addr)) != 0) { + diag_printf("Error writing FIS directory at %p: %s\n", + err_addr, flash_errmsg(stat)); + } + } +#ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL + // Ensure [quietly] that the directory is locked after the update + flash_lock((void *)fis_addr, flash_block_size, (void **)&err_addr); +#endif +} + +static void fis_init(int argc, char *argv[]) { int stat; @@ -213,11 +277,12 @@ fis_init(int argc, char *argv[]) diag_printf("*** Initialize FLASH Image System\n"); #define MIN_REDBOOT_IMAGE_SIZE CYGBLD_REDBOOT_MIN_IMAGE_SIZE - redboot_image_size = block_size > MIN_REDBOOT_IMAGE_SIZE ? block_size : MIN_REDBOOT_IMAGE_SIZE; + redboot_image_size = flash_block_size > MIN_REDBOOT_IMAGE_SIZE ? + flash_block_size : MIN_REDBOOT_IMAGE_SIZE; // Create a pseudo image for RedBoot img = (struct fis_image_desc *)fis_work_block; - memset(img, 0xFF, block_size); // Start with erased data + memset(img, 0xFF, fisdir_size); // Start with erased data #ifdef CYGOPT_REDBOOT_FIS_RESERVED_BASE memset(img, 0, sizeof(*img)); strcpy(img->name, "(reserved)"); @@ -273,13 +338,13 @@ fis_init(int argc, char *argv[]) strcpy(img->name, "FIS directory"); img->flash_base = (CYG_ADDRESS)fis_addr; img->mem_base = (CYG_ADDRESS)fis_addr; - img->size = block_size; + img->size = fisdir_size; img++; #ifdef CYGOPT_REDBOOT_FIS_DIRECTORY_ARM_SIB_ID // FIS gets the size of a full block - note, this should be changed // if support is added for multi-block FIS structures. - img = (struct fis_image_desc *)((CYG_ADDRESS)fis_work_block + block_size); + img = (struct fis_image_desc *)((CYG_ADDRESS)fis_work_block + fisdir_size); // Add a footer so the FIS will be recognized by the ARM Boot // Monitor as a reserved area. { @@ -337,7 +402,7 @@ fis_init(int argc, char *argv[]) erase_start = redboot_flash_start; // high water of created images // Now the empty bits between the end of Redboot and the cfg and dir // blocks. -#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +#if defined(CYGSEM_REDBOOT_FLASH_CONFIG) && !defined(CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG) if (fis_addr > cfg_base) { erase_size = (CYG_ADDRESS)cfg_base - erase_start; // the gap between HWM and config data } else { @@ -348,7 +413,7 @@ fis_init(int argc, char *argv[]) diag_printf(" initialization failed %p: %s\n", err_addr, flash_errmsg(stat)); } - erase_start += (erase_size + block_size); + erase_start += (erase_size + flash_block_size); if (fis_addr > cfg_base) { erase_size = (CYG_ADDRESS)fis_addr - erase_start; // the gap between config and fis data } else { @@ -359,7 +424,7 @@ fis_init(int argc, char *argv[]) diag_printf(" initialization failed %p: %s\n", err_addr, flash_errmsg(stat)); } - erase_start += (erase_size + block_size); + erase_start += (erase_size + flash_block_size); #else // !CYGSEM_REDBOOT_FLASH_CONFIG erase_size = (CYG_ADDRESS)fis_addr - erase_start; // the gap between HWM and fis data if ((stat = flash_erase((void *)erase_start, erase_size, @@ -367,7 +432,7 @@ fis_init(int argc, char *argv[]) diag_printf(" initialization failed %p: %s\n", err_addr, flash_errmsg(stat)); } - erase_start += (erase_size + block_size); + erase_start += (erase_size + flash_block_size); #endif // Lastly, anything at the end erase_size = ((CYG_ADDRESS)flash_end - erase_start) + 1; @@ -380,24 +445,7 @@ fis_init(int argc, char *argv[]) diag_printf(" Warning: device contents not erased, some blocks may not be usable\n"); } -#ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL - // Ensure [quietly] that the directory is unlocked before trying to update - flash_unlock((void *)fis_addr, block_size, (void **)&err_addr); -#endif - if ((stat = flash_erase(fis_addr, block_size, (void **)&err_addr)) != 0) { - diag_printf(" initialization failed at %p: %s\n", err_addr, flash_errmsg(stat)); - } else { - if ((stat = flash_program(fis_addr, fis_work_block, - (CYG_ADDRESS)img - (CYG_ADDRESS)fis_work_block, - (void **)&err_addr)) != 0) { - diag_printf("Error writing image descriptors at %p: %s\n", - err_addr, flash_errmsg(stat)); - } - } -#ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL - // Ensure [quietly] that the directory is locked after the update - flash_lock((void *)fis_addr, block_size, (void **)&err_addr); -#endif + fis_update_directory(); } static void @@ -437,7 +485,7 @@ fis_list(int argc, char *argv[]) show_cksums ? "Checksum" : "Mem addr", show_datalen ? "Datalen" : "Length", "Entry point" ); - for (i = 0; i < block_size/sizeof(*img); i++, img++) { + for (i = 0; i < fisdir_size/sizeof(*img); i++, img++) { if (img->name[0] != (unsigned char)0xFF) { diag_printf("%-16s 0x%08lX 0x%08lX 0x%08lX 0x%08lX\n", img->name, img->flash_base, @@ -476,11 +524,11 @@ fis_free(int argc, char *argv[]) if (*area_start == (unsigned long)0xFFFFFFFF) { break; } - area_start += block_size / sizeof(CYG_ADDRESS); + area_start += flash_block_size / sizeof(CYG_ADDRESS); } fis_ptr = area_start; } else { - fis_ptr += block_size / sizeof(CYG_ADDRESS); + fis_ptr += flash_block_size / sizeof(CYG_ADDRESS); } } if (area_start != fis_ptr) { @@ -515,11 +563,11 @@ fis_find_free(CYG_ADDRESS *addr, unsigne if (*area_start == (unsigned long)0xFFFFFFFF) { break; } - area_start += block_size / sizeof(CYG_ADDRESS); + area_start += flash_block_size / sizeof(CYG_ADDRESS); } fis_ptr = area_start; } else { - fis_ptr += block_size / sizeof(CYG_ADDRESS); + fis_ptr += flash_block_size / sizeof(CYG_ADDRESS); } } if (area_start != fis_ptr) { @@ -546,7 +594,7 @@ fis_create(int argc, char *argv[]) bool img_size_set = false; bool no_copy = false; void *err_addr; - struct fis_image_desc *img; + struct fis_image_desc *img = NULL; bool slot_found, defaults_assumed; struct option_info opts[7]; bool prog_ok = true; @@ -574,29 +622,53 @@ fis_create(int argc, char *argv[]) defaults_assumed = false; if (name) { // Search existing files to acquire defaults for params not specified: - img = (struct fis_image_desc *)fis_work_block; - for (i = 0; i < block_size/sizeof(*img); i++, img++) { - if ((img->name[0] != (unsigned char)0xFF) && (strcmp(name, img->name) == 0)) { - // Found it, so get any unset but necessary params from there: - if (!length_set) { - length_set = true; - length = img->size; - defaults_assumed = true; - } - if (!exec_addr_set) { - // Preserve "normal" behaviour - exec_addr_set = true; - exec_addr = flash_addr_set ? flash_addr : mem_addr; - } - if (!flash_addr_set) { - flash_addr_set = true; - flash_addr = img->flash_base; - defaults_assumed = true; - } - break; + img = fis_lookup(name, NULL); + if (img) { + // Found it, so get image size from there + if (!length_set) { + length_set = true; + length = img->size; + defaults_assumed = true; } } } + if (!mem_addr_set && (load_address >= (CYG_ADDRESS)ram_start) && + (load_address_end) < (CYG_ADDRESS)ram_end) { + mem_addr = load_address; + mem_addr_set = true; + // Get entry address from loader, unless overridden + if (!entry_addr_set) + entry_addr = entry_address; + if (!length_set) { + length = load_address_end - load_address; + length_set = true; + diag_printf("No memory address or length set.\n"); + if (!verify_action("Inferring base %p, length 0x%x", mem_addr, length)) + return; + } else if (defaults_assumed && !img_size_set) { + /* We got length from the FIS table, so the size of the + actual loaded image becomes img_size */ + img_size = load_address_end - load_address; + img_size_set = true; + diag_printf("No memory address set.\n"); + if (!verify_action("Inferring base %p, length 0x%x, image size 0x%x, entry %p\n", + mem_addr, length, img_size, entry_addr)) + return; + } + } + // Get the remaining fall-back values from the fis + if (img) { + if (!exec_addr_set) { + // Preserve "normal" behaviour + exec_addr_set = true; + exec_addr = flash_addr_set ? flash_addr : mem_addr; + } + if (!flash_addr_set) { + flash_addr_set = true; + flash_addr = img->flash_base; + defaults_assumed = true; + } + } if ((!no_copy && !mem_addr_set) || (no_copy && !flash_addr_set) || !length_set || !name) { @@ -609,7 +681,7 @@ fis_create(int argc, char *argv[]) // 'length' is size of FLASH image, 'img_size' is actual data size // Round up length to FLASH block size #ifndef CYGPKG_HAL_MIPS // FIXME: compiler is b0rken - length = ((length + block_size - 1) / block_size) * block_size; + length = ((length + flash_block_size - 1) / flash_block_size) * flash_block_size; if (length < img_size) { diag_printf("Invalid FLASH image size/length combination\n"); return; @@ -621,9 +693,9 @@ fis_create(int argc, char *argv[]) _show_invalid_flash_address(flash_addr, stat); return; } - if (flash_addr_set && flash_addr & (block_size-1)) { + if (flash_addr_set && flash_addr & (flash_block_size-1)) { diag_printf("Invalid FLASH address: %p\n", (void *)flash_addr); - diag_printf(" must be 0x%x aligned\n", block_size); + diag_printf(" must be 0x%x aligned\n", flash_block_size); return; } if (strlen(name) >= sizeof(img->name)) { @@ -644,36 +716,33 @@ fis_create(int argc, char *argv[]) // Find a slot in the directory for this entry // First, see if an image by this name is already present slot_found = false; - img = (struct fis_image_desc *)fis_work_block; - for (i = 0; i < block_size/sizeof(*img); i++, img++) { - if ((img->name[0] != (unsigned char)0xFF) && (strcmp(name, img->name) == 0)) { - if (flash_addr_set && (img->flash_base != flash_addr)) { - diag_printf("Image found, but FLASH address incorrect\n"); - return; - } - if (img->size != length) { - diag_printf("Image found, but LENGTH is incorrect (0x%lx != 0x%lx)\n", img->size, length); - return; - } - if (!verify_action("An image named '%s' exists", name)) { - return; - } else { - slot_found = true; - if (defaults_assumed) { - if (!verify_action("* CAUTION * about to program '%s'\n at %p..%p from %p", - name, (void *)flash_addr, (void *)(flash_addr+img_size-1), - (void *)mem_addr)) { - return; // The guy gave up - } + img = fis_lookup(name, NULL); + if (img) { + if (flash_addr_set && (img->flash_base != flash_addr)) { + diag_printf("Image found, but FLASH address incorrect\n"); + return; + } + if (img->size != length) { + diag_printf("Image found, but LENGTH is incorrect (0x%lx != 0x%lx)\n", img->size, length); + return; + } + if (!verify_action("An image named '%s' exists", name)) { + return; + } else { + slot_found = true; + if (defaults_assumed) { + if (!verify_action("* CAUTION * about to program '%s'\n at %p..%p from %p", + name, (void *)flash_addr, (void *)(flash_addr+img_size-1), + (void *)mem_addr)) { + return; // The guy gave up } - break; } } } // If not found, try and find an empty slot if (!slot_found) { img = (struct fis_image_desc *)fis_work_block; - for (i = 0; i < block_size/sizeof(*img); i++, img++) { + for (i = 0; i < fisdir_size/sizeof(*img); i++, img++) { if (img->name[0] == (unsigned char)0xFF) { slot_found = true; break; @@ -713,23 +782,7 @@ fis_create(int argc, char *argv[]) #ifdef CYGSEM_REDBOOT_FIS_CRC_CHECK img->file_cksum = crc32((unsigned char *)flash_addr, img_size); #endif -#ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL - // Insure [quietly] that the directory is unlocked before trying to update - flash_unlock((void *)fis_addr, block_size, (void **)&err_addr); -#endif - if ((stat = flash_erase((void *)fis_addr, block_size, (void **)&err_addr)) != 0) { - diag_printf("Error erasing at %p: %s\n", err_addr, flash_errmsg(stat)); - // Don't try to program if the erase failed - } else { - // Now program it - if ((stat = flash_program((void *)fis_addr, (void *)fis_work_block, block_size, (void **)&err_addr)) != 0) { - diag_printf("Error programming at %p: %s\n", err_addr, flash_errmsg(stat)); - } - } -#ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL - // Insure [quietly] that the directory is locked after the update - flash_lock((void *)fis_addr, block_size, (void **)&err_addr); -#endif + fis_update_directory(); } } @@ -775,21 +828,16 @@ fis_delete(int argc, char *argv[]) num_reserved++; #endif - for (i = 0; i < block_size/sizeof(*img); i++, img++) { - if ((img->name[0] != (unsigned char)0xFF) && (strcmp(name, img->name) == 0)) { - if (i < num_reserved) { - diag_printf("Sorry, '%s' is a reserved image and cannot be deleted\n", img->name); - return; - } - if (!verify_action("Delete image '%s'", name)) { - return; - } else { - slot_found = true; - break; - } + img = fis_lookup(name, &i); + if (img) { + if (i < num_reserved) { + diag_printf("Sorry, '%s' is a reserved image and cannot be deleted\n", img->name); + return; } - } - if (!slot_found) { + if (!verify_action("Delete image '%s'", name)) { + return; + } + } else { diag_printf("No image '%s' found\n", name); return; } @@ -797,25 +845,7 @@ fis_delete(int argc, char *argv[]) if ((stat = flash_erase((void *)img->flash_base, img->size, (void **)&err_addr)) != 0) { diag_printf("Error erasing at %p: %s\n", err_addr, flash_errmsg(stat)); } else { -#ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL - // Insure [quietly] that the directory is unlocked before trying to update - flash_unlock((void *)fis_addr, block_size, (void **)&err_addr); -#endif - // Update directory - memset(img, 0xFF, sizeof(*img)); - if ((stat = flash_erase((void *)fis_addr, block_size, (void **)&err_addr)) != 0) { - diag_printf("Error erasing at %p: %s\n", err_addr, flash_errmsg(stat)); - // Don't try to program if the erase failed - } else { - // Now program it - if ((stat = flash_program((void *)fis_addr, (void *)fis_work_block, block_size, (void **)&err_addr)) != 0) { - diag_printf("Error programming at %p: %s\n", err_addr, flash_errmsg(stat)); - } - } -#ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL - // Insure [quietly] that the directory is locked after the update - flash_lock((void *)fis_addr, block_size, (void **)&err_addr); -#endif + fis_update_directory(); } } @@ -852,7 +882,7 @@ fis_load(int argc, char *argv[]) fis_usage("invalid arguments"); return; } - if ((img = fis_lookup(name)) == (struct fis_image_desc *)0) { + if ((img = fis_lookup(name, NULL)) == (struct fis_image_desc *)0) { diag_printf("No image '%s' found\n", name); return; } @@ -871,7 +901,7 @@ fis_load(int argc, char *argv[]) _pipe_t fis_load_pipe; _pipe_t* p = &fis_load_pipe; p->out_buf = (unsigned char*) mem_addr; - p->out_size = -1; + p->out_max = p->out_size = -1; p->in_buf = (unsigned char*) img->flash_base; p->in_avail = img->data_length; @@ -952,7 +982,7 @@ fis_write(int argc, char *argv[]) // Round up length to FLASH block size #ifndef CYGPKG_HAL_MIPS // FIXME: compiler is b0rken - length = ((length + block_size - 1) / block_size) * block_size; + length = ((length + flash_block_size - 1) / flash_block_size) * flash_block_size; #endif if (flash_addr_set && ((stat = flash_verify_addr((void *)flash_addr)) || @@ -960,9 +990,9 @@ fis_write(int argc, char *argv[]) _show_invalid_flash_address(flash_addr, stat); return; } - if (flash_addr_set && flash_addr & (block_size-1)) { + if (flash_addr_set && flash_addr & (flash_block_size-1)) { diag_printf("Invalid FLASH address: %p\n", (void *)flash_addr); - diag_printf(" must be 0x%x aligned\n", block_size); + diag_printf(" must be 0x%x aligned\n", flash_block_size); return; } if ((mem_addr < (CYG_ADDRESS)ram_start) || @@ -1028,9 +1058,9 @@ fis_erase(int argc, char *argv[]) _show_invalid_flash_address(flash_addr, stat); return; } - if (flash_addr_set && flash_addr & (block_size-1)) { + if (flash_addr_set && flash_addr & (flash_block_size-1)) { diag_printf("Invalid FLASH address: %p\n", (void *)flash_addr); - diag_printf(" must be 0x%x aligned\n", block_size); + diag_printf(" must be 0x%x aligned\n", flash_block_size); return; } // Safety check - make sure the address range is not within the code we're running @@ -1048,6 +1078,7 @@ fis_erase(int argc, char *argv[]) static void fis_lock(int argc, char *argv[]) { + char *name; int stat; unsigned long length; CYG_ADDRESS flash_addr; @@ -1060,13 +1091,23 @@ fis_lock(int argc, char *argv[]) (void **)&flash_addr, (bool *)&flash_addr_set, "FLASH memory base address"); init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, (void **)&length, (bool *)&length_set, "length"); - if (!scan_opts(argc, argv, 2, opts, 2, (void **)0, 0, "")) + if (!scan_opts(argc, argv, 2, opts, 2, (void **)&name, OPTION_ARG_TYPE_STR, "image name")) { fis_usage("invalid arguments"); return; } - if (!flash_addr_set || !length_set) { + /* Get parameters from image if specified */ + if (name) { + struct fis_image_desc *img; + if ((img = fis_lookup(name, NULL)) == (struct fis_image_desc *)0) { + diag_printf("No image '%s' found\n", name); + return; + } + + flash_addr = img->flash_base; + length = img->size; + } else if (!flash_addr_set || !length_set) { fis_usage("missing argument"); return; } @@ -1084,6 +1125,7 @@ fis_lock(int argc, char *argv[]) static void fis_unlock(int argc, char *argv[]) { + char *name; int stat; unsigned long length; CYG_ADDRESS flash_addr; @@ -1096,13 +1138,22 @@ fis_unlock(int argc, char *argv[]) (void **)&flash_addr, (bool *)&flash_addr_set, "FLASH memory base address"); init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, (void **)&length, (bool *)&length_set, "length"); - if (!scan_opts(argc, argv, 2, opts, 2, (void **)0, 0, "")) + if (!scan_opts(argc, argv, 2, opts, 2, (void **)&name, OPTION_ARG_TYPE_STR, "image name")) { fis_usage("invalid arguments"); return; } - if (!flash_addr_set || !length_set) { + if (name) { + struct fis_image_desc *img; + if ((img = fis_lookup(name, NULL)) == (struct fis_image_desc *)0) { + diag_printf("No image '%s' found\n", name); + return; + } + + flash_addr = img->flash_base; + length = img->size; + } else if (!flash_addr_set || !length_set) { fis_usage("missing argument"); return; } @@ -1112,6 +1163,7 @@ fis_unlock(int argc, char *argv[]) _show_invalid_flash_address(flash_addr, stat); return; } + if ((stat = flash_unlock((void *)flash_addr, length, (void **)&err_addr)) != 0) { diag_printf("Error unlocking at %p: %s\n", err_addr, flash_errmsg(stat)); } @@ -1126,7 +1178,7 @@ void { if (!__flash_init) return; diag_printf("FLASH: %p - %p, %d blocks of %p bytes each.\n", - flash_start, (CYG_ADDRWORD)flash_end + 1, blocks, (void *)block_size); + flash_start, (CYG_ADDRWORD)flash_end + 1, flash_num_blocks, (void *)flash_block_size); } static bool @@ -1143,12 +1195,19 @@ do_flash_init(void) flash_get_limits((void *)0, (void **)&flash_start, (void **)&flash_end); // Keep 'end' address as last valid location, to avoid wrap around problems flash_end = (void *)((CYG_ADDRESS)flash_end - 1); - flash_get_block_info(&block_size, &blocks); + flash_get_block_info(&flash_block_size, &flash_num_blocks); workspace_end = (unsigned char *)(workspace_end-FLASH_MIN_WORKSPACE); #ifdef CYGOPT_REDBOOT_FIS - workspace_end = (unsigned char *)(workspace_end-block_size); + workspace_end = (unsigned char *)(workspace_end-flash_block_size); fis_work_block = workspace_end; - fisdir_size = block_size; + fisdir_size = flash_block_size; + if (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK < 0) { + fis_addr = (void *)((CYG_ADDRESS)flash_end + 1 + + (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*flash_block_size)); + } else { + fis_addr = (void *)((CYG_ADDRESS)flash_start + + (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*flash_block_size)); + } #endif __flash_init = 1; } @@ -1180,14 +1239,7 @@ do_fis(int argc, char *argv[]) return; } #ifdef CYGOPT_REDBOOT_FIS - if (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK < 0) { - fis_addr = (void *)((CYG_ADDRESS)flash_end + 1 + - (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size)); - } else { - fis_addr = (void *)((CYG_ADDRESS)flash_start + - (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size)); - } - memcpy(fis_work_block, fis_addr, block_size); + memcpy(fis_work_block, fis_addr, flash_block_size); #endif if ((cmd = cmd_search(__FIS_cmds_TAB__, &__FIS_cmds_TAB_END__, argv[1])) != (struct cmd *)0) { @@ -1198,17 +1250,7 @@ do_fis(int argc, char *argv[]) } #ifdef CYGSEM_REDBOOT_FLASH_CONFIG -#include -// Configuration data, saved in FLASH, used to set/update RedBoot -// normal "configuration" data items. -static struct _config { - unsigned long len; - unsigned long key1; - unsigned char config_data[MAX_CONFIG_DATA-(4*4)]; - unsigned long key2; - unsigned long cksum; -} *config, *backup_config; static bool config_ok; #define CONFIG_KEY1 0x0BADFACE @@ -1291,6 +1333,7 @@ extern struct config_option __CONFIG_opt #define LIST_OPT_LIST_ONLY (1) #define LIST_OPT_NICKNAMES (2) #define LIST_OPT_FULLNAMES (4) +#define LIST_OPT_DUMBTERM (8) static void config_init(void); @@ -1383,6 +1426,12 @@ get_config(unsigned char *dp, char *titl } else { // read from terminal strcpy(hold_line, line); + if (LIST_OPT_DUMBTERM & list_opt) { + diag_printf( (CONFIG_STRING == type ? + "%s > " : + "%s ? " ), line); + *line = '\0'; + } ret = _rb_gets_preloaded(line, sizeof(line), 0); } if (ret < 0) return CONFIG_ABORT; @@ -1506,7 +1555,7 @@ config_length(int type) static cmd_fun do_flash_config; RedBoot_cmd("fconfig", "Manage configuration kept in FLASH memory", - "[-i] [-l] [-n] [-f] | nickname [value]", + "[-i] [-l] [-n] [-f] [-d] | [-d] nickname [value]", do_flash_config ); @@ -1516,10 +1565,11 @@ do_flash_config(int argc, char *argv[]) bool need_update = false; struct config_option *optend = __CONFIG_options_TAB_END__; struct config_option *opt = __CONFIG_options_TAB__; - struct option_info opts[4]; + struct option_info opts[5]; bool list_only; bool nicknames; bool fullnames; + bool dumbterminal; int list_opt = 0; unsigned char *dp; int len, ret; @@ -1537,13 +1587,15 @@ do_flash_config(int argc, char *argv[]) script = (unsigned char *)0; init_opts(&opts[0], 'l', false, OPTION_ARG_TYPE_FLG, - (void **)&list_only, (bool *)0, "list configuration only"); + (void **)&list_only, (bool *)0, "list configuration only"); init_opts(&opts[1], 'n', false, OPTION_ARG_TYPE_FLG, (void **)&nicknames, (bool *)0, "show nicknames"); init_opts(&opts[2], 'f', false, OPTION_ARG_TYPE_FLG, (void **)&fullnames, (bool *)0, "show full names"); init_opts(&opts[3], 'i', false, OPTION_ARG_TYPE_FLG, (void **)&init, (bool *)0, "initialize configuration database"); + init_opts(&opts[4], 'd', false, OPTION_ARG_TYPE_FLG, + (void **)&dumbterminal, (bool *)0, "dumb terminal: no clever edits"); // First look to see if we are setting or getting a single option // by just quoting its nickname @@ -1554,16 +1606,28 @@ do_flash_config(int argc, char *argv[]) onevalue = (3 == argc) ? argv[2] : NULL; list_opt = LIST_OPT_NICKNAMES; } + // Next see if we are setting or getting a single option with a dumb + // terminal invoked, ie. no line editing. + else if (3 == argc && + '-' == argv[1][0] && 'd' == argv[1][1] && 0 == argv[1][2] && + '-' != argv[2][0]) { + // then the command was "fconfig -d foo" + onlyone = argv[2]; + onevalue = NULL; + list_opt = LIST_OPT_NICKNAMES | LIST_OPT_DUMBTERM; + } else { - if (!scan_opts(argc, argv, 1, opts, 4, 0, 0, "")) + if (!scan_opts(argc, argv, 1, opts, 5, 0, 0, "")) return; list_opt |= list_only ? LIST_OPT_LIST_ONLY : 0; list_opt |= nicknames ? LIST_OPT_NICKNAMES : LIST_OPT_FULLNAMES; list_opt |= fullnames ? LIST_OPT_FULLNAMES : 0; + list_opt |= dumbterminal ? LIST_OPT_DUMBTERM : 0; } if (init && verify_action("Initialize non-volatile configuration")) { config_init(); + need_update = true; } dp = &config->config_data[0]; @@ -1679,8 +1743,8 @@ do_alias(int argc, char *argv[]) // other types so allowing access to all configured values. This allows // for alias (macro) expansion of normal 'fconfig' data, such as the // board IP address. -static char * -lookup_alias(char *alias, char *alias_buf) +char * +flash_lookup_alias(char *alias, char *alias_buf) { char name[80]; char *val; @@ -1732,95 +1796,6 @@ lookup_alias(char *alias, char *alias_bu } } -// Expand aliases, this is recursive. ie if one alias contains other -// aliases, these will also be expanded from the insertion point -// onwards. -// -// If 'iter' is zero, then quoted strings are not expanded -// -bool -_expand_aliases(char *line, int len, int iter) -{ - char *lp = line; - char *ms, *me, *ep; - char *alias; - char c; - int offset, line_len, alias_len; - char alias_buf[MAX_STRING_LENGTH]; - bool macro_found = false; - - if ((line_len = strlen(line)) != 0) { - while (*lp) { - c = *lp++; - if ((c == '%') && (*lp == '{')) { - // Found a macro/alias to expand - ms = lp+1; - lp += 2; - while (*lp && (*lp != '}')) lp++; - if (!*lp) { - diag_printf("Invalid macro/alias '%s'\n", ms); - line[0] = '\0'; // Destroy line - return false; - } - me = lp; - *me = '\0'; - lp++; - if ((alias = lookup_alias(ms,alias_buf)) != (char *)NULL) { - alias_len = strlen(alias); - // See if there is room in the line to expand this macro/alias - if ((line_len+alias_len) < len) { - // Make a hole by moving data within the line - offset = alias_len-strlen(ms)-2; // Number of bytes being inserted - ep = &lp[strlen(lp)-1]; - if (offset > 1) { - ep[offset] = '\0'; - while (ep != (lp-1)) { - ep[offset-1] = *ep; - ep--; - } - } else { - if (offset <=0) { - while ((lp-1) != ep) { - lp[offset-1] = *lp; - lp++; - } - lp[offset-1]='\0'; - } - } - // Insert the macro/alias data - lp = ms-2; - while (*alias) { - if ((alias[0] == '%') && (alias[1] == '{')) macro_found = true; - *lp++ = *alias++; - } - line_len = strlen(line); - lp = lp - alias_len; - } else { - diag_printf("No room to expand '%s'\n", ms); - line[0] = '\0'; // Destroy line - return false; - } - } else { - diag_printf("Alias '%s' not defined\n", ms); - *me = '|'; - } - } else if ((c == '"') && (iter == 0)) { - // Skip quoted strings - while (*lp && (*lp != '"')) lp++; - } - } - } - return macro_found; -} - -void -expand_aliases(char *line, int len) -{ - int iter = 0; - - while (_expand_aliases(line, len, iter++)) { - } -} #endif // CYGSEM_REDBOOT_FLASH_ALIASES // @@ -1829,14 +1804,20 @@ expand_aliases(char *line, int len) void flash_write_config(void) { +#ifndef CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG int stat; void *err_addr; +#endif config->len = sizeof(struct _config); config->key1 = CONFIG_KEY1; config->key2 = CONFIG_KEY2; config->cksum = crc32((unsigned char *)config, sizeof(struct _config)-sizeof(config->cksum)); if (verify_action("Update RedBoot non-volatile configuration")) { +#ifdef CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG + memcpy(fis_work_block, fis_addr, fisdir_size); + fis_update_directory(); +#else // CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG #ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL // Insure [quietly] that the config page is unlocked before trying to update flash_unlock((void *)cfg_base, cfg_size, (void **)&err_addr); @@ -1854,6 +1835,7 @@ flash_write_config(void) // Insure [quietly] that the config data is locked after the update flash_lock((void *)cfg_base, cfg_size, (void **)&err_addr); #endif +#endif } } @@ -1889,6 +1871,9 @@ flash_get_config(char *key, void *val, i { unsigned char *dp; void *val_ptr; +#ifdef CYGSEM_REDBOOT_FLASH_CONFIG_READONLY_FALLBACK + struct _config *save_config = 0; +#endif if (!config_ok) return false; @@ -1922,6 +1907,29 @@ flash_get_config(char *key, void *val, i } return true; } +#ifdef CYGSEM_REDBOOT_FLASH_CONFIG_READONLY_FALLBACK + // Did not find key. Is configuration data valid? + // Check to see if the config data is valid, if not, revert to + // readonly mode, by setting config to readonly_config. We + // will set it back before we leave this function. + if ( (config != readonly_config) && ((crc32((unsigned char *)config, + sizeof(struct _config)-sizeof(config->cksum)) != config->cksum) || + (config->key1 != CONFIG_KEY1)|| (config->key2 != CONFIG_KEY2))) { + save_config = config; + config = readonly_config; + if ((crc32((unsigned char *)config, + sizeof(struct _config)-sizeof(config->cksum)) != config->cksum) || + (config->key1 != CONFIG_KEY1)|| (config->key2 != CONFIG_KEY2)) { + diag_printf("FLASH configuration checksum error or invalid key\n"); + config = save_config; + return false; + } + else{ + diag_printf("Getting config information in READONLY mode\n"); + return flash_get_config(key, val, type); + } + } +#endif return false; } @@ -2054,17 +2062,30 @@ load_flash_config(void) config = (struct _config *)(workspace_end-sizeof(struct _config)); backup_config = (struct _config *)((CYG_ADDRESS)config-sizeof(struct _config)); workspace_end = (unsigned char *)backup_config; -#define _roundup(n,s) ((((n)+(s-1))/s)*s) - cfg_size = (block_size > sizeof(struct _config)) ? + cfg_size = (flash_block_size > sizeof(struct _config)) ? sizeof(struct _config) : - _roundup(sizeof(struct _config), block_size); + _rup(sizeof(struct _config), flash_block_size); +#ifdef CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG + cfg_size = _rup(cfg_size, sizeof(struct fis_image_desc)); + if ((flash_block_size-cfg_size) < 8*sizeof(struct fis_image_desc)) { + // Too bad this can't be checked at compile/build time + diag_printf("Sorry, FLASH config exceeds available space in FIS directory\n"); + return; + } + fisdir_size = flash_block_size - cfg_size; + cfg_base = (void *)(((CYG_ADDRESS)fis_addr + flash_block_size) - cfg_size); +#else if (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK < 0) { - cfg_base = (void *)((CYG_ADDRESS)flash_end + 1 + - (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK*block_size)); + cfg_base = (void *)((CYG_ADDRESS)flash_end + 1 - + _rup(_rup((-CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK*flash_block_size), cfg_size), flash_block_size)); } else { cfg_base = (void *)((CYG_ADDRESS)flash_start + - (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK*block_size)); + _rup(_rup((CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK*flash_block_size), cfg_size), flash_block_size)); } +#endif +#ifdef CYGSEM_REDBOOT_FLASH_CONFIG_READONLY_FALLBACK + readonly_config = cfg_base; +#endif memcpy(config, cfg_base, sizeof(struct _config)); if ((crc32((unsigned char *)config, sizeof(struct _config)-sizeof(config->cksum)) != config->cksum) || @@ -2081,7 +2102,7 @@ load_flash_config(void) } #ifdef CYGSEM_REDBOOT_VARIABLE_BAUD_RATE if (flash_get_config("console_baud_rate", &console_baud_rate, CONFIG_INT)) { - extern void set_console_baud_rate(int); + extern int set_console_baud_rate(int); set_console_baud_rate(console_baud_rate); } #endif diff --git a/packages/redboot/current/src/fs/disk.c b/packages/redboot/current/src/fs/disk.c --- a/packages/redboot/current/src/fs/disk.c +++ b/packages/redboot/current/src/fs/disk.c @@ -5,29 +5,38 @@ // RedBoot disk support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -381,7 +390,7 @@ disk_stream_read(char *buf, int size, in { int nread; - if ((nread = (file_part->funs->read)(fileptr, buf, size)) != size) { + if ((nread = (file_part->funs->read)(fileptr, buf, size)) < 0) { *err = diskerr_read; return -1; } diff --git a/packages/redboot/current/src/fs/e2fs.c b/packages/redboot/current/src/fs/e2fs.c --- a/packages/redboot/current/src/fs/e2fs.c +++ b/packages/redboot/current/src/fs/e2fs.c @@ -5,29 +5,38 @@ // RedBoot support for second extended filesystem // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/fs/ide.c b/packages/redboot/current/src/fs/ide.c --- a/packages/redboot/current/src/fs/ide.c +++ b/packages/redboot/current/src/fs/ide.c @@ -5,29 +5,38 @@ // RedBoot IDE support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -360,7 +369,8 @@ ide_packet_read_sectors(int ctlr, int de count /= SECTORS_PER_CDROM_SECTOR; if (count) { - do_packet_read(ctlr, dev, cdstart, count, buf); + if (!do_packet_read(ctlr, dev, cdstart, count, buf)) + return 0; buf += count * SECTORS_PER_CDROM_SECTOR * SECTOR_SIZE; } @@ -441,8 +451,14 @@ ide_init(void) if (ide_ident(i, j, 1, (cyg_uint16 *)buf) <= 0) { priv->flags = 0; continue; // can't identify device - } else + } else { + u16 = *(cyg_uint16 *)((char *)buf + IDE_DEVID_GENCONFIG); + if (((u16 >> 8) & 0x1f) != 5) { + diag_printf("Non-CDROM ATAPI device #%d - skipped\n", i); + continue; + } priv->flags |= IDE_DEV_PACKET; + } } memset(&disk, 0, sizeof(disk)); diff --git a/packages/redboot/current/src/io.c b/packages/redboot/current/src/io.c --- a/packages/redboot/current/src/io.c +++ b/packages/redboot/current/src/io.c @@ -5,29 +5,38 @@ // RedBoot I/O support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -585,20 +594,43 @@ int return _rb_gets_preloaded(buf, buflen, timeout); } -bool -verify_action(char *fmt, ...) +static bool +_verify_action(int timeout, char *fmt, va_list ap) { - va_list ap; char ans[8]; + int ret; #ifdef CYGFUN_REDBOOT_BOOT_SCRIPT // Don't ask if we're executing a script if (script && *script) return 1; #endif + diag_vprintf(fmt, ap); + diag_printf(" - continue (y/n)? "); + if ((ret = _rb_gets(ans, sizeof(ans), timeout)) > 0) { + return ((ans[0] == 'y') || (ans[0] == 'Y')); + } else { + if (ret == _GETS_TIMEOUT) { + diag_printf(" ** Timed out!\n"); + } + return 0; // Timed out or ^C + } +} + +bool +verify_action(char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); - diag_vprintf(fmt, ap); - diag_printf(" - are you sure (y/n)? "); - _rb_gets(ans, sizeof(ans), 0); - return ((ans[0] == 'y') || (ans[0] == 'Y')); + return _verify_action(0, fmt, ap); } + +bool +verify_action_with_timeout(int timeout, char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + return _verify_action(timeout, fmt, ap); +} diff --git a/packages/redboot/current/src/load.c b/packages/redboot/current/src/load.c --- a/packages/redboot/current/src/load.c +++ b/packages/redboot/current/src/load.c @@ -5,29 +5,38 @@ // RedBoot file/image loader // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -45,13 +54,25 @@ #include #include +#include #ifdef CYGPKG_REDBOOT_DISK #include #endif - -// Buffer used by redboot_getc -getc_info_t getc_info; +// Buffers, data used by redboot_getc +#define BUF_SIZE 256 +struct { + int (*fun)(char *, int len, int *err); + unsigned char buf[BUF_SIZE]; + unsigned char *bufp; + int avail, len, err; + int verbose, decompress, tick; +#ifdef CYGPKG_COMPRESS_ZLIB + int (*raw_fun)(char *, int len, int *err); + _pipe_t load_pipe; + unsigned char _buffer[CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER]; +#endif +} getc_info; static char usage[] = "[-r] [-v] " #ifdef CYGPKG_COMPRESS_ZLIB @@ -73,13 +94,152 @@ RedBoot_cmd("load", do_load ); +#ifdef CYGSEM_REDBOOT_ELF +static int +_read(int (*getc)(void), unsigned char *buf, int len) +{ + int total = 0; + int ch; + while (len-- > 0) { + ch = (*getc)(); + if (ch < 0) { + // EOF or error + break; + } + *buf++ = ch; + total++; + } + return total; +} +#endif + static unsigned long -load_elf_image(int (*getc)(void)) +load_elf_image(getc_t getc, terminate_t terminate, unsigned long base) { - diag_printf("ELF images not supported\n"); +#ifdef CYGSEM_REDBOOT_ELF + Elf32_Ehdr ehdr; +#define MAX_PHDR 8 + Elf32_Phdr phdr[MAX_PHDR]; + unsigned long offset = 0; + int phx, len, ch; + unsigned char *addr; + bool first_addr = true; + unsigned long addr_offset = 0; + unsigned long highest_address = 0; + unsigned long lowest_address = 0xFFFFFFFF; + unsigned char *SHORT_DATA = "Short data reading ELF file"; + + // Read the header + if (_read(getc, (unsigned char *)&ehdr, sizeof(ehdr)) != sizeof(ehdr)) { + diag_printf("Can't read ELF header\n"); + return 0; + } + offset += sizeof(ehdr); +#if 0 // DEBUG + diag_printf("Type: %d, Machine: %d, Version: %d, Entry: %p, PHoff: %p/%d/%d, SHoff: %p/%d/%d\n", + ehdr.e_type, ehdr.e_machine, ehdr.e_version, ehdr.e_entry, + ehdr.e_phoff, ehdr.e_phentsize, ehdr.e_phnum, + ehdr.e_shoff, ehdr.e_shentsize, ehdr.e_shnum); +#endif + if (ehdr.e_type != ET_EXEC) { + diag_printf("Only absolute ELF images supported\n"); + return 0; + } + if (ehdr.e_phnum > MAX_PHDR) { + diag_printf("Too many program headers\n"); + return 0; + } + while (offset < ehdr.e_phoff) { + if ((*getc)() < 0) { + diag_printf(SHORT_DATA); + return 0; + } + offset++; + } + for (phx = 0; phx < ehdr.e_phnum; phx++) { + if (_read(getc, (unsigned char *)&phdr[phx], sizeof(phdr[0])) != sizeof(phdr[0])) { + diag_printf("Can't read ELF program header\n"); + return 0; + } +#if 0 // DEBUG + diag_printf("Program header: type: %d, off: %p, va: %p, pa: %p, len: %d/%d, flags: %d\n", + phdr[phx].p_type, phdr[phx].p_offset, phdr[phx].p_vaddr, phdr[phx].p_paddr, + phdr[phx].p_filesz, phdr[phx].p_memsz, phdr[phx].p_flags); +#endif + offset += sizeof(phdr[0]); + } + for (phx = 0; phx < ehdr.e_phnum; phx++) { + if ((phdr[phx].p_type == PT_LOAD) && (phdr[phx].p_offset != 0)) { + // Loadable segment + if (offset > phdr[phx].p_offset) { + diag_printf("Can't load ELF file - program headers out of order\n"); + return 0; + } + while (offset < phdr[phx].p_offset) { + if ((*getc)() < 0) { + diag_printf(SHORT_DATA); + return 0; + } + offset++; + } + // Copy data into memory + addr = (unsigned char *)phdr[phx].p_paddr; + len = phdr[phx].p_filesz; + if (first_addr) { + if (base) { + addr_offset = (unsigned long)base - (unsigned long)addr; + } else { + addr_offset = 0; + } + first_addr = false; + } + addr += addr_offset; + if ((unsigned long)(addr-addr_offset) < lowest_address) { + lowest_address = (unsigned long)(addr - addr_offset); + } + while (len-- > 0) { +#ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS + if ((addr < user_ram_start) || (addr > user_ram_end)) { + // Only if there is no need to stop the download before printing + // output can we ask confirmation questions. + if (terminate) { + (*terminate)(xyzModem_abort, getc); + diag_printf("*** Warning! Attempt to load ELF data to address: %p\nRedBoot does not believe this is in RAM\nUse TFTP for a chance to override this.\n",(void*)addr); + } else { + if (!verify_action("Attempt to load ELF data to address: %p\n" + "RedBoot does not believe this is in RAM", (void*)addr)) + return 0; + } + } +#endif + if ((ch = (*getc)()) < 0) { + diag_printf(SHORT_DATA); + return 0; + } + *addr++ = ch; + offset++; + if ((unsigned long)(addr-addr_offset) > highest_address) { + highest_address = (unsigned long)(addr - addr_offset); + } + } + } + } + // Save load base/top and entry + load_address = lowest_address; + load_address_end = highest_address; + entry_address = ehdr.e_entry; + + if (addr_offset) diag_printf("Address offset = %p\n", (void *)addr_offset); + diag_printf("Entry point: %p, address range: %p-%p\n", + (void*)ehdr.e_entry, (void *)lowest_address, (void *)highest_address); + return 1; +#else // CYGSEM_REDBOOT_ELF + diag_printf("Loading ELF images not supported\n"); return 0; +#endif // CYGSEM_REDBOOT_ELF } + // // Scan a string of hex bytes and update the checksum // @@ -118,11 +278,9 @@ static long // #define MAX_LINE 80 static unsigned long -load_srec_image(int (*getc)(void), void (*terminate)(int method,int (*getc)(void)), unsigned long base) +load_srec_image(getc_t getc, terminate_t terminate, unsigned long base) { - char line[MAX_LINE]; - char *lp; - int c, len; + int c; long offset = 0, count, sum, val, cksum; unsigned char *addr, *base_addr; char type; @@ -132,7 +290,6 @@ load_srec_image(int (*getc)(void), void unsigned long lowest_address = 0xFFFFFFFF; while ((c = (*getc)()) > 0) { - lp = line; len = 0; // Start of line if (c != 'S') { if (terminate) (*terminate)(xyzModem_abort, getc); @@ -208,6 +365,7 @@ load_srec_image(int (*getc)(void), void case '9': addr = (unsigned char *)_hex2(getc, ('9'-type+2), &sum); offset += ('9'-type+2); + // Save entry address entry_address = (unsigned long)addr; if (terminate) (*terminate)(xyzModem_close, getc); if (addr_offset) diag_printf("Address offset = %p\n", (void *)addr_offset); @@ -230,7 +388,9 @@ load_srec_image(int (*getc)(void), void return 0; } - +// +// Stream I/O support +// int redboot_getc(void) { @@ -261,14 +421,66 @@ redboot_getc(void) return *getc_info.bufp++; } +#ifdef CYGPKG_COMPRESS_ZLIB +// Called to fetch a new chunk of data and decompress it +int +_decompress_stream(char *buf, int len, int *err) +{ + _pipe_t* p = &getc_info.load_pipe; + int res, total; + + total = 0; + while (len > 0) { + if (p->in_avail == 0) { + p->in_buf = &getc_info._buffer[0]; + res = (*getc_info.raw_fun)(p->in_buf, CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER, + &getc_info.err); + if ((p->in_avail = res) <= 0) { + // No more data + return total; + } + } + p->out_buf = buf; + p->out_size = 0; + p->out_max = len; + res = (*_dc_inflate)(p); + if (res != 0) { + *err = res; + return total; + } + len -= p->out_size; + buf += p->out_size; + total += p->out_size; + } + return total; +} +#endif + void -redboot_getc_init(int (*fun)(char *, int, int *), int verbose) +redboot_getc_init(int (*fun)(char *, int, int *), + int verbose, int decompress) { getc_info.avail = 0; getc_info.len = BUF_SIZE; getc_info.fun = fun; getc_info.verbose = verbose; + getc_info.decompress = decompress; getc_info.tick = 0; +#ifdef CYGPKG_COMPRESS_ZLIB + if (decompress) { + _pipe_t* p = &getc_info.load_pipe; + int err; + p->out_buf = &getc_info.buf[0]; + p->out_size = 0; + p->in_avail = 0; + getc_info.fun = _decompress_stream; + getc_info.raw_fun = fun; + err = (*_dc_init)(p); + if (0 != err && p->msg) { + diag_printf("open decompression error: %s\n", p->msg); + } + } +#endif } void @@ -278,6 +490,21 @@ redboot_getc_rewind(void) getc_info.avail = getc_info.len; } +void +redboot_getc_close(void) +{ +#ifdef CYGPKG_COMPRESS_ZLIB + if (getc_info.decompress) { + _pipe_t* p = &getc_info.load_pipe; + int err = getc_info.err; + if (0 != err && p->msg) { + diag_printf("decompression error: %s\n", p->msg); + } + err = (*_dc_close)(p, getc_info.err); + } +#endif +} + #define MODE_TFTP 0 #define MODE_XMODEM xyzModem_xmodem // 1 #define MODE_YMODEM xyzModem_ymodem // 2 @@ -297,9 +524,7 @@ do_load(int argc, char *argv[]) bool hostname_set; char *hostname; #endif -#ifdef CYGPKG_COMPRESS_ZLIB - bool decompress; -#endif + bool decompress = false; int chan = -1; #if CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS > 1 bool chan_set; @@ -309,6 +534,7 @@ do_load(int argc, char *argv[]) char type[4]; char *filename = 0; struct option_info opts[7]; + terminate_t terminate = NULL; #ifdef CYGPKG_REDBOOT_NETWORKING memset((char *)&host, 0, sizeof(host)); @@ -348,8 +574,8 @@ do_load(int argc, char *argv[]) num_options++; #endif - if (!scan_opts(argc, argv, 1, opts, num_options, (void *)&filename, OPTION_ARG_TYPE_STR, "file name")) - { + if (!scan_opts(argc, argv, 1, opts, num_options, + (void *)&filename, OPTION_ARG_TYPE_STR, "file name")) { return; } #ifdef CYGPKG_REDBOOT_NETWORKING @@ -443,17 +669,18 @@ do_load(int argc, char *argv[]) diag_printf("Can't load '%s': %s\n", filename, tftp_error(err)); return; } - redboot_getc_init(tftp_stream_read, verbose); + redboot_getc_init(tftp_stream_read, verbose, decompress); } #endif #ifdef CYGPKG_REDBOOT_DISK else if (mode == MODE_DISK) { res = disk_stream_open(filename, &err); if (res < 0) { + diag_printf("Can't load '%s': %s\n", filename, disk_error(err)); return; } - redboot_getc_init(disk_stream_read, verbose); + redboot_getc_init(disk_stream_read, verbose, decompress); } #endif else { @@ -463,59 +690,49 @@ do_load(int argc, char *argv[]) return; } // Suppress verbosity when using xyz modem download - redboot_getc_init(xyzModem_stream_read, 0 && verbose); + redboot_getc_init(xyzModem_stream_read, 0 && verbose, decompress); + + terminate = xyzModem_stream_terminate; } - if (raw) { -#ifdef CYGPKG_COMPRESS_ZLIB - if (decompress) { - _pipe_t load_pipe; - _pipe_t* p = &load_pipe; - unsigned char _buffer[CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER]; - p->out_buf = (unsigned char*) base; - p->out_size = 0; - p->in_buf = _buffer; - - err = (*_dc_init)(p); - - while (0 == err) { - p->in_avail = 0; - for (i = 0; i < CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER; i++) { - res = redboot_getc(); - if (res < 0) break; - p->in_buf[p->in_avail++] = res; + if (raw) { + bool continue_load = false; + unsigned char *mp = (unsigned char *)base; + err = 0; + while ((res = redboot_getc()) >= 0) { +#ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS + if (!continue_load && mp >= user_ram_end) { + // Only if there is no need to stop the download + // before printing output can we ask confirmation + // questions. + if (terminate) { + (*terminate)(xyzModem_abort, redboot_getc); + diag_printf("*** Warning! RAW data spills over limit of user RAM at %p\nRedBoot does not believe this is in RAM\nUse TFTP for a chance to override this.\n",(void*)mp); + err = -1; + break; + } else { + if (!verify_action("RAW data spills over limit of user RAM at %p\n" + "Continuing may cause a hang or crash", (void*)mp)) { + err = -1; + break; + } + // Don't ask again + continue_load = true; } - if (0 == p->in_avail) break; - - err = (*_dc_inflate)(p); } - - // Free used resources, do final translation of - // error value. - err = (*_dc_close)(p, err); - - if (0 != err && p->msg) { - diag_printf("decompression error: %s\n", p->msg); - } - - end = (unsigned long) base + p->out_size; - } else // dangling block #endif - { - unsigned char *mp = (unsigned char *)base; - while ((res = redboot_getc()) >= 0) { - *mp++ = res; - } - err = 0; - end = (unsigned long) mp; + *mp++ = res; } + end = (unsigned long) mp; // Save load base/top load_address = base; load_address_end = end; + entry_address = base; // best guess if (0 == err) - diag_printf("Raw file loaded %p-%p\n", (void *)base, (void *)end); + diag_printf("Raw file loaded %p-%p, assumed entry at %p\n", + (void *)base, (void *)end, (void*)base); } else { // Read initial header - to determine file [image] type for (i = 0; i < sizeof(type); i++) { @@ -529,19 +746,10 @@ do_load(int argc, char *argv[]) redboot_getc_rewind(); // Restore header to stream // Treat data as some sort of executable image if (strncmp(&type[1], "ELF", 3) == 0) { - end = load_elf_image(redboot_getc); + end = load_elf_image(redboot_getc, terminate, base); } else if ((type[0] == 'S') && ((type[1] >= '0') && (type[1] <= '9'))) { - switch (mode) { - case MODE_XMODEM: - case MODE_YMODEM: - case MODE_ZMODEM: - end = load_srec_image(redboot_getc, xyzModem_stream_terminate, base); - break; - default: - end = load_srec_image(redboot_getc, NULL, base); - break; - } + end = load_srec_image(redboot_getc, terminate, base); } else { diag_printf("Unrecognized image type: 0x%lx\n", *(unsigned long *)type); } @@ -563,5 +771,6 @@ do_load(int argc, char *argv[]) xyzModem_stream_close(&err); break; } + redboot_getc_close(); // Clean up return; } diff --git a/packages/redboot/current/src/main.c b/packages/redboot/current/src/main.c --- a/packages/redboot/current/src/main.c +++ b/packages/redboot/current/src/main.c @@ -5,29 +5,38 @@ // RedBoot main routine // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -95,11 +104,27 @@ RedBoot_cmd("x", "-b [-l ] [-s] [-1|2|4]", do_x ); +#ifdef CYGBLD_BUILD_REDBOOT_WITH_CKSUM RedBoot_cmd("cksum", "Compute a 32bit checksum [POSIX algorithm] for a range of memory", "-b -l ", do_cksum ); +#endif +#ifdef CYGBLD_BUILD_REDBOOT_WITH_MFILL +RedBoot_cmd("mfill", + "Fill a block of memory with a pattern", + "-b -l -p [-1|-2|-4]", + do_mfill + ); +#endif +#ifdef CYGBLD_BUILD_REDBOOT_WITH_MCMP +RedBoot_cmd("mcmp", + "Compare two blocks of memory", + "-s -d -l [-1|-2|-4]", + do_mcmp + ); +#endif RedBoot_cmd("cache", "Manage machine caches", "[ON | OFF]", @@ -137,9 +162,6 @@ extern struct idle_tab_entry __RedBoot_I extern void HAL_ARCH_PROGRAM_NEW_STACK(void *fun); #endif -#ifdef CYGSEM_REDBOOT_FLASH_ALIASES -externC void expand_aliases(char *line, int len); -#endif void do_version(int argc, char *argv[]) @@ -320,9 +342,7 @@ cyg_start(void) } else #endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { -#ifdef CYGSEM_REDBOOT_FLASH_ALIASES expand_aliases(line, sizeof(line)); -#endif command = (char *)&line; if ((*command == '#') || (*command == '=')) { // Special cases @@ -381,33 +401,42 @@ do_caches(int argc, char *argv[]) } } +void +show_help(struct cmd *cmd, struct cmd *cmd_end, char *which, char *pre) +{ + bool show; + int len = 0; + + if (which) { + len = strlen(which); + } + while (cmd != cmd_end) { + show = true; + if (which && (strncasecmp(which, cmd->str, len) != 0)) { + show = false; + } + if (show) { + diag_printf("%s\n %s %s %s\n", cmd->help, pre, cmd->str, cmd->usage); + if ((cmd->sub_cmds != (struct cmd *)0) && (which != (char *)0)) { + show_help(cmd->sub_cmds, cmd->sub_cmds_end, 0, cmd->str); + } + } + cmd++; + } +} void do_help(int argc, char *argv[]) { struct cmd *cmd; char *which = (char *)0; - bool show; - int len = 0; if (!scan_opts(argc, argv, 1, 0, 0, (void **)&which, OPTION_ARG_TYPE_STR, "")) { diag_printf("Invalid argument\n"); return; } - if (which) { - len = strlen(which); - } cmd = __RedBoot_CMD_TAB__; - while (cmd != &__RedBoot_CMD_TAB_END__) { - show = true; - if (which && (strncasecmp(which, cmd->str, len) != 0)) { - show = false; - } - if (show) { - diag_printf("%s\n %s %s\n", cmd->help, cmd->str, cmd->usage); - } - cmd++; - } + show_help(cmd, &__RedBoot_CMD_TAB_END__, which, ""); return; } @@ -419,10 +448,7 @@ do_dump(int argc, char *argv[]) bool base_set, len_set; static unsigned long _base, _len; static char _size = 1; - bool srec_dump; - bool set_32bit = false; - bool set_16bit = false; - bool set_8bit = false; + bool srec_dump, set_32bit, set_16bit, set_8bit; int i, n, off, cksum; cyg_uint8 ch; @@ -505,6 +531,7 @@ do_x(int argc, char *argv[]) do_dump(argc, argv); } +#ifdef CYGBLD_BUILD_REDBOOT_WITH_CKSUM void do_cksum(int argc, char *argv[]) { @@ -524,12 +551,146 @@ do_cksum(int argc, char *argv[]) return; } if (!base_set || !len_set) { - diag_printf("usage: cksum -b -l \n"); + if (load_address >= (CYG_ADDRESS)ram_start && + load_address_end < (CYG_ADDRESS)ram_end && + load_address < load_address_end) { + base = load_address; + len = load_address_end - load_address; + diag_printf("Computing cksum for area %p-%p\n", + base, load_address_end); + } else { + diag_printf("usage: cksum -b -l \n"); + return; + } + } + crc = posix_crc32((unsigned char *)base, len); + diag_printf("POSIX cksum = %lu %lu (0x%08lx 0x%08lx)\n", crc, len, crc, len); +} +#endif + +#ifdef CYGBLD_BUILD_REDBOOT_WITH_MFILL +void +do_mfill(int argc, char *argv[]) +{ + // Fill a region of memory with a pattern + struct option_info opts[6]; + unsigned long base, pat; + long len; + bool base_set, len_set, pat_set; + bool set_32bit, set_16bit, set_8bit; + + init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, + (void **)&base, (bool *)&base_set, "base address"); + init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, + (void **)&len, (bool *)&len_set, "length"); + init_opts(&opts[2], 'p', true, OPTION_ARG_TYPE_NUM, + (void **)&pat, (bool *)&pat_set, "pattern"); + init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG, + (void *)&set_32bit, (bool *)0, "fill 32 bit units"); + init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG, + (void **)&set_16bit, (bool *)0, "fill 16 bit units"); + init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG, + (void **)&set_8bit, (bool *)0, "fill 8 bit units"); + if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) { + return; + } + if (!base_set || !len_set) { + diag_printf("usage: mfill -b -l [-p ] [-1|-2|-4]\n"); return; } - crc = posix_crc32((unsigned char *)base, len); - diag_printf("POSIX cksum = 0x%08lx (%lu)\n", crc, crc); + if (!pat_set) { + pat = 0; + } + // No checks here + if (set_8bit) { + // Fill 8 bits at a time + while ((len -= sizeof(cyg_uint8)) >= 0) { + *((cyg_uint8 *)base)++ = (cyg_uint8)pat; + } + } else if (set_16bit) { + // Fill 16 bits at a time + while ((len -= sizeof(cyg_uint16)) >= 0) { + *((cyg_uint16 *)base)++ = (cyg_uint16)pat; + } + } else { + // Default - 32 bits + while ((len -= sizeof(cyg_uint32)) >= 0) { + *((cyg_uint32 *)base)++ = (cyg_uint32)pat; + } + } } +#endif + +#ifdef CYGBLD_BUILD_REDBOOT_WITH_MCMP +void +do_mcmp(int argc, char *argv[]) +{ + // Fill a region of memory with a pattern + struct option_info opts[6]; + unsigned long src_base, dst_base; + long len; + bool src_base_set, dst_base_set, len_set; + bool set_32bit, set_16bit, set_8bit; + + init_opts(&opts[0], 's', true, OPTION_ARG_TYPE_NUM, + (void **)&src_base, (bool *)&src_base_set, "base address"); + init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, + (void **)&len, (bool *)&len_set, "length"); + init_opts(&opts[2], 'd', true, OPTION_ARG_TYPE_NUM, + (void **)&dst_base, (bool *)&dst_base_set, "base address"); + init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG, + (void *)&set_32bit, (bool *)0, "fill 32 bit units"); + init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG, + (void **)&set_16bit, (bool *)0, "fill 16 bit units"); + init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG, + (void **)&set_8bit, (bool *)0, "fill 8 bit units"); + if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) { + return; + } + if (!src_base_set || !dst_base_set || !len_set) { + diag_printf("usage: mcmp -s -d -l [-1|-2|-4]\n"); + return; + } + // No checks here + if (set_8bit) { + // Compare 8 bits at a time + while ((len -= sizeof(cyg_uint8)) >= 0) { + if (*((cyg_uint8 *)src_base)++ != *((cyg_uint8 *)dst_base)++) { + ((cyg_uint8 *)src_base)--; + ((cyg_uint8 *)dst_base)--; + diag_printf("Buffers don't match - %p=0x%02x, %p=0x%02x\n", + src_base, *((cyg_uint8 *)src_base), + dst_base, *((cyg_uint8 *)dst_base)); + return; + } + } + } else if (set_16bit) { + // Compare 16 bits at a time + while ((len -= sizeof(cyg_uint16)) >= 0) { + if (*((cyg_uint16 *)src_base)++ != *((cyg_uint16 *)dst_base)++) { + ((cyg_uint16 *)src_base)--; + ((cyg_uint16 *)dst_base)--; + diag_printf("Buffers don't match - %p=0x%04x, %p=0x%04x\n", + src_base, *((cyg_uint16 *)src_base), + dst_base, *((cyg_uint16 *)dst_base)); + return; + } + } + } else { + // Default - 32 bits + while ((len -= sizeof(cyg_uint32)) >= 0) { + if (*((cyg_uint32 *)src_base)++ != *((cyg_uint32 *)dst_base)++) { + ((cyg_uint32 *)src_base)--; + ((cyg_uint32 *)dst_base)--; + diag_printf("Buffers don't match - %p=0x%08x, %p=0x%08x\n", + src_base, *((cyg_uint32 *)src_base), + dst_base, *((cyg_uint32 *)dst_base)); + return; + } + } + } +} +#endif void do_go(int argc, char *argv[]) @@ -601,27 +762,39 @@ do_reset(int argc, char *argv[]) #include #endif -void +int set_console_baud_rate(int rate) { hal_virtual_comm_table_t *__chan; - int ret; static int current_rate = CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD; + int ret = current_rate; if (rate != current_rate) { __chan = CYGACC_CALL_IF_CONSOLE_PROCS(); ret = CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_SETBAUD, rate); - if (ret <= 0) { - diag_printf("Failed\n"); + if (ret < 0) { + diag_printf("Setting console baud rate to %d failed\n", rate); + return ret; } + ret = current_rate; current_rate = rate; } + return ret; +} + +static void +_sleep(int ms) +{ + int i; + for (i = 0; i < ms; i++) { + CYGACC_CALL_IF_DELAY_US((cyg_int32)1000); + } } void do_baud_rate(int argc, char *argv[]) { - int new_rate, ret; + int new_rate, ret, old_rate; bool new_rate_set; hal_virtual_comm_table_t *__chan; struct option_info opts[1]; @@ -636,6 +809,29 @@ do_baud_rate(int argc, char *argv[]) } __chan = CYGACC_CALL_IF_CONSOLE_PROCS(); if (new_rate_set) { + diag_printf("Baud rate will be changed to %d - update your settings\n", new_rate); + _sleep(500); // Give serial time to flush + old_rate = CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_GETBAUD); + ret = set_console_baud_rate(new_rate); + if (ret < 0) { + if (old_rate > 0) { + // Try to restore + set_console_baud_rate(old_rate); + _sleep(500); // Give serial time to flush + diag_printf("\nret = %d\n", ret); + } + return; // Couldn't set the desired rate + } + old_rate = ret; + // Make sure this new rate works or back off to previous value + // Sleep for a few seconds, then prompt to see if it works + _sleep(3000); // Give serial time to flush + if (!verify_action_with_timeout(5000, "Baud rate changed to %d", new_rate)) { + _sleep(500); // Give serial time to flush + set_console_baud_rate(old_rate); + _sleep(500); // Give serial time to flush + return; + } #ifdef CYGSEM_REDBOOT_FLASH_CONFIG opt.type = CONFIG_INT; opt.enable = (char *)0; @@ -644,7 +840,6 @@ do_baud_rate(int argc, char *argv[]) opt.dflt = new_rate; flash_add_config(&opt, true); #endif - set_console_baud_rate(new_rate); } else { ret = CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_GETBAUD); diag_printf("Baud rate = "); diff --git a/packages/redboot/current/src/misc_funs.c b/packages/redboot/current/src/misc_funs.c --- a/packages/redboot/current/src/misc_funs.c +++ b/packages/redboot/current/src/misc_funs.c @@ -5,29 +5,38 @@ // Miscellaneous [library] functions for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/net/arp.c b/packages/redboot/current/src/net/arp.c --- a/packages/redboot/current/src/net/arp.c +++ b/packages/redboot/current/src/net/arp.c @@ -5,29 +5,38 @@ // Stand-alone ARP support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/net/bootp.c b/packages/redboot/current/src/net/bootp.c --- a/packages/redboot/current/src/net/bootp.c +++ b/packages/redboot/current/src/net/bootp.c @@ -5,29 +5,38 @@ // Stand-alone minimal BOOTP support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -52,7 +61,8 @@ extern int net_debug; #define SHOULD_BE_RANDOM 0x12345555 /* How many milliseconds to wait before retrying the request */ -#define RETRY_TIME 2000 +#define RETRY_TIME 1000 +#define MAX_RETRIES 30 static bootp_header_t *bp_info; @@ -119,7 +129,7 @@ int /* setup a socket listener for bootp replies */ __udp_install_listener(&udp_skt, IPPORT_BOOTPC, bootp_handler); - retry = 3; + retry = MAX_RETRIES; while (retry-- > 0) { start = MS_TICKS(); diff --git a/packages/redboot/current/src/net/cksum.c b/packages/redboot/current/src/net/cksum.c --- a/packages/redboot/current/src/net/cksum.c +++ b/packages/redboot/current/src/net/cksum.c @@ -5,29 +5,38 @@ // Stand-alone network checksum support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -56,13 +65,13 @@ unsigned short int sum = init_sum; union { - unsigned char c[2]; - unsigned short s; + volatile unsigned char c[2]; + volatile unsigned short s; } su; union { - unsigned short s[2]; - int i; + volatile unsigned short s[2]; + volatile int i; } iu; while ((len -= 2) >= 0) @@ -95,8 +104,8 @@ int word *p; union { - unsigned char c[2]; - unsigned short s; + volatile unsigned char c[2]; + volatile unsigned short s; } su; p = (word *)ip->source; diff --git a/packages/redboot/current/src/net/dns.c b/packages/redboot/current/src/net/dns.c new file mode 100644 --- /dev/null +++ b/packages/redboot/current/src/net/dns.c @@ -0,0 +1,267 @@ +//============================================================================= +// +// dns.c +// +// DNS client code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-09-26 +// Description: Provides DNS lookup as per RFC 1034/1035. +// +// Note: This is a stripped down clone of dns.c from the CYGPKG_NS_DNS +// package which does not use malloc/free and has been tweaked to +// use UDP via RedBoot's network stack. Also adds commands +// to set the DNS server IP at runtime. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include /* Tracing support */ + +#include +#include +/* #include - it's been moved to redboot.h */ +#include + +#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +#include + +RedBoot_config_option("DNS server IP address", + dns_ip, + ALWAYS_ENABLED, true, + CONFIG_IP, + 0 + ); +#endif + +/* So we remember which ports have been used */ +static int get_port = 7700; + +#define DOMAIN_PORT 53 + +/* Some magic to make dns_impl.inl compile under RedBoot */ +#define sprintf diag_sprintf +static cyg_addrword_t _thread_data; +static cyg_addrword_t cyg_thread_get_data(int i) { return _thread_data; } +static void cyg_thread_set_data(int i, cyg_addrword_t data) { _thread_data = data; } + +struct sockaddr_in server; + +/* static buffers so we can make do without malloc */ +static struct hostent _hent; +static char* _h_addr_list[2]; +static struct in_addr _h_addr_list0; +static int _hent_alloc = 0; + +#define _STRING_COUNT 2 +#define _STRING_LENGTH 64 +static char _strings[_STRING_COUNT][_STRING_LENGTH]; +static int _strings_alloc = 0; + +/* as in dns.c proper */ +static short id = 0; /* ID of the last query */ +static int s = -1; /* Socket to the DNS server */ +static cyg_drv_mutex_t dns_mutex; /* Mutex to stop multiple queries as once */ +static cyg_ucount32 ptdindex; /* Index for the per thread data */ +static char * domainname=NULL; /* Domain name used for queries */ + + +/* Allocate space for string of length (len). Return NULL on + failure. */ +static char* +alloc_string(int len) +{ + int i; + + if (len > _STRING_LENGTH) + return NULL; + + for (i = 0; i < _STRING_COUNT; i++) { + if (_strings_alloc & (1 << i)) continue; + _strings_alloc |= (1<h_name) { + free_string(hent->h_name); + } + _hent_alloc = 0; +} + +/* Allocate hent structure with room for one in_addr. Returns NULL on + failure. */ +static struct hostent* +alloc_hent(void) +{ + struct hostent *hent; + + if (_hent_alloc) return NULL; + + hent = &_hent; + memset(hent, 0, sizeof(struct hostent)); + hent->h_addr_list = _h_addr_list; + hent->h_addr_list[0] = (char*)&_h_addr_list0; + hent->h_addr_list[1] = NULL; + _hent_alloc = 1; + + return hent; +} + +/* Send the query to the server and read the response back. Return -1 + if it fails, otherwise put the response back in msg and return the + length of the response. */ +static int +send_recv(char * msg, int len, int msglen) +{ + struct dns_header *dns_hdr; + int finished = false; + int read = 0; + + dns_hdr = (struct dns_header *) msg; + + do { + int len_togo = len; + struct timeval timeout; + struct sockaddr_in local_addr, from_addr; + + memset((char *)&local_addr, 0, sizeof(local_addr)); + local_addr.sin_family = AF_INET; + local_addr.sin_addr.s_addr = htonl(INADDR_ANY); + local_addr.sin_port = htons(get_port++); + + if (__udp_sendto(msg, len_togo, &server, &local_addr) < 0) + return -1; + + memset((char *)&from_addr, 0, sizeof(from_addr)); + + timeout.tv_sec = CYGNUM_REDBOOT_NETWORKING_DNS_TIMEOUT; + timeout.tv_usec = 0; + + read = __udp_recvfrom(msg, len, &from_addr, &local_addr, &timeout); + if (read < 0) + return -1; + + /* Reply to an old query. Ignore it */ + if (ntohs(dns_hdr->id) != (id-1)) { + continue; + } + finished = true; + } while (!finished); + + return read; +} + +void +set_dns(char* new_ip) +{ + in_addr_t dns_ip; + + memset(&server.sin_addr, 0, sizeof(server.sin_addr)); + if (!inet_aton(new_ip, &dns_ip)) { + diag_printf("Bad DNS server address: %s\n", new_ip); + } else { + memcpy(&server.sin_addr, &dns_ip, sizeof(dns_ip)); + /* server config is valid */ + s = 0; + } +} + +void +show_dns(void) +{ + diag_printf(", DNS server IP: %s", inet_ntoa((in_addr_t *)&server.sin_addr)); + if (0 == server.sin_addr.s_addr) { + s = -1; + } +} + +/* Initialise the resolver. Open a socket and bind it to the address + of the server. return -1 if something goes wrong, otherwise 0 */ +int +redboot_dns_res_init(void) +{ + memset((char *)&server, 0, sizeof(server)); + server.sin_len = sizeof(server); + server.sin_family = AF_INET; + server.sin_port = htons(DOMAIN_PORT); + cyg_drv_mutex_init(&dns_mutex); + +#ifdef CYGSEM_REDBOOT_FLASH_CONFIG + { + ip_addr_t dns_ip; + + flash_get_config("dns_ip", &dns_ip, CONFIG_IP); + if (dns_ip[0] == 0 && dns_ip[1] == 0 && dns_ip[2] == 0 && dns_ip[3] == 0) + return -1; + memcpy(&server.sin_addr, &dns_ip, sizeof(dns_ip)); + /* server config is valid */ + s = 0; + } +#else + // Use static configuration + set_dns(__Xstr(CYGPKG_REDBOOT_NETWORKING_DNS_IP)); +#endif + + return 0; +} + +/* Include the DNS client implementation code */ +#include diff --git a/packages/redboot/current/src/net/enet.c b/packages/redboot/current/src/net/enet.c --- a/packages/redboot/current/src/net/enet.c +++ b/packages/redboot/current/src/net/enet.c @@ -5,29 +5,38 @@ // Stand-alone ethernet [link-layer] support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -45,7 +54,7 @@ #include #include -#include // Logical driver interfaces +#include // Logical driver interfaces //#define ENET_STATS 1 diff --git a/packages/redboot/current/src/net/icmp.c b/packages/redboot/current/src/net/icmp.c --- a/packages/redboot/current/src/net/icmp.c +++ b/packages/redboot/current/src/net/icmp.c @@ -5,29 +5,38 @@ // Stand-alone ICMP networking support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/net/inet_addr.c b/packages/redboot/current/src/net/inet_addr.c --- a/packages/redboot/current/src/net/inet_addr.c +++ b/packages/redboot/current/src/net/inet_addr.c @@ -5,29 +5,38 @@ // Stand-alone IP address parsing for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/net/ip.c b/packages/redboot/current/src/net/ip.c --- a/packages/redboot/current/src/net/ip.c +++ b/packages/redboot/current/src/net/ip.c @@ -5,29 +5,38 @@ // Stand-alone IP networking support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/net/net_io.c b/packages/redboot/current/src/net/net_io.c --- a/packages/redboot/current/src/net/net_io.c +++ b/packages/redboot/current/src/net/net_io.c @@ -5,29 +5,38 @@ // Stand-alone network logical I/O support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -44,7 +53,7 @@ //========================================================================== #include -#include // Logical driver interfaces +#include // Logical driver interfaces #include #include // Helper functions #include // HAL I/O interfaces @@ -91,6 +100,20 @@ RedBoot_config_option("Default server IP CONFIG_IP, 0 ); + +// Note: the following options are related too. +RedBoot_config_option("Force console for special debug messages", + info_console_force, + ALWAYS_ENABLED, true, + CONFIG_BOOL, + false + ); +RedBoot_config_option("Console number for special debug messages", + info_console_number, + "info_console_force", true, + CONFIG_INT, + 0 + ); #endif #define TCP_CHANNEL CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS @@ -413,9 +436,21 @@ net_io_isr(void *__ch_data, int* __ctrlc int start_console(void) { - int cur_console; - cur_console = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); - CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGDBG_REDBOOT_NET_DEBUG_CONSOLE_NUMBER); + int cur_console = + CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + +#ifdef CYGSEM_REDBOOT_FLASH_CONFIG + int i = 0; + if ( flash_get_config( "info_console_force", &i, CONFIG_BOOL) ) + if ( i ) + if ( ! flash_get_config( "info_console_number", &i, CONFIG_INT) ) + i = 0; // the default, if that call failed. + if ( i ) + CYGACC_CALL_IF_SET_CONSOLE_COMM(i); + else +#endif + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + return cur_console; } @@ -518,8 +553,8 @@ RedBoot_idle(net_io_test, RedBoot_IDLE_N // // Network initialization // -#include -#include +#include +#include #include // Define table boundaries @@ -528,6 +563,17 @@ CYG_HAL_TABLE_END( __NETDEVTAB_END__, ne RedBoot_init(net_init, RedBoot_INIT_LAST); +static void +show_addrs(void) +{ + diag_printf("IP: %s", inet_ntoa((in_addr_t *)&__local_ip_addr)); + diag_printf(", Default server: %s", inet_ntoa(&my_bootp_info.bp_siaddr)); +#ifdef CYGPKG_REDBOOT_NETWORKING_DNS + show_dns(); +#endif + diag_printf("\n"); +} + void net_init(void) { @@ -540,7 +586,7 @@ net_init(void) use_bootp = true; #endif #ifdef CYGDBG_REDBOOT_NET_DEBUG - net_debug = CYGDBG_REDBOOT_NET_DEBUG; + net_debug = true; #else net_debug = false; #endif @@ -622,9 +668,7 @@ net_init(void) __local_enet_addr[3], __local_enet_addr[4], __local_enet_addr[5]); - - diag_printf("IP: %s", inet_ntoa((in_addr_t *)&__local_ip_addr)); - diag_printf(", Default server: %s\n", inet_ntoa(&my_bootp_info.bp_siaddr)); + show_addrs(); net_io_init(); } @@ -632,3 +676,68 @@ net_init(void) redboot_dns_res_init(); #endif } + +static char usage[] = "[-l ] [-h ]"; + +// Exported CLI function +static void do_ip_addr(int argc, char *argv[]); +RedBoot_cmd("ip_address", + "Set/change IP addresses", + usage, + do_ip_addr + ); + +void +do_ip_addr(int argc, char *argv[]) +{ + struct option_info opts[3]; + char *ip_addr, *host_addr; + bool ip_addr_set, host_addr_set; + struct sockaddr_in host; +#ifdef CYGPKG_REDBOOT_NETWORKING_DNS + char *dns_addr; + bool dns_addr_set; +#endif + int num_opts; + + init_opts(&opts[0], 'l', true, OPTION_ARG_TYPE_STR, + (void **)&ip_addr, (bool *)&ip_addr_set, "local IP address"); + init_opts(&opts[1], 'h', true, OPTION_ARG_TYPE_STR, + (void **)&host_addr, (bool *)&host_addr_set, "default server address"); + num_opts = 2; +#ifdef CYGPKG_REDBOOT_NETWORKING_DNS + init_opts(&opts[2], 'd', true, OPTION_ARG_TYPE_STR, + (void **)&dns_addr, (bool *)&dns_addr_set, "DNS server address"); + num_opts++; +#endif + if (!scan_opts(argc, argv, 1, opts, num_opts, 0, 0, "")) { + return; + } + if (ip_addr_set) { + if (!_gethostbyname(ip_addr, (in_addr_t *)&host)) { + diag_printf("Invalid local IP address: %s\n", ip_addr); + return; + } + // Of course, each address goes in its own place :-) + memcpy(&__local_ip_addr, &host.sin_addr, sizeof(host.sin_addr)); + } + if (host_addr_set) { + if (!_gethostbyname(host_addr, (in_addr_t *)&host)) { + diag_printf("Invalid server address: %s\n", host_addr); + return; + } + my_bootp_info.bp_siaddr = host.sin_addr; + } +#ifdef CYGPKG_REDBOOT_NETWORKING_DNS + if (dns_addr_set) { + set_dns(dns_addr); + } +#endif + show_addrs(); + if (!have_net) { + have_net = true; + net_io_init(); + } +} + +// EOF net_io.c diff --git a/packages/redboot/current/src/net/ping.c b/packages/redboot/current/src/net/ping.c --- a/packages/redboot/current/src/net/ping.c +++ b/packages/redboot/current/src/net/ping.c @@ -5,29 +5,38 @@ // Network utility - ping // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/net/pktbuf.c b/packages/redboot/current/src/net/pktbuf.c --- a/packages/redboot/current/src/net/pktbuf.c +++ b/packages/redboot/current/src/net/pktbuf.c @@ -5,29 +5,38 @@ // Stand-alone network packet support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/net/tcp.c b/packages/redboot/current/src/net/tcp.c --- a/packages/redboot/current/src/net/tcp.c +++ b/packages/redboot/current/src/net/tcp.c @@ -5,29 +5,38 @@ // Stand-alone TCP networking support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -152,12 +161,62 @@ tcp_send(tcp_socket_t *s, int flags, int BSPLOG(bsp_log("tcp_send: state[%d] flags[%s] ack[%x] data[%d].\n", s->state, flags_to_str(tcp->flags), s->ack, s->data_bytes)); - if (s->state == _TIME_WAIT) - __timer_set(&s->timer, 120000, do_close, s); + if (s->state == _TIME_WAIT) { + // If 'reuse' is set on socket, close after 1 second, otherwise 2 minutes + __timer_set(&s->timer, s->reuse ? 1000 : 120000, do_close, s); + } else if ((tcp->flags & (TCP_FLAG_FIN | TCP_FLAG_SYN)) || s->data_bytes) __timer_set(&s->timer, 1000, do_retrans, s); } +static pktbuf_t ack_pkt; +static word ack_buf[ETH_MIN_PKTLEN/sizeof(word)]; + +/* + * Send an ack. + */ +static void +send_ack(tcp_socket_t *s) +{ + tcp_header_t *tcp; + ip_header_t *ip; + unsigned short cksum; + + ack_pkt.buf = ack_buf; + ack_pkt.bufsize = sizeof(ack_buf); + ack_pkt.ip_hdr = ip = (ip_header_t *)ack_buf; + ack_pkt.tcp_hdr = tcp = (tcp_header_t *)(ip + 1); + ack_pkt.pkt_bytes = sizeof(tcp_header_t); + + /* tcp header */ + tcp->hdr_len = 5; + tcp->reserved = 0; + tcp->seqnum = htonl(s->seq); + tcp->acknum = htonl(s->ack); + tcp->checksum = 0; + + tcp->src_port = htons(s->our_port); + tcp->dest_port = htons(s->his_port); + tcp->flags = TCP_FLAG_ACK; + + tcp->window = htons(MAX_TCP_DATA); + tcp->urgent = 0; + + /* fill in some pseudo-header fields */ + memcpy(ip->source, __local_ip_addr, sizeof(ip_addr_t)); + memcpy(ip->destination, s->his_addr.ip_addr, sizeof(ip_addr_t)); + ip->protocol = IP_PROTO_TCP; + + /* another pseudo-header field */ + ip->length = htons(sizeof(tcp_header_t)); + + /* compute tcp checksum */ + cksum = __sum((word *)tcp, sizeof(*tcp), __pseudo_sum(ip)); + tcp->checksum = htons(cksum); + + __ip_send(&ack_pkt, IP_PROTO_TCP, &s->his_addr); +} + /* * Send a reset for a bogus incoming segment. @@ -414,7 +473,6 @@ void s->his_port = ntohs(tcp->src_port); memcpy(s->his_addr.ip_addr, r->ip_addr, sizeof(ip_addr_t)); s->data_bytes = 0; - s->ack_pending = 0; BSPLOG(bsp_log("SYN from %d.%d.%d.%d:%d (seq %x)\n", s->his_addr.ip_addr[0],s->his_addr.ip_addr[1], @@ -472,20 +530,8 @@ void /* * Send an ack if neccessary. */ - if (s->ack != ack || s->ack_pending) { - /* - * we can't send an ack if our write packet is holding outgoing - * data pending an incoming ack. - */ - if (s->data_bytes == 0) { - BSPLOG(bsp_log("Sending ack: new[%x] old[%x]\n", - s->ack, ack)); - __timer_cancel(&s->timer); - tcp_send(s, TCP_FLAG_ACK, 0); - s->ack_pending = 0; - } else - s->ack_pending = 1; - } + if (s->ack != ack || pkt->pkt_bytes > (tcp->hdr_len << 2)) + send_ack(s); break; case _LAST_ACK: @@ -509,18 +555,27 @@ void BSPLOG(bsp_log("_FIN_WAIT_1 --> _TIME_WAIT\n")); s->ack++; s->state = _TIME_WAIT; - tcp_send(s, TCP_FLAG_ACK, 0); + send_ack(s); } else { s->state = _FIN_WAIT_2; BSPLOG(bsp_log("_FIN_WAIT_1 --> _FIN_WAIT_2\n")); } + break; /* All done for now */ } } + /* At this point, no ACK for FIN has been seen, so check for + simultaneous close */ if (tcp->flags & TCP_FLAG_FIN) { BSPLOG(bsp_log("_FIN_WAIT_1 --> _CLOSING\n")); __timer_cancel(&s->timer); s->ack++; s->state = _CLOSING; + /* FIN is resent so the timeout and retry for this packet + will also take care of timeout and resend of the + previously sent FIN (which got us to FIN_WAIT_1). While + not technically correct, resending FIN only causes a + duplicate FIN (same sequence number) which should be + ignored by the other end. */ tcp_send(s, TCP_FLAG_FIN | TCP_FLAG_ACK, 0); } break; @@ -531,7 +586,7 @@ void BSPLOG(bsp_log("_FIN_WAIT_2 --> _TIME_WAIT\n")); s->ack++; s->state = _TIME_WAIT; - tcp_send(s, TCP_FLAG_ACK, 0); + send_ack(s); } break; @@ -602,6 +657,15 @@ int return 0; } +/* + * SO_REUSEADDR, no 2MSL. + */ +void +__tcp_so_reuseaddr(tcp_socket_t *s) +{ +// BSPLOG(bsp_log("__tcp_so_reuseaddr.\n")); + s->reuse = 0x01; +} /* * Block while waiting for all data to be transmitted. diff --git a/packages/redboot/current/src/net/tftp_client.c b/packages/redboot/current/src/net/tftp_client.c --- a/packages/redboot/current/src/net/tftp_client.c +++ b/packages/redboot/current/src/net/tftp_client.c @@ -5,29 +5,38 @@ // Stand-alone TFTP support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/net/timers.c b/packages/redboot/current/src/net/timers.c --- a/packages/redboot/current/src/net/timers.c +++ b/packages/redboot/current/src/net/timers.c @@ -5,29 +5,38 @@ // Stand-alone networking support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/net/udp.c b/packages/redboot/current/src/net/udp.c --- a/packages/redboot/current/src/net/udp.c +++ b/packages/redboot/current/src/net/udp.c @@ -5,29 +5,38 @@ // Stand-alone UDP networking support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/parse.c b/packages/redboot/current/src/parse.c --- a/packages/redboot/current/src/parse.c +++ b/packages/redboot/current/src/parse.c @@ -5,29 +5,38 @@ // RedBoot command line parsing routine // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/syscall.c b/packages/redboot/current/src/syscall.c --- a/packages/redboot/current/src/syscall.c +++ b/packages/redboot/current/src/syscall.c @@ -5,29 +5,38 @@ // Redboot syscall handling for GNUPro bsp support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -46,39 +55,8 @@ #ifdef CYGSEM_REDBOOT_BSP_SYSCALLS -#define EIO 5 /* I/O error */ - -// These are required by the ANSI C part of newlib (excluding system() of -// course). -#define SYS_exit 1 -#define SYS_open 2 -#define SYS_close 3 -#define SYS_read 4 -#define SYS_write 5 -#define SYS_lseek 6 -#define SYS_unlink 7 -#define SYS_getpid 8 -#define SYS_kill 9 -#define SYS_fstat 10 -//#define SYS_sbrk 11 - not currently a system call, but reserved. - -// ARGV support. -#define SYS_argvlen 12 -#define SYS_argv 13 - -// These are extras added for one reason or another. -#define SYS_chdir 14 -#define SYS_stat 15 -#define SYS_chmod 16 -#define SYS_utime 17 -#define SYS_time 18 -#define SYS_times 20 - -#define SYS_interrupt 1000 -#define SYS_meminfo 1001 - -#define __GET_SHARED 0xbaad // 47789 decimal - +#define NEWLIB_EIO 5 /* I/O error */ +#define NEWLIB_ENOSYS 88 /* Syscall not supported */ /* * Clients of this BSP will need to have access to BSP functions and @@ -110,6 +88,51 @@ typedef struct { static __shared_t __shared_data = { 2 }; +// this is used by newlib's mode_t so we should match it +#ifdef __GNUC__ +#define _ST_INT32 __attribute__ ((__mode__ (__SI__))) +#else +#define _ST_INT32 +#endif +typedef unsigned int newlib_mode_t _ST_INT32; +typedef short newlib_dev_t; +typedef unsigned short newlib_ino_t; +typedef unsigned short newlib_nlink_t; +typedef long newlib_off_t; +typedef unsigned short newlib_uid_t; +typedef unsigned short newlib_gid_t; +typedef long newlib_time_t; +typedef long newlib_long_t; + +struct newlib_stat +{ + newlib_dev_t st_dev; + newlib_ino_t st_ino; + newlib_mode_t st_mode; + newlib_nlink_t st_nlink; + newlib_uid_t st_uid; + newlib_gid_t st_gid; + newlib_dev_t st_rdev; + newlib_off_t st_size; + // We assume we've been compiled with the same flags as newlib here +#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) + newlib_time_t st_atime; + newlib_time_t st_mtime; + newlib_time_t st_ctime; +#else + newlib_time_t st_atime; + newlib_long_t st_spare1; + newlib_time_t st_mtime; + newlib_long_t st_spare2; + newlib_time_t st_ctime; + newlib_long_t st_spare3; + newlib_long_t st_blksize; + newlib_long_t st_blocks; + newlib_long_t st_spare4[2]; +#endif +}; +#define NEWLIB_S_IFCHR 0020000 // character special file + static inline char __getc(void) { char c; @@ -136,11 +159,30 @@ static inline void __putc(char c) } +static inline void __flush(void) +{ + hal_virtual_comm_table_t* __chan = CYGACC_CALL_IF_CONSOLE_PROCS(); + + if (__chan == NULL) + __chan = CYGACC_CALL_IF_DEBUG_PROCS(); + + CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_FLUSH_OUTPUT); +} + // Timer support static cyg_handle_t sys_timer_handle; static cyg_interrupt sys_timer_interrupt; -static cyg_uint32 sys_timer_ticks = 0; +static cyg_uint64 sys_timer_ticks = 0; + +#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF + +static unsigned int set_period = CYGNUM_HAL_RTC_PERIOD; // The default + +typedef void *callback_func( char *pc, char *sp ); +static callback_func *timer_callback = 0; + +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF static void sys_timer_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) @@ -154,17 +196,44 @@ sys_timer_isr(cyg_vector_t vector, cyg_a { ++sys_timer_ticks; +#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF + HAL_CLOCK_RESET(CYGNUM_HAL_INTERRUPT_RTC, set_period); +#else HAL_CLOCK_RESET(CYGNUM_HAL_INTERRUPT_RTC, CYGNUM_HAL_RTC_PERIOD); +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF cyg_drv_interrupt_acknowledge(CYGNUM_HAL_INTERRUPT_RTC); +#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF + if ( timer_callback ) { + char *intrpc = (char *)0; + char *intrsp = (char *)0; + + // There may be a number of ways to get the PC and (optional) SP + // information out of the HAL. Hence this is conditioned. In some + // configurations, a register-set pointer is available as + // (invisible) argument 3 to this ISR call. + +#ifdef HAL_GET_PROFILE_INFO + HAL_GET_PROFILE_INFO( intrpc, intrsp ); +#endif // HAL_GET_PROFILE_INFO available + + CYGARC_HAL_SAVE_GP(); + timer_callback( intrpc, intrsp ); + CYGARC_HAL_RESTORE_GP(); + } +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF return 0; } static void sys_timer_init(void) { +#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF + HAL_CLOCK_INITIALIZE(set_period); +#else HAL_CLOCK_INITIALIZE(CYGNUM_HAL_RTC_PERIOD); +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF cyg_drv_interrupt_create( CYGNUM_HAL_INTERRUPT_RTC, @@ -181,6 +250,7 @@ static void sys_timer_init(void) } +#ifndef CYGPKG_HAL_GDB_FILEIO // // read -- read bytes from the serial port. Ignore fd, since // we only have stdin. @@ -219,6 +289,7 @@ sys_write(int fd, char *buf, int nbytes) __putc(*buf++); tosend--; } + __flush(); return (nbytes); } @@ -231,10 +302,9 @@ sys_write(int fd, char *buf, int nbytes) static int sys_open (const char *buf, int flags, int mode) { - return (-EIO); + return (-NEWLIB_EIO); } - // // close -- We don't need to do anything, but pretend we did. // @@ -251,15 +321,21 @@ sys_close(int fd) static int sys_lseek(int fd, int offset, int whence) { - return (-EIO); + return (-NEWLIB_EIO); } + +#endif // ifdef CYGPKG_HAL_GDB_FILEIO + #define NS_PER_TICK (CYGNUM_HAL_RTC_NUMERATOR/CYGNUM_HAL_RTC_DENOMINATOR) -#define TICKS_PER_SEC (1000000000L / NS_PER_TICK) +#define TICKS_PER_SEC (1000000000ULL / NS_PER_TICK) // This needs to match newlib HZ which is normally 60. -#define HZ 60 +#define HZ (60ULL) +#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF +static unsigned int set_freq = TICKS_PER_SEC; // The default +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF static int sys_times(unsigned long *p) { @@ -272,11 +348,84 @@ sys_times(unsigned long *p) /* target clock runs at CLOCKS_PER_SEC. Convert to HZ */ if (p) +#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF + *p = (sys_timer_ticks * HZ) / (cyg_uint64)set_freq; +#else *p = (sys_timer_ticks * HZ) / TICKS_PER_SEC; +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF return 0; } +#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF + +static void sys_profile_call_back( char *func, char **previous_call_back ) +{ + if ( previous_call_back ) + *previous_call_back = (char *)timer_callback; + + timer_callback = (callback_func *)func; + + // Ensure the timer is started + (void)sys_times( (unsigned long *)0 ); +} + +static void sys_profile_frequency( int freq, int *previous_freq ) +{ +// Requested HZ: +// 0 => tell me the current value (no change, IMPLEMENTED HERE) +// - 1 => tell me the slowest (no change) +// - 2 => tell me the default (no change, IMPLEMENTED HERE) +// -nnn => tell me what you would choose for nnn (no change) +// MIN_INT => tell me the fastest (no change) +// +// 1 => tell me the slowest (sets the clock) +// MAX_INT => tell me the fastest (sets the clock) + + // Ensure the timer is started + (void)sys_times( (unsigned long *)0 ); + + if ( -2 == freq ) + freq = TICKS_PER_SEC; // default value + else if ( 0 == freq ) + freq = set_freq; // collect current value + else { + int do_set_freq = (freq > 0); + unsigned int period = CYGNUM_HAL_RTC_PERIOD; + + if ( 0 == (freq ^ -freq) ) // Then it's MIN_INT in local size + freq++; // just so that it will negate correctly + + // Then set the timer to that fast - or pass on the enquiry +#ifdef HAL_CLOCK_REINITIALIZE + // Give the HAL enough info to do the division sum relative to + // the default setup, in period and TICKS_PER_SEC. + HAL_CLOCK_REINITIALIZE( freq, period, TICKS_PER_SEC ); +#else + freq = TICKS_PER_SEC; // the only choice +#endif + if ( do_set_freq ) { // update the global variables + unsigned int orig = set_freq; + set_freq = freq; + set_period = period; + // We must "correct" sys_timer_ticks for the new scale factor. + sys_timer_ticks = sys_timer_ticks * set_freq / orig; + } + } + + if ( previous_freq ) // Return the current value (new value) + *previous_freq = freq; +} + +void sys_profile_reset( void ) +{ + timer_callback = NULL; +// Want to preserve the frequency between runs, for clever GDB users! +// sys_profile_frequency( TICKS_PER_SEC, NULL ); +} + +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF + // // Generic syscall handler. // @@ -288,31 +437,148 @@ CYG_ADDRWORD __do_syscall(CYG_ADDRWORD func, // syscall function number CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, // up to four args. CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, - CYG_ADDRWORD *retval) // syscall return value + CYG_ADDRWORD *retval, CYG_ADDRWORD *sig) // syscall return value { int err = 0; + *sig = 0; switch (func) { +#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol + case SYS_open: + { + __externC int cyg_hal_gdbfileio_open( const char *name, int flags, + int mode, int *sig ); + err = cyg_hal_gdbfileio_open((const char *)arg1, (int)arg2, (int)arg3, + (int *)sig); + break; + } + case SYS_read: + { + __externC int cyg_hal_gdbfileio_read( int fd, void *buf, size_t count, + int *sig ); + err = cyg_hal_gdbfileio_read((int)arg1, (void *)arg2, (size_t)arg3, + (int *)sig); + break; + } + case SYS_write: + { + __externC int cyg_hal_gdbfileio_write( int fd, const void *buf, + size_t count, int *sig ); + err = cyg_hal_gdbfileio_write((int)arg1, (const void *)arg2, + (size_t)arg3, (int *)sig); + break; + } + case SYS_close: + { + __externC int cyg_hal_gdbfileio_close( int fd, int *sig ); + err = cyg_hal_gdbfileio_close((int)arg1, (int *)sig); + break; + } + case SYS_lseek: + { + __externC int cyg_hal_gdbfileio_lseek( int fd, long offset, + int whence, int *sig ); + err = cyg_hal_gdbfileio_lseek((int)arg1, (long)arg2, (int)arg3, + (int *)sig); + break; + } + case SYS_stat: + { + __externC int cyg_hal_gdbfileio_stat( const char *pathname, + void *statbuf, int *sig ); + err = cyg_hal_gdbfileio_stat((const char *)arg1, (void *)arg2, + (int *)sig); + break; + } + case SYS_fstat: + { + __externC int cyg_hal_gdbfileio_fstat( int fd, void *statbuf, + int *sig ); + err = cyg_hal_gdbfileio_fstat((int)arg1, (void *)arg2, + (int *)sig); + break; + } + case SYS_rename: + { + __externC int cyg_hal_gdbfileio_rename( const char *oldpath, + const char *newpath, + int *sig ); + err = cyg_hal_gdbfileio_rename((const char *)arg1, (const char *)arg2, + (int *)sig); + break; + } + case SYS_unlink: + { + __externC int cyg_hal_gdbfileio_unlink( const char *pathname, + int *sig ); + err = cyg_hal_gdbfileio_unlink((const char *)arg1, (int *)sig); + break; + } + case SYS_isatty: + { + __externC int cyg_hal_gdbfileio_isatty( int fd, int *sig ); + err = cyg_hal_gdbfileio_isatty((int)arg1, (int *)sig); + break; + } + case SYS_system: + { + __externC int cyg_hal_gdbfileio_system( const char *command, + int *sig ); + err = cyg_hal_gdbfileio_system((const char *)arg1, (int *)sig); + break; + } + case SYS_gettimeofday: + { + __externC int cyg_hal_gdbfileio_gettimeofday( void *tv, void *tz, + int *sig ); + err = cyg_hal_gdbfileio_gettimeofday((void *)arg1, (void *)arg2, + (int *)sig); + break; + } +#else case SYS_read: err = sys_read((int)arg1, (char *)arg2, (int)arg3); break; - case SYS_write: err = sys_write((int)arg1, (char *)arg2, (int)arg3); break; - case SYS_open: err = sys_open((const char *)arg1, (int)arg2, (int)arg3); break; - case SYS_close: err = sys_close((int)arg1); break; - case SYS_lseek: err = sys_lseek((int)arg1, (int)arg2, (int)arg3); break; + case SYS_rename: + err = -NEWLIB_ENOSYS; + break; + case SYS_unlink: + err = -NEWLIB_ENOSYS; + break; + case SYS_isatty: + err = 1; + break; + case SYS_system: + err = -1; + break; + case SYS_gettimeofday: + err = 0; + break; + case SYS_stat: + err = -NEWLIB_ENOSYS; + break; + case SYS_fstat: + { + struct newlib_stat *st = (struct newlib_stat *)arg2; + st->st_mode = NEWLIB_S_IFCHR; + st->st_blksize = 4096; + err = 0; + break; + } +#endif // !CYGPKG_HAL_GDB_FILEIO case SYS_utime: // FIXME. Some libglosses depend on this behavior. @@ -328,7 +594,20 @@ CYG_ADDRWORD *(unsigned long *)arg1 = (unsigned long)(ram_end-ram_start); *(unsigned long *)arg2 = (unsigned long)ram_end; break; - +#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF + case SYS_timer_call_back: + sys_profile_call_back( (char *)arg1, (char **)arg2 ); + break; + + case SYS_timer_frequency: + sys_profile_frequency( (int)arg1, (unsigned int *)arg2 ); + break; + + case SYS_timer_reset: + sys_profile_reset(); + break; + +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF case __GET_SHARED: *(__shared_t **)arg1 = &__shared_data; break; diff --git a/packages/redboot/current/src/ticks.c b/packages/redboot/current/src/ticks.c --- a/packages/redboot/current/src/ticks.c +++ b/packages/redboot/current/src/ticks.c @@ -5,29 +5,38 @@ // Stand-alone timer support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/redboot/current/src/version.c b/packages/redboot/current/src/version.c --- a/packages/redboot/current/src/version.c +++ b/packages/redboot/current/src/version.c @@ -5,29 +5,38 @@ // RedBoot version "string" // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -59,9 +68,9 @@ // outlined above. // -// Please do not edit the line below by hand: it is changed by the RedBoot -// release process. In a CVS branch, the line is commented out. -// In a release, it is defined to be the RedBoot release number. +// Do not change the following two lines at all. They are fiddled by release +// scripts. +#define _CERTIFICATE Non-certified //#define CYGDAT_REDBOOT_CUSTOM_VERSION current #if defined(CYGDAT_REDBOOT_CUSTOM_VERSION) @@ -72,10 +81,6 @@ #define _REDBOOT_VERSION CYGPKG_REDBOOT #endif -#ifndef _CERTIFICATE -#define _CERTIFICATE Non-certified -#endif - #define __s(x) #x #define _s(x) __s(x) diff --git a/packages/redboot/current/src/xyzModem.c b/packages/redboot/current/src/xyzModem.c --- a/packages/redboot/current/src/xyzModem.c +++ b/packages/redboot/current/src/xyzModem.c @@ -5,34 +5,43 @@ // RedBoot stream handler for xyzModem protocol // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // // Author(s): gthomas -// Contributors: gthomas, tsmith +// Contributors: gthomas, tsmith, Yoshinori Sato // Date: 2000-07-14 // Purpose: // Description: @@ -58,6 +67,8 @@ #define CAN 0x18 #define EOF 0x1A // ^Z for DOS officionados +#define nUSE_YMODEM_LENGTH + // Data & state local to the protocol static struct { hal_virtual_comm_table_t* __chan; @@ -66,7 +77,10 @@ static struct { unsigned char next_blk; // Expected block int len, mode, total_retries; int total_SOH, total_STX, total_CAN; - bool crc_mode, at_eof; + bool crc_mode, at_eof, tx_ack; +#ifdef USE_YMODEM_LENGTH + unsigned long file_length, read_length; +#endif } xyz; #define xyzModem_CHAR_TIMEOUT 2000 // 2 seconds @@ -185,6 +199,11 @@ xyzModem_get_hdr(void) // Find the start of a header can_total = 0; hdr_chars = 0; + + if (xyz.tx_ack) { + CYGACC_COMM_IF_PUTC(*xyz.__chan, ACK); + xyz.tx_ack = false; + } while (!hdr_found) { res = CYGACC_COMM_IF_GETC_TIMEOUT(*xyz.__chan, &c); ZM_DEBUG(zm_save(c)); @@ -322,18 +341,30 @@ xyzModem_stream_open(char *filename, int xyz.len = 0; xyz.crc_mode = true; xyz.at_eof = false; + xyz.tx_ack = false; xyz.mode = mode; xyz.total_retries = 0; xyz.total_SOH = 0; xyz.total_STX = 0; xyz.total_CAN = 0; +#ifdef USE_YMODEM_LENGTH + xyz.read_length = 0; + xyz.file_length = 0; +#endif while (retries-- > 0) { stat = xyzModem_get_hdr(); if (stat == 0) { + // Y-modem file information header if (xyz.blk == 0) { - // Note: yModem file name data blocks quietly discarded - CYGACC_COMM_IF_PUTC(*xyz.__chan, ACK); +#ifdef USE_YMODEM_LENGTH + // skip filename + while (*xyz.bufp++); + // get the length + parse_num(xyz.bufp, &xyz.file_length, NULL, " "); +#endif + // The rest of the file name data block quietly discarded + xyz.tx_ack = true; } xyz.next_blk = 1; xyz.len = 0; @@ -371,7 +402,7 @@ xyzModem_stream_read(char *buf, int size stat = xyzModem_get_hdr(); if (stat == 0) { if (xyz.blk == xyz.next_blk) { - CYGACC_COMM_IF_PUTC(*xyz.__chan, ACK); + xyz.tx_ack = true; ZM_DEBUG(zm_dprintf("ACK block %d (%d)\n", xyz.blk, __LINE__)); xyz.next_blk = (xyz.next_blk + 1) & 0xFF; // Data blocks can be padded with ^Z (EOF) characters @@ -385,6 +416,19 @@ xyzModem_stream_read(char *buf, int size } } } + +#ifdef USE_YMODEM_LENGTH + // See if accumulated length exceeds that of the file. + // If so, reduce size (i.e., cut out pad bytes) + // Only do this for Y-modem (and Z-modem should it ever + // be supported since it can fall back to Y-modem mode). + if (xyz.mode != xyzModem_xmodem && 0 != xyz.file_length) { + xyz.read_length += xyz.len; + if (xyz.read_length > xyz.file_length) { + xyz.len -= (xyz.read_length - xyz.file_length); + } + } +#endif break; } else if (xyz.blk == ((xyz.next_blk - 1) & 0xFF)) { // Just re-ACK this so sender will get on with it @@ -419,16 +463,19 @@ xyzModem_stream_read(char *buf, int size *err = stat; xyz.len = -1; return total; - } + } } - len = xyz.len; - if (size < len) len = size; - memcpy(buf, xyz.bufp, len); - size -= len; - buf += len; - total += len; - xyz.len -= len; - xyz.bufp += len; + // Don't "read" data from the EOF protocol package + if (!xyz.at_eof) { + len = xyz.len; + if (size < len) len = size; + memcpy(buf, xyz.bufp, len); + size -= len; + buf += len; + total += len; + xyz.len -= len; + xyz.bufp += len; + } } return total; } @@ -486,7 +533,7 @@ void xyzModem_stream_terminate(int metho // Make a small delay to give terminal programs like minicom // time to get control again after their file transfer program // exits. - CYGACC_CALL_IF_DELAY_US((cyg_int32)100000); + CYGACC_CALL_IF_DELAY_US((cyg_int32)250000); break; } } diff --git a/packages/redboot/current/src/xyzModem.h b/packages/redboot/current/src/xyzModem.h --- a/packages/redboot/current/src/xyzModem.h +++ b/packages/redboot/current/src/xyzModem.h @@ -5,29 +5,38 @@ // RedBoot stream handler for xyzModem protocol // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/compress/zlib/current/ChangeLog b/packages/services/compress/zlib/current/ChangeLog --- a/packages/services/compress/zlib/current/ChangeLog +++ b/packages/services/compress/zlib/current/ChangeLog @@ -1,3 +1,8 @@ +2002-02-18 Jesper Skov + + * src/infblock.c: Applied fix for double-free which could cause a + zlib crash. Fixed indentation. + 2001-10-15 Gary Thomas * include/zconf.h: @@ -48,27 +53,36 @@ 2001-03-08 Jesper Skov sub.trees.tb, s->hufts, z); if (t != Z_OK) { - ZFREE(z, s->sub.trees.blens); r = t; if (r == Z_DATA_ERROR) + { + ZFREE(z, s->sub.trees.blens); s->mode = BAD; + } LEAVE } s->sub.trees.index = 0; @@ -313,14 +315,17 @@ int r; t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), s->sub.trees.blens, &bl, &bd, &tl, &td, s->hufts, z); - ZFREE(z, s->sub.trees.blens); if (t != Z_OK) { if (t == (uInt)Z_DATA_ERROR) - s->mode = BAD; + { + ZFREE(z, s->sub.trees.blens); + s->mode = BAD; + } r = t; LEAVE } + ZFREE(z, s->sub.trees.blens); Tracev((stderr, "inflate: trees ok\n")); if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL) { diff --git a/packages/services/compress/zlib/current/tests/zlib1.c b/packages/services/compress/zlib/current/tests/zlib1.c --- a/packages/services/compress/zlib/current/tests/zlib1.c +++ b/packages/services/compress/zlib/current/tests/zlib1.c @@ -5,29 +5,38 @@ // zlib compression/decompression test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/compress/zlib/current/tests/zlib2.c b/packages/services/compress/zlib/current/tests/zlib2.c --- a/packages/services/compress/zlib/current/tests/zlib2.c +++ b/packages/services/compress/zlib/current/tests/zlib2.c @@ -5,29 +5,38 @@ // zlib decompression test 2 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/gfx/mw/current/ChangeLog b/packages/services/gfx/mw/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/ChangeLog @@ -0,0 +1,191 @@ +2002-04-30 Bart Veer + + * cdl/microwindows.cdl: + Replace description properties with display properties. + +2002-04-26 Bart Veer + + * src/drivers/scr_ecospcsvga.c: + New screen driver for PC hardware. + + * src/nanox/srvmain.c: + Change #ifdef's for new PC screen driver + + * src/nanox/clientfb.c: + Get a framebuffer address for x86 hardware + + * src/ecos/ecos_app.c: + Only build keyboard widget when needed. PC hardware has a real + keyboard. + + * cdl/microwindows.cdl: + Add configuration options for PC graphics. Automatically + build the files which instantiate eCos threads for the various + microwindows applications. + +2002-04-15 Jesper Skov + + * src/demos/nanox/world.c (MAPFILE): Load from current directory. + +2002-04-12 Bart Veer + + * src/nanox/srvmain.c: + Use a new main loop for PC/VGA. The default loop with + networking enabled assumes you can select() on the + mouse and keyboard, which is not currently implemented. + + * src/ecos/ecos_init.c: + Add some conditional compilation. Only check for + a logo file when there is a file system. Don't bother + with touchscreen calibration on a PC without a + touch-sensitive screen. + + * cdl/microwindows.cdl: + Add configury for building on a PC. + + * src/drivers/ps2kbdmou_ecos.c: + Driver for PC PS/2 keyboard and mouse. Only tested against + a Japanese Dell Inspiron laptop. + +2002-04-12 Jesper Skov + + * src/drivers/scr_ecos.c (gen_getscreeninfo): Return proper + fbdriver ptr. + (set_portrait_mode): Update psd->portrait variable. + + * src/demos/nanox/world.c: Removed load hack. Problem was due to + truncated jffs2 fs. + +2002-04-10 Jesper Skov + + * include/microwin/nano-X.h: Silence warning by including kapi.h + +2002-04-08 Jesper Skov + + * cdl/microwindows.cdl: Build Map demo if required. Require it for + the ARM targets. + + * src/demos/nanox/world.c (load): Hacked to do nothing. + (main): renamed to app_main. + +2002-03-27 Jesper Skov + + * src/drivers/scr_ecos.c (gen_getscreeninfo): Fill in correct + color layout based on pixel format. Now the animation renders + correctly. + + * drivers/scr_ecos.c (gen_getscreeninfo): Fill in all + parameters. At least the missing potrait mode cause + problems. fbdriver parameter is probably wrong, but needs to be + non-zero. + +2002-03-26 Jesper Skov + + * cdl/microwindows.cdl: Renamed CYGBLD_MICROWINDOWS_ARM9_DRIVERS + to CYGBLD_MICROWINDOWS_ARM_DRIVERS and added ipaq/aaed hacks. + + * Moved sources to services/gfx/mw with help from Gary. Moved + src/include directory to include/microwin. + + * cdl/microwindows.cdl: Added CDL build support. + * src/demos/nanowm/nanowm.c: Rename main() for eCos builds. + * src/demos/nxkbd/nxkbd.c: Same. + * src/nanox/srvmain.c: Same. + + * src/ecos/ecos_init.c: Fix some warnings, use redhat.logo for IO + testing. + +2002-03-22 Bart Veer + + * Configs/config.ecosvga: + New config file for eCos on a PC using the VGA driver. + + * Arc.rules, makefile.rules, config, */Makefile */*/Makefile + Add build support for x86 eCos, and allow builds outside the + source tree. + + * nanox/clientfb.c: + Only assume LCD display when compiling for ARM. + etc. do not exist when building for PC. + + * ecos/ecos_app.c: + Add missing #include's + Fix type ecos_nx_setup() vs. ecos_nx_init() + + * drivers/vgaplan4.h: + Define the appropriate out?() macros for eCos + + * drivers/vgainit.c: + Set up to access hardware directly. + Use HAL macro to peek I/O port + Fix one of the initial values for the VGA registers, which I + believe was leaving all planes disabled. + + * drivers/scr_ecos.c: + This is not used by all eCos targets, e.g. PC using the + microwindows VGA driver. For now conditionalize on CYGPKG_HAL_ARM. + + * drivers/memplan4.c, drivers/scr_bios.c, + Set up to access hardware directly under eCos. + + * drivers/kbd_null.c: + Declaration of NUL_Read() did not match definition. + +2002-03-14 Jesper Skov + + * Makefile: Fix typo. + + * nanox/Makefile: Build clientfb.c + * nanox/clientfb.c: Hacked for eCos. + + * nanox/client.c (nxErrorStrings): Define for eCos. + * nanox/srvevent.c (nxErrorStrings): Don't define for eCos. + +2002-03-13 Jesper Skov + + * ecos/Makefile: Require 'DEMO=Y' and 'AGDEMO=Y' to build old or + agdemo respectively. + * ecos/ecos_app.c: Wrap img_demo stuff in USE_IMG_DEMO. + + * ecos/img_demo.c: Added. (older version) + + * Makefile.rules (clean): Don't blow away everything if there's no + bin directory. + + * Makefile: Added ecos build rule. Create bin and lib. + + * Makefile.rules (CPPFLAGS): Include $(INCLUDEDIRS) for proper + dependencies on ecos headers. + + * ecos/ecos_init.c (ecos_nx_init): Use portrait_right mode for + IPAQ. + * drivers/scr_ecos.c (set_portrait_mode): Added. Cleaned up + portrait switch handling. + + * ChangeLog.MW: Moved the original ChangeLog to ChangeLog.MW + + Changes made by Gary Thomas . Diff against + branch MW_0_89_pre8: + * src/Arch.rules: Updated for building ag_demo. + * src/Configs/config.ecos: Changed tools prefix to arm-elf- and + screen pixel type. Also added JPEG support and disabled potrait + mode. + * src/config: copy of Configs/config.ecos + * src/drivers/Makefile: Added portrait files to the eCos build + rule. + * src/drivers/kbd_ipaq.c: various tweaks. + * src/drivers/scr_ecos.c: hacks to get portrait mode working on + iPAQ. + * src/ecos/Makefile: Build tweaks for ag_demo. + * src/ecos/ecos_app.c: mount jffs2, include image demo. + * src/ecos/ecos_init.c: ag_demo tweaks. + * src/engine/devimage.c: build tweak for HAVE_MMAP + * src/include/device.h: COLOR2PIXEL555 hack for strongarm lcd. + * src/include/nano-X.h: Fix regfdset typo. + * src/include/swap.h: __ECOS hacks. + * src/jpeg-6b: imported jpeg support. + * src/nanox/Makefile: eCos build tweaks. + * src/nanox/client.c: eCos ACCESS_PER_THREAD_DATA tweak. + * src/nanox/serv.h: additional Gr->SVR_Gr definitions. + * src/nanox/srvnet.c: __ECOS hack (print error string instead of + value). diff --git a/packages/services/gfx/mw/current/README b/packages/services/gfx/mw/current/README new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/README @@ -0,0 +1,60 @@ +Microwindows is an Open Source project aimed at bringing +the features of modern graphical windowing environments +to smaller devices. Microwindows' genesis was with the +NanoGUI project, and is now the primary distribution for +both the Microwindows and Nano-X codebase. Microwindows +currently runs on Linux, UNIX, X11, ELKS, MSDOS, RTEMS +and bare VGA hardware. It uses the same device- +independent graphics engine built for the NanoGUI project. +Microwindows compiles a sample application and the WinCE +graphics api in about 42k. + +The architecture of Microwindows allows it to be ported +or run on a wide variety of systems. Cross-compilation +for MIPS, ARM and x86 processors is supported. There are currently +screen drivers for Linux 2.2.x framebuffers and Linux 2.0.x +svgalib, as well as an X11 driver that allows applications +to be built and tested under X11 before running on the +target platform. There exists a portable 4-planes VGA driver +that will run on bare hardware, ELKS, MSDOS, or RTEMS. +There are mouse drivers written for bare hardware, direct +serial port, Linux GPM driver, and touchpads. The Microwindows +graphics engine is capable of running on any system that +support readpixel, writepixel, drawhline and drawvline, +although more advanced bit blit routines are provided. + +Microwindows features full RGB color support, optimized +palette bitmap drawing, and a 3d look-and-feel. +Overlapped and child windows are supported, with complete +window and client area clipping. Proportional and fixed +fonts are supported, along with utilities for converting +any MS Windows font or .bmp file. Optimized painting +algorithms are used to allow maximum response while the +user is moving windows on the screen. + +In addition, the Nano-X server can also be built on top of +the device-independent graphics engine. + +The main Microwindows web site is at + http://microwindows.org/ + +An HTML based FAQ and Architecture document are available from +the web site. + +Microwindows may be downloaded at + ftp://microwindows.org/pub/microwindows + +The chief maintainer of the project is Greg Haerr + +Microwindows and Nano-X are discussed on the NanoGUI mailing +list. To subscribe, send mail to nanogui-subscribe@linuxhacker.org. +The list is nanogui@linuxhacker.org. + +Mailing list archives are available at + http://www.linuxhacker.org/cgi-bin/ezmlm-cgi/0 + +The ELKS mailing list is linux-8086@vger.rutgers.edu. To subscribe, +send a message to majordomo@vger.rutgers.edu containing the words +subscribe linux-8086 in the body. + + diff --git a/packages/services/gfx/mw/current/cdl/microwindows.cdl b/packages/services/gfx/mw/current/cdl/microwindows.cdl new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/cdl/microwindows.cdl @@ -0,0 +1,305 @@ +# ==================================================================== +# +# microwindows.cdl +# +# MicroWindows configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: jskov +# Contributors: +# Date: 2002-03-25 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_MICROWINDOWS { + display "MicroWindows" + doc doc/index.html + requires CYGPKG_POSIX + requires CYGPKG_ISOINFRA + requires CYGINT_ISO_C_TIME_TYPES + requires CYGINT_ISO_STRERROR + requires CYGINT_ISO_ERRNO + requires CYGINT_ISO_ERRNO_CODES + requires CYGINT_ISO_MALLOC + requires CYGINT_ISO_STRING_BSD_FUNCS + requires CYGPKG_IO_FILEIO + description "Microwindows." + + # Note: separating the stack implementation from the common support leads + # to some rather incestious config file relationships. + define_proc { + } + + # FB drivers + compile \ + drivers/fblin16.c \ + drivers/fblin1.c \ + drivers/fblin24.c \ + drivers/fblin2.c \ + drivers/fblin32.c \ + drivers/fblin4.c \ + drivers/fblin8.c \ + drivers/fb.c \ + drivers/fbportrait_down.c \ + drivers/fbportrait_left.c \ + drivers/fbportrait_right.c \ + drivers/genfont.c \ + drivers/genmem.c + + # engine + compile \ + engine/devarc.c \ + engine/devclip.c \ + engine/devdraw.c \ + engine/devfont.c \ + engine/devimage.c \ + engine/devkbd.c \ + engine/devlist.c \ + engine/devmouse.c \ + engine/devopen.c \ + engine/devpal1.c \ + engine/devpal2.c \ + engine/devpal4.c \ + engine/devpal8.c \ + engine/devpoly.c \ + engine/devrgn2.c \ + engine/devrgn.c \ + engine/devtimer.c \ + engine/error.c \ + engine/selfont.c + + # NANO X + compile \ + nanox/srvmain.c \ + nanox/srvfunc.c \ + nanox/srvutil.c \ + nanox/srvevent.c \ + nanox/srvclip.c \ + nanox/srvnet.c \ + nanox/clientfb.c \ + nanox/client.c \ + nanox/error.c \ + nanox/nxdraw.c \ + nanox/nxproto.c \ + nanox/nxutil.c + + # FONTS + compile \ + fonts/helvB10.c \ + fonts/helvB12.c \ + fonts/helvR10.c \ + fonts/rom8x16.c \ + fonts/rom8x8.c \ + fonts/symbol.c \ + fonts/winFreeSansSerif11x13.c \ + fonts/winFreeSystem14x16.c \ + fonts/X5x7.c \ + fonts/X6x13.c + + # eCos stuff + cdl_option CYGBLD_MICROWINDOWS_ECOS { + display "Build MicroWindows eCos support" + default_value 0 + + # These files are unique to eCos + compile ecos/ecos_init.c ecos/nanox_thread.c + } + + # eCos ARM drivers + cdl_option CYGBLD_MICROWINDOWS_ARM_DRIVERS { + display "Build MicroWindows ARM drivers" + default_value CYGPKG_HAL_ARM + + compile \ + drivers/scr_ecos.c \ + drivers/kbd_ipaq.c \ + drivers/mou_ipaq.c + + requires CYGBLD_MICROWINDOWS_ECOS + requires CYGBLD_MICROWINDOWS_NANOWM + requires CYGBLD_MICROWINDOWS_NXKBD + requires CYGBLD_MICROWINDOWS_NANOX_DEMOS + + # This should come from the HAL + requires { !CYGPKG_HAL_ARM_SA11X0_IPAQ || is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, " -DMWPIXEL_FORMAT=MWPF_TRUECOLOR565") } + requires { !CYGPKG_HAL_ARM_ARM9_AAED2000 || is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, " -DMWPIXEL_FORMAT=MWPF_TRUECOLOR555") } + + } + + cdl_component CYGPKG_MICROWINDOWS_PC { + display "Build options for PC hardware" + flavor none + active_if CYGPKG_HAL_I386_PCMB + compile drivers/ps2kbdmou_ecos.c + + requires CYGBLD_MICROWINDOWS_ECOS + + cdl_option CYGIMP_MICROWINDOWS_PCSVGA32 { + display "Assume 32 bits per pixel, RGB == 0888" + description \ + "This mode can be used when building for a standard PC, + where bootstrap is handled via RedBoot. A custom version + of RedBoot is required, configured to switch the graphics + card to a suitable resolution before the processor enters + protected mode. A VESA-compliant video BIOS is used for + this. The graphics mode should be 32 bits per pixel true-color." + + implements CYGINT_MICROWINDOWS_PC_DRIVER + default_value 1 + compile drivers/scr_ecospcsvga.c + requires { is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, " -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 ") } + requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, " -DMWPIXEL_FORMAT=MWPF_TRUECOLOR565 ") } + requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, " -DMWPIXEL_FORMAT=MWPF_PALETTE ") } + } + + cdl_option CYGIMP_MICROWINDOWS_PCSVGA16 { + display "Assume 16 bits per pixel, RGB == 565" + description \ + "This mode can be used when building for a standard PC, + where bootstrap is handled via RedBoot. A custom version + of RedBoot is required, configured to switch the graphics + card to a suitable resolution before the processor enters + protected mode. A VESA-compliant video BIOS is used for + this. The graphics mode should be 16 bits per pixel true-color." + + implements CYGINT_MICROWINDOWS_PC_DRIVER + default_value 0 + compile drivers/scr_ecospcsvga.c + requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, " -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 ") } + requires { is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, " -DMWPIXEL_FORMAT=MWPF_TRUECOLOR565 ") } + requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, " -DMWPIXEL_FORMAT=MWPF_PALETTE ") } + } + + cdl_option CYGIMP_MICROWINDOWS_PCVGA { + display "Build for VGA hardware" + description \ + "This driver manipulates VGA hardware directly, rather than + going via the video BIOS. Only a limited resolution of + 640x480 with 4 bits per pixel is available. The driver + does not implement all required microwindows functionality." + + implements CYGINT_MICROWINDOWS_PC_DRIVER + default_value 0 + compile drivers/scr_bios.c drivers/vgainit.c drivers/vgaplan4.c drivers/memplan4.c + requires { is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, " -DMWPIXEL_FORMAT=MWPF_PALETTE ") } + requires { !is_substr(CYGPKG_MICROWINDOWS_CFLAGS_ADD, " -DMWPIXEL_FORMAT=MWPF_TRUECOLOR0888 ") } + } + + cdl_interface CYGINT_MICROWINDOWS_PC_DRIVER { + display "Number of active PC graphics drivers" + requires { CYGINT_MICROWINDOWS_PC_DRIVER == 1 } + } + } + + + # Nano WM + cdl_option CYGBLD_MICROWINDOWS_NANOWM { + display "Build MicroWindows NANOWM" + default_value 0 + + + compile \ + demos/nanowm/nanowm.c \ + demos/nanowm/events.c \ + demos/nanowm/wlist.c \ + demos/nanowm/clients.c \ + demos/nanowm/actions.c \ + ecos/nanowm_thread.c + } + + # keyboard + cdl_option CYGBLD_MICROWINDOWS_NXKBD { + display "Build MicroWindows NXKBD" + default_value 0 + + compile \ + demos/nxkbd/nxkbd.c \ + demos/nxkbd/srvconn.c \ + demos/nxkbd/keynorm.c \ + demos/nxkbd/keyctrl.c \ + demos/nxkbd/keyshft.c \ + demos/nxkbd/keynum.c + } + + # keyboard + cdl_option CYGBLD_MICROWINDOWS_NANOX_DEMOS { + display "Build MicroWindows NanoX demos" + default_value 0 + + compile \ + demos/nanox/world.c demos/nanox/ntetris.c \ + ecos/world_thread.c ecos/ntetris_thread.c + } + + cdl_component CYGPKG_MICROWINDOWS_OPTIONS { + display "Build options" + flavor none + no_define + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_MICROWINDOWS_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-I$(PREFIX)/include/microwin -D__ECOS=1 -DMSDOS=0 -DELKS=0 -D__rtems__=0 -D_MINIX=0 -DNOTYET=0 -DUNIX=1 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DxHAVE_JPEG_SUPPORT=1 -DHAVESELECT=1" } + description " + This option modifies the set of compiler flags for + building the MicroWindows package. + These flags are used in addition to the set of global flags." + } + + cdl_option CYGPKG_MICROWINDOWS_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the MicroWindows package. + These flags are removed from the set of global flags + if present." + } + } +} diff --git a/packages/services/gfx/mw/current/doc/faq.html b/packages/services/gfx/mw/current/doc/faq.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/faq.html @@ -0,0 +1,171 @@ + + + + + + + + + + + + +

  Microwindows Frequently Asked +Questions

+ +

1999/12/04 Microwindows FAQ - greg@censoft.com

+ +

What is Microwindows?

+ +

Microwindows is an Open Source project that brings some of the features of modern +graphical windowing systems to the programming community not wanting or requiring the +large disk and ram requirements of higher-end windowing systems like Microsoft Windows or +the X Window System.  Microwindows does not require any operating system or other +graphics system support, as it writes directly to the display hardware, although it runs +well on Linux framebuffer systems.  Microwindows is designed to be portable, and can +run in a wide variety of hardware and software environments.  One the of more +interesting targets is the emerging market of portable handheld and pocket PC's running +Linux, also known as LinuxCE.

+ +

What does Microwindows run on?

+ +

Microwindows currently runs on 32-bit Linux systems with kernel framebuffer support, or +through the popular SVGAlib library.  In addition, it has been ported to 16-bit Linux +ELKS, and real-mode MSDOS.  Microwindows screen drivers for 1, 2, 4, 8, 16 and 32 +bits-per-pixel have been written, as well as a VGA 16 color 4 planes driver.  +Microwindows has been ported to a number of Handheld and Pocket PC's, as well.  The +Microwindows graphics engine is capable of running on any system that supports readpixel, +writepixel, drawhorzline and drawvertline, and setpalette.  Blitting support is +optional, but if implemented allows enhanced functionality.  All bitmap, font, cursor +and color support is implemented on top of these routines.  Support for 8, 15, 16 and +32 bit truecolor systems as well as 1, 2, 4 and 8bpp palletized systems is implemented.
+
+Recently, an X11 driver was completed that allows Microwindows applications to be run on +top of the X Window desktop.  This driver emulates all of Microwindows' truecolor and +palette modes so that an application can be previewed using the target system's display +characteristics directly on the desktop display, regardless of the desktop display +characteristics.

+ +

What CPU's are supported?

+ +

Microwindows is extremely portable, and completely written in C, although some routines +have been recoded in assembly for speed.  It has been ported to the Intel 16 and 32 +bit cpu's, as well as MIPS R4000 (NEC Vr41xx) and ARM chips found on popular handheld and +pocket PC's.

+ +

How big is Microwindows?

+ +

On 16 bit systems, the entire system, including screen, mouse and keyboard drivers runs +in less than 64k.  On 32-bit systems, support includes proportional fonts and +applications are typically less than 100k.

+ +

What is Microwindows' architecture and what API's are supported?

+ +

Microwindows is essentially a layered design that allows different layers to be used or +rewritten to suite the needs of the implementation.  At the lowest level, screen, +mouse/touchpad and keyboard drivers provide access to the actual display and other +user-input hardware.  At the mid level, a portable graphics engine is implemented, +providing support for line draws, area fills, polygons, clipping and color models.  +At the upper level, various API's are implemented providing access to the graphics +applications programmer.  These APIs may or may not provide desktop and/or window +look and feel.  Currently, Microwindows supports the Win32 and Nano-X APIs.  +These APIs provide close compatibility with the Win32 and X Window systems, allowing +programs to be ported from other systems easily.

+ +

What's the difference between Microwindows and NanoGUI?

+ +

Microwindows' origin is with NanoGUI.  NanoGUI was created by Alex Holden by +taking David Bell's mini-X server and Alan Cox's modifications and adding client/server +networking.  Greg Haerr then took interest in the NanoGUI project and began making +extensive enhancements and modifications to NanoGUI.  Around version 0.5, Greg Haerr +added support for multiple API's, and began distributing Microwindows.  In +Microwindows 0.84, all previous NanoGUI changes were incorporated and since then +Microwindows has been the combined NanoGUI/Microwindows distribution.

+ +

What is Nano-X?

+ +

Nano-X is the X-like API that Microwindows supports.  It is based on David Bell's +mini-X server API, and includes X-like primitives for low-level window and graphics +operations.  Window management is not included, and the window look and feel must be +created through a widget set or directly by the applications programmer.  Currently, +there are a number of people working on widget sets for Nano-X.  There is some +discussion about converting the Nano-X API to be X Window System compatible.

+ +

What is the Microwindows API?

+ +

Microwindows supports an API based on the Win32 graphics device interface +module, and implements a large portion of it. The function calls try to be 100% +compatible, so that code compiled for other operating systems can usually be +compiled with no source code changes.  In addition, a portion of the Win32 +USER module is implemented, which contains routines for window dragging, title +bars,  message passing, and generating required window messages.  +Because of this, window manager support is built into the system, and a single +API for applications programs can be used that doesn't change based on the +widget set being used.
+
+Since the WinCE API is mostly a subset of the Win32 API for graphics-related +functions, the Microwindows API is also WinCE compatible, and can be used to +implement WinCE graphics functions on platforms Microwindows is running on.

+ +

What are Microwindows' graphics features?

+ +

Microwindows features full RGB color support, color mapping, optimized palette bitmap +drawing, truecolor and palletized displays, and a 3d look-and-feel. Overlapped and child +windows are supported, with complete window and client area clipping. Proportional and +fixed fonts are supported, along with utilities for converting fonts or bitmap files. +Optimized painting algorithms are used to allow maximum response while the user is moving +windows on the screen.  Offscreen drawing and bit-blit routines are implemented for +flicker-free drawing and animation. Polygon draws, fills and arbitrary region clipping are +also supported.

+ +

What license is Microwindows under?

+ +

The project is licensed under the MPL.  Alternatively, the software can be +licensed under the GPL, if desired.  This means that the standard Microwindows +distribution can be used for commercial purposes, and supports the needs of developers +working under non-disclosure or writing proprietary device drivers.  Modifications to +source code supplied in the standard distribution must stay open source.  Or the +entire project can be converted to GPL, with files added by a developer considered GPL +only.

+ +

Where is the most current source?

+ +

The FTP site ftp://microwindows.censoft.com/pub/microwindows +is the primary distribution point for all releases.  The home web site is at http://microwindows.censoft.com.  I can be +reached at greg@censoft.com.  I am working on +getting the development tree moved to CVS, stay tuned.

+ +

Are there screenshots and/or demos available?

+ +

There are demos for Linux, ELKS and MSDOS, as well as screenshots, available at:

+ +
+

ftp://microwindows.censoft.com/pub/microwindows/ScreenShots

+

ftp://microwindows.censoft.com/pub/microwindows/LinuxExamples    + ftp://microwindows.censoft.com/pub/microwindows/ElksExamples    + ftp://microwindows.censoft.com/pub/microwindows/DosExamples

+
+ +

Is there a mailing list?

+ +

The mailing list is nanogui@linuxhacker.org

+ +

To subscribe, send an empty email to:

+ +

    nanogui-subscribe@linuxhacker.org

+ +

To unsubscribe, send an empty email to:

+ +

    nanogui-unsubscribe@linuxhacker.org

+ +

What can I do to help?

+ +

We need help in all sorts of areas.  There are currently projects to port base +level widget sets and custom controls to Microwindows.  Fast screen drivers and +blitting routines are also on the list.  There are lots of folks interested in +getting the system to run on one of the many new Handheld or Pocket PC's.  Please +join the list and join the fun.

+ +

 

+ + diff --git a/packages/services/gfx/mw/current/doc/index.html b/packages/services/gfx/mw/current/doc/index.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/index.html @@ -0,0 +1,201 @@ + + + +Greg Haerr's Microwindows and NanoGUI Page + + + + + + + + + + + + + + + + + +

Microwindows and NanoGUI Projects

+

Downloads
+ Microwindows
+ Screen Shots +
+ Linux Binaries +
+ ELKS Binaries +
+ MSDOS Binaries +

+

Docs
+ FAQ
+ Architecture

+

Links
+ NanoGUI
+ Linux CE
+ ELKS
+ Brad's Linux MIPS Pages
+ RTEMS Port

Welcome

+

Microwindows is an Open Source project aimed at bringing the features of modern + graphical windowing environments to smaller devices and platforms.  Microwindows + allows applications to be built and tested on the Linux desktop, as well as cross-compiled + for the target device.  Microwindows' genesis was with the NanoGUI project, and has + now been combined into a single distribution.  The Win32 API implementation is known + as Microwindows, and the Xlib-like API implementation is known as Nano-X. Please read the FAQ for more information.  An extensive Architecture document is also available.   + To get involved, please join the NanoGUI + mailing list.

+

News

+

Version 0.87pre2 release

+

December 14, 1999
+ The second prerelease for version 0.87 has just been released, and is + available for download at:
+ ftp://microwindows.censoft.com/pub/microwindows/microwindows-0.87pre2.tar.gz  + This release is primarily intended for inspection and testing of the + changes before the directory tree reorganization, planned next.
+ The major enhancements include:

+
    +
  • Portrait mode driver for framebuffer systems.  This is a big + win for handhelds and palmtops, many of which require portrait mode + for normal operation.  All graphics output, including mouse + movement, hotspots, and text output, are rotated and displayed in + portrait mode.  In addition, your Microwindows applications can + be viewed in portrait mode on the desktop.  Try moving the mouse + without holding your head sideways!
  • +
  • The RTEMS operating system port source has been integrated with the + main tree.
  • +
  • Fixes to allow Microwindows to be run on big-endian machines are now + included.
  • +
  • Various bug fixes including the Microwindows terminal emulator pty + fix for X11, and Nano-X GrMovewindow fixes for child windows.  + There are still some issues relating to Nano-X clipping during window + movement.
  • +
+

RTEMS Port

+

December 3, 1999
+ There's been alot of interest and development with Microwindows lately.  Rosimildo + daSilva has ported Microwindows 0.86 to the RTEMS operating system, available at http://members.xoom.com/rosimildo/rtems_gui.htm. +   RTEMS is a POSIX-threads compliant real time + multitasking operating system which runs on Intel, Motorola, Hitachi, Mips, and many other + CPUs.

+

Version 0.87pre1 release

+

December 2, 1999
+ I have prepared an interim release of Microwindows and Nano-X enhancements, which + completes many things folks have asked for, version 0.87pre1. This is available for + download at ftp://microwindows.censoft.com/pub/microwindows/microwindows-0.87pre1.tar.gz +
+ The major enhancements include:

    +
  • Support for running under X11. Microwindows and Nano-X can now run as a user-defined + (default 640x480) window under X Windows. The graphics output and look and feel are + identical to framebuffer, but will run on any X display server.
  • +
+
    +
  • Compile-time options allow configuration to emulate any of the Microwindows truecolor or + palette modes, in any pixel depth, including grayscale. This allows a Microwindows or + Nano-X application to be emulated exactly, regardless of the host's or target's + framebuffer characteristics. Thanks to Tony Rogvall for the X11 driver.
    +
  • +
  • The client/server network code has been completely rewritten for speed!!! + I studied the + X11 Xlib implementation and came up with a similar implementation. By queuing all client + data until an event or reply is required, Nano-X now runs at extremely high speed. + For benchmarking, use the world demo, which plots several thousand + points.  This demo now runs extremely quickly.  Unlike + the Xlib implementation, Nano-X still runs synchronously per client, meaning that once a + client request packet is sent, the server waits until the whole packet has arrived until + servicing another client. This keeps the server code immensely simpler, while still + running very quickly.  I urge interested folks to check out the implementation, in + mwin/src/nanox/nxproto.{ch}, and mwin/src/nanox/client.c.
    +
  • +
  • Routines were added to allow Nano-X to be used as a "passive library", meaning + that an application with it's own main loop can now call into Nano-X occasionally + (after a + select returns a file descriptor that Nano-X is interested in), and it will all work. This + was done for Morten. See mwin/src/nanox/client.c, functions GrPrepareSelect(), + GrServiceSelect(), GrMainLoop().
    +
  • +
  • Routines were added to get the system palette, and translate an RGB color to a PIXELVAL + palette index. This was for Richard and the Opera browser. See mwin/src/nanox/srvfunc.c, + functions GrGetSystemPalette, GrFindColor().
    +
  • +
  • A null mouse driver was added for systems without a mouse, by setting NOMOUSE=1 in + Makefile.
    +
    + This is released as 0.87pre1 because I still haven't finished the directory tree + reorganization, and adding Martin's cool X11 graphics makefile configuration tool. The + client/server code rewrite took alot more time than expected. I am also working on getting + all source on CVS.
  • +
+

NanoGUI combined with Microwindows

+

November 13, 1999
+ Alex Holden, the originator of the NanoGUI project, officially handed over his role to + Greg Haerr, so that the NanoGUI and Microwindows projects can officially be available as a + single distribution.  Alex continues to host the Microwindows/NanoGUI mailing list. +   Although the releases have been maintained for some time by Greg Haerr, the + official distribution site is now moved here.  A big thanks goes to Alex for thinking + up the NanoGUI idea and hosting the initial web site.

+

Opera Web Browser ported to Microwindows

+

November 11, 1999
+ The Opera Web Browser, a browser known for it's small + footprint and operation on different operating systems, including Windows, BeOS, Linux, + Solaris, MacOS and OS/2, has announced they have completed initial work porting Opera to + Microwindows.  This is a crticial milestone for Microwindows, since it shows that + larger, graphics intensive applications can run on top of the Microwindows graphics + engine.  The Opera port uses the Nano-X api and features jpeg and gif image support, + as well as transparent image drawing.  The codefile size is 670k.  The current + Microwindows footprint is less than 100k with no compiled-in images.

+

Version 0.86 release

+

October 28, 1999
+ Thanks to Brad LaRonde for helping me get this web page out.  I have posted an update + v0.86 to Microwindows/Nano-X at:

+
+

ftp://microwindows.censoft.com/pub/microwindows/microwindows-0.86.tar.gz +

+
+

This version completes a major effort, that of implementing off-screen drawing, as well + as screen-to-screen blitting. The screen driver interface had to change to accommodate + this, and I had to rewrite all the screen drivers. In addition, the blitting routines were + written for 1, 2, 4, 8, 16 and 32bpp linear framebuffer devices, as well as the 16 color 4 + planes vga (this was a royal pain...) The blitting uses a clipping region traversal + algorithm so that blitting is always high speed, even when the destination window is + partly obscured.

+

This release also auto-detects most Linux framebuffer implementations, and should have + a compiled in driver for it.

+

The standard Microwindows demo is now a graphical terminal emulator, mterm. (No, it + doesn't run vi yet, and it doesn't repaint it's screen contents, but it will ;-) This demo + requires screen-to-screen blitting for scrolling. The 3d graphics demo now uses offscreen + blitting to enhance (read no flicker) the display. Check it out.

+

There is also some experimental full-blown region handling code included, which uses + X11's y-x banding region algorithms. (This stuff is truly for those with extra time and + brains). It is currently not compiled in, but can be included by replacing devclip.c with + devclip2.c. In the next release, arbitrary multi-rectangle clipping regions will be + available. I also plan on implementing separate clip regions from update regions for + windows, with the system computing the update region as a subset of the clip region. + Anyway, this sophisticated region handling is required for smart window painting as well + as higher end graphics primitives. Eventually, this will also allow separate source and + destination clipping for bitblit operations. Only destination clipping is working now.

+

The next release will have a reorganized directory structure, allowing separate + development of Nano-X, widgets, core engine, and Microwindows. I plan on moving the whole + thing to a CVS soon. BTW, Microwindows now supports three processor families, according to + reports emailed me. We've got i386, 8086, MIPS Vr41xx, and ARM families running ;-)

+

Following is a summary of the ChangeLog:
+ Version 0.86 - 28th October 1999 - greg@censoft.com

    +
  • merged framebuffer, elks and msdos vga 16 color 4 planes drivers
  • +
  • wrote vga bitbit routines (a herculean effort)
  • +
  • optimized bitblit by traversing window clip region
  • +
  • added experimental multi-rectangle dynamically allocated regions
  • +
  • wrote scrolling terminal emulator demo for microwindows
  • +
  • added WM_FDINPUT msg, WndRegisterFdInput call for terminal emulator
  • +
  • changed SCREENINFO struct, removed black/white, added bpp, planes
  • +
  • added offscreen (memory DC) drawing to microwindows
  • +
  • added BitBlt, CreateCompatibleBitmap, CreateCompatibleDC, DeleteDC
  • +
  • retired BOGL library, must use new interface for blitting
  • +
  • converted framebuffer, svgalib, elks and msdos screen drivers (we need blit routines for + herc and svgalib still)
  • +
  • major screen driver interface change, old drivers not compatible
  • +
+

Page maintained by Greg Haerr <greg@censoft.com>

+ + diff --git a/packages/services/gfx/mw/current/doc/microwindows_architecture.html b/packages/services/gfx/mw/current/doc/microwindows_architecture.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/microwindows_architecture.html @@ -0,0 +1,1085 @@ + + + + + + + +MicroWindows Architecture + + + + +

Microwindows Architecture

+ +

1999/12/04 Copyright (c) 1999 Greg Haerr <greg@censoft.com> All Rights Reserved.

+ +

This is my first cut at getting the architecture and implementation +spilled out.  Please let me know if there's more detail needed in some areas, or +whether you're confused by my explanations.  This document is for educational and +porting purposes, so please read on.

+ +

Contents

+ +

1. Architecture
+    1.1        Layered Design
+    1.2        Device Drivers
+        1.2.1     Screen Driver
+        1.2.2     Mouse Driver
+        1.2.3     Keyboard Driver
+    1.3        MicroGUI - Device +Independent Graphics Engine 
+    1.4        Applications Programmer +Interfaces
+        1.4.1    Microwindows API
+        1.4.2    Nano-X API

+ +

2. Device-Independent Engine Features
+    2.1        Graphics Engine Features +and Implementation
+        2.1.1    Regions
+        2.1.2    Clipping
+        2.1.3    Line Drawing
+        2.1.4    Rectangles, Circles, +Ellipses
+        2.1.5    Polygons
+        2.1.6    Area Fills
+        2.1.7    Fonts
+        2.1.8    Text Drawing
+        2.1.9    Color model and +palettes
+        2.1.10  Image Drawing
+        2.1.11  Blitting

+ +

3. Microwindows API
+    3.1        Message-passing +architecture
+    3.2        Window creation and +destruction
+    3.3        Window showing, hiding +and moving
+    3.4        Window painting
+        3.4.1    Client and screen +coordinates
+        3.4.2    Device contexts
+        3.4.3    Graphics drawing API
+    3.5        Utility functions
+        3.5.1    Setting window focus
+        3.5.2    Mouse capture
+        3.5.3    Rectangle and Region +management

+ +

4. Nano-X API
+    4.1        Client/Server model
+    4.2        Events
+    4.3        Window creation and +destruction
+    4.4        Window showing, hiding +and moving
+    4.5        Drawing to a window
+        4.5.1    Graphics contexts
+        4.5.2    Graphics drawing API
+    4.6        Utility functions

+ +

1. Architecture

+ +

1.1        Layered Design

+ +

Microwindows is essentially a layered design that allows different layers to be used or +rewritten to suite the needs of the implementation.  At the lowest level, screen, +mouse/touchpad and keyboard drivers provide access to the actual display and other +user-input hardware.  At the mid level, a portable graphics engine is implemented, +providing support for line draws, area fills, polygons, clipping and color models.  +At the upper level, various API's are implemented providing access to the graphics +applications programmer.  These APIs may or may not provide desktop and/or window +look and feel.  Currently, Microwindows supports the ECMA APIW and Nano-X APIs.  +These APIs provide close compatibility with the Win32 and X Window systems, allowing +programs to be ported from other systems easily.

+ +

1.2        Device Drivers

+ +

The device driver interfaces are defined in device.h.  A given implementation of +Microwindows will link at least one screen, mouse and keyboard driver into the +system.  The mid level routines in the device-independent graphics engine core then +call the device driver directly to perform the hardware-specific operations.  This +setup allows varying hardware devices to be added to the Microwindows system without +affecting the way the entire system works.

+ +

1.2.1     Screen Driver

+ +

There are currently screen drivers written for Linux 2.2.x framebuffer systems, as well +as 16-bit ELKS and MSDOS drivers for real-mode VGA cards.  The real mode drivers +(scr_bios.c, vgaplan4.c, mempl4.c, scr_her.c) can be configured to initialize the VGA +hardware directly, or utilize the PC BIOS to begin and end graphics mode.  The +framebuffer drivers (scr_fb.c, fb.c, fblin?.c) have routines for 1, 2, 4 and 8bpp +palletized displays, as well as 8, 15, 16, and 32 bpp truecolor displays.  The +framebuffer system works in Linux by opening /dev/fd0 (or getenv("FRAMEBUFFER")) +and mmap()ing the display memory into a linear buffer in memory.  Some display modes, +like the VGA 4 planes mode, require that OUT instructions be issued by the screen driver, +while packed pixel drivers typically can get away with just reading and writing the +framebuffer only.  All the graphics mode initialization and deinitialization is +handled by the Linux kernel.  Getting this set up can be a real pain.

+ +

The screen driver is the most complex driver in the system, but was designed so that it +can be extremely easy to port new hardware to Microwindows.  For this reason, there +are but a few entry points that must actually talk to the hardware, while other routines +are provided that allow just the small set of core routines to be used, if desired.  +For example, a screen driver must implement ReadPixel, DrawPixel, DrawHorzLine, and +DrawVertLine.  These routines read and write a pixel from display memory, as well as +draw a horizontal and vertical line.  Clipping is handled at the device-independent +layer.  Currently, all mouse movement, text drawing, and bitmap drawing run on top of +these low level functions.  In the future, entry points will be provided for fast +text and bitmap drawing capabilities.  If the display is palletized, a SetPalette +routine must be included, unless a static palette that matches the system palette is +linked into the system.  The screen driver, on initialization, returns values telling +the system the x,y size of the screen, along with the color model supported.

+ +

Two font models are currently provided, to be linked in at your desire.  The +proportional font model has in-core font tables built from .bdf and other font conversion +utilities provided.  The rom-based font uses the PC BIOS to find the character +generator table address and has routines to draw that fixed-pitch font format.

+ +

The screen driver can choose to implement bitblitting, by ORing in PSF_HAVEBLIT into +the returned flags field.  When present, bit blitting allows Microwindows to perform +off-screen drawing.  Microwindows allows any graphics operation that can be performed +on a physical screen to be performed off-screen, and then copied (bit-blitted) to the +physical screen.  Implementing a blitting screen driver can be fairly complex.  +The first consideration in implementing a blitting driver is whether the low-level display +hardware can be passed a hardware address for a framebuffer.  If so, then the same +routines that draw to the physical screen can be used to draw to off-screen buffers.  +This is the method used for the linear framebuffer drivers provided for Linux packed-pixel +displays.  The system replaces the mmap()'d physical framebuffer address with a +malloc()'d memory address and calls the original screen driver entry point.  In the +case where the system doesn't use an actual physical memory address, like when running on +top of X or MS Windows, then two sets of routines must be written; one to write the the +underlying graphics system hardware, and another to write to memory addresses.  In +addition, the blit entry point must then know how to copy both ways between the two +formats.  In fact, all four operations, screen-to-memory, memory-to-screen, +memory-to-memory, and screen-to-screen are supported by Microwindows and may need to be +performed.  And of course the bit blitting routine must be _fast_.  See the +files fblin8.c and mempl4.c for examples of supporting both types of display hardware.

+ +

If writing your first screen driver, I would recommend you start with the PC BIOS real +mode driver, scr_bios.c, or take a look at the framebuffer driver, scr_fb.c, which is +essentially a wrapper around all the fblin?.c routines to read and write various +framebuffer formats.  Don't set the PSF_HAVEBLIT flag at first, and you won't have to +write a bitblit routine from the start.

+ +

Note that currently, all SCREENDEVICE function pointers must be filled in to at least a +void function.  For speed reasons, the system always assumes that the function +pointers are valid.  Thus, even if not implementing bitblit, a do-nothing bit-blit +procedure must be provided.

+ +

1.2.2     Mouse Driver

+ +

There are three mouse drivers currently included in Microwindows.  A GPM driver +for Linux, mou_gpm.c, as well as a serial port mouse driver for Linux and ELKS, +mou_ser.c.  For MSDOS, an int33 driver mou_dos.c is provided.  The provided +mouse drivers decode MS, PC and Logitech mice formats.  A mouse driver's basic +function is to decode the mouse data and return either relative or absolute data for the +mouse position and buttons.

+ +

In addition, Brad LaRonde has written a touch panel driver mou_tp.c, which masquerades +as a mouse driver.  It returns the value of x, y value of the pen on the display +surface, and can be used like a mouse.

+ +

Under Linux, the main loop of Microwindows is a select() statement, with file +descriptors for the mouse and keyboard driver always passed in.  If the system that +Microwindows is running on doesn't support select() or doesn't pass mouse data through a +file descriptor, a Poll() entry point is provided.

+ +

1.2.3     Keyboard Driver

+ +

There are two keyboard drivers provided.  The first, kbd_tty.c, is used for Linux +and ELKS systems where the keyboard is opened and read as through a file descriptor.  +The second, kbd_bios.c, read the PC BIOS for keystrokes and is used in MSDOS real +mode.  The keyboard driver currently returns 8-bit data from the keyboard, but +doesn't decode multi-character function key codes. This functionality will need to be +added soon, by reading termcap files or the like.

+ +

1.3        MicroGUI - Device Independent Graphics +Engine

+ +

 The core graphics functionality of Microwindows resides in the device independent +graphics engine, which calls the screen, mouse and keyboard drivers to interface with the +hardware.  User applications programs never all the core graphics engine routines +directly, but rather through the programmer API's, discussed in the next sections.  +The core engine routines are separated from the applications API's is for a variety of +reasons.  The core routines will always reside on the server in a client/server +environment.  Also, the core routines use internal text font and bitmap formats that +are designed for speed and may or may not be the same as the structures used in standard +API's.  In addition, the core routines always use pointers, never ID's, and can then +be used together to implement more complex functions without always converting handles, +etc.

+ +

In Microwindows, the core routines all begin as GdXXX() functions, and are concerned +with graphics output, not window management.  In addition, all clipping and color +conversion is handled within this layer.  The following files comprise the core +modules of Microwindows:

+ +

    devdraw.c        Core graphics +routines for line, circle, polygon draw and fill, text and bitmap drawing, color +conversion

+ +

    devclip.c          Core +clipping routines.  (devclip2.c is the new y-x-banding algorithm, devclip1.c an older +method)

+ +

    devrgn.c           +New dynamically allocated routines for intersect/union/subtract/xor region creation.

+ +

    devmouse.c      Core routines for keeping +the mouse pointer updated or clipped from the screen.

+ +

    devkbd.c          Core +keyboard handling routines.

+ +

    devpalX.c         Linked in +static palettes for 1, 2, 4 and 8bpp palletized systems.

+ +

Section 2 following discusses the MicroGUI graphics engine routines in detail.

+ +

1.4        Applications Programmer Interfaces

+ +

Microwindows currently supports two different application programming interfaces.  +This set of routines handles client/server activity, window manager activities like +drawing title bars, close boxes, etc, as well as, of course, handling the programmer's +requests for graphics output.  Both the API's run on top of the core graphics engine +routines and device drivers.

+ +

The basic model of any API on top of Microwindows is to hang in initialize the screen, +keyboard and mouse drivers, then hang in a select() loop waiting for an event.  When +an event occurs, if it's a system event like keyboard or mouse activity, then this +information is passed to the user program converted to an expose event, paint message, +etc.  If it's a user requesting a graphics operation, then the parameters are decoded +and passed to the appropriate GdXXX engine routine.  Note that the concept of a +window versus raw graphics operations are handled at this API level.  That is, the +API defines the concepts of what a window is, what the coordinate systems are, etc, and +then the coordinates are all converted to "screen coordinates" and passed to the +core GdXXX engine routines to do the real work.  This level also defines graphics or +display contexts and passes that information, including clipping information, to the core +engine routines.

+ +

Currently, the Microwindows API code is in win*.c, while the Nano-X API code is in +nanox/srv*.c.

+ +

1.4.1    Microwindows API

+ +

The Microwindows API tries to be compliant with the European ECMA APIW standard.  +Currently, there is support for most of the graphics drawing and clipping routines, as +well as automatic window title bar drawing and dragging windows for movement. The +Microwindows API is message-based, and allows programs to be written without regard to the +eventual window management policies implemented by the system.  The Microwindows API +is not currently client/server, and will be discussed in more detail in section 4.

+ +

1.4.2    Nano-X API

+ +

The Nano-X API is modeled after the mini-x server written initially by David Bell, +which was a reimplementation of X on the MINIX operating system.  It loosely follows +the X Window System Xlib API, but the names all being with GrXXX() rather than +X...().  Currently, the Nano-X API is client/server, but does not have any provisions +for automatic window dressings, title bars, or user window moves.  There are several +groups writing widget sets currently, which will provide such things.  Unfortunately, +the user programs must also then write only to a specific widget set API, rather than +using the Nano-X API directly, which means that only the functionality provided by the +widget set will be upwardly available to the applications programmer.  (Although this +could be considerable, in the case that, say Gdk was ported.)

+ +

2. Device-Independent Engine Features

+ +

This section discusses in the capabilities and implementation of Microwindows' core +graphics engine in detail.  It's purpose is both educational and to allow extending +an API by understanding how the engine works.

+ +

    2.1        Graphics Engine +Features and Implementation

+ +

These routines concern themselves with drawing operations to off-screen or screen +surfaces.  Each routine starts with Gd... and is passed a pointer to the SCREENDEVICE +structure (PSD) as it's first parameter.  The PSD parameter specifies the low level +display details, like the x, y size of the device and the color model used by the +hardware, for example.  In addition, the actual routines to perform drawing are +function pointers in this structure.  All screen coordinates are of type COORD, and +specified in device coordinates, that is, offsets from the upper left corner of the +screen.

+ +

Colors are always specified as an RGB COLORVAL value into the graphics engine.  +They are then possibly converted to palette indices and sent to the display hardware as +PIXELVAL values.  In the case of 32bpp truecolor displays, no conversion is +required.  The color model will be discussed in detail below.

+ +

        2.1.1    Regions

+ +

Regions are used to describe arbitrary sets of pixels on the screen.  A simple, +square region of pixels can be described by a single rectangle.  More complex sets of +pixels require more complex data structures.  In Microwindows, regions are described +by an array of non-overlapping rectangles.  Currently, there are two different +implementations of regions in Microwindows, as I've been enhancing the capabilities in +this area.  The original design used a single static array of CLIPRECTs to describe +complex regions.  Any point within any rectangle in the array was considered to be in +the region.  The array wasn't sorted in any particular order, but was always +guaranteed to contain non-overlapping rectangles.  Another global variable, +clipcount, specified the number of rectangles in the array.  This original design had +no engine entry points for region management, the entire array was passed to the clipping +functions, described below.

+ +

In the new design, any number of regions can be created, as the regions (CLIPREGION *) +are stored as dynamically allocated arrays of rectangles.  In this implementation, +the non-overlapping rectangles are always kept in "y-x" sorted bands, such that +each band's y height is the same for all rectangles in the band.  This means that +only the x position and width of the rectangles in each band varied.  Because of +this, it is easier to create a set of functions for combining regions, since effectively +only a single dimension had to be compared for each region operation.  The new region +handling routines allow for creating and destroying regions, as well as combining +rectangles and regions with regions using Intersection, Union, Subtraction, and Exclusive +Or.  This model allows regions to be implemented apart from the clipping routines, +unlike the first version.  Following are the new region routines:

+ +

    +GdAllocRegion                    +- Create a region
+    +GdDestroyRegion                +- Destroy a region
+    +GdCopyRegion                    +- Copy a region
+    GdUnionRectWithRegion     - Union a rectangle with +a region
+    +GdIntersectRegion               +- Create a region from the intersection of two regions
+    +GdSubtractRegion                +- Create a region from the difference of two regions
+    +GdUnionRegion                    +- Create a region from the union of two regions
+    +GdXorRegion                       +- Create a region from the XOR of two regions
+   

+ +

        2.1.2    Clipping

+ +

Clipping in Microwindows is closely tied to the region management code.  At any +point in time, the graphics engine has a single clipping region, that is a set of +rectangles, defined for any graphics operation.  A point is drawn if it is +"inside" any of the current set of clip rectangles.  Two slightly modified +versions of the clipping algorithm are supplied, devclip1.c for the original, static +rectangle array, and devclip2.c for the newer dynamically allocated array.  A single +entry point GdSetClipRects, takes the passed region and specifies it's use for all +subsequent graphics operations.  All the drawing routines then use the two additional +routines to determine whether or not to draw.  GdClipPoint takes an x,y point in +screen coordinates and returns TRUE if the point can be drawn, that is, the point is +within one of the region rectangles.  GdClipArea takes an upper left and lower right +point, and returns one of the following: CLIP_VISIBLE, if the specified area is completely +within the region, CLIP_INVISIBLE, if the area is completely not in the region, which +means that no drawing should be performed, or CLIP_PARTIAL, if a part but not the whole +area is within the region.  A typical graphics primitive will call the screen driver +with unmodified passed inputs if CLIP_VISIBLE is returned, or return if CLIP_INIVISIBLE is +returned.  In the CLIP_PARTIAL case, the primitive must break up the original request +into areas that are within the clip region before calling the screen driver.  This +slows down the operation considerably.

+ +

Because the clipping code is called constantly before drawing operations, Microwindows +keeps a global cache rectangle of the last rectangle checked with GdClipArea, for speed +and also to allow the mid level to quickly calculate how partial drawing lengths.

+ +

        2.1.3    Line Drawing

+ +

Line drawing is the simplest of graphics operations.  Microwindows supports +GdPoint to draw a point, and GdLine to draw a horizontal, vertical or diagonal (using +Bresenham algorithm) line.  Just before any call to the screen driver, a call to +GdCheckCursor assures that the software cursor is removed prior to drawing.  +GdFixCursor restores the cursor if previously visible.

+ +

There is a tricky part to line drawing that had to be added during the support for +multiple API's.  This has to do with whether or not the last point in specified line +segment is drawn or not.  There are two schools of thought on this, and to make it +short, Microwindows supports both of them.  The last parameter to GdLine specifies +whether or not to draw the last point.  The Microwindows API doesn't draw the last +point, but the Nano-X API does.

+ +

Most drawing functions, including line drawing draw using the "current" +foreground color, specified using GdSetForeground.  In addition a drawing mode, +currently either MODE_SET or MODE_XOR can be specified using GdSetMode.

+ +

        2.1.4    Rectangles, +Circles, Ellipses

+ +

Rectangles, circles and ellipses are drawn using the GdRect and GdEllipse +routines.  A circle is an ellipse with the same x and y radius.  As with lines, +rectangles and ellipses are drawn using the current foreground color and mode.

+ +

        2.1.5    Polygons

+ +

Microwindows supports polygon drawing by specifying an array of x, y points.  The +points are then connected using the GdLine function.  The current foreground color, +drawing mode, and clip region is used during output.

+ +

        2.1.6    Area Fills

+ +

Microwindows supports filled rectangular areas using the GdFillRect function.  The +rectangle's outline and contents are filled using the current foreground color.  +Filled circles and ellipses are performed with GdFillEllipse, and polygon fills with +GdFillPoly.  Area filling is implemented through successive calls to the DrawHorzLine +in the screen driver, and are much faster if fully not clipped.

+ +

        2.1.7    Fonts

+ +

Both fixed pitch and proportional fonts are supported in Microwindows.  Because of +potentially large differences in display hardware, the actual font format is known only to +the screen driver, although a set of standard functions are supplied for dealing with +converted .bdf fonts and Microsoft Windows fonts, if you have a license.  The engine +function GdSetFont specifies a font number that is passed to the driver and used to index +a static array of linked in fonts.  Screen driver entry points GetTextSize return the +font height and width for a passed string, and GetTextBits returns an individual character +bitmap.  The engine layer uses these values to calculate a clipping region for text +drawing, as well as to draw the character as a monochrome bitmap.

+ +

The screen drivers currently supplied implement both fixed pitch PC ROM based fonts, as +well as a proportional font format that is linked into the screen driver.  A few +conversion programs allow conversion of fonts from different formats to the driver +format.  Bdftobogl converts X Window System .bdf files to Microwindows format.  +Convfnt32 converts raster and truetype Microsoft Windows fonts, if you have a license, to +Microwindows format.  Convrom converts PC ROM bios fonts.

+ +

A number of free fonts are supplied with the system, a heavier proportional 14x16 +system font, and a sans-serif 11x13 font for title bar and edit box displays.  Any +number of fonts can be linked into the system, and it's fairly easy to dynamically load +fonts if one writes the routines for it.

+ +

        2.1.8    Text Drawing

+ +

Text output is performed by first selecting the desired font with GdSetFont, and then +calling the GdText function.  Full text clipping is performed, although currently +there is no "fast" text output entry point in the screen driver, so each +character bitmap is grabbed using the GetTextBits entrypoint and then drawn using +Drawpixel.  While this will have to remain the same for partially clipped text, a +screen driver entry point to draw fast text will probably be required shortly.

+ +

Text is drawn using the current foreground color.  The background is drawn if the +current "use background" mode set via GdUseBackground is TRUE.  In this +case the background is drawn using the current background color set via +GdSetBackground.  The GdText function also takes a bottomAlign parameter that +specifies whether the text is to be bottom or top aligned, to help with differing API's.

+ +

        2.1.9    Color model and +palettes

+ +

The Microwindows graphics engine requires all colors to be specified as either 24-bit +RGB color values, or in rare cases, as palette indices for speed.  The palette index +method will only work on systems that have hardware palettes, so it's not +recommended.  All of the upper-level color parameters are specified to the engine +routines using a COLORVAL value, which is a long containing the desired RGB color, created +using the RGB() macro.  The engine then converts the COLORVAL to a PIXELVAL value, +which is normally a long also, but on some smaller systems can be compiled as an unsigned +char.  The PIXELVAL value is the actual value passed to any screen driver entry point +requiring a color.  So the mid level routines all work with RGB COLORVALs, while the +device driver routines all work with PIXELVALs.  The graphics engine converts these +values using two routines, GdFindColor and GdFindNearestColor, described below.

+ +

GdFindColor takes a hardware independent RGB value and converts it to a hardware +dependent PIXELVAL pixel value.  In the case of 32bpp display drivers, no conversion +is required.  Otherwise for truecolor systems, Microwindows converts the RGB value to +a 5/5/5 15-bit or 5/6/5 16 bit truecolor value.  For 8bpp truecolor displays, the RGB +value is converted to 3/3/2.  For palletized displays, the GdFindNearestColor +function is called to convert the RGB color to the nearest palette index in the current +system palette.  GdFindNearestColor uses a weighted distance-cubed method to find the +palette value nearest to the requested color, and returns it.  Standard palettes for +1, 2, 4 and 8bpp are included in the files devpal1, devpal2, devpal4 and devpal8.c.  +These palettes associate an RGB value with an index, but may be overwritten.

+ +

The GdSetPalette function determines whether there are any free entries in the system +palette (discussed shortly) and if so, adds entries to the system palette, and calls the +screen driver SetPalette entry point to set the hardware palette.  There is a single +global variable, gr_firstuserpalentry, that contains the index of the next available +system palette entry.  Initially, this is set to 24.  Thus, systems with less +than 24 total palette entries will never have an available palette entry to remap.  +On systems that do, like 256 color systems, then images requiring more color entries keep +calling GdSetPalette until the system palette is full.  To reset marker, the function +GdResetPalette is called.  This allows upper level API's to distinguish between +different images and force the system palette to be rewritten.

+ +

        2.1.10  Image Drawing

+ +

Microwindows supports two styles of images, monochrome and palettized.  Monochrome +images are specified with an IMAGEBITS structure, which is an array of words with 1 bits +specifying the foreground color and 0 bits the background.  The IMAGEBITS bits are +short-word padded to the width of the bitmap.  The GdBitmap routine draws monochrome +bitmaps, similar to GdText, by drawing all the 1 bits in the foreground color, and the 0 +bits in the background color if the "use background" set by GdUseBackground is +TRUE.

+ +

Color bitmaps are specified using a 1, 4 or 8bpp image palette, and an array of indices +into this palette, all stuffed into an IMAGEHDR structure, and drawn via +GdDrawImage.  First, the system creates a conversion palette by calling +GdMakePaletteConversionTable, which converts the images' palette entries into system +indices.  At the same time, the system attempts to increase the system palette if +necessary by calling the GdSetPalette function described above.  At the end of this +operation, the image has a converted palette which necessarily corresponds to the system +palette.  In the case of truecolor hardware, the image's palette entries are +converted to hardware truecolor pixel values, and output directly.

+ +

After converting the image color entries the GdDrawImage determines the whether the +image is clipped, and outputs the image, pixel by pixel.  In the future, a blitting +routine could be used for faster image drawing.

+ +

        2.1.11  Blitting

+ +

Blitting functionality is required in the screen driver for offscreen drawing +capability, discussed earlier in the screen drivers section.  The engine function +GdBlit allows upper level APIs to implement copy operations from offscreen memory to the +display, or vice versa.  The blit format is driver specific, and generally only works +for memory images created by the screen driver during runtime.  The upper level APIs +implement this by allocating a new SCREENDRIVER structure, copying an existing +SCREENDRIVER structure into it, replacing the address field with a malloc()'d value, and +setting the PSF_MEMORY bit, which indicates to the display driver that this is now an +offscreen surface.  Any subsequent calls to the engine routines then draw onto this +surface.  When it is desired to copy the offscreen surface back to the physical +display, the GdBlit routine is called.  Currently, only SRCCOPY operations are +performed, but future plans will add blitting opcodes.

+ +

 

+ +

3. Microwindows API

+ +

    3.1        Message-passing +architecture

+ +

The fundamental communications mechanism in the Microwindows API is the message.  +A message consists of a well-known message number, and two parameters, known as wParam and +lParam.  Messages are stored in an application's message-queue, and retrieved via the +GetMessage function.  The application blocks while waiting for a message.  There +are messages that correspond to hardware events, like WM_CHAR for keyboard input or +WM_LBUTTONDOWN for mouse button down.  In addtiion, events signaling window creation +and destruction WM_CREATE and WM_DESTROY are sent.  In most cases, a message is +associated with a window, identified as an HWND.  After retrieving the message, the +application sends the message to the associated window's handling procedure using +DispatchMessage.  When a window class is created, it's associated message handling +procedure is specified, so the system knows where to send the message.

+ +

The message-passing architecture allows the core API to manage many system functions by +sending messages on all sorts of events, like window creation, painting needed, moving, +etc.  By default, the associated window handling function gets a "first +pass" at the message, and then calls the DefWindowProc function, which handles +default actions for all the messages.  In this way, all windows can behave the same +way when dragged, etc, unless specifically overridden by the user.  Major window +management policies can be redefined by merely re-implementing DefWindowProc, rather than +making changes throughout the system.

+ +

The following functions deal with messages directly:

+ +

    +SendMessage                +Send a message directly to a window
+    +PostMessage                 +Queue a message on the application's message queue for later dispatch
+    PostQuitMessage          +Queue a WM_QUIT message telling the application to terminate when read
+    +GetMessage                  +Block until a message is queued for this application
+    TranslateMessage          +Translate up/down keystrokes to WM_CHAR messages
+    +DispatchMessage           Send a +messages to it's associated window procedure

+ +

A Microwindows application's entry point is the function WinMain, rather than main.

+ +

    3.2        Window creation and +destruction

+ +

The basic unit of screen organization in Microwindows API is the window.  Windows +describe an area of the screen to draw onto, as well as an associate "window +procedure" for handling messages destined for this window.  Applications +programmers can create windows from pre-defined classes, like buttons, edit boxes, and the +like, or define their own window classes.  In both cases, the method of creating and +communicating with the windows remains exactly the same.  The following functions +deal with window registration, creation, and destruction:

+ +

    +RegisterClass                +Define a new window class name and associated window procedure
+    +UnRegisterClass            Undefine +a window class
+    CreateWindowEx         Create +an instance of a window of a certain class
+    +DestroyWindow            Destroy a +window instance

+ +

The WM_CREATE message is just after window creation, before returning from +CreateWindowEx.  The WM_DESTROY message is sent just before destroying a window with +DestroyWindow.

+ +

When a window is registered, extra bytes can be allocated to the window structure when +created.  The GetWindowLong, GetWindowWord, SetWindowLong and SetWindowWord +manipulate these bytes.  In addition, a fixed number of extra bytes per window class +can be allocated on registration and retrieved via the GetClassLong function.

+ +

    3.3        Window showing, +hiding and moving

+ +

The ShowWindow function allows windows to be made visible or hidden.  In addition, +this can be specified during the creation of the window, through CreateWindowEx.  +MoveWindow is called to change a window's position or size.  A WM_MOVE message is +sent if the window's position changes, and WM_SIZE is sent on size changes.

+ +

    3.4        Window painting

+ +

The Microwindows system determines when a window needs to be initially painted or +repainted as the result of other window movement, and a WM_PAINT message is sent to the +associated window procedure.  At this point, it's up the the application to use the +graphics primitives available to paint the window, described below.  Microwindows +keeps track of a windows' "update" region, and sends WM_PAINT whenever the +region is non-empty.  For speed reasons, the WM_PAINT message is only sent when there +are no other messages in the application's queue.  This allows the application to +repaint in one, rather than possibly many, steps.  To force a repaint rather than +waiting, the UpdateWindow function can be called.  The InvalidateRect function +specifies a rectangle to add to the update region, causing a subsequent WM_PAINT.

+ +

The window title is automatically painted and is set with the SetWindowText function, +and retrieved with the GetWindowText function.

+ +

        3.4.1    Client and screen +coordinates

+ +

Every window is drawn on the screen using the device global screen coordinate system +for absolute reference to any pixel on the screen.  The Microwindows API allows +applications programmers to be concerned with only the relative coordinates from the upper +left portion of their window, not including the title bar and 3d effects.  This +coordinate system is called "client coordinates."  As will be explained +below, the Microwindows programmer has the option of getting a device context in either +screen or client coordinates.  If device coordinates are specified, then the +coordinate system is device-based and includes the title area and 3d areas of the +window.  Otherwise, the drawable region is clipped to just that  area that is +reserved by the system for the application's drawing.  The GetClientRect and +GetWindowRect functions return client or screen coordinates for the passed window.  +ClientToScreen and ScreenToClient can be called to translate between window coordinate +systems.

+ +

        3.4.2    Device contexts

+ +

An applications programmer must obtain a "device context" before calling any +graphics drawing API functions.  As explained above, this specifies to the system +which window and what coordinate system are desired, so that these don't have to be passed +to every graphics function.  In addition, various other attributes like foreground +and background color are also set in a device context, so that these parameters don't have +to be specified for every graphics operation.  The device context selects the +appropriate clipping region based on the window specified and the coordinate system.  +When a device context is obtained, various graphics values are set to default values.

+ +

To obtain a client device context, call GetDC.  To obtain a screen device context, +required when drawing onto title bars and the like, call GetWindowDC.  In addition, +fancy clipping operations and child/sibling window clipping can be specified if GetDCEx is +called.  When finished drawing, the ReleaseDC function must be called to deallocate +the DC.

+ +

On receipt of the WM_PAINT message, two special calls, BeginPaint and EndPaint are +called, that serve as replacements to the GetDC/ReleaseDC functions.  These functions +essentially allocate a DC but also validate the update region so that no subsequent +WM_PAINT messages are generated.  BeginPaint also combines the update region and the +clipping region so that user output will only occur where previously invalidated.

+ +

        3.4.3    Graphics drawing +API

+ +

There are many graphics drawing API's in the Microwindows API.  Following is a +list, most of these match up to the engine GdXXX functions discussed in section 2.

+ +

    +SetTextColor                    +Set the foreground text color in a DC
+    +SetBkColor                      +Set the background color in a DC
+    +GetSysColor                    +Get the system color defined for the current look and feel scheme
+    +SetBkMode                     +Set the use background flag in a DC
+    +SetROP2                         +Set the drawing mode (XOR, SET, etc) for drawing
+    +SetPixel                            +Draw a pixel in the current fg color
+    +MoveToEx                       +Prepare to draw a line
+    +LineTo                              +Draw a line from the last location to this one in the current fg color
+    +Rectangle                          +Draw a rectangle in the current pen color
+    +FillRect                             +Fill a rectangle with the current brush color
+    +TextOut                            +Draw text in the current fg/bg color
+    +ExtTextOut                       +Draw text in the current fg/bg color
+    +DrawText                         +Draw text or compute text height and width sizes
+    +DrawDIB                          +Draw a color bitmap
+    +SelectObject                    +Select a pen, brush or font to use in a DC
+    +GetStockObject               +Get a predefined standard pen, brush or font
+    +CreatePen                        +Create a pen of a certain color
+    +CreateSolidBrush             +Create a brush of a certain color
+    CreateCompatibleBitmap  Create an offscreen area to draw onto
+    +DeleteObject                    +Delete a pen, brush or bitmap
+    CreateCompatibleDC        Create an +offscreen DC
+    +DeleteDC                         +Delete an offscreen DC
+    +BitBlit                                +Copy from one bitmap in a DC to another
+    GetSystemPaletteEntries    Get the currently in-use +system palette entries
+  

+ +

    3.5        Utility functions

+ +

A number of routines are provided for various purposes, described below.  In +addition, Microwindows currently exports some helper routines, named WndXXX, that are +useful but subject to change.  These are detailed following:

+ +

    +WndSetDesktopWallpaper                +Set the desktop background image
+    +WndSetCursor                                  +Set the cursor for a window
+    +WndRaiseWindow                             +Raise a window's z-order
+    +WndLowerWindow                           +Lower a window's z-order
+    +WndGetTopWindow                         +Return the topmost window's handle
+    +WndRegisterFdInput                          +Register to send a message when file descriptor has read data available
+    +WndUnregisterFdInput                       +Unregister file descriptor for read data messages

+ +

    +GetTickCount                                    +Return # milliseconds elapsed since startup
+    +Sleep                                                 +Delay processing for specified milliseconds

+ +

        3.5.1    Setting window +focus

+ +

The SetFocus routine is used to pass keyboard focus from one window to another.  +Keystrokes are always sent to the window with focus.  The WM_SETFOCUS and +WM_KILLFOCUS messages are sent to windows just receiving and losing focus.  The +GetActiveWindow routines returns the first non-child ancestor of the focus window, which +is the window that is currently highlighted.  The GetDesktopWindow routine returns +the window handle of the desktop window.

+ +

        3.5.2    Mouse capture

+ +

Normally, Microwindows sends WM_MOUSEMOVE messages to the window the mouse is currently +moving over.  If desired, the 7applications programmer can "capture" the +mouse and receive all mouse move messages by calling SetCapture.  ReleaseCapture +returns the processing to normal.  In addition, the GetCapture function will return +the window with capture, if any.

+ +

        3.5.3    Rectangle and +Region management

+ +

There are a number of functions that are used for rectangles and regions.  +Following is the group:

+ +

    +SetRect                        +Define a rectangle structure
+    +SetRectEmpty              +Define an empty rectangle
+    +CopyRect                    +Copy a rectangle
+    +IsRectEmpty                +Return TRUE if empty rectangle
+    +InflateRect                    +Enlarge a rectangle
+    +OffsetRect                    +Move a rectangle
+    +PtInRect                      +Determine if a point is in a rectangle
+  

+ +

A large number of region management routines are defined and declared in the winrgn.c +file.

+ +

 

+ +

4. Nano-X API

+ +

The Nano-X API was originally designed by David Bell, with his mini-x package for the +MINIX operating system.  Nano-X is now running on top of the core graphics engine +routines discussed in section 2.  Nano-X was designed for a client/server +environment, as no pointers to structures are passed to the API routines, instead a call +is made to the server to get an ID, which is passed to the API functions and is used to +reference the data on the server.  In addition, Nano-X is not message-oriented, +instead modeled after the X protocol which was designed for speed on systems where the +client and server machines were different.

+ +

    4.1        Client/Server model

+ +

In Nano-X, there are two linking mechanisms that can be used for applications +programs.  In the client/server model, the application program is linked with a +client library that forms a UNIX socket connection with the Nano-X server, a separate +process.  Each application then communicates all parameters over the UNIX +socket.  For speed and debugging, it is sometimes desirable to link the application +directly with the server.  In this case, a stub library is provided that just passes +the client routines parameters to the server function.

+ +

The Nano-X naming convention uses GrXXX to designate client side callable routines, +with a marshalling layer implemented in the files nanox/client.c, nanox/nxproto.c, and +nanox/srvnet.c.   The client/server network layer currently uses a fast approach to +marshalling the data from the Gr routine into a buffer, and sent all at once to the +receiving stubs in nanox/srvnet.c, before calling the server drawing routines in +nanox/srvfunc.c.  In the linked application scenario, the Nano-X client links +directly with the functions in nanox/srvfunc.c, and the nanox/client.c and nanox/srvnet.c +files are not required.

+ +

A Nano-X application must call GrOpen before calling any other Nano-X function, and +call GrClose before exiting.  These functions establish a connection with the server +when running the client/server model, and return an error status if the server can't be +found or isn't currently running.

+ +

The main loop in a Nano-X application is to create some windows, define the events you +want with GrSelectEvents, and then wait for an event with GrGetNextEvent.  If it is +desired to merely check for an event, but not wait if there isn't one, GrCheckNextEvent +can be used.  GrPeekEvent can be used to examine the next event without removing it +from the queue.

+ +

When running Nano-X programs in the client/server model, it's currently necessary to +run the server first in a shell script, then wait a second, then run the +application.  Some rewriting is needed to fire up the server when an application +requires it, I believe.

+ +

 4.2        Events

+ +

Nano-X applications specify which events they would like to see on a per-window basis +using GrSelectEvents.  Then, in the main loop, the application calls GrGetNextEvent +and waits for one of the event types selected for in any of the windows.  Typically, +a switch statement is used to determine what to do after receiving the event.  This +is similar to the Microwindows's API GetMessage/DispatchMessage loop, except that in +Microwindows API, DispatchMessage is used to send the event to the window's handling +procedure, typically located with the window object.  In Nano-X, all the event +handling code for each of the windows must be placed together in the main event loop, +there is no automatic dispatching.  Of course, widget sets serve to provide +object-orientation, but this is in addition to the Nano-X API.

+ +

Following are the event types that Nano-X programs can recieve:

+ +

    GR_EVENT_TYPE_NONE, ERROR, EXPOSURE, BUTTON_DOWN, BUTTON_UP, +MOUSE_ENTER, MOUSE_EXIT, MOUSE_MOTION, MOUSE_POSITION, KEY_UP, KEY_DOWN, FOCUS_IN, +FOCUS_OUT, FDINPUT

+ +

Note that Nano-X API provides mouse enter and exit events whereas Microwindows API does +not.  Also, the exposure events are calculated and sent immediately by the server, +and not combined and possibly delayed for better paint throughput as in the Microwindows +API.

+ +

 4.3        Window creation and destruction

+ +

Windows are created in Nano-X with the GrNewWindow function.  Windows can be +specified to be input-only, in which case the GrNewInputWindow function is used.  The +window border and color is specified in these calls, but will have to be rewritten when +fancier window dressings are required.  The return value from these functions is an +ID that can be used in later calls to get a graphics context or perform window +manipulation.

+ +

    4.4        Window showing, +hiding and moving

+ +

Windows are shown by calling the GrMapWindow function, and hidden using +GrUnmapWindow.  Mapping a window is required for all ancestors of a window in order +for it to be visible.  The GrRaiseWindow call is used to raise the Z order of a +window, while GrLowerWindow is used to lower the Z order.  GrMoveWindow is used to +change the position of a window, and GrResizeWindow is used to resize a window.

+ +

    4.5        Drawing to a window

+ +

Nano-X requires both a window ID and a graphics context ID in order to draw to a +window.  Nano-X sends expose events to the application when a window needs to be +redrawn.  Unlike the Microwindows API, Nano-X clients are typically required to +create their drawing graphics contexts early on and keep them for the duration of the +application.  Like Microwindows though, the graphics contexts record information like +the current background and foreground colors so they don't have to be specified in every +graphics API call.

+ +

        4.5.1    Graphics contexts

+ +

To allocate a graphics context for a window, call GrNewGC.  On termination, call +GrDestroyGC.  GrCopyGC can be used to copy on GC to another.  GrGetGCInfo is +used to retrieve the settings contained in a GC.  After creating a graphics context, +the server returns a graphics context ID.  This is then used as a parameter in all +the graphics drawing API functions.  In Nano-X programs, the current clipping region +and window coordinate system aren't stored with the GC, as they are in Microwindows' +DCs.  This is because, first, Nano-X doesn't support dual coordinate systems for +drawing to the "window dressing" area versus the "user" area of the +window (window and client coordinates in Microwindows).  User programs can't draw the +border area of the window, only a single color and width can be specified.  Although +resembling X, this will have to change, so that widget sets can specify the look and feel +of all aspects of the windows they maintain.  Since the clipping region isn't +maintained with the graphics context, but instead with the window data structure, Nano-X +applications must specify both a window ID and a graphics context ID when calling any +graphics API function.  Because of this, many Nano-X applications allocate all +graphics contexts in the beginning of the program, and hold them throughout execution, +since the graphics contexts hold only things like foreground color, etc, and no window +information.  This cannot be done with Microwindows API because the DC's contain +window clipping information and must be released before processing the next message.

+ +

        4.5.2    Graphics drawing +API

+ +

Following are the graphics drawing functions available with Nano-X.  Like +Microwindows API, these all match up eventually to the graphics engine GdXXX routines.

+ +

    +GrGetGCTextSize                    +Return text width and height information
+    +GrClearWindow                       +Clear a window to it's background color
+    +GrSetGCForeground                +Set the foreground color in a graphics context
+    +GrSetGCBackground               +Set the background color in a graphics context
+    GrSetGCUseBackground         +Set the "use background color" in a graphics context
+    +GrSetGCMode                        +Set the drawing mode
+    +GrSetGCFont                           +Set the font
+    +GrPoint                                     +Draw a point in the passed gc's foreground color
+    +GrLine                                      +Draw a line in the passed gc's foreground color
+    +GrRect                                     +Draw a rectangle in passed gc's foreground color
+    +GrFillRect                                 +Fill a rectangle with the passed gc's foreground color
+    +GrEllipse                                   +Draw a circle or ellipse with the passed gc's foreground color
+    +GrFillEllipse                               +Fill a circle or ellipse with the passed gc's foreground color
+    +GrPoly                                       +Draw a polygon using the passed gc's foreground color
+    +GrFillPoly                                  +Fill a polygon using the passed gc's foreground color
+    +GrText                                       +Draw a text string using the foreground and possibly background colors
+    +GrBitmap                                  +Draw an image using a passed monocrhome bitmap, use fb/bg colors
+    +GrArea                                     +Draw a rectangular area using the passed device-dependent pixels
+    +GrReadArea                             +Read the pixel values from the screen and return them
+    GrGetSystemPaletteEntries        Get +the currently in-use system palette entries
+    GrFindColor                             +Translate an RGB color value to a PIXELVAL pixel value
+

+ +

   4.6        Utility functions

+ +

Various functions serve as utility functions to manipulate windows and provide other +information.  These include the following:

+ +

    +GrSetBorderColor                    +Set the border color of a window.  Not suitable for 3d look and feel.
+    +GrSetCursor                             +Set the cursor bitmap for the window.
+    +GrMoveCursor                         +Move the cursor to absolute screen coordinates.
+    +GrSetFocus                              +Set the keyboard input focus window.
+    +GrRedrawScreen                      +Redraw the entire screen.
+    +GrGetScreenInfo                       +Return information about the size of the physical display.
+    +GrGetWindowInfo                    +Return information about the passed window.
+    +GrGetGCInfo                            +Return information about the passed graphics context.
+    +GrGetFontInfo                          +Return information about the passed font number.
+    +GrRegisterInput                        +Register a file descriptor to return an event when read data available
+    GrPrepareSelect +                       +Prepare the fd_set and maxfd variables for using Nano-X as a passive library
+    GrServiceSelect +                        +Callback the passed GetNextEvent routine when Nano-X has events requiring processing
+    GrMainLoop +                             +A convenience routine for a typical Nano-X application main loop

+ + diff --git a/packages/services/gfx/mw/current/doc/nano-X/Makefile b/packages/services/gfx/mw/current/doc/nano-X/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/Makefile @@ -0,0 +1,42 @@ +# Note! You need to have gtk-doc, docbook, jade, tex, and various other +# things set up and playing nicely before you will be able to rebuild +# this documentation. If you just want to read the docs, use the prebuilt +# copies provided. + +MODULE=nano-X +SRCDIR=../../src/ +SOURCEDIR=$(SRCDIR)nanox/ +INCLUDES=$(SRCDIR)/include/nano-X.h +MODFLG=--module=$(MODULE) + +.PHONY : scan templates sgml html ps pdf dvi rtf clean + +all: pdf html cleanup + +scan: $(INCLUDES) + gtkdoc-scan $(MODFLG) --source-dir=$(SOURCEDIR) $(INCLUDES) + +templates: scan + gtkdoc-mktmpl $(MODFLG) + +sgml: templates + gtkdoc-mkdb $(MODFLG) --source-dir=$(SOURCEDIR) + +html: sgml $(MODULE)-docs.sgml + if ! test -d html ; then mkdir html ; fi + cd html && gtkdoc-mkhtml $(MODFLG) ../$(MODULE)-docs.sgml + +ps: sgml $(MODULE)-docs.sgml + db2ps $(MODULE)-docs.sgml + +pdf: ps + ps2pdf $(MODULE)-docs.ps + +cleanup: + rm -f sgml/* tmpl/* *.bak *.log $(MODULE)-unused.txt $(MODULE)-decl.txt $(MODULE)-decl-list.txt *.tex *.dvi *.aux + if test -d tmpl ; then rmdir tmpl ; fi + if test -d sgml ; then rmdir sgml ; fi + +clean: cleanup + rm -f html/* *.pdf *.ps + if test -d html ; then rmdir html ; fi diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/index.html b/packages/services/gfx/mw/current/doc/nano-X/html/index.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/index.html @@ -0,0 +1,183 @@ +Nano-X API Reference Manual


   Next Page >>>
 libnano-X
\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/index.sgml b/packages/services/gfx/mw/current/doc/nano-X/html/index.sgml new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/index.sgml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/libnano-x.html b/packages/services/gfx/mw/current/doc/nano-X/html/libnano-x.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/libnano-x.html @@ -0,0 +1,264 @@ +libnano-X
Nano-X API Reference Manual
<<< Previous PageHome Next Page >>>

libnano-X

Table of Contents
general
window
graphics
events
fonts
pointer
colours
regions
selections
misc


<<< Previous PageHome Next Page >>>
Nano-X API Reference Manualgeneral
\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-colours.html b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-colours.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-colours.html @@ -0,0 +1,617 @@ +colours
Nano-X API Reference Manual
<<< Previous PageHomeUpNext Page >>>

colours

Name

colours —

Synopsis


+
+void        GrGetSystemPalette              (GR_PALETTE *pal);
+void        GrSetSystemPalette              (GR_COUNT first,
+                                             GR_PALETTE *pal);
+void        GrFindColor                     (GR_COLOR c,
+                                             GR_PIXELVAL *retpixel);
+GR_COLOR    GrGetSysColor                   (int index);

Description

Details

GrGetSystemPalette ()

void        GrGetSystemPalette              (GR_PALETTE *pal);

Retrieves the system palette and places it in the specified palette +structure.

pal : pointer to a palette structure to fill in with the system palette


GrSetSystemPalette ()

void        GrSetSystemPalette              (GR_COUNT first,
+                                             GR_PALETTE *pal);

Sets the system palette to the values stored in the specified palette +structure. The values before the specified first value are not set.

first : the first palette value to set
pal : pointer to a palette structure containing the new values


GrFindColor ()

void        GrFindColor                     (GR_COLOR c,
+                                             GR_PIXELVAL *retpixel);

Calculates the pixel value to use to display the specified colour value. +The colour value is specified as a GR_COLOR, which is a 32 bit truecolour +value stored as RGBX. The pixel value size depends on the architecture.

c : the colour value to find
retpixel : pointer to the returned pixel value


GrGetSysColor ()

GR_COLOR    GrGetSysColor                   (int index);

index : an index into the server's colour look up table
Returns : the colour found at the specified index

\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-events.html b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-events.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-events.html @@ -0,0 +1,700 @@ +events
Nano-X API Reference Manual
<<< Previous PageHomeUpNext Page >>>

events

Name

events —

Synopsis


+
+void        GrSelectEvents                  (GR_WINDOW_ID wid,
+                                             GR_EVENT_MASK eventmask);
+void        GrGetNextEvent                  (GR_EVENT *ep);
+void        GrGetNextEventTimeout           (GR_EVENT *ep,
+                                             GR_TIMEOUT timeout);
+void        GrCheckNextEvent                (GR_EVENT *ep);
+int         GrPeekEvent                     (GR_EVENT *ep);

Description

Details

GrSelectEvents ()

void        GrSelectEvents                  (GR_WINDOW_ID wid,
+                                             GR_EVENT_MASK eventmask);

Select the event types which should be returned for the specified window.

wid : the ID of the window to set the event mask of
eventmask : a bit field specifying the desired event mask


GrGetNextEvent ()

void        GrGetNextEvent                  (GR_EVENT *ep);

Gets the next event from the event queue and places it in the specified +GR_EVENT structure. If the queue is currently empty, we sleep until the +next event arrives from the server or input is read on a file descriptor +previously specified by GrRegisterInput().

ep : pointer to the GR_EVENT structure to return the event in


GrGetNextEventTimeout ()

void        GrGetNextEventTimeout           (GR_EVENT *ep,
+                                             GR_TIMEOUT timeout);

Gets the next event from the event queue and places it in the specified +GR_EVENT structure. If the queue is currently empty, we sleep until the +next event arrives from the server, input is read on a file descriptor +previously specified by GrRegisterInput(), or a timeout occurs. Note +that a value of 0 for the timeout parameter doesn't mean "timeout after 0 +milliseconds" but is in fact a magic number meaning "never time out".

ep : pointer to the GR_EVENT structure to return the event in
timeout : the number of milliseconds to wait before timing out


GrCheckNextEvent ()

void        GrCheckNextEvent                (GR_EVENT *ep);

Gets the next event from the event queue if there is one, or returns +immediately with an event type of GR_EVENT_TYPE_NONE if it is empty.

ep : pointer to the GR_EVENT structure to return the event in


GrPeekEvent ()

int         GrPeekEvent                     (GR_EVENT *ep);

Fills in the specified event structure with a copy of the next event on the +queue, without actually removing it from the queue. An event type of +GR_EVENT_TYPE_NONE is given if the queue is empty.

ep : pointer to the GR_EVENT structure to return the event in
Returns : 1 if an event was returned, or 0 if the queue was empty

\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-fonts.html b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-fonts.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-fonts.html @@ -0,0 +1,876 @@ +fonts
Nano-X API Reference Manual
<<< Previous PageHomeUpNext Page >>>

fonts

Name

fonts —

Synopsis


+
+GR_FONT_ID  GrCreateFont                    (GR_CHAR *name,
+                                             GR_COORD height,
+                                             GR_LOGFONT *plogfont);
+void        GrSetFontSize                   (GR_FONT_ID fontid,
+                                             GR_COORD size);
+void        GrSetFontRotation               (GR_FONT_ID fontid,
+                                             int tenthsdegrees);
+void        GrSetFontAttr                   (GR_FONT_ID fontid,
+                                             int setflags,
+                                             int clrflags);
+void        GrDestroyFont                   (GR_FONT_ID fontid);
+void        GrGetFontInfo                   (GR_FONT_ID font,
+                                             GR_FONT_INFO *fip);

Description

Details

GrCreateFont ()

GR_FONT_ID  GrCreateFont                    (GR_CHAR *name,
+                                             GR_COORD height,
+                                             GR_LOGFONT *plogfont);

Attempts to locate a font with the desired attributes and returns a font +ID number which can be used to refer to it. If the plogfont argument is +not NULL, the values in that structure will be used to choose a font. +Otherwise, if the height is non zero, the built in font with the closest +height to that specified will be used. If the height is zero, the built +in font with the specified name will be used. If the desired font is not +found, the first built in font will be returned as a last resort.

name : string containing the name of a built in font to look for
height : the desired height of the font
plogfont : pointer to a LOGFONT structure
Returns : a font ID number which can be used to refer to the font


GrSetFontSize ()

void        GrSetFontSize                   (GR_FONT_ID fontid,
+                                             GR_COORD size);

Changes the size of the specified font to the specified size.

fontid : the ID number of the font to change the size of
size : 


GrSetFontRotation ()

void        GrSetFontRotation               (GR_FONT_ID fontid,
+                                             int tenthsdegrees);

Changes the rotation of the specified font to the specified angle.

fontid : the ID number of the font to rotate
tenthsdegrees : 


GrSetFontAttr ()

void        GrSetFontAttr                   (GR_FONT_ID fontid,
+                                             int setflags,
+                                             int clrflags);

Changes the attributes (GR_TFKERNING, GR_TFANTIALIAS, GR_TFUNDERLINE, etc.) +of the specified font according to the set and clear mask arguments.

fontid : the ID of the font to set the attributes of
setflags : mask specifying attribute flags to set
clrflags : mask specifying attribute flags to clear


GrDestroyFont ()

void        GrDestroyFont                   (GR_FONT_ID fontid);

Frees all resources associated with the specified font ID, and if the font +is a non built in type and this is the last ID referring to it, unloads the +font from memory.

fontid : the ID of the font to destroy


GrGetFontInfo ()

void        GrGetFontInfo                   (GR_FONT_ID font,
+                                             GR_FONT_INFO *fip);

Fills in the specified GR_FONT_INFO structure with information regarding +the specified font.

font : 
fip : pointer to a GR_FONT_INFO structure

\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-general.html b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-general.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-general.html @@ -0,0 +1,706 @@ +general
Nano-X API Reference Manual
<<< Previous PageHomeUpNext Page >>>

general

Name

general —

Synopsis


+
+void        GrFlush                         (void);
+int         GrOpen                          (void);
+void        GrClose                         (void);
+void        GrMainLoop                      (GR_FNCALLBACKEVENT fncb);
+void        GrGetScreenInfo                 (GR_SCREEN_INFO *sip);
+GR_FNCALLBACKEVENT GrSetErrorHandler        (GR_FNCALLBACKEVENT fncb);
+void        GrDefaultErrorHandler           (GR_EVENT *ep);

Description

Details

GrFlush ()

void        GrFlush                         (void);

Flush the message buffer of any messages it may contain.


GrOpen ()

int         GrOpen                          (void);

Open a connection to the graphics server.

Returns : the fd of the connection to the server or -1 on failure


GrClose ()

void        GrClose                         (void);

Close the graphics device, flushing any waiting messages.


GrMainLoop ()

void        GrMainLoop                      (GR_FNCALLBACKEVENT fncb);

A convenience function which calls the specified callback function whenever +an event arrives or there is data to be read on a file descriptor previously +specified by GrRegisterInput(). Currently never returns.

fncb : 


GrGetScreenInfo ()

void        GrGetScreenInfo                 (GR_SCREEN_INFO *sip);

Fills in the specified GR_SCREEN_INFO structure.

sip : pointer to a GR_SCREEN_INFO structure


GrSetErrorHandler ()

GR_FNCALLBACKEVENT GrSetErrorHandler        (GR_FNCALLBACKEVENT fncb);

Sets an error handling routine that will be called on any errors from +the server (assuming the client has asked to receive them). If zero is +used as the argument, errors will be returned as regular events instead.

fncb : the function to call to handle error events
Returns : the address of the previous error handler


GrDefaultErrorHandler ()

void        GrDefaultErrorHandler           (GR_EVENT *ep);

The default error handler which is called when the server reports an error +event and the client hasn't set up a handler of it's own.

Generates a human readable error message on stderr describing what error +occurred and what function it occured in, then exits.

ep : the error event structure

\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-graphics.html b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-graphics.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-graphics.html @@ -0,0 +1,5504 @@ +graphics
Nano-X API Reference Manual
<<< Previous PageHomeUpNext Page >>>

graphics

Name

graphics —

Synopsis


+
+GR_GC_ID    GrNewGC                         (void);
+GR_GC_ID    GrCopyGC                        (GR_GC_ID gc);
+void        GrGetGCInfo                     (GR_GC_ID gc,
+                                             GR_GC_INFO *gcip);
+void        GrDestroyGC                     (GR_GC_ID gc);
+void        GrLine                          (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x1,
+                                             GR_COORD y1,
+                                             GR_COORD x2,
+                                             GR_COORD y2);
+void        GrPoint                         (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y);
+void        GrPoints                        (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COUNT count,
+                                             GR_POINT *pointtable);
+void        GrRect                          (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height);
+void        GrFillRect                      (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height);
+void        GrPoly                          (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COUNT count,
+                                             GR_POINT *pointtable);
+void        GrFillPoly                      (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COUNT count,
+                                             GR_POINT *pointtable);
+void        GrEllipse                       (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE rx,
+                                             GR_SIZE ry);
+void        GrFillEllipse                   (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE rx,
+                                             GR_SIZE ry);
+void        GrArc                           (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE rx,
+                                             GR_SIZE ry,
+                                             GR_COORD ax,
+                                             GR_COORD ay,
+                                             GR_COORD bx,
+                                             GR_COORD by,
+                                             int type);
+void        GrArcAngle                      (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE rx,
+                                             GR_SIZE ry,
+                                             GR_COORD angle1,
+                                             GR_COORD angle2,
+                                             int type);
+void        GrSetGCForeground               (GR_GC_ID gc,
+                                             GR_COLOR foreground);
+void        GrSetGCBackground               (GR_GC_ID gc,
+                                             GR_COLOR background);
+void        GrSetGCUseBackground            (GR_GC_ID gc,
+                                             GR_BOOL flag);
+void        GrSetGCMode                     (GR_GC_ID gc,
+                                             int mode);
+void        GrSetGCFont                     (GR_GC_ID gc,
+                                             GR_FONT_ID font);
+void        GrGetGCTextSize                 (GR_GC_ID gc,
+                                             void *str,
+                                             int count,
+                                             int flags,
+                                             GR_SIZE *retwidth,
+                                             GR_SIZE *retheight,
+                                             GR_SIZE *retbase);
+void        GrReadArea                      (GR_DRAW_ID id,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_PIXELVAL *pixels);
+void        GrArea                          (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             void *pixels,
+                                             int pixtype);
+void        GrCopyArea                      (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_DRAW_ID srcid,
+                                             GR_COORD srcx,
+                                             GR_COORD srcy,
+                                             int op);
+void        GrBitmap                        (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_BITMAP *imagebits);
+void        GrFreeImage                     (GR_IMAGE_ID id);
+void        GrGetImageInfo                  (GR_IMAGE_ID id,
+                                             GR_IMAGE_INFO *iip);
+void        GrDrawImageFromFile             (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             char *path,
+                                             int flags);
+GR_IMAGE_ID GrLoadImageFromFile             (char *path,
+                                             int flags);
+void        GrDrawImageToFit                (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_IMAGE_ID imageid);
+void        GrDrawImageBits                 (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_IMAGE_HDR *pimage);
+void        GrText                          (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             void *str,
+                                             GR_COUNT count,
+                                             int flags);

Description

Details

GrNewGC ()

GR_GC_ID    GrNewGC                         (void);

Creates a new graphics context structure and returns the ID used to refer +to it. The structure is initialised with a set of default parameters.

Returns : the ID of the newly created graphics context or 0 on error


GrCopyGC ()

GR_GC_ID    GrCopyGC                        (GR_GC_ID gc);

Creates a new graphics context structure and fills it in with the values +from the specified already existing graphics context.

gc : the already existing graphics context to copy the parameters from
Returns : the ID of the newly created graphics context or 0 on error


GrGetGCInfo ()

void        GrGetGCInfo                     (GR_GC_ID gc,
+                                             GR_GC_INFO *gcip);

Fills in the specified GR_GC_INFO structure with information regarding the +specified graphics context.

gc : a graphics context
gcip : pointer to a GR_GC_INFO structure


GrDestroyGC ()

void        GrDestroyGC                     (GR_GC_ID gc);

Destroys the graphics context structure with the specified ID.

gc : the ID of the graphics context structure to destroy


GrLine ()

void        GrLine                          (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x1,
+                                             GR_COORD y1,
+                                             GR_COORD x2,
+                                             GR_COORD y2);

Draws a line using the specified graphics context on the specified drawable +from (x1, y1) to (x2, y2), with coordinates given relative to the drawable.

id : the ID of the drawable to draw the line on
gc : the ID of the graphics context to use when drawing the line
x1 : the X coordinate of the start of the line relative to the drawable
y1 : the Y coordinate of the start of the line relative to the drawable
x2 : the X coordinate of the end of the line relative to the drawable
y2 : the Y coordinate of the end of the line relative to the drawable


GrPoint ()

void        GrPoint                         (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y);

Draws a point using the specified graphics context at the specified position +on the specified drawable.

id : the ID of the drawable to draw a point on
gc : the ID of the graphics context to use when drawing the point
x : the X coordinate to draw the point at relative to the drawable
y : the Y coordinate to draw the point at relative to the drawable


GrPoints ()

void        GrPoints                        (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COUNT count,
+                                             GR_POINT *pointtable);

Draws a set of points using the specified graphics context at the positions +specified by the point table on the specified drawable.

id : the ID of the drawable to draw a point on
gc : the ID of the graphics context to use when drawing the point
count : the number of points in the point table
pointtable : pointer to a GR_POINT array which lists the points to draw


GrRect ()

void        GrRect                          (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height);

Draw the boundary of a rectangle of the specified dimensions and position +on the specified drawable using the specified graphics context.

id : the ID of the drawable to draw the rectangle on
gc : the ID of the graphics context to use when drawing the rectangle
x : the X coordinate of the rectangle relative to the drawable
y : the Y coordinate of the rectangle relative to the drawable
width : the width of the rectangle
height : the height of the rectangle


GrFillRect ()

void        GrFillRect                      (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height);

Draw a filled rectangle of the specified dimensions and position on the +specified drawable using the specified graphics context.

id : the ID of the drawable to draw the rectangle on
gc : the ID of the graphics context to use when drawing the rectangle
x : the X coordinate of the rectangle relative to the drawable
y : the Y coordinate of the rectangle relative to the drawable
width : the width of the rectangle
height : the height of the rectangle


GrPoly ()

void        GrPoly                          (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COUNT count,
+                                             GR_POINT *pointtable);

Draws an unfilled polygon on the specified drawable using the specified +graphics context. The polygon is specified by an array of point structures. +The polygon is not automatically closed- if a closed polygon is desired, +the last point must be the same as the first.

id : the ID of the drawable to draw the polygon onto
gc : the ID of the graphics context to use when drawing the polygon
count : the number of points in the point array
pointtable : pointer to an array of points describing the polygon


GrFillPoly ()

void        GrFillPoly                      (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COUNT count,
+                                             GR_POINT *pointtable);

Draws a filled polygon on the specified drawable using the specified +graphics context. The polygon is specified by an array of point structures. +The polygon is automatically closed- the last point need not be the same as +the first in order for the polygon to be closed.

id : the ID of the drawable to draw the polygon onto
gc : the ID of the graphics context to use when drawing the polygon
count : the number of points in the point array
pointtable : pointer to an array of points describing the polygon


GrEllipse ()

void        GrEllipse                       (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE rx,
+                                             GR_SIZE ry);

Draws the boundary of ellipse at the specified position using the specified +dimensions and graphics context on the specified drawable.

id : the ID of the drawable to draw the ellipse on
gc : the ID of the graphics context to use when drawing the ellipse
x : the X coordinate to draw the ellipse at relative to the drawable
y : the Y coordinate to draw the ellipse at relative to the drawable
rx : the radius of the ellipse on the X axis
ry : the radius of the ellipse on the Y axis


GrFillEllipse ()

void        GrFillEllipse                   (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE rx,
+                                             GR_SIZE ry);

Draws a filled ellipse at the specified position using the specified +dimensions and graphics context on the specified drawable.

id : the ID of the drawable to draw the filled ellipse on
gc : the ID of the graphics context to use when drawing the ellipse
x : the X coordinate to draw the ellipse at relative to the drawable
y : the Y coordinate to draw the ellipse at relative to the drawable
rx : the radius of the ellipse on the X axis
ry : the radius of the ellipse on the Y axis


GrArc ()

void        GrArc                           (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE rx,
+                                             GR_SIZE ry,
+                                             GR_COORD ax,
+                                             GR_COORD ay,
+                                             GR_COORD bx,
+                                             GR_COORD by,
+                                             int type);

Draws an arc with the specified dimensions at the specified position +on the specified drawable using the specified graphics context. +The type specifies the fill type. Possible values include GR_ARC and +GR_PIE.

id : the ID of the drawable to draw the arc on
gc : the graphics context to use when drawing the arc
x : the X coordinate to draw the arc at relative to the drawable
y : the Y coordinate to draw the arc at relative to the drawable
rx : the radius of the arc on the X axis
ry : the radius of the arc on the Y axis
ax : the X coordinate of the start of the arc relative to the drawable
ay : the Y coordinate of the start of the arc relative to the drawable
bx : the X coordinate of the end of the arc relative to the drawable
by : the Y coordinate of the end of the arc relative to the drawable
type : the fill style to use when drawing the arc


GrArcAngle ()

void        GrArcAngle                      (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE rx,
+                                             GR_SIZE ry,
+                                             GR_COORD angle1,
+                                             GR_COORD angle2,
+                                             int type);

Draws an arc with the specified dimensions at the specified position +on the specified drawable using the specified graphics context. +The type specifies the fill type. Possible values include GR_ARC and +GR_PIE. This function requires floating point support, and is slightly +slower than the GrArc() function which does not require floating point.

id : the ID of the drawable to draw the arc on
gc : the graphics context to use when drawing the arc
x : the X coordinate to draw the arc at relative to the drawable
y : the Y coordinate to draw the arc at relative to the drawable
rx : the radius of the arc on the X axis
ry : the radius of the arc on the Y axis
angle1 : the angle of the start of the arc
angle2 : the angle of the end of the arc
type : the fill style to use when drawing the arc


GrSetGCForeground ()

void        GrSetGCForeground               (GR_GC_ID gc,
+                                             GR_COLOR foreground);

Changes the foreground colour of the specified graphics context to the +specified colour.

gc : the ID of the graphics context to set the foreground colour of
foreground : the colour to use as the new foreground colour


GrSetGCBackground ()

void        GrSetGCBackground               (GR_GC_ID gc,
+                                             GR_COLOR background);

Changes the background colour of the specified graphics context to the +specified colour.

gc : the ID of the graphics context to set the background colour of
background : the colour to use as the new background colour


GrSetGCUseBackground ()

void        GrSetGCUseBackground            (GR_GC_ID gc,
+                                             GR_BOOL flag);

Sets the flag which chooses whether or not the background colour is used +when drawing bitmaps and text using the specified graphics context to the +specified value.

gc : the ID of the graphics context to change the "use background" flag of
flag : flag specifying whether to use the background colour or not


GrSetGCMode ()

void        GrSetGCMode                     (GR_GC_ID gc,
+                                             int mode);

Changes the drawing mode (SET, XOR, OR, AND, etc.) of the specified +graphics context to the specified mode.

gc : the ID of the graphics context to set the drawing mode of
mode : the new drawing mode


GrSetGCFont ()

void        GrSetGCFont                     (GR_GC_ID gc,
+                                             GR_FONT_ID font);

Sets the font to be used for text drawing in the specified graphics +context to the specified font ID.

gc : the ID of the graphics context to set the font of
font : the ID of the font


GrGetGCTextSize ()

void        GrGetGCTextSize                 (GR_GC_ID gc,
+                                             void *str,
+                                             int count,
+                                             int flags,
+                                             GR_SIZE *retwidth,
+                                             GR_SIZE *retheight,
+                                             GR_SIZE *retbase);

Calculates the dimensions of the specified text string using the current font +and flags in the specified graphics context. The count argument can be -1 +if the string is null terminated.

gc : the graphics context
str : pointer to a text string
count : the length of the string
flags : text rendering flags (GR_TF*)
retwidth : pointer to the variable the width will be returned in
retheight : pointer to the variable the height will be returned in
retbase : pointer to the variable the baseline height will be returned in


GrReadArea ()

void        GrReadArea                      (GR_DRAW_ID id,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_PIXELVAL *pixels);

Reads the pixel data of the specified size from the specified position on +the specified drawable into the specified pixel array. If the drawable is +a window, the data returned will be the pixel values from the relevant +position on the screen regardless of whether the window is obscured by other +windows. If the window is unmapped, or partially or fully outside a window +boundary, black pixel values will be returned.

id : the ID of the drawable to read an area from
x : the X coordinate to read the area from relative to the drawable
y : the Y coordinate to read the area from relative to the drawable
width : the width of the area to read
height : the height of the area to read
pixels : pointer to an area of memory to place the pixel data in


GrArea ()

void        GrArea                          (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             void *pixels,
+                                             int pixtype);

Draws the specified pixel array of the specified size and format onto the +specified drawable using the specified graphics context at the specified +position. Note that colour conversion is currently only performed when using +the GR_PF_RGB format, which is an unsigned long containing RGBX data.

id : the ID of the drawable to draw the area onto
gc : the ID of the graphics context to use when drawing the area
x : the X coordinate to draw the area at relative to the drawable
y : the Y coordinate to draw the area at relative to the drawable
width : the width of the area
height : the height of the area
pixels : pointer to an array containing the pixel data
pixtype : the format of the pixel data


GrCopyArea ()

void        GrCopyArea                      (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_DRAW_ID srcid,
+                                             GR_COORD srcx,
+                                             GR_COORD srcy,
+                                             int op);

Copies the specified area of the specified size between the specified +drawables at the specified positions using the specified graphics context +and ROP codes. 0 is a sensible default ROP code in most cases.

id : the ID of the drawable to copy the area to
gc : the ID of the graphics context to use when copying the area
x : the X coordinate to copy the area to within the destination drawable
y : the Y coordinate to copy the area to within the destination drawable
width : the width of the area to copy
height : the height of the area to copy
srcid : the ID of the drawable to copy the area from
srcx : the X coordinate to copy the area from within the source drawable
srcy : the Y coordinate to copy the area from within the source drawable
op : the ROP codes to pass to the blitter when performing the copy


GrBitmap ()

void        GrBitmap                        (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_BITMAP *imagebits);

Draws the monochrome bitmap data provided in the bitmaptable argument +at the specified position on the specified drawable using the specified +graphics context. Note that the bitmap data should be an array of aligned +16 bit words. The usebackground flag in the graphics context specifies +whether to draw the background colour wherever a bit value is zero.

id : the ID of the drawable to draw the bitmap onto
gc : the ID of the graphics context to use when drawing the bitmap
x : the X coordinate to draw the bitmap at relative to the drawable
y : the Y coordinate to draw the bitmap at relative to the drawable
width : the width of the bitmap
height : the height of the bitmap
imagebits : 


GrFreeImage ()

void        GrFreeImage                     (GR_IMAGE_ID id);

Destroys the specified image buffer and reclaims the memory used by it.

id : ID of the image buffer to free


GrGetImageInfo ()

void        GrGetImageInfo                  (GR_IMAGE_ID id,
+                                             GR_IMAGE_INFO *iip);

Fills in the specified image information structure with the details of the +specified image buffer.

id : ID of an image buffer
iip : pointer to a GR_IMAGE_INFO structure


GrDrawImageFromFile ()

void        GrDrawImageFromFile             (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             char *path,
+                                             int flags);

Loads the specified image file and draws it at the specified position +on the specified drawable using the specified graphics context. The +width and height values specify the size of the image to draw- if the +actual image is a different size, it will be scaled to fit. The image type +is automatically detected using the magic numbers in the image header (ie. +the filename extension is irrelevant). The currently supported image types +include GIF, JPEG, Windows BMP, PNG, XPM, and both ascii and binary +variants of PBM, PGM, and PPM. However the image types supported by a +particular server depend on which image types were enabled in the server +configuration at build time.

id : the ID of the drawable to draw the image onto
gc : the ID of the graphics context to use when drawing the image
x : the X coordinate to draw the image at relative to the drawable
y : the Y coordinate to draw the image at relative to the drawable
width : the maximum image width
height : the maximum image height
path : string containing the filename of the image to load
flags : flags specific to the particular image loader


GrLoadImageFromFile ()

GR_IMAGE_ID GrLoadImageFromFile             (char *path,
+                                             int flags);

Loads the specified image file into a newly created server image buffer +and returns the ID of the buffer. The image type is automatically detected +using the magic numbers in the image header (ie. the filename extension is +irrelevant). The currently supported image types include GIF, JPEG, Windows +BMP, PNG, XPM, and both ascii and binary variants of PBM, PGM, and PPM. +However the image types supported by a particular server depend on which +image types were enabled in the server configuration at build time.

path : string containing the filename of the image to load
flags : flags specific to the particular image loader
Returns : ID of the image buffer the image was loaded into


GrDrawImageToFit ()

void        GrDrawImageToFit                (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_IMAGE_ID imageid);

Draws the image from the specified image buffer at the specified position +on the specified drawable using the specified graphics context. The +width and height values specify the size of the image to draw- if the +actual image is a different size, it will be scaled to fit.

id : the ID of the drawable to draw the image onto
gc : the ID of the graphics context to use when drawing the image
x : the X coordinate to draw the image at relative to the drawable
y : the Y coordinate to draw the image at relative to the drawable
width : the maximum image width
height : the maximum image height
imageid : the ID of the image buffer containing the image to display


GrDrawImageBits ()

void        GrDrawImageBits                 (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_IMAGE_HDR *pimage);

Draws the image contained in the specified image structure onto the +specified drawable at the specified coordinates using the specified +graphics context.

id : the ID of the drawable to draw the image onto
gc : the ID of the graphics context to use when drawing the image
x : the X coordinate to draw the image at relative to the drawable
y : the Y coordinate to draw the image at relative to the drawable
pimage : pointer to the image structure


GrText ()

void        GrText                          (GR_DRAW_ID id,
+                                             GR_GC_ID gc,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             void *str,
+                                             GR_COUNT count,
+                                             int flags);

Draws the specified text string at the specified position on the specified +drawable using the specified graphics context and flags. The default flags +specify ASCII encoding and baseline alignment.

id : the ID of the drawable to draw the text string onto
gc : the ID of the graphics context to use when drawing the text string
x : the X coordinate to draw the string at relative to the drawable
y : the Y coordinate to draw the string at relative to the drawable
str : the text string to draw
count : the number of characters (not bytes) in the string
flags : flags specifying text encoding, alignment, etc.

\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-misc.html b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-misc.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-misc.html @@ -0,0 +1,863 @@ +misc
Nano-X API Reference Manual
<<< Previous PageHomeUp 

misc

Name

misc —

Synopsis


+
+void        GrReqShmCmds                    (long shmsize);
+void        GrInjectKeyboardEvent           (GR_WINDOW_ID wid,
+                                             GR_UNICODE uch,
+                                             GR_CHAR ch,
+                                             int modif,
+                                             int special,
+                                             unsigned char content);
+void        GrRegisterInput                 (int fd);
+void        GrPrepareSelect                 (int *maxfd,
+                                             void *rfdset);
+void        GrServiceSelect                 (void *rfdset,
+                                             GR_FNCALLBACKEVENT fncb);
+void        GrBell                          (void);
+void        GrSetScreenSaverTimeout         (GR_TIMEOUT timeout);

Description

Details

GrReqShmCmds ()

void        GrReqShmCmds                    (long shmsize);

Requests a shared memory area of the specified size to use for transferring +command arguments. This is faster but less portable than the standard BSD +sockets method of communication (and of course will only work if the client +and server are on the same machine). Apart from the initial allocation of +the area using this call, the use of shared memory is completely +transparent. Additionally, if the allocation fails we silently and +automatically fall back on socket communication. It is safe to call this +function even if shared memory support is not compiled in; it will simply +do nothing.

FIXME: how does the user decide what size of shared memory area to allocate?

shmsize : the size of the shared memory area to allocate


GrInjectKeyboardEvent ()

void        GrInjectKeyboardEvent           (GR_WINDOW_ID wid,
+                                             GR_UNICODE uch,
+                                             GR_CHAR ch,
+                                             int modif,
+                                             int special,
+                                             unsigned char content);

Sends a keyboard event to the specified window, or to the window with the +current keyboard focus if 0 is used as the ID. The other arguments +correspond directly to the fields of the same names in the keyboard event +structure.

wid : ID of the window to send the event to, or 0
uch : 32 bit Unicode keystroke value to inject
ch : 8 bit ascii keystroke value to inject
modif : 
special : special keys to inject
content : mask specifying which arguments are valid


GrRegisterInput ()

void        GrRegisterInput                 (int fd);

Register an extra file descriptor to monitor in the main select() call. +An event will be returned when the fd has data waiting to be read if that +event has been selected for.

fd : the file descriptor to monitor


GrPrepareSelect ()

void        GrPrepareSelect                 (int *maxfd,
+                                             void *rfdset);

Prepare for a GrServiceSelect function by asking the server to send the next +event but not waiting around for it to arrive and initialising the +specified fd_set structure with the client/server socket descriptor and any +previously registered external file descriptors. Also compares the current +contents of maxfd, the client/server socket descriptor, and the previously +registered external file descriptors, and returns the highest of them in +maxfd.

maxfd : pointer to a variable which the highest in use fd will be written to
rfdset : pointer to the file descriptor set structure to use


GrServiceSelect ()

void        GrServiceSelect                 (void *rfdset,
+                                             GR_FNCALLBACKEVENT fncb);

Used by GrMainLoop() to call the specified callback function when an +event arrives or there is data waiting on an external fd specified by +GrRegisterInput().

rfdset : pointer to the file descriptor set to monitor
fncb : pointer to the function to call when an event needs handling


GrBell ()

void        GrBell                          (void);

Asks the server to ring the console bell on behalf of the client (intended +for terminal apps to be able to ring the bell on the server even if they +are running remotely).


GrSetScreenSaverTimeout ()

void        GrSetScreenSaverTimeout         (GR_TIMEOUT timeout);

Sets the number of seconds of inactivity before a screen saver activate +event is sent to the root window ID. A value of 0 activates the +screen saver immediately, and a value of -1 disables the screen saver +function.

timeout : the number of seconds of inactivity before screen saver activates

\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-pointer.html b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-pointer.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-pointer.html @@ -0,0 +1,780 @@ +pointer
Nano-X API Reference Manual
<<< Previous PageHomeUpNext Page >>>

pointer

Name

pointer —

Synopsis


+
+void        GrSetCursor                     (GR_WINDOW_ID wid,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_COORD hotx,
+                                             GR_COORD hoty,
+                                             GR_COLOR foreground,
+                                             GR_COLOR background,
+                                             GR_BITMAP *fbbitmap,
+                                             GR_BITMAP *bgbitmap);
+void        GrMoveCursor                    (GR_COORD x,
+                                             GR_COORD y);
+void        GrInjectPointerEvent            (MWCOORD x,
+                                             MWCOORD y,
+                                             int button,
+                                             int visible);

Description

Details

GrSetCursor ()

void        GrSetCursor                     (GR_WINDOW_ID wid,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_COORD hotx,
+                                             GR_COORD hoty,
+                                             GR_COLOR foreground,
+                                             GR_COLOR background,
+                                             GR_BITMAP *fbbitmap,
+                                             GR_BITMAP *bgbitmap);

Specifies a cursor (mouse pointer graphic) to display when the mouse +pointer is over the specified window and subsequently created children. +Points in the bitmap which have neither the foreground or background bits +set are not painted.

wid : the ID of the window to set the cursor of
width : the width of the pointer bitmap
height : the height of the pointer bitmap
hotx : the X coordinate within the bitmap used as the target of the pointer
hoty : the Y coordinate within the bitmap used as the target of the pointer
foreground : the colour to use for the foreground of the pointer
background : the colour to use for the background of the pointer
fbbitmap : 
bgbitmap : pointer to bitmap data specifying the background of the pointer


GrMoveCursor ()

void        GrMoveCursor                    (GR_COORD x,
+                                             GR_COORD y);

Moves the cursor (mouse pointer) to the specified coordinates. +The coordinates are relative to the root window, where (0,0) is the upper +left hand corner of the screen. The reference point used for the pointer +is that of the "hot spot". After moving the pointer, the graphic used for +the pointer will change to the graphic defined for use in the window which +it is over.

x : the X coordinate to move the pointer to
y : the Y coordinate to move the pointer to


GrInjectPointerEvent ()

void        GrInjectPointerEvent            (MWCOORD x,
+                                             MWCOORD y,
+                                             int button,
+                                             int visible);

Sets the pointer invisible if the visible parameter is GR_FALSE, or visible +if it is GR_TRUE, then moves the pointer to the specified position and +generates a mouse event with the specified button status. Also performs +a GrFlush() so that the event takes effect immediately.

x : the X coordinate of the pointer event relevant to the root window
y : the Y coordinate of the pointer event relevant to the root window
button : the pointer button status
visible : whether to display the pointer after the event

\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-regions.html b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-regions.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-regions.html @@ -0,0 +1,1994 @@ +regions
Nano-X API Reference Manual
<<< Previous PageHomeUpNext Page >>>

regions

Name

regions —

Synopsis


+
+GR_REGION_ID GrNewRegion                    (void);
+void        GrDestroyRegion                 (GR_REGION_ID region);
+void        GrUnionRectWithRegion           (GR_REGION_ID region,
+                                             GR_RECT *rect);
+void        GrUnionRegion                   (GR_REGION_ID dst_rgn,
+                                             GR_REGION_ID src_rgn1,
+                                             GR_REGION_ID src_rgn2);
+void        GrSubtractRegion                (GR_REGION_ID dst_rgn,
+                                             GR_REGION_ID src_rgn1,
+                                             GR_REGION_ID src_rgn2);
+void        GrXorRegion                     (GR_REGION_ID dst_rgn,
+                                             GR_REGION_ID src_rgn1,
+                                             GR_REGION_ID src_rgn2);
+void        GrIntersectRegion               (GR_REGION_ID dst_rgn,
+                                             GR_REGION_ID src_rgn1,
+                                             GR_REGION_ID src_rgn2);
+void        GrSetGCRegion                   (GR_GC_ID gc,
+                                             GR_REGION_ID region);
+GR_BOOL     GrPointInRegion                 (GR_REGION_ID region,
+                                             GR_COORD x,
+                                             GR_COORD y);
+int         GrRectInRegion                  (GR_REGION_ID region,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_COORD w,
+                                             GR_COORD h);
+GR_BOOL     GrEmptyRegion                   (GR_REGION_ID region);
+GR_BOOL     GrEqualRegion                   (GR_REGION_ID rgn1,
+                                             GR_REGION_ID rgn2);
+void        GrOffsetRegion                  (GR_REGION_ID region,
+                                             GR_SIZE dx,
+                                             GR_SIZE dy);
+int         GrGetRegionBox                  (GR_REGION_ID region,
+                                             GR_RECT *rect);
+GR_REGION_ID GrNewPolygonRegion             (int mode,
+                                             GR_COUNT count,
+                                             GR_POINT *points);

Description

Details

GrNewRegion ()

GR_REGION_ID GrNewRegion                    (void);

Creates a new region structure and returns the ID used to refer to it. +The structure is initialised with a set of default parameters.

Returns : the ID of the newly created region


GrDestroyRegion ()

void        GrDestroyRegion                 (GR_REGION_ID region);

Destroys the region structure with the specified ID.

region : the ID of the region structure to destroy


GrUnionRectWithRegion ()

void        GrUnionRectWithRegion           (GR_REGION_ID region,
+                                             GR_RECT *rect);

Makes a union of the specified region and the specified rectangle and +places the result back in the source region.

region : the ID of the region to modify
rect : a pointer to the rectangle to add to the region


GrUnionRegion ()

void        GrUnionRegion                   (GR_REGION_ID dst_rgn,
+                                             GR_REGION_ID src_rgn1,
+                                             GR_REGION_ID src_rgn2);

Makes a union of the specified source regions and places the result in the +specified destination region.

dst_rgn : the ID of the destination region
src_rgn1 : the ID of the first source region
src_rgn2 : the ID of the second source region


GrSubtractRegion ()

void        GrSubtractRegion                (GR_REGION_ID dst_rgn,
+                                             GR_REGION_ID src_rgn1,
+                                             GR_REGION_ID src_rgn2);

Subtracts the second source region from the first source region and places +the result in the specified destination region.

dst_rgn : the ID of the destination region
src_rgn1 : the ID of the first source region
src_rgn2 : the ID of the second source region


GrXorRegion ()

void        GrXorRegion                     (GR_REGION_ID dst_rgn,
+                                             GR_REGION_ID src_rgn1,
+                                             GR_REGION_ID src_rgn2);

Performs a logical exclusive OR operation on the specified source regions +and places the result in the destination region. The destination region +will contain only the parts of the source regions which do not overlap.

dst_rgn : the ID of the destination region
src_rgn1 : the ID of the first source region
src_rgn2 : the ID of the second source region


GrIntersectRegion ()

void        GrIntersectRegion               (GR_REGION_ID dst_rgn,
+                                             GR_REGION_ID src_rgn1,
+                                             GR_REGION_ID src_rgn2);

Calculates the intersection of the two specified source regions and places +the result in the specified destination region. The destination region +will contain only the parts of the source regions which overlap each other.

dst_rgn : the ID of the destination region
src_rgn1 : the ID of the first source region
src_rgn2 : the ID of the second source region


GrSetGCRegion ()

void        GrSetGCRegion                   (GR_GC_ID gc,
+                                             GR_REGION_ID region);

Sets the clip mask of the specified graphics context to the specified +region. Subsequent drawing operations using this graphics context will not +draw outside the specified region. The region ID can be set to 0 to remove +the clipping region from the specified graphics context.

gc : the ID of the graphics context to set the clip mask of
region : the ID of the region to use as the clip mask


GrPointInRegion ()

GR_BOOL     GrPointInRegion                 (GR_REGION_ID region,
+                                             GR_COORD x,
+                                             GR_COORD y);

Tests whether the specified point is within the specified region, and +then returns either True or False depending on the result.

region : the ID of the region to examine
x : the X coordinate of the point to test for
y : the Y coordinate of the point to test for
Returns : True if the point is within the region, or False otherwise


GrRectInRegion ()

int         GrRectInRegion                  (GR_REGION_ID region,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_COORD w,
+                                             GR_COORD h);

Tests whether the specified rectangle is contained within the specified +region. Returns GR_RECT_OUT if it is not inside it at all, GR_RECT_ALLIN +if it is completely contained within the region, or GR_RECT_PARTIN if +it is partially contained within the region.

region : the ID of the region to examine
x : the X coordinates of the rectangle to test
y : the Y coordinates of the rectangle to test
w : the width of the rectangle to test
h : the height of the rectangle to test
Returns : GR_RECT_PARTIN, GR_RECT_ALLIN, or GR_RECT_OUT


GrEmptyRegion ()

GR_BOOL     GrEmptyRegion                   (GR_REGION_ID region);

Determines whether the specified region is empty, and returns GR_TRUE +if it is, or GR_FALSE otherwise.

region : the ID of the region to examine
Returns : GR_TRUE if the region is empty, or GR_FALSE if it is not


GrEqualRegion ()

GR_BOOL     GrEqualRegion                   (GR_REGION_ID rgn1,
+                                             GR_REGION_ID rgn2);

Determines whether the specified regions are identical, and returns GR_TRUE +if it is, or GR_FALSE otherwise.

rgn1 : the ID of the first region to examine
rgn2 : the ID of the second region to examine
Returns : GR_TRUE if the regions are equal, or GR_FALSE otherwise


GrOffsetRegion ()

void        GrOffsetRegion                  (GR_REGION_ID region,
+                                             GR_SIZE dx,
+                                             GR_SIZE dy);

Offsets the specified region by the specified distance.

region : the ID of the region to offset
dx : the distance to offset the region by in the X axis
dy : the distance to offset the region by in the Y axis


GrGetRegionBox ()

int         GrGetRegionBox                  (GR_REGION_ID region,
+                                             GR_RECT *rect);

Fills in the specified rectangle structure with a bounding box that would +completely enclose the specified region, and also returns the type of the +specified region.

region : the ID of the region to get the bounding box of
rect : pointer to a rectangle structure
Returns : the region type


GrNewPolygonRegion ()

GR_REGION_ID GrNewPolygonRegion             (int mode,
+                                             GR_COUNT count,
+                                             GR_POINT *points);

Creates a new region structure, fills it with the region described by the +specified polygon, and returns the ID used to refer to it.

mode : the polygon mode to use (GR_POLY_EVENODD or GR_POLY_WINDING)
count : the number of points in the polygon
points : pointer to an array of point structures describing the polygon
Returns : the ID of the newly allocated region structure, or 0 on error

\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-selections.html b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-selections.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-selections.html @@ -0,0 +1,824 @@ +selections
Nano-X API Reference Manual
<<< Previous PageHomeUpNext Page >>>

selections

Name

selections —

Synopsis


+
+void        GrSetSelectionOwner             (GR_WINDOW_ID wid,
+                                             GR_CHAR *typelist);
+GR_WINDOW_ID GrGetSelectionOwner            (GR_CHAR **typelist);
+void        GrRequestClientData             (GR_WINDOW_ID wid,
+                                             GR_WINDOW_ID rid,
+                                             GR_SERIALNO serial,
+                                             GR_MIMETYPE mimetype);
+void        GrSendClientData                (GR_WINDOW_ID wid,
+                                             GR_WINDOW_ID did,
+                                             GR_SERIALNO serial,
+                                             GR_LENGTH len,
+                                             GR_LENGTH thislen,
+                                             void *data);

Description

Details

GrSetSelectionOwner ()

void        GrSetSelectionOwner             (GR_WINDOW_ID wid,
+                                             GR_CHAR *typelist);

Sets the current selection (otherwise known as the clipboard) ownership +to the specified window. Specifying an owner of 0 disowns the selection. +The typelist argument is a list of mime types (seperated by space +characters) which the window is able to supply the data as. At least one +type must be specified unless you are disowning the selection (typically +text/plain for plain ASCII text or text/uri-list for a filename).

The window which owns the current selection must be prepared to handle +SELECTION_LOST events (received when another window takes ownership of the +selection) and CLIENT_DATA_REQ events (received when a client wishes to +retreive the selection data).

wid : the ID of the window to set the selection owner to
typelist : list of mime types selection data can be supplied as


GrGetSelectionOwner ()

GR_WINDOW_ID GrGetSelectionOwner            (GR_CHAR **typelist);

Finds the window which currently owns the selection and returns its ID, +or 0 if no window currently owns the selection. A pointer to the list of +mime types the selection owner is capable of supplying is placed in the +pointer specified by the typelist argument. The typelist is null terminated, +and the fields are seperated by space characters. It is the callers +responsibility to free the typelist string, as it is allocated dynamically. +If the allocation fails, it will be set to a NULL pointer, so remember to +check the value of it before using it.

typelist : pointer used to return the list of available mime types
Returns : the ID of the window which currently owns the selection, or 0


GrRequestClientData ()

void        GrRequestClientData             (GR_WINDOW_ID wid,
+                                             GR_WINDOW_ID rid,
+                                             GR_SERIALNO serial,
+                                             GR_MIMETYPE mimetype);

Sends a CLIENT_DATA_REQ event to the specified window. Used for requesting +both selection and "drag and drop" data. The mimetype argument specifies +the format of the data you would like to receive, as an index into the list +returned by GrGetSelectionOwner (the first type in the list is index 0). +The server makes no guarantees as to when, or even if, the client will +reply to the request. If the client does reply, the reply will take the +form of one or more CLIENT_DATA events. The request serial number is +typically a unique ID which the client can assign to a request in order for +it to be able to keep track of transfers (CLIENT_DATA events contain the +same number in the sid field). Remember to free the data field of the +CLIENT_DATA events as they are dynamically allocated. Also note that if +the allocation fails the data field will be set to NULL, so you should +check the value before using it.

wid : the ID of the window requesting the data
rid : the ID of the window to request the data from
serial : the serial number of the request
mimetype : the number of the desired mime type to request


GrSendClientData ()

void        GrSendClientData                (GR_WINDOW_ID wid,
+                                             GR_WINDOW_ID did,
+                                             GR_SERIALNO serial,
+                                             GR_LENGTH len,
+                                             GR_LENGTH thislen,
+                                             void *data);

Used as the response to a CLIENT_DATA_REQ event. Sends the specified data +of the specified length to the specified window using the specified source +window ID and transfer serial number. Any fragmentation of the data into +multiple CLIENT_DATA events which is required is handled automatically. +The serial number should always be set to the value supplied by the +CLIENT_DATA_REQ event. The thislen parameter is used internally to split +the data up into packets. It should be set to the same value as the len +parameter.

wid : the ID of the window sending the data
did : the ID of the destination window
serial : 
len : the number of bytes of data to transfer
thislen : the number of bytes in this packet
data : pointer to the data to transfer

\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-window.html b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-window.html new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/html/nano-x-window.html @@ -0,0 +1,2491 @@ +window
Nano-X API Reference Manual
<<< Previous PageHomeUpNext Page >>>

window

Name

window —

Synopsis


+
+GR_WINDOW_ID GrNewWindow                    (GR_WINDOW_ID parent,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_SIZE bordersize,
+                                             GR_COLOR background,
+                                             GR_COLOR bordercolor);
+GR_WINDOW_ID GrNewPixmap                    (GR_SIZE width,
+                                             GR_SIZE height,
+                                             void *addr);
+GR_WINDOW_ID GrNewInputWindow               (GR_WINDOW_ID parent,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height);
+void        GrDestroyWindow                 (GR_WINDOW_ID wid);
+void        GrMapWindow                     (GR_WINDOW_ID wid);
+void        GrUnmapWindow                   (GR_WINDOW_ID wid);
+void        GrRaiseWindow                   (GR_WINDOW_ID wid);
+void        GrLowerWindow                   (GR_WINDOW_ID wid);
+void        GrMoveWindow                    (GR_WINDOW_ID wid,
+                                             GR_COORD x,
+                                             GR_COORD y);
+void        GrResizeWindow                  (GR_WINDOW_ID wid,
+                                             GR_SIZE width,
+                                             GR_SIZE height);
+void        GrReparentWindow                (GR_WINDOW_ID wid,
+                                             GR_WINDOW_ID pwid,
+                                             GR_COORD x,
+                                             GR_COORD y);
+void        GrGetWindowInfo                 (GR_WINDOW_ID wid,
+                                             GR_WINDOW_INFO *infoptr);
+void        GrSetWMProperties               (GR_WINDOW_ID wid,
+                                             GR_WM_PROPERTIES *props);
+void        GrGetWMProperties               (GR_WINDOW_ID wid,
+                                             GR_WM_PROPERTIES *props);
+void        GrSetFocus                      (GR_WINDOW_ID wid);
+GR_WINDOW_ID GrGetFocus                     (void);
+void        GrSetBorderColor                (GR_WINDOW_ID wid,
+                                             GR_COLOR color);
+void        GrSetBackgroundPixmap           (GR_WINDOW_ID wid,
+                                             GR_WINDOW_ID pixmap,
+                                             int flags);
+void        GrClearWindow                   (GR_WINDOW_ID wid,
+                                             GR_BOOL exposeflag);
+void        GrCloseWindow                   (GR_WINDOW_ID wid);
+void        GrKillWindow                    (GR_WINDOW_ID wid);

Description

Details

GrNewWindow ()

GR_WINDOW_ID GrNewWindow                    (GR_WINDOW_ID parent,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height,
+                                             GR_SIZE bordersize,
+                                             GR_COLOR background,
+                                             GR_COLOR bordercolor);

Create a new window with the specified parent and window attributes.

parent : the ID of the parent window
x : the X coordinate of the new window relative to the parent window
y : the Y coordinate of the new window relative to the parent window
width : the width of the new window
height : the height of the new window
bordersize : the width of the window border
background : the colour of the window background
bordercolor : the colour of the window border
Returns : the ID of the newly created window


GrNewPixmap ()

GR_WINDOW_ID GrNewPixmap                    (GR_SIZE width,
+                                             GR_SIZE height,
+                                             void *addr);

Create a new server side pixmap (an offscreen drawing area which can be +copied into a window using a GrCopyArea call) of the specified width and +height.

width : the width of the pixmap
height : the height of the pixmap
addr : currently unused in client/server mode
Returns : the ID of the newly created pixmap


GrNewInputWindow ()

GR_WINDOW_ID GrNewInputWindow               (GR_WINDOW_ID parent,
+                                             GR_COORD x,
+                                             GR_COORD y,
+                                             GR_SIZE width,
+                                             GR_SIZE height);

Create a new input-only window with the specified dimensions which is a +child of the specified parent window.

parent : the ID of the window to use as the parent of the new window
x : the X coordinate of the new window relative to the parent window
y : the Y coordinate of the new window relative to the parent window
width : the width of the new window
height : the height of the new window
Returns : the ID of the newly created window


GrDestroyWindow ()

void        GrDestroyWindow                 (GR_WINDOW_ID wid);

Recursively unmaps and frees the data structures associated with the +specified window and all of its children.

wid : the ID of the window to destroy


GrMapWindow ()

void        GrMapWindow                     (GR_WINDOW_ID wid);

Recursively maps (makes visible) the specified window and all of the +child windows which have a sufficient map count. The border and background +of the window are painted, and an exposure event is generated for the +window and every child which becomes visible.

wid : the ID of the window to map


GrUnmapWindow ()

void        GrUnmapWindow                   (GR_WINDOW_ID wid);

Recursively unmaps (makes invisible) the specified window and all of the +child windows.

wid : the ID of the window to unmap


GrRaiseWindow ()

void        GrRaiseWindow                   (GR_WINDOW_ID wid);

Places the specified window at the top of its parents drawing stack, above +all of its sibling windows.

wid : the ID of the window to raise


GrLowerWindow ()

void        GrLowerWindow                   (GR_WINDOW_ID wid);

Places the specified window at the bottom of its parents drawing stack, +below all of its sibling windows.

wid : the ID of the window to lower


GrMoveWindow ()

void        GrMoveWindow                    (GR_WINDOW_ID wid,
+                                             GR_COORD x,
+                                             GR_COORD y);

Moves the specified window to the specified position relative to its +parent window.

wid : the ID of the window to move
x : the X coordinate to move the window to relative to its parent.
y : the Y coordinate to move the window to relative to its parent.


GrResizeWindow ()

void        GrResizeWindow                  (GR_WINDOW_ID wid,
+                                             GR_SIZE width,
+                                             GR_SIZE height);

Resizes the specified window to be the specified width and height.

wid : the ID of the window to resize
width : the width to resize the window to
height : the height to resize the window to


GrReparentWindow ()

void        GrReparentWindow                (GR_WINDOW_ID wid,
+                                             GR_WINDOW_ID pwid,
+                                             GR_COORD x,
+                                             GR_COORD y);

Changes the parent window of the specified window to the specified parent +window and places it at the specified coordinates relative to the new +parent.

wid : the ID of the window to reparent
pwid : the ID of the new parent window
x : the X coordinate to place the window at relative to the new parent
y : the Y coordinate to place the window at relative to the new parent


GrGetWindowInfo ()

void        GrGetWindowInfo                 (GR_WINDOW_ID wid,
+                                             GR_WINDOW_INFO *infoptr);

Fills in a GR_WINDOW_INFO structure with information regarding the window +with the specified window ID.

wid : the ID of the window to retrieve information about
infoptr : pointer to a GR_WINDOW_INFO structure to return the information in


GrSetWMProperties ()

void        GrSetWMProperties               (GR_WINDOW_ID wid,
+                                             GR_WM_PROPERTIES *props);

Copies the provided GR_WM_PROPERTIES structure into the the GR_WM_PROPERTIES +structure of the specified window id.

wid : the ID of the window to set the WM properties of
props : pointer to a GR_WM_PROPERTIES structure


GrGetWMProperties ()

void        GrGetWMProperties               (GR_WINDOW_ID wid,
+                                             GR_WM_PROPERTIES *props);

Reads the GR_WM_PROPERTIES structure for the window with the specified +id and fills in the provided structure with the information. +It is the callers responsibility to free the title member as it is allocated +dynamically. The title field will be set to NULL if the window has no title.

wid : the ID of the window to retreive the WM properties of
props : pointer to a GR_WM_PROPERTIES structure to fill in


GrSetFocus ()

void        GrSetFocus                      (GR_WINDOW_ID wid);

Sets the keyboard focus to the specified window.

wid : the ID of the window to set the focus to


GrGetFocus ()

GR_WINDOW_ID GrGetFocus                     (void);

Returns : the ID of the window which currently has the keyboard focus


GrSetBorderColor ()

void        GrSetBorderColor                (GR_WINDOW_ID wid,
+                                             GR_COLOR color);

Sets the border colour of the specified window to the specified colour.

wid : the ID of the window to set the border colour of
color : 


GrSetBackgroundPixmap ()

void        GrSetBackgroundPixmap           (GR_WINDOW_ID wid,
+                                             GR_WINDOW_ID pixmap,
+                                             int flags);

Sets the background of the specified window to the specified pixmap. +The flags which specify how to draw the pixmap (in the top left of the +window, in the centre of the window, tiled, etc.) are those which start with +GR_BACKGROUND_ in nano-X.h. If the pixmap value is 0, the server will +disable the background pixmap and return to using a solid colour fill.

wid : ID of the window to set the background of
pixmap : ID of the pixmap to use as the background
flags : flags specifying how to draw the pixmap onto the window


GrClearWindow ()

void        GrClearWindow                   (GR_WINDOW_ID wid,
+                                             GR_BOOL exposeflag);

Clears the specified window by setting it to its background color. +If the exposeflag parameter is non zero, an exposure event is generated for +the window after it has been cleared.

wid : the ID of the window to clear
exposeflag : a flag indicating whether to also generate an exposure event


GrCloseWindow ()

void        GrCloseWindow                   (GR_WINDOW_ID wid);

Sends a CLOSE_REQ event to the specified window if the client has selected +to receive CLOSE_REQ events on this window. Used to request an application +to shut down but not force it to do so immediately, so the application can +ask whether to save changed files before shutting down cleanly.

wid : the ID of the window to send the CLOSE_REQ event to


GrKillWindow ()

void        GrKillWindow                    (GR_WINDOW_ID wid);

Forcibly disconnects the client which owns this window with the specified +ID number. Used to kill an application which has locked up and is not +responding to CLOSE_REQ events.

wid : the ID of the window to kill

\ No newline at end of file diff --git a/packages/services/gfx/mw/current/doc/nano-X/nano-X-docs.pdf b/packages/services/gfx/mw/current/doc/nano-X/nano-X-docs.pdf new file mode 100644 index 0000000000000000000000000000000000000000..aead1c9f8d0d3fa32c2d454c5f8cb612174c3fca GIT binary patch literal 116949 zc$}=fV|1nKviBX^oavYy+fF*RZQJgsYtj&0k1*4pU3->1)h&w9={@^@Ku=(6U;)F;O($h+W9no^!2X9tflkES z%E{P)fKJ3p-^p0W*wEI@-bLn8uXn{C3MV$ob0+Zg@hh&6FYaBfdld`S>w~3L|DBd6z5Njdw|fBrE!D^2olv9IsUL+xG~> z((*?&)ue^PK*r5nA^8pEUb?JHsC8&ebn?%~*3R-iMV-n;0veT(#K$Yg2JW*==v`Rm zGFG!B``w)8vSqC&KN7R*`LboTznU%gc68dgm&fx5n3W$BQ&S60Vf1f5GI!@)K^^U( zHvw)R6;4uJmR!Q<-blYnk&P!4MW`Tsx%9R{(}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b1p!jS)>i+-Kl^NqE37CSgf{-%cPAfc%JP5`cRmb>W{b zKg5k-5D(NT$eagg1Bw6v@`HdjK$?Yq%@<9?;sK68Y@mON!vJ$P5esT!A~Fd8_kkk; z*hNMgy*{USgwy9s7bg=NTMH-Z%QAIryeue-{~~f^2L~4s>We%@ + + + + + + + + + +]> + + + + Nano-X API Reference Manual + + + libnano-X + &general; + &window; + &graphics; + &events; + &fonts; + &pointer; + &colours; + ®ions; + &selections; + &misc; + + diff --git a/packages/services/gfx/mw/current/doc/nano-X/nano-X-sections.txt b/packages/services/gfx/mw/current/doc/nano-X/nano-X-sections.txt new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/nano-X/nano-X-sections.txt @@ -0,0 +1,135 @@ +
+general +GrFlush +GrOpen +GrClose +GrMainLoop +GrGetScreenInfo +GrSetErrorHandler +GrDefaultErrorHandler +
+
+window +GrNewWindow +GrNewPixmap +GrNewInputWindow +GrDestroyWindow +GrMapWindow +GrUnmapWindow +GrRaiseWindow +GrLowerWindow +GrMoveWindow +GrResizeWindow +GrReparentWindow +GrGetWindowInfo +GrSetWMProperties +GrGetWMProperties +GrSetFocus +GrGetFocus +GrSetBorderColor +GrSetBackgroundPixmap +GrClearWindow +GrCloseWindow +GrKillWindow +
+
+graphics +GrNewGC +GrCopyGC +GrGetGCInfo +GrDestroyGC +GrLine +GrPoint +GrPoints +GrRect +GrFillRect +GrPoly +GrFillPoly +GrEllipse +GrFillEllipse +GrArc +GrArcAngle +GrSetGCForeground +GrSetGCBackground +GrSetGCUseBackground +GrSetGCMode +GrSetGCFont +GrGetGCTextSize +GrReadArea +GrArea +GrCopyArea +GrBitmap +GrFreeImage +GrGetImageInfo +GrDrawImageFromFile +GrLoadImageFromFile +GrDrawImageToFit +GrDrawImageBits +GrText +
+
+events +GrSelectEvents +GrGetNextEvent +GrGetNextEventTimeout +GrCheckNextEvent +GrPeekEvent +
+
+fonts +GrCreateFont +GrSetFontSize +GrSetFontRotation +GrSetFontAttr +GrDestroyFont +GrGetFontInfo +
+
+pointer +GrSetCursor +GrMoveCursor +GrInjectPointerEvent +
+
+colours +GrGetSystemPalette +GrSetSystemPalette +GrFindColor +GrGetSysColor +
+
+regions +GrNewRegion +GrDestroyRegion +GrUnionRectWithRegion +GrUnionRegion +GrSubtractRegion +GrXorRegion +GrIntersectRegion +GrSetGCRegion +GrPointInRegion +GrRectInRegion +GrEmptyRegion +GrEqualRegion +GrOffsetRegion +GrGetRegionBox +GrNewPolygonRegion +
+
+selections +GrSetSelectionOwner +GrGetSelectionOwner +GrRequestClientData +GrSendClientData +
+
+misc +GrRegisterDragAndDropWindow +GrReqShmCmds +GrInjectKeyboardEvent +GrRegisterInput +GrPrepareSelect +GrServiceSelect +GrBell +GrSetScreenSaverTimeout +
diff --git a/packages/services/gfx/mw/current/doc/original_mini-x.txt b/packages/services/gfx/mw/current/doc/original_mini-x.txt new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/doc/original_mini-x.txt @@ -0,0 +1,1103 @@ + MINI-X TUTORIAL + David I. Bell + 19 May 91 + +This is a simple tutorial on using the mini-X graphics system. Much of this +is a lot easier to understand if you are familiar to X. I am not going to +try to explain every concept in detail here, nor how to put it all together +to make really fancy programs. Instead, I am only going to tell you just +enough to let you make some simple graphics programs which work. Experience +with simple test programs will enable you to build much fancier graphics +programs much easier than trying to decipher what I could tell you. + +I am assuming that you basically know what a screen, pixels, colors, +keyboards, mice, buttons, and windows are. However, you probably don't +know exactly what the properties of windows in this system are. Also, you +might not know two other concepts which are important here, which are +graphics contexts and events. So these things will be explained in this +tutorial. + + +WINDOWS + +Windows are rectangular areas which can be drawn into. Windows have a +position, specified by the x and y coordinates of their upper left corners, +and also a size, specified by their width and height. Windows are arranged +in a tree structure, with the parent windows controlling the child windows. +The top of the tree is known as the root window. The root window is always +present, and represents the total screen area. + +Each child window is clipped by its parent window. This means that a window +can be very large, but the only part of the window that can ever be seen is +the part which shows through its parent window. This applies recursively, +so that all of the parents of a window limit its visibility. The position +of a window is specified relative to its parent, and not absolutely. This +means that for example, when a window is moved, then all of its children will +move with it. The position of a window can be negative. + +Windows which have the same parent can clip each other. That is, there is a +defined order among the children of a window as to which is more important. +If two sibling windows overlap, then the more important window will be visible +in preference to the less important window. The precedence of visibility +of siblings can be dynamically adjusted. Clipping can also occur on a window +by earlier siblings of any of the window's parents. + +Windows can be mapped or unmapped. Unmapped windows are not visible, and +cause no events. They can be thought of as "in storage" or offscreen. +When a window is mapped, then it can become visible on the screen. Children +of an unmapped window are implicitly also unmapped. So a window is not +visible until it and all of its parents are mapped. A newly created window +starts off unmapped. + +Windows have a background color. A newly mapped window is filled with its +background color. Clearing the window later, or having obscured portions +of the window become visible again, will fill the region with the background. +The client program can then draw into the window to make it look correct. + +Windows may have a border. A border is a set of rectangles adjacent to the +four sides of the window which is drawn in a specified color, with a +specified width. This makes pretty lines around the window, for example. +The border cannot be drawn in by the program. Borders are optional, so +that a window with a border width of zero has no border at all. Borders +are "around" the window, so that they do not affect the coordinates of the +window. Whether or not a window has borders, its position determines the +location of the upper left corner which can be drawn into. + +Windows can have a cursor associated with them. The graphics server tracks +the location of the mouse, and maintains the position of a graphics cursor +on the screen. This cursor can automatically change its shape and colors as +it moves between different windows. The use of different cursors for different +windows can be used to provide a powerful clue to the user as to what will +happen if a mouse button is pressed in a window. Newly created windows +inherit the same cursor as their parent. + +There are two types of windows, input-output and input-only windows. +Input-output windows are normal windows which are visible and can be drawn +into. Input-only windows are invisible, have no border, and cannot be +drawn into. Their purpose is to catch events, and to enable the cursor +to be changed in different regions of a visible window. The only children +of input-only windows are also input-only windows. + +Windows are identified by integers called window ids. The root window has +a constant window id value of GR_ROOT_WINDOW_ID. The root window does not +need creating, and cannot be unmapped, moved, resized, or destroyed. +However, it can be drawn into and events can be delivered to it. New windows +can be created from existing windows. Their window ids are not constants, +but once created the window id remains until the window is destroyed. Window +ids are not reused as windows are created and destroyed. + + +GRAPHICS CONTEXTS + +When drawing objects such as lines, there are many parameters that can be +specified for the function call that affect the operation. Besides the +minimum information needed for the function such as the endpoint coordinates, +there are extra parameters that are less important and less variable. +Examples of these extra parameters are color, width (thin or thick), style +(dashed, dotted), and drawing operation (setting, XORing). Instead of +requiring the specifying of each of these extra parameters for every function +call, graphics contexts are used. Graphics contexts are just a collection +of specific combinations of these extra parameters. The many possible +extra parameters to each function are replaced by just one extra parameter, +which is the graphics context. + +For example, instead of a function call like: + drawline(window, x1, y1, x2, y2, color, width, style, operation); + +you have instead + drawline(window, gc, x1, y1, x2, y2), + +where the graphics context contains within itself the parameters color, width, +style, and operation. + +Graphics contexts are stored in the graphics server, and are identified by +unique numbers in a way similar to window ids. Your program must allocate +graphic contexts, which then can be used in drawing functions. A newly +allocated graphics context is supplied with default parameters, such as a +foreground color of white, drawing operation of setting, and width of 0. +You can modify the parameters associated with the graphics context one by +one, by for example, setting the foreground color to black. + +A single graphics context could be used for every drawing operation by +constantly setting the parameters associated with it to the values needed +for each drawing call. But this is inefficient. The reason that multiple +graphics contexts can be allocated is so that you can minimize the setting of +their parameters. By presetting the parameters of several graphics contexts +to commonly used values in your program, you can avoid changing them later. +For example, you can call one graphics context white_gc, and another graphics +context black_gc, and then use the correct graphics context in the drawing +functions to draw in either black or white. + +The parameters contained within a graphics context are currently the +following: + +Drawing mode. +Specifies the operation performed when drawing each pixel. One of: + GR_MODE_SET draw pixels as given (default) + GR_MODE_XOR draw pixels using XOR + GR_MODE_OR draw pixels using OR + GR_MODE_AND draw pixels using AND + +Text font. +A small integer identifying the font for drawing text. The first few are +built-in to the device driver, others must be loaded by the graphics server. +The default font is 0. + +Foreground color. +The color that is used to draw almost all objects with, such as lines, +points, ellipses, text, bitmaps, and filled areas. Default is white. + +Background color. +The color used for some functions in addition to the foreground color. +For bitmaps and text, this is the color used for the zero bits. The +default background color is black. The drawing of this color can be +disabled by the next parameter. + +UseBackground flag. +This is a boolean value which indicates whether or not the background +color is actually to be drawn for bitmaps, text, and the GrArea8 function. +The default is GR_TRUE. + + +EVENTS + +Events are the way in which the graphics system notifies your program +of asychronous changes in the state of the screen, mouse, or keyboard. +Whenever the state changes, your program is notified of this change and +can act on it. The word "event" is used both for the actual change +that took place, and also for the data that is returned to your program +which describes the change. + +Events are generated for various different types of changes that may be useful +for your program to know. Events directly related to the hardware are the +keyboard and mouse events. Keyboard events are generated for each key which +is pressed (and released, if possible). The event contains the character +which caused the event. Mouse events are generated when a button on the +mouse is pressed or released, or when the mouse position moves. The event +contains the buttons which are pressed, and the current position of the mouse. +Other events are more subtle, and are based on non-physical changes, such +as having the mouse move into or out of specific windows. + +Events are generally tied to individual windows. Your program can enable +or disable which kinds of events it wants for each window. Part of the data +associated with an event is the window associated with the event. For +example, if a key is pressed on the keyboard, the event for that key will +indicate which window that key is for. You program can then act differently +for different windows. Events which you have not indicated an interest in +are simply discarded. + +The keyboard and mouse events can propagate upwards through the window tree +and be delivered to some parent window. This occurs if the window does +not select for the event, but one of the parent windows does. Part of the +information returned about these events is the window that accepted the event, +and also the original window which caused the event. Therefore, your program +can determine which child window an event was for without having to select +for the event for each child. Events other than keyboard and mouse events +never propagate. + +The window that keyboard events are delivered to depends on the current +mouse position or on the "input focus". The input focus is a way of +specifying that keyboard events are to be delivered to a particular window, +no matter where the mouse is currently pointing. Your program can change +the input focus as desired. If the input focus is set to the root window, +then the keyboard events will be delivered to the window which contains +the mouse pointer (or one of its parents). + +Events are returned to your program as a structure containing the information +about the event. This information is the event type, the window id which +the event is associated with, and other event-specific data. Events are +stored in a queue, and are delivered to your program one by one as requested. +The order of the events is preserved. Your program can either simply ask +for the next available event (waiting for one if none are yet available), +or it can check to see if an event is available without waiting. The +delivering of events only occurs when you request an event. So even though +events themselves are asychronous, the reading of them is synchronous. +There are no "interrupts" for events, you must explicitly ask for them. + +The important thing about programming with events is that your program +should be written to run "upside-down". That is, you do not have a main +routine which checks that the mouse has been moved, or the keyboard has +been typed on, or which window the mouse is in. Instead, your main routine +just waits for an event, and then dispatches on its type and which window +it is for. Generally, you must keep some state information to remember +what is happening in your program. For example, if the user wants to click +the button in a window to indicate where some text should be inserted, then +your program cannot simply detect the mouse click, and then wait for the +text to be typed. Instead, when the mouse is clicked, it should just +remember the position of the mouse and set a flag to indicate that text +typing is allowed, When the keyboard event arrives, this saved information +then enables you to draw the text at the correct location. Your program +basically becomes one large state machine. + +One obscure event is the exposure event. This is sent to your program when +a window requires redrawing. Due to lack of memory space, the graphics server +does not attempt to save the data from the parts of windows which are +covered by other windows. Therefore, when the obscured parts of the window +are uncovered, your program must be told to redraw those parts. The exposure +event contains a rectangular area which requires drawing (which may in fact +be larger than the area which was actually uncovered). Your program can +either just redraw that area, or if more convenient, redraw the whole window. +The area to be redrawn has already been cleared to the window's background +color. When a window is mapped, an exposure event is sent for the window. +Therefore, you should not explicitly draw into a window when it is first +created and mapped, but should instead just wait for the exposure event, and +then draw it. In this way, the code to draw the window only resides in one +place in your program, and you prevent redundant drawing of the window. +If you are drawing the complete window on all exposure events, then it +might be useful to use GrPeekEvent to examine the next event too. If it +is also an exposure event for the same window, then you can read it by using +GrGetNextEvent, and thereby prevent redundant redrawing. Of course, to +be able to redraw the window, you may need to save extra data in order to +regenerate the drawing commands. (Pixmaps are one way of doing this in +the future, but they are not currently implemented.) + +The following is a description of the various types of events which are +available, and (in parenthesis) the typedef name for the structure that +returns the event. Each event has a type field, which can be used to +distinguish between the various events. For details on the other data +within the structures, refer to graphics.h. The typedef GR_EVENT is a +union which contains all of the possible event structures. + + +GR_EVENT_TYPE_NONE (GR_EVENT) + This indicates that no event has occurred. + +GR_EVENT_TYPE_EXPOSURE (GR_EVENT_EXPOSURE) + This is generated when a window needs redrawing because it is either + newly mapped, or has been uncovered by another window. This returns + the window id, and the x, y, width, and height of the area within + the window which needs redrawing. + +GR_EVENT_TYPE_BUTTON_DOWN (GR_EVENT_BUTTON) + This is generated when a button is pressed down on the mouse. + This returns the window id which generated the event, the window id + which actually contains the mouse, the current position of the mouse, + the buttons which are currently down on the mouse, the buttons + which were just pressed down, and the current modifier flags. + +GR_EVENT_TYPE_BUTTON_UP (GR_EVENT_BUTTON) + This is generated when a button is released on the mouse. This + returns data similarly to button down. + +GR_EVENT_TYPE_MOUSE_ENTER (GR_EVENT_GENERAL) + This is generated when the mouse enters a window. This returns the + window id which generated the event. + +GR_EVENT_TYPE_MOUSE_EXIT (GR_EVENT_GENERAL) + This is generated when the mouse leaves a window. This returns + the window id which generated the event. + +GR_EVENT_TYPE_MOUSE_MOTION (GR_EVENT_MOUSE) + Mouse motion is generated for every motion of the mouse, and is + used to track the entire history of the mouse. Mouse motion + generates many events and causes lots of overhead. This returns + data similarly to mouse enter. + +GR_EVENT_TYPE_MOUSE_POSITION (GR_EVENT_MOUSE) + Mouse position ignores the history of the motion, and only reports the + latest position of the mouse by only queuing the latest such event for + any single client (good for rubber-banding). This returns data + similarly to mouse enter. + +GR_EVENT_TYPE_KEY_DOWN (GR_EVENT_KEYSTROKE) + This indicates that a key has been pressed on the keyboard. + This returns the window id which generated the event, the window id + which actually contains the pointer (if the pointer is outside of + the event window, this will be the event window), the current position + of the mouse, the current buttons on the mouse which are down, the + current modifier flags, and the character which was typed. + +GR_EVENT_TYPE_KEY_UP (GR_EVENT_KEYSTROKE) + This indicates that a key has been released on the keyboard. This + event is not necessarily available, and should not be depended on. + This returns data similarly to key down. + +GR_EVENT_TYPE_FOCUS_IN (GR_EVENT_GENERAL) + This indicates that the input focus has just changed to this window. + This returns the window id which got focus. + +GR_EVENT_TYPE_FOCUS_OUT (GR_EVENT_GENERAL) + This indicates that the input focus has just left this window. + This returns the window id which lost focus. + + +To select for events, you use GrSelectEvents, and specify the window which +wants to receive the events, and also specify a mask indicating the events +you wish to receive. The mask is the logical OR of individual bit values +representing the event types. The mask names are the same as the event +names, except that the "_TYPE_" string is replaced by "_MASK_". For +example, the mask associated with the event GR_EVENT_TYPE_FOCUS_IN is +GR_EVENT_MASK_FOCUS_IN. + +If you select for both button down and button up events, then the mouse +will be implicitly "grabbed" when any button is pressed down in that window. +This means that the mouse position and button down and up events will be +delivered only to that window, and the cursor shape won't change, even if +the mouse leaves that window. The implicit grabbing ends after the last +button is released. While this grabbing occurs, the input focus is also +not changed as the mouse is moved. + + +MODIFIER AND MOUSE BUTTONS + +Modifiers are the status of special keyboard shift-like keys. The state +of these keys can be read as up or down, and don't generate any characters +by themselves. These keys are for things like SHIFT, CTRL, and ALT. +They are returned as bit values OR'd together in various events. Not all +of these modifiers may be implemented. The GrGetScreenInfo function returns +the modifiers that are implemented. The following modifiers are defined: + + GR_MODIFIER_SHIFT shift key is down + GR_MODIFIER_CTRL ctrl key is down + GR_MODIFIER_META meta (or ALT) key is down + GR_MODIFIER_ANY any of the modifiers is down + + +The mouse button state are returned as bit values OR'd together in various +events. Not all of these buttons may be implemented. The GrGetScreenInfo +function returns the buttons that are implemented. The following mouse +buttons are defined: + + GR_BUTTON_1 button 1 is down (left) + GR_BUTTON_2 button 2 is down (middle) + GR_BUTTON_3 button 3 is down (right) + GR_BUTTON_ANY any of the buttons is down + + +BITMAPS + +Bitmaps are defined as an array of GR_BITMAP values, which are unsigned shorts. +Each word is 16 bits, which specify foreground and background values, with 1 +being foreground and 0 being background. Higher order bits in the word +represent pixels to the left of the lower order bits. Bitmaps have a width +and a height, measured in pixels. The width does not need to be a multiple +of 16. In this case, remaining bits in the last word of a row are unused, +so that each row starts with a new bitmap word. The GR_BITMAP_SIZE macro can +be used to allocate the proper number of bitmap words for a bitmap, as in: + + GR_BITMAP_SIZE(width, height). + +The symbol GR_MAX_BITMAP_SIZE is the number of bitmap words required for +the maximum sized cursor. + + +ERROR CODES + +Calls to the graphics libraries may produce errors. Most errors that +occur are due to specifying a window or graphics context which does not +exist, or attempting an operation which is illegal. Many things are allowed +even if pointless, such as drawing outside of the window boundaries, or +while a window is not mapped. The things which return errors are those +which definitely indicate a program bug, attempts to exceed the system +limits, or a fatal device error. + +In order to be as efficient as possible, error codes are not returned by +individual function calls. Instead, if a function fails, an error event +is generated which will eventually be noticed by the program at a possibly +much later time. This allows many drawing requests to be sent at one time +without having to worry about the status of each one. + +Error events are detected when the program checks for events, such as +by calling GrGetNextEvent. At this point, if an error had occurred, a +special error handler routine is called to notice the error. If the program +had not set up its own error handler, a default one is called which will +disconnect from the server, print out an indication of the error, and exit +the program. + +The following is a list of the possible errors: + +GR_ERROR_BAD_WINDOW_ID the specified window id is unknown +GR_ERROR_BAD_GC_ID the specified graphics context id is unknown +GR_ERROR_BAD_CURSOR_SIZE the specified cursor is too large +GR_ERROR_MALLOC_FAILED no more memory is available in the server +GR_ERROR_BAD_WINDOW_SIZE the specified window size is illegal +GR_ERROR_KEYBOARD_ERROR an error occurred reading from the keyboard +GR_ERROR_MOUSE_ERROR an error occurred reading from the mouse +GR_ERROR_INPUT_ONLY_WINDOW drawing was attempted in an input-only window +GR_ERROR_ILLEGAL_ON_ROOT_WINDOW an illegal operation was attempted on the root +GR_ERROR_TOO_MUCH_CLIPPING complexity of windows exceeded clipping limits +GR_ERROR_SCREEN_ERROR an error occurred talking to the screen driver +GR_ERROR_UNMAPPED_FOCUS_WINDOW attempted to set focus to an unmapped window +GR_ERROR_BAD_DRAWING_MODE illegal drawing mode specified for a GC + + +SCREEN PROPERTIES + +You do not have to hard code the size of the screen or the number of colors +available in your program. Instead, you can find this information out +dynamically after the connection is made to the graphics server, by using +the GrGetScreenInfo call. This returns the above information, and in addition +returns the color values for black and white, the aspect ratio of pixels, +the number of built-in fonts available, and the modifiers and buttons which +are available. The aspect ratio is useful for drawing objects which need +to be scaled correctly, such as circles. The aspect ratio is the quotient +of xdpcm and ydpcm, which are integer values. + + +typedef struct { + GR_SIZE rows; /* number of rows on screen */ + GR_SIZE cols; /* number of columns on screen */ + GR_SIZE xdpcm; /* dots/centimeter in x direction */ + GR_SIZE ydpcm; /* dots/centimeter in y direction */ + GR_COLOR maxcolor; /* maximum legal color value */ + GR_COLOR black; /* the color black */ + GR_COLOR white; /* the color white */ + GR_COUNT fonts; /* number of built-in fonts */ + GR_BUTTON buttons; /* buttons which are implemented */ + GR_MODIFIER modifiers; /* modifiers which are implemented */ +} GR_SCREEN_INFO; + + +INCLUDE FILE AND GRAPHICS LIBRARY + +To use the graphics server, your program must include "graphics.h". +This should be put into /usr/include, so that your program simply has +the following line at the top: + #include + +Including this file gives you all of the definitions you need to use the +graphics library. These are the typedefs, function declarations, event +structures, and various constants. + +When loading your program, you need to load the graphics server into the +program by using the -lgraph option in the cc command. For example, if +your program is called myprog, then you could build it using the following: + cc -o myprog myprog.c -lgraph + + +TYPEDEFS + +The following is a list of the typedefs in the include file, and a short +description of their purpose. Refer to their definitions in graphics.h +to find out what their actual C base type is. Most are shorts, unsigned +shorts, or longs. + +GR_COORD coordinate value (x, y locations, signed) +GR_SIZE size value (widths, heights, signed) +GR_COUNT number of items (signed) +GR_COLOR full color value (32 bit value for full generality) +GR_COLOR8 eight bit color value (8 bit value for efficient storage) +GR_BITMAP bitmap unit (single words of 16 bits for bitmaps) +GR_MODE drawing mode (setting, xoring, anding, oring) +GR_CHAR text character (normal chars) +GR_ID resource ids (window, graphics context, pixmap) +GR_DRAW_ID drawable id (window, pixmap) +GR_WINDOW_ID window id (identifies individual window) +GR_PIXMAP_ID pixmap id (identifies individual pixmaps, not yet used) +GR_GC_ID graphics context id (identifies indiviual graphics contexts) +GR_FONT font number (identifies individual fonts, first few built-in) +GR_BOOL boolean value (GR_TRUE or GR_FALSE) +GR_FUNC function codes (not for clients to use) +GR_ERROR error value (reasons for graphics calls to fail) +GR_EVENT_TYPE event types (identifies the type of event) +GR_BUTTON button flags (which mouse buttons are depressed) +GR_MODIFIER modifier flags (CTRL, SHIFT, etc) +GR_EVENT_MASK event masks (mask values corresponding to event types) +GR_FUNC_NAME function name (for error reporting) +GR_ERROR_FUNC error function (for defining error handlers) + + +The following typedefs may be useful to your program. None of the library +functions (currently) accept any of these structures as arguments, except +for the GrPoly and GrFillPoly routines, which use GR_POINT. + + +typedef struct { + GR_COORD x; /* x coordinate */ + GR_COORD y; /* y coordinate */ +} GR_POINT; + +typedef struct { + GR_COORD x1; /* x coordinate of first point */ + GR_COORD y1; /* y coordinate of first point */ + GR_COORD x2; /* x coordinate of second point */ + GR_COORD y2; /* y coordinate of second point */ +} GR_LINE; + +typedef struct { + GR_COORD x; /* x coordinate of center */ + GR_COORD y; /* y coordinate of center */ + GR_SIZE rx; /* radius in x direction */ + GR_SIZE ry; /* radius in y direction */ +} GR_ELLIPSE; + +typedef struct { + GR_COORD x; /* x coordinate of top left corner */ + GR_COORD y; /* y coordinate of top left corner */ + GR_SIZE width; /* width of rectangle */ + GR_SIZE height; /* height of rectangle */ +} GR_RECT; + + +LIMITS + +The coordinate system is limited to integers in the range GR_COORD_MIN +to GR_COORD_MAX. This is -32768 to 32767, and fits in a short. + +The maximum size of a cursor definition is GR_MAX_CURSOR_SIZE, which is +16 pixels by 16 pixels. + +The complexity of overlapping windows is limited to GR_MAX_CLIPRECTS regions, +which is 200. Each window which overlaps another requires another 1 to 4 +regions depending on its position and size. + + +GRAPHICS CALLS + + +int +GrOpen() +Open a connection to the graphics server. This must be the first graphics +function used by your program. Currently, this sets the screen into +graphics mode. Returns zero if successful, -1 on failure. + + +void +GrClose() +Close the connection to the graphics server, first flushing any graphics +calls that have been buffered. Currently, this sets the screen back into +text mode. This (currently) should be called before your program exits, +otherwise the screen will be left in graphics mode. If this occurs, you +can run the 'tm' program to reset the terminal to text mode. + + +GR_ERROR_FUNC +GrSetErrorHandler(func) + GR_ERROR_FUNC func; /* function to handle errors */ +Set an error handling routine, which will be called on any errors from +the server (when events are asked for by the client). If zero is given, +then a default routine will be used which will describe the error and exit. +Returns the previous error handler (0 if none). When an error occurs, +the error handling function is called with the following parameters: +GR_ERROR, GR_FUNC_NAME, and GR_ID. These are the error code, the name +of the function which failed, and a resource id (0 if not meaningful). +The error routine can return if desired, but without corrective action +new errors will probably occur soon. + + +void +GrGetScreenInfo(sip) + GR_SCREEN_INFO *sip; /* location to return info into */ +Return useful information about the screen. This information returned +has been documented above. + + +void +GrGetFontInfo(font, fip) + GR_FONT font; /* font number */ + GR_FONT_INFO *fip; /* address of font info */ +Return useful information about the specified font number. This information +is the font number, the height of the font, the maximum width of any +character in the font, the height of the baseline, a flag indicating whether +or not the font is fixed-width, and a table of the individual widths of each +character in the font. If the font is unknown, the returned font number is +set to zero and the remainder of the information is undefined. Refer to +graphics.h for a definition of the fields of GR_FONT_INFO. + + +void +GrGetGCInfo(gc, gcip) + GR_GC_ID gc; /* graphics context */ + GR_GC_INFO *gcip; /* address of graphics context info */ +Return useful information about the specified graphics context. This +information is the graphics context id, the current font, the foreground +and background colors, and so on. If the graphics context is unknown, +the returned id is 0, and the other information is undefined. Refer to +graphics.h for a definition of the fields of GR_GC_INFO. + + +void +GrGetGCTextSize(gc, cp, len, retwidth, retheight, retbase) + GR_GC_ID gc; /* graphics context containing font */ + GR_CHAR *cp; /* address of text string */ + GR_SIZE len; /* length of text string */ + GR_SIZE *retwidth; /* returned width of string */ + GR_SIZE *retheight; /* returned height of string */ + GR_SIZE *retbase; /* returned height of baseline */ +Return the size of a text string for the font in a graphics context. +This is the width of the string, the height of the string, and the height +above the bottom of the font of the baseline for the font. The returned +sizes are in pixels. + + +void +GrGetNextEvent(ep) + GR_EVENT *ep; /* address where event is returned */ +Return the next event from the event queue, waiting for it if necessary. +If a graphics error had occurred, the error handler will be called at this +point. This routine first flushes any buffered graphics commands. The +GR_EVENT is a union of all the possible events. The type field of the union +indicates which of the possible events took place, and then the correct +element of the union can be used to access that particular event type's data. + + +void +GrCheckNextEvent(ep) + GR_EVENT *ep; /* address where event is returned */ +Return the next event from the event queue if one is ready. +If one is not ready, then the event type GR_EVENT_TYPE_NONE is returned. +Therefore, this routine never blocks. This routine first flushes any +buffered graphics commands. + + +void +GrPeekEvent(ep) + GR_EVENT *ep; /* address where event is returned */ +Return the next event from the event queue if one is ready, without removing +it from the queue. If one is not ready, then the type GR_EVENT_TYPE_NONE +is returned. This routine never blocks. This routine first flushes any +buffered graphics commands. + + +void +GrSelectEvents(wid, eventmask) + GR_WINDOW_ID wid; /* window id */ + GR_EVENT_MASK eventmask; /* mask of events wanted */ +Select events for a window for this client. The events are a bitmask +specifying the events desired for this window. This totally replaces +any previously selected event mask for the window. + + +GR_WINDOW_ID +GrNewWindow(parent, x, y, width, height, bordersize, background, bordercolor) + GR_WINDOW_ID parent; /* parent id */ + GR_COORD x; /* x position relative to parent */ + GR_COORD y; /* y position relative to parent */ + GR_SIZE width; /* width */ + GR_SIZE height; /* height */ + GR_SIZE bordersize; /* size of border */ + GR_COLOR background; /* background color */ + GR_COLOR bordercolor; /* border color */ +Allocate a new input-output window which is a child of the specified window. +A new top-level window is made by specifying a parent of GR_ROOT_WINDOW_ID. +The x and y position is the upper left corner of the window, relative to +the parent's upper left corner. These corners are only for the drawable +area of the windows, so that the border does not affect the position. An +input-output window cannot be made as a child of an input-only window. The +new window starts off unmapped, and must be mapped before it can be seen. +The new window inherits the cursor of the parent window, and initially is +set to select no events. This routine returns the window id of the window +which can be used in other calls. + + +GR_WINDOW_ID +GrNewInputWindow(parent, x, y, width, height) + GR_WINDOW_ID parent; /* parent id */ + GR_COORD x; /* x position relative to parent */ + GR_COORD y; /* y position relative to parent */ + GR_SIZE width; /* width */ + GR_SIZE height; /* height */ +Allocate a new input-only window which is a child of the specified window. +An input-only window is invisible, and cannot be drawn into. It's only +purposes are that it can select events, and can have it's own cursor. The +new window starts off unmapped, and must be mapped before it is effective. +The new window inherits the cursor of the parent window, and initially is +set to select no events. This routine returns the window id of the window +which can be used in other calls. + + +void +GrDestroyWindow(wid) + GR_WINDOW_ID wid; /* window to destroy */ +This unmaps and then destroys the specified window, and all of its children. +The root window cannot be destroyed. After destroying a window, you must be +careful about handling events which refer to the dead window, but which have +not been read yet. + + +void +GrGetWindowInfo(wid, wip) + GR_WINDOW_ID wid; /* window id to find out about */ + GR_WINDOW_INFO *wip; /* location to return info into */ +Return useful information about the specified window. Refer to the +graphics.h include file for the definition of GR_WINDOW_INFO to see +what data is returned. If the window id is not valid, an error is NOT +generated. Instead, the wid value in the returned structure is set to +zero, and the other fields are not defined. + + +GR_GC_ID +GrNewGC() +Allocate a new graphics context with default parameters. These defaults are: +background of black, foreground of white, font as font 0, and drawing mode +as setting. This routine returns the id for the graphics context which can +be used in other calls. + + +GR_GC_ID +GrCopyGC(gc) + GR_GC_ID gc; /* graphics context to copy */ +Allocate a new graphics context which is a copy of another one. The new +graphics context has the same parameter values as the old one, but is then +independent. This routine returns the id for the graphics context which +can be used in other calls. + + +void +GrDestroyGC(gc) + GR_GC_ID gc; /* graphics context to destroy */ +Destroy an existing graphics context. + + +void +GrMapWindow(wid) + GR_WINDOW_ID wid; /* window to be mapped */ +Map the window to make it (and possibly its children) visible on the screen. +This paints the border and background of the window, and creates an +exposure event to tell the client to draw into it. + + +void +GrUnmapWindow(wid) + GR_WINDOW_ID wid; /* window to be unmapped */ +Unmap the window to make it and its children invisible on the screen. + + +void +GrRaiseWindow(wid) + GR_WINDOW_ID wid; /* window to be raised */ +Raise the window to the highest level among its siblings. This means that +this window will be visible in preference to those siblings. Siblings are +windows which have the same parent as this window. + + +void +GrLowerWindow(wid) + GR_WINDOW_ID wid; /* window to be lowered */ +Lower the window to the lowest level among its siblings. This means that +this window will be covered by any siblings which overlap it. + + +void +GrMoveWindow(wid, x, y) + GR_WINDOW_ID wid; /* window to be lowered */ + GR_COORD x; /* new relative x position */ + GR_COORD y; /* new relative y position */ +Move the window to the specified position relative to its parent. + + +void +GrResizeWindow(wid, width, height) + GR_WINDOW_ID wid; /* window to be lowered */ + GR_SIZE width; /* new width of window */ + GR_SIZE height; /* new height of window */ +Resize the window to be the specified size. Resizing of a window can +generate exposure events. + + +void +GrClearWindow(wid, exposeflag) + GR_WINDOW_ID wid; /* window id */ + GR_BOOL exposeflag; /* nonzero to cause an exposure */ +Clear the specified window by setting it to its background color. +If the exposeflag is nonzero, then this also creates an exposure +event for the window. + + +void +GrSetFocus(wid) + GR_WINDOW_ID wid; /* window id */ +Set the focus to a particular window. This makes keyboard events only +visible to that window or children of it, depending on the pointer location. +Setting the focus window to the root window makes the input focus track +the pointer (which is the default). + + +void +GrSetBorderColor(wid, color) + GR_WINDOW_ID wid; /* window id */ + GR_COLOR color; /* color for border */ +Set the border of a window to the specified color. + + +void +GrSetCursor(wid, width, height, hotx, hoty, foreground, background, + fgbitmap, bgbitmap) + + GR_WINDOW_ID wid; /* window id to set cursor for */ + GR_SIZE width; /* width of cursor */ + GR_SIZE height; /* height of cursor */ + GR_COORD hotx; /* relative x position of hot spot */ + GR_COORD hoty; /* relative y position of hot spot */ + GR_COLOR foreground; /* foreground color of cursor */ + GR_COLOR background; /* background color of cursor */ + GR_BITMAP *fgbitmap; /* foreground bitmap */ + GR_BITMAP *bgbitmap; /* background bitmap */ +Specify a new cursor for a window. This cursor will only be used within +that window, and by default for its new children. The cursor is defined +by giving its width and height, its foreground and background colors, its +foreground and background bitmaps, and its "hot spot" position. If a pixel +is specified for both the foreground and background bitmaps, then the +foreground has precedence. The hot spot is an offset from the upper left +corner of the bitmap, and is the location in the cursor which is important. + + +void +GrMoveCursor(x, y) + GR_COORD x; /* new x position of cursor */ + GR_COORD y; /* new y position of cursor */ +Move the cursor to the specified absolute screen coordinates. +The coordinates are that of the defined hot spot of the cursor. +The cursor's appearance is changed to that defined for the window +in which the cursor is moved to. + + +void +GrFlush() +Flush the graphics buffer so that all previous requests will be executed. +This is only needed if you do not check events quickly and want to see the +results on the screen soon, since checking for events does an automatic flush. + + +void +GrSetGCForeground(gc, foreground) + GR_GC_ID gc; /* graphics context id */ + GR_COLOR foreground; /* foreground color */ +Set the foreground color in a graphics context. The default is white. + + +void +GrSetGCBackground(gc, background) + GR_GC_ID gc; /* graphics context id */ + GR_COLOR background; /* background color */ +Set the background color in a graphics context. The default is black. + + +void +GrSetGCUseBackground(gc, flag) + GR_GC_ID gc; /* graphics context id */ + GR_BOOL flag; /* TRUE if background is drawn */ +Set whether or not the background color is drawn in bitmaps and text. +This affects GrBitmap, GrArea8, and GrText. The default is GR_TRUE. + + +void +GrSetGCMode(gc, mode) + GR_GC_ID gc; /* graphics context id */ + GR_MODE mode; /* drawing mode */ +Set the drawing mode in a graphics context. The drawing mode is one of +GR_MODE_SET, GR_MODE_XOR, GR_MODE_AND, or GR_MODE_OR. The default is +GR_MODE_SET. + + +void +GrSetGCFont(gc, font) + GR_GC_ID gc; /* graphics context id */ + GR_FONT font; /* text font */ +Set the font used for text drawing in a graphics context. +The font is a number identifying one of several fonts. +Font number 0 is always available, and is the default font. + + +void +GrLine(id, gc, x1, y1, x2, y2) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COORD x1; + GR_COORD y1; + GR_COORD x2; + GR_COORD y2; +Draw a line in the specified drawable using the specified graphics context. + + +void +GrRect(id, gc, x, y, width, height) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COORD x; + GR_COORD y; + GR_SIZE width; + GR_SIZE height; +Draw the boundary of a rectangle in the specified drawable using the +specified graphics context. + + +void +GrFillRect(id, gc, x, y, width, height) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COORD x; + GR_COORD y; + GR_SIZE width; + GR_SIZE height; +Fill a rectangle in the specified drawable using the specified graphics +context. The boundary of this rectangle is identical to that drawn by +the GrRect function. + + +void +GrEllipse(id, gc, x, y, rx, ry) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COORD x; + GR_COORD y; + GR_SIZE rx; + GR_SIZE ry; +Draw the boundary of an ellipse in the specified drawable with +the specified graphics context. + + +void +GrFillEllipse(id, gc, x, y, rx, ry) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COORD x; + GR_COORD y; + GR_SIZE rx; + GR_SIZE ry; +Fill an ellipse in the specified drawable using the specified +graphics context. + + +void +GrBitmap(id, gc, x, y, width, height, bitmaptable) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COORD x; + GR_COORD y; + GR_SIZE width; + GR_SIZE height; + GR_BITMAP *bitmaptable; +Draw a rectangular area in the specified drawable using the specified +graphics context, as determined by the specified bit map. This differs +from rectangle drawing in that the rectangle is drawn using the foreground +color and possibly the background color as determined by the bit map. +Bits which are 1 are the foreground, and bits which are 0 are the background. +Each row of bits is aligned to the next bitmap word boundary (so there can +be padding at the end of each row). The background bit values are only +written if the usebackground flag is set in the GC. + + +void +GrArea8(id, gc, x, y, width, height, colortable) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COORD x; + GR_COORD y; + GR_SIZE width; + GR_SIZE height; + GR_COLOR8 *colortable; +Draw a rectangular area in the specified drawable using the specified +graphics context. This differs from rectangle drawing in that the +color values for each pixel in the rectangle are specified. The color +values are estricted to 8 bit values. The color table is indexed row by +row from left to right. Table values whose color matches the background +color are only written if the usebackground flag is set in the GC. + + +void +GrReadArea8(id, x, y, width, height, colortable) + GR_DRAW_ID id; + GR_COORD x; + GR_COORD y; + GR_SIZE width; + GR_SIZE height; + GR_COLOR8 *colortable; +Read the color values from the specified rectangular area of the specified +drawable into a supplied buffer. If the drawable is a window which is +obscured by other windows, then the returned values will include the values +from the covering windows. Regions outside of the screen boundaries, or +from unmapped windows will return black. + + +void +GrPoint(id, gc, x, y) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COORD x; + GR_COORD y; +Draw a point in the specified drawable using the specified graphics context. + + +void +GrPoly(id, gc, count, pointtable) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COUNT count; + GR_POINT *pointtable; +Draw a polygon in the specified drawable using the specified graphics +context. The polygon is only complete if the first point is repeated at +the end. Note: currently if the polygon crosses itself, and the drawing +mode is set to XOR, then the individual line segments will affect each +other. The endpoints of the lines are correct, however. + + +void +GrFillPoly(id, gc, count, pointtable) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COUNT count; + GR_POINT *pointtable; +Draw a filled polygon in the specified drawable using the specified +graphics context. The last point may be a duplicate of the first point, +but this is not required. Note: currently only convex polygons are +filled properly. + + +void +GrText(id, gc, x, y, str, count) + GR_DRAW_ID id; + GR_GC_ID gc; + GR_COORD x; + GR_COORD y; + GR_CHAR *str; + GR_COUNT count; +Draw a text string at the specified location in the specified drawable +using the specified graphics context. The background of the characters +are only drawn if the usebackground flag in the GC is set. + + +EXAMPLE PROGRAM + +The following simple program opens the graphics, creates a window, prints +some text in it, waits for the mouse to be clicked in the window, then exits. + + +#include +#include + +#define MARGIN 50 /* margin around window */ + + +main() +{ + GR_WINDOW_ID wid; /* window id */ + GR_GC_ID gc; /* graphics context id */ + GR_EVENT event; /* current event */ + GR_SCREEN_INFO si; /* screen information */ + + if (GrOpen() < 0) { + fprintf(stderr, "Cannot open graphics\n"); + exit(1); + } + + GrGetScreenInfo(&si); + + wid = GrNewWindow(GR_ROOT_WINDOW_ID, MARGIN, MARGIN, + si.cols - MARGIN * 2, si.rows - MARGIN * 2, + 1, si.black, si.white); + + GrSelectEvents(wid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_EXPOSURE); + GrMapWindow(wid); + gc = GrNewGC(); + + while (1) { + GrGetNextEvent(&event); + switch (event.type) { + case GR_EVENT_TYPE_BUTTON_DOWN: + if (event.button.wid != wid) + break; + GrClose(); + exit(0); + + case GR_EVENT_TYPE_EXPOSURE: + if (event.exposure.wid == wid) + GrText(wid, gc, 50, 50, "EXIT", 4); + break; + } + } +} + + +For a more complete demonstration program, see the file "demo.c" in the +/usr/src/graphics/clients directory. diff --git a/packages/services/gfx/mw/current/include/microwin/XtoNX.h b/packages/services/gfx/mw/current/include/microwin/XtoNX.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/XtoNX.h @@ -0,0 +1,164 @@ +#ifndef __XTONX_H +#define __XTONX_H +/* + * Copyright (c) 2001 by Greg Haerr + * + * XtoNX.h - X to Nano-X macro conversion header file + * + * Yes, this is a vain attempt at making things easier when + * porting Xlib programs to Nano-X! + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define MWINCLUDECOLORS +#include "nano-X.h" + +typedef GR_WINDOW_ID Window; +typedef GR_WINDOW_ID Pixmap; +typedef GR_GC_ID GC; +typedef GR_FONT_ID Font; +typedef GR_CURSOR_ID Cursor; +typedef GR_REGION_ID Region; +typedef unsigned long Time; /* change to GR_TIME*/ +typedef GR_EVENT XEvent; +typedef GR_FONT_INFO XFontStruct; +typedef GR_POINT XPoint; +typedef GR_RECT XRectangle; + +/* static display structed initialized by XOpenDisplay()*/ +typedef struct { + GR_COORD display_width; + GR_COORD display_height; + int display_bpp; +} Display; + +/* kluge structs*/ +#define XCharStruct char + +#define DisplayWidth(d,s) (_display.display_width) +#define DisplayHeight(d,s) (_display.display_height) +#define DefaultDepth(d,s) (_display.display_bpp) +#define DefaultScreen(d) 0 +#define RootWindow(d,s) GR_ROOT_WINDOW_ID +#define BlackPixel(d,s) BLACK +#define WhitePixel(d,s) WHITE +#define False 0 +#define True 1 + +#define None 0 +#define RectangleOut MWRECT_OUT +#define RectangleIn MWRECT_ALLIN +#define RectanglePart MWRECT_PARTIN + +/* events*/ +#define EnterWindowMask GR_EVENT_MASK_MOUSE_ENTER +#define LeaveWindowMask GR_EVENT_MASK_MOUSE_EXIT +#define ButtonPressMask GR_EVENT_MASK_BUTTON_DOWN +#define ButtonReleaseMask GR_EVENT_MASK_BUTTON_UP +#define KeyPressMask GR_EVENT_MASK_KEY_DOWN +#define KeyReleaseMask GR_EVENT_MASK_KEY_UP +#define ExposureMask GR_EVENT_MASK_EXPOSURE +#define SubstructureNotifyMask GR_EVENT_MASK_CHLD_UPDATE + +#define EnterNotify GR_EVENT_TYPE_MOUSE_ENTER +#define LeaveNotify GR_EVENT_TYPE_MOUSE_EXIT +#define ButtonPress GR_EVENT_TYPE_BUTTON_DOWN +#define ButtonRelease GR_EVENT_TYPE_BUTTON_UP +#define KeyPress GR_EVENT_TYPE_KEY_DOWN +#define KeyRelease GR_EVENT_TYPE_KEY_UP +#define Expose GR_EVENT_TYPE_EXPOSURE +#define ConfigureNotify GR_EVENT_TYPE_CHLD_UPDATE + +#define XCloseDisplay(d) GrClose() +#define XNextEvent(d,ep) GrGetNextEvent(ep) +#define XSelectInput(d,w,m) GrSelectEvents(w,m) +#define XFlush(d) GrFlush() +#define XSync(d,f) GrFlush() + +/* graphics functions*/ +#define XCreateSimpleWindow(d,p,x,y,w,h,bw,bordc,backc) \ + GrNewWindow(p,x,y,w,h,bw,backc,bordc) +#define XCreateWindow(d,p,x,y,w,h,bw,depth,cl,vis,vm,attr) \ + GrNewWindow(p,x,y,w,h,bw,WHITE,BLACK) +#define XCreatePixmapFromBitmapData(d,w,bm,W,H,f,b,depth) \ + GrNewPixmapFromData(W,H,f,b,(void *)bm, \ + GR_BMDATA_BYTEREVERSE|GR_BMDATA_BYTESWAP) +#define XCreateBitmapFromData(d,w,bm,W,H) \ + GrNewPixmapFromData(W,H,WHITE,BLACK,(void *)bm, \ + GR_BMDATA_BYTEREVERSE|GR_BMDATA_BYTESWAP) +#define XDestroyWindow(d,w) GrDestroyWindow(w) +#define XReparentWindow(d,w,p,x,y) GrReparentWindow(w,p,x,y) +#define XMapWindow(d,w) GrMapWindow(w) +#define XUnmapWindow(d,w) GrUnmapWindow(w) +#define XClearWindow(d,w) GrClearArea(w,0,0,0,0,GR_FALSE) +#define XClearArea(d,w,X,Y,W,H,e) GrClearArea(w,X,Y,W,H,e) +#define XRaiseWindow(d,w) GrRaiseWindow(w) +#define XLowerWindow(d,w) GrLowerWindow(w) +#define XMoveWindow(d,w,x,y) GrMoveWindow(w,x,y) +#define XResizeWindow(d,w,W,H) GrResizeWindow(w,W,H) + +#define XCreateGC(d,a,b,c) GrNewGC() +#define XSetFunction(d,g,f) GrSetGCMode(g,f) +#define GXxor GR_MODE_XOR +#define XSetForeground(d,g,c) GrSetGCForeground(g,c) +#define XSetWindowBackgroundPixmap(d,w,p) \ + GrSetBackgroundPixmap(w,p,GR_BACKGROUND_TILE) +#define XSetWindowBackground(d,w,c) GrSetWindowBackgroundColor(w,c) +#define XSetWindowBorderWidth(d,w,bw) GrSetWindowBorderSize(w,bw) +#define XSetWindowBorder(d,w,c) GrSetWindowBorderColor(w,c) +#define XStoreName(d,w,n) GrSetWindowTitle(w,n) +#define XSetIconName(d,w,n) /* nyi*/ +#define XDrawLines(d,w,g,ar,cnt,B) GrDrawLines(w,g,ar,cnt) +#define XFillRectangle(d,w,g,x,y,W,H) GrFillRect(w,g,x,y,W,H) +#define XDrawString(d,w,g,x,y,s,c) GrText(w,g,x,y,(void *)s,c,GR_TFASCII) +#define XSetFont(d,g,f) GrSetGCFont(g,f) +#define XLoadFont(d,f) GrCreateFont(0, 0, 0) +#define XDefineCursor(d,w,c) GrSetWindowCursor(w,c) +#define XUndefineCursor(d,w) GrSetWindowCursor(w,0) + +#define XCreateRegion() GrNewRegion() +#define XUnionRectWithRegion(rect,sr,dr) GrUnionRectWithRegion(dr,rect) /* FIXME*/ +#define XRectInRegion(r,x,y,w,h) GrRectInRegion(r,x,y,w,h) +#define XSubtractRegion(sra,srb,dr) GrSubtractRegion(dr,sra,srb) +#define XDestroyRegion(r) GrDestroyRegion(r) + +#define XQueryTree(d,w,r,p,c,nc) GrQueryTree(w,p,c,nc) +#define XFree(p) free(p) + +/* client-statically declared functions*/ +#define STATIC_FUNCTIONS \ +static Display _display; \ + \ +Display * \ +XOpenDisplay(char *name) \ +{ \ + GR_SCREEN_INFO sinfo; \ + \ + if (GrOpen() < 0) \ + return NULL; \ + \ + GrGetScreenInfo(&sinfo); \ + _display.display_width = sinfo.cols; \ + _display.display_height = sinfo.rows; \ + _display.display_bpp = sinfo.bpp; \ + \ + return &_display; \ +} \ + \ +int \ +XPending(Display *d) \ +{ \ + GR_EVENT ev; \ + \ + GrFlush(); \ + return GrPeekEvent(&ev); \ +} + +#ifdef __cplusplus +} /* extern "C"*/ +#endif + +#endif /* __XTONX_H*/ diff --git a/packages/services/gfx/mw/current/include/microwin/device.h b/packages/services/gfx/mw/current/include/microwin/device.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/device.h @@ -0,0 +1,654 @@ +#ifndef _DEVICE_H +#define _DEVICE_H +/* + * Copyright (c) 1999, 2000 Greg Haerr + * + * Engine-level Screen, Mouse and Keyboard device driver API's and types + * + * Contents of this file are not for general export + */ +#include "mwtypes.h" /* public export typedefs*/ + +/* Changeable limits and options*/ +#define ALPHABLEND 1 /* =1 to include blending code*/ +#define DYNAMICREGIONS 1 /* =1 to use MWCLIPREGIONS*/ +#define HAVEFLOAT 1 /* =1 incl float, GdArcAngle*/ +#define POLYREGIONS 1 /* =1 includes polygon regions*/ +#define ANIMATEPALETTE 0 /* =1 animated palette test*/ +#define FONTMAPPER 0 /* =1 for Morten's font mapper*/ +#define USE_ALLOCA 1 /* alloca() is available */ +#define EPRINTF GdError /* error output*/ +#define DPRINTF GdErrorNull /* debug output*/ + +/* max char height/width must be >= 16 and a multiple of sizeof(MWIMAGEBITS)*/ +#define MAX_CHAR_HEIGHT 128 /* maximum text bitmap height*/ +#define MAX_CHAR_WIDTH 128 /* maximum text bitmap width*/ +#define MIN_MWCOORD ((MWCOORD) -32768) /* minimum coordinate value */ +#define MAX_MWCOORD ((MWCOORD) 32767) /* maximum coordinate value */ +#define MAX_CLIPRECTS 200 /* max clip rects (obsolete)*/ + +typedef struct _mwscreendevice *PSD; + +/* builtin C-based proportional/fixed font structure*/ +typedef struct { + char * name; /* font name*/ + int maxwidth; /* max width in pixels*/ + int height; /* height in pixels*/ + int ascent; /* ascent (baseline) height*/ + int firstchar; /* first character in bitmap*/ + int size; /* font size in characters*/ + MWIMAGEBITS * bits; /* 16-bit right-padded bitmap data*/ + unsigned short *offset; /* 256 offsets into bitmap data*/ + unsigned char * width; /* 256 character widths or 0 if fixed*/ +} MWCFONT, *PMWCFONT; + +/* draw procs associated with fonts. Strings are [re]packed using defencoding*/ +typedef struct { + int encoding; /* routines expect this encoding*/ + MWBOOL (*GetFontInfo)(PMWFONT pfont, PMWFONTINFO pfontinfo); + void (*GetTextSize)(PMWFONT pfont, const void *text, int cc, + MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase); + void (*GetTextBits)(PMWFONT pfont, int ch, MWIMAGEBITS *retmap, + MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase); + void (*DestroyFont)(PMWFONT pfont); + void (*DrawText)(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y, + const void *str, int count, int flags); + void (*SetFontSize)(PMWFONT pfont, MWCOORD fontsize); + void (*SetFontRotation)(PMWFONT pfont, int tenthdegrees); + void (*SetFontAttr)(PMWFONT pfont, int setflags, int clrflags); +} MWFONTPROCS, *PMWFONTPROCS; + +/* new multi-renderer font struct*/ +typedef struct _mwfont { /* common hdr for all font structures*/ + PMWFONTPROCS fontprocs; /* font-specific rendering routines*/ + MWCOORD fontsize; /* font height in pixels*/ + int fontrotation; /* font rotation*/ + int fontattr; /* font attributes: kerning/antialias*/ + /* font-specific rendering data here*/ +} MWFONT; + +/* fontattr flags*/ +#define FS_FREETYPE 0x0800 + +/* builtin core font struct*/ +typedef struct { + PMWFONTPROCS fontprocs; /* common hdr*/ + MWCOORD fontsize; + int fontrotation; + int fontattr; + + char * name; /* Microwindows font name*/ + PMWCFONT cfont; /* builtin font data*/ +} MWCOREFONT, *PMWCOREFONT; + +/* This structure is used to pass parameters into the low + * level device driver functions. + */ +typedef struct { + MWCOORD dstx, dsty, dstw, dsth, dst_linelen; + MWCOORD srcx, srcy, src_linelen; + void *pixels, *misc; + MWPIXELVAL bg_color, fg_color; + int gr_usebg; +} driver_gc_t; + +/* Operations for the Blitter/Area functions */ +#define PSDOP_COPY 0 +#define PSDOP_COPYALL 1 +#define PSDOP_COPYTRANS 2 +#define PSDOP_ALPHAMAP 3 +#define PSDOP_ALPHACOL 4 +#define PSDOP_PIXMAP_COPYALL 5 + +/* common blitter parameter structure*/ +typedef struct { + PSD dstpsd; /* dst drawable*/ + MWCOORD dstx, dsty; /* dst x,y,w,h*/ + MWCOORD dstw, dsth; + MWCOORD srcx, srcy; /* src x,y*/ + MWCOORD srcw, srch; /* src w,h if stretchblit*/ + PSD srcpsd; /* src drawable*/ + unsigned long rop; /* raster opcode*/ + PSD alphachan; /* alpha chan for MWROP_BLENDCHANNEL*/ + MWPIXELVAL fgcolor; /* fg/bg color for MWROP_BLENDFGBG*/ + MWPIXELVAL bgcolor; + MWPIXELVAL transcolor; /* trans color for MWROP_SRCTRANSCOPY*/ +} MWBLITARGS, *PMWBLITARGS; + +/* screen subdriver entry points: one required for each draw function*/ +/* NOTE: currently used for fb driver only*/ +typedef struct { + int (*Init)(PSD psd); + void (*DrawPixel)(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c); + MWPIXELVAL (*ReadPixel)(PSD psd, MWCOORD x, MWCOORD y); + void (*DrawHorzLine)(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, + MWPIXELVAL c); + void (*DrawVertLine)(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, + MWPIXELVAL c); + void (*FillRect)(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2, + MWCOORD y2,MWPIXELVAL c); + void (*Blit)(PSD destpsd, MWCOORD destx, MWCOORD desty, MWCOORD w, + MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op); + void (*DrawArea)(PSD psd, driver_gc_t *gc, int op); + void (*StretchBlit)(PSD destpsd, MWCOORD destx, MWCOORD desty, + MWCOORD dstw, MWCOORD dsth, PSD srcpsd, MWCOORD srcx, + MWCOORD srcy, MWCOORD srcw, MWCOORD srch, long op); +} SUBDRIVER, *PSUBDRIVER; + +/* + * Interface to Screen Device Driver + * This structure is also allocated for memory (offscreen) drawing and blitting. + */ +typedef struct _mwscreendevice { + MWCOORD xres; /* X screen res (real) */ + MWCOORD yres; /* Y screen res (real) */ + MWCOORD xvirtres; /* X drawing res (will be flipped in portrait mode) */ + MWCOORD yvirtres; /* Y drawing res (will be flipped in portrait mode) */ + int planes; /* # planes*/ + int bpp; /* # bpp*/ + int linelen; /* line length in bytes for bpp 1,2,4,8*/ + /* line length in pixels for bpp 16, 24, 32*/ + int size; /* size of memory allocated*/ + long ncolors; /* # screen colors*/ + int pixtype; /* format of pixel value*/ + int flags; /* device flags*/ + void * addr; /* address of memory allocated (memdc or fb)*/ + + PSD (*Open)(PSD psd); + void (*Close)(PSD psd); + void (*GetScreenInfo)(PSD psd,PMWSCREENINFO psi); + void (*SetPalette)(PSD psd,int first,int count,MWPALENTRY *pal); + void (*DrawPixel)(PSD psd,MWCOORD x,MWCOORD y,MWPIXELVAL c); + MWPIXELVAL (*ReadPixel)(PSD psd,MWCOORD x,MWCOORD y); + void (*DrawHorzLine)(PSD psd,MWCOORD x1,MWCOORD x2,MWCOORD y, + MWPIXELVAL c); + void (*DrawVertLine)(PSD psd,MWCOORD x,MWCOORD y1,MWCOORD y2, + MWPIXELVAL c); + void (*FillRect)(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2, + MWPIXELVAL c); + PMWCOREFONT builtin_fonts; + + /***void (*DrawText)(PSD psd,MWCOORD x,MWCOORD y,const MWUCHAR *str, + int count, MWPIXELVAL fg, PMWFONT pfont);***/ + + void (*Blit)(PSD destpsd,MWCOORD destx,MWCOORD desty,MWCOORD w, + MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op); + void (*PreSelect)(PSD psd); + void (*DrawArea)(PSD psd, driver_gc_t *gc, int op); + int (*SetIOPermissions)(PSD psd); + PSD (*AllocateMemGC)(PSD psd); + MWBOOL (*MapMemGC)(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp, + int linelen,int size,void *addr); + void (*FreeMemGC)(PSD mempsd); + void (*StretchBlit)(PSD destpsd,MWCOORD destx,MWCOORD desty, + MWCOORD destw,MWCOORD desth,PSD srcpsd,MWCOORD srcx, + MWCOORD srcy,MWCOORD srcw,MWCOORD srch,long op); + void (*SetPortrait)(PSD psd,int portraitmode); + int portrait; /* screen portrait mode*/ + PSUBDRIVER orgsubdriver; /* original subdriver for portrait modes*/ +} SCREENDEVICE; + +/* PSD flags*/ +#define PSF_SCREEN 0x0001 /* screen device*/ +#define PSF_MEMORY 0x0002 /* memory device*/ +#define PSF_HAVEBLIT 0x0004 /* have bitblit*/ +#define PSF_HAVEOP_COPY 0x0008 /* psd->DrawArea can do area copy*/ +#define PSF_ADDRMALLOC 0x0010 /* psd->addr was malloc'd*/ +#define PSF_ADDRSHAREDMEM 0x0020 /* psd->addr is shared memory*/ + +/* Interface to Mouse Device Driver*/ +typedef struct _mousedevice { + int (*Open)(struct _mousedevice *); + void (*Close)(void); + int (*GetButtonInfo)(void); + void (*GetDefaultAccel)(int *pscale,int *pthresh); + int (*Read)(MWCOORD *dx,MWCOORD *dy,MWCOORD *dz,int *bp); + int (*Poll)(void); /* not required if have select()*/ +} MOUSEDEVICE; + +/* Interface to Keyboard Device Driver*/ +typedef struct _kbddevice { + int (*Open)(struct _kbddevice *pkd); + void (*Close)(void); + void (*GetModifierInfo)(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers); + int (*Read)(MWKEY *buf,MWKEYMOD *modifiers,MWSCANCODE *scancode); + int (*Poll)(void); /* not required if have select()*/ +} KBDDEVICE; + +/* Clip areas*/ +#define CLIP_VISIBLE 0 +#define CLIP_INVISIBLE 1 +#define CLIP_PARTIAL 2 + +/* static clip rectangle: drawing allowed if point within rectangle*/ +typedef struct { + MWCOORD x; /* x coordinate of top left corner */ + MWCOORD y; /* y coordinate of top left corner */ + MWCOORD width; /* width of rectangle */ + MWCOORD height; /* height of rectangle */ +} MWCLIPRECT; + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#define MWMIN(a,b) ((a) < (b) ? (a) : (b)) +#define MWMAX(a,b) ((a) > (b) ? (a) : (b)) + +/* MWIMAGEBITS macros*/ +#define MWIMAGE_SIZE(width, height) ((height) * (((width) + MWIMAGE_BITSPERIMAGE - 1) / MWIMAGE_BITSPERIMAGE)) +#define MWIMAGE_WORDS(x) (((x)+15)/16) +#define MWIMAGE_BYTES(x) (((x)+7)/8) +#define MWIMAGE_BITSPERIMAGE (sizeof(MWIMAGEBITS) * 8) +#define MWIMAGE_FIRSTBIT ((MWIMAGEBITS) 0x8000) +#define MWIMAGE_NEXTBIT(m) ((MWIMAGEBITS) ((m) >> 1)) +#define MWIMAGE_TESTBIT(m) ((m) & MWIMAGE_FIRSTBIT) /* use with shiftbit*/ +#define MWIMAGE_SHIFTBIT(m) ((MWIMAGEBITS) ((m) << 1)) /* for testbit*/ + +/* color and palette defines*/ +#define RGBDEF(r,g,b) {r, g, b} + +#define GETPALENTRY(pal,index) ((unsigned long)(pal[index].r |\ + (pal[index].g << 8) | (pal[index].b << 16))) +/*#define GETPALENTRY(pal,index) ((*(unsigned long *)&pal[index])&0x00ffffff)*/ + +#define REDVALUE(rgb) ((rgb) & 0xff) +#define GREENVALUE(rgb) (((rgb) >> 8) & 0xff) +#define BLUEVALUE(rgb) (((rgb) >> 16) & 0xff) + +/* Truecolor color conversion and extraction macros*/ +/* + * Conversion from RGB to MWPIXELVAL + */ +/* create 24 bit 8/8/8 format pixel (0x00RRGGBB) from RGB triplet*/ +#define RGB2PIXEL888(r,g,b) \ + (((r) << 16) | ((g) << 8) | (b)) + +/* create 16 bit 5/6/5 format pixel from RGB triplet */ +#define RGB2PIXEL565(r,g,b) \ + ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) + +/* create 16 bit 5/5/5 format pixel from RGB triplet */ +#define RGB2PIXEL555(r,g,b) \ + ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3)) + +/* create 8 bit 3/3/2 format pixel from RGB triplet*/ +#define RGB2PIXEL332(r,g,b) \ + (((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6)) + +/* + * Conversion from MWCOLORVAL to MWPIXELVAL + */ +/* create 24 bit 8/8/8 format pixel from RGB colorval (0x00BBGGRR)*/ +#define COLOR2PIXEL888(c) \ + ((((c) & 0xff) << 16) | ((c) & 0xff00) | (((c) & 0xff0000) >> 16)) + +/* create 16 bit 5/6/5 format pixel from RGB colorval (0x00BBGGRR)*/ +#define COLOR2PIXEL565(c) \ + ((((c) & 0xf8) << 8) | (((c) & 0xfc00) >> 5) | (((c) & 0xf80000) >> 19)) + +/* create 16 bit 5/5/5 format pixel from RGB colorval (0x00BBGGRR)*/ +#if 0 +#define COLOR2PIXEL555(c) \ + ((((c) & 0xf8) << 7) | (((c) & 0xf800) >> 6) | (((c) & 0xf80000) >> 19)) +#else +#define COLOR2PIXEL555(c) \ + ((((c) & 0xf8) >> (3-0)) | (((c) & 0xf800) >> (11-5)) | (((c) & 0xf80000) >> (19-10))) +#endif + +/* create 8 bit 3/3/2 format pixel from RGB colorval (0x00BBGGRR)*/ +#define COLOR2PIXEL332(c) \ + (((c) & 0xe0) | (((c) & 0xe000) >> 11) | (((c) & 0xc00000) >> 22)) + +/* + * Conversion from MWPIXELVAL to red, green or blue components + */ +/* return 8/8/8 bit r, g or b component of 24 bit pixelval*/ +#define PIXEL888RED(pixelval) (((pixelval) >> 16) & 0xff) +#define PIXEL888GREEN(pixelval) (((pixelval) >> 8) & 0xff) +#define PIXEL888BLUE(pixelval) ((pixelval) & 0xff) + +/* return 5/6/5 bit r, g or b component of 16 bit pixelval*/ +#define PIXEL565RED(pixelval) (((pixelval) >> 11) & 0x1f) +#define PIXEL565GREEN(pixelval) (((pixelval) >> 5) & 0x3f) +#define PIXEL565BLUE(pixelval) ((pixelval) & 0x1f) + +/* return 5/5/5 bit r, g or b component of 16 bit pixelval*/ +#define PIXEL555RED(pixelval) (((pixelval) >> 10) & 0x1f) +#define PIXEL555GREEN(pixelval) (((pixelval) >> 5) & 0x1f) +#define PIXEL555BLUE(pixelval) ((pixelval) & 0x1f) + +/* return 3/3/2 bit r, g or b component of 8 bit pixelval*/ +#define PIXEL332RED(pixelval) (((pixelval) >> 5) & 0x07) +#define PIXEL332GREEN(pixelval) (((pixelval) >> 2) & 0x07) +#define PIXEL332BLUE(pixelval) ((pixelval) & 0x03) + +/* + * Conversion from MWPIXELVAL to MWCOLORVAL + */ +/* create RGB colorval (0x00BBGGRR) from 8/8/8 format pixel*/ +#define PIXEL888TOCOLORVAL(p) \ + ((((p) & 0xff0000) >> 16) | ((p) & 0xff00) | (((p) & 0xff) << 16)) + +/* create RGB colorval (0x00BBGGRR) from 5/6/5 format pixel*/ +#define PIXEL565TOCOLORVAL(p) \ + ((((p) & 0xf800) >> 8) | (((p) & 0x07e0) << 5) | (((p) & 0x1f) << 19)) + +#define PIXEL555TOCOLORVAL(p) \ + ((((p) & 0x7c00) >> 7) | (((p) & 0x03e0) << 6) | (((p) & 0x1f) << 19)) + +/* create RGB colorval (0x00BBGGRR) from 3/3/2 format pixel*/ +#define PIXEL332TOCOLORVAL(p) \ + ((((p) & 0xe0)) | (((p) & 0x1c) << 11) | (((p) & 0x03) << 19)) + +#if (MWPIXEL_FORMAT == MWPF_TRUECOLOR888) || (MWPIXEL_FORMAT == MWPF_TRUECOLOR0888) +#define RGB2PIXEL(r,g,b) RGB2PIXEL888(r,g,b) +#define COLORVALTOPIXELVAL(c) COLOR2PIXEL888(c) +#define PIXELVALTOCOLORVAL(p) PIXEL888TOCOLORVAL(p) +#define PIXEL2RED(p) PIXEL888RED(p) +#define PIXEL2GREEN(p) PIXEL888GREEN(p) +#define PIXEL2BLUE(p) PIXEL888BLUE(p) +#endif + +#if MWPIXEL_FORMAT == MWPF_TRUECOLOR565 +#define RGB2PIXEL(r,g,b) RGB2PIXEL565(r,g,b) +#define COLORVALTOPIXELVAL(c) COLOR2PIXEL565(c) +#define PIXELVALTOCOLORVAL(p) PIXEL565TOCOLORVAL(p) +#define PIXEL2RED(p) PIXEL565RED(p) +#define PIXEL2GREEN(p) PIXEL565GREEN(p) +#define PIXEL2BLUE(p) PIXEL565BLUE(p) +#endif + +#if MWPIXEL_FORMAT == MWPF_TRUECOLOR555 +#define RGB2PIXEL(r,g,b) RGB2PIXEL555(r,g,b) +#define COLORVALTOPIXELVAL(c) COLOR2PIXEL555(c) +#define PIXELVALTOCOLORVAL(p) PIXEL555TOCOLORVAL(p) +#define PIXEL2RED(p) PIXEL555RED(p) +#define PIXEL2GREEN(p) PIXEL555GREEN(p) +#define PIXEL2BLUE(p) PIXEL555BLUE(p) +#endif + +#if MWPIXEL_FORMAT == MWPF_TRUECOLOR332 +#define RGB2PIXEL(r,g,b) RGB2PIXEL332(r,g,b) +#define COLORVALTOPIXELVAL(c) COLOR2PIXEL332(c) +#define PIXELVALTOCOLORVAL(p) PIXEL332TOCOLORVAL(p) +#define PIXEL2RED(p) PIXEL332RED(p) +#define PIXEL2GREEN(p) PIXEL332GREEN(p) +#define PIXEL2BLUE(p) PIXEL332BLUE(p) +#endif + +/* Alpha blend two pixels using 8-bit alpha */ +/* FIXME this will be quite a bit faster as an inlined function */ +#define ALPHAPIXELRED(pixelvalsrc, pixelvaldest, alpha) \ + (unsigned char)((((PIXEL2RED(pixelvalsrc) - PIXEL2RED(pixelvaldest))\ + * alpha) >> 8) + PIXEL2RED(pixelvaldest)) + +#define ALPHAPIXELGREEN(pixelvalsrc, pixelvaldest, alpha) \ + (unsigned char)((((PIXEL2GREEN(pixelvalsrc)-PIXEL2GREEN(pixelvaldest))\ + * alpha) >> 8) + PIXEL2GREEN(pixelvaldest)) + +#define ALPHAPIXELBLUE(pixelvalsrc, pixelvaldest, alpha) \ + (unsigned char)((((PIXEL2BLUE(pixelvalsrc) - PIXEL2BLUE(pixelvaldest))\ + * alpha) >> 8) + PIXEL2BLUE(pixelvaldest)) + +#if 0000 +/* colors assumed in first 16 palette entries*/ +/* note: don't use palette indices if the palette may + * be reloaded. Use the RGB values instead. + */ +#define BLACK PALINDEX(0) /* 0, 0, 0*/ +#define BLUE PALINDEX(1) +#define GREEN PALINDEX(2) +#define CYAN PALINDEX(3) +#define RED PALINDEX(4) +#define MAGENTA PALINDEX(5) +#define BROWN PALINDEX(6) +#define LTGRAY PALINDEX(7) /* 192, 192, 192*/ +#define GRAY PALINDEX(8) /* 128, 128, 128*/ +#define LTBLUE PALINDEX(9) +#define LTGREEN PALINDEX(10) +#define LTCYAN PALINDEX(11) +#define LTRED PALINDEX(12) +#define LTMAGENTA PALINDEX(13) +#define YELLOW PALINDEX(14) +#define WHITE PALINDEX(15) /* 255, 255, 255*/ +#endif + +/* GdMakePaletteConversionTable bLoadType types*/ +#define LOADPALETTE 1 /* load image palette into system palette*/ +#define MERGEPALETTE 2 /* merge image palette into system palette*/ + +/* entry points*/ + +/* devdraw.c*/ +PSD GdOpenScreen(void); +void GdCloseScreen(PSD psd); +int GdSetPortraitMode(PSD psd, int portraitmode); +int GdSetMode(int mode); +MWBOOL GdSetUseBackground(MWBOOL flag); +MWPIXELVAL GdSetForeground(MWPIXELVAL fg); +MWPIXELVAL GdSetBackground(MWPIXELVAL bg); +void GdResetPalette(void); +void GdSetPalette(PSD psd,int first, int count, MWPALENTRY *palette); +int GdGetPalette(PSD psd,int first, int count, MWPALENTRY *palette); +MWPIXELVAL GdFindColor(MWCOLORVAL c); +MWPIXELVAL GdFindNearestColor(MWPALENTRY *pal, int size, MWCOLORVAL cr); +int GdCaptureScreen(char *path); +void GdGetScreenInfo(PSD psd,PMWSCREENINFO psi); +void GdPoint(PSD psd,MWCOORD x, MWCOORD y); +void GdLine(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2, + MWBOOL bDrawLastPoint); +void GdRect(PSD psd,MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height); +void GdFillRect(PSD psd,MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height); +void GdBitmap(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height, + MWIMAGEBITS *imagebits); +MWBOOL GdColorInPalette(MWCOLORVAL cr,MWPALENTRY *palette,int palsize); +void GdMakePaletteConversionTable(PSD psd,MWPALENTRY *palette,int palsize, + MWPIXELVAL *convtable,int fLoadType); +void GdDrawImage(PSD psd,MWCOORD x, MWCOORD y, PMWIMAGEHDR pimage); +void GdPoly(PSD psd,int count, MWPOINT *points); +void GdFillPoly(PSD psd,int count, MWPOINT *points); +void GdReadArea(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height, + MWPIXELVAL *pixels); +void GdArea(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height, + void *pixels, int pixtype); +void GdTranslateArea(MWCOORD width, MWCOORD height, void *in, int inpixtype, + MWCOORD inpitch, void *out, int outpixtype, int outpitch); +void GdCopyArea(PSD psd,MWCOORD srcx,MWCOORD srcy,MWCOORD width, + MWCOORD height, MWCOORD destx, MWCOORD desty); +void GdBlit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD width, + MWCOORD height,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long rop); +void GdStretchBlit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD dstw, + MWCOORD dsth, PSD srcpsd, MWCOORD srcx, MWCOORD srcy, + MWCOORD srcw, MWCOORD srch, long rop); +int GdCalcMemGCAlloc(PSD psd, unsigned int width, unsigned int height, + int planes, int bpp, int *size, int *linelen); +extern SCREENDEVICE scrdev; + +/* devarc.c*/ +/* requires float*/ +void GdArcAngle(PSD psd, MWCOORD x0, MWCOORD y0, MWCOORD rx, MWCOORD ry, + MWCOORD angle1, MWCOORD angle2, int type); +/* integer only*/ +void GdArc(PSD psd, MWCOORD x0, MWCOORD y0, MWCOORD rx, MWCOORD ry, + MWCOORD ax, MWCOORD ay, MWCOORD bx, MWCOORD by, int type); +void GdEllipse(PSD psd,MWCOORD x, MWCOORD y, MWCOORD rx, MWCOORD ry, + MWBOOL fill); + +/* devfont.c*/ +void GdClearFontList(void); +int GdAddFont(char *fndry, char *family, char *fontname, PMWLOGFONT lf, + unsigned int flags); +PMWFONT GdSetFont(PMWFONT pfont); +PMWFONT GdCreateFont(PSD psd, const char *name, MWCOORD height, + const PMWLOGFONT plogfont); +MWCOORD GdSetFontSize(PMWFONT pfont, MWCOORD fontsize); +void GdGetFontList(MWFONTLIST ***list, int *num); +void GdFreeFontList(MWFONTLIST ***list, int num); +int GdSetFontRotation(PMWFONT pfont, int tenthdegrees); +int GdSetFontAttr(PMWFONT pfont, int setflags, int clrflags); +void GdDestroyFont(PMWFONT pfont); +MWBOOL GdGetFontInfo(PMWFONT pfont, PMWFONTINFO pfontinfo); +int GdConvertEncoding(const void *istr, int iflags, int cc, void *ostr, + int oflags); +void GdGetTextSize(PMWFONT pfont, const void *str, int cc, MWCOORD *pwidth, + MWCOORD *pheight, MWCOORD *pbase, int flags); +int GdGetTextSizeEx(PMWFONT pfont, const void *str, int cc, + int nMaxExtent, int *lpnFit, int *alpDx, MWCOORD *pwidth, + MWCOORD *pheight, MWCOORD *pbase, int flags); +void GdText(PSD psd,MWCOORD x,MWCOORD y,const void *str,int count,int flags); + +/* devclip1.c*/ +void GdSetClipRects(PSD psd,int count,MWCLIPRECT *table); +MWBOOL GdClipPoint(PSD psd,MWCOORD x,MWCOORD y); +int GdClipArea(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2); +extern MWCOORD clipminx, clipminy, clipmaxx, clipmaxy; + +/* devclip2.c*/ +void GdSetClipRegion(PSD psd, MWCLIPREGION *reg); + +/* devrgn.c - multi-rectangle region entry points*/ +MWBOOL GdPtInRegion(MWCLIPREGION *rgn, MWCOORD x, MWCOORD y); +int GdRectInRegion(MWCLIPREGION *rgn, const MWRECT *rect); +MWBOOL GdEqualRegion(MWCLIPREGION *r1, MWCLIPREGION *r2); +MWBOOL GdEmptyRegion(MWCLIPREGION *rgn); +MWCLIPREGION *GdAllocRegion(void); +MWCLIPREGION *GdAllocRectRegion(MWCOORD left,MWCOORD top,MWCOORD right,MWCOORD bottom); +MWCLIPREGION *GdAllocRectRegionIndirect(MWRECT *prc); +void GdSetRectRegion(MWCLIPREGION *rgn, MWCOORD left, MWCOORD top, + MWCOORD right, MWCOORD bottom); +void GdSetRectRegionIndirect(MWCLIPREGION *rgn, MWRECT *prc); +void GdDestroyRegion(MWCLIPREGION *rgn); +void GdOffsetRegion(MWCLIPREGION *rgn, MWCOORD x, MWCOORD y); +int GdGetRegionBox(MWCLIPREGION *rgn, MWRECT *prc); +void GdUnionRectWithRegion(const MWRECT *rect, MWCLIPREGION *rgn); +void GdSubtractRectFromRegion(const MWRECT *rect, MWCLIPREGION *rgn); +void GdCopyRegion(MWCLIPREGION *d, MWCLIPREGION *s); +void GdIntersectRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2); +void GdUnionRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2); +void GdSubtractRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2); +void GdXorRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2); + +/* devrgn2.c*/ +MWCLIPREGION *GdAllocPolygonRegion(MWPOINT *points, int count, int mode); +MWCLIPREGION *GdAllocPolyPolygonRegion(MWPOINT *points, int *count, + int nbpolygons, int mode); + +/* devmouse.c*/ +int GdOpenMouse(void); +void GdCloseMouse(void); +void GdGetButtonInfo(int *buttons); +void GdRestrictMouse(MWCOORD newminx,MWCOORD newminy,MWCOORD newmaxx, + MWCOORD newmaxy); +void GdSetAccelMouse(int newthresh, int newscale); +void GdMoveMouse(MWCOORD newx, MWCOORD newy); +int GdReadMouse(MWCOORD *px, MWCOORD *py, int *pb); +void GdMoveCursor(MWCOORD x, MWCOORD y); +MWBOOL GdGetCursorPos(MWCOORD *px, MWCOORD *py); +void GdSetCursor(PMWCURSOR pcursor); +int GdShowCursor(PSD psd); +int GdHideCursor(PSD psd); +void GdCheckCursor(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2); +void GdFixCursor(PSD psd); +extern MOUSEDEVICE mousedev; + +/* devkbd.c*/ +int GdOpenKeyboard(void); +void GdCloseKeyboard(void); +void GdGetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers); +int GdReadKeyboard(MWKEY *buf, MWKEYMOD *modifiers, MWSCANCODE *scancode); +extern KBDDEVICE kbddev; + +/* devimage.c */ + +int GdLoadImageFromBuffer(PSD psd, void *buffer, int size, int flags); +void GdDrawImageFromBuffer(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, + MWCOORD height, void *buffer, int size, int flags); +void GdDrawImageFromFile(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, + MWCOORD height, char *path, int flags); +int GdLoadImageFromFile(PSD psd, char *path, int flags); +void GdDrawImageToFit(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, + MWCOORD height, int id); +void GdFreeImage(int id); +MWBOOL GdGetImageInfo(int id, PMWIMAGEINFO pii); +void GdStretchImage(PMWIMAGEHDR src, MWCLIPRECT *srcrect, PMWIMAGEHDR dst, + MWCLIPRECT *dstrect); + +/* devlist.c*/ +/* field offset*/ +#define MWITEM_OFFSET(type, field) ((long)&(((type *)0)->field)) + +void * GdItemAlloc(unsigned int size); +void GdListAdd(PMWLISTHEAD pHead,PMWLIST pItem); +void GdListInsert(PMWLISTHEAD pHead,PMWLIST pItem); +void GdListRemove(PMWLISTHEAD pHead,PMWLIST pItem); +#define GdItemNew(type) ((type *)GdItemAlloc(sizeof(type))) +#define GdItemFree(ptr) free((void *)ptr) + +/* return base item address from list ptr*/ +#define GdItemAddr(p,type,list) ((type *)((long)p - MWITEM_OFFSET(type,list))) + +#if UNIX || DOS_DJGPP + +#include + +typedef void (*MWTIMERCB)(void *); + +#define MWTIMER_ONESHOT 0 +#define MWTIMER_PERIODIC 1 + +typedef struct mw_timer MWTIMER; +struct mw_timer { + struct timeval timeout; + MWTIMERCB callback; + void *arg; + MWTIMER *next; + MWTIMER *prev; + int type; /* MWTIMER_ONESHOT or MWTIMER_PERIODIC */ + MWTIMEOUT period; +}; + +MWTIMER *GdAddTimer(MWTIMEOUT timeout, MWTIMERCB callback, void *arg); +MWTIMER *GdAddPeriodicTimer(MWTIMEOUT timeout, MWTIMERCB callback, void *arg); +void GdDestroyTimer(MWTIMER *timer); +MWTIMER *GdFindTimer(void *arg); +MWBOOL GdGetNextTimeout(struct timeval *tv, MWTIMEOUT timeout); +MWBOOL GdTimeout(void); + +#endif + +/* error.c*/ +int GdError(const char *format, ...); +int GdErrorNull(const char *format, ...); /* doesn't print msgs */ + +#ifdef USE_ALLOCA +/* alloca() is available, so use it for better performance */ +#define ALLOCA(size) alloca(size) +#define FREEA(pmem) +#else +/* no alloca(), so use malloc()/free() instead */ +#define ALLOCA(size) malloc(size) +#define FREEA(pmem) free(pmem) +#endif + +/* no assert() in MSDOS or ELKS...*/ +#if MSDOS | ELKS +#undef assert +#define assert(x) +#endif + +/* RTEMS requires rtems_main()*/ +#if __rtems__ +#define main rtems_main +#endif + +#if !_MINIX +#ifndef __rtems__ +#define HAVESELECT 1 /* has select system call*/ +#endif +#endif + +#endif /*_DEVICE_H*/ diff --git a/packages/services/gfx/mw/current/include/microwin/graph3d.h b/packages/services/gfx/mw/current/include/microwin/graph3d.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/graph3d.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1999 Greg Haerr + * + * 3D Graphics Library for Micro-Windows + */ + +#ifndef _GRAPH3D_H_ +#define _GRAPH3D_H_ + +#include + +#define pi 3.1415926535 +#define epsilon 0.000001 +#define MAXPOLY 32 /* max polygon points*/ + +typedef FLOAT vec1; + +typedef struct { + FLOAT x, y; +} vec2; + +typedef struct { + FLOAT x, y, z; +} vec3; + +/* entry points*/ +void init3(HDC hDC,HWND hwndmem); +void paint3(HDC hDC); +void setcolor3(MWCOLORVAL c); +void moveto3(vec2 pt); +void lineto3(vec2 pt); +void polyfill(int n, vec2 points[]); +void square(void); +void circle3(vec1 r); +void daisy(vec1 r,int points); +void rose(vec1 r,int levels,int points); +void triangle(vec2 v0, vec2 v1, vec2 v2); +void quadrilateral(vec2 v0, vec2 v1, vec2 v2, vec2 v3); +void look3(vec1 x, vec1 y, vec1 z); +void drawgrid(vec1 xmin, vec1 xmax, int nx, vec1 zmin, vec1 zmax, int nz); +void scale3(vec1 sx, vec1 sy, vec1 sz, double A[][5]); +void tran3(vec1 tx, vec1 ty, vec1 tz, double A[][5]); +void rot3(int m, vec1 theta, double A[][5]); +void mult3(double A[][5], double B[][5], double C[][5]); +void findQ(void); + +#endif diff --git a/packages/services/gfx/mw/current/include/microwin/mwobjects.h b/packages/services/gfx/mw/current/include/microwin/mwobjects.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/mwobjects.h @@ -0,0 +1,494 @@ +/* + Copyright (C) Chris Johns (ccj@acm.org) + + MicroWindows C++ Wrappers. + + */ + +#if !defined (_MWOBJECTS_H_) +#define _MWOBJECTS_H_ + +extern "C" +{ +#include "windows.h" +#include "wintern.h" +#include "graph3d.h" +}; + +#include +#include + +namespace MicroWindowsObjects +{ + class FileDescriptor; + + // + // Manage Window Classes. Notice you do not need to specify + // a Window Procedure function pointer. This is handled for + // you. + // + + class WindowClass + { + public: + + WindowClass (); + WindowClass (LPCSTR lpszClassName, + UINT style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW, + int cbClsExtra = 0, + int cbWndExtra = 0, + HINSTANCE hInstance = 0, + HICON hIcon = 0, + HCURSOR hCursor = 0, + HBRUSH hbrBackground = 0, + LPCSTR lpszMenuName = 0); + + void set_style (UINT style) + { wclass.style = style; } + + void set_class_extra (int cbClsExtra) + { wclass.cbClsExtra = cbClsExtra; } + + void set_window_extra (int cbWndExtra) + { wclass.cbWndExtra = cbWndExtra; } + + void set_instance (HINSTANCE hInstance) + { wclass.hInstance = hInstance; } + + void set_icon (HICON hIcon) + { wclass.hIcon = hIcon; } + + void set_cursor (HCURSOR hCursor) + { wclass.hCursor = hCursor; } + + void set_background (HBRUSH hbrBackground) + { wclass.hbrBackground = hbrBackground; } + + void set_menu_name (LPCSTR lpszMenuName) + { wclass.lpszMenuName = lpszMenuName; } + + ATOM register_class (); + + private: + + // + // This variable is a local copy which is + // registered. After that is class does little. + // + + WNDCLASS wclass; + }; + + class Window + { + friend WindowClass; + + public: + + Window (); + Window (DWORD dwExStyle, + LPCSTR lpClassName, + LPCSTR lpWindowName, + DWORD dwStyle, + int x, + int y, + int nWidth, + int nHeight, + HWND hwndParent, + HMENU hMenu, + HINSTANCE hInstance, + LPVOID lpParam); + + virtual ~Window (); + + HWND create (DWORD dwExStyle, + LPCSTR lpClassName, + LPCSTR lpWindowName, + DWORD dwStyle, + int x, + int y, + int nWidth, + int nHeight, + HWND hwndParent, + HMENU hMenu, + HINSTANCE hInstance, + LPVOID lpParam); + + BOOL destory (); + + HWND get_handle () const + { return hwnd; } + operator HWND () const + { return get_handle (); } + + BOOL is_visible () + { return IsWindowVisible (hwnd); } + BOOL show (int nCmdShow) + { return ::ShowWindow (hwnd, nCmdShow); } + BOOL update () + { return ::UpdateWindow (hwnd); } + BOOL invalidate_rect (CONST RECT *lpRect, BOOL bErase) + { return ::InvalidateRect (hwnd, lpRect, bErase); } + + HWND get_focus () + { return ::GetFocus (); } + HWND set_focus () + { return ::SetFocus (hwnd); } + + BOOL move (int x, int y, int nWidth, int nHeight, BOOL bRepaint) + { return MoveWindow (hwnd, x, y, nWidth, nHeight, bRepaint); } + + // FIXME: Should these be here ? + BOOL client_to_screen (LPPOINT lpPoint) + { return ::ClientToScreen (hwnd, lpPoint); } + BOOL screen_to_client (LPPOINT lpPoint) + { return ::ClientToScreen (hwnd, lpPoint); } + + LONG get_long (int nIndex) + { return ::GetWindowLong (hwnd, nIndex); } + LONG set_long (int nIndex, LONG wNewLong) + { return ::SetWindowWord (hwnd, nIndex, wNewLong); } + WORD get_word (int nIndex) + { return ::GetWindowWord (hwnd, nIndex); } + WORD set_word (int nIndex, WORD wNewWord) + { return ::SetWindowWord (hwnd, nIndex, wNewWord); } + + DWORD get_class_long (int nIndex) + { return ::GetClassLong (hwnd, nIndex); } + + int get_text (LPSTR lpString, int nMaxCount) + { return GetWindowText (hwnd, lpString, nMaxCount); } + BOOL set_text (LPCSTR lpString) + { return SetWindowText (hwnd, lpString); } + + // + // File Descriptor handlers. + // + + virtual bool attach (const int fd, FileDescriptor& file_descriptor); + virtual bool detach (FileDescriptor& file_descriptor); + + protected: + + // + // The message handler. Insure you call this class's default + // handler for default message handling so any special + // filtering can occur. + // + + virtual LRESULT message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam); + + private: + + // + // We only need one WndProc. + // + + static LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); + + HWND hwnd; + LPVOID lpCreateParams; + + // + // Set of FileDescriptor objects + // + + struct ltint + { + bool operator() (const FileDescriptor* f1, const FileDescriptor* f2) const; + }; + + set file_descriptors; + + }; + + class Rect + { + public: + + Rect () + { empty (); } + Rect (int xLeft, int yTop, int xRight, int yBottom) + { set (xLeft, yTop, xRight, yBottom); } + Rect (HWND hwnd) + { get_window (hwnd); } + + BOOL get_window (HWND hwnd) + { return GetWindowRect (hwnd, &rect); } + BOOL get_client (HWND hwnd) + { return GetClientRect (hwnd, &rect); } + + BOOL set (int xLeft, int yTop, int xRight, int yBottom) + { return ::SetRect (&rect, xLeft, yTop, xRight, yBottom); } + + BOOL empty () + { return ::SetRectEmpty (&rect); } + + Rect& operator= (const Rect& other) + { CopyRect (&rect, &other.rect); return *this; } + + operator bool () const + { return ::IsRectEmpty (&rect); } + + operator RECT* () + { return ▭ } + + BOOL copy (LPRECT lpRectDst) + { return ::CopyRect (lpRectDst, &rect); } + + BOOL inflate (int dx, int dy) + { return ::InflateRect (&rect, dx, dy); } + + BOOL offset (int dx, int dy) + { return ::OffsetRect (&rect, dx, dy); } + + BOOL point_inside (POINT Point) + { return PtInRect (&rect, Point); } + + MWCOORD left () const + { return rect.left; } + MWCOORD top () const + { return rect.top; } + MWCOORD right () const + { return rect.right; } + MWCOORD bottom () const + { return rect.bottom; } + + private: + + RECT rect; + }; + + inline ostream& operator<< (ostream& s, const Rect& r) { + s << "rect" + << "(l=" << r.left () << ",t=" << r.top () + << ",r=" << r.right () << ",b=" << r.bottom () + << ")"; + return s; + } + + // + // Generic Paint class. Try to help the paint message. + // + + class Paint + { + public: + + enum { TEXT_BUF_SIZE = 512 }; + + Paint (HWND hwnd); + Paint (HWND hwnd, LPARAM lpParam); + virtual ~Paint (); + + // + // These begin and end a paint session. + // + + void begin (bool init_3d = false, bool draw_3d_in_memory = false); + void end (); + + // + // Aspects of the client paint area under our control. + // + + operator HWND () + { return hwnd; } + operator RECT* () + { return r; } + operator HDC () + { return hdc; } + operator PAINTSTRUCT* () + { return &ps; } + operator POINT* () + { return &pt; } + + GDICOORD get_point_x () const + { return pt.x; } + GDICOORD get_point_y () const + { return pt.y; } + + MWCOORD left () const + { return r.left (); } + MWCOORD top () const + { return r.top (); } + MWCOORD right () const + { return r.right (); } + MWCOORD bottom () const + { return r.bottom (); } + + // + // Colour Control. + // + + DWORD get_system_colour (int nIndex) + { return ::GetSysColor (nIndex); } + + // + // Pixel, line and rectange draw support. + // + + COLORREF set_pixel (int x, int y, COLORREF crColour) + { return ::SetPixel (hdc, x, y, crColour); } + + BOOL move_to (int x, int y) + { return ::MoveToEx (hdc, x, y, 0); } + + BOOL line_to (int x, int y) + { return ::LineTo (hdc, x, y); } + + BOOL line_to (int x1, int y1, int x2, int y2) + { if (!move_to (x1, y1)) return FALSE; + return line_to (x2, y2); } + + BOOL rectangle (int x1, int y1, int x2, int y2) + { return ::Rectangle (hdc, x1, y1, x2, y2); } + + BOOL fill_rectangle (int x1, int y1, int x2, int y2, HBRUSH hbr) + { Rect r (x1, y1, x2, y2); + return ::FillRect (hdc, r, hbr); } + + // + // Paint any 3d objects. + // + + void initialise_3d (bool draw_3d_in_mem) + { if (!draw_3d) { + draw_3d = true; ::init3 (hdc, draw_3d_in_mem ? hwnd : 0); } } + void paint_3d () + { if (draw_3d) { ::paint3 (hdc); draw_3d = false; } } + + // + // Text Output. + // + + void set_text_fromat (UINT uFormat) + { text_format = uFormat; } + + int text_out (int x, int y, const char *format, ...); + + private: + + HWND hwnd; + bool draw_3d; + bool drawing; + Rect r; + HDC hdc; + PAINTSTRUCT ps; + POINT pt; + UINT text_format; + + char format_buf[TEXT_BUF_SIZE]; + + }; + + // + // FileDescriptor handles fd event from the User Registered File + // Descriptor support. + // + + class FileDescriptor + { + friend class Window; + + public: + + FileDescriptor (); + virtual ~FileDescriptor (); + + // + // Enable/disable controls. + // + + bool enable_read (); + bool disable_read (); + bool read_enabled () const + { return read_is_enabled; } + + bool enable_write (); + bool disable_write (); + bool write_enabled () const + { return write_is_enabled; } + + bool enable_except (); + bool disable_except (); + bool except_enabled () const + { return except_is_enabled; } + + int fd () const + { return file_desc; } + + operator int () const + { return fd (); } + + const Window *get_window () const + { return window; } + + protected: + + // + // These are called in responce to user fd messages to the window. + // + + virtual LRESULT read (); + virtual LRESULT write (); + virtual LRESULT except (); + + private: + + int file_desc; + bool read_is_enabled; + bool write_is_enabled; + bool except_is_enabled; + Window *window; + + }; + + class Application + { + public: + + Application (); + Application (MWIMAGEHDR& background); + virtual ~Application (); + + HINSTANCE instance () const + { return app_instance; } + + HINSTANCE prev_instance () const + { return app_prev_instance; } + + LPSTR cmd_line () const + { return app_cmd_line; } + + int show_cmd () + { return app_show_cmd; } + + // + // This is called the public C linkage WinMain. Do not call. + // + + static int WINAPI WinMain (HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nShowCmd); + protected: + + virtual int initialise (); + virtual int shutdown (); + + private: + + MWIMAGEHDR *background; + HINSTANCE app_instance; + HINSTANCE app_prev_instance; + LPSTR app_cmd_line; + int app_show_cmd; + + }; +} + +#endif + diff --git a/packages/services/gfx/mw/current/include/microwin/mwtypes.h b/packages/services/gfx/mw/current/include/microwin/mwtypes.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/mwtypes.h @@ -0,0 +1,664 @@ +#ifndef _MWTYPES_H +#define _MWTYPES_H +/* + * Copyright (c) 1999, 2000, 2001 Greg Haerr + * + * Exported Microwindows engine typedefs and defines + */ +#define MWPACKED __attribute__ ((aligned(1), packed)) + +/* builtin font std names*/ +#define MWFONT_SYSTEM_VAR "System" /* winSystem 14x16 (ansi)*/ +#define MWFONT_GUI_VAR "Helvetica" /* winMSSansSerif 11x13 (ansi)*/ +#define MWFONT_OEM_FIXED "Terminal" /* rom8x16 (oem)*/ +#define MWFONT_SYSTEM_FIXED "SystemFixed" /* X6x13 (should be ansi)*/ + +/* Text/GetTextSize encoding flags*/ +#define MWTF_ASCII 0x0000 /* 8 bit packing, ascii*/ +#define MWTF_UTF8 0x0001 /* 8 bit packing, utf8*/ +#define MWTF_UC16 0x0002 /* 16 bit packing, unicode 16*/ +#define MWTF_UC32 0x0004 /* 32 bit packing, unicode 32*/ +#define MWTF_PACKMASK 0x0007 /* packing mask*/ + +/* Text alignment flags*/ +#define MWTF_TOP 0x0010 /* align on top*/ +#define MWTF_BASELINE 0x0020 /* align on baseline*/ +#define MWTF_BOTTOM 0x0040 /* align on bottom*/ + +/* SetFontAttr flags*/ +#define MWTF_KERNING 0x1000 /* font kerning*/ +#define MWTF_ANTIALIAS 0x2000 /* antialiased output*/ +#define MWTF_UNDERLINE 0x4000 /* draw underline*/ + +/* Drawing modes*/ +#define MWMODE_COPY 0 /* src*/ +#define MWMODE_XOR 1 /* src ^ dst*/ +#define MWMODE_OR 2 /* src | dst*/ +#define MWMODE_AND 3 /* src & dst*/ +#define MWMODE_CLEAR 4 /* 0*/ +#define MWMODE_SETTO1 5 /* 11111111*/ /* obsolete name, will be MWMODE_SET*/ +#define MWMODE_EQUIV 6 /* ~(src ^ dst)*/ +#define MWMODE_NOR 7 /* ~(src | dst)*/ +#define MWMODE_NAND 8 /* ~(src & dst)*/ +#define MWMODE_INVERT 9 /* ~dst*/ +#define MWMODE_COPYINVERTED 10 /* ~src*/ +#define MWMODE_ORINVERTED 11 /* ~src | dst*/ +#define MWMODE_ANDINVERTED 12 /* ~src & dst*/ +#define MWMODE_ORREVERSE 13 /* src | ~dst*/ +#define MWMODE_ANDREVERSE 14 /* src & ~dst*/ +#define MWMODE_NOOP 15 /* dst*/ +#define MWMODE_MAX 15 + +/* Mouse button bits*/ +#define MWBUTTON_L 04 +#define MWBUTTON_M 02 +#define MWBUTTON_R 01 + +/* Color defines*/ +#define MWRGB(r,g,b) ((MWCOLORVAL)(((unsigned char)(r)|\ + ((unsigned short)((unsigned char)(g))<<8))|\ + (((unsigned long)(unsigned char)(b))<<16))) +#define MWF_PALINDEX 0x01000000 +#define MWPALINDEX(x) ((MWCOLORVAL)MWF_PALINDEX | (x)) + +/* + * ROP blitter opcodes (extensions < 0x10000000 are MWMODE_xxx blit ops) + */ +#define MWROP_EXTENSION 0xff000000L /* rop extension bits*/ + +/* copy src -> dst except for transparent color in src*/ +#define MWROP_SRCTRANSCOPY 0x11000000L + +/* alpha blend src -> dst with constant alpha, alpha value in low 8 bits*/ +#define MWROP_BLENDCONSTANT 0x12000000L + +/* alpha blend fg/bg color -> dst with src as alpha channel*/ +#define MWROP_BLENDFGBG 0x13000000L + +/* alpha blend src -> dst with separate per pixel alpha channel*/ +#define MWROP_BLENDCHANNEL 0x14000000L + +/* stretch src -> dst*/ +#define MWROP_STRETCH 0x15000000L + +/* blits rops based on src/dst binary operations*/ +#define MWROP_COPY (MWMODE_COPY << 24L) +#define MWROP_XOR (MWMODE_XOR << 24L) +#define MWROP_OR (MWMODE_OR << 24L) +#define MWROP_AND (MWMODE_AND << 24L) +#define MWROP_CLEAR (MWMODE_CLEAR << 24L) +#define MWROP_SET (MWMODE_SETTO1 << 24L) +#define MWROP_EQUIV (MWMODE_EQUIV << 24L) +#define MWROP_NOR (MWMODE_NOR << 24L) +#define MWROP_NAND (MWMODE_NAND << 24L) +#define MWROP_INVERT (MWMODE_INVERT << 24L) +#define MWROP_COPYINVERTED (MWMODE_COPYINVERTED << 24L) +#define MWROP_ORINVERTED (MWMODE_ORINVERTED << 24L) +#define MWROP_ANDINVERTED (MWMODE_ANDINVERTED << 24L) +#define MWROP_ORREVERSE (MWMODE_ORREVERSE << 24L) +#define MWROP_ANDREVERSE (MWMODE_ANDREVERSE << 24L) +#define MWROP_NOOP (MWMODE_NOOP << 24L) + +#define MWROP_SRCCOPY MWROP_COPY /* obsolete*/ +#define MWROP_SRCAND MWROP_AND /* obsolete*/ +#define MWROP_SRCINVERT MWROP_XOR /* obsolete*/ +#define MWROP_BLACKNESS MWROP_CLEAR /* obsolete*/ + +/* convert an MWROP to drawing mode MWMODE value*/ +#define MWROP_TO_MODE(op) ((op) >> 24) + +/* + * Pixel formats + * Note the two pseudo pixel formats are never returned by display drivers, + * but rather used as a data structure type in GrArea. The other + * types are both returned by display drivers and used as pixel packing + * specifiers. + */ +#define MWPF_RGB 0 /* pseudo, convert from packed 32 bit RGB*/ +#define MWPF_PIXELVAL 1 /* pseudo, no convert from packed PIXELVAL*/ +#define MWPF_PALETTE 2 /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +#define MWPF_TRUECOLOR0888 3 /* pixel is packed 32 bits 8/8/8 truecolor*/ +#define MWPF_TRUECOLOR888 4 /* pixel is packed 24 bits 8/8/8 truecolor*/ +#define MWPF_TRUECOLOR565 5 /* pixel is packed 16 bits 5/6/5 truecolor*/ +#define MWPF_TRUECOLOR555 6 /* pixel is packed 16 bits 5/5/5 truecolor*/ +#define MWPF_TRUECOLOR332 7 /* pixel is packed 8 bits 3/3/2 truecolor*/ + +/* + * MWPIXELVAL definition: changes based on target system + * Set using -DMWPIXEL_FORMAT=MWPF_XXX + * + * For the Nano-X server, it is important to use the correct MWPF_* value + * for the MWPIXEL_FORMAT macro in order to match the hardware, + * while the Nano-X clients that includes this file can get away with + * a default pixel format of 24-bit color as the client will either: + * 1) Use the MWPF_PIXELVAL native format when calling GrReadArea, in + * which case we have to have enough spare room to hold 32-bit + * pixlevalues (hence the default MWPF_TRUECOLOR0888 format), or + * 2) Will use some other PF_* format, in which case the application + * is well aware of which pixel-format it uses and can avoid the + * device specific RGB2PIXEL and use RGB2PIXEL565 etc. instead, + * and specifiy the pixel fomar as MWPF_TRUECOLOR565 etc. when + * calling the GrArea function(s). + */ +#ifndef MWPIXEL_FORMAT +#define MWPIXEL_FORMAT MWPF_TRUECOLOR0888 +#endif + +#if defined(__AS386_16__) +/* Force 8 bit palettized display for ELKS*/ +#undef MWPIXEL_FORMAT +#define MWPIXEL_FORMAT MWPF_PALETTE +#endif + +#if (MWPIXEL_FORMAT == MWPF_TRUECOLOR565) || (MWPIXEL_FORMAT == MWPF_TRUECOLOR555) +typedef unsigned short MWPIXELVAL; +#else + #if MWPIXEL_FORMAT == MWPF_TRUECOLOR332 + typedef unsigned char MWPIXELVAL; + #else + #if MWPIXEL_FORMAT == MWPF_PALETTE + typedef unsigned char MWPIXELVAL; + #else + typedef unsigned long MWPIXELVAL; + #endif + #endif +#endif + +/* portrait modes*/ +#define MWPORTRAIT_NONE 0x00 /* hw framebuffer, no rotation*/ +#define MWPORTRAIT_LEFT 0x01 /* rotate left*/ +#define MWPORTRAIT_RIGHT 0x02 /* rotate right*/ +#define MWPORTRAIT_DOWN 0x04 /* upside down*/ + +/* + * Type definitions + */ +typedef int MWCOORD; /* device coordinates*/ +typedef int MWBOOL; /* boolean value*/ +typedef unsigned char MWUCHAR; /* unsigned char*/ +typedef unsigned long MWCOLORVAL; /* device-independent color value*/ +typedef unsigned short MWIMAGEBITS; /* bitmap image unit size*/ +typedef unsigned long MWTIMEOUT; /* timeout value */ + +/* dbl linked list data structure*/ +typedef struct _mwlist { /* LIST must be first decl in struct*/ + struct _mwlist *next; /* next item*/ + struct _mwlist *prev; /* previous item*/ +} MWLIST, *PMWLIST; + +/* dbl linked list head data structure*/ +typedef struct _mwlisthead { + struct _mwlist *head; /* first item*/ + struct _mwlist *tail; /* last item*/ +} MWLISTHEAD, *PMWLISTHEAD; + +/* Keyboard state modifiers*/ +typedef unsigned int MWKEYMOD; + +/* GetScreenInfo structure*/ +typedef struct { + MWCOORD rows; /* number of rows on screen */ + MWCOORD cols; /* number of columns on screen */ + int xdpcm; /* dots/centimeter in x direction */ + int ydpcm; /* dots/centimeter in y direction */ + int planes; /* hw # planes*/ + int bpp; /* hw bpp*/ + long ncolors; /* hw number of colors supported*/ + int fonts; /* number of built-in fonts */ + int buttons; /* buttons which are implemented */ + MWKEYMOD modifiers; /* modifiers which are implemented */ + int pixtype; /* format of pixel value*/ + int portrait; /* current portrait mode*/ + MWBOOL fbdriver; /* true if running mwin fb screen driver*/ + unsigned long rmask; /* red mask bits in pixel*/ + unsigned long gmask; /* green mask bits in pixel*/ + unsigned long bmask; /* blue mask bits in pixel*/ + MWCOORD xpos; /* current x mouse position*/ + MWCOORD ypos; /* current y mouse position*/ + +/* items below are get/set by the window manager and not used internally*/ + int vs_width; /* virtual screen width/height*/ + int vs_height; + int ws_width; /* workspace width/height*/ + int ws_height; +} MWSCREENINFO, *PMWSCREENINFO; + +/* client side window framebuffer info*/ +typedef struct { + unsigned char * physpixels; /* address of real framebuffer*/ + /* note winpixels is only correct in non-portrait modes*/ + unsigned char * winpixels; /* address of 0,0 this window in fb*/ + int pixtype; /* MWPF_ pixel type*/ + int bpp; /* bits per pixel*/ + int bytespp; /* bytes per pixel*/ + int pitch; /* bytes per scan line for window (=fb pitch)*/ + int x, y; /* absolute virtual window coordinates*/ + int portrait_mode; /* current portrait mode*/ + MWCOORD xres; /* real framebuffer resolution*/ + MWCOORD yres; + MWCOORD xvirtres; /* virtual framebuffer resolution*/ + MWCOORD yvirtres; +} MWWINDOWFBINFO; + +/* GetFontInfo structure*/ +typedef struct { + int maxwidth; /* maximum width of any char */ + int height; /* height of font in pixels*/ + int baseline; /* baseline (ascent) of font */ + int firstchar; /* first character in font*/ + int lastchar; /* last character in font*/ + MWBOOL fixed; /* TRUE if font is fixed width */ + MWUCHAR widths[256]; /* table of character widths */ +} MWFONTINFO, *PMWFONTINFO; + +/* GetFontList structure */ +typedef struct { + char *ttname; /* TrueType name, eg "Times New Roman Bold" */ + char *mwname; /* microwin name, eg "timesb" */ +} MWFONTLIST, *PMWFONTLIST; + +/* logical font descriptor*/ + +/* font classes - used internally*/ +#define MWLF_CLASS_BUILTIN 1 /* Builtin fonts (bitmaps) */ +#define MWLF_CLASS_FREETYPE 2 /* FreeType fonts in TT format */ +#define MWLF_CLASS_T1LIB 3 /* T1LIB outlined Adobe Type 1 fonts */ +#define MWLF_CLASS_ANY 4 /* Any font*/ + +#define MWLF_FACESIZE 64 /* max facename size*/ + +/* font type selection - lfOutPrecision*/ +#define MWLF_TYPE_DEFAULT 0 /* any font*/ +#define MWLF_TYPE_SCALED 4 /* outlined font (tt or adobe)*/ +#define MWLF_TYPE_RASTER 5 /* raster only*/ +#define MWLF_TYPE_TRUETYPE 7 /* truetype only*/ +#define MWLF_TYPE_ADOBE 10 /* adobe type 1 only*/ + +/* font weights - lfWeight*/ +#define MWLF_WEIGHT_DEFAULT 0 /* any weight*/ +#define MWLF_WEIGHT_THIN 100 /* thin*/ +#define MWLF_WEIGHT_EXTRALIGHT 200 +#define MWLF_WEIGHT_LIGHT 300 /* light */ +#define MWLF_WEIGHT_NORMAL 400 /* regular*/ +#define MWLF_WEIGHT_REGULAR 400 +#define MWLF_WEIGHT_MEDIUM 500 /* medium */ +#define MWLF_WEIGHT_DEMIBOLD 600 +#define MWLF_WEIGHT_BOLD 700 /* bold*/ +#define MWLF_WEIGTH_EXTRABOLD 800 +#define MWLF_WEIGHT_BLACK 900 /* black */ + +/* font charset - lfCharSet*/ +#define MWLF_CHARSET_ANSI 0 /* win32 ansi*/ +#define MWLF_CHARSET_DEFAULT 1 /* any charset*/ +#define MWLF_CHARSET_UNICODE 254 /* unicode*/ +#define MWLF_CHARSET_OEM 255 /* local hw*/ + +/* font pitch - lfPitch */ +#define MWLF_PITCH_DEFAULT 0 /* any pitch */ +#define MWLF_PITCH_ULTRACONDENSED 10 +#define MWLF_PITCH_EXTRACONDENSED 20 +#define MWLF_PITCH_CONDENSED 30 +#define MWLF_PITCH_SEMICONDENSED 40 +#define MWLF_PITCH_NORMAL 50 +#define MWLF_PITCH_SEMIEXPANDED 60 +#define MWLF_PITCH_EXPANDED 70 +#define MWLF_PITCH_EXTRAEXPANDED 80 +#define MWLF_PITCH_ULTRAEXPANDED 90 + +/* flags for the GdAddFont function */ +#define MWLF_FLAGS_ALIAS 1 + +typedef struct { + long lfHeight; /* desired height in pixels*/ + long lfWidth; /* desired width in pixels or 0*/ + long lfEscapement; /* rotation in tenths of degree*/ + long lfOrientation; /* not used*/ + long lfWeight; /* font weight*/ + MWUCHAR lfItalic; /* =1 for italic */ + MWUCHAR lfUnderline; /* =1 for underline */ + MWUCHAR lfStrikeOut; /* not used*/ + MWUCHAR lfCharSet; /* font character set*/ + MWUCHAR lfOutPrecision; /* font type selection*/ + MWUCHAR lfClipPrecision; /* not used*/ + MWUCHAR lfQuality; /* not used*/ + + /* the following differs from windows font model*/ + MWUCHAR lfRoman; /* =1 for Roman letters (upright) */ + MWUCHAR lfSerif; /* =1 for Serifed font */ + MWUCHAR lfSansSerif; /* =1 for Sans-serif font */ + MWUCHAR lfModern; /* =1 for Modern font */ + MWUCHAR lfMonospace; /* =1 for Monospaced font */ + MWUCHAR lfProportional; /* =1 for Proportional font */ + MWUCHAR lfOblique; /* =1 for Oblique (kind of Italic) */ + MWUCHAR lfSmallCaps; /* =1 for small caps */ + MWUCHAR lfPitch; /* font pitch (width) */ + + char lfFaceName[MWLF_FACESIZE]; /* font name, may be aliased*/ +} MWLOGFONT, *PMWLOGFONT; + +/* + * Macros to initialize the MWLOGFONT structure to the most common defaults + * needed by application programs and the nano-X server program. + */ + +#define MWLF_Clear(lf) \ + do { \ + (lf)->lfHeight = 0; \ + (lf)->lfWidth = 0; \ + (lf)->lfEscapement = 0; \ + (lf)->lfOrientation = 0; \ + (lf)->lfWeight = MWLF_WEIGHT_REGULAR; \ + (lf)->lfPitch = 0; \ + (lf)->lfItalic = 0; \ + (lf)->lfOblique = 0; \ + (lf)->lfRoman = 0; \ + (lf)->lfSerif = 0; \ + (lf)->lfSansSerif = 0; \ + (lf)->lfModern = 0; \ + (lf)->lfMonospace = 0; \ + (lf)->lfProportional = 0; \ + (lf)->lfSmallCaps = 0; \ + (lf)->lfUnderline = 0; \ + (lf)->lfStrikeOut = 0; \ + (lf)->lfCharSet = 0; \ + (lf)->lfOutPrecision = 0; \ + (lf)->lfClipPrecision = 0; \ + (lf)->lfQuality = 0; \ + (lf)->lfFaceName[0] = '\0'; \ + } while (0) + +#define MWLF_SetBold(lf) \ + do { \ + (lf)->lfWeight = MWLF_WEIGHT_BOLD; \ + } while (0) + +#define MWLF_SetRegular(lf) \ + do { \ + (lf)->lfWeight = MWLF_WEIGHT_REGULAR; \ + } while (0) + +#define MWLF_SetItalics(lf) \ + do { \ + (lf)->lfItalic = 1; \ + (lf)->lfOblique = 0; \ + (lf)->lfRoman = 0; \ + } while (0) + +#define MWLF_SetRoman(lf) \ + do { \ + (lf)->lfItalic = 0; \ + (lf)->lfOblique = 0; \ + (lf)->lfRoman = 1; \ + } while (0) + +/* + * Rectangle and point structures. + * These structures are "inherited" in wingdi.h for + * the Win32 RECT and POINT structures, so they must match + * Microsoft's definition. + */ + +/* MWPOINT used in GdPoly, GdFillPoly*/ +typedef struct { + MWCOORD x; + MWCOORD y; +} MWPOINT; + +/* MWRECT used in region routines*/ +typedef struct { + MWCOORD left; + MWCOORD top; + MWCOORD right; + MWCOORD bottom; +} MWRECT; + +/* dynamically allocated multi-rectangle clipping region*/ +typedef struct { + int size; /* malloc'd # of rectangles*/ + int numRects; /* # rectangles in use*/ + int type; /* region type*/ + MWRECT *rects; /* rectangle array*/ + MWRECT extents; /* bounding box of region*/ +} MWCLIPREGION; + +/* region types */ +#define MWREGION_ERROR 0 +#define MWREGION_NULL 1 +#define MWREGION_SIMPLE 2 +#define MWREGION_COMPLEX 3 + +/* GdRectInRegion return codes*/ +#define MWRECT_OUT 0 /* rectangle not in region*/ +#define MWRECT_ALLIN 1 /* rectangle all in region*/ +#define MWRECT_PARTIN 2 /* rectangle partly in region*/ + +/* GdAllocPolyRegion types*/ +#define MWPOLY_EVENODD 1 +#define MWPOLY_WINDING 2 + +/* In-core color palette structure*/ +typedef struct { + MWUCHAR r; + MWUCHAR g; + MWUCHAR b; +} MWPALENTRY; + +/* In-core mono and color image structure*/ +#define MWIMAGE_UPSIDEDOWN 01 /* compression flag: upside down image*/ +#define MWIMAGE_BGR 00 /* compression flag: BGR byte order*/ +#define MWIMAGE_RGB 02 /* compression flag: RGB not BGR bytes*/ + +typedef struct { + int width; /* image width in pixels*/ + int height; /* image height in pixels*/ + int planes; /* # image planes*/ + int bpp; /* bits per pixel (1, 4 or 8)*/ + int pitch; /* bytes per line*/ + int bytesperpixel; /* bytes per pixel*/ + int compression; /* compression algorithm*/ + int palsize; /* palette size*/ + long transcolor; /* transparent color or -1 if none*/ + MWPALENTRY * palette; /* palette*/ + MWUCHAR * imagebits; /* image bits (dword right aligned)*/ +} MWIMAGEHDR, *PMWIMAGEHDR; + +/* image information structure - returned by GdGetImageInfo*/ +typedef struct { + int id; /* image id*/ + int width; /* image width in pixels*/ + int height; /* image height in pixels*/ + int planes; /* # image planes*/ + int bpp; /* bits per pixel (1, 4 or 8)*/ + int pitch; /* bytes per line*/ + int bytesperpixel; /* bytes per pixel*/ + int compression; /* compression algorithm*/ + int palsize; /* palette size*/ + MWPALENTRY palette[256]; /* palette*/ +} MWIMAGEINFO, *PMWIMAGEINFO; + +#define MWMAX_CURSOR_SIZE 16 /* maximum cursor x and y size*/ + +/* In-core software cursor structure*/ +typedef struct { + int width; /* cursor width in pixels*/ + int height; /* cursor height in pixels*/ + MWCOORD hotx; /* relative x pos of hot spot*/ + MWCOORD hoty; /* relative y pos of hot spot*/ + MWCOLORVAL fgcolor; /* foreground color*/ + MWCOLORVAL bgcolor; /* background color*/ + MWIMAGEBITS image[MWMAX_CURSOR_SIZE];/* cursor image bits*/ + MWIMAGEBITS mask[MWMAX_CURSOR_SIZE];/* cursor mask bits*/ +} MWCURSOR, *PMWCURSOR; + +typedef struct _mwfont * PMWFONT; + +/* outline and filled arc and pie types*/ +#define MWARC 0x0001 /* arc*/ +#define MWOUTLINE 0x0002 +#define MWARCOUTLINE 0x0003 /* arc + outline*/ +#define MWPIE 0x0004 /* pie (filled)*/ +#define MWELLIPSE 0x0008 /* ellipse outline*/ +#define MWELLIPSEFILL 0x0010 /* ellipse filled*/ + +#ifdef MWINCLUDECOLORS +/* + * Common colors - note any color including these may not be + * available on palettized systems, and the system will + * then use the nearest color already in the system palette, + * or allocate a new color entry. + * These colors are the first 16 entries in the std palette, + * and are written to the system palette if writable. + */ +#define BLACK MWRGB( 0 , 0 , 0 ) +#define BLUE MWRGB( 0 , 0 , 128 ) +#define GREEN MWRGB( 0 , 128, 0 ) +#define CYAN MWRGB( 0 , 128, 128 ) +#define RED MWRGB( 128, 0 , 0 ) +#define MAGENTA MWRGB( 128, 0 , 128 ) +#define BROWN MWRGB( 128, 64 , 0 ) +#define LTGRAY MWRGB( 192, 192, 192 ) +#define GRAY MWRGB( 128, 128, 128 ) +#define LTBLUE MWRGB( 0 , 0 , 255 ) +#define LTGREEN MWRGB( 0 , 255, 0 ) +#define LTCYAN MWRGB( 0 , 255, 255 ) +#define LTRED MWRGB( 255, 0 , 0 ) +#define LTMAGENTA MWRGB( 255, 0 , 255 ) +#define YELLOW MWRGB( 255, 255, 0 ) +#define WHITE MWRGB( 255, 255, 255 ) + +/* other common colors*/ +#define DKGRAY MWRGB( 32, 32, 32) +#endif /* MWINCLUDECOLORS*/ + +/* Keyboard values*/ +typedef unsigned short MWKEY; +typedef unsigned char MWSCANCODE; + +#define MWKEY_UNKNOWN 0 +/* Following special control keysyms are mapped to ASCII*/ +#define MWKEY_BACKSPACE 8 +#define MWKEY_TAB 9 +#define MWKEY_ENTER 13 +#define MWKEY_ESCAPE 27 +/* Keysyms from 32-126 are mapped to ASCII*/ + +#define MWKEY_NONASCII_MASK 0xFF00 +/* Following keysyms are mapped to private use portion of Unicode-16*/ +/* arrows + home/end pad*/ +#define MWKEY_FIRST 0xF800 +#define MWKEY_LEFT 0xF800 +#define MWKEY_RIGHT 0xF801 +#define MWKEY_UP 0xF802 +#define MWKEY_DOWN 0xF803 +#define MWKEY_INSERT 0xF804 +#define MWKEY_DELETE 0xF805 +#define MWKEY_HOME 0xF806 +#define MWKEY_END 0xF807 +#define MWKEY_PAGEUP 0xF808 +#define MWKEY_PAGEDOWN 0xF809 + +/* Numeric keypad*/ +#define MWKEY_KP0 0xF80A +#define MWKEY_KP1 0xF80B +#define MWKEY_KP2 0xF80C +#define MWKEY_KP3 0xF80D +#define MWKEY_KP4 0xF80E +#define MWKEY_KP5 0xF80F +#define MWKEY_KP6 0xF810 +#define MWKEY_KP7 0xF811 +#define MWKEY_KP8 0xF812 +#define MWKEY_KP9 0xF813 +#define MWKEY_KP_PERIOD 0xF814 +#define MWKEY_KP_DIVIDE 0xF815 +#define MWKEY_KP_MULTIPLY 0xF816 +#define MWKEY_KP_MINUS 0xF817 +#define MWKEY_KP_PLUS 0xF818 +#define MWKEY_KP_ENTER 0xF819 +#define MWKEY_KP_EQUALS 0xF81A + +/* Function keys */ +#define MWKEY_F1 0xF81B +#define MWKEY_F2 0xF81C +#define MWKEY_F3 0xF81D +#define MWKEY_F4 0xF81E +#define MWKEY_F5 0xF81F +#define MWKEY_F6 0xF820 +#define MWKEY_F7 0xF821 +#define MWKEY_F8 0xF822 +#define MWKEY_F9 0xF823 +#define MWKEY_F10 0xF824 +#define MWKEY_F11 0xF825 +#define MWKEY_F12 0xF827 + +/* Key state modifier keys*/ +#define MWKEY_NUMLOCK 0xF828 +#define MWKEY_CAPSLOCK 0xF829 +#define MWKEY_SCROLLOCK 0xF82A +#define MWKEY_LSHIFT 0xF82B +#define MWKEY_RSHIFT 0xF82C +#define MWKEY_LCTRL 0xF82D +#define MWKEY_RCTRL 0xF82E +#define MWKEY_LALT 0xF82F +#define MWKEY_RALT 0xF830 +#define MWKEY_LMETA 0xF831 +#define MWKEY_RMETA 0xF832 +#define MWKEY_ALTGR 0xF833 + +/* Misc function keys*/ +#define MWKEY_PRINT 0xF834 +#define MWKEY_SYSREQ 0xF835 +#define MWKEY_PAUSE 0xF836 +#define MWKEY_BREAK 0xF837 +#define MWKEY_QUIT 0xF838 /* virtual key*/ +#define MWKEY_MENU 0xF839 /* virtual key*/ +#define MWKEY_REDRAW 0xF83A /* virtual key*/ + +/* Handheld function keys*/ +#define MWKEY_RECORD 0xF840 +#define MWKEY_PLAY 0xF841 +#define MWKEY_CONTRAST 0xF842 +#define MWKEY_BRIGHTNESS 0xF843 +#define MWKEY_SELECTUP 0xF844 +#define MWKEY_SELECTDOWN 0xF845 +#define MWKEY_ACCEPT 0xF846 +#define MWKEY_CANCEL 0xF847 +#define MWKEY_APP1 0xF848 +#define MWKEY_APP2 0xF849 +#define MWKEY_LAST 0xF849 + +/* Keyboard state modifiers*/ +#define MWKMOD_NONE 0x0000 +#define MWKMOD_LSHIFT 0x0001 +#define MWKMOD_RSHIFT 0x0002 +#define MWKMOD_LCTRL 0x0040 +#define MWKMOD_RCTRL 0x0080 +#define MWKMOD_LALT 0x0100 +#define MWKMOD_RALT 0x0200 +#define MWKMOD_LMETA 0x0400 /* Windows key*/ +#define MWKMOD_RMETA 0x0800 /* Windows key*/ +#define MWKMOD_NUM 0x1000 +#define MWKMOD_CAPS 0x2000 +#define MWKMOD_ALTGR 0x4000 +#define MWKMOD_SCR 0x8000 + +#define MWKMOD_CTRL (MWKMOD_LCTRL|MWKMOD_RCTRL) +#define MWKMOD_SHIFT (MWKMOD_LSHIFT|MWKMOD_RSHIFT) +#define MWKMOD_ALT (MWKMOD_LALT|MWKMOD_RALT) +#define MWKMOD_META (MWKMOD_LMETA|MWKMOD_RMETA) + +#define MWKINFO_LED_MASK (1 << 0) +#define MWKINFO_LED_MODE_MASK (1 << 1) + +/* Keyboard info values */ +#define MWKINFO_LED_CAP (1 << 0) +#define MWKINFO_LED_NUM (1 << 1) +#define MWKINFO_LED_SCR (1 << 2) + +#define MWKINFO_LED_MODE_ON (1 << 3) +#define MWKINFO_LED_MODE_OFF (1 << 4) + +typedef struct { + int led; + int led_mode; +} MWKBINFO, *PMWKBINFO; +#endif /* _MWTYPES_H*/ diff --git a/packages/services/gfx/mw/current/include/microwin/nano-X.h b/packages/services/gfx/mw/current/include/microwin/nano-X.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/nano-X.h @@ -0,0 +1,858 @@ +#ifndef _NANO_X_H +#define _NANO_X_H +/* Copyright (c) 1999, 2000 Greg Haerr + * Copyright (c) 2000 Alex Holden + * Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * Nano-X public definition header file: user applications should + * include only this header file. + */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __ECOS +#include +#endif + +#include "mwtypes.h" /* exported engine MW* types*/ + +/* + * The following typedefs are inherited from the Microwindows + * engine layer. + */ +typedef MWCOORD GR_COORD; /* coordinate value */ +typedef MWCOORD GR_SIZE; /* size value */ +typedef MWCOLORVAL GR_COLOR; /* full color value */ +typedef MWPIXELVAL GR_PIXELVAL; /* hw pixel value*/ +typedef MWIMAGEBITS GR_BITMAP; /* bitmap unit */ +typedef MWUCHAR GR_CHAR; /* filename, window title */ +typedef MWKEY GR_KEY; /* keystroke value*/ +typedef MWSCANCODE GR_SCANCODE; /* oem keystroke scancode value*/ +typedef MWKEYMOD GR_KEYMOD; /* keystroke modifiers*/ +typedef MWSCREENINFO GR_SCREEN_INFO; /* screen information*/ +typedef MWWINDOWFBINFO GR_WINDOW_FB_INFO; /* direct client-mapped window info*/ +typedef MWFONTINFO GR_FONT_INFO; /* font information*/ +typedef MWIMAGEINFO GR_IMAGE_INFO; /* image information*/ +typedef MWIMAGEHDR GR_IMAGE_HDR; /* multicolor image representation*/ +typedef MWLOGFONT GR_LOGFONT; /* logical font descriptor*/ +typedef MWPALENTRY GR_PALENTRY; /* palette entry*/ +typedef MWPOINT GR_POINT; /* definition of a point*/ +typedef MWTIMEOUT GR_TIMEOUT; /* timeout value */ +typedef MWFONTLIST GR_FONTLIST; /* list of fonts */ +typedef MWKBINFO GR_KBINFO; /* keyboard information */ + +/* Basic typedefs. */ +typedef int GR_COUNT; /* number of items */ +typedef unsigned char GR_CHAR_WIDTH; /* width of character */ +typedef unsigned int GR_ID; /* resource ids */ +typedef GR_ID GR_DRAW_ID; /* drawable id */ +typedef GR_DRAW_ID GR_WINDOW_ID; /* window or pixmap id */ +typedef GR_ID GR_GC_ID; /* graphics context id */ +typedef GR_ID GR_REGION_ID; /* region id */ +typedef GR_ID GR_FONT_ID; /* font id */ +typedef GR_ID GR_IMAGE_ID; /* image id */ +typedef GR_ID GR_TIMER_ID; /* timer id */ +typedef GR_ID GR_CURSOR_ID; /* cursor id */ +typedef unsigned short GR_BOOL; /* boolean value */ +typedef int GR_ERROR; /* error types*/ +typedef int GR_EVENT_TYPE; /* event types */ +typedef int GR_UPDATE_TYPE; /* window update types */ +typedef unsigned long GR_EVENT_MASK; /* event masks */ +typedef char GR_FUNC_NAME[25];/* function name */ +typedef unsigned long GR_WM_PROPS; /* window property flags */ +typedef unsigned long GR_SERIALNO; /* Selection request ID number */ +typedef unsigned short GR_MIMETYPE; /* Index into mime type list */ +typedef unsigned long GR_LENGTH; /* Length of a block of data */ +typedef unsigned int GR_BUTTON; /* mouse button value*/ + +/* Nano-X rectangle, different from MWRECT*/ +typedef struct { + GR_COORD x; + GR_COORD y; + GR_SIZE width; + GR_SIZE height; +} GR_RECT; + +/* The root window id. */ +#define GR_ROOT_WINDOW_ID ((GR_WINDOW_ID) 1) + +/* GR_COLOR color constructor*/ +#define GR_RGB(r,g,b) MWRGB(r,g,b) + +/* Drawing modes for GrSetGCMode*/ +#define GR_MODE_COPY MWMODE_COPY /* src*/ +#define GR_MODE_SET MWMODE_COPY /* obsolete, use GR_MODE_COPY*/ +#define GR_MODE_XOR MWMODE_XOR /* src ^ dst*/ +#define GR_MODE_OR MWMODE_OR /* src | dst*/ +#define GR_MODE_AND MWMODE_AND /* src & dst*/ +#define GR_MODE_CLEAR MWMODE_CLEAR /* 0*/ +#define GR_MODE_SETTO1 MWMODE_SETTO1 /* 11111111*/ /* will be GR_MODE_SET*/ +#define GR_MODE_EQUIV MWMODE_EQUIV /* ~(src ^ dst)*/ +#define GR_MODE_NOR MWMODE_NOR /* ~(src | dst)*/ +#define GR_MODE_NAND MWMODE_NAND /* ~(src & dst)*/ +#define GR_MODE_INVERT MWMODE_INVERT /* ~dst*/ +#define GR_MODE_COPYINVERTED MWMODE_COPYINVERTED /* ~src*/ +#define GR_MODE_ORINVERTED MWMODE_ORINVERTED /* ~src | dst*/ +#define GR_MODE_ANDINVERTED MWMODE_ANDINVERTED /* ~src & dst*/ +#define GR_MODE_ORREVERSE MWMODE_ORREVERSE /* src | ~dst*/ +#define GR_MODE_ANDREVERSE MWMODE_ANDREVERSE /* src & ~dst*/ +#define GR_MODE_NOOP MWMODE_NOOP /* dst*/ + +#define GR_MODE_DRAWMASK 0x00FF +#define GR_MODE_EXCLUDECHILDREN 0x0100 /* exclude children on clip*/ + +/* builtin font std names*/ +#define GR_FONT_SYSTEM_VAR MWFONT_SYSTEM_VAR +#define GR_FONT_GUI_VAR MWFONT_GUI_VAR +#define GR_FONT_OEM_FIXED MWFONT_OEM_FIXED +#define GR_FONT_SYSTEM_FIXED MWFONT_SYSTEM_FIXED + +/* GrText/GrGetTextSize encoding flags*/ +#define GR_TFASCII MWTF_ASCII +#define GR_TFUTF8 MWTF_UTF8 +#define GR_TFUC16 MWTF_UC16 +#define GR_TFUC32 MWTF_UC32 +#define GR_TFPACKMASK MWTF_PACKMASK + +/* GrText alignment flags*/ +#define GR_TFTOP MWTF_TOP +#define GR_TFBASELINE MWTF_BASELINE +#define GR_TFBOTTOM MWTF_BOTTOM + +/* GrSetFontAttr flags*/ +#define GR_TFKERNING MWTF_KERNING +#define GR_TFANTIALIAS MWTF_ANTIALIAS +#define GR_TFUNDERLINE MWTF_UNDERLINE + +/* GrArc, GrArcAngle types*/ +#define GR_ARC MWARC /* arc only*/ +#define GR_ARCOUTLINE MWARCOUTLINE /* arc + outline*/ +#define GR_PIE MWPIE /* pie (filled)*/ + +/* Booleans */ +#define GR_FALSE 0 +#define GR_TRUE 1 + +/* Loadable Image support definition */ +#define GR_IMAGE_MAX_SIZE (-1) + +/* Button flags */ +#define GR_BUTTON_R MWBUTTON_R /* right button*/ +#define GR_BUTTON_M MWBUTTON_M /* middle button*/ +#define GR_BUTTON_L MWBUTTON_L /* left button */ +#define GR_BUTTON_ANY (MWBUTTON_R|MWBUTTON_M|MWBUTTON_L) /* any*/ + +/* GrSetBackgroundPixmap flags */ +#define GR_BACKGROUND_TILE 0 /* Tile across the window */ +#define GR_BACKGROUND_CENTER 1 /* Draw in center of window */ +#define GR_BACKGROUND_TOPLEFT 2 /* Draw at top left of window */ +#define GR_BACKGROUND_STRETCH 4 /* Stretch image to fit window*/ +#define GR_BACKGROUND_TRANS 8 /* Don't fill in gaps */ + +/* GrNewPixmapFromData flags*/ +#define GR_BMDATA_BYTEREVERSE 01 /* byte-reverse bitmap data*/ +#define GR_BMDATA_BYTESWAP 02 /* byte-swap bitmap data*/ + +#if 0 /* don't define unimp'd flags*/ +/* Window property flags */ +#define GR_WM_PROP_NORESIZE 0x04 /* don't let user resize window */ +#define GR_WM_PROP_NOICONISE 0x08 /* don't let user iconise window */ +#define GR_WM_PROP_NOWINMENU 0x10 /* don't display a window menu button */ +#define GR_WM_PROP_NOROLLUP 0x20 /* don't let user roll window up */ +#define GR_WM_PROP_ONTOP 0x200 /* try to keep window always on top */ +#define GR_WM_PROP_STICKY 0x400 /* keep window after desktop change */ +#define GR_WM_PROP_DND 0x2000 /* accept drag and drop icons */ +#endif + +/* Window properties*/ +#define GR_WM_PROPS_NOBACKGROUND 0x00000001L/* Don't draw window background*/ +#define GR_WM_PROPS_NOFOCUS 0x00000002L /* Don't set focus to this window*/ +#define GR_WM_PROPS_NOMOVE 0x00000004L /* Don't let user move window*/ +#define GR_WM_PROPS_NORAISE 0x00000008L /* Don't let user raise window*/ +#define GR_WM_PROPS_NODECORATE 0x00000010L /* Don't redecorate window*/ +#define GR_WM_PROPS_NOAUTOMOVE 0x00000020L /* Don't move window on 1st map*/ +#define GR_WM_PROPS_NOAUTORESIZE 0x00000040L /* Don't resize window on 1st map*/ + +/* default decoration style*/ +#define GR_WM_PROPS_APPWINDOW 0x00000000L /* Leave appearance to WM*/ +#define GR_WM_PROPS_APPMASK 0xF0000000L /* Appearance mask*/ +#define GR_WM_PROPS_BORDER 0x80000000L /* Single line border*/ +#define GR_WM_PROPS_APPFRAME 0x40000000L /* 3D app frame (overrides border)*/ +#define GR_WM_PROPS_CAPTION 0x20000000L /* Title bar*/ +#define GR_WM_PROPS_CLOSEBOX 0x10000000L /* Close box*/ +#define GR_WM_PROPS_MAXIMIZE 0x08000000L /* Application is maximized*/ + +/* Flags for indicating valid bits in GrSetWMProperties call*/ +#define GR_WM_FLAGS_PROPS 0x0001 /* Properties*/ +#define GR_WM_FLAGS_TITLE 0x0002 /* Title*/ +#define GR_WM_FLAGS_BACKGROUND 0x0004 /* Background color*/ +#define GR_WM_FLAGS_BORDERSIZE 0x0008 /* Border size*/ +#define GR_WM_FLAGS_BORDERCOLOR 0x0010 /* Border color*/ + +/* Window manager properties used by the Gr[GS]etWMProperties calls. */ +/* NOTE: this struct must be hand-packed to a DWORD boundary for nxproto.h*/ +typedef struct { + GR_WM_PROPS flags; /* Which properties valid in struct for set*/ + GR_WM_PROPS props; /* Window property bits*/ + GR_CHAR *title; /* Window title*/ + GR_COLOR background; /* Window background color*/ + GR_SIZE bordersize; /* Window border size*/ + GR_COLOR bordercolor; /* Window border color*/ +} GR_WM_PROPERTIES; + +/* Window properties returned by the GrGetWindowInfo call. */ +typedef struct { + GR_WINDOW_ID wid; /* window id (or 0 if no such window) */ + GR_WINDOW_ID parent; /* parent window id */ + GR_WINDOW_ID child; /* first child window id (or 0) */ + GR_WINDOW_ID sibling; /* next sibling window id (or 0) */ + GR_BOOL inputonly; /* TRUE if window is input only */ + GR_BOOL mapped; /* TRUE if window is mapped */ + GR_COUNT unmapcount; /* reasons why window is unmapped */ + GR_COORD x; /* absolute x position of window */ + GR_COORD y; /* absolute y position of window */ + GR_SIZE width; /* width of window */ + GR_SIZE height; /* height of window */ + GR_SIZE bordersize; /* size of border */ + GR_COLOR bordercolor; /* color of border */ + GR_COLOR background; /* background color */ + GR_EVENT_MASK eventmask; /* current event mask for this client */ + GR_WM_PROPS props; /* window properties */ + GR_CURSOR_ID cursor; /* cursor id*/ + unsigned long processid; /* process id of owner*/ +} GR_WINDOW_INFO; + +/* Graphics context properties returned by the GrGetGCInfo call. */ +typedef struct { + GR_GC_ID gcid; /* GC id (or 0 if no such GC) */ + int mode; /* drawing mode */ + GR_REGION_ID region; /* user region */ + int xoff; /* x offset of user region*/ + int yoff; /* y offset of user region*/ + GR_FONT_ID font; /* font number */ + GR_COLOR foreground; /* foreground color */ + GR_COLOR background; /* background color */ + GR_BOOL usebackground; /* use background in bitmaps */ +} GR_GC_INFO; + +/* color palette*/ +typedef struct { + GR_COUNT count; /* # valid entries*/ + GR_PALENTRY palette[256]; /* palette*/ +} GR_PALETTE; + +/* Error codes */ +#define GR_ERROR_BAD_WINDOW_ID 1 +#define GR_ERROR_BAD_GC_ID 2 +#define GR_ERROR_BAD_CURSOR_SIZE 3 +#define GR_ERROR_MALLOC_FAILED 4 +#define GR_ERROR_BAD_WINDOW_SIZE 5 +#define GR_ERROR_KEYBOARD_ERROR 6 +#define GR_ERROR_MOUSE_ERROR 7 +#define GR_ERROR_INPUT_ONLY_WINDOW 8 +#define GR_ERROR_ILLEGAL_ON_ROOT_WINDOW 9 +#define GR_ERROR_TOO_MUCH_CLIPPING 10 +#define GR_ERROR_SCREEN_ERROR 11 +#define GR_ERROR_UNMAPPED_FOCUS_WINDOW 12 +#define GR_ERROR_BAD_DRAWING_MODE 13 + +/* Event types. + * Mouse motion is generated for every motion of the mouse, and is used to + * track the entire history of the mouse (many events and lots of overhead). + * Mouse position ignores the history of the motion, and only reports the + * latest position of the mouse by only queuing the latest such event for + * any single client (good for rubber-banding). + */ +#define GR_EVENT_TYPE_ERROR (-1) +#define GR_EVENT_TYPE_NONE 0 +#define GR_EVENT_TYPE_EXPOSURE 1 +#define GR_EVENT_TYPE_BUTTON_DOWN 2 +#define GR_EVENT_TYPE_BUTTON_UP 3 +#define GR_EVENT_TYPE_MOUSE_ENTER 4 +#define GR_EVENT_TYPE_MOUSE_EXIT 5 +#define GR_EVENT_TYPE_MOUSE_MOTION 6 +#define GR_EVENT_TYPE_MOUSE_POSITION 7 +#define GR_EVENT_TYPE_KEY_DOWN 8 +#define GR_EVENT_TYPE_KEY_UP 9 +#define GR_EVENT_TYPE_FOCUS_IN 10 +#define GR_EVENT_TYPE_FOCUS_OUT 11 +#define GR_EVENT_TYPE_FDINPUT 12 +#define GR_EVENT_TYPE_UPDATE 13 +#define GR_EVENT_TYPE_CHLD_UPDATE 14 +#define GR_EVENT_TYPE_CLOSE_REQ 15 +#define GR_EVENT_TYPE_TIMEOUT 16 +#define GR_EVENT_TYPE_SCREENSAVER 17 +#define GR_EVENT_TYPE_CLIENT_DATA_REQ 18 +#define GR_EVENT_TYPE_CLIENT_DATA 19 +#define GR_EVENT_TYPE_SELECTION_CHANGED 20 +#define GR_EVENT_TYPE_TIMER 21 +#define GR_EVENT_TYPE_PORTRAIT_CHANGED 22 + +/* Event masks */ +#define GR_EVENTMASK(n) (((GR_EVENT_MASK) 1) << (n)) + +#define GR_EVENT_MASK_NONE GR_EVENTMASK(GR_EVENT_TYPE_NONE) +#define GR_EVENT_MASK_ERROR 0x80000000L +#define GR_EVENT_MASK_EXPOSURE GR_EVENTMASK(GR_EVENT_TYPE_EXPOSURE) +#define GR_EVENT_MASK_BUTTON_DOWN GR_EVENTMASK(GR_EVENT_TYPE_BUTTON_DOWN) +#define GR_EVENT_MASK_BUTTON_UP GR_EVENTMASK(GR_EVENT_TYPE_BUTTON_UP) +#define GR_EVENT_MASK_MOUSE_ENTER GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_ENTER) +#define GR_EVENT_MASK_MOUSE_EXIT GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_EXIT) +#define GR_EVENT_MASK_MOUSE_MOTION GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_MOTION) +#define GR_EVENT_MASK_MOUSE_POSITION GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_POSITION) +#define GR_EVENT_MASK_KEY_DOWN GR_EVENTMASK(GR_EVENT_TYPE_KEY_DOWN) +#define GR_EVENT_MASK_KEY_UP GR_EVENTMASK(GR_EVENT_TYPE_KEY_UP) +#define GR_EVENT_MASK_FOCUS_IN GR_EVENTMASK(GR_EVENT_TYPE_FOCUS_IN) +#define GR_EVENT_MASK_FOCUS_OUT GR_EVENTMASK(GR_EVENT_TYPE_FOCUS_OUT) +#define GR_EVENT_MASK_FDINPUT GR_EVENTMASK(GR_EVENT_TYPE_FDINPUT) +#define GR_EVENT_MASK_UPDATE GR_EVENTMASK(GR_EVENT_TYPE_UPDATE) +#define GR_EVENT_MASK_CHLD_UPDATE GR_EVENTMASK(GR_EVENT_TYPE_CHLD_UPDATE) +#define GR_EVENT_MASK_CLOSE_REQ GR_EVENTMASK(GR_EVENT_TYPE_CLOSE_REQ) +#define GR_EVENT_MASK_TIMEOUT GR_EVENTMASK(GR_EVENT_TYPE_TIMEOUT) +#define GR_EVENT_MASK_SCREENSAVER GR_EVENTMASK(GR_EVENT_TYPE_SCREENSAVER) +#define GR_EVENT_MASK_CLIENT_DATA_REQ GR_EVENTMASK(GR_EVENT_TYPE_CLIENT_DATA_REQ) +#define GR_EVENT_MASK_CLIENT_DATA GR_EVENTMASK(GR_EVENT_TYPE_CLIENT_DATA) +#define GR_EVENT_MASK_SELECTION_CHANGED GR_EVENTMASK(GR_EVENT_TYPE_SELECTION_CHANGED) +#define GR_EVENT_MASK_TIMER GR_EVENTMASK(GR_EVENT_TYPE_TIMER) +#define GR_EVENT_MASK_PORTRAIT_CHANGED GR_EVENTMASK(GR_EVENT_TYPE_PORTRAIT_CHANGED) +#define GR_EVENT_MASK_ALL ((GR_EVENT_MASK) -1L) + +/* update event types */ +#define GR_UPDATE_MAP 1 +#define GR_UPDATE_UNMAP 2 +#define GR_UPDATE_MOVE 3 +#define GR_UPDATE_SIZE 4 +#define GR_UPDATE_UNMAPTEMP 5 /* unmap during window move/resize*/ +#define GR_UPDATE_ACTIVATE 6 /* toplevel window [de]activate*/ +#define GR_UPDATE_DESTROY 7 + +/* Event for errors detected by the server. + * These events are not delivered to GrGetNextEvent, but instead call + * the user supplied error handling function. Only the first one of + * these errors at a time is saved for delivery to the client since + * there is not much to be done about errors anyway except complain + * and exit. + */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_FUNC_NAME name; /* function name which failed */ + GR_ERROR code; /* error code */ + GR_ID id; /* resource id (maybe useless) */ +} GR_EVENT_ERROR; + +/* Event for a mouse button pressed down or released. */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_WINDOW_ID wid; /* window id event delivered to */ + GR_WINDOW_ID subwid; /* sub-window id (pointer was in) */ + GR_COORD rootx; /* root window x coordinate */ + GR_COORD rooty; /* root window y coordinate */ + GR_COORD x; /* window x coordinate of mouse */ + GR_COORD y; /* window y coordinate of mouse */ + GR_BUTTON buttons; /* current state of all buttons */ + GR_BUTTON changebuttons; /* buttons which went down or up */ + GR_KEYMOD modifiers; /* modifiers (MWKMOD_SHIFT, etc)*/ + GR_TIMEOUT time; /* tickcount time value*/ +} GR_EVENT_BUTTON; + +/* Event for a keystroke typed for the window with has focus. */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_WINDOW_ID wid; /* window id event delived to */ + GR_WINDOW_ID subwid; /* sub-window id (pointer was in) */ + GR_COORD rootx; /* root window x coordinate */ + GR_COORD rooty; /* root window y coordinate */ + GR_COORD x; /* window x coordinate of mouse */ + GR_COORD y; /* window y coordinate of mouse */ + GR_BUTTON buttons; /* current state of buttons */ + GR_KEYMOD modifiers; /* modifiers (MWKMOD_SHIFT, etc)*/ + GR_KEY ch; /* 16-bit unicode key value, MWKEY_xxx */ + GR_SCANCODE scancode; /* OEM scancode value if available*/ +} GR_EVENT_KEYSTROKE; + +/* Event for exposure for a region of a window. */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_WINDOW_ID wid; /* window id */ + GR_COORD x; /* window x coordinate of exposure */ + GR_COORD y; /* window y coordinate of exposure */ + GR_SIZE width; /* width of exposure */ + GR_SIZE height; /* height of exposure */ +} GR_EVENT_EXPOSURE; + +/* General events for focus in or focus out for a window, or mouse enter + * or mouse exit from a window, or window unmapping or mapping, etc. + * Server portrait mode changes are also sent using this event to + * all windows that request it. + */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_WINDOW_ID wid; /* window id */ + GR_WINDOW_ID otherid; /* new/old focus id for focus events*/ +} GR_EVENT_GENERAL; + +/* Events for mouse motion or mouse position. */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_WINDOW_ID wid; /* window id event delivered to */ + GR_WINDOW_ID subwid; /* sub-window id (pointer was in) */ + GR_COORD rootx; /* root window x coordinate */ + GR_COORD rooty; /* root window y coordinate */ + GR_COORD x; /* window x coordinate of mouse */ + GR_COORD y; /* window y coordinate of mouse */ + GR_BUTTON buttons; /* current state of buttons */ + GR_KEYMOD modifiers; /* modifiers (MWKMOD_SHIFT, etc)*/ +} GR_EVENT_MOUSE; + +/* GrRegisterInput event*/ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + int fd; /* input fd*/ +} GR_EVENT_FDINPUT; + +/* GR_EVENT_TYPE_UPDATE */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_WINDOW_ID wid; /* select window id*/ + GR_WINDOW_ID subwid; /* update window id (=wid for UPDATE event)*/ + GR_COORD x; /* new window x coordinate */ + GR_COORD y; /* new window y coordinate */ + GR_SIZE width; /* new width */ + GR_SIZE height; /* new height */ + GR_UPDATE_TYPE utype; /* update_type */ +} GR_EVENT_UPDATE; + +/* GR_EVENT_TYPE_SCREENSAVER */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_BOOL activate; /* true = activate, false = deactivate */ +} GR_EVENT_SCREENSAVER; + +/* GR_EVENT_TYPE_CLIENT_DATA_REQ */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_WINDOW_ID wid; /* ID of requested window */ + GR_WINDOW_ID rid; /* ID of window to send data to */ + GR_SERIALNO serial; /* Serial number of transaction */ + GR_MIMETYPE mimetype; /* Type to supply data as */ +} GR_EVENT_CLIENT_DATA_REQ; + +/* GR_EVENT_TYPE_CLIENT_DATA */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_WINDOW_ID wid; /* ID of window data is destined for */ + GR_WINDOW_ID rid; /* ID of window data is from */ + GR_SERIALNO serial; /* Serial number of transaction */ + unsigned long len; /* Total length of data */ + unsigned long datalen; /* Length of following data */ + void *data; /* Pointer to data (filled in on client side) */ +} GR_EVENT_CLIENT_DATA; + +/* GR_EVENT_TYPE_SELECTION_CHANGED */ +typedef struct { + GR_EVENT_TYPE type; /* event type */ + GR_WINDOW_ID new_owner; /* ID of new selection owner */ +} GR_EVENT_SELECTION_CHANGED; + +/* GR_EVENT_TYPE_TIMER */ +typedef struct { + GR_EVENT_TYPE type; /* event type, GR_EVENT_TYPE_TIMER */ + GR_WINDOW_ID wid; /* ID of window timer is destined for */ + GR_TIMER_ID tid; /* ID of expired timer */ +} GR_EVENT_TIMER; + +/* + * Union of all possible event structures. + * This is the structure returned by the GrGetNextEvent and similar routines. + */ +typedef union { + GR_EVENT_TYPE type; /* event type */ + GR_EVENT_ERROR error; /* error event */ + GR_EVENT_GENERAL general; /* general window events */ + GR_EVENT_BUTTON button; /* button events */ + GR_EVENT_KEYSTROKE keystroke; /* keystroke events */ + GR_EVENT_EXPOSURE exposure; /* exposure events */ + GR_EVENT_MOUSE mouse; /* mouse motion events */ + GR_EVENT_FDINPUT fdinput; /* fd input events*/ + GR_EVENT_UPDATE update; /* window update events */ + GR_EVENT_SCREENSAVER screensaver; /* Screen saver events */ + GR_EVENT_CLIENT_DATA_REQ clientdatareq; /* Request for client data events */ + GR_EVENT_CLIENT_DATA clientdata; /* Client data events */ + GR_EVENT_SELECTION_CHANGED selectionchanged; /* Selection owner changed */ + GR_EVENT_TIMER timer; +} GR_EVENT; + +typedef void (*GR_FNCALLBACKEVENT)(GR_EVENT *); + +/* Pixel packings within words. */ +#define GR_BITMAPBITS (sizeof(GR_BITMAP) * 8) +#define GR_ZEROBITS ((GR_BITMAP) 0x0000) +#define GR_ONEBITS ((GR_BITMAP) 0xffff) +#define GR_FIRSTBIT ((GR_BITMAP) 0x8000) +#define GR_LASTBIT ((GR_BITMAP) 0x0001) +#define GR_BITVALUE(n) ((GR_BITMAP) (((GR_BITMAP) 1) << (n))) +#define GR_SHIFTBIT(m) ((GR_BITMAP) ((m) << 1)) +#define GR_NEXTBIT(m) ((GR_BITMAP) ((m) >> 1)) +#define GR_TESTBIT(m) (((m) & GR_FIRSTBIT) != 0) + +/* Size of bitmaps. */ +#define GR_BITMAP_SIZE(width, height) ((height) * \ + (((width) + sizeof(GR_BITMAP) * 8 - 1) / (sizeof(GR_BITMAP) * 8))) + +#define GR_MAX_BITMAP_SIZE \ + GR_BITMAP_SIZE(MWMAX_CURSOR_SIZE, MWMAX_CURSOR_SIZE) + +/* GrGetSysColor colors*/ +/* desktop background*/ +#define GR_COLOR_DESKTOP 0 + +/* caption colors*/ +#define GR_COLOR_ACTIVECAPTION 1 +#define GR_COLOR_ACTIVECAPTIONTEXT 2 +#define GR_COLOR_INACTIVECAPTION 3 +#define GR_COLOR_INACTIVECAPTIONTEXT 4 + +/* 3d border shades*/ +#define GR_COLOR_WINDOWFRAME 5 +#define GR_COLOR_BTNSHADOW 6 +#define GR_COLOR_3DLIGHT 7 +#define GR_COLOR_BTNHIGHLIGHT 8 + +/* top level application window backgrounds/text*/ +#define GR_COLOR_APPWINDOW 9 +#define GR_COLOR_APPTEXT 10 + +/* button control backgrounds/text (usually same as app window colors)*/ +#define GR_COLOR_BTNFACE 11 +#define GR_COLOR_BTNTEXT 12 + +/* edit/listbox control backgrounds/text, selected highlights*/ +#define GR_COLOR_WINDOW 13 +#define GR_COLOR_WINDOWTEXT 14 +#define GR_COLOR_HIGHLIGHT 15 +#define GR_COLOR_HIGHLIGHTTEXT 16 +#define GR_COLOR_GRAYTEXT 17 + +/* menu backgrounds/text*/ +#define GR_COLOR_MENUTEXT 18 +#define GR_COLOR_MENU 19 + +/* Error strings per error number*/ +#define GR_ERROR_STRINGS \ + "", \ + "Bad window id: %d\n", \ + "Bad graphics context: %d\n", \ + "Bad cursor size\n", \ + "Out of server memory\n", \ + "Bad window size: %d\n", \ + "Keyboard error\n", \ + "Mouse error\n", \ + "Input only window: %d\n", \ + "Illegal on root window: %d\n", \ + "Clipping overflow\n", \ + "Screen error\n", \ + "Unmapped focus window: %d\n", \ + "Bad drawing mode gc: %d\n" + +extern char *nxErrorStrings[]; + +/* Public graphics routines. */ +void GrFlush(void); +int GrOpen(void); +void GrClose(void); +void GrDelay(GR_TIMEOUT msecs); +void GrGetScreenInfo(GR_SCREEN_INFO *sip); +GR_COLOR GrGetSysColor(int index); +GR_WINDOW_ID GrNewWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, GR_SIZE bordersize, + GR_COLOR background, GR_COLOR bordercolor); +GR_WINDOW_ID GrNewPixmap(GR_SIZE width, GR_SIZE height, void * addr); +GR_WINDOW_ID GrNewInputWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height); +void GrDestroyWindow(GR_WINDOW_ID wid); +GR_GC_ID GrNewGC(void); +GR_GC_ID GrCopyGC(GR_GC_ID gc); +void GrGetGCInfo(GR_GC_ID gc, GR_GC_INFO *gcip); +void GrDestroyGC(GR_GC_ID gc); +GR_REGION_ID GrNewRegion(void); +GR_REGION_ID GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points); +void GrDestroyRegion(GR_REGION_ID region); +void GrUnionRectWithRegion(GR_REGION_ID region, GR_RECT *rect); +void GrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2); +void GrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2); +void GrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2); +void GrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2); +void GrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region); +void GrSetGCClipOrigin(GR_GC_ID gc, int x, int y); +GR_BOOL GrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y); +int GrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y, + GR_COORD w, GR_COORD h); +GR_BOOL GrEmptyRegion(GR_REGION_ID region); +GR_BOOL GrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2); +void GrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy); +int GrGetRegionBox(GR_REGION_ID region, GR_RECT *rect); +void GrMapWindow(GR_WINDOW_ID wid); +void GrUnmapWindow(GR_WINDOW_ID wid); +void GrRaiseWindow(GR_WINDOW_ID wid); +void GrLowerWindow(GR_WINDOW_ID wid); +void GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y); +void GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height); +void GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, + GR_COORD x, GR_COORD y); +void GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr); +void GrSetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props); +void GrGetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props); +GR_FONT_ID GrCreateFont(GR_CHAR *name, GR_COORD height, + GR_LOGFONT *plogfont); +void GrGetFontList(GR_FONTLIST ***fonts, int *numfonts); +void GrFreeFontList(GR_FONTLIST ***fonts, int num); +void GrSetFontSize(GR_FONT_ID fontid, GR_COORD size); +void GrSetFontRotation(GR_FONT_ID fontid, int tenthsdegrees); +void GrSetFontAttr(GR_FONT_ID fontid, int setflags, int clrflags); +void GrDestroyFont(GR_FONT_ID fontid); +void GrGetFontInfo(GR_FONT_ID font, GR_FONT_INFO *fip); +GR_WINDOW_ID GrGetFocus(void); +void GrSetFocus(GR_WINDOW_ID wid); +void GrClearArea(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, GR_BOOL exposeflag); +void GrSelectEvents(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask); +void GrGetNextEvent(GR_EVENT *ep); +void GrGetNextEventTimeout(GR_EVENT *ep, GR_TIMEOUT timeout); +void GrCheckNextEvent(GR_EVENT *ep); +int GrPeekEvent(GR_EVENT *ep); +void GrPeekWaitEvent(GR_EVENT *ep); +void GrLine(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, + GR_COORD x2, GR_COORD y2); +void GrPoint(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y); +void GrPoints(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, + GR_POINT *pointtable); +void GrRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height); +void GrFillRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height); +void GrPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, + GR_POINT *pointtable); +void GrFillPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, + GR_POINT *pointtable); +void GrEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE rx, GR_SIZE ry); +void GrFillEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, + GR_COORD y, GR_SIZE rx, GR_SIZE ry); +void GrArc(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay, + GR_COORD bx, GR_COORD by, int type); +void GrArcAngle(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, + GR_COORD angle2, int type); /* floating point required*/ +void GrSetGCForeground(GR_GC_ID gc, GR_COLOR foreground); +void GrSetGCBackground(GR_GC_ID gc, GR_COLOR background); +void GrSetGCUseBackground(GR_GC_ID gc, GR_BOOL flag); +void GrSetGCMode(GR_GC_ID gc, int mode); +void GrSetGCFont(GR_GC_ID gc, GR_FONT_ID font); +void GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags, + GR_SIZE *retwidth, GR_SIZE *retheight,GR_SIZE *retbase); +void GrReadArea(GR_DRAW_ID id, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, GR_PIXELVAL *pixels); +void GrArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width,GR_SIZE height,void *pixels,int pixtype); +void GrCopyArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, GR_DRAW_ID srcid, + GR_COORD srcx, GR_COORD srcy, int op); +void GrBitmap(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, GR_BITMAP *imagebits); +void GrDrawImageBits(GR_DRAW_ID id,GR_GC_ID gc,GR_COORD x,GR_COORD y, + GR_IMAGE_HDR *pimage); +void GrDrawImageFromFile(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, + GR_COORD y, GR_SIZE width, GR_SIZE height, + char *path, int flags); +GR_IMAGE_ID GrLoadImageFromFile(char *path, int flags); +void GrDrawImageFromBuffer(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, + GR_COORD y, GR_SIZE width, GR_SIZE height, + void *buffer, int size, int flags); +GR_IMAGE_ID GrLoadImageFromBuffer(void *buffer, int size, int flags); +void GrDrawImageToFit(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, + GR_COORD y, GR_SIZE width, GR_SIZE height, + GR_IMAGE_ID imageid); +void GrFreeImage(GR_IMAGE_ID id); +void GrGetImageInfo(GR_IMAGE_ID id, GR_IMAGE_INFO *iip); +void GrText(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + void *str, GR_COUNT count, int flags); +GR_CURSOR_ID GrNewCursor(GR_SIZE width, GR_SIZE height, GR_COORD hotx, + GR_COORD hoty, GR_COLOR foreground, GR_COLOR background, + GR_BITMAP *fgbitmap, GR_BITMAP *bgbitmap); +void GrDestroyCursor(GR_CURSOR_ID cid); +void GrSetWindowCursor(GR_WINDOW_ID wid, GR_CURSOR_ID cid); +void GrMoveCursor(GR_COORD x, GR_COORD y); +void GrGetSystemPalette(GR_PALETTE *pal); +void GrSetSystemPalette(GR_COUNT first, GR_PALETTE *pal); +void GrFindColor(GR_COLOR c, GR_PIXELVAL *retpixel); +void GrReqShmCmds(long shmsize); +void GrInjectPointerEvent(MWCOORD x, MWCOORD y, + int button, int visible); +void GrInjectKeyboardEvent(GR_WINDOW_ID wid, GR_KEY keyvalue, + GR_KEYMOD modifiers, GR_SCANCODE scancode, + GR_BOOL pressed); +void GrCloseWindow(GR_WINDOW_ID wid); +void GrKillWindow(GR_WINDOW_ID wid); +void GrSetScreenSaverTimeout(GR_TIMEOUT timeout); +void GrSetSelectionOwner(GR_WINDOW_ID wid, GR_CHAR *typelist); +GR_WINDOW_ID GrGetSelectionOwner(GR_CHAR **typelist); +void GrRequestClientData(GR_WINDOW_ID wid, GR_WINDOW_ID rid, + GR_SERIALNO serial, GR_MIMETYPE mimetype); +void GrSendClientData(GR_WINDOW_ID wid, GR_WINDOW_ID did, + GR_SERIALNO serial, GR_LENGTH len, GR_LENGTH thislen, + void *data); +void GrBell(void); +void GrSetBackgroundPixmap(GR_WINDOW_ID wid, GR_WINDOW_ID pixmap, + int flags); +void GrQueryTree(GR_WINDOW_ID wid, GR_WINDOW_ID *parentid, GR_WINDOW_ID **children, + GR_COUNT *nchildren); +GR_TIMER_ID GrCreateTimer(GR_WINDOW_ID wid, GR_TIMEOUT period); +void GrDestroyTimer(GR_TIMER_ID tid); +void GrSetPortraitMode(int portraitmode); + +void GrRegisterInput(int fd); +void GrUnregisterInput(int fd); +void GrMainLoop(GR_FNCALLBACKEVENT fncb); +GR_FNCALLBACKEVENT GrSetErrorHandler(GR_FNCALLBACKEVENT fncb); +void GrDefaultErrorHandler(GR_EVENT *ep); + +/* passive library entry points - available with client/server only*/ +void GrPrepareSelect(int *maxfd,void *rfdset); +void GrServiceSelect(void *rfdset, GR_FNCALLBACKEVENT fncb); + +/* nxutil.c - utility routines*/ +GR_WINDOW_ID GrNewWindowEx(GR_WM_PROPS props, GR_CHAR *title, + GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, GR_COLOR background); +void GrDrawLines(GR_DRAW_ID w, GR_GC_ID gc, GR_POINT *points, + GR_COUNT count); +GR_BITMAP * GrNewBitmapFromData(GR_SIZE width, GR_SIZE height, GR_SIZE bits_width, + GR_SIZE bits_height, void *bits, int flags); +GR_WINDOW_ID GrNewPixmapFromData(GR_SIZE width, GR_SIZE height, + GR_COLOR foreground, GR_COLOR background, void * bits, + int flags); + +/* direct client-side framebuffer mapping routines*/ +unsigned char * GrOpenClientFramebuffer(void); +void GrCloseClientFramebuffer(void); +void GrGetWindowFBInfo(GR_WINDOW_ID wid, GR_WINDOW_FB_INFO *fbinfo); + +/* retrofit - no longer used*/ +GR_CURSOR_ID GrSetCursor(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height, + GR_COORD hotx, GR_COORD hoty, GR_COLOR foreground, + GR_COLOR background, GR_BITMAP *fbbitmap, + GR_BITMAP *bgbitmap); +#define GrSetBorderColor GrSetWindowBorderColor /* retrofit*/ +#define GrClearWindow(wid,exposeflag) GrClearArea(wid,0,0,0,0,exposeflag) /* retrofit*/ + +/* useful function macros*/ +#define GrSetWindowBackgroundColor(wid,color) \ + { GR_WM_PROPERTIES props; \ + props.flags = GR_WM_FLAGS_BACKGROUND; \ + props.background = color; \ + GrSetWMProperties(wid, &props); \ + } +#define GrSetWindowBorderSize(wid,width) \ + { GR_WM_PROPERTIES props; \ + props.flags = GR_WM_FLAGS_BORDERSIZE; \ + props.bordersize = width; \ + GrSetWMProperties(wid, &props); \ + } +#define GrSetWindowBorderColor(wid,color) \ + { GR_WM_PROPERTIES props; \ + props.flags = GR_WM_FLAGS_BORDERCOLOR; \ + props.bordercolor = color; \ + GrSetWMProperties(wid, &props); \ + } +#define GrSetWindowTitle(wid,name) \ + { GR_WM_PROPERTIES props; \ + props.flags = GR_WM_FLAGS_TITLE; \ + props.title = (GR_CHAR *)name; \ + GrSetWMProperties(wid, &props); \ + } + +#ifdef __cplusplus +} +#endif + +/* RTEMS requires rtems_main()*/ +#if __rtems__ +#define main rtems_main +#endif + +/* client side event queue (client.c local)*/ +typedef struct event_list EVENT_LIST; +struct event_list { + EVENT_LIST * next; + GR_EVENT event; +}; + +/* queued request buffer (nxproto.c local)*/ +typedef struct { + unsigned char *bufptr; /* next unused buffer location*/ + unsigned char *bufmax; /* max buffer location*/ + unsigned char *buffer; /* request buffer*/ +} REQBUF; + +#ifdef __ECOS +#include +/* + * In a single process, multi-threaded environment, we need to keep + * all static data of shared code in a structure, with a pointer to + * the structure to be stored in thread-local storage + */ +typedef struct { // Init to: + int _nxSocket; // -1 + int _storedevent; // 0 + GR_EVENT _storedevent_data; // no init(0) + int _regfdmax; // -1 + fd_set _regfdset; // FD_ZERO + GR_FNCALLBACKEVENT _GrErrorFunc; // GrDefaultErrorHandler + REQBUF _reqbuf; + EVENT_LIST *_evlist; +} ecos_nanox_client_data; + +extern int ecos_nanox_client_data_index; + +#define ACCESS_PER_THREAD_DATA() \ + ecos_nanox_client_data *data = (ecos_nanox_client_data*) \ + cyg_thread_get_data((cyg_ucount32)ecos_nanox_client_data_index); + +#define INIT_PER_THREAD_DATA() \ + { \ + ecos_nanox_client_data *dptr = malloc(sizeof(ecos_nanox_client_data)); \ + ecos_nanox_client_data_index = data; \ + dptr->_nxSocket = -1; \ + dptr->_storedevent = 0; \ + dptr->_regfdmax = -1; \ + FD_ZERO(&dptr->_regfdset); \ + dptr->_GrErrorFunc = GrDefaultErrorHandler; \ + dptr->_reqbuf.bufptr = NULL; \ + dptr->_reqbuf.bufmax = NULL; \ + dptr->_reqbuf.buffer = NULL; \ + dptr->_evlist = NULL; \ + cyg_thread_set_data(ecos_nanox_client_data_index,(CYG_ADDRWORD)dptr); \ + } + +#define nxSocket (data->_nxSocket) +#define storedevent (data->_storedevent) +#define storedevent_data (data->_storedevent_data) +#define regfdmax (data->_regfdmax) +#define regfdset (data->_regfdset) +#define ErrorFunc (data->_GrErrorFunc) +#define reqbuf (data->_reqbuf) +#define evlist (data->_evlist) + +#else +#define ACCESS_PER_THREAD_DATA() +#endif + +#endif /* _NANO_X_H*/ diff --git a/packages/services/gfx/mw/current/include/microwin/nxdraw.h b/packages/services/gfx/mw/current/include/microwin/nxdraw.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/nxdraw.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2000 Greg Haerr + * + * Nano-X Draw Library + * nxPaintNCArea - paint non-client area + * nxDraw3dShadow - draws a shadow with bottom-left and top-right missing + * nxDraw3dBox - draws a complete shadow + * nxDraw3dInset - draw a 2 line 3d inset + * nxDraw3dOutset - draw a 2 line 3d outset + */ +void nxPaintNCArea(GR_DRAW_ID id, int w, int h, GR_CHAR *title, + GR_BOOL active, GR_WM_PROPS props); + +void nxInflateRect(GR_RECT *prc, GR_SIZE dx, GR_SIZE dy); +void nxDraw3dBox(GR_WINDOW_ID id,int x,int y,int w,int h, + GR_COLOR crTop,GR_COLOR crBottom); +void nxDraw3dInset(GR_DRAW_ID id,int x,int y,int w,int h); +void nxDraw3dOutset(GR_WINDOW_ID id,int x,int y,int w,int h); +void nxDraw3dPushDown(GR_DRAW_ID id, int x, int y, int w, int h); +void nxDraw3dUpDownState(GR_DRAW_ID id, int x, int y, int w, int h, + GR_BOOL fDown); +void nxDraw3dUpFrame(GR_DRAW_ID id, int l, int t, int r, int b); + +/* nxPaintNCArea offsets*/ +#define CXBORDER 3 /* 3d border width*/ +#define CYBORDER 3 /* 3d border height*/ +#define CYCAPTION 12 /* height of caption*/ +#define CXCLOSEBOX 9 /* width of closebox*/ +#define CYCLOSEBOX 9 /* height of closebox*/ +#define CXFRAME (CXBORDER*2) /* width of frame*/ +#define CYFRAME (CYBORDER*2) /* height of frame*/ diff --git a/packages/services/gfx/mw/current/include/microwin/swap.h b/packages/services/gfx/mw/current/include/microwin/swap.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/swap.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2001 Greg Haerr + * + * Byte and word swapping header file for big/little endian mapping + */ + +#ifdef __ECOS +// FIXME! +#define wswap(x) (x) +#define dwswap(x) (x) +#define dwread(addr) (*(unsigned long *)(addr)) +#else +#include +#include +#if __BYTE_ORDER == __BIG_ENDIAN +#define wswap(x) bswap_16(x) +#define dwswap(x) bswap_32(x) +/* read little endian format from buffer*/ +#define dwread(addr) ((*(unsigned char *)(addr)) | \ + (*(unsigned char *)(addr+1) << 8) | \ + (*(unsigned char *)(addr+2) << 16) | \ + (*(unsigned char *)(addr+3) << 24)) +#else +/* little endian - no action required*/ +#define wswap(x) (x) +#define dwswap(x) (x) +#define dwread(addr) (*(unsigned long *)(addr)) +#endif +#endif + diff --git a/packages/services/gfx/mw/current/include/microwin/winctl.h b/packages/services/gfx/mw/current/include/microwin/winctl.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/winctl.h @@ -0,0 +1,434 @@ +/* winctl.h*/ +/* + * Header file for builtin controls + * This currently includes button, progressbar, listbox, edit + */ + +/* entry points*/ +int WINAPI MwRegisterButtonControl(HINSTANCE hInstance); +int WINAPI MwRegisterListboxControl(HINSTANCE hInstance); +int WINAPI MwRegisterEditControl(HINSTANCE hInstance); +int WINAPI MwRegisterStaticControl(HINSTANCE hInstance); +int WINAPI MwRegisterProgressBarControl(HINSTANCE hInstance); +int WINAPI MwRegisterComboboxControl(HINSTANCE hInstance); +int WINAPI MwRegisterScrollbarControl(HINSTANCE hInstance); +int WINAPI MwRegisterMEditControl(HINSTANCE hInstance); + +/* temporarily in button.c*/ +void WINAPI CheckRadioButton(HWND hDlg, int nIDFirst,int nIDLast, + int nIDCheckButton); + +/* Dialog Codes*/ +#define DLGC_WANTARROWS 0x0001 /* Control wants arrow keys */ +#define DLGC_WANTTAB 0x0002 /* Control wants tab keys */ +#define DLGC_WANTALLKEYS 0x0004 /* Control wants all keys */ +#define DLGC_WANTMESSAGE 0x0004 /* Pass message to control */ +#define DLGC_HASSETSEL 0x0008 /* Understands EM_SETSEL message */ +#define DLGC_DEFPUSHBUTTON 0x0010 /* Default pushbutton */ +#define DLGC_UNDEFPUSHBUTTON 0x0020 /* Non-default pushbutton */ +#define DLGC_RADIOBUTTON 0x0040 /* Radio button */ +#define DLGC_WANTCHARS 0x0080 /* Want WM_CHAR messages */ +#define DLGC_STATIC 0x0100 /* Static item: don't include */ +#define DLGC_BUTTON 0x2000 /* Button item: can be checked */ + +/* Button Control Styles*/ +#define BS_PUSHBUTTON 0x00000000L +#define BS_DEFPUSHBUTTON 0x00000001L +#define BS_CHECKBOX 0x00000002L +#define BS_AUTOCHECKBOX 0x00000003L +#define BS_RADIOBUTTON 0x00000004L +#define BS_3STATE 0x00000005L +#define BS_AUTO3STATE 0x00000006L +#define BS_GROUPBOX 0x00000007L +#define BS_USERBUTTON 0x00000008L +#define BS_AUTORADIOBUTTON 0x00000009L +#define BS_OWNERDRAW 0x0000000BL +#define BS_LEFTTEXT 0x00000020L +#define BS_TEXT 0x00000000L +#define BS_ICON 0x00000040L +#define BS_BITMAP 0x00000080L +#define BS_LEFT 0x00000100L +#define BS_RIGHT 0x00000200L +#define BS_CENTER 0x00000300L +#define BS_TOP 0x00000400L +#define BS_BOTTOM 0x00000800L +#define BS_VCENTER 0x00000C00L +#define BS_PUSHLIKE 0x00001000L +#define BS_MULTILINE 0x00002000L +#define BS_NOTIFY 0x00004000L +#define BS_FLAT 0x00008000L +#define BS_RIGHTBUTTON BS_LEFTTEXT + +/* User Button Notification Codes*/ +#define BN_CLICKED 0 +#define BN_PAINT 1 +#define BN_HILITE 2 +#define BN_UNHILITE 3 +#define BN_DISABLE 4 +#define BN_DOUBLECLICKED 5 +#define BN_PUSHED BN_HILITE +#define BN_UNPUSHED BN_UNHILITE +#define BN_DBLCLK BN_DOUBLECLICKED +#define BN_SETFOCUS 6 +#define BN_KILLFOCUS 7 + +/* Button Control Messages*/ +#define BM_GETCHECK 0x00F0 +#define BM_SETCHECK 0x00F1 +#define BM_GETSTATE 0x00F2 +#define BM_SETSTATE 0x00F3 +#define BM_SETSTYLE 0x00F4 +#define BM_CLICK 0x00F5 +#define BM_GETIMAGE 0x00F6 +#define BM_SETIMAGE 0x00F7 + +#define BST_UNCHECKED 0x0000 +#define BST_CHECKED 0x0001 +#define BST_INDETERMINATE 0x0002 +#define BST_PUSHED 0x0004 +#define BST_FOCUS 0x0008 + +/* Progress Bar messages*/ +#define PBM_SETRANGE 0xF0A0 +#define PBM_SETSTEP 0xF0A1 +#define PBM_SETPOS 0xF0A2 +#define PBM_DELTAPOS 0xF0A3 +#define PBM_STEPIT 0xF0A4 + +/* Progress Bar styles */ +#define PBS_NOTIFY 0x0001L +#define PBS_VERTICAL 0x0002L + +/* Progress Bar notification code */ +#define PBN_REACHMAX 1 +#define PBN_REACHMIN 2 + +/* Listbox messages*/ +#define LB_ADDSTRING 0xF180 +#define LB_INSERTSTRING 0xF181 +#define LB_DELETESTRING 0xF182 +#define LB_SELITEMRANGEEX 0xF183 +#define LB_RESETCONTENT 0xF184 +#define LB_SETSEL 0xF185 +#define LB_SETCURSEL 0xF186 +#define LB_GETSEL 0xF187 +#define LB_GETCURSEL 0xF188 +#define LB_GETTEXT 0xF189 +#define LB_GETTEXTLEN 0xF18A +#define LB_GETCOUNT 0xF18B +#define LB_SELECTSTRING 0xF18C +#define LB_DIR 0xF18D +#define LB_GETTOPINDEX 0xF18E +#define LB_FINDSTRING 0xF18F +#define LB_GETSELCOUNT 0xF190 +#define LB_GETSELITEMS 0xF191 +#define LB_SETTABSTOPS 0xF192 +#define LB_GETHORIZONTALEXTENT 0xF193 +#define LB_SETHORIZONTALEXTENT 0xF194 +#define LB_SETCOLUMNWIDTH 0xF195 +#define LB_ADDFILE 0xF196 +#define LB_SETTOPINDEX 0xF197 +#define LB_GETITEMRECT 0xF198 +#define LB_GETITEMDATA 0xF199 +#define LB_SETITEMDATA 0xF19A +#define LB_SELITEMRANGE 0xF19B +#define LB_SETANCHORINDEX 0xF19C +#define LB_GETANCHORINDEX 0xF19D +#define LB_SETCARETINDEX 0xF19E +#define LB_GETCARETINDEX 0xF19F +#define LB_SETITEMHEIGHT 0xF1A0 +#define LB_GETITEMHEIGHT 0xF1A1 +#define LB_FINDSTRINGEXACT 0xF1A2 +#define LB_SETLOCALE 0xF1A5 +#define LB_GETLOCALE 0xF1A6 +#define LB_SETCOUNT 0xF1A7 +#define LB_INITSTORAGE 0xF1A8 +#define LB_ITEMFROMPOINT 0xF1A9 +#define LB_SETTEXT 0xF1AA +#define LB_GETCHECKMARK 0xF1AB +#define LB_SETCHECKMARK 0xF1AC +#define LB_GETITEMADDDATA 0xF1AD +#define LB_SETITEMADDDATA 0xF1AE +#define LB_MSGMAX 0xF1B0 + +/* Listbox styles */ +#define LBS_NOTIFY 0x0001L +#define LBS_SORT 0x0002L +#define LBS_NOREDRAW 0x0004L /* not supported*/ +#define LBS_MULTIPLESEL 0x0008L +#define LBS_OWNERDRAWFIXED 0x0010L /* nyi*/ +#define LBS_OWNERDRAWVARIABLE 0x0020L /* nyi*/ +#define LBS_HASSTRINGS 0x0040L /* not supported*/ +#define LBS_USETABSTOPS 0x0080L /* nyi*/ +#define LBS_NOINTEGRALHEIGHT 0x0100L /* not supported*/ +#define LBS_MULTICOLUMN 0x0200L /* nyi*/ +#define LBS_WANTKEYBOARDINPUT 0x0400L /* not supported*/ +#define LBS_EXTENDEDSEL 0x0800L /* not supported*/ +#define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER) +#define LBS_CHECKBOX 0x1000L /* non std*/ +#define LBS_USEICON 0x2000L /* non std*/ +#define LBS_AUTOCHECK 0x4000L /* non std*/ +#define LBS_AUTOCHECKBOX 0x5000L /* non std*/ +/* private Microwindows styles for combobox*/ +#define LBS_PRELOADED 0x4000L /* Microwindows private*/ +#define LBS_COMBOLBOX 0x8000L /* Microwindows private*/ + +#if 0 +#define LBS_DISABLENOSCROLL 0x1000L +#define LBS_NODATA 0x2000L +#define LBS_NOSEL 0x4000L +#endif + +/* Listbox Notification Codes */ +#define LBN_ERRSPACE (-2) +#define LBN_SELCHANGE 1 +#define LBN_DBLCLK 2 +#define LBN_SELCANCEL 3 +#define LBN_SETFOCUS 4 +#define LBN_KILLFOCUS 5 +#define LBN_CLICKCHECKMARK 6 /* non std*/ + +/* Listbox return value */ +#define LB_OKAY 0 +#define LB_ERR (-1) +#define LB_ERRSPACE (-2) + +/* Edit Control Notification Codes*/ +#define EN_SETFOCUS 0x0100 +#define EN_KILLFOCUS 0x0200 +#define EN_CHANGE 0x0300 +#define EN_UPDATE 0x0400 +#define EN_ERRSPACE 0x0500 +#define EN_MAXTEXT 0x0501 +#define EN_HSCROLL 0x0601 +#define EN_VSCROLL 0x0602 + +/* Edit Control Styles*/ +#define ES_LEFT 0x0000L +#define ES_CENTER 0x0001L +#define ES_RIGHT 0x0002L +#define ES_MULTILINE 0x0004L +#define ES_UPPERCASE 0x0008L +#define ES_LOWERCASE 0x0010L +#define ES_PASSWORD 0x0020L +#define ES_AUTOVSCROLL 0x0040L +#define ES_AUTOHSCROLL 0x0080L +#define ES_NOHIDESEL 0x0100L +#define ES_OEMCONVERT 0x0400L +#define ES_READONLY 0x0800L +#define ES_WANTRETURN 0x1000L +#define ES_NUMBER 0x2000L + +/* Edit Control Messages*/ +#define EM_GETSEL 0xF0B0 +#define EM_SETSEL 0xF0B1 +#define EM_GETRECT 0xF0B2 +#define EM_SETRECT 0xF0B3 +#define EM_SETRECTNP 0xF0B4 +#define EM_SCROLL 0xF0B5 +#define EM_LINESCROLL 0xF0B6 +#define EM_SCROLLCARET 0xF0B7 +#define EM_GETMODIFY 0xF0B8 +#define EM_SETMODIFY 0xF0B9 +#define EM_GETLINECOUNT 0xF0BA +#define EM_LINEINDEX 0xF0BB +#define EM_SETHANDLE 0xF0BC +#define EM_GETHANDLE 0xF0BD +#define EM_GETTHUMB 0xF0BE +#define EM_LINELENGTH 0xF0C1 +#define EM_REPLACESEL 0xF0C2 +#define EM_GETLINE 0xF0C4 +#define EM_LIMITTEXT 0xF0C5 +#define EM_CANUNDO 0xF0C6 +#define EM_UNDO 0xF0C7 +#define EM_FMTLINES 0xF0C8 +#define EM_LINEFROMCHAR 0xF0C9 +#define EM_SETTABSTOPS 0xF0CB +#define EM_SETPASSWORDCHAR 0xF0CC +#define EM_EMPTYUNDOBUFFER 0xF0CD +#define EM_GETFIRSTVISIBLELINE 0xF0CE +#define EM_SETREADONLY 0xF0CF +#define EM_SETWORDBREAKPROC 0xF0D0 +#define EM_GETWORDBREAKPROC 0xF0D1 +#define EM_GETPASSWORDCHAR 0xF0D2 +#define EM_SETMARGINS 0xF0D3 +#define EM_GETMARGINS 0xF0D4 +#define EM_SETLIMITTEXT EM_LIMITTEXT +#define EM_GETLIMITTEXT 0xF0D5 +#define EM_POSFROMCHAR 0xF0D6 +#define EM_CHARFROMPOS 0xF0D7 +#define EM_SETIMESTATUS 0xF0D8 +#define EM_GETIMESTATUS 0xF0D9 + +/* Static Control messages*/ +#define STM_SETICON 0xF170 +#define STM_GETICON 0xF171 +#define STM_SETIMAGE 0xF172 +#define STM_GETIMAGE 0xF173 +#define STM_MSGMAX 0xF174 + +/* Static Control notification code*/ +#define STN_CLICKED 0 +#define STN_DBLCLK 1 +#define STN_ENABLE 2 +#define STN_DISABLE 3 + +/* Static Control Styles */ +#define SS_LEFT 0x00000000L +#define SS_CENTER 0x00000001L +#define SS_RIGHT 0x00000002L +#define SS_ICON 0x00000003L +#define SS_BLACKRECT 0x00000004L +#define SS_GRAYRECT 0x00000005L +#define SS_WHITERECT 0x00000006L +#define SS_BLACKFRAME 0x00000007L +#define SS_GRAYFRAME 0x00000008L +#define SS_WHITEFRAME 0x00000009L +#define SS_GROUPBOX 0x0000000AL +#define SS_SIMPLE 0x0000000BL +#define SS_LEFTNOWORDWRAP 0x0000000CL +#define SS_OWNERDRAW 0x0000000DL +#define SS_BITMAP 0x0000000EL +#define SS_ENHMETAFILE 0x0000000FL +#define SS_TYPEMASK 0x0000000FL +#define SS_NOPREFIX 0x00000080L +#define SS_ETCHEDHORZ 0x00000010L +#define SS_ETCHEDVERT 0x00000011L +#define SS_ETCHEDFRAME 0x00000012L +#define SS_ETCTYPEMAKS 0x0000001FL +#define SS_NOTIFY 0x00000100L +#define SS_CENTERIMAGE 0x00000200L +#define SS_RIGHTJUST 0x00000400L +#define SS_REALSIZEIMAGE 0x00000800L +#define SS_SUNKEN 0x00001000L /* notimp*/ +#define SS_ENDELLIPSIS 0x00004000L /* notimp*/ +#define SS_PATHELLIPSIS 0x00008000L /* notimp*/ +#define SS_WORDELLIPSIS 0x0000C000L /* notimp*/ +#define SS_ELLIPSISMASK 0x0000C000L /* notimp*/ + +/* Combo Box styles*/ +#define CBS_SIMPLE 0x0001L +#define CBS_DROPDOWN 0x0002L +#define CBS_DROPDOWNLIST 0x0003L +#define CBS_OWNERDRAWFIXED 0x0010L +#define CBS_OWNERDRAWVARIABLE 0x0020L +#define CBS_AUTOHSCROLL 0x0040L +#define CBS_OEMCONVERT 0x0080L +#define CBS_SORT 0x0100L +#define CBS_HASSTRINGS 0x0200L +#define CBS_NOINTEGRALHEIGHT 0x0400L +#define CBS_DISABLENOSCROLL 0x0800L +#define CBS_UPPERCASE 0x2000L +#define CBS_LOWERCASE 0x4000L + +/* Combo box messages */ +#define CB_GETEDITSEL 0xF140 +#define CB_LIMITTEXT 0xF141 +#define CB_SETEDITSEL 0xF142 +#define CB_ADDSTRING 0xF143 +#define CB_DELETESTRING 0xF144 +#define CB_DIR 0xF145 +#define CB_GETCOUNT 0xF146 +#define CB_GETCURSEL 0xF147 +#define CB_GETLBTEXT 0xF148 +#define CB_GETLBTEXTLEN 0xF149 +#define CB_INSERTSTRING 0xF14A +#define CB_RESETCONTENT 0xF14B +#define CB_FINDSTRING 0xF14C +#define CB_SELECTSTRING 0xF14D +#define CB_SETCURSEL 0xF14E +#define CB_SHOWDROPDOWN 0xF14F +#define CB_GETITEMDATA 0xF150 +#define CB_SETITEMDATA 0xF151 +#define CB_GETDROPPEDCONTROLRECT 0xF152 +#define CB_SETITEMHEIGHT 0xF153 +#define CB_GETITEMHEIGHT 0xF154 +#define CB_SETEXTENDEDUI 0xF155 +#define CB_GETEXTENDEDUI 0xF156 +#define CB_GETDROPPEDSTATE 0xF157 +#define CB_FINDSTRINGEXACT 0xF158 +#define CB_SETLOCALE 0xF159 /* notimp*/ +#define CB_GETLOCALE 0xF15A /* notimp*/ +#define CB_GETTOPINDEX 0xF15b /* notimp*/ +#define CB_SETTOPINDEX 0xF15c /* notimp*/ +#define CB_GETHORIZONTALEXTENT 0xF15d /* notimp*/ +#define CB_SETHORIZONTALEXTENT 0xF15e /* notimp*/ +#define CB_GETDROPPEDWIDTH 0xF15f /* notimp*/ +#define CB_SETDROPPEDWIDTH 0xF160 /* notimp*/ +#define CB_INITSTORAGE 0xF161 /* notimp*/ +#define CB_MSGMAX 0xF162 + +/* Combo box notification codes */ +#define CBN_ERRSPACE (-1) +#define CBN_SELCHANGE 1 +#define CBN_DBLCLK 2 +#define CBN_SETFOCUS 3 +#define CBN_KILLFOCUS 4 +#define CBN_EDITCHANGE 5 +#define CBN_EDITUPDATE 6 +#define CBN_DROPDOWN 7 +#define CBN_CLOSEUP 8 +#define CBN_SELENDOK 9 +#define CBN_SELENDCANCEL 10 + +/* Combo box message return values */ +#define CB_OKAY 0 +#define CB_ERR (-1) +#define CB_ERRSPACE (-2) + +/* scroll bar control styles*/ +#define SBS_HORZ 0x0000L +#define SBS_VERT 0x0001L +#define SBS_TYPEMASK 0x0001L +#define SBS_TOPALIGN 0x0002L +#define SBS_LEFTALIGN 0x0002L +#define SBS_BOTTOMALIGN 0x0004L +#define SBS_RIGHTALIGN 0x0004L +#define SBS_SIZEBOXTOPLEFTALIGN 0x0002L +#define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L +#define SBS_SIZEBOX 0x0008L +#define SBS_SIZEGRIP 0x0010L + +/* scroll bar constants*/ +#define SB_HORZ 0 +#define SB_VERT 1 +#define SB_CTL 2 +#define SB_BOTH 3 + +/* scroll bar notify codes*/ +#define SB_LINEUP 0 +#define SB_LINELEFT 0 +#define SB_LINEDOWN 1 +#define SB_LINERIGHT 1 +#define SB_PAGEUP 2 +#define SB_PAGELEFT 2 +#define SB_PAGEDOWN 3 +#define SB_PAGERIGHT 3 +#define SB_THUMBPOSITION 4 +#define SB_THUMBTRACK 5 +#define SB_TOP 6 +#define SB_LEFT 6 +#define SB_BOTTOM 7 +#define SB_RIGHT 7 +#define SB_ENDSCROLL 8 + +#define SIF_RANGE 0x0001 +#define SIF_PAGE 0x0002 +#define SIF_POS 0x0004 +#define SIF_DISABLENOSCROLL 0x0008 +#define SIF_TRACKPOS 0x0010 +#define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS) + +typedef struct tagSCROLLINFO { + UINT cbSize; + UINT fMask; + int nMin; + int nMax; + UINT nPage; + int nPos; + int nTrackPos; +} SCROLLINFO, *LPSCROLLINFO; +typedef SCROLLINFO CONST *LPCSCROLLINFO; + +int WINAPI SetScrollInfo(HWND, int, LPCSCROLLINFO, BOOL); +BOOL WINAPI GetScrollInfo(HWND, int, LPSCROLLINFO); diff --git a/packages/services/gfx/mw/current/include/microwin/windef.h b/packages/services/gfx/mw/current/include/microwin/windef.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/windef.h @@ -0,0 +1,177 @@ +/* windef.h*/ +/* + * Copyright (c) 1999 Greg Haerr + * + * Win32 API base type definitions + */ + +#define _WINDEF_H + + +#ifdef VXWORKS +/* Don't include the internal Tornado header file , ** +** as the definitions in it conflict with these definitions. */ +#define __INCntcontexth +/* Bring in the core VxWorks definitions as they could conflict ** +** with the ones below if they are brought in later. */ +#include +#endif + + +#ifndef NULL +#define NULL ((void *)0) +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef NOMINMAX +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#endif /* NOMINMAX */ + +#define CALLBACK +#define WINAPI +#define WINAPIV +#define APIENTRY WINAPI +#define APIPRIVATE +#define PASCAL + +#define FAR +#define NEAR +#define CONST const +#define CDECL + +#define VOID void +typedef void *PVOID; +typedef char CHAR; +typedef short SHORT; +typedef long LONG; +typedef SHORT *PSHORT; +typedef LONG *PLONG; + +#ifndef VXWORKS +typedef unsigned char UCHAR; +typedef unsigned short USHORT; +typedef unsigned long ULONG; +typedef unsigned int UINT; + +#ifndef __ITRON_TYPES_h_ /* FIXME RTEMS hack*/ +#ifndef COMMON_H /* MiniGUI hack*/ +typedef int BOOL; +#endif +#endif + +#endif /* !VXWORKS*/ + +typedef ULONG * PULONG; +typedef USHORT * PUSHORT; +typedef UCHAR * PUCHAR; +typedef char * PSZ; +typedef int INT; +typedef unsigned int *PUINT; + +typedef unsigned long DWORD; +typedef unsigned char BYTE; +typedef unsigned short WORD; + +typedef float FLOAT; +typedef FLOAT *PFLOAT; +typedef BOOL NEAR *PBOOL; +typedef BOOL FAR *LPBOOL; +typedef BYTE NEAR *PBYTE; +typedef BYTE FAR *LPBYTE; +typedef int NEAR *PINT; +typedef int FAR *LPINT; +typedef WORD NEAR *PWORD; +typedef WORD FAR *LPWORD; +typedef long FAR *LPLONG; +typedef DWORD NEAR *PDWORD; +typedef DWORD FAR *LPDWORD; +typedef void FAR *LPVOID; +typedef CONST void FAR *LPCVOID; + +typedef unsigned short WCHAR; +typedef WCHAR *PWCHAR; +typedef WCHAR *LPWCH, *PWCH; +typedef CONST WCHAR *LPCWCH, *PCWCH; +typedef WCHAR *NWPSTR; +typedef WCHAR *LPWSTR, *PWSTR; +typedef CONST WCHAR *LPCWSTR, *PCWSTR; + +typedef CHAR *PCHAR; +typedef CHAR *LPCH, *PCH; +typedef CONST CHAR *LPCCH, *PCCH; +typedef CHAR *NPSTR; +typedef CHAR *LPSTR, *PSTR; +typedef CONST CHAR *LPCSTR, *PCSTR; +typedef char TCHAR, *PTCHAR; +typedef unsigned char TBYTE , *PTBYTE ; +typedef LPSTR LPTCH, PTCH; +typedef LPSTR PTSTR, LPTSTR; +typedef LPCSTR LPCTSTR; + +#define __TEXT(quote) quote +#define TEXT(quote) __TEXT(quote) + +typedef int (FAR WINAPI *FARPROC)(); +typedef int (NEAR WINAPI *NEARPROC)(); +typedef int (WINAPI *PROC)(); + +typedef UINT WPARAM; +typedef LONG LPARAM; +typedef LONG LRESULT; +typedef LONG HRESULT; + +#define MAKEWORD(a, b) ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8)) +#define MAKELONG(a, b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16)) +#define LOWORD(l) ((WORD)(l)) +#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF)) +#define LOBYTE(w) ((BYTE)(w)) +#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) + +#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i))) + +typedef DWORD COLORREF; +typedef DWORD *LPCOLORREF; + +/* handle typedef*/ +typedef PVOID HANDLE; + +typedef HANDLE *PHANDLE; +typedef HANDLE NEAR *SPHANDLE; +typedef HANDLE FAR *LPHANDLE; +typedef HANDLE HGLOBAL; +typedef HANDLE HLOCAL; +typedef HANDLE GLOBALHANDLE; +typedef HANDLE LOCALHANDLE; + +typedef WORD ATOM; + +typedef struct hwnd * HWND; +typedef struct hdc * HDC; +typedef struct hcursor *HCURSOR; +typedef struct hgdiobj *HGDIOBJ; +typedef struct hgdiobj *HBRUSH; +typedef struct hgdiobj *HPEN; +typedef struct hgdiobj *HFONT; +typedef struct hgdiobj *HBITMAP; +typedef struct hgdiobj *HRGN; +typedef struct hgdiobj *HPALETTE; +typedef HANDLE HICON; +typedef HANDLE HINSTANCE; +typedef HANDLE HMENU; + +/* moved to winuser.h for resource compiler*/ +/*typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);*/ + diff --git a/packages/services/gfx/mw/current/include/microwin/windows.h b/packages/services/gfx/mw/current/include/microwin/windows.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/windows.h @@ -0,0 +1,149 @@ +#ifndef _WINDOWS_H +#define _WINDOWS_H +/* windows.h*/ +/* + * Copyright (c) 1999, 2000 Greg Haerr + * + * Microwindows Win32 API master public header file + */ +#ifdef __cplusplus +extern "C" { +#endif + +#include "mwtypes.h" +#include "windef.h" +#include "wingdi.h" +#include "winfont.h" +#include "winkbd.h" +#include "winuser.h" /* now includes winctl.h for resource compiler*/ + +/* external routines*/ +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nShowCmd); + +int MwUserInit(int ac, char **av); + +/* Internal Microwindows non-win32 definitions*/ + +/* GDI Objects*/ + +typedef struct { /* GDI object hdr*/ + int type; /* OBJ_xxx type*/ + BOOL stockobj; /* TRUE if stock (unallocated) object*/ +} MWGDIOBJHDR; + +/* gdiobj*/ +struct hgdiobj { + MWGDIOBJHDR hdr; /* all gdi object start with this hdr*/ + /* additional data...*/ /* allocated per object type*/ +}; + +typedef struct { + MWGDIOBJHDR hdr; + int style; /* pen style*/ + COLORREF color; /* pen color*/ +} MWPENOBJ; + +typedef struct { + MWGDIOBJHDR hdr; + int style; /* brush style*/ + COLORREF color; /* brush color*/ +} MWBRUSHOBJ; + +typedef struct { + MWGDIOBJHDR hdr; + PMWFONT pfont; /* allocated font*/ + char name[32]; /* font name (stock objects only)*/ +} MWFONTOBJ; + +typedef struct { + MWGDIOBJHDR hdr; + int width; /* width*/ + int height; /* height*/ + int planes; /* # planes*/ + int bpp; /* bits per pixel*/ + int linelen; /* bytes per line*/ + int size; /* allocated size in bytes*/ + char bits[1]; /* beginning of bitmap*/ +} MWBITMAPOBJ; + +typedef struct { + MWGDIOBJHDR hdr; + MWCLIPREGION * rgn; /* clip region*/ +} MWRGNOBJ; + +/* device context*/ +struct hdc { + struct _mwscreendevice *psd; /* screen or memory device*/ + HWND hwnd; /* associated window*/ + DWORD flags; /* clipping flags*/ + int bkmode; /* background mode*/ + UINT textalign; /* text alignment flags*/ + MWCOLORVAL bkcolor; /* text background color*/ + MWCOLORVAL textcolor; /* text color*/ + MWBRUSHOBJ * brush; /* current brush*/ + MWPENOBJ * pen; /* current pen*/ + MWFONTOBJ * font; /* current font*/ + MWBITMAPOBJ * bitmap; /* current bitmap (mem dc's only)*/ + MWRGNOBJ * region; /* user specified clip region*/ + int drawmode; /* rop2 drawing mode */ + POINT pt; /* current pen pos in client coords*/ +}; + +/* cursor*/ +struct hcursor { + int usecount; /* use counter */ + MWCURSOR cursor; /* software cursor definition*/ +}; + +/* built-in scrollbars*/ +typedef struct { + int minPos; /* min value of scroll range.*/ + int maxPos; /* max value of scroll range.*/ + int curPos; /* current scroll pos.*/ + int pageStep; /* steps per page.*/ + int barStart; /* start pixel of bar.*/ + int barLen; /* length of bar.*/ + int status; /* status of scroll bar.*/ + RECT rc; /* screen coordinates position*/ +} MWSCROLLBARINFO, *PMWSCROLLBARINFO; + +/* window*/ +struct hwnd { + RECT winrect; /* window rect in screen coords*/ + RECT clirect; /* client rect in screen coords*/ + RECT restorerc; /* restore rect from maximized*/ + DWORD style; /* window style*/ + DWORD exstyle; /* window extended style*/ + PWNDCLASS pClass; /* window class*/ + struct hwnd *parent; /* z-order parent window */ + struct hwnd *owner; /* owner window*/ + struct hwnd *children; /* first child window */ + struct hwnd *siblings; /* next sibling window */ + struct hwnd *next; /* next window in complete list */ + struct hcursor *cursor; /* cursor for this window */ + struct hdc * owndc; /* owndc if CS_OWNDC*/ + int unmapcount; /* count of reasons not really mapped */ + int id; /* window id */ + CHAR szTitle[64]; /* window title*/ + int gotPaintMsg; /* window had WM_PAINT PostMessage*/ + int paintSerial; /* experimental serial # for alphblend*/ + int paintNC; /* experimental NC paint handling*/ + MWCLIPREGION * update; /* update region in screen coords*/ + DWORD userdata; /* setwindowlong user data*/ + DWORD userdata2; /* additional user data (will remove)*/ + MWSCROLLBARINFO hscroll; /* NC scrollbars*/ + MWSCROLLBARINFO vscroll; + int nextrabytes; /* # window extra bytes*/ + char extrabytes[1]; /* window extra bytes - must be last*/ +}; + +/* misc apis - will move to another header file*/ +DWORD WINAPI GetTickCount(VOID); +VOID WINAPI Sleep(DWORD dwMilliseconds); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINDOWS_H*/ diff --git a/packages/services/gfx/mw/current/include/microwin/windowsx.h b/packages/services/gfx/mw/current/include/microwin/windowsx.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/windowsx.h @@ -0,0 +1,55 @@ +#define HANDLE_WM_COMMAND(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), (int)(LOWORD(wParam)), (HWND)(lParam), (UINT)HIWORD(wParam)), 0L) +#define FORWARD_WM_COMMAND(hwnd, id, hwndCtl, codeNotify, fn) \ + (void)(fn)((hwnd), WM_COMMAND, MAKEWPARAM((UINT)(id),(UINT)(codeNotify)), (LPARAM)(HWND)(hwndCtl)) + +#define HANDLE_WM_CREATE(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), (LPCREATESTRUCT)(lParam)) ? 0L : (LRESULT)-1L) +#define FORWARD_WM_CREATE(hwnd, lpCreateStruct, fn) \ + (BOOL)(DWORD)(fn)((hwnd), WM_CREATE, 0L, (LPARAM)(LPCREATESTRUCT)(lpCreateStruct)) + +#define HANDLE_WM_DESTROY(hwnd, wParam, lParam, fn) \ + ((fn)(hwnd), 0L) +#define FORWARD_WM_DESTROY(hwnd, fn) \ + (void)(fn)((hwnd), WM_DESTROY, 0L, 0L) + +#define HANDLE_WM_ERASEBKGND(hwnd, wParam, lParam, fn) \ + (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HDC)(wParam)) +#define FORWARD_WM_ERASEBKGND(hwnd, hdc, fn) \ + (BOOL)(DWORD)(fn)((hwnd), WM_ERASEBKGND, (WPARAM)(HDC)(hdc), 0L) + +#define HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) +#define FORWARD_WM_LBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \ + (void)(fn)((hwnd), (fDoubleClick) ? WM_LBUTTONDBLCLK : WM_LBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y))) + +#define HANDLE_WM_LBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) + +#define HANDLE_WM_LBUTTONUP(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) +#define FORWARD_WM_LBUTTONUP(hwnd, x, y, keyFlags, fn) \ + (void)(fn)((hwnd), WM_LBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y))) + +#define HANDLE_WM_MOUSEMOVE(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) +#define FORWARD_WM_MOUSEMOVE(hwnd, x, y, keyFlags, fn) \ + (void)(fn)((hwnd), WM_MOUSEMOVE, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y))) + +#define HANDLE_WM_SETFOCUS(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), (HWND)(wParam)), 0L) +#define FORWARD_WM_SETFOCUS(hwnd, hwndOldFocus, fn) \ + (void)(fn)((hwnd), WM_SETFOCUS, (WPARAM)(HWND)(hwndOldFocus), 0L) + +#define HANDLE_WM_KILLFOCUS(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), (HWND)(wParam)), 0L) +#define FORWARD_WM_KILLFOCUS(hwnd, hwndNewFocus, fn) \ + (void)(fn)((hwnd), WM_KILLFOCUS, (WPARAM)(HWND)(hwndNewFocus), 0L) + +#define HANDLE_WM_SETTEXT(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), (LPCTSTR)(lParam)), 0L) +#define FORWARD_WM_SETTEXT(hwnd, lpszText, fn) \ + (void)(fn)((hwnd), WM_SETTEXT, 0L, (LPARAM)(LPCTSTR)(lpszText)) + +#define HANDLE_MSG(hwnd, message, fn) \ + case (message): return HANDLE_##message((hwnd), (wParam), (lParam), (fn)) diff --git a/packages/services/gfx/mw/current/include/microwin/winfont.h b/packages/services/gfx/mw/current/include/microwin/winfont.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/winfont.h @@ -0,0 +1,156 @@ +/* winfont.h*/ +/* + * Copyright (c) 2000 Greg Haerr + * + * Win32 font structures and API + */ + +/* tmPitchAndFamily flags*/ +#define TMPF_FIXED_PITCH 0x01 /* win32 bug: means variable*/ +#define TMPF_VECTOR 0x02 +#define TMPF_TRUETYPE 0x04 +#define TMPF_DEVICE 0x08 + +typedef struct tagTEXTMETRIC { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + BYTE tmFirstChar; + BYTE tmLastChar; + BYTE tmDefaultChar; + BYTE tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; +} TEXTMETRIC, *PTEXTMETRIC, NEAR *NPTEXTMETRIC, FAR *LPTEXTMETRIC; + +BOOL WINAPI GetTextMetrics(HDC hdc, LPTEXTMETRIC lptm); +BOOL WINAPI GetCharWidth(HDC hdc,UINT iFirstChar,UINT iLastChar,LPINT lpBuffer); +BOOL WINAPI GetTextExtentPoint(HDC hdc,LPCTSTR lpszStr,int cchString, + LPSIZE lpSize); +BOOL WINAPI GetTextExtentExPoint(HDC hdc,LPCTSTR lpszStr,int cchString, + int nMaxExtent,LPINT lpnFit,LPINT alpDx,LPSIZE lpSize); + +/* inherit logical font descriptor from engine*/ + +typedef struct { + LONG lfHeight; /* desired height in pixels*/ + LONG lfWidth; /* desired width in pixels or 0*/ + LONG lfEscapement; /* rotation in tenths of degree*/ + LONG lfOrientation; /* not used*/ + LONG lfWeight; /* font weight*/ + BYTE lfItalic; /* =1 for italic*/ + BYTE lfUnderline; /* =1 for underline*/ + BYTE lfStrikeOut; /* not used*/ + BYTE lfCharSet; /* font character set*/ + BYTE lfOutPrecision; /* font type selection*/ + BYTE lfClipPrecision; /* not used*/ + BYTE lfQuality; /* not used*/ + BYTE lfPitchAndFamily; /* font pitch and family*/ + CHAR lfFaceName[MWLF_FACESIZE]; /* font name, may be aliased*/ +} LOGFONT, *PLOGFONT, NEAR *NPLOGFONT, FAR *LPLOGFONT; + +#define LF_FACESIZE MWLF_FACESIZE + +/* font weights*/ +#define FW_DONTCARE MWLF_WEIGHT_DEFAULT +#define FW_THIN MWLF_WEIGHT_THIN +#define FW_EXTRALIGHT MWLF_WEIGHT_EXTRALIGHT +#define FW_LIGHT MWLF_WEIGHT_LIGHT +#define FW_NORMAL MWLF_WEIGHT_NORMAL +#define FW_MEDIUM MWLF_WEIGHT_MEDIUM +#define FW_SEMIBOLD MWLF_WEIGHT_DEMIBOLD +#define FW_BOLD MWLF_WEIGHT_BOLD +#define FW_EXTRABOLD MWLF_WEIGHT_EXTRABOLD +#define FW_HEAVY MWLF_WEIGHT_BLACK +#define FW_ULTRALIGHT FW_EXTRALIGHT +#define FW_REGULAR FW_NORMAL +#define FW_DEMIBOLD FW_SEMIBOLD +#define FW_ULTRABOLD FW_EXTRABOLD +#define FW_BLACK FW_HEAVY + +/* output precision - used for font selection*/ +#define OUT_DEFAULT_PRECIS MWLF_TYPE_DEFAULT +#define OUT_STRING_PRECIS 1 +#define OUT_CHARACTER_PRECIS 2 +#define OUT_STROKE_PRECIS 3 +#define OUT_TT_PRECIS MWLF_TYPE_SCALED +#define OUT_DEVICE_PRECIS MFLF_TYPE_RASTER +#define OUT_RASTER_PRECIS MFLF_TYPE_RASTER +#define OUT_TT_ONLY_PRECIS MWLF_TYPE_TRUETYPE +#define OUT_OUTLINE_PRECIS 8 +#define OUT_SCREEN_OUTLINE_PRECIS 9 + +/* clip precision - unused*/ +#define CLIP_DEFAULT_PRECIS 0 +#define CLIP_CHARACTER_PRECIS 1 +#define CLIP_STROKE_PRECIS 2 +#define CLIP_MASK 0xf +#define CLIP_LH_ANGLES (1<<4) +#define CLIP_TT_ALWAYS (2<<4) +#define CLIP_EMBEDDED (8<<4) + +/* output quality - unused*/ +#define DEFAULT_QUALITY 0 +#define DRAFT_QUALITY 1 +#define PROOF_QUALITY 2 +#define NONANTIALIASED_QUALITY 3 +#define ANTIALIASED_QUALITY 4 + +/* font charset*/ +#define ANSI_CHARSET MWLF_CHARSET_ANSI +#define DEFAULT_CHARSET MWLF_CHARSET_DEFAULT +#define SYMBOL_CHARSET 2 +#define OEM_CHARSET MWLF_CHARSET_OEM + +/* font pitch - lfPitchAndFamily*/ +#define MWLF_PITCH_DEFAULT 0 /* any pitch*/ +#define MWLF_PITCH_FIXED 1 /* fixed pitch*/ +#define MWLF_PITCH_VARIABLE 2 /* variable pitch*/ + +/* font pitch*/ +#define DEFAULT_PITCH MWLF_PITCH_DEFAULT +#define FIXED_PITCH MWLF_PITCH_FIXED +#define VARIABLE_PITCH MWLF_PITCH_VARIABLE +#define MONO_FONT 8 + +/* + * font family - lfPitchAndFamily + * + * MWF_FAMILY_SERIF - Times Roman, Century Schoolbook + * MWF_FAMILY_SANSSERIF - Helvetica, Swiss + * MWF_FAMILY_MODERN - Pica, Elite, Courier + */ +#define MWLF_FAMILY_DEFAULT (0<<4) /* any family*/ +#define MWLF_FAMILY_SERIF (1<<4) /* variable stroke width, serif*/ +#define MWLF_FAMILY_SANSSERIF (2<<4) /* variable stroke width, sans-serif*/ +#define MWLF_FAMILY_MODERN (3<<4) /* constant stroke width*/ + +/* add definitions here for font mapper extensions*/ +#define MWLF_FAMILY_BITSTREAM (6<<4) /* bitstream*/ +#define MWLF_FAMILY_ADOBE (7<<4) /* adobe*/ + +/* font family*/ +#define FF_DONTCARE MWLF_FAMILY_DEFAULT +#define FF_ROMAN MWLF_FAMILY_SERIF +#define FF_SWISS MWLF_FAMILY_SANSSERIF +#define FF_MODERN MWLF_FAMILY_MODERN +#define FF_SCRIPT (4<<4) /* Cursive, etc. */ +#define FF_DECORATIVE (5<<4) /* Old English, etc. */ + +HFONT WINAPI CreateFont(int nHeight, int nWidth, int nEscapement, + int nOrientation, int fnWeight, DWORD fdwItalic, + DWORD fdwUnderline, DWORD fdwStrikeOut,DWORD fdwCharSet, + DWORD fdwOutputPrecision,DWORD fdwClipPrecision, + DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCSTR lpszFace); +HFONT WINAPI CreateFontIndirect(CONST LOGFONT *lplf); diff --git a/packages/services/gfx/mw/current/include/microwin/wingdi.h b/packages/services/gfx/mw/current/include/microwin/wingdi.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/wingdi.h @@ -0,0 +1,396 @@ +/* wingdi.h*/ +/* + * Copyright (c) 1999,2000,2001 Greg Haerr + * + * Win32 GDI structures and API + */ + +/* portable coordinate definition*/ +typedef MWCOORD GDICOORD; + +/* inherit RECT and POINT from mwtypes.h*/ +typedef MWRECT RECT; +typedef MWPOINT POINT; + +#if 0000 +typedef struct tagRECT { + GDICOORD left; + GDICOORD top; + GDICOORD right; + GDICOORD bottom; +} RECT; + +typedef struct tagPOINT { + GDICOORD x; + GDICOORD y; +} POINT; +#endif + +typedef RECT NEAR *PRECT, FAR *LPRECT; + +typedef POINT NEAR *PPOINT, FAR *LPPOINT; + +typedef struct tagSIZE { + GDICOORD cx; + GDICOORD cy; +} SIZE, NEAR *PSIZE, FAR *LPSIZE; + +/* GetDCEx flags*/ +#define DCX_WINDOW 0x00000001L +#define DCX_CACHE 0x00000002L +#define DCX_NORESETATTRS 0x00000004L +#define DCX_CLIPCHILDREN 0x00000008L +#define DCX_CLIPSIBLINGS 0x00000010L +#define DCX_PARENTCLIP 0x00000020L +#define DCX_EXCLUDERGN 0x00000040L +#define DCX_INTERSECTRGN 0x00000080L +#define DCX_EXCLUDEUPDATE 0x00000100L +#define DCX_INTERSECTUPDATE 0x00000200L +#define DCX_LOCKWINDOWUPDATE 0x00000400L +#define DCX_VALIDATE 0x00200000L +#define DCX_DEFAULTCLIP 0x80000000L /* microwin only*/ + +HDC WINAPI GetDCEx(HWND hwnd,HRGN hrgnClip,DWORD flags); +HDC WINAPI GetDC(HWND hWnd); +HDC WINAPI GetWindowDC(HWND hWnd); +int WINAPI ReleaseDC(HWND hWnd, HDC hDC); +BOOL WINAPI DeleteDC(HDC hdc); + +typedef struct tagPAINTSTRUCT { + HDC hdc; + BOOL fErase; /* indicates bkgnd needs erasing*/ + RECT rcPaint; /* nyi*/ + BOOL fRestore; /* nyi*/ + BOOL fIncUpdate; /* nyi*/ + BYTE rgbReserved[32]; +} PAINTSTRUCT, *PPAINTSTRUCT, *NPPAINTSTRUCT, FAR *LPPAINTSTRUCT; + +HDC WINAPI BeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint); +BOOL WINAPI EndPaint(HWND hWnd, CONST PAINTSTRUCT *lpPaint); + +#define RGB(r,g,b) MWRGB(r,g,b) +#define GetRValue(rgb) ((BYTE)(rgb)) +#define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8)) +#define GetBValue(rgb) ((BYTE)((rgb)>>16)) + +/* Background Modes */ +#define TRANSPARENT 1 +#define OPAQUE 2 + +/* Text Alignment*/ +#define TA_NOUPDATECP 0 +#define TA_UPDATECP 1 + +#define TA_LEFT 0 +#define TA_RIGHT 2 +#define TA_CENTER 6 + +#define TA_TOP 0 +#define TA_BOTTOM 8 +#define TA_BASELINE 24 +#define TA_RTLREADING 256 +#define TA_MASK (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING) + +COLORREF WINAPI SetTextColor(HDC, COLORREF); +COLORREF WINAPI SetBkColor(HDC, COLORREF); +int WINAPI SetBkMode(HDC, int); +UINT WINAPI SetTextAlign(HDC hdc, UINT fMode); + +/* Binary raster ops*/ +#define R2_BLACK (MWMODE_CLEAR+1) /* 0 */ +#define R2_NOTMERGEPEN (MWMODE_NOR+1) /* DPon */ +#define R2_MASKNOTPEN (MWMODE_ANDINVERTED+1) /* DPna */ +#define R2_NOTCOPYPEN (MWMODE_COPYINVERTED+1) /* Pn */ +#define R2_MASKPENNOT (MWMODE_ANDREVERSE+1) /* PDna */ +#define R2_NOT (MWMODE_INVERT+1) /* Dn */ +#define R2_XORPEN (MWMODE_XOR+1) /* DPx */ +#define R2_NOTMASKPEN (MWMODE_NAND+1) /* DPan */ +#define R2_MASKPEN (MWMODE_AND+1) /* DPa */ +#define R2_NOTXORPEN (MWMODE_EQUIV+1) /* DPxn */ +#define R2_NOP (MWMODE_NOOP+1) /* D */ +#define R2_MERGENOTPEN (MWMODE_ORINVERTED+1) /* DPno */ +#define R2_COPYPEN (MWMODE_COPY+1) /* P */ +#define R2_MERGEPENNOT (MWMODE_ORREVERSE+1) /* PDno */ +#define R2_MERGEPEN (MWMODE_OR+1) /* DPo */ +#define R2_WHITE (MWMODE_SETTO1+1) /* 1 */ +#define R2_LAST 16 + +int WINAPI SetROP2(HDC hdc, int fnDrawMode); + +#define GDI_ERROR (0xFFFFFFFFL) +#define CLR_INVALID 0xFFFFFFFF + +COLORREF WINAPI GetPixel(HDC hdc, int x, int y); +COLORREF WINAPI SetPixel(HDC hdc, int x, int y, COLORREF crColor); +BOOL WINAPI MoveToEx(HDC hdc, int x, int y, LPPOINT lpPoint); +BOOL WINAPI LineTo(HDC hdc, int x, int y); +BOOL WINAPI Polyline(HDC hdc, CONST POINT *lppt, int cPoints); +BOOL WINAPI PolyPolygon(HDC hdc, CONST POINT *lpPoints, LPINT lpPolyCounts, + int nCount); +BOOL WINAPI Rectangle(HDC hdc, int nLeft, int nTop, int nRight,int nBottom); +BOOL WINAPI Ellipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, + int nBottomRect); +BOOL WINAPI Arc(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, + int nBottomRect, int nXStartArc, int nYStartArc, + int nXEndArc, int nYEndArc); +BOOL WINAPI Pie(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, + int nBottomRect, int nXRadial1, int nYRadial1, + int nXRadial2, int nYRadial2); +BOOL WINAPI Polygon(HDC hdc, CONST POINT *lpPoints, int nCount); +int WINAPI FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr); + +/* ExTextOut options*/ +#define ETO_OPAQUE 0x0002 +#define ETO_CLIPPED 0x0004 /* nyi*/ + +BOOL WINAPI TextOut(HDC hdc, int x, int y, LPCSTR lpszString, int cbString); +BOOL WINAPI ExtTextOut(HDC hdc, int x, int y, UINT fuOptions, + CONST RECT *lprc, LPCSTR lpszString, UINT cbCount, + CONST INT *lpDx); +BOOL WINAPI ExtTextOutW(HDC hdc, int x, int y, UINT fuOptions, + CONST RECT *lprc, LPCWSTR lpszString, UINT cbCount, + CONST INT *lpDx); + +/* DrawText options*/ +#define DT_TOP 0x00000000 +#define DT_LEFT 0x00000000 +#define DT_CENTER 0x00000001 +#define DT_RIGHT 0x00000002 +#define DT_VCENTER 0x00000004 +#define DT_BOTTOM 0x00000008 +#define DT_WORDBREAK 0x00000010 +#define DT_SINGLELINE 0x00000020 +#define DT_EXPANDTABS 0x00000040 +#define DT_TABSTOP 0x00000080 +#define DT_NOCLIP 0x00000100 +#define DT_EXTERNALLEADING 0x00000200 +#define DT_CALCRECT 0x00000400 +#define DT_NOPREFIX 0x00000800 +#define DT_INTERNAL 0x00001000 +#define DT_EDITCONTROL 0x00002000 +#define DT_PATH_ELLIPSIS 0x00004000 +#define DT_END_ELLIPSIS 0x00008000 +#define DT_MODIFYSTRING 0x00010000 +#define DT_RTLREADING 0x00020000 +#define DT_WORD_ELLIPSIS 0x00040000 + +int WINAPI DrawTextA(HDC hdc, LPCSTR lpString, int nCount, LPRECT lpRect, + UINT uFormat); +int WINAPI DrawTextW(HDC hdc, LPCWSTR lpString, int nCount, LPRECT lpRect, + UINT uFormat); +#define DrawText DrawTextA + +BOOL WINAPI DrawDIB(HDC hdc,int x, int y,PMWIMAGEHDR pimage); /* microwin*/ + +/* GetSysColor, FillRect colors*/ +#define COLOR_SCROLLBAR 0 +#define COLOR_BACKGROUND 1 +#define COLOR_ACTIVECAPTION 2 +#define COLOR_INACTIVECAPTION 3 +#define COLOR_MENU 4 +#define COLOR_WINDOW 5 +#define COLOR_WINDOWFRAME 6 +#define COLOR_MENUTEXT 7 +#define COLOR_WINDOWTEXT 8 +#define COLOR_CAPTIONTEXT 9 +#define COLOR_ACTIVEBORDER 10 +#define COLOR_INACTIVEBORDER 11 +#define COLOR_APPWORKSPACE 12 +#define COLOR_HIGHLIGHT 13 +#define COLOR_HIGHLIGHTTEXT 14 +#define COLOR_BTNFACE 15 +#define COLOR_BTNSHADOW 16 +#define COLOR_GRAYTEXT 17 +#define COLOR_BTNTEXT 18 +#define COLOR_INACTIVECAPTIONTEXT 19 +#define COLOR_BTNHIGHLIGHT 20 +#define COLOR_3DDKSHADOW 21 +#define COLOR_3DLIGHT 22 +#define COLOR_INFOTEXT 23 +#define COLOR_INFOBK 24 +#define COLOR_DESKTOP COLOR_BACKGROUND +#define COLOR_3DFACE COLOR_BTNFACE +#define COLOR_3DSHADOW COLOR_BTNSHADOW +#define COLOR_3DHIGHLIGHT COLOR_BTNHIGHLIGHT +#define COLOR_3DHILIGHT COLOR_BTNHIGHLIGHT +#define COLOR_BTNHILIGHT COLOR_BTNHIGHLIGHT +#define COLOR_ALTERNATEBUTTONFACE 25 +#define COLOR_HOTLIGHT 26 +#define COLOR_GRADIENTACTIVECAPTION 27 +#define COLOR_GRADIENTINACTIVECAPTION 28 + +DWORD WINAPI GetSysColor(int nIndex); +COLORREF WINAPI SetSysColor(int nIndex, COLORREF crColor);/* Microwindows only*/ + +/* Stock Logical Objects */ +#define WHITE_BRUSH 0 +#define LTGRAY_BRUSH 1 +#define GRAY_BRUSH 2 +#define DKGRAY_BRUSH 3 +#define BLACK_BRUSH 4 +#define NULL_BRUSH 5 +#define HOLLOW_BRUSH NULL_BRUSH +#define WHITE_PEN 6 +#define BLACK_PEN 7 +#define NULL_PEN 8 +#define OEM_FIXED_FONT 10 +#define ANSI_FIXED_FONT 11 +#define ANSI_VAR_FONT 12 +#define SYSTEM_FONT 13 +#define DEVICE_DEFAULT_FONT 14 +#define DEFAULT_PALETTE 15 +#define SYSTEM_FIXED_FONT 16 +#define DEFAULT_GUI_FONT 17 +#define DC_BRUSH 18 +#define DC_PEN 19 +#define STOCK_LAST 19 + +/* Object types*/ +#define OBJ_PEN 1 +#define OBJ_BRUSH 2 +#define OBJ_DC 3 +#define OBJ_METADC 4 +#define OBJ_PAL 5 +#define OBJ_FONT 6 +#define OBJ_BITMAP 7 +#define OBJ_REGION 8 +#define OBJ_METAFILE 9 +#define OBJ_MEMDC 10 +#define OBJ_EXTPEN 11 +#define OBJ_ENHMETADC 12 +#define OBJ_ENHMETAFILE 13 + +HGDIOBJ WINAPI GetStockObject(int nObject); +HGDIOBJ WINAPI SelectObject(HDC hdc, HGDIOBJ hObject); +BOOL WINAPI DeleteObject(HGDIOBJ hObject); +int WINAPI SelectClipRgn(HDC hdc, HRGN hrgn); +int WINAPI ExtSelectClipRgn(HDC hdc, HRGN hrgn, int fnMode); +int WINAPI GetUpdateRgn(HWND hwnd, HRGN hrgn, BOOL bErase); +BOOL WINAPI GetUpdateRect(HWND hwnd, LPRECT lpRect, BOOL bErase); + +/* Brush Styles */ +#define BS_SOLID 0 +#define BS_NULL 1 +#define BS_HOLLOW BS_NULL + +HBRUSH WINAPI CreateSolidBrush(COLORREF crColor); + +/* Pen Styles */ +#define PS_SOLID 0 +#define PS_NULL 5 + +HPEN WINAPI CreatePen(int nPenStyle, int nWidth, COLORREF crColor); + +HBITMAP WINAPI CreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight); +HDC WINAPI CreateCompatibleDC(HDC hdc); + +/* BitBlit raster opcodes*/ +#define SRCCOPY (DWORD)MWROP_COPY /* source */ +#define SRCPAINT (DWORD)MWROP_OR /* source OR dest */ +#define SRCAND (DWORD)MWROP_AND /* source AND dest */ +#define SRCINVERT (DWORD)MWROP_XOR /* source XOR dest */ +#define SRCERASE (DWORD)MWROP_ANDREVERSE /* source AND (NOT dest ) */ +#define NOTSRCCOPY (DWORD)MWROP_COPYINVERTED /* (NOT source) */ +#define NOTSRCERASE (DWORD)MWROP_NOR /* (NOT src) AND (NOT dest) */ +#define MERGEPAINT (DWORD)MWROP_ORINVERTED /* (NOT source) OR dest */ +#define DSTINVERT (DWORD)MWROP_INVERT /* (NOT dest) */ +#define BLACKNESS (DWORD)MWROP_CLEAR /* BLACK */ +#define WHITENESS (DWORD)MWROP_SET /* WHITE */ +#if 0 +#define MERGECOPY (DWORD)0x00C000CA /* (source AND pattern) */ +#define PATCOPY (DWORD)0x00F00021 /* pattern */ +#define PATPAINT (DWORD)0x00FB0A09 /* DPSnoo */ +#define PATINVERT (DWORD)0x005A0049 /* pattern XOR dest */ +#endif + +BOOL WINAPI BitBlt(HDC hdcDest,int nXDest,int nYDest,int nWidth,int nHeight, + HDC hdcSrc,int nXSrc,int nYSrc,DWORD dwRop); +BOOL WINAPI StretchBlt(HDC hdcDest,int nXOriginDest,int nYOriginDest, + int nWidthDest,int nHeightDest,HDC hdcSrc, + int nXOriginSrc,int nYOriginSrc,int nWidthSrc, + int nHeightSrc, DWORD dwRop); + +/* Palette entry flags*/ +#define PC_RESERVED 0x01 +#define PC_EXPLICIT 0x02 +#define PC_NOCOLLAPSE 0x04 + +typedef struct tagPALETTEENTRY { + BYTE peRed; + BYTE peGreen; + BYTE peBlue; + BYTE peFlags; +} PALETTEENTRY, *PPALETTEENTRY, FAR *LPPALETTEENTRY; + +UINT WINAPI GetSystemPaletteEntries(HDC hdc,UINT iStartIndex,UINT nEntries, + LPPALETTEENTRY lppe); + +/* GetDeviceCaps parameters*/ +#define HORZRES 8 /* Horizontal width in pixels */ +#define VERTRES 10 /* Vertical height in pixels */ +#define BITSPIXEL 12 /* Number of bits per pixel */ +#define PLANES 14 /* Number of planes */ +#define LOGPIXELSX 88 /* Logical pixels/inch in X */ +#define LOGPIXELSY 90 /* Logical pixels/inch in Y */ +#define SIZEPALETTE 104 /* Number of entries in physical palette */ + +int WINAPI GetDeviceCaps(HDC hdc, int nIndex); + +/* Region flags*/ +#define ERRORREGION MWREGION_ERROR +#define NULLREGION MWREGION_NULL +#define SIMPLEREGION MWREGION_SIMPLE +#define COMPLEXREGION MWREGION_COMPLEX +/* kluge for VxWorks*/ +#ifdef ERROR +#undef ERROR +#endif +#define ERROR ERRORREGION +#define RGN_ERROR ERRORREGION + +/* CombineRgn() Styles */ +#define RGN_AND 1 +#define RGN_OR 2 +#define RGN_XOR 3 +#define RGN_DIFF 4 +#define RGN_COPY 5 +#define RGN_MIN RGN_AND +#define RGN_MAX RGN_COPY + +/* GetRegionData/ExtCreateRegion */ +#define RDH_RECTANGLES 1 +typedef struct _RGNDATAHEADER { + DWORD dwSize; + DWORD iType; + DWORD nCount; + DWORD nRgnSize; + RECT rcBound; +} RGNDATAHEADER, *PRGNDATAHEADER; + +typedef struct _RGNDATA { + RGNDATAHEADER rdh; + char Buffer[1]; +} RGNDATA, *PRGNDATA, *NPRGNDATA, *LPRGNDATA; + +/* Region entry points*/ +INT WINAPI OffsetRgn(HRGN hrgn, INT x, INT y ); +INT WINAPI GetRgnBox(HRGN hrgn, LPRECT rect ); +HRGN WINAPI CreateRectRgn(INT left, INT top, INT right, INT bottom); +HRGN WINAPI CreateRectRgnIndirect(const RECT* rect ); +VOID WINAPI SetRectRgn(HRGN hrgn, INT left, INT top, INT right, INT bottom ); +HRGN WINAPI CreateRoundRectRgn(INT left, INT top, INT right, INT bottom, + INT ellipse_width, INT ellipse_height ); +HRGN WINAPI CreateEllipticRgn(INT left, INT top, INT right, INT bottom ); +HRGN WINAPI CreateEllipticRgnIndirect(const RECT *rect ); +DWORD WINAPI GetRegionData(HRGN hrgn, DWORD count, LPRGNDATA rgndata); +BOOL WINAPI PtInRegion(HRGN hrgn, INT x, INT y ); +BOOL WINAPI RectInRegion(HRGN hrgn, const RECT *rect ); +BOOL WINAPI EqualRgn(HRGN hrgn1, HRGN hrgn2 ); +INT WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode); + +/* Rect entry points*/ +BOOL WINAPI IntersectRect(LPRECT dest, const RECT *src1, const RECT *src2 ); +BOOL WINAPI UnionRect(LPRECT dest, const RECT *src1, const RECT *src2 ); +BOOL WINAPI EqualRect(const RECT* rect1, const RECT* rect2 ); +BOOL WINAPI SubtractRect(LPRECT dest, const RECT *src1, const RECT *src2 ); + diff --git a/packages/services/gfx/mw/current/include/microwin/winkbd.h b/packages/services/gfx/mw/current/include/microwin/winkbd.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/winkbd.h @@ -0,0 +1,128 @@ +/* winkbd.h*/ +/* + * Copyright (c) 2000 Greg Haerr + * + * Win32 keyboard defines and API + */ + +/* virtual key codes*/ +#define VK_LBUTTON 0x01 +#define VK_RBUTTON 0x02 +#define VK_CANCEL 0x03 /* ctrl-break*/ +#define VK_MBUTTON 0x04 +#define VK_BACK 0x08 /* backspace*/ +#define VK_TAB 0x09 +#define VK_CLEAR 0x0C /* kp5 w/numlock off*/ +#define VK_RETURN 0x0D +#define VK_SHIFT 0x10 /* either shift*/ +#define VK_CONTROL 0x11 /* either control*/ +#define VK_MENU 0x12 /* alt*/ +#define VK_PAUSE 0x13 +#define VK_CAPITAL 0x14 /* caps lock*/ +#define VK_KANA 0x15 +#define VK_HANGEUL VK_KANA +#define VK_HANGUL 0x15 +#define VK_JUNJA 0x17 +#define VK_FINAL 0x18 +#define VK_HANJA 0x19 +#define VK_KANJI 0x19 +#define VK_ESCAPE 0x1B /* esc*/ +#define VK_CONVERT 0x1C +#define VK_NONCONVERT 0x1D +#define VK_ACCEPT 0x1E +#define VK_MODECHANGE 0x1F +#define VK_SPACE 0x20 /* spacebar*/ +#define VK_PRIOR 0x21 /* page up*/ +#define VK_NEXT 0x22 /* page dn*/ +#define VK_END 0x23 +#define VK_HOME 0x24 +#define VK_LEFT 0x25 +#define VK_UP 0x26 +#define VK_RIGHT 0x27 +#define VK_DOWN 0x28 +#define VK_SELECT 0x29 +#define VK_PRINT 0x2A +#define VK_EXECUTE 0x2B +#define VK_SNAPSHOT 0x2C +#define VK_INSERT 0x2D +#define VK_DELETE 0x2E +#define VK_HELP 0x2F + +/* 0x30 - 0x39 ASCII 0 - 9*/ +/* 0x41 - 0x5a ASCII A - Z*/ + +#define VK_LWIN 0x5B +#define VK_RWIN 0x5C +#define VK_APPS 0x5D + +/* numeric keypad keys*/ +#define VK_NUMPAD0 0x60 +#define VK_NUMPAD1 0x61 +#define VK_NUMPAD2 0x62 +#define VK_NUMPAD3 0x63 +#define VK_NUMPAD4 0x64 +#define VK_NUMPAD5 0x65 +#define VK_NUMPAD6 0x66 +#define VK_NUMPAD7 0x67 +#define VK_NUMPAD8 0x68 +#define VK_NUMPAD9 0x69 +#define VK_MULTIPLY 0x6A /* kp * */ +#define VK_ADD 0x6B /* kp + */ +#define VK_SEPARATOR 0x6C +#define VK_SUBTRACT 0x6D /* kp - */ +#define VK_DECIMAL 0x6E /* kp . */ +#define VK_DIVIDE 0x6F /* kp / */ + +#define VK_F1 0x70 +#define VK_F2 0x71 +#define VK_F3 0x72 +#define VK_F4 0x73 +#define VK_F5 0x74 +#define VK_F6 0x75 +#define VK_F7 0x76 +#define VK_F8 0x77 +#define VK_F9 0x78 +#define VK_F10 0x79 +#define VK_F11 0x7A +#define VK_F12 0x7B +#define VK_F13 0x7C +#define VK_F14 0x7D +#define VK_F15 0x7E +#define VK_F16 0x7F +#define VK_F17 0x80 +#define VK_F18 0x81 +#define VK_F19 0x82 +#define VK_F20 0x83 +#define VK_F21 0x84 +#define VK_F22 0x85 +#define VK_F23 0x86 +#define VK_F24 0x87 +#define VK_NUMLOCK 0x90 /* num lock*/ +#define VK_SCROLL 0x91 /* scroll lock*/ + +/* param to GetAsyncKeyState and GetKeyState only*/ +#define VK_LSHIFT 0xA0 +#define VK_RSHIFT 0xA1 +#define VK_LCONTROL 0xA2 +#define VK_RCONTROL 0xA3 +#define VK_LMENU 0xA4 +#define VK_RMENU 0xA5 + +#define VK_PROCESSKEY 0xE5 +#define VK_ATTN 0xF6 +#define VK_CRSEL 0xF7 +#define VK_EXSEL 0xF8 +#define VK_EREOF 0xF9 +#define VK_PLAY 0xFA +#define VK_ZOOM 0xFB +#define VK_NONAME 0xFC +#define VK_PA1 0xFD +#define VK_OEM_CLEAR 0xFE + +/* WM_KEYUP/WM_KEYDOWN/WM_CHAR hiword lparam flags*/ +#define KF_EXTENDED 0x0100 +#define KF_DLGMODE 0x0800 +#define KF_MENUMODE 0x1000 +#define KF_ALTDOWN 0x2000 +#define KF_REPEAT 0x4000 +#define KF_UP 0x8000 diff --git a/packages/services/gfx/mw/current/include/microwin/wintern.h b/packages/services/gfx/mw/current/include/microwin/wintern.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/wintern.h @@ -0,0 +1,134 @@ +/* wintern.h*/ +/* + * Copyright (c) 1999 Greg Haerr + * + * Microwindows internal routines header file + */ +#include + +#if (UNIX | DOS_DJGPP) +#define strcmpi strcasecmp +#elif (VXWORKS) +int strcmpi(const char *s1, const char *s2); +#endif + +#ifdef __PACIFIC__ +#define strcmpi stricmp +#endif + +#define DBLCLICKSPEED 750 /* mouse dblclik speed msecs (was 450)*/ + +/* gotPaintMsg values*/ +#define PAINT_PAINTED 0 /* WM_PAINT msg has been processed*/ +#define PAINT_NEEDSPAINT 1 /* WM_PAINT seen, paint when can*/ +#define PAINT_DELAYPAINT 2 /* WM_PAINT seen,paint after user move*/ + +/* non-win32 api access for microwin*/ +BOOL MwSetDesktopWallpaper(PMWIMAGEHDR pImage); +void MwRegisterFdInput(HWND hwnd,int fd); +void MwUnregisterFdInput(HWND hwnd,int fd); +void MwRegisterFdOutput(HWND hwnd,int fd); +void MwUnregisterFdOutput(HWND hwnd,int fd); +void MwRegisterFdExcept(HWND hwnd,int fd); +void MwUnregisterFdExcept(HWND hwnd,int fd); + +/* internal routines*/ + +/* winuser.c*/ +PWNDCLASS MwFindClassByName(LPCSTR lpClassName); +void MwDestroyWindow(HWND hwnd,BOOL bSendMsg); +HWND MwGetTopWindow(HWND hwnd); +void MwCalcClientRect(HWND hwnd); +void MwSendSizeMove(HWND hwnd, BOOL bSize, BOOL bMove); +void MwSetCursor(HWND wp, PMWCURSOR pcursor); + +/* wingdi.c*/ +#define MwIsClientDC(hdc) (((hdc)->flags & DCX_WINDOW) == 0) +#define MwIsMemDC(hdc) ((hdc)->psd->flags == PSF_MEMORY) +void MwPaintNCArea(HWND hwnd); +HWND MwPrepareDC(HDC hdc); +void MwSetClipWindow(HDC hdc); + +/* winsbar.c*/ +void MwAdjustNCScrollbars(HWND hwnd); +void MwPaintNCScrollbars(HWND hwnd, HDC hdc); +void MwHandleNCMessageScrollbar(HWND hwnd, UINT msg, WPARAM hitcode, + LPARAM lParam); + +/* winexpos.c*/ +void MwRedrawScreen(void); +void MwHideWindow(HWND hwnd,BOOL bChangeFocus,BOOL bSendMsg); +void MwShowWindow(HWND hwnd,BOOL bSendMsg); +void MwRaiseWindow(HWND hwnd); +void MwLowerWindow(HWND hwnd); +BOOL MwCheckOverlap(HWND topwp, HWND botwp); +void MwClearWindow(HWND wp,MWCOORD x,MWCOORD y,MWCOORD width, + MWCOORD height,BOOL exposeflag); +void MwExposeArea(HWND wp, MWCOORD rootx,MWCOORD rooty, + MWCOORD width,MWCOORD height); +/* winevent.c*/ +BOOL MwCheckMouseEvent(void); +BOOL MwCheckKeyboardEvent(void); +void MwHandleMouseStatus(MWCOORD newx, MWCOORD newy, int newbuttons); +void MwTranslateMouseMessage(HWND hwnd,UINT msg,int hittest); +void MwDeliverMouseEvent(int buttons, int changebuttons, + MWKEYMOD modifiers); +void MwDeliverKeyboardEvent(MWKEY keyvalue, MWKEYMOD modifiers, + MWSCANCODE scancode, BOOL pressed); +void MwDeliverExposureEvent(HWND wp, MWCOORD x, MWCOORD y, + MWCOORD width,MWCOORD height); +void MwUnionUpdateRegion(HWND wp, MWCOORD x, MWCOORD y, + MWCOORD width,MWCOORD height, BOOL bUnion); +void MwMoveCursor(MWCOORD x, MWCOORD y); +void MwCheckCursor(void); +HWND MwFindVisibleWindow(MWCOORD x, MWCOORD y); +void MwCheckMouseWindow(void); +int strzcpy(char *dst,const char *src,int dstsiz); + +/* winuser.c*/ +extern int mwSYSMETRICS_CYCAPTION; +extern int mwSYSMETRICS_CXBORDER; +extern int mwSYSMETRICS_CYBORDER; +extern int mwSYSMETRICS_CXFRAME; +extern int mwSYSMETRICS_CYFRAME; +extern int mwSYSMETRICS_CXDOUBLECLK; +extern int mwSYSMETRICS_CYDOUBLECLK; +extern int mwSYSMETRICS_CYHSCROLL; +extern int mwSYSMETRICS_CXHSCROLL; +extern int mwSYSMETRICS_CXVSCROLL; +extern int mwSYSMETRICS_CYVSCROLL; + +/* wingdi.c*/ +extern BOOL mwERASEMOVE; /* default repaint algorithm*/ + +/* winmain.c*/ +int MwOpen(void); +void MwClose(void); +void MwSelect(void); +int MwInitialize(void); +void MwTerminate(void); +extern HWND listwp; /* list of all windows */ +extern HWND rootwp; /* root window pointer */ +extern HWND focuswp; /* focus window for keyboard */ +extern HWND mousewp; /* window mouse is currently in */ +extern HWND capturewp; /* capture window*/ +extern HWND dragwp; /* window user is dragging*/ +extern HCURSOR curcursor; /* currently enabled cursor */ +extern MWCOORD cursorx; /* x position of cursor */ +extern MWCOORD cursory; /* y position of cursor */ +extern MWSCREENINFO sinfo; /* screen information */ +extern DWORD startTicks; /* tickcount on startup */ +extern int mwpaintNC; /* experimental nonclient regions*/ +extern BOOL mwforceNCpaint; /* force NC paint for alphablend*/ + +#if VTSWITCH +/* temp framebuffer vt switch stuff at upper level + * this should be handled at the lower level, just like vgalib does. + */ +void MwInitVt(void); +int MwCurrentVt(void); +int MwCheckVtChange(void); +void MwRedrawVt(int t); +void MwExitVt(void); +extern int mwvterm; +#endif /* VTSWITCH*/ diff --git a/packages/services/gfx/mw/current/include/microwin/wintools.h b/packages/services/gfx/mw/current/include/microwin/wintools.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/wintools.h @@ -0,0 +1,27 @@ +/* + * wintools.h - MS Windows tools library header + * + * WINGEN General Purpose Library + * WINMEM Windows Memory Mgmt Library + * WINFX Special Effects Library + * WINDRAW Draw Library + * WINCTL Custom Control Library + * WIN Class Procedures: ToolsTips, AutoMove, AutoEdit + * WINVID Windows Digital Video + * + * original version 1/6/95 by g haerr + */ + +void WINAPI Draw3dShadow(HDC hDC,int x,int y,int w,int h,COLORREF crTop, + COLORREF crBottom); +void WINAPI Draw3dBox(HDC hDC,int x,int y,int w,int h,COLORREF crTop, + COLORREF crBottom); +void WINAPI Draw3dInset(HDC hDC,int x,int y,int w,int h); +void WINAPI Draw3dOutset(HDC hDC,int x,int y,int w,int h); +void WINAPI Draw3dPushDown(HDC hDC, int x, int y, int w, int h); +void WINAPI Draw3dUpDownState(HDC hDC, int x, int y, int w, int h, + BOOL fDown); +void WINAPI Draw3dUpFrame(HDC hDC, int l, int t, int r, int b); +void WINAPI FastFillRect(HDC hdc,LPRECT lprect,COLORREF cr); +void WINAPI InsetR(LPRECT lprc,int h,int v); +BOOL WINAPI PtInsideWindow(HWND hwnd,UINT x,UINT y); diff --git a/packages/services/gfx/mw/current/include/microwin/winuser.h b/packages/services/gfx/mw/current/include/microwin/winuser.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/include/microwin/winuser.h @@ -0,0 +1,504 @@ +/* winuser.h*/ +/* + * Copyright (c) 1999, 2000 Greg Haerr + * + * Win32 USER structures and API + */ +#include "winctl.h" /* required compatibility for resource compiler*/ + +/* moved from windef.h for resource compiler*/ +typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM); +typedef LRESULT (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM); + +/* win api*/ +LRESULT WINAPI DefWindowProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); + +/* Class styles*/ +#define CS_VREDRAW 0x0001 +#define CS_HREDRAW 0x0002 +#define CS_DBLCLKS 0x0008 +#define CS_OWNDC 0x0020 +#define CS_CLASSDC 0x0040 +#define CS_PARENTDC 0x0080 +#define CS_NOCLOSE 0x0200 +#define CS_SAVEBITS 0x0800 +#define CS_BYTEALIGNCLIENT 0x1000 +#define CS_BYTEALIGNWINDOW 0x2000 +#define CS_GLOBALCLASS 0x4000 + +typedef struct tagWNDCLASSA { + MWLIST link; /* microwin*/ + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; /* nyi*/ + int cbWndExtra; + HINSTANCE hInstance; /* nyi*/ + HICON hIcon; /* nyi*/ + HCURSOR hCursor; /* nyi*/ + HBRUSH hbrBackground; + LPCSTR lpszMenuName; /* nyi*/ + LPCSTR lpszClassName; + CHAR szClassName[40]; /* microwin*/ +} WNDCLASS, *PWNDCLASS, NEAR *NPWNDCLASS, FAR *LPWNDCLASS; + +ATOM WINAPI RegisterClass(CONST WNDCLASS *lpWndClass); + +/* + * Message structure + */ +typedef struct tagMSG { + MWLIST link; /* microwin*/ + HWND hwnd; + UINT message; + WPARAM wParam; + LPARAM lParam; + DWORD time; + POINT pt; +} MSG, *PMSG, NEAR *NPMSG, FAR *LPMSG; + +#define POINTSTOPOINT(pt, pts) \ + { (pt).x = (LONG)(SHORT)LOWORD(*(LONG*)&pts); \ + (pt).y = (LONG)(SHORT)HIWORD(*(LONG*)&pts); } + +#define POINTTOPOINTS(pt) (MAKELONG((short)((pt).x), (short)((pt).y))) +#define MAKEWPARAM(l, h) (WPARAM)MAKELONG(l, h) +#define MAKELPARAM(l, h) (LPARAM)MAKELONG(l, h) +#define MAKELRESULT(l, h) (LRESULT)MAKELONG(l, h) + +/* window messages*/ +#define WM_NULL 0x0000 +#define WM_CREATE 0x0001 +#define WM_DESTROY 0x0002 +#define WM_MOVE 0x0003 +#define WM_SIZE 0x0005 +#define WM_ACTIVATE 0x0006 +#define WM_SETFOCUS 0x0007 +#define WM_KILLFOCUS 0x0008 +#define WM_ENABLE 0x000A +#define WM_SETTEXT 0x000C +#define WM_GETTEXT 0x000D +#define WM_GETTEXTLENGTH 0x000E +#define WM_PAINT 0x000F +#define WM_CLOSE 0x0010 +#define WM_QUIT 0x0012 +#define WM_ERASEBKGND 0x0014 +#define WM_SHOWWINDOW 0x0018 +#define WM_SETFONT 0x0030 +#define WM_GETFONT 0x0031 +#define WM_WINDOWPOSCHANGED 0x0047 +#define WM_NCCALCSIZE 0x0083 +#define WM_NCHITTEST 0x0084 +#define WM_NCPAINT 0x0085 +#define WM_GETDLGCODE 0x0087 +#define WM_NCMOUSEMOVE 0x00A0 +#define WM_NCLBUTTONDOWN 0x00A1 +#define WM_NCLBUTTONUP 0x00A2 +#define WM_NCLBUTTONDBLCLK 0x00A3 +#define WM_NCRBUTTONDOWN 0x00A4 +#define WM_NCRBUTTONUP 0x00A5 +#define WM_NCRBUTTONDBLCLK 0x00A6 +#define WM_KEYFIRST 0x0100 +#define WM_KEYDOWN 0x0100 +#define WM_KEYUP 0x0101 +#define WM_CHAR 0x0102 +#define WM_DEADCHAR 0x0103 /* notimp*/ +#define WM_SYSKEYDOWN 0x0104 /* nyi*/ +#define WM_SYSKEYUP 0x0105 /* nyi*/ +#define WM_SYSCHAR 0x0106 /* nyi*/ +#define WM_SYSDEADCHAR 0x0107 /* notimp*/ +#define WM_KEYLAST 0x0108 +#define WM_COMMAND 0x0111 +#define WM_TIMER 0x0113 +#define WM_HSCROLL 0x0114 +#define WM_VSCROLL 0x0115 + +#define WM_MOUSEFIRST 0x0200 +#define WM_MOUSEMOVE 0x0200 +#define WM_LBUTTONDOWN 0x0201 +#define WM_LBUTTONUP 0x0202 +#define WM_LBUTTONDBLCLK 0x0203 +#define WM_RBUTTONDOWN 0x0204 +#define WM_RBUTTONUP 0x0205 +#define WM_RBUTTONDBLCLK 0x0206 +#define WM_MBUTTONDOWN 0x0207 +#define WM_MBUTTONUP 0x0208 +#define WM_MBUTTONDBLCLK 0x0209 +#define WM_MOUSEWHEEL 0x020A +#define WM_MOUSELAST 0x020A + +#define WM_CARET_CREATE 0x03E0 /* Microwindows only*/ +#define WM_CARET_DESTROY 0x03E1 /* Microwindows only*/ +#define WM_CARET_BLINK 0x03E2 /* Microwindows only*/ +#define WM_FDINPUT 0x03F0 /* Microwindows only*/ +#define WM_FDOUTPUT 0x03F1 /* Microwindows only*/ +#define WM_FDEXCEPT 0x03F2 /* Microwindows only*/ +#define WM_USER 0x0400 + +/* WM_ACTIVATE state values*/ +#define WA_INACTIVE 0 +#define WA_ACTIVE 1 +#define WA_CLICKACTIVE 2 + +/* WM_NCHITTEST codes*/ +#define HTERROR (-2) +#define HTTRANSPARENT (-1) +#define HTNOWHERE 0 +#define HTCLIENT 1 +#define HTCAPTION 2 +#define HTSYSMENU 3 +#define HTGROWBOX 4 +#define HTSIZE HTGROWBOX +#define HTMENU 5 +#define HTHSCROLL 6 +#define HTVSCROLL 7 +#define HTMINBUTTON 8 +#define HTMAXBUTTON 9 +#define HTLEFT 10 +#define HTRIGHT 11 +#define HTTOP 12 +#define HTTOPLEFT 13 +#define HTTOPRIGHT 14 +#define HTBOTTOM 15 +#define HTBOTTOMLEFT 16 +#define HTBOTTOMRIGHT 17 +#define HTBORDER 18 +#define HTREDUCE HTMINBUTTON +#define HTZOOM HTMAXBUTTON +#define HTSIZEFIRST HTLEFT +#define HTSIZELAST HTBOTTOMRIGHT +#define HTOBJECT 19 +#define HTCLOSE 20 +#define HTHELP 21 + +/* WM_SIZE wparam values*/ +#define SIZE_RESTORED 0 +#define SIZE_MINIMIZED 1 +#define SIZE_MAXIMIZED 2 +#define SIZE_MAXSHOW 3 +#define SIZE_MAXHIDE 4 + +LRESULT WINAPI CallWindowProc(WNDPROC lpPrevWndFunc, HWND hwnd, UINT Msg, + WPARAM wParam, LPARAM lParam); +LRESULT WINAPI SendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam); +BOOL WINAPI PostMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam); +BOOL WINAPI PostThreadMessage(DWORD dwThreadId, UINT Msg, WPARAM wParam, + LPARAM lParam); +VOID WINAPI PostQuitMessage(int nExitCode); + +/* PeekMessage options*/ +#define PM_NOREMOVE 0x0000 +#define PM_REMOVE 0x0001 +#define PM_NOYIELD 0x0002 + +BOOL WINAPI PeekMessage(LPMSG lpMsg, HWND hwnd, UINT uMsgFilterMin, + UINT uMsgFilterMax, UINT wRemoveMsg); +BOOL WINAPI GetMessage(LPMSG lpMsg,HWND hwnd,UINT wMsgFilterMin, + UINT wMsgFilterMax); +BOOL WINAPI TranslateMessage(CONST MSG *lpMsg); +LONG WINAPI DispatchMessage(CONST MSG *lpMsg); + +/* note: the following struct is in reverse order from the + * microsoft version since WINAPI is cdecl in this implementation + */ +typedef struct tagCREATESTRUCT { + DWORD dwExStyle; + LPCSTR lpszClass; + LPCSTR lpszName; + LONG style; + int x; + int y; + int cx; + int cy; + HWND hwndParent; + HMENU hMenu; + HINSTANCE hInstance; + LPVOID lpCreateParams; +} CREATESTRUCT, *LPCREATESTRUCT; + +/* + * Window Styles + */ +#define WS_OVERLAPPED 0x00000000L +#define WS_POPUP 0x80000000L +#define WS_CHILD 0x40000000L +#define WS_MINIMIZE 0x20000000L +#define WS_VISIBLE 0x10000000L +#define WS_DISABLED 0x08000000L +#define WS_CLIPSIBLINGS 0x04000000L +#define WS_CLIPCHILDREN 0x02000000L +#define WS_MAXIMIZE 0x01000000L +#define WS_CAPTION 0x00C00000L /* WS_BORDER | WS_DLGFRAME */ +#define WS_BORDER 0x00800000L +#define WS_DLGFRAME 0x00400000L +#define WS_VSCROLL 0x00200000L +#define WS_HSCROLL 0x00100000L +#define WS_SYSMENU 0x00080000L +#define WS_THICKFRAME 0x00040000L +#define WS_GROUP 0x00020000L +#define WS_TABSTOP 0x00010000L + +#define WS_MINIMIZEBOX 0x00020000L +#define WS_MAXIMIZEBOX 0x00010000L + + +#define WS_TILED WS_OVERLAPPED +#define WS_ICONIC WS_MINIMIZE +#define WS_SIZEBOX WS_THICKFRAME +#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW + +/* + * Common Window Styles + */ +#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | \ + WS_CAPTION | \ + WS_SYSMENU | \ + WS_THICKFRAME | \ + WS_MINIMIZEBOX | \ + WS_MAXIMIZEBOX) + +#define WS_POPUPWINDOW (WS_POPUP | \ + WS_BORDER | \ + WS_SYSMENU) + +#define WS_CHILDWINDOW (WS_CHILD) + +/* + * Extended Window Styles + */ +#define WS_EX_DLGMODALFRAME 0x00000001L +#define WS_EX_NOPARENTNOTIFY 0x00000004L +#define WS_EX_TOPMOST 0x00000008L +#define WS_EX_ACCEPTFILES 0x00000010L +#define WS_EX_TRANSPARENT 0x00000020L +#define WS_EX_MDICHILD 0x00000040L +#define WS_EX_TOOLWINDOW 0x00000080L +#define WS_EX_WINDOWEDGE 0x00000100L +#define WS_EX_CLIENTEDGE 0x00000200L +#define WS_EX_CONTEXTHELP 0x00000400L + +#define WS_EX_RIGHT 0x00001000L +#define WS_EX_LEFT 0x00000000L +#define WS_EX_RTLREADING 0x00002000L +#define WS_EX_LTRREADING 0x00000000L +#define WS_EX_LEFTSCROLLBAR 0x00004000L +#define WS_EX_RIGHTSCROLLBAR 0x00000000L + +#define WS_EX_CONTROLPARENT 0x00010000L +#define WS_EX_STATICEDGE 0x00020000L +#define WS_EX_APPWINDOW 0x00040000L +#define WS_EX_LAYERED 0x00080000L + +#define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE) +#define WS_EX_PALETTEWINDOW (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST) + +#define CW_USEDEFAULT ((int)0x80000000) + +#define HWND_DESKTOP ((HWND)0) + +#define CreateWindow(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hwndParent, hMenu, hInstance, lpParam)\ + CreateWindowEx(0L, lpClassName, lpWindowName, dwStyle, x, y,\ + nWidth, nHeight, hwndParent, hMenu, hInstance, lpParam) + +HWND WINAPI CreateWindowEx(DWORD dwExStyle, LPCSTR lpClassName, + LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, + int nWidth, int nHeight, HWND hwndParent, HMENU hMenu, + HINSTANCE hInstance, LPVOID lpParam); +BOOL WINAPI DestroyWindow(HWND hwnd); +BOOL WINAPI IsWindow(HWND hwnd); +#define IsWindowVisible(hwnd) ((BOOL)((hwnd)->unmapcount == 0)) + +/* + * ShowWindow() Commands + */ +#define SW_HIDE 0 +#define SW_SHOWNORMAL 1 +#define SW_NORMAL 1 +#define SW_SHOWMINIMIZED 2 +#define SW_SHOWMAXIMIZED 3 +#define SW_MAXIMIZE 3 +#define SW_SHOWNOACTIVATE 4 +#define SW_SHOW 5 +#define SW_MINIMIZE 6 +#define SW_SHOWMINNOACTIVE 7 +#define SW_SHOWNA 8 +#define SW_RESTORE 9 +#define SW_SHOWDEFAULT 10 +#define SW_FORCEMINIMIZE 11 +#define SW_MAX 11 + +BOOL WINAPI ShowWindow(HWND hwnd, int nCmdShow); +BOOL WINAPI InvalidateRect(HWND hwnd, CONST RECT *lpRect, BOOL bErase); +BOOL WINAPI InvalidateRgn(HWND hwnd, HRGN hrgn, BOOL bErase); +BOOL WINAPI ValidateRect(HWND hwnd, CONST RECT *lprc); +BOOL WINAPI ValidateRgn(HWND hwnd, HRGN hrgn); +BOOL WINAPI UpdateWindow(HWND hwnd); + +BOOL WINAPI SetLayeredWindowAttributes(HWND hwnd, COLORREF crKey, + BYTE bAlpha, DWORD dwFlags); +#define LWA_COLORKEY 0x00000001 +#define LWA_ALPHA 0x00000002 + +HWND WINAPI GetFocus(VOID); +HWND WINAPI SetFocus(HWND hwnd); +BOOL WINAPI SetForegroundWindow(HWND hwnd); +HWND WINAPI SetActiveWindow(HWND hwnd); +HWND WINAPI GetActiveWindow(VOID); +BOOL WINAPI BringWindowToTop(HWND hwnd); +HWND WINAPI GetDesktopWindow(VOID); +HWND WINAPI GetParent(HWND hwnd); +BOOL WINAPI EnableWindow(HWND hwnd, BOOL bEnable); +#define IsWindowEnabled(hwnd) ((BOOL)(((hwnd)->style&WS_DISABLED) == 0)) + +BOOL WINAPI AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, + DWORD dwExStyle); +BOOL WINAPI GetClientRect(HWND hwnd, LPRECT lpRect); +BOOL WINAPI GetWindowRect(HWND hwnd, LPRECT lpRect); + +BOOL WINAPI ClientToScreen(HWND hwnd, LPPOINT lpPoint); +BOOL WINAPI ScreenToClient(HWND hwnd, LPPOINT lpPoint); +int WINAPI MapWindowPoints(HWND hwndFrom, HWND hwndTo, LPPOINT lpPoints, + UINT cPoints); + +BOOL WINAPI SetRect(LPRECT lprc,int xLeft,int yTop,int xRight,int yBottom); +BOOL WINAPI SetRectEmpty(LPRECT lprc); +BOOL WINAPI CopyRect(LPRECT lprcDst, CONST RECT *lprcSrc); +BOOL WINAPI IsRectEmpty(CONST RECT *lprc); +BOOL WINAPI InflateRect(LPRECT lprc, int dx, int dy); +BOOL WINAPI OffsetRect(LPRECT lprc, int dx, int dy); +/* The bcc compiler doesn't work passing structs by value, so we have this*/ +#if ELKS +#define PtInRect(lprc,pt) MwPTINRECT(lprc, *(long *)&(pt)) +#else +#define PtInRect(lprc,pt) MwPTINRECT(lprc, pt) +#endif +BOOL WINAPI MwPTINRECT(CONST RECT *lprc, POINT pt); + +/* + * Window field offsets for GetWindowLong() + */ +#define GWL_WNDPROC (-4) +#define GWL_HINSTANCE (-6) +#define GWL_HWNDPARENT (-8) +#define GWL_STYLE (-16) +#define GWL_EXSTYLE (-20) +#define GWL_USERDATA (-21) +#define GWL_ID (-12) + +/* + * Class field offsets for GetClassLong() + */ +#define GCL_MENUNAME (-8) +#define GCL_HBRBACKGROUND (-10) +#define GCL_HCURSOR (-12) +#define GCL_HICON (-14) +#define GCL_HMODULE (-16) +#define GCL_CBWNDEXTRA (-18) +#define GCL_CBCLSEXTRA (-20) +#define GCL_WNDPROC (-24) +#define GCL_STYLE (-26) +#define GCW_ATOM (-32) +#define GCL_HICONSM (-34) + +LONG WINAPI GetWindowLong(HWND hwnd, int nIndex); +LONG WINAPI SetWindowLong(HWND hwnd, int nIndex, LONG lNewLong); +WORD WINAPI GetWindowWord(HWND hwnd, int nIndex); +WORD WINAPI SetWindowWord(HWND hwnd, int nIndex, WORD wNewWord); +#define GetDlgCtrlID(hwnd) ((int)(hwnd)->id) +DWORD WINAPI GetClassLong(HWND hwnd, int nIndex); +int WINAPI GetWindowTextLength(HWND hwnd); +int WINAPI GetWindowText(HWND hwnd, LPSTR lpString, int nMaxCount); +BOOL WINAPI SetWindowText(HWND hwnd, LPCSTR lpString); + +BOOL WINAPI MoveWindow(HWND hwnd, int x, int y, int nWidth, int nHeight, + BOOL bRepaint); + +/* SetWindowPos Flags*/ +#define SWP_NOSIZE 0x0001 +#define SWP_NOMOVE 0x0002 +#define SWP_NOZORDER 0x0004 +#define SWP_NOREDRAW 0x0008 +#define SWP_NOACTIVATE 0x0010 /* nyi*/ +#define SWP_FRAMECHANGED 0x0020 /* nyi*/ +#define SWP_SHOWWINDOW 0x0040 +#define SWP_HIDEWINDOW 0x0080 +#define SWP_NOCOPYBITS 0x0100 /* nyi*/ +#define SWP_NOOWNERZORDER 0x0200 /* nyi*/ +#define SWP_NOSENDCHANGING 0x0400 /* nyi*/ +#define SWP_DRAWFRAME SWP_FRAMECHANGED +#define SWP_NOREPOSITION SWP_NOOWNERZORDER +#define SWP_DEFERERASE 0x2000 /* nyi*/ +#define SWP_ASYNCWINDOWPOS 0x4000 /* nyi*/ + +#define HWND_TOP ((HWND)0) /* nyi*/ +#define HWND_BOTTOM ((HWND)1) /* nyi*/ +#define HWND_TOPMOST ((HWND)-1) /* nyi*/ +#define HWND_NOTOPMOST ((HWND)-2) /* nyi*/ + +/* WM_WINDOWPOSCHANGED message*/ +typedef struct tagWINDOWPOS { + HWND hwnd; + HWND hwndInsertAfter; + int x; + int y; + int cx; + int cy; + UINT flags; +} WINDOWPOS, *LPWINDOWPOS, *PWINDOWPOS; + +BOOL WINAPI SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, + int cx, int cy, UINT fuFlags); + +BOOL WINAPI GetCursorPos(LPPOINT lpPoint); +HWND WINAPI GetCapture(VOID); +HWND WINAPI SetCapture(HWND hwnd); +BOOL WINAPI ReleaseCapture(VOID); + +/* + * WM_NCCALCSIZE parameter structure + */ +typedef struct tagNCCALCSIZE_PARAMS { + RECT rgrc[3]; + /*PWINDOWPOS lppos;*/ /* removed for microwin*/ +} NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS; + +typedef FARPROC TIMERPROC; + +UINT WINAPI SetTimer(HWND hwnd, UINT idTimer, UINT uTimeout, + TIMERPROC lpTimerFunc); +BOOL WINAPI KillTimer(HWND hwnd, UINT idTimer); +UINT MwGetNextTimeoutValue(void); +void MwHandleTimers(void); + +/* GetSystemMetrics indices*/ +#define SM_CXSCREEN 0 +#define SM_CYSCREEN 1 +#define SM_CXVSCROLL 2 +#define SM_CYHSCROLL 3 +#define SM_CYCAPTION 4 +#define SM_CXBORDER 5 +#define SM_CYBORDER 6 +#define SM_CXDLGFRAME 7 +#define SM_CYDLGFRAME 8 +#define SM_CXFIXEDFRAME SM_CXDLGFRAME +#define SM_CYFIXEDFRAME SM_CYDLGFRAME +#define SM_CYMENU 15 +#define SM_CYVSCROLL 20 +#define SM_CXHSCROLL 21 +#define SM_CXFRAME 32 +#define SM_CYFRAME 33 +#define SM_CXSIZEFRAME SM_CXFRAME +#define SM_CYSIZEFRAME SM_CYFRAME + +int WINAPI GetSystemMetrics(int nIndex); + +HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem); + +/**************************** Caret support **********************************/ +BOOL WINAPI CreateCaret(HWND hwnd, HBITMAP hBitmap, int nWidth, int nHeight); +BOOL WINAPI DestroyCaret(VOID); +BOOL WINAPI HideCaret (HWND hwnd); +BOOL WINAPI ShowCaret(HWND hwnd); +BOOL WINAPI SetCaretPos(int nX, int nY); +BOOL WINAPI GetCaretPos(LPPOINT lpPoint); +UINT WINAPI GetCaretBlinkTime(VOID); +BOOL WINAPI SetCaretBlinkTime(UINT uMSeconds); diff --git a/packages/services/gfx/mw/current/src/Arch.rules b/packages/services/gfx/mw/current/src/Arch.rules new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Arch.rules @@ -0,0 +1,148 @@ +############################################################################## +# Microwindows Architecture rules Makefile +# Copyright (c) 2000, 2002 Martin Jolicoeur, Greg Haerr +# +# This makefile should be placed at the top of a project hierarchy +# +# NOTE: The TOP environment variable should be set to that top directory +############################################################################## + +# Platform dependent flags & definitions + +ifeq ($(ARCH), FREEBSD-X86) +COMPILER = gcc +CXX_COMPILER = g++ +TOOLSPREFIX = +DEFINES += -DLINUX=1 -DUNIX=1 +CFLAGS += -Wall $(OPTFLAGS) +LDFLAGS += +endif + + +ifeq ($(ARCH), LINUX-NATIVE) +COMPILER = gcc +CXX_COMPILER = g++ +TOOLSPREFIX = +DEFINES += -DLINUX=1 -DUNIX=1 +CFLAGS += -Wall $(OPTFLAGS) +LDFLAGS += +# include the following line for static libraries +#LDFLAGS += -static +endif + +ifeq ($(ARCH), LINUX-ARM) +COMPILER = gcc +CXX_COMPILER = g++ +TOOLSPREFIX = $(ARMTOOLSPREFIX) +DEFINES += -DLINUX=1 -DUNIX=1 +CFLAGS += -Wall $(OPTFLAGS) -mstructure-size-boundary=8 +LDFLAGS += +endif + +ifeq ($(ARCH), LINUX-MIPS) +COMPILER = gcc +CXX_COMPILER = g++ +TOOLSPREFIX = $(MIPSTOOLSPREFIX) +DEFINES += -DLINUX=1 -DUNIX=1 +CFLAGS += -msoft-float -Wall $(OPTFLAGS) +ifneq ($(DEBUG), Y) +CFLAGS += -s +endif +LDFLAGS += +endif + +ifeq ($(ARCH), LINUX-POWERPC) +COMPILER = gcc +CXX_COMPILER = g++ +TOOLSPREFIX = $(POWERPCTOOLSPREFIX) +DEFINES += -DLINUX=1 -DUNIX=1 +CFLAGS += -msoft-float -Wall $(OPTFLAGS) +ifneq ($(DEBUG), Y) +CFLAGS += -s +endif +LDFLAGS += +endif + +ifeq ($(ARCH), LINUX-SH) +COMPILER = gcc +CXX_COMPILER = g++ +TOOLSPREFIX =$(SHTOOLSPREFIX) +DEFINES += -DLINUX=1 -DUNIX=1 +CFLAGS += -m1 -m3 -Wall $(OPTFLAGS) +LDFLAGS += +endif + +ifeq ($(ARCH), SOLARIS) +# may require using cc if gcc not installed: +COMPILER = gcc +HOSTCC = gcc +CXX_COMPILER = g++ +TOOLSPREFIX = +DEFINES += -DUNIX=1 -DBIGENDIAN=1 +CFLAGS += $(OPTFLAGS) +LDFLAGS += -lsocket -lnsl -lrt +endif + +ifeq ($(ARCH), ELKS) +COMPILER = bcc +HOSTCC = gcc +CXX_COMPILER = +TOOLSPREFIX = +INCLUDEDIRS += -I/usr/bcc/include -I/home/greg/net/elks/include +DEFINES += -DELKS=1 -DUNIX=1 -Dconst= -Dvolatile= +CFLAGS += -0 -ansi -O +LDFLAGS += +endif + +ifeq ($(ARCH), DJGPP) +COMPILER = gcc +CXX_COMPILER = g++ +TOOLSPREFIX = +DEFINES += -DDOS_DJGPP=1 -D_NAIVE_DOS_REGS=1 -DMSDOS=1 +CFLAGS += -Wall $(OPTFLAGS) +LDFLAGS += +endif + +ifeq ($(ARCH), RTEMS) +COMPILER = gcc +CXX_COMPILER = g++ +TOOLSPREFIX = $(RTEMSTOOLSPREFIX) +INCLUDEDIRS += -I$(RTEMS_BUILD)/$(RTEMS_BSP)/lib/include \ +-I$(RTEMS_BUILD)/$(RTEMS_BSP)/lib/include/networking \ +-I$(RTEMS_BUILD)/$(RTEMS_BSP)/lib/include/sys +DEFINES += -DUNIX=1 +CFLAGS += -O4 -Wall -Wno-unused -fasm -g \ +-B$(RTEMS_BUILD)/$(RTEMS_BSP)/lib/ -specs bsp_specs -qrtems +endif + +ifeq ($(ARCH), ECOS) + COMPILER = gcc + CXX_COMPILER = g++ + DEFINES += -D__ECOS -DUNIX=1 + CFLAGS += -Wall -ffunction-sections -fdata-sections -O2 -g + LDFLAGS += -nostdlib + MW_BASE = /home/bartv/ecc/add-ons/microwindows/microwin + + ifeq (,$(ECOSTARGET)) + $(error ECOSTARGET should be defined in the config file) + else + export ECOSTARGET + ifeq (PCVGA,$(ECOSTARGET)) + TOOLSPREFIX = i386-elf- + #TOOLSPREFIX = + ECOS_PREFIX = /local/bartv/pkgobj/pc/install + endif + + ifeq (IPAQ,$(ECOSTARGET)) + TOOLSPREFIX = arm-elf- + ECOS_PREFIX = /local/bartv/pkgobj/ipaq/install + CFLAGS += -mcpu=arm9 -msoft-float + endif + + ifeq (,$(ECOS_PREFIX)) + $(error eCos target $(ECOS_TARGET) not recognised) + endif + endif + + INCLUDEDIRS += -I$(ECOS_PREFIX)/include +endif diff --git a/packages/services/gfx/mw/current/src/BUGS b/packages/services/gfx/mw/current/src/BUGS new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/BUGS @@ -0,0 +1,42 @@ +GrReparentWindow mapping bug in demo2 app when wm running (temp fixed) +blit slow when moving windows in portrait mode +down portrait mode is not correct + +add offscreen pixmap rotates when portrait changes (remove assert in GdBlit) +remove FIXME kluge in fb.c mapmem, fix offscreen rotation orientation for blits +add subdrivers above driver level for x11 +add portrait switch layer above driver so it works with X11 +any offscreen blit code will fail when in portrait mode + +stretchblit code needs recalc when src offset != 0 (precalc y/x) +put back in DrawArea driver in GdArea +There's still bugs with apps after closebox pressed + +GrReparentWindow must have parent mapped before call + or children of window being reparented get bad unmap counts... +Check out if (height == 0 || ... ) code in engine/devfont.c: bad select +There's still some bugs in the Arc/Pie code - see FLTK valuators demo + +fblin16 DrawArea driver is commented out for font display currently +X11 runs out of colors on t1demo.sh + +SetWindowPos is broken for resize of child windows + +should BeginPaint incorporate the update region with current DC? +WM_MOUSEMOVE shouldn't send hittest code like WM_NCMOUSEMOVE +ATI cards in 16bpp mode: palette not setup properly +PF_PALETTE emulation doesn't work well on X11 (use PF_TRUECOLOR0888) +alpha blending is broken on X11 +cursor disappears with much blitting + +Non-client title bar not repainted properly on repaint + +repaint on VT switch doesn't work with client/server library +Sleep api isn't accurate +switch palette's on the fly from framebuffer identification + +BitBlt clips blit rectangle to source screen/memimage size +Terminal emulator doesn't clip text on right side for some reason +If closing last window, GetMessage/microwindows hangs if not exiting + +The ELKS microwin demo draws mouse droppings on screen diff --git a/packages/services/gfx/mw/current/src/CREDITS b/packages/services/gfx/mw/current/src/CREDITS new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/CREDITS @@ -0,0 +1,52 @@ +Microwindows project +Copyright (c) 1999-2001 Greg Haerr + +CREDITS +Thanks to everyone who has contributed to this project. +Some of the more active contributors are listed below. +If I've missed you, please remind me or submit something! + +Contributors +Engine Greg Haerr, David Bell, Morten Rolland +Win32 api Greg Haerr +Nano-X api David Bell, Alan Cox, Alex Holden, Greg Haerr +Nano-X window manager Alex Holden, Greg Haerr +Nano-X popup keyboard Vladimir Cotfas, Jay Carlson, Greg Haerr +Nano-X scribble handwriting Greg Haerr +Nano-X enhancements, bugfixes Jordan Crouse +Network code, Nano-X client lib Greg Haerr, Alex Holden +MIPS LinuxCE port, touch device Brad LaRonde +ELKS port Greg Haerr, Al Riddoch +NanoWidget set Vidar Hokstad +Bogl library Ben Pfaff +Fonts Darran D. Rimron, Greg Haerr +Font Subsystems Greg Haerr, Martin Jolicoeur, Vidar Hokstad +X11 driver Tony Rogvall +Portrait mode fb driver Martin Jolicoeur +BMP and JPEG file read/display Martin Jolicoeur +RTEMS port Rosimildo daSilva +DJGPP/GRX port Victor Rogachev +C++ objects framework Chris Johns +Arc clipping routines Eero Tamminen +Mozilla kbd,rops,font enum Matthew Wlazlo + +Contact Info +Jay Carlson +Vladimir Cotfas +Alan Cox +Jordan Crouse +Greg Haerr +Vidar Hokstad +Alex Holden +Brad LaRonde +Chris Johns +Martin Jolicoeur +Ben Pfaff +Al Riddoch +Darran D. Rimron +Victor Rogachev +Tony Rogvall +Morten Rolland +Rosimildo daSilva +Eero Tamminen +Matthew Wlazlo diff --git a/packages/services/gfx/mw/current/src/ChangeLog.MW b/packages/services/gfx/mw/current/src/ChangeLog.MW new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/ChangeLog.MW @@ -0,0 +1,871 @@ +Version 0.89pre8 - 15 Nov 2001 - greg@censoft.com + * added MicroTouch DynaPro SC3 touchscreen driver and calibrator (Jordan) + * added GrSetGCClipOrigin + * removed most C++ style comments (Simon), cleaned up source tree + * added GrPeekWaitEvent, blocks until at least one event is available, then peeks + * fix GrPeekEvent, was absorbing events + * added win32 VK_ key translations for scancode MWKEY_ values + * Mozilla and rdesktop enhancements (Matthew Wlazlo) + ttyscan and x11 keyboard driver fixes + GrGetFontList, GrFreeFontList, GdGetFontList + * added USE_16BIT_ACCESS to fblin16.c to draw using short word stores only + * implement all src/dst copy modes in fb/x11 blitters and win32 SetROP2/BitBlt codes + use MWMODE_COPY instead of MWMODE_SET + use MWROP_COPY instead of MWROP_SRCCOPY + * implement all 16 src/dst MWMODE_xxx operations (Matthew Wlazlo) + * fixed alphablending for truecolor 555 systems + * fix GdTimeout bug when usecs only specified (David Erickson) + * check GC changed before fixing clip in GsPrepareDrawing, clip sometimes incorrect + * allow 0 timeout to cancel GrSetScreenSaverTimeout + * changed check for /tmp/.nano-X to use access(), not stat() + * revised reported x, y event values to be parent-relative + * added Century's GrLoadImageFromBuffer, GrDrawImageFromBuffer + * removed GPL restriction to Arc clipping routines w/permission Eero + (24 Sep 2001) + * added pid to GR_WINDOW_INFO for window ownership identification (Century) + * fixed MWPIXELFORMAT for TRUECOLOR555 + * added patch to change mouse position when cursor moved with GrMoveCursor + * removed incorrect GrReparent code with regards to child mapcount (temp fix) + * added direct client-side framebuffer mapped window routines: + GrOpenClientFramebuffer, GrCloseClientFramebuffer, GrGetWindowFBInfo + * added rgb mask values, fb driver type to SCREENINFO struct + * updated mou_tp.c for Yopy (untested), can use mou_yopy.c + * fixed GrCheckNextEvent to return locally queued event first if any + * fixed FREETYPE_FONT_DIR + * added swap.h little/big endian swapping macros, fixed alignment bugs in devimage.c + * added GrSetPortraitMode, GR_EVENT_TYPE_PORTRAIT_CHANGED + * added GsSetPortraitMode, GsSetPortraitModeFromXY, screen driver SetPortrait entrypoint + * reimplemented GdFillPoly algorithm for correctness + (4th July 2001) + * added DJGPP changes from Victor + * added check for CONSOLE env var for /dev/tty to open, GrCopyArea fix and + X11 scanline calc bug from Jordan Crouse + * add patches for compiling with libc5 and default t1lib Latin1 encoding from Tomasz + * added Korean Hangul KSC5601 encoded font support and 16x16 fixed text font from Kevin O + * add byte swap in devimage.c, X11 driver changes, DPRINTF defaults to no output + GrRegisterInput/GrUnregisterInput use fd_set, -s on debug only from Steve Hein + * add GrCreateTimer, GrDestroyTimer periodic timers from Gary James + * added MWPACKED attribute packing define in mwtypes.h + * added eCos port by Gary Thomas + * ntetris game orientation patch (Xiang Lee) + * translate 127 (DEL) to MWKEY_BACKSPACE in tty scancode (L.C. Chang) + * fixed non-inited sizing field in nanowm (L.C. Chang) + * added Microtouch rs232 touch panel driver mou_mt.c (Holger) + * fix multiple GrClose bug (Gary) + * update kbd_pipe.c (Murphy) + * free memory in MwDestroyWindow + (4th June 2001) + * removed Nano-X widget directory (obsoleted) + (15th May 2001) + * temp removed driver DrawArea() calls in GdArea code (blit bug) + * fix clip bug in GdReadArea + * added portrait mode member to screeninfo struct (change all dr/scr*.c) + * added down portrait mode + * added dynamic portrait mode, nano-X [-ANLRD] startup portrait modes + (13th Apr 2001) + * implemented GR_BACKGROUND_STRETCH in GrSetBackgroundPixmap + * fixed startup VTSWITCH time delay bug in win32 + * added StretchBlt, new screen driver stretchblit entry point + * added direct .bmp file create on PRINT, added 16,24,32 bpp output + (27th Jan 2001) + * added GrDelay for msec delay + * added GrQueryTree to obtain window parent/children list + * ported nxroach! (run nxkbd.sh) + * replaced GrClearWindow with GrClearArea, created GrClearWindow macro + * experimental fix to GrReparentWindow when parent not mapped + * added cursor id to GR_WINDOW_INFO + * added server-side cursors, GrNewCursor, GrDestroyCursor, GrSetWindowCursor + * removed GrSetBorderColor, changed to GrSetWindowBorderColor + * added GrNewBitmapFromData +Version 0.89pre7 - 21st Jan 2001 - greg@censoft.com + * moved config.* files to Configs directory and added README + * moved caching devfont.c to devfont.caching.c (breaks ftdemo) + * added extensive gtkdoc sgml/html/pdf nano-X documentation from Alex + * wrote Xlib to Nano-X macro hdr file for easier porting (XtoNX.h) + * added Alex's improved server timeout routines (no alarms) + * converted demo3 to nxview image viewer + * added time field in GR_EVENT_BUTTON for double-click determination + * fixed fast window move blit bug with non-root child windows + * added GR_WM_PROPS_BORDERCOLOR + * added useful macro functions: GrSetWindowTitle,GrSetWindowBorderColor, + GrSetWindowBorderSize, GrSetWindowBackgroundColor + * ported xfreecell to nano-X + * added GrNewPixmapFromData to create pixmap from bitmap data + * added Alex's GrSetBackgroundPixmap, GrBell + * added Alex's cool screensaver app nsaver, GrSetScreenSaverTimeout + * added Alex's getselection/setselection demos, + Gr[GS]etSelectOwner, GrRequestClientData, GrSendClientData + * enhanced nxclock and ftdemo + * fix shared library bug w/GetSysCharHeight function + * fixed MwRegisterInput/Output/Except bug (Yang) + * fixed Arch.rules for Solaris 7 + * fix antialiasing bug when both T1lib and Freetype enabled (Murphy) + * fixed GrReadArea offset bug (Dave Tubbs) + * added MWPF_TRUECOLOR555 for 16 bpp 5/5/5 packed pixels + * fixed PIXEL565TOCOLORVAL and PIXEL332TOCOLORVAL macros + * fixed 5/5/5 driver for ATI card +Version 0.89pre6c (unreleased) 8th Dec 2000 - greg@censoft.com + * new scancode kbd driver: ESC never quits, pause/break quits + select with SCANKBD=Y in config (default) + * added Brent's changes for VxWorks port + * added PNG image decoding from Alex + * fixed GrGetNextEvent returning event twice when signal caught (Alex) + * fixed XPM loader errmsg on non-XPM images from Alex + * added launcher application from Alex + * added HAVE_PNM_SUPPORT for PBM,PGM,PPM ascii&binary images from Alex + * added ntetris game from Alex + * fixed FREETYPE_FONT_DIR in engine/Makefile + * added freetype font caching to devfont.c (experimental) (huge speedup) + * added -mstructure-size-boundary=8 for ARM compiles and structure bugs + * changed MOUSE_POSITION to ..._MOTION in scribble for better recognizer + * fixed nasty slow blitting code in X11 driver + * added USE_EXPOSE config option for XFree4.0 backing store expose fix + * added iPAQ scancode keyboard driver + * added YOPY mouse driver and YOPY build support + * fixed dropped events bug in client/server!! + * send UPDATE_MOVE to all children on window move + * finished fast screen blit move algorithm for topmost windows + * auto calculation of virtual screen size + * change GR_EVENT_MOUSE subwid to always be mouse window (Peter) + * added auto-repeat to scancode tty driver + * fixed buggy GrGetRegionBox + * fixed X11 screen->offscreen blit + * fixed blit with negative src clipping + * added GR_MODE_EXCLUDECHILDREN clip mode to GrSetGCMode + * added window resize to nanowm and #define OUTLINE_MOVE + * changed GrInjectPointerEvent visible arg semantics + * converted x11 kbd driver to scancode + * added MWKEY_* defines, changed kbd modifiers + removed GR_MODIFIER_*, GR_SPECIAL_*, GR_KEYSTROKE_* defines + api change: GR_EVENT_KEYSTROKE to return unicode only values + api change: GrInjectKeyboardEvent + * complete keyboard driver rewrite: scancode, up/down events + * ported Doom! to Microwindows + * fixed overlapping blit for 8/16 bpp + * added current mouse coords in SCREENINFO struct + * started on Wt widget set port +Version 0.89pre6 - 12th Nov 2000 - greg@censoft.com + * added Peter's driver blit fix for dst in src rectangle + * added Scott's correct GdFillPoly routine (uses malloc/qsort) + works for irregular polygons, concave, convex with holes + * added config.ipaq for pre-built ipaq build configuration + * added -lm to LDFLAGS when T1LIB or FREETYPE is used + * added FLIP_MOUSE_IN_PORTRAIT_MODE #define to engine/devmouse.c + * added Vladimir's nxlsclients and nxev programs + * GrCopyArea optimization fix for windows with no eventclients (slider) + * added Kim's SH3 reversed order fblin4sh3.c driver + * added support for SuperH compilations (LINUX-SH) + * added Jordan's convxpm.perl xpm to rgb converter + * added Brent's alloca patch + * fix update map/unmap events sent only on actual unmap/map + * fix window manager to map parent before reparent for unmapcount bug + * allow GdStretchBlit to width/height of 0 without error + * remove GsError for GrNewPixmap of 0 width or height + * change to service all kbd data in single poll loop + * change low level clipping to always clip child windows + * fix server clear allocated pixmaps before drawing to them + * fix blit code after xor in X11 driver for nxterm +Version 0.89pre5 - 2nd Nov 2000 - greg@censoft.com + * add GdCaptureScreen screen capture for later makebmp processing + * temp #define FASTJPEG in engine/devimage.c for 8bpp fast jpeg display + * free server images on client disconnect + * wrote experimental non-flick blit-move routine when window is topmost + * fixed GrCopyArea with offscreen source wid + * fixed UPDATE_MAP x, y, values + * fixed transparent color drawing in GdDrawImage, + unique color no longer required + * fix imagehdr free in GdFreeImage + * added xpm image support from Jordan, (HAVE_XPM_SUPPORT) + * added UPDATE_DESTROY update event subtype + * changed update map/unmap semantics: update sent on all child + windows of map/unmap + * send update unmap event on auto server-destroyed windows + * change GrDestroyWindow to send always send update unmap event + * change GR_EVENT_TYPE_CHLD_UPDATE message wid member, added subwid + now properly sends CHLD_UPDATE messages + * added GrDrawLines util function + * added virtual and workspace width/height GR_SCREEN_INFO members + * added GR_WM_PROPS_NOAUTORESIZE and GR_WM_PROPS_MAXIMIZE window props + * fixed cursor on when in source blit rectangle + * fixed GrCopyArea copy garbage on clipped src area,sends expose instead + * fix DestroyRegion code in GsDestroyClientResources + * added Kaben's clipping fix for GdBlit + * Kaben's clip region fix when alternating between on/offscreen windows + * remove GsError on bad GrCloseWindow + * fix negative text coordinate offsets for freetype + * consolidated GrNewWindow/GrNewInputWindow + * disallow auto-focus to windows with GR_PROPS_NOFOCUS set +Version 0.89pre4 - 26th October 2000 - greg@censoft.com + * added aggregated expose events for better paint appearance + * added cleanapps Makefile entry + * fixed T1Lib Makefile.rules bug + * removed strdup definition for mips in nxscribble + * fixed constant timeout event returned when linked with server + * rewrote error handling completely, new GrDefaultErrorHandler, + GrSetErrorHandler type/semantics. Removed nanox/stubs.c + * don't revert to mouse enter/leave focus after window destroy once set + * fix GrCopyArea drawing on unmapped window crash + * fix crash on bad GrGetWMProperties call + * return all 0 info for any invalid id GrGet* functions + * fix GrGetWMProperties to return flags 0 on invalid window id + * free gc, region and font resources on client exit +Version 0.89pre3 - 17th October 2000 - greg@censoft.com + * turned off alpha blending in X11 screen driver for 8bpp + * added Nano-X draw library nxPaintNCArea, nxDraw3dShadow, etc + * added Vladimir's GR_CLOSE_FIX in nanox/client.c fixing client hang bug + * fix for GrGetWindowInfo crashing Vtech after GrCloseWindow/ncPaint + * added NEC Harrier port from Century Software + * some include file changes for VxWorks port from Brent + * cleaned up nanowm window move/closebox/raisewindow routine and policy + * added GrNewWindowEx to specify title and props at window create time + * implemented window draw styles GR_WM_PROPS_APPWINDOW, APPFRAME, + BORDER, CAPTION, CLOSEBOX, default style set by window manager + * implemented GR_WM_PROPS_NOMOVE, NORAISE, NOAUTOMOVE, NODECORATE + don't decorate if not direct child of root window + * extended GrGetWindowInfo to return window properties + * fixed LINK_APP_INTO_SERVER makes + * added FBREVERSE=Y and PSIONMOUSE=Y config options for Psion 5 port + Justin Davies contributed Psion 5 touchscreen/screen driver + * added PIPEKBD option for named pipe keyboard driver (kbd_pipe.c) + * added nxterm patch for FreeBSD from Andrew + * fixed sharedlibs link for nxkbd, nxscribble and nanowm apps + * fixed make bug when SHAREDLIBS=Y and FREETYPE/T1LIB=Y from Murphy +Version 0.89pre2 - 3rd October 2000 - greg@censoft.com + * added nxscribble handwriting recognition from Century Software + * added nxkbd popup keyboard for Nano-X (original from Jay & Vladimir) + * added SIGHUP ignore to Nano-X, removed GrRedrawScreen dropclient bug + * implemented GrReadArea for pixmaps from Peter + * added free truetype fonts to distribution (Arial, Times, Courier) + * added FREETYPE_FONT_DIR config for truetype font search path, .ttf ext + * enhanced nxclock no polling, nxterm better focus handling + * added GR_UPDATE_UNMAPTEMP and GR_UPDATE_ACTIVATE update events + * added GrGetNextEventTimeout and GR_EVENT_TYPE_TIMEOUT event + * reworked NanoWM for 3d window decorations for Nano-X applications + removed multi-window decorations, uses only one window now + * fixed user clip region parent offset bug from Peter + * added GrGetFocus call for use with nxkbd and nxscribble + * added GrGetSysColor for system-defined color schemes + * fixed focus semantics during window move/resize/reparent + * added Makefile INSTALL_PREFIX variable + * added GrPoints function from Murphy + * rewrote window manager property struct, added set background color + added props, flags, title, background, bordersize get/set + * added kbd_soft.c named pipe keyboard driver from Vladimir + * added touch panel mods to mou_tp.c driver for Helio (TPHELIO=Y) + * added inverted 4bpp screen driver for Helio (INVERT4BPP=Y) + * added changes to Makefile for shared libs for Helio + * added kbd modifier info for X11, nano-X hdr changes from Jordan + * generate Nano-X root window expose event repaint on startup + * removed termios errchk in serial/ps2 mouse driver + * fixed DT_CENTER DrawText and MSDOS GetTickCount from Robert Sharp + * fixed Makefile.rules .depend target errmsg + * start work on Nano-X drawing library for 3d look/feel + * added GrDrawImageBits, .bmp file conversion for Nano-X + must change MAXREQSIZE in nxproto.h + * add title display to nanoWM + * fix SetWMProperties title memcpy/wrapper bugs + * fix many NanoWM bugs: + window move offset, mousedn on client loses title data + * ported nxkbd software keyboard to Nano-X + * added FREEBSD-X86 to config file as ARCH option +Version 0.89pre1 - 18th September 2000 - greg@censoft.com + * added map-update events to be batched to any application that selects + for child update events on the root window (window managers) + this allows a window manager to get a list of all mapped + windows without a special API call + * updated nanowm bitmaps from Vladimir + * eliminate need for sleep after nano-X startup, multiple connect trys + * print nano-X server error messages rather than numbers + * force nano-X cursor to appear on startup + * fix cursor change without mouse movement + * moved apps/nanowm to demos/nanowm to fix Makefile build problem + * fix bad MIPS sys header define for SOCK_STREAM + * fix free() bug in GrSetWMProperties from Vladimir + * added alpha RGB444 12bpp fb driver for EP7211 from Julian + * fixed uninitialized transparent color in devimage.c from Jamie + * fixed mouse in abs mode for iPAQ touchscreen in portrait mode + * renamed demos/mwin/demo.c to mdemo.c + * added changes for compiled in HAVE_BIG5_SUPPORT + packhz12 program + bugfixed hzx12 big5 chinese font + * added changes to win32 controls: + listbox control with scrollbars + edit control w/chinese support and caret + combobox enhancements + new scrollbar (client) control, smooth scrolling thumbs + mtest2 demo program + multiline edit control + * wrote caret handling for win32 + * added Roman's changes for Kaffe port to win32 api: + GetTextExtentExPoint, GetTextExtentPoint, DrawTextA + SRCAND, SRCINVERT, BLACKNESS + added blit AND, INVERT, BLACKNESS to x11 and 16bpp drivers + GdGetTextSizeEx (freetype only for now) + automatically append B/I for bold/italic in CreateFont + fix delete pen/brush but not font resources in ReleaseDC + change default TOP alignment to BASELINE in MwExtTextOut + enhanced glyph width calculations for freetype in devfont.c + auto antialias for freetype at height > 14 + not added (kaffe port): + TextOut defaults to UTF8, not ASCII + no SetForegroundWindow on NCLBUTTONDOWN on HTCLIENT area + * enhanced demo2.c for upcoming Linux Journal article (Dec) +Version 0.88patch1 - 21st August 2000 - greg@censoft.com + * temp hack scribble to window #2, remove srvutil.c id!=1 hack + * fixed nanowm window move flicker + * added window id parm to GrInjectKeyboardEvent + * added otherid to nano-X focus window events + * fixed BOOL decl in scr_bios.c + * add WM_NCHITTEST fix to tpcal calibrator + * fix ADS and iPAQ touch screen drivers for kernel driver select bug + * added right/left portrait mode mouse fixups, -N cmd line startups + * fixed GsError with no clients core dump + * added transparent color to MWIMAGEHDR format, GdDrawImage, GIF decode +Version 0.88 - 3rd August 2000 - greg@censoft.com + * added iPAQ mouse support from Century Software, config IPAQMOUSE + * changed config option TSMOUSE to ADSMOUSE + * added HAVE_GIF_SUPPORT to config, added GIF decoder + * changed image decode algorithms, image is kept in core until drawn + * added GrDrawImageFromFile, GrLoadImageFromFile, GrDrawImageToFit, + GrFreeImage, GrGetImageInfo for GIF, BMP and JPEG + * removed GrJPEG/GdJPEG, GrBMP/GdBMP + * modified MWIMAGEHDR structure, added pitch and bytesperpixel + * wrote decoder for 24bpp .bmp files, enhanced convbmp + * added stretch blit, rewrote image routines in Nano-X for ViewML + * corrected nano-X demo makefiles to work with LINK_APP_INTO_SERVER + + * Patches recieved from ScreenMedia: Jan Vehusheia + * nanox/srvnet.c Free allocated events to freelist when destroying + a client. + * nanox/srvutil.c Correctly reassign mouse pointer information when + an application crashes while a mouse button is held pressed down. + + * Patches recieved from ScreenMedia: Jon K Hellan + * nanox/srvmain.c (GsInitialize): Initialize wp->owner to NULL. + * drivers/kbd_x11.c (X11_Read): Initialize modifiers also when no + key press pending. + * demos/nanox/demo5.c (main): Correct height of bitmap2(fg|bg) in + GrSetCursor call. + + * added Kevin's patch for destroying eventclient structures + * added Jiwon's patch for NULL name strcpy in devfont.c + * added Kyle's makefile patches, PORTRAIT_MODE=R or L in config +Version 0.88pre11 (IBM OTI java&Kaffe ports) - 10th July 2000 - greg@censoft.com + * added set palette patch from Joe for Embedded Planet /dev/lcd driver + * started adding win32 keyboard support (not working yet) + * added Andrew's port to FreeBSD, Wt wterm terminal emulator port + * fixed convbdf font size error + * added Kevin's not working combobox control + * added George's Isicad Prisma screen driver and config + * added Simon's flipped portrait mode driver (we now have two) + * added updated BC5 makefiles from Ming-Lin Kao + * added HZK font patches from kevin + * added checkbox, radio button and static controls by kevin/cms + * changed GrSetFontAttr,GdSetFontAttr api + * added underlining to font rendering with GrSetFontAttr/MWTF_UNDERLINE + * fix WS_POPUP parent clipping, add owner window handling + * fix delete pen/brush/font resources in ReleaseDC, use DeleteObject + * fix memory leak in GetDCEx using CS_OWNDC + * added nofont.c for null font support + * added NOFONTSORCLIPPING config option for screen driver interface only + * separated engine open and draw routines for small driver interface + * IBM OTI Microview port: no ALPHABLEND, VTSWITCH, FBVGA, EPRINTF chg +Version 0.88pre10 (fltk-nx port) - 18th June 2000 - greg@censoft.com + * started adding win32 non-client area scrollbars + * added Simon's contributed slider game (slider.sh) + * added Nano-X GrEqualRegion, GrEmptyRegion, GrOffsetRegion + * added GdEqualRegion, GdEmptyRegion + * changed GdRectInRegion to return partial intersection values + * fixed Nano-X clipping regions relative to drawable + * changed GR_RECT struct to match X, not win32 + * changed GrRectInRegion, GrGetRegionBox, GrUnionRectWithRegion parms + to match X + * applied Kevin's HZK font sizing fix + * removed floating point, ldiv from ported progress bar, fixed bugs + * fixed listbox multi-element display code, initial state + * fixed PIXELVALTOCOLORVAL macro typo +Version 0.88pre9 - 15th June 2000 - greg@censoft.com + * added Chinese Han Zi Ku font support from Tanghao and Jauming + 12x12 and 16x16 ascii and chinese fonts + Big5, Unicode-16 and GB2312 encoding supported + set with config option HAVE_HZK_SUPPORT + * added Guo's Chinese GB2312 decoding routines, fonts/gb2312font.c + set with config option HAVE_GB2312_SUPPORT + * added Jin ke xue's gb16x16song.c font file (no support yet) (and .bdf) + * fixed C++ objects to compile + * added Rosimildo's RTEMS changes, convbmp allows full paths + * added Alex's VERY COOL nano-X window manager! (great job!!) nanowm.sh + * added GrSetWMProperties,GrGetWMProperties,GrCloseWindow, GrKillWindow + * added Alex's npanel enhancements (solid dragging, zombies) + * added Alex's cpu usage reduction to nclock, npanel + * added Alex's patch to get nano-widgets to compile + * added Alex's PPM file decoder demo6 + * implemented DT_CENTER, DT_RIGHT for DrawText + * added changes in tpcal.c for MIPS Osprey board port, dblclk changes + * HAVETEXTMODE #define for Osprey and Embedded Planet ports + * added Michael's MINIX port updates + * added George's setpalette changes to VNC + * added GdAllocPolygonRegion, GrNewPolygonRegion, CreatePolygonRgn + * fixed nasty #if UPDATEREGIONS in windows.h compile problem + * added Kevin's port of edit, listbox and progressbar from MiniGUI + * added GdGetRegionBox, GrGetRegionBox + * fixed update regions calc bug + * combined GdEllipse and GdFillEllipse and Arc/Pie routines + * wrote pie, arc, outline arc routines, win32 Arc,Pie, GrArc,GrArcAngle + * added George's patch to fix X11 screen driver setpalette function + * added Murphy's region code for Nano-X, also polygon regions +Version 0.88pre8 - 23rd May 2000 - greg@censoft.com + * added Murphy's X vs Microwindows speed tester in contrib/speedtst + * fixed convbdf to not emit nonascii characters + * added Victor's DJGPP port + * removed automatic portrait mode + * added extern "C" to nano-X.h + * added Kao's patches for BC5, enhanced scr_tc.c, some bug fixes + * fixed win32 top/baseline/bottom positioning + * added Morten's GrInjectKeyboard/GrInjectPointer patches + * added Kevin Lin's fix to Nano-X persisent mode curclient crash + * changed GdCreateFont name,height semantics + * added Morten's font picker algorithm, turn on w/#define FONTMAPPER 1 + Note: font selection is currently under development + and will likely change + * cleaned up source for Michael's MINIX port, replaced convbmp.c -s opt + * fixed XYPOINT in mou_tp.c, changes for embedded planet tp driver + * added PIXELVALTOCOLORVAL, COLORVALTOPIXELVAL macros, GdTranslateArea + * fixed multiple GsSelect() call in GrGetNextEvent in linked client/serv + * continued port of VNC to Nano-X, contributed by George + * added Rosimildo's patch for RTEMS, MW* fixes, svgalib fade +Version 0.88pre7 - 15th April 2000 - greg@censoft.com + * added LINUX-POWERPC port for embedded planet linux box + * fixed Polygon routine fill/draw reversed, AdjustWindowRectEx + * fixed no root window paint without background bitmap + * added bitmaps to minesweeper, polished up + * added middle button handling for mwin + * added GrSetSystemPalette + * added user-replaceable GdError, removed all fprintf/printf's + * added EPRINTF for all error printfs, DPRINTF for debug printfs + * removed HAVE_PERROR config option + * changed memmove to memcpy +Version 0.88pre6b - 5th April 2000 - greg@censoft.com + * added PostThreadMessage + * started porting minesweeper game + * fixed -p persistent mode + * added Kao's BC 5.02 fixes, other pre6 fixes from name changes + * added Steven's patch for polling drivers, HAVE_PERROR config option + * added Erik Hill's alpha blending for X11 + * fixed jpeg compile bug + * removed include patch from Shane +Version 0.88pre6 - 2nd April 2000 - greg@censoft.com + * major header file cleanup, fixing namespace pollution + API typdef procs data + Nano-X: GR_* Gr*,nx*,(Gs*) nx* + Microwindows: MW* Mw* mw* + Engine: MW* Gd*,Mw* gr_*, fb* + * changed all Nano-X structures and defines to be GR_ prefixed + added GR_PIXELVAL, GR_RGB, GR_LOGFONT + * MW prefixed all exported typedefs for name space cleanup, + split device.h into mwtypes.h for exports + * added MWLOGFONT font descriptions + * removed BUTTON, MODE, MODIFIER typedefs + * added Martin's updates to FreeType renderer, updated ftdemo + * added Martin's updated xconfigure for X-based configuration + * renamed GrUnloadFont to GrDestroyFont, GdDestroyFont + * clean up various unwanted nano-X client library symbol exports + * redraw windows on nano-X client disconnect + * added -p for nano-x persistent mode, no exit on client disconnect + * added Timo's fix in GsAcceptClientFd, ignore SIGPIPE, mult GrClose bug + * added automatic portrait mode if screen y resolution > x res + * fixed GrReqShmCmds for linked client/server case + * implemented freetype renderer ascent/descent calculations + * added ascent field to compiled fonts, GrText uses TF_BASELINE default + * added 5x7, 6x13 compiled (bdf) fonts, FONT_SYSTEM_FIXED is now 6x13 + * fixed typo in fonts/convbdf $IMAGEBITS incorrect + * added #include for outb in 2.3.x systems + * added AdjustWindowRectEx, WM_ACTIVATE, IsWindowEnabled + * completed GetPixel, added PIXELVAL to COLORVAL conversion macros +Version 0.88pre5b - 23rd March 2000 - greg@censoft.com + * added GetSystemMetrics, SM_CYSCREEN, SM_CXSCREEN, SM_CYMENU + * added GetParent, GetDeviceCaps LOGPIXELSX + * added EnableWindow, WM_ENABLE + * added MapWindowPoints, WM_WINDOWPOSCHANGED + * defaulted ANIMATEDPALETTE to off (change in include/device.h) + * added RTEMS patches for svgalib, GsSelect timeout handling (Rosimildo) + * created shared libs for all libraries with SHAREDLIBS=Y config option + * patched setfadelevel out for non framebuffer + * patched client/server shm code (Morten) +Version 0.88pre5 (opera, kaffe) - 22nd March 2000 - greg@censoft.com + * added GetDlgItem, GetWindowTextLength, WM_GETTEXTLENGTH + * added GetPixel (needs rgb backconversion still) + * implemented GWL_WNDPROC, CallWindowProc, GetRValue, GetGValue etc + * added GrSetFontSize, GrSetFontRotation, GrSetFontAttr, and GdXXX + works on a per-font basis, rather than on GC + * added HAVE_SHAREDMEM_SUPPORT config option to compile in shmem support + * added shared memory support for Nano-X client/server protocol (Morten) + * added -e option to Nano-X server to stop terminate on ESC + * fixed psd->DrawArea crash after vt switch, GdArea cursor update + * added SHAREDLIBS config option for shared libs (nano-x only now) + * applied Morten's patch to fix Nano-X client/server protocol bug + * added UTF-8 encoding/decoding for fonts and text + * fixed FreeType memory leak (thanks Martin) + * added ExtTextOutW, DrawTextW for unicode win32 support +Version 0.88pre4 (truetype/t1 fonts) - 19th March 2000 - greg@censoft.com + * implemented text drawing in ascii, utf8, unicode 16 and unicode 32 + * added font id's for Nano-X, added GrCreateFont, GrUnloadFont + * rewrote font subsystem heavily + * added alphablender for antialiased fonts for 8, 16, 24 and 32bpp + * added GrText, GrGetGCTextSize flags, CreateFontIndirect + * added GdText TF_ flags for 8,16,32 bit packing, top/bottom alignment + * added Martin's FreeType TrueType font support + * added Vidar's t1lib adobe type1 font support, t1demo for Nano-X + use HAVE_FREETYPE_SUPPORT config option + use HAVE_T1LIB_SUPPORT config option + * renamed min/max to mwmin/mwmax + * added Fabio's xconfigure patch for VTSWITCH + * fixed WM_CREATE lparam bug + * added mou_ts.c touch screen driver for ADS ARM port + * added GrSetGCFontSize, GdSetFontSize, GdCreateFont, GdUnloadFont + * added GWL_USERDATA to Get/SetWindowLong + * turboc port screen driver fixes + * added nonclient region special paint handling to avoid flicker + * added null kbd driver, set with NOKBD=Y +Version 0.88pre3d (fltk port) - 12th March 2000 - greg@censoft.com + * changed FONTINFO struct, added firstchar, lastchar + * added Shane's fonts patches, added CreateFont, GetTextMetrics, + GetCharWidth, SetAlignText + * debugged nasty VTSWITCH palette changed bug + * experimental #define ANIMATEPALETTE for cool fade in + * added Kyle's patch to get portrait mode working again + * fix SetClipRgn/ExtSetClipRgn to take client coords (win32 api doc bug) + * added WM_SHOWWINDOW msg + * fixed coords to WM_MOVE msg for WS_CHILD windows + * added PeekMessage, Ellipse + * added Rosimildo's rtemscfg.h patch + * added GetUpdateRgn, GetUpdateRect, GdOffsetRegion + * added Kyle's GdCopyArea fix +Version 0.88pre3c (fltk port) - 8th March 2000 - greg@censoft.com + * added CS_OWNDC private DC's + * added SetActiveWindow, SetForegroundWindow, BringWindowToTop + * added Polygon, PolyPolygon (filled and outline) +Version 0.88pre3b (fltk port) - 6th March 2000 - greg@censoft.com + * added GetDeviceCaps, Polyline + * added extern "C" in windows.h + * fixed loop bug in CreateRoundRectRgn + * added penguin to bin/mdemo + * added ValidateRect, ValidateRgn, InvalidateRgn + * completely rewrote UPDATEREGIONS handling for new region fns + * added DCX_EXCLUDEUPDATE handling to window clipping + * sped up WndSetClipWindow, GsSetClipWindow + * added GdSetRectRegionIndirect, GdSubtractRectFromRegion + * added SetWindowPos for size,move,show,hide,repaint,zorder +Version 0.88pre3 - 5th March 2000 - greg@censoft.com + * added contributed DOS TURBOC port by Victor + * modified bin/mdemo to clip 3d drawing into a circle, added penguin + * added GdAllocRectRegion, GdAllocRectRegionIndirect, + * added GdSetRectRegion, GdAllocRegion, GdDestroyRegion + * added SelectClipRgn, ExtSelectClipRgn, user clip regions! + * added DYNAMICREGIONS define for dynamic vs static (small) clip code + * added win32 HRGN object and region routines + * added GetCursorPos + * added Al's update event patches for Nano-X client window manager + * added Rosimildo's RTEMS patches for uniform input devices + * added George's partial mouse data read fixes (upper level only) +Version 0.88pre2 - 29th February 2000 - greg@censoft.com + * added Al's npanel Nano-X program exec'er (cool) + * added Al's patch to cleanup windows on Nano-X client exit + * added Al's ignore sigpipe for ELKS + * added Morten's jpeg grayscale patch + * create dword-aligned offscreen bitmaps for speed + * removed much of global scrdev + * changed screen driver open routine to return psd + * added Vidar's patch for offscreen drawing in Nano-X, added + GrNewPixmap, GrCopyArea. GrDestroyWindow destroys pixmaps +Version 0.88pre1b - 23rd February 2000 - greg@censoft.com + * added Kyle's bug fix for 16 and 32bpp jpeg support +Version 0.88pre1 - 22nd February 2000 - greg@censoft.com + * added PSD to GdClip routines, fixing potential offscreen write bug + * renamed libraries, added "make install", hdrs to /usr/include/microwin + and libs to /usr/lib/libmw*.a and libnano-X.a + * renamed RECT, POINT, CLIPRECT and CLIPREGION types to MWxxx + * added Al's ELKS patches for client/server Nano-X on ELKS + * renamed xconfigure, updated INSTALL with make instructions + * rewrote all fb drivers for speed eliminating multiple function calls + * allow GdText count == -1 for strlen() + * added GdCalcMemGCAlloc to calculate offscreen allocate size + * added three offscreen memory allocation entry points to screen driver + * rewrote vga16 driver to use outw rather than outb for speed + * adjusted fb drivers to always draw last point for drawhorz/drawvert + * rewrote VT switching code, removed from fb driver to separate file + * added SetIOPermissions in scrdev for pthreads create i/o bitmap bug + * fixed parms named "min" in demos for ELKS bcc compiler + * changed VT switch signal to SIGUNUSED for pthreads compatibility + * added Brad's touch panel/mouse calibrator to contrib/GPL/tpcal + * fixed up SVGAlib driver for 256 colors, added screen to screen blit + * process all mouse messages before next select: better mouse speed + * added HTBORDER hit testing + * fixed FBVGA blitting, wrong scrdev used on memdc +Version 0.87 - 13th February 2000 - greg@censoft.com + * added VTSWITCH in config to include virtual terminal switch code + * added support for 24bpp, wrote 24bpp fb driver + * fixed 8/8/8 color macros: RGB2PIXEL888, COLOR2PIXEL888, PIXEL888RED + * fixed 32bpp fb bug with psd->ncolors, 32bpp alpha blit bugs + * added fb driver support for FB_VISUAL_DIRECTCOLOR cards (ATI) + * sped up 16, 32bpp blitters by using memcpy + * added large font patches from Kyle + * added PACIFIC C compiler support from Victor + * default UPDATEREGIONS=N in config file for alpha blend demo + * removed XORMOVE from config, requires only ERASEMOVE=N + * wrote alpha blending demo (requires UPDATEREGIONS=N) + * rewrote void *pixels in devdraw.c, won't compile on ansi compilers + * fixed PF_TRUECOLOR0888 bug in GdArea + * added DJGPP as config ARCH option, Victor's patches for DJGPP + * finalized alpha blending blit routines for 8, 16, and 32bpp + * added SetTimer/KillTimer api (single timer only) + * added Chris' SetSysColor api, C++ object frameworks patch to mwin/ + * added Rosimildo's make patches for RTEMS + * added Martin's make/configure patches +Version 0.87pre6 - 31st January 2000 - greg@censoft.com + * added C++ objects framework from Chris + * added support for multiple read/write/except fd's from Chris + * added Martin's X11 configure program and various Makefile fixes + * added compile time warnings patches from Chris + * added Morten's drawarea patch pre5mr1 + * added experimental 8, 16 and 32bpp constant alpha blending to bitblit + (#define ALPHABLEND in device.h and run bin/mterm for demo) + * changed distance-cubed find nearest color to use abs() for speed + * fixed max character height/width alloc; max now 128x128 (configurable) + * small bugfix DRAWON/DRAWOFF in mempl4.c +Version 0.87pre5 - 26th January 2000 - greg@censoft.com + * prepared prebuilt config files for fb, x11, svga + * added Morten's drawarea driver patch (16bpp only) + * fixed XOR drawing for 1, 2, 4bpp, improved speed with x>>2 not x/4 + * applied Chris' FBVGA patch + * applied Rosilmildo's RTEMS compiling patch + * applied Morten's SCREEN_PIXTYPE X11 Makefile patch + * added Chris' SetWindowLong and $(HOME)config and Arch.rules patch + * completed fix for DJGPP compiled mou_dos.c driver + * added Kyle's patches for arbitrarily wide text chars +Version 0.87pre4 - 18th January 2000 - greg@censoft.com + * added Martin's new config-based Makefile system + * added Martin's JPEG and BMP file reading/display routines + * added Morten's variable PIXELVAL size mods + * added contributed DJGPP/GRX port by Victor Rogachev + * fixed 16bpp and 32bpp fb blit routines, by Kyle Harris + * added Rosimildo's RTEMS changes, scr_bios now runs without bios + * added Dan's GrReparentWindow, fixed GetWindowInfo bug + * added PF_TRUECOLOR0888 for 4 byte packing + * updated doc directory with html faq, architecture +Version 0.87pre3 - 19th December 1999 - greg@censoft.com + * started directory reorganization + * changed LINUX meaning in Makefile, added UNIX for SOLARIS + * fix negative blit index bug found under X11 by Piotr + * set rootwp->parent = NULL for nano-X, fixes GrMoveWindow clip bug + * added COLORVAL<->PIXELVAL conversion macros + * modified GrArea to take packed pixel values of 8, 16 and 24 bits + * modified GrArea to take RGB COLORVALs as well as PIXELVALs + * renamed PF_TRUECOLOR24 to PF_TRUECOLOR888 + * added tunable MAXREQUESTSZ to limit max request length + * modified Nano-X demo.c to GrArea() > 64k pixelvals for testing + * fix client/server 64k length bug (request can be 24 bits in length) + * fixed portrait mode in CreateCompatibleBitmap +Version 0.87pre2 - 14th December 1999 - greg@censoft.com + * added fixes to run on big-endian machines + * integrated rtems port, protected mode vga driver + * added ARM SA1100 4bpp LCD controller driver + * added portrait mode fb driver from Martin Jolicoeur + * fixed GrMoveWindow for child windows, MoveWindow for grandchildren + * added nanox move.c window move test program from Daniel + * rtems portability fixes, use rather than + * fixed mterm demo pty bug under X11 +Version 0.87pre1 - 2nd December 1999 - greg@censoft.com + * added GrMainLoop convenience function + * added passive library entry points GrPrepareSelect,GrServiceSelect + * completely rewrote nano-X client/server networking layer for speed + * removed nano-X stubs file, rename Gs* routines to Gr* + * added GrFindColor function to convert RGB color to pixel value + * added GetSystemPaletteEntries, GrGetSystemPalette functions + * added null mouse driver (NOMOUSE) + * added X11 driver by Tony Rogvall , fixed colors +Version 0.86 - 28th October 1999 - greg@censoft.com + * merged framebuffer, elks and msdos vga 16 color 4 planes drivers + * wrote vga bitbit routines (a herculean effort) + * optimized bitblit by traversing window clip region + * added experimental multi-rectangle dynamically allocated regions + * wrote scrolling terminal emulator demo for microwindows + * added WM_FDINPUT msg, WndRegisterFdInput call for terminal emulator + * changed SCREENINFO struct, removed black/white, added bpp, planes + * added offscreen (memory DC) drawing to microwindows + * added BitBlt, CreateCompatibleBitmap, CreateCompatibleDC, DeleteDC + * retired BOGL library, must use new interface for blitting + * converted framebuffer, svgalib, elks and msdos screen drivers + * (we need blit routines for herc and svgalib still) + * major screen driver interface change, old drivers not compatible +Version 0.85 - 14th October 1999 - greg@censoft.com + * ported microwindows to Casio and Clio palm pc's (thanks Brad) + * ported microwindows to Everex Freestyle palm pc + * changed ncolors in SCREENINFO user struct to long + * system automatically supports 1, 2, 4, 8bpp palette + and 8, 16 and 24 bpp truecolor systems (332, 565, 888 packing) + * removed F_PALINDEX from std colors, std colors now RGB + * wrote 16bpp, 32bpp fb drivers, 2bpp, 4bpp for palm pc + * removed requirement for bogl library, wrote direct framebuffer driver + * started screen driver rearchitecture for bitblit + * experimental bitblt + * added touchscreen device from Brad LaRonde + * enhanced nano-X terminal emulator, added scrolling,bitblit + * added GrRegisterInput for terminal emulator without polling + * rewrote GrGetNextEvent to not require polling + * added CREDITS file + * integrated Vidar's nanoWidgets 0.2 + * added screenshot capability: read /dev/fb0 on exit + * wrote makebmp utility to convert fb data to bmp file +Version 0.84 - 3rd October 1999 - greg@censoft.com + * integrated Vidar's nanoWidgets 0.1, changed color constants + * integrated Brad LaRonde's MIPS LinuxCE port cross-compile changes + * integrated Alex's nano-X-0.5pre3 changes except dir/filename changes + * added support for 8 to 32 bit truecolor systems + * reorganized Makefile for nanoX and linked/non-linked nano-X servers + * reorganized Makefiles for gcc, bcc and other compilers + * reorganized nano-X.h header file for client programs + * fixed GrSetGCFont,GrGetGCTextSize,ReadArea,Area client/server bugs + * fix bug in nanoX network select code for client attach + * workaround for GrGetNextEvent in nanoX client lib + * wrote asm version of VGA driver for ELKS + * added optimized herc hline routine from thomas_d_stewart@hotmail.com + * added contributed terminal emulator demo for nano-X, + (from Alistair Riddoch, requires linked server) +Version 0.83 - 14th July 1999 - greg@censoft.com + * wrote sample untested hercules driver for ELKS + * tweaked window repaint code to paint child windows last for ELKS + * fixed code for pass-by-structure for bcc/ELKS + * added TEST= for select() code in ELKS +Version 0.82 - 5th July 1999 - greg@censoft.com + * added contributed clock demo for nano-X from Alistair Riddoch + * added update region calculation for window painting + * fixed GdColorInPalette, GdSetPalette, various palette bugs + * added double click to maximize/restore windows + * added mouse double click processing + * added GetTickCount() api, requires OS millisecond time fn + * fixed some expose region calculations + * combined Makefile builds both/either Micro-Windows and Nano-X + * wrote XORMOVE window move algorithm for slow cpu's + * added GetDCEx(), SetROP2() and various rect api + * change to single toplevel Makefile mod for ELKS or LINUX + * changed default ELKS mouse port to /dev/ttys0, type to "pc" + * changed tgmath.h to math.h +Version 0.81 - 22nd June 1999 - greg@censoft.com + * added Free System font + * removed mswin4 background + * changed nano directory + * changed vgaplan4 unsigned int fix for ELKS screen bug + * set default rom character height to 14 for scr_bios driver + * added -ansi option for bcc (I'll post my ansi compiling bcc shortly) +Version 0.8 - 20th June 1999 - greg@censoft.com + * added 3d graphics library for demo app + * removed ms windows grabbed fonts, added FreeSansSerif font + * added color bitmap support + * wrote windows bmp file converter + * drawing color bitmaps in 1, 4 and 8 bpp supported + * added support for loading partial palettes + * added MakePaletteConversionTable function + * added support for sophisticated palette optimization + * implemented optimized window redraw algorithms during window moves + * added child window support + * wrote button control + * added more sophisticated focus routines on create/destroy + * added support for type 1 and type 2 line drawing requests in GdLine + * added multiple window color schemes + * added desktop wallpaper +Version 0.7 - 8th June 1999 - greg@censoft.com + * created new win32 api: Micro-Win + * created window manager and overlapped window border drawcode + * added software cursor structure to device layer + * changed nano-x and micro-win color model to RGB for user programs + * added setpalette driver entry point, 16 and 256 color std palettes + * fixed console refresh bug for BOGL + * fixed expose bug bad return; + * fixed ELKS cols,rows bug in scr_bios.c + * disallow console switching for ELKS while in graphics mode + * added EGAMODE and CHARHEIGHT environment variables for ELKS/DOS +Version 0.6 - 23rd May 1999 - greg@censoft.com + * Updated bugs from new mini-x distribution + * Wrote int33 mouse driver for dos + * Wrote a portable vga 4 plane driver for dos, elks + * Updated dos driver to support XOR,AND,OR draw modes + * Wrote routines for ELKS port, compiled with bcc + uses new serial mouse driver, vga 4 plane driver and bios kbd + * Added check for FRAMEBUFFER environment variable for /dev/fbX open + * Added clipped text output routines, using bitmaps + * Added GetCharBits device driver entry point, removed DrawText + * Added new nano-X font format, wrote conversion programs to + convert bdf fonts and PC ROM bios fonts. There is no longer + any dependency on the BOGL font structure. Any number + of fonts are supported. Fonts use min 16 bits/scanline. + Convbdf and convrom.exe are included. + * Created rom 8x16, 8x16 fonts. + * Entire nano-X can run on only drawpixel and readpixel if required + * Documented scr_bogl.c (bogl), and scr_bios.c (bios) drivers. + * Ported world program to 16 bit systems + * Added pc, microsoft and logitech direct serial driver mouse support + * Wrote SVGAlib screen driver, will now run on *any* linux system, + not just v2.x framebuffer systems. scr_svga.c. + * Nano-X is now completely self contained, if desired, in that + there are hw drivers for screen, mouse, and keyboard + that don't require other software to be running +Version 0.5 - 18th May 1999 - greg@censoft.com + * Rewrote cursor routines + * Separated mouse from cursor routines + * Removed DrawCursor from device driver + * Added ReadPixel to device driver + * Made demo programs work with cursor changes + * Added polygon draw and fill routines + * Added area pixel reading/writing, removed 8-bit limit for colors + * Reworked color model + * Added direct hardware 640x480x16 support for VGA real mode systems + * Made api backwards compatible with mini-x + * Ported mini-x world demo program to examples library + +Version 0.4 - 12th May 1999 - greg@censoft.com + * Added XOR drawing mode to screen drivers + * Fixed rectangle, fillrect, and line off-by-one bugs + * Commented example drivers better + * Implemented text clipping + * Fixed VT switch code and redraw + * Hacked physical/virtual 0,0 mapping on linux framebuffer startup + * Added 256 color and 16 color explicit palette to bogl driver + * Added GetFontInfo and GetScreenInfo to drivers + +Version 0.3 - 9th May 1999 - greg@censoft.com + * Release 0.3 is heavy rewrite of lower-level/mid-level routines + * cursor clipping implemented + * screen, mouse and kbd driver APIs created + * includes GPM mouse driver, /dev/tty keyboard driver + * all device-dependent code is in drivers/ directory + * intended as evaluation for standalone and other OS ports + * should be easy to write an int 10h driver for real mode operation + * should be easy to add any other kbd, mouse or screen drivers + * quick port with MSC 5.10 for MSDOS created + +Version 0.2 - 5th May 1999 - greg@censoft.com + * Made release 0.1 operational for evaluation + * Added event processing + * Made demo programs work + * Fixed numerous bugs + * Added client direct link stub routines for non networked systems/test + * Started screen device driver api and bogl integration rewrite + * printf debug code is still included, this is an interim release + for strawman evaluation + +Version 0.1 - 25th April 1999 - alex@linuxhacker.org +Initial release, based on Alan Cox's combination of mini-X and Bogl, and some more work +by myself. Changes since Alan's release include: + + * Client library and server process are seperate. + * Mouse driver rewritten to take the output of GPM in repeater mode. + * Mouse pointer code added to the bogl cfb8 driver. + * K & R parameter declarations converted to ANSI. + * Main control loop uses select() instead of busy waiting. + * Beginning of code to redraw screen on switching to graphics console. + * Client data is stored in a dynamic linked list instead of a fixed size array. + * Some minor bugs fixed. + * Many major bugs added. + * ChangeLog, TODO, BUGS, README, INSTALL, etc. written. + * Probably various other things I've forgotten about now. diff --git a/packages/services/gfx/mw/current/src/Configs/README b/packages/services/gfx/mw/current/src/Configs/README new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/README @@ -0,0 +1,35 @@ +The config files in this directory are pre-built for ease +in building Microwindows on various systems. One config file, +config.fb, is kept up with the latest configuration options. +Use it if you are building a configuration from scratch for +your system. + +To build Microwindows, copy one of these files to microwin/src/config, +and type "make clean; make". + +// Common configurations +config.fb Basic Linux Framebuffer (FB) +config.x11 Microwindows running on X11 +config.ft FB and Freetype font rendering +config.tt FB and T1Lib font rendering +config.xtt X11 and Freetype font rendering + +// Specific ports +config.ads ARM Linux FB for ADS Graphics Client +config.big5 FB and Chinese Big5 fonts +config.dj DJGPP 32-bit MSDOS +config.elks ELKS 16-bit Linux (bcc compiler) +config.freebsd FreeBSD port +config.harrier MIPS Linux FB for NEC Harrier +config.helio MIPS Linux FB for VTech Helio +config.hzk FB and Chinese HZK fonts +config.ipaq ARM Linux FB for iPAQ +config.l7200 ARM Linux FB for L7200 +config.ns x86 Linux for National Semi Geode +config.oti PPC Linux for OTI +config.ppc PPC Linux for Embedded Planet Linux Planet +config.prisma Prisma port +config.psion Psion port +config.rtems RTEMS port +config.svga x86 Linux SVGALib screen driver +config.yopy ARM Linux FB for G.Mate YOPY diff --git a/packages/services/gfx/mw/current/src/Configs/config.ads b/packages/services/gfx/mw/current/src/Configs/config.ads new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.ads @@ -0,0 +1,285 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-ARM +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = Y +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +NOKBD = Y + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.big5 b/packages/services/gfx/mw/current/src/Configs/config.big5 new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.big5 @@ -0,0 +1,296 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = Y +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = Y + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = Y +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.dj b/packages/services/gfx/mw/current/src/Configs/config.dj new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.dj @@ -0,0 +1,300 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = DJGPP +#ARMTOOLSPREFIX = arm-linux- +#MIPSTOOLSPREFIX = mipsel-linux- +#POWERPCTOOLSPREFIX = powerpc-linux- +#RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = Y + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = N +VNC = N +NXSCRIBBLE = N + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_PALETTE + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = Y + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = N + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +FRAMEBUFFER = N +FBVGA = N +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif + +#################################################################### +# +# If the platform is running DOS box using DJGPP and GRX ... +# +#################################################################### +ifeq ($(ARCH), DJGPP) + +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 256 + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.dj-2 b/packages/services/gfx/mw/current/src/Configs/config.dj-2 new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.dj-2 @@ -0,0 +1,300 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = DJGPP +#ARMTOOLSPREFIX = arm-linux- +#MIPSTOOLSPREFIX = mipsel-linux- +#POWERPCTOOLSPREFIX = powerpc-linux- +#RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = Y + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = Y +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y +VNC = N +NXSCRIBBLE = N + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_PALETTE + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = Y + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = N + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = libpng.a +LIBZ = libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = include +LIBT1LIB = libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = include +LIBFTLIB = libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +FRAMEBUFFER = N +FBVGA = N +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif + +#################################################################### +# +# If the platform is running DOS box using DJGPP and GRX ... +# +#################################################################### +ifeq ($(ARCH), DJGPP) + +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 256 + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.ecos b/packages/services/gfx/mw/current/src/Configs/config.ecos new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.ecos @@ -0,0 +1,315 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# LINUX-SH +# FREEBSD-X86 +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = ECOS +#ARMTOOLSPREFIX = arm-linux-gnu- +ARMTOOLSPREFIX = arm-elf- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +SHTOOLSPREFIX = sh-linux-gnu +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = Y +VERBOSE = Y + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = Y +OBJFRAMEWORK = N + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR555 /* pixel is packed 16 bits 5/5/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +#SCREEN_PIXTYPE = MWPF_TRUECOLOR565 +SCREEN_PIXTYPE = MWPF_TRUECOLOR555 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = N +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = Y +INCJPEG = ${MW_BASE}/src/jpeg-6b +LIBJPEG = ${INCJPEG}/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = N + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +# You may want to turn this on for XFree86 4.x or if your backing store +# isn't functioning properly +USE_EXPOSURE = N + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +# set FBREVERSE to reverse bit orders in 1,2,4 bpp +# set FBVGA=N for all systems without VGA hardware (for MIPS must=N) +FRAMEBUFFER = Y +FBVGA = N +VTSWITCH = N +#PORTRAIT_MODE = R +PORTRAIT_MODE = N +FBREVERSE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# TPHELIO for VTech Helio +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0) +# HARRIERMOUSE for NEC Harrier +# PSIONMOUSE for the Psion 5 +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +TPHELIO = N +ADSMOUSE = N +IPAQMOUSE = Y +HARRIERMOUSE = N +PSIONMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +SCANKBD = N +PIPEKBD = N +NOKBD = N +IPAQKBD = Y + +endif + +#################################################################### +# Screen driver specific configuration +# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller +# INVERT4BPP 4bpp inverted pixel driver for VTech Helio +#################################################################### +SA1100_LCD_LTLEND = N +INVERT4BPP = N + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.ecosvga b/packages/services/gfx/mw/current/src/Configs/config.ecosvga new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.ecosvga @@ -0,0 +1,317 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# LINUX-SH +# FREEBSD-X86 +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = ECOS +ECOSTARGET = PCVGA +#ARMTOOLSPREFIX = arm-linux-gnu- +ARMTOOLSPREFIX = arm-elf- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +SHTOOLSPREFIX = sh-linux-gnu +RTEMSTOOLSPREFIX = i386-rtemself- +I386TOOLSPREFIX = i386-elf + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = Y +VERBOSE = Y + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = Y +OBJFRAMEWORK = N + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = N +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR555 /* pixel is packed 16 bits 5/5/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +#SCREEN_PIXTYPE = MWPF_TRUECOLOR565 +SCREEN_PIXTYPE = MWPF_PALETTE + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = N +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = ${MW_BASE}/src/jpeg-6b +LIBJPEG = ${INCJPEG}/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = N + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +# You may want to turn this on for XFree86 4.x or if your backing store +# isn't functioning properly +USE_EXPOSURE = N + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +# set FBREVERSE to reverse bit orders in 1,2,4 bpp +# set FBVGA=N for all systems without VGA hardware (for MIPS must=N) +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = N +#PORTRAIT_MODE = R +PORTRAIT_MODE = N +FBREVERSE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = Y + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# TPHELIO for VTech Helio +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0) +# HARRIERMOUSE for NEC Harrier +# PSIONMOUSE for the Psion 5 +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +TPHELIO = N +ADSMOUSE = N +IPAQMOUSE = N +HARRIERMOUSE = N +PSIONMOUSE = N +NOMOUSE = Y + +# keyboard or null kbd driver +TTYKBD = N +SCANKBD = N +PIPEKBD = N +NOKBD = Y +IPAQKBD = N + +endif + +#################################################################### +# Screen driver specific configuration +# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller +# INVERT4BPP 4bpp inverted pixel driver for VTech Helio +#################################################################### +SA1100_LCD_LTLEND = N +INVERT4BPP = N + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.elks b/packages/services/gfx/mw/current/src/Configs/config.elks new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.elks @@ -0,0 +1,251 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = ELKS +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = N + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_PALETTE + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = Y + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = N + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard type +TTYKBD = Y + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.fb b/packages/services/gfx/mw/current/src/Configs/config.fb new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.fb @@ -0,0 +1,317 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# LINUX-SH +# FREEBSD-X86 +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +SHTOOLSPREFIX = sh-linux-gnu +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR555 /* pixel is packed 16 bits 5/5/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = N + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Korean HANGUL font support (jo16x16.c) +#################################################################### +HAVE_KSC5601_SUPPORT = N +HANGUL_FONT_DIR = "fonts/korean" + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +# You may want to turn this on for XFree86 4.x or if your backing store +# isn't functioning properly +USE_EXPOSURE = Y + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set FBREVERSE to reverse bit orders in 1,2,4 bpp +# set FBVGA=N for all systems without VGA hardware (for MIPS must=N) +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y +FBREVERSE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# TPHELIO for VTech Helio +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0) +# HARRIERMOUSE for NEC Harrier +# PSIONMOUSE for the Psion 5 +# MTMOUSE for Microtouch touchpanel controller at RS232 port +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +TPHELIO = N +ADSMOUSE = N +IPAQMOUSE = N +HARRIERMOUSE = N +PSIONMOUSE = N +MTMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +SCANKBD = Y +PIPEKBD = N +NOKBD = N + +endif + +#################################################################### +# Screen driver specific configuration +# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller +# INVERT4BPP 4bpp inverted pixel driver for VTech Helio +#################################################################### +SA1100_LCD_LTLEND = N +INVERT4BPP = N + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.freebsd b/packages/services/gfx/mw/current/src/Configs/config.freebsd new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.freebsd @@ -0,0 +1,285 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = FREEBSD-X86 +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = Y +NWIDGET = Y +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_PALETTE + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = Y +INCJPEG = /usr/local/include/ +LIBJPEG = /usr/local/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = Y +INCT1LIB = /usr/local/include +LIBT1LIB = /usr/local/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = Y +INCFTLIB = /usr/local/freetype/include +LIBFTLIB = /usr/local/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = Y + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +FRAMEBUFFER = N +FBVGA = N +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.ft b/packages/services/gfx/mw/current/src/Configs/config.ft new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.ft @@ -0,0 +1,309 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# LINUX-SH +# FREEBSD-X86 +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +SHTOOLSPREFIX = sh-linux-gnu +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR555 /* pixel is packed 16 bits 5/5/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = Y +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = N + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +# You may want to turn this on for XFree86 4.x or if your backing store +# isn't functioning properly +USE_EXPOSURE = N + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set FBREVERSE to reverse bit orders in 1,2,4 bpp +# set FBVGA=N for all systems without VGA hardware (for MIPS must=N) +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y +FBREVERSE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# TPHELIO for VTech Helio +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0) +# HARRIERMOUSE for NEC Harrier +# PSIONMOUSE for the Psion 5 +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +TPHELIO = N +ADSMOUSE = N +IPAQMOUSE = N +HARRIERMOUSE = N +PSIONMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +SCANKBD = Y +PIPEKBD = N +NOKBD = N + +endif + +#################################################################### +# Screen driver specific configuration +# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller +# INVERT4BPP 4bpp inverted pixel driver for VTech Helio +#################################################################### +SA1100_LCD_LTLEND = N +INVERT4BPP = N + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.harrier b/packages/services/gfx/mw/current/src/Configs/config.harrier new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.harrier @@ -0,0 +1,286 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-MIPS +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = N +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +HARRIERMOUSE = Y +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +NOKBD = Y + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.helio b/packages/services/gfx/mw/current/src/Configs/config.helio new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.helio @@ -0,0 +1,297 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-MIPS +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = Y + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = N +NANOX = Y +SHAREDLIBS = Y +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = N + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = N + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +#SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 +SCREEN_PIXTYPE = MWPF_PALETTE + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_GIF_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = Y +INCJPEG = . +#LIBJPEG = /usr/lib/libjpeg.so +ifeq ($(ARCH), LINUX-MIPS) +LIBJPEG = /usr/mipsel-linux/lib/libjpeg.so +endif + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = N + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = Y + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = N +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# TPHELIO for VTech Helio +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +TPHELIO = Y +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +NOKBD = Y + +endif + +#################################################################### +# Screen driver specific configuration +# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller +# INVERT4BPP 4bpp inverted pixel driver for VTech Helio +#################################################################### +SA1100_LCD_LTLEND = N +INVERT4BPP = Y + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.hzk b/packages/services/gfx/mw/current/src/Configs/config.hzk new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.hzk @@ -0,0 +1,286 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = Y +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = Y +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = Y +HZK_FONT_DIR = "/home/greg/net/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = Y +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.ipaq b/packages/services/gfx/mw/current/src/Configs/config.ipaq new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.ipaq @@ -0,0 +1,285 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-ARM +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = Y +INCJPEG = . +LIBJPEG = /skiff/local/arm-linux/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = N +VTSWITCH = N +PORTRAIT_MODE = R + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ and Intel Assabet (/dev/h3600_ts 11,0) +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = Y +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +NOKBD = Y + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.ksc b/packages/services/gfx/mw/current/src/Configs/config.ksc new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.ksc @@ -0,0 +1,317 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# LINUX-SH +# FREEBSD-X86 +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +SHTOOLSPREFIX = sh-linux-gnu +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR555 /* pixel is packed 16 bits 5/5/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = N + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Korean HANGUL font support (jo16x16.c) +#################################################################### +HAVE_KSC5601_SUPPORT = Y +HANGUL_FONT_DIR = "fonts/korean" + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +# You may want to turn this on for XFree86 4.x or if your backing store +# isn't functioning properly +USE_EXPOSURE = Y + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set FBREVERSE to reverse bit orders in 1,2,4 bpp +# set FBVGA=N for all systems without VGA hardware (for MIPS must=N) +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y +FBREVERSE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# TPHELIO for VTech Helio +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0) +# HARRIERMOUSE for NEC Harrier +# PSIONMOUSE for the Psion 5 +# MTMOUSE for Microtouch touchpanel controller at RS232 port +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +TPHELIO = N +ADSMOUSE = N +IPAQMOUSE = N +HARRIERMOUSE = N +PSIONMOUSE = N +MTMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +SCANKBD = Y +PIPEKBD = N +NOKBD = N + +endif + +#################################################################### +# Screen driver specific configuration +# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller +# INVERT4BPP 4bpp inverted pixel driver for VTech Helio +#################################################################### +SA1100_LCD_LTLEND = N +INVERT4BPP = N + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.l7200 b/packages/services/gfx/mw/current/src/Configs/config.l7200 new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.l7200 @@ -0,0 +1,297 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# LINUX-SH +# FREEBSD-X86 +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-ARM +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +SHTOOLSPREFIX = sh-linux-gnu +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = Y +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_PALETTE + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = N + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +# set FBREVERSE to reverse bit orders in 1,2,4 bpp +# set FBVGA=N for all systems without VGA hardware (for MIPS must=N) +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y +PORTRAIT_MODE = N +FBREVERSE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# TPHELIO for VTech Helio +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +# HARRIERMOUSE for NEC Harrier +# PSIONMOUSE for the Psion 5 +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +TPHELIO = N +ADSMOUSE = N +IPAQMOUSE = Y +HARRIERMOUSE = N +PSIONMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +PIPEKBD = N +NOKBD = Y + +endif + +#################################################################### +# Screen driver specific configuration +# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller +# INVERT4BPP 4bpp inverted pixel driver for VTech Helio +#################################################################### +SA1100_LCD_LTLEND = N +INVERT4BPP = N + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.mozilla b/packages/services/gfx/mw/current/src/Configs/config.mozilla new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.mozilla @@ -0,0 +1,317 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# LINUX-SH +# FREEBSD-X86 +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +SHTOOLSPREFIX = sh-linux-gnu +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = Y +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR555 /* pixel is packed 16 bits 5/5/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = Y +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = N + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Korean HANGUL font support (jo16x16.c) +#################################################################### +HAVE_KSC5601_SUPPORT = N +HANGUL_FONT_DIR = "fonts/korean" + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +# You may want to turn this on for XFree86 4.x or if your backing store +# isn't functioning properly +USE_EXPOSURE = Y + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set FBREVERSE to reverse bit orders in 1,2,4 bpp +# set FBVGA=N for all systems without VGA hardware (for MIPS must=N) +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y +FBREVERSE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# TPHELIO for VTech Helio +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0) +# HARRIERMOUSE for NEC Harrier +# PSIONMOUSE for the Psion 5 +# MTMOUSE for Microtouch touchpanel controller at RS232 port +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +TPHELIO = N +ADSMOUSE = N +IPAQMOUSE = N +HARRIERMOUSE = N +PSIONMOUSE = N +MTMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +SCANKBD = Y +PIPEKBD = N +NOKBD = N + +endif + +#################################################################### +# Screen driver specific configuration +# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller +# INVERT4BPP 4bpp inverted pixel driver for VTech Helio +#################################################################### +SA1100_LCD_LTLEND = N +INVERT4BPP = N + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.ns b/packages/services/gfx/mw/current/src/Configs/config.ns new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.ns @@ -0,0 +1,292 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = Y +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_XPM_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = Y +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard type +TTYKBD = N +PIPEKBD = N +NOKBD = N +SCANKBD = Y + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.oti b/packages/services/gfx/mw/current/src/Configs/config.oti new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.oti @@ -0,0 +1,291 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = Y +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = Y + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = N +VTSWITCH = Y +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = Y +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.ppc b/packages/services/gfx/mw/current/src/Configs/config.ppc new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.ppc @@ -0,0 +1,286 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-POWERPC +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = N +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = Y +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = Y +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.prisma b/packages/services/gfx/mw/current/src/Configs/config.prisma new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.prisma @@ -0,0 +1,298 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# UCLINUX-PRISMA +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = UCLINUX-PRISMA +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +RTEMSTOOLSPREFIX = i386-rtemself- +UCLINUXTOOLPREFIX = m68k-elf- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = Y + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = N + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_PALETTE + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = Y + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = N +HAVE_GIF_SUPPORT = N +HAVE_PNM_SUPPORT = N + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +FRAMEBUFFER = N +FBVGA = N +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = Y +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = Y +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif +#################################################################### +# +# If the platform is uClinux running on an Isicad Prisma ... +# +#################################################################### +ifeq ($(ARCH), UCLINUX-PRISMA) + +UCROOT = /usr/local/uclinux + +endif + diff --git a/packages/services/gfx/mw/current/src/Configs/config.psion b/packages/services/gfx/mw/current/src/Configs/config.psion new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.psion @@ -0,0 +1,300 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# FREEBSD-X86 +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-ARM +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = Y +NWIDGET = Y +OBJFRAMEWORK = Y + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = N +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = Y + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = N + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 240 +SCREEN_DEPTH = 2 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = N +VTSWITCH = Y +PORTRAIT_MODE = N +FBREVERSE = Y + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# PSIONMOUSE for the Psion 5 +# TPHELIO for VTech Helio +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +TPHELIO = N +ADSMOUSE = N +IPAQMOUSE = N +PSIONMOUSE = Y +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = Y +NOKBD = N + +endif + +#################################################################### +# Screen driver specific configuration +# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller +# INVERT4BPP 4bpp inverted pixel driver for VTech Helio +#################################################################### +SA1100_LCD_LTLEND = N +INVERT4BPP = N + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif + + diff --git a/packages/services/gfx/mw/current/src/Configs/config.rtems b/packages/services/gfx/mw/current/src/Configs/config.rtems new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.rtems @@ -0,0 +1,284 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = RTEMS +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtems- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = Y + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = N +NANOXDEMO = N + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = N + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_PALETTE + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = Y + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard type +TTYKBD = N +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /opt/rtems +RTEMS_BSP = pc486 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.svga b/packages/services/gfx/mw/current/src/Configs/config.svga new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.svga @@ -0,0 +1,250 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +FRAMEBUFFER = N +FBVGA = Y +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = Y + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard type +TTYKBD = Y + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.t1 b/packages/services/gfx/mw/current/src/Configs/config.t1 new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.t1 @@ -0,0 +1,288 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = Y +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = Y + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +SCANKBD = Y +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.x11 b/packages/services/gfx/mw/current/src/Configs/config.x11 new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.x11 @@ -0,0 +1,292 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = N +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = Y + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +# You may want to turn this on for XFree86 4.x or if your backing store +# isn't functioning properly +USE_EXPOSURE = Y + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0) +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard type +TTYKBD = Y +PIPEKBD = N +NOKBD = N + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.xtt b/packages/services/gfx/mw/current/src/Configs/config.xtt new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.xtt @@ -0,0 +1,285 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-NATIVE +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = Y +INCJPEG = . +LIBJPEG = /usr/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = Y +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = Y + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +FRAMEBUFFER = Y +FBVGA = Y +VTSWITCH = Y + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = Y +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N + +# keyboard type +TTYKBD = Y + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/Configs/config.yopy b/packages/services/gfx/mw/current/src/Configs/config.yopy new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Configs/config.yopy @@ -0,0 +1,286 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = LINUX-ARM +ARMTOOLSPREFIX = arm-linux- +MIPSTOOLSPREFIX = mipsel-linux- +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = N +VERBOSE = N + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = N +OBJFRAMEWORK = N + + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +SCREEN_PIXTYPE = MWPF_TRUECOLOR0888 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = Y +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = Y +INCJPEG = . +LIBJPEG = /skiff/local/arm-linux/lib/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +FRAMEBUFFER = Y +FBVGA = N +VTSWITCH = N +PORTRAIT_MODE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +ADSMOUSE = N +IPAQMOUSE = N +NOMOUSE = N +YOPYMOUSE = Y + +# keyboard or null kbd driver +TTYKBD = N +NOKBD = Y + +endif + +#################################################################### +# +# If the platform is a LINUX-ARM box .... +# +#################################################################### +ifeq ($(ARCH), LINUX-ARM) + +# If 4bpp driver with arm SA1100 LCD controller is used ... +SA1100_LCD_LTLEND = N + +endif + + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/INSTALL b/packages/services/gfx/mw/current/src/INSTALL new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/INSTALL @@ -0,0 +1,213 @@ +Microwindows Installation Documentation +September 6, 2001 g haerr + +- For notes on Intel Assabet, see bottom of file - + +Microwindows compiles and runs on Linux, UNIX, ELKS, MSDOS, +RTEMS, X11 and bare hardware. There is support for the MIPS, +ARM, and x86 cpu's using the GNU C cross compiler. + +Microwindows can be compiled to use different screen, +mouse and keyboard drivers for a given operating system environment. +Most options are set using configuration file (microwin/src/config) options. +These options can be manually editted, or if running X11, +by running a graphical configuration program that will read and +write the config file if desired by running "make xconfig". +Other options are set in the graphics drawing engine's header +file microwin/src/include/device.h. + +After changing any options in microwin/src/config, Microwindows +is built by typing "make clean; make". + +Microwindows' header files can be written to /usr/lib/microwin, +and libraries to /usr/lib by typing "make install". This +is not required unless using Microwindows to build other +applications, however. All demos build using the headers +and libraries built in the source tree. + +Config options are detailed in the config file itself and +following each operating environment below. Setting the line + MICROWIN=Y +will build Microwindows. The line + NANOX=Y +will build Nano-X. Both are built by default. + +Setting OPTIMIZE=Y will run an the compiler's -O switch. +Setting DEBUG=Y will add -g. Setting VERBOSE=Y will display +the full compiler command line when making. When cross-compiling +for different platforms, the various XXXTOOLSPREFIX values +must be set accordingly. + +The Nano-X server can be built with a compiled-in application, +or use UNIX sockets to allow seperately compiled applications +to connect to the server. Setting the line + LINK_APP_INTO_SERVER=Y +will build a linked application/server, which is useful for debugging +and speed. The client/server networking code has been rewritten for speed. + +We now have support for scaled, rotated, and antialiased +fonts with both truetype and adobe type 1 fonts. To include +support for truetype fonts, download freetype-1.3.1.tar.gz from +either microwindows.org or www.freetype.org, and set: + HAVE_FREETYPE_SUPPORT=Y +in the config file. For Adobe Type 1 font support, download +t1lib-1.0.tar.tz from microwindows.org or +ftp://ftp.neuroinformatik.ruhr-uni-bochum.de/pub/software/t1lib/ +and set: + HAVE_T1LIB_SUPPORT=Y +in the config file. The ftdemo and t1demo programs demonstrate +use of both truetype and type 1 fonts. + +All the demos are built in the microwin/src/bin directory. Following +are the current demos: + +mdemo Microwindows 3d demo +mterm Microwindows terminal emulator +demo Nano-X demo +demo3 Nano-X .bmp and .jpeg display demo +landmine Nano-X landmine game +world Nano-X world graph demo +nterm Nano-X terminal emulator +nclock Nano-X clock +nano-X Nano-X server (must be run before Nano-X demo) + (see demo*.sh) + +Linux +===== +Linux users set the line below in the config file. + ARCH=LINUX-NATIVE + +Linux users have the choice of running framebuffer screen drivers, +which require kernel 2.2.x, the svgalib screen driver for +Linux 2.0.x users, or X Windows. The framebuffer driver runs on +1, 2, 4, 8, 16 and 32bpp systems. Both linear and VGA memory +layouts are supported. To choose between the framebuffer, +svgalib driver or X Windows, (should run on all Linux systems), +set one of the following lines in the config file: + FRAMEBUFFER=Y (for 1, 2, 4, 8, 16 or 32 bpp linear fb access) + VGALIB=Y (svgalib vga access) + HWVGA=Y (hardware vga access for rtems) + X11=Y (for X11) + +If FRAMEBUFFER is set, the following line enables the optional +4 planes VGA non-linear driver: + FBVGA=Y (for 4 planes VGA 16 color framebuffer) +For MIPS and SuperH compilations, set FBVGA=N, since system header +files don't contain outb() and outw() macros. + +When building the X11 version, it is very important to +set the SCREEN_PIXTYPE value correctly, as Microwindows +will emulate the target pixel depth in X11. See the +config file for more details. + +Linux users can use either the GPM mouse driver, or a "bare" +serial mouse driver that decodes the mouse directly from the +serial port. Set either line in the config file. + GPMMOUSE=Y or + SERMOUSE=Y + NOMOUSE=Y (for no mouse) + +Note that to use the GPM driver, you must start GPM with +the -R option, and usually specify the mouse type with -t. +See mouse.sh for an example. If using the direct serial +mouse driver, the serial port may have to be specified in +microwin/src/drivers/mou_ser.c, as it defaults to /dev/ttyS1. + +I have written a utility that converts MS fonts, for exact +MS-Windows look and feel. You must own a MS license in order +to use an MS font. To use the MS fonts, run mwin/src/fonts/convfnt32.exe +on a Windows system, and it will create the win*.c font tables. +Then, set the following line in the config file: + HAVEMSFONTS=Y + + +ELKS +==== +ELKS users set the line below in the config file. + ARCH=ELKS + +The NWIDGET=N line must be set, as bcc can't handle +ansi C's token paste operator, used in the widget library. + +The serial mouse driver is in microwin/src/drivers/mou_ser.c. +The default mouse port and type can be changed with the following +environment variables, or changed in the driver. + +Environment Var Default Allowed +MOUSE_TYPE pc ms, pc, logi(same as pc) +MOUSE_PORT /dev/ttys0 any serial port + +It might also be a good idea to use the XOR frame-redraw window +move algorithm, by setting the following lines in the config file. +The XOR algorithm redraws only after the window move is +completed, which works well on slower cpu's. + ERASEMOVE=N + UPDATEREGIONS=N + +Since ELKS doesn't currently have a floating point library, +the 3d demo is automatically compiled out of +microwin/src/demos/microwin/demo.c: + #define GRAPH3D 0 + #define IMAGE 0 +The IMAGE define is set to 0 as bringing in most +images will break the 64k data segment limit. The ELKS +version also doesn't include the button control or wallpaper +in the demo to keep the text/data sizes down. + +The latest version of the ELKS kernel supports a variant +of UNIX sockets, using numbers rather than names. To +build a client/server version of Nano-X for ELKS, the config line + LINK_APP_INTO_SERVER=y +must be set. In addition, the bcc compiler doesn't support +the ANSI C '##' token pasting operator which is used +in the client request code, client.c. Run the following +perl script to preprocess the client.c source file: + + cd microwin/src/nanox + mv client.c client.dist + ./elkspatch.pl < client.dist > client.c + +MSDOS +===== +Microwindows is currently ported using MSC v5.10, and MASM. +The file mcmwin.mak will build microwin.exe, and mcnanox.mak +will build nanox.exe. The DEMO= line can be changed to build +different nano-X demos. + +There are contributed DJGPP, TURBO C and PACIFIC C ports. +Instructions are in microwin/src/contrib/djgpp, turboc and +pacific. + +Framebuffer notes: +If you haven't used any of the Linux 2.2 framebuffer drivers before, +it can be a little daunting at first. Alex Buell has written a +Framebuffer HOWTO, which is available on his website at +http://www.tahallah.demon.co.uk/ which goes into detail about the +various drivers, command line options, and the fbset utility. +For any frame buffer other than the Vesa framebuffer +(which can only change modes at bootup because it needs to +execute the code in the video card's ROM in real mode), +you can change bits per pixel with the command 'fbset -depth {8|16|24|32}'. +Another very useful framebuffer site is http://www.linux-fbdev.org + +Intel Assabet +------------- +Microwindows compiles up fine on the StrongARM-based Intel +Assabet. The following information is known to work: + +1. Kernel version - linux-2.4.0-test11 +2. Patches - patch-2.4.0-test11-rmk1, diff-2.4.0-test11-rmk1-np3 +3. Set IPAQMOUSE=Y in Microwindows' config file +4. "mknod /dev/h3600_ts c 11 0" to create the touchscreen device file +5. If your screen isn't calibrated, you'll have to edit the Linux kernel: + - edit drivers/char/ucb1200_ts.c + - search for x_rev = 0 [around line 190] + - change x_rev and y_rev both to 1 + - recompile the kernel +6. More help is available at + http://www.cs.cmu.edu/~wearable/software/assabet.html + +Have fun! + +Greg Haerr + diff --git a/packages/services/gfx/mw/current/src/LICENSE b/packages/services/gfx/mw/current/src/LICENSE new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/LICENSE @@ -0,0 +1,34 @@ +The Microwindows, Nano-X, and BOGL software are licensed under the MPL, +as specified below. Alternatively, the software can be converted to +the GNU General Public License, Version 2. + +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is MicroWindows. + * + * The Initial Developer of the Original Code is Greg Haerr. + * Portions created by Greg Haerr are Copyright (C) 1999 + * Greg Haerr . All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public license (the "[GNU] License"), in which case the + * provisions of [GNU] License are applicable instead of those + * above. If you wish to allow use of your version of this file only + * under the terms of the [GNU] License and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the [GNU] License. If you do not delete + * the provisions above, a recipient may use your version of this file + * under either the MPL or the [GNU] License. + */ diff --git a/packages/services/gfx/mw/current/src/Makefile b/packages/services/gfx/mw/current/src/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Makefile @@ -0,0 +1,59 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr +############################################################################## + +TOP = $(shell pwd) + +# See if the user has a local config file. If so use that else +# use the one provided in the distribution. +ifeq ($(HOME)/microwin/config,$(wildcard $(HOME)/microwin/config)) +CONFIG = $(HOME)/microwin/config +else +CONFIG = $(TOP)/config +endif + +include $(CONFIG) + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += +# Defines for preprocessor +DEFINES += + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +# If you want to create a library with the objects files, define the name here +LIBNAME = +LIBNAMESO = + +# List of objects to compile +OBJS = + +# demos should be built after the libs ! +dirs = drivers mwin engine fonts nanox + +all: default + -$(MAKE) -C demos +ifeq ($(ARCH), ECOS) + $(MAKE) -C ecos +endif + +ecos: default + -mkdir -p bin lib + $(MAKE) -C ecos + + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### diff --git a/packages/services/gfx/mw/current/src/Makefile.rules b/packages/services/gfx/mw/current/src/Makefile.rules new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Makefile.rules @@ -0,0 +1,425 @@ +############################################################################## +# Microwindows rules Makefile +# Copyright (c) 2000, 2002 Martin Jolicoeur, Greg Haerr +# +# This makefile should be placed at the top of a project hierarchy +# +# NOTE: The TOP environment variable should be set to that top directory +############################################################################## + +ifeq ($(ARCH), DJGPP) +SHELL = bash +else +SHELL = /bin/sh +endif + +# install directories for headers and libraries +INSTALL_PREFIX = /usr +HDRINSTALLDIR = $(INSTALL_PREFIX)/include/microwin +LIBINSTALLDIR = $(INSTALL_PREFIX)/lib + +INSTALL_DIR = install -c -m 755 -o root -g root -d +INSTALL_HDR = install -c -m 644 -o root -g bin +INSTALL_LIB = install -c -m 444 -o root -g bin + +INCLUDEDIRS += -I. -I$(TOP)/include + +# +# General configuration setup (see config file) +# +DEFINES += -DMWPIXEL_FORMAT=$(SCREEN_PIXTYPE) + +ifeq ($(VTSWITCH), Y) +DEFINES += -DVTSWITCH=1 +endif + +ifeq ($(X11), Y) +CFLAGS += -DX11=1 +LDFLAGS += -L/usr/X11R6/lib -lX11 +endif + +ifeq ($(VGALIB), Y) +LDFLAGS += -lvga +endif + +ifeq ($(ARCH),FREEBSD-X86) +LDFLAGS += -lvgl +endif + +ifeq ($(HAVE_FILEIO), Y) + +DEFINES += -DHAVE_FILEIO + +ifeq ($(HAVE_JPEG_SUPPORT), Y) +DEFINES += -DHAVE_JPEG_SUPPORT=1 +INCLUDEDIRS += -I$(INCJPEG) +endif + +ifeq ($(HAVE_PNG_SUPPORT), Y) +DEFINES += -DHAVE_PNG_SUPPORT=1 +INCLUDEDIRS += -I$(INCPNG) +endif + +ifeq ($(HAVE_T1LIB_SUPPORT), Y) +DEFINES += -DHAVE_T1LIB_SUPPORT=1 +INCLUDEDIRS += -I$(INCT1LIB) +endif + +ifeq ($(HAVE_FREETYPE_SUPPORT), Y) +DEFINES += -DHAVE_FREETYPE_SUPPORT=1 +DEFINES += -DFREETYPE_FONT_DIR=\"$(FREETYPE_FONT_DIR)\" +INCLUDEDIRS += -I$(INCFTLIB) +endif + +ifeq ($(HAVE_HZK_SUPPORT), Y) +DEFINES += -DHAVE_HZK_SUPPORT=1 +DEFINES += -DHZK_FONT_DIR="\"$(HZK_FONT_DIR)"\" +endif + +ifeq ($(HAVE_BIG5_SUPPORT), Y) +DEFINES += -DHAVE_BIG5_SUPPORT=1 +endif + +ifeq ($(HAVE_GB2312_SUPPORT), Y) +DEFINES += -DHAVE_GB2312_SUPPORT=1 +endif + +ifeq ($(HAVE_KSC5601_SUPPORT), Y) +DEFINES += -DHAVE_KSC5601_SUPPORT=1 +DEFINES += -DHANGUL_FONT_DIR="\"$(HANGUL_FONT_DIR)"\" +endif + +ifeq ($(HAVE_BMP_SUPPORT), Y) +DEFINES += -DHAVE_BMP_SUPPORT=1 +endif + +ifeq ($(HAVE_GIF_SUPPORT), Y) +DEFINES += -DHAVE_GIF_SUPPORT=1 +endif + +ifeq ($(HAVE_PNM_SUPPORT), Y) +DEFINES += -DHAVE_PNM_SUPPORT=1 +endif + +ifeq ($(HAVE_XPM_SUPPORT), Y) +DEFINES += -DHAVE_XPM_SUPPORT=1 +endif + +endif + +ifeq ($(NOFONTSORCLIPPING), Y) +CFLAGS += -DNOFONTSORCLIPPING=1 +endif + +ifeq ($(HAVE_SHAREDMEM_SUPPORT), Y) +DEFINES += -DHAVE_SHAREDMEM_SUPPORT=1 +endif + +ifeq ($(SHAREDLIBS), Y) +CFLAGS += -fpic +endif + +ifeq ($(OPTIMIZE), Y) +OPTFLAGS += -O3 +endif + +ifeq ($(DEBUG), Y) +OPTFLAGS += -ggdb +else +#OPTFLAGS += -DNDEBUG +endif + +#CFLAGS += $(INCLUDEDIRS) +HOSTCFLAGS := $(CFLAGS) +CPPFLAGS += $(DEFINES) $(INCLUDEDIRS) +LDFLAGS += -L$(BUILD)/lib +ARFLAGS = crs + +# Tools (may be overridden by Arch.rules) +HOSTCC = gcc +COMPILER = gcc +CXX_COMPILER = g++ +ACHIVER = ar +LINKER = ld + +# Include the rules for arch's +# if the user has a specific arch local to their home load it +ifneq (,$(wildcard $(dir $(CONFIG))/Arch.rules)) + include $(wildcard $(dir $(CONFIG))/Arch.rules) +else + include $(TOP)/Arch.rules +endif + +# Tools ... +CC = $(TOOLSPREFIX)$(COMPILER) +CXX = $(TOOLSPREFIX)$(CXX_COMPILER) +AR = $(TOOLSPREFIX)$(ACHIVER) +LD = $(TOOLSPREFIX)$(LINKER) +NM = $(TOOLSPREFIX)nm +STRIP = $(TOOLSPREFIX)strip +OBJCOPY = $(TOOLSPREFIX)objcopy +CP = cp +MV = mv + +################## Libraries Section ################## + +MWINLIBS = $(BUILD)/lib/libmwin.a $(BUILD)/lib/libmwinlib.a\ + $(BUILD)/lib/libmwengine.a $(BUILD)/lib/libmwdrivers.a\ + $(BUILD)/lib/libmwfonts.a $(BUILD)/lib/libmwimages.a +CCMWINLIBS = -lmwin -lmwinlib -lmwengine -lmwdrivers -lmwfonts -lmwin -lmwimages -lm + +ifeq ($(NWIDGET), Y) +NANOXCLIENTLIBS += $(BUILD)/lib/libnwidget.a +#ifeq ($(LINK_APP_INTO_SERVER), Y) +#NANOXSERVERLIBS += $(BUILD)/lib/libnwidget.a +#endif +endif + +ifeq ($(LINK_APP_INTO_SERVER), Y) +NANOXCLIENTLIBS += $(BUILD)/lib/libnano-X.a $(BUILD)/lib/libmwengine.a\ + $(BUILD)/lib/libmwdrivers.a $(BUILD)/lib/libmwfonts.a +CCNANOXCLIENTLIBS += -lnano-X -lmwengine -lmwdrivers -lmwfonts +else +NANOXCLIENTLIBS += $(BUILD)/lib/libnano-X.a +CCNANOXCLIENTLIBS += -lnano-X +endif + +NANOXSERVERLIBS += $(BUILD)/lib/libmwengine.a $(BUILD)/lib/libmwdrivers.a\ + $(BUILD)/lib/libmwfonts.a +CCNANOXSERVERLIBS += -lmwengine -lmwdrivers -lmwfonts + +ifeq ($(HAVE_FILEIO), Y) +ifeq ($(HAVE_JPEG_SUPPORT), Y) +MWINLIBS += $(LIBJPEG) +CCMWINLIBS += $(LIBJPEG) +NANOXLIBS += $(LIBJPEG) +NANOXSERVERLIBS += $(LIBJPEG) +ifeq ($(SHAREDLIBS), Y) + CCNANOXSERVERLIBS += $(LIBJPEG) +endif +ifeq ($(LINK_APP_INTO_SERVER), Y) + NANOXCLIENTLIBS += $(LIBJPEG) +endif +endif +ifeq ($(HAVE_PNG_SUPPORT), Y) +MWINLIBS += $(LIBPNG) $(LIBZ) +CCMWINLIBS += $(LIBPNG) $(LIBZ) +NANOXLIBS += $(LIBPNG) $(LIBZ) +NANOXSERVERLIBS += $(LIBPNG) $(LIBZ) +ifeq ($(SHAREDLIBS), Y) + CCNANOXSERVERLIBS += $(LIBPNG) $(LIBZ) +endif +ifeq ($(LINK_APP_INTO_SERVER), Y) + NANOXCLIENTLIBS += $(LIBPNG) $(LIBZ) +endif +endif + +endif + +ifeq ($(HAVE_T1LIB_SUPPORT), Y) +MWINLIBS += $(LIBT1LIB) +CCMWINLIBS += $(LIBT1LIB) +NANOXLIBS += $(LIBT1LIB) +NANOXSERVERLIBS += $(LIBT1LIB) +ifeq ($(SHAREDLIBS), Y) + CCNANOXSERVERLIBS += $(LIBT1LIB) +endif +ifeq ($(LINK_APP_INTO_SERVER), Y) + NANOXCLIENTLIBS += $(LIBT1LIB) +endif +LDFLAGS += -lm +endif + +ifeq ($(HAVE_FREETYPE_SUPPORT), Y) +MWINLIBS += $(LIBFTLIB) +CCMWINLIBS += $(LIBFTLIB) +NANOXLIBS += $(LIBFTLIB) +NANOXSERVERLIBS += $(LIBFTLIB) +ifeq ($(SHAREDLIBS), Y) + CCNANOXSERVERLIBS += $(LIBFTLIB) +endif +ifeq ($(LINK_APP_INTO_SERVER), Y) + NANOXCLIENTLIBS += $(LIBFTLIB) +endif +LDFLAGS += -lm +endif + +ifeq ($(ARCH), ELKS) +CCMWINLIBS = $(MWINLIBS) +CCNANOXLIBS = $(NANOXLIBS) +endif + +ifeq ($(ARCH), DJGPP) +CCMWINLIBS += -lgrx20 +CCNANOXLIBS = $(NANOXLIBS) +NANOXCLIENTLIBS += -lgrx20 +endif + +################## End of Libraries Section ################## + +# If you dont want to see every executed command ... +ifeq ($(VERBOSE), N) +.SILENT: +endif + +.PHONY: default subdirs clean cleandepend xconfig + +# Add any exportable variable here +export TOP BUILD ARCH CONFIG + +# +# This is the default target +# It looks for sub-directories with makefiles in it and tries to execute them +# +ifeq ($(SHAREDLIBS), Y) +default: subdirs $(OBJS) $(CXXOBJS) $(BUILD)/lib/$(LIBNAME) $(BUILD)/lib/$(LIBNAMESO) +else +default: subdirs $(OBJS) $(CXXOBJS) $(ASMOBJS) $(BUILD)/lib/$(LIBNAME) +endif + +# 'dirs' can be pre-specified +ifeq ($(dirs), ) +dirs = $(shell for file in `\ls`; \ + do if [ -d $$file -a $$file != "demos" ]; then \ + if [ -f $$file/Makefile ]; then echo $$file; fi; fi; done) +endif + +# 'demos' can be pre-specified +ifeq ($(demos), ) +demos = $(shell for file in `\ls`; \ + do if [ -d $$file -a $$file = "demos" ]; then \ + if [ -f $$file/Makefile ]; then echo $$file; fi; fi; done) +endif + +# +# Subdirectories target +# +subdirs: +ifeq ($(ARCH), DJGPP) + + $(shell set CURDIR=$(pwd);) + + $(shell \ + if [ ! -d $(BUILD)/bin ]; \ + then mkdir $(BUILD)/bin; fi;) + + $(shell \ + if [ ! -d $(BUILD)/lib ]; \ + then mkdir $(BUILD)/lib; fi;) + +endif + $(foreach dir, $(dirs), mkdir -p $(dir);) + $(foreach dir, $(dirs), $(MAKE) -C $(dir) -f $(VPATH)/$(dir)/Makefile;) + +# +# If a library name is specified, +# a library of that name will be created with objects in that directory +# +ifneq ($(LIBNAME), ) +$(BUILD)/lib/$(LIBNAME): $(OBJS) $(CXXOBJS) + @echo "Creating library $@ ..." + $(AR) $(ARFLAGS) $(BUILD)/lib/$(LIBNAME) $(OBJS) $(CXXOBJS) $(ASMOBJS) +endif + +# +# If a shared object library name is specified, link this object +# +ifeq ($(SHAREDLIBS), Y) +$(BUILD)/lib/$(LIBNAMESO): $(BUILD)/lib/$(LIBNAME) + @echo "Creating shared library $@ ..." + $(LD) -shared -o $@ --whole-archive $^ +endif + +# +# Dependencies target for C files +# +.depend: $(OBJS:.o=.c) $(CXXOBJS:.o=.cc) + @echo "Updating dependencies in $(CURDIR) ..." + $(SHELL) -ec '$(HOSTCC) -MM $(CPPFLAGS) $(HOSTCFLAGS) $^ \ + | sed '\''s/\($*\)\.o[ :]*/\1.o \$@ : $$(TOP)\/config /g'\'' > $@; \ + [ -s $@ ] || rm -f $@' + +# +# Compilation target for C files +# +%.o:%.c + @echo "Compiling $< ..." + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + + +# +# Compilation target for C++ files +# +%.o:%.cc + @echo "C++ compiling $< ..." + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< + +# +# Compilation target for bmp file conversion +# +%.c:%.bmp $(TOP)/mwin/bmp/convbmp.c + echo "Generating $@ from bitmap file ..." + $(BUILD)/bin/convbmp $< > $@ + +xconfig: + ./xconfigure + +# don't clean lib dir +cleanapps: cleandepend + @echo "Cleaning directory $(CURDIR) ..." + $(RM) core *~ *.bak *.o TAGS + $(RM) bin/* + $(foreach dir, $(dirs), $(MAKE) -C $(dir) -f $(TOP)/$(dir)/Makefile cleanapps;) + $(foreach dir, $(demos), $(MAKE) -C $(dir) -f $(TOP)/$(dir)/Makefile cleanapps;) + +clean: cleandepend + @echo "Cleaning directory $(CURDIR) ..." + $(RM) core *~ *.bak *.o TAGS + $(RM) $(BUILD)/lib/*.a $(BUILD)/lib/*.so + $(shell cd $(BUILD)/bin && \ + for file in `\ls`; do if [ ! -d $$file ]; \ + then $(RM) $$file; fi; done; cd $(TOP)) + $(foreach dir, $(dirs), $(MAKE) -C $(dir) -f $(TOP)/$(dir)/Makefile clean;) + $(foreach dir, $(demos), $(MAKE) -C $(dir) -f $(TOP)/$(dir)/Makefile clean;) + + +cleandepend: + @echo "Cleaning dependencies in directory $(CURDIR) ..." + $(RM) .depend + $(foreach dir, $(dirs), $(MAKE) -C $(dir) -f $(TOP)/$(dir)/Makefile cleandepend;) + $(foreach dir, $(demos), $(MAKE) -C $(dir) -f $(TOP)/$(dir)/Makefile cleandepend;) + +install: default + $(INSTALL_DIR) $(HDRINSTALLDIR) + echo "Copying hdrs to $(HDRINSTALLDIR)" + $(INSTALL_HDR) include/*.h $(HDRINSTALLDIR) + echo "Copying libs to $(LIBINSTALLDIR)" + $(INSTALL_DIR) $(LIBINSTALLDIR) + $(INSTALL_LIB) lib/*.a $(LIBINSTALLDIR) +ifeq ($(SHAREDLIBS), Y) + $(INSTALL_LIB) lib/*.so $(LIBINSTALLDIR) +endif + echo "Installation completed successfully." + +tags: + -rm -f TAGS + etags --language=c++ --append \ + `find . \( -name '*.h' -o -name '*.cc' \) -print` + etags --language=c --append `find . -name \*.[hc] -print` + etags --language=asm --append `find . -name \*.[Ss] -print` + +# +# Included dependency files +# +ifneq ($(MAKECMDGOALS), clean) +ifneq ($(MAKECMDGOALS), cleandepend) +ifneq ($(MAKECMDGOALS), realclean) +ifneq ($(MAKECMDGOALS), xconfig) +ifneq ($(OBJS),) +-include .depend +endif +endif +endif +endif +endif + diff --git a/packages/services/gfx/mw/current/src/TODO b/packages/services/gfx/mw/current/src/TODO new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/TODO @@ -0,0 +1,93 @@ +obsolete MWMODE_SET, MWROP_SRCCOPY, change MWMODE_SETTO1 before 0.89 final +write X11 stretchblit driver entry point +check for HAVE_STRETCHBLIT before calling it... +add psi->fbdriver, psi->rmask, psi->portrait in all drivers/scr*.c +ability to link in only specified fb Xbpp drivers + +send recursive UPDATE_MOVE events to child windows, correct wp->x, wp->y sent +add WM_KEYDOWN/KEYUP bits to win32 +fix GR_EVENT_TYPE_BUTTON_UP doesn't include correct buttons entry for up button +client/server gets screwed up on GsError delivery (GrCloseWindow for instance) +NanoWM should decorate top level windows only +rewrite nanowm to be table-driven +change NewWindow to allow style bits +MAXREQSIZE is statically compiled into each client, should be server only +fix MAXREQSIZE of 10000 in nxproto.h for images... +fix nxterm to take x,y,w,h fg,bg on startup +fix nxterm to redisplay properly +fix potential sibling window clip bug with move2.sh and nanowm +allow nano-x wm to run linked with server + +add memmove mods to fblin16, 8 drivers for src in dst rectangle + +fix GrBitmap bit orders? (reversed from X11?) +clear loaded images in server on app exit +fix strlen(const "") (bug in nxkbd.c for #define TITLE) +free props.title is required in client/server but must not in link-into-server + +change VTech Helio kernel to return proper visual for scr_fb.c (TPHELIO) + +automatically create correct MWPIXEL_FORMAT in exported mwtypes.h +fix Polygon auto-complete outline + +GdHideCursor/ShowCursor still interferes with GdFixCursor + for X11 Enter/LeaveNotify auto-hiding of cursor +add startup options: -portrait, -landscape +t1lib UCS2->8859 conversion +fix fonts/convbdf for > 126 chars, check for constant widths, omit width table +auto swap x/y for autoportrait mode if y>x unless -portrait + +hwnd->update should be an HRGN, make things easier +hwnd->update should be cleared in BeginPaint, except for OWNDC +BeginPaint requires DCX_EXCLUDEUPDATE, may be buggy +Add drawarea driver entry point to all scr*.c! +add blitting to svgalib driver + +handle WS_POPUP owner vs parent for GetParent call +handle lost focus on disable window call, check disabled when setfocus +change kbd driver to return ESC, exit check in upper level GsCheckKbd +slim down devfont.c for small systems +add showcursor flag on return from mousedev open +remove sinfo struct +cursor isn't clipped from blit source rectangle (mterm cursor bug) +share clipping code winclip.c with nanox/srvutil.c +implement client and window rects in nanox +support CopyArea for offscreen drawing +rewrite GdArea to use bitblit +build window mgr api +implement CopyArea to perform BitBlit +change printf's to GsError returns in srvnet.c +X11 still has flush problems with demo.c +add length fields to replies +nomalloc returns are bad in wrapper functions +fix GrRetNoMem to be GsError() +fix DeliverEvent in client lib +move to Xlib api compatibility +warn if bad color args are passed? + +put fixed bcc allowing // comments on ftp site + +have GrGetNextEvent work with timeout returns, for nclock.c etc +fix GrRegisterInput for multiple fd's +fix GrRegisterInput to work with GrCheckNextEvent + +eliminate any timeout in select() loop +no duplicate /dev/tty0 open +fix -O3 framebuffer compile requirement +remove gen_ routines from screen drivers into library, create fb library +tag bitmap drawing palette conversion table to bitmap ID for speed +fix DOS driver for stdpal4bpp for static pseudocolor +rotate 2bpp Everex driver for normal display viewing + +convert all drivers to blit +get fast inline memcpy, memcpyw, memcpyl for bitblt +turn on NDEBUG for speed +bitblt src screen clipping not implemented +bitblt src mem clipping (copy BLACK?) not implemented +bitblt assumes src and dest bitmap are same bpp +vgaplan4 still needs vga_to_mempl4 blit +fix asmplan4.s: don't draw last point, add psd struct, write ega_init + +allow more than one WndRegisterFdInput, run multiple mterm's +dynamically load fonts, replace existing ones +error check gdi structures, check for magic word diff --git a/packages/services/gfx/mw/current/src/Version b/packages/services/gfx/mw/current/src/Version new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/Version @@ -0,0 +1,1 @@ +0.89pre8 diff --git a/packages/services/gfx/mw/current/src/config b/packages/services/gfx/mw/current/src/config new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/config @@ -0,0 +1,316 @@ +#################################################################### +# Microwindows and Nano-X configuration file +# +# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86) +# UNIX, ELKS, DJGPP, or RTEMS. +# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or, +# svgalib for VGA hardware. +# In addition, a gpm or direct serial mouse driver can be configured. +# On ELKS, the bios screen driver and serial mouse driver are always used. +# +# Either Microwindows and/or Nano-X can be built. +# Microwindows and Nano-X have several demos. +# +# For MSDOS makes, see mcmwin.mak and mcnanox.mak +#################################################################### + +#################################################################### +# +# build target platform +# +# Valid ARCH values are: +# +# LINUX-NATIVE +# LINUX-ARM +# LINUX-MIPS +# LINUX-POWERPC +# LINUX-SH +# FREEBSD-X86 +# SOLARIS +# RTEMS +# DJGPP +# ELKS +# +# note: ELKS can't build client/server nano-X, nor widget lib +# +#################################################################### +ARCH = ECOS +ECOSTARGET = IPAQ +#ARMTOOLSPREFIX = arm-linux-gnu- +ARMTOOLSPREFIX = arm-elf- +MIPSTOOLSPREFIX = mipsel-linux- +POWERPCTOOLSPREFIX = powerpc-linux- +SHTOOLSPREFIX = sh-linux-gnu +RTEMSTOOLSPREFIX = i386-rtemself- + +#################################################################### +# +# Compiling options +# +#################################################################### +OPTIMIZE = Y +DEBUG = Y +VERBOSE = Y + +#################################################################### +# +# Libraries to build: microwin, nano-X, nanowidget, object frameworks +# +#################################################################### +MICROWIN = Y +NANOX = Y +SHAREDLIBS = N +NWIDGET = Y +OBJFRAMEWORK = N + +#################################################################### +# +# Demos to build +# +#################################################################### +MICROWINDEMO = Y +NANOXDEMO = Y + +#################################################################### +# +# Applications to build +# +#################################################################### +NANOWM = Y + +#################################################################### +# +# The pixeltype of the native hardware or underlying graphics library. +# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide. +# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset. +# It also enables GdArea/GrArea for this particular pixel packing format. +# +# define MWPF_PALETTE /* pixel is packed 8 bits 1, 4 or 8 pal index*/ +# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR888 /* pixel is packed 24 bits 8/8/8 truecolor*/ +# define MWPF_TRUECOLOR565 /* pixel is packed 16 bits 5/6/5 truecolor*/ +# define MWPF_TRUECOLOR555 /* pixel is packed 16 bits 5/5/5 truecolor*/ +# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2 truecolor*/ +# +#################################################################### +#SCREEN_PIXTYPE = MWPF_TRUECOLOR565 +SCREEN_PIXTYPE = MWPF_TRUECOLOR555 + +#################################################################### +# +# NanoX: Put Y to the following line to link the nano-X application +# with the server. This is required for ELKS, if no network is present, +# or for speed or debugging. This affects the nano-X server only. +# +#################################################################### +LINK_APP_INTO_SERVER = N + +#################################################################### +# +# File I/O support +# Supporting either below drags in libc stdio, which may not be wanted +# +#################################################################### +HAVE_FILEIO = Y + +#################################################################### +# BMP, GIF reading support +#################################################################### +HAVE_BMP_SUPPORT = Y +HAVE_GIF_SUPPORT = N +HAVE_PNM_SUPPORT = Y +HAVE_XPM_SUPPORT = Y + +#################################################################### +# JPEG support through libjpeg, see README.txt in contrib/jpeg +#################################################################### +HAVE_JPEG_SUPPORT = Y +INCJPEG = ${MW_BASE}/src/jpeg-6b +LIBJPEG = ${INCJPEG}/libjpeg.a + +#################################################################### +# PNG support via libpng and libz +#################################################################### +HAVE_PNG_SUPPORT = N +INCPNG = . +LIBPNG = /usr/lib/libpng.a +LIBZ = /usr/lib/libz.a + +#################################################################### +# T1 adobe type1 font support thru t1lib +#################################################################### +HAVE_T1LIB_SUPPORT = N +INCT1LIB = /usr/include +LIBT1LIB = /usr/lib/libt1.a + +#################################################################### +# TrueType font support thru FreeType +#################################################################### +HAVE_FREETYPE_SUPPORT = N +INCFTLIB = /usr/include +LIBFTLIB = /usr/lib/libttf.so +FREETYPE_FONT_DIR = "/usr/local/microwin/fonts" + +#################################################################### +# Shared memory support for Nano-X client/server protocol speedup +#################################################################### +HAVE_SHAREDMEM_SUPPORT = N + +#################################################################### +# Chinese Han Zi Ku font support +#################################################################### +HAVE_HZK_SUPPORT = N +HZK_FONT_DIR = "fonts/chinese" + +#################################################################### +# Chinese BIG5 compiled in font support (big5font.c) +#################################################################### +HAVE_BIG5_SUPPORT = N + +#################################################################### +# Chinese GB2312 compiled in font support (gb2312font.c) +#################################################################### +HAVE_GB2312_SUPPORT = N + +#################################################################### +# Generate screen driver interface only with no fonts or clipping +#################################################################### +NOFONTSORCLIPPING = N + +#################################################################### +# +# Window move algorithms for Microwindows +# Change for tradeoff between cpu speed and looks +# ERASEMOVE repaints only backgrounds while window dragging, quicker. +# Otherwise an XOR redraw is used for window moves only after button up, +# quickest (should set for ELKS) +# UPDATEREGIONS paints in update clipping region only for better look and feel +# +#################################################################### +ERASEMOVE = Y +UPDATEREGIONS = Y + +#################################################################### +# +# Use MS fonts (default no) +# +#################################################################### +HAVEMSFONTS = N + +#################################################################### +# +# Link with Gray Palette (valid only for 4bpp modes) +# +#################################################################### +GRAYPALETTE = N + +#################################################################### +# +# If the platform is running UNIX, Linux or RTEMS... +# +#################################################################### +ifneq ($(ARCH), ELKS) + +# X Window screen, mouse and kbd drivers +X11 = N + +ifeq ($(X11), Y) +# predefined model or select screen width, height, depth(palette mode only) +SCREEN_E15 = N +SCREEN_WIDTH = 640 +SCREEN_HEIGHT = 480 +SCREEN_DEPTH = 4 + +# You may want to turn this on for XFree86 4.x or if your backing store +# isn't functioning properly +USE_EXPOSURE = N + +else + +# framebuffer screen driver (linear and/or vga 4 planes) +# set VTSWITCH to include virtual terminal switch code +# set PORTRAIT_MODE to L or R for left or right orientation +# set FBREVERSE to reverse bit orders in 1,2,4 bpp +# set FBVGA=N for all systems without VGA hardware (for MIPS must=N) +FRAMEBUFFER = Y +FBVGA = N +VTSWITCH = N +#PORTRAIT_MODE = R +PORTRAIT_MODE = N +FBREVERSE = N + +# svgalib screen driver +VGALIB = N + +# direct VGA hardware access screen driver +HWVGA = N + +#################################################################### +# Mouse or touch screen driver +# TPMOUSE for Linux-VR and Embedded Planet +# TPHELIO for VTech Helio +# ADSMOUSE for ADS Graphics Client +# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0) +# HARRIERMOUSE for NEC Harrier +# PSIONMOUSE for the Psion 5 +#################################################################### +GPMMOUSE = N +SERMOUSE = N +TPMOUSE = N +TPHELIO = N +ADSMOUSE = N +IPAQMOUSE = Y +HARRIERMOUSE = N +PSIONMOUSE = N +NOMOUSE = N + +# keyboard or null kbd driver +TTYKBD = N +SCANKBD = N +PIPEKBD = N +NOKBD = N +IPAQKBD = Y + +endif + +#################################################################### +# Screen driver specific configuration +# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller +# INVERT4BPP 4bpp inverted pixel driver for VTech Helio +#################################################################### +SA1100_LCD_LTLEND = N +INVERT4BPP = N + +#################################################################### +# +# If the platform is a RTEMS box .... +# +#################################################################### +ifeq ($(ARCH), RTEMS) + +# Location & BSP information of the RTEMS build +RTEMS_BUILD = /tools/build-i386-elf-rtems +RTEMS_BSP = pc386 +LINK_APP_INTO_SERVER = Y + +endif + +endif + +#################################################################### +# +# If the platform is an ELKS box ... +# +#################################################################### +ifeq ($(ARCH), ELKS) + +# Higher speed asm driver, c driver of hercules screen driver +ASMVGADRIVER = Y +CVGADRIVER = N +HERCDRIVER = N +DBGDRIVER = N + +# Mouse support +SERMOUSE = Y + +endif diff --git a/packages/services/gfx/mw/current/src/contrib/BSD/bcopy.s b/packages/services/gfx/mw/current/src/contrib/BSD/bcopy.s new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/BSD/bcopy.s @@ -0,0 +1,1580 @@ +Hi, + +The following code is the file support.s from the FreeBSD 2.6 +distribution for i386. I included the entire file so you can +pick and choose as you like and you can pick up the license. +There's a generic bcopy that does overlapping, uses rep movs +in the largest chunk possible, etc. That might do the trick. +There's a few macros around but hopefully you can decipher +them. + +Later, +FM + +-- +Frank W. Miller +Cornfed Systems Inc +www.cornfed.com + + +-- +/*- + * Copyright (c) 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * $Id: bcopy.s,v 1.1.1.1 2001/06/21 06:32:39 greg Exp $ + */ + +#include "npx.h" +#include "opt_cpu.h" + +#include +#include +#include +#include + +#include "assym.s" + +#define KDSEL 0x10 /* kernel data selector */ +#define IDXSHIFT 10 + + .data + .globl _bcopy_vector +_bcopy_vector: + .long _generic_bcopy + .globl _bzero +_bzero: + .long _generic_bzero + .globl _copyin_vector +_copyin_vector: + .long _generic_copyin + .globl _copyout_vector +_copyout_vector: + .long _generic_copyout + .globl _ovbcopy_vector +_ovbcopy_vector: + .long _generic_bcopy +#if defined(I586_CPU) && NNPX > 0 +kernel_fpu_lock: + .byte 0xfe + .space 3 +#endif + + .text + +/* + * bcopy family + * void bzero(void *buf, u_int len) + */ + +ENTRY(generic_bzero) + pushl %edi + movl 8(%esp),%edi + movl 12(%esp),%ecx + xorl %eax,%eax + shrl $2,%ecx + cld + rep + stosl + movl 12(%esp),%ecx + andl $3,%ecx + rep + stosb + popl %edi + ret + +#if defined(I486_CPU) +ENTRY(i486_bzero) + movl 4(%esp),%edx + movl 8(%esp),%ecx + xorl %eax,%eax +/* + * do 64 byte chunks first + * + * XXX this is probably over-unrolled at least for DX2's + */ +2: + cmpl $64,%ecx + jb 3f + movl %eax,(%edx) + movl %eax,4(%edx) + movl %eax,8(%edx) + movl %eax,12(%edx) + movl %eax,16(%edx) + movl %eax,20(%edx) + movl %eax,24(%edx) + movl %eax,28(%edx) + movl %eax,32(%edx) + movl %eax,36(%edx) + movl %eax,40(%edx) + movl %eax,44(%edx) + movl %eax,48(%edx) + movl %eax,52(%edx) + movl %eax,56(%edx) + movl %eax,60(%edx) + addl $64,%edx + subl $64,%ecx + jnz 2b + ret + +/* + * do 16 byte chunks + */ + SUPERALIGN_TEXT +3: + cmpl $16,%ecx + jb 4f + movl %eax,(%edx) + movl %eax,4(%edx) + movl %eax,8(%edx) + movl %eax,12(%edx) + addl $16,%edx + subl $16,%ecx + jnz 3b + ret + +/* + * do 4 byte chunks + */ + SUPERALIGN_TEXT +4: + cmpl $4,%ecx + jb 5f + movl %eax,(%edx) + addl $4,%edx + subl $4,%ecx + jnz 4b + ret + +/* + * do 1 byte chunks + * a jump table seems to be faster than a loop or more range reductions + * + * XXX need a const section for non-text + */ + .data +jtab: + .long do0 + .long do1 + .long do2 + .long do3 + + .text + SUPERALIGN_TEXT +5: + jmp jtab(,%ecx,4) + + SUPERALIGN_TEXT +do3: + movw %ax,(%edx) + movb %al,2(%edx) + ret + + SUPERALIGN_TEXT +do2: + movw %ax,(%edx) + ret + + SUPERALIGN_TEXT +do1: + movb %al,(%edx) + ret + + SUPERALIGN_TEXT +do0: + ret +#endif + +#if defined(I586_CPU) && NNPX > 0 +ENTRY(i586_bzero) + movl 4(%esp),%edx + movl 8(%esp),%ecx + + /* + * The FPU register method is twice as fast as the integer register + * method unless the target is in the L1 cache and we pre-allocate a + * cache line for it (then the integer register method is 4-5 times + * faster). However, we never pre-allocate cache lines, since that + * would make the integer method 25% or more slower for the common + * case when the target isn't in either the L1 cache or the L2 cache. + * Thus we normally use the FPU register method unless the overhead + * would be too large. + */ + cmpl $256,%ecx /* empirical; clts, fninit, smsw cost a lot */ + jb intreg_i586_bzero + + /* + * The FPU registers may belong to an application or to fastmove() + * or to another invocation of bcopy() or ourself in a higher level + * interrupt or trap handler. Preserving the registers is + * complicated since we avoid it if possible at all levels. We + * want to localize the complications even when that increases them. + * Here the extra work involves preserving CR0_TS in TS. + * `npxproc != NULL' is supposed to be the condition that all the + * FPU resources belong to an application, but npxproc and CR0_TS + * aren't set atomically enough for this condition to work in + * interrupt handlers. + * + * Case 1: FPU registers belong to the application: we must preserve + * the registers if we use them, so we only use the FPU register + * method if the target size is large enough to amortize the extra + * overhead for preserving them. CR0_TS must be preserved although + * it is very likely to end up as set. + * + * Case 2: FPU registers belong to fastmove(): fastmove() currently + * makes the registers look like they belong to an application so + * that cpu_switch() and savectx() don't have to know about it, so + * this case reduces to case 1. + * + * Case 3: FPU registers belong to the kernel: don't use the FPU + * register method. This case is unlikely, and supporting it would + * be more complicated and might take too much stack. + * + * Case 4: FPU registers don't belong to anyone: the FPU registers + * don't need to be preserved, so we always use the FPU register + * method. CR0_TS must be preserved although it is very likely to + * always end up as clear. + */ + cmpl $0,_npxproc + je i586_bz1 + cmpl $256+184,%ecx /* empirical; not quite 2*108 more */ + jb intreg_i586_bzero + sarb $1,kernel_fpu_lock + jc intreg_i586_bzero + smsw %ax + clts + subl $108,%esp + fnsave 0(%esp) + jmp i586_bz2 + +i586_bz1: + sarb $1,kernel_fpu_lock + jc intreg_i586_bzero + smsw %ax + clts + fninit /* XXX should avoid needing this */ +i586_bz2: + fldz + + /* + * Align to an 8 byte boundary (misalignment in the main loop would + * cost a factor of >= 2). Avoid jumps (at little cost if it is + * already aligned) by always zeroing 8 bytes and using the part up + * to the _next_ alignment position. + */ + fstl 0(%edx) + addl %edx,%ecx /* part of %ecx -= new_%edx - %edx */ + addl $8,%edx + andl $~7,%edx + subl %edx,%ecx + + /* + * Similarly align `len' to a multiple of 8. + */ + fstl -8(%edx,%ecx) + decl %ecx + andl $~7,%ecx + + /* + * This wouldn't be any faster if it were unrolled, since the loop + * control instructions are much faster than the fstl and/or done + * in parallel with it so their overhead is insignificant. + */ +fpureg_i586_bzero_loop: + fstl 0(%edx) + addl $8,%edx + subl $8,%ecx + cmpl $8,%ecx + jae fpureg_i586_bzero_loop + + cmpl $0,_npxproc + je i586_bz3 + frstor 0(%esp) + addl $108,%esp + lmsw %ax + movb $0xfe,kernel_fpu_lock + ret + +i586_bz3: + fstpl %st(0) + lmsw %ax + movb $0xfe,kernel_fpu_lock + ret + +intreg_i586_bzero: + /* + * `rep stos' seems to be the best method in practice for small + * counts. Fancy methods usually take too long to start up due + * to cache and BTB misses. + */ + pushl %edi + movl %edx,%edi + xorl %eax,%eax + shrl $2,%ecx + cld + rep + stosl + movl 12(%esp),%ecx + andl $3,%ecx + jne 1f + popl %edi + ret + +1: + rep + stosb + popl %edi + ret +#endif /* I586_CPU && NNPX > 0 */ + +/* fillw(pat, base, cnt) */ +ENTRY(fillw) + pushl %edi + movl 8(%esp),%eax + movl 12(%esp),%edi + movl 16(%esp),%ecx + cld + rep + stosw + popl %edi + ret + +ENTRY(bcopyb) +bcopyb: + pushl %esi + pushl %edi + movl 12(%esp),%esi + movl 16(%esp),%edi + movl 20(%esp),%ecx + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax /* overlapping && src < dst? */ + jb 1f + cld /* nope, copy forwards */ + rep + movsb + popl %edi + popl %esi + ret + + ALIGN_TEXT +1: + addl %ecx,%edi /* copy backwards. */ + addl %ecx,%esi + decl %edi + decl %esi + std + rep + movsb + popl %edi + popl %esi + cld + ret + +ENTRY(bcopy) + MEXITCOUNT + jmp *_bcopy_vector + +ENTRY(ovbcopy) + MEXITCOUNT + jmp *_ovbcopy_vector + +/* + * generic_bcopy(src, dst, cnt) + * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800 + */ +ENTRY(generic_bcopy) + pushl %esi + pushl %edi + movl 12(%esp),%esi + movl 16(%esp),%edi + movl 20(%esp),%ecx + + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax /* overlapping && src < dst? */ + jb 1f + + shrl $2,%ecx /* copy by 32-bit words */ + cld /* nope, copy forwards */ + rep + movsl + movl 20(%esp),%ecx + andl $3,%ecx /* any bytes left? */ + rep + movsb + popl %edi + popl %esi + ret + + ALIGN_TEXT +1: + addl %ecx,%edi /* copy backwards */ + addl %ecx,%esi + decl %edi + decl %esi + andl $3,%ecx /* any fractional bytes? */ + std + rep + movsb + movl 20(%esp),%ecx /* copy remainder by 32-bit words */ + shrl $2,%ecx + subl $3,%esi + subl $3,%edi + rep + movsl + popl %edi + popl %esi + cld + ret + +#if defined(I586_CPU) && NNPX > 0 +ENTRY(i586_bcopy) + pushl %esi + pushl %edi + movl 12(%esp),%esi + movl 16(%esp),%edi + movl 20(%esp),%ecx + + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax /* overlapping && src < dst? */ + jb 1f + + cmpl $1024,%ecx + jb small_i586_bcopy + + sarb $1,kernel_fpu_lock + jc small_i586_bcopy + cmpl $0,_npxproc + je i586_bc1 + smsw %dx + clts + subl $108,%esp + fnsave 0(%esp) + jmp 4f + +i586_bc1: + smsw %dx + clts + fninit /* XXX should avoid needing this */ + + ALIGN_TEXT +4: + pushl %ecx +#define DCACHE_SIZE 8192 + cmpl $(DCACHE_SIZE-512)/2,%ecx + jbe 2f + movl $(DCACHE_SIZE-512)/2,%ecx +2: + subl %ecx,0(%esp) + cmpl $256,%ecx + jb 5f /* XXX should prefetch if %ecx >= 32 */ + pushl %esi + pushl %ecx + ALIGN_TEXT +3: + movl 0(%esi),%eax + movl 32(%esi),%eax + movl 64(%esi),%eax + movl 96(%esi),%eax + movl 128(%esi),%eax + movl 160(%esi),%eax + movl 192(%esi),%eax + movl 224(%esi),%eax + addl $256,%esi + subl $256,%ecx + cmpl $256,%ecx + jae 3b + popl %ecx + popl %esi +5: + ALIGN_TEXT +large_i586_bcopy_loop: + fildq 0(%esi) + fildq 8(%esi) + fildq 16(%esi) + fildq 24(%esi) + fildq 32(%esi) + fildq 40(%esi) + fildq 48(%esi) + fildq 56(%esi) + fistpq 56(%edi) + fistpq 48(%edi) + fistpq 40(%edi) + fistpq 32(%edi) + fistpq 24(%edi) + fistpq 16(%edi) + fistpq 8(%edi) + fistpq 0(%edi) + addl $64,%esi + addl $64,%edi + subl $64,%ecx + cmpl $64,%ecx + jae large_i586_bcopy_loop + popl %eax + addl %eax,%ecx + cmpl $64,%ecx + jae 4b + + cmpl $0,_npxproc + je i586_bc2 + frstor 0(%esp) + addl $108,%esp +i586_bc2: + lmsw %dx + movb $0xfe,kernel_fpu_lock + +/* + * This is a duplicate of the main part of generic_bcopy. See the comments + * there. Jumping into generic_bcopy would cost a whole 0-1 cycles and + * would mess up high resolution profiling. + */ + ALIGN_TEXT +small_i586_bcopy: + shrl $2,%ecx + cld + rep + movsl + movl 20(%esp),%ecx + andl $3,%ecx + rep + movsb + popl %edi + popl %esi + ret + + ALIGN_TEXT +1: + addl %ecx,%edi + addl %ecx,%esi + decl %edi + decl %esi + andl $3,%ecx + std + rep + movsb + movl 20(%esp),%ecx + shrl $2,%ecx + subl $3,%esi + subl $3,%edi + rep + movsl + popl %edi + popl %esi + cld + ret +#endif /* I586_CPU && NNPX > 0 */ + +/* + * Note: memcpy does not support overlapping copies + */ +ENTRY(memcpy) + pushl %edi + pushl %esi + movl 12(%esp),%edi + movl 16(%esp),%esi + movl 20(%esp),%ecx + movl %edi,%eax + shrl $2,%ecx /* copy by 32-bit words */ + cld /* nope, copy forwards */ + rep + movsl + movl 20(%esp),%ecx + andl $3,%ecx /* any bytes left? */ + rep + movsb + popl %esi + popl %edi + ret + + +/*****************************************************************************/ +/* copyout and fubyte family */ +/*****************************************************************************/ +/* + * Access user memory from inside the kernel. These routines and possibly + * the math- and DOS emulators should be the only places that do this. + * + * We have to access the memory with user's permissions, so use a segment + * selector with RPL 3. For writes to user space we have to additionally + * check the PTE for write permission, because the 386 does not check + * write permissions when we are executing with EPL 0. The 486 does check + * this if the WP bit is set in CR0, so we can use a simpler version here. + * + * These routines set curpcb->onfault for the time they execute. When a + * protection violation occurs inside the functions, the trap handler + * returns to *curpcb->onfault instead of the function. + */ + +/* copyout(from_kernel, to_user, len) */ +ENTRY(copyout) + MEXITCOUNT + jmp *_copyout_vector + +ENTRY(generic_copyout) + movl _curpcb,%eax + movl $copyout_fault,PCB_ONFAULT(%eax) + pushl %esi + pushl %edi + pushl %ebx + movl 16(%esp),%esi + movl 20(%esp),%edi + movl 24(%esp),%ebx + testl %ebx,%ebx /* anything to do? */ + jz done_copyout + + /* + * Check explicitly for non-user addresses. If 486 write protection + * is being used, this check is essential because we are in kernel + * mode so the h/w does not provide any protection against writing + * kernel addresses. + */ + + /* + * First, prevent address wrapping. + */ + movl %edi,%eax + addl %ebx,%eax + jc copyout_fault +/* + * XXX STOP USING VM_MAXUSER_ADDRESS. + * It is an end address, not a max, so every time it is used correctly it + * looks like there is an off by one error, and of course it caused an off + * by one error in several places. + */ + cmpl $VM_MAXUSER_ADDRESS,%eax + ja copyout_fault + +#if defined(I386_CPU) + +#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU) + cmpl $CPUCLASS_386,_cpu_class + jne 3f +#endif +/* + * We have to check each PTE for user write permission. + * The checking may cause a page fault, so it is important to set + * up everything for return via copyout_fault before here. + */ + /* compute number of pages */ + movl %edi,%ecx + andl $PAGE_MASK,%ecx + addl %ebx,%ecx + decl %ecx + shrl $IDXSHIFT+2,%ecx + incl %ecx + + /* compute PTE offset for start address */ + movl %edi,%edx + shrl $IDXSHIFT,%edx + andb $0xfc,%dl + +1: + /* check PTE for each page */ + leal _PTmap(%edx),%eax + shrl $IDXSHIFT,%eax + andb $0xfc,%al + testb $PG_V,_PTmap(%eax) /* PTE page must be valid */ + je 4f + movb _PTmap(%edx),%al + andb $PG_V|PG_RW|PG_U,%al /* page must be valid and user writable */ + cmpb $PG_V|PG_RW|PG_U,%al + je 2f + +4: + /* simulate a trap */ + pushl %edx + pushl %ecx + shll $IDXSHIFT,%edx + pushl %edx + call _trapwrite /* trapwrite(addr) */ + popl %edx + popl %ecx + popl %edx + + testl %eax,%eax /* if not ok, return EFAULT */ + jnz copyout_fault + +2: + addl $4,%edx + decl %ecx + jnz 1b /* check next page */ +#endif /* I386_CPU */ + + /* bcopy(%esi, %edi, %ebx) */ +3: + movl %ebx,%ecx + +#if defined(I586_CPU) && NNPX > 0 + ALIGN_TEXT +slow_copyout: +#endif + shrl $2,%ecx + cld + rep + movsl + movb %bl,%cl + andb $3,%cl + rep + movsb + +done_copyout: + popl %ebx + popl %edi + popl %esi + xorl %eax,%eax + movl _curpcb,%edx + movl %eax,PCB_ONFAULT(%edx) + ret + + ALIGN_TEXT +copyout_fault: + popl %ebx + popl %edi + popl %esi + movl _curpcb,%edx + movl $0,PCB_ONFAULT(%edx) + movl $EFAULT,%eax + ret + +#if defined(I586_CPU) && NNPX > 0 +ENTRY(i586_copyout) + /* + * Duplicated from generic_copyout. Could be done a bit better. + */ + movl _curpcb,%eax + movl $copyout_fault,PCB_ONFAULT(%eax) + pushl %esi + pushl %edi + pushl %ebx + movl 16(%esp),%esi + movl 20(%esp),%edi + movl 24(%esp),%ebx + testl %ebx,%ebx /* anything to do? */ + jz done_copyout + + /* + * Check explicitly for non-user addresses. If 486 write protection + * is being used, this check is essential because we are in kernel + * mode so the h/w does not provide any protection against writing + * kernel addresses. + */ + + /* + * First, prevent address wrapping. + */ + movl %edi,%eax + addl %ebx,%eax + jc copyout_fault +/* + * XXX STOP USING VM_MAXUSER_ADDRESS. + * It is an end address, not a max, so every time it is used correctly it + * looks like there is an off by one error, and of course it caused an off + * by one error in several places. + */ + cmpl $VM_MAXUSER_ADDRESS,%eax + ja copyout_fault + + /* bcopy(%esi, %edi, %ebx) */ +3: + movl %ebx,%ecx + /* + * End of duplicated code. + */ + + cmpl $1024,%ecx + jb slow_copyout + + pushl %ecx + call _fastmove + addl $4,%esp + jmp done_copyout +#endif /* I586_CPU && NNPX > 0 */ + +/* copyin(from_user, to_kernel, len) */ +ENTRY(copyin) + MEXITCOUNT + jmp *_copyin_vector + +ENTRY(generic_copyin) + movl _curpcb,%eax + movl $copyin_fault,PCB_ONFAULT(%eax) + pushl %esi + pushl %edi + movl 12(%esp),%esi /* caddr_t from */ + movl 16(%esp),%edi /* caddr_t to */ + movl 20(%esp),%ecx /* size_t len */ + + /* + * make sure address is valid + */ + movl %esi,%edx + addl %ecx,%edx + jc copyin_fault + cmpl $VM_MAXUSER_ADDRESS,%edx + ja copyin_fault + +#if defined(I586_CPU) && NNPX > 0 + ALIGN_TEXT +slow_copyin: +#endif + movb %cl,%al + shrl $2,%ecx /* copy longword-wise */ + cld + rep + movsl + movb %al,%cl + andb $3,%cl /* copy remaining bytes */ + rep + movsb + +#if defined(I586_CPU) && NNPX > 0 + ALIGN_TEXT +done_copyin: +#endif + popl %edi + popl %esi + xorl %eax,%eax + movl _curpcb,%edx + movl %eax,PCB_ONFAULT(%edx) + ret + + ALIGN_TEXT +copyin_fault: + popl %edi + popl %esi + movl _curpcb,%edx + movl $0,PCB_ONFAULT(%edx) + movl $EFAULT,%eax + ret + +#if defined(I586_CPU) && NNPX > 0 +ENTRY(i586_copyin) + /* + * Duplicated from generic_copyin. Could be done a bit better. + */ + movl _curpcb,%eax + movl $copyin_fault,PCB_ONFAULT(%eax) + pushl %esi + pushl %edi + movl 12(%esp),%esi /* caddr_t from */ + movl 16(%esp),%edi /* caddr_t to */ + movl 20(%esp),%ecx /* size_t len */ + + /* + * make sure address is valid + */ + movl %esi,%edx + addl %ecx,%edx + jc copyin_fault + cmpl $VM_MAXUSER_ADDRESS,%edx + ja copyin_fault + /* + * End of duplicated code. + */ + + cmpl $1024,%ecx + jb slow_copyin + + pushl %ebx /* XXX prepare for fastmove_fault */ + pushl %ecx + call _fastmove + addl $8,%esp + jmp done_copyin +#endif /* I586_CPU && NNPX > 0 */ + +#if defined(I586_CPU) && NNPX > 0 +/* fastmove(src, dst, len) + src in %esi + dst in %edi + len in %ecx XXX changed to on stack for profiling + uses %eax and %edx for tmp. storage + */ +/* XXX use ENTRY() to get profiling. fastmove() is actually a non-entry. */ +ENTRY(fastmove) + pushl %ebp + movl %esp,%ebp + subl $PCB_SAVEFPU_SIZE+3*4,%esp + + movl 8(%ebp),%ecx + cmpl $63,%ecx + jbe fastmove_tail + + testl $7,%esi /* check if src addr is multiple of 8 */ + jnz fastmove_tail + + testl $7,%edi /* check if dst addr is multiple of 8 */ + jnz fastmove_tail + +/* if (npxproc != NULL) { */ + cmpl $0,_npxproc + je 6f +/* fnsave(&curpcb->pcb_savefpu); */ + movl _curpcb,%eax + fnsave PCB_SAVEFPU(%eax) +/* npxproc = NULL; */ + movl $0,_npxproc +/* } */ +6: +/* now we own the FPU. */ + +/* + * The process' FP state is saved in the pcb, but if we get + * switched, the cpu_switch() will store our FP state in the + * pcb. It should be possible to avoid all the copying for + * this, e.g., by setting a flag to tell cpu_switch() to + * save the state somewhere else. + */ +/* tmp = curpcb->pcb_savefpu; */ + movl %ecx,-12(%ebp) + movl %esi,-8(%ebp) + movl %edi,-4(%ebp) + movl %esp,%edi + movl _curpcb,%esi + addl $PCB_SAVEFPU,%esi + cld + movl $PCB_SAVEFPU_SIZE>>2,%ecx + rep + movsl + movl -12(%ebp),%ecx + movl -8(%ebp),%esi + movl -4(%ebp),%edi +/* stop_emulating(); */ + clts +/* npxproc = curproc; */ + movl _curproc,%eax + movl %eax,_npxproc + movl _curpcb,%eax + movl $fastmove_fault,PCB_ONFAULT(%eax) +4: + movl %ecx,-12(%ebp) + cmpl $1792,%ecx + jbe 2f + movl $1792,%ecx +2: + subl %ecx,-12(%ebp) + cmpl $256,%ecx + jb 5f + movl %ecx,-8(%ebp) + movl %esi,-4(%ebp) + ALIGN_TEXT +3: + movl 0(%esi),%eax + movl 32(%esi),%eax + movl 64(%esi),%eax + movl 96(%esi),%eax + movl 128(%esi),%eax + movl 160(%esi),%eax + movl 192(%esi),%eax + movl 224(%esi),%eax + addl $256,%esi + subl $256,%ecx + cmpl $256,%ecx + jae 3b + movl -8(%ebp),%ecx + movl -4(%ebp),%esi +5: + ALIGN_TEXT +fastmove_loop: + fildq 0(%esi) + fildq 8(%esi) + fildq 16(%esi) + fildq 24(%esi) + fildq 32(%esi) + fildq 40(%esi) + fildq 48(%esi) + fildq 56(%esi) + fistpq 56(%edi) + fistpq 48(%edi) + fistpq 40(%edi) + fistpq 32(%edi) + fistpq 24(%edi) + fistpq 16(%edi) + fistpq 8(%edi) + fistpq 0(%edi) + addl $-64,%ecx + addl $64,%esi + addl $64,%edi + cmpl $63,%ecx + ja fastmove_loop + movl -12(%ebp),%eax + addl %eax,%ecx + cmpl $64,%ecx + jae 4b + +/* curpcb->pcb_savefpu = tmp; */ + movl %ecx,-12(%ebp) + movl %esi,-8(%ebp) + movl %edi,-4(%ebp) + movl _curpcb,%edi + addl $PCB_SAVEFPU,%edi + movl %esp,%esi + cld + movl $PCB_SAVEFPU_SIZE>>2,%ecx + rep + movsl + movl -12(%ebp),%ecx + movl -8(%ebp),%esi + movl -4(%ebp),%edi + +/* start_emulating(); */ + smsw %ax + orb $CR0_TS,%al + lmsw %ax +/* npxproc = NULL; */ + movl $0,_npxproc + + ALIGN_TEXT +fastmove_tail: + movl _curpcb,%eax + movl $fastmove_tail_fault,PCB_ONFAULT(%eax) + + movb %cl,%al + shrl $2,%ecx /* copy longword-wise */ + cld + rep + movsl + movb %al,%cl + andb $3,%cl /* copy remaining bytes */ + rep + movsb + + movl %ebp,%esp + popl %ebp + ret + + ALIGN_TEXT +fastmove_fault: + movl _curpcb,%edi + addl $PCB_SAVEFPU,%edi + movl %esp,%esi + cld + movl $PCB_SAVEFPU_SIZE>>2,%ecx + rep + movsl + + smsw %ax + orb $CR0_TS,%al + lmsw %ax + movl $0,_npxproc + +fastmove_tail_fault: + movl %ebp,%esp + popl %ebp + addl $8,%esp + popl %ebx + popl %edi + popl %esi + movl _curpcb,%edx + movl $0,PCB_ONFAULT(%edx) + movl $EFAULT,%eax + ret +#endif /* I586_CPU && NNPX > 0 */ + +/* + * fu{byte,sword,word} : fetch a byte (sword, word) from user memory + */ +ENTRY(fuword) + movl _curpcb,%ecx + movl $fusufault,PCB_ONFAULT(%ecx) + movl 4(%esp),%edx /* from */ + + cmpl $VM_MAXUSER_ADDRESS-4,%edx /* verify address is valid */ + ja fusufault + + movl (%edx),%eax + movl $0,PCB_ONFAULT(%ecx) + ret + +/* + * These two routines are called from the profiling code, potentially + * at interrupt time. If they fail, that's okay, good things will + * happen later. Fail all the time for now - until the trap code is + * able to deal with this. + */ +ALTENTRY(suswintr) +ENTRY(fuswintr) + movl $-1,%eax + ret + +ENTRY(fusword) + movl _curpcb,%ecx + movl $fusufault,PCB_ONFAULT(%ecx) + movl 4(%esp),%edx + + cmpl $VM_MAXUSER_ADDRESS-2,%edx + ja fusufault + + movzwl (%edx),%eax + movl $0,PCB_ONFAULT(%ecx) + ret + +ENTRY(fubyte) + movl _curpcb,%ecx + movl $fusufault,PCB_ONFAULT(%ecx) + movl 4(%esp),%edx + + cmpl $VM_MAXUSER_ADDRESS-1,%edx + ja fusufault + + movzbl (%edx),%eax + movl $0,PCB_ONFAULT(%ecx) + ret + + ALIGN_TEXT +fusufault: + movl _curpcb,%ecx + xorl %eax,%eax + movl %eax,PCB_ONFAULT(%ecx) + decl %eax + ret + +/* + * su{byte,sword,word}: write a byte (word, longword) to user memory + */ +ENTRY(suword) + movl _curpcb,%ecx + movl $fusufault,PCB_ONFAULT(%ecx) + movl 4(%esp),%edx + +#if defined(I386_CPU) + +#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU) + cmpl $CPUCLASS_386,_cpu_class + jne 2f /* we only have to set the right segment selector */ +#endif /* I486_CPU || I586_CPU || I686_CPU */ + + /* XXX - page boundary crossing is still not handled */ + movl %edx,%eax + shrl $IDXSHIFT,%edx + andb $0xfc,%dl + + leal _PTmap(%edx),%ecx + shrl $IDXSHIFT,%ecx + andb $0xfc,%cl + testb $PG_V,_PTmap(%ecx) /* PTE page must be valid */ + je 4f + movb _PTmap(%edx),%dl + andb $PG_V|PG_RW|PG_U,%dl /* page must be valid and user writable */ + cmpb $PG_V|PG_RW|PG_U,%dl + je 1f + +4: + /* simulate a trap */ + pushl %eax + call _trapwrite + popl %edx /* remove junk parameter from stack */ + testl %eax,%eax + jnz fusufault +1: + movl 4(%esp),%edx +#endif + +2: + cmpl $VM_MAXUSER_ADDRESS-4,%edx /* verify address validity */ + ja fusufault + + movl 8(%esp),%eax + movl %eax,(%edx) + xorl %eax,%eax + movl _curpcb,%ecx + movl %eax,PCB_ONFAULT(%ecx) + ret + +ENTRY(susword) + movl _curpcb,%ecx + movl $fusufault,PCB_ONFAULT(%ecx) + movl 4(%esp),%edx + +#if defined(I386_CPU) + +#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU) + cmpl $CPUCLASS_386,_cpu_class + jne 2f +#endif /* I486_CPU || I586_CPU || I686_CPU */ + + /* XXX - page boundary crossing is still not handled */ + movl %edx,%eax + shrl $IDXSHIFT,%edx + andb $0xfc,%dl + + leal _PTmap(%edx),%ecx + shrl $IDXSHIFT,%ecx + andb $0xfc,%cl + testb $PG_V,_PTmap(%ecx) /* PTE page must be valid */ + je 4f + movb _PTmap(%edx),%dl + andb $PG_V|PG_RW|PG_U,%dl /* page must be valid and user writable */ + cmpb $PG_V|PG_RW|PG_U,%dl + je 1f + +4: + /* simulate a trap */ + pushl %eax + call _trapwrite + popl %edx /* remove junk parameter from stack */ + testl %eax,%eax + jnz fusufault +1: + movl 4(%esp),%edx +#endif + +2: + cmpl $VM_MAXUSER_ADDRESS-2,%edx /* verify address validity */ + ja fusufault + + movw 8(%esp),%ax + movw %ax,(%edx) + xorl %eax,%eax + movl _curpcb,%ecx /* restore trashed register */ + movl %eax,PCB_ONFAULT(%ecx) + ret + +ALTENTRY(suibyte) +ENTRY(subyte) + movl _curpcb,%ecx + movl $fusufault,PCB_ONFAULT(%ecx) + movl 4(%esp),%edx + +#if defined(I386_CPU) + +#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU) + cmpl $CPUCLASS_386,_cpu_class + jne 2f +#endif /* I486_CPU || I586_CPU || I686_CPU */ + + movl %edx,%eax + shrl $IDXSHIFT,%edx + andb $0xfc,%dl + + leal _PTmap(%edx),%ecx + shrl $IDXSHIFT,%ecx + andb $0xfc,%cl + testb $PG_V,_PTmap(%ecx) /* PTE page must be valid */ + je 4f + movb _PTmap(%edx),%dl + andb $PG_V|PG_RW|PG_U,%dl /* page must be valid and user writable */ + cmpb $PG_V|PG_RW|PG_U,%dl + je 1f + +4: + /* simulate a trap */ + pushl %eax + call _trapwrite + popl %edx /* remove junk parameter from stack */ + testl %eax,%eax + jnz fusufault +1: + movl 4(%esp),%edx +#endif + +2: + cmpl $VM_MAXUSER_ADDRESS-1,%edx /* verify address validity */ + ja fusufault + + movb 8(%esp),%al + movb %al,(%edx) + xorl %eax,%eax + movl _curpcb,%ecx /* restore trashed register */ + movl %eax,PCB_ONFAULT(%ecx) + ret + +/* + * copyinstr(from, to, maxlen, int *lencopied) + * copy a string from from to to, stop when a 0 character is reached. + * return ENAMETOOLONG if string is longer than maxlen, and + * EFAULT on protection violations. If lencopied is non-zero, + * return the actual length in *lencopied. + */ +ENTRY(copyinstr) + pushl %esi + pushl %edi + movl _curpcb,%ecx + movl $cpystrflt,PCB_ONFAULT(%ecx) + + movl 12(%esp),%esi /* %esi = from */ + movl 16(%esp),%edi /* %edi = to */ + movl 20(%esp),%edx /* %edx = maxlen */ + + movl $VM_MAXUSER_ADDRESS,%eax + + /* make sure 'from' is within bounds */ + subl %esi,%eax + jbe cpystrflt + + /* restrict maxlen to <= VM_MAXUSER_ADDRESS-from */ + cmpl %edx,%eax + jae 1f + movl %eax,%edx + movl %eax,20(%esp) +1: + incl %edx + cld + +2: + decl %edx + jz 3f + + lodsb + stosb + orb %al,%al + jnz 2b + + /* Success -- 0 byte reached */ + decl %edx + xorl %eax,%eax + jmp cpystrflt_x +3: + /* edx is zero - return ENAMETOOLONG or EFAULT */ + cmpl $VM_MAXUSER_ADDRESS,%esi + jae cpystrflt +4: + movl $ENAMETOOLONG,%eax + jmp cpystrflt_x + +cpystrflt: + movl $EFAULT,%eax + +cpystrflt_x: + /* set *lencopied and return %eax */ + movl _curpcb,%ecx + movl $0,PCB_ONFAULT(%ecx) + movl 20(%esp),%ecx + subl %edx,%ecx + movl 24(%esp),%edx + testl %edx,%edx + jz 1f + movl %ecx,(%edx) +1: + popl %edi + popl %esi + ret + + +/* + * copystr(from, to, maxlen, int *lencopied) + */ +ENTRY(copystr) + pushl %esi + pushl %edi + + movl 12(%esp),%esi /* %esi = from */ + movl 16(%esp),%edi /* %edi = to */ + movl 20(%esp),%edx /* %edx = maxlen */ + incl %edx + cld +1: + decl %edx + jz 4f + lodsb + stosb + orb %al,%al + jnz 1b + + /* Success -- 0 byte reached */ + decl %edx + xorl %eax,%eax + jmp 6f +4: + /* edx is zero -- return ENAMETOOLONG */ + movl $ENAMETOOLONG,%eax + +6: + /* set *lencopied and return %eax */ + movl 20(%esp),%ecx + subl %edx,%ecx + movl 24(%esp),%edx + testl %edx,%edx + jz 7f + movl %ecx,(%edx) +7: + popl %edi + popl %esi + ret + +ENTRY(bcmp) + pushl %edi + pushl %esi + movl 12(%esp),%edi + movl 16(%esp),%esi + movl 20(%esp),%edx + xorl %eax,%eax + + movl %edx,%ecx + shrl $2,%ecx + cld /* compare forwards */ + repe + cmpsl + jne 1f + + movl %edx,%ecx + andl $3,%ecx + repe + cmpsb + je 2f +1: + incl %eax +2: + popl %esi + popl %edi + ret + + +/* + * Handling of special 386 registers and descriptor tables etc + */ +/* void lgdt(struct region_descriptor *rdp); */ +ENTRY(lgdt) + /* reload the descriptor table */ + movl 4(%esp),%eax + lgdt (%eax) + + /* flush the prefetch q */ + jmp 1f + nop +1: + /* reload "stale" selectors */ + movl $KDSEL,%eax + movl %ax,%ds + movl %ax,%es + movl %ax,%ss + + /* reload code selector by turning return into intersegmental return */ + movl (%esp),%eax + pushl %eax +# movl $KCSEL,4(%esp) + movl $8,4(%esp) + lret + +/* + * void lidt(struct region_descriptor *rdp); + */ +ENTRY(lidt) + movl 4(%esp),%eax + lidt (%eax) + ret + +/* + * void lldt(u_short sel) + */ +ENTRY(lldt) + lldt 4(%esp) + ret + +/* + * void ltr(u_short sel) + */ +ENTRY(ltr) + ltr 4(%esp) + ret + +/* ssdtosd(*ssdp,*sdp) */ +ENTRY(ssdtosd) + pushl %ebx + movl 8(%esp),%ecx + movl 8(%ecx),%ebx + shll $16,%ebx + movl (%ecx),%edx + roll $16,%edx + movb %dh,%bl + movb %dl,%bh + rorl $8,%ebx + movl 4(%ecx),%eax + movw %ax,%dx + andl $0xf0000,%eax + orl %eax,%ebx + movl 12(%esp),%ecx + movl %edx,(%ecx) + movl %ebx,4(%ecx) + popl %ebx + ret + +/* load_cr0(cr0) */ +ENTRY(load_cr0) + movl 4(%esp),%eax + movl %eax,%cr0 + ret + +/* rcr0() */ +ENTRY(rcr0) + movl %cr0,%eax + ret + +/* rcr3() */ +ENTRY(rcr3) + movl %cr3,%eax + ret + +/* void load_cr3(caddr_t cr3) */ +ENTRY(load_cr3) + movl 4(%esp),%eax + movl %eax,%cr3 + ret + + +/*****************************************************************************/ +/* setjump, longjump */ +/*****************************************************************************/ + +ENTRY(setjmp) + movl 4(%esp),%eax + movl %ebx,(%eax) /* save ebx */ + movl %esp,4(%eax) /* save esp */ + movl %ebp,8(%eax) /* save ebp */ + movl %esi,12(%eax) /* save esi */ + movl %edi,16(%eax) /* save edi */ + movl (%esp),%edx /* get rta */ + movl %edx,20(%eax) /* save eip */ + xorl %eax,%eax /* return(0); */ + ret + +ENTRY(longjmp) + movl 4(%esp),%eax + movl (%eax),%ebx /* restore ebx */ + movl 4(%eax),%esp /* restore esp */ + movl 8(%eax),%ebp /* restore ebp */ + movl 12(%eax),%esi /* restore esi */ + movl 16(%eax),%edi /* restore edi */ + movl 20(%eax),%edx /* get rta */ + movl %edx,(%esp) /* put in return frame */ + xorl %eax,%eax /* return(1); */ + incl %eax + ret + +/* + * Here for doing BB-profiling (gcc -a). + * We rely on the "bbset" instead, but need a dummy function. + */ +NON_GPROF_ENTRY(__bb_init_func) + movl 4(%esp),%eax + movl $1,(%eax) + .byte 0xc3 /* avoid macro for `ret' */ diff --git a/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/Makefile b/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/Makefile @@ -0,0 +1,13 @@ +#CC = mipsel-linux-gcc -msoft-float -s +CC = gcc +CFLAGS = -Wall -I../../../include -I../../../drivers -L../../../lib +LIBS = -lmwin -lmwinlib -lmwengine -lmwdrivers -lmwfonts +OBJECTS = tpcal.o transform.o + +all: tpcal + +tpcal: $(OBJECTS) + $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o tpcal + +clean: + rm -f *.o tpcal diff --git a/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/VERSION b/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/VERSION new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/VERSION @@ -0,0 +1,1 @@ +0.5 diff --git a/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/tpcal.c b/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/tpcal.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/tpcal.c @@ -0,0 +1,363 @@ +/* + * Touch-panel calibration program + * Copyright (C) 1999 Bradley D. LaRonde + * + * This program is free software; you may 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include +#include +#include +#include +#include +#include "windows.h" +#include "mou_tp.h" +#include "transform.h" + +static int xext, yext; +static CALIBRATION_PAIRS cps; +static CALIBRATION_PAIR* pcp = 0; + +void DrawAbout(HDC hdc, RECT r) +{ + const int ver_major = 0; + const int ver_minor = 5; + const char app_name[] = "Touch Panel Calibrator"; + const char title[] = "%s, version %d.%d"; + const char copyright[] = "(C) 1999 Bradley D. LaRonde "; + const char warranty[] = "ABSOLUTELY NO WARRANTY"; + const char license1[] = "This is free software, and you are welcome to"; + const char license2[] = "redistribute it under certain conditions."; + + const int leading = 15; + + char s[1024]; + + sprintf(s, title, app_name, ver_major, ver_minor); + SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); + DrawText(hdc, s, -1, &r, DT_CENTER); + + r.top += leading; + DrawText(hdc, copyright, -1, &r, DT_CENTER); + + r.top += leading; + DrawText(hdc, warranty, -1, &r, DT_CENTER); + + r.top += leading; + DrawText(hdc, license1, -1, &r, DT_CENTER); + r.top += leading; + DrawText(hdc, license2, -1, &r, DT_CENTER); +} + +void DrawDone(HDC hdc, RECT r) +{ + const char donemsg[] = "Calibration is done!"; + SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); + DrawText(hdc, donemsg, -1, &r, DT_CENTER); +} + + +void DrawTarget(HDC hdc, POINT p) +{ + const int scale = 9; + const int center = 3; + + // I never knew that Windows GDI always leaves off + // the last point in a line, and the right and bottom side of a rectangle. + // Why would they make use always figure +1? It isn't always obvious where + // +1 is (i.e. a line going at a 10 degree angle). Blech. + // I can only hope that there is some overwhelmingly compelling reason why. + + Rectangle(hdc, p.x - center, p.y - center, p.x + center + 1, p.y + center + 1); + + // scale + MoveToEx(hdc, p.x - scale, p.y, NULL); + LineTo(hdc, p.x + scale + 1, p.y); + + MoveToEx(hdc, p.x, p.y - scale, NULL); + LineTo(hdc, p.x, p.y + scale + 1); +} + +void DrawLabelAlign(HDC hdc, POINT p, LPCSTR psz, int align) +{ + RECT r; + const int w = 180; + const int h = 14; + const int m = 15; + + switch(align) + { + case 1: + // right + r.left = p.x + m; + r.right = p.x + w + m; + r.top = p.y - (h/2); + r.bottom = p.y + (h/2); + break; + + case 2: + // left + r.left = p.x - (w + m); + r.right = p.x - m; + r.top = p.y - (h/2); + r.bottom = p.y + (h/2); + break; + + case 3: + // below + r.left = p.x - (w/2); + r.right = p.x + (w/2); + r.top = p.y + m; + r.bottom = p.y + m + h; + break; + + default: + // at + r.left = p.x; + r.right = p.x + w; + r.top = p.y; + r.bottom = p.y + h; + break; + } + + SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); + DrawText(hdc, psz, -1, &r, DT_LEFT); +} + +void DrawLabel(HDC hdc, POINT p, LPCSTR psz) +{ + if ( p.x < (xext * 1 / 4) ) + return DrawLabelAlign(hdc, p, psz, 1); + + if ( p.x > (xext * 3 / 4) ) + return DrawLabelAlign(hdc, p, psz, 2); + + return DrawLabelAlign(hdc, p, psz, 3); +} + +POINT GetTarget(int n) +{ + const int inset = 10; + POINT p; + + switch (n) + { + case 0: + p.x = xext / 2; p.y = yext / 2; + pcp = &cps.center; + break; + + case 1: + p.x = inset; p.y = inset; + pcp = &cps.ul; + break; + + case 2: + p.x = xext - inset; p.y = inset; + pcp = &cps.ur; + break; + + case 3: + p.x = xext - inset; p.y = yext - inset; + pcp = &cps.lr; + break; + + case 4: + p.x = inset; p.y = yext - inset; + pcp = &cps.ll; + break; + + default: + // return a random target + p.x = random() / (RAND_MAX / xext); + p.y = random() / (RAND_MAX / yext); + pcp = 0; + break; + } + + return p; +} + +static int total_targets = 5; +static int current_target = 0; +static POINT current_target_location; + +void DoPaint(HDC hdc) +{ + const char szInstructions[] = "Please touch the center of the target."; + + POINT p; + int i, n; + int old_rop; + POINT last = current_target_location; + HPEN hOldPen; + + if (current_target == total_targets) { + RECT r = {10, yext/2, xext - 10, yext/2 + 40}; + DrawDone(hdc, r); + return; + } + + if (current_target == 0) + { + RECT r = {10, yext - 85, xext - 10, yext - 10}; + DrawAbout(hdc, r); + } + + current_target_location = GetTarget(current_target); + + old_rop = SetROP2(hdc, R2_XORPEN); + hOldPen = SelectObject(hdc, GetStockObject(WHITE_PEN)); + + n = 20; + for (i=0; i < n; i++) + { + p.x = last.x + ((current_target_location.x - last.x) * i / n); + p.y = last.y + ((current_target_location.y - last.y) * i / n); + DrawTarget(hdc, p); + Sleep(60); + DrawTarget(hdc, p); + } + + // final position + SetROP2(hdc, R2_COPYPEN); + SelectObject(hdc, GetStockObject(BLACK_PEN)); + + DrawTarget(hdc, current_target_location); + DrawLabel(hdc, current_target_location, szInstructions); + + // put things back + SetROP2(hdc, old_rop); + SelectObject(hdc, hOldPen); +} + +#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) +#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) + +LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + PAINTSTRUCT ps; + HDC hdc; + + switch(msg) { + case WM_PAINT: + hdc = BeginPaint(hwnd, &ps); + DoPaint(hdc); + EndPaint(hwnd, &ps); + break; + + case WM_NCHITTEST: + return HTCLIENT; + + case WM_LBUTTONUP: + if ( pcp != 0 ) + { + pcp->screen.x = current_target_location.x * TRANSFORMATION_UNITS_PER_PIXEL; + pcp->screen.y = current_target_location.y * TRANSFORMATION_UNITS_PER_PIXEL; + pcp->device.x = GET_X_LPARAM(lp); + pcp->device.y = GET_Y_LPARAM(lp); + } + + if ( ++current_target == total_targets ) + { + TRANSFORMATION_COEFFICIENTS tc; +#if 0 + CalcTransformationCoefficientsSimple(&cps, &tc); + printf("%d %d %d %d %d %d %d\n", + tc.a, tc.b, tc.c, tc.d, tc.e, tc.f, tc.s); + CalcTransformationCoefficientsBetter(&cps, &tc); + printf("%d %d %d %d %d %d %d\n", + tc.a, tc.b, tc.c, tc.d, tc.e, tc.f, tc.s); + CalcTransformationCoefficientsEvenBetter(&cps, &tc); + printf("%d %d %d %d %d %d %d\n", + tc.a, tc.b, tc.c, tc.d, tc.e, tc.f, tc.s); +#endif + CalcTransformationCoefficientsBest(&cps, &tc); + printf("%d %d %d %d %d %d %d\n", + tc.a, tc.b, tc.c, tc.d, tc.e, tc.f, tc.s); + InvalidateRect(hwnd, NULL, TRUE); + UpdateWindow(hwnd); + PostQuitMessage(0); + break; + } + InvalidateRect(hwnd, NULL, TRUE); + UpdateWindow(hwnd); + break; + + default: + return DefWindowProc(hwnd, msg, wp, lp); + } + + return 0; +} + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +{ + WNDCLASS wc; + RECT r; + HWND hwnd; + MSG msg; + MWCOORD big; + + srandom(time(NULL)); + + /* WndButtonRegister(NULL); */ + + wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW; + wc.lpfnWndProc = (WNDPROC)WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = 0; + wc.hIcon = 0; + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "tpcal"; + RegisterClass(&wc); + + GetWindowRect(GetDesktopWindow(), &r); + xext = r.right; + yext = r.bottom; + + hwnd = CreateWindowEx(0L, "tpcal", "Touch Panel Calibration", + WS_VISIBLE, 0, 0, xext, yext, + NULL, (HMENU)1, NULL, NULL); + + // Don't restrict mouse much in order to handle uncalibrated points. + big = 1000000; + GdRestrictMouse(-big, -big, big, big); + + // We want all mouse events - even ones outside our window. + SetCapture(hwnd); + + while(GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return 0; +} + +int enable_pointing_coordinate_transform; + +int MwUserInit(int ac, char** av) +{ + enable_pointing_coordinate_transform = 0; + + if ( ac > 1 ) + total_targets = atol(av[1]); + + return 0; +} + diff --git a/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/transform.c b/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/transform.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/transform.c @@ -0,0 +1,295 @@ +/* + * transform.c + * Calculate coefficients for tranformation equation + * Copyright (C) 1999 Bradley D. LaRonde + * + * This program is free software; you may 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "windows.h" +#include "mou_tp.h" +#include "transform.h" + +int CalcTransformationCoefficientsSimple(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc) +{ + /* + * This is my simple way of calculating some of the coefficients - + * enough to do a simple scale and translate. + * It ignores any dependencies between axiis (rotation and/or skew). + */ + + int min_screen_x = pcp->ul.screen.x; + int min_screen_y = pcp->ul.screen.y; + int max_screen_x = pcp->lr.screen.x; + int max_screen_y = pcp->lr.screen.y; + + int min_device_x = pcp->ul.device.x; + int min_device_y = pcp->ul.device.y; + int max_device_x = pcp->lr.device.x; + int max_device_y = pcp->lr.device.y; + + ptc->s = (1 << 16); + ptc->a = ptc->s * (min_screen_x - max_screen_x) / (min_device_x - max_device_x); + ptc->b = 0; + ptc->c = (ptc->a * -min_device_x) + (ptc->s * min_screen_x); + ptc->d = 0; + ptc->e = ptc->s * (min_screen_y - max_screen_y) / (min_device_y - max_device_y); + ptc->f = (ptc->e * -min_device_y) + (ptc->s * min_screen_y); + + return 0; +} + +int CalcTransformationCoefficientsBetter(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc) +{ + /* + * Janus (the man) came up with a much better way + * to figure the coefficients. His original algorithm was written in MOO. + * Jay Carlson <> did the translation to C. + * This way takes into account inter-axis dependency like rotation and skew. + */ + + double vector[3][2] = + { + {pcp->ul.screen.x, pcp->ul.screen.y}, + {pcp->ur.screen.x, pcp->ur.screen.y}, + {pcp->lr.screen.x, pcp->lr.screen.y} + }; + + double matrix[3][3] = + { + {pcp->ul.device.x, pcp->ul.device.y, 1.0}, + {pcp->ur.device.x, pcp->ur.device.y, 1.0}, + {pcp->lr.device.x, pcp->lr.device.y, 1.0} + }; + + int i, j, r, k; + double p, q; + + for (i = 0; i < 3; i++) { + p = matrix[i][i]; + + for (j = 0; j < 3; j++) { + matrix[i][j] = matrix[i][j] / p; + } + + for (j = 0; j < 2; j++) { + vector[i][j] = vector[i][j] / p; + } + + for (r = 0; r < 3; r++) { + if (r != i) { + q = matrix[r][i]; + + matrix[r][i] = 0.0; + + for (k = i + 1; k < 3; k++) { + matrix[r][k] = matrix[r][k] - (q * matrix[i][k]); + } + + for (k = 0; k < 2; k++) { + vector[r][k] = vector[r][k] - (q * vector[i][k]); + } + } + } + } + + ptc->s = 1 << 16; + ptc->a = vector[0][0] * ptc->s; + ptc->b = vector[1][0] * ptc->s; + ptc->c = vector[2][0] * ptc->s; + ptc->d = vector[0][1] * ptc->s; + ptc->e = vector[1][1] * ptc->s; + ptc->f = vector[2][1] * ptc->s; + + return 0; +} + +int CalcTransformationCoefficientsEvenBetter(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc) +{ + /* + * Mike Klar <> added the an xy term to correct for trapezoidial distortion. + */ + + double vector[4][2] = + { + {pcp->ul.screen.x, pcp->ul.screen.y}, + {pcp->ur.screen.x, pcp->ur.screen.y}, + {pcp->lr.screen.x, pcp->lr.screen.y}, + {pcp->ll.screen.x, pcp->ll.screen.y} + }; + + double matrix[4][4] = + { + {pcp->ul.device.x, pcp->ul.device.x * pcp->ul.device.y, pcp->ul.device.y, 1.0}, + {pcp->ur.device.x, pcp->ur.device.x * pcp->ur.device.y, pcp->ur.device.y, 1.0}, + {pcp->lr.device.x, pcp->lr.device.x * pcp->lr.device.y, pcp->lr.device.y, 1.0}, + {pcp->ll.device.x, pcp->ll.device.x * pcp->ll.device.y, pcp->ll.device.y, 1.0} + }; + + int i, j, r, k; + double p, q; + + for (i = 0; i < 4; i++) { + p = matrix[i][i]; + + for (j = 0; j < 4; j++) { + matrix[i][j] = matrix[i][j] / p; + } + + for (j = 0; j < 2; j++) { + vector[i][j] = vector[i][j] / p; + } + + for (r = 0; r < 4; r++) { + if (r != i) { + q = matrix[r][i]; + + matrix[r][i] = 0.0; + + for (k = i + 1; k < 4; k++) { + matrix[r][k] = matrix[r][k] - (q * matrix[i][k]); + } + + for (k = 0; k < 2; k++) { + vector[r][k] = vector[r][k] - (q * vector[i][k]); + } + } + } + } + + /* I just drop the xy coefficient since it is so small. */ + ptc->s = 1 << 16; + ptc->a = vector[0][0] * ptc->s; + ptc->b = vector[2][0] * ptc->s; + ptc->c = vector[3][0] * ptc->s; + ptc->d = vector[0][1] * ptc->s; + ptc->e = vector[2][1] * ptc->s; + ptc->f = vector[3][1] * ptc->s; + + return 0; +} + +int CalcTransformationCoefficientsBest(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc) +{ + /* + * Mike Klar <> came up with a best-fit solution that works best. + */ + + const int first_point = 0; + const int last_point = 4; + int i; + + double Sx=0, Sy=0, Sxy=0, Sx2=0, Sy2=0, Sm=0, Sn=0, Smx=0, Smy=0, Snx=0, Sny=0, S=0; + double t1, t2, t3, t4, t5, t6, q; + + /* cast the struct to an array - hacky but ok */ + CALIBRATION_PAIR *cp = (CALIBRATION_PAIR*)pcp; + + /* + * Do a best-fit calculation for as many points as we want, as + * opposed to an exact fit, which can only be done against 3 points. + * + * The following calculates various sumnations of the sample data + * coordinates. For purposes of naming convention, x and y + * refer to device coordinates, m and n refer to screen + * coordinates, S means sumnation. x2 and y2 are x squared and + * y squared, S by itself is just a count of points (= sumnation + * of 1). + */ + + for (i = first_point; i < last_point + 1; i++) { + Sx += cp[i].device.x; + Sy += cp[i].device.y; + Sxy += cp[i].device.x * cp[i].device.y; + Sx2 += cp[i].device.x * cp[i].device.x; + Sy2 += cp[i].device.y * cp[i].device.y; + Sm += cp[i].screen.x; + Sn += cp[i].screen.y; + Smx += cp[i].screen.x * cp[i].device.x; + Smy += cp[i].screen.x * cp[i].device.y; + Snx += cp[i].screen.y * cp[i].device.x; + Sny += cp[i].screen.y * cp[i].device.y; + S += 1; + } + +#if 0 + printf("%f, %f, %f, %f, " + "%f, %f, %f, %f, " + "%f, %f, %f, %f\n", + Sx, Sy, Sxy, Sx2, Sy2, Sm, Sn, Smx, Smy, Snx, Sny, S); +#endif + + /* + * Next we solve the simultaneous equations (these equations minimize + * the sum of the square of the m and n error): + * + * | Sx2 Sxy Sx | | a d | | Smx Snx | + * | Sxy Sy2 Sy | * | b e | = | Smy Sny | + * | Sx Sy S | | c f | | Sm Sn | + * + * We could do the matrix solution in code, but that leads to several + * divide by 0 conditions for cases where the data is truly solvable + * (becuase those terms cancel out of the final solution), so we just + * give the final solution instread. t1 through t6 and q are just + * convenience variables for terms that are used repeatedly - we could + * calculate each of the coefficients directly at this point with a + * nasty long equation, but that would be extremly inefficient. + */ + + t1 = Sxy * Sy - Sx * Sy2; + t2 = Sxy * Sx - Sx2 * Sy; + t3 = Sx2 * Sy2 - Sxy * Sxy; + t4 = Sy2 * S - Sy * Sy; + t5 = Sx * Sy - Sxy * S; + t6 = Sx2 * S - Sx * Sx; + + q = t1 * Sx + t2 * Sy + t3 * S; + + /* + * If q = 0, then the data is unsolvable. This should only happen + * when there are not enough unique data points (less than 3 points + * will give infinite solutions), or at least one of the + * coefficients is infinite (which would indicate that the same + * device point represents an infinite area of the screen, probably + * as a result of the same device data point given for 2 different + * screen points). The first condition should never happen, since + * we're always feeding in at least 3 unique screen points. The + * second condition would probably indicate bad user input or the + * touchpanel device returning bad data. + */ + + if (q == 0) + return -1; + + ptc->s = 1 << 16; + ptc->a = ((t4 * Smx + t5 * Smy + t1 * Sm) / q + 0.5/65536) * ptc->s; + ptc->b = ((t5 * Smx + t6 * Smy + t2 * Sm) / q + 0.5/65536) * ptc->s; + ptc->c = ((t1 * Smx + t2 * Smy + t3 * Sm) / q + 0.5/65536) * ptc->s; + ptc->d = ((t4 * Snx + t5 * Sny + t1 * Sn) / q + 0.5/65536) * ptc->s; + ptc->e = ((t5 * Snx + t6 * Sny + t2 * Sn) / q + 0.5/65536) * ptc->s; + ptc->f = ((t1 * Snx + t2 * Sny + t3 * Sn) / q + 0.5/65536) * ptc->s; + + /* + * Finally, we check for overflow on the fp to integer conversion, + * which would also probably indicate bad data. + */ + + if ( (ptc->a == 0x80000000) || (ptc->b == 0x80000000) || + (ptc->c == 0x80000000) || (ptc->d == 0x80000000) || + (ptc->e == 0x80000000) || (ptc->f == 0x80000000) ) + return -1; + + return 0; +} + diff --git a/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/transform.h b/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/transform.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/GPL/tpcal/transform.h @@ -0,0 +1,37 @@ +/* + * transform.h + * Copyright (C) 1999 Bradley D. LaRonde + * + * This program is free software; you may 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +typedef struct +{ + MWPOINT screen, device; +} CALIBRATION_PAIR; + +typedef struct +{ + CALIBRATION_PAIR center; + CALIBRATION_PAIR ul; + CALIBRATION_PAIR ur; + CALIBRATION_PAIR lr; + CALIBRATION_PAIR ll; +} CALIBRATION_PAIRS; + +int CalcTransformationCoefficientsSimple(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc); +int CalcTransformationCoefficientsBetter(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc); +int CalcTransformationCoefficientsEvenBetter(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc); +int CalcTransformationCoefficientsBest(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc); diff --git a/packages/services/gfx/mw/current/src/contrib/MWIN-TCN.PRJ b/packages/services/gfx/mw/current/src/contrib/MWIN-TCN.PRJ new file mode 100644 index 0000000000000000000000000000000000000000..8688d96d36466824a484a3fc642fc6cad1080e37 GIT binary patch literal 9714 zc%1E8X>e256+W^hc>%&w_9a}5ZRAZG#x@ueWa-(wpsi1`F;vvGW!YA+C0CMJn#6$= z0trh(O1h;BB|s>UK+{s1HfhuTXvxwhP1~fum`pOAY5#PFHf?{D^!1!4*=T$6BWS`* zhBM5kd(S=Re)nG8bMHMe-qA>Jm|2-S6233skFmDkP=GB2)wEgjR0{!$%SBc!rw}o-$~^+5k>JWN%MQD{I;b3gM@!XEQEIu*TXfe!#@c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W!b}THKp5xjRHn#P+L|C z_^2r5NR2r%Iy1_j8Y^!tnkl(z%;XnZDe-EfCAr8N8D1k+9u%}u(oTpgnJJ?u?4dBq z%t?DVjB;|)E)shnu`KUll!udd(io-S#LYZLxi@Jykx_O{+RtQ^SCe*B*_=cxZv*Aa zgk9xC8{gGtlsuER)fuJ73gBwYm(M%zAx*ZZ(DN!bW6!HZ- zolVkP4*nE@$&d=u#4S^XR3DR5#r2|5#5H4*O%wQ>|L3*;=dp{!8=!tL06uBjx0u0$Ih1;a6h?OpqtjaVDR);3{Fk1wynn#d*sn(V^1=GXmT!w7oFY&=O
Zs##jriR4qsx}9qteJ zhOdtPj0J@K;lA*e@J6()4fhZIs0H+6$-$wQ5^zB5OkB5N`_@fYTqpAH-oTa9W(|fl zFCICqWpA~3(C)Ab<&poAiG4B>YjIaon{{6?M#}E-x7o=~)}M;Is}wBjRi%KJj68mo z^IcYxiCg(MUPNB@*dn{tU4&Np%7}};TOn%hKy@|UtLUA5I6U-vreM&v%67JKwQX?J xFVW_=_1U)AHrje^Yi<3uMznZsL7Us=v(2}uHV5kBsB5jY4Sud&oc@#X{{V_1$Aka? diff --git a/packages/services/gfx/mw/current/src/contrib/README.freebsd b/packages/services/gfx/mw/current/src/contrib/README.freebsd new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/README.freebsd @@ -0,0 +1,17 @@ +I have added files to this package to get it to run on a FreeBSD +console. Some changes, particularly to the Makefiles are not particularly +clean, and could probably be done a lot better (but hey, it's what I got +done in about a day d8) + +2000/07/01 +I've added a terminal 'wterm'. At least it has a termcap so you can +run curses based stuff, and it scrolls (scroll speed depends on the +speed of your blitter, the FreeBSD blitter is completely stupid at +the moment). + +-- +Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew +The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | Milton +ACN: 082 081 472 | M:+61 416 022 411 |72 Col .Sig +PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|Specialist + diff --git a/packages/services/gfx/mw/current/src/contrib/djgpp/readme.dj b/packages/services/gfx/mw/current/src/contrib/djgpp/readme.dj new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/djgpp/readme.dj @@ -0,0 +1,41 @@ +For compiliing Microwindows to DOS + DJGPP you should have the following: +===================================================================== +1. Microwin 0.89 pre7 - (microwindows.org) +2. DJGPP ver. 2.01 - (www.delorie.com) +3. GRX ver. 2.3 - (www.gnu.de/software/grx or www.delorie.com) + + +You should do the following: +=============================== +1. copy Configs/config.dj to src/config + + +do MAKE !!! +=============== + +I made it on Windows 95. + +File grx20.h should be in djgpp\include and file libgrx20.a +should be in djgpp\lib. + +For using long file names you should set LFN=y in file djgpp.env +under Windows 95, or rename some files to 8.3 under DOS. + +For NANOXDEMO use LINK_APP_INTO_SERVER. + +! NOT all demos have been tested (or debugged) for DJGPP. + +:-( :-( :-( :-( :-( :-( :-( :-( :-( :-( :-( :-( + +Sorry, but you have to exclude from src/demos/nanox makefile +next files: + +nxterm.c, npanel.c, ntetris.c, launcher.c, nxview.c, slider.c + +TO DO : fix next files : + +nxterm.c, npanel.c, ntetris.c, launcher.c, nxview.c, slider.c + +=============================================== + +Victor Rogachev diff --git a/packages/services/gfx/mw/current/src/contrib/fb.modes b/packages/services/gfx/mw/current/src/contrib/fb.modes new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/fb.modes @@ -0,0 +1,975 @@ +# +# Sample video modes +# +# These data are based on the CRTC parameters in +# +# Mach64 Programmer's Guide, Appendix C +# (C) 1998 ATI Technologies Inc. +# + +# +# 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) +# +# Horizontal Vertical +# Resolution 640 480 +# Scan Frequency 31.469 kHz 59.94 Hz +# Sync Width 3.813 us 0.064 ms +# 12 chars 2 lines +# Front Porch 0.636 us 0.318 ms +# 2 chars 10 lines +# Back Porch 1.907 us 1.048 ms +# 6 chars 33 lines +# Active Time 25.422 us 15.253 ms +# 80 chars 480 lines +# Blank Time 6.356 us 1.430 ms +# 20 chars 45 lines +# Polarity negative negative +# + +mode "640x480-60" + # D: 25.175 MHz, H: 31.469 kHz, V: 59.94 Hz + geometry 640 480 640 480 8 + timings 39722 48 16 33 10 96 2 +endmode + +# +# 640x480, 72 Hz, Non-Interlaced (31.20 MHz dotclock) +# +# Horizontal Vertical +# Resolution 640 480 +# Scan Frequency 37.500 kHz 72.12 Hz +# Sync Width 1.282 us 0.080 ms +# 5 chars 3 lines +# Front Porch 0.769 us 0.240 ms +# 3 chars 9 lines +# Back Porch 4.103 us 0.747 ms +# 16 chars 28 lines +# Active Time 20.513 us 12.800 ms +# 80 chars 480 lines +# Blank Time 6.154 us 1.067 ms +# 24 chars 40 lines +# Polarity negative negative +# + +mode "640x480-72" + # D: 31.20 MHz, H: 37.500 kHz, V: 72.12 Hz + geometry 640 480 640 480 8 + timings 32052 128 24 28 9 40 3 +endmode + +mode "test8" + # D: 31.20 MHz, H: 37.500 kHz, V: 72.12 Hz + geometry 640 480 640 480 8 + timings 32052 128 24 28 9 40 3 +endmode + +mode "test16" + # D: 31.20 MHz, H: 37.500 kHz, V: 72.12 Hz + geometry 640 480 640 480 16 + timings 32052 128 24 28 9 40 3 +endmode + +mode "test32" + # D: 31.20 MHz, H: 37.500 kHz, V: 72.12 Hz + geometry 640 480 640 480 32 + timings 32052 128 24 28 9 40 3 +endmode + +mode "ntest8" + # D: 25.172 MHz, H: 31.466 kHz, V: 59.934 Hz + geometry 640 480 640 480 8 + timings 39726 48 16 33 10 96 2 +endmode + +mode "ntest16" + # D: 25.172 MHz, H: 31.466 kHz, V: 59.934 Hz + geometry 640 480 640 480 16 + timings 39726 48 16 33 10 96 2 +endmode + +mode "ntest32" + # D: 25.172 MHz, H: 31.466 kHz, V: 59.934 Hz + geometry 640 480 640 480 32 + timings 39726 48 16 33 10 96 2 +endmode + +mode "ntest24" + # D: 25.172 MHz, H: 31.466 kHz, V: 59.934 Hz + geometry 640 480 640 480 24 + timings 39726 48 16 33 10 96 2 +endmode + +# +# 640x480, 75 Hz, Non-Interlaced (31.50 MHz dotclock) +# +# Horizontal Vertical +# Resolution 640 480 +# Scan Frequency 37.500 kHz 75.00 Hz +# Sync Width 2.032 us 0.080 ms +# 8 chars 3 lines +# Front Porch 0.508 us 0.027 ms +# 2 chars 1 lines +# Back Porch 3.810 us 0.427 ms +# 15 chars 16 lines +# Active Time 20.317 us 12.800 ms +# 80 chars 480 lines +# Blank Time 6.349 us 0.533 ms +# 25 chars 20 lines +# Polarity negative negative +# + +mode "640x480-75" + # D: 31.50 MHz, H: 37.500 kHz, V: 75.00 Hz + geometry 640 480 640 480 8 + timings 31747 120 16 16 1 64 3 +endmode + +# +# 640x480, 90 Hz, Non-Interlaced (39.91 MHz dotclock) +# +# Horizontal Vertical +# Resolution 640 480 +# Scan Frequency 47.969 kHz 90.00 Hz +# Sync Width 1.002 us 0.292 ms +# 5 chars 14 lines +# Front Porch 0.902 us 0.521 ms +# 4 chars 25 lines +# Back Porch 2.907 us 0.292 ms +# 15 chars 14 lines +# Active Time 16.036 us 10.007 ms +# 80 chars 480 lines +# Blank Time 4.811 us 1.105 ms +# 24 chars 53 lines +# Polarity negative negative +# + +mode "640x480-90" + # D: 39.91 MHz, H: 47.969 kHz, V: 90.00 Hz + geometry 640 480 640 480 8 + timings 25057 120 32 14 25 40 14 +endmode + +# +# 640x480, 100 Hz, Non-Interlaced (44.90 MHz dotclock) +# +# Horizontal Vertical +# Resolution 640 480 +# Scan Frequency 52.948 kHz 99.71 Hz +# Sync Width 2.851 us 0.227 ms +# 16 chars 12 lines +# Front Porch 0.801 us 0.416 ms +# 4 chars 22 lines +# Back Porch 0.981 us 0.322 ms +# 6 chars 17 lines +# Active Time 14.254 us 9.065 ms +# 80 chars 480 lines +# Blank Time 4.633 us 0.963 ms +# 26 chars 51 lines +# Polarity negative negative +# + +mode "640x480-100" + # D: 44.90 MHz, H: 52.948 kHz, V: 99.71 Hz + geometry 640 480 640 480 8 + timings 22272 48 32 17 22 128 12 +endmode + +# +# 800x600, 48 Hz, Interlaced (36.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 800 600 +# Scan Frequency 33.835 kHz 96.39 Hz +# Sync Width 3.556 us 0.177 ms +# 16 chars 12 lines +# Front Porch 2.222 us 0.163 ms +# 10 chars 11 lines +# Back Porch 1.555 us 1.167 ms +# 7 chars 79 lines +# Active Time 22.222 us 8.867 ms +# 100 chars 600 lines +# Blank Time 7.333 us 1.507 ms +# 33 chars 102 lines +# Polarity positive positive +# + +mode "800x600-48-lace" + # D: 36.00 MHz, H: 33.835 kHz, V: 96.39 Hz + geometry 800 600 800 600 8 + timings 27778 56 80 79 11 128 12 + laced true + hsync high + vsync high +endmode + +# +# 800x600, 56 Hz, Non-Interlaced (36.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 800 600 +# Scan Frequency 35.156 kHz 56.25 Hz +# Sync Width 2.000 us 0.057 ms +# 9 chars 2 lines +# Front Porch 0.667 us 0.028 ms +# 3 chars 1 lines +# Back Porch 3.555 us 0.626 ms +# 16 chars 22 lines +# Active Time 22.222 us 17.067 ms +# 100 chars 600 lines +# Blank Time 6.222 us 0.711 ms +# 28 chars 25 lines +# Polarity positive positive +# + +mode "800x600-56" + # D: 36.00 MHz, H: 35.156 kHz, V: 56.25 Hz + geometry 800 600 800 600 8 + timings 27778 128 24 22 1 72 2 + hsync high + vsync high +endmode + +# +# 800x600, 60 Hz, Non-Interlaced (40.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 800 600 +# Scan Frequency 37.879 kHz 60.32 Hz +# Sync Width 3.200 us 0.106 ms +# 16 chars 4 lines +# Front Porch 1.000 us 0.026 ms +# 5 chars 1 lines +# Back Porch 2.200 us 0.607 ms +# 11 chars 23 lines +# Active Time 20.000 us 15.840 ms +# 100 chars 600 lines +# Blank Time 6.400 us 0.739 ms +# 32 chars 28 lines +# Polarity positive positive +# + +mode "800x600-60" + # D: 40.00 MHz, H: 37.879 kHz, V: 60.32 Hz + geometry 800 600 800 600 8 + timings 25000 88 40 23 1 128 4 + hsync high + vsync high +endmode + +# +# 800x600, 70 Hz, Non-Interlaced (44.90 MHz dotclock) +# +# Horizontal Vertical +# Resolution 800 600 +# Scan Frequency 44.544 kHz 70.04 Hz +# Sync Width 3.207 us 0.269 ms +# 18 chars 12 lines +# Front Porch 0.535 us 0.202 ms +# 3 chars 9 lines +# Back Porch 0.891 us 0.337 ms +# 5 chars 15 lines +# Active Time 17.817 us 13.470 ms +# 100 chars 600 lines +# Blank Time 4.633 us 0.808 ms +# 26 chars 36 lines +# Polarity positive negative +# + +mode "800x600-70" + # D: 44.90 MHz, H: 44.544 kHz, V: 70.04 Hz + geometry 800 600 800 600 8 + timings 22272 40 24 15 9 144 12 + hsync high +endmode + +# +# 800x600, 72 Hz, Non-Interlaced (50.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 800 600 +# Scan Frequency 48.090 kHz 72.19 Hz +# Sync Width 2.400 us 0.125 ms +# 15 chars 6 lines +# Front Porch 1.120 us 0.769 ms +# 7 chars 37 lines +# Back Porch 1.280 us 0.478 ms +# 8 chars 23 lines +# Active Time 16.000 us 12.477 ms +# 100 chars 600 lines +# Blank Time 4.800 us 1.372 ms +# 30 chars 66 lines +# Polarity positive positive +# + +mode "800x600-72" + # D: 50.00 MHz, H: 48.090 kHz, V: 72.19 Hz + geometry 800 600 800 600 8 + timings 20000 64 56 23 37 120 6 + hsync high + vsync high +endmode + +# +# 800x600, 75 Hz, Non-Interlaced (49.50 MHz dotclock) +# +# Horizontal Vertical +# Resolution 800 600 +# Scan Frequency 46.875 kHz 75.00 Hz +# Sync Width 1.616 us 0.064 ms +# 10 chars 3 lines +# Front Porch 0.323 us 0.021 ms +# 2 chars 1 lines +# Back Porch 3.232 us 0.448 ms +# 20 chars 21 lines +# Active Time 16.162 us 12.800 ms +# 100 chars 600 lines +# Blank Time 5.172 us 0.533 ms +# 32 chars 25 lines +# Polarity positive positive +# + +mode "800x600-75" + # D: 49.50 MHz, H: 46.875 kHz, V: 75.00 Hz + geometry 800 600 800 600 8 + timings 20203 160 16 21 1 80 3 + hsync high + vsync high +endmode + +# +# 800x600, 90 Hz, Non-Interlaced (56.64 MHz dotclock) +# +# Horizontal Vertical +# Resolution 800 600 +# Scan Frequency 57.097 kHz 89.92 Hz +# Sync Width 1.130 us 0.193 ms +# 8 chars 11 lines +# Front Porch 0.071 us 0.140 ms +# 1 chars 8 lines +# Back Porch 2.189 us 0.280 ms +# 15 chars 16 lines +# Active Time 14.124 us 10.508 ms +# 100 chars 600 lines +# Blank Time 3.390 us 0.613 ms +# 24 chars 35 lines +# Polarity positive positive +# + +mode "800x600-90" + # D: 56.64 MHz, H: 57.097 kHz, V: 89.92 Hz + geometry 800 600 800 600 8 + timings 17656 120 8 16 8 64 11 + hsync high + vsync high +endmode + +# +# 800x600, 100 Hz, Non-Interlaced (67.50 MHz dotclock) +# +# Horizontal Vertical +# Resolution 800 600 +# Scan Frequency 62.500 kHz 100.00 Hz +# Sync Width 0.948 us 0.064 ms +# 8 chars 4 lines +# Front Porch 0.000 us 0.112 ms +# 0 chars 7 lines +# Back Porch 3.200 us 0.224 ms +# 27 chars 14 lines +# Active Time 11.852 us 9.600 ms +# 100 chars 600 lines +# Blank Time 4.148 us 0.400 ms +# 35 chars 25 lines +# Polarity positive positive +# + +mode "800x600-100" + # D: 67.50 MHz, H: 62.500 kHz, V: 100.00 Hz + geometry 800 600 800 600 8 + timings 14815 216 0 14 7 64 4 + hsync high + vsync high +endmode + +# +# 1024x768, 43 Hz, Interlaced (44.90 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1024 768 +# Scan Frequency 35.522 kHz 86.96 Hz +# Sync Width 3.920 us 0.113 ms +# 22 chars 8 lines +# Front Porch 0.178 us 0.014 ms +# 1 chars 1 lines +# Back Porch 1.247 us 0.563 ms +# 7 chars 40 lines +# Active Time 22.806 us 10.810 ms +# 128 chars 768 lines +# Blank Time 5.345 us 0.690 ms +# 30 chars 49 lines +# Polarity positive positive +# + +mode "1024x768-43-lace" + # D: 44.90 MHz, H: 35.522 kHz, V: 86.96 Hz + geometry 1024 768 1024 768 8 + timings 22272 56 8 40 1 176 8 + laced true + hsync high + vsync high +endmode + +# +# 1024x768, 60 Hz, Non-Interlaced (65.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1024 768 +# Scan Frequency 48.363 kHz 60.00 Hz +# Sync Width 2.092 us 0.124 ms +# 17 chars 6 lines +# Front Porch 0.369 us 0.062 ms +# 3 chars 3 lines +# Back Porch 2.462 us 0.601 ms +# 20 chars 29 lines +# Active Time 15.754 us 15.880 ms +# 128 chars 768 lines +# Blank Time 4.923 us 0.786 ms +# 40 chars 38 lines +# Polarity negative negative +# + +mode "1024x768-60" + # D: 65.00 MHz, H: 48.363 kHz, V: 60.00 Hz + geometry 1024 768 1024 768 8 + timings 15385 160 24 29 3 136 6 +endmode + +# +# 1024x768, 70 Hz, Non-Interlaced (75.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1024 768 +# Scan Frequency 56.476 kHz 70.07 Hz +# Sync Width 1.813 us 0.106 ms +# 17 chars 6 lines +# Front Porch 0.320 us 0.053 ms +# 3 chars 3 lines +# Back Porch 1.921 us 0.514 ms +# 18 chars 29 lines +# Active Time 13.653 us 13.599 ms +# 128 chars 768 lines +# Blank Time 4.053 us 0.673 ms +# 38 chars 38 lines +# Polarity negative negative +# + +mode "1024x768-70" + # D: 75.00 MHz, H: 56.476 kHz, V: 70.07 Hz + geometry 1024 768 1024 768 8 + timings 13334 144 24 29 3 136 6 +endmode + +# +# 1024x768, 72 Hz, Non-Interlaced (75.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 10224 768 +# Scan Frequency 58.230 kHz 72.245 Hz +# Sync Width 1.813 us 0.103 ms +# 17 chars 6 lines +# Front Porch 0.320 us 0.052 ms +# 3 chars 3 lines +# Back Porch 1.387 us 0.498 ms +# 13 chars 29 lines +# Active Time 13.653 us 13.189 ms +# 128 chars 768 lines +# Blank Time 3.520 us 0.653 ms +# 33 chars 38 lines +# Polarity negative negative +# + +mode "1024x768-72" + # D: 75.00 MHz, H: 58.230 kHz, V: 72.245 Hz + geometry 10224 768 10224 768 8 + timings 13334 104 24 29 3 136 6 +endmode + +# +# 1024x768, 75 Hz, Non-Interlaced (78.75 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1024 768 +# Scan Frequency 60.023 kHz 75.03 Hz +# Sync Width 1.219 us 0.050 ms +# 12 chars 3 lines +# Front Porch 0.203 us 0.017 ms +# 2 chars 1 lines +# Back Porch 2.235 us 0.466 ms +# 22 chars 28 lines +# Active Time 13.003 us 12.795 ms +# 128 chars 768 lines +# Blank Time 3.657 us 0.533 ms +# 36 chars 32 lines +# Polarity positive positive +# + +mode "1024x768-75" + # D: 78.75 MHz, H: 60.023 kHz, V: 75.03 Hz + geometry 1024 768 1024 768 8 + timings 12699 176 16 28 1 96 3 + hsync high + vsync high +endmode + +# +# 1024x768, 90 Hz, Non-Interlaced (100.0 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1024 768 +# Scan Frequency 76.220 kHz 90.20 Hz +# Sync Width 0.960 us 0.197 ms +# 12 chars 15 lines +# Front Porch 0.000 us 0.276 ms +# 0 chars 21 lines +# Back Porch 1.920 us 0.537 ms +# 24 chars 41 lines +# Active Time 10.240 us 10.076 ms +# 128 chars 768 lines +# Blank Time 2.880 us 1.010 ms +# 36 chars 77 lines +# Polarity negative negative +# + +mode "1024x768-90" + # D: 100.0 MHz, H: 76.220 kHz, V: 90.20 Hz + geometry 1024 768 1024 768 8 + timings 10000 192 0 41 21 96 15 +endmode + +# +# 1024x768, 100 Hz, Non-Interlaced (110.0 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1024 768 +# Scan Frequency 79.023 kHz 99.78 Hz +# Sync Width 0.800 us 0.101 ms +# 11 chars 8 lines +# Front Porch 0.000 us 0.000 ms +# 0 chars 0 lines +# Back Porch 2.545 us 0.202 ms +# 35 chars 16 lines +# Active Time 9.309 us 9.719 ms +# 128 chars 768 lines +# Blank Time 3.345 us 0.304 ms +# 46 chars 24 lines +# Polarity negative negative +# + +mode "1024x768-100" + # D: 110.0 MHz, H: 79.023 kHz, V: 99.78 Hz + geometry 1024 768 1024 768 8 + timings 9091 280 0 16 0 88 8 +endmode + +# +# 1152x864, 43 Hz, Interlaced (65.0 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1152 864 +# Scan Frequency 45.904 kHz 87.02 Hz +# Sync Width 1.969 us 0.098 ms +# 16 chars 9 lines +# Front Porch 1.062 us 0.850 ms +# 9 chars 78 lines +# Back Porch 1.031 us 1.133 ms +# 8 chars 104 lines +# Active Time 17.723 us 9.411 ms +# 144 chars 864 lines +# Blank Time 4.062 us 2.080 ms +# 33 chars 191 lines +# Polarity positive positive +# + +mode "1152x864-43-lace" + # D: 65.0 MHz, H: 45.904 kHz, V: 87.02 Hz + geometry 1152 864 1152 864 8 + timings 15385 64 72 104 78 128 9 + laced true + hsync high + vsync high +endmode + +# +# 1152x864, 47 Hz, Interlaced (65.0 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1152 864 +# Scan Frequency 44.890 kHz 94.80 Hz +# Sync Width 1.969 us 0.100 ms +# 16 chars 9 lines +# Front Porch 1.415 us 0.334 ms +# 11 chars 30 lines +# Back Porch 1.170 us 0.490 ms +# 10 chars 44 lines +# Active Time 17.723 us 9.624 ms +# 144 chars 864 lines +# Blank Time 4.554 us 0.924 ms +# 37 chars 83 lines +# Polarity positive positive +# + +mode "1152x864-47-lace" + # D: 65.0 MHz, H: 44.890 kHz, V: 94.80 Hz + geometry 1152 864 1152 864 8 + timings 15385 80 88 44 30 128 9 + laced true + hsync high + vsync high +endmode + +# +# 1152x864, 60 Hz, Non-Interlaced (80.0 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1152 864 +# Scan Frequency 54.945 kHz 59.98 Hz +# Sync Width 1.400 us 0.091 ms +# 14 chars 5 lines +# Front Porch 0.800 us 0.109 ms +# 8 chars 6 lines +# Back Porch 1.600 us 0.746 ms +# 16 chars 41 lines +# Active Time 14.400 us 15.725 ms +# 144 chars 864 lines +# Blank Time 3.800 us 0.946 ms +# 38 chars 52 lines +# Polarity positive positive +# + +mode "1152x864-60" + # D: 80.0 MHz, H: 54.945 kHz, V: 59.98 Hz + geometry 1152 864 1152 864 8 + timings 12500 128 64 41 6 112 5 + hsync high + vsync high +endmode + +# +# 1152x864, 70 Hz, Non-Interlaced (100.0 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1152 864 +# Scan Frequency 66.138 kHz 69.99 Hz +# Sync Width 1.520 us 0.166 ms +# 19 chars 11 lines +# Front Porch 0.390 us 0.197 ms +# 5 chars 13 lines +# Back Porch 1.690 us 0.862 ms +# 21 chars 57 lines +# Active Time 11.520 us 13.064 ms +# 144 chars 864 lines +# Blank Time 3.600 us 1.225 ms +# 45 chars 81 lines +# Polarity positive positive +# + +mode "1152x864-70" + # D: 100.0 MHz, H: 66.138 kHz, V: 69.99 Hz + geometry 1152 864 1152 864 8 + timings 10000 168 40 57 13 152 11 + hsync high + vsync high +endmode + +# +# 1152x864, 75 Hz, Non-Interlaced (110.0 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1152 864 +# Scan Frequency 75.137 kHz 74.99 Hz +# Sync Width 1.309 us 0.106 ms +# 18 chars 8 lines +# Front Porch 0.245 us 0.599 ms +# 3 chars 45 lines +# Back Porch 1.282 us 1.132 ms +# 18 chars 85 lines +# Active Time 10.473 us 11.499 ms +# 144 chars 864 lines +# Blank Time 2.836 us 1.837 ms +# 39 chars 138 lines +# Polarity positive positive +# + +mode "1152x864-75" + # D: 110.0 MHz, H: 75.137 kHz, V: 74.99 Hz + geometry 1152 864 1152 864 8 + timings 9091 144 24 85 45 144 8 + hsync high + vsync high +endmode + +# +# 1152x864, 80 Hz, Non-Interlaced (110.0 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1152 864 +# Scan Frequency 76.389 kHz 79.74 Hz +# Sync Width 1.018 us 0.092 ms +# 14 chars 7 lines +# Front Porch 0.127 us 0.393 ms +# 2 chars 30 lines +# Back Porch 1.473 us 0.747 ms +# 20 chars 57 lines +# Active Time 10.473 us 11.311 ms +# 144 chars 864 lines +# Blank Time 2.618 us 1.231 ms +# 36 chars 94 lines +# Polarity positive positive +# + +mode "1152x864-80" + # D: 110.0 MHz, H: 76.389 kHz, V: 79.74 Hz + geometry 1152 864 1152 864 8 + timings 9091 160 16 57 30 112 7 + hsync high + vsync high +endmode + +# +# 1280x1024, 43 Hz, Interlaced (80.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1024 1024 +# Scan Frequency 50.000 kHz 87.03 Hz +# Sync Width 1.000 us 0.100 ms +# 10 chars 10 lines +# Front Porch 1.000 us 0.500 ms +# 10 chars 50 lines +# Back Porch 2.000 us 0.650 ms +# 20 chars 65 lines +# Active Time 16.000 us 10.240 ms +# 160 chars 1024 lines +# Blank Time 4.000 us 1.250 ms +# 40 chars 125 lines +# Polarity positive positive +# + +mode "1280x1024-43-lace" + # D: 80.00 MHz, H: 50.000 kHz, V: 87.03 Hz + geometry 1024 1024 1024 1024 8 + timings 12500 160 80 65 50 80 10 + laced true + hsync high + vsync high +endmode + +# +# 1280x1024, 47 Hz, Interlaced (80.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1280 1024 +# Scan Frequency 50.000 kHz 94.97 Hz +# Sync Width 1.000 us 0.100 ms +# 10 chars 10 lines +# Front Porch 1.000 us 0.010 ms +# 10 chars 1 lines +# Back Porch 2.000 us 0.180 ms +# 20 chars 18 lines +# Active Time 16.000 us 10.240 ms +# 160 chars 1024 lines +# Blank Time 4.000 us 0.290 ms +# 40 chars 29 lines +# Polarity positive positive +# + +mode "1280x1024-47-lace" + # D: 80.00 MHz, H: 50.000 kHz, V: 94.97 Hz + geometry 1280 1024 1280 1024 8 + timings 12500 160 80 18 1 80 10 + laced true + hsync high + vsync high +endmode + +# +# 1280x1024, 60 Hz, Non-Interlaced (108.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1280 1024 +# Scan Frequency 63.981 kHz 60.02 Hz +# Sync Width 1.037 us 0.047 ms +# 14 chars 3 lines +# Front Porch 0.444 us 0.015 ms +# 6 chars 1 lines +# Back Porch 2.297 us 0.594 ms +# 31 chars 38 lines +# Active Time 11.852 us 16.005 ms +# 160 chars 1024 lines +# Blank Time 3.778 us 0.656 ms +# 51 chars 42 lines +# Polarity positive positive +# + +mode "1280x1024-60" + # D: 108.00 MHz, H: 63.981 kHz, V: 60.02 Hz + geometry 1280 1024 1280 1024 8 + timings 9260 248 48 38 1 112 3 + hsync high + vsync high +endmode + +# +# 1280x1024, 70 Hz, Non-Interlaced (126.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1280 1024 +# Scan Frequency 74.645 kHz 70.02 Hz +# Sync Width 0.889 us 0.067 ms +# 14 chars 5 lines +# Front Porch 0.635 us 0.013 ms +# 10 chars 1 lines +# Back Porch 1.714 us 0.483 ms +# 27 chars 36 lines +# Active Time 10.159 us 13.718 ms +# 160 chars 1024 lines +# Blank Time 3.238 us 0.563 ms +# 51 chars 42 lines +# Polarity positive positive +# + +mode "1280x1024-70" + # D: 126.00 MHz, H: 74.645 kHz, V: 70.02 Hz + geometry 1280 1024 1280 1024 8 + timings 7937 216 80 36 1 112 5 + hsync high + vsync high +endmode + +# +# 1280x1024, 74 Hz, Non-Interlaced (135.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1280 1024 +# Scan Frequency 78.855 kHz 74.11 Hz +# Sync Width 1.067 us 0.380 ms +# 18 chars 30 lines +# Front Porch 0.237 us 0.000 ms +# 4 chars 0 lines +# Back Porch 1.896 us 0.127 ms +# 32 chars 10 lines +# Active Time 9.481 us 12.986 ms +# 160 chars 1024 lines +# Blank Time 3.200 us 0.507 ms +# 54 chars 40 lines +# Polarity positive positive +# + +mode "1280x1024-74" + # D: 135.00 MHz, H: 78.855 kHz, V: 74.11 Hz + geometry 1280 1024 1280 1024 8 + timings 7408 256 32 10 0 144 30 + hsync high + vsync high +endmode + +# +# 1280x1024, 75 Hz, Non-Interlaced (135.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1280 1024 +# Scan Frequency 79.976 kHz 75.02 Hz +# Sync Width 1.067 us 0.038 ms +# 18 chars 3 lines +# Front Porch 0.119 us 0.012 ms +# 2 chars 1 lines +# Back Porch 1.837 us 0.475 ms +# 31 chars 38 lines +# Active Time 9.481 us 12.804 ms +# 160 chars 1024 lines +# Blank Time 3.022 us 0.525 ms +# 51 chars 42 lines +# Polarity positive positive +# + +mode "1280x1024-75" + # D: 135.00 MHz, H: 79.976 kHz, V: 75.02 Hz + geometry 1280 1024 1280 1024 8 + timings 7408 248 16 38 1 144 3 + hsync high + vsync high +endmode + +# +# 1600x1200, 60 Hz, Non-Interlaced (156.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1600 1200 +# Scan Frequency 76.200 kHz 60.00 Hz +# Sync Width 1.026 us 0.105 ms +# 20 chars 8 lines +# Front Porch 0.205 us 0.131 ms +# 4 chars 10 lines +# Back Porch 1.636 us 0.682 ms +# 32 chars 52 lines +# Active Time 10.256 us 15.748 ms +# 200 chars 1200 lines +# Blank Time 2.872 us 0.866 ms +# 56 chars 66 lines +# Polarity negative negative +# + +mode "1600x1200-60" + # D: 156.00 MHz, H: 76.200 kHz, V: 60.00 Hz + geometry 1600 1200 1600 1200 8 + timings 6411 256 32 52 10 160 8 +endmode + +# +# 1600x1200, 66 Hz, Non-Interlaced (172.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1600 1200 +# Scan Frequency 82.700 kHz 66.00 Hz +# Sync Width 0.791 us 0.036 ms +# 17 chars 3 lines +# Front Porch 0.233 us 0.036 ms +# 5 chars 3 lines +# Back Porch 1.767 us 0.567 ms +# 38 chars 47 lines +# Active Time 9.302 us 14.512 ms +# 200 chars 1200 lines +# Blank Time 2.791 us 0.532 ms +# 60 chars 44 lines +# Polarity negative negative +# + +mode "1600x1200-66" + # D: 172.00 MHz, H: 82.700 kHz, V: 66.00 Hz + geometry 1600 1200 1600 1200 8 + timings 5814 304 40 47 3 136 3 +endmode + +# +# 1600x1200, 76 Hz, Non-Interlaced (198.00 MHz dotclock) +# +# Horizontal Vertical +# Resolution 1600 1200 +# Scan Frequency 95.200 kHz 76.00 Hz +# Sync Width 0.687 us 0.052 ms +# 17 chars 5 lines +# Front Porch 0.202 us 0.032 ms +# 5 chars 3 lines +# Back Porch 1.535 us 0.441 ms +# 38 chars 42 lines +# Active Time 8.081 us 12.606 ms +# 200 chars 1200 lines +# Blank Time 2.424 us 0.525 ms +# 60 chars 50 lines +# Polarity negative negative +# + +mode "1600x1200-76" + # D: 198.00 MHz, H: 95.200 kHz, V: 76.00 Hz + geometry 1600 1200 1600 1200 8 + timings 5051 304 40 42 3 136 5 +endmode + diff --git a/packages/services/gfx/mw/current/src/contrib/jpeg/README.txt b/packages/services/gfx/mw/current/src/contrib/jpeg/README.txt new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/jpeg/README.txt @@ -0,0 +1,25 @@ +To enable jpeg support in nanogui: + +- Download libjpeg source tarball at http://www.ijg.org +- Untar the tarball with tar -zxf + +In the jpeg directory, setup your compilation environment. +Here are the typical steps for linux: + +- cp jconfig.doc jconfig.h +- cp makefile.ansi Makefile +- Open the Makefile and delete the jconfig.h: target +- Don't forget to setup the right cc tools if you cross-compile! +- type 'make' + +In the config file: + +- Enable the HAVE_JPEG_SUPPORT definition +- set the INCJPEG to the jpeg directory +- set the LIBJPEG to the jpeg directory +- compile the project + +See demo3 if you want to see an example demo. + +Martin Jolcoeur +martinj@visuaide.com diff --git a/packages/services/gfx/mw/current/src/contrib/ntimers.c b/packages/services/gfx/mw/current/src/contrib/ntimers.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/ntimers.c @@ -0,0 +1,29 @@ + +void +GsAddTimer(struct GsTimer* newtimer) { + int i; + struct GsTimer* curTimer; + if(our_timers.numof++>0) { + curTimer=our_timer->head; + for(curTimer=our_timer->head;curTimer!=NULL;curTimer=curTimer->next) { + if(curTimer->due>newtimer->due) { /* time to file it away... */ + if(our_timer->head==curTimer) { /* put it at the beginning... */ + newtimer->next=our_timer->head; + our_timer->head=newtimer; + return; + } /* else put it in the middle... */ + newtimer->next=curTimer; + prevTimer->next=newtimer; + return; + } + prevTimer=curTimer; + } /* else put it at the end... */ + our_timer->tail->next=newtimer; + our_timer->tail=newtimer; + newtimer->next=NULL; + return; + } /* else... hey it's the first timer! */ + our_timer->head=newtimer; + our_timer->tail=newtimer; + newtimer->next=NULL; +} diff --git a/packages/services/gfx/mw/current/src/contrib/ntimers.h b/packages/services/gfx/mw/current/src/contrib/ntimers.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/ntimers.h @@ -0,0 +1,19 @@ +#ifndef __NTIMER_H__ +#define __NTIMER_H__ + +struct GsTimer { + struct GsTimer* next; + long due; + void* some_func; + void* some_args; +}; + +struct GsTimerHolder { + struct GsTimer* head; + struct GsTimer* tail; + int numof; +}; + + + +#endif diff --git a/packages/services/gfx/mw/current/src/contrib/pacific/mwin-pcn.prj b/packages/services/gfx/mw/current/src/contrib/pacific/mwin-pcn.prj new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/pacific/mwin-pcn.prj @@ -0,0 +1,105 @@ +;Project file: C:\DEVELOP\MICROWIN\SRC\MWIN-PCN.PRJ for Pacific C MS-DOS V7.51 + +List: Object Files Abs Auto +Entry: $(LIB)\RT86--DL.OBJ +Endlist: + +List: CPP Include Paths Abs Auto +Entry: c:\develop\microwin\src\include +Entry: $(INC) +Endlist: + +List: CPP Pre-defined Symbols Abs Auto +Entry: -DDOS +Entry: -D_HOSTED +Entry: -Di8086 +Entry: -D__PACIFIC__ +Entry: -DHI_TECH_C +Entry: -DLARGE_CODE +Entry: -SP4,4,4,4,4,4,4 +Entry: -S1,2,2,4,4,8 +Entry: -DLARGE_DATA +Entry: -DLARGE_MODEL +Entry: -DERASEMOVE=1 +Entry: -DMSDOS=1 +Entry: -DNONETWORK=1 +Endlist: + +List: Source Files Abs Auto +Entry: C:\DEVELOP\MICROWIN\SRC\DEMOS\NANOX\DEMO.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\KBD_PAC.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\MOU_DOS.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\INT10_PC.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\ROMFONT.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\SCR_BIOS.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\VGAPLAN4.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVCLIP.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVDRAW.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVKBD.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVMOUSE.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL1.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL2.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL4.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL8.C +Entry: C:\DEVELOP\MICROWIN\SRC\NANOX\SRVMAIN.C +Entry: C:\DEVELOP\MICROWIN\SRC\NANOX\SRVFUNC.C +Entry: C:\DEVELOP\MICROWIN\SRC\NANOX\SRVUTIL.C +Entry: C:\DEVELOP\MICROWIN\SRC\NANOX\SRVEVENT.C +Entry: C:\DEVELOP\MICROWIN\SRC\NANOX\STUBS.C +Endlist: + +List: Libraries Abs Auto +Entry: $(LIB)\86--DLF.LIB +Entry: $(LIB)\86--DLC.LIB +Endlist: + +List: Linker options Abs Auto +Entry: -lm +Entry: -p_TEXT,text,CODE=0/,LDATA=0/,LBSS=0/,NVRAM=0/,data=0/,bss,stack=0/ +Endlist: + +List: Objtohex options Abs Auto +Entry: -lDos_hdr +Entry: -E02048h +Endlist: + + +Int: OuputFormat: 0 +Int: Warnlevel: 0 +Int: IdLength: 31 +Int: DebugBaud: 0 +Int: ComPort: 0 +Int: GlobOptLevel: 1 +Int: Rom_addr: 1015808 +Int: Init_addr: 1048560 +Int: Bss_addr: 256 +Int: Bss_size: 32512 +Int: Nvram_addr: 32768 +Int: Modelno: 1 +Int: Chiptype: 1 +Int: Heapsize: 8264 +Int: Falign: 0 +Int: Jalign: 0 +Int: Lalign: 0 + +Bool: Globopt: 0 +Bool: Postopt: 0 +Bool: Assemopt: 0 +Bool: Symbolic_debug: 1 +Bool: Nolocal: 0 +Bool: Usefloat: 1 +Bool: Autoload: 0 +Bool: Cppasm: 0 +Bool: Genlist: 0 +Bool: GenSrclist: 0 +Bool: Gotadrs: 1 +Bool: Multirom: 0 +Bool: Stopwarn: 0 +Bool: Hardfloat: 0 +Bool: Wildcards: 0 +Bool: I80188eb: 0 +Bool: V25: 0 + +String: Outfile:C:\DEVELOP\MICROWIN\SRC\MWIN-PCN.EXE +String: Mapfile: +String: Symfile: diff --git a/packages/services/gfx/mw/current/src/contrib/pacific/mwin-pct.prj b/packages/services/gfx/mw/current/src/contrib/pacific/mwin-pct.prj new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/pacific/mwin-pct.prj @@ -0,0 +1,97 @@ +;Project file: C:\DEVELOP\MICROWIN\SRC\MWIN-PCT.PRJ for Pacific C MS-DOS V7.51 + +List: Object Files Abs Auto +Entry: $(LIB)\RT86--DL.OBJ +Endlist: + +List: CPP Include Paths Abs Auto +Entry: c:\develop\microwin\src\include +Entry: $(INC) +Endlist: + +List: CPP Pre-defined Symbols Abs Auto +Entry: -DDOS +Entry: -D_HOSTED +Entry: -Di8086 +Entry: -D__PACIFIC__ +Entry: -DHI_TECH_C +Entry: -DLARGE_CODE +Entry: -SP4,4,4,4,4,4,4 +Entry: -S1,2,2,4,4,8 +Entry: -DLARGE_DATA +Entry: -DLARGE_MODEL +Entry: -DERASEMOVE=1 +Entry: -DMSDOS=1 +Endlist: + +List: Source Files Abs Auto +Entry: C:\DEVELOP\MICROWIN\SRC\DEMOS\TEST\TEST.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\KBD_PAC.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\MOU_DOS.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\INT10_PC.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\ROMFONT.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\SCR_BIOS.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\VGAPLAN4.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVCLIP.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVDRAW.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVKBD.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVMOUSE.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL1.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL2.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL4.C +Endlist: + +List: Libraries Abs Auto +Entry: $(LIB)\86--DLC.LIB +Endlist: + +List: Linker options Abs Auto +Entry: -lm +Entry: -p_TEXT,text,CODE=0/,LDATA=0/,LBSS=0/,NVRAM=0/,data=0/,bss,stack=0/ +Endlist: + +List: Objtohex options Abs Auto +Entry: -lDos_hdr +Entry: -E02048h +Endlist: + + +Int: OuputFormat: 0 +Int: Warnlevel: 20 +Int: IdLength: 31 +Int: DebugBaud: 0 +Int: ComPort: 0 +Int: GlobOptLevel: 1 +Int: Rom_addr: 1015808 +Int: Init_addr: 1048560 +Int: Bss_addr: 256 +Int: Bss_size: 32512 +Int: Nvram_addr: 32768 +Int: Modelno: 1 +Int: Chiptype: 1 +Int: Heapsize: 8264 +Int: Falign: 0 +Int: Jalign: 0 +Int: Lalign: 0 + +Bool: Globopt: 0 +Bool: Postopt: 0 +Bool: Assemopt: 0 +Bool: Symbolic_debug: 1 +Bool: Nolocal: 0 +Bool: Usefloat: 0 +Bool: Autoload: 0 +Bool: Cppasm: 0 +Bool: Genlist: 0 +Bool: GenSrclist: 0 +Bool: Gotadrs: 1 +Bool: Multirom: 0 +Bool: Stopwarn: 0 +Bool: Hardfloat: 0 +Bool: Wildcards: 0 +Bool: I80188eb: 0 +Bool: V25: 0 + +String: Outfile:C:\DEVELOP\MICROWIN\SRC\MWIN-PCT.EXE +String: Mapfile: +String: Symfile: diff --git a/packages/services/gfx/mw/current/src/contrib/pacific/mwin-pcw.prj b/packages/services/gfx/mw/current/src/contrib/pacific/mwin-pcw.prj new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/pacific/mwin-pcw.prj @@ -0,0 +1,113 @@ +;Project file: MWIN-PCW.PRJ for Pacific C MS-DOS V7.51 + +List: Object Files Abs Auto +Entry: $(LIB)\RT86--DL.OBJ +Endlist: + +List: CPP Include Paths Abs Auto +Entry: c:\develop\microwin\src\include +Entry: $(INC) +Endlist: + +List: CPP Pre-defined Symbols Abs Auto +Entry: -DDOS +Entry: -D_HOSTED +Entry: -Di8086 +Entry: -D__PACIFIC__ +Entry: -DHI_TECH_C +Entry: -DLARGE_CODE +Entry: -SP4,4,4,4,4,4,4 +Entry: -S1,2,2,4,4,8 +Entry: -DLARGE_DATA +Entry: -DLARGE_MODEL +Entry: -DERASEMOVE=1 +Entry: -DMSDOS=1 +Endlist: + +List: Source Files Abs Auto +Entry: C:\DEVELOP\MICROWIN\SRC\DEMOS\MWIN\DEMO.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\KBD_PAC.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\MOU_DOS.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\INT10_PC.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\ROMFONT.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\SCR_BIOS.C +Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\VGAPLAN4.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVCLIP.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVDRAW.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVKBD.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVMOUSE.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL1.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL2.C +Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL4.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINMAIN.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINUSER.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINGDI.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINEXPOS.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINCLIP.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINEVENT.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINDEFW.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\LIST.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\DRAW3D.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\FASTFILL.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\GRAPH3D.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\INSETR.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\PTINSID.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\BUTTON.C +Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\BMP\CS1.C +Endlist: + +List: Libraries Abs Auto +Entry: $(LIB)\86--DLF.LIB +Entry: $(LIB)\86--DLC.LIB +Endlist: + +List: Linker options Abs Auto +Entry: -lm +Entry: -p_TEXT,text,CODE=0/,LDATA=0/,LBSS=0/,NVRAM=0/,data=0/,bss,stack=0/ +Endlist: + +List: Objtohex options Abs Auto +Entry: -lDos_hdr +Entry: -E02048h +Endlist: + + +Int: OuputFormat: 0 +Int: Warnlevel: 0 +Int: IdLength: 31 +Int: DebugBaud: 0 +Int: ComPort: 0 +Int: GlobOptLevel: 1 +Int: Rom_addr: 1015808 +Int: Init_addr: 1048560 +Int: Bss_addr: 256 +Int: Bss_size: 32512 +Int: Nvram_addr: 32768 +Int: Modelno: 1 +Int: Chiptype: 1 +Int: Heapsize: 8264 +Int: Falign: 0 +Int: Jalign: 0 +Int: Lalign: 0 + +Bool: Globopt: 0 +Bool: Postopt: 0 +Bool: Assemopt: 0 +Bool: Symbolic_debug: 1 +Bool: Nolocal: 0 +Bool: Usefloat: 1 +Bool: Autoload: 0 +Bool: Cppasm: 0 +Bool: Genlist: 0 +Bool: GenSrclist: 0 +Bool: Gotadrs: 1 +Bool: Multirom: 0 +Bool: Stopwarn: 0 +Bool: Hardfloat: 0 +Bool: Wildcards: 0 +Bool: I80188eb: 0 +Bool: V25: 0 + +String: Outfile:C:\DEVELOP\MICROWIN\SRC\MWIN-PCW.EXE +String: Mapfile: +String: Symfile: diff --git a/packages/services/gfx/mw/current/src/contrib/pacific/readme.pc b/packages/services/gfx/mw/current/src/contrib/pacific/readme.pc new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/pacific/readme.pc @@ -0,0 +1,41 @@ +For compile Microwindows for DOS & PACIFIC C you should have the following: +===================================================================== +1. Microwin 0.87 pre6 - microwindows.censoft.com +2. PACIFIC C ver. 7.51 - www.hitech.com or www.freedos.org + +You should do the following: +---------------------------- + +- EDIT files *.prj to correct paths +- copy microwin\src\contrib\pacific\mwin-pct.prj microwin\src\mwin-pct.prj +- copy microwin\src\contrib\pacific\mwin-pcw.prj microwin\src\mwin-pcw.prj +- copy microwin\src\contrib\pacific\mwin-pcn.prj microwin\src\mwin-pcn.prj + +- you should check the next: + options | memory model.. | memory model = (*) Large L + options | heap size | = 2048 + options | output file type | (*) MS-DOS Executable Type + make | CPP predifined symbols | -DERASEMOVE=1 -DMSDOS=1 -DNONETWORK=1 + make | CPP include paths | c:\develop\microwin\src\include + +RUN ppd, load project and compile ! + +===================================================================== + +For NANOXDEMO use -DNONETWORK=1 + +- mwin-pct.prj = test demo +- mwin-pcw.prj = mwin demo +- mwin-pcn.prj = nanox demo + +! NOT all demos have been tested. + +===================================================================== +TO COMPILE with PACIFIC C : + +You === SHOULD == check to include header's files only ONE time. +PACIFIC C doesn't check it. +If you do include, PACIFIC C may gives quite strange errors. + +===================================================================== +Victor Rogachev diff --git a/packages/services/gfx/mw/current/src/contrib/ptyfix2.txt b/packages/services/gfx/mw/current/src/contrib/ptyfix2.txt new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/ptyfix2.txt @@ -0,0 +1,86 @@ + +--- demos/microwin/mterm.c.old Fri Dec 3 07:03:39 1999 ++++ demos/microwin/mterm.c Fri Dec 3 07:16:23 1999 +@@ -248,15 +248,16 @@ + char * argv[2]; + + again: +- sprintf(pty_name, "/dev/ptyp%d", n); +- if ((tfd = open(pty_name, O_RDWR | O_NONBLOCK)) < 0) { +- if ((errno == EBUSY) && (n < 3)) { +- ++n; +- goto again; +- } +- fprintf(stderr, "Can't create pty %s\n", pty_name); ++ if ((tfd = getpt())<0) { ++ fprintf(stderr, "Can't create master pty\n"); + return -1; + } ++ ++ if (grantpt(tfd)) ++ perror("failure"); ++ if (unlockpt(tfd)) ++ perror("failure"); ++ + signal(SIGCHLD, ptysignaled); + signal(SIGINT, ptysignaled); + if ((pid = fork()) == -1) { +@@ -264,13 +265,13 @@ + return -1; + } + if (!pid) { ++ ptsname_r(tfd, pty_name, 12); + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); + close(tfd); + + setsid(); +- pty_name[5] = 't'; + if ((tfd = open(pty_name, O_RDWR)) < 0) { + fprintf(stderr, "Child: Can't open pty %s\n", pty_name); + exit(1); +--- demos/nanox/nterm.c.old Fri Dec 3 07:03:39 1999 ++++ demos/nanox/nterm.c Fri Dec 3 07:16:20 1999 +@@ -162,15 +162,16 @@ + pid_t pid; + + again: +- sprintf(pty_name, "/dev/ptyp%d", n); +- if ((tfd = open(pty_name, O_RDWR | O_NONBLOCK)) < 0) { +- if ((errno == EBUSY || errno == EIO) && n < 10) { +- n++; +- goto again; +- } +- fprintf(stderr, "Can't create pty %s\n", pty_name); ++ if ((tfd = getpt())<0) { ++ fprintf(stderr, "Can't create master pty\n"); + return -1; + } ++ ++ if (grantpt(tfd)) ++ perror("failure"); ++ if (unlockpt(tfd)) ++ perror("failure"); ++ + signal(SIGCHLD, sigchild); + signal(SIGINT, sigchild); + if ((pid = fork()) == -1) { +@@ -178,13 +179,13 @@ + return -1; + } + if (!pid) { ++ ptsname_r(tfd, pty_name, 12); + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); + close(tfd); + + setsid(); +- pty_name[5] = 't'; + if ((tfd = open(pty_name, O_RDWR)) < 0) { + fprintf(stderr, "Child: Can't open pty %s\n", pty_name); + exit(1); + + +-- \ No newline at end of file diff --git a/packages/services/gfx/mw/current/src/contrib/readme.tc b/packages/services/gfx/mw/current/src/contrib/readme.tc new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/readme.tc @@ -0,0 +1,102 @@ +For compile Microwindows for DOS & TURBO C +you should have the following: +==================================================== +1. Microwin 0.87 - microwindows.censoft.com +2. Turbo C++ ver. 1.0 or Borland C ver. 3.1 + + +You should do the following: +---------------------------- + +- copy mwin-tcn.prj to microwin\src\ +- copy mwin-tcw.prj to microwin\src\ + +- run tc or bc IDE +- load the project + + +You should check the next: +------------------------- + +- correct paths +- settings defines in : + options | compiler | code generation - defines : + + ERASEMOVE=1; + MSDOS=1; + DOS_TURBOC=1; + + +MAKE ! +==================================================== + +- mwin-pcw.prj = mwin demo +- mwin-pcn.prj = nanox demo + +For nanox add next defines: + NONETWORK=1; + SCREEN_PIXTYPE=PF_PALETTE; + + +! NOT all demos have been tested. +==================================================== + +The project for mwin demo must have next files: + +\DEMOS\MWIN\DEMO.C +\DRIVERS\GENFONT.C +\DRIVERS\KBD_TC.C +\DRIVERS\MOU_DOS.C +\DRIVERS\SCR_TC.C +\FONTS\ROM8X16.C +\FONTS\ROM8X8.C +\FONTS\WINFRE~1.C +\FONTS\WINFRE~2.C +\ENGINE\DEVCLIP.C +\ENGINE\DEVDRAW.C +\ENGINE\DEVKBD.C +\ENGINE\DEVMOUSE.C +\ENGINE\DEVPAL1.C +\ENGINE\DEVPAL2.C +\ENGINE\DEVPAL4.C +\MWIN\WINCLIP.C +\MWIN\WINDEFW.C +\MWIN\WINEVENT.C +\MWIN\WINEXPOS.C +\MWIN\WINMAIN.C +\MWIN\WINUSER.C +\MWIN\WINGDI.C +\MWIN\LIST.C +\MWIN\WINLIB\BUTTON.C +\MWIN\WINLIB\DRAW3D.C +\MWIN\WINLIB\FASTFILL.C +\MWIN\WINLIB\GRAPH3D.C +\MWIN\WINLIB\INSETR.C +\MWIN\WINLIB\PTINSID.C +\MWIN\BMP\CS1.C + +The project for nanox demo must have next files: + +\DEMOS\NANOX\DEMO.C +\DRIVERS\GENFONT.C +\DRIVERS\KBD_TC.C +\DRIVERS\MOU_DOS.C +\DRIVERS\SCR_TC.C +\FONTS\ROM8X16.C +\FONTS\ROM8X8.C +\FONTS\WINFRE~1.C +\ENGINE\DEVCLIP.C +\ENGINE\DEVDRAW.C +\ENGINE\DEVKBD.C +\ENGINE\DEVMOUSE.C +\ENGINE\DEVPAL1.C +\ENGINE\DEVPAL2.C +\ENGINE\DEVPAL4.C +\NANOX\SRVEVENT.C +\NANOX\SRVFUNC.C +\NANOX\SRVMAIN.C +\NANOX\SRVUTIL.C +\NANOX\STUBS.C + +==================================================== +Victor Rogachev diff --git a/packages/services/gfx/mw/current/src/contrib/speedtst/Makefile b/packages/services/gfx/mw/current/src/contrib/speedtst/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/speedtst/Makefile @@ -0,0 +1,18 @@ +CC = gcc + +all: speed xspeed + +speed.o : speed.c + $(CC) -DX11=1 -c $< + +speed: speed.o + $(CC) -DX11=1 $< -o $@ \ + -lnano-X -lmwengine -lmwfonts -lmwdrivers \ + -L/usr/X11R6/lib -lX11 + +xspeed.o : speed.c + $(CC) -DTEST_FOR_X=1 -c $< -o $@ + +xspeed: xspeed.o + $(CC) -DTEST_FOR_X=1 $< -o $@ \ + -L/usr/X11R6/lib -lX11 diff --git a/packages/services/gfx/mw/current/src/contrib/speedtst/speed.c b/packages/services/gfx/mw/current/src/contrib/speedtst/speed.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/speedtst/speed.c @@ -0,0 +1,292 @@ +#include +#include +#include + +#ifdef TEST_FOR_X +#include +#else +#define MWINCLUDECOLORS +#include +#endif + +#define NUM_POINTS 80 + +time_t start_time, end_time; + +void start_timer() +{ + time(&start_time); +} + +void end_timer() +{ + time(&end_time); + printf("start=%lu, end=%lu, time=%lu\n", + start_time, end_time, end_time-start_time); +} + +int main() +{ +#ifdef TEST_FOR_X + Display *display; + Window window; + GC gc; + XGCValues gcValues; + Colormap colormap; + Pixmap src_pixmap; + unsigned long fgColor, bgColor; + int screenNum; + XPoint points[NUM_POINTS]; +#else + GR_WINDOW_ID window; + GR_WINDOW_ID src_pixmap; + unsigned char* src_pixmap_buf[320*240*2]; + GR_GC_ID gc; + GR_POINT points[NUM_POINTS]; +#endif + + int c, c1, count=4500; + int x, y, x1, y1, x2, y2; + +#ifdef TEST_FOR_X + if(!(display=XOpenDisplay(""))) { + printf("Cannot connect to X.\n"); + } + screenNum = DefaultScreen(display); + colormap = DefaultColormap(display, screenNum); + + bgColor = BlackPixel(display, screenNum); + fgColor = WhitePixel(display, screenNum); + window = XCreateSimpleWindow(display, RootWindow(display, screenNum), + 0, 0 , 639, 479, 0, + fgColor, bgColor); + src_pixmap = XCreatePixmap(display, window, 320, 240, 16); + XMapRaised(display, window); + gcValues.background = bgColor; + gcValues.foreground = fgColor; + gcValues.line_width = 1; + gcValues.line_style = LineSolid; + gcValues.fill_style = FillSolid; + gcValues.fill_rule = WindingRule; + gcValues.arc_mode = ArcPieSlice; + gc = XCreateGC(display, window, + GCForeground | GCBackground | GCLineWidth | GCLineStyle | + GCFillStyle, + &gcValues); + +#else + GrOpen(); + window = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, 639, 479, 0, BLACK, BLUE); + src_pixmap = GrNewPixmap(640, 480, src_pixmap_buf); + GrMapWindow(window); + gc = GrNewGC(); + GrSetGCForeground(gc, WHITE); + GrSetGCBackground(gc, BLACK); + GrSetGCMode(gc, GR_MODE_COPY); +#endif + + + + + + // Horizontal Line + //////////////////////////////////////////////// + printf("Horizontal Line(XDrawLine)\n"); + start_timer(); + for(c=0; ce256+W^hc>%&w_9a}5ZRAZG#x@ueWa-(wpsi1`F;vvGW!YA+C0CMJn#6$= z0trh(O1h;BB|s>UK+{s1HfhuTXvxwhP1~fum`pOAY5#PFHf?{D^!1!4*=T$6BWS`* zhBM5kd(S=Re)nG8bMHMe-qA>Jm|2-S6233skFmDkP=GB2)wEgjR0{!$%SBc!rw}o-$~^+5k>JWN%MQD{I;b3gM@!XEQEIu*TXfe!#@cAN$??p>R(j) zH^F}h{!4HjLH!Xz!T+c#5`YSgRRo0ypeE1|Xh~Ouu%H;BuLOaWQo|I2sRYx=l}i)RGmjKpI`yOLV`sEi^*gOmF`9;TuN0&)fyGee{%uWw-Ib1 z_#A^f-e$82%-crf>DC) z1Um?J66_-Q62bih4-gz7c#vR>;30zD1bYY`CipVJUV?oDj}Yu9I6&|y!D9pm2@Vk) zCU~6S34)^pPZHF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X_&Z0VO$;$(@tQ)68h`Nz)) z$uu6WB1K)s?I}`RW!&E)MO4NMLcEl2OK%vFqA2qfB~k#TKjdVmZSmkJy*XFUYqRsM zWI@rF@fsB=zB1m!B1Klli(ITq*GluCh)K&z(sfc+Bs;`*!Q$S)Tcz)pLM$V7ll7z| z5}hc_S zMt8PR9=1^(a0z|{KZF;8{2gr{E+!11I2na2&o1-+^z#x8P~`CVT_F4qt<>!c%Yzz5-9eQFsC# zha+$p4#7cq3?9X6Xg@px`(Us1+uAM3x@n~)hH4fK#Mt&=Um(ne!+il(Z9sJ-Fc8%b z>U)M*3p4ICt!z%x4N5wrk#xaOtf@iQ$=f(rH}CY;vP!Z_d{mLeF0?kqjZ4C#G5U#G zhu$mw^|j2*YS?g3bQ`NC5~GnE7-J)&v8b->@bS~<&%A$%ojrH_#F@W-!1Q{385t}O zhWtaLIMB8J*shU)esG-vCnW|u2I)WS=z4?U=(fNvovDho;6#;r<3je2hWxQ$IK+%B z5{QjPLQxhQ3^42rKYL;<7-c(pg0Wy|Kw4x&wd6?6Eo_{1f-izg+pjCD=<|ijYRQNi zDwZ4Tcc!&7CTT11(?4#T0G)rZCsH-;oa{v&$sJGDCe8lHh4)UKJaz8OdG_4#)5qWc z;O|+NIqSd`a(nzep*nvU=hQ;8GRN(7v_zG-Mf&@3kEFR+JXW5Ue6qS2js5-UE=SLt OKk@vzTMQn`Gyf0B%z9-2 diff --git a/packages/services/gfx/mw/current/src/contrib/turboc/MWIN-TCW.PRJ b/packages/services/gfx/mw/current/src/contrib/turboc/MWIN-TCW.PRJ new file mode 100644 index 0000000000000000000000000000000000000000..434a7ba195b4278741f1b62dc58d363c406d5a9a GIT binary patch literal 18340 zc%1EAeRNah8Gmltq)8fRDWy=#$5jgrAT2FWN^1>ia?_?HxiR;)DG;a@D#DPDQgQ0m zFei#%h-_!`?2nxt=H}TsJIC!0=k!cvI+=hKP-GjZb04}no%36V%Dd-zlcqOcO^Q{| zBu{#OJomY8-rxH?_r1^ik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&d=u#4S^XR3DR5#r2|5#5H4*O%wQ>|L3*;=dp{!8=!tL06uBjx0u0$Ih1;a6h?OpqtjaVDR);3{Fk1wynn#d*sn(V^1=GXmT!w7oFY&=OZs##jriR4qsx}9qteJ zhOdtPj0J@K;lA*e@J6()4fhZIs0H+6$-$wQ5^zB5OkB5N`_@fYTqpAH-oTa9W(|fl zFCICqWpA~3(C)Ab<&poAiG4B>YjIaon{{6?M#}E-x7o=~)}M;Is}wBjRi%KJj68mo z^IcYxiCg(MUPNB@*dn{tU4&Np%7}};TOn%hKy@|UtLUA5I6U-vreM&v%67JKwQX?J xFVW_=_1U)AHrje^Yi<3uMznZsL7Us=v(2}uHV5kBsB5jY4Sud&oc@#X{{V_1$Aka? diff --git a/packages/services/gfx/mw/current/src/contrib/turboc/readme.tc b/packages/services/gfx/mw/current/src/contrib/turboc/readme.tc new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/contrib/turboc/readme.tc @@ -0,0 +1,102 @@ +For compile Microwindows for DOS & TURBO C +you should have the following: +==================================================== +1. Microwin 0.87 - microwindows.censoft.com +2. Turbo C++ ver. 1.0 or Borland C ver. 3.1 + + +You should do the following: +---------------------------- + +- copy mwin-tcn.prj to microwin\src\ +- copy mwin-tcw.prj to microwin\src\ + +- run tc or bc IDE +- load the project + + +You should check the next: +------------------------- + +- correct paths +- settings defines in : + options | compiler | code generation - defines : + + ERASEMOVE=1; + MSDOS=1; + DOS_TURBOC=1; + + +MAKE ! +==================================================== + +- mwin-pcw.prj = mwin demo +- mwin-pcn.prj = nanox demo + +For nanox add next defines: + NONETWORK=1; + SCREEN_PIXTYPE=PF_PALETTE; + + +! NOT all demos have been tested. +==================================================== + +The project for mwin demo must have next files: + +\DEMOS\MWIN\DEMO.C +\DRIVERS\GENFONT.C +\DRIVERS\KBD_TC.C +\DRIVERS\MOU_DOS.C +\DRIVERS\SCR_TC.C +\FONTS\ROM8X16.C +\FONTS\ROM8X8.C +\FONTS\WINFRE~1.C +\FONTS\WINFRE~2.C +\ENGINE\DEVCLIP.C +\ENGINE\DEVDRAW.C +\ENGINE\DEVKBD.C +\ENGINE\DEVMOUSE.C +\ENGINE\DEVPAL1.C +\ENGINE\DEVPAL2.C +\ENGINE\DEVPAL4.C +\MWIN\WINCLIP.C +\MWIN\WINDEFW.C +\MWIN\WINEVENT.C +\MWIN\WINEXPOS.C +\MWIN\WINMAIN.C +\MWIN\WINUSER.C +\MWIN\WINGDI.C +\MWIN\LIST.C +\MWIN\WINLIB\BUTTON.C +\MWIN\WINLIB\DRAW3D.C +\MWIN\WINLIB\FASTFILL.C +\MWIN\WINLIB\GRAPH3D.C +\MWIN\WINLIB\INSETR.C +\MWIN\WINLIB\PTINSID.C +\MWIN\BMP\CS1.C + +The project for nanox demo must have next files: + +\DEMOS\NANOX\DEMO.C +\DRIVERS\GENFONT.C +\DRIVERS\KBD_TC.C +\DRIVERS\MOU_DOS.C +\DRIVERS\SCR_TC.C +\FONTS\ROM8X16.C +\FONTS\ROM8X8.C +\FONTS\WINFRE~1.C +\ENGINE\DEVCLIP.C +\ENGINE\DEVDRAW.C +\ENGINE\DEVKBD.C +\ENGINE\DEVMOUSE.C +\ENGINE\DEVPAL1.C +\ENGINE\DEVPAL2.C +\ENGINE\DEVPAL4.C +\NANOX\SRVEVENT.C +\NANOX\SRVFUNC.C +\NANOX\SRVMAIN.C +\NANOX\SRVUTIL.C +\NANOX\STUBS.C + +==================================================== +Victor Rogachev diff --git a/packages/services/gfx/mw/current/src/demo.sh b/packages/services/gfx/mw/current/src/demo.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demo.sh @@ -0,0 +1,1 @@ +bin/nano-X $1 & bin/nanowm & bin/world diff --git a/packages/services/gfx/mw/current/src/demo2.sh b/packages/services/gfx/mw/current/src/demo2.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demo2.sh @@ -0,0 +1,1 @@ +bin/nano-X -p & bin/demo2; sleep 10000 diff --git a/packages/services/gfx/mw/current/src/demo22.sh b/packages/services/gfx/mw/current/src/demo22.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demo22.sh @@ -0,0 +1,1 @@ +bin/nano-X & bin/nanowm & bin/demo2 & bin/demo2 & sleep 10000 diff --git a/packages/services/gfx/mw/current/src/demo4.sh b/packages/services/gfx/mw/current/src/demo4.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demo4.sh @@ -0,0 +1,1 @@ +bin/nano-X -e & bin/nxterm & bin/nanowm & sleep 10000 diff --git a/packages/services/gfx/mw/current/src/demos/Makefile b/packages/services/gfx/mw/current/src/demos/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/Makefile @@ -0,0 +1,46 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000, 2002 Martin Jolicoeur, Greg Haerr +############################################################################## + +ifndef TOP +TOP = .. +CONFIG = $(TOP)/config +endif + +include $(CONFIG) + +VPATH := $(TOP)/demos + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += +# Defines for preprocessor +DEFINES += + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +# If you want to create a library with the objects files, define the name here +LIBNAME = + +# List of objects to compile +OBJS = + +#ifeq ($(ARCH), ECOS) +#dirs = nanowm nanox nxkbd nxscribble +#endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### + diff --git a/packages/services/gfx/mw/current/src/demos/mwin/Makefile b/packages/services/gfx/mw/current/src/demos/mwin/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/Makefile @@ -0,0 +1,77 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr +############################################################################## + +include $(CONFIG) + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += +# Defines for preprocessor +DEFINES += + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +ifeq ($(MICROWIN), Y) +ifeq ($(MICROWINDEMO), Y) + +# If you want to create a library with the objects files, define the name here +LIBNAME = + +# List of objects to compile +OBJS = mdemo.o mterm.o malpha.o mtest.o mine.o mtest2.o +MINEIMAGES = mineflag.o mineface.o minefacelost.o minebomb.o minedone.o\ + minehitfalse.o + +DEMOS = $(TOP)/bin/mdemo\ + $(TOP)/bin/mterm\ + $(TOP)/bin/malpha\ + $(TOP)/bin/mtest\ + $(TOP)/bin/mtest2\ + $(TOP)/bin/mine + +ifneq ($(ARCH), ELKS) +DEMOS += $(TOP)/bin/muserfd +endif + +all: default $(DEMOS) + +endif +endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### + +$(TOP)/bin/mdemo: mdemo.o $(MWINLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) mdemo.o -o $@ $(CCMWINLIBS) + +$(TOP)/bin/mterm: mterm.o $(MWINLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) mterm.o -o $@ $(CCMWINLIBS) + +$(TOP)/bin/malpha: malpha.o $(MWINLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) malpha.o -o $@ $(CCMWINLIBS) + +$(TOP)/bin/mtest: mtest.o $(MWINLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) mtest.o -o $@ $(CCMWINLIBS) + +$(TOP)/bin/mtest2: mtest2.o $(MWINLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) mtest2.o -o $@ $(CCMWINLIBS) + +$(TOP)/bin/mine: mine.o $(MINEIMAGES) $(MWINLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) mine.o $(MINEIMAGES) -o $@ $(CCMWINLIBS) + +$(TOP)/bin/muserfd: muserfd.o $(MWINLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) muserfd.o -o $@ $(CCMWINLIBS) + diff --git a/packages/services/gfx/mw/current/src/demos/mwin/malpha.c b/packages/services/gfx/mw/current/src/demos/mwin/malpha.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/malpha.c @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2000 Greg Haerr + * + * Microwindows alpha blending demo + * + * This demo requires UPDATEREGIONS=N in microwin/src/config + */ +#include "windows.h" +#include "wintern.h" /* for MwSetDesktopWallpaper*/ +#include "wintools.h" + +extern MWIMAGEHDR image_car8; + +#define APPCLASS "test" + +/* forward decls*/ +LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp); +LRESULT CALLBACK ChildWndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp); + +int +RegisterAppClass(void) +{ + WNDCLASS wc; + + wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW; + wc.lpfnWndProc = (WNDPROC)WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = 0; + wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/ + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = APPCLASS; + RegisterClass( &wc); + + return 1; +} + +HWND +CreateAppWindow(void) +{ + HWND hwnd; + int width, height; + RECT r; + static int nextid = 0; + + GetWindowRect(GetDesktopWindow(), &r); + width = height = r.right / 2; + + hwnd = CreateWindowEx(WS_EX_LAYERED, APPCLASS, + "Microwindows Alpha Blending", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, + width, height, + NULL, (HMENU)++nextid, NULL, NULL); + + return hwnd; +} + +LRESULT CALLBACK +WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + PAINTSTRUCT ps; + HWND sibwp; + HDC hdcMem; + HBITMAP hbmp, hbmpOrg; + HBRUSH hbr; + RECT rc; + extern int mwpaintSerial; + + switch(msg) { + case WM_ERASEBKGND: + /* don't erase with screen dc, must alpha blend bkgnd*/ + return 1; + + case WM_PAINT: + /* NOTE: this routine needs to be generalized + * for arbitrary deep child relationships and + * moved into the Microwindows kernel. In addition, + * the lower window repainting needs to occur + * offscreen and alpha blended offscreen with + * a final blit to the device screen. + */ + /* force NC painting - current NC regions don't work + * with this alpha blend algorithm + */ + mwforceNCpaint = TRUE; + + /* repaint lower windows before alpha blending this window*/ + ++hwnd->unmapcount; /* tricky don't clip this window*/ + SendMessage(rootwp, WM_PAINT, 0, 0); + for(sibwp=hwnd->siblings; sibwp; sibwp=sibwp->siblings) + SendMessage(sibwp, WM_PAINT, 0, 0); + --hwnd->unmapcount; + + /* then queue repaint for higher windows*/ + for(sibwp=hwnd->parent->children; sibwp != hwnd; + sibwp=sibwp->siblings) + /* don't paint if already painted by above code*/ + if(sibwp->paintSerial != mwpaintSerial) + PostMessage(sibwp, WM_PAINT, 0, 0); + + /* now paint this window offscreen and blend with screen*/ + BeginPaint(hwnd, &ps); + GetClientRect(hwnd, &rc); + + /* redirect painting to offscreen dc*/ + hdcMem = CreateCompatibleDC(ps.hdc); + hbmp = CreateCompatibleBitmap(hdcMem, rc.right, rc.bottom); + hbmpOrg = SelectObject(hdcMem, hbmp); + + /* paint window to offscreen*/ + hbr = (HBRUSH)GetClassLong(hwnd, GCL_HBRBACKGROUND); + FillRect(hdcMem, &rc, hbr); + SelectObject(hdcMem, GetStockObject(DEFAULT_GUI_FONT)); + SetBkMode(hdcMem, TRANSPARENT); +#define TEXTSTRING "This demonstrates alpha blending" + TextOut(hdcMem, 0, 20, TEXTSTRING, strlen(TEXTSTRING)); + + /* alpha blend blit offscreen map with physical screen*/ + BitBlt(ps.hdc, 0, 0, rc.right, rc.bottom, hdcMem, 0, 0, + MWROP_BLENDCONSTANT | 150); + DeleteObject(SelectObject(hdcMem, hbmpOrg)); + DeleteDC(hdcMem); + + EndPaint(hwnd, &ps); + break; + + default: + return DefWindowProc( hwnd, msg, wp, lp); + } + return( 0); +} + +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nShowCmd) +{ + MSG msg; + + /* Force XORMOVE window redraw algorithm, required + * for this version of alpha blend painting + */ + mwERASEMOVE = FALSE; + + RegisterAppClass(); + + /* set background wallpaper*/ + MwSetDesktopWallpaper(&image_car8); + + /* must update root window until alpha blend blitting + * uses off screen memory for hidden windows, rather than + * screen memory*/ + UpdateWindow(GetDesktopWindow()); + + CreateAppWindow(); + CreateAppWindow(); + + /* type ESC to quit...*/ + while( GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/mwin/mdemo.c b/packages/services/gfx/mw/current/src/demos/mwin/mdemo.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/mdemo.c @@ -0,0 +1,488 @@ +/* + * Copyright (c) 1999, 2000, 2001 Greg Haerr + * + * Demo program for Microwindows + */ +#define MWINCLUDECOLORS +#include "windows.h" +#include "wintern.h" /* for MwSetDesktopWallpaper*/ + +#include "device.h" + +#if DOS_TURBOC +unsigned _stklen = 4096; +#endif + +#define CLIPDEMO 0 /* set for region clipping demo*/ + +#ifndef ELKS +#define TIMERDEMO 1 /* set for WM_TIMER demo*/ +#define GRAPH3D 0 /* 3d graphics demo*/ +#define IMAGE 0 /* 256 color image demo*/ +#endif +#define ARCDEMO 1 /* arc drawing demo*/ +#define CHILD 1 /* child window demo*/ +#define CLIENT3D 0 /* old client draw test*/ +#define USEBLIT 1 /* use blit rather than DrawDIB()*/ + +#if GRAPH3D +#include "graph3d.h" +#endif + +extern MWIMAGEHDR image_car8; +extern MWIMAGEHDR image_zion208; +extern MWIMAGEHDR image_penguin; +extern MWIMAGEHDR image_under4; +extern MWIMAGEHDR image_microwin; +extern MWIMAGEHDR image_cs1; +extern MWIMAGEHDR image_rle8; + +#if CHILD +#if ELKS | MSDOS +PMWIMAGEHDR image = &image_cs1; /* 2 color bitmap for 16 color systems*/ +#else +PMWIMAGEHDR image = &image_penguin; +#endif +#endif + +#if IMAGE +PMWIMAGEHDR image2 = &image_zion208; +#endif + +#define APPCLASS "test" +#define APPCHILD "test2" + +/* forward decls*/ +LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp); +LRESULT CALLBACK ChildWndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp); + +int +MwUserInit(int ac, char **av) +{ + /* test user init procedure - do nothing*/ + return 0; +} + +int +RegisterAppClass(void) +{ + WNDCLASS wc; + +#if !ELKS + MwRegisterButtonControl(NULL); + MwRegisterEditControl(NULL); + MwRegisterListboxControl(NULL); + MwRegisterProgressBarControl(NULL); + /*MwRegisterComboboxControl(NULL);*/ +#endif + wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW; + wc.lpfnWndProc = (WNDPROC)WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = 0; + wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/ + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = APPCLASS; + RegisterClass( &wc); + +#if CHILD + wc.lpfnWndProc = (WNDPROC)ChildWndProc; + wc.lpszClassName = APPCHILD; + return RegisterClass( &wc); +#endif + return 1; +} + +HWND +CreateAppWindow(void) +{ + HWND hwnd, hlist; + static int nextid = 1; + int width, height; + RECT r; + GetWindowRect(GetDesktopWindow(), &r); + width = height = r.right / 2; + + hwnd = CreateWindowEx(0L, APPCLASS, + "Microwindows Application", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, + width, height, + NULL, (HMENU)nextid++, NULL, NULL); + +#if CHILD + if(hwnd +#if GRAPH3D + && (nextid & 03)!=2 +#endif + ) { + CreateWindowEx(0L, APPCHILD, + "", + WS_BORDER | WS_CHILD | WS_VISIBLE, + 4, 4, width / 3-6, height / 3, + hwnd, (HMENU)2, NULL, NULL); + CreateWindowEx(0L, APPCHILD, + "", + WS_BORDER | WS_CHILD | WS_VISIBLE, + width / 3, height / 3, width / 3-6, height / 3, + hwnd, (HMENU)3, NULL, NULL); + CreateWindowEx(0L, APPCHILD, + "", + WS_BORDER | WS_CHILD | WS_VISIBLE, + width * 3 / 5, height * 3 / 5, + width * 2 / 3, height * 2 / 3, + hwnd, (HMENU)4, NULL, NULL); + CreateWindowEx(0L, "EDIT", + "OK", + WS_BORDER|WS_CHILD | WS_VISIBLE, + width * 5 / 8, 10, 100, 18, + hwnd, (HMENU)5, NULL, NULL); + CreateWindowEx(0L, "PROGBAR", + "OK", + WS_BORDER|WS_CHILD | WS_VISIBLE, + width * 5 / 8, 32, 100, 18, + hwnd, (HMENU)6, NULL, NULL); + + hlist = CreateWindowEx(0L, "LISTBOX", + "OK", + WS_HSCROLL|WS_VSCROLL|WS_BORDER|WS_CHILD | WS_VISIBLE, + width * 5 / 8, 54, 100, 48, + hwnd, (HMENU)7, NULL, NULL); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Cherry"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Apple"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Orange"); + + CreateWindowEx(0L, "BUTTON", + "Cancel", + BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE, + width * 5 / 8 + 50, 106, 50, 14, + hwnd, (HMENU)8, NULL, NULL); + } +#endif + return hwnd; +} + +#if CHILD +LRESULT CALLBACK +ChildWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + RECT rc; + PAINTSTRUCT ps; + + switch(msg) { + case WM_PAINT: + BeginPaint(hwnd, &ps); + GetClientRect(hwnd, &rc); +#if USEBLIT +{ + HDC hdcMem; + HBITMAP hbmp, hbmpOrg; + + /* redirect painting to offscreen dc, then use blit function*/ + hdcMem = CreateCompatibleDC(ps.hdc); + hbmp = CreateCompatibleBitmap(hdcMem, rc.right, rc.bottom); + hbmpOrg = SelectObject(hdcMem, hbmp); + + /* draw onto offscreen dc*/ + DrawDIB(hdcMem, 0, 0, image); + + /* blit offscreen with physical screen*/ + BitBlt(ps.hdc, 0, 0, rc.right, rc.bottom, hdcMem, + 0, 0, MWROP_SRCCOPY); + /*StretchBlt(ps.hdc, 0, 0, rc.right, rc.bottom, hdcMem, + 0, 0, image->width/3*5, image->height/3*4, MWROP_SRCCOPY);*/ + DeleteObject(SelectObject(hdcMem, hbmpOrg)); + DeleteDC(hdcMem); +} +#else + DrawDIB(ps.hdc, rc.left, rc.top, image); +#endif + EndPaint(hwnd, &ps); + break; + default: + return DefWindowProc( hwnd, msg, wp, lp); + } + return( 0); +} +#endif + +LRESULT CALLBACK +WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + PAINTSTRUCT ps; + HDC hdc; +#if CLIENT3D | IMAGE | GRAPH3D + RECT rc; +#endif +#if GRAPH3D + static int countup = 1; + int id; + static vec1 gx, gy; +#endif +#if TIMERDEMO + static POINT mousept; +#endif +#if ARCDEMO + static int startdegrees = 0; + static int enddegrees = 30; +#endif + + switch( msg) { +#if TIMERDEMO + case WM_CREATE: + SetTimer(hwnd, 1, 100, NULL); + mousept.x = 60; + mousept.y = 20; + break; + + case WM_TIMER: +#if GRAPH3D + GetClientRect(hwnd, &rc); + if(countup) { + mousept.y += 20; + if(mousept.y >= rc.bottom) { + mousept.y -= 20; + countup = 0; + } + } else { + mousept.y -= 20; + if(mousept.y < 20) { + mousept.y += 20; + countup = 1; + } + } + SendMessage(hwnd, WM_MOUSEMOVE, 0, + MAKELONG(mousept.x, mousept.y)); +#endif +#if ARCDEMO + startdegrees += 10; + if(startdegrees >= 360) + startdegrees = 0; + enddegrees += 15; + if(enddegrees >= 360) + enddegrees = 0; + InvalidateRect(hwnd, NULL, TRUE); +#endif + break; + + case WM_DESTROY: + KillTimer(hwnd, 1); + break; +#endif /* TIMERDEMO*/ + case WM_SIZE: + break; + + case WM_MOVE: + break; + +#if CLIENT3D + case WM_SETFOCUS: + PostMessage((HWND)wp, WM_PAINT, 0, 0L); + break; + + case WM_KILLFOCUS: + PostMessage((HWND)wp, WM_PAINT, 0, 0L); + break; + case WM_ERASEBKGND: + if(GetFocus() != hwnd) + return DefWindowProc(hwnd, msg, wp, lp); + return 1; +#endif +#if GRAPH3D + case WM_ERASEBKGND: + if((GetWindowLong(hwnd, GWL_ID) & 03) == 1) + return 1; + return DefWindowProc(hwnd, msg, wp, lp); +#endif + case WM_PAINT: + hdc = BeginPaint(hwnd, &ps); + +#if CLIENT3D + if(GetFocus() == hwnd) { + GetClientRect(hwnd, &rc); + Draw3dShadow(hdc, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_3DDKSHADOW), + GetSysColor(COLOR_3DLIGHT)); + InflateRect(&rc, -1, -1); + FillRect(hdc, &rc, GetStockObject(GRAY_BRUSH)); + } +#endif +#if IMAGE + GetClientRect(hwnd, &rc); + DrawDIB(hdc, rc.left+2, rc.top+2, image2); +#endif +#if ARCDEMO +{ + int x, y, w, h; + RECT rc; + + if(hdc != NULL) { + GetWindowRect(hwnd, &rc); + rc.top += 13; + InflateRect(&rc, -3, -3); + /*Ellipse(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top);*/ + /*Arc(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top, 0,0, 0,0);*/ + /*Pie(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top, 0,0, 0,0);*/ + + x = rc.left; + y = rc.top; + w = rc.right - rc.left; + h = rc.bottom - rc.top; + w += 10; + GdSetForeground(GdFindColor(RGB(0,255,0))); + GdArcAngle(hdc->psd, x+w/2, y+h/2, w/2, h/2, startdegrees*64, + enddegrees*64, MWPIE); + GdSetForeground(GdFindColor(RGB(0,0,0))); + GdArcAngle(hdc->psd, x+w/2, y+h/2, w/2, h/2, startdegrees*64, + enddegrees*64, MWARCOUTLINE); + /*GdSetForeground(GdFindColor(RGB(255,255,255)));*/ + /*GdPoint(hdc->psd, x+w/2, y+h/2);*/ + } + EndPaint(hwnd, &ps); + break; +} +#endif /* ARCDEMO*/ +#if GRAPH3D + id = (int)GetWindowLong(hwnd, GWL_ID) & 03; + init3(hdc, id == 1? hwnd: NULL); + switch(id) { + case 0: + rose(1.0, 7, 13); + break; + case 1: + /*look3(0.5, 0.7, 1.5);*/ + /*look3(0.2, -2 * gy, 1.0+gx);*/ + look3(-2 * gx, -2 * gy, 1.2); + drawgrid(-8.0, 8.0, 10, -8.0, 8.0, 10); + break; + case 2: + setcolor3(BLACK); + circle3(1.0); + break; + case 3: + setcolor3(BLUE); + daisy(1.0, 20); + break; + } + +#if CLIPDEMO + if(id == 1) { + HRGN hrgn, hrgn2; + + /* create circular clip region for effect*/ + GetClientRect(hwnd, &rc); + InflateRect(&rc, -80, -80); + switch((int)GetWindowLong(hwnd, GWL_ID)) { + default: + hrgn = CreateEllipticRgnIndirect(&rc); + break; + case 5: + hrgn = CreateRoundRectRgn(rc.left, rc.top, + rc.right, rc.bottom, 100, 100); + break; + case 1: + hrgn = CreateRectRgnIndirect(&rc); + break; + } + + /* erase background, clip out blit area*/ + GetClientRect(hwnd, &rc); + hrgn2 = CreateRectRgnIndirect(&rc); + SelectClipRgn(hdc, hrgn2); + ExtSelectClipRgn(hdc, hrgn, RGN_XOR); + DeleteObject(hrgn2); + + GetClientRect(hwnd, &rc); + FillRect(hdc, &rc, GetStockObject(BLACK_BRUSH)); + + /* clip in only blit area*/ + SelectClipRgn(hdc, hrgn); + DeleteObject(hrgn); + } +#endif /* CLIPDEMO*/ + + paint3(hdc); + +#endif /* GRAPH3D*/ + EndPaint(hwnd, &ps); + break; + + case WM_LBUTTONDOWN: + break; + + case WM_MOUSEMOVE: +#if GRAPH3D + if((GetWindowLong(hwnd, GWL_ID) & 03) == 1) { + POINT pt; + + POINTSTOPOINT(pt, lp); + GetClientRect(hwnd, &rc); + gx = (vec1)pt.x / rc.right; + gy = (vec1)pt.y / rc.bottom; + InvalidateRect(hwnd, NULL, FALSE); + mousept.x = pt.x; + mousept.y = pt.y; + } +#endif + break; + + case WM_LBUTTONUP: + break; + + case WM_RBUTTONDOWN: + break; + + default: + return DefWindowProc( hwnd, msg, wp, lp); + } + return( 0); +} + +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nShowCmd) +{ + MSG msg; + HWND hwnd; + RECT rc; + + RegisterAppClass(); + GetWindowRect(GetDesktopWindow(), &rc); +#if !(ELKS | MSDOS) + /* create penguin window*/ + CreateWindowEx(0L, APPCHILD, "", WS_BORDER | WS_VISIBLE, + rc.right-130-1, rc.bottom-153-1, 130, 153, + GetDesktopWindow(), (HMENU)1000, NULL, NULL); +#endif + CreateAppWindow(); + CreateAppWindow(); + CreateAppWindow(); +#if !(ELKS | MSDOS) + CreateAppWindow(); + CreateAppWindow(); + CreateAppWindow(); + CreateAppWindow(); + CreateAppWindow(); + hwnd = CreateAppWindow(); + GetWindowRect(hwnd, &rc); + OffsetRect(&rc, 50, 50); + MoveWindow(hwnd, rc.left, rc.top, rc.bottom-rc.top, + rc.right-rc.left, TRUE); +#endif +#if !(ELKS | MSDOS) + /* set background wallpaper*/ + MwSetDesktopWallpaper(&image_microwin); + /*MwSetDesktopWallpaper(&image_under4);*/ + /*MwSetDesktopWallpaper(&image_car8);*/ +#endif + + /* type ESC to quit...*/ + while( GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/mwin/mdemo.stretch.c b/packages/services/gfx/mw/current/src/demos/mwin/mdemo.stretch.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/mdemo.stretch.c @@ -0,0 +1,483 @@ +/* + * Copyright (c) 1999, 2000 Greg Haerr + * + * Demo program for Microwindows + */ +#define MWINCLUDECOLORS +#include "windows.h" +#include "wintern.h" /* for MwSetDesktopWallpaper*/ + +#include "device.h" + +#if DOS_TURBOC +unsigned _stklen = 4096; +#endif + +#define CLIPDEMO 0 /* set for region clipping demo*/ + +#ifndef ELKS +#define TIMERDEMO 1 /* set for WM_TIMER demo*/ +#define GRAPH3D 0 /* 3d graphics demo*/ +#define IMAGE 0 /* 256 color image demo*/ +#endif +#define ARCDEMO 1 /* arc drawing demo*/ +#define CHILD 1 /* child window demo*/ +#define CLIENT3D 0 /* old client draw test*/ + +#if GRAPH3D +#include "graph3d.h" +#endif + +extern MWIMAGEHDR image_car8; +extern MWIMAGEHDR image_zion208; +extern MWIMAGEHDR image_penguin; +extern MWIMAGEHDR image_under4; +extern MWIMAGEHDR image_microwin; +extern MWIMAGEHDR image_cs1; +extern MWIMAGEHDR image_rle8; + +#if CHILD +#if ELKS | MSDOS +PMWIMAGEHDR image = &image_cs1; /* 2 color bitmap for 16 color systems*/ +#else +PMWIMAGEHDR image = &image_penguin; +#endif +#endif + +#if IMAGE +PMWIMAGEHDR image2 = &image_zion208; +#endif + +#define APPCLASS "test" +#define APPCHILD "test2" + +/* forward decls*/ +LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp); +LRESULT CALLBACK ChildWndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp); + +int +MwUserInit(int ac, char **av) +{ + /* test user init procedure - do nothing*/ + return 0; +} + +int +RegisterAppClass(void) +{ + WNDCLASS wc; + +#if !ELKS + MwRegisterButtonControl(NULL); + MwRegisterEditControl(NULL); + MwRegisterListboxControl(NULL); + MwRegisterProgressBarControl(NULL); + /*MwRegisterComboboxControl(NULL);*/ +#endif + wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW; + wc.lpfnWndProc = (WNDPROC)WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = 0; + wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/ + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = APPCLASS; + RegisterClass( &wc); + +#if CHILD + wc.lpfnWndProc = (WNDPROC)ChildWndProc; + wc.lpszClassName = APPCHILD; + return RegisterClass( &wc); +#endif + return 1; +} + +HWND +CreateAppWindow(void) +{ + HWND hwnd, hlist; + static int nextid = 1; + int width, height; + RECT r; + GetWindowRect(GetDesktopWindow(), &r); + width = height = r.right / 2; + + hwnd = CreateWindowEx(0L, APPCLASS, + "Microwindows Application", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, + width, height, + NULL, (HMENU)nextid++, NULL, NULL); + +#if CHILD + if(hwnd +#if GRAPH3D + && (nextid & 03)!=2 +#endif + ) { + CreateWindowEx(0L, APPCHILD, + "", + WS_BORDER | WS_CHILD | WS_VISIBLE, + 4, 4, width / 3, height / 3, + hwnd, (HMENU)2, NULL, NULL); +return hwnd; + CreateWindowEx(0L, APPCHILD, + "", + WS_BORDER | WS_CHILD | WS_VISIBLE, + width / 3, height / 3, width / 3, height / 3, + hwnd, (HMENU)3, NULL, NULL); + CreateWindowEx(0L, APPCHILD, + "", + WS_BORDER | WS_CHILD | WS_VISIBLE, + width * 3 / 5, height * 3 / 5, + width * 2 / 3, height * 2 / 3, + hwnd, (HMENU)4, NULL, NULL); + CreateWindowEx(0L, "EDIT", + "OK", + WS_BORDER|WS_CHILD | WS_VISIBLE, + width * 5 / 8, 10, 100, 18, + hwnd, (HMENU)5, NULL, NULL); + CreateWindowEx(0L, "PROGBAR", + "OK", + WS_BORDER|WS_CHILD | WS_VISIBLE, + width * 5 / 8, 32, 100, 18, + hwnd, (HMENU)6, NULL, NULL); + + hlist = CreateWindowEx(0L, "LISTBOX", + "OK", + WS_HSCROLL|WS_VSCROLL|WS_BORDER|WS_CHILD | WS_VISIBLE, + width * 5 / 8, 54, 100, 48, + hwnd, (HMENU)7, NULL, NULL); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Cherry"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Apple"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Orange"); + + CreateWindowEx(0L, "BUTTON", + "Cancel", + BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE, + width * 5 / 8 + 50, 106, 50, 14, + hwnd, (HMENU)8, NULL, NULL); + } +#endif + return hwnd; +} + +#if CHILD +LRESULT CALLBACK +ChildWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + HDC hdcMem; + HBITMAP hbmp, hbmpOrg; + RECT rc; + PAINTSTRUCT ps; + + switch(msg) { + case WM_PAINT: + BeginPaint(hwnd, &ps); + GetClientRect(hwnd, &rc); + + /* redirect painting to offscreen dc*/ + hdcMem = CreateCompatibleDC(ps.hdc); + //hbmp = CreateCompatibleBitmap(hdcMem, rc.right, rc.bottom); + hbmp = CreateCompatibleBitmap(hdcMem, image->width, image->height); + hbmpOrg = SelectObject(hdcMem, hbmp); + + /* draw onto offscreen dc*/ + DrawDIB(hdcMem, 0, 0, image); + + /* blit offscreen with physical screen*/ + //BitBlt(ps.hdc, 0, 0, rc.right, rc.bottom, hdcMem, 0, 0, MWROP_SRCCOPY); + StretchBlt(ps.hdc, 0, 0, rc.right, rc.bottom, hdcMem, 0, 0, image->width, image->height, MWROP_SRCCOPY); + DeleteObject(SelectObject(hdcMem, hbmpOrg)); + DeleteDC(hdcMem); + + EndPaint(hwnd, &ps); + break; + default: + return DefWindowProc( hwnd, msg, wp, lp); + } + return( 0); +} +#endif + +LRESULT CALLBACK +WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + PAINTSTRUCT ps; + HDC hdc; +#if CLIENT3D | IMAGE | GRAPH3D + RECT rc; +#endif +#if GRAPH3D + static int countup = 1; + int id; + static vec1 gx, gy; +#endif +#if TIMERDEMO + static POINT mousept; +#endif +#if ARCDEMO + static int startdegrees = 0; + static int enddegrees = 30; +#endif + + switch( msg) { +#if TIMERDEMO + case WM_CREATE: + SetTimer(hwnd, 1, 100, NULL); + mousept.x = 60; + mousept.y = 20; + break; + + case WM_TIMER: +#if GRAPH3D + GetClientRect(hwnd, &rc); + if(countup) { + mousept.y += 20; + if(mousept.y >= rc.bottom) { + mousept.y -= 20; + countup = 0; + } + } else { + mousept.y -= 20; + if(mousept.y < 20) { + mousept.y += 20; + countup = 1; + } + } + SendMessage(hwnd, WM_MOUSEMOVE, 0, + MAKELONG(mousept.x, mousept.y)); +#endif +#if ARCDEMO + startdegrees += 10; + if(startdegrees >= 360) + startdegrees = 0; + enddegrees += 15; + if(enddegrees >= 360) + enddegrees = 0; + InvalidateRect(hwnd, NULL, TRUE); +#endif + break; + + case WM_DESTROY: + KillTimer(hwnd, 1); + break; +#endif /* TIMERDEMO*/ + case WM_SIZE: + break; + + case WM_MOVE: + break; + +#if CLIENT3D + case WM_SETFOCUS: + PostMessage((HWND)wp, WM_PAINT, 0, 0L); + break; + + case WM_KILLFOCUS: + PostMessage((HWND)wp, WM_PAINT, 0, 0L); + break; + case WM_ERASEBKGND: + if(GetFocus() != hwnd) + return DefWindowProc(hwnd, msg, wp, lp); + return 1; +#endif +#if GRAPH3D + case WM_ERASEBKGND: + if((GetWindowLong(hwnd, GWL_ID) & 03) == 1) + return 1; + return DefWindowProc(hwnd, msg, wp, lp); +#endif + case WM_PAINT: + hdc = BeginPaint(hwnd, &ps); + +#if CLIENT3D + if(GetFocus() == hwnd) { + GetClientRect(hwnd, &rc); + Draw3dShadow(hdc, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_3DDKSHADOW), + GetSysColor(COLOR_3DLIGHT)); + InflateRect(&rc, -1, -1); + FillRect(hdc, &rc, GetStockObject(GRAY_BRUSH)); + } +#endif +#if IMAGE + GetClientRect(hwnd, &rc); + DrawDIB(hdc, rc.left+2, rc.top+2, image2); +#endif +#if ARCDEMO +{ + int x, y, w, h; + RECT rc; + + if(hdc != NULL) { + GetWindowRect(hwnd, &rc); + rc.top += 13; + InflateRect(&rc, -3, -3); + //Ellipse(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top); + //Arc(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top, 0,0, 0,0); + //Pie(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top, 0,0, 0,0); +#if 1 + x = rc.left; + y = rc.top; + w = rc.right - rc.left; + h = rc.bottom - rc.top; + w += 10; + GdSetForeground(GdFindColor(RGB(0,255,0))); + GdArcAngle(hdc->psd, x+w/2, y+h/2, w/2, h/2, startdegrees*64, + enddegrees*64, MWPIE); + GdSetForeground(GdFindColor(RGB(0,0,0))); + GdArcAngle(hdc->psd, x+w/2, y+h/2, w/2, h/2, startdegrees*64, + enddegrees*64, MWARCOUTLINE); + //GdSetForeground(GdFindColor(RGB(255,255,255))); + //GdPoint(hdc->psd, x+w/2, y+h/2); +#endif + } + EndPaint(hwnd, &ps); + break; +} +#endif /* ARCDEMO*/ +#if GRAPH3D + id = (int)GetWindowLong(hwnd, GWL_ID) & 03; + init3(hdc, id == 1? hwnd: NULL); + switch(id) { + case 0: + rose(1.0, 7, 13); + break; + case 1: + //look3(0.5, 0.7, 1.5); + //look3(0.2, -2 * gy, 1.0+gx); + look3(-2 * gx, -2 * gy, 1.2); + drawgrid(-8.0, 8.0, 10, -8.0, 8.0, 10); + break; + case 2: + setcolor3(BLACK); + circle3(1.0); + break; + case 3: + setcolor3(BLUE); + daisy(1.0, 20); + break; + } + +#if CLIPDEMO + if(id == 1) { + HRGN hrgn, hrgn2; + + /* create circular clip region for effect*/ + GetClientRect(hwnd, &rc); + InflateRect(&rc, -80, -80); + switch((int)GetWindowLong(hwnd, GWL_ID)) { + default: + hrgn = CreateEllipticRgnIndirect(&rc); + break; + case 5: + hrgn = CreateRoundRectRgn(rc.left, rc.top, + rc.right, rc.bottom, 100, 100); + break; + case 1: + hrgn = CreateRectRgnIndirect(&rc); + break; + } + + /* erase background, clip out blit area*/ + GetClientRect(hwnd, &rc); + hrgn2 = CreateRectRgnIndirect(&rc); + SelectClipRgn(hdc, hrgn2); + ExtSelectClipRgn(hdc, hrgn, RGN_XOR); + DeleteObject(hrgn2); + + GetClientRect(hwnd, &rc); + FillRect(hdc, &rc, GetStockObject(BLACK_BRUSH)); + + /* clip in only blit area*/ + SelectClipRgn(hdc, hrgn); + DeleteObject(hrgn); + } +#endif /* CLIPDEMO*/ + + paint3(hdc); + +#endif /* GRAPH3D*/ + EndPaint(hwnd, &ps); + break; + + case WM_LBUTTONDOWN: + break; + + case WM_MOUSEMOVE: +#if GRAPH3D + if((GetWindowLong(hwnd, GWL_ID) & 03) == 1) { + POINT pt; + + POINTSTOPOINT(pt, lp); + GetClientRect(hwnd, &rc); + gx = (vec1)pt.x / rc.right; + gy = (vec1)pt.y / rc.bottom; + InvalidateRect(hwnd, NULL, FALSE); + mousept.x = pt.x; + mousept.y = pt.y; + } +#endif + break; + + case WM_LBUTTONUP: + break; + + case WM_RBUTTONDOWN: + break; + + default: + return DefWindowProc( hwnd, msg, wp, lp); + } + return( 0); +} + +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nShowCmd) +{ + MSG msg; + HWND hwnd; + RECT rc; + + RegisterAppClass(); + GetWindowRect(GetDesktopWindow(), &rc); +#if !(ELKS | MSDOS) + /* create penguin window*/ + //CreateWindowEx(0L, APPCHILD, "", WS_BORDER | WS_VISIBLE, + //rc.right-130-1, rc.bottom-153-1, 130, 153, + //GetDesktopWindow(), (HMENU)1000, NULL, NULL); +#endif + CreateAppWindow(); + CreateAppWindow(); + //CreateAppWindow(); +#if !(ELKS | MSDOS) + //CreateAppWindow(); + //CreateAppWindow(); + //CreateAppWindow(); + //CreateAppWindow(); + //CreateAppWindow(); + //hwnd = CreateAppWindow(); + //GetWindowRect(hwnd, &rc); + //OffsetRect(&rc, 50, 50); + //MoveWindow(hwnd, rc.left, rc.top, rc.bottom-rc.top, + //rc.right-rc.left, TRUE); +#endif +#if !(ELKS | MSDOS) + /* set background wallpaper*/ + MwSetDesktopWallpaper(&image_microwin); + /*MwSetDesktopWallpaper(&image_under4);*/ + /*MwSetDesktopWallpaper(&image_car8);*/ +#endif + + /* type ESC to quit...*/ + while( GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/mwin/mine.c b/packages/services/gfx/mw/current/src/demos/mwin/mine.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/mine.c @@ -0,0 +1,1347 @@ +#include +#include +#include +#include +/* + * Minesweeper for Microwindows, adapted from MiniGUI + */ +extern int mwCurrentButtons; /* FIXME */ + + +#ifdef __rtems__ +#define srandom srand +#define random rand +#endif + +#define MWINCLUDECOLORS +#include "windows.h" +#include "wintools.h" + +typedef struct { + int flag; + int value; + BOOL test; + BOOL hit; + BOOL bombout; + BOOL error; +}BOM; + +typedef struct { + int x; + int y; + BOOL NY; +}NO; + +typedef struct { + int highscore; + char name[20]; +}SCORE; + +typedef struct { + DWORD dwStyle; + LPSTR spCaption; + HMENU hMenu; + HCURSOR hCursor; + HICON hIcon; + WNDPROC MainWindowProc; + int lx, ty, rx, by; + COLORREF iBkColor; + DWORD dwAddData; + HWND hHosting; +} MAINWINCREATE, *PMAINWINCREATE; + +#define IDOK 0 +#define GetCharWidth() 11 +#define GetCharHeight() 13 + +extern MWIMAGEHDR image_mineflag; +extern MWIMAGEHDR image_mineface; +extern MWIMAGEHDR image_minefacelost; +extern MWIMAGEHDR image_minebomb; +extern MWIMAGEHDR image_minedone; +extern MWIMAGEHDR image_minehitfalse; + +HWND CreateMainWindow(PMAINWINCREATE pCreateInfo); +BOOL PtInRect2(const RECT *lprc, int x, int y); +void Draw3DUpFrame(HDC hDC, int l, int t, int r, int b, int fillc); +void SearchGround(HDC hdc,int x,int y); +int Open(HWND hWnd,int x,int y); +LRESULT TestMyWinProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam); +void InitMyWinCreateInfo(PMAINWINCREATE pCreateInfo); +void InitAbHostedCreateInfo(HWND hHosting, PMAINWINCREATE pCreateInfo); +void InitHighScoreCreateInfo (HWND hHosting, PMAINWINCREATE pCreateInfo); +void InitCongratulationCreateInfo (HWND hHosting, PMAINWINCREATE pCreateInfo); +void* TestMyWindow(void* data); +void BombGame(HWND hWnd, int x, int y); +void Finished(HWND hWnd); +void Cancel3DFrame(HDC hdc, int l,int t,int r,int b); +void TextValue(HDC hdc, int x,int y,int value); +void BombOut(HWND hWnd); +void BothButtonDownProc(HWND hWnd, int x, int y); +void DrawDigit(HDC hdc, char* buffer, int CLOCK); + +#define ID_ABOUT 300 +#define ID_NEW 301 +#define ID_LARGE 302 +#define ID_MIDDLE 303 +#define ID_SMALL 304 +#define ID_CLOSE 305 +#define ID_HIGHSCORE 306 +#define ID_CLOCK 400 + +#define WIDTH_LARGEWIN 544 +#define HEIGHT_LARGEWIN 371 +#define WIDTH_MIDDLEWIN 287 +#define HEIGHT_MIDDLEWIN 332 +#define WIDTH_SMALLWIN 178 +#define HEIGHT_SMALLWIN 206 + +#define WIDTH_FACE 30 +#define HEIGHT_FACE 30 + +#define WIDTH_DIGIT 11 +#define WIDTH_BOMNUM (2*WIDTH_DIGIT) +#define HEIGHT_BOMNUM 30 + +#define WIDTH_CLOCK (3*WIDTH_DIGIT) +#define HEIGHT_CLOCK 30 +#define FREQ_CLOCK 1000 + +#define WIDTH_BOX 18 +#define HEIGHT_BOX 18 + +#if 0 +static int winwidth = WIDTH_LARGEWIN; /* change this for startup mine size */ +static int winheight = HEIGHT_LARGEWIN; +static int sg_boxnumx = 30; +static int sg_boxnumy = 18; +static int bombnum = 99; +#endif + +#if 1 +static int winwidth = WIDTH_MIDDLEWIN; /* change this for startup mine size */ +static int winheight = HEIGHT_MIDDLEWIN; +static int sg_boxnumx = 16; +static int sg_boxnumy = 16; +static int bombnum = 40; +#endif + +#if 0 +static int winwidth = WIDTH_SMALLWIN; /* change this for startup mine size */ +static int winheight = HEIGHT_SMALLWIN; +static int sg_boxnumx = 8; +static int sg_boxnumy = 8; +static int bombnum = 10; +#endif + +static BOM bom[30][18]; +static NO NoAdr[540]; +static SCORE score[3]; +static int itime, leftbombnum; +static int oldx, oldy, adrx, adry; +static int flag_bombout, flag_finished, flag_size = 2; +static int second = 0 ; +static BOOL bTimer; +static HWND hHighscore,hCongratulate; +static int offsetx; +static int x_face, x_bomnum, x_clock; + +void Cancel3DFrame(HDC hdc, int l, int t, int w, int h) +{ + HBRUSH hbr; + RECT rc; + + SetTextColor (hdc,GRAY); + Rectangle(hdc, l, t, l + w, t + h); + hbr = CreateSolidBrush(LTGRAY); + SetRect(&rc, l+1, t+1, l+w, t+h); + FillRect(hdc, &rc, hbr); + DeleteObject(hbr); +} + +void TextValue(HDC hdc, int x, int y, int value) + { + int color = 0; + char va[20]; + switch(value) + { + case 1: color=BLUE; break; + case 2: color=GREEN; break; + case 3: color=RED; break; + case 4: color=MAGENTA; break; + case 5: color=YELLOW; break; + case 6: color=CYAN; break; + case 7: color=RED; break; + case 8: color=GREEN; break; + } + SetBkColor(hdc,LTGRAY); + SetTextColor(hdc,color); + sprintf(va,"%d",value); + + TextOut(hdc, x + ((WIDTH_BOX - GetCharWidth ()) >> 1), + y + ((HEIGHT_BOX - GetCharHeight ()) >> 1), va, -1); +} + +void SearchGround(HDC hdc,int x,int y) +{ + int x1=0,y1=0; + int i=1; + + bom[x][y].test=TRUE; + NoAdr[itime].x=x; + NoAdr[itime].y=y; + NoAdr[itime].NY=FALSE; + itime++; + Cancel3DFrame(hdc,x*WIDTH_BOX+offsetx, y*HEIGHT_BOX+HEIGHT_FACE, + WIDTH_BOX, HEIGHT_BOX); + while( i <= 8 ) + { + switch(i) + { + case 1: x1=x-1; y1=y; break; + case 2: x1=x-1; y1=y-1; break; + case 3: x1=x-1; y1=y+1; break; + case 4: x1=x+1; y1=y; break; + case 5: x1=x+1; y1=y-1; break; + case 6: x1=x+1; y1=y+1; break; + case 7: y1=y-1; x1=x; break; + case 8: y1=y+1; x1=x; break; + } + if( x1>=0 && y1>=0 && x1=0 && y1>=0 && x1=0 && y1>=0 && x1=0 && y1>=0 && x1=0 && y1>=0 && x1=0 && adry1>=0 && adrx1=0 && adry1>=0 && adrx1=0&&j-1>=0&&bom[i-1][j-1].flag) + bom[i][j].value++; + + if(i-1>=0&&bom[i-1][j].flag) + bom[i][j].value++; + + if(i-1>=0&&j+1=0&&bom[i][j-1].flag) + bom[i][j].value++; + + if(j+1=0&&bom[i+1][j-1].flag) + bom[i][j].value++; + } + } + InvalidateRect (hWnd, NULL, TRUE); + } + break; + + case WM_TIMER: + if (wParam == ID_CLOCK) + if (bTimer){ + if (second < 1000){ + second++; + InvalidateRect(hWnd, &clock, FALSE); + } + } + break; + + case WM_LBUTTONDOWN: + + oldx = LOWORD (lParam); + oldy = HIWORD (lParam); + + adrx = (oldx-offsetx)/WIDTH_BOX; + adry = (oldy-HEIGHT_FACE)/HEIGHT_BOX; + + if (hCongratulate || hHighscore) + break; + + if (!PtInRect2 (&bombregion, oldx, oldy)) { + if (PtInRect2 (&face, oldx, oldy)){ + PostMessage (hWnd, WM_COMMAND, ID_NEW, 0); + break; + } + else + break; + } + if (flag_bombout) + break; + if (flag_finished) + break; + if (!bTimer) + bTimer = TRUE; + + if (bom[adrx][adry].hit) + break; + +#if 0 + if (GetShiftKeyStatus() & 0x00000200) { +#endif + if(mwCurrentButtons & MWBUTTON_R) { + BothButtonDownProc(hWnd,adrx,adry); + break; + } + + + if (bom[adrx][adry].test) + break; + + if (bom[adrx][adry].flag) { + BombOut(hWnd); + break; + } + if (bom[adrx][adry].value != 0) + { + NoAdr[itime].x = adrx; + NoAdr[itime].y = adry; + NoAdr[itime].NY = TRUE; + itime++; + bom[adrx][adry].test = TRUE; + + SetRect (&onerect, adrx*WIDTH_BOX+offsetx, + adry*HEIGHT_BOX+HEIGHT_FACE, + (adrx+1)*WIDTH_BOX+offsetx, + (adry+1)*HEIGHT_BOX+HEIGHT_FACE); + InvalidateRect (hWnd, &onerect, FALSE); + } + else { + hdc = GetDC(hWnd); + SearchGround (hdc, adrx, adry); + ReleaseDC(hWnd, hdc); + } + + if (itime == (sg_boxnumx*sg_boxnumy - bombnum)) + Finished(hWnd); + + break; + + case WM_MBUTTONDOWN: + oldx = LOWORD (lParam); + oldy = HIWORD (lParam); + adrx = (oldx-offsetx)/WIDTH_BOX; + adry = (oldy-HEIGHT_FACE)/HEIGHT_BOX; + + if (!PtInRect2 (&bombregion, oldx, oldy)) + break; + if (flag_bombout) + break; + if (flag_finished) + break; + + if (!bTimer) + bTimer = TRUE; + + /*****RBUTTONDOWN & LBUTTONDOWN******/ + + BothButtonDownProc(hWnd,adrx,adry); + break; + + case WM_RBUTTONDOWN: +#if 0 + SetCapture (hWnd); +#endif + oldx = LOWORD (lParam); + oldy = HIWORD (lParam); + adrx = (oldx-offsetx)/WIDTH_BOX; + adry = (oldy-HEIGHT_FACE)/HEIGHT_BOX; + + if (!PtInRect2 (&bombregion, oldx, oldy)) + break; + if (flag_bombout) + break; + if (flag_finished) + break; + + if (!bTimer) + bTimer = TRUE; + + /*****RBUTTONDOWN & LBUTTONDOWN******/ + +#if 0 + if (GetShiftKeyStatus() & 0x00000100){ +#endif + if(mwCurrentButtons & MWBUTTON_L) { + BothButtonDownProc(hWnd,adrx,adry); + break; + } + /******* only rbuttondown *******/ + + if (bom[adrx][adry].test) + break; + if (!bom[adrx][adry].hit ) + { + bom[adrx][adry].hit = TRUE; + leftbombnum--; + } + else + { bom[adrx][adry].hit = FALSE; + leftbombnum++; + } + SetRect (&onerect, adrx*WIDTH_BOX+offsetx, + adry*HEIGHT_BOX+HEIGHT_FACE, + (adrx+1)*WIDTH_BOX+offsetx, + (adry+1)*HEIGHT_BOX+HEIGHT_FACE); + InvalidateRect (hWnd, &onerect, FALSE); + InvalidateRect (hWnd, &bombnumber, FALSE); + break; + + case WM_PAINT: + hdc = BeginPaint (hWnd, &ps); + + sprintf(seconds, "%03d", second); + DrawDigit(hdc, seconds, TRUE); + + if (leftbombnum >= 0){ + sprintf(bomn,"%02d",leftbombnum); + DrawDigit(hdc, bomn, FALSE); + } + + if (flag_finished) + DrawDIB(hdc, x_face+1, 1, &image_minedone); +#if 0 + DrawMyBitmap (hdc, fValidfinalface?&bmpfinalface:NULL, +#endif + else + if (flag_bombout) + DrawDIB(hdc, x_face, 0, &image_minefacelost); + else + DrawDIB(hdc, x_face, 0, &image_mineface); + + for (i = 0; i < sg_boxnumx; i++) + for (j = 0; j < sg_boxnumy; j++) + { + if (!bom[i][j].test && !bom[i][j].bombout){ + SetTextColor (hdc,BLACK); + SelectObject(hdc, GetStockObject(NULL_BRUSH)); + Draw3DUpFrame(hdc, + i*WIDTH_BOX+offsetx, + j*HEIGHT_BOX+HEIGHT_FACE, + (i+1)*WIDTH_BOX+offsetx, + (j+1)*HEIGHT_BOX+HEIGHT_FACE, + LTGRAY); + } + + + if ( bom[i][j].hit) + DrawDIB(hdc, i*WIDTH_BOX+offsetx+3, j*HEIGHT_BOX+3+HEIGHT_FACE, + &image_mineflag); + + if (bom[i][j].error) { + Cancel3DFrame(hdc,i*WIDTH_BOX+offsetx, + j*HEIGHT_BOX+HEIGHT_FACE, + WIDTH_BOX,HEIGHT_BOX); + + DrawDIB(hdc, i*WIDTH_BOX+offsetx+1, j*HEIGHT_BOX+1+HEIGHT_FACE, + &image_minehitfalse); + } + + if (bom[i][j].bombout) { + Cancel3DFrame(hdc,i*WIDTH_BOX+offsetx, + j*HEIGHT_BOX+HEIGHT_FACE, + WIDTH_BOX,HEIGHT_BOX); + + DrawDIB(hdc, i*WIDTH_BOX+offsetx+1, j*HEIGHT_BOX+1+HEIGHT_FACE, + &image_minebomb); + } + } + + for ( i = 0; i < itime; i++ ) + { + Cancel3DFrame(hdc,(NoAdr[i].x)*WIDTH_BOX+offsetx, + (NoAdr[i].y)*HEIGHT_BOX+HEIGHT_FACE, + WIDTH_BOX, HEIGHT_BOX); + if(NoAdr[i].NY) + TextValue(hdc,(NoAdr[i].x)*WIDTH_BOX+offsetx, + (NoAdr[i].y)*HEIGHT_BOX+HEIGHT_FACE, + bom[NoAdr[i].x][NoAdr[i].y].value); + } + EndPaint (hWnd, &ps); + break; + + case WM_CLOSE: + KillTimer(hWnd, ID_CLOCK); + DestroyWindow (hWnd); + PostQuitMessage (0); + return 0; + } + return DefWindowProc(hWnd, message, wParam, lParam); +} + +void InitMyWinCreateInfo(PMAINWINCREATE pCreateInfo) +{ + pCreateInfo->dwStyle = WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_VISIBLE; + pCreateInfo->spCaption="Microwindows Minesweeper"; + pCreateInfo->hMenu = 0; /* createmenu1(); */ + pCreateInfo->hCursor = 0; /* GetSystemCursor(0); */ + pCreateInfo->hIcon = 0; + pCreateInfo->MainWindowProc = TestMyWinProc; + pCreateInfo->lx = 0; + pCreateInfo->ty = 0; + pCreateInfo->rx = winwidth; + pCreateInfo->by = winheight; + pCreateInfo->iBkColor = LTGRAY; + pCreateInfo->dwAddData = 0; + pCreateInfo->hHosting = HWND_DESKTOP; +} + +void* TestMyWindow(void* data) +{ + MSG Msg; + MAINWINCREATE CreateInfo; + HWND hMainWnd; + + InitMyWinCreateInfo(&CreateInfo); + + hMainWnd = CreateMainWindow(&CreateInfo); + + if (hMainWnd == 0) + return NULL; + + ShowWindow(hMainWnd,SW_SHOWNORMAL); + while( GetMessage(&Msg, NULL, 0, 0) ) { + TranslateMessage (&Msg); + DispatchMessage(&Msg); + } + + return NULL; +} + +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nShowCmd) +{ + TestMyWindow (NULL); + return 0; +} + +/********** create a hosted about window****/ +LRESULT AbHostedWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + PAINTSTRUCT ps; + + switch (message) { + case WM_CREATE: + break; + + case WM_PAINT: + { + HDC hdc; + + hdc = BeginPaint (hWnd, &ps); + SetBkColor(hdc,LTGRAY); + TextOut (hdc, 10, 25, "Minesweeper Ver 0.9 (1999/08/27)", -1); + TextOut (hdc, 10, 55, + "Author: Mis. Zheng Xiang (xiang_zi@263.net).", -1); + TextOut (hdc, 10, 75, + " Mis. Glory (glory@263.net).", -1); + EndPaint (hWnd, &ps); + } + return 0; + + case WM_CLOSE: + DestroyWindow (hWnd); + return 0; + } + + return DefWindowProc(hWnd, message, wParam, lParam); +} +void InitAbHostedCreateInfo (HWND hHosting, PMAINWINCREATE pCreateInfo) +{ + pCreateInfo->dwStyle = WS_BORDER | WS_CAPTION | WS_VISIBLE; + pCreateInfo->spCaption = "The about window" ; + pCreateInfo->hMenu = 0; + pCreateInfo->hCursor = 0; /* GetSystemCursor(0); */ + pCreateInfo->hIcon = 0; + pCreateInfo->MainWindowProc = AbHostedWinProc; + pCreateInfo->lx = 100; + pCreateInfo->ty = 200; + pCreateInfo->rx = 540; + pCreateInfo->by = 390; + pCreateInfo->iBkColor = LTGRAY; + pCreateInfo->dwAddData = 0; + pCreateInfo->hHosting = hHosting; +} + +/*************************** High Scores Window ******************************/ +#define IDC_RESET 110 +LRESULT HighScoreWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + PAINTSTRUCT ps; + static HWND hRESET, hOK; + + switch (message) { + case WM_CREATE: + hRESET = CreateWindowEx (0L, "button", + "ÖØÖÃ", + WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE, + 100, 145, 60, 26, + hWnd, (HMENU)IDC_RESET, 0, 0L); + + hOK = CreateWindowEx (0L, "button", + "È·¶¨", + WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE, + 220, 145, 60, 26, + hWnd, (HMENU)IDOK, 0, 0L); + break; + + case WM_COMMAND: + { + int id = LOWORD(wParam); + int i; + + if (id == IDC_RESET && HIWORD(wParam) == BN_CLICKED) { + for (i = 0; i < 3; i++){ + score[i].highscore = 999; + strcpy(score[i].name, "unknown"); + } + +#if 0 + FILE* pHighscore; + if ((pHighscore = fopen("res/.highscore.bomb", "w+"))){ + for (i = 0; i < 3; i++) + fprintf(pHighscore, "%d, %s\n", + score[i].highscore,score[i].name); + fclose(pHighscore); + } +#endif + InvalidateRect(hWnd, NULL, TRUE); + } + if (id == IDOK && HIWORD(wParam) == BN_CLICKED) + PostMessage(hWnd, WM_CLOSE, 0, 0); + } + break; + + case WM_PAINT: + { + HDC hdc; + char buffer[50]; + int i; + + hdc = BeginPaint (hWnd, &ps); + SetBkColor(hdc,LTGRAY); + TextOut(hdc, 130, 15, "Ó¢ÐÛ°ñ", -1); + TextOut(hdc, 15, 45, "SMALL" , -1); + TextOut(hdc, 15, 75, "MIDDLE", -1 ); + TextOut(hdc, 15, 105, "LARGE", -1 ); + for (i = 0; i < 3; i++){ + sprintf(buffer, "%3d %s", + score[i].highscore, score[i].name); + TextOut(hdc, 150, 45+i*30, buffer, -1); + } + EndPaint (hWnd, &ps); + } + return 0; + + case WM_CLOSE: + DestroyWindow (hRESET); + DestroyWindow (hOK); + DestroyWindow (hWnd); + hHighscore = HWND_DESKTOP; + return 0; + } + + return DefWindowProc(hWnd, message, wParam, lParam); +} + +void InitHighScoreCreateInfo (HWND hHosting, PMAINWINCREATE pCreateInfo) +{ + pCreateInfo->dwStyle = WS_BORDER | WS_CAPTION; + pCreateInfo->spCaption = "High Score" ; + pCreateInfo->hMenu = 0; + pCreateInfo->hCursor = 0; /* GetSystemCursor(0); */ + pCreateInfo->hIcon = 0; + pCreateInfo->MainWindowProc = HighScoreWinProc; + pCreateInfo->lx = 100; + pCreateInfo->ty = 200; + pCreateInfo->rx = 470; + pCreateInfo->by = 410; + pCreateInfo->iBkColor = LTGRAY; + pCreateInfo->dwAddData = 0; + pCreateInfo->hHosting = hHosting; +} + +/************************* Congratulation Window *****************************/ + +#define IDC_CTRL_NAME 100 + +LRESULT CongratulationWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + static HWND hPrompt, hName, hOK; + + switch (message) { + case WM_CREATE: +#if 0 + hPrompt = CreateWindow ("static", + "ÇëÊäÈë´óϺ×ðÐÕ´óÃû: ", + SS_SIMPLE | WS_VISIBLE, + IDC_STATIC, + 10, 10, 185, 24, hWnd, 0); + hName = CreateWindow ("edit", + getlogin(), + WS_CHILD | WS_VISIBLE | WS_BORDER, + IDC_CTRL_NAME, + 10, 40, 175, 26, hWnd, 0); +#endif + hOK = CreateWindow ("button", + "È·¶¨", + WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE, + 110, 75, 75, 26, + hWnd, (HMENU)IDOK, 0, 0L); + break; + + case WM_COMMAND: + { + int id = LOWORD(wParam); + + if (id == IDOK && HIWORD(wParam) == BN_CLICKED) { + score[flag_size].highscore = second; + SendMessage (hName, WM_GETTEXT, + 19, (LPARAM)score[flag_size].name); +#if 0 + FILE* pHighscore; + int i; + if ((pHighscore = fopen("res/.highscore.bomb", "w+"))){ + for (i = 0; i < 3; i++) + fprintf(pHighscore, "%d, %s\n", + score[i].highscore,score[i].name); + fclose(pHighscore); + } +#endif + PostMessage (hWnd, WM_CLOSE, 0, 0); + } + } + break; + case WM_CLOSE: + DestroyWindow (hPrompt); + DestroyWindow (hName); + DestroyWindow (hOK); + DestroyWindow (hWnd); + hCongratulate = HWND_DESKTOP; + return 0; + } + + return DefWindowProc(hWnd, message, wParam, lParam); +} + +void InitCongratulationCreateInfo (HWND hHosting, PMAINWINCREATE pCreateInfo) +{ + pCreateInfo->dwStyle = WS_BORDER | WS_CAPTION | WS_VISIBLE; + pCreateInfo->spCaption = "Congratulation" ; + pCreateInfo->hMenu = 0; + pCreateInfo->hCursor = 0; /* GetSystemCursor(0); */ + pCreateInfo->hIcon = 0; + pCreateInfo->MainWindowProc = CongratulationWinProc; + pCreateInfo->lx = 50; + pCreateInfo->ty = 60; + pCreateInfo->rx = 255; + pCreateInfo->by = 200; + pCreateInfo->iBkColor = LTGRAY; + pCreateInfo->dwAddData = 0; + pCreateInfo->hHosting = hHosting; +} + +HWND +CreateMainWindow(PMAINWINCREATE pCreateInfo) +{ + HWND hwnd; + RECT rc; + WNDCLASS wc; + + wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = (WNDPROC)pCreateInfo->MainWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = 0; + wc.hIcon = pCreateInfo->hIcon; + wc.hCursor = pCreateInfo->hCursor; + wc.hbrBackground = (HBRUSH)CreateSolidBrush(pCreateInfo->iBkColor); + wc.lpszMenuName = 0; + wc.lpszClassName = pCreateInfo->spCaption; + RegisterClass(&wc); + + SetRect(&rc, pCreateInfo->lx, pCreateInfo->ty, pCreateInfo->rx, + pCreateInfo->by); + AdjustWindowRectEx(&rc, pCreateInfo->dwStyle, FALSE, 0L); + + hwnd = CreateWindowEx(0L, pCreateInfo->spCaption, + pCreateInfo->spCaption, + pCreateInfo->dwStyle, + rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, + pCreateInfo->hHosting, + (HMENU)0, (HINSTANCE)0, + (PVOID)pCreateInfo->dwAddData); + return hwnd; +} + +BOOL +PtInRect2(const RECT *lprc, int x, int y) +{ + POINT p; + + p.x = x; + p.y = y; + return PtInRect(lprc, p); +} + +void +Draw3DUpFrame(HDC hDC, int l, int t, int r, int b, int fillc) +{ + RECT rc; + HBRUSH hbr; + + SetRect(&rc, l, t, r, b); + Draw3dBox(hDC, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_3DLIGHT), + GetSysColor(COLOR_WINDOWFRAME)); + InflateRect(&rc, -1, -1); + Draw3dBox(hDC, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_BTNHIGHLIGHT), + GetSysColor(COLOR_BTNSHADOW)); + InflateRect(&rc, -1, -1); + + hbr = CreateSolidBrush(LTGRAY); + FillRect(hDC, &rc, hbr); + DeleteObject(hbr); +} diff --git a/packages/services/gfx/mw/current/src/demos/mwin/minebomb.bmp b/packages/services/gfx/mw/current/src/demos/mwin/minebomb.bmp new file mode 100644 index 0000000000000000000000000000000000000000..0aa51f4b368c00f679227378bda5325f74bc28fd GIT binary patch literal 230 zc${wS3P60ILUs@zWIlq1xuLv({{uuEO2gH|^rM*z0So}Q%{Dv$ diff --git a/packages/services/gfx/mw/current/src/demos/mwin/minedone.bmp b/packages/services/gfx/mw/current/src/demos/mwin/minedone.bmp new file mode 100644 index 0000000000000000000000000000000000000000..5edd0104ffdad633a1f6908e3418398d09029707 GIT binary patch literal 534 zc${^RF&4rg42J*ue2*c!gC}rwcXRhHoh&0`kKqy6vv8}9n1BU@*B{dGCFvvN`MR8t z^cK5`U4J&=oZ_De2Xbk{x$JbwA%q}aBQb5nn4K;S$;aBYN^*AVI4(t%0n;*=y{SC2 z$X6z1HakliASo#9rMz-3mmdxod?&`kmplO;M1{RFO8v|_B5LmA+~7ffL;wBzhW8Ki RX}QXFyeY5$^IlpBe*rc4%T)jX diff --git a/packages/services/gfx/mw/current/src/demos/mwin/mineface.bmp b/packages/services/gfx/mw/current/src/demos/mwin/mineface.bmp new file mode 100644 index 0000000000000000000000000000000000000000..27cc50516a26cf55b4983105c921d61975afa5ec GIT binary patch literal 534 zc$|%pF%H8Z3`LzP5(9gOo*?Jw-n(RK7#VYn9)aBpx5`Mrp~Vywsoxm$j1h+W<9ea2 zCwzh5K0eW$^RJ0cRB%7*ir7qg)U8n{9D3Ip5WJoZWA@fB(MW{lovXtnwZ2!rSkEudTpu D$Gg$h diff --git a/packages/services/gfx/mw/current/src/demos/mwin/mineflag.bmp b/packages/services/gfx/mw/current/src/demos/mwin/mineflag.bmp new file mode 100644 index 0000000000000000000000000000000000000000..cdcc6b69dcfc2de7da9b0180f1e49aace7a43994 GIT binary patch literal 230 zc${@$?)0HzJ^vs#4e3(4cTmY&WKoI}{ diff --git a/packages/services/gfx/mw/current/src/demos/mwin/minehitfalse.bmp b/packages/services/gfx/mw/current/src/demos/mwin/minehitfalse.bmp new file mode 100644 index 0000000000000000000000000000000000000000..f56896ece64b3d80e3757376f857027b749f112e GIT binary patch literal 246 zc${5KF%Ezr48+95xEP<|JKX(?la-Clu(6T;hQT+vVz1RfuN(*0UgzaQWBVzx=PgwIbh TsjQ3@2&*As4+GOm-9>-g@q<++ diff --git a/packages/services/gfx/mw/current/src/demos/mwin/mstretch.c b/packages/services/gfx/mw/current/src/demos/mwin/mstretch.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/mstretch.c @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2001 Greg Haerr + * + * Demo program for StretchBlt + */ +#define MWINCLUDECOLORS +#include "windows.h" +#include "device.h" + +extern MWIMAGEHDR image_penguin; + +PMWIMAGEHDR image = &image_penguin; + +#define APPCHILD "test2" + +/* forward decls*/ +LRESULT CALLBACK ChildWndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp); + +int +RegisterAppClass(void) +{ + WNDCLASS wc; + + wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW; + wc.lpfnWndProc = (WNDPROC)ChildWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = 0; + wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/ + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = APPCHILD; + return RegisterClass( &wc); +} + +LRESULT CALLBACK +ChildWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + HDC hdcMem; + HBITMAP hbmp, hbmpOrg; + RECT rc; + PAINTSTRUCT ps; + + switch(msg) { + case WM_PAINT: + BeginPaint(hwnd, &ps); + GetClientRect(hwnd, &rc); + + /* redirect painting to offscreen dc*/ + hdcMem = CreateCompatibleDC(ps.hdc); + hbmp = CreateCompatibleBitmap(hdcMem, image->width, image->height); + hbmpOrg = SelectObject(hdcMem, hbmp); + + /* draw onto offscreen dc*/ + DrawDIB(hdcMem, 0, 0, image); + + /* stretch blit offscreen with physical screen*/ + StretchBlt(ps.hdc, 0, 0, rc.right, rc.bottom, hdcMem, + 0, 0, image->width, image->height, MWROP_SRCCOPY); + DeleteObject(SelectObject(hdcMem, hbmpOrg)); + DeleteDC(hdcMem); + EndPaint(hwnd, &ps); + break; + default: + return DefWindowProc( hwnd, msg, wp, lp); + } + return 0; +} + +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nShowCmd) +{ + MSG msg; + RECT rc; + + RegisterAppClass(); + GetWindowRect(GetDesktopWindow(), &rc); + + /* create penguin windows*/ + CreateWindowEx(0L, APPCHILD, "", WS_BORDER | WS_VISIBLE, + 10, 10, 50, 50, + GetDesktopWindow(), (HMENU)1000, NULL, NULL); + + CreateWindowEx(0L, APPCHILD, "", WS_BORDER | WS_VISIBLE, + 10, 70, 200, 200, + GetDesktopWindow(), (HMENU)1001, NULL, NULL); + + /* type ESC to quit...*/ + while( GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/mwin/mterm.c b/packages/services/gfx/mw/current/src/demos/mwin/mterm.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/mterm.c @@ -0,0 +1,333 @@ +/* + * Copyright (c) 1999 Greg Haerr + * + * Microwindows Terminal Emulator for Linux + * + * Yes, this is just a demo, and doesn't repaint contents on refresh. + */ + +#include +#include +#include +#include +#include +#include +#define MWINCLUDECOLORS +#include "windows.h" +#include "wintern.h" /* for MwRegisterFdInput*/ +#include "wintools.h" /* Draw3dInset*/ + +#define COLS 80 +#define ROWS 24 +#define XMARGIN 2 +#define YMARGIN 2 +#define FGCOLOR GREEN +#define BKCOLOR BLACK +#define FONTNAME SYSTEM_FIXED_FONT +/*#define FONTNAME OEM_FIXED_FONT*/ +#define APPCLASS "mterm" + +#if DOS_DJGPP +#define killpg kill +#define SIGCHLD 17 /* from Linux, not defined in DJGPP */ +#endif + +/* forward decls*/ +LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp); +void EmOutChar(HWND hwnd, int ch); +int CreatePtyShell(void); +int ReadPtyShell(int fd, char *buf, int count); +int WritePtyShell(int fd, char *buf, int count); +void ClosePtyShell(int fd); + +/* local data*/ +static int ttyfd = -1; +static int xpos = XMARGIN; +static int ypos = YMARGIN; +static int nCharWidth, nCharHeight; +static int nScreenWidth, nScreenHeight; + +int +RegisterAppClass(void) +{ + WNDCLASS wc; + + wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW; + wc.lpfnWndProc = (WNDPROC)WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = 0; + wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/ + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground = CreateSolidBrush(BKCOLOR); + wc.lpszMenuName = NULL; + wc.lpszClassName = APPCLASS; + RegisterClass( &wc); + return 1; +} + +HWND +CreateAppWindow(void) +{ + HWND hwnd; + HDC hdc; + int w, h; + RECT rc; + + GetWindowRect(GetDesktopWindow(), &rc); + w = rc.right - 40; + h = rc.bottom; + + /* determine TE size from font*/ + hdc = GetDC(NULL); + SelectObject(hdc, GetStockObject(FONTNAME)); + SetRect(&rc, 0, 0, 0, 0); + nCharHeight = DrawText(hdc, "m", 1, &rc, DT_CALCRECT); + nCharWidth = rc.right; + nScreenWidth = min(w, nCharWidth*COLS); + nScreenHeight = min(h, nCharHeight*ROWS); + ReleaseDC(NULL, hdc); + + hwnd = CreateWindowEx(0L, APPCLASS, + "Microwindows Terminal", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, + nScreenWidth+4, nScreenHeight+24, + NULL, (HMENU)1, NULL, NULL); + + return hwnd; +} + +LRESULT CALLBACK +WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + unsigned char ch; + HDC hdc; + RECT rc; + PAINTSTRUCT ps; + + switch(msg) { + case WM_CREATE: + ttyfd = CreatePtyShell(); + /*if(ttyfd == -1) + return -1;*/ + MwRegisterFdInput(hwnd, ttyfd); + xpos = XMARGIN; + ypos = YMARGIN; + break; + + case WM_DESTROY: + MwUnregisterFdInput(hwnd, ttyfd); + ClosePtyShell(ttyfd); + break; + + case WM_CHAR: + ch = (char)wp; + /* echo half duplex if CreatePtyShell() failed*/ + if(ttyfd == -1) { + EmOutChar(hwnd, ch); + if(ch == '\r') + EmOutChar(hwnd, '\n'); + } else + WritePtyShell(ttyfd, &ch, 1); + break; + + case WM_FDINPUT: + if(ReadPtyShell(ttyfd, &ch, 1) == 1) + EmOutChar(hwnd, ch); + break; + + case WM_PAINT: + hdc = BeginPaint(hwnd, &ps); + GetClientRect(hwnd, &rc); + Draw3dInset(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top); + EndPaint(hwnd, &ps); + break; + + default: + return DefWindowProc(hwnd, msg, wp, lp); + } + return 0; +} + +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nShowCmd) +{ + MSG msg; + extern MWIMAGEHDR image_car8; + + RegisterAppClass(); + MwSetDesktopWallpaper(&image_car8); + + CreateAppWindow(); + + /* type ESC to quit...*/ + while(GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return 0; +} + +void +EmOutChar(HWND hwnd, int ch) +{ + HDC hdc; + RECT rc; + + switch(ch) { + case '\r': + xpos = XMARGIN; + return; + case '\n': + ypos += nCharHeight; + GetClientRect(hwnd, &rc); + if(ypos > (ROWS-1)*nCharHeight + YMARGIN) { + ypos -= nCharHeight; + + /* scroll window using bitblt ;-)*/ + hdc = GetDC(hwnd); + BitBlt(hdc, XMARGIN, YMARGIN, rc.right-XMARGIN*2, + rc.bottom-nCharHeight-YMARGIN*2, + hdc, XMARGIN, nCharHeight+YMARGIN, SRCCOPY); + rc.top = ypos; + rc.left += XMARGIN; + rc.right -= XMARGIN; + rc.bottom -= YMARGIN; + FillRect(hdc, &rc, + (HBRUSH)GetClassLong(hwnd, GCL_HBRBACKGROUND)); + ReleaseDC(hwnd, hdc); + } + return; + case '\007': /* bel*/ + write(STDERR_FILENO, "\007", 1); + return; + case '\t': + xpos += nCharWidth; + while((xpos/nCharWidth) & 7) + EmOutChar(hwnd, ' '); + return; + case '\b': + if(xpos <= XMARGIN) + return; + xpos -= nCharWidth; + EmOutChar(hwnd, ' '); + xpos -= nCharWidth; + return; + } + + /* draw some text*/ + hdc = GetDC(hwnd); + SelectObject(hdc, GetStockObject(FONTNAME)); + SetBkColor(hdc, BKCOLOR); + SetTextColor(hdc, FGCOLOR); + SetRect(&rc, xpos, ypos, xpos+nCharWidth, ypos+nCharHeight); + ExtTextOut(hdc, xpos, ypos, ETO_OPAQUE, &rc, (char *)&ch, 1, NULL); + ReleaseDC(hwnd, hdc); + xpos += nCharWidth; + if(xpos > (COLS-1)*nCharWidth) { + xpos = XMARGIN; + EmOutChar(hwnd, '\n'); + } +} + +#if ELKS +#define SHELL "/bin/sash" +#else +#if DOS_DJGPP +#define SHELL "bash" +#else +#define SHELL "/bin/sh" +#endif +#endif + +static int pid; + +static void +ptysignaled(int signo) +{ + switch(signo) { + case SIGINT: /* interrupt*/ +#if !ELKS + /* this doesn't work, can anyone fix it?*/ + killpg(pid, SIGINT); +#endif + return; + case SIGCHLD: /* child status change - child exit*/ + DestroyWindow(GetActiveWindow()); + CreateAppWindow(); + return; + } + fprintf(stderr, "Uncaught signal %d\n", signo); +} + +/* + * Create a shell running through a pseudo tty, return the shell fd. + */ +int +CreatePtyShell(void) +{ + int n = 0; + int tfd; + char pty_name[12]; + char * argv[2]; + +again: + sprintf(pty_name, "/dev/ptyp%d", n); + if ((tfd = open(pty_name, O_RDWR | O_NONBLOCK)) < 0) { + if ((errno == EBUSY || errno == EIO) && n < 10) { + ++n; + goto again; + } + fprintf(stderr, "Can't create pty %s\n", pty_name); + return -1; + } + signal(SIGCHLD, ptysignaled); + signal(SIGINT, ptysignaled); + if ((pid = fork()) == -1) { + fprintf(stderr, "No processes\n"); + return -1; + } + if (!pid) { + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); + close(tfd); + + setsid(); + pty_name[5] = 't'; + if ((tfd = open(pty_name, O_RDWR)) < 0) { + fprintf(stderr, "Child: Can't open pty %s\n", pty_name); + exit(1); + } + dup2(tfd, STDIN_FILENO); + dup2(tfd, STDOUT_FILENO); + dup2(tfd, STDERR_FILENO); + /*if(!(argv[0] = getenv("SHELL")))*/ + argv[0] = SHELL; + argv[1] = NULL; + execv(argv[0], argv); + exit(1); + } + return tfd; +} + +int +ReadPtyShell(int fd, char *buf, int count) +{ + return read(fd, buf, count); +} + +int +WritePtyShell(int fd, char *buf, int count) +{ + return write(fd, buf, count); +} + +void +ClosePtyShell(int fd) +{ + if(ttyfd != -1) + close(fd); +} diff --git a/packages/services/gfx/mw/current/src/demos/mwin/mtest.c b/packages/services/gfx/mw/current/src/demos/mwin/mtest.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/mtest.c @@ -0,0 +1,72 @@ +#include + +LRESULT CALLBACK wproc(HWND,UINT,WPARAM,LPARAM); + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + PSTR szCmdLine, int iCmdShow) +{ + static char szAppName[]="HolaWin"; + HWND hwnd; + MSG msg; + WNDCLASS wndclass; + + wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = (WNDPROC)wproc; + wndclass.cbClsExtra =0; + wndclass.cbWndExtra =0; + wndclass.hInstance =0; + wndclass.hIcon =0; + wndclass.hCursor =0; + wndclass.hbrBackground =(HBRUSH)GetStockObject(LTGRAY_BRUSH); + wndclass.lpszMenuName =NULL; + wndclass.lpszClassName = szAppName; + + RegisterClass(&wndclass); + hwnd=CreateWindowEx(0L, + szAppName, + "Hola", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, + CW_USEDEFAULT, + 80, + 80, + NULL, + NULL, + NULL, + NULL); + + + ShowWindow(hwnd,iCmdShow); + UpdateWindow(hwnd); + + while (GetMessage(&msg,NULL,0,0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return msg.wParam; +} +LRESULT CALLBACK wproc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) +{ + HDC hdc; + PAINTSTRUCT ps; + RECT rect; + + switch (iMsg) { + case WM_CREATE: + break; + case WM_PAINT: + /*case WM_MOUSEFIRST:*/ + hdc=BeginPaint(hwnd,&ps); + GetClientRect(hwnd,&rect); + DrawText(hdc, "Hola, NOS", -1, &rect, + DT_SINGLELINE|DT_CENTER|DT_VCENTER); + EndPaint(hwnd,&ps); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hwnd,iMsg,wParam,lParam); + } + return (0); +} diff --git a/packages/services/gfx/mw/current/src/demos/mwin/mtest2.c b/packages/services/gfx/mw/current/src/demos/mwin/mtest2.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/mtest2.c @@ -0,0 +1,196 @@ +#define MWINCLUDECOLORS +#include + +LRESULT CALLBACK wproc(HWND,UINT,WPARAM,LPARAM); + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + PSTR szCmdLine, int iCmdShow) +{ + static char szAppName[]="HolaWin"; + HWND hwnd; + MSG msg; + WNDCLASS wndclass; + + int width, height; + RECT r; + HWND hlist,hedit; + + GetWindowRect(GetDesktopWindow(), &r); + width = height = r.right / 2; + + MwRegisterButtonControl(NULL); + MwRegisterEditControl(NULL); + MwRegisterListboxControl(NULL); + MwRegisterProgressBarControl(NULL); + MwRegisterStaticControl(NULL); + MwRegisterComboboxControl(NULL); + MwRegisterScrollbarControl(NULL); + + wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = (WNDPROC)wproc; + wndclass.cbClsExtra =0; + wndclass.cbWndExtra =0; + wndclass.hInstance =0; + wndclass.hIcon =0; + wndclass.hCursor =0; + wndclass.hbrBackground =(HBRUSH)GetStockObject(LTGRAY_BRUSH); + wndclass.lpszMenuName =NULL; + wndclass.lpszClassName = szAppName; + + RegisterClass(&wndclass); + hwnd=CreateWindowEx(0L, + szAppName, + "Hola", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, + CW_USEDEFAULT, + width, /* 80, */ + height, /* 80, */ + NULL, + NULL, + NULL, + NULL); +#if !ELKS + + hedit=CreateWindowEx(0L, "EDIT", + "OK", + WS_BORDER|WS_CHILD | WS_VISIBLE, + width * 5 / 8, 10, 100, 18, + hwnd, (HMENU)5, NULL, NULL); + + CreateWindowEx(0L, "PROGBAR", + "OK", + WS_BORDER|WS_CHILD | WS_VISIBLE, + width * 5 / 8, 32, 100, 18, + hwnd, (HMENU)6, NULL, NULL); + + hlist = CreateWindowEx(0L, "LISTBOX", + "OK", + WS_VSCROLL| + /*WS_HSCROLL|*/ + WS_BORDER|WS_CHILD | WS_VISIBLE, + width * 5 / 8, 54, 100, 54, + hwnd, (HMENU)7, NULL, NULL); + + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Cherry"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Apple"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Orange"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Banana"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Smooth"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"00000"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"11111"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"22222"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"33333"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"44444"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"55555"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"66666"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"77777"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"88888"); + SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"99999"); + + CreateWindowEx(0L, "BUTTON", + "Cancel", + WS_CHILD | WS_VISIBLE, + width * 5 / 8 + 50, 106+16+6, 50, 14, + hwnd, (HMENU)8, NULL, NULL); + + CreateWindowEx(0L, "STATIC", + "Static", + WS_CHILD | WS_VISIBLE, + width * 5 / 8, 106+34+6, 100, 18, + hwnd, (HMENU)9, NULL, NULL); +#if 0 + { + HWND hcombo; + + hcombo = CreateWindowEx(0L, "COMBOBOX", + "Combobox", +#if 0 + CBS_SIMPLE | /* edit+list */ +#endif +#if 0 + CBS_DROPDOWNLIST | /* static+pop */ +#endif +#if 1 + CBS_DROPDOWN | /* edit+pop */ +#endif + + WS_VSCROLL | WS_CHILD | WS_VISIBLE, + width * 5 / 8, 106+14+4+18+4, 100, (18*5), + hwnd, (HMENU)10, NULL, NULL); + + SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Cherry"); + SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Apple"); + SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Orange"); + SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Banana"); + } +#endif + +#if 1 + CreateWindowEx(0L, "SCROLLBAR", + "OK", + SBS_VERT | + WS_CHILD | WS_VISIBLE , + width * 5 / 8 -(18*2), 106+68, 18, 128, + hwnd, (HMENU)11, NULL, NULL); + + CreateWindowEx(0L, "SCROLLBAR", + "OK", + SBS_HORZ | + WS_CHILD | WS_VISIBLE , + width * 5 / 8 -18 , 106+68, 128, 18, + hwnd, (HMENU)12, NULL, NULL); +#endif + +#endif + + ShowWindow(hwnd,iCmdShow); + UpdateWindow(hwnd); + + while (GetMessage(&msg,NULL,0,0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return msg.wParam; +} +LRESULT CALLBACK wproc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) +{ + HDC hdc; + PAINTSTRUCT ps; + RECT rect; + HGDIOBJ oldfont; + + switch (iMsg) { + case WM_CREATE: + break; + case WM_PAINT: + /*case WM_MOUSEFIRST:*/ + hdc=BeginPaint(hwnd,&ps); + + /*GetClientRect(hwnd,&rc);*/ + /*Arc(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top, 0,0, 0,0);*/ + /*Pie(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top, 0,0, 0,0);*/ + + GetClientRect(hwnd,&rect); + oldfont=SelectObject(hdc,CreateFont(12, + 0,0,0,0,0,0,0,0,0,0,0, + FF_DONTCARE|DEFAULT_PITCH, + "HZXFONT")); + DrawText(hdc, "Hola, NOS, ¤¤¤å´ú¸Õ", -1, &rect, + DT_SINGLELINE|DT_CENTER|DT_VCENTER); + DeleteObject(SelectObject(hdc,oldfont)); + + /*for (i=0;i<100;i++) + SetPixel(hdc,i,i,BLUE);*/ + + EndPaint(hwnd,&ps); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hwnd,iMsg,wParam,lParam); + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/mwin/mtest_ksc.c b/packages/services/gfx/mw/current/src/demos/mwin/mtest_ksc.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/mtest_ksc.c @@ -0,0 +1,73 @@ +/* KSC5601 test program*/ +#include + +LRESULT CALLBACK wproc(HWND,UINT,WPARAM,LPARAM); + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + PSTR szCmdLine, int iCmdShow) +{ + static char szAppName[]="HolaWin"; + HWND hwnd; + MSG msg; + WNDCLASS wndclass; + + wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = (WNDPROC)wproc; + wndclass.cbClsExtra =0; + wndclass.cbWndExtra =0; + wndclass.hInstance =0; + wndclass.hIcon =0; + wndclass.hCursor =0; + wndclass.hbrBackground =(HBRUSH)GetStockObject(LTGRAY_BRUSH); + wndclass.lpszMenuName =NULL; + wndclass.lpszClassName = szAppName; + + RegisterClass(&wndclass); + hwnd=CreateWindowEx(0L, + szAppName, + "Hola", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, + CW_USEDEFAULT, + 200, + 200, + NULL, + NULL, + NULL, + NULL); + + + ShowWindow(hwnd,iCmdShow); + UpdateWindow(hwnd); + + while (GetMessage(&msg,NULL,0,0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return msg.wParam; +} +LRESULT CALLBACK wproc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) +{ + HDC hdc; + PAINTSTRUCT ps; + RECT rect; + + switch (iMsg) { + case WM_CREATE: + break; + case WM_PAINT: + /*case WM_MOUSEFIRST:*/ + hdc=BeginPaint(hwnd,&ps); + GetClientRect(hwnd,&rect); + DrawText(hdc, "Hola, NOS ¤¾¤¿¤¤ÇÑ", -1, &rect, + DT_SINGLELINE|DT_CENTER|DT_VCENTER); + EndPaint(hwnd,&ps); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hwnd,iMsg,wParam,lParam); + } + return (0); +} diff --git a/packages/services/gfx/mw/current/src/demos/mwin/muserfd.c b/packages/services/gfx/mw/current/src/demos/mwin/muserfd.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwin/muserfd.c @@ -0,0 +1,144 @@ +#include +#include +#include +#include + + +#if DOS_DJGPP | defined(__FreeBSD__) +#include +#endif + +#define MAX_TEST_FD (500) + +LRESULT CALLBACK wproc(HWND,UINT,WPARAM,LPARAM); + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + PSTR szCmdLine, int iCmdShow) +{ + static char szAppName[]="HolaWin"; + HWND hwnd; + WNDCLASS wndclass; + int random_fd[MAX_TEST_FD][2], fd, unreg_fd; + + wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = (WNDPROC)wproc; + wndclass.cbClsExtra =0; + wndclass.cbWndExtra =0; + wndclass.hInstance =0; + wndclass.hIcon =0; + wndclass.hCursor =0; + wndclass.hbrBackground =(HBRUSH)GetStockObject(LTGRAY_BRUSH); + wndclass.lpszMenuName =NULL; + wndclass.lpszClassName = szAppName; + + RegisterClass(&wndclass); + hwnd=CreateWindowEx(0L, + szAppName, + "Hola", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, + CW_USEDEFAULT, + 80, + 80, + NULL, + NULL, + NULL, + NULL); + + /* + * Create a random list of fd's to test the list + * code. + */ + + printf ("Select a random list of fd's to test with.\n"); + + for (fd = 0; fd < MAX_TEST_FD; fd++) + { + random_fd[fd][0] = random () % FD_SETSIZE; + random_fd[fd][1] = random () % 3; + } + + for (fd = 0; fd < MAX_TEST_FD; fd++) + { + switch (random_fd[fd][1]) + { + case 0: + MwRegisterFdInput (hwnd, random_fd[fd][0]); + break; + + case 1: + MwRegisterFdOutput (hwnd, random_fd[fd][0]); + break; + + case 2: + MwRegisterFdExcept (hwnd, random_fd[fd][0]); + break; + + default: + + printf ("Bad fd type, fd index = %i, type = %i !\n", + fd, random_fd[fd][1]); + return 1; + } + } + + unreg_fd = random () % MAX_TEST_FD; + + for (fd = 0; fd < MAX_TEST_FD; fd++) + { + switch (random_fd[unreg_fd][1]) + { + case 0: + MwUnregisterFdInput (hwnd, random_fd[unreg_fd][0]); + break; + + case 1: + MwUnregisterFdOutput (hwnd, random_fd[unreg_fd][0]); + break; + + case 2: + MwUnregisterFdExcept (hwnd, random_fd[unreg_fd][0]); + break; + + default: + + printf ("Bad fd type !\n"); + return 1; + } + + unreg_fd++; + if (unreg_fd >= MAX_TEST_FD) + unreg_fd = 0; + } + + + return 0; +} + +LRESULT CALLBACK wproc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) +{ + HDC hdc; + PAINTSTRUCT ps; + RECT rect; + + switch (iMsg) { + case WM_CREATE: + break; + case WM_PAINT: +#if 0 + case WM_MOUSEFIRST: +#endif + hdc=BeginPaint(hwnd,&ps); + GetClientRect(hwnd,&rect); + DrawText(hdc, "Hola, NOS", -1, &rect, + DT_SINGLELINE|DT_CENTER|DT_VCENTER); + EndPaint(hwnd,&ps); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hwnd,iMsg,wParam,lParam); + } + return (0); +} diff --git a/packages/services/gfx/mw/current/src/demos/mwobjects/Makefile b/packages/services/gfx/mw/current/src/demos/mwobjects/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwobjects/Makefile @@ -0,0 +1,51 @@ +############################################################################## +# +# MW Objects Makefile +# +# (c) Chris Johns 2000 +# +############################################################################## + +include $(CONFIG) + +# Do nothing for RTEMS +ifneq ($(ARCH), RTEMS) + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += +# Defines for preprocessor +DEFINES += + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +ifeq ($(OBJFRAMEWORK), Y) + +# List of objects to compile +CXOBJS = mwo-test.o + +all: default $(TOP)/bin/mwo-test + +endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### + +CCMWINLIBS = -lmwobjects -lmwin -lmwinlib -lmwengine -lmwdrivers -lmwfonts -lmwimages -lm + +$(TOP)/bin/mwo-test: mwo-test.o + $(CXX) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(CCMWINLIBS) + + +endif diff --git a/packages/services/gfx/mw/current/src/demos/mwobjects/mwo-test.cc b/packages/services/gfx/mw/current/src/demos/mwobjects/mwo-test.cc new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/mwobjects/mwo-test.cc @@ -0,0 +1,512 @@ +/* + * Copyright (c) 1999 Greg Haerr + * + * Demo program for Micro-Windows + */ + +#define MWINCLUDECOLORS +#include +#include + +extern MWIMAGEHDR image_microwin; +extern MWIMAGEHDR image_zion208; + +PMWIMAGEHDR image = &image_zion208; + +using namespace MicroWindowsObjects; + +class TestWindowClass + : public WindowClass +{ +public: + + TestWindowClass (LPCSTR lpszClassName); + +}; + +class TestChildWindow + : public Window +{ +public: + + TestChildWindow (); + + HWND create (LPCSTR lpszClassName, + HWND parent, + int x, int y, + int nWidth, int nHeight); + + void set_trace (bool t) + { trace = t; } + +protected: + + virtual LRESULT message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam); +private: + + bool trace; + +}; + +class TestWindow + : public Window +{ +public: + + TestWindow (LPCSTR lpszClassName, bool trace = false); + +private: + + bool trace; + Window button; + TestChildWindow image[3]; + +}; + +class Test3dWindow + : public Window +{ +public: + + Test3dWindow (LPCSTR lpszChild); + +protected: + + virtual LRESULT message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam); +private: + + vec1 gx; + vec1 gy; + + vec1 last_gx; + vec1 last_gy; + +}; + +class TestRoseWindow + : public TestWindow +{ +public: + + TestRoseWindow (LPCSTR lpszClassName, bool trace = false); + +protected: + + virtual LRESULT message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam); +}; + +class TestCircleWindow + : public TestWindow +{ +public: + + TestCircleWindow (LPCSTR lpszClassName, bool trace = false); + +protected: + + virtual LRESULT message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam); +}; + +class TestDaisyWindow + : public TestWindow +{ +public: + + TestDaisyWindow (LPCSTR lpszClass, bool trace = false); + +protected: + + virtual LRESULT message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam); +}; + +class TestFileDescriptor + : public FileDescriptor +{ +public: + + void do_fd_test (); + +protected: + + LRESULT read (); + LRESULT write (); + LRESULT except (); +}; + +class TestApplication + : public Application +{ + enum { GROUPS = 2 }; + +public: + + TestApplication (); + +protected: + + virtual int initialise (); + virtual int shutdown (); + +private: + + TestWindowClass main_class; + + Test3dWindow *t3d [GROUPS]; + TestRoseWindow *tr [GROUPS]; + TestCircleWindow *tc [GROUPS]; + TestDaisyWindow *td [GROUPS]; + + TestFileDescriptor *fd; + +}; + +TestWindowClass::TestWindowClass (LPCSTR lpszClassName) + : WindowClass (lpszClassName, + CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW) +{ + set_background ((HBRUSH) GetStockObject (LTGRAY_BRUSH)); +} + +TestChildWindow::TestChildWindow () +{ +} + +HWND +TestChildWindow::create (LPCSTR lpszClassName, + HWND parent, + int x, int y, + int nWidth, int nHeight) +{ + return Window::create (0, + lpszClassName, + "", + WS_BORDER | WS_CHILD | WS_VISIBLE, + x, y, nWidth, nHeight, + parent, 0, 0, 0); +} + +LRESULT +TestChildWindow::message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam) +{ + Paint paint (*this); + + switch (msg) + { + case WM_PAINT: + paint.begin (); + + DrawDIB (paint, paint.left (), paint.top (), image); + + paint.end (); + break; + + default: + return Window::message_handler (msg, wParam, lParam); + } + return 0; +} + +TestWindow::TestWindow (LPCSTR lpszClassName, bool trace) + : trace (trace) +{ + Rect rc (GetDesktopWindow ()); + int width; + int height; + + width = height = rc.right () / 2; + + if (trace) + cout << "create: hwnd=" << get_handle () + << " " << rc << endl; + + create (0, lpszClassName, "Micro C++ Application", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, + width, height, + 0, 0, 0, 0); + + button.create (0, "BUTTON", "Ok", + WS_CHILD | WS_VISIBLE, + width * 5 / 8, 10, 50, 14, + *this, 0, 0, 0); + + image[0].create (lpszClassName, *this, + 4, 4, + width / 3, height / 3); + image[1].create (lpszClassName, *this, + width / 3, height / 3, + width / 3, height / 3); + image[2].create (lpszClassName, *this, + width * 3 / 5, height * 3 / 5, + width * 2 / 3, height * 2 / 3); + + image[0].set_trace (trace); + image[1].set_trace (trace); + image[2].set_trace (trace); + +} + +Test3dWindow::Test3dWindow (LPCSTR lpszClassName) + : gx (0), + gy (0), + last_gx (0), + last_gy (0) +{ + Rect rect (GetDesktopWindow ()); + int width; + int height; + + width = height = rect.right () / 2; + + create (0, lpszClassName, "Micro C++ Application", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, + width, height, + 0, 0, 0, 0); +} + +LRESULT +Test3dWindow::message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam) +{ + Paint paint (*this, lParam); + Rect rc; + + switch (msg) + { + case WM_PAINT: + paint.begin (true); + + look3 (-2 * gx, -2 * gy, 1.2); + drawgrid (-8.0, 8.0, 10, -8.0, 8.0, 10); + + last_gx = gx; + last_gy = gy; + + paint.end (); + break; + + case WM_MOUSEMOVE: + + rc.get_client (*this); + gx = (vec1) paint.get_point_x () / rc.right (); + gy = (vec1) paint.get_point_y () / rc.bottom (); + + if (gx > last_gx || gy > last_gy) + invalidate_rect (0, FALSE); + break; + + default: + return Window::message_handler (msg, wParam, lParam); + } + return 0; +} + +TestRoseWindow::TestRoseWindow (LPCSTR lpszClassName, bool trace) + : TestWindow (lpszClassName, trace) +{ +} + +LRESULT +TestRoseWindow::message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam) +{ + Paint paint (*this); + + switch (msg) + { + case WM_PAINT: + paint.begin (true); + + rose (1.0, 7, 13); + + paint.end (); + break; + + default: + return Window::message_handler (msg, wParam, lParam); + } + return 0; +} + +TestCircleWindow::TestCircleWindow (LPCSTR lpszClassName, bool trace) + : TestWindow (lpszClassName, trace) +{ +} + +LRESULT +TestCircleWindow::message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam) +{ + Paint paint (*this); + + switch (msg) + { + case WM_PAINT: + paint.begin (true); + + setcolor3 (BLACK); + circle3 (1.0); + + paint.end (); + break; + + default: + return Window::message_handler (msg, wParam, lParam); + } + return 0; +} + +TestDaisyWindow::TestDaisyWindow (LPCSTR lpszClassName, bool trace) + : TestWindow (lpszClassName, trace) +{ +} + +LRESULT +TestDaisyWindow::message_handler (UINT msg, + WPARAM wParam, + LPARAM lParam) +{ + Paint paint (*this); + + switch (msg) + { + case WM_PAINT: + paint.begin (true); + + setcolor3 (BLUE); + daisy (1.0, 20); + + paint.paint_3d (); + + paint.text_out (10, 250, "Date built : %s", __DATE__); + + paint.end (); + break; + + case WM_LBUTTONDOWN: + cout << "left down : " << *this << endl; + SendMessage (*this, WM_FDINPUT, 200, 0); + return Window::message_handler (msg, wParam, lParam); + break; + + case WM_RBUTTONDOWN: + cout << "right down : " << *this << endl; + SendMessage (*this, WM_FDOUTPUT, 200, 0); + return Window::message_handler (msg, wParam, lParam); + break; + + case WM_LBUTTONDBLCLK: + cout << "double left : " << *this << endl; + SendMessage (*this, WM_FDEXCEPT, 200, 0); + return Window::message_handler (msg, wParam, lParam); + break; + + default: + return Window::message_handler (msg, wParam, lParam); + } + return 0; +} + +void +TestFileDescriptor::do_fd_test () +{ +} + +LRESULT +TestFileDescriptor::read () +{ + cout << "test read fd for `" << *get_window () << "' and fd " << *this << endl; + return 0; +} + +LRESULT +TestFileDescriptor::write () +{ + cout << "test write fd for `" << *get_window () << "' and fd " << *this << endl; + return 0; +} + +LRESULT +TestFileDescriptor::except () +{ + cout << "test except fd for `" << *get_window () << "' and fd " << *this << endl; + return 0; +} + +TestApplication::TestApplication () + : Application (image_microwin), + main_class ("test") +{ + for (int i = 0; i < GROUPS; i++) + { + t3d [i] = 0; + tr [i] = 0; + tc [i] = 0; + td [i] = 0; + } +} + +int +TestApplication::initialise () +{ + main_class.register_class (); + + for (int i = 0; i < GROUPS; i++) + { + t3d [i] = new Test3dWindow ("test"); + tr [i] = new TestRoseWindow ("test"); + tc [i] = new TestCircleWindow ("test"); + td [i] = new TestDaisyWindow ("test"); + } + + fd = new TestFileDescriptor (); + + cout << "attach to " << *td[GROUPS - 1] << endl; + + td[GROUPS - 1]->attach (200, *fd); + + return 0; +} + +int +TestApplication::shutdown () +{ + for (int i = 0; i < GROUPS; i++) + { + if (t3d [i]) + delete t3d [i]; + t3d [i] = 0; + + if (tr [i]) + delete tr [i]; + tr [i] = 0; + + if (tc [i]) + delete tc [i]; + tc [i] = 0; + + if (td [i]) + delete td [i]; + td [i] = 0; + } + + return 0; +} + +TestApplication test_application; diff --git a/packages/services/gfx/mw/current/src/demos/nanowm/Makefile b/packages/services/gfx/mw/current/src/demos/nanowm/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanowm/Makefile @@ -0,0 +1,67 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000, 2002 Martin Jolicoeur, Greg Haerr +############################################################################## + +ifndef TOP +TOP = ../.. +CONFIG = $(TOP)/config +endif + +include $(CONFIG) + +VPATH := $(TOP)/demos/nanowm + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += +# Defines for preprocessor +DEFINES += + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +ifeq ($(NANOWM), Y) + +# If you want to create a library with the objects files, define the name here +LIBNAME = + +# List of objects to compile +OBJS = nanowm.o events.o wlist.o clients.o actions.o + +ifeq ($(ARCH), ECOS) +TARGET = $(BUILD)/bin/nanowm.o +else +TARGET = $(BUILD)/bin/nanowm +endif + +all: default $(TARGET) + +endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### +ifeq ($(SHAREDLIBS), Y) +$(TOP)/bin/nanowm: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(CCNANOXCLIENTLIBS) +else +ifeq ($(ARCH), ECOS) +$(BUILD)/bin/nanowm.o: $(OBJS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -Wl,-r -Wl,--defsym -Wl,nanowm_main=main -o XX.o + $(NM) XX.o | grep -v _main | grep ' T' | awk -f $(TOP)/ecos/retain.awk | xargs $(OBJCOPY) XX.o $@ + rm -f XX.o +else +$(TOP)/bin/nanowm: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS) +endif +endif diff --git a/packages/services/gfx/mw/current/src/demos/nanowm/actions.c b/packages/services/gfx/mw/current/src/demos/nanowm/actions.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanowm/actions.c @@ -0,0 +1,502 @@ +/* + * NanoWM - Window Manager for Nano-X + * + * Copyright (C) 2000 Greg Haerr + * Copyright (C) 2000 Alex Holden + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" +#include "nxdraw.h" +/* Uncomment this if you want debugging output from this file */ +/*#define DEBUG*/ + +#include "nanowm.h" + +/* uncomment this line to perform outline move operations*/ +/*#define OUTLINE_MOVE*/ + +void redraw_ncarea(win *window) +{ + GR_WINDOW_INFO info; + GR_WM_PROPERTIES props; + GR_BOOL active; + + Dprintf("container_exposure window %d\n", window->wid); + + GrGetWindowInfo(window->wid, &info); + + GrGetWMProperties(window->clientid, &props); + + /* + * Check for invalid window. This will be the + * case if the client exited, and we're just + * getting the paint notification for our parent. + */ + if (props.flags == 0) + return; + + active = (window->clientid == GrGetFocus()); + nxPaintNCArea(window->wid, info.width, info.height, props.title, + active, props.props); +} + +void container_exposure(win *window, GR_EVENT_EXPOSURE *event) +{ + Dprintf("container_exposure window %d\n", window->wid); + + redraw_ncarea(window); +} + +static GR_BOOL +PtInRect(GR_RECT *prc, GR_SIZE x, GR_SIZE y) +{ + return (x >= prc->x && x < (prc->x+prc->width) && + y >= prc->y && y < (prc->y+prc->height)); +} + +void container_buttondown(win *window, GR_EVENT_BUTTON *event) +{ + struct pos_size *pos; + GR_RECT r; + GR_COORD cxborder = 0, cyborder = 0; + GR_WINDOW_INFO info; + GR_GC_ID gc; + Dprintf("container_buttondown window %d\n", window->wid); + + if(window->active) return; + + GrGetWindowInfo(window->wid, &info); + + /* calc border sizes*/ + if (info.props & GR_WM_PROPS_BORDER) { + cxborder = 1; + cyborder = 1; + } + if (info.props & GR_WM_PROPS_APPFRAME) { + cxborder = CXBORDER; + cyborder = CYBORDER; + } + + /* Check for close box press*/ + if ((info.props & (GR_WM_PROPS_CAPTION|GR_WM_PROPS_CLOSEBOX)) == + (GR_WM_PROPS_CAPTION|GR_WM_PROPS_CLOSEBOX)) { + + /* Get close box rect*/ + r.x = info.width - CXCLOSEBOX - cxborder - 2; + r.y = cyborder + 2; + r.width = CXCLOSEBOX; + r.height = CYCLOSEBOX; + + /* Check mousedn in close box*/ + if (PtInRect(&r, event->x, event->y)) { + /* this may or not close the window...*/ + GrCloseWindow(window->clientid); + return; + } + } + + /* Set focus on button down*/ + GrSetFocus(window->clientid); +/* + * Note: Resize seems to cause lots of trouble since the resize "handle" + * does not seem to be visible/advertized. Thus at any touch, the window + * may get resized and it is often impossible to recover + */ + + /* check for corner resize */ + r.x = info.width - 5; + r.y = info.height - 5; + r.width = 5; + r.height = 5; + + if(PtInRect(&r,event->x, event->y)) { + + struct pos_size * pos; + + if(!window->data) + if(!(window->data = malloc(sizeof(struct pos_size)))) return; + + window->sizing = GR_TRUE; + pos = (struct pos_size*)window->data; + + /* save off the width/height offset from the window manager */ + GrGetWindowInfo(window->clientid,&info); + pos->xoff = -info.width; + pos->yoff = -info.height; + + GrGetWindowInfo(window->wid,&info); + pos->xoff += info.width; + pos->yoff += info.height; + + gc = GrNewGC(); + GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN); + GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, info.width, info.height); + GrDestroyGC(gc); + + /* save this rectangle's width/height so we can erase it later */ + pos->width = info.width; + pos->height = info.height; + + return; + } + + /* if not in caption, return (FIXME, not calc'd exactly)*/ + if (!(info.props & GR_WM_PROPS_CAPTION)) + return; + + /* Get caption box rect*/ + r.x = cxborder; + r.y = cyborder; + r.width = info.width - cxborder*2; + r.height = CYCAPTION; + + /* Check for mousedn in caption box*/ + if (!PtInRect(&r, event->x, event->y)) + return; + + /* Raise window if mouse down and allowed*/ + if (!(info.props & GR_WM_PROPS_NORAISE)) + GrRaiseWindow(window->wid); + + /* Don't allow window move if NOMOVE property set*/ + if (info.props & GR_WM_PROPS_NOMOVE) + return; + + if(!window->data) + if(!(window->data = malloc(sizeof(struct pos_size)))) return; + + pos = (struct pos_size *) window->data; + + GrGetWindowInfo(window->wid,&info); + + pos->xoff = event->x; + pos->yoff = event->y; + +#ifdef OUTLINE_MOVE + pos->xorig = info.x; + pos->yorig = info.y; + pos->width = info.width; + pos->height = info.height; + + gc = GrNewGC(); + GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN); + GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, info.width, info.height); + GrDestroyGC(gc); +#endif + window->active = GR_TRUE; +} + +void container_buttonup(win *window, GR_EVENT_BUTTON *event) +{ + Dprintf("container_buttonup window %d\n", window->wid); + + if(window->active) { + struct pos_size * pos = (struct pos_size *)window->data; +#ifdef OUTLINE_MOVE + GR_GC_ID gc; + gc = GrNewGC(); + GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN); + GrRect(GR_ROOT_WINDOW_ID,gc,pos->xorig, pos->yorig, pos->width, pos->height); + + GrMoveWindow(window->wid, pos->xorig, pos->yorig); + +#endif + free(pos); + window->active = GR_FALSE; + window->data = 0; + } + + if(window->sizing) { + GR_WINDOW_INFO info; + GR_GC_ID gc; + + struct pos_size * pos = (struct pos_size *)window->data; + + gc = GrNewGC(); + GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN); + + GrGetWindowInfo(window->wid, &info); + + GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, pos->width, pos->height); + + GrResizeWindow(window->wid,event->rootx - info.x, event->rooty - info.y); + GrResizeWindow(window->clientid,event->rootx - info.x - pos->xoff, + event->rooty - info.y - pos->yoff); + GrDestroyGC(gc); + free(window->data); + window->sizing = GR_FALSE; + window->data = 0; + } +} + +void container_mousemoved(win *window, GR_EVENT_MOUSE *event) +{ + struct pos_size *pos; + GR_WINDOW_INFO info; + GR_GC_ID gc; + + Dprintf("container_mousemoved window %d\n", window->wid); + + if(window->sizing) { + + struct pos_size * pos = (struct pos_size*)window->data; + GrGetWindowInfo(window->wid, &info); + + gc = GrNewGC(); + GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN); + + /* erase old rectangle */ + GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, pos->width, pos->height); + /* draw new one */ + GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, + event->rootx - info.x, event->rooty - info.y); + GrDestroyGC(gc); + + /* save this new rectangle's width, height */ + /* I know, this shouldn't be stored in x/y, but... */ + pos->width = event->rootx - info.x; + pos->height = event->rooty - info.y; + + return; + } + + if(!window->active) return; + + pos = (struct pos_size *) window->data; + +#ifdef OUTLINE_MOVE + gc = GrNewGC(); + GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN); + GrRect(GR_ROOT_WINDOW_ID,gc,pos->xorig, pos->yorig, pos->width, pos->height); + GrRect(GR_ROOT_WINDOW_ID,gc,event->rootx - pos->xoff, event->rooty - pos->yoff, + pos->width, pos->height); + + pos->xorig = event->rootx - pos->xoff; + pos->yorig = event->rooty - pos->yoff; + + GrDestroyGC(gc); +#else + GrMoveWindow(window->wid, event->rootx - pos->xoff, + event->rooty - pos->yoff); +#endif +} + +#if 0000 +void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event) +{ + win *pwin = find_window(window->pid); + struct clientinfo *ci = pwin->data; + GR_WM_PROPERTIES prop; + + Dprintf("topbar_exposure window %d\n", window->wid); + + GrGetWMProperties(ci->cid, &prop); + if (prop.title) + GrText(window->wid, buttonsgc, 0, 0, prop.title, -1, + GR_TFASCII|GR_TFTOP); +} + +void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event) +{ + Dprintf("closebutton_exposure window %d\n", window->wid); + + GrBitmap(window->wid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, + TITLE_BAR_HEIGHT, window->active ? closebutton_pressed : + closebutton_notpressed); +} + +void topbar_buttondown(win *window, GR_EVENT_BUTTON *event) +{ + struct position *pos; + + Dprintf("topbar_buttondown window %d\n", window->wid); + + GrRaiseWindow(window->pid); + + if(window->active) return; + + if(!window->data) + if(!(window->data = malloc(sizeof(struct position)))) return; + + pos = (struct position *) window->data; + + pos->x = event->x + TITLE_BAR_HEIGHT; /* actually width*/ + pos->y = event->y; + + window->active = GR_TRUE; +} + +void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event) +{ + GR_WINDOW_INFO wi; + struct pos_size *pos; + + Dprintf("resizebar_buttondown window %d\n", window->wid); + + GrRaiseWindow(window->pid); + + if(window->active) return; + + if(!window->data) + if(!(window->data = malloc(sizeof(struct pos_size)))) return; + + pos = (struct pos_size *) window->data; + + GrGetWindowInfo(window->pid, &wi); + + pos->xoff = event->x; + pos->yoff = event->y; + pos->xorig = wi.x; + pos->yorig = wi.y; + pos->width = wi.width; + pos->height = wi.height; + + window->active = GR_TRUE; +} + +void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event) +{ + Dprintf("closebutton_buttondown window %d\n", window->wid); + + GrRaiseWindow(window->pid); + + window->active = GR_TRUE; + closebutton_exposure(window, NULL); +} + + +void topbar_buttonup(win *window, GR_EVENT_BUTTON *event) +{ + Dprintf("topbar_buttonup window %d\n", window->wid); + + window->active = GR_FALSE; +} + +void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event) +{ + win *pwin = find_window(window->pid); + struct clientinfo *ci = pwin->data; + + Dprintf("closebutton_buttonup window %d\n", window->wid); + + window->active = GR_FALSE; + closebutton_exposure(window, NULL); + + GrCloseWindow(ci->cid); +} + +void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event) +{ + struct position *pos; + GR_WM_PROPERTIES props; + + Dprintf("topbar_mousemoved window %d\n", window->wid); + + if(!window->active) return; + + pos = (struct position *) window->data; + + /* turn off background erase draw while moving*/ + GrGetWMProperties(window->pid, &props); + props.flags = GR_WM_FLAGS_PROPS; + props.props |= GR_WM_PROPS_NOBACKGROUND; + GrSetWMProperties(window->pid, &props); + + GrMoveWindow(window->pid, event->rootx - pos->x, + event->rooty - pos->y); + + props.props &= ~GR_WM_PROPS_NOBACKGROUND; + GrSetWMProperties(window->pid, &props); +} + +void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event) +{ + GR_COORD newx; + GR_SIZE newwidth; + struct pos_size *pos; + + Dprintf("leftbar_mousemoved window %d\n", window->wid); + + if(!window->active) return; + + pos = (struct pos_size *) window->data; + + newx = event->rootx - pos->xoff; + newwidth = pos->width + pos->xorig - event->rootx - pos->xoff; + + GrMoveWindow(window->pid, newx, pos->yorig); + GrResizeWindow(window->pid, newwidth, pos->height); +} + +void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event) +{ + GR_COORD newx; + GR_SIZE newwidth, newheight; + struct pos_size *pos; + + Dprintf("leftresize_mousemoved window %d\n", window->wid); + + if(!window->active) return; + + pos = (struct pos_size *) window->data; + + newx = event->rootx - pos->xoff; + newheight = event->rooty - pos->yorig; + newwidth = pos->width + pos->xorig - event->rootx - pos->xoff; + + GrMoveWindow(window->pid, newx, pos->yorig); + GrResizeWindow(window->pid, newwidth, newheight); +} + +void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event) +{ + GR_SIZE newheight; + struct pos_size *pos; + + Dprintf("bottombar_mousemoved window %d\n", window->wid); + + if(!window->active) return; + + pos = (struct pos_size *) window->data; + + newheight = event->rooty - pos->yorig; + + GrResizeWindow(window->pid, pos->width, newheight); +} + +void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event) +{ + GR_SIZE newwidth, newheight; + struct pos_size *pos; + + Dprintf("rightresize_mousemoved window %d\n", window->wid); + + if(!window->active) return; + + pos = (struct pos_size *) window->data; + + newheight = event->rooty - pos->yorig; + newwidth = event->rootx - pos->xorig; + + GrResizeWindow(window->pid, newwidth, newheight); +} + +void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event) +{ + GR_SIZE newwidth; + struct pos_size *pos; + + Dprintf("rightbar_mousemoved window %d\n", window->wid); + + if(!window->active) return; + + pos = (struct pos_size *) window->data; + + newwidth = event->rootx - pos->xorig; + + GrResizeWindow(window->pid, newwidth, pos->height); + +} +#endif /* 0000*/ diff --git a/packages/services/gfx/mw/current/src/demos/nanowm/clients.c b/packages/services/gfx/mw/current/src/demos/nanowm/clients.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanowm/clients.c @@ -0,0 +1,373 @@ +/* + * NanoWM - Window Manager for Nano-X + * + * Copyright (C) 2000 Greg Haerr + * Copyright (C) 2000 Alex Holden + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" +#include "nxdraw.h" +/* Uncomment this if you want debugging output from this file */ +/*#define DEBUG*/ + +#include "nanowm.h" + +/* default window style for GR_WM_PROPS_APPWINDOW*/ +#define DEFAULT_WINDOW_STYLE (GR_WM_PROPS_APPFRAME | GR_WM_PROPS_CAPTION |\ + GR_WM_PROPS_CLOSEBOX) + +static GR_COORD lastx = FIRST_WINDOW_LOCATION; +static GR_COORD lasty = FIRST_WINDOW_LOCATION; + +/* + * A new client window has been mapped, so we need to reparent and decorate it. + * Returns -1 on failure or 0 on success. + */ +int new_client_window(GR_WINDOW_ID wid) +{ + win window; + GR_WINDOW_ID pid; + GR_WINDOW_INFO winfo; + GR_COORD x, y, width, height, xoffset, yoffset; + GR_WM_PROPS style; + GR_WM_PROPERTIES props; + + /* get client window information*/ + GrGetWindowInfo(wid, &winfo); + style = winfo.props; + + /* if not redecorating or not child of root window, return*/ + if (winfo.parent != GR_ROOT_WINDOW_ID || + (style & GR_WM_PROPS_NODECORATE)) + return 0; + + /* deal with replacing borders with window decorations*/ + if (winfo.bordersize) { + /* + * For complex reasons, it's easier to unmap, + * remove the borders, and then map again, + * rather than try to recalculate the window + * position in the server w/o borders. By + * the time we get this event, the window has + * already been painted with borders... + * This currently causes a screen flicker as + * the window is painted twice. The workaround + * is to create the window without borders in + * the first place. + */ + GrUnmapWindow(wid); + + /* remove client borders, if any*/ + props.flags = style | GR_WM_FLAGS_BORDERSIZE; + props.bordersize = 0; + GrSetWMProperties(wid, &props); + + /* remap the window without borders, call this routine again*/ + GrMapWindow(wid); + return 0; + } + + /* if default decoration style asked for, set real draw bits*/ + if ((style & GR_WM_PROPS_APPMASK) == GR_WM_PROPS_APPWINDOW) { + GR_WM_PROPERTIES pr; + + style = (style & ~GR_WM_PROPS_APPMASK)|DEFAULT_WINDOW_STYLE; + pr.flags = GR_WM_FLAGS_PROPS; + pr.props = style; + GrSetWMProperties(wid, &pr); + } + + /* determine container widths and client child window offsets*/ + if (style & GR_WM_PROPS_APPFRAME) { + width = winfo.width + CXFRAME; + height = winfo.height + CYFRAME; + xoffset = CXBORDER; + yoffset = CYBORDER; + } else if (style & GR_WM_PROPS_BORDER) { + width = winfo.width + 2; + height = winfo.height + 2; + xoffset = 1; + yoffset = 1; + } else { + width = winfo.width; + height = winfo.height; + xoffset = 0; + yoffset = 0; + } + if (style & GR_WM_PROPS_CAPTION) { + height += CYCAPTION; + yoffset += CYCAPTION; + if (style & GR_WM_PROPS_APPFRAME) { + /* extra line under caption with appframe*/ + ++height; + ++yoffset; + } + } + + /* determine x,y window location*/ + if (style & GR_WM_PROPS_NOAUTOMOVE) { + x = winfo.x; + y = winfo.y; + } else { + /* We could proably use a more intelligent algorithm here */ + x = lastx + WINDOW_STEP; + if((x + width) > si.cols) + x = FIRST_WINDOW_LOCATION; + lastx = x; + y = lasty + WINDOW_STEP; + if((y + height) > si.rows) + y = FIRST_WINDOW_LOCATION; + lasty = y; + } + + /* create container window*/ + pid = GrNewWindow(GR_ROOT_WINDOW_ID, x, y, width, height, + 0, LTGRAY, BLACK); + window.wid = pid; + window.pid = GR_ROOT_WINDOW_ID; + window.type = WINDOW_TYPE_CONTAINER; + window.sizing = GR_FALSE; + window.active = 0; + window.data = NULL; + window.clientid = wid; + add_window(&window); + + /* don't erase background of container window*/ + props.flags = GR_WM_FLAGS_PROPS; + props.props = style | GR_WM_PROPS_NOBACKGROUND; + GrSetWMProperties(pid, &props); + + Dprintf("New client window %d container %d\n", wid, pid); + + GrSelectEvents(pid, GR_EVENT_MASK_CHLD_UPDATE + | GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_BUTTON_DOWN + | GR_EVENT_MASK_MOUSE_POSITION | GR_EVENT_MASK_EXPOSURE); + + /* reparent client to container window*/ + /* must map before reparent (nano-x bug)*/ + GrMapWindow(pid); + GrReparentWindow(wid, pid, xoffset, yoffset); + + GrSetFocus(wid); /* force fixed focus*/ + + /* add client window*/ + window.wid = wid; + window.pid = pid; + window.type = WINDOW_TYPE_CLIENT; + window.sizing = GR_FALSE; + window.active = 0; + window.clientid = 0; + window.data = NULL; + add_window(&window); + +#if 0000 + /* add system utility button*/ + nid = GrNewWindow(pid, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, + LTGRAY, BLACK); + window.wid = nid; + window.pid = pid; + window.type = WINDOW_TYPE_UTILITYBUTTON; + window.active = GR_FALSE; + window.data = NULL; + add_window(&window); + + GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP + | GR_EVENT_MASK_EXPOSURE + | GR_EVENT_MASK_MOUSE_EXIT); + GrMapWindow(nid); + GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, + utilitybutton_notpressed); + + nid = GrNewWindow(pid, TITLE_BAR_HEIGHT + 1, 1, width - (4 * + TITLE_BAR_HEIGHT) - 3, TITLE_BAR_HEIGHT - 3, 1, LTGRAY, + BLACK); + window.wid = nid; + window.pid = pid; + window.type = WINDOW_TYPE_TOPBAR; + window.active = GR_FALSE; + window.data = NULL; + + add_window(&window); + + GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP + | GR_EVENT_MASK_EXPOSURE + | GR_EVENT_MASK_MOUSE_POSITION); + GrMapWindow(nid); + + nid = GrNewWindow(pid, width - (3 * TITLE_BAR_HEIGHT), 0, + TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK); + window.wid = nid; + window.pid = pid; + window.type = WINDOW_TYPE_ICONISEBUTTON; + window.active = GR_FALSE; + window.data = NULL; + add_window(&window); + + GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP + | GR_EVENT_MASK_EXPOSURE + | GR_EVENT_MASK_MOUSE_EXIT); + GrMapWindow(nid); + GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, + iconisebutton_notpressed); + + nid = GrNewWindow(pid, width - (2 * TITLE_BAR_HEIGHT), 0, + TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK); + window.wid = nid; + window.pid = pid; + window.type = WINDOW_TYPE_MAXIMISEBUTTON; + window.active = GR_FALSE; + window.data = NULL; + add_window(&window); + + GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP + | GR_EVENT_MASK_EXPOSURE + | GR_EVENT_MASK_MOUSE_EXIT); + GrMapWindow(nid); + GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, + maximisebutton_notpressed); + + nid = GrNewWindow(pid, width - TITLE_BAR_HEIGHT, 0, + TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK); + window.wid = nid; + window.pid = pid; + window.type = WINDOW_TYPE_CLOSEBUTTON; + window.active = GR_FALSE; + window.data = NULL; + add_window(&window); + + GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP + | GR_EVENT_MASK_EXPOSURE + | GR_EVENT_MASK_MOUSE_EXIT); + GrMapWindow(nid); + GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, + closebutton_notpressed); + + nid = GrNewWindow(pid, 1, TITLE_BAR_HEIGHT + 1, BORDER_WIDTHS - 2, + height - TITLE_BAR_HEIGHT - BORDER_WIDTHS - 1, + 1, LTGRAY, BLACK); + window.wid = nid; + window.pid = pid; + window.type = WINDOW_TYPE_LEFTBAR; + window.active = GR_FALSE; + window.data = NULL; + + add_window(&window); + + GrSetCursor(nid, horizontal_resize_columns, horizontal_resize_rows, + horizontal_resize_hotx, horizontal_resize_hoty, + BLACK, WHITE, horizontal_resize_fg, + horizontal_resize_bg); + + GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP + | GR_EVENT_MASK_MOUSE_POSITION); + + GrMapWindow(nid); + + nid = GrNewWindow(pid, 1, height - BORDER_WIDTHS + 1, BORDER_WIDTHS - 2, + BORDER_WIDTHS - 2, 1, LTGRAY, BLACK); + window.wid = nid; + window.pid = pid; + window.type = WINDOW_TYPE_LEFTRESIZE; + window.active = GR_FALSE; + window.data = NULL; + + + add_window(&window); + + GrSetCursor(nid, lefthand_resize_columns, lefthand_resize_rows, + lefthand_resize_hotx, lefthand_resize_hoty, + BLACK, WHITE, lefthand_resize_fg, lefthand_resize_bg); + + GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP + | GR_EVENT_MASK_MOUSE_POSITION); + + GrMapWindow(nid); + + nid = GrNewWindow(pid, BORDER_WIDTHS, height - BORDER_WIDTHS + 1, + width - (2 * BORDER_WIDTHS), BORDER_WIDTHS - 2, 1, + LTGRAY, BLACK); + window.wid = nid; + window.pid = pid; + window.type = WINDOW_TYPE_BOTTOMBAR; + window.active = GR_FALSE; + window.data = NULL; + add_window(&window); + + GrSetCursor(nid, vertical_resize_columns, vertical_resize_rows, + vertical_resize_hotx, vertical_resize_hoty, + BLACK, WHITE, vertical_resize_fg, vertical_resize_bg); + + GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP + | GR_EVENT_MASK_MOUSE_POSITION); + + GrMapWindow(nid); + + nid = GrNewWindow(pid, width - BORDER_WIDTHS + 1, + height - BORDER_WIDTHS + 1, BORDER_WIDTHS - 2, + BORDER_WIDTHS - 2, 1, LTGRAY, BLACK); + window.wid = nid; + window.pid = pid; + window.type = WINDOW_TYPE_RIGHTRESIZE; + window.active = GR_FALSE; + window.data = NULL; + + add_window(&window); + + GrSetCursor(nid, righthand_resize_columns, righthand_resize_rows, + righthand_resize_hotx, righthand_resize_hoty, + BLACK, WHITE, righthand_resize_fg, righthand_resize_bg); + + GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP + | GR_EVENT_MASK_MOUSE_POSITION); + + GrMapWindow(nid); + + nid = GrNewWindow(pid, width - BORDER_WIDTHS + 1, TITLE_BAR_HEIGHT + 1, + BORDER_WIDTHS - 2, height - TITLE_BAR_HEIGHT - BORDER_WIDTHS -1, + 1, LTGRAY, BLACK); + window.wid = nid; + window.pid = pid; + window.type = WINDOW_TYPE_RIGHTBAR; + window.active = GR_FALSE; + window.data = NULL; + + add_window(&window); + + GrSetCursor(nid, horizontal_resize_columns, horizontal_resize_rows, + horizontal_resize_hotx, horizontal_resize_hoty, + BLACK, WHITE, horizontal_resize_fg, + horizontal_resize_bg); + + GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP + | GR_EVENT_MASK_MOUSE_POSITION); + GrMapWindow(nid); +#endif + return 0; +} + +/* + * We've just received an event notifying us that a client window has been + * unmapped, so we need to destroy all of the decorations. + */ +void client_window_destroy(win *window) +{ + win *pwin; + GR_WINDOW_ID pid; + + Dprintf("Client window %d has been destroyed\n", window->wid); + + if(!(pwin = find_window(window->pid))) { + fprintf(stderr, "Couldn't find parent of destroyed window " + "%d\n", window->wid); + return; + } + + /* Do it this way around so we don't handle events after destroying */ + pid = pwin->wid; + remove_window_and_children(pwin); + + Dprintf("Destroying container %d\n", pid); + GrDestroyWindow(pid); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanowm/events.c b/packages/services/gfx/mw/current/src/demos/nanowm/events.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanowm/events.c @@ -0,0 +1,202 @@ +/* + * NanoWM - Window Manager for Nano-X + * + * Copyright (C) 2000 Greg Haerr + * Copyright (C) 2000 Alex Holden + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" +/* Uncomment this if you want debugging output from this file */ +/*#define DEBUG*/ + +#include "nanowm.h" + +void do_exposure(GR_EVENT_EXPOSURE *event) +{ + win *window; + + Dprintf("do_exposure: wid %d, x %d, y %d, width %d, height %d\n", + event->wid, event->x, event->y, event->width, event->height); + + if(!(window = find_window(event->wid))) return; + + switch(window->type) { + case WINDOW_TYPE_CONTAINER: + container_exposure(window, event); + break; + default: + printf("Unhandled exposure on window %d " + "(type %d)\n", window->wid, window->type); + break; + } + +} + +void do_button_down(GR_EVENT_BUTTON *event) +{ + win *window; + + Dprintf("do_button_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, " + "y %d, buttons %d, changebuttons %d, modifiers %d\n", + event->wid, event->subwid, event->rootx, event->rooty, event->x, + event->y, event->buttons, event->changebuttons, + event->modifiers); + + if(!(window = find_window(event->wid))) return; + + switch(window->type) { + case WINDOW_TYPE_CONTAINER: + container_buttondown(window, event); + break; + default: + printf("Unhandled button down on window %d " + "(type %d)\n", window->wid, window->type); + break; + } +} + +void do_button_up(GR_EVENT_BUTTON *event) +{ + win *window; + + Dprintf("do_button_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, " + "y %d, buttons %d, changebuttons %d, modifiers %d\n", + event->wid, event->subwid, event->rootx, event->rooty, event->x, + event->y, event->buttons, event->changebuttons, + event->modifiers); + + if(!(window = find_window(event->wid))) return; + + switch(window->type) { + case WINDOW_TYPE_CONTAINER: + container_buttonup(window, event); + break; + default: + printf("Unhandled button up on window %d " + "(type %d)\n", window->wid, window->type); + break; + } +} + +void do_mouse_enter(GR_EVENT_GENERAL *event) +{ + win *window; + + Dprintf("do_mouse_enter: wid %d\n", event->wid); + + if(!(window = find_window(event->wid))) + return; + + switch(window->type) { + default: + printf("Unhandled mouse enter from window %d " + "(type %d)\n", window->wid, window->type); + break; + } +} + +void do_mouse_exit(GR_EVENT_GENERAL *event) +{ + win *window; + + Dprintf("do_mouse_exit: wid %d\n", event->wid); + + if(!(window = find_window(event->wid))) return; + + switch(window->type) { + default: + printf("Unhandled mouse exit from window %d " + "(type %d)\n", window->wid, window->type); + break; + } +} + +void do_mouse_moved(GR_EVENT_MOUSE *event) +{ + win *window; + + Dprintf("do_mouse_moved: wid %d, subwid %d, rootx %d, rooty %d, x %d, " + "y %d, buttons %d, modifiers %d\n", event->wid, event->subwid, + event->rootx, event->rooty, event->x, event->y, event->buttons, + event->modifiers); + + if(!(window = find_window(event->wid))) return; + + switch(window->type) { + case WINDOW_TYPE_CONTAINER: + container_mousemoved(window, event); + break; + default: + printf("Unhandled mouse movement in window %d " + "(type %d)\n", window->wid, window->type); + break; + } +} + +void do_focus_in(GR_EVENT_GENERAL *event) +{ + win *window; + + printf("do_focus_in: wid %d\n", event->wid); + + if(!(window = find_window(event->wid))) + return; + + switch(window->type) { + default: + printf("Unhandled focus in from window %d " + "(type %d)\n", window->wid, window->type); + break; + } +} + +void do_key_down(GR_EVENT_KEYSTROKE *event) +{ + Dprintf("do_key_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, " + "y %d, buttons %d, modifiers %d, uch %lu, special %d, " + "ch %d, content %d\n", event->wid, event->subwid, event->rootx, + event->rooty, event->x, event->y, event->buttons, + event->modifiers, event->uch, event->special, event->ch, + event->content); + + /* FIXME: Implement keyboard shortcuts */ +} + +void do_key_up(GR_EVENT_KEYSTROKE *event) +{ + Dprintf("do_key_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, " + "y %d, buttons %d, modifiers %d, uch %lu, special %d, " + "ch %d, content %d\n", event->wid, event->subwid, event->rootx, + event->rooty, event->x, event->y, event->buttons, + event->modifiers, event->uch, event->special, event->ch, + event->content); +} + +void do_update(GR_EVENT_UPDATE *event) +{ + win *window; + + Dprintf("do_update: wid %d, subwid %d, x %d, y %d, width %d, height %d, " + "utype %d\n", event->wid, event->subwid, event->x, event->y, event->width, + event->height, event->utype); + + if(!(window = find_window(event->subwid))) { + if (event->utype == GR_UPDATE_MAP) + new_client_window(event->subwid); + return; + } + + if(window->type == WINDOW_TYPE_CONTAINER) { + if (event->utype == GR_UPDATE_ACTIVATE) + redraw_ncarea(window); + return; + } + + if(window->type != WINDOW_TYPE_CLIENT) + return; + + if(event->utype == GR_UPDATE_DESTROY) + client_window_destroy(window); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanowm/nanowm.c b/packages/services/gfx/mw/current/src/demos/nanowm/nanowm.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanowm/nanowm.c @@ -0,0 +1,101 @@ +/* + * NanoWM - Window Manager for Nano-X + * + * Copyright (C) 2000 Greg Haerr + * Copyright (C) 2000 Alex Holden + * Parts based on npanel.c Copyright (C) 1999 Alistair Riddoch. + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" +/* Uncomment this if you want debugging output from this file */ +/*#define DEBUG*/ + +#include "nanowm.h" + +GR_SCREEN_INFO si; + +#ifdef __ECOS +int nanowm_main(int argc, char *argv[]) +#else +int main(int argc, char *argv[]) +#endif +{ + GR_EVENT event; + GR_WM_PROPERTIES props; + win window; + + if(GrOpen() < 0) { + fprintf(stderr, "Couldn't connect to Nano-X server!\n"); + exit(1); + } + + /* pass errors through main loop, don't exit*/ + GrSetErrorHandler(NULL); + + GrGetScreenInfo(&si); + + /* add root window*/ + window.wid = GR_ROOT_WINDOW_ID; + window.pid = GR_ROOT_WINDOW_ID; + window.type = WINDOW_TYPE_ROOT; + window.clientid = 1; + window.sizing = GR_FALSE; + window.active = 0; + window.data = NULL; + add_window(&window); + + GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_CHLD_UPDATE); + + /* Set new root window background color*/ + props.flags = GR_WM_FLAGS_BACKGROUND; + props.background = GrGetSysColor(GR_COLOR_DESKTOP); + GrSetWMProperties(GR_ROOT_WINDOW_ID, &props); + + while(1) { + GrGetNextEvent(&event); + + switch(event.type) { + case GR_EVENT_TYPE_ERROR: + printf("nanowm: error %d\n", event.error.code); + break; + case GR_EVENT_TYPE_EXPOSURE: + do_exposure(&event.exposure); + break; + case GR_EVENT_TYPE_BUTTON_DOWN: + do_button_down(&event.button); + break; + case GR_EVENT_TYPE_BUTTON_UP: + do_button_up(&event.button); + break; + case GR_EVENT_TYPE_MOUSE_ENTER: + do_mouse_enter(&event.general); + break; + case GR_EVENT_TYPE_MOUSE_EXIT: + do_mouse_exit(&event.general); + break; + case GR_EVENT_TYPE_MOUSE_POSITION: + do_mouse_moved(&event.mouse); + break; + case GR_EVENT_TYPE_KEY_DOWN: + do_key_down(&event.keystroke); + break; + case GR_EVENT_TYPE_KEY_UP: + do_key_up(&event.keystroke); + break; + case GR_EVENT_TYPE_FOCUS_IN: + do_focus_in(&event.general); + break; + case GR_EVENT_TYPE_CHLD_UPDATE: + do_update(&event.update); + break; + default: + fprintf(stderr, "Got unexpected event %d\n", + event.type); + break; + } + } + + GrClose(); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanowm/nanowm.h b/packages/services/gfx/mw/current/src/demos/nanowm/nanowm.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanowm/nanowm.h @@ -0,0 +1,196 @@ +/* + * NanoWM- the NanoGUI window manager. + * Copyright (C) 2000 Alex Holden + */ + +#ifndef __NANOWM_H +#define __NANOWM_H + +#ifdef DEBUG +#define Dprintf printf +#else +#define Dprintf(ignore...) +#endif + +/* Where to place the first window on the screen */ +#define FIRST_WINDOW_LOCATION 2 + +/* The distance to leave between windows when deciding where to place */ +#define WINDOW_STEP 20 + +/* The different window types which can be used in windowlist->type */ +enum { + WINDOW_TYPE_ROOT, + WINDOW_TYPE_CONTAINER, + WINDOW_TYPE_CLIENT + /***WINDOW_TYPE_TOPBAR, + WINDOW_TYPE_LEFTBAR, + WINDOW_TYPE_RIGHTBAR, + WINDOW_TYPE_BOTTOMBAR, + WINDOW_TYPE_LEFTRESIZE, + WINDOW_TYPE_RIGHTRESIZE, + WINDOW_TYPE_CLOSEBUTTON, + WINDOW_TYPE_MAXIMISEBUTTON, + WINDOW_TYPE_RESTOREBUTTON, + WINDOW_TYPE_ICONISEBUTTON, + WINDOW_TYPE_ICON, + WINDOW_TYPE_UTILITYBUTTON, + WINDOW_TYPE_UTILITYMENU, + WINDOW_TYPE_UTILITYMENUENTRY, + WINDOW_TYPE_ROOTMENU, + WINDOW_TYPE_ROOTMENUENTRY**/ +}; + +/* + * Used to keep a list of all the windows we know about so we can quickly + * find out whether a window is "one of ours", and if it is, what kind of + * window it is (title bar, side bar, button, icon, root menu, etc.), who + * it's a child of, and any special data associated with it (the title + * used in the title, the text of a root menu entry, the pixmap of an + * icon, etc.). + */ +struct windowlist { + GR_WINDOW_ID wid; /* The ID of this window */ + GR_WINDOW_ID pid; /* The ID of this window's parent */ + GR_WINDOW_ID clientid; /* clientid for container window*/ + int type; /* What kind of window this is */ + int sizing; /* True if in the middle of a sizing request */ + int active; /* Whether this window is active or not */ + void *data; /* Data associated with this window */ + struct windowlist *next; /* The next window in the list */ +}; +typedef struct windowlist win; + +/* + * Used to record the offset position when performing a move. + */ +struct position { + GR_COORD x; + GR_COORD y; +}; + +/* + * Used to record the original position, original size, and offset position + * when performing a resize. + */ +struct pos_size { + GR_COORD xoff; + GR_COORD yoff; + GR_COORD xorig; + GR_COORD yorig; + GR_SIZE width; + GR_SIZE height; +}; + +#if 0000 +/* + * Used to record some general information about the client. + */ +struct clientinfo { + GR_WINDOW_ID cid; +}; +#endif + +/* Function prototypes */ +win *find_window(GR_WINDOW_ID wid); +int add_window(win *window); +int remove_window(win *window); +int remove_window_and_children(win *window); +int new_client_window(GR_WINDOW_ID wid); +void client_window_destroy(win *window); +void redraw_ncarea(win *window); +void do_exposure(GR_EVENT_EXPOSURE *event); +void do_button_down(GR_EVENT_BUTTON *event); +void do_button_up(GR_EVENT_BUTTON *event); +void do_mouse_enter(GR_EVENT_GENERAL *event); +void do_mouse_exit(GR_EVENT_GENERAL *event); +void do_mouse_moved(GR_EVENT_MOUSE *event); +void do_focus_in(GR_EVENT_GENERAL *event); +void do_key_down(GR_EVENT_KEYSTROKE *event); +void do_key_up(GR_EVENT_KEYSTROKE *event); +void do_focus_in(GR_EVENT_GENERAL *event); +void do_focus_out(GR_EVENT_GENERAL *event); +void do_update(GR_EVENT_UPDATE *event); +void do_chld_update(GR_EVENT_UPDATE *event); +void rootwindow_exposure(win *window, GR_EVENT_EXPOSURE *event); +void container_exposure(win *window, GR_EVENT_EXPOSURE *event); +void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event); +void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event); +void maximisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event); +void restorebutton_exposure(win *window, GR_EVENT_EXPOSURE *event); +void iconisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event); +void utilitybutton_exposure(win *window, GR_EVENT_EXPOSURE *event); +void utilitymenu_exposure(win *window, GR_EVENT_EXPOSURE *event); +void utilitymenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event); +void rootmenu_exposure(win *window, GR_EVENT_EXPOSURE *event); +void rootmenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event); +void icon_exposure(win *window, GR_EVENT_EXPOSURE *event); +void rootwindow_buttondown(win *window, GR_EVENT_BUTTON *event); +void container_buttondown(win *window, GR_EVENT_BUTTON *event); +void topbar_buttondown(win *window, GR_EVENT_BUTTON *event); +void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event); +void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event); +void maximisebutton_buttondown(win *window, GR_EVENT_BUTTON *event); +void restorebutton_buttondown(win *window, GR_EVENT_BUTTON *event); +void iconisebutton_buttondown(win *window, GR_EVENT_BUTTON *event); +void utilitybutton_buttondown(win *window, GR_EVENT_BUTTON *event); +void icon_buttondown(win *window, GR_EVENT_BUTTON *event); +void rootwindow_buttonup(win *window, GR_EVENT_BUTTON *event); +void container_buttonup(win *window, GR_EVENT_BUTTON *event); +void topbar_buttonup(win *window, GR_EVENT_BUTTON *event); +void resizebar_buttonup(win *window, GR_EVENT_BUTTON *event); +void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event); +void maximisebutton_buttonup(win *window, GR_EVENT_BUTTON *event); +void restorebutton_buttonup(win *window, GR_EVENT_BUTTON *event); +void iconisebutton_buttonup(win *window, GR_EVENT_BUTTON *event); +void utilitybutton_buttonup(win *window, GR_EVENT_BUTTON *event); +void icon_buttonup(win *window, GR_EVENT_BUTTON *event); +void utilitymenuentry_buttonup(win *window, GR_EVENT_BUTTON *event); +void rootmenuentry_buttonup(win *window, GR_EVENT_BUTTON *event); +void closebutton_mouseexit(win *window, GR_EVENT_GENERAL *event); +void maximisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event); +void restorebutton_mouseexit(win *window, GR_EVENT_GENERAL *event); +void iconisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event); +void utilitybutton_mouseexit(win *window, GR_EVENT_GENERAL *event); +void utilitymenu_mouseexit(win *window, GR_EVENT_GENERAL *event); +void utilitymenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event); +void rootmenu_mouseexit(win *window, GR_EVENT_GENERAL *event); +void rootmenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event); +void container_mousemoved(win *window, GR_EVENT_MOUSE *event); +void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event); +void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event); +void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event); +void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event); +void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event); +void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event); + +extern GR_SCREEN_INFO si; +extern win *windows; +extern GR_BITMAP utilitybutton_notpressed[]; +extern GR_BITMAP utilitybutton_pressed[]; +extern GR_BITMAP maximisebutton_notpressed[]; +extern GR_BITMAP maximisebutton_pressed[]; +extern GR_BITMAP iconisebutton_notpressed[]; +extern GR_BITMAP iconisebutton_pressed[]; +extern GR_BITMAP closebutton_notpressed[]; +extern GR_BITMAP closebutton_pressed[]; +extern GR_BITMAP restorebutton_notpressed[]; +extern GR_BITMAP restorebutton_pressed[]; +extern GR_BITMAP horizontal_resize_fg[]; +extern GR_BITMAP horizontal_resize_bg[]; +extern GR_BITMAP vertical_resize_fg[]; +extern GR_BITMAP vertical_resize_bg[]; +extern GR_BITMAP righthand_resize_fg[]; +extern GR_BITMAP righthand_resize_bg[]; +extern GR_BITMAP lefthand_resize_fg[]; +extern GR_BITMAP lefthand_resize_bg[]; +extern int horizontal_resize_columns, horizontal_resize_rows; +extern int horizontal_resize_hotx, horizontal_resize_hoty; +extern int vertical_resize_columns, vertical_resize_rows; +extern int vertical_resize_hotx, vertical_resize_hoty; +extern int lefthand_resize_columns, lefthand_resize_rows; +extern int lefthand_resize_hotx, lefthand_resize_hoty; +extern int righthand_resize_columns, righthand_resize_rows; +extern int righthand_resize_hotx, righthand_resize_hoty; + +#endif diff --git a/packages/services/gfx/mw/current/src/demos/nanowm/nanowm.syms b/packages/services/gfx/mw/current/src/demos/nanowm/nanowm.syms new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanowm/nanowm.syms @@ -0,0 +1,1 @@ +nanowm_main diff --git a/packages/services/gfx/mw/current/src/demos/nanowm/org/.depend b/packages/services/gfx/mw/current/src/demos/nanowm/org/.depend new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanowm/org/.depend @@ -0,0 +1,6 @@ +nanowm.o .depend : $(TOP)/config nanowm.c nanowm.h +bitmaps.o .depend : $(TOP)/config bitmaps.c +events.o .depend : $(TOP)/config events.c nanowm.h +wlist.o .depend : $(TOP)/config wlist.c nanowm.h +clients.o .depend : $(TOP)/config clients.c nanowm.h +actions.o .depend : $(TOP)/config actions.c nanowm.h diff --git a/packages/services/gfx/mw/current/src/demos/nanowm/wlist.c b/packages/services/gfx/mw/current/src/demos/nanowm/wlist.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanowm/wlist.c @@ -0,0 +1,123 @@ +/* + * NanoWM - Window Manager for Nano-X + * + * Copyright (C) 2000 Greg Haerr + * Copyright (C) 2000 Alex Holden + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" +/* Uncomment this to get debugging output from this file */ +/*#define DEBUG*/ + +#include "nanowm.h" + +static win *windows = NULL; + +/* + * Find the windowlist entry for the specified window ID and return a pointer + * to it, or NULL if it isn't in the list. + */ +win *find_window(GR_WINDOW_ID wid) +{ + win *w = windows; + + Dprintf("Looking for window %d... ", wid); + + while(w) { + Dprintf("%d ", w->wid); + if(w->wid == wid) { + Dprintf("found it!\n"); + return w; + } + w = w->next; + } + + Dprintf("Nope, %d is not in the list\n", wid); + return NULL; +} + +/* + * Add a new entry to the front of the windowlist. + * Returns -1 on failure or 0 on success. + */ +int add_window(win *window) +{ + win *w; + + Dprintf("Adding window %d\n", window->wid); + + if(!(w = malloc(sizeof(win)))) return -1; + + w->wid = window->wid; + w->pid = window->pid; + w->type = window->type; + w->sizing = GR_FALSE; /* window->sizing*/ + w->active = window->active; + w->clientid = window->clientid; + w->data = window->data; + w->next = windows; + windows = w; + + return 0; +} + +/* + * Remove an entry from the windowlist. + * We must search through the list for it so that we can find the previous + * entry in the list and fix the next pointer. The alternative is to add a + * prev pointer to the structure which would increase the memory usage. + * Returns -1 on failure or 0 on success. + */ +int remove_window(win *window) +{ + win *w = windows; + win *prev = NULL; + + while(w) { + if(w == window) { + if(!prev) windows = w->next; + else prev->next = w->next; + if(w->data) free(w->data); + free(w); + return 0; + } + prev = w; + w = w->next; + } + + return -1; +} + +/* + * Remove an entry and all it's children from the windowlist. + * Returns -1 on failure or 0 on success. + */ +int remove_window_and_children(win *window) +{ + win *t, *w = windows; + win *prev = NULL; + GR_WINDOW_ID pid = window->wid; + + Dprintf("Removing window %d and children\n", window->wid); + + while(w) { + Dprintf("Examining window %d (pid %d)\n", w->wid, w->pid); + if((w->pid == pid) || (w == window)) { + Dprintf("Removing window %d (pid %d)\n", w->wid, + w->pid); + if(prev) prev->next = w->next; + else windows = w->next; + t = w->next; + if(w->data) free(w->data); + free(w); + w = t; + continue; + } + prev = w; + w = w->next; + } + + return -1; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/Makefile b/packages/services/gfx/mw/current/src/demos/nanox/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/Makefile @@ -0,0 +1,186 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000, 2002 Martin Jolicoeur, Greg Haerr +############################################################################## + +ifndef TOP +TOP = ../.. +CONFIG = $(TOP)/config +endif + +include $(CONFIG) + +VPATH := $(TOP)/demos/nanox + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += +# Defines for preprocessor +DEFINES += + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += -lm + +############################# targets section ################################ + +ifeq ($(NANOX), Y) +ifeq ($(NANOXDEMO), Y) + +# If you want to create a library with the objects files, define the name here +LIBNAME = + +# List of objects to compile +ifeq ($(ARCH), ECOS) +OBJS = landmine.o +TARGETS = $(BUILD)/bin/landmine.o +OBJS += ntetris.o +TARGETS += $(BUILD)/bin/ntetris.o +OBJS += world.o +TARGETS += $(BUILD)/bin/world.o +else +OBJS = demo.o \ + move.o \ + landmine.o \ + world.o \ + nxclock.o \ + nxterm.o \ + nxview.o \ + nxlsclients.o \ + nxev.o \ + npanel.o \ + nterm.o \ + demo2.o \ + demo5.o \ + demo6.o \ + t1demo.o \ + ftdemo.o \ + logfont.o \ + slider.o \ + ntetris.o \ + launcher.o \ + nsaver.o \ + getselection.o \ + setselection.o + +TARGETS = $(TOP)/bin/demo $(TOP)/bin/move $(TOP)/bin/landmine \ + $(TOP)/bin/world $(TOP)/bin/nxclock $(TOP)/bin/nxterm \ + $(TOP)/bin/nxview $(TOP)/bin/nxlsclients $(TOP)/bin/nxev \ + $(TOP)/bin/npanel $(TOP)/bin/nterm \ + $(TOP)/bin/demo2 $(TOP)/bin/demo5 $(TOP)/bin/demo6 \ + $(TOP)/bin/t1demo $(TOP)/bin/ftdemo $(TOP)/bin/logfont \ + $(TOP)/bin/slider $(TOP)/bin/ntetris $(TOP)/bin/launcher \ + $(TOP)/bin/nsaver $(TOP)/bin/getselection $(TOP)/bin/setselection +endif + +all: default $(TARGETS) support + +support: world.map nanogui.ppm ntetris.ppm launcher.cnf tux.gif + $(CP) $^ $(BUILD)/bin +endif +endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +ifeq ($(SHAREDLIBS), Y) +LD_NANOXCLIENTLIBS = $(CCNANOXCLIENTLIBS) +else +LD_NANOXCLIENTLIBS = $(NANOXCLIENTLIBS) +endif + +######################## Tools targets section ############################### + +$(BUILD)/bin/demo: demo.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/move: move.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/landmine: landmine.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/world: world.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/nxclock: nxclock.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/nxterm: nxterm.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/nxview: nxview.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/nxlsclients: nxlsclients.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/nxev: nxev.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/npanel: npanel.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/nterm: nterm.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/demo2: demo2.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/demo5: demo5.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/demo6: demo6.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/t1demo: t1demo.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/ftdemo: ftdemo.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/logfont: logfont.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/slider: slider.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/ntetris: ntetris.o $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/launcher: launcher.o $($NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/nsaver: nsaver.o $($NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/getselection: getselection.o $($NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +$(BUILD)/bin/setselection: setselection.o $($NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS) + +ifeq ($(ARCH), ECOS) +# Special build rules for linked in applications +$(BUILD)/bin/landmine.o: landmine.o +# $(CC) $(CFLAGS) $(LDFLAGS) $< -Wl,-r -Wl,--retain-symbols-file -Wl,landmine.syms -Wl,--defsym -Wl,landmine_main=main -o XX.o + $(CC) $(CFLAGS) $(LDFLAGS) $< -Wl,-r -Wl,--defsym -Wl,landmine_main=main -o XX.o + $(NM) XX.o | grep -v _main | grep ' T' | awk -f $(TOP)/ecos/retain.awk | xargs $(OBJCOPY) XX.o $@ + rm -f XX.o + +$(BUILD)/bin/ntetris.o: ntetris.o + $(CC) $(CFLAGS) $(LDFLAGS) $< -Wl,-r -Wl,--defsym -Wl,ntetris_main=main -o XX.o + $(NM) XX.o | grep -v _main | grep ' T' | awk -f $(TOP)/ecos/retain.awk | xargs $(OBJCOPY) XX.o $@ + rm -f XX.o + +$(BUILD)/bin/world.o: world.o + $(CC) $(CFLAGS) $(LDFLAGS) $< -Wl,-r -Wl,--defsym -Wl,world_main=main -o XX.o + $(NM) XX.o | grep -v _main | grep ' T' | awk -f $(TOP)/ecos/retain.awk | xargs $(OBJCOPY) XX.o $@ + rm -f XX.o +endif + diff --git a/packages/services/gfx/mw/current/src/demos/nanox/README.world b/packages/services/gfx/mw/current/src/demos/nanox/README.world new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/README.world @@ -0,0 +1,64 @@ + WORLD + +This is a program that uses mini-X graphics in MINIX to display a map of +the world. The database for this map is supplied, and is an edited version +of the CIA database. The continents, islands, rivers, lakes, countries, +and the states of the USA are shown. I have slightly edited the database +to fix some arctic islands and remove the Berlin corridor. But some country +boundaries are obsolete, since this map is a few years old at least. + +This program only uses integer arithmetic. Floating point is simulated +using fixed point arithmetic. For this reason, the projection used in +the program is rather crude (latitude and longitude are linear and are +parallel lines). This means that there is much distortion for the lands +which are near the North and South poles. If floating point was avaiable, +a good projection could be used instead (such as a true spherical view!). + +The file "world.map" is the database, and should be installed in "/usr/lib". +Otherwise you need to edit world.c and change MAPFILE as desired. + +To build the program (assuming mini-X is installed), use the command: + + cc -o world world.c -lgraph + +When the program starts, it draws the whole world. After this is done, +you can use two of the mouse buttons and the keys to manipulate the view. + +To zoom in on a section of the map, move the mouse to the location that +you intend to zoom in on, and press the left mouse button. Then when you +drag the mouse, a rectangle (the zoom box) will be drawn to indicate the +current area that you are zooming into. Notice that the point that you +start the zoom box on will be the center of the zoom box, NOT one of its +corners. + +While keeping the mouse button pressed, you can use the 's' and 'm' keys +to switch between the 'scaling' and the 'moving' modes of the rectangle. +The scaling mode makes the size of the zoom box vary as you move the mouse, +but keeps the center of the zoom box fixed. The moving mode keeps the size +of the zoom box the same, but moves the box around as you move the mouse. +Note that the width and height of the zoom box change together to preserve +the aspect ratio of the zoom area. + +If you have started to do a zoom, but change your mind, then you can type +the escape key before letting up on the mouse button, and this will cancel +the zoom operation. If you really want to do a zoom, then simply let up +on the mouse button and the selected area will be redrawn to fit the screen. +At this point you can zoom in further if you wish. + +You can return to the top level map by typing 't'. Then you can zoom in +again on a different area of the map. Alternatively, you can "zoom out" +just a little by creating a zoom box larger than the screen size. This can +be done, for example, by starting a zoom near the top of the screen, and then +dragging the mouse down to the bottom of the screen. Repeating this process +lets you slowly reduce the magnification. + +If you press the right mouse button, the display will show the longitude +and latitude of the location on the map covered by the cursor. You can then +drag the mouse around with the button held down, and the coordinates will +continuously track the cursor location. Letting up on the mouse button +removes the coordinate display. + +Typing 'q' will quit from the world program. + +Enjoy! +David I. Bell diff --git a/packages/services/gfx/mw/current/src/demos/nanox/demo.c b/packages/services/gfx/mw/current/src/demos/nanox/demo.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/demo.c @@ -0,0 +1,479 @@ +/* + * Demonstration program for Nano-X graphics. + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + +#if DOS_TURBOC +unsigned _stklen = 32768; +#endif + +/* + * Definitions to make it easy to define cursors + */ +#define _ ((unsigned) 0) /* off bits */ +#define X ((unsigned) 1) /* on bits */ +#define MASK(a,b,c,d,e,f,g) \ + (((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \ + + e) * 2) + f) * 2) + g) << 9) + +#define W2_WIDTH 70 +#define W2_HEIGHT 40 + + +static GR_WINDOW_ID w1; /* id for large window */ +static GR_WINDOW_ID w2; /* id for small window */ +static GR_WINDOW_ID w3; /* id for third window */ +static GR_WINDOW_ID w4; /* id for grabbable window */ +static GR_WINDOW_ID w5; /* id for testing enter/exit window */ +static GR_GC_ID gc1; /* graphics context for text */ +static GR_GC_ID gc2; /* graphics context for rectangle */ +static GR_GC_ID gc3; /* graphics context for circles */ +static GR_GC_ID gc4; /* graphics context for lines */ +static GR_COORD begxpos; /* beginning x position */ +static GR_COORD xpos; /* x position for text drawing */ +static GR_COORD ypos; /* y position for text drawing */ +static GR_COORD linexpos; /* x position for line drawing */ +static GR_COORD lineypos; /* y position for line drawing */ +static GR_COORD xorxpos; /* x position for xor line */ +static GR_COORD xorypos; /* y position for xor line */ +static GR_BOOL lineok; /* ok to draw line */ +static GR_SIZE COLS, ROWS; +static GR_SCREEN_INFO si; /* information about screen */ + +void do_buttondown(GR_EVENT_BUTTON *bp); +void do_buttonup(GR_EVENT_BUTTON *bp); +void do_motion(GR_EVENT_MOUSE *mp); +void do_keystroke(GR_EVENT_KEYSTROKE *kp); +void do_exposure(GR_EVENT_EXPOSURE *ep); +void do_focusin(GR_EVENT_GENERAL *gp); +void do_focusout(GR_EVENT_GENERAL *gp); +void do_enter(GR_EVENT_GENERAL *gp); +void do_exit(GR_EVENT_GENERAL *gp); +void do_idle(void); +/* routine to handle errors */ +void errorcatcher(GR_EVENT *ep); + +int +main(int argc,char **argv) +{ + GR_EVENT event; /* current event */ + GR_BITMAP bitmap1fg[7]; /* bitmaps for first cursor */ + GR_BITMAP bitmap1bg[7]; + GR_BITMAP bitmap2fg[7]; /* bitmaps for second cursor */ + GR_BITMAP bitmap2bg[7]; + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + GrReqShmCmds(655360); + + GrGetScreenInfo(&si); +COLS = si.cols - 40; +ROWS = si.rows - 80; + + /* print error, but don't exit*/ + GrSetErrorHandler(errorcatcher); + + w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 100, 50, COLS - 120, + ROWS - 60, 1, BROWN, WHITE); + w2 = GrNewWindow(GR_ROOT_WINDOW_ID, 6, 6, W2_WIDTH, W2_HEIGHT, 2, GREEN, + WHITE); + w3 = GrNewWindow(GR_ROOT_WINDOW_ID, 250, 30, 80, 100, 1, LTGRAY, + GREEN); + w4 = GrNewWindow(GR_ROOT_WINDOW_ID, 350, 20, 200, 150, 5, BLACK, WHITE); + w5 = GrNewWindow(GR_ROOT_WINDOW_ID, 11, 143, 209, 100, 1, BLUE, GREEN); + + GrSelectEvents(w1, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT | + GR_EVENT_MASK_CLOSE_REQ); + /* must select down and up for w2 to get implicit grab when + * running window manager, otherwise the wm-created parent + * window will get the grab, and we won't get the button up... + */ + GrSelectEvents(w2, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(w3, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_MOUSE_MOTION | GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(w4, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_POSITION | + GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(w5, GR_EVENT_MASK_MOUSE_ENTER | + GR_EVENT_MASK_MOUSE_EXIT | GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_CLOSE_REQ); + + GrMapWindow(w1); + GrMapWindow(w2); + GrMapWindow(w3); + GrMapWindow(w4); + GrMapWindow(w5); + + gc1 = GrNewGC(); + gc2 = GrNewGC(); + gc3 = GrNewGC(); + gc4 = GrNewGC(); + + GrSetGCForeground(gc1, RED); + GrSetGCBackground(gc1, BROWN); + GrSetGCForeground(gc2, MAGENTA); + GrSetGCMode(gc4, GR_MODE_XOR); + + bitmap1fg[0] = MASK(_,_,_,X,_,_,_); + bitmap1fg[1] = MASK(_,_,_,X,_,_,_); + bitmap1fg[2] = MASK(_,_,_,X,_,_,_); + bitmap1fg[3] = MASK(X,X,X,X,X,X,X); + bitmap1fg[4] = MASK(_,_,_,X,_,_,_); + bitmap1fg[5] = MASK(_,_,_,X,_,_,_); + bitmap1fg[6] = MASK(_,_,_,X,_,_,_); + + bitmap1bg[0] = MASK(_,_,X,X,X,_,_); + bitmap1bg[1] = MASK(_,_,X,X,X,_,_); + bitmap1bg[2] = MASK(X,X,X,X,X,X,X); + bitmap1bg[3] = MASK(X,X,X,X,X,X,X); + bitmap1bg[4] = MASK(X,X,X,X,X,X,X); + bitmap1bg[5] = MASK(_,_,X,X,X,_,_); + bitmap1bg[6] = MASK(_,_,X,X,X,_,_); + + bitmap2fg[0] = MASK(_,_,X,X,X,_,_); + bitmap2fg[1] = MASK(_,X,_,_,_,X,_); + bitmap2fg[2] = MASK(X,_,_,_,_,_,X); + bitmap2fg[3] = MASK(X,_,_,_,_,_,X); + bitmap2fg[4] = MASK(_,X,_,_,_,X,_); + bitmap2fg[5] = MASK(_,_,X,X,X,_,_); + + bitmap2bg[0] = MASK(_,_,X,X,X,_,_); + bitmap2bg[1] = MASK(_,X,X,X,X,X,_); + bitmap2bg[2] = MASK(X,X,X,X,X,X,X); + bitmap2bg[3] = MASK(X,X,X,X,X,X,X); + bitmap2bg[4] = MASK(_,X,X,X,X,X,_); + bitmap2bg[5] = MASK(_,_,X,X,X,_,_); + + GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg); + GrSetCursor(w2, 7, 7, 3, 3, WHITE, BLACK, bitmap2fg, bitmap2bg); + + while (1) { + GrCheckNextEvent(&event); + + switch (event.type) { + case GR_EVENT_TYPE_BUTTON_DOWN: + do_buttondown(&event.button); + break; + + case GR_EVENT_TYPE_BUTTON_UP: + do_buttonup(&event.button); + break; + + case GR_EVENT_TYPE_MOUSE_POSITION: + case GR_EVENT_TYPE_MOUSE_MOTION: + do_motion(&event.mouse); + break; + + case GR_EVENT_TYPE_KEY_DOWN: + do_keystroke(&event.keystroke); + break; + + case GR_EVENT_TYPE_EXPOSURE: + do_exposure(&event.exposure); + break; + + case GR_EVENT_TYPE_FOCUS_IN: + do_focusin(&event.general); + break; + + case GR_EVENT_TYPE_FOCUS_OUT: + do_focusout(&event.general); + break; + + case GR_EVENT_TYPE_MOUSE_ENTER: + do_enter(&event.general); + break; + + case GR_EVENT_TYPE_MOUSE_EXIT: + do_exit(&event.general); + break; + + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + + case GR_EVENT_TYPE_NONE: + do_idle(); + break; + } + } +} + + +/* + * Here when a button is pressed. + */ +void +do_buttondown(GR_EVENT_BUTTON *bp) +{ + GR_PIXELVAL intable[W2_WIDTH * W2_HEIGHT]; + GR_PIXELVAL outtable[W2_WIDTH * W2_HEIGHT * 6]; + GR_PIXELVAL *inp; + GR_PIXELVAL *outp; + GR_PIXELVAL *oldinp; + GR_COORD row; + GR_COORD col; + + /*static int xx = 100; + static int yy = 50;*/ + + if (bp->wid == w3) { + GrRaiseWindow(w3); + GrReadArea(w2, 0, 0, W2_WIDTH, W2_HEIGHT, intable); + inp = intable; + outp = outtable; + for (row = 0; row < W2_HEIGHT; row++) { + oldinp = inp; + for (col = 0; col < W2_WIDTH; col++) { + *outp++ = *inp; + *outp++ = *inp++; + } + inp = oldinp; + for (col = 0; col < W2_WIDTH; col++) { + *outp++ = *inp; + *outp++ = *inp++; + } + inp = oldinp; + for (col = 0; col < W2_WIDTH; col++) { + *outp++ = *inp; + *outp++ = *inp++; + } + } + GrArea(w1, gc1, 0, 0, W2_WIDTH * 2, W2_HEIGHT * 3, outtable, + MWPF_PIXELVAL); + return; + } + + if (bp->wid == w4) { + GrRaiseWindow(w4); + linexpos = bp->x; + lineypos = bp->y; + xorxpos = bp->x; + xorypos = bp->y; + GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos); + lineok = GR_TRUE; + return; + } + + if (bp->wid != w1) { + /* + * Cause a fatal error for testing if more than one + * button is pressed. + */ + if ((bp->buttons & -((int) bp->buttons)) != bp->buttons) + GrClearWindow(-1, 0); + return; + } + + GrRaiseWindow(w1); + /*GrMoveWindow(w1, ++xx, yy);*/ + + if (bp->buttons & GR_BUTTON_L) { + GrClearWindow(w1, GR_TRUE); + return; + } + + begxpos = bp->x; + xpos = bp->x; + ypos = bp->y; +} + + +/* + * Here when a button is released. + */ +void +do_buttonup(GR_EVENT_BUTTON *bp) +{ + if (bp->wid == w4) { + if (lineok) { + GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos); + GrLine(w4, gc3, bp->x, bp->y, linexpos, lineypos); + } + lineok = GR_FALSE; + return; + } + + if (bp->wid == w2) { + GrClose(); + exit(0); + } +} + + +/* + * Here when the mouse has a motion event. + */ +void +do_motion(GR_EVENT_MOUSE *mp) +{ + if (mp->wid == w4) { + if (lineok) { + GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos); + xorxpos = mp->x; + xorypos = mp->y; + GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos); + } + return; + } + + if (mp->wid == w3) { + GrPoint(w3, gc3, mp->x, mp->y); + return; + } +} + + +/* + * Here when a keyboard press occurs. + */ +void +do_keystroke(GR_EVENT_KEYSTROKE *kp) +{ + GR_SIZE width; /* width of character */ + GR_SIZE height; /* height of character */ + GR_SIZE base; /* height of baseline */ + + if (kp->wid == w4) { + if (lineok) { + GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos); + lineok = GR_FALSE; + } + return; + } + + GrGetGCTextSize(gc1, &kp->ch, 1, GR_TFASCII, &width, &height, &base); + if ((kp->ch == '\r') || (kp->ch == '\n')) { + xpos = begxpos; + ypos += height; + return; + } + if (kp->ch == '\b') { /* assumes fixed width font!! */ + if (xpos <= begxpos) + return; + xpos -= width; + GrSetGCForeground(gc3, BROWN); + GrFillRect(w1, gc3, xpos, ypos - height + base + 1, + width, height); + return; + } + GrText(w1, gc1, xpos, ypos + base, &kp->ch, 1, 0); + xpos += width; +} + + +/* + * Here when an exposure event occurs. + */ +void +do_exposure(GR_EVENT_EXPOSURE *ep) +{ + GR_POINT points[3]; + + if (ep->wid != w1) + return; + points[0].x = 311; + points[0].y = 119; + points[1].x = 350; + points[1].y = 270; + points[2].x = 247; + points[2].y = 147; + + GrFillRect(w1, gc2, 50, 50, 150, 200); + GrFillPoly(w1, gc2, 3, points); +} + + +/* + * Here when a focus in event occurs. + */ +void +do_focusin(GR_EVENT_GENERAL *gp) +{ + if (gp->wid != w1) + return; + GrSetBorderColor(w1, WHITE); +} + +/* + * Here when a focus out event occurs. + */ +void +do_focusout(GR_EVENT_GENERAL *gp) +{ + if (gp->wid != w1) + return; + GrSetBorderColor(w1, GRAY); +} + + +/* + * Here when a enter window event occurs. + */ +void +do_enter(GR_EVENT_GENERAL *gp) +{ + if (gp->wid != w5) + return; + GrSetBorderColor(w5, WHITE); + GrRaiseWindow(w5); +} + + +/* + * Here when a exit window event occurs. + */ +void +do_exit(GR_EVENT_GENERAL *gp) +{ + if (gp->wid != w5) + return; + GrSetBorderColor(w5, GREEN); + GrLowerWindow(w5); +} + + +/* + * Here to do an idle task when nothing else is happening. + * Just draw a randomly colored filled circle in the small window. + */ +void +do_idle(void) +{ + GR_COORD x; + GR_COORD y; + GR_SIZE rx; + GR_SIZE ry; + GR_COLOR color; + + x = rand() % 70; + y = rand() % 40; + rx = (rand() % 10) + 5; + ry = (rx * si.ydpcm) / si.xdpcm; /* make it appear circular */ + + color = rand() % si.ncolors; + + GrSetGCForeground(gc3, MWPALINDEX(color)); + GrFillEllipse(w2, gc3, x, y, rx, ry); +} + + +/* + * Here on a server error. Print the std message but don't exit. + */ +void +errorcatcher(GR_EVENT *ep) +{ + printf("nxclient: Error (%s) ", ep->error.name); + printf(nxErrorStrings[ep->error.code], ep->error.id); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/demo2.c b/packages/services/gfx/mw/current/src/demos/nanox/demo2.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/demo2.c @@ -0,0 +1,92 @@ +#define MWINCLUDECOLORS +#include +#include "nano-X.h" + +#include + +int +main(int ac,char **av) +{ + GR_WINDOW_ID w, w2; + GR_GC_ID gc; + GR_EVENT event; + GR_WM_PROPERTIES props; + + if (GrOpen() < 0) { + printf("Can't open graphics\n"); + exit(1); + } + + /* pass errors through main loop*/ + GrSetErrorHandler(NULL); + +#define WIDTH 320 +#define HEIGHT 240 + w = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 20, WIDTH, HEIGHT, + 0, GREEN, BLACK); + + w2 = GrNewWindow(w, 20, 20, 40, 40, 0, WHITE, BLACK); + + props.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE; + props.props = GR_WM_PROPS_NOBACKGROUND; + props.title = "Nano-X Demo2"; + GrSetWMProperties(w, &props); + + gc = GrNewGC(); + + GrSelectEvents(w, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ + | GR_EVENT_MASK_BUTTON_DOWN + | GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_KEY_UP); + GrMapWindow(w); + GrSetFocus(w); + /* serious bug here: when wm running, w2 is mapped anyway!!*/ + /*GrMapWindow(w2);*/ + + for (;;) { + /*GR_EVENT_KEYSTROKE *kev;*/ + + GrGetNextEvent(&event); + switch (event.type) { + case GR_EVENT_TYPE_EXPOSURE: + GrSetGCForeground(gc,GrGetSysColor(GR_COLOR_APPWINDOW)); + GrFillRect(w, gc, event.exposure.x, event.exposure.y, + event.exposure.width, event.exposure.height); + GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPTEXT)); + GrSetGCUseBackground(gc, GR_FALSE); + GrText(w, gc, 10, 30, "Hello World", -1, GR_TFASCII); +GrRect(w, gc, 5, 5, 300, 60); + break; + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + break; + case GR_EVENT_TYPE_ERROR: + printf("\7demo2: Error (%s) ", event.error.name); + printf(nxErrorStrings[event.error.code],event.error.id); + break; +#if 0 + case GR_EVENT_TYPE_BUTTON_DOWN: + /* test server error on bad syscall*/ + GrMapWindow(w2); + GrMoveWindow(GR_ROOT_WINDOW_ID, 0, 0); + { GR_SCREEN_INFO sinfo; GrGetScreenInfo(&sinfo); } + break; +#endif +#if 0 + case GR_EVENT_TYPE_KEY_DOWN: + kev = (GR_EVENT_KEYSTROKE *)&event; + printf("DOWN %d (%04x) %04x\n", + kev->ch, kev->ch, kev->modifiers); + break; + case GR_EVENT_TYPE_KEY_UP: + kev = (GR_EVENT_KEYSTROKE *)&event; + printf("UP %d (%04x) %04x\n", + kev->ch, kev->ch, kev->modifiers); + break; +#endif + } + } + + GrClose(); + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/demo4.c b/packages/services/gfx/mw/current/src/demos/nanox/demo4.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/demo4.c @@ -0,0 +1,87 @@ +/* + * Demonstration program for Nano-X blitting + */ +#include +#include +#include "nano-X.h" +#include "device.h" + +static GR_GC_ID gc1; /* graphics context for text */ +static GR_SCREEN_INFO si; /* information about screen */ + +#define GRAY14 MWRGB( 17, 17, 17 ) +#define GRAY13 MWRGB( 34, 34, 34 ) +#define GRAY12 MWRGB( 51, 51, 51 ) +#define GRAY11 MWRGB( 68, 68, 68 ) +#define GRAY10 MWRGB( 85, 85, 85 ) +#define GRAY9 MWRGB( 102, 102, 102 ) +#define GRAY8 MWRGB( 119, 119, 119 ) +#define GRAY7 MWRGB( 136, 136, 136 ) +#define GRAY6 MWRGB( 153, 153, 153 ) +#define GRAY5 MWRGB( 170, 170, 170 ) +#define GRAY4 MWRGB( 187, 187, 187 ) +#define GRAY3 MWRGB( 204, 204, 204 ) +#define GRAY2 MWRGB( 221, 221, 221 ) +#define GRAY1 MWRGB( 238, 238, 238 ) + +int +main(int argc,char **argv) +{ + GR_EVENT event; /* current event */ + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + GrGetScreenInfo(&si); + + gc1 = GrNewGC(); + + GrSetGCForeground(gc1, WHITE); + /*GrFillRect(GR_ROOT_WINDOW_ID, gc, 0, 0, 240, 320);*/ + + GrLine(GR_ROOT_WINDOW_ID, gc1, 4, 4, 634, 4); + GrLine(GR_ROOT_WINDOW_ID, gc1, 4, 4, 4, 474); + GrLine(GR_ROOT_WINDOW_ID, gc1, 634, 4, 634, 474); + GrLine(GR_ROOT_WINDOW_ID, gc1, 4, 474, 634, 474); + + /*GrJPEG(GR_ROOT_WINDOW_ID, gc, 0, 0, 400, 400, "/home/mart/nov9_pic1.jpg");*/ + +/* Bitblit function */ +{ + PSD mempsd; + int linelen, size; + void * pixels; + + mempsd = scrdev.AllocateMemGC(&scrdev); + GdCalcMemGCAlloc(mempsd, 50, 100, 0, 0, &size, &linelen); + pixels = malloc(size); + mempsd->flags |= PSF_ADDRMALLOC; + mempsd->MapMemGC(mempsd, 50, 100, scrdev.planes, scrdev.bpp, + linelen, size, pixels); + + /* Draw some stuff on offscreen */ + GdSetForeground(GdFindColor(GREEN)); + GdFillRect(mempsd, 0, 0, 50, 100); + GdSetForeground(GdFindColor(RED)); + GdFillRect(mempsd, 5, 20, 40, 60); + + /* blit */ + GdBlit(&scrdev, 10, 10, 50, 100, mempsd, 0, 0, 0); +} +/* GrSetGCForeground(gc, BLACK); + GrPoint(GR_ROOT_WINDOW_ID, gc, 0, 0); + + GrSetGCForeground(gc, GRAY10); + GrFillRect(GR_ROOT_WINDOW_ID, gc, 1, 1, 478, 638); +*/ + while (1) { + GrGetNextEvent(&event); + if(event.type == GR_EVENT_TYPE_CLOSE_REQ) break; + } + + GrClose(); + + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/demo5.c b/packages/services/gfx/mw/current/src/demos/nanox/demo5.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/demo5.c @@ -0,0 +1,471 @@ +/* + * Demonstration program for off screen drawing with Nano-X. Based on demo.c + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + +/* + * Definitions to make it easy to define cursors + */ +#define _ ((unsigned) 0) /* off bits */ +#define X ((unsigned) 1) /* on bits */ +#define MASK(a,b,c,d,e,f,g) \ + (((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \ + + e) * 2) + f) * 2) + g) << 9) + +#define W2_WIDTH 70 +#define W2_HEIGHT 40 + + +static GR_WINDOW_ID w1; /* id for large window */ +static GR_WINDOW_ID w2; /* id for small window */ +static GR_WINDOW_ID w3; /* id for third window */ +static GR_WINDOW_ID w4; /* id for grabbable window */ +static GR_WINDOW_ID w5; /* id for testing enter/exit window */ +static GR_WINDOW_ID p1; /* off screen pixmap */ +static GR_GC_ID gc1; /* graphics context for text */ +static GR_GC_ID gc2; /* graphics context for rectangle */ +static GR_GC_ID gc3; /* graphics context for circles */ +static GR_GC_ID gc4; /* graphics context for lines */ +static GR_COORD begxpos; /* beginning x position */ +static GR_COORD xpos; /* x position for text drawing */ +static GR_COORD ypos; /* y position for text drawing */ +static GR_COORD linexpos; /* x position for line drawing */ +static GR_COORD lineypos; /* y position for line drawing */ +static GR_COORD xorxpos; /* x position for xor line */ +static GR_COORD xorypos; /* y position for xor line */ +static GR_BOOL lineok; /* ok to draw line */ +static GR_SCREEN_INFO si; /* information about screen */ + +void do_buttondown(); +void do_buttonup(); +void do_motion(); +void do_keystroke(); +void do_exposure(); +void do_focusin(); +void do_focusout(); +void do_enter(); +void do_exit(); +void do_idle(); + +int +main(int argc,char **argv) +{ + GR_EVENT event; /* current event */ + GR_BITMAP bitmap1fg[7]; /* bitmaps for first cursor */ + GR_BITMAP bitmap1bg[7]; + GR_BITMAP bitmap2fg[7]; /* bitmaps for second cursor */ + GR_BITMAP bitmap2bg[7]; + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + GrGetScreenInfo(&si); + + w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 100, 50, si.cols - 120, + si.rows - 60, 1, BROWN, WHITE); + w2 = GrNewWindow(GR_ROOT_WINDOW_ID, 6, 6, W2_WIDTH, W2_HEIGHT, 2, GREEN, + WHITE); + w3 = GrNewWindow(GR_ROOT_WINDOW_ID, 250, 30, 80, 100, 1, LTGRAY, + GREEN); + w4 = GrNewWindow(GR_ROOT_WINDOW_ID, 350, 20, 200, 150, 5, BLACK, WHITE); + w5 = GrNewWindow(GR_ROOT_WINDOW_ID, 11, 143, 209, 100, 1, BLUE, GREEN); + + p1 = GrNewPixmap(200,200,0); + + GrSelectEvents(w1, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT | + GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(w2, GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(w3, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_MOUSE_MOTION | GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(w4, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_POSITION | + GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(w5, GR_EVENT_MASK_MOUSE_ENTER | + GR_EVENT_MASK_MOUSE_EXIT | GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_CLOSE_REQ); + + GrMapWindow(w1); + GrMapWindow(w2); + GrMapWindow(w3); + GrMapWindow(w4); + GrMapWindow(w5); + + gc1 = GrNewGC(); + gc2 = GrNewGC(); + gc3 = GrNewGC(); + gc4 = GrNewGC(); + + GrSetGCForeground(gc1, RED); + GrSetGCBackground(gc1, BROWN); + GrSetGCForeground(gc2, MAGENTA); + GrSetGCMode(gc4, GR_MODE_XOR); + + bitmap1fg[0] = MASK(_,_,_,X,_,_,_); + bitmap1fg[1] = MASK(_,_,_,X,_,_,_); + bitmap1fg[2] = MASK(_,_,_,X,_,_,_); + bitmap1fg[3] = MASK(X,X,X,X,X,X,X); + bitmap1fg[4] = MASK(_,_,_,X,_,_,_); + bitmap1fg[5] = MASK(_,_,_,X,_,_,_); + bitmap1fg[6] = MASK(_,_,_,X,_,_,_); + + bitmap1bg[0] = MASK(_,_,X,X,X,_,_); + bitmap1bg[1] = MASK(_,_,X,X,X,_,_); + bitmap1bg[2] = MASK(X,X,X,X,X,X,X); + bitmap1bg[3] = MASK(X,X,X,X,X,X,X); + bitmap1bg[4] = MASK(X,X,X,X,X,X,X); + bitmap1bg[5] = MASK(_,_,X,X,X,_,_); + bitmap1bg[6] = MASK(_,_,X,X,X,_,_); + + bitmap2fg[0] = MASK(_,_,X,X,X,_,_); + bitmap2fg[1] = MASK(_,X,_,_,_,X,_); + bitmap2fg[2] = MASK(X,_,_,_,_,_,X); + bitmap2fg[3] = MASK(X,_,_,_,_,_,X); + bitmap2fg[4] = MASK(_,X,_,_,_,X,_); + bitmap2fg[5] = MASK(_,_,X,X,X,_,_); + + bitmap2bg[0] = MASK(_,_,X,X,X,_,_); + bitmap2bg[1] = MASK(_,X,X,X,X,X,_); + bitmap2bg[2] = MASK(X,X,X,X,X,X,X); + bitmap2bg[3] = MASK(X,X,X,X,X,X,X); + bitmap2bg[4] = MASK(_,X,X,X,X,X,_); + bitmap2bg[5] = MASK(_,_,X,X,X,_,_); + + GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg); + GrSetCursor(w2, 7, 6, 3, 3, WHITE, BLACK, bitmap2fg, bitmap2bg); + + GrRect(GR_ROOT_WINDOW_ID, gc1, 0, 0, si.cols, si.rows); + + + while (1) { + GrGetNextEvent(&event); + + switch (event.type) { + case GR_EVENT_TYPE_BUTTON_DOWN: + do_buttondown(&event.button); + break; + + case GR_EVENT_TYPE_BUTTON_UP: + do_buttonup(&event.button); + break; + + case GR_EVENT_TYPE_MOUSE_POSITION: + case GR_EVENT_TYPE_MOUSE_MOTION: + do_motion(&event.mouse); + break; + + case GR_EVENT_TYPE_KEY_DOWN: + do_keystroke(&event.keystroke); + break; + + case GR_EVENT_TYPE_EXPOSURE: + do_exposure(&event.exposure); + break; + + case GR_EVENT_TYPE_FOCUS_IN: + do_focusin(&event.general); + break; + + case GR_EVENT_TYPE_FOCUS_OUT: + do_focusout(&event.general); + break; + + case GR_EVENT_TYPE_MOUSE_ENTER: + do_enter(&event.general); + break; + + case GR_EVENT_TYPE_MOUSE_EXIT: + do_exit(&event.general); + break; + + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + + case GR_EVENT_TYPE_NONE: + do_idle(); + break; + } + } +} + + +/* + * Here when a button is pressed. + */ +void +do_buttondown(bp) + GR_EVENT_BUTTON *bp; +{ + GR_PIXELVAL intable[W2_WIDTH * W2_HEIGHT]; + GR_PIXELVAL outtable[W2_WIDTH * W2_HEIGHT * 6]; + GR_PIXELVAL *inp; + GR_PIXELVAL *outp; + GR_PIXELVAL *oldinp; + GR_COORD row; + GR_COORD col; + + /*static int xx = 100; + static int yy = 50;*/ + + if (bp->wid == w3) { + GrRaiseWindow(w3); + GrReadArea(w2, 0, 0, W2_WIDTH, W2_HEIGHT, intable); + inp = intable; + outp = outtable; + for (row = 0; row < W2_HEIGHT; row++) { + oldinp = inp; + for (col = 0; col < W2_WIDTH; col++) { + *outp++ = *inp; + *outp++ = *inp++; + } + inp = oldinp; + for (col = 0; col < W2_WIDTH; col++) { + *outp++ = *inp; + *outp++ = *inp++; + } + inp = oldinp; + for (col = 0; col < W2_WIDTH; col++) { + *outp++ = *inp; + *outp++ = *inp++; + } + } + GrArea(w1, gc1, 0, 0, W2_WIDTH * 2, W2_HEIGHT * 3, outtable, + MWPF_PIXELVAL); + return; + } + + if (bp->wid == w4) { + /* Draw a line in the off screen pixmap. Won't be shown until the button + * is released + */ + + GrLine(p1, gc1, 0,0, bp->x, bp->y); + + GrRaiseWindow(w4); + linexpos = bp->x; + lineypos = bp->y; + xorxpos = bp->x; + xorypos = bp->y; + GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos); + lineok = GR_TRUE; + return; + } + + if (bp->wid != w1) { + /* + * Cause a fatal error for testing if more than one + * button is pressed. + */ + if ((bp->buttons & -((int) bp->buttons)) != bp->buttons) + GrClearWindow(-1, 0); + return; + } + + GrRaiseWindow(w1); + /*GrMoveWindow(w1, ++xx, yy);*/ + + if (bp->buttons & GR_BUTTON_L) { + GrClearWindow(w1, GR_TRUE); + return; + } + + begxpos = bp->x; + xpos = bp->x; + ypos = bp->y; +} + + +/* + * Here when a button is released. + */ +void +do_buttonup(bp) + GR_EVENT_BUTTON *bp; +{ + if (bp->wid == w4) { + if (lineok) { + GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos); + GrLine(w4, gc3, bp->x, bp->y, linexpos, lineypos); + } + lineok = GR_FALSE; + GrCopyArea(w1, gc4, 200,200, 200,200, p1,0,0,MWROP_SRCCOPY); + return; + } + + if (bp->wid == w2) { + GrClose(); + exit(0); + } +} + + +/* + * Here when the mouse has a motion event. + */ +void +do_motion(mp) + GR_EVENT_MOUSE *mp; +{ + if (mp->wid == w4) { + if (lineok) { + GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos); + xorxpos = mp->x; + xorypos = mp->y; + GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos); + } + return; + } + + if (mp->wid == w3) { + GrPoint(w3, gc3, mp->x, mp->y); + return; + } +} + + +/* + * Here when a keyboard press occurs. + */ +void +do_keystroke(kp) + GR_EVENT_KEYSTROKE *kp; +{ + GR_SIZE width; /* width of character */ + GR_SIZE height; /* height of character */ + GR_SIZE base; /* height of baseline */ + + if (kp->wid == w4) { + if (lineok) { + GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos); + lineok = GR_FALSE; + } + return; + } + + GrGetGCTextSize(gc1, &kp->ch, 1, GR_TFASCII, &width, &height, &base); + if ((kp->ch == '\r') || (kp->ch == '\n')) { + xpos = begxpos; + ypos += height; + return; + } + if (kp->ch == '\b') { /* assumes fixed width font!! */ + if (xpos <= begxpos) + return; + xpos -= width; + GrSetGCForeground(gc3, BROWN); + GrFillRect(w1, gc3, xpos, ypos - height + base + 1, + width, height); + return; + } + GrText(w1, gc1, xpos, ypos + base, &kp->ch, 1, 0); + xpos += width; +} + + +/* + * Here when an exposure event occurs. + */ +void +do_exposure(ep) + GR_EVENT_EXPOSURE *ep; +{ + GR_POINT points[3]; + + if (ep->wid != w1) + return; + points[0].x = 311; + points[0].y = 119; + points[1].x = 350; + points[1].y = 270; + points[2].x = 247; + points[2].y = 147; + + GrFillRect(w1, gc2, 50, 50, 150, 200); + GrFillPoly(w1, gc2, 3, points); +} + + +/* + * Here when a focus in event occurs. + */ +void +do_focusin(gp) + GR_EVENT_GENERAL *gp; +{ + if (gp->wid != w1) + return; + GrSetBorderColor(w1, WHITE); +} + +/* + * Here when a focus out event occurs. + */ +void +do_focusout(gp) + GR_EVENT_GENERAL *gp; +{ + if (gp->wid != w1) + return; + GrSetBorderColor(w1, GRAY); +} + + +/* + * Here when a enter window event occurs. + */ +void +do_enter(gp) + GR_EVENT_GENERAL *gp; +{ + if (gp->wid != w5) + return; + GrSetBorderColor(w5, WHITE); + GrRaiseWindow(w5); +} + + +/* + * Here when a exit window event occurs. + */ +void +do_exit(gp) + GR_EVENT_GENERAL *gp; +{ + if (gp->wid != w5) + return; + GrSetBorderColor(w5, GREEN); + GrLowerWindow(w5); +} + + +/* + * Here to do an idle task when nothing else is happening. + * Just draw a randomly colored filled circle in the small window. + */ +void +do_idle() +{ + GR_COORD x; + GR_COORD y; + GR_SIZE rx; + GR_SIZE ry; + GR_COLOR color; + + x = rand() % 70; + y = rand() % 40; + rx = (rand() % 10) + 5; + ry = (rx * si.ydpcm) / si.xdpcm; /* make it appear circular */ + + color = rand() % si.ncolors; + + GrSetGCForeground(gc3, MWPALINDEX(color)); + GrFillEllipse(w2, gc3, x, y, rx, ry); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/demo6.c b/packages/services/gfx/mw/current/src/demos/nanox/demo6.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/demo6.c @@ -0,0 +1,165 @@ +/* + * Demonstrates loading a binary PPM file and displaying it in a window + * as a Pixmap. + */ + +/* Comment this definition out if you don't want to use server side pixmaps */ +/* (it will be slower but will work on device drivers without bitblt) */ +#define USE_PIXMAPS + +#include +#include +#include +#include +#include + +GR_WINDOW_ID window; /* ID for output window */ +#ifdef USE_PIXMAPS +GR_WINDOW_ID pmap; /* ID for pixmap */ +#endif +GR_GC_ID gc; /* Graphics context */ +int width, height; /* Size of image */ +unsigned char *data; /* Local copy of image data */ + +void do_exposure(GR_EVENT_EXPOSURE *event) +{ + /* The window has been exposed so redraw it */ +#ifdef USE_PIXMAPS + GrCopyArea(window, gc, 0, 0, width, height, pmap, 0, 0, MWROP_SRCCOPY); +#else + GrArea(window, gc, 0, 0, width, height, data, MWPF_RGB); +#endif +} + +void errorhandler(GR_EVENT *ep) +{ + printf("Error (%s) code %d id %d", ep->error.name, + ep->error.code, ep->error.id); + exit(1); +} + +int main(int argc, char *argv[]) +{ + unsigned char line[256]; + GR_EVENT event; + FILE *infile; + int i, o; + unsigned char *p; + + if(argc != 2) { + printf("Usage: demo6 \n"); + exit(1); + } + + if(!(infile = fopen(argv[1], "r"))) { + printf("Couldn't open \"%s\" for reading: %s\n", argv[1], + strerror(errno)); + exit(2); + } + + /* Read magic number (P6 = colour, binary encoded PPM file) */ + if(!fgets(line, 256, infile)) goto truncated; + if(line[0] != 'P' || line[1] != '6') { + printf("Unsupported PPM type or not a PPM file.\n"); + printf("Please supply a valid P6 format file (colour, with " + "binary encoding).\n"); + } + + /* Strip comments */ + do { + if(!fgets(line, 256, infile)) goto truncated; + } while(line[0] == '#'); + + /* Read width and height */ + sscanf(line, "%i %i", &width, &height); + + /* Read the maximum colour value */ + if(!fgets(line, 256, infile)) goto truncated; + sscanf(line, "%i", &i); + if(i != 255) { + printf("Truecolour mode only is supported\n"); + exit(4); + } + + /* Calculate how many bytes of image data there is */ + i = width * height * 3; + /* Calculate how many bytes of data there will be after unpacking */ + o = width * height * 4; + + /* Allocate the space to store the data whilst it's being loaded */ + if(!(data = malloc(o))) { + printf("Not enough memory to load image\n"); + exit(5); + } + + /* Read the data in and unpack it to RGBX format */ + /* The lower byte isn't used so we don't set it to anything */ + p = data; + while(o) { + if(fread(p, 1, 3, infile) != 3) goto truncated; + p += 4; + o -= 4; + } + + /* We don't need the input file anymore so close it */ + fclose(infile); + + /* Register the error handler */ + GrSetErrorHandler(errorhandler); + + if(GrOpen() < 0) { + printf("Couldn't connect to Nano-X server\n"); + exit(6); + } + +#ifdef USE_PIXMAPS + /* Create the pixmap to store the picture in */ + pmap = GrNewPixmap(width, height, NULL); +#endif + + /* Create a graphics context */ + gc = GrNewGC(); + +#ifdef USE_PIXMAPS + /* Copy the image data into the pixmap */ + GrArea(pmap, gc, 0, 0, width, height, data, MWPF_RGB); + /* We can free the image data now because it's stored in the pixmap */ + free(data); +#endif + + /* Create a window to output the image to */ + window = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, width, height, 0, 0, 0); + + /* Select expose events so we can redraw the image when necessary */ + GrSelectEvents(window, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_CLOSE_REQ); + + /* Make the window visible */ + GrMapWindow(window); + +#ifdef USE_PIXMAPS + /* Paint the pixmap onto it */ + GrCopyArea(window, gc, 0, 0, width, height, pmap, 0, 0, + MWROP_SRCCOPY); +#else + GrArea(window, gc, 0, 0, width, height, data, MWPF_RGB); +#endif + + while(1) { + GrGetNextEvent(&event); + switch(event.type) { + case GR_EVENT_TYPE_EXPOSURE: + do_exposure(&event.exposure); + break; + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + } + } + + return 0; + +truncated: + printf("Error: File appears to be truncated\n"); + exit(3); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/ftdemo.c b/packages/services/gfx/mw/current/src/demos/nanox/ftdemo.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/ftdemo.c @@ -0,0 +1,156 @@ +/* + * Demonstration program for freetype truetype font support + * Martin Jolicoeur 2000 martinj@visuaide.com. + */ +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + +#if HAVE_T1LIB_SUPPORT +#define FONTNAME "bchr" +#if 0 +#define FONTNAME "bchb" +#define FONTNAME "dcr10" +#define FONTNAME "dcbx10" +#endif +#elif HAVE_FREETYPE_SUPPORT +#define FONTNAME "lt1-r-omega-serif" +#if 0 +#define FONTNAME "times" +#define FONTNAME "cour" +#endif +#else +#define FONTNAME GR_FONT_SYSTEM_VAR +#endif + +#define MAXW 400 +#define MAXH 400 + +GR_GC_ID gid; +GR_FONT_ID fontid, fontid2; +GR_BOOL kerning = GR_FALSE; +GR_BOOL aa = GR_TRUE; +GR_BOOL underline = GR_FALSE; +int angle = 0; +int state = GR_TFBOTTOM; +char buffer[128]; +int n; +void Render(GR_WINDOW_ID window); + +int +main() +{ + FILE *file; + GR_EVENT event; + GR_WINDOW_ID window; + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + window = GrNewWindow(GR_ROOT_WINDOW_ID, 50,50, MAXW,MAXH, 4, BLACK, WHITE); + GrMapWindow(window); + + gid = GrNewGC (); + GrSelectEvents(window, GR_EVENT_MASK_KEY_DOWN | + GR_EVENT_MASK_CLOSE_REQ | GR_EVENT_MASK_EXPOSURE); + + if ((file = fopen("ftdemo.txt", "r")) == NULL) { + printf("Can't open text file\n"); + return (-1); + } + + n = 0; + + if(fgets(buffer, 128, file) != NULL) { + for (n = 0; n < 128 && buffer[n]; n++) { + if (buffer[n] == '\n') + break; + } + } + fclose(file); + + fontid = GrCreateFont(FONTNAME, 20, NULL); + fontid2 = GrCreateFont(FONTNAME, 36, NULL); + + Render(window); + + while (1) { + GrGetNextEvent(&event); + + switch (event.type) { + case GR_EVENT_TYPE_KEY_DOWN: + switch(event.keystroke.ch) { + case 171: /* + */ + case '+': + case '=': + angle += 100; /* Increase 10 degrees */ + angle %= 3600; + break; + case 173: /* - */ + case '-': + case '_': + angle -= 100; /* Decrease 10 degrees */ + angle %= 3600; + break; + case 'a': + aa = (aa == GR_FALSE)?GR_TRUE:GR_FALSE; + break; + case 'k': + kerning = (kerning == GR_FALSE)?GR_TRUE:GR_FALSE; + break; + case 'l': + state = (state == GR_TFBOTTOM)?GR_TFBASELINE: \ + (state == GR_TFBASELINE)?GR_TFTOP:GR_TFBOTTOM; + break; + case 'u': + underline = underline? GR_FALSE: GR_TRUE; + break; + default: + continue; + /* Unknown keystroke */ + } + Render(window); + break; + case GR_EVENT_TYPE_EXPOSURE: + Render(window); + break; + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + } + } + + return 0; +} + +void Render(GR_WINDOW_ID window) +{ + GrSetGCBackground(gid, WHITE); + GrSetGCForeground (gid, WHITE); + GrSetGCUseBackground(gid, GR_FALSE); + GrFillRect(window, gid, 0, 0, MAXW, MAXH); + GrSetGCForeground (gid, BLACK); + + /* Draw menu */ + GrSetGCFont(gid, fontid); + GrSetFontAttr(fontid, GR_TFKERNING | GR_TFANTIALIAS, 0); + GrText(window, gid, 5, 20, "+ Rotate string clockwise", 25, GR_TFASCII); + GrText(window, gid, 5, 40, "- Rotate string counter-clockwise", 34, GR_TFASCII); + GrText(window, gid, 5, 60, "a Toggle anti-aliasing", 22, GR_TFASCII); + GrText(window, gid, 5, 80, "k Toggle kerning", 16, GR_TFASCII); + GrText(window, gid, 5, 100, "u Toggle underline", 18, GR_TFASCII); + GrText(window, gid, 5, 120, "l Toggle alignment bottom/baseline/top", 39, GR_TFASCII); + + /* Draw test string */ + GrSetGCFont(gid, fontid2); + GrSetFontAttr(fontid2, (kerning?GR_TFKERNING:0) | (aa?GR_TFANTIALIAS:0) | + (underline?GR_TFUNDERLINE: 0), -1); + GrSetFontRotation(fontid2, angle); + GrText(window, gid, MAXW/2, MAXH/2, buffer, n, state|GR_TFUTF8); + + /* Draw arrow */ + GrLine (window, gid, (MAXW/2)-10 , MAXH/2, (MAXW/2)+10, MAXH/2); + GrLine (window, gid, MAXW/2, (MAXH/2)-10, MAXW/2, (MAXH/2)+10); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/getselection.c b/packages/services/gfx/mw/current/src/demos/nanox/getselection.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/getselection.c @@ -0,0 +1,119 @@ +#include +#include +#include +#include + +#include "nano-X.h" + +static int bytes_received = 0; +static char *data = NULL; + +int got_client_data(GR_EVENT *event) +{ + GR_EVENT_CLIENT_DATA *ev = &event->clientdata; + + fprintf(stderr, "Got client data packet with serial number %ld for " + "window %d from window %d\n", ev->serial, ev->wid, + ev->rid); + if(!(data = realloc(data, bytes_received + ev->datalen))) { + fprintf(stderr, "Out of memory\n"); + exit(7); + } + memcpy(data + bytes_received, ev->data, ev->datalen); + free(ev->data); + + fprintf(stderr, "Got client data packet with serial number %ld for " + "window %d from window %d\n", ev->serial, ev->wid, + ev->rid); + fprintf(stderr, "Already received %d bytes, this packet is %ld bytes " + "long, and the total data length is %ld bytes so ", + bytes_received, ev->datalen, ev->len); + + bytes_received += ev->datalen; + if(bytes_received == ev->len) { + fprintf(stderr, "we have received all of the data now.\n"); + fprintf(stderr, "The data in the packet is:\n%s\n", data); + return 1; + } + else if(bytes_received < ev->len) { + fprintf(stderr, "this is not the last data packet.\n"); + return 0; + } else fprintf(stderr, "we have received too much data (shouldn't " + "happen)\n"); + + return 1; +} + +int main(int argc, char *argv[]) +{ + GR_CHAR *typelist, *p; + GR_WINDOW_ID sid, wid; + GR_EVENT event; + int n = 0, mimetype = -1; + + if(GrOpen() < 0) { + fprintf(stderr, "Couldn't connect to Nano-X server\n"); + return 1; + } + + sid = GrGetSelectionOwner(&typelist); + if(!sid) { + fprintf(stderr, "Clipboard is empty\n"); + return 2; + } + + if(!typelist) { + fprintf(stderr, "GrGetSelectionOwner() returned an empty " + "type list for window %d\n", sid); + return 3; + } + + fprintf(stderr, "Window %d owns the selection\n", sid); + fprintf(stderr, "It claims to be able to supply data in the following " + "types:\n%s\n", typelist); + + p = strtok(typelist, " "); + do { + if(!strncmp("text/plain", p, 10)) { + mimetype = n; + break; + } + n++; + } while((p = strtok(NULL, " "))); + + if(mimetype == -1) { + fprintf(stderr, "Type text/plain is not available\n"); + return 4; + } + + free(typelist); + + fprintf(stderr, "Type text/plain is available- requesting data\n"); + + wid = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, 1, 1, 0, 0, 0); + if(!wid) { + fprintf(stderr, "Couldn't get a window\n"); + return 5; + } + + GrSelectEvents(wid, GR_EVENT_MASK_CLIENT_DATA); + + GrRequestClientData(wid, sid, 0, mimetype); + + while(1) { + GrGetNextEventTimeout(&event, 4000); + switch(event.type) { + case GR_EVENT_TYPE_CLIENT_DATA: + if(got_client_data(&event)) + return 0; + break; + case GR_EVENT_TYPE_TIMEOUT: + fprintf(stderr, "Timed out waiting for data\n"); + return 6; + default: + break; + } + } + + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/info.c b/packages/services/gfx/mw/current/src/demos/nanox/info.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/info.c @@ -0,0 +1,55 @@ +/* + * Display the results of various GrGetsomethingInfo() calls. + */ + +#include +#include +#include "nano-X.h" + +int main() +{ + GR_SCREEN_INFO si; + GR_FONT_INFO fi; + GR_GC_INFO gi; + GR_FONT fonts; + int x, y; + + GrOpen(); + GrGetScreenInfo(&si); + + printf("rows = %d\n", si.rows); + printf("cols = %d\n", si.cols); + printf("bpp = %d\n", si.bpp); + printf("planes = %d\n", si.planes); + printf("ncolors = %d\n", si.ncolors); + printf("buttons = 0x%x\n", si.buttons); + printf("modifiers = 0x%x\n", si.modifiers); + printf("fonts = %d\n", si.fonts); + + getch(); + + for(fonts = 0; fonts < si.fonts; fonts++) { +/* if(!GrGetFontInfo(fonts, &fi)) { */ + GrGetFontInfo(fonts, &fi); + if(1) { + printf("\nfont = %d\n", fi.font); + printf("height = %d\n", fi.height); + printf("maxwidth = %d\n", fi.maxwidth); + printf("baseline = %d\n", fi.baseline); + printf("fixed = %s\n", fi.fixed ? "TRUE" : "FALSE"); + printf("widths =\n"); + for(y = 0; y != 3; y++) { + for(x = 0; x != 7; x++) + printf("%2d", fi.widths[x * y]); + printf("\n"); + + getch(); + + } + } + } + + getch(); + + GrClose(); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/landmine.c b/packages/services/gfx/mw/current/src/demos/nanox/landmine.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/landmine.c @@ -0,0 +1,1337 @@ +/* + * Landmine, the game. + * Written for mini-X by David I. Bell. + */ + +#include +#include +#include +#if UNIX | DOS_DJGPP +#include +#include +#include +#endif +#define MWINCLUDECOLORS +#include "nano-X.h" + + +#define MINSIZE 3 /* minimum size of board */ +#define MAXSIZE 30 /* maximum size of board */ +#define SIZE 15 /* default size of playing board */ +#define MINEPERCENT 15 /* default percentage of mines */ +#define SAVEFILE "landmine.save" /* default save file name */ +#define MAGIC 649351261 /* magic number in save files */ +#define MAXPARAMS 1000 /* maximum different game parameters */ + +#define FULLSIZE (MAXSIZE + 2) /* board size including borders */ + +#ifdef __ECOS +/* 240x320 screen values*/ +#define BOARDGAP 2 /* millimeter gap around board */ +#define RIGHTGAP 2 /* mm gap between board, right side */ +#define BUTTONGAP 5 /* mm gap between buttons */ +#define STATUSGAP 10 /* mm gap between buttons and status */ + +#define BUTTONWIDTH 80 /* width of buttons (pixels) */ +#define BUTTONHEIGHT 25 /* height of buttons (pixels) */ +#define RIGHTSIDE 90 /* pixels to guarantee for right side */ +#define BOARDBORDER 2 /* border size around board */ +#else +#define BOARDGAP 10 /* millimeter gap around board */ +#define RIGHTGAP 15 /* mm gap between board, right side */ +#define BUTTONGAP 20 /* mm gap between buttons */ +#define STATUSGAP 35 /* mm gap between buttons and status */ + +#define BUTTONWIDTH 80 /* width of buttons (pixels) */ +#define BUTTONHEIGHT 25 /* height of buttons (pixels) */ +#define RIGHTSIDE 150 /* pixels to guarantee for right side */ +#define BOARDBORDER 2 /* border size around board */ +#endif + +/* + * Print the number of steps taken. + * This is used twice, and is a macro to guarantee that + * the two printouts match. + */ +#define PRINTSTEPS printline(2, "Steps: %3d\n", steps) + + +/* + * Typedefs local to this program. + */ +typedef unsigned short CELL; /* cell value */ +typedef int POS; /* cell position */ + + +/* + * For defining bitmaps easily. + */ +#define X ((unsigned) 1) +#define _ ((unsigned) 0) + +#define BITS(a,b,c,d,e,f,g,h,i) \ + (((((((((a*2+b)*2+c)*2+d)*2+e)*2+f)*2+g)*2+h)*2+i) << 7) + + +static GR_BITMAP twolegs_fg[] = { /* two legs foreground */ + BITS(_,_,_,_,_,_,_,_,_), + BITS(_,_,_,X,X,X,_,_,_), + BITS(_,_,_,X,X,X,_,_,_), + BITS(_,_,_,X,X,X,_,_,_), + BITS(_,_,_,_,X,_,_,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,X,_,X,_,X,_,X,_), + BITS(_,X,_,X,X,X,_,X,_), + BITS(_,_,_,X,_,X,_,_,_), + BITS(_,_,_,X,_,X,_,_,_), + BITS(_,_,X,X,_,X,X,_,_), + BITS(_,_,_,_,_,_,_,_,_) +}; + +static GR_BITMAP twolegs_bg[] = { /* two legs background */ + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,X,X,X,X,X,X,X,_), + BITS(X,X,X,X,X,X,X,X,X), + BITS(X,X,X,X,_,X,X,X,X), + BITS(X,X,X,X,X,X,X,X,X), + BITS(X,X,X,X,X,X,X,X,X), + BITS(_,X,X,X,X,X,X,X,_), + BITS(_,X,X,X,X,X,X,X,_), + BITS(_,X,X,X,X,X,X,X,_) +}; + + +static GR_BITMAP oneleg_fg[] = { /* one leg foreground */ + BITS(_,_,_,_,_,_,_,_,_), + BITS(_,_,_,X,X,X,_,_,_), + BITS(_,_,_,X,X,X,_,_,_), + BITS(_,_,_,X,X,X,_,_,_), + BITS(_,_,_,_,X,_,_,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,X,_,X,_,X,_,X,_), + BITS(_,_,_,X,X,X,_,X,_), + BITS(_,_,_,_,_,X,_,_,_), + BITS(_,_,_,_,_,X,_,_,_), + BITS(_,_,_,_,_,X,X,_,_), + BITS(_,_,_,_,_,_,_,_,_), +}; + + +static GR_BITMAP oneleg_bg[] = { /* one leg background */ + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,X,X,X,X,X,X,X,_), + BITS(X,X,X,X,X,X,X,X,X), + BITS(X,X,X,X,_,X,X,X,X), + BITS(X,X,X,X,X,X,X,X,X), + BITS(_,_,X,X,X,X,X,X,X), + BITS(_,_,_,_,X,X,X,X,_), + BITS(_,_,_,_,X,X,X,X,_), + BITS(_,_,_,_,X,X,X,X,_) +}; + + +static GR_BITMAP noleg_fg[] = { /* no legs foreground */ + BITS(_,_,_,_,_,_,_,_,_), + BITS(_,_,_,X,X,X,_,_,_), + BITS(_,_,_,X,X,X,_,_,_), + BITS(_,_,_,X,X,X,_,_,_), + BITS(_,_,_,_,X,_,_,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,X,_,X,_,X,_,X,_), + BITS(_,_,_,X,X,X,_,_,_), + BITS(_,_,_,_,_,_,_,_,_), + BITS(_,_,_,_,_,_,_,_,_), + BITS(_,_,_,_,_,_,_,_,_), + BITS(_,_,_,_,_,_,_,_,_), +}; + + +static GR_BITMAP noleg_bg[] = { /* no legs background */ + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,X,X,X,X,X,X,X,_), + BITS(X,X,X,X,X,X,X,X,X), + BITS(X,X,X,X,_,X,X,X,X), + BITS(X,X,X,X,X,X,X,X,X), + BITS(_,_,X,X,X,X,X,_,_), + BITS(_,_,_,_,_,_,_,_,_), + BITS(_,_,_,_,_,_,_,_,_), + BITS(_,_,_,_,_,_,_,_,_) +}; + + +/* + * Components of a cell. + */ +#define F_EMPTY ' ' /* default value for empty square */ +#define F_REMEMBER '*' /* character to remember mine */ +#define F_WRONG 'X' /* character to remember wrong guess */ +#define F_DISPLAY 0xff /* character to be displayed here */ +#define F_MINE 0x100 /* TRUE if a mine is here */ +#define F_EDGE 0x200 /* TRUE if this is edge of the world */ +#define F_OLD 0x400 /* TRUE if been at this square before */ +#define F_REACH 0x800 /* TRUE if can reach this square */ +#define F_FLAGS 0xff00 /* all flags */ + + +/* + * The status of the game. + * This structure is read and written from the save file. + */ +static struct status { /* status of games */ + long s_magic; /* magic number */ + short s_playing; /* TRUE if playing a game */ + short s_size; /* current size of board */ + short s_mines; /* current number of mines on board */ + short s_legs; /* number of legs left */ + short s_steps; /* number of steps taken this game */ + short s_index; /* current game parameter index */ + short s_sizeparam[MAXPARAMS]; /* table of size parameters */ + short s_mineparam[MAXPARAMS]; /* table of mine parameters */ + long s_games0[MAXPARAMS]; /* games finished with no legs */ + long s_games1[MAXPARAMS]; /* games finished with one leg */ + long s_games2[MAXPARAMS]; /* games finished with two legs */ + long s_steps0[MAXPARAMS]; /* steps taken in no leg games */ + long s_steps1[MAXPARAMS]; /* steps taken in one leg games */ + long s_steps2[MAXPARAMS]; /* steps taken in two leg games */ + CELL s_board[FULLSIZE*FULLSIZE]; /* board layout */ +} st; + + +/* + * Definitions to make structure references easy. + */ +#define magic st.s_magic +#define playing st.s_playing +#define size st.s_size +#define mines st.s_mines +#define legs st.s_legs +#define steps st.s_steps +#define index st.s_index +#define sizeparam st.s_sizeparam +#define mineparam st.s_mineparam +#define games0 st.s_games0 +#define games1 st.s_games1 +#define games2 st.s_games2 +#define steps0 st.s_steps0 +#define steps1 st.s_steps1 +#define steps2 st.s_steps2 +#define board st.s_board + + +#define boardpos(row, col) (((row) * FULLSIZE) + (col)) +#define ismine(cell) ((cell) & F_MINE) +#define isedge(cell) ((cell) & F_EDGE) +#define isold(cell) ((cell) & F_OLD) +#define isseen(cell) (((cell) & F_DISPLAY) == F_REMEMBER) +#define isknown(cell) (((cell) & F_DISPLAY) != F_EMPTY) +#define displaychar(cell) ((cell) & F_DISPLAY) +#define badsquare(n) (((n) <= 0) || ((n) > size)) + + +/* + * Offsets for accessing adjacent cells. + */ +static POS steptable[8] = { + FULLSIZE, -FULLSIZE, 1, -1, FULLSIZE-1, + FULLSIZE+1, -FULLSIZE-1, -FULLSIZE+1 +}; + + +static GR_WINDOW_ID mainwid; /* main window id */ +static GR_WINDOW_ID boardwid; /* board window id */ +static GR_WINDOW_ID statwid; /* status display window id */ +static GR_WINDOW_ID quitwid; /* window id for quit button */ +static GR_WINDOW_ID savewid; /* window id for save button */ +static GR_WINDOW_ID newgamewid; /* window id for new game button */ + +static GR_GC_ID boardgc; /* graphics context for board */ +static GR_GC_ID cleargc; /* GC for clearing cell of board */ +static GR_GC_ID redgc; /* GC for drawing red */ +static GR_GC_ID greengc; /* GC for drawing green */ +static GR_GC_ID blackgc; /* GC for drawing black */ +static GR_GC_ID delaygc; /* GC for delaying */ +static GR_GC_ID statgc; /* GC for status window */ +static GR_GC_ID buttongc; /* GC for drawing buttons */ +static GR_GC_ID xorgc; /* GC for inverting things */ + +static GR_SIZE xp; /* pixels for x direction per square */ +static GR_SIZE yp; /* pixels for y direction per square */ +static GR_SIZE statwidth; /* width of window drawing text in */ +static GR_SIZE statheight; /* height of window drawing text in */ +static GR_SIZE charheight; /* height of characters */ +static GR_COORD charxpos; /* current X position for characters */ +static GR_COORD charypos; /* current Y position for characters */ + +static GR_SCREEN_INFO si; /* window information */ +static GR_FONT_INFO fi; /* font information */ + +static GR_SIZE COLS, ROWS; + +static char *savefile; /* filename for saving game */ + + +/* + * Procedures. + */ +static void printline(GR_COORD, char *, ...); +static void newline(); +static void delay(); +static void dokey(); +static void handleevent(); +static void doexposure(); +static void dobutton(); +static void drawbomb(); +static void drawstatus(); +static void drawbutton(); +static void drawboard(); +static void drawcell(); +static void cellcenter(); +static void clearcell(); +static void newgame(); +static void movetopos(); +static void setcursor(); +static void togglecell(); +static void gameover(); +static void readgame(); +static void findindex(); +static POS findcell(); +static GR_BOOL checkpath(); +static GR_BOOL writegame(); + +int +main(argc,argv) + int argc; + char **argv; +{ + GR_COORD x; + GR_COORD y; + GR_SIZE width; + GR_SIZE height; + GR_COORD rightx; /* x coordinate for right half stuff */ + GR_BOOL setsize; /* TRUE if size of board is set */ + GR_BOOL setmines; /* TRUE if number of mines is set */ + GR_SIZE newsize = 10; /* desired size of board */ + GR_COUNT newmines = 25; /* desired number of mines */ + GR_WM_PROPERTIES props; + + setmines = GR_FALSE; + setsize = GR_FALSE; + + argc--; + argv++; + while ((argc > 0) && (**argv == '-')) { + switch (argv[0][1]) { + case 'm': + if (argc <= 0) { + fprintf(stderr, "Missing mine count\n"); + exit(1); + } + argc--; + argv++; + newmines = atoi(*argv); + setmines = GR_TRUE; + break; + + case 's': + if (argc <= 0) { + fprintf(stderr, "Missing size\n"); + exit(1); + } + argc--; + argv++; + newsize = atoi(*argv); + setsize = GR_TRUE; + break; + + default: + fprintf(stderr, "Unknown option \"-%c\"\n", + argv[0][1]); + exit(1); + } + argc--; + argv++; + } + if (argc > 0) + savefile = *argv; + + srand(time(0)); + + readgame(savefile); + + if (setsize) { + if ((newsize < MINSIZE) || (newsize > MAXSIZE)) { + fprintf(stderr, "Illegal board size\n"); + exit(1); + } + if (newsize != size) { + if (steps && playing) { + fprintf(stderr, + "Cannot change size while game is in progress\n"); + exit(1); + } + playing = GR_FALSE; + size = newsize; + if (!playing) + mines = (size * size * MINEPERCENT) / 100; + } + } + + if (setmines) { + if ((newmines <= 0) || ((newmines > (size * size) / 2))) { + fprintf(stderr, "Illegal number of mines\n"); + exit(1); + } + if (newmines != mines) { + if (steps && playing) { + fprintf(stderr, + "Cannot change mines while game is in progress\n"); + exit(1); + } + playing = GR_FALSE; + mines = newmines; + } + } + + findindex(); + + /* + * Parameters of the game have been verified. + * Now open the graphics and play the game. + */ + + if (GrOpen() < 0) { + fprintf(stderr, "Cannot open graphics\n"); + exit(1); + } + + GrReqShmCmds(655360); /* Test by Morten Rolland for shm support */ + + GrGetScreenInfo(&si); + GrGetFontInfo(0, &fi); + charheight = fi.height; + + /* + * Create the main window which will contain all the others. + */ +#if 0 +COLS = si.cols - 40; +#else +COLS = si.cols; +#endif +ROWS = si.rows - 80; + mainwid = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, COLS, ROWS, + 0, BLACK, WHITE); + + /* set title */ + props.flags = GR_WM_FLAGS_TITLE | GR_WM_FLAGS_PROPS; + props.props = GR_WM_PROPS_APPFRAME | GR_WM_PROPS_CAPTION; + props.title = "Land Mine"; + GrSetWMProperties(mainwid, &props); + + /* + * Create the board window which lies at the left side. + * Make the board square, and as large as possible while still + * leaving room to the right side for statistics and buttons. + */ + width = COLS - RIGHTSIDE - (si.xdpcm * RIGHTGAP / 10) - BOARDBORDER * 2; + height = (((long) width) * si.ydpcm) / si.xdpcm; + if (height > ROWS /* - y * 2*/) { + height = ROWS - BOARDBORDER * 2; + width = (((long) height) * si.xdpcm) / si.ydpcm; + } + xp = width / size; + yp = height / size; + + width = xp * size - 1; + height = yp * size - 1; + x = BOARDBORDER; + y = (ROWS - height) / 2; + + rightx = x + width + (si.xdpcm * RIGHTGAP / 10); + boardwid = GrNewWindow(mainwid, x, y, width, height, BOARDBORDER, + BLUE, WHITE); + /* + * Create the buttons. + */ + x = rightx; + y = (si.ydpcm * BOARDGAP / 10); + quitwid = GrNewWindow(mainwid, x, y, BUTTONWIDTH, BUTTONHEIGHT, + 1, RED, WHITE); + + y += (si.ydpcm * BUTTONGAP / 10); + savewid = GrNewWindow(mainwid, x, y, BUTTONWIDTH, BUTTONHEIGHT, + 1, GREEN, WHITE); + + y += (si.ydpcm * BUTTONGAP / 10); + newgamewid = GrNewWindow(mainwid, x, y, BUTTONWIDTH, BUTTONHEIGHT, + 1, GREEN, WHITE); + + /* + * Create the statistics window. + */ + x = rightx; + y += (si.ydpcm * STATUSGAP / 10); + width = COLS - x; + height = ROWS - y; + statwid = GrNewWindow(mainwid, x, y, width, height, 0, + 0, 0); + statwidth = width; + statheight = height; + + /* + * Create the GC for drawing the board. + */ + boardgc = GrNewGC(); + cleargc = GrNewGC(); + delaygc = GrNewGC(); + redgc = GrNewGC(); + greengc = GrNewGC(); + statgc = GrNewGC(); + blackgc = GrNewGC(); + buttongc = GrNewGC(); + xorgc = GrNewGC(); + GrSetGCBackground(boardgc, BLUE); + GrSetGCForeground(cleargc, BLUE); + GrSetGCForeground(redgc, RED); + GrSetGCForeground(greengc, GREEN); + GrSetGCForeground(statgc, GRAY); + GrSetGCForeground(delaygc, BLACK); + GrSetGCForeground(blackgc, BLACK); + GrSetGCMode(delaygc, GR_MODE_XOR); + GrSetGCMode(xorgc, GR_MODE_XOR); + GrSetGCUseBackground(boardgc, GR_FALSE); + GrSetGCUseBackground(buttongc, GR_FALSE); + + GrSelectEvents(mainwid, GR_EVENT_MASK_CLOSE_REQ); + + GrSelectEvents(boardwid, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_KEY_DOWN); + + GrSelectEvents(statwid, GR_EVENT_MASK_EXPOSURE); + + GrSelectEvents(quitwid, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + + GrSelectEvents(newgamewid, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + + GrSelectEvents(savewid, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + + setcursor(); + + GrMapWindow(mainwid); + GrMapWindow(boardwid); + GrMapWindow(statwid); + GrMapWindow(quitwid); + GrMapWindow(savewid); + GrMapWindow(newgamewid); + + if (!playing) + newgame(); + + while (GR_TRUE) { + GR_EVENT event; + + GrGetNextEvent(&event); + handleevent(&event); + } +} + + +/* + * Read the next event and handle it. + */ +static void +handleevent(GR_EVENT *ep) +{ + switch (ep->type) { + case GR_EVENT_TYPE_BUTTON_DOWN: + dobutton(&ep->button); + break; + + case GR_EVENT_TYPE_EXPOSURE: + doexposure(&ep->exposure); + break; + + case GR_EVENT_TYPE_KEY_DOWN: + dokey(&ep->keystroke); + break; + + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + } +} + + +/* + * Handle exposure events. + */ +static void +doexposure(ep) + GR_EVENT_EXPOSURE *ep; +{ + if (ep->wid == boardwid) { + drawboard(); + return; + } + + if (ep->wid == statwid) { + drawstatus(); + return; + } + + if (ep->wid == quitwid) { + drawbutton(quitwid, "QUIT"); + return; + } + + if (ep->wid == savewid) { + drawbutton(savewid, "SAVE GAME"); + return; + } + + if (ep->wid == newgamewid) { + drawbutton(newgamewid, "NEW GAME"); + return; + } +} + + +/* + * Here when we get a button down event. + */ +static void +dobutton(bp) + GR_EVENT_BUTTON *bp; +{ + if (bp->wid == boardwid) { + movetopos(findcell(bp->x, bp->y)); + return; + } + + if (bp->wid == quitwid) { + GrFillRect(quitwid, xorgc, 0, 0, BUTTONWIDTH, BUTTONHEIGHT); + GrFlush(); + if (savefile) + writegame(savefile); + GrClose(); + exit(0); + } + + if (bp->wid == savewid) { + GrFillRect(savewid, xorgc, 0, 0, BUTTONWIDTH, BUTTONHEIGHT); + GrFlush(); + if (savefile == NULL) + savefile = SAVEFILE; + if (writegame(savefile)) + write(1, "\007", 1); + else + delay(); + GrFillRect(savewid, xorgc, 0, 0, BUTTONWIDTH, BUTTONHEIGHT); + } + + if (bp->wid == newgamewid) { + GrFillRect(newgamewid, xorgc, 0, 0, BUTTONWIDTH, BUTTONHEIGHT); + GrFlush(); + /*if (playing) + write(1, "\007", 1); + else {*/ + newgame(); + delay(); + /*}*/ + GrFillRect(newgamewid, xorgc, 0, 0, BUTTONWIDTH, BUTTONHEIGHT); + } +} + + +/* + * Here when we get a keypress in a window. + */ +static void +dokey(kp) + GR_EVENT_KEYSTROKE *kp; +{ + if ((kp->wid != boardwid) || !playing) + return; + + switch (kp->ch) { + case ' ': /* remember or forget mine */ + togglecell(findcell(kp->x, kp->y)); + break; + } +} + + +/* + * Redraw the board. + */ +static void +drawboard() +{ + GR_COORD row; + GR_COORD col; + + for (row = 1; row < size; row++) { + GrLine(boardwid, boardgc, 0, row * yp - 1, size * xp - 1, + row * yp - 1); + GrLine(boardwid, boardgc, row * xp - 1, 0, + row * xp - 1, size * yp - 1); + } + for (row = 0; row < FULLSIZE; row++) { + for (col = 0; col < FULLSIZE; col++) { + drawcell(boardpos(row, col)); + } + } +} + + +/* + * Draw a cell on the board. + */ +static void +drawcell(pos) + POS pos; /* position to be drawn */ +{ + GR_COORD x; + GR_COORD y; + GR_SIZE chwidth; + GR_SIZE chheight; + GR_SIZE chbase; + CELL cell; + GR_CHAR ch; + + cell = board[pos]; + if (!isknown(cell)) + return; + + ch = displaychar(cell); + if (ch == F_WRONG) { + drawbomb(pos, greengc, GR_FALSE); + return; + } + + if (isold(cell)) { + clearcell(pos); + cellcenter(pos, &x, &y); + GrGetGCTextSize(boardgc, &ch, 1, GR_TFASCII, &chwidth, + &chheight, &chbase); + GrText(boardwid, boardgc, x - chwidth / 2 + 1, + y + chheight / 2, &ch, 1, GR_TFBOTTOM); + return; + } + + drawbomb(pos, redgc, GR_FALSE); +} + + +/* + * Clear a particular cell. + */ +static void +clearcell(pos) + POS pos; /* position to be cleared */ +{ + GR_COORD row; + GR_COORD col; + + row = pos / FULLSIZE; + col = pos % FULLSIZE; + GrFillRect(boardwid, cleargc, col * xp - xp, row * yp - yp, + xp - 1, yp - 1); +} + + +/* + * Draw a bomb in a window using the specified GC. + * The bomb is animated and the terminal is beeped if necessary. + */ +static void +drawbomb(pos, gc, animate) + POS pos; /* position to draw bomb at */ + GR_GC_ID gc; /* GC for drawing (red or green) */ + GR_BOOL animate; /* TRUE to animate the bomb */ +{ + GR_COORD x; + GR_COORD y; + GR_COUNT count; + + if (animate) + write(1, "\007", 1); + + cellcenter(pos, &x, &y); + + count = (animate ? 8 : 1); + for (;;) { + GrFillEllipse(boardwid, gc, x, y, xp / 2 - 3, yp / 2 - 3); + if (--count == 0) + return; + delay(); + clearcell(pos); + delay(); + } +} + + +/* + * Draw a button which has a specified label string centered in it. + */ +static void +drawbutton(window, label) + GR_WINDOW_ID window; + char *label; +{ + GR_SIZE width; + GR_SIZE height; + GR_SIZE base; + + GrGetGCTextSize(buttongc, label, strlen(label), GR_TFASCII, &width, + &height, &base); + GrText(window, buttongc, (BUTTONWIDTH - width) / 2, + (BUTTONHEIGHT - height) / 2 + height - 1, + label, -1, GR_TFBOTTOM); +} + + +/* + * Set the cursor as appropriate. + * The cursor changes depending on the number of legs left. + */ +static void +setcursor() +{ + GR_BITMAP *fgbits; /* bitmap for foreground */ + GR_BITMAP *bgbits; /* bitmap for background */ + + switch (legs) { + case 0: + fgbits = noleg_fg; + bgbits = noleg_bg; + break; + case 1: + fgbits = oneleg_fg; + bgbits = oneleg_bg; + break; + default: + fgbits = twolegs_fg; + bgbits = twolegs_bg; + break; + } + GrSetCursor(boardwid, 9, 12, 4, 6, WHITE, BLACK, fgbits, bgbits); +} + + +/* + * Delay for a while so that something can be seen. + * This is done by drawing a large rectangle over the window using a mode + * of XOR with the value of 0, (which does nothing except waste time). + */ +static void +delay() +{ + GR_COUNT i; + + for (i = 0; i < 1; i++) { + GrFillRect(boardwid, delaygc, 0, 0, xp * size - 1, + yp * size - 1); + GrFlush(); + } +} + + +/* + * Calculate the coordinates of the center of a cell on the board. + * The coordinates are relative to the origin of the board window. + */ +static void +cellcenter(pos, retx, rety) + POS pos; /* position to find center of */ + GR_COORD *retx; /* returned X coordinate */ + GR_COORD *rety; /* returned Y coordinate */ +{ + *retx = (pos % FULLSIZE) * xp - 1 - xp / 2; + *rety = (pos / FULLSIZE) * yp - 1 - yp / 2; +} + + +/* + * Draw the status information in the status window. + */ +static void +drawstatus() +{ + long score; + long allsteps; + long games; + + score = 0; + games = games0[index]; + allsteps = steps0[index]; + score += games1[index]; + games += games1[index]; + allsteps += steps1[index]; + score += games2[index] * 2; + games += games2[index]; + allsteps += steps2[index]; + + printline(0, "Size: %2d\n", size); + printline(1, "Mines: %3d\n", mines); + PRINTSTEPS; + printline(3, "Legs: %d\n", legs); + + printline(5, "Won games: %3d\n", games2[index]); + printline(6, "1-leg games:%3d\n", games1[index]); + printline(7, "Lost games: %3d\n", games0[index]); + + if (games) { + printline(9, "Legs/game: %3d.%03d\n", score / games, + ((score * 1000) / games) % 1000); + + printline(10, "Steps/game:%3d.%03d\n", allsteps / games, + ((allsteps * 1000) / games) % 1000); + } +} + + +/* + * Printf routine for windows, which can print at particular lines. + * A negative line number means continue printing at the previous location. + * Assumes the status window for output. + */ +static void printline(GR_COORD row, char * fmt, ...) +{ + va_list ap; + GR_COUNT cc; + GR_SIZE width; + char *cp; + char buf[256]; + + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + va_end(ap); + + if (row >= 0) { + charxpos = 0; + charypos = charheight * row + charheight - 1; + } + + cp = buf; + for (;;) { + cc = 0; + width = 0; + while (*cp >= ' ') { + width += fi.widths[(int)*cp++]; + cc++; + } + if (width) { + GrText(statwid, statgc, charxpos, charypos, + cp - cc, cc, GR_TFBOTTOM); + charxpos += width; + } + + switch (*cp++) { + case '\0': + return; + case '\n': + newline(); + break; + case '\r': + charxpos = 0; + break; + } + } +} + + +/* + * Clear the remainder of the line and move to the next line. + * This assumes output is in the status window. + */ +static void +newline() +{ + GrFillRect(statwid, blackgc, charxpos, charypos - charheight + 1, + statwidth - charxpos, charheight); + charxpos = 0; + charypos += charheight; +} + + +/* + * Translate a board window coordinate into a cell position. + * If the coordinate is outside of the window, or exactly on one + * of the interior lines, then a coordinate of 0 is returned. + */ +static POS +findcell(x, y) + GR_COORD x; + GR_COORD y; +{ + GR_COORD row; + GR_COORD col; + + if (((x % xp) == 0) || ((y % yp) == 0)) + return 0; + row = (y / yp) + 1; + col = (x / xp) + 1; + if ((row <= 0) || (row > size) || (col <= 0) || (col > size)) + return 0; + return boardpos(row, col); +} + + +/* + * Initialize the board for playing + */ +static void +newgame() +{ + GR_COORD row; + GR_COORD col; + GR_COUNT count; + CELL cell; + POS pos; + + for (row = 0; row < FULLSIZE; row++) { + for (col = 0; col < FULLSIZE; col++) { + cell = F_EMPTY; + if (badsquare(row) || badsquare(col)) + cell |= F_EDGE; + board[boardpos(row, col)] = cell; + } + } + + playing = GR_TRUE; + count = 0; + legs = 2; + steps = 0; + drawstatus(); + setcursor(); + + while (count < mines) { + do { + row = (rand() / 16) % (size * size + 1); + } while (row == (size * size)); + + col = (row % size) + 1; + row = (row / size) + 1; + pos = boardpos(row, col); + + if ((pos == boardpos(1,1)) || (pos == boardpos(1,2)) || + (pos == boardpos(2,1)) || (pos == boardpos(2,2)) || + (pos == boardpos(size,size))) + continue; + + if (!ismine(board[pos]) && checkpath(pos)) + count++; + } + + board[boardpos(1,1)] = (F_OLD | '0'); + + GrClearWindow(boardwid, GR_TRUE); +} + + +/* + * Check to see if there is still a path from the top left corner to the + * bottom right corner, if a new mine is placed at the indicated position. + * Returns GR_TRUE if mine was successfully placed. + */ +static GR_BOOL +checkpath(pos) + POS pos; /* position to place mine at */ +{ + CELL *bp; /* current board position */ + CELL *endbp; /* ending position */ + POS endpos; /* ending position */ + GR_COUNT count; /* number of neighbors */ + GR_COUNT i; /* loop counter */ + GR_BOOL more; /* GR_TRUE if new square reached */ + + /* + * Begin by assuming there is a mine at the specified location, + * and then count neighbors. If there are less than two other + * mines or edge squares, then there must still be a path. + */ + board[pos] |= F_MINE; + + count = 0; + + for (i = 7; i >= 0; i--) { + if (board[pos + steptable[i]] & (F_MINE | F_EDGE)) + count++; + } + + if (count < 2) + return GR_TRUE; + + /* + * Two or more neighbors, so we must do the full check. + * First clear the reach flag, except for the top left corner. + */ + endpos = boardpos(size, size); + bp = &board[endpos]; + endbp = bp; + while (bp != board) + *bp-- &= ~F_REACH; + board[boardpos(1,1)] |= F_REACH; + + /* + * Now loop looking for new squares next to already reached squares. + * Stop when no more changes are found, or when the lower right + * corner is reached. + */ + do { + more = GR_FALSE; + for (bp = &board[boardpos(1,1)]; bp != endbp; bp++) { + if (*bp & F_REACH) { + for (i = 7; i >= 0; i--) { + if ((bp[steptable[i]] & (F_MINE | F_REACH | F_EDGE)) == 0) { + bp[steptable[i]] |= F_REACH; + more = GR_TRUE; + } + } + } + } + + if (board[endpos] & F_REACH) + return GR_TRUE; + } while (more); + + /* + * Cannot reach the lower right corner, so remove the mine and fail. + */ + board[pos] &= ~F_MINE; + + return GR_FALSE; +} + + +/* + * Move to a particular position and see if we hit a mine. + * If not, then count the number of mines adjacent to us so it can be seen. + * If we are stepping onto a location where we remembered a mine is at, + * then don't do it. Moving is only allowed to old locations, or to + * locations adjacent to old ones. + */ +static void +movetopos(newpos) + POS newpos; /* position to move to */ +{ + POS fixpos; /* position to fix up */ + CELL cell; /* current cell */ + GR_COUNT count; /* count of cells */ + GR_COUNT i; /* index for neighbors */ + + if ((newpos < 0) || (newpos >= (FULLSIZE * FULLSIZE)) || !playing) + return; + + cell = board[newpos]; + + if (isedge(cell) || (isseen(cell)) || isold(cell)) + return; + + count = isold(cell); + for (i = 0; i < 8; i++) + if (isold(board[newpos + steptable[i]])) + count++; + + if (count <= 0) + return; + + cell = (cell & F_FLAGS) | F_OLD; + steps++; + + PRINTSTEPS; + + if (ismine(cell)) { /* we hit a mine */ + legs--; + board[newpos] = (F_REMEMBER | F_MINE); + cell = (F_EMPTY | F_OLD); + board[newpos] = cell; + drawbomb(newpos, redgc, GR_TRUE); + clearcell(newpos); + setcursor(); + for (i = 0; i < 8; i++) { + fixpos = newpos + steptable[i]; + if (isold(board[fixpos])) { + board[fixpos]--; + drawcell(fixpos); + } + } + drawstatus(); + } + + count = 0; + for (i = 0; i < 8; i++) + if (ismine(board[newpos + steptable[i]])) + count++; + board[newpos] = cell | (count + '0'); + + drawcell(newpos); + + if ((legs <= 0) || (newpos == boardpos(size,size))) + gameover(); +} + + +/* + * Remember or forget the location of a mine. + * This is for informational purposes only and does not affect anything. + */ +static void +togglecell(pos) + POS pos; /* position to toggle */ +{ + CELL cell; + + if ((pos <= 0) || !playing) + return; + + cell = board[pos]; + if (isknown(cell)) { + if (!isseen(cell)) + return; + board[pos] = (board[pos] & F_FLAGS) | F_EMPTY; + clearcell(pos); + return; + } + + board[pos] = (board[pos] & F_FLAGS) | F_REMEMBER; + drawcell(pos); +} + + +/* + * Here when the game is over. + * Show where the mines are, and give the results. + */ +static void +gameover() +{ + POS pos; + CELL cell; + + playing = GR_FALSE; + switch (legs) { + case 0: + games0[index]++; + steps0[index] += steps; + break; + case 1: + games1[index]++; + steps1[index] += steps; + break; + case 2: + games2[index]++; + steps2[index] += steps; + break; + } + + for (pos = 0; pos < (FULLSIZE * FULLSIZE); pos++) { + cell = board[pos]; + if (isseen(cell)) + cell = (cell & F_FLAGS) | F_WRONG; + if (ismine(cell)) + cell = (cell & F_FLAGS) | F_REMEMBER; + board[pos] = cell; + } + + drawboard(); + drawstatus(); +} + + +/* + * Search the game parameter table for the current board size and + * number of mines, and set the index for those parameters so that + * the statistics can be accessed. Allocates a new index if necessary. + */ +static void +findindex() +{ + for (index = 0; index < MAXPARAMS; index++) { + if ((sizeparam[index] == size) && (mineparam[index] == mines)) + return; + } + for (index = 0; index < MAXPARAMS; index++) { + if (sizeparam[index] == 0) { + sizeparam[index] = size; + mineparam[index] = mines; + return; + } + } + fprintf(stderr, "Too many parameters in save file\n"); + exit(1); +} + + +/* + * Read in a saved game if available, otherwise start from scratch. + * Exits if an error is encountered. + */ +static void +readgame(name) + char *name; /* filename */ +{ + int fd; + + fd = -1; + if (name) + fd = open(name, 0); + + if (fd < 0) { + magic = MAGIC; + size = SIZE; + mines = (size * size * MINEPERCENT) / 100; + playing = GR_FALSE; + return; + } + + if (read(fd, &st, sizeof(st)) != sizeof(st)) + magic = 0; + close(fd); + + if ((magic != MAGIC) || (size > MAXSIZE)) { + fprintf(stderr, "Save file format is incorrect\n"); + exit(1); + } +} + + +/* + * Write the current game to a file. + * Returns nonzero on an error. + */ +static GR_BOOL +writegame(name) + char *name; /* filename */ +{ + int fd; + + if (name == NULL) + return GR_TRUE; + + fd = creat(name, 0666); + if (fd < 0) + return GR_TRUE; + + if (write(fd, &st, sizeof(st)) != sizeof(st)) { + close(fd); + return GR_TRUE; + } + close(fd); + return GR_FALSE; +} + +/* END CODE */ diff --git a/packages/services/gfx/mw/current/src/demos/nanox/landmine.doc b/packages/services/gfx/mw/current/src/demos/nanox/landmine.doc new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/landmine.doc @@ -0,0 +1,108 @@ + LANDMINE + + +Landmine is a game in which you try to safely move step by step from the +top left corner of a square board to the bottom right corner of the board. +Scattered among the cells of the board are invisible mines which blow up +if you step on them. When you step on a mine, one of your legs is blown +off, and if you lose both legs, then the game is over. + +Steps are made one at a time from any cell you have already visited to +any of the eight possible cells which are adjacent to it. At the start +of the game you are placed in the top left corner of the board, which is +guaranteed to have no mine in it. There are also no mines immediately +adjacent to the starting cell. There is also a guaranteed path from the +starting cell to the finishing cell which does not encounter any mines. + +You cannot see the mines, however you have a detector which indicates +the presence of the mines. The detector cannot locate the direction of +any individual mine, but it does indicate the number of mines immediately +adjacent to your cell. By using this information from all the cells you +have already visited, you can usually deduce where the mines must be. +In this way, you can find your way safely to the destination cell. Some +of the deductions that can be made are very subtle, and experience will +improve your scores dramatically. + +When landmine is started up under mini-X, the board is displayed at the +left side, some buttons are displayed at the upper right, and some statistics +are displayed at the lower right. To make a step, use the mouse to move the +cursor onto the cell that you wish to step on, and press a button. A number +will appear in that square (if there is no mine there!) indicating now many +mines are adjacent to that square. You can step onto any cell which is +adjacent to any cell you have already stepped on. + +In order to help you deduce where the mines are and what steps are safe, +you can mark any non-visited cell as containing a mine. To do this, move +the mouse to that cell, and then type a space. A red circle will then +appear in that cell to indicate that you think it contains a mine. A +side effect of doing this is that you cannot accidentally step on the +square while it is marked. Notice that the cell is marked as you request +whether or not a mine is actually there, thus if you mistakenly mark a +cell, you are likely to get confused and later step on a real mine! If +you think that a cell is marked in error, you can clear the marking by +moving the mouse to the cell and then typing another space. + +If you step on a mine, you will hear a beep, and a red circle will flash +on and off for a few seconds to indicate that the mine has exploded. +Then the mine will be removed, and the counts in the adjacent cells +will be adjusted to reflect the new situation with one less mine. Your +number of legs is also reduced by 1, and the cursor shape is changed to +indicate this. If you lose both legs, then the game is lost. If you +successfully make it to the lower right corner, then the game is won. + +When the game is over, the location of all mines are marked with red circles. +In addition, if you had marked cells as containing mines, but the cells were +wrongly marked, then those cells are shown with green circles. After you +have analyzed the results of the game, you can start a new game by using +the NEW GAME button. + +The three buttons on the top right of the screen are QUIT, SAVE GAME, +and NEW GAME. The buttons are activated by moving the cursor to the +interior of the button, and pressing any mouse button. No confirmation +is asked for these actions. + +QUIT will immediately quit playing and return you to text mode and exit. +However, if you had started landmine with a filename to restore from, +then the current status will be saved back to that file. If you had not +supplied a filename on starting, and have not saved the game using the +SAVE GAME button, then QUIT will quit without saving anything. + +SAVE GAME is used to save the current status of the game without exiting. +This lets you make sure that the game is saved away when you have been +playing for a long time and are worried about crashes. If you had given +a file for restoring of previous games, then the game will be saved back +into that file. If you had not specified a filename, then a default name +of "landmine.save" will be used. If the save operation works, the button +will momentarily flash. If the save operation fails, then a beep will +be sounded. + +NEW GAME is used to start a new game. This button can only be used after +a game has just been completed. That is, after both legs have been blown +off or you have reached the destination cell, you use this button to +begin another game. + +When starting landmine, you can specify some options on the command line. +The options are the following: + + landmine [-s n] [-m n] [savefile] + +The savefile is the filename to save the game into when the SAVE GAME or +QUIT buttons are used, as described above. + +The -s option sets the size of the board. The size is the number of cells +across the board, and also down the board. The board size can be set to +any size from 3 to 30. The default size is 15. + +The -m option sets the number of mines on the board. This can be set from +1 to 50% of the number of cells on the board. The default number of mines +is 15% of the number of cells on the board. For the default board size, +the default number of mines is 33. + +The statistics saved in the save file are kept for each combination of +board size and mines, thus you can play with many different combinations +of values and the statistics will be kept separately. There is a limit +of 1000 different combinations that can be saved. + +You cannot change the board size or number of mines while a game is in +progress. To change the parameters, finish the game, save the game into a +file and exit, then restart landmine giving the new parameters. diff --git a/packages/services/gfx/mw/current/src/demos/nanox/landmine.syms b/packages/services/gfx/mw/current/src/demos/nanox/landmine.syms new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/landmine.syms @@ -0,0 +1,1 @@ +landmine_main diff --git a/packages/services/gfx/mw/current/src/demos/nanox/launcher.c b/packages/services/gfx/mw/current/src/demos/nanox/launcher.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/launcher.c @@ -0,0 +1,599 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is NanoLauncher. + * + * The Initial Developer of the Original Code is Alex Holden. + * Portions created by Alex Holden are Copyright (C) 2000 + * Alex Holden . All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public license (the "[GNU] License"), in which case the + * provisions of [GNU] License are applicable instead of those + * above. If you wish to allow use of your version of this file only + * under the terms of the [GNU] License and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the [GNU] License. If you do not delete + * the provisions above, a recipient may use your version of this file + * under either the MPL or the [GNU] License. + */ + +/* + * A simple application launcher for Nano-X by Alex Holden. + * + * The application needs to be started with the first argument specifying + * the location of it's configuration file. The format of the file is + * extremely simple- each line can contain either a comment (indicated by + * beginning the line with a '#' symbol) or an item description. + * An item description consists of the name of the item (the title which + * appears underneath the icon on the launcher button) followed by the name + * of the icon file (or '-' for no icon) and the command to execute when the + * item is clicked on. The command can optionally be followed by a limited + * number of arguments to pass to the program when it is executed (increase + * MAX_ARGUMENTS in launcher.h if you need more). The program will currently + * only allow one icon size (specified at compile time by the ICON_WIDTH and + * ICON_HEIGHT parameters). The program only loads each icon file once even if + * it is used multiple times, so you can save a small amount of memory by + * using the same icon for several programs. If you want to change the size + * of the item buttons, change ITEM_WIDTH and ITEM_HEIGHT in launcher.h. + * The way the launcher decides whether to draw a vertical panel on the left + * hand side of the screen or a horizontal panel along the bottom is by + * looking at the width and height of the screen- the panel will be placed on + * the side on portrait screens and on the bottom on landscape screens. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MWINCLUDECOLORS +#include "nano-X.h" +#include "launcher.h" + +void reaper(int signum) { while(waitpid(WAIT_ANY, NULL, WNOHANG) > 0); } + +void *my_malloc(size_t size) +{ + void *ret; + + if(!(ret = malloc(size))) { + fprintf(stderr, "Out of memory\n"); + exit(1); + } + + return ret; +} + +void usage(void) +{ + fprintf(stderr, "Usage: launcher \n"); + exit(3); +} + +prog_item *make_prog_item(char *buf, int lineno) +{ + char *p, *pp, *command; + prog_item *prog; + int n; + + p = buf; + + prog = my_malloc(sizeof(prog_item)); + + for(n = 0; n < MAX_ARGUMENTS; n++) prog->argv[n] = NULL; + + while(isspace(*p)) p++; + if(!*p) { + fprintf(stderr, "Premature end of line on line %d of config " + "file\n", lineno); + return 0; + } + command = p; + while(*p && (!isspace(*p))) p++; + *p++ = 0; + if(!(prog->command = strdup(command))) { + free(prog); + goto nomem; + } + pp = p - 1; + while(--pp != command) { + if(*pp == '/') { + pp++; + break; + } + } + if(!(prog->argv[0] = strdup(pp))) { + free(prog->command); + free(prog); + goto nomem; + } + + n = 1; + while(*p) { + while(isspace(*p)) p++; + if(!*p) break; + pp = p; + while(*p && (!isspace(*p))) p++; + *p++ = 0; + if(!(prog->argv[n] = strdup(pp))) { + for(n = MAX_ARGUMENTS; n; n--) + if(prog->argv[n]) free(prog->argv[n]); + free(prog->command); + free(prog); + goto nomem; + } + if(++n == (MAX_ARGUMENTS - 1)) { + fprintf(stderr, "Too many arguments on line " + "%d of the config file\n", lineno); + break; + } + } + + return prog; + +nomem: + fprintf(stderr, "Out of memory parsing line %d of the config " + "file\n", lineno); + return 0; +} + +void set_window_background_colour(char *buf, int lineno) +{ + GR_WM_PROPERTIES props; + char *p = buf, *pp; + + while(isspace(*p)) p++; + if(!*p) { + fprintf(stderr, "Premature end of line on line %d of config " + "file\n", lineno); + return; + } + pp = p; + while(*p && (!isspace(*p))) p++; + *p = 0; + + if(!strcmp(pp, "BLACK")) props.background = BLACK; + else if(!strcmp(pp, "BLUE")) props.background = BLUE; + else if(!strcmp(pp, "GREEN")) props.background = GREEN; + else if(!strcmp(pp, "CYAN")) props.background = CYAN; + else if(!strcmp(pp, "RED")) props.background = RED; + else if(!strcmp(pp, "MAGENTA")) props.background = MAGENTA; + else if(!strcmp(pp, "BROWN")) props.background = BROWN; + else if(!strcmp(pp, "LTGRAY")) props.background = LTGRAY; + else if(!strcmp(pp, "GRAY")) props.background = GRAY; + else if(!strcmp(pp, "LTBLUE")) props.background = LTBLUE; + else if(!strcmp(pp, "LTGREEN")) props.background = LTGREEN; + else if(!strcmp(pp, "LTCYAN")) props.background = LTCYAN; + else if(!strcmp(pp, "LTRED")) props.background = LTRED; + else if(!strcmp(pp, "LTMAGENTA")) props.background = LTMAGENTA; + else if(!strcmp(pp, "YELLOW")) props.background = YELLOW; + else if(!strcmp(pp, "WHITE")) props.background = WHITE; + else { + fprintf(stderr, "Invalid colour \"%s\" on line %d of config " + "file\n", pp, lineno); + return; + } + + props.flags = GR_WM_FLAGS_BACKGROUND; + GrSetWMProperties(GR_ROOT_WINDOW_ID, &props); +} + +void parse_config_line(lstate *state, char *buf, int lineno) +{ + char *p, *pp, *name, *icon; + int n; + litem *new_litem, *li; + sitem *new_sitem; + GR_IMAGE_INFO imageinfo; + + p = buf; + + if((!*p) || (*p == '#') || (*p == '\n')) return; + + while(isspace(*p)) p++; + name = p; + while(*p && (!isspace(*p))) p++; + if(!*p) goto premature; + *p++ = 0; + + if(!strcmp(name, "$screensaver")) { + new_sitem = my_malloc(sizeof(sitem)); + if(!(new_sitem->prog = make_prog_item(p, lineno))) { + free(new_sitem); + return; + } + new_sitem->next = NULL; + if(!state->sitems) { + state->sitems = new_sitem; + state->cursitem = new_sitem; + } else { + new_sitem->next = state->sitems; + state->sitems = new_sitem; + } + return; + } else if(!strcmp(name, "$screensaver_timeout")) { + n = strtol(p, NULL, 10); + GrSetScreenSaverTimeout(n); + return; + } else if(!strcmp(name, "$window_background_image")) { + while(isspace(*p)) p++; + if(!*p) goto premature; + pp = p; + while(*p && (!isspace(*p))) p++; + *p = 0; + state->window_background_image = strdup(pp); + return; + } else if(!strcmp(name, "$window_background_mode")) { + state->window_background_mode = (int) strtol(p, NULL, 10); + return; + } else if(!strcmp(name, "$window_background_colour")) { + set_window_background_colour(p, lineno); + return; + } + + while(isspace(*p)) p++; + if(!*p) goto premature; + icon = p; + while(*p && (!isspace(*p))) p++; + if(!*p) goto premature; + *p++ = 0; + + new_litem = my_malloc(sizeof(litem)); + if(!(new_litem->name = strdup(name))) { + free(new_litem); + goto nomem; + } + if(!(new_litem->icon = strdup(icon))) { + free(new_litem->name); + free(new_litem); + goto nomem; + } + if(!(new_litem->prog = make_prog_item(p, lineno))) { + free(new_litem->name); + free(new_litem->icon); + free(new_litem); + return; + } + new_litem->iconid = 0; + if(strcmp("-", icon)) { + li = state->litems; + while(li) { + if(!(strcmp(icon, li->name))) { + new_litem->iconid = li->iconid; + break; + } + li = li->next; + } + if(!new_litem->iconid) { + if(!(new_litem->iconid = GrLoadImageFromFile(icon, 0))){ + fprintf(stderr, "Couldn't load icon \"%s\"\n", + icon); + } else { + GrGetImageInfo(new_litem->iconid, &imageinfo); + if((imageinfo.width != ICON_WIDTH) || + (imageinfo.height != ICON_HEIGHT)) { + fprintf(stderr, "Icon \"%s\" is the " + "wrong size (%dx%d instead of %dx%d)" + "\n", icon, imageinfo.width, + imageinfo.height, ICON_WIDTH, + ICON_HEIGHT); + GrFreeImage(new_litem->iconid); + new_litem->iconid = 0; + } + } + } + } + + new_litem->prev = NULL; + new_litem->next = NULL; + if(!state->litems) { + state->lastlitem = new_litem; + state->litems = new_litem; + } else { + new_litem->next = state->litems; + state->litems->prev = new_litem; + state->litems = new_litem; + } + + state->numlitems++; + + return; + +nomem: + fprintf(stderr, "Out of memory\n"); + exit(1); + +premature: + fprintf(stderr, "Premature end of line on line %d of config file\n", + lineno); +} + +void read_config(lstate *state) +{ + int lineno = 1; + FILE *fp; + char *buf = my_malloc(256); + + if(!(fp = fopen(state->config_file, "r"))) { + fprintf(stderr, "Couldn't open config file \"%s\"\n", + state->config_file); + exit(2); + } + + state->litems = NULL; + state->numlitems = 0; + state->sitems = NULL; + + while(fgets(buf, 256, fp)) { + parse_config_line(state, buf, lineno); + lineno++; + } + + fclose(fp); + free(buf); + + if(!state->numlitems) { + fprintf(stderr, "No valid launcher items in config file\n"); + exit(5); + } +} + +void draw_item(lstate *state, litem *item) +{ + GR_SIZE width, height, base, x, len; + + GrDrawImageToFit(item->wid, state->gc, ICON_X_POSITION, ICON_Y_POSITION, + ICON_WIDTH, ICON_HEIGHT, item->iconid); + + len = strlen(item->name); + GrGetGCTextSize(state->gc, item->name, len, 0, &width, &height, &base); + if(width >= ITEM_WIDTH) x = 0; + else x = (ITEM_WIDTH - width) / 2; + + GrText(item->wid, state->gc, x, TEXT_Y_POSITION, item->name, len, 0); +} + +void handle_exposure_event(lstate *state) +{ + GR_EVENT_EXPOSURE *event = &state->event.exposure; + litem *i = state->litems; + + if(event->wid == state->main_window) return; + + while(i) { + if(event->wid == i->wid) { + draw_item(state, i); + return; + } + i = i->next; + } + + fprintf(stderr, "Got exposure event for unknown window %d\n", + event->wid); +} + +void launch_program(prog_item *prog) +{ + pid_t pid; + + if((pid = fork()) == -1) perror("Couldn't fork"); + else if(!pid) { + if(execvp(prog->command, prog->argv) == -1) + fprintf(stderr, "Couldn't start \"%s\": %s\n", + prog->command, strerror(errno)); + exit(7); + } +} + +void handle_mouse_event(lstate *state) +{ + GR_EVENT_MOUSE *event = &state->event.mouse; + litem *i = state->litems; + + if(event->wid == state->main_window) return; + + while(i) { + if(event->wid == i->wid) { + launch_program(i->prog); + return; + } + i = i->next; + } + + fprintf(stderr, "Got mouse event for unknown window %d\n", event->wid); +} + +void handle_screensaver_event(lstate *state) +{ + GR_EVENT_SCREENSAVER *event = &state->event.screensaver; + + if(event->activate != GR_TRUE) return; + + if(!state->sitems) { + fprintf(stderr, "Got screensaver activate event with no " + "screensavers defined\n"); + return; + } + + state->cursitem = state->cursitem->next; + if(!state->cursitem) state->cursitem = state->sitems; + + launch_program(state->cursitem->prog); +} + +void handle_event(lstate *state) +{ + switch(state->event.type) { + case GR_EVENT_TYPE_EXPOSURE: + handle_exposure_event(state); + break; + case GR_EVENT_TYPE_BUTTON_DOWN: + handle_mouse_event(state); + break; + case GR_EVENT_TYPE_CLOSE_REQ: + break; + case GR_EVENT_TYPE_SCREENSAVER: + handle_screensaver_event(state); + break; + case GR_EVENT_TYPE_NONE: + break; + default: + fprintf(stderr, "Got unknown event type %d\n", + state->event.type); + break; + } +} + +void do_event_loop(lstate *state) +{ + do { + GrGetNextEvent(&state->event); + handle_event(state); + } while(state->event.type != GR_EVENT_TYPE_CLOSE_REQ); +} + +void initialise(lstate *state) +{ + GR_SCREEN_INFO si; + GR_IMAGE_ID back_image; + GR_IMAGE_INFO imageinfo; + int rows = 1, columns = 1, width, height, x = 0, y = 1; + GR_WM_PROPERTIES props; + litem *i; + + if(GrOpen() < 0) { + fprintf(stderr, "Couldn't connect to Nano-X server\n"); + exit(4); + } + + state->window_background_mode = 0; + state->window_background_image = NULL; + + read_config(state); + + GrGetScreenInfo(&si); + + if(si.rows > si.cols) { + rows = state->numlitems; + while((((rows / columns) + rows % columns) * ITEM_HEIGHT) > + si.rows) { + columns++; + } + if((columns * ITEM_WIDTH) > si.cols) goto toomany; + rows = (rows / columns) + (rows % columns); + width = columns * ITEM_WIDTH + 1 + columns; + height = rows * ITEM_HEIGHT + 1 + rows; + } else { + columns = state->numlitems; + while((((columns / rows) + (columns % rows)) * ITEM_WIDTH) > + si.cols) { + rows++; + } + if((rows * ITEM_HEIGHT) > si.rows) goto toomany; + columns = (columns / rows) + (columns % rows); + width = columns * ITEM_WIDTH + 1 + columns; + height = (rows * ITEM_HEIGHT) + 1 + rows; + y = si.rows - (rows * ITEM_HEIGHT) - 1 - rows; + } + + state->gc = GrNewGC(); + GrSetGCForeground(state->gc, ITEM_TEXT_COLOUR); + GrSetGCBackground(state->gc, ITEM_BACKGROUND_COLOUR); + + if(state->window_background_image) { + if(!(back_image = GrLoadImageFromFile( + state->window_background_image, 0))) { + fprintf(stderr, "Couldn't load background image\n"); + } else { + GrGetImageInfo(back_image, &imageinfo); + if(!(state->background_pixmap = GrNewPixmap( + imageinfo.width, + imageinfo.height, NULL))) { + fprintf(stderr, "Couldn't allocate pixmap " + "for background image\n"); + } else { + GrDrawImageToFit(state->background_pixmap, + state->gc, 0, 0, imageinfo.width, + imageinfo.height, back_image); + GrFreeImage(back_image); + GrSetBackgroundPixmap(GR_ROOT_WINDOW_ID, + state->background_pixmap, + state->window_background_mode); + GrClearWindow(GR_ROOT_WINDOW_ID, GR_TRUE); + } + } + } + + if(state->sitems) + GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_SCREENSAVER); + + state->main_window = GrNewWindow(GR_ROOT_WINDOW_ID, 0, y, width, height, + 0, ITEM_BACKGROUND_COLOUR, 0); + GrSelectEvents(state->main_window, GR_EVENT_MASK_CLOSE_REQ); + props.flags = GR_WM_FLAGS_PROPS; + props.props = GR_WM_PROPS_NOMOVE | GR_WM_PROPS_NODECORATE | + GR_WM_PROPS_NOAUTOMOVE | GR_WM_PROPS_NOAUTORESIZE; + GrSetWMProperties(state->main_window, &props); + + i = state->lastlitem; + y = 0; + while(i) { + i->wid = GrNewWindow(state->main_window, + (x * ITEM_WIDTH) + x + 1, + (y * ITEM_HEIGHT) + y + 1, ITEM_WIDTH, + ITEM_HEIGHT, 1, ITEM_BACKGROUND_COLOUR, + ITEM_BORDER_COLOUR); + GrSelectEvents(i->wid, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + GrMapWindow(i->wid); + i = i->prev; + if(++x == columns) { + x = 0; + y++; + } + } + + GrMapWindow(state->main_window); + + signal(SIGCHLD, &reaper); + + return; + +toomany: + fprintf(stderr, "Too many items to fit on screen\n"); + exit(6); +} + +int main(int argc, char *argv[]) +{ + lstate *state; + + if(argc != 2) usage(); + + state = my_malloc(sizeof(lstate)); + state->config_file = strdup(argv[1]); + + initialise(state); + + do_event_loop(state); + + GrClose(); + + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/launcher.cnf b/packages/services/gfx/mw/current/src/demos/nanox/launcher.cnf new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/launcher.cnf @@ -0,0 +1,55 @@ +# Sample launcher configuration file + +# These are the screen savers to use: +# A simple screen blanker: +# $screensaver bin/nsaver 1 +# Draws random dots: +$screensaver bin/nsaver 2 +# Draws random lines: +$screensaver bin/nsaver 3 +# Draws worms that crawl randomly around the screen: +$screensaver bin/nsaver 4 +# Draws a star field accelerating towards the viewer: +$screensaver bin/nsaver 5 +# Draws a simulated lightning storm: +$screensaver bin/nsaver 6 +# Draws an orbiting planet simulation: +$screensaver bin/nsaver 7 +# Draws a moire interference pattern: +$screensaver bin/nsaver 8 + +# This is the screen saver timeout delay (in seconds): +$screensaver_timeout 300 + +# This is the file to use as the root window background image: +$window_background_image bin/tux.gif + +# This is the mode to use for the window background: +# 0 = tile across screen +# 1 = draw once in centre of screen +# 2 = draw once at top left of screen +$window_background_mode 0 + +# This is the background colour to use for the root window: +# Possible values are: +# BLACK, BLUE, GREEN, RED, MAGENTA, BROWN, LTGRAY, GRAY, LTBLUE, LTGREEN, +# LTCYAN, LTRED, LTMAGENTA, YELLOW, WHITE. +# $window_background_colour GREEN + +# These are the launcher panel items. Each line is in the format: + +# The item name must not contain any spaces. +# <...> +# The item name must not contain any spaces. +# The icon filename can be the letter '-' to specify no icon. + +Tetris bin/ntetris.ppm bin/ntetris +Landmine - bin/landmine +Slider - bin/slider demos/nanox/slidebmp.bmp +Terminal - bin/nxterm +Clock - bin/nxclock +Map - bin/world +Scribble - bin/nxscribble +SoftKeyboard - bin/nxkbd +Logo - bin/nxview bin/nanogui.ppm +Roach - bin/nxroach -roaches 10 diff --git a/packages/services/gfx/mw/current/src/demos/nanox/launcher.h b/packages/services/gfx/mw/current/src/demos/nanox/launcher.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/launcher.h @@ -0,0 +1,102 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is NanoLauncher. + * + * The Initial Developer of the Original Code is Alex Holden. + * Portions created by Alex Holden are Copyright (C) 2000 + * Alex Holden . All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public license (the "[GNU] License"), in which case the + * provisions of [GNU] License are applicable instead of those + * above. If you wish to allow use of your version of this file only + * under the terms of the [GNU] License and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the [GNU] License. If you do not delete + * the provisions above, a recipient may use your version of this file + * under either the MPL or the [GNU] License. + */ + +#ifndef LAUNCHER_H +#define LAUNCHER_H + +#define ITEM_WIDTH 100 +#define ITEM_HEIGHT 60 +#define ITEM_TEXT_COLOUR BLACK +#define ITEM_BORDER_COLOUR BLACK +#define ITEM_BACKGROUND_COLOUR LTGRAY +#define ICON_WIDTH 32 +#define ICON_HEIGHT 32 +#define ICON_X_POSITION ((ITEM_WIDTH - ICON_WIDTH) / 2) +#define ICON_Y_POSITION 6 +#define TEXT_Y_POSITION (ITEM_HEIGHT - 6) +#define MAX_ARGUMENTS 12 + +struct command_argv { + char *command; + char *argv[MAX_ARGUMENTS]; +}; +typedef struct command_argv prog_item; + +struct launcher_item { + char *name; + char *icon; + prog_item *prog; + struct launcher_item *next; + struct launcher_item *prev; + GR_IMAGE_ID iconid; + GR_WINDOW_ID wid; +}; +typedef struct launcher_item litem; + +struct screensaver_item { + prog_item *prog; + struct screensaver_item *next; +}; +typedef struct screensaver_item sitem; + +struct launcher_state { + char *config_file; + GR_WINDOW_ID main_window; + litem *litems; + litem *lastlitem; + int numlitems; + sitem *sitems; + sitem *cursitem; + GR_GC_ID gc; + GR_EVENT event; + int window_background_mode; + char *window_background_image; + GR_WINDOW_ID background_pixmap; +}; +typedef struct launcher_state lstate; + +void reaper(int signum); +void *my_malloc(size_t size); +void usage(void); +prog_item *make_prog_item(char *command, int lineno); +void set_window_background_colour(char *buf, int lineno); +void parse_config_line(lstate *state, char *buf, int lineno); +void read_config(lstate *state); +void draw_item(lstate *state, litem *item); +void handle_exposure_event(lstate *state); +void launch_program(prog_item *prog); +void handle_mouse_event(lstate *state); +void handle_screensaver_event(lstate *state); +void handle_event(lstate *state); +void do_event_loop(lstate *state); +void initialise(lstate *state); + +#endif diff --git a/packages/services/gfx/mw/current/src/demos/nanox/logfont.c b/packages/services/gfx/mw/current/src/demos/nanox/logfont.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/logfont.c @@ -0,0 +1,106 @@ +#include +#include +#include +#include +#if UNIX +#include +#endif +#define MWINCLUDECOLORS +#include "nano-X.h" +/* + * logical font demo for Nano-X + */ + +#define MAXW 630 +#define MAXH 470 + +int main(int argc, char **argv) +{ + GR_WINDOW_ID window; + GR_EVENT event; + GR_GC_ID gc; + GR_FONT_ID fontid; + int x, y, rnd = 0; + MWLOGFONT lf; + char description[128]; + + srand(time(0)); + + GrOpen(); + window = GrNewWindow(GR_ROOT_WINDOW_ID, 5, 5, MAXW, MAXH, 4, BLACK, BLUE); + GrMapWindow(window); + + gc = GrNewGC(); + + GrSelectEvents(window,GR_EVENT_MASK_ALL); + GrSetGCUseBackground(gc,GR_FALSE); + GrSetGCBackground(gc, GR_RGB(0, 0, 0)); + + y = 30; + x = 0; + + while(1) { + GrCheckNextEvent(&event); + + if(event.type == GR_EVENT_TYPE_CLOSE_REQ) { + GrClose(); + exit(0); + } + + /*sleep(1);*/ + + MWLF_Clear(&lf); + description[0] = '\0'; + /*lf.lfSerif = 1;*/ + + if ( rnd & 1 ) { + lf.lfWeight = MWLF_WEIGHT_BOLD; + strcat(description,"Bold "); + } + + + if ( rnd & 2 ) { + lf.lfItalic = 1; + strcat(description,"Italics "); + } + if ( rnd & 4 ) { + lf.lfOblique = 1; + strcat(description,"Oblique "); + } + + if ( rnd & 8 ) { + lf.lfMonospace = 1; + strcat(description,"Monospace "); + } else { + lf.lfProportional = 1; + strcat(description,"Proportional "); + } + + if ( argc > 1 ) + strcpy(lf.lfFaceName,argv[1]); + else + strcpy(lf.lfFaceName,"fantasy"); + + fontid = GrCreateFont(0, 0, &lf); + /* GrSetFontSize(fontid, 1+(int)(80.0 * rand() / (RAND_MAX+1.0))); */ + GrSetFontSize(fontid,26); + GrSetFontRotation(fontid, 330); /* 33 degrees*/ + GrSetFontAttr(fontid, GR_TFKERNING | GR_TFANTIALIAS, 0); + GrSetGCFont(gc, fontid); + /*GrSetGCBackground(gc, rand() & 0xffffff);*/ + GrSetGCForeground(gc, 0xffffff); + /* x = (int) ((MAXW * 1.0) *rand()/(RAND_MAX+1.0)); + y = (int) ((MAXH * 1.0) *rand()/(RAND_MAX+1.0)); */ + + GrText(window, gc,x,y, description, -1, GR_TFASCII); + + GrDestroyFont(fontid); + + rnd++; + y += 30; + if ( y > 460 ) + y = 0; + } + + GrClose(); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/logfont_ksc.c b/packages/services/gfx/mw/current/src/demos/nanox/logfont_ksc.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/logfont_ksc.c @@ -0,0 +1,108 @@ +/* KSC5601 test program*/ +#include +#include +#include +#include +#if UNIX +#include +#endif +#define MWINCLUDECOLORS +#include "nano-X.h" +/* + * logical font demo for Nano-X + */ + +#define MAXW 630 +#define MAXH 470 + +int main(int argc, char **argv) +{ + GR_WINDOW_ID window; + GR_EVENT event; + GR_GC_ID gc; + GR_FONT_ID fontid; + int x, y, rnd = 0; + MWLOGFONT lf; + char description[128]; + + srand(time(0)); + + GrOpen(); + window = GrNewWindow(GR_ROOT_WINDOW_ID, 5, 5, MAXW, MAXH, 4, BLACK, BLUE); + GrMapWindow(window); + + gc = GrNewGC(); + + GrSelectEvents(window,GR_EVENT_MASK_ALL); + GrSetGCUseBackground(gc,GR_FALSE); + GrSetGCBackground(gc, GR_RGB(0, 0, 0)); + + y = 30; + x = 0; + + while(1) { + GrCheckNextEvent(&event); + + if(event.type == GR_EVENT_TYPE_CLOSE_REQ) { + GrClose(); + exit(0); + } + + sleep(1); + + MWLF_Clear(&lf); + description[0] = '\0'; + + // lf.lfSerif = 1; + + if ( rnd & 1 ) { + lf.lfWeight = MWLF_WEIGHT_BOLD; + strcat(description,"Bold "); + } + + + if ( rnd & 2 ) { + lf.lfItalic = 1; + strcat(description,"Italics "); + } + if ( rnd & 4 ) { + lf.lfOblique = 1; + strcat(description,"Oblique "); + } + + if ( rnd & 8 ) { + lf.lfMonospace = 1; + strcat(description,"°íÁ¤Æø Monospace "); + } else { + lf.lfProportional = 1; + strcat(description,"Proportional "); + } + + if ( argc > 1 ) + strcpy(lf.lfFaceName,argv[1]); + else + strcpy(lf.lfFaceName,"fantasy"); + + fontid = GrCreateFont(0, 0, &lf); + /* GrSetFontSize(fontid, 1+(int)(80.0 * rand() / (RAND_MAX+1.0))); */ + GrSetFontSize(fontid,26); + GrSetFontRotation(fontid, 330); /* 33 degrees*/ + GrSetFontAttr(fontid, GR_TFKERNING | GR_TFANTIALIAS, 0); + GrSetGCFont(gc, fontid); + /*GrSetGCBackground(gc, rand() & 0xffffff);*/ + GrSetGCForeground(gc, 0xffffff); + /* x = (int) ((MAXW * 1.0) *rand()/(RAND_MAX+1.0)); + y = (int) ((MAXH * 1.0) *rand()/(RAND_MAX+1.0)); */ + + GrText(window, gc,x,y, description, -1, GR_TFASCII); + + GrDestroyFont(fontid); + + rnd++; + y += 30; + if ( y > 460 ) + y = 0; + } + + GrClose(); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/move.c b/packages/services/gfx/mw/current/src/demos/nanox/move.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/move.c @@ -0,0 +1,107 @@ +#include +#define MWINCLUDECOLORS +#include "nano-X.h" +/* + * Demo to test child window movement and redrawing + */ +int +main(int ac,char **av) +{ + GR_COORD offset_x = 0, offset_y = 0; + GR_WINDOW_ID window1, subwindow1, subsubwin1; + GR_WINDOW_ID window2, subwindow2; + /*GR_WINDOW_ID subsubwin2;*/ + GR_EVENT event; + + fprintf(stderr,"This is a demo program.\n"); + fprintf(stderr,"Left-button drags window\n"); + fprintf(stderr,"Right-button raises window\n"); + + GrOpen(); + window1 = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 20, 100, 60, 4, BLACK, BLUE); + subwindow1 = GrNewWindow(window1, 5, 5, 90, 50, 4, WHITE, RED); + subsubwin1 = GrNewWindow(subwindow1, 10, 10, 10, 10, 2, GREEN, BLUE); + + window2 = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 100, 100, 60, 4, BLACK, BLUE); + subwindow2 = GrNewWindow(window2, 5, 5, 90, 50, 4, WHITE, RED); +/* subsubwin2 = GrNewWindow(subwindow2, 10, 10, 10, 10, 2, GREEN, BLUE); */ + + GrSelectEvents(window1, + GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_BUTTON_UP | + GR_EVENT_MASK_MOUSE_ENTER | + GR_EVENT_MASK_MOUSE_EXIT | + GR_EVENT_MASK_MOUSE_MOTION | + GR_EVENT_MASK_CLOSE_REQ); + + GrSelectEvents(window2, + GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_BUTTON_UP | + GR_EVENT_MASK_MOUSE_ENTER | + GR_EVENT_MASK_MOUSE_EXIT | + GR_EVENT_MASK_MOUSE_MOTION | + GR_EVENT_MASK_CLOSE_REQ); + + GrSelectEvents(subsubwin1, + GR_EVENT_MASK_BUTTON_DOWN | + 0); + + GrMapWindow(subsubwin1); + GrMapWindow(subwindow1); + GrMapWindow(window1); + + /*GrMapWindow(subsubwin2);*/ + GrMapWindow(subwindow2); + GrMapWindow(window2); + + while(1) { + GrGetNextEvent(&event); + + switch (event.type) { + case GR_EVENT_TYPE_NONE: + break; + case GR_EVENT_TYPE_BUTTON_DOWN: + offset_x = event.button.x; + offset_y = event.button.y; + + if (event.button.changebuttons & GR_BUTTON_R) { + GrRaiseWindow(event.button.wid); + } + if (event.button.wid == subsubwin1) { + GR_WINDOW_INFO winfo; + GrGetWindowInfo(subsubwin1, &winfo); + if (winfo.parent == subwindow1) { + GrReparentWindow(subsubwin1, subwindow2, 10, 10); + } else { + GrReparentWindow(subsubwin1, subwindow1, 10, 10); + } + } + case GR_EVENT_TYPE_MOUSE_MOTION: + if (event.mouse.buttons == GR_BUTTON_L && + (event.mouse.wid == window1 || event.mouse.wid == window2)) { + GrMoveWindow(event.mouse.wid, + event.mouse.rootx - offset_x, + event.mouse.rooty - offset_y); + } + if (event.mouse.buttons == GR_BUTTON_R) { + GrResizeWindow(event.mouse.wid, + event.mouse.x + 1, + event.mouse.y + 1); + } + break; + case GR_EVENT_TYPE_EXPOSURE: + /*GrFillRect(event.exposure.wid, defgc, + event.exposure.x, event.exposure.y, + event.exposure.width, event.exposure.height);*/ + break; + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + default: + fprintf(stderr, "%d\n", event.type); + } + } + GrClose(); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/nanogui.ppm b/packages/services/gfx/mw/current/src/demos/nanox/nanogui.ppm new file mode 100644 index 0000000000000000000000000000000000000000..58a2ae0cc60db15dce01e16ca75ea926dd372d9f GIT binary patch literal 95630 zc%1FM_jhDRo&U}5v%pBBQS6*^ZsnYF?3{DXId@B~943!FPJnF;*uXB!V$#MhyDZq) zB%ANA&)73I?0@py9?4Qm>f3$$wxlup_?-9QaKKY4l|S>UcU8S_m8`$MXRwzt*i+x# z*H{1l{@<_GqDOzacA^hY>w_Zwu}FV7t=|{vcYx}S^xM;V|41JJdap>oIjwh#^vA#Nj@uB|nSl2)PMUno`Y5hl${=G>5R-}JDt$%4a(LWdT_)tGT zt)CU?r$ze7Y5f?`jU&BXq#vEuKNabRH=Z2pAB*&ZVl_Vbha&xbk-mRg-z(C0i}cnh zee!10iM~^$Zx`uXr}ajWzFDN#57m66*NXJ&kv;|Vjnn#ik-k=>SB}+E(91=7sYovt z>4npJSkRvj^?Z?@Ydxh0MY><4d#81`NOy{K8&KPcZngd8ST~DwP^A6S+AGrTp%4Y_ zoYr=cwu-cg_@82J6lwif$p6U~Y3;ODk(b4v51{eq_t5zBei47(1Lsc(_*CN0e^=no zIrx<24;XyP@aJF7^5=0${`?FYe|}uVpSQvJ0|p;Z{+xzS8UB0^5`RG9Q-(ipl;=+= z_>|!f7<|444L)V~^ALCGCyVbb2a9t41fL^8h6b;?L!opHlq! zJer>}{J9$QbE*8f8uL?zKbK&BK7wt2ATGWx&-|3(&p(~gGd4dE7hjiWeoFJ_9DE=y zzAn%FoaN7jo1aqr*@niSjp`R)tF`h6j`=CWpJMoc@TYq7QwP)hlv#XzuFMa_#n_D;_LFvPlcW5=IVBy%bK4jZ#EYH%9pb9d;#XCwY2%U*q!IgGd~y2 zA75fE?ztKCZDzf>h%LHm%J_`&yxpC&`=Vz5n%91Wqd%50KNa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J+A diff --git a/packages/services/gfx/mw/current/src/demos/nanox/npanel.c b/packages/services/gfx/mw/current/src/demos/nanox/npanel.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/npanel.c @@ -0,0 +1,378 @@ +/* + * nano-X launcher/window manager program + * (C) 1999 Alistair Riddoch + * (C) 2000 Alex Holden + */ + +/* + Undefine this if solid window moves are incredibly slow on your hardware. + Unfortunately since outline moves are not supported yet, the only + alternative is "invisible" moving. +*/ +#define SHOW_WINDOW_MOTION + +/* + Define this if you want the mouse pointer to become bell shaped when over + the launcher window. +*/ +#undef USE_WEIRD_POINTER + +#include +#include +#include +#include +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + +/* + * Definitions to make it easy to define cursors + */ +#define _ ((unsigned) 0) /* off bits */ +#define X ((unsigned) 1) /* on bits */ +#define MASK(a,b,c,d,e,f,g) \ + (((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \ + + e) * 2) + f) * 2) + g) << 9) + +#define DEC_HEIGHT 7 +#define IDLE_DELAY 100000 + +static GR_WINDOW_ID w1; /* id for launcher window */ +static GR_GC_ID gc; /* graphics context for rectangle */ +static GR_GC_ID bgc; /* graphics context for rectangle */ +static GR_SCREEN_INFO si; /* information about screen */ +static int fwidth, fheight; +static int fbase; +static int num_apps = 0; + +void do_exposure(); +void do_buttondown(); +void do_buttonup(); +void do_update(); +void do_mouse(); + +struct app_info { + char app_id[10]; + char app_path[64]; +} Apps[] = { +#if ELKS + {"clock", "/root/nclock"}, + {"term", "/root/nterm"}, + {"demo", "/root/demo"}, + {"demo2", "/root/demo2"}, +#else + {"clock", "bin/nclock"}, + {"term", "bin/nterm"}, + {"demo", "bin/demo"}, + {"demo2", "bin/demo2"}, + {"ntest", "bin/ntest"}, +#endif + {"", ""} +}; + +typedef struct managed_window mwin; +struct managed_window { + GR_WINDOW_ID wid; /* Application's window */ + GR_WINDOW_ID fid; /* Title bar */ + GR_COORD x; /* Overall window X origin */ + GR_COORD y; /* Overall window Y origin */ + GR_SIZE width; /* Overall width of window */ + mwin * next; +}; + +mwin * mwins = NULL; +mwin * in_motion = NULL; +GR_COORD move_xoff; +GR_COORD move_yoff; + +/* + * Reap the dead children whenever we get a SIGCHLD. + */ +void reaper(int signum) { while(waitpid(WAIT_ANY, NULL, WNOHANG) > 0); } + +int +main(int argc,char **argv) +{ + GR_EVENT event; /* current event */ + struct app_info * act; + int width, height; + +#ifdef USE_WEIRD_POINTER + GR_BITMAP bitmap1fg[7]; /* bitmaps for first cursor */ + GR_BITMAP bitmap1bg[7]; +#endif + + for(act = Apps; act->app_id[0] != '\0'; act++, num_apps++); + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + GrGetScreenInfo(&si); + + signal(SIGCHLD, &reaper); + + gc = GrNewGC(); + bgc = GrNewGC(); + + GrSetGCForeground(bgc, GRAY); + GrSetGCFont(gc, GrCreateFont(GR_FONT_OEM_FIXED, 0, NULL)); + + GrGetGCTextSize(gc, "A", 1, GR_TFASCII, &fwidth, &fheight, &fbase); + width = fwidth * 8 + 4; + height = (fheight) * num_apps + 4; + + w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 5, 5, width, + height, 1, WHITE, BLACK); + + GrSelectEvents(w1, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_BUTTON_DOWN + | GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_CHLD_UPDATE); + + GrMapWindow(w1); + +#ifdef USE_WEIRD_POINTER + bitmap1bg[0] = MASK(_,_,X,X,X,_,_); + bitmap1bg[1] = MASK(_,X,X,X,X,X,_); + bitmap1bg[2] = MASK(_,X,X,X,X,X,_); + bitmap1bg[3] = MASK(_,X,X,X,X,X,_); + bitmap1bg[4] = MASK(_,X,X,X,X,X,_); + bitmap1bg[5] = MASK(_,X,X,X,X,X,_); + bitmap1bg[6] = MASK(X,X,X,X,X,X,X); + + bitmap1fg[0] = MASK(_,_,_,_,_,_,_); + bitmap1fg[1] = MASK(_,_,_,X,_,_,_); + bitmap1fg[2] = MASK(_,_,X,X,X,_,_); + bitmap1fg[3] = MASK(_,_,X,X,X,_,_); + bitmap1fg[4] = MASK(_,_,X,X,X,_,_); + bitmap1fg[5] = MASK(_,_,X,X,X,_,_); + bitmap1fg[6] = MASK(_,X,X,X,X,X,_); + + GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg); +#endif + + GrFillRect(GR_ROOT_WINDOW_ID, bgc, 0, 0, si.cols, si.rows); + + GrSetGCForeground(gc, BLACK); + GrSetGCBackground(gc, WHITE); + + while (1) { + GrGetNextEvent(&event); + + switch (event.type) { + case GR_EVENT_TYPE_EXPOSURE: + do_exposure(&event.exposure); + break; + case GR_EVENT_TYPE_BUTTON_DOWN: + do_buttondown(&event.button); + break; + case GR_EVENT_TYPE_BUTTON_UP: + do_buttonup(&event.button); + break; + case GR_EVENT_TYPE_UPDATE: + do_update(&event.update); + break; + case GR_EVENT_TYPE_MOUSE_POSITION: + do_mouse(&event.mouse); + break; + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + } + } +} + +mwin * IsDecoration(GR_WINDOW_ID wid) +{ + mwin * mwp; + for(mwp = mwins; mwp; mwp = mwp->next) { + if (mwp->fid == wid) { + return mwp; + } + } + return NULL; +} + +mwin * FindWindow(GR_WINDOW_ID wid) +{ + mwin * mwp; + for(mwp = mwins; mwp; mwp = mwp->next) { + if (mwp->wid == wid) { + return mwp; + } + } + return NULL; +} + +mwin * NewWindow(GR_WINDOW_ID wid) +{ + mwin * mwp = malloc(sizeof(mwin)); + + if (mwp) { + mwp->wid = wid; + mwp->next = mwins; + mwins = mwp; + } + return mwp; +} + +void +do_update(ep) + GR_EVENT_UPDATE *ep; +{ + mwin * mwp; + mwin * tmwp; + GR_WINDOW_INFO winfo; + + if (IsDecoration(ep->wid)) return; + + if ((mwp = FindWindow(ep->wid)) == NULL) { + /* We have a new window */ + if (ep->utype != GR_UPDATE_MAP) return; + if ((mwp = NewWindow(ep->wid)) == NULL) { + printf("malloc failed\n"); + return; + } + GrGetWindowInfo(ep->wid, &winfo); + mwp->x = ep->x - winfo.bordersize; + mwp->y = ep->y - winfo.bordersize; + mwp->width = ep->width + 2 * winfo.bordersize; + GrMoveWindow(mwp->wid, mwp->x + winfo.bordersize, + mwp->y + DEC_HEIGHT + + 2 * winfo.bordersize); + mwp->fid = GrNewWindow(GR_ROOT_WINDOW_ID, mwp->x + 1, + mwp->y + 1, mwp->width - 2, + DEC_HEIGHT - 2, 1, BLUE, BLACK); + GrSelectEvents(mwp->fid, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_POSITION); + GrMapWindow(mwp->fid); + } else { + switch (ep->utype) { + case GR_UPDATE_UNMAP: + GrUnmapWindow(mwp->fid); + GrDestroyWindow(mwp->fid); + if (mwins == mwp) { + mwins = mwp->next; + } else for(tmwp = mwins; tmwp; tmwp = tmwp->next) { + if (tmwp->next == mwp) { + tmwp->next = mwp->next; + } + } + free(mwp); + break; + case GR_UPDATE_MOVE: + GrGetWindowInfo(ep->wid, &winfo); + if ((ep->x == (mwp->x + winfo.bordersize)) && + (ep->y == (mwp->y + winfo.bordersize + + DEC_HEIGHT))) { + return; + } + mwp->x = ep->x - winfo.bordersize; + mwp->y = ep->y - winfo.bordersize - DEC_HEIGHT; + GrMoveWindow(mwp->fid, mwp->x + 1, mwp->y + 1); + default: + break; + } + } +} + +/* + * Handle mouse position events + */ +void do_mouse(ep) + GR_EVENT_MOUSE *ep; +{ +#ifdef SHOW_WINDOW_MOTION + GR_WINDOW_INFO winfo; + + if(!in_motion) return; + + in_motion->x = ep->rootx - move_xoff - 1; + in_motion->y = ep->rooty - move_yoff - 1; + GrMoveWindow(in_motion->fid, in_motion->x + 1, in_motion->y + 1); + GrGetWindowInfo(in_motion->wid, &winfo); + GrMoveWindow(in_motion->wid, in_motion->x + winfo.bordersize - 1, + in_motion->y + 2 * winfo.bordersize + DEC_HEIGHT - 1); +#endif +} + +/* + * Here when an exposure event occurs. + */ +void +do_exposure(ep) + GR_EVENT_EXPOSURE *ep; +{ + struct app_info * act; + int app_no; + + if (ep->wid == w1) { + for(act=Apps,app_no=0;act->app_id[0]!='\0';act++,app_no++) { + GrText(w1, gc, 2, 2 + fheight * (app_no + 1), + act->app_id, -1, GR_TFBOTTOM); + } + } else if (ep->wid == GR_ROOT_WINDOW_ID) { + GrFillRect(GR_ROOT_WINDOW_ID, bgc, ep->x, ep->y, + ep->width, ep->height); + } +} + +extern char ** environ; + +void +do_buttondown(ep) + GR_EVENT_BUTTON *ep; +{ + mwin * mwp; + static int app_no; + + if (ep->wid == w1) { + app_no = ep->y / fheight; + if (app_no >= num_apps) { + app_no = num_apps - 1; + } + + if (!vfork()) { + char * nargv[2]; + + nargv[0] = Apps[app_no].app_path; + nargv[1] = 0; + execve(nargv[0], nargv, environ); + /* write(1, "\7", 1); */ + exit(1); + } + } else if ((mwp = IsDecoration(ep->wid)) != NULL) { + GrRaiseWindow(mwp->wid); + GrRaiseWindow(mwp->fid); + in_motion = mwp; + move_xoff = ep->x; + move_yoff = ep->y; + } +} + +void +do_buttonup(ep) +GR_EVENT_BUTTON *ep; +{ +#ifdef SHOW_WINDOW_MOTION + in_motion = NULL; +#else + mwin * mwp; + GR_WINDOW_INFO winfo; + + if ((mwp = IsDecoration(ep->wid)) != NULL) { + if (mwp == in_motion) { + mwp->x = ep->rootx - 1 - move_xoff; + mwp->y = ep->rooty - 1 - move_yoff; + GrMoveWindow(mwp->fid, mwp->x + 1, mwp->y + 1); + GrGetWindowInfo(mwp->wid, &winfo); + GrMoveWindow(mwp->wid, mwp->x + winfo.bordersize, + mwp->y + 2 * winfo.bordersize + DEC_HEIGHT); + in_motion = NULL; + } + } +#endif +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/nsaver.c b/packages/services/gfx/mw/current/src/demos/nanox/nsaver.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/nsaver.c @@ -0,0 +1,959 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is NanoScreenSaver. + * + * The Initial Developer of the Original Code is Alex Holden. + * Portions created by Alex Holden are Copyright (C) 2000 + * Alex Holden . All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public license (the "[GNU] License"), in which case the + * provisions of [GNU] License are applicable instead of those + * above. If you wish to allow use of your version of this file only + * under the terms of the [GNU] License and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the [GNU] License. If you do not delete + * the provisions above, a recipient may use your version of this file + * under either the MPL or the [GNU] License. + */ +/* + * A collection of screen savers for Nano-X by Alex Holden. + */ + +#include +#include +#include +#include +#include + +#define MWINCLUDECOLORS +#include "nano-X.h" +#include "nsaver.h" + +void *my_malloc(size_t size) +{ + void *ret; + + if(!(ret = malloc(size))) { + fprintf(stderr, "Out of memory\n"); + exit(1); + } + + return ret; +} + +void get_random_point_on_screen(nstate *state, GR_COORD *x, GR_COORD *y, + GR_COLOR *c) +{ + if(x) { + *x = (int) RANDRANGE(0, (state->si.cols - 1.0)); + } + if(y) { + *y = (int) RANDRANGE(0, (state->si.rows - 1.0)); + } + if(c) { + *c = MWPALINDEX((int)RANDRANGE(0, (state->si.ncolors - 1))); + } +} + +void saver1_init(nstate *state) {} + +void saver1_exposure(nstate *state) +{ + GrClearWindow(state->main_window, 0); +} + +void saver1_animate(nstate *state) {} + +void saver2_init(nstate *state) +{ + (int)state->priv = SAVER2_MAXPIXELS; + state->animate_interval = SAVER2_DELAY; +} + +void saver2_exposure(nstate *state) +{ + GrClearWindow(state->main_window, 0); +} + +void saver2_animate(nstate *state) +{ + GR_COORD x, y; + GR_COLOR c; + int pixels = SAVER2_PIXELS_PER_FRAME; + + while(pixels--) { + if(!((int)state->priv--)) { + (int)state->priv = SAVER2_MAXPIXELS; + GrClearWindow(state->main_window, 0); + } + get_random_point_on_screen(state, &x, &y, &c); + GrSetGCForeground(state->main_gc, c); + GrPoint(state->main_window, state->main_gc, x, y); + } +} + +void saver3_init(nstate *state) +{ + s3state *s = my_malloc(sizeof(s3state)); + state->priv = s; + s->maxsegments = SAVER3_MAXSEGMENTS; + s->lastx = 0; + s->lasty = 0; + state->animate_interval = SAVER3_DELAY; +} + +void saver3_exposure(nstate *state) +{ + GrClearWindow(state->main_window, 0); +} + +void saver3_animate(nstate *state) +{ + GR_COORD newx, newy; + GR_COLOR c; + s3state *s = state->priv; + int pixels = SAVER3_SEGMENTS_PER_FRAME; + + while(pixels--) { + if(!(s->maxsegments--)) { + s->maxsegments = SAVER3_MAXSEGMENTS; + GrClearWindow(state->main_window, 0); + } + get_random_point_on_screen(state, &newx, &newy, &c); + GrSetGCForeground(state->main_gc, c); + GrLine(state->main_window, state->main_gc, s->lastx, s->lasty, + newx, newy); + s->lastx = newx; + s->lasty = newy; + } +} + +void saver4_init(nstate *state) +{ + int i; + + s4state *s = my_malloc(sizeof(s4state)); + state->priv = s; + + s->length = 0; + + for(i = 0; i < SAVER4_NUMWORMS; i++) { + s->tip = 0; + get_random_point_on_screen(state, &s->worms[i].points[0].x, + &s->worms[i].points[0].y, + &s->worms[i].colour); + } + + state->animate_interval = SAVER4_DELAY; +} + +void saver4_exposure(nstate *state) +{ + int i; + s4state *s = state->priv; + + GrClearWindow(state->main_window, 0); + + if(!s->length) return; + + for(i = 0; i < SAVER4_NUMWORMS; i++) { + GrSetGCForeground(state->main_gc, s->worms[i].colour); + GrPoints(state->main_window, state->main_gc, s->length, + s->worms[i].points); + } +} + +void saver4_get_new_worm_position(nstate *state, s4state *s, int worm, + GR_COORD *newx, GR_COORD *newy) +{ + int i; + GR_COORD oldx = s->worms[worm].points[s->tip].x; + GR_COORD oldy = s->worms[worm].points[s->tip].y; + + do { + i = (int)RANDRANGE(0, 3.0); + switch(i) { + case 0: + *newx = oldx + 1; + if(*newx == state->si.cols) *newx = 0; + break; + case 1: + *newx = oldx - 1; + if(*newx == -1) *newx = state->si.cols - 1; + break; + case 2: + *newx = oldx; + break; + } + + i = (int)RANDRANGE(0, 3.0); + switch(i) { + case 0: + *newy = oldy + 1; + if(*newy == state->si.rows) *newy = 0; + break; + case 1: + *newy = oldy - 1; + if(*newy == -1) *newy = state->si.rows - 1; + break; + case 2: + *newy = oldy; + break; + } + } while((*newx == oldx) && (*newy == oldy)); +} + +int saver4_worm_collides(nstate *state, s4state *s, int x, int y, int thisworm, + int thispoint) +{ + int i, n; + + for(i = 0; i < SAVER4_NUMWORMS; i++) { + for(n = 0; n < s->length; n++) { + if((i == thisworm) && (n == thispoint)) continue; + if((s->worms[i].points[n].x == x) && + (s->worms[i].points[n].y) == y) { + return 1; + } + } + } + return 0; +} + +void saver4_animate(nstate *state) +{ + int i, newx, newy, tail, newtip, tries; + s4state *s = state->priv; + + if(s->length == SAVER4_WORMLENGTH) tail = s->tip + 1; + else tail = 0; + if(tail == SAVER4_WORMLENGTH) tail = 0; + newtip = s->tip + 1; + if(newtip == SAVER4_WORMLENGTH) newtip = 0; + + for(i = 0; i < SAVER4_NUMWORMS; i++) { + if(!saver4_worm_collides(state, s, s->worms[i].points[tail].x, + s->worms[i].points[tail].y, i, tail)) { + GrSetGCForeground(state->main_gc, BLACK); + GrPoint(state->main_window, state->main_gc, + s->worms[i].points[tail].x, + s->worms[i].points[tail].y); + } + for(tries = SAVER4_COLLISION_RELUCTANCE; tries; tries--) { + saver4_get_new_worm_position(state, s, i, &newx, + &newy); + if(!saver4_worm_collides(state, s, newx, newy, -1, -1)) + break; + } + s->worms[i].points[newtip].x = newx; + s->worms[i].points[newtip].y = newy; + if(tries) { + GrSetGCForeground(state->main_gc, s->worms[i].colour); + GrPoint(state->main_window, state->main_gc, newx, newy); + } + } + + s->tip = newtip; + if(s->length < SAVER4_WORMLENGTH) s->length++; +} + +void saver5_init(nstate *state) +{ + int i; + + s5state *s = my_malloc(sizeof(s5state)); + state->priv = s; + + s->numstars = 0; + + for(i = 0; i < SAVER5_NUMSTARS; i++) { + s->stars[i].angle = RANDRANGE(0, (2 * M_PI)); + s->stars[i].pos = 1; + } + + state->animate_interval = SAVER5_DELAY; +} + +int saver5_drawstar(nstate *state, s5state *s, int star, int delete) +{ + int opp, adj; + GR_COORD x, y; + + if(delete) GrSetGCForeground(state->main_gc, BLACK); + else GrSetGCForeground(state->main_gc, WHITE); + + opp = (int)(sin(s->stars[star].angle) * s->stars[star].pos); + adj = (int)(cos(s->stars[star].angle) * s->stars[star].pos); + + x = (state->si.cols / 2) + adj; + y = (state->si.rows / 2) + opp; + + if((x < 0) || (y < 0) || (x >= state->si.cols) || (y >= state->si.rows)) + return 1; + + GrPoint(state->main_window, state->main_gc, x, y); + + return 0; +} + +void saver5_exposure(nstate *state) +{ + int i; + s5state *s = state->priv; + + GrClearWindow(state->main_window, 0); + + for(i = 0; i < SAVER5_NUMSTARS; i++) { + saver5_drawstar(state, s, i, 0); + } +} + +void saver5_animate(nstate *state) +{ + int i; + double position, scale, increment; + s5state *s = state->priv; + + if(s->numstars < SAVER5_NUMSTARS) { + s->numstars += SAVER5_STARS_INCREMENT; + if(s->numstars > SAVER5_NUMSTARS) + s->numstars = SAVER5_NUMSTARS; + } + + for(i = 0; i < s->numstars; i++) { + saver5_drawstar(state, s, i, 1); + position = (double)s->stars[i].pos / + (double)(state->si.cols / 2); + scale = sin((position * M_PI_2) + M_PI + M_PI_2) + 1.0; + increment = (scale * SAVER5_STARS_ACCEL_RATE) + 1; + s->stars[i].pos += (int) increment; + if(saver5_drawstar(state, s, i, 0)) { + s->stars[i].pos = 1; + s->stars[i].angle = RANDRANGE(0, (2 * M_PI)); + saver5_drawstar(state, s, i, 0); + } + } +} + +void saver6_init(nstate *state) +{ + int i, n; + + s6state *s = my_malloc(sizeof(s6state)); + state->priv = s; + + s->new_bolt_time = 0; + + for(i = 0; i < SAVER6_MAXBOLTS; i++) { + s->bolts[i].duration = 0; + for(n = 0; n < SAVER6_MAXFORKS; n++) { + s->bolts[i].forks[n].valid = 0; + } + } + + state->animate_interval = SAVER6_DELAY; +} + +void saver6_drawfork(nstate *state, s6state *s, int bolt, int fork, int delete) +{ + int i; + + if(delete) GrSetGCForeground(state->main_gc, BLACK); + for(i = 0; i < SAVER6_THICKNESS; i++) { + if(!delete) { + if((i < 2) || (i >= SAVER6_THICKNESS - 2)) + GrSetGCForeground(state->main_gc, LTBLUE); + else GrSetGCForeground(state->main_gc, WHITE); + } + GrPoly(state->main_window, state->main_gc, + s->bolts[bolt].forks[fork].valid, + s->bolts[bolt].forks[fork].vertices[i]); + } +} + +void saver6_drawbolt(nstate *state, s6state *s, int bolt, int delete) +{ + int n; + + for(n = 0; n < SAVER6_MAXFORKS; n++) + if(s->bolts[bolt].forks[n].valid) + saver6_drawfork(state, s, bolt, n, delete); +} + +void saver6_drawlightning(nstate *state, s6state *s, int delete) +{ + int i; + + for(i = 0; i < SAVER6_MAXBOLTS; i++) { + if(s->bolts[i].duration) { + if(delete) s->bolts[i].duration--; + saver6_drawbolt(state, s, i, delete); + } + } +} + +void saver6_exposure(nstate *state) +{ + s6state *s = state->priv; + + GrClearWindow(state->main_window, 0); + + saver6_drawlightning(state, s, 0); +} + +void saver6_setvertices(s6state *s, int bolt, int fork, int vert, GR_COORD x, + GR_COORD y) +{ + int i; + + for(i = 0; i < SAVER6_THICKNESS; i++) { + s->bolts[bolt].forks[fork].vertices[i][vert].x = x + i; + s->bolts[bolt].forks[fork].vertices[i][vert].y = y; + } +} + +void saver6_perturb(nstate *state, GR_COORD *x, GR_COORD *y, int maxperturb) +{ + *x += (int)RANDRANGE(0, (maxperturb - 1.0)) - + (double)(maxperturb / 2.0); + if(*x < 0) *x = 0; + if(*x > (state->si.cols - 1)) *x = state->si.cols - 1; + + *y += (int)RANDRANGE(0, (maxperturb - 1.0)) - + (double)(maxperturb / 2.0); + if(*y < 0) *y = 0; + if(*y > (state->si.cols - 1)) *y = state->si.cols - 1; +} + +void saver6_makefork(nstate *state, s6state *s, int bolt, int fork, GR_COORD x, + GR_COORD y) +{ + int i, vertices; + double length, incr, pos, angle, scale; + GR_COORD ex, ey, nx, ny, xlen, ylen; + + saver6_setvertices(s, bolt, fork, 0, x , y); + + scale = (double)(state->si.rows - y) / (double)state->si.rows; + + vertices = (int)(scale * RANDRANGE(SAVER6_MINFULLVERTICES, + SAVER6_MAXVERTICES)); + + if(vertices < SAVER6_MINVERTICES) vertices = SAVER6_MINVERTICES; + + s->bolts[bolt].forks[fork].valid = vertices; + + ey = state->si.rows - SAVER6_MAXEND_Y + + (int)RANDRANGE(0, SAVER6_MAXEND_Y - 1.0); + if((ey - y) <= 0) ey = SAVER6_MINDROP; + if(ey >= (state->si.rows - 1)) ey = state->si.rows - 1; + + if(!fork) { + ex = x + (int)RANDRANGE(0, ((state->si.cols - 1.0) / 2.0)); + } else { + ex = x + (int)(RANDRANGE(0, (ey - y)) / 2.0) - ((ey - y) / 2.0); + } + + if(ex >= state->si.cols) ex = state->si.cols - 1; + if(ex < 0) ex = 0; + + xlen = MAX(x, ex) - MIN(x, ex); + ylen = MAX(y, ey) - MIN(y, ey); + + length = sqrt(((double)(xlen * xlen) + (double)(ylen * ylen))); + incr = length / (vertices - 1); + angle = atan(((double)xlen / (double)ylen)); + + for(i = vertices - 1; i ; i--) { + pos = (incr * (i - 1)) + (RANDRANGE(0, SAVER6_MAXZIGZAG) - + ((double)SAVER6_MAXZIGZAG / 2.0)); + if(pos < 0) pos = 0; + if(pos > length) pos = length; + nx = x - (pos * sin(angle)); + ny = y + pos * cos(angle); + saver6_perturb(state, &nx, &ny, SAVER6_MAXZIGZAG); + saver6_setvertices(s, bolt, fork, i, nx , ny); + } +} + +int saver6_makeforks(nstate *state, s6state *s, int bolt, int fork, + int *vert, int *nextfork) +{ + int thisvert = 1, thisfork; + double prob; + + if(*vert == (s->bolts[bolt].forks[fork].valid - 1)) return 0; + if(*nextfork == SAVER6_MAXFORKS) return 0; + + prob = (double)SAVER6_FORK_PROBABILITY * ((double)*vert / + (double)s->bolts[bolt].forks[fork].valid) * + (1.0 / ((double)fork + 1.0)); + if(RANDRANGE(0, 1) < prob) { + thisfork = *nextfork; + saver6_makefork(state, s, bolt, thisfork, + s->bolts[bolt].forks[fork].vertices[0][*vert].x, + s->bolts[bolt].forks[fork].vertices[0][*vert].y); + *nextfork += 1; + while(saver6_makeforks(state, s, bolt, thisfork, &thisvert, + nextfork)); + } + + *vert += 1; + + return 1; +} + +void saver6_makebolt(nstate *state, s6state *s, int bolt) +{ + GR_COORD x; + int vert = 1, nextfork = 1, n; + + for(n = 0; n < SAVER6_MAXFORKS; n++) + s->bolts[bolt].forks[n].valid = 0; + + x = (int)RANDRANGE(0, (state->si.cols - 1.0)); + + saver6_makefork(state, s, bolt, 0, x, 0); + + while(saver6_makeforks(state, s, bolt, 0, &vert, &nextfork)); +} + +void saver6_newbolt(nstate *state, s6state *s) +{ + int i; + + for(i = 0; i < SAVER6_MAXBOLTS; i++) { + if(!s->bolts[i].duration) { + saver6_makebolt(state, s, i); + s->bolts[i].duration = RANDRANGE(SAVER6_MINDURATION, + SAVER6_MAXDURATION); + saver6_drawbolt(state, s, i, 0); + break; + } + } + + s->new_bolt_time = RANDRANGE(1, SAVER6_MAXNEWBOLTTIME); +} + +void saver6_perturb_bolt(nstate *state, s6state *s, int bolt, int fork) +{ + int m, o; + GR_COORD x, ox, y, oy; + + for(m = 1; m < s->bolts[bolt].forks[fork].valid; m++) { + ox = x = s->bolts[bolt].forks[fork].vertices[0][m].x; + oy = y = s->bolts[bolt].forks[fork].vertices[0][m].y; + saver6_perturb(state, &x, &y, SAVER6_MAXZIGZAG); + saver6_setvertices(s, bolt, fork, m, x, y); + for(o = fork + 1; o < SAVER6_MAXFORKS; o++) { + if((s->bolts[bolt].forks[o].vertices[0][0].x == ox) && + (s->bolts[bolt].forks[o].vertices[0][0].y + == oy)) { + saver6_setvertices(s, bolt, o, 0, x, y); + } + } + } +} + +void saver6_perturb_lightning(nstate *state, s6state *s) +{ + int i, n; + + for(i = 0; i < SAVER6_MAXBOLTS; i++) { + if(!s->bolts[i].duration) continue; + for(n = 0; n < SAVER6_MAXFORKS; n++) { + if(!s->bolts[i].forks[n].valid) continue; + saver6_perturb_bolt(state, s, i, n); + } + } +} + +void saver6_animate(nstate *state) +{ + s6state *s = state->priv; + + saver6_drawlightning(state, s, 1); + saver6_perturb_lightning(state, s); + saver6_drawlightning(state, s, 0); + + if(!s->new_bolt_time--) saver6_newbolt(state, s); +} + +/* The algorithm used in saver7 was adapted from "grav" by Greg Bowering */ + +void saver7_drawstar(nstate *state, s7state *s) +{ + GrSetGCForeground(state->main_gc, SAVER7_STARCOLOUR); + GrFillEllipse(state->main_window, state->main_gc, s->starx, s->stary, + SAVER7_STARRADIUS, SAVER7_STARRADIUS); +} + +void saver7_drawplanet(nstate *state, s7state *s, int planet, int erase) +{ + if(erase) GrSetGCForeground(state->main_gc, BLACK); + else GrSetGCForeground(state->main_gc, s->planets[planet].colour); + + if((s->planets[planet].ax < 0) || (s->planets[planet].ay < 0) || + (s->planets[planet].ax >= state->si.cols) || + (s->planets[planet].ay >= state->si.rows)) { + return; + } + + GrFillEllipse(state->main_window, state->main_gc, s->planets[planet].ax, + s->planets[planet].ay, + SAVER7_PLANETRADIUS, SAVER7_PLANETRADIUS); +} + +void saver7_calc_planet_position(nstate *state, s7state *s, int planet) +{ + if(s->planets[planet].r > -SAVER7_ALMOSTDIST) { + s->planets[planet].ax = (int)((double) state->si.cols * + (0.5 + (s->planets[planet].x / (s->planets[planet].r + + SAVER7_DIST)))); + s->planets[planet].ay = (int)((double) state->si.rows * + (0.5 + (s->planets[planet].y / (s->planets[planet].r + + SAVER7_DIST)))); + } else { + s->planets[planet].ax = -1; + s->planets[planet].ay = -1; + } +} + +void saver7_init(nstate *state) +{ + int i; + s7state *s = my_malloc(sizeof(s7state)); + state->priv = s; + + s->starx = state->si.cols / 2; + s->stary = state->si.rows / 2; + + for(i = 0; i < SAVER7_PLANETS; i++) { + s->planets[i].r = RANDRANGE(SAVER7_MIN_STARTDIM, + SAVER7_MAX_STARTDIM); + s->planets[i].x = RANDRANGE(SAVER7_MIN_STARTDIM, + SAVER7_MAX_STARTDIM); + s->planets[i].y = RANDRANGE(SAVER7_MIN_STARTDIM, + SAVER7_MAX_STARTDIM); + s->planets[i].rv = RANDRANGE(SAVER7_MIN_STARTVEL, + SAVER7_MAX_STARTVEL); + s->planets[i].xv = RANDRANGE(SAVER7_MIN_STARTVEL, + SAVER7_MAX_STARTVEL); + s->planets[i].yv = RANDRANGE(SAVER7_MIN_STARTVEL, + SAVER7_MAX_STARTVEL); + s->planets[i].colour = RANDRANGE(0, (state->si.ncolors - 1)); + saver7_calc_planet_position(state, s, i); + saver7_drawplanet(state, s, i, 0); + } + + saver7_drawstar(state, s); + + state->animate_interval = SAVER7_DELAY; +} + +void saver7_exposure(nstate *state) +{ + int i; + s7state *s = state->priv; + + GrClearWindow(state->main_window, 0); + + for(i = 0; i < SAVER7_PLANETS; i++) + saver7_drawplanet(state, s, i, 0); + + saver7_drawstar(state, s); +} + +void saver7_moveplanet(nstate *state, s7state *s, int planet) +{ + double dist; + double accel; + + dist = (s->planets[planet].x * s->planets[planet].x) + + (s->planets[planet].y * s->planets[planet].y) + + (s->planets[planet].r * s->planets[planet].r); + if(dist < SAVER7_COLLIDE) dist = SAVER7_COLLIDE; + dist = sqrt(dist); + dist = dist * dist * dist; + +#ifdef SAVER7_USE_DAMPING + accel = s->planets[planet].r * SAVER7_G / dist; + if(accel > SAVER7_MAX_ACCEL) accel = SAVER7_MAX_ACCEL; + else if(accel < -SAVER7_MAX_ACCEL) accel = -SAVER7_MAX_ACCEL; + s->planets[planet].rv = (s->planets[planet].rv + accel) * + SAVER7_DAMPING_FACTOR; + s->planets[planet].r += s->planets[planet].rv; + accel = s->planets[planet].x * SAVER7_G / dist; + if(accel > SAVER7_MAX_ACCEL) accel = SAVER7_MAX_ACCEL; + else if(accel < -SAVER7_MAX_ACCEL) accel = -SAVER7_MAX_ACCEL; + s->planets[planet].xv = (s->planets[planet].xv + accel) * + SAVER7_DAMPING_FACTOR; + s->planets[planet].x += s->planets[planet].xv; + accel = s->planets[planet].y * SAVER7_G / dist; + if(accel > SAVER7_MAX_ACCEL) accel = SAVER7_MAX_ACCEL; + else if(accel < -SAVER7_MAX_ACCEL) accel = -SAVER7_MAX_ACCEL; + s->planets[planet].yv = (s->planets[planet].yv + accel) * + SAVER7_DAMPING_FACTOR; + s->planets[planet].y += s->planets[planet].yv; +#else + accel = s->planets[planet].r * SAVER7_G / dist; + s->planets[planet].rv += accel; + s->planets[planet].r += s->planets[planet].rv; + accel = s->planets[planet].x * SAVER7_G / dist; + s->planets[planet].xv += accel; + s->planets[planet].x += s->planets[planet].xv; + accel = s->planets[planet].y * SAVER7_G / dist; + s->planets[planet].yv += accel; + s->planets[planet].y += s->planets[planet].yv; +#endif +} + +void saver7_animate(nstate *state) +{ + int i; + s7state *s = state->priv; + + for(i = 0; i < SAVER7_PLANETS; i++) { + saver7_moveplanet(state, s, i); + saver7_drawplanet(state, s, i, 1); + saver7_calc_planet_position(state, s, i); + saver7_drawplanet(state, s, i, 0); + } + saver7_drawstar(state, s); +} + +/* The algorithm used in saver8 is based on that found at: + http://www.go2net.com/internet/deep/1997/04/16/body.html */ + +void saver8_init(nstate *state) +{ + int red = 0, green = 0, blue = 0, step, i = 0; + + s8state *s = my_malloc(sizeof(s8state)); + state->priv = s; + + s->current_line = 0; + + step = 512 / SAVER8_NUMCOLOURS; + + for(green = 255; green > 0; green -= step, blue += step, i++) + s->colours[i] = GR_RGB(0, green, blue); + for(blue = 255; blue > 0; blue -= step, red += step, i++) + s->colours[i] = GR_RGB(red, 0, blue); + + state->animate_interval = SAVER8_DELAY; +} + +void saver8_drawpattern(nstate *state) +{ + int x, col, lines = SAVER8_LINES_PER_FRAME; + s8state *s = state->priv; + + if(!s->current_line) + s->factor = RANDRANGE(SAVER8_MINFACTOR, SAVER8_MAXFACTOR); + + while(s->current_line < state->si.rows) { + if(!--lines) return; + for(x = 0; x < state->si.cols; x++) { + col = ((((x * x) + (s->current_line * s->current_line)) + / s->factor) % SAVER8_NUMCOLOURS); + GrSetGCForeground(state->main_gc, s->colours[col]); + GrPoint(state->main_window, state->main_gc, x, + s->current_line); + } + s->current_line++; + } + s->current_line = 0; +} + +void saver8_exposure(nstate *state) +{ + s8state *s = state->priv; + + GrClearWindow(state->main_window, 0); + s->current_line = 0; + saver8_drawpattern(state); +} + +void saver8_animate(nstate *state) +{ + saver8_drawpattern(state); +} + +int init(nstate *state) +{ + GR_WM_PROPERTIES props; + GR_BITMAP cursor = 0; + + if(!GrOpen()) { + fprintf(stderr, "Couldn't connect to Nano-X server\n"); + return 3; + } + + GrGetScreenInfo(&state->si); + + state->main_window = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, + state->si.cols, state->si.rows, 0, BLACK, 0); + + GrSelectEvents(state->main_window, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_UP | + GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_MOUSE_MOTION | + GR_EVENT_MASK_KEY_UP | + GR_EVENT_MASK_KEY_DOWN | + GR_EVENT_MASK_FOCUS_OUT | + GR_EVENT_MASK_CLOSE_REQ); + + props.flags = GR_WM_FLAGS_PROPS; + props.props = GR_WM_PROPS_NOMOVE | GR_WM_PROPS_NODECORATE | + GR_WM_PROPS_NOAUTOMOVE | GR_WM_PROPS_NOAUTORESIZE; + GrSetWMProperties(state->main_window, &props); + + state->main_gc = GrNewGC(); + GrSetGCForeground(state->main_gc, WHITE); + GrSetGCBackground(state->main_gc, BLACK); + + state->animate_interval = 0; + + srand(time(0)); + + init_functions[state->saver](state); + + calculate_timeout(state); + + GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_SCREENSAVER); + + GrSetCursor(state->main_window, 1, 1, 1, 1, 0, 0, &cursor, &cursor); + + GrMapWindow(state->main_window); + + GrSetFocus(state->main_window); + + return 0; +} + +void calculate_timeout(nstate *state) +{ + struct timeval t; + long u; + + gettimeofday(&t, NULL); + u = t.tv_usec + (state->animate_interval * 1000); + state->timeout.tv_sec = t.tv_sec + (u / 1000000); + state->timeout.tv_usec = u % 1000000; +} + +unsigned long timeout_delay(nstate *state) +{ + struct timeval t; + signed long s, m, ret; + + gettimeofday(&t, NULL); + + if(!state->animate_interval) return 0; + + if((t.tv_sec > state->timeout.tv_sec) || + ((t.tv_sec == state->timeout.tv_sec) && + t.tv_usec >= state->timeout.tv_usec)) return 1; + + s = state->timeout.tv_sec - t.tv_sec; + m = ((state->timeout.tv_usec - t.tv_usec) / 1000); + ret = (unsigned long)((1000 * s) + m); + + if(ret <= 0) return 1; + else return ret; +} + +void do_animate(nstate *state) +{ + struct timeval t; + + if(!state->animate_interval) return; + + gettimeofday(&t, NULL); + + if((t.tv_sec > state->timeout.tv_sec) || + ((t.tv_sec == state->timeout.tv_sec) && + (t.tv_usec >= state->timeout.tv_usec))) { + animate_functions[state->saver](state); + calculate_timeout(state); + } +} + +int do_screensaver_event(nstate *state) +{ + GR_EVENT_SCREENSAVER *event = &state->event.screensaver; + + if(event->activate != GR_FALSE) { + fprintf(stderr, "Got a non-deactivate screensaver event\n"); + return 0; + } + + return 1; +} + +int handle_event(nstate *state) +{ + switch(state->event.type) { + case GR_EVENT_TYPE_EXPOSURE: + exposure_functions[state->saver](state); + case GR_EVENT_TYPE_TIMEOUT: + case GR_EVENT_TYPE_NONE: + break; + case GR_EVENT_TYPE_SCREENSAVER: + if(do_screensaver_event(state)) return 0; + break; + case GR_EVENT_TYPE_CLOSE_REQ: + case GR_EVENT_MASK_BUTTON_UP: + case GR_EVENT_MASK_BUTTON_DOWN: + case GR_EVENT_MASK_MOUSE_MOTION: + case GR_EVENT_MASK_KEY_UP: + case GR_EVENT_MASK_KEY_DOWN: + case GR_EVENT_MASK_FOCUS_OUT: + return 0; + default: + fprintf(stderr, "Got unknown event type %d\n", + state->event.type); + break; + } + do_animate(state); + return(1); +} + +int main(int argc, char *argv[]) +{ + int ret; + nstate *state = my_malloc(sizeof(nstate)); + + if(argc == 2) { + state->saver = atoi(argv[1]) - 1; + if((state->saver) < 0 || (state->saver >= NUM_SAVERS)) { + fprintf(stderr, "Invalid saver number \"%s\"\n", + argv[1]); + return 2; + } + } else state->saver = 0; + + if((ret = init(state))) return ret; + + do { + GrGetNextEventTimeout(&state->event, timeout_delay(state)); + } while(handle_event(state)); + + GrClose(); + + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/nsaver.h b/packages/services/gfx/mw/current/src/demos/nanox/nsaver.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/nsaver.h @@ -0,0 +1,273 @@ +#ifndef NSAVER_H +#define NSAVER_H +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is NanoScreenSaver. + * + * The Initial Developer of the Original Code is Alex Holden. + * Portions created by Alex Holden are Copyright (C) 2000 + * Alex Holden . All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public license (the "[GNU] License"), in which case the + * provisions of [GNU] License are applicable instead of those + * above. If you wish to allow use of your version of this file only + * under the terms of the [GNU] License and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the [GNU] License. If you do not delete + * the provisions above, a recipient may use your version of this file + * under either the MPL or the [GNU] License. + */ + +#define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) +#define MIN(X, Y) ((X) < (Y) ? (X) : (Y)) +#define RANDRANGE(LO, HI) ((LO) + ((double)((HI) - (LO)) * rand() \ + / (RAND_MAX + 1.0))) + +typedef struct { + GR_WINDOW_ID main_window; + GR_GC_ID main_gc; + GR_EVENT event; + long animate_interval; + struct timeval timeout; + int saver; + void *priv; + GR_SCREEN_INFO si; +} nstate; + +void *my_malloc(size_t size); +void get_random_point_on_screen(nstate *state, GR_COORD *x, GR_COORD *y, + GR_COLOR *c); +int init(nstate *state); +void calculate_timeout(nstate *state); +unsigned long timeout_delay(nstate *state); +unsigned long timeout_delay(nstate *state); +void do_animate(nstate *state); +int do_screensaver_event(nstate *state); +int handle_event(nstate *state); + +#define NUM_SAVERS 8 + +void saver1_init(nstate *state); +void saver1_exposure(nstate *state); +void saver1_animate(nstate *state); + +#define SAVER2_DELAY 1 +#define SAVER2_MAXPIXELS 65535 +#define SAVER2_PIXELS_PER_FRAME 16 + +void saver2_init(nstate *state); +void saver2_exposure(nstate *state); +void saver2_animate(nstate *state); + +#define SAVER3_DELAY 1 +#define SAVER3_MAXSEGMENTS 65535 +#define SAVER3_SEGMENTS_PER_FRAME 4 + +typedef struct { + int maxsegments; + GR_COORD lastx; + GR_COORD lasty; +} s3state; + +void saver3_init(nstate *state); +void saver3_exposure(nstate *state); +void saver3_animate(nstate *state); + +#define SAVER4_DELAY 4 +#define SAVER4_NUMWORMS 10 +#define SAVER4_WORMLENGTH 100 +#define SAVER4_COLLISION_RELUCTANCE 20 + +typedef struct { + GR_COLOR colour; + GR_POINT points[SAVER4_WORMLENGTH]; +} s4worm; + +typedef struct { + int length; + int tip; + s4worm worms[SAVER4_NUMWORMS]; +} s4state; + +void saver4_init(nstate *state); +void saver4_exposure(nstate *state); +void saver4_get_new_worm_position(nstate *state, s4state *s, int worm, + GR_COORD *newx, GR_COORD *newy); +int saver4_worm_collides(nstate *state, s4state *s, int x, int y, int thisworm, + int thispoint); +void saver4_animate(nstate *state); + +#define SAVER5_DELAY 1 +#define SAVER5_NUMSTARS 300 +#define SAVER5_STARS_INCREMENT 2 +#define SAVER5_STARS_ACCEL_RATE 30 + +typedef struct { + double angle; + int pos; +} s5star; + +typedef struct { + int numstars; + s5star stars[SAVER5_NUMSTARS]; +} s5state; + +void saver5_init(nstate *state); +int saver5_drawstar(nstate *state, s5state *s, int star, int delete); +void saver5_exposure(nstate *state); +void saver5_animate(nstate *state); + +#define SAVER6_DELAY 5 +#define SAVER6_MAXVERTICES 20 +#define SAVER6_MINFULLVERTICES 5 +#define SAVER6_MINVERTICES 3 +#define SAVER6_MINDROP 10 +#define SAVER6_MAXBOLTS 4 +#define SAVER6_MAXFORKS 20 +#define SAVER6_MAXEND_Y 50 +#define SAVER6_THICKNESS 6 +#define SAVER6_MINDURATION 10 +#define SAVER6_MAXDURATION 20 +#define SAVER6_MAXNEWBOLTTIME 300 +#define SAVER6_MAXZIGZAG 10 +#define SAVER6_MAXPERTURBATION 5 +#define SAVER6_FORK_PROBABILITY 0.5 + +typedef struct { + int valid; + GR_POINT vertices[SAVER6_THICKNESS][SAVER6_MAXVERTICES]; +} s6fork; + +typedef struct { + int duration; + s6fork forks[SAVER6_MAXFORKS]; +} s6bolt; + +typedef struct { + int new_bolt_time; + s6bolt bolts[SAVER6_MAXBOLTS]; +} s6state; + +void saver6_init(nstate *state); +void saver6_drawfork(nstate *state, s6state *s, int bolt, int fork, int delete); +void saver6_drawbolt(nstate *state, s6state *s, int bolt, int delete); +void saver6_drawlightning(nstate *state, s6state *s, int delete); +void saver6_exposure(nstate *state); +void saver6_setvertices(s6state *s, int bolt, int fork, int vert, GR_COORD x, + GR_COORD y); +void saver6_makefork(nstate *state, s6state *s, int bolt, int fork, GR_COORD x, + GR_COORD y); +void saver6_perturb(nstate *state, GR_COORD *x, GR_COORD *y, int maxperturb); +void saver6_makebolt(nstate *state, s6state *s, int bolt); +void saver6_newbolt(nstate *state, s6state *s); +void saver6_perturb_bolt(nstate *state, s6state *s, int bolt, int fork); +void saver6_perturb_lightning(nstate *state, s6state *s); +void saver6_animate(nstate *state); + +/* The algorithm used in saver7 was adapted from "grav" by Greg Bowering */ + +#define SAVER7_DELAY 2 +#define SAVER7_PLANETS 15 +#define SAVER7_PLANETS_USE_DAMPING +#define SAVER7_STARCOLOUR YELLOW +#define SAVER7_STARRADIUS 5 +#define SAVER7_PLANETRADIUS 3 +#define SAVER7_DIST 16.0 +#define SAVER7_ALMOSTDIST (SAVER7_DIST - 0.01) +#define SAVER7_MAX_STARTDIM (SAVER7_ALMOSTDIST / 2.0) +#define SAVER7_MIN_STARTDIM -SAVER7_MAX_STARTDIM +#define SAVER7_MAX_STARTVEL 0.04 +#define SAVER7_MIN_STARTVEL -SAVER7_MAX_STARTVEL +#define SAVER7_G -0.02 +#define SAVER7_COLLIDE 0.0001 +#define SAVER7_DAMPING_FACTOR 0.999999 +#define SAVER7_MAX_ACCEL 0.1 + +typedef struct { + double r; + double rv; + double x; + double xv; + double y; + double yv; + GR_COORD ax; + GR_COORD ay; + GR_COLOR colour; +} s7planet; + +typedef struct { + s7planet planets[SAVER7_PLANETS]; + GR_COORD starx; + GR_COORD stary; +} s7state; + +void saver7_init(nstate *state); +void saver7_exposure(nstate *state); +void saver7_animate(nstate *state); + +/* The algorithm used in saver8 is based on that found at: + http://www.go2net.com/internet/deep/1997/04/16/body.html */ + +#define SAVER8_DELAY 1 +#define SAVER8_NUMCOLOURS 64 /* Don't set this higher than 512! */ +#define SAVER8_MINFACTOR 1 +#define SAVER8_MAXFACTOR 20 +#define SAVER8_LINES_PER_FRAME 5 + +typedef struct { + GR_COLOR colours[SAVER8_NUMCOLOURS]; + int current_line; + int factor; +} s8state; + +void saver8_init(nstate *state); +void saver8_drawpattern(nstate *state); +void saver8_exposure(nstate *state); +void saver8_animate(nstate *state); + +typedef void(*saver_function)(nstate *); + +saver_function init_functions[NUM_SAVERS] = { + saver1_init, + saver2_init, + saver3_init, + saver4_init, + saver5_init, + saver6_init, + saver7_init, + saver8_init +}; +saver_function exposure_functions[NUM_SAVERS] = { + saver1_exposure, + saver2_exposure, + saver3_exposure, + saver4_exposure, + saver5_exposure, + saver6_exposure, + saver7_exposure, + saver8_exposure +}; +saver_function animate_functions[NUM_SAVERS] = { + saver1_animate, + saver2_animate, + saver3_animate, + saver4_animate, + saver5_animate, + saver6_animate, + saver7_animate, + saver8_animate +}; +#endif diff --git a/packages/services/gfx/mw/current/src/demos/nanox/nterm.c b/packages/services/gfx/mw/current/src/demos/nanox/nterm.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/nterm.c @@ -0,0 +1,328 @@ +/* + * Nano-X terminal emulator + * + * Al Riddoch + * Greg Haerr + */ + +#include +#include +#include +#include +#include +#include + +#define MWINCLUDECOLORS +#include "nano-X.h" + +#define HAVEBLIT 0 /* set if have bitblit (experimental)*/ + +#define _ ((unsigned) 0) /* off bits */ +#define X ((unsigned) 1) /* on bits */ +#define MASK(a,b,c,d,e,f,g) \ + (((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \ + + e) * 2) + f) * 2) + g) << 9) + +#if DOS_DJGPP +#define SIGCHLD 17 /* from Linux */ +#endif + +static GR_WINDOW_ID w1; /* id for window */ +static GR_GC_ID gc1; /* graphics context */ +static GR_GC_ID gc3; /* graphics context */ +static GR_COORD xpos; /* x coord for text */ +static GR_COORD ypos; /* y coord for text */ +static GR_SCREEN_INFO si; /* screen info */ +static int tfd; + +void do_buttondown(); +void do_buttonup(); +void do_motion(); +void text_init(); +int term_init(); +void do_keystroke(); +void do_focusin(); +void do_focusout(); +void do_enter(); +void do_exit(); +void do_fdinput(); +void printg(); +void HandleEvent(GR_EVENT *ep); + +int main(int argc, char ** argv) +{ + GR_BITMAP bitmap1fg[7]; /* mouse cursor */ + GR_BITMAP bitmap1bg[7]; + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + GrGetScreenInfo(&si); + + w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 50, 30, si.cols - 120, + si.rows - 60, 1, WHITE, LTBLUE); + + GrSelectEvents(w1, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT | + GR_EVENT_MASK_CLOSE_REQ); + + GrMapWindow(w1); + + gc1 = GrNewGC(); + gc3 = GrNewGC(); + + GrSetGCForeground(gc1, GRAY); + GrSetGCBackground(gc1, LTBLUE); + GrSetGCFont(gc1, GrCreateFont(GR_FONT_SYSTEM_FIXED, 0, NULL)); + /*GrSetGCFont(gc1, GrCreateFont(GR_FONT_OEM_FIXED, 0, NULL));*/ + GrSetGCForeground(gc3, WHITE); + GrSetGCBackground(gc3, BLACK); + + bitmap1fg[0] = MASK(_,_,X,_,X,_,_); + bitmap1fg[1] = MASK(_,_,_,X,_,_,_); + bitmap1fg[2] = MASK(_,_,_,X,_,_,_); + bitmap1fg[3] = MASK(_,_,_,X,_,_,_); + bitmap1fg[4] = MASK(_,_,_,X,_,_,_); + bitmap1fg[5] = MASK(_,_,_,X,_,_,_); + bitmap1fg[6] = MASK(_,_,X,_,X,_,_); + + bitmap1bg[0] = MASK(_,X,X,X,X,X,_); + bitmap1bg[1] = MASK(_,_,X,X,X,_,_); + bitmap1bg[2] = MASK(_,_,X,X,X,_,_); + bitmap1bg[3] = MASK(_,_,X,X,X,_,_); + bitmap1bg[4] = MASK(_,_,X,X,X,_,_); + bitmap1bg[5] = MASK(_,_,X,X,X,_,_); + bitmap1bg[6] = MASK(_,X,X,X,X,X,_); + + GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg); + + /*GrFillRect(GR_ROOT_WINDOW_ID, gc1, 0, 0, si.cols, si.rows);*/ + + GrSetGCForeground(gc1, BLACK); + GrSetGCBackground(gc1, WHITE); + text_init(); + if (term_init() < 0) { + GrClose(); + exit(1); + } + + /* we want tfd events also*/ + GrRegisterInput(tfd); + +#if 1 + GrMainLoop(HandleEvent); +#else + while(1) { + GR_EVENT ev; + + GrGetNextEvent(&ev); + HandleEvent(&ev); + } +#endif + /* notreached*/ + return 0; +} + +void +HandleEvent(GR_EVENT *ep) +{ + switch (ep->type) { + case GR_EVENT_TYPE_KEY_DOWN: + do_keystroke(&ep->keystroke); + break; + + case GR_EVENT_TYPE_FOCUS_IN: + do_focusin(&ep->general); + break; + + case GR_EVENT_TYPE_FOCUS_OUT: + do_focusout(&ep->general); + break; + + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + + case GR_EVENT_TYPE_FDINPUT: + do_fdinput(); + break; + } +} + +#if ELKS +char * nargv[2] = {"/bin/sash", NULL}; +#else +#if DOS_DJGPP +char * nargv[2] = {"bash", NULL}; +#else +char * nargv[2] = {"/bin/sh", NULL}; +#endif +#endif + +void sigchild(int signo) +{ + printg("We have a signal right now!\n"); + GrClose(); + exit(0); +} + +int term_init() +{ + char pty_name[12]; + int n = 0; + pid_t pid; + +again: + sprintf(pty_name, "/dev/ptyp%d", n); + if ((tfd = open(pty_name, O_RDWR | O_NONBLOCK)) < 0) { + if ((errno == EBUSY || errno == EIO) && n < 10) { + n++; + goto again; + } + fprintf(stderr, "Can't create pty %s\n", pty_name); + return -1; + } + signal(SIGCHLD, sigchild); + signal(SIGINT, sigchild); + if ((pid = fork()) == -1) { + fprintf(stderr, "No processes\n"); + return -1; + } + if (!pid) { + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); + close(tfd); + + setsid(); + pty_name[5] = 't'; + if ((tfd = open(pty_name, O_RDWR)) < 0) { + fprintf(stderr, "Child: Can't open pty %s\n", pty_name); + exit(1); + } + dup2(tfd, STDIN_FILENO); + dup2(tfd, STDOUT_FILENO); + dup2(tfd, STDERR_FILENO); + execv(nargv[0], nargv); + exit(1); + } + return 0; +} + + +GR_SIZE width; /* width of character */ +GR_SIZE height; /* height of character */ +GR_SIZE base; /* height of baseline */ + +void text_init() +{ + GrGetGCTextSize(gc1, "A", 1, GR_TFASCII, &width, &height, &base); +} + +void char_del(GR_COORD x, GR_COORD y) +{ + xpos -= width; + GrFillRect(w1, gc3, x, y /*- height*/ /*+ base*/ + 1, width, height); +} + +void char_out(GR_CHAR ch) +{ + switch(ch) { + case '\r': + xpos = 0; + return; + case '\n': + ypos += height; + if(ypos > si.rows - 60 - height) { + ypos -= height; +#if HAVEBLIT + bogl_cfb8_blit(50, 30, si.cols-120, + si.rows-60-height, 50, 30+height); + GrFillRect(w1, gc3, 50, ypos, si.cols-120, height); +#else + /* FIXME: changing FALSE to TRUE crashes nano-X*/ + /* clear screen, no scroll*/ + ypos = 0; + GrClearWindow(w1, GR_FALSE); +#endif + } + return; + case '\007': /* bel*/ + return; + case '\t': + xpos += width; + while((xpos/width) & 7) + char_out(' '); + return; + case '\b': /* assumes fixed width font!!*/ + if (xpos <= 0) + return; + char_del(xpos, ypos); + return; + } + GrText(w1, gc1, xpos+1, ypos, &ch, 1, GR_TFTOP); + xpos += width; +} + +void printg(char * text) +{ + int i; + + for(i = 0; i < strlen(text); i++) { + char_out(text[i]); + } +} + + +/* + * Here when a keyboard press occurs. + */ +void +do_keystroke(kp) + GR_EVENT_KEYSTROKE *kp; +{ + char foo; + + foo = kp->ch; + write(tfd, &foo, 1); +} + + +/* + * Here when a focus in event occurs. + */ +void +do_focusin(gp) + GR_EVENT_GENERAL *gp; +{ + if (gp->wid != w1) + return; + GrSetBorderColor(w1, LTBLUE); +} + +/* + * Here when a focus out event occurs. + */ +void +do_focusout(gp) + GR_EVENT_GENERAL *gp; +{ + if (gp->wid != w1) + return; + GrSetBorderColor(w1, GRAY); +} + +/* + * Here to read the shell input file descriptor. + */ +void +do_fdinput() +{ + char c; + + if (read(tfd, &c, 1) == 1) + char_out(c); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/ntetris.c b/packages/services/gfx/mw/current/src/demos/nanox/ntetris.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/ntetris.c @@ -0,0 +1,981 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is NanoTetris. + * + * The Initial Developer of the Original Code is Alex Holden. + * Portions created by Alex Holden are Copyright (C) 2000 + * Alex Holden . All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public license (the "[GNU] License"), in which case the + * provisions of [GNU] License are applicable instead of those + * above. If you wish to allow use of your version of this file only + * under the terms of the [GNU] License and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the [GNU] License. If you do not delete + * the provisions above, a recipient may use your version of this file + * under either the MPL or the [GNU] License. + */ + +/* + * A Nano-X Tetris clone by Alex Holden. + * + * The objective is to keep placing new pieces for as long as possible. When a + * horizontal line is filled with blocks, it will vanish, and everything above + * it will drop down a line. It quickly gets difficult because the speed + * increases with the score. Unlike with some Tetris clones, no bonus points + * are awarded for matching colours, completing more than one line at a time, + * or for using the "drop shape to bottom" function. + * + * The box in the top left of the game window is the score box. The top score + * is the highest score you have achieved since last resetting the high score + * counter. The counter is stored when the game exits in the file specified by + * the HISCORE_FILE parameter ("/usr/games/nanotetris.hiscore" by default). + * Note that no attempt is made to encrypt the file, so anybody with write + * access to the file can alter the contents of it using a text editor. + * + * The box below the score box is the next shape box. This contains a "preview" + * of the next shape to appear, so that you can plan ahead as you are building + * up the blocks. + * + * The game functions can be controlled using either the mouse (or a touch pad, + * touch screen, trackball, etc.) and the buttons below the next shape box, or + * with the following keyboard keys: + * + * Q = quit game + * N = new game + * P = pause game + * C = continue game + * D = rotate shape anticlockwise + * F = rotate shape clockwise + * J = move shape left + * K = move shape right + * Space Bar = drop shape to bottom. + * + * The reason for the unconventional use of D, F, J, and K keys is that they + * are all in the "home" position of a QWERTY keyboard, which makes them very + * easy to press if you are used to touch typing. + * + * I'll leave it to you to figure out which mouse operated movement button does + * what (it's pretty obvious). + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __ECOS +#define random rand +#define srandom srand +#endif + +#define MWINCLUDECOLORS +#include + +#include "ntetris.h" + +void *my_malloc(size_t size) +{ + void *ret; + + if(!(ret = malloc(size))) { + fprintf(stderr, "Out of memory\n"); + exit(1); + } + + return ret; +} + +#ifdef HAVE_USLEEP +void msleep(long ms) +{ + usleep(ms * 1000); +} +#else +void msleep(long ms) +{ + struct timespec req, rem; + + req.tv_sec = ms / 1000000; + req.tv_nsec = (ms % 1000000) * 1000000; + + while(nanosleep(&req, &rem) == -1) { + if(errno == EINTR) { + req.tv_sec = rem.tv_sec; + req.tv_nsec = rem.tv_nsec; + continue; + } else { + perror("nanosleep() failed"); + return; + } + } +} +#endif + +#ifdef USE_HISCORE_FILE +void read_hiscore(nstate *state) +{ + FILE *f; + int i, n; + + if(!(f = fopen(HISCORE_FILE, "r"))) { + if(errno != ENOENT) + perror("Couldn't open high score file for reading"); + state->hiscore = state->fhiscore = 0; + return; + } + + i = fscanf(f, "%d", &n); + fclose(f); + + if(i != 1) { + fprintf(stderr, "Couldn't read high score file\n"); + n = 0; + } + + state->hiscore = state->fhiscore = n; +} + +void write_hiscore(nstate *state) +{ + FILE *f; + + if(state->score > state->hiscore) state->hiscore = state->score; + if(state->hiscore <= state->fhiscore) return; + + if(!(f = fopen(HISCORE_FILE, "w"))) { + perror("Couldn't open high score file for writing"); + return; + } + + if((fprintf(f, "%d", state->hiscore)) == -1) { + perror("Couldn't write to high score file"); + } + + fclose(f); +} +#else +void read_hiscore(nstate *state) +{ + state->hiscore = 0; +} + +void write_hiscore(nstate *state) {} +#endif + +int will_collide(nstate *state, int x, int y, int orientation) +{ + int r, c, xx, yy; + char ch = 0; + + draw_shape(state, state->current_shape.x, state->current_shape.y, 1); + for(r = 0; ch < 3; r++) { + ch = 0; + for(c = 0; ch < 2; c++) { + ch = shapes[state->current_shape.type] + [orientation][r][c]; + if(ch == 1) { + yy = y + r; + xx = x + c; + if((yy == WELL_HEIGHT) || (xx == WELL_WIDTH) || + (state->blocks[0][yy][xx])) { + draw_shape(state, + state->current_shape.x, + state->current_shape.y, 0); + return 1; + } + } + } + } + draw_shape(state, state->current_shape.x, state->current_shape.y, 0); + + return 0; +} + +void draw_shape(nstate *state, GR_COORD x, GR_COORD y, int erase) +{ + int r, c, yy, xx; + GR_COLOR col; + char ch = 0; + + if(erase) col = 0; + else col = state->current_shape.colour; + + for(r = 0; ch < 3; r++) { + ch = 0; + for(c = 0; ch < 2; c++) { + ch = shapes[state->current_shape.type] + [state->current_shape.orientation][r][c]; + if(ch == 1) { + yy = y + r; + xx = x + c; + state->blocks[0][yy][xx] = col; + } + } + } +} + +void draw_well(nstate *state, int forcedraw) +{ + int x, y; + + for(y = WELL_NOTVISIBLE; y < WELL_HEIGHT; y++) { + for(x = 0; x < WELL_WIDTH; x++) { + if(forcedraw || (state->blocks[0][y][x] != + state->blocks[1][y][x])) { + state->blocks[1][y][x] = state->blocks[0][y][x]; + GrSetGCForeground(state->wellgc, + state->blocks[0][y][x]); + GrFillRect(state->well_window, state->wellgc, + (BLOCK_SIZE * x), + (BLOCK_SIZE * (y - WELL_NOTVISIBLE)), + BLOCK_SIZE, BLOCK_SIZE); + } + } + } + + GrFlush(); +} + +void draw_score(nstate *state) +{ + char buf[32]; + + GrFillRect(state->score_window, state->scoregcb, 0, 0, + SCORE_WINDOW_WIDTH, SCORE_WINDOW_HEIGHT); + + sprintf(buf, "%d", state->score); + GrText(state->score_window, state->scoregcf, TEXT_X_POSITION, + TEXT2_Y_POSITION, buf, strlen(buf), 0); + sprintf(buf, "%d", state->hiscore); + GrText(state->score_window, state->scoregcf, TEXT_X_POSITION, + TEXT_Y_POSITION, buf, strlen(buf), 0); +} + +void draw_next_shape(nstate *state) +{ + int r, c, startx, starty, x, y; + char ch = 0; + + GrFillRect(state->next_shape_window, state->nextshapegcb, 0, 0, + NEXT_SHAPE_WINDOW_WIDTH, NEXT_SHAPE_WINDOW_HEIGHT); + + GrSetGCForeground(state->nextshapegcf, state->next_shape.colour); + + startx = (BLOCK_SIZE * ((NEXT_SHAPE_WINDOW_SIZE / 2) - + (shape_sizes[state->next_shape.type] + [state->next_shape.orientation][0] / 2))); + starty = (BLOCK_SIZE * ((NEXT_SHAPE_WINDOW_SIZE / 2) - + (shape_sizes[state->next_shape.type] + [state->next_shape.orientation][1] / 2))); + + for(r = 0; ch < 3; r++) { + ch = 0; + for(c = 0; ch < 2; c++) { + ch = shapes[state->next_shape.type] + [state->next_shape.orientation][r][c]; + if(ch == 1) { + x = startx + (c * BLOCK_SIZE); + y = starty + (r * BLOCK_SIZE); + GrFillRect(state->next_shape_window, + state->nextshapegcf, x, y, + BLOCK_SIZE, BLOCK_SIZE); + } + } + } +} + +void draw_new_game_button(nstate *state) +{ + GrFillRect(state->new_game_button, state->buttongcb, 0, 0, + NEW_GAME_BUTTON_WIDTH, NEW_GAME_BUTTON_HEIGHT); + GrText(state->new_game_button, state->buttongcf, TEXT_X_POSITION, + TEXT_Y_POSITION, "New Game", 8, 0); +} + +void draw_anticlockwise_button(nstate *state) +{ + if(!state->running_buttons_mapped) return; + GrFillRect(state->anticlockwise_button, state->buttongcb, 0, 0, + ANTICLOCKWISE_BUTTON_WIDTH, ANTICLOCKWISE_BUTTON_HEIGHT); + GrText(state->anticlockwise_button, state->buttongcf, TEXT_X_POSITION, + TEXT_Y_POSITION, " /", 4, 0); +} + +void draw_clockwise_button(nstate *state) +{ + if(!state->running_buttons_mapped) return; + GrFillRect(state->clockwise_button, state->buttongcb, 0, 0, + CLOCKWISE_BUTTON_WIDTH, CLOCKWISE_BUTTON_HEIGHT); + GrText(state->clockwise_button, state->buttongcf, TEXT_X_POSITION, + TEXT_Y_POSITION, " \\", 4, 0); +} + +void draw_left_button(nstate *state) +{ + if(!state->running_buttons_mapped) return; + GrFillRect(state->left_button, state->buttongcb, 0, 0, + LEFT_BUTTON_WIDTH, LEFT_BUTTON_HEIGHT); + GrText(state->left_button, state->buttongcf, TEXT_X_POSITION, + TEXT_Y_POSITION, " <", 3, 0); +} + +void draw_right_button(nstate *state) +{ + if(!state->running_buttons_mapped) return; + GrFillRect(state->right_button, state->buttongcb, 0, 0, + RIGHT_BUTTON_WIDTH, RIGHT_BUTTON_HEIGHT); + GrText(state->right_button, state->buttongcf, TEXT_X_POSITION, + TEXT_Y_POSITION, " >", 4, 0); +} + +void draw_drop_button(nstate *state) +{ + if(!state->running_buttons_mapped) return; + GrFillRect(state->drop_button, state->buttongcb, 0, 0, + DROP_BUTTON_WIDTH, DROP_BUTTON_HEIGHT); + GrText(state->drop_button, state->buttongcf, TEXT_X_POSITION, + TEXT_Y_POSITION, " Drop", 8, 0); +} + +void draw_pause_continue_button(nstate *state) +{ + if((state->running_buttons_mapped) && (state->state == STATE_STOPPED)) { + GrUnmapWindow(state->pause_continue_button); + GrUnmapWindow(state->anticlockwise_button); + GrUnmapWindow(state->clockwise_button); + GrUnmapWindow(state->left_button); + GrUnmapWindow(state->right_button); + GrUnmapWindow(state->drop_button); + state->running_buttons_mapped = 0; + return; + } + if((!state->running_buttons_mapped) && (state->state == STATE_RUNNING)){ + GrMapWindow(state->pause_continue_button); + GrMapWindow(state->anticlockwise_button); + GrMapWindow(state->clockwise_button); + GrMapWindow(state->left_button); + GrMapWindow(state->right_button); + GrMapWindow(state->drop_button); + state->running_buttons_mapped = 1; + return; + } + if(!state->running_buttons_mapped) return; + GrFillRect(state->pause_continue_button, state->buttongcb, 0, 0, + PAUSE_CONTINUE_BUTTON_WIDTH, PAUSE_CONTINUE_BUTTON_HEIGHT); + if(state->state == STATE_PAUSED) { + GrText(state->pause_continue_button, state->buttongcf, + TEXT_X_POSITION, TEXT_Y_POSITION, " Continue", 9, 0); + } else { + GrText(state->pause_continue_button, state->buttongcf, + TEXT_X_POSITION, TEXT_Y_POSITION, " Pause", 8, 0); + } +} + +int block_is_all_in_well(nstate *state) +{ + if(state->current_shape.y >= WELL_NOTVISIBLE) + return 1; + + return 0; +} + +void delete_line(nstate *state, int line) +{ + int x, y; + + if(line < WELL_NOTVISIBLE) return; + + for(y = line - 1; y; y--) + for(x = WELL_WIDTH; x; x--) + state->blocks[0][y + 1][x] = state->blocks[0][y][x]; + + draw_well(state, 0); +} + +void block_reached_bottom(nstate *state) +{ + int x, y; + + if(!block_is_all_in_well(state)) { + state->state = STATE_STOPPED; + return; + } + + for(y = WELL_HEIGHT - 1; y; y--) { + for(x = 0; x < WELL_WIDTH; x++) + if(!state->blocks[0][y][x]) goto nr; + msleep(DELETE_LINE_DELAY); + delete_line(state, y); + state->score += SCORE_INCREMENT; + if((LEVELS > (state->level + 1)) && (((state->level + 1) * + LEVEL_DIVISOR) <= state->score)) + state->level++; + draw_score(state); + y++; + nr: + } + + choose_new_shape(state); + draw_next_shape(state); +} + +void move_block(nstate *state, int direction) +{ + if(direction == 0) { + if(!state->current_shape.x) return; + else { + if(!will_collide(state, (state->current_shape.x - 1), + state->current_shape.y, + state->current_shape.orientation)) { + draw_shape(state, state->current_shape.x, + state->current_shape.y, 1); + state->current_shape.x--; + draw_shape(state, state->current_shape.x, + state->current_shape.y, 0); + draw_well(state, 0); + } + } + } else { + if(!will_collide(state, (state->current_shape.x + 1), + state->current_shape.y, + state->current_shape.orientation)) { + draw_shape(state, state->current_shape.x, + state->current_shape.y, 1); + state->current_shape.x++; + draw_shape(state, state->current_shape.x, + state->current_shape.y, 0); + draw_well(state, 0); + } + } +} + +void rotate_block(nstate *state, int direction) +{ + int neworientation = 0; + + if(direction == 0) { + if(!state->current_shape.orientation) + neworientation = MAXORIENTATIONS - 1; + else neworientation = state->current_shape.orientation - 1; + } else { + neworientation = state->current_shape.orientation + 1; + if(neworientation == MAXORIENTATIONS) neworientation = 0; + } + + if(!will_collide(state, state->current_shape.x, state->current_shape.y, + neworientation)) { + draw_shape(state, state->current_shape.x, + state->current_shape.y, 1); + state->current_shape.orientation = neworientation; + draw_shape(state, state->current_shape.x, + state->current_shape.y, 0); + draw_well(state, 0); + } +} + +int drop_block_1(nstate *state) +{ + if(will_collide(state, state->current_shape.x, + (state->current_shape.y + 1), + state->current_shape.orientation)) { + block_reached_bottom(state); + return 1; + } + + draw_shape(state, state->current_shape.x, state->current_shape.y, 1); + state->current_shape.y++; + draw_shape(state, state->current_shape.x, state->current_shape.y, 0); + + draw_well(state, 0); + + return 0; +} + +void drop_block(nstate *state) +{ + while(!drop_block_1(state)) msleep(DROP_BLOCK_DELAY); +} + +void handle_exposure_event(nstate *state) +{ + GR_EVENT_EXPOSURE *event = &state->event.exposure; + + if(event->wid == state->score_window) { + draw_score(state); + return; + } + if(event->wid == state->next_shape_window) { + draw_next_shape(state); + return; + } + if(event->wid == state->new_game_button) { + draw_new_game_button(state); + return; + } + if(event->wid == state->pause_continue_button) { + draw_pause_continue_button(state); + return; + } + if(event->wid == state->anticlockwise_button) { + draw_anticlockwise_button(state); + return; + } + if(event->wid == state->clockwise_button) { + draw_clockwise_button(state); + return; + } + if(event->wid == state->left_button) { + draw_left_button(state); + return; + } + if(event->wid == state->right_button) { + draw_right_button(state); + return; + } + if(event->wid == state->drop_button) { + draw_drop_button(state); + return; + } + if(event->wid == state->well_window) { + draw_well(state, 1); + return; + } +} + +void handle_mouse_event(nstate *state) +{ + GR_EVENT_MOUSE *event = &state->event.mouse; + + if(event->wid == state->new_game_button) { + state->state = STATE_NEWGAME; + return; + } + if(event->wid == state->pause_continue_button) { + if(state->state == STATE_PAUSED) state->state = STATE_RUNNING; + else state->state = STATE_PAUSED; + return; + } + if(event->wid == state->anticlockwise_button) { + if(state->state == STATE_PAUSED) state->state = STATE_RUNNING; + rotate_block(state, 0); + return; + } + if(event->wid == state->clockwise_button) { + if(state->state == STATE_PAUSED) state->state = STATE_RUNNING; + rotate_block(state, 1); + return; + } + if(event->wid == state->left_button) { + if(state->state == STATE_PAUSED) state->state = STATE_RUNNING; + move_block(state, 0); + return; + } + if(event->wid == state->right_button) { + if(state->state == STATE_PAUSED) state->state = STATE_RUNNING; + move_block(state, 1); + return; + } + if(event->wid == state->drop_button) { + if(state->state == STATE_PAUSED) state->state = STATE_RUNNING; + drop_block(state); + return; + } +} + +void handle_keyboard_event(nstate *state) +{ + GR_EVENT_KEYSTROKE *event = &state->event.keystroke; + + switch(event->ch) { + case 'q': + case 'Q': + case MWKEY_CANCEL: + state->state = STATE_EXIT; + return; + case 'n': + case 'N': + case MWKEY_APP1: + state->state = STATE_NEWGAME; + return; + } + + if(state->state == STATE_STOPPED) return; + + state->state = STATE_RUNNING; + + switch(event->ch) { + case 'p': + case 'P': + state->state = STATE_PAUSED; + break; + case 'j': + case 'J': + case MWKEY_LEFT: + move_block(state, 0); + break; + case 'k': + case 'K': + case MWKEY_RIGHT: + move_block(state, 1); + break; + case 'd': + case 'D': + case MWKEY_UP: + rotate_block(state, 0); + break; + case 'f': + case 'F': + case MWKEY_DOWN: + rotate_block(state, 1); + break; + case ' ': + case MWKEY_MENU: + drop_block(state); + break; + } +} + +void handle_event(nstate *state) +{ + switch(state->event.type) { + case GR_EVENT_TYPE_EXPOSURE: + handle_exposure_event(state); + break; + case GR_EVENT_TYPE_BUTTON_DOWN: + handle_mouse_event(state); + break; + case GR_EVENT_TYPE_KEY_DOWN: + handle_keyboard_event(state); + break; + case GR_EVENT_TYPE_CLOSE_REQ: + state->state = STATE_EXIT; + break; + case GR_EVENT_TYPE_TIMEOUT: + break; + default: + fprintf(stderr, "Unhandled event type %d\n", + state->event.type); + break; + } +} + +void clear_well(nstate *state) +{ + int x, y; + + for(y = 0; y < WELL_HEIGHT; y++) + for(x = 0; x < WELL_WIDTH; x++) { + state->blocks[0][y][x] = 0; + state->blocks[1][y][x] = 0; + } +} + +/* Dirty hack alert- this is to avoid using any floating point math */ +int random8(int limit) +{ + int ret; + + do { ret = random() & 7; } while(ret > limit); + + return ret; +} + +void choose_new_shape(nstate *state) +{ + state->current_shape.type = state->next_shape.type; + state->current_shape.orientation = state->next_shape.orientation; + state->current_shape.colour = state->next_shape.colour; + state->current_shape.x = (WELL_WIDTH / 2) - 2; + state->current_shape.y = WELL_NOTVISIBLE - + shape_sizes[state->next_shape.type] + [state->next_shape.orientation][1] - 1; + state->next_shape.type = random8(MAXSHAPES - 1); + state->next_shape.orientation = random8(MAXORIENTATIONS - 1); + state->next_shape.colour = block_colours[random8(MAX_BLOCK_COLOUR)]; +} + +void new_game(nstate *state) +{ + clear_well(state); + if(state->score > state->hiscore) state->hiscore = state->score; + state->score = 0; + state->level = 0; + draw_score(state); + choose_new_shape(state); + draw_next_shape(state); + draw_well(state, 1); + if(state->state == STATE_NEWGAME) state->state = STATE_RUNNING; +} + +void init_game(nstate *state) +{ + GR_WM_PROPERTIES props; + + if(GrOpen() < 0) { + fprintf(stderr, "Couldn't connect to Nano-X server\n"); + exit(1); + } + + state->main_window = GrNewWindow(GR_ROOT_WINDOW_ID, + MAIN_WINDOW_X_POSITION, + MAIN_WINDOW_Y_POSITION, + MAIN_WINDOW_WIDTH, + MAIN_WINDOW_HEIGHT, 0, + MAIN_WINDOW_BACKGROUND_COLOUR, 0); + /* set title */ + props.flags = GR_WM_FLAGS_TITLE | GR_WM_FLAGS_PROPS; + props.props = GR_WM_PROPS_BORDER | GR_WM_PROPS_CAPTION; + props.title = "Nano-Tetris"; + GrSetWMProperties(state->main_window, &props); + GrSelectEvents(state->main_window, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_CLOSE_REQ | + GR_EVENT_MASK_KEY_DOWN | + GR_EVENT_MASK_TIMEOUT); + + state->score_window = GrNewWindow(state->main_window, + SCORE_WINDOW_X_POSITION, + SCORE_WINDOW_Y_POSITION, + SCORE_WINDOW_WIDTH, + SCORE_WINDOW_HEIGHT, 0, + SCORE_WINDOW_BACKGROUND_COLOUR, 0); + GrSelectEvents(state->score_window, GR_EVENT_MASK_EXPOSURE); + GrMapWindow(state->score_window); + state->scoregcf = GrNewGC(); + GrSetGCForeground(state->scoregcf, SCORE_WINDOW_FOREGROUND_COLOUR); + GrSetGCBackground(state->scoregcf, SCORE_WINDOW_BACKGROUND_COLOUR); + state->scoregcb = GrNewGC(); + GrSetGCForeground(state->scoregcb, SCORE_WINDOW_BACKGROUND_COLOUR); + + state->next_shape_window = GrNewWindow(state->main_window, + NEXT_SHAPE_WINDOW_X_POSITION, + NEXT_SHAPE_WINDOW_Y_POSITION, + NEXT_SHAPE_WINDOW_WIDTH, + NEXT_SHAPE_WINDOW_HEIGHT, 0, + NEXT_SHAPE_WINDOW_BACKGROUND_COLOUR, 0); + GrSelectEvents(state->next_shape_window, GR_EVENT_MASK_EXPOSURE); + GrMapWindow(state->next_shape_window); + state->nextshapegcf = GrNewGC(); + state->nextshapegcb = GrNewGC(); + GrSetGCForeground(state->nextshapegcb, + NEXT_SHAPE_WINDOW_BACKGROUND_COLOUR); + + state->new_game_button = GrNewWindow(state->main_window, + NEW_GAME_BUTTON_X_POSITION, + NEW_GAME_BUTTON_Y_POSITION, + NEW_GAME_BUTTON_WIDTH, + NEW_GAME_BUTTON_HEIGHT, 0, + BUTTON_BACKGROUND_COLOUR, 0); + GrSelectEvents(state->new_game_button, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + GrMapWindow(state->new_game_button); + state->buttongcf = GrNewGC(); + GrSetGCForeground(state->buttongcf, BUTTON_FOREGROUND_COLOUR); + GrSetGCBackground(state->buttongcf, BUTTON_BACKGROUND_COLOUR); + state->buttongcb = GrNewGC(); + GrSetGCForeground(state->buttongcb, BUTTON_BACKGROUND_COLOUR); + + state->pause_continue_button = GrNewWindow(state->main_window, + PAUSE_CONTINUE_BUTTON_X_POSITION, + PAUSE_CONTINUE_BUTTON_Y_POSITION, + PAUSE_CONTINUE_BUTTON_WIDTH, + PAUSE_CONTINUE_BUTTON_HEIGHT, 0, + BUTTON_BACKGROUND_COLOUR, 0); + GrSelectEvents(state->pause_continue_button, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + + state->anticlockwise_button = GrNewWindow(state->main_window, + ANTICLOCKWISE_BUTTON_X_POSITION, + ANTICLOCKWISE_BUTTON_Y_POSITION, + ANTICLOCKWISE_BUTTON_WIDTH, + ANTICLOCKWISE_BUTTON_HEIGHT, 0, + BUTTON_BACKGROUND_COLOUR, + 0); + GrSelectEvents(state->anticlockwise_button, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + + state->clockwise_button = GrNewWindow(state->main_window, + CLOCKWISE_BUTTON_X_POSITION, + CLOCKWISE_BUTTON_Y_POSITION, + CLOCKWISE_BUTTON_WIDTH, + CLOCKWISE_BUTTON_HEIGHT, 0, + BUTTON_BACKGROUND_COLOUR, + 0); + GrSelectEvents(state->clockwise_button, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + + state->left_button = GrNewWindow(state->main_window, + LEFT_BUTTON_X_POSITION, + LEFT_BUTTON_Y_POSITION, + LEFT_BUTTON_WIDTH, + LEFT_BUTTON_HEIGHT, 0, + BUTTON_BACKGROUND_COLOUR, + 0); + GrSelectEvents(state->left_button, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + + state->right_button = GrNewWindow(state->main_window, + RIGHT_BUTTON_X_POSITION, + RIGHT_BUTTON_Y_POSITION, + RIGHT_BUTTON_WIDTH, + RIGHT_BUTTON_HEIGHT, 0, + BUTTON_BACKGROUND_COLOUR, + 0); + GrSelectEvents(state->right_button, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + + state->drop_button = GrNewWindow(state->main_window, + DROP_BUTTON_X_POSITION, + DROP_BUTTON_Y_POSITION, + DROP_BUTTON_WIDTH, + DROP_BUTTON_HEIGHT, 0, + BUTTON_BACKGROUND_COLOUR, + 0); + GrSelectEvents(state->drop_button, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN); + + state->well_window = GrNewWindow(state->main_window, + WELL_WINDOW_X_POSITION, + WELL_WINDOW_Y_POSITION, + WELL_WINDOW_WIDTH, + WELL_WINDOW_HEIGHT, 0, + WELL_WINDOW_BACKGROUND_COLOUR, 0); + GrSelectEvents(state->well_window, GR_EVENT_MASK_EXPOSURE); + GrMapWindow(state->well_window); + state->wellgc = GrNewGC(); + + GrMapWindow(state->main_window); + + state->state = STATE_STOPPED; + state->score = 0; + read_hiscore(state); + state->level = 0; + state->running_buttons_mapped = 0; + + srandom(time(0)); + + choose_new_shape(state); + new_game(state); +} + +void calculate_timeout(nstate *state) +{ + struct timeval t; + long u; + + gettimeofday(&t, NULL); + u = t.tv_usec + (delays[state->level] * 1000); + state->timeout.tv_sec = t.tv_sec + (u / 1000000); + state->timeout.tv_usec = u % 1000000; +} + +unsigned long timeout_delay(nstate *state) +{ + struct timeval t; + signed long s, m, ret; + + gettimeofday(&t, NULL); + + if((t.tv_sec > state->timeout.tv_sec) || + ((t.tv_sec == state->timeout.tv_sec) && + t.tv_usec >= state->timeout.tv_usec)) return 1; + + s = state->timeout.tv_sec - t.tv_sec; + m = ((state->timeout.tv_usec - t.tv_usec) / 1000); + ret = (unsigned long)((1000 * s) + m); +/* + fprintf(stderr, "t.tv_sec = %ld, t.tv_usec = %ld, timeout.tv_sec = " + "%ld, timeout.tv_usec = %ld, s = %ld, m = %ld, ret = %ld\n", + t.tv_sec, t.tv_usec, state->timeout.tv_sec, + state->timeout.tv_usec, s, m, ret); +*/ + if(ret <= 0) return 1; + else return ret; +} + +void do_update(nstate *state) +{ + struct timeval t; + + gettimeofday(&t, NULL); + + if((t.tv_sec > state->timeout.tv_sec) || + ((t.tv_sec == state->timeout.tv_sec) && + (t.tv_usec >= state->timeout.tv_usec))) { + drop_block_1(state); + calculate_timeout(state); + } +} + +void do_pause(nstate *state) +{ + draw_pause_continue_button(state); + while(state->state == STATE_PAUSED) { + GrGetNextEvent(&state->event); + handle_event(state); + } + draw_pause_continue_button(state); +} + +void wait_for_start(nstate *state) +{ + draw_pause_continue_button(state); + while(state->state == STATE_STOPPED) { + GrGetNextEvent(&state->event); + handle_event(state); + } + if(state->state == STATE_NEWGAME) state->state = STATE_RUNNING; + draw_pause_continue_button(state); + calculate_timeout(state); +} + +void run_game(nstate *state) +{ + while(state->state == STATE_RUNNING) { + GrGetNextEventTimeout(&state->event, timeout_delay(state)); + handle_event(state); + if(state->state == STATE_PAUSED) do_pause(state); + if(state->state == STATE_RUNNING) do_update(state); + } +} + +void main_game_loop(nstate *state) +{ + wait_for_start(state); + while(state->state != STATE_EXIT) { + if(state->state == STATE_RUNNING) run_game(state); + if(state->state == STATE_STOPPED) wait_for_start(state); + if(state->state != STATE_EXIT) new_game(state); + } +} + +int main(int argc, char *argv[]) +{ + nstate *state = my_malloc(sizeof(nstate)); + + init_game(state); + main_game_loop(state); + + write_hiscore(state); + + GrClose(); + + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/ntetris.h b/packages/services/gfx/mw/current/src/demos/nanox/ntetris.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/ntetris.h @@ -0,0 +1,414 @@ +#ifndef NTETRIS_H +#define NTETRIS_H + +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is NanoTetris. + * + * The Initial Developer of the Original Code is Alex Holden. + * Portions created by Alex Holden are Copyright (C) 2000 + * Alex Holden . All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public license (the "[GNU] License"), in which case the + * provisions of [GNU] License are applicable instead of those + * above. If you wish to allow use of your version of this file only + * under the terms of the [GNU] License and not to allow others to use + * your version of this file under the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and + * other provisions required by the [GNU] License. If you do not delete + * the provisions above, a recipient may use your version of this file + * under either the MPL or the [GNU] License. + */ + +/* + * Anything which is configurable should be in this file. + * Unfortunately I haven't really bothered to comment anything except for the + * array of shape descriptions (you can add your own new shapes quite easily). + */ + +#ifndef __ECOS +#define USE_HISCORE_FILE +#define HISCORE_FILE "/usr/games/nanotetris.hiscore" +#endif +#undef HAVE_USLEEP +#define BLOCK_SIZE 10 +#define BORDER_WIDTH 10 +#define CONTROL_BAR_WIDTH 90 +#define BUTTON_HEIGHT 20 +#define BUTTON_WIDTH (CONTROL_BAR_WIDTH - BORDER_WIDTH) +#define BUTTON_BACKGROUND_COLOUR LTGRAY +#define BUTTON_FOREGROUND_COLOUR BLACK +#define MOVEMENT_BUTTON_WIDTH ((BUTTON_WIDTH / 2) - 1) +#define TEXT_X_POSITION 5 +#define TEXT_Y_POSITION 15 +#define TEXT2_Y_POSITION 30 +#define WELL_WIDTH 12 +#define WELL_HEIGHT 28 +#define WELL_VISIBLE_HEIGHT 24 +#define WELL_NOTVISIBLE (WELL_HEIGHT - WELL_VISIBLE_HEIGHT) +#define LEVEL_DIVISOR 500 +#ifdef __ECOS +#define DROP_BLOCK_DELAY 10 +#else +#define DROP_BLOCK_DELAY 25 +#endif +#define DELETE_LINE_DELAY 300 +#define SCORE_INCREMENT 100 + +#define MAIN_WINDOW_X_POSITION 0 +#define MAIN_WINDOW_Y_POSITION 0 +#define MAIN_WINDOW_WIDTH (CONTROL_BAR_WIDTH + (2 * BORDER_WIDTH) + \ + (WELL_WIDTH * BLOCK_SIZE)) +#define MAIN_WINDOW_HEIGHT ((2 * BORDER_WIDTH) + \ + (WELL_VISIBLE_HEIGHT * BLOCK_SIZE)) +#define MAIN_WINDOW_BACKGROUND_COLOUR BLUE + +#define SCORE_WINDOW_WIDTH BUTTON_WIDTH +#define SCORE_WINDOW_HEIGHT 35 +#define SCORE_WINDOW_X_POSITION BORDER_WIDTH +#define SCORE_WINDOW_Y_POSITION BORDER_WIDTH +#define SCORE_WINDOW_BACKGROUND_COLOUR BLACK +#define SCORE_WINDOW_FOREGROUND_COLOUR LTGREEN + +#define NEXT_SHAPE_WINDOW_SIZE 6 +#define NEXT_SHAPE_WINDOW_WIDTH (NEXT_SHAPE_WINDOW_SIZE * BLOCK_SIZE) +#define NEXT_SHAPE_WINDOW_HEIGHT (NEXT_SHAPE_WINDOW_SIZE * BLOCK_SIZE) +#define NEXT_SHAPE_WINDOW_X_POSITION (BORDER_WIDTH + 10) +#define NEXT_SHAPE_WINDOW_Y_POSITION ((2 * BORDER_WIDTH) + SCORE_WINDOW_HEIGHT) +#define NEXT_SHAPE_WINDOW_BACKGROUND_COLOUR BLACK + +#define NEW_GAME_BUTTON_WIDTH BUTTON_WIDTH +#define NEW_GAME_BUTTON_HEIGHT BUTTON_HEIGHT +#define NEW_GAME_BUTTON_X_POSITION BORDER_WIDTH +#define NEW_GAME_BUTTON_Y_POSITION ((3 * BORDER_WIDTH) + SCORE_WINDOW_HEIGHT \ + + NEXT_SHAPE_WINDOW_HEIGHT) + +#define PAUSE_CONTINUE_BUTTON_WIDTH BUTTON_WIDTH +#define PAUSE_CONTINUE_BUTTON_HEIGHT BUTTON_HEIGHT +#define PAUSE_CONTINUE_BUTTON_X_POSITION BORDER_WIDTH +#define PAUSE_CONTINUE_BUTTON_Y_POSITION ((4 * BORDER_WIDTH) + \ + SCORE_WINDOW_HEIGHT + NEXT_SHAPE_WINDOW_HEIGHT + \ + NEW_GAME_BUTTON_HEIGHT) + +#define ANTICLOCKWISE_BUTTON_WIDTH MOVEMENT_BUTTON_WIDTH +#define ANTICLOCKWISE_BUTTON_HEIGHT BUTTON_HEIGHT +#define ANTICLOCKWISE_BUTTON_X_POSITION BORDER_WIDTH +#define ANTICLOCKWISE_BUTTON_Y_POSITION ((5 * BORDER_WIDTH) + \ + SCORE_WINDOW_HEIGHT + NEXT_SHAPE_WINDOW_HEIGHT + \ + NEW_GAME_BUTTON_HEIGHT + PAUSE_CONTINUE_BUTTON_HEIGHT) + +#define CLOCKWISE_BUTTON_WIDTH MOVEMENT_BUTTON_WIDTH +#define CLOCKWISE_BUTTON_HEIGHT BUTTON_HEIGHT +#define CLOCKWISE_BUTTON_X_POSITION (ANTICLOCKWISE_BUTTON_X_POSITION + \ + ANTICLOCKWISE_BUTTON_WIDTH + 2) +#define CLOCKWISE_BUTTON_Y_POSITION ANTICLOCKWISE_BUTTON_Y_POSITION + +#define LEFT_BUTTON_WIDTH MOVEMENT_BUTTON_WIDTH +#define LEFT_BUTTON_HEIGHT BUTTON_HEIGHT +#define LEFT_BUTTON_X_POSITION BORDER_WIDTH +#define LEFT_BUTTON_Y_POSITION (ANTICLOCKWISE_BUTTON_Y_POSITION + \ + ANTICLOCKWISE_BUTTON_HEIGHT + 2) + +#define RIGHT_BUTTON_WIDTH MOVEMENT_BUTTON_WIDTH +#define RIGHT_BUTTON_HEIGHT BUTTON_HEIGHT +#define RIGHT_BUTTON_X_POSITION (LEFT_BUTTON_X_POSITION + LEFT_BUTTON_WIDTH + 2) +#define RIGHT_BUTTON_Y_POSITION LEFT_BUTTON_Y_POSITION + +#define DROP_BUTTON_WIDTH BUTTON_WIDTH +#define DROP_BUTTON_HEIGHT BUTTON_HEIGHT +#define DROP_BUTTON_X_POSITION BORDER_WIDTH +#define DROP_BUTTON_Y_POSITION (LEFT_BUTTON_Y_POSITION + LEFT_BUTTON_HEIGHT + 2) + +#define WELL_WINDOW_WIDTH (BLOCK_SIZE * WELL_WIDTH) +#define WELL_WINDOW_HEIGHT (BLOCK_SIZE * WELL_VISIBLE_HEIGHT) +#define WELL_WINDOW_X_POSITION (CONTROL_BAR_WIDTH + BORDER_WIDTH) +#define WELL_WINDOW_Y_POSITION BORDER_WIDTH +#define WELL_WINDOW_BACKGROUND_COLOUR BLACK + +enum { + STATE_STOPPED, + STATE_RUNNING, + STATE_PAUSED, + STATE_NEWGAME, + STATE_EXIT, + STATE_UNKNOWN +}; + +typedef GR_COLOR block; + +struct ntetris_shape { + int type; + int orientation; + GR_COLOR colour; + int x; + int y; +}; +typedef struct ntetris_shape shape; + +struct ntetris_state { + block blocks[2][WELL_HEIGHT][WELL_WIDTH]; + int score; + int hiscore; + int fhiscore; + int level; + int state; + int running_buttons_mapped; + shape current_shape; + shape next_shape; + GR_WINDOW_ID main_window; + GR_WINDOW_ID score_window; + GR_WINDOW_ID next_shape_window; + GR_WINDOW_ID new_game_button; + GR_WINDOW_ID pause_continue_button; + GR_WINDOW_ID anticlockwise_button; + GR_WINDOW_ID clockwise_button; + GR_WINDOW_ID left_button; + GR_WINDOW_ID right_button; + GR_WINDOW_ID drop_button; + GR_WINDOW_ID well_window; + GR_GC_ID scoregcf; + GR_GC_ID scoregcb; + GR_GC_ID nextshapegcf; + GR_GC_ID nextshapegcb; + GR_GC_ID buttongcf; + GR_GC_ID buttongcb; + GR_GC_ID wellgc; + GR_EVENT event; + struct timeval timeout; +}; +typedef struct ntetris_state nstate; + +void *my_malloc(size_t size); +void msleep(long ms); +void read_hiscore(nstate *state); +void write_hiscore(nstate *state); +int will_collide(nstate *state, int x, int y, int orientation); +void draw_shape(nstate *state, GR_COORD x, GR_COORD y, int erase); +void draw_well(nstate *state, int forcedraw); +void draw_score(nstate *state); +void draw_next_shape(nstate *state); +void draw_new_game_button(nstate *state); +void draw_anticlockwise_button(nstate *state); +void draw_clockwise_button(nstate *state); +void draw_left_button(nstate *state); +void draw_right_button(nstate *state); +void draw_drop_button(nstate *state); +void draw_pause_continue_button(nstate *state); +int block_is_all_in_well(nstate *state); +void delete_line(nstate *state, int line); +void block_reached_bottom(nstate *state); +void move_block(nstate *state, int direction); +void rotate_block(nstate *state, int direction); +void drop_block(nstate *state); +void handle_exposure_event(nstate *state); +void handle_mouse_event(nstate *state); +void handle_keyboard_event(nstate *state); +void handle_event(nstate *state); +void clear_well(nstate *state); +int random8(int limit); +void choose_new_shape(nstate *state); +void new_game(nstate *state); +void init_game(nstate *state); +void calculate_timeout(nstate *state); +unsigned long timeout_delay(nstate *state); +void do_update(nstate *state); +void do_pause(nstate *state); +void wait_for_start(nstate *state); +void run_game(nstate *state); +void main_game_loop(nstate *state); + +#define LEVELS 12 +static const int delays[] = {600, 550, 500, 450, 400, 350, + 300, 250, 200, 150, 100, 50}; +#define MAX_BLOCK_COLOUR 3 +static const GR_COLOR block_colours[] = { + LTRED, LTGREEN, LTBLUE, YELLOW +}; + +/* + * This isn't the most space efficient way of storing the shape patterns, but + * it's quick and easy to parse, and only takes a few hundred bytes of code + * space anyway. 0 means "not filled", 1 means "filled", 2 means "go to next + * line", and 3 means "end of pattern". There are four patterns for each shape; + * one for each orientation. Adding new shapes is quite easy- just increase + * MAXSHAPES by the number of shapes you add, then add the four pattern + * descriptions (each one should be the previous one rotated clockwise) for + * each shape. If you need to use more than MAXROWS rows (including the "end + * of line" marker), increase MAXROWS. Ditto for MAXCOLS. Increasing + * MAXORIENTATIONS (to get more than four orientations) may work, but it's + * untested, and remember that if you increase it you'll have to add the new + * orientations for all of the original shapes as well as your new ones. Also + * remember to add the new shapes the the array of shape sizes below. + */ +#define MAXSHAPES 7 +#define MAXORIENTATIONS 4 +#define MAXCOLS 5 +#define MAXROWS 4 +static const char shapes[MAXSHAPES][MAXORIENTATIONS][MAXROWS][MAXCOLS] = { + { /* **** */ + { + {1,1,1,1,3} + }, + { + {1,2}, + {1,2}, + {1,2}, + {1,3} + }, + { + {1,1,1,1,3} + }, + { + {1,2}, + {1,2}, + {1,2}, + {1,3} + } + }, + { /* * + *** */ + { + {0,0,1,2}, + {1,1,1,3} + }, + { + {1,2}, + {1,2}, + {1,1,3} + }, + { + {1,1,1,2}, + {1,3} + }, + { + {1,1,2}, + {0,1,2}, + {0,1,3} + } + }, + { /* * + *** */ + { + {1,2}, + {1,1,1,3} + }, + { + {1,1,2}, + {1,2}, + {1,3} + }, + { + {1,1,1,2}, + {0,0,1,3} + }, + { + {0,1,2}, + {0,1,2}, + {1,1,3} + } + }, + { /* ** + ** */ + { + {1,1,2}, + {0,1,1,3} + }, + { + {0,1,2}, + {1,1,2}, + {1,3} + }, + { + {1,1,2}, + {0,1,1,3} + }, + { + {0,1,2}, + {1,1,2}, + {1,3} + } + }, + { /* ** + ** */ + { + {0,1,1,2}, + {1,1,3} + }, + { + {1,2}, + {1,1,2}, + {0,1,3} + }, + { + {0,1,1,2}, + {1,1,3} + }, + { + {1,2}, + {1,1,2}, + {0,1,3} + } + }, + { /* ** + ** */ + { + {1,1,2}, + {1,1,3} + }, + { + {1,1,2}, + {1,1,3} + }, + { + {1,1,2}, + {1,1,3} + }, + { + {1,1,2}, + {1,1,3} + } + }, + { /* * + *** */ + { + {0,1,2}, + {1,1,1,3} + }, + { + {1,2}, + {1,1,2}, + {1,3} + }, + { + {1,1,1,2}, + {0,1,3} + }, + { + {0,1,2}, + {1,1,2}, + {0,1,3} + } + } +}; +static const unsigned char shape_sizes[MAXSHAPES][MAXORIENTATIONS][2] = { + {{4,1},{1,4},{4,1},{1,4}}, + {{3,2},{2,3},{3,2},{2,3}}, + {{3,2},{2,3},{3,2},{2,3}}, + {{3,2},{2,3},{3,2},{2,3}}, + {{3,2},{2,3},{3,2},{2,3}}, + {{2,2},{2,2},{2,2},{2,2}}, + {{3,2},{2,3},{3,2},{2,3}} +}; +#endif diff --git a/packages/services/gfx/mw/current/src/demos/nanox/ntetris.ppm b/packages/services/gfx/mw/current/src/demos/nanox/ntetris.ppm new file mode 100644 index 0000000000000000000000000000000000000000..678da816d307eea1e2444541e739d99409f8976d GIT binary patch literal 3130 zc$^C`<5E^|4svx2@ei_62+2rQaQE~LP%l;p@bgu0%giZBEm8keGvG2d zQZP2+GBP#gVqjP>ED(M`j2c|JV0!;EU?-_=KDyz!%>R#sh%le9ODHj)7=#rJD)aHH z85-uJY9MGn9xyQG<5n~H&Bu?(H-9HyFlzpY4}Yws1pUmXIQ+5JHB@&$4a`R|cnFyP Z|33=CTgeYD^U+L3GaH*F^fQ0xA^^@mgYW + * Copyright (C) 1999 Alistair Riddoch + */ + +#include +#include +#include +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + +/* If you need a clock bigger than 200x200 you will need to re-write the trig * + * to use longs. (Only applies under ELKS I think. */ +#define CWIDTH 100 /* Max 200 */ +#define CHEIGHT 100 /* Max 200 */ + +/* + * Definitions to make it easy to define cursors + */ +#define _ ((unsigned) 0) /* off bits */ +#define X ((unsigned) 1) /* on bits */ +#define MASK(a,b,c,d,e,f,g) \ + (((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \ + + e) * 2) + f) * 2) + g) << 9) + +static GR_WINDOW_ID w1; /* id for window */ +static GR_GC_ID gc1; /* graphics context for text */ +static GR_GC_ID gc2; /* graphics context for rectangle */ +static int lh = -1, lm = -1, ls = -1; +static time_t then; + +static unsigned char trig[91] = + { 0, 4, 8, 13, 17, 22, 26, 31, 35, 40, 44, 48, 53, 57, 61, 66, + 70, 74, 79, 83, 87, 91, 95, 100, 104, 108, 112, 116, 120, 124, 128, + 131, 135, 139, 143, 146, 150, 154, 157, 161, 164, 167, 171, 174, 177, + 181, 184, 187, 190, 193, 196, 198, 201, 204, 207, 209, 212, 214, 217, + 219, 221, 223, 226, 228, 230, 232, 233, 235, 237, 238, 240, 242, 243, + 244, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 254, 255, 255, + 255, 255, 255, 255}; + +void do_exposure(); +void do_clock(); +void do_idle(); +void errorcatcher(); /* routine to handle errors */ + +int +main(int ac, char **av) +{ + GR_EVENT event; /* current event */ + GR_BITMAP bitmap1fg[7]; /* bitmaps for first cursor */ + GR_BITMAP bitmap1bg[7]; + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + /* create window*/ + w1 = GrNewWindowEx( + GR_WM_PROPS_NOAUTOMOVE|GR_WM_PROPS_BORDER|GR_WM_PROPS_CAPTION| + GR_WM_PROPS_CLOSEBOX, "nxclock", GR_ROOT_WINDOW_ID, + 10, 10, CWIDTH, CHEIGHT, GrGetSysColor(GR_COLOR_WINDOW)); + + GrSelectEvents(w1, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ); + + gc1 = GrNewGC(); + gc2 = GrNewGC(); + + GrSetGCForeground(gc1, GrGetSysColor(GR_COLOR_WINDOW)); + GrSetGCBackground(gc1, GrGetSysColor(GR_COLOR_WINDOWTEXT)); + GrSetGCForeground(gc2, GrGetSysColor(GR_COLOR_WINDOWTEXT)); + GrSetGCBackground(gc2, GrGetSysColor(GR_COLOR_WINDOW)); + + bitmap1bg[0] = MASK(_,_,X,X,X,_,_); + bitmap1bg[1] = MASK(_,X,X,X,X,X,_); + bitmap1bg[2] = MASK(X,X,X,X,X,X,X); + bitmap1bg[3] = MASK(X,X,X,X,X,X,X); + bitmap1bg[4] = MASK(X,X,X,X,X,X,X); + bitmap1bg[5] = MASK(_,X,X,X,X,X,_); + bitmap1bg[6] = MASK(_,_,X,X,X,_,_); + + bitmap1fg[0] = MASK(_,_,_,X,_,_,_); + bitmap1fg[1] = MASK(_,X,_,X,_,X,_); + bitmap1fg[2] = MASK(_,_,_,X,_,_,_); + bitmap1fg[3] = MASK(X,_,_,X,X,_,X); + bitmap1fg[4] = MASK(_,_,_,_,_,_,_); + bitmap1fg[5] = MASK(_,X,_,_,_,X,_); + bitmap1fg[6] = MASK(_,_,_,X,_,_,_); + + GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg); + GrMapWindow(w1); + + while (1) { + GrGetNextEventTimeout(&event, 500L); + + switch (event.type) { + case GR_EVENT_TYPE_EXPOSURE: + do_exposure(&event.exposure); + break; + + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + + case GR_EVENT_TYPE_TIMEOUT: + do_clock(); + break; + } + } +} + +int bsin(int angle) +{ + if(angle < 91) { + return trig[angle]; + } else if (angle < 181) { + return trig[180 - angle]; + } else if (angle < 271) { + return -trig[angle - 180]; + } else if (angle < 361) { + return -trig[360 - angle]; + } else { + return 0; + } +} + +int bcos(int angle) +{ + if(angle < 91) { + return trig[90 - angle]; + } else if (angle < 181) { + return -trig[angle - 90]; + } else if (angle < 271) { + return -trig[270 - angle]; + } else if (angle < 361) { + return trig[angle - 270]; + } else { + return 0; + } +} + +/* + * Here when an exposure event occurs. + */ +void +do_exposure(ep) + GR_EVENT_EXPOSURE *ep; +{ + GR_COORD midx = CWIDTH / 2; + GR_COORD midy = CHEIGHT / 2; + int i, l; + +/* GrFillRect(w1, gc2, 0, 0, CWIDTH, CHEIGHT); */ +/* GrFillEllipse(w1, gc1, midx, midy, midx, midy); */ + GrEllipse(w1, gc2, midx, midy, midx - 1, midy - 1); + for(i = 0; i < 60; i++) { + if (i%5 == 0) { + l = 5; + } else { + l = 0; + } + GrLine(w1, gc2, + midx + (((midx - 3) * bsin(i * 6)) >> 8), + midy + (((midy - 3) * bcos(i * 6)) >> 8), + midx + (((midx - 3 - l) * bsin(i * 6)) >> 8), + midy + (((midy - 3 - l) * bcos(i * 6)) >> 8)); + } + + lh = -1; lm = -1; ls = -1; + then = 0; + do_clock(); +} + +void draw_time(int hour, int minutes, int sec, GR_GC_ID gc ) +{ + GR_COORD midx = CWIDTH / 2; + GR_COORD midy = CHEIGHT / 2; + + GrLine(w1, gc1, + midx + (((midx - 8 - midx / 10) * bsin(ls)) >> 8), + midy - (((midy - 8 - midy / 10) * bcos(ls)) >> 8), + midx + (((midx - 8 - midx / 4) * bsin(ls)) >> 8), + midy - (((midy - 8 - midx / 4) * bcos(ls)) >> 8)); + GrLine(w1, gc2, + midx + (((midx - 8 - midx / 10) * bsin(sec)) >> 8), + midy - (((midy - 8 - midy / 10) * bcos(sec)) >> 8), + midx + (((midx - 8 - midx / 4) * bsin(sec)) >> 8), + midy - (((midy - 8 - midx / 4) * bcos(sec)) >> 8)); + if ((lm != minutes) || (ls == minutes)) { + GrLine(w1, gc1, + midx + (((midx - 8 - midx / 10) * bsin(lm)) >> 8), + midy - (((midy - 8 - midy / 10) * bcos(lm)) >> 8), + midx + (((midx / 5) * bsin(lm)) >> 8), + midy - (((midy / 5) * bcos(lm)) >> 8)); + GrLine(w1, gc2, + midx + (((midx - 8 - midx / 10) * bsin(minutes)) >> 8), + midy - (((midy - 8 - midy / 10) * bcos(minutes)) >> 8), + midx + (((midx / 5) * bsin(minutes)) >> 8), + midy - (((midy / 5) * bcos(minutes)) >> 8)); + GrLine(w1, gc1, + midx + (((midx - 8 - midx / 2) * bsin(lh)) >> 8), + midy - (((midy - 8 - midy / 2) * bcos(lh)) >> 8), + midx + (((midx / 5) * bsin(lh)) >> 8), + midy - (((midy / 5) * bcos(lh)) >> 8)); + GrLine(w1, gc2, + midx + (((midx - 8 - midx / 2) * bsin(hour)) >> 8), + midy - (((midy - 8 - midy / 2) * bcos(hour)) >> 8), + midx + (((midx / 5) * bsin(hour)) >> 8), + midy - (((midy / 5) * bcos(hour)) >> 8)); + } + lh = hour; + lm = minutes; + ls = sec; +} + +/* + * Update the clock if the seconds have changed. + */ +void +do_clock() +{ + struct timeval tv; + struct timezone tz; + struct tm * tp; + time_t now; + int minutes, hour, sec; + + gettimeofday(&tv, &tz); + now = tv.tv_sec - (60 * tz.tz_minuteswest); + if (now == then) { + return; + } + then = now; + tp = gmtime(&now); + minutes = tp->tm_min * 6; + sec = tp->tm_sec * 6; + hour = tp->tm_hour; + if (hour > 12) { + hour -= 12; + } + hour = hour*30 + minutes/12; + draw_time(hour, minutes, sec, gc2); +} + +#if 0 +/* + * Sleep a while to avoid using too much CPU time. + */ +void do_idle() +{ + struct timespec idletime; + idletime.tv_sec = 0; + idletime.tv_nsec = 100000; + nanosleep(&idletime, NULL); +} +#endif diff --git a/packages/services/gfx/mw/current/src/demos/nanox/nxev.c b/packages/services/gfx/mw/current/src/demos/nanox/nxev.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/nxev.c @@ -0,0 +1,269 @@ +/* + * Copyright (C) 2000 by VTech Informations LTD + * + * This program is released under MPL + * + * Vladimir Cotfas , Nov 7, 2000 + */ + +#include +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + + +static GR_WINDOW_ID w1; /* id for large window */ +static GR_WINDOW_ID w2; /* id for child window */ +static GR_GC_ID gc1; /* graphics context for text */ + +#define ALT_CURSOR + +#define WIDTH 100 +#define HEIGHT 100 + +#ifdef ALT_CURSOR +/* + * Definitions to make it easy to define cursors + */ +#define _ ((unsigned) 0) /* off bits */ +#define X ((unsigned) 1) /* on bits */ +#define MASK(a,b,c,d,e,f,g) \ + (((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \ + + e) * 2) + f) * 2) + g) << 9) +#endif + +struct _xlat { + GR_UPDATE_TYPE type; + const char* name; +}; +typedef struct _xlat XLAT; + +static XLAT update_types[] = { + { 0, "none" }, + { GR_UPDATE_MAP, "GR_UPDATE_MAP" }, + { GR_UPDATE_UNMAP, "GR_UPDATE_UNMAP" }, + { GR_UPDATE_MOVE, "GR_UPDATE_MOVE" }, + { GR_UPDATE_SIZE, "GR_UPDATE_SIZE" }, + { GR_UPDATE_UNMAPTEMP, "GR_UPDATE_UNMAPTEMP" }, + { GR_UPDATE_ACTIVATE, "GR_UPDATE_ACTIVATE" }, + { GR_UPDATE_DESTROY, "GR_UPDATE_DESTROY" } +}; +#define NR_UPDATES 7 + +struct XLAT { + int event_type; + char* event_desc; +}; + +static struct XLAT table[] = { + { GR_EVENT_TYPE_ERROR, "GR_EVENT_TYPE_ERROR" }, + { GR_EVENT_TYPE_NONE, "GR_EVENT_TYPE_NONE" }, + { GR_EVENT_TYPE_EXPOSURE, "GR_EVENT_TYPE_EXPOSURE" }, + { GR_EVENT_TYPE_BUTTON_DOWN, "GR_EVENT_TYPE_BUTTON_DOWN" }, + { GR_EVENT_TYPE_BUTTON_UP, "GR_EVENT_TYPE_BUTTON_UP" }, + { GR_EVENT_TYPE_MOUSE_ENTER, "GR_EVENT_TYPE_MOUSE_ENTER" }, + { GR_EVENT_TYPE_MOUSE_EXIT, "GR_EVENT_TYPE_MOUSE_EXIT" }, + { GR_EVENT_TYPE_MOUSE_MOTION, "GR_EVENT_TYPE_MOUSE_MOTION" }, + { GR_EVENT_TYPE_MOUSE_POSITION, "GR_EVENT_TYPE_MOUSE_POSITION" }, + { GR_EVENT_TYPE_KEY_DOWN, "GR_EVENT_TYPE_KEY_DOWN" }, + { GR_EVENT_TYPE_KEY_UP, "GR_EVENT_TYPE_KEY_UP" }, + { GR_EVENT_TYPE_FOCUS_IN, "GR_EVENT_TYPE_FOCUS_IN" }, + { GR_EVENT_TYPE_FOCUS_OUT, "GR_EVENT_TYPE_FOCUS_OUT" }, + { GR_EVENT_TYPE_FDINPUT, "GR_EVENT_TYPE_FDINPUT" }, + { GR_EVENT_TYPE_UPDATE, "GR_EVENT_TYPE_UPDATE" }, + { GR_EVENT_TYPE_CHLD_UPDATE, "GR_EVENT_TYPE_CHLD_UPDATE" }, + { GR_EVENT_TYPE_CLOSE_REQ, "GR_EVENT_TYPE_CLOSE_REQ" }, +}; + +#define table_SZ (sizeof(table) / sizeof(table[0])) + +char* +lookupEvent(int type) +{ + int i; + + for (i = 0; i < table_SZ; i++) + if (table[i].event_type == type) + return table[i].event_desc; + + return NULL; +} + +int +main(int argc, char **argv) +{ + GR_EVENT event; /* current event */ + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + GrReqShmCmds(65536); /* shared mem is suposed to be faster */ + + w1 = GrNewWindow(GR_ROOT_WINDOW_ID, + 0, 0, + WIDTH, HEIGHT, + 4, + WHITE, BLACK); + GrSelectEvents(w1, 0xffffffffl); /* all events :) */ + + w2 = GrNewWindow(w1, + 10, 10, + WIDTH / 4, HEIGHT / 4, + 4, + WHITE, BLACK); + GrSelectEvents(w2, 0xffffffffl); /* all events :) */ + + + { + GR_WM_PROPERTIES props; + + props.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE; + + props.props = GR_WM_PROPS_BORDER | GR_WM_PROPS_CAPTION | \ + GR_WM_PROPS_CAPTION | GR_WM_PROPS_CLOSEBOX; + props.title = "nano-X Events"; + GrSetWMProperties(w1, &props); + } + + GrMapWindow(w1); + GrMapWindow(w2); + + gc1 = GrNewGC(); + + GrSetGCForeground(gc1, BLACK); + GrSetGCBackground(gc1, WHITE); + + +#ifdef ALT_CURSOR + { + GR_BITMAP bitmap1fg[7]; /* bitmaps for cursor */ + GR_BITMAP bitmap1bg[7]; + + bitmap1bg[0] = MASK(X,X,X,X,X,X,X); + bitmap1bg[1] = MASK(_,X,X,X,X,X,_); + bitmap1bg[2] = MASK(_,_,X,X,X,_,_); + bitmap1bg[3] = MASK(_,_,_,X,_,_,_); + bitmap1bg[4] = MASK(_,_,X,X,X,_,_); + bitmap1bg[5] = MASK(_,X,X,X,X,X,_); + bitmap1bg[6] = MASK(X,X,X,X,X,X,X); + + bitmap1fg[0] = MASK(X,X,X,X,X,X,X); + bitmap1fg[1] = MASK(_,X,X,X,X,X,_); + bitmap1fg[2] = MASK(_,_,X,X,X,_,_); + bitmap1fg[3] = MASK(_,_,_,X,_,_,_); + bitmap1fg[4] = MASK(_,_,X,X,X,_,_); + bitmap1fg[5] = MASK(_,X,X,X,X,X,_); + bitmap1fg[6] = MASK(X,X,X,X,X,X,X); + + GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg); + } +#endif + + + for (;;) { + GrGetNextEvent(&event); + + printf("%s (0x%x)\n", \ + lookupEvent(event.type), event.type); + + switch(event.type) { + case GR_EVENT_TYPE_EXPOSURE: + { + printf("\twid = %d\n", event.exposure.wid); + printf("\t(X, Y) = (%d, %d)\n", \ + event.exposure.x, event.exposure.y); + printf("\twidth = %d, height = %d\n", \ + event.exposure.width, event.exposure.height); + } + break; + case GR_EVENT_TYPE_BUTTON_DOWN: + case GR_EVENT_TYPE_BUTTON_UP: + { + printf("\twid = %d\n", event.button.wid); + printf("\tsub-window id = %d\n", event.button.subwid); + printf("\troot window (X, Y) coordinates = (%d, %d)\n", \ + event.button.rootx, event.button.rooty); + printf("\t(X, Y) = (%d, %d)\n", \ + event.button.x, event.button.y); + printf("\tbuttons: %04X, ", event.button.buttons); + printf("changed buttons: %04X\n", event.button.changebuttons); + printf("\tmodifiers: %04X\n", event.button.modifiers); + } + break; + case GR_EVENT_TYPE_MOUSE_ENTER: + case GR_EVENT_TYPE_MOUSE_EXIT: + case GR_EVENT_TYPE_MOUSE_MOTION: + case GR_EVENT_TYPE_MOUSE_POSITION: + { + printf("\twid = %d\n", event.mouse.wid); + printf("\tsub-window id = %d\n", event.mouse.subwid); + printf("\troot window (X, Y) coordinates = (%d, %d)\n", \ + event.mouse.rootx, event.mouse.rooty); + printf("\t(X, Y) = (%d, %d)\n", \ + event.mouse.x, event.mouse.y); + printf("\tbuttons: %04X\n", event.mouse.buttons); + printf("\tmodifiers: %04X\n", event.mouse.modifiers); + } + break; + case GR_EVENT_TYPE_KEY_DOWN: + case GR_EVENT_TYPE_KEY_UP: + { + printf("\twid = %d\n", event.keystroke.wid); + printf("\tsub-window id = %d\n", event.keystroke.subwid); + printf("\troot window (X, Y) coordinates = (%d, %d)\n", \ + event.keystroke.rootx, event.keystroke.rooty); + printf("\t(X, Y) = (%d, %d)\n", \ + event.keystroke.x, event.keystroke.y); + printf("\tbuttons: %04X\n", event.keystroke.buttons); + printf("\tmodifiers: %04X\n", event.keystroke.modifiers); + printf("\tUnicode-16 keyvalue: %d, ASCII: %d\n", \ + (int)event.keystroke.ch, event.keystroke.ch); + printf("\tscancode: %02X\n", + (int)event.keystroke.scancode); + } + break; + case GR_EVENT_TYPE_FOCUS_IN: + printf("\twid = %d\n", event.general.wid); + printf("\told focus = %d\n", event.general.otherid); + break; + case GR_EVENT_TYPE_FOCUS_OUT: + printf("\twid = %d\n", event.general.wid); + printf("\tnew focus = %d\n", event.general.otherid); + break; + case GR_EVENT_TYPE_UPDATE: + case GR_EVENT_TYPE_CHLD_UPDATE: + { + printf("\twid = %d\n", event.update.wid); + printf("\tsub-window id = %d\n", event.update.subwid); + printf("\t(X, Y) = (%d, %d)\n", \ + event.update.x, event.update.y); + printf("\twidth = %d, height = %d\n", \ + event.update.width, event.update.height); + { + GR_UPDATE_TYPE u = event.update.utype; + const char* p; + + p = (u > NR_UPDATES)? \ + "": \ + update_types[u].name; + + printf("\tupdate_type: %s (%d)\n", + p, u); + } + } + break; + case GR_EVENT_TYPE_TIMEOUT: + printf("\ttimeout?\n"); + break; + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + /* no return*/ + } + } + + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/nxlsclients.c b/packages/services/gfx/mw/current/src/demos/nanox/nxlsclients.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/nxlsclients.c @@ -0,0 +1,225 @@ +/* + * Copyright (C) 2000 by VTech Informations LTD. + * This program is released under MPL. + * + * Vladimir Cotfas Oct 25, 2000 + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" +#include "windef.h" + +/* which is the maximim window id?!?!*/ +#define LIMIT 10000 + +struct _colour { + unsigned long colour; + char* name; +}; +typedef struct _colour COLOURS; + +static COLOURS colour_table[] = { + { BLACK, "Black" }, + { BLUE, "Blue" }, + { GREEN, "Green"}, + { CYAN, "Cyan" }, + { RED, "Red" }, + { MAGENTA, "Magenta" }, + { BROWN, "Brown" }, + { LTGRAY, "LightGray" }, + { GRAY, "Gray" }, + { DKGRAY, "DarkGray" }, + { LTBLUE, "LightBlue" }, + { LTGREEN, "LightGreen" }, + { LTCYAN, "LightCyan" }, + { LTRED, "LightRed" }, + { LTMAGENTA, "LightMagenta" }, + { YELLOW, "Yellow" }, + { WHITE, "White" } +}; +#define NR_COLOURS (sizeof(colour_table) / sizeof(colour_table[0])) + +char* +lookupColour(unsigned long c) +{ + int i; + + for (i = 0; i < NR_COLOURS; i++) + if (c == colour_table[i].colour) + return colour_table[i].name; + + return "UanbleToComply"; +} + +struct _xlat { + unsigned event_type; + char* event_desc; +}; +typedef struct _xlat XLAT; + +static XLAT event_table[] = { + { GR_EVENT_TYPE_ERROR, "GR_EVENT_MASK_ERROR" }, +/* { GR_EVENT_TYPE_NONE, "GR_EVENT_MASK_NONE" }, */ + { GR_EVENT_TYPE_EXPOSURE, "GR_EVENT_MASK_EXPOSURE" }, + { GR_EVENT_TYPE_BUTTON_DOWN, "GR_EVENT_MASK_BUTTON_DOWN" }, + { GR_EVENT_TYPE_BUTTON_UP, "GR_EVENT_MASK_BUTTON_UP" }, + { GR_EVENT_TYPE_MOUSE_ENTER, "GR_EVENT_MASK_MOUSE_ENTER" }, + { GR_EVENT_TYPE_MOUSE_EXIT, "GR_EVENT_MASK_MOUSE_EXIT" }, + { GR_EVENT_TYPE_MOUSE_MOTION, "GR_EVENT_MASK_MOUSE_MOTION" }, + { GR_EVENT_TYPE_MOUSE_POSITION, "GR_EVENT_MASK_MOUSE_POSITION" }, + { GR_EVENT_TYPE_KEY_DOWN, "GR_EVENT_MASK_KEY_DOWN" }, + { GR_EVENT_TYPE_KEY_UP, "GR_EVENT_MASK_KEY_UP" }, + { GR_EVENT_TYPE_FOCUS_IN, "GR_EVENT_MASK_FOCUS_IN" }, + { GR_EVENT_TYPE_FOCUS_OUT, "GR_EVENT_MASK_FOCUS_OUT" }, + { GR_EVENT_TYPE_FDINPUT, "GR_EVENT_MASK_FDINPUT" }, + { GR_EVENT_TYPE_UPDATE, "GR_EVENT_MASK_UPDATE" }, + { GR_EVENT_TYPE_CHLD_UPDATE, "GR_EVENT_MASK_CHLD_UPDATE" }, + { GR_EVENT_TYPE_CLOSE_REQ, "GR_EVENT_MASK_CLOSE_REQ" } +}; +#define NR_MASKS (sizeof(event_table) / sizeof(event_table[0])) + +struct _wm_props { + GR_WM_PROPS prop; + char* prop_symbol; + char* prop_descr; +}; +typedef struct _wm_props WM_PROPS; + +static WM_PROPS props_table[] = { + /* Window properties */ + { GR_WM_PROPS_NOBACKGROUND, "GR_WM_PROPS_NOBACKGROUND", "Don't draw window background" }, + { GR_WM_PROPS_NOFOCUS, "GR_WM_PROPS_NOFOCUS", "Don't set focus to this window" }, + { GR_WM_PROPS_NOMOVE, "GR_WM_PROPS_NOMOVE", "Don't let user move window" }, + { GR_WM_PROPS_NORAISE, "GR_WM_PROPS_NORAISE", "Don't let user raise window" }, + { GR_WM_PROPS_NODECORATE, "GR_WM_PROPS_NODECORATE", "Don't redecorate window" }, + { GR_WM_PROPS_NOAUTOMOVE, "GR_WM_PROPS_NOAUTOMOVE", "Don't move window on decorating" }, + + /* default decoration style */ + { GR_WM_PROPS_APPWINDOW, "GR_WM_PROPS_APPWINDOW", "Leave appearance to WM" }, + { GR_WM_PROPS_APPMASK, "GR_WM_PROPS_APPMASK", "Appearance mask" }, + { GR_WM_PROPS_BORDER, "GR_WM_PROPS_BORDER", "Single line border" }, + { GR_WM_PROPS_APPFRAME, "GR_WM_PROPS_APPFRAME", "3D app frame" }, + { GR_WM_PROPS_CAPTION, "GR_WM_PROPS_CAPTION", "Title bar" }, + { GR_WM_PROPS_CLOSEBOX, "GR_WM_PROPS_CLOSEBOX", "Close box" }, +#if 0 + { GR_WM_PROPS_MAXIMIZED, "GR_WM_PROPS_MAXIMIZED", "Application is maximized" } +#endif +}; +#define NR_PROPS (sizeof(props_table) / sizeof(props_table[0])) + +int +main(int argc, char* argv[]) +{ + GR_WINDOW_ID w; + GR_WINDOW_INFO info; + + if (GrOpen() < 0) { + fprintf(stderr, "nxlsclients: cannot open graphics\n"); + exit(1); + } + + for (w = 0; w < LIMIT; w++) { + info.wid = -1; /* self-sabotaged like CCCP */ + + GrGetWindowInfo(w, &info); + + if (info.wid == -1) { + printf("Query wid = %d, GrGetWindowInfo() is not working!\n", w); + continue; + } + if (info.wid == 0) { +#if 0 + printf("Query wid = %d --> does not exist\n", w); +#endif + continue; + } + printf("Window id = %d\n", info.wid); + printf("\tAbsolute upper-left X: %d\n", info.x); + printf("\tAbsolute upper-left Y: %d\n", info.y); + printf("\tWidth = %d\n", info.width); + printf("\tHeight = %d\n", info.height); + printf("\tBorder: size = %d, colour = %s (#%06lX)\n", \ + info.bordersize, + lookupColour(info.bordercolor), info.bordercolor); + printf("\tBackground colour = %s (#%06lX)\n", \ + lookupColour(info.background), info.background); + + printf("\tParent = %d\n", info.parent); + printf("\tFirst child = %d\n", info.child); + printf("\tNext sibling? = %d\n", info.sibling); + + printf("\t%sinput-only, ", (info.inputonly == TRUE)?"": "not "); + printf("%smapped", (info.mapped == TRUE)?"": "not "); + if (info.mapped != TRUE) + printf(", unmapcount = %d", info.unmapcount); + printf("\n"); + + printf("\tEvent mask (0x%08lX):\n", info.eventmask); + { + int i, n = 0; + GR_EVENT_MASK tmp = info.eventmask; + + for (i = 0; i < NR_MASKS; i++) { + GR_EVENT_MASK mask = GR_EVENTMASK(event_table[i].event_type); + + if ((tmp & mask) == mask) { + printf("\t\t%s\n", event_table[i].event_desc); + n++; + } + } + if (!n) + printf("\t\tGR_EVENT_MASK_NONE (?!?!?)\n"); + } + + /* We don't use info.props, use GrGetWMProperties() intead */ + printf("\tWM Properties:\n"); + { + GR_WM_PROPERTIES wm_props; + + GrGetWMProperties(w, &wm_props); + + printf("\t\tTitle: "); + if ((wm_props.flags & GR_WM_FLAGS_TITLE ) == GR_WM_FLAGS_TITLE) + printf("'%s'\n", (char*)wm_props.title?:"(null)"); + else + printf("\n"); + + printf("\t\tBackground colour: "); + if ((wm_props.flags & GR_WM_FLAGS_BACKGROUND) == GR_WM_FLAGS_BACKGROUND) + printf("%s (#%06lX)\n", lookupColour(wm_props.background), + wm_props.background); + else + printf("\n"); + + printf("\t\tBorder size: "); + if ((wm_props.flags & GR_WM_FLAGS_BORDERSIZE) == GR_WM_FLAGS_BORDERSIZE) + printf("%d\n", wm_props.bordersize); + else + printf("\n"); + + printf("\t\tProperty bits (0x%08lX):\n", wm_props.props); + { + int i, n = 0; + + for (i = 0; i < NR_PROPS; i++) { + GR_WM_PROPS prop = props_table[i].prop; + if ((wm_props.props & prop) == prop) { + printf("\t\t\t%s (%s)\n", \ + props_table[i].prop_symbol, \ + props_table[i].prop_descr); + n++; + } + } + + if (!n) + printf("\t\tNONE (?!?!?)\n"); + } + + } + } + + GrClose(); + + return 0; + } diff --git a/packages/services/gfx/mw/current/src/demos/nanox/nxterm.c b/packages/services/gfx/mw/current/src/demos/nanox/nxterm.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/nxterm.c @@ -0,0 +1,1182 @@ +/* + * nxterm - terminal emulator for Nano-X + * + * (C) 1994,95,96 by Torsten Scherer (TeSche) + * itschere@techfak.uni-bielefeld.de + * + * - quite some changes for W1R1 + * - yet more changes for W1R2 + * + * TeSche 01/96: + * - supports W_ICON & W_CLOSE + * - supports /etc/utmp logging for SunOS4 and Linux + * - supports catching of console output for SunOS4 + * Phx 02-06/96: + * - supports NetBSD-Amiga + * Eero 11/97: + * - unsetenv(DISPLAY), setenv(LINES, COLUMNS). + * - Add new text modes (you need to use terminfo...). + * Eero 2/98: + * - Implemented fg/bgcolor setting. With monochrome server it changes + * bgmode variable, which tells in which mode to draw to screen + * (M_CLEAR/M_DRAW) and affects F_REVERSE settings. + * - Added a couple of checks. + * + * TODO: + * - Allocate and set sensible window palette for fg/bg color setting. + * - add scroll-region ('cs') command. Fairly many programs + * can take advantage of that. + * - Add xterm like mouse event to terminfo key event conversion... :) + * - check if current NetBSD really needs ifdefs below with + * current W server/library. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" +#include "nxterm.h" + +#define TITLE "nxterm" + +#define SMALLBUFFER 80 +#define LARGEBUFFER 1024 + +/* + * some pty helper functions + */ +#ifdef linux +#define NSIG _NSIG +#endif + +#ifdef __FreeBSD__ +#include +#endif + + +/* + * some global variables + */ + +static GR_WINDOW_ID w1; /* id for window */ +static GR_GC_ID gc1; /* graphics context */ +static GR_FONT_ID regFont; +/*static GR_FONT_ID boldFont;*/ + +static GR_SCREEN_INFO si; /* screen info */ +static GR_FONT_INFO fi; /* Font Info */ +static GR_WINDOW_INFO wi; +static GR_GC_INFO gi; +static GR_BOOL havefocus = GR_FALSE; + +static short winw, winh, pid, console; +static int pipeh; +static short cblink = 0, visualbell = 0, debug = 0; +#ifdef __FreeBSD__ +static char pty[SMALLBUFFER]; +static struct winsize winsz; +#endif + +#define fonh fi.height +#define fonw fi.maxwidth + +int term_init(); + +/****************************************************************************/ + +/* + * + */ + +/* static int isIconified; */ +static int isMaximized=0; + +void maximize(void) +{ + static short x0, y0, w, h, w_max,h_max; + + if (!isMaximized) + { + + w_max=si.cols-wi.bordersize; + h_max=si.rows-wi.bordersize; + GrMoveWindow(w1,0,0); + GrResizeWindow(w1,w_max, h_max); + isMaximized=1; + } + else + { + GrResizeWindow(w1, w, h); + GrMoveWindow(w1, x0, y0); + isMaximized=0; + } +} + + +/****************************************************************************/ + + +/* + * some common tool functions + */ + +void sigpipe(int sig) +{ + /* this one musn't close the window */ +/* _write_utmp(pty, "", "", 0); */ + kill(-pid, SIGHUP); + _exit(sig); +} + + +void sigchld(int sig) +{ +/* _write_utmp(pty, "", "", 0); */ + _exit(sig); +} + + +void sigquit(int sig) +{ + signal(sig, SIG_IGN); + kill(-pid, SIGHUP); +} + + +/* + * this is the wterm terminal code, almost like VT52 + */ + +short bgmode, escstate, curx, cury, curon, curvis; +short savx, savy, wrap, style; +short col, row, colmask = 0x7f, rowmask = 0x7f; + +/* + * something to buffer plain text output + */ + +short sbufcnt = 0; +short sbufx, sbufy; +char lineBuffer[SMALLBUFFER+1]; +char *sbuf=lineBuffer; + +void sflush(void) +{ + if (sbufcnt) + { + GrText(w1,gc1, sbufx*fonw, sbufy*fonh, sbuf, sbufcnt, GR_TFTOP); + sbufcnt = 0; + } +} + + +void lineRedraw(void) +{ + GrSetGCForeground(gc1,gi.background); + GrFillRect(w1, gc1, curx*fonw, cury*fonh, (col-curx)*fonw, fonh); + GrSetGCForeground(gc1,gi.foreground); + + if (sbufcnt) + { + sbuf[sbufcnt] = 0; + GrText(w1,gc1, sbufx*fonw, sbufy*fonh, sbuf, sbufcnt, GR_TFTOP); + } +} + +void sadd (char c) +{ + if (sbufcnt == SMALLBUFFER) + { + sflush (); + } + + if (!sbufcnt) + { + sbufx = curx; + sbufy = cury; + } + + sbuf[sbufcnt++] = c; +} + +void show_cursor (void) +{ + GrSetGCMode(gc1,GR_MODE_XOR); + GrSetGCForeground(gc1, WHITE); + GrFillRect(w1, gc1, curx*fonw, cury*fonh+1, fonw, fonh-1); + GrSetGCForeground(gc1, gi.foreground); + GrSetGCMode(gc1,GR_MODE_COPY); +} + + +void draw_cursor (void) +{ + if (!curvis) + { + curvis = 1; + show_cursor(); + } +} +void hide_cursor (void) +{ + if (curvis) + { + curvis = 0; + show_cursor(); + } +} + + +void vscroll(int lines) +{ + hide_cursor(); + GrCopyArea(w1,gc1,0, 0, winw, winh-(lines*fonh), + w1, 0, (lines*fonh), MWROP_SRCCOPY); + + GrSetGCForeground(gc1,gi.background); + GrFillRect(w1, gc1, 0, winh-(lines*fonh), + winw, (lines*fonh)); + GrSetGCForeground(gc1,gi.foreground); +} + +void esc5(unsigned char c) /* setting background color */ +{ + + GrSetGCBackground(gc1, c); + GrGetGCInfo(gc1,&gi); + escstate = 0; +} + +void esc4(unsigned char c) /* setting foreground color */ +{ + GrSetGCForeground(gc1,c); + GrGetGCInfo(gc1,&gi); + escstate = 0; +} + +void esc3(unsigned char c) /* cursor position x axis */ +{ + curx = (c - 32) & colmask; + if (curx >= col) + curx = col - 1; + else if (curx < 0) + curx = 0; + escstate = 0; +} + + +void esc2(unsigned char c) /* cursor position y axis */ +{ + cury = (c - 32) & rowmask; + if (cury >= row) + cury = row - 1; + else if (cury < 0) + cury = 0; + escstate = 3; +} + + +void esc1(unsigned char c) /* various control codes */ +{ + static int ReverseMode=0; + escstate = 0; + + switch(c) + { + case 'A':/* cursor up */ + hide_cursor(); + if ((cury -= 1) < 0) + cury = 0; + break; + + case 'B':/* cursor down */ + hide_cursor(); + if ((cury += 1) >= row) + cury = row - 1; + break; + + case 'C':/* cursor right */ + hide_cursor(); + if ((curx += 1) >= col) + curx = col - 1; + break; + + case 'D':/* cursor left */ + hide_cursor(); + if ((curx -= 1) < 0) + curx = 0; + break; + + case 'E':/* clear screen & home */ + GrClearWindow(w1, 0); + curx = 0; + cury = 0; + break; + + case 'H':/* cursor home */ + curx = 0; + cury = 0; + break; + + case 'I':/* reverse index */ + if ((cury -= 1) < 0) + { + cury = 0; + vscroll(1); + } + break; + + case 'J':/* erase to end of page */ + + if (cury < row-1) + { + GrSetGCForeground(gc1,gi.background); + GrFillRect(w1,gc1, 0,(cury+1)*fonh, winw, (row-1-cury)*fonh); + GrSetGCForeground(gc1,gi.foreground); + } + GrSetGCForeground(gc1,gi.background); + GrFillRect(w1, gc1, curx*fonw, cury*fonh, (col-curx)*fonw, fonh); + GrSetGCForeground(gc1,gi.foreground); + break; + + case 'K':/* erase to end of line */ + GrSetGCForeground(gc1,gi.background); + GrFillRect(w1, gc1, curx*fonw, cury*fonh, (col-curx)*fonw, fonh); + GrSetGCForeground(gc1,gi.foreground); + break; + + case 'L':/* insert line */ + if (cury < row-1) + { + vscroll(1); + } + curx = 0; + break; + + case 'M':/* delete line */ + if (cury < row-1) + { + vscroll(1); + } + curx = 0; + break; + + case 'Y':/* position cursor */ + escstate = 2; + break; + + case 'b':/* set foreground color */ + escstate = 4; + break; + + case 'c':/* set background color */ + escstate = 5; + break; + + case 'd':/* erase beginning of display */ +/* w_setmode(win, bgmode); */ + if (cury > 0) + { + GrSetGCForeground(gc1,gi.background); + GrFillRect(w1,gc1, 0, 0, winw, cury*fonh); + GrSetGCForeground(gc1,gi.foreground); + } + if (curx > 0) + { + GrSetGCForeground(gc1,gi.background); + GrFillRect(w1,gc1, 0, cury*fonh, curx*fonw, fonh); + GrSetGCForeground(gc1,gi.foreground); + } + break; + + case 'e':/* enable cursor */ + curon = 1; + break; + + case 'f':/* disable cursor */ + curon = 0; + break; + + case 'j':/* save cursor position */ + savx = curx; + savy = cury; + break; + + case 'k':/* restore cursor position */ + curx = savx; + cury = savy; + break; + + case 'l':/* erase entire line */ + GrSetGCForeground(gc1,gi.background); + GrRect(w1,gc1, 0, cury*fonh, winw, fonh); + GrSetGCForeground(gc1,gi.foreground); + curx = 0; + break; + + case 'o':/* erase beginning of line */ + if (curx > 0) + { + GrSetGCForeground(gc1,gi.background); + GrRect(w1,gc1,0, cury*fonh, curx*fonw, fonh); + GrSetGCForeground(gc1,gi.foreground); + } + break; + + case 'p':/* enter reverse video mode */ + { + if(!ReverseMode) + { + GrSetGCForeground(gc1,gi.background); + GrSetGCBackground(gc1,gi.foreground); + ReverseMode=1; + } + } + break; + + case 'q':/* exit reverse video mode */ + { + if(ReverseMode) + { + GrSetGCForeground(gc1,gi.foreground); + GrSetGCBackground(gc1,gi.background); + ReverseMode=0; + } + } + break; + + case 'v':/* enable wrap at end of line */ + wrap = 1; + break; + + case 'w':/* disable wrap at end of line */ + wrap = 0; + break; + +/* and these are the extentions not in VT52 */ + + case 'G': /* clear all attributes */ + break; + + case 'g': /* enter bold mode */ +/* GrSetGCFont(gc1, boldFont); */ + break; + + case 'h': /* exit bold mode */ +/* GrSetGCFont(gc1, regFont); */ + break; + + case 'i': /* enter underline mode */ + break; + + /* j, k and l are already used */ + + case 'm': /* exit underline mode */ + break; + +/* these ones aren't yet on the termcap entries */ + + case 'n': /* enter italic mode */ + break; + /* o, p and q are already used */ + + case 'r': /* exit italic mode */ + break; + + case 's': /* enter light mode */ + break; + + case 't': /* exit ligth mode */ + break; + + default: /* unknown escape sequence */ + break; + } +} + +/* + * un-escaped character print routine + */ + +void esc0 (unsigned char c) +{ + switch (c) + { + case 0: + /* + * printing \000 on a terminal means "do nothing". + * But since we use \000 as string terminator none + * of the characters that follow were printed. + * + * perl -e 'printf("a%ca", 0);' + * + * said 'a' in a wterm, but should say 'aa'. This + * bug screwed up most ncurses programs. + * + * kay. + */ + break; + + case 7: /* bell */ + if (visualbell) + { +/* w_setmode(win, M_INVERS); */ +/* w_pbox(win, 0, 0, winw, winh); */ +/* w_test(win, 0, 0); */ +/* w_pbox(win, 0, 0, winw, winh); */ + ; + } + else + { + ; + GrBell(); + } + break; + + case 8: /* backspace */ + lineRedraw(); + if (--curx < 0) + { + curx = 0; + } + break; + + case 9: /* tab */ + { + int borg,i; + + borg=(((curx >> 3) + 1) << 3); + if(borg >= col) + { + borg=col-1; + } + borg=borg-curx; + for(i=0; i < borg; ++i){sadd(' ');} + if ((curx = ((curx >> 3) + 1) << 3) >= col) + { + curx = col - 1; + } + } + break; + + case 10: /* line feed */ + sflush(); + if (++cury >= row) + { + vscroll(1); + cury = row-1; + } + break; + + case 13: /* carriage return */ + sflush(); + curx = 0; + break; + + case 27: /* escape */ + sflush(); + escstate = 1; + break; + + case 127: /* delete */ + break; + + default: /* any printable char */ + sadd(c); + if (++curx >= col) + { + sflush(); + if (!wrap) + { + curx = col-1; + } + else + { + curx = 0; + if (++cury >= row) + { + vscroll(1); + } + } + } + break; + } +} + + +void printc(unsigned char c) +{ + switch(escstate) + { + case 0: + esc0(c); + break; + + case 1: + sflush(); + esc1(c); + break; + + case 2: + sflush(); + esc2(c); + break; + + case 3: + sflush(); + esc3(c); + break; + + case 4: + sflush(); + esc4(c); + break; + + case 5: + sflush(); + esc5(c); + break; + + default: + escstate = 0; + break; + } +} + + +void init() +{ + curx = savx = 0; + cury = savy = 0; + wrap = 1; + curon = 1; + curvis = 0; + escstate = 0; +} + + +/* + * general code... + */ + +void +term(void) +{ + long in, l; + GR_EVENT wevent; + GR_EVENT_KEYSTROKE *kp; + unsigned char buf[LARGEBUFFER]; + + GrRegisterInput(pipeh); + while (42) { + if (havefocus) + draw_cursor(); + GrGetNextEvent(&wevent); + + switch(wevent.type) { + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + break; + + case GR_EVENT_TYPE_KEY_DOWN: + kp=(GR_EVENT_KEYSTROKE *)&wevent; + /* toss all special keys*/ + if (kp->ch & MWKEY_NONASCII_MASK) + break; + *buf = kp->ch & 0xff; + write(pipeh, buf,1); + break; + + case GR_EVENT_TYPE_FOCUS_IN: + havefocus = GR_TRUE; + break; + + case GR_EVENT_TYPE_FOCUS_OUT: + havefocus = GR_FALSE; + hide_cursor(); + break; + + case GR_EVENT_TYPE_UPDATE: + /* + * if we get temporarily unmapped (moved), + * set cursor state off. + */ + if (wevent.update.utype == GR_UPDATE_UNMAPTEMP) + curvis = 0; + break; + + case GR_EVENT_TYPE_FDINPUT: + hide_cursor(); + while ((in = read(pipeh, buf, sizeof(buf))) > 0) { + for (l=0; l] [-s ]\n"); + printf(" [-g ] [-v] [-c] [-h] [program {args}]\n"); + exit(0); +} + + +void *mysignal(int signum, void *handler) +{ + struct sigaction sa, so; + + sa.sa_handler = handler; + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + sigaction(signum, &sa, &so); + + return so.sa_handler; +} + +/* + * guess what... :) + */ + +int main(int argc, char **argv) +{ + GR_BITMAP bitmap1fg[7]; /* mouse cursor */ + GR_BITMAP bitmap1bg[7]; + GR_WM_PROPERTIES props; + + short xp, yp, fsize; + char *family, *shell = NULL, *cptr, *geometry = NULL; + struct passwd *pw; + char buf[80]; + short uid; + char thesh[128]; +#ifdef __FreeBSD__ + char *ptr; +#endif + +#ifdef SIGTTOU + /* just in case we're started in the background */ + signal(SIGTTOU, SIG_IGN); +#endif + + /* who am I? */ + if (!(pw = getpwuid((uid = getuid())))) + { + fprintf(stderr, "error: wterm can't determine determine your login name\n"); + exit(-1); + } + + + if (GrOpen() < 0) + { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + GrGetScreenInfo(&si); + /* + * scan arguments... + */ + + console = 0; + argv++; + while (*argv && **argv=='-') + switch (*(*argv+1)) + { + case 'b': + cblink = 1; + argv++; + break; + + case 'c': + console = 1; + argv++; + break; + + case 'd': + debug = 1; + argv++; + break; + + case 'f': + if (*++argv) { + family = *argv++; + } else { + usage("-f option requires an argument"); + } + break; + + case 's': + if (*++argv) { + fsize = atoi(*argv++); + } else { + usage("-s option requires an argument"); + } + break; + + case 'g': + if (*++argv) { + geometry = *argv++; + } else { + usage("-g option requires an argument"); + } + break; + + case 'h': + /* this will never return */ + usage(""); + + case 'v': + visualbell = 1; + argv++; + break; + + default: + usage("unknown option"); + } + + /* + * now *argv either points to a program to start or is zero + */ + + if (*argv) { + shell = *argv; + } + if (!shell) { + shell = getenv("SHELL="); + } + if (!shell) { + shell = pw->pw_shell; + } + if (!shell) { + shell = "/bin/sh"; + } + + if (!*argv) { + /* + * the '-' makes the shell think it is a login shell, + * we leave argv[0] alone if it isn`t a shell (ie. + * the user specified the program to run as an argument + * to wterm. + */ + cptr = strrchr(shell, '/'); + sprintf (thesh, "-%s", cptr ? cptr + 1 : shell); + *--argv = thesh; + } + + col = 80; + row = 25; + xp = 0; + yp = 0; + if (geometry) + { + if (col < 1) + { + col = 80; + } + if (row < 1) + { + row = 25; + } + if (col > 0x7f) + colmask = 0xffff; + if (row > 0x7f) + rowmask = 0xffff; + } + + regFont=GrCreateFont(GR_FONT_SYSTEM_FIXED, 0, NULL); + /*regFont=GrCreateFont(GR_FONT_OEM_FIXED, 0, NULL);*/ + /*boldFont=GrCreateFont(GR_FONT_SYSTEM_FIXED, 0, NULL);*/ + GrGetFontInfo(regFont, &fi); + + winw=col*fi.maxwidth; + winh=row*fi.height; + w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 10,10,winw, winh,0,BLACK,LTBLUE); + props.flags = GR_WM_FLAGS_TITLE; + props.title = TITLE; + GrSetWMProperties(w1, &props); + + GrSelectEvents(w1, GR_EVENT_MASK_BUTTON_DOWN | + GR_EVENT_MASK_KEY_DOWN | + GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT | + GR_EVENT_MASK_UPDATE | GR_EVENT_MASK_CLOSE_REQ); + + GrMapWindow(w1); + + gc1 = GrNewGC(); + GrSetGCFont(gc1, regFont); + +#define _ ((unsigned) 0) /* off bits */ +#define X ((unsigned) 1) /* on bits */ +#define MASK(a,b,c,d,e,f,g) \ + (((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \ + + e) * 2) + f) * 2) + g) << 9) + bitmap1fg[0] = MASK(_,_,X,_,X,_,_); + bitmap1fg[1] = MASK(_,_,_,X,_,_,_); + bitmap1fg[2] = MASK(_,_,_,X,_,_,_); + bitmap1fg[3] = MASK(_,_,_,X,_,_,_); + bitmap1fg[4] = MASK(_,_,_,X,_,_,_); + bitmap1fg[5] = MASK(_,_,_,X,_,_,_); + bitmap1fg[6] = MASK(_,_,X,_,X,_,_); + + bitmap1bg[0] = MASK(_,X,X,X,X,X,_); + bitmap1bg[1] = MASK(_,_,X,X,X,_,_); + bitmap1bg[2] = MASK(_,_,X,X,X,_,_); + bitmap1bg[3] = MASK(_,_,X,X,X,_,_); + bitmap1bg[4] = MASK(_,_,X,X,X,_,_); + bitmap1bg[5] = MASK(_,_,X,X,X,_,_); + bitmap1bg[6] = MASK(_,X,X,X,X,X,_); + GrSetCursor(w1, 7, 7, 3, 3, GREEN, BLACK, bitmap1fg, bitmap1bg); + GrSetGCForeground(gc1, GREEN); + GrSetGCBackground(gc1, BLACK); + GrGetWindowInfo(w1,&wi); + GrGetGCInfo(gc1,&gi); + + sprintf(buf, "wterm: %s", shell); + + /* + * what kind of terminal do we want to emulate? + */ +#ifdef __FreeBSD__ + putenv ("TERM=wterm"); +#else + putenv ("TERM=vt52"); +#endif + + /* + * this one should enable us to get rid of an /etc/termcap entry for + * both curses and ncurses, hopefully... + */ + + if (termcap_string) + { + sprintf (termcap_string + strlen (termcap_string), "li#%d:co#%d:", + row, col); + putenv (termcap_string); + } + /* in case program absolutely needs terminfo entry, these 'should' + * transmit the screen size of correctly (at least xterm sets these + * and everything seems to work correctly...). Unlike putenv(), + * setenv() allocates also the given string not just a pointer. + */ + sprintf (buf, "%d", col); + setenv ("COLUMNS", buf, 1); + sprintf (buf, "%d", row); + setenv ("LINES", buf, 1); + + init(); + + /* + * create a pty + */ +#ifdef __FreeBSD__ + winsz.ws_col = col; + winsz.ws_row = row; + if ((pid = forkpty(&pipeh, pty, NULL, &winsz)) < 0) + { + fprintf(stderr,"wterm: can't create pty\r\n"); + perror("wterm"); + sleep(2); + GrKillWindow(w1); + exit(-1); + } + + if ((ptr = rindex(pty, '/'))) + { + strcpy(pty, ptr + 1); + } + + if (!pid) + { + int i; + for (i = getdtablesize(); --i >= 3; ) + close (i); + /* + * SIG_IGN are not reset on exec() + */ + for (i = NSIG; --i >= 0; ) + signal (i, SIG_DFL); + + /* caution: start shell with correct user id! */ + seteuid(getuid()); + setegid(getgid()); + + /* this shall not return */ + execvp(shell, argv); + + /* oops? */ + fprintf(stderr,"wterm: can't start shell\r\n"); + sleep(3); + GrKillWindow(w1); + _exit(-1); + } +#else + pipeh = term_init(); +#endif + +/* _write_utmp(pty, pw->pw_name, "", time(0)); */ + +#if 0 + /* catch some signals */ + mysignal(SIGTERM, sigquit); + mysignal(SIGHUP, sigquit); + mysignal(SIGINT, SIG_IGN); + mysignal(SIGQUIT, sigquit); + mysignal(SIGPIPE, sigpipe); + mysignal(SIGCHLD, sigchld); +#endif + + /* prepare to catch console output */ + if (console) + { + /* for any OS chr$(7) might cause endless loops if + * catched from console + */ + visualbell = 1; + console = 0; /* data will come to normal pipe handle */ + ioctl(pipeh, TIOCCONS, 0); + } + + term(); + return 0; +} + +#if ELKS +char * nargv[2] = {"/bin/sash", NULL}; +#else +#if DOS_DJGPP +char * nargv[2] = {"bash", NULL}; +#else +char * nargv[2] = {"/bin/sh", NULL}; +#endif +#endif + +void sigchild(int signo) +{ + GrClose(); + exit(0); +} + +int term_init() +{ + int tfd; + int n = 0; + pid_t pid; + char pty_name[12]; + +again: + sprintf(pty_name, "/dev/ptyp%d", n); + if ((tfd = open(pty_name, O_RDWR | O_NONBLOCK)) < 0) { + if ((errno == EBUSY || errno == EIO) && n < 10) { + n++; + goto again; + } + fprintf(stderr, "Can't create pty %s\n", pty_name); + return -1; + } + signal(SIGCHLD, sigchild); + signal(SIGINT, sigchild); + if ((pid = fork()) == -1) { + fprintf(stderr, "No processes\n"); + return -1; + } + if (!pid) { + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(tfd); + + setsid(); + pty_name[5] = 't'; + if ((tfd = open(pty_name, O_RDWR)) < 0) { + fprintf(stderr, "Child: Can't open pty %s\n", pty_name); + exit(1); + } + close(STDERR_FILENO); + dup2(tfd, STDIN_FILENO); + dup2(tfd, STDOUT_FILENO); + dup2(tfd, STDERR_FILENO); + execv(nargv[0], nargv); + exit(1); + } + return tfd; +} + +#if 0 +void _write_utmp(char *line, char *user, char *host, int time) +{ + int fh, offset, isEmpty, isLine; + struct utmp ut; + + if ((fh = open("/etc/utmp", O_RDWR)) < 0) { + return; + } + + /* first of all try to find an entry with the same line */ + + offset = 0; + isEmpty = -1; + isLine = -1; + + while ((isLine < 0) && (read(fh, &ut, sizeof(ut)) == sizeof(ut))) { + if (!ut.ut_line[0]) + { + if (isEmpty < 0) + { + isEmpty = offset; + } + } + else + { + if (!strncmp(ut.ut_line, line, sizeof(ut.ut_line))) { + isLine = offset; + } + } + offset += sizeof(ut); + } + + if (isLine != -1) { + /* we've found a match */ + lseek(fh, isLine, SEEK_SET); + } else if (isEmpty != -1) { + /* no match found, but at least an empty entry */ + lseek(fh, isLine, SEEK_SET); + } else { + /* not even an empty entry found, assume we can append to the file */ + } + + if (time) + { + strncpy(ut.ut_line, line, sizeof(ut.ut_line)); + strncpy(ut.ut_name, user, sizeof(ut.ut_name)); + strncpy(ut.ut_host, host, sizeof(ut.ut_host)); + ut.ut_time = time; + } + else + { + memset(&ut, 0, sizeof(ut)); + } + write(fh, &ut, sizeof(ut)); + close(fh); +} +#endif diff --git a/packages/services/gfx/mw/current/src/demos/nanox/nxterm.h b/packages/services/gfx/mw/current/src/demos/nanox/nxterm.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/nxterm.h @@ -0,0 +1,65 @@ +/* These contained 'pt:re=\\EC' entries. I deleted them from MiNT and linux + * because neither of my (linux) termcap nor terminfo manual pages listed + * them. + * ++eero + */ +#ifdef __MINT__ + +static char termcap_string[1024] = +"TERMCAP=wterm|WTerm terminal:al=\\EL:am:bc=\\ED:bl=^G:bs:cd=\\EJ:\ +ce=\\EK:cl=\\EE:cm=\\EY%+ %+ :cr=^M:dl=\\EM:do=\\EB:ho=\\EH:is=\\Ev\\Eq:\ +l0=F10:le=\\ED:ms:nd=\\EC:rc=\\Ek:rs=\\Ev\\Eq\\EE:sc=\\Ej:sr=\\EI:\ +ti=\\Ev\\Ee\\EG:up=\\EA:ve=\\Ee:vi=\\Ef:so=\\Ep:se=\\Eq:mb=\\Ei:md=\\Eg:\ +mr=\\Ep:me=\\EG:te=\\EG:us=\\Ei:ue=\\EG:\ +kb=^H:kl=\\ED:kr=\\EC:ku=\\EA:kd=\\EB:kI=\\EI:kh=\\EE:kP=\\Ea:kN=\\Eb:k0=\\EY:\ +k1=\\EP:k2=\\EQ:k3=\\ER:k4=\\ES:k5=\\ET:k6=\\EU:k7=\\EV:k8=\\EW:k9=\\EX:\ +s0=\\Ey:s1=\\Ep:s2=\\Eq:s3=\\Er:s4=\\Es:s5=\\Et:s6=\\Eu:s7=\\Ev:s8=\\Ew:\ +s9=\\Ex:"; + +#elif defined(linux) || defined(__FreeBSD__) + +static char termcap_string[1024] = +"TERMCAP=wterm|WTerm terminal:al=\\EL:am:bc=\\ED:bl=^G:bs:cd=\\EJ:\ +ce=\\EK:cl=\\EE:cm=\\EY%+ %+ :cr=^M:dl=\\EM:do=\\EB:ho=\\EH:is=\\Ev\\Eq:\ +l0=F10:le=\\ED:ms:nd=\\EC:rc=\\Ek:rs=\\Ev\\Eq\\EE:sc=\\Ej:sr=\\EI:\ +ti=\\Ev\\Ee\\EG:up=\\EA:ve=\\Ee:vi=\\Ef:so=\\Ep:se=\\Eq:mb=\\Ei:md=\\Eg:\ +mr=\\Ep:me=\\EG:te=\\EG:us=\\Ei:ue=\\EG:\ +kb=^H:kl=\\E[D:kr=\\E[C:ku=\\E[A:kd=\\E[B:kI=\\EI:kh=\\EE:kP=\\Ea:kN=\\Eb:\ +k0=\\EY:k1=\\EP:k2=\\EQ:k3=\\ER:k4=\\ES:k5=\\ET:k6=\\EU:k7=\\EV:k8=\\EW:\ +k9=\\EX:s0=\\Ey:s1=\\Ep:s2=\\Eq:s3=\\Er:s4=\\Es:s5=\\Et:s6=\\Eu:s7=\\Ev:\ +s8=\\Ew:s9=\\Ex:"; + +#elif defined(sun) + + /* only very basic cursor keys so far... */ + +static char termcap_string[1024] = +"TERMCAP=wterm|WTerm terminal:al=\\EL:am:bc=\\ED:bl=^G:bs:cd=\\EJ:\ +ce=\\EK:cl=\\EE:cm=\\EY%+ %+ :cr=^M:dl=\\EM:do=\\EB:ho=\\EH:is=\\Ev\\Eq:\ +l0=F10:le=\\ED:ms:nd=\\EC:pt:re=\\EC:rc=\\Ek:rs=\\Ev\\Eq\\EE:sc=\\Ej:sr=\\EI:\ +ti=\\Ev\\Ee\\EG:up=\\EA:ve=\\Ee:vi=\\Ef:so=\\Ep:se=\\Eq:mb=\\Ei:md=\\Eg:\ +mr=\\Ep:me=\\EG:te=\\EG:us=\\Ei:ue=\\EG:\ +kb=^H:kl=\\E[D:kr=\\E[C:ku=\\E[A:kd=\\E[B:\ +k1=\\E[224z:k2=\\E[225z:k3=\\E[226z:k4=\\E[227z:k5=\\E[228z:\ +k6=\\E[229z:k7=\\E[230z:k8=\\E[231z:k9=\\E[232z:k0=\\E[233z:\ +kN=\\E[222z:kP=\\E[216z:kh=\\E[214z:kH=\\E220z:"; + +#elif defined(__NetBSD__) + +static char termcap_string[1024] = +"TERMCAP=wterm|WTerm terminal:al=\\EL:am:bc=\\ED:bl=^G:bs:cd=\\EJ:\ +ce=\\EK:cl=\\EE:cm=\\EY%+ %+ :cr=^M:dl=\\EM:do=\\EB:ho=\\EH:is=\\Ev\\Eq:\ +l0=F10:le=\\ED:ms:nd=\\EC:pt:re=\\EC:rc=\\Ek:rs=\\Ev\\Eq\\EE:sc=\\Ej:sr=\\EI:\ +ti=\\Ev\\Ee\\EG:up=\\EA:ve=\\Ee:vi=\\Ef:so=\\Ep:se=\\Eq:mb=\\Ei:md=\\Eg:\ +mr=\\Ep:me=\\EG:te=\\EG:us=\\Ei:ue=\\EG:\ +kb=^H:kl=\\E[D:kr=\\E[C:ku=\\E[A:kd=\\E[B:\ +k1=\\E[224z:k2=\\E[225z:k3=\\E[226z:k4=\\E[227z:k5=\\E[228z:\ +k6=\\E[229z:k7=\\E[230z:k8=\\E[231z:k9=\\E[232z:k0=\\E[233z:\ +kN=\\E[222z:kP=\\E[216z:kh=\\E[214z:kH=\\E220z:"; + +#else + +#error oops, a new operating system? + +#endif + diff --git a/packages/services/gfx/mw/current/src/demos/nanox/nxview.c b/packages/services/gfx/mw/current/src/demos/nanox/nxview.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/nxview.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2000, 2001 Greg Haerr + * + * nxview - Nano-X image viewer + * + * Autorecognizes and displays BMP, GIF, JPEG, PNG and XPM files + */ +#include +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + +int +main(int argc,char **argv) +{ + GR_IMAGE_ID image_id; + GR_WINDOW_ID window_id; + GR_GC_ID gc_id; + GR_SIZE w = -1; + GR_SIZE h = -1; + GR_EVENT event; + GR_SCREEN_INFO sinfo; + GR_IMAGE_INFO info; + char title[256]; + + if (argc < 2) { + printf("Usage: nxview [stretch]\n"); + exit(1); + } + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + if (!(image_id = GrLoadImageFromFile(argv[1], 0))) { + fprintf(stderr, "Can't load image file: %s\n", argv[1]); + exit(1); + } + + if(argc > 2) { + /* stretch to half screen size*/ + GrGetScreenInfo(&sinfo); + w = sinfo.cols/2; + h = sinfo.rows/2; + } else { + GrGetImageInfo(image_id, &info); + w = info.width; + h = info.height; + } + + sprintf(title, "nxview %s", argv[1]); + window_id = GrNewWindowEx(GR_WM_PROPS_APPWINDOW, title, + GR_ROOT_WINDOW_ID, 0, 0, w, h, BLACK); + + GrSelectEvents(window_id, + GR_EVENT_MASK_CLOSE_REQ|GR_EVENT_MASK_EXPOSURE); + + GrMapWindow(window_id); + + gc_id = GrNewGC(); + + while (1) { + GrGetNextEvent(&event); + switch(event.type) { + case GR_EVENT_TYPE_CLOSE_REQ: + GrDestroyWindow(window_id); + GrDestroyGC(gc_id); + GrFreeImage(image_id); + GrClose(); + exit(0); + /* no return*/ + case GR_EVENT_TYPE_EXPOSURE: + GrDrawImageToFit(window_id, gc_id, 0,0, w,h, image_id); + break; + } + } + + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/polytest.c b/packages/services/gfx/mw/current/src/demos/nanox/polytest.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/polytest.c @@ -0,0 +1,160 @@ +#include +#include "nano-X.h" + +void draw(GR_EVENT * e) +{ + GR_GC_ID gc; + GR_POINT points[4]; + + int x = 10; + int y = 10; + int sz = 20; + int sz2 = 5; + + gc = GrNewGC(); + + GrSetGCBackground(gc, GR_RGB(0,0,0)); + //GrSetGCMode(gc, GR_MODE_XOR); + + points[0].x = x; + points[0].y = y; + + points[1].x = x + sz; + points[1].y = y; + + points[2].x = x + (sz/2) ; + points[2].y = y + sz; + + GrSetGCForeground(gc, GR_RGB(255,255,255)); + GrFillPoly(((GR_EVENT_EXPOSURE*)e)->wid,gc,3,points); + points[3].x = x; + points[3].y = y; + GrSetGCForeground(gc,GR_RGB(0,255,0)); + GrPoly(((GR_EVENT_EXPOSURE*)e)->wid,gc,4,points); + + y += sz + 10; + + points[0].x = x; + points[0].y = y; + + points[1].x = x + sz + 1; + points[1].y = y; + + points[2].x = x + (sz/2) ; + points[2].y = y + sz; + + GrSetGCForeground(gc, GR_RGB(255,255,255)); + GrFillPoly(((GR_EVENT_EXPOSURE*)e)->wid,gc,3,points); + points[3].x = x; + points[3].y = y; + GrSetGCForeground(gc,GR_RGB(0,255,0)); + GrPoly(((GR_EVENT_EXPOSURE*)e)->wid,gc,4,points); + + y += sz + 10; + + points[0].x = x; + points[0].y = y; + + points[1].x = x + sz - 1; + points[1].y = y; + + points[2].x = x + (sz/2) ; + points[2].y = y + sz; + + GrSetGCForeground(gc, GR_RGB(255,255,255)); + GrFillPoly(((GR_EVENT_EXPOSURE*)e)->wid,gc,3,points); + points[3].x = x; + points[3].y = y; + GrSetGCForeground(gc,GR_RGB(0,255,0)); + GrPoly(((GR_EVENT_EXPOSURE*)e)->wid,gc,4,points); + + /* draw right arrow*/ + sz = 10; + sz2 = 8; + + x = 60; + y = 60; + + points[0].x = x; + points[0].y = y; + + y -= sz; + + points[1].x = x + sz2; + points[1].y = y; + + y -= sz; + + points[2].x = x; + points[2].y = y; + + GrSetGCForeground(gc, GR_RGB(255,255,255)); + GrFillPoly(((GR_EVENT_EXPOSURE*)e)->wid,gc,3,points); + + points[3].x = x; + points[3].y = 60; + + GrSetGCForeground(gc,GR_RGB(0,255,0)); + GrPoly(((GR_EVENT_EXPOSURE*)e)->wid,gc,4,points); + + GrSetGCForeground(gc,GR_RGB(255,255,255)); + + x = 60; + y = 90; + + points[0].x = x; + points[0].y = y; + + y -= sz; + + points[1].x = x + sz2; + points[1].y = y; + + y -= sz; + + points[2].x = x; + points[2].y = y; + + GrSetGCForeground(gc, GR_RGB(255,255,255)); + GrFillPoly(((GR_EVENT_EXPOSURE*)e)->wid,gc,3,points); + points[3].x = x; + points[3].y = 90; + //GrPoly(((GR_EVENT_EXPOSURE*)e)->wid,gc,4,points); + + GrDestroyGC(gc); +} + +main() +{ + GR_EVENT event; + GR_WINDOW_ID w; + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + /* create window*/ + w = GrNewWindowEx( + GR_WM_PROPS_NOAUTOMOVE|GR_WM_PROPS_BORDER|GR_WM_PROPS_CAPTION| + GR_WM_PROPS_CLOSEBOX, "POLY FILL", GR_ROOT_WINDOW_ID, + 10, 10, 100, 300, GR_RGB(0,0,0)); + // w = GrNewWindow(0,100,100,100,100,3,GR_RGB(0,0,255),GR_RGB(0,0,0)); + + GrSelectEvents(w, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ); + GrMapWindow(w); + + while (1) { + GrGetNextEvent(&event); + + switch (event.type) { + case GR_EVENT_TYPE_EXPOSURE: + draw(&event); + break; + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + } + } + +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/setselection.c b/packages/services/gfx/mw/current/src/demos/nanox/setselection.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/setselection.c @@ -0,0 +1,84 @@ +#include +#include +#include + +#include "nano-X.h" + +int main(int argc, char *argv[]) +{ + GR_WINDOW_ID wid; + GR_EVENT event; + FILE *fp; + char *buf = NULL; + int buf_size = 0; + int data_len = 0; + int ret = 0; + GR_EVENT_CLIENT_DATA_REQ *req; + GR_EVENT_SELECTION_CHANGED *sc; + + if(argc != 2) { + fprintf(stderr, "Usage: setselection \n"); + return 1; + } + + if(!(fp = fopen(argv[1], "r"))) { + fprintf(stderr, "Couldn't open text file\n"); + return 2; + } + + do { + data_len += ret; + buf_size = data_len + 65536; + if(!(buf = realloc(buf, buf_size))) { + fprintf(stderr, "Out of memory\n"); + return 3; + } + } while((ret = fread(buf + data_len, 1, 65536, fp)) > 0); + if(ret < 0) { + fprintf(stderr, "Failed to read text file sucessfully\n"); + return 2; + } + + if(GrOpen() < 0) { + fprintf(stderr, "Couldn't connect to Nano-X server\n"); + return 4; + } + + wid = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, 1, 1, 0, 0, 0); + if(!wid) { + fprintf(stderr, "Couldn't get a window\n"); + return 5; + } + + GrSelectEvents(wid, GR_EVENT_MASK_CLIENT_DATA_REQ | + GR_EVENT_MASK_SELECTION_CHANGED); + + GrSetSelectionOwner(wid, "nota/realtype text/plain non/existant " + "something/else"); + + while(1) { + GrGetNextEvent(&event); + switch(event.type) { + case GR_EVENT_TYPE_CLIENT_DATA_REQ: + req = &event.clientdatareq; + fprintf(stderr, "Got request with serial " + "number %ld from window %d for mime " + "type %d\n", req->serial, req->rid, + req->mimetype); + GrSendClientData(wid, req->rid, req->serial, + data_len, data_len, buf); + break; + case GR_EVENT_TYPE_SELECTION_CHANGED: + sc = &event.selectionchanged; + if(sc->new_owner != wid) { + fprintf(stderr, "Lost selection to " + "window %d\n", sc->new_owner); + return 0; + } + default: + break; + } + } + + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/slidebmp.bmp b/packages/services/gfx/mw/current/src/demos/nanox/slidebmp.bmp new file mode 100644 index 0000000000000000000000000000000000000000..f311f40f777dd950acb5b9276519e68b112a030d GIT binary patch literal 41194 zc$}@h*?Qa9(j>Y75C8#A5=DU&2T_tKTb3nSwuX}Js`9SdyLgx34 z^!dJelJgREG9q$;l&k*JH_b_$xdNFP8JTMV`uSh~-~SnS`oEG8uI%ssW7q#>*CcfL z{QvmBLm2mT{qI57`}_Ow+i$;xUw{3T@A=LC-rxU%7s5Rs|AxDGr@hDS<5^sO`NckG zpZVpt@H;+l_kXp&zwrBhxA*=Me*MMn+h4rxw_oj(_TFFZbNBYVJsp0*cknO1``*6i zcYDo#-+t$}-+!|ovA_0O_~m!}V89T6`4!*st9|Cz@VmX|7yC|o(%z5v*z@=J&R^^) ze9!LzAO8*CX|MeXO!i&B+k1bp*M0>qVEPr`7Xoj7#rN3jzu-Ogn>N5-xSeb)9ITDi ze&ct0-*0$tz6RCqI_dtYySv-7OUG_|9Xs=J2TvqvVt+^J zxQEYnj_{FgI_~uBGO~L|_V#og@_h4o^ZEYZ&4HcX9NZs#-ah#kKP}V$p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~Y0+C(lTi3&gLG@U^m+RHqpvSxO6;T1ZL%EQQabBYj9Z9VA8oY=FK#teB z1!K#i)h&FGBWNBlcBUFjF+1k^CQkfDYJl3ZD2hEA2vG_ms-=^io9Xl2TL726-W>%5GKw;-CO92L|7}6I` zD_*0Lei`)rJy2oSU~IeDzMkdUN4auCx!K~}WXvgT(}>~X@gEnDs hZp&Z1Ckh%qRr|osgRA}4k0yHq|0X*At + * + * This program is licensed under the same terms that Microwindows + * and Nano-X are licensed under. See the file LICENSE accompanying + * this distribution. + */ + +#include +#include +#include +#include + +#define MWINCLUDECOLORS +#include "nano-X.h" + +/* set up size of the grid */ +#define WIDTH_IN_TILES 4 +#define HEIGHT_IN_TILES 4 +#define MAX_TILES (WIDTH_IN_TILES * HEIGHT_IN_TILES) +#define USE_IMAGE 1 + +static int value[WIDTH_IN_TILES][HEIGHT_IN_TILES]; +static int calc_width, calc_height; +static int tile_width = 40; +static int tile_height = 40; + +#if USE_IMAGE +static void * image_addr; +static int using_image = 1; +static GR_WINDOW_ID image; /* storage area for image */ +#endif + +static GR_WINDOW_ID master; /* id for whole window */ +static GR_WINDOW_ID buttons; /* id for buttons */ +static GR_WINDOW_ID tiles; /* id for play area */ +static GR_GC_ID gc1; /* graphics context for text */ + +static int value[WIDTH_IN_TILES][HEIGHT_IN_TILES]; + +/* function prototypes */ +static void HandleEvents(); +static void RefreshWindow(); +static void RandomiseTiles(); +static void MoveTile(); +static void DrawTile(); + +int +main(int argc,char **argv) +{ + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + gc1 = GrNewGC(); + +#if USE_IMAGE + image = GrNewWindow(GR_ROOT_WINDOW_ID, 300, 0, (WIDTH_IN_TILES * tile_width), + (HEIGHT_IN_TILES * tile_height), 4, BLACK, WHITE); + + if(argc != 2) + /* No image specified, use numered tiles */ + using_image = 0; + else { + /* need to find out image size.... */ + image_addr = malloc(4 * (WIDTH_IN_TILES * tile_width) * + (HEIGHT_IN_TILES * tile_height) ); + + image = GrNewPixmap((WIDTH_IN_TILES * tile_width), + (HEIGHT_IN_TILES * tile_height), image_addr); + + GrDrawImageFromFile(image, gc1, 0, 0, + GR_IMAGE_MAX_SIZE, GR_IMAGE_MAX_SIZE, argv[1], 0); + } +#endif + + /* calculate size of tile area */ + calc_width = 10 + (WIDTH_IN_TILES * tile_width); + calc_height = 15 + 35 + (HEIGHT_IN_TILES * tile_height); +#if 0 + /* enforce minimum size */ + if (calc_width < 240) calc_width=240; + if (calc_height < 320) calc_height=320; +#endif + master = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, calc_width, calc_height, 1, RED, WHITE); + buttons = GrNewWindow((GR_WINDOW_ID) master, 5, 5, (calc_width - 5), 35, 1, RED, RED); + + tiles = GrNewWindow((GR_WINDOW_ID) master, (calc_width/2) - (WIDTH_IN_TILES * tile_width /2), + 45 + ((calc_height - 50)/2) - (HEIGHT_IN_TILES * tile_height /2), + (WIDTH_IN_TILES * tile_width), (HEIGHT_IN_TILES * tile_height), 1, RED, RED); + + GrMapWindow(master); + GrMapWindow(buttons); + GrMapWindow(tiles); + + /* set random seed */ + srandom((int) getpid()); + + RandomiseTiles(); + + GrSelectEvents(master, GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(buttons, GR_EVENT_MASK_BUTTON_DOWN); + GrSelectEvents(tiles, GR_EVENT_MASK_BUTTON_DOWN); + + RefreshWindow(); + + while (GR_TRUE) { + GR_EVENT event; + + GrGetNextEvent(&event); + HandleEvents(&event); + } +} + + +/* + * Read the next event and handle it. + */ +void +HandleEvents(GR_EVENT *ep) +{ + switch (ep->type) { + case GR_EVENT_TYPE_BUTTON_DOWN: + if (ep->button.wid == buttons) { + if (ep->button.x < (calc_width/2)) { + /* 'Again' */ + RandomiseTiles(); + RefreshWindow(); + } else { + /* 'Quit' */ + GrClose(); +#if USE_IMAGE + if (using_image) + free(image_addr); +#endif + exit(0); + } + } + + if (ep->button.wid == tiles) { + /* Try to move selected tile */ + MoveTile( (int)(ep->button.x / tile_width), + (int)(ep->button.y / tile_height) ); + } + break; + + case GR_EVENT_TYPE_EXPOSURE: + RefreshWindow(); + break; + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + } + +} + +void +RefreshWindow() +{ + int xpos, ypos; + + GrSetGCForeground(gc1, WHITE); + GrSetGCBackground(gc1, RED); + + /* draw the buttons */ + GrRect(buttons, gc1, 0, 0, (calc_width - 12)/2, 34); + GrRect(buttons, gc1, (calc_width - 8)/2, 0, (calc_width - 12)/2, 34); + +#if 0 /* for when center align text works */ + GrText(buttons, gc1, (calc_width - 10)/4, 22, "Again", 5, 0); + GrText(buttons, gc1, (calc_width - 10)*3/4, 22, "Quit", 4, 0); +#else + GrText(buttons, gc1, 5, 22, "Again", 5, 0); + GrText(buttons, gc1, (calc_width / 2) + 5, 22, "Quit", 4, 0); +#endif + + /* draw the tiles */ + for (ypos=0; ypos< HEIGHT_IN_TILES; ypos++){ + for (xpos=0; xpos< WIDTH_IN_TILES; xpos++){ + DrawTile(xpos, ypos); + } + } +} + +void +RandomiseTiles() +{ + int count, xpos, ypos; + + /* allocate all the numbers in order 1..MAX_TILES */ + for (ypos=0; ypos< HEIGHT_IN_TILES; ypos++){ + for (xpos=0; xpos< WIDTH_IN_TILES; xpos++){ + value[xpos][ypos] = 1 + xpos + (WIDTH_IN_TILES * ypos); + } + } + + /* position of 'hole' */ + xpos = WIDTH_IN_TILES - 1; + ypos = HEIGHT_IN_TILES - 1; + + /* randomly slide them around, ALL games can therefore solved - so no excusses!! */ + for (count=0; count< MAX_TILES * 1000; count++){ + switch(random() % 4) { + case 0: + if (ypos < HEIGHT_IN_TILES - 1) { + value[xpos][ypos] = value[xpos][ypos+1]; + ypos++; + value[xpos][ypos] = MAX_TILES; + } + break; + case 1: + if (xpos > 0) { + value[xpos][ypos] = value[xpos - 1][ypos]; + xpos--; + value[xpos][ypos] = MAX_TILES; + } + break; + case 2: + if (ypos > 0) { + value[xpos][ypos] = value[xpos][ypos - 1]; + ypos--; + value[xpos][ypos] = MAX_TILES; + } + break; + case 3: + if (xpos < WIDTH_IN_TILES - 1) { + value[xpos][ypos] = value[xpos + 1][ypos]; + xpos++; + value[xpos][ypos] = MAX_TILES; + } + break; + } + } +} + +void +MoveTile(xpos, ypos) + int xpos, ypos; +{ + /* check all possible moves to see if there is the blank (N,E,S,W) */ + if (ypos > 0 && value[xpos][ypos - 1] == MAX_TILES) { + value[xpos][ypos - 1] = value[xpos][ypos]; + value[xpos][ypos] = MAX_TILES; + DrawTile(xpos, ypos - 1); + DrawTile(xpos, ypos); + } + + if (xpos < (WIDTH_IN_TILES - 1) && value[xpos + 1][ypos] == MAX_TILES) { + value[xpos + 1][ypos] = value[xpos][ypos]; + value[xpos][ypos] = MAX_TILES; + DrawTile(xpos + 1, ypos); + DrawTile(xpos, ypos); + } + + if (ypos < (HEIGHT_IN_TILES - 1) && value[xpos][ypos + 1] == MAX_TILES) { + value[xpos][ypos + 1] = value[xpos][ypos]; + value[xpos][ypos] = MAX_TILES; + DrawTile(xpos, ypos + 1); + DrawTile(xpos, ypos); + } + + if (xpos > 0 && value[xpos - 1][ypos] == MAX_TILES) { + value[xpos - 1][ypos] = value[xpos][ypos]; + value[xpos][ypos] = MAX_TILES; + DrawTile(xpos - 1, ypos); + DrawTile(xpos, ypos); + } + + /* check for a winner */ + if (value[WIDTH_IN_TILES - 1][HEIGHT_IN_TILES - 1] == MAX_TILES) { + int winner = 0; + for (ypos=0; ypos< HEIGHT_IN_TILES; ypos++){ + for (xpos=0; xpos< WIDTH_IN_TILES; xpos++){ + if (value[xpos][ypos] == winner + 1) + winner++; + else + winner=0; + } + } + if (winner == MAX_TILES) { + /* Do winning screen */ + int loop = MAX_TILES; + for(loop=0; loop < MAX_TILES; loop++) { + for(winner=0; winner < (MAX_TILES - loop) ; winner++) { + + /* move tiles around */ + xpos = winner % WIDTH_IN_TILES; + ypos = (int)(winner/WIDTH_IN_TILES); + value[xpos][ypos] = loop + winner + 1; + DrawTile(winner % WIDTH_IN_TILES, (int)(winner/WIDTH_IN_TILES)); + } + GrFlush(); + for(winner=0; winner < 10000000 ; winner++); + /* delay loop */ + } + /* Print message */ + GrSetGCForeground(gc1, WHITE); + GrSetGCBackground(gc1, RED); + GrText(tiles, gc1, ((WIDTH_IN_TILES * tile_width)/2) - 40, (HEIGHT_IN_TILES * tile_height)/2, "Well Done!!", -1, 0); + } + + } +} + + +void +DrawTile(xpos, ypos) + int xpos, ypos; +{ + char text[]="00"; + + /* blank out old tile */ + GrSetGCForeground(gc1, RED); + GrFillRect(tiles, gc1, (xpos* tile_width), (ypos*tile_height), tile_width, tile_height); + + if (value[xpos][ypos] != MAX_TILES ) { + /* re-draw tile and number */ + GrSetGCForeground(gc1, WHITE); + GrSetGCBackground(gc1, RED); + GrRect(tiles, gc1, (xpos*tile_width), (ypos*tile_height), tile_width, tile_height); + +#if USE_IMAGE + if (using_image) { + /* copy from image window */ + GrCopyArea(tiles, gc1, 1 + (xpos*tile_width), 1 + (ypos*tile_height), + tile_width - 2, tile_height - 2, image, + 1 + (((value[xpos][ypos] - 1) % WIDTH_IN_TILES) * tile_width), + 1 + (((int)(value[xpos][ypos] - 1) / WIDTH_IN_TILES) * tile_height), 0); + } else { +#endif + /* label the tile with a number */ + if (value[xpos][ypos] > 9) + text[0] = 48 + (int)(value[xpos][ypos]/10); + else + text[0] = 32; + + text[1] = 48 + value[xpos][ypos] % 10; + + GrText(tiles, gc1, (xpos*tile_width) + (tile_width /2) - 5, (ypos*tile_height) + (tile_height/2) + 5, &text, -1, 0); +#if USE_IMAGE + } +#endif + } +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/t1demo.c b/packages/services/gfx/mw/current/src/demos/nanox/t1demo.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/t1demo.c @@ -0,0 +1,191 @@ +/* + * font demo for Nano-X + * also includes region clipping demo + */ +#include +#include +#if UNIX | DOS_DJGPP +#include +#endif +#define MWINCLUDECOLORS +#include "nano-X.h" + +#define MAXW (630-50) +#define MAXH (470-50) + +#define CLIP_POLYGON 0 /* =1 for polygonal region test*/ + +#if HAVE_HZK_SUPPORT +#define BIG5 + +#define MAXFONTS 1 +#ifndef BIG5 +#define FONT1 "HZKFONT" +#define FONT2 "HZKFONT" +#define FONT3 "HZKFONT" +#define FONT4 "HZKFONT" +#define FONT5 "HZKFONT" +#else +#define FONT1 "HZXFONT" +#define FONT2 "HZXFONT" +#define FONT3 "HZXFONT" +#define FONT4 "HZXFONT" +#define FONT5 "HZXFONT" +#endif +#elif HAVE_T1LIB_SUPPORT +#define MAXFONTS 5 +#define FONT1 "bchr" +#define FONT2 "bchb" +#define FONT3 "dcr10" +#define FONT4 "dcbx10" +#define FONT5 "bchri" +#else +/* truetype*/ +#define MAXFONTS 5 +#define FONT1 "lt1-r-omega-serif" +#define FONT2 "arial" +#define FONT3 "times" +#define FONT4 "cour" +#define FONT5 "timesi" +#endif + +static char * names[5] = { FONT1, FONT2, FONT3, FONT4, FONT5 }; + +int main() +{ + GR_WINDOW_ID window; + GR_EVENT event; + GR_GC_ID gc; + GR_FONT_ID fontid; + int i, x, y; + GR_REGION_ID regionid = 0; +#if CLIP_POLYGON + GR_POINT points[]={ {100, 100}, + {300, 100}, + {300, 300}, + {100, 300}}; +#else + GR_RECT clip_rect={100,100,300,300}; +#endif + + srand(time(0)); + + GrOpen(); + window = GrNewWindow(GR_ROOT_WINDOW_ID, 50,50, MAXW,MAXH, 4, BLACK,BLUE); + GrMapWindow(window); + + gc = GrNewGC(); + +#if CLIP_POLYGON + /* polygon clip region*/ + regionid = GrNewPolygonRegion(MWPOLY_EVENODD, 3, points); +#else + /* rectangle clip region*/ + regionid = GrNewRegion(); + GrUnionRectWithRegion(regionid, &clip_rect); +#endif + + GrSetGCRegion(gc, regionid); + + GrSelectEvents(window,GR_EVENT_MASK_ALL); + GrSetGCUseBackground(gc,GR_FALSE); + GrSetGCBackground(gc, GR_RGB(0, 0, 0)); + while(1) { + GrCheckNextEvent(&event); + + i = (int)((float)MAXFONTS * rand() / (RAND_MAX + 1.0)); + fontid = GrCreateFont(names[i], 20, NULL); + GrSetFontSize(fontid, 1+(int)(80.0 * rand() / (RAND_MAX+1.0))); + GrSetFontRotation(fontid, 330); /* 33 degrees*/ + GrSetFontAttr(fontid, GR_TFKERNING | GR_TFANTIALIAS, 0); + GrSetGCFont(gc, fontid); + /*GrSetGCBackground(gc, rand() & 0xffffff);*/ + GrSetGCForeground(gc, rand() & 0xffffff); + x = (int) ((MAXW * 1.0) *rand()/(RAND_MAX+1.0)); + y = (int) ((MAXH * 1.0) *rand()/(RAND_MAX+1.0)); + +#if HAVE_HZK_SUPPORT + { /* to test Unicode 16 chinese characters display ,use HZK font Bitmap font (Metrix font). */ +#ifndef BIG5 + char buffer[256]; + buffer[0]=0x6c; + buffer[1]=0x49; + buffer[2]=0x73; + buffer[3]=0x8b; + buffer[4]=0x79; + buffer[5]=0xd1; + buffer[6]=0x62; + buffer[7]=0x80; + buffer[8]=0x61; + buffer[9]=0x00; + buffer[10]=0x41; + buffer[11]=0x00; + + buffer[12]=0x00; + buffer[13]=0xa1; + buffer[14]=0x00; + buffer[15]=0xa6; + buffer[16]=0x6c; + buffer[17]=0x49; + buffer[18]=0x0; + buffer[19]=0x0; + GrText(window, gc,x,y+20, buffer,17, GR_TFUC16); + x=0;y=16; + GrText(window, gc,x,y+20, buffer,17, GR_TFUC16); +#else + unsigned short buffer[7]; + buffer[0]=0x9060; + buffer[1]=0x898b; + buffer[2]=0x79d1; + buffer[3]=0x6280; + buffer[4]=0x0061; + buffer[5]=0x0041; + buffer[6]=0x0; + GrText(window, gc,x,y+20, buffer,7, GR_TFUC16); + x=0;y=16; + GrText(window, gc,x,y+20, buffer,7, GR_TFUC16); +#endif + } + +#ifndef BIG5 + x=0;y=16; + /* HZK Metrix font test, includes Chinese and English*/ + GrText(window, gc,x,y, "Microwindows,»¶Ó­Ê¹ÓÃÖÐÓ¢ÎĵãÕó×ÖÌå", + -1, GR_TFASCII); +#else + GrText(window, gc,x,y, "Microwindows,Åwªï¨Ï¥Î¤¤­^¤åÂI°}¦rÅé", + -1, GR_TFASCII); + x=0;y=16*3+4; + GrText(window, gc,x,y, "£t£u£v£w£¸£¹£º", -1, GR_TFASCII); +#endif + GrFlush(); + +#else /* !HZK_FONT_SUPPORT*/ + +#if HAVE_BIG5_SUPPORT + /* ENCODING_BIG5 test*/ + GrText(window, gc,x,y, "±d±d", -1, GR_TFASCII); +#else +#if HAVE_GB2312_SUPPORT + /* ENCODING_GB2312 test*/ + GrText(window, gc,x,y, "\275\241\275\241", -1, GR_TFASCII); +#else + /* ASCII test*/ + GrText(window, gc,x,y, "Microwindows", -1, GR_TFASCII); +#endif +#endif + +#endif /* HZK_FONT_SUPPORT*/ + + + GrDestroyFont(fontid); + + if(event.type == GR_EVENT_TYPE_CLOSE_REQ) { + GrClose(); + exit(0); + } + } + + GrDestroyRegion(regionid); + GrClose(); +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/test.pbm b/packages/services/gfx/mw/current/src/demos/nanox/test.pbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/test.pbm @@ -0,0 +1,14 @@ +P1 +# A Space Invader +14 10 + +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 1 1 1 1 0 0 0 0 0 +0 0 1 1 1 1 1 1 1 1 1 1 0 0 +0 1 1 1 1 1 1 1 1 1 1 1 1 0 +0 1 1 1 0 0 1 1 0 0 1 1 1 0 +0 1 1 1 1 1 1 1 1 1 1 1 1 0 +0 0 0 0 1 1 0 0 1 1 0 0 0 0 +0 0 0 1 1 0 1 1 0 1 1 0 0 0 +0 1 1 0 0 0 0 0 0 0 0 1 1 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/packages/services/gfx/mw/current/src/demos/nanox/tux.gif b/packages/services/gfx/mw/current/src/demos/nanox/tux.gif new file mode 100644 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yVS7)$QVT^Kuq!@m~QEGUoC8vT5l_@KGbDY)i{ zr)MrJ_H=GV!G`tpR+~$dPEffeMcL%Dh7wF}I9s6Ae)f(pi}yOWx8h1T@YUB~<*DD= z$CrM#PL~qi>2yG59dR}Q7v3Gl3ZCzCH@ayf^P?!OIOXZ#=Or(~qH2F^Ynzp4z+L?g zusm`%tY3A3cO$CX($pzl9^f(xJVDytx&p#|PeVb-+Iq*Yl6&x{z280=nW)U_ZuBMm zsi^ZE(?7@0CJ!qLvfTp@AG=c2sP=D(`9+k*|MxTC1C}JrN8&|&iQZQg{ZUq{3nSC{ z6XJf$sY7lz7xx~+8l+S7(A%Ro2gK_S+$=dAa@*)uVaIl>MK?TGcT{cGJEl#Tt-~Vop zrlxo;Ez3LV-Raj2O(*!Q-clRzerT933<>$E1T3UjGh{txfB2Rt1t55B}X_d!c67PCC&UuM)VS8#Vt{Fdsj?5$5~HO*_< zHiPGPsV1y{{7bj=Wx6^cme@YV*qWBbn+&FHEz6HLgPDA$aF1tY@=Wd#kAQzXxH^z2 zEB0BGy#+pZ+Ss&Ws`&H=X+n5c&kx`4k2$xkdi}i-+I;i2)Evw?UA6tRM_5b9$-(De z6e(#9Oc->C*uIwzo@Ypx-l|@l!ZW#VZ<+mNdWq{zB%YMSiPR;^-eYx>%D~_B1zdjz<$O%x{Gpc8)5yY!1V_?-2)H3 z{-kwL#p;+45mz%w$^P zR5Lw(!bd?y1@7k1CmSVPDF$X(0ChVx>oy diff --git a/packages/services/gfx/mw/current/src/demos/nanox/wait.c b/packages/services/gfx/mw/current/src/demos/nanox/wait.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/wait.c @@ -0,0 +1,13 @@ +/* + * Connect to the server, then wait until terminated (useful for stopping the server + * from exiting without a window manager) + */ + +#include "nano-X.h" + +int main() +{ + char c; + read(GrOpen(), &c, 1); + return 0; +} diff --git a/packages/services/gfx/mw/current/src/demos/nanox/world.c b/packages/services/gfx/mw/current/src/demos/nanox/world.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nanox/world.c @@ -0,0 +1,654 @@ +/* + * Draw a crude map of the world using mini-X graphics on MINIX. + * Converted from an Amiga program by Mike Groshart and Bob Dufford. + * Author: David I. Bell + * + * ported to 16 bit systems by Greg Haerr + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + +#if defined(MSDOS) || defined(__ECOS) +#include +#endif + +#if LINUX | DOS_DJGPP +#include +#include +#include +#include +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +#if defined(DOS_DJGPP) || defined(__ECOS) +#define MAPFILE "world.map" +#else +#define MAPFILE "demos/nanox/world.map" /* was /usr/lib*/ +#endif + +#define SELECTBUTTON GR_BUTTON_L +#define COORDBUTTON GR_BUTTON_R + + +/* + * Definitions to use fixed point in place of true floating point. + */ +typedef long FLOAT; + +#define SCALE 100 /* fixed point scaling factor */ + +#define FFMUL(a,b) (((FLOAT)(a) * (b) + (SCALE / 2)) / SCALE) +#define FFDIV(a,b) (((FLOAT)(a) * SCALE) / (b)) +#define FIMUL(a,b) ((FLOAT)(a) * (b)) +#define FIDIV(a,b) ((FLOAT)(a) / (b)) +#define ITOF(a) ((FLOAT)(a) * SCALE) +#define FTOI(a) (((FLOAT)(a) + (SCALE / 2)) / SCALE) + + +#define QSPAN (90L*60*SCALE) /* equator to pole (90 degrees) */ +#define HSPAN (QSPAN*2) /* pole to pole (180 degrees) */ +#define WSPAN (QSPAN*4) /* around equator (360 degrees) */ + +#define ABS(n) (((n) < 0) ? -(n) : (n)) + + +/* + * Structure of a point in the database file. + */ +typedef struct { + short Code; /* type of point (see code_colors below) */ + short Lat; /* latitude in minutes */ + short Lon; /* longitude in minutes */ +} MWPACKED DBPOINT; + +#if BIGENDIAN +#define SHORT_SWAP(p) (p = ((p & 0xff) << 8) | ((p >> 8) & 0xff)) +#define DBPOINT_CONVERT(p) (SHORT_SWAP(p->Code),SHORT_SWAP(p->Lat),SHORT_SWAP(p->Lon)) +#else +#define DBPOINT_CONVERT(p) ((void)p) +#endif + +#define POINTSize sizeof(DBPOINT) +#define PCount 128 /* number of points to read at once */ + + +/* + * The following variables are the scaling factors to be used when drawing + * points. However, they are larger than the true value by a factor of 60. + * This is done because without real floating point, their true values are + * too small to be accurate enough. I cannot just increase the fixed point + * precision because that causes overflows. What a pain! + */ +static FLOAT X_Scale; +static FLOAT Y_Scale; + +/* + * Other variables. + */ +static FLOAT Latitude, Longitude; /* current center of view */ +static FLOAT zoom; /* current zoom scaling factor */ + +static FLOAT latradius; /* half of view of latitide */ +static FLOAT longradius; /* half of view of longitude */ +static FLOAT viewlong; /* amount of longitide in view */ +static FLOAT viewlat; /* amount of latitude in view */ + +static GR_SIZE mapwidth; /* width of map in pixels */ +static GR_SIZE mapheight; /* height of map in pixels */ +static GR_COORD mapxorig; /* one half of map width */ +static GR_COORD mapyorig; /* one half of map height */ +static GR_COORD selectx; /* x position of current selection */ +static GR_COORD selecty; /* y position of current selection */ +static GR_COORD selectptrx; /* x position of pointer in selection */ +static GR_COORD selectptry; /* y position of pointer in selection */ +static GR_SIZE selectwidth; /* width of current selection */ +static GR_SIZE selectheight; /* height of current selection */ +static int selectmode; /* selection mode */ +static GR_BOOL selectvisible; /* TRUE if selection is visible on screen */ +static GR_SIZE selectxscale; /* x scaling factor for selection rectangle */ +static GR_SIZE selectyscale; /* y scaling factor for selection rectangle */ +static GR_BOOL coordvisible; /* TRUE if coordinates are visible on screen */ +static GR_BOOL coordenabled; /* TRUE if coordinate display is enabled */ +static GR_COORD coordx; /* x position of coordinates */ +static GR_COORD coordy; /* y position of coordinates */ +static GR_COORD ptrx; /* latest x position of pointer */ +static GR_COORD ptry; /* latest y position of pointer */ +static char coordstring[32]; /* coordinate string */ + +static GR_WINDOW_ID mainwid; /* main window id */ +static GR_WINDOW_ID mapwid; /* window id for map */ +static GR_GC_ID mapgc; /* GC used for drawing map */ +static GR_GC_ID xorgc; /* GC used for rubber banding */ +static GR_SIZE COLS, ROWS; + + +/* + * Current selection mode + */ +#define SELECT_NONE 0 +#define SELECT_SCALE 1 +#define SELECT_MOVE 2 + +/* + * Order of color table (indexed by type of point): + * unused + * continents + * countries + * unused + * USA states + * islands + * lakes + * rivers + */ +static GR_COLOR code_colors[] = { + BLACK, GREEN, RED, BLACK, BROWN, GREEN, BLUE, BLUE +}; + + +static void load(); +static void setzoom(); +static void checkevent(); +static void doexposure(); +static void dobuttondown(); +static void dobuttonup(); +static void doposition(); +static void dokeydown(); +static void showselection(); +static void showcoords(); +static void mintostr(); + + +#ifdef __ECOS +int +world_main(int argc, char **argv) +#else +int +main(int argc, char **argv) +#endif +{ + GR_SCREEN_INFO si; + GR_WM_PROPERTIES props; + + if (GrOpen() < 0) { + fprintf(stderr, "Cannot open graphics\n"); + exit(1); + } + + GrReqShmCmds(65536); /* Test by Morten Rolland for shm support */ + + GrGetScreenInfo(&si); +#ifdef __ECOS +/* 240x320 screen*/ +COLS = si.cols - 10; +ROWS = si.rows - 40; +#else +COLS = si.cols - 40; +ROWS = si.rows - 80; +#endif + + mainwid = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, COLS, ROWS, + 0, BLACK, BLACK); + + /* set title */ + props.flags = GR_WM_FLAGS_TITLE | GR_WM_FLAGS_PROPS; + props.props = GR_WM_PROPS_BORDER | GR_WM_PROPS_CAPTION; + props.title = "NanoX World Map"; + GrSetWMProperties(mainwid, &props); + + mapwidth = COLS - 2; + mapheight = ROWS - 2; + mapxorig = mapwidth / 2; + mapyorig = mapheight / 2; + selectxscale = 4; + selectyscale = 3; + coordx = 0; + coordy = ROWS - 1; + mapwid = GrNewWindow(mainwid, 1, 1, mapwidth, mapheight, +#if 0 + 1, BLACK, WHITE); +#else + 1, LTGRAY, BLACK); +#endif + GrSelectEvents(mainwid, GR_EVENT_MASK_CLOSE_REQ); + GrSelectEvents(mapwid, GR_EVENT_MASK_EXPOSURE | + GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP | + GR_EVENT_MASK_MOUSE_POSITION | GR_EVENT_MASK_KEY_DOWN); + + GrMapWindow(mainwid); + GrMapWindow(mapwid); + + mapgc = GrNewGC(); + xorgc = GrNewGC(); + GrSetGCMode(xorgc, GR_MODE_XOR); + + Longitude = ITOF(0); + Latitude = ITOF(0); + setzoom(ITOF(1)); + + while (1) + checkevent(); +} + + +static void +checkevent() +{ + GR_EVENT event; + + GrGetNextEvent(&event); + switch (event.type) { + case GR_EVENT_TYPE_EXPOSURE: + doexposure(&event.exposure); + break; + case GR_EVENT_TYPE_BUTTON_DOWN: + dobuttondown(&event.button); + break; + case GR_EVENT_TYPE_BUTTON_UP: + dobuttonup(&event.button); + break; + case GR_EVENT_TYPE_MOUSE_POSITION: + doposition(&event.mouse); + break; + case GR_EVENT_TYPE_KEY_DOWN: + dokeydown(&event.keystroke); + break; + case GR_EVENT_TYPE_CLOSE_REQ: + GrClose(); + exit(0); + } +} + + +static void +doexposure(ep) + GR_EVENT_EXPOSURE *ep; +{ + if (ep->wid != mapwid) + return; + + /* removed: helps with blink with nanowm*/ + /*GrClearWindow(mapwid, GR_FALSE);*/ + selectvisible = GR_FALSE; + coordvisible = GR_FALSE; + load(MAPFILE); + showselection(GR_TRUE); + showcoords(GR_TRUE); +} + + +static void +dobuttondown(bp) + GR_EVENT_BUTTON *bp; +{ + if (bp->wid != mapwid) + return; + + if (bp->changebuttons & SELECTBUTTON) { + showselection(GR_FALSE); + selectx = bp->x; + selecty = bp->y; + selectptrx = bp->x; + selectptry = bp->y; + selectwidth = 0; + selectheight = 0; + selectmode = SELECT_SCALE; + showselection(GR_TRUE); + } + + if (bp->changebuttons & COORDBUTTON) { + showcoords(GR_FALSE); + ptrx = bp->x; + ptry = bp->y; + coordenabled = GR_TRUE; + showcoords(GR_TRUE); + } +} + + +static void +dobuttonup(bp) + GR_EVENT_BUTTON *bp; +{ + if (bp->wid != mapwid) + return; + + if (bp->changebuttons & COORDBUTTON) { + showcoords(GR_FALSE); + coordenabled = GR_FALSE; + } + + if (bp->changebuttons & SELECTBUTTON) { + showselection(GR_FALSE); + if (selectmode == SELECT_NONE) + return; + selectmode = SELECT_NONE; + if (selectwidth <= 0) + return; + Longitude += + FIDIV(FIMUL(viewlong, selectx - mapxorig), mapwidth); + Latitude -= + FIDIV(FIMUL(viewlat, selecty - mapyorig), mapheight); + setzoom(FIDIV(FIMUL(zoom, mapwidth), selectwidth)); + GrClearWindow(mapwid, GR_TRUE); + } +} + + +static void +doposition(mp) + GR_EVENT_MOUSE *mp; +{ + GR_SIZE temp; + + if (mp->wid != mapwid) + return; + + if (coordenabled) { + showcoords(GR_FALSE); + ptrx = mp->x; + ptry = mp->y; + showcoords(GR_TRUE); + } + + showselection(GR_FALSE); + switch (selectmode) { + case SELECT_SCALE: + selectwidth = ABS(mp->x - selectx) * 2 + 1; + selectheight = ABS(mp->y - selecty) * 2 + 1; + temp = ((long) selectwidth) * selectyscale + / selectxscale; + if (selectheight < temp) + selectheight = temp; + temp = ((long) selectheight) * selectxscale + / selectyscale; + if (selectwidth < temp) + selectwidth = temp; + break; + + case SELECT_MOVE: + selectx += (mp->x - selectptrx); + selecty += (mp->y - selectptry); + break; + } + + selectptrx = mp->x; + selectptry = mp->y; + showselection(GR_TRUE); +} + + +static void +dokeydown(kp) + GR_EVENT_KEYSTROKE *kp; +{ + if (kp->wid != mapwid) + return; + + if (selectmode != SELECT_NONE) { + switch (kp->ch) { + case 's': /* scale selection */ + selectmode = SELECT_SCALE; + break; + + case 'm': /* move selection */ + selectmode = SELECT_MOVE; + break; + + case '\033': /* cancel selection */ + showselection(GR_FALSE); + selectmode = SELECT_NONE; + break; + } + return; + } + + switch (kp->ch) { + case 'q': /* quit */ + case 'Q': + GrClose(); + exit(0); + + case 't': /* redraw total map */ + Longitude = ITOF(0); + Latitude = ITOF(0); + setzoom(ITOF(1)); + GrClearWindow(mapwid, GR_TRUE); + } +} + + +/* + * Draw or erase the current selection if any is defined. + * The selection is a rectangle centered on a specified point, and with a + * specified width and height. Drawing and erasing the selection are the + * same drawing operation because of the XOR operation. + */ +static void +showselection(show) + GR_BOOL show; /* TRUE if show the selection */ +{ + if ((show == 0) == (selectvisible == 0)) + return; + if (selectmode == SELECT_NONE) + return; + GrRect(mapwid, xorgc, selectx - selectwidth / 2, + selecty - selectheight / 2, selectwidth, selectheight); + selectvisible = show; +} + + +/* + * Draw or erase the coordinate string of the current pointer position. + * Both of these are the same operation because of the XOR operation. + */ +static void +showcoords(show) + GR_BOOL show; /* TRUE if show the coordinates */ +{ + long curlong; + long curlat; + FLOAT ptrlat; + FLOAT ptrlong; + + if (((show == 0) == (coordvisible == 0)) || !coordenabled) + return; + + if (show) { + ptrlat = FIDIV(FIMUL(viewlat, ptry), mapheight - 1); + ptrlong = FIDIV(FIMUL(viewlong, ptrx), mapwidth - 1); + + curlat = FTOI(Latitude + latradius - ptrlat); + curlong = FTOI(Longitude - longradius + ptrlong); + + if (curlong > 180*60) + curlong -= 360*60; + if (curlong < -180*60) + curlong += 360*60; + + mintostr(coordstring, curlong); + strcat(coordstring, " "); + mintostr(coordstring + strlen(coordstring), curlat); + } + + GrText(mapwid, xorgc, coordx, coordy, coordstring, -1, GR_TFBOTTOM); + coordvisible = show; +} + + +/* + * Convert minutes to a string of the form "ddd'mm" and store it + * into the indicated buffer. + */ +static void +mintostr(buf, minutes) + char *buf; + long minutes; +{ + if (minutes < 0) { + minutes = -minutes; + *buf++ = '-'; + } + sprintf(buf, "%ld'%02ld", (long)(minutes / 60), (long)(minutes % 60)); +} + + +#if 0 +/* + * Convert "ddd'mm" to mins + */ +static long +degtomin(s) + char *s; +{ + int deg, minutes; + char str[10],*strchr(),*cp; + + strcpy(str,s); + if (cp = strchr(str,'\047')) { + *cp = '\0'; + minutes = atoi(++cp); + } else + minutes = 0; + if ((deg = atoi(str)) < 0) + minutes = -minutes; + return(deg * 60 + minutes); +} +#endif + + +/* + * Set the scale factors for the given zoom factor. + * The factors 3 and 4 are here to compensate for the screen aspect ratio. + */ +static void +setzoom(newzoom) + FLOAT newzoom; +{ + zoom = newzoom; + + Y_Scale = FIDIV(FIMUL(zoom, mapheight * 3), 180 * 4); + X_Scale = FIDIV(FIMUL(zoom, mapwidth), 360); + + viewlong = FFDIV(WSPAN, zoom); + viewlat = FFDIV(HSPAN * 4 / 3, zoom); + longradius = FIDIV(viewlong, 2); + latradius = FIDIV(viewlat, 2); +} + + +/* + * Read the database file and draw the world. + */ +static void +load(fn) + char *fn; +{ + register DBPOINT *pp; + DBPOINT *pend; + FLOAT x, y, LonPrv, LatPrv; + long oldlong = 0L; + GR_COORD xnew, ynew; + GR_COORD xold = 0, yold = 0; + GR_BOOL is_out; + GR_BOOL was_out; + GR_BOOL newseg = GR_FALSE; + GR_COLOR oldcolor; + GR_COLOR newcolor; + int n; + int fh; + DBPOINT p[PCount]; + + LonPrv = ITOF(0); + LatPrv = ITOF(0); + oldcolor = -1; + is_out = GR_FALSE; + was_out = GR_FALSE; + + fh = open(fn, O_BINARY | O_RDONLY); + if (fh < 0) { + GrClose(); + fprintf(stderr, "Cannot open %s\n", fn); + exit(1); + } + + while ((n = read(fh, p, PCount * POINTSize)) > 0) { + for (pp = p,pend = p + n/POINTSize; pp < pend; pp++) + { + DBPOINT_CONVERT(pp); + /* do displacement */ + x = ITOF(pp->Lon) - Longitude; + y = ITOF(pp->Lat) - Latitude; + + /* wrap around for East-West */ + if (x < -HSPAN) + x += WSPAN; + if (x > HSPAN) + x -= WSPAN; + + if (pp->Code > 5) { + newcolor = code_colors[pp->Code / 1000]; + if (newcolor != oldcolor) { + oldcolor = newcolor; + GrSetGCForeground(mapgc, oldcolor); + } + newseg = GR_TRUE; + } + + if (oldcolor == BLACK) + goto go_on; + + /* ignore points outside magnified area */ + if ((x < -longradius || x > longradius || + y < -latradius || y > latradius)) + { + is_out = 1; + if (was_out) { /* out to out */ + LonPrv = x; + LatPrv = y; + goto go_on; + } + + /* in to out */ + xold = mapxorig + FTOI(FFMUL(LonPrv, X_Scale)) / 60; + yold = mapyorig - FTOI(FFMUL(LatPrv, Y_Scale)) / 60; + } else { /* out to in */ + is_out = 0; + if (was_out) { + xold = mapxorig + + FTOI(FFMUL(LonPrv, X_Scale)) / 60; + yold = mapyorig - + FTOI(FFMUL(LatPrv, Y_Scale)) / 60; + } + /* in to in */ + } + LonPrv = x; + LatPrv = y; + + /* scale points w/in area to interlace screen */ + xnew = mapxorig + FTOI(FFMUL(x, X_Scale)) / 60; + ynew = mapyorig - FTOI(FFMUL(y, Y_Scale)) / 60; + + /* if new segment, move to place */ + if (newseg || ABS(oldlong - pp->Lon) > 180*60) { + xold = xnew; + yold = ynew; + } + oldlong = pp->Lon; + + GrLine(mapwid, mapgc, xold, yold, xnew, ynew); + xold = xnew; + yold = ynew; +go_on: + was_out = is_out; + newseg = GR_FALSE; + } + } + close(fh); +} + +/* END CODE */ diff --git a/packages/services/gfx/mw/current/src/demos/nanox/world.map b/packages/services/gfx/mw/current/src/demos/nanox/world.map new file mode 100644 index 0000000000000000000000000000000000000000..6a583560fb7ca19948581ed7c313e79fc4d90270 GIT binary patch literal 156828 zc$_?)b(qyg+s1Q}OzgzYF6=Jr4vQ9dch^FTyHnhyIK{oVySuwPrBHS$?(WX&cR$nj z`u_P{_jS*c$s{M4%uF(KUP!-*gM%cYl{f}$E-na?g`dUc&^5(Bp(~2Bpj~kq=o9C{ z@rv`InK&_s38FX?+7>s1vEo6b<`W-7mlPi%^%wCHbP4f2bZPMibQLifG3~{BU`;U< zPCe0+MHV`UFW@v3Gr(4&2B(Yo0lJf@W|4$Gq70|6n1cBJTo32$Bl;nAxR@F2D`tYz zU5o)oign;j6&r%<#L3`(kO@b`1<+^2nTSae=Rlto7eT)iXG1?1mw}(exo`w&8Te6L z1IHsRhgPJu&@s|{Fq^a#%qz_UOLCT#mVlF`(b&sOX*~2CX&AUf>IWW?S|NvXQd`=i z)C@c(wFIwA_26HXDndV%@_>(|V&G>fjP@&sAh&QiCFnoOLU#ED&OlcAD|Bi3BXni? zF7$8mapIWxW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vA&*QL0=1J?;4gW8hbF8-V29w*Ms|Vmx8-;zX$i` O&O>W==g$8x{{H~9DkaAN diff --git a/packages/services/gfx/mw/current/src/demos/nxkbd/Makefile b/packages/services/gfx/mw/current/src/demos/nxkbd/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxkbd/Makefile @@ -0,0 +1,63 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000, 2002 Martin Jolicoeur, Greg Haerr +############################################################################## + +include $(CONFIG) + +VPATH := $(TOP)/demos/nxkbd + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += +# Defines for preprocessor +DEFINES += + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +ifeq ($(NANOWM), Y) + +# If you want to create a library with the objects files, define the name here +LIBNAME = + +# List of objects to compile +OBJS = nxkbd.o srvconn.o keynorm.o keyctrl.o keyshft.o keynum.o + +ifeq ($(ARCH), ECOS) +TARGET = $(BUILD)/bin/nxkbd.o +else +TARGET = $(BUILD)/bin/nxkbd +endif + +all: default $(TARGET) + +endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### + +ifeq ($(SHAREDLIBS), Y) +$(BUILD)/bin/nxkbd: $(OBJS) $(NANOXCLIENTLIBS) $(BUILd)/config + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(CCNANOXCLIENTLIBS) +else +ifeq ($(ARCH), ECOS) +$(BUILD)/bin/nxkbd.o: $(OBJS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -Wl,-r -Wl,--defsym -Wl,nxkbd_main=main -o XX.o + $(NM) XX.o | grep -v _main | grep ' T' | awk -f $(TOP)/ecos/retain.awk | xargs $(OBJCOPY) XX.o $@ + rm -f XX.o +else +$(BUILD)/bin/nxkbd: $(OBJS) $(NANOXCLIENTLIBS) $(BUILD)/config + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS) +endif +endif diff --git a/packages/services/gfx/mw/current/src/demos/nxkbd/keyctrl.bmp b/packages/services/gfx/mw/current/src/demos/nxkbd/keyctrl.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c8fc44e2b406d9cd8ecdc0116bd5e6f11c82b3b7 GIT binary patch literal 1282 zc$}@$F-Rjp6adgQXnWggCGilh617hR3p;B&g)8K`D+RN&TM9P8(oQTClyIGbva^C> z8Lv_>Bm-Iq3OfXn9d+Cp|LjaQn`7~WyB~&OU;ga>f0Fsd!ibeb8P+#gJFrTyhTx;( zV%SQfV3rCgrIi<+AXF$9N+S#0Xryv4^z9=bq|xC*R*ZdGd4KKe%@@kmU~&24d0lA zH1BgZx@&Lvt+xuJRor?#<#ap{lM{A;G3SgPYa@XuPS_-HIe$v+I4aKCG-HgC)9~wo z&D7auYJO|7pldXtM)?^^5sb$Qy@~kgja@N+C zyssKMaZnE?yoVJ?$Lu>J^$tDbs>A>Q diff --git a/packages/services/gfx/mw/current/src/demos/nxkbd/keyctrl.c b/packages/services/gfx/mw/current/src/demos/nxkbd/keyctrl.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxkbd/keyctrl.c @@ -0,0 +1,83 @@ +/* Generated by convbmp*/ +#include "device.h" + +/* MWIMAGEHDR image_keyctrl converted from keyctrl.bmp*/ + +static MWPALENTRY palette[2] = { + RGBDEF( 0, 0, 0 ), /* pal 0*/ + RGBDEF( 255, 255, 255 ), /* pal 1*/ +}; + +static MWUCHAR imagebits[] = { +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xe2, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd0,0xce,0xff,0xfb,0xff,0xef,0xff,0xbf,0xee, +0x46,0xad,0xea,0xad,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd7,0xb6,0xff,0xfb,0xff,0xef,0xff,0xbf,0xee, +0x7a,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd7,0xf6,0xff,0xfb,0xff,0xef,0xff,0xbe,0x2e, +0x7a,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xdb,0xf6,0xff,0xfb,0xff,0xef,0xff,0xbe,0xee, +0x66,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xdd,0xce,0xff,0xfb,0xff,0xef,0xff,0xbe,0x3e, +0x5e,0x68,0x8a,0x91,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xde,0xf6,0xff,0xfb,0xff,0xef,0xff,0xa6,0xfe, +0x5e,0xfd,0xda,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xfb,0xde,0xf6,0xff,0xfb,0xff,0xef,0xff,0xaa,0x3e, +0x62,0xee,0xda,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xfb,0xd6,0xb6,0xff,0xfb,0xff,0xef,0xff,0xab,0xfe, +0x7f,0xff,0xfb,0xff,0x77,0xff,0xff,0xff,0xff,0xff,0xfb,0x99,0xce,0xff,0xfb,0xff,0xef,0xff,0xab,0xfe, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xa7,0xfe, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x00,0x00,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x00,0x00,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x18,0xa2,0x0f,0x87,0xbd,0xde,0xfc,0x7b,0xf7,0xef,0x8f,0xbe,0xde,0xfa,0xbb,0xfb,0xef,0x1f,0xbf,0xfe, +0x25,0x22,0x0f,0xbf,0xbe,0xbe,0xfb,0xfb,0xf7,0xef,0xb7,0xbe,0xde,0xfa,0xbb,0xfb,0xef,0xdf,0xbf,0xfe, +0x21,0x22,0x0f,0xdf,0xbf,0x7e,0xfb,0xfb,0xeb,0xef,0xb7,0xbe,0xde,0xfa,0xbb,0xfb,0xef,0xdf,0xb7,0xf6, +0x21,0x32,0x0f,0xef,0xbf,0x7e,0xfb,0xfb,0xeb,0xef,0xb7,0xbe,0xde,0xfa,0xbb,0xf7,0xef,0xdf,0xbb,0xee, +0x23,0xaa,0x0f,0xf7,0xbe,0xbe,0xfb,0xfb,0xdd,0xef,0xb7,0xbe,0xde,0xfa,0xbb,0xf7,0xef,0xdf,0xbd,0xde, +0x25,0x02,0x0f,0x87,0xbd,0xde,0xfc,0x7b,0xdd,0xef,0x8f,0xbe,0x3e,0xf8,0x7b,0xf7,0xef,0xdf,0xbe,0xbe, +0x19,0x02,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xbf,0xbf,0xfe,0xff,0xfb,0xef,0xef,0xdf,0xbf,0x7e, +0x00,0x00,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xbf,0xbf,0xfe,0xff,0xfb,0xef,0xef,0xdf,0xbf,0xfe, +0x00,0x00,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xef,0xef,0x1f,0xbf,0xfe, +0x00,0x00,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x00,0x00,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7c,0x7d,0xff,0xf7,0xf7,0xdf,0xff,0x7f,0xfd,0xc0,0x77,0xff,0xfe, +0x7c,0x7d,0xf9,0xf7,0xe3,0xdf,0xbf,0x7f,0xbd,0xf6,0xf7,0xeb,0xdf,0x6f,0x7e,0xfd,0xff,0xf7,0xef,0xfe, +0x7b,0x7d,0xf6,0xf7,0xdb,0xdf,0xbf,0x7e,0x3d,0xf6,0xf7,0xfb,0xdf,0x5f,0x7e,0xfd,0xff,0xf7,0xcf,0xfe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ff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +}; + +MWIMAGEHDR image_keyctrl = { + 160, 61, /* width, height*/ + 1, 1, /* planes, bpp*/ + 20, 1, /* pitch, bytesperpixel*/ + 1, 2, /* compression, palsize*/ + -1L, /* transcolor*/ + palette, + imagebits, +}; diff --git a/packages/services/gfx/mw/current/src/demos/nxkbd/keynorm.bmp b/packages/services/gfx/mw/current/src/demos/nxkbd/keynorm.bmp new file mode 100644 index 0000000000000000000000000000000000000000..ec03821a9640cf771504bb024609a79f01f37ded GIT binary patch literal 1282 zc$}rtF-yZh6ae5Ty6WHXPgKFd%~1r=3J&V#DA?R(6kLj3b@Abp}3xK@)%DSh1S{` z6rNTZG=QGL7Cj&8r$h`r@DcvkdFnvm}uYLZ@CYjVHZ=$1g1 z{l>=yNbM&pffT;46v%V3rmP8G46tji)JtwYFW%4;bHihOzPcoV_6E6$WF@wD1bD~n zd&%T&##t>QEy?G-`ot)G{AdGb72`-l{q>dnVlLAFnYpY3&!Otr>wn2c4)=E%ypSM?0@p1_&%%-(5h=Dc#-jm;gLy=GQx)9ore^?Tu}p2HlDJvdY?H{ jCDz7|xxPFXtr@Pn1^X8;Ixj7Z_v(}VCPtgfUuX3R$@<7l diff --git a/packages/services/gfx/mw/current/src/demos/nxkbd/keynorm.c b/packages/services/gfx/mw/current/src/demos/nxkbd/keynorm.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxkbd/keynorm.c @@ -0,0 +1,83 @@ +/* Generated by convbmp*/ +#include "device.h" + +/* MWIMAGEHDR image_keynorm converted from keynorm.bmp*/ + +static MWPALENTRY palette[2] = { + RGBDEF( 0, 0, 0 ), /* pal 0*/ + RGBDEF( 255, 255, 255 ), /* pal 1*/ +}; + +static MWUCHAR imagebits[] = { +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd0,0xce,0xff,0xfb,0xff,0xef,0xef,0xbf,0x7e, +0x46,0xad,0xea,0xad,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd7,0xb6,0xff,0xfb,0xff,0xef,0xef,0xbf,0x7e, +0x7a,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd7,0xf6,0xff,0xfb,0xff,0xef,0xef,0xbf,0x7e, +0x7a,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xdb,0xf6,0xff,0xfb,0xc0,0xef,0xdf,0xbf,0xbe, +0x66,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xdd,0xce,0xff,0xfb,0xff,0xef,0xdf,0xbf,0xbe, +0x5e,0x68,0x8a,0x91,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xde,0xf6,0xfd,0xfb,0xc0,0xef,0xdf,0xbf,0xbe, +0x5e,0xfd,0xda,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xfb,0xde,0xf6,0xfe,0xfb,0xff,0xef,0xbf,0xbf,0xde, +0x62,0xee,0xda,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xfb,0xd6,0xb6,0xfc,0xfb,0xff,0xef,0xbf,0xbf,0xde, +0x7f,0xff,0xfb,0xff,0x77,0xff,0xff,0xff,0xff,0xff,0xfb,0x99,0xce,0xfc,0xfb,0xff,0xef,0xbf,0xbf,0xde, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x7f,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xef,0xef,0xff,0xbf,0xfe, +0x67,0x5d,0xef,0x87,0xbd,0xde,0xfc,0x7b,0xf7,0xef,0x8f,0xbe,0xde,0xfa,0xbb,0xf7,0xef,0xff,0xbe,0xfe, +0x5a,0xdd,0xef,0xbf,0xbe,0xbe,0xfb,0xfb,0xf7,0xef,0xb7,0xbe,0xde,0xfa,0xbb,0xe7,0xef,0xcf,0xbf,0x7e, +0x5e,0xdd,0xef,0xdf,0xbf,0x7e,0xfb,0xfb,0xeb,0xef,0xb7,0xbe,0xde,0xfa,0xbb,0xe7,0xef,0xcf,0xbe,0x7e, +0x5e,0xcd,0xef,0xef,0xbf,0x7e,0xfb,0xfb,0xeb,0xef,0xb7,0xbe,0xde,0xfa,0xbb,0xff,0xef,0xff,0xbe,0x7e, +0x5c,0x55,0xef,0xf7,0xbe,0xbe,0xfb,0xfb,0xdd,0xef,0xb7,0xbe,0xde,0xfa,0xbb,0xff,0xef,0xff,0xbf,0xfe, +0x5a,0xfd,0xef,0x87,0xbd,0xde,0xfc,0x7b,0xdd,0xef,0x8f,0xbe,0x3e,0xf8,0x7b,0xff,0xef,0xff,0xbe,0x7e, +0x66,0xfd,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xbf,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbe,0x7e, +0x7f,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xbf,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x7f,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe,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,0x3f,0x7e,0xfd,0xf6,0xf7,0xdb,0xdf,0xbf,0x7d,0xbd,0xf6,0xf7,0x8f,0xfe, +0x7c,0x7d,0xee,0xf7,0xe7,0xdf,0x5f,0x7c,0x3d,0xf6,0xf7,0xdb,0xdf,0xbf,0x7e,0x7d,0xf1,0xf7,0xcf,0xfe, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7e,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xef,0xfe, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7e,0xfd,0xff,0xf7,0xff,0xdf,0xbf,0x7f,0xfd,0xff,0xf7,0xff,0xfe, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe, +0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +}; + +MWIMAGEHDR image_keynorm = { + 160, 61, /* width, height*/ + 1, 1, /* planes, bpp*/ + 20, 1, /* pitch, bytesperpixel*/ + 1, 2, /* compression, palsize*/ + -1L, /* transcolor*/ + palette, + imagebits, +}; diff --git a/packages/services/gfx/mw/current/src/demos/nxkbd/keynum.bmp b/packages/services/gfx/mw/current/src/demos/nxkbd/keynum.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9dc9d7630668cae37fa580ad45520c24d8c6dfe3 GIT binary patch literal 1282 zc$}TkL2DC16ae5@6?=*|j|qy0dNMZ;q6H7yi{3;iZ4?iw7b87{l}xk2Q^1S(2c$hq zScIB|F3B7edeWdC0yWuDyohOL=s{j#m>u8jPSOM;4Zbi8`{nK1_uh@$bEi{rT*tG3 zXA{pgJSXsH;{B=ADCX=jp|ws;i>j6yw24DZl3HjQ9b=bs)^65+)jNqTEFH=pLbRfC zeed%-a|gJOH0;Fe@H+C@AO@ne{90&-D$?5k?sa^iaHUL-U(tlo#9Va%9-~fE!^fUq ztw5Y7zzeg^s)o0r=PC&T^FBK#nMcqFyI)ZX+Gus(V_v06{Su?bUc}a6SywT~>)tY! zN*n8klvFq{o5x-C$$1viQu8-{KBEW)v!7dX|D+eH0b^|YC0s!-cJ`v>S;V(b zIKj$W8@*ylo>qcl<}ADsL*8@dy<{(Y7xCvTL*TQ+Wb(auskh+S>QkSien=fqAE6)D zi(}rbdUbOdW4!J5)esTtYWUn|e zHeakks-Tqm>ScgtZtb(1Td4qfUk2f`;-lMl-C1Pq!v*`^=Dv*f74?08@NI{zGpmXs zRi^#WT^5P=cvmIyu)s+UgW!3{rZH7XBno_*Lqv1XHp~^qtTg1a%y3gnP?l|lIj^DL^$tqqga7%@ws>GK{#zVCE6{wu0 zN=5=XtKdyIZxg*P4%&vkMYg5 + * linked-in bitmaps, redrawn keymaps + * enhanced shift/control function, fnkeys + * supports all ascii values 1-127 + * Copyright (C) 2000 by VTech Informations LTD. + * Vladimir Cotfas Aug 31, 2000 + * initial port to Nano-X + * Copyright (C) 2000 by Jay Carlson + * initial soft kbd for W + * + * This code is licensed with the same license as Microwindows. + * + * #define KBDPIPE in srvconn.c for named pipe keyboard driver. + * Otherwise, the GrInjectKeyboardEvent method is used. + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + +#define TITLE "Soft Keyboard" +#define DISKIMAGES 0 /* =0 use linked-in images*/ +#define _SOFTKBD_DEBUG 0 + +/* kbd states, each with unique bitmap*/ +#define NORM 1000 +#define CNTRL 1001 +#define SHIFT 1002 +#define NUM 1003 +#define INTL 1004 + +/* special chars*/ +#define BS '\b' /* value of <- on kbd*/ +#define F1 2000 +#define NONE 3000 + +/* number of charcodes per bitmap*/ +#define SCANCODES 41 + +/* size of bitmaps*/ +#define BM_WIDTH 160 +#define BM_HEIGHT 61 + +struct keycolumn { + short xoffset; + short scancode; +}; + +struct keyrow { + short yoffset; + short height; + struct keycolumn columns[12]; +}; + +/* fixed layout for each scancode location*/ +struct keyrow keyrows[4] = { + {0, 15, + {{0, 0}, {14, 1}, {28, 2}, {42, 3}, {56, 4}, {70, 5}, {84, 6}, {98, 7}, {112, 8}, {126, 9}, {140, 10}, {999, -1}}}, + {15, 15, + {{0, 11}, {14, 12}, {28, 13}, {42, 14}, {56, 15}, {70, 16}, {84, 17}, {98, 18}, {112, 19}, {126, 20}, {140, 21}, {999, -1}}}, + {30, 15, + {{0, 22}, {19, 23}, {33, 24}, {47, 25}, {61, 26}, {75, 27}, {89, 28}, {103, 29}, {117, 30}, {131, 31}, {145, 32}, {999, -1}} }, + {45, 15, + {{0, 33}, {21, 34}, {36, 35}, {85, 36}, {103, 37}, {117, 38}, {131, 39}, {145, 40}, {999, -1}}} +}; + +#define C(x) ((x)&0x1f) + +/* charcode mappings per kbd state*/ +static short normal[SCANCODES] = { + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', BS, + 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', '-', '\r', + CNTRL, 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', ';', + SHIFT, INTL, ' ', NUM, '\'', '=', '\\', '/' +}; + +static short control[SCANCODES] = { + C('q'),C('w'),C('e'),C('r'),C('t'),C('y'),C('u'),C('i'),C('o'),C('p'),'\033', + C('a'),C('s'),C('d'),C('f'),C('g'),C('h'),C('j'),C('k'),C('l'),C('_'),'\r', + CNTRL,C('z'),C('x'),C('c'),C('v'),C('b'),C('n'),C('m'),C('\\'),C(']'),C('^'), + SHIFT,INTL,' ',NUM,NONE,NONE,NONE,'\177' +}; + +static short shift[SCANCODES] = { + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', BS, + 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', '_', '\r', + CNTRL, 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', ':', + SHIFT, INTL, ' ', NUM, '"', '+', '|', '?' +}; + +static short num[SCANCODES] = { + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', BS, + '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '\r', + CNTRL, F1, F1+1, F1+2, F1+3, F1+4, F1+5, F1+6, F1+7, '`', '~', + SHIFT, INTL, ' ', NUM, '[', ']', '{', '}'}; + +static char *fnkey[] = { + "\033OP", "\033OQ", "\033OR", "\033OS", "\03315~", + "\03317~", "\03318~", "\03319~", "\03320~", "\03321~" +}; + +struct layout_state { + char *filename; + GR_IMAGE_HDR *imagehdr; + short *scancode_translations; + short sshift; + short ctrl_layout, shift_layout, num_layout; +}; + +/* auto-converted .bmp files for internal linking*/ +extern GR_IMAGE_HDR image_keynorm; +extern GR_IMAGE_HDR image_keyctrl; +extern GR_IMAGE_HDR image_keyshft; +extern GR_IMAGE_HDR image_keynum; + +static struct layout_state layout_states[] = { + { /* 0 */ + "keynorm.bmp", + &image_keynorm, + normal, + 0, + 2, 1, 3 + }, + { /* 1 */ + "keyshft.bmp", + &image_keyshft, + shift, + 0, + 2, 0, 3 + }, + { /* 2 */ + "keyctrl.bmp", + &image_keyctrl, + control, + 1, /* ctrl is single shift*/ + 0, 1, 3 + }, + { /* 3 */ + "keynum.bmp", + &image_keynum, + num, + 0, + 2, 1, 0 + } +}; +#define N_LAYOUT_STATES (sizeof(layout_states) / sizeof(layout_states[0])) + +static GR_WINDOW_ID w; +static GR_GC_ID gc; /* graphics context for text */ +static int current_layout = 0; +#if DISKIMAGES +static GR_IMAGE_ID layout_images[N_LAYOUT_STATES]; +static int layout_images_loaded[N_LAYOUT_STATES]; +#endif + +extern int KbdWrite(int c); +extern int KbdOpen(void); +extern void KbdClose(void); + +static void +push_character(int c) +{ +#if _SOFTKBD_DEBUG + fprintf(stderr, "pushed %d (0x%x) '%c'\n", c, c, c); +#endif + KbdWrite(c); +} + +static void +display_layout(int layout) +{ +#if DISKIMAGES +#define LIBDIR "." /* "/etc/nxkbd.d" */ + if (!layout_images_loaded[layout] ) { + char buf[128]; + + /* + * OK, load image on the server-side ;-) + * DON'T check for errors ;( + */ + sprintf(buf, "%s/%s", LIBDIR, layout_states[layout].filename); + layout_images[layout] = GrLoadImageFromFile(buf, 0); + layout_images_loaded[layout] = 1; + } + GrDrawImageToFit(w, gc, 0, 0, -1, -1, layout_images[layout]); +#else + GrDrawImageBits(w, gc, 0, 0, layout_states[layout].imagehdr); +#endif +} + +static void +process_scancode(int scancode) +{ + int c; + + c = layout_states[current_layout].scancode_translations[scancode]; +#if _SOFTKBD_DEBUG + printf("scancode = %d ", scancode); + printf("current_layout = %d ('%s'), scancode (translated) = %d\n", + current_layout, layout_states[current_layout].filename, c); +#endif + + switch (c) { + default: + if (c < 256) /* normal character*/ + break; + + /* handle special functions*/ + if (c >= F1 && c < F1+10) { + char *p = fnkey[c-F1]; + while (*p) + push_character(*p++); + return; + } + + /* no action for NONE*/ + if (c == NONE) + return; + fprintf(stderr, "nxkbd: key with unknown translation pressed\n"); + return; + case CNTRL: + current_layout = layout_states[current_layout].ctrl_layout; + display_layout(current_layout); + return; + case SHIFT: + current_layout = layout_states[current_layout].shift_layout; + display_layout(current_layout); + return; + case NUM: + current_layout = layout_states[current_layout].num_layout; + display_layout(current_layout); + return; + case INTL: +#if _SOFTKBD_DEBUG + printf("INTL not yet implemented\n"); +#endif + return; + } + + if (layout_states[current_layout].sshift) { + current_layout = 0; + display_layout(current_layout); + } + + push_character(c); +} + + +static void +mouse_hit(int x, int y) +{ + int row, column; + + for (row = 0; row < 4; row++) { + if (y >= keyrows[row].yoffset && + y < keyrows[row].yoffset+keyrows[row].height) { + for (column = 0; column < 12; column++) { + if (keyrows[row].columns[column].xoffset == 999) { + fprintf(stderr, "off end of row\n"); + return; + } + if (x < keyrows[row].columns[column + 1].xoffset) { + int scancode = keyrows[row].columns[column].scancode; + process_scancode(scancode); + return; + } + } + } + } + + fprintf(stderr, "nxkbd: off bottom\n"); +} + +#ifdef __ECOS +int +nxkbd_main(int argc, char* argv[]) +#else +int +main(int argc, char* argv[]) +#endif +{ + GR_EVENT event; /* current event */ + GR_WM_PROPERTIES props; + + if (GrOpen() < 0) { + fprintf(stderr, "nxkbd: cannot open graphics\n"); + exit(1); + } + + if (KbdOpen() < 0) { + fprintf(stderr, "nxkbd: cannot open kbd named pipe\n"); +#if 0 + exit(1); +#endif + } + +#if !DISKIMAGES + GrReqShmCmds(4096); /* fast image copy*/ +#endif + w = GrNewWindow(GR_ROOT_WINDOW_ID, + 0, 0, BM_WIDTH, BM_HEIGHT, + 0, WHITE, BLACK); + + GrSelectEvents(w, GR_EVENT_MASK_CLOSE_REQ | + GR_EVENT_MASK_EXPOSURE | + /*GR_EVENT_MASK_FOCUS_IN |*/ + /*GR_EVENT_MASK_KEY_DOWN |*/ /* required for focus*/ + GR_EVENT_MASK_BUTTON_DOWN); + +#if 0 /* this code fails when link-app-into-server */ + //if (props.title) // can't free with link-into-server + //free(props.title); + + /* title must be alloc'd and copied*/ + //props.title = malloc(18); + //if (props.title) + //strcpy(props.title, TITLE); + + props.flags = + GR_WM_FLAG_NORESIZE | /* don't let user resize window */ + GR_WM_FLAG_NOBORDERS | /* don't draw any window borders */ + GR_WM_FLAG_NOTITLEBAR | /* don't draw a title bar */ + GR_WM_FLAG_NOFOCUS; /* don't set focus to this window*/ +#endif + + props.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE; + props.props = GR_WM_PROPS_NOFOCUS; + props.props |= /*GR_WM_PROPS_NOMOVE |*/ GR_WM_PROPS_NORAISE | + GR_WM_PROPS_BORDER | GR_WM_PROPS_CAPTION | GR_WM_PROPS_CLOSEBOX; + props.title = TITLE; + GrSetWMProperties(w, &props); + + GrMapWindow(w); + + gc = GrNewGC(); + + current_layout = 0; + for (;;) { + GrGetNextEvent(&event); + + switch(event.type) { + case GR_EVENT_TYPE_CLOSE_REQ: +#if DISKIMAGES + { + int i; + + for(i=0; i < N_LAYOUT_STATES; i++) { + if( !layout_images_loaded[i] ) + continue; + GrFreeImage(layout_images[i]); + } + } +#endif + GrClose(); + exit(0); + /* no return*/ + case GR_EVENT_TYPE_EXPOSURE: + display_layout(current_layout); + break; + case GR_EVENT_TYPE_BUTTON_DOWN: + mouse_hit(event.button.x, event.button.y); + break; +#if 0 + case GR_EVENT_TYPE_FOCUS_IN: + if (event.general.otherid != 1) { + int lastfocus = event.general.otherid; + GrSetFocus(lastfocus); + } + break; +#endif + } + } + + /*NOTREACHED*/ + return 0; + } diff --git a/packages/services/gfx/mw/current/src/demos/nxkbd/nxkbd.syms b/packages/services/gfx/mw/current/src/demos/nxkbd/nxkbd.syms new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxkbd/nxkbd.syms @@ -0,0 +1,1 @@ +nxkbd_main diff --git a/packages/services/gfx/mw/current/src/demos/nxkbd/srvconn.c b/packages/services/gfx/mw/current/src/demos/nxkbd/srvconn.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxkbd/srvconn.c @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2000 by Greg Haerr + * Copyright (C) 2000 by VTech Informations LTD. + * Vladimir Cotfas Aug 31, 2000 + */ +#include +#include +#include "nano-X.h" + +#define KBDPIPE 0 /* =1 to use named pipe for soft kbd*/ + +#if KBDPIPE +static char KBD_NAMED_PIPE[] = "/tmp/.nano-X-softkbd"; +static int kbd_fd = -1; + +int +KbdOpen(void) +{ + if (kbd_fd != -1) + close(kbd_fd); + + if ((kbd_fd = open(KBD_NAMED_PIPE, O_WRONLY)) < 0) + return -1; + + return kbd_fd; +} + +void +KbdClose(void) +{ + if(kbd_fd >= 0) { + close(kbd_fd); + kbd_fd = -1; + } +} + +int +KbdWrite(int c) +{ + char cc = c & 0xff; + + return write(kbd_fd, &cc, 1); +} + +#else /* !KBDPIPE*/ + +int +KbdOpen(void) +{ + return 0; +} + +void +KbdClose(void) +{ +} + +int +KbdWrite(int c) +{ + GR_WINDOW_ID win = GrGetFocus(); + + /* FIXME: modifiers are incorrect*/ + GrInjectKeyboardEvent(win, c, 0, 0, 1); + GrInjectKeyboardEvent(win, c, 0, 0, 0); + return 1; +} +#endif /* KBDPIPE*/ diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/Makefile b/packages/services/gfx/mw/current/src/demos/nxroach/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/Makefile @@ -0,0 +1,48 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr +############################################################################## + +include $(CONFIG) + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += +# Defines for preprocessor +DEFINES += + +# Compilation flags for C files OTHER than include directories +CFLAGS += -I./bitmaps +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += -lm + +############################# targets section ################################ + +ifeq ($(NANOWM), Y) + +# If you want to create a library with the objects files, define the name here +LIBNAME = + +# List of objects to compile +OBJS = nxroach.o + +all: default $(TOP)/bin/nxroach + +endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### + +ifeq ($(SHAREDLIBS), Y) +$(TOP)/bin/nxroach: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(CCNANOXCLIENTLIBS) +else +$(TOP)/bin/nxroach: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS) +endif diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach000.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach000.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach000.xbm @@ -0,0 +1,30 @@ +#define roach000_width 48 +#define roach000_height 48 + +static char roach000_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x06, 0x80, + 0x00, 0x00, 0x03, 0x00, 0x03, 0x60, 0x00, 0x00, 0x7e, 0x80, 0xc1, 0x3f, + 0x00, 0x00, 0xc0, 0x83, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0xc6, 0x30, 0x00, + 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xef, 0x01, + 0x00, 0x00, 0xfe, 0xff, 0xe7, 0x11, 0x10, 0xc0, 0xff, 0xff, 0xf7, 0x03, + 0x02, 0xf0, 0xff, 0xff, 0xf3, 0x3f, 0x00, 0xf0, 0xff, 0xff, 0xf3, 0x3b, + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xf3, 0x3f, + 0x00, 0xe0, 0xff, 0xff, 0xf3, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xf3, 0x07, + 0x01, 0xe0, 0xff, 0xff, 0xf7, 0x13, 0x08, 0xc0, 0xff, 0xff, 0xf7, 0x03, + 0x00, 0x00, 0xfe, 0xff, 0xe7, 0x01, 0x00, 0x00, 0x00, 0xff, 0x0f, 0x00, + 0x00, 0x00, 0x00, 0x88, 0x18, 0x00, 0x00, 0x00, 0xf8, 0xc7, 0xf0, 0x03, + 0x00, 0x00, 0xfe, 0x81, 0xc1, 0x3f, 0x00, 0x00, 0x06, 0x00, 0x01, 0x30, + 0x00, 0x00, 0x03, 0x00, 0x02, 0x40, 0x00, 0x80, 0x01, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach015.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach015.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach015.xbm @@ -0,0 +1,30 @@ +#define roach015_width 48 +#define roach015_height 48 + +static char roach015_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0c, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x07, + 0x00, 0x00, 0x00, 0x40, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x60, 0x3c, 0x00, + 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x10, 0x00, 0x10, 0x06, 0x00, + 0x00, 0x60, 0xfc, 0x30, 0x72, 0x04, 0x00, 0xc0, 0x9f, 0xe3, 0xf3, 0x1e, + 0x00, 0x00, 0x00, 0xfe, 0xfb, 0x1d, 0x00, 0x00, 0xc0, 0xff, 0xfb, 0x3d, + 0x00, 0x00, 0xf8, 0xff, 0xf9, 0x3f, 0x00, 0x00, 0xfe, 0xff, 0xfb, 0x3f, + 0x3c, 0x00, 0xff, 0xff, 0xfb, 0x07, 0x00, 0xc0, 0xff, 0x1f, 0xf8, 0x17, + 0x00, 0xe0, 0xff, 0xe1, 0xf7, 0x07, 0x00, 0xf0, 0x1f, 0xfe, 0xf7, 0x03, + 0x00, 0xf0, 0xe1, 0xff, 0xe7, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xcf, 0x01, + 0x00, 0xc0, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x7f, 0xfc, + 0x00, 0xc0, 0xff, 0x3f, 0xc3, 0x1f, 0x01, 0xc0, 0xff, 0x23, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1c, 0x00, + 0x00, 0x00, 0x80, 0x07, 0x20, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x40, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach030.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach030.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach030.xbm @@ -0,0 +1,30 @@ +#define roach030_width 48 +#define roach030_height 48 + +static char roach030_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x00, 0x00, 0x10, 0x1e, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x07, 0x00, 0x00, 0x00, 0x00, 0x98, 0x01, 0x09, + 0x00, 0x00, 0x00, 0x8c, 0x01, 0x04, 0x00, 0x00, 0x00, 0x8c, 0xb8, 0x07, + 0x00, 0x00, 0x00, 0x84, 0x7c, 0x0f, 0x00, 0x00, 0x00, 0xfc, 0xfc, 0x8e, + 0x00, 0x00, 0x00, 0xf8, 0xfc, 0x1f, 0x00, 0x00, 0xe0, 0xff, 0xfc, 0x05, + 0x00, 0x04, 0x1e, 0xff, 0xfd, 0x17, 0x00, 0xf8, 0x87, 0xff, 0xf9, 0x03, + 0x00, 0xe0, 0xc0, 0xff, 0xf9, 0x07, 0x00, 0x00, 0xf0, 0x7f, 0xf0, 0x07, + 0x00, 0x00, 0xf8, 0x1f, 0xe7, 0x03, 0x00, 0x00, 0xfe, 0xcf, 0xcf, 0xc1, + 0x03, 0x00, 0xff, 0xf3, 0x1f, 0xe0, 0x00, 0x80, 0xff, 0xfc, 0xff, 0x3f, + 0x00, 0x80, 0x3f, 0xfe, 0xbf, 0x07, 0x00, 0xc0, 0x9f, 0xff, 0x07, 0x00, + 0x00, 0xc0, 0xe7, 0xff, 0x0f, 0x00, 0x00, 0xc0, 0xf9, 0xff, 0x3c, 0x00, + 0x00, 0x00, 0xfe, 0xff, 0xf8, 0x01, 0x00, 0x00, 0xff, 0x8f, 0x00, 0x02, + 0x00, 0x00, 0xff, 0x61, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach045.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach045.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach045.xbm @@ -0,0 +1,30 @@ +#define roach045_width 48 +#define roach045_height 48 + +static char roach045_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x01, + 0x00, 0x00, 0x00, 0xc0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x62, 0xc0, 0x43, + 0x00, 0x00, 0x00, 0x62, 0xfe, 0x13, 0x00, 0x00, 0x00, 0x23, 0xff, 0x07, + 0x00, 0x00, 0x00, 0x23, 0xff, 0x07, 0x00, 0x00, 0x00, 0x63, 0xff, 0x0b, + 0x00, 0x00, 0x00, 0x73, 0xff, 0x01, 0x00, 0x00, 0x00, 0x7e, 0xfe, 0x01, + 0x00, 0x00, 0x00, 0xfc, 0xfc, 0x03, 0x00, 0x00, 0x40, 0xfe, 0xf9, 0x03, + 0x07, 0x00, 0xf0, 0xff, 0xf1, 0xc3, 0x00, 0x00, 0x18, 0xff, 0xc0, 0xe3, + 0x00, 0x00, 0x8e, 0x7f, 0x1e, 0x70, 0x00, 0x00, 0xc7, 0x3f, 0xff, 0x1f, + 0x00, 0xfc, 0xe3, 0x9f, 0x7f, 0x07, 0x00, 0xe0, 0xe1, 0xcf, 0x3f, 0x00, + 0x00, 0x00, 0xf0, 0xe7, 0x3f, 0x00, 0x00, 0x00, 0xf8, 0xf1, 0x1f, 0x00, + 0x00, 0x00, 0xfc, 0xfc, 0xe7, 0x0f, 0x00, 0x00, 0x7e, 0xfe, 0x03, 0x00, + 0x00, 0x00, 0x3e, 0xff, 0x03, 0x00, 0x00, 0x00, 0x9f, 0xff, 0x02, 0x00, + 0x00, 0x00, 0xcf, 0x7f, 0x03, 0x00, 0x00, 0x00, 0xe7, 0x1f, 0x03, 0x00, + 0x00, 0x00, 0xf2, 0x8f, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x83, 0x01, 0x00, + 0x00, 0x00, 0xf8, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach060.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach060.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach060.xbm @@ -0,0 +1,30 @@ +#define roach060_width 48 +#define roach060_height 48 + +static char roach060_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, + 0x00, 0x00, 0x00, 0x60, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x74, 0x04, + 0x00, 0x00, 0x00, 0x30, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x18, 0xfc, 0x01, + 0x00, 0x00, 0x00, 0x88, 0xff, 0x00, 0x00, 0x00, 0x40, 0xc8, 0xff, 0x02, + 0x00, 0x00, 0xc0, 0xd8, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xd8, 0xff, 0x80, + 0x01, 0x00, 0x80, 0x90, 0xff, 0xe1, 0x00, 0x00, 0x80, 0x18, 0xff, 0x61, + 0x00, 0x00, 0x80, 0x3f, 0xfe, 0x33, 0x00, 0x00, 0x00, 0x7f, 0xfc, 0x19, + 0x00, 0x00, 0x00, 0xfe, 0xf1, 0x18, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x0f, + 0x00, 0x00, 0xc0, 0xff, 0xff, 0x01, 0x00, 0x00, 0xe0, 0x7f, 0x7f, 0x00, + 0x00, 0x00, 0x90, 0xbf, 0x7f, 0x00, 0x00, 0x00, 0x98, 0xbf, 0x3f, 0x38, + 0x00, 0x00, 0xd8, 0xdf, 0x7f, 0x0f, 0x00, 0x00, 0xcc, 0xef, 0xdf, 0x01, + 0x00, 0x00, 0xe6, 0xef, 0x0f, 0x00, 0x00, 0xc0, 0xe3, 0xf7, 0x0f, 0x00, + 0x00, 0x00, 0xe0, 0xf7, 0x1f, 0x00, 0x00, 0x00, 0xf0, 0xfb, 0x1f, 0x00, + 0x00, 0x00, 0xf0, 0xf9, 0x1b, 0x00, 0x00, 0x00, 0xf0, 0xfd, 0x19, 0x00, + 0x00, 0x00, 0xf8, 0xfe, 0x08, 0x00, 0x00, 0x00, 0x78, 0x7e, 0x0c, 0x00, + 0x00, 0x00, 0x70, 0x3f, 0x04, 0x00, 0x00, 0x00, 0x30, 0x3f, 0x06, 0x00, + 0x00, 0x00, 0x80, 0x1f, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach075.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach075.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach075.xbm @@ -0,0 +1,30 @@ +#define roach075_width 48 +#define roach075_height 48 + +static char roach075_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x84, 0x06, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3e, 0x00, + 0x00, 0x00, 0x00, 0x06, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1e, 0x60, + 0x00, 0x00, 0x00, 0xc6, 0x3f, 0x20, 0x00, 0x00, 0x00, 0xe6, 0x3f, 0x18, + 0x00, 0x00, 0x00, 0xf2, 0x7f, 0x18, 0x00, 0x00, 0x08, 0xf2, 0x7f, 0x18, + 0x00, 0x00, 0x30, 0xf6, 0xff, 0x0c, 0x00, 0x00, 0x20, 0xe4, 0xff, 0x0c, + 0x00, 0x00, 0x60, 0x98, 0xff, 0x0c, 0x00, 0x00, 0x40, 0x38, 0x38, 0x06, + 0x00, 0x00, 0xc0, 0xff, 0xe0, 0x01, 0x00, 0x00, 0x80, 0xff, 0xfe, 0x00, + 0x00, 0x00, 0x00, 0x7e, 0xfe, 0x78, 0x00, 0x00, 0x00, 0x7e, 0x7f, 0x1c, + 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x0e, 0x00, 0x00, 0xc0, 0x7f, 0xff, 0x03, + 0x00, 0x00, 0xc0, 0x3e, 0x7f, 0x00, 0x00, 0x00, 0x20, 0xbf, 0x3f, 0x00, + 0x00, 0x00, 0x20, 0xbf, 0x3f, 0x00, 0x00, 0x00, 0x20, 0xbf, 0x7f, 0x00, + 0x00, 0x00, 0x10, 0x9f, 0x5f, 0x00, 0x00, 0x00, 0x10, 0xdf, 0x5f, 0x00, + 0x00, 0x00, 0x18, 0xdf, 0x4f, 0x00, 0x00, 0x00, 0x0c, 0xdf, 0x4f, 0x00, + 0x00, 0x00, 0x86, 0xcf, 0x47, 0x00, 0x00, 0x00, 0x80, 0xef, 0x47, 0x00, + 0x00, 0x00, 0x80, 0xef, 0x63, 0x00, 0x00, 0x00, 0x00, 0xef, 0x63, 0x00, + 0x00, 0x00, 0x00, 0xe7, 0x41, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x81, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach090.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach090.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach090.xbm @@ -0,0 +1,30 @@ +#define roach090_width 48 +#define roach090_height 48 + +static char roach090_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, + 0x00, 0x00, 0xc0, 0xc0, 0x03, 0x0c, 0x00, 0x00, 0xc0, 0xd0, 0x07, 0x0c, + 0x00, 0x00, 0xc0, 0xc0, 0x07, 0x04, 0x00, 0x00, 0xc0, 0x60, 0x07, 0x06, + 0x00, 0x00, 0xc0, 0x80, 0x03, 0x06, 0x00, 0x00, 0xc0, 0xf0, 0x3f, 0x06, + 0x00, 0x00, 0x80, 0xf8, 0x7f, 0x06, 0x00, 0x00, 0x80, 0xf9, 0x7f, 0x06, + 0x00, 0x00, 0x80, 0xf9, 0x7f, 0x02, 0x00, 0x00, 0x00, 0xfb, 0x7f, 0x03, + 0x00, 0x00, 0x00, 0xf3, 0x9f, 0x61, 0x00, 0x00, 0x18, 0x1c, 0x70, 0x30, + 0x00, 0x00, 0x30, 0xfc, 0x7e, 0x18, 0x00, 0x00, 0x60, 0xfc, 0x7e, 0x0c, + 0x00, 0x00, 0xc0, 0xfc, 0x7e, 0x06, 0x00, 0x00, 0xc0, 0xff, 0xfe, 0x03, + 0x00, 0x00, 0x00, 0xfc, 0x7e, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfe, 0x01, + 0x00, 0x00, 0x00, 0xff, 0x7e, 0x01, 0x00, 0x00, 0x80, 0xfc, 0x7e, 0x03, + 0x00, 0x00, 0x80, 0xfc, 0x7e, 0x02, 0x00, 0x00, 0x80, 0xfc, 0x7e, 0x02, + 0x00, 0x00, 0x80, 0xf8, 0x3e, 0x06, 0x00, 0x00, 0xc0, 0xf8, 0x3e, 0x06, + 0x00, 0x00, 0xc0, 0xf8, 0x3e, 0x06, 0x00, 0x00, 0xc0, 0xf8, 0x3e, 0x04, + 0x00, 0x00, 0xc0, 0xf8, 0x3e, 0x0c, 0x00, 0x00, 0x60, 0xf8, 0x3e, 0x08, + 0x00, 0x00, 0x20, 0xf8, 0x3e, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1e, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach105.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach105.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach105.xbm @@ -0,0 +1,30 @@ +#define roach105_width 48 +#define roach105_height 48 + +static char roach105_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xc1, 0x00, + 0x00, 0x00, 0x06, 0xf8, 0xc0, 0x00, 0x00, 0x00, 0x1c, 0xfa, 0xc1, 0x00, + 0x00, 0x00, 0x18, 0x88, 0x83, 0x00, 0x00, 0x00, 0x10, 0xe0, 0x9f, 0x00, + 0x00, 0x00, 0x30, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x20, 0xfc, 0x9f, 0x10, + 0x00, 0x00, 0x60, 0xfe, 0x5f, 0x18, 0x00, 0x00, 0x60, 0xfe, 0x4f, 0x0c, + 0x00, 0x00, 0x60, 0xfc, 0x27, 0x0c, 0x00, 0x00, 0xc0, 0x78, 0x3c, 0x0e, + 0x00, 0x00, 0x80, 0x07, 0x7c, 0x06, 0x00, 0x00, 0x00, 0xfc, 0xfe, 0x03, + 0x00, 0x00, 0x08, 0xfc, 0xfe, 0x00, 0x00, 0x00, 0x78, 0xfc, 0xfd, 0x00, + 0x00, 0x00, 0xe0, 0xfc, 0xfd, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0x07, + 0x00, 0x00, 0x00, 0xf8, 0xfd, 0x05, 0x00, 0x00, 0x00, 0xf8, 0xfb, 0x05, + 0x00, 0x00, 0x00, 0xf8, 0xfb, 0x09, 0x00, 0x00, 0x00, 0xfc, 0xfb, 0x19, + 0x00, 0x00, 0x00, 0xfc, 0xf3, 0x19, 0x00, 0x00, 0x00, 0xe4, 0xf7, 0x31, + 0x00, 0x00, 0x00, 0xe4, 0xf7, 0x31, 0x00, 0x00, 0x00, 0xe4, 0xf7, 0xc1, + 0x00, 0x00, 0x00, 0xc4, 0xe7, 0x03, 0x01, 0x00, 0x00, 0xcc, 0xef, 0x03, + 0x00, 0x00, 0x00, 0x8c, 0xef, 0x03, 0x00, 0x00, 0x00, 0x8c, 0xef, 0x01, + 0x00, 0x00, 0x00, 0x0c, 0xcf, 0x01, 0x00, 0x00, 0x00, 0x0c, 0xde, 0x01, + 0x00, 0x00, 0x00, 0x06, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach120.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach120.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach120.xbm @@ -0,0 +1,30 @@ +#define roach120_width 48 +#define roach120_height 48 + +static char roach120_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x10, 0x08, 0x18, 0x00, 0x00, 0x00, 0x00, 0x28, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x1e, 0x38, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x30, 0x00, + 0x00, 0x00, 0x00, 0x9f, 0x63, 0x00, 0x00, 0x00, 0x80, 0xe6, 0x67, 0x04, + 0x00, 0x80, 0x00, 0xfa, 0x27, 0x04, 0x00, 0x00, 0x07, 0xfc, 0x2f, 0x06, + 0x00, 0x00, 0x0c, 0xfc, 0x07, 0x06, 0x00, 0x00, 0x18, 0xfe, 0x37, 0x02, + 0x00, 0x00, 0x18, 0xff, 0x3b, 0x02, 0x00, 0x00, 0x30, 0xfe, 0xfc, 0x03, + 0x00, 0x00, 0x60, 0x3e, 0xfc, 0x00, 0x00, 0x00, 0x60, 0xc0, 0xfe, 0x00, + 0x00, 0x00, 0xc0, 0xff, 0xfd, 0x07, 0x00, 0x00, 0x00, 0xfc, 0xfd, 0x0f, + 0x00, 0x00, 0x00, 0xfc, 0xfb, 0x1b, 0x00, 0x00, 0x20, 0xf8, 0xf3, 0x37, + 0x00, 0x00, 0xf0, 0xf9, 0xf7, 0x67, 0x00, 0x00, 0xc0, 0xff, 0xef, 0xc7, + 0x00, 0x00, 0x00, 0xe0, 0xef, 0x8f, 0x01, 0x00, 0x00, 0xe0, 0xdf, 0x0f, + 0x0f, 0x00, 0x00, 0xe0, 0x9f, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0xbf, 0x1f, + 0x00, 0x00, 0x00, 0x20, 0x3f, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x7e, 0x1e, + 0x00, 0x00, 0x00, 0x20, 0xfe, 0x3e, 0x00, 0x00, 0x00, 0x60, 0xfc, 0x3c, + 0x00, 0x00, 0x00, 0x40, 0xf8, 0x3d, 0x00, 0x00, 0x00, 0xc0, 0xf8, 0x19, + 0x00, 0x00, 0x00, 0x80, 0xf1, 0x03, 0x00, 0x00, 0x00, 0x80, 0xc1, 0x03, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach135.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach135.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach135.xbm @@ -0,0 +1,30 @@ +#define roach135_width 48 +#define roach135_height 48 + +static char roach135_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0e, 0x00, + 0x00, 0x00, 0x04, 0x03, 0x88, 0x01, 0x00, 0x00, 0xd8, 0xef, 0x88, 0x01, + 0x00, 0x00, 0xc0, 0xff, 0x89, 0x01, 0x00, 0x00, 0x80, 0xfd, 0x8b, 0x01, + 0x00, 0x00, 0xa0, 0xfc, 0x9f, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, + 0x00, 0x00, 0x00, 0xfe, 0x7d, 0x00, 0x00, 0xc0, 0x01, 0xff, 0xfe, 0x00, + 0x00, 0x00, 0x06, 0x7f, 0xfe, 0x07, 0x00, 0x00, 0x0e, 0x3f, 0xfe, 0x1f, + 0x00, 0x00, 0x3c, 0xcf, 0xfd, 0x27, 0x00, 0x00, 0x70, 0xe0, 0xfb, 0xc7, + 0x00, 0x00, 0xe0, 0xff, 0xf7, 0x8f, 0x7f, 0x00, 0x00, 0xf8, 0xef, 0x1f, + 0x07, 0x00, 0x00, 0xf0, 0xdf, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0xbf, 0x7f, + 0x00, 0x00, 0x80, 0xf7, 0x7f, 0x7e, 0x00, 0x00, 0xe0, 0xdf, 0xff, 0xfc, + 0x00, 0x00, 0x00, 0x80, 0xff, 0xf9, 0x01, 0x00, 0x00, 0x80, 0xfe, 0xf3, + 0x01, 0x00, 0x00, 0x80, 0xfd, 0xe7, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xcf, + 0x01, 0x00, 0x00, 0x00, 0xe3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach150.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach150.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach150.xbm @@ -0,0 +1,30 @@ +#define roach150_width 48 +#define roach150_height 48 + +static char roach150_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x04, 0x70, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x00, + 0x00, 0x00, 0xc0, 0x7b, 0x42, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x42, 0x00, + 0x00, 0x00, 0xe1, 0xfd, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xfe, 0x3f, 0x04, + 0x00, 0x00, 0x60, 0xfe, 0xfe, 0x3f, 0x00, 0x00, 0x50, 0xff, 0xfe, 0x61, + 0x70, 0x00, 0x00, 0x7f, 0xfe, 0x87, 0x0f, 0x00, 0x00, 0x7f, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x3f, 0xfc, 0x3f, 0x00, 0x00, 0x07, 0xdf, 0xf3, 0x7f, + 0x00, 0x80, 0x1f, 0xee, 0xcf, 0xff, 0x00, 0x00, 0x38, 0xf0, 0x3f, 0xff, + 0x01, 0x00, 0xe0, 0xff, 0xff, 0xfc, 0x03, 0x00, 0x00, 0xe0, 0xff, 0xf3, + 0x07, 0x00, 0x00, 0xc0, 0xff, 0xcf, 0x07, 0x00, 0x00, 0xc0, 0xff, 0x3f, + 0x07, 0x00, 0x00, 0x7c, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x3e, 0xfc, 0xff, + 0x01, 0x00, 0x00, 0x00, 0xec, 0xff, 0x03, 0x00, 0x00, 0x00, 0x18, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach165.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach165.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach165.xbm @@ -0,0 +1,30 @@ +#define roach165_width 48 +#define roach165_height 48 + +static char roach165_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x06, 0x00, + 0x00, 0x00, 0x80, 0x1f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1c, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x18, 0x00, 0x00, 0x80, 0x00, 0xc0, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x00, 0x44, 0xf8, 0x1f, 0x3e, + 0x0e, 0x00, 0x30, 0x7c, 0xff, 0xe0, 0x07, 0x00, 0xe0, 0x7e, 0xff, 0x03, + 0x00, 0x00, 0xf0, 0x7e, 0xff, 0x07, 0x00, 0x00, 0x70, 0xff, 0xff, 0x3f, + 0x00, 0x00, 0x70, 0xff, 0xff, 0xff, 0x00, 0x00, 0x60, 0x7f, 0xff, 0xff, + 0x01, 0x00, 0x50, 0x7f, 0x80, 0xff, 0x0f, 0x00, 0x00, 0x3f, 0x1f, 0xf8, + 0x1f, 0x00, 0x00, 0xbf, 0xff, 0x01, 0x1f, 0x00, 0x00, 0xde, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0xec, 0xff, 0xff, 0x01, 0x00, 0x3e, 0xf0, 0xff, 0xff, + 0x07, 0x00, 0xff, 0x8f, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x07, 0xf9, 0xff, + 0x07, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x30, 0x00, + 0x00, 0x00, 0x00, 0x70, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach180.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach180.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach180.xbm @@ -0,0 +1,30 @@ +#define roach180_width 48 +#define roach180_height 48 + +static char roach180_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, + 0x02, 0x00, 0x08, 0x80, 0x01, 0x00, 0x01, 0x00, 0xf8, 0x81, 0x03, 0x80, + 0x01, 0x00, 0xe0, 0x0f, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x10, 0x84, 0x07, + 0x00, 0x00, 0x00, 0x20, 0x84, 0x01, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x8c, 0xff, 0xff, 0x01, 0x00, 0x00, 0x9c, 0xff, 0xff, + 0x07, 0x00, 0x20, 0xbe, 0xff, 0xff, 0x0f, 0x00, 0xe0, 0x7f, 0xff, 0xff, + 0x1f, 0x00, 0xf0, 0x7f, 0xff, 0xff, 0x0f, 0x00, 0x70, 0x7f, 0x00, 0x00, + 0x00, 0x00, 0x70, 0x7f, 0xff, 0xff, 0x0f, 0x00, 0x70, 0x7f, 0xff, 0xff, + 0x1f, 0x00, 0x48, 0x7f, 0xff, 0xff, 0x1f, 0x80, 0x20, 0x7f, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0xbe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x9c, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x48, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x20, 0xc4, 0x00, + 0x00, 0x00, 0xf0, 0x1f, 0x8c, 0xff, 0x00, 0x00, 0xf8, 0x03, 0x07, 0x80, + 0x01, 0x00, 0x18, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, + 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach195.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach195.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach195.xbm @@ -0,0 +1,30 @@ +#define roach195_width 48 +#define roach195_height 48 + +static char roach195_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x1c, + 0x00, 0x00, 0x00, 0x38, 0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0xe0, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf1, 0xff, + 0x01, 0x00, 0xe7, 0x07, 0xff, 0xff, 0x07, 0x00, 0xfc, 0x1c, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, 0xff, 0x3f, + 0x08, 0x00, 0x00, 0xde, 0xff, 0xc3, 0x1f, 0x00, 0x00, 0xbe, 0x3f, 0xfc, + 0x1f, 0x00, 0x00, 0x7f, 0xc3, 0xff, 0x1f, 0x00, 0x20, 0x7f, 0xfc, 0xff, + 0x0f, 0x00, 0x60, 0x7f, 0xff, 0xff, 0x01, 0x00, 0x70, 0x7f, 0xff, 0x7f, + 0x00, 0x00, 0x70, 0xfe, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0xfe, 0xff, 0x07, + 0x00, 0x00, 0xe0, 0xfe, 0xff, 0xc1, 0x03, 0x00, 0x10, 0xfd, 0x7f, 0xff, + 0x0f, 0x00, 0xc0, 0x78, 0x11, 0x00, 0x18, 0x00, 0x02, 0xb0, 0x20, 0x00, + 0x00, 0x00, 0x01, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x7c, 0x1c, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x0c, 0x00, + 0x00, 0x00, 0xc0, 0x01, 0x04, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach210.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach210.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach210.xbm @@ -0,0 +1,30 @@ +#define roach210_width 48 +#define roach210_height 48 + +static char roach210_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xf0, + 0x00, 0x00, 0x00, 0x00, 0x18, 0xff, 0x01, 0x00, 0x00, 0x03, 0x8c, 0xff, + 0x01, 0x00, 0x00, 0x3e, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x60, 0xfc, 0x1f, + 0x04, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0x0f, 0x00, 0x00, 0xc0, 0xff, 0xc3, + 0x0f, 0x00, 0x80, 0xe7, 0xff, 0xf0, 0x07, 0x00, 0xf0, 0xf8, 0x3f, 0xfc, + 0x03, 0x00, 0x7f, 0xf0, 0x1f, 0xff, 0x01, 0x00, 0x0e, 0xcc, 0xc7, 0xff, + 0x00, 0x00, 0x00, 0x9e, 0xf1, 0x7f, 0x00, 0x00, 0x00, 0x3f, 0xfc, 0x3f, + 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x0f, 0x0f, 0x00, 0x00, 0xff, 0xfe, 0x87, + 0x33, 0x00, 0xa0, 0xff, 0xfe, 0xff, 0x00, 0x00, 0xe0, 0xff, 0xfd, 0x1c, + 0x00, 0x00, 0xf0, 0xff, 0x7d, 0x00, 0x00, 0x00, 0xe3, 0xfd, 0xfd, 0x00, + 0x00, 0x00, 0xe0, 0xf9, 0x85, 0x00, 0x00, 0x00, 0xc0, 0xf1, 0xc7, 0x00, + 0x00, 0x00, 0x40, 0xc2, 0xc2, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x00, + 0x00, 0x00, 0x20, 0x80, 0x63, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x20, 0x00, + 0x00, 0x00, 0x08, 0x70, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach225.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach225.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach225.xbm @@ -0,0 +1,30 @@ +#define roach225_width 48 +#define roach225_height 48 + +static char roach225_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0xc6, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x9f, + 0x01, 0x00, 0x00, 0x00, 0xf1, 0xcf, 0x01, 0x00, 0x00, 0x00, 0xf9, 0xe7, + 0x01, 0x00, 0x00, 0x00, 0xff, 0xf3, 0x01, 0x00, 0x00, 0x0f, 0xff, 0xf9, + 0x01, 0x00, 0xc0, 0x1f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x7e, + 0x00, 0x00, 0x00, 0xe0, 0x9f, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xcf, 0x3f, + 0x3e, 0x00, 0x80, 0xff, 0xe7, 0x1f, 0x07, 0x00, 0xc0, 0xf0, 0xf3, 0xdf, + 0x03, 0x00, 0x70, 0xe0, 0xf9, 0xcf, 0x00, 0x00, 0x38, 0x3c, 0xfc, 0x67, + 0x00, 0x00, 0x1e, 0x7e, 0xfe, 0x1f, 0x00, 0x80, 0x0f, 0xfe, 0xfc, 0x01, + 0x00, 0x00, 0x00, 0xfe, 0xfd, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xfb, 0x01, + 0x00, 0x00, 0x00, 0xff, 0x7b, 0x03, 0x00, 0x00, 0x00, 0xfd, 0x0f, 0x03, + 0x00, 0x00, 0x80, 0xf9, 0x1f, 0x03, 0x00, 0x00, 0xc0, 0xe3, 0x1f, 0x03, + 0x00, 0x00, 0x80, 0x9f, 0x1b, 0x01, 0x00, 0x00, 0x00, 0x07, 0x18, 0x01, + 0x00, 0x00, 0x02, 0x08, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach240.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach240.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach240.xbm @@ -0,0 +1,30 @@ +#define roach240_width 48 +#define roach240_height 48 + +static char roach240_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x80, 0xc1, 0x03, 0x00, 0x00, 0x00, 0x80, 0xf1, 0x11, + 0x00, 0x00, 0x00, 0x80, 0xf8, 0x18, 0x00, 0x00, 0x00, 0x80, 0xf8, 0x3c, + 0x00, 0x00, 0x00, 0x40, 0x7c, 0x3c, 0x00, 0x00, 0x00, 0x40, 0x7e, 0x3e, + 0x00, 0x00, 0x00, 0x20, 0x3f, 0x1e, 0x00, 0x00, 0x00, 0xa0, 0x3f, 0x1f, + 0x00, 0x00, 0x00, 0xe0, 0x9f, 0x1f, 0x3e, 0x00, 0x00, 0xc0, 0x9f, 0x0f, + 0x07, 0x00, 0x00, 0xc0, 0xcf, 0x8f, 0x00, 0x00, 0x00, 0xe6, 0xe7, 0xcf, + 0x00, 0x00, 0xc0, 0xf9, 0xe7, 0x47, 0x00, 0x00, 0x00, 0xf0, 0xf3, 0x67, + 0x00, 0x00, 0x00, 0xf8, 0xf3, 0x37, 0x00, 0x00, 0x00, 0xf8, 0xf9, 0x1f, + 0x00, 0x00, 0x00, 0xff, 0xfd, 0x07, 0x00, 0x00, 0xc0, 0x03, 0xfc, 0x01, + 0x00, 0x00, 0x60, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x30, 0xfc, 0xfc, 0x03, + 0x00, 0x00, 0x30, 0xfe, 0xfb, 0x06, 0x00, 0x00, 0x30, 0xfe, 0x77, 0x06, + 0x00, 0x00, 0x1c, 0xfc, 0x37, 0x06, 0x00, 0x00, 0x02, 0xfc, 0x2f, 0x06, + 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x04, 0x00, 0x00, 0x00, 0xe5, 0x6f, 0x0c, + 0x00, 0x00, 0x00, 0x8e, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x00, + 0x00, 0x00, 0x00, 0x3e, 0x20, 0x00, 0x00, 0x00, 0x80, 0xf0, 0x30, 0x00, + 0x00, 0x00, 0x40, 0x10, 0x30, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach255.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach255.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach255.xbm @@ -0,0 +1,30 @@ +#define roach255_width 48 +#define roach255_height 48 + +static char roach255_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x18, 0x00, 0x00, 0x00, 0x00, 0x06, 0x9c, 0x01, + 0x00, 0x00, 0x00, 0x0c, 0x9e, 0x03, 0x00, 0x00, 0x00, 0x18, 0x8f, 0x03, + 0x00, 0x00, 0x00, 0x18, 0xcf, 0x03, 0x00, 0x00, 0x00, 0x98, 0xcf, 0x03, + 0x00, 0x00, 0x00, 0x88, 0xcf, 0x83, 0x01, 0x00, 0x00, 0xc8, 0xc7, 0xe3, + 0x00, 0x00, 0x00, 0xc8, 0xe7, 0x63, 0x00, 0x00, 0x00, 0xec, 0xe7, 0x33, + 0x00, 0x00, 0x00, 0xec, 0xe7, 0x33, 0x00, 0x00, 0x00, 0xf8, 0xe3, 0x13, + 0x00, 0x00, 0x00, 0xf8, 0xf3, 0x1b, 0x00, 0x00, 0x00, 0xf0, 0xf3, 0x1b, + 0x00, 0x00, 0x00, 0xf0, 0xf3, 0x09, 0x00, 0x00, 0x80, 0xff, 0xf9, 0x07, + 0x00, 0x00, 0xc0, 0xf8, 0xf9, 0x01, 0x00, 0x00, 0xe0, 0xf8, 0xf9, 0x01, + 0x00, 0x00, 0x10, 0xfc, 0xf9, 0x01, 0x00, 0x00, 0x00, 0xfc, 0xfc, 0x07, + 0x00, 0x00, 0x00, 0x02, 0xfc, 0x0c, 0x00, 0x00, 0x00, 0x01, 0xf8, 0x0c, + 0x00, 0x00, 0x80, 0xf8, 0x63, 0x18, 0x00, 0x00, 0xc0, 0xfc, 0x6f, 0x18, + 0x00, 0x00, 0x60, 0xfc, 0x9f, 0x30, 0x00, 0x00, 0x60, 0xfc, 0x3f, 0x01, + 0x00, 0x00, 0x60, 0xf8, 0x3f, 0x01, 0x00, 0x00, 0x20, 0xe0, 0x3f, 0x01, + 0x00, 0x00, 0x38, 0xb0, 0x8f, 0x01, 0x00, 0x00, 0x08, 0xf4, 0x83, 0x01, + 0x00, 0x00, 0x00, 0xf0, 0x81, 0x01, 0x00, 0x00, 0x00, 0xf0, 0x85, 0x00, + 0x00, 0x00, 0x00, 0x08, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x81, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach270.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach270.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach270.xbm @@ -0,0 +1,30 @@ +#define roach270_width 48 +#define roach270_height 48 + +static char roach270_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0x1c, 0x00, 0x00, 0x00, 0x20, 0xf0, 0x3c, 0x18, + 0x00, 0x00, 0xc0, 0xf0, 0x3c, 0x0c, 0x00, 0x00, 0x80, 0xf1, 0x3c, 0x06, + 0x00, 0x00, 0x00, 0xf9, 0x7c, 0x06, 0x00, 0x00, 0x00, 0xf9, 0x7c, 0x06, + 0x00, 0x00, 0x00, 0xf9, 0x7c, 0x06, 0x00, 0x00, 0x00, 0xf9, 0x7c, 0x06, + 0x00, 0x00, 0x00, 0xf9, 0x7c, 0x06, 0x00, 0x00, 0x00, 0xfb, 0x7c, 0x02, + 0x00, 0x00, 0x00, 0xff, 0xfc, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xfc, 0x01, + 0x00, 0x00, 0x00, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0x00, + 0x00, 0x00, 0x00, 0xf8, 0xfc, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfc, 0x07, + 0x00, 0x00, 0x80, 0xfc, 0xfc, 0x0c, 0x00, 0x00, 0xc0, 0xfc, 0xfc, 0x18, + 0x00, 0x00, 0x60, 0x78, 0xfc, 0x10, 0x00, 0x00, 0x30, 0x18, 0xc0, 0x20, + 0x00, 0x00, 0x00, 0xc6, 0x1f, 0x01, 0x00, 0x00, 0x00, 0xe3, 0x7f, 0x02, + 0x00, 0x00, 0x00, 0xf1, 0xff, 0x06, 0x00, 0x00, 0x80, 0xf1, 0xff, 0x06, + 0x00, 0x00, 0x80, 0xf1, 0xff, 0x06, 0x00, 0x00, 0x80, 0xe1, 0x7f, 0x06, + 0x00, 0x00, 0x80, 0x81, 0x1f, 0x06, 0x00, 0x00, 0x80, 0x81, 0x0f, 0x04, + 0x00, 0x00, 0x80, 0x81, 0x2f, 0x04, 0x00, 0x00, 0xc0, 0x80, 0x0f, 0x0c, + 0x00, 0x00, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach285.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach285.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach285.xbm @@ -0,0 +1,30 @@ +#define roach285_width 48 +#define roach285_height 48 + +static char roach285_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x80, 0x00, + 0x00, 0x00, 0x00, 0xe6, 0xc1, 0x00, 0x00, 0x00, 0x00, 0xcf, 0x63, 0x00, + 0x00, 0x00, 0x00, 0xcf, 0x47, 0x00, 0x00, 0x00, 0x00, 0xcf, 0x47, 0x00, + 0x00, 0x00, 0x03, 0xdf, 0x4f, 0x00, 0x00, 0x00, 0x1c, 0x9f, 0xcf, 0x00, + 0x00, 0x00, 0x30, 0x9f, 0x9f, 0x00, 0x00, 0x00, 0x30, 0xbf, 0x9f, 0x00, + 0x00, 0x00, 0x20, 0xbf, 0xbf, 0x00, 0x00, 0x00, 0x40, 0x3e, 0xff, 0x00, + 0x00, 0x00, 0x40, 0x3e, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0x7e, 0x7f, 0x00, + 0x00, 0x00, 0xc0, 0x7f, 0x7f, 0x03, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x07, + 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x1c, 0x00, 0x00, 0x00, 0xfc, 0xfe, 0x18, + 0x00, 0x00, 0x00, 0xfc, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfd, 0x00, + 0x00, 0x00, 0x00, 0xfd, 0x01, 0x07, 0x00, 0x00, 0x80, 0x7c, 0xf8, 0x0e, + 0x00, 0x00, 0xc0, 0xb8, 0xff, 0x0d, 0x00, 0x00, 0x40, 0xd8, 0xff, 0x09, + 0x00, 0x00, 0x00, 0xcc, 0xff, 0x19, 0x00, 0x00, 0x00, 0xee, 0xff, 0x19, + 0x00, 0x00, 0x00, 0xe6, 0xff, 0x18, 0x00, 0x00, 0x00, 0xc6, 0x7f, 0x30, + 0x00, 0x00, 0x00, 0x86, 0x7f, 0x60, 0x00, 0x00, 0x00, 0x06, 0x7e, 0xc1, + 0x00, 0x00, 0x00, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xbc, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach300.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach300.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach300.xbm @@ -0,0 +1,30 @@ +#define roach300_width 48 +#define roach300_height 48 + +static char roach300_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x1f, 0x06, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x04, 0x00, + 0x00, 0x00, 0x60, 0x7c, 0x0c, 0x00, 0x00, 0x00, 0xe0, 0x7c, 0x0c, 0x00, + 0x00, 0x00, 0xf0, 0xf8, 0x08, 0x00, 0x00, 0x00, 0xe0, 0xf9, 0x11, 0x00, + 0x00, 0x00, 0xe0, 0xf3, 0x13, 0x00, 0x00, 0x00, 0xe0, 0xf3, 0x17, 0x00, + 0x00, 0x00, 0xc0, 0xe7, 0x1f, 0x00, 0x00, 0xc0, 0xc7, 0xc7, 0x1f, 0x00, + 0x00, 0x00, 0xcc, 0xcf, 0x9f, 0x00, 0x00, 0x00, 0x88, 0x9f, 0xff, 0x07, + 0x00, 0x00, 0x98, 0x9f, 0xff, 0x3c, 0x00, 0x00, 0xb0, 0x3f, 0x7f, 0x00, + 0x00, 0x00, 0x60, 0x7f, 0xff, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0xfe, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0x7e, 0x0f, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x1c, + 0x00, 0x00, 0x00, 0xfc, 0xf1, 0x19, 0x00, 0x00, 0x00, 0x7e, 0xf8, 0x33, + 0x00, 0x00, 0x00, 0x79, 0xfc, 0x63, 0x00, 0x00, 0x80, 0x31, 0xfe, 0x63, + 0x00, 0x00, 0x80, 0x31, 0xff, 0xc3, 0x01, 0x00, 0x80, 0x91, 0xff, 0x01, + 0x03, 0x00, 0x80, 0x91, 0xff, 0x04, 0x00, 0x00, 0x80, 0x98, 0x7f, 0x01, + 0x00, 0x00, 0x00, 0x18, 0xff, 0x03, 0x00, 0x00, 0x00, 0x10, 0xf0, 0x05, + 0x00, 0x00, 0x00, 0x30, 0x60, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach315.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach315.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach315.xbm @@ -0,0 +1,30 @@ +#define roach315_width 48 +#define roach315_height 48 + +static char roach315_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x00, 0x00, + 0x00, 0x00, 0xf0, 0xe1, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc7, 0x01, 0x00, + 0x00, 0x00, 0xe0, 0x9f, 0x01, 0x00, 0x00, 0x00, 0xc6, 0x3f, 0x02, 0x00, + 0x00, 0x00, 0x8e, 0x7f, 0x06, 0x00, 0x00, 0x00, 0x1e, 0xff, 0x06, 0x00, + 0x00, 0x00, 0x3e, 0xfe, 0xc3, 0x00, 0x00, 0x00, 0x7c, 0xfc, 0xe7, 0x1f, + 0x00, 0x00, 0xfc, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0xf8, 0xf1, 0x1f, 0x00, + 0x00, 0x00, 0xf8, 0xe7, 0x3f, 0x00, 0x00, 0x80, 0xf1, 0xcf, 0x3f, 0x02, + 0x00, 0x00, 0xe6, 0x9f, 0xff, 0x07, 0x00, 0x00, 0xcc, 0x3f, 0x1f, 0x08, + 0x00, 0x00, 0x9c, 0x7f, 0xce, 0x31, 0x00, 0x00, 0xf0, 0xff, 0xe0, 0x63, + 0x00, 0x00, 0xc0, 0xfe, 0xf1, 0xe7, 0x03, 0x00, 0x00, 0xfc, 0xf9, 0xc7, + 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x07, 0x00, 0x00, 0x00, 0xfe, 0xfc, 0x03, + 0x00, 0x00, 0x00, 0x62, 0xfe, 0x05, 0x00, 0x00, 0x00, 0x42, 0xfe, 0x0e, + 0x00, 0x00, 0x00, 0x42, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x46, 0xfe, 0x47, + 0x00, 0x00, 0x00, 0x66, 0x84, 0x03, 0x00, 0x00, 0x00, 0xc2, 0x40, 0x00, + 0x04, 0x00, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x04, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach330.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach330.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach330.xbm @@ -0,0 +1,30 @@ +#define roach330_width 48 +#define roach330_height 48 + +static char roach330_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x60, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0xc1, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x8f, 0xf0, 0x01, + 0x00, 0x00, 0xf8, 0xff, 0x38, 0x00, 0x00, 0x80, 0xe0, 0xff, 0x0f, 0x00, + 0x00, 0x80, 0xc3, 0xff, 0x07, 0x00, 0x00, 0x80, 0x0f, 0xff, 0x1f, 0x03, + 0x00, 0x80, 0x3f, 0xfc, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xf0, 0x7f, 0x38, + 0x00, 0x00, 0xfe, 0xe3, 0x8f, 0xe1, 0x07, 0x00, 0xf8, 0x8f, 0xc7, 0xc3, + 0x00, 0x00, 0xf0, 0x3f, 0xe6, 0x07, 0x00, 0x00, 0xe1, 0xff, 0xf0, 0x07, + 0x00, 0xc0, 0xc7, 0xff, 0xf9, 0x07, 0x00, 0x30, 0xbc, 0xff, 0xf9, 0x07, + 0x00, 0x00, 0xf0, 0xfd, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0xf8, 0xfd, 0x7f, + 0x00, 0x00, 0x00, 0xf0, 0xfc, 0x1d, 0x08, 0x00, 0x00, 0xc8, 0xfd, 0x1e, + 0x00, 0x00, 0x00, 0x0c, 0x7d, 0x06, 0x00, 0x00, 0x00, 0x08, 0x19, 0x02, + 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach345.xbm b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach345.xbm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/bitmaps/roach345.xbm @@ -0,0 +1,30 @@ +#define roach345_width 48 +#define roach345_height 48 + +static char roach345_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x0e, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, + 0x00, 0x00, 0xff, 0x23, 0x03, 0x00, 0x00, 0x80, 0xff, 0xff, 0x83, 0x03, + 0x00, 0xc0, 0xff, 0xff, 0xe3, 0xff, 0x03, 0x80, 0xff, 0xff, 0x3f, 0x70, + 0x00, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0x00, 0x40, 0x00, 0xff, 0xcf, 0x03, + 0x00, 0xe0, 0x0f, 0xf0, 0xef, 0x03, 0x00, 0xc0, 0x7f, 0x00, 0xf7, 0x07, + 0x00, 0xc0, 0xff, 0x07, 0xf0, 0x07, 0x00, 0x00, 0xff, 0x7f, 0xf0, 0xff, + 0x13, 0x00, 0xfe, 0xff, 0xf1, 0x3f, 0x00, 0x00, 0xf0, 0xff, 0xf9, 0x3b, + 0x00, 0x00, 0xc0, 0xff, 0xf9, 0x1f, 0x00, 0x00, 0x82, 0xff, 0xfb, 0x1f, + 0x00, 0x00, 0xff, 0xfb, 0xfb, 0x03, 0x00, 0x80, 0xe1, 0xe1, 0xf3, 0x81, + 0x00, 0x40, 0x00, 0x30, 0x62, 0x00, 0x02, 0x00, 0x00, 0x30, 0x04, 0x00, + 0x04, 0x00, 0x00, 0x60, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x78, 0x00, + 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00}; + diff --git a/packages/services/gfx/mw/current/src/demos/nxroach/nxroach.c b/packages/services/gfx/mw/current/src/demos/nxroach/nxroach.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/demos/nxroach/nxroach.c @@ -0,0 +1,499 @@ +/* + Xroach - A game of skill. Try to find the roaches under your windows. + Ported to Nano-X by Greg Haerr + + Copyright 1991 by J.T. Anderson + jta@locus.com + + This program may be freely distributed provided that all + copyright notices are retained. + + Dedicated to Greg McFarlane. (gregm@otc.otca.oz.au) +*/ +char Copyright[] = "nxroach\nCopyright 1991 J.T. Anderson"; + +#include +#include +#include +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + +#define None 0 +#define Pixmap GR_WINDOW_ID +#include "roachmap.h" + +#define SCAMPER_EVENT 99 + +typedef struct Roach { + RoachMap *rp; + int index; + float x; + float y; + int intX; + int intY; + int hidden; + int turnLeft; + int steps; +} Roach; + +GR_COORD display_width, display_height; +GR_GC_ID gc; +GR_COLOR roachColor = BLACK; +GR_REGION_ID rootVisible = 0; +GR_BOOL done = GR_FALSE; +GR_BOOL eventBlock = GR_FALSE; + +Roach *roaches; +int maxRoaches = 10; +int curRoaches = 0; +float roachSpeed = 20.0; + +void Usage(void); +void SigHandler(int sig); +void AddRoach(void); +void MoveRoach(int Rx); +void DrawRoaches(void); +void CoverRoot(void); +int CalcRootVisible(void); +int MarkHiddenRoaches(void); + +int +main(int ac, char **av) +{ + int ax; + char *arg; + RoachMap *rp; + int rx; + float angle; + GR_EVENT ev; + int nVis; + int needCalc; + GR_SCREEN_INFO sinfo; + + /* + Process command line options. + */ + for (ax=1; axpixmap = GrNewPixmapFromData(rp->width, rp->height, WHITE, BLACK, + rp->roachBits, GR_BMDATA_BYTEREVERSE|GR_BMDATA_BYTESWAP); + rp->sine = sin(angle); + rp->cosine = cos(angle); + } + + roaches = (Roach *)malloc(sizeof(Roach) * maxRoaches); + + gc = GrNewGC(); + + while (curRoaches < maxRoaches) + AddRoach(); + + GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CHLD_UPDATE); + + needCalc = 1; + while (!done) { + if (GrPeekEvent(&ev)) + GrGetNextEvent(&ev); + else { + if (needCalc) { + needCalc = CalcRootVisible(); + } + nVis = MarkHiddenRoaches(); + if (nVis) { + ev.type = SCAMPER_EVENT; + } + else { + DrawRoaches(); + eventBlock = GR_TRUE; + GrGetNextEvent(&ev); + eventBlock = GR_FALSE; + } + } + + switch (ev.type) { + case SCAMPER_EVENT: + for (rx=0; rxrp->width) > (x + width)) return 0; + if (ry < y) return 0; + if ((ry + roach->rp->height) > (y + height)) return 0; + + return 1; +} + +/* + Check for roach overlapping specified rectangle. +*/ +int +RoachOverRect(Roach *roach, int rx, int ry, int x, int y, + unsigned int width, unsigned int height) +{ + if (rx >= (x + width)) return 0; + if ((rx + roach->rp->width) <= x) return 0; + if (ry >= (y + height)) return 0; + if ((ry + roach->rp->height) <= y) return 0; + + return 1; +} + +/* + Give birth to a roach. +*/ +void +AddRoach(void) +{ + Roach *r; + + if (curRoaches < maxRoaches) { + r = &roaches[curRoaches++]; + r->index = RandInt(ROACH_HEADINGS); + r->rp = &roachPix[r->index]; + r->x = RandInt(display_width - r->rp->width); + r->y = RandInt(display_height - r->rp->height); + r->intX = -1; + r->intY = -1; + r->hidden = 0; + r->steps = RandInt(200); + r->turnLeft = RandInt(100) >= 50; + } +} + +/* + Turn a roach. +*/ +void +TurnRoach(Roach *roach) +{ + if (roach->index != (roach->rp - roachPix)) return; + + if (roach->turnLeft) { + roach->index += (RandInt(30) / 10) + 1; + if (roach->index >= ROACH_HEADINGS) + roach->index -= ROACH_HEADINGS; + } + else { + roach->index -= (RandInt(30) / 10) + 1; + if (roach->index < 0) + roach->index += ROACH_HEADINGS; + } +} + +/* + Move a roach. +*/ +void +MoveRoach(int rx) +{ + Roach *roach; + Roach *r2; + float newX; + float newY; + int ii; + + roach = &roaches[rx]; + newX = roach->x + (roachSpeed * roach->rp->cosine); + newY = roach->y - (roachSpeed * roach->rp->sine); + + if (RoachInRect(roach, (int)newX, (int)newY, + 0, 0, display_width, display_height)) { + + roach->x = newX; + roach->y = newY; + + if (roach->steps-- <= 0) { + TurnRoach(roach); + roach->steps = RandInt(200); + } + + for (ii=rx+1; iiintX, r2->intY, r2->rp->width, r2->rp->height)) { + + TurnRoach(roach); + } + } + } + else { + TurnRoach(roach); + } +} + +/* + Draw all roaches. +*/ +void +DrawRoaches(void) +{ + Roach *roach; + int rx; + + for (rx=0; rxintX >= 0) { + GrClearArea(GR_ROOT_WINDOW_ID, roach->intX, roach->intY, + roach->rp->width, roach->rp->height, GR_FALSE); + } + } + + for (rx=0; rxhidden) { + int size = roach->rp->width * roach->rp->height; + GR_PIXELVAL roachbuf[size]; + GR_PIXELVAL screenbuf[size]; + int i; + + roach->intX = roach->x; + roach->intY = roach->y; + roach->rp = &roachPix[roach->index]; + + /* + //XSetForeground(display, gc, AllocNamedColor(roachColor, black)); + //XSetFillStyle(display, gc, FillStippled); + //XSetStipple(display, gc, roach->rp->pixmap); + //XSetTSOrigin(display, gc, roach->intX, roach->intY); + //XFillRectangle(display, rootWin, gc, + //roach->intX, roach->intY, roach->rp->width, roach->rp->height); + */ + + /* read roach bitmap*/ + GrReadArea(roach->rp->pixmap, 0, 0, + roach->rp->width, roach->rp->height, roachbuf); + + /* read root window*/ + GrReadArea(GR_ROOT_WINDOW_ID, roach->intX, roach->intY, + roach->rp->width, roach->rp->height, screenbuf); + + /* convert fg roach bitmap bits to roach color on root window bits*/ + for (i=0; iintX, roach->intY, + roach->rp->width, roach->rp->height, screenbuf, MWPF_PIXELVAL); + } + else { + roach->intX = -1; + } + } + GrFlush(); +} + +/* + Cover root window to erase roaches. +*/ +void +CoverRoot(void) +{ + GR_WINDOW_ID roachWin; + + roachWin = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, display_width, display_height, + 0, CYAN, BLACK); + GrLowerWindow(roachWin); + GrMapWindow(roachWin); + GrFlush(); +} + +/* + Calculate Visible region of root window. +*/ +int +CalcRootVisible(void) +{ + GR_REGION_ID covered; + GR_REGION_ID visible; + GR_WINDOW_ID parent; + GR_WINDOW_ID *children; + GR_COUNT nChildren; + GR_COUNT wx; + GR_RECT rect; + GR_WINDOW_INFO info; + + /* + Get children of root. + */ + GrQueryTree(GR_ROOT_WINDOW_ID, &parent, &children, &nChildren); + + /* + For each mapped child, add the window rectangle to the covered + region. + */ + covered = GrNewRegion(); + for (wx=0; wx^wQlj^_cw2Tc=N;WKm5=4AFb&EAU$Y^Z`I{-r4pnm*X_b}2_@|X;M0)2%N3Sx zI3*4+TPS&)*gtV!1G-A-Q^bgM1mq8?Ql*SFV(;z1YzfUVL|Ri&%cqw(V*DlOTEc;` zWo_`#Q07o@OmIxuMHpbPH_;iF(c3c}GT!mOmE20M?ux#Mv<;K=4tn@5e>d}RF8b>Eyi6nG=oHEq+N z4Qe)z&Nc`^wo};`M3duEmB}P7a7&eZ5}5KEwY@L~ZMeAV6jm2$I}7Dl65g$I;tUX9 ztx{r7(}j77{JlXLIi)2&{zCkv3-R%V@j}oEzwh5ML$$3jZ!J82{MFmH|NN_We*4>H z_uO;OM<0Fk&O4XKj$OHD@{ZG|w=fE;Bqg~d-Q$$2HGNxENir0wn~xpCrJdEIMx8u) z@|$&wUwL$%YZ|;;x5|T%9+gRz(WS~&L2<{Y{T;q_IYf8P2J*ct4Y*OXA*clhmoOF`asWDyjo)QnEE^F#`*D6=lvn?J@K=BT z`#pdE``_RB^Vs8YaVu9|Ub$z_Wrnqkl@QS*t+b^K6Q$gW6Ro3;A>qE&`(Ug-Hfq$7 zg5>uok%TnKv5#B)gBehi`1;ZwojfmCgSLGs#D%GX_SeG>aJ($QT> z6LgS)!Xa~@MKmZI`e+A>$z*E5!-9bFQejJM;l@kx1381;AFM6w=?OVJajbB(^sBG_ z`Om+CF?Q_O<8$KT_UzfSGA=GouvJhG5OIwTmm=welh&%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!?eWbUqM=ps6hueaUeP<7sS zTRO1j7r%uO1%8A3@_h#w1(}%k^jwfqq;1p!;%*1jlvsR0#(um2V$`Cq0W7bLLe0~D zW%bA{vo=k6w>PK=lkFIugG87Yrv|M#{}?4Xs}2s5^%3*ML}X=@V-@4PyVD2P|f#=4E(t>jP=H6b<{ zJg&=DE<5QBH;@A+4cBHGN%^2AD%7y$X^g^1DU$Fsp(x`ugITMX$1@EGbHU+0g%M(W ze&r+_T$0^LcV@xQ8wHJTm#}`-@B$X{{6#$H1_VqgE5EhQ{HxBI-U!T8Qu^GqqP-;Lu@+0D_wSb)gGzrP>qYB0G#T3rQ z3J7D10d8BsF!f1se9muiLx+VbB+oxqV!Jb`6k*EshWD_;y}O>$T^rSkJ8gq9cT I#r22(03fuSk^lez diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/testimg.ppm b/packages/services/gfx/mw/current/src/jpeg-6b/testimg.ppm new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/testimg.ppm @@ -0,0 +1,4 @@ +P6 +227 149 +255 +0/-0/-10.21/51.51.62/62/83/83/:3-:3-:3-:3-:3-:3-:2/91.91.80-80-91.91.:2/80-80-80-80-80-80-80-80-6.+6.+6.+5-*5-*4,)4,)4,)4,)4,)4,)4,)4,)4,)4,)2-)/*$/,%/,%0-&1.'2/(30)30)63,63,74-85.85.96/:70:7.A:0B<0D>2F@4IA4JB5KC6KC6MD5MD5OC3NB2OC3OC3PD4RE5R?1Y?2b@4nB5}E6‹H8™G9£F7¯G:¸G9¾E:ÅG;ÇG>ÊG?ËH@ÐE@çFLíCLëDKëEIîCIïBDñ>Bô=Aø;A÷:@ô:?ð×?<ËA7»=/µ@.µ@.´?-´?-³@-²?-¯@-­@,ªA,¦A-¢B,Ÿ@*›A)˜@*–A,”>-’?/’?/‘>.‘>,=+’<+’<+”?+”?+”=*”=*”=*•>+–?,–@/–?6•>5—=2Ÿ?1©B3³D3¼D4¿D4¹?0µA2¬F8žH;‡H9oA2T8*C3&=5295495473271160050-50-72/72/72/61.61-50,50,41,//-.0-//-//-0/-0/-2.-2.-5,-4+,4*+3)*7(+=.1E69P:0U?1^A3jC4xD6„E4’E5œC3§C4¯A4µA4¼B7ÀD:ÄE<ÅF=ÍC@áEIçBIèCIêDHíDGïBDó@Cö?Cø;A÷:@ô:?ðÕ@<Ê@6¹>/µ@.´?-´?-´?-²?,°?-¯@-­@,©@+¦A-¡A+Ÿ@*›A)˜@*–A,”>-’?/‘>.‘>.‘>,=+’<+’<+”?+“>*”=*”=*”=*•>+–?,–@/”@5•>5˜>3 >1«A3µD4½C4¿D5»A2·C6¬F8œI;…G:l@3S9*B4)>63:6595484382271161.61.72/72/72/61.61-50,50,41,//-.0-//-//-0/-0/-2.-2.-3--5,-4*+3)*5)+<-0C47N8:d>=vEA†JINLšTV¤aj¥l}rŽ‘{¢†€®…¹{„»ou©[[QHuOCiOFeOG_PH_RN_[Yfnotƒ‡ˆ”™•™ž—š ”™‘ƒ~ojkY][LVSJXSZVRaXQa/.,/.,0/-10.40-40-51.51.72.72.72.72.92,92,92,92,91.80.7/-7/-7/-7/-80.91/80.80.80.80.80.80.80.80.6.,5-+5-+5-+4,*4,*4,*4,*5-+5-+5-+5-+5-+5-+5-+3.*2-'1.'2/(30)30)41*41*52+63,63,63,74-85.96/96/:7.?8.@:.B<0D>2G?4H@5H@3H@3I@1I@1K?1K?1K?/L@0MA1NB2MA1QA1YB2dC2qC3|C2‡B2’A0˜<- :+§;.¯=2µ@6ºD:¿F=ÅD>ÙCEá@FãBGçBFêDFðCEôADø?Dú;@ù:?õ;@ð=@è@@ÜA=Ñ@;Æ@5·=.³@-³@-²?,²?-°?-¯>,­@,ª?-§@-¥@,¡A+A,š?*˜@*•@+”>-‘>.‘>.‘>.=+=+=+=+‘>,‘>,’<+’<+“=,“=,”?+•?.•A6–?5š>3£>2¯A4¹C5¿D5ÁC5ÀD8¸F;®I=™J=G;h@4Q:,B5,?74=77<66:4494183072/72/62/62/62/51.52-41,41,21,.0-,1-.0-.0-//-//-0/-2.-5//4..5,-4*+4*+9-/>24I56[97l?9|E@†IDOM˜[`›fv”mˆŒwžƒ}­}‚¹u~·fm¤TV‰MEvLAkMAeOFcQHcMH^NK\[[eqty…‰ˆ‡Œ†Šˆ…†Š|xzlfiXZ[MVSLZU[ZT`[S`.-+/.,/.,0/-3/,40-40-40-61-61-61-61-81+81+81+81+7/-7/-6.,6.,6.,6.,7/-7/-80.80.80.80.80.80.80.80.5-+5-+5-+4,*4,*4,*3+)3+)6.,6.,6.,6.,6.,6.,6.,4/,30+30)30)41*41*52+52+52+52+52+63,74-85.85.96/96->7-?9-@:.B<0E=2E=2F>1F>1G=1G>/H<.I=/I=/J>.L@0JA0KD2NE4UD4^D3iD2sB1~A/†?-Œ9)”9'9*£<-¬@3³E8¸H<ÁF>ÒDCÚACÞBCâDCçCDìBCó@C÷?Aú;@ù:?õ;@î>@åA@ÚB=Í@9Â@3µ=-°@,°@,°@,¯>,®?,®?,¬?+©@-¦?,£@+ @*œ@+˜@*–@)”?*‘>,‘>.‘>.=-=+=+<*<*=+=+<*<*’<+‘>,”>-’?-•A6–?5œ>2¦@4²B6¼C8ÁC7ÂB7ÂF<ºJ?¬L@—K>|F:b@4L:.A7-@85>96=77<74:5294183083062/62/62/32.52-21,21,12--2.-2./1./1.00.00.10.10.5106005//5,-4+,6,-:01D22T71c;3qA7{E;‚HD‰RU_l‹i‚ƒs˜}y«x}µowµ`f¢QR‹LEyL@pL@hPEgQFfLC^GBVMLZ^^fjnquyxx}wz€vwzokoa`bTWYLTTL]WY]V]]V^------.-+/.,0/-10.3/,40-3/,3/,4/+4/+4/+4/+6/)6/)4/,4/,3.+3.+3.+3.+4/,4/,50-50-50-50-50-50-50-50-3.+3.+2-*2-*2-*1,)1,)1,)4/,4/,4/,4/,4/,4/,4/,4/,41,41,41,41,41,52-52-52-52-52-63.63.74/85096196/<5-=6,?8.@9/B:/C;0C;0C;.D:.D:.F:.G;-H<.I=/J>0I@1JG6MH5RG5YF5bE3jD1uB/}>,‚;)‹:)“:*š=,£B2¬F8²J=»I?ÌGBÔDCØDBÝEBâBBéAAð=@ô<>ù:?ø:<ô<>í?>áB>ÓC:ÅA5¹?0²?-®?,®?,®?,­>-¬>-¬>-ª?-¨>.¤?- ?,ž?+š?,—?+•>*“>*‘>,?.>->->-Ž=,Ž=,Ž=,Ž=,Ž=,Ž=,Ž=,<,>-‘>.?.”B4—A4@1¨@3¶A7¿C9ÅB8ÄA7¾C;·H?¦LCJ@tE;Z>2E9-<5+@93@85?75>63=52<4194083/62/43/43/23.32.12-12-02--2.,2.-2.-2./1./1.00.10.3205105104..2,,4+,7./=/.N5.Y9.e=1n@3sB;yKK€Zeƒg€p—zxªu{·ks´_d¦TT”OGƒLBwNAmNBhMAeJA`GBYGFXKKWMPU]cc`fbbia`f\Z`TW[MUXMXXP^YV`WX`WZ,,,,,,.-+.-+/.,0/-3/,3/,2.+2.+3.*3.*3.*3.*5.(5-*3.+3.+2-*1,)1,)2-*3.+3.+3.+3.+3.+3.+3.+3.+3.+3.+2-*2-*2-*2-*1,)1,)1,)0+(3.+3.+3.+3.+3.+3.+3.+3.+41,41,41,41,41,41,41,41,41,52-52-63.74/85085085.;4,<5+=6,>7-@7.A9.A9.A9.C9/C9-E9-F:.G;/H<.J>0HA1JG6IH6NG5VF6\E3dC2n@0v>-{<+‚;)Œ;*”=,œ@1£F5ªJ:´J=ÄH@ÌEAÑFAÖE@ÞCAä@>ì>?ñ:<÷;<ô:;ð<=é@=ÜC=ÍC8¾@2±>,®?,«@,ª?+ª?+ª?-©>,©>,¨?,¥>-¢?, ?,›>,—?+•>*“>)‘?*>+>->->-Ž=,Ž=,Ž=,<+Ž=,‹<+<+‹<+‹<-Œ=,>/Ž?.”B4—A2 @2¬B5¹C9ÂC:ÅB:ÂA;ºA9±I@£NGNEoG=S?4A;/96-@93A75?74>63<4194083/74/43/43/34/23.23.02-02-.3--3/-3/.3/.3/02/02/11/11/21/32032040/2.-1-,4..8.,G4-O4)X8+`<0e?6mGFyYd‚k…€uŸ||²w|¼nu»dh¯[[¡RMLB~OArL@hI=cH>`HB^ECX@BO;@FBGJDMJJQJJQIIQFKQEOUIVWO^YS`YS`XU++++++,,,---/.,/.,0/-0/-1-*1-*1-*1-*2-)2-)2-)2-)2-*2,,1++1++1++1++2,,2,,1++1++1++1++1++1++1++1++2,,2,,2,,1++1++1++0**0**3--3--3--3--3--3--3--3.+41,41,41,30+30+30+30+30+41,41,52-63.74/74/85085.:3+;4,<5-=6.?6/?6-?6-?7,B8.B8.E8/E9-G;/H<0J>2H@3HE6GF4KE5QD4XC2_B2f?.n=,v=,|:*…9)Œ;*“=.›B2¢F7¬F8»F<ÂF>ÉF>ÐE>ÙD@âC?ê@@ð>>ò::ñ;:ì<<äA<ÖC;ÆD6µ@/ª=)ª?-©@-©@-¨?,¨>.¨>.§=-¥>-£=. ?.ž?-š?-–?,“>*‘?*>)>+>->-Œ=,Œ=.Œ=.‹<-‹<-‹<-Š=-Š;,‰<,Š.‹=0Œ?/’C2˜B1¡A1®B6¼C:ÂC<ÄC=ÀC=¹FA²QJ¥XRXQsRIWI>CC793@72>71=60:5/94.83/63.43.43.34/13.13..3-.3-.3--3/-3/-3/-3/.3/.3/02/02/00.11/22021/0/-/.,2.-4/,?0+D0)K3)T8-Z<4dFFu]jƒs‰€«…„¾~ƒÇtzÆmp½ce¯VSšLC‚K?qI_FB]DBW?AN;?H:BE>HGDMHGQIGQHJRGNVKUXM^ZOaYNaXO++++++,,,,,,.,-/.,0/-0/-1-*1-*1-*1-*2-)2-)2-)2-*2,,1++1++0**0**1++1++2,,0**0**0**0**0**0**0**0**2,,2,,2,,1++1++0**0**0**2,,2,,2,,2,,2,,2,,2,,2,,3/,30+30+30+30+30+30+30+41,41,52-63.63.74/85085092,:3+;4,<5->5.>5.>5.>5,B8/B8.E8/E8/G:1I=1J>2I?3FC4FC4JB5OA4TA2\@2b>0j<-q<.w9*}8)…8(Œ:,•=/›B4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]OOymy‹…Ÿ“»”–ϕك‰ÓtzÆjn·_b§Z[”LItHBdA>]>>X?BUAIVLU\U`bbqnn}xv†|rulyoguh_k_W_P]\Hb\Fc]G,-/,-/,-/,-/------.,-.-+/.,.-+0,)0,)/+(/+(/+(/+(.*).*).*).*)/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*0,+0,+0,+1-,1-,1-,1-,1-,1-,1-,1-,1-,1-,0,+0,)1-*2.+3/,3/,2.+2.+2.+2.+2.+2.+3/,40-51.62/80.91.:2/;4.=4/>50>50=4-?4.?4.A4.B5-C6.E80G:2H;3H>5H>5L=6O>6Q=4V;2Z90_7/h70p7.w7-9-‰9.<1–<1›=1¢@3§A3¬B5´D8¾E:ÉF<ÔE=ÛD=ßD@àE@ÞFAÔG>ÄF8²C2¥B-žB-ŸC.žB-Ÿ@.ž?-ž?-ž?-ž>.ž>.š=,™>,–=-”=,=+>+Œ>*Œ=,‹<+Š=+‰<,‰<,‰<,‡;+‡;-…<-†2†@6‡A7ˆB6“G9—E7£G<¯J@¸IB¸GA·LF³TN±d\ªqfŸ~oo|mmseZfZNXMLNAKI=EC7@=4=:188.44,11)23-23-03,/2+/1,.0+.0+.0+/1.-2./1./1./1./1./1./1.02/02/11/11/11/11/11/2015+49-7<23?53H?:^VTxr|Šˆž““¹”—Ê–Ô„‹ÏyÂqy¸kt­hnž\_€XZqSUjRWjT^hZgmfvvr‚tˆ~’‡ƒ•‰~Žv†yr€qfteZeT[ZE`Z@b\D,-/,-/,-/,-/,-/,.-------.-+.-+.-+-,*/+(.*'.*'.*',+),*+,*+,*++)*+)*+)*+)*-+,-+,-+,-+,-+,-+,-+,-+,,*+,*+-+,-+,-+,.,-.,-.,-.,-.,-.,-/-./-./-./-./.,0,+0,+1-,2.-2.-2.-2.-1-,1-,1-,1-,1-,2.-3/.40/51.80.91.:2/;30=31=4/=4/=4/?40?4.A4.A4.C60D71F93G:4H;5J;6K<7N=6P;6S:5V72[6.c60k6.t5,}7/‡9/;0”<0–<1?3 @4¢@3¨@3±C6ºD8ÅE:ÍD:ÕF@×H@ÔIBÌI?¾E:®C3¡B.œA.B/œA.œ?.›>-›>-›>-›>/›?0˜<-–=-”<.“=.>-Œ=,‹<+Š=+‰<*‰<*‰<,‡;+‡;-…<-„:-ƒ;-„<0‚<0‚<2‚>3ƒ?4…A8‡C:ˆD9”J=—H; H>¬KD²KF³LG²SM®`V­sg¦qŒz‘Ž{‚‰ws€ocqbXcUNRDMN@HI;DD8@@49;.46+/1&01)01)/0*/0*./*./*//-//-//-.0-//-//-//-//-//-//-00.00.00.00.00.00.00.1/26+97+98/4;63HE>_^Yzz|‹š”±’—¿•Ç„ŽÃ}‰»{‰¶|‹²}Œ«}ˆšwƒq~‡n}‚n~~o‚~yŽ…ƒ™‹¡”‘¨˜¥”ˆŠƒ–ƒ|{j{i\hTXX@]Y<_[@-.0-.0-.0-.0-.0-.0.......-+.-+-,*-,*.*'.*'.*'.*),*++)*+)*+)*+)**()*()*(),*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+-+,-+,-+,-+,.,-.,-.,-.,-/-./-./-./+*0,+1-,1-,1-,1-,0,+0,+0,+0,+0,+0,+1-,2.-3/.40/91/:20;31<41=31=31=31=4/>3/>3/@2/@3-A4.C60D71E82F93H94I:5J;6L:6N94Q83T50^72e60o6/x8/‚90Š:/<1”>1™?4›?4›?2Ÿ?1¥A2®B5¸D7¿E:ÇG>ËH@ÊJAÃI>¶F:ªB5žA0™@.™A-™A-˜?-—>,—>,™>,™=.—>.•<,”=,“=.=-Ž=,Š=+Š=-‰<,ˆ;)ˆ;)‡;+‡;+„;,„;,ƒ;-€;,;/€<1€<1>5ƒ@7ƒC:‡D<ˆE<”L@–H<žG>§JC®LI®QL­]Vªj^§€o¡yšš‚›ƒ†•€z‹xm{jbm]SZJQUFKO@EI:@D6;=057,13(01)/0(./).-(.-).-)/.,0/-/.,/.,/.,/.,/.,..,/.,..,0/-//-0/-//-//-//-//-2-17,:6*83-1961HJ?bfX{€z‹““£–°Œ•¶ƒ²¯…™²¤¶’¨³“¨«¤£Œ ž‡ž˜‚™}˜‰œ‹ˆ£”°š˜±›”­—‹£…›„’|k|iXfOSV;ZV9^Z=+/2+/2+/2+/2-.0-.0......------.-+-,*-,*,+),+),+),*+,*+,*++)*+)**()*()*(),*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*++)*+)*+)*,*+-+,-+,.,-.,-/-./-./-./+*0,+0,+0,+0,+0,+/+*.*)/+*/+*/+*/+*0,+1-,3/.40/901:20;31<42=32=31<20<20=20=2.?1.?1.@2/A30B5/C60D63C84D95E:6G96H94K84N50X72_60i70r7/}:1†<1Œ>2>2—@6—?5—?5—?3œ@3£C5«C6³E8ºE;½G=¾H>¹G=°D8¦A5›?0—@/—@-—@-–?.•>-”=,•<,–=/–=/•<.“;-’0->0-?1.@2/A4.?4.@51@72@93A:4B94C84F74H5/Q51X5/a6/l8-u9.€0‹=1“?5•>5“?5“?4•B4šB4 C4¥D4¬B5°D8´E:±E;ªB7¡?4š>1–>0•?.”?+“=,“=,“<+“<+”<.”<.“;-’<-<.;-Š;,‰<,‡;+‡;+†:*†:*…9)ƒ:)ƒ:+9*9-9-€<1<3?6€A8‚C<…F?ˆIBŠICŽJAG>—HCŸNJ§VR§`Z©pe¤ƒrœ”}–¡ƒ¨Šˆ§ˆƒ „~–~yˆup{jdp\]iSR^JJS@BK:>E5:@29<134,22*1.)/,'/))0**1++2,,1++1++1++1++1++0,+0,+0,+1-,1-,1-,1-,/.,/.,/.,2,.8*75(13+(56&EK1\gGu‚d†“yޛБž”Ÿš‹ž˜¥——´ž¢Å¥©Î­¥É­¦Ê°§Ë±¤È¬—¾Ÿ‹³‘ˆ°²Ž²Ž²¬Š„¡‚€™{wŽrdx]Q_ENR7QQ5SR6,03,03,03,03./1./1./1./1/////////////.,/.,.-+.-+/-..,-.,--+,,*++)*+)**()+)*+)*+)*+)*+)*+)*+)*+)*+)*+)*+)**()*()*())'()'(+)*+)*,*+-+,.,-.,-/-./-./+*/+*/+*/+*/+*.*)-)(,('0,+0,+0,+0,+1-,2.-40/40/:12;23;23<34=32<21<21;10<1/<1/>0/=/.>0->0-?1.>3/=60;60;83<94=:5>93@72C60G4.O4+Y4+d5+n8,x:-;.…;.<4‘<5>3@3A2“B1—A2™@0 >1¦@4ªB7ªB9¥@6Ÿ>5—=2•?2’?-’?-‘>,=+‘;*‘;*’<-’<-‘;.‘;.Ž;-;-Š;.ˆ:-†:,„;,…9)…9)ƒ:)‚9(‚9*9*~8,~8,€<1€=4€@7B9„E>…IAˆKFŒMFŒIAŽH@˜JF¡SO¨]X©hb©{n¤Žy™œ’§†‰¬‹‚ªˆ€¡„™€~‹wxnjxadr[ZhQQ]IITCCL;>D60-?1.=2.=4-=6.;819919:29:2;81?6/C2+J1,T2)^3*g7+o9-u=.z2¢B6¡C7žB7™?4–>2”>1”>/“=.=-<,Ž=,Œ=,Œ=.>/Ž<.Ž<.‹2>5€@6‚C:ƒG=…JB‡NE‹OGŒICŽID“PJ˜\Tžg`uiž‡už˜€”¡…ª‰‰¬‹ƒ¨‡€¡„~›zytˆoi}bby]\pUUgOO\HGRAAH8=A388.85.7/,3+)2()2()3)*4*+0*,/+*0*,0**0*,0*,2),2),3*-1+-1+-1+-0,-0,-0,-1+/4)/4*+4-%46!?F%T`8m|Qg‰™tžz¡~ˆ¡zЧ{‘¶‚›ÄˆŸËŸÉ™žÇÆš˜Á•Œ·Š‚­€…®‚Œµ‰„«‰®…‰©‚~œxvolƒfZnSJZ?GM3FJ1DF./0+.0+/0+01,01,01,12-21-32.43/43/62/51.41,3/,4/,50-50-4/,3.+2,,1-,0,+0,+.,-.,---/--/,,.++-*).))+.)/.)-/(/.)-/)-.)-.*+.*+/+*/+*-,*.-)--+-.)./*./*------.,-/-./.,0/-2.+2.+2-*4,)5-*6.+8/*:1,:1*;2+=4-=4->50>50>50=4/<3.;2-=2.<1-<1/;0.=/.>0/>0/@1.A0)@2);4*77-39-28.56.:3-?-)F*'L)'S*&Z/(`5,d<0k@0yA0@/†A1‹B3@3“=0“;/’8-“;/“=.”A1•B2”C2’A0‘>.‘;,—;0—:2’;1Œ=0ˆ?0„?/‚?.ƒ>.ˆ@1ˆ?0Š>1Š<0‰;/ˆ:.†:-ƒ;-{9+~@3w<.q7)w>-w>-v;-}?2{;/‚@4‡E9‰I?ˆLA†MB„PC‡NE‘KI—SP”bY‘paŒ}j‰‰q‰–|Šž‚¤‡¦‰Ž§Š§Œ‡¤ˆ~Ÿ‚uš{o—uiib„_[zXZsUZnSWeNPWEJK=C?6@93;0.6**3')3'+3'+1&*,*-)+***,*(),'+.(,1(-2'-3(.3(.3(02(00)10)1/*1/*0/)-1++0-(//#5,>5,>5.>5.>5.=4-<3.<3.=2.<1-;0.;0.=/.=/.>0/@1.C0*C0)A2+>4+:6-95,:3-<1-?-+D*)I*(N+'T/)Z5-_:1e>/pA/xA-€A0ˆ@2?4‘=3“:2“;19.‹.Œ@0A1A1ŽA/‘?1•;2•;2<2‹=0†>0ƒ@/?/‚?.…@1†>/‰=0ˆ<.‡;.„;,‚:,€;,x8,x<1s9-n9+s>.s>.r8*u:,}=1ƒA5‰E:‹I=‰K@†NA„PC‡NE‘JH—SR’f]Œwf„†p€“wž„¥†ˆ§ˆ§Š§§Š¤‰Ÿƒwœ}o˜ve’i`‹`Y‚ZY{X\wXZnSSaJNUCFH;C@7<737/-3*+2)*1(+.(*,*+**,+),+),-(,/)-2(02(02(02(02(10)1/*1-*3-*3-*12-12.-0,)--%8:,SXBox]€‹i‡–o†™l†žnˆ£p†¤p„¥pŠ­w“¶€™¹‡–¶„“³Œ®{†«x‚¨w‚¨yƒ¨|ƒ¦|‚¤{x’uqˆnh{eYjWMZHEL<@D5;=/12,12,12,12,23-23-43.43.54/54/85085085074/72.61-80-80-7/,6.+4/,3.+2,,1-,1-./-.0.1/-0--/,,.+*/+)./(/1'//)-/)-/)-/)-.*+.*+0,+0,+/.*/.*/.)0/*0/*0/+//-///0./0./0/-/.,1-*2-*6.+70*90+:1*<1+=3*>4+?5,?6-?6-@7.@7.?6/>5.=4-=4-=2.<1-;0.;0.;0.;0.<1/?1.C2+E0+H/+K--L,/K+.I*/E+.A-,@.*A.(E.(M.)X1*b3-g5,j:,o;-w;0=4‡<6Œ<5:4:4Š<2‡=2†>2…?3†A2‰A3ŒB5C5Ž?2=/Œ>1Š>.‡>/…>,†=.ˆ<,‰;.‰<,ˆ:-†:*ƒ;,<)~=+{<+}=1z<1v:/u;/x@1x@1v<.v;-?5‚B8‰F=‹H?‰JA‡KA‡NCŠNF‘JH˜TQ–f\ve‡…n‚‘t{¤ƒ…¨‡ˆª‰ªŒ©ŒŽ¥‰ˆŸƒš}y˜xi–ma’e\‹a\†`]‚`[|]UrVPhPFYEBP?:D93:2.3,*/)*,)**(0'(1&*1&*1&*0'*1(+0*.0+//*.-+.,+0+,0)-0(-1(-1)-01/23/..*'**"57*PUAmv[|Ši€k~“j™jƒŸn€ n~ m€¥q‡¬x¯|‹­zˆªx„©v§v§u¦w¦y¤y€¢}}›yw‘tp‡mh|cYkUMZHDH9=?299-23-23-34.34.34.45/54/54/650761961:72:72961940940:2/91.91.80-50-4/,4..4..3/03/01/01/20.1..0--/-+.0)02).0*.0*.0*.0*,/+,/+*1-,1-,0/+0/+10+10+10+10,11/1111/010.10.2.+3.+3.*92,92,;2+<3,>4+@6-@6-A7.B8/A8/B90A8/A81@70>5.>5.=2.=2.<1/;0.;0.<1/=20=2.B3.E2.L..R+0V'/U&.P'/I).C/.<1+;2)?2)G0(R/)_.*d/)i9/k;/u<3}<6…;8‰;9Š;7ˆ:6‰>8†@8†B9…B9…C7†B7‡A7‰A5ˆ@1ˆA/‡@.‡@.‡>-ˆ<,ˆ;+‰:+Š8*ˆ9*‡:*ƒ:)<){=(x>(x>*‚>1{7.z7.z<1v;-w=/|A3{@2€B7ƒE:†H=ˆJ?†J@‡MBˆODŠQHŒSJŽ\QŽh[‹tb…g€‹m~–vž|ƒ§ƒ„©‡‡ª‰‹ªŠ‹¦‡‡ ‚ƒš~}˜yq•oi”ifgfŒeg‹gd†e_~_Zw[PhPK^JBP?8D62:/.4*,/(+*%2&&5%(4%(2&(1'(/)+/+,.,-+++*+-*+-(,-(,/',/',/*+-.*+1++0+'.+"88,PUAiqYv„c{Œhyh|–iœl}Ÿmyžkz m¥r‚§t€¥q}£p}£p}¥s~¥v~¥x}¤x|¡x}Ÿzz™wuqn‡je|bWkRN[GDF9?=1:8,45/45/45/560560560761761872872;83<94<94<94<73<73<41<41;30;3083072/61.61.5106216213122011/00./1-.2,04+.4+.4+.2,.2,,2,,2,,3/.3/,3/,3/,21,21,32-32.32032032032051051.61.61-;4.<5/=4-?6-A7.B8/E8/C9/D:1D:1E;2D:1C90B8/@5/@5/>3/>3/=2.=2.=20=20>31>31@51E31M02T,4X)3W(2R)1K,1B30:6-77+:6*B4)M2)X/)^/)f:1j;3s<7z=:‚<:†<;‡;;†::‚;7>8A8B9ƒC:ƒC:…@9„@7‚C2‚C1ƒB0„?/†=.ˆ<.‰:-‹9-‰7+‡8+…9+‚:+~=+x>*v?*x>*9-|/'‚8/„>4w4+s5*}A6}C7E:€G<‚I>ƒJ?„KB†MD‡QG…WJ|aNzjQ€pYu]‚|bƒ†i†“uˆ|ƒ£~§‚‚ª…‚¬†©„¥€{ž}z™wz’pzlxlwŒkumr‰lm„gkd`rX[iRR[HHL=@@4;7,70&5*$6('5''3''1'&.)&+*(++)+-*',('+*)+*)+***,+),+),-)*,#$2*'50*86*BC5UZFfpWn}^tˆeqŠbuex˜iw›ks™htšiwŸkz¢nx lwŸmx ny£s{¥u{¥w|£wyžuzœww–tsŽom†hd{_WkPN[GCC7>:195,560560671671782782872872983:94=:5>;6>;6>;6>95>95?74?74>63=52;63:5294194184184395484373243151240/6-06-.6-06-.4..4..4..4/,40-40-40-51.32-32-43.43.43/431542540841850940:5/=60>7/@7.A8/C90D:0G:1H;2F<3F<3F<3F<3E;2C90B71A60@51@51?40>3/>31?42@53?53@72C52I35P16T/6S.5P05J22C52=90<:-=:+C7)I6(Q3)W2)]2+d3,l50v64}77‚87ƒ77‚66~75}:4}<6}>5€?9ƒ@8†?9…A8€B3€C1B1ƒ@0…=/‡;.ˆ:.‡9-…9,ƒ9,‚:,<,|=,y>,x?,|=,‡5*‹2,¡LE§XQ‹A8|90‚F;€K=yH:zJ<{M>|N?}OBQE‡UJ‚_LrkOosR|uX‡w]yb˜iŸ‹s ”z––z|‹£ˆ¨…§‚€¤~{Ÿy~™vƒ‘p…ŽoƒŽp€pp{ŽpwŒms‡kj~bfv\_hSV[GOM>GA3@6*=0';,'9+(6+'3+(/,',-'+.').().(+-(-,*/+*3)*4(*7'*7'(3($<3,E>4IG8QR@]bKgqVjyZn‚]k„\l‰]p‘bq•eo•do—eršfuŸmrœjq›itžnx¢rz¤vy¢vyŸvvštw™vu”rokj…fc|^UlON\ECC7@91;4,671782782782893893983:94:94;:5>;6?<7?<7?<7@;7@;7B:7B:7A96@85=84=84<73<73<73<74<74<74;639529338308/09/.8/080.80.80.61.61-61-61-52-52-63.63.74/74/540540841952:63<94=84@93@70A8/C90D:0G:1H<0I=1I=1J=4J=4J=4I<3F<3D:1B8/A7.A81@70@72?61?61@72@72A83?74@85B86D97G96H96H96H94E80E8/E9-E9+G9,I9*K9+Q7*Z/&d/'n3-z63ƒ98‰;9‹;:‹=;‹A>‡@:‚=6<3:3‚<4ˆ=7‰@7ƒA5B3‚@2ƒ?2ƒ=1„<0;/€/|>/}>/=/†9/1+¢<8ÍlfÙ~y­ZTŒC<ˆLAN@tJ(+C&+E$+C&(F5-LC4VQ>[YD`bJgmQiwVj{Wl‚[g‚Wf†WlŽ\o”an”an–bršfsko›jo™irœnw ty¢xxžwu›vs—su—vs’rn‹li„cb{[TmMM]CGH:E<5@707827828938938939:4:94:94;:5<;6?<7@=8@=8@=8A<8A<8C;8C;8C;8B:7?:6>95>95=84>95>95>95>95=85<73:51;30:0.:0.91.91.91/91.91.72.61-61-63.63.63.74/74/74/540651952;83<94?:4B;5B;3A8/B:/C9/E;/H<0I=1J>2J>2K>5K>5J=4J=4F<3E;2C90B8/B92B92A83@72@72A83B94A:4?82@93B;5D=7F=6G<6K<5N;4M6.N6,Q6+Q6+Q7*P9+P9)V6'f6*r6,~;3‰@9•D@›HDŸJGŸLF QJ™LDŽD;…;0„7-…7-Œ91=4ˆ>5‡>7†=6…<5…<5=4}=3z>3x@3vA3x@3z>3<3ƒ:3ˆ73‘31˜(&³=;ì|zý•’Åhc–G@‰K@xH:nMhV>lX@t[E`L€hPysQ„wUžt\´l^É__ÓV\ÙQ[×T\äouÙzx̆|À~µ•€«•}£’xŸvœŠrœŠt™u•u‘‘u‹’s†‘s‚‘r|‹ny†ju{amoWgbN_TBUE5R/(9/&7.'6/'81):/)=.+A,+F)+H(+K'+H)'TB4YQ9B?:D?;D?;E@8E>8D=7B;5B;5B;5B;5B:7B;5A:4A:4A83A83A83@72@64>71>71>71<71<71;60:5/85.85.74/74/961961961:70<71=82A:2B;1C:1D<1F<2J>2K?3L@2N@3N@5N@7N@7L?6K>5I<3H;2E;2E;2B90A8/@91?80?80?80@93@93<5/MD=M@:K:3T@9R62O0+a<6\3-`5.`4+^/'^/%f6,m=1q=0‰I=G;—I?ŸKAŸF>›>7š=6žD;¦ND¤PE¨VJ«YK¥OB™A5—;0›>6“98‘98Œ65†52†84„?8|@6r>1rB4oA2q=0v:0‚72Œ43’-1š',ÈHIèbaÅEDÍWUáyv«VO†F<„VFmR=i[AibFjeHj`En^D|dLjT’bL²m]ÑnhÛX]à;Lç-Eò+Hõ0Lö@YìI\ä[eånrâ{|Û€}Ûƒ؉‚Ãv½wº„x¶†x²ˆx­Šw¨‹y¥Œxš€o™~m˜xi“oabY„UM{IBxA>u:9:49:49:49:4:;5;<6>=8?>9>=8>=8A>9A>9B?:C@;D?;D?;FA=E@8E>8E>8E>8E>8D=5C<6C<4D;4C:1B92B92B92B92A83A83@93@93>71<71;60;6096/85.74/74/96196/96/:70<71>:1A:0B<0C;0E;/I=1J>0L@2L@2N@3N@3N@5N@7M?6J=4I<3H;2E;2E;2C:1B90@91@91@91@91A:4B92D93I81L/+V.,j76u99{;;…ECƒD?„H@…IA†G>ŽIB™NH¡PL¢OG“D7”B4šB6ŸC8 >3œ7-œ7-Ÿ=0£C5›?0™@0 E3¤G6§F6®H:¶NE´LM¯HL¥@D™9;‘98>:ƒ@8x>3o>0zI;…LA„?8„,+’).³9DÒLWÜKNßMMÊ>=À@?Ð`\³YQ„@5‚TDyaIe[@^]?ihIslOvgJ~dK–cN¼dXÖ_[æUZëANò,Eþ%Dÿ&Hÿ'Iÿ.Nù3Nò6UE8[O5cZ9gaAifEnrOz‚]z‰bt†^r‰_p‰_p‹`qŽ`u’dw”dw”dw”fs’ix–rz—xy–x~˜}ƒ„…‡ƒ›…™ƒz’zr‰om„hhd`y[TmMNaERSAVPBUOC8938938939:4;<6<=7?>9@?:@?:@?:C@;C@;C@;C@;D?;D?;FA;FA;FA;E@:E@:E@:G@8F?7JA:I@9H?8G>5F=6E<3F<3E;1D:1D:1D:1D:1D;4D;4D;4C<4?80?80<71;60:5/:5/94.94.96/96/:5/;7.>7/@9/B90C;0E;1F<0I=1K?1M?2M@0NA1M@0P?5M?4L>3K=2I<3H;2E;1D:0C:1C:1A:0A:0?;2@<3@<3D;4UD—I?–LAœNB¬RJ¾URÌOSÄLK¥@4B0 @0¥?1¥;.£7+¤8+§=/«E6¡>+˜7$:'¥>-¬A/²C2¶D:§02¯:B¹DL½LRºMR­KL–A>‚71{8/v6,x2*„1-œ37¹=GÕGWèM[âFIÏ53Ð:9½31ÈNKÆc]”J?Œ[J}cLj_CgdEtoOpQhJhN°hYäbbõQZôDQö7Iý1Jÿ2Nÿ/Mÿ*Hÿ2Oü0K÷1Jõ5Lò4Mð2Kó3Ló7Pò@XïC[îF]íIaëNcêQeèUhèVkåSjäRiãOiäNiçNlëPoòSsóVuþh…ña|å[tÕUlÍYlÉdr¨R]r-2^&'Y0,W:4Q?5B:-:8)>B1LN9VO3aV6e_?heDquT†e~ŒiwˆdxŒiu‹er‹dr‹cvŒeyhzizj€•v„›~Šž… Š’£—¨–˜©™–¦™‘¢’‡˜†zypƒmg~b^wYTmMPcGSXDXUDYVG7827828939:4;<6=>8@?:A@;BA5G=3F<2E;1D:0D:0E;1E;2D;2E<3E<5E<5@91?80=82<71;60:5/:5/:5/96/96-;7.;7,?8.@:.C;0D0K?/M@0M@0M@/M@0O?2O>4L>3K=2J<3G:1E;1D:0D;2D;2B;1@<1@<3A=4B>5F<3S81[*&‰:?¾T`ÙTeæUfãUcËJOŸ30–:/‘>0™A3®F=ÅIGÕBHÍ>@±B7§F5©B3¬@3¯?3°>3³B4´D6²G5©B/£<)¤;(©<(«:(®6&­3(¶97º9=½7>¼7<¿^õ@aøCfö@fõ?eõ?gø?hüCmÿErÿIsÿOuÿQuþUvòSqçTnåaxÖfv·Wb}15j0/X1*P8,G>/>A.;D/?G/PK._T8g`CokN||`ˆŽr‡‘v}‹qzq|s|szozŠm}Œoƒ’uˆ—z•£Šœ©•£®¦±¡¬´§±¹®°·°«µ­¡«¢” ”ƒ‘‚s„qh|c]tXSlNPdHRZCWYDYZH671671782893:;5<=7?>9@?:BA/K?1M@0M@0NA0O?/O?0O?2N=3N=3J<1I;0G;/D:0D:0D<1D<1B;1@<1A=2A?3B?6K=4\5.w32­LSÛ]iæM_å@Q×6E·&+¨1)7(’:&—<)¬@3ÃD=Ô>?Í;;±?5¨B4ª@2­?2²@5¸C9¼H;»J<¬>/ª?/¨=+¦;)ª9)°:,·;/¼<1ÊFAÎDAÐ>?Ð79Ö7<ÞBEâLNÝROÄC>ÆKCÍTLÔSMÙKJÛ?Bà5>á27Û4.Ú7.Ð1+Ï:4¿84³@9µ[P–UC{N9‚bI†kP„`F’[F­fTËrdçmhêEKò:Dê9Cç=8@?:@?:C@;DAGB>GD=GD=HC=ID>IE2I=1G=1G=1F<0F<0E;1E;1D;2C:1A:0A:0@91@91=82<71;60;60;7.;7.;7,<8-?9-A;/D0L?/M@0NA0NA0O?/O?/O?2N=3M<2L;1I;0G;/F90C9/C;0B<0B;1@<1@>2A?3B?6N;4m84—FEÄY_ÛWbßCQÞ8FÔ3;½++­1'¡8%˜:!—9 ¤;&¶>.Ã:2¾71§7,¢:-¥9-§7,¯:1¸B8ºE;·E:®>2­?0§<,¤6'ª6)¶>0ÃD;ÊG=¾8-Î@6áD?ìBBô=Aó9>ë27Þ.0Û75âGBèSLåNGÜ=9Ù10ã/2ê67Ù1(ÞÒA>ÒGBÝOMëWWíNRïDMð:Gö5F÷2Fø.Dû1Gþ7Nþ8Sý8Tý8Vþ9Wÿ;\ÿ>aÿAeÿCkþ;eýjý?mú>nø>oô=mö:jÿHrÿ;aÿ?dÿKnÿKn÷NmïUoãZnèr‚Âaj˜ILt:8\6-P9+PC2UM:^QAreUˆ|n•‚Ÿ‘¦§Ÿ¡¦Ÿ–œ˜•ž›ž§¤¦¯¬¦¬¨¢§£¦¨£µ´°ÂÁ¼ÌÉÀÑÎÅÕÐÌÕÐÍÔÎÎÕÏÑÑËÏËÆÊ¿½À°²¯˜Ÿ˜€Œ~m~k`t[WnRVjNS`FV`EX`H560560560560671893:94;:5=<7>=8A>9C@;DAHC?HC?GD=HE>ID>ID>JF=JF=MF2@@4P91r1/¨JKÁSV»>D½06Â03Á//º1)©1!£9#œ=!™;›< ¡=#¥;%¤6%ž6) 8-¢6,¥4,­81·@:¸C<²@6±B7­A4¨-Ï>-Ù5+á*&í"%ú%+ÿ*1ÿ.4í)*ç.+á3,ß4,à3,ã2,é0-ç2+Ú2%Ö6&Ð2&Ï7,Å6.½>7È`UÒq¦eSVBŠM:£WIÈf[ßd_çRTèCIõFMí@Dß??Ô@<É@8Æ@7ÑFAãMLïJNô@Kù9Hý7Hü5Hø3E÷6Gú;Mú8Pü7Rû6Rý6Uÿ6Xÿ9]ÿ;aÿkÿ?mÿ@qÿBtÿBuþBuüBtùBpÿFmúAaþEeÿKjþKkÿVtÿ_zõ]tòj~æp~Óow®^aƒCAg6/hB7sUJye\Œ}v£–­£¡²®«¶¶¶²¶¹ª¯³°·½¶½Å½ÁÊÀÃÊÃÂÊÉÆÍÕÎÖÝ×ÛâÚØçÝÛéÝÝæÚÜåØßä×ààÔÞÙÏØÊÅ˺ºº¢§£ˆ’‡t‚qexb\sW[oS[jM\iK]gL561561561560561671872983<;6=<7@=8B?:DAHE>HE>HE2G=1E=2D;2C:1C:3A:2A:4@93?74<73<71>7/>7/<8/=90>:1A:2C<2D=3H@5I?3L@2MA1NA0P@0O@-O@-L?/L>1M=0L;1J91I81E80C90@9/>:/;;/<<0=>0>?1A?0S8-‡<7Ä\[ÊZY®86«.*²1+®.%­2#¬9&¬B*ªF,¦D'£A&£A&¢<#Ÿ9# 9*£;0¦:0¦7.­<4¶C<·E;°@5«=0¨Dá;=Ö<<Í@9Á>4¶8,¹6.Ä94âHHé@Eð;Dö:Hú:Iø8G÷;Iû?NþAUÿ?Vþiÿ>lÿ>oÿ>pý>qú@rø@t÷Aq÷CjÿMmÿSs÷Jhë@`ýTsÿg…ÿe‚÷]wï_xçh{Üp}Æqx§gg^X{ZQ—~wª™’¾°­Ä¼ºÆÂÃÈÇÌÇÇÏÃÃÏËÊØÌÊØÑÊÚ×ÎßßÔäæÛéêàëíãëïåæòèæôèèðäæîáèíàéêÝçäØâÑÊÑÁ¿Â««©‘–z†xl{hbu_`rXbpVboScmT21/320431651875984984984;:5<;6==5??7AA9CC9EE;EE;HH@HH>HHLC4J@4KA5MC9LB8F=4B90E<5C:5@93?74@85?75<74<42C:5B94A96>95?:7>:7?;8@<9B?:D@7G@6J@4L@0O@-O@+L?,G@.F?/I;0K81M53K65J88F;9B?:6904,«=,­<,³=/½C4ÄF8À>1º2&Ç9+Ì8*Ð8+Ö8-Û7-â5.é3/î1-ñ.,ô.-ó0,ñ1,ê5*ã7)Ý:)Û:(Ü9&Ô3Ð3 Ï8'Æ7'¾6(ÂB5ÏSIÈNCÏSKá\Wî]ZðPRí>Cò9?÷?GêAFßCDÕAAÈ?9»<3±;/°HH>HH9H?:F=8B;5D:8A96?74?74@85@85=85;62=4/=4/=52<74=96>:9=<:>=9B?:D?9G@6J@4M@0O@-P?+L@*B?,B?.F<0H:1J65I56F35@65@<9:=6;>5@@4E<-J9)^B4€L>®QB«;- 2#¡6&£:'ž7$ž9%£>*¡;%§<(®?+³@-¶=,·9*¸6(µ7)ª9)¥:*¤9)¥;+¨>.«A1«B/«@.®?,«:(±<+¿E6ÆH9Á?1¼8+À6)Ë7+Ï7,Ð9.Ñ;-Ô8·;1®:-ª<-«=.¶E5ÆL?ÔNEÜGCã?>ï?Bú?Fþ@JøCJ÷CLúDPÿFTýBSù>Sü>XÿBaÿFhÿCiü?iù@jùBpüFvþJzÿK{ÿJzÿHtõKpñQsõ\zù_{ûXwüNqýEkúDlïEiÚKgÈ_p±nukLI~t°–‰Ì²¥äÓÉìãÜëçæêéîêçòíâóöãùûáúÿâýÿçÿÿìÿÿòþÿöþÿùûþú÷ýúõü÷ôúõòøïðôëîñèíïæëæÝàÜÖØÊÆÅ³²®ž¡šŽ“Œ‰…ˆƒ•‡‰€†Œ~/.,0/-10.21/43/540762761:94::2<<4>>6@@6BB8CC9DD:IF=IG;JH;LI8MJ7NL7NL7OL9KI:NKBTRS_^fihxmm…lkŠkhƒ`YiYQ\OGRH@KH>GG=EE93>:1=9083-94.;60<92=:3>;4?<5@<3E>4G?4I?3L@0O?0P?/P?-L?,<;&:=(?<+A;-B71A62>42;30=84B;5H94N2.Y,)l/.‡;= FE£;0¢2$Ÿ1 ¤9'¥<)ž7$ž8"¢<&¤;&ª=)±A-¶A/¹>.»<-¾:-¾-­>-­<,²?-°8(¹>.ËL=ËG:¼6*º2&É9.Ð6,Ô6+Ô8,Ö:.Ø:/Ü8.ã6/è3,ð0-ô.+ô.+ð1)ç2'Ý6&Ô8"Ò7!Ý8$Ü5#Ú9'Ú>/Ó=.È6)Å9,ËA7É<5Í>8ÙEAåKIêJJéCCì?AëCCÞCAÕD?ÍB=Â=4¶:.®8*«:*¬;+¬8)ÀD8ÔNEÝIEà@@è>A÷BIÿHPôAGô@IùCOýGTþEUú@Uû?XþA_ÿDfÿCiÿCkÿFpÿIwÿK{ÿL|ÿJzÿFxÿHwÿKtúNtÿZ|ÿa€ýUvñCdûIkÿTvÜ?\ÍI`Ø{…¸||aC;|n®ŽÕ³§óÛÑûìåúòðù÷ú÷ôýôìûúëÿÿêÿÿìÿÿîÿÿóÿÿ÷ÿÿûÿÿýüÿþûÿýùÿúøÿøöÿõöýóôûðôùðóðçêåßáÓÏξ½¹­®¨¢¥ž£™£—£«žž¦—›£–/.,/.,0/-10,21-32.54/650880991;;3==5??5AA7BB8CC9HEQPL^]bmlzzz’‚¡€‚¨€€¦{u—rkŠe_{YSmTLdMEZG@PB;2?=1@<1?;/A;-F?/H?.K?/M@/O?0O?/P>0L?/@=*?>,@=.?;/?;2>93=:5:94<94D95M51V-+j)-„28ž8C«>C¦7.¥7(¥:(ª?-¨?, 9&¡8#¤;&¥:&«<)³>,¹@/½>/Á=0Å=1Ä>2½?3¶=2²9.®8*¯9+°:,²:,³9*¶;,¹;-ÄB4ËE9È>3¾1'À2(Í9/Ö5+Ø4*Ú6-Û7-Þ7.á6,æ3,ì1*ó0,ô.+ô/)ï0(ä2&Û4$Ò6 Ð5×2Ú0Ú4$Ü<.Ö=/Ð9.Í=2ÒD:Ä5-Å60Ê;5ØD@âMIåKIÞC?Ö=8Ó@9ÎA8Ç>4¾VádtþŸ§ÓŽd92lJ>¥ynÐ¥œõÔËÿéãÿôòÿýÿÿüÿùóÿüïÿÿïÿÿðÿÿòÿÿôÿÿ÷ÿÿûýÿüûÿýúÿüøÿúøÿù÷ÿö÷ÿõöÿôøþó÷öëïìãäÚÕÒÉÆÁº¹´³´¬±´©°¶ª¶¾³°¸­¬´©10,10,0/+0/+10,21,43.54/77/880991;;3==3??5AA7DA8IE:LF:NH:PJ:RK9RM:SL:QK=OJDVTUfdqwx††¨¹“ÃÆŽ‹À‡ƒ¶{w©pmšid_[~UPnNJaKGXEBM?=B;7895296/85,85,671783891;;1>5L?6K>5F<3B92=82:946;47<59<5>:1H4-Y2-w78”?D¦>E§9<ª;0ª<+«@.¬A/©@-¥<)¦;'«>*§8$­:'µ<+¼=.Á<-Å;.Ê<0Ê=3Å?6¾>3º:/·7,·7,¸8+º8+º8+»7+ÇA5ÍC8Å8.Á1&Æ3)Ë7-Ï5+Û4+ß3)á4-â6,ã5,ç5+ì1*ð/*õ/,ö/*ò/)ì0'â2#Ù4!Ð5Ï4Ö1Ù/Ø2"Ø6)×9-Ô:0Ö?6ØE=ÖF>Í@7É<5Ë@9ÖKDÙNGÒE>Å;1Å=1Â<0ÀCòBLûIUÿJYýFXúCYûC]û@_ûBdÿElÿJsÿNzÿO|ÿLyþIvÿJwÿTÿT}ýJqùImÿStÿVtøNiëD^äF]êXkÿ–¢ÿµ¼óžŽHFk.)¦kcÍ–óÈÁÿãÞÿñðÿüýÿýÿü÷þþöÿÿöÿÿ÷ÿÿøÿÿúÿÿüÿÿýýÿýúÿüøÿûøÿùøÿø÷ÿöøÿõ÷ÿôøÿôøýñóóéêäÜÚÖÑÍÍÊÃÉÉ¿ÊÊÀÊÍÂÉÐȾȿ·Á¸65143.32.10+10+21,32-43.66.77/880::2<<2>>4@@6B@4JD8ME8OH8RK;TK:TM;SL*F@*G?*H@+IA,IB0IA4HB6HA9G@:K=?ž51§;/ª<+ª?-ª?-©>,©>*¬?+°?-«8%²9(¹:+¿9-Ã9,È:.Í:0Ï<4Ë>5Æ;4Â91Á8.Á8.Â9/Â8.Ã6,Å7-ÑC9Ð@7Ã0&Ã,#Ð7/Ö<4Ó2*à3,ä2(ç2+è3*ê3+í2+ð/*ó-*ö/*õ.)ñ0)ì1(á4$Ú5"Ñ6 Ð5Ø7#Ù3#Ö3$Õ3&Õ5)Ô8,Ô<1Ö?6ìYQáRJÓHAÌC;ÊE<ÌI?ÈE;À>1¼:*¼;(¼:*¹:)·:(¸:+¼>0¿A3ÁA6Á<3Å<6ÏA=×EEÝGHäIMëLPèBFê@CðCIùKTþNYüJZüF\üF_øA_ùBaýEiÿJpÿNwÿOzÿNxÿLvÿQ{ÿRyþOvýOtÿVyÿ]{ÿSoîD^úTlîQd÷dtÿ’žÿ‹•ôƒ‰Ç`d§MMµjgΊXÿÞÙÿïîÿúùÿüþýûÿýúÿþûÿÿûÿÿûÿÿüÿÿûýÿûûÿûøÿûøÿüùÿûúÿûúÿøúÿöøÿó÷ýñóùíïòææçÝÛߨÒÛ×ÎÝÛÏàÞÒßáÖÜãÛÏØÓÅÎÉ<94;8185052+41*41*52+63,74-85.96/;81=:1?<3A>5C?4JB7MC7PG8SJ;WK;UL=UK?SJCSJK]Wcnl‚‚‚¦‘•Åš ÚŸ¦ê¢©ñ¡¥ïž ë™›å•˜Ý”•֑ʉ‰½‚ƒ±zy¡rq‘fc~XVkPN\IGRFCLCBJ??K==G;:@;9:<94?;/C=-E@,F@*FA+EB/EC4CC7BC;AC>@ACBLCANEEOCHNAIL>HI>GDCHAA=2L:.gF7ƒOAI<Ž?2”8)¥>/©>,«>*¬?+­@,¯@-°?-±<*±8'¶8)½9*Ã9,È8-Ì8.Ò91Ô;5Ï:4Í:3Ë81Ë81Ì92Í:2Ì70Ë6/Ó<5Õ>5Ò91Ì2(Î4*Ø;2Ú<3×3*ä1*é1'ì1*î2)ð1)ò/)ô-(ö,(÷-)ô/)ð1)é3(â5'Ù6%Ò7!Ï7 Ô9%Õ8%Ó6%Ñ4%Ò4(Ó7+Ò8.Ð7/ãNGèXPçZSÚQIÌG>ÄD9¿@7¹>/¹<*¹<&¹<(¹:'¸9(º;*À>0ÃA4ÉD;Æ@7É@:ÑFCÕIHÖHGØGJßIKæFHèBDíDIõLSüQZûO]ûL]ûK`öD^÷DaùFfýIlÿNuÿOxÿOxÿPw÷VxóUvôTvüYxÿ]{ÿZwûQkòI`ýWköUgêM^ö^mâKZæTaåTa×XaÁefȃ~å«§ÿÔÑÿëèÿóòÿøùÿþÿûüÿûüÿûüÿüüþüúýýùúý÷÷ü÷ôÿú÷ÿûøÿüûÿûúÿøøÿóóýîñúëîðáäéÝÝäÙÕâÙÒæßÕëçÛñíáññåìóìÛæâÎÙÕ@=6=:3:7074-52+52+52+63,74-74-96/;81=:1?<3@=4B>3JB7MC7RF8VJ:WK;XL?:6@<1A>/C@/CB0BC3BD7?D=>D@CVCIaLRhU\o\br`dobbjd`afXWaJDlG>ƒSE•XF“J7‘@+™>+¨A.®@/®A-¯@-°A.´A/²=+°7&µ7(¼8+Â8+È8-Í6-Ñ7/Õ81Ø;4Ò72Ð72Ð72Ñ82Ô94Ô94Ó83Ó6/ÞA:Õ8/Ñ3*Ö8/Þ=5Þ=5Ú91Ü5,ç2)ë0'ï0(ñ0)ô/)÷-)÷,(÷,(÷-)ô/)î2)é4)á5'Ú7&Ô7$Ï8#Î7"Ï8%Î7$Ï6&Ð7)Ò9+Ñ7+Î4*Ë4+ãNGód\ë`YÕOFÄA7º;2µ9-¸>)¸>'¹<&¹;%º9&½9*À2ÊD9ÊA9ÎE?ÕKHÓLIÎGDÍEEÖHGãIIæCDèEHòMSøSZùR\÷O^úOaôH^õG`øGdûIiÿNrÿQxÿRyÿTzðUuïZwù^}ý^|ùUpõMgùOiÿYnÿ[mÿctðM^÷TeôO`üUgõL_äR_À^_»vqל˜úÉÅÿåãÿíëÿôôÿÿýüÿÿûÿÿûÿÿûÿþýýýýüúþùöýøõÿøõÿùöÿúùÿúùÿööüððøéìôææëÝÝèÚÙäÙÓèÞÕðèÝùóåÿúìþþòôúöáëêÓÝÜB>5A=4@<3>:1<8/:6-84+73*62)62)73*84+;60>93A<6E>6I@7MC7RF8UI9WJ:XK;ZLA[NHTIMXR`gd|~§’Ê— ãžªö¥°ÿª³ÿ«²ÿ¬´ÿ¬²üª±ùª¯ó¨¬ì©«èŸ¡Ú™šÒÁ±tr¡he’]Z‡XR~XQzYQvVOnMH_C?M?:@?;:B?8>>4@B5BE:?D=:CB>FH?LUDVnQfƒarŽisŽtvx„o€€^lŠ[c’WYžWU¦VM¦M?Ÿ@.œ9$ :$§<(¬=*®?,±@.³@-´?-¶=,¹;,º6'¾6(Ä6*Ë7-Ñ7-Ö8/Ú91Ú83×84Ø95Ù:6Ø93Ø61Ø61Ú83Ý:3æC<à=6Ú70ã@7þ[Rÿlcÿ]Tç?6å3)í2)ñ2*ô/)ô*&õ(%ø(&ø+(÷-+ó0,í2+ã1'Ú0#Ô1"Ô4$Ó:(Ì;&Ê<(Í<)Ï<*Ò:,Ò9+Ò8,Ñ7-Ú@8Ï81ÜGAôc^åXQËB<Å@;·4*·:&¶<$¹<&º<&½:(¿:+Ä<0Æ>2Ç>4ÌC;ÙPJßXRÔOJÃ?:À?:ÏHDÞHGâGEæJKïPTñRWïNVíKXñL\ùRføOf÷Ke÷JfüMlÿQsÿRvýRvôWvîXuõXuû[wÿ\xÿZsÿWnÿVkÿbuýVgÿ\mÿ[lñFXôDXÿQeîVeÆfgªieʋ網øÒÏÿëçýïîüø÷ùýüùÿÿùÿÿúÿþüþýÿþüÿûøþöôþùõÿû÷ÿùöÿöôÿööÿõõöèèæØØãÕÔÞÐÍáÖÐñçÞüôçþøèÿüéÿÿóúÿùèñðØáàC?6B>3A=4?;2=90;7.:6-95,73*73*73*84+:5/=82@;5D=5H?6LB6QE7TH8VI8WJ9YK>ZMEUJNWQ_eby{¤ŠÉ”⛦õ£®þ«´ÿ¬µÿ®¶ÿ¯·ÿ°·ÿ¯¶ü¯´ø¯²õ©ªë¢£ã˜˜ØŒŠÉ€»uq®ie c^˜`WŽ`Vˆ]TVPtMIbFCTBAIAAC<<:AB=FEACD?A?@DBEOMRWVdch†quš}¢‡}Ÿ’}œ {š¥pФ`u¬Yi¶VaºQU¸HF°@4¬;)¬<&­='¨8$¨7%«8&®9(°8'²9(µ7(¸6(»3%Â4(Ê7-Ó:2Ù<3Þ=5ß<5ß<5á>9ß<7ß<7á>9åB=èC=çB<æA;å@:æB9ä@7Ü8/Õ1(Ø6+ëI>ÿ[Oñ@6î6,ê+#î)#ø-)ÿ/-þ,+ö((ú0.õ4/ï61ç6.Þ3)Ö2&Ô2%Ï6&Ë:'È;'Ê<(Í:(Ï9*Ð7)Ñ5)Ð4(Ó9/Ï5-Ô=6åPJåTQÛLHÍB?·1(¼;(»=&½<'¾;'¾9(À8(Â:,Ä:/È>4ËB8ÕOFÜWPÒRIÃD=¿C;ÌHCÛLHßJFåMLëSRíTWëPVéNVìOZ÷VføUhùSiúRküRmÿSqÿStÿRuòMmøUtÿ\zÿ_{ÿ\vÿUoûRiûReüUf÷RbÿZhÿZhóN^øScþYißS^¶`_—^W¶}Ù©¥îÈÅýáÞùééýøõúüùùÿÿøÿÿ÷ÿýúþýÿÿýÿûûÿ÷õýøôþùõþùõþöóÿ÷öÿõõöêêêÜÛäÖÓÝÐÊßÕÌïåÛüõåÿùçÿýéÿÿïúÿøèñîÛáßEA6EA5C?4A=2?;0=9.<8-;7,84+84+73*84+:5/=82?:4C<4G>5JB7ND8RF6TG6WG7YIBZEJpW]‚cs˜r—¥z§®«²{£¸vœÀp“ÂcƒÀTnÂG\ÐK\ÑHPÄ<<º5.¸9*µ<'°<%°;'°;)²:)´;*·<,»<-À<-Ä<.Ä6*Ë8.Ó<1Ù?5ßA8á>7à<3ß:4Ü71Ù4.Ø3-Þ93æA;ìE?éB<ä=5ã<4Û4,Ø4+Û7-Ô2'Ì, Ö6*éG:õK>ò@6ï4-ð-)ö,*ú,,ü,,ø*,ð*)ì/+è2.ã5.Ü4+Ø1(Õ1'Ñ3'Í7(Ë:)Í:(Ð:)Ò;*Ó:*Ô8+Ô8,Ñ4+Ö<4Õ:5Õ<7åONíYWÙEEÂ3/À;,¿<(À;*¿:)Á9)À8(À8*À8,Æ=3ÇA6ÏJAØUKÒRGÆG>ÀD:ÇG>ÖKDØICÝLIäSPåSTâPSâMSåNWòXdöZhý[pþZrüVnúRlûQlÿQpýGmÿPvÿZ}ÿ[{ÿVrýTkþWkÿ\mûYhøZhûamö`kí]gïfnìfmÉ\_ ]W{OF˜mfÁ˜”ݺ¶ðÔÑôàßÿõôùù÷ùÿýùÿÿ÷ÿýúþýÿÿÿÿýÿÿøùüùôüùòüùôýøôÿùöÿøöùîìïäâåÚÖÛÐÊÜÒÈîäØýöäÿûèÿýçÿÿíúýôêðìÞãßIE9HD8FB6D@4B>3@<1?;0>:/:6-95,95,95,:5/<71>93@;5E>6I@7LD7OF5RE4UE5WG8WI>XMKXNW^Zqpp–€†ºŒ–Ô•¡é©õ¨°ù©±ù­³ý°·ÿ±·ÿ²¹ÿ´¸ÿ´¸ÿ¯±ü«­ø¥§òŸžê—–⌋ׂÍ}yÅum¶pgªf`ž_ZYX„QQuGGcA>Q=5DH8BT=C`@EnCJ€OU–]d«fx¿kÉnšËo˜ÉiÈ`ƒÉWxÆIgÄ;UÆ2HÙAPàEMÑ;<Æ71Ä?0½@,±:$­6"­5$®5$³5&¶7(¼8+Ã;-È/Û?0Ü@3Ü@3Ò6*æLBåJEÎ50ßGFóZ\ßIKÕA?È2ÈF9ÏOBÎPDÆH<¿C7ÁC7ÎH?ÑF?ÕJEÛPKÝROÙMLÚKMÜKPëX`ó[güaqÿauúXmõOgõMgÿNkÿOuÿRyÿUwÿTqüTmý[pÿcuÿjxÿguúboõamídlãflÙhjÎghµfa^TeG<^U©ˆÍ«©åÇÅïÚÙÿóóùøöùýüøÿÿ÷ÿÿûÿÿÿþÿÿüÿÿùúþûöûûóûúõþûöÿýùÿûøþôòøíéêßÙÞÔËÝÓÉíæÖÿøåÿþèÿÿæÿÿëøúïêïèãæßNH:MG9LF8JD6HB6F@4D=3C<2?80>7/=6.=6.=60>71@93?:4C>8EA8KC8NE6QD3RE2VF6VH;ZMGVMR[Whlk‹~‚±Š“Î’Ÿãš¦î¦®÷©¯ù­°ý¯³ý°³ÿ°´þ°³ÿ¯³ý«®û¨«ø¤§ô ¢ïšœé“•⊌ن…уÉ{u»mk¬dež_a’Y[„RQsNHbWFY_CQmBLEM˜MT¬U]¼[bÊZhÙRpâRußTuÙPlÒJbÍBWÇ8JÅ.?Ô8EãCKæGKØ>>Í>6ÌF:ÃH6¶?+·>-¸=-º<-½>/Ã?0ÊB4ÐD7ÕE:ÙE9ÚB7Û>5Ù;2Ù6-Ù5,Ú3+×3*Ô1*×4-Ú7.Ý90ß80Þ7/Ý6.Ü5,Ö/&Ù5+×7+Ï2#Í1"Ò9)Õ>-Ô;)Ø<-æD7øJAýD?ù64õ*-ö*-÷/2÷67í55â30Ú1,×0*×/,Ù0-Ù0+ã81ä91â:1â;2à<0ß=0Ü?0Ú>1Ñ7+ïWLøaZÓ;6Ñ;:æPQÜFHæPQÏ<4Ê:/Æ8,Å9,Ä:-Ä<.Ã;-À;,¾:-¾<.ÃA3ÇH9ÇI;ÂD6¾@2¼>0ÉF<ÊE<ÎIBÕPI×RMÕNKÓKK×LOéZ`ð^hüfrÿhxü]qòPeóMeýNkÿVzÿTxÿRrøTmö]qûhxûjw÷erüetó_mì`kêkrßruÃjfªd\žla}fVXH9kXJ”|r½ œÞÂÁîÖÖþîïûõõûûûûÿÿùÿÿýþÿÿþÿÿûÿÿúýÿþùûþõûüöÿþùÿÿúÿþúÿûõÿ÷òñèáäÜÑáÙÌðé×ÿúäÿÿæÿþåÿÿê÷ùëíðçèéáQK=PJ1ÃE6ÃE6ÅF7ÉE8ÎF8ÑG:×G<ÚG=Ö>3Õ;1Ö8/Õ4,Ö3*Ø4+Û4,Ú6-Û81Ý<4à=4ß<3Ý90Ü5-Ü5,Û7-Ò.$Ý;0Ú=.Í1"Æ-Î7&Ò=)Í:&Ì9'Ô8)â:/ó=9ÿ@@ÿ<>þ37ó,/ê,.á+*Ø*)Ô+(×/,Þ44ä88é99ï75ð74î73è71ã7-Ü6*×5(Ñ5&Í5(çPEÿmcÛHAÈ42×CCÓ>BêVVÙA<Ò>4Ë8.Æ6+Æ:-Æ/Á=.»9+»<-¾?0ÀA2¿A2½@.¼=.»<-ÃC6ÄD9ÈH?ÐPGÓRLÐOIÒNLÕONé^cîagûitÿnzÿduõVjõQiÿUoÿWvÿVtúXpñ^pônyöw€íksÞXañ`mñ`mìboïs}숊Ì|ªth™yjskXON:_VGƒqg¯–’ÜÀ¿ïÕØüéëþôõýûüýþÿúþÿþýÿÿýÿÿûÿÿùþÿÿûùÿõúýöÿÿúÿÿúÿÿøÿý÷ÿþöùðçíåÚéáÔôïÜÿûåÿþåÿÿãÿÿèùúêòôçîðåSM=RL4D=3B;3A:2@93A:4A96@;7A@;CC;IE9MG7OG2RF0UF1UH5WK?RHFXR^jg‚}§‰“Ä’žÚ˜¢ç¤§ö¦§ú«©ü«¬þ¬­ÿ­®þ¬®û¬®û¨¬ö¦ªô¤¨ñ£§ð¡¨î §í¤è›¢æ™žâ’šÛ‹“҆ʃ„ˆ·ƒ¨ˆyšmˆšcz©Xi»Q_ÏMYàIRèAIê=Aé=;ã>8ÝC9ÖH:ÎI8ÅF3ÂC0Å@1äTIàG?Ú;7Ø64Ø88Ø:;Ñ98È74À:/¾<.¿;.À:.Â8+Ã7*Æ4'Æ2&Î4*Ð3*Ñ3(Ô3)Ö3*Ù5,Ý6.Ü8/Þ=3Û=2Ü;1Û8/Û7-Ú6,Ø4*×3)Õ3&Ó3%Ð4%Ï6&Ò=)Ñ>*Ê9$À2È:&Ê4%Õ1'ç51ú<<ÿ=@ÿ7=÷37ê-1á-.Ù--×/.Ü43ã9:é;=ð9=ö26ø03ô01í1/ä1*Þ2(Õ1%Ï3$É1$Ñ=1új_äTLÈ95Ð@?Ë:=äRSäJHÜC=Ñ:3É6.Æ8.Å;0Â<0¿=/º;*¼?-½@.¼?-º;*º;(½;+¾<,¼>0¼>2ÀD8ÈLBÌPHÊNFÌLIÐNLèaeìaføhrÿo{ÿhx÷Zk÷UjþZrÿYsû]tîaræjtë}€ñ‡‰èwyÚ_dñgtþm|óeuëlwö‘•ì¢ŸÄ”Š¢|hjUHQSK>PJ>êDFå@DÙ8=Î65ÍB;ÈD8ÉC8ÇA5Æ>2Ã9,Â6)Â2'Æ2(Ë3(Î4*Ó5,Ø5.Ù4.Û4.Û4,äB7Ý=1Ù7,Ú6,ß9-ß9-Û5)Õ1%Ø8(Í2 Ê1!Ï9(Î8'Ç4"Ê7%ÔC0È7&Î8*×6,Þ5.æ3/î53ö:9û?>ÿLKúHFòBBì>=ê<=ç7:å26æ,1ô+1ø)/ô,.ï/.è1+à4*Ù5)Ó7(Æ0!À.ôdYë]SÏ@:ÔDCË;;ßMMêRQàHEÓ;6É6/Æ8.Æ9/Ã;-¾:+¾<,Á@-ÀA.»<)·8%¸9&½<)¾?.µ7)³7+¸>1ÁG:ÅK@ÅIAÈIBËJEåa_æ^`ñdjþnwþkuó]iðXeø]mú^sõbtèdoãlrì~ù‹ö†…éqsøryÿy†õaqàXföˆ‘ÿ´´Ð®¢ ›‡]jPDR9QT?jbU›ˆÚÀ¿òØÙöàãÿô÷ÿúýÿþÿýüÿþüÿÿýÿÿûÿþùýûÿúôÿòòþòùÿôüÿöûýòÿýôÿÿôÿÿóûõç÷ñáþùåÿýçþüãþýáÿÿêÿÿñýýóüüòXO@WP@WN?UN>TK2G?2H>2F@4GC:GE9JG8NI6RJ5UJ4UJ4VK9XNDULMZTbkhƒ{~§‰Ã‘™×˜Ÿç£¤ö¥¢ù¢¢ü¡¢ü ¤ÿ¢¨ÿ£«ÿ¤­ü¡ªõ¡©ñ¡¨ì¥¨íª©ï­©ó±©ö¬©ø ©ø—§ò’¡â–ŸÖ¦£Î¶ž¾¹…œ¸gz¿L]ÑERß>Mç;Gç?ß<=ÝEBÉ:4ÊD9ÊF:º1)ÛJEèJIéCEë>Bè;?æÚ<=Ô<;ÏB;È?7ÊD;ÑMAÍK>¿=0¸6)½9,¿7+Ã6,È5-Ë2*Ñ/*Ô/+Û2/Þ5.çA5ß9+Ù1$Ý3&å9+ç;-ß8&Õ2Ï2Ì4Ê5!Ç4"Ç4"Ê4%Í5'Ï5)Ê0&Ï2)Ñ5)Ò6*Ò4(Õ3&×3'Ü4)à2)æ3.ë52ë33é/2ç-2è-4í.5ö-3ö+/ï+,ì/-ê5.ã9,Ù7(Ð4%Ã-Ä3"çXHéYNË;3ßNIÅ41ÚHHáOPÜJJÔC@Ì;6È80Æ8,Ç9+È<+Å<*Â;(¾9&¼;(»<)º=)º=+·<,´8,µ;0¹=1»?3»?3¾@4À@5ÄA7ïjaõpiêc_ômjûqqìadôgmÿpyÿlzûhxðdoébiëdjîlnîqoîqoûy{ÿ}…ùZlücwßbpû¬¯¶ªš}‘u]rQJY:LR8snZ¥•ˆË·°íÕÓÿîðÿö÷ÿ÷ûýøüüüþþÿÿþÿÿÿþÿûÿþðÿôåþéæûêïÿîøÿöüÿôþÿóÿþñÿýñÿûîÿúêÿùæÿùãÿùáÿùáüúåÿÿõÿÿûÿÿûYPAXO@XO@VM>UL=TKÌLAÁC5¸:,·9+¹7*¿7+Æ6-Ë4-Ñ2.Ø3/á53ä84ä>2á;-Þ6)ß5&á5'á5'Ú5"Ó4Ñ9$Ë9"Ç9%Ç:&É<+Ë<,Ì8,Î4*Õ3.Ö5-Ó7+Ï7)É6&Ç4"Ë4!Ï4"Ø2$Þ2&ã0+æ.,æ,-æ,/æ-2è.3ì+.í,-ì0.è2.à4*Û5'Õ8'Ò9'Õ?.»*ÖD5Ð>1ÙF>ëVPÚB?ØBAçUVâRRÜKHÔC>Í=5É9.È9+Ç8(È;*Ä;(¿:'½<)½>+º?-¹@/¶>.²:,´;0·=0¸>1º?0½?1ÁB3ÅC5ëi\òmdçb[ðkfõolèbañklütxÿq~ÿo|öirí]fêY`ñbf÷qpþzxûvwÿx~ùRdþ[pä]nö¦©©¦“jŒkZtON_;SZ;us\©ÖĸöáÜÿõñÿúúÿúûÿûüüüüúþýûÿþúþÿõÿúíÿóáÿéáýæéÿëóÿñøÿòýÿòÿÿñÿýïÿýíÿúéÿöåûóàúòÝüôßü÷äýúóüüúÿÿý\PB[OA[OAYM?XL>WK=VJDã=?å==åAá>CàBè;?ã9<Ü68Ö66Ñ96Ì;6ÕHAÄ;1¾5+ÅA5ÍK>ÆH:»=/·8)º6)¿7)Ç7,Ï6.×50Þ71æ95é=9×3*×5*Ú6*Ü6*Ý5*Ý7)Ú:*×>,Å4!¿4¹4!¹6"¼8)½8)½3(À-%ã@;å>8Þ=3Õ<.Ì9)È7$È7"Ì7#Ò7%Õ3$×/&Ù.'Û.*Ü.-Û//Ü./Û,)ß0+à5-Ü5,Õ3&Ð4%Ð9&Ñ>*ÔA/Â1 çSEÒ;0ÚA;ÞC?èJIðTUíUTçSQãOMÝJCÖC;Ï<2Ê8+Å6&Ä7&À7%¼7&¹:'¹<*·>-µ=,²=,°:,±;/´<.µ=/·=.¹?0¾C4ÃE7Ü\Qêg]äaYðlgöpmça`ìfgójqàR^ï^kõhqòemñ`gôeiùqqþxwútuÿnuóJ]øRhä[mñœ¡£œŠa€`UoHOd=W`Aww]­¥’áÑÂÿîæÿøñÿüøÿþúþÿúûÿüûÿýûÿýùÿûóÿöèÿîÜþãÚøÞáùáèûåïüèöýëýþìýúéÿúêÿ÷æúñàôèØòçÕöëÙøñáþúñýüøÿþû\PB\PB[OAZN@YM?YM?XL>XL>UI;TH:SG9RF8RF8RF8RF8PF:LE;KGEç=Fã?FÖ:>Ñ?@ÑEDÆA<º61Å>:êZYÝABã@Cæ=@ã:=Û89Ó97Ð<8ÎA8ÏE;Â:.»2(À/¸9(½8)Â9)Ë8.Ò:/Ù80à91è;7ë>8Ø1+Ù2*Ü3,Ý5,à5-ß7.Û9.Ö=/É7(Æ:)Á<+¾<,¿;.Á;0Å<6Î95ëC@í@<ä@7Ù=1Ï9*Ç9%È:&É;%Ï<(Ð7'Ï1%Ñ1%Ô1(Ö3,Ô1,Ñ/*Ó2*Ó5,Ó7+Ð7)Í5'Ê7%Ì;(Ì>*Ì;(Ï<,ô^PàF<Ò3/Ò.,æ@@ûWXÿusÿroÿjgö^YçPGÕA7Ç5(½. Ä8'À8(»8&¸;)·<,µ=-²=,°<-¯;.­<.°.¼B3ÀF7ËMAß`Wâa[ôpløtræ`aä]aæ]dÖHTçYeógrôgoöelükpþsvþvvûpsûenñDXôKbåXkë’– •ƒ_zYQlCSh?\gEy|_°ª”çÜÊÿõèÿùðÿûñþþôýÿ÷ûÿúùÿúöÿøòüóêûëÚøÞÎóÒÊëÌÏìÎ×îÒàðÖéóÛò÷áöõáûöãüõãõìÛíáÑéÝÍíáÑñèÙüõíü÷ñþùó\PB\PB[OA[OAZN@YM?YM?YM?WK=VJ@Ð@?ÐIE¿>8³2,ÈC<àUPÜDCáACã?@á>?Ú?=Ô@<ÑD;ÏF<Ç=2À8*½5)½9*¿=-¿=-½;+½<)Â:*Ç;*Ï;/Õ;/Û8/à8/ç83é:5æ95ä52ä20æ21ç32æ40Ý2+Ô0'Ë1'Ë7-È:0Ä7.Á4-Ã40Ì:;Ý?@ë8;í76ä71Ø5,Ì4&Æ5"Ä7#Å:%Ë=)Ë8&Ì4&Î5'Ô8,Ô:0Ó9/Ð8-Ð>1Ê;-Å8'Ä7%Æ9'Ç<)Ç<)Ç:(Í>-Í:*Ø>2áC:Ô/-ä::à24ß56×53Ö;6ÞC>åKCêQIêSHèTHäUGË?0Ä?.¾<,¸=-·>-´?.°?/®>0¬<.¬<.¬<.¬=,­<,±=.·A3ºD6ÆLAÞbXâc]ðnlôrrå`cå`eç`g÷kvûoz÷kví`hð_fýlqÿx{ÿy|úmsø^jóAWôC]èUh懣“ƒg]YtI^uIhwPˆf³²–èâÌÿúéÿýíÿþïýÿòûÿôøÿôôÿñíûêäòáØî×Åèǻ伺޺¿Þ¼ÇàÀÍâÃØæÌãëÓìîØôñÞ÷òßóêÙìàÒèÚÍêÜÏïáÖòèßñèáòéâ[OA[OA[OAZN@ZN@YM?YM?YM?XL>XL>WK=VJQI>QI>SK>UL;XM9XM7YL9XM;WK?ULGYSWe^nnjƒut–~}¥„…±†‰´‡‰¹Š‹Á‹ÈŽÏŽŽÔÕӔӋʃˆÀ|¸u|²ov­io«ljœ€lˆ“cy®YvËPoãBdð7Vö4L÷8Hï@EåFBÝJCÛJEáGGèCJò=Nð>LäCI×CCÌA>ÎIDº;4°4,ÉI@ÕLFØBAÚ?=Û;;Ú<;Ø@=ÔE?ÍG<ËG:À8*Á8(À8*¾9(¼9'»8&½:(À;(Ä;)Ê=,Ò<.×;.Ü8.á6.ä6/è50é32è./é,0î02õ47õ77î45æ21Ú.*×4/Õ62Ñ32Ï/1Ò/4Û6=ê:Dí06î02æ3/Ü3,Ñ5)Ê7'È9(É<(Æ8$É6$Î6(Ó:,Ú>2ÝA5ÝA5ØA6ÓG8ÉA1Â;(À9&Ã<)Æ=*Å<*Å8&Ì:+Í7)Í0'æC<Û2/ï?Aã/2Ú*,Õ1/Ò5.Õ81Ö90Ò8.Ì5*Æ2&À1#ÎE5ÆA2¼=.µ:*±9)¯9+«:,ª:,«;/«=0¬>/¬<.«<+­<,²>/µA2ÉSGàg^àc_êjiînoæchðjqõoxúq{ýt~ömuîbködnÿrzÿx~ÿquúipøWfùAYô@[êQfá~ƒ¬—†ykmˆ]o‰ZyŠ`—r¶·˜ßÞÂùôÞüúåÿÿïûÿïõÿïïÿëçúäÜïÙÐãÍÅÞÁ°Ö­¨Ó¦ªÐ§°Ó«¶Ô®¼Ö±ÇÚºÒßÁàæÌèêÔòíÚòéØîâÔìÛÑêÙÏìÛÓéÚÓæÙÑåØÐ[N>[N>[N>[N>ZM=ZM=ZM=ZM=YLUL=XLNÝAEÔFDÈA=ÉHB´:/±7,ÎOFÉB<Î=8Ð64Ï10Ð51Ó>8ÏE;ÈF9ÃD5¾9(Ã:(Â:*¿:'½8%¾9&¿:'Á:&Ä9&Ë:)Ó:,Ù9+Ý7+á5+ä3+ê3-ë*+ñ*-ø-3ü/4ÿ17ÿ37ÿ38ý58ù8;õ8<ò9>ò9Aô9D÷7Fû6Hþ5Eô+5ô-2í12ã4/Ù6-Ð8*Î;+Î=,Ë5&Ñ8*Ù;/ß=2â>4ä=4å>5ßA6ÙJ<ÏG7ÉA1Ä<,Â9)Â9'Æ8*È9)É2'Ó9/á@8ëD>Þ0/à..ë46è66Ø3-Õ7.×90×:1Õ;1Ò;0Í:0É;/ÖL?ÌF:¿@1´9*°6)¬6(«7*©8*¬;-­=/®>0­=/«<+«<+­<.±=0ÀKAÚdZÞc^èkiðosêinõrzüvîfp÷oyùryöjsþlvÿwÿv}ùhoùcn÷RbþB[÷ZM=ZM=ZM=ZM=ZM=YLVJ>XL>YN5É83Ç/,Å*&È/*Í:3ÌC9ÃC6¼>/À;*Ä;)Ã<)Á:'Â;(Ã<)Â;'Ã8%Ä5$Ê7%Ô8)Ù7*Ý5*á3*å3)ê2*õ33ÿ58ÿ8<ÿ4:ÿ-2ÿ(-ÿ(-þ+1ü-3ö)0ò&1÷)6ÿ,?ÿ*Aü 9ó/ö"0ó(.í,1æ0/Ú1,Ô3+Ñ5)Ð6*Ô6+Ý90æ=6ë>7ë:4è71è50â92ßH=×K<ÓE7Ë=/Ä6(Â3%È6)Ï8-Î4*Ô6-æC<ß82à21Ò ì89å63Õ1(Ò4)Ò4)Ï5)Î6+Ê6*È5+Å7+ãYNØRFÊH;¾@2·;/µ;.µ<1µ<1¯9-±;/±=0±=.¯;,­9*­9,®:-±<2ÐYQÜb]ìppôvyîmrõq|ör}ÿzƒÿ‰ÿy€ôhq÷epÿq|ÿuÿktø^jöOaÿA^÷8WéG^Ûntº‹™©„‚žn~šg—hœq¡©‚´º–ÈÍ­ÕܽÌÙ»ÁÔ´²Ì©§ÂŸž¼˜š¶–²Œ±†‰³†µ~¹„•À‹œÂŸÄ‘¨Å™²È¡¾ÎªÉÒµÚÙÄæßÍêÞÒéÖÏáÌÉÛÆÃÔÁ»Î½µÈ·°ZM=ZM=ZM=ZM=ZM=ZM=ZM=ZM=XK;XK;XK;YLYM=WMCWLHXNOZPX]Ub`Yia\rjfokŽsp›vq§{u³ƒ~ÁŠƒÉŠƒÇˆÀŠ~¼ˆy²ƒr¨†r§t«‡l£†\„HL¤B9¶A:ÍC@Þ@?è:;ô<>ÿDE÷><ó=<ì>=ê@AëBIêCMëANãALÐ>>Å@9¾?6·>3°,º7%Á:'Ã<)Â;(À9%Â9&Å:'Ç:(Ë:'Ð9(Ö6(Ø2$Ú."à/%ì7.õ=5õ82÷40÷0-ø**û&(û%'û%'û%'û&*÷!)ø".ÿ'7ÿ(>ÿ!;ÿ6ý1ÿ'8ï#,æ#+ã+-Ý--Ô+(Ò-)Ü41â62è64î66ò65ò12ï./î,,å/,Ü92Ñ:1Ò91ìSK»"Ä+#ßF>È.&Í.(Þ<7èE@â:7Ø/*Ú.*â51å<7ß>4Õ<.Ï5)Ë3&Ì5*Í;.Ë;0Å8.ìbXàZOÈC:¹6,º:/¸8-±3'´6*°0%°2&®2&¯4%°6'²:*´<.³=1°:0ºC;Ö\Wìppñsvöx|ûyƒõq|ÿ|„ýw€út}üs{ÿr~ÿr}ÿmxÿgsü`nôI\ÿ>\ÿ>[äAVÔek´•€’¡zƒm}™f~”c‡—j”Ÿwž¦ ¨ƒœ¨„’£Š£|€Ÿvzšqyšo|r vƒ¤u‚­wƒ³y‹¸‘¼„“¾†—¾‡œ¾Œ¢½§¼“¯½š¾Â§Ï̹ßÓÇãÒÊÜÇÄÔ¿¼Ìº¶Á²«¹ª¥ZM=ZM=ZM=ZM=ZM=ZM=ZM=ZM=XK;XK;XK;YL]P@[OC[NFYNJZPQ\SX_U^_Wfd\tibƒng‘qjxp¬€y¼‡€ÄŠÄ€Á~ºt«Œn¢—q¤¡u¨šjž™W{=Aª5+±5+Â<3Ó@8Ý>8è?:óA=õ=;õ;<ô;@ñ>Bî@IèAIâ@KÚAFÇ<9½=4¶<1±;/«:,®:+½A5ÐJAÚG@ÜA=Ô63Ð51Õ@9ÍC8»9+²5#½8'Â;(Ä=*Ä=*Ä;(Æ;(Ç:(Ê9(Ï9(Ï6&Ô2%Ú2%ã5*ê8.ï80ð91ç1&ç/%ê.%ï,&ö+'û+)þ,+ÿ-.ü*-ú%+ú$.ÿ'7ÿ$;ÿ7ÿ3ü0õ0ö.9õ3<å*1Û(,Ü.0Þ02Û+.ñ:>ô7=÷4:ö26ö/4ø03ù25ô87Û2-Ú;5×82äE?äE?Î/+Ñ2.Á"Ô51á?:èE@à=8Ø3-Ù2,Ý60Ý:1Ô:.Ï9*É5'Ç5(È9+Ê<0Ê<2Æ9/ícYáXNÉ@8º4+Â91Ã:0¿6,Â9/¿5+¾4*½4*»5)¸6)µ5(´6(°6)´;0»B9ÓYTèljïqtöx|þ|„øv€þ|„üyùv~þuÿsÿp}ÿkwüdqý_nöI]ÿ>\ÿ>\éCYÓeh®Žw‰˜oz•bu’\xŽ]cŠ•k˜p‹•p…”mp‡]l‰]h‰\g^k_q•ey›izŸk¬t„±vŠ·|»}¼“¼‚–½†›»‰›µ†¡³‹­¶—¾½¨ÏÆ·ØÇ¿ÖÁ¼Ï¼¸Æ·´º¬©²¤£\L<\L<\L<\L<\L<\L<\L<\Lù:Aö=Eï@GæAHÙ@EÏ@BÀ;6¸90±9+­9*©8(­9*»?3ÏF<ÙD>×96Ù74Ú;7ÜC=ÝOEÎH<µ3#¾9(Á:'Ä;)Æ=+É=,È<+É:)Ì9)Ï7)Ï2#Ó/#ß4*î=3ô?6ñ91é4+à4&ß5&â2%å/$ë,$î+%ñ+(ò+(ó+-ð(+ò&/ø(6þ%:ý7ü3ø3ô%7ò0;ó5Aò8Cð;Dðä,6ð2<ó/;ö.9ö-7õ.3õ.1ó/1í42Ü0,â=9Ú64ß;9ÿmjåCAÑ/-Î/,Ù:7ß@<àA;Û<6Õ7.Ö5-Ö5+Ò6*È6'Ã6%Â6'Ä8)Å;.Æ<1Æ<1Å;1ë`YáTMÉ<3¿0(Ë;3Ñ>6Î;3Ò=6Ø=8×<7Ô=6Ï<2É;1Ã9.¼6*¶6)¹;/¼@6ÏTMãgeíorøz~ÿˆû|ƒû|ƒûyûx€ÿwÿsÿn}ÿgvû`pü[mõG^ÿ\ìFZÎ`až~ev…Zi„Qh…OmƒRt…X{ˆ]}ˆ^x„\q‚X`zM_Pa…UeYn•`uœg} j~£mƒ¬r„²tˆ¶x‹¹y‹¹y¹z‘º~”º“±•¬€›©†©­’ºµ¢Ç¹®Ë¸²È¶´¸¬¬ª¡¢ —š[K;[K;[K;[K;[K;[K;[K;[K;ZJ:ZJ:ZJ:[K;[K;\L<\L<\L<]K=]K=]L<^M=^M;^O<^O<^O<^Q@^Q@]OB[OC\NE[NF\OI]OO^P_bTmdY{i^‰pgœ|t­…{·ˆ{³™…º¥…´¯€ª¸z¡ÆxŸÑuœÌcŒÈMlÜFRßA@ÕA=ÏE;ÌH;ÍG;ÓE9ÞA:î@Aõ0ÎD:Õ<7Õ31à;9åA?áD?èSLßUJ¿:+Á9)¾7$À7%Ä;)É=,Ê=,Ë9*Î8)Í4&Ò2&Ù2)å9/ñ>7õ>6ð5.ä/&à6)Þ6)à4*ã1'ç.)ê-)ì*(ì**ê),è',ë'1ò)9ö&<÷!;û=û%Aû6Hä(6ç.<ÿP\ÿ`lÿP\ò;åGDÛ=:Ú<9Õ:5Ò80Ñ7-Ð6*Í4&Æ3#¾5#¹6$»8&¿;,À9é=9æ?9á@8Ù?5Ð<2È:.Á9-»9,»=1ËNHàc_ìnoú|ÿ„ˆý~…øy€øy€üyÿx‚ÿt‚ÿn}ýetù^n÷VhóE\ý8Vÿ^N>\O?^NA]OB^PE^OJbNYbQdcTqdZ}le‘xr¢w¨ƒv¤”}§¬†«Â‰©Î‚žÚw”ál‰ÛXwÚD_óBTúDPïJPáIHÐE>ËE<ÐF<ÙD>èBBð@Cõ@GõBHíDGßCDÏA=Â?7¿@7µ=/®:+«:*ª9)®8*»;.Ì?6áFAâ=;îBBëAAÞ;6ãJBæXLÕK>È@2À8(¼3#Á8(È<-É:*Ë7)Ð8+Î0%×3)à8/é;4í:5í60ë0+å,'ã0,ã1-ç10ì31ó25ö37÷48÷6;ì-5ê,6í.=ñ0Có-Fö)Gý+Nÿ3Rô9Lå3?ð@Mÿ_lÿlzÿWfõCSõ>Pî3Dí3Aí3>é6<ã99Û83Î4*Ç/$Ë2*Ç.(Ð72òYTö\ZòXVÛA?âHFÜB@Ô<7Î70Í6-Ï8-Ï9+Ê7'Â5#¹8#³9$µ:(¸=-¹;,¶6)¼7.Æ=5ÛNGÙEAÎ50Ð1-á>9ç@:ã81ç51ë20î21ë52ç83á:2Ø:/Ð9.È:.¾6*º8+ÈIBÜ_Yënlû}€ÿ…‰ýƒõv}öw~üyÿx‚ÿsƒÿk}ýdvù^pôSeôF]ý8Vþ=ZïL]ÀTRz_BWhÑC?ÖEBãEFèBDîAEíCFçDEÚEAËB:¿?4»?3±;-©8(¨9(ª9)°8*¼:-Ê;3èIEé??ë=>å78Ú2/ÞA:îZPôh[ÚPCÉA3¾5%Â6'Ç9+È9+Ë7+Ò8,Ñ0&Ú6-æ;4é;4ê40è/,ê-+ë--ó49õ3;ø3=ü3=ÿ1>þ0=ý1=ù1>õ0Aò1Bô4Kõ5Nõ0Nö-Oÿ1Xÿ>_æ3HùO\ÿanÿ_nÿWfûP`ôDXé8JóAQê:GÝ2:Ò/2Ê2-Â8-½;+¼:*Ä:/À2(ÙJBúkcÝLGáPKÏ;9Ï;9àLJÔ@<Ê70Ê7-Î-±9)¯3'º:/ÊD;ÖGAØC=Ô72×2.ç;7ì:6è2.í2-ò,-ô,,ò./ï31è71â:1Ú<1Ò>2Â6)º4)ÅB:×XRçjhú|}ÿ†‰þ€„õv}÷xýz‚ÿx‚ÿqÿi{ûbtø]oòQc÷I`ÿ:Xý?[ðO_ºQNqX:Sf8]uEa|InSv†Y{ˆ]~‹`g‚—l€œl}Ÿm|¤o}¨p€©o‚ªnƒ©l…©lˆ«qˆ®qˆ°r†³r„³oƒµp…·r‰¸t‹µv‰¬tŽ¥wš¨„°´™ÈïØÌ¾ÚÑÌÂÂÌ«±Á›¡±ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8[L9[L9\M:\M:]L:^K<`J<^K<_L=^M;_N<^O<^O<^O:_P;`O;aP>aP>aP>aPÉ@8¾>3¸>1¯9+¨7'©:)­<*´<,Á=1Ï?7ß=:å99ã03â/2à42Û94æMEülaòh[ÙQCÆÍD>Á63É;7äUQÕF@É91È8-É:,È9(È9(Ä=)±?'¦<&¨;&¬=*«7(¬3(¼=4ÓLFÖGAÝE@Û96Ü30é73ì51ë0+ô1-ý,/ÿ+-ú./ô1/í4/æ81ß;1Ø>2É9.½3(À;2ÏNHáa^÷yzÿˆŠÿƒ‡ùzû|ƒÿ{†ÿx„ÿn~þew÷^põZlëL`õIaü9Wû=YîM]²JGhQ1Qd6\tDf~Nuˆ[Žc„h†’jˆ—n‰žsˆ¤t„¦t§r}¨p¨n©mƒ©l…©l…¨n‡«n…­o…¯o°l€²k‚¶n…·r‡³t‡­t§wœ¬…²¹šÈƯ×νÙÒÌ»¿Ê¤¬¿’š­[J8ZK8[J8ZK8[J8ZK8[J8ZK8[J8ZK8[J8[L9\K9\M:]L:]L:^K<^K<^K<^M=^M=^O<^O<\O<`Q>aR=aR?bQ?bQ?aP>aO;bL>hOKgNRbP\cWkjfuv”}|œx—‘z–«•Æ„’Ú}…ðuzþlmÿY[ýDLþ/Iÿ5Rÿ4½=0µ?1¬;+©8(­<,´?.»@1ÊA7ØC=Ù74á85Þ..â30æ:6Ó0'Ï5)ëUGÿwjë[PÑC7Ê<0Ë;0É7*Í6+Ô:0Ú70ß82å63ç32ê01í12ô36ý4<þ%6ÿ#9ÿ"9ÿ"9ÿ!8ÿ6ý5ø6ï2î9ð%Bï(Gî&Jñ'Mÿ3\ÿEhÿbuÿ`l÷WcñQ]òP]ïMZâ@MÔ2=Ú=FÌ7;»/.®/(¦5'¢;(›?&œ>%ª9'²8+ÒVJ»;2Ä?8¾41½2/ÎC@åWSÕHAÈ91Ä6*Å6(Ä5%Æ5$Ã:(±<(§:&¨7%­9*¬4&¯1%Â?5ÛRJÙIAáHBÞ;6Þ2.ê41í1/ï-+ü22þ,/ý+.ù+-ó++í-*æ1*ß4,Ö8,Ñ=1¿2(¼7.ÈIBÙ\Xówwÿ‰‹ÿ‡Šû€…þ†ÿ}ˆÿv„ÿj|þ_s÷XlöTiêD\õD^õ6Uñ:VàLZ¥HC^K-Mc5Uo?b}JtŒ\€–g‡˜lˆ›nŠ r‹¥vŒ¬z†«wªr~§m|¥i}¥g¥g‚¦i‚¥k‚¨mƒ«m‚¬l®h~°i³j„¶o‰¶s‰¯rެx™°„­»˜¿Å©ËʵËͶ½Åžªº‹—§]K7\K7]K7\K7]K7\K7]K7\K7^L8]L8^L8]L8^L8]L8^L8]L:]J<]K=^L>\L<\L<[N=]P?^SA`SB_R?`P@bQAcRBdQBdNAdLBjMIhKMdPYf[lnk†w{ž€…­‰ˆ²ƒ©¥‡©¾ˆ Ð‚’ây~ðsqújbÿa^ùJWñ>Që:Lî?NïCQê@Kæ9Ê=4Á;0¸:,§6&¯A0­<,¬6(¿A5ÌF=Ì=5Ð72Ú85Ü71Þ5.Þ6-Þ8*Ý<*×:'Ó6%Ù;0ðSLòZOÙE9Ç8*Í>.ÔB3Ò:-Ô3+ðGBá//î5:ó6=î,7ÿBMñ'3ú&2ÿ)2ÿ(2ù'ý"*ÿ'/þ'/ð&ð)ù+7ê .ì&7ñ-Aç#;ÿXrç-Dÿ]lÿ_iþZcùU\õPWëHMÝ?@Í84Ë>7ÄA7·?1¦7&™2!™6#š;'Ÿ<)§8-®7/ÂE?¿;7½31Ä64Å54ÔDCÛLHÚKEÑD;È:0Ä4)Ç5(Ë4)Å5*¼1¹=3Ö_Yésqÿû„†û‡Šÿ„Œÿxˆÿh}ÿ_wÿ[uÿUoøLføEcñ:Yô;[æ?YÛ]i‹@;VF-L^6YuBg†Mw–]}œcg€¡jƒ¦n‚¨o€§n¦m~¥l}¥i|¤h}£f£e£f¥l¦m«l¬k~­g®f±gƒ³i‡µm‹´r°vŽ®|™´‰§½™±Á¤²Á®¦²°˜žz…‹]K7]K7]K7]K7]K7]K7]K7]K7^L8^L8^L8^L8^L8^L8^L8^K:\K;^L>_M?^N>[N=[N=\Q?^RB_SC]QA]OB_OB`NDbPFcOHeNHiMJgNQeS_g_tnny~¨€‡»‡ŠÁž•Ê£‹»«£¹xÓyƒê|{ôvjöi`ø]aóOZìFRòHSøIVõEPï?Jë;Eä9?à:<Ú::Õ=8Î?7Ç>4À/Ç8(Ê8)Ó;.Þ;4öJFä01ð6;ö6Añ.<ÿ@Nï'4ó$,÷%(û),ý+,ü*+ø((ö((÷+,ï$'í%(ê%,ý;DÙ'ð4CüARØ&6ÿjuÿbjþZaüW]ôOSåBC×<8Ñ>6¾8,¿D5¹H6©>,™/)(’(ž-%°:6ÑTPÎHGÃ54Æ45Ñ==ëWUØGBÖG?ÐA9Ç9/Æ3)Ê6,Ð7/Î70Ç=3Â91Â5.Ã2-É4.Ñ83Ø?9ÞE=äJ@ÞA8Ú6-Ý0*ç0,ò21û03û03ô02ó12ô01ó/0ó0.î1-ç4-ß9-×=1¿3$¾aP@`P@]P?\O>[O?[RC[QE[QG\OG\OI_PMcQOfTTgUUgUUgV\h]nli†sv£|ƒº‚ŠËŠÔ˜‘× ŠÊª‚´¹}ŸÏ€“䄆îvósjûeg÷S\íGQðFOöHR÷EQòAKî=Eä7=à7:Ù99Ô<7Í@7ÅA4¾?0¶>-­>-ª<+«:,¸B6ÇH?À;2»0)Ê:2Í6/Ð6.Õ7,Ø8,Ù7(Ù8&Ü9&à:*Ý4-Û4.âA9éOCÞH:È5%È2#Ù@2â>5õHDè13ò5;ù7@ø4@ÿESø2?ð)0ë#&ì$'ù13õ-/ï''ì&%õ12ë)*ö8:è+1â)1ë3=ÿR^ï=Kÿ[gþ^fñV\îOTðMRêEIÝ:;Õ74Ô?9À6,Á?2¼B5³=1¬7-¥3)¡,#œ' š%©/*ÇECÂ::¼,,È35×ABô^]Ð?:ÒC;ÐA9Ë=3Ì9/Ô=4Ú@8Û@;Û@<Ø=;Ý>;ãA?ä>>à::ã?=ëIDàB9Ý<4Ù5,Ý2+ç1-ð31õ12ø02ô02ô02ô01ó/0ó0.î1-ç4-ß9-Ø>2À4%º8+µ;0Ð[Tízwÿ“’û‡Šúƒ‰ý~‰ÿr‚ÿdyÿ[tÿTqÿNmÿFgû=_ô=\îEbßTg¢AHp;3SH2Qa<]xEf‡Nr“Zu˜^tš_xžc{£g{£gy¢fy¢fy¡cx byŸby a| bz cz¢f{¤h{§h{¨e{©a{©`}«`®`‡²jеn‹²s‰¬t†¦w‚žuy“no†lSeYAPM2A>^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^L8`N:aP<`Q>]P?ZN>YOCXPEXOH[QO_UTbXYeX_iYcl\fk^glaildqok‚rtšy~µ†Ê…ŒÚŒŽáŽ‡×Ÿ‹Ó­ŠÄ³€©½yŽÌ{Þzò‚wÿsrÿcgùU\ôMTõGPôCMò>Gï-±=0¼F:ÌRGÇH?º5.º1)È91Í81Ó;0Ù=1Û;-Ù6'Ü6&à8+à5-Û2+à=4ìNBãK=Ò:,Ñ8*àB6ß7.ð>:é/0ð16÷4<ü8BÿNZÿLUý>Eò38â$&í/1ê,,ð22è**ë/.ò::Ñæ37Ý,2è9@ðEMÿXcóMWØ=CÚADáBFá>AÞ9=Ü89Ø88Ó97É83Â91½:2ÀA:ÍNHÖVSÐNNÃC@²72¶95ÏKIÙMLãQRïYZêRQñYVÉ51Î>6ÒB9Ð@7Ó?5ÙB9àC<â@;é?@ç8=ì9=ò?Cï:?è58ì>=öMJÞ93Û60Ú3+Þ3,å4.ì30ò21ô01ô02ö/2ö01õ/0õ/.ð0-é4-à8-Ù?3Â6'·5(³9.ËVOï|yÿ“’üˆ‹ý‰þz‡ýoücwÿXqÿOlÿFhÿ@cû9\ô?^éKdØZh…35g;0WO8WgCa{Kj‰Ps’Yt•\u˜^wby¡ez¢fw dv awŸavž`xŸ`xŸ`{Ÿaz cz¢fz£gz§fz§bz¨`z¨]|«]~­_†²g‹´nŒ³tŠ­s†¦u€qtŽii€dQcUDSL8G@^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M9]K5_M5`P9_P;\O>ZN@XOFXQKYPQ`W\g`hnfsshysg{sg}qh}ol}pq†rw—v}«z‚Á‡Ò„ŠàŠ‹å“ãŒÚ „¿žuŸ l‚¬nq¼vlÒviòsmÿllÿgiþ^`ûRWõFMï3Û=1Ú6*Ü4'â6*à3,â70ä=5åE9âF9ÞB3ÞA2â>2Û0&ê72ì0/ï.1ñ.4ú7?ÿPXÿ]dÿZ_ÿOSá.1ã03à,-÷EEè66Ü,,Û-.ë>@Ü25Ù37ÿbhà=BË*2Ê-4Á&*Õ;=á@EÛ6:Ù37ß9=Ü7;Í/0Ì43Í;;ÕGFÞRSì`cõilôekê^aÄ@>ÆE@å^[øhgÿopÿjjåKK×=;É40Ñ>7×D<ÖC;Õ>5Õ<4Ø:1Ü41î5;ñ-7ð,6ò.8ï,4ë,3ó9<þJKß3/Ü3.Ú3+Ü3,ã5.ê40ï4/ò21ô02ö/2÷/1ö.0õ/.ð0-ê3-â7-Ù?3Æ8*´2%²8-ÃNGï|yÿ’‘ÿˆŒÿ‰ÿw…úl|øatûTnýHgÿ>bÿ:_ú6\óAaàNeÂWap/+_?0[W>^lIe}Mk‰St’\u–_v™_xžcy¡cx buŸ`uŸ`u_vž_wž_xŸ`{Ÿaz¡bz¢d{¥e|¦d|§`y§^y¨Z{ª\}¬^€¬a…¯g‡®m‡ªp…¥sƒ r{•nrŠjexe[k^RbU_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N:^L4_N4`N8^O:[N>YOEZSMZTT_ZahbprmzuŒ{u‘{q“zp“vp’qt“rxšt}¨w¶zƒÄ~†Ï„‰Ú‹ŒÞ–Ü™ŠÍ›…¶¢ƒ£ª„‘«~yŸl[šQ>¼MBÔQIâWRëWUñSRñKMí>Cå4:é9<æ9;à;9Ø=8Ó@8ÊB6ÀA0º?/³9,ºA6«5+£.$¾I?Ùg\ÙdZËUI¸<2¸6)À3)Î:0Ù;0Ú6,Þ3)ä6-ß1*ä71ã;2Ý9/Þ>0ãF5äB3ß9+ß1(é4-ð31ï-.í*.ô17ÿEJÿV[ÿ]bÿ\aâ9<ã9<Õ+,ôJKâ89×//Û57Ì()Ì'+øXZÝ>BÕ9=Ñ6:º#Ä(+Ü<>æAEÝ49Ù,2Þ17Ù05Í(.Ò37äKNöaeûhnùcl÷`iú`løbkÖLLÕNJê\ZêVTçMMãHFÏ42Î3/ÙA<àKDäOHßJCÙ@8×:3×6.Ü.-õ2:û-:ø*7õ'4õ)4ø0:ÿ>CÿJJà1.Þ3,Ü3,Ý5,á4-ç4/í4/ð3/ô02÷/2ù.1ø-0ö..ñ/-ë2-â7-Ù=1É;-³1$±7,ºC=ìyvÿÿˆÿ|ˆÿqöhxö_rùRlûDcÿ9^ÿ6]ú6\ðFcÑN`¢IMe5+VD0[Y@^lIe|NkˆRt‘[w•_x™`{ždz cvž`s›]rœ\s›\tœ]v^wž_{Ÿaz¡by¡bz¤b|§b{¦_x¦[x§Yz©Y{ªZ~ª_ƒ­e…¬k‡©m‰§s‰¥u„s|”ru‰pnlfwe_P=_P=_P=_P=_P=_P=_P=_P=^O<^O<^O<^O<^O<^O<^O<_N:aP6aP6aO9^O<[OA[RK\VV_Zakgvso†}z—‚~¡|¥}w£{u¥xv§sy©s}°x¸{„¿~†Ä„‰ÉŽÎ”“Íš“Ç •½«›µ¼¦²É­©Å¦”ªˆmœfJœE2¯A4¶@4ÂB9ÖHDèNNîJKì?Cë=?é;=ä<;ß=:Ù@8Ð@5È>1Á=0½:0¾?6¯4,§1'»I?ÑcVÖh[ÕeWÃOBº>2º4)Ç7,Ö90Ù5,ß2+ç60â0,ã4/â7/Þ7.à>1åC4ä>0Þ4%æ4*é0+ð3/ð..ï-.ò14ó78öBEöMRüY^éFKöQWØ37ëFJÝ8<æAEÚ7:Î.0Ñ05äHKÒ7;Ð7:¹#%Õ;=Û8;å;>ëÿ0=ú*7ü.:ÿ;EÿCHûABã1/ß4-Ý4-Ý5,â4-æ3,í4/ñ40ô02÷/2ù.1ø-0ö..ñ/-ë2-ã7-Ø:/Í>0µ1%±7,²;5ésqÿŠŠÿ‡ÿv†þi}óató[p÷PjúCbÿ7`ÿ7aù;_ìLf¿O[~86]=0NF1VX@ZeEcxMj…RrŽ[v”^yša{ždxžas›]p˜Yp™WqšXqšXt›\uœ]y_xŸ`x¡_y¢^z¥^y¤\x¤Yx¤Wy¥V{§X©_‚¬d„«h†¨l‡¥o†¢q€šmx‘jq…ij~cbv]_P=_P=_P=_P=_P=_P=_P=_P=^O<^O<^O<^O<^O<^O<^O<_N:cQ9cQ9aP<]P@ZPG\TR_Zaa_mtrŠyx˜€¨ƒ°~~°yy¯yu°wwµw|¾x€Á}…Ä‚ˆÄ…ŠÁ¿—–¾ ¼¬§»¶¬µ¾³±È¸«Ð¾¦ÖÁ¢Ñ»–Ьˆ¯oT®\G¤G5¨>0ÂG?àWQïWVñNOé@Cê=?æ<=â=;ß=:×=5Ñ:1É90Á80Á<5¹:3¸=5ÁOEÇXMÇ]OÑeXÓcUÂL>¼:-Å8.Ò91×4-ß2,ç60æ40á2-à5.ã<3çC7æC4â:-ß3%ê5,æ.&ð0-ï/,ð31ñ54ç-.â24çBF÷X]öW\ÿouåDJëHMà@Æ02Ö:=òHKî9>ð7?ø=Fò7Bè-8ô>Jÿ]gÿmwÿjrÿcn÷]gú^kÿaoÿ]nùYeò\]ãPIâJGÕ74Ò/0Ù54Ò0.Ø95ßD?ãJDâIAÙ@8Ó6/Ö4/Ü71è66ê'/ü0<þ2=÷+6ù0:ÿ>Eý?Aì44â3.à5.Þ6-ß4,á3*è3,ï4/ô41ö01÷/2ù.1ø-0ø..ò/-ë2-ã7-×9.Ñ?2¶0%²6,°61èpoÿ‡ˆÿ†Žÿp‚ücxñ\pôXn÷OiûBbÿ9aÿ`P@`P@_O?_O?_O?aQAbRB_O?]M=]M=aQAcSCbRB`Q>dS?aP>]P@^QI[QPZSZeapsq‰yxšz|¥~€±€¹}ºxz·rs´lo¶twÈv{Ì€ƒÊ‹Æ–—䤾²°»¼¹´ËƳÓ̰ÙϬÛϧÜÏ£ÝУÙ˜٘Ѩˆ¸€g ^FËzgÖue½H?×QN÷ccéKLå?Aâ89ä::â:9Ü75Ù61Ö;6Ë81À5.ÇB;»<3¿I?ÆXK¹OAÎdVÑcTÌXIÅG9Ä:/Í6-Ø7/á6/ã4/ß0-ß2,à70ä=4à<0Ý7)ß5(å7,ä/$ê/&ì/)î1-î20ë40è51â64×79æJNõY]íNS×8=×6<ùX`ÿ~„ÿ~†ÿouÿgoÿipÿflõ\añX[ûZ_ÿUZÿDKü8Bû7Aö2>î+9ì0>ñ=HÿS_ÿ`iÿgrÿepþbmÿcnÿ`oý]gíSSßF@Ö85Ö41×11×/.Ø31Û94áD=ÜB:Ù?7Ö<4×90Û81à93æ66ð7<ó4;ó4;ö4<õ6;ò59ë33ã1/Þ3,Þ5.ß7.à5+ä3+é2,ï2,õ20÷12ø03ú/2ù.1ù//ó0.ì3.å7.à?5Ì8,¿6,¯/&¸;7ÒXWÿ˜šþ{ƒÿm€ÿe|ø\rðPhôGeüCeÿ;dù9`õNlÓRd‰=?P, C;&CG.KM5Y_CZjEcxMqˆZx’bx–`t•\r–Yq˜Yl•Sm–Rn—So˜Tr™Xt›Zuœ]uœ[t›XtWv Xw¡Wv¢Wv¢Uu¡Tt S{¥[{£]zž^u—[m‹Ub~MXrCSj>AW0?U/`P@`P@`P@_O?`P@aQAbRB`P@_O?`P@bRBcSCbRB`P@fVG_QF\OG^TSaZad`omkƒvw–wy¢{}®}¸x|¹quµkp´lo¶nq¾uvÐ|~Õ‰‰Ó˜˜Î¨§Ç¸¶ÁÉźÓαÛתâÛ¥çÞ¥æÝ¢äÛ¤âØ£ÛÑ ÔÇ›Ó¼š»œ€©}dÅ‹wÊ}m´VJÒa[örpìZ[çKLã?@ç=>ë>@ç;;â66Û64Ö=8É83Ê?8¹6.¸>3½K@¶H;È]MÝo`Ô`QÆH:½5)Ä0&Ô6-Ü5-Û0)â51å95ä=7à<3Ü8.Û5)ß4*ã5*ì7.í5+í2+ë0+ç0,ã2,á4.Ý52Ö87Ø>@äJLóW[ú^bü\dþ]eÿaiôS[ïNVñQYÿ_gÿjqÿflõZ`óNTí4:ñ,5ô*6÷-9ñ'5å!-æ'6í7CþPZÿZdÿblÿdmÿenÿcmý[hõQZåEEÞ<7Û64Þ63ß55Ü30Ú2/Û62à>9Û>7Ø;4×:3Û81ß82å95ç:6é9;ê7:ë7:î79î79ì65å31ß2,Ü3,Ý6-ß7,â6,å2+ê1,ò1,õ20÷12÷03ú/2ù.1÷//ó0.ì3.å7.ß<3Ô=2Â8.¶1*·74ØZ[ÿ“ûs}ÿfzÿ^vùWo÷OiùFfû?bü^QA^QA^QA^QA_RB`SCaTD`SC_RB`SCaTDaTD`SC^PCbUM\QM[QRcYbkdtqm„vu•y{¤y{¬y~¶x|»nsµei°`g¯jn¸ruÆ}}ׇ„Ý—”Û©§Ø»¹ÏËÊÈÜØ¿åá´éäªíè¦ðé¥íå¤çá§âÛ§×Ï¡Ëܸ¯©››ƒk¨ƒp§o`œRGº]UÝmi÷uuï__äJLå@DëADì>@è8:â66ß=:Ô;6ÔA:Â70·7,·>3®=/¶F8Ûj\ßi[Ù[MÊB6Å2(Ñ4+Ù6-Ù2,Þ52éA>ìGCà=6Õ2)Õ1'Ú2'Þ0%æ4*è1)ç.)æ/)ã2,â7/á=4àB9Æ-(Ê43ÜDCðVXú^b÷ZaóS[ñQ[èFQêHSïOYü\fÿmvÿntôY_ã>Dé.5ô-4û2<ü2>õ+9í'4ö6EÿKW÷ISõPWøW_þ^fÿckÿ`i÷RYéBIÞ97Þ71ã75é<8ë;;æ95á51Ý60Ý:3Ù;2×90×90Ü71á83ç:6é<8ã99ã99å97ç98è88æ74á40Û2+Ú6-Û7-Þ8,â6,ç2)ë0)ó0,÷10õ12õ13ø02÷/1÷//ò0.î3.ç6.Ý90ÜD9Ç80»4.µ/.ä_bÿƒˆølwþbxþWsúPmþLlÿCfö:]ó;_ìIfÔSgDJl;4O>,=<':?(ED/FH0Q\U'B\/E_2Ic6WJ:ZM=\O?^QA]P@^QA_RBaTD`SC`SC`SCaTDaTD`SC_RB\PDZOMZQVbXcjcsqm†vu•xz£z|­w|´sy·mr´bi¯]d¬ag±lr¾x{ʉ‰ß•‘夡䶵áÇÄÙÕÑÎáÝÄçä¹ëæ¯îê­îè¬éâ«ãÛªÚÓ©Ë¡»¶™¥¥›™„“ˆv˜q™rc›bW³i`Ïrmû‹‰õutê[]æLNèCGí@Dìô@?ï=;æ95à72Ý82Ú91Ù80Ù80Ü71ã73è96é:7â:7à;9ã:7æ:8ç:6å84à5.Ú3+Ú6,Û7-Þ8,â6,ç2)ë0)ò/+ö0/ô22ô23÷12ö01ö0/ò0.î3.ç6.Ü8/àF<É91¾3.¶,,îfjÿy€øgtÿbyýTqþKkÿGjÿ>cò6Yë=^ãQhÄXeˆBBgC7[N;GF1AC-JH3EE-LU6Sc>btLlƒUp‹XnRkPiŽKgIhJh‘Kj“Mk”Pm–To–Wp—Vt›Xs›Uq™So—Pj“MgJeŽHdG`‡D]AWy=Rq8Mi6Lf6Ne7Of8Lf7Oi9Sm>UH8WJ:[N>\O?]P@]P@_RBaTD_RB`SCaTDaTD`SC_RB_RB^QIVMR_Xhnf{tp‰xt—xw¡xz«y{´sy·jr³`g­[c«_g°jr»v|Æ€„Γ•àžžä­®ç»½æËÉßÔÓØÝÛÎá߯åá¾æâ¼äß¹à×¶ÚÐµÎÆ±¾µ¦­§›˜šŒŒŽ€‰…yŠ|q‘vk›si¨meºoi扄î~ósrñedñWYðMNîDEì@@ã:7à;7äB=ÞE?Ì<3Æ=3ÄB5¯1#®0"ÇI;ÜXKÖN@Ì=/Î8*Ð6*Ñ3*Ö42õUUÿkhú]XãD>Ü;3ß;2ã80â4-ã2,â1+Ý0)Ô0'Í/$Æ/$Â0#Å9,À4'Á3)Ë:5×CAÛEGÛBGÚ@HàDOëOZòVaòVaú^iÿgoóYaáBGê:<í57í38ï28ñ3=÷9CÿHSÿV_ä6?Ý4;ß6;ëADùJOüIMô;Aé13è51ë95ï<8ò<9ó;9ð:7é73â70ß;2Ü;1Û:0Ü90ß82ä73è64é75æ:8ä;8æ:8è:9è;7æ95á6/Ü3,Û7-Ü8.ß9-á7*å3)é1)ñ0)ô1-ó32ñ33ô22ô01ô1/ò0.î3.ç6.Þ7/àC:Ê70À1-À13÷jpÿqzúftû]túPmÿCfÿ=dÿ9cõ8^æEdÙZm«V[wE>dJ=aYFTO;KI4PI6GE.GP3L\8ZlFf|Nm…SmŠRlŒMhJfŽHgHg‘Ii’Lj“Ol•Sn•Vo–Ut™Vs˜Un•Rj’LfKcŒHaŠF_ˆFZBX|?St;Pn8Ok:Rl=Wn@ZqCUo?Vq>WqARE5UH8XK;ZM=[N>\O?^QA`SC`SCaTDaTDaTD`SC`SCbUEaVP^Vcje|yu}yšzy¡xy©vy°sw´jr³cj°[c«]e®hp¹v~LJшŒÓ™Ý£¥à¯³ã»¿åÆÇãÏÎÞÔÓØ×ÖÑÙ×ËÙÖÇ×ÑÅÒÉÀÌþʹ´¨¬£šŠ‹†x{tyvquleleogŽa[`[ÀsmØyuð{ü|yÿrpýccöSTðHGïC?ê>:á<6àA;Ñ:1ÓC:ÝTJÂ>2¸6)½9,Â=.È?/ÏB1×C5Ö@1Ñ7-Ð2/êLMú_]òWSßD?Ù:4Û81à70æ93ç92ç92â:1Ú9/Ñ9,Ê8+Ä8)°(¸3"È@2ÓI>ÒD@Ë;:Ì7;Ï:@Ñ7AâHRíV_ðYbõ^g÷`iêU[ÜAEå@>ì?;ñACúGJÿLTÿQYÿT]ÿV^á4:Ú/5Ü/3ç7:ô=Aø;?÷48ó12í42ï95ð86í42ë20ê20ç40á4.ã<4à=4ß<3Þ;2á83ä73è43è43è88ç98è88ë99ë97é75â5/Þ3,Û7-Ü8,Ý:+ß7*ã2(ç0(ï0(ò1,ñ42ð43ó32ó11ó1/ñ1.ì3.ç6.à91Ù<3Ì71Á0-Ñ@CÿnuýkuùbqðRiõHfÿ;aÿ4^ÿ6bû>däNiÊ\i‹GFjF:]L<]VCXQ>RJ7OG4ID.DJ.GU2Sc>^sHgMj‡OjŠKgŒGgŒFfŽGfHgJi’Nk”Rm”Um”Uq•Uo”Qj‘NgŽKcŒH`‰E_ˆF^†G\‚E[~DWxAVr?Uo@YpB]rG^uG[sCYtAXs@NB2QE5UI9WK;XL\P@^RBaUEbVFbVFaUE_SCaUEfZJh]YngwupŽ|x™{y wx¦vw­pu¯jo¯ah¬^f®_g°em¶pxÀ}…ؙ͉ؗ Ö¡¨Öª±Û´¹ßº¿ßÀÁÝÃÃÛÇÆØÆÃÔÅÁÐÁ»É¼³Ä»°Áµ¨¼¦˜¯–‹œˆ…Œqqqtpopfewhe†nj„_Y•d_›ZT¹f`Ùsnðzvÿ{wÿwsÿhfüZWþRNõHBæ=6çD=Ø;4ÛG=ê\RÅ;0Ä<0½7+¾6(Ç>.ÑD3ÔB3ÔA1×A3Ò86Ø>>ÝCCÜB@Ö=7Õ81Ø7/Þ7/å:3æ93å:3â;3Û>5ÕA5ÑE8ÌG6®-¼;%ÍJ8ÑL=Æ=5»0+À00Ê9>×AJáKTëU`ðZeð]eìYaßLRÔ>@Ï4/Ø7/à;9ê@@òCHõDJñBIî?Fâ5;ß26ã36ï8<õ79ø14û/2ü14ï20ð95ð74ì0.è,*ç0,æ3.à3,ä=5à=4à=4à<3ã:5æ95ê65ì65ì57ì57í57î68î66ë54ä2.Þ1+Þ7.Ý9-Ý:+ß7*á4&æ1&í1(ñ1,ð42î53ñ42ò21ó1/ñ1.ì3.ç6.â;3Ò4+Ò:5Æ20çUXÿpxùcnòZiçI`óEfÿ8bÿ/]ÿ5bÿBhÜLe±PYj5/^G7XK:UN;[P>VI8M@0JC0@F,AO.K[6Xj@bxGfJhˆIf‹FeŠDc‹BcEeŽHgLh‘Oi‘Rk’Sn’RlPhNd‹JaŠH_ˆF_‡H_‡H_…H_‚H]~G]yF]wH`wKcxOczN]uC[vAZu@JC3MF6QH9TK.ÑE6Ë>-Á2"Ê7'ÛE7ÞE?Ó97Ì3.Í50Ô;5×=5Ý<4á=4ä;4ä92Þ5.×4+Ï5)Ê8+Å<,Â?-ÔS>ÈG2½<)¾:-Ã=2Ä;5Â74Â43ÜKNÞMRáPUåTYèY]åVXÜMOÓD@É5+Ñ7+Ø7/Ý52â24å26æ18æ.6ì4>ì3;ó5?û9Bý4>ú+5ÿ(3ÿ/9ø-3ù57ù59ð./ë*+é0.è51â5/ã<4à=4à=4á=4ä;6ç:6ë76î66ì46ë35ì25í34í55ê41ã1-Û0(Þ8,Ý:+Ý:+Þ8(à4&ã3$é3&ì4*î50î52ð42ð3/ò2/ï2,ì4,ç6.ä=4Í/&×>9Ì35ùbgÿoy÷[iðNcêC]ùEhÿ:eÿ0]ÿ6aöGhÉJ]“CFR,#VI8SL:OH6[O?UI9F?-HF1>B'@J(IU1Sd:_rEe}Ig„JeˆHcˆCa‰BbŠCcEeŽHfMhPiQlPkMfJcŠIaˆG`‡F`‡H`†I^G^F_}G`|Ia{Kd{Mf|Nf~N]xC]z@^{CDB6FD8JF;PG>RH>WI>]M>_O?`Q>aR?`SB_VGbYRgb_ojnso~wq“zt |y¨yw©pp¦gg£`a¢\_¤`b­fhµopÀyzÌ„‚Ö‹ß–’眙栞ݡ¡×££Ù¤¤Ú¦£Ø¥¢×¥¡Ô¤ Ó¥žÑ£Í¢šÉ¢™ÈŸ–Ù»Ž‚°ƒ|žrn}igld^`fZZkYUrWP}WNŒWO•RI¨ZPµXPÁZSØkdìyrù‚|ÿ‹†ùuqÿusí_]ßPLÙEAïZTÌ71Å2*Ä6*Ã7(À7'Ã7&Æ9(Ê;+Ð<.Õ?1Ò8.Ö<2×?4Ó;0Í5(Í3'Ø:/â@5à90á90Þ7.×7+Ï7)É:*Æ?,ÄA/Â=.Æ@4ËE:ÍG<ÌC;Å<4»2,¶+&Ç<7ÐEBÙOLàVSãYVáXRØOIÐC:Ì;*Ó:(Ü8,â5.è./ì*2ð(3ô'6ú->ú+?û*?ý)?ÿ(?ÿ&?ÿ$<ÿ$<ÿ$8ÿ'9ÿ+<þ,9ó+5í.5è45ç;9Ý84Ý:3Þ;4à;5ã:5æ95é73ë54ë35ì46ë54é54ç53â5/Ý5,Û5)Ü8,Û9*Ü9(Þ9&ß8&â7%ã6%æ4&ì5-í4/ð50ñ4.ñ5,í5+ê5*å7,à90Ø7/Õ:6Û?BÿmwÿbsûSjõIcÿKjö6[ÿ6_ÿcçNj¯IV^$"D, ?:'HE4PMC/?G/BH&EK%KS.S]8[kDavKd~NdƒJb†F`ˆBa‰@c‹BeFhJlPm‘Ql‘LiŽHgŒGf‹HfŠJe‰Ic…HaƒGdƒJdIbGc~GdJdHe~Ga}C[{<\=_‚B=?4?A6FC[K>]M=`O;`Q<^SA^VIc[Xhcinlyso†tp•vpžtp¢pm¢gfŸaaŸ]^¡\\¤ed°kjºtrÅ}{φ‚Ù‰à”Žæ˜“å›–Ùœ˜Õ™Öžš×ž˜Ö—Õœ–Ô›•Ñž–Ñœ”Íœ“Ê›’ǚ牻ˆ®‚xtk|mdif]^f[YiZSoWM{UJŠVKšVK°\RºYRÁXRÓfaàqjãvoí~wý‡…ÿ‡…÷usîgdãUSëZUÇ2,Â/%Å7)Ã7&À7%Á8&Ä8'È;*Ï;-Ó=/Õ9,Õ9,Ó:,Ò:,Ñ9+Ñ9+Ô8+Ø8,ß;1à90Ü8.Ö8,Ï9*È9(Á:&¾9&¾6*Á80Æ=5É@8ÊA9È?7Å<4Â91¿4-Ç>6ÑH@ØOGÚQI×NFÌC;Ã7*Ê7%Ó8$Ý7)å4,í//ô+3ù)7ý(:ÿ+@ÿ*Aÿ)Aÿ&Aÿ#@ÿ!<ÿ=ÿ:ÿ:ÿ 9ÿ%;ÿ);÷-9ð19ê7:å;;Ü94Ü:5Þ;4à;5ã:5æ95é73ë52ë35ì46ë54è64ä71ß6/Ü5,Ù5)Û9*Û9*Ü9(Ü9&Þ9&ß8%á8%ã6%ç5+ê3+ë4,ë5*ë5*ê6(ä7)á7*ß;1Õ4,Ó54óTYÿesÿ[põGbÿIhÿAdÿ;`ý3[ù;aòMmÍLb‰8?S*$A5'69(;<,B@1DA0@?-=B.>G,=CKP'\b_„?b‡B69.:<1??7DA:KB;OE/Ô>/Î6(Ë/"Ú:.Ú8-Ù7,Ö8,Ð:+É:)Â9&¾7$½5)À6,Â8.Ä:0Ç=3Ê@6ËA7ÌB8Ç:1Ê@6ÏE;ÐF<ÒH>ÑG=Ê@6Å7+Ì6%Ö6&ß7,ç4/ñ03ö-5û+9ÿ*<ü';ü'=û%=ù#;û!:ú7ü7þ6ÿ8ÿ6ÿ$8ý*;÷2<ñ6=ë8;ä::Ü94Ü:5Þ;4à;5å95ç85é73ë52í36î47í55ê65å61á6/Ü5,Ø4(Ú8)Ù9)Ú9'Û8%Ý8%Þ7$à7$á6%á5'â4)ã5*ã6(ã6(á7(Þ6)Û7+Ý<2Ð1+Ø88ÿkrÿ]nþPiñ<[ÿHlÿ7]ÿ>eù5[î>bæVqª?Qa#(L/);7+07'37&9<)@=*A<(@>)BB&?FXa4s~T€Œdw‡`hSa}La€G`ƒC`…?a‰@cŒ@hŽEjJkMl‘Nn“Mk‘HhHgŒGh‹Kh‹KfˆLd†Je„KdƒJc€FdGf‚Hf‚GeFb€Bc†DeŠEhH25*58-;<4A>7G@:KB;RE.Ñ>.Ë8(Ç/!Ò6)Ó5)Ò4(Ò6)Ñ9+Í<+È=*Ä;)Ä:-Ä:/Æ90Æ9/Ç:1È;1É<3Ë=3ÓD<ÓE;ÐA9Ë=3Ë<4ÏA7Ï@8Î;1Î5'Ù5)â5.ë31ò/5÷+6ù)7ü):ù&9÷&;÷&;ø'<û&<ý%:ÿ$:ÿ#:ÿ"7þ#7ú%7ù,;÷5>ò9?è8:à87Ü94Ü:5Þ;4à;5å95ç85é73ë54î47î47î66ê65æ72á6/Ü5,×5*Ø8*Ø8(Ø8(Ù8&Ú7&Ü7$Ý6$Ý6$Û5%Ü6(Ý7'Ü9(Ü9(Û:(Ù9)×:+×:1Ð3.ëHKÿoyÿVjøD_ø<_ÿAgÿ3\ÿ8bø>cèMlÅOe€0=J C1-11'.6'4=,=B.B@+B<$E>$HE$U\0p~MŸr—¨|ƒ˜mj„W_{J]~E_ƒCa†@bŠAfCkJl‘Lm’Om’Oo”Nl’IiŽIhHiŒLiŒLhŠNg‰Mf…LdƒJdGe‚HgƒHh„If‚Gd‚DgŠHiŽIl‘L-3'36+891<;6B=9G@:MD=QG=SI=SK>UNDZUQa^eigumklkŠjhb`XVˆPP†QQXYš`cªfj´orÁuxÉ|Ђ…Ö†‡Ù‡ˆØŠ‰Ù‹ŠÖ‹ŒÏ‹ŠÌŠ‰Í‰‡Ð‰…ш„ÑŠƒÑ‰‚ÐŒ„Ï‹„È…Á†º†°‡¥~w–m…„Yj€SZnVTc\RZaOZ_HeZDxUB’LD¸TRÐSWÛRYå^dèejãklæuqäunâoh÷~vÿ‚{ÿ‡~ôl`É?2Á8(À;(¿='¿='À<'Â;'Å:'Ç8(Í7)Ø:/Ù8.Ò8,Ï9+Ì:+É:*È9)É7(Ï9+Ñ7+Ò8,Ñ7+Ï7*Ì8*Ë<,Ë>-Ê<0É=0Ê<2É;/È:0Æ8,Å7-Å5*Ð@7Ð@5Í=4É9.Ë80Î;1Í:2Ì5,Ð/%Ù0)ä20ì25ô/8ù-9û+;ü,<ü-?û.?ü/@ü/@þ/Aÿ/?ÿ-?ÿ.@ÿ)9ü)8÷+7õ0:ñ6=í8=ã77Ü43Ü94Ü:5Þ;6â:7å95ç85ê65ì44ñ48ñ48ï56í76æ72á6/Ú6,×5*Ø8*Ö9(Ö9(Ø9&Ø9&Ù8&Ú7&Ù8&Õ8%Õ:&Ö;'Õ=(Ô=(Ô=*Ô=,Ô<.Ñ7/Ú;8ÿ^eÿaqÿPi÷<[ÿAiÿ4_ÿ4`û1YôKlÛYq•>NZ%-C),:2/-0)08+7@/:B+<<"A<UH(`[5{…S£lª¾‹¨¾Ž¥wo‹[aK^F`„DcˆBeDj“Go”Np•Po“So“So”Nl’IiŽIgŒGiŒLiŒLi‹OhŠNf…Je„IdƒHe„Ig…Ih†Hg…Ge…DiŽIi‘Kl”N+1%.4*470893>:7B=:HA;KD1Î8*È4&Ê8)Ë<,É:,È:,É;/É;-Ê:/È9+È5+Ç5(Ê6,Ï;/Ò>4Ó?3Ö?6Õ>3Î7.É,#Ò+%Ü-*ç02ð39ö1;ú0<ý0?ý0?ù0@÷1@÷1@ö0=÷/<÷-9ú,9ú*7ý/<ù/;õ0:ð3:í6;æ69ß55Ù42Ü94Ý:5ß:6â:7å95ç85ê65ì44ò59ò59ð67í76æ74ß6/Ú6-Ö6*Õ7+Ô8)Ô8)Ô9'Õ8'Õ8%×7'Ô9%Ð9$Î<%Ï=&Ï?'Î@(Î@*Ð?.Ò;0Ñ61ëHIÿfrÿOdÿHfû7[ÿAmý/]ÿ7aò4XãPj¼Ufm19E(*E697325406906=-3;#38CCja:…TŸ®w©Á‡µÎ—¯Ç“’®}v”be†Q`‚F`…BcˆBgFm–Jr˜Or—Rq•Up”To”Nl‘KhHf‹Fh‹KiŒLi‹Ni‹Og†Kf…Je„If…IhˆIi‰Hi‡Gf†CjJk“Mn–P(0#+1'/4-350764<85@=8C>8IEù4>ù1>ú0@ø/?ò.<ï/<í/9í07ï-5ï,2ò+2ñ*1õ2:õ3;ò5;ì59å57á55Þ65Ü75Ü86Ý97ß:6ã:7æ87é77ê67ì46ô5:ô5:ñ7:î87æ74à70Ú6-Ô6*Ó7*Ñ8*Ð8*Ð9(Ð9(Ð9&Ñ8(Ð9&Ë9"È:"È>$Ç?%È@(È@*Ì=-Ï;1×96üU\ÿ^qÿGcÿ?aÿ:aÿ7gþ3bû8`íFdÅNa‰@IS12A64@:<:46?56<7179+4="9CSZ.‚‚P¢§q±ÅŠ¯ËŽ°Ì’¦Ã’®}{™egˆQ_E^ƒ@c‰@iDo•Js™Ps˜Sq•Uo“Sn“NkJgŒGeŠEgŠJh‹Ki‹Ni‹NfˆKd†Id†IeˆHgŠJh‹Ii‰Hf‰Ej’Ll–No™Q&.!(0%-2+13.331764:95<;6GD=DD*¾;'¼7$À4#ÑB2ãOAäN@ØB4Ë7)Ë7)Ð>/Ê;+É:*Ç8(Æ7'È6'Ê6(Î8*Ð8+Ó;.Õ;/Õ9-Ò6*Õ7,Ú<1Ý<2Ü71è88ñ8=÷:Aû9Bú4Aõ/<ò,;ï,:í/;ê19ê38ë48í57ñ56ô36ó57ð37ï6;í9<é69â45Ý33ß76à;9Ý86Þ97á96ã:7æ87é77ê67ì46ô5:ô5:ñ7:ì89æ95ß82Ø7/Ó7+Ð8+Í:*Í9+Ì;*Í:*Í:(Í:*Ì;(Å9"Â:"Ã=$Â>%Ã?(Æ?+Ê<.Ï81ß<89?48E26C41=:)>E&FU*bs?›a­½±ËŒ«É‹¦Ã‹º„ެz{™ef‡PZ|@^?a‡>hŽCo•Jr˜Or—Rp”Tn’Rn“NjIf‹Fd‰Df‰Ih‹Ki‹Ni‹NfˆKe‡Jd‡GeˆFgŠHh‹Gh‹GeŠDk“Lm—OpšR(0!'/"(-&).(.0-3317839:4==5?@8DE@JLKORYVXeZ\s]^}YX‚[Y‹^]–ee£nn¶wxÈØ„…⌌ðŠŠì†‡ä‚‚Ü€€Ö‚€Óƒ‚΀ƒÈ„ǃƒË„„ΆƒÐˆƒÓ‹„ÒŒ„ÏŠ€ÅŠ€¼‰€¯‡}Ÿ€xwozkegf]Xm[Qm[Mi\Lf^Kd_IeaHhaGo_FoP;…UA¥]O¿aYÑYXÝQTîS[ø\`ùheæYPÔD<Î70Ñ7/×:1Ö=/Ô;+Ï9(Í:&Ï9(Ñ:)Ô8)Ø8*Ü5,Ü5,Ð/%Í3)Ì8,Ê>/Å@/Á@-¾=*¼9'Â9)¾0"éWJßK?Ã/#Ñ=1Î2Ü<0Ù7,Ú8-â>4ìC<õBEò9?ð2<ö4?ö2@ñ-;í-:í2=ì7>æ5;ä68å78ë99ð:9ñ78ï77ò;=î<<ê::æ87á85ß74Ü75Ü75Þ97á98ã99æ::é9;ì9<í9<ï8<ô7;ó6:ð8:í9:ç;9à;5×90Ï7,Ê8+È9)Ç9+Æ:)Ç:)Ç:(È;*Ç<)Á9#Ä='¾:#¶4¼9%ÉD3Ï?6Ê1,ÿ^eÿVgÿIbÿ<\ø1X÷0Yû6cõBiçYo¬FQo33N3,B?6>C<@78@-1L/3K2.A9&DJ(Zn=~š_ž¸w¨Å‚¬ÊŒŸ¾‚˜¶€”²~‚ nf„RXvBY{?]€>c‡AiDn”Im•Ll”Nk’Ol‘NiŽIfŠDc†Bc†Bf‰Ih‹KfŠLdˆJg‹MhŒNg‹Kf‹HeŠEf‹EjIk“Jq›QržSt U*0")/#).').(-/,130561782;<4>?7AD=HJGOPTSUaXYkZ\u\Z^]‰db”kj¤utº~·‡ß‹Œéð‰‰ë…„ ؀~Ҁς‚Ì…†É†‡È‡ˆË‰ˆÎ‹ˆÏŒ†Î†ÌŽ…ÈŠ€¼‰±†|¡‚x‘{s€tknlb`e]Re`Me^Kf^Kh]Ki\Ij^Hk_Gn^Ew_G[C’YF­ZLÇVPÞRSõQXÿX_ðUSãLEÙ>9Õ60Ù6/Ü90Û9,Ö9(Ó8&Ñ8&Ñ8(Ô8)×7)Ü6*ß4,Ý5,Î0'É5)È9+Æ=-ÄA/Á@-¿<*¾9(Ä8)Ë<.äREÜH<È4(Ì:-È:,Â4&Ê=,Ë<+Ê;*Ê;*Ë:)Ì9)Î8)Ï6(Ó7*Ö8,Ù7,×3)Õ1'Ø1(Þ7.ç<5øDGñ8>í/9ï/:ð0=î.;ë1<ë6?ä5:Ü36Ø22ß:8îEBøIFøDCó?>é:7ç98å97â96á85à85á98á98à87â88å99ç9:é9;ì9<í9<î7;ó6:ò59î68ê88ä;8Ü:5Ó9/Ë7+Æ8*Ã:*Â:*À;*À;*Á<)Á<+Á<)½9$Á?)»:%³5¹:'Á;/Ê:2Ø<=ÿ^gÿPdÿA[ù8Wö6[õ;`ô>dãIe«?Lƒ?>_:2G;/:>08>2F<:R>=N0.S8/VK5ciEx[°pÂ}¡Æš¹}š¹€š¶ƒ©xrŽ^YuETp=\{B_@b†@iCm“Hl”Kk“LiMiMgŒGe‰Cc†Bc†DgŠJiŒLhŒNg‹MiOiMiŽKgŒGgŒFfŽEl’Im•LpœQoRt U-1"-1#,/&,.)//-11/34/45-9;0<>1@B7EHAKMLQRWUUaVWi\Yt^]fdŒpn zx·…ƒÎ‹ßêŽïŽŒíŠ‰ç‡„ßÓ|Ë}ȀƅLjˆÆŠŠÊŒŠÉŒŠÉŒˆÅŒ„¿‹‚·‰€­†|¡€v{p€ujpndbi_Vc]M_aL_aKc^Jg\Jl[In\Ho]Gq]EwaIxX?‡S=£VDÇXOãUSøOTþMSâ><Þ<7Ý84Þ71á6/á6.Ý7+Ú7(Ô7&Ó8$Ó8&Õ8'Ø6)Ý5*à3,Ý5,Ë3(Ä6(Â9)Á<+Â?-Â?-Á<+À8(Ã5'ÜJ=ÚF:ÕA5Îå84â62à72à72à72á85â96ä;8ä;8á77ä88æ8:è8;ë8<ë8<ë8<ì8;ï58î47ì57ç77â:7Ù:4Ï8/Ç7,Â8+¿:+½;+»<+»<+»<)»<+»<)¸9&½@*³9$±6$¶;+µ0'Ã40ìPTÿ[iÿJ`õ:Uð7Vñ@]ïHfçHdÍNa‚89e?6R@2DA09=,57)>6+K9/E-#R=,g]Bˆ_’«t—»{–Áz–¿{”³xœ¸…š´…€šm\uKHb5Nh8[xB_}?cƒ@hŒDl’Gj’Ih’JgLfKd‰Dd‡Cc†DeˆFh‹KkŽNkOjŽNiOiOiMhJgHh’Hl”Ko™Ms¡Vs£Wv¤Y24&04&01)01+12-23.34.46+9;-;>-?A3DF9IJDMONRQWSS]XVd\Zoda~nl”zw¬„‚ÃŒ‰Ö‘㔑ê“뎋≅قÌ|Ã|¿€~½„‚Á†…Á‰ˆÂŠÃ‹ˆ¿‰…¸‡®…}¤…{€vŽyn~rgmmaak^Vi[Pc\J]`K]aJc^Jh[JmZKqZJtZIv[FsWAxR;ŠQ=ªYFÍ[PãTPðFIñ>AÛ2/Ü5/á51ã60ã5.á5+à6)Û8)Ö7$Ó8$Ñ8&Ô9'Ø6)Ü6*à3,Ú6-È6)½8'¼7&½:(¿>+Â?-Ã;+Ä8)Æ4'éUIÓ<1Ì8,ÑB4¾5%À=+À=+À8(Ä8'Å9(Ç:)È9)Ë7)Ì6(Í3'Ò6*Ô3)Õ2)Û4,ã:3é>7ì?9ì=:è45ì59ï6;î5;ê2:æ39ä7=â<@óUVübbÿmjÿidóVQäA<ß63Ý4/ß61Þ71Þ71ß82á85â96å97æ:8å78æ89è8;é9<ë8<ë8<ë8<ì7<î5:î68ê67å97ß<7Ö<4Ì9/Å9,¾9*º;*¶;)µ<)µ<+´=)³;*³<(³:'·@,­8&­8'³;-«+"Ã54ý`gÿTdúG\ð-=@-@C.DG4IK>MNFQPNRRRVUSYX]a_lkius›€}²ˆ†ÇŒŠÓ•’ᔑâÜ‹‡Ó„Ä}º|µ|³~·„º‡„¹‰…·Š„²†¨z›€xs‡znzrfjm_^j[Ti[PjZKfZJb_Lb_Le^Li\Kn[Lr[Kw\K{ZG~UA†R=›RA¶VFÎRHÚG@â88å33Ý1-ß3/â5/ã5.á3,ß3)Ý5(Ü9(Ó8$Ð9$Ï:&Ñ:'Ô8)Ù7*Ý5,Ø7-Ä;+¹:)µ6%·8'½;+Â=.Ç;.Ç7,Ð90õ\TÖ=5É5+ÏA5¸3$·:(¼?+¿:)Ã:*Æ:+È:,Ê;-Ì:-Ï8-Ñ7-Ð3*Ò1)Ö1+Þ71å<7ê>:è;7æ74é75ï;<ðë8>è7=ê7;î7;î79ê7:ä::ß=:Ö=7Ë;2Ã;/º8*µ:*³;*¯<)¯<*¬<(¬;)¬;)ª;(¬=*¦8'§9*ª8-¬/)Ë@CÿhrôM^óH[íDYåH[ÙO^ÉT]·TWœXUdM?OL9LG4JE1FD-?B'=D#>H#KV.\g.==1==3==5;<4;=2;=/?B/@D-CG.FJ3KL:NOAQQIRRHYWJZZN_^\gerqn‰{y¡ƒ€·‡…Čьӊϊ…ǃº~y¯zw¦yv¥{v¬|y®€|®ƒ}©ƒ}£x—|t‹zrvksrffm_\j\Sk[NlZLl[Kk[Ki]Mg^Mi]Mj]Mn]Ms^Mz]MZI“`O›VG§N@¸J=Å@7Ï6.Ø1+Þ1+á51á6/â5.â4-à2)Þ4'Ü6&Ú;(Ñ9$Í;$Ì;&Î;'Ñ:)Õ9*Ù7,Ó9-Á>,´;(°5#²5#»9)Ä<.É;/Ë7-Ù?7ø[TãIAÎ:0Ì@3¸6&¬3 µ<)¼9'¿7'À7'Ã7(Å7)É7*Î7,Ñ7-Ù<3Û:2Þ93å<7ê>:ê=9ç85ã41è96ë<9ì::è8:ì>@øPPÿbcÿppùheâTPÊ=6À1+É40Ö;7ß=:à;7â;5á:2â94á83ã73ä73å55æ66é69é69ê7;ë8<ë8>ê7=è7=é6:ï8<ì89è8:ã;:Ý>:Ó>7É<2À8ÛTXûepîK\ïI]éJ\ÛM[ÉQZ´VV ZRŠ`RPI7HM9NI5H@+;567>O%Lf6lŠTw”\„›e‰šd›f£k”­t˜°|ƒ•mn}\Q`Cg{HiƒFl‹Gm‘Gj“Gf’GbGcŽGhJlMo’Pn“PlMiŽKjJj’Ls›TsUsSržQržOs¢Rw¦Uz«Zv¦Zu¥[s£YRK;RK;RJ=RJ=RJ=RJ=RJ=RK;UNXQ?YR@[TD\UE\UEb[HaZHaYLbYRe][kaiqftuj{zn„|pˆs‹s‰|p„uj{mbre]jc`k`_g_\c_Z^^ZY^YUaZRbZOe[Og[Ki\Kk\Ik\Gm]Fm]Fj^HicMqfTqZJuOB‹WJœ\P£YL¬ZL¥N=¦E4§<,±7(Â8-Ñ80Ü41Ý1-ß6/Þ7.Þ7.Þ7.Þ7.Û7+Ø6)×7)Õ8)Ô8)Ò9)Ò9)Ò9+Ò9+Ô8+Í;,½;+¶>-®9(©1 «2!·9*ÀÔH9Â=,·2#ÝPFØJ@ÔF<ÔD;ÚG?ÞG@àC>à<:à74æ87ì::ì::ç77â64à93Ü=7ÙF>ÏB9Ä:/¼4(·1&¹5)¿;/Ã?3Ã:0É<3Ò?7Ú?:â=;ç;9ì89í9:ç7:å8:å8:å99å97å97å95å95à40á51ä65å76æ89ç9:ç9:ç9;ë;>æ9;ß99Ü=:ÖA=ÍB;ÁA6·?1©:)£<+ =*›<(™:&–:%—8&‘8&A0‹<-‡/#‘/&¼LJämoçloÍVZ½LNµNOªQM¢UO›XO—]R•aTŠjSWZ/:M7FTa)~ŽP›°oŸ¼yœ½x’µs~ah€L\mCYdBT]BHP9?D0:=,@C2<@1:>0]sBgƒHpKo“Kl’Gj’Ii“KgJlPm‘So“Sl“Pm’Mk“Jm–Jm˜IqœLqžMrŸNr¡Pt£Rv§UyªYzª^y¦cm™ZbŽOWN?WN?WN?WN?WN?WN?WN?WN?XO@YPAYPA[RC\SD]TE^UF_VGd[JcZIcYMcYOf[Uj_]nbdpdhreltgpvirvirsfmm`gg[_bXY^[VZZRYVOWTKXTIXTH\VH^WGcZKcZIf[Ig\Hi]Gj^Fk_Gh`IcbMngTv\MSFšVM«VO°RJ·QE¯H9¬C0¬=,±9)¾8,Ë80Õ62Ù40Ý6.Ü8.Ü8.Ü8.Û7-Ú8-Ù7,×7+×7+Õ7+Õ7+Õ7+Ô8+Ô8+Ô8+Î:,¾<.¶>.®9(¦1 §2 ²:)¹>.¾<.Æ:-Ç4*Ë4)Ò;0ÜE:áOBßQCÝOCÛF?Ø@;Ó<5Ò;4Ö=7Ú=8Ü86Ý33ç77ë78î79ë78ç77å97â=9ÛB:ÊA7¿?4¸:,±6'¯5&²8)¸=-¿@1ÅA4Í@6×@7ß=8ã:7é77ï56ñ7:é6:ç6<ç7:æ89æ87å95å95ã:5â92ã:3ã:5ä;6ä;8ä;8å99å99ä:;ã;;ß<=Ù?=ÐA;Ä?6·=2¬;-¥;+ =*œ=+—<)–;(’:&“8%Œ:%€9'€8)‰5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<:Ã<8Æ;6Ä:0Â8-½8)¼:*¾?.Ç?/Ó9-Ù7,Ú8-Ù9-Ú8-Ø8,Ø8,Õ7+Õ7+Ô8+Ô8+Ô8+Ô8+Ô8+Ò9+Í;,Á?1¶>.¬9'¢3 3¢8"¬=)µ@.¼?-¿:+Ã7*Å5*Ë7+Î:.Îî7<ì38é06æ25å58á77Ú65Î61·5(¯7'®6&¬7&¬7&®9(²:)µ:*ÃA1ÊB4ÔA7Ü?8â;5æ95ë76î87í68ë78ë78ê86ê86è94ç:4æ;4â92á:2ß:4à;7Þ:8Ü:8Û97Ù99Ö<:Õ@<ÒC=ÊA;»;2¯6+¤6'ž7(œ;*˜;)”;)’;(:&8$Œ7#‡9%€=*v5#5'™E:ªPH¬MG©LG¦QLPJ˜UL”ZO”^R•aV•aV—aWgT‰…_™©x­½Ž¦¸ˆ¡ts†YN`8/A->3B%:F.=F3;A3:=2:=4<=599-?@2<>39<1<@29B/?L2PbNK:NK:NK:PMTQ@VS@XWC[ZF]\H^]Kb`Qf^QmWJ†[R¬ic¾c`ÁMMÈBCÐ;=Ô89Ó84Ì70Á9+º=)µC+¼B+Î;+×7)Ø8*×:+Ù9+Ö9*Ö9*Ô8)Ô8)Ô8)Ô8)Ò9)Ò9)Ò9)Ò9)Í;,Á?1¶>0«:(¡6"š4›7 £=&¯B-³;*º;,Â:,Ç9-Ë8.Î:0Ð<0Ù:4é9<ì4<æ39ã28â38á48â38â25é6<é49ç4:ç7:ã9<Û76Ð21À0(´6(­:(­:(«:(«:(«:(¬9&¯7&¸:+Á;/Î>3Ø?7à=8ä;8è96ì87î66î66î66í74ê84è:3ç:3ä<3á:2ß;2ß<5Ü=7Û=:Ù><×=;Ô>=Ï@<ËB<ÅB:¹=5­7-£5(ž7(š:*–;)“<)‘;*:(Š9&‰8%ˆ7$ƒ8%ƒ@-u4"{3%“G:¤QI¡NFžNG¡WN˜UL’XLZN\N]R”`U—aWhW‰f˜¥z©€Žj]kHDS42@&$2-:&0;*5=.9?3?1;=28;0;?18A.>K1PbÜ87Ô70Ç;.¼?+±C*µA(Ê;*Ô7(Õ8)Õ9*Ö9*Õ9*Õ9*Ô8)Ô8)Ò9)Ò9)Ò9)Ò9)Ò9)Ò9)Í;,Á?1µ=/«<)¢9$™6•5›;"§A*²B.¹@/¿;,Ã7*Å2(Ë4+Ò;0ß=8ê5:î3<ë6=é8>ç:>ä;>ã:=â9<ß58á7:â9>á=>Û=>Ñ96Ã2/¶0'¯9+«>*«>*©>*ª=)©<(©:'«8%¯6%¹7)Å;0Ð=3Ù<5ß<7ä;8è;7î87ï75ï75î85ë:4é;4ç<4ä=4â>5à?7ÞA:ÚA;ÙA>ÕA?Ñ@=ÍB?Ã?:»@8³=3ª8-¡5(›5'˜8(•<*‘<(<)Š<(ˆ:&†9'„7%ƒ6$6%}:)t3!~9*—OA£YNœRG•OE˜VJ•YN[MŽZMŒ[MŽ\Q“_T™`W‘gW~xXyƒ^r|ZU`B;E,/;%0;*0<.3=24<16<2?1:<17:/:>07@-=J0Oa;bxIk‡Lu”Qu™Qt˜NqšNršSpšRršQsœPr›Op™Kn™Jp›LsžOv¡Ry¥X{§Zz¨]x¦]qŸWg”O]ŠEX‚B`‡NY€ISzCg^Og^Og^Og^Og^Og^Og^Og^Og^Og^Og^Oh_Ph_Ph_Ph_Pi`OjaPjbOjbOjbOi`Oi`OiaNiaNiaNh`Kh`Kh`Ih`IhaGhaGhaGf_Le^Kb[I\WDWR?PM:LI8IH6IH6GH6GJ9GK:HL;IMì;Aê@CæAEàBCÜ@AÙ??Í12Ð66Ó:<Ñ=;É;9¾71µ4.­4)ª<-¥>+¥>+¥@,¥>+¤>(¦;'©:'ª7%²7'¼8+Å8.Ì70Ô94Ü=9æ>;é:7ì95ì95ë:4é;4è;4å=4â>4àB7ÝC9ÚC<ÕB;ÏA=Ê?<Ç=;¿>9±<3©:/¢8+œ6(˜7'”8)‘:):(‹=)‰<*‡<)ƒ:'‚9(€7&6%}6$x3#x5%…B2˜UEWK”PCPD•ZL“YMZN\Q\Q’[T•\U˜[VŽbUkbEV`=JS4=G,6?*2=,4>35?66=68?8=B;CF=EG/;9*78*=>0:<17:/:>06?,=J0N`:awHk‡Lu”Qu™Qt˜Nr›OršSpšPq›OrNqœMp›LošKrNu¡Ty¥X«`~©az¥]qœUf‘L_‰G]‡E^ˆIb‰PY€ISzCh_Ph_Ph_Ph_Ph_Ph_Ph_Ph_Pg^Oh_Ph_Ph_Ph_Ph_Pi`Qi`QmdUlcTjaRi`Qh_Pg^Og^Mh`MiaNiaLiaLiaLh`Ih`IhaGh`IgaKf_Le^Kb[H\WDUR?PMSQDSPAXLÂYSÙROàDEà::Ü75Õ;3Ê>/º=)µ8"É:)Ï8'Ð9(Ò;*Ò;*Ò;*Ò;*Ò;*Ñ:)Ñ:)Ñ:)Ñ:)Ñ:)Ñ:)Ñ:)Í;,Á;0¶:.­<,§>+™9#3“7Ÿ?'£9#°;)À>0Æ<1Ì8.Ð7/Ù<5ã?=ì=Bî?DéCEâDCØ@?Ê;7À50»1.¹/,¼51¾:6»<6³:2ª8.¤8,¡:+¡=-Ÿ>+ ?,¡@-¡@-¡A+£>*¦=*©;*­:(²7(¹5)¿5+É90Ô?9àC>ä=7è;5è;5ç<4å<5ä=4á>5Þ@5ÜD9ØD:ÒC;ÊA9Ä?:¼;6¸85°93¢7-™8(•5'“6'‘:)<*‹:)…8&ˆ=*…<+ƒ<*€<)~:'|8%{6&{6&y1#€8*ŒG8–SC’PB‹L=RE™_S‘WL’YN”[R–]T–]V—\V–YTŒ^QaX;EM(6@8A&>G26BE*;:&78(=>09;069.:>06?,F7GK=IK=AE4KJ6\Q;aE/ƒJ9Àj]Üg`ãUSäFEåA@àA=Õ>5É=0Æ=-Æ4%Ë5&Ì6'Í7(Í7(Î8)Ñ;,Ó=.Ò<-Ò<-Ò<-Ò<-Ñ;,Ñ;,Ñ;,Î<-»2(¶7.±;/¨:)š7"”5•7œ9"®A-³;+º6)Á4*Í6/×<7âC?êHEèDEèEHÝCCÉ:6»61´80®8.©4+«9/©9.¤8. 8-›9,–:+“<+’<+–=+˜=*™>+š?,›@-A, A-£@-¢;*¥:(«7(°6)¶6+¾8-Ä;3Ì<4Ú=6à=6â?8âA7âA9ÞB6Ú@6×@5ØH=ÒE;ÇA8»;2²5/ª3-¦1*Ÿ2+™9-’;*‘9+:*‹:)ˆ;)‡;+…<+€9'}8(|9(|9(|9({8'y6&x3$w- ‹A4—OC“MAŽL@‘QE“UJŽRG˜\R˜\R‘UMTL—ZU•XS”WT“gZ]T5IQ*AK(BK,>H/7@+2=-4?14<1HPCZ^PW[JMO:DF.AA'==%:;)>?1;=2:=2;?14=*;H.PbF7>F7=E6@F8>E5>F1HL5MI0U?'Q:¼sbËcXà_ZëUTçGGâ@>àA=Ø?9Î:0Í9+Î=,Ï=.Ï>-Ï;-Î;+Í9+Í:*Î:,Ð:+Ð:,Ð:+Ð:,Ð:+Ð:,Í;.É?5ÅB:¼B7®=/Ÿ6#–1–1›2¨5#´6(Ã;/ÑA8ÞE?æIDéJFêKHÞCAÛEDÐB>¼<3¯9/©=0¥?1Ÿ=0Ÿ?1œ>2—>0”>/=/Š>.‡@.ˆ?,Ž=*‘;*’<+“=,”?+•>+—>,™>,Ÿ@.¡=-¤:,¨8,¬8+±8-¶:0¼9/Ê<2Ð<2Ó?5ÕA7×C9ÖC9ÔD9ÑE8ÊB6ÃA4¹=3°:0©6/¤5.Ÿ4,™7,’:.Œ=,Š;,ˆ;+†:*„;*ƒ<*<,~;*|;){9)y:)x9(w8'u6'w4$€4'D7˜NC‘K?ŒJ>QD’TIRG“SJ˜XO˜UO—VPœ]X”WRŽSOŠcT]W5Xc9_jBZfBIT66C)4@*0:<19<1<@25>+;H.PbMKD63Å?3ÅA4ÃA3ÁA4¶;,²:,ª8-£7+ž6+›6,˜7.”:/;/ˆ<,‡;-„;,‚:+€;+€;+<,};+z;*z;,w9*v8)u7(t6)v4&ˆ;1”F<–NBŽJ=ˆHEI0?C(=@#:<$89';<.8:/9<1=A36?,MK4Ñ>4Ò>4Ò>4Ó?5Ó?5Ó?5Ó>7Ó?;ÑB>ËD>ÆF=ÂF<ÃI>ÇM@ÎPDÙSHÝPGâMGäIEäGBâC?àA=ÛB=ÕFBÉD?º?7«=0Ÿ>.šC0•G3”I6F4ŒE3ˆC3…B1€A0}@.zA.|?-‚:,†8,…9+†:,†:,‡;-‡;+ˆ;+‰:+‹:)Ž8)8*•9,™;/=/¢<0ª:/­8.¯9/°:.°:.°:,¯9+®8*¨7)¥7(ž6)›6*•7+’8-‘9/Ž<0ˆ<.…<-ƒ;,9*:*~9*}:*};+|:,z;,y;,w9*s8*q6(r7)u5)ŒD8’H=‘K?ŠH:‡I<‹OD“TK—TL–QL›TP˜QO”SO–\X_Xh^—~j””p…’fu‚WYh?CR+?O*P`B)=A(;='78(:;-79.9<1=A37@-NKB1=I1?G/LG1S>+g=-•ZL­_Sœ>4ž3+¶?9ØXUóigödeëRUæJNèNPÙIAÓF<Í@6Ë>4Î@6ÒD:ÕG=×G>ÚJAÚJAÝJBÝJBÞKCÞKCàKDàKEëSRèTTãSRÜROØSLØSLÛULàUNàLHáIFãEBâC@äB@âC@äEBàFDÙJFÊE@¹>7¬=2¡?2˜B1’E3G4ŒE3ˆC3‡B3ƒ@0?1~?0z?/|>/€:.ƒ9.ƒ9.ƒ9.ƒ;-ƒ;-ƒ;-ƒ;-9*‚9*…9+‡:*‰:+;-<.“;/›;/ž9-Ÿ9- :,¡9,¢8+¢8*¢8*Ÿ8)œ8)˜8(”8)9*Œ:,‰:-‡;-„:-‚:,9+€8*}8)}7+|8+{9+z8,y9-x:-v8+q5*o5)q7+t9+ŒH;I<‰I=„I;…K?ŒRF“WM˜XO˜QMœUQ˜RP“VQ’`YˆbWƒg[†zdnrQZi@JY0AR(IZ0Wi?dvNj|VXiEL[:?L.:D)C-B47@-;H.L^8_uFi…Jt“Pt˜Pt˜Nr›Os›TpœQnMmžLp¡Pw¨Y|ªaz¨`rXi“QZƒA\„Ea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EÀ;>»;<ÄFGØZ[ãefÛY[ÌGHÑJGÐEBÍB?ÐB>ÔFBÔFBÐB>É>7ÏD=ÏD=ÒD@ÔEAÖEBÙECÚDEÝDFÞ?Cß@DÞBEßEEáGGàFFàBCá>?èBDé@Cè>Aç=>ä>>ãA?áC@ßECÖBBÅ98¶50°;4¦?6š>3=/?2ˆ)=C5ã?>â@=â@=ÞC?ÓB?Å>:¶93ª70Ÿ:0—=2Ž>3†>2ƒ?2?3=2;3„93†93ˆ81ˆ92…;0„<.„<.ƒ;-;/€:.€:.€:.~:-~:-~:-~:-};/};/};/};/}90}90~80~8.€7.€7.€7.~8,€8,~8,}9,|8-{9-z8,x8,x8,x8.x8.w7-v8-v6,t6+s5*q5+m1'r6,n4)m3(o6+m4)q8-I=…SH…SJ†RGˆRH‹PHQJ”QK•RL“TMTK‰[N‚cQo_HYU:MV7O_;j~YbxQYoHUjCRg@Mb;IY5CR17D&4>#2:#6;'<>0@B5@@6<>358-39-4:.7:/9=/;?.=B,%Q?)kP=XG„NBˆE=“D?±WV¸TT»QQÀPOÀNMÁMMÂLJÃKJÐTTÈHGÂ=>Ä=:ÐB@ÓEAÏB;Ç>4ÊD9ÉE9ËF=ÍG>ÔFBØDDÜAEÝAEáBFáCDáCDâDEâDCáFDáFDáFDàEAßD@àB?ßA>àA=àA=àA=ÞC?ÔE?ÈC<º>6¬:0 90”:/Š<0‚<0€A2~@3~>4<3ƒ:3†91ˆ81‰90‡;.…<-„;,„;,ƒ;-‚:,‚:,‚:,9-9-9-9-~:/~:/~:/~:/}90}90}90}90}90}90|90|90|90z:0z:0y9/y9/y9/w9.w9.w8/w8/t8.s7-r6,r6,p6+p6+k1&q7,m4)l3(o6+l3(p7,~H>„RI…SLˆQJ‹PJQL”PM•QN”SOŠOG…SH€[K{ePsiPhkLfqQgxT^tMXnGPf?La:K_:K\:GV7CP4>2;=04:03;05;16<0:A,>D*Q[9^mDkRpŒRp“Sq™RsSsžVxŸ^|¢exžak‘T`†I]ƒ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ÎÈμ²¸¥——‡zym]_YIKL:@E1;D/>J6=H7=F5;C4;>5:;3983880==3C<2N71a84ˆHH¯]_Å`dÊWZÍQSÓNO×MKÛKJÞHGáFDãDAâBBßCDÞDFÞDFÝCEÝCEÜBDÜBBÛCBÚDCØD@ÕD?ÓF?ÒE<ÐF<ÐG=ÔE=Ù@:Ù@:ÑB:ÈC:¼C:¬@4™;/Œ9+‰=/ƒ>.>-€=,<,ƒ;,ƒ;,„<-‚:,‚:,‚:,9+9-9-~8.}9.~:/~:/}:1}:1}:1}:1}:1}:1z:1y:1x90x90w8/t8.s7-r8-t8.s9.r8-q8-r8-p7,p7,p7,o6-o6-n5,n5,m4+l3*k2)i3)g1'k7,h4)e1&h4)b0%f4)zA8MG’MH‘PJŽULˆXNYOxZOr\Nk^N^WGRPAKN=CJ:9B12:+08)17+17-06,/5+/5)08+2:+4<-9D4;F5=H7-.800621622717829;0:<.:?)?H+KY5[qChƒLq“Vwž[w¡YsœVgP^IUx@WzB[~F[~F[~F]€H_‚J_‚J_‚J_‚J^I^I]€H]€JUvIJk@@a6haQhaQhaQibRibRjcSjcSjcSibRibRibRibRibRibRibRibRkbSkbSkbSkbSkbSkbSkbSkbSlcTlcTlcTlcTlcTlcTlcTlbVpg^ng_lgatqj‡„¡ œ¼¼ºÎÐÏÏÏÏàààòòòúøùû÷ö÷óðñìéðâßèÐÆÝÁµÁ«¢‘}ub^\GKM7CH2AI2AI4@G5BD7AA7B=9C97?:69<5>?7B71J.+d66QR³giÆnmÀ\\ÇZWÐVS×QNÜLKâHHæCDåBCßCFÝDFÝDFÝCEÝCEÜBDÜBBÜBBÜDCÙCB×C?ÓD>ÒE>ÐF<ÐF<ÔE=ÜC=ÛA9ÒB:ÊD;¿E:°A6œ:-‹5&ŠD69A208+/7*6<247058157247025.06,08-19,6A3:E5=J9>K9-,6..400511606718:/:<.:?+WzB[~FY|DY|D\G_‚J_‚J^I^I^I]€H]€H]LStIHhA?]7icSicSicSicSicSicSicSicSicSicS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E24B1.8/.5..3--2+23+46+8:-9=,7?(DQ3WlEh‚Ut•`wbp˜YgPY|DWxCTu@Tu@VwBYzEYzEYzE[|G_€K_€K\}H[|G^J^J^{MSnKF_A9R4icSicSicSicSicSicSicSicSicSicSicSicSicSicSicSicSkbSkbSkbSlcTlcTmdUmdUmdUmdUmdUmdUmdUmdUneVneVlfZed_y{x—™˜²¶·ÍÑÒäéìôùüúÿÿûÿÿüÿÿýþÿþþþÿþüÿÿûÿÿúÿÿôþüçúùÝïðÑáåÄÒØ´¼ÄŸ ¨ƒ‡‘l`gEQX7DG,DC.JD4LD7KA8I>:C;9SJKia_wvœ’¾³¯ÙÎÈêÜÓþèÝÿóéÿäÛð©£ÃecµBEÇDIÚRVÛUTÑMKÊDAÍCAÔFE×EFØDDÙCDÖ=?×>@Ø@?Ö@?ÖB@ÓB?ÓB=ÔA:Ù@:Ù@:ÒB:ËE<ÀD<²B7¡<2“9.Ž<0‰=0ƒ>/>.=-~<,€=-€=-9-9-~:/}9.}9.|8-{8/{8/}:1}:1{;2{;2{;2{;2z;4x<4t;2q;1r90o9/n8.l8-l6,k7,l8-j8-j8-j8-j8-i9-j8-j8-n91m80m80m80m80i7.f4+c1(d2)a1']-#_0&c4*\-#_0&sD<}PJVP~YQpTI^J?OC7?<-46(2;*0;+1<.2=/4<14<15;17:379479668357257227007/08-.9+0;-2?.6C27E48G48G49F54>33:2/4-,2(/0(13(57*6:)6>'DQ5YmJk„Zw—fwœfl“Z_‡KWxCWuCTr@Tr@VtBXvDYwEYwEZxF]{I_}K]{I]{I_}K^|JZwKPgJAW@3I2icSicSicSicSicSicSicSicSicSicSicSicSicSicSicSicSjcSkbSkbSlcTlcTmdUmdUmdUmdUmdUmdUneVneVneVneVmg[jkfƒ‡ˆ£§¨¹¾ÁÐÕØåíïóûýõýÿûÿÿûÿÿüÿÿüþûýþùþýøÿþ÷ÿÿóøýæôýÞî÷ØæòÎÝéÃÎÚ´¶Á™¡«†€‡efmLMQ6FH0HJ5KI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ËØ“ƒ¸eS£J:´TF½WIµF;·@8ÈKEÇC>ÊC?ÌB?ÎC@ÎC>ÎC>ÍD>ÍB=ÑB<ÒC?ÎDAÅD?¸A=ª=8ž;5•<4Ž;3‰<2ƒ=3=2=1~<0=1=/~:/~:/~:/}9.|90{8/{8/{8/|<3{;2{;2z:1y:3x92w81u91n70l7/l7/j8/i7.i7.h6-g7-g7-g7-f7-f7-f7-f7-f7-f7-h70h6/g5.g5.g6/h70g6/f5.a2*e6.^2)\0'`4+a5,i=4uSJXG@E>6<5/95,;8/8:/57,36+69.5;/7:/69.69.58-57,36+28,19,28.19,19.19,19,19,.9+.9+.9+/:,0;+3>.6A17B2ex\umt’lf‰_RwKBh9KkVsCZwG]zJ^{K_|L_|LVsCNg@ÉD=ÈC<ÉB<ÑC?ÐE@ÌEAÂC=³=9¦;5œ;5•<6Œ<3‡=4…<5=4<3~<0=1=1~:/~:/~:/}9.|90{8/{8/{8/{;2{;2y:3x92w81v70v70s7/n70j8/j8/j8/j8/h8.h8.h8.g7-f7-f7-f7-d8-d8-d8-f7-g6/h70i81i81h70i81j;3l=5g80k<4b6-a5,oC:xLCtI@nMDC9056.45/8918;247.14+25,58-58-57,46+46+46+46)37)/7(.9)08+.9).9+.9)08)08)19*08)08+/7*08+19,3;.4<-9B1:C0;B0:A1:<.68*24&/3$29'IU?cu[m„gf„bWyTInE?d8Hg;Li;Nk=Nk=Li;Li;Mj
    UrDYvH[xJ]zL^{M\yKQn@G_;6B4+4/#)%gdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSicSjcSjcSjbUlbVlbVmcWmdUmdUmdUleUmfVngWogZnh\oh^mjekormtzƒŠ¥®³ÃÌÑÕßáæîñôüþôýú÷ýùùþ÷úÿôüÿòüÿñüÿîýþðûøïþúñÿùïÿúíÿùéÿòßïàËÝηÁ²›¢—|ubb_NXZL]cWmwn|†}¦¬¢¾ÀµÚÕÏîäâüîîÿôôÿô÷þôõÿùùûúøûýøüÿúøÿõôüñ÷ýñÿÿñÿùèÿôãÿÌ»½p›QD©SFµSH²C:ÀJ@ÄH@ÇG>ÉF>ÈE=ÇD<ÆC;ÆC;ÍG>ÌG>ÇG>¼C;­>5Ÿ:2—:3‘>6Š=5†=4ƒ=5=4€<3;0;1;1~:/~:/~:1}90|90{8/{8/{8/z:1z:1x92w81v70u6/u6/q6.m80k90j8/j8/i9/i9/i9/h8.g7-f7-g7-f7-f7-f7-f7-f7-f5.j81m;4k:3j92j:0m>4oC8l@5oD;d<2c=2zVJ†dZyWMbLA>:13814927<54:0/5+25,9<336+25*24)03(13(25*46+47,.6),7)/7*-8*/7*/7*/7*/7*19,08+08-/7,/7,/7,08-08+7?09B14*00!''heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjdVjdVjdXldYlcZmeZmeXmfVg`NjeRnkXol]he\feasqr‚†Š“–ž¡«³¶ÃÈËØÝàêîïö÷ùùûúüþýþþüÿÿúýþöúýòùüñúýòûþóùúòúúòùùíüúëþüçù÷ÞéåÊÕÔ¶º¹›˜˜|qtY_dMbkXr}l„‚‘›´¹²ËÌÇãâÞòîë÷óòû÷öýùøüø÷ÿþüþþüþþüýÿúýÿúýÿúýÿúýÿúúü÷ÿÿúÿûöÿê娧 £`X›D=µNE¿MCÂF<ÄD9ÊE<ÎI@ÎKAËH@ÇG<ÆG8ÃH8½J8³H8¦E5šB4‘B5‹C5†B5„B6‚@4‚>3‚<2„:1†91†9191~:1|91{80z7/z7/w7.v6-w7.w7.w8/w8/v7.u6-q5+n3+l7/i81i81h70h70g6/g6/g6/f5.g6/i70i81h70g6/e4-e3,h3-j5/m80k90j:0i;.i=0kA3gB2jI:dH:v_O~k\ŠxjŒoRJ=79.4:04:039/39/39/28.28.17-17-36-06,25,/5+14+/5+/4-.5-/4-.5-/4-/4-/4-/4-05./4-/4-.3,.3,/4-/4-/6.1;23=26@58B79D67B45@03>-4?.DQ=WeN[kQPbHEX<@T8BW6Ic>Ke>Kf=Kf=JeOj?UpGYtK\vO]wP]wRWqNHb?;O6&1+&+.$),heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZmfVidQjhSmjWjk[gg_lll~„“š¨¯µ¸ÂÄÑÖÙâçêòóõûüþÿþÿÿþÿþýûÿþúÿÿúþÿùûüôøûòöüò÷ýó÷úñøúïøúí÷úéùûåòõÚßâÃÌЯ´¸—‘–vkqUYaI_kUtoŒ˜Š§œ¿Á¼ÓÓÑççåóóñ÷÷õûûùüüúûûùþþüþþüþþüþþüþþüþþüþþüûÿþõÿÿõÿÿþÿÿÿûúÿíêð¿ºÂ~uŸKA¯M@¹K>ÂL@ÅK>ÃE9¼=4¾?6ÃE9ÄF7ÃJ7½L:³J7¦F6™C2‘C6E7…C7‚B8A7>5‚<4ƒ:3†91„93~92}:2z:1z:1y90x8/v7.v7.u6-v7.t8.t8.t8.r6,o5*m4+l7/i81j81h70i70h70g6/g6/e3,e3,g5.h6/j81j81j81k92k60l71k90k;1k;/j>1j@0iD2gH6kP=gRAufSueŒ…s†ƒrKL<69.39/39/39/28.28.28.17-17-17-17-06,06,/5+/5+/5+/4./4./4./4./4./4./4./4.05//4..3-.3-.3-.3-/4./6/.80/:21=34@66B66B66B45B16C1CP>P]IR`IIW@AO6BP7EU:Jb@Jd?Ke@Ke>Ic6I5&1-',0$)-heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZmfVmhUkiTmjWjk[kkcwww‘’—§¬²¿ÆÌÒÜÞìñô÷üÿþÿÿþÿÿÿþÿÿþÿþýûÿþúÿÿúýþøúûóõøïñ÷ëñ÷ëô÷ìõùëöøêõøåõ÷áîîÔÛÛ¿ÉÊ«°±’“–yuy`kpZt{iˆŸ§œ®µ­ÍÏÊÞÞÜïïíøøöûûùþþüþþüýýûþþüþþüþþüþþüþþüþþüþþüýÿþûÿÿûÿÿÿÿÿÿûùÿúôÿ÷íýÑÆØž”L=¥RB©L;§@1·G;ÏYMÏUJ¼@4ÄD7ÆH:ÃK=¹I;ªB7?3—@7“E;‰@9„A9A8?6~>5}=4<4}=4z;4x<4w;3w;3u:2t91t91t91r90r90r90r90o9/n8.l6,k5+l7/j81l71j81k60i70i70h6/g5.g5.f5.g6/h70i81k:3k:3l;4j;3i:0h<1k?2jC4iD2fE2fI7lVAjYGujV†m‘Ž{€mEF658-28.28.28.17-17-17-06,17-17-17-06,06,/5+/5+/5+/4./4./4./4./4./4./4./4./4./4..3--2,-2,.3-/4..5.+5-+6.-9//;12>24@46B47D38E3?L:ER>CQ:;I28F->L3DT9J_@Jb@LdBKc?Ia=G`9F_8G`9RkDXpL]uS^vVZqTPgK=T8.A.&1-',0%*.heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZmfVniVljUlkWlm]pqi€‚ž¡¦¹¾ÄÄËÑÛåçõúýûÿÿüýÿüýÿþüýüûùÿþüÿÿûÿþùûüôõöîîñæéïãçíßíñâðôåñôãñôßòñÜêêÐØØ¼ÇÇ«²±•¡¡‰‘“}“€œž‘ª­¢¶»´ÀÅ¿ÜÜÚééçööôûûùýýûÿÿýÿÿýýýûþþüþþüþþüþþüþþüþþüþþüþþþûûýÿþÿÿþÿ÷òïüóìÿüóÿûíÿôäìñ¹p•P@¢O?¸XJ·M?µE9ÀG<ÁA6ÈE;ÅI?½G=¯@9¡<4š=6–A4e=1f>2hC3iE5fG3cG2cJ6hV@i\IskV…‚oŽzpq_9=,47,28.17-17-17-06,06,06,17-17-17-06,06,/5+/5+/5+.3-.3-.3-.3-.3-.3-.3-.3-.3-.3--2,-2,-2,-2,.3--4-*4,)4,*6,+7-.:.1=14@25A36C2:G5N4DX¿@7ÆC;ÅF?¿D=±>;¦:7ž:8™>;‘=;Š?<„@=}@=xA6s>6r=5r=5r=5p>5o=4n>4m=3l<2k;1j;1i:0i:0j:0n72p62p62m61m61l71i70i70l;4k:3h91e90e90e90e:1d<2fB6cA5cC4dD5dG5dI6bI3_I2^L6eV?jbMrmW„ƒo„‡r[`L3:(28,28.17-17-17-06,06,06,17-17-17-06,06,/5+/5+/5+.3-.3-.3-.3-.3-.3-.3-.3--2,-2,,1+,1+,1+,1+-2,,3,,6.+5-*4+*4++5,.8-0;-2=/2=-5@/6A05A-1=)1=)5A-8F/=O5@T8FY=H\@J]?I^=K^>K`?TgG[pQcvZauZYkSJ]G6G4&4%$-*$),"'*heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZlfVjgTkjUlnYorasvm…„Ÿ¤¨¸¿ÇÖßäí÷ùûÿÿûÿÿûüÿþÿÿÿþÿþýûÿÿûÿÿúüüôóõêëíâãçÙÝãÕÜãÑäéÓçìÕéíÖêìÔëëÓèæÏßÚÄÓθÓÎºÌÆ¶ËøÐÉÁ×ÒÎàÛØêæåðïíóòðùù÷ýýûýýûýýûÿÿýþþüüüúþþüþþüþþüþþüþþüþþüþþüÿýüÿûüÿøùÿþýþÿýùÿýôÿøïÿõ÷ÿöð÷çÿÿíÿîÛͧ”¤kX¢[GªWE­L;¹D:ÀD<ÀE>¼E?´A>ª=:¢:9š;9•=5o?5o?5o@6n?5m>4k<2h<1h<1h<1l<2o83q62p62p62m61l71j81i81h70g80e90e:1d<2e?4f@5dB6^B4aG8cL:dM;cM8`K6]K3]M4]Q9bX?mhRss[€ƒnv{eFO:4=*39-28.28.28.17-17-17-06,17-17-17-06,06,/5+/5+/5+-2,-2,-2,-2,-2,-2,-2,-2,-2,,1++0*+0*+0*+0*,1+,3,.5.,6.*4+*4+*4++5,-7,.9+-8*0;+4?/5@/4?.3?+3>-3@,7F/9K3@O8BT:GW¸J=¹I>¸I@´G@¯D>¥=:œ:7–=9>:ˆ?9€A:xA:tD:pF:pE5j>5n=6o83r73p62p62n72l71j81i81d8/d90c;1d>3d@4cA5cA5_C5ZE4_NnlUtv^|kcmU2>(6B.3;.39/39/39/28.28.28.17-17-17-17-06,06,/5+/5+/5+-2,-2,-2,-2,-2,-2,-2,-2,,1+,1++0**/)*/)+0*,1++2+-4-+5-*4,*4,+5,+5,,6+-7,,6+/:,2=/6A17B27B15@04?.2?-4C.:G3=L5AO8DT:JX?L\BTbI\kTcqZ^mXUbPDRA2>0#/%&/,&,,$**heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjdVjdVjcYkdZlc\md[lfZlfVolYmlWjlWgkZflbr{xŽ˜š¨±¸ÊÓØãìñøýÿ÷üÿúûÿþÿÿÿþÿúùõÿÿúýýõøøîðòåéëÝåéØãêØåíÖæìÒéíÒêíÒèèÎèæÏèãÏáÚÈØÐÃØÎÄÝÒÌêßÛøíëÿôöÿõùÿõûÿùüþüýÿÿýÿÿýþþüþþüÿÿýÿÿýýýûþþüþþüþþüþþüþþüþþüþþüÿþúÿýûÿýûýüúùýüøÿÿõÿÿóÿÿíýúóÿûûÿúÿÿôÿöæÿóßÿãÍ×­•©oY¨WD®Q@¬O>¯OA±OB­K@¤C<™<5•>7?6ˆ?8A7{B7uD6qE8qE8p?8q?8s>8q?8q?8q?8q?8p?8sB;qB:o@8m>6l=5j>5m>6o>7o83q73o83m82m82i81h91f:1f;2d>3d@4bB5`C5]A3\@2WB1TG4[S>f^Gi^HbX?ZS9ZS7\W:ZV;XW;kmUsw^u}fUaI&28D03;.4:04:039/39/39/28.28.17-17-17-06,06,/5+/5+/5+-2,-2,-2,-2,-2,-2,-2,-2,,1++0*+0**/)*/)+0*+0*,1++2+)3+*4,+5-+5,,6--7.-7,,6+.8-2<16A39D69D47B46A10;+2?-5B09F22=/x=/t?/sB3tD6r=5r=7t=8s>8u@:u@:t?9q?8sA:q@9q@9q@9p?8n?7o>7o>7k92m82l:3l;4l;4h<3g<3c=2c?3^>1dG9cG9T=-N9(M8'@1WQ;PN7KI0OK2]Y>ieJeaDVU7XX<]`CosZz€fdlU=I1-9#2>*4-1=)2>*9E/BN8IU?O[GVbN]hWYdTLWI/u@8s>8u>9u@:t?9o=6p>7sA:q?8p?8p?8n?7o>7m>6n=6m>6k<4l=5m>6k?6j?6gA6eA5bB5dG9[A2^G7^I8N=+F7$G8%>6!LL4GK2DG,DD*MM1\[?baC`aBYY=dgJsw^sy_X`I:D,/;%7C/6>16<26<26<25;15;15;15;15;15;15;14:04:039/39/39/27127127116016016005/05/.3-.3--2,-2,,1+,1++0*+0**1**1*)0))0))0)*1*+2*,3+.5--4,.5-07/4;39A6?F>BJ?;F8:E57B14?.3?+6B.)r>)s@+tD0vE4q?4n<3q<4tB9sA8o?5qA7xH>n>4m>4m>4k?4l=3j>3l=3j>3g?5gA6gA6gC7eC7cC6`C5^D5bK;UB1ZI7`S@RG3C;&E=(FA+AE,BH.AE*<@%?B%NN2_`AijKaaEnqTvzagmSJO94<%4=(=F38>28>48>48>47=37=37=36<28>48>47=37=37=36<26<26<25:449349349338238238227105/05//4..3--2,,1++0*+0*).().().().().(*/)+0*,1+160/4.,1+,1+/4.6;4=BK:4.8/-4--4-,3,gdUgdUheVheVheVheVifWifWifWifWifWifWifWifWifWifWkeWkeWlcZmd[md]mf\mg[jiWkmXimVjoYjs`hthm|wˆ˜˜¦³¹¿ÊÐÓÜãëðööûÿüýÿýÿþÿÿýÿþùþþöýýñúûí÷úçô÷âîóÜåíÕâèÎÛàÀ×Ú»ÖÖ¼Ù×ÂÝ×ÇÞ×ÍåÛÙìààøìðûðöÿõûÿùþÿúýÿûûÿûûÿýüÿþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüýÿüøÿþøÿþûÿþþþþÿüþÿúÿÿùÿÿøþÿúýÿùüÿùùÿýúÿÿøÿÿøûÿõüþðÿÿíÿüéÿñßÿðÝÿïÚñÒ½´z{R>tJ4uH3vI4zM8}P;yL7nA.e7'{M@sD:qB8sD:oC8g;0d8-g=1i?3i?3i?3g?3f>2f>2f>2e?2b@4bB5`C5_C5_C5[D4ZE4WD3XI6OB/\T?oiSc^HMK4IG0IK3>D*?H-@F*48>47=37=37=39?58>48>48>48>48>48>48>47<67<67<66;56;56;55:45:438238216005//4.-2,,1+,1++0*+0**/)*/)+0*,1+-2,-2,05/.3-+0*+0*-2.2718=9;B:@K=@M;@M;=J68E13@,1?(0>'4.:0,6..5.-4-gdUgdUgdUheVheVifWifWifWifWifWifWifWifWifWifWifWkeWldWlcZmd[md]mf\mg[jiWkmXinWiqZgs_drejyt…••£²·½ÈÎÒÛâêïõôùýûüÿýÿþÿÿýÿÿúÿÿøÿÿóþÿñûþë÷úåðõÞæîÖâèÌÙÜ¿ÕÕ¹ÒйÔѾÚÔÈàÙÑêàßôéíþóùÿ÷üÿûÿÿýÿÿþÿÿþüÿþúÿþúþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüýÿþúÿÿúÿÿûÿÿþþþÿýþÿüüÿûüÿûúÿúøÿù÷ÿú÷ÿýøÿÿûÿÿûýÿúýþùùôîÿþöÿýôÿüóÿûîÿ÷çûæÕéÒÀÏ´¡¶š…”uawVCjI6lI6rM;uP>mF7iB3gB2jE5nI9nJ:oK;oK;eA1cB1cB1cB1cB1cB1bC1`C3]F6\G6\G6ZG6ZG6WH5TG4RG3PH3NH2fdM~~frrZVX@JL4GM3A.:>-;>39?59?58>48>47=37=37=38>48>48>48>48>48>48>48>49>89>89>88=78=78=77<67<66;55:449338227105//4./4.-2.-2.,1-+0,+0,,1--2.-2.,1-,1-,1-,1-.210513764;4;G9=L9@O<@O:8F71?2-9-,6--4,,3+fcTfcTgdUheVheVifWjgXjgXifWifWifWifWifWifWifWifWldWldWlcZmd[md]mf\mg[jiWkmXinWiqZgs_bpcgxr‚””£²·ÀËÑÔÝäëðöõúþûüÿýÿþÿÿýÿÿúÿÿøÿÿôÿÿóÿÿïúýèò÷àçðÕâèÌ×Ú½ÑѵÍË´Î˺ÖÏÅÞ×Ñìâã÷îóÿöþÿúÿÿýÿÿþÿÿÿýþÿúþÿùþÿúþÿúþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþüþþþýþÿýþÿýþÿýÿþýÿüþÿúþÿùÿÿ÷ýýóýýõþýøþýùÿþüþþþÿýÿÿþÿþùÿÿüÿÿûüûöóÿøòÿýôÿþñÿýíÿúéÿòà÷äÓçÒ¿Ò»©¹ŸŽŸ„srb|]K}^LtUCaD2W:(Y<*[>,X=*`E2`E2`E2_F2`G3`G3`G3]H3\K7\M:\M:YL9XM9UM8RL6QL6NL5QQ9ikS|€gmqXSY?FL2>G,48>48>48>47=37=38>48>48>48>49?59?5:?9:?9:?9:?99>89>89>88=78=78=77<66;55:4493382382/40.3/-2.,1-+0,+0,+0,+0,+0,,1--10.21/32/32/32-4-3?17F3=L7@O:?N7M:MJ9BC3=@5;A7;A7;A7:@6:@6:@69?58>48>48>49?59?5:@6:@6:@6;@:;@:;@::?9:?99>89>89>8:?9:?99>89>88=78=77<67<6495273162/40-2.,1-+/.+/.,0/,0/-10.21.23.23-12+1-+9*/@-6H2;M7=O7A6>A6>A6=@7=@79?59?59?5:@6:@6:B7:B7:B7;@9;@9;@::?8:?99>79>89>7;@:;@9;@:;@9:?9:?8:?9:?98?87=94;4382160/4..3/.3/.21.21,2.,2.+2++2*,4))6%$6)=!2F+8L1;O6;M5;M5;M58J29K3;M5H&DK*FM+EL*PV4PT3KN/HK,TT8bbFccIZZ@[Y@\ZA][B][B[Y@XV=US:SQ8HF1GD1DA0A?0@>1>>2??5>@5;>59?59?59A69A48C58C58C5:B79A69@88@58?79A69@8:B7:A9:B79@8:B7;B:E=8B:8B:7A88@56>14O<>P::L6@R8EW=FY=DX=@T;5H2+<),6+,3++2*ZgM[hN\hP]iQbjSckTglXhkXghVghVifWifWkeWlfXmeZmgYmgYkhYkg[kg\jf]jf[hfZefVhiWglVfo\erajwnzЉœ«²ºÈÑÐÙàáéìò÷ûøþþùþúúÿøûþóùýïøùë÷øæõôâíìØéæÓåâÏÜ×ÄÒ˹ʿ­Á´¤¹­¡¼¯¦Á¶²ËÁÀÛÐÖæßæûóþý÷ÿþûÿÿþÿþýÿüýÿüýÿüýÿþþþþþþþþþþþþþþþþþþÿþüÿþüÿþüÿþüÿýúÿüùÿüùÿýúÿýùÿþúÿþýÿýüÿüýÿýþÿþÿÿþÿÿýþýûüÿþýÿþûÿüúÿøóøíçòåÝöèßûðêÿúýÿüÿÿýþÿÿýÿÿûýÿüýÿþüýÿýþÿýþÿÿýÿÿþüÿþõÿÿîÿþèÿÿäúöÝýûâäàÇ‹‡lRM0SN0QK+QK+UO/UO/TO1TO1SO2SO2QP4QP4QM2PO3PN5NQ6MO7JP6HM6EM5HQ6EN1BK.?I'BI(FM+JP,KQ-NR/PT1VZ7^bA_bCY\?TWWU>XV=YW>XV=XW;WV:XT9QK3OI3LG4ID1DA2B@3A?3>@5<=59?59?59A67B48C57D37D3:B79A69A68@58@59A69A6:B7:B7:B7:B7:B7;C874>63=40>-3C)9M*BY/Ga1Op;Ln;Li=Fa>BY?F;J@?I>>I9?G8>F7>D8=B;>E>9C;6@74B19I/BV3Pg=XrB^J[}JXuIMhECZ@9O:6G54E2XR6:@6:@69A67B47B46C26C2;C8:B79A69A69A69A6:B7;C8;C8:B7:B7;C8;C8=E:>F;=G<=G?>H=>I9?G8>F7>D8=B;=D=9C;6@74B19I/DX5Ri?[uEZ{FWyFTqEIdA=T:2H3/@.->+6H2@R8L_CReGSgKOcG@W=6I30:/07/-4,YgMZhN\hP^jRblTemVinZjo[mn\lm[mk\mj[nhZnhZoi]oi[liZkhYjfZieZie\ieZig[ghXghVchRajWerao|s{‹ŠŸ¦¢°¹ÁËÔÔÝäéñôòúüôúøñöðíðçèìÞâãÕÚÛÉÒÑ¿ÌɶÉıþ«¿¸¦¼³¢Ê¾®ÓŸÜÐÄæÙÑíâàöìíÿôúÿùÿÿ÷ÿÿúÿÿüÿþýÿýüÿûüþüþýþÿÿþþþþþþþþþþþþþþþþþþÿþüÿþüþýûþýûÿýúÿýúÿýúÿûøÿúöþùõÿýüÿûúýùúþúûþüýÿýþÿþÿÿýþÿüûÿýúÿüúÿøó÷ìæòåÝøêáÿôîÿúýÿüÿÿýþÿ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y9 z`cy0JOb~C@5YN;RQ1!u&0Y_I1#>Wirj)-t+elev3a3ak4g>A_t64c6wJ7NGeQREek zF1^30uo-Tj?`--=J-}^himR5hQaP+{> zw9D)5pki1q0?O)qlQeE062WAr^eG8-ppZ7Ty<^*w`KoIL0fpZTBoLd91+gkybka32 z$?DkeYVk=PgKEWb#k7I87+OPTPVWF}L6NaIX}7&Pt$6D?%NwWe6$P+cTyV`aoN960 Yunwb=4dh&vSx?7Wvbb4A=g;(i0NR{#J2 diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/testprog.jpg b/packages/services/gfx/mw/current/src/jpeg-6b/testprog.jpg new file mode 100644 index 0000000000000000000000000000000000000000..920fee2e32b5a8ab0af796e010ee8a1add3eee63 GIT binary patch literal 5655 zc$}4&WmHt%;>Ks_W`Z1Y=!St|XplxqLJ*`IC5Mu35J`Dy5O9bAl$Ml68l;t$PEjcl zQQ(jF-uGR1-EaSW&Zo22I_vCb|JLt0`)2-T4FJ+qyQ>BO0s#Qv?FG150w@EB2nYxX z@QDZs35kh`NXV$j$w*1b=pj%_Dkc~UGZT!Fk(EP;o0Uy~osp48f>%HUfkYx%xTWMI zMP-G=kfMKH0wg9TCL<-IBPXX5g)_oM|KH=L7XT&#WB@jCfouRAFc23Eyy*il0020+ zz(1e+&%goV;^7kz-cHg30sk`x#K8sN;omF*$Z&xG91t$(_R+}A``JUsg#4NkEDEqZQ+-QrX_m{qFRvGOyp{?K=m5tu8ezDbF_fk=MT z>Zg_mRINvu?h(&vE${|DxKCKofJpikP;Keo(X+dqqBZ7R6IwMoXesoKRybdR;Kk^} zCTZ#5&ZWfP6W$4>!7kt5oXnBu2XZbbYn}cu9w)i8Crmr@D2aA*C$J#Nr$O+Y*3?;W zO=WZJi-LYde{RpwQ#>?J2czibbeZrIN9|F0r?)W=;IGt-siS=J>Ce`;apX8lc|V_A zayVCCyV1Vh57yc3KAZd5A>%h8X<1;xtozn=YDQ|QO~XSh&;B?_Qa!q4jI|?Gdchm) zK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z6kIm+UdtvMiJR|Zp=v->HdP&C<_eUJBg zf8d6(lg!2!Ntgt5fuI6gjCf|jeM>6Xw%AAC!PfWRZON+J)SYE&eob=E(QF1hGtVM~_G;S6( zMWb)QbmvvixPN5ajtFPN;2{N9_%Y9327zXC4H&EbGka^h&vm$kkvVwq0eBN+9+Chr z`*!(kj!|Q~{yw1N10<8?M>O`!GshN_%z^vCW3uOL61$1zxFR9De0G$U@o_KdqnT^s z9vD>0f`*%WU^S`bsa5F13OoyWxNRgsYC^h4VKN4aES2n6DJ@KR$C6zvTgl+Ld;FuE zGMpkXi-eG1u$^MMgm*%q;$>{C9*);i9EX`5p1PpIx18tn8@TROS7FQDFYttxi{8+z z=e64Nn=OMBs|ZZ)KHxh5*|B6BXPlzez(++@fYEX$TDiD7U+NA!(b*iOqfRdO&DYwl z+ZzW084KLkkP$VL*J@BX1~<2ORiwe;LO`pouHA%4uNqaQfR&Jf=Le){jb5r7`b*!d zrn}oI(foiT8#RL;;%1ClkWBIP--t;8j#$NI(F8aa53WI>dIKm2*GroGlGBQM$kCDQ zGcqIj_>{T4#y@LxE!RmHG)uilD?#oamJoIQReVl3<(CrNa4inAHF~PVle1jXr#V!r z$T<=bT}zBs!!xy*^n|g|Ha0;9vEs5H?(T+VvsHyoeW=VOc!;UbC6ZyEP^c4a9TQP6 zurpZ?2r|ojBTG^2B_Y|>lDv^Mt)hZ`z%!{Esy`D)lK!iJhl8{ZYnfcyJ9|cQWRT!Z zKeuC1ka3TKje-y;kgUz!RBE51^6-3~hb}M!1@e((1Od68o&b;=`8vu?z)LXD#U@7=IgRz}oX8&sBN?MFE)*y+3{Y~#+Il9F9 zJZsEb-sEDWU8R46=l$TDimage_width / (dstinfo->max_h_samp_factor * DCTSIZE); + + for (ci = 0; ci < dstinfo->num_components; ci++) { + compptr = dstinfo->comp_info + ci; + comp_width = MCU_cols * compptr->h_samp_factor; + for (blk_y = 0; blk_y < compptr->height_in_blocks; + blk_y += compptr->v_samp_factor) { + buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); + for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { + for (blk_x = 0; blk_x * 2 < comp_width; blk_x++) { + ptr1 = buffer[offset_y][blk_x]; + ptr2 = buffer[offset_y][comp_width - blk_x - 1]; + /* this unrolled loop doesn't need to know which row it's on... */ + for (k = 0; k < DCTSIZE2; k += 2) { + temp1 = *ptr1; /* swap even column */ + temp2 = *ptr2; + *ptr1++ = temp2; + *ptr2++ = temp1; + temp1 = *ptr1; /* swap odd column with sign change */ + temp2 = *ptr2; + *ptr1++ = -temp2; + *ptr2++ = -temp1; + } + } + } + } + } +} + + +LOCAL(void) +do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) +/* Vertical flip */ +{ + JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y; + int ci, i, j, offset_y; + JBLOCKARRAY src_buffer, dst_buffer; + JBLOCKROW src_row_ptr, dst_row_ptr; + JCOEFPTR src_ptr, dst_ptr; + jpeg_component_info *compptr; + + /* We output into a separate array because we can't touch different + * rows of the source virtual array simultaneously. Otherwise, this + * is a pretty straightforward analog of horizontal flip. + * Within a DCT block, vertical mirroring is done by changing the signs + * of odd-numbered rows. + * Partial iMCUs at the bottom edge are copied verbatim. + */ + MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); + + for (ci = 0; ci < dstinfo->num_components; ci++) { + compptr = dstinfo->comp_info + ci; + comp_height = MCU_rows * compptr->v_samp_factor; + for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; + dst_blk_y += compptr->v_samp_factor) { + dst_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); + if (dst_blk_y < comp_height) { + /* Row is within the mirrorable area. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor, + (JDIMENSION) compptr->v_samp_factor, FALSE); + } else { + /* Bottom-edge blocks will be copied verbatim. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, FALSE); + } + for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { + if (dst_blk_y < comp_height) { + /* Row is within the mirrorable area. */ + dst_row_ptr = dst_buffer[offset_y]; + src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1]; + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; + dst_blk_x++) { + dst_ptr = dst_row_ptr[dst_blk_x]; + src_ptr = src_row_ptr[dst_blk_x]; + for (i = 0; i < DCTSIZE; i += 2) { + /* copy even row */ + for (j = 0; j < DCTSIZE; j++) + *dst_ptr++ = *src_ptr++; + /* copy odd row with sign change */ + for (j = 0; j < DCTSIZE; j++) + *dst_ptr++ = - *src_ptr++; + } + } + } else { + /* Just copy row verbatim. */ + jcopy_block_row(src_buffer[offset_y], dst_buffer[offset_y], + compptr->width_in_blocks); + } + } + } + } +} + + +LOCAL(void) +do_transpose (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) +/* Transpose source into destination */ +{ + JDIMENSION dst_blk_x, dst_blk_y; + int ci, i, j, offset_x, offset_y; + JBLOCKARRAY src_buffer, dst_buffer; + JCOEFPTR src_ptr, dst_ptr; + jpeg_component_info *compptr; + + /* Transposing pixels within a block just requires transposing the + * DCT coefficients. + * Partial iMCUs at the edges require no special treatment; we simply + * process all the available DCT blocks for every component. + */ + for (ci = 0; ci < dstinfo->num_components; ci++) { + compptr = dstinfo->comp_info + ci; + for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; + dst_blk_y += compptr->v_samp_factor) { + dst_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); + for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; + dst_blk_x += compptr->h_samp_factor) { + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, + (JDIMENSION) compptr->h_samp_factor, FALSE); + for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { + src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; + dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; + for (i = 0; i < DCTSIZE; i++) + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + } + } + } + } + } +} + + +LOCAL(void) +do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) +/* 90 degree rotation is equivalent to + * 1. Transposing the image; + * 2. Horizontal mirroring. + * These two steps are merged into a single processing routine. + */ +{ + JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y; + int ci, i, j, offset_x, offset_y; + JBLOCKARRAY src_buffer, dst_buffer; + JCOEFPTR src_ptr, dst_ptr; + jpeg_component_info *compptr; + + /* Because of the horizontal mirror step, we can't process partial iMCUs + * at the (output) right edge properly. They just get transposed and + * not mirrored. + */ + MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); + + for (ci = 0; ci < dstinfo->num_components; ci++) { + compptr = dstinfo->comp_info + ci; + comp_width = MCU_cols * compptr->h_samp_factor; + for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; + dst_blk_y += compptr->v_samp_factor) { + dst_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); + for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; + dst_blk_x += compptr->h_samp_factor) { + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, + (JDIMENSION) compptr->h_samp_factor, FALSE); + for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { + src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; + if (dst_blk_x < comp_width) { + /* Block is within the mirrorable area. */ + dst_ptr = dst_buffer[offset_y] + [comp_width - dst_blk_x - offset_x - 1]; + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + i++; + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + } + } else { + /* Edge blocks are transposed but not mirrored. */ + dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; + for (i = 0; i < DCTSIZE; i++) + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + } + } + } + } + } + } +} + + +LOCAL(void) +do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) +/* 270 degree rotation is equivalent to + * 1. Horizontal mirroring; + * 2. Transposing the image. + * These two steps are merged into a single processing routine. + */ +{ + JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y; + int ci, i, j, offset_x, offset_y; + JBLOCKARRAY src_buffer, dst_buffer; + JCOEFPTR src_ptr, dst_ptr; + jpeg_component_info *compptr; + + /* Because of the horizontal mirror step, we can't process partial iMCUs + * at the (output) bottom edge properly. They just get transposed and + * not mirrored. + */ + MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); + + for (ci = 0; ci < dstinfo->num_components; ci++) { + compptr = dstinfo->comp_info + ci; + comp_height = MCU_rows * compptr->v_samp_factor; + for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; + dst_blk_y += compptr->v_samp_factor) { + dst_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); + for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; + dst_blk_x += compptr->h_samp_factor) { + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, + (JDIMENSION) compptr->h_samp_factor, FALSE); + for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { + dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; + if (dst_blk_y < comp_height) { + /* Block is within the mirrorable area. */ + src_ptr = src_buffer[offset_x] + [comp_height - dst_blk_y - offset_y - 1]; + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < DCTSIZE; j++) { + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + j++; + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + } + } + } else { + /* Edge blocks are transposed but not mirrored. */ + src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; + for (i = 0; i < DCTSIZE; i++) + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + } + } + } + } + } + } +} + + +LOCAL(void) +do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) +/* 180 degree rotation is equivalent to + * 1. Vertical mirroring; + * 2. Horizontal mirroring. + * These two steps are merged into a single processing routine. + */ +{ + JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y; + int ci, i, j, offset_y; + JBLOCKARRAY src_buffer, dst_buffer; + JBLOCKROW src_row_ptr, dst_row_ptr; + JCOEFPTR src_ptr, dst_ptr; + jpeg_component_info *compptr; + + MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); + MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); + + for (ci = 0; ci < dstinfo->num_components; ci++) { + compptr = dstinfo->comp_info + ci; + comp_width = MCU_cols * compptr->h_samp_factor; + comp_height = MCU_rows * compptr->v_samp_factor; + for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; + dst_blk_y += compptr->v_samp_factor) { + dst_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); + if (dst_blk_y < comp_height) { + /* Row is within the vertically mirrorable area. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor, + (JDIMENSION) compptr->v_samp_factor, FALSE); + } else { + /* Bottom-edge rows are only mirrored horizontally. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, FALSE); + } + for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { + if (dst_blk_y < comp_height) { + /* Row is within the mirrorable area. */ + dst_row_ptr = dst_buffer[offset_y]; + src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1]; + /* Process the blocks that can be mirrored both ways. */ + for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) { + dst_ptr = dst_row_ptr[dst_blk_x]; + src_ptr = src_row_ptr[comp_width - dst_blk_x - 1]; + for (i = 0; i < DCTSIZE; i += 2) { + /* For even row, negate every odd column. */ + for (j = 0; j < DCTSIZE; j += 2) { + *dst_ptr++ = *src_ptr++; + *dst_ptr++ = - *src_ptr++; + } + /* For odd row, negate every even column. */ + for (j = 0; j < DCTSIZE; j += 2) { + *dst_ptr++ = - *src_ptr++; + *dst_ptr++ = *src_ptr++; + } + } + } + /* Any remaining right-edge blocks are only mirrored vertically. */ + for (; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) { + dst_ptr = dst_row_ptr[dst_blk_x]; + src_ptr = src_row_ptr[dst_blk_x]; + for (i = 0; i < DCTSIZE; i += 2) { + for (j = 0; j < DCTSIZE; j++) + *dst_ptr++ = *src_ptr++; + for (j = 0; j < DCTSIZE; j++) + *dst_ptr++ = - *src_ptr++; + } + } + } else { + /* Remaining rows are just mirrored horizontally. */ + dst_row_ptr = dst_buffer[offset_y]; + src_row_ptr = src_buffer[offset_y]; + /* Process the blocks that can be mirrored. */ + for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) { + dst_ptr = dst_row_ptr[dst_blk_x]; + src_ptr = src_row_ptr[comp_width - dst_blk_x - 1]; + for (i = 0; i < DCTSIZE2; i += 2) { + *dst_ptr++ = *src_ptr++; + *dst_ptr++ = - *src_ptr++; + } + } + /* Any remaining right-edge blocks are only copied. */ + for (; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) { + dst_ptr = dst_row_ptr[dst_blk_x]; + src_ptr = src_row_ptr[dst_blk_x]; + for (i = 0; i < DCTSIZE2; i++) + *dst_ptr++ = *src_ptr++; + } + } + } + } + } +} + + +LOCAL(void) +do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) +/* Transverse transpose is equivalent to + * 1. 180 degree rotation; + * 2. Transposition; + * or + * 1. Horizontal mirroring; + * 2. Transposition; + * 3. Horizontal mirroring. + * These steps are merged into a single processing routine. + */ +{ + JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y; + int ci, i, j, offset_x, offset_y; + JBLOCKARRAY src_buffer, dst_buffer; + JCOEFPTR src_ptr, dst_ptr; + jpeg_component_info *compptr; + + MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); + MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); + + for (ci = 0; ci < dstinfo->num_components; ci++) { + compptr = dstinfo->comp_info + ci; + comp_width = MCU_cols * compptr->h_samp_factor; + comp_height = MCU_rows * compptr->v_samp_factor; + for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; + dst_blk_y += compptr->v_samp_factor) { + dst_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); + for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; + dst_blk_x += compptr->h_samp_factor) { + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, + (JDIMENSION) compptr->h_samp_factor, FALSE); + for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { + if (dst_blk_y < comp_height) { + src_ptr = src_buffer[offset_x] + [comp_height - dst_blk_y - offset_y - 1]; + if (dst_blk_x < comp_width) { + /* Block is within the mirrorable area. */ + dst_ptr = dst_buffer[offset_y] + [comp_width - dst_blk_x - offset_x - 1]; + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < DCTSIZE; j++) { + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + j++; + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + } + i++; + for (j = 0; j < DCTSIZE; j++) { + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + j++; + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + } + } + } else { + /* Right-edge blocks are mirrored in y only */ + dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < DCTSIZE; j++) { + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + j++; + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + } + } + } + } else { + src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; + if (dst_blk_x < comp_width) { + /* Bottom-edge blocks are mirrored in x only */ + dst_ptr = dst_buffer[offset_y] + [comp_width - dst_blk_x - offset_x - 1]; + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + i++; + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + } + } else { + /* At lower right corner, just transpose, no mirroring */ + dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; + for (i = 0; i < DCTSIZE; i++) + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + } + } + } + } + } + } + } +} + + +/* Request any required workspace. + * + * We allocate the workspace virtual arrays from the source decompression + * object, so that all the arrays (both the original data and the workspace) + * will be taken into account while making memory management decisions. + * Hence, this routine must be called after jpeg_read_header (which reads + * the image dimensions) and before jpeg_read_coefficients (which realizes + * the source's virtual arrays). + */ + +GLOBAL(void) +jtransform_request_workspace (j_decompress_ptr srcinfo, + jpeg_transform_info *info) +{ + jvirt_barray_ptr *coef_arrays = NULL; + jpeg_component_info *compptr; + int ci; + + if (info->force_grayscale && + srcinfo->jpeg_color_space == JCS_YCbCr && + srcinfo->num_components == 3) { + /* We'll only process the first component */ + info->num_components = 1; + } else { + /* Process all the components */ + info->num_components = srcinfo->num_components; + } + + switch (info->transform) { + case JXFORM_NONE: + case JXFORM_FLIP_H: + /* Don't need a workspace array */ + break; + case JXFORM_FLIP_V: + case JXFORM_ROT_180: + /* Need workspace arrays having same dimensions as source image. + * Note that we allocate arrays padded out to the next iMCU boundary, + * so that transform routines need not worry about missing edge blocks. + */ + coef_arrays = (jvirt_barray_ptr *) + (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE, + SIZEOF(jvirt_barray_ptr) * info->num_components); + for (ci = 0; ci < info->num_components; ci++) { + compptr = srcinfo->comp_info + ci; + coef_arrays[ci] = (*srcinfo->mem->request_virt_barray) + ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE, + (JDIMENSION) jround_up((long) compptr->width_in_blocks, + (long) compptr->h_samp_factor), + (JDIMENSION) jround_up((long) compptr->height_in_blocks, + (long) compptr->v_samp_factor), + (JDIMENSION) compptr->v_samp_factor); + } + break; + case JXFORM_TRANSPOSE: + case JXFORM_TRANSVERSE: + case JXFORM_ROT_90: + case JXFORM_ROT_270: + /* Need workspace arrays having transposed dimensions. + * Note that we allocate arrays padded out to the next iMCU boundary, + * so that transform routines need not worry about missing edge blocks. + */ + coef_arrays = (jvirt_barray_ptr *) + (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE, + SIZEOF(jvirt_barray_ptr) * info->num_components); + for (ci = 0; ci < info->num_components; ci++) { + compptr = srcinfo->comp_info + ci; + coef_arrays[ci] = (*srcinfo->mem->request_virt_barray) + ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE, + (JDIMENSION) jround_up((long) compptr->height_in_blocks, + (long) compptr->v_samp_factor), + (JDIMENSION) jround_up((long) compptr->width_in_blocks, + (long) compptr->h_samp_factor), + (JDIMENSION) compptr->h_samp_factor); + } + break; + } + info->workspace_coef_arrays = coef_arrays; +} + + +/* Transpose destination image parameters */ + +LOCAL(void) +transpose_critical_parameters (j_compress_ptr dstinfo) +{ + int tblno, i, j, ci, itemp; + jpeg_component_info *compptr; + JQUANT_TBL *qtblptr; + JDIMENSION dtemp; + UINT16 qtemp; + + /* Transpose basic image dimensions */ + dtemp = dstinfo->image_width; + dstinfo->image_width = dstinfo->image_height; + dstinfo->image_height = dtemp; + + /* Transpose sampling factors */ + for (ci = 0; ci < dstinfo->num_components; ci++) { + compptr = dstinfo->comp_info + ci; + itemp = compptr->h_samp_factor; + compptr->h_samp_factor = compptr->v_samp_factor; + compptr->v_samp_factor = itemp; + } + + /* Transpose quantization tables */ + for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) { + qtblptr = dstinfo->quant_tbl_ptrs[tblno]; + if (qtblptr != NULL) { + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < i; j++) { + qtemp = qtblptr->quantval[i*DCTSIZE+j]; + qtblptr->quantval[i*DCTSIZE+j] = qtblptr->quantval[j*DCTSIZE+i]; + qtblptr->quantval[j*DCTSIZE+i] = qtemp; + } + } + } + } +} + + +/* Trim off any partial iMCUs on the indicated destination edge */ + +LOCAL(void) +trim_right_edge (j_compress_ptr dstinfo) +{ + int ci, max_h_samp_factor; + JDIMENSION MCU_cols; + + /* We have to compute max_h_samp_factor ourselves, + * because it hasn't been set yet in the destination + * (and we don't want to use the source's value). + */ + max_h_samp_factor = 1; + for (ci = 0; ci < dstinfo->num_components; ci++) { + int h_samp_factor = dstinfo->comp_info[ci].h_samp_factor; + max_h_samp_factor = MAX(max_h_samp_factor, h_samp_factor); + } + MCU_cols = dstinfo->image_width / (max_h_samp_factor * DCTSIZE); + if (MCU_cols > 0) /* can't trim to 0 pixels */ + dstinfo->image_width = MCU_cols * (max_h_samp_factor * DCTSIZE); +} + +LOCAL(void) +trim_bottom_edge (j_compress_ptr dstinfo) +{ + int ci, max_v_samp_factor; + JDIMENSION MCU_rows; + + /* We have to compute max_v_samp_factor ourselves, + * because it hasn't been set yet in the destination + * (and we don't want to use the source's value). + */ + max_v_samp_factor = 1; + for (ci = 0; ci < dstinfo->num_components; ci++) { + int v_samp_factor = dstinfo->comp_info[ci].v_samp_factor; + max_v_samp_factor = MAX(max_v_samp_factor, v_samp_factor); + } + MCU_rows = dstinfo->image_height / (max_v_samp_factor * DCTSIZE); + if (MCU_rows > 0) /* can't trim to 0 pixels */ + dstinfo->image_height = MCU_rows * (max_v_samp_factor * DCTSIZE); +} + + +/* Adjust output image parameters as needed. + * + * This must be called after jpeg_copy_critical_parameters() + * and before jpeg_write_coefficients(). + * + * The return value is the set of virtual coefficient arrays to be written + * (either the ones allocated by jtransform_request_workspace, or the + * original source data arrays). The caller will need to pass this value + * to jpeg_write_coefficients(). + */ + +GLOBAL(jvirt_barray_ptr *) +jtransform_adjust_parameters (j_decompress_ptr srcinfo, + j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jpeg_transform_info *info) +{ + /* If force-to-grayscale is requested, adjust destination parameters */ + if (info->force_grayscale) { + /* We use jpeg_set_colorspace to make sure subsidiary settings get fixed + * properly. Among other things, the target h_samp_factor & v_samp_factor + * will get set to 1, which typically won't match the source. + * In fact we do this even if the source is already grayscale; that + * provides an easy way of coercing a grayscale JPEG with funny sampling + * factors to the customary 1,1. (Some decoders fail on other factors.) + */ + if ((dstinfo->jpeg_color_space == JCS_YCbCr && + dstinfo->num_components == 3) || + (dstinfo->jpeg_color_space == JCS_GRAYSCALE && + dstinfo->num_components == 1)) { + /* We have to preserve the source's quantization table number. */ + int sv_quant_tbl_no = dstinfo->comp_info[0].quant_tbl_no; + jpeg_set_colorspace(dstinfo, JCS_GRAYSCALE); + dstinfo->comp_info[0].quant_tbl_no = sv_quant_tbl_no; + } else { + /* Sorry, can't do it */ + ERREXIT(dstinfo, JERR_CONVERSION_NOTIMPL); + } + } + + /* Correct the destination's image dimensions etc if necessary */ + switch (info->transform) { + case JXFORM_NONE: + /* Nothing to do */ + break; + case JXFORM_FLIP_H: + if (info->trim) + trim_right_edge(dstinfo); + break; + case JXFORM_FLIP_V: + if (info->trim) + trim_bottom_edge(dstinfo); + break; + case JXFORM_TRANSPOSE: + transpose_critical_parameters(dstinfo); + /* transpose does NOT have to trim anything */ + break; + case JXFORM_TRANSVERSE: + transpose_critical_parameters(dstinfo); + if (info->trim) { + trim_right_edge(dstinfo); + trim_bottom_edge(dstinfo); + } + break; + case JXFORM_ROT_90: + transpose_critical_parameters(dstinfo); + if (info->trim) + trim_right_edge(dstinfo); + break; + case JXFORM_ROT_180: + if (info->trim) { + trim_right_edge(dstinfo); + trim_bottom_edge(dstinfo); + } + break; + case JXFORM_ROT_270: + transpose_critical_parameters(dstinfo); + if (info->trim) + trim_bottom_edge(dstinfo); + break; + } + + /* Return the appropriate output data set */ + if (info->workspace_coef_arrays != NULL) + return info->workspace_coef_arrays; + return src_coef_arrays; +} + + +/* Execute the actual transformation, if any. + * + * This must be called *after* jpeg_write_coefficients, because it depends + * on jpeg_write_coefficients to have computed subsidiary values such as + * the per-component width and height fields in the destination object. + * + * Note that some transformations will modify the source data arrays! + */ + +GLOBAL(void) +jtransform_execute_transformation (j_decompress_ptr srcinfo, + j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jpeg_transform_info *info) +{ + jvirt_barray_ptr *dst_coef_arrays = info->workspace_coef_arrays; + + switch (info->transform) { + case JXFORM_NONE: + break; + case JXFORM_FLIP_H: + do_flip_h(srcinfo, dstinfo, src_coef_arrays); + break; + case JXFORM_FLIP_V: + do_flip_v(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); + break; + case JXFORM_TRANSPOSE: + do_transpose(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); + break; + case JXFORM_TRANSVERSE: + do_transverse(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); + break; + case JXFORM_ROT_90: + do_rot_90(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); + break; + case JXFORM_ROT_180: + do_rot_180(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); + break; + case JXFORM_ROT_270: + do_rot_270(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); + break; + } +} + +#endif /* TRANSFORMS_SUPPORTED */ + + +/* Setup decompression object to save desired markers in memory. + * This must be called before jpeg_read_header() to have the desired effect. + */ + +GLOBAL(void) +jcopy_markers_setup (j_decompress_ptr srcinfo, JCOPY_OPTION option) +{ +#ifdef SAVE_MARKERS_SUPPORTED + int m; + + /* Save comments except under NONE option */ + if (option != JCOPYOPT_NONE) { + jpeg_save_markers(srcinfo, JPEG_COM, 0xFFFF); + } + /* Save all types of APPn markers iff ALL option */ + if (option == JCOPYOPT_ALL) { + for (m = 0; m < 16; m++) + jpeg_save_markers(srcinfo, JPEG_APP0 + m, 0xFFFF); + } +#endif /* SAVE_MARKERS_SUPPORTED */ +} + +/* Copy markers saved in the given source object to the destination object. + * This should be called just after jpeg_start_compress() or + * jpeg_write_coefficients(). + * Note that those routines will have written the SOI, and also the + * JFIF APP0 or Adobe APP14 markers if selected. + */ + +GLOBAL(void) +jcopy_markers_execute (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + JCOPY_OPTION option) +{ + jpeg_saved_marker_ptr marker; + + /* In the current implementation, we don't actually need to examine the + * option flag here; we just copy everything that got saved. + * But to avoid confusion, we do not output JFIF and Adobe APP14 markers + * if the encoder library already wrote one. + */ + for (marker = srcinfo->marker_list; marker != NULL; marker = marker->next) { + if (dstinfo->write_JFIF_header && + marker->marker == JPEG_APP0 && + marker->data_length >= 5 && + GETJOCTET(marker->data[0]) == 0x4A && + GETJOCTET(marker->data[1]) == 0x46 && + GETJOCTET(marker->data[2]) == 0x49 && + GETJOCTET(marker->data[3]) == 0x46 && + GETJOCTET(marker->data[4]) == 0) + continue; /* reject duplicate JFIF */ + if (dstinfo->write_Adobe_marker && + marker->marker == JPEG_APP0+14 && + marker->data_length >= 5 && + GETJOCTET(marker->data[0]) == 0x41 && + GETJOCTET(marker->data[1]) == 0x64 && + GETJOCTET(marker->data[2]) == 0x6F && + GETJOCTET(marker->data[3]) == 0x62 && + GETJOCTET(marker->data[4]) == 0x65) + continue; /* reject duplicate Adobe */ +#ifdef NEED_FAR_POINTERS + /* We could use jpeg_write_marker if the data weren't FAR... */ + { + unsigned int i; + jpeg_write_m_header(dstinfo, marker->marker, marker->data_length); + for (i = 0; i < marker->data_length; i++) + jpeg_write_m_byte(dstinfo, marker->data[i]); + } +#else + jpeg_write_marker(dstinfo, marker->marker, + marker->data, marker->data_length); +#endif + } +} diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/transupp.h b/packages/services/gfx/mw/current/src/jpeg-6b/transupp.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/transupp.h @@ -0,0 +1,135 @@ +/* + * transupp.h + * + * Copyright (C) 1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains declarations for image transformation routines and + * other utility code used by the jpegtran sample application. These are + * NOT part of the core JPEG library. But we keep these routines separate + * from jpegtran.c to ease the task of maintaining jpegtran-like programs + * that have other user interfaces. + * + * NOTE: all the routines declared here have very specific requirements + * about when they are to be executed during the reading and writing of the + * source and destination files. See the comments in transupp.c, or see + * jpegtran.c for an example of correct usage. + */ + +/* If you happen not to want the image transform support, disable it here */ +#ifndef TRANSFORMS_SUPPORTED +#define TRANSFORMS_SUPPORTED 1 /* 0 disables transform code */ +#endif + +/* Short forms of external names for systems with brain-damaged linkers. */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jtransform_request_workspace jTrRequest +#define jtransform_adjust_parameters jTrAdjust +#define jtransform_execute_transformation jTrExec +#define jcopy_markers_setup jCMrkSetup +#define jcopy_markers_execute jCMrkExec +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + + +/* + * Codes for supported types of image transformations. + */ + +typedef enum { + JXFORM_NONE, /* no transformation */ + JXFORM_FLIP_H, /* horizontal flip */ + JXFORM_FLIP_V, /* vertical flip */ + JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */ + JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */ + JXFORM_ROT_90, /* 90-degree clockwise rotation */ + JXFORM_ROT_180, /* 180-degree rotation */ + JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */ +} JXFORM_CODE; + +/* + * Although rotating and flipping data expressed as DCT coefficients is not + * hard, there is an asymmetry in the JPEG format specification for images + * whose dimensions aren't multiples of the iMCU size. The right and bottom + * image edges are padded out to the next iMCU boundary with junk data; but + * no padding is possible at the top and left edges. If we were to flip + * the whole image including the pad data, then pad garbage would become + * visible at the top and/or left, and real pixels would disappear into the + * pad margins --- perhaps permanently, since encoders & decoders may not + * bother to preserve DCT blocks that appear to be completely outside the + * nominal image area. So, we have to exclude any partial iMCUs from the + * basic transformation. + * + * Transpose is the only transformation that can handle partial iMCUs at the + * right and bottom edges completely cleanly. flip_h can flip partial iMCUs + * at the bottom, but leaves any partial iMCUs at the right edge untouched. + * Similarly flip_v leaves any partial iMCUs at the bottom edge untouched. + * The other transforms are defined as combinations of these basic transforms + * and process edge blocks in a way that preserves the equivalence. + * + * The "trim" option causes untransformable partial iMCUs to be dropped; + * this is not strictly lossless, but it usually gives the best-looking + * result for odd-size images. Note that when this option is active, + * the expected mathematical equivalences between the transforms may not hold. + * (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim + * followed by -rot 180 -trim trims both edges.) + * + * We also offer a "force to grayscale" option, which simply discards the + * chrominance channels of a YCbCr image. This is lossless in the sense that + * the luminance channel is preserved exactly. It's not the same kind of + * thing as the rotate/flip transformations, but it's convenient to handle it + * as part of this package, mainly because the transformation routines have to + * be aware of the option to know how many components to work on. + */ + +typedef struct { + /* Options: set by caller */ + JXFORM_CODE transform; /* image transform operator */ + boolean trim; /* if TRUE, trim partial MCUs as needed */ + boolean force_grayscale; /* if TRUE, convert color image to grayscale */ + + /* Internal workspace: caller should not touch these */ + int num_components; /* # of components in workspace */ + jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */ +} jpeg_transform_info; + + +#if TRANSFORMS_SUPPORTED + +/* Request any required workspace */ +EXTERN(void) jtransform_request_workspace + JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info)); +/* Adjust output image parameters */ +EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters + JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jpeg_transform_info *info)); +/* Execute the actual transformation, if any */ +EXTERN(void) jtransform_execute_transformation + JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jpeg_transform_info *info)); + +#endif /* TRANSFORMS_SUPPORTED */ + + +/* + * Support for copying optional markers from source to destination file. + */ + +typedef enum { + JCOPYOPT_NONE, /* copy no optional markers */ + JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */ + JCOPYOPT_ALL /* copy all optional markers */ +} JCOPY_OPTION; + +#define JCOPYOPT_DEFAULT JCOPYOPT_COMMENTS /* recommended default */ + +/* Setup decompression object to save desired markers in memory */ +EXTERN(void) jcopy_markers_setup + JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option)); +/* Copy markers saved in the given source object to the destination object */ +EXTERN(void) jcopy_markers_execute + JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + JCOPY_OPTION option)); diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/usage.doc b/packages/services/gfx/mw/current/src/jpeg-6b/usage.doc new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/usage.doc @@ -0,0 +1,562 @@ +USAGE instructions for the Independent JPEG Group's JPEG software +================================================================= + +This file describes usage of the JPEG conversion programs cjpeg and djpeg, +as well as the utility programs jpegtran, rdjpgcom and wrjpgcom. (See +the other documentation files if you wish to use the JPEG library within +your own programs.) + +If you are on a Unix machine you may prefer to read the Unix-style manual +pages in files cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1. + + +INTRODUCTION + +These programs implement JPEG image compression and decompression. JPEG +(pronounced "jay-peg") is a standardized compression method for full-color +and gray-scale images. JPEG is designed to handle "real-world" scenes, +for example scanned photographs. Cartoons, line drawings, and other +non-realistic images are not JPEG's strong suit; on that sort of material +you may get poor image quality and/or little compression. + +JPEG is lossy, meaning that the output image is not necessarily identical to +the input image. Hence you should not use JPEG if you have to have identical +output bits. However, on typical real-world images, very good compression +levels can be obtained with no visible change, and amazingly high compression +is possible if you can tolerate a low-quality image. You can trade off image +quality against file size by adjusting the compressor's "quality" setting. + + +GENERAL USAGE + +We provide two programs, cjpeg to compress an image file into JPEG format, +and djpeg to decompress a JPEG file back into a conventional image format. + +On Unix-like systems, you say: + cjpeg [switches] [imagefile] >jpegfile +or + djpeg [switches] [jpegfile] >imagefile +The programs read the specified input file, or standard input if none is +named. They always write to standard output (with trace/error messages to +standard error). These conventions are handy for piping images between +programs. + +On most non-Unix systems, you say: + cjpeg [switches] imagefile jpegfile +or + djpeg [switches] jpegfile imagefile +i.e., both the input and output files are named on the command line. This +style is a little more foolproof, and it loses no functionality if you don't +have pipes. (You can get this style on Unix too, if you prefer, by defining +TWO_FILE_COMMANDLINE when you compile the programs; see install.doc.) + +You can also say: + cjpeg [switches] -outfile jpegfile imagefile +or + djpeg [switches] -outfile imagefile jpegfile +This syntax works on all systems, so it is useful for scripts. + +The currently supported image file formats are: PPM (PBMPLUS color format), +PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit +format). (RLE is supported only if the URT library is available.) +cjpeg recognizes the input image format automatically, with the exception +of some Targa-format files. You have to tell djpeg which format to generate. + +JPEG files are in the defacto standard JFIF file format. There are other, +less widely used JPEG-based file formats, but we don't support them. + +All switch names may be abbreviated; for example, -grayscale may be written +-gray or -gr. Most of the "basic" switches can be abbreviated to as little as +one letter. Upper and lower case are equivalent (-BMP is the same as -bmp). +British spellings are also accepted (e.g., -greyscale), though for brevity +these are not mentioned below. + + +CJPEG DETAILS + +The basic command line switches for cjpeg are: + + -quality N Scale quantization tables to adjust image quality. + Quality is 0 (worst) to 100 (best); default is 75. + (See below for more info.) + + -grayscale Create monochrome JPEG file from color input. + Be sure to use this switch when compressing a grayscale + BMP file, because cjpeg isn't bright enough to notice + whether a BMP file uses only shades of gray. By + saying -grayscale, you'll get a smaller JPEG file that + takes less time to process. + + -optimize Perform optimization of entropy encoding parameters. + Without this, default encoding parameters are used. + -optimize usually makes the JPEG file a little smaller, + but cjpeg runs somewhat slower and needs much more + memory. Image quality and speed of decompression are + unaffected by -optimize. + + -progressive Create progressive JPEG file (see below). + + -targa Input file is Targa format. Targa files that contain + an "identification" field will not be automatically + recognized by cjpeg; for such files you must specify + -targa to make cjpeg treat the input as Targa format. + For most Targa files, you won't need this switch. + +The -quality switch lets you trade off compressed file size against quality of +the reconstructed image: the higher the quality setting, the larger the JPEG +file, and the closer the output image will be to the original input. Normally +you want to use the lowest quality setting (smallest file) that decompresses +into something visually indistinguishable from the original image. For this +purpose the quality setting should be between 50 and 95; the default of 75 is +often about right. If you see defects at -quality 75, then go up 5 or 10 +counts at a time until you are happy with the output image. (The optimal +setting will vary from one image to another.) + +-quality 100 will generate a quantization table of all 1's, minimizing loss +in the quantization step (but there is still information loss in subsampling, +as well as roundoff error). This setting is mainly of interest for +experimental purposes. Quality values above about 95 are NOT recommended for +normal use; the compressed file size goes up dramatically for hardly any gain +in output image quality. + +In the other direction, quality values below 50 will produce very small files +of low image quality. Settings around 5 to 10 might be useful in preparing an +index of a large image library, for example. Try -quality 2 (or so) for some +amusing Cubist effects. (Note: quality values below about 25 generate 2-byte +quantization tables, which are considered optional in the JPEG standard. +cjpeg emits a warning message when you give such a quality value, because some +other JPEG programs may be unable to decode the resulting file. Use -baseline +if you need to ensure compatibility at low quality values.) + +The -progressive switch creates a "progressive JPEG" file. In this type of +JPEG file, the data is stored in multiple scans of increasing quality. If the +file is being transmitted over a slow communications link, the decoder can use +the first scan to display a low-quality image very quickly, and can then +improve the display with each subsequent scan. The final image is exactly +equivalent to a standard JPEG file of the same quality setting, and the total +file size is about the same --- often a little smaller. CAUTION: progressive +JPEG is not yet widely implemented, so many decoders will be unable to view a +progressive JPEG file at all. + +Switches for advanced users: + + -dct int Use integer DCT method (default). + -dct fast Use fast integer DCT (less accurate). + -dct float Use floating-point DCT method. + The float method is very slightly more accurate than + the int method, but is much slower unless your machine + has very fast floating-point hardware. Also note that + results of the floating-point method may vary slightly + across machines, while the integer methods should give + the same results everywhere. The fast integer method + is much less accurate than the other two. + + -restart N Emit a JPEG restart marker every N MCU rows, or every + N MCU blocks if "B" is attached to the number. + -restart 0 (the default) means no restart markers. + + -smooth N Smooth the input image to eliminate dithering noise. + N, ranging from 1 to 100, indicates the strength of + smoothing. 0 (the default) means no smoothing. + + -maxmemory N Set limit for amount of memory to use in processing + large images. Value is in thousands of bytes, or + millions of bytes if "M" is attached to the number. + For example, -max 4m selects 4000000 bytes. If more + space is needed, temporary files will be used. + + -verbose Enable debug printout. More -v's give more printout. + or -debug Also, version information is printed at startup. + +The -restart option inserts extra markers that allow a JPEG decoder to +resynchronize after a transmission error. Without restart markers, any damage +to a compressed file will usually ruin the image from the point of the error +to the end of the image; with restart markers, the damage is usually confined +to the portion of the image up to the next restart marker. Of course, the +restart markers occupy extra space. We recommend -restart 1 for images that +will be transmitted across unreliable networks such as Usenet. + +The -smooth option filters the input to eliminate fine-scale noise. This is +often useful when converting dithered images to JPEG: a moderate smoothing +factor of 10 to 50 gets rid of dithering patterns in the input file, resulting +in a smaller JPEG file and a better-looking image. Too large a smoothing +factor will visibly blur the image, however. + +Switches for wizards: + + -baseline Force baseline-compatible quantization tables to be + generated. This clamps quantization values to 8 bits + even at low quality settings. (This switch is poorly + named, since it does not ensure that the output is + actually baseline JPEG. For example, you can use + -baseline and -progressive together.) + + -qtables file Use the quantization tables given in the specified + text file. + + -qslots N[,...] Select which quantization table to use for each color + component. + + -sample HxV[,...] Set JPEG sampling factors for each color component. + + -scans file Use the scan script given in the specified text file. + +The "wizard" switches are intended for experimentation with JPEG. If you +don't know what you are doing, DON'T USE THEM. These switches are documented +further in the file wizard.doc. + + +DJPEG DETAILS + +The basic command line switches for djpeg are: + + -colors N Reduce image to at most N colors. This reduces the + or -quantize N number of colors used in the output image, so that it + can be displayed on a colormapped display or stored in + a colormapped file format. For example, if you have + an 8-bit display, you'd need to reduce to 256 or fewer + colors. (-colors is the recommended name, -quantize + is provided only for backwards compatibility.) + + -fast Select recommended processing options for fast, low + quality output. (The default options are chosen for + highest quality output.) Currently, this is equivalent + to "-dct fast -nosmooth -onepass -dither ordered". + + -grayscale Force gray-scale output even if JPEG file is color. + Useful for viewing on monochrome displays; also, + djpeg runs noticeably faster in this mode. + + -scale M/N Scale the output image by a factor M/N. Currently + the scale factor must be 1/1, 1/2, 1/4, or 1/8. + Scaling is handy if the image is larger than your + screen; also, djpeg runs much faster when scaling + down the output. + + -bmp Select BMP output format (Windows flavor). 8-bit + colormapped format is emitted if -colors or -grayscale + is specified, or if the JPEG file is gray-scale; + otherwise, 24-bit full-color format is emitted. + + -gif Select GIF output format. Since GIF does not support + more than 256 colors, -colors 256 is assumed (unless + you specify a smaller number of colors). If you + specify -fast, the default number of colors is 216. + + -os2 Select BMP output format (OS/2 1.x flavor). 8-bit + colormapped format is emitted if -colors or -grayscale + is specified, or if the JPEG file is gray-scale; + otherwise, 24-bit full-color format is emitted. + + -pnm Select PBMPLUS (PPM/PGM) output format (this is the + default format). PGM is emitted if the JPEG file is + gray-scale or if -grayscale is specified; otherwise + PPM is emitted. + + -rle Select RLE output format. (Requires URT library.) + + -targa Select Targa output format. Gray-scale format is + emitted if the JPEG file is gray-scale or if + -grayscale is specified; otherwise, colormapped format + is emitted if -colors is specified; otherwise, 24-bit + full-color format is emitted. + +Switches for advanced users: + + -dct int Use integer DCT method (default). + -dct fast Use fast integer DCT (less accurate). + -dct float Use floating-point DCT method. + The float method is very slightly more accurate than + the int method, but is much slower unless your machine + has very fast floating-point hardware. Also note that + results of the floating-point method may vary slightly + across machines, while the integer methods should give + the same results everywhere. The fast integer method + is much less accurate than the other two. + + -dither fs Use Floyd-Steinberg dithering in color quantization. + -dither ordered Use ordered dithering in color quantization. + -dither none Do not use dithering in color quantization. + By default, Floyd-Steinberg dithering is applied when + quantizing colors; this is slow but usually produces + the best results. Ordered dither is a compromise + between speed and quality; no dithering is fast but + usually looks awful. Note that these switches have + no effect unless color quantization is being done. + Ordered dither is only available in -onepass mode. + + -map FILE Quantize to the colors used in the specified image + file. This is useful for producing multiple files + with identical color maps, or for forcing a predefined + set of colors to be used. The FILE must be a GIF + or PPM file. This option overrides -colors and + -onepass. + + -nosmooth Use a faster, lower-quality upsampling routine. + + -onepass Use one-pass instead of two-pass color quantization. + The one-pass method is faster and needs less memory, + but it produces a lower-quality image. -onepass is + ignored unless you also say -colors N. Also, + the one-pass method is always used for gray-scale + output (the two-pass method is no improvement then). + + -maxmemory N Set limit for amount of memory to use in processing + large images. Value is in thousands of bytes, or + millions of bytes if "M" is attached to the number. + For example, -max 4m selects 4000000 bytes. If more + space is needed, temporary files will be used. + + -verbose Enable debug printout. More -v's give more printout. + or -debug Also, version information is printed at startup. + + +HINTS FOR CJPEG + +Color GIF files are not the ideal input for JPEG; JPEG is really intended for +compressing full-color (24-bit) images. In particular, don't try to convert +cartoons, line drawings, and other images that have only a few distinct +colors. GIF works great on these, JPEG does not. If you want to convert a +GIF to JPEG, you should experiment with cjpeg's -quality and -smooth options +to get a satisfactory conversion. -smooth 10 or so is often helpful. + +Avoid running an image through a series of JPEG compression/decompression +cycles. Image quality loss will accumulate; after ten or so cycles the image +may be noticeably worse than it was after one cycle. It's best to use a +lossless format while manipulating an image, then convert to JPEG format when +you are ready to file the image away. + +The -optimize option to cjpeg is worth using when you are making a "final" +version for posting or archiving. It's also a win when you are using low +quality settings to make very small JPEG files; the percentage improvement +is often a lot more than it is on larger files. (At present, -optimize +mode is always selected when generating progressive JPEG files.) + +GIF input files are no longer supported, to avoid the Unisys LZW patent. +Use a Unisys-licensed program if you need to read a GIF file. (Conversion +of GIF files to JPEG is usually a bad idea anyway.) + + +HINTS FOR DJPEG + +To get a quick preview of an image, use the -grayscale and/or -scale switches. +"-grayscale -scale 1/8" is the fastest case. + +Several options are available that trade off image quality to gain speed. +"-fast" turns on the recommended settings. + +"-dct fast" and/or "-nosmooth" gain speed at a small sacrifice in quality. +When producing a color-quantized image, "-onepass -dither ordered" is fast but +much lower quality than the default behavior. "-dither none" may give +acceptable results in two-pass mode, but is seldom tolerable in one-pass mode. + +If you are fortunate enough to have very fast floating point hardware, +"-dct float" may be even faster than "-dct fast". But on most machines +"-dct float" is slower than "-dct int"; in this case it is not worth using, +because its theoretical accuracy advantage is too small to be significant +in practice. + +Two-pass color quantization requires a good deal of memory; on MS-DOS machines +it may run out of memory even with -maxmemory 0. In that case you can still +decompress, with some loss of image quality, by specifying -onepass for +one-pass quantization. + +To avoid the Unisys LZW patent, djpeg produces uncompressed GIF files. These +are larger than they should be, but are readable by standard GIF decoders. + + +HINTS FOR BOTH PROGRAMS + +If more space is needed than will fit in the available main memory (as +determined by -maxmemory), temporary files will be used. (MS-DOS versions +will try to get extended or expanded memory first.) The temporary files are +often rather large: in typical cases they occupy three bytes per pixel, for +example 3*800*600 = 1.44Mb for an 800x600 image. If you don't have enough +free disk space, leave out -progressive and -optimize (for cjpeg) or specify +-onepass (for djpeg). + +On MS-DOS, the temporary files are created in the directory named by the TMP +or TEMP environment variable, or in the current directory if neither of those +exist. Amiga implementations put the temp files in the directory named by +JPEGTMP:, so be sure to assign JPEGTMP: to a disk partition with adequate free +space. + +The default memory usage limit (-maxmemory) is set when the software is +compiled. If you get an "insufficient memory" error, try specifying a smaller +-maxmemory value, even -maxmemory 0 to use the absolute minimum space. You +may want to recompile with a smaller default value if this happens often. + +On machines that have "environment" variables, you can define the environment +variable JPEGMEM to set the default memory limit. The value is specified as +described for the -maxmemory switch. JPEGMEM overrides the default value +specified when the program was compiled, and itself is overridden by an +explicit -maxmemory switch. + +On MS-DOS machines, -maxmemory is the amount of main (conventional) memory to +use. (Extended or expanded memory is also used if available.) Most +DOS-specific versions of this software do their own memory space estimation +and do not need you to specify -maxmemory. + + +JPEGTRAN + +jpegtran performs various useful transformations of JPEG files. +It can translate the coded representation from one variant of JPEG to another, +for example from baseline JPEG to progressive JPEG or vice versa. It can also +perform some rearrangements of the image data, for example turning an image +from landscape to portrait format by rotation. + +jpegtran works by rearranging the compressed data (DCT coefficients), without +ever fully decoding the image. Therefore, its transformations are lossless: +there is no image degradation at all, which would not be true if you used +djpeg followed by cjpeg to accomplish the same conversion. But by the same +token, jpegtran cannot perform lossy operations such as changing the image +quality. + +jpegtran uses a command line syntax similar to cjpeg or djpeg. +On Unix-like systems, you say: + jpegtran [switches] [inputfile] >outputfile +On most non-Unix systems, you say: + jpegtran [switches] inputfile outputfile +where both the input and output files are JPEG files. + +To specify the coded JPEG representation used in the output file, +jpegtran accepts a subset of the switches recognized by cjpeg: + -optimize Perform optimization of entropy encoding parameters. + -progressive Create progressive JPEG file. + -restart N Emit a JPEG restart marker every N MCU rows, or every + N MCU blocks if "B" is attached to the number. + -scans file Use the scan script given in the specified text file. +See the previous discussion of cjpeg for more details about these switches. +If you specify none of these switches, you get a plain baseline-JPEG output +file. The quality setting and so forth are determined by the input file. + +The image can be losslessly transformed by giving one of these switches: + -flip horizontal Mirror image horizontally (left-right). + -flip vertical Mirror image vertically (top-bottom). + -rotate 90 Rotate image 90 degrees clockwise. + -rotate 180 Rotate image 180 degrees. + -rotate 270 Rotate image 270 degrees clockwise (or 90 ccw). + -transpose Transpose image (across UL-to-LR axis). + -transverse Transverse transpose (across UR-to-LL axis). + +The transpose transformation has no restrictions regarding image dimensions. +The other transformations operate rather oddly if the image dimensions are not +a multiple of the iMCU size (usually 8 or 16 pixels), because they can only +transform complete blocks of DCT coefficient data in the desired way. + +jpegtran's default behavior when transforming an odd-size image is designed +to preserve exact reversibility and mathematical consistency of the +transformation set. As stated, transpose is able to flip the entire image +area. Horizontal mirroring leaves any partial iMCU column at the right edge +untouched, but is able to flip all rows of the image. Similarly, vertical +mirroring leaves any partial iMCU row at the bottom edge untouched, but is +able to flip all columns. The other transforms can be built up as sequences +of transpose and flip operations; for consistency, their actions on edge +pixels are defined to be the same as the end result of the corresponding +transpose-and-flip sequence. + +For practical use, you may prefer to discard any untransformable edge pixels +rather than having a strange-looking strip along the right and/or bottom edges +of a transformed image. To do this, add the -trim switch: + -trim Drop non-transformable edge blocks. +Obviously, a transformation with -trim is not reversible, so strictly speaking +jpegtran with this switch is not lossless. Also, the expected mathematical +equivalences between the transformations no longer hold. For example, +"-rot 270 -trim" trims only the bottom edge, but "-rot 90 -trim" followed by +"-rot 180 -trim" trims both edges. + +Another not-strictly-lossless transformation switch is: + -grayscale Force grayscale output. +This option discards the chrominance channels if the input image is YCbCr +(ie, a standard color JPEG), resulting in a grayscale JPEG file. The +luminance channel is preserved exactly, so this is a better method of reducing +to grayscale than decompression, conversion, and recompression. This switch +is particularly handy for fixing a monochrome picture that was mistakenly +encoded as a color JPEG. (In such a case, the space savings from getting rid +of the near-empty chroma channels won't be large; but the decoding time for +a grayscale JPEG is substantially less than that for a color JPEG.) + +jpegtran also recognizes these switches that control what to do with "extra" +markers, such as comment blocks: + -copy none Copy no extra markers from source file. This setting + suppresses all comments and other excess baggage + present in the source file. + -copy comments Copy only comment markers. This setting copies + comments from the source file, but discards + any other inessential data. + -copy all Copy all extra markers. This setting preserves + miscellaneous markers found in the source file, such + as JFIF thumbnails and Photoshop settings. In some + files these extra markers can be sizable. +The default behavior is -copy comments. (Note: in IJG releases v6 and v6a, +jpegtran always did the equivalent of -copy none.) + +Additional switches recognized by jpegtran are: + -outfile filename + -maxmemory N + -verbose + -debug +These work the same as in cjpeg or djpeg. + + +THE COMMENT UTILITIES + +The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file. +Although the standard doesn't actually define what COM blocks are for, they +are widely used to hold user-supplied text strings. This lets you add +annotations, titles, index terms, etc to your JPEG files, and later retrieve +them as text. COM blocks do not interfere with the image stored in the JPEG +file. The maximum size of a COM block is 64K, but you can have as many of +them as you like in one JPEG file. + +We provide two utility programs to display COM block contents and add COM +blocks to a JPEG file. + +rdjpgcom searches a JPEG file and prints the contents of any COM blocks on +standard output. The command line syntax is + rdjpgcom [-verbose] [inputfilename] +The switch "-verbose" (or just "-v") causes rdjpgcom to also display the JPEG +image dimensions. If you omit the input file name from the command line, +the JPEG file is read from standard input. (This may not work on some +operating systems, if binary data can't be read from stdin.) + +wrjpgcom adds a COM block, containing text you provide, to a JPEG file. +Ordinarily, the COM block is added after any existing COM blocks, but you +can delete the old COM blocks if you wish. wrjpgcom produces a new JPEG +file; it does not modify the input file. DO NOT try to overwrite the input +file by directing wrjpgcom's output back into it; on most systems this will +just destroy your file. + +The command line syntax for wrjpgcom is similar to cjpeg's. On Unix-like +systems, it is + wrjpgcom [switches] [inputfilename] +The output file is written to standard output. The input file comes from +the named file, or from standard input if no input file is named. + +On most non-Unix systems, the syntax is + wrjpgcom [switches] inputfilename outputfilename +where both input and output file names must be given explicitly. + +wrjpgcom understands three switches: + -replace Delete any existing COM blocks from the file. + -comment "Comment text" Supply new COM text on command line. + -cfile name Read text for new COM block from named file. +(Switch names can be abbreviated.) If you have only one line of comment text +to add, you can provide it on the command line with -comment. The comment +text must be surrounded with quotes so that it is treated as a single +argument. Longer comments can be read from a text file. + +If you give neither -comment nor -cfile, then wrjpgcom will read the comment +text from standard input. (In this case an input image file name MUST be +supplied, so that the source JPEG file comes from somewhere else.) You can +enter multiple lines, up to 64KB worth. Type an end-of-file indicator +(usually control-D or control-Z) to terminate the comment text entry. + +wrjpgcom will not add a COM block if the provided comment string is empty. +Therefore -replace -comment "" can be used to delete all COM blocks from a +file. + +These utility programs do not depend on the IJG JPEG library. In +particular, the source code for rdjpgcom is intended as an illustration of +the minimum amount of code required to parse a JPEG file header correctly. diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/wizard.doc b/packages/services/gfx/mw/current/src/jpeg-6b/wizard.doc new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/wizard.doc @@ -0,0 +1,211 @@ +Advanced usage instructions for the Independent JPEG Group's JPEG software +========================================================================== + +This file describes cjpeg's "switches for wizards". + +The "wizard" switches are intended for experimentation with JPEG by persons +who are reasonably knowledgeable about the JPEG standard. If you don't know +what you are doing, DON'T USE THESE SWITCHES. You'll likely produce files +with worse image quality and/or poorer compression than you'd get from the +default settings. Furthermore, these switches must be used with caution +when making files intended for general use, because not all JPEG decoders +will support unusual JPEG parameter settings. + + +Quantization Table Adjustment +----------------------------- + +Ordinarily, cjpeg starts with a default set of tables (the same ones given +as examples in the JPEG standard) and scales them up or down according to +the -quality setting. The details of the scaling algorithm can be found in +jcparam.c. At very low quality settings, some quantization table entries +can get scaled up to values exceeding 255. Although 2-byte quantization +values are supported by the IJG software, this feature is not in baseline +JPEG and is not supported by all implementations. If you need to ensure +wide compatibility of low-quality files, you can constrain the scaled +quantization values to no more than 255 by giving the -baseline switch. +Note that use of -baseline will result in poorer quality for the same file +size, since more bits than necessary are expended on higher AC coefficients. + +You can substitute a different set of quantization values by using the +-qtables switch: + + -qtables file Use the quantization tables given in the named file. + +The specified file should be a text file containing decimal quantization +values. The file should contain one to four tables, each of 64 elements. +The tables are implicitly numbered 0,1,etc. in order of appearance. Table +entries appear in normal array order (NOT in the zigzag order in which they +will be stored in the JPEG file). + +Quantization table files are free format, in that arbitrary whitespace can +appear between numbers. Also, comments can be included: a comment starts +with '#' and extends to the end of the line. Here is an example file that +duplicates the default quantization tables: + + # Quantization tables given in JPEG spec, section K.1 + + # This is table 0 (the luminance table): + 16 11 10 16 24 40 51 61 + 12 12 14 19 26 58 60 55 + 14 13 16 24 40 57 69 56 + 14 17 22 29 51 87 80 62 + 18 22 37 56 68 109 103 77 + 24 35 55 64 81 104 113 92 + 49 64 78 87 103 121 120 101 + 72 92 95 98 112 100 103 99 + + # This is table 1 (the chrominance table): + 17 18 24 47 99 99 99 99 + 18 21 26 66 99 99 99 99 + 24 26 56 99 99 99 99 99 + 47 66 99 99 99 99 99 99 + 99 99 99 99 99 99 99 99 + 99 99 99 99 99 99 99 99 + 99 99 99 99 99 99 99 99 + 99 99 99 99 99 99 99 99 + +If the -qtables switch is used without -quality, then the specified tables +are used exactly as-is. If both -qtables and -quality are used, then the +tables taken from the file are scaled in the same fashion that the default +tables would be scaled for that quality setting. If -baseline appears, then +the quantization values are constrained to the range 1-255. + +By default, cjpeg will use quantization table 0 for luminance components and +table 1 for chrominance components. To override this choice, use the -qslots +switch: + + -qslots N[,...] Select which quantization table to use for + each color component. + +The -qslots switch specifies a quantization table number for each color +component, in the order in which the components appear in the JPEG SOF marker. +For example, to create a separate table for each of Y,Cb,Cr, you could +provide a -qtables file that defines three quantization tables and say +"-qslots 0,1,2". If -qslots gives fewer table numbers than there are color +components, then the last table number is repeated as necessary. + + +Sampling Factor Adjustment +-------------------------- + +By default, cjpeg uses 2:1 horizontal and vertical downsampling when +compressing YCbCr data, and no downsampling for all other color spaces. +You can override this default with the -sample switch: + + -sample HxV[,...] Set JPEG sampling factors for each color + component. + +The -sample switch specifies the JPEG sampling factors for each color +component, in the order in which they appear in the JPEG SOF marker. +If you specify fewer HxV pairs than there are components, the remaining +components are set to 1x1 sampling. For example, the default YCbCr setting +is equivalent to "-sample 2x2,1x1,1x1", which can be abbreviated to +"-sample 2x2". + +There are still some JPEG decoders in existence that support only 2x1 +sampling (also called 4:2:2 sampling). Compatibility with such decoders can +be achieved by specifying "-sample 2x1". This is not recommended unless +really necessary, since it increases file size and encoding/decoding time +with very little quality gain. + + +Multiple Scan / Progression Control +----------------------------------- + +By default, cjpeg emits a single-scan sequential JPEG file. The +-progressive switch generates a progressive JPEG file using a default series +of progression parameters. You can create multiple-scan sequential JPEG +files or progressive JPEG files with custom progression parameters by using +the -scans switch: + + -scans file Use the scan sequence given in the named file. + +The specified file should be a text file containing a "scan script". +The script specifies the contents and ordering of the scans to be emitted. +Each entry in the script defines one scan. A scan definition specifies +the components to be included in the scan, and for progressive JPEG it also +specifies the progression parameters Ss,Se,Ah,Al for the scan. Scan +definitions are separated by semicolons (';'). A semicolon after the last +scan definition is optional. + +Each scan definition contains one to four component indexes, optionally +followed by a colon (':') and the four progressive-JPEG parameters. The +component indexes denote which color component(s) are to be transmitted in +the scan. Components are numbered in the order in which they appear in the +JPEG SOF marker, with the first component being numbered 0. (Note that these +indexes are not the "component ID" codes assigned to the components, just +positional indexes.) + +The progression parameters for each scan are: + Ss Zigzag index of first coefficient included in scan + Se Zigzag index of last coefficient included in scan + Ah Zero for first scan of a coefficient, else Al of prior scan + Al Successive approximation low bit position for scan +If the progression parameters are omitted, the values 0,63,0,0 are used, +producing a sequential JPEG file. cjpeg automatically determines whether +the script represents a progressive or sequential file, by observing whether +Ss and Se values other than 0 and 63 appear. (The -progressive switch is +not needed to specify this; in fact, it is ignored when -scans appears.) +The scan script must meet the JPEG restrictions on progression sequences. +(cjpeg checks that the spec's requirements are obeyed.) + +Scan script files are free format, in that arbitrary whitespace can appear +between numbers and around punctuation. Also, comments can be included: a +comment starts with '#' and extends to the end of the line. For additional +legibility, commas or dashes can be placed between values. (Actually, any +single punctuation character other than ':' or ';' can be inserted.) For +example, the following two scan definitions are equivalent: + 0 1 2: 0 63 0 0; + 0,1,2 : 0-63, 0,0 ; + +Here is an example of a scan script that generates a partially interleaved +sequential JPEG file: + + 0; # Y only in first scan + 1 2; # Cb and Cr in second scan + +Here is an example of a progressive scan script using only spectral selection +(no successive approximation): + + # Interleaved DC scan for Y,Cb,Cr: + 0,1,2: 0-0, 0, 0 ; + # AC scans: + 0: 1-2, 0, 0 ; # First two Y AC coefficients + 0: 3-5, 0, 0 ; # Three more + 1: 1-63, 0, 0 ; # All AC coefficients for Cb + 2: 1-63, 0, 0 ; # All AC coefficients for Cr + 0: 6-9, 0, 0 ; # More Y coefficients + 0: 10-63, 0, 0 ; # Remaining Y coefficients + +Here is an example of a successive-approximation script. This is equivalent +to the default script used by "cjpeg -progressive" for YCbCr images: + + # Initial DC scan for Y,Cb,Cr (lowest bit not sent) + 0,1,2: 0-0, 0, 1 ; + # First AC scan: send first 5 Y AC coefficients, minus 2 lowest bits: + 0: 1-5, 0, 2 ; + # Send all Cr,Cb AC coefficients, minus lowest bit: + # (chroma data is usually too small to be worth subdividing further; + # but note we send Cr first since eye is least sensitive to Cb) + 2: 1-63, 0, 1 ; + 1: 1-63, 0, 1 ; + # Send remaining Y AC coefficients, minus 2 lowest bits: + 0: 6-63, 0, 2 ; + # Send next-to-lowest bit of all Y AC coefficients: + 0: 1-63, 2, 1 ; + # At this point we've sent all but the lowest bit of all coefficients. + # Send lowest bit of DC coefficients + 0,1,2: 0-0, 1, 0 ; + # Send lowest bit of AC coefficients + 2: 1-63, 1, 0 ; + 1: 1-63, 1, 0 ; + # Y AC lowest bit scan is last; it's usually the largest scan + 0: 1-63, 1, 0 ; + +It may be worth pointing out that this script is tuned for quality settings +of around 50 to 75. For lower quality settings, you'd probably want to use +a script with fewer stages of successive approximation (otherwise the +initial scans will be really bad). For higher quality settings, you might +want to use more stages of successive approximation (so that the initial +scans are not too large). diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/wrbmp.c b/packages/services/gfx/mw/current/src/jpeg-6b/wrbmp.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/wrbmp.c @@ -0,0 +1,442 @@ +/* + * wrbmp.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains routines to write output images in Microsoft "BMP" + * format (MS Windows 3.x and OS/2 1.x flavors). + * Either 8-bit colormapped or 24-bit full-color format can be written. + * No compression is supported. + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume output to + * an ordinary stdio stream. + * + * This code contributed by James Arthur Boucher. + */ + +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ + +#ifdef BMP_SUPPORTED + + +/* + * To support 12-bit JPEG data, we'd have to scale output down to 8 bits. + * This is not yet implemented. + */ + +#if BITS_IN_JSAMPLE != 8 + Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ +#endif + +/* + * Since BMP stores scanlines bottom-to-top, we have to invert the image + * from JPEG's top-to-bottom order. To do this, we save the outgoing data + * in a virtual array during put_pixel_row calls, then actually emit the + * BMP file during finish_output. The virtual array contains one JSAMPLE per + * pixel if the output is grayscale or colormapped, three if it is full color. + */ + +/* Private version of data destination object */ + +typedef struct { + struct djpeg_dest_struct pub; /* public fields */ + + boolean is_os2; /* saves the OS2 format request flag */ + + jvirt_sarray_ptr whole_image; /* needed to reverse row order */ + JDIMENSION data_width; /* JSAMPLEs per row */ + JDIMENSION row_width; /* physical width of one row in the BMP file */ + int pad_bytes; /* number of padding bytes needed per row */ + JDIMENSION cur_output_row; /* next row# to write to virtual array */ +} bmp_dest_struct; + +typedef bmp_dest_struct * bmp_dest_ptr; + + +/* Forward declarations */ +LOCAL(void) write_colormap + JPP((j_decompress_ptr cinfo, bmp_dest_ptr dest, + int map_colors, int map_entry_size)); + + +/* + * Write some pixel data. + * In this module rows_supplied will always be 1. + */ + +METHODDEF(void) +put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied) +/* This version is for writing 24-bit pixels */ +{ + bmp_dest_ptr dest = (bmp_dest_ptr) dinfo; + JSAMPARRAY image_ptr; + register JSAMPROW inptr, outptr; + register JDIMENSION col; + int pad; + + /* Access next row in virtual array */ + image_ptr = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, dest->whole_image, + dest->cur_output_row, (JDIMENSION) 1, TRUE); + dest->cur_output_row++; + + /* Transfer data. Note destination values must be in BGR order + * (even though Microsoft's own documents say the opposite). + */ + inptr = dest->pub.buffer[0]; + outptr = image_ptr[0]; + for (col = cinfo->output_width; col > 0; col--) { + outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ + outptr[1] = *inptr++; + outptr[0] = *inptr++; + outptr += 3; + } + + /* Zero out the pad bytes. */ + pad = dest->pad_bytes; + while (--pad >= 0) + *outptr++ = 0; +} + +METHODDEF(void) +put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied) +/* This version is for grayscale OR quantized color output */ +{ + bmp_dest_ptr dest = (bmp_dest_ptr) dinfo; + JSAMPARRAY image_ptr; + register JSAMPROW inptr, outptr; + register JDIMENSION col; + int pad; + + /* Access next row in virtual array */ + image_ptr = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, dest->whole_image, + dest->cur_output_row, (JDIMENSION) 1, TRUE); + dest->cur_output_row++; + + /* Transfer data. */ + inptr = dest->pub.buffer[0]; + outptr = image_ptr[0]; + for (col = cinfo->output_width; col > 0; col--) { + *outptr++ = *inptr++; /* can omit GETJSAMPLE() safely */ + } + + /* Zero out the pad bytes. */ + pad = dest->pad_bytes; + while (--pad >= 0) + *outptr++ = 0; +} + + +/* + * Startup: normally writes the file header. + * In this module we may as well postpone everything until finish_output. + */ + +METHODDEF(void) +start_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) +{ + /* no work here */ +} + + +/* + * Finish up at the end of the file. + * + * Here is where we really output the BMP file. + * + * First, routines to write the Windows and OS/2 variants of the file header. + */ + +LOCAL(void) +write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) +/* Write a Windows-style BMP file header, including colormap if needed */ +{ + char bmpfileheader[14]; + char bmpinfoheader[40]; +#define PUT_2B(array,offset,value) \ + (array[offset] = (char) ((value) & 0xFF), \ + array[offset+1] = (char) (((value) >> 8) & 0xFF)) +#define PUT_4B(array,offset,value) \ + (array[offset] = (char) ((value) & 0xFF), \ + array[offset+1] = (char) (((value) >> 8) & 0xFF), \ + array[offset+2] = (char) (((value) >> 16) & 0xFF), \ + array[offset+3] = (char) (((value) >> 24) & 0xFF)) + INT32 headersize, bfSize; + int bits_per_pixel, cmap_entries; + + /* Compute colormap size and total file size */ + if (cinfo->out_color_space == JCS_RGB) { + if (cinfo->quantize_colors) { + /* Colormapped RGB */ + bits_per_pixel = 8; + cmap_entries = 256; + } else { + /* Unquantized, full color RGB */ + bits_per_pixel = 24; + cmap_entries = 0; + } + } else { + /* Grayscale output. We need to fake a 256-entry colormap. */ + bits_per_pixel = 8; + cmap_entries = 256; + } + /* File size */ + headersize = 14 + 40 + cmap_entries * 4; /* Header and colormap */ + bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height; + + /* Set unused fields of header to 0 */ + MEMZERO(bmpfileheader, SIZEOF(bmpfileheader)); + MEMZERO(bmpinfoheader, SIZEOF(bmpinfoheader)); + + /* Fill the file header */ + bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */ + bmpfileheader[1] = 0x4D; + PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */ + /* we leave bfReserved1 & bfReserved2 = 0 */ + PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */ + + /* Fill the info header (Microsoft calls this a BITMAPINFOHEADER) */ + PUT_2B(bmpinfoheader, 0, 40); /* biSize */ + PUT_4B(bmpinfoheader, 4, cinfo->output_width); /* biWidth */ + PUT_4B(bmpinfoheader, 8, cinfo->output_height); /* biHeight */ + PUT_2B(bmpinfoheader, 12, 1); /* biPlanes - must be 1 */ + PUT_2B(bmpinfoheader, 14, bits_per_pixel); /* biBitCount */ + /* we leave biCompression = 0, for none */ + /* we leave biSizeImage = 0; this is correct for uncompressed data */ + if (cinfo->density_unit == 2) { /* if have density in dots/cm, then */ + PUT_4B(bmpinfoheader, 24, (INT32) (cinfo->X_density*100)); /* XPels/M */ + PUT_4B(bmpinfoheader, 28, (INT32) (cinfo->Y_density*100)); /* XPels/M */ + } + PUT_2B(bmpinfoheader, 32, cmap_entries); /* biClrUsed */ + /* we leave biClrImportant = 0 */ + + if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14) + ERREXIT(cinfo, JERR_FILE_WRITE); + if (JFWRITE(dest->pub.output_file, bmpinfoheader, 40) != (size_t) 40) + ERREXIT(cinfo, JERR_FILE_WRITE); + + if (cmap_entries > 0) + write_colormap(cinfo, dest, cmap_entries, 4); +} + + +LOCAL(void) +write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) +/* Write an OS2-style BMP file header, including colormap if needed */ +{ + char bmpfileheader[14]; + char bmpcoreheader[12]; + INT32 headersize, bfSize; + int bits_per_pixel, cmap_entries; + + /* Compute colormap size and total file size */ + if (cinfo->out_color_space == JCS_RGB) { + if (cinfo->quantize_colors) { + /* Colormapped RGB */ + bits_per_pixel = 8; + cmap_entries = 256; + } else { + /* Unquantized, full color RGB */ + bits_per_pixel = 24; + cmap_entries = 0; + } + } else { + /* Grayscale output. We need to fake a 256-entry colormap. */ + bits_per_pixel = 8; + cmap_entries = 256; + } + /* File size */ + headersize = 14 + 12 + cmap_entries * 3; /* Header and colormap */ + bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height; + + /* Set unused fields of header to 0 */ + MEMZERO(bmpfileheader, SIZEOF(bmpfileheader)); + MEMZERO(bmpcoreheader, SIZEOF(bmpcoreheader)); + + /* Fill the file header */ + bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */ + bmpfileheader[1] = 0x4D; + PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */ + /* we leave bfReserved1 & bfReserved2 = 0 */ + PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */ + + /* Fill the info header (Microsoft calls this a BITMAPCOREHEADER) */ + PUT_2B(bmpcoreheader, 0, 12); /* bcSize */ + PUT_2B(bmpcoreheader, 4, cinfo->output_width); /* bcWidth */ + PUT_2B(bmpcoreheader, 6, cinfo->output_height); /* bcHeight */ + PUT_2B(bmpcoreheader, 8, 1); /* bcPlanes - must be 1 */ + PUT_2B(bmpcoreheader, 10, bits_per_pixel); /* bcBitCount */ + + if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14) + ERREXIT(cinfo, JERR_FILE_WRITE); + if (JFWRITE(dest->pub.output_file, bmpcoreheader, 12) != (size_t) 12) + ERREXIT(cinfo, JERR_FILE_WRITE); + + if (cmap_entries > 0) + write_colormap(cinfo, dest, cmap_entries, 3); +} + + +/* + * Write the colormap. + * Windows uses BGR0 map entries; OS/2 uses BGR entries. + */ + +LOCAL(void) +write_colormap (j_decompress_ptr cinfo, bmp_dest_ptr dest, + int map_colors, int map_entry_size) +{ + JSAMPARRAY colormap = cinfo->colormap; + int num_colors = cinfo->actual_number_of_colors; + FILE * outfile = dest->pub.output_file; + int i; + + if (colormap != NULL) { + if (cinfo->out_color_components == 3) { + /* Normal case with RGB colormap */ + for (i = 0; i < num_colors; i++) { + putc(GETJSAMPLE(colormap[2][i]), outfile); + putc(GETJSAMPLE(colormap[1][i]), outfile); + putc(GETJSAMPLE(colormap[0][i]), outfile); + if (map_entry_size == 4) + putc(0, outfile); + } + } else { + /* Grayscale colormap (only happens with grayscale quantization) */ + for (i = 0; i < num_colors; i++) { + putc(GETJSAMPLE(colormap[0][i]), outfile); + putc(GETJSAMPLE(colormap[0][i]), outfile); + putc(GETJSAMPLE(colormap[0][i]), outfile); + if (map_entry_size == 4) + putc(0, outfile); + } + } + } else { + /* If no colormap, must be grayscale data. Generate a linear "map". */ + for (i = 0; i < 256; i++) { + putc(i, outfile); + putc(i, outfile); + putc(i, outfile); + if (map_entry_size == 4) + putc(0, outfile); + } + } + /* Pad colormap with zeros to ensure specified number of colormap entries */ + if (i > map_colors) + ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, i); + for (; i < map_colors; i++) { + putc(0, outfile); + putc(0, outfile); + putc(0, outfile); + if (map_entry_size == 4) + putc(0, outfile); + } +} + + +METHODDEF(void) +finish_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) +{ + bmp_dest_ptr dest = (bmp_dest_ptr) dinfo; + register FILE * outfile = dest->pub.output_file; + JSAMPARRAY image_ptr; + register JSAMPROW data_ptr; + JDIMENSION row; + register JDIMENSION col; + cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; + + /* Write the header and colormap */ + if (dest->is_os2) + write_os2_header(cinfo, dest); + else + write_bmp_header(cinfo, dest); + + /* Write the file body from our virtual array */ + for (row = cinfo->output_height; row > 0; row--) { + if (progress != NULL) { + progress->pub.pass_counter = (long) (cinfo->output_height - row); + progress->pub.pass_limit = (long) cinfo->output_height; + (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); + } + image_ptr = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, dest->whole_image, row-1, (JDIMENSION) 1, FALSE); + data_ptr = image_ptr[0]; + for (col = dest->row_width; col > 0; col--) { + putc(GETJSAMPLE(*data_ptr), outfile); + data_ptr++; + } + } + if (progress != NULL) + progress->completed_extra_passes++; + + /* Make sure we wrote the output file OK */ + fflush(outfile); + if (ferror(outfile)) + ERREXIT(cinfo, JERR_FILE_WRITE); +} + + +/* + * The module selection routine for BMP format output. + */ + +GLOBAL(djpeg_dest_ptr) +jinit_write_bmp (j_decompress_ptr cinfo, boolean is_os2) +{ + bmp_dest_ptr dest; + JDIMENSION row_width; + + /* Create module interface object, fill in method pointers */ + dest = (bmp_dest_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(bmp_dest_struct)); + dest->pub.start_output = start_output_bmp; + dest->pub.finish_output = finish_output_bmp; + dest->is_os2 = is_os2; + + if (cinfo->out_color_space == JCS_GRAYSCALE) { + dest->pub.put_pixel_rows = put_gray_rows; + } else if (cinfo->out_color_space == JCS_RGB) { + if (cinfo->quantize_colors) + dest->pub.put_pixel_rows = put_gray_rows; + else + dest->pub.put_pixel_rows = put_pixel_rows; + } else { + ERREXIT(cinfo, JERR_BMP_COLORSPACE); + } + + /* Calculate output image dimensions so we can allocate space */ + jpeg_calc_output_dimensions(cinfo); + + /* Determine width of rows in the BMP file (padded to 4-byte boundary). */ + row_width = cinfo->output_width * cinfo->output_components; + dest->data_width = row_width; + while ((row_width & 3) != 0) row_width++; + dest->row_width = row_width; + dest->pad_bytes = (int) (row_width - dest->data_width); + + /* Allocate space for inversion array, prepare for write pass */ + dest->whole_image = (*cinfo->mem->request_virt_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, + row_width, cinfo->output_height, (JDIMENSION) 1); + dest->cur_output_row = 0; + if (cinfo->progress != NULL) { + cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; + progress->total_extra_passes++; /* count file input as separate pass */ + } + + /* Create decompressor output buffer. */ + dest->pub.buffer = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, row_width, (JDIMENSION) 1); + dest->pub.buffer_height = 1; + + return (djpeg_dest_ptr) dest; +} + +#endif /* BMP_SUPPORTED */ diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/wrgif.c b/packages/services/gfx/mw/current/src/jpeg-6b/wrgif.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/wrgif.c @@ -0,0 +1,399 @@ +/* + * wrgif.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains routines to write output images in GIF format. + * + ************************************************************************** + * NOTE: to avoid entanglements with Unisys' patent on LZW compression, * + * this code has been modified to output "uncompressed GIF" files. * + * There is no trace of the LZW algorithm in this file. * + ************************************************************************** + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume output to + * an ordinary stdio stream. + */ + +/* + * This code is loosely based on ppmtogif from the PBMPLUS distribution + * of Feb. 1991. That file contains the following copyright notice: + * Based on GIFENCODE by David Rowley . + * Lempel-Ziv compression based on "compress" by Spencer W. Thomas et al. + * Copyright (C) 1989 by Jef Poskanzer. + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. This software is provided "as is" without express or + * implied warranty. + * + * We are also required to state that + * "The Graphics Interchange Format(c) is the Copyright property of + * CompuServe Incorporated. GIF(sm) is a Service Mark property of + * CompuServe Incorporated." + */ + +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ + +#ifdef GIF_SUPPORTED + + +/* Private version of data destination object */ + +typedef struct { + struct djpeg_dest_struct pub; /* public fields */ + + j_decompress_ptr cinfo; /* back link saves passing separate parm */ + + /* State for packing variable-width codes into a bitstream */ + int n_bits; /* current number of bits/code */ + int maxcode; /* maximum code, given n_bits */ + INT32 cur_accum; /* holds bits not yet output */ + int cur_bits; /* # of bits in cur_accum */ + + /* State for GIF code assignment */ + int ClearCode; /* clear code (doesn't change) */ + int EOFCode; /* EOF code (ditto) */ + int code_counter; /* counts output symbols */ + + /* GIF data packet construction buffer */ + int bytesinpkt; /* # of bytes in current packet */ + char packetbuf[256]; /* workspace for accumulating packet */ + +} gif_dest_struct; + +typedef gif_dest_struct * gif_dest_ptr; + +/* Largest value that will fit in N bits */ +#define MAXCODE(n_bits) ((1 << (n_bits)) - 1) + + +/* + * Routines to package finished data bytes into GIF data blocks. + * A data block consists of a count byte (1..255) and that many data bytes. + */ + +LOCAL(void) +flush_packet (gif_dest_ptr dinfo) +/* flush any accumulated data */ +{ + if (dinfo->bytesinpkt > 0) { /* never write zero-length packet */ + dinfo->packetbuf[0] = (char) dinfo->bytesinpkt++; + if (JFWRITE(dinfo->pub.output_file, dinfo->packetbuf, dinfo->bytesinpkt) + != (size_t) dinfo->bytesinpkt) + ERREXIT(dinfo->cinfo, JERR_FILE_WRITE); + dinfo->bytesinpkt = 0; + } +} + + +/* Add a character to current packet; flush to disk if necessary */ +#define CHAR_OUT(dinfo,c) \ + { (dinfo)->packetbuf[++(dinfo)->bytesinpkt] = (char) (c); \ + if ((dinfo)->bytesinpkt >= 255) \ + flush_packet(dinfo); \ + } + + +/* Routine to convert variable-width codes into a byte stream */ + +LOCAL(void) +output (gif_dest_ptr dinfo, int code) +/* Emit a code of n_bits bits */ +/* Uses cur_accum and cur_bits to reblock into 8-bit bytes */ +{ + dinfo->cur_accum |= ((INT32) code) << dinfo->cur_bits; + dinfo->cur_bits += dinfo->n_bits; + + while (dinfo->cur_bits >= 8) { + CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF); + dinfo->cur_accum >>= 8; + dinfo->cur_bits -= 8; + } +} + + +/* The pseudo-compression algorithm. + * + * In this module we simply output each pixel value as a separate symbol; + * thus, no compression occurs. In fact, there is expansion of one bit per + * pixel, because we use a symbol width one bit wider than the pixel width. + * + * GIF ordinarily uses variable-width symbols, and the decoder will expect + * to ratchet up the symbol width after a fixed number of symbols. + * To simplify the logic and keep the expansion penalty down, we emit a + * GIF Clear code to reset the decoder just before the width would ratchet up. + * Thus, all the symbols in the output file will have the same bit width. + * Note that emitting the Clear codes at the right times is a mere matter of + * counting output symbols and is in no way dependent on the LZW patent. + * + * With a small basic pixel width (low color count), Clear codes will be + * needed very frequently, causing the file to expand even more. So this + * simplistic approach wouldn't work too well on bilevel images, for example. + * But for output of JPEG conversions the pixel width will usually be 8 bits + * (129 to 256 colors), so the overhead added by Clear symbols is only about + * one symbol in every 256. + */ + +LOCAL(void) +compress_init (gif_dest_ptr dinfo, int i_bits) +/* Initialize pseudo-compressor */ +{ + /* init all the state variables */ + dinfo->n_bits = i_bits; + dinfo->maxcode = MAXCODE(dinfo->n_bits); + dinfo->ClearCode = (1 << (i_bits - 1)); + dinfo->EOFCode = dinfo->ClearCode + 1; + dinfo->code_counter = dinfo->ClearCode + 2; + /* init output buffering vars */ + dinfo->bytesinpkt = 0; + dinfo->cur_accum = 0; + dinfo->cur_bits = 0; + /* GIF specifies an initial Clear code */ + output(dinfo, dinfo->ClearCode); +} + + +LOCAL(void) +compress_pixel (gif_dest_ptr dinfo, int c) +/* Accept and "compress" one pixel value. + * The given value must be less than n_bits wide. + */ +{ + /* Output the given pixel value as a symbol. */ + output(dinfo, c); + /* Issue Clear codes often enough to keep the reader from ratcheting up + * its symbol size. + */ + if (dinfo->code_counter < dinfo->maxcode) { + dinfo->code_counter++; + } else { + output(dinfo, dinfo->ClearCode); + dinfo->code_counter = dinfo->ClearCode + 2; /* reset the counter */ + } +} + + +LOCAL(void) +compress_term (gif_dest_ptr dinfo) +/* Clean up at end */ +{ + /* Send an EOF code */ + output(dinfo, dinfo->EOFCode); + /* Flush the bit-packing buffer */ + if (dinfo->cur_bits > 0) { + CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF); + } + /* Flush the packet buffer */ + flush_packet(dinfo); +} + + +/* GIF header construction */ + + +LOCAL(void) +put_word (gif_dest_ptr dinfo, unsigned int w) +/* Emit a 16-bit word, LSB first */ +{ + putc(w & 0xFF, dinfo->pub.output_file); + putc((w >> 8) & 0xFF, dinfo->pub.output_file); +} + + +LOCAL(void) +put_3bytes (gif_dest_ptr dinfo, int val) +/* Emit 3 copies of same byte value --- handy subr for colormap construction */ +{ + putc(val, dinfo->pub.output_file); + putc(val, dinfo->pub.output_file); + putc(val, dinfo->pub.output_file); +} + + +LOCAL(void) +emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap) +/* Output the GIF file header, including color map */ +/* If colormap==NULL, synthesize a gray-scale colormap */ +{ + int BitsPerPixel, ColorMapSize, InitCodeSize, FlagByte; + int cshift = dinfo->cinfo->data_precision - 8; + int i; + + if (num_colors > 256) + ERREXIT1(dinfo->cinfo, JERR_TOO_MANY_COLORS, num_colors); + /* Compute bits/pixel and related values */ + BitsPerPixel = 1; + while (num_colors > (1 << BitsPerPixel)) + BitsPerPixel++; + ColorMapSize = 1 << BitsPerPixel; + if (BitsPerPixel <= 1) + InitCodeSize = 2; + else + InitCodeSize = BitsPerPixel; + /* + * Write the GIF header. + * Note that we generate a plain GIF87 header for maximum compatibility. + */ + putc('G', dinfo->pub.output_file); + putc('I', dinfo->pub.output_file); + putc('F', dinfo->pub.output_file); + putc('8', dinfo->pub.output_file); + putc('7', dinfo->pub.output_file); + putc('a', dinfo->pub.output_file); + /* Write the Logical Screen Descriptor */ + put_word(dinfo, (unsigned int) dinfo->cinfo->output_width); + put_word(dinfo, (unsigned int) dinfo->cinfo->output_height); + FlagByte = 0x80; /* Yes, there is a global color table */ + FlagByte |= (BitsPerPixel-1) << 4; /* color resolution */ + FlagByte |= (BitsPerPixel-1); /* size of global color table */ + putc(FlagByte, dinfo->pub.output_file); + putc(0, dinfo->pub.output_file); /* Background color index */ + putc(0, dinfo->pub.output_file); /* Reserved (aspect ratio in GIF89) */ + /* Write the Global Color Map */ + /* If the color map is more than 8 bits precision, */ + /* we reduce it to 8 bits by shifting */ + for (i=0; i < ColorMapSize; i++) { + if (i < num_colors) { + if (colormap != NULL) { + if (dinfo->cinfo->out_color_space == JCS_RGB) { + /* Normal case: RGB color map */ + putc(GETJSAMPLE(colormap[0][i]) >> cshift, dinfo->pub.output_file); + putc(GETJSAMPLE(colormap[1][i]) >> cshift, dinfo->pub.output_file); + putc(GETJSAMPLE(colormap[2][i]) >> cshift, dinfo->pub.output_file); + } else { + /* Grayscale "color map": possible if quantizing grayscale image */ + put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift); + } + } else { + /* Create a gray-scale map of num_colors values, range 0..255 */ + put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1)); + } + } else { + /* fill out the map to a power of 2 */ + put_3bytes(dinfo, 0); + } + } + /* Write image separator and Image Descriptor */ + putc(',', dinfo->pub.output_file); /* separator */ + put_word(dinfo, 0); /* left/top offset */ + put_word(dinfo, 0); + put_word(dinfo, (unsigned int) dinfo->cinfo->output_width); /* image size */ + put_word(dinfo, (unsigned int) dinfo->cinfo->output_height); + /* flag byte: not interlaced, no local color map */ + putc(0x00, dinfo->pub.output_file); + /* Write Initial Code Size byte */ + putc(InitCodeSize, dinfo->pub.output_file); + + /* Initialize for "compression" of image data */ + compress_init(dinfo, InitCodeSize+1); +} + + +/* + * Startup: write the file header. + */ + +METHODDEF(void) +start_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) +{ + gif_dest_ptr dest = (gif_dest_ptr) dinfo; + + if (cinfo->quantize_colors) + emit_header(dest, cinfo->actual_number_of_colors, cinfo->colormap); + else + emit_header(dest, 256, (JSAMPARRAY) NULL); +} + + +/* + * Write some pixel data. + * In this module rows_supplied will always be 1. + */ + +METHODDEF(void) +put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied) +{ + gif_dest_ptr dest = (gif_dest_ptr) dinfo; + register JSAMPROW ptr; + register JDIMENSION col; + + ptr = dest->pub.buffer[0]; + for (col = cinfo->output_width; col > 0; col--) { + compress_pixel(dest, GETJSAMPLE(*ptr++)); + } +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF(void) +finish_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) +{ + gif_dest_ptr dest = (gif_dest_ptr) dinfo; + + /* Flush "compression" mechanism */ + compress_term(dest); + /* Write a zero-length data block to end the series */ + putc(0, dest->pub.output_file); + /* Write the GIF terminator mark */ + putc(';', dest->pub.output_file); + /* Make sure we wrote the output file OK */ + fflush(dest->pub.output_file); + if (ferror(dest->pub.output_file)) + ERREXIT(cinfo, JERR_FILE_WRITE); +} + + +/* + * The module selection routine for GIF format output. + */ + +GLOBAL(djpeg_dest_ptr) +jinit_write_gif (j_decompress_ptr cinfo) +{ + gif_dest_ptr dest; + + /* Create module interface object, fill in method pointers */ + dest = (gif_dest_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(gif_dest_struct)); + dest->cinfo = cinfo; /* make back link for subroutines */ + dest->pub.start_output = start_output_gif; + dest->pub.put_pixel_rows = put_pixel_rows; + dest->pub.finish_output = finish_output_gif; + + if (cinfo->out_color_space != JCS_GRAYSCALE && + cinfo->out_color_space != JCS_RGB) + ERREXIT(cinfo, JERR_GIF_COLORSPACE); + + /* Force quantization if color or if > 8 bits input */ + if (cinfo->out_color_space != JCS_GRAYSCALE || cinfo->data_precision > 8) { + /* Force quantization to at most 256 colors */ + cinfo->quantize_colors = TRUE; + if (cinfo->desired_number_of_colors > 256) + cinfo->desired_number_of_colors = 256; + } + + /* Calculate output image dimensions so we can allocate space */ + jpeg_calc_output_dimensions(cinfo); + + if (cinfo->output_components != 1) /* safety check: just one component? */ + ERREXIT(cinfo, JERR_GIF_BUG); + + /* Create decompressor output buffer. */ + dest->pub.buffer = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->output_width, (JDIMENSION) 1); + dest->pub.buffer_height = 1; + + return (djpeg_dest_ptr) dest; +} + +#endif /* GIF_SUPPORTED */ diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/wrjpgcom.1 b/packages/services/gfx/mw/current/src/jpeg-6b/wrjpgcom.1 new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/wrjpgcom.1 @@ -0,0 +1,103 @@ +.TH WRJPGCOM 1 "15 June 1995" +.SH NAME +wrjpgcom \- insert text comments into a JPEG file +.SH SYNOPSIS +.B wrjpgcom +[ +.B \-replace +] +[ +.BI \-comment " text" +] +[ +.BI \-cfile " name" +] +[ +.I filename +] +.LP +.SH DESCRIPTION +.LP +.B wrjpgcom +reads the named JPEG/JFIF file, or the standard input if no file is named, +and generates a new JPEG/JFIF file on standard output. A comment block is +added to the file. +.PP +The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file. +Although the standard doesn't actually define what COM blocks are for, they +are widely used to hold user-supplied text strings. This lets you add +annotations, titles, index terms, etc to your JPEG files, and later retrieve +them as text. COM blocks do not interfere with the image stored in the JPEG +file. The maximum size of a COM block is 64K, but you can have as many of +them as you like in one JPEG file. +.PP +.B wrjpgcom +adds a COM block, containing text you provide, to a JPEG file. +Ordinarily, the COM block is added after any existing COM blocks; but you +can delete the old COM blocks if you wish. +.SH OPTIONS +Switch names may be abbreviated, and are not case sensitive. +.TP +.B \-replace +Delete any existing COM blocks from the file. +.TP +.BI \-comment " text" +Supply text for new COM block on command line. +.TP +.BI \-cfile " name" +Read text for new COM block from named file. +.PP +If you have only one line of comment text to add, you can provide it on the +command line with +.BR \-comment . +The comment text must be surrounded with quotes so that it is treated as a +single argument. Longer comments can be read from a text file. +.PP +If you give neither +.B \-comment +nor +.BR \-cfile , +then +.B wrjpgcom +will read the comment text from standard input. (In this case an input image +file name MUST be supplied, so that the source JPEG file comes from somewhere +else.) You can enter multiple lines, up to 64KB worth. Type an end-of-file +indicator (usually control-D) to terminate the comment text entry. +.PP +.B wrjpgcom +will not add a COM block if the provided comment string is empty. Therefore +\fB\-replace \-comment ""\fR can be used to delete all COM blocks from a file. +.SH EXAMPLES +.LP +Add a short comment to in.jpg, producing out.jpg: +.IP +.B wrjpgcom \-c +\fI"View of my back yard" in.jpg +.B > +.I out.jpg +.PP +Attach a long comment previously stored in comment.txt: +.IP +.B wrjpgcom +.I in.jpg +.B < +.I comment.txt +.B > +.I out.jpg +.PP +or equivalently +.IP +.B wrjpgcom +.B -cfile +.I comment.txt +.B < +.I in.jpg +.B > +.I out.jpg +.SH SEE ALSO +.BR cjpeg (1), +.BR djpeg (1), +.BR jpegtran (1), +.BR rdjpgcom (1) +.SH AUTHOR +Independent JPEG Group diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/wrjpgcom.c b/packages/services/gfx/mw/current/src/jpeg-6b/wrjpgcom.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/wrjpgcom.c @@ -0,0 +1,583 @@ +/* + * wrjpgcom.c + * + * Copyright (C) 1994-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains a very simple stand-alone application that inserts + * user-supplied text as a COM (comment) marker in a JFIF file. + * This may be useful as an example of the minimum logic needed to parse + * JPEG markers. + */ + +#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */ +#include "jinclude.h" /* get auto-config symbols, */ + +#ifndef HAVE_STDLIB_H /* should declare malloc() */ +extern void * malloc (); +#endif +#include /* to declare isupper(), tolower() */ +#ifdef USE_SETMODE +#include /* to declare setmode()'s parameter macros */ +/* If you have setmode() but not , just delete this line: */ +#include /* to declare setmode() */ +#endif + +#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ +#ifdef __MWERKS__ +#include /* Metrowerks needs this */ +#include /* ... and this */ +#endif +#ifdef THINK_C +#include /* Think declares it here */ +#endif +#endif + +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" +#define WRITE_BINARY "w" +#else +#ifdef VMS /* VMS is very nonstandard */ +#define READ_BINARY "rb", "ctx=stm" +#define WRITE_BINARY "wb", "ctx=stm" +#else /* standard ANSI-compliant case */ +#define READ_BINARY "rb" +#define WRITE_BINARY "wb" +#endif +#endif + +#ifndef EXIT_FAILURE /* define exit() codes if not provided */ +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#ifdef VMS +#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ +#else +#define EXIT_SUCCESS 0 +#endif +#endif + +/* Reduce this value if your malloc() can't allocate blocks up to 64K. + * On DOS, compiling in large model is usually a better solution. + */ + +#ifndef MAX_COM_LENGTH +#define MAX_COM_LENGTH 65000L /* must be <= 65533 in any case */ +#endif + + +/* + * These macros are used to read the input file and write the output file. + * To reuse this code in another application, you might need to change these. + */ + +static FILE * infile; /* input JPEG file */ + +/* Return next input byte, or EOF if no more */ +#define NEXTBYTE() getc(infile) + +static FILE * outfile; /* output JPEG file */ + +/* Emit an output byte */ +#define PUTBYTE(x) putc((x), outfile) + + +/* Error exit handler */ +#define ERREXIT(msg) (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE)) + + +/* Read one byte, testing for EOF */ +static int +read_1_byte (void) +{ + int c; + + c = NEXTBYTE(); + if (c == EOF) + ERREXIT("Premature EOF in JPEG file"); + return c; +} + +/* Read 2 bytes, convert to unsigned int */ +/* All 2-byte quantities in JPEG markers are MSB first */ +static unsigned int +read_2_bytes (void) +{ + int c1, c2; + + c1 = NEXTBYTE(); + if (c1 == EOF) + ERREXIT("Premature EOF in JPEG file"); + c2 = NEXTBYTE(); + if (c2 == EOF) + ERREXIT("Premature EOF in JPEG file"); + return (((unsigned int) c1) << 8) + ((unsigned int) c2); +} + + +/* Routines to write data to output file */ + +static void +write_1_byte (int c) +{ + PUTBYTE(c); +} + +static void +write_2_bytes (unsigned int val) +{ + PUTBYTE((val >> 8) & 0xFF); + PUTBYTE(val & 0xFF); +} + +static void +write_marker (int marker) +{ + PUTBYTE(0xFF); + PUTBYTE(marker); +} + +static void +copy_rest_of_file (void) +{ + int c; + + while ((c = NEXTBYTE()) != EOF) + PUTBYTE(c); +} + + +/* + * JPEG markers consist of one or more 0xFF bytes, followed by a marker + * code byte (which is not an FF). Here are the marker codes of interest + * in this program. (See jdmarker.c for a more complete list.) + */ + +#define M_SOF0 0xC0 /* Start Of Frame N */ +#define M_SOF1 0xC1 /* N indicates which compression process */ +#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ +#define M_SOF3 0xC3 +#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ +#define M_SOF6 0xC6 +#define M_SOF7 0xC7 +#define M_SOF9 0xC9 +#define M_SOF10 0xCA +#define M_SOF11 0xCB +#define M_SOF13 0xCD +#define M_SOF14 0xCE +#define M_SOF15 0xCF +#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ +#define M_EOI 0xD9 /* End Of Image (end of datastream) */ +#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ +#define M_COM 0xFE /* COMment */ + + +/* + * Find the next JPEG marker and return its marker code. + * We expect at least one FF byte, possibly more if the compressor used FFs + * to pad the file. (Padding FFs will NOT be replicated in the output file.) + * There could also be non-FF garbage between markers. The treatment of such + * garbage is unspecified; we choose to skip over it but emit a warning msg. + * NB: this routine must not be used after seeing SOS marker, since it will + * not deal correctly with FF/00 sequences in the compressed image data... + */ + +static int +next_marker (void) +{ + int c; + int discarded_bytes = 0; + + /* Find 0xFF byte; count and skip any non-FFs. */ + c = read_1_byte(); + while (c != 0xFF) { + discarded_bytes++; + c = read_1_byte(); + } + /* Get marker code byte, swallowing any duplicate FF bytes. Extra FFs + * are legal as pad bytes, so don't count them in discarded_bytes. + */ + do { + c = read_1_byte(); + } while (c == 0xFF); + + if (discarded_bytes != 0) { + fprintf(stderr, "Warning: garbage data found in JPEG file\n"); + } + + return c; +} + + +/* + * Read the initial marker, which should be SOI. + * For a JFIF file, the first two bytes of the file should be literally + * 0xFF M_SOI. To be more general, we could use next_marker, but if the + * input file weren't actually JPEG at all, next_marker might read the whole + * file and then return a misleading error message... + */ + +static int +first_marker (void) +{ + int c1, c2; + + c1 = NEXTBYTE(); + c2 = NEXTBYTE(); + if (c1 != 0xFF || c2 != M_SOI) + ERREXIT("Not a JPEG file"); + return c2; +} + + +/* + * Most types of marker are followed by a variable-length parameter segment. + * This routine skips over the parameters for any marker we don't otherwise + * want to process. + * Note that we MUST skip the parameter segment explicitly in order not to + * be fooled by 0xFF bytes that might appear within the parameter segment; + * such bytes do NOT introduce new markers. + */ + +static void +copy_variable (void) +/* Copy an unknown or uninteresting variable-length marker */ +{ + unsigned int length; + + /* Get the marker parameter length count */ + length = read_2_bytes(); + write_2_bytes(length); + /* Length includes itself, so must be at least 2 */ + if (length < 2) + ERREXIT("Erroneous JPEG marker length"); + length -= 2; + /* Skip over the remaining bytes */ + while (length > 0) { + write_1_byte(read_1_byte()); + length--; + } +} + +static void +skip_variable (void) +/* Skip over an unknown or uninteresting variable-length marker */ +{ + unsigned int length; + + /* Get the marker parameter length count */ + length = read_2_bytes(); + /* Length includes itself, so must be at least 2 */ + if (length < 2) + ERREXIT("Erroneous JPEG marker length"); + length -= 2; + /* Skip over the remaining bytes */ + while (length > 0) { + (void) read_1_byte(); + length--; + } +} + + +/* + * Parse the marker stream until SOFn or EOI is seen; + * copy data to output, but discard COM markers unless keep_COM is true. + */ + +static int +scan_JPEG_header (int keep_COM) +{ + int marker; + + /* Expect SOI at start of file */ + if (first_marker() != M_SOI) + ERREXIT("Expected SOI marker first"); + write_marker(M_SOI); + + /* Scan miscellaneous markers until we reach SOFn. */ + for (;;) { + marker = next_marker(); + switch (marker) { + /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be, + * treated as SOFn. C4 in particular is actually DHT. + */ + case M_SOF0: /* Baseline */ + case M_SOF1: /* Extended sequential, Huffman */ + case M_SOF2: /* Progressive, Huffman */ + case M_SOF3: /* Lossless, Huffman */ + case M_SOF5: /* Differential sequential, Huffman */ + case M_SOF6: /* Differential progressive, Huffman */ + case M_SOF7: /* Differential lossless, Huffman */ + case M_SOF9: /* Extended sequential, arithmetic */ + case M_SOF10: /* Progressive, arithmetic */ + case M_SOF11: /* Lossless, arithmetic */ + case M_SOF13: /* Differential sequential, arithmetic */ + case M_SOF14: /* Differential progressive, arithmetic */ + case M_SOF15: /* Differential lossless, arithmetic */ + return marker; + + case M_SOS: /* should not see compressed data before SOF */ + ERREXIT("SOS without prior SOFn"); + break; + + case M_EOI: /* in case it's a tables-only JPEG stream */ + return marker; + + case M_COM: /* Existing COM: conditionally discard */ + if (keep_COM) { + write_marker(marker); + copy_variable(); + } else { + skip_variable(); + } + break; + + default: /* Anything else just gets copied */ + write_marker(marker); + copy_variable(); /* we assume it has a parameter count... */ + break; + } + } /* end loop */ +} + + +/* Command line parsing code */ + +static const char * progname; /* program name for error messages */ + + +static void +usage (void) +/* complain about bad command line */ +{ + fprintf(stderr, "wrjpgcom inserts a textual comment in a JPEG file.\n"); + fprintf(stderr, "You can add to or replace any existing comment(s).\n"); + + fprintf(stderr, "Usage: %s [switches] ", progname); +#ifdef TWO_FILE_COMMANDLINE + fprintf(stderr, "inputfile outputfile\n"); +#else + fprintf(stderr, "[inputfile]\n"); +#endif + + fprintf(stderr, "Switches (names may be abbreviated):\n"); + fprintf(stderr, " -replace Delete any existing comments\n"); + fprintf(stderr, " -comment \"text\" Insert comment with given text\n"); + fprintf(stderr, " -cfile name Read comment from named file\n"); + fprintf(stderr, "Notice that you must put quotes around the comment text\n"); + fprintf(stderr, "when you use -comment.\n"); + fprintf(stderr, "If you do not give either -comment or -cfile on the command line,\n"); + fprintf(stderr, "then the comment text is read from standard input.\n"); + fprintf(stderr, "It can be multiple lines, up to %u characters total.\n", + (unsigned int) MAX_COM_LENGTH); +#ifndef TWO_FILE_COMMANDLINE + fprintf(stderr, "You must specify an input JPEG file name when supplying\n"); + fprintf(stderr, "comment text from standard input.\n"); +#endif + + exit(EXIT_FAILURE); +} + + +static int +keymatch (char * arg, const char * keyword, int minchars) +/* Case-insensitive matching of (possibly abbreviated) keyword switches. */ +/* keyword is the constant keyword (must be lower case already), */ +/* minchars is length of minimum legal abbreviation. */ +{ + register int ca, ck; + register int nmatched = 0; + + while ((ca = *arg++) != '\0') { + if ((ck = *keyword++) == '\0') + return 0; /* arg longer than keyword, no good */ + if (isupper(ca)) /* force arg to lcase (assume ck is already) */ + ca = tolower(ca); + if (ca != ck) + return 0; /* no good */ + nmatched++; /* count matched characters */ + } + /* reached end of argument; fail if it's too short for unique abbrev */ + if (nmatched < minchars) + return 0; + return 1; /* A-OK */ +} + + +/* + * The main program. + */ + +int +main (int argc, char **argv) +{ + int argn; + char * arg; + int keep_COM = 1; + char * comment_arg = NULL; + FILE * comment_file = NULL; + unsigned int comment_length = 0; + int marker; + + /* On Mac, fetch a command line. */ +#ifdef USE_CCOMMAND + argc = ccommand(&argv); +#endif + + progname = argv[0]; + if (progname == NULL || progname[0] == 0) + progname = "wrjpgcom"; /* in case C library doesn't provide it */ + + /* Parse switches, if any */ + for (argn = 1; argn < argc; argn++) { + arg = argv[argn]; + if (arg[0] != '-') + break; /* not switch, must be file name */ + arg++; /* advance over '-' */ + if (keymatch(arg, "replace", 1)) { + keep_COM = 0; + } else if (keymatch(arg, "cfile", 2)) { + if (++argn >= argc) usage(); + if ((comment_file = fopen(argv[argn], "r")) == NULL) { + fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); + exit(EXIT_FAILURE); + } + } else if (keymatch(arg, "comment", 1)) { + if (++argn >= argc) usage(); + comment_arg = argv[argn]; + /* If the comment text starts with '"', then we are probably running + * under MS-DOG and must parse out the quoted string ourselves. Sigh. + */ + if (comment_arg[0] == '"') { + comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH); + if (comment_arg == NULL) + ERREXIT("Insufficient memory"); + strcpy(comment_arg, argv[argn]+1); + for (;;) { + comment_length = (unsigned int) strlen(comment_arg); + if (comment_length > 0 && comment_arg[comment_length-1] == '"') { + comment_arg[comment_length-1] = '\0'; /* zap terminating quote */ + break; + } + if (++argn >= argc) + ERREXIT("Missing ending quote mark"); + strcat(comment_arg, " "); + strcat(comment_arg, argv[argn]); + } + } + comment_length = (unsigned int) strlen(comment_arg); + } else + usage(); + } + + /* Cannot use both -comment and -cfile. */ + if (comment_arg != NULL && comment_file != NULL) + usage(); + /* If there is neither -comment nor -cfile, we will read the comment text + * from stdin; in this case there MUST be an input JPEG file name. + */ + if (comment_arg == NULL && comment_file == NULL && argn >= argc) + usage(); + + /* Open the input file. */ + if (argn < argc) { + if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); + exit(EXIT_FAILURE); + } + } else { + /* default input file is stdin */ +#ifdef USE_SETMODE /* need to hack file mode? */ + setmode(fileno(stdin), O_BINARY); +#endif +#ifdef USE_FDOPEN /* need to re-open in binary mode? */ + if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open stdin\n", progname); + exit(EXIT_FAILURE); + } +#else + infile = stdin; +#endif + } + + /* Open the output file. */ +#ifdef TWO_FILE_COMMANDLINE + /* Must have explicit output file name */ + if (argn != argc-2) { + fprintf(stderr, "%s: must name one input and one output file\n", + progname); + usage(); + } + if ((outfile = fopen(argv[argn+1], WRITE_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", progname, argv[argn+1]); + exit(EXIT_FAILURE); + } +#else + /* Unix style: expect zero or one file name */ + if (argn < argc-1) { + fprintf(stderr, "%s: only one input file\n", progname); + usage(); + } + /* default output file is stdout */ +#ifdef USE_SETMODE /* need to hack file mode? */ + setmode(fileno(stdout), O_BINARY); +#endif +#ifdef USE_FDOPEN /* need to re-open in binary mode? */ + if ((outfile = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open stdout\n", progname); + exit(EXIT_FAILURE); + } +#else + outfile = stdout; +#endif +#endif /* TWO_FILE_COMMANDLINE */ + + /* Collect comment text from comment_file or stdin, if necessary */ + if (comment_arg == NULL) { + FILE * src_file; + int c; + + comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH); + if (comment_arg == NULL) + ERREXIT("Insufficient memory"); + comment_length = 0; + src_file = (comment_file != NULL ? comment_file : stdin); + while ((c = getc(src_file)) != EOF) { + if (comment_length >= (unsigned int) MAX_COM_LENGTH) { + fprintf(stderr, "Comment text may not exceed %u bytes\n", + (unsigned int) MAX_COM_LENGTH); + exit(EXIT_FAILURE); + } + comment_arg[comment_length++] = (char) c; + } + if (comment_file != NULL) + fclose(comment_file); + } + + /* Copy JPEG headers until SOFn marker; + * we will insert the new comment marker just before SOFn. + * This (a) causes the new comment to appear after, rather than before, + * existing comments; and (b) ensures that comments come after any JFIF + * or JFXX markers, as required by the JFIF specification. + */ + marker = scan_JPEG_header(keep_COM); + /* Insert the new COM marker, but only if nonempty text has been supplied */ + if (comment_length > 0) { + write_marker(M_COM); + write_2_bytes(comment_length + 2); + while (comment_length > 0) { + write_1_byte(*comment_arg++); + comment_length--; + } + } + /* Duplicate the remainder of the source file. + * Note that any COM markers occuring after SOF will not be touched. + */ + write_marker(marker); + copy_rest_of_file(); + + /* All done. */ + exit(EXIT_SUCCESS); + return 0; /* suppress no-return-value warnings */ +} diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/wrppm.c b/packages/services/gfx/mw/current/src/jpeg-6b/wrppm.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/wrppm.c @@ -0,0 +1,268 @@ +/* + * wrppm.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains routines to write output images in PPM/PGM format. + * The extended 2-byte-per-sample raw PPM/PGM formats are supported. + * The PBMPLUS library is NOT required to compile this software + * (but it is highly useful as a set of PPM image manipulation programs). + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume output to + * an ordinary stdio stream. + */ + +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ + +#ifdef PPM_SUPPORTED + + +/* + * For 12-bit JPEG data, we either downscale the values to 8 bits + * (to write standard byte-per-sample PPM/PGM files), or output + * nonstandard word-per-sample PPM/PGM files. Downscaling is done + * if PPM_NORAWWORD is defined (this can be done in the Makefile + * or in jconfig.h). + * (When the core library supports data precision reduction, a cleaner + * implementation will be to ask for that instead.) + */ + +#if BITS_IN_JSAMPLE == 8 +#define PUTPPMSAMPLE(ptr,v) *ptr++ = (char) (v) +#define BYTESPERSAMPLE 1 +#define PPM_MAXVAL 255 +#else +#ifdef PPM_NORAWWORD +#define PUTPPMSAMPLE(ptr,v) *ptr++ = (char) ((v) >> (BITS_IN_JSAMPLE-8)) +#define BYTESPERSAMPLE 1 +#define PPM_MAXVAL 255 +#else +/* The word-per-sample format always puts the LSB first. */ +#define PUTPPMSAMPLE(ptr,v) \ + { register int val_ = v; \ + *ptr++ = (char) (val_ & 0xFF); \ + *ptr++ = (char) ((val_ >> 8) & 0xFF); \ + } +#define BYTESPERSAMPLE 2 +#define PPM_MAXVAL ((1<pub.output_file, dest->iobuffer, dest->buffer_width); +} + + +/* + * This code is used when we have to copy the data and apply a pixel + * format translation. Typically this only happens in 12-bit mode. + */ + +METHODDEF(void) +copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied) +{ + ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; + register char * bufferptr; + register JSAMPROW ptr; + register JDIMENSION col; + + ptr = dest->pub.buffer[0]; + bufferptr = dest->iobuffer; + for (col = dest->samples_per_row; col > 0; col--) { + PUTPPMSAMPLE(bufferptr, GETJSAMPLE(*ptr++)); + } + (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); +} + + +/* + * Write some pixel data when color quantization is in effect. + * We have to demap the color index values to straight data. + */ + +METHODDEF(void) +put_demapped_rgb (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied) +{ + ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; + register char * bufferptr; + register int pixval; + register JSAMPROW ptr; + register JSAMPROW color_map0 = cinfo->colormap[0]; + register JSAMPROW color_map1 = cinfo->colormap[1]; + register JSAMPROW color_map2 = cinfo->colormap[2]; + register JDIMENSION col; + + ptr = dest->pub.buffer[0]; + bufferptr = dest->iobuffer; + for (col = cinfo->output_width; col > 0; col--) { + pixval = GETJSAMPLE(*ptr++); + PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map0[pixval])); + PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map1[pixval])); + PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map2[pixval])); + } + (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); +} + + +METHODDEF(void) +put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied) +{ + ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; + register char * bufferptr; + register JSAMPROW ptr; + register JSAMPROW color_map = cinfo->colormap[0]; + register JDIMENSION col; + + ptr = dest->pub.buffer[0]; + bufferptr = dest->iobuffer; + for (col = cinfo->output_width; col > 0; col--) { + PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map[GETJSAMPLE(*ptr++)])); + } + (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); +} + + +/* + * Startup: write the file header. + */ + +METHODDEF(void) +start_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) +{ + ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; + + /* Emit file header */ + switch (cinfo->out_color_space) { + case JCS_GRAYSCALE: + /* emit header for raw PGM format */ + fprintf(dest->pub.output_file, "P5\n%ld %ld\n%d\n", + (long) cinfo->output_width, (long) cinfo->output_height, + PPM_MAXVAL); + break; + case JCS_RGB: + /* emit header for raw PPM format */ + fprintf(dest->pub.output_file, "P6\n%ld %ld\n%d\n", + (long) cinfo->output_width, (long) cinfo->output_height, + PPM_MAXVAL); + break; + default: + ERREXIT(cinfo, JERR_PPM_COLORSPACE); + } +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF(void) +finish_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) +{ + /* Make sure we wrote the output file OK */ + fflush(dinfo->output_file); + if (ferror(dinfo->output_file)) + ERREXIT(cinfo, JERR_FILE_WRITE); +} + + +/* + * The module selection routine for PPM format output. + */ + +GLOBAL(djpeg_dest_ptr) +jinit_write_ppm (j_decompress_ptr cinfo) +{ + ppm_dest_ptr dest; + + /* Create module interface object, fill in method pointers */ + dest = (ppm_dest_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(ppm_dest_struct)); + dest->pub.start_output = start_output_ppm; + dest->pub.finish_output = finish_output_ppm; + + /* Calculate output image dimensions so we can allocate space */ + jpeg_calc_output_dimensions(cinfo); + + /* Create physical I/O buffer. Note we make this near on a PC. */ + dest->samples_per_row = cinfo->output_width * cinfo->out_color_components; + dest->buffer_width = dest->samples_per_row * (BYTESPERSAMPLE * SIZEOF(char)); + dest->iobuffer = (char *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width); + + if (cinfo->quantize_colors || BITS_IN_JSAMPLE != 8 || + SIZEOF(JSAMPLE) != SIZEOF(char)) { + /* When quantizing, we need an output buffer for colormap indexes + * that's separate from the physical I/O buffer. We also need a + * separate buffer if pixel format translation must take place. + */ + dest->pub.buffer = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + cinfo->output_width * cinfo->output_components, (JDIMENSION) 1); + dest->pub.buffer_height = 1; + if (! cinfo->quantize_colors) + dest->pub.put_pixel_rows = copy_pixel_rows; + else if (cinfo->out_color_space == JCS_GRAYSCALE) + dest->pub.put_pixel_rows = put_demapped_gray; + else + dest->pub.put_pixel_rows = put_demapped_rgb; + } else { + /* We will fwrite() directly from decompressor output buffer. */ + /* Synthesize a JSAMPARRAY pointer structure */ + /* Cast here implies near->far pointer conversion on PCs */ + dest->pixrow = (JSAMPROW) dest->iobuffer; + dest->pub.buffer = & dest->pixrow; + dest->pub.buffer_height = 1; + dest->pub.put_pixel_rows = put_pixel_rows; + } + + return (djpeg_dest_ptr) dest; +} + +#endif /* PPM_SUPPORTED */ diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/wrrle.c b/packages/services/gfx/mw/current/src/jpeg-6b/wrrle.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/wrrle.c @@ -0,0 +1,305 @@ +/* + * wrrle.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains routines to write output images in RLE format. + * The Utah Raster Toolkit library is required (version 3.1 or later). + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume output to + * an ordinary stdio stream. + * + * Based on code contributed by Mike Lijewski, + * with updates from Robert Hutchinson. + */ + +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ + +#ifdef RLE_SUPPORTED + +/* rle.h is provided by the Utah Raster Toolkit. */ + +#include + +/* + * We assume that JSAMPLE has the same representation as rle_pixel, + * to wit, "unsigned char". Hence we can't cope with 12- or 16-bit samples. + */ + +#if BITS_IN_JSAMPLE != 8 + Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ +#endif + + +/* + * Since RLE stores scanlines bottom-to-top, we have to invert the image + * from JPEG's top-to-bottom order. To do this, we save the outgoing data + * in a virtual array during put_pixel_row calls, then actually emit the + * RLE file during finish_output. + */ + + +/* + * For now, if we emit an RLE color map then it is always 256 entries long, + * though not all of the entries need be used. + */ + +#define CMAPBITS 8 +#define CMAPLENGTH (1<<(CMAPBITS)) + +typedef struct { + struct djpeg_dest_struct pub; /* public fields */ + + jvirt_sarray_ptr image; /* virtual array to store the output image */ + rle_map *colormap; /* RLE-style color map, or NULL if none */ + rle_pixel **rle_row; /* To pass rows to rle_putrow() */ + +} rle_dest_struct; + +typedef rle_dest_struct * rle_dest_ptr; + +/* Forward declarations */ +METHODDEF(void) rle_put_pixel_rows + JPP((j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied)); + + +/* + * Write the file header. + * + * In this module it's easier to wait till finish_output to write anything. + */ + +METHODDEF(void) +start_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) +{ + rle_dest_ptr dest = (rle_dest_ptr) dinfo; + size_t cmapsize; + int i, ci; +#ifdef PROGRESS_REPORT + cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; +#endif + + /* + * Make sure the image can be stored in RLE format. + * + * - RLE stores image dimensions as *signed* 16 bit integers. JPEG + * uses unsigned, so we have to check the width. + * + * - Colorspace is expected to be grayscale or RGB. + * + * - The number of channels (components) is expected to be 1 (grayscale/ + * pseudocolor) or 3 (truecolor/directcolor). + * (could be 2 or 4 if using an alpha channel, but we aren't) + */ + + if (cinfo->output_width > 32767 || cinfo->output_height > 32767) + ERREXIT2(cinfo, JERR_RLE_DIMENSIONS, cinfo->output_width, + cinfo->output_height); + + if (cinfo->out_color_space != JCS_GRAYSCALE && + cinfo->out_color_space != JCS_RGB) + ERREXIT(cinfo, JERR_RLE_COLORSPACE); + + if (cinfo->output_components != 1 && cinfo->output_components != 3) + ERREXIT1(cinfo, JERR_RLE_TOOMANYCHANNELS, cinfo->num_components); + + /* Convert colormap, if any, to RLE format. */ + + dest->colormap = NULL; + + if (cinfo->quantize_colors) { + /* Allocate storage for RLE-style cmap, zero any extra entries */ + cmapsize = cinfo->out_color_components * CMAPLENGTH * SIZEOF(rle_map); + dest->colormap = (rle_map *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, cmapsize); + MEMZERO(dest->colormap, cmapsize); + + /* Save away data in RLE format --- note 8-bit left shift! */ + /* Shifting would need adjustment for JSAMPLEs wider than 8 bits. */ + for (ci = 0; ci < cinfo->out_color_components; ci++) { + for (i = 0; i < cinfo->actual_number_of_colors; i++) { + dest->colormap[ci * CMAPLENGTH + i] = + GETJSAMPLE(cinfo->colormap[ci][i]) << 8; + } + } + } + + /* Set the output buffer to the first row */ + dest->pub.buffer = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, dest->image, (JDIMENSION) 0, (JDIMENSION) 1, TRUE); + dest->pub.buffer_height = 1; + + dest->pub.put_pixel_rows = rle_put_pixel_rows; + +#ifdef PROGRESS_REPORT + if (progress != NULL) { + progress->total_extra_passes++; /* count file writing as separate pass */ + } +#endif +} + + +/* + * Write some pixel data. + * + * This routine just saves the data away in a virtual array. + */ + +METHODDEF(void) +rle_put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied) +{ + rle_dest_ptr dest = (rle_dest_ptr) dinfo; + + if (cinfo->output_scanline < cinfo->output_height) { + dest->pub.buffer = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, dest->image, + cinfo->output_scanline, (JDIMENSION) 1, TRUE); + } +} + +/* + * Finish up at the end of the file. + * + * Here is where we really output the RLE file. + */ + +METHODDEF(void) +finish_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) +{ + rle_dest_ptr dest = (rle_dest_ptr) dinfo; + rle_hdr header; /* Output file information */ + rle_pixel **rle_row, *red, *green, *blue; + JSAMPROW output_row; + char cmapcomment[80]; + int row, col; + int ci; +#ifdef PROGRESS_REPORT + cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; +#endif + + /* Initialize the header info */ + header = *rle_hdr_init(NULL); + header.rle_file = dest->pub.output_file; + header.xmin = 0; + header.xmax = cinfo->output_width - 1; + header.ymin = 0; + header.ymax = cinfo->output_height - 1; + header.alpha = 0; + header.ncolors = cinfo->output_components; + for (ci = 0; ci < cinfo->output_components; ci++) { + RLE_SET_BIT(header, ci); + } + if (cinfo->quantize_colors) { + header.ncmap = cinfo->out_color_components; + header.cmaplen = CMAPBITS; + header.cmap = dest->colormap; + /* Add a comment to the output image with the true colormap length. */ + sprintf(cmapcomment, "color_map_length=%d", cinfo->actual_number_of_colors); + rle_putcom(cmapcomment, &header); + } + + /* Emit the RLE header and color map (if any) */ + rle_put_setup(&header); + + /* Now output the RLE data from our virtual array. + * We assume here that (a) rle_pixel is represented the same as JSAMPLE, + * and (b) we are not on a machine where FAR pointers differ from regular. + */ + +#ifdef PROGRESS_REPORT + if (progress != NULL) { + progress->pub.pass_limit = cinfo->output_height; + progress->pub.pass_counter = 0; + (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); + } +#endif + + if (cinfo->output_components == 1) { + for (row = cinfo->output_height-1; row >= 0; row--) { + rle_row = (rle_pixel **) (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, dest->image, + (JDIMENSION) row, (JDIMENSION) 1, FALSE); + rle_putrow(rle_row, (int) cinfo->output_width, &header); +#ifdef PROGRESS_REPORT + if (progress != NULL) { + progress->pub.pass_counter++; + (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); + } +#endif + } + } else { + for (row = cinfo->output_height-1; row >= 0; row--) { + rle_row = (rle_pixel **) dest->rle_row; + output_row = * (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, dest->image, + (JDIMENSION) row, (JDIMENSION) 1, FALSE); + red = rle_row[0]; + green = rle_row[1]; + blue = rle_row[2]; + for (col = cinfo->output_width; col > 0; col--) { + *red++ = GETJSAMPLE(*output_row++); + *green++ = GETJSAMPLE(*output_row++); + *blue++ = GETJSAMPLE(*output_row++); + } + rle_putrow(rle_row, (int) cinfo->output_width, &header); +#ifdef PROGRESS_REPORT + if (progress != NULL) { + progress->pub.pass_counter++; + (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); + } +#endif + } + } + +#ifdef PROGRESS_REPORT + if (progress != NULL) + progress->completed_extra_passes++; +#endif + + /* Emit file trailer */ + rle_puteof(&header); + fflush(dest->pub.output_file); + if (ferror(dest->pub.output_file)) + ERREXIT(cinfo, JERR_FILE_WRITE); +} + + +/* + * The module selection routine for RLE format output. + */ + +GLOBAL(djpeg_dest_ptr) +jinit_write_rle (j_decompress_ptr cinfo) +{ + rle_dest_ptr dest; + + /* Create module interface object, fill in method pointers */ + dest = (rle_dest_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(rle_dest_struct)); + dest->pub.start_output = start_output_rle; + dest->pub.finish_output = finish_output_rle; + + /* Calculate output image dimensions so we can allocate space */ + jpeg_calc_output_dimensions(cinfo); + + /* Allocate a work array for output to the RLE library. */ + dest->rle_row = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + cinfo->output_width, (JDIMENSION) cinfo->output_components); + + /* Allocate a virtual array to hold the image. */ + dest->image = (*cinfo->mem->request_virt_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, + (JDIMENSION) (cinfo->output_width * cinfo->output_components), + cinfo->output_height, (JDIMENSION) 1); + + return (djpeg_dest_ptr) dest; +} + +#endif /* RLE_SUPPORTED */ diff --git a/packages/services/gfx/mw/current/src/jpeg-6b/wrtarga.c b/packages/services/gfx/mw/current/src/jpeg-6b/wrtarga.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/jpeg-6b/wrtarga.c @@ -0,0 +1,253 @@ +/* + * wrtarga.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains routines to write output images in Targa format. + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume output to + * an ordinary stdio stream. + * + * Based on code contributed by Lee Daniel Crocker. + */ + +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ + +#ifdef TARGA_SUPPORTED + + +/* + * To support 12-bit JPEG data, we'd have to scale output down to 8 bits. + * This is not yet implemented. + */ + +#if BITS_IN_JSAMPLE != 8 + Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ +#endif + +/* + * The output buffer needs to be writable by fwrite(). On PCs, we must + * allocate the buffer in near data space, because we are assuming small-data + * memory model, wherein fwrite() can't reach far memory. If you need to + * process very wide images on a PC, you might have to compile in large-memory + * model, or else replace fwrite() with a putc() loop --- which will be much + * slower. + */ + + +/* Private version of data destination object */ + +typedef struct { + struct djpeg_dest_struct pub; /* public fields */ + + char *iobuffer; /* physical I/O buffer */ + JDIMENSION buffer_width; /* width of one row */ +} tga_dest_struct; + +typedef tga_dest_struct * tga_dest_ptr; + + +LOCAL(void) +write_header (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors) +/* Create and write a Targa header */ +{ + char targaheader[18]; + + /* Set unused fields of header to 0 */ + MEMZERO(targaheader, SIZEOF(targaheader)); + + if (num_colors > 0) { + targaheader[1] = 1; /* color map type 1 */ + targaheader[5] = (char) (num_colors & 0xFF); + targaheader[6] = (char) (num_colors >> 8); + targaheader[7] = 24; /* 24 bits per cmap entry */ + } + + targaheader[12] = (char) (cinfo->output_width & 0xFF); + targaheader[13] = (char) (cinfo->output_width >> 8); + targaheader[14] = (char) (cinfo->output_height & 0xFF); + targaheader[15] = (char) (cinfo->output_height >> 8); + targaheader[17] = 0x20; /* Top-down, non-interlaced */ + + if (cinfo->out_color_space == JCS_GRAYSCALE) { + targaheader[2] = 3; /* image type = uncompressed gray-scale */ + targaheader[16] = 8; /* bits per pixel */ + } else { /* must be RGB */ + if (num_colors > 0) { + targaheader[2] = 1; /* image type = colormapped RGB */ + targaheader[16] = 8; + } else { + targaheader[2] = 2; /* image type = uncompressed RGB */ + targaheader[16] = 24; + } + } + + if (JFWRITE(dinfo->output_file, targaheader, 18) != (size_t) 18) + ERREXIT(cinfo, JERR_FILE_WRITE); +} + + +/* + * Write some pixel data. + * In this module rows_supplied will always be 1. + */ + +METHODDEF(void) +put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied) +/* used for unquantized full-color output */ +{ + tga_dest_ptr dest = (tga_dest_ptr) dinfo; + register JSAMPROW inptr; + register char * outptr; + register JDIMENSION col; + + inptr = dest->pub.buffer[0]; + outptr = dest->iobuffer; + for (col = cinfo->output_width; col > 0; col--) { + outptr[0] = (char) GETJSAMPLE(inptr[2]); /* RGB to BGR order */ + outptr[1] = (char) GETJSAMPLE(inptr[1]); + outptr[2] = (char) GETJSAMPLE(inptr[0]); + inptr += 3, outptr += 3; + } + (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); +} + +METHODDEF(void) +put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied) +/* used for grayscale OR quantized color output */ +{ + tga_dest_ptr dest = (tga_dest_ptr) dinfo; + register JSAMPROW inptr; + register char * outptr; + register JDIMENSION col; + + inptr = dest->pub.buffer[0]; + outptr = dest->iobuffer; + for (col = cinfo->output_width; col > 0; col--) { + *outptr++ = (char) GETJSAMPLE(*inptr++); + } + (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); +} + + +/* + * Write some demapped pixel data when color quantization is in effect. + * For Targa, this is only applied to grayscale data. + */ + +METHODDEF(void) +put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied) +{ + tga_dest_ptr dest = (tga_dest_ptr) dinfo; + register JSAMPROW inptr; + register char * outptr; + register JSAMPROW color_map0 = cinfo->colormap[0]; + register JDIMENSION col; + + inptr = dest->pub.buffer[0]; + outptr = dest->iobuffer; + for (col = cinfo->output_width; col > 0; col--) { + *outptr++ = (char) GETJSAMPLE(color_map0[GETJSAMPLE(*inptr++)]); + } + (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); +} + + +/* + * Startup: write the file header. + */ + +METHODDEF(void) +start_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) +{ + tga_dest_ptr dest = (tga_dest_ptr) dinfo; + int num_colors, i; + FILE *outfile; + + if (cinfo->out_color_space == JCS_GRAYSCALE) { + /* Targa doesn't have a mapped grayscale format, so we will */ + /* demap quantized gray output. Never emit a colormap. */ + write_header(cinfo, dinfo, 0); + if (cinfo->quantize_colors) + dest->pub.put_pixel_rows = put_demapped_gray; + else + dest->pub.put_pixel_rows = put_gray_rows; + } else if (cinfo->out_color_space == JCS_RGB) { + if (cinfo->quantize_colors) { + /* We only support 8-bit colormap indexes, so only 256 colors */ + num_colors = cinfo->actual_number_of_colors; + if (num_colors > 256) + ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, num_colors); + write_header(cinfo, dinfo, num_colors); + /* Write the colormap. Note Targa uses BGR byte order */ + outfile = dest->pub.output_file; + for (i = 0; i < num_colors; i++) { + putc(GETJSAMPLE(cinfo->colormap[2][i]), outfile); + putc(GETJSAMPLE(cinfo->colormap[1][i]), outfile); + putc(GETJSAMPLE(cinfo->colormap[0][i]), outfile); + } + dest->pub.put_pixel_rows = put_gray_rows; + } else { + write_header(cinfo, dinfo, 0); + dest->pub.put_pixel_rows = put_pixel_rows; + } + } else { + ERREXIT(cinfo, JERR_TGA_COLORSPACE); + } +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF(void) +finish_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) +{ + /* Make sure we wrote the output file OK */ + fflush(dinfo->output_file); + if (ferror(dinfo->output_file)) + ERREXIT(cinfo, JERR_FILE_WRITE); +} + + +/* + * The module selection routine for Targa format output. + */ + +GLOBAL(djpeg_dest_ptr) +jinit_write_targa (j_decompress_ptr cinfo) +{ + tga_dest_ptr dest; + + /* Create module interface object, fill in method pointers */ + dest = (tga_dest_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(tga_dest_struct)); + dest->pub.start_output = start_output_tga; + dest->pub.finish_output = finish_output_tga; + + /* Calculate output image dimensions so we can allocate space */ + jpeg_calc_output_dimensions(cinfo); + + /* Create I/O buffer. Note we make this near on a PC. */ + dest->buffer_width = cinfo->output_width * cinfo->output_components; + dest->iobuffer = (char *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (size_t) (dest->buffer_width * SIZEOF(char))); + + /* Create decompressor output buffer. */ + dest->pub.buffer = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width, (JDIMENSION) 1); + dest->pub.buffer_height = 1; + + return (djpeg_dest_ptr) dest; +} + +#endif /* TARGA_SUPPORTED */ diff --git a/packages/services/gfx/mw/current/src/launcher.sh b/packages/services/gfx/mw/current/src/launcher.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/launcher.sh @@ -0,0 +1,1 @@ +bin/nano-X & bin/nanowm & bin/launcher bin/launcher.cnf & sleep 10000 diff --git a/packages/services/gfx/mw/current/src/logfont.sh b/packages/services/gfx/mw/current/src/logfont.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/logfont.sh @@ -0,0 +1,1 @@ +bin/nano-X & bin/logfont diff --git a/packages/services/gfx/mw/current/src/mcmwin.mak b/packages/services/gfx/mw/current/src/mcmwin.mak new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mcmwin.mak @@ -0,0 +1,66 @@ +# +# Microwindows Makefile for MSDOS using Microsoft C 5.10 +# +# Copyright (c) 1999 Greg Haerr +# +CC=cl -c -Gs -Ols -AM -I. -Ic:\tools\msc5\include +xCFLAGS=-W1 -DUPDATEREGIONS=1 -DERASEMOVE=1 +CFLAGS=-W1 -DERASEMOVE=1 +LFLAGS=/NOI +LIBDIR=c:\tools\msc5 + +SERV=mwin\winmain.obj mwin\winuser.obj mwin\wingdi.obj mwin\winexpos.obj\ + mwin\winclip.obj mwin\winevent.obj mwin\windefw.obj mwin\list.obj\ + engine\devdraw.obj engine\devmouse.obj engine\devkbd.obj\ + engine\devclip.obj\ + engine\devpal1.obj engine\devpal2.obj engine\devpal4.obj\ + mwin\winlib\draw3d.obj mwin\winlib\fastfill.obj mwin\winlib\insetr.obj\ + mwin\winlib\ptinsid.obj mwin\winlib\graph3d.obj +VGA_NEW=drivers\vgaplan4.obj drivers\mempl4.obj +VGA_OLD=drivers\asmplan4.obj +VGA_HWINIT=drivers\vgainit.obj +DRIVERS=drivers\scr_bios.obj drivers\romfont.obj drivers\kbd_bios.obj\ + drivers\mou_dos.obj drivers\asmbios.obj $(VGA_NEW) +DEMO=demos\mwin\demo.obj mwin\winctl\button.obj mwin\bmp\cs1.obj +OBJS=$(SERV) $(DRIVERS) $(DEMO) +LIBS= + +all: mwindemo + +clean: + erase *.map + erase mwindemo.exe + erase drivers\*.obj + erase demos\mwin\*.obj + erase engine\*.obj + erase mwin\*.obj + erase mwin\bmp\*.obj + erase mwin\winctl\*.obj + erase mwin\winlib\*.obj + + +.c.obj: + $(CC) $(CFLAGS) -Fo$@ $< + +drivers\asmbios.obj: drivers\asmbios.s + cd drivers + masm -Dmem_S -D__MEDIUM__ -Mx asmbios.s;;; + cd .. + +drivers\asmplan4.obj: drivers\asmplan4.s + cd drivers + masm -Dmem_S -D__MEDIUM__ -Mx asmplan4.s;;; + cd .. + +mwindemo: $(OBJS) + @set LIB=$(LIBDOS) + link @<< +$(LFLAGS) /NOE+ +$(OBJS: =+^ +) +mwindemo +mwindemo/map/stack:3000/seg:256/f/packc:50000 +$(LIBS) $(LIBDIR)\mlibce +nul +<< + diff --git a/packages/services/gfx/mw/current/src/mcnanox.mak b/packages/services/gfx/mw/current/src/mcnanox.mak new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mcnanox.mak @@ -0,0 +1,61 @@ +# +# Nano-X Makefile for MSDOS using Microsoft C 5.10 +# +# Copyright (c) 1999 Greg Haerr +# +CC=cl -c -Gs -Ols -AM -I. -Ic:\tools\msc5\include +CFLAGS=-W1 -DNONETWORK=1 +LFLAGS=/NOI +LIBDIR=c:\tools\msc5 + +SERV=nanox\srvmain.obj nanox\srvfunc.obj nanox\srvutil.obj nanox\srvevent.obj\ + engine\devdraw.obj engine\devmouse.obj engine\devkbd.obj\ + engine\devclip.obj\ + engine\devpal1.obj engine\devpal2.obj engine\devpal4.obj +VGA_NEW=drivers\vgaplan4.obj drivers\mempl4.obj +VGA_OLD=drivers\asmplan4.obj +VGA_HWINIT=drivers\vgainit.obj +DRIVERS=drivers\scr_bios.obj drivers\romfont.obj drivers\kbd_bios.obj\ + drivers\mou_dos.obj drivers\asmbios.obj $(VGA_NEW) +xDEMO=demos\nanox\demo.obj nanox\stubs.obj +DEMO=demos\nanox\landmine.obj nanox\stubs.obj +xDEMO=demos\nanox\world.obj nanox\stubs.obj +xDEMO=test.obj +OBJS=$(SERV) $(DRIVERS) $(DEMO) +LIBS= + +all: nanox + +clean: + erase *.map + erase nanox.exe + erase nanox\*.obj + erase engine\*.obj + erase drivers\*.obj + erase demos\nanox\*.obj + +.c.obj: + $(CC) $(CFLAGS) -Fo$@ $< + +drivers\asmbios.obj: drivers\asmbios.s + cd drivers + masm -Dmem_S -D__MEDIUM__ -Mx asmbios.s;;; + cd .. + +drivers\asmplan4.obj: drivers\asmplan4.s + cd drivers + masm -Dmem_S -D__MEDIUM__ -Mx asmplan4.s;;; + cd .. + +nanox: $(OBJS) + @set LIB=$(LIBDOS) + link @<< +$(LFLAGS) /NOE+ +$(OBJS: =+^ +) +nanox +nanox/map/stack:16384/seg:256/f/packc:50000 +$(LIBS) $(LIBDIR)\mlibce +nul +<< + diff --git a/packages/services/gfx/mw/current/src/mouse.sh b/packages/services/gfx/mw/current/src/mouse.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mouse.sh @@ -0,0 +1,4 @@ +# kill old mouse driver +gpm -k +# start mouse driver in repeater mode +gpm -R -t ps2 diff --git a/packages/services/gfx/mw/current/src/move.sh b/packages/services/gfx/mw/current/src/move.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/move.sh @@ -0,0 +1,1 @@ +bin/nano-X -p & bin/move; #sleep 10000 diff --git a/packages/services/gfx/mw/current/src/move2.sh b/packages/services/gfx/mw/current/src/move2.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/move2.sh @@ -0,0 +1,1 @@ +bin/nano-X -p & bin/nanowm & bin/move; #sleep 10000 diff --git a/packages/services/gfx/mw/current/src/mwin/Makefile b/packages/services/gfx/mw/current/src/mwin/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/Makefile @@ -0,0 +1,55 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000, 2002 Martin Jolicoeur, Greg Haerr +############################################################################## + +ifndef TOP +TOP = .. +CONFIG = $(TOP)/config +endif + +include $(CONFIG) + +VPATH := $(TOP)/mwin + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += + +# Defines for preprocessor +ifeq ($(ERASEMOVE), Y) +DEFINES += -DERASEMOVE=1 +endif + +ifeq ($(UPDATEREGIONS), Y) +DEFINES += -DUPDATEREGIONS=1 +endif + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +ifeq ($(MICROWIN), Y) + +# If you want to create a library with the objects files, define the name here +LIBNAME = libmwin.a +LIBNAMESO = libmwin.so + +# List of objects to compile +OBJS = winmain.o winuser.o wingdi.o winexpos.o winclip.o winevent.o\ + windefw.o winrgn.o winfont.o winsbar.o + +endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### + diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/Makefile b/packages/services/gfx/mw/current/src/mwin/bmp/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/bmp/Makefile @@ -0,0 +1,64 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr +############################################################################## + +ifndef TOP +TOP = ../.. +CONFIG = $(TOP)/config +endif + +include $(CONFIG) + +#all: $(TOP)/bin/convbmp +#HOSTCC=gcc +#HOSTCFLAGS=-I../../include + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += +# Defines for preprocessor +DEFINES += + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +ifeq ($(MICROWIN), Y) + +# If you want to create a library with the objects files, define the name here +LIBNAME = libmwimages.a +LIBNAMESO = libmwimages.so + +# List of objects to compile +OBJS = car8.o min4.o max4.o close4.o under4.o\ + zion208.o cs1.o rle8.o microwin.o penguin.o + +all: $(TOP)/bin/convbmp $(TOP)/bin/makebmp default + +convbmp: convbmp.c + $(HOSTCC) $(HOSTCFLAGS) $< -o $@ + +endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### + +realclean: clean + $(RM) car8.c min4.c max4.c close4.c under4.c zion208.c cs1.c rle8.c \ + microwin.c penguin.c + +$(TOP)/bin/convbmp: convbmp.c + $(HOSTCC) $(HOSTCFLAGS) $< -o $@ + +$(TOP)/bin/makebmp: makebmp.c + $(HOSTCC) $(HOSTCFLAGS) $< -o $@ diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/car8.bmp b/packages/services/gfx/mw/current/src/mwin/bmp/car8.bmp new file mode 100644 index 0000000000000000000000000000000000000000..a4316b206b83f0d8a9ea35d44f520636eb45fac2 GIT binary patch literal 50974 zc%1FMZFm&dohRCMssUA1BUMXRYC$#qB4)e2+ij;cGtzn*fhA+ikloC#$UftdLxQ3~ z#9(Z|FBrrHjAUutyhunm2+SmQ64p|LkTDM%8|1+3CeEFi;5!pz4;LFejv=-Y!u>q= zgFoC4egFUed99X&oxRUJrEu1gg>x<1f3frT;yJ9ilU6A&!yVk@0 zUSH;}m@kvTS*)r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RjE8>XE(U3Yr6hf6p(bQ5W zrIO_QQ7z47Q{+LdVF-B=`pmF2;Iwx0Xa@~7c>}#=OmPQcfrPG?7b$aYNcAJu5<0b2L*u`YT-A#z=; zWI&>(;Nn>tq6rN{Be4_)LzGR(3g;8s(;*eorR|H9kWd*pOWsLaQ#P!*gvHSElS)py zK$dD+bwhqf%Mb~)_Ls6ytT%KYNxJZcCY`b{8X8(d$#xJ8#`ncJQ%I0@LjH-LsiojY zhN)%7uhe$bk>{pG_u-2)Ma8K+DYcV&Izg4YV3`7s + * + * Windows BMP to Microwindows image converter + * + * 6/9/1999 g haerr + * + * 05/01/2000 Michael Temari + * Modified to output .s ACK format for Minix + */ + +#include +#include +#include +#include "device.h" + +/* separators for DOS & Unix file systems */ +#define OS_FILE_SEPARATOR "/\\" + +#define PIX2BYTES(n) (((n)+7)/8) + +#define BI_RGB 0L +#define BI_RLE8 1L +#define BI_RLE4 2L +#define BI_BITFIELDS 3L + +typedef unsigned char UCHAR; +typedef unsigned char BYTE; + +#if !_MINIX +typedef unsigned short WORD; +typedef unsigned long DWORD; +typedef long LONG; +#define CASTWORD +#define CASTDWORD +#define CASTLONG +#else +/* The Minix ACK compiler cannot pack a structure so we do it the hardway */ +typedef unsigned char WORD[2]; +typedef unsigned char DWORD[4]; +typedef unsigned char LONG[4]; +#define CASTWORD *(unsigned short *)& +#define CASTDWORD *(unsigned long *)& +#define CASTLONG *(long *)& +#endif + +#pragma pack(1) +/* windows style*/ +typedef struct { + /* BITMAPFILEHEADER*/ + BYTE bfType[2]; + DWORD bfSize; + WORD bfReserved1; + WORD bfReserved2; + DWORD bfOffBits; + /* BITMAPINFOHEADER*/ + DWORD BiSize; + LONG BiWidth; + LONG BiHeight; + WORD BiPlanes; + WORD BiBitCount; + DWORD BiCompression; + DWORD BiSizeImage; + LONG BiXpelsPerMeter; + LONG BiYpelsPerMeter; + DWORD BiClrUsed; + DWORD BiClrImportant; +} BMPHEAD; + +/* os/2 style*/ +typedef struct { + /* BITMAPFILEHEADER*/ + BYTE bfType[2]; + DWORD bfSize; + WORD bfReserved1; + WORD bfReserved2; + DWORD bfOffBits; + /* BITMAPCOREHEADER*/ + DWORD bcSize; + WORD bcWidth; + WORD bcHeight; + WORD bcPlanes; + WORD bcBitCount; +} BMPCOREHEAD; +#pragma pack() + +int ConvBMP(FILE *fp,char *name); +void outline(UCHAR *linebuffer, int bitdepth, int linesize, int y); +int DecodeRLE8(UCHAR *buf,FILE *fp); +int DecodeRLE4(UCHAR *buf,FILE *fp); +void put4(int b); + +int s_flag = 0; + +int main(int argc,char *argv[]) +{ +FILE *fp; +char *p; +char name[64]; +char oname[64]; + + /* skip the program name */ + argc--; + argv++; + + /* check for -s flag */ + if(argc && strcmp(*argv, "-s") == 0) { + s_flag = -1; + argc--; + argv++; + } + + /* need at least one file to convert */ + if(argc == 0) { + fprintf(stderr, "Usage: convbmp [-s] \n"); + return(-1); + } + + /* go back one since the first thing in the loop is to increment */ + argv--; + while(argc--) { + argv++; + if((p = strrchr(*argv, '.')) != (char *)NULL) + *p = '\0'; + strcpy(name, *argv); + strcpy(oname, *argv); + if(s_flag) + strcat(oname, ".s"); + else + strcat(oname, ".c"); + if(p != (char *)NULL) + *p = '.'; + if((fp = fopen(*argv, "rb")) == (FILE *)NULL) { + fprintf(stderr, "Can't open file: %s\n", *argv); + continue; + } + if(freopen(oname, "w", stdout) == (FILE *)NULL) { + fclose(fp); + fprintf(stderr, "Could not open output file %s\n", oname); + continue; + } + + /* + let's strip any directory from the path passed in. + This prevent problems if this utility is given + path is not for the curent directory. + */ + p = name; + while( 1 ) + { + char *p1 = p; + p1 = strpbrk( p, OS_FILE_SEPARATOR ); + if( p1 ) + { + p = p1+1; + } + else + { + break; + } + } + if(ConvBMP(fp, p)) { + fprintf(stderr, "Conversion failed: %s\n", *argv); + fclose(fp); + continue; + } + fclose(fp); + } + return(0); +} + +/* decode a bmp file*/ +int ConvBMP(FILE *fp, char *name) +{ +BMPHEAD bmp; +BMPCOREHEAD *bmc; +int i, palsize; +UCHAR *linebuffer = NULL; +unsigned int cx, cy, bitdepth, linesize; +long compression; +MWPALENTRY cmap[256]; +long l; +int g; +int bytesperpixel; +UCHAR *p = (UCHAR *)&l; + + /* read BMP header*/ + if(fread(&bmp, 1, sizeof(BMPHEAD), fp) != sizeof(BMPHEAD)) { + fprintf(stderr, "Error reading .bmp file header\n"); + return(-1); + } + + /* might be windows or os/2 header*/ + if(CASTDWORD bmp.BiSize == 12) { + bmc = (BMPCOREHEAD *)&bmp; + cx = (int)CASTWORD bmc->bcWidth; + cy = (int)CASTWORD bmc->bcHeight; + bitdepth = CASTWORD bmc->bcBitCount; + palsize = 1 << bitdepth; + compression = BI_RGB; + fseek(fp, sizeof(BMPCOREHEAD), SEEK_SET); + } else { + cx = (int)CASTLONG bmp.BiWidth; + cy = (int)CASTLONG bmp.BiHeight; + bitdepth = CASTWORD bmp.BiBitCount; + palsize = (int)CASTDWORD bmp.BiClrUsed; + if(palsize == 0) + palsize = 1 << bitdepth; + compression = CASTDWORD bmp.BiCompression; + } + + if(bitdepth > 8) + palsize = 0; + + /* currently only 1, 4, 8 and 24 bpp bitmaps*/ + if(bitdepth > 8 && bitdepth != 24) { + fprintf(stderr, "Error: bits per pixel must be 1, 4, 8 or 24\n"); + return(-1); + } + + /* compute image line size and allocate line buffer*/ + if(bitdepth == 1) { + linesize = PIX2BYTES(cx); + bytesperpixel = 1; + } else if(bitdepth <= 4) { + linesize = PIX2BYTES(cx<<2); + bytesperpixel = 1; + } else if(bitdepth <= 8) { + linesize = cx; + bytesperpixel = 1; + } else if(bitdepth <= 16) { + linesize = cx * 2; + bytesperpixel = 2; + } else if(bitdepth <= 24) { + linesize = cx * 3; + bytesperpixel = 3; + } else { + linesize = cx * 4; + bytesperpixel = 4; + } + + linesize = (linesize+3) & ~3; + + if((linebuffer = malloc(linesize)) == (UCHAR *)NULL) { + fprintf(stderr, "Error with malloc(%d)\n", linesize); + return(-1); + } + + if(!s_flag) { + printf("/* Generated by convbmp*/\n"); + printf("#include \"device.h\"\n\n"); + printf("/* MWIMAGEHDR image_%s converted from %s.bmp*/\n\n", + name, name); + } + + /* get colormap*/ + if(bitdepth <= 8) { + for(i=0; i= 0; i--) { + if(!DecodeRLE8(linebuffer, fp)) + break; + outline(linebuffer, bitdepth, linesize, i); + } + } else if(compression == BI_RLE4) { + for(i = cy-1; i>= 0; i--) { + if(!DecodeRLE4(linebuffer, fp)) + break; + outline(linebuffer, bitdepth, linesize, i); + } + } else { + for(i=0; i> 4) & 0x0f); + c1 <<= 4; + } + continue; + } + default: + c = fgetc(fp); + c1 = (c >> 4) & 0x0f; + c2 = c & 0x0f; + for(c=0; c) +{ + chop($_); + + $firstchar = substr($_, 0, 1); + + if ($firstchar ne "!") + { + ($r, $g, $b, $val) = /\s*(\d*)\s*(\d*)\s*(\d*)\s*(\w*)/; + $rgbvals{$val} = sprintf("#%2.2x%2.2x%2.2x", $r, $g, $b); + } +} + +close(RGBIN); + +# Ok then, are we in batch mode or individual mode? + +if ($ARGV[0] eq "--batch") +{ + $srcdir = $ARGV[1]; + $destdir = $ARGV[2]; + + # Batch mode, open up directory and fire + opendir(INDIR, $srcdir) || die "Directory $ARGV[1] doesn't exist"; + my @xpms = readdir(INDIR); + closedir(INDIR); + + foreach $xpmfile (@xpms) + { + if ($xpmfile =~ /\.xpm/g) + { + print "Converting $srcdir/$xpmfile to $destdir/$xpmfile...\n" + &convert_xpm("$srcdir/$xpmfile", "$destdir/$xpmfile"); + } + } +} +else +{ + # regular mode + &convert_xpm($ARGV[0], $ARGV[1]); +} + + +sub convert_xpm +{ + # Open up the file to convert it + + $filea = $_[0]; + $fileb = $_[1]; + + print"Writing from $filea to $fileb...\n"; + + open(XPMIN, $filea) || die "Could not file $filea for processing...\n"; + open(XPMOUT,">$fileb") || die "Could not open file $fileb for writing...\n"; + + $xpmline = ; + + die "$fila is Not an XPM file!\n" if (!($xpmline =~ /\/\* XPM \*\/\n/)); + + $firstchar = substr($xpmline, 0, 1); + + while($firstchar ne "\"") + { + print XPMOUT $xpmline; + $xpmline = ; + $firstchar = substr($xpmline, 0, 1); + } + + # Now we have the numbers. Grab em! + + ($width, $height, $colors, $chars) = ($xpmline =~ /\"(\d*) (\d*) (\d*) (\d*)\",\n/); + + print XPMOUT $xpmline; + + # Now read in the appropriate number of colors + + for($i = 0; $i < $colors; $i++) + { + $xpmline = ; + chop($xpmline); + + ($str, $val, $color) = ($xpmline =~ /\"(.+)\s+(\w*)\s+(.+)\"/); + + $firstchar = substr($color, 0, 1); + + if ($firstchar ne "#") + { + $color = $rgbvals{$color} if ($color ne "None"); + } + + print XPMOUT "\"$str $val $color\",\n"; + } + + while() + { + print XPMOUT $_; + } + + close(XPMIN); + close(XPMOUT); +} + + + diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/cs1.bmp b/packages/services/gfx/mw/current/src/mwin/bmp/cs1.bmp new file mode 100644 index 0000000000000000000000000000000000000000..cec4f45e030a529eac3c3071394d161ed6dc9dd7 GIT binary patch literal 3182 zc$}q{JC4>c5P-*|aD$X1q^0BpM55;^Tp^JtsOgcoN)QL&2w0+^BppTyHuJJ){0AW+ zvKwjlOY-?Op7G09ub%>6FYtbb_dC4b;~nsauIKukt|xlaRcobNuJ7%S-PoHuE8)&E zY&Vu*y|EqUM^*rqN0#CKZ2~CU1KVNB>&Q?yr+H+g+vCVc2VrES0~i?V9vJBkmvm!rx6yQk_rl73@jB`tvOMUpgUEgjI$?FtVW)LoOoyE&mb?x-O)Ptz zu%89CqwDx#J!`0@Yd33KN^#Vt8Q)2W@FIU^asWp{QMh(e`53B zS@>5L|CgnaO@DZA(sT*DzK)fV$%2ebQu1+UvTtH%6bBN5vCT6r+$B+MjN(e7f9@<& zmpQDBah!4^bBhg$=aqxo*oqBo*T{GDFCq#o2XGTAjJNZpvD>s54%t^?c9?+XtPV1qPj- z88)vI_H)qbxn$5O8+85r;&jRmuj}7x*>`83%bg49O)0>jwV z1H)KxI`?hYb#|Dpv(t2T7ByXG#dMuj(-})}KWCqCKac0GGgi9JSnWE;KGr+?=GbqZ C@l&n< diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/cs1.c b/packages/services/gfx/mw/current/src/mwin/bmp/cs1.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/bmp/cs1.c @@ -0,0 +1,178 @@ +/* Generated by convbmp*/ +#include "device.h" + +/* MWIMAGEHDR image_cs1 converted from cs1.bmp*/ + +static MWPALENTRY palette[2] = { + RGBDEF( 0, 0, 0 ), /* pal 0*/ + RGBDEF( 255, 255, 255 ), /* pal 1*/ +}; + +static MWUCHAR imagebits[] = { +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x83,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0xfe,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x03,0xf8,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x0f,0xe0,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x3f,0x80,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0xfe,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x03,0xf8,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x0f,0xe0,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0xff,0x00,0x00,0x0f,0xf7,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x03,0xfc,0x00,0x00,0x3f,0xc1,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x00,0x7f,0x00,0x7f,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x01,0xfe,0x00,0x3f,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0xff,0x00,0x00,0x07,0xf8,0x00,0x0f,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0x80,0x00,0x03,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x07,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x00,0x7f,0x80,0x00,0x07,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xf0,0x00,0x00,0xff,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xc0,0x00,0x03,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xff,0x1f,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0x00,0x00,0x0f,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xfc,0x07,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xfc,0x00,0x00,0x3f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xf0,0x03,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xf0,0x00,0x00,0x7f,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0xc0,0x01,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xc0,0x00,0x01,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xff,0x00,0x00,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0x00,0x00,0x07,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xfc,0x00,0x00,0x3f,0xff,0xff,0x80,0x00, +0xff,0xfc,0x00,0x00,0x1f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x00,0x1f,0xff,0xff,0x80,0x00, +0xff,0xf0,0x00,0x00,0x7f,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x00,0x0f,0xff,0xff,0x80,0x00, +0xff,0xc0,0x00,0x01,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xff,0x00,0x00,0x00,0x07,0xff,0xff,0x80,0x00, +0xff,0x00,0x00,0x07,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xfc,0x00,0x00,0x00,0x03,0xff,0xff,0x80,0x00, +0xf8,0x00,0x00,0x1f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xf8,0x00,0x00,0x00,0x01,0xff,0xff,0x80,0x00, +0xfe,0x00,0x00,0x7f,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0xff,0xff,0x80,0x00, +0xff,0x80,0x01,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x7f,0xff,0x80,0x00, +0xff,0xc0,0x07,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xfe,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00, +0xff,0xf0,0x1f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xf8,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x00, +0xff,0xf8,0x7f,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0x80,0x00, +0xff,0xfd,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0x80,0x00, +0xff,0xff,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0x80,0x00, +0xff,0xff,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0x80,0x00, +0xff,0xff,0xe0,0x00,0x07,0xf8,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x00, +0xff,0xff,0xf8,0x00,0x1f,0xe0,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x00, +0xff,0xf9,0xfe,0x00,0x7f,0xc0,0x00,0x03,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x80,0x00, +0xff,0xf0,0xff,0x01,0xff,0x00,0x00,0x0f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x80,0x00, +0xff,0xe0,0x3f,0xe3,0xfc,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x80,0x00, +0xff,0xe0,0x0f,0xcf,0xf0,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x80,0x00, +0xff,0xc0,0x07,0xff,0xc0,0x00,0x01,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x80,0x00, +0xff,0x80,0x01,0xfe,0x00,0x00,0x07,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x80,0x00, +0xff,0x00,0x00,0xff,0x00,0x00,0x1f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x80,0x00, +0xff,0x00,0x00,0x3f,0xc0,0x00,0x7f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x80,0x00, +0xfe,0x00,0x00,0x1f,0xe0,0x01,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x80,0x00, +0xfe,0x00,0x00,0x07,0xf8,0x07,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x80,0x00, +0xfc,0x00,0x00,0x01,0xfe,0x1f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00, +0xf8,0x00,0x00,0x00,0xfe,0x7f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00, +0xf8,0x00,0x00,0x00,0x3f,0xff,0x00,0x00,0x1f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00, +0xf8,0x00,0x00,0x00,0x1f,0xfc,0x00,0x00,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00, +0xf0,0x00,0x00,0x00,0x07,0xf8,0x00,0x03,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00, +0xf0,0x00,0x00,0x00,0x03,0xfe,0x00,0x0f,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00, +0xe0,0x00,0x00,0x00,0x00,0xff,0x00,0x1f,0xff,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0xe0,0x00,0x00,0x00,0x00,0x7f,0xc0,0x3f,0xff,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0xe0,0x00,0x00,0x00,0x00,0x1f,0xf0,0x7f,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0xc0,0x00,0x00,0x00,0x00,0x0f,0xf8,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0xc0,0x00,0x00,0x00,0x00,0x03,0xfc,0xff,0xff,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0xc0,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0xc0,0x00,0x00,0x00,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0x80,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0x80,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, +0x80,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, +0x80,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, +0x80,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x03,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x3f,0xe0,0x00,0x00,0x00,0x00,0x07,0x80,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xff,0xff,0xfe,0x1f,0xf8,0x00,0x00,0x00,0x00,0x07,0x80,0x00, +0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xff,0xfc,0x07,0xfc,0x00,0x00,0x00,0x00,0x07,0x80,0x00, +0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xf8,0x01,0xff,0x00,0x00,0x00,0x00,0x0f,0x80,0x00, +0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xf0,0x00,0x7f,0xc0,0x00,0x00,0x00,0x0f,0x80,0x00, +0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xe0,0x00,0x3f,0xe0,0x00,0x00,0x00,0x0f,0x80,0x00, +0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x80,0x00,0x3f,0xf8,0x00,0x00,0x00,0x1f,0x80,0x00, +0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfc,0x00,0x00,0x7f,0xfc,0x00,0x00,0x00,0x1f,0x80,0x00, +0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xfe,0x00,0x00,0x00,0x1f,0x80,0x00, +0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0xff,0x80,0x00,0x00,0x3f,0x80,0x00, +0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xf8,0x7f,0xc0,0x00,0x00,0x7f,0x80,0x00, +0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xe0,0x1f,0xf0,0x00,0x00,0x7f,0x80,0x00, +0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x0f,0xf8,0x00,0x00,0xff,0x80,0x00, +0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0x00,0x03,0xfe,0x00,0x00,0xff,0x80,0x00, +0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xf8,0x00,0x00,0xff,0x80,0x01,0xff,0x80,0x00, +0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xe0,0x00,0x01,0xff,0xc0,0x03,0xff,0x80,0x00, +0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x00,0x03,0xff,0xf0,0x03,0xff,0x80,0x00, +0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0x00,0x00,0x0f,0xff,0xf8,0x07,0xff,0x80,0x00, +0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xf8,0x00,0x00,0x3f,0xc3,0xfe,0x0f,0xff,0x80,0x00, +0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xe0,0x00,0x00,0xff,0x01,0xff,0x1f,0xff,0x80,0x00, +0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x00,0x03,0xfc,0x00,0x7f,0x9f,0xff,0x80,0x00, +0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x1f,0xff,0xff,0x80,0x00, +0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x0f,0xff,0xff,0x80,0x00, +0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xe0,0x00,0x00,0xff,0x00,0x00,0x07,0xff,0xff,0x80,0x00, +0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x80,0x00,0x03,0xfc,0x00,0x00,0x1f,0xff,0xff,0x80,0x00, +0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x03,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x00,0x7f,0xff,0xff,0x80,0x00, +0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x0f,0xfc,0x00,0x00,0x3f,0xc0,0x00,0x01,0xfe,0x3f,0xff,0x80,0x00, +0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x3f,0xf0,0x00,0x00,0xff,0x00,0x00,0x07,0xf8,0x0f,0xff,0x80,0x00, +0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0xff,0xc0,0x00,0x03,0xfe,0x00,0x00,0x1f,0xe0,0x03,0xff,0x80,0x00, +0xff,0xfe,0x00,0x00,0x00,0x00,0x03,0xff,0x00,0x00,0x07,0xf8,0x00,0x00,0x7f,0x80,0x01,0xff,0x80,0x00, +0xff,0xff,0x00,0x00,0x00,0x00,0x0f,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x01,0xfe,0x00,0x00,0x7f,0x80,0x00, +0xff,0xff,0x80,0x00,0x00,0x00,0x3f,0xf0,0x00,0x00,0x7f,0x80,0x00,0x07,0xf8,0x00,0x00,0x7f,0x80,0x00, +0xff,0xff,0xe0,0x00,0x00,0x00,0xff,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xe0,0x00,0x00,0xff,0x80,0x00, +0xff,0xff,0xe0,0x00,0x00,0x03,0xff,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0x80,0x00,0x03,0xff,0x80,0x00, +0xff,0xff,0xf0,0x00,0x00,0x0f,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xfe,0x00,0x00,0x0f,0xff,0x80,0x00, +0xff,0xff,0xfc,0x00,0x00,0x3f,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xf8,0x00,0x00,0x3f,0xff,0x80,0x00, +0xff,0xff,0xfe,0x00,0x00,0xff,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xe0,0x00,0x00,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0x00,0x03,0xff,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0x80,0x00,0x03,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0x80,0x0f,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xfe,0x00,0x00,0x0f,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xc0,0x3f,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xf8,0x00,0x00,0x3f,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xf0,0x7f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xe0,0x00,0x00,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xf9,0xff,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0x80,0x00,0x03,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xfe,0x00,0x00,0x0f,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xf8,0x00,0x00,0x3f,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0x80,0x00,0x01,0xfe,0x00,0x00,0x0f,0xe0,0x00,0x00,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xc0,0x00,0x07,0xf8,0x00,0x00,0x3f,0x80,0x00,0x03,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xf0,0x00,0x1f,0xe0,0x00,0x00,0xff,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xfc,0x00,0x7f,0x80,0x00,0x03,0xfc,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xfe,0x01,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0x87,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xdf,0xe0,0x00,0x00,0xff,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x03,0xfc,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x0f,0xf0,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x3f,0xc0,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0xff,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x03,0xfc,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x0f,0xf0,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x3f,0xc0,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00, +}; + +MWIMAGEHDR image_cs1 = { + 145, 156, /* width, height*/ + 1, 1, /* planes, bpp*/ + 20, 1, /* pitch, bytesperpixel*/ + 1, 2, /* compression, palsize*/ + -1L, /* transcolor*/ + palette, + imagebits, +}; diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/earth.jpg b/packages/services/gfx/mw/current/src/mwin/bmp/earth.jpg new file mode 100644 index 0000000000000000000000000000000000000000..73c9c18e8068436bee07eb80faf61f5b0584ae60 GIT binary patch literal 40661 zc$}2FWn3K5vo<)mI|D(31PJc#oXAxI!NoBw_H z?%sWOzwGnvboH;g`&4z+Q&s2n=j$c_UrFJk0s!G3*bvwNfY()kEC3%18y6cB9~TFg zkN}_P&3p1UBqVRR=^3cri|~qz3G)gGN_{X=m6Fqy7Zg%=($F=vu(7p~P=WZkT6r6R zZ7lzz1c88%@D1<{CpkH%rHqh_<^ONI_5ldc5rz@qNC?WCj0I6VgWPAUKC2Z7#oC^$0GfJ~Iaoiz#9~13>lSJ)-*m zt%qFonDk}`S4r7$S)~0)NWHnH`tzcw5>@KW;r251TFlq>_*)WF0%L3cBJcIo`e>tj zhsYglFMz&E3sS+yt}AHr;b zh~`}*nJ_Wsaa5;|J6`Jr0u#lhOdfFeD)9#II`r(&4fecmEfO@k&ZZKkORM!$PScGK zR{B3*Gv?%X>g7k3y{CtYtj4OW$)s3zrO-2(JuHXT0yrrgu44>VX~EurlA*+|TG=g( zzAxJmEeI;oN-jF-!XijZHz&27Z=zK*&V5t8pllGs?lex{XZyc40;zktA!EMHnUr!xoOFd#~$8HO3FYvjq;!8bi&8VS!mZ;wOg_J zNk((l*8P8LaPX|8=;s<_WdlK0j-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{$pnexn3{vDr{dzFs9n@wrnc?6D3%ysD&sm+EIyup5cQE&^S1Y<`|Yv zlCvn$-^3NC^tP2uF zyO;i3lWP+swZIr(nPFnjC%iI=kZ5(|8ecrYE^LJb{h_LGK9B+>)H+ktENH!7QHd*u zGcIZBIn^?{jlE60Muua`v((_%G3?nWS5P?17+qzQt@9c}eH=v)q~Yb26nF?$P3m0x zdLvrkID^S#^Tg)v-}CE4bF%j+NSi*~rf8WvPhr1sGX{~eXg0k=c#I%)}R?5lm((OG;f)e0acfoTAo=mxat7%yiADijYn_) z0FGR4!{KgYkL5CDQE7V*v`O@r`=LU+IJ9Z8eLIA0H<;yP#1$T(W1`F8%t#9?+HM8% z3*l2Z-&Ga`3fMCI6swCdi`&dsWd8v2?BJ|t^r`o(Br<`1VxK;97TI~oia)|+x|h)x R%ZG`FS?(sv`~Ltd|Jk2W%R~SG diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/layout b/packages/services/gfx/mw/current/src/mwin/bmp/layout new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/bmp/layout @@ -0,0 +1,21 @@ +0000000 4d42 00e6 0000 0000 0000 0076 0000 0028 + [BM] [fbSize ] [r1] [r2] [bfOffbi] [biS +0000020 0000 0010 0000 000e 0000 0001 0004 0000 + ize] [biWidth] [Biheigh] plan bpp comp +0000040 0000 0070 0000 0000 0000 0000 0000 0010 + ress imagesize xpelsperm ypelsperm colo +0000060 0000 0010 0000 0000 0000 0000 00bf bf00 + ruse clrimport +0000100 0000 bf00 00bf 00bf 0000 00bf 00bf bfbf +0000120 0000 c0c0 00c0 8080 0080 0000 00ff ff00 +0000140 0000 ff00 00ff 00ff 0000 00ff 00ff ffff +0000160 0000 ffff 00ff 0000 0000 0000 0000 88f8 + bitmap-> +0000200 8888 8888 8088 77f7 7777 7777 8077 70f7 +0000220 0000 0000 8077 70f7 7777 7077 8077 70f7 +0000240 7777 7077 8077 70f7 7777 7077 8077 70f7 +* +0000300 7777 7077 8077 70f7 0000 0000 8077 70f7 +0000320 0000 0000 8077 77f7 7777 7777 8077 ffff +0000340 ffff ffff f0ff +0000346 diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/makebmp.c b/packages/services/gfx/mw/current/src/mwin/bmp/makebmp.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/bmp/makebmp.c @@ -0,0 +1,136 @@ +/* + * Copyright (c) 1999 Greg Haerr + * + * Framebuffer data to .bmp file converter + * + * 10/4/1999 g haerr + */ +#include +#include + +#define BI_RGB 0L +#define BI_RLE8 1L +#define BI_RLE4 2L +#define BI_BITFIELDS 3L + +typedef unsigned char BYTE; +typedef unsigned short WORD; +typedef unsigned long DWORD; +typedef long LONG; + +#pragma pack(1) +/* windows style*/ +typedef struct { + /* BITMAPFILEHEADER*/ + BYTE bfType[2]; + DWORD bfSize; + WORD bfReserved1; + WORD bfReserved2; + DWORD bfOffBits; + /* BITMAPINFOHEADER*/ + DWORD BiSize; + LONG BiWidth; + LONG BiHeight; + WORD BiPlanes; + WORD BiBitCount; + DWORD BiCompression; + DWORD BiSizeImage; + LONG BiXpelsPerMeter; + LONG BiYpelsPerMeter; + DWORD BiClrUsed; + DWORD BiClrImportant; +} BMPHEAD; +#pragma pack() + +int MakeBMP(FILE *ifp,FILE *ofp); + +int +main(int ac,char **av) +{ + FILE *ifp; + FILE *ofp; + + if(ac < 3) { + fprintf(stderr, "Usage: makebmp \n"); + exit(1); + } + ifp = fopen(av[1], "rb"); + if(!ifp) { + fprintf(stderr, "Can't open file: %s\n", av[1]); + exit(1); + } + ofp = fopen(av[2], "wb"); + if(!ofp) { + fprintf(stderr, "Can't create file: %s\n", av[2]); + exit(1); + } + if(!MakeBMP(ifp, ofp)) { + fprintf(stderr, "Conversion failed: %s\n", av[2]); + fclose(ofp); + unlink(av[2]); + exit(1); + } + fclose(ifp); + fclose(ofp); + return 0; +} + +/* create a bmp file*/ +int +MakeBMP(FILE *ifp, FILE *ofp) +{ + BMPHEAD bmp; + int i, j; + int cx, cy, extra, bitdepth, ncolors; + + cx = 640; + cy = 480; + extra = (cx + 3) & 3; + bitdepth = 8; + if(bitdepth <= 8) + ncolors = 1<0; --i) { + long base = sizeof(bmp) + ncolors*4 + (long)i*cx; + fseek(ofp, base, SEEK_SET); + for(j=0; j-^KSQe9W$UTtUmfWI&EV}k# zp#!-Yl4Fj!Zf>LN8YKFZ!-8~{U>NQ9y(;z3xYeEn9DA__OI`J<-g{rYzp5VBeDSNV ze=hp-2Rx7QJi90Idp!5VNQAx(1ek5kbv z%qs4q&gK#it3ga34QVc}ANpa{qrZ}e{k69FZ={)iFumAo%tG(HAHLm;n?d3*%U+>j zS8{T-y5is!7&$P+D{v<&7L@1;bK`>AS5cqjlB#xKioP+2QRm4(%u$g5?LP$9X}`2EHK$5aBRcbon(j z6x4;;9T@TW^A_Z+EjrVwrrTcL!4|wsji&44 zklj0x=z#7TH9_pY{o-EnF%wa)hFw2SqqLeS9;w;-`dn8{BO+l&luJK;IYy?pYd09R z6q2Fek3{DG5*6aAqYS{!i=Gw424sn1|3>bP%z7*v>+R+7a~2HmcG?iFf$tTIRKCq% z%zOYc@+hS5u!||>ya`(+I~EPG_P`e~dJvNGo%#n~c&l*2(pSa{UoJ5jRC=YVH4}1GeovAZ*rq0xvI#XxrOr5F! zFY0gbuK7EcxNZ27q-xrx#so1G+avP8|D-8hRZ0aJ4L(Y8mQH~CysV_HK+3AJos?3eeSt|e z#b74cGpr_URS@J@3^>e6011*0NqSL5rE%agCBCW2{fxq@S}39+C3PEV+1;dNVjDlx zl#m?NwAyWXItsLryh)0eq}6{$IcwLf>k8q~lr+akkE6Po9%EsvdCzlbbTyxb z6(0BZSBM~8Vf!iL7ZI)VC;j3 zr7X~5_ZfOg6``h*ib}hAM~r}kCAUGmc%Bqd6zhXp4gSXmG(JKsSRbto zg8;R~`#M=`osG5XMr)%yrxk0iuR0d>H5#8xD+Y>3E3CUwn{48kvE?AFl}88kKVdvE z{_x((86%A2l9GJS`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w8(MJE7V>OFqXOjv(VRdhjtp2e zX0Wm^pC>F5cAgm)C+RFY?jsRL%e&G)3<-ClvKiM)yBxt1vL$i%&~VSH+dG~b5yb&N zy%_k8;kgKY$HPsUS!cQB@AuOjMb^$EM{887$=XKVqv z*?F599L(7sN2APSzDsfDL0Ge*0$-)Qb~Wj@2myX$rXlNH%l*J>eTo5`-dMFX zZm2$Y>#)o8M0FHVhFDm+(Z8BwI7QLOPR28a!*)k6nR3+aLM`M@NJLyoV{{ke$)#bm z>N%Bd)ucuwo(9Hlj^P0g&F3bZqRLE9ZhGe8sm#Jor?XW~NLa=7oQ2uK323qb+uZ9c z%}Dx577o79wm+k=Pb0z-&IlBrOxdNUE1j)=Hd^@Shvb24lK*(;4gCVC`)>IR@(h6g zN1oPC_5Ja*>zh(f(OLW6cSt(QX>`~ACB5mw%o6rhoHjV-+sB|a2lTwJV@|ZV=n2Qk zrPg-*$D?9&$f?(4WLljE54HO=y%@dcf=9K=U#cgwGS>Rcvx)%CAq}6Z_kN}pz)4Vk z@z&3t3w5D>pQ-@-X3y#pEK4QRkY4>({Z`!xZHGnb2lB| z{(Zt^M7@nYgDRKHD&Qz)m9V&ji3M&LG4+b5pKcTON?rGPA8r%6Jgh*%J;Hc)hjF>- lxKMxS)adoCf9k(Q<6kX(wWGbsznr@Dmp=N2-_y7Puu~EbT diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/min4.c b/packages/services/gfx/mw/current/src/mwin/bmp/min4.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/bmp/min4.c @@ -0,0 +1,50 @@ +/* Generated by convbmp*/ +#include "device.h" + +/* MWIMAGEHDR image_min4 converted from min4.bmp*/ + +static MWPALENTRY palette[16] = { + RGBDEF( 0, 0, 0 ), /* pal 0*/ + RGBDEF( 191, 0, 0 ), /* pal 1*/ + RGBDEF( 0, 191, 0 ), /* pal 2*/ + RGBDEF( 191, 191, 0 ), /* pal 3*/ + RGBDEF( 0, 0, 191 ), /* pal 4*/ + RGBDEF( 191, 0, 191 ), /* pal 5*/ + RGBDEF( 0, 191, 191 ), /* pal 6*/ + RGBDEF( 192, 192, 192 ), /* pal 7*/ + RGBDEF( 128, 128, 128 ), /* pal 8*/ + RGBDEF( 255, 0, 0 ), /* pal 9*/ + RGBDEF( 0, 255, 0 ), /* pal 10*/ + RGBDEF( 255, 255, 0 ), /* pal 11*/ + RGBDEF( 0, 0, 255 ), /* pal 12*/ + RGBDEF( 255, 0, 255 ), /* pal 13*/ + RGBDEF( 0, 255, 255 ), /* pal 14*/ + RGBDEF( 255, 255, 255 ), /* pal 15*/ +}; + +static MWUCHAR imagebits[] = { +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xf8,0x88,0x88,0x88,0x88,0x88,0x88,0x80, +0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80, +0xf7,0x77,0x00,0x00,0x00,0x77,0x77,0x80, +0xf7,0x77,0x00,0x00,0x00,0x77,0x77,0x80, +0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80, +0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80, +0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80, +0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80, +0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80, +0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80, +0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80, +0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0, +}; + +MWIMAGEHDR image_min4 = { + 16, 14, /* width, height*/ + 1, 4, /* planes, bpp*/ + 8, 1, /* pitch, bytesperpixel*/ + 1, 16, /* compression, palsize*/ + -1L, /* transcolor*/ + palette, + imagebits, +}; diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/penguin.bmp b/packages/services/gfx/mw/current/src/mwin/bmp/penguin.bmp new file mode 100644 index 0000000000000000000000000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?r(eazd1T2ntC2H|>-2DBwA45zLzIuBWdq2&^gsA{B zP4a%)OvxSq_d_#jZ+xti?r_ME@b*J$wu(x-Nip`{IJH@s((IS4U@bZ#)G#ba_$%|1o&D@Vha!p_|jw1CQ@n!l|k1+3#$I(@? zo*E#EFc}_W4nBqpCe=M|?dzZDN6~l$_~L?oL=q4ynERElGu{t=q8&xiX`(%onyONO zh%QgSJG3f(do3?NRQXid(4|MGr>FSh>Eq=7@UyF7nwqHkZUJBT+-d0||GnYE0Gh5X zT-PBEc6aM0A8iV74YSm){|B~p{Qgb&*Wueue=7;NXZ*bWY-oTF+gkT31h^4jTX4yF zJIj7e@l{>#YHDSd!~ZjWZ@<^o*VpBCo3%9gwwnU_%LM@b(b3ahPv=GQblIzI{2K@W zK2k6Qc&sJ&g@2;}+AfBrqrDvde(?KC_1Ah&Pmd0}>#D@(!`oW>V#$GTNffTDP4+cfZjR> m*(CUeL{tj8Ru_NznfB=g+1f}b@zWXuSts-QR!94-1^5j}V5C|A diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/penguin.c b/packages/services/gfx/mw/current/src/mwin/bmp/penguin.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/bmp/penguin.c @@ -0,0 +1,427 @@ +/* Generated by convbmp*/ +#include "device.h" + +/* MWIMAGEHDR image_penguin converted from penguin.bmp*/ + +static MWPALENTRY palette[256] = { + RGBDEF( 0, 0, 0 ), /* pal 0*/ + RGBDEF( 8, 0, 0 ), /* pal 1*/ + RGBDEF( 8, 8, 0 ), /* pal 2*/ + RGBDEF( 8, 8, 8 ), /* pal 3*/ + RGBDEF( 18, 10, 0 ), /* pal 4*/ + RGBDEF( 33, 0, 0 ), /* pal 5*/ + RGBDEF( 16, 16, 16 ), /* pal 6*/ + RGBDEF( 24, 24, 24 ), /* pal 7*/ + RGBDEF( 39, 27, 4 ), /* pal 8*/ + RGBDEF( 63, 41, 2 ), /* pal 9*/ + RGBDEF( 66, 49, 0 ), /* pal 10*/ + RGBDEF( 74, 41, 0 ), /* pal 11*/ + RGBDEF( 74, 49, 0 ), /* pal 12*/ + RGBDEF( 78, 52, 3 ), /* pal 13*/ + RGBDEF( 90, 60, 2 ), /* pal 14*/ + RGBDEF( 99, 70, 4 ), /* pal 15*/ + RGBDEF( 33, 33, 33 ), /* pal 16*/ + RGBDEF( 41, 41, 41 ), /* pal 17*/ + RGBDEF( 41, 41, 66 ), /* pal 18*/ + RGBDEF( 49, 49, 49 ), /* pal 19*/ + RGBDEF( 63, 63, 60 ), /* pal 20*/ + RGBDEF( 82, 57, 41 ), /* pal 21*/ + RGBDEF( 74, 74, 66 ), /* pal 22*/ + RGBDEF( 74, 74, 74 ), /* pal 23*/ + RGBDEF( 74, 74, 82 ), /* pal 24*/ + RGBDEF( 82, 82, 82 ), /* pal 25*/ + RGBDEF( 90, 90, 90 ), /* pal 26*/ + RGBDEF( 99, 99, 90 ), /* pal 27*/ + RGBDEF( 90, 90, 99 ), /* pal 28*/ + RGBDEF( 99, 99, 99 ), /* pal 29*/ + RGBDEF( 99, 99, 107 ), /* pal 30*/ + RGBDEF( 0, 0, 255 ), /* pal 31*/ + RGBDEF( 141, 96, 1 ), /* pal 32*/ + RGBDEF( 158, 111, 24 ), /* pal 33*/ + RGBDEF( 196, 135, 9 ), /* pal 34*/ + RGBDEF( 211, 154, 5 ), /* pal 35*/ + RGBDEF( 226, 165, 4 ), /* pal 36*/ + RGBDEF( 229, 177, 1 ), /* pal 37*/ + RGBDEF( 237, 179, 8 ), /* pal 38*/ + RGBDEF( 237, 174, 16 ), /* pal 39*/ + RGBDEF( 233, 195, 8 ), /* pal 40*/ + RGBDEF( 247, 193, 12 ), /* pal 41*/ + RGBDEF( 243, 207, 10 ), /* pal 42*/ + RGBDEF( 255, 214, 8 ), /* pal 43*/ + RGBDEF( 255, 189, 16 ), /* pal 44*/ + RGBDEF( 247, 218, 16 ), /* pal 45*/ + RGBDEF( 247, 212, 24 ), /* pal 46*/ + RGBDEF( 249, 216, 47 ), /* pal 47*/ + RGBDEF( 117, 117, 120 ), /* pal 48*/ + RGBDEF( 142, 139, 139 ), /* pal 49*/ + RGBDEF( 181, 164, 145 ), /* pal 50*/ + RGBDEF( 173, 173, 177 ), /* pal 51*/ + RGBDEF( 189, 189, 189 ), /* pal 52*/ + RGBDEF( 202, 202, 202 ), /* pal 53*/ + RGBDEF( 198, 198, 231 ), /* pal 54*/ + RGBDEF( 218, 218, 218 ), /* pal 55*/ + RGBDEF( 231, 214, 140 ), /* pal 56*/ + RGBDEF( 231, 231, 222 ), /* pal 57*/ + RGBDEF( 222, 222, 239 ), /* pal 58*/ + RGBDEF( 239, 236, 236 ), /* pal 59*/ + RGBDEF( 247, 247, 239 ), /* pal 60*/ + RGBDEF( 239, 239, 247 ), /* pal 61*/ + RGBDEF( 247, 247, 247 ), /* pal 62*/ + RGBDEF( 255, 255, 255 ), /* pal 63*/ + RGBDEF( 0, 0, 0 ), /* pal 64*/ + RGBDEF( 191, 0, 0 ), /* pal 65*/ + RGBDEF( 0, 191, 0 ), /* pal 66*/ + RGBDEF( 191, 191, 0 ), /* pal 67*/ + RGBDEF( 0, 0, 191 ), /* pal 68*/ + RGBDEF( 191, 0, 191 ), /* pal 69*/ + RGBDEF( 0, 191, 191 ), /* pal 70*/ + RGBDEF( 192, 192, 192 ), /* pal 71*/ + RGBDEF( 128, 128, 128 ), /* pal 72*/ + RGBDEF( 255, 0, 0 ), /* pal 73*/ + RGBDEF( 0, 255, 0 ), /* pal 74*/ + RGBDEF( 255, 255, 0 ), /* pal 75*/ + RGBDEF( 0, 0, 255 ), /* pal 76*/ + RGBDEF( 255, 0, 255 ), /* pal 77*/ + RGBDEF( 0, 255, 255 ), /* pal 78*/ + RGBDEF( 255, 255, 255 ), /* pal 79*/ + RGBDEF( 0, 0, 0 ), /* pal 80*/ + RGBDEF( 0, 0, 0 ), /* pal 81*/ + RGBDEF( 0, 0, 0 ), /* pal 82*/ + RGBDEF( 0, 0, 0 ), /* pal 83*/ + RGBDEF( 0, 0, 0 ), /* pal 84*/ + RGBDEF( 0, 0, 0 ), /* pal 85*/ + RGBDEF( 0, 0, 0 ), /* pal 86*/ + RGBDEF( 0, 0, 0 ), /* pal 87*/ + RGBDEF( 0, 0, 0 ), /* pal 88*/ + RGBDEF( 0, 0, 0 ), /* pal 89*/ + RGBDEF( 0, 0, 0 ), /* pal 90*/ + RGBDEF( 0, 0, 0 ), /* pal 91*/ + RGBDEF( 0, 0, 0 ), /* pal 92*/ + RGBDEF( 0, 0, 0 ), /* pal 93*/ + RGBDEF( 0, 0, 0 ), /* pal 94*/ + RGBDEF( 0, 0, 0 ), /* pal 95*/ + RGBDEF( 0, 0, 0 ), /* pal 96*/ + RGBDEF( 0, 0, 0 ), /* pal 97*/ + RGBDEF( 0, 0, 0 ), /* pal 98*/ + RGBDEF( 0, 0, 0 ), /* pal 99*/ + RGBDEF( 0, 0, 0 ), /* pal 100*/ + RGBDEF( 0, 0, 0 ), /* pal 101*/ + RGBDEF( 0, 0, 0 ), /* pal 102*/ + RGBDEF( 0, 0, 0 ), /* pal 103*/ + RGBDEF( 0, 0, 0 ), /* pal 104*/ + RGBDEF( 0, 0, 0 ), /* pal 105*/ + RGBDEF( 0, 0, 0 ), /* pal 106*/ + RGBDEF( 0, 0, 0 ), /* pal 107*/ + RGBDEF( 0, 0, 0 ), /* pal 108*/ + RGBDEF( 0, 0, 0 ), /* pal 109*/ + RGBDEF( 0, 0, 0 ), /* pal 110*/ + RGBDEF( 0, 0, 0 ), /* pal 111*/ + RGBDEF( 0, 0, 0 ), /* pal 112*/ + RGBDEF( 0, 0, 0 ), /* pal 113*/ + RGBDEF( 0, 0, 0 ), /* pal 114*/ + RGBDEF( 0, 0, 0 ), /* pal 115*/ + RGBDEF( 0, 0, 0 ), /* pal 116*/ + RGBDEF( 0, 0, 0 ), /* pal 117*/ + RGBDEF( 0, 0, 0 ), /* pal 118*/ + RGBDEF( 0, 0, 0 ), /* pal 119*/ + RGBDEF( 0, 0, 0 ), /* pal 120*/ + RGBDEF( 0, 0, 0 ), /* pal 121*/ + RGBDEF( 0, 0, 0 ), /* pal 122*/ + RGBDEF( 0, 0, 0 ), /* pal 123*/ + RGBDEF( 0, 0, 0 ), /* pal 124*/ + RGBDEF( 0, 0, 0 ), /* pal 125*/ + RGBDEF( 0, 0, 0 ), /* pal 126*/ + RGBDEF( 0, 0, 0 ), /* pal 127*/ + RGBDEF( 0, 0, 0 ), /* pal 128*/ + RGBDEF( 0, 0, 0 ), /* pal 129*/ + RGBDEF( 0, 0, 0 ), /* pal 130*/ + RGBDEF( 0, 0, 0 ), /* pal 131*/ + RGBDEF( 0, 0, 0 ), /* pal 132*/ + RGBDEF( 0, 0, 0 ), /* pal 133*/ + RGBDEF( 0, 0, 0 ), /* pal 134*/ + RGBDEF( 0, 0, 0 ), /* pal 135*/ + RGBDEF( 0, 0, 0 ), /* pal 136*/ + RGBDEF( 0, 0, 0 ), /* pal 137*/ + RGBDEF( 0, 0, 0 ), /* pal 138*/ + RGBDEF( 0, 0, 0 ), /* pal 139*/ + RGBDEF( 0, 0, 0 ), /* pal 140*/ + RGBDEF( 0, 0, 0 ), /* pal 141*/ + RGBDEF( 0, 0, 0 ), /* pal 142*/ + RGBDEF( 0, 0, 0 ), /* pal 143*/ + RGBDEF( 0, 0, 0 ), /* pal 144*/ + RGBDEF( 0, 0, 0 ), /* pal 145*/ + RGBDEF( 0, 0, 0 ), /* pal 146*/ + RGBDEF( 0, 0, 0 ), /* pal 147*/ + RGBDEF( 0, 0, 0 ), /* pal 148*/ + RGBDEF( 0, 0, 0 ), /* pal 149*/ + RGBDEF( 0, 0, 0 ), /* pal 150*/ + RGBDEF( 0, 0, 0 ), /* pal 151*/ + RGBDEF( 0, 0, 0 ), /* pal 152*/ + RGBDEF( 0, 0, 0 ), /* pal 153*/ + RGBDEF( 0, 0, 0 ), /* pal 154*/ + RGBDEF( 0, 0, 0 ), /* pal 155*/ + RGBDEF( 0, 0, 0 ), /* pal 156*/ + RGBDEF( 0, 0, 0 ), /* pal 157*/ + RGBDEF( 0, 0, 0 ), /* pal 158*/ + RGBDEF( 0, 0, 0 ), /* pal 159*/ + RGBDEF( 0, 0, 0 ), /* pal 160*/ + RGBDEF( 0, 0, 0 ), /* pal 161*/ + RGBDEF( 0, 0, 0 ), /* pal 162*/ + RGBDEF( 0, 0, 0 ), /* pal 163*/ + RGBDEF( 0, 0, 0 ), /* pal 164*/ + RGBDEF( 0, 0, 0 ), /* pal 165*/ + RGBDEF( 0, 0, 0 ), /* pal 166*/ + RGBDEF( 0, 0, 0 ), /* pal 167*/ + RGBDEF( 0, 0, 0 ), /* pal 168*/ + RGBDEF( 0, 0, 0 ), /* pal 169*/ + RGBDEF( 0, 0, 0 ), /* pal 170*/ + RGBDEF( 0, 0, 0 ), /* pal 171*/ + RGBDEF( 0, 0, 0 ), /* pal 172*/ + RGBDEF( 0, 0, 0 ), /* pal 173*/ + RGBDEF( 0, 0, 0 ), /* pal 174*/ + RGBDEF( 0, 0, 0 ), /* pal 175*/ + RGBDEF( 0, 0, 0 ), /* pal 176*/ + RGBDEF( 0, 0, 0 ), /* pal 177*/ + RGBDEF( 0, 0, 0 ), /* pal 178*/ + RGBDEF( 0, 0, 0 ), /* pal 179*/ + RGBDEF( 0, 0, 0 ), /* pal 180*/ + RGBDEF( 0, 0, 0 ), /* pal 181*/ + RGBDEF( 0, 0, 0 ), /* pal 182*/ + RGBDEF( 0, 0, 0 ), /* pal 183*/ + RGBDEF( 0, 0, 0 ), /* pal 184*/ + RGBDEF( 0, 0, 0 ), /* pal 185*/ + RGBDEF( 0, 0, 0 ), /* pal 186*/ + RGBDEF( 0, 0, 0 ), /* pal 187*/ + RGBDEF( 0, 0, 0 ), /* pal 188*/ + RGBDEF( 0, 0, 0 ), /* pal 189*/ + RGBDEF( 0, 0, 0 ), /* pal 190*/ + RGBDEF( 0, 0, 0 ), /* pal 191*/ + RGBDEF( 0, 0, 0 ), /* pal 192*/ + RGBDEF( 0, 0, 0 ), /* pal 193*/ + RGBDEF( 0, 0, 0 ), /* pal 194*/ + RGBDEF( 0, 0, 0 ), /* pal 195*/ + RGBDEF( 0, 0, 0 ), /* pal 196*/ + RGBDEF( 0, 0, 0 ), /* pal 197*/ + RGBDEF( 0, 0, 0 ), /* pal 198*/ + RGBDEF( 0, 0, 0 ), /* pal 199*/ + RGBDEF( 0, 0, 0 ), /* pal 200*/ + RGBDEF( 0, 0, 0 ), /* pal 201*/ + RGBDEF( 0, 0, 0 ), /* pal 202*/ + RGBDEF( 0, 0, 0 ), /* pal 203*/ + RGBDEF( 0, 0, 0 ), /* pal 204*/ + RGBDEF( 0, 0, 0 ), /* pal 205*/ + RGBDEF( 0, 0, 0 ), /* pal 206*/ + RGBDEF( 0, 0, 0 ), /* pal 207*/ + RGBDEF( 0, 0, 0 ), /* pal 208*/ + RGBDEF( 0, 0, 0 ), /* pal 209*/ + RGBDEF( 0, 0, 0 ), /* pal 210*/ + RGBDEF( 0, 0, 0 ), /* pal 211*/ + RGBDEF( 0, 0, 0 ), /* pal 212*/ + RGBDEF( 0, 0, 0 ), /* pal 213*/ + RGBDEF( 0, 0, 0 ), /* pal 214*/ + RGBDEF( 0, 0, 0 ), /* pal 215*/ + RGBDEF( 0, 0, 0 ), /* pal 216*/ + RGBDEF( 0, 0, 0 ), /* pal 217*/ + RGBDEF( 0, 0, 0 ), /* pal 218*/ + RGBDEF( 0, 0, 0 ), /* pal 219*/ + RGBDEF( 0, 0, 0 ), /* pal 220*/ + RGBDEF( 0, 0, 0 ), /* pal 221*/ + RGBDEF( 0, 0, 0 ), /* pal 222*/ + RGBDEF( 0, 0, 0 ), /* pal 223*/ + RGBDEF( 0, 0, 0 ), /* pal 224*/ + RGBDEF( 0, 0, 0 ), /* pal 225*/ + RGBDEF( 0, 0, 0 ), /* pal 226*/ + RGBDEF( 0, 0, 0 ), /* pal 227*/ + RGBDEF( 0, 0, 0 ), /* pal 228*/ + RGBDEF( 0, 0, 0 ), /* pal 229*/ + RGBDEF( 0, 0, 0 ), /* pal 230*/ + RGBDEF( 0, 0, 0 ), /* pal 231*/ + RGBDEF( 0, 0, 0 ), /* pal 232*/ + RGBDEF( 0, 0, 0 ), /* pal 233*/ + RGBDEF( 0, 0, 0 ), /* pal 234*/ + RGBDEF( 0, 0, 0 ), /* pal 235*/ + RGBDEF( 0, 0, 0 ), /* pal 236*/ + RGBDEF( 0, 0, 0 ), /* pal 237*/ + RGBDEF( 0, 0, 0 ), /* pal 238*/ + RGBDEF( 0, 0, 0 ), /* pal 239*/ + RGBDEF( 0, 0, 0 ), /* pal 240*/ + RGBDEF( 0, 0, 0 ), /* pal 241*/ + RGBDEF( 0, 0, 0 ), /* pal 242*/ + RGBDEF( 0, 0, 0 ), /* pal 243*/ + RGBDEF( 0, 0, 0 ), /* pal 244*/ + RGBDEF( 0, 0, 0 ), /* pal 245*/ + RGBDEF( 0, 0, 0 ), /* pal 246*/ + RGBDEF( 0, 0, 0 ), /* pal 247*/ + RGBDEF( 0, 0, 0 ), /* pal 248*/ + RGBDEF( 0, 0, 0 ), /* pal 249*/ + RGBDEF( 0, 0, 0 ), /* pal 250*/ + RGBDEF( 0, 0, 0 ), /* pal 251*/ + RGBDEF( 0, 0, 0 ), /* pal 252*/ + RGBDEF( 0, 0, 0 ), /* pal 253*/ + RGBDEF( 0, 0, 0 ), /* pal 254*/ + RGBDEF( 0, 0, 0 ), /* pal 255*/ +}; + +static MWUCHAR imagebits[] = { +76,76,76,76,76,31,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,11,13,14,15,15,15,15,11,11,11,21,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,76,76,76,76,76,76,31,31,31,76,76,76,76,76,76,76,76,76,76,76,76,76,12,11,11,10,11,14,14,15,14,11,14,11,11,76,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,76,31,31,31,31,31,76,76, +76,76,76,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,76,76,76,76,31,31,31,76,76,76,76,76,9,11,14,15,15,32,15,32,15,15,15,15,15,11,11,76,76,76,76,31,31,31,31,76,76,76,76,76,31,31,31,31,31,31,31,76,76,76,76,76,76,31,31,76,31,31,31,31,76,76,76,76,76,76,76,76,12,9,11,14,15,65,32,32,32,32,32,32,15,15,15,11,11,76,76,76,76,31,76,76,31,31,31,76,76,31,31,31,31,31,31,31,31,31,31,31,76,76, +76,76,76,31,31,31,76,31,76,76,76,76,76,76,76,76,31,31,31,31,31,31,76,76,76,76,76,76,13,15,32,32,32,32,32,32,32,32,32,32,32,15,15,15,11,11,76,76,76,31,31,31,31,31,76,76,76,76,31,31,31,31,31,31,31,31,31,31,76,76,31,31,76,76,76,76,76,31,31,31,31,31,31,76,76,12,9,11,14,15,32,32,33,33,33,33,34,32,34,32,32,32,15,21,76,76,76,76,76,76,31,31,31,31,31,31,31,76,76,76,76,76,76,76,31,31,31,76, +76,76,76,31,31,31,76,31,31,76,76,76,76,31,31,31,76,76,76,76,76,76,76,76,76,11,13,15,32,32,33,32,33,32,34,32,33,32,33,33,32,32,32,15,15,14,11,76,76,76,76,76,31,31,31,76,76,31,31,76,76,76,31,31,31,31,76,31,31,76,31,76,76,76,76,76,76,76,76,76,31,31,31,76,76,12,11,15,32,32,32,32,34,33,34,33,33,34,32,33,33,32,32,15,21,76,76,76,76,31,76,76,31,31,31,31,31,31,31,76,76,76,76,76,31,31,31,76, +76,76,76,31,76,31,31,76,31,31,31,31,31,31,31,31,76,76,76,76,76,13,13,15,32,32,32,32,33,32,33,33,34,33,34,33,34,33,33,33,33,32,32,32,15,15,14,11,3,255,76,76,76,76,31,76,76,76,76,76,31,76,76,31,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,12,9,14,32,32,33,34,33,34,32,34,34,34,34,34,34,33,34,33,32,32,20,76,76,76,76,76,76,31,76,31,31,31,31,31,76,76,31,76,31,31,31,31,76, +76,76,31,31,76,76,31,76,31,31,76,76,76,76,76,76,76,15,15,32,32,32,32,32,33,33,32,34,33,34,34,33,34,34,34,34,34,34,34,33,33,34,32,32,32,32,14,11,8,255,255,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,10,13,32,32,32,33,33,33,34,34,34,34,34,34,35,34,34,34,33,34,32,32,9,76,76,76,76,76,31,76,76,31,76,31,31,76,76,31,76,76,31,31,76,76, +76,76,31,76,76,76,76,76,76,76,76,76,76,13,15,32,32,32,33,33,33,33,33,34,33,33,34,34,34,34,34,35,35,35,35,35,35,34,35,34,34,33,33,33,32,32,15,15,9,3,255,255,255,255,255,255,255,255,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,255,255,255,255,9,14,15,32,33,34,34,34,34,34,34,35,35,35,34,35,35,34,34,34,33,34,32,13,76,76,76,76,76,76,76,31,76,31,76,31,76,31,76,76,31,31,76,76, +76,76,76,76,76,76,76,76,76,76,32,32,33,33,33,33,34,33,33,33,34,33,34,34,34,34,34,35,34,36,36,36,36,36,37,36,36,35,35,35,34,34,34,33,32,32,32,15,13,9,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,9,14,32,32,34,33,34,34,34,35,35,35,35,35,36,35,35,35,35,34,34,34,33,33,32,9,76,76,76,76,76,31,76,31,76,31,76,31,31,76,76,31,31,76, +76,76,76,76,76,32,32,32,33,33,33,33,34,34,34,34,34,34,34,34,34,34,34,34,35,35,35,35,39,39,40,41,41,41,38,44,38,38,36,36,35,35,34,34,33,32,32,32,13,11,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,12,15,32,32,34,34,34,34,36,35,36,36,40,36,35,36,36,36,35,35,35,34,35,34,33,33,9,76,76,76,76,76,76,31,76,31,31,76,31,31,76,31,31,76, +76,76,33,32,33,33,33,34,33,34,34,34,34,34,34,35,35,34,35,35,35,35,35,35,35,36,36,39,39,41,41,41,46,38,47,38,44,39,39,39,38,35,35,34,34,33,32,32,15,9,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,12,15,32,34,34,34,35,35,36,36,39,37,39,39,46,38,39,37,39,36,36,36,35,34,35,34,34,21,76,76,76,76,76,76,76,76,31,76,76,31,76,31,31,76, +76,34,34,34,34,34,34,34,34,34,34,35,35,35,35,34,35,36,35,35,35,39,39,38,38,38,39,44,39,41,36,44,44,40,41,41,41,46,39,44,37,39,35,35,34,33,34,32,15,11,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,13,32,32,34,34,34,35,36,37,41,39,39,46,39,44,39,44,39,44,39,39,39,39,36,35,35,35,34,33,11,76,76,76,76,76,76,31,76,76,31,76,31,76,76, +76,34,35,34,35,34,34,39,34,35,35,35,35,36,36,36,39,35,38,36,38,36,40,39,41,44,41,40,44,41,35,46,41,47,47,38,46,40,44,35,44,39,36,35,34,34,33,32,15,9,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,13,15,33,34,35,35,35,36,40,39,44,46,39,44,40,39,41,36,44,39,44,39,39,39,39,39,39,35,35,34,33,76,76,76,76,76,31,76,76,31,31,31,76,76, +31,35,35,35,34,39,35,35,39,36,36,39,36,39,37,39,36,39,41,38,44,44,39,41,46,40,40,46,46,35,44,40,41,39,41,36,41,46,41,41,35,39,39,36,35,34,33,32,13,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,13,32,33,34,34,35,38,38,39,39,46,46,40,47,38,44,35,39,44,40,47,35,44,44,44,39,44,38,39,35,35,33,33,76,76,76,76,76,76,76,31,76,31,76, +31,34,39,34,39,35,36,39,36,39,37,37,39,39,39,41,41,47,38,36,39,46,40,47,38,41,46,41,39,40,47,38,41,41,35,44,36,39,41,36,41,40,39,35,35,34,34,32,9,255,255,255,255,255,255,3,255,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,13,32,32,35,35,35,38,36,41,41,46,38,44,40,46,35,44,47,40,47,39,41,35,44,35,44,39,47,39,47,47,35,35,35,35,76,76,76,76,76,76,76,31,76, +31,39,35,35,35,39,39,39,40,39,44,47,38,46,40,41,47,39,38,47,46,46,39,46,41,39,41,41,41,47,38,47,40,41,44,35,41,46,41,41,41,36,36,35,35,34,33,32,9,255,255,255,25,62,62,62,62,62,62,62,62,62,53,20,255,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,9,15,33,34,35,36,36,39,40,39,46,44,40,47,41,44,35,44,44,35,44,44,41,46,40,41,47,40,41,35,46,46,39,36,36,35,35,76,76,76,76,76,76,76, +31,35,34,39,39,39,39,39,44,44,40,39,44,47,41,36,44,41,47,35,44,41,41,44,35,44,46,39,41,41,44,35,41,41,46,40,41,41,38,41,38,39,39,35,35,35,33,15,9,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,49,19,255,255,255,255,255,255,255,255,255,255,255,255,255,255,8,15,33,34,35,35,36,37,41,41,46,39,41,47,41,36,44,35,41,44,35,44,46,39,47,35,44,41,39,47,41,36,44,39,46,36,36,35,35,76,76,76,76,76, +76,35,39,34,39,39,46,41,46,40,44,36,44,35,39,46,41,44,41,44,40,40,47,35,44,35,44,46,35,44,41,46,47,38,46,41,39,36,44,41,37,39,37,67,35,34,32,9,52,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,255,255,255,8,15,32,34,35,35,36,39,38,41,36,46,40,35,44,40,41,41,41,41,44,35,41,44,35,36,44,41,46,44,35,44,36,46,38,41,36,44,35,34,76,76,76,76, +76,35,34,39,35,39,41,40,39,39,36,39,46,41,47,39,41,39,41,39,44,41,41,41,46,46,39,41,36,41,41,39,46,41,41,40,46,46,39,38,40,37,40,39,35,34,15,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,255,6,15,32,34,35,35,36,37,40,41,41,41,41,41,41,47,39,46,44,40,36,39,41,41,41,36,44,35,41,46,39,46,47,39,41,35,39,46,44,44,35,35,76,76, +76,35,39,34,39,39,39,47,40,46,44,44,41,35,41,47,40,41,46,40,44,35,41,36,41,39,41,47,38,41,47,35,46,39,47,35,39,36,44,40,39,40,40,37,34,33,33,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,3,255,255,255,255,255,255,255,14,32,34,34,36,36,37,41,41,39,36,44,39,46,39,38,46,41,36,41,46,44,40,41,35,39,42,46,41,36,41,41,41,41,47,35,44,40,35,44,35,36,76, +76,35,35,34,39,47,39,41,35,46,39,41,44,44,47,39,41,36,46,41,36,41,46,38,36,41,46,44,36,44,41,47,38,41,44,47,41,39,41,39,40,40,40,39,34,32,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,13,32,33,35,36,36,39,39,41,41,46,40,47,46,44,47,35,41,41,47,39,46,44,47,38,47,38,47,40,40,44,47,40,39,36,44,41,47,40,44,35,35,35, +76,35,34,39,34,39,39,46,47,38,41,46,35,44,35,44,40,47,39,35,41,36,38,47,38,47,39,36,39,41,41,41,47,40,44,40,41,41,41,39,40,42,40,35,34,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,3,255,255,255,3,13,32,34,34,35,36,37,40,41,41,41,41,35,44,35,39,47,38,47,40,47,39,44,41,47,39,47,40,44,47,38,41,41,41,44,40,41,47,44,41,47,35,41, +76,34,34,39,35,47,39,39,46,46,39,44,35,44,40,39,44,39,46,44,46,39,47,40,47,41,41,41,41,46,41,46,40,41,36,46,36,39,41,41,40,40,39,35,33,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,12,32,34,34,35,36,37,41,39,41,46,40,47,44,47,40,44,39,46,41,41,41,35,46,44,44,40,44,35,44,41,44,40,47,41,36,47,38,36,41,41,47,41, +76,34,34,35,39,39,39,44,40,44,46,44,40,47,40,39,36,41,41,36,40,44,36,35,44,40,41,46,38,36,44,40,41,47,38,41,36,39,41,38,42,40,35,35,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,255,12,32,33,35,35,36,38,38,38,41,42,47,40,40,40,47,40,47,39,40,47,40,41,41,44,40,46,41,41,41,35,44,47,46,39,44,39,40,46,44,40,41,40, +76,34,34,39,35,39,40,47,39,39,36,36,39,46,39,44,47,44,40,41,47,40,41,41,47,39,36,39,46,39,36,44,46,47,39,47,38,41,40,40,42,36,35,6,17,20,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,12,32,34,34,35,36,36,41,39,41,41,41,40,46,47,35,46,46,39,47,40,41,46,39,40,39,46,38,46,36,44,46,41,40,40,40,44,47,40,36,41,44,44, +76,34,34,39,39,39,46,41,41,46,47,40,44,40,46,47,40,46,39,46,44,35,44,36,41,36,41,46,41,47,38,36,39,38,41,46,47,38,41,42,40,35,3,255,255,255,255,25,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,53,255,8,32,33,34,35,35,38,38,40,41,41,44,41,44,41,44,39,41,46,40,47,40,44,46,44,47,38,41,36,39,41,41,41,36,44,46,40,47,40,41,46,40,41, +76,34,35,39,39,46,41,39,36,44,40,47,35,41,36,39,36,41,46,38,36,39,36,44,41,40,47,39,36,44,35,44,41,47,38,46,38,41,41,46,39,34,3,255,255,255,255,255,29,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,53,53,6,32,34,34,35,35,36,38,41,39,39,41,40,39,41,40,44,41,41,39,41,41,40,41,46,40,47,35,46,41,46,44,35,44,41,46,41,41,36,41,41,76,76, +76,34,35,39,39,39,39,47,40,44,47,35,44,41,44,44,46,41,41,47,39,47,38,46,39,46,39,36,44,40,44,46,39,41,46,39,41,40,46,36,35,3,255,255,255,255,255,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,71,53,32,33,34,34,36,37,38,37,40,44,39,39,39,39,39,39,39,39,40,44,38,40,46,41,40,40,47,39,36,41,46,44,35,41,39,41,36,38,41,76,76,76, +76,34,47,35,39,44,36,44,41,46,39,46,36,39,46,35,41,41,46,41,44,38,36,41,47,41,36,44,35,44,36,44,46,41,44,35,41,42,40,35,3,255,255,255,255,255,255,255,255,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,71,71,33,33,34,35,35,38,36,39,37,40,38,38,39,36,36,39,38,38,39,40,44,41,38,46,41,46,44,35,41,44,39,41,41,46,39,46,41,76,76,76,31,31, +76,34,35,39,41,39,47,35,44,41,44,40,41,47,40,41,41,39,41,41,41,47,39,35,41,41,39,46,40,35,46,35,41,41,44,41,40,40,36,35,255,255,255,255,255,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,53,53,53,33,33,34,35,36,36,38,36,38,36,38,36,39,36,39,36,39,38,36,40,38,39,47,47,35,44,46,41,41,39,46,47,40,41,47,39,76,76,76,31,76,31, +76,34,39,39,40,39,40,46,41,36,35,44,47,40,39,41,47,41,47,41,41,47,40,47,40,47,40,41,47,41,41,41,46,38,41,40,46,36,35,3,255,255,255,255,255,255,255,255,22,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,71,53,53,72,34,34,35,38,36,36,36,38,36,36,36,35,36,35,36,36,36,36,39,40,39,46,40,39,41,46,41,41,47,35,41,44,41,40,76,76,76,31,31,31,31, +76,35,35,39,40,40,41,41,39,41,41,41,39,41,47,46,40,36,44,35,46,44,47,39,41,41,36,44,44,40,41,47,41,47,40,40,40,36,6,255,255,255,255,3,255,255,255,6,48,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,53,71,53,33,34,34,36,37,38,36,37,35,36,35,35,35,35,35,35,35,36,36,36,37,39,41,46,40,47,38,46,41,41,41,41,36,41,76,76,76,76,31,76,31,76, +76,34,35,39,39,39,39,39,46,37,39,46,44,46,39,44,39,39,41,36,44,35,44,40,47,39,46,35,46,39,41,41,41,39,41,46,36,35,255,255,255,255,255,255,255,255,255,30,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,52,53,53,34,34,36,39,38,36,36,36,35,35,35,35,34,35,34,34,34,35,35,35,37,39,40,41,36,41,36,38,41,41,41,46,40,76,76,76,31,31,31,76,31,76, +76,36,35,36,36,39,39,37,39,39,39,40,39,39,39,39,46,44,40,44,35,44,41,40,47,40,47,40,40,47,38,46,41,41,41,40,35,3,255,255,255,255,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,71,71,53,50,35,36,39,38,39,36,35,35,35,34,34,34,34,34,34,34,34,34,35,35,36,40,39,41,41,41,41,41,41,40,41,44,76,76,76,31,31,31,76,31,76, +76,76,32,36,39,37,39,39,39,39,39,39,39,39,39,39,39,46,44,39,36,41,44,41,46,38,41,41,47,40,41,41,41,41,40,39,3,255,255,255,255,255,255,255,20,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,71,71,53,50,36,35,39,37,39,36,35,34,34,34,34,33,34,34,33,34,33,34,34,34,35,37,39,40,39,41,41,44,41,41,41,76,76,76,76,31,31,31,31,31,76, +76,76,76,33,34,37,39,36,35,35,34,35,35,39,39,39,39,39,44,35,44,44,35,41,41,47,38,47,40,41,41,41,41,45,40,35,3,255,255,255,255,255,255,16,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,53,71,53,53,50,35,44,39,38,35,36,34,34,34,33,34,32,33,32,32,33,34,33,34,33,34,35,36,39,40,39,41,40,46,41,76,31,76,76,31,31,31,31,76,31,76, +76,76,76,31,76,76,76,34,33,34,34,34,34,35,39,35,39,39,39,39,39,36,41,44,39,41,40,41,46,44,35,41,41,38,40,255,255,255,255,255,255,6,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,53,53,53,34,39,35,44,39,38,35,34,34,34,33,15,9,255,255,255,255,255,8,14,33,34,34,36,38,37,38,41,41,38,38,76,76,76,76,31,31,31,31,76,31,76, +76,76,76,31,76,31,76,76,76,76,76,33,34,34,35,35,39,39,39,44,41,47,44,35,44,46,39,46,40,41,41,41,41,40,35,255,255,255,3,255,3,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,52,53,33,47,44,44,39,38,35,34,33,32,15,8,255,255,255,255,255,255,255,255,9,32,34,35,40,40,41,39,41,41,38,76,76,76,76,76,76,31,31,76,31,76, +76,76,76,76,76,76,76,76,76,76,76,76,34,33,34,35,35,39,39,39,39,46,41,46,35,44,44,41,41,40,41,41,41,39,255,255,255,255,255,16,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,53,34,36,36,39,41,38,35,34,33,12,255,255,255,255,255,255,255,255,255,255,255,255,33,35,39,46,40,40,41,40,39,76,76,76,31,76,76,31,31,76,31,31, +76,76,31,76,76,76,76,76,31,76,76,31,76,76,34,35,35,35,39,39,47,39,46,41,46,35,41,39,46,47,38,46,37,255,255,255,255,3,20,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,50,35,39,39,39,39,37,34,15,255,255,255,255,255,255,255,255,255,255,255,255,255,255,32,35,46,40,45,46,40,46,76,76,76,76,76,76,76,76,76,76,31, +76,76,31,76,31,76,76,76,31,76,76,76,76,76,76,34,34,35,39,35,39,44,39,46,39,36,44,46,39,41,41,46,36,255,255,255,6,25,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,34,39,40,44,41,46,40,33,15,255,255,255,255,255,255,255,255,255,255,255,255,6,255,255,34,40,40,40,67,47,40,76,76,76,76,31,31,31,31,31,76,31, +76,76,31,31,31,31,76,76,31,31,76,76,76,76,76,34,34,35,35,39,35,44,36,41,46,40,36,44,40,41,46,39,255,255,255,16,50,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,39,35,39,46,46,67,42,39,51,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,8,45,46,67,46,47,40,76,76,31,31,31,31,31,31,31,31,31, +76,76,31,31,76,31,76,76,31,31,31,31,76,76,31,76,35,35,35,35,47,35,46,38,41,46,38,41,46,41,38,255,255,255,19,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,35,39,39,46,40,47,40,67,33,3,3,255,255,255,255,255,255,255,255,255,255,255,7,3,6,8,40,47,40,40,46,76,76,31,31,31,31,31,31,31,31,31, +76,76,31,76,76,31,31,76,76,76,31,31,76,76,76,76,76,35,35,39,41,46,39,46,46,39,36,41,38,41,255,255,255,25,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,39,39,47,67,40,67,40,40,33,3,255,255,255,255,255,255,255,255,255,255,255,255,3,16,6,255,33,42,38,41,76,76,31,31,31,31,31,31,31,31,31,31, +76,76,31,76,76,31,31,31,76,76,31,76,76,76,76,76,76,35,35,44,39,46,41,47,38,46,41,41,41,255,255,255,23,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,35,40,40,47,39,47,41,15,255,255,255,255,255,255,255,255,255,255,255,255,255,255,16,16,16,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,76,31,76,31,31,31,31,31,31,76,76,31,76,35,35,46,36,41,41,46,41,41,41,255,255,3,52,52,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,39,35,35,39,35,34,20,255,255,255,255,255,255,255,255,255,255,255,255,255,255,16,19,19,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,76,31,31,31,76,76,76,31,76,76,76,76,35,39,36,41,36,39,39,41,255,255,255,51,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,16,3,255,255,255,255,255,255,255,255,255,255,255,255,255,16,29,22,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,76,31,31,76,76,31,31,76,76,255,255,255,44,35,46,41,36,255,255,255,19,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,29,255,16,6,255,255,255,255,255,255,255,255,255,255,255,6,27,29,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,76,76,31,31,76,76,31,76,76,255,255,255,255,44,41,255,255,255,255,30,51,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,255,255,19,16,255,255,255,255,255,255,3,16,19,18,19,16,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,76,255,255,255,255,255,255,255,255,255,16,53,255,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,25,26,16,3,19,19,19,16,6,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,76,31,31,76,76,76,76,76,255,255,255,255,255,255,255,255,3,48,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,20,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,76,76,255,255,255,255,255,255,255,255,20,51,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,255,255,255,18,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,76,31,76,76,31,31,31,76,76,255,255,255,255,255,255,16,19,25,255,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,6,19,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,76,31,31,76,76,76,76,76,76,76,255,255,255,255,255,6,16,22,24,255,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,23,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,76, +31,31,31,31,31,31,31,31,76,31,31,76,76,31,76,76,76,76,255,255,255,255,255,255,6,19,23,255,255,255,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,255,255,255,255,26,16,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,76,31,31,31,31,31,76,76,76,76,255,255,255,255,255,255,255,6,48,255,255,255,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,6,16,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,16,48,255,255,255,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,25,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,255,255,255,255,255,6,29,255,255,255,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,3,3,255,255,255,25,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,16,23,255,255,255,49,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,23,3,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,76, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,6,23,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,18,3,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,18,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,71,255,255,255,255,255,255,255,255,19,6,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,76,255,255,255,255,17,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,29,255,255,255,255,255,255,255,255,255,19,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,255,255,255,6,255,255,255,255,51,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,255,20,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,4,255,25,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,255,255,255,255,255,255,255,19,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,255,255,255,255,19,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,255,19,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,3,16,16,255,255,255,49,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,6,18,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,31,255,255,255,3,19,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,29,6,255,255,255,255,255,255,255,255,255,255,76,31,76,76,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,255,255,255,19,255,255,255,255,49,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,26,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,6,27,255,255,255,19,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,53,3,6,6,3,255,255,255,255,16,24,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,18,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,22,7,16,19,19,16,3,3,255,25,16,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,31,76,255,255,255,16,26,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,16,6,16,20,23,19,16,6,2,22,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,30,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,52,255,255,16,18,24,20,16,255,19,16,255,255,255,255,255,255,255,255,255,255,76,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,16,19,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,55,62,19,255,255,3,19,20,19,16,255,19,3,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,20,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,71,53,62,255,255,255,6,16,16,6,3,18,6,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,76, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,31,255,255,255,255,16,19,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,61,55,71,53,62,20,255,255,255,255,3,3,255,18,19,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,48,255,255,255,255,71,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,53,71,59,62,255,255,255,255,255,255,255,7,16,3,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,3,23,6,255,255,24,71,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,53,71,71,55,62,20,255,255,255,255,255,3,255,20,16,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,255,3,19,255,255,255,51,52,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,55,55,52,53,53,62,62,255,255,255,255,255,3,2,22,16,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,255,255,255,255,30,51,52,55,62,62,62,62,62,62,62,62,62,62,62,62,62,59,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,57,53,53,71,71,53,57,62,20,255,255,255,255,255,18,19,6,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,255,255,255,255,255,255,255,255,255,6,49,51,51,55,57,62,62,62,62,62,62,62,62,62,62,62,57,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,61,59,55,55,53,71,53,71,53,71,55,62,62,255,255,255,255,29,23,16,3,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,255,255,255,255,255,255,255,255,255,3,51,49,51,51,55,55,57,61,62,62,62,62,62,62,62,62,59,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,55,53,55,71,71,71,53,71,71,71,71,53,59,62,20,255,255,255,28,24,6,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,255,255,255,255,255,30,51,49,51,56,53,55,58,57,62,62,62,62,62,62,62,57,55,55,62,62,62,62,62,62,62,62,62,62,62,62,55,55,55,71,71,71,53,52,71,71,53,71,71,53,59,62,62,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,255,255,255,255,255,22,49,51,51,53,57,59,62,62,62,62,62,62,62,62,55,55,57,55,55,55,57,62,62,62,62,62,62,62,62,62,59,57,55,55,55,55,53,55,53,53,71,71,53,57,62,61,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,76,255,255,255,255,255,255,255,255,6,51,50,53,61,62,62,62,62,62,62,62,62,62,62,62,62,62,59,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,59,57,55,55,59,59,61,55,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,255,255,255,255,255,255,255,255,49,52,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,30,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,3,255,255,255,255,255,255,30,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,31,255,255,255,255,255,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,255,255,255,255,255,255,51,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,29,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,76,76,76,255,255,255,255,255,255,255,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,16,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,76,76,255,255,255,255,255,255,49,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,58,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,255,255,255,255,255,255,255,52,62,62,62,62,62,62,62,62,62,62,62,62,57,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,18,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,31,76,76,31,255,255,255,255,255,255,51,55,62,62,62,62,62,62,62,62,62,62,53,52,53,52,53,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,16,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,76,255,255,255,3,3,255,55,59,62,62,62,62,62,62,62,52,51,52,53,51,52,52,52,53,59,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,51,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,76,2,6,16,3,3,255,71,62,62,62,62,62,62,62,71,53,71,52,52,52,53,51,71,71,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,25,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,4,7,16,6,3,255,255,57,62,62,62,62,62,71,71,71,52,52,51,52,51,71,53,52,51,55,57,59,59,62,62,62,62,62,62,62,62,62,62,62,62,62,51,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,4,3,3,255,255,255,71,62,62,61,59,53,71,53,51,51,51,51,53,71,53,52,51,53,52,53,55,59,59,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6,4,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,255,62,62,59,55,71,52,51,52,51,71,51,54,53,52,52,52,53,51,53,53,53,55,59,62,62,62,62,62,62,62,62,62,62,52,255,255,255,255,255,255,255,255,255,255,255,255,255,255,16,76,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,71,59,57,53,71,71,51,51,52,48,33,33,33,49,56,51,50,53,51,56,53,71,53,60,62,62,62,62,62,62,62,62,58,19,255,255,255,255,255,255,255,255,255,255,255,255,255,255,16,76,31,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,31,255,255,255,255,255,56,53,53,71,51,52,50,50,32,33,32,32,33,32,33,32,33,50,50,53,52,50,71,53,60,62,62,62,62,62,62,55,53,255,255,255,255,255,255,255,255,255,255,255,255,255,255,8,76,76,31,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,71,71,71,53,54,51,33,32,32,33,34,34,33,34,33,33,33,33,34,50,52,52,71,53,53,62,62,62,62,62,62,55,23,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,71,52,52,51,52,33,32,32,34,34,35,35,35,35,34,34,34,34,33,34,72,52,51,52,52,52,62,62,62,71,52,51,255,255,255,255,255,20,20,72,20,255,255,255,255,255,255,76,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,255,255,255,51,53,71,52,32,33,32,34,35,67,38,35,35,35,35,35,35,34,35,34,34,33,52,71,71,71,55,53,55,52,53,71,255,255,255,255,255,49,48,49,48,6,255,255,255,255,255,76,76,31,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,6,51,71,71,32,33,32,34,34,40,40,37,67,35,35,36,35,35,35,35,35,34,34,34,33,55,55,55,53,71,71,71,255,255,255,255,255,49,48,49,48,49,18,255,255,255,255,76,76,76,31,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,255,255,16,51,52,33,32,32,13,32,33,33,32,21,13,21,13,33,34,35,35,35,35,35,35,35,34,33,50,53,51,71,71,53,255,255,255,255,255,72,48,72,48,17,255,255,3,255,255,76,76,31,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,51,33,32,12,32,38,41,40,46,47,47,67,39,40,33,15,10,33,34,35,35,35,37,35,39,34,33,34,56,53,3,255,255,255,255,49,48,49,49,49,16,255,255,255,255,76,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,255,255,255,255,10,32,9,33,42,41,41,41,47,47,47,47,47,67,40,47,67,34,17,15,35,35,36,36,36,36,35,34,33,7,255,255,255,255,255,48,49,28,255,255,255,255,255,255,76,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,3,12,14,35,39,39,41,41,41,46,40,46,40,67,47,67,40,40,67,40,67,15,33,67,36,36,36,36,35,35,32,3,255,255,255,255,49,25,255,255,255,255,255,255,255,76,76,31,31,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,76,255,255,255,15,32,34,39,35,39,41,36,41,41,42,45,46,47,51,46,67,47,40,40,47,67,33,33,67,35,36,35,35,35,47,7,255,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,31,76,76,255,255,255,34,34,34,36,36,39,41,41,39,41,46,41,45,47,47,47,40,40,67,40,67,40,47,40,34,67,34,37,36,35,67,9,3,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,76,255,255,255,34,33,35,35,35,39,41,40,41,40,46,42,42,46,67,47,50,47,39,47,67,46,40,67,46,42,67,33,35,36,39,9,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,31,31,31,76,255,255,255,33,34,34,35,39,39,39,40,41,38,42,40,45,46,47,47,47,47,47,67,40,40,67,42,40,67,42,33,15,40,39,15,3,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,76,255,255,255,9,33,33,34,36,39,38,40,39,41,40,41,40,42,67,47,47,50,47,40,47,67,47,40,67,47,67,46,46,47,40,15,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,255,255,255,255,8,34,34,35,39,39,41,41,41,40,41,46,42,46,67,47,47,56,47,67,40,40,67,47,46,46,67,47,42,35,6,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,255,255,255,255,255,4,33,34,36,39,39,41,39,46,40,40,42,45,47,47,67,56,47,47,47,67,40,40,67,45,40,36,33,8,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,31,76,255,255,255,255,255,62,62,34,34,39,41,46,41,39,41,46,40,45,46,47,47,47,67,46,40,40,40,40,34,34,32,62,62,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,31,76,76,255,255,255,255,49,62,62,255,34,33,38,39,46,41,40,41,40,40,40,40,67,47,40,46,40,34,15,27,53,62,62,62,62,255,3,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,31,31,31,76,255,255,255,255,52,62,26,255,255,15,36,34,34,40,44,40,40,40,34,32,33,46,46,45,36,255,255,255,255,255,62,62,62,62,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,76,255,255,255,255,55,62,255,255,2,255,8,39,40,40,41,40,67,67,45,45,45,35,15,8,255,255,255,255,255,255,255,62,62,62,71,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,76,255,255,255,255,53,19,255,255,255,255,255,62,34,32,34,34,33,34,33,32,9,56,62,255,255,255,255,255,255,255,255,71,62,62,71,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,31,31,31,31,76,76,255,255,255,53,62,16,255,255,3,49,3,57,62,26,255,4,255,255,255,3,48,71,62,255,255,255,255,255,255,255,255,71,62,62,71,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,255,255,255,53,62,255,255,255,16,49,255,59,62,48,3,3,255,255,20,255,55,55,62,255,255,255,255,255,3,255,255,71,62,62,71,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,255,255,255,55,62,255,255,255,72,49,255,62,62,48,6,16,22,25,19,255,71,62,62,255,255,255,255,255,20,20,3,62,62,62,53,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,76,255,255,255,49,62,255,255,3,49,25,255,62,62,48,6,6,6,16,255,255,53,62,62,62,255,255,255,6,50,72,255,62,62,62,30,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,49,62,7,255,3,25,17,62,62,62,48,255,255,255,6,255,255,56,59,62,62,3,255,255,49,49,6,61,62,62,62,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,30,62,62,30,22,23,62,62,62,62,255,255,255,255,3,255,255,71,55,62,62,62,72,16,255,25,62,62,62,62,49,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,30,51,71,62,62,62,62,62,62,22,255,255,255,255,255,255,255,49,55,61,62,62,62,62,62,62,62,62,71,49,49,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,19,49,51,52,53,52,55,56,51,19,255,255,255,255,255,255,255,23,49,51,57,62,62,62,62,62,55,52,49,49,3,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,255,255,255,255,3,30,51,51,53,53,52,49,72,255,7,255,255,255,255,3,255,255,49,49,51,51,52,52,53,53,55,52,50,72,255,255,6,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,16,30,49,52,51,49,72,255,255,19,255,255,255,255,255,255,255,255,49,49,49,51,51,51,52,53,52,51,255,255,16,255,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,255,6,30,49,49,48,255,6,27,6,255,255,255,255,255,3,255,255,255,49,49,49,49,51,49,51,51,255,255,30,6,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,255,255,255,255,255,3,255,255,255,255,3,255,26,16,255,255,255,255,255,255,255,255,255,255,255,16,49,48,48,48,16,255,255,26,17,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,3,6,3,255,3,16,18,16,255,255,255,255,255,255,255,255,255,3,255,255,255,255,255,255,255,255,255,48,26,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,255,255,6,6,16,6,6,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,16,18,18,7,255,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,31,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,5,76,76,31,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6,6,6,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,16,16,19,6,3,3,255,255,255,255,255,255,255,255,255,76,76,76,31,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,16,20,23,20,19,16,7,7,6,3,255,255,255,255,4,76,76,31,31,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,16,20,30,30,26,20,20,16,16,6,3,255,255,255,76,76,76,31,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,16,20,48,48,48,26,20,20,17,6,255,255,255,255,76,76,76,31,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6,18,30,49,49,30,22,17,6,255,255,255,255,76,76,76,76,31,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,6,20,26,48,30,25,19,7,3,255,255,255,255,76,76,31,31,31,31,76,31,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,16,19,23,26,25,19,16,255,255,255,255,255,76,76,76,76,76,76,76,76,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6,16,18,19,16,3,255,255,255,255,255,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,6,3,255,255,255,255,255,76,76,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,31,76,76,76,5,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,76,76,76,76,4,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,31,31,31,31,76,76,31,31,76,31,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,31,76,76,31,31,76,31,31,31,31,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,31,31,76,76,76,76,31,31,76,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,31,76,76,76,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,31,31,31,31,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,255,255,255,255,255,255,255,255,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, +}; + +MWIMAGEHDR image_penguin = { + 128, 151, /* width, height*/ + 1, 8, /* planes, bpp*/ + 128, 1, /* pitch, bytesperpixel*/ + 1, 256, /* compression, palsize*/ + -1L, /* transcolor*/ + palette, + imagebits, +}; diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/pngtest.png b/packages/services/gfx/mw/current/src/mwin/bmp/pngtest.png new file mode 100644 index 0000000000000000000000000000000000000000..f3a6df4483fc9d020c028d4e4f417767bfa72877 GIT binary patch literal 8574 zc$@)#A%WhBP) z000SeMObuHX>@F508max+yQwt001AiNklO)sr#@4<(ul(br`VbraBmuhk@3?%j97U znXm>WOoQH`mkmQV#Dgk$0iE!|kWKC(UZ$ifRdrR{?y-0LgGZ$*Gb7{uBI5Vw`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R&a*U?#(SU^?@d6se2Tz8OIqmb6lRw0q)s}Px7y2HC3D*{Q;_xJ78w(SLVOhwpB zUvCPlSN_dZ@3+Z^rxWwdpZf0PJvWrz-E|AZ@PtpBxRRuHD(Ck0_lG!4M<9iI_Hxe^Z$D zpIP2Hsp(mDa{M>@r!N-~Ba(pkua^n@2X=P_mdn}aU(~-C|N1xoH7=K5{sHIxCn?{! zvqybfFDZ*Bkpc$`hkK}y6x5CzbEPVtutGhsmR1maE|;tALppG4DYJDWn~N!4`pXHsi_VCJxXDJxCx0>6mK2j| zAZfwd$NP_2dF{Jz(M(*w#`BO46r)2eP^2-halrRltp!AbZB3a4wnyFL)Wsr>NmgP> zjytKyrVqAYK^T($U$Ui{ct}F(s(GAivrKo<86K?tA8rU&BlmN~0000007*qoM6N<$ Ef`FLc{r~^~ diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/rle8.bmp b/packages/services/gfx/mw/current/src/mwin/bmp/rle8.bmp new file mode 100644 index 0000000000000000000000000000000000000000..762af2987e25dd8bd61b5c63fa29cb295110c27e GIT binary patch literal 71938 zc%0n5-;-U(ktSAE=Ty}_r%s)FZxi>T(d2EQTOdsiMQ~_E*uk(KB+kx{h1YTfUp9h{ z@WV138v@mU1%Lw@7(p{qbAke)8Au`_Qp2^lusKA#-J!v>8MEs!H^xmy6XZ~Q@Pl3) z!B_gp@|zy~AZLD=b#Cilu%s6H$GzvCla-bEW#*Sz&-@qegf;x1|D-nNQTq35^y7W{ z*P4;xzkGU3{*M1x`I?MIW_2>5uT}awOJC2Kjg1YnvHBSO%U@^BW2>v?G5Y?oji=0G zPtn(7Pt(8j^%(u_DgJtnzFwf8FPX=lzGj}HzdiNLbLOdMpQnE>nWrDyps%OQ)AZh_ zpLyCm{q(c+?{oC^f_eH``Z{}!{=H_NdG;)QJ#U_Q{+c=a^ke2MUFR&l{_L~Q(7(@_ zv(LR?&Yrzw&OT3H&(Uk1-!^A2ZJTGGea<}l{PX6yXC5=JJ-cBpJ@b^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vQG<{|^omaD1I(TpyvYq$+-A$fwvP<));~Wvo0)+nipgDsGCf@7`a_ zSbNtN!f*fOcZUZD21m^Bf~=_t6&2{{z%U`AJ8&w|2y_WONcx+;#jfW>73{48|Bvqm zfxR`(#7PVq=N%pwc7xbNfo3z0b07yR7OyT|8~Fe;>USg+po}U0OHee3oUhqu_OBp3ih&$hI*2{i(X8Q9lD1@#Bzw<6D z4|=Tx6gH_ZS|f^IVu%kF>@qzz47`*WTdof9z~6W-?PB^r^B;IfqCT=w!M@2s^a)Xv zF^Y@>(Pmsk#1PBG|JpFQS}Xck$jrG?klY1B<0fFo zH3D6zF+x%uGb7spJG2l=NXno2AGS)um47cijLiKI$87W{`5@B(nbrUyA^H0Ub*s6f z(~L__xviaUn_)8Ym8Baqk#fdeQ1X(kFLJ?MzVlC?Dtfx|XS^0*1+0c9cDIF$WEhl* zDh)VM=sM!!I6Zrqes5A9u>L1qLGK*d)fjUEc6k>C(d5?SphaQ<_8*)b(FR5B7-`v& zA&M&#WW}`U$r48sh?Gqb$_ddEYQ{cJ3J(UGOd@YVJU7a0Nc-1Jhz=3|b
    eCos Power Management Support
    PrevNext

    Attached and Detached Controllers

    Name

    Attached and Detached Controllers -- control which power controllers are affected by global changes

    Synopsis

    #include <cyg/power/power.h>

    cyg_bool power_get_controller_attached + ( PowerController* controller + );

    void power_set_controller_attached + ( PowerController* controller + , cyg_bool new_state + );

    Detaching Power Controllers

    By default the global operation power_set_mode +affects all power controllers. There may be circumstances when this is +not desirable. For example if a particular device is not currently +being used then it can be left switched off: the rest of the system +could be moving between active, idle and +sleep modes, but there is no point in invoking the power +controller for the unused device. To support this the power management +package supports the concept of attached and detached controllers. By +default all controllers are attached, and hence will be affected by +global mode changes. A specific controller can be detached using the +function power_set_controller_attached. This +function takes two arguments, one to specify a particular controller +and another to specify the desired new state. +power_get_controller_attached can be used to +determine whether or not a specific controller is currently attached.

    The attached or detached state of a controller only affects what +happens during a global mode change, in other words following a call +to power_set_mode. It is still possible to +manipulate a detached controller using +power_set_controller_mode or +power_set_controller_mode_now.


    PrevHomeNext
    Support for Policy Modules Implementing a Power Controller
    \ No newline at end of file diff --git a/packages/services/power/common/current/doc/power-change.html b/packages/services/power/common/current/doc/power-change.html new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/doc/power-change.html @@ -0,0 +1,453 @@ + + + + + + + + + + + +Changing Power Modes +
    eCos Power Management Support
    PrevNext

    Changing Power Modes

    Name

    Changing Power Modes -- reducing or increasing power consumption as needed

    Synopsis

    #include <cyg/power/power.h>

    void power_set_mode + ( PowerMode new_mode + );

    void power_set_controller_mode + ( PowerController* controller + , PowerMode new_mode + );

    void power_set_controller_mode_now + ( PowerController* controller + , PowerMode new_mode + );

    Changing the Global Power Mode

    The primary functionality supported by the power management package is +to change the system's global power mode. This is achieved by calling +the function power_set_mode with a single +argument, which should be one of PowerMode_Active, +PowerMode_Idle, PowerMode_Sleep +or PowerMode_Off. Typically this function will only +be invoked in certain scenarios:

    1. A typical system will contain a policy module which is primarily +responsible for initiating power mode changes, and a thread inside the +power management package. The policy module will call +power_set_mode, which has the effect of +manipulating some internal state in the power management package and +waking up its thread. When this thread gets scheduled to run (its +priority is controlled by a configuration option), it will iterate +over the power controllers and invoke each controller to change its +power mode. There is support for a callback function, and for +detached power controllers.

    2. After a call to power_set_mode but before the +power management thread has had a chance to iterate over all the +controllers, or even before the thread has been rescheduled at all, +the policy module may decide that a different power mode would be more +appropriate for the current situation and calls +power_set_mode again. This has the effect of +aborting the previous mode change, followed by the power management +thread iterating over the power controllers again for the new mode.

    3. If there is no single policy module responsible for power mode +changes, any code can call power_set_mode. If +there are multiple calls in quick succession, earlier calls will +be aborted and the system should end up in the power mode +corresponding to the last call

    4. As a special case, it is possible for a power controller to call +power_set_mode when invoked by the power +management thread. For example a power controller could decide that it +is inappropriate for the system to go to sleep because the device it +is associated with is still busy. The effect is as if the policy +module had called power_set_mode again before +the mode change had completed.

    If the power management package has been configured not to use a +separate thread then obviously the behaviour is somewhat different. +The call to power_set_mode will now iterate over +the various power controllers immediately, rather than leaving this to +a separate thread, and the whole mode change completes before +power_set_mode returns. If some other thread or a +DSR calls power_set_mode concurrently the +behaviour of the system is undefined. However, it is still legal for a +power controller to call power_set_mode: +effectively this is a recursive call; it is detected by the system, +and internal state is updated; the recursive +power_set_mode call now returns, and when the +power controller returns back to the original +power_set_mode call it detects what has happened, +aborts the previous mode change, and starts a new mode change as +requested by the controller.

    power_set_mode is normally invoked from thread +context. If a separate power management thread is used it can be +invoked safely from DSR context. If the system is configured not to +use such a thread, it may or may not be safe to invoke this function +from DSR context: essentially the function just iterates through +the various power controllers, and the documentation or source code of +each controller present in the current system will have to be examined +to determine whether or not this can happen safely in DSR context. +power_set_mode should never be invoked from +ISR context.

    Manipulating an Individual Power Controller

    In some cases it is desirable to set the power mode of an individual +controller separately from the mode for the system as a whole. For +example if a device is not currently being used then the associated +power controller could be set to PowerMode_Off, +even while the system as a whole is still active. This can be achieved +by calling the function +power_set_controller_mode. It takes two +arguments: the first identifies a particular controller; the second +specifies the desired new power mode for that controller. The function +operates in much the same way as power_set_mode, +for example if a separate power management thread is being used then +power_set_controller_mode operates by +manipulating some internal state and waking up that thread. The +limitations are also much the same as for +power_set_mode, so for example +power_set_controller_mode should not be invoked +from inside ISRs.

    Manipulating individual controllers is often used in conjunction with +the function power_set_controller_attached, +allowing the policy module to specify which controllers are affected +by global mode changes.

    Direct Manipulation of a Power Controller

    In exceptional circumstances it may be necessary to invoke a power +controller directly, bypassing the power management thread and +higher-level functionality such as callback functions. The +function power_set_controller_mode_now allows +this. It takes two arguments, a controller and a mode, just like +power_set_controller_mode.

    Use of power_set_controller_mode_now is +dangerous. For example no attempt is made to synchronise with any +other power mode changes that might be happening concurrently. A +possible use is when the system gets woken up out of +sleep mode: depending on the hardware, on which power +controllers are present, and on the application code it may be +necessary to wake up some power controllers immediately before the +system as a whole is ready to run again.


    PrevHomeNext
    Power Management Information Support for Policy Modules
    \ No newline at end of file diff --git a/packages/services/power/common/current/doc/power-controller.html b/packages/services/power/common/current/doc/power-controller.html new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/doc/power-controller.html @@ -0,0 +1,638 @@ + + + + + + + + + + + +Implementing a Power Controller +
    eCos Power Management Support
    Prev 

    Implementing a Power Controller

    Name

    Implementing a Power Controller -- adding power management support to device drivers and +other packages

    Implementing a Power Controller

    A system will have some number of power controllers. Usually there +will be one power controller for the cpu, +power_controller_cpu, typically provided by one of +the HAL packages and responsible for managing the processor itself and +associated critical components such as memory. Some or all of the +device drivers will provide power controllers, allowing the power +consumption of the associated devices to be controlled. There may be +some arbitrary number of other controllers present in the system. The +power management package does not impose any restrictions on the +number or nature of the power controllers in the system, other than +insisting that at most one power_controller_cpu be +provided.

    Each power controller involves a single data structure of type +PowerController, defined in the header file +cyg/power/power.h. These data +structures should all be placed in the table +__POWER__, so that the power management package and +other code can easily locate all the controllers in the system. This +table is constructed at link-time, avoiding code-size or run-time +overheads. To facilitate this the package provides two macros which +should be used to define a power controller, +POWER_CONTROLLER() and +POWER_CONTROLLER_CPU().

    The macro POWER_CONTROLLER takes four arguments:

    1. A variable name. This can be used to access the power controller +directly, as well as via the table.

    2. A priority. The table of power controllers is sorted, such that power +controllers with a numerically lower priority come earlier in the +table. The special controller power_controller_cpu +always comes at the end of the table. When moving from a high-power +mode to a lower-powered mode, the power management package iterates +through the table from front to back. When moving to a higher-powered +mode the reverse direction is used. The intention is that the power +controller for a software-only package such as a TCP/IP stack should +appear near the start of the table, whereas the controllers for the +ethernet and similar devices would be near the end of the table. Hence +when the policy module initiates a mode change to a lower-powered mode +the TCP/IP stack gets a chance to cancel this mode change, before the +devices it depends on are powered down. Similarly when moving to a +higher-powered mode the devices will be re-activated before any +software that depends on those devices.

      The header file cyg/power/power.h defines three +priorities PowerPri_Early, +PowerPri_Typical and +PowerPri_Late. For most controllers one of these +priorities, possibly with a small number added or subtracted, will +give sufficient control. If an application developer is uncertain +about the relative priorities of the various controllers, a simple +test program that iterates over +the table will quickly eliminate any confusion.

    3. A constant string identifier. If the system has been configured +without support for such identifiers +(CYGIMP_POWER_PROVIDE_STRINGS) then this identifer +will be discarded at compile-time. Otherwise it will be made available +to higher-level code using the function +power_get_controller_id.

    4. A function pointer. This will be invoked to perform actual mode +changes, as described below.

    A typical example of the use of the +POWER_CONTROLLER macro would be as follows:

    #include <pkgconf/system.h>
    +
    +#ifdef CYGPKG_POWER
    +# include <cyg/power/power.h>
    +
    +static void
    +xyzzy_device_power_mode_change(
    +    PowerController* controller,
    +    PowerMode        desired_mode,
    +    PowerModeChange  change)
    +{
    +   // Do the work
    +}
    +
    +static POWER_CONTROLLER(xyzzy_power_controller, \
    +                        PowerPri_Late,          \
    +                        "xyzzy device",         \
    +                        &xyzzy_device_power_mode_change);
    +#endif

    This creates a variable xyzzy_power_controller, +which is a power controller data structure that will end up near the +end of the table of power controllers. Higher-level code can +iterate through this table and report the string "xyzzy +device" to the user. Whenever there is a mode change +operation that affects this controller, the function +xyzzy_device_power_mode_change will be invoked. +The variable is declared static so this controller cannot be +manipulated by name in any other code. Alternatively, if the variable +had not been declared static other code could manipulate this +controller by name as well as through the table, especially if the +package for the xyzzy device driver explicitly declared this +variable in an exported header file. Obviously exporting the variable +involves a slight risk of a name clash at link time.

    The above code explicitly checks for the presence of the power +management package before including that package's header file or +providing any related functionality. Since power management +functionality is optional, such checks are recommended.

    The macro POWER_CONTROLLER_CPU only takes two +arguments, a string identifier and a mode change function pointer. +This macro always instantiates a variable +power_controller_cpu so there is no need to provide +a variable name. The resulting power controller structure always +appears at the end of the table, so there is no need to specify a +priority. Typical usage of the POWER_CONTROLLER_CPU +macro would be:

    static void
    +wumpus_processor_power_mode_change(
    +    PowerController* controller,
    +    PowerMode        desired_mode,
    +    PowerModeChange  change)
    +{
    +   // Do the work
    +}
    +
    +POWER_CONTROLLER_CPU("wumpus processor", \
    +                     &wumpus_processor_power_mode_change);

    This defines a power controller structure +power_controller_cpu. It should not be declared +static since higher-level code may well want to manipulate the cpu's +power mode directly, and the variable is declared by the power +management package's header file.

    Some care has to be taken to ensure that the power controllers +actually end up in the final executable. If a power controller +variable ends up in an ordinary library and is never referenced +directly then typically the linker will believe that the variable is +not needed and it will not end up in the executable. For eCos packages +this can be achieved in the CDL, by specifying that the containing +source file should end up in libextras.a rather +than the default libtarget.a:

    cdl_package CYGPKG_HAL_WUMPUS_ARCH {
    +    …
    +    compile -library=libextras.a data.c
    +}

    If the file data.c instantiates a power +controller this is now guaranteed to end up in the final executable, +as intended. Typically HAL and device driver packages will already +have some data that must not be eliminated by the linker, so they will +already contain a file that gets built into +libextras.a. For power controllers defined inside +application code it is important that the power controllers end up in +.o object files rather than in +.a library archive files.

    All the real work of a power controller is done by the mode change +function. If the power management package has been configured to use a +separate thread then this mode change function will be invoked by that +thread (except for the special case of power_set_controller_mode_now). +If no separate thread is used then the mode change function will be +invoked directly by power_set_mode or +power_set_controller_mode.

    The mode change function will be invoked with three arguments. The +first argument identifies the power controller. Usually this argument +is not actually required since a given mode change function will only +ever be invoked for a single power controller. For example, +xyzzy_device_power_mode_change will only ever be +used in conjunction with xyzzy_power_controller. +However there may be some packages which contain multiple controllers, +all of which can share a single mode change function, and in that case +it is essential to identify the specific controller. The second +argument specifies the mode the controller should switch to, if +possible: it will be one of PowerMode_Active, +PowerMode_Idle, PowerMode_Sleep +or PowerMode_Off. The final argument will be one of +PowerModeChange_Controller, +PowerModeChange_ControllerNow, or +PowerModeChange_Global, and identifies the call +that caused this invocation. For example, if the mode change function +was invoked because of a call to power_set_mode +then this argument will be PowerModeChange_Global. +It is up to each controller to decide how to interpret this final +argument. A typical controller might reject a global request to switch +to off mode if the associated device is still busy, but +if the request was aimed specifically at this controller then it could +instead abort any current I/O operations and switch off the device.

    The PowerController data structure contains +one field, mode, that needs to be updated +by the power mode change function. At all times it should indicate the +current mode for this controller. When a mode change is requested the +desired mode is passed as the second argument. The exact operation of +the power mode change function depends very much on what is being +controlled and the current circumstances, but some guidelines are +possible:

    1. If the request can be satisfied without obvious detriment, do so and +update the mode field. Reducing the power +consumption of a device that is not currently being used is generally +harmless.

    2. If a request is a no-op, for example if the system is switching +from idle to sleep mode and the controller +does not distinguish between these modes, simply act as if the request +was satisfied.

    3. If a request is felt to be unsafe, for example shutting down a +device that is still in use, then the controller may decide +to reject this request. This is especially true if the request was a +global mode change as opposed to one intended specifically for this +controller: in the latter case the policy module should be given due +deference. There are a number of ways in which a request can be +rejected:

      1. If the request cannot be satisfied immediately but may be feasible in +a short while, leave the mode field +unchanged. Higher-level code in the policy module can interpret this +as a hint to retry the operation a little bit later. This approach is +also useful if the mode change can be started but will take some time +to complete, for example shutting down a socket connection, and +additional processing will be needed later on.

      2. If the request is felt to be inappropriate, for example switching off +a device that is still in use, the mode change function can +call power_set_controller_mode to reset the +desired mode for this controller back to the current mode. +Higher-level code can then interpret this as a hint that there is more +activity in the system than had been apparent.

      3. For a global mode change, if the new mode is felt to be inappropriate +then the power controller can call power_set_mode +to indicate this. An example of this would be the policy module +deciding to switch off the whole unit while there is still I/O +activity.

    Mode change functions should not directly manipulate any other fields +in the PowerController data structure. If it +is necessary to keep track of additional data then static variables +can be used.

    It should be noted that the above are only guidelines. Their +application in any given situation may be unclear. In addition the +detailed requirements of specific systems will vary, so even if the +power controller for a given device driver follows the above +guidelines exactly it may turn out that slightly different behaviour +would be more appropriate for the actual system that is being +developed. Fortunately the open source nature of +eCos allows system developers to fine-tune +power controllers to meet their exact requirements.


    PrevHome 
    Attached and Detached Controllers  
    \ No newline at end of file diff --git a/packages/services/power/common/current/doc/power-info.html b/packages/services/power/common/current/doc/power-info.html new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/doc/power-info.html @@ -0,0 +1,486 @@ + + + + + + + + + + + +Power Management Information +
    eCos Power Management Support
    PrevNext

    Power Management Information

    Name

    Obtaining Power Management Information -- finding out about the various power controllers in the system

    Synopsis

    #include <cyg/power/power.h>
    +
    +extern PowerController __POWER__[], __POWER_END__;
    +extern PowerController power_controller_cpu;
    +extern cyg_handle_t    power_thread_handle;

    PowerMode power_get_mode + (void);

    PowerMode power_get_desired_mode + (void);

    PowerMode power_get_controller_mode + ( PowerController* controller + );

    PowerMode power_get_controller_desired_mode + ( PowerController* controller + );

    const char* power_get_controller_id + ( PowerController* controller + );

    Accessing Power Controllers

    All the power controllers in a system are held in a table, filled in +at link-time. The symbols __POWER__ and +__POWER_END can be used to iterate through this +table, for example:

    PowerController* controller;
    +for (controller  = &(__POWER__[0]);
    +     controller != &(__POWER_END__);
    +     controller++) {
    +
    +     …
    +}

    Each controller has an associated priority, controlling the order in +which they appear in the table. Typically a software-only component +such as a TCP/IP stack would use a small number for the priority, so +that it appears near the start of the table, whereas a device driver +would be nearer the back of the table. When switching to a +lower-powered mode the power management package will iterate through +this table from front to back, thus ensuring that for example the +TCP/IP stack gets a chance to shut down before the underlying ethernet +or other hardware that the stack depends on. Similarly when switching +to a higher-powered mode the power management package will iterate +through this table from back to front.

    In most systems there will be one special controller, +power_controller_cpu, which should be provided by +one of the architectural, variant or platform HAL packages. This +controller will always be the last entry in the table. It is +responsible for the final power down operation when switching to +off mode. Other packages such as device drivers may or +may not declare variable identifiers for their power controllers, +allowing those controllers to be accessed by name as well as by their +entries in the global table.

    Global Power Modes

    The function power_get_mode can be called at any +time to determine the current power mode for the system as a whole. +The return value will be one of PowerMode_Active, +PowerMode_Idle, PowerMode_Sleep +or PowerMode_Off. In normal circumstances it is +unlikely that PowerMode_Off would be returned since +that mode generally means that the cpu is no longer running.

    The function power_get_desired_mode returns the +power mode that the system should be running at. Most of the time this +will be the same value as returned by +power_get_mode. However a different value may be +returned when in the middle of changing power modes. For example, if +the current thread runs at a higher priority than the power management +thread then the latter may have been pre-empted in the middle of a +mode change: power_get_mode will return the mode +the system was running at before the mode change started, and +power_get_desired_mode will return the mode the +system should end up in when the mode change completes, barring +further calls to power_set_mode.

    Individual Controller Power Modes

    The power management package keeps track of the current and desired +modes for each power controller, as well as the modes for the system as +a whole. The function power_get_controller_mode +takes a single argument, a pointer to a power controller, and returns +the power mode that controller is currently running at. Similarly +power_get_controller_desired_mode returns the +power mode that controller should be running at. Most of the time the +current and desired modes for a given controller will be the same, and +will also be the same as the global power mode. However if the power +management thread is preeempted in the middle of a mode change then +some of the controllers will have been updated to the desired global +mode, whereas others will still be at the old mode. The power +management package also provides functionality for manipulating +individual controllers, and for detaching controllers from +global mode changes.

    Power Controller Identification

    In some scenarios the power management package will run completely +automated, and there is no need to identify individual power +controllers. Any form of identification such as a string +description would serve no purpose, but would still consume memory in +the final system. In other scenarios it may be very desirable to +provide some means of identification. For example, while still +debugging it may be useful to see a simple string when printing the +contents of a power controller structure. Alternatively, if the +application is expected to provide some sort of user interface that +gives control over which parts of the system are enabled or disabled, +a string identifier for each controller would be useful. To cope with +these scenarios the power management package provides a configuration +option CYGIMP_POWER_PROVIDE_STRINGS. When enabled, +each power controller will contain a pointer to a constant string +which can be accessed via a function +power_get_controller_id. When disabled the system +will not contain these strings, and the function will not be provided. +The following code illustrates how to use this function.

    #include <stdio.h>
    +#include <pkgconf/system.h>
    +#ifndef CYGPKG_POWER
    +# error The power management package is not present.
    +#endif
    +#include <pkgconf/power.h>
    +#ifndef CYGIMP_POWER_PROVIDE_STRINGS
    +# error Power controller identifiers are not available.
    +#endif
    +#include <cyg/power/power.h>
    +
    +static const char*
    +mode_to_string(PowerMode mode)
    +{
    +    const char* result;
    +    switch(mode) {
    +      case PowerMode_Active : result = "active"; break;
    +      case PowerMode_Idle   : result = "idle"; break;
    +      case PowerMode_Sleep  : result = "sleep"; break;
    +      case PowerMode_Off    : result = "off"; break;
    +      default               : result = "<unknown>"; break;
    +    }
    +    return result;
    +}
    +
    +int
    +main(int argc, char** argv)
    +{
    +    PowerController* controller;
    +
    +    for (controller = &(__POWER__[0]);
    +         controller != &(__POWER_END__);
    +         controller++) {
    +        printf("Controller @ %p: %s, %s\n", controller,
    +               power_get_controller_id(controller),
    +               mode_to_string(power_get_controller_mode(controller)));
    +    }
    +    return 0;
    +}

    The Power Management Thread

    If the power management package is configured to use a separate thread +then a handle for that thread is made available to higher-level code +via the variable power_thread_handle. This handle +can be used for a variety of purposes, including manipulating that +thread's priority.


    PrevHomeNext
    Introduction Changing Power Modes
    \ No newline at end of file diff --git a/packages/services/power/common/current/doc/power-intro.html b/packages/services/power/common/current/doc/power-intro.html new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/doc/power-intro.html @@ -0,0 +1,553 @@ + + + + + + + + + + + +Introduction +
    eCos Power Management Support
    PrevNext

    Introduction

    Name

    Introduction -- eCos support for Power Management

    Introduction

    The eCos Power Management package provides a framework for +incorporating power management facilities in an embedded application. +However its functionality is deliberately limited.

    1. The package does not contain any support for controlling the current +power mode of any given processor, device or board. Instead it is the +responsibility of the appropriate HAL or device driver package to +implement such support, by implementing power +controllers. The power management package groups these +power controllers together and provides an interface for manipulating +them.

    2. The package does not contain any power management policy support. +Specifically, including this package in an application does not by +itself ever cause the system to go into low-power mode. Instead it is +the responsibility of a separate policy module, provided by +higher-level application code or by some other package, to decide when +it would be appropriate to switch from one power mode to another. The +power management package then provides the mechanisms for making it +happen.

    Including Power Management

    The power management package is never included automatically in an +eCos configuration: it is not part of any target specification or of +any template. Instead it must be added explicitly to a configuration +if the intended application requires power management functionality. +When using the command-line ecosconfig tool this +can be achieved using a command such as:

    $ ecosconfig add power

    The generic eCos user documentation should be consulted for more +information on how to use the various tools. The functionality +provided by the power management package is defined in the header file +cyg/power/power.h. This header +file can be used by both C and C++ code.

    Power Modes

    There are four defined modes of operation:

    active

    The system is fully operational, and power consumption is expected to +be high.

    idle

    There has been little or no activity for a short period of time. It is +up to the policy module to determine what constitutes a short period +of time, but typically it will be some tenths of a second or some +small number of seconds. A possible action when entering idle mode is +to reduce the system's clock speed, thus reducing the power drawn by +the cpu.

    Note that typically this power mode is not entered automatically +whenever the idle thread starts running. Instead it is entered when +the policy module discovers that for a certain period of time the +system has been spending most of its time in the idle thread. +Theoretically it is possible to implement a policy module that would +cause a switch to idle mode as soon as the idle thread starts running, +but that could result in a great many power mode changes for no +immediate benefit.

    sleep

    The system has been idle for a significant period of time, perhaps +some tens of seconds. It is desirable to shut down any hardware that +is drawing a significant amount of power, for example a screen +backlight.

    off

    The system is powered down. Power consumption should be minimized. +Some special action may be needed before the system comes back up, for +example the user may need to press a specific button.

    The exact transitions that will happen are decided by the policy +module. One policy module might include transitions from active to +idle, from idle to sleep, from sleep to off, and from any of idle, +sleep or off directly back to active. Another policy module might +only use the active and off states, bypassing the intermediate ones.

    Power Controllers

    The power management package operates primarily on power controllers. +The main functionality provided by a power controller is to switch the +power mode for some part of the system, for example the lcd display or +the cpu. A power controller consists primarily of a function which +will be invoked to switch the power mode for the part of the overall +system being controlled, plus some auxiliary data. A typical system +will include a number of different power controllers:

    1. Usually there will be one power controller +power_controller_cpu associated with the processor +or with the target platform, and provided by the corresponding HAL +package. It is this controller which is responsible for switching off +the system when entering the off mode, which makes it +somewhat special: attempting to switch off the cpu before other +devices like the lcd display does not make sense because the cpu would +no longer be executing any instructions for the latter operation. +Therefore this power controller has to be invoked last when switching +to a lower-power mode, and similarly when switching back to a +higher-power mode it will be invoked first.

      It should be noted that providing power management support is not a +hard requirement when porting eCos to a new processor or platform, and +many eCos ports predate the availability of power management support. +Therefore for any given platform it is distinctly possible that +power_controller_cpu is not yet provided, and if +full power management functionality is desired then the appropriate +HAL package would have to be extended first. System developers should +examine the relevant HAL documentation and sources to determine what +is actually available.

    2. Some or all of the device drivers will supply their own power +controllers, as part of the device driver package. It is not required +that all device drivers provide power controllers. In some cases, +especially for devices that are integrated with the processor, +power_controller_cpu will take care of the +integrated devices as a side effect. In other cases the hardware may +not provide any functionality that allows power consumption to be +controlled. For any given device driver it is also possible that no +power controller exists either because it was not required when the +driver was written, or because the driver predates the availability of +power management. Again the relevant documentation and sources should +be consulted for further information.

    3. There may be power controllers which are not associated directly with +any specific hardware. For example a TCP/IP stack could provide a +power controller so that it gets informed when the system has been +reactivated: by looking at the system clock it can determine for how +long the system has been switched off; using this information it can +then recover from expired dhcp leases, or even to shut down any stream +connections that may have become invalid (although arguably the stack +should have refused to go to off mode while there were +open connections).

    Basic Operation

    By default the Power Management package creates a thread during +initialization. It is also possible for the package to be used without +such a thread, for example in configurations which do not include a +full kernel, and this alternative is described below. When a separate +thread is used the stacksize and priority for this thread can be +controlled by configuration options +CYGNUM_POWER_THREAD_STACKSIZE and +CYGNUM_POWER_THREAD_PRIORITY. Typically the thread +will just wait on a semaphore internal to the package, and will do +nothing until some other part of the system requests a change to the +power mode.

    At some point the policy module will decide that the system should +move into a lower-power mode, for example from active to idle. This is +achieved by calling the function power_set_mode, +provided by the power management package and declared in cyg/power/power.h, with a single +argument, PowerMode_Idle. This function manipulates +some internal state and posts the semaphore, thus waking up the power +management thread. Note that the function returns before the mode +change has completed, and in fact depending on thread priorities this +return may happen before any power controller has been invoked.

    When the power management thread wakes up it examines the internal +state to figure out what it should be doing. In this case it is +supposed to change the global power mode, so it will iterate over all +the power controllers requesting each one to switch to the +idle mode. It is up to each power controller to handle +this request appropriately. Optionally the thread will invoke a +callback function after processing each power controller, so that +higher-level code such as the policy module can more easily keep +track of the actual state of each controller. Once the thread has +iterated through all the power controllers it will again wait on the +internal semaphore for the next request to arrive.

    Note: At present the power management thread always runs at a single +priority, which defaults to a low priority. A possible future +enhancement would be to support two separate priorities. When +switching to a lower-powered mode the thread would run at a low +priority as before, thus allowing other threads to run and get a +chance to cancel this mode change. When switching to a higher-powered +mode the thread would run at a high priority. This could be especially +important when moving out of the off state: for example +it would ensure that all device drivers get a chance to wake up before +ordinary application threads get to run again and possibly attempt I/O +operations.

    Although usually calls to power_set_mode will +come from just one place in the policy module, this is not a hard +requirement. It is possible for multiple threads to call this +function, with no need for any synchronization. If the power +management thread is in the middle of performing a mode change and a +new request comes in, the thread will detect this, abort the current +operation, and start iterating through the power controllers again +with the new mode. This check happens between every power controller +invocation. Usefully this makes it possible for power controllers +themselves to manipulate power modes: a power controller is invoked to +change mode; for some reason it determines that the new mode is +inappropriate; it calls power_set_mode to move +the system back to another mode; when the power controller returns +this event will be detected; the power management thread will abort +the current mode change, and start the new one.

    In addition to changing the power mode for the system as a whole, +individual controllers can be manipulated using the function +power_set_controller_mode. For example, while the +system as a whole might be in active mode certain devices +might be kept in sleep mode until they are explicitly +activated. It is possible to mix concurrent calls to +power_set_mode and +power_set_controller_mode, and when a power +controller is invoked it may use +power_set_controller_mode to request further +changes to its own or to another controller's mode as required.

    There are some scenarios where the power management package should not +use its own thread. One scenario is if the configuration is +specifically for a single-threaded application such as RedBoot. +Another scenario is if the policy module already involves a separate +thread: it may make more sense if the various power management +operations are synchronous with respect to the calling thread. The use +of a separate thread inside the power management package is controlled +by the configuration option CYGPKG_POWER_THREAD, +which is active only if the kernel package is present and enabled by +default.

    If no separate power management thread is used then obviously the +implementations of power_set_mode and +power_set_controller_mode will be somewhat +different: instead of waking up a separate thread to do the work, +these functions will now manipulate the power controllers directly. If +the system does still involve multiple threads then only one thread +may call power_set_mode or +power_set_controller_mode at a time: the power +management package will not provide any synchronization, that must +happen at a higher level. However when a power controller is invoked +it can still call these functions as required.


    PrevHomeNext
    eCos Power Management Support Power Management Information
    \ No newline at end of file diff --git a/packages/services/power/common/current/doc/power-policy.html b/packages/services/power/common/current/doc/power-policy.html new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/doc/power-policy.html @@ -0,0 +1,408 @@ + + + + + + + + + + + +Support for Policy Modules +
    eCos Power Management Support
    PrevNext

    Support for Policy Modules

    Name

    Support for Policy Modules -- closer integration with higher-level code

    Synopsis

    #include <cyg/power/power.h>

    void power_set_policy_callback + ( void (*)(PowerController*, PowerMode, PowerMode, PowerMode, PowerMode) callback + );

    void (*)(PowerController*, PowerMode, PowerMode, PowerMode, PowerMode) power_get_policy_callback + (void);

    CYG_ADDRWORD power_get_controller_policy_data + ( PowerController* controller + );

    void power_set_controller_policy_data + ( PowerController* controller + , CYG_ADDRWORD data + );

    Policy Callbacks

    The use of a separate thread to perform power mode changes in typical +configurations can cause problems for some policy modules. +Specifically, the policy module can request a mode change for the +system as a whole or for an individual controller, but it does not +know when the power management thread actually gets scheduled to run +again and carry out the request. Although it would be possible for the +policy module to perform some sort of polling, in general that is +undesirable.

    To avoid such problems the policy module can install a callback +function using power_set_policy_callback. The +current callback function can be retrieved using +power_get_policy_callback. If a callback function +has been installed then it will be called by the power management +package whenever a power controller has been invoked to perform a mode +change. The callback will be called in the context of the power +management thread, so usually it will have to make use of thread +synchronisation primitives to interact with the main policy module. It +is passed five arguments:

    1. The power controller that has just been invoked to perform a mode +change.

    2. The mode this controller was running at before the invocation.

    3. The current mode this controller is now running at.

    4. The desired mode before the power controller was invoked. Usually this +will be the same as the current mode, unless the controller has +decided for some reason that this was inappropriate.

    5. The current desired mode. This will differ from the previous argument +only if there has was another call to +power_set_mode or +power_set_controller_mode while the power +controller was being invoked, probably by the power controller itself.

    A simple example of a policy callback function would be:

    static void
    +power_callback(
    +    PowerController* controller,
    +    PowerMode old_mode,
    +    PowerMode new_mode,
    +    PowerMode old_desired_mode,
    +    powerMode new_desired_mode)
    +{
    +    printf("Power mode change: %s, %s -> %d\n",
    +        power_get_controller_id(controller),
    +        mode_to_string(old_mode),
    +        mode_to_string(new_mode));
    +
    +    CYG_UNUSED_PARAM(PowerMode, old_desired_mode);
    +    CYG_UNUSED_PARAM(PowerMode, new_desired_mode);
    +}
    +
    +int
    +main(int argc, char** argv)
    +{
    +    …
    +    power_set_policy_callback(&power_callback);
    +    …
    +}

    If power_set_controller_mode_now is used to +manipulate an individual controller the policy callback will not be +invoked. This function may get called from any context including DSRs, +and even if there is already a call to the policy callback happening +in some other context, so invoking the callback would usually be +unsafe.

    If the power management package has not been configured to use a +separate thread then power_set_mode and +power_set_controller_mode will manipulate the +power controllers immediately and invoke the policy callback +afterwards. Therefore the policy callback will typically run in the +same context as the main policy module.

    Policy-specific Controller Data

    Some policy modules may want to associate some additional data with +each power controller. This could be achieved by for example +maintaining a hash table or similar data structure, but for +convenience the power management package allows higher-level code, +typically the policy module, to store and retrieve one word of data in +each power controller. The function +power_set_controller_policy_data takes two +arguments, a pointer to a power controller and a +CYG_ADDRWORD of data: by appropriate use of casts this +word could be an integer or a pointer to some data structure. The +matching function +power_get_controller_policy_data retrieves the +word previously installed, and can be cast back to an integer or +pointer. The default value for the policy data is 0.

    For example the following code fragment stores a simple index value in +each power controller. This could then be retrieved by the policy +callback.

        unsigned int     i = 0;
    +    PowerController* controller;
    +
    +    for (controller = &(__POWER__[0]);
    +         controller != &(__POWER_END__);
    +         controller++) {
    +        power_set_controller_policy_data(controller, (CYG_ADDRWORD) i++);
    +    }

    Not all policy modules will require per-controller data. The +configuration option +CYGIMP_POWER_PROVIDE_POLICY_DATA can be used to +control this functionality, thus avoiding wasting a small amount of +memory inside each power controller structure.


    PrevHomeNext
    Changing Power Modes Attached and Detached Controllers
    \ No newline at end of file diff --git a/packages/services/power/common/current/doc/power.sgml b/packages/services/power/common/current/doc/power.sgml new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/doc/power.sgml @@ -0,0 +1,1437 @@ + + + + + + + + + + + +####ECOSGPLCOPYRIGHTBEGIN#### + ------------------------------------------- + This file is part of eCos, the Embedded Configurable Operating System. + Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + + eCos is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 or (at your option) any later version. + + eCos is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with eCos; if not, write to the Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + + As a special exception, if other files instantiate templates or use macros + or inline functions from this file, or you compile this file and link it + with other works to produce a work based on this file, this file does not + by itself cause the resulting work to be covered by the GNU General Public + License. However the source code for this file must still be made available + in accordance with section (3) of the GNU General Public License. + + This exception does not invalidate any other reasons why a work based on + this file might be covered by the GNU General Public License. + + Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. + at http://sources.redhat.com/ecos/ecos-license + ------------------------------------------- +####ECOSGPLCOPYRIGHTEND#### + + + + + + + + + + + + + + + eCos Power Management Support + + + + + +Introduction + + +Introduction +eCos support for Power Management + + + + + +Introduction + +The eCos Power Management package provides a framework for +incorporating power management facilities in an embedded application. +However its functionality is deliberately limited. + + + + +The package does not contain any support for controlling the current +power mode of any given processor, device or board. Instead it is the +responsibility of the appropriate HAL or device driver package to +implement such support, by implementing power +controllers. The power management package groups these +power controllers together and provides an interface for manipulating +them. + + + + +The package does not contain any power management policy support. +Specifically, including this package in an application does not by +itself ever cause the system to go into low-power mode. Instead it is +the responsibility of a separate policy module, provided by +higher-level application code or by some other package, to decide when +it would be appropriate to switch from one power mode to another. The +power management package then provides the mechanisms for making it +happen. + + + + + + + + + +Including Power Management + +The power management package is never included automatically in an +eCos configuration: it is not part of any target specification or of +any template. Instead it must be added explicitly to a configuration +if the intended application requires power management functionality. +When using the command-line ecosconfig tool this +can be achieved using a command such as: + + +$ ecosconfig add power + + +The generic eCos user documentation should be consulted for more +information on how to use the various tools. The functionality +provided by the power management package is defined in the header file +cyg/power/power.h. This header +file can be used by both C and C++ code. + + + + + + + + +Power Modes + +There are four defined modes of operation: + + + +active + + +The system is fully operational, and power consumption is expected to +be high. + + + + +idle + + +There has been little or no activity for a short period of time. It is +up to the policy module to determine what constitutes a short period +of time, but typically it will be some tenths of a second or some +small number of seconds. A possible action when entering idle mode is +to reduce the system's clock speed, thus reducing the power drawn by +the cpu. + + +Note that typically this power mode is not entered automatically +whenever the idle thread starts running. Instead it is entered when +the policy module discovers that for a certain period of time the +system has been spending most of its time in the idle thread. +Theoretically it is possible to implement a policy module that would +cause a switch to idle mode as soon as the idle thread starts running, +but that could result in a great many power mode changes for no +immediate benefit. + + + + +sleep + + +The system has been idle for a significant period of time, perhaps +some tens of seconds. It is desirable to shut down any hardware that +is drawing a significant amount of power, for example a screen +backlight. + + + + +off + + +The system is powered down. Power consumption should be minimized. +Some special action may be needed before the system comes back up, for +example the user may need to press a specific button. + + + + + + + +The exact transitions that will happen are decided by the policy +module. One policy module might include transitions from active to +idle, from idle to sleep, from sleep to off, and from any of idle, +sleep or off directly back to active. Another policy module might +only use the active and off states, bypassing the intermediate ones. + + + + + + + + +Power Controllers + +The power management package operates primarily on power controllers. +The main functionality provided by a power controller is to switch the +power mode for some part of the system, for example the lcd display or +the cpu. A power controller consists primarily of a function which +will be invoked to switch the power mode for the part of the overall +system being controlled, plus some auxiliary data. A typical system +will include a number of different power controllers: + + + + +Usually there will be one power controller +power_controller_cpu associated with the processor +or with the target platform, and provided by the corresponding HAL +package. It is this controller which is responsible for switching off +the system when entering the off mode, which makes it +somewhat special: attempting to switch off the cpu before other +devices like the lcd display does not make sense because the cpu would +no longer be executing any instructions for the latter operation. +Therefore this power controller has to be invoked last when switching +to a lower-power mode, and similarly when switching back to a +higher-power mode it will be invoked first. + + +It should be noted that providing power management support is not a +hard requirement when porting eCos to a new processor or platform, and +many eCos ports predate the availability of power management support. +Therefore for any given platform it is distinctly possible that +power_controller_cpu is not yet provided, and if +full power management functionality is desired then the appropriate +HAL package would have to be extended first. System developers should +examine the relevant HAL documentation and sources to determine what +is actually available. + + + + +Some or all of the device drivers will supply their own power +controllers, as part of the device driver package. It is not required +that all device drivers provide power controllers. In some cases, +especially for devices that are integrated with the processor, +power_controller_cpu will take care of the +integrated devices as a side effect. In other cases the hardware may +not provide any functionality that allows power consumption to be +controlled. For any given device driver it is also possible that no +power controller exists either because it was not required when the +driver was written, or because the driver predates the availability of +power management. Again the relevant documentation and sources should +be consulted for further information. + + + + +There may be power controllers which are not associated directly with +any specific hardware. For example a TCP/IP stack could provide a +power controller so that it gets informed when the system has been +reactivated: by looking at the system clock it can determine for how +long the system has been switched off; using this information it can +then recover from expired dhcp leases, or even to shut down any stream +connections that may have become invalid (although arguably the stack +should have refused to go to off mode while there were +open connections). + + + + + + + + + +Basic Operation + +By default the Power Management package creates a thread during +initialization. It is also possible for the package to be used without +such a thread, for example in configurations which do not include a +full kernel, and this alternative is described below. When a separate +thread is used the stacksize and priority for this thread can be +controlled by configuration options +CYGNUM_POWER_THREAD_STACKSIZE and +CYGNUM_POWER_THREAD_PRIORITY. Typically the thread +will just wait on a semaphore internal to the package, and will do +nothing until some other part of the system requests a change to the +power mode. + + +At some point the policy module will decide that the system should +move into a lower-power mode, for example from active to idle. This is +achieved by calling the function power_set_mode, +provided by the power management package and declared in cyg/power/power.h, with a single +argument, PowerMode_Idle. This function manipulates +some internal state and posts the semaphore, thus waking up the power +management thread. Note that the function returns before the mode +change has completed, and in fact depending on thread priorities this +return may happen before any power controller has been invoked. + + +When the power management thread wakes up it examines the internal +state to figure out what it should be doing. In this case it is +supposed to change the global power mode, so it will iterate over all +the power controllers requesting each one to switch to the +idle mode. It is up to each power controller to handle +this request appropriately. Optionally the thread will invoke a +callback function after processing each power controller, so that +higher-level code such as the policy module can more easily keep +track of the actual state of each controller. Once the thread has +iterated through all the power controllers it will again wait on the +internal semaphore for the next request to arrive. + + + +At present the power management thread always runs at a single +priority, which defaults to a low priority. A possible future +enhancement would be to support two separate priorities. When +switching to a lower-powered mode the thread would run at a low +priority as before, thus allowing other threads to run and get a +chance to cancel this mode change. When switching to a higher-powered +mode the thread would run at a high priority. This could be especially +important when moving out of the off state: for example +it would ensure that all device drivers get a chance to wake up before +ordinary application threads get to run again and possibly attempt I/O +operations. + + + +Although usually calls to power_set_mode will +come from just one place in the policy module, this is not a hard +requirement. It is possible for multiple threads to call this +function, with no need for any synchronization. If the power +management thread is in the middle of performing a mode change and a +new request comes in, the thread will detect this, abort the current +operation, and start iterating through the power controllers again +with the new mode. This check happens between every power controller +invocation. Usefully this makes it possible for power controllers +themselves to manipulate power modes: a power controller is invoked to +change mode; for some reason it determines that the new mode is +inappropriate; it calls power_set_mode to move +the system back to another mode; when the power controller returns +this event will be detected; the power management thread will abort +the current mode change, and start the new one. + + +In addition to changing the power mode for the system as a whole, +individual controllers can be manipulated using the function +power_set_controller_mode. For example, while the +system as a whole might be in active mode certain devices +might be kept in sleep mode until they are explicitly +activated. It is possible to mix concurrent calls to +power_set_mode and +power_set_controller_mode, and when a power +controller is invoked it may use +power_set_controller_mode to request further +changes to its own or to another controller's mode as required. + + +There are some scenarios where the power management package should not +use its own thread. One scenario is if the configuration is +specifically for a single-threaded application such as RedBoot. +Another scenario is if the policy module already involves a separate +thread: it may make more sense if the various power management +operations are synchronous with respect to the calling thread. The use +of a separate thread inside the power management package is controlled +by the configuration option CYGPKG_POWER_THREAD, +which is active only if the kernel package is present and enabled by +default. + + +If no separate power management thread is used then obviously the +implementations of power_set_mode and +power_set_controller_mode will be somewhat +different: instead of waking up a separate thread to do the work, +these functions will now manipulate the power controllers directly. If +the system does still involve multiple threads then only one thread +may call power_set_mode or +power_set_controller_mode at a time: the power +management package will not provide any synchronization, that must +happen at a higher level. However when a power controller is invoked +it can still call these functions as required. + + + + + + + + + + + + +Power Management Information + + +Obtaining Power Management Information +finding out about the various power controllers in the system + + + + + +#include <cyg/power/power.h> + +extern PowerController __POWER__[], __POWER_END__; +extern PowerController power_controller_cpu; +extern cyg_handle_t power_thread_handle; + + + + + PowerMode power_get_mode + + + + + + PowerMode power_get_desired_mode + + + + + + PowerMode power_get_controller_mode + + + PowerController* controller + + + + + PowerMode power_get_controller_desired_mode + + + PowerController* controller + + + + + const char* power_get_controller_id + + + PowerController* controller + + + + + + +Accessing Power Controllers + +All the power controllers in a system are held in a table, filled in +at link-time. The symbols __POWER__ and +__POWER_END can be used to iterate through this +table, for example: + + +PowerController* controller; +for (controller = &(__POWER__[0]); + controller != &(__POWER_END__); + controller++) { + + … +} + + +Each controller has an associated priority, controlling the order in +which they appear in the table. Typically a software-only component +such as a TCP/IP stack would use a small number for the priority, so +that it appears near the start of the table, whereas a device driver +would be nearer the back of the table. When switching to a +lower-powered mode the power management package will iterate through +this table from front to back, thus ensuring that for example the +TCP/IP stack gets a chance to shut down before the underlying ethernet +or other hardware that the stack depends on. Similarly when switching +to a higher-powered mode the power management package will iterate +through this table from back to front. + + +In most systems there will be one special controller, +power_controller_cpu, which should be provided by +one of the architectural, variant or platform HAL packages. This +controller will always be the last entry in the table. It is +responsible for the final power down operation when switching to +off mode. Other packages such as device drivers may or +may not declare variable identifiers for their power controllers, +allowing those controllers to be accessed by name as well as by their +entries in the global table. + + + + +Global Power Modes + +The function power_get_mode can be called at any +time to determine the current power mode for the system as a whole. +The return value will be one of PowerMode_Active, +PowerMode_Idle, PowerMode_Sleep +or PowerMode_Off. In normal circumstances it is +unlikely that PowerMode_Off would be returned since +that mode generally means that the cpu is no longer running. + + +The function power_get_desired_mode returns the +power mode that the system should be running at. Most of the time this +will be the same value as returned by +power_get_mode. However a different value may be +returned when in the middle of changing power modes. For example, if +the current thread runs at a higher priority than the power management +thread then the latter may have been pre-empted in the middle of a +mode change: power_get_mode will return the mode +the system was running at before the mode change started, and +power_get_desired_mode will return the mode the +system should end up in when the mode change completes, barring +further calls to power_set_mode. + + + + +Individual Controller Power Modes + +The power management package keeps track of the current and desired +modes for each power controller, as well as the modes for the system as +a whole. The function power_get_controller_mode +takes a single argument, a pointer to a power controller, and returns +the power mode that controller is currently running at. Similarly +power_get_controller_desired_mode returns the +power mode that controller should be running at. Most of the time the +current and desired modes for a given controller will be the same, and +will also be the same as the global power mode. However if the power +management thread is preeempted in the middle of a mode change then +some of the controllers will have been updated to the desired global +mode, whereas others will still be at the old mode. The power +management package also provides functionality for manipulating + +individual controllers, and for detaching controllers from +global mode changes. + + + + +Power Controller Identification + +In some scenarios the power management package will run completely +automated, and there is no need to identify individual power +controllers. Any form of identification such as a string +description would serve no purpose, but would still consume memory in +the final system. In other scenarios it may be very desirable to +provide some means of identification. For example, while still +debugging it may be useful to see a simple string when printing the +contents of a power controller structure. Alternatively, if the +application is expected to provide some sort of user interface that +gives control over which parts of the system are enabled or disabled, +a string identifier for each controller would be useful. To cope with +these scenarios the power management package provides a configuration +option CYGIMP_POWER_PROVIDE_STRINGS. When enabled, +each power controller will contain a pointer to a constant string +which can be accessed via a function +power_get_controller_id. When disabled the system +will not contain these strings, and the function will not be provided. +The following code illustrates how to use this function. + + +#include <stdio.h> +#include <pkgconf/system.h> +#ifndef CYGPKG_POWER +# error The power management package is not present. +#endif +#include <pkgconf/power.h> +#ifndef CYGIMP_POWER_PROVIDE_STRINGS +# error Power controller identifiers are not available. +#endif +#include <cyg/power/power.h> + +static const char* +mode_to_string(PowerMode mode) +{ + const char* result; + switch(mode) { + case PowerMode_Active : result = "active"; break; + case PowerMode_Idle : result = "idle"; break; + case PowerMode_Sleep : result = "sleep"; break; + case PowerMode_Off : result = "off"; break; + default : result = "<unknown>"; break; + } + return result; +} + +int +main(int argc, char** argv) +{ + PowerController* controller; + + for (controller = &(__POWER__[0]); + controller != &(__POWER_END__); + controller++) { + printf("Controller @ %p: %s, %s\n", controller, + power_get_controller_id(controller), + mode_to_string(power_get_controller_mode(controller))); + } + return 0; +} + + + +The Power Management Thread + +If the power management package is configured to use a separate thread +then a handle for that thread is made available to higher-level code +via the variable power_thread_handle. This handle +can be used for a variety of purposes, including manipulating that +thread's priority. + + + + + + + + + + +Changing Power Modes + + +Changing Power Modes +reducing or increasing power consumption as needed + + + + + +#include <cyg/power/power.h> + + + + + void power_set_mode + + + PowerMode new_mode + + + + + void power_set_controller_mode + + + PowerController* controller + + + PowerMode new_mode + + + + + void power_set_controller_mode_now + + + PowerController* controller + + + PowerMode new_mode + + + + + + +Changing the Global Power Mode + +The primary functionality supported by the power management package is +to change the system's global power mode. This is achieved by calling +the function power_set_mode with a single +argument, which should be one of PowerMode_Active, +PowerMode_Idle, PowerMode_Sleep +or PowerMode_Off. Typically this function will only +be invoked in certain scenarios: + + + + +A typical system will contain a policy module which is primarily +responsible for initiating power mode changes, and a thread inside the +power management package. The policy module will call +power_set_mode, which has the effect of +manipulating some internal state in the power management package and +waking up its thread. When this thread gets scheduled to run (its +priority is controlled by a configuration option), it will iterate +over the power controllers and invoke each controller to change its +power mode. There is support for a callback function, and for +detached power controllers. + + + + +After a call to power_set_mode but before the +power management thread has had a chance to iterate over all the +controllers, or even before the thread has been rescheduled at all, +the policy module may decide that a different power mode would be more +appropriate for the current situation and calls +power_set_mode again. This has the effect of +aborting the previous mode change, followed by the power management +thread iterating over the power controllers again for the new mode. + + + + +If there is no single policy module responsible for power mode +changes, any code can call power_set_mode. If +there are multiple calls in quick succession, earlier calls will +be aborted and the system should end up in the power mode +corresponding to the last call + + + + +As a special case, it is possible for a power controller to call +power_set_mode when invoked by the power +management thread. For example a power controller could decide that it +is inappropriate for the system to go to sleep because the device it +is associated with is still busy. The effect is as if the policy +module had called power_set_mode again before +the mode change had completed. + + + + +If the power management package has been configured not to use a +separate thread then obviously the behaviour is somewhat different. +The call to power_set_mode will now iterate over +the various power controllers immediately, rather than leaving this to +a separate thread, and the whole mode change completes before +power_set_mode returns. If some other thread or a +DSR calls power_set_mode concurrently the +behaviour of the system is undefined. However, it is still legal for a +power controller to call power_set_mode: +effectively this is a recursive call; it is detected by the system, +and internal state is updated; the recursive +power_set_mode call now returns, and when the +power controller returns back to the original +power_set_mode call it detects what has happened, +aborts the previous mode change, and starts a new mode change as +requested by the controller. + + +power_set_mode is normally invoked from thread +context. If a separate power management thread is used it can be +invoked safely from DSR context. If the system is configured not to +use such a thread, it may or may not be safe to invoke this function +from DSR context: essentially the function just iterates through +the various power controllers, and the documentation or source code of +each controller present in the current system will have to be examined +to determine whether or not this can happen safely in DSR context. +power_set_mode should never be invoked from +ISR context. + + + + +Manipulating an Individual Power Controller + +In some cases it is desirable to set the power mode of an individual +controller separately from the mode for the system as a whole. For +example if a device is not currently being used then the associated +power controller could be set to PowerMode_Off, +even while the system as a whole is still active. This can be achieved +by calling the function +power_set_controller_mode. It takes two +arguments: the first identifies a particular controller; the second +specifies the desired new power mode for that controller. The function +operates in much the same way as power_set_mode, +for example if a separate power management thread is being used then +power_set_controller_mode operates by +manipulating some internal state and waking up that thread. The +limitations are also much the same as for +power_set_mode, so for example +power_set_controller_mode should not be invoked +from inside ISRs. + + +Manipulating individual controllers is often used in conjunction with +the function power_set_controller_attached, +allowing the policy module to specify which controllers are affected +by global mode changes. + + + + +Direct Manipulation of a Power Controller + +In exceptional circumstances it may be necessary to invoke a power +controller directly, bypassing the power management thread and +higher-level functionality such as callback functions. The +function power_set_controller_mode_now allows +this. It takes two arguments, a controller and a mode, just like +power_set_controller_mode. + + +Use of power_set_controller_mode_now is +dangerous. For example no attempt is made to synchronise with any +other power mode changes that might be happening concurrently. A +possible use is when the system gets woken up out of +sleep mode: depending on the hardware, on which power +controllers are present, and on the application code it may be +necessary to wake up some power controllers immediately before the +system as a whole is ready to run again. + + + + + + + + + + +Support for Policy Modules + + +Support for Policy Modules +closer integration with higher-level code + + + + + +#include <cyg/power/power.h> + + + + + void power_set_policy_callback + + + void (*)(PowerController*, PowerMode, PowerMode, PowerMode, PowerMode) callback + + + + + void (*)(PowerController*, PowerMode, PowerMode, PowerMode, PowerMode) power_get_policy_callback + + + + + + CYG_ADDRWORD power_get_controller_policy_data + + + PowerController* controller + + + + + void power_set_controller_policy_data + + + PowerController* controller + + + CYG_ADDRWORD data + + + + + + + +Policy Callbacks + +The use of a separate thread to perform power mode changes in typical +configurations can cause problems for some policy modules. +Specifically, the policy module can request a mode change for the +system as a whole or for an individual controller, but it does not +know when the power management thread actually gets scheduled to run +again and carry out the request. Although it would be possible for the +policy module to perform some sort of polling, in general that is +undesirable. + + +To avoid such problems the policy module can install a callback +function using power_set_policy_callback. The +current callback function can be retrieved using +power_get_policy_callback. If a callback function +has been installed then it will be called by the power management +package whenever a power controller has been invoked to perform a mode +change. The callback will be called in the context of the power +management thread, so usually it will have to make use of thread +synchronisation primitives to interact with the main policy module. It +is passed five arguments: + + + + +The power controller that has just been invoked to perform a mode +change. + + + + +The mode this controller was running at before the invocation. + + + + +The current mode this controller is now running at. + + + + +The desired mode before the power controller was invoked. Usually this +will be the same as the current mode, unless the controller has +decided for some reason that this was inappropriate. + + + + +The current desired mode. This will differ from the previous argument +only if there has was another call to +power_set_mode or +power_set_controller_mode while the power +controller was being invoked, probably by the power controller itself. + + + + +A simple example of a policy callback function would be: + + +static void +power_callback( + PowerController* controller, + PowerMode old_mode, + PowerMode new_mode, + PowerMode old_desired_mode, + powerMode new_desired_mode) +{ + printf("Power mode change: %s, %s -> %d\n", + power_get_controller_id(controller), + mode_to_string(old_mode), + mode_to_string(new_mode)); + + CYG_UNUSED_PARAM(PowerMode, old_desired_mode); + CYG_UNUSED_PARAM(PowerMode, new_desired_mode); +} + +int +main(int argc, char** argv) +{ + … + power_set_policy_callback(&power_callback); + … +} + + +If power_set_controller_mode_now is used to +manipulate an individual controller the policy callback will not be +invoked. This function may get called from any context including DSRs, +and even if there is already a call to the policy callback happening +in some other context, so invoking the callback would usually be +unsafe. + + +If the power management package has not been configured to use a +separate thread then power_set_mode and +power_set_controller_mode will manipulate the +power controllers immediately and invoke the policy callback +afterwards. Therefore the policy callback will typically run in the +same context as the main policy module. + + + + +Policy-specific Controller Data + +Some policy modules may want to associate some additional data with +each power controller. This could be achieved by for example +maintaining a hash table or similar data structure, but for +convenience the power management package allows higher-level code, +typically the policy module, to store and retrieve one word of data in +each power controller. The function +power_set_controller_policy_data takes two +arguments, a pointer to a power controller and a +CYG_ADDRWORD of data: by appropriate use of casts this +word could be an integer or a pointer to some data structure. The +matching function +power_get_controller_policy_data retrieves the +word previously installed, and can be cast back to an integer or +pointer. The default value for the policy data is 0. + + +For example the following code fragment stores a simple index value in +each power controller. This could then be retrieved by the policy +callback. + + + unsigned int i = 0; + PowerController* controller; + + for (controller = &(__POWER__[0]); + controller != &(__POWER_END__); + controller++) { + power_set_controller_policy_data(controller, (CYG_ADDRWORD) i++); + } + + +Not all policy modules will require per-controller data. The +configuration option +CYGIMP_POWER_PROVIDE_POLICY_DATA can be used to +control this functionality, thus avoiding wasting a small amount of +memory inside each power controller structure. + + + + + + + + + + +Attached and Detached Controllers + + +Attached and Detached Controllers +control which power controllers are affected by global changes + + + + + +#include <cyg/power/power.h> + + + + cyg_bool power_get_controller_attached + + + PowerController* controller + + + + + void power_set_controller_attached + + + PowerController* controller + + + cyg_bool new_state + + + + + + +Detaching Power Controllers + +By default the global operation power_set_mode +affects all power controllers. There may be circumstances when this is +not desirable. For example if a particular device is not currently +being used then it can be left switched off: the rest of the system +could be moving between active, idle and +sleep modes, but there is no point in invoking the power +controller for the unused device. To support this the power management +package supports the concept of attached and detached controllers. By +default all controllers are attached, and hence will be affected by +global mode changes. A specific controller can be detached using the +function power_set_controller_attached. This +function takes two arguments, one to specify a particular controller +and another to specify the desired new state. +power_get_controller_attached can be used to +determine whether or not a specific controller is currently attached. + + +The attached or detached state of a controller only affects what +happens during a global mode change, in other words following a call +to power_set_mode. It is still possible to +manipulate a detached controller using +power_set_controller_mode or +power_set_controller_mode_now. + + + + + + + + + + +Implementing a Power Controller + + +Implementing a Power Controller +adding power management support to device drivers and +other packages + + + +Implementing a Power Controller + +A system will have some number of power controllers. Usually there +will be one power controller for the cpu, +power_controller_cpu, typically provided by one of +the HAL packages and responsible for managing the processor itself and +associated critical components such as memory. Some or all of the +device drivers will provide power controllers, allowing the power +consumption of the associated devices to be controlled. There may be +some arbitrary number of other controllers present in the system. The +power management package does not impose any restrictions on the +number or nature of the power controllers in the system, other than +insisting that at most one power_controller_cpu be +provided. + + +Each power controller involves a single data structure of type +PowerController, defined in the header file +cyg/power/power.h. These data +structures should all be placed in the table +__POWER__, so that the power management package and +other code can easily locate all the controllers in the system. This +table is constructed at link-time, avoiding code-size or run-time +overheads. To facilitate this the package provides two macros which +should be used to define a power controller, +POWER_CONTROLLER() and +POWER_CONTROLLER_CPU(). + + +The macro POWER_CONTROLLER takes four arguments: + + + + +A variable name. This can be used to access the power controller +directly, as well as via the table. + + + + +A priority. The table of power controllers is sorted, such that power +controllers with a numerically lower priority come earlier in the +table. The special controller power_controller_cpu +always comes at the end of the table. When moving from a high-power +mode to a lower-powered mode, the power management package iterates +through the table from front to back. When moving to a higher-powered +mode the reverse direction is used. The intention is that the power +controller for a software-only package such as a TCP/IP stack should +appear near the start of the table, whereas the controllers for the +ethernet and similar devices would be near the end of the table. Hence +when the policy module initiates a mode change to a lower-powered mode +the TCP/IP stack gets a chance to cancel this mode change, before the +devices it depends on are powered down. Similarly when moving to a +higher-powered mode the devices will be re-activated before any +software that depends on those devices. + + +The header file cyg/power/power.h defines three +priorities PowerPri_Early, +PowerPri_Typical and +PowerPri_Late. For most controllers one of these +priorities, possibly with a small number added or subtracted, will +give sufficient control. If an application developer is uncertain +about the relative priorities of the various controllers, a simple +test program that iterates over +the table will quickly eliminate any confusion. + + + + +A constant string identifier. If the system has been configured +without support for such identifiers +(CYGIMP_POWER_PROVIDE_STRINGS) then this identifer +will be discarded at compile-time. Otherwise it will be made available +to higher-level code using the function +power_get_controller_id. + + + + +A function pointer. This will be invoked to perform actual mode +changes, as described below. + + + + +A typical example of the use of the +POWER_CONTROLLER macro would be as follows: + + +#include <pkgconf/system.h> + +#ifdef CYGPKG_POWER +# include <cyg/power/power.h> + +static void +xyzzy_device_power_mode_change( + PowerController* controller, + PowerMode desired_mode, + PowerModeChange change) +{ + // Do the work +} + +static POWER_CONTROLLER(xyzzy_power_controller, \ + PowerPri_Late, \ + "xyzzy device", \ + &xyzzy_device_power_mode_change); +#endif + + +This creates a variable xyzzy_power_controller, +which is a power controller data structure that will end up near the +end of the table of power controllers. Higher-level code can +iterate through this table and report the string "xyzzy +device" to the user. Whenever there is a mode change +operation that affects this controller, the function +xyzzy_device_power_mode_change will be invoked. +The variable is declared static so this controller cannot be +manipulated by name in any other code. Alternatively, if the variable +had not been declared static other code could manipulate this +controller by name as well as through the table, especially if the +package for the xyzzy device driver explicitly declared this +variable in an exported header file. Obviously exporting the variable +involves a slight risk of a name clash at link time. + + +The above code explicitly checks for the presence of the power +management package before including that package's header file or +providing any related functionality. Since power management +functionality is optional, such checks are recommended. + + +The macro POWER_CONTROLLER_CPU only takes two +arguments, a string identifier and a mode change function pointer. +This macro always instantiates a variable +power_controller_cpu so there is no need to provide +a variable name. The resulting power controller structure always +appears at the end of the table, so there is no need to specify a +priority. Typical usage of the POWER_CONTROLLER_CPU +macro would be: + + +static void +wumpus_processor_power_mode_change( + PowerController* controller, + PowerMode desired_mode, + PowerModeChange change) +{ + // Do the work +} + +POWER_CONTROLLER_CPU("wumpus processor", \ + &wumpus_processor_power_mode_change); + + +This defines a power controller structure +power_controller_cpu. It should not be declared +static since higher-level code may well want to manipulate the cpu's +power mode directly, and the variable is declared by the power +management package's header file. + + +Some care has to be taken to ensure that the power controllers +actually end up in the final executable. If a power controller +variable ends up in an ordinary library and is never referenced +directly then typically the linker will believe that the variable is +not needed and it will not end up in the executable. For eCos packages +this can be achieved in the CDL, by specifying that the containing +source file should end up in libextras.a rather +than the default libtarget.a: + + +cdl_package CYGPKG_HAL_WUMPUS_ARCH { + … + compile -library=libextras.a data.c +} + + +If the file data.c instantiates a power +controller this is now guaranteed to end up in the final executable, +as intended. Typically HAL and device driver packages will already +have some data that must not be eliminated by the linker, so they will +already contain a file that gets built into +libextras.a. For power controllers defined inside +application code it is important that the power controllers end up in +.o object files rather than in +.a library archive files. + + +All the real work of a power controller is done by the mode change +function. If the power management package has been configured to use a +separate thread then this mode change function will be invoked by that +thread (except for the special case of power_set_controller_mode_now). +If no separate thread is used then the mode change function will be +invoked directly by power_set_mode or +power_set_controller_mode. + + +The mode change function will be invoked with three arguments. The +first argument identifies the power controller. Usually this argument +is not actually required since a given mode change function will only +ever be invoked for a single power controller. For example, +xyzzy_device_power_mode_change will only ever be +used in conjunction with xyzzy_power_controller. +However there may be some packages which contain multiple controllers, +all of which can share a single mode change function, and in that case +it is essential to identify the specific controller. The second +argument specifies the mode the controller should switch to, if +possible: it will be one of PowerMode_Active, +PowerMode_Idle, PowerMode_Sleep +or PowerMode_Off. The final argument will be one of +PowerModeChange_Controller, +PowerModeChange_ControllerNow, or +PowerModeChange_Global, and identifies the call +that caused this invocation. For example, if the mode change function +was invoked because of a call to power_set_mode +then this argument will be PowerModeChange_Global. +It is up to each controller to decide how to interpret this final +argument. A typical controller might reject a global request to switch +to off mode if the associated device is still busy, but +if the request was aimed specifically at this controller then it could +instead abort any current I/O operations and switch off the device. + + +The PowerController data structure contains +one field, mode, that needs to be updated +by the power mode change function. At all times it should indicate the +current mode for this controller. When a mode change is requested the +desired mode is passed as the second argument. The exact operation of +the power mode change function depends very much on what is being +controlled and the current circumstances, but some guidelines are +possible: + + + + +If the request can be satisfied without obvious detriment, do so and +update the mode field. Reducing the power +consumption of a device that is not currently being used is generally +harmless. + + + + +If a request is a no-op, for example if the system is switching +from idle to sleep mode and the controller +does not distinguish between these modes, simply act as if the request +was satisfied. + + + + +If a request is felt to be unsafe, for example shutting down a +device that is still in use, then the controller may decide +to reject this request. This is especially true if the request was a +global mode change as opposed to one intended specifically for this +controller: in the latter case the policy module should be given due +deference. There are a number of ways in which a request can be +rejected: + + + + +If the request cannot be satisfied immediately but may be feasible in +a short while, leave the mode field +unchanged. Higher-level code in the policy module can interpret this +as a hint to retry the operation a little bit later. This approach is +also useful if the mode change can be started but will take some time +to complete, for example shutting down a socket connection, and +additional processing will be needed later on. + + + + +If the request is felt to be inappropriate, for example switching off +a device that is still in use, the mode change function can +call power_set_controller_mode to reset the +desired mode for this controller back to the current mode. +Higher-level code can then interpret this as a hint that there is more +activity in the system than had been apparent. + + + + +For a global mode change, if the new mode is felt to be inappropriate +then the power controller can call power_set_mode +to indicate this. An example of this would be the policy module +deciding to switch off the whole unit while there is still I/O +activity. + + + + + + +Mode change functions should not directly manipulate any other fields +in the PowerController data structure. If it +is necessary to keep track of additional data then static variables +can be used. + + +It should be noted that the above are only guidelines. Their +application in any given situation may be unclear. In addition the +detailed requirements of specific systems will vary, so even if the +power controller for a given device driver follows the above +guidelines exactly it may turn out that slightly different behaviour +would be more appropriate for the actual system that is being +developed. Fortunately the open source nature of +eCos allows system developers to fine-tune +power controllers to meet their exact requirements. + + + + + + + + diff --git a/packages/services/power/common/current/doc/services-power.html b/packages/services/power/common/current/doc/services-power.html new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/doc/services-power.html @@ -0,0 +1,164 @@ + + + + + + + + + + + +eCos Power Management Support +

    I. eCos Power Management Support

    Table of Contents
    Introduction — eCos support for Power Management
    Power Management Information — finding out about the various power controllers in the system
    Changing Power Modes — reducing or increasing power consumption as needed
    Support for Policy Modules — closer integration with higher-level code
    Attached and Detached Controllers — control which power controllers are affected by global changes
    Implementing a Power Controller — adding power management support to device drivers and +other packages

      Next
      Introduction
    \ No newline at end of file diff --git a/packages/services/power/common/current/include/power.h b/packages/services/power/common/current/include/power.h new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/include/power.h @@ -0,0 +1,249 @@ +#ifndef CYGONCE_POWER_POWER_H +# define CYGONCE_POWER_POWER_H +//========================================================================== +// +// include/power.h +// +// Definitions of power management support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): bartv +// Contributors: bartv +// Date: 2001-06-12 +// +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include +#include +#include + +#ifdef CYGPKG_POWER_THREAD +#include // CYGPKG_POWER_THREAD is active_if CYGPKG_KERNEL so + // the kernel's headers are guaranteed to be available. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// The four defined modes of power operation. +#define PowerMode_Min 0 +#define PowerMode_Active 0 +#define PowerMode_Idle 1 +#define PowerMode_Sleep 2 +#define PowerMode_Off 3 +#define PowerMode_Max 3 +typedef cyg_uint8 PowerMode; + +// Whether a mode change is initiated globally or per-controller +#define PowerModeChange_Controller 0 +#define PowerModeChange_ControllerNow 1 +#define PowerModeChange_Global 2 +typedef cyg_uint32 PowerModeChange; + +// Some priorities. +#define PowerPri_Early 1000 +#define PowerPri_Typical 5000 +#define PowerPri_Late 9000 + +typedef struct PowerController { + void (*change_mode)(struct PowerController*, PowerMode, PowerModeChange); +#ifdef CYGIMP_POWER_PROVIDE_STRINGS + char* id; +#endif +#ifdef CYGIMP_POWER_PROVIDE_POLICY_DATA + CYG_ADDRWORD policy_data; +#endif + PowerMode mode; + PowerMode desired_mode; + cyg_uint8 change_this; + cyg_uint8 attached; +} CYG_HAL_TABLE_TYPE PowerController; + +// The table of power controllers, allowing application code +// to access all of them. +extern PowerController __POWER__[], __POWER_END__; + +// There should always be a power controller for the cpu which can +// be accessed by any client. +extern PowerController power_controller_cpu; + +// If a separate power management thread is being used, its handle +// is exported so that other code can e.g. manipulate its priority +#ifdef CYGPKG_POWER_THREAD +extern cyg_handle_t power_thread_handle; +#endif + +// Inline functions and supporting data. +extern PowerMode __power_mode; +extern PowerMode __power_desired_mode; +typedef void (*__power_policy_callback_t)(PowerController*, PowerMode, PowerMode, PowerMode, PowerMode); +extern __power_policy_callback_t __power_policy_callback; + +// This macro is overridden elsewhere in this package when defining linkable +// extern (i.e. non-inline) versions of these functions. +#ifndef POWER_INLINE +# define POWER_INLINE extern inline +#endif + +POWER_INLINE PowerMode +power_get_mode(void) +{ + return __power_mode; +} + +POWER_INLINE PowerMode +power_get_desired_mode(void) +{ + return __power_desired_mode; +} + +POWER_INLINE PowerMode +power_get_controller_mode(PowerController* controller) +{ + return controller->mode; +} + +POWER_INLINE PowerMode +power_get_controller_desired_mode(PowerController* controller) +{ + return controller->desired_mode; +} + +POWER_INLINE void +power_set_policy_callback(__power_policy_callback_t new_callback) +{ + __power_policy_callback = new_callback; +} + +POWER_INLINE __power_policy_callback_t +power_get_policy_callback(void) +{ + return __power_policy_callback; +} + +#ifdef CYGIMP_POWER_PROVIDE_STRINGS +POWER_INLINE const char* +power_get_controller_id(PowerController* controller) +{ + return controller->id; +} +#endif + +#ifdef CYGIMP_POWER_PROVIDE_POLICY_DATA +POWER_INLINE void +power_set_controller_policy_data(PowerController* controller, CYG_ADDRWORD data) +{ + controller->policy_data = data; +} + +POWER_INLINE CYG_ADDRWORD +power_get_controller_policy_data(PowerController* controller) +{ + return controller->policy_data; +} +#endif + +POWER_INLINE cyg_bool +power_get_controller_attached(PowerController* controller) +{ + return controller->attached; +} + +POWER_INLINE void +power_set_controller_attached(PowerController* controller, cyg_bool new_value) +{ + controller->attached = new_value; +} + +POWER_INLINE void +power_set_controller_mode_now(PowerController* controller, PowerMode new_mode) +{ + controller->desired_mode = new_mode; + if (controller->mode != controller->desired_mode) { + (*controller->change_mode)(controller, new_mode, PowerModeChange_ControllerNow); + } +} + +// Now for the non-inline functions. +extern void power_set_controller_mode(PowerController*, PowerMode); +extern void power_set_mode(PowerMode); + +// Implementation support. +#ifdef CYGIMP_POWER_PROVIDE_STRINGS +# define POWER_CONTROLLER_ID(_id_) id: _id_, +#else +# define POWER_CONTROLLER_ID(_id_) +#endif +#ifdef CYGIMP_POWER_PROVIDE_POLICY_DATA +# define POWER_CONTROLLER_POLICY_DATA policy_data: 0, +#else +# define POWER_CONTROLLER_POLICY_DATA +#endif + +#define POWER_CONTROLLER(_name_, _pri_, _id_, _fn_) \ +PowerController _name_ \ + CYG_HAL_TABLE_QUALIFIED_ENTRY(power, _pri_) = { \ + change_mode: _fn_, \ + POWER_CONTROLLER_ID(_id_) \ + POWER_CONTROLLER_POLICY_DATA \ + mode: PowerMode_Active, \ + desired_mode: PowerMode_Active, \ + change_this: 0, \ + attached: 1 \ +} + +#define POWER_CONTROLLER_CPU(_id_, _fn_) \ +PowerController power_controller_cpu \ + CYG_HAL_TABLE_EXTRA(power) = { \ + change_mode: _fn_, \ + POWER_CONTROLLER_ID(_id_) \ + POWER_CONTROLLER_POLICY_DATA \ + mode: PowerMode_Active, \ + desired_mode: PowerMode_Active, \ + change_this: 0, \ + attached: 1, \ +} + +#ifdef __cplusplus +} // extern "C" { +#endif + +#endif // CYGONCE_POWER_POWER_H diff --git a/packages/services/power/common/current/src/power.cxx b/packages/services/power/common/current/src/power.cxx new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/src/power.cxx @@ -0,0 +1,371 @@ +//========================================================================== +// +// power.cxx +// +// Main implementation of power management support. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): bartv +// Contributors: bartv +// Date: 2001-06-18 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Provide the external (non-inline) definitions of the inline functions +// in power.h so there's something available in C code when the compiler +// chooses not to inline +#define POWER_INLINE extern "C" + +#include +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +// Statics. Most of these are only relevant when a separate power +// management thread is being used. Some of these are exported, e.g. +// to allow the use of inline functions. + +// The current power mode for the system as a whole. +PowerMode __power_mode = PowerMode_Active; + +// The mode that the system should be running at. +PowerMode __power_desired_mode = PowerMode_Active; + +// The policy callback function, if any. +__power_policy_callback_t __power_policy_callback = 0; + +// This flag is used to abort a mode change. It allows a controller to +// call power_set_mode() while the mode is already being changed. +static volatile cyg_bool abort_mode_change = false; + +#ifdef CYGPKG_POWER_THREAD +static unsigned char power_thread_stack[CYGNUM_POWER_THREAD_STACKSIZE]; +static cyg_thread power_thread; +// The power management thread's handle is exported to support +// operations like changing the thread's priority. +cyg_handle_t power_thread_handle; + +// This semaphore is used to wake up the power management thread when there +// is work to be done. +static cyg_sem_t power_thread_action; + +#else +static cyg_bool power_doing_it = false; +static cyg_uint power_todo_count = 0; +#endif + +// ---------------------------------------------------------------------------- +// Synchronisation. +// +// There are two exported functions to worry about: power_set_mode() +// and power_set_controller_mode(). There are also two main scenarios: +// CYGPKG_POWER_THREAD enabled and CYGPKG_POWER_THREAD_DISABLED. +// +// If CYGPKG_POWER_THREAD is enabled then any external code may at any +// time invoke the exported functions. These are asynchronous calls. +// In addition when the power management thread invokes a power +// controller that controller may also call the exported functions, +// synchronously. In either scenario the calls can return before the +// operation has completed, hence the policy callback functionality. +// +// If CYGPKG_POWER_THREAD is disabled then there may be only one +// external call to the exported functions, and the operation must +// complete before that call returns. If there are multiple concurrent +// external calls then the behaviour of the system is undefined. +// Really. It is still possible for power controllers to call the +// exported functions synchronously, which complicates things +// somewhat. +// +// The CYGPKG_POWER_THREAD case is the easier to handle. The power +// management thread simply loops forever, waiting on a semaphore +// until there is some work to be done and then checking internal +// state to figure out what that work should be. Some care has to be +// taken that the internal state gets updated and read atomically, +// which can be achieved by cyg_scheduler_lock() and unlock() calls in +// strategic places. Obviously it is undesirable to keep these locks +// longer than is absolutely necessary since that would impact +// dispatch latency, and in particular power controllers must not be +// invoked with the scheduler locked because there are no specific +// restrictions on what a controller may or may not do. +// +// The call graph is something like: +// power_thread_fn() - the thread entry point, loops waiting on the semaphore +// power_doit() - do the real work. This can be either a global mode +// change or one or more individual controller mode changes. +// Either operation involves iterating through the controllers. +// power_change_controller_mode() - manipulate an individual controller. +// +// There is one little complication. If during a power_doit() +// set_mode() loop there is a call to power_set_mode() then the +// current loop should be aborted. This is especially important when +// switching to off mode and a controller has decided to cancel this +// via another call to set_mode(). +// +// If no separate thread is used then there will only ever be one +// external call. That will result in an invocation of +// power_nothread_doit(), which in turn calls power_doit() and +// power_change_controller_mode() as in the threaded case. A flag is +// used so that it is possible to distinguish between external and +// synchronous calls, and a counter ensures that synchronous calls are +// processed correctly. Recursion is avoided so that stack usage +// remains deterministic. +// power_set_mode()/power_set_controller_mode() +// power_nothread_doit() +// power_doit() +// power_change_controller_mode(); +// +// The main fields in the power controller data structures to worry +// about are "mode", "desired_mode", and "change_this". "mode" is only +// manipulated by the power controller itself, and since all power +// controller accesses are serialized no problems arise. +// "desired_mode" and "change_this" are updated by power_set_mode() +// and power_set_controller_mode(), and read by power_doit(). If a separate +// thread is in use then the scheduler lock protects access to thse fields. +// Without a separate thread concurrency is not an issue. Obviously there +// are other fields and variables, but most of these will only be set during +// system start-up and the rest do not require any special attention. + +// ---------------------------------------------------------------------------- +// Do the real work. +// +// power_change_controller_mode() acts on a single controller. It is invoked only +// from power_doit(), either for a global mode change or for an individual mode change. +// It should be invoked with the scheduler unlocked - power_doit() is responsible for +// synchronizing with the external calls. +static inline void +power_change_controller_mode(PowerController* controller, PowerMode desired_mode, cyg_bool change_this) +{ + // The policy callback will want to know the previous power mode. + PowerMode old_mode = controller->mode; + + // Invoke the mode change operation. Note that + // controller->change_this and controller->desired_mode may have + // been updated by now, but at some point they did have values + // which required a mode change. + (*controller->change_mode)(controller, desired_mode, change_this ? PowerModeChange_Controller : PowerModeChange_Global); + + // Report the results to higher-level code. It is unlikely that + // the policy callback will be changed while the system is running, + // but just in case somebody installs a null pointer between the + // check and the call... + void (*callback)(PowerController*, PowerMode, PowerMode, PowerMode, PowerMode) = __power_policy_callback; + if (0 != callback) { + (*callback)(controller, old_mode, controller->mode, desired_mode, controller->desired_mode); + } +} + +// power_doit() is responsible for a single iteration over the various controllers, +// aborting if there is a global mode change during the current iteration. The +// calling code, either power_thread_fn() or power_nothread_doit(), will take +// care of the higher-level iterating while there is work to be done. +// +// If a global mode change has been requested then the order in which the controllers +// are invoked is significant: front->back for lowering power modes, back->front for +// a higher power mode. If there are individual changes to be processed then +// arbitrarily front->back is used as well. +static inline void +power_doit() +{ + PowerController* controller; + + abort_mode_change = false; + + if (__power_desired_mode < __power_mode) { + // The new mode is more active than the old one, so start with + // the power controllers at the back of the table. + for (controller = &(__POWER_END__) - 1; !abort_mode_change && (controller >= &(__POWER__[0])); controller--) { + PowerMode desired_mode; + cyg_bool change_this; + +#ifdef CYGPKG_POWER_THREAD + // Read the desired_mode and change_this flags atomically. + cyg_scheduler_lock(); + desired_mode = controller->desired_mode; + change_this = controller->change_this; + cyg_scheduler_unlock(); +#else + desired_mode = controller->desired_mode; + change_this = controller->change_this; +#endif + // If this controller is not running at the desired mode, change it. + if (desired_mode != controller->mode) { + power_change_controller_mode(controller, desired_mode, change_this); + } + } + } else { // __power_desired_mode >= __power_mode. + // Either a global mode change to a less active mode, or + // one or more individual controller changes. Other than + // iterating in a different direction, the code is the same + // as above. + for (controller = &(__POWER__[0]); !abort_mode_change && (controller != &(__POWER_END__)); controller++) { + PowerMode desired_mode; + cyg_bool change_this; + +#ifdef CYGPKG_POWER_THREAD + cyg_scheduler_lock(); + desired_mode = controller->desired_mode; + change_this = controller->change_this; + cyg_scheduler_unlock(); +#else + desired_mode = controller->desired_mode; + change_this = controller->change_this; +#endif + if (desired_mode != controller->mode) { + power_change_controller_mode(controller, desired_mode, change_this); + } + } + } + + // All of the controllers have been invoked. If there have been no + // intervening calls to power_set_mode() (which would have updated + // abort_mode_change) then we must now be running at the desired + // global mode. + if (!abort_mode_change) { + __power_mode = __power_desired_mode; + } +} + +#ifdef CYGPKG_POWER_THREAD +static void +power_thread_fn(cyg_addrword_t param) +{ + for (;;) { + // Currently idle. Wait for a request to change power modes. + cyg_semaphore_wait(&power_thread_action); + power_doit(); + } +} +#else +static inline void +power_nothread_doit() +{ + power_todo_count++; + if (!power_doing_it) { + power_doing_it = true; + do { + power_doit(); + } while (--power_todo_count > 0); + power_doing_it = false; + } +} +#endif + +// ---------------------------------------------------------------------------- +// The exported calls. + +extern "C" void +power_set_controller_mode(PowerController* controller, PowerMode new_mode) +{ +#ifdef CYGPKG_POWER_THREAD + cyg_scheduler_lock(); // Protect against concurrent calls +#endif + + controller->desired_mode = new_mode; + controller->change_this = true; + +#ifdef CYGPKG_POWER_THREAD + cyg_scheduler_unlock(); + cyg_semaphore_post(&power_thread_action); +#else + power_nothread_doit(); +#endif +} + +extern "C" void +power_set_mode(PowerMode new_mode) +{ + PowerController* controller; + +#ifdef CYGPKG_POWER_THREAD + cyg_scheduler_lock(); +#endif + + __power_desired_mode = new_mode; + abort_mode_change = true; + // Update each controller. Most importantly, clear the + // "change_this" flag in every power controller. The net result is + // that power_set_mode() overrides any power_set_controller_mode() + // operations that have not yet been processed, but future + // power_set_controller_mode() calls will have the desired effect. + for (controller = &(__POWER__[0]); controller != &(__POWER_END__); controller++) { + if (controller->attached) { + controller->change_this = 0; + controller->desired_mode = new_mode; + } + } + +#ifdef CYGPKG_POWER_THREAD + cyg_scheduler_unlock(); + cyg_semaphore_post(&power_thread_action); +#else + power_nothread_doit(); +#endif +} + +// ---------------------------------------------------------------------------- +// Power management initialization. This gets called from +// power_data.cxx using a prioritized constructors. Doing this way +// minimizes the amount of data that is going to end up in libextras.a +// and hence in the final executable, allowing linker garbage collection +// to clean up as much as possible. The main operation here is to start +// up a separate power management thread when configured to do so. +// +// If no separate thread is being used then no run-time initialization +// is needed. +#ifdef CYGPKG_POWER_THREAD +extern "C" void +power_init(void) +{ + cyg_semaphore_init(&power_thread_action, 0); + cyg_thread_create(CYGNUM_POWER_THREAD_PRIORITY, + &power_thread_fn, + (cyg_addrword_t) 0, + "Power management thread", + power_thread_stack, + CYGNUM_POWER_THREAD_STACKSIZE, + &power_thread_handle, + &power_thread + ); + cyg_thread_resume(power_thread_handle); +} +#endif + diff --git a/packages/services/power/common/current/src/power_data.cxx b/packages/services/power/common/current/src/power_data.cxx new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/src/power_data.cxx @@ -0,0 +1,77 @@ +//========================================================================== +// +// power_data.cxx +// +// Initialization and table support for power management. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): bartv +// Contributors: bartv +// Date: 2001-06-12 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include + +// Run-time package initialization. This is only required when the +// power management package runs its own thread. It involves a dummy +// class plus a single instance of that class. Initialization is +// scheduled for after low-level device driver init, kernel init, and +// I/O subsystem init. That way all device drivers should be up and +// running already. + +#ifdef CYGPKG_POWER_THREAD +externC void power_init(void); + +class power_init_class { +public: + power_init_class(void) { + power_init(); + } +}; + +static power_init_class _power_init CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO + 1); +#endif + +// Define the table for power controllers. +CYG_HAL_TABLE_BEGIN( __POWER__, power ); +CYG_HAL_TABLE_END( __POWER_END__, power ); diff --git a/packages/services/power/common/current/tests/powertest.cxx b/packages/services/power/common/current/tests/powertest.cxx new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/tests/powertest.cxx @@ -0,0 +1,369 @@ +//========================================================================== +// +// powertest.cxx +// +// Testcase for the power management support. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): bartv +// Contributors: bartv +// Date: 2001-07-29 +// +// This testcase checks most of the functionality of the power management +// package. The main exception is the POWER_CONTROLLER_CPU macro and +// the power_controller_cpu variable: that controller may or may not be +// provided by one of the HAL packages, so attempting to manipulate that +// HAL could cause link-time conflicts. +// +// The testcase is likely to fail if some package supplies a policy +// module that is making concurrent calls, for example if that module +// installs its own callback. For now there is no way of detecting +// that scenario, but also for now policy modules are assumed to be +// provided by the application rather than by any eCos package. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include +#include +#include +#include +#include + +#ifdef CYGPKG_KERNEL +// Additional #include's to support the use of multiple threads. +#include +#include +#endif + +// Additional prototypes. These are builtins, but in some configurations +// the relevant headers may not be present. +extern "C" int strcmp(const char*, const char*); + +// ---------------------------------------------------------------------------- +// Define the various tests in the system. This allows the power controllers +// and the policy callback to take appropriate action as required. +enum PowerTest { + PowerTest_Presence, + PowerTest_Order, + PowerTest_InitialState, + PowerTest_Ids +} current_test; + +// ---------------------------------------------------------------------------- +// Statics. +#ifdef CYGPKG_KERNEL +static unsigned char policy_thread_stack[CYGNUM_HAL_STACK_SIZE_TYPICAL]; +static cyg_thread policy_thread; +static cyg_handle_t policy_thread_handle; +#endif + +// ---------------------------------------------------------------------------- +// Provide three power controllers at different priorities. +static void xyzzy_power_controller_fn(PowerController*, PowerMode, PowerModeChange); +static void wumpus_power_controller_fn(PowerController*, PowerMode, PowerModeChange); +static void erwin_power_controller_fn(PowerController*, PowerMode, PowerModeChange); + +POWER_CONTROLLER(xyzzy_controller, PowerPri_Early, "xyzzy", &xyzzy_power_controller_fn); +POWER_CONTROLLER(wumpus_controller, PowerPri_Typical, "wumpus", &wumpus_power_controller_fn); +POWER_CONTROLLER(erwin_controller, PowerPri_Late, "erwin", &erwin_power_controller_fn); + +// ---------------------------------------------------------------------------- +// The test cases. + +// Check that all three power controllers are actually present in the array. +static void +test_presence(void) +{ + bool seen_xyzzy = false; + bool seen_wumpus = false; + bool seen_erwin = false; + PowerController* controller; + + for (controller = &(__POWER__[0]); controller != &__POWER_END__; controller++) { + if (controller == &xyzzy_controller) { + CYG_ASSERTC(!seen_xyzzy); + seen_xyzzy = true; + } else if (controller == &wumpus_controller) { + CYG_ASSERTC(!seen_wumpus); + seen_wumpus = true; + } else if (controller == &erwin_controller) { + CYG_ASSERTC(!seen_erwin); + seen_erwin = true; + } + } + + if (seen_xyzzy && seen_wumpus && seen_erwin) { + CYG_TEST_PASS("All expected controllers found"); + } else { + CYG_TEST_FAIL_FINISH("Failed to find all the controllers that should be present"); + } +} + +// Now check that the controllers appear in the expected order. +static void +test_order(void) +{ + int xyzzy_index = -1; + int wumpus_index = -1; + int erwin_index = -1; + int i; + + for (i = 0; &(__POWER__[i]) != &__POWER_END__; i++) { + if (&__POWER__[i] == &xyzzy_controller) { + CYG_ASSERTC(-1 == xyzzy_index); + xyzzy_index = i; + } else if (&__POWER__[i] == &wumpus_controller) { + CYG_ASSERTC(-1 == wumpus_index); + wumpus_index = i; + } else if (&__POWER__[i] == &erwin_controller) { + CYG_ASSERTC(-1 == erwin_index); + erwin_index = i; + } + } + CYG_ASSERTC(-1 != xyzzy_index); + CYG_ASSERTC(-1 != wumpus_index); + CYG_ASSERTC(-1 != erwin_index); + + if ((xyzzy_index < wumpus_index) && (wumpus_index < erwin_index)) { + CYG_TEST_PASS("The power controllers are in the correct order"); + } else { + CYG_TEST_FAIL_FINISH("The power controllers are not in the correct order"); + } +} + +// Check the initial state of the system. Power controllers other than the ones +// defined by this testcase are ignored, since conceivably they might well come +// up in a mode other than active. +static void +test_initial_state(void) +{ + bool test_ok = true; + // There have been no calls to change power mode, so the system should be active + if (PowerMode_Active != power_get_mode()) { + CYG_TEST_FAIL("Initial power mode not active"); + test_ok = false; + } + if (PowerMode_Active != power_get_desired_mode()) { + CYG_TEST_FAIL("Initial desired power mode not active"); + test_ok = false; + } + if ((void (*)(PowerController*, PowerMode, PowerMode, PowerMode, PowerMode)) 0 != power_get_policy_callback()) { + CYG_TEST_FAIL("A policy callback has already been installed"); + test_ok = false; + } + + if ((PowerMode_Active != power_get_controller_mode(&xyzzy_controller)) || + (PowerMode_Active != power_get_controller_mode(&wumpus_controller)) || + (PowerMode_Active != power_get_controller_mode(&erwin_controller))) { + CYG_TEST_FAIL("Not all power controllers initialized to active"); + test_ok = false; + } + if ((PowerMode_Active != power_get_controller_desired_mode(&xyzzy_controller)) || + (PowerMode_Active != power_get_controller_desired_mode(&wumpus_controller)) || + (PowerMode_Active != power_get_controller_desired_mode(&erwin_controller))) { + CYG_TEST_FAIL("Not all power controllers initialized to desired active"); + test_ok = false; + } + + if (!power_get_controller_attached(&xyzzy_controller) || + !power_get_controller_attached(&wumpus_controller) || + !power_get_controller_attached(&erwin_controller)) { + CYG_TEST_FAIL("Some power controllers started off detached"); + test_ok = false; + } + + // The initial policy data is checked in a separate testcase + if (test_ok) { + CYG_TEST_PASS("Initial power management state is as expected"); + } +} + +// If the configuration involves per-controller id's, check them. +#ifdef CYGIMP_POWER_PROVIDE_STRINGS +static int test_ids_data = 0; // avoid problems with over-optimising + +static void +test_ids(void) +{ + // All of the power controllers should have a valid id, i.e. it + // should be possible to dereference the pointer. A SEGV here + // probably indicates that a HAL or device driver package has + // failed to supply a sensible string, which is a test failure + // albeit one in that package rather than the power management + // package. + PowerController* controller; + for (controller = &(__POWER__[0]); controller != &__POWER_END__; controller++) { + const char* id = power_get_controller_id(controller); + test_ids_data += id[0]; + } + + // In addition the id strings for the three known controllers are also known. + if ((0 == strcmp("xyzzy", power_get_controller_id(&xyzzy_controller))) && + (0 == strcmp("wumpus", power_get_controller_id(&wumpus_controller))) && + (0 == strcmp("erwin", power_get_controller_id(&erwin_controller)))) { + CYG_TEST_PASS("Controller id strings match up"); + } else { + CYG_TEST_FAIL("Controller id strings fail to match"); + } +} +#else +static void +test_ids(void) +{ + CYG_TEST_NA("Unable to test controller ids - this functionaly has been configured out"); +} +#endif +// ---------------------------------------------------------------------------- +// The individual power controller functions. By default these just obey the +// requested mode change, but there are some special cases. +static void +xyzzy_power_controller_fn(PowerController* controller, PowerMode desired_mode, PowerModeChange change) +{ + switch (current_test) { + default : + controller->mode = desired_mode; + break; + } +} + +static void +wumpus_power_controller_fn(PowerController* controller, PowerMode desired_mode, PowerModeChange change) +{ + switch (current_test) { + default : + controller->mode = desired_mode; + break; + } +} + +static void +erwin_power_controller_fn(PowerController* controller, PowerMode desired_mode, PowerModeChange change) +{ + switch (current_test) { + default : + controller->mode = desired_mode; + break; + } +} + +// ---------------------------------------------------------------------------- +// The main policy callback. Like the controller functions by default this +// does nothing, but for specific tests it has to take action. +static void +policy_callback(PowerController* controller, PowerMode old_mode, PowerMode current_mode, PowerMode old_desired_mode, PowerMode current_desired_mode) +{ +} + +// ---------------------------------------------------------------------------- +// Utilities. + +// Detach all controllers except the ones supplied by this package. It would +// be unfortunate if say the cpu stopped running because a test case decided +// to set the global mode to off. +static void +detach_all_controllers(void) +{ + PowerController* controller; + for (controller = &(__POWER__[0]); controller != &__POWER_END__; controller++) { + if ((controller != &xyzzy_controller) && (controller != &wumpus_controller) && (controller != &erwin_controller)) { + power_set_controller_attached(controller, false); + } + } +} + +// ---------------------------------------------------------------------------- +// The main routine, which acts as the policy module. This either runs as +// a separate thread, if the kernel is present, or else it is called +// directly from cyg_start(). +static void +powertest_main(CYG_ADDRWORD data) +{ + CYG_ASSERT(0 == data, "No data should be supplied"); + + CYG_TEST_INIT(); + + current_test = PowerTest_Presence; + test_presence(); + + current_test = PowerTest_Order; + test_order(); + + current_test = PowerTest_InitialState; + test_initial_state(); + + current_test = PowerTest_Ids; + test_ids(); + + detach_all_controllers(); + + CYG_TEST_FINISH("All tests have been run"); +} + +// ---------------------------------------------------------------------------- +// Test startup. +externC void +cyg_start(void) +{ +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG + cyg_hal_invoke_constructors(); +#endif + +#ifdef CYGPKG_KERNEL + cyg_thread_create(CYG_SCHED_DEFAULT_INFO, + &powertest_main, + (cyg_addrword_t) 0, + "Power policy thread", + policy_thread_stack, + CYGNUM_HAL_STACK_SIZE_TYPICAL, + &policy_thread_handle, + &policy_thread); + cyg_thread_resume(policy_thread_handle); + Cyg_Scheduler::start(); + CYG_TEST_FAIL_FINISH("Not reached"); +#else + powertest_main(0); +#endif +} + + + + diff --git a/packages/templates/all/ChangeLog b/packages/templates/all/ChangeLog --- a/packages/templates/all/ChangeLog +++ b/packages/templates/all/ChangeLog @@ -1,3 +1,7 @@ +2002-01-29 Jesper Skov + + * current.ect: Added CYGPKG_NET_OPENBSD_STACK. + 2001-11-27 Jonathan Larmour current.ect: Provide default for CYGBLD_ISO_STRING_BSD_FUNCS_HEADER @@ -91,27 +95,36 @@ 1999-12-09 Bart Veer }; +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + cdl_option CYGBLD_ISO_STRERROR_HEADER { inferred_value 1 }; diff --git a/packages/templates/cygmon/ChangeLog b/packages/templates/cygmon/ChangeLog --- a/packages/templates/cygmon/ChangeLog +++ b/packages/templates/cygmon/ChangeLog @@ -64,27 +64,36 @@ 2000-01-25 Jesper Skov + + * current.ect: Added CYGPKG_NET_OPENBSD_STACK. + 2001-11-27 Jonathan Larmour current.ect: Provide default for CYGBLD_ISO_STRING_BSD_FUNCS_HEADER @@ -37,29 +41,38 @@ 2000-05-02 Jonathan Larmour + + * current.ect: DNS header moved. + +2001-09-24 Jesper Skov + + * current.ect: Added DNS package. + 2001-08-21 Jonathan Larmour * current.ect: Pre-infer CYGBLD_ISO_PMUTEXTYPES_HEADER. @@ -84,27 +92,36 @@ 2000-02-08 Gary Thomas }; +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + cdl_option CYGBLD_ISO_STRERROR_HEADER { inferred_value 1 }; diff --git a/packages/templates/new_net/ChangeLog b/packages/templates/new_net/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/templates/new_net/ChangeLog @@ -0,0 +1,38 @@ +2002-01-28 Gary Thomas + + * current.ect: New configuration, using new FreeBSD based stack. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/templates/new_net/current.ect b/packages/templates/new_net/current.ect new file mode 100644 --- /dev/null +++ b/packages/templates/new_net/current.ect @@ -0,0 +1,201 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration template_net { + description "This configuration includes the TCP/IP stack." ; + package CYGPKG_HAL current ; + package CYGPKG_IO current ; + package CYGPKG_IO_SERIAL current ; + package CYGPKG_INFRA current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_KERNEL current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_LIBC current ; + package CYGPKG_LIBC_TIME current ; + package CYGPKG_LIBC_STDLIB current ; + package CYGPKG_LIBC_STRING current ; + package CYGPKG_LIBC_I18N current ; + package CYGPKG_LIBC_SETJMP current ; + package CYGPKG_LIBC_STARTUP current ; + package CYGPKG_LIBC_STDIO current ; + package CYGPKG_LIBM current ; + package CYGPKG_POSIX current ; + package CYGPKG_IO_WATCHDOG current ; + package CYGPKG_IO_WALLCLOCK current ; + package CYGPKG_ERROR current ; + package CYGPKG_IO_FILEIO current ; + package CYGPKG_NET current ; + package CYGPKG_NET_FREEBSD_STACK current ; + package CYGPKG_NS_DNS current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGBLD_ISO_CTYPE_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILETYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILEACCESS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_CHAR_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_DIRECT_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_ERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMER_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_NUMBERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DIRENT_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREADTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_BSDTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_UTSNAME_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SEMAPHORES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_LIMITS_HEADER { + inferred_value 1 +}; + +cdl_option CYGIMP_KERNEL_SCHED_SORTED_QUEUES { + inferred_value 1 +}; + +cdl_option CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE { + inferred_value 1 +}; + +cdl_component CYGSEM_KERNEL_SCHED_ASR_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGSEM_KERNEL_SCHED_ASR_GLOBAL { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_STREAMS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGSETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_OPEN_MAX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PMUTEXTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; diff --git a/packages/templates/posix/ChangeLog b/packages/templates/posix/ChangeLog --- a/packages/templates/posix/ChangeLog +++ b/packages/templates/posix/ChangeLog @@ -38,27 +38,36 @@ 2000-05-04 Nick Garnett + + * current.ect: Added DNS package. + 2001-09-12 Gary Thomas * current.ect: Large stack no longer necessary as 'fconfig' data @@ -49,27 +53,36 @@ 2000-07-12 Gary Thomas +}; cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { inferred_value 1 diff --git a/packages/templates/stubs/ChangeLog b/packages/templates/stubs/ChangeLog --- a/packages/templates/stubs/ChangeLog +++ b/packages/templates/stubs/ChangeLog @@ -1,3 +1,7 @@ +2002-03-13 Jesper Skov + + * current.ect: Fix _GDB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UtbI=){B+K;-8aU4*Zull)sQJ z#NH717D(s}3}0Y1aE5T(`wWPTjli4r?uf#63R_f=d5??kuECMc zw*4aQ0c>B!IwSDo^v*4uP8_>TO2~u=<{T+h+Qzhz5&RQJfECCybzY|DUFLrYu3rst zB^(x|GEN{VwY`VWk)>Q1kUD55b-nhjYV+^gJ6s<0we5#@ChX5VINX2c#fKeamEv7W z9sML`28R2GVRveq2~E6@@ou@xitI}pdD(+9B)E~@C@KzIa}b>=wh^xIVLv8JXIW&Z lKk^u`1XGfC>RI+$Lz0Q3@>FtEcpJ{0#x!C)4b?mO{{q$Pl{x?b diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/rle8.c b/packages/services/gfx/mw/current/src/mwin/bmp/rle8.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/bmp/rle8.c @@ -0,0 +1,476 @@ +/* Generated by convbmp*/ +#include "device.h" + +/* MWIMAGEHDR image_rle8 converted from rle8.bmp*/ + +static MWPALENTRY palette[256] = { + RGBDEF( 8, 8, 16 ), /* pal 0*/ + RGBDEF( 16, 16, 24 ), /* pal 1*/ + RGBDEF( 24, 16, 24 ), /* pal 2*/ + RGBDEF( 74, 16, 24 ), /* pal 3*/ + RGBDEF( 90, 16, 24 ), /* pal 4*/ + RGBDEF( 33, 33, 33 ), /* pal 5*/ + RGBDEF( 41, 24, 33 ), /* pal 6*/ + RGBDEF( 41, 33, 33 ), /* pal 7*/ + RGBDEF( 74, 33, 33 ), /* pal 8*/ + RGBDEF( 24, 24, 41 ), /* pal 9*/ + RGBDEF( 41, 33, 41 ), /* pal 10*/ + RGBDEF( 49, 33, 41 ), /* pal 11*/ + RGBDEF( 49, 49, 41 ), /* pal 12*/ + RGBDEF( 57, 41, 41 ), /* pal 13*/ + RGBDEF( 57, 49, 41 ), /* pal 14*/ + RGBDEF( 74, 41, 41 ), /* pal 15*/ + RGBDEF( 74, 49, 41 ), /* pal 16*/ + RGBDEF( 90, 49, 41 ), /* pal 17*/ + RGBDEF( 107, 49, 41 ), /* pal 18*/ + RGBDEF( 115, 41, 41 ), /* pal 19*/ + RGBDEF( 123, 57, 41 ), /* pal 20*/ + RGBDEF( 57, 49, 49 ), /* pal 21*/ + RGBDEF( 90, 66, 49 ), /* pal 22*/ + RGBDEF( 99, 82, 49 ), /* pal 23*/ + RGBDEF( 115, 66, 49 ), /* pal 24*/ + RGBDEF( 33, 41, 57 ), /* pal 25*/ + RGBDEF( 49, 41, 57 ), /* pal 26*/ + RGBDEF( 49, 49, 57 ), /* pal 27*/ + RGBDEF( 57, 66, 57 ), /* pal 28*/ + RGBDEF( 82, 57, 57 ), /* pal 29*/ + RGBDEF( 90, 66, 57 ), /* pal 30*/ + RGBDEF( 107, 66, 57 ), /* pal 31*/ + RGBDEF( 107, 82, 57 ), /* pal 32*/ + RGBDEF( 123, 74, 57 ), /* pal 33*/ + RGBDEF( 123, 82, 57 ), /* pal 34*/ + RGBDEF( 74, 82, 66 ), /* pal 35*/ + RGBDEF( 99, 82, 66 ), /* pal 36*/ + RGBDEF( 123, 99, 66 ), /* pal 37*/ + RGBDEF( 41, 57, 74 ), /* pal 38*/ + RGBDEF( 57, 49, 74 ), /* pal 39*/ + RGBDEF( 57, 66, 74 ), /* pal 40*/ + RGBDEF( 66, 82, 74 ), /* pal 41*/ + RGBDEF( 90, 66, 74 ), /* pal 42*/ + RGBDEF( 107, 90, 74 ), /* pal 43*/ + RGBDEF( 115, 74, 74 ), /* pal 44*/ + RGBDEF( 115, 99, 74 ), /* pal 45*/ + RGBDEF( 123, 90, 74 ), /* pal 46*/ + RGBDEF( 132, 99, 74 ), /* pal 47*/ + RGBDEF( 132, 115, 74 ), /* pal 48*/ + RGBDEF( 90, 82, 82 ), /* pal 49*/ + RGBDEF( 99, 99, 82 ), /* pal 50*/ + RGBDEF( 41, 66, 90 ), /* pal 51*/ + RGBDEF( 33, 82, 148 ), /* pal 52*/ + RGBDEF( 49, 66, 115 ), /* pal 53*/ + RGBDEF( 49, 66, 123 ), /* pal 54*/ + RGBDEF( 49, 82, 140 ), /* pal 55*/ + RGBDEF( 49, 90, 156 ), /* pal 56*/ + RGBDEF( 57, 82, 107 ), /* pal 57*/ + RGBDEF( 57, 82, 132 ), /* pal 58*/ + RGBDEF( 66, 66, 90 ), /* pal 59*/ + RGBDEF( 66, 74, 90 ), /* pal 60*/ + RGBDEF( 66, 82, 148 ), /* pal 61*/ + RGBDEF( 66, 99, 132 ), /* pal 62*/ + RGBDEF( 66, 99, 148 ), /* pal 63*/ + RGBDEF( 74, 82, 90 ), /* pal 64*/ + RGBDEF( 79, 98, 109 ), /* pal 65*/ + RGBDEF( 107, 90, 107 ), /* pal 66*/ + RGBDEF( 103, 107, 107 ), /* pal 67*/ + RGBDEF( 123, 107, 94 ), /* pal 68*/ + RGBDEF( 115, 107, 123 ), /* pal 69*/ + RGBDEF( 127, 115, 107 ), /* pal 70*/ + RGBDEF( 74, 99, 132 ), /* pal 71*/ + RGBDEF( 82, 107, 132 ), /* pal 72*/ + RGBDEF( 90, 123, 132 ), /* pal 73*/ + RGBDEF( 115, 132, 132 ), /* pal 74*/ + RGBDEF( 107, 123, 148 ), /* pal 75*/ + RGBDEF( 74, 123, 156 ), /* pal 76*/ + RGBDEF( 99, 107, 156 ), /* pal 77*/ + RGBDEF( 123, 140, 156 ), /* pal 78*/ + RGBDEF( 99, 123, 165 ), /* pal 79*/ + RGBDEF( 49, 90, 173 ), /* pal 80*/ + RGBDEF( 57, 99, 173 ), /* pal 81*/ + RGBDEF( 66, 107, 173 ), /* pal 82*/ + RGBDEF( 49, 90, 181 ), /* pal 83*/ + RGBDEF( 66, 107, 181 ), /* pal 84*/ + RGBDEF( 66, 115, 181 ), /* pal 85*/ + RGBDEF( 90, 115, 181 ), /* pal 86*/ + RGBDEF( 107, 140, 181 ), /* pal 87*/ + RGBDEF( 66, 107, 189 ), /* pal 88*/ + RGBDEF( 74, 115, 189 ), /* pal 89*/ + RGBDEF( 74, 123, 198 ), /* pal 90*/ + RGBDEF( 90, 132, 198 ), /* pal 91*/ + RGBDEF( 99, 140, 198 ), /* pal 92*/ + RGBDEF( 115, 148, 198 ), /* pal 93*/ + RGBDEF( 123, 115, 198 ), /* pal 94*/ + RGBDEF( 82, 132, 206 ), /* pal 95*/ + RGBDEF( 99, 148, 206 ), /* pal 96*/ + RGBDEF( 115, 148, 206 ), /* pal 97*/ + RGBDEF( 115, 156, 206 ), /* pal 98*/ + RGBDEF( 57, 107, 214 ), /* pal 99*/ + RGBDEF( 74, 132, 214 ), /* pal 100*/ + RGBDEF( 107, 148, 214 ), /* pal 101*/ + RGBDEF( 99, 148, 222 ), /* pal 102*/ + RGBDEF( 115, 165, 222 ), /* pal 103*/ + RGBDEF( 140, 41, 24 ), /* pal 104*/ + RGBDEF( 140, 49, 41 ), /* pal 105*/ + RGBDEF( 140, 99, 66 ), /* pal 106*/ + RGBDEF( 148, 66, 33 ), /* pal 107*/ + RGBDEF( 148, 66, 49 ), /* pal 108*/ + RGBDEF( 148, 74, 57 ), /* pal 109*/ + RGBDEF( 148, 90, 57 ), /* pal 110*/ + RGBDEF( 156, 82, 57 ), /* pal 111*/ + RGBDEF( 165, 49, 41 ), /* pal 112*/ + RGBDEF( 165, 66, 49 ), /* pal 113*/ + RGBDEF( 165, 90, 57 ), /* pal 114*/ + RGBDEF( 189, 71, 55 ), /* pal 115*/ + RGBDEF( 165, 99, 66 ), /* pal 116*/ + RGBDEF( 148, 115, 74 ), /* pal 117*/ + RGBDEF( 165, 82, 74 ), /* pal 118*/ + RGBDEF( 165, 115, 74 ), /* pal 119*/ + RGBDEF( 156, 111, 82 ), /* pal 120*/ + RGBDEF( 152, 111, 115 ), /* pal 121*/ + RGBDEF( 181, 99, 66 ), /* pal 122*/ + RGBDEF( 181, 115, 74 ), /* pal 123*/ + RGBDEF( 181, 115, 82 ), /* pal 124*/ + RGBDEF( 198, 103, 70 ), /* pal 125*/ + RGBDEF( 198, 123, 74 ), /* pal 126*/ + RGBDEF( 219, 109, 71 ), /* pal 127*/ + RGBDEF( 231, 123, 74 ), /* pal 128*/ + RGBDEF( 145, 134, 87 ), /* pal 129*/ + RGBDEF( 162, 140, 98 ), /* pal 130*/ + RGBDEF( 151, 138, 130 ), /* pal 131*/ + RGBDEF( 181, 123, 82 ), /* pal 132*/ + RGBDEF( 189, 140, 90 ), /* pal 133*/ + RGBDEF( 178, 140, 126 ), /* pal 134*/ + RGBDEF( 189, 156, 82 ), /* pal 135*/ + RGBDEF( 198, 132, 82 ), /* pal 136*/ + RGBDEF( 198, 140, 82 ), /* pal 137*/ + RGBDEF( 214, 140, 82 ), /* pal 138*/ + RGBDEF( 198, 156, 90 ), /* pal 139*/ + RGBDEF( 214, 132, 90 ), /* pal 140*/ + RGBDEF( 201, 155, 112 ), /* pal 141*/ + RGBDEF( 239, 131, 82 ), /* pal 142*/ + RGBDEF( 247, 148, 82 ), /* pal 143*/ + RGBDEF( 231, 148, 90 ), /* pal 144*/ + RGBDEF( 247, 152, 90 ), /* pal 145*/ + RGBDEF( 255, 165, 90 ), /* pal 146*/ + RGBDEF( 232, 156, 109 ), /* pal 147*/ + RGBDEF( 251, 169, 115 ), /* pal 148*/ + RGBDEF( 214, 173, 115 ), /* pal 149*/ + RGBDEF( 247, 178, 101 ), /* pal 150*/ + RGBDEF( 239, 181, 123 ), /* pal 151*/ + RGBDEF( 240, 193, 113 ), /* pal 152*/ + RGBDEF( 255, 198, 123 ), /* pal 153*/ + RGBDEF( 255, 214, 132 ), /* pal 154*/ + RGBDEF( 132, 156, 181 ), /* pal 155*/ + RGBDEF( 132, 173, 206 ), /* pal 156*/ + RGBDEF( 140, 123, 148 ), /* pal 157*/ + RGBDEF( 140, 165, 165 ), /* pal 158*/ + RGBDEF( 140, 173, 198 ), /* pal 159*/ + RGBDEF( 140, 173, 222 ), /* pal 160*/ + RGBDEF( 140, 181, 231 ), /* pal 161*/ + RGBDEF( 148, 181, 222 ), /* pal 162*/ + RGBDEF( 148, 189, 247 ), /* pal 163*/ + RGBDEF( 156, 156, 165 ), /* pal 164*/ + RGBDEF( 156, 165, 165 ), /* pal 165*/ + RGBDEF( 156, 165, 189 ), /* pal 166*/ + RGBDEF( 156, 173, 198 ), /* pal 167*/ + RGBDEF( 156, 189, 222 ), /* pal 168*/ + RGBDEF( 156, 189, 231 ), /* pal 169*/ + RGBDEF( 165, 198, 198 ), /* pal 170*/ + RGBDEF( 165, 198, 222 ), /* pal 171*/ + RGBDEF( 165, 206, 173 ), /* pal 172*/ + RGBDEF( 173, 198, 239 ), /* pal 173*/ + RGBDEF( 173, 206, 247 ), /* pal 174*/ + RGBDEF( 181, 181, 198 ), /* pal 175*/ + RGBDEF( 181, 198, 189 ), /* pal 176*/ + RGBDEF( 181, 198, 239 ), /* pal 177*/ + RGBDEF( 181, 206, 206 ), /* pal 178*/ + RGBDEF( 181, 206, 231 ), /* pal 179*/ + RGBDEF( 189, 173, 148 ), /* pal 180*/ + RGBDEF( 206, 181, 140 ), /* pal 181*/ + RGBDEF( 231, 173, 140 ), /* pal 182*/ + RGBDEF( 247, 198, 140 ), /* pal 183*/ + RGBDEF( 255, 206, 140 ), /* pal 184*/ + RGBDEF( 231, 198, 148 ), /* pal 185*/ + RGBDEF( 255, 222, 148 ), /* pal 186*/ + RGBDEF( 198, 185, 156 ), /* pal 187*/ + RGBDEF( 210, 185, 172 ), /* pal 188*/ + RGBDEF( 222, 181, 189 ), /* pal 189*/ + RGBDEF( 189, 198, 198 ), /* pal 190*/ + RGBDEF( 238, 198, 165 ), /* pal 191*/ + RGBDEF( 222, 206, 201 ), /* pal 192*/ + RGBDEF( 247, 239, 181 ), /* pal 193*/ + RGBDEF( 189, 198, 222 ), /* pal 194*/ + RGBDEF( 198, 214, 222 ), /* pal 195*/ + RGBDEF( 206, 214, 222 ), /* pal 196*/ + RGBDEF( 255, 247, 222 ), /* pal 197*/ + RGBDEF( 198, 214, 231 ), /* pal 198*/ + RGBDEF( 206, 214, 239 ), /* pal 199*/ + RGBDEF( 214, 222, 239 ), /* pal 200*/ + RGBDEF( 231, 231, 239 ), /* pal 201*/ + RGBDEF( 198, 214, 247 ), /* pal 202*/ + RGBDEF( 198, 222, 247 ), /* pal 203*/ + RGBDEF( 214, 231, 247 ), /* pal 204*/ + RGBDEF( 231, 239, 255 ), /* pal 205*/ + RGBDEF( 247, 247, 255 ), /* pal 206*/ + RGBDEF( 0, 0, 0 ), /* pal 207*/ + RGBDEF( 0, 0, 0 ), /* pal 208*/ + RGBDEF( 0, 0, 0 ), /* pal 209*/ + RGBDEF( 0, 0, 0 ), /* pal 210*/ + RGBDEF( 0, 0, 0 ), /* pal 211*/ + RGBDEF( 0, 0, 0 ), /* pal 212*/ + RGBDEF( 0, 0, 0 ), /* pal 213*/ + RGBDEF( 0, 0, 0 ), /* pal 214*/ + RGBDEF( 0, 0, 0 ), /* pal 215*/ + RGBDEF( 0, 0, 0 ), /* pal 216*/ + RGBDEF( 0, 0, 0 ), /* pal 217*/ + RGBDEF( 0, 0, 0 ), /* pal 218*/ + RGBDEF( 0, 0, 0 ), /* pal 219*/ + RGBDEF( 0, 0, 0 ), /* pal 220*/ + RGBDEF( 0, 0, 0 ), /* pal 221*/ + RGBDEF( 0, 0, 0 ), /* pal 222*/ + RGBDEF( 0, 0, 0 ), /* pal 223*/ + RGBDEF( 0, 0, 0 ), /* pal 224*/ + RGBDEF( 0, 0, 0 ), /* pal 225*/ + RGBDEF( 0, 0, 0 ), /* pal 226*/ + RGBDEF( 0, 0, 0 ), /* pal 227*/ + RGBDEF( 0, 0, 0 ), /* pal 228*/ + RGBDEF( 0, 0, 0 ), /* pal 229*/ + RGBDEF( 0, 0, 0 ), /* pal 230*/ + RGBDEF( 0, 0, 0 ), /* pal 231*/ + RGBDEF( 0, 0, 0 ), /* pal 232*/ + RGBDEF( 0, 0, 0 ), /* pal 233*/ + RGBDEF( 0, 0, 0 ), /* pal 234*/ + RGBDEF( 0, 0, 0 ), /* pal 235*/ + RGBDEF( 0, 0, 0 ), /* pal 236*/ + RGBDEF( 0, 0, 0 ), /* pal 237*/ + RGBDEF( 0, 0, 0 ), /* pal 238*/ + RGBDEF( 0, 0, 0 ), /* pal 239*/ + RGBDEF( 0, 0, 0 ), /* pal 240*/ + RGBDEF( 0, 0, 0 ), /* pal 241*/ + RGBDEF( 0, 0, 0 ), /* pal 242*/ + RGBDEF( 0, 0, 0 ), /* pal 243*/ + RGBDEF( 0, 0, 0 ), /* pal 244*/ + RGBDEF( 0, 0, 0 ), /* pal 245*/ + RGBDEF( 0, 0, 0 ), /* pal 246*/ + RGBDEF( 0, 0, 0 ), /* pal 247*/ + RGBDEF( 0, 0, 0 ), /* pal 248*/ + RGBDEF( 0, 0, 0 ), /* pal 249*/ + RGBDEF( 0, 0, 0 ), /* pal 250*/ + RGBDEF( 0, 0, 0 ), /* pal 251*/ + RGBDEF( 0, 0, 0 ), /* pal 252*/ + RGBDEF( 0, 0, 0 ), /* pal 253*/ + RGBDEF( 0, 0, 0 ), /* pal 254*/ + RGBDEF( 0, 0, 0 ), /* pal 255*/ +}; + +static MWUCHAR imagebits[] = { +5,5,13,12,22,11,5,2,2,2,5,2,2,2,1,2,5,2,13,7,11,5,2,2,2,5,2,5,2,1,1,1,1,2,5,2,2,2,2,9,1,1,2,14,1,1,1,1,0,1,1,1,0,2,2,2,2,2,1,1,1,0,1,0,1,0,1,0,0,2,0,2,1,0,1,1,1,1,1,1,1,2,0,0,2,0,2,1,0,2,0,1,7,13,0,1,0,2,1,0,1,1,1,1,0,1,2,2,1,2,2,2,1,1,1,1,2,2,1,0,1,5,1,2,1,2,2,1,1,2,16,13,2,2,2,2,2,1,1,1,1,1,0,2,0,2,1,1,1,14,22,133,30,29,11,5,7,6,7,7,15,16,15,13,13,0,2,6,1,14,23,17,16,16,16,30,34,6,34,18,47,13,2,7,5,13,1,2,2,1,2,5,2,1,2,1,1,1,2,1,0,1,1,2,0,1,2,2,1,2,5,1,2,0,2,0,1,1,0,2,1,2,2,5,1,1,1,1,1,1,1,2,5,2,1,1,0,2,1,1,1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1,1,1,2,10,2,6,2,2,2,2,1,1,2,1,26,11,11,7,7,2,5,1,1,1,2,2,6,5,2,2,2,1,1,6,13,5,2,1,1,1,1,2,2,10,12,1,2,2,2,5,2,1, +1,1,1,1,1,1,1,1,1,1,2,5,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,2,2,1,11,11,5,13,13,2,2,2,2,12,13,21,2,0,2,2,2,2,2,2,2,6,2,5,11,13,16,29,14,30,29,21,29,22,14,2,6,1,2,2,2,2,5,13,13,36,29,16,16,14,14,16,13,13,11,0,1,2,1,5,2,2,2,6,2,2,2,2,2,21,13,2,2,12,2,13,2,7,7,29,13,13,12,13,11,8,11,8,7,7,6,2,6,7,8,7,7,7,7,2,2,1,1,14,7,7,6,7,2,6,6,7,6,2,1,1,6,5,7,13,2,2,2,7,2,6,2,2,7,2,6,13,2,2,7,7,6,2,13,2,1,1,1,1,1,1,1,1,0,1,1,1,1,2,1,2,7,2,2,1,5,2,2,5,7,2,7,11,7,6,7,6,2,1,2,2,1,1,0,2,1,1,0,1,2,1,1,1,2,2,1,2,1,2,1,1,1,2,5,1,2,2,5,2,2,1,2,1,2,1,2,5,2,2,5,2,5,11,6,6,6,2,6,6,2,2,2,2,1,1,1,1,2,1,1,1,2,10,7,7,2,1,6,5,1,1,2,2,13,11,7,10,11,2,2,6,1,2,5,9,2,1,1,1,1,1,2,2,10,2,6,1,1,1,1,2,11,9,6,5,10,10,10,2,2,1, +2,1,6,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,6,5,2,1,2,1,5,13,13,7,11,0,1,2,2,13,2,21,2,1,5,6,5,2,1,2,11,2,2,2,13,13,21,21,29,22,13,22,43,14,14,6,1,2,6,2,2,2,11,6,16,23,16,16,13,29,14,13,16,13,6,2,1,1,2,2,2,5,7,2,2,2,5,2,9,14,2,12,7,2,11,2,2,21,13,16,13,13,16,11,8,13,8,13,11,11,6,2,6,7,7,13,7,6,6,2,1,1,2,7,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1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,5,2,5,2,2,1,5,21,11,13,5,2,2,13,2,6,5,12,0,2,5,2,5,2,1,2,2,5,2,13,7,2,13,7,14,23,30,36,22,29,16,11,7,13,13,13,13,11,14,29,13,16,29,13,29,13,14,14,17,13,2,2,2,1,2,2,2,2,6,2,2,2,2,2,13,5,2,10,2,12,2,10,7,11,16,29,17,13,16,13,17,13,8,11,11,6,6,6,14,8,6,7,7,6,2,7,1,1,2,14,2,2,14,6,2,6,2,14,7,2,2,2,6,2,2,2,5,2,2,13,2,5,2,14,7,2,7,7,7,2,14,6,6,2,1,1,1,1,1,1,1,0,2,1,0,1,0,1,1,1,2,2,6,2,5,5,7,2,5,13,11,11,11,11,11,7,7,2,2,1,1,1,1,1,1,0,2,1,0,2,1,1,1,1,2,1,1,1,1,1,1,1,1,2,10,2,2,2,6,9,1,2,1,2,1,2,1,2,2,2,11,2,11,2,2,2,7,6,6,6,2,2,2,2,2,2,1,1,5,2,2,6,1,6,5,2,1,2,2,1,2,2,2,5,10,10,9,13,1,5,2,2,1,2,2,2,2,2,5,1,1,1,11,10,5,2,1,1,2,1,2,2,2,11,6,6,10,6,6,5,11,2, +1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,2,1,1,1,2,5,2,2,2,2,2,6,1,10,21,13,13,2,1,6,13,21,11,2,2,0,1,11,2,2,5,1,2,2,5,11,6,5,5,11,7,30,23,34,68,11,22,17,13,11,7,6,2,21,13,11,11,14,17,21,14,36,13,21,29,14,11,2,6,1,1,2,6,1,6,1,2,2,2,5,6,5,2,13,2,14,13,12,2,2,7,16,21,14,13,11,13,13,16,13,11,13,6,6,2,7,7,13,6,7,7,6,7,1,1,7,14,2,2,14,2,2,6,2,14,13,2,5,1,2,2,2,5,2,6,5,2,2,2,2,21,13,5,7,7,2,7,6,13,2,2,2,1,1,1,0,2,0,2,0,1,1,1,1,1,2,6,1,5,2,2,2,2,5,1,2,2,2,5,2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5,1,2,1,2,5,1,1,2,1,1,2,5,2,1,1,2,2,2,5,2,10,10,2,2,1,1,5,11,2,10,2,11,11,5,11,10,2,2,1,2,1,5,1,1,1,5,9,6,6,2,10,11,9,6,6,2, +2,5,2,5,5,5,1,2,5,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,2,5,2,7,5,5,2,2,11,5,12,13,2,2,5,2,5,2,13,1,1,5,1,5,2,2,7,2,13,22,49,45,16,45,47,21,32,2,13,11,13,13,13,21,11,29,22,30,43,29,22,12,21,14,11,13,29,1,2,2,2,5,2,1,2,5,2,5,2,13,1,12,2,5,5,2,2,2,5,1,2,11,11,13,6,2,11,17,15,15,15,7,11,6,6,11,7,7,2,6,5,2,2,1,1,2,1,2,2,2,2,6,2,2,7,2,2,1,1,2,7,6,2,5,5,13,2,2,2,6,1,6,1,6,6,14,7,6,7,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,5,2,2,2,2,2,6,2,5,1,13,11,13,13,13,2,1,0,2,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,1,1,1,1,2,2,5,2,1,1,6,1,2,6,1,2,2,2,5,2,10,7,2,5,6,7,13,11,2,2,12,2,2,2,2,2,1,1,1,6,2,1,5,1,2,1,1,2,2,2,1,5,2,12,11,2,5,6,2,5,1,1,2,2,2,5,10,10,10,6,10,5,1,2,1,2,1,1,1,1,2,1,2,11,9,6,5,2,11,6,6,2, +10,2,5,5,9,2,1,1,1,1,1,1,1,2,1,1,5,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,10,13,10,5,5,10,10,10,1,2,6,2,2,2,5,2,5,1,2,2,5,2,11,2,2,14,30,30,29,35,45,21,43,16,5,5,30,14,13,14,14,21,37,22,34,30,29,16,21,29,14,13,16,7,2,2,2,6,2,1,2,2,2,2,2,2,7,1,2,2,2,2,2,5,2,2,2,2,7,11,13,11,6,7,17,8,15,13,7,8,6,6,6,6,6,6,2,6,7,2,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10,2,2,2,2,1,1,5,2,2,5,2,2,2,1,2,5,2,5,1,5,2,2,5,2,2,2,2,5,1,9,2,1,2,2,6,10,7,2,1,1,6,1,6,1,2,1,2,2,2,1,2,25,2,9,7,2,13,13,6,36, +2,2,5,2,1,1,1,5,5,2,1,1,1,2,2,1,1,1,2,2,2,1,1,1,1,5,2,5,2,2,5,5,13,11,2,6,13,13,5,2,2,5,2,2,2,9,2,2,2,2,1,1,2,2,11,13,36,13,5,2,14,29,22,16,29,16,29,13,14,13,16,16,13,21,29,30,29,17,16,30,13,21,11,7,6,2,2,7,11,2,2,6,2,2,6,6,6,2,6,1,2,2,2,5,2,5,2,2,2,5,2,5,7,6,13,11,11,13,22,16,11,11,7,11,6,7,6,8,11,13,6,5,2,1,0,1,1,1,2,5,2,7,7,11,6,1,2,5,2,2,2,11,2,2,2,1,2,2,5,5,7,7,2,1,7,14,6,13,7,5,60,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,5,1,2,5,1,2,11,10,2,13,2,2,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,2,5,2,2,1,2,5,2,2,6,1,2,2,2,5,2,2,5,12,6,6,11,7,11,2,2,2,6,2,2,6,1,1,1,1,1,2,5,2,2,5,2,5,2,1,2,2,11,10,2,2,2,1,2,1,5,2,2,5,2,5,2,2,11,5,10,11,1,1,2,1,1,2,1,2,6,1,1,1,5,2,2,2,5,9,2,10,11,43,74, +5,5,2,5,5,1,1,5,5,5,1,1,1,1,1,1,1,2,6,2,2,5,1,2,1,2,11,2,2,2,6,5,14,11,13,7,16,26,15,1,2,2,2,5,2,2,1,2,2,2,1,2,1,2,13,30,16,13,6,13,30,32,43,34,29,30,30,22,29,29,22,13,30,13,21,37,45,43,14,21,14,21,11,11,8,2,2,6,6,2,2,2,5,2,6,6,6,7,2,6,2,2,6,1,2,2,2,6,1,2,1,2,7,6,7,11,11,11,18,13,15,13,6,11,6,6,13,6,6,6,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2,2,6,2,2,1,1,6,2,2,2,2,5,2,2,5,13,26,2,5,2,2,2,2,5,2,5,7,21,10,13,16,15,13,14,13,27,2,2,5,2,2,5,2,2,2,6,12,2,2,6,2,7,29,10,2,11,17,11,22,34,32,30,16,29,13,13,14,14,13,21,29,2,21,43,22,13,21,29,16,29,13,17,15,1,6,17,2,2,7,6,2,7,6,13,6,6,2,6,2,2,2,2,2,5,2,2,2,2,2,2,2,6,6,6,7,7,13,13,8,11,6,11,13,8,11,7,6,6,6,2,2,2,1,0,1,5,2,5,7,11,13,7,11,2,2,2,2,6,5,2,2,2,1,1,1,2,2,2,5,7,6,2,2,14,2,13,13,2,2,1,1,1,1,1,57,38,0,2,1,1,1,1,1,1,0,2,2,5,2,1,2,2,1,2,5,2,2,5,1,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,9,5,2,2,2,6,2,2,6,2,2,2,7,2,6,2,2,13,11,1,2,5,9,11,2,6,1,2,2,2,1,1,1,2,6,2,5,2,2,2,11,5,2,9,2,6,2,1,1,5,1,2,2,2,5,2,6,10,10,7,11,2,2,2,2,2,2,25,2,5,2,2,2,6,1,9,11,11,16,192,205,201,200,74, +2,6,5,1,2,1,1,5,2,5,2,2,6,2,2,5,2,13,12,5,2,5,2,5,2,6,2,5,21,16,11,2,30,16,14,21,16,2,2,2,2,2,6,2,2,2,21,2,28,13,22,15,6,7,17,9,2,11,22,30,22,34,43,30,22,29,14,29,14,15,13,21,17,29,16,30,30,17,17,17,17,16,13,15,8,2,14,11,2,2,6,2,2,2,7,7,7,6,2,2,2,5,5,2,6,1,2,13,2,5,2,5,13,7,2,6,7,13,6,2,17,7,2,11,7,11,8,13,11,6,2,2,6,1,1,1,1,2,1,2,2,2,2,6,2,7,2,11,5,13,7,2,5,2,1,1,1,7,5,13,1,5,1,2,2,14,6,14,8,2,2,1,1,1,1,1,1,1,1,1,2,1,0,2,0,2,1,1,2,2,2,1,1,1,2,5,2,2,6,2,11,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,1,2,2,2,6,1,6,1,11,7,6,2,6,2,2,10,2,2,11,11,2,6,2,2,5,6,2,2,1,1,2,1,5,1,1,5,1,2,9,2,5,9,6,2,2,6,1,2,2,6,2,1,2,2,2,11,6,2,11,10,6,10,2,1,5,2,2,25,2,2,2,9,2,25,1,2,6,11,13,165,205,201,201,204,201,131, +2,2,2,6,1,1,1,2,1,2,11,7,2,2,2,10,2,13,10,10,2,5,2,1,2,2,5,11,14,21,15,21,22,29,13,14,11,6,2,5,2,5,1,2,2,2,13,5,21,22,117,29,2,30,17,2,6,14,20,15,22,31,32,33,29,29,21,13,14,13,14,16,47,106,31,16,24,17,33,29,29,15,13,29,11,0,29,11,2,6,6,2,6,6,7,7,13,7,0,6,2,2,5,6,1,5,6,1,2,2,2,6,5,7,6,2,7,7,7,7,16,6,7,8,11,11,13,11,17,6,6,2,2,1,1,1,1,2,2,2,5,2,5,2,2,2,13,5,12,7,2,6,2,2,1,1,1,2,7,5,2,2,1,2,13,13,7,17,13,2,2,2,1,1,5,2,1,1,9,40,2,5,2,1,1,1,1,1,2,2,1,2,5,1,2,2,5,1,2,2,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,2,1,2,2,2,2,11,11,6,6,6,2,6,5,11,2,7,13,12,1,1,2,5,1,9,7,7,1,2,2,21,1,1,2,1,2,6,2,5,2,5,2,2,5,1,6,2,5,1,1,2,6,2,11,2,5,11,10,5,10,6,1,2,2,5,2,2,2,5,2,2,5,2,2,9,11,13,13,205,201,201,204,201,201,74, +2,5,1,1,6,2,1,5,2,7,13,11,2,5,7,29,14,15,13,21,13,5,5,2,6,1,2,5,7,21,21,29,22,22,13,29,7,2,2,2,2,2,6,2,2,12,7,21,12,29,130,18,15,120,6,6,1,14,22,18,22,122,37,29,16,16,13,14,13,15,47,106,43,18,15,24,24,29,33,18,30,22,11,8,8,1,16,7,1,11,2,2,2,7,6,7,13,2,2,2,5,2,2,2,12,7,2,13,2,5,7,2,13,7,6,6,7,13,8,6,16,6,13,17,13,11,11,11,11,11,6,6,2,0,1,1,1,1,1,5,2,2,2,2,6,1,14,6,2,2,1,2,2,6,1,1,2,7,7,2,2,13,1,5,13,14,7,7,13,2,2,7,5,5,65,7,2,2,1,9,9,51,9,10,59,1,2,1,2,1,5,2,1,2,5,2,2,5,2,5,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,6,5,2,5,2,11,2,10,6,6,7,11,6,2,2,7,11,11,10,2,2,2,5,2,6,2,10,5,2,2,25,51,11,1,1,5,2,2,5,2,12,2,5,2,2,6,1,2,2,6,1,6,1,2,25,2,11,6,2,9,11,5,2,2,26,38,64,10,5,2,5,2,2,9,5,6,26,8,130,205,204,201,201,200,201,74, +2,1,1,6,1,1,1,2,5,10,7,12,5,2,12,21,14,14,14,13,13,10,10,12,1,5,6,5,12,21,13,16,29,22,13,29,2,2,2,5,2,2,14,14,13,2,12,16,29,36,47,37,106,33,11,2,2,21,22,30,18,132,24,33,30,22,29,13,29,47,46,17,109,33,22,33,33,17,33,33,30,17,13,15,11,6,16,11,2,2,2,6,2,13,7,13,7,2,2,2,5,2,5,2,6,7,2,2,2,2,13,1,7,6,2,7,13,7,11,13,6,6,7,11,11,17,13,8,8,11,11,2,6,1,1,2,1,2,2,2,2,2,2,7,2,13,2,2,2,1,1,2,2,2,1,1,2,2,6,1,6,2,2,13,13,6,6,13,7,2,12,2,2,1,71,72,40,1,1,2,2,2,5,57,27,1,1,2,6,2,2,2,5,2,2,6,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,11,2,11,6,8,11,6,2,6,6,5,12,1,6,1,2,2,2,10,2,13,11,1,2,2,5,2,5,2,2,2,5,2,5,2,2,5,2,5,2,2,5,2,2,2,2,5,2,2,9,2,11,1,10,2,2,5,2,9,2,2,2,9,2,9,2,5,10,2,12,8,166,206,200,201,204,204,201,201,69, +2,6,1,2,1,1,1,2,13,13,13,5,2,2,16,29,26,2,21,15,12,10,5,12,10,5,2,12,21,29,13,13,16,22,29,13,1,6,2,2,2,13,13,2,2,2,13,21,13,23,43,31,31,11,8,6,6,6,16,21,29,47,46,24,31,21,22,11,34,47,31,31,46,105,29,46,18,31,33,18,30,17,11,17,8,2,14,11,2,6,6,1,7,6,11,13,7,6,6,1,2,2,2,2,5,2,5,6,2,6,2,2,2,6,6,6,7,11,11,13,13,11,7,11,17,11,11,8,7,7,6,2,6,2,1,2,1,2,2,2,2,12,6,7,2,2,2,6,2,1,0,2,2,5,1,1,2,5,2,6,1,2,1,2,6,6,7,7,13,2,1,2,1,64,40,5,9,1,1,1,40,25,38,6,1,0,1,1,2,1,2,6,2,2,5,2,5,1,2,1,5,1,2,2,5,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,5,2,1,5,2,6,6,6,7,11,11,13,7,6,6,2,11,2,6,1,2,2,2,5,1,13,11,2,2,2,6,2,2,1,2,5,2,2,2,2,5,12,7,2,12,1,5,2,5,2,5,2,2,2,11,2,11,10,9,10,5,2,2,2,6,1,5,2,2,6,2,5,2,9,9,21,176,205,201,201,201,201,201,201,204,131, +2,2,1,5,1,2,2,10,13,14,13,2,2,13,21,12,12,2,14,21,6,2,7,10,5,13,7,16,13,14,13,13,16,24,16,13,6,1,5,2,2,2,7,2,13,7,11,14,21,36,30,18,13,6,11,2,2,11,16,22,30,34,109,110,109,31,8,32,123,31,24,18,31,33,33,113,44,8,33,18,31,30,13,15,11,2,29,2,2,2,7,13,5,2,7,11,13,2,2,2,2,6,1,6,1,6,2,6,2,7,6,6,12,2,11,7,6,13,11,11,29,7,13,11,17,11,11,11,11,11,6,7,2,2,6,2,1,5,1,2,7,13,11,5,1,1,1,2,7,2,1,1,2,2,1,1,2,2,2,1,1,5,2,13,7,6,7,7,7,6,1,6,25,9,2,2,1,1,1,5,27,60,1,1,1,1,1,1,1,2,1,2,2,9,51,2,2,1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,2,2,6,2,11,2,2,7,6,11,8,11,6,10,11,7,6,2,2,5,1,2,5,2,11,11,7,6,6,5,2,2,1,6,2,9,2,5,9,25,9,1,2,13,10,6,2,2,2,1,2,5,2,5,2,2,10,12,10,2,2,2,13,26,2,6,2,5,0,2,2,2,9,13,2,121,205,198,204,201,198,201,204,201,198,74, +2,5,2,2,1,2,6,7,13,11,11,7,5,5,10,13,12,2,13,11,2,7,7,6,2,13,13,7,11,6,7,13,13,17,29,6,2,2,6,2,5,2,11,2,13,16,10,12,16,13,36,17,11,11,6,11,29,22,17,13,13,22,34,110,114,24,30,34,20,24,20,18,106,33,33,33,18,13,109,24,33,18,11,15,6,11,14,2,6,6,7,6,6,7,13,13,7,2,2,2,5,1,5,7,11,7,7,7,2,11,2,7,11,2,13,2,11,11,11,8,8,11,11,13,21,28,17,13,7,13,11,6,2,6,1,2,2,2,2,5,7,7,7,2,1,1,2,7,2,2,1,1,2,6,1,1,2,5,2,2,1,2,7,6,13,6,7,7,13,1,5,2,2,2,1,2,2,1,1,2,1,27,40,2,1,1,1,1,1,2,6,1,6,1,2,2,1,1,1,1,2,2,2,5,2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,2,1,1,2,2,6,1,2,2,11,6,6,11,13,8,11,6,2,12,11,7,6,1,2,2,2,2,2,13,11,11,1,9,2,5,2,5,1,9,2,25,7,2,2,5,9,10,10,5,2,5,2,5,1,1,1,1,2,2,11,2,2,6,1,2,5,10,1,2,2,51,76,91,40,2,2,9,2,29,206,201,200,201,198,204,201,204,204,201,74, +2,1,2,6,1,6,1,10,11,13,7,13,5,2,5,13,2,2,21,13,6,6,7,11,6,7,6,2,2,6,7,6,14,36,11,6,6,2,2,2,2,2,7,7,21,16,2,7,12,30,130,8,13,6,16,21,13,29,14,29,14,30,34,109,122,22,17,46,33,33,18,33,33,24,24,24,17,11,110,24,24,18,13,15,13,16,13,11,2,6,7,7,7,6,7,7,2,6,2,2,6,2,5,5,2,7,7,6,6,7,11,13,6,2,2,2,11,13,11,7,13,6,13,16,13,29,29,13,17,11,11,6,6,2,5,2,5,1,2,2,5,6,1,1,1,1,2,6,13,1,1,2,5,2,1,1,2,1,1,1,1,1,2,7,11,7,6,6,2,2,2,2,2,1,2,26,5,1,1,1,1,5,9,0,1,1,1,1,1,1,1,7,2,5,1,2,2,1,1,1,1,1,2,2,2,9,2,2,2,1,1,1,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,2,1,2,1,10,1,2,5,2,6,11,2,7,11,6,11,11,2,11,7,11,11,6,6,2,2,2,10,11,13,11,6,2,5,9,2,1,2,5,5,5,9,5,9,2,5,2,25,2,11,2,2,9,2,2,2,5,2,2,9,11,2,2,2,5,2,2,9,11,5,2,2,12,2,6,10,12,35,67,192,204,204,200,198,204,201,198,200,200,201,74, +2,6,1,2,6,1,5,11,5,10,13,13,11,11,5,2,2,13,13,13,11,11,13,8,7,7,2,6,6,2,6,13,16,16,21,7,2,2,5,2,5,2,2,13,16,30,30,17,29,22,47,17,8,13,116,16,21,22,14,30,11,16,43,110,132,18,43,108,18,24,24,33,24,109,33,24,11,11,114,33,24,44,7,18,22,17,11,2,2,11,6,6,2,13,7,13,6,2,7,2,2,2,2,2,5,6,1,2,2,5,2,13,2,2,6,12,11,14,11,13,17,1,13,22,13,30,16,7,21,13,11,7,2,2,1,2,2,1,2,14,35,1,0,1,1,1,2,7,2,2,1,2,2,2,1,0,1,1,2,1,1,2,2,13,6,2,7,2,6,2,6,2,2,5,2,2,1,1,1,1,2,1,1,1,1,1,1,60,131,13,13,2,2,2,2,2,1,1,1,1,1,2,5,2,2,1,2,1,1,1,1,1,1,1,1,2,1,5,1,2,1,1,2,1,1,1,1,1,1,2,5,2,1,2,2,6,1,2,13,11,2,11,13,11,8,11,7,7,11,10,11,2,6,2,2,13,11,5,2,2,11,10,2,2,5,1,2,9,5,2,5,9,2,25,2,2,2,5,2,6,2,2,2,5,1,2,5,5,6,1,2,2,6,1,5,2,5,9,2,25,2,2,2,2,11,192,206,204,200,200,200,199,199,200,198,200,200,195,200,74, +2,2,5,2,2,2,5,10,7,13,7,13,17,21,11,2,2,2,21,11,11,13,6,11,6,8,2,6,7,13,13,14,17,30,13,6,6,2,2,2,2,2,12,13,30,47,47,34,36,119,114,8,13,20,20,13,13,11,16,13,14,29,16,24,20,15,22,108,20,33,18,111,109,109,20,31,13,6,109,24,33,18,11,29,18,14,13,2,7,7,7,13,7,7,13,7,2,13,2,2,6,2,13,5,7,12,12,13,2,2,2,11,2,2,2,2,11,15,13,13,11,2,16,16,13,16,29,6,16,8,7,6,6,2,2,6,1,1,2,16,12,1,1,1,1,0,2,7,6,1,0,1,5,2,2,1,1,1,1,1,1,1,2,7,7,13,6,6,1,2,2,2,5,2,2,1,1,1,1,2,6,0,1,1,1,1,2,9,11,1,2,2,6,2,1,1,1,1,1,1,1,1,2,2,5,2,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2,1,2,2,5,2,9,6,6,7,2,6,11,11,7,7,7,11,2,10,2,13,2,2,2,1,2,2,6,2,11,5,7,5,9,2,5,9,9,5,9,2,5,2,2,5,2,9,5,10,1,2,6,2,2,6,9,2,5,5,78,7,11,1,2,6,2,9,2,5,11,51,7,2,11,166,201,198,200,198,196,199,199,199,199,196,199,195,196,199,131, +2,5,2,2,5,2,2,10,21,11,7,13,13,21,6,1,5,13,13,7,7,11,7,11,17,6,2,13,13,14,13,13,22,16,11,6,2,2,5,2,2,5,14,45,117,119,119,32,47,47,125,29,11,24,114,26,6,7,13,7,22,16,16,45,122,18,22,111,33,109,24,114,111,109,31,18,11,11,114,24,37,18,11,33,33,11,13,2,11,7,13,7,6,13,21,11,2,7,2,7,2,2,2,13,11,13,2,2,2,5,2,5,2,5,2,7,17,11,11,7,13,1,13,17,11,21,17,6,17,11,11,6,2,1,2,2,1,1,2,10,7,2,2,1,1,1,2,7,2,2,1,1,2,2,1,1,1,1,1,2,1,1,2,2,6,7,7,2,2,12,1,26,10,1,1,1,1,1,1,1,25,26,2,1,1,2,1,1,5,2,2,11,2,2,2,9,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,5,2,1,2,1,2,2,2,2,10,6,2,11,11,6,11,8,11,13,11,6,7,7,2,11,1,1,1,11,2,2,5,9,2,2,5,2,2,9,2,2,2,2,2,6,2,2,2,2,10,2,11,2,2,2,2,2,2,1,12,69,200,65,74,70,5,1,9,2,10,13,60,35,64,78,188,204,204,200,200,200,198,200,196,195,200,199,199,198,199,200,74, +2,1,5,2,2,5,5,13,11,13,5,7,13,7,2,2,13,12,7,13,13,11,8,8,7,11,2,13,6,11,13,22,31,17,11,6,6,2,2,2,2,2,29,106,32,30,34,30,117,140,123,19,8,34,105,1,11,6,29,29,30,24,30,45,34,11,22,106,33,33,24,118,114,109,33,18,13,11,114,108,109,16,13,46,18,11,21,2,6,11,7,7,13,17,16,2,11,2,2,13,17,6,5,26,2,5,2,6,2,2,7,2,2,2,11,13,13,13,7,13,6,1,7,13,16,13,16,11,13,11,13,2,6,2,2,5,1,1,2,22,7,6,0,1,1,1,2,7,6,2,1,2,1,1,1,1,1,1,2,1,1,1,2,7,6,6,6,2,2,2,1,21,1,1,1,1,1,1,0,1,2,1,1,1,1,5,2,2,2,2,5,2,2,5,2,2,1,1,1,1,1,2,1,1,1,2,2,5,1,1,1,1,1,1,2,1,1,2,1,1,1,2,1,1,1,1,1,1,2,1,5,2,2,5,2,2,6,6,6,6,6,7,7,7,11,11,13,11,5,2,12,10,2,1,1,5,1,9,9,2,5,2,5,2,2,6,2,5,11,2,2,2,2,2,2,6,6,2,2,11,2,2,11,2,6,6,134,204,200,204,196,190,134,1,13,29,5,11,192,131,200,204,204,204,198,201,198,200,203,199,196,179,200,179,200,179,199,198,179,74, +2,1,2,5,10,2,10,10,7,13,10,7,21,11,2,6,5,13,6,11,13,13,11,13,11,17,2,7,7,7,29,24,24,16,11,13,2,2,2,6,2,11,22,29,22,30,47,36,45,147,125,31,8,136,33,11,2,6,11,13,16,16,13,33,106,32,43,110,33,33,24,111,114,111,24,15,11,15,118,33,110,11,29,34,109,13,2,2,11,11,11,13,14,22,13,7,6,2,6,21,29,13,13,2,2,2,5,2,5,2,6,2,5,2,11,13,13,11,11,13,2,1,11,13,16,21,29,7,11,11,11,6,2,2,6,1,1,1,12,14,6,2,1,1,1,1,2,6,1,1,1,6,1,1,1,1,1,1,1,1,1,1,1,1,6,7,2,2,6,1,26,10,12,10,1,1,1,1,1,1,5,2,1,1,2,2,2,2,6,1,2,2,2,10,2,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,2,1,1,1,1,1,2,1,2,1,2,1,6,1,5,2,2,11,11,6,6,6,6,6,7,13,11,7,6,10,10,2,2,1,1,2,9,5,5,2,6,9,2,9,2,2,2,2,2,11,2,6,43,67,155,78,28,13,167,67,16,7,13,22,50,198,200,200,199,199,195,200,204,178,204,201,30,175,204,201,198,204,199,200,200,200,200,200,200,198,198,199,194,198,179,198,202,194,198,157, +2,2,6,2,2,2,2,5,12,11,13,13,13,11,5,2,5,2,6,11,13,11,7,13,11,11,2,7,11,17,29,30,24,11,7,7,6,2,2,2,7,23,16,16,22,36,45,30,116,145,109,18,16,18,24,11,2,2,13,29,13,22,30,47,119,32,36,34,33,109,109,114,111,109,32,17,13,13,111,20,110,13,18,109,20,11,2,1,11,15,15,10,16,24,13,13,6,2,6,13,16,21,14,2,6,12,2,2,2,5,1,2,2,2,13,13,7,11,14,17,2,1,7,15,17,16,13,11,11,11,11,11,2,6,1,2,1,1,14,11,2,5,0,1,1,1,2,2,2,2,41,2,2,6,1,1,2,1,1,1,1,1,1,2,11,7,35,40,2,60,67,2,10,2,1,1,2,1,1,1,1,2,2,1,2,6,9,2,2,11,6,2,2,2,2,2,0,1,1,1,0,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,2,2,6,1,2,2,2,11,6,6,11,8,11,11,13,2,2,10,11,2,2,1,1,2,5,2,5,2,2,2,5,5,2,2,5,6,65,78,65,167,199,179,177,199,194,170,202,198,195,176,195,199,203,179,198,179,200,198,179,200,195,199,200,200,200,204,196,200,200,198,200,198,204,200,200,198,200,199,199,198,198,194,198,198,198,198,179,74, +1,1,2,2,5,2,6,5,13,14,13,10,11,13,2,2,11,2,11,7,11,7,13,11,13,13,2,11,11,14,32,33,29,110,105,15,2,2,6,7,16,29,16,17,22,22,22,34,126,146,114,18,8,8,24,8,11,6,6,14,29,16,13,34,34,46,17,34,33,24,33,118,114,108,109,15,2,7,122,111,111,11,22,22,24,11,6,0,13,11,15,15,22,22,13,6,2,2,13,13,13,29,7,2,2,2,5,6,2,2,5,2,2,13,7,7,29,17,29,21,2,2,13,16,16,14,13,13,8,13,13,11,2,1,2,6,1,1,13,7,2,2,1,1,1,1,2,13,6,0,2,1,6,1,2,0,2,0,2,2,2,2,2,11,2,21,38,6,1,40,51,6,2,1,1,1,1,1,1,1,2,1,1,2,1,2,2,6,1,5,6,11,2,2,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,6,1,5,1,1,1,1,1,1,1,1,1,1,1,2,2,2,6,2,5,2,2,5,2,6,6,6,7,11,11,11,8,2,11,11,13,2,11,2,1,5,2,2,2,2,2,2,29,175,7,66,190,75,2,169,179,194,169,171,194,173,171,194,194,194,173,179,194,173,179,194,179,179,198,198,179,198,198,179,196,199,199,199,200,198,200,199,200,200,203,200,198,200,202,196,198,179,198,179,198,198,179,198,177,179,131, +1,1,5,2,2,5,11,6,7,13,7,11,7,10,6,5,7,2,2,11,7,7,13,13,7,7,2,13,11,16,34,36,46,119,116,11,6,2,6,29,16,30,16,22,11,106,110,114,126,150,115,8,8,22,19,31,31,2,16,30,30,32,22,22,37,109,14,33,31,33,109,111,111,109,111,11,11,29,111,122,109,6,6,110,111,11,0,2,11,16,15,22,30,13,21,11,6,6,7,14,22,30,2,5,5,5,7,2,2,2,6,2,5,13,13,14,17,29,29,14,5,1,2,13,13,29,14,13,15,13,11,6,6,2,6,1,1,1,14,13,1,1,1,1,1,2,6,5,2,6,2,2,2,64,76,1,1,1,1,1,1,1,2,11,2,12,2,2,72,12,9,1,2,1,1,1,1,1,1,1,1,9,5,2,2,5,2,2,6,6,7,2,5,2,2,5,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,2,2,2,2,2,6,1,6,6,11,6,6,11,6,7,7,2,6,8,11,13,6,2,2,2,2,2,6,2,6,21,168,179,168,173,179,158,66,177,173,171,171,177,169,194,177,179,179,177,194,173,194,179,179,179,194,179,198,179,202,195,179,200,198,199,179,199,199,200,199,196,198,200,200,196,199,199,195,198,198,198,198,198,202,179,198,179,198,179,74, +1,1,2,2,6,1,11,6,13,13,13,11,7,7,2,10,11,6,2,13,13,13,13,11,13,7,2,7,14,18,37,22,110,132,120,11,2,13,16,34,18,37,29,23,106,138,106,136,138,146,113,6,13,20,15,24,122,6,22,18,29,29,22,29,34,33,14,17,31,34,114,114,116,106,111,29,3,29,109,125,109,6,14,126,117,13,2,0,11,17,22,16,11,7,11,2,2,2,13,16,30,30,2,2,5,5,5,12,2,5,2,2,13,11,7,14,23,29,16,2,2,5,2,13,15,14,17,13,17,5,11,13,7,6,1,2,1,2,13,1,2,1,1,1,2,2,2,13,6,2,2,2,5,1,1,1,2,1,1,1,1,1,7,13,2,6,2,2,5,1,2,5,1,5,1,1,1,1,1,1,1,1,2,5,2,2,2,1,2,10,10,13,2,5,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,6,1,2,1,1,1,1,1,1,2,6,1,5,2,5,2,2,2,2,11,11,11,6,11,6,11,6,6,7,6,2,6,5,2,2,1,6,5,2,11,2,155,171,162,194,171,168,177,177,171,169,194,168,168,171,177,169,194,171,177,194,194,177,194,194,173,179,198,194,195,179,198,198,179,196,198,199,198,179,198,199,200,199,199,200,198,200,196,199,195,198,198,179,198,179,199,179,198,179,194,74, +1,2,2,5,2,2,10,6,13,11,10,5,11,5,2,13,13,2,11,13,7,13,7,14,21,7,2,13,16,22,46,16,46,126,106,6,2,7,7,29,16,32,15,132,119,126,124,144,140,152,19,6,8,19,22,18,21,2,29,22,22,30,17,14,30,24,13,17,110,109,109,111,109,109,109,15,11,13,108,132,116,6,110,126,122,13,2,11,14,22,45,2,5,13,2,13,2,7,13,29,32,21,1,2,6,2,2,2,2,2,2,2,21,7,13,29,16,23,2,1,2,2,2,13,13,13,14,11,11,8,13,13,6,2,2,6,2,2,2,5,6,1,1,1,2,5,2,13,7,6,1,2,7,6,2,5,5,1,1,1,1,2,13,11,2,2,2,2,1,1,2,9,2,1,1,1,1,1,1,1,1,2,1,2,10,5,5,2,2,10,7,2,2,2,2,2,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,5,1,2,1,1,1,1,5,2,1,2,2,6,1,2,5,2,5,2,6,2,13,6,11,13,11,11,11,2,2,13,2,2,2,6,6,2,2,11,66,171,194,162,168,169,194,171,171,171,177,168,171,171,171,175,171,169,194,168,173,168,171,179,194,194,179,198,179,194,198,179,202,195,194,198,198,179,198,202,179,198,200,199,199,199,199,199,199,198,199,179,202,198,198,179,198,202,179,179,74, +1,5,2,2,1,2,5,5,10,11,7,10,7,5,5,21,11,2,5,13,13,13,14,13,13,7,6,13,14,32,43,17,48,106,33,11,6,13,11,30,29,16,8,106,132,138,149,140,138,153,19,6,8,126,114,33,11,2,7,16,36,17,29,22,34,15,22,22,34,33,109,114,119,33,24,8,6,13,109,109,44,2,119,123,114,17,29,2,21,30,11,1,2,7,6,7,7,12,13,21,32,11,2,2,2,2,6,2,11,2,6,5,7,7,7,29,22,16,0,2,2,2,11,13,13,17,13,8,6,14,11,13,6,1,6,1,7,2,13,2,2,1,1,1,2,2,2,14,7,2,1,2,13,1,1,2,6,2,5,2,1,1,11,7,11,6,2,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,6,2,5,2,2,5,2,11,6,2,2,6,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,6,1,5,2,2,2,6,2,2,2,2,11,7,7,7,6,14,11,6,6,2,6,1,2,6,11,11,6,6,6,42,194,169,168,162,171,162,168,162,168,171,173,169,171,168,171,171,162,168,168,171,194,168,194,168,169,179,177,179,179,198,198,179,198,179,195,179,179,198,195,194,179,195,179,202,195,202,179,200,195,198,198,198,179,199,179,198,198,179,179,179,69, +1,2,2,5,1,1,2,5,12,11,7,10,13,2,5,13,11,11,2,14,13,13,13,13,7,5,2,13,29,36,22,16,18,119,120,11,7,7,7,34,11,17,29,119,123,125,140,138,140,148,4,13,15,126,33,13,13,29,14,29,32,29,13,13,32,11,13,24,110,106,106,114,116,110,18,13,6,15,111,132,18,11,116,119,111,15,29,6,6,13,11,2,2,2,2,5,13,7,11,30,30,2,12,2,5,5,1,2,21,2,2,2,13,13,14,30,30,29,1,1,1,2,12,11,8,13,11,13,13,13,11,13,2,2,2,5,2,13,6,2,2,2,1,1,2,5,5,6,7,6,2,2,2,2,6,1,2,7,7,6,1,2,5,11,2,2,6,1,1,1,1,1,1,1,1,2,5,1,1,1,1,2,1,2,2,2,5,2,2,9,6,1,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,2,6,1,2,1,5,1,5,2,2,11,2,11,2,10,10,13,10,7,11,1,2,2,6,11,11,11,11,2,69,169,162,162,167,169,169,168,171,175,169,171,168,168,171,171,162,169,168,168,168,168,169,168,171,194,177,175,171,177,179,179,195,202,179,198,179,179,179,198,179,179,198,198,198,179,198,198,198,177,198,194,179,179,198,179,198,198,179,198,179,194,74, +1,2,6,6,1,6,5,10,2,2,5,11,5,2,13,13,13,11,6,13,14,14,16,16,13,29,7,16,16,33,13,13,22,106,119,15,7,11,13,22,7,17,22,133,116,116,137,144,139,150,8,13,16,122,29,11,13,16,16,16,16,13,5,6,109,6,7,34,110,116,34,123,106,111,24,11,6,15,111,141,8,13,122,122,116,22,18,2,6,13,6,2,2,5,2,5,2,10,16,43,6,7,6,2,2,2,6,2,12,2,6,5,14,7,16,30,23,13,2,1,2,1,2,13,11,11,16,6,13,13,11,13,6,1,2,2,2,5,2,7,1,1,2,6,2,2,11,6,2,2,5,2,11,2,1,13,5,11,13,6,2,6,2,21,36,21,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,5,2,5,5,11,2,2,2,10,6,7,2,1,1,1,1,1,1,1,1,26,5,1,1,1,1,1,1,1,1,5,2,1,1,1,2,1,2,1,1,1,1,1,1,1,2,1,2,5,2,2,6,2,2,5,2,10,10,5,11,13,13,6,5,10,2,11,11,11,15,11,2,6,66,169,166,162,169,162,168,162,169,162,162,162,171,171,168,168,169,168,168,168,177,162,168,168,177,162,171,171,169,177,194,194,177,177,179,202,179,179,179,179,177,198,202,179,177,199,179,198,179,179,179,179,179,179,179,173,195,179,195,202,179,179,177,74, +1,2,2,11,5,1,2,7,2,5,2,5,2,5,21,13,13,13,13,11,13,13,13,13,11,13,6,14,22,32,8,11,22,106,114,15,13,2,16,22,11,15,119,141,110,106,144,138,128,150,4,11,24,24,6,16,16,29,13,13,13,6,6,7,114,2,29,37,110,106,106,123,116,46,8,13,6,17,118,138,6,13,122,122,120,20,15,2,2,13,6,2,2,2,2,2,2,13,6,11,13,6,2,2,2,5,2,2,13,2,2,2,14,7,14,29,30,13,2,1,2,2,2,21,13,29,16,13,14,8,7,13,2,2,2,6,5,2,13,1,1,1,1,2,2,2,12,2,11,2,2,12,2,2,5,11,2,12,11,7,6,2,2,35,30,2,2,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,5,2,2,2,11,2,12,2,11,6,7,2,6,1,1,1,1,1,1,2,1,2,6,9,2,1,1,1,1,1,1,2,2,1,2,5,1,1,1,1,1,1,1,1,1,1,5,2,1,6,1,1,2,2,6,5,7,6,2,6,7,17,13,2,9,2,7,10,13,13,11,6,66,159,169,162,169,162,162,162,162,162,162,162,169,168,168,168,169,168,168,168,169,162,168,168,168,168,168,169,168,168,194,162,171,171,194,179,194,179,179,194,173,198,194,173,194,179,198,194,194,179,194,179,179,202,179,177,194,179,173,179,179,202,194,179,171,74, +1,2,5,2,2,2,6,5,5,2,1,2,10,12,11,11,13,13,17,11,11,11,13,13,6,11,2,29,16,33,13,13,33,116,116,31,17,6,22,16,7,37,144,139,110,117,141,127,138,150,4,6,17,24,11,22,16,7,13,13,7,6,2,14,111,2,34,109,47,122,33,47,116,22,17,6,2,22,116,126,1,22,122,122,116,33,7,11,2,6,6,2,6,2,2,6,2,13,13,13,13,2,7,2,5,2,2,2,13,2,2,6,2,6,7,13,22,11,6,1,2,1,2,15,13,11,7,6,13,13,13,11,2,2,5,1,2,2,13,2,1,1,2,5,2,5,2,6,2,6,7,6,2,2,6,5,6,7,13,13,7,7,13,7,2,2,5,2,1,1,1,1,1,1,1,5,2,1,1,1,1,2,2,2,6,2,5,2,7,6,7,6,11,6,6,0,6,1,1,1,1,1,1,1,2,51,2,1,1,1,1,1,5,2,5,2,1,2,2,2,1,2,1,1,1,1,1,2,1,2,2,2,2,6,1,5,1,2,2,2,6,6,21,16,11,10,5,9,11,1,13,10,13,42,168,162,162,162,167,169,168,162,167,169,169,167,168,162,162,162,168,162,168,162,171,162,171,162,168,168,162,162,171,171,162,168,171,171,177,171,177,194,194,177,194,179,179,194,173,179,177,179,179,173,194,179,194,177,194,173,179,177,179,179,179,194,179,169,173,74, +1,1,2,2,5,2,2,5,2,2,6,1,2,2,2,5,11,13,22,11,6,8,11,8,11,13,7,29,16,30,11,15,44,122,122,106,17,7,46,17,16,133,139,149,106,132,144,138,138,153,113,19,22,44,17,21,13,13,13,13,6,2,2,13,110,2,36,22,106,34,33,31,114,11,6,6,6,18,106,106,2,114,126,126,122,108,6,2,2,2,7,6,2,2,2,2,11,7,14,14,13,2,6,2,2,2,2,5,7,13,1,7,6,14,13,17,22,7,2,2,2,5,7,6,6,2,6,11,13,11,13,7,1,2,2,13,1,7,7,6,1,1,2,2,6,11,11,6,2,7,5,2,5,1,5,7,2,11,13,13,7,13,6,7,6,2,2,1,2,2,1,1,1,1,2,2,1,1,1,1,2,5,2,2,5,2,10,11,6,7,8,11,11,6,2,2,2,1,5,2,2,1,1,1,1,1,1,2,1,1,1,1,2,1,2,2,2,5,2,2,5,1,2,1,1,1,1,1,2,5,2,5,2,2,2,6,2,5,11,2,6,11,14,15,13,2,5,11,11,5,15,13,15,69,162,162,162,162,162,169,162,162,162,162,171,162,168,162,168,162,162,168,162,162,162,168,162,168,168,162,162,171,162,171,169,194,160,171,162,194,171,177,171,194,169,179,194,177,179,194,194,173,173,194,179,179,171,179,171,179,177,194,173,179,179,179,173,171,171,74, +2,5,2,5,10,27,21,7,2,5,2,6,2,5,2,2,13,11,16,11,6,13,13,13,13,11,6,17,16,22,13,17,34,119,120,111,17,6,109,18,30,130,144,133,119,132,144,149,142,150,115,147,113,13,13,13,13,16,29,14,7,6,6,22,8,13,116,24,116,110,46,139,108,8,13,2,15,18,46,6,11,123,138,132,123,109,11,6,6,6,11,6,2,6,6,2,11,7,17,15,13,2,2,6,2,13,2,2,7,6,6,2,6,7,7,22,32,6,2,2,1,2,2,7,2,6,11,13,11,7,13,6,1,2,6,2,5,11,7,2,1,2,2,2,13,13,14,8,2,7,6,2,2,2,5,2,13,13,11,13,11,11,14,2,5,2,2,5,2,5,1,1,2,1,1,1,1,1,2,1,2,1,5,2,2,7,13,11,11,13,11,11,17,6,2,6,1,1,1,0,2,1,6,0,1,1,2,51,2,0,1,1,2,6,1,5,1,1,1,2,2,5,1,2,1,1,1,1,1,2,2,2,2,5,2,2,2,2,9,13,6,14,13,21,26,10,27,11,11,6,11,49,166,169,162,159,162,162,162,162,162,168,169,162,168,168,160,175,169,162,168,162,162,168,162,168,162,169,162,168,168,162,171,162,194,162,194,171,177,162,168,171,169,194,171,173,177,171,177,171,179,179,177,194,179,179,194,179,177,179,179,194,173,179,173,171,177,171,162,74, +2,2,5,2,5,5,1,5,5,11,1,1,2,2,6,2,11,13,29,15,11,15,15,13,11,11,6,16,29,16,8,22,36,116,123,122,8,11,119,122,37,133,149,137,133,132,132,136,149,150,113,150,115,6,11,11,17,16,13,7,6,1,6,18,2,32,111,46,119,138,34,133,105,13,18,6,29,24,15,2,14,144,136,116,126,111,15,6,11,1,13,11,2,2,11,7,13,11,23,17,11,2,2,2,7,2,2,2,13,7,6,7,2,7,13,22,17,6,2,2,1,2,7,2,2,13,7,13,13,11,13,2,2,2,13,2,2,13,6,2,2,2,2,6,7,13,6,14,7,6,2,2,2,2,5,6,7,13,13,11,11,7,11,2,2,6,2,2,1,2,1,1,1,2,1,1,1,1,1,1,1,2,2,5,11,11,11,11,6,11,13,11,8,11,2,2,2,2,72,72,73,27,38,10,1,1,2,27,25,10,1,1,1,2,2,2,6,2,5,2,6,1,1,1,1,1,1,1,2,6,1,5,2,2,2,11,11,10,11,2,21,7,13,7,10,5,10,11,40,155,168,168,162,159,162,162,169,159,162,162,168,162,168,168,168,162,171,169,162,162,168,169,162,162,168,168,168,168,168,168,162,171,162,168,162,168,169,169,162,171,162,167,168,168,168,171,168,168,171,169,171,179,177,194,173,169,179,173,194,169,173,179,194,179,194,173,194,173,162,74, +5,1,1,2,5,2,6,10,7,13,2,1,5,2,2,2,2,13,17,22,6,11,15,13,11,11,6,16,17,17,6,33,109,132,116,125,17,6,123,122,116,132,130,133,126,126,133,144,150,153,115,150,114,2,6,6,7,7,6,2,6,6,2,7,2,106,22,114,132,123,34,122,114,33,33,2,33,109,15,2,22,138,140,150,126,29,8,2,2,2,11,11,2,2,5,11,13,13,21,2,2,2,6,2,7,2,6,2,1,11,2,6,5,7,13,22,11,11,6,1,2,2,6,7,12,2,6,13,13,13,13,6,6,7,5,2,2,2,12,2,1,2,7,7,7,6,13,7,7,13,2,5,1,1,12,6,7,11,13,7,6,11,6,2,5,2,2,5,2,2,5,2,1,1,1,1,1,1,1,1,2,5,2,2,2,13,11,11,6,13,11,17,15,11,6,2,5,1,9,25,9,38,51,38,51,10,1,9,25,9,1,5,2,2,1,5,2,2,2,2,2,2,1,1,2,1,1,2,5,2,2,2,5,2,2,11,10,7,11,2,11,13,10,10,28,11,17,43,169,162,160,162,162,162,162,162,160,169,162,162,162,162,167,169,169,162,162,162,168,168,169,169,169,169,169,169,168,168,168,168,162,169,162,162,169,162,167,169,169,162,171,162,162,162,168,169,162,168,169,173,162,173,179,177,194,194,171,177,171,177,194,169,179,173,179,171,173,171,168,74, +2,6,2,5,5,1,2,5,5,2,1,2,2,5,2,5,6,13,22,15,11,17,8,7,13,11,16,43,17,29,13,34,34,119,110,132,18,11,117,119,34,130,132,133,150,123,133,144,150,152,143,148,105,6,6,6,6,6,6,6,2,6,6,6,16,123,18,132,114,123,144,125,114,34,106,6,34,114,15,2,34,148,144,124,114,8,11,2,2,6,16,6,2,6,7,13,11,7,2,6,7,6,1,7,6,2,13,6,13,7,5,7,6,13,12,8,13,6,2,6,2,1,7,2,2,2,11,13,13,16,7,13,6,2,7,6,2,2,13,1,2,2,13,11,6,8,7,7,7,7,2,2,2,1,5,7,7,10,7,11,11,11,6,2,2,2,5,2,2,6,2,5,1,1,1,1,2,1,1,2,5,2,2,5,2,11,11,6,13,8,13,8,17,8,2,2,2,2,1,2,27,10,1,1,1,1,1,10,1,1,2,2,5,2,2,2,2,2,5,2,2,5,2,2,5,2,1,2,2,2,1,6,2,5,2,6,10,9,11,6,13,10,21,13,14,11,22,169,160,160,162,160,162,169,167,160,167,160,168,162,162,171,162,168,162,168,168,169,169,162,168,168,168,169,162,168,168,171,162,168,162,162,162,162,162,162,162,162,171,169,162,162,162,162,167,171,162,171,162,171,171,173,171,169,177,194,179,177,171,169,177,173,194,173,173,194,171,173,169,74, +2,1,2,6,2,2,5,2,5,2,1,5,2,6,1,2,7,13,17,15,5,13,15,8,13,13,36,109,32,16,16,47,46,106,110,126,31,13,106,132,129,123,136,130,136,119,130,139,146,153,143,143,113,11,17,8,11,6,6,6,6,2,6,2,110,116,31,123,126,140,144,136,126,116,108,7,32,110,31,2,106,138,138,122,110,17,2,6,2,21,17,11,1,2,11,16,13,11,6,7,7,2,2,2,7,7,7,2,6,2,13,1,7,13,8,13,7,11,6,2,6,6,2,2,13,7,13,14,11,8,6,14,6,1,12,1,2,13,6,7,2,5,7,13,7,13,13,8,6,2,2,2,2,2,2,2,12,11,6,13,8,17,6,2,2,5,2,2,6,1,1,2,2,1,1,1,1,1,1,1,2,2,5,2,5,11,13,15,13,17,11,13,17,11,6,1,2,5,2,1,1,1,5,1,2,2,1,1,1,2,5,2,2,2,1,6,5,1,2,2,5,2,5,2,2,2,1,2,6,1,1,2,2,2,2,5,2,2,5,11,10,6,21,28,15,64,155,162,169,166,162,162,162,167,169,162,168,162,162,169,162,162,168,162,168,162,169,169,171,168,168,171,162,169,171,168,171,168,168,162,162,171,162,162,162,162,162,168,169,162,171,162,167,169,162,162,167,162,168,162,175,169,171,171,177,194,169,173,171,173,171,177,171,173,171,169,177,194,162,74, +1,2,1,2,2,5,5,1,6,2,1,2,2,2,2,6,13,11,15,33,8,14,14,13,13,16,109,33,31,13,29,34,34,126,31,126,109,15,46,132,119,137,137,141,120,132,117,133,153,150,150,142,113,17,122,17,6,6,7,6,2,2,7,6,123,122,106,126,116,139,138,122,122,119,111,16,109,132,109,6,126,138,138,126,114,24,19,15,18,24,18,2,6,7,13,13,13,2,2,7,2,2,6,2,6,11,7,6,7,2,2,13,6,7,11,13,7,13,6,2,2,13,1,6,2,7,11,13,13,11,11,2,2,2,13,2,5,11,7,13,17,11,13,11,6,7,7,7,6,6,2,1,2,2,2,13,11,13,13,11,7,17,7,2,6,2,2,5,1,1,1,1,1,2,9,2,1,1,1,5,1,6,1,6,2,10,11,15,17,15,8,17,17,15,2,2,2,2,2,60,5,2,1,9,38,25,1,6,1,1,2,6,2,5,1,2,2,2,5,2,6,5,2,10,2,13,11,2,2,6,2,2,5,2,5,2,5,2,2,13,15,157,168,169,162,169,160,162,160,169,162,168,162,162,162,162,162,162,162,162,167,162,162,168,168,168,171,171,171,162,169,177,162,194,162,168,168,162,168,169,162,162,162,168,167,169,162,167,162,162,162,162,168,162,168,168,162,171,162,171,162,168,168,171,171,169,194,177,173,171,171,169,179,173,171,171,177,169,168,74, +1,1,5,2,6,2,2,5,1,2,1,2,5,2,5,2,13,13,32,46,17,21,13,13,7,22,32,22,17,13,14,34,106,124,22,123,111,8,120,110,106,151,114,139,144,132,132,132,148,153,150,115,114,17,114,13,6,6,7,2,6,2,2,12,140,108,116,132,144,151,150,144,137,119,110,16,36,106,18,13,137,138,138,126,110,18,22,6,17,22,11,13,15,13,13,2,2,2,11,6,2,6,2,2,7,7,11,2,6,2,11,7,7,7,16,11,7,11,6,6,2,2,13,1,5,13,7,6,6,6,1,6,1,2,7,2,2,13,11,14,11,13,13,7,6,7,13,7,7,5,2,1,1,2,6,13,7,11,13,7,17,8,7,2,2,5,2,2,5,2,1,1,1,2,2,1,2,1,1,1,1,2,5,2,2,10,13,15,18,29,11,15,17,15,6,2,2,5,2,2,1,2,1,2,2,0,1,1,1,6,5,1,2,2,6,2,5,2,1,2,5,2,10,11,7,13,13,11,6,2,2,25,2,2,2,2,9,2,11,78,162,161,160,162,162,162,160,167,169,162,162,162,167,169,162,162,167,169,162,162,162,162,168,162,162,171,171,168,169,169,168,171,171,169,168,168,169,168,171,167,169,162,162,162,162,162,159,169,162,162,162,162,167,162,162,162,168,162,162,171,162,168,169,168,194,169,177,171,169,179,173,194,168,177,171,173,168,171,168,74, +2,1,2,1,2,2,6,2,2,1,1,1,2,2,2,2,11,13,20,36,33,10,11,11,13,22,33,36,32,13,30,24,37,123,8,119,114,33,119,34,119,145,114,122,137,136,133,139,153,146,142,127,18,33,18,6,2,6,2,2,2,6,2,34,24,129,138,144,149,146,153,138,119,120,8,36,15,33,8,22,144,138,147,126,114,6,18,13,13,16,13,117,29,11,13,11,2,13,7,7,6,2,7,14,7,7,13,1,12,6,10,13,10,11,13,13,11,11,13,7,7,2,2,2,13,13,7,7,2,6,13,1,5,10,13,1,10,7,13,13,13,7,11,7,2,7,2,13,2,2,6,1,1,1,12,7,7,7,7,13,13,17,2,6,2,2,2,5,2,1,1,1,1,2,2,5,1,1,1,1,1,7,2,2,5,11,11,17,15,8,13,17,31,15,2,2,2,2,5,51,11,1,1,1,1,1,1,1,2,2,2,2,5,2,2,2,2,6,1,2,10,7,13,13,11,13,13,21,13,6,2,2,2,2,6,10,5,10,11,87,160,159,162,160,159,162,162,162,162,167,169,162,162,162,162,168,162,168,168,169,169,169,162,162,162,162,168,168,168,169,162,168,168,168,162,167,168,162,162,162,162,167,169,162,162,162,162,162,167,171,162,168,162,162,175,162,162,162,162,162,168,168,162,168,169,171,171,169,194,173,194,171,177,171,173,173,171,173,168,74, +1,2,1,2,1,6,1,2,5,2,1,5,2,2,5,2,11,13,22,18,110,6,13,16,11,32,37,34,36,13,30,16,123,125,29,37,34,43,136,149,151,138,144,132,138,139,132,133,149,152,143,143,113,18,18,11,6,2,6,6,2,7,6,37,24,144,144,138,150,152,150,136,137,116,5,126,11,13,2,106,146,153,144,123,8,13,13,17,17,22,11,14,6,2,13,2,6,6,11,11,7,6,7,29,13,7,2,6,5,2,12,13,11,7,13,17,7,7,2,2,6,6,12,2,12,11,13,6,2,13,2,1,2,10,2,2,12,13,13,13,11,13,7,6,7,7,16,16,11,2,2,1,2,1,7,11,13,13,13,7,11,8,2,2,2,5,2,2,2,1,5,1,1,1,2,1,1,1,1,5,1,5,2,6,1,5,13,13,15,15,15,30,29,6,6,2,2,1,9,12,10,1,1,1,1,1,1,1,2,5,1,6,2,2,5,2,5,1,12,1,5,10,7,11,7,11,21,24,111,46,131,131,11,2,2,9,11,6,29,163,162,162,162,162,162,162,162,162,162,162,162,162,162,167,169,162,162,171,167,168,168,169,169,162,168,162,171,168,168,168,168,168,169,168,168,162,162,162,162,162,162,168,162,162,167,169,162,162,162,162,162,168,162,162,162,162,162,162,162,162,168,169,168,173,171,173,173,194,169,194,177,171,173,171,173,171,169,177,169,74, +2,5,1,2,1,2,2,10,2,1,2,2,2,6,2,12,1,14,36,114,119,6,21,29,14,29,34,45,17,29,23,45,132,122,33,31,44,132,122,132,183,138,149,123,147,132,132,138,154,145,150,146,127,20,31,6,6,2,2,2,6,1,2,33,24,144,144,149,149,144,147,139,137,116,16,31,8,8,11,136,144,144,123,122,11,14,14,29,22,16,11,2,2,2,2,40,41,41,40,27,40,73,73,49,2,2,2,2,6,2,11,7,13,13,11,6,11,6,2,2,2,5,2,2,13,13,7,7,5,2,2,2,2,5,2,2,13,13,13,13,11,6,7,13,6,7,15,6,6,2,2,2,1,2,7,11,13,13,6,6,11,17,2,2,6,2,2,5,1,2,2,9,2,2,2,1,1,1,1,2,1,2,5,1,2,5,11,8,17,15,18,30,30,11,2,38,6,1,1,1,1,1,5,2,2,1,1,2,2,2,6,1,2,5,2,2,2,6,10,2,5,9,13,13,26,29,120,45,180,173,198,202,30,2,5,2,2,42,156,162,162,161,168,168,162,162,168,168,169,162,169,162,168,162,168,168,162,162,162,162,167,169,169,162,162,162,162,162,168,169,168,162,168,162,162,169,162,162,167,162,162,162,162,162,162,162,167,169,162,162,162,162,168,162,162,162,162,168,162,169,171,171,162,177,171,171,177,171,177,177,173,171,177,173,171,173,171,171,171,74, +2,2,5,2,1,5,5,25,2,1,2,5,2,2,11,7,13,30,34,46,109,13,16,22,15,22,46,34,22,29,32,30,106,140,33,110,18,126,114,151,153,126,126,48,150,140,119,139,184,146,154,146,145,24,114,19,7,6,6,2,6,2,2,32,109,139,144,149,144,150,150,137,139,109,22,33,21,117,6,126,126,138,136,114,30,11,7,13,30,16,7,11,2,5,2,2,6,1,6,2,2,1,2,5,2,2,5,2,2,2,2,11,13,13,11,13,8,2,2,6,2,2,6,2,12,13,11,2,7,2,2,2,2,5,2,2,12,7,7,2,7,11,13,13,6,11,7,6,6,2,6,1,2,13,7,13,13,13,15,29,16,29,7,2,2,2,2,6,2,1,2,1,1,1,2,2,1,1,5,2,1,2,10,2,5,11,6,17,15,17,33,17,36,2,2,2,2,2,6,1,1,2,6,57,21,5,1,2,5,2,2,2,5,2,5,2,5,10,2,5,10,10,12,14,7,117,132,129,194,179,171,179,159,2,65,41,159,162,160,171,160,162,168,162,162,169,168,169,168,168,162,168,169,162,162,167,162,162,168,168,162,171,162,168,168,162,169,162,171,160,162,162,162,162,162,167,162,160,162,162,168,162,167,171,169,162,168,162,169,168,169,162,162,168,168,162,168,169,171,171,171,173,171,173,169,171,179,173,171,171,194,171,173,171,173,171,171,173,162,74, +2,5,2,2,1,2,2,2,1,1,2,2,5,2,7,13,21,29,22,34,33,8,29,32,16,36,117,46,29,22,17,22,120,132,114,116,120,110,144,153,183,144,120,117,153,144,106,133,150,153,153,146,150,115,33,8,6,2,2,6,6,6,2,117,126,133,147,150,149,144,147,139,144,31,22,34,18,109,1,126,126,128,125,126,109,24,29,6,2,6,11,13,2,2,1,2,2,6,1,2,6,2,2,2,1,1,2,1,5,2,5,11,11,11,8,15,13,6,2,2,2,2,7,2,13,11,7,7,7,13,1,1,2,10,2,2,21,11,11,6,13,13,14,11,11,13,11,11,8,2,6,2,2,11,7,13,13,11,18,29,18,20,11,6,2,5,2,2,2,6,1,1,1,1,1,2,2,1,2,1,5,2,2,5,2,2,11,8,15,29,31,24,17,6,2,6,6,2,2,1,1,1,2,1,1,1,1,2,2,5,2,6,2,2,2,2,2,21,2,6,5,1,21,164,18,119,141,176,179,179,173,173,171,194,173,173,169,171,162,162,162,162,162,171,169,171,169,162,168,169,168,168,162,162,162,168,162,162,162,168,162,168,168,168,168,162,171,162,167,169,168,162,169,160,162,162,160,167,169,169,171,169,171,162,171,177,168,177,171,162,168,171,162,173,162,171,171,173,194,171,194,179,171,179,194,177,171,177,194,173,179,194,173,173,171,177,171,171,169,74, +2,2,2,5,1,2,5,1,1,1,5,2,2,2,13,13,13,16,30,43,17,13,16,46,17,29,23,45,16,30,46,106,110,126,126,132,109,106,149,183,144,144,126,45,152,149,106,144,153,183,153,152,142,19,108,8,11,6,2,6,2,2,6,37,110,138,144,149,151,150,146,123,136,15,29,24,24,109,13,144,122,127,125,122,24,22,11,2,2,2,8,13,2,6,2,5,7,2,11,2,2,2,6,1,1,2,5,1,2,2,2,6,13,8,15,22,15,2,6,2,2,13,10,13,13,7,6,6,7,2,1,1,2,13,2,2,13,11,2,11,14,15,11,7,8,17,11,11,13,2,6,2,2,13,5,11,11,13,24,31,108,109,6,2,2,2,2,5,1,1,2,2,12,1,2,2,5,5,2,2,6,1,5,2,5,2,11,15,15,17,33,24,34,15,6,6,2,11,6,2,2,1,1,2,1,6,1,2,6,1,2,2,2,2,5,2,2,21,13,7,6,68,202,198,176,176,179,179,179,179,179,169,173,171,171,168,171,162,162,162,168,169,162,162,171,162,169,162,171,162,168,168,169,168,168,168,162,162,168,171,162,168,169,169,162,171,162,162,168,162,162,168,162,160,169,162,162,162,168,168,168,171,168,169,194,168,171,171,173,173,171,179,171,171,171,173,194,173,179,179,179,173,194,173,179,179,179,194,173,194,173,179,179,179,194,169,179,173,169,74, +2,6,5,1,2,1,6,2,1,1,2,2,6,2,21,13,13,14,31,34,29,7,33,37,22,17,29,32,22,106,120,116,122,126,132,138,126,119,153,184,141,144,140,36,154,144,117,149,153,154,153,154,127,34,20,15,11,6,6,6,6,2,2,29,24,150,151,144,139,146,138,138,122,11,16,24,18,24,22,145,142,122,140,20,31,17,13,2,5,2,15,17,2,2,2,2,5,2,7,11,2,2,2,1,1,1,1,1,2,5,2,7,15,13,15,17,13,6,6,2,2,10,7,11,13,10,13,5,11,6,2,0,2,13,2,11,11,13,13,11,7,13,13,11,14,11,8,13,11,6,2,6,2,13,13,21,17,13,18,24,33,24,2,2,2,6,2,2,5,1,2,9,9,1,1,1,1,2,2,1,2,2,6,1,2,11,13,17,22,30,109,24,15,36,11,7,13,110,16,22,2,1,2,2,6,1,2,6,1,11,2,2,6,2,2,6,5,29,30,21,78,198,198,179,179,202,179,171,179,171,179,173,171,173,168,194,162,168,168,168,168,169,162,171,171,169,171,177,162,171,162,169,168,168,168,162,162,167,171,162,168,168,162,168,162,171,162,169,168,162,162,168,168,162,162,162,162,162,168,168,169,173,162,171,171,173,171,173,171,179,179,194,173,179,179,194,179,177,179,179,179,179,202,179,179,179,194,179,202,179,179,179,194,179,179,179,179,171,169,74, +2,2,6,2,6,1,2,1,2,5,2,5,1,2,14,16,16,32,46,30,16,7,117,130,114,11,16,109,24,106,33,106,126,126,122,141,126,147,153,151,139,149,128,23,154,151,153,150,154,153,152,152,143,17,24,105,26,6,2,11,2,2,6,7,24,149,144,144,144,144,126,138,34,6,17,17,22,6,24,138,143,128,126,46,33,29,11,6,2,11,8,17,11,2,6,2,2,2,13,6,2,2,5,1,1,1,1,2,6,2,13,16,17,15,15,13,6,2,2,2,7,13,6,14,13,8,2,13,13,2,6,1,1,13,2,13,11,11,2,11,13,14,14,13,13,11,17,15,15,13,2,2,15,21,13,21,29,22,29,18,109,17,11,6,2,2,2,12,9,2,2,1,1,1,1,2,5,2,1,2,5,2,2,2,6,5,13,29,33,109,109,31,13,30,109,33,127,106,114,22,1,2,12,5,21,36,2,2,2,11,6,2,2,2,2,2,12,11,30,196,198,179,179,198,179,179,179,194,179,179,171,179,171,173,171,169,171,162,168,168,168,162,194,162,169,171,171,171,171,171,171,162,168,168,168,168,162,162,168,168,171,162,171,169,162,168,168,168,168,168,168,162,169,168,162,167,169,169,162,171,194,171,173,171,171,171,194,169,179,179,179,198,179,195,179,179,177,179,179,194,179,179,195,202,195,173,179,198,179,198,198,173,198,198,173,198,173,179,179,74, +2,7,32,17,8,2,5,2,1,2,2,2,6,7,29,13,36,45,22,36,24,12,117,132,29,2,22,34,34,110,31,122,126,138,122,123,149,133,139,139,141,144,140,36,153,150,154,186,153,153,152,150,143,20,20,127,18,11,2,2,11,6,2,13,22,123,122,138,144,145,141,126,18,11,11,22,24,3,110,151,144,128,123,32,31,11,2,2,2,13,15,17,6,2,1,2,13,2,7,2,5,2,2,1,1,1,2,1,2,2,15,8,13,15,13,6,11,6,7,6,6,13,7,16,16,13,11,13,11,2,2,1,6,13,13,6,13,7,2,21,21,29,13,11,11,15,17,15,29,11,7,13,14,15,13,13,13,18,22,34,33,6,6,2,6,6,2,2,5,1,1,1,1,1,2,5,2,5,2,1,2,2,5,2,2,2,13,13,34,44,108,18,13,119,19,114,115,47,136,133,11,6,9,11,29,18,11,11,2,11,2,6,2,6,2,2,15,24,200,179,179,179,179,179,179,179,179,179,179,179,179,179,171,179,171,173,171,171,171,171,171,171,171,169,177,168,173,168,194,168,194,168,168,169,169,162,168,169,168,162,171,168,169,168,169,171,171,171,162,169,162,171,169,162,162,162,168,162,168,171,171,169,179,179,177,179,194,173,194,179,194,179,195,198,179,179,179,198,202,194,198,198,179,198,198,198,179,179,179,179,198,195,198,202,198,198,198,179,179,69, +2,13,22,114,33,15,16,11,2,6,9,2,2,12,36,30,47,16,21,33,29,18,47,46,11,6,29,17,18,36,24,122,138,144,109,130,110,136,149,122,123,132,148,24,154,183,186,154,183,153,153,153,142,18,24,127,108,6,1,6,6,2,2,6,114,126,122,136,144,138,144,132,17,6,6,17,110,8,137,150,140,139,33,30,33,6,2,2,5,15,11,6,6,2,2,2,2,2,12,2,2,2,5,1,1,2,5,2,5,2,21,16,29,17,11,11,17,6,8,7,13,13,11,13,16,7,11,13,13,7,1,1,7,21,21,29,17,7,10,13,13,13,11,29,32,32,15,22,15,11,11,13,14,7,13,21,29,17,33,116,116,36,34,34,13,22,2,2,2,1,2,1,1,1,1,2,2,1,1,5,2,5,2,2,5,10,13,13,33,109,33,15,13,109,32,46,33,46,117,133,11,5,10,1,11,11,119,109,1,2,2,11,6,2,29,29,16,179,179,179,179,179,179,194,179,179,179,194,179,179,179,179,179,173,171,171,171,173,168,171,173,173,171,171,169,171,194,171,171,171,168,168,168,169,171,168,169,162,169,168,169,171,162,168,168,169,162,171,171,194,162,171,162,168,162,162,167,171,162,168,171,179,173,179,179,179,179,195,179,198,179,199,198,195,198,179,198,198,179,195,199,196,198,195,198,195,198,196,198,198,198,203,203,198,200,203,195,198,179,74, +1,2,29,34,34,22,17,22,2,2,2,6,1,7,29,30,49,2,14,34,22,18,21,22,8,13,21,22,22,16,33,116,144,144,18,116,106,149,123,146,140,149,154,24,183,153,183,154,153,153,153,153,128,10,18,114,142,11,2,2,11,2,6,6,110,116,126,145,145,150,138,124,6,11,6,30,123,8,138,137,138,119,33,16,13,2,5,2,13,33,11,2,11,6,2,2,6,1,15,11,6,2,2,1,2,5,2,2,2,2,12,16,13,17,11,7,6,6,7,6,7,16,11,13,30,11,13,16,21,11,1,1,13,16,29,29,16,11,2,13,14,29,14,22,30,16,22,16,11,11,13,13,13,13,14,14,14,33,132,125,120,34,13,126,122,138,2,2,2,1,1,2,5,1,1,2,5,2,2,1,2,2,5,2,2,6,13,21,110,20,33,8,17,117,109,116,32,45,47,133,114,10,121,119,10,26,132,70,11,6,2,6,11,8,32,30,194,195,179,179,179,194,202,179,194,198,179,179,179,169,179,173,179,171,171,173,173,171,173,171,171,173,171,169,171,162,171,162,168,168,168,162,162,162,162,168,168,168,169,162,194,161,173,171,171,169,177,162,194,168,169,194,171,169,168,168,162,162,162,194,171,169,194,194,179,179,198,179,198,199,196,199,199,199,199,198,199,199,196,199,199,196,199,199,199,199,198,198,203,200,198,204,201,200,204,200,195,198,198,131, +2,6,21,36,21,6,18,109,15,2,6,1,12,12,13,16,13,11,6,16,18,30,33,17,13,13,11,16,16,13,34,149,138,34,122,149,116,138,138,186,141,186,183,110,185,151,153,153,154,153,153,146,142,8,122,150,125,2,2,11,6,6,11,8,110,144,150,143,146,146,122,24,2,11,11,24,114,22,119,149,123,106,33,18,5,2,2,11,8,110,15,29,106,6,2,2,2,11,13,14,13,6,2,6,2,2,2,6,2,7,22,13,18,29,6,6,6,7,7,13,6,16,11,13,18,1,21,17,13,6,2,1,13,16,29,16,17,7,14,21,29,16,21,29,18,22,22,17,33,8,13,13,13,13,14,29,29,30,125,111,15,11,20,145,126,136,2,2,2,2,5,2,2,2,1,6,1,2,6,1,6,2,2,5,2,2,21,29,117,37,22,11,16,29,36,33,43,22,109,124,21,2,132,37,6,2,182,204,74,11,6,11,20,180,198,203,198,198,179,179,179,179,179,179,179,179,179,194,179,194,169,179,179,194,173,194,169,173,173,171,194,169,173,173,171,171,169,171,168,162,168,162,160,162,168,162,175,169,169,171,171,169,194,168,173,171,169,171,173,171,173,171,169,171,168,168,169,194,169,171,162,194,173,179,179,179,195,179,198,198,196,199,199,200,199,199,195,199,203,203,199,203,199,196,199,200,200,200,200,204,200,198,204,204,200,204,198,203,196,74, +2,2,10,11,1,13,122,114,33,11,2,1,2,6,36,16,13,14,13,7,29,24,22,43,17,13,11,17,16,13,37,140,126,149,149,138,119,149,123,153,152,153,150,24,130,149,153,152,153,153,152,150,142,116,125,128,16,2,2,2,2,6,6,6,116,150,150,143,143,125,136,17,2,11,22,33,18,15,129,144,123,116,33,11,2,6,2,7,13,110,18,13,15,11,16,12,6,7,13,14,14,17,1,1,2,2,11,2,2,29,16,16,22,11,6,7,13,11,13,6,13,22,11,22,17,1,21,29,17,6,2,1,13,29,17,33,29,13,13,16,29,30,21,29,16,30,15,29,17,11,17,14,13,14,29,16,21,18,116,114,3,6,138,127,126,110,6,2,5,1,2,2,5,2,2,2,2,6,1,2,2,2,2,2,2,5,10,29,106,114,106,2,21,68,29,50,106,46,133,188,6,7,29,16,117,130,203,203,172,7,30,130,180,199,198,198,179,198,195,179,179,179,179,179,179,179,179,179,171,171,194,171,173,171,194,179,171,171,173,194,194,179,171,169,173,171,168,162,171,162,162,171,162,162,171,162,171,162,171,168,171,173,173,171,173,168,171,173,173,171,173,171,171,171,169,168,168,171,169,168,171,171,177,179,179,194,173,195,179,196,199,199,199,199,199,199,199,199,199,199,199,200,198,200,200,203,198,204,198,196,204,200,204,204,201,200,200,195,199,74, +2,5,0,2,1,12,106,111,109,29,2,5,2,7,16,11,13,11,13,11,22,33,22,29,13,10,22,46,13,17,36,119,129,149,140,139,138,149,132,149,153,150,147,16,47,133,153,154,152,153,153,153,125,115,122,109,2,6,2,2,11,6,6,6,34,144,128,128,142,138,125,6,13,24,116,120,125,8,22,22,123,125,8,6,2,2,2,13,2,22,29,3,22,16,17,2,6,7,14,29,13,17,6,6,2,2,2,2,6,30,14,17,22,11,7,11,13,13,13,13,13,20,29,32,13,1,13,22,17,17,2,2,21,22,32,30,31,11,13,29,22,16,30,16,16,29,15,17,11,2,21,21,11,13,16,16,16,24,33,125,6,113,145,126,147,119,2,2,2,2,6,2,2,5,2,13,13,2,5,11,2,6,2,2,6,2,12,29,32,122,125,6,16,66,116,141,29,21,106,6,15,43,15,47,47,195,198,202,198,131,47,141,176,198,179,200,202,198,179,198,198,179,202,179,179,179,179,179,171,171,171,171,173,171,171,171,194,171,179,179,179,179,179,173,171,173,162,168,168,162,162,162,162,162,162,162,168,162,168,171,171,194,169,173,194,177,171,177,171,179,177,173,171,173,171,171,171,171,171,179,177,179,194,179,179,179,179,179,173,198,195,195,195,199,195,199,199,198,198,199,196,200,198,204,200,200,200,204,201,200,204,204,204,195,204,204,204,204,196,74, +2,2,5,1,2,7,34,109,108,108,11,2,2,5,11,1,6,2,7,13,16,37,31,13,12,16,29,13,33,106,141,122,120,149,18,106,119,147,129,152,183,152,144,8,22,183,153,154,153,153,153,150,125,138,111,11,2,2,2,2,7,6,6,11,34,143,128,138,128,126,125,17,22,119,122,138,126,11,6,7,136,111,11,6,2,2,2,13,11,18,18,22,11,15,11,2,7,11,13,13,13,6,7,21,11,2,2,11,7,18,15,24,30,2,13,7,11,13,13,11,13,16,30,37,11,1,2,22,18,15,6,2,16,30,22,32,31,11,7,13,17,29,18,29,16,17,30,22,13,11,21,17,6,21,29,29,29,17,34,111,120,140,127,149,144,144,8,2,6,2,2,6,2,2,2,15,11,2,34,37,36,7,13,11,2,2,11,36,34,120,123,121,170,48,124,141,106,4,15,106,11,17,18,106,200,202,195,179,198,179,8,175,198,199,198,179,200,179,198,198,179,179,198,179,198,179,179,179,179,171,171,173,169,179,173,179,174,179,179,179,169,179,173,171,177,171,171,171,162,168,168,162,166,161,162,162,162,171,160,168,168,171,169,194,169,171,177,169,194,179,179,194,179,169,179,169,171,173,173,168,171,194,179,179,194,179,175,179,194,173,198,199,199,200,199,199,195,200,200,198,200,198,204,200,204,201,200,200,204,201,201,195,204,204,200,201,204,201,204,131, +2,5,2,1,1,12,32,37,111,109,18,2,6,26,2,5,1,5,13,15,16,31,31,16,12,16,11,23,130,117,150,148,37,30,8,47,141,132,37,123,144,154,153,8,36,150,147,153,154,184,150,147,125,125,8,11,2,6,2,2,6,6,6,6,138,143,125,127,126,114,122,6,36,132,139,122,24,2,11,11,126,19,6,11,6,2,11,16,11,16,24,16,15,11,2,2,21,13,21,16,22,6,17,6,13,2,2,12,16,32,30,46,13,2,12,11,6,11,7,21,22,17,29,33,1,1,1,13,24,2,13,11,13,31,32,34,31,7,13,16,22,30,17,30,15,17,15,31,15,2,14,29,11,16,30,22,22,46,110,18,114,119,140,140,144,151,116,2,2,1,2,2,2,6,2,11,6,29,46,36,32,13,10,21,10,5,13,36,68,108,123,137,19,6,24,109,106,154,110,43,16,45,190,202,198,198,179,199,195,198,203,203,200,179,198,203,203,199,198,179,198,198,179,179,198,179,179,179,171,171,169,179,171,173,179,169,179,171,173,179,171,171,171,194,169,177,171,177,162,169,168,169,169,169,168,169,168,162,168,162,162,168,169,162,194,171,173,171,171,194,179,177,194,177,179,194,169,173,171,177,173,171,179,194,171,171,173,171,177,194,173,199,199,199,199,204,200,200,200,203,200,203,200,198,200,204,204,204,201,204,201,201,204,205,201,205,201,205,204,74, +2,2,2,1,2,16,30,30,33,37,109,22,0,1,2,2,6,2,2,13,32,2,43,122,16,17,21,22,37,130,137,151,119,123,24,47,149,114,32,133,153,153,152,8,130,147,154,184,153,150,150,143,126,127,8,6,6,2,6,2,11,6,11,14,128,128,128,128,138,114,138,145,109,109,128,136,18,6,6,13,116,11,15,11,2,2,34,15,22,29,22,22,33,18,6,2,17,29,30,33,30,13,36,11,17,2,2,29,16,30,30,32,2,6,2,11,7,7,13,16,29,16,22,29,2,1,2,21,11,17,44,7,10,32,46,24,33,5,10,29,18,33,16,29,16,20,29,111,18,1,13,18,14,30,30,30,22,109,110,109,18,144,132,147,153,150,143,6,2,2,6,2,11,6,6,6,22,23,43,34,34,29,13,1,10,10,13,17,124,142,125,142,140,109,44,30,47,121,165,194,190,200,179,202,198,179,198,179,198,198,179,198,179,198,199,198,198,199,179,203,198,179,198,198,179,179,179,179,179,179,179,179,179,179,179,179,179,179,173,171,179,171,173,173,171,171,171,169,171,168,168,169,171,171,171,162,169,162,162,171,162,168,169,168,168,168,171,171,171,169,179,177,171,194,177,179,194,169,179,179,179,194,179,171,173,173,171,171,171,177,179,194,199,199,200,200,204,204,200,201,200,201,203,200,200,200,204,201,204,201,201,204,201,201,205,201,205,204,201,74, +2,2,2,9,1,7,32,46,36,34,24,29,2,2,5,2,2,2,11,106,20,21,129,130,14,21,16,22,34,119,181,149,106,22,15,130,120,119,110,183,153,153,150,8,152,152,150,150,153,148,147,139,114,127,8,11,2,2,2,2,6,6,6,33,143,150,138,143,128,47,139,148,112,126,138,140,17,11,6,17,116,6,13,8,2,11,119,6,30,30,16,37,17,46,8,11,11,23,30,10,21,21,13,21,13,2,6,16,21,30,30,13,2,2,7,13,21,14,21,34,30,15,30,18,1,1,2,13,15,29,16,2,21,24,46,33,33,11,7,16,29,14,22,17,29,34,114,109,22,2,21,29,8,18,15,13,29,110,116,132,106,126,139,153,150,147,136,10,6,16,11,8,8,8,13,11,30,49,36,29,36,29,17,21,50,172,15,130,114,116,133,129,70,166,130,33,134,177,194,177,194,173,194,179,202,198,194,198,202,179,203,198,198,195,198,199,198,199,195,200,195,198,198,198,171,198,179,179,179,198,179,202,179,179,173,179,179,179,179,179,173,179,169,179,177,171,177,171,169,169,171,169,194,169,173,179,168,162,162,160,162,168,162,162,168,168,171,162,179,171,194,179,177,179,177,171,173,171,179,179,179,179,173,179,194,169,171,173,194,171,173,179,198,199,199,204,204,201,200,200,204,200,200,204,200,200,204,201,205,204,201,201,205,206,204,201,206,201,201,69, +9,1,2,2,9,5,30,109,116,120,109,10,2,6,2,2,5,13,45,130,106,13,14,15,11,45,141,34,47,117,132,144,18,119,109,45,32,120,36,133,153,153,147,24,138,138,150,153,148,126,149,122,123,128,3,11,6,6,2,2,11,6,8,132,149,146,144,149,128,116,144,145,138,126,136,151,116,29,36,48,29,6,11,15,17,16,123,6,16,36,30,36,29,29,18,21,14,30,7,7,11,21,6,7,13,13,21,7,7,30,47,6,2,7,13,17,21,7,17,29,29,16,24,17,2,1,1,11,13,16,5,10,29,34,43,33,44,6,15,16,29,29,43,36,22,46,109,32,31,2,7,15,22,29,11,6,16,132,120,116,110,149,153,150,148,144,140,8,21,17,11,17,18,20,17,2,29,21,29,14,33,132,29,30,46,3,13,106,123,46,11,35,163,162,168,169,171,169,171,194,177,198,179,194,202,179,179,198,202,202,198,203,179,200,179,200,199,195,198,196,203,203,198,198,198,198,179,202,198,179,179,198,198,202,198,202,179,179,179,179,179,179,178,169,171,171,171,171,173,171,177,171,179,194,179,177,179,168,162,162,156,162,162,171,162,162,168,162,168,171,169,194,179,194,194,173,194,179,179,179,179,194,179,194,171,171,173,177,194,173,194,198,179,198,200,200,204,204,204,204,201,204,200,204,204,204,201,204,201,201,201,201,205,201,206,205,201,206,205,74, +2,6,1,2,1,2,29,34,123,111,109,33,116,119,16,6,6,32,130,120,32,21,16,26,2,36,132,132,149,151,140,149,8,126,111,15,106,124,32,117,144,144,106,15,137,144,149,150,144,144,144,111,125,140,17,6,6,2,2,2,11,6,22,133,147,150,145,136,144,140,138,127,126,122,141,141,14,24,19,22,6,6,2,13,13,36,122,1,17,22,30,16,48,31,119,30,30,13,29,16,12,47,2,29,36,29,29,1,30,32,10,2,5,11,13,13,13,14,23,22,16,30,17,24,2,1,2,11,2,16,2,11,22,30,33,32,46,34,31,13,13,21,28,29,22,30,33,33,18,1,12,17,15,7,13,18,33,119,106,116,147,152,150,150,148,140,146,115,109,11,6,6,17,6,2,6,2,13,43,13,30,119,106,106,30,13,32,126,22,159,166,162,162,160,162,162,168,171,171,171,194,169,194,179,202,179,198,179,198,179,200,199,199,195,198,199,199,199,195,196,198,198,200,198,200,203,198,198,179,198,198,179,198,179,179,198,179,202,179,179,179,179,179,179,179,168,173,173,171,171,171,169,194,179,177,179,179,179,168,162,162,162,162,162,162,162,168,168,168,171,171,194,179,179,179,179,173,195,179,179,179,179,173,194,171,194,171,169,179,194,179,179,195,179,200,195,204,200,201,204,200,204,201,201,204,204,201,201,204,201,204,204,201,206,206,201,205,206,201,74, +2,1,2,2,1,5,30,47,126,122,116,46,149,152,34,43,106,132,119,130,15,14,21,12,6,14,22,152,151,120,133,132,15,116,33,13,24,123,133,133,123,145,109,16,137,138,149,153,153,115,47,106,115,142,15,6,6,11,2,6,6,6,34,144,144,144,136,138,138,123,113,126,47,13,122,110,6,16,33,17,8,2,30,32,129,133,130,6,36,30,36,117,120,6,32,32,43,11,45,21,21,50,14,36,29,21,13,33,47,29,1,2,11,2,13,8,13,29,17,30,29,32,46,20,2,1,2,13,13,13,11,11,29,32,31,120,140,46,17,13,17,15,21,13,15,33,109,32,17,6,2,16,11,11,16,30,46,106,106,140,152,148,153,152,150,136,149,113,20,6,2,11,6,18,8,15,11,10,11,11,36,120,119,147,128,108,109,118,141,161,162,160,162,160,171,169,162,171,171,162,171,171,171,169,194,194,177,179,194,198,198,202,200,199,199,198,199,196,203,198,200,203,203,195,198,203,198,198,198,198,179,198,198,198,203,195,203,195,198,202,202,179,179,179,171,173,171,179,171,173,171,173,171,179,179,198,179,179,179,168,162,162,156,161,156,162,162,168,162,173,171,171,169,194,179,179,194,179,179,198,179,179,179,194,179,171,177,194,173,194,179,198,194,198,199,199,200,201,200,204,204,201,204,201,200,204,201,201,204,201,201,205,201,205,201,206,206,201,206,131, +2,2,1,1,2,2,16,36,122,126,116,46,122,116,33,36,139,133,70,15,6,7,7,2,13,13,43,153,147,120,120,4,29,126,109,40,133,137,20,22,33,145,105,31,147,136,153,154,145,125,31,31,18,140,8,6,6,2,2,2,7,6,117,138,144,138,128,137,126,114,109,22,6,22,138,15,6,16,24,18,44,34,29,30,120,18,32,2,29,23,30,117,29,13,30,43,29,29,17,22,15,6,21,29,34,6,36,21,17,10,1,2,5,2,11,15,13,22,22,30,29,34,31,24,2,1,2,14,17,1,5,13,45,47,117,129,120,106,34,106,17,21,11,15,37,31,33,33,20,2,2,29,22,16,17,29,106,110,116,124,152,148,146,142,144,139,139,136,15,6,6,6,6,8,17,15,17,6,2,36,16,119,132,142,125,109,116,149,169,162,162,162,168,167,162,167,171,169,171,169,171,162,168,194,168,177,171,173,194,202,179,199,199,199,203,199,199,199,198,203,200,198,196,203,200,195,198,200,203,198,198,203,179,200,198,203,199,203,199,179,198,198,173,179,179,194,179,169,173,171,171,171,179,179,194,179,198,198,179,179,171,168,168,162,168,162,168,168,171,194,171,177,171,171,177,194,179,179,179,179,179,194,194,179,179,179,179,179,179,179,179,179,198,198,179,200,195,195,200,199,204,200,200,204,204,204,201,204,201,201,205,201,205,201,206,206,201,206,205,74, +82,10,2,2,1,5,16,33,106,126,144,139,136,44,7,132,185,132,46,1,5,1,1,2,16,139,148,153,144,124,17,13,24,153,18,29,34,109,106,24,29,138,114,146,126,147,153,144,150,142,105,15,8,126,4,5,2,2,5,2,11,11,133,149,150,149,126,146,125,126,14,2,6,22,114,5,7,16,13,114,111,115,18,33,29,6,11,2,29,32,17,32,16,33,32,34,47,123,122,31,22,13,13,43,32,2,34,34,29,12,1,2,2,2,13,109,15,31,18,29,17,106,33,17,2,1,2,21,22,6,0,29,45,106,46,109,46,109,34,106,24,5,11,14,24,33,33,29,24,6,6,16,29,16,29,8,47,46,114,142,145,139,150,153,149,147,123,126,2,11,6,6,6,11,18,22,17,13,29,10,29,106,33,140,125,114,131,160,168,168,162,162,162,162,162,162,168,169,171,177,171,169,168,168,171,173,171,169,194,179,179,195,198,198,200,199,196,204,200,200,200,200,200,200,204,203,203,198,196,198,198,199,199,179,195,179,200,179,198,198,179,198,179,179,171,179,179,179,171,194,171,179,173,194,179,198,199,199,179,179,179,179,171,171,168,168,173,171,168,171,171,171,173,194,179,173,179,179,179,194,179,179,179,179,202,179,171,194,179,198,179,198,179,198,179,198,196,199,203,200,200,200,204,201,201,200,204,201,201,205,201,204,201,205,206,201,206,201,201,74, +95,53,6,0,1,2,29,29,47,133,130,136,126,118,21,149,132,141,13,2,2,1,2,13,22,149,138,146,136,46,11,17,109,143,20,16,46,116,148,24,32,154,127,126,144,146,145,128,144,142,105,8,46,128,6,17,13,2,2,2,11,16,133,141,147,144,150,122,113,111,13,6,6,22,109,2,11,13,18,114,33,111,115,31,8,17,6,6,13,16,22,22,30,106,46,37,119,129,120,47,106,31,2,47,43,14,22,15,17,2,2,5,2,11,11,106,11,20,31,15,15,116,110,15,1,1,2,29,18,2,2,21,30,22,17,43,34,111,37,110,30,9,2,34,31,31,24,24,15,1,11,33,30,22,36,29,110,106,127,138,146,145,153,154,147,145,124,144,6,2,2,6,6,13,20,17,17,8,49,39,129,106,106,111,115,164,162,169,168,162,171,169,169,162,168,168,168,171,171,169,168,168,168,168,171,194,171,173,171,177,194,202,203,195,198,204,199,200,200,198,204,204,200,200,204,200,200,203,198,203,198,198,202,199,203,199,203,195,179,198,198,179,198,202,179,179,179,179,194,169,173,179,168,179,179,198,199,199,196,203,198,195,179,179,179,179,168,171,174,173,171,171,171,169,173,194,173,194,179,194,179,179,195,179,194,198,202,179,179,198,179,198,198,198,198,179,198,198,179,200,195,200,204,204,204,201,201,200,201,201,205,201,205,201,206,201,206,206,206,131, +89,84,38,5,2,2,13,21,32,34,139,147,149,130,117,133,149,136,6,2,2,6,2,7,29,110,153,150,111,6,8,114,144,152,4,14,46,24,24,13,16,137,128,3,114,142,150,150,115,142,114,11,109,115,31,110,7,6,2,2,11,16,110,122,145,140,115,137,154,123,6,6,2,47,20,2,6,7,16,109,119,108,126,8,15,17,17,2,21,31,30,16,30,47,34,68,110,48,132,31,46,24,15,34,24,13,16,30,13,2,2,7,2,7,13,18,21,24,31,15,43,20,109,8,2,1,5,11,22,6,2,13,30,32,30,24,106,46,47,32,33,6,2,18,30,36,16,117,6,2,30,37,43,22,30,45,106,132,125,144,153,153,153,153,151,151,149,126,11,2,2,6,6,6,18,31,33,14,13,8,49,47,8,111,164,169,169,169,162,168,162,168,168,169,171,168,171,169,171,168,168,169,168,162,194,169,179,171,171,194,179,179,196,199,200,203,204,199,198,200,200,198,204,198,201,200,199,199,199,199,198,198,179,202,195,203,196,179,198,198,179,202,179,198,179,179,179,179,171,179,171,177,179,179,194,179,199,199,199,199,196,203,195,198,198,179,179,179,179,169,173,174,194,171,179,179,194,169,179,179,179,179,179,198,179,198,194,179,179,198,198,179,198,199,179,198,203,198,198,198,195,203,198,204,201,200,204,201,204,201,205,205,201,201,205,206,201,206,201,74, +89,90,91,90,71,2,7,22,47,119,139,182,149,140,106,132,150,132,11,2,2,2,6,7,16,119,154,151,17,13,29,152,150,140,2,14,119,110,29,1,7,117,33,126,147,128,150,150,105,138,127,6,109,109,128,37,7,2,2,5,6,14,123,144,126,127,128,153,152,125,8,6,6,119,19,5,6,14,34,122,109,111,47,19,13,13,11,6,16,13,13,22,34,106,32,36,106,33,34,18,33,18,31,29,18,13,29,11,2,2,6,2,2,2,12,11,17,108,33,24,109,31,122,6,2,1,2,13,22,8,6,16,34,33,16,46,106,120,116,132,144,109,5,121,16,22,129,122,2,5,36,30,29,29,22,47,36,132,127,139,151,153,153,148,151,137,149,34,2,6,2,11,17,22,21,17,22,109,157,166,171,78,157,166,169,169,169,171,168,168,169,169,169,162,168,168,168,168,168,169,162,168,169,171,171,173,173,171,171,179,202,179,203,200,198,203,200,199,200,198,204,196,204,196,198,196,199,203,199,198,198,203,179,198,179,198,198,203,195,179,198,198,198,179,179,198,173,179,179,194,194,177,179,179,179,198,179,198,199,200,196,203,199,199,198,198,198,202,179,179,198,194,202,179,179,179,179,179,179,173,179,179,198,179,198,179,198,179,198,179,179,198,199,198,198,198,195,198,198,203,195,200,200,203,200,204,201,200,201,205,201,201,205,205,201,201,205,201,206,74, +90,90,91,90,90,38,11,129,130,47,120,133,133,123,29,149,147,125,16,7,11,6,2,11,22,130,146,136,11,6,33,150,137,144,111,24,33,43,114,22,132,119,109,106,8,8,138,148,8,146,125,11,114,18,46,18,2,2,2,2,2,29,116,114,126,145,153,152,144,128,16,6,6,137,20,6,6,6,11,20,109,18,114,22,6,13,11,11,6,6,30,30,29,106,30,30,46,17,36,17,30,24,15,30,15,4,7,6,2,2,2,6,6,2,6,13,1,16,11,8,33,32,136,2,1,2,6,12,17,11,6,30,34,34,46,109,116,124,141,140,141,136,126,8,32,134,149,17,1,2,43,30,16,21,36,133,43,120,125,144,150,183,150,149,146,147,129,6,6,11,8,17,34,17,31,21,24,78,168,162,160,168,162,162,167,171,171,169,168,168,168,168,169,169,168,169,162,169,171,168,168,168,171,171,177,179,179,179,194,179,198,202,199,199,203,198,198,203,199,196,196,199,203,199,199,203,195,199,198,179,198,198,198,198,198,203,179,198,203,195,203,198,196,198,179,179,194,179,179,179,194,179,194,179,179,198,198,198,199,199,199,203,198,198,179,198,179,199,203,196,196,199,179,198,179,179,198,178,173,198,195,198,198,198,198,195,199,198,198,195,179,198,198,198,198,200,203,199,196,198,199,199,196,198,199,203,200,201,204,201,201,205,206,201,205,206,201,206,205,131, +82,90,89,90,91,82,38,30,32,34,132,139,138,133,119,147,137,140,11,13,11,11,13,13,32,124,153,19,11,30,132,126,144,145,115,119,122,21,22,22,17,29,8,6,17,106,143,105,114,150,111,6,33,114,17,34,2,6,2,2,11,16,123,138,126,153,143,143,115,140,8,6,6,135,111,6,6,7,7,24,24,24,114,19,11,13,13,22,2,11,4,16,30,46,17,30,116,22,14,17,16,30,16,45,32,164,2,7,6,7,2,10,9,11,7,14,6,13,24,119,15,34,132,1,1,2,2,11,30,11,7,29,37,24,119,149,149,141,139,144,139,133,136,109,47,130,136,109,5,2,36,30,29,43,120,130,106,120,139,147,148,145,147,141,140,33,6,10,13,16,36,16,21,29,16,68,169,162,156,156,160,162,162,162,168,168,194,162,194,162,168,160,162,168,168,168,169,169,162,168,169,171,173,171,179,179,198,179,179,202,199,179,200,195,196,198,203,200,200,199,198,198,199,198,195,199,203,179,198,179,202,179,194,198,179,179,202,198,179,196,199,199,203,195,198,202,179,179,179,179,198,179,179,202,179,179,198,179,198,199,203,199,198,179,198,203,196,200,199,199,203,196,199,203,198,195,179,198,198,198,179,196,203,198,199,199,199,195,199,198,198,198,199,203,200,195,198,204,198,198,195,200,195,198,199,196,203,198,204,204,201,201,205,205,205,201,205,201,205,74, +89,86,89,89,89,90,86,7,21,116,140,144,139,147,120,144,151,108,13,11,13,13,13,18,43,119,141,11,17,144,138,133,144,128,24,137,125,116,31,13,16,33,17,15,24,24,31,20,142,150,18,29,123,146,144,31,6,11,2,2,7,7,106,137,136,148,138,146,108,136,6,6,13,147,122,6,13,1,7,22,34,17,109,111,13,15,15,18,15,33,44,23,22,33,13,34,47,106,43,22,47,31,35,29,46,40,2,29,13,13,2,1,5,21,13,11,2,119,133,116,15,130,22,2,1,2,2,35,28,2,13,30,119,132,149,183,133,141,133,133,141,132,130,33,132,130,117,43,2,7,21,36,37,47,47,47,120,118,120,138,147,148,146,142,116,13,13,15,30,11,21,28,66,165,29,159,162,162,162,160,162,162,160,169,162,168,162,168,162,162,162,162,160,162,168,162,162,169,169,168,168,169,194,173,194,173,179,202,198,196,179,200,202,199,199,200,198,204,198,204,199,199,199,195,203,195,179,198,198,202,179,198,179,179,179,198,179,198,199,203,199,199,199,203,198,202,198,179,198,198,203,198,179,198,198,198,198,198,179,199,198,203,198,199,195,179,196,198,179,198,198,198,179,199,195,202,203,199,199,199,195,179,199,199,199,203,198,200,200,196,199,200,195,200,203,200,200,198,200,203,199,199,199,195,199,199,199,199,198,201,204,204,201,206,201,205,201,205,200,74, +84,85,85,86,85,89,89,7,32,36,132,130,144,132,139,144,140,19,17,13,13,13,34,111,22,34,142,11,114,144,147,149,144,125,125,140,32,32,31,44,119,114,21,34,109,114,151,18,150,140,6,135,152,144,122,17,30,34,11,2,5,11,133,135,32,138,146,151,108,125,6,6,24,139,109,2,6,13,13,32,34,34,136,31,8,17,17,18,33,46,22,29,34,22,11,106,132,34,118,119,18,120,14,48,46,2,5,5,1,5,2,5,1,2,5,1,11,117,110,33,18,132,11,2,1,2,5,29,13,2,21,130,134,130,141,149,149,133,133,139,133,119,117,46,141,110,47,1,5,5,28,30,110,31,117,106,116,106,109,116,142,142,20,140,32,16,36,15,120,164,162,173,169,171,166,171,194,162,169,168,168,162,171,160,168,162,162,162,160,161,162,169,160,160,98,160,160,160,162,162,168,171,169,171,179,179,198,177,198,203,195,198,199,204,198,200,200,198,200,200,200,199,198,199,203,199,195,179,198,198,179,179,179,179,179,179,179,179,198,195,199,199,198,199,198,179,195,198,198,179,198,199,195,198,179,199,179,198,202,198,179,196,200,203,203,199,178,203,198,195,198,198,203,198,203,198,200,198,200,195,200,195,198,198,198,196,203,203,198,204,200,203,200,204,198,204,200,200,200,200,195,203,200,198,199,199,198,199,199,198,204,201,204,201,201,201,205,201,201,131, +89,89,89,89,90,90,95,26,13,32,132,139,182,138,140,128,125,125,20,11,11,13,17,116,33,130,144,11,116,122,111,109,115,114,111,110,16,29,16,130,109,44,13,34,106,119,126,126,144,132,133,144,144,122,139,109,29,106,13,2,31,21,48,47,16,126,149,146,138,133,16,13,119,116,17,6,6,11,13,22,24,116,120,11,17,46,17,17,24,15,17,36,119,130,6,106,119,132,149,122,130,24,11,37,20,1,2,5,7,2,2,2,5,2,2,6,21,34,34,120,116,15,6,1,2,2,2,30,3,6,30,33,132,46,129,180,133,133,141,132,119,129,120,141,139,149,31,1,2,11,29,22,33,116,119,116,116,129,132,122,145,125,110,18,16,22,16,74,179,169,169,162,171,169,194,169,171,169,175,169,171,169,168,162,160,162,156,159,160,160,169,159,160,160,156,159,160,160,168,162,162,168,173,194,177,179,179,198,179,200,195,179,196,200,204,200,204,204,199,204,199,196,199,198,199,195,203,198,179,202,198,179,179,179,179,202,198,198,179,200,203,179,200,198,198,198,202,179,196,203,196,203,199,195,199,199,195,179,179,198,202,179,199,196,203,195,199,195,203,199,196,198,198,203,200,198,200,200,195,203,203,195,200,199,199,196,198,200,200,204,198,201,201,200,203,198,201,200,204,198,201,199,199,203,199,198,199,199,198,195,200,200,200,204,204,205,201,204,201,74, +89,90,89,90,85,91,90,27,32,119,139,136,137,136,126,127,143,145,109,11,11,14,16,106,126,132,106,17,119,140,18,108,125,114,114,106,24,16,22,119,16,110,21,46,43,110,151,145,33,116,149,126,150,126,138,20,13,13,2,2,5,33,11,6,7,140,151,127,126,34,109,70,34,11,6,6,6,7,14,34,109,119,24,2,44,106,126,43,33,30,30,47,123,11,29,106,147,137,149,136,124,132,11,132,24,1,2,2,5,13,1,2,2,5,2,2,23,46,32,132,132,21,2,5,2,2,2,70,68,16,21,130,133,120,133,117,182,133,133,119,130,120,120,149,133,141,24,1,2,13,21,43,125,118,109,116,132,119,114,124,144,140,36,17,66,168,167,168,168,168,194,171,173,171,171,173,171,171,173,162,194,160,168,160,162,160,160,162,162,162,156,159,160,160,97,156,160,160,162,167,169,171,171,179,177,179,199,179,199,203,199,199,203,195,198,204,200,199,204,199,200,203,203,195,203,179,179,198,202,198,179,179,179,202,179,179,198,179,198,198,199,202,198,198,179,198,198,202,198,203,198,204,199,195,199,195,199,199,195,179,198,202,198,198,199,203,199,199,198,200,199,198,200,198,200,200,200,198,200,198,198,200,198,198,198,203,198,196,198,204,200,200,198,204,200,204,200,204,198,204,198,204,200,198,195,198,200,199,199,199,199,198,200,200,204,200,204,204,200,74, +89,90,91,90,91,90,91,71,133,120,130,114,109,114,119,128,150,146,33,11,13,21,22,46,110,37,24,46,138,126,8,46,144,149,126,34,17,22,30,22,34,22,16,31,34,123,149,126,18,148,108,138,138,126,139,116,2,2,11,6,11,14,2,11,11,123,130,19,148,125,115,15,11,7,7,2,6,7,29,132,133,106,123,6,36,106,120,34,33,15,46,126,116,11,34,183,149,151,139,132,129,124,11,37,13,2,6,10,5,2,2,2,5,2,2,7,43,110,110,133,130,2,2,2,2,9,13,13,2,6,21,130,144,149,145,133,47,139,147,125,132,132,129,141,133,132,33,1,2,35,11,117,120,109,44,114,120,124,118,106,149,31,69,14,78,168,168,168,171,169,171,169,177,194,169,173,171,177,173,173,171,169,162,160,160,159,160,162,160,160,160,159,159,160,156,160,162,160,162,168,168,171,173,194,179,198,179,202,199,196,195,179,196,203,203,204,199,196,203,204,196,199,196,200,203,195,202,198,179,194,179,179,179,177,179,198,198,202,198,179,195,198,198,179,198,198,177,198,199,198,203,198,200,199,203,196,203,203,203,195,179,198,179,198,199,196,203,199,198,196,198,200,200,195,200,195,200,198,204,195,200,195,198,198,200,198,195,198,203,200,204,204,200,201,200,204,201,200,200,203,200,198,204,198,196,196,198,198,200,203,199,198,199,204,200,196,200,200,204,131, +89,89,89,89,89,90,85,71,6,17,125,138,139,137,136,147,150,139,86,60,29,16,22,67,101,92,96,46,126,114,15,116,126,144,132,34,22,120,22,30,47,13,16,129,106,132,144,115,32,150,136,123,144,126,144,18,11,22,123,13,47,13,2,11,24,122,18,139,138,126,143,19,6,6,6,6,2,13,8,116,18,36,110,16,16,106,132,123,33,36,136,181,109,37,120,181,136,141,138,120,33,22,10,30,2,2,2,5,2,11,2,1,2,2,6,5,45,33,120,119,33,1,2,2,2,1,11,21,6,2,30,133,124,47,151,147,31,132,144,149,126,119,132,144,126,144,34,1,11,21,29,117,120,109,109,118,116,124,128,43,45,163,162,98,173,162,168,171,169,169,175,171,169,173,173,169,177,171,177,171,168,162,162,162,162,160,160,162,169,167,169,160,162,159,160,156,169,162,162,168,171,173,194,202,198,198,203,198,199,203,203,195,198,200,200,195,203,198,199,198,204,203,203,198,179,198,179,179,198,179,179,198,198,198,202,179,198,179,198,198,179,198,179,198,177,198,198,179,203,199,199,203,198,199,199,198,200,198,195,203,195,179,198,198,203,196,200,198,204,200,200,198,196,204,195,204,200,204,198,204,204,198,200,204,195,204,204,200,204,198,195,204,201,204,201,201,203,201,203,200,200,204,200,200,203,199,199,203,199,198,200,198,198,200,199,204,198,201,200,74, +89,89,89,85,90,91,89,90,6,13,123,144,140,136,119,140,148,79,89,90,79,75,75,90,92,91,96,59,13,33,138,144,149,182,96,53,22,32,30,34,20,31,26,23,132,144,149,114,22,150,136,122,136,133,150,8,29,114,126,8,119,13,7,2,132,105,119,144,34,16,150,20,11,6,6,2,2,6,29,115,32,114,136,8,22,132,130,133,132,130,141,126,33,130,119,151,110,130,133,138,109,16,14,6,2,5,6,2,10,2,6,1,1,2,7,6,30,123,109,109,15,6,1,2,5,2,2,2,11,1,36,151,123,34,149,144,106,133,141,133,132,116,144,144,145,147,17,2,2,22,31,36,36,116,109,116,122,113,148,169,162,171,169,171,162,171,171,169,171,177,177,168,177,175,171,171,168,169,194,171,169,162,160,162,162,159,169,162,162,162,162,160,162,160,162,160,167,162,162,168,171,202,194,202,179,198,179,196,196,200,199,203,198,200,198,199,198,200,200,203,198,200,198,179,198,198,198,179,179,179,179,179,202,179,198,198,179,198,179,198,199,198,198,198,179,179,198,199,196,198,199,199,199,204,200,198,200,198,200,198,199,198,198,179,198,199,198,205,203,198,200,200,204,198,204,204,204,195,201,204,195,201,195,204,195,204,195,204,195,200,200,198,204,204,201,200,201,200,201,200,203,200,200,204,200,200,198,200,199,196,199,199,196,198,199,203,199,198,200,131, +89,86,89,90,86,88,91,100,6,6,33,126,142,138,122,106,48,90,89,90,86,90,90,91,91,90,92,59,106,116,119,117,48,87,96,96,49,11,32,29,7,33,33,21,47,36,29,11,114,150,144,123,106,138,151,105,34,114,120,29,129,119,123,104,114,18,137,132,11,24,153,19,2,11,6,6,2,7,17,123,106,106,135,20,36,130,110,132,132,120,130,24,24,139,133,130,120,106,136,123,130,116,2,2,2,2,2,11,2,2,2,2,1,2,2,2,34,109,111,33,2,2,6,2,2,5,2,5,7,11,29,136,122,36,133,149,24,141,145,136,136,133,140,141,133,126,8,2,21,36,13,46,109,109,118,118,125,127,140,194,160,171,168,168,168,168,167,168,169,171,171,177,171,171,177,175,173,171,162,168,162,162,162,161,162,169,162,162,168,162,162,162,162,168,162,162,168,162,171,171,194,173,179,198,179,198,203,199,199,196,198,200,196,198,200,203,199,199,198,196,198,203,198,199,195,179,179,179,194,198,179,198,202,179,179,179,202,179,202,179,198,179,198,179,198,179,198,179,199,200,200,203,198,200,198,204,198,200,200,203,203,195,179,198,199,199,200,198,201,203,200,204,195,201,201,204,201,204,200,204,201,204,201,201,201,204,201,201,204,195,204,201,204,204,204,204,204,201,200,200,204,201,203,198,200,200,198,204,199,198,200,199,199,199,195,196,199,203,195,74, +85,85,85,85,89,89,86,90,58,11,126,128,128,132,134,77,95,89,91,90,90,91,86,90,86,91,92,71,66,68,77,100,91,92,91,96,96,62,34,16,30,123,18,13,32,8,11,16,149,150,147,33,106,128,146,144,120,133,31,34,110,133,149,154,148,22,122,105,11,24,145,8,11,7,2,2,7,6,37,125,45,47,106,106,30,117,106,129,136,46,29,24,110,144,109,34,136,120,137,124,126,116,0,6,1,11,2,2,6,6,2,6,1,1,6,2,46,138,125,15,6,2,2,2,6,1,2,2,31,31,30,144,137,117,37,133,30,153,149,145,133,119,138,122,119,124,11,2,2,8,43,111,126,33,33,111,125,115,145,198,168,162,169,168,168,162,168,162,168,168,162,171,169,162,171,171,171,171,168,168,162,168,162,160,168,168,162,168,168,169,162,162,171,162,168,168,162,168,171,173,179,198,198,202,194,198,195,203,199,203,195,198,204,203,196,203,200,199,200,199,198,179,199,198,203,179,198,179,179,179,202,179,179,179,198,179,198,198,198,198,202,179,198,198,202,173,195,199,198,195,198,201,200,198,204,200,200,203,198,200,200,200,203,196,198,199,200,204,204,201,205,201,204,201,204,201,204,201,204,201,204,204,204,201,204,201,201,200,204,201,195,204,204,200,201,204,200,204,204,204,199,200,200,195,200,200,200,198,204,200,203,198,199,203,203,199,198,199,195,74, +89,89,89,85,85,89,89,85,90,61,36,123,121,78,84,89,82,85,85,90,76,90,91,89,91,90,86,90,91,85,91,90,91,91,91,91,92,102,39,11,17,138,17,13,30,7,2,29,123,149,126,20,139,152,151,138,136,125,10,130,147,153,153,144,147,126,144,114,17,106,145,11,7,7,6,2,6,6,119,116,34,106,47,106,33,47,34,47,126,11,8,109,141,143,29,132,116,119,141,144,151,24,2,1,2,11,2,6,2,7,13,2,2,6,1,2,129,122,132,22,2,2,2,5,1,5,2,6,36,129,116,129,141,122,120,132,30,126,133,133,136,140,132,132,110,125,11,2,13,46,110,126,146,127,29,24,150,128,147,169,169,169,168,162,162,162,168,162,168,162,169,169,162,168,171,173,171,169,168,168,168,169,162,162,162,162,162,168,169,162,171,169,162,162,160,162,171,171,171,194,179,202,179,198,198,203,199,198,204,200,200,200,203,198,200,195,198,204,198,196,200,198,203,195,196,198,202,179,179,179,194,202,179,179,202,179,195,179,198,179,198,179,198,179,198,198,179,203,199,203,200,195,204,204,200,198,200,200,204,199,198,196,198,199,204,200,201,201,204,201,201,204,205,201,201,204,201,201,204,201,204,201,201,204,201,204,201,204,204,204,201,200,201,204,204,201,204,204,204,200,199,200,200,200,198,199,202,200,198,200,199,199,200,200,195,200,200,198,200,131, +85,85,86,88,85,89,84,84,89,89,89,82,84,84,82,84,89,85,90,91,90,90,85,89,91,85,90,90,89,90,89,91,89,86,91,91,92,96,62,30,46,122,16,32,30,13,2,24,144,152,148,20,149,144,142,124,106,110,15,120,153,151,144,111,149,139,128,127,8,138,144,6,7,6,2,2,13,7,132,33,106,128,127,108,29,22,116,44,123,8,11,116,136,136,16,124,132,114,153,141,68,11,2,2,5,1,11,2,11,13,21,6,2,2,2,6,117,149,132,13,2,2,5,25,1,2,6,7,47,120,120,120,124,151,105,31,18,132,120,132,133,124,123,110,47,117,6,2,11,33,116,136,140,138,104,113,141,126,130,169,169,168,162,171,169,160,168,168,171,171,171,177,168,171,194,169,177,171,169,162,171,168,169,169,169,169,162,162,169,169,162,168,160,160,159,160,162,171,171,194,173,198,179,202,179,200,198,200,203,199,200,199,200,200,200,200,203,198,200,179,196,199,196,203,179,179,179,179,202,179,198,179,198,198,179,195,179,203,178,202,195,179,196,199,198,179,200,198,198,198,200,200,203,200,198,200,200,204,196,200,204,200,200,200,195,204,201,201,201,206,201,205,201,205,206,201,204,201,204,201,201,201,204,201,201,205,201,204,201,201,204,201,200,200,201,200,201,203,200,204,199,199,202,199,199,199,198,199,203,198,200,202,199,198,198,199,199,202,179,74, +89,89,85,89,82,84,84,82,84,82,84,84,84,84,89,85,86,89,85,85,91,89,90,91,82,91,85,91,88,91,90,90,89,91,90,86,90,86,92,75,130,43,30,29,11,11,7,141,152,151,144,151,138,143,150,128,119,8,43,110,148,147,143,145,115,109,132,126,15,153,128,6,7,14,29,16,11,13,136,15,30,138,143,20,11,34,124,24,132,31,36,133,124,132,34,119,149,119,144,124,6,2,5,2,2,6,6,2,14,47,22,21,13,6,2,2,68,125,33,2,6,10,2,1,2,5,1,13,119,119,15,32,133,116,130,133,33,106,120,110,130,132,139,120,110,6,2,6,13,106,132,119,132,127,140,126,18,69,156,162,162,168,169,169,162,171,169,171,169,171,171,162,194,162,171,171,162,194,168,194,162,171,171,162,171,169,162,169,162,160,162,156,156,156,156,156,160,169,168,171,194,179,179,179,198,198,202,179,200,202,199,199,199,200,200,200,199,200,199,198,199,203,199,200,198,198,179,173,198,198,179,202,179,198,198,203,195,179,202,194,198,203,199,203,199,198,198,199,203,200,200,203,198,198,204,198,200,195,204,204,198,200,204,204,200,201,204,205,205,206,206,201,206,201,206,205,201,201,205,201,204,201,201,201,204,201,201,204,201,200,204,201,204,204,204,204,200,204,204,195,202,194,198,199,198,177,198,179,198,179,179,198,198,179,198,179,198,177,179,74, +89,84,84,85,84,84,84,84,82,84,84,84,84,82,84,84,84,85,89,85,85,90,89,85,91,90,91,89,89,89,89,90,91,90,85,91,90,90,91,91,95,13,13,2,16,17,6,120,151,137,141,144,150,142,142,138,17,13,33,37,153,152,146,145,142,115,110,111,122,124,13,6,7,36,110,114,109,22,47,2,29,129,150,20,23,34,116,47,123,116,117,133,149,126,68,133,141,130,149,125,2,2,2,1,2,2,2,11,106,36,47,22,46,29,31,18,117,139,136,2,2,2,6,2,2,5,2,13,116,29,18,17,36,109,43,116,29,29,119,106,130,123,106,106,132,24,2,2,11,119,110,120,132,144,140,45,159,161,156,162,161,168,162,169,169,162,171,171,171,173,171,171,171,162,169,169,169,171,171,169,171,168,168,171,162,169,162,160,160,156,98,103,98,103,103,156,156,160,162,168,171,171,171,177,179,177,198,177,194,202,179,198,196,199,204,204,204,199,195,198,198,202,198,179,200,179,198,198,179,179,198,198,202,179,195,179,198,198,198,179,199,179,198,203,200,203,199,200,200,200,198,200,200,203,200,195,200,204,200,204,200,204,201,200,203,204,201,204,201,205,201,205,206,206,201,205,205,204,201,205,201,204,201,204,201,201,204,201,204,204,204,201,204,201,200,200,200,198,199,199,198,198,198,179,198,177,194,179,202,179,194,173,179,199,194,173,194,171,171,74, +84,84,84,84,84,84,84,84,82,84,82,84,84,84,84,88,85,85,89,89,89,91,85,90,85,85,85,89,89,89,89,91,90,89,91,90,90,89,90,90,95,12,11,6,22,24,7,130,149,148,145,138,150,143,150,106,15,24,13,47,147,149,127,143,115,17,18,17,132,29,2,11,7,24,109,125,149,106,30,6,16,34,132,15,16,34,138,117,133,140,139,182,186,22,120,149,136,151,37,132,3,5,2,2,2,6,5,6,106,114,48,16,15,22,136,119,181,24,130,6,2,5,2,2,2,2,2,21,116,124,29,34,120,33,110,46,18,29,30,119,120,130,119,47,47,32,6,2,13,43,119,132,133,124,17,87,160,160,156,156,160,162,162,169,162,169,168,168,168,168,168,169,162,160,159,160,162,162,168,168,162,162,162,162,161,160,160,156,103,98,98,98,98,98,98,98,98,98,160,161,168,169,168,171,171,171,171,177,179,179,194,179,179,199,203,199,199,198,198,203,199,179,198,203,198,198,202,179,198,198,198,179,200,199,203,199,179,198,179,198,179,198,198,199,199,200,200,203,196,200,203,200,200,200,200,200,200,200,198,204,200,201,200,204,201,204,200,201,201,204,201,201,206,201,206,201,205,201,201,201,204,201,201,201,204,201,204,201,205,204,201,203,200,198,204,200,203,199,198,194,177,179,179,177,194,194,179,177,194,173,173,194,194,177,179,173,169,160,162,69, +82,84,82,82,84,82,82,82,82,84,82,84,84,84,84,88,89,85,86,89,89,89,86,88,90,85,86,82,85,89,89,85,85,89,89,89,89,89,89,89,95,61,14,129,129,29,34,116,141,149,144,138,145,150,115,4,22,122,15,117,140,127,149,143,150,111,18,192,18,7,2,6,13,13,24,128,126,110,15,2,21,110,126,6,22,130,141,45,133,153,151,144,116,6,181,132,47,120,34,106,20,2,5,11,6,2,6,7,123,122,109,11,22,17,110,123,141,14,20,2,11,6,2,12,2,5,2,13,106,120,30,32,46,106,46,36,106,43,47,120,132,120,120,45,106,24,15,11,29,31,47,149,120,97,87,98,103,159,160,161,156,160,169,162,160,169,156,160,162,168,162,161,160,156,160,156,156,162,168,169,168,162,156,160,156,160,103,98,98,96,102,92,92,92,98,98,98,103,93,159,161,162,162,156,168,162,169,160,173,171,171,173,194,202,194,203,203,200,195,199,199,203,199,179,200,198,198,198,179,198,200,199,202,196,198,200,203,198,199,203,198,179,198,179,196,204,200,204,200,200,200,200,198,200,199,199,199,199,203,200,200,204,200,200,204,204,204,201,200,201,205,204,201,201,205,205,201,206,205,204,201,201,201,205,201,201,201,204,204,200,200,198,199,200,179,198,179,177,179,179,169,194,162,168,177,177,169,194,169,162,171,177,171,173,171,194,162,171,169,74, +84,84,82,82,82,82,84,84,84,82,84,82,82,82,84,85,89,85,85,85,85,85,88,85,85,85,85,88,84,84,84,88,89,84,89,85,86,89,89,89,90,61,14,23,29,29,22,119,106,122,47,34,149,146,146,114,18,46,17,139,150,145,153,152,125,153,114,27,2,11,2,7,7,13,34,146,149,124,6,2,47,153,153,8,45,141,110,106,47,150,148,138,6,120,119,132,22,119,45,47,111,2,31,125,33,13,11,11,117,24,109,15,13,13,106,147,125,36,126,2,21,16,2,1,1,2,11,13,116,47,17,36,43,43,31,43,116,43,43,46,46,47,119,46,133,106,24,34,33,116,132,164,92,97,103,98,98,103,160,160,160,161,160,156,162,160,160,162,168,162,160,156,159,160,156,160,156,162,162,160,161,160,160,161,156,160,98,92,92,92,96,92,96,101,92,92,98,98,98,98,98,103,98,160,156,160,159,160,169,167,169,171,171,171,173,194,179,198,179,199,195,198,202,199,199,198,179,179,198,198,179,200,198,199,200,200,200,195,199,198,179,200,198,203,195,200,200,198,204,204,204,199,203,200,198,199,179,200,179,200,199,199,199,199,204,204,201,204,200,204,204,201,205,205,205,201,205,204,197,205,201,204,204,204,205,201,204,205,200,200,199,179,202,179,199,194,173,194,177,171,169,169,169,169,171,171,177,169,162,168,171,171,168,168,162,168,162,169,162,69, +84,82,81,82,84,81,88,84,82,82,82,84,82,84,84,84,84,84,82,85,89,84,85,84,88,84,84,82,84,82,84,85,85,85,90,85,90,85,89,95,91,82,0,2,11,106,11,106,36,46,22,22,153,145,148,127,17,29,8,149,149,142,153,154,144,153,20,5,2,11,7,6,7,13,34,126,138,32,16,5,36,147,149,8,129,136,31,16,132,146,140,11,33,123,147,141,15,47,29,43,114,4,123,105,182,185,3,13,30,110,33,24,20,126,147,124,136,129,147,2,7,13,2,5,2,2,11,47,130,29,29,47,116,116,124,114,33,31,138,116,136,132,138,114,186,144,120,46,23,35,71,96,96,93,98,98,98,98,160,159,160,156,160,156,160,156,160,156,162,156,160,156,103,156,160,156,162,169,160,160,162,160,160,160,161,98,96,102,92,92,92,92,91,92,92,92,92,96,101,98,98,98,98,98,98,98,103,159,160,160,160,162,162,168,169,168,173,194,179,179,198,179,179,179,179,198,179,194,179,179,198,203,198,198,198,199,204,204,202,196,199,199,179,199,203,195,203,200,200,203,198,203,198,179,179,179,179,198,179,198,179,202,179,198,179,199,199,199,200,200,204,201,204,201,201,205,206,201,204,201,200,201,204,200,201,204,200,200,203,199,198,198,202,194,169,177,171,171,177,168,162,162,162,169,169,169,171,168,168,169,169,169,168,160,162,162,160,162,160,73, +82,82,84,82,84,84,81,82,82,82,81,85,81,84,82,82,84,82,84,84,82,90,89,88,84,84,88,84,84,84,84,85,88,85,88,89,85,90,90,88,89,95,40,2,14,133,2,45,30,47,11,29,150,146,142,142,33,11,43,144,152,151,126,140,123,152,109,2,5,6,6,7,6,11,13,110,109,17,30,2,21,144,133,11,20,114,109,36,133,149,128,22,138,141,144,122,30,33,33,23,116,144,128,130,136,136,6,11,33,106,120,123,109,141,146,123,129,119,116,0,5,72,64,2,2,6,7,37,22,7,117,120,130,120,129,120,120,43,119,130,132,130,31,138,154,149,111,120,77,95,95,91,97,102,98,98,98,98,103,160,159,103,97,160,156,160,156,161,160,160,156,160,160,156,160,160,162,162,156,169,169,160,156,160,156,98,98,96,92,91,91,91,91,91,91,91,92,92,91,92,92,92,98,92,98,98,98,98,156,156,156,160,156,160,160,162,162,169,171,168,168,168,169,168,173,179,179,179,179,171,179,199,198,179,198,198,198,179,200,202,203,198,203,200,203,203,200,199,204,202,200,199,198,179,169,171,173,173,171,177,179,194,177,194,173,198,198,198,198,199,200,204,200,201,201,204,201,205,201,201,204,201,201,201,204,203,199,198,179,198,177,177,179,177,162,162,168,168,168,162,168,162,167,168,162,162,160,169,162,171,162,162,162,162,160,160,160,159,159,73, +84,84,82,84,82,82,84,84,84,81,85,83,85,81,82,84,82,84,82,84,88,85,85,82,84,84,84,84,84,84,84,88,84,89,88,88,89,88,85,90,90,88,54,7,43,33,6,5,33,20,13,16,148,150,143,148,122,16,47,144,120,122,15,106,46,138,33,2,2,11,6,6,6,7,13,31,33,14,30,5,7,119,124,11,37,106,120,36,151,153,127,111,124,138,132,33,30,30,22,43,114,186,140,147,132,17,6,21,118,30,116,137,132,136,130,110,36,139,120,2,5,6,2,38,2,11,11,43,2,11,119,37,120,36,120,47,124,110,47,47,132,31,46,144,154,119,46,85,89,89,90,85,92,87,98,98,98,103,98,156,103,159,103,156,160,156,156,160,162,160,156,160,156,160,160,160,162,161,156,160,156,160,160,98,103,98,96,92,92,91,101,91,90,91,91,91,92,91,92,92,92,101,92,93,98,98,103,98,103,98,98,98,98,103,156,160,103,156,156,160,156,98,103,159,156,169,171,173,179,179,179,194,179,179,179,194,179,198,198,179,198,179,179,198,179,199,200,200,199,203,199,199,198,179,168,168,162,162,169,168,162,169,169,171,168,171,177,198,179,202,200,204,201,203,201,205,204,201,201,204,201,201,203,204,200,202,179,198,177,194,173,171,169,171,162,162,168,162,162,162,162,162,162,162,160,168,162,162,162,160,162,160,162,160,156,160,156,156,156,71, +81,84,81,84,81,81,84,82,81,81,85,81,81,82,81,84,81,88,84,84,84,84,88,85,84,84,84,82,84,84,84,88,85,85,88,88,85,88,88,88,85,85,85,7,5,2,2,6,29,17,17,138,153,152,150,144,125,112,24,132,119,20,109,34,120,127,13,2,11,2,7,6,6,11,17,46,33,16,116,1,2,130,126,3,45,130,114,106,151,148,127,125,126,125,128,31,109,18,36,116,151,183,153,132,46,13,115,125,136,33,47,130,141,150,120,8,119,133,17,1,6,2,2,25,1,2,12,1,6,37,132,47,120,118,106,132,141,109,29,106,20,113,140,124,120,130,65,90,89,90,86,90,91,91,92,98,98,98,98,103,98,98,103,160,156,160,160,160,156,160,156,161,160,156,160,160,156,160,161,156,160,160,98,103,98,98,98,96,92,91,90,91,91,91,91,102,91,92,96,91,102,91,96,102,92,101,98,98,92,101,96,96,91,96,96,98,98,98,102,96,92,92,92,92,98,98,160,169,169,173,171,173,173,173,171,171,171,169,173,179,173,173,171,173,179,198,202,179,179,198,202,179,179,173,169,160,160,156,159,160,156,160,162,160,160,169,171,179,194,203,198,204,201,200,204,204,204,204,204,204,200,204,200,179,198,198,177,171,168,169,169,168,162,160,162,161,162,162,162,162,162,169,169,162,162,162,162,160,162,162,162,160,160,160,160,103,98,103,98,72, +81,81,84,84,81,81,85,81,81,81,81,81,82,84,82,84,82,84,84,84,82,84,84,82,82,84,82,84,81,84,84,84,84,84,88,85,84,84,84,88,88,88,95,51,2,2,5,2,13,22,109,150,153,150,128,125,139,153,122,132,132,31,18,110,132,15,5,2,2,11,2,7,14,123,126,116,37,11,106,2,6,106,144,22,30,116,110,34,145,144,132,127,125,151,151,24,106,33,45,141,149,142,153,122,15,21,138,153,142,132,114,147,114,132,138,130,138,110,6,2,2,9,2,2,2,6,5,2,2,130,130,44,130,117,47,47,123,33,33,136,153,124,149,30,65,86,90,86,84,88,90,91,90,91,91,87,97,96,98,98,98,103,98,159,103,159,160,161,160,160,160,98,103,160,161,161,160,161,156,160,156,98,103,98,92,96,98,101,92,92,91,92,91,101,92,102,92,91,92,92,92,91,91,92,92,92,92,91,91,92,91,91,90,79,92,91,92,92,87,92,91,90,91,92,92,87,98,98,159,97,160,161,168,162,160,168,162,162,156,169,173,162,169,169,171,173,194,202,194,179,179,194,162,167,156,156,98,98,98,160,156,98,98,97,159,156,173,194,202,179,198,199,198,200,202,200,200,200,200,200,200,199,199,202,194,169,171,162,162,162,160,156,162,156,160,156,162,156,160,162,162,160,169,160,156,160,160,160,161,160,156,161,156,103,98,156,98,98,98,72, +81,81,81,56,84,81,81,81,81,85,80,81,85,84,81,82,81,81,82,82,84,84,84,81,88,84,82,81,84,84,84,84,84,88,84,84,84,88,85,88,85,88,90,84,1,5,2,2,13,34,123,152,150,145,152,126,126,153,142,114,51,11,18,33,18,2,2,5,6,2,10,6,106,124,126,24,34,8,31,11,2,47,116,15,30,110,15,47,138,137,114,126,183,183,125,46,34,33,36,144,137,128,154,145,15,11,133,136,124,126,141,148,183,116,151,136,140,149,164,75,11,2,2,6,1,6,2,2,2,47,109,106,119,46,114,116,114,13,141,137,140,43,87,82,91,85,90,84,84,86,90,91,85,90,90,90,91,92,96,92,103,98,103,98,159,156,160,156,161,160,98,160,103,160,156,160,160,161,160,161,156,103,103,97,96,92,102,92,96,91,91,91,92,101,101,92,96,91,91,92,91,91,91,91,91,92,91,91,90,86,92,91,91,90,90,91,90,91,90,89,91,90,91,91,91,92,92,92,97,101,98,98,98,156,98,98,159,160,98,156,160,160,156,162,162,160,171,179,173,169,177,169,162,160,98,98,97,92,98,98,103,98,98,98,156,162,169,194,179,198,202,179,198,198,202,179,199,203,203,196,198,179,198,179,177,169,162,162,162,160,162,160,160,160,156,160,160,160,162,156,162,160,156,160,160,156,160,160,160,156,160,156,98,98,98,98,101,101,92,71, +81,81,81,81,56,81,81,81,81,85,83,81,81,85,81,81,85,84,81,82,82,81,82,84,81,84,81,84,81,84,84,84,84,84,84,84,84,88,88,81,88,88,89,100,5,2,2,5,21,120,126,150,144,145,141,35,144,153,145,125,110,17,24,32,6,6,1,2,11,6,7,11,22,122,124,7,12,29,23,11,2,36,109,8,16,22,18,110,138,128,142,145,149,153,19,34,43,22,29,130,153,143,153,110,111,151,8,130,144,133,153,153,151,137,37,117,45,67,62,38,9,2,5,25,5,11,11,2,2,47,124,120,126,111,46,142,140,17,120,132,183,131,90,90,85,85,85,82,85,89,90,90,85,90,85,91,91,92,92,98,103,98,103,160,160,160,156,98,103,98,103,103,98,98,98,101,98,103,98,160,98,98,102,98,96,91,92,92,91,92,92,91,92,102,92,101,91,91,91,91,91,95,92,91,91,90,91,91,91,89,86,90,86,95,90,90,89,90,85,90,91,89,90,82,91,91,91,91,92,92,98,98,101,96,101,92,98,98,98,98,96,98,98,160,156,160,168,162,171,171,171,168,160,98,96,92,92,96,96,98,93,98,98,160,160,161,162,177,173,173,179,198,179,202,179,202,202,179,202,179,202,179,171,171,168,168,160,160,160,160,156,160,160,156,160,161,160,156,160,156,160,160,160,160,156,160,160,159,103,98,103,98,98,93,102,92,96,92,92,62, +81,81,81,81,81,81,56,81,81,83,85,81,81,81,56,85,81,81,85,81,81,84,81,84,84,84,84,81,84,82,84,84,84,81,84,84,84,84,84,84,88,88,89,100,25,2,5,2,2,106,144,124,144,148,3,22,185,148,122,188,197,121,11,6,5,2,1,7,7,10,2,2,29,126,125,6,21,22,106,11,2,48,136,11,22,114,132,123,153,186,186,154,151,143,125,22,31,21,13,136,154,153,138,45,46,46,116,144,132,110,183,133,123,132,29,46,60,85,82,58,12,9,1,10,5,5,29,11,2,30,46,47,114,111,20,133,15,46,130,184,185,86,89,85,90,86,90,85,88,85,86,88,88,85,89,91,91,91,101,92,98,103,98,103,98,98,98,98,98,96,91,92,97,96,91,91,92,98,98,96,101,98,87,91,91,95,90,91,91,91,91,91,91,91,87,91,91,91,91,86,95,91,91,91,91,91,90,89,85,91,90,91,90,89,76,91,85,90,89,90,89,89,90,91,91,90,91,91,92,96,92,92,92,92,92,92,101,92,97,92,91,92,98,156,103,162,162,162,168,168,162,161,97,97,92,92,92,92,96,101,101,98,98,160,159,162,169,171,171,171,179,173,194,179,179,194,173,194,173,194,177,171,171,169,162,160,160,156,156,156,103,156,156,159,160,159,160,103,156,98,160,162,156,160,156,98,98,98,98,98,101,101,97,102,92,92,96,96,90,58, +56,81,56,81,81,56,84,81,81,56,81,81,81,85,81,81,81,88,81,81,85,81,81,81,81,81,81,88,81,84,84,84,84,81,88,84,84,84,84,84,84,85,88,90,53,2,2,2,5,31,127,144,150,140,8,14,132,138,11,36,138,8,1,6,11,2,1,10,12,11,11,5,119,151,29,13,37,17,117,2,2,130,136,6,37,137,132,151,186,186,153,186,145,150,142,8,11,6,17,139,144,149,114,14,47,46,141,147,126,134,153,19,24,131,29,81,90,88,88,90,40,58,28,5,10,2,26,9,21,134,182,182,191,120,67,34,46,47,141,191,87,90,86,90,90,89,91,85,85,90,85,86,89,90,86,90,91,91,91,92,96,93,98,98,98,98,98,96,101,91,91,91,91,92,85,91,91,91,91,89,91,91,90,90,90,86,90,91,91,91,91,92,91,91,90,91,91,91,91,91,86,91,90,91,92,91,91,90,92,90,92,91,85,91,89,90,91,85,86,89,89,89,90,91,90,91,90,91,91,87,101,92,92,91,92,92,91,91,91,91,91,87,101,98,98,160,156,103,156,160,169,156,102,92,92,92,96,92,92,96,98,98,103,93,156,156,156,169,169,169,169,173,173,171,171,173,171,177,173,171,168,169,168,168,162,162,156,160,160,103,97,98,98,98,98,156,103,159,103,160,156,160,156,103,97,98,97,101,98,97,97,101,98,97,97,92,92,97,96,58, +81,81,81,81,81,81,81,81,81,81,56,81,81,81,56,88,81,81,56,85,81,81,81,85,81,82,82,81,84,84,84,84,84,84,81,84,88,85,84,84,88,84,88,85,85,26,2,5,2,30,144,151,146,153,148,34,132,10,2,5,1,2,1,5,2,2,1,13,1,10,12,8,187,45,2,21,50,2,126,11,2,133,32,2,30,119,132,149,186,153,153,144,141,138,151,6,6,6,6,148,119,148,45,30,46,106,145,140,30,136,130,115,136,44,59,71,89,84,88,90,63,95,61,13,5,5,5,14,148,180,180,45,151,141,144,181,31,149,193,158,90,91,89,91,91,90,90,85,85,91,85,90,90,90,85,89,90,90,85,91,90,90,92,92,91,92,92,91,91,95,90,91,90,89,91,90,90,91,89,91,90,90,85,85,86,90,85,90,91,91,92,91,90,91,91,91,91,91,91,91,91,91,91,92,92,91,90,90,86,91,90,92,90,90,90,91,85,89,85,85,89,89,91,89,90,79,91,91,90,91,91,91,89,91,90,92,91,91,91,91,90,91,92,98,98,92,98,101,103,156,160,160,97,92,96,92,92,96,98,98,98,98,98,98,103,98,156,160,156,162,169,169,169,162,169,173,171,177,171,169,162,168,162,162,168,162,160,160,156,98,98,98,98,98,98,98,103,98,98,98,103,156,98,103,98,98,97,93,102,92,98,98,98,98,96,93,102,91,92,71, +81,80,82,81,81,81,56,82,81,81,81,81,81,80,81,81,81,81,81,81,81,81,81,81,81,85,81,84,81,82,84,84,81,84,85,84,81,81,88,84,84,84,88,88,85,99,2,2,12,30,132,144,148,150,122,141,5,6,2,2,5,1,2,2,12,2,1,2,5,6,2,14,140,110,2,21,29,2,137,17,2,130,20,2,43,106,147,153,186,154,144,136,108,139,116,2,13,11,11,151,132,144,8,29,119,133,124,109,30,119,132,149,93,96,95,90,85,88,88,88,88,89,100,40,5,11,26,40,197,182,141,119,185,130,182,154,187,149,158,85,91,85,90,89,91,91,91,90,91,89,91,89,85,88,89,89,91,85,90,86,90,89,91,88,91,91,91,95,90,89,89,90,89,91,90,89,91,89,91,90,85,86,85,91,90,82,86,90,91,91,91,91,91,96,92,91,91,91,90,90,91,91,92,92,91,91,91,91,91,89,91,90,86,90,91,89,85,89,89,89,85,86,90,91,90,85,91,89,92,91,91,90,91,91,91,91,91,91,91,85,91,91,91,92,91,91,92,92,97,98,160,156,98,96,102,92,92,92,96,97,98,97,92,96,96,96,98,98,98,156,161,162,168,169,169,171,173,171,173,169,169,168,162,162,160,161,156,160,156,98,98,98,98,98,103,93,156,98,97,101,98,98,101,97,97,101,98,101,92,96,97,92,97,97,101,102,93,93,101,71, +81,81,56,82,82,81,81,81,83,56,81,81,83,85,81,81,81,81,81,56,81,81,81,85,81,81,81,85,84,84,84,84,84,84,83,85,85,81,88,85,84,85,84,88,85,83,21,26,13,16,106,151,142,143,94,26,9,2,5,2,1,2,1,2,10,2,1,6,10,12,6,106,151,114,2,10,13,5,130,8,2,37,114,2,21,48,153,154,153,145,125,138,132,116,124,7,145,114,17,124,130,148,13,34,124,136,136,30,24,132,134,91,91,91,89,91,89,85,85,84,84,84,84,99,71,72,13,13,181,186,191,121,117,147,149,141,70,87,90,86,90,90,91,91,91,90,92,89,89,90,85,89,89,84,89,88,85,88,90,90,90,89,89,88,89,89,89,85,91,89,88,91,85,91,85,91,85,95,90,85,89,90,90,90,89,85,90,91,91,91,91,90,91,92,91,92,91,91,91,90,91,92,96,92,92,91,91,90,86,92,91,91,90,89,85,89,88,85,85,89,89,89,90,90,91,90,90,90,91,90,91,92,92,91,91,91,92,91,91,91,90,90,91,91,90,79,91,91,92,98,103,98,103,92,92,92,91,92,96,92,96,92,92,92,92,92,92,96,98,98,161,156,162,162,169,169,168,168,168,162,162,162,162,160,159,156,98,98,98,98,98,98,97,97,98,98,103,98,97,97,98,97,97,102,92,101,92,97,101,92,101,102,93,92,97,93,101,102,93,71, +81,81,80,81,81,56,84,82,81,81,81,56,81,81,56,81,81,81,56,84,56,81,81,81,82,81,81,81,82,84,82,82,85,81,85,81,81,81,85,81,81,83,85,81,88,85,59,21,22,32,153,93,71,69,85,6,2,2,2,9,5,1,2,11,2,2,1,2,5,9,21,141,132,21,6,1,2,2,36,113,2,47,37,2,36,120,154,153,145,146,150,31,106,116,15,11,144,145,115,140,133,31,13,36,34,141,22,15,36,69,95,90,91,90,90,85,85,88,88,84,84,84,84,88,90,85,63,64,40,130,180,185,147,67,130,192,90,88,85,91,90,91,89,90,86,91,90,89,91,85,95,89,89,85,89,85,84,88,89,88,89,82,84,84,88,85,89,89,84,89,91,85,90,89,91,90,90,86,85,91,85,91,95,85,86,90,91,91,90,90,89,92,91,96,96,91,91,91,91,91,91,92,92,96,102,91,90,89,91,90,90,85,85,89,89,85,86,89,84,89,84,90,86,89,90,90,89,89,91,91,90,89,86,90,92,91,92,90,91,88,90,86,88,90,89,90,91,91,97,98,98,98,98,96,91,91,92,91,91,92,92,91,91,92,91,91,91,92,98,98,98,98,156,160,169,169,168,162,160,156,160,162,160,98,156,98,97,98,102,93,98,98,97,98,98,97,98,97,98,103,98,97,97,92,92,92,92,92,101,97,97,101,92,97,102,93,97,98,97,71, +81,56,81,81,56,81,81,81,56,82,56,81,56,81,81,81,80,81,81,81,81,85,83,85,85,82,81,85,81,85,84,81,81,81,88,81,88,81,81,81,85,90,81,81,88,88,63,50,85,85,86,84,84,84,80,6,7,2,6,2,2,2,5,1,11,1,2,2,6,10,37,133,181,8,2,6,6,7,43,130,11,45,30,5,30,130,136,136,148,144,140,6,32,124,11,13,136,146,147,116,147,24,34,33,132,29,36,65,64,58,89,89,85,90,89,85,89,88,85,84,84,84,85,90,85,90,86,100,57,11,129,131,77,76,86,86,89,89,90,90,91,85,91,90,91,91,91,89,90,91,85,89,89,89,85,88,84,89,90,85,86,88,88,84,85,86,89,88,89,89,85,91,89,95,89,86,90,90,85,90,89,85,85,91,85,91,85,91,85,91,91,91,91,92,92,91,91,91,91,91,97,96,101,91,91,91,91,90,86,95,91,89,89,89,89,85,85,85,85,88,85,90,85,86,90,86,88,91,85,91,90,90,90,91,85,92,90,86,89,89,85,89,88,90,89,85,91,92,92,92,96,101,92,91,91,91,91,91,91,91,91,91,91,89,90,76,96,91,92,98,98,103,156,156,161,162,160,160,159,103,156,156,103,98,98,97,92,92,92,101,98,98,97,92,96,101,101,97,98,98,98,98,91,91,91,91,91,91,92,101,91,92,92,101,91,92,101,97,92,72, +56,81,82,81,56,81,56,56,81,80,81,81,81,81,56,81,81,84,56,81,81,81,81,81,83,56,85,81,81,85,80,85,81,88,81,81,81,88,81,81,81,81,83,85,81,81,81,88,81,88,85,85,88,85,90,6,2,2,7,2,2,5,2,5,21,34,2,5,1,21,132,140,148,18,22,11,11,10,21,132,11,27,39,10,16,116,136,138,144,122,148,29,29,22,2,30,146,140,136,136,144,130,141,34,151,44,40,95,84,88,90,89,89,89,88,88,88,88,85,88,85,84,88,85,90,91,90,85,91,82,85,85,90,90,85,89,89,89,88,95,90,90,88,91,90,91,90,90,91,85,91,85,84,85,89,85,89,90,85,89,84,89,85,89,85,90,85,89,90,85,90,90,91,89,91,90,85,91,85,91,90,90,91,90,85,89,91,85,91,90,89,92,92,92,92,91,92,92,91,91,91,92,92,91,91,91,91,89,91,85,85,89,84,84,88,88,84,88,82,84,88,85,90,85,85,85,90,90,90,85,89,89,89,89,90,90,90,85,89,89,89,85,86,89,89,90,91,91,91,87,96,91,92,92,85,90,91,91,91,91,91,91,89,79,95,89,86,92,92,92,98,98,103,98,98,98,98,103,98,98,97,98,92,92,92,92,91,91,91,92,96,98,92,96,96,96,96,92,101,92,97,101,97,91,91,91,91,92,91,91,91,92,92,92,92,101,92,97,97,72, +81,81,80,81,81,84,81,81,56,81,81,56,81,56,84,56,82,81,81,81,81,84,81,81,81,83,85,83,81,83,85,81,81,81,83,85,83,81,81,81,81,81,81,81,81,83,85,88,81,81,88,81,88,81,83,11,2,2,9,5,2,2,2,2,5,29,2,2,6,22,139,120,17,124,114,16,11,2,123,190,2,12,9,2,29,106,106,106,136,144,43,29,119,29,11,123,125,142,133,133,116,133,138,110,22,21,58,88,84,84,88,84,88,88,85,84,84,85,88,84,88,89,89,88,89,90,90,82,89,85,88,88,89,88,85,89,90,82,88,88,88,85,90,90,85,90,86,95,90,90,90,85,85,88,88,88,89,90,90,91,85,89,85,90,85,86,90,84,88,90,86,95,89,90,85,91,88,85,91,85,91,91,85,85,89,90,89,89,86,85,90,91,92,91,90,91,91,85,92,91,91,92,96,91,90,91,92,90,89,91,85,86,88,84,84,84,84,84,84,84,82,84,88,90,82,88,88,89,89,85,88,90,89,90,91,85,89,89,88,89,89,85,90,86,89,88,90,90,90,90,86,91,90,89,91,79,90,91,91,91,92,90,92,90,90,90,92,91,91,92,92,96,97,98,101,92,96,92,92,92,101,92,92,91,91,91,86,91,91,91,92,98,96,92,92,92,92,92,91,92,91,92,101,92,92,91,91,91,91,91,91,91,91,91,91,92,92,91,92,71, +56,81,56,81,56,81,56,81,84,81,56,81,81,81,81,81,81,56,82,81,81,81,81,81,81,81,81,81,81,56,81,83,81,81,81,81,81,81,81,56,85,81,81,81,81,81,81,81,83,81,83,81,83,81,99,10,25,6,2,2,2,6,2,2,2,30,2,6,1,36,144,136,132,116,11,15,6,11,16,11,11,11,2,2,11,13,31,46,125,17,33,47,180,43,134,108,109,132,114,149,123,147,46,66,75,57,84,82,84,81,85,84,84,88,84,84,88,88,85,88,88,89,89,85,88,85,88,88,85,88,89,85,90,90,88,85,88,88,85,84,84,88,90,83,90,90,90,88,91,90,89,89,85,88,84,84,88,90,89,85,90,90,85,91,90,90,85,89,90,88,90,90,85,89,88,84,89,90,91,90,89,85,91,90,86,89,90,90,90,90,91,91,92,92,90,92,90,91,90,91,92,92,101,91,91,91,90,86,90,90,90,82,85,84,84,84,84,84,84,82,82,84,84,88,84,84,84,84,88,84,84,88,90,86,90,89,89,89,89,84,85,88,85,89,89,89,90,85,91,90,90,85,91,90,90,91,90,90,92,90,92,85,91,85,91,89,79,90,91,91,92,97,92,92,92,92,91,91,92,92,92,92,91,91,91,91,91,91,91,91,92,96,92,92,91,91,91,91,91,91,91,91,92,92,86,91,86,91,91,92,92,91,91,91,91,91,91,91,91,62, +81,56,82,56,81,56,81,56,56,81,81,80,56,82,56,82,84,81,56,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,83,84,81,81,83,81,81,81,81,81,81,81,90,1,2,9,2,5,9,2,2,2,12,119,17,2,5,117,147,116,122,8,15,24,17,13,29,10,2,12,9,5,21,17,29,47,110,14,134,24,34,138,46,29,33,151,144,144,119,116,35,91,82,56,81,81,88,81,81,83,84,81,88,84,81,88,84,84,88,84,88,84,84,84,84,88,88,88,88,88,89,89,85,89,89,88,84,85,81,90,81,88,85,90,81,88,85,90,85,88,85,88,85,85,90,89,90,88,89,89,90,90,86,85,88,90,81,88,88,89,85,84,85,84,84,88,90,85,91,90,89,85,90,90,90,85,86,88,91,85,90,86,91,91,90,91,85,90,86,92,96,91,90,86,90,90,90,85,85,85,88,82,84,88,85,82,84,85,84,84,84,88,85,84,84,84,84,84,84,84,89,85,90,90,86,89,89,89,89,89,84,89,89,89,89,85,86,89,89,89,85,89,85,90,86,91,82,91,89,95,89,91,89,95,89,91,91,91,92,92,91,91,91,91,91,91,87,92,91,91,91,91,91,91,91,91,91,91,96,96,92,91,91,90,91,91,91,91,91,91,92,92,91,91,91,91,92,92,91,91,91,91,92,91,92,91,91,58, +56,81,80,82,81,81,56,84,81,56,81,81,81,81,81,81,56,84,82,84,81,81,81,81,81,81,56,84,81,81,81,81,81,81,81,81,81,81,80,81,81,81,81,81,81,81,81,81,81,81,81,81,83,81,83,2,5,9,2,2,2,21,6,6,2,43,126,3,2,30,17,34,29,2,15,127,127,125,109,10,13,2,2,2,7,106,140,133,21,21,106,142,146,151,109,10,37,151,140,36,48,74,57,83,81,80,81,84,81,81,81,81,81,81,81,88,88,84,81,81,88,85,85,88,85,88,84,84,84,84,84,84,88,89,90,88,88,85,84,88,85,81,88,81,85,81,88,85,88,88,88,81,88,85,81,88,88,85,88,85,88,90,88,90,90,88,85,81,88,85,88,85,88,81,84,84,88,91,85,91,90,89,91,90,85,88,85,85,89,88,90,90,91,90,90,91,85,89,89,90,90,90,96,90,92,91,85,91,90,89,89,88,88,85,84,81,88,81,85,81,88,81,84,82,84,84,84,84,84,84,84,88,90,89,86,89,85,89,89,89,90,89,89,89,89,89,86,88,85,85,89,89,85,86,90,90,85,91,91,90,90,86,95,85,91,89,92,85,91,91,91,91,91,91,89,91,91,91,91,91,91,91,91,91,91,92,91,92,96,92,92,92,92,92,91,79,89,91,91,91,91,86,91,91,91,91,91,92,91,91,91,91,92,91,91,87,91,91,91,58, +81,81,81,81,56,56,81,56,56,84,56,81,84,56,81,81,56,81,81,56,81,81,80,81,81,56,81,56,81,81,81,81,81,80,82,81,81,81,81,81,81,81,81,81,84,56,81,81,81,80,81,81,81,81,88,26,9,9,5,2,10,21,11,2,2,22,138,15,10,30,129,6,2,2,24,125,128,124,126,109,106,106,6,6,48,149,138,130,30,21,109,122,181,182,8,5,119,136,33,50,63,81,81,81,80,81,81,81,81,81,81,81,81,81,89,81,81,81,83,88,88,81,81,81,81,85,81,84,85,88,85,84,84,88,88,84,84,85,83,85,88,85,88,85,85,88,81,81,88,85,88,85,83,85,81,81,81,83,88,88,85,83,85,88,81,81,81,81,81,81,81,88,81,88,85,85,84,88,90,89,90,90,84,84,85,88,90,81,84,84,89,89,89,90,86,85,90,89,90,85,90,91,88,91,89,90,91,85,86,89,84,84,84,84,84,81,81,81,83,85,80,85,84,84,84,84,84,84,84,84,84,84,89,88,85,90,89,89,90,89,88,85,89,89,89,90,85,91,90,91,85,89,85,90,86,91,90,89,92,85,86,90,90,91,90,89,85,89,91,91,91,91,79,90,79,90,90,91,91,91,91,91,86,92,92,92,92,92,91,92,92,92,91,91,91,91,91,91,92,91,91,91,86,91,91,91,91,91,92,92,92,91,91,91,91,91,91,91,86,58, +56,81,56,82,81,84,81,56,81,81,56,81,56,81,80,82,81,81,56,56,84,81,81,81,84,81,56,82,81,81,82,81,81,81,56,81,56,56,81,81,81,81,81,81,81,81,80,81,80,81,80,81,81,81,56,81,6,10,7,9,12,7,9,11,2,12,21,10,12,21,13,11,5,11,116,132,145,115,123,46,130,109,21,119,116,116,43,46,26,21,130,137,184,118,2,6,106,132,60,81,81,81,81,81,80,81,81,83,81,81,81,81,81,81,81,81,81,84,81,81,81,81,88,81,81,88,81,85,83,82,84,81,85,84,84,82,88,88,85,81,81,81,81,85,83,81,81,81,81,81,81,81,88,81,81,81,81,81,83,81,81,81,90,80,81,81,81,81,81,81,81,81,81,81,88,81,88,85,85,88,85,88,85,84,84,84,81,85,84,81,88,89,89,90,90,89,84,88,85,89,91,88,89,85,91,90,85,90,85,89,89,88,84,84,81,88,81,81,81,81,88,84,84,84,85,84,81,82,84,82,84,84,84,89,89,88,85,86,88,89,86,89,86,89,90,85,85,89,90,86,91,89,90,90,91,91,86,91,82,91,90,91,85,91,91,90,90,85,90,90,91,91,90,90,90,91,91,91,91,91,91,91,91,86,91,91,92,91,92,92,91,91,91,91,91,91,91,82,91,86,91,91,91,91,91,91,91,91,91,92,91,91,91,91,91,91,86,86,95,57, +81,81,84,56,81,56,84,81,81,56,81,56,81,56,81,81,56,81,81,56,81,81,56,56,81,56,81,81,80,80,56,81,81,81,81,80,82,80,82,56,81,81,80,80,80,61,81,81,81,81,81,81,80,81,80,99,10,2,10,2,2,29,32,2,6,9,27,10,2,5,10,13,10,11,119,116,122,116,111,21,47,18,110,120,106,181,144,45,39,26,30,181,138,8,2,21,149,66,58,81,81,80,81,81,81,81,81,84,80,81,80,81,81,81,81,81,83,81,81,81,83,81,81,88,81,81,88,81,81,90,84,83,81,85,88,85,81,81,81,88,81,88,88,81,83,85,88,80,81,81,81,81,81,81,83,80,56,81,81,81,81,83,81,81,81,83,80,81,81,85,81,81,83,81,81,83,85,83,89,88,88,89,85,84,84,88,81,85,88,85,84,88,88,88,85,88,85,88,85,88,84,88,85,84,88,91,88,88,85,88,85,84,84,81,84,85,81,81,81,81,85,81,84,84,84,85,85,84,84,84,82,84,84,88,82,90,89,89,85,91,85,85,90,90,89,86,91,91,91,91,90,79,91,91,91,90,91,90,89,91,90,86,92,91,91,91,90,90,86,91,91,91,91,91,91,90,90,91,91,91,86,91,91,91,91,91,92,92,92,92,91,91,91,91,91,86,91,91,86,91,91,91,91,91,91,91,92,91,92,86,91,91,86,90,91,91,92,90,89,58, +81,56,56,81,56,81,81,81,56,82,56,56,56,81,81,61,81,56,84,56,81,56,81,56,81,81,81,56,81,81,81,81,81,81,80,56,56,61,83,82,56,82,80,80,82,56,56,80,82,80,81,80,81,80,81,81,54,2,2,9,10,17,106,17,2,6,5,5,2,62,40,15,11,9,6,46,138,147,109,11,141,32,138,46,141,132,119,46,11,2,29,132,141,11,2,22,77,81,81,80,81,81,80,80,81,80,80,61,81,81,81,80,81,80,81,81,80,84,81,81,81,81,81,90,83,81,81,81,81,81,81,81,81,84,81,81,81,88,81,88,85,88,81,81,81,81,83,85,83,85,81,81,81,81,81,81,81,81,80,81,81,81,83,81,81,83,81,81,83,81,83,85,81,81,81,81,81,81,81,88,88,85,88,85,88,81,81,81,85,81,88,84,84,84,84,88,85,84,84,81,84,84,84,84,89,90,89,85,84,84,84,84,84,84,84,80,81,88,81,81,81,88,84,82,88,82,88,85,89,89,84,84,84,84,89,88,89,85,91,85,92,91,90,91,86,90,91,91,91,91,91,91,91,91,91,86,90,86,91,91,91,92,91,101,96,92,92,92,92,92,92,92,91,91,91,86,91,86,90,79,90,91,91,86,92,91,91,91,92,91,91,91,91,91,91,91,91,91,91,91,91,91,92,92,91,91,91,91,91,91,90,89,86,91,90,86,86,86,91,58, +56,84,82,81,82,81,56,81,56,80,81,56,82,56,56,80,61,80,56,81,81,56,82,81,56,80,56,82,56,81,56,81,56,80,56,80,80,80,56,80,80,80,81,80,80,80,80,81,80,80,61,81,81,81,81,81,81,6,9,5,5,43,130,136,6,53,26,54,2,2,2,18,22,2,6,36,136,126,118,13,141,34,120,43,136,136,134,30,26,2,141,119,29,2,117,187,80,80,61,81,80,81,81,81,81,81,81,80,80,81,81,80,80,61,83,81,81,81,81,81,81,81,81,81,81,81,81,81,88,81,88,81,81,81,81,81,81,81,90,80,81,81,81,81,81,81,81,83,81,81,83,85,81,81,81,80,81,81,80,80,81,83,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,88,85,88,81,88,81,81,85,83,81,81,85,88,84,84,84,84,88,85,84,88,82,84,84,84,85,90,89,84,84,84,84,84,84,81,84,81,81,81,88,81,84,81,84,82,84,88,85,85,84,89,84,85,84,84,84,89,89,90,90,86,90,91,89,92,91,91,91,91,91,91,92,91,91,91,91,91,91,92,91,91,92,92,92,92,96,92,92,92,91,92,92,91,91,91,91,91,91,91,90,90,90,86,91,91,91,90,86,91,91,91,91,91,91,91,91,91,91,91,91,91,92,92,91,91,91,91,91,91,89,91,90,91,86,90,89,91,89,90,85,62, +56,81,81,80,56,56,56,81,56,61,56,80,56,56,82,56,81,56,56,63,80,80,56,56,63,80,56,61,63,81,80,61,80,80,61,80,56,80,61,81,80,80,61,81,80,56,80,61,81,80,80,56,80,61,81,80,81,51,2,2,9,46,123,136,42,88,82,83,2,6,2,29,111,112,16,116,133,182,111,29,132,119,130,139,46,43,48,197,147,122,49,120,32,26,78,80,56,81,80,56,80,81,61,83,56,80,82,80,56,83,80,80,83,80,61,56,81,81,81,81,81,81,81,81,81,80,80,81,81,81,81,84,81,81,83,81,81,81,83,88,83,81,81,85,81,81,85,81,83,81,81,81,81,83,81,80,81,81,81,56,80,81,56,81,81,81,81,81,81,83,81,81,81,81,56,81,81,81,81,81,81,88,81,81,81,81,83,81,88,82,84,84,84,85,84,84,88,84,81,84,81,84,84,84,88,85,84,84,82,84,82,81,81,84,81,81,56,81,81,85,81,84,84,84,84,84,88,88,85,85,84,84,85,89,85,85,91,90,91,82,91,90,91,90,90,91,90,91,91,91,86,91,90,91,91,91,92,91,92,91,92,92,92,92,92,91,91,92,92,92,101,92,96,93,92,92,96,91,91,86,91,90,90,92,86,79,91,95,90,91,91,90,86,91,91,91,91,91,87,92,91,92,91,92,91,91,91,91,91,90,79,89,85,86,91,86,89,91,85,58, +81,56,56,56,82,56,81,56,81,56,80,56,82,56,56,80,82,56,61,56,56,63,80,56,61,80,56,80,80,56,56,81,80,56,80,80,80,56,80,80,56,80,56,80,80,80,56,56,80,80,56,80,80,56,80,80,61,83,26,2,2,129,124,132,77,80,80,85,26,1,2,5,29,18,132,32,110,141,114,47,138,32,70,138,120,44,193,134,176,180,17,130,82,81,80,80,80,56,80,82,80,56,80,80,80,80,80,80,80,81,56,81,83,80,80,81,83,81,81,80,81,81,81,81,81,81,80,81,80,81,81,56,84,81,81,81,81,81,83,81,90,83,81,83,81,83,81,81,83,81,81,81,81,81,83,81,81,81,81,83,81,56,84,81,80,81,81,81,81,81,81,80,56,82,81,80,81,81,81,88,81,84,81,56,81,81,81,81,84,84,84,84,88,88,84,84,84,84,84,81,88,85,84,84,84,84,88,84,81,84,81,84,82,81,84,81,81,81,83,81,85,84,84,84,82,84,84,84,84,84,88,84,85,82,89,89,89,89,85,90,85,85,89,85,89,89,90,91,90,90,89,91,91,92,90,91,86,86,92,91,91,91,91,91,91,79,91,91,91,92,92,92,97,96,92,97,92,92,91,91,89,86,92,90,90,85,85,90,85,86,85,90,90,91,85,91,91,91,91,91,92,91,91,91,86,91,91,79,91,90,90,91,91,89,91,89,92,90,85,58, +81,82,81,81,81,56,56,56,56,84,56,80,56,81,56,56,56,56,56,80,56,56,56,80,80,56,56,56,81,80,80,56,56,80,80,56,81,80,80,56,80,80,80,80,56,81,80,80,56,80,80,81,80,80,80,56,80,80,81,11,5,119,133,157,80,80,81,81,54,29,1,12,2,43,123,120,120,126,29,119,69,61,29,192,188,130,132,129,120,43,58,56,80,81,80,80,56,80,80,80,81,80,81,80,56,81,80,80,56,56,81,80,80,81,81,81,81,81,80,81,81,80,81,81,80,81,80,81,81,80,81,83,81,81,84,81,81,81,81,81,83,81,81,81,81,81,81,81,83,81,83,80,81,81,81,81,56,81,81,81,80,83,81,80,81,81,81,81,81,81,81,81,81,80,81,81,80,81,82,80,81,81,81,81,81,81,81,81,81,88,84,84,84,84,82,84,84,84,88,81,81,81,88,84,84,84,81,82,81,84,81,81,81,81,84,81,81,81,81,81,81,84,81,81,84,84,84,84,84,85,84,84,88,88,89,84,84,88,89,88,84,85,84,88,82,89,89,85,90,89,90,91,90,86,91,91,90,86,86,92,91,90,91,91,91,91,90,91,91,91,92,92,92,96,96,96,96,91,91,91,91,90,85,86,89,89,90,91,90,82,91,85,86,86,90,91,91,91,91,91,91,87,92,91,91,91,86,95,90,90,79,89,90,90,90,91,89,91,82,57, +82,82,81,84,82,56,82,81,81,56,56,56,56,56,81,56,80,56,56,56,56,56,80,56,56,80,56,56,56,56,56,80,56,80,56,80,56,80,56,80,56,56,80,56,80,56,80,56,80,56,80,56,56,80,56,80,56,80,56,56,38,67,72,56,80,56,56,81,56,35,141,33,2,10,45,132,144,141,64,82,80,56,80,52,38,65,65,85,58,80,56,80,56,80,56,81,80,56,80,56,80,56,80,56,80,56,80,56,80,56,80,56,81,80,80,81,80,83,80,81,81,81,81,81,81,80,81,80,83,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,80,81,81,81,81,81,80,81,81,80,81,81,80,81,81,81,83,80,80,81,80,81,81,81,81,80,81,80,81,81,81,81,88,84,81,81,88,81,82,81,84,82,82,81,81,81,81,81,88,84,84,82,84,81,84,81,81,81,81,81,81,81,81,81,81,81,81,88,81,84,81,88,84,84,84,84,84,84,84,88,84,84,84,88,85,84,84,84,84,84,84,84,89,84,89,89,85,90,90,90,85,91,90,91,89,92,79,90,91,91,91,91,91,91,91,91,92,92,92,92,92,91,91,91,91,90,86,85,89,85,86,85,86,91,89,85,90,85,90,91,82,86,91,90,91,91,91,91,91,91,91,91,91,79,91,90,91,79,90,91,79,90,91,89,58, +82,81,82,81,81,56,81,56,56,56,81,56,81,56,56,56,56,80,80,80,56,80,56,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,56,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,80,6,14,28,39,133,149,157,80,80,80,56,80,80,81,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,80,81,80,81,83,80,80,56,80,80,81,83,56,81,80,81,80,81,81,83,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,80,80,80,81,81,80,81,81,81,56,83,80,56,80,83,56,83,81,80,80,81,81,81,83,81,80,81,81,81,81,81,80,81,81,81,81,81,81,84,81,81,84,84,81,84,84,84,81,81,81,81,81,84,84,84,84,81,84,81,84,81,81,82,81,81,81,81,56,81,81,81,81,81,81,84,81,84,81,82,81,82,84,84,81,81,84,82,84,84,84,84,84,84,84,84,84,84,84,84,84,89,89,90,89,89,85,89,90,90,90,90,90,91,90,91,90,90,91,91,92,92,92,91,92,91,91,91,90,90,90,90,90,85,90,89,89,90,85,89,89,85,89,85,89,90,90,85,91,90,86,90,90,86,90,85,86,90,85,85,90,90,90,90,86,90,90,90,90,58, +}; + +MWIMAGEHDR image_rle8 = { + 320, 200, /* width, height*/ + 1, 8, /* planes, bpp*/ + 320, 1, /* pitch, bytesperpixel*/ + 1, 256, /* compression, palsize*/ + -1L, /* transcolor*/ + palette, + imagebits, +}; diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/stdpal4.bmp b/packages/services/gfx/mw/current/src/mwin/bmp/stdpal4.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c28fb4ff5b788d37312045e7ae726ec450cca1e5 GIT binary patch literal 11974 zc%1FhF%AJi7{&3Cs3oqTQaOZZB^p<71lldNN{JJ=f@Uj~s5P$O3gf-mm57!vLH=*{ z+nN1l=2z`_dK{&arD~|!sCKGO>X!aY`{!OtmtJ~FRi0E;&E%m)UDul3$>m8oH;+6=mf%SXfwCzh>P57BAew diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/tux.gif b/packages/services/gfx/mw/current/src/mwin/bmp/tux.gif new file mode 100644 index 0000000000000000000000000000000000000000..30c93d9def3defd2e82d30cfcdc3fd776f569ce8 GIT binary patch literal 3064 zc$^iMdsI_*632hYMScXSH#I;&C^r}-2-tu?gFH;aD@2s5q6CXJptupKM!=d?T(1T& zC}>2)pllluB?@RjYNHEoM9_e-M11sWtsC)m*#$SCZli5+)A?)WoS8G9@64HVCN(XE z7n6&Fb>I~MIyq`HF?0liA_&d{V`d(TA~p*{CIWgDVk0ri%)z-prvNe$w5U;>3$4v4 zApv%hYd7(<1Y+rOq@f%pLN=o|Ge+uwOeWKn`WaM+QH5%&N(c!Qalvyl)=b2SxKNso zyd`l;k4mM|W)&ji1F2MEBv6crlt>VrPG>a$0tYgjYa^LDotD5Mh9X+6_U%0ppNmL% zK*|RS97rS*8_AQ)~CLhS}O=tRz1|n91i61c$5xMI*8-A0*7`IlW-A@M#JTD34+k+^jevNc>~#n zm{dTqLTvy0ZeMZWHRj}!>9sQOBF>? zTA5=JfFwzs99mS+W`bHNG^!DugV_S*I6`VrVgsU3DD(tkQbVhiv|6n;5~3(ds!=`% z@HtScZL5-UEgDA)_`Dm{NF6eH77Zjd079UaAQ*;`YN%HL2oSy8F)pZ(ODz_Q3`cA> z%0`Xp6%LJY5W>FZ5>gBJJhq5~SapEMK}ap+VTjRaw3{8Mkj-YQWC*1Plm&KI#hFwN z?U15uIt8Tk&_qD14q|>Nsex7_LJ$o$J*rh8Hi`^oBPtxRldwyJP-Y+!;Rb`jW`HC~ z*^JPxhola2IQ+~c#GrtEUCowegfc>t$wanA)|Mc49kdxxy8-RfI$*2-0J{;|Y__-E zDga6yk;7P1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.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c9aed392104a8fe8dce0ee16a3bab671e88fc198 GIT binary patch literal 5454 zc%03cv69?23_!8NbZlDTU?*XBmbaPEG z0ZhW;$T!cKFHJp0z;;TD2CagA7cJix9WNXN$q^g|)R7PL#z}BXC~m^~7UX))ZM^yg z`7=--li-7#66Aoa75ELelx``Q9Vl)OdX-XDm0MHbsYD|-jruL}c!hJ0%+5hTi@6iP zjOE?2+(-h^rYQA|uV*o@o-iJNVzDtO*IeGfViA|p^j^c4Smo#8b9s}aa`H8Qx3+>jh z=WHn?6A=u~M-%rvpcAJUYx5{4G|sZ;R22%OoFKQ3oPe-$;=;*QZ{|$ODfgF|(*<;t zn4`o!uSA|R&78_dbi}!#apD%*<5od3+~LHLj58-FXVhn5;)KQA|4ZD{*5Wx;xZ_N! zuAv(ys_~7ph*6m_?{U%*CpFH{9*{UJG&Nk1?Sw=kZj8hsewz+YMCqBT*Hcijx#TM$z(^82XC!4v{A&Y14YzLey(jwOL zcX~drbMoVzXU^Z$LRZdwzg)AO3{YT#Y`#SfU~WK_MCm4AoK4zA8n!EoMe0Q@dT}&r|UkOfK|d+_emNEC$jb( z&eB{IR6{xYx=-d`I3G;h<4QEIZ!Io-(hDW**73n^46?Vdb-boQUECJgYN3RhcR)S; zJEtyV>owKDv|qTN6+J(%}pV4j;OTtIt9UT>k%)MYzt^KhH69rV~|_jLl-s~obp;cwHjO?rm3 za5i_f4pW2qlpAL<&auyy)QLOJYc168Ip<3B%fAmD{7mvw$IvnD1M}UrO0FKP9UKLI0vw6IO zvX0cC>S}k46B4IN1>+iS?J>ypA2+!OnGfM>s2qaIfR-$iWb$cBz==*VV+qh`r<)Ht>yGP3H3s0ccM0|Xtw0fG+T06_y5{AD;tU4kpf)3ySK?iVvpaVES&;cAE Ef2}LwUjP6A diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/win/chkbox.bmp b/packages/services/gfx/mw/current/src/mwin/bmp/win/chkbox.bmp new file mode 100644 index 0000000000000000000000000000000000000000..7517a6e1d455c1a37014c481f8c1cf875e25c70d GIT binary patch literal 1618 zc${pF diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/win/radio.bmp b/packages/services/gfx/mw/current/src/mwin/bmp/win/radio.bmp new file mode 100644 index 0000000000000000000000000000000000000000..01a19103109a660cf50a49c15bbd9586acd4ffad GIT binary patch literal 1006 zc${aDXf@#P$700>tTqsJ)K_u_ ztQOe}G_4r=fHCtQ1K`z%rU??exU}NXhnz6zp^p@Ik{d2?eP~+YBDnQIw8C{m07L{$ Q8IE+;fCR8AAU|CL09@ajVgLXD diff --git a/packages/services/gfx/mw/current/src/mwin/bmp/win/radio2.bmp b/packages/services/gfx/mw/current/src/mwin/bmp/win/radio2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..7a93eef93eef14d0fef0ebb91786b1158351d842 GIT binary patch literal 5718 zc%1E+!41MN3`NZnh$BZPU;ysr$UKbJO&FzE4MLyTAe_d~Sb0*aG))>m)s32-hRc>_ zj$960&Rlj}HuI5a|G18fcCJ9d@PAR{+9=&MCfzkAZmv}p{MsQE44Q!20XbrHO@24v zow0nP@>KS>hHt`hd;W4jKlGNmQYEX)7H^EM9MmMRy2_T7xn`m%pE&{6F%cLtxXGaSeu#Dx*xwe4#`FKpKmUINy8ZKS2Emi?_`NU) z?!jXiH28!6I~d$TzGsa_(8)5mci?^k?x%uYuNU+>Pr)PJPXteOI>A%${HfkE!Bfw` z{i)~R5$;dHXV2jM6x?5g*JpyKo?8r_fzO_K{#5YH$rs@9Oz_-OJ-9y;JO{sh?)m3} z=bk$WkEh`NV({EaxSv>r$Hn0JlPBQ*Lh$?xi@}NKo(fLDc22)n9!~`)PQ4hM zIB_O8@dDgW!FOI*4o;j|4o;pt6`XwGh2YflPX*Ub_JT9dKNBp%ef8us!3U?F30^$; zT(AuHQ_nvioI3G5eCPRK`2~1{`zhGx^uPLVgBM}jFTVJ%ga7fx#bEKpGr@~zUWMWbpa57vO#-`22%2!EauC zF8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J!AJV}5x71t&o0e-q2h{vkiZkXWcd*j{Nr|8aHb z_4hu+H{Z}}6+726D9M$dA=m!<>+if1Jj?d+d58Y~Nugx;1^xcfy}gXqOHliWy50_J z5isN;{{Q|qn*M+<@bXuLeVz6Pr6I8`2Lln7!(h=YcA*nc+A#!h1)_$)N|Cc*_o0_6 z-9SK0oZ%;O7NZAAJeI``F>`Gj+{=&uYFpbby{g{tey>pdt+zwa|KHBYIkw~Q5Ch{M zQ1p5g(7 +#include +#include +#include + +namespace MicroWindowsObjects +{ + + static Application *the_application = 0; + + WindowClass::WindowClass () + { + wclass.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW; + wclass.lpfnWndProc = 0; + wclass.lpfnWndProc = 0; + wclass.cbClsExtra = 0; + wclass.cbWndExtra = 0; + wclass.hInstance = 0; + wclass.hIcon = 0; + wclass.hCursor = 0; + wclass.hbrBackground = 0; + wclass.lpszMenuName = 0; + wclass.lpszClassName = 0; + } + + WindowClass::WindowClass (LPCSTR lpszClassName, + UINT style, + int cbClsExtra, + int cbWndExtra, + HINSTANCE hInstance, + HICON hIcon, + HCURSOR hCursor, + HBRUSH hbrBackground, + LPCSTR lpszMenuName) + { + wclass.style = style; + wclass.lpfnWndProc = (WNDPROC) Window::WndProc; + wclass.cbClsExtra = cbClsExtra; + wclass.cbWndExtra = cbWndExtra + sizeof (Window *); + wclass.hInstance = hInstance; + wclass.hIcon = hIcon; + wclass.hCursor = hCursor; + wclass.hbrBackground = hbrBackground; + wclass.lpszMenuName = lpszMenuName; + wclass.lpszClassName = lpszClassName; + } + + ATOM WindowClass::register_class () + { + return RegisterClass (&wclass); + } + + Window::Window () + : hwnd (0) + { + } + + Window::Window (DWORD dwExStyle, + LPCSTR lpClassName, + LPCSTR lpWindowName, + DWORD dwStyle, + int x, + int y, + int nWidth, + int nHeight, + HWND hwndParent, + HMENU hMenu, + HINSTANCE hInstance, + LPVOID lpParam) + : hwnd (0) + { + create (dwExStyle, + lpClassName, + lpWindowName, + dwStyle, + x, y, nWidth, nHeight, + hwndParent, + hMenu, + hInstance, + lpParam); + } + + Window::~Window () + { + destory (); + } + + HWND + Window::create (DWORD dwExStyle, + LPCSTR lpClassName, + LPCSTR lpWindowName, + DWORD dwStyle, + int x, + int y, + int nWidth, + int nHeight, + HWND hwndParent, + HMENU hMenu, + HINSTANCE hInstance, + LPVOID lpParam) + { + lpCreateParams = lpParam; + + lpParam = (LPVOID) this; + + hwnd = ::CreateWindowEx (dwExStyle, + lpClassName, + lpWindowName, + dwStyle, + x, y, nWidth, nHeight, + hwndParent, + hMenu, + hInstance, + lpParam); + return hwnd; + } + + BOOL + Window::destory () + { + if (hwnd) + { + HWND old_hwnd = hwnd; + hwnd = 0; + return ::DestroyWindow (old_hwnd); + } + return 0; + } + + bool + Window::attach (const int fd, FileDescriptor& file_descriptor) + { + // + // The user must set the fd before being added to the set. + // + + if ((fd < 0) || (fd >= FD_SETSIZE) || (file_descriptor.file_desc != -1)) + return false; + + // + // If this fd is already taken do not add another. + // + + file_descriptor.file_desc = fd; + file_descriptor.window = this; + + if (file_descriptors.find (&file_descriptor) != file_descriptors.end ()) + { + file_descriptor.file_desc = -1; + file_descriptor.window = 0; + return false; + } + + file_descriptors.insert (&file_descriptor); + + return true; + } + + bool + Window::detach (FileDescriptor& file_descriptor) + { + // + // The user must set the fd before being added to the set. + // + + if ((file_descriptor.fd () < 0) || (file_descriptor.fd () >= FD_SETSIZE)) + return false; + + // + // If this fd is already taken do not add another. + // + + if (file_descriptors.find (&file_descriptor) == file_descriptors.end ()) + return false; + + file_descriptor.disable_read (); + file_descriptor.disable_write (); + file_descriptor.disable_except (); + + file_descriptors.erase (&file_descriptor); + + file_descriptor.file_desc = -1; + file_descriptor.window = 0; + + return true; + } + + struct eq_fd + { + const int fd; + eq_fd (const int fd) : fd (fd) {} + bool operator() (const FileDescriptor* f1) const + { return (f1->fd () == fd); } + }; + + LRESULT + Window::message_handler (UINT msg, + WPARAM wp, + LPARAM lp) + { + switch (msg) + { + case WM_FDINPUT: + case WM_FDOUTPUT: + case WM_FDEXCEPT: + + { + // + // The iterator provides a reference to the object pointer + // as the set contains pointers. + // + + set::iterator file_descriptor; + + file_descriptor = find_if (file_descriptors.begin (), + file_descriptors.end (), + eq_fd ((int) wp)); + + if (file_descriptor != file_descriptors.end ()) + { + switch (msg) + { + case WM_FDINPUT: + return (*file_descriptor)->read (); + + case WM_FDOUTPUT: + return (*file_descriptor)->write (); + + case WM_FDEXCEPT: + return (*file_descriptor)->except (); + } + } + } + break; + + default: + break; + } + + return ::DefWindowProc (hwnd, msg, wp, lp); + } + + bool + Window::ltint::operator () (const FileDescriptor* f1, + const FileDescriptor* f2) const + { + return f1->fd () < f2->fd (); + } + + LRESULT CALLBACK + Window::WndProc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) + { + int offset = GetClassLong (hwnd, GCL_CBWNDEXTRA) - sizeof (Window *); + Window *window = 0; + + if (msg == WM_CREATE) + { + LPCREATESTRUCT cs = (LPCREATESTRUCT) lp; + + window = dynamic_cast((Window*) cs->lpCreateParams); + + if (window) + { + window->hwnd = hwnd; + SetWindowLong (hwnd, offset, (DWORD) window); + cs->lpCreateParams = window->lpCreateParams; + } + } + else + { + window = dynamic_cast((Window*) GetWindowLong (hwnd, offset)); + } + + if (window) + return window->message_handler (msg, wp, lp); + + return ::DefWindowProc (hwnd, msg, wp, lp); + } + + Paint::Paint (HWND hwnd) + : hwnd (hwnd), + draw_3d (false), + drawing (false), + r (0, 0, 0, 0), + text_format (0) + { + } + + Paint::Paint (HWND hwnd, LPARAM lpParam) + : hwnd (hwnd), + draw_3d (false), + drawing (false), + r (0, 0, 0, 0), + text_format (0) + { + POINTSTOPOINT (pt, lpParam); + } + + Paint::~Paint () + { + end (); + } + + void + Paint::begin (bool init_3d, bool draw_3d_in_mem) + { + if (!drawing && hwnd) + { + hdc = ::BeginPaint (hwnd, &ps); + + r.get_client (hwnd); + + if (init_3d) + initialise_3d (draw_3d_in_mem); + + drawing = true; + } + } + + void + Paint::end () + { + if (drawing) + { + paint_3d (); + + ::EndPaint (hwnd, &ps); + + drawing = false; + } + } + + int + Paint::text_out (int x, int y, const char *format, ...) + { + Rect rect (x, y, x + 100, y + 100); + va_list arg; + + va_start (arg, format); + vsnprintf (format_buf, TEXT_BUF_SIZE, format, arg); + format_buf[TEXT_BUF_SIZE - 1] = '\0'; + + return ::DrawText (hdc, format_buf, -1, rect, text_format); + } + + FileDescriptor::FileDescriptor () + : file_desc (-1), + window (0) + { + } + + FileDescriptor::~FileDescriptor () + { + if (window) + window->detach (*this); + } + + bool + FileDescriptor::enable_read () + { + if (!read_is_enabled && window && (file_desc != -1)) + { + ::MwRegisterFdInput (*window, file_desc); + read_is_enabled = true; + return true; + } + return false; + } + + bool + FileDescriptor::disable_read () + { + if (read_is_enabled && window && (file_desc != -1)) + { + ::MwUnregisterFdInput (*window, file_desc); + read_is_enabled = false; + return true; + } + return false; + } + + + bool + FileDescriptor::enable_write () + { + if (!write_is_enabled && window && (file_desc != -1)) + { + ::MwRegisterFdOutput (*window, file_desc); + write_is_enabled = true; + return true; + } + return false; + } + + bool + FileDescriptor::disable_write () + { + if (write_is_enabled && window && (file_desc != -1)) + { + ::MwUnregisterFdOutput (*window, file_desc); + write_is_enabled = false; + return true; + } + return false; + } + + bool + FileDescriptor::enable_except () + { + if (!except_is_enabled && window && (file_desc != -1)) + { + ::MwRegisterFdExcept (*window, file_desc); + except_is_enabled = true; + return true; + } + return false; + } + + bool + FileDescriptor::disable_except () + { + if (except_is_enabled && window && (file_desc != -1)) + { + ::MwUnregisterFdExcept (*window, file_desc); + except_is_enabled = false; + return true; + } + return false; + } + + LRESULT + FileDescriptor::read () + { + return 0; + } + + LRESULT + FileDescriptor::write () + { + return 0; + } + + LRESULT + FileDescriptor::except () + { + return 0; + } + + Application::Application () + : background (0) + { + if (!the_application) + the_application = this; + } + + Application::Application (MWIMAGEHDR& background) + : background (&background) + { + if (!the_application) + the_application = this; + } + + Application::~Application () + { + } + + int + Application::initialise () + { + return 0; + } + + int + Application::shutdown () + { + return 0; + } + + int WINAPI + Application::WinMain (HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nShowCmd) + { + if (the_application) + { + int result; + + MwRegisterButtonControl (0); + + result = the_application->initialise (); + + if (result) + return result; + + // + // Set background wallpaper + // + + if (the_application->background) + MwSetDesktopWallpaper (the_application->background); + + MSG msg; + + // + // type ESC to quit... + // + + while (GetMessage (&msg, 0, 0, 0)) + { + TranslateMessage (&msg); + DispatchMessage (&msg); + } + + result = the_application->shutdown (); + + if (result) + return result; + + return 0; + } + + return 1; + } + +}; + +// +// Global Microwindows WinMain () routine with "C" linkage +// + +extern "C" +{ + int WinMain (HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nShowCmd) + { + return MicroWindowsObjects::Application::WinMain (hInstance, + hPrevInstance, + lpCmdLine, + nShowCmd); + } +}; diff --git a/packages/services/gfx/mw/current/src/mwin/winclip.c b/packages/services/gfx/mw/current/src/mwin/winclip.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winclip.c @@ -0,0 +1,7 @@ +#include "device.h" + +#if DYNAMICREGIONS +#include "winclip2.c" +#else +#include "winclip1.c" +#endif diff --git a/packages/services/gfx/mw/current/src/mwin/winclip1.c b/packages/services/gfx/mw/current/src/mwin/winclip1.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winclip1.c @@ -0,0 +1,398 @@ +/* + * Copyright (c) 1999 Greg Haerr + * Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + */ +#include "windows.h" +#include "wintern.h" + +/* + * Macro to distinguish cases of clipping. + */ +#define GAPVAL(leftgap, rightgap, topgap, bottomgap) \ + (((leftgap) << 3) + ((rightgap) << 2) + ((topgap) << 1) + (bottomgap)) + +static BOOL MwExcludeClipRect(int minx,int miny,int maxx,int maxy,int *count, + MWCLIPRECT *cliprects); +static int MwSplitClipRect(MWCLIPRECT *srcrect, MWCLIPRECT *destrect, + MWCOORD minx, MWCOORD miny, MWCOORD maxx, MWCOORD maxy); + +/* + * Set the clip rectangles for a window taking into account other + * windows that may be obscuring it. The windows that may be obscuring + * this one are the siblings of each direct ancestor which are higher + * in priority than those ancestors. Also, each parent limits the visible + * area of the window. + */ +void +MwSetClipWindow(HDC hdc) +{ + HWND wp = hdc->hwnd; + HWND pwp; /* parent window */ + HWND sibwp; /* sibling windows */ + MWCLIPRECT *clip; /* first clip rectangle */ + int count; /* number of clip rectangles */ + MWCOORD diff; /* difference in coordinates */ + BOOL toomany; /* TRUE if too many clip rects */ + PRECT prc; /* client or window rectangle*/ + MWCLIPRECT cliprects[MAX_CLIPRECTS]; /* clip rectangles */ + + if (wp->unmapcount) + return; + + /* + * Start with the rectangle for the complete window. + * We will then cut pieces out of it as needed. + */ + prc = MwIsClientDC(hdc)? &wp->clirect: &wp->winrect; + count = 1; + clip = cliprects; + clip->x = prc->left; + clip->y = prc->top; + clip->width = prc->right - prc->left; + clip->height = prc->bottom - prc->top; + + /* + * First walk upwards through all parent windows, + * and restrict the visible part of this window to the part + * that shows through all of those parent windows client areas. + */ + pwp = wp; + while (pwp != rootwp) { + pwp = pwp->parent; + + diff = pwp->clirect.left - clip->x; + if (diff > 0) { + clip->width -= diff; + clip->x = pwp->clirect.left; + } + + diff = pwp->clirect.right - (clip->x + clip->width); + if (diff < 0) + clip->width += diff; + + diff = pwp->clirect.top - clip->y; + if (diff > 0) { + clip->height -= diff; + clip->y = pwp->clirect.top; + } + + diff = pwp->clirect.bottom - (clip->y + clip->height); + if (diff < 0) + clip->height += diff; + } + + /* + * If the window is completely clipped out of view, then + * set the clipping region to indicate that. + */ + if (clip->width <= 0 || clip->height <= 0) { + GdSetClipRects(hdc->psd, 1, cliprects); + return; + } + + /* + * Now examine all windows that obscure this window, and + * for each obscuration, break up the clip rectangles into + * the smaller pieces that are still visible. The windows + * that can obscure us are the earlier siblings of all of + * our parents. When clipping the root window, search all children. + */ + toomany = FALSE; + pwp = wp; + while (pwp != NULL) { + wp = pwp; + pwp = wp->parent; + if(!pwp) { + /* We're clipping the root window*/ + if(hdc->flags & DCX_CLIPCHILDREN) + /* start with root's children*/ + sibwp = rootwp->children; + else sibwp = NULL; /* no search*/ + wp = NULL; /* search all root's children*/ + } else { + if(hdc->flags & DCX_CLIPSIBLINGS) + sibwp = pwp->children; + else sibwp = wp; /* no search*/ + } + for (; sibwp != wp; sibwp = sibwp->siblings) { + if (sibwp->unmapcount) + continue; + + toomany |= MwExcludeClipRect(sibwp->winrect.left, + sibwp->winrect.top, sibwp->winrect.right-1, + sibwp->winrect.bottom-1, &count, cliprects); + + } + + /* if not clipping the root window, stop when you reach it*/ + if(pwp == rootwp) + break; + } + + /* + * If not the root window and we're going to be drawing + * in the client area, clip all children. This is + * required for non-special paint handling for child windows. + * Non-client dc's don't clip children in order to get + * proper border clipping in the case of border-clipped children. + */ + wp = hdc->hwnd; + if(wp != rootwp && MwIsClientDC(hdc)) { + for (sibwp=wp->children; sibwp; sibwp = sibwp->siblings) { + if (sibwp->unmapcount) + continue; + + toomany |= MwExcludeClipRect(sibwp->winrect.left, + sibwp->winrect.top, sibwp->winrect.right-1, + sibwp->winrect.bottom-1, &count, cliprects); + } + } + + if (toomany) { + /*GsError(GR_ERROR_TOO_MUCH_CLIPPING, wp->id);*/ + clip->x = 0; + clip->y = 0; + clip->width = -1; + clip->height = -1; + count = 1; + } + + /* + * Set the clip rectangles. + */ + GdSetClipRects(hdc->psd, count, cliprects); +} + +static BOOL +MwExcludeClipRect(int minx,int miny,int maxx,int maxy,int *count, + MWCLIPRECT *cliprects) +{ + int i; /* current index */ + int newcount; /* number of new rectangles */ + BOOL toomany = FALSE;/* TRUE if too many clip rects */ + + newcount = *count; + for (i = 0; i < *count; i++) { + if (newcount > MAX_CLIPRECTS - 3) { + toomany = TRUE; + break; + } + newcount += MwSplitClipRect(&cliprects[i], + &cliprects[newcount], + minx, miny, maxx, maxy); + } + *count = newcount; + return toomany; +} + +/* + * Check the specified clip rectangle against the specified rectangular + * region, and reduce it or split it up into multiple clip rectangles + * such that the specified region is not contained in any of the clip + * rectangles. The source clip rectangle can be modified in place, and + * in addition more clip rectangles can be generated, which are placed in + * the indicated destination location. The maximum number of new clip + * rectangles needed is 3. Returns the number of clip rectangles added. + * If the source clip rectangle is totally obliterated, it is set to an + * impossible region and 0 is returned. When splits are done, we prefer + * to create wide regions instead of high regions. + */ +static int +MwSplitClipRect(MWCLIPRECT *srcrect, MWCLIPRECT *destrect, MWCOORD minx, + MWCOORD miny, MWCOORD maxx, MWCOORD maxy) +{ + MWCOORD x; + MWCOORD y; + MWCOORD width; + MWCOORD height; + MWCOORD dx; + MWCOORD dy; + int gaps; + + /* + * First see if there is any overlap at all. + * If not, then nothing to do. + */ + x = srcrect->x; + y = srcrect->y; + width = srcrect->width; + height = srcrect->height; + + if ((minx > maxx) || (miny > maxy) || (maxx < x) || (maxy < y) || + (x + width <= minx) || (y + height <= miny)) + return 0; + + /* + * There is an overlap. Calculate a value to differentiate + * various cases, and then handle each case separately. The + * cases are classified on whether there are gaps on the left, + * right, top, and bottom sides of the clip rectangle. + */ + gaps = 0; + if (x < minx) + gaps |= GAPVAL(1, 0, 0, 0); + if (x + width - 1 > maxx) + gaps |= GAPVAL(0, 1, 0, 0); + if (y < miny) + gaps |= GAPVAL(0, 0, 1, 0); + if (y + height - 1 > maxy) + gaps |= GAPVAL(0, 0, 0, 1); + + switch (gaps) { + case GAPVAL(0, 0, 0, 0): /* no gaps at all */ + srcrect->x = 0; + srcrect->y = 0; + srcrect->width = 0; + srcrect->height = 0; + return 0; + + case GAPVAL(0, 0, 0, 1): /* gap on bottom */ + dy = maxy - y + 1; + srcrect->y += dy; + srcrect->height -= dy; + return 0; + + case GAPVAL(0, 0, 1, 0): /* gap on top */ + srcrect->height = miny - y; + return 0; + + case GAPVAL(0, 0, 1, 1): /* gap on top, bottom */ + srcrect->height = miny - y; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + return 1; + + case GAPVAL(0, 1, 0, 0): /* gap on right */ + dx = maxx - x + 1; + srcrect->x += dx; + srcrect->width -= dx; + return 0; + + case GAPVAL(0, 1, 0, 1): /* gap on right, bottom */ + dx = maxx - x + 1; + srcrect->x += dx; + srcrect->width -= dx; + srcrect->height = maxy - y + 1; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + return 1; + + case GAPVAL(0, 1, 1, 0): /* gap on right, top */ + dx = maxx - x + 1; + srcrect->height = miny - y; + destrect->x = x + dx; + destrect->width = width - dx; + destrect->y = miny; + destrect->height = y + height - miny; + return 1; + + case GAPVAL(0, 1, 1, 1): /* gap on right, top, bottom */ + dx = maxx - x + 1; + srcrect->height = miny - y; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + destrect++; + destrect->x = x + dx; + destrect->width = width - dx; + destrect->y = miny; + destrect->height = maxy - miny + 1; + return 2; + + case GAPVAL(1, 0, 0, 0): /* gap on left */ + srcrect->width = minx - x; + return 0; + + case GAPVAL(1, 0, 0, 1): /* gap on left, bottom */ + srcrect->width = minx - x; + srcrect->height = maxy - y + 1; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + return 1; + + case GAPVAL(1, 0, 1, 0): /* gap on left, top */ + srcrect->height = miny - y; + destrect->x = x; + destrect->width = minx - x; + destrect->y = miny; + destrect->height = y + height - miny; + return 1; + + case GAPVAL(1, 0, 1, 1): /* gap on left, top, bottom */ + srcrect->height = miny - y; + destrect->x = x; + destrect->width = minx - x; + destrect->y = miny; + destrect->height = maxy - miny + 1; + destrect++; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + return 2; + + case GAPVAL(1, 1, 0, 0): /* gap on left, right */ + destrect->x = maxx + 1; + destrect->width = x + width - maxx - 1; + destrect->y = y; + destrect->height = height; + srcrect->width = minx - x; + return 1; + + case GAPVAL(1, 1, 0, 1): /* gap on left, right, bottom */ + dy = maxy - y + 1; + srcrect->y += dy; + srcrect->height -= dy; + destrect->x = x; + destrect->width = minx - x; + destrect->y = y; + destrect->height = dy; + destrect++; + destrect->x = maxx + 1; + destrect->width = x + width - maxx - 1; + destrect->y = y; + destrect->height = dy; + return 2; + + case GAPVAL(1, 1, 1, 0): /* gap on left, right, top */ + srcrect->height = miny - y; + destrect->x = x; + destrect->width = minx - x; + destrect->y = miny; + destrect->height = y + height - miny; + destrect++; + destrect->x = maxx + 1; + destrect->width = x + width - maxx - 1; + destrect->y = miny; + destrect->height = y + height - miny; + return 2; + + case GAPVAL(1, 1, 1, 1): /* gap on all sides */ + srcrect->height = miny - y; + destrect->x = x; + destrect->width = minx - x; + destrect->y = miny; + destrect->height = maxy - miny + 1; + destrect++; + destrect->x = maxx + 1; + destrect->width = x + width - maxx - 1; + destrect->y = miny; + destrect->height = maxy - miny + 1; + destrect++; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + return 3; + } + return 0; /* NOTREACHED */ +} diff --git a/packages/services/gfx/mw/current/src/mwin/winclip2.c b/packages/services/gfx/mw/current/src/mwin/winclip2.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winclip2.c @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2000 Greg Haerr + * Portions Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * DYNAMICREGIONS MwSetClipWindow + */ +#include "windows.h" +#include "wintern.h" + +/* + * Set the clip rectangles for a window taking into account other + * windows that may be obscuring it. The windows that may be obscuring + * this one are the siblings of each direct ancestor which are higher + * in priority than those ancestors. Also, each parent limits the visible + * area of the window. + */ +void +MwSetClipWindow(HDC hdc) +{ + HWND wp = hdc->hwnd; + HWND pwp; /* parent window */ + HWND sibwp; /* sibling windows */ + MWCOORD diff; /* difference in coordinates */ + PRECT prc; /* client or window rectangle*/ + MWCLIPREGION *vis, *r; + MWCOORD x, y, width, height; + + /* + * Start with the rectangle for the complete window. + * We will then cut pieces out of it as needed. + */ + prc = MwIsClientDC(hdc)? &wp->clirect: &wp->winrect; + x = prc->left; + y = prc->top; + width = prc->right - prc->left; + height = prc->bottom - prc->top; + + /* + * First walk upwards through all parent windows, + * and restrict the visible part of this window to the part + * that shows through all of those parent windows client areas. + */ + pwp = wp; + while (pwp != rootwp) { + pwp = pwp->parent; + + diff = pwp->clirect.left - x; + if (diff > 0) { + width -= diff; + x = pwp->clirect.left; + } + + diff = pwp->clirect.right - (x + width); + if (diff < 0) + width += diff; + + diff = pwp->clirect.top - y; + if (diff > 0) { + height -= diff; + y = pwp->clirect.top; + } + + diff = pwp->clirect.bottom - (y + height); + if (diff < 0) + height += diff; + } + + /* + * If the window is completely clipped out of view, then + * set the clipping region to indicate that. + */ + if (width <= 0 || height <= 0) { + GdSetClipRegion(hdc->psd, NULL); + return; + } + + /* + * Allocate initial vis region to parent-clipped size of window + */ + vis = GdAllocRectRegion(x, y, x+width, y+height); + + /* + * Allocate temp region + */ + r = GdAllocRegion(); + + /* + * Now examine all windows that obscure this window, and + * for each obscuration, break up the clip rectangles into + * the smaller pieces that are still visible. The windows + * that can obscure us are the earlier siblings of all of + * our parents. When clipping the root window, search all children. + */ + pwp = wp; + while (pwp != NULL) { + wp = pwp; + pwp = wp->parent; + if(!pwp) { + /* We're clipping the root window*/ + if(hdc->flags & DCX_CLIPCHILDREN) + /* start with root's children*/ + sibwp = rootwp->children; + else sibwp = NULL; /* no search*/ + wp = NULL; /* search all root's children*/ + } else { + if(hdc->flags & DCX_CLIPSIBLINGS) + sibwp = pwp->children; + else sibwp = wp; /* no search*/ + } + for (; sibwp != wp; sibwp = sibwp->siblings) { + if (sibwp->unmapcount) + continue; + + GdSetRectRegionIndirect(r, &sibwp->winrect); + GdSubtractRegion(vis, vis, r); + } + + /* if not clipping the root window, stop when you reach it*/ + if(pwp == rootwp) + break; + } + + /* + * If not the root window and we're going to be drawing + * in the client area, clip all children. This is + * required for non-special paint handling for child windows. + * Non-client dc's don't clip children in order to get + * proper border clipping in the case of border-clipped children. + */ + wp = hdc->hwnd; + if(wp != rootwp && MwIsClientDC(hdc)) { + for (sibwp=wp->children; sibwp; sibwp = sibwp->siblings) { + if (sibwp->unmapcount) + continue; + + GdSetRectRegionIndirect(r, &sibwp->winrect); + GdSubtractRegion(vis, vis, r); + } + } + +#if UPDATEREGIONS + /* + * Intersect with update region, unless requested not to. + */ + if(!(hdc->flags & DCX_EXCLUDEUPDATE)) + GdIntersectRegion(vis, vis, wp->update); +#endif + /* + * Intersect with user region, if set. + */ + if (hdc->region) + GdIntersectRegion(vis, vis, hdc->region->rgn); + /* + * Set the clip region (later destroy handled by GdSetClipRegion) + */ + GdSetClipRegion(hdc->psd, vis); + + /* + * Destroy temp region + */ + GdDestroyRegion(r); +} diff --git a/packages/services/gfx/mw/current/src/mwin/windefw.c b/packages/services/gfx/mw/current/src/mwin/windefw.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/windefw.c @@ -0,0 +1,402 @@ +/* + * Copyright (c) 1999 Greg Haerr + * + * DefWindowProc implementation for Micro-Windows + * This file should ideally only include windows.h, and be built + * on top of regular win32 api calls. For speed, however, + * certain knowledge of the internal hwnd is known... + */ +#include "windows.h" +#include "wintern.h" +#include "device.h" +#include "wintools.h" /* Draw3dBox, etc*/ +#include + +/* desktop wallpaper image*/ +static PMWIMAGEHDR pImageWallpaper = NULL; + +/* local routines*/ +static void GetCloseBoxRect(HWND hwnd, LPRECT lprc); +static void DrawXORFrame(HWND hwnd,int x, int y, BOOL bDrawCurrent); +static RECT lastrc; + +BOOL +MwSetDesktopWallpaper(PMWIMAGEHDR pImage) +{ + pImageWallpaper = pImage; + InvalidateRect(rootwp, NULL, TRUE); + return TRUE; +} + +/* needed only for XORMOVE repaint algorithm*/ +static void +DrawXORFrame(HWND hwnd,int x, int y, BOOL bDrawCurrent) +{ + HDC hdc; + RECT rc; + + hdc = GetDCEx(NULL, NULL, DCX_WINDOW|DCX_EXCLUDEUPDATE); + SelectObject(hdc, GetStockObject(NULL_BRUSH)); + SelectObject(hdc, GetStockObject(WHITE_PEN)); + GdSetMode(MWMODE_XOR); + if(!IsRectEmpty(&lastrc)) + Rectangle(hdc, lastrc.left, lastrc.top, lastrc.right, + lastrc.bottom); + GetWindowRect(hwnd, &rc); + SetRect(&lastrc, rc.left+x, rc.top+y, rc.right+x, rc.bottom+y); + if(bDrawCurrent) + Rectangle(hdc, lastrc.left, lastrc.top, lastrc.right, + lastrc.bottom); + ReleaseDC(NULL, hdc); + GdSetMode(MWMODE_COPY); +} + +/* + * This procedure implements the messages passed by the window + * manager for default processing on behalf of the window. + */ +LRESULT WINAPI +DefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + HDC hdc; + RECT rc; + DWORD dwStyle; + HBRUSH hbr; + HPEN hpen, holdpen; + PAINTSTRUCT ps; + POINT curpt; + int x, y; + HWND wp; + HWND oldActive; + COLORREF crCaption; + LPNCCALCSIZE_PARAMS lpnc; + CHAR szTitle[64]; + static POINT startpt; + + switch(msg) { + case WM_NCCALCSIZE: + /* calculate client rect from passed window rect in rgrc[0]*/ + lpnc = (LPNCCALCSIZE_PARAMS)lParam; + dwStyle = GetWindowLong(hwnd, GWL_STYLE); + if(dwStyle & WS_BORDER) { + if((dwStyle & WS_CAPTION) == WS_CAPTION) { + InflateRect(&lpnc->rgrc[0], + -mwSYSMETRICS_CXFRAME, + -mwSYSMETRICS_CYFRAME); + lpnc->rgrc[0].top += mwSYSMETRICS_CYCAPTION + 1; + } else + InflateRect(&lpnc->rgrc[0], -1, -1); + } + break; + + case WM_NCPAINT: + /* repaint all non-client area*/ + dwStyle = GetWindowLong(hwnd, GWL_STYLE); + + if(dwStyle & WS_BORDER) { + hdc = GetWindowDC(hwnd); + GetWindowRect(hwnd, &rc); + + if((dwStyle & WS_CAPTION) == WS_CAPTION) { + /* draw 2-line 3d border around window*/ + Draw3dOutset(hdc, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top); + InflateRect(&rc, -2, -2); + + /* draw 1-line inset inside border*/ + hpen = CreatePen(PS_SOLID, 1, + GetSysColor(COLOR_BTNFACE)); + holdpen = SelectObject(hdc, hpen); + SelectObject(hdc, GetStockObject(NULL_BRUSH)); + Rectangle(hdc, rc.left, rc.top, rc.right, + rc.bottom); + InflateRect(&rc, -1, -1); + + /* fill caption*/ + rc.bottom = rc.top + mwSYSMETRICS_CYCAPTION; + crCaption = GetActiveWindow()==hwnd? + GetSysColor(COLOR_ACTIVECAPTION): + GetSysColor(COLOR_INACTIVECAPTION); + hbr = CreateSolidBrush(crCaption); + FillRect(hdc, &rc, hbr); + DeleteObject(hbr); + + /* draw 1 line under caption*/ + MoveToEx(hdc, rc.left, rc.bottom, NULL); + LineTo(hdc, rc.right, rc.bottom); + DeleteObject(SelectObject(hdc, holdpen)); + + /* draw caption text*/ + if(GetWindowText(hwnd, szTitle, + sizeof(szTitle))) { + SetBkMode(hdc, TRANSPARENT); + /* set background color even though + * transparent in case GdArea is used + * to draw text which compares + * gr_foreground != gr_background + * when transparent... + */ + SetBkColor(hdc, crCaption); + SetTextColor(hdc, + GetActiveWindow()==hwnd? + GetSysColor(COLOR_CAPTIONTEXT): + GetSysColor(COLOR_INACTIVECAPTIONTEXT)); + SelectObject(hdc, + GetStockObject(DEFAULT_GUI_FONT)); + GetWindowRect(hwnd, &rc); + TextOut(hdc, rc.left+4, rc.top+2, + szTitle, strlen(szTitle)); + } + + /* draw close box*/ + GetCloseBoxRect(hwnd, &rc); + /*DrawDIB(hdc, rc.right-XSIZE_CLOSEBOX-3, + rc.top+3, &image_close4);*/ + Draw3dBox(hdc, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_BTNHIGHLIGHT), + GetSysColor(COLOR_WINDOWFRAME)); + InflateRect(&rc, -1, -1); + hbr = CreateSolidBrush( + GetSysColor(COLOR_BTNFACE)); + FillRect(hdc, &rc, hbr); + DeleteObject(hbr); + + InflateRect(&rc, -1, -1); + MoveToEx(hdc, rc.left, rc.top, NULL); + LineTo(hdc, rc.right-1, rc.bottom-1); + MoveToEx(hdc, rc.left, rc.bottom-1, NULL); + LineTo(hdc, rc.right-1, rc.top); + } else { + SelectObject(hdc, GetStockObject(NULL_BRUSH)); + Rectangle(hdc, rc.left, rc.top, rc.right, + rc.bottom); + } + ReleaseDC(hwnd, hdc); + } + break; + + case WM_NCHITTEST: + /* if system is dragging a window, always return caption*/ + if(dragwp) + return HTCAPTION; + + /* Determine what part of the window the mouse is over*/ + POINTSTOPOINT(curpt, lParam); + + if(PtInRect(&hwnd->clirect, curpt)) + return HTCLIENT; + + if(PtInRect(&hwnd->vscroll.rc, curpt)) + return HTVSCROLL; + if(PtInRect(&hwnd->hscroll.rc, curpt)) + return HTHSCROLL; + + dwStyle = GetWindowLong(hwnd, GWL_STYLE); + if((dwStyle & WS_CAPTION) == WS_CAPTION) { + GetCloseBoxRect(hwnd, &rc); + if(PtInRect(&rc, curpt)) + return HTCLOSE; + + GetWindowRect(hwnd, &rc); + InflateRect(&rc, -2, -2); + rc.bottom = rc.top + mwSYSMETRICS_CYCAPTION; + if(PtInRect(&rc, curpt)) + return HTCAPTION; + + GetWindowRect(hwnd, &rc); + InflateRect(&rc, -2, -2); + rc.top += mwSYSMETRICS_CYCAPTION; + if(PtInRect(&rc, curpt)) + return HTCLIENT; + + return HTBORDER; + } + return HTNOWHERE; + + case WM_NCLBUTTONDOWN: + /* Handle default actions for mouse down on window*/ + if(wParam == HTCLOSE) { + SendMessage(hwnd, WM_CLOSE, 0, 0L); + break; + } + + /* set focus on mouse down, repaint if necessary*/ + oldActive = GetActiveWindow(); + if(wParam == HTCLIENT || wParam == HTVSCROLL || + wParam == HTHSCROLL) + /* activate and raise window if in client area*/ + /* kaffe port requires this commented out*/ + SetForegroundWindow(hwnd); + else { + /* otherwise just change focus window, same z order*/ + /* this will activate it's top level parent*/ + SetFocus(hwnd); + } + /* repaint captions now because of activation change*/ + UpdateWindow(oldActive); + UpdateWindow(hwnd); + + if(wParam == HTVSCROLL || wParam == HTHSCROLL) { + MwHandleNCMessageScrollbar(hwnd, msg, wParam, lParam); + break; + } + + /* start window drag if in caption area*/ + if(wParam == HTCAPTION && hwnd != rootwp) { + POINTSTOPOINT(startpt, lParam); + if(!(GetWindowLong(hwnd, GWL_STYLE) & WS_MAXIMIZE)) + dragwp = hwnd; + SetRectEmpty(&lastrc); /* XORMOVE only*/ + } + break; + + case WM_NCMOUSEMOVE: + if(wParam == HTVSCROLL || wParam == HTHSCROLL) { + MwHandleNCMessageScrollbar(hwnd, msg, wParam, lParam); + break; + } + + /* drag window with mousemove after mousedown*/ + if(dragwp == hwnd) { + POINTSTOPOINT(curpt, lParam); + x = curpt.x - startpt.x; + y = curpt.y - startpt.y; + + if(mwERASEMOVE) { + GetWindowRect(hwnd, &rc); + MoveWindow(hwnd, rc.left+x, rc.top+y, + rc.right-rc.left, rc.bottom-rc.top, + TRUE); + startpt = curpt; + } else + DrawXORFrame(hwnd, x, y, TRUE); + } + break; + + case WM_NCLBUTTONUP: + /* stop window drag*/ + if(dragwp == hwnd) { + dragwp = NULL; + + if(mwERASEMOVE) { + /* + * User stopped moving window, repaint + * windows previously queued for painting. + */ + for(wp=listwp; wp; wp=wp->next) + if(wp->gotPaintMsg == PAINT_DELAYPAINT) + wp->gotPaintMsg = PAINT_NEEDSPAINT; + } else { + POINTSTOPOINT(curpt, lParam); + x = curpt.x - startpt.x; + y = curpt.y - startpt.y; + DrawXORFrame(hwnd, x, y, FALSE); + GetWindowRect(hwnd, &rc); + MoveWindow(hwnd, rc.left+x, rc.top+y, + rc.right-rc.left, rc.bottom-rc.top, TRUE); + } + } + + if(wParam == HTVSCROLL || wParam == HTHSCROLL) { + MwHandleNCMessageScrollbar(hwnd, msg, wParam, lParam); + break; + } + break; + + case WM_NCLBUTTONDBLCLK: + if(wParam == HTVSCROLL || wParam == HTHSCROLL) { + MwHandleNCMessageScrollbar(hwnd, msg, wParam, lParam); + break; + } + + /* maximize/restore processing*/ + if(wParam != HTCAPTION) + break; + + if((hwnd->style & WS_CAPTION) == WS_CAPTION) { + if(hwnd->style & WS_MAXIMIZE) { + rc = hwnd->restorerc; + MoveWindow(hwnd, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + TRUE); + hwnd->style &= ~WS_MAXIMIZE; + } else { + hwnd->restorerc = hwnd->winrect; + GetWindowRect(rootwp, &rc); + MoveWindow(hwnd, -mwSYSMETRICS_CXFRAME, + -mwSYSMETRICS_CYFRAME, + rc.right+2*mwSYSMETRICS_CXFRAME, + rc.bottom+2*mwSYSMETRICS_CYFRAME, TRUE); + hwnd->style |= WS_MAXIMIZE; + } + } + break; + + case WM_GETTEXTLENGTH: + /* Get window text length. This routine requires + * knowledge of the internal window structure + */ + return strlen(hwnd->szTitle); + + case WM_GETTEXT: + /* Get window text. This routine requires + * knowledge of the internal window structure + */ + return strzcpy((LPSTR)lParam, hwnd->szTitle, wParam); + + case WM_SETTEXT: + /* Set window text. This routine requires + * knowledge of the internal window structure. + * Note that setting text doesn't invalidate the window. + */ + strzcpy(hwnd->szTitle, (LPSTR)lParam, sizeof(hwnd->szTitle)); + return TRUE; + + case WM_CLOSE: + DestroyWindow(hwnd); + if(hwnd == rootwp) + PostQuitMessage(0); + break; + + case WM_ERASEBKGND: + /* erase background with class background brush*/ + hbr = (HBRUSH)GetClassLong(hwnd, GCL_HBRBACKGROUND); + if(!hbr) + return 0; + /* don't exclude update region*/ + hdc = GetDCEx(hwnd, NULL, DCX_DEFAULTCLIP); + FillRect(hdc, NULL, hbr); + ReleaseDC(hwnd, hdc); + return 1; + + case WM_PAINT: + /* required to send erasebkgnd for desktop window*/ + hdc = BeginPaint(hwnd, &ps); + + /* draw desktop wallpaper*/ + if(hwnd == rootwp && pImageWallpaper) { + GetWindowRect(hwnd, &rc); + DrawDIB(hdc, + (rc.right-rc.left-pImageWallpaper->width)/2, + (rc.bottom-rc.top-pImageWallpaper->height)/2, + pImageWallpaper); + } + + EndPaint(hwnd, &ps); + break; + } + return 0; +} + +static void +GetCloseBoxRect(HWND hwnd, LPRECT lprc) +{ +#define XSIZE_CLOSEBOX 9 +#define YSIZE_CLOSEBOX 9 + GetWindowRect(hwnd, lprc); + lprc->left = lprc->right - XSIZE_CLOSEBOX - 5; + lprc->top = lprc->top + 5; + lprc->right = lprc->left + XSIZE_CLOSEBOX; + lprc->bottom = lprc->top + YSIZE_CLOSEBOX; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winevent.c b/packages/services/gfx/mw/current/src/mwin/winevent.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winevent.c @@ -0,0 +1,591 @@ +/* + * Copyright (c) 1999, 2000 Greg Haerr + * Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * Graphics server event routines for windows. + */ +#include "windows.h" +#include "wintern.h" +#include "device.h" +#include +#include +#include + +#if !(DOS_TURBOC | DOS_QUICKC | _MINIX | VXWORKS) +static int +abs(int n) +{ + return n >= 0? n: -n; +} +#endif + +/* + * Update mouse status and issue events on it if necessary. + * This function doesn't block, but is normally only called when + * there is known to be some data waiting to be read from the mouse. + */ +BOOL +MwCheckMouseEvent(void) +{ + MWCOORD rootx; /* latest mouse x position */ + MWCOORD rooty; /* latest mouse y position */ + int newbuttons; /* latest buttons */ + int mousestatus; /* latest mouse status */ + + /* Read the latest mouse status: */ + mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons); + if(mousestatus < 0) { + /*MwError(GR_ERROR_MOUSE_ERROR, 0);*/ + return FALSE; + } else if(mousestatus) { /* Deliver events as appropriate: */ + MwHandleMouseStatus(rootx, rooty, newbuttons); + return TRUE; + } + return FALSE; +} + +/* + * Update keyboard status and issue events on it if necessary. + * This function doesn't block, but is normally only called when + * there is known to be some data waiting to be read from the keyboard. + */ +BOOL +MwCheckKeyboardEvent(void) +{ + MWKEY mwkey; /* latest character */ + MWKEYMOD modifiers; /* latest modifiers */ + MWSCANCODE scancode; + int keystatus; /* latest keyboard status */ + + /* Read the latest keyboard status: */ + keystatus = GdReadKeyboard(&mwkey, &modifiers, &scancode); + if(keystatus < 0) { + if(keystatus == -2) /* special case for ESC pressed*/ + MwTerminate(); + /*MwError(GR_ERROR_KEYBOARD_ERROR, 0);*/ + return FALSE; + } else if(keystatus) { /* Deliver events as appropriate: */ + switch (mwkey) { + case MWKEY_QUIT: + MwTerminate(); + /* no return*/ + case MWKEY_REDRAW: + MwRedrawScreen(); + break; + case MWKEY_PRINT: + if (keystatus == 1) + GdCaptureScreen("screen.bmp"); + break; + } + MwDeliverKeyboardEvent(mwkey, modifiers, scancode, + keystatus==1? TRUE: FALSE); + return TRUE; + } + return FALSE; +} + +/* + * Handle all mouse events. These are mouse enter, mouse exit, mouse + * motion, mouse position, button down, and button up. This also moves + * the cursor to the new mouse position and changes it shape if needed. + */ +void +MwHandleMouseStatus(MWCOORD newx, MWCOORD newy, int newbuttons) +{ + int changebuttons; /* buttons that have changed */ + MWKEYMOD modifiers; /* latest modifiers */ + static int curbuttons; + + GdGetModifierInfo(NULL, &modifiers); /* Read kbd modifiers */ + + /* + * First, if the mouse has moved, then position the cursor to the + * new location, which will send mouse enter, mouse exit, focus in, + * and focus out events if needed. Check here for mouse motion and + * mouse position events. + */ + if (newx != cursorx || newy != cursory) { + MwMoveCursor(newx, newy); + MwDeliverMouseEvent(newbuttons, 0, modifiers); + } + + /* + * Next, generate a button up event if any buttons have been released. + */ + changebuttons = (curbuttons & ~newbuttons); + if (changebuttons) + MwDeliverMouseEvent(newbuttons, changebuttons, modifiers); + + /* + * Finally, generate a button down event if any buttons have been + * pressed. + */ + changebuttons = (~curbuttons & newbuttons); + if (changebuttons) + MwDeliverMouseEvent(newbuttons, changebuttons, modifiers); + + curbuttons = newbuttons; +} + +/* + * Translate and deliver hardware mouse message to proper window. + */ +void +MwTranslateMouseMessage(HWND hwnd,UINT msg,int hittest) +{ + POINT pt; + DWORD tick; + static UINT lastmsg = 0; + static HWND lasthwnd; + static DWORD lasttick; + static int lastx, lasty; + + /* determine double click eligibility*/ + if(msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN) { + tick = GetTickCount(); + if((hwnd->pClass->style & CS_DBLCLKS) && + msg == lastmsg && hwnd == lasthwnd && + tick - lasttick < DBLCLICKSPEED && + abs(cursorx-lastx) < mwSYSMETRICS_CXDOUBLECLK && + abs(cursory-lasty) < mwSYSMETRICS_CYDOUBLECLK) + msg += (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); + lastmsg = msg; + lasthwnd = hwnd; + lasttick = tick; + lastx = cursorx; + lasty = cursory; + } + + /* + * We always send nc mouse message + * unlike Windows, for HTCLIENT default processing + */ + PostMessage(hwnd, msg + (WM_NCMOUSEMOVE-WM_MOUSEMOVE), hittest, + MAKELONG(cursorx, cursory)); + + /* then possibly send user mouse message*/ + if(hittest == HTCLIENT) { + pt.x = cursorx; + pt.y = cursory; + ScreenToClient(hwnd, &pt); + PostMessage(hwnd, msg, 0, MAKELONG(pt.x, pt.y)); + } +} + +/* + * Deliver a mouse button or motion event. + */ +int mwCurrentButtons; + +void +MwDeliverMouseEvent(int buttons, int changebuttons, MWKEYMOD modifiers) +{ + HWND hwnd; + int hittest; + UINT msg; + + mwCurrentButtons = buttons; + + hwnd = GetCapture(); + if(!hwnd) + hwnd = mousewp; + hittest = SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(cursorx,cursory)); + + if(!changebuttons) + MwTranslateMouseMessage(hwnd, WM_MOUSEMOVE, hittest); + + if(changebuttons & MWBUTTON_L) { + msg = (buttons&MWBUTTON_L)? WM_LBUTTONDOWN: WM_LBUTTONUP; + MwTranslateMouseMessage(hwnd, msg, hittest); + } + + if(changebuttons & MWBUTTON_M) { + msg = (buttons&MWBUTTON_M)? WM_MBUTTONDOWN: WM_MBUTTONUP; + MwTranslateMouseMessage(hwnd, msg, hittest); + } + + if(changebuttons & MWBUTTON_R) { + msg = (buttons&MWBUTTON_R)? WM_RBUTTONDOWN: WM_RBUTTONUP; + MwTranslateMouseMessage(hwnd, msg, hittest); + } +} + +/* + * Deliver a keyboard event. + */ +void +MwDeliverKeyboardEvent(MWKEY keyvalue, MWKEYMOD modifiers, MWSCANCODE scancode, + BOOL pressed) +{ + WPARAM VK_Code = keyvalue; /* default no translation*/ + + /* Keysyms from 1-255 are mapped to ASCII*/ + if (keyvalue < 1 || keyvalue > 255) + switch(keyvalue) { + + /* arrows + home/end pad*/ + case MWKEY_LEFT: + VK_Code = VK_LEFT; + break; + case MWKEY_RIGHT: + VK_Code = VK_RIGHT; + break; + case MWKEY_UP: + VK_Code = VK_UP; + break; + case MWKEY_DOWN: + VK_Code = VK_DOWN; + break; + case MWKEY_INSERT: + VK_Code = VK_INSERT; + break; + case MWKEY_DELETE: + VK_Code = VK_DELETE; + break; + case MWKEY_HOME: + VK_Code = VK_HOME; + break; + case MWKEY_END: + VK_Code = VK_END; + break; + case MWKEY_PAGEUP: + VK_Code = VK_PRIOR; + break; + case MWKEY_PAGEDOWN: + VK_Code = VK_NEXT; + break; + + /* Numeric keypad*/ + case MWKEY_KP0: + VK_Code = VK_NUMPAD0; + break; + case MWKEY_KP1: + VK_Code = VK_NUMPAD1; + break; + case MWKEY_KP2: + VK_Code = VK_NUMPAD2; + break; + case MWKEY_KP3: + VK_Code = VK_NUMPAD3; + break; + case MWKEY_KP4: + VK_Code = VK_NUMPAD4; + break; + case MWKEY_KP5: + VK_Code = VK_NUMPAD5; + break; + case MWKEY_KP6: + VK_Code = VK_NUMPAD6; + break; + case MWKEY_KP7: + VK_Code = VK_NUMPAD7; + break; + case MWKEY_KP8: + VK_Code = VK_NUMPAD8; + break; + case MWKEY_KP9: + VK_Code = VK_NUMPAD9; + break; + case MWKEY_KP_PERIOD: + VK_Code = VK_DECIMAL; + break; + case MWKEY_KP_DIVIDE: + VK_Code = VK_DIVIDE; + break; + case MWKEY_KP_MULTIPLY: + VK_Code = VK_MULTIPLY; + break; + case MWKEY_KP_MINUS: + VK_Code = VK_SUBTRACT; + break; + case MWKEY_KP_PLUS: + VK_Code = VK_ADD; + break; + case MWKEY_KP_ENTER: + VK_Code = VK_RETURN; + break; + + /* Function keys */ + case MWKEY_F1: + VK_Code = VK_F1; + break; + case MWKEY_F2: + VK_Code = VK_F2; + break; + case MWKEY_F3: + VK_Code = VK_F3; + break; + case MWKEY_F4: + VK_Code = VK_F4; + break; + case MWKEY_F5: + VK_Code = VK_F5; + break; + case MWKEY_F6: + VK_Code = VK_F6; + break; + case MWKEY_F7: + VK_Code = VK_F7; + break; + case MWKEY_F8: + VK_Code = VK_F8; + break; + case MWKEY_F9: + VK_Code = VK_F9; + break; + case MWKEY_F10: + VK_Code = VK_F10; + break; + case MWKEY_F11: + VK_Code = VK_F11; + break; + case MWKEY_F12: + VK_Code = VK_F12; + break; + + /* Key state modifier keys*/ + case MWKEY_NUMLOCK: + VK_Code = VK_NUMLOCK; + break; + case MWKEY_CAPSLOCK: + VK_Code = VK_CAPITAL; + break; + case MWKEY_SCROLLOCK: + VK_Code = VK_CAPITAL; + break; + case MWKEY_LSHIFT: + VK_Code = VK_LSHIFT; + break; + case MWKEY_RSHIFT: + VK_Code = VK_RSHIFT; + break; + case MWKEY_LCTRL: + VK_Code = VK_LCONTROL; + break; + case MWKEY_RCTRL: + VK_Code = VK_RCONTROL; + break; + case MWKEY_LALT: + VK_Code = VK_MENU; + break; + case MWKEY_RALT: + VK_Code = VK_MENU; + break; + + /* Misc function keys*/ + case MWKEY_PRINT: + VK_Code = VK_PRINT; + break; + case MWKEY_PAUSE: + VK_Code = VK_PAUSE; + break; + case MWKEY_MENU: + VK_Code = VK_LMENU; /* virtual key*/ + break; + + /* questionable mappings or no mappings...*/ + case MWKEY_KP_EQUALS: + VK_Code = '='; /* FIXME*/ + break; + + /* map all non-handled MWKEY values to VK_NONAME*/ +#if 0 + case MWKEY_UNKNOWN: + case MWKEY_SYSREQ: + case MWKEY_BREAK + case MWKEY_QUIT: + case MWKEY_REDRAW: + case MWKEY_LMETA: + case MWKEY_RMETA: + case MWKEY_ALTGR: + /* Handheld function keys*/ + case MWKEY_RECORD: + case MWKEY_PLAY: + case MWKEY_CONTRAST: + case MWKEY_BRIGHTNESS: + case MWKEY_SELECTUP: + case MWKEY_SELECTDOWN: + case MWKEY_ACCEPT: + case MWKEY_CANCEL: + case MWKEY_APP1: + case MWKEY_APP2: + case MWKEY_LAST: +#endif + default: + VK_Code = VK_NONAME; + break; + } + + if (pressed) + SendMessage(focuswp, WM_CHAR, VK_Code, 0L); +} + +/* + * Deliver a window expose event. + * Most of the work is in calculating the update region + * for better redraw look and feel, and then queuing a + * WM_PAINT message to the window. + */ +void +MwDeliverExposureEvent(HWND wp, MWCOORD x, MWCOORD y, MWCOORD width, + MWCOORD height) +{ + if (wp->unmapcount) + return; + + MwUnionUpdateRegion(wp, x, y, width, height, TRUE); + PostMessage(wp, WM_PAINT, 0, 0L); +} + +/* + * Combine the passed rectangle with the update region for the given window. + * Coordinates are passed relative to window. + * If bUnion is TRUE, union the rectangle, otherwise subtract it. + */ +void +MwUnionUpdateRegion(HWND wp, MWCOORD x, MWCOORD y, MWCOORD width, + MWCOORD height, BOOL bUnion) +{ +#if UPDATEREGIONS + MWRECT rc; + + if (wp->unmapcount) + return; + + /* convert window relative coords to screen coords*/ + rc.left = x + wp->winrect.left; + rc.top = y + wp->winrect.top; + rc.right = rc.left + width; + rc.bottom = rc.top + height; + + if(bUnion) + GdUnionRectWithRegion(&rc, wp->update); + else + GdSubtractRectFromRegion(&rc, wp->update); +#endif +} + +/* + * Move the cursor to the specified absolute screen coordinates. + * The coordinates are that of the defined hot spot of the cursor. + * The cursor's appearance is changed to that defined for the window + * in which the cursor is moved to. In addition, the window the + * cursor is in is recalculated. + */ +void MwMoveCursor(MWCOORD x, MWCOORD y) +{ + /* + * Move the cursor only if necessary, offsetting it to + * place the hot spot at the specified coordinates. + */ + if (x != cursorx || y != cursory) { + if(curcursor) + GdMoveCursor(x - curcursor->cursor.hotx, + y - curcursor->cursor.hoty); + cursorx = x; + cursory = y; + } + + /* + * Now check to see which window the mouse is in and whether or + * not the cursor shape should be changed. + */ + MwCheckMouseWindow(); + MwCheckCursor(); +} + +/* + * Check to see if the cursor shape is the correct shape for its current + * location. If not, its shape is changed. + */ +void MwCheckCursor(void) +{ + HWND wp; /* window cursor is in */ + HCURSOR cp; /* cursor definition */ + + /* + * Get the cursor at its current position, and if it is not the + * currently defined one, then set the new cursor. However, + * if the window is currently captured, then leave it alone. + */ + wp = capturewp; + if (wp == NULL) + wp = mousewp; + + cp = wp->cursor; + if (cp == curcursor) + return; + + /* + * It needs redefining, so do it. + */ + curcursor = cp; + GdMoveCursor(cursorx - cp->cursor.hotx, cursory - cp->cursor.hoty); + GdSetCursor(&cp->cursor); +} + +/* + * Find the window which is currently visible for the specified coordinates. + * This just walks down the window tree looking for the deepest mapped + * window which contains the specified point. If the coordinates are + * off the screen, the root window is returned. + */ +HWND +MwFindVisibleWindow(MWCOORD x, MWCOORD y) +{ + HWND wp; /* current window */ + HWND retwp; /* returned window */ + + wp = rootwp; + retwp = wp; + while (wp) { + if (!wp->unmapcount && + wp->winrect.left <= x && wp->winrect.top <= y && + wp->winrect.right > x && wp->winrect.bottom > y) { + retwp = wp; + wp = wp->children; + continue; + } + wp = wp->siblings; + } + return retwp; +} + +/* + * Check to see if the window the mouse is currently in has changed. + */ +void MwCheckMouseWindow(void) +{ + HWND wp; + + /* Don't change if window drag or capture in progress*/ + wp = dragwp; + if(!wp) + wp = capturewp; + if(!wp) + wp = MwFindVisibleWindow(cursorx, cursory); + mousewp = wp; +} + +/* + * Copy dstsiz bytes, including nul, from src to dst. + * Return # bytes, excluding nul, copied. + */ +int +strzcpy(char *dst,const char *src,int dstsiz) +{ + int cc = dstsiz; + + /* return 0 on NULL src*/ + if(!src) + cc = dstsiz = 1; + + while(--dstsiz > 0) { + if((*dst++ = *src++) == '\0') + return cc - dstsiz - 1; + } + *dst = 0; + return cc - dstsiz - 1; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winexpos.c b/packages/services/gfx/mw/current/src/mwin/winexpos.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winexpos.c @@ -0,0 +1,369 @@ +/* + * Copyright (c) 1999 Greg Haerr + * Portions Copyright (c) 1991 David I. Bell + * + * Non-Win32 API helper routines for window showing/hiding/exposing + */ +#include "windows.h" +#include "wintern.h" +#include + +/* Redraw all windows*/ +void +MwRedrawScreen(void) +{ + /* redraw all windows except desktop window*/ + MwExposeArea(rootwp, 0, 0, rootwp->winrect.right, + rootwp->winrect.bottom); + + /* redraw desktop window*/ + PostMessage(rootwp, WM_PAINT, 0, 0L); +} + +/* + * Hide the window to make it and its children invisible on the screen. + * This is a recursive routine which increments the unmapcount values for + * this window and all of its children, and causes exposure events for + * windows which are newly uncovered. + */ +void +MwHideWindow(HWND hwnd,BOOL bChangeFocus, BOOL bSendMsg) +{ + HWND wp = hwnd; + HWND pwp; /* parent window */ + HWND sibwp; /* sibling window */ + HWND childwp; /* child window */ + + if (wp == rootwp) + return; + + ++mwpaintNC; /* experimental NC paint handling*/ + + /* send hide message if currently visible*/ + if(bSendMsg && wp->unmapcount == 0) + SendMessage(wp, WM_SHOWWINDOW, FALSE, 0L); + + wp->unmapcount++; + + for (childwp = wp->children; childwp; childwp = childwp->siblings) + MwHideWindow(childwp, bChangeFocus, bSendMsg); + + if (wp == mousewp) { + MwCheckMouseWindow(); + MwCheckCursor(); + } + + if (bChangeFocus && wp == focuswp) + SetFocus(rootwp->children? rootwp->children: rootwp); + + /* + * If the parent window is still unmapped, then we are all done. + */ + if (wp->parent->unmapcount) + return; + + /* + * Clear the area in the parent for this window, causing an + * exposure event for it. + */ + pwp = wp->parent; + MwClearWindow(pwp, wp->winrect.left - pwp->winrect.left, + wp->winrect.top - pwp->winrect.top, + wp->winrect.right - wp->winrect.left, + wp->winrect.bottom - wp->winrect.top, TRUE); + + /* + * Finally clear and redraw all parts of our lower sibling + * windows that were covered by this window. + */ + sibwp = wp; + while (sibwp->siblings) { + sibwp = sibwp->siblings; + MwExposeArea(sibwp, wp->winrect.left, wp->winrect.top, + wp->winrect.right - wp->winrect.left, + wp->winrect.bottom - wp->winrect.top); + } +} + +/* + * Map the window to possibly make it and its children visible on the screen. + * This is a recursive routine which decrements the unmapcount values for + * this window and all of its children, and causes exposure events for + * those windows which become visible. + */ +void +MwShowWindow(HWND hwnd, BOOL bSendMsg) +{ + HWND wp = hwnd; + + if (wp == rootwp) + return; + + ++mwpaintNC; /* experimental NC paint handling*/ + + if (wp->unmapcount) + wp->unmapcount--; + + if (wp->unmapcount == 0) { + SendMessage(wp, WM_SHOWWINDOW, TRUE, 0L); + MwCheckMouseWindow(); + MwCheckCursor(); + } + + /* + * If the window just became visible, + * then draw its border, clear it to the background color, and + * generate an exposure event. + */ + if (wp->unmapcount == 0) { + /*MwDrawBorder(wp);*/ + MwClearWindow(wp, 0, 0, wp->winrect.right - wp->winrect.left, + wp->winrect.bottom - wp->winrect.top, TRUE); + } + + /* + * Do the same thing for the children. + */ + for (wp = wp->children; wp; wp = wp->siblings) + MwShowWindow(wp, bSendMsg); +} + +/* + * Raise a window to the highest level among its siblings. + */ +void +MwRaiseWindow(HWND hwnd) +{ + HWND wp = hwnd; + HWND prevwp; + BOOL overlap; + + if (!wp || wp == rootwp) + return; + + ++mwpaintNC; /* experimental NC paint handling*/ + + /* + * If this is already the highest window then we are done. + */ + prevwp = wp->parent->children; + if (prevwp == wp) + return; + + /* + * Find the sibling just before this window so we can unlink it. + * Also, determine if any sibling ahead of us overlaps the window. + * Remember that for exposure events. + */ + overlap = FALSE; + while (prevwp->siblings != wp) { + overlap |= MwCheckOverlap(prevwp, wp); + prevwp = prevwp->siblings; + } + overlap |= MwCheckOverlap(prevwp, wp); + + /* + * Now unlink the window and relink it in at the front of the + * sibling chain. + */ + prevwp->siblings = wp->siblings; + wp->siblings = wp->parent->children; + wp->parent->children = wp; + + /* + * Finally redraw the window if necessary. + */ + if (overlap) { + /*MwDrawBorder(wp);*/ + MwExposeArea(wp, wp->winrect.left, wp->winrect.top, + wp->winrect.right - wp->winrect.left, + wp->winrect.bottom - wp->winrect.top); + } +} + +/* + * Lower a window to the lowest level among its siblings. + */ +void +MwLowerWindow(HWND hwnd) +{ + HWND wp = hwnd; + HWND prevwp; + HWND sibwp; /* sibling window */ + HWND expwp; /* siblings being exposed */ + + if (!wp || wp == rootwp || !wp->siblings) + return; + + ++mwpaintNC; /* experimental NC paint handling*/ + + /* + * Find the sibling just before this window so we can unlink us. + */ + prevwp = wp->parent->children; + if (prevwp != wp) { + while (prevwp->siblings != wp) + prevwp = prevwp->siblings; + } + + /* + * Remember the first sibling that is after us, so we can + * generate exposure events for the remaining siblings. Then + * walk down the sibling chain looking for the last sibling. + */ + expwp = wp->siblings; + sibwp = wp; + while (sibwp->siblings) + sibwp = sibwp->siblings; + + /* + * Now unlink the window and relink it in at the end of the + * sibling chain. + */ + if (prevwp == wp) + wp->parent->children = wp->siblings; + else + prevwp->siblings = wp->siblings; + sibwp->siblings = wp; + + wp->siblings = NULL; + + /* + * Finally redraw the sibling windows which this window covered + * if they overlapped our window. + */ + while (expwp && (expwp != wp)) { + if (MwCheckOverlap(wp, expwp)) + MwExposeArea(expwp, wp->winrect.left, wp->winrect.top, + wp->winrect.right - wp->winrect.left, + wp->winrect.bottom - wp->winrect.top); + expwp = expwp->siblings; + } +} + +/* + * Check to see if the first window overlaps the second window. + */ +BOOL +MwCheckOverlap(HWND topwp, HWND botwp) +{ + MWCOORD minx1; + MWCOORD miny1; + MWCOORD maxx1; + MWCOORD maxy1; + MWCOORD minx2; + MWCOORD miny2; + MWCOORD maxx2; + MWCOORD maxy2; + + if (topwp->unmapcount || botwp->unmapcount) + return FALSE; + + minx1 = topwp->winrect.left; + miny1 = topwp->winrect.top; + maxx1 = topwp->winrect.right - 1; + maxy1 = topwp->winrect.bottom - 1; + + minx2 = botwp->winrect.left; + miny2 = botwp->winrect.top; + maxx2 = botwp->winrect.right - 1; + maxy2 = botwp->winrect.bottom - 1; + + if (minx1 > maxx2 || minx2 > maxx1 || miny1 > maxy2 || miny2 > maxy1) + return FALSE; + + return TRUE; +} + +/* + * Clear the specified area of a window and possibly make an exposure event. + * This sets the area window to its background color. If the exposeflag is + * nonzero, then this also creates an exposure event for the window. + */ +void +MwClearWindow(HWND wp, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height, + BOOL exposeflag) +{ + if (wp->unmapcount) + return; + + /* + * Reduce the arguments so that they actually lie within the window. + */ + if (x < 0) { + width += x; + x = 0; + } + if (y < 0) { + height += y; + y = 0; + } + if (x + width > wp->winrect.right - wp->winrect.left) + width = (wp->winrect.right - wp->winrect.left) - x; + if (y + height > wp->winrect.bottom - wp->winrect.top) + height = (wp->winrect.bottom - wp->winrect.top) - y; + + /* + * Now see if the region is really in the window. If not, then + * do nothing. + */ + if (x >= (wp->winrect.right - wp->winrect.left) || + y >= (wp->winrect.bottom - wp->winrect.top) || + width <= 0 || height <= 0) + return; + + /* + * Now do the exposure if required. + */ + if (exposeflag) + MwDeliverExposureEvent(wp, x, y, width, height); +} + +/* + * Handle the exposing of the specified absolute region of the screen, + * starting with the specified window. That window and all of its + * children will be redrawn and/or exposure events generated if they + * overlap the specified area. This is a recursive routine. + */ +void +MwExposeArea(HWND wp, MWCOORD rootx, MWCOORD rooty, MWCOORD width, + MWCOORD height) +{ + if (wp->unmapcount) + return; + + ++mwpaintNC; /* experimental NC paint handling*/ + + /* + * First see if the area overlaps the window including the border. + * If not, then there is nothing more to do. + */ + if (rootx >= wp->winrect.right || rooty >= wp->winrect.bottom || + (rootx + width) <= wp->winrect.left || + (rooty + height) <= wp->winrect.top) + return; + +#if 0 + /* + * The area does overlap the window. See if the area overlaps + * the border, and if so, then redraw it. + */ + if (rootx < wp->winrect.left || rooty < wp->winrect.top || + (rootx + width) > wp->winrect.right || + (rooty + height) > wp->winrect.bottom) + MwDrawBorder(wp); +#endif + + /* + * Now clear the window itself in the specified area, + * which might cause an exposure event. + */ + MwClearWindow(wp, rootx - wp->winrect.left, rooty - wp->winrect.top, + width, height, TRUE); + + /* + * Now do the same for all the children. + */ + for (wp = wp->children; wp; wp = wp->siblings) + MwExposeArea(wp, rootx, rooty, width, height); +} diff --git a/packages/services/gfx/mw/current/src/mwin/winfont.c b/packages/services/gfx/mw/current/src/mwin/winfont.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winfont.c @@ -0,0 +1,250 @@ +/* + * Copyright (c) 2000 Greg Haerr + * GetTextExtent*Point by Roman Guseynov + * Original contributions by Shane Nay + * + * Win32 API upper level font selection routines + */ +#include "windows.h" +#include "wintern.h" +#include "device.h" +#include +#include + +HFONT WINAPI +CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, + int fnWeight, DWORD fdwItalic, DWORD fdwUnderline, DWORD fdwStrikeOut, + DWORD fdwCharSet,DWORD fdwOutputPrecision,DWORD fdwClipPrecision, + DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCSTR lpszFace) +{ + LOGFONT lf; + + lf.lfHeight = nHeight; + lf.lfWidth = nWidth; + lf.lfEscapement = nEscapement; + lf.lfOrientation = nOrientation; + lf.lfWeight = fnWeight; + lf.lfItalic = fdwItalic; + lf.lfUnderline = fdwUnderline; + lf.lfStrikeOut = fdwStrikeOut; + lf.lfCharSet = fdwCharSet; + lf.lfOutPrecision = fdwOutputPrecision; + lf.lfClipPrecision = fdwClipPrecision; + lf.lfQuality = fdwQuality; + lf.lfPitchAndFamily = fdwPitchAndFamily; + strncpy(lf.lfFaceName, lpszFace, sizeof(lf.lfFaceName)); + + return CreateFontIndirect(&lf); +} + +HFONT WINAPI +CreateFontIndirect(CONST LOGFONT *lplf) +{ + MWFONTOBJ * hfont; + int family, pitch; + MWLOGFONT mwlf; + char szFacename[32]; + + /* create a gdi font object*/ + hfont = GdItemNew(MWFONTOBJ); + if(!hfont) + return NULL; + hfont->hdr.type = OBJ_FONT; + hfont->hdr.stockobj = FALSE; + + /* convert LOGFONT to MWLOGFONT*/ + memset(&mwlf, 0, sizeof(mwlf)); + mwlf.lfHeight = lplf->lfHeight; + mwlf.lfWidth = lplf->lfWidth; + mwlf.lfEscapement = lplf->lfEscapement; + mwlf.lfOrientation = lplf->lfOrientation; + mwlf.lfWeight = lplf->lfWeight; + mwlf.lfItalic = lplf->lfItalic; + mwlf.lfUnderline = lplf->lfUnderline; + mwlf.lfStrikeOut = lplf->lfStrikeOut; + mwlf.lfCharSet = lplf->lfCharSet; + mwlf.lfOutPrecision = lplf->lfOutPrecision; + mwlf.lfClipPrecision = lplf->lfClipPrecision; + mwlf.lfQuality = lplf->lfQuality; + strncpy(mwlf.lfFaceName, lplf->lfFaceName, sizeof(mwlf.lfFaceName)); + + family = lplf->lfPitchAndFamily & 0xf0; + switch(family) { + case FF_DONTCARE: + break; + case FF_ROMAN: + mwlf.lfRoman = 1; + mwlf.lfSerif = 1; + break; + case FF_SWISS: + mwlf.lfSansSerif = 1; + break; + case FF_MODERN: + mwlf.lfModern = 1; + break; + } + + pitch = lplf->lfPitchAndFamily & 0x0f; + switch(pitch) { + case DEFAULT_PITCH: + break; + case FIXED_PITCH: + case MONO_FONT: + mwlf.lfMonospace = 1; + break; + case VARIABLE_PITCH: + mwlf.lfProportional = 1; + break; + } + /*mwlf.lfOblique = 0;*/ + /*mwlf.lfSmallCaps = 0;*/ + /*mwlf.lfPitch = 0;*/ + + /* select a font based on facename, bold/italic and height*/ + strncpy(szFacename, lplf->lfFaceName, sizeof(szFacename)); + if (lplf->lfWeight==FW_BOLD) + strcat(szFacename, "B"); + if (lplf->lfItalic) + strcat(szFacename, "I"); + hfont->pfont = GdCreateFont(&scrdev, szFacename, lplf->lfHeight, &mwlf); + + return (HFONT)hfont; +} + +BOOL WINAPI +GetTextMetrics(HDC hdc, LPTEXTMETRIC lptm) +{ + MWFONTINFO fi; + + if(!hdc) + return FALSE; + + GdGetFontInfo(hdc->font->pfont, &fi); + + /* FIXME many items are guessed for the time being*/ + lptm->tmHeight = fi.height; + + /* reversed for kaffe port + lptm->tmAscent = fi.height - fi.baseline; + lptm->tmDescent= fi.baseline; + */ + + lptm->tmDescent = fi.height - fi.baseline; + lptm->tmAscent= fi.baseline; + lptm->tmInternalLeading = 0; + lptm->tmExternalLeading = 0; + lptm->tmAveCharWidth = fi.widths['x']; + lptm->tmMaxCharWidth = fi.maxwidth; + lptm->tmWeight = FW_NORMAL; + lptm->tmOverhang = 0; + lptm->tmDigitizedAspectX = fi.maxwidth; + lptm->tmDigitizedAspectY = fi.height; + lptm->tmFirstChar = 32; + lptm->tmLastChar = 255; + lptm->tmDefaultChar = '?'; + lptm->tmBreakChar = 0; + lptm->tmItalic = 0; + lptm->tmUnderlined = 0; + lptm->tmStruckOut = 0; + /* note that win32 has the TMPF_FIXED_PITCH flags REVERSED...*/ + lptm->tmPitchAndFamily = fi.fixed? + FF_DONTCARE: (FF_DONTCARE | TMPF_FIXED_PITCH); + lptm->tmCharSet = OEM_CHARSET; + return TRUE; +} + +BOOL WINAPI +GetCharWidth(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer) +{ + int i; + int j = 0; + MWFONTINFO fi; + + if(!hdc || iLastChar < iFirstChar) + return FALSE; + + GdGetFontInfo(hdc->font->pfont, &fi); + for(i=iFirstChar; i <= iLastChar; ++i) + if(i < fi.firstchar || i > fi.lastchar || i > 255) + lpBuffer[j++] = 0; + else lpBuffer[j++] = fi.widths[i]; + lpBuffer[j++] = fi.widths[i]; + + return TRUE; +} + +BOOL WINAPI +GetTextExtentPoint( + HDC hdc, /* handle to DC*/ + LPCTSTR lpszStr, /* character string*/ + int cchString, /* number of characters*/ + LPSIZE lpSize) /* string dimensions*/ +{ + int width = 1, height = 1, baseline = 0; + + if (lpSize) { + lpSize->cx = 0; + lpSize->cy = 0; + } + if (!hdc || !lpszStr || !cchString || !lpSize) + return FALSE; + GdGetTextSize(hdc->font->pfont, lpszStr, cchString, &width, &height, + &baseline, MWTF_UTF8); + lpSize->cx = width; + lpSize->cy = height; + + /*printf(": lpszStr=\"%s\", cchString=%d, lpsize->cx=%d, lpSize->cy=%d\n", lpszStr, cchString, lpSize->cx, lpSize->cy);*/ + return TRUE; +} + +BOOL WINAPI +GetTextExtentExPoint(HDC hdc, /* handle to DC*/ + LPCTSTR lpszStr, /* character string*/ + int cchString, /* number of characters*/ + int nMaxExtent, /* maximum width of formatted string*/ + LPINT lpnFit, /* maximum number of characters*/ + LPINT alpDx, /* array of partial string widths*/ + LPSIZE lpSize) /* string dimensions*/ + +{ + int attr,width=0,height=0; + + if(!hdc || !lpszStr) + return FALSE; + if (cchString<0) + cchString = strlen((char *)lpszStr); + attr=hdc->font->pfont->fontattr; + if (attr&FS_FREETYPE) + { + if (GdGetTextSizeEx(hdc->font->pfont,lpszStr,cchString, + nMaxExtent,lpnFit,alpDx,&width,&height,NULL,MWTF_UTF8)) + { + lpSize->cx=width; + lpSize->cy=height; + return TRUE; + } + return FALSE; + } + else + { + SIZE sz; + int i; + + if (!GetTextExtentPoint(hdc, lpszStr, cchString, lpSize)) + return FALSE; + if ((!nMaxExtent)||(!lpnFit)||(!alpDx)) + return TRUE; + for (i=0; i + * + * Win32 API upper level graphics drawing routines + */ +#include "windows.h" +#include "wintern.h" +#include "device.h" +#include +#include + +#define MAXSYSCOLORS 29 /* # of COLOR_* system colors*/ +#define MAXSTOCKOBJECTS 18 /* # of stock objects*/ + +#if ERASEMOVE +BOOL mwERASEMOVE = TRUE; /* default XORMOVE repaint algorithm*/ +#else +BOOL mwERASEMOVE = FALSE; /* default ERASEMOVE repaint algorithm*/ +#endif + +/* cast a pointer to an integer*/ +#if DOS_TURBOC +#define PTRTOINT unsigned long +#else +#define PTRTOINT unsigned int +#endif + +static HDC cliphdc; /* current window cliprects*/ + +/* default bitmap for new DCs*/ +static MWBITMAPOBJ default_bitmap = { + {OBJ_BITMAP, TRUE}, 1, 1, 1, 1, 1, 1 +}; + +static BOOL MwExtTextOut(HDC hdc, int x, int y, UINT fuOptions, + CONST RECT *lprc, LPCVOID lpszString, UINT cbCount, + CONST INT *lpDx, int flags); +static int MwDrawText(HDC hdc, LPCVOID lpString, int nCount, LPRECT lpRect, + UINT uFormat, int flags); + +HDC WINAPI +GetDCEx(HWND hwnd,HRGN hrgnClip,DWORD flags) +{ + HDC hdc; + + if(!hwnd) /* handle NULL hwnd => desktop*/ + hwnd = rootwp; + + /* handle private DC's*/ + if(hwnd->owndc && !(flags & DCX_WINDOW)) + return hwnd->owndc; + + /* add caching?*/ + hdc = GdItemNew(struct hdc); + if(!hdc) + return NULL; + + hdc->psd = &scrdev; + hdc->hwnd = hwnd; + if(flags & DCX_DEFAULTCLIP) { + flags &= ~DCX_DEFAULTCLIP; + if(hwnd->style & WS_CLIPSIBLINGS) + flags |= DCX_CLIPSIBLINGS; + if(hwnd->style & WS_CLIPCHILDREN) + flags |= DCX_CLIPCHILDREN; + } + hdc->flags = flags; + hdc->bkmode = OPAQUE; + hdc->textalign = TA_LEFT | TA_TOP | TA_NOUPDATECP; + hdc->bkcolor = RGB(255, 255, 255); /* WHITE*/ + hdc->textcolor = RGB(0, 0, 0); /* BLACK*/ + hdc->brush = (MWBRUSHOBJ *)GetStockObject(WHITE_BRUSH); + hdc->pen = (MWPENOBJ *)GetStockObject(BLACK_PEN); + hdc->font = (MWFONTOBJ *)GetStockObject(SYSTEM_FONT); +#if UPDATEREGIONS + if(hrgnClip) { + /* make a copy of passed region*/ + hdc->region = (MWRGNOBJ *)CreateRectRgn(0, 0, 0, 0); + CombineRgn((HRGN)hdc->region, hrgnClip, NULL, RGN_COPY); + } +#endif + + /* make default bitmap compatible with scrdev + * otherwise problems occur later because selecting + * in the default bitmap overwrite planes and bpp + * in a memory dc, and thus it becomes incompatible + * with scrdev. + */ + default_bitmap.planes = scrdev.planes; + default_bitmap.bpp = scrdev.bpp; + hdc->bitmap = &default_bitmap; + + hdc->drawmode = R2_COPYPEN; + hdc->pt.x = 0; + hdc->pt.y = 0; + + /* assign private DC if CS_OWNDC and not WindowDC*/ + if((hwnd->pClass->style & CS_OWNDC) && !(flags & DCX_WINDOW)) { + /* must exclude update region due to BeginPaint GetDCEx call*/ + hdc->flags |= DCX_EXCLUDEUPDATE; + hwnd->owndc = hdc; + } + + return hdc; +} + +HDC WINAPI +GetDC(HWND hwnd) +{ + /* + * Exclude update regions when drawing with GetDC. + * This is required because some programs use GetDC + * when painting outside of BeginPaint/EndPaint, and + * the update region is empty then. + */ + return GetDCEx(hwnd, NULL, DCX_DEFAULTCLIP|DCX_EXCLUDEUPDATE); +} + +HDC WINAPI +GetWindowDC(HWND hwnd) +{ + /* + * Exclude update region for now, since we + * don't keep track of non-client update regions yet + */ + return GetDCEx(hwnd, NULL,DCX_WINDOW|DCX_DEFAULTCLIP|DCX_EXCLUDEUPDATE); +} + +/* free a DC allocated from GetDC*/ +int WINAPI +ReleaseDC(HWND hwnd, HDC hdc) +{ + /* don't delete a memory dc on release*/ + if(!hdc || (hdc->psd->flags&PSF_MEMORY)) + return 0; + + if(hdc == cliphdc) + cliphdc = NULL; + + /* handle private DC's*/ + if(hdc->hwnd->owndc && !(hdc->flags & DCX_WINDOW)) + return 1; + + DeleteObject((HBRUSH)hdc->brush); + DeleteObject((HPEN)hdc->pen); +#if 0 /* don't delete font resources on ReleaseDC... use DeleteObject instead*/ + DeleteObject((HFONT)hdc->font); +#endif + DeleteObject((HRGN)hdc->region); + /* + * We can only select a bitmap in a memory DC, + * so bitmaps aren't released except through DeleteDC. + */ + DeleteObject((HBITMAP)hdc->bitmap); + GdItemFree(hdc); + return 1; +} + +/* free a dc allocated from CreateCompatibleDC*/ +BOOL WINAPI +DeleteDC(HDC hdc) +{ + /* don't delete a normal dc, only memory dc's*/ + if(!hdc || !(hdc->psd->flags&PSF_MEMORY)) + return 0; + + /* free allocated memory screen device*/ + hdc->psd->FreeMemGC(hdc->psd); + + /* make it look like a GetDC dc, and free it*/ + hdc->psd = &scrdev; + return ReleaseDC(NULL, hdc); +} + +void +MwPaintNCArea(HWND hwnd) +{ + SendMessage(hwnd, WM_NCPAINT, 0, 0L); + + /* for now, we always paint NC scrollbar areas*/ + MwPaintNCScrollbars(hwnd, NULL); +} + +HDC WINAPI +BeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint) +{ + HDC hdc; + + /* first update non-client area*/ + if(mwforceNCpaint || hwnd->paintNC != mwpaintNC) { + MwPaintNCArea(hwnd); + hwnd->paintNC = mwpaintNC; + } + + /* If ERASEMOVE: + * Don't allow windows to repaint while user is moving + * a window. Instead, just erase backgrounds + * and indicate delayed painting required, which + * will occur after user completes window move. + */ + if(mwERASEMOVE && dragwp) { + hdc = NULL; + lpPaint->fErase = !DefWindowProc(hwnd, WM_ERASEBKGND, 0, 0L); + hwnd->gotPaintMsg = PAINT_DELAYPAINT; + } else { + HideCaret(hwnd); + + /* FIXME: mdemo requires update excluded or draw errors occur*/ + hdc = GetDCEx(hwnd, NULL, DCX_DEFAULTCLIP + |DCX_EXCLUDEUPDATE); /* FIXME - bug*/ + + /* erase client background*/ + lpPaint->fErase = !SendMessage(hwnd, WM_ERASEBKGND, (WPARAM)hdc, + 0L); + } + lpPaint->hdc = hdc; + + GetUpdateRect(hwnd, &lpPaint->rcPaint, FALSE); + return hdc; +} + +BOOL WINAPI +EndPaint(HWND hwnd, CONST PAINTSTRUCT *lpPaint) +{ + ReleaseDC(hwnd, lpPaint->hdc); +#if UPDATEREGIONS + /* don't clear update region until done dragging*/ + if(mwERASEMOVE && !dragwp) + GdSetRectRegion(hwnd->update, 0, 0, 0, 0); +#endif + ShowCaret(hwnd); + return TRUE; +} + +COLORREF WINAPI +SetTextColor(HDC hdc, COLORREF crColor) +{ + COLORREF oldtextcolor; + + if (!hdc) + return CLR_INVALID; + oldtextcolor = hdc->textcolor; + hdc->textcolor = (MWCOLORVAL)crColor; + return oldtextcolor; +} + +COLORREF WINAPI +SetBkColor(HDC hdc, COLORREF crColor) +{ + COLORREF oldbkcolor; + + if (!hdc) + return CLR_INVALID; + oldbkcolor = hdc->bkcolor; + hdc->bkcolor = crColor; + return oldbkcolor; +} + +int WINAPI +SetBkMode(HDC hdc, int iBkMode) +{ + int oldbkmode; + + if(!hdc) + return 0; + oldbkmode = hdc->bkmode; + hdc->bkmode = iBkMode; + return oldbkmode; +} + +UINT WINAPI +SetTextAlign(HDC hdc, UINT fMode) +{ + UINT oldfMode; + + if(!hdc) + return GDI_ERROR; + oldfMode = hdc->textalign; + hdc->textalign = fMode; + return oldfMode; +} + +/* FIXME: releasing a DC does NOT change back the drawing mode!*/ +int WINAPI +SetROP2(HDC hdc, int fnDrawMode) +{ + int newmode, oldmode; + + if(!hdc || (fnDrawMode <= 0 || fnDrawMode > R2_LAST)) + return 0; + + oldmode = hdc->drawmode; + newmode = fnDrawMode - 1; /* map to MWMODE_xxx*/ + hdc->drawmode = newmode; + GdSetMode(newmode); + return oldmode; +} + +/* + * Setup clip region from device context's associated window or bitmap. + * Memory DC's are always associated with the desktop window, and are + * always visible. Return the DC's hwnd if window is visible. + */ +HWND +MwPrepareDC(HDC hdc) +{ + HWND hwnd; + + if(!hdc || !hdc->hwnd) + return NULL; + + hwnd = hdc->hwnd; + if (hwnd->unmapcount) + return NULL; + + /* + * If the window is not the currently clipped one, then + * make it the current one and define its clip rectangles. + */ + if(hdc != cliphdc) { + /* clip memory dc's to the bitmap size*/ + if(hdc->psd->flags&PSF_MEMORY) { +#if DYNAMICREGIONS + GdSetClipRegion(hdc->psd, + GdAllocRectRegion(0, 0, hdc->psd->xvirtres, + hdc->psd->yvirtres)); +#else + static MWCLIPRECT crc = {0, 0, 0, 0}; + + crc.width = hdc->psd->xvirtres; + crc.height = hdc->psd->yvirtres; + GdSetClipRects(hdc->psd, 1, &crc); +#endif + } else MwSetClipWindow(hdc); + cliphdc = hdc; + } + + return hwnd; +} + +/* return RGB value at specified coordinates*/ +COLORREF WINAPI +GetPixel(HDC hdc, int x, int y) +{ + HWND hwnd; + POINT pt; + MWPIXELVAL pixel; + MWPALENTRY rgb; + + hwnd = MwPrepareDC(hdc); + if(!hwnd) + return CLR_INVALID; + pt.x = x; + pt.y = y; + if(MwIsClientDC(hdc)) + ClientToScreen(hwnd, &pt); + + /* read pixel value*/ + GdReadArea(hdc->psd, pt.x, pt.y, 1, 1, &pixel); + + switch(hdc->psd->pixtype) { + case MWPF_TRUECOLOR0888: + case MWPF_TRUECOLOR888: + /* create RGB colorval from 8/8/8 pixel*/ + return PIXEL888TOCOLORVAL(pixel); + + case MWPF_TRUECOLOR565: + /* create RGB colorval from 5/6/5 pixel*/ + return PIXEL565TOCOLORVAL(pixel); + + case MWPF_TRUECOLOR555: + /* create RGB colorval from 5/5/5 pixel*/ + return PIXEL555TOCOLORVAL(pixel); + + case MWPF_TRUECOLOR332: + /* create RGB colorval from 3/3/2 pixel*/ + return PIXEL332TOCOLORVAL(pixel); + + case MWPF_PALETTE: + if(GdGetPalette(hdc->psd, pixel, 1, &rgb)) + return RGB(rgb.r, rgb.g, rgb.b); + } + return CLR_INVALID; +} + +COLORREF WINAPI +SetPixel(HDC hdc, int x, int y, COLORREF crColor) +{ + HWND hwnd; + POINT pt; + + hwnd = MwPrepareDC(hdc); + if(!hwnd) + return 0; /* doesn't return previous color*/ + pt.x = x; + pt.y = y; + if(MwIsClientDC(hdc)) + ClientToScreen(hwnd, &pt); + + /* draw point in passed color*/ + GdSetForeground(GdFindColor(crColor)); + GdPoint(hdc->psd, pt.x, pt.y); + return 0; /* doesn't return previous color*/ +} + +BOOL WINAPI +MoveToEx(HDC hdc, int x, int y, LPPOINT lpPoint) +{ + if(!hdc) + return FALSE; + if(lpPoint) + *lpPoint = hdc->pt; + hdc->pt.x = x; + hdc->pt.y = y; + return TRUE; +} + +BOOL WINAPI +LineTo(HDC hdc, int x, int y) +{ + HWND hwnd; + POINT beg, end; + + hwnd = MwPrepareDC(hdc); + if(!hwnd) + return FALSE; + + beg.x = hdc->pt.x; + beg.y = hdc->pt.y; + end.x = x; + end.y = y; + if(MwIsClientDC(hdc)) { + ClientToScreen(hwnd, &beg); + ClientToScreen(hwnd, &end); + } + + /* draw line in current pen color*/ + if(hdc->pen->style != PS_NULL) { + GdSetForeground(GdFindColor(hdc->pen->color)); + /* don't draw last point*/ + GdLine(hdc->psd, beg.x, beg.y, end.x, end.y, FALSE); + } + hdc->pt.x = x; + hdc->pt.y = y; + return TRUE; +} + +/* draw line segments by connecting passed points*/ +BOOL WINAPI +Polyline(HDC hdc, CONST POINT *lppt, int cPoints) +{ + HWND hwnd; + POINT beg, end; + + if(cPoints <= 1) + return FALSE; + + hwnd = MwPrepareDC(hdc); + if(!hwnd) + return FALSE; + + if(hdc->pen->style == PS_NULL) + return TRUE; + + /* draw line in current pen color*/ + GdSetForeground(GdFindColor(hdc->pen->color)); + + beg = *lppt++; + if(MwIsClientDC(hdc)) + ClientToScreen(hwnd, &beg); + while(--cPoints > 0) { + end = *lppt++; + if(MwIsClientDC(hdc)) + ClientToScreen(hwnd, &end); + + /* don't draw last point*/ + GdLine(hdc->psd, beg.x, beg.y, end.x, end.y, FALSE); + + beg = end; + } + return TRUE; +} + +BOOL WINAPI +Rectangle(HDC hdc, int nLeft, int nTop, int nRight, int nBottom) +{ + HWND hwnd; + RECT rc; + + hwnd = MwPrepareDC(hdc); + if(!hwnd) + return FALSE; + + SetRect(&rc, nLeft, nTop, nRight, nBottom); + if(MwIsClientDC(hdc)) + MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); + + /* draw rectangle in current pen color*/ + if(hdc->pen->style != PS_NULL) { + GdSetForeground(GdFindColor(hdc->pen->color)); + GdRect(hdc->psd, rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top); + } + + /* fill rectangle in current brush color*/ + if(hdc->brush->style != BS_NULL) { + InflateRect(&rc, -1, -1); + GdSetForeground(GdFindColor(hdc->brush->color)); + GdFillRect(hdc->psd, rc.left, rc.top, rc.right - rc.left, + rc.bottom - rc.top); + } + + return TRUE; +} + +BOOL WINAPI +Ellipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) +{ + HWND hwnd; + int rx, ry; + RECT rc; + + hwnd = MwPrepareDC(hdc); + if(!hwnd) + return FALSE; + + SetRect(&rc, nLeftRect, nTopRect, nRightRect, nBottomRect); + if(MwIsClientDC(hdc)) + MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); + + rx = (rc.right - rc.left)/2 - 1; + ry = (rc.bottom - rc.top)/2 - 1; + rc.left += rx; + rc.top += ry; + + /* fill ellipse in current brush color*/ + if(hdc->brush->style != BS_NULL) { + InflateRect(&rc, -1, -1); + GdSetForeground(GdFindColor(hdc->brush->color)); + GdEllipse(hdc->psd, rc.left, rc.top, rx, ry, TRUE); + } + + /* draw ellipse outline in current pen color*/ + if(hdc->pen->style != PS_NULL) { + GdSetForeground(GdFindColor(hdc->pen->color)); + GdEllipse(hdc->psd, rc.left, rc.top, rx, ry, FALSE); + } + + return TRUE; +} + +static void +dopiearc(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, + int ax, int ay, int bx, int by, int type) +{ + HWND hwnd; + int rx, ry; + RECT rc, rc2; + + hwnd = MwPrepareDC(hdc); + if(!hwnd) + return; + + SetRect(&rc, nLeftRect, nTopRect, nRightRect, nBottomRect); + SetRect(&rc2, ax, ay, bx, by); + if(MwIsClientDC(hdc)) { + MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); + MapWindowPoints(hwnd, NULL, (LPPOINT)&rc2, 2); + } + + rx = (rc.right - rc.left)/2 - 1; + ry = (rc.bottom - rc.top)/2 - 1; + rc.left += rx; + rc.top += ry; + + /* fill ellipse in current brush color*/ + if(hdc->brush->style != BS_NULL && type == MWPIE) { + GdSetForeground(GdFindColor(hdc->brush->color)); + GdArc(hdc->psd, rc.left, rc.top, rx, ry, + rc2.left, rc2.top, rc2.right, rc2.bottom, MWPIE); + } + + /* draw ellipse outline in current pen color*/ + if(hdc->pen->style != PS_NULL) { + GdSetForeground(GdFindColor(hdc->pen->color)); + if(type == MWPIE) + type = MWARC; /* MWARCOUTLINE?*/ + GdArc(hdc->psd, rc.left, rc.top, rx, ry, + rc2.left, rc2.top, rc2.right, rc2.bottom, type); + } +} + +BOOL WINAPI +Arc(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, + int nXStartArc, int nYStartArc, int nXEndArc, int nYEndArc) +{ + dopiearc(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect, + nXStartArc, nYStartArc, nXEndArc, nYEndArc, MWARC); + return TRUE; +} + +BOOL WINAPI +Pie(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, + int nXRadial1, int nYRadial1, int nXRadial2, int nYRadial2) +{ + dopiearc(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect, + nXRadial1, nYRadial1, nXRadial2, nYRadial2, MWPIE); + return TRUE; +} + +BOOL WINAPI +Polygon(HDC hdc, CONST POINT *lpPoints, int nCount) +{ + HWND hwnd; + int i; + LPPOINT pp, ppAlloc = NULL; + + hwnd = MwPrepareDC(hdc); + if(!hwnd) + return FALSE; + + if(MwIsClientDC(hdc)) { + /* convert points to client coords*/ + ppAlloc = (LPPOINT)malloc(nCount * sizeof(POINT)); + if(!ppAlloc) + return FALSE; + memcpy(ppAlloc, lpPoints, nCount*sizeof(POINT)); + pp = ppAlloc; + for(i=0; ibrush->style != BS_NULL) { + GdSetForeground(GdFindColor(hdc->brush->color)); + GdFillPoly(hdc->psd, nCount, pp); + } + + /* draw polygon outline in current pen color*/ + if(hdc->pen->style != PS_NULL) { + GdSetForeground(GdFindColor(hdc->pen->color)); + GdPoly(hdc->psd, nCount, pp); + } + + if(ppAlloc) + free(ppAlloc); + return TRUE; +} + +/* draw nCount polygons*/ +BOOL WINAPI +PolyPolygon(HDC hdc, CONST POINT *lpPoints, LPINT lpPolyCounts, int nCount) +{ + while(--nCount >= 0) { + if (!Polygon(hdc, lpPoints, *lpPolyCounts)) + return FALSE; + lpPoints += *lpPolyCounts++; + } + return TRUE; +} + +int WINAPI +FillRect(HDC hdc, CONST RECT *lprc, HBRUSH hbr) +{ + HWND hwnd; + RECT rc; + MWBRUSHOBJ * obr = (MWBRUSHOBJ *)hbr; + COLORREF crFill; + + hwnd = MwPrepareDC(hdc); + if(!hwnd || !obr) + return FALSE; + + if(!lprc) { + if(MwIsClientDC(hdc)) + GetClientRect(hwnd, &rc); + else + GetWindowRect(hwnd, &rc); + lprc = &rc; + } else + rc = *lprc; + if(MwIsClientDC(hdc)) + MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); + + /* handle COLOR_xxx + 1 passed as HBRUSH*/ + if((PTRTOINT)obr <= MAXSYSCOLORS) + crFill = GetSysColor((int)obr-1); + else { + /* get color from passed HBRUSH*/ + if(obr->style == BS_NULL) + return TRUE; + crFill = obr->color; + } + + /* fill rectangle in passed brush color*/ + GdSetForeground(GdFindColor(crFill)); + GdFillRect(hdc->psd, rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top); + return TRUE; +} + +/* ascii*/ +BOOL WINAPI +TextOut(HDC hdc, int x, int y, LPCSTR lpszString, int cbString) +{ + /* kaffe port wants MWTF_UTF8 here...*/ + return MwExtTextOut(hdc, x, y, 0, NULL, lpszString, cbString, NULL, + MWTF_ASCII); +} + +/* ascii*/ +BOOL WINAPI +ExtTextOut(HDC hdc, int x, int y, UINT fuOptions, CONST RECT *lprc, + LPCSTR lpszString, UINT cbCount, CONST INT *lpDx) +{ + return MwExtTextOut(hdc, x, y, fuOptions, lprc, lpszString, + cbCount, lpDx, MWTF_ASCII); +} + +/* unicode*/ +BOOL WINAPI +ExtTextOutW(HDC hdc, int x, int y, UINT fuOptions, CONST RECT *lprc, + LPCWSTR lpszString, UINT cbCount, CONST INT *lpDx) +{ + return MwExtTextOut(hdc, x, y, fuOptions, lprc, lpszString, + cbCount, lpDx, MWTF_UC16); +} + +/* internal version of ExtTextOut, passed flags for text data type*/ +static BOOL +MwExtTextOut(HDC hdc, int x, int y, UINT fuOptions, CONST RECT *lprc, + LPCVOID lpszString, UINT cbCount, CONST INT *lpDx, int flags) +{ + HWND hwnd; + POINT pt; + RECT rc; + + hwnd = MwPrepareDC(hdc); + if(!hwnd) + return FALSE; + + pt.x = x; + pt.y = y; + if(MwIsClientDC(hdc)) + ClientToScreen(hwnd, &pt); + + /* optionally fill passed rectangle*/ + if(lprc && (fuOptions&ETO_OPAQUE)) { + rc = *lprc; + if(MwIsClientDC(hdc)) + MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); + + /* fill rectangle with current background color*/ + GdSetForeground(GdFindColor(hdc->bkcolor)); + GdFillRect(hdc->psd, rc.left, rc.top, rc.right - rc.left, + rc.bottom - rc.top); + GdSetUseBackground(FALSE); + } else { + /* use current background mode for text background draw*/ + GdSetUseBackground(hdc->bkmode == OPAQUE? TRUE: FALSE); + /* always set background color in case GdArea is + * used to draw, which compares gr_foreground != gr_background + * if gr_usebg is false... + */ + /*if(hdc->bkmode == OPAQUE)*/ + GdSetBackground(GdFindColor(hdc->bkcolor)); + } + + /* nyi: lpDx*/ + + /* draw text in current text foreground and background color*/ + GdSetForeground(GdFindColor(hdc->textcolor)); + GdSetFont(hdc->font->pfont); + + /* this whole text alignment thing needs rewriting*/ + if((hdc->textalign & TA_BASELINE) == TA_BASELINE) { + /* this is not right... changed for kaffe port + flags |= MWTF_TOP; + */ + flags |= MWTF_BASELINE; + } else if(hdc->textalign & TA_BOTTOM) { + MWCOORD ph, pw, pb; + + if(lprc) + pt.y += lprc->bottom - lprc->top; + else { + GdGetTextSize(hdc->font->pfont, lpszString, cbCount, + &pw, &ph, &pb, flags); + pt.y += ph; + } + flags |= MWTF_BOTTOM; + } else + flags |= MWTF_TOP; + GdText(hdc->psd, pt.x, pt.y, lpszString, cbCount, flags); + + return TRUE; +} + +/* ascii*/ +int WINAPI +DrawTextA(HDC hdc, LPCSTR lpString, int nCount, LPRECT lpRect, UINT uFormat) +{ + return MwDrawText(hdc, lpString, nCount, lpRect, uFormat, MWTF_ASCII); +} + +/* unicode*/ +int WINAPI +DrawTextW(HDC hdc, LPCWSTR lpString, int nCount, LPRECT lpRect, UINT uFormat) +{ + return MwDrawText(hdc, lpString, nCount, lpRect, uFormat, MWTF_UC16); +} + +/* note: many DT_x aren't implemented in this function*/ +/* internal version of DrawText, passed flags for text data type*/ +static int +MwDrawText(HDC hdc, LPCVOID lpString, int nCount, LPRECT lpRect, UINT uFormat, + int flags) +{ + MWCOORD x, y, width, height, baseline; + + if(nCount == -1) + nCount = strlen(lpString); + + if(uFormat & (DT_CALCRECT|DT_CENTER|DT_RIGHT)) { + if(!hdc) + return 0; + GdGetTextSize(hdc->font->pfont, lpString, nCount, + &width, &height, &baseline, MWTF_ASCII); + } + x = lpRect->left; + y = lpRect->top; + + if(uFormat & DT_CALCRECT) { + lpRect->right = x + width; + lpRect->bottom = y + height; + return height; + } + + if(uFormat & DT_CENTER) + x = (lpRect->left + lpRect->right - width) / 2; + else if(uFormat & DT_RIGHT) + x += lpRect->right - width; + + /* draw text at DT_TOP using current fg, bg and bkmode*/ + MwExtTextOut(hdc, x, y, 0, NULL, lpString, nCount, NULL, flags); + return height; +} + +/* Microwindows only*/ +BOOL WINAPI +DrawDIB(HDC hdc,int x,int y,PMWIMAGEHDR pimage) +{ + HWND hwnd; + POINT pt; + + hwnd = MwPrepareDC(hdc); + if(!hwnd || !pimage) + return FALSE; + pt.x = x; + pt.y = y; + if(MwIsClientDC(hdc)) + ClientToScreen(hwnd, &pt); + + GdDrawImage(hdc->psd, pt.x, pt.y, pimage); + return TRUE; +} + +/* define color scheme: A (tan), B (winstd) or C (old)*/ +#if ELKS +#define B +#else +#define A +#endif + +#define A_RGB(r,g,b) +#define B_RGB(r,g,b) +#define C_RGB(r,g,b) + +#ifdef A +#undef A_RGB +#define A_RGB(r,g,b) RGB(r,g,b), +#endif +#ifdef B +#undef B_RGB +#define B_RGB(r,g,b) RGB(r,g,b), +#endif +#ifdef C +#undef C_RGB +#define C_RGB(r,g,b) RGB(r,g,b), +#endif + +static COLORREF sysColors[MAXSYSCOLORS] = { + RGB(192, 192, 192), /* COLOR_SCROLLBAR 0*/ + RGB( 0, 128, 128), /* COLOR_BACKGROUND */ + A_RGB(128, 0, 0) /* COLOR_ACTIVECAPTION */ + B_RGB(128, 0, 128) /* COLOR_ACTIVECAPTION */ + C_RGB(128, 0, 128) /* COLOR_ACTIVECAPTION */ + A_RGB(162, 141, 104) /* COLOR_INACTIVECAPTION */ + B_RGB(128, 128, 128) /* COLOR_INACTIVECAPTION */ + C_RGB( 0, 64, 128) /* COLOR_INACTIVECAPTION */ + RGB(192, 192, 192), /* COLOR_MENU */ + RGB(255, 255, 255), /* COLOR_WINDOW 5*/ + RGB( 0, 0, 0), /* COLOR_WINDOWFRAME */ + RGB( 0, 0, 0), /* COLOR_MENUTEXT */ + RGB( 0, 0, 0), /* COLOR_WINDOWTEXT */ + RGB(255, 255, 255), /* COLOR_CAPTIONTEXT */ + RGB(192, 192, 192), /* COLOR_ACTIVEBORDER 10*/ + RGB(192, 192, 192), /* COLOR_INACTIVEBORDER */ + RGB(128, 128, 128), /* COLOR_APPWORKSPACE */ + RGB(128, 0, 0), /* COLOR_HIGHLIGHT */ + RGB(255, 255, 255), /* COLOR_HIGHLIGHTTEXT */ + A_RGB(213, 204, 187) /* COLOR_BTNFACE 15*/ + B_RGB(192, 192, 192) /* COLOR_BTNFACE 15*/ + C_RGB(160, 160, 160) /* COLOR_BTNFACE 15*/ + A_RGB(162, 141, 104) /* COLOR_BTNSHADOW */ + B_RGB(128, 128, 128) /* COLOR_BTNSHADOW */ + C_RGB(128, 128, 128) /* COLOR_BTNSHADOW */ + RGB( 64, 64, 64), /* COLOR_GRAYTEXT */ + RGB( 0, 0, 0), /* COLOR_BTNTEXT */ + RGB(192, 192, 192), /* COLOR_INACTIVECAPTIONTEXT */ + A_RGB(234, 230, 221) /* COLOR_BTNHIGHLIGHT 20*/ + B_RGB(255, 255, 255) /* COLOR_BTNHIGHLIGHT 20*/ + C_RGB(223, 223, 223) /* COLOR_BTNHIGHLIGHT 20*/ + RGB( 0, 0, 0), /* COLOR_3DDKSHADOW */ + A_RGB(213, 204, 187) /* COLOR_3DLIGHT */ + B_RGB(223, 223, 223) /* COLOR_3DLIGHT */ + C_RGB(192, 192, 192) /* COLOR_3DLIGHT */ + RGB( 0, 0, 0), /* COLOR_INFOTEXT */ + RGB(225, 255, 255), /* COLOR_INFOBK */ + RGB(184, 180, 184), /* COLOR_ALTERNATEBTNFACE 25*/ + RGB( 0, 0, 255), /* COLOR_HOTLIGHT */ + RGB( 16, 132, 208), /* COLOR_GRADIENTACTIVECAPTION */ + RGB(184, 180, 184) /* COLOR_GRADIENTINACTIVECAPTION 28*/ +}; + +DWORD WINAPI +GetSysColor(int nIndex) +{ + if(nIndex >= 0 && nIndex < MAXSYSCOLORS) + return sysColors[nIndex]; + return 0; +} + +COLORREF WINAPI +SetSysColor(int nIndex, COLORREF crColor) /* Microwindows only*/ +{ + COLORREF oldColor; + + if(nIndex >= 0 && nIndex < MAXSYSCOLORS) { + oldColor = sysColors[nIndex]; + sysColors[nIndex] = crColor; + return oldColor; + } + return 0; +} + +static MWBRUSHOBJ OBJ_WHITE_BRUSH = { + {OBJ_BRUSH, TRUE}, BS_SOLID, RGB(255, 255, 255) +}; + +static MWBRUSHOBJ OBJ_LTGRAY_BRUSH = { + {OBJ_BRUSH, TRUE}, BS_SOLID, RGB(192, 192, 192) +}; + +static MWBRUSHOBJ OBJ_GRAY_BRUSH = { + {OBJ_BRUSH, TRUE}, BS_SOLID, RGB(128, 128, 128) +}; + +static MWBRUSHOBJ OBJ_DKGRAY_BRUSH = { + {OBJ_BRUSH, TRUE}, BS_SOLID, RGB(32, 32, 32) +}; + +static MWBRUSHOBJ OBJ_BLACK_BRUSH = { + {OBJ_BRUSH, TRUE}, BS_SOLID, RGB(0, 0, 0) +}; + +static MWBRUSHOBJ OBJ_NULL_BRUSH = { + {OBJ_BRUSH, TRUE}, BS_NULL, RGB(0, 0, 0) +}; + +static MWPENOBJ OBJ_WHITE_PEN = { + {OBJ_PEN, TRUE}, PS_SOLID, RGB(255, 255, 255) +}; + +static MWPENOBJ OBJ_BLACK_PEN = { + {OBJ_PEN, TRUE}, PS_SOLID, RGB(0, 0, 0) +}; + +static MWPENOBJ OBJ_NULL_PEN = { + {OBJ_PEN, TRUE}, PS_NULL, RGB(0, 0, 0) +}; + +static MWFONTOBJ OBJ_OEM_FIXED_FONT = { + {OBJ_FONT, TRUE}, NULL, MWFONT_OEM_FIXED +}; + +static MWFONTOBJ OBJ_ANSI_FIXED_FONT = { + {OBJ_FONT, TRUE}, NULL, MWFONT_SYSTEM_FIXED +}; + +static MWFONTOBJ OBJ_ANSI_VAR_FONT = { + {OBJ_FONT, TRUE}, NULL, MWFONT_SYSTEM_VAR +}; + +static MWFONTOBJ OBJ_SYSTEM_FONT = { + {OBJ_FONT, TRUE}, NULL, MWFONT_SYSTEM_VAR +}; + +static MWFONTOBJ OBJ_DEVICE_DEFAULT_FONT = { + {OBJ_FONT, TRUE}, NULL, MWFONT_OEM_FIXED +}; + +static MWFONTOBJ OBJ_SYSTEM_FIXED_FONT = { + {OBJ_FONT, TRUE}, NULL, MWFONT_SYSTEM_FIXED +}; + +static MWFONTOBJ OBJ_DEFAULT_GUI_FONT = { + {OBJ_FONT, TRUE}, NULL, MWFONT_GUI_VAR +}; + +static struct hgdiobj *stockObjects[MAXSTOCKOBJECTS] = { + (struct hgdiobj *)&OBJ_WHITE_BRUSH, /* WHITE_BRUSH*/ + (struct hgdiobj *)&OBJ_LTGRAY_BRUSH, /* LTGRAY_BRUSH*/ + (struct hgdiobj *)&OBJ_GRAY_BRUSH, /* GRAY_BRUSH*/ + (struct hgdiobj *)&OBJ_DKGRAY_BRUSH, /* DKGRAY_BRUSH*/ + (struct hgdiobj *)&OBJ_BLACK_BRUSH, /* BLACK_BRUSH*/ + (struct hgdiobj *)&OBJ_NULL_BRUSH, /* NULL_BRUSH*/ + (struct hgdiobj *)&OBJ_WHITE_PEN, /* WHITE_PEN*/ + (struct hgdiobj *)&OBJ_BLACK_PEN, /* BLACK_PEN*/ + (struct hgdiobj *)&OBJ_NULL_PEN, /* NULL_PEN*/ + (struct hgdiobj *)NULL, + (struct hgdiobj *)&OBJ_OEM_FIXED_FONT, /* OEM_FIXED_FONT*/ + (struct hgdiobj *)&OBJ_ANSI_FIXED_FONT, /* ANSI_FIXED_FONT*/ + (struct hgdiobj *)&OBJ_ANSI_VAR_FONT, /* ANSI_VAR_FONT*/ + (struct hgdiobj *)&OBJ_SYSTEM_FONT, /* SYSTEM_FONT*/ + (struct hgdiobj *)&OBJ_DEVICE_DEFAULT_FONT, /* DEVICE_DEFAULT_FONT*/ + (struct hgdiobj *)NULL, /* DEFAULT_PALETTE*/ + (struct hgdiobj *)&OBJ_SYSTEM_FIXED_FONT, /* SYSTEM_FIXED_FONT*/ + (struct hgdiobj *)&OBJ_DEFAULT_GUI_FONT /* DEFAULT_GUI_FONT*/ +}; + +HGDIOBJ WINAPI +GetStockObject(int nObject) +{ + HGDIOBJ pObj; + MWFONTOBJ * pFont; + + if(nObject >= 0 && nObject < MAXSTOCKOBJECTS) { + pObj = stockObjects[nObject]; + + /* create stock fonts on first access*/ + if(pObj->hdr.type == OBJ_FONT) { + pFont = (MWFONTOBJ *)pObj; + if(pFont->pfont == NULL) { + pFont->pfont = GdCreateFont(&scrdev, + pFont->name, 0, NULL); + } + return pObj; + } + + /* implement multiple color schemes with + * standard background brushes... + */ + switch(nObject) { + case LTGRAY_BRUSH: + case GRAY_BRUSH: + ((MWBRUSHOBJ *)pObj)->color =GetSysColor(COLOR_BTNFACE); + break; + case DKGRAY_BRUSH: + ((MWBRUSHOBJ *)pObj)->color = + GetSysColor(COLOR_BTNSHADOW); + break; + } + return pObj; + } + return NULL; +} + +HGDIOBJ WINAPI +SelectObject(HDC hdc, HGDIOBJ hObject) +{ + HGDIOBJ objOrg; + MWBITMAPOBJ * pb; + + if(!hdc || !hObject) + return NULL; + + switch(hObject->hdr.type) { + case OBJ_PEN: + objOrg = (HGDIOBJ)hdc->pen; + hdc->pen = (MWPENOBJ *)hObject; + break; + case OBJ_BRUSH: + objOrg = (HGDIOBJ)hdc->brush; + hdc->brush = (MWBRUSHOBJ *)hObject; + break; + case OBJ_FONT: + objOrg = (HGDIOBJ)hdc->font; + hdc->font = (MWFONTOBJ *)hObject; + break; + case OBJ_BITMAP: + /* must be memory dc to select bitmap*/ + if(!(hdc->psd->flags&PSF_MEMORY)) + return NULL; + objOrg = (HGDIOBJ)hdc->bitmap; + + /* setup mem dc for drawing into bitmap*/ + pb = (MWBITMAPOBJ *)hObject; + + /* init memory context*/ + if (!hdc->psd->MapMemGC(hdc->psd, pb->width, pb->height, + pb->planes, pb->bpp, pb->linelen, pb->size, + &pb->bits[0])) + return NULL; + + hdc->bitmap = (MWBITMAPOBJ *)hObject; + break; +#if UPDATEREGIONS + case OBJ_REGION: + /*objOrg = (HGDIOBJ)hdc->region;*/ + objOrg = NULL; /* FIXME? hdc->region is destroyed below*/ + SelectClipRgn(hdc, (HRGN)hObject); + break; +#endif + default: + return NULL; + } + + return objOrg; +} + +BOOL WINAPI +DeleteObject(HGDIOBJ hObject) +{ + if(!hObject || hObject->hdr.stockobj) + return FALSE; + if(hObject->hdr.type == OBJ_FONT) + GdDestroyFont(((MWFONTOBJ *)hObject)->pfont); + if(hObject->hdr.type == OBJ_REGION) + GdDestroyRegion(((MWRGNOBJ *)hObject)->rgn); + GdItemFree(hObject); + return TRUE; +} + +#if UPDATEREGIONS +/* region is passed in client coords (win32 api doc bug)*/ +int WINAPI +SelectClipRgn(HDC hdc, HRGN hrgn) +{ + return ExtSelectClipRgn(hdc, hrgn, RGN_COPY); +} + +/* + * Select a user clip region into DC, recalculate final clipregion. + * Only a copy of the passed region is used. + */ +/* region is passed in client coords (win32 api doc bug)*/ +int WINAPI +ExtSelectClipRgn(HDC hdc, HRGN hrgn, int fnMode) +{ + HRGN newrgn; + + if(!hdc) + return ERROR; + if(hdc->region != (MWRGNOBJ *)hrgn) { + /* combine region if not null*/ + if(hrgn) { + newrgn = CreateRectRgn(0, 0, 0, 0); + + /* + * Temporarily convert region from + * client coords to screen coords, since + * hwnd->update is kept in screen coords. + */ + OffsetRgn(hrgn, hdc->hwnd->clirect.left, + hdc->hwnd->clirect.top); + + if(fnMode == RGN_COPY) + CombineRgn(newrgn, hrgn, NULL, fnMode); + else CombineRgn(newrgn, (HRGN)hdc->region, hrgn,fnMode); + + /* convert passed region back to client coords*/ + OffsetRgn(hrgn, -hdc->hwnd->clirect.left, + -hdc->hwnd->clirect.top); + + + hrgn = newrgn; + } + DeleteObject((HRGN)hdc->region); + hdc->region = (MWRGNOBJ *)hrgn; + + /* force recalc of clipregion*/ + cliphdc = NULL; + MwPrepareDC(hdc); + } + if(hrgn) + return ((MWRGNOBJ *)hrgn)->rgn->type; + return NULLREGION; +} + +/* update region is returned in client coordinates*/ +int WINAPI +GetUpdateRgn(HWND hwnd, HRGN hrgn, BOOL bErase) +{ + /* FIXME bErase*/ + if(!hwnd) + return ERROR; + + /* convert internal update region to client coords*/ + GdOffsetRegion(hwnd->update, -hwnd->clirect.left, -hwnd->clirect.top); + GdCopyRegion(((MWRGNOBJ *)hrgn)->rgn, hwnd->update); + GdOffsetRegion(hwnd->update, hwnd->clirect.left, hwnd->clirect.top); + return hwnd->update->type; +} +#endif /* UPDATEREGIONS*/ + +/* update rectangle is returned in client coords*/ +BOOL WINAPI +GetUpdateRect(HWND hwnd, LPRECT lpRect, BOOL bErase) +{ + /* FIXME bErase*/ + if(!hwnd) + return FALSE; +#if UPDATEREGIONS + if(lpRect) { + *lpRect = hwnd->update->extents; + /* convert to client coords*/ + ScreenToClient(hwnd, (LPPOINT)&lpRect->left); + ScreenToClient(hwnd, (LPPOINT)&lpRect->right); + } + + /* return TRUE if update region is non-empty*/ + return hwnd->update->type != NULLREGION; +#else + GetClientRect(hwnd, lpRect); + return TRUE; +#endif +} + +HBRUSH WINAPI +CreateSolidBrush(COLORREF crColor) +{ + MWBRUSHOBJ *hbr; + + hbr = GdItemNew(MWBRUSHOBJ); + if(!hbr) + return NULL; + hbr->hdr.type = OBJ_BRUSH; + hbr->hdr.stockobj = FALSE; + hbr->style = BS_SOLID; + hbr->color = crColor; + return (HBRUSH)hbr; +} + +HPEN WINAPI +CreatePen(int nPenStyle, int nWidth, COLORREF crColor) +{ + MWPENOBJ *hpen; + + /* fix: nWidth > 1*/ + hpen = GdItemNew(MWPENOBJ); + if(!hpen) + return NULL; + hpen->hdr.type = OBJ_PEN; + hpen->hdr.stockobj = FALSE; + hpen->style = nPenStyle; + hpen->color = crColor; + return (HPEN)hpen; +} + +HBITMAP WINAPI +CreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight) +{ + MWBITMAPOBJ * hbitmap; + int size; + int linelen; + + if(!hdc) + return NULL; + + nWidth = MWMAX(nWidth, 1); + nHeight = MWMAX(nHeight, 1); + + /* calc memory allocation size and linelen from width and height*/ + if(!GdCalcMemGCAlloc(hdc->psd, nWidth, nHeight, 0, 0, &size, &linelen)) + return NULL; + + /* allocate gdi object*/ + hbitmap = (MWBITMAPOBJ *)GdItemAlloc(sizeof(MWBITMAPOBJ)-1+size); + if(!hbitmap) + return NULL; + hbitmap->hdr.type = OBJ_BITMAP; + hbitmap->hdr.stockobj = FALSE; + hbitmap->width = nWidth; + hbitmap->height = nHeight; + + /* create compatible with hdc*/ + hbitmap->planes = hdc->psd->planes; + hbitmap->bpp = hdc->psd->bpp; + hbitmap->linelen = linelen; + hbitmap->size = size; + + return (HBRUSH)hbitmap; +} + +/* return NULL if no driver bitblit available*/ +HDC WINAPI +CreateCompatibleDC(HDC hdc) +{ + HDC hdcmem; + PSD psd; + PSD mempsd; + + /* allow NULL hdc to mean screen*/ + psd = hdc? hdc->psd: &scrdev; + + /* allocate memory device, if driver doesn't blit will fail*/ + mempsd = psd->AllocateMemGC(psd); + if(!mempsd) + return NULL; + + /* allocate a DC for DesktopWindow*/ + hdcmem = GetDCEx(NULL, NULL, DCX_DEFAULTCLIP); + if(!hdcmem) { + mempsd->FreeMemGC(mempsd); + return NULL; + } + hdcmem->psd = mempsd; + + /* select in default bitmap to setup mem device parms*/ + SelectObject(hdcmem, (HGDIOBJ)&default_bitmap); + return hdcmem; +} + +BOOL WINAPI +BitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, + HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop) +{ + /* use stretch blit with equal src and dest width/height*/ + return StretchBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, + hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); +} + +BOOL WINAPI +StretchBlt(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, + int nHeightDest, HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, + int nWidthSrc, int nHeightSrc, DWORD dwRop) +{ + + HWND hwnd; + POINT dst, src; + + if(!hdcDest || !hdcSrc) + return FALSE; + dst.x = nXOriginDest; + dst.y = nYOriginDest; + src.x = nXOriginSrc; + src.y = nYOriginSrc; + + /* if src screen DC, convert coords*/ + /* FIXME: src clipping isn't checked, only one set of cliprects also*/ + if(!MwIsMemDC(hdcSrc) && MwIsClientDC(hdcSrc)) { + if(!(hwnd = MwPrepareDC(hdcSrc))) + return FALSE; + ClientToScreen(hwnd, &src); + } + /* if dst screen DC, convert coords and set clipping*/ + /* FIXME: if dest is also screen, src clipping will be overwritten*/ + if(!MwIsMemDC(hdcDest) && MwIsClientDC(hdcDest)) { + if(!(hwnd = MwPrepareDC(hdcDest))) + return FALSE; + ClientToScreen(hwnd, &dst); + } + + if (nWidthDest == nWidthSrc && nHeightDest == nHeightSrc) { + GdBlit(hdcDest->psd, dst.x, dst.y, nWidthDest, nHeightDest, + hdcSrc->psd, src.x, src.y, dwRop); + } else { + GdStretchBlit(hdcDest->psd, dst.x, dst.y, + nWidthDest, nHeightDest, hdcSrc->psd, src.x, src.y, + nWidthSrc, nHeightSrc, dwRop); + } + return TRUE; +} + +UINT WINAPI +GetSystemPaletteEntries(HDC hdc,UINT iStartIndex,UINT nEntries, + LPPALETTEENTRY lppe) +{ + UINT i; + MWPALENTRY rgb; + + /* currently, we only work for screen device*/ + if(!hdc || hdc->psd != &scrdev) + return 0; + + for(i=0; ipsd, i+iStartIndex, 1, &rgb)) + break; + lppe->peRed = rgb.r; + lppe->peGreen = rgb.g; + lppe->peBlue = rgb.b; + lppe->peFlags = 0; + ++lppe; + } + return i; +} + +/* allow NULL hdc for scrdev*/ +int WINAPI +GetDeviceCaps(HDC hdc, int nIndex) +{ + PSD psd; + + if (!hdc) + psd = &scrdev; + else psd = hdc->psd; + + switch(nIndex) { + case HORZRES: + return psd->xvirtres; + case VERTRES: + return psd->yvirtres; + case BITSPIXEL: + return psd->bpp; + case PLANES: + return psd->planes; + case LOGPIXELSX: + case LOGPIXELSY: + return 96; + case SIZEPALETTE: + if (psd->bpp <= 8) + return psd->ncolors; + break; + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/Makefile b/packages/services/gfx/mw/current/src/mwin/winlib/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/Makefile @@ -0,0 +1,50 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr +############################################################################## + +ifndef TOP +TOP = ../.. +CONFIG = $(TOP)/config +endif + +include $(CONFIG) + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += +# Defines for preprocessor +DEFINES += + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +ifeq ($(MICROWIN), Y) + +# If you want to create a library with the objects files, define the name here +LIBNAME = libmwinlib.a +LIBNAMESO = libmwinlib.so + +# List of objects to compile +OBJS = draw3d.o ptinsid.o insetr.o fastfill.o graph3d.o mwuser.o + +ifneq ($(ARCH), ELKS) +OBJS += button.o edit.o listbox.o progbar.o static.o combobox.o caret.o \ + scrlbar.o medit.o +endif + +endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### + diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/button.c b/packages/services/gfx/mw/current/src/mwin/winlib/button.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/button.c @@ -0,0 +1,898 @@ +#include "windows.h" +#include "windowsx.h" +#include "wintools.h" +/* + * WINCTL Custom Control Library + * Push button Custom Control + * This control implements a custom pushbutton control. + * + * 4/8/98 g haerr original version from control palette v2.00, Blaise Computing + */ + +#define GET_PBSTATE(h) (GetWindowWord(h, 0)) +#define GET_PBCAPTURE(h) (GetWindowWord(h, 2)) +#define GET_PBWASINSIDE(h) (GetWindowWord(h, 4)) +#define GET_PBDELETEFONT(h) (GetWindowWord(h, 6)) +#define GET_PBFONT(h) (GetWindowWord(h, 8)) + +#define SET_PBSTATE(h,x) (SetWindowWord(h, 0, x)) +#define SET_PBCAPTURE(h,x) (SetWindowWord(h, 2, x)) +#define SET_PBWASINSIDE(h,x) (SetWindowWord(h, 4, x)) +#define SET_PBDELETEFONT(h,x) (SetWindowWord(h, 6, x)) +#define SET_PBFONT(h,x) (SetWindowWord(h, 8, x)) + +#define PARENT(hwnd) ((HWND)GetWindowLong(hwnd,GWL_HWNDPARENT)) + +/* Internal state variable bit positions */ +#define PUSH_UP 0x0000 +#define PUSH_DOWN 0x0001 /* Button is down */ +#define PUSH_FOCUS 0x0002 /* Button is focused */ +#define PUSH_DISABLED 0x0004 /* Button is disabled */ +#define PUSH_DEFAULT 0x0008 /* Button is currently a default */ +#define PUSH_CHECKED 0x0010 + +/* Push Button states */ +#define PBS_UP 0x0000 /* Normal button state. */ +#define PBS_FOCUSDOWN 0x0001 /* Button pressed. */ +#define PBS_FOCUSUP 0x0002 /* Focused state. */ +#define PBS_DISABLED 0x0004 /* Disabled state. */ +#define PBS_DEFAULT 0x0008 /* Default state. */ +#define PBS_CHECKED 0x0010 /* checked state. */ + +#define WM_PAINT_SPECIAL WM_PAINT +#define HANDLE_WM_PAINT_SPECIAL(hwnd, wParam, lParam, fn) \ + ((fn)((hwnd),(HDC)(wParam)), 0L) + +/* BOOL Cls_OnGetState( HWND hwnd); */ +#define HANDLE_BM_GETSTATE(hwnd, wParam, lParam, fn) ((fn)(hwnd)) +#define FORWARD_BM_GETSTATE(hwnd) \ + (LONG)(fn)((hwnd), BM_GETSTATE, (WPARAM)0, (LPARAM)0) + +/* void Cls_OnSetState( HWND hwnd, WORD wState); */ +#define HANDLE_BM_SETSTATE( hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), (WORD)wParam), 0) +#define FORWARD_BM_SETSTATE( hwnd, wState) \ + (fn)((hwnd), BM_SETSTATE, (WPARAM)wState, (LPARAM)0) + +/* void Cls_OnSetStyle( HWND hwnd, WORD style, BOOL bRedraw); */ +#define HANDLE_BM_SETSTYLE( hwnd, wParam, lParam, fn) \ + ((fn)((hwnd), (WORD)wParam, (BOOL)LOWORD(lParam)), 0) +#define FORWARD_BM_SETSTYLE( hwnd, style, bRedraw, fn) \ + (fn)((hwnd), BM_SETSTYLE, (WPARAM)style, MAKELPARAM(bRedraw, 0)) + +/* entry points*/ +void WINAPI CheckRadioButton(HWND hDlg, int nIDFirst,int nIDLast, + int nIDCheckButton); + +/* local procs*/ +static void WINAPI cenButton_FnEnd( HWND, WORD); +static WORD WINAPI cenButton_FnStart( HWND); +static BOOL WINAPI cenButton_OnCreate( HWND, LPCREATESTRUCT); +/*static void WINAPI cenButton_OnDestroy( HWND);*/ +/*static void WINAPI cenButton_OnEnable( HWND, BOOL);*/ +static BOOL WINAPI cenButton_OnEraseBkgnd( HWND, HDC); +/*static UINT WINAPI cenButton_OnGetDlgCode( HWND, LPMSG);*/ +static LONG WINAPI cenButton_OnGetState( HWND); +/*static void WINAPI cenButton_OnKey( HWND, UINT, BOOL, int, UINT);*/ +static void WINAPI cenButton_OnKillFocus( HWND, HWND); +static void WINAPI cenButton_OnLButtonDown( HWND, BOOL, UINT, UINT, UINT); +static void WINAPI cenButton_OnLButtonUp( HWND, UINT, UINT, UINT); +static void WINAPI cenButton_OnMouseMove( HWND, UINT, UINT, UINT); +static void WINAPI cenButton_OnPaint( HWND, HDC); +static void WINAPI DrawPushButton(HWND hwnd,HDC hDCwParam,UINT wEnumState, + DWORD dwStyle); +static void WINAPI DrawGroupBox(HWND hwnd,HDC hDCwParam, DWORD dwStyle); +static void WINAPI cenButton_OnSetFocus( HWND, HWND); +static void WINAPI cenButton_OnSetStyle( HWND, WORD, BOOL); +static void WINAPI cenButton_OnSetState( HWND, WORD); +static void WINAPI cenButton_SetState( HWND, WORD, BOOL); +static void WINAPI cenButton_OnSetText( HWND, LPCSTR); + +static void WINAPI +cenButton_FnEnd( +HWND hwnd, +WORD wState) +{ + if( wState != GET_PBSTATE( hwnd)) { + if( IsWindowVisible( hwnd)) + UpdateWindow( hwnd); + } +} + +static WORD WINAPI +cenButton_FnStart( +HWND hwnd) +{ + return GET_PBSTATE( hwnd); +} + +static BOOL WINAPI +cenButton_OnCreate( +HWND hwnd, +LPCREATESTRUCT lpCreate) +{ + /* Set initial states */ + /*SET_PBDELETEFONT( hwnd, FALSE);*/ + /*SET_PBFONT( hwnd, NULL);*/ + SET_PBSTATE( hwnd, PUSH_UP ); + SET_PBCAPTURE( hwnd, FALSE ); + SET_PBWASINSIDE( hwnd, FALSE ); + + if ((lpCreate->style & 0x0f) == BS_DEFPUSHBUTTON) + cenButton_SetState( hwnd, PUSH_DEFAULT, TRUE ); + + if (lpCreate->style & WS_DISABLED) + cenButton_SetState( hwnd, PUSH_DISABLED, TRUE ); + + return( TRUE); +} + +#if 0 +static void WINAPI +cenButton_OnDestroy( +HWND hwnd) +{ + if( GET_PBDELETEFONT( hwnd)) { + DeleteObject( GET_PBFONT( hwnd)); + SET_PBDELETEFONT( hwnd, FALSE); + } +} + +static void WINAPI +cenButton_OnEnable( +HWND hwnd, +BOOL bEnable) +{ + WORD wState; + + wState = cenButton_FnStart( hwnd); + cenButton_SetState( hwnd, PUSH_DISABLED, !bEnable); + cenButton_FnEnd( hwnd, wState); +} +#endif + +static BOOL WINAPI +cenButton_OnEraseBkgnd( +HWND hwnd, +HDC hdc) +{ + /* Background is erased at WM_PAINT time, so return TRUE*/ + return TRUE; +} + +#if 0 +static UINT WINAPI +cenButton_OnGetDlgCode( +HWND hwnd, +LPMSG lpMsg) +{ + /* WM_GETDLGCODE is sent by the dialog manager to find */ + /* what type/style of control is responding and/or to */ + /* determine what keystrokes the control wants to process */ + /* itself. In this case, the pushbutton identifies itself */ + /* and also indicates whether it is currently the default */ + /* pushbutton. */ + + /*return( DLGC_BUTTON | ((GET_PBSTATE( hwnd) & PUSH_DEFAULT) ? + DLGC_DEFPUSHBUTTON : DLGC_UNDEFPUSHBUTTON));*/ + return( DLGC_BUTTON); +} +#endif + +static LONG WINAPI +cenButton_OnGetState( +HWND hwnd) +{ + /* BM_GETSTATE is sent to enquire about the state of the */ + /* control. It returns TRUE if the button is in the down */ + /* state. */ + + return( ( GET_PBSTATE( hwnd) & PUSH_DOWN) == PUSH_DOWN); +} + +#if 0 +static void WINAPI +cenButton_OnKey( +HWND hwnd, +UINT vk, +BOOL bDown, +int cRepeat, +UINT flag) +{ + WORD wState; + + wState = cenButton_FnStart( hwnd); + if (bDown) { + /* WM_KEYDOWN is sent when a non-system key is pressed. */ + /* If a spacebar is detected and the previous key state */ + /* was up, then the control should switch to the down */ + /* state. */ + + if ( (vk == ' ') && !(HIBYTE(flag) & 0x40) ) + cenButton_SetState( hwnd, PUSH_DOWN, TRUE ); + } + else { + /* WM_KEYUP is sent when a non-system key is released. */ + /* If a space bar is detected, change to the up state. If */ + /* the control is the focused control, send the BN_CLICKED */ + /* notification message. */ + + if ( vk == ' ' ) + { cenButton_SetState( hwnd, PUSH_DOWN, FALSE ); + + if (GET_PBSTATE( hwnd) & PUSH_FOCUS) { + FORWARD_WM_COMMAND( PARENT( hwnd), GetDlgCtrlID( hwnd), + hwnd, BN_CLICKED, SendMessage); + if(!IsWindow(hwnd)) + return; + } + } + } + cenButton_FnEnd( hwnd, wState); +} +#endif + +static void WINAPI +cenButton_OnKillFocus( +HWND hwnd, +HWND hwndNewFocus) +{ + WORD wState; + + wState = cenButton_FnStart( hwnd); + cenButton_SetState( hwnd, PUSH_FOCUS, FALSE ); + cenButton_FnEnd( hwnd, wState); +} + +static void WINAPI +cenButton_OnLButtonDown( +HWND hwnd, +BOOL bDblClick, +UINT x, +UINT y, +UINT keyState) +{ + WORD wState; + + wState = cenButton_FnStart( hwnd); + /* capture the mouse*/ + SetCapture( hwnd ); + /* set focus to ourself*/ + SetFocus( hwnd ); + SET_PBCAPTURE( hwnd, TRUE ); + SET_PBWASINSIDE( hwnd, TRUE ); + /* set down state*/ + cenButton_SetState( hwnd, PUSH_DOWN, TRUE ); + cenButton_FnEnd( hwnd, wState); +} + +static void WINAPI +cenButton_OnLButtonUp( +HWND hwnd, +UINT x, +UINT y, +UINT keys) +{ + WORD wState; + DWORD dwStyle; + + dwStyle = GetWindowLong(hwnd, GWL_STYLE); + wState = cenButton_FnStart( hwnd); + + /* only draw up state if we captured mouse*/ + if(GetCapture() == hwnd) + cenButton_SetState( hwnd, PUSH_DOWN, FALSE ); + /* release mouse capture*/ + ReleaseCapture(); + + /* if cursor is inside control, send clicked notification to parent*/ + if (GET_PBWASINSIDE( hwnd)) { + switch((int)(dwStyle & 0x0f)) { + case BS_AUTOCHECKBOX: + SendMessage(hwnd,BM_SETCHECK,(wState & PBS_CHECKED)?0:1,0L); + break; + case BS_AUTORADIOBUTTON: + CheckRadioButton(PARENT(hwnd),0,0xffff,hwnd->id); + break; + } + FORWARD_WM_COMMAND( PARENT( hwnd), GetDlgCtrlID( hwnd), hwnd, + BN_CLICKED, SendMessage); + if(!IsWindow(hwnd)) + return; + } + + SET_PBCAPTURE( hwnd, FALSE ); + SET_PBWASINSIDE( hwnd, FALSE ); + cenButton_FnEnd( hwnd, wState); +} + +static void WINAPI +cenButton_OnMouseMove( +HWND hwnd, +UINT x, +UINT y, +UINT keys) +{ + /* WM_MOUSEMOVE is sent at every discernable mouse */ + /* movement. It is necessary to detect this because if */ + /* the mouse has been captured (because of a button down */ + /* message), the location of the cursor needs to be */ + /* tracked. If it moves out of the confines of the */ + /* control, the control should change to the focus/up */ + /* state (and retain capture.) If the cursor then moves */ + /* back into the control, change back to the down state. */ + + WORD wState; + DWORD dwStyle; + + wState = cenButton_FnStart( hwnd); + dwStyle = GetWindowLong(hwnd, GWL_STYLE); + if( GET_PBCAPTURE( hwnd)) { + if( !PtInsideWindow( hwnd, x, y) ) { + if( GET_PBWASINSIDE( hwnd)) { + cenButton_SetState( hwnd, PUSH_DOWN, FALSE); + SET_PBWASINSIDE( hwnd, FALSE ); + } + } else { + if( !GET_PBWASINSIDE( hwnd) ) { + cenButton_SetState( hwnd, PUSH_DOWN, TRUE ); + SET_PBWASINSIDE( hwnd, TRUE ); + } + } + } + cenButton_FnEnd( hwnd, wState); +} + +static void WINAPI +cenButton_OnPaint( +HWND hwnd, +HDC hDCwParam) +{ + UINT wEnumState; + DWORD dwStyle; + + if( GET_PBSTATE( hwnd) & PUSH_DISABLED) + wEnumState = PBS_DISABLED; + else if( GET_PBSTATE( hwnd) & PUSH_DOWN) + wEnumState = PBS_FOCUSDOWN; + else if( GET_PBSTATE( hwnd) & PUSH_CHECKED) + wEnumState = PBS_CHECKED; + else + { + if( GET_PBSTATE( hwnd) & PUSH_FOCUS) + wEnumState = PBS_FOCUSUP; + else + wEnumState = PBS_UP; + if( GET_PBSTATE( hwnd) & PUSH_DEFAULT) + wEnumState |= PBS_DEFAULT; + } + + /* common draw code for button and checkbox*/ + dwStyle = GetWindowLong(hwnd, GWL_STYLE); + switch((int)(dwStyle & 0x0f)) { + case BS_GROUPBOX: + DrawGroupBox( hwnd, hDCwParam, dwStyle); + break; + default: + DrawPushButton( hwnd, hDCwParam, wEnumState, dwStyle); + } +} + +static void WINAPI +DrawPushButton(HWND hwnd,HDC hDCwParam,UINT wEnumState,DWORD dwStyle) +{ + HDC hdc; + HBRUSH hNewBrush; + RECT rect; + RECT rectClient; + RECT rectSave; + RECT rc; + int iFaceOffset = 0; + INT uiHeight; + INT uiWidth; + COLORREF crOld; + COLORREF crBkOld; + int oldBkMode; + HFONT hNewFont; + HFONT hOldFont; + HPEN hOldPen; + COLORREF hOldColor; + PAINTSTRUCT ps; + char buf[256]; +#define uiWidthFrame 0 +#define uiWidthShadow 2 + + hdc = BeginPaint(hwnd, &ps); + if(!hdc) + goto Return; + + GetWindowText(hwnd, buf, sizeof(buf)); + GetClientRect( hwnd, &rectClient ); + uiWidth = rectClient.right - rectClient.left; + uiHeight = rectClient.bottom - rectClient.top; + + hNewBrush = (HBRUSH) GetStockObject(LTGRAY_BRUSH); + crOld = SetTextColor( hdc, GetSysColor( COLOR_BTNTEXT)); + crBkOld = SetBkColor( hdc, GetSysColor( COLOR_BTNFACE)); + + rc = rectClient; + switch((int)(dwStyle & 0x0f)) { + case BS_PUSHBUTTON: + case BS_DEFPUSHBUTTON: + if( wEnumState & PBS_FOCUSDOWN) { + Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_WINDOWFRAME), GetSysColor(COLOR_WINDOWFRAME)); + InsetR(&rc, 1, 1); + Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNSHADOW)); + InsetR(&rc, 1, 1); + FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE)); + iFaceOffset = 1; + } else { + if(wEnumState & PBS_DEFAULT) { + Draw3dBox(hdc, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_WINDOWFRAME), + GetSysColor(COLOR_WINDOWFRAME)); + InsetR(&rc, 1, 1); + } + Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_BTNHIGHLIGHT),GetSysColor(COLOR_WINDOWFRAME)); + InsetR(&rc, 1, 1); + Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_3DLIGHT), GetSysColor(COLOR_BTNSHADOW)); + InsetR(&rc, 1, 1); + FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE)); + iFaceOffset = 0; + } + break; + + case BS_CHECKBOX: + case BS_AUTOCHECKBOX: + FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE)); + /*rc.left += 2;*/ + /*rc.top += 2;*/ + rc.right = rc.left + 12; + rc.bottom = rc.top + 12; + /*Draw3dBox(hdc, rc.left, rc.top, 8, 8, + GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_3DLIGHT));*/ + Draw3dInset(hdc, rc.left, rc.top, 12, 12); + InsetR(&rc, 2, 2); + FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNHIGHLIGHT)); + iFaceOffset = 1; + if(wEnumState & PBS_CHECKED) { + MoveToEx(hdc, rc.left, rc.top,NULL); + LineTo(hdc, rc.right, rc.bottom); + MoveToEx(hdc, rc.left, rc.bottom,NULL); + LineTo(hdc, rc.right, rc.top); + } + break; + + case BS_AUTORADIOBUTTON: + case BS_RADIOBUTTON: + FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE)); + rc.left = 0; + rc.top += 1; + rc.right = rc.left + 10; + rc.bottom = rc.top + 10; + + SelectObject(hdc, GetStockObject(NULL_BRUSH)); + hOldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, + GetSysColor(COLOR_BTNSHADOW))); + SelectObject(hdc, GetStockObject(WHITE_BRUSH)); + Ellipse(hdc,rc.left,rc.top, rc.right,rc.bottom); + InsetR(&rc, 1, 1); + + SelectObject(hdc, GetStockObject(WHITE_BRUSH)); + DeleteObject(SelectObject(hdc, + CreatePen(PS_SOLID, 1,GetSysColor(COLOR_WINDOWFRAME)))); + Ellipse(hdc,rc.left,rc.top, rc.right,rc.bottom); + DeleteObject(SelectObject(hdc, hOldPen)); + + iFaceOffset = 0; + if(wEnumState & PBS_CHECKED) + Ellipse(hdc, rc.left+2, rc.top+2, rc.right-2, + rc.bottom-2); + break; + } + + /* + * draw text + */ + if(buf[ 0]) { + hNewFont = GetStockObject( DEFAULT_GUI_FONT); + hOldFont = SelectObject( hdc, hNewFont); + + /* calculate text bounding rect*/ + rect.left = 0; + rect.top = 0; + DrawText( hdc, buf, -1, &rect, DT_CALCRECT | DT_LEFT | + DT_SINGLELINE | DT_TOP); + rectSave = rect; + + /* + * calculate text draw location + */ + switch((int)(dwStyle & (BS_LEFT|BS_CENTER|BS_RIGHT))) { + case BS_CENTER: + default: + rect.left = (uiWidth - (rect.right - rect.left)) / 2 + + iFaceOffset; + break; + case BS_LEFT: + rect.left = uiWidthFrame + uiWidthShadow + 2 + + iFaceOffset; + break; + case BS_RIGHT: + rect.left = (rect.right - rect.left) + uiWidthFrame + + uiWidthShadow + 4 + iFaceOffset; + break; + } + + switch((int)(dwStyle & 0x0f)) { + case BS_CHECKBOX: + case BS_AUTOCHECKBOX: + case BS_AUTORADIOBUTTON: + case BS_RADIOBUTTON: + rect.left = 12; + break; + } + + rect.right += rect.left - rectSave.left; + + switch((int)(dwStyle & (BS_TOP|BS_VCENTER|BS_BOTTOM))) { + case BS_VCENTER: + default: + rect.top = (uiHeight - (rect.bottom - rect.top)) / 2 + + iFaceOffset; + break; + case BS_TOP: + rect.top = 2 + uiWidthFrame + uiWidthShadow + + iFaceOffset; + break; + case BS_BOTTOM: + rect.top = uiHeight - uiWidthFrame - uiWidthShadow - + (rect.bottom - rect.top) - 1 + iFaceOffset; + break; + } + switch((int)(dwStyle & 0x0f)) { + case BS_CHECKBOX: + case BS_AUTOCHECKBOX: + case BS_AUTORADIOBUTTON: + case BS_RADIOBUTTON: + rect.top = 0; + break; + } + rect.bottom += rect.top - rectSave.top; + + oldBkMode = SetBkMode( hdc, TRANSPARENT); + if(wEnumState & PBS_DISABLED) + hOldColor = SetTextColor( hdc, + GetSysColor( COLOR_GRAYTEXT)); + else + hOldColor = SetTextColor( hdc, + GetSysColor( COLOR_BTNTEXT)); + + DrawText( hdc, buf, -1, &rect,DT_LEFT | DT_SINGLELINE | DT_TOP); + + SetBkMode( hdc, oldBkMode); + SetTextColor( hdc, hOldColor); + SelectObject( hdc, hOldFont); + } + +#if 0 + if( (!(wEnumState&PBS_CHECKED) && (wEnumState&PBS_FOCUSDOWN)) || + (wEnumState & PBS_FOCUSUP)) { + rect = rectClient; + uiWidth = uiWidthFrame + uiWidthShadow + 2; + rect.left += uiWidth; + rect.top += uiWidth; + rect.right -= uiWidth; + rect.bottom -= uiWidth; + if((dwStyle & (BS_FLAT|BS_NOFOCUSRECT)) == 0) + DrawFocusRect( hdc, &rect); + } +#endif + + SetTextColor( hdc, crOld); + SetBkColor( hdc, crBkOld); + +Return: + EndPaint(hwnd, &ps); +} + +static void WINAPI +cenButton_OnSetFocus( +HWND hwnd, +HWND hwndOldFocus) +{ + /* WM_SETFOCUS is sent when the user clicks on the control */ + /* or when the dialog manager determines that a keystroke */ + /* should cause the control to be focused. This affects */ + /* the appearance of the control so the state is saved for */ + /* future drawing. */ + + WORD wState; + + wState = cenButton_FnStart( hwnd); + /*if(!IsWindowEnabled(hwnd)) + cenButton_SetState( hwnd, PUSH_FOCUS, TRUE );*/ + cenButton_FnEnd( hwnd, wState); +} + +static void WINAPI +cenButton_OnSetStyle( +HWND hwnd, +WORD style, +BOOL bRedraw) +{ + WORD wState; + + wState = cenButton_FnStart( hwnd); + cenButton_SetState( hwnd, PUSH_DEFAULT, + (style & 0x0f) == BS_DEFPUSHBUTTON); + cenButton_FnEnd( hwnd, wState); +} + +static void WINAPI +cenButton_OnSetState( +HWND hwnd, +WORD wState) +{ + WORD wStateOld; + + wStateOld = cenButton_FnStart( hwnd); + cenButton_SetState( hwnd, PUSH_DOWN, (wState ? TRUE : FALSE ) ); + cenButton_FnEnd( hwnd, wStateOld); +} + +static void WINAPI +cenButton_SetState( +HWND hwnd, +WORD wState, +BOOL bEnable ) +{ + /* Turn on/off state bits according to the bEnable flag. If the */ + /* new state is different, invalidate the client window so that */ + /* the proper bitmap is displayed. */ + + WORD wNewState; + WORD wOldState; + RECT rectClient; + + wOldState = GET_PBSTATE( hwnd); + wNewState = (bEnable ? (wOldState | wState) : (wOldState & ~wState)); + + if (wOldState != wNewState) + { SET_PBSTATE( hwnd, wNewState ); + GetClientRect(hwnd, &rectClient); + InvalidateRect(hwnd, &rectClient, FALSE); + } +} + +#if 0 +static void WINAPI +cenButton_OnSetFont( +HWND hwnd, +HFONT hFont, +BOOL bRedraw) +{ + BOOL bDeleteFont = FALSE; + HFONT hFontNew = 0; + LOGFONT logFont; + + /* create a thin font*/ + if( GetObject( hFont, sizeof( logFont), &logFont) != 0) { + if( logFont.lfWeight != FW_NORMAL) { + logFont.lfWeight = FW_NORMAL; + if( ( hFontNew = CreateFontIndirect( &logFont)) != 0) { + hFont = hFontNew; + bDeleteFont = TRUE; + } + } + } + + if( GET_PBDELETEFONT( hwnd)) + DeleteObject( GET_PBFONT( hwnd)); + + SET_PBDELETEFONT( hwnd, bDeleteFont); + SET_PBFONT( hwnd, hFont); + + FORWARD_WM_SETFONT( hwnd, hFont, bRedraw, DefWindowProc); +} +#endif + +static void WINAPI +cenButton_OnSetText( +HWND hwnd, +LPCSTR lpszText) +{ + /* WM_SETTEXT is sent to change the text of the button */ + /* control. In this case we allow the default window proc */ + /* to handle the message first. But this only affects the */ + /* internal Windows data structure of the control, it does */ + /* not display the change. To do this we invalidate and */ + /* update the client area of the control which displays */ + /* the new text. */ + + FORWARD_WM_SETTEXT( hwnd, lpszText, DefWindowProc); + InvalidateRect( hwnd, NULL, FALSE); + UpdateWindow( hwnd); +} + +LRESULT CALLBACK +cenButtonWndFn( +HWND hwnd, +UINT message, +WPARAM wParam, +LPARAM lParam) +{ + /* This is the window proc for the pushbutton control. Most of */ + /* the drawing is accomplished in the DrawPushButton() function. */ + /* The code below is mainly concerned with the keyboard and mouse */ + /* events that the control detects. */ + + switch( message) { + HANDLE_MSG( hwnd, WM_CREATE, cenButton_OnCreate); + /*HANDLE_MSG( hwnd, WM_ENABLE, cenButton_OnEnable);*/ + HANDLE_MSG( hwnd, WM_SETFOCUS, cenButton_OnSetFocus); + HANDLE_MSG( hwnd, WM_KILLFOCUS, cenButton_OnKillFocus); + HANDLE_MSG( hwnd, WM_LBUTTONDOWN, cenButton_OnLButtonDown); + HANDLE_MSG( hwnd, WM_LBUTTONDBLCLK, cenButton_OnLButtonDown); + HANDLE_MSG( hwnd, WM_LBUTTONUP, cenButton_OnLButtonUp); + HANDLE_MSG( hwnd, WM_MOUSEMOVE, cenButton_OnMouseMove); + /*HANDLE_MSG( hwnd, WM_KEYDOWN, cenButton_OnKey);*/ + /*HANDLE_MSG( hwnd, WM_KEYUP, cenButton_OnKey);*/ + HANDLE_MSG( hwnd, WM_ERASEBKGND, cenButton_OnEraseBkgnd); + HANDLE_MSG( hwnd, WM_PAINT_SPECIAL, cenButton_OnPaint); + /*HANDLE_MSG( hwnd, WM_GETDLGCODE, cenButton_OnGetDlgCode);*/ + HANDLE_MSG( hwnd, BM_SETSTYLE, cenButton_OnSetStyle); + HANDLE_MSG( hwnd, BM_GETSTATE, cenButton_OnGetState); + HANDLE_MSG( hwnd, BM_SETSTATE, cenButton_OnSetState); + /*HANDLE_MSG( hwnd, WM_DESTROY, cenButton_OnDestroy);*/ + /*HANDLE_MSG( hwnd, WM_SETFONT, cenButton_OnSetFont);*/ + HANDLE_MSG( hwnd, WM_SETTEXT, cenButton_OnSetText); + + case BM_GETCHECK: +#if 0 + return cenButton_OnGetState(hwnd); +#else + return( ( GET_PBSTATE(hwnd) & PUSH_CHECKED) == PUSH_CHECKED); +#endif + + case BM_SETCHECK: +#if 0 + cenButton_OnSetState(hwnd, (WORD)wParam); +#else +{ + WORD wStateOld; + + wStateOld = cenButton_FnStart( hwnd); + cenButton_SetState( hwnd, PUSH_CHECKED, + ((WORD)wParam ? TRUE : FALSE) ); + cenButton_FnEnd( hwnd, wStateOld); +} +#endif + return 0; + } + + return DefWindowProc( hwnd, message, wParam, lParam); +} + +/* backwards compatibility*/ +int WINAPI +MwButtonRegister(HINSTANCE hInstance) +{ + return MwRegisterButtonControl(hInstance); +} + +int WINAPI +MwRegisterButtonControl(HINSTANCE hInstance) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)cenButtonWndFn; + wc.cbClsExtra = 0; + wc.cbWndExtra = 10; + wc.hInstance = hInstance; + wc.hIcon = NULL; + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground= GetStockObject(LTGRAY_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName= "BUTTON"; + + return RegisterClass(&wc); +} + +static void WINAPI +DrawGroupBox(HWND hwnd,HDC hDCwParam,DWORD dwStyle) +{ + HDC hdc; + HFONT hFont; + RECT rcClient; + RECT rcText; + RECT rc; + PAINTSTRUCT ps; + char buf[256]; + HPEN hPenTop, hPenBottom, holdPen; + COLORREF crTop,crBottom; + + + hdc = BeginPaint(hwnd, &ps); + if(!hdc) + goto Return; + + GetWindowText(hwnd, buf, sizeof(buf)); + GetClientRect( hwnd, &rcClient ); + + hFont = GetStockObject( DEFAULT_GUI_FONT); + if (hFont) + hFont = SelectObject(hdc,hFont); + + rc.left = 0; + rc.top = 0; + DrawText( hdc, buf, -1, &rc, DT_CALCRECT); + + if(buf[ 0]) { + SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT)); + SetBkMode(hdc,TRANSPARENT); + SetRect(&rcText,8,2,rc.right+8,rc.bottom+2); + DrawText(hdc,buf,-1,&rcText,DT_CENTER); + } + + crTop=GetSysColor(COLOR_BTNHIGHLIGHT); + crBottom=GetSysColor(COLOR_BTNSHADOW); + + hPenTop = CreatePen( PS_SOLID, 1, crTop); + hPenBottom = CreatePen( PS_SOLID, 1, crBottom); + holdPen = SelectObject( hdc, hPenTop); + + MoveToEx(hdc,0,rc.bottom/2,NULL); + + if(buf[ 0]) { + LineTo(hdc,5,rc.bottom/2); + MoveToEx(hdc,rc.right+11,rc.bottom/2,NULL); + LineTo(hdc,rcClient.right-1,rc.bottom/2); + } + else + LineTo(hdc,rcClient.right-1,rc.bottom/2); + + LineTo(hdc,rcClient.right-1,rcClient.bottom-1); + + SelectObject( hdc, hPenBottom); + LineTo(hdc,rcClient.left,rcClient.bottom-1); + LineTo(hdc,rcClient.left,rc.bottom/2); + + SelectObject( hdc, holdPen); + DeleteObject( hPenTop); + DeleteObject( hPenBottom); + + if (hFont) + SelectObject(hdc,hFont); + +Return: + EndPaint(hwnd, &ps); +} + +/* temporarily here, should move to winuser.c*/ +void WINAPI +CheckRadioButton(HWND hDlg, int nIDFirst,int nIDLast,int nIDCheckButton) +{ + HWND hWndCheck,hWndTemp; + DWORD dwStyle; + + if (!(hWndCheck = GetDlgItem(hDlg,nIDCheckButton))) + return; + + for(hWndTemp=hDlg->children; hWndTemp; hWndTemp=hWndTemp->siblings) { + if(hWndCheck == hWndTemp) continue; + dwStyle = GetWindowLong(hWndTemp,GWL_STYLE); + if ((hWndTemp->id >= (WORD)nIDFirst) && + (hWndTemp->id <= (WORD)nIDLast) && + ((LOWORD(dwStyle) == BS_RADIOBUTTON) || + (LOWORD(dwStyle) == BS_AUTORADIOBUTTON))) + SendMessage(hWndTemp,BM_SETCHECK,FALSE,0); + } + SendMessage(hWndCheck,BM_SETCHECK,TRUE,0); +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/caret.c b/packages/services/gfx/mw/current/src/mwin/winlib/caret.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/caret.c @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2000 Greg Haerr + * + * Caret control for Microwindows win32 api. + * + * TODO: add SetSysTimer for blinking + */ +#include +#include +#include +#ifndef __ECOS +#include +#endif +#include "windows.h" +#include "device.h" + +#define DEF_BLINK_TIME 500 /* default blink time in ms*/ + +typedef struct { + HWND hwnd; /* != NULL if caret is created*/ + int x; + int y; + int nWidth; + int nHeight; + BOOL fShown; /* caret is currently visible*/ + int nShowCount; /* <= 0 for hidden caret*/ + UINT nBlinkTime; +} CARETINFO; + +/* local data*/ +static CARETINFO sysCaret; /* the system caret*/ + +/* local procs*/ +static void MwShowCaret(void); +static void MwHideCaret(void); +static void MwUpdateCaret(void); + +BOOL WINAPI +CreateCaret(HWND hwnd, HBITMAP hBitmap, int nWidth, int nHeight) +{ + + DestroyCaret(); /* destroy old caret if any*/ + + if (nWidth <= 0) + nWidth = 1; + if (nHeight <= 0) + nHeight = 1; + + sysCaret.hwnd = hwnd; + sysCaret.x = 0; + sysCaret.y = 0; + sysCaret.nWidth = nWidth; + sysCaret.nHeight = nHeight; + sysCaret.fShown = FALSE; + sysCaret.nShowCount = 0; + sysCaret.nBlinkTime = DEF_BLINK_TIME; + return TRUE; +} + +BOOL WINAPI +DestroyCaret(VOID) +{ + if (sysCaret.fShown) + MwHideCaret(); + sysCaret.hwnd = NULL; + sysCaret.fShown = FALSE; + return TRUE; +} + +BOOL WINAPI +HideCaret(HWND hwnd) +{ + if (hwnd == NULL) + hwnd = sysCaret.hwnd; + if (hwnd == NULL || hwnd != sysCaret.hwnd) + return FALSE; + + /* hide caret if this call made it invisible*/ + if (--sysCaret.nShowCount == 0) { + MwHideCaret(); + return TRUE; + } + return FALSE; +} + +BOOL WINAPI +ShowCaret(HWND hwnd) +{ + if (hwnd == NULL) + hwnd = sysCaret.hwnd; + if (hwnd == NULL || hwnd != sysCaret.hwnd || sysCaret.nShowCount < 0) + return FALSE; + + if (++sysCaret.nShowCount > 1) + return TRUE; + + /* show caret, this call made it visible*/ + MwShowCaret(); + return TRUE; +} + +BOOL WINAPI +SetCaretPos(int nX, int nY) +{ + if (sysCaret.fShown && (sysCaret.x != nX || sysCaret.y != nY)) { + MwUpdateCaret(); /* toggle off*/ + sysCaret.x = nX; + sysCaret.y = nY; + MwUpdateCaret(); /* toggle on in new location*/ + return TRUE; + } + sysCaret.x = nX; + sysCaret.y = nY; + return TRUE; +} + +BOOL WINAPI +GetCaretPos(LPPOINT lpPoint) +{ + lpPoint->x = sysCaret.x; + lpPoint->y = sysCaret.y; + return TRUE; +} + +UINT WINAPI +GetCaretBlinkTime(VOID) +{ + return sysCaret.nBlinkTime; +} + +BOOL WINAPI +SetCaretBlinkTime(UINT uMSeconds) +{ + sysCaret.nBlinkTime = uMSeconds; + /* SetSysTimer */ + return TRUE; +} + +static void +MwShowCaret(void) +{ + if (sysCaret.fShown) + return; + MwUpdateCaret(); + sysCaret.fShown = TRUE; +} + +static void +MwHideCaret(void) +{ + if (!sysCaret.fShown) + return; + MwUpdateCaret(); + sysCaret.fShown = FALSE; +} + +/* Draw the caret using XOR. Same routine is used to show and hide caret.*/ +static void +MwUpdateCaret(void) +{ + int oldmode; + HDC hdc; + HPEN hpen; + HBRUSH hbr; + + oldmode = GdSetMode(MWMODE_XOR); + hdc = GetDC(sysCaret.hwnd); + hpen = SelectObject(hdc, GetStockObject(WHITE_PEN)); + + /* it seems there's some problems with Rectangle with nWidth == 1*/ + if (sysCaret.nWidth == 1) { + MoveToEx(hdc, sysCaret.x, sysCaret.y, NULL); + LineTo(hdc, sysCaret.x, sysCaret.y+sysCaret.nHeight); + } else { + hbr = SelectObject(hdc, GetStockObject(WHITE_BRUSH)); + Rectangle(hdc, sysCaret.x, sysCaret.y, + sysCaret.x+sysCaret.nWidth, + sysCaret.y+sysCaret.nHeight); + SelectObject(hdc, hbr); + } + SelectObject(hdc, hpen); + ReleaseDC(sysCaret.hwnd, hdc); + GdSetMode(oldmode); +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/combobox.c b/packages/services/gfx/mw/current/src/mwin/winlib/combobox.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/combobox.c @@ -0,0 +1,1785 @@ +/*-------------------------------------------------------------------------- +** ComboBox.c Twin From: Twin/controls +** +** +**------------------------- < License Information > ------------------------ +** +** This file was originally a part of Willows TWIN. Willows +** TWIN was released under a Library GPL (LGPL). This permits +** redistribution of this source code, provided that the full +** TWIN license is in effect, and provided that all modifications +** to this source code are made publicly available. +** Please refer to Willows software (www.willows.com) or +** LICENSE for full information. +** +** Under Twine, this file is also protected by an LGPL. Please +** see LICENSE for full details on this license. +** +** +** Copyright 1997 Willows Software, Inc. +**------------------------ < File Content Description > -------------------- +** +** Module: controls/ComboBox.c +** +** Description: +** +** +** Functions defined: +** +**------------------------- < Revision Information > ----------------------- +** +** Full Revision history at bottom of file +** +**--------------------------------------------------------------------------*/ +#include +#include +#include +#include "windows.h" +#include "windowsx.h" + +#define WinMalloc(n) malloc((n)) +#define WinFree(p) free(p) + +#define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp) +#define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp) +#define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp) +#define GET_WM_COMMAND_MPS(id, hwnd, cmd) \ + (WPARAM)MAKELONG(id, cmd), (LONG)(hwnd) +#define LOSHORT(x) (short int)LOWORD(x) +#define Edit_SetSel(hwndCtl, ichStart, ichEnd) ((void)SendMessage((hwndCtl), EM_SETSEL, (ichStart), (ichEnd))) + + +typedef struct { + HFONT hFont; /* hFont used */ + HWND hWndParent; /* parent window */ + UINT nID; /* control ID */ + WORD wStateFlags; /* combobox state flags */ + UINT wStyle; /* this is a copy of LOWORD(style) */ + BOOL bExtended; /* extended UI flag */ + BOOL bRedraw; /* MiD - redraw flag, draw only if it's 1 */ + HWND EditControl; /* edit/static control hWnd */ + HWND ListBoxControl; /* listbox control hWnd */ + RECT ButtonRect; /* local button rect (client) */ + RECT ListBoxRect; /* listbox rect (screen) */ + UINT uHeight; /* height of the normal state */ + WNDPROC lpfnOldStatic; /* previous static wndproc */ + UINT nListItems; /* ecw */ +} COMBOBOX; + +#define CWD_LPCBDATA 0 +#define CBC_EDITID 1 + +#define CSF_CAPTUREACTIVE 0x0001 +#define CSF_LOCALBUTTONDOWN 0x0002 +#define CSF_BUTTONDOWN 0x0004 +#define CSF_LBOXBUTTONDOWN 0x0008 +#define CSF_FOCUS 0x0010 /* MiD */ +#define CSF_HASDROPPED 0x0020 /* weav */ + +#define SET_STATE(lp, wMask) (lp->wStateFlags |= (wMask)) +#define CLEAR_STATE(lp, wMask) (lp->wStateFlags &= ~(wMask)) +#define IS_SET(lp, wMask) (lp->wStateFlags & (wMask)) + +#define BOWNERDRAW(l) ((l)->wStyle & (CBS_OWNERDRAWFIXED|CBS_OWNERDRAWVARIABLE)) + +/********************************************** + Styles: + + CBS_AUTOHSCROLL passed to the edit control + CBS_DISABLENOSCROLL passed to the listbox control + CBS_DROPDOWN + CBS_DROPDOWNLIST + CBS_HASSTRINGS passed to the listbox control + CBS_NOINTEGRALHEIGHT passed to the listbox control + CBS_OEMCONVERT passed to the edit control + CBS_OWNERDRAWFIXED passed to the listbox control + CBS_OWNERDRAWVARIABLE passed to the listbox control + CBS_SIMPLE TODO + CBS_SORT passed to the listbox control + + WS_VSCROLL passed to the listbox control + +*********************************************/ + +/********************************************** + CBN_xxx messages to be added + + from mouse tracking... + CBN_SELENDCANCEL TODO + CBN_SELENDOK TODO + +*********************************************/ + +/* imported stuff */ +#if 1 +void +Draw3DButtonRect(HDC hDC, HPEN hPenHigh, HPEN hPenShadow, + RECT rc, BOOL fClicked) +{ + HPEN hPenOld; + POINT lpt[6]; + + POINT p3[3]; + int shrink=1; + + hPenOld = SelectObject(hDC, hPenShadow); + if (fClicked) { + lpt[0].x = lpt[1].x = rc.left; + lpt[1].y = lpt[2].y = rc.top; + lpt[2].x = rc.right-1; + lpt[0].y = rc.bottom-1; + Polyline(hDC,lpt,3); + } + else { + lpt[0].x = lpt[1].x = rc.right-1; + lpt[0].y = rc.top; + lpt[1].y = lpt[2].y = rc.bottom-1; + lpt[2].x = rc.left; + lpt[3].x = rc.left+1; + lpt[3].y = lpt[4].y = rc.bottom-2; + lpt[4].x = lpt[5].x = rc.right-2; + lpt[5].y = rc.top+1; + Polyline(hDC,lpt,6); + + SelectObject(hDC, hPenHigh); + lpt[0].x = rc.right-1; + lpt[0].y = lpt[1].y = rc.top; + lpt[1].x = lpt[2].x = rc.left; + lpt[2].y = rc.bottom-1; + lpt[3].x = lpt[4].x = rc.left+1; + lpt[3].y = rc.bottom-2; + lpt[4].y = lpt[5].y = rc.top+1; + lpt[5].x = rc.right-2; + Polyline(hDC,lpt,6); + } + + SelectObject(hDC,GetStockObject(BLACK_BRUSH)); + /* down */ + p3[0].x= rc.left + ((rc.right-rc.left)/2) - 1; + p3[0].y= rc.bottom - 4 - shrink; + p3[1].x= rc.left + 2 + shrink - 1; + p3[1].y= rc.bottom-(rc.bottom-rc.top) + 2 + shrink; + p3[2].x= rc.left + ((rc.right-rc.left)-4) - shrink; + p3[2].y= rc.bottom-(rc.bottom-rc.top) + 2 + shrink; + Polygon(hDC,p3,3); + + SelectObject(hDC,hPenOld); +} +#endif + +#if 0 /* jmt: fix: no COMBOLBOX */ +extern LRESULT DefLISTBOXProc(HWND, UINT, WPARAM, LPARAM); +extern LRESULT ListboxCtrlProc(HWND, UINT, WPARAM, LPARAM); +#endif + +#if 0 +static HPEN GetSysColorPen(int color) +{ + return NULL; +} +static HBRUSH GetSysColorBrush(int color) +{ + return NULL; +} +#endif + +typedef HWND HWND32; + +#if 0 /* jmt: fix: no ownerdraw */ +typedef HANDLE HCLASS32; +static HCLASS32 FindClass(LPCSTR str, HINSTANCE hInstance) +{ + return NULL; +} +#endif + +#if 0 /* jmt: fix: no scrollbar */ +static HWND TWIN_ConvertToSysScroll(HWND hwnd, BOOL status, LPPOINT pp) +{ + return NULL; +} +#endif +extern HWND listwp; +static HWND WindowFromPoint(POINT pt) +{ + HWND wp,wp1; + int dx,dy,dx1,dy1; +#if 0 + return NULL; /* fix!! */ +#else + wp1=NULL; + switch(sizeof(dx)) + { + case 4: + dx=0x7fffffff; + dy=0x7fffffff; + break; + case 2: + dx=0x7fff; + dy=0x7fff; + break; + } + for(wp=listwp; wp; wp=wp->next) + { + if (wp->winrect.left <= pt.x && pt.x <= wp->winrect.right) + { + dx1=(wp->winrect.right-pt.x); + if (dx1winrect.left); + if (dx1winrect.top <= pt.y && pt.y <= wp->winrect.bottom) + { + dy1=(wp->winrect.bottom-pt.y); + if (dy1winrect.top); + if (dy1userdata/*GetWindowLong(hWnd,CWD_LPCBDATA)*/)) + return rc; + + switch(uMsg) { +#if 0 + case WM_SIZE: + case WM_ENABLE: + case WM_LBUTTONDBLCLK: + case WM_COMPAREITEM: + case WM_CUT: + case WM_CLEAR: +#endif + + case WM_SETFOCUS: + SET_STATE(lp, CSF_FOCUS); + if ((lp->wStyle & 0x0F) == CBS_DROPDOWNLIST) + { + uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0L); + CBoxDrawStatic(lp, hWnd, uiKey); + } + if (lp->EditControl) + { + SetFocus(lp->EditControl); + } + break; + + case WM_KILLFOCUS: + CLEAR_STATE(lp, CSF_FOCUS); + if ((lp->wStyle & 0x0F) == CBS_DROPDOWNLIST) + { + uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0L); + CBoxDrawStatic(lp, hWnd, uiKey); + } + /* + ** Hide listbox when loosing focus to window other than + ** our own listbox... When wParam == 0 we "loose" the focus + ** to the scrollbar in a listbox! + */ + if ((lp->wStyle & 0x0F) != CBS_SIMPLE && wParam != (WPARAM)lp->ListBoxControl && wParam != 0) + SendMessage(hWnd, CB_SHOWDROPDOWN, 0, 0L); + fprintf(stderr," 385: WM_KILLFOCUS\n"); + break; + +#if 0 /* jmt: fix: no WM_KEYDOWN */ + case WM_KEYDOWN: /* MiD 08/14/95 */ + /* + ** We have to process this message in order to show + ** current selection in a static control for certain + ** keys. This doesn't affect combobox with an edit + ** control, since the edit traps all key messages. + */ + { + int nCur = SendMessage(lp->ListBoxControl, LB_GETCURSEL,0, 0L); + int nPrevCur = nCur; + int nCount = SendMessage(lp->ListBoxControl, LB_GETCOUNT, 0, 0L); + + if (nCount == 0) + break; + + switch(wParam) + { + case VK_HOME: + nCur = 0; + break; + + case VK_END: + nCur = nCount - 1; + break; + + case VK_UP: + nCur--; + break; + + case VK_DOWN: + nCur++; + break; + + default: + return 0L; + } + + if (nCur >= nCount) + nCur = nCount - 1; + if (nCur < 0) + nCur = 0; + + SendMessage(lp->ListBoxControl, LB_SETCURSEL, nCur, 0L); + SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID, hWnd, CBN_SELCHANGE)); + if (nCur != nPrevCur) +/* ecw */ SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID, hWnd, CBN_SELENDOK)); + InvalidateRect(hWnd, NULL, 1); + break; + } +#endif /* WM_KEYDOWN */ + + case WM_CHAR: + { + int nNewCur; + int nOldCur; + + if (lp->EditControl) + { + SendMessage(lp->EditControl, uMsg, wParam, lParam); + } + else { + nOldCur = SendMessage(lp->ListBoxControl, LB_GETCURSEL,0, 0L); + SendMessage(lp->ListBoxControl, uMsg, wParam, lParam); + nNewCur = SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0L); + if (nNewCur != nOldCur) + { + SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID, hWnd, CBN_SELCHANGE)); + InvalidateRect(hWnd, NULL, 1); + } + } + break; + } + +#if 0 /* jmt: fix: no WM_SETREDRAW */ + case WM_SETREDRAW: + lp->bRedraw = wParam; + if (lp->EditControl) + SendMessage(lp->EditControl, WM_SETREDRAW, wParam, lParam); + if (lp->ListBoxControl) + SendMessage(lp->ListBoxControl, WM_SETREDRAW, wParam, lParam); + break; +#endif + case WM_CREATE: /*WM_NCCREATE:*/ + lp = (COMBOBOX *)WinMalloc(sizeof(COMBOBOX)); + memset((LPSTR)lp,'\0',sizeof(COMBOBOX)); + + /* save ptr to internal structure */ + hWnd->userdata=(DWORD)lp; /* -SetWindowLong(hWnd, CWD_LPCBDATA, (LONG) lp); */ + + /* this is for CreateWindow calls */ + hInst = NULL; /* -GetWindowInstance(hWnd); */ + + /* fill in the internal structure */ + lpcs = (LPCREATESTRUCT)lParam; + lp->bRedraw = 1; + lp->wStateFlags = 0; + lp->wStyle = (UINT)LOWORD(lpcs->style); + if (!BOWNERDRAW(lp)) + lp->wStyle |= CBS_HASSTRINGS; + lp->bExtended = TRUE; + lp->hFont = 0; + lp->hWndParent = lpcs->hwndParent; + lp->nID = (UINT)lpcs->hMenu; + +#if 0 /* jmt: fix: no ownerdraw */ + /* calc the height of the edit/static control */ + if (0) /* (BOWNERDRAW(lp)) */ + { + mis.CtlType = ODT_COMBOBOX; + mis.CtlID = (UINT)lpcs->hMenu; + mis.itemID = (UINT)-1; + mis.itemData = 0L; + SendMessage(lpcs->hwndParent, WM_MEASUREITEM, (WPARAM)lpcs->hMenu, (LPARAM)&mis); + /*** wEditHeight = (WORD)mis.itemHeight + 2; ***/ + } +#endif /* ownerdraw */ + + /* get system font dimensions */ + hDC = GetDC((HWND)0); + GetTextMetrics(hDC,&tm); + ReleaseDC((HWND)0,hDC); + + /* allow different fonts to fit, don't hard code */ + /* otherwise big fonts won't fit. */ + /*****wEditHeight = ((tm.tmHeight - tm.tmInternalLeading)*7)/4;*****/ + wEditHeight = tm.tmHeight + tm.tmInternalLeading * 3; + + lp->uHeight = (UINT)wEditHeight; + + if ((lp->wStyle & 0x0F) != CBS_SIMPLE) + { + lp->ButtonRect.top = 0; + lp->ButtonRect.left = lpcs->cx - 1 - GetSystemMetrics(SM_CXVSCROLL); + lp->ButtonRect.right = lpcs->cx; + lp->ButtonRect.bottom = wEditHeight; + /* for CBS_DROPDOWN/DROPDOWNLIST resize the window */ + SetWindowPos(hWnd, 0, + 0, 0, lpcs->cx, (int)wEditHeight, + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW); + } + else SetRectEmpty(&lp->ButtonRect); + + if ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) + { /* EDIT field - calc edit control style */ + dwStyle = WS_CHILD | WS_VISIBLE | WS_BORDER; + if (lp->wStyle & CBS_AUTOHSCROLL) + dwStyle |= ES_AUTOHSCROLL; + if (lp->wStyle & CBS_OEMCONVERT) + dwStyle |= ES_OEMCONVERT; + + if ((lp->wStyle & 0x0F) == CBS_SIMPLE) + { + fprintf(stderr," 528: wEditWidth = lpcs->cx=%d\n",lpcs->cx); + wEditWidth = lpcs->cx; + } + else /* ?if ((lp->wStyle & 0xf) == CBS_DROPDOWN) */ + { + fprintf(stderr," 533: wEditWidth = lp->ButtonRect.left - 5=%d;\n",lp->ButtonRect.left - 5); + wEditWidth = lp->ButtonRect.left - 5; + } + /* create edit control */ + lp->EditControl = CreateWindow("EDIT", NULL, dwStyle, + 0, 0, wEditWidth, wEditHeight, + hWnd, (HMENU)CBC_EDITID, + hInst,(LPVOID)NULL); + } + else /* CBS_DROPDOWN -- static instead of edit */ + lp->EditControl = 0; + + /* listbox style */ + /* jmt: fix: no WS_EX_SAVEBITS, WS_EX_NOCAPTURE, WS_EX_POPUPMENU */ + dwExStyle = 0L; /* WS_EX_SAVEBITS | WS_EX_NOCAPTURE | WS_EX_POPUPMENU; */ + dwStyle = WS_BORDER | LBS_NOTIFY ; /* | LBS_COMBOLBOX; */ + if ((lp->wStyle & 0xf) == CBS_SIMPLE) + dwStyle |= WS_VISIBLE | WS_CHILD; + else + dwStyle |= WS_POPUP; +#if 0 + if (lp->wStyle & CBS_DISABLENOSCROLL) + dwStyle |= LBS_DISABLENOSCROLL; +#endif + if (lp->wStyle & CBS_HASSTRINGS) + dwStyle |= LBS_HASSTRINGS; + if (lp->wStyle & CBS_NOINTEGRALHEIGHT) + dwStyle |= LBS_NOINTEGRALHEIGHT; + if (lp->wStyle & CBS_OWNERDRAWFIXED) + dwStyle |= LBS_OWNERDRAWFIXED; + if (lp->wStyle & CBS_OWNERDRAWVARIABLE) + dwStyle |= LBS_OWNERDRAWVARIABLE; + if (lp->wStyle & CBS_SORT) + dwStyle |= LBS_SORT; + if (lpcs->style & WS_VSCROLL) + dwStyle |= WS_VSCROLL; + + /* calc listbox dimensions and position */ + if ((lp->wStyle & 0xf) == CBS_SIMPLE) { + lp->ListBoxRect.left = 5; + lp->ListBoxRect.top = wEditHeight - 1; + lp->ListBoxRect.right = lpcs->cx; + lp->ListBoxRect.bottom = lpcs->cy - 2; + } else { + lp->ListBoxRect.left = lpcs->x; + lp->ListBoxRect.right = lp->ListBoxRect.left + lpcs->cx - 1; + lp->ListBoxRect.top = lpcs->y + wEditHeight - 1; + lp->ListBoxRect.bottom = lp->ListBoxRect.top + lpcs->cy + 1; + if ((lp->wStyle & 0x0F) == CBS_DROPDOWN) { + lp->ListBoxRect.left += 5; + } + } +#ifdef LATER + cp.x = ((lp->wStyle & 0xf) == CBS_DROPDOWNLIST)?0:5; + cp.y = wEditHeight - 1; + if ((lp->wStyle & 0xf) != CBS_SIMPLE) + ClientToScreen(hWnd,&cp); + lp->ListBoxRect.left = cp.x; + lp->ListBoxRect.top = cp.y; + lp->ListBoxRect.right = cp.x + lpcs->cx; + if ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) + lp->ListBoxRect.right -= 5; + lp->ListBoxRect.bottom = lp->ListBoxRect.top + lpcs->cy - + wEditHeight + 1; +#endif + + lp->ListBoxControl = CreateWindowEx(dwExStyle,"LISTBOX",/*"COMBOLBOX",*/ + NULL, dwStyle, + lp->ListBoxRect.left, lp->ListBoxRect.top, + lp->ListBoxRect.right - lp->ListBoxRect.left, + lp->ListBoxRect.bottom - lp->ListBoxRect.top, + hWnd, 0, + hInst,(LPVOID)NULL); +#if MWCLIENT +#if 0 + GrLowerWindow(lp->ListBoxControl->wid); +#endif + MwLowerWindow(lp->ListBoxControl); +#endif +#ifdef LATER + /* Microsoft Word 6.0 wants to see COMBOLBOX on top */ + /* of Z-order... */ + if (dwStyle & WS_POPUP) + { + SetWindowPos(lp->ListBoxControl, HWND_TOP, + 0, 0, 0, 0, + SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE); + } +#endif + +#if 0 /* jmt: fix: no HWND32(LPWININFO) */ + /* physically expand client window, + if there is a scroll style + */ + if (lpcs->style & WS_VSCROLL) + { + HWND32 hWnd32 = GETHWND32(hWnd); + + SetRectEmpty(&hWnd32->rcNC); + + hWnd32->wWidth = (WORD) hWnd32->rWnd.right-hWnd32->rWnd.left; + hWnd32->wHeight = (WORD)hWnd32->rWnd.bottom-hWnd32->rWnd.top; + RELEASEWININFO(hWnd32); + } +#endif + /* + ** Finally turn off border drawing and WM_?SCROLL styles to prevent creation + ** of system scrollbars. + */ + dwStyle = GetWindowLong(hWnd, GWL_STYLE); + dwStyle &= ~(WS_VSCROLL | WS_HSCROLL | WS_BORDER | WS_DLGFRAME | WS_THICKFRAME); + SetWindowLong(hWnd, GWL_STYLE, dwStyle); + lp->nListItems = 0; + return TRUE; + + case WM_DESTROY: /*WM_NCDESTROY:*/ + if (IsWindow(lp->ListBoxControl)) + DestroyWindow(lp->ListBoxControl); + if (IsWindow(lp->EditControl)) + DestroyWindow(lp->EditControl); + WinFree((LPSTR)lp); + return 0L; + + case WM_GETDLGCODE: + return (LRESULT)(DLGC_WANTCHARS|DLGC_WANTARROWS); + +/* jmt: twine->mwin bug fixed: */ + case WM_NCLBUTTONDOWN: /* jmt: a must */ +#if 0 /* twine->mw buggy */ + case WM_LBUTTONDOWN: +#endif + if ((lp->wStyle & 0xf) == CBS_SIMPLE) + break; + + cp.x = (int)(short)LOWORD(lParam); + cp.y = (int)(short)HIWORD(lParam); +#if 1 /* WM_NCLBUTTONDOWM: */ + ScreenToClient(hWnd, &cp); /* jmt: a must */ +#endif + if (!IS_SET(lp, CSF_CAPTUREACTIVE)) /* no listbox yet */ + { + /* click on a button or anywhere if it's dropdown combo */ + if (PtInRect(&lp->ButtonRect, cp) || + (lp->wStyle & 0x0F) == CBS_DROPDOWNLIST) + { + if (PtInRect(&lp->ButtonRect, cp)) + CBoxDrawButton(hWnd, 1, lp); + + cp.x = ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) ? 5 : 0; + cp.y = lp->uHeight - 1; + + ClientToScreen(hWnd, &cp); + + fprintf(stderr," (1)lp->ListBoxRect:(%d,%d,%d,%d)\n", + lp->ListBoxRect.left, + lp->ListBoxRect.top, + lp->ListBoxRect.right, + lp->ListBoxRect.bottom); + + OffsetRect(&lp->ListBoxRect, cp.x - lp->ListBoxRect.left, cp.y - lp->ListBoxRect.top); + + fprintf(stderr," (2)lp->ListBoxRect:(%d,%d,%d,%d)\n", + lp->ListBoxRect.left, + lp->ListBoxRect.top, + lp->ListBoxRect.right, + lp->ListBoxRect.bottom); + + SetWindowPos(lp->ListBoxControl, HWND_TOP, /*0,*/ + cp.x, cp.y, 0, 0, + SWP_NOSIZE | /*SWP_NOZORDER |*/ SWP_NOACTIVATE); + + SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_DROPDOWN)); + /* ECW added following conditional... 4/4/96 */ + /* JMT following conditional is a must for microwindows 8/14/2k */ + if (1) /* -(!IS_SET(lp, CSF_HASDROPPED)) jmt: a must */ + { + /* ??first time it drops down, size it to hold all items?? */ + + int nitems = SendMessage(lp->ListBoxControl,LB_GETCOUNT,0,0L); +#if 0 + /* resize if too small, in this case, also do too long */ + if (lp->ListBoxRect.bottom - lp->ListBoxRect.top < + ((lp->uHeight-2) * nitems)) + { +#endif + nitems = (nitems > 12 ? 12 : nitems); /* a dozen, max */ + +#if 0 /* twine->mw buggy? */ + lp->ListBoxRect.bottom = + lp->ListBoxRect.top + ((lp->uHeight-2) * nitems); +#endif + fprintf(stderr," (2.5)lp->ListBoxRect:(%d,%d,%d,%d)\n", + lp->ListBoxRect.left, + lp->ListBoxRect.top, + lp->ListBoxRect.right, + lp->ListBoxRect.bottom); + +/* jmt: twine->mwin bug fixed: */ + fprintf(stderr," 706: fixed: SetWindowPos(lp->ListBoxControl,,%d,%d,...)\n",cp.x,cp.y); +#if 0 /* twine->mwin bug */ + SetWindowPos(lp->ListBoxControl,HWND_TOP,0,0, + lp->ListBoxRect.right - lp->ListBoxRect.left, + lp->ListBoxRect.bottom - lp->ListBoxRect.top, + SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); +#else /* jmt: twine->mwin bug fixed: */ + SetWindowPos(lp->ListBoxControl,HWND_TOP,cp.x,cp.y, + lp->ListBoxRect.right - lp->ListBoxRect.left, + lp->ListBoxRect.bottom - lp->ListBoxRect.top, + SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); +#endif + +#if 0 + } +#endif + SET_STATE(lp, CSF_HASDROPPED); + } + /* End of addition */ + ShowWindow(lp->ListBoxControl, SW_SHOW); +#if 0 /* orig(twine) */ + SetFocus(lp->ListBoxControl); +#else /* jmt: mwclient */ + SetForegroundWindow(lp->ListBoxControl); +#endif + CBoxCapture(hWnd, 1); + SET_STATE(lp, CSF_CAPTUREACTIVE); + SET_STATE(lp, CSF_BUTTONDOWN); + } + } + else + { /* there is a listbox visible */ + HWND hwndNewFocus = 0; + + cpScreen = cp; + + if ((lp->wStyle & 0xf) != CBS_SIMPLE) + { + ClientToScreen(hWnd, &cpScreen); + hwndNewFocus = WindowFromPoint(cpScreen); + } + + fprintf(stderr," (3)lp->ListBoxRect:(%d,%d,%d,%d)\n", + lp->ListBoxRect.left, + lp->ListBoxRect.top, + lp->ListBoxRect.right, + lp->ListBoxRect.bottom); + + if (PtInRect(&lp->ListBoxRect, cpScreen)) + { + CBoxSendMouseToLBox(lp, WM_LBUTTONDOWN, wParam, cpScreen); + } + else + { + if (PtInRect(&lp->ButtonRect, cp)) + CBoxDrawButton(hWnd, 0, lp); + if ((lp->wStyle & 0x0F) == CBS_DROPDOWN && hwndNewFocus == lp->EditControl) + /* don't close listbox */; + else { + SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_CLOSEUP)); + + fprintf(stderr," 802: (hide) SetWindowPos(lp->ListBoxControl, , 0, 0, 0, 0,..)\n"); + + SetWindowPos(lp->ListBoxControl, 0, + 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_HIDEWINDOW); +#if MWCLIENT + MwLowerWindow(lp->ListBoxControl); +#endif + CBoxCapture(hWnd, 0); + CLEAR_STATE(lp, CSF_BUTTONDOWN); + } + CLEAR_STATE(lp, CSF_CAPTUREACTIVE); + + if (hwndNewFocus && hwndNewFocus != hWnd) + { + ScreenToClient(hwndNewFocus, &cpScreen); + SetFocus(hwndNewFocus); + + SendMessage(hwndNewFocus, WM_LBUTTONDOWN, wParam, MAKELONG(cpScreen.x, cpScreen.y)); + } + } /* !(PtInRect(&lp->ListBoxRect, cpScreen)) */ + } + break; + +/* jmt: twine->mwin bug fixed: */ + case WM_NCMOUSEMOVE: +#if 0 /* jmt: twine->mw buggy */ + case WM_MOUSEMOVE: +#endif + if (!IS_SET(lp,CSF_BUTTONDOWN) && ((lp->wStyle & 0xf) == CBS_SIMPLE)) + break; + + cp.x = (int)(short)LOWORD(lParam); + cp.y = (int)(short)HIWORD(lParam); +#if 1 /* WM_NCMOUSEMOVE: */ + ScreenToClient(hWnd, &cp); /* jmt: a must */ +#endif + + if (IS_SET(lp, CSF_CAPTUREACTIVE)) + { + if (PtInRect(&lp->ButtonRect,cp)) + { + if (!IS_SET(lp, CSF_LOCALBUTTONDOWN)) + CBoxDrawButton(hWnd, 1, lp); + break; + } + if ((lp->wStyle & 0xf) != CBS_SIMPLE) + ClientToScreen(hWnd,&cp); + if (PtInRect(&lp->ListBoxRect,cp)) + { + CBoxSendMouseToLBox(lp,WM_MOUSEMOVE,wParam,cp); + } + if (IS_SET(lp,CSF_LOCALBUTTONDOWN) && ((lp->wStyle & 0xf) != CBS_SIMPLE)) + CBoxDrawButton(hWnd,0,lp); + } + break; + +/* jmt: twine->mwin bug fixed: */ + case WM_NCLBUTTONUP: +#if 0 /* twine->mw buggy */ + case WM_LBUTTONUP: +#endif + if (!IS_SET(lp, CSF_CAPTUREACTIVE)) + break; + + cp.x = (int)(short)LOWORD(lParam); + cp.y = (int)(short)HIWORD(lParam); +#if 1 /* WM_NCLBUTTONUP */ + ScreenToClient(hWnd, &cp); /* jmt: a must */ +#endif + + CLEAR_STATE(lp,CSF_BUTTONDOWN); + + if (PtInRect(&lp->ButtonRect, cp)) + /*(lp->wStyle & 0x0F) == CBS_DROPDOWNLIST)*/ + { + if (PtInRect(&lp->ButtonRect, cp)) + CBoxDrawButton(hWnd, 0, lp); + if (IS_SET(lp, CSF_LBOXBUTTONDOWN)) + { + if ((lp->wStyle & 0xf) != CBS_SIMPLE) + ClientToScreen(hWnd, &cp); + CBoxSendMouseToLBox(lp, WM_LBUTTONUP, wParam, cp); + CLEAR_STATE(lp,CSF_LBOXBUTTONDOWN); + } + break; + } + if ((lp->wStyle & 0xf) != CBS_SIMPLE) + ClientToScreen(hWnd, &cp); + + if (PtInRect(&lp->ListBoxRect, cp)) + { + uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0); + if (uiKey != (UINT)LB_ERR) + { + if (lp->EditControl) + { + SetFocus(lp->EditControl); + + CBoxDrawEdit(lp, hWnd, uiKey); + } + else { + SetFocus(hWnd); + + CBoxDrawStatic(lp, hWnd, uiKey); + } + + /* LATER check the WS_EX_NOPARENTNOTIFY bit in ext style.*/ +/* ecw */ SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_SELENDOK)); + SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_CLOSEUP)); + + fprintf(stderr," 844: (hide) SetWindowPos(lp->ListBoxControl, , 0, 0, 0, 0,..)\n"); + + SetWindowPos(lp->ListBoxControl, 0, + 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_HIDEWINDOW); + + CBoxCapture(hWnd, 0); + CLEAR_STATE(lp,CSF_CAPTUREACTIVE); + } /* uiKey ok */ + + CBoxSendMouseToLBox(lp, WM_LBUTTONUP, wParam, cp); + CLEAR_STATE(lp,CSF_LBOXBUTTONDOWN); +#if MWCLIENT +#if 0 + GrLowerWindow(lp->ListBoxControl->wid); +#endif + MwLowerWindow(lp->ListBoxControl); +#endif + } + else /* clicked somewhere outside button or listbox - + ** the listbox should stay intact... MiD + */ + if (IS_SET(lp, CSF_LBOXBUTTONDOWN)) + { + if ((lp->wStyle & 0xf) != CBS_SIMPLE) + ClientToScreen(hWnd, &cp); + CBoxSendMouseToLBox(lp, WM_LBUTTONUP, wParam, cp); + CLEAR_STATE(lp,CSF_LBOXBUTTONDOWN); + } + break; + + case WM_ERASEBKGND: + return 1L; + + case WM_PAINT: + BeginPaint(hWnd,&ps); + EndPaint(hWnd,&ps); + + if (!IsWindowVisible(hWnd) || !lp->bRedraw) + return 0L; + + if ((lp->wStyle & 0xf) != CBS_SIMPLE) + CBoxDrawButton(hWnd, IS_SET(lp,CSF_LOCALBUTTONDOWN), lp); + uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0); + if (lp->EditControl) + CBoxDrawEdit(lp, hWnd, uiKey); + else CBoxDrawStatic(lp, hWnd, uiKey); + return 0L; + + case WM_COMMAND: + if (GET_WM_COMMAND_ID(wParam,lParam) == CBC_EDITID) { + /* edit/static control notifications */ + switch((short)GET_WM_COMMAND_CMD(wParam,lParam)) { + case EN_SETFOCUS: +#ifdef LATER + wCBN = CBN_SETFOCUS; +#else + wCBN = 0; +#endif + break; + case EN_KILLFOCUS: + wCBN = CBN_KILLFOCUS; + break; + case EN_CHANGE: + { + int index = 0; + char sz[128]; + /* + ** Advance listbox + ** selection until there is string match. One first mismatch + ** listbox advances to its first item. + */ + SendMessage(lp->EditControl, WM_GETTEXT, sizeof(sz)-1, (LPARAM)sz); + if (/*l*/strlen(sz) > 0/*L*/) + index = (int)SendMessage(lp->ListBoxControl, LB_FINDSTRING, -1, (LPARAM)sz); + if (index == LB_ERR) + index = 0; + SendMessage(lp->ListBoxControl, LB_SETTOPINDEX, index, 0L); + wCBN = CBN_EDITCHANGE; + break; + } + case EN_UPDATE: + wCBN = CBN_EDITUPDATE; + break; + case EN_ERRSPACE: + wCBN = CBN_ERRSPACE; + break; + default: + wCBN = 0; + break; + } + if (wCBN) + return SendMessage(lp->hWndParent,WM_COMMAND, + GET_WM_COMMAND_MPS(lp->nID,hWnd,wCBN)); + else + return rc; + } + if (GET_WM_COMMAND_ID(wParam,lParam) == 0) { + /* listbox notifications */ + switch ((short)GET_WM_COMMAND_CMD(wParam,lParam)) { + case LBN_ERRSPACE: + wCBN = CBN_ERRSPACE; + break; + case LBN_SELCHANGE: + if ((lp->wStyle & 0xf) == CBS_SIMPLE) + { + uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0); + if (uiKey != (UINT)LB_ERR) + if (lp->EditControl) + { + CBoxDrawEdit(lp, hWnd, uiKey); + } + } + wCBN = CBN_SELCHANGE; + break; + case LBN_DBLCLK: + wCBN = CBN_DBLCLK; + break; + case LBN_SELCANCEL: /* TODO */ + wCBN = 0; + break; + case LBN_SETFOCUS: + wCBN = CBN_SETFOCUS; + break; + case LBN_KILLFOCUS: + wCBN = CBN_KILLFOCUS; + break; + default: + wCBN = 0; + break; + } + if (wCBN) + return SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,wCBN)); + else + return rc; + } + break; + + case WM_GETTEXT: + if ( lp->EditControl ) + return SendMessage(lp->EditControl,uMsg,wParam,lParam); + else if ( lp->ListBoxControl ) { + WPARAM sel, len; + + sel = (WPARAM)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0); + if ( sel != (WPARAM)LB_ERR ) { + len = (WPARAM)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, 0, 0); + if ( len <= wParam ) + return SendMessage(lp->ListBoxControl, LB_GETTEXT, sel, lParam); + } + } + return CB_ERR; + + case WM_GETTEXTLENGTH: + if ( lp->EditControl ) + return SendMessage(lp->EditControl,uMsg,wParam,lParam); + else if ( lp->ListBoxControl ) { + WPARAM sel; + + sel = (WPARAM)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0); + if ( sel != (WPARAM)LB_ERR ) + return SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, sel, 0); + } + return CB_ERR; + + case WM_SETTEXT: + if ( lp->EditControl ) + return SendMessage(lp->EditControl,uMsg,wParam,lParam); + return CB_ERR; + +#if 0 /* jmt: fix: no WM_SETFONT/WM_GETFONT */ + case WM_SETFONT: + lp->hFont = (HFONT)wParam; + + hDC = GetDC(hWnd); + SelectObject(hDC,lp->hFont); + GetTextMetrics(hDC,&tm); + ReleaseDC(hWnd,hDC); + wEditHeight = tm.tmHeight + 3 * tm.tmInternalLeading; + + if (wEditHeight == lp->uHeight) + return 0L; + + lp->uHeight = (UINT)wEditHeight; + lp->ButtonRect.bottom = wEditHeight; + /* + ** The following SetWindowPos causes WM_WINDOWPOSCHANGING message + ** where child windows are resized and/or moved. + */ + ShowWindow(hWnd, SW_HIDE); + GetClientRect(hWnd,&rcClient); + if ((lp->wStyle & 0xf) != CBS_SIMPLE) + SetWindowPos(hWnd, 0, + 0, 0, rcClient.right, (int)wEditHeight, + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW); + else SetWindowPos(hWnd, 0, + 0, 0, rcClient.right, (int)wEditHeight + lp->ListBoxRect.bottom - lp->ListBoxRect.top + 1, + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW); + ShowWindow(hWnd, SW_SHOWNA); + + if (lp->EditControl) + SendMessage(lp->EditControl, WM_SETFONT, wParam,lParam); + SendMessage(lp->ListBoxControl, WM_SETFONT, wParam,lParam); + + if(LOWORD(lParam)) + RedrawWindow(hWnd,(const RECT *)0,(HRGN)0, + RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW ); + return (LRESULT)0; + + case WM_GETFONT: + return lp->hFont; +#endif /* WM_SETFONT/WM_GETFONT */ + + case WM_MOVE: /*WM_WINDOWPOSCHANGING:*/ +#if 0 + lpwp = (LPWINDOWPOS)lParam; +#else + pp.x=LOWORD(lParam); + pp.y=HIWORD(lParam); +#endif + if (1)/*(lpwp)*/ { + if (1)/*(!(lpwp->flags & SWP_NOSIZE))*/ { + lp->ButtonRect.right = (hWnd->winrect.right-hWnd->winrect.left); /* lpwp->cx; */ + if ((lp->wStyle & 0xf) == CBS_SIMPLE) + lp->ButtonRect.left = lp->ButtonRect.right; + else lp->ButtonRect.left = (hWnd->winrect.right-hWnd->winrect.left)/*lpwp->cx*/ - 1 - + GetSystemMetrics(SM_CXVSCROLL); + + if (lp->EditControl) + { + wEditWidth = lp->ButtonRect.left + 1; + if ((lp->wStyle & 0xf) == CBS_SIMPLE) + wEditWidth --; + if ((lp->wStyle & 0xf) == CBS_DROPDOWN) + wEditWidth -= 5; + SetWindowPos(lp->EditControl,(HWND)0, + 0,0, + wEditWidth, lp->uHeight, + SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); + } + if (lp->ListBoxControl) + { + if ((lp->wStyle & 0x0F) == CBS_SIMPLE) + { + lp->ListBoxRect.left = 5; + lp->ListBoxRect.top = lp->uHeight - 1; + lp->ListBoxRect.right = (hWnd->winrect.right-hWnd->winrect.left); /* lpwp->cx; */ + lp->ListBoxRect.bottom = (hWnd->winrect.bottom-hWnd->winrect.top)/*lpwp->cy*/ - 2; + } + else { + POINT cp; + cp.x = 0; + cp.y = lp->uHeight - 1; + ClientToScreen(hWnd, &cp); + OffsetRect(&lp->ListBoxRect, cp.x - lp->ListBoxRect.left, cp.y - lp->ListBoxRect.top); + + lp->ListBoxRect.right = lp->ListBoxRect.left + (hWnd->winrect.right-hWnd->winrect.left)/*lpwp->cx*/; + if ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) + lp->ListBoxRect.right -= 5; + } + + SetWindowPos(lp->ListBoxControl,(HWND)0, + lp->ListBoxRect.left, lp->ListBoxRect.top, + lp->ListBoxRect.right - lp->ListBoxRect.left, + lp->ListBoxRect.bottom - lp->ListBoxRect.top, + SWP_NOACTIVATE|SWP_NOZORDER); + } +#if 0 /* jmt: fix: no WM_WINDOWPOSCHANGING */ + /* the height of the normal state stays the same */ + if ((lp->wStyle & 0xf) != CBS_SIMPLE) + lpwp->cy = (int)lp->uHeight; +#endif + } + } + return (LRESULT)0; + + case WM_WINDOWPOSCHANGED: + DefWindowProc(hWnd,uMsg,wParam,lParam); + lpwp = (LPWINDOWPOS)lParam; + if (lpwp) { + if (!(lpwp->flags & SWP_NOSIZE)) /* TODO */ +#if 0 + RedrawWindow(hWnd,(const RECT *)0,(HRGN)0, + RDW_INVALIDATE|RDW_ERASE); +#else + InvalidateRect(hWnd,NULL,TRUE); +#endif + } + return (LRESULT)0; + +#if 0 /* jmt: fix: no ownerdraw */ + /*********************************************/ + /* ownerdraw stuff */ + /*********************************************/ + case WM_DRAWITEM: + lpdis = (LPDRAWITEMSTRUCT)lParam; + lpdis->CtlType = ODT_COMBOBOX; + lpdis->CtlID = lp->nID; + lpdis->hwndItem = hWnd; + return SendMessage(lp->hWndParent,WM_DRAWITEM, + (WPARAM)lp->nID,lParam); + + case WM_MEASUREITEM: + lpmis = (LPMEASUREITEMSTRUCT)lParam; + lpmis->CtlType = ODT_COMBOBOX; + lpmis->CtlID = lp->nID; + return SendMessage(lp->hWndParent,WM_MEASUREITEM, + (WPARAM)lp->nID,lParam); + + case WM_DELETEITEM: + lpdlis = (LPDELETEITEMSTRUCT)lParam; + lpdlis->CtlType = ODT_COMBOBOX; + lpdlis->CtlID = lp->nID; + lpdlis->hwndItem = hWnd; + return SendMessage(lp->hWndParent,WM_DELETEITEM, + (WPARAM)lp->nID,lParam); + + case WM_CONVERT: + if (!lpComboBinToNat) { + hComboClass32 = FindClass("COMBOBOX",0); + lpComboBinToNat = (WNDPROC)GetClassHandleLong( + hComboClass32,GCL_BINTONAT); + } + if (lpComboBinToNat) + return lpComboBinToNat(hWnd, uMsg, wParam, lParam); + else + return (LRESULT)0; +#endif /* ownerdraw */ + + default: + return DefCBProc( hWnd, uMsg, wParam, lParam); + } + return rc; +} + +/************************************************************************ +** +************************************************************************/ +static LRESULT DefCBProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + int len,index; + COMBOBOX *lp; + char *selection; + int rc; + POINT cp; + + lp = (COMBOBOX *) hWnd->userdata/*GetWindowLong(hWnd,CWD_LPCBDATA)*/; + switch(uMsg) { + /*********************************************/ + /* messages specific to the list box control */ + /*********************************************/ + case CB_ADDSTRING: + lp->nListItems++; /* shd. test for successful return */ + return SendMessage(lp->ListBoxControl,LB_ADDSTRING, + wParam,lParam); + + case CB_DELETESTRING: + if (lp->nListItems) + lp->nListItems--; + return SendMessage(lp->ListBoxControl,LB_DELETESTRING, + wParam,lParam); + + case CB_DIR: + return SendMessage(lp->ListBoxControl,LB_DIR, + wParam,lParam); + + case CB_FINDSTRING: + return SendMessage(lp->ListBoxControl,LB_FINDSTRING, + wParam,lParam); + + case CB_FINDSTRINGEXACT: + return SendMessage(lp->ListBoxControl,LB_FINDSTRINGEXACT, + wParam,lParam); + + case CB_GETCOUNT: + return SendMessage(lp->ListBoxControl,LB_GETCOUNT, + wParam,lParam); + + case CB_GETCURSEL: + return SendMessage(lp->ListBoxControl,LB_GETCURSEL, + wParam,lParam); + + case CB_GETITEMDATA: + return SendMessage(lp->ListBoxControl,LB_GETITEMDATA, + wParam,lParam); + + case CB_GETITEMHEIGHT: + return SendMessage(lp->ListBoxControl,LB_GETITEMHEIGHT, + wParam,lParam); + + case CB_GETLBTEXT: + return SendMessage(lp->ListBoxControl,LB_GETTEXT, + wParam,lParam); + + case CB_GETLBTEXTLEN: + return SendMessage(lp->ListBoxControl,LB_GETTEXTLEN, + wParam,lParam); + + case CB_INSERTSTRING: + return SendMessage(lp->ListBoxControl,LB_INSERTSTRING, + wParam,lParam); + + case CB_SETITEMDATA: + return SendMessage(lp->ListBoxControl,LB_SETITEMDATA, + wParam,lParam); + + /*********************************************/ + /* messages specific to the edit control */ + /*********************************************/ + case CB_GETEDITSEL: + return SendMessage(lp->EditControl,EM_GETSEL,0,0); + + case CB_LIMITTEXT: + return SendMessage(lp->EditControl,EM_LIMITTEXT, + wParam,lParam); + + case CB_SETEDITSEL: + return SendMessage(lp->EditControl,EM_SETSEL, + wParam,lParam); + + /*********************************************/ + /* messages handled by the combobox */ + /*********************************************/ + case CB_GETDROPPEDCONTROLRECT: + CopyRect((LPRECT)lParam,&lp->ListBoxRect); + break; + case CB_GETDROPPEDSTATE: + return IS_SET(lp,CSF_CAPTUREACTIVE); + + case CB_GETEXTENDEDUI: + return (LRESULT)lp->bExtended; + + case CB_RESETCONTENT: + SendMessage(lp->ListBoxControl,LB_RESETCONTENT,0,0); + if (lp->EditControl) + SendMessage(lp->EditControl,WM_SETTEXT,0,(LPARAM)(LPSTR)""); + break; + + case CB_SELECTSTRING: + index = (int)SendMessage(lp->ListBoxControl, LB_SELECTSTRING, wParam, lParam); + if (index == LB_ERR) + return CB_ERR; + + len = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, index, 0); + if (len <= 0) + return CB_ERR; + + selection = (LPSTR)WinMalloc((UINT)len+1); + rc = (int)SendMessage(lp->ListBoxControl, LB_GETTEXT, (WPARAM)index, (LPARAM)selection); + if (lp->EditControl) + rc = (int)SendMessage(lp->EditControl, WM_SETTEXT, 0, (LPARAM)selection); + else CBoxDrawStatic(lp, hWnd, index); + WinFree(selection); + break; + + case CB_SETCURSEL: + rc = (int)SendMessage(lp->ListBoxControl, LB_SETCURSEL, wParam, lParam); + if (rc == LB_ERR) + return CB_ERR; + len = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, wParam, 0); + if (len <= 0) + return CB_ERR; + + selection = (LPSTR)WinMalloc((UINT)len+1); + rc = (int)SendMessage(lp->ListBoxControl, LB_GETTEXT, wParam, (LPARAM)selection); + if (lp->EditControl) + rc = (int)SendMessage(lp->EditControl, WM_SETTEXT, 0, (LPARAM)selection); + else CBoxDrawStatic(lp, hWnd, wParam); + WinFree(selection); + return (LRESULT)wParam; + + case CB_SETEXTENDEDUI: + lp->bExtended = (BOOL)wParam; + break; + + case CB_SETITEMHEIGHT: /* TODO */ + break; + + case CB_SHOWDROPDOWN: + if ((lp->wStyle & 0xf) == CBS_SIMPLE) + return 1L; + if (wParam) + { + if (IS_SET(lp,CSF_CAPTUREACTIVE)) + return 1L; + + cp.x = ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) ? 5 : 0; + cp.y = lp->uHeight -1; + + ClientToScreen(hWnd, &cp); + OffsetRect(&lp->ListBoxRect, cp.x - lp->ListBoxRect.left, cp.y - lp->ListBoxRect.top); + + SetWindowPos(lp->ListBoxControl, 0, + cp.x, cp.y, 0, 0, + SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + + SendMessage(lp->hWndParent,WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_DROPDOWN)); + + fprintf(stderr," 1330: SetWindowPos(lp->ListBoxControl, , 0, 0, 0, 0,..)\n"); + + SetWindowPos(lp->ListBoxControl, HWND_TOP, + 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW); + + CBoxCapture(hWnd, 1); + SET_STATE(lp,CSF_CAPTUREACTIVE); + } + else + { + if (!IS_SET(lp,CSF_CAPTUREACTIVE)) + return 1L; + + SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_CLOSEUP)); +/* test: */ + fprintf(stderr," 1343: (hide) SetWindowPos(lp->ListBoxControl, , 0, 0, 0, 0,..)\n"); + + SetWindowPos(lp->ListBoxControl, 0, + 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_HIDEWINDOW); + + CBoxCapture(hWnd, 0); + CLEAR_STATE(lp, CSF_CAPTUREACTIVE); + } + return 1L; + + /*********************************************/ + /* messages handled by the defwindowproc.... */ + /*********************************************/ + default: + return DefWindowProc( hWnd, uMsg, wParam, lParam); + } + return CB_OKAY; +} + + +static void +CBoxDrawButton(HWND hWnd,UINT wState,COMBOBOX *lp) +{ + HDC hDC; + int x,y; + int dx,dy; +#if 0 /* jmt: fix: no LoadBitmap() */ + int cx,cy; + static int nWidth,nHeight; + BITMAP bmpCombo; + static HBITMAP hbmpCombo = 0; + HBITMAP hbmpOld = 0; + HDC hdcSrc; + COLORREF rgbText, rgbBk; +#endif + HBRUSH hBrush; + HPEN hPenHigh,hPenShadow; + RECT rc; + + hDC = GetDC(hWnd); + + CopyRect(&rc,&lp->ButtonRect); + x = rc.left; + y = rc.top; + dx = rc.right; + dy = rc.bottom; + + hPenHigh = GetStockObject(WHITE_PEN); +#if 0 + hPenShadow = GetSysColorPen(COLOR_BTNSHADOW); +#else + hPenShadow = CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNSHADOW)); +#endif +#if 0 + hBrush = GetSysColorBrush(COLOR_BTNFACE); +#else + hBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); +#endif + FillRect(hDC, &rc, hBrush); +#if 0 + hBrush = GetStockObject(BLACK_BRUSH); + FillRect/*FrameRect*/(hDC, &lp->ButtonRect, hBrush); +#else + SelectObject(hDC,GetStockObject(BLACK_PEN)); + Rectangle(hDC,lp->ButtonRect.left,lp->ButtonRect.top,lp->ButtonRect.right,lp->ButtonRect.bottom); +#endif + rc.left += 1; rc.right -= 1; + rc.top += 1; rc.bottom -= 1; + + Draw3DButtonRect(hDC,hPenHigh,hPenShadow,rc,wState); + +#if 0 /* jmt: fix: no LoadBitmap(),GetObject() */ + if (hbmpCombo == 0) + { + hbmpCombo = LoadBitmap(0,(LPSTR)OBM_COMBO); + GetObject(hbmpCombo, sizeof(BITMAP), (LPVOID)&bmpCombo); + nWidth = bmpCombo.bmWidth; + nHeight = bmpCombo.bmHeight; + } + /* + ** MiD 08/15/95 changed to mono bitmap as it is in Windows. Convert + ** it to colors on the fly + */ + hdcSrc = CreateCompatibleDC(hDC); + hbmpOld = SelectObject(hdcSrc, hbmpCombo); + /* + ** Source hdc ok. Prepare the target hdc, then BitBlt to it. + */ + rgbText = SetTextColor(hDC,GetSysColor(COLOR_BTNTEXT)); + rgbBk = SetBkColor(hDC,GetSysColor(COLOR_BTNFACE)); + + cx = (dx - x - nWidth)/2; + cy = (dy - y - nHeight)/2; + if (wState) + { cx++; cy++; } + BitBlt(hDC, x+cx, y+cy, nWidth, nHeight, hdcSrc, 0, 0, SRCCOPY); + + SetTextColor(hDC, rgbText); + SetBkColor(hDC, rgbBk); + SelectObject(hdcSrc,hbmpOld); + DeleteDC(hdcSrc); +#endif /* BitBlt Bitmap */ +#if 1 + DeleteObject(hBrush); + DeleteObject(hPenShadow); +#endif + ReleaseDC(hWnd,hDC); + + if (wState) + SET_STATE(lp,CSF_LOCALBUTTONDOWN); + else + CLEAR_STATE(lp,CSF_LOCALBUTTONDOWN); +} + +#if 0 /* jmt: fix: no COMBOLBOX */ +/************************************************************************ +** +************************************************************************/ +LRESULT DefCOMBOLBOXProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ +#if 0 + return DefLISTBOXProc(hWnd, msg, wParam,lParam); +#endif + return ListboxCtrlProc(hWnd, msg, wParam,lParam); +} +#endif + +/************************************************************************ +** +************************************************************************/ +static void CBoxSendMouseToLBox(COMBOBOX *lp, UINT uiMsg, WPARAM wParam, POINT ptScreen) +{ + POINT pt; + int nNCHit; +#if 0 /* jmt: fix: no scrollbar */ + HWND hWndScroll; +#endif + pt = ptScreen; + ScreenToClient(lp->ListBoxControl,&pt); + + nNCHit = LOSHORT(SendMessage(lp->ListBoxControl, WM_NCHITTEST, 0, MAKELPARAM(ptScreen.x,ptScreen.y))); + + switch (nNCHit) + { + case HTCLIENT: + if (uiMsg == WM_MOUSEMOVE && !IS_SET(lp,CSF_LBOXBUTTONDOWN)) + { + SendMessage(lp->ListBoxControl, WM_LBUTTONDOWN, 0, MAKELONG((WORD)pt.x,(WORD)pt.y)); + + SET_STATE(lp, CSF_BUTTONDOWN | CSF_LBOXBUTTONDOWN); + } + SendMessage(lp->ListBoxControl, uiMsg, wParam, MAKELONG((WORD)pt.x,(WORD)pt.y)); + break; + +#if 0 /* jmt: fix: no scrollbar */ + case HTVSCROLL: + if (0 != (hWndScroll = TWIN_ConvertToSysScroll(lp->ListBoxControl, TRUE /* vertical */, &pt))) + SendMessage(hWndScroll, uiMsg, wParam, MAKELONG((WORD)pt.x,(WORD)pt.y)); + break; +#endif + default: + break; + } +} + +/************************************************************************ +** +************************************************************************/ +static void CBoxCapture(HWND hWnd, WORD wFunc) +{ + static HWND hWndCapture = (HWND)0; + + if (wFunc) + { + hWndCapture = SetCapture(hWnd); + + SetFocus(hWnd); + } + else { + if (!hWndCapture) + ReleaseCapture(); + else { +#ifdef LATER + SetCapture(hWndCapture); +#else + ReleaseCapture(); +#endif + hWndCapture = (HWND)0; + } + } +} + +/************************************************************************ +** +************************************************************************/ +static void CBoxDrawEdit(COMBOBOX *lp, HWND hWnd, UINT uiKey) +{ + int nLen; + LPVOID lpData; +#if 0 /* jmt: fix: no ownerdraw */ + HRGN hRgn; + DRAWITEMSTRUCT dis; +#endif +/* + if (uiKey == (UINT)LB_ERR) + return; + + if (!BOWNERDRAW(lp)) +*/ + if (lp->wStyle & CBS_HASSTRINGS) + { + if (uiKey == (UINT)LB_ERR) + return; + nLen = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, uiKey, 0L); + if (nLen <= 0) + return; + lpData = (LPVOID)WinMalloc(nLen+1); + SendMessage(lp->ListBoxControl, LB_GETTEXT, uiKey, (LPARAM)lpData); + SendMessage(lp->EditControl, WM_SETTEXT, strlen(lpData), (LPARAM)lpData); + Edit_SetSel(lp->EditControl, 0, -1); + WinFree((LPSTR)lpData); + } +#if 0 /* jmt: fix: no ownerdraw */ + else { + dis.CtlType = ODT_COMBOBOX; + dis.CtlID = (UINT)lp->nID; + dis.itemID = -1; /* used to be uiKey */ + dis.itemAction = ODA_DRAWENTIRE; + dis.itemState = ODS_FOCUS; + dis.hwndItem = hWnd; + dis.itemData = 0; + GetClientRect(lp->EditControl,&dis.rcItem); + dis.rcItem.left += 3; + dis.rcItem.right -= 3; + dis.rcItem.top += 2; + dis.rcItem.bottom -= 2; + + dis.hDC = GetDC(lp->EditControl); + hRgn = CreateRectRgnIndirect(&dis.rcItem); + SelectClipRgn(dis.hDC,hRgn); + SelectObject(dis.hDC, lp->hFont); + SendMessage(lp->hWndParent, WM_DRAWITEM, (WPARAM)(UINT)lp->nID, (LPARAM)&dis); + ReleaseDC(lp->EditControl,dis.hDC); + DeleteObject(hRgn); + } +#endif /* ownerdraw */ +} + +/************************************************************************ +** +************************************************************************/ +static void CBoxDrawStatic(COMBOBOX *lp, HWND hWnd, UINT uiKey) +{ + int nLen; + HDC hdc; + LPVOID lpData; + RECT rcClient; + HFONT hfonOld = 0; +#if 0 /* jmt: fix: no ownerdraw */ + HRGN hRgn; + DRAWITEMSTRUCT dis; +#endif + HBRUSH hbrStatic, hbrOld; + + /* Draw rectangle regardless of ownerdraw style... + */ + hdc = GetDC(hWnd); + rcClient.left = 0; + rcClient.top = 0; + rcClient.right = lp->ButtonRect.left+1; + rcClient.bottom = lp->uHeight; + hbrStatic = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); + hbrOld = SelectObject(hdc, hbrStatic); + SelectObject(hdc, GetStockObject(BLACK_PEN));/* ??? COLOR_WINDOWFRAME */ + Rectangle(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); + SelectObject(hdc, hbrOld); + DeleteObject(hbrStatic); + ReleaseDC(hWnd, hdc); + + if (uiKey == (UINT)LB_ERR) + return; + +/* jmt: no ownerdraw */ + if (1) /* (!BOWNERDRAW(lp)) */ + { + /* if necessary, draw text */ + hdc = GetDC(hWnd); + nLen = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, (WPARAM)uiKey, 0L); + if (nLen > 0) + { + lpData = (LPVOID)WinMalloc(nLen+1); + SendMessage(lp->ListBoxControl, LB_GETTEXT, uiKey, (LPARAM)lpData); + SetBkMode(hdc, TRANSPARENT); + if (!IS_SET(lp, CSF_FOCUS)) + { + SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT)); + rcClient.left += 2; + } + else { + InflateRect(&rcClient, -2, -2); + hbrStatic = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT)); + hbrOld = SelectObject(hdc, hbrStatic); + FillRect(hdc, &rcClient, hbrStatic); +#if 0 /* jmt: fix: no DrawFocusRect() */ + DrawFocusRect(hdc, &rcClient); +#endif + SelectObject(hdc, hbrOld); + DeleteObject(hbrStatic); + SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); + } + if (lp->hFont) + hfonOld = SelectObject(hdc, lp->hFont); + DrawText(hdc, (LPSTR)lpData, nLen, &rcClient, DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX); + if (lp->hFont) + SelectObject(hdc, hfonOld); + WinFree((LPVOID)lpData); + } + ReleaseDC(hWnd, hdc); + } +#if 0 /* jmt: fix: no ownerdraw */ + else { /* fill OWNERDRAWSTRUCT and send WM_DRAWITEM message */ + dis.CtlType = ODT_COMBOBOX; + dis.CtlID = (UINT)lp->nID; + dis.itemID = uiKey; + dis.itemAction = ODA_DRAWENTIRE; + dis.itemState = ODS_FOCUS; + dis.hwndItem = hWnd; + dis.itemData = SendMessage(lp->ListBoxControl, LB_GETITEMDATA, uiKey, 0L); + GetClientRect(hWnd, &dis.rcItem); + dis.rcItem.left += 3; + dis.rcItem.right = lp->ButtonRect.left - 2; /* do not touch button */ + dis.rcItem.top += 2; + dis.rcItem.bottom -= 2; + + dis.hDC = GetDC(hWnd); + hRgn = CreateRectRgnIndirect(&dis.rcItem); + SelectClipRgn(dis.hDC, hRgn); + SelectObject(dis.hDC, lp->hFont); + SendMessage(lp->hWndParent, WM_DRAWITEM, (WPARAM)(UINT)lp->nID, (LPARAM)&dis); + ReleaseDC(hWnd, dis.hDC); + DeleteObject(hRgn); + } +#endif /* ownerdraw */ + +} + + +/*------------------------- < Full Revision History > ---------------------- +** Revision 1.2 2001/11/06 23:35:46 greg +** +** Revision 1.1.1.1 2001/06/21 06:32:42 greg +** Microwindows pre8 with patches +** +** Revision 1.1.1.1 2001/06/05 03:44:01 root +** First import of 5/5/2001 Microwindows to CVS +** +** Revision 1.8 2000/08/14 jmt +** ported to microwin(non-client/server mode) +** +** Revision 1.7 2000/06/28 jmt +** porting to microwin +** +** Revision 1.6 2000/01/21 02:48:47 robf +** remove dead code +** +** Revision 1.5 1999/11/29 05:07:54 robf +** removed extraneous call CreateCompatibleDC +** +** Revision 1.4 1999/07/08 18:52:50 mwalsh +** Updated Comments +** +**-------------------------------------------------------------------------*/ + diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/draw3d.c b/packages/services/gfx/mw/current/src/mwin/winlib/draw3d.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/draw3d.c @@ -0,0 +1,144 @@ +#include "windows.h" +#include "wintools.h" +/* + * WIN Draw Library + * Draw3dShadow - draws a shadow with bottom-left and top-right missing + * Draw3dBox - draws a complete shadow + * Draw3dInset - draw a 2 line 3d inset + * Draw3dOutset - draw a 2 line 3d outset + */ + +/* + * Draw3dShadow + * NOINDENT_BLACK T=white, B=black + * NOINDENT_GRAY T=white, B=dkgray + * INDENT_BLACK T=black, B=white + * INDENT_GRAY T=dkgray, B=white + * + * TTTTTTTTTTTTTT + * T B + * T B + * BBBBBBBBBBBBBB + */ +void WINAPI +Draw3dShadow(HDC hDC,int x,int y,int w,int h,COLORREF crTop,COLORREF crBottom) +{ + HPEN hPenTop, hPenBottom, holdPen; + + hPenTop = CreatePen( PS_SOLID, 1, crTop); + hPenBottom = CreatePen( PS_SOLID, 1, crBottom); + holdPen = SelectObject( hDC, hPenTop); + MoveToEx( hDC, x, y+h-2, NULL); + LineTo( hDC, x, y); /* left side*/ + LineTo( hDC, x+w-1, y); /* top side*/ + + SelectObject( hDC, hPenBottom); + MoveToEx( hDC, x+w-1, y+1, NULL); + LineTo( hDC, x+w-1, y+h-1); /* right side*/ + LineTo( hDC, x, y+h-1); /* bottom side*/ + + SelectObject( hDC, holdPen); + DeleteObject( hPenTop); + DeleteObject( hPenBottom); +} + +/* + * Draw3dBox + * + * TTTTTTTTTTTTTTB + * T B + * T B + * BBBBBBBBBBBBBBB + */ +void WINAPI +Draw3dBox(HDC hDC,int x,int y,int w,int h,COLORREF crTop,COLORREF crBottom) +{ + HPEN hPenTop, hPenBottom, holdPen; + + hPenTop = CreatePen( PS_SOLID, 1, crTop); + hPenBottom = CreatePen( PS_SOLID, 1, crBottom); + holdPen = SelectObject( hDC, hPenTop); + MoveToEx( hDC, x, y+h-2, NULL); + LineTo( hDC, x, y); /* left side*/ + MoveToEx( hDC, x, y, NULL); + LineTo( hDC, x+w-1, y); /* top side*/ + + SelectObject( hDC, hPenBottom); + MoveToEx( hDC, x+w-1, y, NULL); + LineTo( hDC, x+w-1, y+h-1); /* right side*/ + LineTo( hDC, x-1, y+h-1); /* bottom side*/ + + SelectObject( hDC, holdPen); + DeleteObject( hPenTop); + DeleteObject( hPenBottom); +} + +/* + * Draw 2 line deep 3d inset + */ +void WINAPI +Draw3dInset(HDC hDC,int x,int y,int w,int h) +{ + Draw3dBox(hDC, x, y, w, h, + GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT)); + ++x; ++y; w -= 2; h -= 2; + Draw3dBox(hDC, x, y, w, h, + GetSysColor(COLOR_WINDOWFRAME), GetSysColor(COLOR_3DLIGHT)); +} + +/* + * Draw 2 line deep 3d outset + */ +void WINAPI +Draw3dOutset(HDC hDC,int x,int y,int w,int h) +{ + Draw3dBox(hDC, x, y, w, h, + GetSysColor(COLOR_3DLIGHT), GetSysColor(COLOR_WINDOWFRAME)); + ++x; ++y; w -= 2; h -= 2; + Draw3dBox(hDC, x, y, w, h, + GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW)); +} + +/* + * Draw 1 line pushed down rectangle + */ +void WINAPI +Draw3dPushDown(HDC hDC, int x, int y, int w, int h) +{ + Draw3dBox(hDC, x, y, w, h, GetSysColor(COLOR_BTNSHADOW), + GetSysColor(COLOR_BTNSHADOW)); +} + +/* + * Draw either 3d up or down depending on state + */ +void WINAPI +Draw3dUpDownState(HDC hDC, int x, int y, int w, int h, BOOL fDown) +{ + if (fDown) + Draw3dPushDown(hDC, x, y, w, h); + else Draw3dOutset(hDC, x, y, w, h); +} + +void WINAPI +Draw3dUpFrame(HDC hDC, int l, int t, int r, int b) +{ + RECT rc; + HBRUSH hbr; + + SetRect(&rc, l, t, r, b); + Draw3dBox(hDC, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_3DLIGHT), + GetSysColor(COLOR_WINDOWFRAME)); + InflateRect(&rc, -1, -1); + Draw3dBox(hDC, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_BTNHIGHLIGHT), + GetSysColor(COLOR_BTNSHADOW)); + InflateRect(&rc, -1, -1); + + hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); + FillRect(hDC, &rc, hbr); + DeleteObject(hbr); +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/edit.c b/packages/services/gfx/mw/current/src/mwin/winlib/edit.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/edit.c @@ -0,0 +1,1172 @@ +/* + * Copyright (C) 1999, 2000, Wei Yongming. + * Portions Copyright (c) 2000 Greg Haerr + * + * Edit control for Microwindows win32 api. + */ + +/* +** This library is free software; you can redistribute it and/or +** modify it under the terms of the GNU Library General Public +** License as published by the Free Software Foundation; either +** version 2 of the License, or (at your option) any later version. +** +** This library 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 +** Library General Public License for more details. +** +** You should have received a copy of the GNU Library General Public +** License along with this library; if not, write to the Free +** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +** MA 02111-1307, USA +*/ + +/* +** Alternatively, the contents of this file may be used under the terms +** of the Mozilla Public License (the "MPL License") in which case the +** provisions of the MPL License are applicable instead of those above. +*/ + +/* Note: +** Although there was a version by Zhao Jianghua, this version of +** EDIT control is written by Wei Yongming from scratch. +** +** Create date: 1999/8/26 +** +** Modify records: +** +** Who When Where For What Status +**----------------------------------------------------------------------------- +** WEI Yongming 2000/02/24 Tsinghua Add MPL License Finished +** Kevin Tseng 2000/05/30 gv port to microwin ported +** Greg Haerr 2000/06/16 Utah 3d look, bug fixes Finished +** Kevin Tseng 2000/06/22 gv port to mw-nanox ported +** +** TODO: +** * Selection. +** * Undo. +*/ + +#include +#include +#include +#define MWINCLUDECOLORS +#include "windows.h" /* windef.h, winuser.h */ +#include "wintools.h" +#include "device.h" /* GdGetTextSize */ + +#define USE_BIG5 + +#if 0 +#define DEFAULT_FONT DEFAULT_GUI_FONT +#endif +#define DEFAULT_FONT SYSTEM_FIXED_FONT + +#define WIDTH_EDIT_BORDER 2 +#define MARGIN_EDIT_LEFT 1 +#define MARGIN_EDIT_TOP 1 +#define MARGIN_EDIT_RIGHT 2 +#define MARGIN_EDIT_BOTTOM 1 + +#define LEN_SLEDIT_BUFFER 3000 +#define LEN_SLEDIT_UNDOBUFFER 1024 + +#define EST_FOCUSED 0x00000001L +#define EST_MODIFY 0x00000002L +#define EST_READONLY 0x00000004L +#define EST_REPLACE 0x00000008L + +#define EDIT_OP_NONE 0x00 +#define EDIT_OP_DELETE 0x01 +#define EDIT_OP_INSERT 0x02 +#define EDIT_OP_REPLACE 0x03 + +typedef struct tagSLEDITDATA { + HFONT hFont; /* hFont used */ + int bufferLen; /* length of buffer */ + + int dataEnd; /* data end position */ + int editPos; /* current edit position */ + int caretOff; /* caret offset in box */ + int startPos; /* start display position */ + + int selStart; /* selection start position */ + int selEnd; /* selection end position */ + + int passwdChar; /* password character */ + + int leftMargin; /* left margin */ + int topMargin; /* top margin */ + int rightMargin; /* right margin */ + int bottomMargin; /* bottom margin */ + + int hardLimit; /* hard limit */ + + int lastOp; /* last operation */ + int lastPos; /* last operation position */ + int affectedLen; /* affected len of last operation */ + int undoBufferLen; /* undo buffer len */ + char undoBuffer [LEN_SLEDIT_UNDOBUFFER]; /* Undo buffer; */ + char buffer [LEN_SLEDIT_BUFFER]; /* buffer */ +} SLEDITDATA, *PSLEDITDATA; + +static LRESULT CALLBACK +SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + +static int GetSysCharHeight (HWND hwnd) +{ +#ifndef USE_BIG5 + HDC hdc; + int xw, xh, xb; + + hdc = GetDC(hwnd); + SelectObject(hdc, GetStockObject(DEFAULT_FONT)); + GdSetFont(hdc->font->pfont); + GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII); + ReleaseDC(hwnd,hdc); + + return xh; +#else + return 12; +#endif +} + +static int GetSysCharWidth (HWND hwnd) +{ +#ifndef USE_BIG5 + HDC hdc; + int xw, xh, xb; + + hdc = GetDC(hwnd); + SelectObject(hdc, GetStockObject(DEFAULT_FONT)); + GdSetFont(hdc->font->pfont); + GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII); + ReleaseDC(hwnd,hdc); + + return xw; +#else + return 6; +#endif +} + +static int GetSysCCharWidth (HWND hwnd) +{ + return (2*GetSysCharWidth(hwnd)); +} + +int WINAPI MwRegisterEditControl(HINSTANCE hInstance) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)SLEditCtrlProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = NULL; + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground= GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName= "EDIT"; + + return RegisterClass(&wc); +} + +static int edtGetOutWidth (const HWND pCtrl) +{ + return pCtrl->clirect.right - pCtrl->clirect.left + - ((PSLEDITDATA)(pCtrl->userdata2))->leftMargin + - ((PSLEDITDATA)(pCtrl->userdata2))->rightMargin; +} + +static int edtGetStartDispPosAtEnd (const HWND pCtrl, PSLEDITDATA pSLEditData) +{ + int nOutWidth = edtGetOutWidth (pCtrl); + int endPos = pSLEditData->dataEnd; + int newStartPos = pSLEditData->startPos; + const char* buffer = pSLEditData->buffer; + + while (TRUE) { + if ((endPos - newStartPos) * GetSysCharWidth (pCtrl) < nOutWidth) + break; + + /* FIXME: #ifdef GB2312?*/ + if ((BYTE)buffer [newStartPos] > 0xA0) /* 1st:gb:a1-f7,big5:a1-f9 */ + { + newStartPos ++; + if (newStartPos < pSLEditData->dataEnd) + { +#ifndef USE_BIG5 + if ((BYTE)buffer [newStartPos] > 0xA0) +#else /* 2nd:gb:a1-fe,big5:40-7e,a1-fe */ + if ( ((BYTE)buffer [newStartPos] >= 0x40 && (BYTE)buffer[newStartPos] <= 0x7e) || + ((BYTE)buffer [newStartPos] >= 0xa1 && (BYTE)buffer[newStartPos] <= 0xfe)) +#endif + newStartPos ++; + } + } + else + newStartPos ++; + } + + return newStartPos; +} + +static int edtGetDispLen (const HWND pCtrl) +{ + int i, n = 0; + int nOutWidth = edtGetOutWidth (pCtrl); + int nTextWidth = 0; + PSLEDITDATA pSLEditData = (PSLEDITDATA)(pCtrl->userdata2); + const char* buffer = pSLEditData->buffer; + + for (i = pSLEditData->startPos; i < pSLEditData->dataEnd; i++) { + /* FIXME #ifdef GB2312?*/ + if ((BYTE)buffer [i] > 0xA0) /* st:gb:a1-f7,big5:a1-f9 */ + { + i++; + if (i < pSLEditData->dataEnd) + { +#ifndef USE_BIG5 + if ((BYTE)buffer [i] > 0xA0) /* 2nd:gb:a1-fe,big5:40-7e,a1-fe */ +#else /* 2nd:gb:a1-fe,big5:40-7e,a1-fe */ + if ( ((BYTE)buffer [i] >= 0x40 && (BYTE)buffer[i] <= 0x7e) || + ((BYTE)buffer [i] >= 0xa1 && (BYTE)buffer[i] <= 0xfe)) +#endif + { + nTextWidth += GetSysCCharWidth (pCtrl); + n += 2; + } + else + i--; + } + else + { + nTextWidth += GetSysCharWidth (pCtrl); + n++; + } + } + else + { + nTextWidth += GetSysCharWidth (pCtrl); + n++; + } + + if (nTextWidth > nOutWidth) + break; + } + + return n; +} + +static int edtGetOffset (HWND hwnd,const SLEDITDATA* pSLEditData, int x) +{ + int i; + int newOff = 0; + int nTextWidth = 0; + const char* buffer = pSLEditData->buffer; + + x -= pSLEditData->leftMargin; + for (i = pSLEditData->startPos; i < pSLEditData->dataEnd; i++) { + if ((nTextWidth + (GetSysCharWidth(hwnd) >> 1)) >= x) + break; + + /* FIXME #ifdef GB2312?*/ + if ((BYTE)buffer [i] > 0xA0) /* 1st:gb:a1-f7,big5:a1-f9 */ + { + i++; + if (i < pSLEditData->dataEnd) + { +#ifndef USE_BIG5 + if ((BYTE)buffer [i] > 0xA0) /* 2nd:gb:a1-fe,big5:40-7e,a1-fe */ +#else /* 2nd:gb:a1-fe,big5:40-7e,a1-fe */ + if ( ((BYTE)buffer [i] >= 0x40 && (BYTE)buffer[i] <= 0x7e) || + ((BYTE)buffer [i] >= 0xa1 && (BYTE)buffer[i] <= 0xfe)) +#endif + { + nTextWidth += GetSysCCharWidth (hwnd); + newOff += 2; + } + else + i --; + } + else + { + nTextWidth += GetSysCharWidth (hwnd); + newOff ++; + } + } + else + { + nTextWidth += GetSysCharWidth (hwnd); + newOff ++; + } + + } + + return newOff; +} + +static BOOL edtIsACCharBeforePosition (const char* string, int pos) +{ + if (pos < 2) + return FALSE; + +/* 1st:gb:a1-f7,big5:a1-f9 2nd:gb:a1-fe,big5:40-7e,a1-fe */ +#ifndef USE_BIG5 + /* FIXME #ifdef GB2312?*/ + if ((BYTE)string [pos - 2] > 0xA0 && (BYTE)string [pos - 1] > 0xA0) + return TRUE; +#else + if ((BYTE)string [pos - 2] > 0xA0) + { + if ( ((BYTE)string [pos - 1] >= 0x40 && (BYTE)string[pos - 1] <= 0x7e) || + ((BYTE)string [pos - 1] >= 0xa1 && (BYTE)string[pos - 1] <= 0xfe)) + return TRUE; + } +#endif + + return FALSE; +} + +static BOOL edtIsACCharAtPosition (const char* string, int len, int pos) +{ + if (pos > (len - 2)) + return FALSE; + +/* 1st:gb:a1-f7,big5:a1-f9 2nd:gb:a1-fe,big5:40-7e,a1-fe */ +#ifndef USE_BIG5 + if ((BYTE)string [pos] > 0xA0 && (BYTE)string [pos + 1] > 0xA0) + return TRUE; +#else + if ((BYTE)string [pos] > 0xA0) + { + if ( ((BYTE)string [pos + 1] >= 0x40 && (BYTE)string [pos + 1] <= 0x7e) || + ((BYTE)string [pos + 1] >= 0xa1 && (BYTE)string [pos + 1] <= 0xfe)) { + /*fprintf(stderr,"true\n"); + fflush(stderr);*/ + return TRUE; + } + } +#endif + + return FALSE; +} + +LRESULT CALLBACK +SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND pCtrl; + DWORD dwStyle; + HDC hdc; + PSLEDITDATA pSLEditData; + RECT rc; + + pCtrl = hWnd; + dwStyle = pCtrl->style; + + switch (message) + { + case WM_CREATE: + if (!(pSLEditData = malloc (sizeof (SLEDITDATA)))) { + fprintf (stderr, "EDIT: malloc error!\n"); + return -1; + } + + pSLEditData->hFont = GetStockObject(DEFAULT_FONT); + + pSLEditData->bufferLen = LEN_SLEDIT_BUFFER; + pSLEditData->editPos = 0; + pSLEditData->caretOff = 0; + pSLEditData->startPos = 0; + + pSLEditData->selStart = 0; + pSLEditData->selEnd = 0; + pSLEditData->passwdChar = '*'; + pSLEditData->leftMargin = MARGIN_EDIT_LEFT; + pSLEditData->topMargin = MARGIN_EDIT_TOP; + pSLEditData->rightMargin = MARGIN_EDIT_RIGHT; + pSLEditData->bottomMargin = MARGIN_EDIT_BOTTOM; + + pSLEditData->hardLimit = -1; + + /* undo information */ + pSLEditData->lastOp = EDIT_OP_NONE; + pSLEditData->lastPos = 0; + pSLEditData->affectedLen = 0; + pSLEditData->undoBufferLen = LEN_SLEDIT_UNDOBUFFER; + pSLEditData->undoBuffer [0] = '\0'; + + pSLEditData->dataEnd = strlen (pCtrl->szTitle); + memcpy (pSLEditData->buffer, pCtrl->szTitle, + min (LEN_SLEDIT_BUFFER, pSLEditData->dataEnd)); + + pCtrl->userdata2 = (DWORD) pSLEditData; + + pCtrl->userdata = 0; + break; + + case WM_DESTROY: + DestroyCaret (); + + free ((void*)pCtrl->userdata2); + break; +#if 0 + case WM_CHANGESIZE: + { + pCtrl->cl = pCtrl->left + WIDTH_EDIT_BORDER; + pCtrl->ct = pCtrl->top + WIDTH_EDIT_BORDER; + pCtrl->cr = pCtrl->right - WIDTH_EDIT_BORDER; + pCtrl->cb = pCtrl->bottom - WIDTH_EDIT_BORDER; + } + break; +#endif + +#if 1 /* jmt: for edit: chinese support */ + case WM_SETFONT: + { + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + pSLEditData->hFont = (HFONT)wParam; + + ShowWindow(hWnd, SW_HIDE); + ShowWindow(hWnd, SW_SHOWNA); + + if(LOWORD(lParam)) + InvalidateRect(hWnd,NULL,TRUE); + } + return (LRESULT)0; + + case WM_GETFONT: + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + return (LRESULT)pSLEditData->hFont; +#endif + +#if 0 + case WM_SETCURSOR: + if (dwStyle & WS_DISABLED) + { + SetCursor (GetSystemCursor (IDC_ARROW)); + return 0; + } + break; +#endif + case WM_KILLFOCUS: + pCtrl->userdata &= ~EST_FOCUSED; + + HideCaret (hWnd); + DestroyCaret (); + + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (pCtrl->id, EN_KILLFOCUS), (LPARAM)hWnd); + break; + + case WM_SETFOCUS: + if (pCtrl->userdata & EST_FOCUSED) + return 0; + + pCtrl->userdata |= EST_FOCUSED; + + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + /* only implemented for ES_LEFT align format. */ + + CreateCaret (hWnd, NULL, 1 /*+ GetSysCharWidth(hWnd)*/, + hWnd->clirect.bottom-hWnd->clirect.top-2); + SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) + + pSLEditData->leftMargin, pSLEditData->topMargin); + ShowCaret (hWnd); + + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (pCtrl->id, EN_SETFOCUS), (LPARAM) hWnd); + break; + + case WM_ENABLE: + if ( (!(dwStyle & WS_DISABLED) && !wParam) + || ((dwStyle & WS_DISABLED) && wParam) ) { + if (wParam) + pCtrl->style &= ~WS_DISABLED; + else + pCtrl->style |= WS_DISABLED; + + InvalidateRect (hWnd, NULL, FALSE); + } + break; + + case WM_NCCALCSIZE: + { + LPNCCALCSIZE_PARAMS lpnc; + + /* calculate client rect from passed window rect in rgrc[0]*/ + lpnc = (LPNCCALCSIZE_PARAMS)lParam; + if(GetWindowLong(hWnd, GWL_STYLE) & WS_BORDER) + InflateRect(&lpnc->rgrc[0], -2, -2); + } + break; + + case WM_NCPAINT: + hdc = wParam? (HDC)wParam: GetWindowDC (hWnd); + GetWindowRect(hWnd, &rc); + + if (dwStyle & WS_BORDER) + Draw3dInset(hdc, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top); + + if (!wParam) + ReleaseDC (hWnd, hdc); + break; + + case WM_PAINT: + { + int dispLen; + char* dispBuffer; + RECT rect,rc; + PAINTSTRUCT ps; + + HGDIOBJ oldfont; + oldfont=NULL; + + hdc = BeginPaint (hWnd,&ps); + GetClientRect (hWnd, &rect); + + if (dwStyle & WS_DISABLED) + { +#if 0 + SetBrushColor (hdc, LTGRAY/*COLOR_lightgray*/); + FillBox (hdc, 0, 0, rect.right, rect.bottom); +#else + rc.left=0; rc.top=0; rc.bottom=rect.bottom; rc.right=rect.right; + FillRect(hdc,&rc,GetStockObject(LTGRAY_BRUSH)); +#endif + SetBkColor (hdc, LTGRAY/*COLOR_lightgray*/); + } + else + { +#if 0 + SetBrushColor (hdc, WHITE/*COLOR_lightwhite*/); + FillBox (hdc, 0, 0, rect.right, rect.bottom); +#else + rc.left=0; rc.top=0; rc.bottom=rect.bottom; rc.right=rect.right; + FillRect(hdc,&rc,GetStockObject(WHITE_BRUSH)); +#endif + SetBkColor (hdc, WHITE/*COLOR_lightwhite*/); + } + + SetTextColor (hdc, BLACK/*COLOR_black*/); + dispLen = edtGetDispLen (pCtrl); + if (dispLen == 0) + { + EndPaint (hWnd, &ps); + break; + } + + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + +#ifdef _DEBUG + if (pSLEditData->startPos > pSLEditData->dataEnd) + fprintf (stderr, "ASSERT failure: %s.\n", "Edit Paint"); +#endif + + dispBuffer = ALLOCA(dispLen + 1); + + if (dwStyle & ES_PASSWORD) + memset (dispBuffer, '*', dispLen); + else + memcpy (dispBuffer, + pSLEditData->buffer + pSLEditData->startPos, + dispLen); + + dispBuffer [dispLen] = '\0'; + + /* only implemented ES_LEFT align format for single line edit. */ + rect.left += pSLEditData->leftMargin; + rect.top += pSLEditData->topMargin; + rect.right -= pSLEditData->rightMargin; + rect.bottom -= pSLEditData->bottomMargin; + +#if 0 /* FIXME no ClipRectIntersect() */ +#if 0 + ClipRectIntersect (hdc, &rect); +#else + GdSetClipRects(hdc->psd,1,&rect); /*??==ClipRectIntersect??*/ +#endif +#endif + +#ifdef USE_BIG5 + oldfont=SelectObject(hdc,CreateFont(12, + 0,0,0,0,0,0,0,0,0,0,0, + FF_DONTCARE|DEFAULT_PITCH, + "HZXFONT")); +#else + SelectObject(hdc, pSLEditData->hFont); +#endif + TextOut (hdc, pSLEditData->leftMargin, pSLEditData->topMargin, + dispBuffer,-1); + +#ifdef USE_BIG5 + DeleteObject(SelectObject(hdc,oldfont)); +#endif + + EndPaint (hWnd, &ps); + + FREEA(dispBuffer); + } + break; +#if 1 /* jmt+ */ + case WM_KEYDOWN: + { + BOOL bChange = FALSE; + int i; + RECT InvRect; + int deleted; + + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + + switch ((int)(wParam)) /* (LOWORD (wParam)) */ + { +#if 0 + case SCANCODE_ENTER: + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (pCtrl->id, EN_ENTER), (LPARAM) hWnd); + return 0; + + case SCANCODE_HOME: + if (pSLEditData->editPos == 0) + return 0; + + pSLEditData->editPos = 0; + pSLEditData->caretOff = 0; + + SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) + + pSLEditData->leftMargin, pSLEditData->topMargin); + if (pSLEditData->startPos != 0) + InvalidateRect (hWnd, NULL, FALSE); + + pSLEditData->startPos = 0; + return 0; + + case SCANCODE_END: + { + int newStartPos; + + if (pSLEditData->editPos == pSLEditData->dataEnd) + return 0; + + newStartPos = edtGetStartDispPosAtEnd (pCtrl, pSLEditData); + + pSLEditData->editPos = pSLEditData->dataEnd; + pSLEditData->caretOff = pSLEditData->editPos - newStartPos; + + SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) + + pSLEditData->leftMargin, pSLEditData->topMargin); + if (pSLEditData->startPos != newStartPos) + InvalidateRect (hWnd, NULL, FALSE); + + pSLEditData->startPos = newStartPos; + } + return 0; +#endif + + case VK_LEFT: /* SCANCODE_CURSORBLOCKLEFT: */ + { + BOOL bScroll = FALSE; + int scrollStep; + + if (pSLEditData->editPos == 0) + return 0; + + if (edtIsACCharBeforePosition (pSLEditData->buffer, + pSLEditData->editPos)) + { + scrollStep = 2; + pSLEditData->editPos -= 2; + } + else { + scrollStep = 1; + pSLEditData->editPos --; + } + + pSLEditData->caretOff -= scrollStep; + if (pSLEditData->caretOff == 0 + && pSLEditData->editPos != 0) + { + bScroll = TRUE; + + if (edtIsACCharBeforePosition (pSLEditData->buffer, + pSLEditData->editPos)) + { + pSLEditData->startPos -= 2; + pSLEditData->caretOff = 2; + } + else + { + pSLEditData->startPos --; + pSLEditData->caretOff = 1; + } + } + else if (pSLEditData->caretOff < 0) + { + pSLEditData->startPos = 0; + pSLEditData->caretOff = 0; + } + + SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) + + pSLEditData->leftMargin, pSLEditData->topMargin); + + if (bScroll) + InvalidateRect (hWnd, NULL, FALSE); + } + return 0; + + case VK_RIGHT: /* SCANCODE_CURSORBLOCKRIGHT: */ + { + BOOL bScroll = FALSE; + int scrollStep, moveStep; + + if (pSLEditData->editPos == pSLEditData->dataEnd) + return 0; + + if (edtIsACCharAtPosition (pSLEditData->buffer, + pSLEditData->dataEnd, + pSLEditData->startPos)) + { + if (edtIsACCharAtPosition (pSLEditData->buffer, + pSLEditData->dataEnd, + pSLEditData->editPos)) + { + scrollStep = 2; + moveStep = 2; + pSLEditData->editPos += 2; + } + else + { + scrollStep = 2; + moveStep = 1; + pSLEditData->editPos ++; + } + } + else + { + if (edtIsACCharAtPosition (pSLEditData->buffer, + pSLEditData->dataEnd, + pSLEditData->editPos)) + { + if (edtIsACCharAtPosition (pSLEditData->buffer, + pSLEditData->dataEnd, + pSLEditData->startPos + 1)) + scrollStep = 3; + else + scrollStep = 2; + + moveStep = 2; + pSLEditData->editPos += 2; + } + else + { + scrollStep = 1; + moveStep = 1; + pSLEditData->editPos ++; + } + } + + pSLEditData->caretOff += moveStep; + if (pSLEditData->caretOff * GetSysCharWidth (hWnd) + > edtGetOutWidth (pCtrl)) + { + bScroll = TRUE; + pSLEditData->startPos += scrollStep; + + pSLEditData->caretOff = + pSLEditData->editPos - pSLEditData->startPos; + } + + SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) + + pSLEditData->leftMargin, pSLEditData->topMargin); + if (bScroll) + InvalidateRect (hWnd, NULL, FALSE); + } + return 0; +#if 0 + case SCANCODE_INSERT: + pCtrl->userdata ^= EST_REPLACE; + break; +#endif + case VK_DELETE: /* SCANCODE_REMOVE: */ + if ((pCtrl->userdata & EST_READONLY) + || (pSLEditData->editPos == pSLEditData->dataEnd)){ + #if 0 /* fix: no ping() */ + Ping (); + #endif + return 0; + } + + if (edtIsACCharAtPosition (pSLEditData->buffer, + pSLEditData->dataEnd, pSLEditData->editPos)) + deleted = 2; + else + deleted = 1; + + for (i = pSLEditData->editPos; + i < pSLEditData->dataEnd - deleted; i++) + pSLEditData->buffer [i] + = pSLEditData->buffer [i + deleted]; + + pSLEditData->dataEnd -= deleted; + bChange = TRUE; + + InvRect.left = pSLEditData->leftMargin + + pSLEditData->caretOff * GetSysCharWidth (hWnd); + InvRect.top = pSLEditData->topMargin; + InvRect.right = pCtrl->clirect.right - pCtrl->clirect.left; + InvRect.bottom = pCtrl->clirect.bottom - pCtrl->clirect.top; + + InvalidateRect (hWnd, &InvRect, FALSE); + break; + + case VK_BACK: /* SCANCODE_BACKSPACE: */ + if ((pCtrl->userdata & EST_READONLY) + || (pSLEditData->editPos == 0)) { +#if 0 /* fix: no ping */ + Ping (); +#endif + return 0; + } + + if (edtIsACCharBeforePosition (pSLEditData->buffer, + pSLEditData->editPos)) + deleted = 2; + else + deleted = 1; + + for (i = pSLEditData->editPos; + i < pSLEditData->dataEnd; + i++) + pSLEditData->buffer [i - deleted] + = pSLEditData->buffer [i]; + + pSLEditData->dataEnd -= deleted; + pSLEditData->editPos -= deleted; + bChange = TRUE; + + pSLEditData->caretOff -= deleted; + if (pSLEditData->caretOff == 0 + && pSLEditData->editPos != 0) { + if (edtIsACCharBeforePosition (pSLEditData->buffer, + pSLEditData->editPos)) { + pSLEditData->startPos -= 2; + pSLEditData->caretOff = 2; + } + else { + pSLEditData->startPos --; + pSLEditData->caretOff = 1; + } + + InvRect.left = pSLEditData->leftMargin; + InvRect.top = pSLEditData->topMargin; + InvRect.right = pCtrl->clirect.right - + pCtrl->clirect.left; + InvRect.bottom = pCtrl->clirect.bottom - + pCtrl->clirect.top; + } + else { + InvRect.left = pSLEditData->leftMargin + + pSLEditData->caretOff * GetSysCharWidth (hWnd); + InvRect.top = pSLEditData->topMargin; + InvRect.right = pCtrl->clirect.right - + pCtrl->clirect.left; + InvRect.bottom = pCtrl->clirect.bottom - + pCtrl->clirect.top; + } + + SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) + + pSLEditData->leftMargin, pSLEditData->topMargin); + InvalidateRect (hWnd, &InvRect, FALSE); + break; + + default: + break; + } + + if (bChange) + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (pCtrl->id, EN_CHANGE), (LPARAM) hWnd); + } + break; +#endif + case WM_CHAR: + { + char charBuffer [2]; + int i, chars, scrollStep, inserting; + RECT InvRect; + + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + + if (dwStyle & ES_READONLY) { + +#if 0 /* fix: no ping() */ + Ping(); +#endif + return 0; + } + + if (HIBYTE (wParam)) { + charBuffer [0] = LOBYTE (wParam); + charBuffer [1] = HIBYTE (wParam); + chars = 2; + } + else { + charBuffer [0] = LOBYTE (wParam); + chars = 1; + } + + if (chars == 1) { + switch (charBuffer [0]) + { + case 0x00: /* NULL */ + case 0x07: /* BEL */ + case 0x08: /* BS */ + case 0x09: /* HT */ + case 0x0A: /* LF */ + case 0x0B: /* VT */ + case 0x0C: /* FF */ + case 0x0D: /* CR */ + case 0x1B: /* Escape */ + return 0; + } + } + + if (pCtrl->userdata & EST_REPLACE) { + if (pSLEditData->dataEnd == pSLEditData->editPos) + inserting = chars; + else if (edtIsACCharAtPosition (pSLEditData->buffer, + pSLEditData->dataEnd, + pSLEditData->editPos)) { + if (chars == 2) + inserting = 0; + else + inserting = -1; + } + else { + if (chars == 2) + inserting = 1; + else + inserting = 0; + } + } + else + inserting = chars; + + /* check space */ + if (pSLEditData->dataEnd + inserting > pSLEditData->bufferLen) { + +#if 0 /* fix: no ping() */ + Ping (); +#endif + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (pCtrl->id, EN_MAXTEXT), (LPARAM) hWnd); + return 0; + } + else if ((pSLEditData->hardLimit >= 0) + && ((pSLEditData->dataEnd + inserting) + > pSLEditData->hardLimit)) { +#if 0 /* fix: no ping() */ + Ping (); +#endif + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (pCtrl->id, EN_MAXTEXT), (LPARAM) hWnd); + return 0; + } + + if (inserting == -1) { + for (i = pSLEditData->editPos; i < pSLEditData->dataEnd-1; i++) + pSLEditData->buffer [i] = pSLEditData->buffer [i + 1]; + } + else if (inserting > 0) { + for (i = pSLEditData->dataEnd + inserting - 1; + i > pSLEditData->editPos + inserting - 1; + i--) + pSLEditData->buffer [i] + = pSLEditData->buffer [i - inserting]; + } + + for (i = 0; i < chars; i++) + pSLEditData->buffer [pSLEditData->editPos + i] + = charBuffer [i]; + + pSLEditData->editPos += chars; + pSLEditData->caretOff += chars; + pSLEditData->dataEnd += inserting; + + if (pSLEditData->caretOff * GetSysCharWidth (hWnd) + > edtGetOutWidth (pCtrl)) + { + if (edtIsACCharAtPosition (pSLEditData->buffer, + pSLEditData->dataEnd, + pSLEditData->startPos)) + scrollStep = 2; + else { + if (chars == 2) { + if (edtIsACCharAtPosition (pSLEditData->buffer, + pSLEditData->dataEnd, + pSLEditData->startPos + 1)) + scrollStep = 3; + else + scrollStep = 2; + } + else + scrollStep = 1; + } + + pSLEditData->startPos += scrollStep; + + pSLEditData->caretOff = + pSLEditData->editPos - pSLEditData->startPos; + + InvRect.left = pSLEditData->leftMargin; + InvRect.top = pSLEditData->topMargin; + InvRect.right = pCtrl->clirect.right - pCtrl->clirect.left; + InvRect.bottom = pCtrl->clirect.bottom - pCtrl->clirect.top; + } + else { + InvRect.left = pSLEditData->leftMargin + + (pSLEditData->caretOff - chars) + * GetSysCharWidth (hWnd); + InvRect.top = pSLEditData->topMargin; + InvRect.right = pCtrl->clirect.right - pCtrl->clirect.left; + InvRect.bottom = pCtrl->clirect.bottom - pCtrl->clirect.top; + } + + SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) + + pSLEditData->leftMargin, pSLEditData->topMargin); + InvalidateRect (hWnd, &InvRect, FALSE); + + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (pCtrl->id, EN_CHANGE), (LPARAM) hWnd); + } + break; + + case WM_GETTEXTLENGTH: + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + return pSLEditData->dataEnd; + + case WM_GETTEXT: + { + char* buffer = (char*)lParam; + int len; + + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + + len = min ((int)wParam, pSLEditData->dataEnd); + + memcpy (buffer, pSLEditData->buffer, len); + buffer [len] = '\0'; + + return len; + } + break; + + case WM_SETTEXT: + { + int len; + + if (dwStyle & ES_READONLY) + return 0; + + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + + + len = strlen ((char*)lParam); + len = min (len, pSLEditData->bufferLen); + + if (pSLEditData->hardLimit >= 0) + len = min (len, pSLEditData->hardLimit); + + pSLEditData->dataEnd = len; + memcpy (pSLEditData->buffer, (char*)lParam, len); + + pSLEditData->editPos = 0; + pSLEditData->caretOff = 0; + pSLEditData->startPos = 0; + + InvalidateRect (hWnd, NULL, FALSE); + } + break; + + case WM_LBUTTONDBLCLK: + break; + + case WM_LBUTTONDOWN: + { + int newOff; + + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + newOff = edtGetOffset (hWnd,pSLEditData, LOWORD (lParam)); + + if (newOff != pSLEditData->caretOff) + { + pSLEditData->editPos += newOff - pSLEditData->caretOff; + pSLEditData->caretOff = newOff; + + SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) + + pSLEditData->leftMargin, pSLEditData->topMargin); + } + } + break; + + case WM_LBUTTONUP: + break; + + case WM_MOUSEMOVE: + break; + + case WM_GETDLGCODE: + return DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS; + + case EM_SETREADONLY: + if (wParam) + pCtrl->style/*dwStyle*/ |= ES_READONLY; + else + pCtrl->style/*dwStyle*/ &= ~ES_READONLY; + return 0; + + case EM_SETPASSWORDCHAR: + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + + if (pSLEditData->passwdChar != (int)wParam) { + if (dwStyle & ES_PASSWORD) { + pSLEditData->passwdChar = (int)wParam; + InvalidateRect (hWnd, NULL, TRUE); + } + } + return 0; + + case EM_GETPASSWORDCHAR: + { + int* passwdchar; + + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + passwdchar = (int*) lParam; + + *passwdchar = pSLEditData->passwdChar; + } + return 0; + + case EM_LIMITTEXT: + { + int newLimit = (int)wParam; + + if (newLimit >= 0) { + pSLEditData = (PSLEDITDATA) (pCtrl->userdata2); + if (pSLEditData->bufferLen < newLimit) + pSLEditData->hardLimit = -1; + else + pSLEditData->hardLimit = newLimit; + } + } + return 0; + + default: + return DefWindowProc (hWnd, message, wParam, lParam); + break; + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/fastfill.c b/packages/services/gfx/mw/current/src/mwin/winlib/fastfill.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/fastfill.c @@ -0,0 +1,19 @@ +#include "windows.h" +#include "wintools.h" +/* + * WIN Draw Library + * Fast fill rectangle + */ + +/* + * fast fill background (works with non-dithered colors only) + */ +void WINAPI +FastFillRect(HDC hdc,LPRECT lprect,COLORREF cr) +{ + COLORREF crOld; + + crOld = SetBkColor( hdc, cr); + ExtTextOut( hdc, 0, 0, ETO_OPAQUE | ETO_CLIPPED, lprect, NULL, 0, NULL); + SetBkColor( hdc, crOld); +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/graph3d.c b/packages/services/gfx/mw/current/src/mwin/winlib/graph3d.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/graph3d.c @@ -0,0 +1,540 @@ +/* + * Copyright (c) 1999 Greg Haerr + * + * 3D Graphics Library for Micro-Windows + */ +#define MWINCLUDECOLORS +#include "windows.h" +#include "device.h" +#include "graph3d.h" +#define USEBLIT 1 /* =1 to use memDC's*/ + +static int nxpix; +static int nypix; +static vec1 xscale; +static vec1 yscale; +static vec3 eye; +static vec3 direct; +static double Q[5][5]; +static HDC hdc; +static HDC hdcMem; +static HBITMAP hbmp, hbmpOrg; + +/* setup eye, direction, calc observation matrix Q*/ +void +look3(vec1 x, vec1 y, vec1 z) +{ + eye.x = x; + eye.y = y; + eye.z = z; + direct.x = -eye.x; + direct.y = -eye.y; + direct.z = -eye.z; + findQ(); +} + +void +init3(HDC hDC, HWND memhwnd) +{ + HBRUSH hbr; + + hdc = hDC; + if(hdc) { + nxpix = hdc->hwnd->clirect.right - hdc->hwnd->clirect.left; + nypix = hdc->hwnd->clirect.bottom - hdc->hwnd->clirect.top; + xscale = (vec1)(nxpix-1) / nxpix * nxpix/2; + yscale = (vec1)(nypix-1) / nypix * nypix/2; + + if(memhwnd) { + hdcMem = CreateCompatibleDC(NULL); + if(hdcMem) { + hbmp = CreateCompatibleBitmap(hdcMem, + nxpix, nypix); + hbmpOrg = SelectObject(hdcMem, hbmp); + hdc = hdcMem; + } + hbr = (HBRUSH)GetClassLong(memhwnd, GCL_HBRBACKGROUND); + FillRect(hdc, NULL, hbr); + } + /* create pen for setcolor3() color override*/ + SelectObject(hdc, CreatePen(PS_SOLID, 1, BLACK)); + } +} + +void +paint3(HDC hDC) +{ + if(hdcMem) { + BitBlt(hDC, 0, 0, nxpix, nypix, hdcMem, 0, 0, SRCCOPY); + DeleteObject(SelectObject(hdcMem, hbmpOrg)); + DeleteDC(hdcMem); + } + hdcMem = NULL; +} + +int +fx(vec1 x) +{ + return (int)(x * xscale + nxpix*0.5 - 0.5); +} + +int +fy(vec1 y) +{ + return (int)(y * yscale + nypix*0.5 - 0.5); +} + +void +moveto3(vec2 pt) +{ + MoveToEx(hdc, fx(pt.x), fy(pt.y), NULL); +} + +void +setcolor3(MWCOLORVAL c) +{ + if(hdc) + hdc->pen->color = c; +} + +void +lineto3(vec2 pt) +{ + LineTo(hdc, fx(pt.x), fy(pt.y)); +} + +void +polyfill(int n, vec2 points[]) +{ + int i; + int xoff, yoff; + MWPOINT pv[MAXPOLY]; + + if(!hdc) + return; + + /* calc window offset*/ + xoff = hdc->hwnd->clirect.left; + yoff = hdc->hwnd->clirect.top; + + /* only plot non-trivial polygons*/ + if(n > 2) { + for(i=0; ipen->color)); + GdFillPoly(hdc->psd, n, pv); + } +} + +void +square(void) +{ + vec2 pt0, pt1, pt2, pt3; + + pt0.x = -1; pt0.y = 1; + pt1.x = -1; pt1.y = -1; + pt2.x = 1; pt2.y = -1; + pt3.x = 1; pt3.y = 1; + moveto3(pt0); + lineto3(pt1); + lineto3(pt2); + lineto3(pt3); + lineto3(pt0); +} + +void +circle3(vec1 r) +{ + vec1 theta = 0; + vec1 thinc = 2*pi/100; + int i; + vec2 pt; + + pt.x = r; + pt.y = 0.0; + moveto3(pt); + + for(i=0; i<100; ++i) { + theta = theta + thinc; + pt.x = r*cos(theta); + pt.y = r*sin(theta); + lineto3(pt); + } +} + +void +daisy(vec1 r,int points) +{ + int i, j; + vec1 theta = 0; + vec1 thinc; + vec2 pt[100]; + + /* calculate n points on a circle*/ + thinc = 2*pi/points; + for(i=0; i epsilon) { + mu = ((v2.x-v0.x)*(v3.y-v2.y) - (v2.y-v0.y)*(v3.x-v2.x))/denom; + + /* if intersection between lines v0 to v1 and v2 to v3, + * call it v4 and form triangles v0,v2,v4 and v1,v3,v4 + */ + if(mu >= 0 && mu <= 1) { + v4.x = (1-mu)*v0.x + mu*v1.x; + v4.y = (1-mu)*v0.y + mu*v1.y; + triangle(v0, v2, v4); + triangle(v1, v3, v4); + return 0; + } + } + + /* else find intersection of lines v0 to v2 and v1 to v3*/ + denom = (v2.x-v0.x)*(v3.y-v1.y) - (v2.y-v0.y)*(v3.x-v1.x); + if(fabs(denom) > epsilon) { + mu = ((v1.x-v0.x)*(v3.y-v1.y) - (v1.y-v0.y)*(v3.x-v1.x))/denom; + + /* if intersection between v0 and v1, call it v4 + * and form triangles v0,v1,v4 and v2,v3,v4 + */ + if(mu >= 0 && mu <= 1) { + v4.x = (1-mu)*v0.x + mu*v2.x; + v4.y = (1-mu)*v0.y + mu*v2.y; + triangle(v0, v1, v4); + triangle(v2, v3, v4); + return 0; + } + } + + /* there are no proper intersections so form quadrilateral v0,v1,v3,v2*/ + quadrilateral(v0, v1, v3, v2); + return 1; +} + +/* plotted function*/ +static vec1 +plotfn(vec1 x, vec1 z) +{ + vec1 t; + + /* y = 4sin(sqrt(x*x+z*z))/sqrt(x*x+z*z) */ + t = sqrt(x*x + z*z); + if(fabs(t) < epsilon) + return 4.0; + return 4.0 * sin(t) / t; +} + +/* draw mathematical function plotfn*/ +void +drawgrid(vec1 xmin, vec1 xmax, int nx, vec1 zmin, vec1 zmax, int nz) +{ + int i, j; + vec1 xi, xstep, yij; + vec1 zj, zstep; + vec2 v[2][100]; + double S[5][5]; + + /* scale it down*/ + scale3(1.0/(xmax-xmin)*2, 1.0/(xmax-xmin)*2, 1.0/(zmax-zmin), S); + mult3(Q, S, Q); + + /* grid from xmin to xmax in nx steps and zmin to xmax in nz steps*/ + xstep = (xmax-xmin)/nx; + zstep = (zmax-zmin)/nz; + xi = xmin; + zj = zmin; + + /* calc grid points on first fixed-z line, fine the y-height + * and transfrorm the points (xi,yij,zj) into observed + * position. Observed first set stored in v[0,1..nx] + */ + for(i=0; i<=nx; ++i) { + yij = plotfn(xi, zj); + v[0][i].x = Q[1][1]*xi + Q[1][2]*yij + Q[1][3]*zj; + v[0][i].y = Q[2][1]*xi + Q[2][2]*yij + Q[2][3]*zj; + xi += xstep; + } + + /* run thru consecutive fixed-z lines (the second set)*/ + for(j=0; j 0.0) + return pi*0.5; + else return pi*1.5; + else + if(x < 0.0) + return atan(y/x) + pi; + else return atan(y/x); +} + +/* calc 3d scaling matrix A giving scaling vector sx,sy,sz. + * one unit on the x axis becomes sx units, one unit on y, sy, + * and one unit on the z axis becomes sz units + */ +void +scale3(vec1 sx, vec1 sy, vec1 sz, double A[][5]) +{ + int i, j; + + for(i=1; i<5; ++i) + for(j=1; j<5; ++j) + A[i][j] = 0.0; + A[1][1] = sx; + A[2][2] = sy; + A[3][3] = sz; + A[4][4] = 1.0; +} + +/* calc 3d axes translation matrix A + * origin translated by vectdor tx,ty,tz + */ +void +tran3(vec1 tx, vec1 ty, vec1 tz, double A[][5]) +{ + int i, j; + + for(i=1; i<5; ++i) { + for(j=1; j<5; ++j) + A[i][j] = 0.0; + A[i][i] = 1.0; + } + A[1][4] = -tx; + A[2][4] = -ty; + A[3][4] = -tz; +} + +/* calc 3d axes rotation matrix A. The axes are + * rotated anti-clockwise through an angle theta radians + * about an axis specified by m: m=1 means x, m=2 y, m=3 z axis + */ +void +rot3(int m, vec1 theta, double A[][5]) +{ + int i, j, m1, m2; + vec1 c, s; + + for(i=1; i<5; ++i) + for(j=1; j<5; ++j) + A[i][j] = 0.0; + A[m][m] = 1.0; + A[4][4] = 1.0; + m1 = (m % 3) + 1; + m2 = (m1 % 3) + 1; + c = cos(theta); + s = sin(theta); + A[m1][m1] = c; + A[m2][m2] = c; + A[m1][m2] = s; + A[m2][m1] = s; +} + +/* calc the matrix product C of two matrices A and B*/ +void +mult3(double A[][5], double B[][5], double C[][5]) +{ + int i, j, k; + vec1 ab; + + for(i=1; i<5; ++i) + for(j=1; j<5; ++j) { + ab = 0; + for(k=1; k<5; ++k) + ab += A[i][k] * B[k][j]; + C[i][j] = ab; + } +} + +/* calc observation matrix Q for given observer*/ +void +findQ(void) +{ + vec1 alpha, beta, gamma, v, w; + double E[5][5]; + double F[5][5]; + double G[5][5]; + double H[5][5]; + double U[5][5]; + + /* calc translation matrix F*/ + tran3(eye.x, eye.y, eye.z, F); + + /* calc rotation matrix G*/ + alpha = angle(-direct.x, -direct.y); + rot3(3, alpha, G); + + /* calc rotation matrix H*/ + v = sqrt(direct.x*direct.x + direct.y*direct.y); + beta = angle(-direct.z, v); + rot3(2, beta, H); + + /* calc rotation matrix U*/ + w = sqrt(v*v + direct.z*direct.z); + gamma = angle(-direct.x*w, direct.y*direct.z); + rot3(3, -gamma, U); + + /* combine the transformations to find Q*/ + mult3(G, F, Q); + mult3(H, Q, E); + mult3(U, E, Q); +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/insetr.c b/packages/services/gfx/mw/current/src/mwin/winlib/insetr.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/insetr.c @@ -0,0 +1,14 @@ +#include "windows.h" +#include "wintools.h" +/* + * WIN Draw Library + */ + +void WINAPI +InsetR(LPRECT lprc,int h,int v) +{ + lprc->top += v; + lprc->left += h; + lprc->right -= 2*h-1; + lprc->bottom -= 2*v-1; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/listbox.c b/packages/services/gfx/mw/current/src/mwin/winlib/listbox.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/listbox.c @@ -0,0 +1,1688 @@ +/* + * Copyright (C) 1999, 2000, Wei Yongming. + * Portions Copyright (c) 2000 Greg Haerr + * + * Listbox for Microwindows win32 api. + */ + +/* +** This library is free software; you can redistribute it and/or +** modify it under the terms of the GNU Library General Public +** License as published by the Free Software Foundation; either +** version 2 of the License, or (at your option) any later version. +** +** This library 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 +** Library General Public License for more details. +** +** You should have received a copy of the GNU Library General Public +** License along with this library; if not, write to the Free +** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +** MA 02111-1307, USA +*/ + +/* +** Alternatively, the contents of this file may be used under the terms +** of the Mozilla Public License (the "MPL License") in which case the +** provisions of the MPL License are applicable instead of those above. +*/ + +/* Note: +** Although there was a version by Zhao Jianghua, this version of +** LISTBOX control is written by Wei Yongming from scratch. +** +** Modify records: +** +** Who When Where For What Status +**----------------------------------------------------------------------------- +** Wei Yongming 1999/10/18 Tsinghua Item Additional Data Finished +** Wei Yongming 1999/10/31 Tsinghua Space bar for checkmark Finished +** Wei Yongming 1999/10/31 Tsinghua Character match item Finished +** Wei Yongming 1999/11/07 Tsinghua Character match item Bug fixing +** WEI Yongming 2000/01/20 Tsinghua Thumb dragging Finished +** WEI Yongming 2000/02/24 Tsinghua Add MPL License Finished +** Kevin Tseng 2000/05/26 gv port to microwin ported +** Greg Haerr 2000/06/15 Utah 3d look, bug fixes Finished +** Kevin Tseng 2000/06/22 gv port to mw-nanox ported +** Kevin Tseng 2000/06/22 gv fixed bug if no item Finished +** Kevin Tseng 2000/08/08 gv enable scrollbar(V) porting +** Kevin Tseng 2000/08/10 gv enable scrollbar(V) ported +** Kevin Tseng 2000/08/10 gv WM_CHAR, WM_KEYDOWN ported +** +** TODO: +** 1. Multiple columns support. +*/ + +#include +#include +#include +#define MWINCLUDECOLORS +#include "windows.h" +#include "wintools.h" /* Draw3dBox */ +#include "device.h" /* GdGetTextSize */ + +#define FixStrAlloc(n) malloc((n)+1) +#define FreeFixStr(p) free(p) + +#define LBIF_NORMAL 0x0000L +#define LBIF_SELECTED 0x0001L +#define LBIF_CHECKED 0x0010L +#define LBIF_PARTCHECKED 0x0020L +#define LBIF_CHECKMARKMASK 0x00F0L + +#define CMFLAG_BLANK 0 +#define CMFLAG_CHECKED 1 +#define CMFLAG_PARTCHECKED 2 +typedef struct _LISTBOXITEMINFO { + int insPos; /* insert position */ + char* string; /* item string */ + int cmFlag; /* check mark flag */ + HICON hIcon; /* handle of icon */ +} LISTBOXITEMINFO, *PLISTBOXITEMINFO; + +typedef struct _LISTBOXITEM { + char* key; /* item sort key */ + DWORD dwFlags; /* item flags */ + DWORD dwData; /* item data */ + DWORD dwAddData; /* item additional data */ + struct _LISTBOXITEM* next; /* next item */ +} LISTBOXITEM, *PLISTBOXITEM; + +#define DEF_LB_BUFFER_LEN 5 + +#define LBF_FOCUS 0x0001 +#define LBF_NOTHINGSELECTED 0x0002 + +typedef struct _LISTBOXDATA { + DWORD dwFlags; /* listbox flags */ + + int itemCount; /* items count */ + int itemTop; /* start display item */ + int itemVisibles; /* number of visible items */ + + int itemHilighted; /* current hilighted item */ + int itemHeight; /* item height */ + + LISTBOXITEM* head; /* items linked list head */ + + int buffLen; /* buffer length */ + LISTBOXITEM* buffStart; /* buffer start */ + LISTBOXITEM* buffEnd; /* buffer end */ + LISTBOXITEM* freeList; /* free list in buffer */ +} LISTBOXDATA, *PLISTBOXDATA; + +void ListboxControlCleanup (); +static LRESULT CALLBACK +ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + +#define ITEM_BOTTOM(x) (x->itemTop + x->itemVisibles - 1) + +#define LST_WIDTH_CHECKMARK 11 +#define LST_HEIGHT_CHECKMARK 11 +#define LST_INTER_BMPTEXT 2 + +int WINAPI MwRegisterListboxControl(HINSTANCE hInstance) +{ + WNDCLASS wc; +#if 0 + static BITMAP sg_bmpCheckMark; + if (!LoadSystemBitmap (&sg_bmpCheckMark, "checkmark")) { + fprintf (stderr, "Load ListBox Check Mark Bitmap failure!\n"); + return FALSE; + } +#endif + wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)ListboxCtrlProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = NULL; + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground= GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName= "LISTBOX"; + + return RegisterClass(&wc); +} + +void ListboxControlCleanup () +{ +#if 0 + UnloadBitmap (&sg_bmpCheckMark); +#endif +} + +static LRESULT NotifyParent (HWND hwnd, int id, int code) +{ + return SendMessage (GetParent (hwnd), WM_COMMAND, + (WPARAM) MAKELONG (id, code), (LPARAM)hwnd); +} + +static BOOL lstInitListBoxData (HWND hwnd,LISTBOXDATA* pData, int len) +{ + int i, xw, xh, xb; + PLISTBOXITEM plbi; + HDC hdc; + + memset (pData, 0, sizeof (LISTBOXDATA)); +#if 0 + pData->itemHeight = GetSysCharHeight (); +#else + hdc=GetDC(hwnd); +#if MWCLIENT /* nanox client */ + GrSetGCFont(hdc->gc,hdc->font->fontid); + GrGetGCTextSize(hdc->gc,"X",1, + MWTF_ASCII,&xw,&xh,&xb); +#else + GdSetFont(hdc->font->pfont); + GdGetTextSize(hdc->font->pfont,"X",1, + &xw,&xh,&xb,MWTF_ASCII); +#endif + ReleaseDC(hwnd,hdc); + pData->itemHeight=xh + 1; +#endif + pData->itemHilighted = 0; + pData->dwFlags = LBF_NOTHINGSELECTED; + + /* init item buffer. */ + if (!(pData->buffStart = malloc (len * sizeof (LISTBOXITEM)))) + return FALSE; + + pData->buffLen = len; + pData->buffEnd = pData->buffStart + len; + pData->freeList = pData->buffStart; + + plbi = pData->freeList; + for (i = 0; i < len - 1; i++) { + plbi->next = plbi + 1; + plbi ++; + } + plbi->next = NULL; + + return TRUE; +} + +static void lstListBoxCleanUp (LISTBOXDATA* pData) +{ + PLISTBOXITEM plbi; + PLISTBOXITEM next; + + plbi = pData->head; + while (plbi) { + FreeFixStr (plbi->key); + next = plbi->next; + if (plbi < pData->buffStart || plbi > pData->buffEnd) + free (plbi); + + plbi = next; + } + + free (pData->buffStart); +} + +static void lstResetListBoxContent (PLISTBOXDATA pData) +{ + int i; + PLISTBOXITEM plbi, next; + + pData->itemCount = 0; + pData->itemTop = 0; + pData->itemHilighted = 0; +#if 0 + pData->itemVisibles = 0; +#endif + + plbi = pData->head; + while (plbi) { + FreeFixStr (plbi->key); + next = plbi->next; + if (plbi < pData->buffStart || plbi > pData->buffEnd) + free (plbi); + + plbi = next; + } + + pData->head = NULL; + pData->freeList = pData->buffStart; + + plbi = pData->freeList; + for (i = 0; i < pData->buffLen - 1; i++) { + plbi->next = plbi + 1; + plbi ++; + } + plbi->next = NULL; +} + +static PLISTBOXITEM lstAllocItem (PLISTBOXDATA pData) +{ + PLISTBOXITEM plbi; + + if (pData->freeList) { + plbi = pData->freeList; + pData->freeList = plbi->next; + } + else + plbi = (PLISTBOXITEM) malloc (sizeof (LISTBOXITEM)); + + return plbi; +} + +static void lstFreeItem (PLISTBOXDATA pData, PLISTBOXITEM plbi) +{ + if (plbi < pData->buffStart || plbi > pData->buffEnd) + free (plbi); + else { + plbi->next = pData->freeList; + pData->freeList = plbi; + } +} + +static int lstAddNewItem (DWORD dwStyle, + PLISTBOXDATA pData, PLISTBOXITEM newItem, int pos) +{ + PLISTBOXITEM plbi; + PLISTBOXITEM insPosItem = NULL; + int insPos = 0; + + newItem->next = NULL; + if (!pData->head) + insPosItem = NULL; + else if (dwStyle & LBS_SORT) { + plbi = pData->head; + + if (strcmp (newItem->key, plbi->key) < 0) { + insPosItem = NULL; + insPos = 0; + } + else { + while (plbi->next) { + if (strcmp (newItem->key, plbi->next->key) <= 0) + break; + + plbi = plbi->next; + insPos ++; + } + insPosItem = plbi; + } + } + else { + plbi = pData->head; + + if (pos < 0) { + while (plbi->next) { + plbi = plbi->next; + insPos ++; + } + insPosItem = plbi; + } + else if (pos > 0) { + int index = 0; + + while (plbi->next) { + if (pos == index) + break; + plbi = plbi->next; + index ++; + insPos ++; + } + insPosItem = plbi; + } + } + + if (insPosItem) { + plbi = insPosItem->next; + insPosItem->next = newItem; + newItem->next = plbi; + + insPos ++; + } + else { + plbi = pData->head; + pData->head = newItem; + newItem->next = plbi; + } + + pData->itemCount ++; + return insPos; +} + +static PLISTBOXITEM lstRemoveItem (PLISTBOXDATA pData, int* pos) +{ + int index = 0; + PLISTBOXITEM plbi, prev; + + if (!pData->head) + return NULL; + + if (*pos < 0) { + prev = pData->head; + plbi = pData->head; + while (plbi->next) { + prev = plbi; + plbi = plbi->next; + index ++; + } + + if (plbi == pData->head) { + pData->head = pData->head->next; + *pos = 0; + return plbi; + } + else { + prev->next = plbi->next; + *pos = index; + return plbi; + } + } + else if (*pos == 0) { + plbi = pData->head; + pData->head = plbi->next; + return plbi; + } + else { + index = 0; + prev = pData->head; + plbi = pData->head; + while (plbi->next) { + if (*pos == index) + break; + + prev = plbi; + plbi = plbi->next; + index ++; + } + + if (plbi == pData->head) { + pData->head = pData->head->next; + *pos = 0; + return plbi; + } + else { + prev->next = plbi->next; + *pos = index; + return plbi; + } + } + + return NULL; +} + +static void lstGetItemsRect (PLISTBOXDATA pData, int start, int end, RECT* prc) +{ + if (start < 0) + start = 0; + + prc->top = (start - pData->itemTop)*pData->itemHeight; + + if (end >= 0) + prc->bottom = (end - pData->itemTop + 1)*pData->itemHeight; + +} + +static void lstInvalidateItem (HWND hwnd, PLISTBOXDATA pData, int pos,BOOL fEBk) +{ + RECT rcInv; + + if (pos < pData->itemTop || pos > (pData->itemTop + pData->itemVisibles)) + return; + + GetClientRect (hwnd, &rcInv); + rcInv.top = (pos - pData->itemTop)*pData->itemHeight; + rcInv.bottom = rcInv.top + pData->itemHeight; + + InvalidateRect (hwnd, &rcInv, fEBk); +} + +static BOOL lstInvalidateUnderItem (HWND hwnd, PLISTBOXDATA pData, int pos) +{ + RECT rcInv; + + if (pos > (pData->itemTop + pData->itemVisibles)) + return FALSE; + + if (pos <= pData->itemTop) { + InvalidateRect (hwnd, NULL, TRUE); + return TRUE; + } + + GetClientRect (hwnd, &rcInv); + + lstGetItemsRect (pData, pos, -1, &rcInv); + + if (rcInv.top < rcInv.bottom) + InvalidateRect (hwnd, &rcInv, TRUE); + + return TRUE; +} + +static PLISTBOXITEM lstGetItem (PLISTBOXDATA pData, int pos) +{ + int i; + PLISTBOXITEM plbi; + + plbi = pData->head; + for (i=0; i < pos && plbi; i++) + plbi = plbi->next; + + return plbi; +} + +static int lstFindItem (PLISTBOXDATA pData, int start, char* key, BOOL bExact) +{ + PLISTBOXITEM plbi; + int keylen = strlen (key); + + if (start >= (pData->itemCount - 1)) + start = 0; + + plbi = lstGetItem (pData, start); + + while (plbi) + { + if (bExact && (keylen != strlen (plbi->key))) { + plbi = plbi->next; + start ++; + continue; + } + + if (strncasecmp (key, plbi->key, keylen) == 0) + return start; + + plbi = plbi->next; + start ++; + } + + return LB_ERR; +} + +static void lstOnDrawSListBoxItems (HDC hdc, DWORD dwStyle, + PLISTBOXDATA pData, int width) +{ + PLISTBOXITEM plbi; + int i; + int x = 0, y = 0; + int offset; + RECT rc; + COLORREF bk; + + plbi = lstGetItem (pData, pData->itemTop); + + for (i = 0; plbi && i < (pData->itemVisibles + 1); i++) { + + if (plbi->dwFlags & LBIF_SELECTED) { + SetBkColor (hdc, bk = BLUE); + SetTextColor (hdc, WHITE); + } + else { + SetBkColor (hdc, bk = WHITE); + SetTextColor (hdc, BLACK); + } + rc.left = 0; + rc.top = y; + rc.right = width; + rc.bottom = y + pData->itemHeight; + FastFillRect(hdc, &rc, bk); + + if (dwStyle & LBS_CHECKBOX) { + x = LST_INTER_BMPTEXT; + if (plbi->dwFlags & LBIF_CHECKED) + offset = 0; + else if (plbi->dwFlags & LBIF_PARTCHECKED) + offset = LST_WIDTH_CHECKMARK << 1; + else + offset = LST_WIDTH_CHECKMARK; +#if 0 /* fix: no bitmap */ + FillBoxWithBitmapPart (hdc, + x, y + ((pData->itemHeight - LST_HEIGHT_CHECKMARK)>>1), + LST_WIDTH_CHECKMARK, LST_HEIGHT_CHECKMARK, + 0, 0, + &sg_bmpCheckMark, + offset, 0); +#endif + x += LST_WIDTH_CHECKMARK + LST_INTER_BMPTEXT; + } +#if 0 /* fix: no icon */ + if (dwStyle & LBS_USEICON && plbi->dwData) { + DrawIcon (hdc, + x, y, pData->itemHeight, pData->itemHeight, + (HICON) plbi->dwData); + x += pData->itemHeight + LST_INTER_BMPTEXT; + } +#endif + +/* jmt: should be SYSTEM_FIXED_FONT because of minigui's GetSysCharXXX() */ +#if 0 + SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); +#endif + SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT)); + TextOut (hdc, x+2, y, plbi->key,-1); + + y += pData->itemHeight; + plbi = plbi->next; + } +} + +static int lstSelectItem (DWORD dwStyle, PLISTBOXDATA pData, int newSel) +{ + PLISTBOXITEM plbi, newItem; + int index; + + newItem = lstGetItem (pData, newSel); +#if 1 /* jmt: fixed if no item added */ + if (!newItem) return -1; +#endif +#ifdef _DEBUG + if (!newItem) + fprintf (stderr, "ASSERT failed: return value of lstGetItem" + " in lstSelectItem.\n"); +#endif + + if (dwStyle & LBS_MULTIPLESEL) { + newItem->dwFlags ^= LBIF_SELECTED; + return newSel; + } + + index = 0; + plbi = pData->head; + while (plbi) { + if (plbi->dwFlags & LBIF_SELECTED) { + if (index != newSel) { + plbi->dwFlags &= ~LBIF_SELECTED; + newItem->dwFlags |= LBIF_SELECTED; + return index; + } + break; + } + + plbi = plbi->next; + index ++; + } + + newItem->dwFlags |= LBIF_SELECTED; + return -1; +} + +static void lstDrawFocusRect (HDC hdc, PLISTBOXDATA pData, RECT* rc) +{ + HGDIOBJ oldbrush,oldpen; + + if (pData->itemHilighted < pData->itemTop + || pData->itemHilighted > (pData->itemTop + pData->itemVisibles)) + return; + + if (pData->dwFlags & LBF_FOCUS) { + lstGetItemsRect (pData, pData->itemHilighted, pData->itemHilighted, rc); +#if 0 + InflateRect (rc, -1, -1); + + FocusRect (hdc, rc->left - 1, rc->top, rc->right, rc->bottom); +#else + oldbrush=SelectObject(hdc, GetStockObject(NULL_BRUSH)); + oldpen=SelectObject(hdc, CreatePen(PS_SOLID, 1, + GetSysColor(COLOR_BTNHIGHLIGHT))); +#if 0 + GdSetMode(MWMODE_XOR); +#endif + Rectangle (hdc, rc->left, rc->top, rc->right, rc->bottom); +#if 0 + GdSetMode(MWMODE_SET); +#endif + SelectObject(hdc,oldbrush); + DeleteObject(SelectObject(hdc,oldpen)); +#endif + } +} + +static void lstCalcParams (const RECT* rcClient, PLISTBOXDATA pData) +{ +#define RECTHP(prc) (prc->bottom - prc->top) + pData->itemVisibles = (RECTHP (rcClient)) / pData->itemHeight; + +#if 1 /* test calculation of itemVisibles */ + if( ((RECTHP (rcClient)) % pData->itemHeight) ) + pData->itemVisibles++; +#endif +} + +extern BOOL SetScrollPos (HWND hWnd, int iSBar, int iNewPos); +extern BOOL EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable); + +static void lstSetVScrollInfo (HWND hwnd, PLISTBOXDATA pData, BOOL fRedraw) +{ + SCROLLINFO si; + + if (pData->itemVisibles >= pData->itemCount) + { + SetScrollPos (hwnd, SB_VERT, 0); + EnableScrollBar (hwnd, SB_VERT, FALSE); + return; + } + + si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; + si.nMax = pData->itemCount - 1; + si.nMin = 0; + si.nPage = min (pData->itemVisibles, (pData->itemCount - pData->itemTop)); + si.nPos = pData->itemTop; + + SetScrollInfo (hwnd, SB_VERT, &si, fRedraw); + EnableScrollBar (hwnd, SB_VERT, TRUE); +} + +LRESULT CALLBACK +ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + HDC hdc; + HWND pCtrl; + PLISTBOXDATA pData; + DWORD dwStyle; + + pCtrl = hwnd; + dwStyle = pCtrl->style; + + switch (message) + { + case WM_CREATE: + pData = (LISTBOXDATA*) malloc (sizeof(LISTBOXDATA)); + if (pData == NULL) + return -1; + + pCtrl->userdata = (DWORD)pData; + if (!lstInitListBoxData (hwnd, pData, DEF_LB_BUFFER_LEN)) { + free (pData); + return -1; + } + break; + + case WM_SIZE: + { + RECT rc; + + pData = (PLISTBOXDATA)pCtrl->userdata; + GetClientRect(hwnd, &rc); + lstCalcParams (&rc, pData); + } + break; + + case WM_DESTROY: + pData = (PLISTBOXDATA)pCtrl->userdata; + lstListBoxCleanUp (pData); + free (pData); + break; + + case LB_RESETCONTENT: + pData = (PLISTBOXDATA)pCtrl->userdata; + lstResetListBoxContent (pData); + InvalidateRect (hwnd, NULL, TRUE); + break; + + case LB_ADDSTRING: + case LB_INSERTSTRING: + { + char* string = NULL; + PLISTBOXITEMINFO plbii = NULL; + PLISTBOXITEM newItem; + int pos; + + if (dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON) { + plbii = (PLISTBOXITEMINFO)lParam; + if (!plbii) + return LB_ERR; + + string = plbii->string; + } + else { + string = (char*)lParam; + if (string == NULL || string [0] == '\0') + return LB_ERR; + } + + pData = (PLISTBOXDATA)pCtrl->userdata; + newItem = lstAllocItem (pData); + if (!newItem) { + NotifyParent (hwnd, pCtrl->id, LBN_ERRSPACE); + return LB_ERRSPACE; + } + + newItem->key = FixStrAlloc (strlen (string)); + strcpy (newItem->key, string); + newItem->dwFlags = LBIF_NORMAL; + if (plbii) { + switch (plbii->cmFlag) { + case CMFLAG_CHECKED: + newItem->dwFlags |= LBIF_CHECKED; + break; + case CMFLAG_PARTCHECKED: + newItem->dwFlags |= LBIF_PARTCHECKED; + break; + } + + if (dwStyle & LBS_USEICON) + newItem->dwData = (DWORD)plbii->hIcon; + else + newItem->dwData = 0L; + } + newItem->dwAddData = 0L; + + if (message == LB_ADDSTRING) + pos = lstAddNewItem (dwStyle, pData, newItem, -1); + else + pos = lstAddNewItem (dwStyle, pData, newItem, (int)wParam); + + lstInvalidateUnderItem (hwnd, pData, pos); + + lstSetVScrollInfo (hwnd, pData, TRUE); + + return pos; + } + break; + + case LB_DELETESTRING: + { + PLISTBOXITEM removed; + int delete; + + delete = (int)wParam; + + pData = (PLISTBOXDATA)pCtrl->userdata; + removed = lstRemoveItem (pData, &delete); + if (removed) { + FreeFixStr (removed->key); + lstFreeItem (pData, removed); + + pData->itemCount --; + + if (pData->itemTop != 0 + && pData->itemCount <= pData->itemVisibles) { + pData->itemTop = 0; + InvalidateRect (hwnd, NULL, TRUE); + } + else { + lstInvalidateUnderItem (hwnd, pData, delete); + if (delete <= pData->itemTop) { + pData->itemTop --; + if (pData->itemTop < 0) + pData->itemTop = 0; + } + } + + if (pData->itemHilighted >= pData->itemCount) { + pData->itemHilighted = pData->itemCount - 1; + if (pData->itemHilighted < 0) + pData->itemHilighted = 0; + } + + if (pData->itemHilighted < pData->itemTop) + pData->itemHilighted = pData->itemTop; + if (pData->itemHilighted > ITEM_BOTTOM (pData)) + pData->itemHilighted = ITEM_BOTTOM (pData); + + lstSetVScrollInfo (hwnd, pData, TRUE); + } + } + break; + + case LB_FINDSTRING: + if( *(char*)lParam == '\0' ) + return LB_ERR; + + pData = (PLISTBOXDATA)pCtrl->userdata; + return lstFindItem(pData, (int)wParam, (char*)lParam, FALSE); + + case LB_FINDSTRINGEXACT: + if( *(char*)lParam == '\0' ) + return LB_ERR; + + pData = (PLISTBOXDATA)pCtrl->userdata; + return lstFindItem(pData, (int)wParam, (char*)lParam, TRUE); + + case LB_SETTOPINDEX: + { + int newTop = (int) wParam; + + pData = (PLISTBOXDATA)pCtrl->userdata; + + if (newTop <0) + newTop = 0; + else if (newTop > pData->itemCount - pData->itemVisibles) + newTop = pData->itemCount - pData->itemVisibles; + + if (pData->itemTop != newTop) { + pData->itemTop = newTop; + + if (pData->itemHilighted < pData->itemTop) + pData->itemHilighted = pData->itemTop; + if (pData->itemHilighted > ITEM_BOTTOM (pData)) + pData->itemHilighted = ITEM_BOTTOM (pData); + + lstSetVScrollInfo (hwnd, pData, TRUE); + + InvalidateRect (hwnd, NULL, TRUE); + } + } + break; + + case LB_SETCURSEL: + case LB_SETCARETINDEX: + { + int new = (int)wParam; + int old, newTop; + + pData = (PLISTBOXDATA)pCtrl->userdata; + if (new < 0 || new > pData->itemCount - 1) + return LB_ERR; + + old = pData->itemHilighted; + if (new >= 0 && new != old) { + if (pData->itemCount - new >= pData->itemVisibles) + newTop = new; + else + newTop = max (pData->itemCount - pData->itemVisibles, 0); + + pData->itemTop = newTop; + pData->itemHilighted = new; + lstSetVScrollInfo (hwnd, pData, TRUE); + } + + if (!(dwStyle & LBS_MULTIPLESEL)) + lstSelectItem (dwStyle, pData, new); + InvalidateRect (hwnd, NULL, TRUE); + + return old; + } + break; + + case LB_GETCOUNT: + pData = (PLISTBOXDATA)pCtrl->userdata; + return pData->itemCount; + break; + + case LB_GETCURSEL: + { + PLISTBOXITEM plbi; + int index = 0; + + pData = (PLISTBOXDATA)pCtrl->userdata; + if (dwStyle & LBS_MULTIPLESEL) + return pData->itemHilighted; + + plbi = pData->head; + while (plbi) { + if (plbi->dwFlags & LBIF_SELECTED) + return index; + + index ++; + plbi = plbi->next; + } + + return LB_ERR; + } + break; + + case LB_GETSELCOUNT: + { + int nSel; + PLISTBOXITEM plbi; + + pData = (PLISTBOXDATA)pCtrl->userdata; + + nSel = 0; + plbi = pData->head; + while (plbi) { + if (plbi->dwFlags & LBIF_SELECTED) + nSel ++; + plbi = plbi->next; + } + + return nSel; + } + break; + + case LB_GETTOPINDEX: + pData = (PLISTBOXDATA)pCtrl->userdata; + return pData->itemTop; + break; + + case LB_GETCARETINDEX: + pData = (PLISTBOXDATA)pCtrl->userdata; + return pData->itemHilighted; + break; + + case LB_GETTEXTLEN: + { + PLISTBOXITEM plbi; + + pData = (PLISTBOXDATA)pCtrl->userdata; + plbi = lstGetItem (pData, (int)wParam); + if (plbi) + return strlen (plbi->key); + else + return LB_ERR; + } + break; + + case LB_GETTEXT: + { + PLISTBOXITEM plbi; + + pData = (PLISTBOXDATA)pCtrl->userdata; + plbi = lstGetItem (pData, (int)wParam); + if (plbi) + strcpy ((char*)lParam, plbi->key); + else + return LB_ERR; + } + break; + + case LB_SETTEXT: + { + PLISTBOXITEM plbi; + char* newStr; + + pData = (PLISTBOXDATA)pCtrl->userdata; + plbi = lstGetItem (pData, (int)wParam); + if (plbi) { + newStr = FixStrAlloc (strlen ((char*)lParam)); + if (newStr) { + FreeFixStr (plbi->key); + plbi->key = newStr; + strcpy (plbi->key, (char*)lParam); + lstInvalidateItem (hwnd, pData, (int)wParam, TRUE); + } + else + return LB_ERR; + } + else + return LB_ERR; + } + break; + + case LB_GETITEMDATA: + { + PLISTBOXITEM plbi; + PLISTBOXITEMINFO plbii; + + pData = (PLISTBOXDATA)pCtrl->userdata; + if (!(plbi = lstGetItem (pData, (int)wParam))) + return LB_ERR; + + if (!(dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON)) { + return plbi->dwData; + } + + plbii = (PLISTBOXITEMINFO)lParam; + if (!plbii) + return LB_ERR; + + if (plbi->dwFlags & LBIF_CHECKED) + plbii->cmFlag = CMFLAG_CHECKED; + else if (plbi->dwFlags & LBIF_PARTCHECKED) + plbii->cmFlag = CMFLAG_PARTCHECKED; + else + plbii->cmFlag = CMFLAG_BLANK; + plbii->hIcon = (HICON)plbi->dwData; + + return LB_OKAY; + } + break; + + case LB_SETITEMDATA: + { + PLISTBOXITEM plbi; + PLISTBOXITEMINFO plbii; + + pData = (PLISTBOXDATA)pCtrl->userdata; + if (!(plbi = lstGetItem (pData, (int)wParam))) + return LB_ERR; + + if (!(dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON)) { + plbi->dwData = (DWORD)lParam; + return LB_OKAY; + } + + plbii = (PLISTBOXITEMINFO)lParam; + if (!plbii) + return LB_ERR; + + plbi->dwFlags &= ~LBIF_CHECKMARKMASK; + switch (plbii->cmFlag) { + case CMFLAG_CHECKED: + plbi->dwFlags |= LBIF_CHECKED; + break; + case CMFLAG_PARTCHECKED: + plbi->dwFlags |= LBIF_PARTCHECKED; + break; + } + + if (dwStyle & LBS_USEICON) + plbi->dwData = (DWORD)plbii->hIcon; + else + plbi->dwData = 0; + + lstInvalidateItem (hwnd, pData, (int)wParam, TRUE); + + return LB_OKAY; + } + break; + + case LB_GETITEMADDDATA: + { + PLISTBOXITEM plbi; + + pData = (PLISTBOXDATA)pCtrl->userdata; + if (!(plbi = lstGetItem (pData, (int)wParam))) + return LB_ERR; + + return plbi->dwAddData; + } + break; + + case LB_SETITEMADDDATA: + { + PLISTBOXITEM plbi; + + pData = (PLISTBOXDATA)pCtrl->userdata; + if (!(plbi = lstGetItem (pData, (int)wParam))) + return LB_ERR; + + plbi->dwAddData = (DWORD)lParam; + + return LB_OKAY; + } + break; + + case LB_GETCHECKMARK: + { + PLISTBOXITEM plbi; + + if (!(dwStyle & LBS_CHECKBOX)) + return LB_ERR; + + pData = (PLISTBOXDATA)pCtrl->userdata; + if (!(plbi = lstGetItem (pData, (int)wParam))) + return LB_ERR; + + if (plbi->dwFlags & LBIF_CHECKED) + return CMFLAG_CHECKED; + + if (plbi->dwFlags & LBIF_PARTCHECKED) + return CMFLAG_PARTCHECKED; + + return CMFLAG_BLANK; + } + break; + + case LB_SETCHECKMARK: + { + PLISTBOXITEM plbi; + + if (!(dwStyle & LBS_CHECKBOX)) + return LB_ERR; + + pData = (PLISTBOXDATA)pCtrl->userdata; + if (!(plbi = lstGetItem (pData, (int)wParam))) + return LB_ERR; + + plbi->dwFlags &= ~LBIF_CHECKMARKMASK; + switch (lParam) { + case CMFLAG_CHECKED: + plbi->dwFlags |= LBIF_CHECKED; + break; + case CMFLAG_PARTCHECKED: + plbi->dwFlags |= LBIF_PARTCHECKED; + break; + } + + lstInvalidateItem (hwnd, pData, (int)wParam, TRUE); + + return LB_OKAY; + } + break; + + case LB_GETSELITEMS: + { + int nItem; + int nSel = 0; + int index = 0; + int* pInt; + PLISTBOXITEM plbi; + + nItem = (int)wParam; + pInt = (int*)lParam; + + pData = (PLISTBOXDATA)pCtrl->userdata; + plbi = pData->head; + while (plbi) { + + if (plbi->dwFlags & LBIF_SELECTED) { + if (pInt) { + if (nSel < nItem) + *(pInt + nSel) = index; + else + return nItem; + } + nSel ++; + } + + plbi = plbi->next; + index ++; + } + + return nSel; + } + break; + + case LB_GETSEL: + { + PLISTBOXITEM plbi; + + pData = (PLISTBOXDATA)pCtrl->userdata; + plbi = lstGetItem (pData, (int)wParam); + if (plbi) + return plbi->dwFlags & LBIF_SELECTED; + else + return LB_ERR; + } + break; + + case LB_SETSEL: + { + PLISTBOXITEM plbi; + + pData = (PLISTBOXDATA)pCtrl->userdata; + plbi = lstGetItem (pData, (int)lParam); + if (plbi) { + pData->dwFlags &= ~LBF_NOTHINGSELECTED; + if (wParam == -1) + plbi->dwFlags ^= LBIF_SELECTED; + else if (wParam == 0) + plbi->dwFlags &= ~LBIF_SELECTED; + else + plbi->dwFlags |= LBIF_SELECTED; + + lstInvalidateItem (hwnd, pData, (int)lParam, FALSE); + } + else + return LB_ERR; + } + break; + + case LB_GETITEMHEIGHT: + pData = (PLISTBOXDATA)pCtrl->userdata; + return pData->itemHeight; + break; + + case LB_SETITEMHEIGHT: + pData = (PLISTBOXDATA)pCtrl->userdata; + if (pData->itemHeight != LOWORD (lParam)) { + RECT rcClient; + + pData->itemHeight = LOWORD (lParam); + GetClientRect (hwnd, &rcClient); + lstCalcParams (&rcClient, pData); + + lstSetVScrollInfo (hwnd, pData, TRUE); + InvalidateRect (hwnd, NULL, TRUE); + } + break; + + case WM_SETFOCUS: + { + pData = (PLISTBOXDATA)pCtrl->userdata; + + if (pData->dwFlags & LBF_FOCUS) + break; + + pData->dwFlags |= LBF_FOCUS; + InvalidateRect(hwnd, NULL, TRUE); + + NotifyParent (hwnd, pCtrl->id, LBN_SETFOCUS); + } + break; + + case WM_KILLFOCUS: + { + pData = (PLISTBOXDATA)pCtrl->userdata; + + pData->dwFlags &= ~LBF_FOCUS; + InvalidateRect(hwnd, NULL, TRUE); + + NotifyParent (hwnd, pCtrl->id, LBN_KILLFOCUS); + } + break; + + case WM_GETDLGCODE: + return DLGC_WANTARROWS | DLGC_WANTCHARS; + + case WM_GETTEXTLENGTH: + case WM_GETTEXT: + case WM_SETTEXT: + return -1; +#if 0 + case WM_SETFONT: + break; + + case WM_GETFONT: + break; +#endif + case WM_NCCALCSIZE: + { + LPNCCALCSIZE_PARAMS lpnc; + + /* calculate client rect from passed window rect in rgrc[0]*/ + lpnc = (LPNCCALCSIZE_PARAMS)lParam; + if(GetWindowLong(hwnd, GWL_STYLE) & WS_BORDER) + InflateRect(&lpnc->rgrc[0], -2, -2); + } + break; + + case WM_NCPAINT: + { + RECT rc; + + hdc = wParam? (HDC)wParam: GetWindowDC (hwnd); + GetWindowRect(hwnd, &rc); + + if (dwStyle & WS_BORDER) + Draw3dInset(hdc, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top); + + if (!wParam) + ReleaseDC (hwnd, hdc); + } + break; + + case WM_PAINT: + { + RECT rc; + PAINTSTRUCT ps; + + hdc = BeginPaint (hwnd,&ps); + pData = (PLISTBOXDATA)pCtrl->userdata; + + /* + * If this is the first paint and there's nothing + * selected, then auto select the topmost displayed item. + */ + if (pData->dwFlags & LBF_NOTHINGSELECTED) { + lstSelectItem (hwnd->style, pData, pData->itemTop); + pData->dwFlags &= ~LBF_NOTHINGSELECTED; + } + GetClientRect (hwnd, &rc); + lstOnDrawSListBoxItems (hdc, dwStyle, pData, rc.right-rc.left); + lstDrawFocusRect (hdc, pData, &rc); + + EndPaint (hwnd, &ps); + } + break; + + case WM_LBUTTONDBLCLK: + if (dwStyle & LBS_NOTIFY) + NotifyParent (hwnd, pCtrl->id, LBN_DBLCLK); + break; + + case WM_LBUTTONDOWN: + { + int oldSel, mouseX, mouseY, hit; + RECT rcInv; + + pData = (PLISTBOXDATA)pCtrl->userdata; + if (pData->itemCount == 0) + break; + + mouseX = LOWORD (lParam); + mouseY = HIWORD (lParam); + hit = mouseY / pData->itemHeight; + hit += pData->itemTop; + + if (hit >= pData->itemCount) + break; + + GetClientRect (hwnd, &rcInv); + oldSel = lstSelectItem (dwStyle, pData, hit); + if ((dwStyle & LBS_NOTIFY) && (oldSel != hit)) + NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE); + if (oldSel >= 0) { + if (oldSel >= pData->itemTop + && (oldSel <= pData->itemTop + pData->itemVisibles)) { + lstGetItemsRect (pData, oldSel, oldSel, &rcInv); + InvalidateRect (hwnd, &rcInv, TRUE); + } + } + + lstGetItemsRect (pData, hit, hit, &rcInv); + InvalidateRect (hwnd, &rcInv, TRUE); + + if (pData->itemHilighted != hit) + { + hdc = GetDC(hwnd); /* hdc = GetClientDC (hwnd); */ + + lstDrawFocusRect (hdc, pData, &rcInv); + ReleaseDC (hwnd,hdc); + } + pData->itemHilighted = hit; + + if (dwStyle & LBS_CHECKBOX) { + if (mouseX > 0 && mouseX < LST_WIDTH_CHECKMARK) { + NotifyParent (hwnd, pCtrl->id, LBN_CLICKCHECKMARK); + + if (dwStyle & LBS_AUTOCHECK) { + PLISTBOXITEM plbi; + + plbi = lstGetItem (pData, hit); + + switch (plbi->dwFlags & LBIF_CHECKMARKMASK) { + case LBIF_CHECKED: + plbi->dwFlags &= ~LBIF_CHECKMARKMASK; + break; + default: + plbi->dwFlags &= ~LBIF_CHECKMARKMASK; + plbi->dwFlags |= LBIF_CHECKED; + break; + } + + lstInvalidateItem (hwnd, pData, hit, TRUE); + } + } + } + + lstSetVScrollInfo (hwnd, pData, TRUE); + } + break; + + case WM_LBUTTONUP: + break; + + case WM_MOUSEMOVE: + break; + + case WM_KEYDOWN: + { + int oldSel, newSel, newTop; + RECT rcInv; + + pData = (PLISTBOXDATA)pCtrl->userdata; + newTop = pData->itemTop; + newSel = pData->itemHilighted; + switch (LOWORD (wParam)) + { + case VK_HOME: /* SCANCODE_HOME: */ + newSel = 0; + newTop = 0; + break; + + case VK_END: /* SCANCODE_END: */ + newSel = pData->itemCount - 1; + if (pData->itemCount > pData->itemVisibles) + newTop = pData->itemCount - pData->itemVisibles; + else + newTop = 0; + break; + + case VK_DOWN: /* SCANCODE_CURSORBLOCKDOWN: */ + newSel ++; + if (newSel >= pData->itemCount) + return 0; + if (newSel > ITEM_BOTTOM (pData)) + newTop ++; + break; + + case VK_UP: /* SCANCODE_CURSORBLOCKUP: */ + newSel --; + if (newSel < 0) + return 0; + if (newSel < pData->itemTop) + newTop --; + break; + + case VK_NEXT: /* SCANCODE_PAGEDOWN: */ + newSel += pData->itemVisibles; + if (newSel >= pData->itemCount) + newSel = pData->itemCount - 1; + + if (pData->itemCount - newSel >= pData->itemVisibles) + newTop = newSel; + else + newTop = max (pData->itemCount-pData->itemVisibles, 0); + break; + + case VK_PRIOR: /* SCANCODE_PAGEUP: */ + newSel -= pData->itemVisibles; + if (newSel < 0) + newSel = 0; + + newTop -= pData->itemVisibles; + if (newTop < 0) + newTop = 0; + break; + + default: + return 0; + } + + GetClientRect (hwnd, &rcInv); + if (pData->itemHilighted != newSel) { + if (pData->itemTop != newTop) { + pData->itemTop = newTop; + pData->itemHilighted = newSel; + if (!(dwStyle & LBS_MULTIPLESEL)) { + oldSel = lstSelectItem (dwStyle, pData, newSel); + if ((dwStyle & LBS_NOTIFY) && (oldSel != newSel)) + NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE); + } + InvalidateRect (hwnd, NULL, TRUE); + } + else { + if (!(dwStyle & LBS_MULTIPLESEL)) { + oldSel = lstSelectItem (dwStyle, pData, newSel); + if ((dwStyle & LBS_NOTIFY) && (oldSel != newSel)) + NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE); + if (oldSel >= 0) { + if (oldSel >= pData->itemTop + && oldSel <= (ITEM_BOTTOM (pData) + 1)) { + lstGetItemsRect (pData, oldSel, oldSel, &rcInv); + InvalidateRect (hwnd, &rcInv, TRUE); + } + } + + if (newSel < newTop) { + pData->itemHilighted = newSel; + break; + } + + lstGetItemsRect (pData, pData->itemHilighted, + pData->itemHilighted, &rcInv); + + hdc = GetDC(hwnd); /* hdc = GetClientDC (hwnd); */ + + lstDrawFocusRect (hdc, pData, &rcInv); + ReleaseDC (hwnd,hdc); + + pData->itemHilighted = newSel; + lstGetItemsRect (pData, newSel, newSel, &rcInv); + InvalidateRect (hwnd, &rcInv, TRUE); + } + else + { + hdc = GetDC(hwnd); /* hdc = GetClientDC (hwnd); */ + + lstDrawFocusRect (hdc, pData, &rcInv); + pData->itemHilighted = newSel; + GetClientRect (hwnd, &rcInv); + lstDrawFocusRect (hdc, pData, &rcInv); + ReleaseDC (hwnd,hdc); + } + } + lstSetVScrollInfo (hwnd, pData, TRUE); + } + } + break; + + case WM_CHAR: + { + char head [2]; + int index; + int newTop; + + head [0] = (char) (wParam); + head [1] = '\0'; + + pData = (PLISTBOXDATA)pCtrl->userdata; + + if (head[0] == ' ') { + if (dwStyle & LBS_MULTIPLESEL) { + RECT rcInv; + + GetClientRect (hwnd, &rcInv); + lstSelectItem (dwStyle, pData, pData->itemHilighted); + lstGetItemsRect (pData, + pData->itemHilighted, + pData->itemHilighted, + &rcInv); + InvalidateRect (hwnd, &rcInv, TRUE); + } + else if (dwStyle & LBS_CHECKBOX) { + NotifyParent (hwnd, pCtrl->id, LBN_CLICKCHECKMARK); + + if (dwStyle & LBS_AUTOCHECK) { + PLISTBOXITEM plbi; + + plbi = lstGetItem (pData, pData->itemHilighted); + + switch (plbi->dwFlags & LBIF_CHECKMARKMASK) { + case LBIF_CHECKED: + plbi->dwFlags &= ~LBIF_CHECKMARKMASK; + break; + default: + plbi->dwFlags &= ~LBIF_CHECKMARKMASK; + plbi->dwFlags |= LBIF_CHECKED; + break; + } + + lstInvalidateItem (hwnd, pData, + pData->itemHilighted, TRUE); + } + } + break; + } + + index = lstFindItem (pData, pData->itemHilighted + 1, head, FALSE); + if (index < 0) { + index = lstFindItem (pData, 0, head, FALSE); + } + + if (index >= 0) { + if (pData->itemCount - index >= pData->itemVisibles) + newTop = index; + else + newTop = max (pData->itemCount - pData->itemVisibles, 0); + + pData->itemTop = newTop; + pData->itemHilighted = index; + if (!(dwStyle & LBS_MULTIPLESEL)) + lstSelectItem (dwStyle, pData, index); + InvalidateRect (hwnd, NULL, TRUE); + + lstSetVScrollInfo (hwnd, pData, TRUE); + } + } + break; + + case WM_VSCROLL: + { + int newTop; + int scrollHeight = 0; + + pData = (PLISTBOXDATA)pCtrl->userdata; + newTop = pData->itemTop; + switch(wParam) + { + case SB_LINEDOWN: + +#if 0 /* test itemVisibles */ + printf("itemVisibles:%d\n",pData->itemVisibles); + printf("SB_LINEDOWN:(%d:%d)\n", + ITEM_BOTTOM (pData),(pData->itemCount - 1 )); +#endif + if (ITEM_BOTTOM (pData) < (pData->itemCount - 1 )) + { + newTop ++; + scrollHeight = -pData->itemHeight; /* for ScrollWindow() */ + } + break; + + case SB_LINEUP: + if (pData->itemTop > 0) + { + newTop --; + scrollHeight = pData->itemHeight; + } + break; + + case SB_PAGEDOWN: + if ((pData->itemTop + (pData->itemVisibles << 1)) <= + pData->itemCount) + newTop += pData->itemVisibles; + else + newTop = pData->itemCount - pData->itemVisibles; + + if (newTop < 0) + return 0; + + scrollHeight = -(newTop - pData->itemTop) + *pData->itemHeight; + break; + + case SB_PAGEUP: + if (pData->itemTop >= pData->itemVisibles) + newTop -= pData->itemVisibles; + else + newTop = 0; + + scrollHeight = (pData->itemTop - newTop)*pData->itemHeight; + break; + + case SB_THUMBTRACK: + newTop = (int)lParam; + scrollHeight = (pData->itemTop - newTop)*pData->itemHeight; + break; + } + + if (scrollHeight) + { + pData->itemTop = newTop; +#if 0 /* !!: fix: no scroll */ + ScrollWindow (hwnd, 0, scrollHeight, NULL, NULL); +#endif + SendMessage (hwnd, WM_PAINT, 0, 0); + + lstSetVScrollInfo (hwnd, pData, TRUE); + + return 0; + } + } + break; + + case WM_HSCROLL: + pData = (PLISTBOXDATA)pCtrl->userdata; + switch (wParam) + { + case SB_LINERIGHT: + break; + + case SB_LINELEFT: + break; + + case SB_PAGELEFT: + break; + + case SB_PAGERIGHT: + break; + } + break; + + default: + return DefWindowProc (hwnd, message, wParam, lParam); + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/medit.c b/packages/services/gfx/mw/current/src/mwin/winlib/medit.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/medit.c @@ -0,0 +1,1744 @@ +/* + * Copyright (C) 1999, 2000, Wei Yongming. + * Portions Copyright (c) 2000 Greg Haerr + * + * Multi Line Edit Control for Microwindows win32 api. + */ + +/* +** This library is free software; you can redistribute it and/or +** modify it under the terms of the GNU Library General Public +** License as published by the Free Software Foundation; either +** version 2 of the License, or (at your option) any later version. +** +** This library 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 +** Library General Public License for more details. +** +** You should have received a copy of the GNU Library General Public +** License along with this library; if not, write to the Free +** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +** MA 02111-1307, USA +*/ + +/* +** Alternatively, the contents of this file may be used under the terms +** of the Mozilla Public License (the "MPL License") in which case the +** provisions of the MPL License are applicable instead of those above. +*/ + +/* Note: +** Although there was a version by Zhao Jianghua, this version of +** EDIT control is written by Wei Yongming from scratch. +** +** Create date: 1999/8/26 +** +** Modify records: +** +** Who When Where For What Status +**----------------------------------------------------------------------------- +** WEI Yongming 2000/02/24 Tsinghua Add MPL License Finished +** Kevin Tseng 2000/08/30 gv port to microwin ported +** +** +** TODO: +** * Selection. +** * Undo. +*/ + +#include +#include +#include +#include +#define MWINCLUDECOLORS +#include "windows.h" /* windef.h, winuser.h */ +#include "wintools.h" +#include "device.h" /* GdGetTextSize */ + +#define USE_BIG5 + +#define WIDTH_MEDIT_BORDER 2 +#define MARGIN_MEDIT_LEFT 1 +#define MARGIN_MEDIT_TOP 1 +#define MARGIN_MEDIT_RIGHT 2 +#define MARGIN_MEDIT_BOTTOM 1 + +#define LEN_MLEDIT_BUFFER 3000 +#define LEN_MLEDIT_UNDOBUFFER 1024 + +#define EST_FOCUSED 0x00000001L +#define EST_MODIFY 0x00000002L +#define EST_READONLY 0x00000004L +#define EST_REPLACE 0x00000008L + +#define MEDIT_OP_NONE 0x00 +#define MEDIT_OP_DELETE 0x01 +#define MEDIT_OP_INSERT 0x02 +#define MEDIT_OP_REPLACE 0x03 + +typedef struct tagLINEDATA { + int lineNO; /* ÐкŠ*/ + int dataEnd; + struct tagLINEDATA *previous; /* ǰһÐÐ */ + struct tagLINEDATA *next; /* ºóÒ»ÐÐ */ + char buffer[LEN_MLEDIT_BUFFER+1]; +}LINEDATA; +typedef LINEDATA* PLINEDATA; + +#define ATTENG 0 /* english */ +#define ATTCHL 1 /* chinese left(1st) byte */ +#define ATTCHR 2 /* chinese right(2nd) byte */ +static char attr[LEN_MLEDIT_BUFFER]; + +typedef struct tagMLEDITDATA { + int totalLen; /* length of buffer,¿ÉÄÜûÓÐÓà */ + + int editPos; /* current edit position */ + int caretPos; /* caret offset in box */ + int editLine; /* current eidt line */ + int dispPos; /* ¿ªÊ¼ÏÔʾµÄλÖà */ + int StartlineDisp; /* start line displayed */ + int EndlineDisp; /* end line displayed */ + int linesDisp; /* ÐèÒªÏÔʾµÄÐÐÊý */ + int lines; /* ×ܵÄÐÐÊý` */ + int MaxlinesDisp; /* ×î´óÏÔʾµÄÐÐÊý. */ + + int selStartPos; /* selection start position */ + int selStartLine; /* selection start line */ + int selEndPos; /* selection end position */ + int selEndLine; /* selection end line */ + + int passwdChar; /* password character */ + + int leftMargin; /* left margin */ + int topMargin; /* top margin */ + int rightMargin; /* right margin */ + int bottomMargin; /* bottom margin */ + + int hardLimit; /* hard limit */ + + int lastOp; /* last operation */ + int lastPos; /* last operation position */ + int lastLine; /* last operation line */ + int affectedLen; /* affected len of last operation */ + int undoBufferLen; /* undo buffer len */ + char undoBuffer [LEN_MLEDIT_UNDOBUFFER]; + /* Undo buffer; */ + PLINEDATA head; /* buffer */ + PLINEDATA tail; /* ¿ÉÄܲ»ÐèÒª */ +}MLEDITDATA; +typedef MLEDITDATA* PMLEDITDATA; + +BOOL RegisterMLEditControl (void); + +int MLEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam); + +#define PIXEL_invalid (-1) +extern HWND sg_hCaretWnd; +extern HWND rootwp; + +static int GetSysCharHeight (HWND hwnd) +{ +#ifndef USE_BIG5 + HDC hdc; + int xw, xh, xb; + + hdc = GetDC(hwnd); + SelectObject(hdc, GetStockObject(DEFAULT_FONT)); + GdSetFont(hdc->font->pfont); + GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII); + ReleaseDC(hwnd,hdc); + + return xh; +#else + return 12; +#endif +} + +static int GetSysCharWidth (HWND hwnd) +{ +#ifndef USE_BIG5 + HDC hdc; + int xw, xh, xb; + + hdc = GetDC(hwnd); + SelectObject(hdc, GetStockObject(DEFAULT_FONT)); + GdSetFont(hdc->font->pfont); + GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII); + ReleaseDC(hwnd,hdc); + + return xw; +#else + return 6; +#endif +} + +static int GetSysCCharWidth (HWND hwnd) +{ + return (2*GetSysCharWidth(hwnd)); +} +char* GetWindowCaption (HWND hWnd) +{ + return hWnd->szTitle; +} + +DWORD GetWindowAdditionalData (HWND hWnd) +{ + return hWnd->userdata; +} + +DWORD SetWindowAdditionalData (HWND hWnd, DWORD newData) +{ + DWORD oldOne = 0L; + + oldOne = hWnd->userdata; + hWnd->userdata = newData; + + return oldOne; +} + +DWORD GetWindowAdditionalData2 (HWND hWnd) +{ + return hWnd->userdata2; +} + +DWORD SetWindowAdditionalData2 (HWND hWnd, DWORD newData) +{ + DWORD oldOne = 0L; + + oldOne = hWnd->userdata2; + hWnd->userdata2 = newData; + + return oldOne; +} + +DWORD GetWindowStyle (HWND hWnd) +{ + return hWnd->style; +} + +BOOL ExcludeWindowStyle (HWND hWnd, DWORD dwStyle) +{ + if (hWnd == rootwp/*HWND_DESKTOP*/) + return FALSE; + + hWnd->style &= ~dwStyle; + return TRUE; +} + +BOOL IncludeWindowStyle (HWND hWnd, DWORD dwStyle) +{ + + if (hWnd == rootwp/*HWND_DESKTOP*/) + return FALSE; + + hWnd->style |= dwStyle; + return TRUE; +} + +int WINAPI MwRegisterMEditControl(HINSTANCE hInstance) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)MLEditCtrlProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = NULL; + wc.hCursor = 0; + wc.hbrBackground= GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName= "MEDIT"; + + return RegisterClass(&wc); +} + +static inline int edtGetOutWidth (HWND hWnd) +{ + PMLEDITDATA pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd); + RECT rc; + GetClientRect(hWnd,&rc); + return rc.right - rc.left + - pMLEditData->leftMargin + - pMLEditData->rightMargin; +} + +static int edtGetStartDispPosAtEnd (HWND hWnd, + PLINEDATA pLineData) +{ + int nOutWidth = edtGetOutWidth (hWnd); + int endPos = pLineData->dataEnd; + PMLEDITDATA pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd); + int newStartPos = pMLEditData->dispPos; + const char* buffer = pLineData->buffer; + + if(endPos < newStartPos) + return 0; + while (TRUE) + { + if ((endPos - newStartPos) * GetSysCharWidth (hWnd) < nOutWidth) + break; + + /* 1st:gb:a1-f7,big5:a1-f9 */ + if ((BYTE)buffer [newStartPos] > 0xA0) + { + newStartPos ++; + if (newStartPos < pLineData->dataEnd) + { +#ifndef USE_BIG5 + if ((BYTE)buffer [newStartPos] > 0xA0) +#else /* 2nd:gb:a1-fe,big5:40-7e,a1-fe */ + if ( ((BYTE)buffer [newStartPos] >= 0x40 && (BYTE)buffer[newStartPos] <= 0x7e) || + ((BYTE)buffer [newStartPos] >= 0xa1 && (BYTE)buffer[newStartPos] <= 0xfe)) +#endif + newStartPos ++; + } + } + else + newStartPos ++; + } + return newStartPos; +} + +static int edtGetDispLen (HWND hWnd,PLINEDATA pLineData) +{ + int i, n = 0; + int nOutWidth = edtGetOutWidth (hWnd); + int nTextWidth = 0; + PMLEDITDATA pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd); + const char* buffer = pLineData->buffer; + + if(buffer[0]==0||pLineData->dataEnddispPos) + return 0; + + for (i = pMLEditData->dispPos; i < pLineData->dataEnd; i++) + { + /* 1st:gb:a1-f7,big5:a1-f9 */ + if ((BYTE)buffer [i] > 0xA0) + { + i++; + if (i < pLineData->dataEnd) + { +#ifndef USE_BIG5 + if ((BYTE)buffer [i] > 0xA0) /* 2nd:gb:a1-fe,big5:40-7e,a1-fe */ +#else /* 2nd:gb:a1-fe,big5:40-7e,a1-fe */ + if ( ((BYTE)buffer [i] >= 0x40 && (BYTE)buffer[i] <= 0x7e) || + ((BYTE)buffer [i] >= 0xa1 && (BYTE)buffer[i] <= 0xfe)) +#endif + { + nTextWidth += GetSysCCharWidth (hWnd); + n += 2; + } + else + i--; + } + else + { + nTextWidth += GetSysCharWidth (hWnd); + n++; + } + } + else + { + nTextWidth += GetSysCharWidth (hWnd); + n++; + } + + if (nTextWidth > nOutWidth) + break; + } + + return n; +} + +static int edtGetOffset (HWND hwnd,const MLEDITDATA* pMLEditData, PLINEDATA pLineData, int x) +{ + int i; + int newOff = 0; + int nTextWidth = 0; + const char* buffer = pLineData->buffer; + + if(pLineData->dataEnddispPos) + return pLineData->dataEnd; + + x -= pMLEditData->leftMargin; + for (i = pMLEditData->dispPos; i < pLineData->dataEnd; i++) { + if ((nTextWidth + (GetSysCharWidth(hwnd) >> 1)) >= x) + break; + + /* 1st:gb:a1-f7,big5:a1-f9 */ + if ((BYTE)buffer [i] > 0xA0) + { + i++; + + if (nTextWidth + GetSysCCharWidth(hwnd)/2 >= x) + break; + + if (i < pLineData->dataEnd) + { +#ifndef USE_BIG5 + if ((BYTE)buffer [i] > 0xA0) /* 2nd:gb:a1-fe,big5:40-7e,a1-fe */ +#else /* 2nd:gb:a1-fe,big5:40-7e,a1-fe */ + if ( ((BYTE)buffer [i] >= 0x40 && (BYTE)buffer[i] <= 0x7e) || + ((BYTE)buffer [i] >= 0xa1 && (BYTE)buffer[i] <= 0xfe)) +#endif + { + nTextWidth += GetSysCCharWidth (hwnd); + newOff += 2; + } + else + i --; + } + else + { + nTextWidth += GetSysCharWidth (hwnd); + newOff ++; + } + } + else + { + nTextWidth += GetSysCharWidth (hwnd); + newOff ++; + } + } + return newOff; +} + +static int edtGetLineNO (HWND hwnd,const MLEDITDATA* pMLEditData, int x) +{ + int nline = 0; + if(x>=0) + { + nline = x / GetSysCharHeight(hwnd); + if (nline <= pMLEditData->linesDisp) + return nline; + } + return -1; +} + +static BOOL edtIsACCharAtPosition (const char* string, int len, int pos) +{ + if (pos > (len - 2)) + return FALSE; + +/* 1st:gb:a1-f7,big5:a1-f9 2nd:gb:a1-fe,big5:40-7e,a1-fe */ +#ifndef USE_BIG5 + if ((BYTE)string [pos] > 0xA0 && (BYTE)string [pos + 1] > 0xA0) + return TRUE; +#else + if ((BYTE)string [pos] > 0xA0) + { + if ( ((BYTE)string [pos + 1] >= 0x40 && (BYTE)string [pos + 1] <= 0x7e) || + ((BYTE)string [pos + 1] >= 0xa1 && (BYTE)string [pos + 1] <= 0xfe)) { + /*fprintf(stderr,"true\n"); + fflush(stderr);*/ + return TRUE; + } + } +#endif + + return FALSE; +} + +static void str2attr(const char* str,int len) +{ + int i=0; + do + { + if (edtIsACCharAtPosition(str,len,i)) + { + attr[i]=ATTCHL; + attr[i+1]=ATTCHR; + i+=2; + } + else + { + attr[i]=ATTENG; + i++; + } + }while(i 0xA0 && (BYTE)string [pos - 1] > 0xA0) + return TRUE; +#else +#if 0 + if ((BYTE)string [pos - 2] > 0xA0) + { + if ( ((BYTE)string [pos - 1] >= 0x40 && (BYTE)string[pos - 1] <= 0x7e) || + ((BYTE)string [pos - 1] >= 0xa1 && (BYTE)string[pos - 1] <= 0xfe)) + return TRUE; + } +#else + str2attr(string,len); + if (attr[pos-1]==ATTENG) return FALSE; + else return TRUE; +#endif +#endif + + return FALSE; +} + + +static BOOL edtIsACCharFromBegin(const char* string,int len,int pos) +{ + int i; + if(pos == 0) + return TRUE; + if(len == 0) + return FALSE; + for(i=0;ihead = malloc (sizeof (LINEDATA)))) { + fprintf (stderr, "EDITLINE: malloc error!\n"); + return ; + } + pMLEditData->head->previous = NULL; + pLineData=pMLEditData->head; + while ( (off1 = GetRETURNPos(caption)) != -1) + { + off1 = min(off1, LEN_MLEDIT_BUFFER); + memcpy(pLineData->buffer,caption,off1); + pLineData->buffer[off1] = '\0'; + caption+=min(off1,LEN_MLEDIT_BUFFER)+1; + pLineData->lineNO = lineNO; + pMLEditData->dispPos = 0; + pLineData->dataEnd = strlen(pLineData->buffer); + pLineData->next = malloc (sizeof (LINEDATA)); + pLineData->next->previous = pLineData; + pLineData = pLineData->next; + lineNO++; + } + off1 = min(strlen(caption),LEN_MLEDIT_BUFFER); + memcpy(pLineData->buffer,caption,off1); + pLineData->buffer[off1] = '\0'; + pLineData->lineNO = lineNO++; + pMLEditData->dispPos = 0; + pLineData->dataEnd = strlen(pLineData->buffer); + pLineData->next = NULL; + pMLEditData->lines = lineNO ; +} + +PLINEDATA GetLineData(PMLEDITDATA pMLEditData,int lineNO) +{ + PLINEDATA pLineData=pMLEditData->head; + while(pLineData) + { + if(pLineData->lineNO==lineNO) + return pLineData; + pLineData = pLineData->next; + } + return NULL; +} + +int MLEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +{ + DWORD dwStyle; + DWORD dw; + HDC hdc; + PLINEDATA pLineData; + RECT clientRect; + PMLEDITDATA pMLEditData; + dwStyle = GetWindowStyle(hWnd); + + switch (message) + { + case WM_CREATE: + { + if (!(pMLEditData = malloc (sizeof (MLEDITDATA)))) { + fprintf (stderr, "EDIT: malloc error!\n"); + return -1; + } + + pMLEditData->totalLen = LEN_MLEDIT_BUFFER; + pMLEditData->editPos = 0; + pMLEditData->editLine = 0; + pMLEditData->caretPos = 0; + + MLEditInitBuffer(pMLEditData,GetWindowCaption(hWnd)); + + GetClientRect(hWnd,&clientRect); + pMLEditData->MaxlinesDisp = (clientRect.bottom-clientRect.top)/GetSysCharHeight(hWnd); + pMLEditData->linesDisp = min(pMLEditData->MaxlinesDisp,pMLEditData->lines); + pMLEditData->StartlineDisp = 0; + pMLEditData->EndlineDisp = pMLEditData->StartlineDisp + pMLEditData->linesDisp - 1; + + pMLEditData->selStartPos = 0; + pMLEditData->selEndPos = 0; + pMLEditData->passwdChar = '*'; + pMLEditData->leftMargin = MARGIN_MEDIT_LEFT; + pMLEditData->topMargin = MARGIN_MEDIT_TOP; + pMLEditData->rightMargin = MARGIN_MEDIT_RIGHT; + pMLEditData->bottomMargin = MARGIN_MEDIT_BOTTOM; + + pMLEditData->hardLimit = -1; + + /* undo information */ + pMLEditData->lastOp = MEDIT_OP_NONE; + pMLEditData->lastPos = 0; + pMLEditData->affectedLen = 0; + pMLEditData->undoBufferLen = LEN_MLEDIT_UNDOBUFFER; + pMLEditData->undoBuffer [0] = '\0'; + SetWindowAdditionalData2(hWnd,(DWORD)pMLEditData); + SetWindowAdditionalData(hWnd,(DWORD)0); + break; + } + case WM_DESTROY: + { + PLINEDATA temp; + pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd); + DestroyCaret (); + pLineData = pMLEditData->head; + while(pLineData) + { + /*printf("delete lineNO = %d,buffer=%s\n",pLineData->lineNO,pLineData->buffer);*/ + temp = pLineData->next; + free(pLineData); + pLineData = temp; + } + free(pMLEditData); + } + break; + + case WM_SETFONT: + break; + + case WM_GETFONT: + break; + +#if 0 /* fix: no WM_SETCURSOR */ + case WM_SETCURSOR: + if (dwStyle & WS_DISABLED) { + SetCursor (GetSystemCursor (IDC_ARROW)); + return 0; + } + break; + + case WM_SIZECHANGED: + { + } + return 0; +#endif + case WM_KILLFOCUS: + { + dw= GetWindowAdditionalData(hWnd); + dw&= ~EST_FOCUSED; + SetWindowAdditionalData(hWnd,dw); + + HideCaret (hWnd); + DestroyCaret (); + + SendMessage (GetParent (hWnd), + WM_COMMAND, + (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_KILLFOCUS), + (LPARAM)hWnd); + } + break; + + case WM_SETFOCUS: + { + dw= GetWindowAdditionalData(hWnd); + if (dw & EST_FOCUSED) + return 0; + + dw |= EST_FOCUSED; + SetWindowAdditionalData(hWnd,dw); + + pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd); + + /* only implemented for ES_LEFT align format. */ + + CreateCaret (hWnd, NULL, 1, /*GetSysCharWidth(hWnd)+1,*/ + hWnd->clirect.bottom-hWnd->clirect.top-2); + SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin, pMLEditData->topMargin); + ShowCaret(hWnd); + + SendMessage (GetParent (hWnd), + WM_COMMAND, + (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_SETFOCUS), + (LPARAM) hWnd); + } + break; + + case WM_ENABLE: + if ( (!(dwStyle & WS_DISABLED) && !wParam) + || ((dwStyle & WS_DISABLED) && wParam) ) { + if (wParam) + ExcludeWindowStyle(hWnd,WS_DISABLED); + else + IncludeWindowStyle(hWnd,WS_DISABLED); + + InvalidateRect (hWnd, NULL, FALSE); + } + return 0; + + case WM_NCPAINT: + { + RECT rc; +#if 0 + if (wParam) + hdc = (HDC)wParam; + else + hdc = GetDC (hWnd); +#if 0 /* fix: no ClipRectIntersect() */ + if (lParam) + ClipRectIntersect (hdc, (RECT*)lParam); +#endif +#else + hdc = wParam? (HDC)wParam: GetWindowDC (hWnd); + GetWindowRect(hWnd, &rc); +#endif + if (dwStyle & WS_BORDER) + { +#if 0 + RECT rc; + GetWindowRect(hWnd,&rc); + Draw3DDownFrame (hdc, 0, 0, + rc.right - rc.left - 1, + rc.bottom - rc.top - 1, + PIXEL_invalid); +#else + Draw3dInset(hdc, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top); +#endif + } + if (!wParam) { + ReleaseDC(hWnd,hdc); + } + } + return 0; + + case WM_PAINT: + { + int dispLen,i; + char* dispBuffer; + RECT rect,rc; + PAINTSTRUCT ps; + HGDIOBJ oldfont=NULL; + + hdc = BeginPaint (hWnd,&ps); + GetClientRect (hWnd, &rect); + + if (dwStyle & WS_DISABLED) + { + rc.left=0; rc.top=0; rc.bottom=rect.bottom; rc.right=rect.right; + FillRect(hdc,&rc,GetStockObject(LTGRAY_BRUSH)); + SetBkColor (hdc, LTGRAY/*PIXEL_lightgray*/); + } + else { + rc.left=0; rc.top=0; rc.bottom=rect.bottom; rc.right=rect.right; + FillRect(hdc,&rc,GetStockObject(WHITE_BRUSH)); + SetBkColor (hdc, WHITE/*PIXEL_lightwhite*/); + } + + SetTextColor (hdc, BLACK/*PIXEL_black*/); + + pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd); + for(i = pMLEditData->StartlineDisp; i <= pMLEditData->EndlineDisp; i++) + { + pLineData= GetLineData(pMLEditData,i); + dispLen = edtGetDispLen (hWnd,pLineData); + if (dispLen == 0 && pMLEditData->EndlineDisp >= pMLEditData->lines) { + continue; + } + +#ifdef _DEBUG + if (pMLEditData->dispPos > pLineData->dataEnd) + fprintf (stderr, "ASSERT failure: %s.\n", "Edit Paint"); +#endif + + dispBuffer = alloca (LEN_MLEDIT_BUFFER+1); + + if (dwStyle & ES_PASSWORD) + memset (dispBuffer, '*', pLineData->dataEnd); + memcpy (dispBuffer, + pLineData->buffer, /* +pMLEditData->dispPos, */ + pLineData->dataEnd); /* - pMLEditData->dispPos); */ + dispBuffer[pLineData->dataEnd] = '\0'; + + /* only implemented ES_LEFT align format for single line edit. */ + rect.left = pMLEditData->leftMargin; + rect.top = pMLEditData->topMargin ; + rect.right = pMLEditData->rightMargin; + rect.bottom = pMLEditData->bottomMargin; +#if 0 + printf("lineNO=%d,lines=%d,editLine=%d\n",pLineData->lineNO,pMLEditData->lines, + pMLEditData->editLine); + printf("--dispBuffer=%s--\n",dispBuffer); + ClipRectIntersect (hdc, &rect); /* fix: no ClipRectIntersect() */ +#endif + +#ifdef USE_BIG5 + oldfont=SelectObject(hdc,CreateFont(12, + 0,0,0,0,0,0,0,0,0,0,0, + FF_DONTCARE|DEFAULT_PITCH, + "HZXFONT")); +#endif + TextOut (hdc, + pMLEditData->leftMargin - pMLEditData->dispPos * GetSysCharWidth(hWnd) , + GetSysCharHeight(hWnd)*(pLineData->lineNO - pMLEditData->StartlineDisp) + + pMLEditData->topMargin, + dispBuffer,-1); + } +#ifdef USE_BIG5 + DeleteObject(SelectObject(hdc,oldfont)); +#endif + EndPaint (hWnd, &ps); + } + break; + + case WM_KEYDOWN: + { + BOOL bChange = FALSE; + int i; + int deleted; + PLINEDATA temp = NULL; + char * tempP = NULL; + + pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd); + + switch (LOWORD (wParam)) + { + + case VK_RETURN: /* SCANCODE_ENTER: */ + { + pLineData = GetLineData(pMLEditData,pMLEditData->editLine); + if (pMLEditData->editPos < pLineData->dataEnd) + tempP = pLineData->buffer + pMLEditData->editPos; + temp = pLineData->next; + pLineData->next = malloc( sizeof(LINEDATA) ); + pLineData->next->previous = pLineData; + pLineData->next->next = temp; + if(temp) + { + temp->previous = pLineData->next; + } + temp = pLineData->next; + temp->lineNO = pMLEditData->editLine + 1; + if(tempP) + { + memcpy(temp->buffer,tempP,strlen(tempP)); + temp->dataEnd = strlen(tempP); + } + else + temp->dataEnd = 0; + temp->buffer[temp->dataEnd] = '\0'; + pLineData->dataEnd = pMLEditData->editPos; + pLineData->buffer[pLineData->dataEnd]='\0'; + temp = temp->next; + while (temp) + { + temp->lineNO++; + temp = temp->next; + } + pMLEditData->editPos = 0; + pMLEditData->caretPos= 0; + pMLEditData->dispPos = 0; + if(pMLEditData->linesDisp < pMLEditData->MaxlinesDisp) + { + pMLEditData->EndlineDisp++; + pMLEditData->linesDisp++; + } + else if(pMLEditData->editLine == pMLEditData->EndlineDisp) + { + pMLEditData->StartlineDisp++; + pMLEditData->EndlineDisp++; + } + pMLEditData->editLine++; + pMLEditData->lines++; + SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin, + (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd) + +pMLEditData->topMargin); + InvalidateRect (hWnd, NULL, FALSE); + return 0; + } + case VK_HOME: /* SCANCODE_HOME: */ + { + PLINEDATA temp; + if (pMLEditData->editPos == 0) + return 0; + + pMLEditData->editPos = 0; + pMLEditData->caretPos = 0; + + SetCaretPos (pMLEditData->leftMargin, + (pMLEditData->editLine-pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd) + +pMLEditData->topMargin); + temp = GetLineData(pMLEditData,pMLEditData->editLine); + if (pMLEditData->dispPos != 0) + { + pMLEditData->dispPos = 0; + InvalidateRect (hWnd, NULL, FALSE); + } + return 0; + } + case VK_END: /* SCANCODE_END: */ + { + int newStartPos; + pLineData = GetLineData(pMLEditData,pMLEditData->editLine); + if (pMLEditData->editPos == pLineData->dataEnd) + return 0; + newStartPos = edtGetStartDispPosAtEnd (hWnd, pLineData); + + pMLEditData->editPos = pLineData->dataEnd; + pMLEditData->caretPos = pMLEditData->editPos - newStartPos; + + SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin, + (pMLEditData->editLine-pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd) + + pMLEditData->topMargin); + + if (pMLEditData->dispPos != newStartPos) + InvalidateRect (hWnd, NULL, FALSE); + pMLEditData->dispPos = newStartPos; + } + return 0; + + case VK_LEFT: /* SCANCODE_CURSORBLOCKLEFT: */ + { + BOOL bScroll = FALSE; + int scrollStep,newStartPos; + PLINEDATA temp; + pLineData = GetLineData(pMLEditData,pMLEditData->editLine); + if (pMLEditData->editPos == 0 ) + { + temp = pLineData->previous; + if(temp && pMLEditData->editLine > pMLEditData->StartlineDisp) + { + pMLEditData->editLine --; + pMLEditData->editPos = temp->dataEnd; + newStartPos = edtGetStartDispPosAtEnd (hWnd, temp); + pMLEditData->caretPos = pMLEditData->editPos - newStartPos; + if (pMLEditData->dispPos != newStartPos) + { + pMLEditData->dispPos = newStartPos; + bScroll = TRUE; + } + } + else + return 0; + } + else + { if (edtIsACCharBeforePosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->editPos)) { + scrollStep = 2; + pMLEditData->editPos -= 2; + } + else { + scrollStep = 1; + pMLEditData->editPos --; + } + + pMLEditData->caretPos -= scrollStep; + if (pMLEditData->caretPos == 0 + && pMLEditData->editPos != 0) { + + bScroll = TRUE; + + if (edtIsACCharBeforePosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->editPos)) { + pMLEditData->dispPos -= 2; + pMLEditData->caretPos = 2; + } + else { + pMLEditData->dispPos--; + pMLEditData->caretPos = 1; + } + } + else if (pMLEditData->caretPos < 0) { + pMLEditData->dispPos = 0; + pMLEditData->caretPos = 0; + } + } + SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin, + (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd) + + pMLEditData->topMargin); + + if (bScroll) + InvalidateRect (hWnd, NULL, FALSE); + } + return 0; + + case VK_RIGHT: /* SCANCODE_CURSORBLOCKRIGHT: */ + { + BOOL bScroll = FALSE; + int scrollStep, moveStep; + PLINEDATA temp; + + pLineData = GetLineData(pMLEditData,pMLEditData->editLine); + if (pMLEditData->editPos == pLineData->dataEnd) + { + temp = pLineData->next; + if(temp) + { + pMLEditData->editLine++; + pMLEditData->editPos = 0; + pMLEditData->caretPos = 0; + if(pMLEditData->dispPos !=0) + { + pMLEditData->dispPos = 0; + bScroll = TRUE; + } + } + else + return 0; + } + else + { + if (edtIsACCharAtPosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->dispPos)) { + if (edtIsACCharAtPosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->editPos)) { + scrollStep = 2; + moveStep = 2; + pMLEditData->editPos += 2; + } + else { + scrollStep = 2; + moveStep = 1; + pMLEditData->editPos ++; + } + } + else { + if (edtIsACCharAtPosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->editPos)) { + + if (edtIsACCharAtPosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->dispPos + 1)) + scrollStep = 3; + else + scrollStep = 2; + + moveStep = 2; + pMLEditData->editPos += 2; + } + else { + scrollStep = 1; + moveStep = 1; + pMLEditData->editPos ++; + } + } + + pMLEditData->caretPos += moveStep; + if (pMLEditData->caretPos * GetSysCharWidth (hWnd) + > edtGetOutWidth (hWnd)) { + bScroll = TRUE; + pMLEditData->dispPos += scrollStep; + pMLEditData->caretPos = + pMLEditData->editPos - pMLEditData->dispPos; + } + } + SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin, + (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight (hWnd) + + pMLEditData->topMargin); + + if (bScroll) + InvalidateRect (hWnd, NULL, FALSE); + } + return 0; + + case VK_UP: /* SCANCODE_CURSORBLOCKUP: */ + { + BOOL bScroll = FALSE; + int newStartPos; + PLINEDATA temp; + pLineData = GetLineData(pMLEditData,pMLEditData->editLine); + temp = pLineData->previous; + if(pMLEditData->editLine == 0) + return 0; + else if (pMLEditData->editLine == pMLEditData->StartlineDisp) + { + bScroll = TRUE; + pMLEditData->StartlineDisp--; + pMLEditData->EndlineDisp--; + } + pMLEditData->editLine--; + + if( pMLEditData->editPos >= temp->dataEnd ) + { + pMLEditData->editPos = temp->dataEnd; + pMLEditData->dispPos = 0; + newStartPos = edtGetStartDispPosAtEnd (hWnd, temp); + pMLEditData->dispPos = newStartPos; + pMLEditData->caretPos = pMLEditData->editPos - newStartPos; + bScroll = TRUE; + } + else + { + newStartPos = edtGetOffset(hWnd, pMLEditData,temp, + pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin); + if(!edtIsACCharFromBegin(temp->buffer,temp->dataEnd, + pMLEditData->dispPos)) + { + bScroll = TRUE; + pMLEditData->dispPos--; + newStartPos = edtGetOffset(hWnd, pMLEditData,temp, + pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin+GetSysCharWidth(hWnd)/2); + } + pMLEditData->editPos = newStartPos + pMLEditData->dispPos; + pMLEditData->caretPos = newStartPos; + } + SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin, + (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd) + + pMLEditData->topMargin); + if(bScroll) + InvalidateRect(hWnd,NULL,FALSE); + } + break; + case VK_DOWN: /* SCANCODE_CURSORBLOCKDOWN: */ + { + BOOL bScroll = FALSE; + int newStartPos; + PLINEDATA temp; + pLineData = GetLineData(pMLEditData,pMLEditData->editLine); + temp = pLineData->next; + if(pMLEditData->editLine == pMLEditData->lines-1) + return 0; + else if (pMLEditData->editLine == pMLEditData->EndlineDisp) + { + bScroll = TRUE; + pMLEditData->StartlineDisp++; + pMLEditData->EndlineDisp++; + } + pMLEditData->editLine++; + + if( pMLEditData->editPos >= temp->dataEnd ) + { + pMLEditData->editPos = temp->dataEnd; + pMLEditData->dispPos = 0; + newStartPos = edtGetStartDispPosAtEnd (hWnd, temp); + pMLEditData->dispPos = newStartPos; + pMLEditData->caretPos = pMLEditData->editPos - newStartPos; + bScroll = TRUE; + } + else + { + newStartPos = edtGetOffset(hWnd, pMLEditData,temp, + pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin); + if(!edtIsACCharFromBegin(temp->buffer,temp->dataEnd, + pMLEditData->dispPos)) + { + bScroll = TRUE; + pMLEditData->dispPos--; + newStartPos = edtGetOffset(hWnd, pMLEditData,temp, + pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin+GetSysCharWidth(hWnd)/2); + } + pMLEditData->editPos = newStartPos + pMLEditData->dispPos; + pMLEditData->caretPos = newStartPos; + } + SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin, + (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd) + + pMLEditData->topMargin); + if(bScroll) + InvalidateRect(hWnd,NULL,FALSE); + + } + break; + case VK_INSERT: /* SCANCODE_INSERT: */ + dw = GetWindowAdditionalData(hWnd); + dw ^= EST_REPLACE; + SetWindowAdditionalData(hWnd,dw); + break; + + case VK_DELETE: /* SCANCODE_REMOVE: */ + { + PLINEDATA temp; + int leftLen; + pLineData = GetLineData(pMLEditData,pMLEditData->editLine); + if ((GetWindowAdditionalData(hWnd) & EST_READONLY) ){ +#if 0 /* fix: no ping() */ + ping (); +#endif + return 0; + } + temp = pLineData->next; + if (pLineData->dataEnd == pMLEditData->editPos && temp) + { + if(pLineData->dataEnd + temp->dataEnd <= LEN_MLEDIT_BUFFER) + { + memcpy(pLineData->buffer+pLineData->dataEnd,temp->buffer,temp->dataEnd); + pLineData->dataEnd += temp->dataEnd; + pLineData->buffer[pLineData->dataEnd] = '\0'; + if(temp->next) + { + pLineData->next = temp->next; + temp->next->previous = pLineData; + } + else + pLineData->next = NULL; + free(temp); + temp = pLineData->next; + while (temp) + { + temp->lineNO--; + temp = temp->next; + } + if(pMLEditData->lines <= pMLEditData->MaxlinesDisp) + { + pMLEditData->EndlineDisp--; + pMLEditData->linesDisp--; + } + if(pMLEditData->EndlineDisp >= pMLEditData->lines-1) + { + pMLEditData->EndlineDisp--; + if(pMLEditData->StartlineDisp !=0) + pMLEditData->StartlineDisp--; + else + pMLEditData->linesDisp--; + } + pMLEditData->lines--; + } + else if (temp->dataEnd > 0) + { + leftLen = LEN_MLEDIT_BUFFER - pLineData->dataEnd; + memcpy(pLineData->buffer+pLineData->dataEnd,temp->buffer,leftLen); + pLineData->dataEnd +=leftLen; + pLineData->buffer[pLineData->dataEnd] = '\0'; + memcpy(temp->buffer,temp->buffer+leftLen,temp->dataEnd-leftLen); + temp->dataEnd -=leftLen; + temp->buffer[temp->dataEnd] = '\0'; + } + } + else if (pMLEditData->editPos != pLineData->dataEnd) + { + if (edtIsACCharAtPosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->editPos)) + deleted = 2; + else + deleted = 1; + + for (i = pMLEditData->editPos; + i < pLineData->dataEnd - deleted; + i++) + pLineData->buffer [i] + = pLineData->buffer [i + deleted]; + + pLineData->dataEnd -= deleted; + pLineData->buffer[pLineData->dataEnd] = '\0'; + } + bChange = TRUE; + InvalidateRect (hWnd, NULL,FALSE); + } + break; + + case VK_BACK: /* SCANCODE_BACKSPACE: */ + { + PLINEDATA temp; + int leftLen,tempEnd; + if ((GetWindowAdditionalData(hWnd) & EST_READONLY) ){ +#if 0 /* fix: no Ping() */ + Ping (); +#endif + return 0; + } + pLineData = GetLineData(pMLEditData,pMLEditData->editLine); + temp = pLineData->previous; + if (pMLEditData->editPos == 0 && temp) + { + tempEnd = temp->dataEnd; + if(pLineData->dataEnd + temp->dataEnd <= LEN_MLEDIT_BUFFER) + { + memcpy(temp->buffer+temp->dataEnd,pLineData->buffer,pLineData->dataEnd); + temp->dataEnd +=pLineData->dataEnd; + temp->buffer[temp->dataEnd] = '\0'; + if(pLineData->next) + { + temp->next = pLineData->next; + pLineData->next->previous = temp; + } + else + temp->next = NULL; + free(pLineData); + pLineData = temp; + temp = temp->next; + while(temp) + { + temp->lineNO--; + temp = temp->next; + } + if(pMLEditData->StartlineDisp == pMLEditData->editLine + && pMLEditData->StartlineDisp != 0) + { + pMLEditData->StartlineDisp--; + if(pMLEditData->EndlineDisp == pMLEditData->lines) + pMLEditData->EndlineDisp--; + } + if(pMLEditData->lines <= pMLEditData->MaxlinesDisp) + { + pMLEditData->linesDisp--; + pMLEditData->EndlineDisp--; + } + pMLEditData->lines--; + } + else if (pLineData->dataEnd > 0) + { + leftLen = LEN_MLEDIT_BUFFER - temp->dataEnd; + memcpy(temp->buffer+temp->dataEnd,pLineData->buffer,leftLen); + temp->dataEnd +=leftLen; + temp->buffer[temp->dataEnd] = '\0'; + memcpy(pLineData->buffer,pLineData->buffer+leftLen,pLineData->dataEnd-leftLen); + pLineData->dataEnd -=leftLen; + pLineData->buffer[pLineData->dataEnd] = '\0'; + } + pMLEditData->editLine--; + pMLEditData->editPos = tempEnd; + pMLEditData->dispPos = tempEnd; + /* µ±±à¼­Î»Öò»Îª0,caretλÖÃΪ0µÄʱºò,ÒÆ¶¯caretλÖÃ. */ + if (pMLEditData->caretPos == 0 + && pMLEditData->editPos != 0) { + if (edtIsACCharBeforePosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->editPos)) { + pMLEditData->dispPos -= 2; + pMLEditData->caretPos = 2; + } + else { + pMLEditData->dispPos--; + pMLEditData->caretPos = 1; + } + } + else if (pMLEditData->caretPos < 0) { + pMLEditData->dispPos = 0; + pMLEditData->caretPos = 0; + } + } + else if (pMLEditData->editPos != 0 ) + { + if (edtIsACCharBeforePosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->editPos)) + deleted = 2; + else + deleted = 1; + + for (i = pMLEditData->editPos; + i < pLineData->dataEnd; + i++) + pLineData->buffer [i - deleted] + = pLineData->buffer [i]; + + pLineData->dataEnd -= deleted; + pMLEditData->editPos -= deleted; + pMLEditData->caretPos -= deleted; + if (pMLEditData->caretPos == 0 + && pMLEditData->editPos != 0) { + if (edtIsACCharBeforePosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->editPos)) { + pMLEditData->dispPos -= 2; + pMLEditData->caretPos = 2; + } + else { + pMLEditData->dispPos --; + pMLEditData->caretPos = 1; + } + + } + } + bChange = TRUE; + SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin, + (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd) + + pMLEditData->topMargin); + InvalidateRect (hWnd, NULL, FALSE); + } + break; + + default: + break; + } + + if (bChange) + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_CHANGE), + (LPARAM) hWnd); + return 0; + } + + case WM_CHAR: + { + char charBuffer [2]; + int i, chars, scrollStep, inserting; + UINT format; + + pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); + + pLineData = GetLineData(pMLEditData,pMLEditData->editLine); + + if (dwStyle & ES_READONLY) { +#if 0 /* fix: no Ping() */ + Ping (); +#endif + return 0; + } + if (HIBYTE (wParam)) { + charBuffer [0] = LOBYTE (wParam); + charBuffer [1] = HIBYTE (wParam); + chars = 2; + } + else { + charBuffer [0] = LOBYTE (wParam); + chars = 1; + } + + if (chars == 1) { + switch (charBuffer [0]) + { + case 0x00: /* NULL */ + case 0x07: /* BEL */ + case 0x08: /* BS */ + case 0x09: /* HT */ + case 0x0A: /* LF */ + case 0x0B: /* VT */ + case 0x0C: /* FF */ + case 0x0D: /* CR */ + case 0x1B: /* Escape */ + return 0; + } + } + if (GetWindowAdditionalData(hWnd) & EST_REPLACE) { + if (pLineData->dataEnd == pMLEditData->editPos) + inserting = chars; + else if (edtIsACCharAtPosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->editPos)) { + if (chars == 2) + inserting = 0; + else + inserting = -1; + } + else { + if (chars == 2) + inserting = 1; + else + inserting = 0; + } + } + else + inserting = chars; + + /* check space */ + if (pLineData->dataEnd + inserting > pMLEditData->totalLen) { +#if 0 /* fix no ping */ + Ping (); +#endif + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_MAXTEXT), + (LPARAM) hWnd); + return 0; + } + else if ((pMLEditData->hardLimit >= 0) + && ((pLineData->dataEnd + inserting) + > pMLEditData->hardLimit)) { +#if 0 /* fix no ping */ + Ping (); +#endif + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_MAXTEXT), + (LPARAM) hWnd); + return 0; + } + if (inserting == -1) { + for (i = pMLEditData->editPos; i < pLineData->dataEnd-1; i++) + pLineData->buffer [i] = pLineData->buffer [i + 1]; + } + else if (inserting > 0) { + for (i = pLineData->dataEnd + inserting - 1; + i > pMLEditData->editPos + inserting - 1; + i--) + pLineData->buffer [i] + = pLineData->buffer [i - inserting]; + } + for (i = 0; i < chars; i++) + pLineData->buffer [pMLEditData->editPos + i] + = charBuffer [i]; + + pMLEditData->editPos += chars; + pMLEditData->caretPos += chars; + pLineData->dataEnd += inserting; + pLineData->buffer[pLineData->dataEnd] = '\0'; + if (pMLEditData->caretPos * GetSysCharWidth (hWnd) + > edtGetOutWidth (hWnd)) + { + if (edtIsACCharAtPosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->dispPos)) + scrollStep = 2; + else { + if (chars == 2) { + if (edtIsACCharAtPosition (pLineData->buffer, + pLineData->dataEnd, + pMLEditData->dispPos + 1)) + scrollStep = 3; + else + scrollStep = 2; + } + else + scrollStep = 1; + } + + pMLEditData->dispPos += scrollStep; + + pMLEditData->caretPos = + pMLEditData->editPos - pMLEditData->dispPos; + + } + SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin, + (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd) + + pMLEditData->topMargin); + InvalidateRect (hWnd, NULL,FALSE); + format = DT_NOPREFIX; + SendMessage (GetParent (hWnd), WM_COMMAND, + (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_CHANGE), + (LPARAM) hWnd); + } + return 0; + + case WM_GETTEXTLENGTH: + { + PLINEDATA temp; + int lineNO = (int)wParam; + pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); + temp = pMLEditData->head; + while(temp) + { + if (temp->lineNO == lineNO) + return temp->dataEnd; + temp = temp->next; + } + return -1; + } + case WM_GETTEXT: + { + PLINEDATA temp; + int len,total = 0,lineNO; + char * buffer = (char*)lParam; + pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); + len = (int)wParam; + lineNO = (int)wParam; + temp = pMLEditData->head; + while (temp && total + temp->dataEnd < len) + { + memcpy(buffer+total,temp->buffer,temp->dataEnd); + total += temp->dataEnd; + temp = temp->next; + } + + } + return 0; +/* can i add it to message define ? */ +#if 0 + case WM_GETLINETEXT: + { + PLINEDATA temp; + char* buffer = (char*)lParam; + int lineNO,len; + + pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); + lineNO = (int)wParam; + temp = GetLineData(pMLEditData,lineNO); + if(temp) + { + len = min ((int)wParam, temp->dataEnd); + memcpy (buffer, temp->buffer,len); + buffer [len] = '\0'; + return 0; + } + return -1; + } + break; + case WM_SETTEXT: + { + MLEditInitBuffer(pMLEditData,(char *)lParam); + } + return 0; +#endif +/* can i add it to message defined? */ +#if 0 + case WM_SETLINETEXT: + { + int len,lineNO; + PLINEDATA temp; + + if (dwStyle & ES_READONLY) + return 0; + + pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); + + len = strlen ((char*)lParam); + lineNO = (int)wParam; + temp = pMLEditData->head; + len = min (len, pMLEditData->totalLen); + + if (pMLEditData->hardLimit >= 0) + len = min (len, pMLEditData->hardLimit); + while (temp) + { + if(temp->lineNO == lineNO) + { + temp->dataEnd = len; + memcpy (temp->buffer, (char*)lParam, len); + } + temp = temp->next; + } + pMLEditData->editPos = 0; + pMLEditData->caretPos = 0; + pMLEditData->dispPos = 0; + InvalidateRect (hWnd, NULL, FALSE); + } + return 0; +#endif + case WM_LBUTTONDBLCLK: + break; + + case WM_LBUTTONDOWN: + { + int newOff,lineNO; + PLINEDATA temp; + BOOL bScroll = FALSE; + + pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); + lineNO = edtGetLineNO (hWnd,pMLEditData, HIWORD (lParam)); + if ( lineNO < 0 ) + return 0; + lineNO += pMLEditData->StartlineDisp; + if (lineNO <= pMLEditData->EndlineDisp && lineNO <= pMLEditData->lines-1 ) + { + temp = GetLineData(pMLEditData,lineNO); + newOff = edtGetOffset (hWnd,pMLEditData,temp, LOWORD (lParam)); + if(!edtIsACCharFromBegin(temp->buffer,temp->dataEnd,pMLEditData->dispPos)) + { + bScroll = TRUE; + pMLEditData->dispPos--; + newOff = edtGetOffset (hWnd,pMLEditData,temp, LOWORD(lParam)+GetSysCharWidth(hWnd)/2); + } + if (newOff != pMLEditData->caretPos || lineNO != pMLEditData->editLine) { + pMLEditData->editLine = temp->lineNO; + pMLEditData->editPos = newOff +pMLEditData->dispPos; + pMLEditData->caretPos = newOff; + SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) + + pMLEditData->leftMargin, + (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd) + + pMLEditData->topMargin); + } + if(bScroll) + InvalidateRect(hWnd,NULL,FALSE); + } + } + break; + + case WM_LBUTTONUP: + break; + + case WM_MOUSEMOVE: + break; + + case WM_GETDLGCODE: + return DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS; + + case EM_SETREADONLY: + if (wParam) + IncludeWindowStyle(hWnd,ES_READONLY); + else + ExcludeWindowStyle(hWnd,ES_READONLY); + return 0; + + case EM_SETPASSWORDCHAR: + pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); + + if (pMLEditData->passwdChar != (int)wParam) { + if (dwStyle & ES_PASSWORD) { + pMLEditData->passwdChar = (int)wParam; + InvalidateRect (hWnd, NULL, TRUE); + } + } + return 0; + + case EM_GETPASSWORDCHAR: + { + int* passwdchar; + + pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); + passwdchar = (int*) lParam; + + *passwdchar = pMLEditData->passwdChar; + } + return 0; + + case EM_LIMITTEXT: + { + int newLimit = (int)wParam; + + if (newLimit >= 0) { + pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); + if (pMLEditData->totalLen < newLimit) + pMLEditData->hardLimit = -1; + else + pMLEditData->hardLimit = newLimit; + } + } + return 0; + + default: + return DefWindowProc (hWnd, message, wParam, lParam); + break; + } + + return 0; /* !DefaultControlProc (hWnd, message, wParam, lParam); */ +} + diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/mwuser.c b/packages/services/gfx/mw/current/src/mwin/winlib/mwuser.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/mwuser.c @@ -0,0 +1,7 @@ +#include "windows.h" + +int +MwUserInit(int ac,char **av) +{ + return 0; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/progbar.c b/packages/services/gfx/mw/current/src/mwin/winlib/progbar.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/progbar.c @@ -0,0 +1,363 @@ +/* + * Copyright (C) 1999, 2000, Wei Yongming. + * Portions Copyright (c) 2000 Greg Haerr + * + * Progress bar for Microwindows win32 api. + */ + +/* +** This library is free software; you can redistribute it and/or +** modify it under the terms of the GNU Library General Public +** License as published by the Free Software Foundation; either +** version 2 of the License, or (at your option) any later version. +** +** This library 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 +** Library General Public License for more details. +** +** You should have received a copy of the GNU Library General Public +** License along with this library; if not, write to the Free +** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +** MA 02111-1307, USA +*/ + +/* +** Alternatively, the contents of this file may be used under the terms +** of the Mozilla Public License (the "MPL License") in which case the +** provisions of the MPL License are applicable instead of those above. +*/ + +/* Copyright (C) 1999, 2000, Wei Yongming. +** +** Note: +** Originally by Zhao Jianghua. +** +** Create date: 1999/8/29 +** +** Modify records: +** +** Who When Where For What Status +**----------------------------------------------------------------------------- +** WEI Yongming 1999/10/27 Tsinghua unsigned int Finished +** WEI Yongming 1999/10/27 Tsinghua FPException fixing Finished +** WEI Yongming 2000/02/24 Tsinghua Add MPL License Finished +** Kevin Tseng 2000/05/24 gv port to microwin ported +** Greg Haerr 2000/06/15 Utah removed floats Finished +*/ + +#include +#include +#include +#define MWINCLUDECOLORS +#include "windows.h" /* windef.h, winuser.h */ +#include "wintools.h" /* Draw3dBox */ +#include "device.h" /* GdGetTextSize */ + +#define TEST 1 /* =1 for testing*/ + +#define WIDTH_PBAR_BORDER 2 + +typedef struct _PROGRESSDATA { + unsigned int nMin; + unsigned int nMax; + unsigned int nPos; + unsigned int nStepInc; +} PROGRESSDATA, *PPROGRESSDATA; + +static LRESULT CALLBACK +ProgressBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + +int WINAPI MwRegisterProgressBarControl(HINSTANCE hInstance) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)ProgressBarCtrlProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = NULL; + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground= GetStockObject(LTGRAY_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName= "PROGBAR"; + + return RegisterClass(&wc); +} + +static void +FillBox(HDC hdc, int x, int y, int w, int h, COLORREF cr) +{ + RECT rc; + + if (w <= 0) + return; + SetRect(&rc, x, y, x+w, y+h); + FastFillRect(hdc, &rc, cr); +} + +static int +GetSysCharWidth(HDC hdc) +{ + int cw, ch, cb; + + GdGetTextSize(hdc->font->pfont,"X",1, &cw,&ch,&cb,MWTF_ASCII); + return cw; +} + +static int +GetSysCharHeight(HDC hdc) +{ + int cw, ch, cb; + + GdGetTextSize(hdc->font->pfont,"X",1, &cw,&ch,&cb,MWTF_ASCII); + return ch; +} + +void pbarOnDraw (HWND hwnd, HDC hdc, PROGRESSDATA* pData, BOOL fVertical, + BOOL fErase) +{ + int x, y, w, h; + unsigned int nAllPart; + unsigned int nNowPart; + int whOne, nRem; + int ix, iy; + int i; + int step; + COLORREF cr; + RECT rcClient; + char szText[8]; + + if (!hdc || (pData->nMax == pData->nMin)) + return; + + if ((pData->nMax - pData->nMin) > 5) + step = 5; + else + step = 1; + + GetClientRect (hwnd, &rcClient); + SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); + + x = rcClient.left + WIDTH_PBAR_BORDER; + y = rcClient.top + WIDTH_PBAR_BORDER; + w = (rcClient.right - rcClient.left) - (WIDTH_PBAR_BORDER << 1); + h = (rcClient.bottom - rcClient.top) - (WIDTH_PBAR_BORDER << 1); + + nAllPart = (pData->nMax - pData->nMin) / step; + nNowPart = (pData->nPos - pData->nMin) / step; + if (fVertical) { + whOne = h / nAllPart; + nRem = h % nAllPart; + } else { + whOne = w / nAllPart; + nRem = w % nAllPart; + } + + if (fErase) + FillBox (hdc, x, y, w, h, GetSysColor(COLOR_BTNSHADOW)); + + if(whOne >= 4) { + if (fVertical) { + for (i = 0, iy = y + h - 1; i < nNowPart; ++i) { +#if 0 + if ((iy - whOne) < y) + whOne = iy - y; +#endif + + FillBox (hdc, x, iy - whOne, w, whOne - 1, BLUE); + + iy -= whOne + 1; +#if 0 + if(nRem > 0) { + iy --; + nRem --; + } +#endif + } + } + else { + for (i = 0, ix = x + 1; i < nNowPart; ++i) { +#if 0 + if ((ix + whOne) > (x + w)) + whOne = x + w - ix; +#endif + FillBox (hdc, ix, y, whOne - 1, h, BLUE); + ix += whOne + 1; +#if 0 + if(nRem > 0) { + ix ++; + nRem --; + } +#endif + } + } + } + else { + /* no vertical support */ + int d = nNowPart*100/nAllPart; + int maxw = GetSysCharWidth (hdc) << 2; + int charh = GetSysCharHeight (hdc); + + if (d > 50) + cr = BLUE; + else + cr = GetSysColor(COLOR_BTNSHADOW); + FillBox (hdc, x + ((w - maxw)>>1), y + ((h - charh) > 1), maxw, + charh - 1, cr); + FillBox (hdc, x, y, (int)((long)w*d/100L), h, BLUE); + SetTextColor (hdc, WHITE); + SetBkMode (hdc, TRANSPARENT); + sprintf (szText, "%d%%", d); + TextOut (hdc, x + ((w - GetSysCharWidth (hdc) * strlen (szText) )>>1), + y + ((h - GetSysCharHeight(hdc) )>>1), + szText, strlen(szText)); + } +} + +static void pbarNormalizeParams (const HWND pCtrl, + PROGRESSDATA* pData, BOOL fNotify) +{ + if (pData->nPos > pData->nMax) { + if (fNotify) + SendMessage (GetParent ((HWND)pCtrl), WM_COMMAND, + (WPARAM)MAKELONG (pCtrl->id, PBN_REACHMAX), (LPARAM)pCtrl); + pData->nPos = pData->nMax; + } + + if (pData->nPos < pData->nMin) { + if (fNotify) + SendMessage (GetParent ((HWND)pCtrl), WM_COMMAND, + (WPARAM)MAKELONG (pCtrl->id, PBN_REACHMIN), (LPARAM)pCtrl); + pData->nPos = pData->nMin; + } +} + +static LRESULT CALLBACK +ProgressBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + HDC hdc; + HWND pCtrl; + PROGRESSDATA* pData; + BOOL fErase; + RECT rc; + PAINTSTRUCT ps; + int pos; + + pCtrl = hwnd; + + switch (message) + { + case WM_CREATE: + if (!(pData = malloc (sizeof (PROGRESSDATA)))) { + fprintf(stderr, "Create progress bar control failure!\n"); + return -1; + } + +#if TEST + pData->nMax = 1000; + pData->nMin = 0; + pData->nPos = 500; + pData->nStepInc = 100; +#else + pData->nMax = 100; + pData->nMin = 0; + pData->nPos = 0; + pData->nStepInc = 10; +#endif + + pCtrl->userdata = (DWORD)pData; + break; + + case WM_DESTROY: + free ((void *)(pCtrl->userdata)); + break; + + case WM_GETDLGCODE: + return DLGC_STATIC; + + case WM_NCPAINT: + if(GetWindowLong(hwnd, GWL_STYLE) & WS_BORDER) { + GetWindowRect(hwnd, &rc); + hdc = GetWindowDC(hwnd); + Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, + rc.bottom-rc.top, GetSysColor(COLOR_BTNSHADOW), + GetSysColor(COLOR_BTNHIGHLIGHT)); + } + break; + + case WM_PAINT: + hdc = BeginPaint (hwnd,&ps); + pbarOnDraw (hwnd, hdc, (PROGRESSDATA *)pCtrl->userdata, + hwnd->style & PBS_VERTICAL, TRUE); + EndPaint (hwnd, &ps); + break; + + case PBM_SETRANGE: + pData = (PROGRESSDATA *)pCtrl->userdata; + pData->nMin = min (wParam, lParam); + pData->nMax = max (wParam, lParam); + if (pData->nPos > pData->nMax) + pData->nPos = pData->nMax; + if (pData->nPos < pData->nMin) + pData->nPos = pData->nMin; + break; + + case PBM_SETSTEP: + pData = (PROGRESSDATA *)pCtrl->userdata; + pData->nStepInc = wParam; + break; + + case PBM_SETPOS: + pData = (PROGRESSDATA *)pCtrl->userdata; + + if (pData->nPos == wParam) + break; + + fErase = (wParam < pData->nPos); + pData->nPos = wParam; + pbarNormalizeParams (pCtrl, pData, hwnd->style & PBS_NOTIFY); + InvalidateRect(hwnd, NULL, fErase); + break; + + case PBM_DELTAPOS: + pData = (PROGRESSDATA *)pCtrl->userdata; + + if (wParam == 0) + break; + + fErase = (wParam < 0); + pData->nPos += wParam; + pbarNormalizeParams (pCtrl, pData, hwnd->style & PBS_NOTIFY); + InvalidateRect(hwnd, NULL, fErase); + break; + + case PBM_STEPIT: + pData = (PROGRESSDATA *)pCtrl->userdata; + + if (pData->nStepInc == 0) + break; + + fErase = (pData->nStepInc < 0); + pData->nPos += pData->nStepInc; + pbarNormalizeParams (pCtrl, pData, hwnd->style & PBS_NOTIFY); + InvalidateRect(hwnd, NULL, fErase); + break; + +#if TEST + case WM_LBUTTONDOWN: + case WM_LBUTTONDBLCLK: + pData = (PROGRESSDATA *)pCtrl->userdata; + pos = pData->nPos; + pos += pData->nStepInc; + if (pos > pData->nMax) + pos = pData->nMin; + SendMessage(hwnd, PBM_SETPOS, pos, 0L); + break; +#endif + default: + return DefWindowProc (hwnd, message, wParam, lParam); + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/ptinsid.c b/packages/services/gfx/mw/current/src/mwin/winlib/ptinsid.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/ptinsid.c @@ -0,0 +1,18 @@ +#include "windows.h" +#include "wintools.h" + +BOOL WINAPI +PtInsideWindow(HWND hwnd,UINT x,UINT y) +{ + /* Determine whether or not the position ( x, y) is contained */ + /* within the control's client rectangle. */ + + RECT clientRect; + POINT buttonPoint; + + buttonPoint.x = x; + buttonPoint.y = y; + + GetClientRect( hwnd, &clientRect); + return PtInRect( &clientRect, buttonPoint); +} diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/scrlbar.c b/packages/services/gfx/mw/current/src/mwin/winlib/scrlbar.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/scrlbar.c @@ -0,0 +1,1140 @@ +/* + * Copyright (c) 2000 Greg Haerr + * Portions Copyright (c) 1999, 2000, Wei Yongming. + * jmt: scrollbar thumb ported + * + * Microwindows win32 Scrollbars control + */ +#include +#include +#include +#define MWINCLUDECOLORS /* jmt: for color macros */ +#include "windows.h" +#include "wintern.h" +#include "wintools.h" + +/* scrollbar status/positions*/ +#define SBS_UNKNOWN 0x0000 +#define SBS_LEFTARROW 0x0001 +#define SBS_RIGHTARROW 0x0002 +#define SBS_LEFTSPACE 0x0004 +#define SBS_RIGHTSPACE 0x0008 +#define SBS_HORZTHUMB 0x0010 +#define SBS_UPARROW 0x0020 +#define SBS_DOWNARROW 0x0040 +#define SBS_UPSPACE 0x0080 +#define SBS_DOWNSPACE 0x0100 +#define SBS_VERTTHUMB 0x0200 +#define SBS_MASK 0x03ff +#define SBS_DISABLED 0x4000 +#define SBS_HIDE 0x8000 + + +#define MWM_DEFBARLEN 18 +#define MWM_MINBARLEN 8 + +static LRESULT CALLBACK +ScrollbarControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + + +int WINAPI MwRegisterScrollbarControl(HINSTANCE hInstance) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)ScrollbarControlProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = NULL; + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground= GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName= "SCROLLBAR"; + + return RegisterClass(&wc); +} + +static DWORD GetWindowStyle (HWND hwnd) +{ + return hwnd->style; +} + +static int +wndGetBorder(HWND hwnd) +{ + if (hwnd->style & WS_BORDER) { + if ((hwnd->style & WS_CAPTION) == WS_CAPTION) + return mwSYSMETRICS_CXFRAME; + return mwSYSMETRICS_CXBORDER; + } + return 0; +} + +static BOOL +wndGetVScrollBarRect (HWND hwnd, RECT* rcVBar) +{ + int cx,cy; RECT rc; + MWSCROLLBARINFO* pData; + + pData = (MWSCROLLBARINFO *)hwnd->userdata; + rc = hwnd->winrect; + cx=rc.right-rc.left; + cy=rc.bottom-rc.top; + + rcVBar->left = hwnd->winrect.right - cx + - wndGetBorder (hwnd); + rcVBar->right = hwnd->winrect.right - wndGetBorder (hwnd); + rcVBar->top = hwnd->winrect.top; + rcVBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd); + + return TRUE; +} + +static BOOL +wndGetHScrollBarRect (HWND hwnd, RECT* rcHBar) +{ + int cx,cy; RECT rc; + MWSCROLLBARINFO* pData; + + pData = (MWSCROLLBARINFO *)hwnd->userdata; + rc = hwnd->winrect; + cx=rc.right-rc.left; + cy=rc.bottom-rc.top; + + rcHBar->top = hwnd->winrect.bottom - cy + - wndGetBorder (hwnd); + rcHBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd); + rcHBar->left = hwnd->winrect.left; + rcHBar->right = hwnd->winrect.right - wndGetBorder (hwnd); + + return TRUE; +} + +void +MwPaintScrollbars(HWND hwnd, HDC hdc, DWORD style) +{ + BOOL vertbar = (style==SBS_VERT); + BOOL horzbar = (style==SBS_HORZ); + BOOL fGotDC = FALSE; + RECT rc,rc2; + + POINT p3[3]; + int shrink=2; + + int start = 0; + RECT rcHBar, rcVBar; + + int cx,cy; + MWSCROLLBARINFO* pData; + + pData = (MWSCROLLBARINFO *)hwnd->userdata; + rc = hwnd->winrect; + cx=rc.right-rc.left; + cy=rc.bottom-rc.top; + + if (!hdc && (horzbar || vertbar)) { + hdc = GetWindowDC(hwnd); + fGotDC = TRUE; + } + + if (vertbar) { + +#if 1 + /* bkgnd */ + rc2.left=rc.left; rc2.right=rc2.left+ cx; + rc2.top=rc.top; + rc2.bottom=rc2.top+ cx; + FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1)); + rc2.top=rc.bottom- cx; + rc2.bottom=rc2.top+ cx; + FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1)); +#endif + /* up */ + Draw3dUpDownState(hdc, rc.left, rc.top, + cx, cx, + pData->status & SBS_UPARROW); + /* down */ + Draw3dUpDownState(hdc, rc.left,rc.bottom-cx, + cx, cx, + pData->status & SBS_DOWNARROW); +/* jmt: draw arrows */ + SelectObject(hdc,GetStockObject(BLACK_BRUSH)); + /* up */ + p3[0].x= rc.left + (cx/2) - 1; + p3[0].y= rc.top + 2 + shrink; + p3[1].x= rc.left + 2 + shrink - 1; + p3[1].y= rc.top + (cx-4) - shrink; + p3[2].x= rc.left + (cx-4) - shrink; + p3[2].y= rc.top + (cx-4) - shrink; + Polygon(hdc,p3,3); + /* down */ + p3[0].x= rc.left + (cx/2) - 1; + p3[0].y= rc.bottom - 4 - shrink; + p3[1].x= rc.left + 2 + shrink - 1; + p3[1].y= rc.bottom-cx + 2 + shrink; + p3[2].x= rc.left + (cx-4) - shrink; + p3[2].y= rc.bottom-cx + 2 + shrink; + Polygon(hdc,p3,3); + + /* draw moving bar */ + + wndGetVScrollBarRect (hwnd, &rcVBar); + rcVBar.left -- ; + /*rcVBar.right -- ;*/ + + start = rcVBar.top + cx + pData->barStart; + + if (start + pData->barLen > rcVBar.bottom) + start = rcVBar.bottom - pData->barLen; + + if (pData->barLen == 0) + pData->barLen=rc.bottom-rc.top-(cx*2); + + /* bkgnd */ + rc2.left=rc.left; rc2.right=rc.right/*-1*/; + rc2.top=rc.top+cx; + rc2.bottom=start; + if (rc2.bottom>rc2.top) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + rc2.top=start+pData->barLen; + rc2.bottom=rc.bottom-cx; + if (rc2.bottom>rc2.top) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + Draw3dUpFrame (hdc, rcVBar.left, start, rcVBar.right, + start + pData->barLen); + /*printf("barv:(l,t,r,b):(%d,%d,%d,%d)\n", + rcVBar.left, start, rcVBar.right, + start + pData->barLen);*/ + + } + if (horzbar) { +#if 1 + /* bkgnd */ + rc2.top=rc.top; rc2.bottom=rc2.top+ cy; + rc2.left=rc.left; + rc2.right=rc2.left+ cy; + FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1)); + rc2.left=rc.right- cy; + rc2.right=rc2.left+ cy; + FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1)); +#endif + /* left */ + Draw3dUpDownState(hdc, rc.left, rc.top, + cy, cy, + pData->status & SBS_LEFTARROW); + /* right */ + Draw3dUpDownState(hdc, rc.right-cy, rc.top, + cy, cy, + pData->status & SBS_RIGHTARROW); +/* jmt: draw arrows */ + SelectObject(hdc,GetStockObject(BLACK_BRUSH)); + /* left */ + p3[0].x= rc.left + 2 + shrink; + p3[0].y= rc.top + (cy/2) ; + p3[1].x= rc.left + (cy-4) - shrink ; + p3[1].y= rc.top + 2 + shrink; + p3[2].x= rc.left + (cy-4) - shrink; + p3[2].y= rc.bottom - 4 - shrink + 1; + Polygon(hdc,p3,3); + /* right */ + p3[0].x= rc.right - 4 - shrink; + p3[0].y= rc.top + (cy/2) ; + p3[1].x= rc.right-cy + 2 + shrink ; + p3[1].y= rc.top + 2 + shrink; + p3[2].x= rc.right-cy + 2 + shrink; + p3[2].y= rc.bottom - 4 - shrink + 1; + Polygon(hdc,p3,3); + + /* draw moving bar. */ + + wndGetHScrollBarRect (hwnd, &rcHBar); + rcHBar.top -- ; + /*rcHBar.bottom -- ;*/ + + start = rcHBar.left + cy + pData->barStart; + + if (start + pData->barLen > rcHBar.right) + start = rcHBar.right - pData->barLen; + + if (pData->barLen == 0) + pData->barLen=rc.right-rc.left-(cy*2); + + /* bkgnd */ + rc2.top=rc.top; rc2.bottom=rc.bottom/*-1*/; + rc2.left=rc.left+cy; + rc2.right=start; + if (rc2.right>rc2.left) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + rc2.left=start+pData->barLen; + rc2.right=rc.right-cy; + if (rc2.right>rc2.left) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + Draw3dUpFrame (hdc, start, rcHBar.top, start + pData->barLen, + rcHBar.bottom); + /*printf("barh:(l,t,r,b):(%d,%d,%d,%d)\n", + start, rcHBar.top, start + pData->barLen, + rcHBar.bottom);*/ + } + + if (fGotDC) + ReleaseDC(hwnd, hdc); +} + +/* handle a non-client message for a scrollbar*/ +void +MwHandleMessageScrollbar(HWND hwnd, WPARAM hitcode, LPARAM lParam, UINT msg, DWORD style) +{ + int pos = SBS_UNKNOWN; + BOOL vertbar = (style==SBS_VERT); + BOOL horzbar = (style==SBS_HORZ); + int * pStat; + POINT pt; + RECT rc; + + static BOOL bDraw; + + static int downPos = SBS_UNKNOWN; + static int sbCode; + int newThumbPos; + + int itemMoveable,itemCount,itemVisible,moveRange; /* jmt:2k0819 */ + int moveTop,moveBottom,moveLeft,moveRight; /* jmt:2k0819 */ + + int cx,cy; + MWSCROLLBARINFO* pData; + + pData = (MWSCROLLBARINFO *)hwnd->userdata; + rc = hwnd->winrect; + cx=rc.right-rc.left; + cy=rc.bottom-rc.top; + + POINTSTOPOINT(pt, lParam); + for (;;) { /* use for() to allow break statement*/ + if (vertbar) + { + pStat = &pData->status; + rc = hwnd->winrect; + rc.bottom = rc.top + cx; + if (PtInRect(&rc, pt)) + { + pos = SBS_UPARROW; + break; + } + rc.bottom = hwnd->winrect.bottom; + rc.top = rc.bottom - cx; + if (PtInRect(&rc, pt)) + { + pos = SBS_DOWNARROW; + break; + } + pos = SBS_VERTTHUMB; + } else if (horzbar) + { + pStat = &pData->status; + rc = hwnd->winrect; + rc.right = rc.left + cy; + if (PtInRect(&rc, pt)) { + pos = SBS_LEFTARROW; + break; + } + rc.right = hwnd->winrect.right; + rc.left = rc.right - cy; + if (PtInRect(&rc, pt)) { + pos = SBS_RIGHTARROW; + break; + } + pos = SBS_HORZTHUMB; + } else + return; + break; + } + + if (pos == SBS_UNKNOWN) + return; + + *pStat &= ~SBS_MASK; /* remove stray mouse states*/ + + if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK) + *pStat |= pos; + else *pStat &= ~pos; + + if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK) + bDraw=TRUE; + + if (bDraw) + MwPaintScrollbars(hwnd, NULL,style); + + if (pos == SBS_UPARROW || pos == SBS_LEFTARROW) /* jmt:2k0820 */ + { + if (pData->curPos != pData->minPos) + sbCode = SB_LINEUP; + } + else if (pos == SBS_DOWNARROW || pos == SBS_RIGHTARROW) /* jmt:2k0820 */ + { + if (pData->curPos != pData->maxPos) + sbCode = SB_LINEDOWN; + } + else if (pos == SBS_VERTTHUMB || pos == SBS_HORZTHUMB) + { + sbCode = SB_THUMBTRACK; + } + + switch(msg) + { + case WM_NCLBUTTONDOWN: + case WM_NCLBUTTONDBLCLK: + downPos = pos; + break; + + case WM_NCMOUSEMOVE: + if (vertbar) + { + if (sbCode == SB_THUMBTRACK && downPos == SBS_VERTTHUMB) + { + /* jmt(2k0819): new algorithm for SB_THUMBTRACK */ + + rc = hwnd->winrect; + moveTop = rc.top + cx; + moveBottom = hwnd->winrect.bottom - cx; + moveRange = moveBottom - moveTop; + + itemCount = pData->maxPos - pData->minPos + 1; + itemVisible = pData->pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveTop,itemMoveable,moveRange,newThumbPos); + + if ( newThumbPos >= pData->minPos && + newThumbPos <= pData->maxPos) + { + SendMessage (hwnd, + WM_VSCROLL, SB_THUMBTRACK, newThumbPos); + + SendMessage (GetParent(hwnd), + WM_VSCROLL, SB_THUMBTRACK, newThumbPos); + } + break; + } + } + if (horzbar) + { + if (sbCode == SB_THUMBTRACK && downPos == SBS_HORZTHUMB) + { + /* jmt(2k0819): new algorithm for SB_THUMBTRACK */ + + rc = hwnd->winrect; + moveLeft = rc.left + cy; + moveRight = hwnd->winrect.right - cy; + moveRange = moveRight - moveLeft; + + itemCount = pData->maxPos - pData->minPos + 1; + itemVisible = pData->pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveLeft,itemMoveable,moveRange,newThumbPos); + + if ( newThumbPos >= pData->minPos && + newThumbPos <= pData->maxPos) + { + SendMessage (hwnd, + WM_HSCROLL, SB_THUMBTRACK, newThumbPos); + + SendMessage (GetParent(hwnd), + WM_HSCROLL, SB_THUMBTRACK, newThumbPos); + } + break; + } + } + break; + + case WM_NCLBUTTONUP: + bDraw=FALSE; + downPos = SBS_UNKNOWN; + + if (sbCode==SB_THUMBTRACK) + { + if (vertbar) + { + /* jmt(2k0819): new algorithm for SB_THUMBTRACK */ + + rc = hwnd->winrect; + moveTop = rc.top + cx; + moveBottom = hwnd->winrect.bottom - cx; + moveRange = moveBottom - moveTop; + + itemCount = pData->maxPos - pData->minPos + 1; + itemVisible = pData->pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveTop,itemMoveable,moveRange,newThumbPos); + + if ( newThumbPos >= pData->minPos && + newThumbPos <= pData->maxPos) + { + SendMessage (hwnd, + WM_VSCROLL, SB_THUMBTRACK, newThumbPos); + + SendMessage (GetParent(hwnd), + WM_VSCROLL, SB_THUMBTRACK, newThumbPos); + } + break; /* case */ + } + if (horzbar) + { + /* jmt(2k0819): new algorithm for SB_THUMBTRACK */ + + rc = hwnd->winrect; + moveLeft = rc.left + cy; + moveRight = hwnd->winrect.right - cy; + moveRange = moveRight - moveLeft; + + itemCount = pData->maxPos - pData->minPos + 1; + itemVisible = pData->pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveLeft,itemMoveable,moveRange,newThumbPos); + + if ( newThumbPos >= pData->minPos && + newThumbPos <= pData->maxPos) + { + SendMessage (hwnd, + WM_HSCROLL, SB_THUMBTRACK, newThumbPos); + + SendMessage (GetParent(hwnd), + WM_HSCROLL, SB_THUMBTRACK, newThumbPos); + } + break; /* case */ + } + } + else + { + if (vertbar) + { + SendMessage (hwnd, WM_VSCROLL, sbCode, 0); + SendMessage (GetParent(hwnd), WM_VSCROLL, sbCode, 0); + } + if (horzbar) + { + SendMessage (hwnd, WM_HSCROLL, sbCode, 0); + SendMessage (GetParent(hwnd), WM_HSCROLL, sbCode, 0); + } + } + break; + } +} + + +static BOOL +PtInRect2(const RECT *lprc, int x, int y) +{ + POINT p; + + p.x = x; + p.y = y; + return PtInRect(lprc, p); +} + +static void +wndScrollBarPos (HWND hwnd, BOOL bIsHBar, RECT* rcBar) /* jmt: 2k0820 */ +{ + UINT moveRange; + PMWSCROLLBARINFO pSBar; + int cx,cy; + RECT rc; + + rc = hwnd->winrect; + cx=rc.right-rc.left; + cy=rc.bottom-rc.top; + pSBar = (MWSCROLLBARINFO *)hwnd->userdata; + + if (pSBar->minPos == pSBar->maxPos) { + pSBar->status |= SBS_HIDE; + return; + } + + if (bIsHBar) + moveRange = (rcBar->right - rcBar->left) - (cy << 1); + else + moveRange = (rcBar->bottom - rcBar->top) - (cx << 1); + + + if (pSBar->pageStep == 0) + { + pSBar->barLen = MWM_DEFBARLEN; + + if (pSBar->barLen > moveRange) + pSBar->barLen = MWM_MINBARLEN; + } + else + { + pSBar->barLen = moveRange * pSBar->pageStep / + (pSBar->maxPos - pSBar->minPos + 1); + if (pSBar->barLen < MWM_MINBARLEN) + pSBar->barLen = MWM_MINBARLEN; + } + + pSBar->barStart = moveRange * (pSBar->curPos - pSBar->minPos) / + (pSBar->maxPos - pSBar->minPos + 1); + + + if (pSBar->barStart + pSBar->barLen > moveRange) + pSBar->barStart = moveRange - pSBar->barLen; + + + if (pSBar->barStart < 0) + pSBar->barStart = 0; +} + +static PMWSCROLLBARINFO wndGetScrollBar (HWND pWin) /* jmt: 2k0820 */ +{ + MWSCROLLBARINFO* pData; + + pData = (MWSCROLLBARINFO *)pWin->userdata; + + if (!strcmp(pWin->pClass->lpszClassName,"SCROLLBAR")) + return pData; + else + return NULL; +} + +BOOL EnableScrollBarEx (HWND hWnd, int iSBar, BOOL bEnable) /* jmt: iSBar not used */ +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + BOOL bPrevState; + RECT rcBar; + + DWORD dwStyle; /* jmt:2k0820 */ + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin)) ) + return FALSE; + + bPrevState = !(pSBar->status & SBS_DISABLED); + + if (bEnable && !bPrevState) + pSBar->status &= ~SBS_DISABLED; + else if (!bEnable && bPrevState) + pSBar->status |= SBS_DISABLED; + else + return FALSE; + + dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK); /* jmt: 2k0820 */ + + if (dwStyle == SBS_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintScrollbars(hWnd,NULL,dwStyle); /* a must */ +#endif + + return TRUE; +} + +BOOL GetScrollPosEx (HWND hWnd, int iSBar, int* pPos) /* jmt: iSBar not used */ +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin)) ) + return FALSE; + + *pPos = pSBar->curPos; + return TRUE; +} + +BOOL GetScrollRangeEx (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos) /* jmt: iSBar not used */ +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin)) ) + return FALSE; + + *pMinPos = pSBar->minPos; + *pMaxPos = pSBar->maxPos; + return TRUE; +} + +BOOL SetScrollPosEx (HWND hWnd, int iSBar, int iNewPos) /* jmt: iSBar not used */ +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + RECT rcBar; + + DWORD dwStyle; /* jmt:2k0820 */ + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin)) ) + return FALSE; + + if (iNewPos < pSBar->minPos) + pSBar->curPos = pSBar->minPos; + else + pSBar->curPos = iNewPos; + + { + int max = pSBar->maxPos; + max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0; + + if (pSBar->curPos > max) + pSBar->curPos = max; + } + + dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK); /* jmt: 2k0820 */ + + if (dwStyle == SBS_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } + + wndScrollBarPos (pWin, dwStyle == SBS_HORZ, &rcBar); + +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintScrollbars(hWnd,NULL,dwStyle); /* a must */ +#endif + return TRUE; +} + +BOOL SetScrollRangeEx (HWND hWnd, int iSBar, int iMinPos, int iMaxPos) /* jmt: iSBar not used */ +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + RECT rcBar; + + DWORD dwStyle; /* jmt:2k0820 */ + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin)) ) + return FALSE; + + pSBar->minPos = (iMinPos < iMaxPos)?iMinPos:iMaxPos; + pSBar->maxPos = (iMinPos > iMaxPos)?iMinPos:iMaxPos; + + /* validate parameters. */ + if (pSBar->curPos < pSBar->minPos) + pSBar->curPos = pSBar->minPos; + + if (pSBar->pageStep <= 0) + pSBar->pageStep = 0; + else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1)) + pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1; + + { + int max = pSBar->maxPos; + max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0; + + if (pSBar->curPos > max) + pSBar->curPos = max; + } + + dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK); /* jmt: 2k0820 */ + + if (dwStyle == SBS_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } + wndScrollBarPos (pWin, dwStyle == SBS_HORZ, &rcBar); + +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintScrollbars(hWnd,NULL,dwStyle); /* a must */ +#endif + + return TRUE; +} + +BOOL SetScrollInfoEx (HWND hWnd, int iSBar, + LPCSCROLLINFO lpsi, BOOL fRedraw) /* jmt: iSBar not used */ +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + RECT rcBar; + + DWORD dwStyle; /* jmt:2k0820 */ + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin)) ) + return FALSE; + + if( lpsi->fMask & SIF_RANGE ) + { + pSBar->minPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMin:lpsi->nMax; + pSBar->maxPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMax:lpsi->nMin; + } + + if( lpsi->fMask & SIF_POS ) + pSBar->curPos = lpsi->nPos; + + if( lpsi->fMask & SIF_PAGE ) + pSBar->pageStep = lpsi->nPage; + + /* validate parameters. */ + if (pSBar->curPos < pSBar->minPos) + pSBar->curPos = pSBar->minPos; + + if (pSBar->pageStep <= 0) + pSBar->pageStep = 0; + else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1)) + pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1; + + { + int max = pSBar->maxPos; + max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0; + + if (pSBar->curPos > max) + pSBar->curPos = max; + } + + dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK); /* jmt: 2k0820 */ + + if(fRedraw) + { + if (dwStyle == SBS_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } + wndScrollBarPos (pWin, dwStyle == SBS_HORZ, &rcBar); + +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintScrollbars(hWnd,NULL,dwStyle); /* a must */ +#endif + } + + return TRUE; +} + +BOOL GetScrollInfoEx(HWND hWnd, int iSBar, LPSCROLLINFO lpsi) /* jmt: iSBar not used */ +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin)) ) + return FALSE; + + if( lpsi->fMask & SIF_RANGE ) + { + lpsi->nMin = pSBar->minPos; + lpsi->nMax = pSBar->maxPos; + } + + if( lpsi->fMask & SIF_POS ) + { + lpsi->nPos = pSBar->curPos; + } + + if( lpsi->fMask & SIF_PAGE ) + lpsi->nPage = pSBar->pageStep; + + return TRUE; +} + +BOOL ShowScrollBarEx (HWND hWnd, int iSBar, BOOL bShow) /* jmt: iSBar not used */ +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + BOOL bPrevState; + RECT rcBar; + + DWORD dwStyle; /* jmt:2k0820 */ + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin)) ) + return FALSE; + + bPrevState = !(pSBar->status & SBS_HIDE); + + if (bShow && !bPrevState) + pSBar->status &= ~SBS_HIDE; + else if (!bShow && bPrevState) + pSBar->status |= SBS_HIDE; + else + return FALSE; + +#if 0 /* fix: no WM_CHANGESIZE */ + SendMessage (hWnd, WM_CHANGESIZE, 0, 0); +#endif + + dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK); /* jmt: 2k0820 */ + + if (dwStyle == SBS_VERT) + wndGetVScrollBarRect (pWin, &rcBar); + else + wndGetHScrollBarRect (pWin, &rcBar); + + { + RECT rcWin, rcClient; + + memcpy (&rcWin, &pWin->winrect.left, sizeof (RECT)); + + rcClient.left = 0; + rcClient.top = 0; + rcClient.right = pWin->clirect.right - pWin->clirect.left; + rcClient.bottom = pWin->clirect.bottom - pWin->clirect.top; +#if 0 /* fix: no WM_SIZECHANGED */ + SendMessage (hWnd, WM_SIZECHANGED, + (WPARAM)&rcWin, (LPARAM)&rcClient); +#endif + } + + if (bShow) { + SendMessage (hWnd, WM_NCPAINT, 0, 0); + } + else { + rcBar.left -= pWin->clirect.left; + rcBar.top -= pWin->clirect.top; + rcBar.right -= pWin->clirect.left; + rcBar.bottom -= pWin->clirect.top; + SendMessage (hWnd, WM_NCPAINT, 0, 0); + InvalidateRect (hWnd, &rcBar, TRUE); + } + + return TRUE; +} + +static void sbSetScrollInfo (HWND hwnd, PMWSCROLLBARINFO pData, BOOL fRedraw) /* jmt:2k0820 */ +{ + SCROLLINFO si; + + int itemCount,itemVisibles; + + itemCount = pData->maxPos - pData->minPos + 1; + itemVisibles = pData->pageStep; + + if (itemVisibles >= itemCount) + { + SetScrollPosEx (hwnd, 0, 0); /* jmt: arg2 not used */ + EnableScrollBarEx (hwnd, 0, FALSE); /* jmt: arg2 not used */ + return; + } + + si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; + si.nMax = itemCount - 1; + si.nMin = 0; + + si.nPage = itemVisibles; /* jmt(2k0819): new algorithm for SB_THUMBTRACK */ + + si.nPos = pData->curPos; + + SetScrollInfoEx (hwnd, 0, &si, fRedraw); /* jmt: arg2 not used */ + EnableScrollBarEx (hwnd, 0, TRUE); /* jmt: arg2 not used */ +} + +static LRESULT CALLBACK +ScrollbarControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* jmt:2k0820 */ +{ + DWORD dwStyle; + MWSCROLLBARINFO* pData; + + int moveRange; + RECT rcBar; + + dwStyle = (GetWindowStyle (hwnd) & SBS_TYPEMASK); + switch (message) + { + case WM_CREATE: + if (!(pData = malloc (sizeof (MWSCROLLBARINFO)))) + { + fprintf(stderr, "Create scroll bar control failure!\n"); + return -1; + } + + pData->minPos=0; /* min value of scroll range.*/ + /* max value of scroll range.*/ + pData->maxPos=0; + if (dwStyle==SBS_VERT) + moveRange=((hwnd->winrect.bottom-hwnd->winrect.top) + -((hwnd->winrect.right-hwnd->winrect.left)<<1)); + else + moveRange=((hwnd->winrect.right-hwnd->winrect.left) + -((hwnd->winrect.bottom-hwnd->winrect.top)<<1)); + if (moveRange > MWM_MINBARLEN) + { + + + pData->maxPos=moveRange / MWM_MINBARLEN; + if( (moveRange % MWM_MINBARLEN) ) + pData->maxPos++; + } + printf("maxPos=%d\n",pData->maxPos); + + pData->curPos=0; /* current scroll pos.*/ + + /* steps per page.*/ + pData->pageStep=1; + if ( (pData->maxPos - 2) > 1) + pData->pageStep = pData->maxPos - 2; + printf("pageStep=%d\n",pData->pageStep); + + pData->barStart=0; /* start pixel of bar.*/ + pData->barLen=MWM_MINBARLEN; /* length of bar.*/ + pData->status=SBS_UNKNOWN; /* status of scroll bar.*/ +#if 0 /* jmt: must handle WM_MOVE */ + pData->rc=hwnd->winrect; /* screen coordinates position*/ +#endif + hwnd->userdata = (DWORD)pData; + + if (dwStyle == SBS_VERT) + { + wndGetVScrollBarRect (hwnd, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (hwnd, &rcBar); + rcBar.top --; + rcBar.bottom --; + } + /* adjust pData->barLen */ + wndScrollBarPos (hwnd, dwStyle == SBS_HORZ, &rcBar); + + break; + + case WM_DESTROY: + free ((void *)(hwnd->userdata)); + break; + + case WM_PAINT: + MwPaintScrollbars(hwnd,NULL,dwStyle); + break; + + case WM_NCLBUTTONDOWN: + case WM_NCLBUTTONDBLCLK: + case WM_NCMOUSEMOVE: + case WM_NCLBUTTONUP: + MwHandleMessageScrollbar(hwnd, wParam, lParam, message, dwStyle); + break; + + case WM_HSCROLL: + case WM_VSCROLL: + { + int newTop,itemCount,itemVisibles; + + pData = (MWSCROLLBARINFO *)hwnd->userdata; + newTop = pData->curPos; + itemCount = pData->maxPos - pData->minPos + 1; + itemVisibles = pData->pageStep; + + switch(wParam) + { + case SB_LINEDOWN: +#define ITEM_BOTTOM(x) (x->curPos + itemVisibles - 1) + if (ITEM_BOTTOM (pData) < (itemCount - 1 )) + { + newTop ++; + } + break; + + case SB_LINEUP: + if (pData->curPos > 0) + { + newTop --; + } + break; + + case SB_PAGEDOWN: + if ((pData->curPos + (itemVisibles << 1)) <= + itemCount) + newTop += itemVisibles; + else + newTop = itemCount - itemVisibles; + + if (newTop < 0) + return 0; + + break; + + case SB_PAGEUP: + if (pData->curPos >= itemVisibles) + newTop -= itemVisibles; + else + newTop = 0; + + break; + + case SB_THUMBTRACK: + newTop = (int)lParam; + break; + } + + pData->curPos = newTop; + + SendMessage (hwnd, WM_PAINT, 0, 0); + + sbSetScrollInfo (hwnd, pData, TRUE); + + return 0; + } + break; + + default: + return DefWindowProc (hwnd, message, wParam, lParam); + } + return 0; +} + diff --git a/packages/services/gfx/mw/current/src/mwin/winlib/static.c b/packages/services/gfx/mw/current/src/mwin/winlib/static.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winlib/static.c @@ -0,0 +1,369 @@ +/* + * Copyright (C) 1999, 2000, Wei Yongming. + * Portions Copyright (c) 2000 Greg Haerr + * + * Static control for Microwindows win32 api. + */ + +/* +** This library is free software; you can redistribute it and/or +** modify it under the terms of the GNU Library General Public +** License as published by the Free Software Foundation; either +** version 2 of the License, or (at your option) any later version. +** +** This library 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 +** Library General Public License for more details. +** +** You should have received a copy of the GNU Library General Public +** License along with this library; if not, write to the Free +** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +** MA 02111-1307, USA +*/ + +/* +** Alternatively, the contents of this file may be used under the terms +** of the Mozilla Public License (the "MPL License") in which case the +** provisions of the MPL License are applicable instead of those above. +*/ + +/* Create date: 1999/5/22 +** +** Modify records: +** +** Who When Where For What Status +**----------------------------------------------------------------------------- +** WEI Yongming 1999/8/21 Tsinghua Rearrangment Finished +** WEI Yongming 1999/10/27 Tsinghua SETTEXT bug Finished +** WEI Yongming 1999/10/27 Tsinghua SETTEXT bug Finished +** WEI Yongming 2000/02/24 Tsinghua Add MPL License Finished +** Kevin Tseng 2000/06/26 gv port to microwin ported +** Greg Haerr 2000/07/05 Utah bug fixes Finished +*/ + +#include +#include +#include +#define MWINCLUDECOLORS +#include "windows.h" /* windef.h, winuser.h */ +#include "wintools.h" +#include "device.h" /* GdGetTextSize */ + +/* jmt: should be SYSTEM_FIXED_FONT because of minigui's GetSysCharXXX() */ +#define FONT_NAME SYSTEM_FIXED_FONT /* was DEFAULT_GUI_FONT*/ + +static LRESULT CALLBACK +StaticControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + +int WINAPI MwRegisterStaticControl(HINSTANCE hInstance) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)StaticControlProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = NULL; + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground= GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName= "STATIC"; + + return RegisterClass(&wc); +} + +#if 1 +#define RECTW(rc) (rc.right-rc.left) +#define RECTH(rc) (rc.bottom-rc.top) + +static DWORD GetWindowStyle (HWND hwnd) +{ + return hwnd->style; +} + +static COLORREF GetWindowBkColor (HWND hwnd) +{ + MWBRUSHOBJ *hbr; + hbr=(MWBRUSHOBJ *)hwnd->pClass->hbrBackground; + return hbr->color; +} + +static char *GetWindowCaption (HWND hwnd) +{ + return hwnd->szTitle; +} + +static void SetWindowCaption (HWND hwnd,char *caption) +{ + if (strlen(caption)<=63) /* mw: szTitle[64] */ + strcpy(hwnd->szTitle,caption); + else + { + strncpy(hwnd->szTitle,caption,63); + hwnd->szTitle[63]='\0'; + } +} + +static int GetSysCharHeight (HWND hwnd) +{ + HDC hdc; + int xw, xh, xb; + + hdc = GetDC(hwnd); + + SelectObject(hdc, GetStockObject(FONT_NAME)); + +#if MWCLIENT /* nanox client */ + GrGetGCTextSize(hdc->gc, "X", 1, MWTF_ASCII, &xw, &xh, &xb); +#else + GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII); +#endif + ReleaseDC(hwnd,hdc); + + return xh; +} + +static int GetSysCharWidth (HWND hwnd) +{ + HDC hdc; + int xw, xh, xb; + + hdc = GetDC(hwnd); + + SelectObject(hdc, GetStockObject(FONT_NAME)); + +#if MWCLIENT /* nanox client */ + GrGetGCTextSize(hdc->gc, "X", 1, MWTF_ASCII, &xw, &xh, &xb); +#else + GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII); +#endif + ReleaseDC(hwnd,hdc); + + return xw; +} +#endif + +static LRESULT CALLBACK +StaticControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + RECT rcClient; + HDC hdc; + char* spCaption; + HWND pCtrl; + UINT uFormat; + DWORD dwStyle; + + pCtrl = hwnd; + switch (message) { + case WM_CREATE: + return 0; + + case WM_DESTROY: + break; + + case STM_GETIMAGE: + return (int)(pCtrl->userdata); + + case STM_SETIMAGE: + { + int pOldValue; + + pOldValue = (int)(pCtrl->userdata); + pCtrl->userdata = (DWORD)wParam; + InvalidateRect (hwnd, NULL, FALSE); + return pOldValue; + } + + case WM_GETDLGCODE: + return DLGC_STATIC; + + + case WM_PAINT: + { + PAINTSTRUCT ps; + RECT rc; + HBRUSH hbr; + + hdc = BeginPaint (hwnd,&ps); + + GetClientRect (hwnd, &rcClient); + + FastFillRect(hdc, &rcClient, GetSysColor(COLOR_BTNFACE)); + + dwStyle = GetWindowStyle (hwnd); + + switch (dwStyle & SS_TYPEMASK) + { + case SS_GRAYRECT: +#if 0 + SetBrushColor (hdc, LTGRAY); + FillBox(hdc, 0, 0, RECTW(rcClient), RECTH(rcClient)); +#else + rc.left=0; rc.top=0; rc.bottom=RECTH(rcClient); rc.right=RECTW(rcClient); + FillRect(hdc,&rc,GetStockObject(LTGRAY_BRUSH)); +#endif + break; + + case SS_GRAYFRAME: +#if 0 + Draw3DDownFrame (hdc, + 0, 0, rcClient.right, rcClient.bottom, + DKGRAY); +#else + Draw3dInset(hdc, 0, 0, + rcClient.right, rcClient.bottom); +#endif + break; + + case SS_BITMAP: +#if 0 /* jmt: fix: no FillBoxWithBitmap() */ + FillBoxWithBitmap(hdc, 0, 0, 0, 0, + (PBITMAP)(pCtrl->userdata)); +#endif + break; + + case SS_ICON: +#if 0 /* jmt: fix: no DrawIcon */ + hIcon = (HICON)(pCtrl->userdata); + DrawIcon (hdc, 0, 0, 0, 0, hIcon); +#endif + break; + + case SS_SIMPLE: +#if 0 + SetBrushColor (hdc, GetWindowBkColor (hwnd)); + FillBox (hdc, 0, 0, rcClient.right, rcClient.bottom); +#else + hbr=CreateSolidBrush(GetWindowBkColor(hwnd)); + rc.left=0; rc.top=0; rc.bottom=rcClient.bottom; rc.right=rcClient.right; + FillRect(hdc,&rc,hbr); + DeleteObject(hbr); +#endif + if (dwStyle & WS_DISABLED) + SetTextColor (hdc, DKGRAY); + else + SetTextColor (hdc, BLACK); + SetBkColor(hdc, GetSysColor(COLOR_BTNFACE)); + spCaption = GetWindowCaption (hwnd); + if (spCaption) + { + SelectObject(hdc, GetStockObject(FONT_NAME)); + TextOut (hdc, 0, 0, spCaption, -1); + } + break; + + case SS_LEFT: + case SS_CENTER: + case SS_RIGHT: + case SS_LEFTNOWORDWRAP: + uFormat = DT_TOP; + if ( (dwStyle & SS_TYPEMASK) == SS_LEFT) + uFormat |= DT_LEFT | DT_WORDBREAK; + else if ( (dwStyle & SS_TYPEMASK) == SS_CENTER) + uFormat |= DT_CENTER | DT_WORDBREAK; + else if ( (dwStyle & SS_TYPEMASK) == SS_RIGHT) + uFormat |= DT_RIGHT | DT_WORDBREAK; + else if ( (dwStyle & SS_TYPEMASK) == SS_LEFTNOWORDWRAP) + uFormat |= DT_LEFT | DT_SINGLELINE | DT_EXPANDTABS; + + if (dwStyle & WS_DISABLED) + SetTextColor (hdc, DKGRAY); + else + SetTextColor (hdc, BLACK); + +#if 0 + SetBkColor (hdc, GetWindowBkColor (hwnd)); +#endif + SetBkColor(hdc, GetSysColor(COLOR_BTNFACE)); + spCaption = GetWindowCaption (hwnd); + if (dwStyle & SS_NOPREFIX) + uFormat |= DT_NOPREFIX; + + if (spCaption) + { + SelectObject(hdc, GetStockObject(FONT_NAME)); + DrawText (hdc, spCaption, -1, &rcClient, uFormat); + } + break; + + case SS_GROUPBOX: +#if 0 + Draw3DBorder (hdc, rcClient.left, + rcClient.top + (GetSysCharHeight(hwnd) >> 1), + rcClient.right, rcClient.bottom); +#else + Draw3dInset(hdc, rcClient.left, + rcClient.top+(GetSysCharHeight(hwnd) >> 1), + rcClient.right-rcClient.left, + rcClient.bottom-rcClient.top); +#endif + if (dwStyle & WS_DISABLED) + SetTextColor (hdc, DKGRAY); + else + SetTextColor (hdc, BLACK); + +#if 0 + SetBkColor(hdc, GetWindowBkColor (GetParent (hwnd))); +#endif + SetBkColor(hdc, GetSysColor(COLOR_BTNFACE)); + spCaption = GetWindowCaption (hwnd); + if (spCaption) + { + SelectObject(hdc, GetStockObject(FONT_NAME)); + TextOut (hdc, GetSysCharWidth (hwnd), 2, spCaption, -1); + } + break; + } + EndPaint (hwnd, &ps); + } + break; + +#if 0 /* jmt: SS_NOTIFY isn't standard in win32 */ + case WM_LBUTTONDBLCLK: + if (GetWindowStyle (hwnd) & SS_NOTIFY) + SendMessage (GetParent(hwnd), WM_COMMAND, + (WPARAM)MAKELONG(pCtrl->id, STN_DBLCLK), + (LPARAM)hwnd); + break; +#endif + case WM_LBUTTONDOWN: + break; + + case WM_NCLBUTTONDBLCLK: + break; + + case WM_NCLBUTTONDOWN: + break; + + case WM_NCHITTEST: + dwStyle = GetWindowStyle (hwnd); + if ((dwStyle & SS_TYPEMASK) == SS_GROUPBOX) + return HTTRANSPARENT; + +#if 0 /* jmt: SS_NOTIFY isn't standard in win32 */ + if (GetWindowStyle (hwnd) & SS_NOTIFY) + return HTCLIENT; + else +#endif + return HTNOWHERE; + break; + + +#if 0 /* jmt: fix: no WM_GETFONT/WM_SETFONT */ + case WM_GETFONT: + break; + case WM_SETFONT: + break; +#endif + case WM_SETTEXT: + SetWindowCaption (hwnd, (char*)lParam); + InvalidateRect (hwnd, NULL, TRUE); + break; + + default: + return DefWindowProc (hwnd, message, wParam, lParam); + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winmain.c b/packages/services/gfx/mw/current/src/mwin/winmain.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winmain.c @@ -0,0 +1,558 @@ +/* + * Copyright (c) 1999, 2000 Greg Haerr + * + * Main module of Microwindows + */ +#include +#include +#include +#include + +#ifndef __PACIFIC__ +#include +#include +#endif + +#if UNIX | DOS_DJGPP +#include +#if _MINIX +#include +#else +#include +#endif +#endif + +#if ELKS +#include +#include +#endif + +#include "windows.h" +#include "wintern.h" +#include "device.h" +/* + * External definitions defined here. + */ +HWND listwp; /* list of all windows */ +HWND rootwp; /* root window pointer */ +HWND focuswp; /* focus window for keyboard */ +HWND mousewp; /* window mouse is currently in */ +HWND capturewp; /* capture window*/ +HWND dragwp; /* window user is dragging*/ +HCURSOR curcursor; /* currently enabled cursor */ +MWCOORD cursorx; /* current x position of cursor */ +MWCOORD cursory; /* current y position of cursor */ +DWORD startTicks; /* tickcount on startup */ +int keyb_fd; /* the keyboard file descriptor */ +int mouse_fd; /* the mouse file descriptor */ +int escape_quits = 1; /* terminate when pressing ESC */ + +int +main(int ac,char **av) +{ + /* call user hook routine before anything*/ + if(MwUserInit(ac, av) < 0) + exit(1); + + if(MwOpen() < 0) + exit(1); + + /* call windows main program entry point*/ + WinMain(NULL, NULL, NULL, SW_SHOW); + + MwClose(); + return 0; +} + +/* + * Open a connection from a new client to the server. + * Returns -1 on failure. + */ +int +MwOpen(void) +{ + /* Client calls this routine once. We + * init everything here + */ + if(MwInitialize() < 0) + return -1; + return 1; +} + +/* + * Close the connection to the server. + */ +void +MwClose(void) +{ + MwTerminate(); +} + +#if (UNIX | DOS_DJGPP) && !_MINIX +/* + * Support for more than one user fd. + * Chris Johns (ccj@acm.org) + * + * Register the specified file descriptor to post + * WM_FDINPUT/WM_FDOUTPUT/WM_FDEXCEPT to the passed hwnd + * when input/output/except is ready. + * + * Allow for any fd to be selected on. + * + * The user fd's are listed and scanned helping keep the + * overhead down for a large list of fd's being selected on. + */ + +typedef struct { + HWND read; + HWND write; + HWND except; + int next; +} WNDUSERFD; + +static WNDUSERFD userregfd[FD_SETSIZE]; +static int userregfd_head; + +void +MwRegisterFdInput(HWND hwnd, int fd) +{ + if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) { + if (!userregfd[fd].read) { + userregfd[fd].read = hwnd; + if (userregfd[fd].next == -1 && !userregfd[fd].write && !userregfd[fd].except) { + userregfd[fd].next = userregfd_head; + userregfd_head = fd; + } + } + } +} + +void +MwUnregisterFdInput(HWND hwnd, int fd) +{ + if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) { + if (userregfd[fd].read == hwnd) { + userregfd[fd].read = NULL; + if (!userregfd[fd].write && !userregfd[fd].except) { + int *listfd = &userregfd_head; + while (*listfd != -1) { + if (*listfd == fd) { + *listfd = userregfd[fd].next; + userregfd[fd].next = -1; + return; + } + listfd = &userregfd[*listfd].next; + } + userregfd_head = fd; + } + } + } +} + +void +MwRegisterFdOutput(HWND hwnd, int fd) +{ + if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) { + if (!userregfd[fd].write) { + userregfd[fd].write = hwnd; + if (userregfd[fd].next == -1 && !userregfd[fd].read && !userregfd[fd].except) { + userregfd[fd].next = userregfd_head; + userregfd_head = fd; + } + } + } +} + +void +MwUnregisterFdOutput(HWND hwnd, int fd) +{ + if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) { + if (userregfd[fd].write == hwnd) { + userregfd[fd].write = NULL; + if (!userregfd[fd].read && !userregfd[fd].except) { + int *listfd = &userregfd_head; + while (*listfd != -1) { + if (*listfd == fd) { + *listfd = userregfd[fd].next; + userregfd[fd].next = -1; + return; + } + listfd = &userregfd[*listfd].next; + } + userregfd_head = fd; + } + } + } +} + +void +MwRegisterFdExcept(HWND hwnd, int fd) +{ + if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) { + if (!userregfd[fd].except) { + userregfd[fd].except = hwnd; + if (userregfd[fd].next == -1 && !userregfd[fd].read && !userregfd[fd].write) { + userregfd[fd].next = userregfd_head; + userregfd_head = fd; + } + } + } +} + +void +MwUnregisterFdExcept(HWND hwnd, int fd) +{ + if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) { + if (userregfd[fd].except == hwnd) { + userregfd[fd].except = NULL; + if (!userregfd[fd].read && !userregfd[fd].write) { + int *listfd = &userregfd_head; + while (*listfd != -1) { + if (*listfd == fd) { + *listfd = userregfd[fd].next; + userregfd[fd].next = -1; + return; + } + listfd = &userregfd[*listfd].next; + } + userregfd_head = fd; + } + } + } +} + +#endif /* UNIX | DOS_DJGPP*/ + +#if MSDOS | _MINIX +void +MwSelect(void) +{ + /* If mouse data present, service it*/ + if(mousedev.Poll()) + while(MwCheckMouseEvent()) + continue; + + /* If keyboard data present, service it*/ + if(kbddev.Poll()) + while(MwCheckKeyboardEvent()) + continue; + + MwHandleTimers(); +} +#endif + +#if UNIX && defined(HAVESELECT) +#if ANIMATEPALETTE +static int fade = 0; +#endif + +void +MwSelect(void) +{ + fd_set rfds; + fd_set wfds; + fd_set efds; + int fd; + int e; + int setsize = 0; + UINT timeout; + struct timeval to; + + /* perform pre-select duties, if any*/ + if(scrdev.PreSelect) + scrdev.PreSelect(&scrdev); + + /* Set up the FDs for use in the main select(): */ + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); + + if(mouse_fd >= 0) { + FD_SET(mouse_fd, &rfds); + if(mouse_fd > setsize) + setsize = mouse_fd; + } + if(keyb_fd >= 0) { + FD_SET(keyb_fd, &rfds); + if(keyb_fd > setsize) + setsize = keyb_fd; + } + + /* handle registered file descriptors */ + fd = userregfd_head; + while (fd != -1) { + if (userregfd[fd].read) FD_SET(fd, &rfds); + if (userregfd[fd].write) FD_SET(fd, &wfds); + if (userregfd[fd].except) FD_SET(fd, &efds); + if(fd > setsize) setsize = fd; + fd = userregfd[fd].next; + } + + ++setsize; + + /* Set up the timeout for the main select(). If + * the mouse is captured we're probably moving a window, + * so poll quickly to allow other windows to repaint while + * checking for more event input. + */ + if(dragwp) + timeout = to.tv_sec = to.tv_usec = 0L; + else { + timeout = MwGetNextTimeoutValue(); /* returns ms*/ +#if ANIMATEPALETTE + if(fade < 100) + timeout = 40; +#endif +if (!timeout) timeout = 10; /* temp kluge required for mdemo to run ok*/ + GdGetNextTimeout(&to, timeout); + } + + /* Wait for some input on any of the fds in the set or a timeout: */ + if((e = select(setsize, &rfds, &wfds, &efds, &to)) > 0) { + + /* If data is present on the mouse fd, service it: */ + if(mouse_fd >= 0 && FD_ISSET(mouse_fd, &rfds)) + while(MwCheckMouseEvent()) + continue; + + /* If data is present on the keyboard fd, service it: */ + if(keyb_fd >= 0 && FD_ISSET(keyb_fd, &rfds)) + while(MwCheckKeyboardEvent()) + continue; + + /* If registered descriptor, handle it */ + fd = userregfd_head; + while (fd != -1) { + if (userregfd[fd].read && FD_ISSET(fd, &rfds)) + PostMessage(userregfd[fd].read, WM_FDINPUT, fd, 0); + if (userregfd[fd].write && FD_ISSET(fd, &wfds)) + PostMessage(userregfd[fd].write, WM_FDOUTPUT, fd, 0); + if (userregfd[fd].except && FD_ISSET(fd, &efds)) + PostMessage(userregfd[fd].except, WM_FDEXCEPT, fd, 0); + fd = userregfd[fd].next; + } + } + else if(e == 0) { + /* timeout has occured*/ + if(GdTimeout() == FALSE) + return; +#if ANIMATEPALETTE + if(fade <= 100) { + setfadelevel(&scrdev, fade); + fade += 5; + } +#endif + MwHandleTimers(); + } else + if(errno != EINTR) + EPRINTF("Select() call in main failed\n"); +} +#endif + +#if VTSWITCH +static void +CheckVtChange(void *arg) +{ + if(MwCheckVtChange()) { +#if ANIMATEPALETTE + fade = 0; +#endif + MwRedrawScreen(); + } + GdAddTimer(50, CheckVtChange, NULL); +} +#endif + +/* + * Initialize the graphics and mouse devices at startup. + * Returns nonzero with a message printed if the initialization failed. + */ +int +MwInitialize(void) +{ + HWND wp; /* root window */ + PSD psd; + WNDCLASS wc; + int fd; + static MWCURSOR arrow = { /* default arrow cursor*/ + 16, 16, + 0, 0, + RGB(255, 255, 255), RGB(0, 0, 0), + { 0xe000, 0x9800, 0x8600, 0x4180, + 0x4060, 0x2018, 0x2004, 0x107c, + 0x1020, 0x0910, 0x0988, 0x0544, + 0x0522, 0x0211, 0x000a, 0x0004 }, + { 0xe000, 0xf800, 0xfe00, 0x7f80, + 0x7fe0, 0x3ff8, 0x3ffc, 0x1ffc, + 0x1fe0, 0x0ff0, 0x0ff8, 0x077c, + 0x073e, 0x021f, 0x000e, 0x0004 } + }; + + extern MWLISTHEAD mwClassHead; + +#if (UNIX | DOS_DJGPP) && !_MINIX + for (fd = 0; fd < FD_SETSIZE; fd++) { + userregfd[fd].read = NULL; + userregfd[fd].write = NULL; + userregfd[fd].except = NULL; + userregfd[fd].next = -1; + } + userregfd_head = -1; +#endif + /* catch terminate signal to restore tty state*/ + signal(SIGTERM, (void *)MwTerminate); + + startTicks = GetTickCount(); + + if ((keyb_fd = GdOpenKeyboard()) == -1) { + EPRINTF("Cannot initialise keyboard\n"); + return -1; + } + + if ((psd = GdOpenScreen()) == NULL) { + EPRINTF("Cannot initialise screen\n"); + GdCloseKeyboard(); + return -1; + } + + if ((mouse_fd = GdOpenMouse()) == -1) { + EPRINTF("Cannot initialise mouse\n"); + GdCloseScreen(psd); + GdCloseKeyboard(); + return -1; + } + +#if ANIMATEPALETTE + setfadelevel(psd, 0); +#endif + /* + * Initialize the root window. + */ + wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW; + wc.lpfnWndProc = (WNDPROC)DefWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = 0; + wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/ + wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/ + wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_BACKGROUND)); + wc.lpszMenuName = NULL; + wc.lpszClassName = "DeskTop"; + RegisterClass( &wc); + + wp = GdItemNew(struct hwnd); + if (!wp) { + EPRINTF("No memory for root window\n"); + GdCloseMouse(); + GdCloseScreen(psd); + GdCloseKeyboard(); + return -1; + } + /* remove the WS_CAPTION to have bare desktop window*/ + /*wp->style = WS_CLIPCHILDREN | WS_CAPTION | WS_VISIBLE;*/ + wp->style = WS_CLIPCHILDREN | WS_VISIBLE; + wp->exstyle = 0; + wp->pClass = (PWNDCLASS)mwClassHead.head; + wp->parent = NULL; + wp->children = NULL; + wp->siblings = NULL; + wp->next = NULL; + SetRect(&wp->winrect, 0, 0, psd->xvirtres, psd->yvirtres); + MwCalcClientRect(wp); + wp->cursor = NULL; + wp->unmapcount = 0; + wp->id = 0; + strcpy(wp->szTitle, "Microwindows"); + wp->gotPaintMsg = PAINT_PAINTED; +#if UPDATEREGIONS + wp->update = GdAllocRegion(); +#endif + + listwp = wp; + rootwp = wp; + focuswp = wp; + mousewp = wp; + + /* schedule desktop window paint*/ + InvalidateRect(rootwp, NULL, TRUE); + +#if VTSWITCH + MwInitVt(); + /* Check for VT change every 50 ms: */ + GdAddTimer(50, CheckVtChange, NULL); +#endif + + /* + * Initialize and position the default cursor. + */ + curcursor = NULL; + cursorx = -1; + cursory = -1; + GdShowCursor(psd); + MwMoveCursor(psd->xvirtres / 2, psd->yvirtres / 2); + MwSetCursor(rootwp, &arrow); + + /* + * Finally tell the mouse driver some things. + */ + GdRestrictMouse(0, 0, psd->xvirtres - 1, psd->yvirtres - 1); + GdMoveMouse(psd->xvirtres / 2, psd->yvirtres / 2); + + return 0; +} + +/* + * Here to close down the server. + */ +void +MwTerminate(void) +{ + GdCloseScreen(&scrdev); + GdCloseMouse(); + GdCloseKeyboard(); +#if VTSWITCH + MwRedrawVt(mwvterm); + MwExitVt(); +#endif + exit(0); +} + +/* + * Return # milliseconds elapsed since start of Microwindows + * Granularity is 25 msec + */ +DWORD WINAPI +GetTickCount(VOID) +{ +#if MSDOS +#include + return (DWORD)(clock() * 1000 / CLOCKS_PER_SEC); +#else +#if _MINIX + struct tms t; + + return (DWORD)times(&t) * 16; +#else +#if UNIX + struct timeval t; + + gettimeofday(&t, NULL); + return ((t.tv_sec * 1000) + (t.tv_usec / 25000) * 25) - startTicks; +#else + return 0L; +#endif +#endif +#endif +} + +VOID WINAPI +Sleep(DWORD dwMilliseconds) +{ + int i, j, k; + const int loops_per_ms = 20000; + + /* FIXME this is not calibrated */ + for(i=0; i < dwMilliseconds; i++) + for(j=0; j < loops_per_ms; j++) + k = i * j; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winrgn.c b/packages/services/gfx/mw/current/src/mwin/winrgn.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winrgn.c @@ -0,0 +1,566 @@ +/* + * Portions Copyright (c) 1999, 2000 Greg Haerr + * Somewhat less shamelessly ripped from the Wine distribution + * + * Win32 API Region Management Routines. + * Win32 API Complex Rectangle Routines. + * + * GDI region objects. Shamelessly ripped out from the X11 distribution + * Thanks for the nice licence. + * + * Copyright 1993, 1994, 1995 Alexandre Julliard + * Modifications and additions: Copyright 1998 Huw Davies + */ +#include "windows.h" +#include "device.h" +#include +#include + +/* later, error checking can be built into this get*/ +#define GDI_GetObjPtr(hrgn,type) (hrgn) + +/* local functions*/ +static HRGN REGION_CreateRegion(void); +/*BOOL REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect );*/ +/*BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y );*/ + +#define EMPTY_REGION(pReg) { \ + (pReg)->numRects = 0; \ + (pReg)->extents.left = (pReg)->extents.top = 0; \ + (pReg)->extents.right = (pReg)->extents.bottom = 0; \ + (pReg)->type = NULLREGION; \ + } + +/* + * Create a new empty region. + */ +static HRGN +REGION_CreateRegion(void) +{ + MWRGNOBJ *obj; + + obj = GdItemNew(MWRGNOBJ); + if(!obj) + return NULL; + obj->hdr.type = OBJ_REGION; + obj->hdr.stockobj = FALSE; + if(!(obj->rgn = GdAllocRegion())) { + GdItemFree(obj); + return NULL; + } + return (HRGN)obj; +} + + +INT WINAPI +OffsetRgn( HRGN hrgn, INT x, INT y ) +{ + MWRGNOBJ * obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION ); + + if (obj) + { + GdOffsetRegion(obj->rgn, x, y); + return obj->rgn->type; + } + return ERRORREGION; +} + + +INT WINAPI +GetRgnBox( HRGN hrgn, LPRECT rect ) +{ + MWRGNOBJ * obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION ); + if (obj) + return GdGetRegionBox(obj->rgn, rect); + return ERRORREGION; +} + + +HRGN WINAPI +CreateRectRgn(INT left, INT top, INT right, INT bottom) +{ + HRGN hrgn; + + if (!(hrgn = REGION_CreateRegion())) + return 0; + /*TRACE(region, "\n");*/ + SetRectRgn(hrgn, left, top, right, bottom); + return hrgn; +} + + +HRGN WINAPI +CreateRectRgnIndirect( const RECT* rect ) +{ + return CreateRectRgn( rect->left, rect->top, rect->right, rect->bottom ); +} + + +/* + * Allows either or both left and top to be greater than right or bottom. + */ +VOID WINAPI +SetRectRgn( HRGN hrgn, INT left, INT top, INT right, INT bottom ) +{ + MWRGNOBJ * obj; + MWCLIPREGION *rgn; + + /*TRACE(region, " %04x %d,%d-%d,%d\n", hrgn, left, top, right, bottom );*/ + + if (!(obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION ))) return; + + if (left > right) { INT tmp = left; left = right; right = tmp; } + if (top > bottom) { INT tmp = top; top = bottom; bottom = tmp; } + + rgn = obj->rgn; + GdSetRectRegion(rgn, left, top, right, bottom); +} + + +HRGN WINAPI +CreateRoundRectRgn( INT left, INT top, INT right, INT bottom, + INT ellipse_width, INT ellipse_height ) +{ + MWRGNOBJ * obj; + HRGN hrgn; + int asq, bsq, d, xd, yd; + RECT rect; + + /* Check if we can do a normal rectangle instead */ + if (ellipse_width == 0 || ellipse_height == 0) + return CreateRectRgn( left, top, right, bottom ); + + /* Make the dimensions sensible */ + if (left > right) { INT tmp = left; left = right; right = tmp; } + if (top > bottom) { INT tmp = top; top = bottom; bottom = tmp; } + + ellipse_width = abs(ellipse_width); + ellipse_height = abs(ellipse_height); + + /* Create region */ + + if (!(hrgn = REGION_CreateRegion())) + return 0; + obj = (MWRGNOBJ *)hrgn; + /*TRACE(region,"(%d,%d-%d,%d %dx%d): ret=%04x\n", + left, top, right, bottom, ellipse_width, ellipse_height, hrgn);*/ + + /* Check parameters */ + + if (ellipse_width > right-left) ellipse_width = right-left; + if (ellipse_height > bottom-top) ellipse_height = bottom-top; + + /* Ellipse algorithm, based on an article by K. Porter */ + /* in DDJ Graphics Programming Column, 8/89 */ + + asq = ellipse_width * ellipse_width / 4; /* a^2 */ + bsq = ellipse_height * ellipse_height / 4; /* b^2 */ + if (asq == 0) asq = 1; + if (bsq == 0) bsq = 1; + d = bsq - asq * ellipse_height / 2 + asq / 4; /* b^2 - a^2b + a^2/4 */ + xd = 0; + yd = asq * ellipse_height; /* 2a^2b */ + + rect.left = left + ellipse_width / 2; + rect.right = right - ellipse_width / 2; + + /* Loop to draw first half of quadrant */ + + while (xd < yd) + { + if (d > 0) /* if nearest pixel is toward the center */ + { + /* move toward center */ + rect.top = top++; + rect.bottom = rect.top + 1; + GdUnionRectWithRegion( &rect, obj->rgn ); + rect.top = --bottom; + rect.bottom = rect.top + 1; + GdUnionRectWithRegion( &rect, obj->rgn ); + yd -= 2*asq; + d -= yd; + } + rect.left--; /* next horiz point */ + rect.right++; + xd += 2*bsq; + d += bsq + xd; + } + + /* Loop to draw second half of quadrant */ + + d += (3 * (asq-bsq) / 2 - (xd+yd)) / 2; + while (yd >= 0) + { + /* next vertical point */ + rect.top = top++; + rect.bottom = rect.top + 1; + GdUnionRectWithRegion( &rect, obj->rgn ); + rect.top = --bottom; + rect.bottom = rect.top + 1; + GdUnionRectWithRegion( &rect, obj->rgn ); + if (d < 0) /* if nearest pixel is outside ellipse */ + { + rect.left--; /* move away from center */ + rect.right++; + xd += 2*bsq; + d += xd; + } + yd -= 2*asq; + d += asq - yd; + } + + /* Add the inside rectangle */ + + if (top <= bottom) + { + rect.top = top; + rect.bottom = bottom; + GdUnionRectWithRegion( &rect, obj->rgn ); + } + obj->rgn->type = SIMPLEREGION; /* FIXME? */ + return hrgn; +} + + +HRGN WINAPI +CreateEllipticRgn( INT left, INT top, INT right, INT bottom ) +{ + return CreateRoundRectRgn(left, top, right, bottom, right-left, bottom-top); +} + + +HRGN WINAPI +CreateEllipticRgnIndirect( const RECT *rect ) +{ + return CreateRoundRectRgn( rect->left, rect->top, rect->right, + rect->bottom, rect->right - rect->left, + rect->bottom - rect->top ); +} + +HRGN WINAPI +CreatePolygonRgn(const POINT *points, INT count, INT mode) +{ +#if POLYREGIONS + HRGN hrgn; + MWRGNOBJ * obj; + MWCLIPREGION * rgn; + + if (!(hrgn = REGION_CreateRegion())) + return NULL; + obj = (MWRGNOBJ *)GDI_GetObjPtr(hrgn, OBJ_REGION); + if (!obj) + return NULL; + + rgn = GdAllocPolygonRegion((POINT *)points, count, mode); + if (!rgn) + return hrgn; + GdDestroyRegion(obj->rgn); + obj->rgn = rgn; + return hrgn; +#endif +} + +DWORD WINAPI +GetRegionData(HRGN hrgn, DWORD count, LPRGNDATA rgndata) +{ + DWORD size; + MWRGNOBJ *obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION ); + MWCLIPREGION *rgn; + + /*TRACE(region," %04x count = %ld, rgndata = %p\n", hrgn, count, rgndata);*/ + + if(!obj) return 0; + + rgn = obj->rgn; + size = rgn->numRects * sizeof(RECT); + if(count < (size + sizeof(RGNDATAHEADER)) || rgndata == NULL) + return size + sizeof(RGNDATAHEADER); + + rgndata->rdh.dwSize = sizeof(RGNDATAHEADER); + rgndata->rdh.iType = RDH_RECTANGLES; + rgndata->rdh.nCount = rgn->numRects; + rgndata->rdh.nRgnSize = size; + rgndata->rdh.rcBound.left = rgn->extents.left; + rgndata->rdh.rcBound.top = rgn->extents.top; + rgndata->rdh.rcBound.right = rgn->extents.right; + rgndata->rdh.rcBound.bottom = rgn->extents.bottom; + + memcpy( rgndata->Buffer, rgn->rects, size ); + + return 1; +} + + +#if 0 +HRGN WINAPI +ExtCreateRegion(const XFORM* lpXform, DWORD dwCount, const RGNDATA* rgndata) +{ + HRGN hrgn = CreateRectRgn(0, 0, 0, 0); + MWRGNOBJ *obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION ); + RECT *pCurRect, *pEndRect; + + /*TRACE(region, " %p %ld %p. Returning %04x\n", + lpXform, dwCount, rgndata, hrgn);*/ + if(!hrgn) + { + WARN(region, "Can't create a region!\n"); + return 0; + } + if(lpXform) + WARN(region, "Xform not implemented - ignoring\n"); + + if(rgndata->rdh.iType != RDH_RECTANGLES) + { + WARN(region, "Type not RDH_RECTANGLES\n"); + DeleteObject( hrgn ); + return 0; + } + + pEndRect = (RECT *)rgndata->Buffer + rgndata->rdh.nCount; + for(pCurRect = (RECT *)rgndata->Buffer; pCurRect < pEndRect; pCurRect++) + GdUnionRectWithRegion( pCurRect, obj->rgn ); + + return hrgn; +} +#endif + + +BOOL WINAPI +PtInRegion( HRGN hrgn, INT x, INT y ) +{ + MWRGNOBJ * obj; + + obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION ); + if(!obj) + return FALSE; + return GdPtInRegion(obj->rgn, x, y); +} + +/* + * Returns TRUE if rect is at least partly inside hrgn + */ +BOOL WINAPI +RectInRegion( HRGN hrgn, const RECT *rect ) +{ + MWRGNOBJ * obj; + + obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION ); + if(!obj) + return FALSE; + return (GdRectInRegion(obj->rgn, rect) == MWRECT_OUT? FALSE: TRUE); +} + +BOOL WINAPI +EqualRgn( HRGN hrgn1, HRGN hrgn2 ) +{ + MWRGNOBJ *obj1, *obj2; + + if ((obj1 = (MWRGNOBJ *) GDI_GetObjPtr( hrgn1, OBJ_REGION ))) + if ((obj2 = (MWRGNOBJ *) GDI_GetObjPtr( hrgn2, OBJ_REGION ))) + return GdEqualRegion(obj1->rgn, obj2->rgn); + return FALSE; +} + +#if 0 +/* + * REGION_UnionRectWithRgn + * Adds a rectangle to a HRGN + * A helper used by scroll.c + */ +BOOL +REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect ) +{ + MWRGNOBJ *obj = (MWRGNOBJ *)hrgn; + + if(!obj) return FALSE; + GdUnionRectWithRegion( lpRect, obj->rgn ); + return TRUE; +} + +/* + * REGION_FrameRgn + * Create a region that is a frame around another region. + * Expand all rectangles by +/- x and y, then subtract original region. + */ +BOOL +REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y ) +{ + BOOL bRet; + MWRGNOBJ *srcObj = (MWRGNOBJ*) GDI_GetObjPtr( hSrc, OBJ_REGION ); + + if (srcObj->rgn->numRects != 0) + { + MWRGNOBJ* destObj = (MWRGNOBJ*) GDI_GetObjPtr( hDest, OBJ_REGION ); + RECT *pRect, *pEndRect; + RECT tempRect; + + EMPTY_REGION( destObj->rgn ); + + pEndRect = srcObj->rgn->rects + srcObj->rgn->numRects; + for(pRect = srcObj->rgn->rects; pRect < pEndRect; pRect++) + { + tempRect.left = pRect->left - x; + tempRect.top = pRect->top - y; + tempRect.right = pRect->right + x; + tempRect.bottom = pRect->bottom + y; + GdUnionRectWithRegion( &tempRect, destObj->rgn ); + } + GdSubtractRegion( destObj->rgn, destObj->rgn, srcObj->rgn ); + bRet = TRUE; + } + else + bRet = FALSE; + return bRet; +} +#endif + +/* + * Note: The behavior is correct even if src and dest regions are the same. + */ +INT WINAPI +CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode) +{ + MWRGNOBJ *destObj = (MWRGNOBJ *) GDI_GetObjPtr( hDest, OBJ_REGION); + INT result = ERRORREGION; + + /*TRACE(region, " %04x,%04x -> %04x mode=%x\n", hSrc1, hSrc2, hDest,mode);*/ + + if (destObj) + { + MWRGNOBJ *src1Obj = (MWRGNOBJ *) GDI_GetObjPtr( hSrc1, OBJ_REGION); + + if (src1Obj) + { + /*TRACE(region, "dump:\n"); + if(TRACE_ON(region)) + REGION_DumpRegion(src1Obj->rgn);*/ + if (mode == RGN_COPY) + { + GdCopyRegion( destObj->rgn, src1Obj->rgn ); + result = destObj->rgn->type; + } + else + { + MWRGNOBJ *src2Obj = (MWRGNOBJ *) GDI_GetObjPtr( hSrc2, OBJ_REGION); + + if (src2Obj) + { + /*TRACE(region, "dump:\n"); + if(TRACE_ON(region)) + REGION_DumpRegion(src2Obj->rgn);*/ + switch (mode) + { + case RGN_AND: + GdIntersectRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn); + break; + case RGN_OR: + GdUnionRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn ); + break; + case RGN_XOR: + GdXorRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn ); + break; + case RGN_DIFF: + GdSubtractRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn ); + break; + } + result = destObj->rgn->type; + } + } + } + /*TRACE(region, "dump:\n"); + if(TRACE_ON(region)) + REGION_DumpRegion(destObj->rgn);*/ + } + return result; +} + +/* + * Rectangle-related functions + * + * Copyright 1993, 1996 Alexandre Julliard + * + */ +BOOL WINAPI +IntersectRect( LPRECT dest, const RECT *src1, const RECT *src2 ) +{ + if (IsRectEmpty(src1) || IsRectEmpty(src2) || + (src1->left >= src2->right) || (src2->left >= src1->right) || + (src1->top >= src2->bottom) || (src2->top >= src1->bottom)) + { + SetRectEmpty( dest ); + return FALSE; + } + dest->left = MWMAX( src1->left, src2->left ); + dest->right = MWMIN( src1->right, src2->right ); + dest->top = MWMAX( src1->top, src2->top ); + dest->bottom = MWMIN( src1->bottom, src2->bottom ); + return TRUE; +} + + +BOOL WINAPI +UnionRect( LPRECT dest, const RECT *src1, const RECT *src2 ) +{ + if (IsRectEmpty(src1)) + { + if (IsRectEmpty(src2)) + { + SetRectEmpty( dest ); + return FALSE; + } + else *dest = *src2; + } + else + { + if (IsRectEmpty(src2)) *dest = *src1; + else + { + dest->left = MWMIN( src1->left, src2->left ); + dest->right = MWMAX( src1->right, src2->right ); + dest->top = MWMIN( src1->top, src2->top ); + dest->bottom = MWMAX( src1->bottom, src2->bottom ); + } + } + return TRUE; +} + + +BOOL WINAPI +EqualRect( const RECT* rect1, const RECT* rect2 ) +{ + return ((rect1->left == rect2->left) && (rect1->right == rect2->right) && + (rect1->top == rect2->top) && (rect1->bottom == rect2->bottom)); +} + + +BOOL WINAPI +SubtractRect( LPRECT dest, const RECT *src1, const RECT *src2 ) +{ + RECT tmp; + + if (IsRectEmpty( src1 )) + { + SetRectEmpty( dest ); + return FALSE; + } + *dest = *src1; + if (IntersectRect( &tmp, src1, src2 )) + { + if (EqualRect( &tmp, dest )) + { + SetRectEmpty( dest ); + return FALSE; + } + if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom)) + { + if (tmp.left == dest->left) dest->left = tmp.right; + else if (tmp.right == dest->right) dest->right = tmp.left; + } + else if ((tmp.left == dest->left) && (tmp.right == dest->right)) + { + if (tmp.top == dest->top) dest->top = tmp.bottom; + else if (tmp.bottom == dest->bottom) dest->bottom = tmp.top; + } + } + return TRUE; +} diff --git a/packages/services/gfx/mw/current/src/mwin/winsbar.2 b/packages/services/gfx/mw/current/src/mwin/winsbar.2 new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winsbar.2 @@ -0,0 +1,940 @@ +/* + * Copyright (c) 2000 Greg Haerr + * Portions Copyright (c) 1999, 2000, Wei Yongming. + * jmt: scrollbar thumb ported + * + * Microwindows win32 NonClient Scrollbars + */ +#define MWINCLUDECOLORS//jmt: for color macros +#include "windows.h" +#include "wintern.h" +#include "wintools.h" +#include +#include +#include //printf +/* scrollbar status/positions*/ +#define SBS_UNKNOWN 0x0000 +#define SBS_LEFTARROW 0x0001 +#define SBS_RIGHTARROW 0x0002 +#define SBS_LEFTSPACE 0x0004 +#define SBS_RIGHTSPACE 0x0008 +#define SBS_HORZTHUMB 0x0010 +#define SBS_UPARROW 0x0020 +#define SBS_DOWNARROW 0x0040 +#define SBS_UPSPACE 0x0080 +#define SBS_DOWNSPACE 0x0100 +#define SBS_VERTTHUMB 0x0200 +#define SBS_MASK 0x03ff +#define SBS_DISABLED 0x4000 +#define SBS_HIDE 0x8000 + +#define HSCROLLBARVISIBLE(hwnd) ((hwnd)->style & WS_HSCROLL) +#define VSCROLLBARVISIBLE(hwnd) ((hwnd)->style & WS_VSCROLL) + +//# + +/****************************** Drawing Helpers *******************************/ +static void +Draw3DUpFrame(HDC hDC, int l, int t, int r, int b) +{ + RECT rc; + HBRUSH hbr; + + SetRect(&rc, l, t, r, b); + Draw3dBox(hDC, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_3DLIGHT), + GetSysColor(COLOR_WINDOWFRAME)); + InflateRect(&rc, -1, -1); + Draw3dBox(hDC, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GetSysColor(COLOR_BTNHIGHLIGHT), + GetSysColor(COLOR_BTNSHADOW)); + InflateRect(&rc, -1, -1); + + hbr = CreateSolidBrush(LTGRAY); + FillRect(hDC, &rc, hbr); + DeleteObject(hbr); +} + + +/* + * Adjust client area smaller if scrollbars visible. + * Also, compute the NC hittest regions for the scrollbars. + */ +void +MwAdjustNCScrollbars(HWND hwnd) +{ + BOOL vertbar = VSCROLLBARVISIBLE(hwnd); + BOOL horzbar = HSCROLLBARVISIBLE(hwnd); + + if (vertbar) { + hwnd->clirect.right -= mwSYSMETRICS_CXVSCROLL; + if (horzbar) + hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL; + hwnd->vscroll.rc.left = hwnd->clirect.right; + hwnd->vscroll.rc.right = hwnd->clirect.right + + mwSYSMETRICS_CXVSCROLL; + hwnd->vscroll.rc.top = hwnd->clirect.top; + hwnd->vscroll.rc.bottom = hwnd->clirect.bottom; + } else + SetRectEmpty(&hwnd->vscroll.rc); + if (horzbar) { + if (!vertbar) + hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL; + hwnd->hscroll.rc.top = hwnd->clirect.bottom; + hwnd->hscroll.rc.bottom = hwnd->clirect.bottom + + mwSYSMETRICS_CYHSCROLL; + hwnd->hscroll.rc.left = hwnd->clirect.left; + hwnd->hscroll.rc.right = hwnd->clirect.right; + } else + SetRectEmpty(&hwnd->hscroll.rc); +} + +static int +wndGetBorder(HWND hwnd) +{ + if (hwnd->style & WS_BORDER) { + if ((hwnd->style & WS_CAPTION) == WS_CAPTION) + return mwSYSMETRICS_CXFRAME; + return mwSYSMETRICS_CXBORDER; + } + return 0; +} + +static BOOL +wndGetVScrollBarRect (HWND hwnd, RECT* rcVBar) +{ + if (hwnd->style & WS_VSCROLL) { + rcVBar->left = hwnd->winrect.right - mwSYSMETRICS_CXVSCROLL + - wndGetBorder (hwnd); + rcVBar->right = hwnd->winrect.right - wndGetBorder (hwnd); + rcVBar->top = hwnd->clirect.top; + rcVBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd); + + if (hwnd->style & WS_HSCROLL && !(hwnd->hscroll.status & SBS_HIDE)) + rcVBar->bottom -= mwSYSMETRICS_CYHSCROLL; + + return TRUE; + } + + return FALSE; +} + +static BOOL +wndGetHScrollBarRect (HWND hwnd, RECT* rcHBar) +{ + if (hwnd->style & WS_HSCROLL) { + rcHBar->top = hwnd->winrect.bottom - mwSYSMETRICS_CYHSCROLL + - wndGetBorder (hwnd); + rcHBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd); + rcHBar->left = hwnd->clirect.left; + rcHBar->right = hwnd->winrect.right - wndGetBorder (hwnd); + + if (hwnd->style & WS_VSCROLL && !(hwnd->vscroll.status & SBS_HIDE)) + rcHBar->right -= mwSYSMETRICS_CXVSCROLL; + + return TRUE; + } + + return FALSE; +} + +void +MwPaintNCScrollbars(HWND hwnd, HDC hdc) +{ + BOOL vertbar = VSCROLLBARVISIBLE(hwnd); + BOOL horzbar = HSCROLLBARVISIBLE(hwnd); + BOOL fGotDC = FALSE; + RECT rc,rc2; + + POINT p3[3]; + int shrink=2; + + int start = 0; + RECT rcHBar, rcVBar; + + + if (!hdc && (horzbar || vertbar)) { + hdc = GetWindowDC(hwnd); + fGotDC = TRUE; + } + + if (horzbar && vertbar) { + rc.left = hwnd->clirect.right; + rc.top = hwnd->clirect.bottom; + rc.right = rc.left + mwSYSMETRICS_CXVSCROLL; + rc.bottom = rc.top + mwSYSMETRICS_CYHSCROLL; + FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1)); + } + if (vertbar) { + rc = hwnd->vscroll.rc; + + /* bkgnd */ + FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1)); + + /* up */ + Draw3dUpDownState(hdc, rc.left, rc.top, + mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL, + hwnd->vscroll.status & SBS_UPARROW); + /* down */ + Draw3dUpDownState(hdc, rc.left,rc.bottom-mwSYSMETRICS_CYHSCROLL, + mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL, + hwnd->vscroll.status & SBS_DOWNARROW); +#if 1//jmt: draw arrows + SelectObject(hdc,GetStockObject(BLACK_BRUSH)); + /* up */ + p3[0].x= rc.left + (mwSYSMETRICS_CXVSCROLL/2) - 1; + p3[0].y= rc.top + 2 + shrink; + p3[1].x= rc.left + 2 + shrink - 1; + p3[1].y= rc.top + (mwSYSMETRICS_CYHSCROLL-4) - shrink; + p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink; + p3[2].y= rc.top + (mwSYSMETRICS_CYHSCROLL-4) - shrink; + Polygon(hdc,p3,3); + /* down */ + p3[0].x= rc.left + (mwSYSMETRICS_CXVSCROLL/2) - 1; + p3[0].y= rc.bottom - 4 - shrink; + p3[1].x= rc.left + 2 + shrink - 1; + p3[1].y= rc.bottom-mwSYSMETRICS_CYHSCROLL + 2 + shrink; + p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink; + p3[2].y= rc.bottom-mwSYSMETRICS_CYHSCROLL + 2 + shrink; + Polygon(hdc,p3,3); +#endif +#if 1 + // draw moving bar + + wndGetVScrollBarRect (hwnd, &rcVBar); + rcVBar.left -- ; + rcVBar.right -- ; + + start = rcVBar.top + mwSYSMETRICS_CYVSCROLL + hwnd->vscroll.barStart; + + if (start + hwnd->vscroll.barLen > rcVBar.bottom) + start = rcVBar.bottom - hwnd->vscroll.barLen; + + if (hwnd->vscroll.barLen == 0) + hwnd->vscroll.barLen=rc.bottom-rc.top-(mwSYSMETRICS_CYVSCROLL*2); + + /* bkgnd */ + rc2.left=rc.left; rc2.right=rc.right/*-1*/; + rc2.top=rc.top+mwSYSMETRICS_CYHSCROLL; + rc2.bottom=start; + if (rc2.bottom>rc2.top) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + rc2.top=start+hwnd->vscroll.barLen; + rc2.bottom=rc.bottom-mwSYSMETRICS_CYHSCROLL; + if (rc2.bottom>rc2.top) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + Draw3DUpFrame (hdc, rcVBar.left, start, rcVBar.right, + start + hwnd->vscroll.barLen); +#if 0 + printf("barv:(l,t,r,b):(%d,%d,%d,%d)\n", + rcVBar.left, start, rcVBar.right, + start + hwnd->vscroll.barLen); +#endif +#endif + } + if (horzbar) { + rc = hwnd->hscroll.rc; + + /* bkgnd */ + FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1)); + + /* left */ + Draw3dUpDownState(hdc, rc.left, rc.top, + mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL, + hwnd->hscroll.status & SBS_LEFTARROW); + /* right */ + Draw3dUpDownState(hdc, rc.right-mwSYSMETRICS_CXVSCROLL, rc.top, + mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL, + hwnd->hscroll.status & SBS_RIGHTARROW); +#if 1//jmt: draw arrows + SelectObject(hdc,GetStockObject(BLACK_BRUSH)); + /* left */ + p3[0].x= rc.left + 2 + shrink; + p3[0].y= rc.top + (mwSYSMETRICS_CYHSCROLL/2) ; + p3[1].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink ; + p3[1].y= rc.top + 2 + shrink; + p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink; + p3[2].y= rc.bottom - 4 - shrink + 1; + Polygon(hdc,p3,3); + /* right */ + p3[0].x= rc.right - 4 - shrink; + p3[0].y= rc.top + (mwSYSMETRICS_CYHSCROLL/2) ; + p3[1].x= rc.right-mwSYSMETRICS_CXVSCROLL + 2 + shrink ; + p3[1].y= rc.top + 2 + shrink; + p3[2].x= rc.right-mwSYSMETRICS_CXVSCROLL + 2 + shrink; + p3[2].y= rc.bottom - 4 - shrink + 1; + Polygon(hdc,p3,3); +#endif +#if 1 + // draw moving bar. + + wndGetHScrollBarRect (hwnd, &rcHBar); + rcHBar.top -- ; + rcHBar.bottom -- ; + + start = rcHBar.left + mwSYSMETRICS_CXHSCROLL + hwnd->hscroll.barStart; + + if (start + hwnd->hscroll.barLen > rcHBar.right) + start = rcHBar.right - hwnd->hscroll.barLen; + + if (hwnd->hscroll.barLen == 0) + hwnd->hscroll.barLen=rc.right-rc.left-(mwSYSMETRICS_CXHSCROLL*2); + + /* bkgnd */ + rc2.top=rc.top; rc2.bottom=rc.bottom/*-1*/; + rc2.left=rc.left+mwSYSMETRICS_CXVSCROLL; + rc2.right=start; + if (rc2.right>rc2.left) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + rc2.left=start+hwnd->hscroll.barLen; + rc2.right=rc.right-mwSYSMETRICS_CXVSCROLL; + if (rc2.right>rc2.left) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + Draw3DUpFrame (hdc, start, rcHBar.top, start + hwnd->hscroll.barLen, + rcHBar.bottom); +#if 0 + printf("barh:(l,t,r,b):(%d,%d,%d,%d)\n", + start, rcHBar.top, start + hwnd->hscroll.barLen, + rcHBar.bottom); +#endif +#endif + } + + if (fGotDC) + ReleaseDC(hwnd, hdc); +} + +/* handle a non-client message for a scrollbar*/ +void +MwHandleNCMessageScrollbar(HWND hwnd, WPARAM hitcode, LPARAM lParam, UINT msg/*BOOL fDown*/) +{ + int pos = SBS_UNKNOWN; + BOOL vertbar = VSCROLLBARVISIBLE(hwnd); + BOOL horzbar = HSCROLLBARVISIBLE(hwnd); + int * pStat; + POINT pt; + RECT rc; + + static BOOL bDraw; + + static int downPos = SBS_UNKNOWN;// + static int sbCode; + int newThumbPos; + + int itemMoveable,itemCount,itemVisible,moveRange;//jmt:2k0819 + int moveTop,moveBottom,moveLeft,moveRight;//jmt:2k0819 + + POINTSTOPOINT(pt, lParam); + for (;;) { /* use for() to allow break statement*/ + if (hitcode == HTVSCROLL && vertbar) + { + pStat = &hwnd->vscroll.status; + rc = hwnd->vscroll.rc; + rc.bottom = rc.top + mwSYSMETRICS_CYVSCROLL; + if (PtInRect(&rc, pt)) + { + pos = SBS_UPARROW; + break; + } + rc.bottom = hwnd->vscroll.rc.bottom; + rc.top = rc.bottom - mwSYSMETRICS_CYVSCROLL; + if (PtInRect(&rc, pt)) + { + pos = SBS_DOWNARROW; + break; + } + pos = SBS_VERTTHUMB; + } else if (hitcode == HTHSCROLL && horzbar) + { + pStat = &hwnd->hscroll.status; + rc = hwnd->hscroll.rc; + rc.right = rc.left + mwSYSMETRICS_CXHSCROLL; + if (PtInRect(&rc, pt)) { + pos = SBS_LEFTARROW; + break; + } + rc.right = hwnd->hscroll.rc.right; + rc.left = rc.right - mwSYSMETRICS_CXHSCROLL; + if (PtInRect(&rc, pt)) { + pos = SBS_RIGHTARROW; + break; + } + pos = SBS_HORZTHUMB; + } else + return; + break; + } + + if (pos == SBS_UNKNOWN) + return; + + *pStat &= ~SBS_MASK; /* remove stray mouse states*/ + + if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK)//jmt:2k0819 + *pStat |= pos; + else *pStat &= ~pos; + + if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK)//jmt:2k0819 + bDraw=TRUE; + + if (bDraw) + MwPaintNCScrollbars(hwnd, NULL); + + if (pos == SBS_UPARROW || pos == SBS_LEFTARROW)//jmt:2k0820 + { + if (hwnd->vscroll.curPos != hwnd->vscroll.minPos) + sbCode = SB_LINEUP; + } + else if (pos == SBS_DOWNARROW || pos == SBS_RIGHTARROW)//jmt:2k0820 + { + if (hwnd->vscroll.curPos != hwnd->vscroll.maxPos) + sbCode = SB_LINEDOWN; + } + else if (pos == SBS_VERTTHUMB || pos == SBS_HORZTHUMB)// + { + sbCode = SB_THUMBTRACK;// + } + + switch(msg) + { + case WM_NCLBUTTONDOWN: + case WM_NCLBUTTONDBLCLK://jmt:2k0819 + downPos = pos; + break; + + case WM_NCMOUSEMOVE://jmt:2k0819 + if (hitcode == HTVSCROLL && vertbar) + { + if (sbCode == SB_THUMBTRACK && downPos == SBS_VERTTHUMB)// + { + //jmt(2k0819): new algorithm for SB_THUMBTRACK + + rc = hwnd->vscroll.rc; + moveTop = rc.top + mwSYSMETRICS_CYVSCROLL; + moveBottom = hwnd->vscroll.rc.bottom - mwSYSMETRICS_CYVSCROLL; + moveRange = moveBottom - moveTop; + + itemCount = hwnd->vscroll.maxPos - hwnd->vscroll.minPos + 1; + itemVisible = hwnd->vscroll.pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveTop,itemMoveable,moveRange,newThumbPos); + //# + + if ( newThumbPos >= hwnd->vscroll.minPos && + newThumbPos <= hwnd->vscroll.maxPos) + SendMessage (hwnd, + WM_VSCROLL, SB_THUMBTRACK, newThumbPos); + break; + } + } + + if (hitcode == HTHSCROLL && horzbar) + { + if (sbCode == SB_THUMBTRACK && downPos == SBS_HORZTHUMB)// + { + //jmt(2k0819): new algorithm for SB_THUMBTRACK + + rc = hwnd->hscroll.rc; + moveLeft = rc.left + mwSYSMETRICS_CXHSCROLL; + moveRight = hwnd->hscroll.rc.right - mwSYSMETRICS_CXHSCROLL; + moveRange = moveRight - moveLeft; + + itemCount = hwnd->hscroll.maxPos - hwnd->hscroll.minPos + 1; + itemVisible = hwnd->hscroll.pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveLeft,itemMoveable,moveRange,newThumbPos); + //# + + if ( newThumbPos >= hwnd->hscroll.minPos && + newThumbPos <= hwnd->hscroll.maxPos) + SendMessage (hwnd, + WM_HSCROLL, SB_THUMBTRACK, newThumbPos); + break; + } + } + + break; + + case WM_NCLBUTTONUP://jmt:2k0819 + bDraw=FALSE; + downPos = SBS_UNKNOWN;// + + if (sbCode==SB_THUMBTRACK) + { + if (hitcode == HTVSCROLL && vertbar) + { + //jmt(2k0819): new algorithm for SB_THUMBTRACK + + rc = hwnd->vscroll.rc; + moveTop = rc.top + mwSYSMETRICS_CYVSCROLL; + moveBottom = hwnd->vscroll.rc.bottom - mwSYSMETRICS_CYVSCROLL; + moveRange = moveBottom - moveTop; + + itemCount = hwnd->vscroll.maxPos - hwnd->vscroll.minPos + 1; + itemVisible = hwnd->vscroll.pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveTop,itemMoveable,moveRange,newThumbPos); + //# + if ( newThumbPos >= hwnd->vscroll.minPos && + newThumbPos <= hwnd->vscroll.maxPos) + SendMessage (hwnd, + WM_VSCROLL, SB_THUMBTRACK, newThumbPos); + break; + } + + if (hitcode == HTHSCROLL && horzbar) + { + //jmt(2k0819): new algorithm for SB_THUMBTRACK + + rc = hwnd->hscroll.rc; + moveLeft = rc.left + mwSYSMETRICS_CXHSCROLL; + moveRight = hwnd->hscroll.rc.right - mwSYSMETRICS_CXHSCROLL; + moveRange = moveRight - moveLeft; + + itemCount = hwnd->hscroll.maxPos - hwnd->hscroll.minPos + 1; + itemVisible = hwnd->hscroll.pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveLeft,itemMoveable,moveRange,newThumbPos); + //# + + if ( newThumbPos >= hwnd->hscroll.minPos && + newThumbPos <= hwnd->hscroll.maxPos) + SendMessage (hwnd, + WM_HSCROLL, SB_THUMBTRACK, newThumbPos); + break; + } + } + else//jmt:2k0820 + { + if (hitcode == HTVSCROLL && vertbar) + SendMessage (hwnd, WM_VSCROLL, sbCode, 0); + + if (hitcode == HTHSCROLL && horzbar) + SendMessage (hwnd, WM_HSCROLL, sbCode, 0); + } + break; + } + +} + + +static BOOL +PtInRect2(const RECT *lprc, int x, int y) +{ + POINT p; + + p.x = x; + p.y = y; + return PtInRect(lprc, p); +} + +#if 1//0000 + + +static void +wndScrollBarPos (HWND hwnd, BOOL bIsHBar, RECT* rcBar) +{ + UINT moveRange; + PMWSCROLLBARINFO pSBar; + + if (bIsHBar) + pSBar = &hwnd->hscroll; + else + pSBar = &hwnd->vscroll; + + if (pSBar->minPos == pSBar->maxPos) { + pSBar->status |= SBS_HIDE; + return; + } + + if (bIsHBar) + moveRange = (rcBar->right - rcBar->left) - (mwSYSMETRICS_CXHSCROLL<<1); + else + moveRange = (rcBar->bottom - rcBar->top) - (mwSYSMETRICS_CYVSCROLL<<1); + +#define MWM_DEFBARLEN 18// +#define MWM_MINBARLEN 8// + + if (pSBar->pageStep == 0) + { + pSBar->barLen = MWM_DEFBARLEN; + + if (pSBar->barLen > moveRange) + pSBar->barLen = MWM_MINBARLEN; + } + else + { + pSBar->barLen = moveRange * pSBar->pageStep / + (pSBar->maxPos - pSBar->minPos + 1); + if (pSBar->barLen < MWM_MINBARLEN) + pSBar->barLen = MWM_MINBARLEN; + } + + pSBar->barStart = moveRange * (pSBar->curPos - pSBar->minPos) / + (pSBar->maxPos - pSBar->minPos + 1); + + + if (pSBar->barStart + pSBar->barLen > moveRange) + pSBar->barStart = moveRange - pSBar->barLen; + + + if (pSBar->barStart < 0) + pSBar->barStart = 0; +} + +static PMWSCROLLBARINFO wndGetScrollBar (HWND pWin, int iSBar) +{ + if (iSBar == SB_HORZ) { + if (pWin->style & WS_HSCROLL) + return &pWin->hscroll; + } + else if (iSBar == SB_VERT) { + if (pWin->style & WS_VSCROLL) + return &pWin->vscroll; + } + + return NULL; +} + +BOOL EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + BOOL bPrevState; + RECT rcBar; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )//ok + return FALSE; + + bPrevState = !(pSBar->status & SBS_DISABLED); + + if (bEnable && !bPrevState) + pSBar->status &= ~SBS_DISABLED; + else if (!bEnable && bPrevState) + pSBar->status |= SBS_DISABLED; + else + return FALSE; + + if (iSBar == SB_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintNCScrollbars(hWnd,NULL);//a must +#endif + + return TRUE; +} + +BOOL GetScrollPos (HWND hWnd, int iSBar, int* pPos) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + *pPos = pSBar->curPos; + return TRUE; +} + +BOOL GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + *pMinPos = pSBar->minPos; + *pMaxPos = pSBar->maxPos; + return TRUE; +} + +BOOL SetScrollPos (HWND hWnd, int iSBar, int iNewPos)//ok +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + RECT rcBar; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + if (iNewPos < pSBar->minPos) + pSBar->curPos = pSBar->minPos; + else + pSBar->curPos = iNewPos; + + { + int max = pSBar->maxPos; + max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0; + + if (pSBar->curPos > max) + pSBar->curPos = max; + } + + if (iSBar == SB_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } + + wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar); + +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintNCScrollbars(hWnd,NULL);//a must +#endif + return TRUE; +} + +BOOL SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + RECT rcBar; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + pSBar->minPos = (iMinPos < iMaxPos)?iMinPos:iMaxPos; + pSBar->maxPos = (iMinPos > iMaxPos)?iMinPos:iMaxPos; + + // validate parameters. + if (pSBar->curPos < pSBar->minPos) + pSBar->curPos = pSBar->minPos; + + if (pSBar->pageStep <= 0) + pSBar->pageStep = 0; + else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1)) + pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1; + + { + int max = pSBar->maxPos; + max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0; + + if (pSBar->curPos > max) + pSBar->curPos = max; + } + + if (iSBar == SB_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } + wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar); + +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintNCScrollbars(hWnd,NULL);//a must +#endif + + return TRUE; +} + +BOOL SetScrollInfo (HWND hWnd, int iSBar, + LPCSCROLLINFO lpsi, BOOL fRedraw)//ok +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + RECT rcBar; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + if( lpsi->fMask & SIF_RANGE ) + { + pSBar->minPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMin:lpsi->nMax; + pSBar->maxPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMax:lpsi->nMin; + } + + if( lpsi->fMask & SIF_POS ) + pSBar->curPos = lpsi->nPos; + + if( lpsi->fMask & SIF_PAGE ) + pSBar->pageStep = lpsi->nPage; + + // validate parameters. + if (pSBar->curPos < pSBar->minPos) + pSBar->curPos = pSBar->minPos; + + if (pSBar->pageStep <= 0) + pSBar->pageStep = 0; + else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1)) + pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1; + + { + int max = pSBar->maxPos; + max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0; + + if (pSBar->curPos > max) + pSBar->curPos = max; + } + + if(fRedraw) + { + if (iSBar == SB_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } + wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar); + +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintNCScrollbars(hWnd,NULL);//a must +#endif + } + + return TRUE; +} + +BOOL GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + if( lpsi->fMask & SIF_RANGE ) + { + lpsi->nMin = pSBar->minPos; + lpsi->nMax = pSBar->maxPos; + } + + if( lpsi->fMask & SIF_POS ) + { + lpsi->nPos = pSBar->curPos; + } + + if( lpsi->fMask & SIF_PAGE ) + lpsi->nPage = pSBar->pageStep; + + return TRUE; +} + +BOOL ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + BOOL bPrevState; + RECT rcBar; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + bPrevState = !(pSBar->status & SBS_HIDE); + + if (bShow && !bPrevState) + pSBar->status &= ~SBS_HIDE; + else if (!bShow && bPrevState) + pSBar->status |= SBS_HIDE; + else + return FALSE; +#if 0//fix: no WM_CHANGESIZE + SendMessage (hWnd, WM_CHANGESIZE, 0, 0); +#endif + if (iSBar == SB_VERT) + wndGetVScrollBarRect (pWin, &rcBar); + else + wndGetHScrollBarRect (pWin, &rcBar); + + { + RECT rcWin, rcClient; + + memcpy (&rcWin, &pWin->winrect.left, sizeof (RECT)); + + rcClient.left = 0; + rcClient.top = 0; + rcClient.right = pWin->clirect.right - pWin->clirect.left; + rcClient.bottom = pWin->clirect.bottom - pWin->clirect.top; +#if 0//fix: no WM_SIZECHANGED + SendMessage/*SendAsyncMessage*/ (hWnd, WM_SIZECHANGED, + (WPARAM)&rcWin, (LPARAM)&rcClient); +#endif + } + + if (bShow) { + SendMessage (hWnd, WM_NCPAINT, 0, 0); + } + else { + rcBar.left -= pWin->clirect.left; + rcBar.top -= pWin->clirect.top; + rcBar.right -= pWin->clirect.left; + rcBar.bottom -= pWin->clirect.top; + SendMessage (hWnd, WM_NCPAINT, 0, 0); + InvalidateRect (hWnd, &rcBar, TRUE); + } + + return TRUE; +} +#endif diff --git a/packages/services/gfx/mw/current/src/mwin/winsbar.c b/packages/services/gfx/mw/current/src/mwin/winsbar.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winsbar.c @@ -0,0 +1,921 @@ +/* + * Copyright (c) 2000 Greg Haerr + * Portions Copyright (c) 1999, 2000, Wei Yongming. + * jmt: scrollbar thumb ported + * + * Microwindows win32 NonClient Scrollbars + */ +#define MWINCLUDECOLORS +#include "windows.h" +#include "wintern.h" +#include "wintools.h" +#include +#include +#include + +/* scrollbar status/positions*/ +#define SBS_UNKNOWN 0x0000 +#define SBS_LEFTARROW 0x0001 +#define SBS_RIGHTARROW 0x0002 +#define SBS_LEFTSPACE 0x0004 +#define SBS_RIGHTSPACE 0x0008 +#define SBS_HORZTHUMB 0x0010 +#define SBS_UPARROW 0x0020 +#define SBS_DOWNARROW 0x0040 +#define SBS_UPSPACE 0x0080 +#define SBS_DOWNSPACE 0x0100 +#define SBS_VERTTHUMB 0x0200 +#define SBS_MASK 0x03ff +#define SBS_DISABLED 0x4000 +#define SBS_HIDE 0x8000 + +#define HSCROLLBARVISIBLE(hwnd) ((hwnd)->style & WS_HSCROLL) +#define VSCROLLBARVISIBLE(hwnd) ((hwnd)->style & WS_VSCROLL) + +/* + * Adjust client area smaller if scrollbars visible. + * Also, compute the NC hittest regions for the scrollbars. + */ +void +MwAdjustNCScrollbars(HWND hwnd) +{ + BOOL vertbar = VSCROLLBARVISIBLE(hwnd); + BOOL horzbar = HSCROLLBARVISIBLE(hwnd); + + if (vertbar) { + hwnd->clirect.right -= mwSYSMETRICS_CXVSCROLL; + if (horzbar) + hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL; + hwnd->vscroll.rc.left = hwnd->clirect.right; + hwnd->vscroll.rc.right = hwnd->clirect.right + + mwSYSMETRICS_CXVSCROLL; + hwnd->vscroll.rc.top = hwnd->clirect.top; + hwnd->vscroll.rc.bottom = hwnd->clirect.bottom; + } else + SetRectEmpty(&hwnd->vscroll.rc); + if (horzbar) { + if (!vertbar) + hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL; + hwnd->hscroll.rc.top = hwnd->clirect.bottom; + hwnd->hscroll.rc.bottom = hwnd->clirect.bottom + + mwSYSMETRICS_CYHSCROLL; + hwnd->hscroll.rc.left = hwnd->clirect.left; + hwnd->hscroll.rc.right = hwnd->clirect.right; + } else + SetRectEmpty(&hwnd->hscroll.rc); +} + +static int +wndGetBorder(HWND hwnd) +{ + if (hwnd->style & WS_BORDER) { + if ((hwnd->style & WS_CAPTION) == WS_CAPTION) + return mwSYSMETRICS_CXFRAME; + return mwSYSMETRICS_CXBORDER; + } + return 0; +} + +static BOOL +wndGetVScrollBarRect (HWND hwnd, RECT* rcVBar) +{ + if (hwnd->style & WS_VSCROLL) { + rcVBar->left = hwnd->winrect.right - mwSYSMETRICS_CXVSCROLL + - wndGetBorder (hwnd); + rcVBar->right = hwnd->winrect.right - wndGetBorder (hwnd); + rcVBar->top = hwnd->clirect.top; + rcVBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd); + + if (hwnd->style & WS_HSCROLL && !(hwnd->hscroll.status & SBS_HIDE)) + rcVBar->bottom -= mwSYSMETRICS_CYHSCROLL; + + return TRUE; + } + + return FALSE; +} + +static BOOL +wndGetHScrollBarRect (HWND hwnd, RECT* rcHBar) +{ + if (hwnd->style & WS_HSCROLL) { + rcHBar->top = hwnd->winrect.bottom - mwSYSMETRICS_CYHSCROLL + - wndGetBorder (hwnd); + rcHBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd); + rcHBar->left = hwnd->clirect.left; + rcHBar->right = hwnd->winrect.right - wndGetBorder (hwnd); + + if (hwnd->style & WS_VSCROLL && !(hwnd->vscroll.status & SBS_HIDE)) + rcHBar->right -= mwSYSMETRICS_CXVSCROLL; + + return TRUE; + } + + return FALSE; +} + +void +MwPaintNCScrollbars(HWND hwnd, HDC hdc) +{ + BOOL vertbar = VSCROLLBARVISIBLE(hwnd); + BOOL horzbar = HSCROLLBARVISIBLE(hwnd); + BOOL fGotDC = FALSE; + RECT rc,rc2; + + POINT p3[3]; + int shrink=2; + + int start = 0; + RECT rcHBar, rcVBar; + + + if (!hdc && (horzbar || vertbar)) { + hdc = GetWindowDC(hwnd); + fGotDC = TRUE; + } + + if (horzbar && vertbar) { + rc.left = hwnd->clirect.right; + rc.top = hwnd->clirect.bottom; + rc.right = rc.left + mwSYSMETRICS_CXVSCROLL; + rc.bottom = rc.top + mwSYSMETRICS_CYHSCROLL; + FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1)); + } + if (vertbar) { + rc = hwnd->vscroll.rc; +#if 1 + /* bkgnd */ + rc2.left=rc.left; rc2.right=rc2.left+ mwSYSMETRICS_CXVSCROLL; + rc2.top=rc.top; + rc2.bottom=rc2.top+ mwSYSMETRICS_CYHSCROLL; + FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1)); + rc2.top=rc.bottom- mwSYSMETRICS_CYHSCROLL; + rc2.bottom=rc2.top+ mwSYSMETRICS_CYHSCROLL; + FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1)); +#endif + /* up */ + Draw3dUpDownState(hdc, rc.left, rc.top, + mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL, + hwnd->vscroll.status & SBS_UPARROW); + /* down */ + Draw3dUpDownState(hdc, rc.left,rc.bottom-mwSYSMETRICS_CYHSCROLL, + mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL, + hwnd->vscroll.status & SBS_DOWNARROW); +/* jmt: draw arrows */ + SelectObject(hdc,GetStockObject(BLACK_BRUSH)); + /* up */ + p3[0].x= rc.left + (mwSYSMETRICS_CXVSCROLL/2) - 1; + p3[0].y= rc.top + 2 + shrink; + p3[1].x= rc.left + 2 + shrink - 1; + p3[1].y= rc.top + (mwSYSMETRICS_CYHSCROLL-4) - shrink; + p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink; + p3[2].y= rc.top + (mwSYSMETRICS_CYHSCROLL-4) - shrink; + Polygon(hdc,p3,3); + /* down */ + p3[0].x= rc.left + (mwSYSMETRICS_CXVSCROLL/2) - 1; + p3[0].y= rc.bottom - 4 - shrink; + p3[1].x= rc.left + 2 + shrink - 1; + p3[1].y= rc.bottom-mwSYSMETRICS_CYHSCROLL + 2 + shrink; + p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink; + p3[2].y= rc.bottom-mwSYSMETRICS_CYHSCROLL + 2 + shrink; + Polygon(hdc,p3,3); + + /* draw moving bar */ + + wndGetVScrollBarRect (hwnd, &rcVBar); + rcVBar.left -- ; + rcVBar.right -- ; + + start = rcVBar.top + mwSYSMETRICS_CYVSCROLL + hwnd->vscroll.barStart; + + if (start + hwnd->vscroll.barLen > rcVBar.bottom) + start = rcVBar.bottom - hwnd->vscroll.barLen; + + if (hwnd->vscroll.barLen == 0) + hwnd->vscroll.barLen=rc.bottom-rc.top-(mwSYSMETRICS_CYVSCROLL*2); + + /* bkgnd */ + rc2.left=rc.left; rc2.right=rc.right/*-1*/; + rc2.top=rc.top+mwSYSMETRICS_CYHSCROLL; + rc2.bottom=start; + if (rc2.bottom>rc2.top) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + rc2.top=start+hwnd->vscroll.barLen; + rc2.bottom=rc.bottom-mwSYSMETRICS_CYHSCROLL; + if (rc2.bottom>rc2.top) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + Draw3dUpFrame (hdc, rcVBar.left, start, rcVBar.right, + start + hwnd->vscroll.barLen); + /*printf("barv:(l,t,r,b):(%d,%d,%d,%d)\n", + rcVBar.left, start, rcVBar.right, + start + hwnd->vscroll.barLen);*/ + } + if (horzbar) { + rc = hwnd->hscroll.rc; + +#if 1 + /* bkgnd */ + rc2.top=rc.top; rc2.bottom=rc2.top+ mwSYSMETRICS_CYHSCROLL; + rc2.left=rc.left; + rc2.right=rc2.left+ mwSYSMETRICS_CXVSCROLL; + FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1)); + rc2.left=rc.right- mwSYSMETRICS_CXVSCROLL; + rc2.right=rc2.left+ mwSYSMETRICS_CXVSCROLL; + FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1)); +#endif + + /* left */ + Draw3dUpDownState(hdc, rc.left, rc.top, + mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL, + hwnd->hscroll.status & SBS_LEFTARROW); + /* right */ + Draw3dUpDownState(hdc, rc.right-mwSYSMETRICS_CXVSCROLL, rc.top, + mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL, + hwnd->hscroll.status & SBS_RIGHTARROW); +/* jmt: draw arrows */ + SelectObject(hdc,GetStockObject(BLACK_BRUSH)); + /* left */ + p3[0].x= rc.left + 2 + shrink; + p3[0].y= rc.top + (mwSYSMETRICS_CYHSCROLL/2) ; + p3[1].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink ; + p3[1].y= rc.top + 2 + shrink; + p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink; + p3[2].y= rc.bottom - 4 - shrink + 1; + Polygon(hdc,p3,3); + /* right */ + p3[0].x= rc.right - 4 - shrink; + p3[0].y= rc.top + (mwSYSMETRICS_CYHSCROLL/2) ; + p3[1].x= rc.right-mwSYSMETRICS_CXVSCROLL + 2 + shrink ; + p3[1].y= rc.top + 2 + shrink; + p3[2].x= rc.right-mwSYSMETRICS_CXVSCROLL + 2 + shrink; + p3[2].y= rc.bottom - 4 - shrink + 1; + Polygon(hdc,p3,3); + + /* draw moving bar. */ + + wndGetHScrollBarRect (hwnd, &rcHBar); + rcHBar.top -- ; + rcHBar.bottom -- ; + + start = rcHBar.left + mwSYSMETRICS_CXHSCROLL + hwnd->hscroll.barStart; + + if (start + hwnd->hscroll.barLen > rcHBar.right) + start = rcHBar.right - hwnd->hscroll.barLen; + + if (hwnd->hscroll.barLen == 0) + hwnd->hscroll.barLen=rc.right-rc.left-(mwSYSMETRICS_CXHSCROLL*2); + + /* bkgnd */ + rc2.top=rc.top; rc2.bottom=rc.bottom/*-1*/; + rc2.left=rc.left+mwSYSMETRICS_CXVSCROLL; + rc2.right=start; + if (rc2.right>rc2.left) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + rc2.left=start+hwnd->hscroll.barLen; + rc2.right=rc.right-mwSYSMETRICS_CXVSCROLL; + if (rc2.right>rc2.left) + FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH)); + + Draw3dUpFrame (hdc, start, rcHBar.top, start + hwnd->hscroll.barLen, + rcHBar.bottom); + /*printf("barh:(l,t,r,b):(%d,%d,%d,%d)\n", + start, rcHBar.top, start + hwnd->hscroll.barLen, + rcHBar.bottom);*/ + + } + + if (fGotDC) + ReleaseDC(hwnd, hdc); +} + +/* handle a non-client message for a scrollbar*/ +void +MwHandleNCMessageScrollbar(HWND hwnd, UINT msg, WPARAM hitcode, LPARAM lParam) +{ + int pos = SBS_UNKNOWN; + BOOL vertbar = VSCROLLBARVISIBLE(hwnd); + BOOL horzbar = HSCROLLBARVISIBLE(hwnd); + int * pStat; + POINT pt; + RECT rc; + + static BOOL bDraw; + + static int downPos = SBS_UNKNOWN; + static int sbCode; + int newThumbPos; + + int itemMoveable,itemCount,itemVisible,moveRange; /* jmt:2k0819 */ + int moveTop,moveBottom,moveLeft,moveRight; /* jmt:2k0819 */ + + POINTSTOPOINT(pt, lParam); + for (;;) { /* use for() to allow break statement*/ + if (hitcode == HTVSCROLL && vertbar) + { + pStat = &hwnd->vscroll.status; + rc = hwnd->vscroll.rc; + rc.bottom = rc.top + mwSYSMETRICS_CYVSCROLL; + if (PtInRect(&rc, pt)) + { + pos = SBS_UPARROW; + break; + } + rc.bottom = hwnd->vscroll.rc.bottom; + rc.top = rc.bottom - mwSYSMETRICS_CYVSCROLL; + if (PtInRect(&rc, pt)) + { + pos = SBS_DOWNARROW; + break; + } + pos = SBS_VERTTHUMB; + } else if (hitcode == HTHSCROLL && horzbar) + { + pStat = &hwnd->hscroll.status; + rc = hwnd->hscroll.rc; + rc.right = rc.left + mwSYSMETRICS_CXHSCROLL; + if (PtInRect(&rc, pt)) { + pos = SBS_LEFTARROW; + break; + } + rc.right = hwnd->hscroll.rc.right; + rc.left = rc.right - mwSYSMETRICS_CXHSCROLL; + if (PtInRect(&rc, pt)) { + pos = SBS_RIGHTARROW; + break; + } + pos = SBS_HORZTHUMB; + } else + return; + break; + } + + if (pos == SBS_UNKNOWN) + return; + + *pStat &= ~SBS_MASK; /* remove stray mouse states*/ + + if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK) /* jmt:2k0819 */ + *pStat |= pos; + else *pStat &= ~pos; + + if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK) /* jmt:2k0819 */ + bDraw=TRUE; + + if (bDraw) + MwPaintNCScrollbars(hwnd, NULL); + + if (pos == SBS_UPARROW || pos == SBS_LEFTARROW) /* jmt:2k0820 */ + { + if (hwnd->vscroll.curPos != hwnd->vscroll.minPos) + sbCode = SB_LINEUP; + } + else if (pos == SBS_DOWNARROW || pos == SBS_RIGHTARROW) /* jmt:2k0820 */ + { + if (hwnd->vscroll.curPos != hwnd->vscroll.maxPos) + sbCode = SB_LINEDOWN; + } + else if (pos == SBS_VERTTHUMB || pos == SBS_HORZTHUMB) + { + sbCode = SB_THUMBTRACK; + } + + switch(msg) + { + case WM_NCLBUTTONDOWN: + case WM_NCLBUTTONDBLCLK: /* jmt:2k0819 */ + downPos = pos; +#if MWCLIENT + InvalidateRect(hwnd,NULL,TRUE); +#endif + break; + + case WM_NCMOUSEMOVE: /* jmt:2k0819 */ + if (hitcode == HTVSCROLL && vertbar) + { + if (sbCode == SB_THUMBTRACK && downPos == SBS_VERTTHUMB) + { + /* jmt(2k0819): new algorithm for SB_THUMBTRACK */ + + rc = hwnd->vscroll.rc; + moveTop = rc.top + mwSYSMETRICS_CYVSCROLL; + moveBottom = hwnd->vscroll.rc.bottom - mwSYSMETRICS_CYVSCROLL; + moveRange = moveBottom - moveTop; + + itemCount = hwnd->vscroll.maxPos - hwnd->vscroll.minPos + 1; + itemVisible = hwnd->vscroll.pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveTop,itemMoveable,moveRange,newThumbPos); + + if ( newThumbPos >= hwnd->vscroll.minPos && + newThumbPos <= hwnd->vscroll.maxPos) + SendMessage (hwnd, + WM_VSCROLL, SB_THUMBTRACK, newThumbPos); + break; + } + } + + if (hitcode == HTHSCROLL && horzbar) + { + if (sbCode == SB_THUMBTRACK && downPos == SBS_HORZTHUMB) + { + /* jmt(2k0819): new algorithm for SB_THUMBTRACK */ + + rc = hwnd->hscroll.rc; + moveLeft = rc.left + mwSYSMETRICS_CXHSCROLL; + moveRight = hwnd->hscroll.rc.right - mwSYSMETRICS_CXHSCROLL; + moveRange = moveRight - moveLeft; + + itemCount = hwnd->hscroll.maxPos - hwnd->hscroll.minPos + 1; + itemVisible = hwnd->hscroll.pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveLeft,itemMoveable,moveRange,newThumbPos); + + if ( newThumbPos >= hwnd->hscroll.minPos && + newThumbPos <= hwnd->hscroll.maxPos) + SendMessage (hwnd, + WM_HSCROLL, SB_THUMBTRACK, newThumbPos); + break; + } + } + + break; + + case WM_NCLBUTTONUP: /* jmt:2k0819 */ + bDraw=FALSE; + downPos = SBS_UNKNOWN; + + if (sbCode==SB_THUMBTRACK) + { + if (hitcode == HTVSCROLL && vertbar) + { + /* jmt(2k0819): new algorithm for SB_THUMBTRACK */ + + rc = hwnd->vscroll.rc; + moveTop = rc.top + mwSYSMETRICS_CYVSCROLL; + moveBottom = hwnd->vscroll.rc.bottom - mwSYSMETRICS_CYVSCROLL; + moveRange = moveBottom - moveTop; + + itemCount = hwnd->vscroll.maxPos - hwnd->vscroll.minPos + 1; + itemVisible = hwnd->vscroll.pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveTop,itemMoveable,moveRange,newThumbPos); + + if ( newThumbPos >= hwnd->vscroll.minPos && + newThumbPos <= hwnd->vscroll.maxPos) + SendMessage (hwnd, + WM_VSCROLL, SB_THUMBTRACK, newThumbPos); + break; + } + + if (hitcode == HTHSCROLL && horzbar) + { + /* jmt(2k0819): new algorithm for SB_THUMBTRACK */ + + rc = hwnd->hscroll.rc; + moveLeft = rc.left + mwSYSMETRICS_CXHSCROLL; + moveRight = hwnd->hscroll.rc.right - mwSYSMETRICS_CXHSCROLL; + moveRange = moveRight - moveLeft; + + itemCount = hwnd->hscroll.maxPos - hwnd->hscroll.minPos + 1; + itemVisible = hwnd->hscroll.pageStep; + itemMoveable = itemCount - itemVisible + 1; + + newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange; + printf("((%d-%d)*%d)/%d=%d\n", + pt.y,moveLeft,itemMoveable,moveRange,newThumbPos); + + if ( newThumbPos >= hwnd->hscroll.minPos && + newThumbPos <= hwnd->hscroll.maxPos) + SendMessage (hwnd, + WM_HSCROLL, SB_THUMBTRACK, newThumbPos); + break; + } + } + else /* jmt:2k0820 */ + { + if (hitcode == HTVSCROLL && vertbar) + SendMessage (hwnd, WM_VSCROLL, sbCode, 0); + + if (hitcode == HTHSCROLL && horzbar) + SendMessage (hwnd, WM_HSCROLL, sbCode, 0); + } + break; + } + +} + + +static BOOL +PtInRect2(const RECT *lprc, int x, int y) +{ + POINT p; + + p.x = x; + p.y = y; + return PtInRect(lprc, p); +} + +#if 1 /* 0000 */ + + +static void +wndScrollBarPos (HWND hwnd, BOOL bIsHBar, RECT* rcBar) +{ + UINT moveRange; + PMWSCROLLBARINFO pSBar; + + if (bIsHBar) + pSBar = &hwnd->hscroll; + else + pSBar = &hwnd->vscroll; + + if (pSBar->minPos == pSBar->maxPos) { + pSBar->status |= SBS_HIDE; + return; + } + + if (bIsHBar) + moveRange = (rcBar->right - rcBar->left) - (mwSYSMETRICS_CXHSCROLL<<1); + else + moveRange = (rcBar->bottom - rcBar->top) - (mwSYSMETRICS_CYVSCROLL<<1); + +#define MWM_DEFBARLEN 18 +#define MWM_MINBARLEN 8 + + if (pSBar->pageStep == 0) + { + pSBar->barLen = MWM_DEFBARLEN; + + if (pSBar->barLen > moveRange) + pSBar->barLen = MWM_MINBARLEN; + } + else + { + pSBar->barLen = moveRange * pSBar->pageStep / + (pSBar->maxPos - pSBar->minPos + 1); + if (pSBar->barLen < MWM_MINBARLEN) + pSBar->barLen = MWM_MINBARLEN; + } + + pSBar->barStart = moveRange * (pSBar->curPos - pSBar->minPos) / + (pSBar->maxPos - pSBar->minPos + 1); + + + if (pSBar->barStart + pSBar->barLen > moveRange) + pSBar->barStart = moveRange - pSBar->barLen; + + + if (pSBar->barStart < 0) + pSBar->barStart = 0; +} + +static PMWSCROLLBARINFO wndGetScrollBar (HWND pWin, int iSBar) +{ + if (iSBar == SB_HORZ) { + if (pWin->style & WS_HSCROLL) + return &pWin->hscroll; + } + else if (iSBar == SB_VERT) { + if (pWin->style & WS_VSCROLL) + return &pWin->vscroll; + } + + return NULL; +} + +BOOL EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + BOOL bPrevState; + RECT rcBar; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + bPrevState = !(pSBar->status & SBS_DISABLED); + + if (bEnable && !bPrevState) + pSBar->status &= ~SBS_DISABLED; + else if (!bEnable && bPrevState) + pSBar->status |= SBS_DISABLED; + else + return FALSE; + + if (iSBar == SB_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintNCScrollbars(hWnd,NULL); /* a must */ +#endif + + return TRUE; +} + +BOOL GetScrollPos (HWND hWnd, int iSBar, int* pPos) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + *pPos = pSBar->curPos; + return TRUE; +} + +BOOL GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + *pMinPos = pSBar->minPos; + *pMaxPos = pSBar->maxPos; + return TRUE; +} + +BOOL SetScrollPos (HWND hWnd, int iSBar, int iNewPos) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + RECT rcBar; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + if (iNewPos < pSBar->minPos) + pSBar->curPos = pSBar->minPos; + else + pSBar->curPos = iNewPos; + + { + int max = pSBar->maxPos; + max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0; + + if (pSBar->curPos > max) + pSBar->curPos = max; + } + + if (iSBar == SB_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } + + wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar); + +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintNCScrollbars(hWnd,NULL); /* a must */ +#endif + return TRUE; +} + +BOOL SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + RECT rcBar; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + pSBar->minPos = (iMinPos < iMaxPos)?iMinPos:iMaxPos; + pSBar->maxPos = (iMinPos > iMaxPos)?iMinPos:iMaxPos; + + /* validate parameters. */ + if (pSBar->curPos < pSBar->minPos) + pSBar->curPos = pSBar->minPos; + + if (pSBar->pageStep <= 0) + pSBar->pageStep = 0; + else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1)) + pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1; + + { + int max = pSBar->maxPos; + max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0; + + if (pSBar->curPos > max) + pSBar->curPos = max; + } + + if (iSBar == SB_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } + wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar); + +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintNCScrollbars(hWnd,NULL); /* a must */ +#endif + + return TRUE; +} + +BOOL SetScrollInfo (HWND hWnd, int iSBar, + LPCSCROLLINFO lpsi, BOOL fRedraw) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + RECT rcBar; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + if( lpsi->fMask & SIF_RANGE ) + { + pSBar->minPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMin:lpsi->nMax; + pSBar->maxPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMax:lpsi->nMin; + } + + if( lpsi->fMask & SIF_POS ) + pSBar->curPos = lpsi->nPos; + + if( lpsi->fMask & SIF_PAGE ) + pSBar->pageStep = lpsi->nPage; + + /* validate parameters. */ + if (pSBar->curPos < pSBar->minPos) + pSBar->curPos = pSBar->minPos; + + if (pSBar->pageStep <= 0) + pSBar->pageStep = 0; + else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1)) + pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1; + + { + int max = pSBar->maxPos; + max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0; + + if (pSBar->curPos > max) + pSBar->curPos = max; + } + + if(fRedraw) + { + if (iSBar == SB_VERT) + { + wndGetVScrollBarRect (pWin, &rcBar); + rcBar.left --; + rcBar.right --; + } + else + { + wndGetHScrollBarRect (pWin, &rcBar); + rcBar.top --; + rcBar.bottom --; + } + wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar); + +#if 0 + SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar)); +#else + MwPaintNCScrollbars(hWnd,NULL); /* a must */ +#endif + } + + return TRUE; +} + +BOOL GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + if( lpsi->fMask & SIF_RANGE ) + { + lpsi->nMin = pSBar->minPos; + lpsi->nMax = pSBar->maxPos; + } + + if( lpsi->fMask & SIF_POS ) + { + lpsi->nPos = pSBar->curPos; + } + + if( lpsi->fMask & SIF_PAGE ) + lpsi->nPage = pSBar->pageStep; + + return TRUE; +} + +BOOL ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow) +{ + PMWSCROLLBARINFO pSBar; + HWND pWin; + BOOL bPrevState; + RECT rcBar; + + pWin = (HWND)hWnd; + + if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) ) + return FALSE; + + bPrevState = !(pSBar->status & SBS_HIDE); + + if (bShow && !bPrevState) + pSBar->status &= ~SBS_HIDE; + else if (!bShow && bPrevState) + pSBar->status |= SBS_HIDE; + else + return FALSE; +#if 0 /* fix: no WM_CHANGESIZE */ + SendMessage (hWnd, WM_CHANGESIZE, 0, 0); +#endif + if (iSBar == SB_VERT) + wndGetVScrollBarRect (pWin, &rcBar); + else + wndGetHScrollBarRect (pWin, &rcBar); + + { + RECT rcWin, rcClient; + + memcpy (&rcWin, &pWin->winrect.left, sizeof (RECT)); + + rcClient.left = 0; + rcClient.top = 0; + rcClient.right = pWin->clirect.right - pWin->clirect.left; + rcClient.bottom = pWin->clirect.bottom - pWin->clirect.top; +#if 0 /* fix: no WM_SIZECHANGED */ + SendMessage/*SendAsyncMessage*/ (hWnd, WM_SIZECHANGED, + (WPARAM)&rcWin, (LPARAM)&rcClient); +#endif + } + + if (bShow) { + SendMessage (hWnd, WM_NCPAINT, 0, 0); + } + else { + rcBar.left -= pWin->clirect.left; + rcBar.top -= pWin->clirect.top; + rcBar.right -= pWin->clirect.left; + rcBar.bottom -= pWin->clirect.top; + SendMessage (hWnd, WM_NCPAINT, 0, 0); + InvalidateRect (hWnd, &rcBar, TRUE); + } + + return TRUE; +} +#endif diff --git a/packages/services/gfx/mw/current/src/mwin/winuser.c b/packages/services/gfx/mw/current/src/mwin/winuser.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/mwin/winuser.c @@ -0,0 +1,1420 @@ +/* + * Copyright (c) 1999 Greg Haerr + * + * Win32 API upper level window creation, management and msg routines + */ +#include "windows.h" +#include "wintern.h" +#include "device.h" +#include +#include + +#define PAINTONCE 1 /* =1 to queue paint msgs only once*/ +#define MOUSETEST 1 + +MWLISTHEAD mwMsgHead; /* application msg queue*/ +MWLISTHEAD mwClassHead; /* register class list*/ + +int mwSYSMETRICS_CYCAPTION = 12; /* Y caption height*/ +int mwSYSMETRICS_CXFRAME = 3; /* width of frame border*/ +int mwSYSMETRICS_CYFRAME = 3; /* height of frame border*/ +int mwSYSMETRICS_CXBORDER = 1; /* width of single border*/ +int mwSYSMETRICS_CYBORDER = 1; /* width of single border*/ +int mwSYSMETRICS_CXVSCROLL = 13; /* width of vertical scrollbar*/ +int mwSYSMETRICS_CYHSCROLL = 13; /* height of horizontal scrollbar*/ +int mwSYSMETRICS_CXHSCROLL = 13; /* width of arrow on horz scrollbar*/ +int mwSYSMETRICS_CYVSCROLL = 13; /* height of arrow on vert scrollbar*/ +int mwSYSMETRICS_CXDOUBLECLK = 2; /* +/- X double click position*/ +int mwSYSMETRICS_CYDOUBLECLK = 2; /* +/- Y double click position*/ +int mwpaintSerial = 1; /* experimental alphablend sequencing*/ +int mwpaintNC = 1; /* experimental NC paint handling*/ +BOOL mwforceNCpaint = FALSE; /* force NC paint when alpha blending*/ + +static void MwOffsetChildren(HWND hwnd, int offx, int offy); + +LRESULT WINAPI +CallWindowProc(WNDPROC lpPrevWndFunc, HWND hwnd, UINT Msg, WPARAM wParam, + LPARAM lParam) +{ + return (*lpPrevWndFunc)(hwnd, Msg, wParam, lParam); +} + +LRESULT WINAPI +SendMessage(HWND hwnd, UINT Msg,WPARAM wParam,LPARAM lParam) +{ + if(hwnd && hwnd->pClass) { + hwnd->paintSerial = mwpaintSerial; /* assign msg sequence #*/ + return (*hwnd->pClass->lpfnWndProc)(hwnd, Msg, wParam, lParam); + } + return 0; +} + +BOOL WINAPI +PostMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + MSG * pMsg; + +#if PAINTONCE + /* don't queue paint msgs, set window paint status instead*/ + if(Msg == WM_PAINT) { + hwnd->gotPaintMsg = PAINT_NEEDSPAINT; + return TRUE; + } +#endif +#if MOUSETEST + /* replace multiple mouse messages with one for better mouse handling*/ + if(Msg == WM_MOUSEMOVE) { + PMWLIST p; + for(p=mwMsgHead.head; p; p=p->next) { + pMsg = GdItemAddr(p, MSG, link); + if(pMsg->hwnd == hwnd && pMsg->message == Msg) { + pMsg->wParam = wParam; + pMsg->lParam = lParam; + pMsg->time = GetTickCount(); + pMsg->pt.x = cursorx; + pMsg->pt.y = cursory; + return TRUE; + } + } + } +#endif + pMsg = GdItemNew(MSG); + if(!pMsg) + return FALSE; + pMsg->hwnd = hwnd; + pMsg->message = Msg; + pMsg->wParam = wParam; + pMsg->lParam = lParam; + pMsg->time = GetTickCount(); + pMsg->pt.x = cursorx; + pMsg->pt.y = cursory; + GdListAdd(&mwMsgHead, &pMsg->link); + return TRUE; +} + +/* currently, we post to the single message queue, regardless of thread*/ +BOOL WINAPI +PostThreadMessage(DWORD dwThreadId, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + return PostMessage(NULL, Msg, wParam, lParam); +} + +VOID WINAPI +PostQuitMessage(int nExitCode) +{ + PostMessage(NULL, WM_QUIT, nExitCode, 0L); +} + +static BOOL +chkPaintMsg(HWND wp, LPMSG lpMsg) +{ + /* + * Tricky: only repaint window if there + * isn't a mouse capture (window move) in progress, + * or the window is the moving window. + */ + if(wp->gotPaintMsg == PAINT_NEEDSPAINT && + (!dragwp || dragwp == wp)) { + paint: + wp->gotPaintMsg = PAINT_PAINTED; + lpMsg->hwnd = wp; + lpMsg->message = WM_PAINT; + lpMsg->wParam = 0; + lpMsg->lParam = 0; + lpMsg->time = 0; + lpMsg->pt.x = cursorx; + lpMsg->pt.y = cursory; + return TRUE; + } else if(dragwp && wp->gotPaintMsg == PAINT_NEEDSPAINT) { + /* All other windows we'll check for + * event input first, then allow repaint. + */ + MwSelect(); + if(mwMsgHead.head == NULL) + goto paint; + } + return FALSE; +} + +BOOL WINAPI +PeekMessage(LPMSG lpMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, + UINT wRemoveMsg) +{ + HWND wp; + PMSG pNxtMsg; + + /* check if no messages in queue*/ + if(mwMsgHead.head == NULL) { +#if PAINTONCE + /* check all windows for pending paint messages*/ + for(wp=listwp; wp; wp=wp->next) { + if(!(wp->style & WS_CHILD)) { + if(chkPaintMsg(wp, lpMsg)) + return TRUE; + } + } + for(wp=listwp; wp; wp=wp->next) { + if(wp->style & WS_CHILD) { + if(chkPaintMsg(wp, lpMsg)) + return TRUE; + } + } +#endif + MwSelect(); + } + + if(mwMsgHead.head == NULL) + return FALSE; + + pNxtMsg = (PMSG)mwMsgHead.head; + if(wRemoveMsg & PM_REMOVE) + GdListRemove(&mwMsgHead, &pNxtMsg->link); + *lpMsg = *pNxtMsg; + if(wRemoveMsg & PM_REMOVE) + GdItemFree(pNxtMsg); + return TRUE; +} + +BOOL WINAPI +GetMessage(LPMSG lpMsg,HWND hwnd,UINT wMsgFilterMin,UINT wMsgFilterMax) +{ + /* + * currently MwSelect() must poll for VT switch reasons, + * so this code will work + */ + while(!PeekMessage(lpMsg, hwnd, wMsgFilterMin, wMsgFilterMax,PM_REMOVE)) + continue; + return lpMsg->message != WM_QUIT; +} + +BOOL WINAPI +TranslateMessage(CONST MSG *lpMsg) +{ + return FALSE; +} + +LONG WINAPI +DispatchMessage(CONST MSG *lpMsg) +{ + return SendMessage(lpMsg->hwnd, lpMsg->message, lpMsg->wParam, + lpMsg->lParam); +} + +/* find the registered window class struct by name*/ +PWNDCLASS +MwFindClassByName(LPCSTR lpClassName) +{ + PMWLIST p; + PWNDCLASS pClass; + + for(p=mwClassHead.head; p; p=p->next) { + pClass = GdItemAddr(p, WNDCLASS, link); + if(strcmpi(pClass->szClassName, lpClassName) == 0) + return pClass; + } + return NULL; +} + +ATOM WINAPI +RegisterClass(CONST WNDCLASS *lpWndClass) +{ + PWNDCLASS pClass; + + /* check if already present*/ + pClass = MwFindClassByName(lpWndClass->lpszClassName); + if(pClass) + return 0; + + /* copy class into new struct*/ + pClass = GdItemNew(WNDCLASS); + if(!pClass) + return 0; + *pClass = *lpWndClass; + strcpy(pClass->szClassName, lpWndClass->lpszClassName); + GdListAdd(&mwClassHead, &pClass->link); + + return 1; +} + +BOOL WINAPI +UnregisterClass(LPCSTR lpClassName, HINSTANCE hInstance) +{ + PWNDCLASS pClass; + + pClass = MwFindClassByName(lpClassName); + if(!pClass) + return FALSE; + GdListRemove(&mwClassHead, &pClass->link); + DeleteObject(pClass->hbrBackground); + GdItemFree(pClass); + return TRUE; +} + +HWND WINAPI +CreateWindowEx(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, + DWORD dwStyle, int x, int y, int nWidth, int nHeight, + HWND hwndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) +{ + HWND pwp; /* parent window */ + HWND wp; /* new window */ + HWND hwndOwner; + PWNDCLASS pClass; + CREATESTRUCT cs; + static int nextx = 20; + static int nexty = 20; + + pClass = MwFindClassByName(lpClassName); + if(!pClass) + return NULL; + + if(x == CW_USEDEFAULT || y == CW_USEDEFAULT) { + x = nextx; + nextx += 10; + y = nexty; + nexty += 10; + if(nextx > 200) + nextx = nexty = 20; + } + if(nWidth == CW_USEDEFAULT || nHeight == CW_USEDEFAULT) { + nWidth = 250; + nHeight = 250; + } + + if(hwndParent == NULL) { + if(dwStyle & WS_CHILD) + return NULL; + pwp = rootwp; + } else + pwp = hwndParent; + + /* WS_POPUP z-order parent is the root window (passed parent is owner)*/ + if(dwStyle & WS_POPUP) + pwp = rootwp; /* force clip to root, not z-parent*/ + + /* window owner is NULL for child windows, else it's the passed parent*/ + if(dwStyle & WS_CHILD) + hwndOwner = NULL; + else hwndOwner = hwndParent; + + wp = (HWND)GdItemAlloc(sizeof(struct hwnd) - 1 + pClass->cbWndExtra); + if(!wp) + return NULL; + + /* force all clipping on by default*/ + dwStyle |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN; + + wp->pClass = pClass; + wp->style = dwStyle; + wp->exstyle = dwExStyle; + wp->parent = pwp; + wp->owner = hwndOwner; + wp->children = NULL; + wp->siblings = pwp->children; + pwp->children = wp; + wp->next = listwp; + listwp = wp; + wp->winrect.left = pwp->clirect.left + x; + wp->winrect.top = pwp->clirect.top + y; + wp->winrect.right = wp->winrect.left + nWidth; + wp->winrect.bottom = wp->winrect.top + nHeight; + wp->cursor = pwp->cursor; + wp->cursor->usecount++; + wp->unmapcount = pwp->unmapcount + 1; + wp->id = (int)hMenu; + wp->gotPaintMsg = PAINT_PAINTED; + strzcpy(wp->szTitle, lpWindowName, sizeof(wp->szTitle)); +#if UPDATEREGIONS + wp->update = GdAllocRegion(); +#endif + wp->nextrabytes = pClass->cbWndExtra; + + /* calculate client area*/ + MwCalcClientRect(wp); + + cs.lpCreateParams = lpParam; + cs.hInstance = hInstance; + cs.hMenu = hMenu; + cs.hwndParent = hwndParent; + cs.cy = nHeight; + cs.cx = nWidth; + cs.y = y; + cs.x = x; + cs.style = dwStyle; + cs.lpszName = lpWindowName; + cs.lpszClass = lpClassName; + cs.dwExStyle = dwExStyle; + + if(SendMessage(wp, WM_CREATE, 0, (LPARAM)(LPSTR)&cs) == -1) { + MwDestroyWindow(wp, FALSE); + return NULL; + } + + /* send SIZE and MOVE msgs*/ + MwSendSizeMove(wp, TRUE, TRUE); + + if(wp->style & WS_VISIBLE) { + MwShowWindow(wp, TRUE); + SetFocus(wp); + } + + return wp; +} + +BOOL WINAPI +DestroyWindow(HWND hwnd) +{ + MwDestroyWindow(hwnd, TRUE); + return TRUE; +} + +/* + * Destroy the specified window, and all of its children. + * This is a recursive routine. + */ +void +MwDestroyWindow(HWND hwnd,BOOL bSendMsg) +{ + HWND wp = hwnd; + HWND prevwp; + PMWLIST p; + PMSG pmsg; + + if (wp == rootwp) + return; + + /* + * Unmap the window. + */ + if (wp->unmapcount == 0) + MwHideWindow(wp, FALSE, FALSE); + + if(bSendMsg) + SendMessage(hwnd, WM_DESTROY, 0, 0L); + + /* + * Disable all sendmessages to this window. + */ + wp->pClass = NULL; + + /* + * Destroy all children, sending WM_DESTROY messages. + */ + while (wp->children) + MwDestroyWindow(wp->children, bSendMsg); + + /* + * Free any cursor associated with the window. + */ + if (wp->cursor->usecount-- == 1) { + free(wp->cursor); + wp->cursor = NULL; + } + + /* + * Remove this window from the child list of its parent. + */ + prevwp = wp->parent->children; + if (prevwp == wp) + wp->parent->children = wp->siblings; + else { + while (prevwp->siblings != wp) + prevwp = prevwp->siblings; + prevwp->siblings = wp->siblings; + } + wp->siblings = NULL; + + /* + * Remove this window from the complete list of windows. + */ + prevwp = listwp; + if (prevwp == wp) + listwp = wp->next; + else { + while (prevwp->next != wp) + prevwp = prevwp->next; + prevwp->next = wp->next; + } + wp->next = NULL; + + /* + * Forget various information related to this window. + * Then finally free the structure. + */ + + /* Remove all messages from msg queue for this window*/ + for(p=mwMsgHead.head; p; ) { + pmsg = GdItemAddr(p, MSG, link); + if(pmsg->hwnd == wp) { + p = p->next; + GdListRemove(&mwMsgHead, &pmsg->link); + GdItemFree(p); + } else + p = p->next; + } + + /* FIXME: destroy hdc's relating to window?*/ + + if (wp == capturewp) { + capturewp = NULL; + MwCheckMouseWindow(); + } + + if (wp == MwGetTopWindow(focuswp)) + SetFocus(rootwp->children? rootwp->children: rootwp); + + /* destroy private DC*/ + if(wp->owndc) { + HDC hdc = wp->owndc; + wp->owndc = NULL; /* force destroy with ReleaseDC*/ + ReleaseDC(wp, hdc); + } +#if UPDATEREGIONS + GdDestroyRegion(wp->update); +#endif + GdItemFree(wp); +} + +BOOL WINAPI +IsWindow(HWND hwnd) +{ + HWND wp; + + for(wp=listwp; wp; wp=wp->next) + if(wp == hwnd) + return TRUE; + return FALSE; +} + +BOOL WINAPI +ShowWindow(HWND hwnd, int nCmdShow) +{ + if(!hwnd) + return FALSE; + + /* fix: send show msg*/ + + switch(nCmdShow) { + case SW_HIDE: + if (!(hwnd->style & WS_VISIBLE)) + return FALSE; + MwHideWindow(hwnd, TRUE, TRUE); + hwnd->style &= ~WS_VISIBLE; + break; + + default: + if (hwnd->style & WS_VISIBLE) + return FALSE; + hwnd->style |= WS_VISIBLE; + MwShowWindow(hwnd, TRUE); + } + return TRUE; +} + +BOOL WINAPI +InvalidateRect(HWND hwnd, CONST RECT *lpRect, BOOL bErase) +{ + /* FIXME: handle bErase*/ + if(!hwnd) + MwRedrawScreen(); + else { +#if UPDATEREGIONS + RECT rc; + + /* add to update region*/ + if(!lpRect) + GetClientRect(hwnd, &rc); + else rc = *lpRect; + rc.bottom += mwSYSMETRICS_CYCAPTION + + mwSYSMETRICS_CYFRAME + 1; + rc.right += mwSYSMETRICS_CXFRAME; + MwUnionUpdateRegion(hwnd, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, TRUE); + + /* if update region not empty, mark as needing painting*/ + if(hwnd->update->numRects != 0) +#endif + if(hwnd->gotPaintMsg == PAINT_PAINTED) + hwnd->gotPaintMsg = PAINT_NEEDSPAINT; + } + return TRUE; +} + +#if UPDATEREGIONS +/* add region to window update region*/ +BOOL WINAPI +InvalidateRgn(HWND hwnd, HRGN hrgn, BOOL bErase) +{ + /* FIXME: handle bErase*/ + if(hwnd) { + if(!hrgn) + /* add client area to update region*/ + return InvalidateRect(hwnd, NULL, bErase); + + /* passed region is in client coords, convert to screen*/ + GdOffsetRegion(((MWRGNOBJ *)hrgn)->rgn, + hwnd->clirect.left, hwnd->clirect.top); + GdUnionRegion(hwnd->update, hwnd->update, + ((MWRGNOBJ *)hrgn)->rgn); + GdOffsetRegion(((MWRGNOBJ *)hrgn)->rgn, + -hwnd->clirect.left, -hwnd->clirect.top); + + /* if update region not empty, mark as needing painting*/ + if(hwnd->update->numRects != 0) + if(hwnd->gotPaintMsg == PAINT_PAINTED) + hwnd->gotPaintMsg = PAINT_NEEDSPAINT; + } + return TRUE; +} + +BOOL WINAPI +ValidateRect(HWND hwnd, CONST RECT *lprc) +{ + RECT rc; + + if(!hwnd) + MwRedrawScreen(); + else { + /* subtract from update region*/ + if(!lprc) + GetClientRect(hwnd, &rc); + else rc = *lprc; + rc.bottom += mwSYSMETRICS_CYCAPTION + + mwSYSMETRICS_CYFRAME + 1; + rc.right += mwSYSMETRICS_CXFRAME; + MwUnionUpdateRegion(hwnd, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, FALSE); + + /* if update region empty, mark window as painted*/ + if(hwnd->update->numRects == 0) + if(hwnd->gotPaintMsg == PAINT_NEEDSPAINT) + hwnd->gotPaintMsg = PAINT_PAINTED; + } + return TRUE; +} + +/* remove region from window update region*/ +BOOL WINAPI +ValidateRgn(HWND hwnd, HRGN hrgn) +{ + if(hwnd) { + if(!hrgn) + /* remove client area from update region*/ + return ValidateRect(hwnd, NULL); + + /* passed region is in client coords, convert to screen*/ + GdOffsetRegion(((MWRGNOBJ *)hrgn)->rgn, + hwnd->clirect.left, hwnd->clirect.top); + GdSubtractRegion(hwnd->update, hwnd->update, + ((MWRGNOBJ *)hrgn)->rgn); + GdOffsetRegion(((MWRGNOBJ *)hrgn)->rgn, + -hwnd->clirect.left, -hwnd->clirect.top); + + /* if update region empty, mark window as painted*/ + if(hwnd->update->numRects == 0) + if(hwnd->gotPaintMsg == PAINT_NEEDSPAINT) + hwnd->gotPaintMsg = PAINT_PAINTED; + } + return TRUE; +} +#endif /* UPDATEREGIONS*/ + +BOOL WINAPI +UpdateWindow(HWND hwnd) +{ +#if PAINTONCE + if(hwnd && hwnd->gotPaintMsg == PAINT_NEEDSPAINT) { + SendMessage(hwnd, WM_PAINT, 0, 0L); + hwnd->gotPaintMsg = PAINT_PAINTED; + return TRUE; + } + return FALSE; +#else + /* fix: remove other paint messages from queue*/ + SendMessage(hwnd, WM_PAINT, 0, 0L); + return TRUE; +#endif +} + +HWND WINAPI +GetFocus(VOID) +{ + return focuswp; +} + +HWND WINAPI +SetFocus(HWND hwnd) +{ + HWND oldfocus; + HWND top, top2; + + /* if NULL or hidden, set focus to desktop*/ + if(!hwnd || hwnd->unmapcount) + hwnd = rootwp; + + if(hwnd == focuswp) + return focuswp; + + oldfocus = focuswp; + SendMessage(oldfocus, WM_KILLFOCUS, (WPARAM)hwnd, 0L); + focuswp = hwnd; + SendMessage(focuswp, WM_SETFOCUS, (WPARAM)oldfocus, 0L); + + /* FIXME SetActiveWindow() here?*/ + top = MwGetTopWindow(oldfocus); + top2 = MwGetTopWindow(focuswp); + if(top2 != top) { + /* send deactivate*/ + SendMessage(top, WM_ACTIVATE, (WPARAM)MAKELONG(WA_INACTIVE, 0), + (LPARAM)top2); + /* repaint captions*/ + MwPaintNCArea(top); +#if 0 + /* Make sure that caption area is fully invalidated, + * as repaint will be in active color. + * FIXME: this doesn't work; breaks terminal emulator + * on focus out/in + */ + MwUnionUpdateRegion(top2, 0, 0, + top2->winrect.right-top2->winrect.left, + mwSYSMETRICS_CYCAPTION+4, TRUE); +#endif + /* send deactivate*/ + SendMessage(top, WM_ACTIVATE, (WPARAM)MAKELONG(WA_ACTIVE, 0), + (LPARAM)top); + MwPaintNCArea(top2); + } + + return oldfocus; +} + +/* the foreground window is the top level window at the top of the z order*/ +/* setting the foreground window sets focus and moves window to top*/ +BOOL WINAPI +SetForegroundWindow(HWND hwnd) +{ + /* activate (set focus to) specified window*/ + SetFocus(hwnd); + + /* raise top level parent to top of z order*/ + SetWindowPos(MwGetTopWindow(hwnd), HWND_TOP, 0, 0, 0, 0, + SWP_NOMOVE|SWP_NOSIZE); + + return TRUE; +} + +/* our SetActiveWindow is the same as SetFocus, no z order change*/ +HWND WINAPI +SetActiveWindow(HWND hwnd) +{ + HWND oldActive; + + oldActive = GetActiveWindow(); + SetFocus(hwnd); /* WM_ACTIVATE sent by SetFocus*/ + return oldActive; +} + +/* The active window is the first non-child ancestor of focus window*/ +HWND WINAPI +GetActiveWindow(VOID) +{ + return MwGetTopWindow(focuswp); +} + +/* activate the top level window associated with window*/ +BOOL WINAPI +BringWindowToTop(HWND hwnd) +{ + return SetForegroundWindow(hwnd); +} + +HWND WINAPI +GetDesktopWindow(VOID) +{ + return rootwp; +} + +HWND +MwGetTopWindow(HWND hwnd) +{ + while(hwnd->style & WS_CHILD) + hwnd = hwnd->parent; + return hwnd; +} + +HWND WINAPI +GetParent(HWND hwnd) +{ + /* top level windows return NULL instead of rootwp*/ + if(!hwnd || !(hwnd->style & (WS_POPUP|WS_CHILD))) + return NULL; /* toplevel window*/ + if(hwnd->style & WS_POPUP) + return hwnd->owner; /* popup window*/ + return hwnd->parent; /* child window*/ +} + +BOOL WINAPI +EnableWindow(HWND hwnd, BOOL bEnable) +{ + if(bEnable && (hwnd->style & WS_DISABLED)) { + /* enable window*/ + hwnd->style &= ~WS_DISABLED; + SendMessage(hwnd, WM_ENABLE, TRUE, 0L); + return TRUE; + } + if(!bEnable && !(hwnd->style & WS_DISABLED)) { + /* disable window*/ + hwnd->style |= WS_DISABLED; + /* FIXME: handle lost focus for child window of hwnd*/ + /* FIXME: handle lost focus for capture window*/ + if(hwnd == focuswp) + SetFocus(NULL); + SendMessage(hwnd, WM_ENABLE, FALSE, 0L); + return FALSE; + } + return (hwnd->style & WS_DISABLED) != 0; +} + +/* calc window rect from client rect in screen coords*/ +BOOL WINAPI +AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle) +{ + int yoffset; + + if(dwStyle & WS_BORDER) { + if((dwStyle & WS_CAPTION) == WS_CAPTION) { + InflateRect(lpRect, mwSYSMETRICS_CXFRAME, + mwSYSMETRICS_CYFRAME); + yoffset = mwSYSMETRICS_CYCAPTION + 1; + lpRect->top -= yoffset; + lpRect->bottom -= yoffset; + } else + InflateRect(lpRect, 1, 1); + + /* make sure upper left is on screen*/ + if(lpRect->left < 0) { + lpRect->right -= lpRect->left; + lpRect->left = 0; + } + if(lpRect->top < 0) { + lpRect->bottom -= lpRect->top; + lpRect->top = 0; + } + } + return TRUE; +} + +/* set the client rect for a window from the window position*/ +void +MwCalcClientRect(HWND hwnd) +{ + NCCALCSIZE_PARAMS nccs; + + /* set first rectangle to window rect*/ + nccs.rgrc[0] = hwnd->winrect; + SendMessage(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)(LPSTR)&nccs); + hwnd->clirect = nccs.rgrc[0]; + + /* adjust client area if scrollbar(s) visible*/ + MwAdjustNCScrollbars(hwnd); +} + +BOOL WINAPI +GetClientRect(HWND hwnd, LPRECT lpRect) +{ + if(!hwnd || !lpRect) + return FALSE; + + /* convert client area rect from screen coordinates*/ + lpRect->left = 0; + lpRect->top = 0; + lpRect->right = hwnd->clirect.right - hwnd->clirect.left; + lpRect->bottom = hwnd->clirect.bottom - hwnd->clirect.top; + return TRUE; +} + +BOOL WINAPI +GetWindowRect(HWND hwnd, LPRECT lpRect) +{ + if(!hwnd || !lpRect) + return FALSE; + + /* window rect is already in screen coordinates*/ + *lpRect = hwnd->winrect; + return TRUE; +} + +BOOL WINAPI +ClientToScreen(HWND hwnd, LPPOINT lpPoint) +{ + if(!hwnd || !lpPoint) + return FALSE; + MapWindowPoints(hwnd, NULL, lpPoint, 1); + return TRUE; +} + +BOOL WINAPI +ScreenToClient(HWND hwnd, LPPOINT lpPoint) +{ + if(!hwnd || !lpPoint) + return FALSE; + MapWindowPoints(NULL, hwnd, lpPoint, 1); + return TRUE; +} + +int WINAPI +MapWindowPoints(HWND hwndFrom, HWND hwndTo, LPPOINT lpPoints, UINT cPoints) +{ + MWCOORD offx = 0; + MWCOORD offy = 0; + + /* map src window to screen coords*/ + if(hwndFrom) { + offx = hwndFrom->clirect.left; + offy = hwndFrom->clirect.top; + } + + /* map to dst window client coords*/ + if(hwndTo) { + offx -= hwndTo->clirect.left; + offy -= hwndTo->clirect.top; + } + + /* adjust points*/ + while(cPoints--) { + lpPoints->x += offx; + lpPoints->y += offy; + ++lpPoints; + } + return (int)MAKELONG(offx, offy); +} + +BOOL WINAPI +SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom) +{ + lprc->left = xLeft; + lprc->top = yTop; + lprc->right = xRight; + lprc->bottom = yBottom; + return TRUE; +} + +BOOL WINAPI +SetRectEmpty(LPRECT lprc) +{ + lprc->left = lprc->right = lprc->top = lprc->bottom = 0; + return TRUE; +} + +BOOL WINAPI +CopyRect(LPRECT lprcDst, CONST RECT *lprcSrc) +{ + *lprcDst = *lprcSrc; + return TRUE; +} + +BOOL WINAPI +IsRectEmpty(CONST RECT *lprc) +{ + /* FIXME: should this just be ==, not <= ?*/ + /*return lprc->left == lprc->right || lprc->top == lprc->bottom;*/ + return lprc->right <= lprc->left || lprc->bottom <= lprc->top; +} + +BOOL WINAPI +InflateRect(LPRECT lprc, int dx, int dy) +{ + lprc->left -= dx; + lprc->top -= dy; + lprc->right += dx; + lprc->bottom += dy; + return TRUE; +} + +BOOL WINAPI +OffsetRect(LPRECT lprc, int dx, int dy) +{ + lprc->left += dx; + lprc->right += dx; + lprc->top += dy; + lprc->bottom += dy; + return TRUE; +} + +/* PtInRect is #defined to MwPTINRECT because of bcc struct passing bug*/ +BOOL WINAPI +MwPTINRECT(CONST RECT *lprc, POINT pt) +{ + return (pt.x >= lprc->left && pt.x < lprc->right && + pt.y >= lprc->top && pt.y < lprc->bottom); +} + +LONG WINAPI +GetWindowLong(HWND hwnd, int nIndex) +{ + switch(nIndex) { + case GWL_WNDPROC: + return (LONG)hwnd->pClass->lpfnWndProc; + case GWL_HINSTANCE: + /* nyi*/ + break; + case GWL_HWNDPARENT: + return (LONG)hwnd->parent; + case GWL_ID: + return hwnd->id; + case GWL_STYLE: + return hwnd->style; + case GWL_EXSTYLE: + return hwnd->exstyle; + case GWL_USERDATA: + return hwnd->userdata; + default: + if(nIndex+3 < hwnd->nextrabytes) + return *(LONG *)&hwnd->extrabytes[nIndex]; + } + return 0; +} + +LONG WINAPI +SetWindowLong(HWND hwnd, int nIndex, LONG lNewLong) +{ + LONG oldval = 0; + + switch(nIndex) { + case GWL_USERDATA: + oldval = hwnd->userdata; + hwnd->userdata = lNewLong; + break; + case GWL_WNDPROC: + oldval = (LONG)hwnd->pClass->lpfnWndProc; + hwnd->pClass->lpfnWndProc = (WNDPROC)lNewLong; + break; + case GWL_HINSTANCE: + case GWL_HWNDPARENT: + case GWL_ID: + case GWL_STYLE: + case GWL_EXSTYLE: + /* nyi*/ + break; + default: + if(nIndex+3 < hwnd->nextrabytes) { + oldval = GetWindowLong(hwnd, nIndex); + *(LONG *)&hwnd->extrabytes[nIndex] = lNewLong; + } + break; + } + return oldval; +} + +WORD WINAPI +GetWindowWord(HWND hwnd, int nIndex) +{ + if(nIndex+1 < hwnd->nextrabytes) + return *(WORD *)&hwnd->extrabytes[nIndex]; + return 0; +} + +WORD WINAPI +SetWindowWord(HWND hwnd, int nIndex, WORD wNewWord) +{ + WORD oldval = 0; + + if(nIndex+1 < hwnd->nextrabytes) { + oldval = GetWindowWord(hwnd, nIndex); + *(WORD *)&hwnd->extrabytes[nIndex] = wNewWord; + } + return oldval; +} + +DWORD WINAPI +GetClassLong(HWND hwnd, int nIndex) +{ + switch(nIndex) { + case GCL_HBRBACKGROUND: + return (DWORD)hwnd->pClass->hbrBackground; + case GCL_CBWNDEXTRA: + return (DWORD)hwnd->pClass->cbWndExtra; + } + return 0; +} + +int WINAPI +GetWindowTextLength(HWND hwnd) +{ + return SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0L); +} + +int WINAPI +GetWindowText(HWND hwnd, LPSTR lpString, int nMaxCount) +{ + return SendMessage(hwnd, WM_GETTEXT, nMaxCount,(LPARAM)(LPSTR)lpString); +} + +BOOL WINAPI +SetWindowText(HWND hwnd, LPCSTR lpString) +{ + return SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)(LPCSTR)lpString); +} + +/* Recursively offset all children of passed window*/ +static void +MwOffsetChildren(HWND hwnd, int offx, int offy) +{ + HWND cp; + + /* offset all child windows for move*/ + for(cp=hwnd->children; cp; cp=cp->siblings) { + + /* offset window and client area rects*/ + OffsetRect(&cp->winrect, offx, offy); + OffsetRect(&cp->clirect, offx, offy); + + /* offset scrollbar NC hittest rects*/ + if(!IsRectEmpty(&cp->vscroll.rc)) + OffsetRect(&cp->vscroll.rc, offx, offy); + if(!IsRectEmpty(&cp->hscroll.rc)) + OffsetRect(&cp->hscroll.rc, offx, offy); + MwOffsetChildren(cp, offx, offy); + } +} + +BOOL +SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, + UINT fuFlags) +{ + int hidden; + BOOL bMove, bSize, bZorder; + MWCOORD offx = 0, offy = 0; /* = 0 for bad gcc warning*/ + WINDOWPOS winpos; + + if(!hwnd || hwnd == rootwp || cx < 0 || cy < 0) + return FALSE; + + /* FIXME SWP_NOACTIVATE*/ + + if((fuFlags & SWP_SHOWWINDOW)) + return ShowWindow(hwnd, SW_SHOW); + + if((fuFlags & SWP_HIDEWINDOW)) + return ShowWindow(hwnd, SW_HIDE); + + /* move is relative to parent's client rect for child windows*/ + if(hwnd->style & WS_CHILD) { + x += hwnd->parent->clirect.left; + y += hwnd->parent->clirect.top; + } else { + x += hwnd->parent->winrect.left; + y += hwnd->parent->winrect.top; + } + + bMove = !(fuFlags & SWP_NOMOVE) && + (hwnd->winrect.left != x || hwnd->winrect.top != y); + bSize = !(fuFlags & SWP_NOSIZE) && + ((hwnd->winrect.right - hwnd->winrect.left) != cx || + (hwnd->winrect.bottom - hwnd->winrect.top) != cy); + bZorder = !(fuFlags & SWP_NOZORDER); + if(!bMove && !bSize && !bZorder) + return TRUE; + + /* could optimize to not require redraw when possible*/ + hidden = hwnd->unmapcount || (fuFlags & SWP_NOREDRAW); + + if(bZorder) { + switch((int)hwndInsertAfter) { + case (int)HWND_TOP: + MwRaiseWindow(hwnd); + break; + case (int)HWND_BOTTOM: + MwLowerWindow(hwnd); + break; + default: + /* FIXME for non top/bottom zorder*/ + break; + } + } else { + if(!hidden) + MwHideWindow(hwnd, FALSE, FALSE); + } + + if(bMove) { + offx = x - hwnd->winrect.left; + offy = y - hwnd->winrect.top; + } + if(bMove || bSize) { + hwnd->winrect.left = x; + hwnd->winrect.top = y; + hwnd->winrect.right = x + cx; + hwnd->winrect.bottom = y + cy; + } + if(bMove) + MwOffsetChildren(hwnd, offx, offy); + + if(bMove || bSize) { + MwCalcClientRect(hwnd); + + /* send windowposchanged message*/ + /* FIXME: move WM_MOVE, WM_SIZE to defwndproc*/ + winpos.hwnd = hwnd; + winpos.hwndInsertAfter = hwndInsertAfter; + winpos.x = x; + winpos.y = y; + winpos.cx = cx; + winpos.cy = cy; + winpos.flags = fuFlags; + SendMessage(hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&winpos); + + MwSendSizeMove(hwnd, bSize, bMove); + } + + ++mwpaintSerial; /* increment paint serial # for alphablending*/ + ++mwpaintNC; /* increment paint serial # for NC painting*/ + if(!bZorder && !hidden) + MwShowWindow(hwnd, FALSE); + + return TRUE; +} + +BOOL WINAPI +MoveWindow(HWND hwnd, int x, int y, int nWidth, int nHeight, BOOL bRepaint) +{ + UINT flags = SWP_NOZORDER | SWP_NOACTIVATE; + + if(!bRepaint) + flags |= SWP_NOREDRAW; + return SetWindowPos(hwnd, 0, x, y, nWidth, nHeight, flags); +} + +void +MwSendSizeMove(HWND hwnd, BOOL bSize, BOOL bMove) +{ + DWORD dwStyle; + RECT rc; + + if(bSize) { + GetClientRect(hwnd, &rc); + SendMessage(hwnd, WM_SIZE, SIZE_RESTORED, + MAKELONG(rc.right, rc.bottom)); + } + if(bMove) { + dwStyle = GetWindowLong(hwnd, GWL_STYLE); + GetWindowRect(hwnd, &rc); + /* return parent coords for child windows*/ + if(dwStyle & WS_CHILD) + ScreenToClient(hwnd->parent, (LPPOINT)&rc.left); + SendMessage(hwnd, WM_MOVE, 0, MAKELONG(rc.left, rc.top)); + } +} + +/* + * Specify a cursor for a window. + * This cursor will only be used within that window, and by default + * for its new children. If the cursor is currently within this + * window, it will be changed to the new one immediately. + */ +void +MwSetCursor(HWND wp, PMWCURSOR pcursor) +{ + HCURSOR cp; + int bytes; + + if(!wp || !pcursor) + return; + + bytes = MWIMAGE_SIZE(pcursor->width,pcursor->height) + * sizeof(MWIMAGEBITS); + + /* + * See if the window is using a shared cursor definition. + * If so, then allocate a new private one, otherwise reuse it. + */ + cp = wp->cursor; + if (!cp || cp->usecount-- > 1) { + cp = GdItemNew(struct hcursor); + if(!cp) + return; + } + + cp->usecount = 1; + cp->cursor.width = pcursor->width; + cp->cursor.height = pcursor->height; + cp->cursor.hotx = pcursor->hotx; + cp->cursor.hoty = pcursor->hoty; + cp->cursor.fgcolor = pcursor->fgcolor; + cp->cursor.bgcolor = pcursor->bgcolor; + memcpy(cp->cursor.image, pcursor->image, bytes); + memcpy(cp->cursor.mask, pcursor->mask, bytes); + wp->cursor = cp; + + /* + * If this was the current cursor, then draw the new one. + */ + if (cp == curcursor || curcursor == NULL) { + GdMoveCursor(cursorx - cp->cursor.hotx, + cursory - cp->cursor.hoty); + GdSetCursor(&cp->cursor); + } +} + +BOOL WINAPI +GetCursorPos(LPPOINT lpPoint) +{ + MWCOORD x, y; + + if(lpPoint) { + GdGetCursorPos(&x, &y); + lpPoint->x = x; + lpPoint->y = y; + return TRUE; + } + return FALSE; +} + +HWND WINAPI +GetCapture(VOID) +{ + return capturewp; +} + +HWND WINAPI +SetCapture(HWND hwnd) +{ + HWND oldCapture = capturewp; + + capturewp = hwnd; + MwCheckMouseWindow(); + return oldCapture; +} + +BOOL WINAPI +ReleaseCapture(VOID) +{ + capturewp = NULL; + MwCheckMouseWindow(); + return TRUE; +} + +struct timer { /* private timer structure*/ + HWND hwnd; /* window associated with timer, NULL if none*/ + UINT idTimer; /* id for timer*/ + UINT uTimeout; /* timeout value, in msecs*/ + DWORD dwClockExpires; /* GetTickCount timer expiration value*/ + TIMERPROC lpTimerFunc; /* callback function*/ +}; + +static struct timer timer; /* single global timer FIXME*/ + +UINT WINAPI +SetTimer(HWND hwnd, UINT idTimer, UINT uTimeout, TIMERPROC lpTimerFunc) +{ + static UINT nextID = 0; /* next ID when hwnd is NULL*/ + + /* assign timer id based on valid window handle*/ + timer.hwnd = hwnd; + timer.idTimer = hwnd? idTimer: ++nextID; + timer.uTimeout = uTimeout; + timer.dwClockExpires = GetTickCount() + uTimeout; + timer.lpTimerFunc = lpTimerFunc; + + return timer.idTimer; +} + +BOOL WINAPI +KillTimer(HWND hwnd, UINT idTimer) +{ + if(timer.hwnd == hwnd && timer.idTimer == idTimer) { + timer.uTimeout = 0; + return TRUE; + } + return FALSE; +} + +/* + * Return the next timeout value in msecs + */ +UINT +MwGetNextTimeoutValue(void) +{ + int timeout; + + if(timer.uTimeout) { + timeout = timer.dwClockExpires - GetTickCount(); + if(timeout > 0) + return timeout; + } + return 0; +} + +/* + * Check if any timers have expired by looking at current system ticks + */ +void +MwHandleTimers(void) +{ + int timeout; + DWORD dwTime; + + /* check if timer running*/ + if(timer.uTimeout == 0) + return; + + /* determine if timer expired*/ + dwTime = GetTickCount(); + timeout = timer.dwClockExpires - dwTime; + if(timeout > 0) + return; + + /* call timer function or post timer message*/ + if(timer.lpTimerFunc) + timer.lpTimerFunc(timer.hwnd, WM_TIMER, timer.idTimer, dwTime); + else PostMessage(timer.hwnd, WM_TIMER, timer.idTimer, 0); + + /* reset timer*/ + timer.dwClockExpires = dwTime + timer.uTimeout; +} + +int WINAPI +GetSystemMetrics(int nIndex) +{ + switch(nIndex) { + case SM_CXSCREEN: + return scrdev.xvirtres; + case SM_CYSCREEN: + return scrdev.yvirtres; + case SM_CXVSCROLL: + return mwSYSMETRICS_CXVSCROLL; + case SM_CYHSCROLL: + return mwSYSMETRICS_CYHSCROLL; + case SM_CYCAPTION: + /* + 1 for line under caption*/ + return mwSYSMETRICS_CYCAPTION + 1; + case SM_CXBORDER: + return mwSYSMETRICS_CXBORDER; + case SM_CYBORDER: + return mwSYSMETRICS_CYBORDER; + case SM_CYMENU: + break; /* FIXME: 19 when menubars work*/ + case SM_CYVSCROLL: + return mwSYSMETRICS_CYVSCROLL; + case SM_CXHSCROLL: + return mwSYSMETRICS_CXHSCROLL; + case SM_CXFRAME: + case SM_CXDLGFRAME: + return mwSYSMETRICS_CXFRAME; + case SM_CYFRAME: + case SM_CYDLGFRAME: + return mwSYSMETRICS_CYFRAME; + } + return 0; +} + +HWND WINAPI +GetDlgItem(HWND hDlg, int nIDDlgItem) +{ + HWND wp; + + if(hDlg) { + for(wp=hDlg->children; wp; wp=wp->siblings) + if(wp->id == nIDDlgItem) + return wp; + } + return 0; +} diff --git a/packages/services/gfx/mw/current/src/nano-X.cfg b/packages/services/gfx/mw/current/src/nano-X.cfg new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nano-X.cfg @@ -0,0 +1,201 @@ +# Font Configuration file for nano-X: T1 fonts (URW) +# EXPERIMENTAL, SUBJECT TO CHANGE +# This file is only used if Nano-X is compiled with #define FONTMAPPER 1 +# +# This file is used by specifying the '-c' option to the nano-X server. Several +# such configuration files may be specified with multiple '-c' options. + +# Only use 'clear-fonts' once before setting up all the fonts, possibly from different +# files, e.g. one file for genuine PostScript files, one for similar files, one for +# builtin fonts, one for freetype fonts etc., but only one 'clear-fonts': +clear-fonts + + +# There are two font-definition formats: +# +# font , +# font alias [], +# +# The family name is used to find a related font with different style, e.g. ask for "Times New Roman", +# which is an upright font, and then be able to say "I want it in Italics". What happens is that +# the family name of "Times New Roman", which is "Times", is used as a basis to find a font whose +# attributes best match those sought. + +# Some aliases for use by Browsers etc. +font alias - Serif Proportional,Serif Times +font alias - Sans-serif Proportional,Sans-serif Helvetica +font alias - Fantasy Proportional,Serif NewCewturySchlbk +font alias - Cursive Proportional,Serif ChanceryL,ChanceryL-MediItal +font alias - Monospace Monospace,Serif NimbusMonL + +# This is a "Times" Lookalike font +font unknown - NimbusRomNo9L-Regu Proportional,Serif,Regular,Roman T1,n021003l +font unknown - NimbusRomNo9L-ReguItal Proportional,Serif,Regular,Italic T1,n021023l +font unknown - NimbusRomNo9L-Medi Proportional,Serif,Medium,Roman T1,n021004l +font unknown - NimbusRomNo9L-MediItal Proportional,Serif,Medium,Italic T1,n021024l +font alias NimbusRomNo9L "NimbusRomNo9L Regular" Proportional,Serif,Regular,Roman unknown,NimbusRomNo9L-Regu +font alias NimbusRomNo9L "NimbusRomNo9L Regular Italic" Proportional,Serif,Regular,Italic unknown,NimbusRomNo9L-ReguItal +font alias NimbusRomNo9L "NimbusRomNo9L Medium" Proportional,Serif,Medium,Roman unknown,NimbusRomNo9L-Medi +font alias NimbusRomNo9L "NimbusRomNo9L Medium Italic" Proportional,Serif,Medium,Italic unknown,NimbusRomNo9L-MediItal + +font alias Times "Times Roman" Proportional,Serif,Regular,Roman unknown,NimbusRomNo9L-Regu +font alias Times "Times Italic" Proportional,Serif,Regular,Italic unknown,NimbusRomNo9L-ReguItal +font alias Times "Times Bold" Proportional,Serif,Bold,Roman unknown,NimbusRomNo9L-Medi +font alias Times "Times Bold Italic" Proportional,Serif,Bold,Italic unknown,NimbusRomNo9L-MediItal + +font alias Times "Times New Roman" Proportional,Serif,Regular,Roman unknown,NimbusRomNo9L-Regu +font alias Times "Times New Italic" Proportional,Serif,Regular,Italic unknown,NimbusRomNo9L-ReguItal +font alias Times "Times New Bold" Proportional,Serif,Bold,Roman unknown,NimbusRomNo9L-Medi +font alias Times "Times New Bold Italic" Proportional,Serif,Bold,Italic unknown,NimbusRomNo9L-MediItal + + +# This is a Helvetica font +font unknown - NimbusSanL-Regu Proportional,Sans-serif,Regular,Roman T1,n019003l +font unknown - NimbusSanL-ReguItal Proportional,Sans-serif,Regular,Italic T1,n019023l +font unknown - NimbusSanL-Bold Proportional,Sans-serif,Bold,Roman T1,n019004l +font unknown - NimbusSanL-BoldItal Proportional,Sans-serif,Bold,Italic T1,n019024l +font alias NimbusSanL "NimbusSanL Regular" Proportional,Sans-serif,Regular,Roman unknown,NimbusSanL-Regu +font alias NimbusSanL "NimbusSanL Regular Italic" Proportional,Sans-serif,Regular,Italic unknown,NimbusSanL-ReguItal +font alias NimbusSanL "NimbusSanL Bold" Proportional,Sans-serif,Bold,Roman unknown,NimbusSanL-Bold +font alias NimbusSanL "NimbusSanL Bold Italic" Proportional,Sans-serif,Bold,Italic unknown,NimbusSanL-BoldItal + +font alias Helvetica "Helvetica" Proportional,Sans-serif,Regular,Roman unknown,NimbusSanL-Regu +font alias Helvetica "Helvetica Oblique" Proportional,Sans-serif,Regular,Oblique unknown,NimbusSanL-ReguItal +font alias Helvetica "Helvetica Bold" Proportional,Sans-serif,Bold,Roman unknown,NimbusSanL-Bold +font alias Helvetica "Helvetica Bold Oblique" Proportional,Sans-serif,Bold,Oblique unknown,NimbusSanL-BoldItal + + +# This is a "courier" font +font unknown - NimbusMonL-Regu Monospace,Serif,Regular,Roman T1,n022003l +font unknown - NimbusMonL-ReguObli Monospace,Serif,Regular,Oblique T1,n022023l +font unknown - NimbusMonL-Bold Monospace,Serif,Bold,Roman T1,n022004l +font unknown - NimbusMonL-BoldObli Monospace,Serif,Bold,Oblique T1,n022024l +font alias NimbusMonL "NimbusMonL Regular" Monospace,Serif,Regular,Roman unknown,NimbusMonL-Regu +font alias NimbusMonL "NimbusMonL Regular Oblique" Monospace,Serif,Regular,Olique unknown,NimbusMonL-ReguObli +font alias NimbusMonL "NimbusMonL Bold" Monospace,Serif,Bold,Roman unknown,NimbusMonL-Bold +font alias NimbusMonL "NimbusMonL Bold Oblique" Monospace,Serif,Bold,Oblique unknown,NimbusMonL-BoldObli + +font alias Courier "Courier" Monospace,Serif,Regular,Roman unknown,NimbusMonL-Regu +font alias Courier "Courier Oblique" Monospace,Serif,Regular,Oblique unknown,NimbusMonL-ReguObli +font alias Courier "Courier Bold" Monospace,Serif,Bold,Roman unknown,NimbusMonL-Bold +font alias Courier "Courier Bold Oblique" Monospace,Serif,Bold,Oblique unknown,NimbusMonL-BoldObli + + +# This is a "Palatino" lookalike +font URW - PalladioL-Roma Proportional,Serif,Regular,Roman T1,p052003l +font URW - PalladioL-Ital Proportional,Serif,Regular,Italic T1,p052023l +font URW - PalladioL-Bold Proportional,Serif,Bold,Roman T1,p052004l +font URW - PalladioL-BoldItal Proportional,Serif,Bold,Italic T1,p052024l +font alias PalladioL "PalladioL Roman" Proportional,Serif,Regular,Roman URW,PalladioL-Roma +font alias PalladioL "PalladioL Italic" Proportional,Serif,Regular,Italic URW,PalladioL-Ital +font alias PalladioL "PalladioL Bold" Proportional,Serif,Bold,Roman URW,PalladioL-Bold +font alias PalladioL "PalladioL Bold Italic" Proportional,Serif,Bold,Italic URW,PalladioL-BoldItal + +font alias Palatino "Palatino Roman" Proportional,Serif,Regular,Roman URW,URWPalladioL-Roma +font alias Palatino "Palatino Italic" Proportional,Serif,Regular,Italic URW,URWPalladioL-Ital +font alias Palatino "Palatino Bold" Proportional,Serif,Bold,Roman URWPalladioL-Bold +font alias Palatino "Palatino Bold Italic" Proportional,Serif,Bold,Italic URWPalladioL-BoldItal + + +# Schoolbook +font unknown - CenturySchL-Roma Proportional,Serif,Regular,Roman T1,c059013l +font unknown - CenturySchL-Ital Proportional,Serif,Regular,Italic T1,c059033l +font unknown - CenturySchL-Bold Proportional,Serif,Bold,Roman T1,c059016l +font unknown - CenturySchL-BoldItal Proportional,Serif,Bold,Italic T1,c059036l +font alias CenturySchL "CenturySchL Roman" Proportional,Serif,Regular,Roman unknown,CenturySchL-Roma +font alias CenturySchL "CenturySchL Ital" Proportional,Serif,Regular,Italic unknown,CenturySchL-Ital +font alias CenturySchL "CenturySchL Bold" Proportional,Serif,Bold,Roman unknown,CenturySchL-Bold +font alias CenturySchL "CenturySchL Bold Italic" Proportional,Serif,Bold,Italic unknown,CenturySchL-BoldItal + +font alias NewCewturySchlbk "NewCewturySchlbk Roman" Proportional,Serif,Regular,Roman unknown,CenturySchL-Roma +font alias NewCewturySchlbk "NewCewturySchlbk Italic" Proportional,Serif,Regular,Italic unknown,CenturySchL-Ital +font alias NewCewturySchlbk "NewCewturySchlbk Bold" Proportional,Serif,Bold,Roman unknown,CenturySchL-Bold +font alias NewCewturySchlbk "NewCewturySchlbk Bold Italic" Proportional,Serif,Bold,Italic unknown,CenturySchL-BoldItal + + +# Bookman +font URW - BookmanL-DemiBold Proportional,Serif,Demibold,Roman T1,b018015l +font URW - BookmanL-DemiBoldItal Proportional,Serif,Demibold,Italic T1,b018035l +font URW - BookmanL-Ligh Proportional,Serif,Light,Roman T1,b018012l +font URW - BookmanL-LighItal Proportional,Serif,Light,Italic T1,b018032l +font alias BookmanL "BookmanL DemiBold" Proportional,Serif,Demibold,Roman URW,BookmanL-DemiBold +font alias BookmanL "BookmanL DemiBold Italic" Proportional,Serif,Demibold,Italic URW,BookmanL-DemiBoldItal +font alias BookmanL "BookmanL Light" Proportional,Serif,Light,Roman URW,BookmanL-Ligh +font alias BookmanL "BookmanL Light Italic" Proportional,Serif,Light,Italic URW,BookmanL-LighItal + +font alias Bookman "Bookman Demi" Proportional,Serif,Demibold,Roman URW,BookmanL-DemiBold +font alias Bookman "Bookman Demibold" Proportional,Serif,Demibold,Roman URW,BookmanL-DemiBold +font alias Bookman "Bookman Demi Italic" Proportional,Serif,Demibold,Italic URW,BookmanL-DemiBoldItal +font alias Bookman "Bookman Demibold Italic" Proportional,Serif,Demibold,Italic URW,BookmanL-DemiBoldItal +font alias Bookman "Bookman Light" Proportional,Serif,Light,Roman URW,BookmanL-Ligh +font alias Bookman "Bookman Light Italic" Proportional,Serif,Light,Italic URW,BookmanL-LighItal +font alias Bookman "Bookman Bold" Proportional,Serif,Demibold,Roman URW,BookmanL-DemiBold +font alias Bookman "Bookman Bold Italic" Proportional,Serif,Demibold,Italic URW,BookmanL-DemiBoldItal + +# Gothic +font URW - GothicL-Book Regular,Sans-serif T1,a010013l +font URW - GothicL-BookObli Regular,Oblique,Sans-serif T1,a010033l +font URW - GothicL-Demi Demibold,Sans-serif T1,a010015l +font URW - GothicL-DemiObli Demibold,Oblique,Sans-serif T1,a010035l +font alias GothicL "GothicL Book" Regular,Sans-serif URW,GothicL-Book +font alias GothicL "GothicL Book Oblique" Regular,Oblique,Sans-serif URW,GothicL-BookObli +font alias GothicL "GothicL Demibold" Demibold,Sans-serif URW,GothicL-Demi +font alias GothicL "GothicL Demi Oblique" Demibold,Oblique,Sans-serif URW,GothicL-DemiObli +font alias GothicL "GothicL Demibold Oblique" Demibold,Oblique,Sans-serif URW,GothicL-DemiObli + +# A condensed Sans-serif font (narrow) +font unknown - NimbusSanL-ReguCond Proportional,Sans-serif,Regular,Condensed T1,n019043l +font unknown - NimbusSanL-ReguCondItal Proportional,Sans-serif,Regular,Condensed,Italic T1,n019063l +font unknown - NimbusSanL-BoldCond Proportional,Sans-serif,Bold,Condensed T1,n019044l +font unknown - NimbusSanL-BoldCondItal Proportional,Sans-serif,Bold,Condensed,Italic T1,n019064l +font alias NimbusSanL "NimbusSanL Regular Condensed" Proportional,Sans-serif,Regular,Condensed unknown,NimbusSanL-ReguCond +font alias NimbusSanL "NimbusSanL Regular Condensed Italic" Proportional,Sans-serif,Regular,Condensed,Italic unknown,NimbusSanL-ReguCondItal +font alias NimbusSanL "NimbusSanL Bold Condensd" Proportional,Sans-serif,Bold,Condensed unknown,NimbusSanL-BoldCond +font alias NimbusSanL "NimbusSanL Bold Condensed Italic" Proportional,Sans-serif,Bold,Condensed,Italic unknown,NimbusSanL-BoldCondItal + +font alias "Helvetica Narrow" "Helvetica Narrow" Proportional,Sans-serif,Condensed,Regular,Roman unknown,NimbusSanL-ReguCond +font alias "Helvetica Narrow" "Helvelica Narrow-Oblique" Proportional,Sans-serif,Condensed,Regular,Oblique unknown,NimbusSanL-ReguCondItal +font alias "Helvetica Narrow" "Helvelica Narrow-Bold" Proportional,Sans-serif,Condensed,Bold,Roman unknown,NimbusSanL-BoldCond +font alias "Helvetica Narrow" "Helvelica Narrow-BoldOblique" Proportional,Sans-serif,Condensed,Bold,Oblique unknown,NimbusSanL-BoldCondItal + + + +# Misc fonts +font unknown - StandardSymL-Regu Regular T1,s050000l +font alias - "Standard Symbol" Regular StandardSymL-Regu + +font unknown - Dingbats-Regu Regular T1,d050000l +font alias - Dingbats Regular Dingbats-Regu + +font URW ChanceryL ChanceryL-MediItal Proportional,Serif,Medium,Italic z003034l +font alias - Chancery Proportional,Serif,Medium,Italic ChanceryL,ChanceryL-MediItal +font alias - "Zapf Chancery" Proportional,Serif,Medium,Italic ChanceryL,ChanceryL-MediItal +font alias - "Zapf Chancery Medium Italic" Proportional,Serif,Medium,Italic ChanceryL,ChanceryL-MediItal + + +# Aliases + + + +font alias AvantGarde "AvantGarde Book" Proportional,Sans-serif,Regular,Roman URW,URWGothicL-Book +font alias AvantGarde "AvantGarde BookOblique" Proportional,Sans-serif,Regular,Oblique URW,URWGothicL-BookObli +font alias AvantGarde "AvantGarde Demi" Proportional,Sans-serif,DemiBold,Roman URWGothicL-Demi +font alias AvantGarde "AvantGarde DemiOblique" Proportional,Sans-serif,DemiBold,Oblique URW,URWGothicL-DemiObli + + + + +# /Symbol /StandardSymL ; +# +# /ZapfChancery-MediumItalic /URWChanceryL-MediItal ; +# +# /ZapfDingbats /Dingbats ; + + + +# The default Microwindows and Nano-X fonts +# font MWF - System Proportional,Sans-serif,Regular,Roman,Normal MWF,System +# font MWF - Helvetica Proportional,Sans-serif,Regular,Roman,Normal MWF,Helvetica +# font MWF - Terminal Regular,Roman,Normal,Monospace,Sans-serif MWF,Terminal +# font MWF - SystemFixed Regular,Roman,Normal,Monospace,Sans-serif MWF,SystemFixed + diff --git a/packages/services/gfx/mw/current/src/nanowm.sh b/packages/services/gfx/mw/current/src/nanowm.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanowm.sh @@ -0,0 +1,1 @@ +bin/nano-X & bin/nanowm & bin/demo6 bin/nanogui.ppm & bin/nxclock & sleep 10000 diff --git a/packages/services/gfx/mw/current/src/nanox/Makefile b/packages/services/gfx/mw/current/src/nanox/Makefile new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/Makefile @@ -0,0 +1,80 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000, 2002 Martin Jolicoeur, Greg Haerr +############################################################################## + +ifndef TOP +`TOP = .. +CONFIG = $(TOP)/config +endif + +include $(CONFIG) + +VPATH := $(TOP)/nanox + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += + +# Defines for preprocessor +ifeq ($(LINK_APP_INTO_SERVER), Y) +DEFINES += -DNONETWORK=1 +endif + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +ifeq ($(NANOX), Y) + +# If you want to create a library with the objects files, define the name here +LIBNAME = libnano-X.a +LIBNAMESO = libnano-X.so + +# Nano-X server files +NANOXFILES = srvmain.o srvfunc.o srvutil.o srvevent.o srvclip.o +NETFILES = srvnet.o +UTILFILES = nxdraw.o nxutil.o + +ifeq ($(LINK_APP_INTO_SERVER), Y) +NANOXFILES += $(UTILFILES) +OBJS = $(NANOXFILES) +else +NANOXFILES += $(NETFILES) +OBJS = client.o clientfb.o nxproto.o error.o $(UTILFILES) +ifeq ($(ARCH), ECOS) +TARGET = $(BUILD)/bin/nano-X.o +else +TARGET = $(BUILD)/bin/nano-X +endif +all: default $(TARGET) +endif + +endif + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### + +# Server binary ... +ifeq ($(SHAREDLIBS), Y) +$(BUILD)/bin/nano-X: $(NANOXFILES) $(NANOXSERVERLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(NANOXFILES) $(CCNANOXSERVERLIBS) +else +$(BUILD)/bin/nano-X.o: $(OBJS) $(NANOXFILES) $(NANOXSERVERLIBS) $(TOP)/config +# $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(NANOXFILES) $(NANOXSERVERLIBS) -Wl,-r -Wl,--retain-symbols-file -Wl,nanox.syms -Wl,--defsym -Wl,nanox_main=main -o XX.o + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(NANOXFILES) $(NANOXSERVERLIBS) -Wl,-r -Wl,--defsym -Wl,nanox_main=main -o XX.o + $(NM) XX.o | grep -v _main | grep -v Gr | grep -v nx | grep ' T' | awk -f $(TOP)/ecos/retain.awk | xargs $(OBJCOPY) XX.o $@ +# rm -f XX.o + +$(BUILD)/bin/nano-X: $(NANOXFILES) $(NANOXSERVERLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(NANOXFILES) $(NANOXSERVERLIBS) $(LDFLAGS) +endif diff --git a/packages/services/gfx/mw/current/src/nanox/client.c b/packages/services/gfx/mw/current/src/nanox/client.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/client.c @@ -0,0 +1,3431 @@ +/* + * Copyright (c) 1999, 2000 Greg Haerr + * Copyright (c) 1999, 2000 Alex Holden + * Copyright (c) 1991 David I. Bell + * Copyright (c) 2000 Vidar Hokstad + * Copyright (c) 2000 Morten Rolland + * + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * Client routines to do graphics with windows and graphics contexts. + * + * Rewritten heavily for speed by Greg Haerr + * + * Whenever you add a new API entry point, please comment it in the same way + * as the rest of the functions in this file. Also add your functions to the + * appropriate section(s) in doc/nano-X/nano-X-sections.txt and regenerate the + * documentation by running make in the doc/nano-X/ directory. If you do not + * have the necessary tools (gtk-doc and the docbook-tools) to rebuild the + * documentation, just skip that step and we will do it for you. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#if HAVE_SHAREDMEM_SUPPORT +#include +#include +#include +#endif +#include +#include +#if ELKS +#include +#include +#elif __ECOS +#include +#include +#include +#define _NO_SVR_MAPPING +#define getpid() ((int)cyg_thread_self()) +#else +#include +#if hpux +#include +#else +#ifdef __GLIBC__ +#include +#endif +#endif +#endif +#include "nano-X.h" +#include "serv.h" +#include "nxproto.h" + +#define GR_CLOSE_FIX 1 /* dirty hack attempts to fix GrClose hang bug*/ + +#define SHM_BLOCK_SIZE 4096 + +#ifndef __ECOS +/* exported global data */ +int nxSocket = -1; /* The network socket descriptor */ +#if HAVE_SHAREDMEM_SUPPORT +char * nxSharedMem = 0; /* Address of shared memory segment*/ +static int nxSharedMemSize; /* Size in bytes of shared mem segment*/ +#endif + +static int regfdmax = -1; /* GrRegisterInput globals*/ +static fd_set regfdset; + +/* readable error strings*/ +char *nxErrorStrings[] = { + GR_ERROR_STRINGS +}; + +static EVENT_LIST * evlist; + +/* + * The following is the user defined function for handling errors. + * If this is not set, then the default action is to close the connection + * to the server, describe the error, and then exit. This error function + * will only be called when the client asks for events. + */ +static GR_FNCALLBACKEVENT ErrorFunc = GrDefaultErrorHandler; + +#else /* __ECOS*/ +/* + * eCos uses a thread data pointer to store all statics in... + */ +int ecos_nanox_client_data_index = CYGNUM_KERNEL_THREADS_DATA_MAX; + +/* readable error strings*/ +char *nxErrorStrings[] = { + GR_ERROR_STRINGS +}; +#endif + +/* + * Queue an event in FIFO for later retrieval. + */ +static void +QueueEvent(GR_EVENT *ep) +{ + EVENT_LIST * elp; + EVENT_LIST * prevelp; + ACCESS_PER_THREAD_DATA() + + elp = malloc(sizeof(EVENT_LIST)); + if (elp) { + elp->event = *ep; + elp->next = NULL; + + /* add as last entry on list*/ + if (!evlist) { + evlist = elp; + return; + } + prevelp = evlist; + while (prevelp->next) + prevelp = prevelp->next; + prevelp->next = elp; + } +} + +/* + * Retrieve first event in FIFO event queue. + */ +static void +GetNextQueuedEvent(GR_EVENT *ep) +{ + ACCESS_PER_THREAD_DATA() + *ep = evlist->event; + evlist = evlist->next; +} + +/* + * Read n bytes of data from the server into block *b. Make sure the data + * you are about to read are actually of the correct type - e.g. make a + * check for the first block of data you read as a response to a command + * with the Typed version of this function. Returns 0 on success or -1 on + * failure. + */ +static int GrReadBlock(void *b, int n) +{ + int i = 0; + char *v; + ACCESS_PER_THREAD_DATA() + + v = (char *) b; + + nxFlushReq(0L,0); + while(v < ((char *) b + n)) { + i = read(nxSocket, v, ((char *) b + n - v)); + if ( i <= 0 ) { + if ( i == 0 ) { + /* We should maybe produce an event here, + * if possible. + */ + EPRINTF("nxclient: lost connection to Nano-X " + "server\n"); + exit(1); + } + if ( errno == EINTR || errno == EAGAIN ) + continue; + + EPRINTF("nxclient: bad readblock %d\n", i); + return -1; + } + v += i; + } + + return 0; +} + +/* + * Read a byte of data from the server. + */ +static int GrReadByte() +{ + unsigned char c; + + if(GrReadBlock(&c, 1) == -1) + return -1; + else return (int) c; +} + +/* + * Check if this is a CLIENT_DATA event, in which case we need to read the + * data for the event into a buffer and set the event data pointer to the + * address of it (or NULL if the malloc() fails). We also don't try to read + * any data if datalen is 0. + */ +static void GrCheckForClientData(GR_EVENT *evp) +{ + GR_EVENT_CLIENT_DATA *event; + + if(evp->type == GR_EVENT_TYPE_CLIENT_DATA) { + event = (GR_EVENT_CLIENT_DATA *)evp; + if(!event->datalen) { + event->data = NULL; + return; + } + if(!(event->data = malloc(event->datalen))) return; + GrReadBlock(event->data, event->datalen); + } +} + +/* + * Check if the data we are about to read is of the correct type. This + * must be done in order to avoid reading an event as part of the response + * from the server to a command that requires a reply. + */ +static int GrCheckBlockType(short packettype) +{ + short b; + GR_EVENT event; + + while (GrReadBlock(&b,sizeof(b)) != -1) { + if (b == packettype) + return b; + + if (b == GrNumGetNextEvent) { + /*EPRINTF("nxclient %d: Storing event (expected %d)\n", + getpid(), packettype);*/ + +#if 0 + /* We only need to handle one event, since the next + * event won't arrive until the next GrPrepareSelect() + * has been called, and by then we have already + * handled this event in GrServiceSelect(). If + * GrPrepareSelect() is never called, then we should + * never get here either, so that is cool too. + */ + GrReadBlock(&storedevent_data, + sizeof(storedevent_data)); + GrCheckForClientData(&storedevent_data); + storedevent = 1; +#endif + /* read event and queue it for later processing*/ + GrReadBlock(&event, sizeof(event)); + QueueEvent(&event); + } else { + EPRINTF("nxclient %d: Wrong packet type %d " + "(expected %d)\n", getpid(),b, packettype); + } + } + EPRINTF("nxclient %d: Corrupted packet\n", getpid()); + return -1; +} + +/* + * Actually read a response from the server, much like the GrReadBlock but + * make sure the response is of the right kind, e.g. store the event that + * may have sneaked into the stream. + */ +static int GrTypedReadBlock(void *b, int n, int type) +{ + int r; + + r = GrCheckBlockType(type); + if (r != type) + return -1; + return GrReadBlock(b,n); +} + +/* + * Check if the passed event is an error event, and call the error handler if + * there is one. After calling the handler (if it returns), the event type is + * set to a non-event so that we don't return an error event through the + * GetEvent() mechanism. This solution is simpler than creating a client-side + * event queue. + */ +static void +CheckErrorEvent(GR_EVENT *ep) +{ + ACCESS_PER_THREAD_DATA() + + if (ep->type == GR_EVENT_TYPE_ERROR) { + if (ErrorFunc) { + /* call error handler*/ + ErrorFunc(ep); + + /* then convert to null event*/ + ep->type = GR_EVENT_TYPE_NONE; + } + } +} + +/** + * GrFlush: + * + * Flush the message buffer of any messages it may contain. + */ +void +GrFlush(void) +{ + nxFlushReq(0L,1); +} + +/** + * GrOpen: + * @Returns: the fd of the connection to the server or -1 on failure + * + * Open a connection to the graphics server. + */ +int +GrOpen(void) +{ + size_t size; + nxOpenReq req; + int tries; + int ret = 0; +#if ELKS + struct sockaddr_na name; +#define ADDR_FAM AF_NANO +#elif defined(__ECOS) + struct sockaddr_in name; +#define ADDR_FAM AF_INET +#else + struct sockaddr_un name; +#define ADDR_FAM AF_UNIX +#endif + ACCESS_PER_THREAD_DATA() + + if (nxSocket == -1) { + if((nxSocket = socket(ADDR_FAM, SOCK_STREAM, 0)) == -1) { + nxSocket = -1; + return -1; + } + } else { + return nxSocket; + } + +#if ELKS + name.sun_family = AF_NANO; + name.sun_no = GR_NUMB_SOCKET; + size = sizeof(struct sockaddr_na); +#elif defined(__ECOS) + name.sin_family = AF_INET; + name.sin_port = htons(6600); /* Nano-X server port*/ + name.sin_addr.s_addr = inet_addr("127.0.0.1"); /* Loopback address*/ + size = sizeof(struct sockaddr_in); +#else + name.sun_family = AF_UNIX; + strcpy(name.sun_path, GR_NAMED_SOCKET); + size = (offsetof(struct sockaddr_un, sun_path) + + strlen(name.sun_path) + 1); +#endif + + /* + * Try to open the connection for up to a second, + * waiting 1/10 second between attempts. + */ + for (tries=1; tries<=10; ++tries) { + struct timespec req; + + ret = connect(nxSocket, (struct sockaddr *) &name, size); + if (ret >= 0) + break; + req.tv_sec = 0; + req.tv_nsec = 100000000L; + nanosleep(&req, NULL); + EPRINTF("nxclient: retry connect attempt %d\n", tries); + } + if (ret == -1) { + close(nxSocket); + nxSocket = -1; + return -1; + } + + /* + * By Performing the 'GrOpen' without allocating a buffer, just + * shuffeling the struct over the wire, we can postpone the + * allocation of the client size command buffer, which will never be + * allocated if the first command after GrOpen() is + * GrReqShmCmds() which allocates a replacement shared memory + * segment. + * So: Calling GrReqShmCmds() right after GrOpen will prevent the + * traditional command queue buffer from being allocated from + * the process heap - and only the shared memory segment is + * allocated. + */ + req.reqType = GrNumOpen; + req.hilength = 0; + req.length = sizeof(req); + /* associate the process ID with the client*/ + req.pid = getpid(); + + nxWriteSocket((char *)&req,sizeof(req)); + return nxSocket; +} + +#if GR_CLOSE_FIX +static void +mySignalhandler(int sig) +{ + if (sig == SIGALRM) { + printf("Oops! nxFlushReq() timed out, cowardly chickening " + "out!\n"); + exit(127); + } +} +#endif + +/** + * GrClose: + * + * Close the graphics device, flushing any waiting messages. + */ +/* Vladimir Cotfas: hang in GrFlush() --> nxFlushReq(0L,1); */ +void +GrClose(void) +{ + ACCESS_PER_THREAD_DATA() +#if GR_CLOSE_FIX + /* allow 1 second to flush*/ + void * oldSignalHandler = signal(SIGALRM, mySignalhandler); + alarm(1); +#endif + AllocReq(Close); + GrFlush(); +#if GR_CLOSE_FIX + alarm(0); + signal(SIGALRM, oldSignalHandler); +#endif + close(nxSocket); + nxSocket = -1; +} + +/** + * GrDefaultErrorHandler: + * @ep: the error event structure + * + * The default error handler which is called when the server reports an error + * event and the client hasn't set up a handler of it's own. + * + * Generates a human readable error message on stderr describing what error + * occurred and what function it occured in, then exits. + */ +void +GrDefaultErrorHandler(GR_EVENT *ep) +{ + if (ep->type == GR_EVENT_TYPE_ERROR) { + EPRINTF("nxclient %d: Error (%s) ", getpid(), ep->error.name); + EPRINTF(nxErrorStrings[ep->error.code], ep->error.id); + GrClose(); + exit(1); + } +} + +/** + * GrSetErrorHandler: + * @fncb: the function to call to handle error events + * @Returns: the address of the previous error handler + * + * Sets an error handling routine that will be called on any errors from + * the server (assuming the client has asked to receive them). If zero is + * used as the argument, errors will be returned as regular events instead. + */ +GR_FNCALLBACKEVENT +GrSetErrorHandler(GR_FNCALLBACKEVENT fncb) +{ + ACCESS_PER_THREAD_DATA() + GR_FNCALLBACKEVENT orig = ErrorFunc; + + ErrorFunc = fncb; + return orig; +} + +/** + * GrDelay: + * @msecs: number of milliseconds to delay + * + * This function suspends execution of the program for the specified + * number of milliseconds. + */ +void +GrDelay(GR_TIMEOUT msecs) +{ + struct timeval timeval; + + timeval.tv_sec = msecs / 1000; + timeval.tv_usec = msecs % 1000; + select(0, NULL, NULL, NULL, &timeval); +} + +/** + * GrGetScreenInfo: + * @sip: pointer to a GR_SCREEN_INFO structure + * + * Fills in the specified GR_SCREEN_INFO structure. + */ +void +GrGetScreenInfo(GR_SCREEN_INFO *sip) +{ + AllocReq(GetScreenInfo); + GrTypedReadBlock(sip, sizeof(GR_SCREEN_INFO),GrNumGetScreenInfo); +} + +/** + * GrGetSysColor: + * @index: an index into the server's colour look up table + * @Returns: the colour found at the specified index + * + * Returns the colour at the specified index into the server's colour look + * up table. The colours in the table are those with names like + * "GR_COLOR_DESKTOP", "GR_COLOR_ACTIVECAPTION", "GR_COLOR_APPWINDOW", etc. + * as listed in nano-X.h + */ +GR_COLOR +GrGetSysColor(int index) +{ + nxGetSysColorReq *req; + GR_COLOR color; + + req = AllocReq(GetSysColor); + req->index = index; + if(GrTypedReadBlock(&color, sizeof(color),GrNumGetSysColor) == -1) + return 0; + return color; +} + +/** + * GrGetFontInfo: + * @fontno: the font ID number + * @fip: pointer to a GR_FONT_INFO structure + * + * Fills in the specified GR_FONT_INFO structure with information regarding + * the specified font. + */ +void +GrGetFontInfo(GR_FONT_ID fontno, GR_FONT_INFO *fip) +{ + nxGetFontInfoReq *req; + + req = AllocReq(GetFontInfo); + req->fontid = fontno; + GrTypedReadBlock(fip, sizeof(GR_FONT_INFO),GrNumGetFontInfo); +} + +/** + * GrGetGCInfo: + * @gc: a graphics context + * @gcip: pointer to a GR_GC_INFO structure + * + * Fills in the specified GR_GC_INFO structure with information regarding the + * specified graphics context. + */ +void GrGetGCInfo(GR_GC_ID gc, GR_GC_INFO *gcip) +{ + nxGetGCInfoReq *req; + + req = AllocReq(GetGCInfo); + req->gcid = gc; + GrTypedReadBlock(gcip, sizeof(GR_GC_INFO),GrNumGetGCInfo); +} + +/** + * GrGetGCTextSize: + * @gc: the graphics context + * @str: pointer to a text string + * @count: the length of the string + * @flags: text rendering flags (GR_TF*) + * @retwidth: pointer to the variable the width will be returned in + * @retheight: pointer to the variable the height will be returned in + * @retbase: pointer to the variable the baseline height will be returned in + * + * Calculates the dimensions of the specified text string using the current font + * and flags in the specified graphics context. The count argument can be -1 + * if the string is null terminated. + */ +void GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags, + GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase) +{ + nxGetGCTextSizeReq *req; + int size; + + if(count == -1 && (flags&MWTF_PACKMASK) == MWTF_ASCII) + count = strlen((char *)str); + + size = nxCalcStringBytes(str, count, flags); + + req = AllocReqExtra(GetGCTextSize, size); + req->gcid = gc; + req->flags = flags; + memcpy(GetReqData(req), str, size); + GrTypedReadBlock(retwidth, sizeof(*retwidth),GrNumGetGCTextSize); + GrReadBlock(retheight, sizeof(*retheight)); + GrReadBlock(retbase, sizeof(*retbase)); +} + +/** + * GrRegisterInput: + * @fd: the file descriptor to monitor + * + * Register an extra file descriptor to monitor in the main select() call. + * An event will be returned when the fd has data waiting to be read if that + * event has been selected for. + */ +void +GrRegisterInput(int fd) +{ + ACCESS_PER_THREAD_DATA() + + if (fd < 0) + return; + FD_SET(fd, ®fdset); + if (fd > regfdmax) regfdmax = fd + 1; +} + +/** + * GrUnregisterInput: + * @fd: the file descriptor to stop monitoring + * + * Stop monitoring a file descriptor (previously registered with + * GrRegisterInput()) in the main select() call. + */ +void +GrUnregisterInput(int fd) +{ + int i, max; + ACCESS_PER_THREAD_DATA() + + /* unregister all inputs if fd is -1 */ + if (fd == -1) { + FD_ZERO(®fdset); + regfdmax = -1; + return; + } + + FD_CLR(fd, ®fdset); + /* recalculate the max file descriptor */ + for (i = 0, max = regfdmax, regfdmax = -1; i < max; i++) + if (FD_ISSET(i, ®fdset)) + regfdmax = i + 1; +} + +/** + * GrPrepareSelect: + * @maxfd: pointer to a variable which the highest in use fd will be written to + * @rfdset: pointer to the file descriptor set structure to use + * + * Prepare for a GrServiceSelect function by asking the server to send the next + * event but not waiting around for it to arrive and initialising the + * specified fd_set structure with the client/server socket descriptor and any + * previously registered external file descriptors. Also compares the current + * contents of maxfd, the client/server socket descriptor, and the previously + * registered external file descriptors, and returns the highest of them in + * maxfd. + */ +void +GrPrepareSelect(int *maxfd,void *rfdset) +{ + fd_set *rfds = rfdset; + int fd; + + ACCESS_PER_THREAD_DATA() + + AllocReq(GetNextEvent); + GrFlush(); + + FD_SET(nxSocket, rfds); + if(nxSocket > *maxfd) + *maxfd = nxSocket; + + /* handle registered input file descriptors*/ + for (fd = 0; fd < regfdmax; fd++) { + if (FD_ISSET(fd, ®fdset)) { + FD_SET(fd, rfds); + if (fd > *maxfd) *maxfd = fd; + } + } +} + +/** + * GrServiceSelect: + * @rfdset: pointer to the file descriptor set to monitor + * @fncb: pointer to the function to call when an event needs handling + * + * Used by GrMainLoop() to call the specified callback function when an + * event arrives or there is data waiting on an external fd specified by + * GrRegisterInput(). + */ +void +GrServiceSelect(void *rfdset, GR_FNCALLBACKEVENT fncb) +{ + fd_set * rfds = rfdset; + int fd; + GR_EVENT ev; + + ACCESS_PER_THREAD_DATA() + + /* Clean out any event that might have arrived while waiting + * for other data, for instance by doing Nano-X requests + * between GrPrepareSelect() and GrServiceSelect(), or when + * an event is generated in Nano-X at the same time as the + * client wakes up for some reason and calls Nano-X functions. + */ + if (evlist) { + /*DPRINTF("nxclient: Handling queued event\n");*/ + GetNextQueuedEvent(&ev); + CheckErrorEvent(&ev); + fncb(&ev); + } + else { + if(FD_ISSET(nxSocket, rfds)) { + GrTypedReadBlock(&ev, sizeof(ev),GrNumGetNextEvent); + GrCheckForClientData(&ev); + CheckErrorEvent(&ev); + fncb(&ev); + } + } + + /* check for input on registered file descriptors */ + for (fd = 0; fd < regfdmax; fd++) { + if (FD_ISSET(fd, ®fdset) && FD_ISSET(fd, rfds)) { + ev.type = GR_EVENT_TYPE_FDINPUT; + ev.fdinput.fd = fd; + fncb(&ev); + } + } +} + +/** + * GrMainLoop: + * @fncb: + * + * A convenience function which calls the specified callback function whenever + * an event arrives or there is data to be read on a file descriptor previously + * specified by GrRegisterInput(). Currently never returns. + */ +void +GrMainLoop(GR_FNCALLBACKEVENT fncb) +{ + fd_set rfds; + int setsize = 0; + + for(;;) { + FD_ZERO(&rfds); + GrPrepareSelect(&setsize, &rfds); + if(select(setsize+1, &rfds, NULL, NULL, NULL) > 0) + GrServiceSelect(&rfds, fncb); + } +} + +/** + * GrGetNextEvent: + * @ep: pointer to the GR_EVENT structure to return the event in + * + * Gets the next event from the event queue and places it in the specified + * GR_EVENT structure. If the queue is currently empty, we sleep until the + * next event arrives from the server or input is read on a file descriptor + * previously specified by GrRegisterInput(). + */ +void +GrGetNextEvent(GR_EVENT *ep) +{ + GrGetNextEventTimeout(ep, 0L); +} + +/** + * GrGetNextEventTimeout: + * @ep: pointer to the GR_EVENT structure to return the event in + * @timeout: the number of milliseconds to wait before timing out + * + * Gets the next event from the event queue and places it in the specified + * GR_EVENT structure. If the queue is currently empty, we sleep until the + * next event arrives from the server, input is read on a file descriptor + * previously specified by GrRegisterInput(), or a timeout occurs. Note + * that a value of 0 for the timeout parameter doesn't mean "timeout after 0 + * milliseconds" but is in fact a magic number meaning "never time out". + */ +void +GrGetNextEventTimeout(GR_EVENT *ep, GR_TIMEOUT timeout) +{ + fd_set rfds; + int setsize = 0; + int e; + struct timeval to; + ACCESS_PER_THREAD_DATA() + + if (evlist) { + /*DPRINTF("nxclient %d: Returning queued event\n",getpid());*/ + GetNextQueuedEvent(ep); + CheckErrorEvent(ep); + return; + } + + FD_ZERO(&rfds); + /* + * This will cause a GrGetNextEvent to be sent down the wire. + * If we timeout before the server responds, and then + * call this procedure again, and the server has more than + * one event waiting for this process, then more than one + * event will be written on the socket by the server. At + * that point, a single stored event won't work, and the + * client needs an event queue. + */ + GrPrepareSelect(&setsize, &rfds); + if (timeout) { + to.tv_sec = timeout / 1000; + to.tv_usec = (timeout % 1000) * 1000; + } + + if((e = select(setsize+1, &rfds, NULL, NULL, timeout ? &to : NULL))>0) { + int fd; + + if(FD_ISSET(nxSocket, &rfds)) { + /* + * This will never be GR_EVENT_NONE with the current + * implementation. + */ + GrTypedReadBlock(ep, sizeof(*ep),GrNumGetNextEvent); + GrCheckForClientData(ep); + CheckErrorEvent(ep); + return; + } + + /* check for input on registered file descriptors */ + for (fd = 0; fd < regfdmax; fd++) { + if (FD_ISSET(fd, ®fdset) && FD_ISSET(fd, &rfds)) { + ep->type = GR_EVENT_TYPE_FDINPUT; + ep->fdinput.fd = fd; + break; + } + } + } + else if (e == 0) { + /* + * Timeout has occured. We currently return a timeout event + * regardless of whether the client has selected for it. + */ + ep->type = GR_EVENT_TYPE_TIMEOUT; + } else { + if(errno == EINTR) { + ep->type = GR_EVENT_TYPE_NONE; + } else { + EPRINTF("nxclient: select failed\n"); + GrClose(); + exit(1); + } + } +} + +/** + * GrCheckNextEvent: + * @ep: pointer to the GR_EVENT structure to return the event in + * + * Gets the next event from the event queue if there is one, or returns + * immediately with an event type of GR_EVENT_TYPE_NONE if it is empty. + */ +void +GrCheckNextEvent(GR_EVENT *ep) +{ + ACCESS_PER_THREAD_DATA() + if (evlist) { + /*DPRINTF("nxclient %d: Returning queued event\n",getpid());*/ + GetNextQueuedEvent(ep); + CheckErrorEvent(ep); + return; + } + + AllocReq(CheckNextEvent); + GrTypedReadBlock(ep, sizeof(*ep),GrNumGetNextEvent); + GrCheckForClientData(ep); + CheckErrorEvent(ep); +} + +/** + * GrPeekEvent: + * @ep: pointer to the GR_EVENT structure to return the event in + * @Returns: 1 if an event was returned, or 0 if the queue was empty + * + * Fills in the specified event structure with a copy of the next event on the + * queue, without actually removing it from the queue. An event type of + * GR_EVENT_TYPE_NONE is given if the queue is empty. + */ +int +GrPeekEvent(GR_EVENT *ep) +{ + int ret; + ACCESS_PER_THREAD_DATA() + + if (evlist) { + *ep = evlist->event; + CheckErrorEvent(ep); + return 1; + } + + AllocReq(PeekEvent); + GrTypedReadBlock(ep, sizeof(*ep),GrNumPeekEvent); + GrCheckForClientData(ep); + ret = GrReadByte(); + CheckErrorEvent(ep); + return ret; +} + +/** + * GrPeekWaitEvent: + * @ep: pointer to the GR_EVENT structure to return the event in + * + * Wait until an event is available for a client, and then peek at it. + */ +void +GrPeekWaitEvent(GR_EVENT *ep) +{ + EVENT_LIST * elp; + ACCESS_PER_THREAD_DATA() + + if (evlist) { + *ep = evlist->event; + CheckErrorEvent(ep); + return; + } + + /* no events, wait for next event*/ + GrGetNextEvent(ep); + + /* add event back on head of list*/ + elp = malloc(sizeof(EVENT_LIST)); + if (elp) { + elp->event = *ep; + elp->next = evlist; + } + + /* peek at it*/ + GrPeekEvent(ep); +} + +/** + * GrSelectEvents: + * @wid: the ID of the window to set the event mask of + * @eventmask: a bit field specifying the desired event mask + * + * Select the event types which should be returned for the specified window. + */ +void +GrSelectEvents(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask) +{ + + nxSelectEventsReq *req; + + req = AllocReq(SelectEvents); + req->windowid = wid; + req->eventmask = eventmask; +} + +/** + * GrNewWindow: + * @parent: the ID of the parent window + * @x: the X coordinate of the new window relative to the parent window + * @y: the Y coordinate of the new window relative to the parent window + * @width: the width of the new window + * @height: the height of the new window + * @bordersize: the width of the window border + * @background: the colour of the window background + * @bordercolor: the colour of the window border + * @Returns: the ID of the newly created window + * + * Create a new window with the specified parent and window attributes. + */ +GR_WINDOW_ID +GrNewWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, GR_SIZE bordersize, GR_COLOR background, + GR_COLOR bordercolor) +{ + nxNewWindowReq *req; + GR_WINDOW_ID wid; + + req = AllocReq(NewWindow); + req->parentid = parent; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->backgroundcolor = background; + req->bordercolor = bordercolor; + req->bordersize = bordersize; + if(GrTypedReadBlock(&wid, sizeof(wid),GrNumNewWindow) == -1) + return 0; + return wid; +} + + +/** + * GrNewPixmap: + * @width: the width of the pixmap + * @height: the height of the pixmap + * @addr: currently unused in client/server mode + * @Returns: the ID of the newly created pixmap + * + * Create a new server side pixmap (an offscreen drawing area which can be + * copied into a window using a GrCopyArea call) of the specified width and + * height. + */ +/* FIXME: Add support for shared memory... */ +GR_WINDOW_ID +GrNewPixmap(GR_SIZE width, GR_SIZE height, void *addr) +{ + nxNewPixmapReq *req; + GR_WINDOW_ID wid; + + req = AllocReq(NewPixmap); + req->width = width; + req->height = height; + if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewPixmap) == -1) + return 0; + return wid; +} + +/** + * GrNewInputWindow: + * @parent: the ID of the window to use as the parent of the new window + * @x: the X coordinate of the new window relative to the parent window + * @y: the Y coordinate of the new window relative to the parent window + * @width: the width of the new window + * @height: the height of the new window + * @Returns: the ID of the newly created window + * + * Create a new input-only window with the specified dimensions which is a + * child of the specified parent window. + */ +GR_WINDOW_ID +GrNewInputWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height) +{ + nxNewInputWindowReq *req; + GR_WINDOW_ID wid; + + req = AllocReq(NewInputWindow); + req->parentid = parent; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewInputWindow) == -1) + return 0; + return wid; +} + +/** + * GrDestroyWindow: + * @wid: the ID of the window to destroy + * + * Recursively unmaps and frees the data structures associated with the + * specified window and all of its children. + */ +void +GrDestroyWindow(GR_WINDOW_ID wid) +{ + nxDestroyWindowReq *req; + + req = AllocReq(DestroyWindow); + req->windowid = wid; +} + +/** + * GrGetWindowInfo: + * @wid: the ID of the window to retrieve information about + * @infoptr: pointer to a GR_WINDOW_INFO structure to return the information in + * + * Fills in a GR_WINDOW_INFO structure with information regarding the window + * with the specified window ID. + */ +void +GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr) +{ + nxGetWindowInfoReq *req; + + req = AllocReq(GetWindowInfo); + req->windowid = wid; + GrTypedReadBlock(infoptr, sizeof(GR_WINDOW_INFO), GrNumGetWindowInfo); +} + +/** + * GrNewGC: + * @Returns: the ID of the newly created graphics context or 0 on error + * + * Creates a new graphics context structure and returns the ID used to refer + * to it. The structure is initialised with a set of default parameters. + */ +GR_GC_ID +GrNewGC(void) +{ + GR_GC_ID gc; + + AllocReq(NewGC); + if(GrTypedReadBlock(&gc, sizeof(gc),GrNumNewGC) == -1) + return 0; + return gc; +} + +/** + * GrCopyGC: + * @gc: the already existing graphics context to copy the parameters from + * @Returns: the ID of the newly created graphics context or 0 on error + * + * Creates a new graphics context structure and fills it in with the values + * from the specified already existing graphics context. + */ +GR_GC_ID +GrCopyGC(GR_GC_ID gc) +{ + nxCopyGCReq *req; + GR_GC_ID newgc; + + req = AllocReq(CopyGC); + req->gcid = gc; + if(GrTypedReadBlock(&newgc, sizeof(newgc),GrNumCopyGC) == -1) + return 0; + return newgc; +} + +/** + * GrDestroyGC: + * @gc: the ID of the graphics context structure to destroy + * + * Destroys the graphics context structure with the specified ID. + */ +void +GrDestroyGC(GR_GC_ID gc) +{ + nxDestroyGCReq *req; + + req = AllocReq(DestroyGC); + req->gcid = gc; +} + +/** + * GrNewRegion: + * @Returns: the ID of the newly created region + * + * Creates a new region structure and returns the ID used to refer to it. + * The structure is initialised with a set of default parameters. + */ +GR_REGION_ID +GrNewRegion(void) +{ + GR_REGION_ID region; + + AllocReq(NewRegion); + if(GrTypedReadBlock(®ion, sizeof(region),GrNumNewRegion) == -1) + return 0; + return region; +} + +/** + * GrDestroyRegion: + * @region: the ID of the region structure to destroy + * + * Destroys the region structure with the specified ID. + */ +void +GrDestroyRegion(GR_REGION_ID region) +{ + nxDestroyRegionReq *req; + + req = AllocReq(DestroyRegion); + req->regionid = region; +} + +/** + * GrUnionRectWithRegion: + * @region: the ID of the region to modify + * @rect: a pointer to the rectangle to add to the region + * + * Makes a union of the specified region and the specified rectangle and + * places the result back in the source region. + */ +void +GrUnionRectWithRegion(GR_REGION_ID region, GR_RECT *rect) +{ + nxUnionRectWithRegionReq *req; + + req = AllocReq(UnionRectWithRegion); + if(rect) + memcpy(&req->rect, rect, sizeof(*rect)); + req->regionid = region; +} + +/** + * GrUnionRegion: + * @dst_rgn: the ID of the destination region + * @src_rgn1: the ID of the first source region + * @src_rgn2: the ID of the second source region + * + * Makes a union of the specified source regions and places the result in the + * specified destination region. + */ +void +GrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2) +{ + nxUnionRegionReq *req; + + req = AllocReq(UnionRegion); + req->regionid = dst_rgn; + req->srcregionid1 = src_rgn1; + req->srcregionid2 = src_rgn2; +} + +/** + * GrSubtractRegion: + * @dst_rgn: the ID of the destination region + * @src_rgn1: the ID of the first source region + * @src_rgn2: the ID of the second source region + * + * Subtracts the second source region from the first source region and places + * the result in the specified destination region. + */ +void +GrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2) +{ + nxSubtractRegionReq *req; + + req = AllocReq(SubtractRegion); + req->regionid = dst_rgn; + req->srcregionid1 = src_rgn1; + req->srcregionid2 = src_rgn2; +} + +/** + * GrXorRegion: + * @dst_rgn: the ID of the destination region + * @src_rgn1: the ID of the first source region + * @src_rgn2: the ID of the second source region + * + * Performs a logical exclusive OR operation on the specified source regions + * and places the result in the destination region. The destination region + * will contain only the parts of the source regions which do not overlap. + */ +void +GrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2) +{ + nxXorRegionReq *req; + + req = AllocReq(XorRegion); + req->regionid = dst_rgn; + req->srcregionid1 = src_rgn1; + req->srcregionid2 = src_rgn2; +} + +/** + * GrIntersectRegion: + * @dst_rgn: the ID of the destination region + * @src_rgn1: the ID of the first source region + * @src_rgn2: the ID of the second source region + * + * Calculates the intersection of the two specified source regions and places + * the result in the specified destination region. The destination region + * will contain only the parts of the source regions which overlap each other. + */ +void +GrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2) +{ + nxIntersectRegionReq *req; + + req = AllocReq(IntersectRegion); + req->regionid = dst_rgn; + req->srcregionid1 = src_rgn1; + req->srcregionid2 = src_rgn2; +} + +/** + * GrSetGCRegion: + * @gc: the ID of the graphics context to set the clip mask of + * @region: the ID of the region to use as the clip mask + * + * Sets the clip mask of the specified graphics context to the specified + * region. Subsequent drawing operations using this graphics context will not + * draw outside the specified region. The region ID can be set to 0 to remove + * the clipping region from the specified graphics context. + */ +void +GrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region) +{ + nxSetGCRegionReq *req; + + req = AllocReq(SetGCRegion); + req->gcid = gc; + req->regionid = region; +} + +/** + * GrSetGCClipOrigin: + * @gc: the ID of the graphics context with user clip region + * @xoff: new X offset of user clip region + * @xoff: new Y offset of user clip region + * + * Sets the X,Y origin of the user clip region in the specified + * graphics context. + */ +void +GrSetGCClipOrigin(GR_GC_ID gc, int x, int y) +{ + nxSetGCClipOriginReq *req; + + req = AllocReq(SetGCClipOrigin); + req->gcid = gc; + req->xoff = x; + req->yoff = y; +} + +/** + * GrPointInRegion: + * @region: the ID of the region to examine + * @x: the X coordinate of the point to test for + * @y: the Y coordinate of the point to test for + * @Returns: True if the point is within the region, or False otherwise + * + * Tests whether the specified point is within the specified region, and + * then returns either True or False depending on the result. + */ +GR_BOOL +GrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y) +{ + nxPointInRegionReq *req; + GR_BOOL ret_value; + + req = AllocReq(PointInRegion); + req->regionid = region; + req->x = x; + req->y = y; + if(GrTypedReadBlock(&ret_value, sizeof(ret_value), + GrNumPointInRegion) == -1) + return GR_FALSE; + return ret_value; +} + +/** + * GrRectInRegion: + * @region: the ID of the region to examine + * @x: the X coordinates of the rectangle to test + * @y: the Y coordinates of the rectangle to test + * @w: the width of the rectangle to test + * @h: the height of the rectangle to test + * @Returns: GR_RECT_PARTIN, GR_RECT_ALLIN, or GR_RECT_OUT + * + * Tests whether the specified rectangle is contained within the specified + * region. Returns GR_RECT_OUT if it is not inside it at all, GR_RECT_ALLIN + * if it is completely contained within the region, or GR_RECT_PARTIN if + * it is partially contained within the region. + */ +int +GrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y, GR_COORD w, + GR_COORD h) +{ + nxRectInRegionReq *req; + unsigned short ret_value; + + req = AllocReq(RectInRegion); + req->regionid = region; + req->x = x; + req->y = y; + req->w = w; + req->h = h; + if(GrTypedReadBlock(&ret_value, sizeof(ret_value), + GrNumRectInRegion) == -1) + return 0; + return (int)ret_value; +} + +/** + * GrEmptyRegion: + * @region: the ID of the region to examine + * @Returns: GR_TRUE if the region is empty, or GR_FALSE if it is not + * + * Determines whether the specified region is empty, and returns GR_TRUE + * if it is, or GR_FALSE otherwise. + */ +GR_BOOL +GrEmptyRegion(GR_REGION_ID region) +{ + nxEmptyRegionReq *req; + GR_BOOL ret_value; + + req = AllocReq(EmptyRegion); + req->regionid = region; + if(GrTypedReadBlock(&ret_value, sizeof(ret_value), + GrNumEmptyRegion) == -1) + return GR_FALSE; + return ret_value; +} + +/** + * GrEqualRegion: + * @rgn1: the ID of the first region to examine + * @rgn2: the ID of the second region to examine + * @Returns: GR_TRUE if the regions are equal, or GR_FALSE otherwise + * + * Determines whether the specified regions are identical, and returns GR_TRUE + * if it is, or GR_FALSE otherwise. + */ +GR_BOOL +GrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2) +{ + nxEqualRegionReq *req; + GR_BOOL ret_value; + + req = AllocReq(EqualRegion); + req->region1 = rgn1; + req->region2 = rgn2; + if(GrTypedReadBlock(&ret_value, sizeof(ret_value), + GrNumEqualRegion) == -1) + return GR_FALSE; + return ret_value; +} + +/** + * GrOffsetRegion: + * @region: the ID of the region to offset + * @dx: the distance to offset the region by in the X axis + * @dy: the distance to offset the region by in the Y axis + * + * Offsets the specified region by the specified distance. + */ +void +GrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy) +{ + nxOffsetRegionReq *req; + + req = AllocReq(OffsetRegion); + req->region = region; + req->dx = dx; + req->dy = dy; +} + +/** + * GrGetRegionBox: + * @region: the ID of the region to get the bounding box of + * @rect: pointer to a rectangle structure + * @Returns: the region type + * + * Fills in the specified rectangle structure with a bounding box that would + * completely enclose the specified region, and also returns the type of the + * specified region. + */ +int +GrGetRegionBox(GR_REGION_ID region, GR_RECT *rect) +{ + nxGetRegionBoxReq *req; + unsigned short ret_value; + + if (!rect) + return GR_FALSE; + req = AllocReq(GetRegionBox); + req->regionid = region; + if(GrTypedReadBlock(rect, sizeof(*rect), GrNumGetRegionBox) == -1) + return GR_FALSE; + if(GrTypedReadBlock(&ret_value, sizeof(ret_value), + GrNumGetRegionBox) == -1) + return GR_FALSE; + return ret_value; +} + +/** + * GrNewPolygonRegion: + * @mode: the polygon mode to use (GR_POLY_EVENODD or GR_POLY_WINDING) + * @count: the number of points in the polygon + * @points: pointer to an array of point structures describing the polygon + * @Returns: the ID of the newly allocated region structure, or 0 on error + * + * Creates a new region structure, fills it with the region described by the + * specified polygon, and returns the ID used to refer to it. + */ +GR_REGION_ID +GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points) +{ + nxNewPolygonRegionReq *req; + long size; + GR_REGION_ID region; + + if(count == 0) + return GrNewRegion(); + + if(points == NULL) + return 0; + + size = (long)count * sizeof(GR_POINT); + req = AllocReqExtra(NewPolygonRegion, size); + req->mode = mode; + /* FIXME: unportable method, depends on sizeof(int) in GR_POINT*/ + memcpy(GetReqData(req), points, size); + + if(GrTypedReadBlock(®ion, sizeof(region), + GrNumNewPolygonRegion) == -1) + return 0; + return region; +} + +/** + * GrMapWindow: + * @wid: the ID of the window to map + * + * Recursively maps (makes visible) the specified window and all of the + * child windows which have a sufficient map count. The border and background + * of the window are painted, and an exposure event is generated for the + * window and every child which becomes visible. + */ +void +GrMapWindow(GR_WINDOW_ID wid) +{ + nxMapWindowReq *req; + + req = AllocReq(MapWindow); + req->windowid = wid; +} + +/** + * GrUnmapWindow: + * @wid: the ID of the window to unmap + * + * Recursively unmaps (makes invisible) the specified window and all of the + * child windows. + */ +void +GrUnmapWindow(GR_WINDOW_ID wid) +{ + nxUnmapWindowReq *req; + + req = AllocReq(UnmapWindow); + req->windowid = wid; +} + +/** + * GrRaiseWindow: + * @wid: the ID of the window to raise + * + * Places the specified window at the top of its parents drawing stack, above + * all of its sibling windows. + */ +void +GrRaiseWindow(GR_WINDOW_ID wid) +{ + nxRaiseWindowReq *req; + + req = AllocReq(RaiseWindow); + req->windowid = wid; +} + +/** + * GrLowerWindow: + * @wid: the ID of the window to lower + * + * Places the specified window at the bottom of its parents drawing stack, + * below all of its sibling windows. + */ +void +GrLowerWindow(GR_WINDOW_ID wid) +{ + nxLowerWindowReq *req; + + req = AllocReq(LowerWindow); + req->windowid = wid; +} + +/** + * GrMoveWindow: + * @wid: the ID of the window to move + * @x: the X coordinate to move the window to relative to its parent. + * @y: the Y coordinate to move the window to relative to its parent. + * + * Moves the specified window to the specified position relative to its + * parent window. + */ +void +GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y) +{ + nxMoveWindowReq *req; + + req = AllocReq(MoveWindow); + req->windowid = wid; + req->x = x; + req->y = y; +} + +/** + * GrResizeWindow: + * @wid: the ID of the window to resize + * @width: the width to resize the window to + * @height: the height to resize the window to + * + * Resizes the specified window to be the specified width and height. + */ +void +GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height) +{ + nxResizeWindowReq *req; + + req = AllocReq(ResizeWindow); + req->windowid = wid; + req->width = width; + req->height = height; +} + +/** + * GrReparentWindow: + * @wid: the ID of the window to reparent + * @pwid: the ID of the new parent window + * @x: the X coordinate to place the window at relative to the new parent + * @y: the Y coordinate to place the window at relative to the new parent + * + * Changes the parent window of the specified window to the specified parent + * window and places it at the specified coordinates relative to the new + * parent. + */ +void +GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y) +{ + nxReparentWindowReq *req; + + req = AllocReq(ReparentWindow); + req->windowid = wid; + req->parentid = pwid; + req->x = x; + req->y = y; +} + +/** + * GrClearArea: + * @wid: window ID + * @exposeflag: a flag indicating whether to also generate an exposure event + * + * Clears the specified window by to its background color or pixmap. + * If exposeflag is non zero, an exposure event is generated for + * the window after it has been cleared. + */ +void +GrClearArea(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, GR_BOOL exposeflag) +{ + nxClearAreaReq *req; + + req = AllocReq(ClearArea); + req->windowid = wid; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->exposeflag = exposeflag; +} + +/** + * GrGetFocus: + * @Returns: the ID of the window which currently has the keyboard focus + * + * Returns the ID of the window which currently has the keyboard focus. + */ +GR_WINDOW_ID +GrGetFocus(void) +{ + GR_WINDOW_ID wid; + + AllocReq(GetFocus); + if(GrTypedReadBlock(&wid, sizeof(wid), GrNumGetFocus) == -1) + return 0; + return wid; +} + +/** + * GrSetFocus: + * @wid: the ID of the window to set the focus to + * + * Sets the keyboard focus to the specified window. + */ +void +GrSetFocus(GR_WINDOW_ID wid) +{ + nxSetFocusReq *req; + + req = AllocReq(SetFocus); + req->windowid = wid; +} + +/** + * GrSetWindowCursor: + * @wid: the ID of the window to set the cursor for + * @cid: the cursor ID + * + * Specify a cursor for a window. + * This cursor will only be used within that window, and by default + * for its new children. If the cursor is currently within this + * window, it will be changed to the new one immediately. + * If the new cursor ID is 0, revert to the root window cursor. + */ +void +GrSetWindowCursor(GR_WINDOW_ID wid, GR_CURSOR_ID cid) +{ + nxSetWindowCursorReq *req; + + req = AllocReq(SetWindowCursor); + req->windowid = wid; + req->cursorid = cid; +} + +/** + * GrNewCursor: + * @width: the width of the pointer bitmap + * @height: the height of the pointer bitmap + * @hotx: the X coordinate within the bitmap used as the target of the pointer + * @hoty: the Y coordinate within the bitmap used as the target of the pointer + * @foreground: the colour to use for the foreground of the pointer + * @background: the colour to use for the background of the pointer + * @fgbitmap: pointer to bitmap data specifying the foreground of the pointer + * @bgbitmap: pointer to bitmap data specifying the background of the pointer + * + * Creates a server-based cursor (mouse graphic) resource. + */ +GR_CURSOR_ID +GrNewCursor(GR_SIZE width, GR_SIZE height, GR_COORD hotx, GR_COORD hoty, + GR_COLOR foreground, GR_COLOR background, + GR_BITMAP *fgbitmap, GR_BITMAP *bgbitmap) +{ + nxNewCursorReq *req; + int bitmapsize; + char * data; + GR_CURSOR_ID cursorid; + + bitmapsize = GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP); + req = AllocReqExtra(NewCursor, bitmapsize*2); + req->width = width; + req->height = height; + req->hotx = hotx; + req->hoty = hoty; + req->fgcolor = foreground; + req->bgcolor = background; + data = GetReqData(req); + memcpy(data, fgbitmap, bitmapsize); + memcpy(data+bitmapsize, bgbitmap, bitmapsize); + + if(GrTypedReadBlock(&cursorid, sizeof(cursorid), GrNumNewCursor) == -1) + return 0; + return cursorid; +} + +/** + * GrMoveCursor: + * @x: the X coordinate to move the pointer to + * @y: the Y coordinate to move the pointer to + * + * Moves the cursor (mouse pointer) to the specified coordinates. + * The coordinates are relative to the root window, where (0,0) is the upper + * left hand corner of the screen. The reference point used for the pointer + * is that of the "hot spot". After moving the pointer, the graphic used for + * the pointer will change to the graphic defined for use in the window which + * it is over. + */ +void +GrMoveCursor(GR_COORD x, GR_COORD y) +{ + nxMoveCursorReq *req; + + req = AllocReq(MoveCursor); + req->x = x; + req->y = y; +} + +/** + * GrSetGCForeground: + * @gc: the ID of the graphics context to set the foreground colour of + * @foreground: the colour to use as the new foreground colour + * + * Changes the foreground colour of the specified graphics context to the + * specified colour. + */ +void +GrSetGCForeground(GR_GC_ID gc, GR_COLOR foreground) +{ + nxSetGCForegroundReq *req; + + req = AllocReq(SetGCForeground); + req->gcid = gc; + req->color = foreground; +} + +/** + * GrSetGCBackground: + * @gc: the ID of the graphics context to set the background colour of + * @background: the colour to use as the new background colour + * + * Changes the background colour of the specified graphics context to the + * specified colour. + */ +void +GrSetGCBackground(GR_GC_ID gc, GR_COLOR background) +{ + nxSetGCBackgroundReq *req; + + req = AllocReq(SetGCBackground); + req->gcid = gc; + req->color = background; +} + +/** + * GrSetGCMode: + * @gc: the ID of the graphics context to set the drawing mode of + * @mode: the new drawing mode + * + * Changes the drawing mode (SET, XOR, OR, AND, etc.) of the specified + * graphics context to the specified mode. + */ +void +GrSetGCMode(GR_GC_ID gc, int mode) +{ + nxSetGCModeReq *req; + + req = AllocReq(SetGCMode); + req->gcid = gc; + req->mode = mode; +} + +/** + * GrSetGCUseBackground: + * @gc: the ID of the graphics context to change the "use background" flag of + * @flag: flag specifying whether to use the background colour or not + * + * Sets the flag which chooses whether or not the background colour is used + * when drawing bitmaps and text using the specified graphics context to the + * specified value. + */ +void +GrSetGCUseBackground(GR_GC_ID gc, GR_BOOL flag) +{ + nxSetGCUseBackgroundReq *req; + + req = AllocReq(SetGCUseBackground); + req->gcid = gc; + req->flag = flag; +} + +/** + * GrCreateFont: + * @name: string containing the name of a built in font to look for + * @height: the desired height of the font + * @plogfont: pointer to a LOGFONT structure + * @Returns: a font ID number which can be used to refer to the font + * + * Attempts to locate a font with the desired attributes and returns a font + * ID number which can be used to refer to it. If the plogfont argument is + * not NULL, the values in that structure will be used to choose a font. + * Otherwise, if the height is non zero, the built in font with the closest + * height to that specified will be used. If the height is zero, the built + * in font with the specified name will be used. If the desired font is not + * found, the first built in font will be returned as a last resort. + */ +GR_FONT_ID +GrCreateFont(GR_CHAR *name, GR_COORD height, GR_LOGFONT *plogfont) +{ + nxCreateFontReq *req; + GR_FONT_ID fontid; + + req = AllocReq(CreateFont); + if (plogfont) { + memcpy(&req->lf, plogfont, sizeof(*plogfont)); + req->height = 0; + req->lf_used = 1; + } else { + if (name) + strcpy(req->lf.lfFaceName, name); + else req->lf.lfFaceName[0] = '\0'; + req->height = height; + req->lf_used = 0; + } + + if(GrTypedReadBlock(&fontid, sizeof(fontid),GrNumCreateFont) == -1) + return 0; + return fontid; +} + +/** + * GrGetFontList: + * @fonts: pointer used to return an array of font names. + * @numfonts: pointer used to return the number of names found. + * + * Returns an array of strings containing the names of available fonts and an + * integer that specifies the number of strings returned. + */ +void +GrGetFontList(GR_FONTLIST ***fonts, int *numfonts) +{ + nxGetFontListReq *req; + char *tmpstr; + GR_FONTLIST **flist; + int num, len, i; + + req = AllocReq(GetFontList); + + GrTypedReadBlock(&num, sizeof(int), GrNumGetFontList); + + *numfonts = num; + + if(num == -1) + return; + + flist = (GR_FONTLIST**)malloc(num * sizeof(GR_FONTLIST*)); + + for(i = 0; i < num; i++) + flist[i] = (GR_FONTLIST*)malloc(sizeof(GR_FONTLIST*)); + + for(i = 0; i < num; i++) { + GrReadBlock(&len, sizeof(int)); + tmpstr = (char*)malloc(len * sizeof(char)); + GrReadBlock(tmpstr, len * sizeof(char)); + flist[i]->ttname = tmpstr; + + GrReadBlock(&len, sizeof(int)); + tmpstr = (char*)malloc(len * sizeof(char)); + GrReadBlock(tmpstr, len * sizeof(char)); + flist[i]->mwname = tmpstr; + + } + + *fonts = flist; +} + +/** + * GrFreeFontList: + * @fonts: pointer to array returned by GrGetFontList + * @numfonts: the number of font names in the array + * + * free's the specified array. + */ +void +GrFreeFontList(GR_FONTLIST ***fonts, int n) +{ + int i; + MWFONTLIST *g, **list = *fonts; + + for (i = 0; i < n; i++) { + g = list[i]; + if(g) { + if(g->mwname) + free(g->mwname); + if(g->ttname) + free(g->ttname); + free(g); + } + } + free(list); + *fonts = 0; +} + +/** + * GrSetFontSize: + * @fontid: the ID number of the font to change the size of + * @fontsize: the size to change the font to + * + * Changes the size of the specified font to the specified size. + */ +void +GrSetFontSize(GR_FONT_ID fontid, GR_COORD fontsize) +{ + nxSetFontSizeReq *req; + + req = AllocReq(SetFontSize); + req->fontid = fontid; + req->fontsize = fontsize; +} + +/** + * GrSetFontRotation: + * @fontid: the ID number of the font to rotate + * @tenthdegrees: the angle to set the rotation to in tenths of a degree + * + * Changes the rotation of the specified font to the specified angle. + */ +void +GrSetFontRotation(GR_FONT_ID fontid, int tenthdegrees) +{ + nxSetFontRotationReq *req; + + req = AllocReq(SetFontRotation); + req->fontid = fontid; + req->tenthdegrees = tenthdegrees; +} + +/** + * GrSetFontAttr: + * @fontid: the ID of the font to set the attributes of + * @setflags: mask specifying attribute flags to set + * @clrflags: mask specifying attribute flags to clear + * + * Changes the attributes (GR_TFKERNING, GR_TFANTIALIAS, GR_TFUNDERLINE, etc.) + * of the specified font according to the set and clear mask arguments. + */ +void +GrSetFontAttr(GR_FONT_ID fontid, int setflags, int clrflags) +{ + nxSetFontAttrReq *req; + + req = AllocReq(SetFontAttr); + req->fontid = fontid; + req->setflags = setflags; + req->clrflags = clrflags; +} + +/** + * GrDestroyFont: + * @fontid: the ID of the font to destroy + * + * Frees all resources associated with the specified font ID, and if the font + * is a non built in type and this is the last ID referring to it, unloads the + * font from memory. + */ +void +GrDestroyFont(GR_FONT_ID fontid) +{ + nxDestroyFontReq *req; + + req = AllocReq(DestroyFont); + req->fontid = fontid; +} + +/** + * GrSetGCFont: + * @gc: the ID of the graphics context to set the font of + * @font: the ID of the font + * + * Sets the font to be used for text drawing in the specified graphics + * context to the specified font ID. + */ +void +GrSetGCFont(GR_GC_ID gc, GR_FONT_ID font) +{ + nxSetGCFontReq *req; + + req = AllocReq(SetGCFont); + req->gcid = gc; + req->fontid = font; +} + +/** + * GrLine: + * @id: the ID of the drawable to draw the line on + * @gc: the ID of the graphics context to use when drawing the line + * @x1: the X coordinate of the start of the line relative to the drawable + * @y1: the Y coordinate of the start of the line relative to the drawable + * @x2: the X coordinate of the end of the line relative to the drawable + * @y2: the Y coordinate of the end of the line relative to the drawable + * + * Draws a line using the specified graphics context on the specified drawable + * from (x1, y1) to (x2, y2), with coordinates given relative to the drawable. + */ +void +GrLine(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, GR_COORD x2, + GR_COORD y2) +{ + nxLineReq *req; + + req = AllocReq(Line); + req->drawid = id; + req->gcid = gc; + req->x1 = x1; + req->y1 = y1; + req->x2 = x2; + req->y2 = y2; +} + +/** + * GrRect: + * @id: the ID of the drawable to draw the rectangle on + * @gc: the ID of the graphics context to use when drawing the rectangle + * @x: the X coordinate of the rectangle relative to the drawable + * @y: the Y coordinate of the rectangle relative to the drawable + * @width: the width of the rectangle + * @height: the height of the rectangle + * + * Draw the boundary of a rectangle of the specified dimensions and position + * on the specified drawable using the specified graphics context. + */ +void +GrRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height) +{ + nxRectReq *req; + + req = AllocReq(Rect); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->width = width; + req->height = height; +} + +/** + * GrFillRect: + * @id: the ID of the drawable to draw the rectangle on + * @gc: the ID of the graphics context to use when drawing the rectangle + * @x: the X coordinate of the rectangle relative to the drawable + * @y: the Y coordinate of the rectangle relative to the drawable + * @width: the width of the rectangle + * @height: the height of the rectangle + * + * Draw a filled rectangle of the specified dimensions and position on the + * specified drawable using the specified graphics context. + */ +void +GrFillRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height) +{ + nxFillRectReq *req; + + req = AllocReq(FillRect); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->width = width; + req->height = height; +} + +/** + * GrEllipse: + * @id: the ID of the drawable to draw the ellipse on + * @gc: the ID of the graphics context to use when drawing the ellipse + * @x: the X coordinate to draw the ellipse at relative to the drawable + * @y: the Y coordinate to draw the ellipse at relative to the drawable + * @rx: the radius of the ellipse on the X axis + * @ry: the radius of the ellipse on the Y axis + * + * Draws the boundary of ellipse at the specified position using the specified + * dimensions and graphics context on the specified drawable. + */ +void +GrEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, + GR_SIZE ry) +{ + nxEllipseReq *req; + + req = AllocReq(Ellipse); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->rx = rx; + req->ry = ry; +} + +/** + * GrFillEllipse: + * @id: the ID of the drawable to draw the filled ellipse on + * @gc: the ID of the graphics context to use when drawing the ellipse + * @x: the X coordinate to draw the ellipse at relative to the drawable + * @y: the Y coordinate to draw the ellipse at relative to the drawable + * @rx: the radius of the ellipse on the X axis + * @ry: the radius of the ellipse on the Y axis + * + * Draws a filled ellipse at the specified position using the specified + * dimensions and graphics context on the specified drawable. + */ +void +GrFillEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE rx, GR_SIZE ry) +{ + nxFillEllipseReq *req; + + req = AllocReq(FillEllipse); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->rx = rx; + req->ry = ry; +} + +/** + * GrArc: + * @id: the ID of the drawable to draw the arc on + * @gc: the graphics context to use when drawing the arc + * @x: the X coordinate to draw the arc at relative to the drawable + * @y: the Y coordinate to draw the arc at relative to the drawable + * @rx: the radius of the arc on the X axis + * @ry: the radius of the arc on the Y axis + * @ax: the X coordinate of the start of the arc relative to the drawable + * @ay: the Y coordinate of the start of the arc relative to the drawable + * @bx: the X coordinate of the end of the arc relative to the drawable + * @by: the Y coordinate of the end of the arc relative to the drawable + * @type: the fill style to use when drawing the arc + * + * Draws an arc with the specified dimensions at the specified position + * on the specified drawable using the specified graphics context. + * The type specifies the fill type. Possible values include GR_ARC and + * GR_PIE. + */ +void +GrArc(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay, + GR_COORD bx, GR_COORD by, int type) +{ + nxArcReq *req; + + req = AllocReq(Arc); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->rx = rx; + req->ry = ry; + req->ax = ax; + req->ay = ay; + req->bx = bx; + req->by = by; + req->type = type; +} + +/** + * GrArcAngle: + * @id: the ID of the drawable to draw the arc on + * @gc: the graphics context to use when drawing the arc + * @x: the X coordinate to draw the arc at relative to the drawable + * @y: the Y coordinate to draw the arc at relative to the drawable + * @rx: the radius of the arc on the X axis + * @ry: the radius of the arc on the Y axis + * @angle1: the angle of the start of the arc + * @angle2: the angle of the end of the arc + * @type: the fill style to use when drawing the arc + * + * Draws an arc with the specified dimensions at the specified position + * on the specified drawable using the specified graphics context. + * The type specifies the fill type. Possible values include GR_ARC and + * GR_PIE. This function requires floating point support, and is slightly + * slower than the GrArc() function which does not require floating point. + */ +void +GrArcAngle(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, GR_COORD angle2, int type) +{ + nxArcAngleReq *req; + + req = AllocReq(ArcAngle); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->rx = rx; + req->ry = ry; + req->angle1 = angle1; + req->angle2 = angle2; + req->type = type; +} + +/** + * GrBitmap: + * @id: the ID of the drawable to draw the bitmap onto + * @gc: the ID of the graphics context to use when drawing the bitmap + * @x: the X coordinate to draw the bitmap at relative to the drawable + * @y: the Y coordinate to draw the bitmap at relative to the drawable + * @width: the width of the bitmap + * @height: the height of the bitmap + * @bitmaptable: pointer to the bitmap data + * + * Draws the monochrome bitmap data provided in the bitmaptable argument + * at the specified position on the specified drawable using the specified + * graphics context. Note that the bitmap data should be an array of aligned + * 16 bit words. The usebackground flag in the graphics context specifies + * whether to draw the background colour wherever a bit value is zero. + */ +void +GrBitmap(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, GR_BITMAP *bitmaptable) +{ + nxBitmapReq *req; + long bitmapsize; + + bitmapsize = (long)GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP); + req = AllocReqExtra(Bitmap, bitmapsize); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + memcpy(GetReqData(req), bitmaptable, bitmapsize); +} + +/** + * GrDrawImageBits: + * @id: the ID of the drawable to draw the image onto + * @gc: the ID of the graphics context to use when drawing the image + * @x: the X coordinate to draw the image at relative to the drawable + * @y: the Y coordinate to draw the image at relative to the drawable + * @pimage: pointer to the image structure + * + * Draws the image contained in the specified image structure onto the + * specified drawable at the specified coordinates using the specified + * graphics context. + */ +void +GrDrawImageBits(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_IMAGE_HDR *pimage) +{ + nxDrawImageBitsReq *req; + int imagesize; + int palsize; + char *addr; + + imagesize = pimage->pitch * pimage->height; + palsize = pimage->palsize * sizeof(MWPALENTRY); + req = AllocReqExtra(DrawImageBits, imagesize + palsize); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + /* fill MWIMAGEHDR items passed externally*/ + req->width = pimage->width; + req->height = pimage->height; + req->planes = pimage->planes; + req->bpp = pimage->bpp; + req->pitch = pimage->pitch; + req->bytesperpixel = pimage->bytesperpixel; + req->compression = pimage->compression; + req->palsize = pimage->palsize; + req->transcolor = pimage->transcolor; + addr = GetReqData(req); + memcpy(addr, pimage->imagebits, imagesize); + memcpy(addr+imagesize, pimage->palette, palsize); +} + +/** + * GrDrawImageFromFile: + * @id: the ID of the drawable to draw the image onto + * @gc: the ID of the graphics context to use when drawing the image + * @x: the X coordinate to draw the image at relative to the drawable + * @y: the Y coordinate to draw the image at relative to the drawable + * @width: the maximum image width + * @height: the maximum image height + * @path: string containing the filename of the image to load + * @flags: flags specific to the particular image loader + * + * Loads the specified image file and draws it at the specified position + * on the specified drawable using the specified graphics context. The + * width and height values specify the size of the image to draw- if the + * actual image is a different size, it will be scaled to fit. The image type + * is automatically detected using the magic numbers in the image header (ie. + * the filename extension is irrelevant). The currently supported image types + * include GIF, JPEG, Windows BMP, PNG, XPM, and both ascii and binary + * variants of PBM, PGM, and PPM. However the image types supported by a + * particular server depend on which image types were enabled in the server + * configuration at build time. + */ +void +GrDrawImageFromFile(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, char* path, int flags) +{ + nxDrawImageFromFileReq *req; + + req = AllocReqExtra(DrawImageFromFile, strlen(path)+1); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->flags = flags; + memcpy(GetReqData(req), path, strlen(path)+1); +} + +/** + * GrLoadImageFromFile: + * @path: string containing the filename of the image to load + * @flags: flags specific to the particular image loader + * @Returns: ID of the image buffer the image was loaded into + * + * Loads the specified image file into a newly created server image buffer + * and returns the ID of the buffer. The image type is automatically detected + * using the magic numbers in the image header (ie. the filename extension is + * irrelevant). The currently supported image types include GIF, JPEG, Windows + * BMP, PNG, XPM, and both ascii and binary variants of PBM, PGM, and PPM. + * However the image types supported by a particular server depend on which + * image types were enabled in the server configuration at build time. + */ +GR_IMAGE_ID +GrLoadImageFromFile(char *path, int flags) +{ + nxLoadImageFromFileReq *req; + GR_IMAGE_ID imageid; + + req = AllocReqExtra(LoadImageFromFile, strlen(path)+1); + req->flags = flags; + memcpy(GetReqData(req), path, strlen(path)+1); + + if(GrTypedReadBlock(&imageid, sizeof(imageid), + GrNumLoadImageFromFile) == -1) + return 0; + return imageid; +} + +/** + * GrDrawImageToFit: + * @id: the ID of the drawable to draw the image onto + * @gc: the ID of the graphics context to use when drawing the image + * @x: the X coordinate to draw the image at relative to the drawable + * @y: the Y coordinate to draw the image at relative to the drawable + * @width: the maximum image width + * @height: the maximum image height + * @imageid: the ID of the image buffer containing the image to display + * + * Draws the image from the specified image buffer at the specified position + * on the specified drawable using the specified graphics context. The + * width and height values specify the size of the image to draw- if the + * actual image is a different size, it will be scaled to fit. + */ +void +GrDrawImageToFit(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, GR_IMAGE_ID imageid) +{ + nxDrawImageToFitReq *req; + + req = AllocReq(DrawImageToFit); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->imageid = imageid; +} + +/** + * GrFreeImage: + * @id: ID of the image buffer to free + * + * Destroys the specified image buffer and reclaims the memory used by it. + */ +void +GrFreeImage(GR_IMAGE_ID id) +{ + nxFreeImageReq *req; + + req = AllocReq(FreeImage); + req->id = id; +} + +/** + * GrGetImageInfo: + * @id: ID of an image buffer + * @iip: pointer to a GR_IMAGE_INFO structure + * + * Fills in the specified image information structure with the details of the + * specified image buffer. + */ +void +GrGetImageInfo(GR_IMAGE_ID id, GR_IMAGE_INFO *iip) +{ + nxGetImageInfoReq *req; + + req = AllocReq(GetImageInfo); + req->id = id; + GrTypedReadBlock(iip, sizeof(GR_IMAGE_INFO), GrNumGetImageInfo); +} + +static int sendImageBuffer(void *buffer, int size) { + + int bufid; + int bufsize = size; + void *bufptr = buffer; + + nxImageBufferAllocReq *alloc; + nxImageBufferSendReq *send; + + /* Step 1 - Allocate a buffer on the other side */ + + alloc = AllocReq(ImageBufferAlloc); + alloc->size = size; + + GrTypedReadBlock(&bufid, sizeof(bufid), GrNumImageBufferAlloc); + + if (bufid < 0) return(0); + + /* step 2 - Send the buffer across */ + + while(bufsize > 0) { + int chunk = (MAXREQUESTSZ - sizeof(nxImageBufferSendReq)); + if (chunk > bufsize) chunk=bufsize; + + send = AllocReqExtra(ImageBufferSend, chunk); + send->buffer_id = bufid; + send->size = chunk; + + memcpy(GetReqData(send), bufptr, chunk); + bufptr += chunk; + bufsize -= chunk; + } + + return(bufid); +} + +GR_IMAGE_ID GrLoadImageFromBuffer(void *buffer, int size, int flags) { + + int bufid; + nxLoadImageFromBufferReq *req; + GR_IMAGE_ID imageid; + + /* Step 1 - Send the buffer to the other side */ + bufid = sendImageBuffer(buffer, size); + + if (!bufid) return(0); + + /* Step 2 - Send the command to load the image */ + /* Note - This will free the buffer automagically */ + + req = AllocReq(LoadImageFromBuffer); + req->flags = flags; + req->buffer = bufid; + + if(GrTypedReadBlock(&imageid, sizeof(imageid), + GrNumLoadImageFromBuffer) == -1) + return(0); + else + return(imageid); +} + +void GrDrawImageFromBuffer(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, + void *buffer, int size, int flags) { + + int bufid; + nxDrawImageFromBufferReq *req; + + /* Step 1 - Send the buffer to the other side */ + bufid = sendImageBuffer(buffer, size); + + if (!bufid) return; + + /* Step 2 - Send the command to load/draw the image */ + /* Note - This will free the buffer automagically */ + + req = AllocReq(DrawImageFromBuffer); + req->flags = flags; + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->flags = flags; + req->buffer = bufid; +} + + +/* + * Draw a rectangular area in the specified drawable using the specified + * graphics context. This differs from rectangle drawing in that the + * color values for each pixel in the rectangle are specified. + * The color table is indexed + * row by row. Values whose color matches the background color are only + * written if the usebackground flag is set in the GC. + * + * The pixels are packed according to pixtype: + * + * pixtype array of + * MWPF_RGB MWCOLORVAL (unsigned long) + * MWPF_PIXELVAL MWPIXELVAL (compile-time dependent) + * MWPF_PALETTE unsigned char + * MWPF_TRUECOLOR0888 unsigned long + * MWPF_TRUECOLOR888 packed struct {char r,char g,char b} (24 bits) + * MWPF_TRUECOLOR565 unsigned short + * MWPF_TRUECOLOR555 unsigned short + * MWPF_TRUECOLOR332 unsigned char + */ +/** + * GrArea: + * @id: the ID of the drawable to draw the area onto + * @gc: the ID of the graphics context to use when drawing the area + * @x: the X coordinate to draw the area at relative to the drawable + * @y: the Y coordinate to draw the area at relative to the drawable + * @width: the width of the area + * @height: the height of the area + * @pixels: pointer to an array containing the pixel data + * @pixtype: the format of the pixel data + * + * Draws the specified pixel array of the specified size and format onto the + * specified drawable using the specified graphics context at the specified + * position. Note that colour conversion is currently only performed when using + * the GR_PF_RGB format, which is an unsigned long containing RGBX data. + */ +void +GrArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, void *pixels, int pixtype) +{ + nxAreaReq *req; + long size; + long chunk_y; + int pixsize; + + /* Calculate size of packed pixels*/ + switch(pixtype) { + case MWPF_RGB: + pixsize = sizeof(MWCOLORVAL); + break; + case MWPF_PIXELVAL: + pixsize = sizeof(MWPIXELVAL); + break; + case MWPF_PALETTE: + case MWPF_TRUECOLOR332: + pixsize = sizeof(unsigned char); + break; + case MWPF_TRUECOLOR0888: + pixsize = sizeof(unsigned long); + break; + case MWPF_TRUECOLOR888: + pixsize = 3; + break; + case MWPF_TRUECOLOR565: + case MWPF_TRUECOLOR555: + pixsize = sizeof(unsigned short); + break; + default: + return; + } + + /* Break request into MAXREQUESTSZ size packets*/ + while(height > 0) { + chunk_y = (MAXREQUESTSZ - sizeof(nxAreaReq)) / + ((long)width * pixsize); + if(chunk_y > height) + chunk_y = height; + size = chunk_y * ((long)width * pixsize); + req = AllocReqExtra(Area, size); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->width = width; + req->height = chunk_y; + req->pixtype = pixtype; + memcpy(GetReqData(req), pixels, size); + pixels = (void *)(((char *)pixels) + size); + y += chunk_y; + height -= chunk_y; + } +} + +/** + * GrCopyArea: + * @id: the ID of the drawable to copy the area to + * @gc: the ID of the graphics context to use when copying the area + * @x: the X coordinate to copy the area to within the destination drawable + * @y: the Y coordinate to copy the area to within the destination drawable + * @width: the width of the area to copy + * @height: the height of the area to copy + * @srcid: the ID of the drawable to copy the area from + * @srcx: the X coordinate to copy the area from within the source drawable + * @srcy: the Y coordinate to copy the area from within the source drawable + * @op: the ROP codes to pass to the blitter when performing the copy + * + * Copies the specified area of the specified size between the specified + * drawables at the specified positions using the specified graphics context + * and ROP codes. 0 is a sensible default ROP code in most cases. + */ +void +GrCopyArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, GR_DRAW_ID srcid, + GR_COORD srcx, GR_COORD srcy, int op) +{ + nxCopyAreaReq *req; + + req = AllocReq(CopyArea); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->srcid = srcid; + req->srcx = srcx; + req->srcy = srcy; + req->op = op; +} + + +/** + * GrReadArea: + * @id: the ID of the drawable to read an area from + * @x: the X coordinate to read the area from relative to the drawable + * @y: the Y coordinate to read the area from relative to the drawable + * @width: the width of the area to read + * @height: the height of the area to read + * @pixels: pointer to an area of memory to place the pixel data in + * + * Reads the pixel data of the specified size from the specified position on + * the specified drawable into the specified pixel array. If the drawable is + * a window, the data returned will be the pixel values from the relevant + * position on the screen regardless of whether the window is obscured by other + * windows. If the window is unmapped, or partially or fully outside a window + * boundary, black pixel values will be returned. + */ +void +GrReadArea(GR_DRAW_ID id,GR_COORD x,GR_COORD y,GR_SIZE width, + GR_SIZE height, GR_PIXELVAL *pixels) +{ + nxReadAreaReq *req; + long size; + + req = AllocReq(ReadArea); + req->drawid = id; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + size = (long)width * height * sizeof(MWPIXELVAL); + GrTypedReadBlock(pixels, size, GrNumReadArea); +} + +/** + * GrPoint: + * @id: the ID of the drawable to draw a point on + * @gc: the ID of the graphics context to use when drawing the point + * @x: the X coordinate to draw the point at relative to the drawable + * @y: the Y coordinate to draw the point at relative to the drawable + * + * Draws a point using the specified graphics context at the specified position + * on the specified drawable. + */ +void +GrPoint(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y) +{ + nxPointReq *req; + + req = AllocReq(Point); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + +} + +/** + * GrPoints: + * @id: the ID of the drawable to draw a point on + * @gc: the ID of the graphics context to use when drawing the point + * @count: the number of points in the point table + * @pointtable: pointer to a GR_POINT array which lists the points to draw + * + * Draws a set of points using the specified graphics context at the positions + * specified by the point table on the specified drawable. + */ +void +GrPoints(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable) +{ + nxPointsReq *req; + long size; + + size = (long)count * sizeof(GR_POINT); + req = AllocReqExtra(Points, size); + req->drawid = id; + req->gcid = gc; + memcpy(GetReqData(req), pointtable, size); +} + +/** + * GrPoly: + * @id: the ID of the drawable to draw the polygon onto + * @gc: the ID of the graphics context to use when drawing the polygon + * @count: the number of points in the point array + * @pointtable: pointer to an array of points describing the polygon + * + * Draws an unfilled polygon on the specified drawable using the specified + * graphics context. The polygon is specified by an array of point structures. + * The polygon is not automatically closed- if a closed polygon is desired, + * the last point must be the same as the first. + */ +void +GrPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable) +{ + nxPolyReq *req; + long size; + + size = (long)count * sizeof(GR_POINT); + req = AllocReqExtra(Poly, size); + req->drawid = id; + req->gcid = gc; + memcpy(GetReqData(req), pointtable, size); +} + +/** + * GrFillPoly: + * @id: the ID of the drawable to draw the polygon onto + * @gc: the ID of the graphics context to use when drawing the polygon + * @count: the number of points in the point array + * @pointtable: pointer to an array of points describing the polygon + * + * Draws a filled polygon on the specified drawable using the specified + * graphics context. The polygon is specified by an array of point structures. + * The polygon is automatically closed- the last point need not be the same as + * the first in order for the polygon to be closed. + */ +void +GrFillPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,GR_POINT *pointtable) +{ + nxFillPolyReq *req; + long size; + + size = (long)count * sizeof(GR_POINT); + req = AllocReqExtra(FillPoly, size); + req->drawid = id; + req->gcid = gc; + memcpy(GetReqData(req), pointtable, size); +} + +/** + * GrText: + * @id: the ID of the drawable to draw the text string onto + * @gc: the ID of the graphics context to use when drawing the text string + * @x: the X coordinate to draw the string at relative to the drawable + * @y: the Y coordinate to draw the string at relative to the drawable + * @str: the text string to draw + * @count: the number of characters (not bytes) in the string + * @flags: flags specifying text encoding, alignment, etc. + * + * Draws the specified text string at the specified position on the specified + * drawable using the specified graphics context and flags. The default flags + * specify ASCII encoding and baseline alignment. + */ +void +GrText(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str, + GR_COUNT count, int flags) +{ + nxTextReq *req; + int size; + + if(count == -1 && (flags&MWTF_PACKMASK) == MWTF_ASCII) + count = strlen((char *)str); + + size = nxCalcStringBytes(str, count, flags); + + req = AllocReqExtra(Text, size); + req->drawid = id; + req->gcid = gc; + req->x = x; + req->y = y; + req->count = count; + req->flags = flags; + memcpy(GetReqData(req), str, size); +} + + +/** + * GrGetSystemPalette: + * @pal: pointer to a palette structure to fill in with the system palette + * + * Retrieves the system palette and places it in the specified palette + * structure. + */ +void +GrGetSystemPalette(GR_PALETTE *pal) +{ + AllocReq(GetSystemPalette); + GrTypedReadBlock(pal, sizeof(*pal), GrNumGetSystemPalette); +} + +/** + * GrSetSystemPalette: + * @first: the first palette value to set + * @pal: pointer to a palette structure containing the new values + * + * Sets the system palette to the values stored in the specified palette + * structure. The values before the specified first value are not set. + */ +void +GrSetSystemPalette(GR_COUNT first, GR_PALETTE *pal) +{ + nxSetSystemPaletteReq *req; + + req = AllocReq(SetSystemPalette); + req->first = first; + req->count = pal->count; + memcpy(req->palette, pal->palette, sizeof(GR_PALENTRY) * pal->count); +} + +/** + * GrFindColor: + * @c: the colour value to find + * @retpixel: pointer to the returned pixel value + * + * Calculates the pixel value to use to display the specified colour value. + * The colour value is specified as a GR_COLOR, which is a 32 bit truecolour + * value stored as RGBX. The pixel value size depends on the architecture. + */ +void +GrFindColor(GR_COLOR c, GR_PIXELVAL *retpixel) +{ + nxFindColorReq *req; + + req = AllocReq(FindColor); + req->color = c; + GrTypedReadBlock(retpixel, sizeof(*retpixel), GrNumFindColor); +} + +/** + * GrReqShmCmds: + * @shmsize: the size of the shared memory area to allocate + * + * Requests a shared memory area of the specified size to use for transferring + * command arguments. This is faster but less portable than the standard BSD + * sockets method of communication (and of course will only work if the client + * and server are on the same machine). Apart from the initial allocation of + * the area using this call, the use of shared memory is completely + * transparent. Additionally, if the allocation fails we silently and + * automatically fall back on socket communication. It is safe to call this + * function even if shared memory support is not compiled in; it will simply + * do nothing. + * + * FIXME: how does the user decide what size of shared memory area to allocate? + */ +void +GrReqShmCmds(long shmsize) +{ +#if HAVE_SHAREDMEM_SUPPORT + nxReqShmCmdsReq req; + int key, shmid; + + if ( nxSharedMem != 0 ) + return; + + GrFlush(); + + shmsize = (shmsize+SHM_BLOCK_SIZE-1) & ~(SHM_BLOCK_SIZE-1); + + req.reqType = GrNumReqShmCmds; + req.hilength = 0; + req.length = sizeof(req); + req.size = shmsize; + + nxWriteSocket((char *)&req,sizeof(req)); + GrReadBlock(&key,sizeof(key)); + + if ( !key ) { + EPRINTF("nxclient: no shared memory support on server\n"); + return; + } + + shmid = shmget(key,shmsize,0); + if ( shmid == -1 ) { + EPRINTF("nxclient: Can't shmget key %d: %m\n", key); + return; + } + + nxSharedMem = shmat(shmid,0,0); + shmctl(shmid,IPC_RMID,0); /* Prevent other from attaching */ + if ( nxSharedMem == (char *)-1 ) + return; + + nxSharedMemSize = shmsize; + nxAssignReqbuffer(nxSharedMem, shmsize); +#endif /* HAVE_SHAREDMEM_SUPPORT*/ +} + +/** + * GrInjectPointerEvent: + * @x: the X coordinate of the pointer event relevant to the root window + * @y: the Y coordinate of the pointer event relevant to the root window + * @button: the pointer button status + * @visible: whether to display the pointer after the event + * + * Sets the pointer invisible if the visible parameter is GR_FALSE, or visible + * if it is GR_TRUE, then moves the pointer to the specified position and + * generates a mouse event with the specified button status. Also performs + * a GrFlush() so that the event takes effect immediately. + */ +void +GrInjectPointerEvent(GR_COORD x, GR_COORD y, int button, int visible) +{ + nxInjectEventReq *req; + + req = AllocReq(InjectEvent); + req->event_type = GR_INJECT_EVENT_POINTER; + req->event.pointer.visible = visible; + req->event.pointer.x = x; + req->event.pointer.y = y; + req->event.pointer.button = button; + + GrFlush(); +} + +/** + * GrInjectKeyboardEvent: + * @wid: ID of the window to send the event to, or 0 + * @uch: 32 bit Unicode keystroke value to inject + * @ch: 8 bit ascii keystroke value to inject + * @modifier: modifiers (shift, ctrl, alt, etc.) to inject + * @special: special keys to inject + * @content: mask specifying which arguments are valid + * + * Sends a keyboard event to the specified window, or to the window with the + * current keyboard focus if 0 is used as the ID. The other arguments + * correspond directly to the fields of the same names in the keyboard event + * structure. + */ +void +GrInjectKeyboardEvent(GR_WINDOW_ID wid, GR_KEY keyvalue, + GR_KEYMOD modifier, GR_SCANCODE scancode, GR_BOOL pressed) +{ + nxInjectEventReq *req; + + req = AllocReq(InjectEvent); + req->event_type = GR_INJECT_EVENT_KEYBOARD; + req->event.keyboard.wid = wid; + req->event.keyboard.keyvalue = keyvalue; + req->event.keyboard.modifier = modifier; + req->event.keyboard.scancode = scancode; + req->event.keyboard.pressed = pressed; + + GrFlush(); +} + +/** + * GrSetWMProperties: + * @wid: the ID of the window to set the WM properties of + * @props: pointer to a GR_WM_PROPERTIES structure + * + * Copies the provided GR_WM_PROPERTIES structure into the the GR_WM_PROPERTIES + * structure of the specified window id. + */ +void +GrSetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props) +{ + nxSetWMPropertiesReq *req; + char *addr; + int s; + + if ((props->flags & GR_WM_FLAGS_TITLE) && props->title) + s = strlen(props->title) + 1; + else s = 0; + + req = AllocReqExtra(SetWMProperties, s + sizeof(GR_WM_PROPERTIES)); + req->windowid = wid; + addr = GetReqData(req); + memcpy(addr, props, sizeof(GR_WM_PROPERTIES)); + if (s) + memcpy(addr + sizeof(GR_WM_PROPERTIES), props->title, s); +} + +/** + * GrGetWMProperties: + * @wid: the ID of the window to retreive the WM properties of + * @props: pointer to a GR_WM_PROPERTIES structure to fill in + * + * Reads the GR_WM_PROPERTIES structure for the window with the specified + * id and fills in the provided structure with the information. + * It is the callers responsibility to free the title member as it is allocated + * dynamically. The title field will be set to NULL if the window has no title. + */ +void +GrGetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props) +{ + nxGetWMPropertiesReq *req; + UINT16 textlen; + GR_CHAR c; + + req = AllocReq(GetWMProperties); + req->windowid = wid; + + GrTypedReadBlock(props, sizeof(GR_WM_PROPERTIES), GrNumGetWMProperties); + GrReadBlock(&textlen, sizeof(textlen)); + if(!textlen) { + props->title = NULL; + return; + } + if(!(props->title = malloc(textlen))) { + /* Oh dear, we're out of memory but still have to purge the + requested data (and throw it away) */ + while(textlen--) GrReadBlock(&c, 1); + } else { + GrReadBlock(props->title, textlen); + } +} + +/** + * GrCloseWindow: + * @wid: the ID of the window to send the CLOSE_REQ event to + * + * Sends a CLOSE_REQ event to the specified window if the client has selected + * to receive CLOSE_REQ events on this window. Used to request an application + * to shut down but not force it to do so immediately, so the application can + * ask whether to save changed files before shutting down cleanly. + */ +void +GrCloseWindow(GR_WINDOW_ID wid) +{ + nxCloseWindowReq *req; + + req = AllocReq(CloseWindow); + req->windowid = wid; +} + +/** + * GrKillWindow: + * @wid: the ID of the window to kill + * + * Forcibly disconnects the client which owns this window with the specified + * ID number. Used to kill an application which has locked up and is not + * responding to CLOSE_REQ events. + */ +void +GrKillWindow(GR_WINDOW_ID wid) +{ + nxKillWindowReq *req; + + req = AllocReq(KillWindow); + req->windowid = wid; +} + +/** + * GrSetScreenSaverTimeout: + * @timeout: the number of seconds of inactivity before screen saver activates + * + * Sets the number of seconds of inactivity before a screen saver activate + * event is sent to the root window ID. A value of 0 activates the + * screen saver immediately, and a value of -1 disables the screen saver + * function. + */ +void +GrSetScreenSaverTimeout(GR_TIMEOUT timeout) +{ + nxSetScreenSaverTimeoutReq *req; + + req = AllocReq(SetScreenSaverTimeout); + req->timeout = timeout; +} + +/** + * GrSetSelectionOwner: + * @wid: the ID of the window to set the selection owner to + * @typelist: list of mime types selection data can be supplied as + * + * Sets the current selection (otherwise known as the clipboard) ownership + * to the specified window. Specifying an owner of 0 disowns the selection. + * The typelist argument is a list of mime types (seperated by space + * characters) which the window is able to supply the data as. At least one + * type must be specified unless you are disowning the selection (typically + * text/plain for plain ASCII text or text/uri-list for a filename). + * + * The window which owns the current selection must be prepared to handle + * SELECTION_LOST events (received when another window takes ownership of the + * selection) and CLIENT_DATA_REQ events (received when a client wishes to + * retreive the selection data). + */ +void +GrSetSelectionOwner(GR_WINDOW_ID wid, GR_CHAR *typelist) +{ + nxSetSelectionOwnerReq *req; + char *p; + int len; + + if(wid) { + len = strlen(typelist) + 1; + req = AllocReqExtra(SetSelectionOwner, len); + p = GetReqData(req); + memcpy(p, typelist, len); + } else { + req = AllocReq(SetSelectionOwner); + } + + req->wid = wid; +} + +/** + * GrGetSelectionOwner: + * @typelist: pointer used to return the list of available mime types + * @Returns: the ID of the window which currently owns the selection, or 0 + * + * Finds the window which currently owns the selection and returns its ID, + * or 0 if no window currently owns the selection. A pointer to the list of + * mime types the selection owner is capable of supplying is placed in the + * pointer specified by the typelist argument. The typelist is null terminated, + * and the fields are seperated by space characters. It is the callers + * responsibility to free the typelist string, as it is allocated dynamically. + * If the allocation fails, it will be set to a NULL pointer, so remember to + * check the value of it before using it. + */ +GR_WINDOW_ID +GrGetSelectionOwner(GR_CHAR **typelist) +{ + nxGetSelectionOwnerReq *req; + UINT16 textlen; + GR_CHAR c; + GR_WINDOW_ID wid; + + req = AllocReq(GetSelectionOwner); + GrTypedReadBlock(&wid, sizeof(wid), GrNumGetSelectionOwner); + if(wid) { + GrReadBlock(&textlen, sizeof(textlen)); + if(!(*typelist = malloc(textlen))) { + /* Oh dear, we're out of memory but still have to + purge the requested data (and throw it away) */ + while(textlen--) GrReadBlock(&c, 1); + } else { + GrReadBlock(*typelist, textlen); + } + } + + return wid; +} + +/** + * GrRequestClientData: + * @wid: the ID of the window requesting the data + * @rid: the ID of the window to request the data from + * @serial: the serial number of the request + * @mimetype: the number of the desired mime type to request + * + * Sends a CLIENT_DATA_REQ event to the specified window. Used for requesting + * both selection and "drag and drop" data. The mimetype argument specifies + * the format of the data you would like to receive, as an index into the list + * returned by GrGetSelectionOwner (the first type in the list is index 0). + * The server makes no guarantees as to when, or even if, the client will + * reply to the request. If the client does reply, the reply will take the + * form of one or more CLIENT_DATA events. The request serial number is + * typically a unique ID which the client can assign to a request in order for + * it to be able to keep track of transfers (CLIENT_DATA events contain the + * same number in the sid field). Remember to free the data field of the + * CLIENT_DATA events as they are dynamically allocated. Also note that if + * the allocation fails the data field will be set to NULL, so you should + * check the value before using it. + */ +void +GrRequestClientData(GR_WINDOW_ID wid, GR_WINDOW_ID rid, GR_SERIALNO serial, + GR_MIMETYPE mimetype) +{ + nxRequestClientDataReq *req; + + req = AllocReq(RequestClientData); + req->wid = wid; + req->rid = rid; + req->serial = serial; + req->mimetype = mimetype; +} + +/** + * GrSendClientData: + * @wid: the ID of the window sending the data + * @did: the ID of the destination window + * @sid: the serial number of the request + * @len: the number of bytes of data to transfer + * @thislen: the number of bytes in this packet + * @data: pointer to the data to transfer + * + * Used as the response to a CLIENT_DATA_REQ event. Sends the specified data + * of the specified length to the specified window using the specified source + * window ID and transfer serial number. Any fragmentation of the data into + * multiple CLIENT_DATA events which is required is handled automatically. + * The serial number should always be set to the value supplied by the + * CLIENT_DATA_REQ event. The thislen parameter is used internally to split + * the data up into packets. It should be set to the same value as the len + * parameter. + * + */ +void +GrSendClientData(GR_WINDOW_ID wid, GR_WINDOW_ID did, GR_SERIALNO serial, + GR_LENGTH len, GR_LENGTH thislen, void *data) +{ + nxSendClientDataReq *req; + char *p; + GR_LENGTH l, pos = 0; + + while(pos < len) { + l = MAXREQUESTSZ - sizeof(nxSendClientDataReq); + if(l > (len - pos)) l = len - pos; + req = AllocReqExtra(SendClientData, l); + req->wid = wid; + req->did = did; + req->serial = serial; + req->len = len; + p = GetReqData(req); + memcpy(p, data + pos, l); + pos += l; + } +} + +/** + * GrBell: + * + * Asks the server to ring the console bell on behalf of the client (intended + * for terminal apps to be able to ring the bell on the server even if they + * are running remotely). + */ +void +GrBell(void) +{ + AllocReq(Bell); +} + +/** + * GrSetBackgroundPixmap: + * @wid: ID of the window to set the background of + * @pixmap: ID of the pixmap to use as the background + * @flags: flags specifying how to draw the pixmap onto the window + * + * Sets the background of the specified window to the specified pixmap. + * The flags which specify how to draw the pixmap (in the top left of the + * window, in the centre of the window, tiled, etc.) are those which start with + * GR_BACKGROUND_ in nano-X.h. If the pixmap value is 0, the server will + * disable the background pixmap and return to using a solid colour fill. + */ +void +GrSetBackgroundPixmap(GR_WINDOW_ID wid, GR_WINDOW_ID pixmap, int flags) +{ + nxSetBackgroundPixmapReq *req; + + req = AllocReq(SetBackgroundPixmap); + req->wid = wid; + req->pixmap = pixmap; + req->flags = flags; +} + +/** + * GrDestroyCursor: + * @id: ID of the cursor to destory + * + * Destroys the specified server-based cursor and + * reclaims the memory used by it. + */ +void +GrDestroyCursor(GR_CURSOR_ID cid) +{ + nxDestroyCursorReq *req; + + req = AllocReq(DestroyCursor); + req->cursorid = cid; +} + +/** + * GrQueryTree: + * @wid: window ID for query + * @parentid: returned parent ID + * @children: returned children ID list + * @nchildren: returned children count + * + * Return window parent and list of children. + * Caller must free() children list after use. + */ +void +GrQueryTree(GR_WINDOW_ID wid, GR_WINDOW_ID *parentid, GR_WINDOW_ID **children, + GR_COUNT *nchildren) +{ + nxQueryTreeReq *req; + GR_COUNT count; + GR_WINDOW_ID dummy; + + req = AllocReq(QueryTree); + req->windowid = wid; + + GrTypedReadBlock(parentid, sizeof(*parentid), GrNumQueryTree); + GrReadBlock(nchildren, sizeof(*nchildren)); + if (!*nchildren) { + *children = NULL; + return; + } + count = *nchildren; + if(!(*children = malloc(count * sizeof(GR_WINDOW_ID)))) { + /* We're out of memory but still have to purge the + requested data (and throw it away) */ + while(count--) + GrReadBlock(&dummy, sizeof(GR_WINDOW_ID)); + } else { + GrReadBlock(*children, count * sizeof(GR_WINDOW_ID)); + } +} + +#if YOU_WANT_TO_IMPLEMENT_DRAG_AND_DROP +/** + * GrRegisterDragAndDropWindow: + * @wid: the ID of the window to use as the drag and drop source window + * @iid: the ID of the pixmap to use as the drag and drop icon + * @typelist: list of mime types the drag and drop data can be supplied as + * + * Enables the specified window to be used as a drag and drop source. The + * specified pixmap will be used as the icon shown whilst dragging, and the + * null terminated, newline seperated list of mime types which the data can + * be supplied as is specified by the typelist argument. At least one type + * (typically text/plain for plain ASCII or text/uri-list for a filename or + * list of filenames) must be specified. When the icon is dropped, + * the window which it is dropped on will receive a DROP event (providing it + * has selected for DROP events), and if the client wishes to accept the data + * and is able to handle one of the mime types in the type list, it should use + * GrRequestClientData() to retrieve the data from the drag and drop source + * window. Remember to free the typelist field of the DROP event as it is + * dynamically allocated. It is possible for a client to select for DROP events + * on the Root window if it is desired to allow dropping icons on the desktop. + */ +void +GrRegisterDragAndDropWindow(GR_WINDOW_ID wid, GR_WINDOW_ID iid, + GR_CHAR *typelist) +{ +} +#endif + + +GR_TIMER_ID +GrCreateTimer (GR_WINDOW_ID wid, GR_TIMEOUT period) +{ + nxCreateTimerReq *req; + GR_TIMER_ID timerid; + + req = AllocReq(CreateTimer); + + req->wid = wid; + req->period = period; + + if (GrTypedReadBlock(&timerid, sizeof (timerid), GrNumCreateTimer) == -1) + return 0; + return timerid; +} + +void +GrDestroyTimer (GR_TIMER_ID tid) +{ + nxDestroyTimerReq *req; + + req = AllocReq(DestroyTimer); + req->timerid = tid; +} + +void +GrSetPortraitMode(int portraitmode) +{ + nxSetPortraitModeReq *req; + + req = AllocReq(SetPortraitMode); + req->portraitmode = portraitmode; +} diff --git a/packages/services/gfx/mw/current/src/nanox/clientfb.c b/packages/services/gfx/mw/current/src/nanox/clientfb.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/clientfb.c @@ -0,0 +1,196 @@ +/* + * Microwindows direct client-side framebuffer mapping routines + * + * Copyright (c) 2001, 2002 by Greg Haerr + */ +#include +#include +#include +#include +#ifdef __ECOS +# include +# ifdef CYGPKG_HAL_ARM +# include +# endif +#else +#include +#include +#include /* For definition of PAGE_SIZE */ +#include +#endif +#include "nano-X.h" +#include "device.h" + +/* globals: assumes use of non-shared libnano-X.a for now*/ +static int frame_fd; /* client side framebuffer fd*/ +static unsigned char * frame_map; /* client side framebuffer mmap'd addr*/ +static int frame_len; /* client side framebuffer length*/ +static unsigned char * physpixels; /* start address of pixels*/ +static GR_SCREEN_INFO sinfo; + +/* map framebuffer address into client memory*/ +unsigned char * +GrOpenClientFramebuffer(void) +{ +#ifndef __ECOS + int frame_offset; + char * fbdev; + struct fb_fix_screeninfo finfo; +#endif + + /* if already open, return fb address*/ + if (physpixels) + return physpixels; + + /* + * For now, we'll just check whether or not Microwindows + * is running its framebuffer driver to determine whether + * to allow direct client-side framebuffer mapping. In + * the future, we could allow direct mapping for Microwindows + * running on top of X, and finding the address of the + * window within the Microwindows X window. + */ + GrGetScreenInfo(&sinfo); + if (!sinfo.fbdriver) + return NULL; + +#ifdef __ECOS +# ifdef CYGPKG_HAL_ARM + { + struct lcd_info li; + lcd_getinfo(&li); + physpixels = li.fb; + return physpixels; + } +# else + /* This works for scr_ecospcsvga.c, at least */ + { + physpixels = scrdev.addr; + return physpixels; + } +# endif +#else + /* + * Try to open the framebuffer directly. + */ + if (!(fbdev = getenv("FRAMEBUFFER"))) + fbdev = "/dev/fb0"; + frame_fd = open(fbdev, O_RDWR); + if (frame_fd < 0) { + printf("Can't open framebuffer device\n"); + return NULL; + } + + /* Get the type of video hardware */ + if (ioctl(frame_fd, FBIOGET_FSCREENINFO, &finfo) < 0 ) { + printf("Couldn't get fb hardware info\n"); + goto err; + } + + // FIXME remove when mwin returns fb or X + switch (finfo.visual) { + case FB_VISUAL_TRUECOLOR: + case FB_VISUAL_PSEUDOCOLOR: + case FB_VISUAL_STATIC_PSEUDOCOLOR: + case FB_VISUAL_DIRECTCOLOR: + break; + default: + printf("Unsupported fb color map\n"); + goto err; + } + + /* Memory map the device, compensating for buggy PPC mmap() */ + frame_offset = (((long)finfo.smem_start) - + (((long)finfo.smem_start)&~(PAGE_SIZE-1))); + frame_len = finfo.smem_len + frame_offset; + frame_map = (unsigned char *)mmap(NULL, frame_len, PROT_READ|PROT_WRITE, + MAP_SHARED, frame_fd, 0); + if (frame_map == (unsigned char *)-1) { + printf("Unable to memory map the video hardware\n"); + frame_map = NULL; + goto err; + } + physpixels = frame_map + frame_offset; + return physpixels; + +err: + close(frame_fd); + return NULL; +#endif // __ECOS +} + +void +GrCloseClientFramebuffer(void) +{ +#ifndef __ECOS + if (frame_fd >= 0) { + if (frame_map) { + munmap(frame_map, frame_len); + frame_map = NULL; + physpixels = NULL; + } + close(frame_fd); + frame_fd = -1; + + /* reset sinfo struct*/ + sinfo.cols = 0; + } +#endif +} + +/* + * Return client-side mapped framebuffer info for + * passed window. If not running framebuffer, the + * physpixel and winpixel members will be NULL, and + * everything else correct. + */ +void +GrGetWindowFBInfo(GR_WINDOW_ID wid, GR_WINDOW_FB_INFO *fbinfo) +{ + int physoffset; + GR_WINDOW_INFO info; + static int last_portrait = -1; + + /* re-get screen info on auto-portrait switch*/ + if (sinfo.cols == 0 || last_portrait != sinfo.portrait) + GrGetScreenInfo(&sinfo); + last_portrait = sinfo.portrait; + + /* must get window position anew each time*/ + GrGetWindowInfo(wid, &info); + + fbinfo->bpp = sinfo.bpp; + fbinfo->bytespp = (sinfo.bpp+7)/8; + fbinfo->pixtype = sinfo.pixtype; + fbinfo->x = info.x; + fbinfo->y = info.y; + fbinfo->portrait_mode = sinfo.portrait; + + switch (fbinfo->portrait_mode) { + case MWPORTRAIT_RIGHT: + case MWPORTRAIT_LEFT: + /* + * We reverse coords since Microwindows reports + * back the virtual xres/yres, and we want + * the physical xres/yres. + */ + // FIXME return xres and xvirtres in SCREENINFO? + fbinfo->xres = sinfo.rows; /* reverse coords*/ + fbinfo->yres = sinfo.cols; + break; + default: + fbinfo->xres = sinfo.cols; + fbinfo->yres = sinfo.rows; + break; + } + fbinfo->xvirtres = sinfo.cols; + fbinfo->yvirtres = sinfo.rows; + fbinfo->pitch = fbinfo->xres * fbinfo->bytespp; + + /* fill in memory mapped addresses*/ + fbinfo->physpixels = physpixels; + + /* winpixels only valid for non-portrait modes*/ + physoffset = info.y*fbinfo->pitch + info.x*fbinfo->bytespp; + fbinfo->winpixels = physpixels? (physpixels + physoffset): NULL; +} diff --git a/packages/services/gfx/mw/current/src/nanox/elkspatch.pl b/packages/services/gfx/mw/current/src/nanox/elkspatch.pl new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/elkspatch.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl +# elkspatch.pl +# +# Perl script to hack AllocReq macros for ELKS bcc compiler +# +# This script rewrites the AllocReq macro which uses ANSI C's '##' +# token pasting operator to an input compatible with the bcc compiler +# +# This is only required if desiring to build client/server Nano-X for ELKS +# To run: +# mv client.c client.dist +# ./elkspatch.pl < client.dist > client.c +# + +while (<>) { + if (/^(.*)AllocReq\(([A-Za-z]+)\)(.*)$/) { + print("#if ELKS /* KLUDGE */\n"); + printf("%s((nx%sReq *)nxAllocReq(GrNum%s,(long)sizeof(nx%sReq), 0L))%s /* KLUDGE */\n", + $1, $2, $2, $2, $3); + print("#else /* KLUDGE */\n"); + print; + print("#endif /* KLUDGE */\n"); + } elsif (/^(.*)AllocReqExtra\(([A-Za-z]+) *, *(.*)\)(;)$/) { + print("#if ELKS /* KLUDGE */\n"); + printf("%s((nx%sReq *)nxAllocReq(GrNum%s,(long)sizeof(nx%sReq), (long)%s))%s /* KLUDGE */\n", + $1, $2, $2, $2, $3, $4); + print("#else /* KLUDGE */\n"); + print; + print("#endif /* KLUDGE */\n"); + } else { + print; + } +} diff --git a/packages/services/gfx/mw/current/src/nanox/error.c b/packages/services/gfx/mw/current/src/nanox/error.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/error.c @@ -0,0 +1,31 @@ +/* + * Reconfigurable error handler + */ + +#include +#include +#if (UNIX | DOS_DJGPP) +#include +#endif +#include "device.h" + +/* output error message and return -1*/ +int +GdError(const char *format, ...) +{ + va_list args; + char buf[512]; + + va_start(args, format); + vsprintf(buf, format, args); + va_end(args); + write(2, buf, strlen(buf)); + return -1; +} + +/* null routine to consume messages */ +int +GdErrorNull(const char *format, ...) +{ + return -1; +} diff --git a/packages/services/gfx/mw/current/src/nanox/nanox.syms b/packages/services/gfx/mw/current/src/nanox/nanox.syms new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/nanox.syms @@ -0,0 +1,1 @@ +nanox_main diff --git a/packages/services/gfx/mw/current/src/nanox/nxdraw.c b/packages/services/gfx/mw/current/src/nanox/nxdraw.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/nxdraw.c @@ -0,0 +1,251 @@ +/* + * Copyright (c) 2000 Greg Haerr + * + * Nano-X Draw Library + */ +#define MWINCLUDECOLORS +#include +#include "nano-X.h" +#include "nxdraw.h" + +void +nxPaintNCArea(GR_DRAW_ID id, int w, int h, GR_CHAR *title, GR_BOOL active, + GR_WM_PROPS props) +{ + int x = 0; + int y = 0; + GR_GC_ID gc = GrNewGC(); + GR_FONT_ID fontid; + GR_RECT r; + + + if (props & GR_WM_PROPS_APPFRAME) { + /* draw 2-line 3d border around window*/ + nxDraw3dOutset(id, x, y, w, h); + x += 2; y += 2; w -= 4; h -= 4; + + /* draw 1-line inset inside border*/ + GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPWINDOW)); + GrRect(id, gc, x, y, w, h); + x += 1; y += 1; w -= 2; h -= 2; + } else if (props & GR_WM_PROPS_BORDER) { + /* draw 1-line black border around window*/ + GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_WINDOWFRAME)); + GrRect(id, gc, x, y, w, h); + x += 1; y += 1; w -= 2; h -= 2; + } + + if (!(props & GR_WM_PROPS_CAPTION)) + goto out; + + /* fill caption*/ + GrSetGCForeground(gc, + GrGetSysColor(active? GR_COLOR_ACTIVECAPTION: + GR_COLOR_INACTIVECAPTION)); + GrFillRect(id, gc, x, y, w, CYCAPTION); + + /* draw caption text*/ + if (title) { + GrSetGCForeground(gc, + GrGetSysColor(active? GR_COLOR_ACTIVECAPTIONTEXT: + GR_COLOR_INACTIVECAPTIONTEXT)); + GrSetGCUseBackground(gc, GR_FALSE); + fontid = GrCreateFont(GR_FONT_GUI_VAR, 0, NULL); + GrSetGCFont(gc, fontid); + GrText(id, gc, x+4, y-1, title, -1, GR_TFASCII|GR_TFTOP); + GrDestroyFont(fontid); + } + y += CYCAPTION; + + /* draw one line under caption*/ + if (props & GR_WM_PROPS_APPFRAME) { + GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPWINDOW)); + GrLine(id, gc, x, y, x+w-1, y); + } + + if (props & GR_WM_PROPS_CLOSEBOX) { + /* draw close box*/ + r.x = x + w - CXCLOSEBOX - 2; + r.y = y - CYCAPTION + 2; + r.width = CXCLOSEBOX; + r.height = CYCLOSEBOX; + + nxDraw3dBox(id, r.x, r.y, r.width, r.height, + GrGetSysColor(GR_COLOR_BTNHIGHLIGHT), + GrGetSysColor(GR_COLOR_WINDOWFRAME)); + nxInflateRect(&r, -1, -1); + GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPWINDOW)); + GrFillRect(id, gc, r.x, r.y, r.width, r.height); + + nxInflateRect(&r, -1, -1); + GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_BTNTEXT)); + GrLine(id, gc, r.x, r.y, r.x+r.width-1, r.y+r.height-1); + GrLine(id, gc, r.x, r.y+r.height-1, r.x+r.width-1, r.y); + } + +#if 0 + /* fill in client area*/ + y++; + h -= CYCAPTION+1; + GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPWINDOW)); + GrFillRect(id, gc, x, y, w, h); +#endif + +out: + GrDestroyGC(gc); +} + +/* + * Enlarge/decrease the size of a rectangle + */ +void +nxInflateRect(GR_RECT *prc, GR_SIZE dx, GR_SIZE dy) +{ + prc->x -= dx; + prc->y -= dy; + prc->width += dx * 2; + prc->height += dy * 2; +} + +/* + * nxDraw3dShadow + * NOINDENT_BLACK T=white, B=black + * NOINDENT_GRAY T=white, B=dkgray + * INDENT_BLACK T=black, B=white + * INDENT_GRAY T=dkgray, B=white + * + * TTTTTTTTTTTTTT + * T B + * T B + * BBBBBBBBBBBBBB + */ +void +nxDraw3dShadow(GR_DRAW_ID id,int x,int y,int w,int h,GR_COLOR crTop, + GR_COLOR crBottom) +{ + GR_GC_ID gc = GrNewGC(); + + GrSetGCForeground(gc, crTop); + /*MoveToEx( hDC, x, y+h-2, NULL);*/ + /*LineTo( hDC, x, y);*/ /* left side*/ + GrLine(id, gc, x, y+h-2, x, y); /* left*/ + /*LineTo( hDC, x+w-1, y);*/ /* top side*/ + GrLine(id, gc, x, y, x+w-2, y); /* top*/ + + GrSetGCForeground(gc, crBottom); + /*MoveToEx( hDC, x+w-1, y+1, NULL);*/ + /*LineTo( hDC, x+w-1, y+h-1);*/ /* right side*/ + GrLine(id, gc, x+w-1, y+1, x+w-1, y+h-2); /* right*/ + /*LineTo( hDC, x, y+h-1);*/ /* bottom side*/ + GrLine(id, gc, x+w-1, y+h-1, x, y+h-1); /* bottom*/ + + GrDestroyGC(gc); +} + +/* + * nxDraw3dBox + * + * TTTTTTTTTTTTTTB + * T B + * T B + * BBBBBBBBBBBBBBB + */ +void +nxDraw3dBox(GR_WINDOW_ID id,int x,int y,int w,int h,GR_COLOR crTop, + GR_COLOR crBottom) +{ + GR_GC_ID gc = GrNewGC(); + + GrSetGCForeground(gc, crTop); + /*MoveToEx( hDC, x, y+h-2, NULL);*/ + /*LineTo( hDC, x, y);*/ /* left side*/ + GrLine(id, gc, x, y+h-2, x, y+1); /* left*/ + /*MoveToEx( hDC, x, y, NULL);*/ + /*LineTo( hDC, x+w-1, y);*/ /* top side*/ + GrLine(id, gc, x, y, x+w-2, y); /* top*/ + + GrSetGCForeground(gc, crBottom); + GrLine(id, gc, x+w-1, y, x+w-1, y+h-2); /* right*/ + /*MoveToEx( hDC, x+w-1, y, NULL);*/ + /*LineTo( hDC, x+w-1, y+h-1);*/ /* right side*/ + GrLine(id, gc, x+w-1, y+h-1, x, y+h-1); /* bottom*/ + /*LineTo( hDC, x-1, y+h-1);*/ /* bottom side*/ + + GrDestroyGC(gc); +} + +/* + * Draw 2 line deep 3d inset + */ +void +nxDraw3dInset(GR_DRAW_ID id,int x,int y,int w,int h) +{ + nxDraw3dBox(id, x, y, w, h, + GrGetSysColor(GR_COLOR_BTNSHADOW), + GrGetSysColor(GR_COLOR_BTNHIGHLIGHT)); + ++x; ++y; w -= 2; h -= 2; + nxDraw3dBox(id, x, y, w, h, + GrGetSysColor(GR_COLOR_WINDOWFRAME), + GrGetSysColor(GR_COLOR_3DLIGHT)); +} + +/* + * Draw 2 line deep 3d outset + */ +void +nxDraw3dOutset(GR_DRAW_ID id,int x,int y,int w,int h) +{ + nxDraw3dBox(id, x, y, w, h, + GrGetSysColor(GR_COLOR_3DLIGHT), + GrGetSysColor(GR_COLOR_WINDOWFRAME)); + ++x; ++y; w -= 2; h -= 2; + nxDraw3dBox(id, x, y, w, h, + GrGetSysColor(GR_COLOR_BTNHIGHLIGHT), + GrGetSysColor(GR_COLOR_BTNSHADOW)); +} + +/* + * Draw 1 line pushed down rectangle + */ +void +nxDraw3dPushDown(GR_DRAW_ID id, int x, int y, int w, int h) +{ + nxDraw3dBox(id, x, y, w, h, GrGetSysColor(GR_COLOR_BTNSHADOW), + GrGetSysColor(GR_COLOR_BTNSHADOW)); +} + +/* + * Draw either 3d up or down depending on state + */ +void +nxDraw3dUpDownState(GR_DRAW_ID id, int x, int y, int w, int h, GR_BOOL fDown) +{ + if (fDown) + nxDraw3dPushDown(id, x, y, w, h); + else nxDraw3dOutset(id, x, y, w, h); +} + +#if 0 +void +nxDraw3dUpFrame(GR_DRAW_ID id, int l, int t, int r, int b) +{ + RECT rc; + HBRUSH hbr; + + SetRect(&rc, l, t, r, b); + nxDraw3dBox(hDC, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GrGetSysColor(GR_COLOR_3DLIGHT), + GrGetSysColor(GR_COLOR_WINDOWFRAME)); + nxInflateRect(&rc, -1, -1); + nxDraw3dBox(hDC, rc.left, rc.top, + rc.right-rc.left, rc.bottom-rc.top, + GrGetSysColor(GR_COLOR_BTNHIGHLIGHT), + GrGetSysColor(GR_COLOR_BTNSHADOW)); + nxInflateRect(&rc, -1, -1); + + hbr = CreateSolidBrush(GrGetSysColor(GR_COLOR_APPWINDOW)); + FillRect(hDC, &rc, hbr); + DeleteObject(hbr); +} +#endif diff --git a/packages/services/gfx/mw/current/src/nanox/nxproto.c b/packages/services/gfx/mw/current/src/nanox/nxproto.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/nxproto.c @@ -0,0 +1,205 @@ +/* + * Copyright (c) 1999 Greg Haerr + * + * Nano-X Core Protocol Client Request Handling Routines + */ +#include +#include +#include +#include +#include +#include +#include "serv.h" +#include "nxproto.h" + +#define SZREQBUF 2048 /* initial request buffer size*/ + +#ifndef __ECOS +static REQBUF reqbuf; /* request buffer*/ +extern int nxSocket; +extern char * nxSharedMem; +#endif + +/* Allocate a request buffer of passed size and fill in header fields*/ +void * +nxAllocReq(int type, long size, long extra) +{ + nxReq * req; + long aligned_len; + ACCESS_PER_THREAD_DATA(); + + /* variable size requests must be hand-padded*/ + if(extra) + assert((size & (long)(ALIGNSZ-1)) == 0); + + /* calculate aligned length of request buffer*/ + aligned_len = (size + extra + (long)(ALIGNSZ-1)) & ~(long)(ALIGNSZ-1); + + /* verify we're not greater than max request size*/ + assert(aligned_len <= MAXREQUESTSZ); + + /* flush buffer if required, and allocate larger one if required*/ + if(reqbuf.bufptr + aligned_len >= reqbuf.bufmax) + nxFlushReq(aligned_len,1); + + /* fill in request header*/ + req = (nxReq *)reqbuf.bufptr; + req->reqType = (BYTE8)type; + req->hilength = (BYTE8)((size + extra) >> 16); + req->length = (UINT16)(size + extra); + reqbuf.bufptr += aligned_len; + return req; +} + +static void nxAllocReqbuffer(long newsize) +{ + ACCESS_PER_THREAD_DATA(); + + if(newsize < (long)SZREQBUF) + newsize = SZREQBUF; + reqbuf.buffer = malloc(newsize); + if(!reqbuf.buffer) { + EPRINTF("nxFlushReq: Can't allocate initial request buffer\n"); + exit(1); + } + reqbuf.bufptr = reqbuf.buffer; + reqbuf.bufmax = reqbuf.buffer + newsize; +} + +void +nxAssignReqbuffer(char *buffer, long size) +{ + ACCESS_PER_THREAD_DATA(); + + if ( reqbuf.buffer != 0 ) + free(reqbuf.buffer); + reqbuf.buffer = buffer; + reqbuf.bufptr = reqbuf.buffer; + reqbuf.bufmax = reqbuf.buffer + size; +} + +/* Write a block of data on the socket to the nano-X server */ +void +nxWriteSocket(char *buf, int todo) +{ + int written; + ACCESS_PER_THREAD_DATA(); + + do { + written = write(nxSocket, buf, todo); + if ( written < 0 ) { + if ( errno == EAGAIN || errno == EINTR ) + continue; + EPRINTF("nxFlushReq: write failed: %m\n"); + exit(1); + } + buf += written; + todo -= written; + } while ( todo > 0 ); +} + +/* Flush request buffer if required, possibly reallocate buffer size*/ +void +nxFlushReq(long newsize, int reply_needed) +{ + ACCESS_PER_THREAD_DATA(); + + /* handle one-time initialization case*/ + if(reqbuf.buffer == NULL) { + nxAllocReqbuffer(newsize); + return; + } + + /* flush buffer if required*/ + if(reqbuf.bufptr > reqbuf.buffer) { + char * buf = reqbuf.buffer; + int todo = reqbuf.bufptr - reqbuf.buffer; + +#if HAVE_SHAREDMEM_SUPPORT + if ( nxSharedMem != 0 ) { + /* There is a shared memory segment used for the + * request buffer. Make up a flush command and + * send it over the socket, to tell the server to + * process the shared memory segment. + * The 'reply_needed' argument should be non-zero + * when a confirmation is needed that all commands + * are flushed, so new ones can be filled into the + * request buffer. NOTE: This is *only* needed + * when explicitely flushing the request buffer, or + * when flushing it to make space for new commands. + * DO NOT REQUEST A REPLY when flushing the request + * buffer because the last command in the buffer + * will send a response: This response would be + * queued up first and had to be drained before the + * response to the flush command itsel.... + * So the GrReadBlock used to read replys to commands + * must not specify a nonzero 'reply_needed'. + * Not requesting a reply in this case is + * safe, since the command executed will wait for + * the reply *it* is waiting for, and thus make + * sure the request buffer is flushed before + * continuing. + * + * We have to make the protocol request by hand, + * as it has to be sent over the socket to wake + * up the Nano-X server. + */ + char c; + nxShmCmdsFlushReq req; + + req.reqType = GrNumShmCmdsFlush; + req.hilength = 0; + req.length = sizeof(req); + req.size = todo; + req.reply = reply_needed; + + nxWriteSocket((char *)&req,sizeof(req)); + + if ( reply_needed ) + while ( read(nxSocket, &c, 1) != 1 ) + ; + + reqbuf.bufptr = reqbuf.buffer; + + if ( reqbuf.buffer + newsize > reqbuf.bufmax ) { + /* Shared memory too small, critical */ + EPRINTF("nxFlushReq: shm region too small\n"); + exit(1); + } + return; + } +#endif /* HAVE_SHAREDMEM_SUPPORT*/ + + /* Standard Socket transfer */ + nxWriteSocket(buf,todo); + reqbuf.bufptr = reqbuf.buffer; + } + + /* allocate larger buffer for current request, if needed*/ + if(reqbuf.bufptr + newsize >= reqbuf.bufmax) { + reqbuf.buffer = realloc(reqbuf.buffer, newsize); + if(!reqbuf.buffer) { + EPRINTF("nxFlushReq: Can't reallocate request buffer\n"); + exit(1); + } + reqbuf.bufptr = reqbuf.buffer; + reqbuf.bufmax = reqbuf.buffer + newsize; + } +} + +/* calc # bytes required for passed string according to encoding*/ +int +nxCalcStringBytes(void *str, int count, int flags) +{ + int nbytes; + + /* calc byte length of data*/ + if(flags & MWTF_UC16) + nbytes = count * 2; + else if(flags & MWTF_UC32) + nbytes = count * 4; + else + nbytes = count; + + return nbytes; +} diff --git a/packages/services/gfx/mw/current/src/nanox/nxproto.h b/packages/services/gfx/mw/current/src/nanox/nxproto.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/nxproto.h @@ -0,0 +1,1172 @@ +/* + * Copyright (c) 1999 Greg Haerr + * Copyright (c) 2000 Alex Holden + * + * Nano-X Core Protocol Header + * + * These structures define the Nano-X client/server protocol. + * Much of this has been modeled after the X11 implementation. + * Note that all NX Protocol requests should have all data quantities + * properly aligned. This is assured by hand-coding each NX request + * structure. Unlike Xlib, fixed size request structs don't have to + * be a multiple of 4 bytes, since the length field is a byte count + * and GetReq() automatically pads all requests to 4-byte boundaries. + * Request structs for variable size data, however, must be hand-padded + * to 4-byte alignment, as variable data starts after sizeof(structure). + * Also, the hilength/length fields store the unaligned byte count, so + * that extra code isn't required to de-crypt extra data size or + * big packets. + */ + +/* + * The following is provided to allow limiting the maximum + * request size that will be sent (not received) using this protocol. + * The protocol allows for 2^24 byte maximum, but the + * server currently allocates the MAXREQUESTSZ in a stack buffer. + * Also, the client realloc's the request queue to + * the largest size asked for, and currently never reduces it. + * + * Routines like GrArea will split packets to be <= MAXREQUESTSZ + * automatically. + * + * NOTE: MAXREQUESTSZ must be an _aligned_ multiple of 4, meaning + * that MAXREQUESTSZ = (MAXREQUESTSZ + 3) & ~3. + */ +#define MAXREQUESTSZ 30000 /* max request size (65532)*/ + +typedef unsigned char BYTE8; /* 1 byte*/ +typedef unsigned short UINT16; /* 2 bytes*/ +typedef short INT16; /* 2 bytes*/ +typedef unsigned long UINT32; /* 4 bytes*/ + +#if ELKS +typedef UINT16 IDTYPE; +#define ALIGNSZ 2 /* 2 byte packet alignment*/ +#else +typedef UINT32 IDTYPE; +#define ALIGNSZ 4 /* 4 byte packet alignment*/ +#endif + +/* all requests share this header*/ +typedef struct { + BYTE8 reqType; /* request code*/ + BYTE8 hilength; /* upper 24 bits of unaligned length*/ + UINT16 length; /* lower 16 bits of unaligned length*/ +} nxReq; + +/* Allocate a fixed size request from request buffer*/ +#define AllocReq(name) \ + ((nx##name##Req *)nxAllocReq(GrNum##name,sizeof(nx##name##Req), 0)) + +/* Allocate a request, but allocate n extra bytes*/ +#define AllocReqExtra(name,n) \ + ((nx##name##Req *)nxAllocReq(GrNum##name,sizeof(nx##name##Req), n)) + +/* return pointer to variable length data*/ +#define GetReqData(req) ((void *)((char *)req + sizeof(* (req)))) + +/* FIXME fails when sizeof(int) == 2*/ +/* get request total valid data length, including header*/ +#define GetReqLen(req) (((req)->hilength << 16) | (req)->length) + +/* get request variable data length, not including fixed size structure*/ +#define GetReqVarLen(req) (GetReqLen(req) - sizeof(* (req))) + +/* get request total aligned length*/ +#define GetReqAlignedLen(req) ((GetReqLen(req) + (ALIGNSZ-1)) & ~(ALIGNSZ-1)) + +void * nxAllocReq(int type, long size, long extra); +void nxFlushReq(long newsize, int reply_needed); +void nxAssignReqbuffer(char *buffer, long size); +void nxWriteSocket(char *buf, int todo); +int nxCalcStringBytes(void *str, int count, int flags); + +#if notyet +/* all replies share this header*/ +typedef struct { + BYTE8 repType; /* reply code*/ + BYTE8 hilength; /* upper 24 bits of unaligned length*/ + UINT16 length; /* lower 16 bits of unaligned length*/ +} nxReply; + +/* reply types if not equal to request type*/ +#define GrNumErrorReply 255 +#define GrNumEventReply 254 +#endif /* notyet*/ + +#define GrNumOpen 0 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT32 pid; +} nxOpenReq; + +#define GrNumClose 1 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxCloseReq; + +#define GrNumGetScreenInfo 2 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxGetScreenInfoReq; + +#define GrNumNewWindow 3 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE parentid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; + UINT32 backgroundcolor; + UINT32 bordercolor; + INT16 bordersize; +} nxNewWindowReq; + +#define GrNumNewInputWindow 4 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE parentid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; +} nxNewInputWindowReq; + +#define GrNumDestroyWindow 5 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxDestroyWindowReq; + +#define GrNumNewGC 6 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxNewGCReq; + +#define GrNumCopyGC 7 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; +} nxCopyGCReq; + +#define GrNumGetGCInfo 8 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; +} nxGetGCInfoReq; + +#define GrNumDestroyGC 9 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; +} nxDestroyGCReq; + +#define GrNumMapWindow 10 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxMapWindowReq; + +#define GrNumUnmapWindow 11 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxUnmapWindowReq; + +#define GrNumRaiseWindow 12 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxRaiseWindowReq; + +#define GrNumLowerWindow 13 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxLowerWindowReq; + +#define GrNumMoveWindow 14 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; + INT16 x; + INT16 y; +} nxMoveWindowReq; + +#define GrNumResizeWindow 15 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; + INT16 width; + INT16 height; +} nxResizeWindowReq; + +#define GrNumGetWindowInfo 16 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxGetWindowInfoReq; + +#define GrNumGetFontInfo 17 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE fontid; +} nxGetFontInfoReq; + +#define GrNumSetFocus 18 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxSetFocusReq; + +#define GrNumSetWindowCursor 19 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; + IDTYPE cursorid; +} nxSetWindowCursorReq; + +#define GrNumClearArea 20 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; + UINT16 x; + UINT16 y; + UINT16 width; + UINT16 height; + UINT16 exposeflag; +} nxClearAreaReq; + +#define GrNumSelectEvents 21 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; + UINT32 eventmask; +} nxSelectEventsReq; + +#define GrNumGetNextEvent 22 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxGetNextEventReq; + +#define GrNumCheckNextEvent 23 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxCheckNextEventReq; + +#define GrNumPeekEvent 24 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxPeekEventReq; + +#define GrNumLine 25 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x1; + INT16 y1; + INT16 x2; + INT16 y2; +} nxLineReq; + +#define GrNumPoint 26 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; +} nxPointReq; + +#define GrNumRect 27 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; +} nxRectReq; + +#define GrNumFillRect 28 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; +} nxFillRectReq; + +#define GrNumPoly 29 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + /*INT16 pointtable[];*/ +} nxPolyReq; + +#define GrNumFillPoly 30 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + /*INT16 pointtable[];*/ +} nxFillPolyReq; + +#define GrNumEllipse 31 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 rx; + INT16 ry; +} nxEllipseReq; + +#define GrNumFillEllipse 32 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 rx; + INT16 ry; +} nxFillEllipseReq; + +#define GrNumSetGCForeground 33 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; + UINT32 color; +} nxSetGCForegroundReq; + +#define GrNumSetGCBackground 34 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; + UINT32 color; +} nxSetGCBackgroundReq; + +#define GrNumSetGCUseBackground 35 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; + UINT16 flag; +} nxSetGCUseBackgroundReq; + +#define GrNumSetGCMode 36 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; + UINT16 mode; +} nxSetGCModeReq; + +#define GrNumSetGCFont 37 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; + IDTYPE fontid; +} nxSetGCFontReq; + +#define GrNumGetGCTextSize 38 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; + UINT16 flags; + UINT16 pad; + /*BYTE8 text[];*/ +} nxGetGCTextSizeReq; + +#define GrNumReadArea 39 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; +} nxReadAreaReq; + +#define GrNumArea 40 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; + INT16 pixtype; + INT16 pad; + /*UINT32 pixels[];*/ +} nxAreaReq; + +#define GrNumBitmap 41 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; + /*UINT16 bitmaptable[];*/ +} nxBitmapReq; + +#define GrNumText 42 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 count; + INT16 flags; + /*BYTE8 text[];*/ +} nxTextReq; + +#define GrNumNewCursor 43 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + INT16 width; + INT16 height; + INT16 hotx; + INT16 hoty; + UINT32 fgcolor; + UINT32 bgcolor; + /*UINT16 fgbitmap[];*/ + /*UINT16 bgbitmap[];*/ +} nxNewCursorReq; + +#define GrNumMoveCursor 44 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + INT16 x; + INT16 y; +} nxMoveCursorReq; + +#define GrNumGetSystemPalette 45 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxGetSystemPaletteReq; + +#define GrNumFindColor 46 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT32 color; +} nxFindColorReq; + +#define GrNumReparentWindow 47 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; + IDTYPE parentid; + INT16 x; + INT16 y; +} nxReparentWindowReq; + +#define GrNumDrawImageFromFile 48 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; + IDTYPE flags; + /*char path[];*/ +} nxDrawImageFromFileReq; + +#define GrNumLoadImageFromFile 49 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + INT16 flags; + INT16 pad; +} nxLoadImageFromFileReq; + +#define GrNumNewPixmap 50 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + INT16 width; + INT16 height; +/* FIXME: Add support for passing shared memory info */ +} nxNewPixmapReq; + +#define GrNumCopyArea 51 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; + IDTYPE srcid; + INT16 srcx; + INT16 srcy; + UINT32 op; +} nxCopyAreaReq; + +#define GrNumSetFontSize 52 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE fontid; + INT16 fontsize; +} nxSetFontSizeReq; + +#define GrNumCreateFont 53 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + INT16 height; + INT16 lf_used; + MWLOGFONT lf; +} nxCreateFontReq; + +#define GrNumDestroyFont 54 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE fontid; +} nxDestroyFontReq; + +#define GrNumReqShmCmds 55 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT32 size; +} nxReqShmCmdsReq; + +#define GrNumShmCmdsFlush 56 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT32 size; + UINT32 reply; +} nxShmCmdsFlushReq; + +#define GrNumSetFontRotation 57 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE fontid; + INT16 tenthdegrees; +} nxSetFontRotationReq; + +#define GrNumSetFontAttr 58 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE fontid; + INT16 setflags; + INT16 clrflags; +} nxSetFontAttrReq; + +#define GrNumSetSystemPalette 59 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + INT16 first; + INT16 count; + MWPALENTRY palette[256]; +} nxSetSystemPaletteReq; + +#define GrNumInjectEvent 60 +#define GR_INJECT_EVENT_POINTER 0 +#define GR_INJECT_EVENT_KEYBOARD 1 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + union { + struct { + INT16 x; + INT16 y; + UINT16 button; + BYTE8 visible; + } pointer; + struct { + IDTYPE wid; + UINT16 keyvalue; + UINT16 modifier; + BYTE8 scancode; + BYTE8 pressed; + } keyboard; + } event; + UINT16 event_type; +} nxInjectEventReq; + +#define GrNumNewRegion 61 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxNewRegionReq; + +#define GrNumDestroyRegion 62 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE regionid; +} nxDestroyRegionReq; + +#define GrNumUnionRectWithRegion 63 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE regionid; + GR_RECT rect; +} nxUnionRectWithRegionReq; + +#define GrNumUnionRegion 64 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE regionid; + IDTYPE srcregionid1; + IDTYPE srcregionid2; +} nxUnionRegionReq; + +#define GrNumIntersectRegion 65 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE regionid; + IDTYPE srcregionid1; + IDTYPE srcregionid2; +} nxIntersectRegionReq; + +#define GrNumSetGCRegion 66 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; + IDTYPE regionid; +} nxSetGCRegionReq; + +#define GrNumSubtractRegion 67 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE regionid; + IDTYPE srcregionid1; + IDTYPE srcregionid2; +} nxSubtractRegionReq; + +#define GrNumXorRegion 68 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE regionid; + IDTYPE srcregionid1; + IDTYPE srcregionid2; +} nxXorRegionReq; + +#define GrNumPointInRegion 69 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE regionid; + INT16 x; + INT16 y; +} nxPointInRegionReq; + +#define GrNumRectInRegion 70 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE regionid; + INT16 x; + INT16 y; + INT16 w; + INT16 h; +} nxRectInRegionReq; + +#define GrNumEmptyRegion 71 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE regionid; +} nxEmptyRegionReq; + +#define GrNumEqualRegion 72 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE region1; + IDTYPE region2; +} nxEqualRegionReq; + +#define GrNumOffsetRegion 73 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE region; + INT16 dx; + INT16 dy; +} nxOffsetRegionReq; + +#define GrNumGetRegionBox 74 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE regionid; +} nxGetRegionBoxReq; + +#define GrNumNewPolygonRegion 75 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT16 mode; + UINT16 pad; + /*INT16 points[];*/ +} nxNewPolygonRegionReq; + +#define GrNumArc 76 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 rx; + INT16 ry; + INT16 ax; + INT16 ay; + INT16 bx; + INT16 by; + INT16 type; +} nxArcReq; + +#define GrNumArcAngle 77 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 rx; + INT16 ry; + INT16 angle1; + INT16 angle2; + INT16 type; +} nxArcAngleReq; + +#define GrNumSetWMProperties 78 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; + /* GR_WM_PROPERTIES props */ + /* GR_CHAR *title */ +} nxSetWMPropertiesReq; + +#define GrNumGetWMProperties 79 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxGetWMPropertiesReq; + +#define GrNumCloseWindow 80 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxCloseWindowReq; + +#define GrNumKillWindow 81 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxKillWindowReq; + +#define GrNumDrawImageToFit 82 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; + IDTYPE imageid; +} nxDrawImageToFitReq; + +#define GrNumFreeImage 83 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE id; +} nxFreeImageReq; + +#define GrNumGetImageInfo 84 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE id; +} nxGetImageInfoReq; + +#define GrNumDrawImageBits 85 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 width; /* MWIMAGEHDR start*/ + INT16 height; + INT16 planes; + INT16 bpp; + INT16 pitch; + INT16 bytesperpixel; + INT16 compression; + INT16 palsize; + UINT32 transcolor; + /*MWIMAGEBITS imagebits[];*/ + /*MWPALENTRY palette[palsize];*/ +} nxDrawImageBitsReq; + +#define GrNumPoints 86 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + /*INT16 pointtable[];*/ +} nxPointsReq; + +#define GrNumGetFocus 87 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxGetFocusReq; + +#define GrNumGetSysColor 88 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT16 index; +} nxGetSysColorReq; + +#define GrNumSetScreenSaverTimeout 89 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT32 timeout; +} nxSetScreenSaverTimeoutReq; + +#define GrNumSetSelectionOwner 90 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE wid; + /* GR_CHAR *typelist */ +} nxSetSelectionOwnerReq; + +#define GrNumGetSelectionOwner 91 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxGetSelectionOwnerReq; + +#define GrNumRequestClientData 92 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE wid; + IDTYPE rid; + UINT32 serial; + UINT16 mimetype; +} nxRequestClientDataReq; + +#define GrNumSendClientData 93 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE wid; + IDTYPE did; + UINT32 serial; + UINT32 len; + /* void *data */ +} nxSendClientDataReq; + +#define GrNumBell 94 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxBellReq; + +#define GrNumSetBackgroundPixmap 95 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE wid; + IDTYPE pixmap; + UINT32 flags; +} nxSetBackgroundPixmapReq; + +#define GrNumDestroyCursor 96 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE cursorid; +} nxDestroyCursorReq; + +#define GrNumQueryTree 97 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE windowid; +} nxQueryTreeReq; + +#define GrNumCreateTimer 98 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE wid; + UINT32 period; +} nxCreateTimerReq; + +#define GrNumDestroyTimer 99 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE timerid; +} nxDestroyTimerReq; + +#define GrNumSetPortraitMode 100 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT32 portraitmode; +} nxSetPortraitModeReq; + +#define GrNumImageBufferAlloc 101 + +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT32 size; +} nxImageBufferAllocReq; + +#define GrNumImageBufferSend 102 + +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT32 buffer_id; + UINT32 size; +} nxImageBufferSendReq; + +#define GrNumLoadImageFromBuffer 103 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + UINT32 buffer; + INT16 flags; + INT16 pad; +} nxLoadImageFromBufferReq; + +#define GrNumDrawImageFromBuffer 104 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE drawid; + IDTYPE gcid; + INT16 x; + INT16 y; + INT16 width; + INT16 height; + UINT32 buffer; + IDTYPE flags; +} nxDrawImageFromBufferReq; + +#define GrNumGetFontList 105 +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; +} nxGetFontListReq; + +#define GrNumSetGCClipOrigin 106 + +typedef struct { + BYTE8 reqType; + BYTE8 hilength; + UINT16 length; + IDTYPE gcid; + UINT32 xoff; + UINT32 yoff; +} nxSetGCClipOriginReq; + +#define GrTotalNumCalls 107 diff --git a/packages/services/gfx/mw/current/src/nanox/nxutil.c b/packages/services/gfx/mw/current/src/nanox/nxutil.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/nxutil.c @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2000 Greg Haerr + * + * Nano-X Client utility routines + * + * These routines are Gr* functionality without requiring new API entry points. + */ +#include +#include +#define MWINCLUDECOLORS +#include "nano-X.h" + +/* + * Create new window with passed style, title and location. + */ +GR_WINDOW_ID +GrNewWindowEx(GR_WM_PROPS props, GR_CHAR *title, GR_WINDOW_ID parent, + GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height, + GR_COLOR background) +{ + GR_WINDOW_ID wid; + GR_WM_PROPERTIES wmprops; + + /* create window with no borders*/ + wid = GrNewWindow(parent, x, y, width, height, 0, background, BLACK); + if (wid) { + /* set properties and title*/ + wmprops.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE; + wmprops.props = props; + wmprops.title = title; + GrSetWMProperties(wid, &wmprops); + } + return wid; +} + +/* draw an array of lines*/ +void +GrDrawLines(GR_DRAW_ID w, GR_GC_ID gc, GR_POINT *points, GR_COUNT count) +{ + GR_POINT beg, end; + + if (count < 1) + return; + if (count == 1) { + GrPoint(w, gc, points->x, points->y); + return; + } + + beg = *points++; + while (--count > 0) { + end = *points++; + GrLine(w, gc, beg.x, beg.y, end.x, end.y); + beg = end; + } +} + +/* + * Retrofit routine. Use GrNewCursor and GrSetWindowCursor for new code. + */ +GR_CURSOR_ID +GrSetCursor(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height, GR_COORD hotx, + GR_COORD hoty, GR_COLOR foreground, GR_COLOR background, + GR_BITMAP *fgbitmap, GR_BITMAP *bgbitmap) +{ + GR_CURSOR_ID cid; + + cid = GrNewCursor(width, height, hotx, hoty, foreground, + background, fgbitmap, bgbitmap); + if (cid) + GrSetWindowCursor(wid, cid); + return cid; +} + +/* byte-reversing table for reversing X bitmaps*/ +static unsigned char revbyte[256] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff +}; + +/* + * Create a GdBitmap-compatible bitmap (16-bit short array) from data bits + * flags specify input format + * caller must free return buffer + * + * Currently only works if width/height < bits_width/bits_height + */ +GR_BITMAP * +GrNewBitmapFromData(GR_SIZE width, GR_SIZE height, GR_SIZE bits_width, GR_SIZE bits_height, + void *bits, int flags) +{ + int x, y; + int xb; + int brev = flags & GR_BMDATA_BYTEREVERSE; + int bswap = flags & GR_BMDATA_BYTESWAP; + unsigned char * inbuf = bits; + unsigned char * p; + GR_BITMAP * buf; + /*int size;*/ + + /* + * bit reverse or byte-swap short words in image + * and pad to 16 bits for GrBitmap() + */ + xb = (width+7)/8; /* FIXME: may not be in packed-8bit format*/ + /*size = ((xb+1)&~01) * height;*/ + /*buf = (GR_BITMAP *)malloc(size);*/ + buf = (GR_BITMAP *)malloc(((xb+1)&~01) * height); + if (!buf) + return NULL; + + p = (unsigned char *)buf; + for(y=0; y + * Copyright (c) 2000 Alex Holden + * Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * Private definitions for the graphics server. + * These definitions are not to be used by clients. + */ + +#if defined(__ECOS) && !defined(_NO_SVR_MAPPING) +// +// Since eCos is a single task, multi-threaded environment, the +// server and the client code share the same namespace. This means +// that server functions which are represented by dispatchers in +// the client code need to have unique names, thus this remapping. +// +#define GrArcAngle SVR_GrArcAngle +#define GrArc SVR_GrArc +#define GrArea SVR_GrArea +#define GrBell SVR_GrBell +#define GrBitmap SVR_GrBitmap +#define GrCheckNextEvent SVR_GrCheckNextEvent +#define GrClearWindow SVR_GrClearWindow +#define GrClose SVR_GrClose +#define GrCloseWindow SVR_GrCloseWindow +#define GrCopyArea SVR_GrCopyArea +#define GrCopyGC SVR_GrCopyGC +#define GrCreateFont SVR_GrCreateFont +#define GrDestroyFont SVR_GrDestroyFont +#define GrDestroyGC SVR_GrDestroyGC +#define GrDestroyRegion SVR_GrDestroyRegion +#define GrDestroyWindow SVR_GrDestroyWindow +#define GrDrawImageBits SVR_GrDrawImageBits +#define GrDrawImageFromFile SVR_GrDrawImageFromFile +#define GrDrawImageToFit SVR_GrDrawImageToFit +#define GrEllipse SVR_GrEllipse +#define GrEmptyRegion SVR_GrEmptyRegion +#define GrEqualRegion SVR_GrEqualRegion +#define GrFillEllipse SVR_GrFillEllipse +#define GrFillPoly SVR_GrFillPoly +#define GrFillRect SVR_GrFillRect +#define GrFindColor SVR_GrFindColor +#define GrFreeImage SVR_GrFreeImage +#define GrGetFocus SVR_GrGetFocus +#define GrGetFontInfo SVR_GrGetFontInfo +#define GrGetGCInfo SVR_GrGetGCInfo +#define GrGetGCTextSize SVR_GrGetGCTextSize +#define GrGetImageInfo SVR_GrGetImageInfo +#define GrGetRegionBox SVR_GrGetRegionBox +#define GrGetScreenInfo SVR_GrGetScreenInfo +#define GrGetSelectionOwner SVR_GrGetSelectionOwner +#define GrGetSysColor SVR_GrGetSysColor +#define GrGetSystemPalette SVR_GrGetSystemPalette +#define GrGetWindowInfo SVR_GrGetWindowInfo +#define GrGetWMProperties SVR_GrGetWMProperties +#define GrInjectKeyboardEvent SVR_GrInjectKeyboardEvent +#define GrInjectPointerEvent SVR_GrInjectPointerEvent +#define GrIntersectRegion SVR_GrIntersectRegion +#define GrKillWindow SVR_GrKillWindow +#define GrLine SVR_GrLine +#define GrLoadImageFromFile SVR_GrLoadImageFromFile +#define GrLowerWindow SVR_GrLowerWindow +#define GrMapWindow SVR_GrMapWindow +#define GrMoveCursor SVR_GrMoveCursor +#define GrMoveWindow SVR_GrMoveWindow +#define GrNewGC SVR_GrNewGC +#define GrNewInputWindow SVR_GrNewInputWindow +#define GrNewPixmap SVR_GrNewPixmap +#define GrNewPolygonRegion SVR_GrNewPolygonRegion +#define GrNewRegion SVR_GrNewRegion +#define GrNewWindow SVR_GrNewWindow +#define GrOffsetRegion SVR_GrOffsetRegion +#define GrOpen SVR_GrOpen +#define GrPeekEvent SVR_GrPeekEvent +#define GrPointInRegion SVR_GrPointInRegion +#define GrPoints SVR_GrPoints +#define GrPoint SVR_GrPoint +#define GrPoly SVR_GrPoly +#define GrRaiseWindow SVR_GrRaiseWindow +#define GrReadArea SVR_GrReadArea +#define GrRectInRegion SVR_GrRectInRegion +#define GrRect SVR_GrRect +#define GrReparentWindow SVR_GrReparentWindow +#define GrRequestClientData SVR_GrRequestClientData +#define GrResizeWindow SVR_GrResizeWindow +#define GrSelectEvents SVR_GrSelectEvents +#define GrSendClientData SVR_GrSendClientData +#define GrSetBackgroundPixmap SVR_GrSetBackgroundPixmap +#define GrSetBorderColor SVR_GrSetBorderColor +#define GrSetCursor SVR_GrSetCursor +#define GrSetFocus SVR_GrSetFocus +#define GrSetFontAttr SVR_GrSetFontAttr +#define GrSetFontRotation SVR_GrSetFontRotation +#define GrSetFontSize SVR_GrSetFontSize +#define GrSetGCBackground SVR_GrSetGCBackground +#define GrSetGCFont SVR_GrSetGCFont +#define GrSetGCForeground SVR_GrSetGCForeground +#define GrSetGCMode SVR_GrSetGCMode +#define GrSetGCRegion SVR_GrSetGCRegion +#define GrSetGCUseBackground SVR_GrSetGCUseBackground +#define GrSetScreenSaverTimeout SVR_GrSetScreenSaverTimeout +#define GrSetSelectionOwner SVR_GrSetSelectionOwner +#define GrSetSystemPalette SVR_GrSetSystemPalette +#define GrSetWMProperties SVR_GrSetWMProperties +#define GrSubtractRegion SVR_GrSubtractRegion +#define GrText SVR_GrText +#define GrUnionRectWithRegion SVR_GrUnionRectWithRegion +#define GrUnionRegion SVR_GrUnionRegion +#define GrUnmapWindow SVR_GrUnmapWindow +#define GrXorRegion SVR_GrXorRegion +#define GrDelay SVR_GrDelay +#define GrSetGCClipOrigin SVR_GrSetGCClipOrigin +#define GrClearArea SVR_GrClearArea +#define GrNewCursor SVR_GrNewCursor +#define GrDestroyCursor SVR_GrDestroyCursor +#define GrSetWindowCursor SVR_GrSetWindowCursor +#define GrDrawImageFromBuffer SVR_GrDrawImageFromBuffer +#define GrLoadImageFromBuffer SVR_GrLoadImageFromBuffer +#define GrGetFontList SVR_GrGetFontList +#define GrFreeFontList SVR_GrFreeFontList +#define GrQueryTree SVR_GrQueryTree +#define GrCreateTimer SVR_GrCreateTimer +#define GrDestroyTimer SVR_GrDestroyTimer +#define GrSetPortraitMode SVR_GrSetPortraitMode +#endif + +#include "nano-X.h" +#include "device.h" + +/* + * Drawing types. + */ +typedef int GR_DRAW_TYPE; + +#define GR_DRAW_TYPE_NONE 0 /* none or error */ +#define GR_DRAW_TYPE_WINDOW 1 /* windows */ +#define GR_DRAW_TYPE_PIXMAP 2 /* pixmaps */ + +#define GR_MAX_MODE MWMODE_MAX +/* + * List of elements for events. + */ +typedef struct gr_event_list GR_EVENT_LIST; +struct gr_event_list { + GR_EVENT_LIST *next; /* next element in list */ + GR_EVENT event; /* event */ +}; + +/* + * Data structure to keep track of state of clients. + */ +typedef struct gr_client GR_CLIENT; +struct gr_client { + int id; /* client id and socket descriptor */ + GR_EVENT_LIST *eventhead; /* head of event chain (or NULL) */ + GR_EVENT_LIST *eventtail; /* tail of event chain (or NULL) */ + GR_CLIENT *next; /* the next client in the list */ + GR_CLIENT *prev; /* the previous client in the list */ + int waiting_for_event; /* used to implement GrGetNextEvent*/ + char *shm_cmds; + int shm_cmds_size; + int shm_cmds_shmid; + unsigned long processid; /* client process id*/ +}; + +/* + * Structure to remember clients associated with events. + */ +typedef struct gr_event_client GR_EVENT_CLIENT; +struct gr_event_client { + GR_EVENT_CLIENT *next; /* next interested client or NULL */ + GR_EVENT_MASK eventmask; /* events client wants to see */ + GR_CLIENT *client; /* client who is interested */ +}; + +/* + * Structure to remember graphics contexts. + */ +typedef struct gr_gc GR_GC; +struct gr_gc { + GR_GC_ID id; /* graphics context id */ + int mode; /* drawing mode */ + GR_REGION_ID regionid; /* current clipping region */ + int xoff; /* X offset for the clip region */ + int yoff; /* Y offset for the clip region */ + GR_FONT_ID fontid; /* current font id*/ + GR_COLOR foreground; /* foreground color */ + GR_COLOR background; /* background color */ + GR_BOOL usebackground; /* actually display the background */ + GR_BOOL changed; /* graphics context has been changed */ + GR_CLIENT *owner; /* client that created it */ + GR_GC *next; /* next graphics context */ +}; + +/* + * Structure to remember regions. + */ +typedef struct gr_region GR_REGION; +struct gr_region { + MWCLIPREGION * rgn; + GR_REGION_ID id; + GR_CLIENT * owner; /* client that created it */ + GR_REGION * next; +}; + +/* + * Structure to remember fonts. + */ +typedef struct gr_font GR_FONT; +struct gr_font { + PMWFONT pfont; /* font*/ + int fontsize; /* font size*/ + GR_FONT_ID id; /* font id*/ + GR_CLIENT * owner; /* client that created it */ + GR_FONT * next; /* next font*/ +}; + +/* + * Structure to remember images. + */ +typedef struct gr_image GR_IMAGE; +struct gr_image { + GR_IMAGE_ID id; + GR_CLIENT * owner; /* client that created it */ + GR_IMAGE * next; +}; + +/* + * Cursor structure. + */ +typedef struct gr_cursor GR_CURSOR; +struct gr_cursor { + GR_CURSOR_ID id; /* cursor id*/ + GR_CLIENT *owner; /* client that created it*/ + GR_CURSOR *next; + MWCURSOR cursor; /* mwin engine cursor structure*/ +}; + +/* + * Structure to remember selection owner and mime types it can produce. + */ +typedef struct { + GR_WINDOW_ID wid; + GR_CHAR *typelist; +} GR_SELECTIONOWNER; + + +/* + * Structure to remember timers. + */ +typedef struct gr_timer GR_TIMER; +struct gr_timer +{ + GR_TIMER_ID id; /* This instances ID */ + GR_CLIENT *owner; /* client that created it */ + GR_WINDOW_ID wid; + MWTIMER *timer; /* Device independent layer timer */ + GR_TIMER *next; +}; + +/* + * Drawable structure. This structure must be the first + * elements in a GR_WINDOW or GR_PIXMAP, as GrPrepareWindow + * returns a GR_DRAWABLE. This structure includes + * only those items that routines that use GrPrepareWindow + * might dereference, and must be included in windows or pixmaps. + */ +typedef struct gr_drawable { + GR_COORD x; /* x position (0)*/ + GR_COORD y; /* y position (0)*/ + GR_SIZE width; /* width */ + GR_SIZE height; /* height */ + struct _mwscreendevice *psd; /* associated screen device */ + GR_WINDOW_ID id; /* window/pixmap id */ +} GR_DRAWABLE; + +/* + * Window structure + * Note: first elements must match GR_DRAWABLE + */ +typedef struct gr_pixmap GR_PIXMAP; +typedef struct gr_window GR_WINDOW; +struct gr_window { + GR_COORD x; /* absolute x position */ + GR_COORD y; /* absolute y position */ + GR_SIZE width; /* width */ + GR_SIZE height; /* height */ + struct _mwscreendevice *psd; /* associated screen device */ + GR_WINDOW_ID id; /* window id */ + /* end of GR_DRAWABLE common members*/ + + GR_WINDOW *next; /* next window in complete list */ + GR_CLIENT *owner; /* client that created it */ + GR_WINDOW *parent; /* parent window */ + GR_WINDOW *children; /* first child window */ + GR_WINDOW *siblings; /* next sibling window */ + GR_SIZE bordersize; /* size of border */ + GR_COLOR bordercolor; /* color of border */ + GR_COLOR background; /* background color */ + GR_PIXMAP *bgpixmap; /* background pixmap */ + int bgpixmapflags; /* center, tile etc. */ + GR_EVENT_MASK nopropmask; /* events not to be propagated */ + GR_EVENT_CLIENT *eventclients; /* clients interested in events */ + GR_CURSOR_ID cursorid; /* cursor for this window */ + GR_BOOL mapped; /* TRUE if explicitly mapped */ + GR_COUNT unmapcount; /* count of reasons not really mapped */ + GR_BOOL output; /* TRUE if window can do output */ + GR_WM_PROPS props; /* window properties*/ + GR_CHAR *title; /* window title*/ +}; + +/* + * Pixmap structure + * Note: first elements must match GR_DRAWABLE + */ +struct gr_pixmap { + GR_COORD x; /* x position (0)*/ + GR_COORD y; /* y position (0)*/ + GR_SIZE width; /* width */ + GR_SIZE height; /* height */ + struct _mwscreendevice *psd; /* associated screen device */ + GR_WINDOW_ID id; /* pixmap id */ + /* end of GR_DRAWABLE common members*/ + + GR_PIXMAP *next; /* next pixmap in list */ + GR_CLIENT *owner; /* client that created it */ +}; + +/* + * Macros to obtain the client number from a resource id, and to + * produce the first resource id to be used for a client number. + * Client numbers must not be zero. This allows for 255 clients. +#define GR_ID_CLIENT(n) (((GR_ID) (n)) >> 24) +#define GR_ID_BASE(n) (((GR_ID) (n)) << 24) + */ + +/* + * Graphics server routines. + */ +int GsInitialize(void); +void GsClose(int fd); +void GsSelect(GR_TIMEOUT timeout); +void GsTerminate(void); +GR_TIMEOUT GsGetTickCount(void); +void GsRedrawScreen(void); +void GsError(GR_ERROR code, GR_ID id); +GR_BOOL GsCheckMouseEvent(void); +GR_BOOL GsCheckKeyboardEvent(void); +int GsReadKeyboard(GR_CHAR *buf, int *modifiers); +int GsOpenKeyboard(void); +void GsGetButtonInfo(int *buttons); +void GsGetModifierInfo(int *modifiers); +void GsCloseKeyboard(void); +void GsExposeArea(GR_WINDOW *wp, GR_COORD rootx, GR_COORD rooty, + GR_SIZE width, GR_SIZE height, GR_WINDOW *stopwp); +void GsCheckCursor(void); +void GsWpSetFocus(GR_WINDOW *wp); +void GsWpDrawBackgroundPixmap(GR_WINDOW *wp, GR_PIXMAP *pm, + GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height); +void GsWpTileBackgroundPixmap(GR_WINDOW *wp, GR_PIXMAP *pm, + GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height); +void GsWpClearWindow(GR_WINDOW *wp, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, GR_BOOL exposeflag); +void GsWpUnmapWindow(GR_WINDOW *wp, GR_BOOL temp_unmap); +void GsWpMapWindow(GR_WINDOW *wp, GR_BOOL temp); +void GsWpDestroyWindow(GR_WINDOW *wp); +void GsSetPortraitMode(int mode); +void GsSetPortraitModeFromXY(GR_COORD rootx, GR_COORD rooty); +void GsSetClipWindow(GR_WINDOW *wp, MWCLIPREGION *userregion, + int flags); +void GsHandleMouseStatus(GR_COORD newx, GR_COORD newy, + int newbuttons); +void GsFreePositionEvent(GR_CLIENT *client, GR_WINDOW_ID wid, + GR_WINDOW_ID subwid); +void GsDeliverButtonEvent(GR_EVENT_TYPE type, int buttons, + int changebuttons, int modifiers); +void GsDeliverMotionEvent(GR_EVENT_TYPE type, int buttons, + MWKEYMOD modifiers); +void GsDeliverKeyboardEvent(GR_WINDOW_ID wid, GR_EVENT_TYPE type, + GR_KEY keyvalue, GR_KEYMOD modifiers, + GR_SCANCODE scancode); +void GsDeliverExposureEvent(GR_WINDOW *wp, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height); +void GsFreeExposureEvent(GR_CLIENT *client, GR_WINDOW_ID wid, + GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height); +void GsDeliverUpdateEvent(GR_WINDOW *wp, GR_UPDATE_TYPE utype, + GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height); +void GsDeliverGeneralEvent(GR_WINDOW *wp, GR_EVENT_TYPE type, + GR_WINDOW *other); +void GsDeliverPortraitChangedEvent(void); +void GsDeliverScreenSaverEvent(GR_BOOL activate); +void GsDeliverClientDataReqEvent(GR_WINDOW_ID wid, GR_WINDOW_ID rid, + GR_SERIALNO serial, GR_MIMETYPE mimetype); +void GsDeliverClientDataEvent(GR_WINDOW_ID wid, GR_WINDOW_ID rid, + GR_SERIALNO serial, GR_LENGTH len, GR_LENGTH thislen, + void *data); +void GsDeliverSelectionChangedEvent(GR_WINDOW_ID old_owner, + GR_WINDOW_ID new_owner); +void GsDeliverTimerEvent(GR_CLIENT *client, GR_WINDOW_ID wid, + GR_TIMER_ID tid); +void GsCheckMouseWindow(void); +void GsCheckFocusWindow(void); +GR_DRAW_TYPE GsPrepareDrawing(GR_DRAW_ID id, GR_GC_ID gcid, + GR_DRAWABLE **retdp); +GR_BOOL GsCheckOverlap(GR_WINDOW *topwp, GR_WINDOW *botwp); +GR_EVENT *GsAllocEvent(GR_CLIENT *client); +GR_WINDOW *GsFindWindow(GR_WINDOW_ID id); +GR_PIXMAP *GsFindPixmap(GR_WINDOW_ID id); +GR_GC *GsFindGC(GR_GC_ID gcid); +GR_REGION *GsFindRegion(GR_REGION_ID regionid); +GR_FONT *GsFindFont(GR_FONT_ID fontid); +GR_TIMER *GsFindTimer(GR_TIMER_ID timer_id); +GR_CURSOR *GsFindCursor(GR_CURSOR_ID cursorid); +GR_WINDOW *GsPrepareWindow(GR_WINDOW_ID wid); +GR_WINDOW *GsFindVisibleWindow(GR_COORD x, GR_COORD y); +void GsDrawBorder(GR_WINDOW *wp); +int GsCurrentVt(void); +void GsRedrawVt(int t); +int GsOpenSocket(void); +void GsCloseSocket(void); +void GsAcceptClient(void); +void GsAcceptClientFd(int i); +int GsPutCh(int fd, unsigned char c); +GR_CLIENT *GsFindClient(int fd); +void GsDestroyClientResources(GR_CLIENT * client); +void GsDropClient(int fd); +int GsRead(int fd, void *buf, int c); +int GsWrite(int fd, void *buf, int c); +void GsHandleClient(int fd); +void GsResetScreenSaver(void); +void GsActivateScreenSaver(void *arg); +void GrGetNextEventWrapperFinish(int); +void GsTimerCB(void *arg); + +/* + * External data definitions. + */ +extern char * curfunc; /* current function name */ +extern GR_WINDOW_ID cachewindowid; /* cached window id */ +extern GR_WINDOW_ID cachepixmapid; +extern GR_GC_ID cachegcid; /* cached graphics context id */ +extern GR_GC *cachegcp; /* cached graphics context */ +extern GR_GC *listgcp; /* list of all gc */ +extern GR_REGION *listregionp; /* list of all regions */ +extern GR_FONT *listfontp; /* list of all fonts */ +extern GR_IMAGE *listimagep; /* list of all images */ +extern GR_CURSOR *listcursorp; /* list of all cursors */ +extern GR_CURSOR *stdcursor; /* root window cursor */ +extern GR_GC *curgcp; /* current graphics context */ +extern GR_WINDOW *cachewp; /* cached window pointer */ +extern GR_PIXMAP *cachepp; /* cached pixmap pointer */ +extern GR_WINDOW *listwp; /* list of all windows */ +extern GR_PIXMAP *listpp; /* list of all pixmaps */ +extern GR_WINDOW *rootwp; /* root window pointer */ +extern GR_WINDOW *clipwp; /* window clipping is set for */ +extern GR_WINDOW *focuswp; /* focus window for keyboard */ +extern GR_WINDOW *mousewp; /* window mouse is currently in */ +extern GR_WINDOW *grabbuttonwp; /* window grabbed by button */ +extern GR_CURSOR *curcursor; /* currently enabled cursor */ +extern GR_COORD cursorx; /* x position of cursor */ +extern GR_COORD cursory; /* y position of cursor */ +extern int curbuttons; /* current state of buttons */ +extern GR_CLIENT *curclient; /* current client */ +extern char *current_shm_cmds; +extern int current_shm_cmds_size; +extern GR_EVENT_LIST *eventfree; /* list of free events */ +extern GR_BOOL focusfixed; /* TRUE if focus is fixed */ +extern GR_SCREEN_INFO sinfo; /* screen information */ +extern PMWFONT stdfont; /* default font*/ +extern int escape_quits; /* terminate when pressing ESC*/ +extern int connectcount; /* # of connections to server */ +extern GR_TIMEOUT screensaver_delay; /* time before screensaver */ + /* activates */ +extern GR_TIMER_ID cache_timer_id; /* cached timer ID */ +extern GR_TIMER *cache_timer; /* cached timer */ +extern GR_TIMER *list_timer; /* list of all timers */ + +extern GR_BOOL screensaver_active; /* screensaver is active */ +extern GR_SELECTIONOWNER selection_owner; /* the selection owner */ +extern int autoportrait; /* auto portrait mode switching*/ + +/* + * The filename to use for the named socket. If we ever support multiple + * servers on one machine, the last digit will be that of the FB used for it. + */ +#define GR_NAMED_SOCKET "/tmp/.nano-X" +#define GR_NUMB_SOCKET 79 + +#if VTSWITCH +/* temp framebuffer vt switch stuff at upper level + * this should be handled at the lower level, just like vgalib does. + */ +void MwInitVt(void); +int MwCurrentVt(void); +int MwCheckVtChange(void); +void MwRedrawVt(int t); +void MwExitVt(void); +extern int mwvterm; +#endif /* VTSWITCH*/ + +#endif /* _SERV_H*/ diff --git a/packages/services/gfx/mw/current/src/nanox/srvclip.c b/packages/services/gfx/mw/current/src/nanox/srvclip.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/srvclip.c @@ -0,0 +1,7 @@ +#include "device.h" + +#if DYNAMICREGIONS +#include "srvclip2.c" +#else +#include "srvclip1.c" +#endif diff --git a/packages/services/gfx/mw/current/src/nanox/srvclip1.c b/packages/services/gfx/mw/current/src/nanox/srvclip1.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/srvclip1.c @@ -0,0 +1,371 @@ +/* + * Copyright (c) 2000 Greg Haerr + * Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + */ +#include +#include +#include "serv.h" + +/* + * Macro to distinguish cases of clipping. + */ +#define GAPVAL(leftgap, rightgap, topgap, bottomgap) \ + (((leftgap) << 3) + ((rightgap) << 2) + ((topgap) << 1) + (bottomgap)) + +static GR_COUNT GsSplitClipRect(MWCLIPRECT *srcrect, MWCLIPRECT *destrect, + GR_COORD minx, GR_COORD miny, GR_COORD maxx, + GR_COORD maxy); +/* + * Set the clip rectangles for a window taking into account other + * windows that may be obscuring it. The windows that may be obscuring + * this one are the siblings of each direct ancestor which are higher + * in priority than those ancestors. Also, each parent limits the visible + * area of the window. The clipping is not done if it is already up to + * date of if the window is not outputtable. + */ +void +GsSetClipWindow(GR_WINDOW *wp, MWCLIPREGION *userregion, int flags) +{ + GR_WINDOW *pwp; /* parent window */ + GR_WINDOW *sibwp; /* sibling windows */ + MWCLIPRECT *clip; /* first clip rectangle */ + GR_COUNT count; /* number of clip rectangles */ + GR_COUNT newcount; /* number of new rectangles */ + GR_COUNT i; /* current index */ + GR_COORD minx; /* minimum clip x coordinate */ + GR_COORD miny; /* minimum clip y coordinate */ + GR_COORD maxx; /* maximum clip x coordinate */ + GR_COORD maxy; /* maximum clip y coordinate */ + GR_COORD diff; /* difference in coordinates */ + GR_SIZE bs; /* border size */ + GR_BOOL toomany; /* TRUE if too many clip rects */ + MWCLIPRECT cliprects[MAX_CLIPRECTS]; /* clip rectangles */ + + if (wp->unmapcount || !wp->output || (wp == clipwp)) + return; + + clipwp = wp; + + /* + * Start with the rectangle for the complete window. + * We will then cut pieces out of it as needed. + */ + count = 1; + clip = cliprects; + clip->x = wp->x; + clip->y = wp->y; + clip->width = wp->width; + clip->height = wp->height; + + /* + * First walk upwards through all parent windows, + * and restrict the visible part of this window to the part + * that shows through all of those parent windows. + */ + pwp = wp; + while (pwp != rootwp) { + pwp = pwp->parent; + + diff = pwp->x - clip->x; + if (diff > 0) { + clip->width -= diff; + clip->x = pwp->x; + } + + diff = (pwp->x + pwp->width) - (clip->x + clip->width); + if (diff < 0) + clip->width += diff; + + diff = pwp->y - clip->y; + if (diff > 0) { + clip->height -= diff; + clip->y = pwp->y; + } + + diff = (pwp->y + pwp->height) - (clip->y + clip->height); + if (diff < 0) + clip->height += diff; + } + + /* + * If the window is completely clipped out of view, then + * set the clipping region to indicate that. + */ + if ((clip->width <= 0) || (clip->height <= 0)) { + GdSetClipRects(clipwp->psd, 1, cliprects); + return; + } + + /* + * Now examine all windows that obscure this window, and + * for each obscuration, break up the clip rectangles into + * the smaller pieces that are still visible. The windows + * that can obscure us are the earlier siblings of all of + * our parents. + */ + toomany = GR_FALSE; + pwp = wp; +/*while (pwp != rootwp) {*/ + while (pwp != NULL) { + wp = pwp; + pwp = wp->parent; + + if(!pwp) { + /* We're clipping the root window*/ + sibwp = rootwp->children; + wp = NULL; + } else + sibwp = pwp->children; + + for (; sibwp != wp; sibwp = sibwp->siblings) { + if (sibwp->unmapcount || !sibwp->output) + continue; + + bs = sibwp->bordersize; + minx = sibwp->x - bs; + miny = sibwp->y - bs; + maxx = sibwp->x + sibwp->width + bs - 1; + maxy = sibwp->y + sibwp->height + bs - 1; + + newcount = count; + for (i = 0; i < count; i++) { + if (newcount > MAX_CLIPRECTS - 3) { + toomany = GR_TRUE; + break; + } + newcount += GsSplitClipRect(&cliprects[i], + &cliprects[newcount], + minx, miny, maxx, maxy); + } + count = newcount; + } +if(pwp == rootwp) +break; + } + + if (toomany) { + GsError(GR_ERROR_TOO_MUCH_CLIPPING, wp->id); + clip->x = 0; + clip->y = 0; + clip->width = -1; + clip->height = -1; + count = 1; + } + + /* + * Set the clip rectangles. + */ + GdSetClipRects(clipwp->psd, count, cliprects); +} + +/* + * Check the specified clip rectangle against the specified rectangular + * region, and reduce it or split it up into multiple clip rectangles + * such that the specified region is not contained in any of the clip + * rectangles. The source clip rectangle can be modified in place, and + * in addition more clip rectangles can be generated, which are placed in + * the indicated destination location. The maximum number of new clip + * rectangles needed is 3. Returns the number of clip rectangles added. + * If the source clip rectangle is totally obliterated, it is set to an + * impossible region and 0 is returned. When splits are done, we prefer + * to create wide regions instead of high regions. + */ +static GR_COUNT +GsSplitClipRect(MWCLIPRECT *srcrect, MWCLIPRECT *destrect, GR_COORD minx, + GR_COORD miny, GR_COORD maxx, GR_COORD maxy) +{ + GR_COORD x; + GR_COORD y; + GR_SIZE width; + GR_SIZE height; + GR_COORD dx; + GR_COORD dy; + int gaps; + + /* + * First see if there is any overlap at all. + * If not, then nothing to do. + */ + x = srcrect->x; + y = srcrect->y; + width = srcrect->width; + height = srcrect->height; + + if ((minx > maxx) || (miny > maxy) || (maxx < x) || (maxy < y) || + (x + width <= minx) || (y + height <= miny)) + return 0; + + /* + * There is an overlap. Calculate a value to differentiate + * various cases, and then handle each case separately. The + * cases are classified on whether there are gaps on the left, + * right, top, and bottom sides of the clip rectangle. + */ + gaps = 0; + if (x < minx) + gaps |= GAPVAL(1, 0, 0, 0); + if (x + width - 1 > maxx) + gaps |= GAPVAL(0, 1, 0, 0); + if (y < miny) + gaps |= GAPVAL(0, 0, 1, 0); + if (y + height - 1 > maxy) + gaps |= GAPVAL(0, 0, 0, 1); + + switch (gaps) { + case GAPVAL(0, 0, 0, 0): /* no gaps at all */ + srcrect->x = 0; + srcrect->y = 0; + srcrect->width = 0; + srcrect->height = 0; + return 0; + + case GAPVAL(0, 0, 0, 1): /* gap on bottom */ + dy = maxy - y + 1; + srcrect->y += dy; + srcrect->height -= dy; + return 0; + + case GAPVAL(0, 0, 1, 0): /* gap on top */ + srcrect->height = miny - y; + return 0; + + case GAPVAL(0, 0, 1, 1): /* gap on top, bottom */ + srcrect->height = miny - y; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + return 1; + + case GAPVAL(0, 1, 0, 0): /* gap on right */ + dx = maxx - x + 1; + srcrect->x += dx; + srcrect->width -= dx; + return 0; + + case GAPVAL(0, 1, 0, 1): /* gap on right, bottom */ + dx = maxx - x + 1; + srcrect->x += dx; + srcrect->width -= dx; + srcrect->height = maxy - y + 1; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + return 1; + + case GAPVAL(0, 1, 1, 0): /* gap on right, top */ + dx = maxx - x + 1; + srcrect->height = miny - y; + destrect->x = x + dx; + destrect->width = width - dx; + destrect->y = miny; + destrect->height = y + height - miny; + return 1; + + case GAPVAL(0, 1, 1, 1): /* gap on right, top, bottom */ + dx = maxx - x + 1; + srcrect->height = miny - y; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + destrect++; + destrect->x = x + dx; + destrect->width = width - dx; + destrect->y = miny; + destrect->height = maxy - miny + 1; + return 2; + + case GAPVAL(1, 0, 0, 0): /* gap on left */ + srcrect->width = minx - x; + return 0; + + case GAPVAL(1, 0, 0, 1): /* gap on left, bottom */ + srcrect->width = minx - x; + srcrect->height = maxy - y + 1; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + return 1; + + case GAPVAL(1, 0, 1, 0): /* gap on left, top */ + srcrect->height = miny - y; + destrect->x = x; + destrect->width = minx - x; + destrect->y = miny; + destrect->height = y + height - miny; + return 1; + + case GAPVAL(1, 0, 1, 1): /* gap on left, top, bottom */ + srcrect->height = miny - y; + destrect->x = x; + destrect->width = minx - x; + destrect->y = miny; + destrect->height = maxy - miny + 1; + destrect++; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + return 2; + + case GAPVAL(1, 1, 0, 0): /* gap on left, right */ + destrect->x = maxx + 1; + destrect->width = x + width - maxx - 1; + destrect->y = y; + destrect->height = height; + srcrect->width = minx - x; + return 1; + + case GAPVAL(1, 1, 0, 1): /* gap on left, right, bottom */ + dy = maxy - y + 1; + srcrect->y += dy; + srcrect->height -= dy; + destrect->x = x; + destrect->width = minx - x; + destrect->y = y; + destrect->height = dy; + destrect++; + destrect->x = maxx + 1; + destrect->width = x + width - maxx - 1; + destrect->y = y; + destrect->height = dy; + return 2; + + case GAPVAL(1, 1, 1, 0): /* gap on left, right, top */ + srcrect->height = miny - y; + destrect->x = x; + destrect->width = minx - x; + destrect->y = miny; + destrect->height = y + height - miny; + destrect++; + destrect->x = maxx + 1; + destrect->width = x + width - maxx - 1; + destrect->y = miny; + destrect->height = y + height - miny; + return 2; + + case GAPVAL(1, 1, 1, 1): /* gap on all sides */ + srcrect->height = miny - y; + destrect->x = x; + destrect->width = minx - x; + destrect->y = miny; + destrect->height = maxy - miny + 1; + destrect++; + destrect->x = maxx + 1; + destrect->width = x + width - maxx - 1; + destrect->y = miny; + destrect->height = maxy - miny + 1; + destrect++; + destrect->x = x; + destrect->width = width; + destrect->y = maxy + 1; + destrect->height = y + height - maxy - 1; + return 3; + } + return 0; /* NOTREACHED */ +} diff --git a/packages/services/gfx/mw/current/src/nanox/srvclip2.c b/packages/services/gfx/mw/current/src/nanox/srvclip2.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/srvclip2.c @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2000 Greg Haerr + * Portions Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * DYNAMICREGIONS GsSetClipWindow + */ +#include +#include +#include "serv.h" + +/* + * Set the clip rectangles for a window taking into account other + * windows that may be obscuring it. The windows that may be obscuring + * this one are the siblings of each direct ancestor which are higher + * in priority than those ancestors. Also, each parent limits the visible + * area of the window. The clipping is not done if it is already up to + * date of if the window is not outputtable. + */ +void +GsSetClipWindow(GR_WINDOW *wp, MWCLIPREGION *userregion, int flags) +{ + GR_WINDOW *orgwp; /* original window pointer */ + GR_WINDOW *pwp; /* parent window */ + GR_WINDOW *sibwp; /* sibling windows */ + GR_COORD minx; /* minimum clip x coordinate */ + GR_COORD miny; /* minimum clip y coordinate */ + GR_COORD maxx; /* maximum clip x coordinate */ + GR_COORD maxy; /* maximum clip y coordinate */ + GR_COORD diff; /* difference in coordinates */ + GR_SIZE bs; /* border size */ + GR_COORD x, y, width, height; + MWCLIPREGION *vis, *r; + + if (wp->unmapcount || !wp->output) + return; + + clipwp = wp; + + /* + * Start with the rectangle for the complete window. + * We will then cut pieces out of it as needed. + */ + x = wp->x; + y = wp->y; + width = wp->width; + height = wp->height; + + /* + * First walk upwards through all parent windows, + * and restrict the visible part of this window to the part + * that shows through all of those parent windows. + */ + pwp = wp; + while (pwp != rootwp) { + pwp = pwp->parent; + + diff = pwp->x - x; + if (diff > 0) { + width -= diff; + x = pwp->x; + } + + diff = (pwp->x + pwp->width) - (x + width); + if (diff < 0) + width += diff; + + diff = pwp->y - y; + if (diff > 0) { + height -= diff; + y = pwp->y; + } + + diff = (pwp->y + pwp->height) - (y + height); + if (diff < 0) + height += diff; + } + + /* + * If the window is completely clipped out of view, then + * set the clipping region to indicate that. + */ + if (width <= 0 || height <= 0) { + GdSetClipRegion(clipwp->psd, NULL); + return; + } + + /* + * Allocate region to clipped size of window + */ + vis = GdAllocRectRegion(x, y, x+width, y+height); + + /* + * Allocate temp region + */ + r = GdAllocRegion(); + + /* + * Now examine all windows that obscure this window, and + * for each obscuration, break up the clip rectangles into + * the smaller pieces that are still visible. The windows + * that can obscure us are the earlier siblings of all of + * our parents. + */ + orgwp = wp; + pwp = wp; + while (pwp != NULL) { + wp = pwp; + pwp = wp->parent; + + if(!pwp) { + /* We're clipping the root window*/ + if (!(flags & GR_MODE_EXCLUDECHILDREN)) + /* start with root's children*/ + sibwp = rootwp->children; + else sibwp = NULL; /* no search*/ + wp = NULL; /* search all root's children*/ + } else { + sibwp = pwp->children; /* clip siblings*/ + } + + for (; sibwp != wp; sibwp = sibwp->siblings) { + if (sibwp->unmapcount || !sibwp->output) + continue; + + bs = sibwp->bordersize; + minx = sibwp->x - bs; + miny = sibwp->y - bs; + maxx = sibwp->x + sibwp->width + bs; + maxy = sibwp->y + sibwp->height + bs; + + GdSetRectRegion(r, minx, miny, maxx, maxy); + GdSubtractRegion(vis, vis, r); + } + + /* if not clipping the root window, stop when you reach it*/ + if (pwp == rootwp) + break; + } + + wp = orgwp; + /* + * If not the root window, clip all children. + * (Root window's children are are clipped above) + */ + if(wp != rootwp && !(flags & GR_MODE_EXCLUDECHILDREN)) { + for (sibwp=wp->children; sibwp; sibwp = sibwp->siblings) { + if (sibwp->unmapcount || !sibwp->output) + continue; + + bs = sibwp->bordersize; + minx = sibwp->x - bs; + miny = sibwp->y - bs; + maxx = sibwp->x + sibwp->width + bs; + maxy = sibwp->y + sibwp->height + bs; + + GdSetRectRegion(r, minx, miny, maxx, maxy); + GdSubtractRegion(vis, vis, r); + } + } + + /* + * Intersect with user region, if set. + */ + if (userregion) { + /* temporarily offset region by window coordinates*/ + GdOffsetRegion(userregion, wp->x, wp->y); + GdIntersectRegion(vis, vis, userregion); + GdOffsetRegion(userregion, -wp->x, -wp->y); + } + + /* + * Set the clip region (later destroy handled by GdSetClipRegion) + */ + GdSetClipRegion(clipwp->psd, vis); + + /* + * Destroy temp region + */ + GdDestroyRegion(r); +} diff --git a/packages/services/gfx/mw/current/src/nanox/srvevent.c b/packages/services/gfx/mw/current/src/nanox/srvevent.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/srvevent.c @@ -0,0 +1,900 @@ +/* + * Copyright (c) 2000 Greg Haerr + * Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * Graphics server event routines for windows. + */ +#include +#include +#include +#include "serv.h" + +#ifndef __ECOS +/* readable error strings*/ +char *nxErrorStrings[] = { + GR_ERROR_STRINGS +}; +#endif + +#if NONETWORK +/* [copied from client.c] + * The following is the user defined function for handling errors. + * If this is not set, then the default action is to close the connection + * to the server, describe the error, and then exit. This error function + * will only be called when the client asks for events. + */ +static GR_FNCALLBACKEVENT ErrorFunc = GrDefaultErrorHandler; + +/* + * The default error handler which is called when the server + * reports an error event and the client hasn't set a handler for error events. + */ +void +GrDefaultErrorHandler(GR_EVENT *ep) +{ + if (ep->type == GR_EVENT_TYPE_ERROR) { + EPRINTF("nxclient: Error (%s) ", ep->error.name); + EPRINTF(nxErrorStrings[ep->error.code], ep->error.id); + GrClose(); + exit(1); + } +} + +/* + * Set an error handling routine, which will be called on any errors from + * the server (when events are asked for by the client). If zero is given, + * then errors will be returned as regular events. + * Returns the previous error handler. + */ +GR_FNCALLBACKEVENT +GrSetErrorHandler(GR_FNCALLBACKEVENT fncb) +{ + GR_FNCALLBACKEVENT orig = ErrorFunc; + + ErrorFunc = fncb; + return orig; +} +#endif /* NONETWORK*/ + +/* + * Generate an error from a graphics function. + * This creates a special event which describes the error. + * Only one error event at a time can be saved for delivery to a client. + * This is ok since there are usually lots of redundant errors generated + * before the client can notice, errors occurs after the fact, and clients + * can't do much about them except complain and die. The error is saved + * specially so that memory problems cannot occur. + */ +void GsError(GR_ERROR code, GR_ID id) +{ + GR_EVENT_ERROR *ep; /* event to describe error */ + + EPRINTF("nano-X: GsError "); + if(curfunc) + EPRINTF("(%s) ", curfunc); + EPRINTF(nxErrorStrings[code], id); + + /* if no clients, nothing to report*/ + if (!curclient) + return; + + /* queue the error event regardless of GrSelectEvents*/ + ep = (GR_EVENT_ERROR *)GsAllocEvent(curclient); + ep->type = GR_EVENT_TYPE_ERROR; + ep->name[0] = 0; + if(curfunc) { + strncpy(ep->name, curfunc, sizeof(GR_FUNC_NAME)); + ep->name[sizeof(GR_FUNC_NAME)-1] = '\0'; + } + ep->code = code; + ep->id = id; +} + +/* + * Allocate an event to be passed back to the specified client. + * The event is already chained onto the event queue, and only + * needs filling out. Returns NULL with an error generated if + * the event cannot be allocated. + */ +GR_EVENT *GsAllocEvent(GR_CLIENT *client) +{ + GR_EVENT_LIST *elp; /* current element list */ + GR_CLIENT *oldcurclient; /* old current client */ + + /* + * Get a new event structure from the free list, or else + * allocate it using malloc. + */ + elp = eventfree; + if (elp) + eventfree = elp->next; + else { + elp = (GR_EVENT_LIST *) malloc(sizeof(GR_EVENT_LIST)); + if (elp == NULL) { + oldcurclient = curclient; + curclient = client; + GsError(GR_ERROR_MALLOC_FAILED, 0); + curclient = oldcurclient; + return NULL; + } + } + + /* + * Add the event to the end of the event list. + */ + if (client->eventhead) + client->eventtail->next = elp; + else + client->eventhead = elp; + client->eventtail = elp; + elp->next = NULL; + elp->event.type = GR_EVENT_TYPE_NONE; + + return &elp->event; +} + +/* + * Update mouse status and issue events on it if necessary. + * This function doesn't block, but is normally only called when + * there is known to be some data waiting to be read from the mouse. + */ +GR_BOOL GsCheckMouseEvent(void) +{ + GR_COORD rootx; /* latest mouse x position */ + GR_COORD rooty; /* latest mouse y position */ + int newbuttons; /* latest buttons */ + int mousestatus; /* latest mouse status */ + + /* Read the latest mouse status: */ + mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons); + if(mousestatus < 0) { + GsError(GR_ERROR_MOUSE_ERROR, 0); + return FALSE; + } else if(mousestatus) { /* Deliver events as appropriate: */ + GsHandleMouseStatus(rootx, rooty, newbuttons); + + /* possibly reset portrait mode based on mouse position*/ + if (autoportrait) + GsSetPortraitModeFromXY(rootx, rooty); + return TRUE; + } + return FALSE; +} + +/* + * Update keyboard status and issue events on it if necessary. + * This function doesn't block, but is normally only called when + * there is known to be some data waiting to be read from the keyboard. + */ +GR_BOOL GsCheckKeyboardEvent(void) +{ + MWKEY mwkey; /* latest character */ + MWKEYMOD modifiers; /* latest modifiers */ + MWSCANCODE scancode; + int keystatus; /* latest keyboard status */ + + /* Read the latest keyboard status: */ + keystatus = GdReadKeyboard(&mwkey, &modifiers, &scancode); + + if(keystatus < 0) { + if(keystatus == -2) /* special case return code*/ + GsTerminate(); + GsError(GR_ERROR_KEYBOARD_ERROR, 0); + return FALSE; + } else if(keystatus) { /* Deliver events as appropriate: */ + switch (mwkey) { + case MWKEY_QUIT: + GsTerminate(); + /* no return*/ + case MWKEY_REDRAW: + GsRedrawScreen(); + break; + case MWKEY_PRINT: + if (keystatus == 1) + GdCaptureScreen("screen.bmp"); + break; + } + GsDeliverKeyboardEvent(0, + (keystatus==1? + GR_EVENT_TYPE_KEY_DOWN: GR_EVENT_TYPE_KEY_UP), + mwkey, modifiers, scancode); + return TRUE; + } + return FALSE; +} + +/* + * Handle all mouse events. These are mouse enter, mouse exit, mouse + * motion, mouse position, button down, and button up. This also moves + * the cursor to the new mouse position and changes it shape if needed. + */ +void GsHandleMouseStatus(GR_COORD newx, GR_COORD newy, int newbuttons) +{ + int changebuttons; /* buttons that have changed */ + MWKEYMOD modifiers; /* latest modifiers */ + + GdGetModifierInfo(NULL, &modifiers); /* Read kbd modifiers */ + + /* + * First, if the mouse has moved, then position the cursor to the + * new location, which will send mouse enter, mouse exit, focus in, + * and focus out events if needed. Check here for mouse motion and + * mouse position events. Flush the device queue to make sure the + * new cursor location is quickly seen by the user. + */ + if ((newx != cursorx) || (newy != cursory)) { + GsResetScreenSaver(); + GrMoveCursor(newx, newy); + GsDeliverMotionEvent(GR_EVENT_TYPE_MOUSE_MOTION, + newbuttons, modifiers); + GsDeliverMotionEvent(GR_EVENT_TYPE_MOUSE_POSITION, + newbuttons, modifiers); + } + + /* + * Next, generate a button up event if any buttons have been released. + */ + changebuttons = (curbuttons & ~newbuttons); + if (changebuttons) { + GsResetScreenSaver(); + GsDeliverButtonEvent(GR_EVENT_TYPE_BUTTON_UP, + newbuttons, changebuttons, modifiers); + } + + /* + * Finally, generate a button down event if any buttons have been + * pressed. + */ + changebuttons = (~curbuttons & newbuttons); + if (changebuttons) { + GsResetScreenSaver(); + GsDeliverButtonEvent(GR_EVENT_TYPE_BUTTON_DOWN, + newbuttons, changebuttons, modifiers); + } + + curbuttons = newbuttons; +} + +/* + * Deliver a mouse button event to the clients which have selected for it. + * Each client can only be delivered one instance of the event. The window + * the event is delivered for is either the smallest one containing the + * mouse coordinates, or else one of its direct ancestors. The lowest + * window in that tree which has enabled for the event gets it. This scan + * is done independently for each client. If a window with the correct + * noprop mask is reached, or if no window selects for the event, then the + * event is discarded for that client. Special case: for the first client + * that is enabled for both button down and button up events in a window, + * then the pointer is implicitly grabbed by that window when a button is + * pressed down in that window. The grabbing remains until all buttons are + * released. While the pointer is grabbed, no other clients or windows can + * receive button down or up events. + */ +void GsDeliverButtonEvent(GR_EVENT_TYPE type, int buttons, int changebuttons, + int modifiers) +{ + GR_EVENT_BUTTON *ep; /* mouse button event */ + GR_WINDOW *wp; /* current window */ + GR_EVENT_CLIENT *ecp; /* current event client */ + GR_CLIENT *client; /* current client */ + GR_WINDOW_ID subwid; /* subwindow id event is for */ + GR_EVENT_MASK eventmask; /* event mask */ + GR_EVENT_MASK tempmask; /* to get around compiler bug */ + + eventmask = GR_EVENTMASK(type); + if (eventmask == 0) + return; + + /* + * If the pointer is implicitly grabbed, then the only window + * which can receive button events is that window. Otherwise + * the window the pointer is in gets the events. Determine the + * subwindow by seeing if it is a child of the grabbed button. + */ + wp = mousewp; + subwid = wp->id; + + if (grabbuttonwp) { + while ((wp != rootwp) && (wp != grabbuttonwp)) + wp = wp->parent; +#if 0 + if (wp != grabbuttonwp) + subwid = grabbuttonwp->id; +#endif + wp = grabbuttonwp; + } + + for (;;) { + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & eventmask) == 0) + continue; + + client = ecp->client; + + /* + * If this is a button down, the buttons are not + * yet grabbed, and this client is enabled for both + * button down and button up events, then implicitly + * grab the window for him. + */ + if ((type == GR_EVENT_TYPE_BUTTON_DOWN) + && (grabbuttonwp == NULL)) + { + tempmask = GR_EVENT_MASK_BUTTON_UP; + if (ecp->eventmask & tempmask) { +/*DPRINTF("nano-X: implicit grab on window %d\n", wp->id);*/ + grabbuttonwp = wp; + } + } + + ep = (GR_EVENT_BUTTON *) GsAllocEvent(client); + if (ep == NULL) + continue; + + ep->type = type; + ep->wid = wp->id; + ep->subwid = subwid; + ep->rootx = cursorx; + ep->rooty = cursory; + ep->x = cursorx - wp->x; + ep->y = cursory - wp->y; + ep->buttons = buttons; + ep->changebuttons = changebuttons; + ep->modifiers = modifiers; + ep->time = GsGetTickCount(); + } + + /* + * Events do not propagate if the window was grabbed. + * Also release the grab if the buttons are now all released, + * which can cause various events. + */ + if (grabbuttonwp) { + if (buttons == 0) { + grabbuttonwp = NULL; + GrMoveCursor(cursorx, cursory); + } + return; + } + + if ((wp == rootwp) || (wp->nopropmask & eventmask)) + return; + + wp = wp->parent; + } +} + +/* + * Deliver a mouse motion event to the clients which have selected for it. + * Each client can only be delivered one instance of the event. The window + * the event is delivered for is either the smallest one containing the + * mouse coordinates, or else one of its direct ancestors. The lowest + * window in that tree which has enabled for the event gets it. This scan + * is done independently for each client. If a window with the correct + * noprop mask is reached, or if no window selects for the event, then the + * event is discarded for that client. Special case: If the event type is + * GR_EVENT_TYPE_MOUSE_POSITION, then only the last such event is queued for + * any single client to reduce events. If the mouse is implicitly grabbed, + * then only the grabbing window receives the events, and continues to do + * so even if the mouse is currently outside of the grabbing window. + */ +void GsDeliverMotionEvent(GR_EVENT_TYPE type, int buttons, MWKEYMOD modifiers) +{ + GR_EVENT_MOUSE *ep; /* mouse motion event */ + GR_WINDOW *wp; /* current window */ + GR_EVENT_CLIENT *ecp; /* current event client */ + GR_CLIENT *client; /* current client */ + GR_WINDOW_ID subwid; /* subwindow id event is for */ + GR_EVENT_MASK eventmask; /* event mask */ + + eventmask = GR_EVENTMASK(type); + if (eventmask == 0) + return; + + wp = mousewp; + subwid = wp->id; + + if (grabbuttonwp) { + while ((wp != rootwp) && (wp != grabbuttonwp)) + wp = wp->parent; +#if 0 + if (wp != grabbuttonwp) + subwid = grabbuttonwp->id; +#endif + wp = grabbuttonwp; + } + + for (;;) { + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & eventmask) == 0) + continue; + + client = ecp->client; + + /* + * If the event is for just the latest position, + * then search the event queue for an existing + * event of this type (if any), and free it. + */ + if (type == GR_EVENT_TYPE_MOUSE_POSITION) + GsFreePositionEvent(client, wp->id, subwid); + + ep = (GR_EVENT_MOUSE *) GsAllocEvent(client); + if (ep == NULL) + continue; + + ep->type = type; + ep->wid = wp->id; + ep->subwid = subwid; + ep->rootx = cursorx; + ep->rooty = cursory; + ep->x = cursorx - wp->x; + ep->y = cursory - wp->y; + ep->buttons = buttons; + ep->modifiers = modifiers; + } + + if ((wp == rootwp) || grabbuttonwp || + (wp->nopropmask & eventmask)) + return; + + wp = wp->parent; + } +} + +/* + * Deliver a keyboard event to one of the clients which have selected for it. + * Only the first client found gets the event (no duplicates are sent). The + * window the event is delivered to is either the smallest one containing + * the mouse coordinates, or else one of its direct ancestors (if such a + * window is a descendant of the focus window), or else just the focus window. + * The lowest window in that tree which has enabled for the event gets it. + * If a window with the correct noprop mask is reached, or if no window selects + * for the event, then the event is discarded. + */ +void GsDeliverKeyboardEvent(GR_WINDOW_ID wid, GR_EVENT_TYPE type, + GR_KEY keyvalue, GR_KEYMOD modifiers, GR_SCANCODE scancode) +{ + GR_EVENT_KEYSTROKE *ep; /* keystroke event */ + GR_WINDOW *wp; /* current window */ + GR_WINDOW *tempwp; /* temporary window pointer */ + GR_EVENT_CLIENT *ecp; /* current event client */ + GR_WINDOW_ID subwid; /* subwindow id event is for */ + GR_EVENT_MASK eventmask; /* event mask */ + GR_WINDOW *kwp; + + eventmask = GR_EVENTMASK(type); + if (eventmask == 0) + return; + + GsResetScreenSaver(); + + /* if window id passed, use it, otherwise focus window*/ + if (wid) { + kwp = GsFindWindow(wid); + if (!kwp) + return; + } else + kwp = focuswp; + wp = mousewp; + subwid = wp->id; + + /* + * See if the actual window the pointer is in is a descendant of + * the focus window. If not, then ignore it, and force the input + * into the focus window itself. + */ + tempwp = wp; + while ((tempwp != kwp) && (tempwp != rootwp)) + tempwp = tempwp->parent; + + if (tempwp != kwp) { + wp = kwp; + subwid = wp->id; + } + + /* + * Now walk upwards looking for the first window which will accept + * the keyboard event. However, do not go beyond the focus window, + * and only give the event to one client. + */ + for (;;) { + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & eventmask) == 0) + continue; + + ep = (GR_EVENT_KEYSTROKE *) GsAllocEvent(ecp->client); + if (ep == NULL) + return; + + ep->type = type; + ep->wid = wp->id; + ep->subwid = subwid; + ep->rootx = cursorx; + ep->rooty = cursory; + ep->x = cursorx - wp->x; + ep->y = cursory - wp->y; + ep->buttons = curbuttons; + ep->modifiers = modifiers; + ep->ch = keyvalue; + ep->scancode = scancode; + return; /* only one client gets it */ + } + + if ((wp == rootwp) || (wp == kwp) || + (wp->nopropmask & eventmask)) + return; + + wp = wp->parent; + } +} + +/* + * Try to deliver a exposure event to the clients which have selected for it. + * This does not send exposure events for unmapped or input-only windows. + * Exposure events do not propagate upwards. + */ +void +GsDeliverExposureEvent(GR_WINDOW *wp, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height) +{ + GR_EVENT_EXPOSURE *ep; /* exposure event */ + GR_EVENT_CLIENT *ecp; /* current event client */ + + if (wp->unmapcount || !wp->output) + return; + + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & GR_EVENT_MASK_EXPOSURE) == 0) + continue; + + GsFreeExposureEvent(ecp->client, wp->id, x, y, width, height); + + ep = (GR_EVENT_EXPOSURE *) GsAllocEvent(ecp->client); + if (ep == NULL) + continue; + + ep->type = GR_EVENT_TYPE_EXPOSURE; + ep->wid = wp->id; + ep->x = x; + ep->y = y; + ep->width = width; + ep->height = height; + } +} + +/* + * Search for an enclosed expose event in the specified client's + * event queue, and remove it. This is used to prevent multiple expose + * events from being delivered, thus providing a more pleasing visual + * redraw effect than if the events were all sent. + */ +void +GsFreeExposureEvent(GR_CLIENT *client, GR_WINDOW_ID wid, GR_COORD x, + GR_COORD y, GR_SIZE width, GR_SIZE height) +{ + GR_EVENT_LIST *elp; /* current element list */ + GR_EVENT_LIST *prevelp; /* previous element list */ + + prevelp = NULL; + for (elp = client->eventhead; elp; prevelp = elp, elp = elp->next) { + if (elp->event.type != GR_EVENT_TYPE_EXPOSURE || + elp->event.exposure.wid != wid) + continue; + if (elp->event.exposure.x < x || elp->event.exposure.y < y || + elp->event.exposure.x+elp->event.exposure.width > x+width || + elp->event.exposure.y+elp->event.exposure.height > y+height) + continue; + + /* + * Found one, remove it and put it back on the free list. + */ + if (prevelp) + prevelp->next = elp->next; + else + client->eventhead = elp->next; + if (client->eventtail == elp) + client->eventtail = prevelp; + + elp->next = eventfree; + eventfree = elp; + return; + } +} + +/* + * Try to deliver an update event to the clients which have selected for it. + */ +void GsDeliverUpdateEvent(GR_WINDOW *wp, GR_UPDATE_TYPE utype, GR_COORD x, + GR_COORD y, GR_SIZE width, GR_SIZE height) +{ + GR_EVENT_MASK cmask = GR_EVENT_MASK_UPDATE; + GR_EVENT_UPDATE *ep; /* update event */ + GR_EVENT_CLIENT *ecp; /* current event client */ + GR_WINDOW_ID id = wp->id; + int lcount = 0; + + /* adjust reported x,y to be parent-relative*/ + if (wp->parent) { + x -= wp->parent->x; + y -= wp->parent->y; + } + +update_again: + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & cmask) == 0) + continue; + + ep = (GR_EVENT_UPDATE *) GsAllocEvent(ecp->client); + if (ep == NULL) + continue; + + ep->type = lcount? + GR_EVENT_TYPE_CHLD_UPDATE: GR_EVENT_TYPE_UPDATE; + ep->utype = utype; + ep->wid = wp->id; /* GrSelectEvents window id*/ + ep->subwid = id; /* update window id*/ + ep->x = x; + ep->y = y; + ep->width = width; + ep->height = height; + } + + /* If we are currently checking the window updated, go back and + * check its parent too */ + if (!lcount++) { + wp = wp->parent; + /* check for NULL on root window id*/ + if (wp == NULL) + return; + cmask = GR_EVENT_MASK_CHLD_UPDATE; + goto update_again; + } +} + +/* + * Try to deliver a general event such as focus in, focus out, mouse enter, + * or mouse exit to the clients which have selected for it. These events + * only have the window id as data, and do not propagate upwards. + */ +void GsDeliverGeneralEvent(GR_WINDOW *wp, GR_EVENT_TYPE type, GR_WINDOW *other) +{ + GR_EVENT_GENERAL *gp; /* general event */ + GR_EVENT_CLIENT *ecp; /* current event client */ + GR_EVENT_MASK eventmask; /* event mask */ + + eventmask = GR_EVENTMASK(type); + if (eventmask == 0) + return; + + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & eventmask) == 0) + continue; + + gp = (GR_EVENT_GENERAL *) GsAllocEvent(ecp->client); + if (gp == NULL) + continue; + + gp->type = type; + gp->wid = wp->id; + if (other) + gp->otherid = other->id; + else gp->otherid = 0; + } +} + +/* + * Deliver a portrait mode changed event to all windows which + * have selected for it. + */ +void GsDeliverPortraitChangedEvent(void) +{ + GR_WINDOW *wp; + GR_EVENT_GENERAL *gp; + GR_EVENT_CLIENT *ecp; + + for (wp=listwp; wp; wp=wp->next) { + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & GR_EVENT_MASK_PORTRAIT_CHANGED) == 0) + continue; + + gp = (GR_EVENT_GENERAL *) GsAllocEvent(ecp->client); + if (gp == NULL) + continue; + + gp->type = GR_EVENT_TYPE_PORTRAIT_CHANGED; + gp->wid = wp->id; + gp->otherid = 0; + } + } +} + +/* + * Deliver a Screen Saver event. There is only one parameter- activate the + * screen saver or deactivate it. We only deliver it to the root window, + * but we do send it to every client which has selected for it (because the + * program which starts the screen saver on an activate event might not also + * be the screen saver program which wants to catch the deactivate event). + */ +void GsDeliverScreenSaverEvent(GR_BOOL activate) +{ + GR_EVENT_SCREENSAVER *gp; /* screensaver event */ + GR_EVENT_CLIENT *ecp; /* current event client */ + + for (ecp = rootwp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & GR_EVENT_MASK_SCREENSAVER) == 0) + continue; + + gp = (GR_EVENT_SCREENSAVER *) GsAllocEvent(ecp->client); + if (gp == NULL) + continue; + + gp->type = GR_EVENT_TYPE_SCREENSAVER; + gp->activate = activate; + } +} + +/* + * Deliver a client data request event. Delivered to the clients who have + * selected for this event on the specified window only. + */ +void +GsDeliverClientDataReqEvent(GR_WINDOW_ID wid, GR_WINDOW_ID rid, + GR_SERIALNO serial, GR_MIMETYPE mimetype) +{ + GR_EVENT_CLIENT_DATA_REQ *gp; /* client data request event */ + GR_EVENT_CLIENT *ecp; /* current event client */ + GR_WINDOW *wp; + + if(!(wp = GsFindWindow(wid))) return; + + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & GR_EVENT_MASK_CLIENT_DATA_REQ) == 0) + continue; + + gp = (GR_EVENT_CLIENT_DATA_REQ *) GsAllocEvent(ecp->client); + if (gp == NULL) + continue; + + gp->type = GR_EVENT_TYPE_CLIENT_DATA_REQ; + gp->wid = wid; + gp->rid = rid; + gp->serial = serial; + gp->mimetype = mimetype; + continue; + } +} + +/* + * Deliver a client data event. Delivered to the clients who have selected for + * this event on the specified window only. + */ +void +GsDeliverClientDataEvent(GR_WINDOW_ID wid, GR_WINDOW_ID rid, + GR_SERIALNO serial, GR_LENGTH len, GR_LENGTH thislen, void *data) +{ + GR_EVENT_CLIENT_DATA *gp; /* client data request event */ + GR_EVENT_CLIENT *ecp; /* current event client */ + GR_WINDOW *wp; + + if(!(wp = GsFindWindow(wid))) return; + + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & GR_EVENT_MASK_CLIENT_DATA) == 0) + continue; + + gp = (GR_EVENT_CLIENT_DATA *) GsAllocEvent(ecp->client); + if (gp == NULL) + continue; + + gp->type = GR_EVENT_TYPE_CLIENT_DATA; + gp->wid = wid; + gp->rid = rid; + gp->serial = serial; + gp->len = len; + gp->datalen = thislen; + if(!(gp->data = malloc(thislen))) { + GsError(GR_ERROR_MALLOC_FAILED, wid); + return; + } + memcpy(gp->data, data, thislen); + continue; + } +} + +/* + * Search for a matching mouse position event in the specified client's + * event queue, and remove it. This is used to prevent multiple position + * events from being delivered, thus providing a more efficient rubber- + * banding effect than if the mouse motion events were all sent. + */ +void +GsFreePositionEvent(GR_CLIENT *client, GR_WINDOW_ID wid, GR_WINDOW_ID subwid) +{ + GR_EVENT_LIST *elp; /* current element list */ + GR_EVENT_LIST *prevelp; /* previous element list */ + + prevelp = NULL; + for (elp = client->eventhead; elp; prevelp = elp, elp = elp->next) { + if (elp->event.type != GR_EVENT_TYPE_MOUSE_POSITION) + continue; + if (elp->event.mouse.wid != wid) + continue; + if (elp->event.mouse.subwid != subwid) + continue; + + /* + * Found one, remove it and put it back on the free list. + */ + if (prevelp) + prevelp->next = elp->next; + else + client->eventhead = elp->next; + if (client->eventtail == elp) + client->eventtail = prevelp; + + elp->next = eventfree; + eventfree = elp; + return; + } +} + +/* + * Deliver a "selection owner changed" event to all windows which have + * selected for it. We deliver this event to all clients which have selected + * to receive GR_EVENT_TYPE_SELECTION_CHANGED events for the window of the + * _previous_ selection owner. + */ +void GsDeliverSelectionChangedEvent(GR_WINDOW_ID old_owner, + GR_WINDOW_ID new_owner) +{ + GR_EVENT_SELECTION_CHANGED *gp; /* selection changed event */ + GR_EVENT_CLIENT *ecp; /* current event client */ + GR_WINDOW *wp; + + if(!(wp = GsFindWindow(old_owner))) return; + + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if ((ecp->eventmask & GR_EVENT_MASK_SELECTION_CHANGED) == 0) + continue; + + fprintf(stderr, "Delivering a selection changed event\n"); + gp = (GR_EVENT_SELECTION_CHANGED *) GsAllocEvent(ecp->client); + if (gp == NULL) + continue; + + gp->type = GR_EVENT_TYPE_SELECTION_CHANGED; + gp->new_owner = new_owner; + } +} + +void GsDeliverTimerEvent (GR_CLIENT *client, GR_WINDOW_ID wid, GR_TIMER_ID tid) +{ + GR_EVENT_TIMER *event; /* general event */ + GR_EVENT_CLIENT *ecp; /* current event client */ + GR_WINDOW *wp; /* current window */ + + if ((wp = GsFindWindow (wid)) == NULL) + { + return; + } + + for (ecp = wp->eventclients; ecp != NULL; ecp = ecp->next) + { + if ((ecp->client == client) && ((ecp->eventmask & GR_EVENT_MASK_TIMER) != 0)) + { + event = (GR_EVENT_TIMER*) GsAllocEvent (client); + if (event == NULL) + { + break; + } + + event->type = GR_EVENT_TYPE_TIMER; + event->wid = wid; + event->tid = tid; + } + } +} + diff --git a/packages/services/gfx/mw/current/src/nanox/srvfunc.c b/packages/services/gfx/mw/current/src/nanox/srvfunc.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/srvfunc.c @@ -0,0 +1,2946 @@ +/* + * Copyright (c) 1999, 2000, 2001 Greg Haerr + * Copyright (c) 2000 Alex Holden + * Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + */ +#include +#include +#include +#define MWINCLUDECOLORS +#include "serv.h" + +static int nextid = GR_ROOT_WINDOW_ID + 1; + +static void CheckNextEvent(GR_EVENT *ep, GR_BOOL doSelect); + +/* + * Return information about the screen for clients to use. + */ +void +GrGetScreenInfo(GR_SCREEN_INFO *sip) +{ + GdGetScreenInfo(rootwp->psd, sip); + + /* virtual/workspace screen sizing*/ +#if 0 + /* force small screen for emulation purposes*/ + sip->vs_width = 240; /* PDA*/ + sip->vs_height = 320; + sip->ws_width = 240; + sip->ws_height = 298; +#else + /* set workspace equal to screen area minus 22 pixel taskbar*/ + sip->vs_width = sip->cols; + sip->vs_height = sip->rows; + sip->ws_width = sip->cols; + sip->ws_height = sip->rows - 22; +#endif +} + +/* + * Return the size of a text string for the font in a graphics context. + * This is the width of the string, the height of the string, + * and the height above the bottom of the font of the baseline for the font. + */ +void +GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags, + GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase) +{ + GR_GC *gcp; + GR_FONT *fontp; + PMWFONT pf; + + gcp = GsFindGC(gc); + if (gcp == NULL) + fontp = NULL; + else + fontp = GsFindFont(gcp->fontid); + pf = fontp? fontp->pfont: stdfont; + GdGetTextSize(pf, str, count, retwidth, retheight, retbase, flags); +} + +#if NONETWORK +/* + * Return the next waiting event for a client, or wait for one if there + * is none yet. The event is copied into the specified structure, and + * then is moved from the event queue to the free event queue. If there + * is an error event waiting, it is delivered before any other events. + */ +void +GrGetNextEvent(GR_EVENT *ep) +{ + GrGetNextEventTimeout(ep, 0L); +} + +/* + * Return the next event from the event queue, or + * wait for a new one if one is not ready. If timeout + * is nonzero, return timeout event if time elapsed. + */ +void +GrGetNextEventTimeout(GR_EVENT *ep, GR_TIMEOUT timeout) +{ + /* If no event ready, wait for one*/ + /* Note: won't work for multiple clients*/ + /* This is OK, since only static linked apps call this function*/ + while(curclient->eventhead == NULL) + GsSelect(timeout); + CheckNextEvent(ep, GR_FALSE); +} + +/* + * Wait until an event is available for a client, and then peek at it. + */ +void +GrPeekWaitEvent(GR_EVENT *ep) +{ + while(curclient->eventhead == NULL) + GsSelect(0L); + GrPeekEvent(ep); +} +#endif + +/* + * Return the next event from the event queue if one is ready. + * If one is not ready, then the type GR_EVENT_TYPE_NONE is returned. + * If it is an error event, then a user-specified routine is called + * if it was defined, otherwise we clean up and exit. + */ +void +GrCheckNextEvent(GR_EVENT *ep) +{ + CheckNextEvent(ep, GR_TRUE); +} + +static void +CheckNextEvent(GR_EVENT *ep, GR_BOOL doSelect) +{ + GR_EVENT_LIST * elp; + +#if NONETWORK + /* Since we're bound to server, select() is only called + * thru here + */ + if(doSelect) + GsSelect(0L); +#endif + /* Copy first event if any*/ + if(!GrPeekEvent(ep)) + return; + + /* Get first event again*/ + elp = curclient->eventhead; + + /* Remove first event from queue*/ + curclient->eventhead = elp->next; + if (curclient->eventtail == elp) + curclient->eventtail = NULL; + + elp->next = eventfree; + eventfree = elp; +} + +/* + * Peek at the event queue for the current client to see if there are any + * outstanding events. Returns the event at the head of the queue, or + * else a null event type. The event is still left in the queue, however. + */ +int +GrPeekEvent(GR_EVENT *ep) +{ + GR_EVENT_LIST * elp; + + elp = curclient->eventhead; + if(elp == NULL) { + ep->type = GR_EVENT_TYPE_NONE; + return 0; + } + + /* copy event out*/ + *ep = elp->event; + return 1; +} + +/* + * Return information about a window id. + */ +void +GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr) +{ + GR_WINDOW *wp; /* window structure */ + GR_PIXMAP *pp; + GR_EVENT_CLIENT *evp; /* event-client structure */ + + /* first check window list*/ + wp = GsFindWindow(wid); + if (wp) { + infoptr->wid = wid; + /* report parent-relative x,y coordinates*/ + infoptr->x = wp->x - (wp->parent ? wp->parent->x : 0); + infoptr->y = wp->y - (wp->parent ? wp->parent->y : 0); + infoptr->width = wp->width; + infoptr->height = wp->height; + infoptr->parent = wp->parent? wp->parent->id: 0; + infoptr->child = wp->children? wp->children->id: 0; + infoptr->sibling = wp->siblings? wp->siblings->id: 0; + infoptr->mapped = wp->mapped; + infoptr->unmapcount = wp->unmapcount; + infoptr->inputonly = !wp->output; + infoptr->bordersize = wp->bordersize; + infoptr->bordercolor = wp->bordercolor; + infoptr->background = wp->background; + infoptr->props = wp->props; + infoptr->cursor = wp->cursorid; + infoptr->processid = wp->owner? wp->owner->processid: 0; + infoptr->eventmask = 0; + + for (evp = wp->eventclients; evp; evp = evp->next) { + if (evp->client == curclient) + infoptr->eventmask = evp->eventmask; + } + return; + } + + /* then pixmap list*/ + pp = GsFindPixmap(wid); + if (pp) { + infoptr->wid = wid; + infoptr->x = pp->x; + infoptr->y = pp->y; + infoptr->width = pp->width; + infoptr->height = pp->height; + infoptr->parent = 0; + infoptr->child = 0; + infoptr->sibling = 0; + infoptr->mapped = GR_FALSE; + infoptr->unmapcount = 0; + infoptr->inputonly = GR_FALSE; + infoptr->bordersize = 0; + infoptr->bordercolor = 0; + infoptr->background = 0; + infoptr->eventmask = 0; + infoptr->cursor = 0; + infoptr->processid = pp->owner? pp->owner->processid: 0; + return; + } + + /* No error if window id is invalid.*/ + memset(infoptr, 0, sizeof(GR_WINDOW_INFO)); +} + +/* + * Destroy an existing window and all of its children. + * Also used to destroy a pixmap. + */ +void +GrDestroyWindow(GR_WINDOW_ID wid) +{ + GR_WINDOW *wp; /* window structure */ + GR_PIXMAP *pp; + GR_PIXMAP *prevpp; + PSD psd; + + wp = GsFindWindow(wid); + if (wp) { + GsWpDestroyWindow(wp); + } else { + pp = GsFindPixmap(wid); + if (pp) { + psd = pp->psd; + /* deallocate pixmap memory*/ + if (psd->flags & PSF_ADDRMALLOC) + free(psd->addr); + + /* deallocate mem gc*/ + psd->FreeMemGC(psd); + + /* + * Remove this pixmap from the complete list of pixmaps. + */ + prevpp = listpp; + if (prevpp == pp) + listpp = pp->next; + else { + while (prevpp->next != pp) + prevpp = prevpp->next; + prevpp->next = pp->next; + } + + /* + * Forget various information if they related to this + * pixmap. Then finally free the structure. + */ + if (pp == cachepp) { + cachepixmapid = 0; + cachepp = NULL; + } + free(pp); + } + } +} + + +/* + * Raise a window to the highest level among its siblings. + */ +void +GrRaiseWindow(GR_WINDOW_ID wid) +{ + GR_WINDOW *wp; /* window structure */ + GR_WINDOW *prevwp; /* previous window pointer */ + GR_BOOL overlap; /* TRUE if there was overlap */ + + wp = GsFindWindow(wid); + if ((wp == NULL) || (wp == rootwp)) + return; + + /* + * If this is already the highest window then we are done. + */ + prevwp = wp->parent->children; + if (prevwp == wp) + return; + + /* + * Find the sibling just before this window so we can unlink it. + * Also, determine if any sibling ahead of us overlaps the window. + * Remember that for exposure events. + */ + overlap = GR_FALSE; + while (prevwp->siblings != wp) { + overlap |= GsCheckOverlap(prevwp, wp); + prevwp = prevwp->siblings; + } + overlap |= GsCheckOverlap(prevwp, wp); + + /* + * Now unlink the window and relink it in at the front of the + * sibling chain. + */ + prevwp->siblings = wp->siblings; + wp->siblings = wp->parent->children; + wp->parent->children = wp; + + /* + * Finally redraw the window if necessary. + */ + if (overlap) { + GsDrawBorder(wp); + GsExposeArea(wp, wp->x, wp->y, wp->width, wp->height, NULL); + } +} + +/* + * Lower a window to the lowest level among its siblings. + */ +void GrLowerWindow(GR_WINDOW_ID wid) +{ + GR_WINDOW *wp; /* window structure */ + GR_WINDOW *prevwp; /* previous window pointer */ + GR_WINDOW *sibwp; /* sibling window */ + GR_WINDOW *expwp; /* siblings being exposed */ + + wp = GsFindWindow(wid); + if ((wp == NULL) || (wp == rootwp)) + return; + if (wp->siblings == NULL) + return; + + /* + * Find the sibling just before this window so we can unlink us. + */ + prevwp = wp->parent->children; + if (prevwp != wp) { + while (prevwp->siblings != wp) + prevwp = prevwp->siblings; + } + + /* + * Remember the first sibling that is after us, so we can + * generate exposure events for the remaining siblings. Then + * walk down the sibling chain looking for the last sibling. + */ + expwp = wp->siblings; + sibwp = wp; + while (sibwp->siblings) + sibwp = sibwp->siblings; + + /* + * Now unlink the window and relink it in at the end of the + * sibling chain. + */ + if (prevwp == wp) + wp->parent->children = wp->siblings; + else + prevwp->siblings = wp->siblings; + sibwp->siblings = wp; + + wp->siblings = NULL; + + /* + * Finally redraw the sibling windows which this window covered + * if they overlapped our window. + */ + while (expwp && (expwp != wp)) { + if (GsCheckOverlap(wp, expwp)) { + GsExposeArea(expwp, wp->x - wp->bordersize, + wp->y - wp->bordersize, + wp->width + wp->bordersize * 2, + wp->height + wp->bordersize * 2, NULL); + } + expwp = expwp->siblings; + } +} + +/* Offset a window position and all children by offx,offy*/ +static void +OffsetWindow(GR_WINDOW *wp, GR_COORD offx, GR_COORD offy) +{ + GR_WINDOW *cp; + + wp->x += offx; + wp->y += offy; + for(cp=wp->children; cp; cp=cp->siblings) + OffsetWindow(cp, offx, offy); +} + +/* deliver an update move event to window and all children*/ +static void +DeliverUpdateMoveEventAndChildren(GR_WINDOW *wp) +{ + GR_WINDOW * childwp; + + GsDeliverUpdateEvent(wp, GR_UPDATE_MOVE, wp->x, wp->y, + wp->width, wp->height); + + for (childwp = wp->children; childwp; childwp = childwp->siblings) + DeliverUpdateMoveEventAndChildren(childwp); +} + +/* + * Move the window to the specified position relative to its parent. + */ +void +GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y) +{ + GR_WINDOW *wp; /* window structure */ + GR_COORD offx, offy; + + wp = GsFindWindow(wid); + if (wp == NULL) + return; + if (wp == rootwp) { + GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid); + return; + } + + x += wp->parent->x; + y += wp->parent->y; + offx = x - wp->x; + offy = y - wp->y; + + if (wp->x == x && wp->y == y) + return; + + /*** move algorithms not requiring unmap/map ***/ +#if 1 + /* perform screen blit if topmost and mapped - no flicker!*/ + if (wp->mapped && wp == wp->parent->children + && wp->parent->id == GR_ROOT_WINDOW_ID + + /* temp don't blit in portrait mode, still buggy*/ + && !(wp->psd->portrait & (MWPORTRAIT_LEFT|MWPORTRAIT_RIGHT)) + ) { + int oldx = wp->x; + int oldy = wp->y; + GR_WINDOW_ID pixid = GrNewPixmap(wp->width, wp->height,NULL); + GR_GC_ID gc = GrNewGC(); + GR_WINDOW * stopwp = wp; + int X, Y, W, H; + + /* must hide cursor first or GdFixCursor() will show it*/ + GdHideCursor(rootwp->psd); + + /* turn off clipping of root's children*/ + GrSetGCMode(gc, GR_MODE_COPY|GR_MODE_EXCLUDECHILDREN); + + /* copy topmost window contents offscreen*/ + GrCopyArea(pixid, gc, 0, 0, wp->width, wp->height, + GR_ROOT_WINDOW_ID, oldx, oldy, MWROP_COPY); + + /* calc new window offsets*/ + OffsetWindow(wp, offx, offy); + + /* force recalc of clip region*/ + clipwp = NULL; + + /* copy window bits to new location*/ + GrCopyArea(GR_ROOT_WINDOW_ID, gc, wp->x, wp->y, wp->width, + wp->height, pixid, 0, 0, MWROP_COPY); + + /* + * If any portion of the window was offscreen + * and is coming onscreen, must send expose events + * to this window as well. + */ + if ((oldx < 0 && wp->x > oldx) || + (oldy < 0 && wp->y > oldy) || + (oldx+wp->width > rootwp->width && wp->x < oldx) || + (oldy+wp->height > rootwp->height && wp->y < oldy)) + stopwp = NULL; + + /* + * Calculate bounded exposed area and + * redraw anything lower than stopwp window. + */ + X = MWMIN(oldx, wp->x); + Y = MWMIN(oldy, wp->y); + W = MWMAX(oldx, wp->x) + wp->width - X; + H = MWMAX(oldy, wp->y) + wp->height - Y; + GsExposeArea(rootwp, X, Y, W, H, stopwp); + + GdShowCursor(rootwp->psd); + GrDestroyGC(gc); + GrDestroyWindow(pixid); + DeliverUpdateMoveEventAndChildren(wp); + return; + } +#endif +#if 0 + /* perform quick move and expose if topmost and mapped - no blit*/ + if (wp->mapped && wp == wp->parent->children) { + int oldx = wp->x; + int oldy = wp->y; + int X, Y, W, H; + + OffsetWindow(wp, offx, offy); + + /* force recalc of clip region*/ + clipwp = NULL; + + X = MWMIN(oldx, wp->x); + Y = MWMIN(oldy, wp->y); + W = MWMAX(oldx, wp->x) + wp->width - X; + H = MWMAX(oldy, wp->y) + wp->height - Y; + GsExposeArea(rootwp, X, Y, W, H, NULL); + DeliverUpdateMoveEventAndChildren(wp); + return; + } +#endif + /* + * This method will redraw the window entirely, + * resulting in considerable flicker. + */ + GsWpUnmapWindow(wp, GR_TRUE); + OffsetWindow(wp, offx, offy); + GsWpMapWindow(wp, GR_FALSE); + DeliverUpdateMoveEventAndChildren(wp); +} + +/* + * Resize the window to be the specified size. + */ +void +GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height) +{ + GR_WINDOW *wp; /* window structure */ + + wp = GsFindWindow(wid); + if (wp == NULL) + return; + if (wp == rootwp) { + GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid); + return; + } + if ((width <= 0) || (height <= 0)) { + GsError(GR_ERROR_BAD_WINDOW_SIZE, wid); + return; + } + + if ((wp->width == width) && (wp->height == height)) + return; + + if (wp->unmapcount || !wp->output) { + wp->width = width; + wp->height = height; + return; + } + + /* + * This should be optimized to not require redrawing of the window + * when possible. + */ + GsWpUnmapWindow(wp, GR_TRUE); + wp->width = width; + wp->height = height; + GsWpMapWindow(wp, GR_FALSE); + GsDeliverUpdateEvent(wp, GR_UPDATE_SIZE, wp->x, wp->y, width, height); +} + +/* set unmapcount for a window and all its children*/ +static void +SetUnmapCountTree(GR_WINDOW *wp, int value, GR_BOOL increment) +{ + GR_WINDOW * childwp; + + if (increment) + wp->unmapcount += value; + else wp->unmapcount = value; + + for (childwp = wp->children; childwp; childwp = childwp->siblings) + SetUnmapCountTree(childwp, value, increment); +} + +/* + * Reparent window to new parent, position at passed x, y + * + * NOTE: currently, the new parent must be mapped before + * reparenting, or the children of the newly parented window + * will have bad unmapcount values due to the GrMapWindow + * being called on the parent afterwards, and chaining down + * through the children. + */ +void +GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y) +{ + GR_WINDOW *wp; /* window structure */ + GR_WINDOW *pwp; /* parent window structure */ + GR_WINDOW **mysibptr; /* handle to my sibling ptr */ + GR_COORD offx, offy; + GR_BOOL wasmapped; + + wp = GsFindWindow(wid); + pwp = GsFindWindow(pwid); + if (wp == NULL || pwp == NULL || wp == pwp) + return; + if (wp == rootwp) { + GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid); + return; + } + + x += pwp->x; + y += pwp->y; + offx = x - wp->x; + offy = y - wp->y; + +/*printf("pid %d wid %d (oldpid %d) %d,%d\n", pwid, wid, wp->parent->id, pwp->unmapcount, wp->unmapcount);*/ + /* + * Always unmap window, can't hurt if not mapped. + */ + wasmapped = (wp->unmapcount == 0); + GsWpUnmapWindow(wp, GR_TRUE); + + for(mysibptr = &(wp->parent->children); *mysibptr != wp; + mysibptr = &((*mysibptr)->siblings)) + continue; + *mysibptr = wp->siblings; + wp->parent = pwp; + wp->siblings = pwp->children; + pwp->children = wp; + OffsetWindow(wp, offx, offy); +#if 1 /* temp fix to bad mapcount reparenting code below*/ + GsWpMapWindow(wp, GR_FALSE); +#else + /* + * If parent mapped and window was mapped, set unmapcount + * to 0 and remap window. + */ + if (!pwp->unmapcount && wasmapped) { + SetUnmapCountTree(wp, 0, GR_FALSE); + GsWpMapWindow(wp, GR_FALSE); + } else { + if (wasmapped) + SetUnmapCountTree(wp, pwp->unmapcount, GR_FALSE); + else SetUnmapCountTree(wp, pwp->unmapcount+1, GR_FALSE); + } +#endif +} + +static int nextgcid = 1000; +/* + * Allocate a new GC with default parameters. + * The GC is owned by the current client. + */ +GR_GC_ID +GrNewGC(void) +{ + GR_GC *gcp; + + gcp = (GR_GC *) malloc(sizeof(GR_GC)); + if (gcp == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + return 0; + } + + gcp->id = nextgcid++; + gcp->mode = GR_MODE_COPY; + gcp->regionid = 0; /* no region*/ + gcp->xoff = 0; /* no offset*/ + gcp->yoff = 0; + gcp->fontid = 0; /* 0 is default font*/ + gcp->foreground = WHITE; + gcp->background = BLACK; + gcp->usebackground = GR_TRUE; + gcp->changed = GR_TRUE; + gcp->owner = curclient; + gcp->next = listgcp; + + listgcp = gcp; + + return gcp->id; +} + +/* + * Destroy an existing graphics context. + */ +void +GrDestroyGC(GR_GC_ID gc) +{ + GR_GC *gcp; /* graphics context */ + GR_GC *prevgcp; /* previous graphics context */ + + gcp = GsFindGC(gc); + if (gcp == NULL) + return; + + if (gc == cachegcid) { + cachegcid = 0; + cachegcp = NULL; + } + if (gcp == curgcp) + curgcp = NULL; + + if (listgcp == gcp) + listgcp = gcp->next; + else { + prevgcp = listgcp; + while (prevgcp->next != gcp) + prevgcp = prevgcp->next; + + prevgcp->next = gcp->next; + } + free(gcp); +} + +/* + * Allocate a new GC which is a copy of another one. + * The GC is owned by the current client. + */ +GR_GC_ID +GrCopyGC(GR_GC_ID gc) +{ + GR_GC *oldgcp; /* old graphics context */ + GR_GC *gcp; /* new graphics context */ + + oldgcp = GsFindGC(gc); + if (oldgcp == NULL) + return 0; + + gcp = (GR_GC *) malloc(sizeof(GR_GC)); + if (gcp == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + return 0; + } + + /* + * Copy all the old gcp values into the new one, except allocate + * a new id for it and link it into the list of GCs. + */ + *gcp = *oldgcp; + gcp->id = nextgcid++; + gcp->changed = GR_TRUE; + gcp->owner = curclient; + gcp->next = listgcp; + listgcp = gcp; + + return gcp->id; +} + +/* + * Return information about the specified graphics context. + */ +void +GrGetGCInfo(GR_GC_ID gcid, GR_GC_INFO *gcip) +{ + GR_GC *gcp; + + /* + * Find the GC manually so that an error is not generated. + */ + for (gcp = listgcp; gcp && (gcp->id != gcid); gcp = gcp->next) + continue; + + if (gcp == NULL) { + memset(gcip, 0, sizeof(GR_GC_INFO)); + return; + } + + gcip->gcid = gcid; + gcip->mode = gcp->mode; + gcip->region = gcp->regionid; + gcip->xoff = gcp->xoff; + gcip->yoff = gcp->yoff; + gcip->font = gcp->fontid; + gcip->foreground = gcp->foreground; + gcip->background = gcp->background; + gcip->usebackground = gcp->usebackground; +} + +static int nextregionid = 1000; +/* + * Allocate a new REGION with default parameters. + * The REGION is owned by the current client. + */ +GR_REGION_ID +GrNewRegion(void) +{ + GR_REGION *regionp; + + regionp = (GR_REGION *) malloc(sizeof(GR_REGION)); + if (regionp == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + return 0; + } + + regionp->rgn = GdAllocRegion(); + regionp->id = nextregionid++; + regionp->owner = curclient; + regionp->next = listregionp; + + listregionp = regionp; + return regionp->id; +} + +/* + * Allocate a new region from a set of points interpreted as a polygon. + * The REGION is owned by the current client. + */ +GR_REGION_ID +GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points) +{ +#if POLYREGIONS + GR_REGION *regionp; + + regionp = (GR_REGION *) malloc(sizeof(GR_REGION)); + if (regionp == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + return 0; + } + + regionp->rgn = GdAllocPolygonRegion(points, count, mode); + regionp->id = nextregionid++; + regionp->owner = curclient; + regionp->next = listregionp; + + listregionp = regionp; + return regionp->id; +#else + return 0; +#endif +} + +/* + * Destroy an existing region. + */ +void +GrDestroyRegion(GR_REGION_ID region) +{ + GR_REGION *regionp; /* region */ + GR_REGION *prevregionp; /* previous region */ + + regionp = GsFindRegion(region); + if (regionp == NULL) + return; + + if (listregionp == regionp) + listregionp = regionp->next; + else { + prevregionp = listregionp; + while (prevregionp->next != regionp) + prevregionp = prevregionp->next; + + prevregionp->next = regionp->next; + } + GdDestroyRegion(regionp->rgn); + free(regionp); +} + +/* + * Updates the region from a union of the specified rectangle + * and the original region. + */ +void +GrUnionRectWithRegion(GR_REGION_ID region, GR_RECT *rect) +{ + GR_REGION *regionp; + MWRECT rc; + + regionp = GsFindRegion(region); + if (regionp) { + /* convert Nano-X rect to MW rect*/ + rc.left = rect->x; + rc.top = rect->y; + rc.right = rect->x + rect->width; + rc.bottom = rect->y + rect->height; + GdUnionRectWithRegion(&rc, regionp->rgn); + } +} + +/* + * Updates the region from a union of two regions. + */ +void +GrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2) +{ + GR_REGION *regionp; + GR_REGION *srcregionp1; + GR_REGION *srcregionp2; + + regionp = GsFindRegion(dst_rgn); + if (regionp == NULL) + return; + + srcregionp1 = GsFindRegion(src_rgn1); + if (srcregionp1 == NULL) + return; + + srcregionp2 = GsFindRegion(src_rgn2); + if (srcregionp2 == NULL) + return; + + GdUnionRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn); +} + +/* + * Updates the region by subtracting a region from another. + */ +void +GrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2) +{ + GR_REGION *regionp; + GR_REGION *srcregionp1; + GR_REGION *srcregionp2; + + regionp = GsFindRegion(dst_rgn); + if (regionp == NULL) + return; + + srcregionp1 = GsFindRegion(src_rgn1); + if (srcregionp1 == NULL) + return; + + srcregionp2 = GsFindRegion(src_rgn2); + if (srcregionp2 == NULL) + return; + + GdSubtractRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn); +} + +/* + * Updates the region to the difference of two regions. + */ +void +GrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2) +{ + GR_REGION *regionp; + GR_REGION *srcregionp1; + GR_REGION *srcregionp2; + + regionp = GsFindRegion(dst_rgn); + if (regionp == NULL) + return; + + srcregionp1 = GsFindRegion(src_rgn1); + if (srcregionp1 == NULL) + return; + + srcregionp2 = GsFindRegion(src_rgn2); + if (srcregionp2 == NULL) + return; + + GdXorRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn); +} + +/* + * Updates the region from a intersection of two regions. + */ +void +GrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1, + GR_REGION_ID src_rgn2) +{ + GR_REGION *regionp; + GR_REGION *srcregionp1; + GR_REGION *srcregionp2; + + regionp = GsFindRegion(dst_rgn); + if (regionp == NULL) + return; + + srcregionp1 = GsFindRegion(src_rgn1); + if (srcregionp1 == NULL) + return; + + srcregionp2 = GsFindRegion(src_rgn2); + if (srcregionp2 == NULL) + return; + + GdIntersectRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn); +} + +/* + * Sets the clip-mask in the GC to the specified region. + */ +void +GrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region) +{ + GR_GC *gcp; + + gcp = GsFindGC(gc); + if(gcp == NULL) + return; + + gcp->regionid = region; + gcp->changed = GR_TRUE; +} + +/* + * Set the x,y origin of user clip region in GC. + */ +void +GrSetGCClipOrigin(GR_GC_ID gc, int xoff, int yoff) +{ + GR_GC *gcp; + + gcp = GsFindGC(gc); + if(gcp == NULL) + return; + + gcp->xoff = xoff; + gcp->yoff = yoff; + gcp->changed = GR_TRUE; +} + +/* + * Determines whether a specified point resides in a region. + */ +GR_BOOL +GrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y) +{ + GR_REGION *regionp; + + regionp = GsFindRegion(region); + if (regionp == NULL) + return GR_FALSE; + + return GdPtInRegion(regionp->rgn, x, y); +} + +/* + * Determines whether a specified rectangle at least partly resides + * in a region. + */ +int +GrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y, GR_COORD w, + GR_COORD h) +{ + GR_REGION *regionp; + MWRECT rect; + + regionp = GsFindRegion(region); + if (regionp == NULL) + return MWRECT_OUT; + + rect.left = x; + rect.top = y; + rect.right = x + w; + rect.bottom = y + h; + return GdRectInRegion(regionp->rgn, &rect); +} + +/* + * Return GR_TRUE if a region is empty. + */ +GR_BOOL +GrEmptyRegion(GR_REGION_ID region) +{ + GR_REGION *regionp; + + regionp = GsFindRegion(region); + if (regionp == NULL) + return GR_TRUE; + + return GdEmptyRegion(regionp->rgn); +} + +/* + * Return GR_TRUE if two regions are identical. + */ +GR_BOOL +GrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2) +{ + GR_REGION *prgn1; + GR_REGION *prgn2; + + prgn1 = GsFindRegion(rgn1); + prgn2 = GsFindRegion(rgn2); + + if (!prgn1 && !prgn2) + return GR_TRUE; + if (!prgn1 || !prgn2) + return GR_FALSE; + + return GdEqualRegion(prgn1->rgn, prgn2->rgn); +} + +/* + * Offset a region by dx, dy. + */ +void +GrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy) +{ + GR_REGION *regionp; + + regionp = GsFindRegion(region); + if (regionp) + GdOffsetRegion(regionp->rgn, dx, dy); +} + +/* + * Return the bounding box for the specified region. + */ +int +GrGetRegionBox(GR_REGION_ID region, GR_RECT *rect) +{ + GR_REGION *regionp; + MWRECT rc; + int ret_val; + + regionp = GsFindRegion(region); + if (regionp == NULL) { + memset(rect, 0, sizeof(GR_RECT)); + return MWREGION_ERROR; + } + + ret_val = GdGetRegionBox(regionp->rgn, &rc); + /* convert MW rect to Nano-X rect*/ + rect->x = rc.left; + rect->y = rc.top; + rect->width = rc.right - rc.left; + rect->height = rc.bottom - rc.top; + return ret_val; +} + +static int nextfontid = 1000; +/* + * Allocate a new GC with default parameters. + * The GC is owned by the current client. + */ +GR_FONT_ID +GrCreateFont(GR_CHAR *name, GR_COORD height, GR_LOGFONT *plogfont) +{ + GR_FONT *fontp; + + fontp = (GR_FONT *) malloc(sizeof(GR_FONT)); + if (fontp == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + return 0; + } + + if (plogfont) + fontp->pfont = GdCreateFont(&scrdev, NULL, 0, plogfont); + else + fontp->pfont = GdCreateFont(&scrdev, name, height, NULL); + fontp->id = nextfontid++; + fontp->owner = curclient; + fontp->next = listfontp; + + listfontp = fontp; + + return fontp->id; +} + +/* Set the font size for the passed font*/ +void +GrSetFontSize(GR_FONT_ID fontid, GR_COORD size) +{ + GR_FONT *fontp; + + fontp = GsFindFont(fontid); + if (fontp) + GdSetFontSize(fontp->pfont, size); +} + +/* Set the font rotation in tenths of degrees for the passed font*/ +void +GrSetFontRotation(GR_FONT_ID fontid, int tenthdegrees) +{ + GR_FONT *fontp; + + fontp = GsFindFont(fontid); + if (fontp) + GdSetFontRotation(fontp->pfont, tenthdegrees); +} + +/* Set the font size for the passed font*/ +void +GrSetFontAttr(GR_FONT_ID fontid, int setflags, int clrflags) +{ + GR_FONT *fontp; + + fontp = GsFindFont(fontid); + if (fontp) + GdSetFontAttr(fontp->pfont, setflags, clrflags); +} + +/* + * Unload and deallocate an existing font. + */ +void +GrDestroyFont(GR_FONT_ID fontid) +{ + GR_FONT *fontp; + GR_FONT *prevfontp; + + fontp = GsFindFont(fontid); + if (fontp == NULL) + return; + + if (listfontp == fontp) + listfontp = fontp->next; + else { + prevfontp = listfontp; + while (prevfontp->next != fontp) + prevfontp = prevfontp->next; + + prevfontp->next = fontp->next; + } + GdDestroyFont(fontp->pfont); + free(fontp); +} + +/* + * Return useful information about the specified font. + * Font #0 returns info about the standard font. + */ +void +GrGetFontInfo(GR_FONT_ID font, GR_FONT_INFO *fip) +{ + GR_FONT *fontp; + PMWFONT pf; + + if (font == 0) + pf = stdfont; + else { + fontp = GsFindFont(font); + if (!fontp) { + memset(fip, 0, sizeof(GR_FONT_INFO)); + return; + } + pf = fontp->pfont; + } + GdGetFontInfo(pf, fip); +} + +/* + * Select events for a window for this client. + * The events are a bitmask for the events desired. + */ +void +GrSelectEvents(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask) +{ + GR_WINDOW *wp; /* window structure */ + GR_EVENT_CLIENT *evp; /* event-client structure */ + + wp = GsFindWindow(wid); + if (wp == NULL) + return; + + /* + * See if this client is already in the event client list. + * If so, then just replace the events he is selecting for. + */ + for (evp = wp->eventclients; evp; evp = evp->next) { + if (evp->client == curclient) { + evp->eventmask = eventmask; + return; + } + } + + /* + * A new client for this window, so allocate a new event client + * structure and insert it into the front of the list in the window. + */ + evp = (GR_EVENT_CLIENT *) malloc(sizeof(GR_EVENT_CLIENT)); + if (evp == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, wid); + return; + } + + evp->client = curclient; + evp->eventmask = eventmask; + evp->next = wp->eventclients; + wp->eventclients = evp; + + /* + * If it's a request for child updates to the root window, + * then search entire list and send map events for + * mapped windows now. This allows a window manager + * to get the mapped window list without another API call. + */ + if (wid==GR_ROOT_WINDOW_ID && (eventmask & GR_EVENT_MASK_CHLD_UPDATE)) { + for (wp = listwp; wp; wp = wp->next) { + if (wp->unmapcount == 0) + GsDeliverUpdateEvent(wp, GR_UPDATE_MAP, + wp->x, wp->y, wp->width, wp->height); + } + } +} + +static GR_WINDOW * +NewWindow(GR_WINDOW *pwp, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, GR_SIZE bordersize, GR_COLOR background, + GR_COLOR bordercolor) +{ + GR_WINDOW *wp; /* new window*/ + + if (width <= 0 || height <= 0 || bordersize < 0) { + GsError(GR_ERROR_BAD_WINDOW_SIZE, 0); + return NULL; + } + + wp = (GR_WINDOW *) malloc(sizeof(GR_WINDOW)); + if (wp == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + return NULL; + } + + wp->id = nextid++; + wp->psd = rootwp->psd; + wp->parent = pwp; + wp->children = NULL; + wp->siblings = pwp->children; + wp->next = listwp; + wp->x = pwp->x + x; + wp->y = pwp->y + y; + wp->width = width; + wp->height = height; + wp->bordersize = bordersize; + wp->background = background; + wp->bgpixmap = NULL; + wp->bgpixmapflags = GR_BACKGROUND_TILE; + wp->bordercolor = bordercolor; + wp->nopropmask = 0; + wp->eventclients = NULL; + wp->owner = curclient; + wp->cursorid = pwp->cursorid; + wp->mapped = GR_FALSE; + wp->unmapcount = pwp->unmapcount + 1; + wp->output = GR_TRUE; + wp->props = 0; + wp->title = NULL; + + pwp->children = wp; + listwp = wp; + + return wp; +} + +/* + * Allocate a new window which is a child of the specified window. + * The window inherits the cursor of the parent window. + * The window is owned by the current client. + */ +GR_WINDOW_ID +GrNewWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, GR_SIZE bordersize, GR_COLOR background, + GR_COLOR bordercolor) +{ + GR_WINDOW *pwp; /* parent window */ + GR_WINDOW *wp; /* new window */ + + pwp = GsFindWindow(parent); + if (pwp == NULL) + return 0; + + if (!pwp->output) { + GsError(GR_ERROR_INPUT_ONLY_WINDOW, pwp->id); + return 0; + } + + wp = NewWindow(pwp, x, y, width, height, bordersize, background, + bordercolor); + return wp? wp->id: 0; +} + +/* + * Allocate a new input-only window which is a child of the specified window. + * Such a window is invisible, cannot be drawn into, and is only used to + * return events. The window inherits the cursor of the parent window. + * The window is owned by the current client. + */ +GR_WINDOW_ID +GrNewInputWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height) +{ + GR_WINDOW *pwp; /* parent window */ + GR_WINDOW *wp; /* new window */ + + pwp = GsFindWindow(parent); + if (pwp == NULL) + return 0; + + wp = NewWindow(pwp, x, y, width, height, 0, BLACK, BLACK); + if (wp) { + /* convert to input-only window*/ + wp->output = GR_FALSE; + return wp->id; + } + return 0; +} + +/* + * Allocate a pixmap, can be used with any drawing functions + * for offscreen drawing + */ +GR_WINDOW_ID +GrNewPixmap(GR_SIZE width, GR_SIZE height, void * pixels) +{ + GR_PIXMAP *pp; + PSD psd; + int size, linelen, bpp, planes; + + if (width <= 0 || height <= 0) { + /* no error for now, server will desynchronize w/app*/ + /*GsError(GR_ERROR_BAD_WINDOW_SIZE, 0);*/ + return 0; + } + + /* + * allocate offscreen psd. If screen driver doesn't + * support blitting, this will fail. Use root window screen + * device for compatibility for now. + */ + planes = rootwp->psd->planes; + bpp = rootwp->psd->bpp; + psd = rootwp->psd->AllocateMemGC(rootwp->psd); + if (!psd) + return 0; + + pp = (GR_PIXMAP *) malloc(sizeof(GR_PIXMAP)); + if (pp == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + psd->FreeMemGC(psd); + return 0; + } + + GdCalcMemGCAlloc(psd, width, height, 0, 0, &size, &linelen); + + /* Allocate space for pixel values */ + if (!pixels) { + pixels = calloc(size, 1); + psd->flags |= PSF_ADDRMALLOC; + } + if (!pixels) { + free(pp); + psd->FreeMemGC(psd); + GsError(GR_ERROR_MALLOC_FAILED, 0); + return 0; + } + + pp->id = nextid++; + pp->next = listpp; + pp->psd = psd; + pp->x = 0; + pp->y = 0; + pp->width = width; + pp->height = height; + pp->owner = curclient; + + psd->MapMemGC(psd, width, height, planes, bpp, linelen, size, + pixels); + + listpp = pp; + return pp->id; +} + +/* + * Map the window to make it (and possibly its children) visible on the screen. + */ +void +GrMapWindow(GR_WINDOW_ID wid) +{ + GR_WINDOW *wp; /* window structure */ + + wp = GsFindWindow(wid); + if (!wp || wp->mapped) + return; + + wp->mapped = GR_TRUE; + + GsWpMapWindow(wp, GR_FALSE); +} + +/* + * Unmap the window to make it and its children invisible on the screen. + */ +void +GrUnmapWindow(GR_WINDOW_ID wid) +{ + GR_WINDOW *wp; /* window structure */ + + wp = GsFindWindow(wid); + if (!wp || !wp->mapped) + return; + + GsWpUnmapWindow(wp, GR_FALSE); + + wp->mapped = GR_FALSE; +} + +/* + * Clear the associated area of a window to its background color + * or pixmap. Generate expose event for window if exposeflag set. + */ +void +GrClearArea(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, GR_BOOL exposeflag) +{ + GR_WINDOW *wp; /* window structure */ + + wp = GsPrepareWindow(wid); + if (wp) { + if (width == 0) + width = wp->width; + if (height == 0) + height = wp->height; + GsWpClearWindow(wp, x, y, width, height, exposeflag); + } +} + +/* Return window with keyboard focus.*/ +GR_WINDOW_ID +GrGetFocus(void) +{ + return focuswp->id; +} + +/* + * Set the focus to a particular window. + * This makes keyboard events only visible to that window or children of it, + * depending on the pointer location. + */ +void +GrSetFocus(GR_WINDOW_ID wid) +{ + GR_WINDOW *wp; /* window structure */ + + wp = GsFindWindow(wid); + if (wp == NULL) + return; + + if (wp->unmapcount) { + GsError(GR_ERROR_UNMAPPED_FOCUS_WINDOW, wid); + return; + } + + /* Check if window wants focus, if not, ignore call*/ + if (wp->props & GR_WM_PROPS_NOFOCUS) + return; + + focusfixed = (wp != rootwp); + GsWpSetFocus(wp); +} + +/* + * Create a new server-based cursor resource. + */ +static int nextcursorid = 1000; +GR_CURSOR_ID +GrNewCursor(GR_SIZE width, GR_SIZE height, GR_COORD hotx, GR_COORD hoty, + GR_COLOR foreground, GR_COLOR background, GR_BITMAP *fgbitmap, + GR_BITMAP *bgbitmap) +{ + GR_CURSOR *cp; + int bytes; + + /* + * Make sure the size of the bitmap is reasonable. + */ + if (width <= 0 || width > MWMAX_CURSOR_SIZE || + height <= 0 || height > MWMAX_CURSOR_SIZE) { + GsError(GR_ERROR_BAD_CURSOR_SIZE, 0); + return 0; + } + + cp = (GR_CURSOR *)malloc(sizeof(GR_CURSOR)); + if (cp == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + return 0; + } + + /* fill in cursor structure*/ + cp->cursor.width = width; + cp->cursor.height = height; + cp->cursor.hotx = hotx; + cp->cursor.hoty = hoty; + cp->cursor.fgcolor = foreground; + cp->cursor.bgcolor = background; + bytes = GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP); + memcpy(&cp->cursor.image, fgbitmap, bytes); + memcpy(&cp->cursor.mask, bgbitmap, bytes); + + cp->id = nextcursorid++; + cp->owner = curclient; + cp->next = listcursorp; + listcursorp = cp; + + return cp->id; +} + +/* + * Destroy a server-based cursor. + */ +void +GrDestroyCursor(GR_CURSOR_ID cid) +{ + GR_CURSOR *cursorp; + GR_CURSOR *prevcursorp; + + cursorp = GsFindCursor(cid); + if (cursorp == NULL) + return; + + if (listcursorp == cursorp) + listcursorp = cursorp->next; + else { + prevcursorp = listcursorp; + while (prevcursorp->next != cursorp) + prevcursorp = prevcursorp->next; + + prevcursorp->next = cursorp->next; + } + + if (curcursor == cursorp) + curcursor = NULL; + + free(cursorp); + GsCheckCursor(); +} + +/* + * Specify a cursor for a window. + * This cursor will only be used within that window, and by default + * for its new children. If the cursor is currently within this + * window, it will be changed to the new one immediately. + * If the new cursor id is 0, revert to the root window cursor. + */ +void +GrSetWindowCursor(GR_WINDOW_ID wid, GR_CURSOR_ID cid) +{ + GR_WINDOW *wp; + GR_CURSOR *cp; /* cursor structure */ + + wp = GsFindWindow(wid); + if (wp == NULL) + return; + + if (cid == 0) + cp = stdcursor; + else { + cp = GsFindCursor(cid); + if (!cp) + return; /* FIXME add server errmsg*/ + } + wp->cursorid = cid; + + /* + * If this was the current cursor, then draw the new one. + */ + if (cp == curcursor || curcursor == NULL) { + GdMoveCursor(cursorx - cp->cursor.hotx, + cursory - cp->cursor.hoty); + GdSetCursor(&cp->cursor); + } + + GsCheckCursor(); +} + +/* + * Move the cursor to the specified absolute screen coordinates. + * The coordinates are that of the defined hot spot of the cursor. + * The cursor's appearance is changed to that defined for the window + * in which the cursor is moved to. In addition, mouse enter, mouse + * exit, focus in, and focus out events are generated if necessary. + * The current mouse location is also changed. + */ +void +GrMoveCursor(GR_COORD x, GR_COORD y) +{ + /* + * Move the cursor only if necessary, offsetting it to + * place the hot spot at the specified coordinates. + */ + if ((x != cursorx) || (y != cursory)) { + if(curcursor) { + GdMoveCursor(x - curcursor->cursor.hotx, + y - curcursor->cursor.hoty); + GdMoveMouse(x, y); + } + cursorx = x; + cursory = y; + } + + /* + * Now check to see which window the mouse is in, whether or + * not the cursor shape should be changed, and whether or not + * the input focus window should be changed. + */ + GsCheckMouseWindow(); + GsCheckFocusWindow(); + GsCheckCursor(); +} + +/* + * Set the foreground color in a graphics context. + */ +void +GrSetGCForeground(GR_GC_ID gc, GR_COLOR foreground) +{ + GR_GC *gcp; /* graphics context */ + + gcp = GsFindGC(gc); + if (!gcp || gcp->foreground == foreground) + return; + + gcp->foreground = foreground; + gcp->changed = GR_TRUE; +} + +/* + * Set the background color in a graphics context. + */ +void +GrSetGCBackground(GR_GC_ID gc, GR_COLOR background) +{ + GR_GC *gcp; /* graphics context */ + + gcp = GsFindGC(gc); + if (!gcp || gcp->background == background) + return; + + gcp->background = background; + gcp->changed = GR_TRUE; +} + +/* + * Set whether or not the background color is drawn in bitmaps and text. + */ +void +GrSetGCUseBackground(GR_GC_ID gc, GR_BOOL flag) +{ + GR_GC *gcp; /* graphics context */ + + flag = (flag != 0); + gcp = GsFindGC(gc); + if (!gcp || gcp->usebackground == flag) + return; + + gcp->usebackground = flag; + gcp->changed = GR_TRUE; +} + +/* + * Set the drawing mode in a graphics context. + */ +void +GrSetGCMode(GR_GC_ID gc, int mode) +{ + GR_GC *gcp; /* graphics context */ + + gcp = GsFindGC(gc); + if (!gcp || gcp->mode == mode) + return; + if ((mode & GR_MODE_DRAWMASK) > GR_MAX_MODE) { + GsError(GR_ERROR_BAD_DRAWING_MODE, gc); + return; + } + + gcp->mode = mode; + gcp->changed = GR_TRUE; +} + +/* + * Set the text font in a graphics context. + */ +void +GrSetGCFont(GR_GC_ID gc, GR_FONT_ID font) +{ + GR_GC *gcp; /* graphics context */ + GR_FONT *fontp; + + gcp = GsFindGC(gc); + if (!gcp || gcp->fontid == font) + return; + + fontp = GsFindFont(font); + gcp->fontid = font; + gcp->changed = GR_TRUE; +} + +/* + * Draw a line in the specified drawable using the specified graphics context. + */ + +void +GrLine(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, GR_COORD x2, + GR_COORD y2) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdLine(dp->psd, dp->x + x1, dp->y + y1, + dp->x + x2, dp->y + y2, TRUE); + break; + } +} + +/* + * Draw the boundary of a rectangle in the specified drawable using the + * specified graphics context. + * NOTE: this function draws a rectangle 1 pixel wider and higher + * than Xlib's XDrawRectangle(). + */ +void +GrRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdRect(dp->psd, dp->x + x, dp->y + y, width, height); + break; + } +} + +/* + * Fill a rectangle in the specified drawable using the specified + * graphics context. + */ +void +GrFillRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdFillRect(dp->psd, dp->x + x, dp->y + y, width,height); + break; + } +} + +/* + * Draw the boundary of an ellipse in the specified drawable with + * the specified graphics context. Integer only. + */ +void +GrEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, + GR_SIZE ry) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdEllipse(dp->psd, dp->x + x, dp->y + y, rx, ry, FALSE); + break; + } +} + +/* + * Fill an ellipse in the specified drawable using the specified + * graphics context. Integer only. + */ +void +GrFillEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx, + GR_SIZE ry) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdEllipse(dp->psd, dp->x + x, dp->y + y, rx, ry, TRUE); + break; + } +} + +/* + * Draw an arc, pie or ellipse in the specified drawable using + * the specified graphics context. Integer only. + */ +void +GrArc(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay, + GR_COORD bx, GR_COORD by, int type) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdArc(dp->psd, dp->x + x, dp->y + y, rx, ry, + dp->x+ax, dp->y+ay, dp->x+bx, dp->y+by, type); + break; + } +} + +/* + * Draw an arc or pie in the specified drawable using + * the specified graphics context. Requires floating point. + */ +void +GrArcAngle(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, GR_COORD angle2, int type) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdArcAngle(dp->psd, dp->x + x, dp->y + y, rx, ry, + angle1, angle2, type); + break; + } +} + +/* + * Draw a rectangular area in the specified drawable using the specified + * graphics, as determined by the specified bit map. This differs from + * rectangle drawing in that the rectangle is drawn using the foreground + * color and possibly the background color as determined by the bit map. + * Each row of bits is aligned to the next bitmap word boundary (so there + * is padding at the end of the row). The background bit values are only + * written if the usebackground flag is set in the GC. + */ +void +GrBitmap(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, GR_BITMAP *imagebits) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdBitmap(dp->psd, dp->x + x, dp->y + y, width, height, + imagebits); + break; + } +} + +/* draw a multicolor image at x, y*/ +void +GrDrawImageBits(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_IMAGE_HDR *pimage) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdDrawImage(dp->psd, dp->x + x, dp->y + y, pimage); + break; + } +} + +#if !((DOS_DJGPP) || (__PACIFIC__) || (DOS_TURBOC)) +/* Load an image file from disk and display it at the specified coordinates*/ +void +GrDrawImageFromFile(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, char* path, int flags) +{ +#if defined(HAVE_FILEIO) + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdDrawImageFromFile(dp->psd, dp->x + x, dp->y + y, + width, height, path, flags); + break; + } +#endif +} + +/* load image from file and cache it*/ +GR_IMAGE_ID +GrLoadImageFromFile(char *path, int flags) +{ +#if defined(HAVE_FILEIO) + GR_IMAGE_ID id; + GR_IMAGE * imagep; + + id = GdLoadImageFromFile(&scrdev, path, flags); + if (!id) + return 0; + + imagep = (GR_IMAGE *) malloc(sizeof(GR_IMAGE)); + if (imagep == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + GdFreeImage(id); + return 0; + } + + imagep->id = id; + imagep->owner = curclient; + imagep->next = listimagep; + + listimagep = imagep; + return id; +#else + return 0; +#endif +} + +/* Draw an image from a buffer */ + +void +GrDrawImageFromBuffer(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, + void *buffer, int size, int flags) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdDrawImageFromBuffer(dp->psd, dp->x + x, dp->y + y, + width, height, buffer, size, flags); + break; + } +} + +/* load image from the given buffer and cache it*/ + +GR_IMAGE_ID +GrLoadImageFromBuffer(void *buffer, int size, int flags) +{ + GR_IMAGE_ID id; + GR_IMAGE * imagep; + + id = GdLoadImageFromBuffer(&scrdev, buffer, size, flags); + if (!id) return(0); + + imagep = (GR_IMAGE *) malloc(sizeof(GR_IMAGE)); + if (imagep == NULL) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + GdFreeImage(id); + return 0; + } + + imagep->id = id; + imagep->owner = curclient; + imagep->next = listimagep; + + listimagep = imagep; + return id; +} + + +/* draw cached image*/ +void +GrDrawImageToFit(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, GR_IMAGE_ID imageid) +{ +#if defined(HAVE_FILEIO) + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdDrawImageToFit(dp->psd, dp->x + x, dp->y + y, + width, height, imageid); + break; + + } +#endif +} + +/* free cached image*/ +void +GrFreeImage(GR_IMAGE_ID id) +{ +#if defined(HAVE_FILEIO) + GR_IMAGE *imagep; + GR_IMAGE *previmagep; + + for (imagep = listimagep; imagep; imagep = imagep->next) { + if (imagep->id == id) { + + if (listimagep == imagep) + listimagep = imagep->next; + else { + previmagep = listimagep; + while (previmagep->next != imagep) + previmagep = previmagep->next; + + previmagep->next = imagep->next; + } + + GdFreeImage(imagep->id); + free(imagep); + return; + } + } +#endif +} + +/* return cached image information*/ +void +GrGetImageInfo(GR_IMAGE_ID id, GR_IMAGE_INFO *iip) +{ +#if defined(HAVE_FILEIO) + GdGetImageInfo(id, iip); +#else + memset(iip, 0, sizeof(GR_IMAGE_INFO)); +#endif +} +#endif /* !defined (DOS_DJGPP)|| (__PACIFIC__) || (DOS_TURBOC)) */ + +/* + * Draw a rectangular area in the specified drawable using the specified + * graphics context. This differs from rectangle drawing in that the + * color values for each pixel in the rectangle are specified. + * The color table is indexed row by row. + */ +void +GrArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, void *pixels, int pixtype) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdArea(dp->psd, dp->x + x, dp->y + y, width, height, + pixels, pixtype); + break; + } +} + +/* + * Copy a rectangle from one drawable to another or the same + */ +void +GrCopyArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height, GR_DRAW_ID source, + GR_COORD srcx, GR_COORD srcy, int op) +{ + GR_DRAWABLE *dp; + GR_WINDOW *swp; + GR_PIXMAP *spp = NULL; + GR_DRAW_TYPE type; + PSD srcpsd; + + srcpsd = NULL; + + swp = GsFindWindow(source); + type = GsPrepareDrawing(id, gc, &dp); + if (type == GR_DRAW_TYPE_NONE) + return; + + if (swp) { + srcpsd = swp->psd; + srcx += swp->x; + srcy += swp->y; + } else { + spp = GsFindPixmap(source); + if (spp) + srcpsd = spp->psd; + } + if (!srcpsd) + return; + +#if DYNAMICREGIONS + /* + * Skip blit and send expose event if window is partly + * obscured and source and destination are onscreen. + * Also check that receiving window's first client has + * selected for expose events. This keeps brain-dead + * programs that don't process exposure events somewhat working. + */ + if (swp && (srcpsd == dp->psd) && swp->eventclients && + (swp->eventclients->eventmask & GR_EVENT_MASK_EXPOSURE)) { + MWRECT rc; + extern MWCLIPREGION *clipregion; + + /* clip blit rectangle to source screen/bitmap size*/ + if(srcx+width > srcpsd->xvirtres) + width = srcpsd->xvirtres - srcx; + if(srcy+height > srcpsd->yvirtres) + height = srcpsd->yvirtres - srcy; + + rc.left = srcx; + rc.top = srcy; + rc.right = srcx + width; + rc.bottom = srcy + height; + + /* + * if source isn't entirely within clip region, then + * the blit is partly obscured and will copy some garbage. + * In this case, skip the blit, punt, and deliver an + * exposure event instead for proper display. + */ + if (GdRectInRegion(clipregion, &rc) != MWRECT_ALLIN) { + GsDeliverExposureEvent(swp, dp->x+x, dp->y+y, + width, height); + return; + } + } +#endif + /* perform blit*/ + GdCheckCursor(srcpsd, srcx, srcy, srcx+width, srcy+height); /* FIXME*/ + GdBlit(dp->psd, dp->x+x, dp->y+y, width, height, srcpsd, srcx, srcy,op); + GdFixCursor(srcpsd); /* FIXME*/ +} + + +/* + * Read the color values from the specified rectangular area of the + * specified drawable into a supplied buffer. If the drawable is a + * window which is obscured by other windows, then the returned values + * will include the values from the covering windows. Regions outside + * of the screen boundaries, or unmapped windows will return black. + */ +void +GrReadArea(GR_DRAW_ID id,GR_COORD x,GR_COORD y,GR_SIZE width,GR_SIZE height, + GR_PIXELVAL *pixels) +{ + GR_WINDOW *wp; + GR_PIXMAP *pp = NULL; + + if ((wp = GsFindWindow(id)) == NULL && (pp = GsFindPixmap(id)) == NULL){ + GsError(GR_ERROR_BAD_WINDOW_ID, id); + return; + } + + if (wp != NULL) { + if (wp->unmapcount || (x >= wp->width) || (y >= wp->height) || + (x + width <= 0) || (y + height <= 0)) { + /* long count; + * GR_PIXELVAL black; + * + * black = GdFindColor(BLACK); + * count = width * height; + * while (count-- > 0) + * *pixels++ = black; + */ + return; + } + GdReadArea(wp->psd, wp->x+x, wp->y+y, width, height, pixels); + } + if (pp != NULL) { + if ((x >= pp->width) || (y >= pp->height) || + (x + width <= 0) || (y + height <= 0)) { + return; + } + GdReadArea(pp->psd, x, y, width, height, pixels); + } +} + +/* + * Draw a point in the specified drawable using the specified + * graphics context. + */ +void +GrPoint(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y) +{ + GR_DRAWABLE *dp; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdPoint(dp->psd, dp->x + x, dp->y + y); + break; + } +} + +/* + * Draw points in the specified drawable using the specified + * graphics context. + */ +void +GrPoints(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable) +{ + GR_DRAWABLE *dp; + GR_POINT *pp; + GR_COUNT i; + PSD psd; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + psd = dp->psd; + break; + default: + return; + } + + pp = pointtable; + for (i = count; i-- > 0; pp++) { + GdPoint(psd, pp->x + dp->x, pp->y + dp->y); + } +} + +/* + * Draw a polygon in the specified drawable using the specified + * graphics context. The polygon is only complete if the first + * point is repeated at the end. + */ +void +GrPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable) +{ + GR_DRAWABLE *dp; + GR_POINT *pp; + GR_COUNT i; + PSD psd; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + psd = dp->psd; + break; + default: + return; + } + + /* + * Here for drawing to a window. + * Relocate all the points relative to the window. + */ + pp = pointtable; + for (i = count; i-- > 0; pp++) { + pp->x += dp->x; + pp->y += dp->y; + } + + GdPoly(psd, count, pointtable); + +#ifdef NONETWORK + /* + * The following is only necessary when the server + * isn't a separate process. We don't want to change the + * user's arguments! + */ + pp = pointtable; + for (i = count; i-- > 0; pp++) { + pp->x -= dp->x; + pp->y -= dp->y; + } +#endif +} + +/* + * Draw a filled polygon in the specified drawable using the specified + * graphics context. The last point may be a duplicate of the first + * point, but this is not required. + */ +void +GrFillPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable) +{ + GR_DRAWABLE *dp; + GR_POINT *pp; + GR_COUNT i; + PSD psd; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + psd = dp->psd; + break; + default: + return; + } + + /* + * Here for drawing to a window. + * Relocate all the points relative to the window. + */ + pp = pointtable; + for (i = count; i-- > 0; pp++) { + pp->x += dp->x; + pp->y += dp->y; + } + + GdFillPoly(psd, count, pointtable); + +#ifdef NONETWORK + /* + * The following is only necessary when the server + * isn't a separate process. We don't want to change the + * user's arguments! + */ + pp = pointtable; + for (i = count; i-- > 0; pp++) { + pp->x -= dp->x; + pp->y -= dp->y; + } +#endif +} + +/* + * Draw a text string in the specified drawable using the + * specified graphics context. + */ +void +GrText(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str, + GR_COUNT count, int flags) +{ + GR_DRAWABLE *dp; + + /* default to baseline alignment if none specified*/ + if((flags&(MWTF_TOP|MWTF_BASELINE|MWTF_BOTTOM)) == 0) + flags |= MWTF_BASELINE; + + switch (GsPrepareDrawing(id, gc, &dp)) { + case GR_DRAW_TYPE_WINDOW: + case GR_DRAW_TYPE_PIXMAP: + GdText(dp->psd, dp->x + x, dp->y + y, str, count,flags); + break; + } +} + +/* Return the system palette entries*/ +void +GrGetSystemPalette(GR_PALETTE *pal) +{ + /* return 0 count if not in palettized mode*/ + memset(pal, 0, sizeof(GR_PALETTE *)); + + if(rootwp->psd->pixtype == MWPF_PALETTE) { + pal->count = (int)rootwp->psd->ncolors; + GdGetPalette(rootwp->psd, 0, pal->count, pal->palette); + } +} + +/* Set the system palette entries from first for count*/ +void +GrSetSystemPalette(GR_COUNT first, GR_PALETTE *pal) +{ + GdSetPalette(rootwp->psd, first, pal->count, pal->palette); + if (first == 0) + GsRedrawScreen(); +} + +/* Convert passed color value to pixel value, depending on system mode*/ +void +GrFindColor(GR_COLOR c, GR_PIXELVAL *retpixel) +{ + *retpixel = GdFindColor(c); +} + +/* visible =0, no cursor change; =1, show; else hide*/ +void +GrInjectPointerEvent(GR_COORD x, GR_COORD y, int button, int visible) +{ + if (visible != 0) { + if (visible == 1) + GdShowCursor(&scrdev); + else + GdHideCursor(&scrdev); + } + + GdMoveMouse(x, y); + GsHandleMouseStatus(x, y, button); +} + +void +GrInjectKeyboardEvent(GR_WINDOW_ID wid, GR_KEY keyvalue, GR_KEYMOD modifiers, + GR_SCANCODE scancode, GR_BOOL pressed) +{ + /* create a keyboard event */ + GsDeliverKeyboardEvent(wid, + pressed? GR_EVENT_TYPE_KEY_DOWN: GR_EVENT_TYPE_KEY_UP, + keyvalue, modifiers, scancode); +} + +/* + * Set certain window properties, according to flags value + * passed in props. + */ +void +GrSetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props) +{ + GR_WINDOW *wp; + int tl = 0; /* Initialized to avoid warning */ + + /* Find the window structure (generate an error if it doesn't exist) */ + wp = GsFindWindow(wid); + if(!wp) { + GsError(GR_ERROR_BAD_WINDOW_ID, wid); + return; + } + + /* Set window properties*/ + if (props->flags & GR_WM_FLAGS_PROPS) + wp->props = props->props; + + /* Set window title*/ + if (props->flags & GR_WM_FLAGS_TITLE) { + /* Remove the old title if it exists */ + if(wp->title) + free(wp->title); + + /* Calculate the space needed to store the new title */ + if(props->title) + tl = strlen(props->title) + 1; + + /* Check for empty title*/ + if(!props->title || tl == 1) { + wp->title = NULL; + } else { + /* Otherwise, allocate some space for the new title */ + if(!(wp->title = malloc(tl))) + GsError(GR_ERROR_MALLOC_FAILED, wid); + else + memcpy(wp->title, props->title, tl); + } + } + + /* Set window background*/ + if (props->flags & GR_WM_FLAGS_BACKGROUND) { + if (wp->background != props->background) { + wp->background = props->background; + GsExposeArea(wp, wp->x, wp->y, wp->width, wp->height, + NULL); + } + } + + /* Set window border size*/ + if (props->flags & GR_WM_FLAGS_BORDERSIZE) { + if (wp->bordersize != props->bordersize) { + GsWpUnmapWindow(wp, GR_TRUE); + wp->bordersize = props->bordersize; + GsWpMapWindow(wp, GR_TRUE); + } + } + + /* Set window border color*/ + if (props->flags & GR_WM_FLAGS_BORDERCOLOR) { + if (wp->bordercolor != props->bordercolor) { + wp->bordercolor = props->bordercolor; + if (wp->bordersize) + GsDrawBorder(wp); + } + } +} + +/* + * Return all window properties + */ +void +GrGetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props) +{ + GR_WINDOW *wp; + + /* Find the window structure, no error on invalid window id*/ + wp = GsFindWindow(wid); + if(!wp) { + /* set flags to 0 on bad window id*/ + memset(props, 0, sizeof(GR_WM_PROPERTIES)); + return; + } + + /* Return everything, regardless of props->flags*/ + props->flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE | + GR_WM_FLAGS_BACKGROUND | GR_WM_FLAGS_BORDERSIZE | + GR_WM_FLAGS_BORDERCOLOR; + props->props = wp->props; + props->title = wp->title; + props->background = wp->background; + props->bordersize = wp->bordersize; + props->bordercolor = wp->bordercolor; +} + +void +GrCloseWindow(GR_WINDOW_ID wid) +{ + GR_WINDOW *wp; + + /* Find the window structure (generate an error if it doesn't exist) */ + wp = GsFindWindow(wid); + if(!wp) { + /* + * no error for now, client/server problems + * with nxwm when sent + */ + /*GsError(GR_ERROR_BAD_WINDOW_ID, wid);*/ + return; + } + + /* Send a CLOSE_REQ event to the client */ + GsDeliverGeneralEvent(wp, GR_EVENT_TYPE_CLOSE_REQ, NULL); +} + +void +GrKillWindow(GR_WINDOW_ID wid) +{ + GR_WINDOW *wp; + + /* Find the window structure (generate an error if it doesn't exist) */ + wp = GsFindWindow(wid); + if(!wp) { + GsError(GR_ERROR_BAD_WINDOW_ID, wid); + return; + } + + /* Forcibly kill the connection to the client */ + GsClose(wp->owner->id); +} + +/* + * GrGetSystemColor color scheme definitions + */ +/* define color scheme: A (tan), B (winstd) or C (old)*/ +#define A + +#define A_RGB(r,g,b) +#define B_RGB(r,g,b) +#define C_RGB(r,g,b) + +#ifdef A +#undef A_RGB +#define A_RGB(r,g,b) GR_RGB(r,g,b), +#endif +#ifdef B +#undef B_RGB +#define B_RGB(r,g,b) GR_RGB(r,g,b), +#endif +#ifdef C +#undef C_RGB +#define C_RGB(r,g,b) GR_RGB(r,g,b), +#endif + +#define MAXSYSCOLORS 20 /* # of GR_COLOR_* system colors*/ + +static GR_COLOR sysColors[MAXSYSCOLORS] = { + /* desktop background*/ + GR_RGB( 0, 128, 128), /* GR_COLOR_DESKTOP */ + + /* caption colors*/ + A_RGB(128, 0, 0) /* GR_COLOR_ACTIVECAPTION */ + B_RGB(128, 0, 128) /* GR_COLOR_ACTIVECAPTION */ + C_RGB(128, 0, 128) /* GR_COLOR_ACTIVECAPTION */ + GR_RGB(255, 255, 255), /* GR_COLOR_ACTIVECAPTIONTEXT */ + A_RGB(162, 141, 104) /* GR_COLOR_INACTIVECAPTION */ + B_RGB(128, 128, 128) /* GR_COLOR_INACTIVECAPTION */ + C_RGB( 0, 64, 128) /* GR_COLOR_INACTIVECAPTION */ + GR_RGB(192, 192, 192), /* GR_COLOR_INACTIVECAPTIONTEXT */ + + /* 3d border shades*/ + GR_RGB( 0, 0, 0), /* GR_COLOR_WINDOWFRAME */ + A_RGB(162, 141, 104) /* GR_COLOR_BTNSHADOW */ + B_RGB(128, 128, 128) /* GR_COLOR_BTNSHADOW */ + C_RGB(128, 128, 128) /* GR_COLOR_BTNSHADOW */ + A_RGB(213, 204, 187) /* GR_COLOR_3DLIGHT */ + B_RGB(223, 223, 223) /* GR_COLOR_3DLIGHT */ + C_RGB(192, 192, 192) /* GR_COLOR_3DLIGHT */ + A_RGB(234, 230, 221) /* GR_COLOR_BTNHIGHLIGHT */ + B_RGB(255, 255, 255) /* GR_COLOR_BTNHIGHLIGHT */ + C_RGB(223, 223, 223) /* GR_COLOR_BTNHIGHLIGHT */ + + /* top level application window backgrounds/text*/ + A_RGB(213, 204, 187) /* GR_COLOR_APPWINDOW */ + B_RGB(192, 192, 192) /* GR_COLOR_APPWINDOW */ + C_RGB(160, 160, 160) /* GR_COLOR_APPWINDOW */ + GR_RGB( 0, 0, 0), /* GR_COLOR_APPTEXT */ + + /* button control backgrounds/text (usually same as app window colors)*/ + A_RGB(213, 204, 187) /* GR_COLOR_BTNFACE */ + B_RGB(192, 192, 192) /* GR_COLOR_BTNFACE */ + C_RGB(160, 160, 160) /* GR_COLOR_BTNFACE */ + GR_RGB( 0, 0, 0), /* GR_COLOR_BTNTEXT */ + + /* edit/listbox control backgrounds/text, selected highlights*/ + GR_RGB(255, 255, 255), /* GR_COLOR_WINDOW */ + GR_RGB( 0, 0, 0), /* GR_COLOR_WINDOWTEXT */ + GR_RGB(128, 0, 0), /* GR_COLOR_HIGHLIGHT */ + GR_RGB(255, 255, 255), /* GR_COLOR_HIGHLIGHTTEXT */ + GR_RGB( 64, 64, 64), /* GR_COLOR_GRAYTEXT */ + + /* menu backgrounds/text*/ + A_RGB(213, 204, 187) /* GR_COLOR_MENU */ + B_RGB(192, 192, 192) /* GR_COLOR_MENU */ + C_RGB(160, 160, 160) /* GR_COLOR_MENU */ + GR_RGB( 0, 0, 0), /* GR_COLOR_MENUTEXT */ +}; + +/* Return system-defined color*/ +GR_COLOR +GrGetSysColor(int index) +{ + if(index >= 0 && index < MAXSYSCOLORS) + return sysColors[index]; + return 0; +} + +void +GrSetScreenSaverTimeout(GR_TIMEOUT timeout) +{ + MWTIMER *timer; + + screensaver_delay = timeout * 1000; + + if((timer = GdFindTimer(GsActivateScreenSaver))) + GdDestroyTimer(timer); + + /* 0 timeout cancels timer*/ + if (timeout == 0) + return; + + GdAddTimer(screensaver_delay, GsActivateScreenSaver, + GsActivateScreenSaver); +} + +void +GrSetSelectionOwner(GR_WINDOW_ID wid, GR_CHAR *typelist) +{ + GR_WINDOW_ID oldwid = selection_owner.wid; + + if(selection_owner.typelist) free(selection_owner.typelist); + + selection_owner.wid = wid; + + if(wid) { + if(!(selection_owner.typelist = strdup(typelist))) { + GsError(GR_ERROR_MALLOC_FAILED, wid); + selection_owner.wid = 0; + } + } else selection_owner.typelist = NULL; + + GsDeliverSelectionChangedEvent(oldwid, wid); +} + +GR_WINDOW_ID +GrGetSelectionOwner(GR_CHAR **typelist) +{ + *typelist = selection_owner.typelist; + return selection_owner.wid; +} + +void +GrRequestClientData(GR_WINDOW_ID wid, GR_WINDOW_ID rid, GR_SERIALNO serial, + GR_MIMETYPE mimetype) +{ + GsDeliverClientDataReqEvent(rid, wid, serial, mimetype); +} + +void +GrSendClientData(GR_WINDOW_ID wid, GR_WINDOW_ID did, GR_SERIALNO serial, + GR_LENGTH len, GR_LENGTH thislen, void *data) +{ + void *p; + + if(!(p = malloc(len))) { + GsError(GR_ERROR_MALLOC_FAILED, wid); + return; /* FIXME note no error to application*/ + } + memcpy(p, data, thislen); + + GsDeliverClientDataEvent(did, wid, serial, len, thislen, p); +} + +/* + * Set a window's background pixmap. Note that this doesn't + * cause a screen refresh, use GrClearWindow if required. + */ +void +GrSetBackgroundPixmap(GR_WINDOW_ID wid, GR_WINDOW_ID pixmap, int flags) +{ + GR_WINDOW *wp; + GR_PIXMAP *pp = NULL; + + if (!(wp = GsFindWindow(wid))) { + GsError(GR_ERROR_BAD_WINDOW_ID, wid); + return; + } + + if (pixmap && !(pp = GsFindPixmap(pixmap))) { + GsError(GR_ERROR_BAD_WINDOW_ID, pixmap); + return; + } + wp->bgpixmap = pp; + wp->bgpixmapflags = flags; +} + +void +GrGetFontList(GR_FONTLIST ***fonts, int *numfonts) +{ + GdGetFontList(fonts,numfonts); +} + +void +GrFreeFontList(GR_FONTLIST ***fonts, int num) +{ + GdFreeFontList(fonts, num); +} + +/* + * Return window parent and list of children. + * Caller must free() children list after use. + */ +void +GrQueryTree(GR_WINDOW_ID wid, GR_WINDOW_ID *parentid, GR_WINDOW_ID **children, + GR_COUNT *nchildren) +{ + GR_WINDOW *wp; + GR_WINDOW *cp; + GR_WINDOW_ID *retarray; + GR_COUNT n = 0; + + wp = GsFindWindow(wid); + if (!wp) { + *parentid = 0; +nochildren: + *children = NULL; + *nchildren = 0; + return; + } + *parentid = wp->parent? wp->parent->id: 0; + + /* count children for alloc*/ + for(cp=wp->children; cp; cp=cp->siblings) + ++n; + if (n == 0) + goto nochildren; + + /* alloc return child array*/ + retarray = (GR_WINDOW_ID *)malloc(n * sizeof(GR_WINDOW_ID)); + if (!retarray) { + GsError(GR_ERROR_MALLOC_FAILED, 0); + goto nochildren; + } + + /* fill in return array*/ + n = 0; + for(cp=wp->children; cp; cp=cp->siblings) { + retarray[n++] = cp->id; + } + *children = retarray; + *nchildren = n; +} + + +static int next_timer_id = 1000; + +/** + * GrCreateTimer: + * @wid: the ID of the window to use as a destination for GR_TIMER_EVENT + * events that result from this timer. + * @period: the timer period in milliseconds + * @Returns: the ID of the newly created timer, or 0 if failure. + * + * Creates a Nano-X timer with the specified period. + * NOTE: There is a potential for more GR_TIMER_EVENTS to be queued + * in the connection between the Nano-X server and client. The client + * should be able to handle late arriving GR_TIMER_EVENTs. + */ +GR_TIMER_ID +GrCreateTimer (GR_WINDOW_ID wid, GR_TIMEOUT period) +{ + GR_TIMER *timer; + + /* Create a nano-X layer timr */ + timer = (GR_TIMER*) malloc (sizeof (GR_TIMER)); + if (timer == NULL) + { + GsError (GR_ERROR_MALLOC_FAILED, 0); + return 0; + } + + /* Create a device independent layer timer */ + timer->timer = GdAddPeriodicTimer (period, GsTimerCB, timer); + if (timer->timer == NULL) + { + free (timer); + GsError (GR_ERROR_MALLOC_FAILED, 0); + return 0; + } + + /* + * Fill in the rest of the timer structure, and + * link the new timer into the servers list of timers. + */ + timer->id = next_timer_id++; + timer->owner = curclient; + timer->wid = wid; + timer->next = list_timer; + list_timer = timer; + + return timer->id; +} + +/** + * GrDestroyTimer: + * @tid: the ID of the timer to destroy + * + * Destroys a timer previously created with GrCreateTimer(). + */ +void +GrDestroyTimer (GR_TIMER_ID tid) +{ + GR_TIMER *timer; + GR_TIMER *prev_timer; + + /* Find the timer structure that corresponds to "tid" */ + timer = GsFindTimer (tid); + if (timer == NULL) + return; + + if (tid == cache_timer_id) + { + cache_timer_id = 0; + cache_timer = NULL; + } + + /* Delete the timer from the device independent engine layer */ + GdDestroyTimer (timer->timer); + + /* Pull the timer out of the servers list */ + if (list_timer == timer) + { + list_timer = timer->next; + } + else + { + prev_timer = list_timer; + while (prev_timer->next != timer) + { + prev_timer = prev_timer->next; + } + prev_timer->next = timer->next; + } + free (timer); +} + +/** + * GrSetPortraitMode + * @newmode: new portrait mode + * + * Sets new server portrait mode and redraws all windows. + */ +void +GrSetPortraitMode(int portraitmode) +{ + GsSetPortraitMode(portraitmode); +} diff --git a/packages/services/gfx/mw/current/src/nanox/srvmain.c b/packages/services/gfx/mw/current/src/nanox/srvmain.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/srvmain.c @@ -0,0 +1,903 @@ +/* + * Copyright (c) 1999, 2000, 2001 Greg Haerr + * Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * Main module of graphics server. + */ +#include +#include +#include +#include + +#ifdef __PACIFIC__ +#include +#else +#include +#include +#endif + +#ifdef DOS_TURBOC +#include +#endif + +#define MWINCLUDECOLORS +#include "serv.h" +#if UNIX | DOS_DJGPP +#include +#if _MINIX +#include +#else +#include +#endif +#endif + +#if DOS_DJGPP +typedef unsigned long DWORD; /* FIXME why is this here?*/ +#endif + +#if ELKS +#include +#include +#endif + +#ifdef __ECOS +# include +# include +# ifdef CYGPKG_NET +# define NONETWORK 0 +# else +# error Not yet supported. +# define NONETWORK 1 +# endif +#endif + +/* + * External definitions defined here. + */ +GR_WINDOW_ID cachewindowid; /* cached window id */ +GR_WINDOW_ID cachepixmapid; /* cached pixmap id */ +GR_GC_ID cachegcid; /* cached graphics context id */ +GR_WINDOW *cachewp; /* cached window pointer */ +GR_GC *cachegcp; /* cached graphics context */ +GR_PIXMAP *cachepp; /* cached pixmap */ +GR_PIXMAP *listpp; /* List of all pixmaps */ +GR_WINDOW *listwp; /* list of all windows */ +GR_WINDOW *rootwp; /* root window pointer */ +GR_GC *listgcp; /* list of all gc */ +GR_REGION *listregionp; /* list of all regions */ +GR_FONT *listfontp; /* list of all fonts */ +GR_IMAGE *listimagep; /* list of all images */ +GR_CURSOR *listcursorp; /* list of all cursors */ +GR_CURSOR *stdcursor; /* root window cursor */ +GR_GC *curgcp; /* currently enabled gc */ +GR_WINDOW *clipwp; /* window clipping is set for */ +GR_WINDOW *focuswp; /* focus window for keyboard */ +GR_WINDOW *mousewp; /* window mouse is currently in */ +GR_WINDOW *grabbuttonwp; /* window grabbed by button */ +GR_CURSOR *curcursor; /* currently enabled cursor */ +GR_COORD cursorx; /* current x position of cursor */ +GR_COORD cursory; /* current y position of cursor */ +int curbuttons; /* current state of buttons */ +GR_CLIENT *curclient; /* client currently executing for */ +GR_EVENT_LIST *eventfree; /* list of free events */ +GR_BOOL focusfixed; /* TRUE if focus is fixed on a window */ +PMWFONT stdfont; /* default font*/ +int escape_quits = 1; /* terminate when pressing ESC */ +char *progname; /* Name of this program.. */ + +int current_fd; /* the fd of the client talking to */ +int connectcount = 0; /* number of connections to server */ +GR_CLIENT *root_client; /* root entry of the client table */ +GR_CLIENT *current_client; /* the client we are currently talking*/ +char *current_shm_cmds; +int current_shm_cmds_size; +int keyb_fd; /* the keyboard file descriptor */ +int mouse_fd; /* the mouse file descriptor */ +char *curfunc; /* the name of the current server func*/ +GR_TIMEOUT screensaver_delay; /* time before screensaver activates */ +GR_BOOL screensaver_active; /* time before screensaver activates */ +GR_SELECTIONOWNER selection_owner; /* the selection owner and typelist */ +GR_TIMEOUT startTicks; /* ms time server started*/ +int autoportrait = FALSE; /* auto portrait mode switching*/ + +GR_TIMER_ID cache_timer_id; /* cached timer ID */ +GR_TIMER *cache_timer; /* cached timer */ +GR_TIMER *list_timer; /* list of all timers */ + +static int persistent_mode = 0; +static int portraitmode = MWPORTRAIT_NONE; + +#if !NONETWORK +int un_sock; /* the server socket descriptor */ + +static void +usage(void) +{ + fprintf(stderr,"Usage: %s [-e] [-p] [-N] [-c ...]\n", + progname); + exit(1); +} + +/* + * This is the main server loop which initialises the server, services + * the clients, and shuts the server down when there are no more clients. + */ +#ifdef __ECOS +int +nanox_main(int argc, char *argv[]) +#else +int +main(int argc, char *argv[]) +#endif +{ + int t; + int read_configfile(char *file); + + progname = argv[0]; + + t = 1; + while ( t < argc ) { + if ( !strcmp("-e",argv[t])) { + escape_quits = 0; + t++; + continue; + } + if ( !strcmp("-p",argv[t]) ) { + persistent_mode = 1; + t++; + continue; + } + if ( !strcmp("-A",argv[t]) ) { + autoportrait = TRUE; + t++; + continue; + } + if ( !strcmp("-N",argv[t]) ) { + portraitmode = MWPORTRAIT_NONE; + t++; + continue; + } + if ( !strcmp("-L",argv[t]) ) { + portraitmode = MWPORTRAIT_LEFT; + t++; + continue; + } + if ( !strcmp("-R",argv[t]) ) { + portraitmode = MWPORTRAIT_RIGHT; + t++; + continue; + } + if ( !strcmp("-D",argv[t]) ) { + portraitmode = MWPORTRAIT_DOWN; + t++; + continue; + } +#if FONTMAPPER + if ( !strcmp("-c",argv[t]) ) { + if ( t+1 >= argc ) + usage(); + read_configfile(argv[t+1]); + t += 2; + continue; + } +#endif + usage(); + } + + /* Attempt to initialise the server*/ + if(GsInitialize() < 0) + exit(1); + + while(1) + GsSelect(0L); + return 0; +} +#endif + +void +GsAcceptClientFd(int i) +{ + GR_CLIENT *client, *cl; + + if(!(client = malloc(sizeof(GR_CLIENT)))) { + close(i); + return; + } + + client->id = i; + client->eventhead = NULL; + client->eventtail = NULL; + /*client->errorevent.type = GR_EVENT_TYPE_NONE;*/ + client->next = NULL; + client->prev = NULL; + client->waiting_for_event = FALSE; + client->shm_cmds = 0; + + if(connectcount++ == 0) + root_client = client; + else { + cl = root_client; + while(cl->next) + cl = cl->next; + client->prev = cl; + cl->next = client; + } +} + +/* + * Open a connection from a new client to the server. + * Returns -1 on failure. + */ +int +GrOpen(void) +{ +#if NONETWORK + escape_quits = 1; + + /* Client calls this routine once. We + * init everything here + */ + if (connectcount <= 0) { + if(GsInitialize() < 0) + return -1; + GsAcceptClientFd(999); + curclient = root_client; + } +#endif + return 1; +} + +/* + * Close the current connection to the server. + */ +void +GrClose(void) +{ + GsClose(current_fd); +} + +/* + * Drop a specific server connection. + */ +void +GsClose(int fd) +{ + GsDropClient(fd); + if(!persistent_mode && connectcount == 0) + GsTerminate(); +} + +#if NONETWORK +/* client/server GsDropClient is in srvnet.c*/ +void +GsDropClient(int fd) +{ + --connectcount; +} +#endif + +#if UNIX | DOS_DJGPP +#if NONETWORK && defined(HAVESELECT) +/* + * Register the specified file descriptor to return an event + * when input is ready. + */ + +static int regfdmax = -1; +static fd_set regfdset; + +void +GrRegisterInput(int fd) +{ + FD_SET(fd, ®fdset); + if (fd > regfdmax) regfdmax = fd + 1; +} + +void +GrUnregisterInput(int fd) +{ + int i, max; + + /* unregister all inputs if the FD is -1 */ + if (fd == -1) { + FD_ZERO(®fdset); + regfdmax = -1; + return; + } + + FD_CLR(fd, ®fdset); + /* recalculate the max file descriptor */ + for (i = 0, max = regfdmax, regfdmax = -1; i < max; i++) + if (FD_ISSET(i, ®fdset)) + regfdmax = i + 1; +} + +#endif /* NONETWORK && HAVESELECT */ +#endif /* UNIX | DOS_DJGPP*/ + +/* + * This function suspends execution of the program for the specified + * number of milliseconds. + */ +void +GrDelay(GR_TIMEOUT msecs) +{ +#if UNIX + struct timeval timeval; + + timeval.tv_sec = msecs / 1000; + timeval.tv_usec = msecs % 1000; + select(0, NULL, NULL, NULL, &timeval); +#endif +} + +#if NONETWORK +void +GrFlush(void) +{ +} + +void +GrMainLoop(GR_FNCALLBACKEVENT fncb) +{ + GR_EVENT event; + + for(;;) { + GrGetNextEvent(&event); + fncb(&event); + } +} + +void +GrReqShmCmds(long shmsize) +{ + /* no action required, no client/server*/ +} +#endif + + +#if VXWORKS + +#define POLLTIME 100 /* polling sleep interval (in msec) */ +#define MAX_MOUSEEVENTS 10 /* max number of mouse event to get in 1 select */ +#define MAX_KEYBDEVENTS 10 /* max number of mouse event to get in 1 select */ + +extern void GdSleep(int dwMilliseconds); + +void +GsSelect(GR_TIMEOUT timeout) +{ + int mouseevents = 0; + int keybdevents = 0; + GR_TIMEOUT waittime = 0; + GR_EVENT_GENERAL *gp; + + + /* input gathering loop */ + while (1) + { + + /* perform pre-select duties, if any */ + if(scrdev.PreSelect) + { + scrdev.PreSelect(&scrdev); + } + + + /* If mouse data present, service it */ + while (mousedev.Poll() > 0) + { + GsCheckMouseEvent(); + if (mouseevents++ > MAX_MOUSEEVENTS) + { + /* don't handle too many events at one shot */ + break; + } + } + + + /* If keyboard data present, service it */ + while (kbddev.Poll() > 0) + { + GsCheckKeyboardEvent(); + if (keybdevents++ > MAX_KEYBDEVENTS) + { + /* don't handle too many events at one shot */ + break; + } + } + + + /* did we process any input yet? */ + if ((mouseevents > 0) || (keybdevents > 0)) + { + /* yep -- return without sleeping */ + return; + } + + + /* give up time-slice & sleep for a bit */ + GdSleep(POLLTIME); + waittime += POLLTIME; + + + /* have we timed out? */ + if (waittime >= timeout) + { + /* special case: polling when timeout == 0 -- don't send timeout event */ + if (timeout != 0) + { + /* Timeout has occured. + ** Currently return a timeout event regardless of whether client + ** has selected for it. + */ + if ((gp = (GR_EVENT_GENERAL *)GsAllocEvent(curclient)) != NULL) + { + gp->type = GR_EVENT_TYPE_TIMEOUT; + } + } + return; + } + } + +} + +#elif MSDOS | _MINIX + +void +GsSelect(GR_TIMEOUT timeout) +{ + /* If mouse data present, service it*/ + if(mousedev.Poll()) + while(GsCheckMouseEvent()) + continue; + + /* If keyboard data present, service it*/ + if(kbddev.Poll()) + while(GsCheckKeyboardEvent()) + continue; + +} + +#elif defined(__ECOS) && defined(CYGPKG_HAL_I386_PCMB) + +// For eCos on PC, use polling for the mouse and keyboard. Also +// use select() with a short timeout for communication. +// +// This needs fixing up later. +void +GsSelect(GR_TIMEOUT timeout) +{ + fd_set rfds; + int setsize = 0; + struct timeval tout; + int real_timeout; + int e; + + /* If mouse data present, service it*/ + if(mousedev.Poll()) + while(GsCheckMouseEvent()) + continue; + + /* If keyboard data present, service it*/ + if(kbddev.Poll()) + while(GsCheckKeyboardEvent()) + continue; + + FD_ZERO(&rfds); + /* perform pre-select duties, if any*/ + if(rootwp->psd->PreSelect) + rootwp->psd->PreSelect(rootwp->psd); + + /* handle client socket connections*/ + FD_SET(un_sock, &rfds); + if (un_sock > setsize) setsize = un_sock; + curclient = root_client; + while(curclient) { + if(curclient->waiting_for_event && curclient->eventhead) { + curclient->waiting_for_event = FALSE; + GrGetNextEventWrapperFinish(curclient->id); + return; + } + FD_SET(curclient->id, &rfds); + if(curclient->id > setsize) setsize = curclient->id; + curclient = curclient->next; + } + + /* Set up the timeout for the main select(): */ + if(GdGetNextTimeout(&tout, timeout) == TRUE) { + if ((tout.tv_sec > 0) || (tout.tv_usec > 20000)) { + tout.tv_sec = 0; + tout.tv_usec = 20000; + real_timeout = 0; + } else { + real_timeout = 1; + } + } else { + tout.tv_sec = 0; + tout.tv_usec = 20000; + real_timeout = 0; + } + + /* Wait for some input on any of the fds in the set or a timeout: */ + if((e = select(setsize+1, &rfds, NULL, NULL, &tout)) > 0) { + /* If a client is trying to connect, accept it: */ + if(FD_ISSET(un_sock, &rfds)) + GsAcceptClient(); + + /* If a client is sending us a command, handle it: */ + curclient = root_client; + while(curclient) { + GR_CLIENT *curclient_next; + + /* curclient may be freed in GsDropClient*/ + curclient_next = curclient->next; + if(FD_ISSET(curclient->id, &rfds)) + GsHandleClient(curclient->id); + curclient = curclient_next; + } + } + else if (e == 0) { + if (real_timeout) { + GdTimeout(); + } + } else + if(errno != EINTR) + EPRINTF("Select() call in main failed\n"); +} + +#elif UNIX && defined(HAVESELECT) + +void +GsSelect(GR_TIMEOUT timeout) +{ + fd_set rfds; + int e; + int setsize = 0; + struct timeval tout, *to; +#if NONETWORK + int fd; +#endif + + /* perform pre-select duties, if any*/ + if(rootwp->psd->PreSelect) + rootwp->psd->PreSelect(rootwp->psd); + + /* Set up the FDs for use in the main select(): */ + FD_ZERO(&rfds); + if(mouse_fd >= 0) { + FD_SET(mouse_fd, &rfds); + if (mouse_fd > setsize) + setsize = mouse_fd; + } + if(keyb_fd >= 0) { + FD_SET(keyb_fd, &rfds); + if (keyb_fd > setsize) + setsize = keyb_fd; + } +#if NONETWORK + /* handle registered input file descriptors*/ + for (fd = 0; fd < regfdmax; fd++) { + if (!FD_ISSET(fd, ®fdset)) + continue; + + FD_SET(fd, &rfds); + if (fd > setsize) setsize = fd; + } +#else /* not NONETWORK */ + /* handle client socket connections*/ + FD_SET(un_sock, &rfds); + if (un_sock > setsize) setsize = un_sock; + curclient = root_client; + while(curclient) { + if(curclient->waiting_for_event && curclient->eventhead) { + curclient->waiting_for_event = FALSE; + GrGetNextEventWrapperFinish(curclient->id); + return; + } + FD_SET(curclient->id, &rfds); + if(curclient->id > setsize) setsize = curclient->id; + curclient = curclient->next; + } +#endif /* NONETWORK */ + /* Set up the timeout for the main select(): */ + if(GdGetNextTimeout(&tout, timeout) == TRUE) + to = &tout; + else to = NULL; + + /* Wait for some input on any of the fds in the set or a timeout: */ + if((e = select(setsize+1, &rfds, NULL, NULL, to)) > 0) { + /* If data is present on the mouse fd, service it: */ + if(mouse_fd >= 0 && FD_ISSET(mouse_fd, &rfds)) + while(GsCheckMouseEvent()) + continue; + + /* If data is present on the keyboard fd, service it: */ + if(keyb_fd >= 0 && FD_ISSET(keyb_fd, &rfds)) + while(GsCheckKeyboardEvent()) + continue; + +#if NONETWORK + /* check for input on registered file descriptors */ + for (fd = 0; fd < regfdmax; fd++) { + GR_EVENT_FDINPUT * gp; + + if (!FD_ISSET(fd, ®fdset) || !FD_ISSET(fd, &rfds)) + continue; + + gp =(GR_EVENT_FDINPUT *)GsAllocEvent(curclient); + if(gp) { + gp->type = GR_EVENT_TYPE_FDINPUT; + gp->fd = fd; + } + } +#else /* not NONETWORK */ + + /* If a client is trying to connect, accept it: */ + if(FD_ISSET(un_sock, &rfds)) + GsAcceptClient(); + + /* If a client is sending us a command, handle it: */ + curclient = root_client; + while(curclient) { + GR_CLIENT *curclient_next; + + /* curclient may be freed in GsDropClient*/ + curclient_next = curclient->next; + if(FD_ISSET(curclient->id, &rfds)) + GsHandleClient(curclient->id); + curclient = curclient_next; + } +#endif /* NONETWORK */ + } + else if (e == 0) { +#if NONETWORK + /* + * Timeout has occured. Currently return + * a timeout event regardless of whether + * client has selected for it. + */ + if(GdTimeout() == TRUE) { + GR_EVENT_GENERAL * gp; + gp = (GR_EVENT_GENERAL *)GsAllocEvent(curclient); + if(gp) + gp->type = GR_EVENT_TYPE_TIMEOUT; + } +#else /* not NONETWORK */ + GdTimeout(); +#endif /* NONETWORK */ + } else + if(errno != EINTR) + EPRINTF("Select() call in main failed\n"); +} +#endif /* UNIX && defined(HAVESELECT)*/ + +#if VTSWITCH +static void +CheckVtChange(void *arg) +{ + if(MwCheckVtChange()) + GsRedrawScreen(); + GdAddTimer(50, CheckVtChange, NULL); +} +#endif + +/* + * Initialize the graphics and mouse devices at startup. + * Returns nonzero with a message printed if the initialization failed. + */ +int +GsInitialize(void) +{ + GR_WINDOW *wp; /* root window */ + PSD psd; + GR_CURSOR_ID cid; + static MWIMAGEBITS cursorbits[16] = { + 0xe000, 0x9800, 0x8600, 0x4180, + 0x4060, 0x2018, 0x2004, 0x107c, + 0x1020, 0x0910, 0x0988, 0x0544, + 0x0522, 0x0211, 0x000a, 0x0004 + }; + static MWIMAGEBITS cursormask[16] = { + 0xe000, 0xf800, 0xfe00, 0x7f80, + 0x7fe0, 0x3ff8, 0x3ffc, 0x1ffc, + 0x1fe0, 0x0ff0, 0x0ff8, 0x077c, + 0x073e, 0x021f, 0x000e, 0x0004 + }; + + wp = (GR_WINDOW *) malloc(sizeof(GR_WINDOW)); + if (wp == NULL) { + EPRINTF("Cannot allocate root window\n"); + return -1; + } + + startTicks = GsGetTickCount(); + + /* catch terminate signal to restore tty state*/ + signal(SIGTERM, (void *)GsTerminate); + + screensaver_delay = 0; + screensaver_active = GR_FALSE; + + selection_owner.wid = 0; + selection_owner.typelist = NULL; + +#if !NONETWORK + /* ignore pipe signal, sent when clients exit*/ + signal(SIGPIPE, SIG_IGN); + signal(SIGHUP, SIG_IGN); + + if (GsOpenSocket() < 0) { + EPRINTF("Cannot bind to named socket\n"); + free(wp); + return -1; + } +#endif + + if ((keyb_fd = GdOpenKeyboard()) == -1) { + EPRINTF("Cannot initialise keyboard\n"); + /*GsCloseSocket();*/ + free(wp); + return -1; + } + + if ((psd = GdOpenScreen()) == NULL) { + EPRINTF("Cannot initialise screen\n"); + /*GsCloseSocket();*/ + GdCloseKeyboard(); + free(wp); + return -1; + } + GdSetPortraitMode(psd, portraitmode); + + if ((mouse_fd = GdOpenMouse()) == -1) { + EPRINTF("Cannot initialise mouse\n"); + /*GsCloseSocket();*/ + GdCloseScreen(psd); + GdCloseKeyboard(); + free(wp); + return -1; + } + + /* + * Create std font. + */ +#if (HAVE_BIG5_SUPPORT | HAVE_GB2312_SUPPORT) + /* system fixed font looks better when mixed with chinese fonts*/ + stdfont = GdCreateFont(psd, MWFONT_SYSTEM_FIXED, 0, NULL); +#else + stdfont = GdCreateFont(psd, MWFONT_SYSTEM_VAR, 0, NULL); +#endif + + /* + * Initialize the root window. + */ + wp->psd = psd; + wp->id = GR_ROOT_WINDOW_ID; + wp->parent = NULL; /* changed: was = NULL*/ + wp->owner = NULL; + wp->children = NULL; + wp->siblings = NULL; + wp->next = NULL; + wp->x = 0; + wp->y = 0; + wp->width = psd->xvirtres; + wp->height = psd->yvirtres; + wp->bordersize = 0; + wp->background = BLACK; + wp->bordercolor = BLACK; + wp->nopropmask = 0; + wp->bgpixmap = NULL; + wp->bgpixmapflags = GR_BACKGROUND_TILE; + wp->eventclients = NULL; + wp->cursorid = 0; + wp->mapped = GR_TRUE; + wp->unmapcount = 0; + wp->output = GR_TRUE; + wp->props = 0; + wp->title = NULL; + + listpp = NULL; + listwp = wp; + rootwp = wp; + focuswp = wp; + mousewp = wp; + focusfixed = GR_FALSE; + + /* + * Initialize and position the default cursor. + */ + curcursor = NULL; + cursorx = -1; + cursory = -1; + GdShowCursor(psd); + GrMoveCursor(psd->xvirtres / 2, psd->yvirtres / 2); + cid = GrNewCursor(16, 16, 0, 0, WHITE, BLACK, cursorbits, cursormask); + GrSetWindowCursor(GR_ROOT_WINDOW_ID, cid); + stdcursor = GsFindCursor(cid); + +#if VTSWITCH + MwInitVt(); + /* Check for VT change every 50 ms: */ + GdAddTimer(50, CheckVtChange, NULL); +#endif + psd->FillRect(psd, 0, 0, psd->xvirtres-1, psd->yvirtres-1, + GdFindColor(BLACK)); + + /* + * Tell the mouse driver some things. + */ + curbuttons = 0; + GdRestrictMouse(0, 0, psd->xvirtres - 1, psd->yvirtres - 1); + GdMoveMouse(psd->xvirtres / 2, psd->yvirtres / 2); + + /* Force root window screen paint*/ + GsRedrawScreen(); + + /* + * Force the cursor to appear on the screen at startup. + * (not required with above GsRedrawScreen) + GdHideCursor(psd); + GdShowCursor(psd); + */ + + /* + * All done. + */ + connectcount = 0; + return 0; +} + +/* + * Here to close down the server. + */ +void +GsTerminate(void) +{ +#if !NONETWORK + GsCloseSocket(); +#endif + GdCloseScreen(rootwp->psd); + GdCloseMouse(); + GdCloseKeyboard(); +#if VTSWITCH + MwRedrawVt(mwvterm); +#endif + exit(0); +} + +/* + * Return # milliseconds elapsed since start of Microwindows + * Granularity is 25 msec + */ +GR_TIMEOUT +GsGetTickCount(void) +{ +#if MSDOS +#include + return (DWORD)(clock() * 1000 / CLOCKS_PER_SEC); +#else +#if _MINIX + struct tms t; + + return (DWORD)times(&t) * 16; +#else +#if UNIX + struct timeval t; + + gettimeofday(&t, NULL); + return ((t.tv_sec * 1000) + (t.tv_usec / 25000) * 25) - startTicks; +#else + return 0L; +#endif +#endif +#endif +} + +void +GrBell(void) +{ + write(2, "\7", 1); +} diff --git a/packages/services/gfx/mw/current/src/nanox/srvnet.c b/packages/services/gfx/mw/current/src/nanox/srvnet.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/srvnet.c @@ -0,0 +1,1911 @@ +/* + * Copyright (c) 1999-2001 Greg Haerr + * Copyright (c) 1999 Alex Holden + * Copyright (c) 2000 Vidar Hokstad + * Copyright (c) 2000 Morten Rolland + * Portions Copyright (c) 1991 David I. Bell + * + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * Completely rewritten for speed by Greg Haerr + * + * This is the server side of the network interface, which accepts + * connections from clients, receives functions from them, and dispatches + * events to them. + */ +#include +#include +#include +#include +#include +#include +#include +#if HAVE_SHAREDMEM_SUPPORT +#include +#include +#include +#endif +#if ELKS +#include +#elif __ECOS +#include + +#else +#include +#endif +#include "serv.h" +#include "nxproto.h" + +/* fix bad MIPS sys headers...*/ +#ifndef SOCK_STREAM +#define SOCK_STREAM 2 /* */ +#endif + +extern int un_sock; +extern GR_CLIENT *root_client; +extern int current_fd; + +static int GsWriteType(int,short); + +/* + * Wrapper functions called after full packet read + */ +static void +GrOpenWrapper(void *r) +{ + nxOpenReq *req = r; + + /* store process id of client*/ + curclient->processid = req->pid; + + GrOpen(); +} + +static void +GrCloseWrapper(void *r) +{ + GrClose(); +} + +static void +GrGetScreenInfoWrapper(void *r) +{ + GR_SCREEN_INFO si; + + GrGetScreenInfo(&si); + GsWriteType(current_fd,GrNumGetScreenInfo); + GsWrite(current_fd, &si, sizeof(si)); +} + +static void +GrGetSysColorWrapper(void *r) +{ + nxGetSysColorReq *req = r; + GR_COLOR color = GrGetSysColor(req->index); + + GsWriteType(current_fd, GrNumGetSysColor); + GsWrite(current_fd, &color, sizeof(color)); +} + +static void +GrNewWindowWrapper(void *r) +{ + nxNewWindowReq *req = r; + GR_WINDOW_ID wid; + + wid = GrNewWindow(req->parentid, req->x, req->y, req->width, + req->height, req->bordersize, req->backgroundcolor, + req->bordercolor); + + GsWriteType(current_fd,GrNumNewWindow); + GsWrite(current_fd, &wid, sizeof(wid)); +} + + +static void +GrNewPixmapWrapper(void *r) +{ + nxNewPixmapReq *req = r; + GR_WINDOW_ID wid; + + /* FIXME: Add support for passing info about shared memory + * segment + */ + wid = GrNewPixmap(req->width, req->height, 0); + + GsWriteType(current_fd,GrNumNewPixmap); + GsWrite(current_fd, &wid, sizeof(wid)); +} + +static void +GrNewInputWindowWrapper(void *r) +{ + nxNewInputWindowReq *req = r; + GR_WINDOW_ID wid; + + wid = GrNewInputWindow(req->parentid, req->x, req->y, req->width, + req->height); + GsWriteType(current_fd,GrNumNewInputWindow); + GsWrite(current_fd, &wid, sizeof(wid)); +} + +static void +GrDestroyWindowWrapper(void *r) +{ + nxDestroyWindowReq *req = r; + + GrDestroyWindow(req->windowid); +} + +static void +GrNewGCWrapper(void *r) +{ + GR_GC_ID gc = GrNewGC(); + + GsWriteType(current_fd,GrNumNewGC); + GsWrite(current_fd, &gc, sizeof(gc)); +} + +static void +GrCopyGCWrapper(void *r) +{ + nxCopyGCReq *req = r; + GR_GC_ID gcnew; + + gcnew = GrCopyGC(req->gcid); + GsWriteType(current_fd,GrNumCopyGC); + GsWrite(current_fd, &gcnew, sizeof(gcnew)); +} + +static void +GrGetGCInfoWrapper(void *r) +{ + nxGetGCInfoReq *req = r; + GR_GC_INFO gcinfo; + + GrGetGCInfo(req->gcid, &gcinfo); + GsWriteType(current_fd,GrNumGetGCInfo); + GsWrite(current_fd, &gcinfo, sizeof(gcinfo)); +} + +static void +GrDestroyGCWrapper(void *r) +{ + nxDestroyGCReq *req = r; + + GrDestroyGC(req->gcid); +} + +static void +GrNewRegionWrapper(void *r) +{ + GR_REGION_ID region = GrNewRegion(); + + GsWriteType(current_fd, GrNumNewRegion); + GsWrite(current_fd, ®ion, sizeof(region)); +} + +static void +GrDestroyRegionWrapper(void *r) +{ + nxDestroyRegionReq *req = r; + + GrDestroyRegion(req->regionid); +} + +static void +GrIntersectRegionWrapper(void *r) +{ + nxIntersectRegionReq *req = r; + + GrIntersectRegion(req->regionid, req->srcregionid1, + req->srcregionid2); +} + +static void +GrUnionRectWithRegionWrapper(void *r) +{ + nxUnionRectWithRegionReq *req = r; + + GrUnionRectWithRegion(req->regionid, &(req->rect)); +} + +static void +GrUnionRegionWrapper(void *r) +{ + nxUnionRegionReq *req = r; + + GrUnionRegion(req->regionid, req->srcregionid1, req->srcregionid2); +} + +static void +GrSubtractRegionWrapper(void *r) +{ + nxSubtractRegionReq *req = r; + + GrSubtractRegion(req->regionid, req->srcregionid1, req->srcregionid2); +} + +static void +GrXorRegionWrapper(void *r) +{ + nxXorRegionReq *req = r; + + GrXorRegion(req->regionid, req->srcregionid1, req->srcregionid2); +} + +static void +GrPointInRegionWrapper(void *r) +{ + nxPointInRegionReq *req = r; + GR_BOOL ret_value = GrPointInRegion(req->regionid, req->x, req->y); + + GsWriteType(current_fd, GrNumPointInRegion); + GsWrite(current_fd, &ret_value, sizeof(ret_value)); +} + +static void +GrRectInRegionWrapper(void *r) +{ + nxRectInRegionReq *req = r; + unsigned short ret_value; + + ret_value = (unsigned short)GrRectInRegion(req->regionid, + req->x, req->y, req->w, req->h); + + GsWriteType(current_fd, GrNumRectInRegion); + GsWrite(current_fd, &ret_value, sizeof(ret_value)); +} + +static void +GrEmptyRegionWrapper(void *r) +{ + nxEmptyRegionReq *req = r; + GR_BOOL ret_value; + + ret_value = GrEmptyRegion(req->regionid); + GsWriteType(current_fd, GrNumEmptyRegion); + GsWrite(current_fd, &ret_value, sizeof(ret_value)); +} + +static void +GrEqualRegionWrapper(void *r) +{ + nxEqualRegionReq *req = r; + GR_BOOL ret_value; + + ret_value = GrEqualRegion(req->region1, req->region2); + GsWriteType(current_fd, GrNumEqualRegion); + GsWrite(current_fd, &ret_value, sizeof(ret_value)); +} + +static void +GrOffsetRegionWrapper(void *r) +{ + nxOffsetRegionReq *req = r; + + GrOffsetRegion(req->region, req->dx, req->dy); +} + +static void +GrSetGCRegionWrapper(void *r) +{ + nxSetGCRegionReq *req = r; + + GrSetGCRegion(req->gcid, req->regionid); +} + +static void +GrSetGCClipOriginWrapper(void *r) +{ + nxSetGCClipOriginReq *req = r; + GrSetGCClipOrigin(req->gcid, req->xoff, req->yoff); +} + +static void +GrGetRegionBoxWrapper(void *r) +{ + nxRectInRegionReq *req = r; + GR_BOOL ret_value; + GR_RECT ret_rect; + + ret_value = GrGetRegionBox(req->regionid, &ret_rect); + + GsWriteType(current_fd, GrNumGetRegionBox); + GsWrite(current_fd, &ret_rect, sizeof(ret_rect)); + GsWriteType(current_fd, GrNumGetRegionBox); + GsWrite(current_fd, &ret_value, sizeof(ret_value)); +} + +static void +GrNewPolygonRegionWrapper(void *r) +{ + GR_REGION_ID region; + nxNewPolygonRegionReq *req = r; + int count; + + /* FIXME: unportable method, depends on sizeof(int) in GR_POINT*/ + count = GetReqVarLen(req) / sizeof(GR_POINT); + region = GrNewPolygonRegion(req->mode, count, + (GR_POINT *)GetReqData(req)); + + GsWriteType(current_fd, GrNumNewPolygonRegion); + GsWrite(current_fd, ®ion, sizeof(region)); +} + +static void +GrMapWindowWrapper(void *r) +{ + nxMapWindowReq *req = r; + + GrMapWindow(req->windowid); +} + +static void +GrUnmapWindowWrapper(void *r) +{ + nxUnmapWindowReq *req = r; + + GrUnmapWindow(req->windowid); +} + +static void +GrRaiseWindowWrapper(void *r) +{ + nxRaiseWindowReq *req = r; + + GrRaiseWindow(req->windowid); +} + +static void +GrLowerWindowWrapper(void *r) +{ + nxLowerWindowReq *req = r; + + GrLowerWindow(req->windowid); +} + +static void +GrMoveWindowWrapper(void *r) +{ + nxMoveWindowReq *req = r; + + GrMoveWindow(req->windowid, req->x, req->y); +} + +static void +GrResizeWindowWrapper(void *r) +{ + nxResizeWindowReq *req = r; + + GrResizeWindow(req->windowid, req->width, req->height); +} + +static void +GrReparentWindowWrapper(void *r) +{ + nxReparentWindowReq *req = r; + + GrReparentWindow(req->windowid, req->parentid, req->x, req->y); +} + +static void +GrGetWindowInfoWrapper(void *r) +{ + nxGetWindowInfoReq *req = r; + GR_WINDOW_INFO wi; + + GrGetWindowInfo(req->windowid, &wi); + GsWriteType(current_fd,GrNumGetWindowInfo); + GsWrite(current_fd, &wi, sizeof(wi)); +} + +static void +GrGetFontInfoWrapper(void *r) +{ + nxGetFontInfoReq *req = r; + GR_FONT_INFO fi; + + GrGetFontInfo(req->fontid, &fi); + GsWriteType(current_fd,GrNumGetFontInfo); + GsWrite(current_fd, &fi, sizeof(fi)); +} + +static void +GrGetFocusWrapper(void *r) +{ + GR_WINDOW_ID wid = GrGetFocus(); + + GsWriteType(current_fd, GrNumGetFocus); + GsWrite(current_fd, &wid, sizeof(wid)); +} + +static void +GrSetFocusWrapper(void *r) +{ + nxSetFocusReq *req = r; + + GrSetFocus(req->windowid); +} + +static void +GrSetWindowCursorWrapper(void *r) +{ + nxSetWindowCursorReq *req = r; + + GrSetWindowCursor(req->windowid, req->cursorid); +} + +static void +GrClearAreaWrapper(void *r) +{ + nxClearAreaReq *req = r; + + GrClearArea(req->windowid, req->x, req->y, req->width, + req->height, req->exposeflag); +} + +static void +GrSelectEventsWrapper(void *r) +{ + nxSelectEventsReq *req = r; + + GrSelectEvents(req->windowid, req->eventmask); +} + +static void +GrGetNextEventWrapper(void *r) +{ +#if 1 + /* tell main loop to call Finish routine on event*/ + curclient->waiting_for_event = TRUE; +#else + GR_EVENT evt; + + /* first check if any event ready*/ + GrCheckNextEvent(&evt); + if(evt.type == GR_EVENT_TYPE_NONE) { + /* tell main loop to call Finish routine on event*/ + curclient->waiting_for_event = TRUE; + return; + } + + GsWriteType(current_fd, GrNumGetNextEvent); + GsWrite(current_fd, &evt, sizeof(evt)); + if(evt.type == GR_EVENT_TYPE_CLIENT_DATA) { + GsWrite(fd, evt.data, evt.datalen); + free(evt.data); + } +#endif +} + +/* Complete the GrGetNextEvent call from client. + * The client is still waiting on a read at this point. + */ +void +GrGetNextEventWrapperFinish(int fd) +{ + GR_EVENT evt; + GR_EVENT_CLIENT_DATA *cde; + + /* get the event and pass it to client*/ + /* this will never be GR_EVENT_TYPE_NONE*/ + GrCheckNextEvent(&evt); + + GsWriteType(fd,GrNumGetNextEvent); + GsWrite(fd, &evt, sizeof(evt)); + if(evt.type == GR_EVENT_TYPE_CLIENT_DATA) { + cde = (GR_EVENT_CLIENT_DATA *)&evt; + if(cde->data) { + GsWrite(fd, cde->data, cde->datalen); + free(cde->data); + } cde->datalen = 0; + } +} + +static void +GrCheckNextEventWrapper(void *r) +{ + GR_EVENT evt; + GR_EVENT_CLIENT_DATA *cde; + + GrCheckNextEvent(&evt); + + GsWriteType(current_fd,GrNumGetNextEvent); + GsWrite(current_fd, &evt, sizeof(evt)); + if(evt.type == GR_EVENT_TYPE_CLIENT_DATA) { + cde = (GR_EVENT_CLIENT_DATA *)&evt; + if(cde->data) { + GsWrite(current_fd, cde->data, cde->datalen); + free(cde->data); + } cde->datalen = 0; + } +} + +static void +GrPeekEventWrapper(void *r) +{ + GR_EVENT evt; + GR_CHAR ret; + GR_EVENT_CLIENT_DATA *cde; + + ret = GrPeekEvent(&evt); + + GsWriteType(current_fd,GrNumPeekEvent); + GsWrite(current_fd, &evt, sizeof(evt)); + if(evt.type == GR_EVENT_TYPE_CLIENT_DATA) { + cde = (GR_EVENT_CLIENT_DATA *)&evt; + if(cde->data) { + GsWrite(current_fd, cde->data, cde->datalen); + free(cde->data); + } cde->datalen = 0; + } + GsWrite(current_fd, &ret, sizeof(GR_CHAR)); +} + +static void +GrLineWrapper(void *r) +{ + nxLineReq *req = r; + + GrLine(req->drawid, req->gcid, req->x1, req->y1, req->x2, req->y2); +} + +static void +GrPointWrapper(void *r) +{ + nxPointReq *req = r; + + GrPoint(req->drawid, req->gcid, req->x, req->y); + +} + +static void +GrPointsWrapper(void *r) +{ + nxPointsReq *req = r; + int count; + + count = GetReqVarLen(req) / sizeof(GR_POINT); + GrPoints(req->drawid, req->gcid, count, (GR_POINT *)GetReqData(req)); +} + +static void +GrRectWrapper(void *r) +{ + nxRectReq *req = r; + + GrRect(req->drawid, req->gcid, req->x, req->y, req->width, req->height); +} + +static void +GrFillRectWrapper(void *r) +{ + nxFillRectReq *req = r; + + GrFillRect(req->drawid, req->gcid, req->x, req->y, req->width, + req->height); +} + +static void +GrPolyWrapper(void *r) +{ + nxPolyReq *req = r; + int count; + + count = GetReqVarLen(req) / sizeof(GR_POINT); + GrPoly(req->drawid, req->gcid, count, (GR_POINT *)GetReqData(req)); +} + +/* FIXME: fails with pointtable size > 64k if sizeof(int) == 2*/ +static void +GrFillPolyWrapper(void *r) +{ + nxPolyReq *req = r; + int count; + + count = GetReqVarLen(req) / sizeof(GR_POINT); + GrFillPoly(req->drawid, req->gcid, count, (GR_POINT *)GetReqData(req)); +} + +static void +GrEllipseWrapper(void *r) +{ + nxEllipseReq *req = r; + + GrEllipse(req->drawid, req->gcid, req->x, req->y, req->rx, req->ry); +} + +static void +GrFillEllipseWrapper(void *r) +{ + nxFillEllipseReq *req = r; + + GrFillEllipse(req->drawid, req->gcid, req->x, req->y, req->rx, req->ry); +} + +static void +GrArcWrapper(void *r) +{ + nxArcReq *req = r; + + GrArc(req->drawid, req->gcid, req->x, req->y, req->rx, req->ry, + req->ax, req->ay, req->bx, req->by, req->type); +} + +static void +GrArcAngleWrapper(void *r) +{ + nxArcAngleReq *req = r; + + GrArcAngle(req->drawid, req->gcid, req->x, req->y, req->rx, req->ry, + req->angle1, req->angle2, req->type); +} + +static void +GrSetGCForegroundWrapper(void *r) +{ + nxSetGCForegroundReq *req = r; + + GrSetGCForeground(req->gcid, req->color); +} + +static void +GrSetGCBackgroundWrapper(void *r) +{ + nxSetGCBackgroundReq *req = r; + + GrSetGCBackground(req->gcid, req->color); +} + +static void +GrSetGCUseBackgroundWrapper(void *r) +{ + nxSetGCUseBackgroundReq *req = r; + + GrSetGCUseBackground(req->gcid, req->flag); +} + +static void +GrSetGCModeWrapper(void *r) +{ + nxSetGCModeReq *req = r; + + GrSetGCMode(req->gcid, req->mode); +} + +static void +GrCreateFontWrapper(void *r) +{ + nxCreateFontReq *req = r; + GR_FONT_ID fontid; + + if(req->lf_used) + fontid = GrCreateFont(NULL, 0, &req->lf); + else + fontid = GrCreateFont(req->lf.lfFaceName, req->height, NULL); + + GsWriteType(current_fd,GrNumCreateFont); + GsWrite(current_fd, &fontid, sizeof(fontid)); +} + +static void +GrSetFontSizeWrapper(void *r) +{ + nxSetFontSizeReq *req = r; + + GrSetFontSize(req->fontid, req->fontsize); +} + +static void +GrSetFontRotationWrapper(void *r) +{ + nxSetFontRotationReq *req = r; + + GrSetFontRotation(req->fontid, req->tenthdegrees); +} + +static void +GrSetFontAttrWrapper(void *r) +{ + nxSetFontAttrReq *req = r; + + GrSetFontAttr(req->fontid, req->setflags, req->clrflags); +} + +static void +GrDestroyFontWrapper(void *r) +{ + nxDestroyFontReq *req = r; + + GrDestroyFont(req->fontid); +} + +static void +GrSetGCFontWrapper(void *r) +{ + nxSetGCFontReq *req = r; + + GrSetGCFont(req->gcid, req->fontid); +} + +static void +GrGetGCTextSizeWrapper(void *r) +{ + nxGetGCTextSizeReq *req = r; + GR_SIZE retwidth, retheight, retbase; + + GrGetGCTextSize(req->gcid, GetReqData(req), GetReqVarLen(req), + req->flags, &retwidth, &retheight, &retbase); + + GsWriteType(current_fd,GrNumGetGCTextSize); + GsWrite(current_fd, &retwidth, sizeof(retwidth)); + GsWrite(current_fd, &retheight, sizeof(retheight)); + GsWrite(current_fd, &retbase, sizeof(retbase)); +} + +/* FIXME: fails with size > 64k if sizeof(int) == 2*/ +static void +GsReadAreaWrapper(void *r) +{ + nxReadAreaReq *req = r; + int size; + GR_PIXELVAL * area; + + /* FIXME: optimize for smaller pixelvals*/ + size = req->width * req->height * sizeof(GR_PIXELVAL); + + if(!(area = malloc(size))) { + /*GsPutCh(current_fd, GrRetENoMem);*/ /* FIXME*/ + /*return;*/ + } + + GrReadArea(req->drawid, req->x, req->y, req->width, req->height, area); + GsWriteType(current_fd,GrNumReadArea); + GsWrite(current_fd, area, size); + free(area); +} + +/* FIXME: fails with size > 64k if sizeof(int) == 2*/ +static void +GrAreaWrapper(void *r) +{ + nxAreaReq *req = r; + + GrArea(req->drawid, req->gcid, req->x, req->y, req->width, req->height, + GetReqData(req), req->pixtype); +} + +/* FIXME: fails with bitmapsize > 64k if sizeof(int) == 2*/ +static void +GrBitmapWrapper(void *r) +{ + nxBitmapReq *req = r; + + GrBitmap(req->drawid, req->gcid, req->x, req->y, req->width, + req->height, GetReqData(req)); +} + +static void +GrDrawImageBitsWrapper(void *r) +{ + nxDrawImageBitsReq *req = r; + char * addr; + int imagesize; + GR_IMAGE_HDR hdr; + + hdr.width = req->width; + hdr.height = req->height; + hdr.planes = req->planes; + hdr.bpp = req->bpp; + hdr.pitch = req->pitch; + hdr.bytesperpixel = req->bytesperpixel; + hdr.compression = req->compression; + hdr.palsize = req->palsize; + hdr.transcolor = req->transcolor; + addr = GetReqData(req); + hdr.imagebits = (MWUCHAR *)addr; + imagesize = hdr.pitch * hdr.height; + hdr.palette = (MWPALENTRY *)(addr + imagesize); + GrDrawImageBits(req->drawid, req->gcid, req->x, req->y, &hdr); +} + +static void +GrCopyAreaWrapper(void *r) +{ + nxCopyAreaReq *req = r; + + GrCopyArea(req->drawid, req->gcid, req->x, req->y, req->width, req->height, + req->srcid, req->srcx, req->srcy, req->op); +} + +static void +GrTextWrapper(void *r) +{ + nxTextReq *req = r; + + GrText(req->drawid, req->gcid, req->x, req->y, GetReqData(req), + req->count, req->flags); +} + +static void +GrNewCursorWrapper(void *r) +{ + nxNewCursorReq *req = r; + int varlen; + char * bitmap; + GR_CURSOR_ID cursorid; + + varlen = GetReqVarLen(req); + bitmap = GetReqData(req); + + cursorid = GrNewCursor(req->width, req->height, + req->hotx, req->hoty, req->fgcolor, req->bgcolor, + (GR_BITMAP *)bitmap, (GR_BITMAP *)(bitmap+varlen/2)); + + GsWriteType(current_fd, GrNumNewCursor); + GsWrite(current_fd, &cursorid, sizeof(cursorid)); +} + +static void +GrMoveCursorWrapper(void *r) +{ + nxMoveCursorReq *req = r; + + GrMoveCursor(req->x, req->y); +} + +static void +GrGetSystemPaletteWrapper(void *r) +{ + GR_PALETTE pal; + + GrGetSystemPalette(&pal); + GsWriteType(current_fd,GrNumGetSystemPalette); + GsWrite(current_fd, &pal, sizeof(pal)); +} + +static void +GrSetSystemPaletteWrapper(void *r) +{ + nxSetSystemPaletteReq *req = r; + GR_PALETTE pal; + + pal.count = req->count; + memcpy(pal.palette, req->palette, sizeof(pal.palette)); + GrSetSystemPalette(req->first, &pal); +} + +static void +GrFindColorWrapper(void *r) +{ + nxFindColorReq *req = r; + GR_PIXELVAL pixel; + + GrFindColor(req->color, &pixel); + GsWriteType(current_fd,GrNumFindColor); + GsWrite(current_fd, &pixel, sizeof(pixel)); +} + +static void +GrInjectEventWrapper(void *r) +{ + nxInjectEventReq *req = r; + + switch(req->event_type) { + case GR_INJECT_EVENT_POINTER: + GrInjectPointerEvent(req->event.pointer.x, + req->event.pointer.y, + req->event.pointer.button, + req->event.pointer.visible); + break; + + case GR_INJECT_EVENT_KEYBOARD: + GrInjectKeyboardEvent(req->event.keyboard.wid, + req->event.keyboard.keyvalue, + req->event.keyboard.modifier, + req->event.keyboard.scancode, + req->event.keyboard.pressed); + break; + } +} + +static void +GrSetWMPropertiesWrapper(void *r) +{ + nxSetWMPropertiesReq *req = r; + GR_WM_PROPERTIES *props = GetReqData(req); + + if(GetReqVarLen(req) - sizeof(GR_WM_PROPERTIES)) + props->title = (char *)props + sizeof(GR_WM_PROPERTIES); + else + props->title = NULL; + GrSetWMProperties(req->windowid, props); +} + +static void +GrGetWMPropertiesWrapper(void *r) +{ + nxGetWMPropertiesReq *req = r; + UINT16 textlen; + GR_WM_PROPERTIES props; + + GrGetWMProperties(req->windowid, &props); + + if(props.title) + textlen = strlen(props.title) + 1; + else textlen = 0; + + GsWriteType(current_fd,GrNumGetWMProperties); + GsWrite(current_fd, &props, sizeof(props)); + GsWrite(current_fd, &textlen, sizeof(textlen)); + if(textlen) + GsWrite(current_fd, props.title, textlen); +} + +static void +GrCloseWindowWrapper(void *r) +{ + nxCloseWindowReq *req = r; + + GrCloseWindow(req->windowid); +} + +static void +GrKillWindowWrapper(void *r) +{ + nxKillWindowReq *req = r; + + GrKillWindow(req->windowid); +} + +static void +GrDrawImageFromFileWrapper(void *r) +{ + nxDrawImageFromFileReq *req = r; + + GrDrawImageFromFile(req->drawid, req->gcid, req->x, req->y, req->width, + req->height, GetReqData(req), req->flags); +} + +static void +GrLoadImageFromFileWrapper(void *r) +{ + nxLoadImageFromFileReq *req = r; + GR_IMAGE_ID id; + + id = GrLoadImageFromFile(GetReqData(req), req->flags); + GsWriteType(current_fd, GrNumLoadImageFromFile); + GsWrite(current_fd, &id, sizeof(id)); +} + +static void +GrDrawImageToFitWrapper(void *r) +{ + nxDrawImageToFitReq *req = r; + + GrDrawImageToFit(req->drawid, req->gcid, req->x, req->y, req->width, + req->height, req->imageid); +} + +static void +GrFreeImageWrapper(void *r) +{ + nxFreeImageReq *req = r; + + GrFreeImage(req->id); +} + +static void +GrGetImageInfoWrapper(void *r) +{ + nxGetImageInfoReq *req = r; + GR_IMAGE_INFO info; + + GrGetImageInfo(req->id, &info); + GsWriteType(current_fd, GrNumGetImageInfo); + GsWrite(current_fd, &info, sizeof(info)); +} + +static void +GrSetScreenSaverTimeoutWrapper(void *r) +{ + nxSetScreenSaverTimeoutReq *req = r; + + GrSetScreenSaverTimeout(req->timeout); +} + +static void +GrSetSelectionOwnerWrapper(void *r) +{ + nxSetSelectionOwnerReq *req = r; + + GrSetSelectionOwner(req->wid, GetReqData(req)); +} + +static void +GrGetSelectionOwnerWrapper(void *r) +{ + GR_CHAR *typelist; + GR_WINDOW_ID wid; + unsigned short len; + + wid = GrGetSelectionOwner(&typelist); + GsWriteType(current_fd, GrNumGetSelectionOwner); + GsWrite(current_fd, &wid, sizeof(wid)); + + if(wid) { + len = strlen(typelist) + 1; + GsWrite(current_fd, &len, sizeof(len)); + GsWrite(current_fd, typelist, len); + } +} + +static void +GrRequestClientDataWrapper(void *r) +{ + nxRequestClientDataReq *req = r; + + GrRequestClientData(req->wid, req->rid, req->serial, req->mimetype); +} + +static void +GrSendClientDataWrapper(void *r) +{ + nxSendClientDataReq *req = r; + + GrSendClientData(req->wid, req->did, req->serial, req->len, + GetReqVarLen(req), GetReqData(req)); +} + +static void +GrBellWrapper(void *r) +{ + GrBell(); +} + +static void +GrSetBackgroundPixmapWrapper(void *r) +{ + nxSetBackgroundPixmapReq *req = r; + + GrSetBackgroundPixmap(req->wid, req->pixmap, req->flags); +} + +static void +GrDestroyCursorWrapper(void *r) +{ + nxDestroyCursorReq *req = r; + + GrDestroyCursor(req->cursorid); +} + +static void +GrQueryTreeWrapper(void *r) +{ + nxQueryTreeReq *req = r; + GR_WINDOW_ID parentid; + GR_WINDOW_ID * children; + GR_COUNT nchildren; + + GrQueryTree(req->windowid, &parentid, &children, &nchildren); + + GsWriteType(current_fd, GrNumQueryTree); + GsWrite(current_fd, &parentid, sizeof(parentid)); + GsWrite(current_fd, &nchildren, sizeof(nchildren)); + if (nchildren) { + GsWrite(current_fd, children, nchildren * sizeof(GR_WINDOW_ID)); + free(children); + } +} + +static void +GrCreateTimerWrapper(void *r) +{ + nxCreateTimerReq *req = r; + GR_TIMER_ID timerid; + + timerid = GrCreateTimer(req->wid, req->period); + + GsWriteType(current_fd, GrNumCreateTimer); + GsWrite(current_fd, &timerid, sizeof (timerid)); +} + +typedef struct image_list { + void *data; + int id; + int size; + int offset; + + struct image_list *next; +} imagelist_t; + +static imagelist_t *imageListHead = 0; +static imagelist_t *imageListTail = 0; +static int imageListId = 0; + +static void freeImageBuffer(imagelist_t *buffer) { + + imagelist_t *prev = 0; + imagelist_t *ptr = imageListHead; + + while(ptr) { + if (ptr == buffer) { + if (prev) + prev->next = buffer->next; + else + imageListHead = buffer->next; + + if (!imageListHead) imageListTail = 0; + + free(buffer->data); + free(buffer); + return; + } + + prev = ptr; + ptr = ptr->next; + } +} + +static void GrImageBufferAllocWrapper(void *r) { + nxImageBufferAllocReq *req = r; + + /* Add a new buffer to the end of the list */ + + if (!imageListTail) { + imageListHead = imageListTail = (imagelist_t *) malloc(sizeof(imagelist_t)); + } + else { + imageListTail->next = (imagelist_t *) malloc(sizeof(imagelist_t)); + imageListTail = imageListTail->next; + } + + imageListTail->id = ++imageListId; + imageListTail->data = (void *) malloc(req->size); + imageListTail->size = req->size; + imageListTail->offset = 0; + + imageListTail->next = 0; + + GsWriteType(current_fd,GrNumImageBufferAlloc); + GsWrite(current_fd, &imageListTail->id, sizeof(int)); +} + +static void GrImageBufferSendWrapper(void *r) { + + int csize = 0; + + imagelist_t *buffer = 0; + nxImageBufferSendReq *req = r; + + for(buffer = imageListHead; buffer; buffer = buffer->next) + if (buffer->id == req->buffer_id) break; + + if (!buffer) return; + + if (buffer->offset + req->size >= buffer->size) + csize = buffer->size - buffer->offset; + else + csize = req->size; + + if (!csize) return; + + memcpy((void *) (buffer->data + buffer->offset), + GetReqData(req), csize); + + buffer->offset += csize; +} + +void GrLoadImageFromBufferWrapper(void *r) { + + GR_IMAGE_ID id; + imagelist_t *buffer = 0; + + nxLoadImageFromBufferReq *req = r; + + for(buffer = imageListHead; buffer; buffer = buffer->next) + if (buffer->id == req->buffer) break; + + if (!buffer) return; + + id = GrLoadImageFromBuffer(buffer->data, buffer->size, req->flags); + + GsWriteType(current_fd, GrNumLoadImageFromBuffer); + GsWrite(current_fd, &id, sizeof(id)); + + freeImageBuffer(buffer); +} + +void GrDrawImageFromBufferWrapper(void *r) { + + imagelist_t *buffer = 0; + + nxDrawImageFromBufferReq *req = r; + + for(buffer = imageListHead; buffer; buffer = buffer->next) + if (buffer->id == req->buffer) break; + + if (!buffer) return; + + GrDrawImageFromBuffer(req->drawid, req->gcid, req->x, req->y, req->width, + req->height, buffer->data, buffer->size, + req->flags); + + freeImageBuffer(buffer); +} + + + +static void +GrDestroyTimerWrapper(void *r) +{ + nxDestroyTimerReq *req = r; + + GrDestroyTimer(req->timerid); +} + +static void +GrSetPortraitModeWrapper(void *r) +{ + nxSetPortraitModeReq *req = r; + + GrSetPortraitMode(req->portraitmode); +} + +/* + * This function makes the Nano-X server set up a shared memory segment + * that the client can use when feeding the Nano-X server with requests. + * There is a corresponding GrShmCmdsFlush function that will make the + * server execute the batched commands. + */ +#define SHMKEY_BASE 1000000 +#define SHMKEY_MAX 256 + +void +GrReqShmCmdsWrapper(void *r) +{ +#if HAVE_SHAREDMEM_SUPPORT + nxReqShmCmdsReq *req = r; + int key, shmid; + char *tmp; + + if ( curclient->shm_cmds != 0 ) + goto bad; + + for ( key=SHMKEY_BASE; key < SHMKEY_BASE+SHMKEY_MAX; key++ ) { + shmid = shmget(key,req->size,IPC_CREAT|IPC_EXCL|0666); + if ( shmid == -1 ) { + if ( errno != EEXIST ) + goto bad; + } else { + tmp = shmat(shmid,0,0); + if ( tmp == (char *)-1 ) + goto bad; + curclient->shm_cmds = tmp; + curclient->shm_cmds_shmid = shmid; + curclient->shm_cmds_size = req->size; + goto finish; + } + } + + bad: + key = 0; + + finish: + DPRINTF("Shm: Request key granted=%d\n",key); + GsWrite(current_fd, &key, sizeof(key)); +#else + /* return no shared memory support*/ + int key = 0; + GsWrite(current_fd, &key, sizeof(key)); +#endif /* HAVE_SHAREDMEM_SUPPORT*/ +} + +static void +GrGetFontListWrapper(void *r) +{ + MWFONTLIST **list; + int num; + int i, ttlen, mwlen; + + GrGetFontList(&list, &num); + + GsWriteType(current_fd, GrNumGetFontList); + + /* the number of strings comming in */ + GsWrite(current_fd, &num, sizeof(int)); + + if(num != -1) { + for(i = 0; i < num; i++) { + ttlen = strlen(list[i]->ttname) + 1; + mwlen = strlen(list[i]->mwname) + 1; + + GsWrite(current_fd, &ttlen, sizeof(int)); + GsWrite(current_fd, list[i]->ttname, ttlen * sizeof(char)); + + GsWrite(current_fd, &mwlen, sizeof(int)); + GsWrite(current_fd, list[i]->mwname, mwlen * sizeof(char)); + } + + GrFreeFontList(&list, num); + } +} + +void GrShmCmdsFlushWrapper(void *r); + +/* + * Handler functions, ordered by reqType + */ +struct GrFunction { + void (*func)(void *); + GR_FUNC_NAME name; +} GrFunctions[] = { + /* 0 */ {GrOpenWrapper, "GrOpen"}, + /* 1 */ {GrCloseWrapper, "GrClose"}, + /* 2 */ {GrGetScreenInfoWrapper, "GrGetScreenInfo"}, + /* 3 */ {GrNewWindowWrapper, "GrNewWindow"}, + /* 4 */ {GrNewInputWindowWrapper, "GrNewInputWindow"}, + /* 5 */ {GrDestroyWindowWrapper, "GrDestroyWindow"}, + /* 6 */ {GrNewGCWrapper, "GrNewGC"}, + /* 7 */ {GrCopyGCWrapper, "GrCopyGC"}, + /* 8 */ {GrGetGCInfoWrapper, "GrGetGCInfo"}, + /* 9 */ {GrDestroyGCWrapper, "GrDestroyGC"}, + /* 10 */ {GrMapWindowWrapper, "GrMapWindow"}, + /* 11 */ {GrUnmapWindowWrapper, "GrUnmapWindow"}, + /* 12 */ {GrRaiseWindowWrapper, "GrRaiseWindow"}, + /* 13 */ {GrLowerWindowWrapper, "GrLowerWindow"}, + /* 14 */ {GrMoveWindowWrapper, "GrMoveWindow"}, + /* 15 */ {GrResizeWindowWrapper, "GrResizeWindow"}, + /* 16 */ {GrGetWindowInfoWrapper, "GrGetWindowInfo"}, + /* 17 */ {GrGetFontInfoWrapper, "GrGetFontInfo"}, + /* 18 */ {GrSetFocusWrapper, "GrSetFocus"}, + /* 19 */ {GrSetWindowCursorWrapper, "GrSetWindowCursor"}, + /* 20 */ {GrClearAreaWrapper, "GrClearAreaWrapper"}, + /* 21 */ {GrSelectEventsWrapper, "GrSelectEvents"}, + /* 22 */ {GrGetNextEventWrapper, "GrGetNextEvent"}, + /* 23 */ {GrCheckNextEventWrapper, "GrCheckNextEvent"}, + /* 24 */ {GrPeekEventWrapper, "GrPeekEvent"}, + /* 25 */ {GrLineWrapper, "GrLine"}, + /* 26 */ {GrPointWrapper, "GrPoint"}, + /* 27 */ {GrRectWrapper, "GrRect"}, + /* 28 */ {GrFillRectWrapper, "GrFillRect"}, + /* 29 */ {GrPolyWrapper, "GrPoly"}, + /* 30 */ {GrFillPolyWrapper, "GrFillPoly"}, + /* 31 */ {GrEllipseWrapper, "GrEllipse"}, + /* 32 */ {GrFillEllipseWrapper, "GrFillEllipse"}, + /* 33 */ {GrSetGCForegroundWrapper, "GrSetGCForeground"}, + /* 34 */ {GrSetGCBackgroundWrapper, "GrSetGCBackGround"}, + /* 35 */ {GrSetGCUseBackgroundWrapper, "GrSetGCUseBackGround"}, + /* 36 */ {GrSetGCModeWrapper, "GrSetGCMode"}, + /* 37 */ {GrSetGCFontWrapper, "GrSetGCFont"}, + /* 38 */ {GrGetGCTextSizeWrapper, "GrGetGCTextSize"}, + /* 39 */ {GsReadAreaWrapper, "GsReadArea"}, + /* 40 */ {GrAreaWrapper, "GrArea"}, + /* 41 */ {GrBitmapWrapper, "GrBitmap"}, + /* 42 */ {GrTextWrapper, "GrText"}, + /* 43 */ {GrNewCursorWrapper, "GrNewCursor"}, + /* 44 */ {GrMoveCursorWrapper, "GrMoveCursor"}, + /* 45 */ {GrGetSystemPaletteWrapper, "GrGetSystemPalette"}, + /* 46 */ {GrFindColorWrapper, "GrFindColor"}, + /* 47 */ {GrReparentWindowWrapper, "GrReparentWindow"}, + /* 48 */ {GrDrawImageFromFileWrapper, "GrDrawImageFromFile"}, + /* 49 */ {GrLoadImageFromFileWrapper, "GrLoadImageFromFile"}, + /* 50 */ {GrNewPixmapWrapper, "GrNewPixmap"}, + /* 51 */ {GrCopyAreaWrapper, "GrCopyArea"}, + /* 52 */ {GrSetFontSizeWrapper, "GrSetFontSize"}, + /* 53 */ {GrCreateFontWrapper, "GrCreateFont"}, + /* 54 */ {GrDestroyFontWrapper, "GrDestroyFont"}, + /* 55 */ {GrReqShmCmdsWrapper, "GrReqShmCmds"}, + /* 56 */ {GrShmCmdsFlushWrapper, "GrShmCmdsFlush"}, + /* 57 */ {GrSetFontRotationWrapper, "GrSetFontRotation"}, + /* 58 */ {GrSetFontAttrWrapper, "GrSetFontAttr"}, + /* 59 */ {GrSetSystemPaletteWrapper, "GrSetSystemPalette"}, + /* 60 */ {GrInjectEventWrapper, "GrInjectEvent"}, + /* 61 */ {GrNewRegionWrapper, "GrNewRegion"}, + /* 62 */ {GrDestroyRegionWrapper, "GrDestroyRegion"}, + /* 63 */ {GrUnionRectWithRegionWrapper, "GrUnionRectWithRegion"}, + /* 64 */ {GrUnionRegionWrapper, "GrUnionRegion"}, + /* 65 */ {GrIntersectRegionWrapper, "GrIntersectRegion"}, + /* 66 */ {GrSetGCRegionWrapper, "GrSetGCRegion"}, + /* 67 */ {GrSubtractRegionWrapper, "GrSubtractRegion"}, + /* 68 */ {GrXorRegionWrapper, "GrXorRegion"}, + /* 69 */ {GrPointInRegionWrapper, "GrPointInRegion"}, + /* 70 */ {GrRectInRegionWrapper, "GrRectInRegion"}, + /* 71 */ {GrEmptyRegionWrapper, "GrEmptyRegion"}, + /* 72 */ {GrEqualRegionWrapper, "GrEqualRegion"}, + /* 73 */ {GrOffsetRegionWrapper, "GrOffsetRegion"}, + /* 74 */ {GrGetRegionBoxWrapper, "GrGetRegionBox"}, + /* 75 */ {GrNewPolygonRegionWrapper, "GrNewPolygonRegion"}, + /* 76 */ {GrArcWrapper, "GrArc"}, + /* 77 */ {GrArcAngleWrapper, "GrArcAngle"}, + /* 78 */ {GrSetWMPropertiesWrapper, "GrSetWMProperties"}, + /* 79 */ {GrGetWMPropertiesWrapper, "GrGetWMProperties"}, + /* 80 */ {GrCloseWindowWrapper, "GrCloseWindow"}, + /* 81 */ {GrKillWindowWrapper, "GrKillWindow"}, + /* 82 */ {GrDrawImageToFitWrapper, "GrDrawImageToFit"}, + /* 83 */ {GrFreeImageWrapper, "GrFreeImage"}, + /* 84 */ {GrGetImageInfoWrapper, "GrGetImageInfo"}, + /* 85 */ {GrDrawImageBitsWrapper, "GrDrawImageBits"}, + /* 86 */ {GrPointsWrapper, "GrPoints"}, + /* 87 */ {GrGetFocusWrapper, "GrGetFocus"}, + /* 88 */ {GrGetSysColorWrapper, "GrGetSysColor"}, + /* 89 */ {GrSetScreenSaverTimeoutWrapper, "GrSetScreenSaverTimeout"}, + /* 90 */ {GrSetSelectionOwnerWrapper, "GrSetSelectionOwner"}, + /* 91 */ {GrGetSelectionOwnerWrapper, "GrGetSelectionOwner"}, + /* 92 */ {GrRequestClientDataWrapper, "GrRequestClientData"}, + /* 93 */ {GrSendClientDataWrapper, "GrSendClientData"}, + /* 94 */ {GrBellWrapper, "GrBell"}, + /* 95 */ {GrSetBackgroundPixmapWrapper, "GrSetBackgroundPixmap"}, + /* 96 */ {GrDestroyCursorWrapper, "GrDestroyCursor"}, + /* 97 */ {GrQueryTreeWrapper, "GrQueryTree"}, + /* 98 */ {GrCreateTimerWrapper, "GrCreateTimer"}, + /* 99 */ {GrDestroyTimerWrapper, "GrDestroyTimer"}, + /* 100 */ {GrSetPortraitModeWrapper, "GrSetPortraitMode"}, + /* 101 */ {GrImageBufferAllocWrapper, "GrImageBufferAlloc"}, + /* 102 */ {GrImageBufferSendWrapper, "GrImageBufferSend"}, + /* 103 */ {GrLoadImageFromBufferWrapper, "GrLoadImageFromBuffer"}, + /* 104 */ {GrDrawImageFromBufferWrapper, "GrDrawImageFromBuffer"}, + /* 105 */ {GrGetFontListWrapper, "GrGetFontList"}, + /* 106 */ {GrSetGCClipOriginWrapper, "GrSetGCClipOrigin"}, +}; + +void +GrShmCmdsFlushWrapper(void *r) +{ + nxShmCmdsFlushReq *req = r; + unsigned char reply; +#if HAVE_SHAREDMEM_SUPPORT + nxReq *pr; + int length; + unsigned char *do_req, *do_req_last; + + if ( current_shm_cmds == 0 || current_shm_cmds_size < req->size ) { + /* No or short shm present serverside, bug or mischief */ + EPRINTF("nano-X: Ill behaved client assumes shm ok\n"); + if ( req->reply ) { + reply = 0; + GsWrite(current_fd, &reply, 1); + } + return; + } + + do_req = current_shm_cmds; + do_req_last = current_shm_cmds + req->size; + + while ( do_req < do_req_last ) { + pr = (nxReq *)do_req; + length = GetReqAlignedLen(pr); + if ( pr->reqType < GrTotalNumCalls ) { + GrFunctions[pr->reqType].func(pr); + } else { + EPRINTF("nano-X: Error bad shm function!\n"); + } + do_req += length; + } + + if ( req->reply ) { + reply = 1; + GsWrite(current_fd, &reply, 1); + } +#else + /* no shared memory support*/ + if ( req->reply ) { + reply = 0; + GsWrite(current_fd, &reply, 1); + } +#endif /* HAVE_SHAREDMEM_SUPPORT*/ +} + +/* + * This function is used to bind to the named socket which is used to + * accept connections from the clients. + */ +int +GsOpenSocket(void) +{ +#if ELKS + struct sockaddr_na sckt; +#ifndef SUN_LEN +#define SUN_LEN(ptr) (sizeof(sckt)) +#endif +#elif __ECOS + struct sockaddr_in sckt; +#ifndef SUN_LEN +#define SUN_LEN(ptr) (sizeof(sckt)) +#endif +#else + struct sockaddr_un sckt; +#ifndef SUN_LEN +#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ + + strlen ((ptr)->sun_path)) +#endif +#endif /* ELKS */ + +#if ELKS + if((un_sock = socket(AF_NANO, SOCK_STREAM, 0)) == -1) + return -1; + + sckt.sun_family = AF_NANO; + sckt.sun_no = GR_NUMB_SOCKET; +#elif __ECOS + // Create the socket + if((un_sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) + return -1; + + // Bind to any/all local IP addresses + memset( &sckt, '\0', sizeof(sckt) ); + sckt.sin_family = AF_INET; + sckt.sin_len = sizeof(sckt); + sckt.sin_port = htons(6600); + sckt.sin_addr.s_addr = INADDR_ANY; +#else + if (access(GR_NAMED_SOCKET, F_OK) == 0) { + /* FIXME: should try connecting to see if server is active */ + if(unlink(GR_NAMED_SOCKET)) + return -1; + } + + /* Create the socket: */ + if((un_sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) + return -1; + + /* Bind a name to the socket: */ + sckt.sun_family = AF_UNIX; + strncpy(sckt.sun_path, GR_NAMED_SOCKET, sizeof(sckt.sun_path)); +#endif /* ELKS */ + if(bind(un_sock, (struct sockaddr *) &sckt, SUN_LEN(&sckt)) < 0) + return -1; + + /* Start listening on the socket: */ + if(listen(un_sock, 5) == -1) + return -1; + return 1; +} + +void +GsCloseSocket(void) +{ + if(un_sock != -1) + close(un_sock); + un_sock = -1; + unlink(GR_NAMED_SOCKET); +} + +/* + * This function is used to accept a connnection from a client. + */ +void +GsAcceptClient(void) +{ + int i; +#if ELKS + struct sockaddr_na sckt; +#elif __ECOS + struct sockaddr_in sckt; +#else + struct sockaddr_un sckt; +#endif + size_t size = sizeof(sckt); + + if((i = accept(un_sock, (struct sockaddr *) &sckt, &size)) == -1) { +#ifdef __ECOS + // All ports should do this + EPRINTF("nano-X: Error accept failed (%s)\n", strerror(errno)); +#else + EPRINTF("nano-X: Error accept failed (%d)\n", errno); +#endif + return; + } + GsAcceptClientFd(i); +} + +/* + * This function accepts a client ID, and searches through the + * linked list of clients, returning a pointer to the relevant + * structure or NULL if not found. + */ +GR_CLIENT * +GsFindClient(int fd) +{ + GR_CLIENT *client; + + client = root_client; + + while(client) { + if(client->id == fd) + return(client); + client = client->next; + } + + return 0; +} + +/* + * Destroy windows and eventclient structures used by client. + * Called by GsDropClient after a client has exited to clean + * up resources. + */ +void +GsDestroyClientResources(GR_CLIENT * client) +{ + GR_WINDOW * wp, *nwp; + GR_PIXMAP * pp, *npp; + GR_GC * gp, *ngp; + GR_REGION * rp, *nrp; + GR_FONT * fp, *nfp; + GR_IMAGE * ip, *nip; + GR_CURSOR * cp, *ncp; + GR_EVENT_CLIENT *ecp, *necp; + GR_EVENT_CLIENT *pecp = NULL; + GR_EVENT_LIST *evp; + +printf("Destroy client %d resources\n", client->id); + /* search window list, destroy windows owned by client*/ + for(wp=listwp; wp; wp=nwp) { + nwp = wp->next; + /* + * Remove eventclient structures for this client + */ + ecp = wp->eventclients; + while (ecp) { + necp = ecp->next; + if (ecp->client == client) { +printf( " Destroy window %d eventclient mask %08lx\n", wp->id, ecp->eventmask); + if (ecp == wp->eventclients) + wp->eventclients = ecp->next; + else + pecp->next = ecp->next; + free(ecp); + } else + pecp = ecp; + ecp = necp; + } + if (wp->owner == client) { +printf(" Destroy window %d\n", wp->id); + GrDestroyWindow(wp->id); + } + } + + /* search pixmap list, destroy pixmaps owned by client*/ + for(pp=listpp; pp; pp=npp) { + npp = pp->next; + if (pp->owner == client) { +printf(" Destroy pixmap %d\n", pp->id); + GrDestroyWindow(pp->id); + } + } + + /* free gc's owned by client*/ + for(gp=listgcp; gp; gp=ngp) { + ngp = gp->next; + if (gp->owner == client) { +printf(" Destroy gc %d\n", gp->id); + GrDestroyGC(gp->id); + } + } + + /* free fonts owned by client*/ + for(fp=listfontp; fp; fp=nfp) { + nfp = fp->next; + if (fp->owner == client) { +printf(" Destroy font %d\n", fp->id); + GrDestroyFont(fp->id); + } + } + + /* free regions owned by client*/ + for(rp=listregionp; rp; rp=nrp) { + nrp = rp->next; + if (rp->owner == client) { +printf(" Destroy region %d\n", rp->id); + GrDestroyRegion(rp->id); + } + } + + /* free images owned by client*/ + for(ip=listimagep; ip; ip=nip) { + nip = ip->next; + if (ip->owner == client) { +printf(" Destroy image %d\n", ip->id); + GrFreeImage(ip->id); + } + } + + /* free cursors owned by client*/ + for(cp=listcursorp; cp; cp=ncp) { + ncp = cp->next; + if (cp->owner == client) { +printf(" Destroy cursor %d\n", cp->id); + GrDestroyCursor(cp->id); + } + } + + /* Free events associated with client*/ + evp = client->eventhead; + while (evp) { +printf(" Destroy event %d\n", evp->event.type); + client->eventhead = evp->next; + evp->next = eventfree; + eventfree = evp; + evp = client->eventhead; + } +} + +/* + * Display window, pixmap, gc, font, region lists + */ +void +GsPrintResources(void) +{ + GR_WINDOW *wp; + GR_PIXMAP *pp; + GR_GC *gp; + GR_REGION *rp; + GR_FONT *fp; + GR_IMAGE *ip; + + /* window list*/ + printf("Window list:\n"); + for(wp=listwp; wp; wp=wp->next) { + printf("%d(%d),", wp->id, wp->owner? wp->owner->id: 0); + } + printf("\nPixmap list:\n"); + for(pp=listpp; pp; pp=pp->next) { + printf("%d(%d),", pp->id, pp->owner->id); + } + printf("\nGC list:\n"); + for(gp=listgcp; gp; gp=gp->next) { + printf("%d(%d),", gp->id, gp->owner->id); + } + printf("\nFont list:\n"); + for(fp=listfontp; fp; fp=fp->next) { + printf("%d(%d),", fp->id, fp->owner->id); + } + printf("\nRegion list:\n"); + for(rp=listregionp; rp; rp=rp->next) { + printf("%d(%d),", rp->id, rp->owner->id); + } + printf("\nImage list:\n"); + for(ip=listimagep; ip; ip=ip->next) { + printf("%d(%d),", ip->id, ip->owner->id); + } + printf("\n"); +} + +/* + * This is used to drop a client when it is detected that the connection to it + * has been lost. + */ +void +GsDropClient(int fd) +{ + GR_CLIENT *client; + + if((client = GsFindClient(fd))) { /* If it exists */ + close(fd); /* Close the socket */ + + GsDestroyClientResources(client); + if(client == root_client) + root_client = client->next; + /* Link the prev to the next */ + if(client->prev) client->prev->next = client->next; + + /* Link the next to the prev */ + if(client->next) client->next->prev = client->prev; + +#if HAVE_SHAREDMEM_SUPPORT + if ( client->shm_cmds != 0 ) { + /* Free shared memory */ + shmctl(client->shm_cmds_shmid,IPC_RMID,0); + shmdt(client->shm_cmds); + } +#endif +GsPrintResources(); + free(client); /* Free the structure */ + + clipwp = NULL; /* reset clip window*/ + --connectcount; + } else EPRINTF("nano-X: trying to drop non-existent client %d.\n", fd); +} + +/* + * This is a wrapper to read() which handles error conditions, and + * returns 0 for both error conditions and no data. + */ +int +#if ELKS +GsRead(int fd, char *buf, int c) +#else +GsRead(int fd, void *buf, int c) +#endif +{ + int e, n; + + n = 0; + + while(n < c) { + e = read(fd, (buf + n), (c - n)); + if(e <= 0) { + if (e == 0) + EPRINTF("nano-X: client closed socket: %d\n", fd); + else EPRINTF("nano-X: GsRead failed %d %d: %d\r\n", + e, n, errno); + GsClose(fd); + return -1; + } + n += e; + } + + return 0; +} + +/* + * This is a wrapper to write(). + */ +int GsWrite(int fd, void *buf, int c) +{ + int e, n; + + n = 0; + + while(n < c) { + e = write(fd, ((char *) buf + n), (c - n)); + if(e <= 0) { + GsClose(fd); + return -1; + } + n += e; + } + + return 0; +} + +int GsWriteType(int fd, short type) +{ + return GsWrite(fd,&type,sizeof(type)); +} + +/* + * This function is used to parse and dispatch requests from the clients. + * Note that the maximum request size is allocated from the stack + * in this function. + */ +void +GsHandleClient(int fd) +{ + nxReq * req; + long len; + char buf[MAXREQUESTSZ]; + + current_fd = fd; +#if HAVE_SHAREDMEM_SUPPORT + current_shm_cmds = curclient->shm_cmds; + current_shm_cmds_size = curclient->shm_cmds_size; +#endif + /* read request header*/ + if(GsRead(fd, buf, sizeof(nxReq))) + return; + + len = GetReqAlignedLen((nxReq *)&buf[0]); + if(len > sizeof(nxReq)) { + if(len > MAXREQUESTSZ) { + EPRINTF("nano-X: GsHandleClient request too large: %ld > %d\n", + len, MAXREQUESTSZ); + exit(1); + } + /* read additional request data*/ + if(GsRead(fd, &buf[sizeof(nxReq)], len-sizeof(nxReq))) + return; + } + req = (nxReq *)&buf[0]; + + if(req->reqType < GrTotalNumCalls) { + curfunc = GrFunctions[req->reqType].name; + /*DPRINTF("HandleClient %s\n", curfunc);*/ + GrFunctions[req->reqType].func(req); + } else { + EPRINTF("nano-X: GsHandleClient bad function\n"); + } +} diff --git a/packages/services/gfx/mw/current/src/nanox/srvutil.c b/packages/services/gfx/mw/current/src/nanox/srvutil.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nanox/srvutil.c @@ -0,0 +1,1231 @@ +/* + * Copyright (c) 2000 Greg Haerr + * Copyright (c) 1991 David I. Bell + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * Graphics server utility routines for windows. + */ +#include +#include + +#ifndef __PACIFIC__ +#include +#endif + +#include "serv.h" + +/* + * Help prevent future bugs by defining this variable to an illegal value. + * These routines should not be referencing this, but should be using + * unmapcount instead. + */ +#define mapped cannotusemapped + +/* + * Redraw the screen completely. + */ +void +GsRedrawScreen(void) +{ + /* Redraw all windows*/ + GsExposeArea(rootwp, 0, 0, rootwp->width, rootwp->height, NULL); +} + +/* + * Activate Screen Saver. + */ +void +GsActivateScreenSaver(void *arg) +{ + screensaver_active = GR_TRUE; + GsDeliverScreenSaverEvent(GR_TRUE); +} + +/* + * Deactivate screen saver and reset timer if active. + */ +void +GsResetScreenSaver(void) +{ + MWTIMER *timer; + + if(screensaver_active == GR_TRUE) { + screensaver_active = GR_FALSE; + GsDeliverScreenSaverEvent(GR_FALSE); + } + if(screensaver_delay) { + if((timer = GdFindTimer(GsActivateScreenSaver))) + GdDestroyTimer(timer); + GdAddTimer(screensaver_delay, GsActivateScreenSaver, + GsActivateScreenSaver); + } +} + +void +GsTimerCB (void *arg) +{ + GR_TIMER *timer = (GR_TIMER*) arg; + + GsDeliverTimerEvent (timer->owner, timer->wid, timer->id); +} + + +/* + * Unmap the window to make it and its children invisible on the screen. + * This is a recursive routine which increments the unmapcount values for + * this window and all of its children, and causes exposure events for + * windows which are newly uncovered. + * If temp_unmap set, don't reset focus or generate mouse/focus events, + * as window will be mapped again momentarily (window move, resize, etc) + */ +void GsWpUnmapWindow(GR_WINDOW *wp, GR_BOOL temp_unmap) +{ + GR_WINDOW *pwp; /* parent window */ + GR_WINDOW *sibwp; /* sibling window */ + GR_WINDOW *childwp; /* child window */ + GR_SIZE bs; /* border size of this window */ + + if (wp == rootwp) { + GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wp->id); + return; + } + + if (wp == clipwp) + clipwp = NULL; + + ++wp->unmapcount; + + for (childwp = wp->children; childwp; childwp = childwp->siblings) + GsWpUnmapWindow(childwp, temp_unmap); + + if (!temp_unmap && wp == mousewp) { + GsCheckMouseWindow(); + GsCheckCursor(); + } + + if (!temp_unmap && wp == focuswp) { + if (focusfixed) + /* don't revert to mouse enter/leave focus if fixed*/ + focuswp = rootwp; + else { + focusfixed = GR_FALSE; + GsCheckFocusWindow(); + } + } + + /* Send update event if just unmapped*/ + if (wp->unmapcount == 1) { + GsDeliverUpdateEvent(wp, + (temp_unmap? GR_UPDATE_UNMAPTEMP: GR_UPDATE_UNMAP), + 0, 0, 0, 0); + } + + /* + * If this is an input-only window or the parent window is + * still unmapped, then we are all done. + */ + if (!wp->output || wp->parent->unmapcount) + return; + + /* + * Clear the area in the parent for this window, causing an + * exposure event for it. Take into account the border size. + */ + bs = wp->bordersize; + pwp = wp->parent; + GsWpClearWindow(pwp, wp->x - pwp->x - bs, wp->y - pwp->y - bs, + wp->width + bs * 2, wp->height + bs * 2, GR_TRUE); + + /* + * Finally clear and redraw all parts of our lower sibling + * windows that were covered by this window. + */ + sibwp = wp; + while (sibwp->siblings) { + sibwp = sibwp->siblings; + GsExposeArea(sibwp, wp->x - bs, wp->y - bs, + wp->width + bs * 2, wp->height + bs * 2, NULL); + } +} + +/* + * Map the window to possibly make it and its children visible on the screen. + * This is a recursive routine which decrements the unmapcount values for + * this window and all of its children, and causes exposure events for + * those windows which become visible. + * If temp is set, then window is being mapped again after a temporary + * unmap, so don't reset focus or generate mouse/focus events. + */ +void GsWpMapWindow(GR_WINDOW *wp, GR_BOOL temp) +{ + if (wp == rootwp) { + GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wp->id); + return; + } + + if (wp->unmapcount) + --wp->unmapcount; + + if (!temp && wp->unmapcount == 0) { + GsCheckMouseWindow(); + GsCheckFocusWindow(); + GsCheckCursor(); + } + + /* send update event if just mapped*/ + if (wp->unmapcount == 0) { + GsDeliverUpdateEvent(wp, GR_UPDATE_MAP, wp->x, wp->y, + wp->width, wp->height); + } + + /* + * If the window is an output window and just became visible, + * then draw its border, clear it to the background color, and + * generate an exposure event. + */ + if (wp->output && (wp->unmapcount == 0)) { + GsDrawBorder(wp); + GsWpClearWindow(wp, 0, 0, wp->width, wp->height, GR_TRUE); + } + + /* + * Do the same thing for the children. + */ + for (wp = wp->children; wp; wp = wp->siblings) + GsWpMapWindow(wp, temp); +} + +/* + * Destroy the specified window, and all of its children. + * This is a recursive routine. + */ +void GsWpDestroyWindow(GR_WINDOW *wp) +{ + GR_WINDOW *prevwp; /* previous window pointer */ + GR_EVENT_CLIENT *ecp; /* selections for window */ + GR_WINDOW_ID oldwid; /* old selection owner */ + + if (wp == rootwp) { + GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wp->id); + return; + } + + /* Disable selection if this window is the owner */ + if(selection_owner.wid == wp->id) { + oldwid = selection_owner.wid; + selection_owner.wid = 0; + if(selection_owner.typelist) free(selection_owner.typelist); + GsDeliverSelectionChangedEvent(oldwid, 0); + } + + /* + * Unmap the window first. + */ + if (wp->unmapcount == 0) + GsWpUnmapWindow(wp, GR_FALSE); + + /* send update event*/ + GsDeliverUpdateEvent(wp, GR_UPDATE_DESTROY, wp->x, wp->y, + wp->width, wp->height); + + /* + * Destroy all children. + */ + while (wp->children) + GsWpDestroyWindow(wp->children); + + /* + * Free all client selection structures. + */ + while (wp->eventclients) { + ecp = wp->eventclients; + wp->eventclients = ecp->next; + free(ecp); + } + + /* + * Remove this window from the child list of its parent. + */ + prevwp = wp->parent->children; + if (prevwp == wp) + wp->parent->children = wp->siblings; + else { + while (prevwp->siblings != wp) + prevwp = prevwp->siblings; + prevwp->siblings = wp->siblings; + } + wp->siblings = NULL; + + /* + * Remove this window from the complete list of windows. + */ + prevwp = listwp; + if (prevwp == wp) + listwp = wp->next; + else { + while (prevwp->next != wp) + prevwp = prevwp->next; + prevwp->next = wp->next; + } + wp->next = NULL; + + /* + * Forget various information if they related to this window. + * Then finally free the structure. + */ + if (wp == clipwp) + clipwp = NULL; + if (wp == grabbuttonwp) + grabbuttonwp = NULL; + if (wp == cachewp) { + cachewindowid = 0; + cachewp = NULL; + } + if (wp == focuswp) { + /* don't revert to mouse enter/leave focus if fixed*/ + /*focusfixed = GR_FALSE;*/ + focuswp = rootwp; + } + + GsCheckMouseWindow(); + + if(wp->title) + free(wp->title); + + free(wp); +} + +/* + * Draw a window's background pixmap. + * + * The flags mean: + * GR_BACKGROUND_TILE- tile the pixmap across the window (default). + * GR_BACKGROUND_TOPLEFT- draw the pixmap at (0,0) relative to the window. + * GR_BACKGROUND_CENTER- draw the pixmap in the middle of the window. + * GR_BACKGROUND_STRETCH- stretch the pixmap within the window. + * GR_BACKGROUND_TRANS- if the pixmap is smaller than the window and not + * using tile mode, there will be gaps around the pixmap. This flag causes + * to not fill in the spaces with the background colour. + */ +void GsWpDrawBackgroundPixmap(GR_WINDOW *wp, GR_PIXMAP *pm, GR_COORD x, + GR_COORD y, GR_SIZE width, GR_SIZE height) +{ + GR_SIZE destwidth, destheight, fillwidth, fillheight, pmwidth, pmheight; + GR_COORD fromx, fromy, destx, desty, pixmapx = 0, pixmapy = 0; + + if(wp->bgpixmapflags & (GR_BACKGROUND_TOPLEFT|GR_BACKGROUND_STRETCH)) { + pixmapx = 0; + pixmapy = 0; + } else if(wp->bgpixmapflags & GR_BACKGROUND_CENTER) { + if(pm->width >= wp->width) pixmapx = 0; + else pixmapx = (wp->width - pm->width) / 2; + if(pm->height >= wp->height) pixmapy = 0; + else pixmapy = (wp->height - pm->height) / 2; + } else { + /* GR_BACKGROUND_TILE (default)*/ + GsWpTileBackgroundPixmap(wp, pm, x, y, width, height); + return; + } + + if(pm->width > wp->width) pmwidth = wp->width; + else pmwidth = pm->width; + if(pm->height > wp->height) pmheight = wp->height; + else pmheight = pm->height; + + if(x > pixmapx) { + destx = x; + fromx = x - pixmapx; + destwidth = pixmapx + pmwidth - x; + } else { + destx = pixmapx; + fromx = 0; + destwidth = x + width - pixmapx; + } + + if(y > pixmapy) { + desty = y; + fromy = y - pixmapy; + destheight = pixmapy + pmheight - desty; + } else { + desty = pixmapy; + fromy = 0; + destheight = y + height - pixmapy; + } + + if(destwidth > 0 && destheight > 0) { + if (wp->bgpixmapflags & GR_BACKGROUND_STRETCH) { + GdStretchBlit(wp->psd, destx + wp->x, desty + wp->y, + destwidth, destheight, pm->psd, fromx, fromy, + pm->width, pm->height, MWROP_COPY); + } else GdBlit(wp->psd, destx + wp->x, desty + wp->y, destwidth, + destheight, pm->psd, fromx, fromy, MWROP_COPY); + } + + if(wp->bgpixmapflags & (GR_BACKGROUND_TRANS|GR_BACKGROUND_STRETCH)) + return; + + /* Fill in the gaps around the pixmap */ + if(x < pixmapx) { + fillwidth = pixmapx - x; + if(fillwidth > width) fillwidth = width; + fillheight = height; + GdFillRect(wp->psd, wp->x + x, wp->y + y, fillwidth,fillheight); + } + if((x + width) > (pixmapx + pmwidth)) { + fillwidth = (x + width) - (pixmapx + pmwidth); + if(fillwidth > width) fillwidth = width; + fillheight = height; + if(x < (pixmapx + pmwidth)) destx = pixmapx + pmwidth + wp->x; + else destx = x + wp->x; + GdFillRect(wp->psd, destx, wp->y + y, fillwidth, fillheight); + } + if(y < pixmapy) { + fillheight = pixmapy - y; + if(fillheight > height) fillheight = height; + if(x < pixmapx) destx = pixmapx + wp->x; + else destx = x + wp->x; + if((x + width) > (pixmapx + pmwidth)) + fillwidth = pixmapx + pmwidth - destx; + else fillwidth = x + width - destx; + if((fillwidth > 0) && (fillheight > 0)) { + GdFillRect(wp->psd, destx, wp->y + y, fillwidth, + fillheight); + } + } + if((y + height) > (pixmapy + pmheight)) { + fillheight = (y + height) - (pixmapy + pmheight); + if(fillheight > height) fillheight = height; + if(x < pixmapx) destx = pixmapx + wp->x; + else destx = x + wp->x; + if(y < (pixmapy + pmheight)) desty = pixmapy + pmheight + wp->y; + else desty = y + wp->y; + + if((x + width) > (pixmapx + pmwidth)) + fillwidth = pixmapx + pmwidth - destx; + else fillwidth = x + width - destx; + if((fillwidth > 0) && (fillheight > 0)) { + GdFillRect(wp->psd, destx, desty, fillwidth,fillheight); + } + } +} + +/* + * Draw a tiled pixmap window background. + */ +void +GsWpTileBackgroundPixmap(GR_WINDOW *wp, GR_PIXMAP *pm, GR_COORD x, GR_COORD y, + GR_SIZE width, GR_SIZE height) +{ + GR_COORD tilex = 0, tiley = 0, fromx, fromy, cx, cy; + GR_SIZE destwidth, destheight, pmwidth, pmheight, cwidth, cheight; + + if(pm->width > wp->width) pmwidth = wp->width; + else pmwidth = pm->width; + if(pm->height > wp->height) pmheight = wp->height; + else pmheight = pm->height; + + for(;tiley < wp->height; tiley += pmheight, tilex = 0) { + if(tiley > (y + height)) continue; + if(y > (tiley + pmheight)) continue; + if((tiley + pmheight) > wp->height) + destheight = wp->height - tiley; + else destheight = pmheight; + for(;tilex < wp->width; tilex += pmwidth) { + if(tilex > (x + width)) continue; + if(x > (tilex + pmwidth)) continue; + if((tilex + pmwidth) > wp->width) + destwidth = wp->width - tilex; + else destwidth = pmwidth; + + if((tilex >= x) && ((tilex + destwidth)<=(x + width))) { + fromx = 0; + cx = tilex + wp->x; + cwidth = destwidth; + } else { + if(x > tilex) { + fromx = x - tilex; + cwidth = destwidth - fromx; + } else { + fromx = 0; + cwidth = x + width - tilex; + } + if(cwidth > width) cwidth = width; + if(cwidth > destwidth) cwidth = destwidth; + cx = wp->x + tilex + fromx; + } + + if((tiley >= y)&&((tiley + destheight)<=(y + height))) { + fromy = 0; + cy = tiley + wp->y; + cheight = destheight; + } else { + if(y > tiley) { + fromy = y - tiley; + cheight = destheight - fromy; + } else { + fromy = 0; + cheight = y + height - tiley; + } + if(cwidth > width) cwidth = width; + if(cheight > destheight) cheight = destheight; + cy = wp->y + tiley + fromy; + } + + if((cwidth > 0) && (cheight > 0)) { + GdBlit(wp->psd, cx, cy, cwidth, cheight, + pm->psd, fromx, fromy, MWROP_COPY); + } + } + } +} + +/* + * Clear the specified area of a window and possibly make an exposure event. + * This sets the area window to its background color or pixmap. If the + * exposeflag is nonzero, then this also creates an exposure event for the + * window. + */ +void +GsWpClearWindow(GR_WINDOW *wp, GR_COORD x, GR_COORD y, GR_SIZE width, + GR_SIZE height, GR_BOOL exposeflag) +{ + if (wp->unmapcount || !wp->output) + return; + /* + * Reduce the arguments so that they actually lie within the window. + */ + if (x < 0) { + width += x; + x = 0; + } + if (y < 0) { + height += y; + y = 0; + } + if (x + width > wp->width) + width = wp->width - x; + if (y + height > wp->height) + height = wp->height - y; + + /* + * Now see if the region is really in the window. If not, then + * do nothing. + */ + if ((x >= wp->width) || (y >= wp->height) || (width <= 0) || + (height <= 0)) + return; + + /* + * Draw the background of the window. + * Invalidate the current graphics context since + * we are changing the foreground color and mode. + */ + GsSetClipWindow(wp, NULL, 0); + curgcp = NULL; + if (!(wp->props & GR_WM_PROPS_NOBACKGROUND)) { + GdSetMode(GR_MODE_COPY); + GdSetForeground(GdFindColor(wp->background)); + if (wp->bgpixmap) { + GsWpDrawBackgroundPixmap(wp, wp->bgpixmap, x, y, + width, height); + } else { + GdFillRect(wp->psd, wp->x + x, wp->y + y, width,height); + } + } + + /* + * Now do the exposure if required. + */ + if (exposeflag) + GsDeliverExposureEvent(wp, x, y, width, height); +} + +/* + * Handle the exposing of the specified absolute region of the screen, + * starting with the specified window. That window and all of its + * children will be redrawn and/or exposure events generated if they + * overlap the specified area. This is a recursive routine. + */ +void +GsExposeArea(GR_WINDOW *wp, GR_COORD rootx, GR_COORD rooty, GR_SIZE width, + GR_SIZE height, GR_WINDOW *stopwp) +{ + if (!wp->output || wp->unmapcount || wp == stopwp) + return; + + /* + * First see if the area overlaps the window including the border. + * If not, then there is nothing more to do. + */ + if ((rootx >= wp->x + wp->width + wp->bordersize) || + (rooty >= wp->y + wp->height + wp->bordersize) || + (rootx + width <= wp->x - wp->bordersize) || + (rooty + height <= wp->y - wp->bordersize)) + return; + + /* + * The area does overlap the window. See if the area overlaps + * the border, and if so, then redraw it. + */ + if ((rootx < wp->x) || (rooty < wp->y) || + (rootx + width > wp->x + wp->width) || + (rooty + height > wp->y + wp->height)) + GsDrawBorder(wp); + + /* + * Now clear the window itself in the specified area, + * which might cause an exposure event. + */ + GsWpClearWindow(wp, rootx - wp->x, rooty - wp->y, + width, height, GR_TRUE); + + /* + * Now do the same for all the children. + */ + for (wp = wp->children; wp; wp = wp->siblings) + GsExposeArea(wp, rootx, rooty, width, height, stopwp); +} + +/* + * Draw the border of a window if there is one. + * Note: To allow the border to be drawn with the correct clipping, + * we temporarily grow the size of the window to include the border. + */ +void GsDrawBorder(GR_WINDOW *wp) +{ + GR_COORD lminx; /* left edge minimum x */ + GR_COORD rminx; /* right edge minimum x */ + GR_COORD tminy; /* top edge minimum y */ + GR_COORD bminy; /* bottom edge minimum y */ + GR_COORD topy; /* top y value of window */ + GR_COORD boty; /* bottom y value of window */ + GR_SIZE width; /* original width of window */ + GR_SIZE height; /* original height of window */ + GR_SIZE bs; /* border size */ + + bs = wp->bordersize; + if (bs <= 0) + return; + + width = wp->width; + height = wp->height; + lminx = wp->x - bs; + rminx = wp->x + width; + tminy = wp->y - bs; + bminy = wp->y + height; + topy = wp->y; + boty = bminy - 1; + + wp->x -= bs; + wp->y -= bs; + wp->width += (bs * 2); + wp->height += (bs * 2); + wp->bordersize = 0; + + clipwp = NULL; + GsSetClipWindow(wp, NULL, 0); + curgcp = NULL; + GdSetMode(GR_MODE_COPY); + GdSetForeground(GdFindColor(wp->bordercolor)); + + if (bs == 1) { + GdLine(wp->psd, lminx, tminy, rminx, tminy, TRUE); + GdLine(wp->psd, lminx, bminy, rminx, bminy, TRUE); + GdLine(wp->psd, lminx, topy, lminx, boty, TRUE); + GdLine(wp->psd, rminx, topy, rminx, boty, TRUE); + } else { + GdFillRect(wp->psd, lminx, tminy, width + bs * 2, bs); + GdFillRect(wp->psd, lminx, bminy, width + bs * 2, bs); + GdFillRect(wp->psd, lminx, topy, bs, height); + GdFillRect(wp->psd, rminx, topy, bs, height); + } + + /* + * Restore the true window size. + * Forget the currently clipped window since we messed it up. + */ + wp->x += bs; + wp->y += bs; + wp->width -= (bs * 2); + wp->height -= (bs * 2); + wp->bordersize = bs; + clipwp = NULL; +} + +/* + * Check to see if the first window overlaps the second window. + */ +GR_BOOL GsCheckOverlap(GR_WINDOW *topwp, GR_WINDOW *botwp) +{ + GR_COORD minx1; + GR_COORD miny1; + GR_COORD maxx1; + GR_COORD maxy1; + GR_COORD minx2; + GR_COORD miny2; + GR_COORD maxx2; + GR_COORD maxy2; + GR_SIZE bs; + + if (!topwp->output || topwp->unmapcount || botwp->unmapcount) + return GR_FALSE; + + bs = topwp->bordersize; + minx1 = topwp->x - bs; + miny1 = topwp->y - bs; + maxx1 = topwp->x + topwp->width + bs - 1; + maxy1 = topwp->y + topwp->height + bs - 1; + + bs = botwp->bordersize; + minx2 = botwp->x - bs; + miny2 = botwp->y - bs; + maxx2 = botwp->x + botwp->width + bs - 1; + maxy2 = botwp->y + botwp->height + bs - 1; + + if ((minx1 > maxx2) || (minx2 > maxx1) || (miny1 > maxy2) + || (miny2 > maxy1)) + return GR_FALSE; + + return GR_TRUE; +} + +/* + * Return a pointer to the window structure with the specified window id. + * Returns NULL if the window does not exist. + */ +GR_WINDOW * +GsFindWindow(GR_WINDOW_ID id) +{ + GR_WINDOW *wp; /* current window pointer */ + + /* + * See if this is the root window or the same window as last time. + */ + if (id == GR_ROOT_WINDOW_ID) + return rootwp; + + if ((id == cachewindowid) && id) + return cachewp; + + /* + * No, search for it and cache it for future calls. + */ + for (wp = listwp; wp; wp = wp->next) { + if (wp->id == id) { + cachewindowid = id; + cachewp = wp; + return wp; + } + } + + return NULL; +} + + + +/* + * Return a pointer to the pixmap structure with the specified window id. + * Returns NULL if the pixmap does not exist. + */ +GR_PIXMAP * +GsFindPixmap(GR_WINDOW_ID id) +{ + GR_PIXMAP *pp; /* current pixmap pointer */ + + if ((id == cachepixmapid) && id) + return cachepp; + + /* + * No, search for it and cache it for future calls. + */ + for (pp = listpp; pp; pp = pp->next) { + if (pp->id == id) { + cachepixmapid = id; + cachepp = pp; + return pp; + } + } + + return NULL; +} + + +/* + * Return a pointer to the graphics context with the specified id. + * Returns NULL if the graphics context does not exist, with an + * error saved. + */ +GR_GC * +GsFindGC(GR_GC_ID gcid) +{ + GR_GC *gcp; /* current graphics context pointer */ + + /* + * See if this is the same graphics context as last time. + */ + if ((gcid == cachegcid) && gcid) + return cachegcp; + + /* + * No, search for it and cache it for future calls. + */ + for (gcp = listgcp; gcp; gcp = gcp->next) { + if (gcp->id == gcid) { + cachegcid = gcid; + cachegcp = gcp; + return gcp; + } + } + + GsError(GR_ERROR_BAD_GC_ID, gcid); + + return NULL; +} + +/* Return a pointer to the region with the specified id.*/ +GR_REGION * +GsFindRegion(GR_REGION_ID regionid) +{ + GR_REGION *regionp; /* current region pointer */ + + for (regionp = listregionp; regionp; regionp = regionp->next) { + if (regionp->id == regionid) { + return regionp; + } + } + + return NULL; +} + +/* find a font with specified id*/ +GR_FONT * +GsFindFont(GR_FONT_ID fontid) +{ + GR_FONT *fontp; + + for (fontp = listfontp; fontp; fontp = fontp->next) { + if (fontp->id == fontid) + return fontp; + } + return NULL; +} + +/* find a cursor with specified id*/ +GR_CURSOR * +GsFindCursor(GR_CURSOR_ID cursorid) +{ + GR_CURSOR *cursorp; + + for (cursorp = listcursorp; cursorp; cursorp = cursorp->next) { + if (cursorp->id == cursorid) + return cursorp; + } + return NULL; +} + +GR_TIMER * +GsFindTimer (GR_TIMER_ID timer_id) +{ + GR_TIMER *timer; + + /* + * See if this is the same graphics context as last time. + */ + if ((timer_id == cache_timer_id) && timer_id) + return cache_timer; + + /* + * No, search for it and cache it for future calls. + */ + for (timer = list_timer; timer != NULL; timer = timer->next) + { + if (timer->id == timer_id) + { + cache_timer_id = timer_id; + cache_timer = timer; + return timer; + } + } + return NULL; +} + + +/* + * Prepare to do drawing in a window or pixmap using the specified + * graphics context. Returns the drawable pointer if successful, + * and the type of drawing id that was supplied. Returns the special value + * GR_DRAW_TYPE_NONE if an error is generated, or if drawing is useless. + */ +GR_DRAW_TYPE GsPrepareDrawing(GR_DRAW_ID id, GR_GC_ID gcid, GR_DRAWABLE **retdp) +{ + GR_WINDOW *wp; /* found window */ + GR_PIXMAP *pp; /* found pixmap */ + GR_GC *gcp; /* found graphics context */ + GR_FONT *fontp; + GR_REGION *regionp; /* user clipping region */ + MWCLIPREGION *reg; + PMWFONT pf; + + *retdp = NULL; + + gcp = GsFindGC(gcid); + if (gcp == NULL) + return GR_DRAW_TYPE_NONE; + + /* + * If the graphics context is not the current one, then + * make it the current one and remember to update it. + */ + if (gcp != curgcp) { + curgcp = gcp; + gcp->changed = GR_TRUE; + } + + /* + * Look for window or pixmap id + */ + pp = NULL; + wp = GsFindWindow(id); + if (wp == NULL) { + pp = GsFindPixmap(id); + if (pp == NULL) + return GR_DRAW_TYPE_NONE; + +#if DYNAMICREGIONS + reg = GdAllocRectRegion(0, 0, pp->psd->xvirtres, + pp->psd->yvirtres); + /* intersect with user region if any*/ + if (gcp->regionid) { + regionp = GsFindRegion(gcp->regionid); + if (regionp) + GdIntersectRegion(reg, reg, regionp->rgn); + } + GdSetClipRegion(pp->psd, reg); +#else + { + MWCLIPRECT cliprect; + /* FIXME: setup pixmap clipping, different from windows*/ + cliprect.x = 0; + cliprect.y = 0; + cliprect.width = pp->psd->xvirtres; + cliprect.height = pp->psd->yvirtres; + GdSetClipRects(pp->psd, 1, &cliprect); + } +#endif + /* reset clip cache for next window draw*/ + clipwp = NULL; + } else { + + if (!wp->output) { + GsError(GR_ERROR_INPUT_ONLY_WINDOW, id); + return GR_DRAW_TYPE_NONE; + } + + if (wp->unmapcount) + return GR_DRAW_TYPE_NONE; + + /* + * If the window is not the currently clipped one, + * then make it the current one and define its clip rectangles. + */ + if (wp != clipwp || gcp->changed) { + /* find user region for intersect*/ + if (gcp->regionid) + regionp = GsFindRegion(gcp->regionid); + else regionp = NULL; + + /* + * Special handling if user region is not at offset 0,0 + */ + if (regionp && (gcp->xoff || gcp->yoff)) { + MWCLIPREGION *local = GdAllocRegion(); + + GdCopyRegion(local, regionp->rgn); + GdOffsetRegion(local, gcp->xoff, gcp->yoff); + + GsSetClipWindow(wp, local, + gcp->mode & ~GR_MODE_DRAWMASK); + + GdDestroyRegion(local); + } else { + GsSetClipWindow(wp, regionp? regionp->rgn: NULL, + gcp->mode & ~GR_MODE_DRAWMASK); + } + } + } + + /* + * If the graphics context has been changed, then tell the + * device driver about it. + */ + if (gcp->changed) { + GdSetForeground(GdFindColor(gcp->foreground)); + GdSetBackground(GdFindColor(gcp->background)); + GdSetMode(gcp->mode & GR_MODE_DRAWMASK); + GdSetUseBackground(gcp->usebackground); + fontp = GsFindFont(gcp->fontid); + pf = fontp? fontp->pfont: stdfont; + GdSetFont(pf); + gcp->changed = GR_FALSE; + } + + *retdp = wp? (GR_DRAWABLE *)wp: (GR_DRAWABLE *)pp; + return wp? GR_DRAW_TYPE_WINDOW: GR_DRAW_TYPE_PIXMAP; +} + +/* + * Prepare the specified window for drawing into it. + * This sets up the clipping regions to just allow drawing into it. + * Returns NULL if the drawing is illegal (with an error generated), + * or if the window is not mapped. + */ +GR_WINDOW *GsPrepareWindow(GR_WINDOW_ID wid) +{ + GR_WINDOW *wp; /* found window */ + + wp = GsFindWindow(wid); + if (wp == NULL) + return NULL; + + if (!wp->output) { + GsError(GR_ERROR_INPUT_ONLY_WINDOW, wid); + return NULL; + } + + if (wp->unmapcount) + return NULL; + + if (wp != clipwp) { + /* FIXME: no user region clipping here*/ + GsSetClipWindow(wp, NULL, 0); + } + + return wp; +} + +/* + * Find the window which is currently visible for the specified coordinates. + * This just walks down the window tree looking for the deepest mapped + * window which contains the specified point. If the coordinates are + * off the screen, the root window is returned. + */ +GR_WINDOW *GsFindVisibleWindow(GR_COORD x, GR_COORD y) +{ + GR_WINDOW *wp; /* current window */ + GR_WINDOW *retwp; /* returned window */ + + wp = rootwp; + retwp = wp; + while (wp) { + if ((wp->unmapcount == 0) && (wp->x <= x) && (wp->y <= y) && + (wp->x + wp->width > x) && (wp->y + wp->height > y)) + { + retwp = wp; + wp = wp->children; + continue; + } + wp = wp->siblings; + } + return retwp; +} + +/* + * Check to see if the cursor shape is the correct shape for its current + * location. If not, its shape is changed. + */ +void GsCheckCursor(void) +{ + GR_WINDOW *wp; /* window cursor is in */ + GR_CURSOR *cp; /* cursor definition */ + + /* + * Get the cursor at its current position, and if it is not the + * currently defined one, then set the new cursor. However, + * if the pointer is currently grabbed, then leave it alone. + */ + wp = grabbuttonwp; + if (wp == NULL) + wp = mousewp; + + cp = GsFindCursor(wp->cursorid); + if (!cp) + cp = stdcursor; + if (cp == curcursor) + return; + + /* + * It needs redefining, so do it. + */ + curcursor = cp; + GdMoveCursor(cursorx - cp->cursor.hotx, cursory - cp->cursor.hoty); + GdSetCursor(&cp->cursor); +} + +/* + * Check to see if the window the mouse is currently in has changed. + * If so, generate enter and leave events as required. The newest + * mouse window is remembered in mousewp. However, do not change the + * window while it is grabbed. + */ +void GsCheckMouseWindow(void) +{ + GR_WINDOW *wp; /* newest window for mouse */ + + wp = grabbuttonwp; + if (wp == NULL) + wp = GsFindVisibleWindow(cursorx, cursory); + if (wp == mousewp) + return; + + GsDeliverGeneralEvent(mousewp, GR_EVENT_TYPE_MOUSE_EXIT, NULL); + + mousewp = wp; + + GsDeliverGeneralEvent(wp, GR_EVENT_TYPE_MOUSE_ENTER, NULL); +} + +/* + * Determine the current focus window for the current mouse coordinates. + * The mouse coordinates only matter if the focus is not fixed. Otherwise, + * the selected window is dependant on the window which wants keyboard + * events. This also sets the current focus for that found window. + * The window with focus is remembered in focuswp. + */ +void GsCheckFocusWindow(void) +{ + GR_WINDOW *wp; /* current window */ + GR_EVENT_CLIENT *ecp; /* current event client */ + GR_EVENT_MASK eventmask; /* event mask */ + + if (focusfixed) + return; + + eventmask = GR_EVENT_MASK_KEY_DOWN; + + /* + * Walk upwards from the current window containing the mouse + * looking for the first window which would accept a keyboard event. + */ + for (wp = mousewp; ;wp = wp->parent) { + if (wp->props & GR_WM_PROPS_NOFOCUS) + continue; + for (ecp = wp->eventclients; ecp; ecp = ecp->next) { + if (ecp->eventmask & eventmask) { + GsWpSetFocus(wp); + return; + } + } + if ((wp == rootwp) || (wp->nopropmask & eventmask)) { + GsWpSetFocus(rootwp); + return; + } + } +} + +/* Send an update activate event to top level window of passed window*/ +static void +GsWpNotifyActivate(GR_WINDOW *wp) +{ + GR_WINDOW *pwp; + + for (pwp=wp; pwp->parent; pwp=pwp->parent) + if (pwp->parent->id == GR_ROOT_WINDOW_ID) + break; + if (pwp->id != GR_ROOT_WINDOW_ID) + GsDeliverUpdateEvent(pwp, GR_UPDATE_ACTIVATE, 0, 0, 0, 0); +} + +/* + * Set the input focus to the specified window. + * This generates focus out and focus in events as necessary. + */ +void GsWpSetFocus(GR_WINDOW *wp) +{ + GR_WINDOW *oldfocus; + + if (wp == focuswp) + return; + + GsDeliverGeneralEvent(focuswp, GR_EVENT_TYPE_FOCUS_OUT, wp); + GsWpNotifyActivate(focuswp); + + oldfocus = focuswp; + focuswp = wp; + + GsDeliverGeneralEvent(wp, GR_EVENT_TYPE_FOCUS_IN, oldfocus); + GsWpNotifyActivate(focuswp); +} + +/* + * Set dynamic portrait mode and redraw screen. + */ +void +GsSetPortraitMode(int mode) +{ + GdSetPortraitMode(&scrdev, mode); + GdRestrictMouse(0, 0, scrdev.xvirtres - 1, scrdev.yvirtres - 1); + + /* reset clip and root window size*/ + clipwp = NULL; + rootwp->width = scrdev.xvirtres; + rootwp->height = scrdev.yvirtres; + + /* deliver portrait changed event to all windows selecting it*/ + GsDeliverPortraitChangedEvent(); + + /* redraw screen - apps may redraw/resize again causing flicker*/ + GsRedrawScreen(); +} + +/* + * Check mouse coordinates and possibly set indicated portrait + * mode from mouse position. + */ +void +GsSetPortraitModeFromXY(GR_COORD rootx, GR_COORD rooty) +{ + int newmode; + + if (rootx == 0) { + /* rotate left*/ + switch (scrdev.portrait) { + case MWPORTRAIT_NONE: + default: + newmode = MWPORTRAIT_LEFT; + break; + case MWPORTRAIT_LEFT: + newmode = MWPORTRAIT_DOWN; + break; + case MWPORTRAIT_DOWN: + newmode = MWPORTRAIT_RIGHT; + break; + case MWPORTRAIT_RIGHT: + newmode = MWPORTRAIT_NONE; + break; + } + GsSetPortraitMode(newmode); + GrMoveCursor(5, rooty); + GdMoveMouse(5, rooty); + } else if (rootx == scrdev.xvirtres-1) { + /* rotate right*/ + switch (scrdev.portrait) { + case MWPORTRAIT_NONE: + default: + newmode = MWPORTRAIT_RIGHT; + break; + case MWPORTRAIT_LEFT: + newmode = MWPORTRAIT_NONE; + break; + case MWPORTRAIT_DOWN: + newmode = MWPORTRAIT_LEFT; + break; + case MWPORTRAIT_RIGHT: + newmode = MWPORTRAIT_DOWN; + break; + } + GsSetPortraitMode(newmode); + GrMoveCursor(scrdev.xvirtres-5, rooty); + GdMoveMouse(scrdev.xvirtres-5, rooty); + } +} diff --git a/packages/services/gfx/mw/current/src/npanel.sh b/packages/services/gfx/mw/current/src/npanel.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/npanel.sh @@ -0,0 +1,1 @@ +bin/nano-X -p & bin/npanel diff --git a/packages/services/gfx/mw/current/src/nxkbd.sh b/packages/services/gfx/mw/current/src/nxkbd.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nxkbd.sh @@ -0,0 +1,1 @@ +bin/nano-X -A $1 & bin/nxkbd & bin/nanowm & bin/nxterm & bin/nxterm & bin/nxroach -roaches 10 & sleep 10000 diff --git a/packages/services/gfx/mw/current/src/nxview.sh b/packages/services/gfx/mw/current/src/nxview.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/nxview.sh @@ -0,0 +1,1 @@ +bin/nano-X -N & bin/nanowm & bin/nxview $1 $2; sleep 10000 diff --git a/packages/services/gfx/mw/current/src/rtems/Makefile.rtems b/packages/services/gfx/mw/current/src/rtems/Makefile.rtems new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/rtems/Makefile.rtems @@ -0,0 +1,132 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr +# +# Rosimildo da Silva +# Udapted to the RTEMS environment... +# +############################################################################## + +ifndef TOP +TOP = .. +CONFIG = $(TOP)/config +endif + +include $(CONFIG) + +######################## Additional Flags section ############################ + +# Directories list for header files +ifeq ($(HAVE_JPEG_SUPPORT), Y) +INCLUDEDIRS += -I$(TOP)/jpeg-6b +endif +# Defines for preprocessor +DEFINES += +# Defines for preprocessor +ifeq ($(LINK_APP_INTO_SERVER), Y) +DEFINES += -DNONETWORK=1 +endif + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +ifeq ($(HAVE_JPEG_SUPPORT), Y) +LDFLAGS += -L$(TOP)/jpeg-6b +endif + +# PC386 specific stuff... +PROJECT_RELEASE = $(RTEMS_BUILD)/$(RTEMS_BSP) +PROJECT_TOOLS = $(PROJECT_RELEASE)/build-tools +START16FILE = $(PROJECT_RELEASE)/lib/start16.bin +RELOCADDR = 0x00100000 +START16ADDR = 0x00097C00 +HEADERADDR = 0x00097E00 +EXTRA_LFLAGS =-Wl,-Ttext,$(RELOCADDR) + +############################# targets section ################################ + +ifeq ($(ARCH), RTEMS) + +# If you want to create a library with the objects files, define the name here +LIBNAME = + + +# Name of the target which the image will be created to the downloaded to the +# target box. +RTEMS_TARGET=rtems + + +# Main module -- this module defines the "main()" routine to get compiled. +# It basically selects which application is actually built to be loaded as +# the RTEMS system. +# For example, select one: +# MAIN_OBJ = mw_uid_test.o -- Mouse & KBD test driver +# MAIN_OBJ = ../demos/nanox/demo.o -- Nano-X demo +# MAIN_OBJ = ../demos/mwobjects/mwo-test.o -- C++ demo +# MAIN_OBJ = ../demos/test/test.o -- test driver + + +# If you want to build the "mineswipper" game, use the modules below. +# This should give you an idea of what you have to do to the others demos. +#MINEIMAGES = ../demos/mwin/mineflag.o ../demos/mwin/mineface.o \ +# ../demos/mwin/minefacelost.o ../demos/mwin/minebomb.o \ +# ../demos/mwin/minedone.o ../demos/mwin/minehitfalse.o +#MAIN_OBJ =../demos/mwin/mine.o $(MINEIMAGES) + +MAIN_OBJ = ../demos/mwin/demo.o + +# List of objects always needed by a RTEMS application +OBJS = rtems_init.o + +# IMPORTANT NOTE: if MAIN_OBJ is a C++ code, add it to CXXOBJS instead. +OBJS += $(MAIN_OBJ) +# CXXOBJS += $(MAIN_OBJ) + + +all: default $(RTEMS_TARGET).bt + + +######################### Makefile.rules section ############################# + +include $(TOP)/Makefile.rules + +######################## Tools targets section ############################### +# let's adjust the libraries to match the API that you are using. + +NLIBS = + +ifeq ($(NANOX), Y) +NLIBS += -lnano-X +endif + +ifeq ($(NWIDGET), Y) +NLIBS += -lnwidget +endif + +ifeq ($(OBJFRAMEWORK), Y) +NLIBS += -lmwobjects +endif + +ifeq ($(MICROWIN), Y) +NLIBS += -lmwin -lmwinlib +endif + +NLIBS += -lmwengine -lmwdrivers -lmwfonts -lmwimages -lm + +ifeq ($(VGALIB), Y) +NLIBS += -lvga +endif + +$(RTEMS_TARGET).bt: $(RTEMS_TARGET).exe + $(OBJCOPY) -O binary $(RTEMS_TARGET).exe $(RTEMS_TARGET).bin; + $(PROJECT_TOOLS)/bin2boot -v $(RTEMS_TARGET).bt $(HEADERADDR) $(START16FILE) \ + $(START16ADDR) 0 $(RTEMS_TARGET).bin $(RELOCADDR) 0; + rm $(RTEMS_TARGET).bin + +$(RTEMS_TARGET).exe: $(OBJS) $(CXXOBJS) + $(CXX) $(CFLAGS) $(LDFLAGS) $(EXTRA_LFLAGS) $^ -o $@ $(NLIBS) + + +endif diff --git a/packages/services/gfx/mw/current/src/rtems/mw_uid_test.cc b/packages/services/gfx/mw/current/src/rtems/mw_uid_test.cc new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/rtems/mw_uid_test.cc @@ -0,0 +1,101 @@ +/* +*/ + +#include +#include +#include +#include +#include + +#include +#include + +static const char *Q_NAME = "MWQ"; +#define Q_MAX_MSGS 128 + + +/* + * "Select() routine called by the MicroWindows framework to receive events + * from the input devices. + */ +void GsSelect(void) +{ + struct MW_UID_MESSAGE m; + int rc; + + /* let's make sure that the type is invalid */ + m.type = MV_UID_INVALID; + + /* wait up to 100 milisecons for events */ + rc = uid_read_message( &m, 100 ); + + /* return if timed-out or something went wrong */ + if( rc < 0 ) + { + if( errno != ETIMEDOUT ) + printf( " rc= %d, errno=%d\n", rc, errno ); + return; + } + /* let's pass the event up to microwindows */ + switch( m.type ) + { + /* Mouse or Touch Screen event */ + case MV_UID_REL_POS: + case MV_UID_ABS_POS: + printf( "Mouse: btns=%X, dx=%d, dy=%d, dz=%d\n", + m.m.pos.btns, m.m.pos.x, m.m.pos.y, m.m.pos.z ); + break; + + + /* KBD event */ + case MV_UID_KBD: + printf( "Kbd: code=%X, modifiers=%X, mode=%d\n", + (unsigned char )m.m.kbd.code, m.m.kbd.modifiers, m.m.kbd.mode ); + break; + + /* micro-windows does nothing with those.. */ + case MV_UID_TIMER: + case MV_UID_INVALID: + default: + ; + } +} + +extern "C" int close( int ); +extern "C" int rtems_main(int argc, char **argv) +{ + int status; + printf( "Starting untar file.\n" ); + struct MW_UID_MESSAGE m; + + int rc; + /* if this is the first time around, create the message queue */ + rc = uid_open_queue( Q_NAME, O_CREAT | O_RDWR, Q_MAX_MSGS ); + + printf( "Open QUEUE=%X\n", rc ); + + int mouse_fd = open( "/dev/mouse", O_NONBLOCK ); + uid_register_device( mouse_fd, Q_NAME ); + + /* kbd it is already opened */ + int kbd_fd = fileno( stdin ); + uid_register_device( kbd_fd, Q_NAME ); + + int old_mode = 0; + /* set keyboard to scanmode */ + rc = uid_set_kbd_mode( kbd_fd, MV_KEY_MODE_SCANCODE, &old_mode ); + printf( "Kbd OldMode=%X, rc=%d\n", old_mode, rc ); + while( TRUE ) + { + GsSelect(); + } + uid_unregister_device( kbd_fd ); + uid_unregister_device( mouse_fd ); + rc = uid_close_queue(); + printf( "Close QUEUE=%X\n", rc ); + + close( mouse_fd ); + + fprintf(stdout, "About to leave main()\n" ); + return 0; +} diff --git a/packages/services/gfx/mw/current/src/rtems/net_cfg.h b/packages/services/gfx/mw/current/src/rtems/net_cfg.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/rtems/net_cfg.h @@ -0,0 +1,121 @@ +/*************************************************************************** + * + * $Header: /usr/cvs/microwin/src/rtems/net_cfg.h,v 1.1.1.1 2001/06/21 06:32:42 greg Exp $ + * + * MODULE DESCRIPTION: This module specializes the RTEMS Network configuration + * for the omniORB examples. It could be used as a starting + * point of an application using omniORB and RTEMS. + * + * This file was based on "networkconfig.h" that comes with the netdemos + * examples that ships with the RTEMS distribution. + * + * NOTE: This file must be modified to match your environment. + * + * by: Rosimildo da Silva: + * rdasilva@connecttel.com + * http://www.connecttel.com + * + * MODIFICATION/HISTORY: + * + * $Log: net_cfg.h,v $ + * Revision 1.1.1.1 2001/06/21 06:32:42 greg + * Microwindows pre8 with patches + * + * Revision 1.1.1.1 2001/06/05 03:44:03 root + * First import of 5/5/2001 Microwindows to CVS + * + ****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/* +#define RTEMS_USE_BOOTP +*/ + +#include +#include + +/* + * Define RTEMS_SET_ETHERNET_ADDRESS if you want to specify the + * Ethernet address here. If RTEMS_SET_ETHERNET_ADDRESS is not + * defined the driver will choose an address. + */ +#define RTEMS_SET_ETHERNET_ADDRESS +#if (defined (RTEMS_SET_ETHERNET_ADDRESS)) +static char ethernet_address[6] = { 0x20, 0x00, 0x27, 0xAF, 0x03, 0x51 }; +#endif + +#undef RTEMS_BSP_NETWORK_DRIVER_NAME +#define RTEMS_BSP_NETWORK_DRIVER_NAME "ep0" + +extern int rtems_3c509_driver_attach( struct rtems_bsdnet_ifconfig *config ); +#undef RTEMS_BSP_NETWORK_DRIVER_ATTACH +#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_3c509_driver_attach + +/* + * Default network interface + */ +static struct rtems_bsdnet_ifconfig netdriver_config = +{ + RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */ + RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */ + + NULL, /* link to next interface */ + +#if (defined (RTEMS_USE_BOOTP)) + NULL, /* BOOTP supplies IP address */ + NULL, /* BOOTP supplies IP net mask */ +#else + "192.168.0.11", /* IP address */ + "255.255.255.0", /* IP net mask */ +#endif /* !RTEMS_USE_BOOTP */ + +#if (defined (RTEMS_SET_ETHERNET_ADDRESS)) + ethernet_address, /* Ethernet hardware address */ +#else + NULL, /* Driver supplies hardware address */ +#endif + 0 /* Use default driver parameters */ +}; + +/* + * Network configuration + */ +struct rtems_bsdnet_config rtems_bsdnet_config = { + &netdriver_config, + +#if (defined (RTEMS_USE_BOOTP)) + rtems_bsdnet_do_bootp, +#else + NULL, +#endif + + 0, /* Default network task priority */ + 0, /* Default mbuf capacity */ + 0, /* Default mbuf cluster capacity */ + +#if (!defined (RTEMS_USE_BOOTP)) + "lucila", /* Host name */ + "rps.com", /* Domain name */ + "192.168.0.1", /* Gateway */ + "192.168.0.1", /* Log host */ + {"192.168.0.1" }, /* Name server(s) */ +#endif /* !RTEMS_USE_BOOTP */ + +}; + +/* + * For TFTP test application + */ +#if (!defined (RTEMS_USE_BOOTP)) +#define RTEMS_TFTP_TEST_HOST_NAME "192.168.0.2" +#define RTEMS_TFTP_TEST_FILE_NAME "root/boot.bt" +#endif + + +#ifdef __cplusplus +} +#endif + +/* end of include file */ diff --git a/packages/services/gfx/mw/current/src/rtems/readme.rtems b/packages/services/gfx/mw/current/src/rtems/readme.rtems new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/rtems/readme.rtems @@ -0,0 +1,215 @@ +RTEMS Setup +=========== + +This file provide instructions on how to configure and build Microwindows +for RTEMS. It is assumed that you are familiar enough with RTEMS and Microwindows, +and have a development environment that works with both systems. If you are not, +it is encouraged to play around with each one these packages first, separately, +before you start mixing them together. + + +NOTE: Microwindows code does not compile when ITRON API is enabled -- need fix + + +a) RTEMS --- Patching & Building +========================== + + + Download RTEMS source (rtems-4.5.0-beta3.tgz) from Oarcorp. + + + make a build directory + mkdir work + + + untar rtems beta3 + cd work + tar xzf rtems-4.5.0-beta3.tgz + + + Download rtems and microwindows patches from Rosimildo's site. + - rtems-4.5.0beta2-microwin-0.88.patch + - microwin-088pre7-rtems.patch + + + Apply rtems-4.5.0beta3-microwin-0.88.patch. + cd rtems-4.5.0-beta3 + patch -p1 <../rtems-4.5.0beta3-microwin-0.88.patch + + NOTE: find . -name "*.rej", t check for rejects. + + # Regenerate some RTEMS build structure. You may need to update + # autoconf and automake packages on your machine. + ./bootstrap + + + + Mouse driver setup: +This needs to be improved later. Right now this is utter complex. +It reminds me setting up GRUB. :-). + +You need to edit the device driver table in rtemscfg.h, around line 61. +There are two "/dev/mouse" drivers on RTEMS. Only one of them can be +loaded on the system. Select the one that fits your needs. + + i) for PS/2 mouse: +Select to load PAUX_DRIVER_TABLE_ENTRY in the device driver table. You +would do this, defining PS2_MOUSE in the file rtemscfg.h before the +device driver table. + +#define PS2_MOUSE + + ii) Serial Mouse + +-- Select the mouse type: "ms", "pc". Most serial mouses are microsoft ( "ms" ) +compatible. This is the default selection. + + +-- Select serial port -- defaul is COM1 + +Both selections are made in the header file: + $RTEMS_SOURCE)/c/src/lib/libbsp/i386/pc386/console/serial_mouse.h +around line 72. + +[snip from $RTEMS_SOURCE)/c/src/lib/libbsp/i386/pc386/console/serial_mouse.h ] +/* Select the mouse type: "ms","pc","ps2" */ +#define MOUSE_TYPE "ms" + +/* Select the serial port used by the mouse driver */ +#define SERIAL_MOUSE_COM1 1 +/* #define SERIAL_MOUSE_COM2 1 */ + +IMPORTANT: Any change on one of these settings, requires recompilation of RTEMS. + + + +Configure and install RTEMS. This assumes RPMs are installed +and tools are available as /opt/rtems. You will need to +be able to write into the /opt/rtems directory so you will +likely have to be root to do the "make install" step. +I am using the c build scripts and you should look +at user.cfg to make sure it is OK for you. + + ./bit_rtems i386 pc386 + # takes a while and ends up with /opt/rtems/pc386 installed + + +b) MicroWindows --- Patching & Building +======================================= + + + Downloaded Microwindows source (microwindows-0.88pre7.tar.gz) from censoft. + + + make a build directory + mkdir work + + + untar microwindows + cd work + tar xzf microwindows-0.88pre7.tar.gz + + + Apply microwin-088pre7-rtems.patch. + cd microwin + patch -p1 <../microwin-088pre7-rtems.patch + +Found readme.rtems in microwin source: + + bash$ find . -name "readme.rtems" + ./src/rtems/readme.rtems + +Per readme.rtems use config.rtems for Microwindows. + + cd microwin + cd src + cp config config.SHIP + cp config.rtems config + + +Edit config to localize it. Make sure these variables are +set as shown below: + + RTEMSTOOLSPREFIX = i386-rtems- + RTEMS_BUILD = /opt/rtems + +Now build microwindows: + + cd src + make + + NOTE: This does not build the demos. + +Now build the demos. + + src/rtems/Makefile.rtems is intended to be used to each of the + demos. You have a couple of issues... + + + This builds whatever demo is selected by the definition + of MAIN_OBJ around line 52 of Makefile.rtems. + + + This produces rtems.exe for each demo. It is quite large + so you might want to strip it like this: + +bash$ cp rtems.exe rtems_nosym.exe +bash$ i386-rtems-strip rtems_nosym.exe + + + +c) Microwindows Configuration +============================= + +NOTE: You can use the default configuration for RTEMS -- + copy config.rtems to config + + --> or + +1. Select the architecture to be RTEMS. :-) +ARCH = RTEMS + +2. No demos are built for RTEMS. Later, using the Makefile under the +rtems directory you can select whatever you need to build. This is because +RTEMS requires special configuration tables, and a definition of the +"Init" task. + + + A demo is selected by the definition of MAIN_OBJ around line 52 +of Makefile.rtems. + +MICROWINDEMO = N +NANOXDEMO = N + + +3. color scheme -- ( unless you wrote the super-duper video driver for RTEMS ) +SCREEN_PIXTYPE = PF_PALETTE + + +4. Nano-X server linked with client as a single executable +LINK_APP_INTO_SERVER = Y + + +5.1. Enable the Micro FrameBuffer interface. +FRAMEBUFFER = Y +FBVGA = Y + + ==> or + +5.2. For SVGALIB -- This requires you have the SVGALIB support under RTEMS. +Please go to this site for more information: +http://members/xoom.com/rosimildo/rtems_svga.html + +LIBVGA = Y + + + +c) KBD & MOUSE Test +=================== + +A test program has been added to help debugging the input devices. It is +called rtems/mw_uid_test.cc. Modify the Makefile to build it. It'll help +making sure that mouse&kbd works. + + + + +Credits +======= + +I'd like to Thank Joel Sherrill for going over the original notes, and +prividing me with his own notes to be merged here. + + + + +Good Luck !!!. + +Rosimildo. diff --git a/packages/services/gfx/mw/current/src/rtems/rtems_init.c b/packages/services/gfx/mw/current/src/rtems/rtems_init.c new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/rtems/rtems_init.c @@ -0,0 +1,86 @@ +/* +///////////////////////////////////////////////////////////////////////////// +// $Header: /usr/cvs/microwin/src/rtems/rtems_init.c,v 1.1.1.1 2001/06/21 06:32:42 greg Exp $ +// +// Copyright (c) 1999 ConnectTel, Inc. All Rights Reserved. +// +// MODULE DESCRIPTION: +// +// RTEMS Init Task for a MicroWindows application that +// may or may not use network functionality. +// +// by: Rosimildo da Silva: +// rdasilva@connecttel.com +// http://www.connecttel.com +// +// MODIFICATION/HISTORY: +// $Log: rtems_init.c,v $ +// Revision 1.1.1.1 2001/06/21 06:32:42 greg +// Microwindows pre8 with patches +// +// Revision 1.1.1.1 2001/06/05 03:44:03 root +// First import of 5/5/2001 Microwindows to CVS +// +// +///////////////////////////////////////////////////////////////////////////// +*/ + +#define CONFIGURE_INIT +#include +#include "rtemscfg.h" + +#ifndef NONETWORK +#include "net_cfg.h" +#include +#include +#include +#include +#include +#endif +#include "device.h" /* DPRINTF() macro */ + +/* Enable the following define if you want to debug this application */ +/* #define USE_REMOTE_GDB__ */ +#ifdef USE_REMOTE_GDB__ +extern void init_remote_gdb( void ); +#define BREAKPOINT() asm(" int $3"); +#endif + +/* this is the command line options to be passed to the main routine */ +char *cc_argv[] = +{ + "cc_main", /* arg[ 0 ] -- always the name of the program */ +}; +int cc_argc = sizeof( cc_argv ) / sizeof( cc_argv[ 0 ] ); + + +extern int rtems_main(int argc, char **argv); + +/* + * DESCRIPTION: Init task for any MicroWindows/RTEMS application. + */ +void *POSIX_Init( void *argument ) +{ + size_t st = 0; + +#ifdef USE_REMOTE_GDB__ + init_remote_gdb(); +/* BREAKPOINT(); */ +#endif + + DPRINTF( "\nStarting RTEMS init task...\n" ); + +#ifndef NONETWORK + /* Make all network initialization */ + rtems_bsdnet_initialize_network(); + DPRINTF( "Netowrk Initialization is complete.\n\n" ); +#endif + + st = _Thread_Executing->Start.Initial_stack.size; + DPRINTF( "Init Task Stack Size is: %d\n", st ); + + rtems_main( cc_argc, cc_argv ); + DPRINTF( "*** Done ***\n\n\n" ); + pthread_exit( NULL ); + return NULL; /* just so the compiler thinks we returned something */ +} diff --git a/packages/services/gfx/mw/current/src/rtems/rtemscfg.h b/packages/services/gfx/mw/current/src/rtems/rtemscfg.h new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/rtems/rtemscfg.h @@ -0,0 +1,101 @@ +/*************************************************************************** + * + * $Header: /usr/cvs/microwin/src/rtems/rtemscfg.h,v 1.1.1.1 2001/06/21 06:32:42 greg Exp $ + * + * Copyright (c) 1999 ConnectTel, Inc. All Rights Reserved. + * + * MODULE DESCRIPTION: RTEMS configuration file. This file should be + * udpated to match your own configuration. + * + * by: Rosimildo da Silva: + * rdasilva@connecttel.com + * http://www.connecttel.com + * + * MODIFICATION/HISTORY: + * + * $Log: rtemscfg.h,v $ + * Revision 1.1.1.1 2001/06/21 06:32:42 greg + * Microwindows pre8 with patches + * + * Revision 1.1.1.1 2001/06/05 03:44:03 root + * First import of 5/5/2001 Microwindows to CVS + * + ****************************************************************************/ + + +#include /* includes */ +#include +#include +#include +#include + +/* functions */ +#ifdef __cplusplus +extern "C" { +#endif + +/* configuration information */ +#define CONFIGURE_MAXIMUM_DEVICES 40 +#define CONFIGURE_MAXIMUM_TASKS 300 +#define CONFIGURE_MAXIMUM_TIMERS 32 +#define CONFIGURE_MAXIMUM_SEMAPHORES 100 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 20 +#define CONFIGURE_MAXIMUM_PARTITIONS 10 +#define CONFIGURE_MAXIMUM_REGIONS 10 + +/* This seetings overwrite the ones defined in confdefs.h */ +#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 32 +#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 32 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 32 +#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 10 +#define CONFIGURE_MAXIMUM_POSIX_THREADS 256 +#define CONFIGURE_MAXIMUM_POSIX_TIMERS 10 + +/* used by the input device driver */ +#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 10 + +void *POSIX_Init( void *argument ); +#define CONFIGURE_INIT_TASK_STACK_SIZE (512*1024) +#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE (512*1024) +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + + +#define CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 + + +/* List of device drivers loaded by RTEMS at boot time */ +rtems_driver_address_table Device_drivers[] = +{ + CONSOLE_DRIVER_TABLE_ENTRY, + CLOCK_DRIVER_TABLE_ENTRY, + +/* this can be a bit tricky: If you are using a serial mouse, + make sure that you do not install and serial driver that + uses the same port !!!! +*/ + TTY2_DRIVER_TABLE_ENTRY, + +#if PS2_MOUSE + PAUX_DRIVER_TABLE_ENTRY, +#else + + /* + * Make sure that you have selected the COM port and the + * mouse type in ( c/src/lib/libbsp/i386/pc386/console/serial_mouse.h ). + */ + SERIAL_MOUSE_DRIVER_TABLE_ENTRY, +#endif + + /* Standard VGA driver */ + FBVGA_DRIVER_TABLE_ENTRY, + + { NULL,NULL, NULL,NULL,NULL, NULL } +}; + +#include + +#ifdef __cplusplus +} +#endif +/* end of include file */ diff --git a/packages/services/gfx/mw/current/src/scribble.sh b/packages/services/gfx/mw/current/src/scribble.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/scribble.sh @@ -0,0 +1,1 @@ +bin/nano-X & bin/nxkbd & bin/nxscribble & bin/nanowm & bin/nxterm & bin/nxterm & sleep 10000 diff --git a/packages/services/gfx/mw/current/src/slider.sh b/packages/services/gfx/mw/current/src/slider.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/slider.sh @@ -0,0 +1,1 @@ +bin/nano-X & bin/nanowm & bin/slider demos/nanox/slidebmp.bmp ; sleep 10000 diff --git a/packages/services/gfx/mw/current/src/t1demo.sh b/packages/services/gfx/mw/current/src/t1demo.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/t1demo.sh @@ -0,0 +1,1 @@ +bin/nano-X & bin/nanowm & bin/t1demo diff --git a/packages/services/gfx/mw/current/src/tcmwin.mak b/packages/services/gfx/mw/current/src/tcmwin.mak new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/tcmwin.mak @@ -0,0 +1,575 @@ +# +# Borland C++ IDE generated makefile +# Generated 2000/4/21 at PM 02:09:29 +# +.AUTODEPEND + + +# +# Borland C++ tools +# +IMPLIB = Implib +BCCDOS = Bcc +BccDos.cfg +TLINK = TLink +TLIB = TLib +TASM = Tasm +# +# IDE macros +# + + +# +# Options +# +BC_Path = C:\BC5 +BC_Lib_Path = $(BC_Path)\LIB +BGI_Path = $(BC_Path)\BGI +MW_Path = D:\microwin +IDE_LinkFLAGSDOS = -L$(BC_Lib_Path) +IDE_BFLAGS = +CompLocalOptsAtDOS_mwdlib = -ml -f- +LinkerLocalOptsAtDOS_mwdlib = -c -Tde +ResLocalOptsAtDOS_mwdlib = +BLocalOptsAtDOS_mwdlib = +CompOptsAt_mwdlib = $(CompLocalOptsAtDOS_mwdlib) +CompInheritOptsAt_mwdlib = -I$(MW_Path)\SRC\INCLUDE;$(MW_Path)\SRC\DRIVERS;$(MW_Path)\SRC\ENGINE;$(MW_Path)\SRC\MWIN;$(MW_Path)\SRC\MWIN\WINLIB;$(BC_Path)\INCLUDE -DMSDOS=1;DOS_TURBOC=1 +LinkerInheritOptsAt_mwdlib = -x +LinkerOptsAt_mwdlib = $(LinkerLocalOptsAtDOS_mwdlib) +ResOptsAt_mwdlib = $(ResLocalOptsAtDOS_mwdlib) +BOptsAt_mwdlib = $(BLocalOptsAtDOS_mwdlib) +CompLocalOptsAtDOS_demodexe = -ml -f287 +LinkerLocalOptsAtDOS_demodexe = -c -Tde +ResLocalOptsAtDOS_demodexe = +BLocalOptsAtDOS_demodexe = +CompOptsAt_demodexe = $(CompLocalOptsAtDOS_demodexe) +CompInheritOptsAt_demodexe = -I$(MW_Path)\SRC\INCLUDE;$(BC_Path)\INCLUDE -DMSDOS=1;DOS_TURBOC=1 +LinkerInheritOptsAt_demodexe = -x +LinkerOptsAt_demodexe = $(LinkerLocalOptsAtDOS_demodexe) +ResOptsAt_demodexe = $(ResLocalOptsAtDOS_demodexe) +BOptsAt_demodexe = $(BLocalOptsAtDOS_demodexe) +CompLocalOptsAtDOS_minedexe = -ml -f287 +LinkerLocalOptsAtDOS_minedexe = -c -Tde +ResLocalOptsAtDOS_minedexe = +BLocalOptsAtDOS_minedexe = +CompOptsAt_minedexe = $(CompLocalOptsAtDOS_minedexe) +CompInheritOptsAt_minedexe = -I$(MW_Path)\SRC\INCLUDE;$(BC_Path)\INCLUDE;$(MW_Path)\SRC\DEMOS\MWIN +LinkerInheritOptsAt_minedexe = -x +LinkerOptsAt_minedexe = $(LinkerLocalOptsAtDOS_minedexe) +ResOptsAt_minedexe = $(ResLocalOptsAtDOS_minedexe) +BOptsAt_minedexe = $(BLocalOptsAtDOS_minedexe) +CompLocalOptsAtDOS_demosbmwinbminedc = +LinkerLocalOptsAtDOS_demosbmwinbminedc = +ResLocalOptsAtDOS_demosbmwinbminedc = +BLocalOptsAtDOS_demosbmwinbminedc = +CompOptsAt_demosbmwinbminedc = $(CompOptsAt_minedexe) $(CompLocalOptsAtDOS_demosbmwinbminedc) +CompInheritOptsAt_demosbmwinbminedc = -I$(MW_Path)\SRC\INCLUDE;$(BC_Path)\INCLUDE;$(MW_Path)\SRC\DEMOS\MWIN +LinkerInheritOptsAt_demosbmwinbminedc = -x +LinkerOptsAt_demosbmwinbminedc = $(LinkerOptsAt_minedexe) $(LinkerLocalOptsAtDOS_demosbmwinbminedc) +ResOptsAt_demosbmwinbminedc = $(ResOptsAt_minedexe) $(ResLocalOptsAtDOS_demosbmwinbminedc) +BOptsAt_demosbmwinbminedc = $(BOptsAt_minedexe) $(BLocalOptsAtDOS_demosbmwinbminedc) +CompLocalOptsAtDOS_malphadexe = -ml -f- +LinkerLocalOptsAtDOS_malphadexe = -c -Tde +ResLocalOptsAtDOS_malphadexe = +BLocalOptsAtDOS_malphadexe = +CompOptsAt_malphadexe = $(CompLocalOptsAtDOS_malphadexe) +CompInheritOptsAt_malphadexe = -I$(MW_Path)\SRC\INCLUDE;$(BC_Path)\INCLUDE -DMSDOS=1;DOS_TURBOC=1 +LinkerInheritOptsAt_malphadexe = -x +LinkerOptsAt_malphadexe = $(LinkerLocalOptsAtDOS_malphadexe) +ResOptsAt_malphadexe = $(ResLocalOptsAtDOS_malphadexe) +BOptsAt_malphadexe = $(BLocalOptsAtDOS_malphadexe) +CompLocalOptsAtDOS_mtestdexe = -ml -f- +LinkerLocalOptsAtDOS_mtestdexe = -c -Tde +ResLocalOptsAtDOS_mtestdexe = +BLocalOptsAtDOS_mtestdexe = +CompOptsAt_mtestdexe = $(CompLocalOptsAtDOS_mtestdexe) +CompInheritOptsAt_mtestdexe = -I$(MW_Path)\SRC\INCLUDE;$(BC_Path)\INCLUDE -DMSDOS=1;DOS_TURBOC=1 +LinkerInheritOptsAt_mtestdexe = -x +LinkerOptsAt_mtestdexe = $(LinkerLocalOptsAtDOS_mtestdexe) +ResOptsAt_mtestdexe = $(ResLocalOptsAtDOS_mtestdexe) +BOptsAt_mtestdexe = $(BLocalOptsAtDOS_mtestdexe) + +# +# Dependency List +# +Dep_mw = \ + mw.lib\ + demo.exe\ + mine.exe\ + malpha.exe\ + mtest.exe + +mw : BccDos.cfg $(Dep_mw) + echo MakeNode + +Dep_mwdlib = \ + egavga.obj\ + rom8x16.obj\ + winfreesansserif11x13.obj\ + winfreesystem14x16.obj\ + x6x13.obj\ + genfont.obj\ + kbd_tc.obj\ + mou_dos.obj\ + scr_tc.obj\ + devclip.obj\ + devdraw.obj\ + devkbd.obj\ + devlist.obj\ + devfont.obj\ + devmouse.obj\ + devpal4.obj\ + devpal2.obj\ + devpal1.obj\ + devrgn.obj\ + devrgn2.obj\ + devarc.obj\ + error.obj\ + cs1.obj\ + button.obj\ + edit.obj\ + progbar.obj\ + listbox.obj\ + draw3d.obj\ + fastfill.obj\ + graph3d.obj\ + insetr.obj\ + ptinsid.obj\ + mwuser.obj\ + winsbar.obj\ + winclip.obj\ + windefw.obj\ + winevent.obj\ + winexpos.obj\ + wingdi.obj\ + winmain.obj\ + winuser.obj + +mw.lib : $(Dep_mwdlib) + $(TLIB) $< $(IDE_BFLAGS) $(BOptsAt_mwdlib) @&&| + -+egavga.obj & +-+rom8x16.obj & +-+winfreesansserif11x13.obj & +-+winfreesystem14x16.obj & +-+x6x13.obj & +-+genfont.obj & +-+kbd_tc.obj & +-+mou_dos.obj & +-+scr_tc.obj & +-+devclip.obj & +-+devdraw.obj & +-+devkbd.obj & +-+devlist.obj & +-+devfont.obj & +-+devmouse.obj & +-+devpal4.obj & +-+devpal2.obj & +-+devpal1.obj & +-+devrgn.obj & +-+devrgn2.obj & +-+devarc.obj & +-+error.obj & +-+cs1.obj & +-+button.obj & +-+edit.obj & +-+progbar.obj & +-+listbox.obj & +-+draw3d.obj & +-+fastfill.obj & +-+graph3d.obj & +-+insetr.obj & +-+ptinsid.obj & +-+mwuser.obj & +-+winsbar.obj & +-+winclip.obj & +-+windefw.obj & +-+winevent.obj & +-+winexpos.obj & +-+wingdi.obj & +-+winmain.obj & +-+winuser.obj +| + +rom8x16.obj : fonts\rom8x16.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ fonts\rom8x16.c +| + +winfreesansserif11x13.obj : fonts\winfreesansserif11x13.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ fonts\winfreesansserif11x13.c +| + +winfreesystem14x16.obj : fonts\winfreesystem14x16.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ fonts\winfreesystem14x16.c +| + +x6x13.obj : fonts\x6x13.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ fonts\x6x13.c +| + +genfont.obj : drivers\genfont.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ drivers\genfont.c +| + +kbd_tc.obj : drivers\kbd_tc.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ drivers\kbd_tc.c +| + +mou_dos.obj : drivers\mou_dos.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ drivers\mou_dos.c +| + +scr_tc.obj : drivers\scr_tc.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ drivers\scr_tc.c +| + +devclip.obj : engine\devclip.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devclip.c +| + +devdraw.obj : engine\devdraw.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devdraw.c +| + +devkbd.obj : engine\devkbd.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devkbd.c +| + +devlist.obj : engine\devlist.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devlist.c +| + +devfont.obj : engine\devfont.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devfont.c +| + +devmouse.obj : engine\devmouse.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devmouse.c +| + +devpal4.obj : engine\devpal4.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devpal4.c +| + +devpal2.obj : engine\devpal2.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devpal2.c +| + +devpal1.obj : engine\devpal1.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devpal1.c +| + +devrgn.obj : engine\devrgn.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devrgn.c +| + +devrgn2.obj : engine\devrgn2.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devrgn2.c +| + +devarc.obj : engine\devarc.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devarc.c +| + +error.obj : engine\error.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\error.c +| + +cs1.obj : mwin\bmp\cs1.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\bmp\cs1.c +| + +button.obj : mwin\winlib\button.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\button.c +| + +edit.obj : mwin\winlib\edit.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\edit.c +| + +progbar.obj : mwin\winlib\progbar.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\progbar.c +| + +listbox.obj : mwin\winlib\listbox.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\listbox.c +| + +draw3d.obj : mwin\winlib\draw3d.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\draw3d.c +| + +fastfill.obj : mwin\winlib\fastfill.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\fastfill.c +| + +graph3d.obj : mwin\winlib\graph3d.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\graph3d.c +| + +insetr.obj : mwin\winlib\insetr.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\insetr.c +| + +ptinsid.obj : mwin\winlib\ptinsid.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\ptinsid.c +| + +mwuser.obj : mwin\winlib\mwuser.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\mwuser.c +| + +winsbar.obj : mwin\winsbar.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winsbar.c +| + +winclip.obj : mwin\winclip.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winclip.c +| + +windefw.obj : mwin\windefw.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\windefw.c +| + +winevent.obj : mwin\winevent.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winevent.c +| + +winexpos.obj : mwin\winexpos.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winexpos.c +| + +wingdi.obj : mwin\wingdi.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\wingdi.c +| + +winmain.obj : mwin\winmain.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winmain.c +| + +winuser.obj : mwin\winuser.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winuser.c +| + +Dep_demodexe = \ + mw.lib\ + microwin.obj\ + penguin.obj\ + demo.obj + +demo.exe : $(Dep_demodexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demodexe) $(LinkerInheritOptsAt_demodexe) + +$(BC_Lib_Path)\c0l.obj+ +microwin.obj+ +penguin.obj+ +demo.obj +$<,$* +mw.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +microwin.obj : mwin\bmp\microwin.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_demodexe) $(CompInheritOptsAt_demodexe) -o$@ mwin\bmp\microwin.c +| + +penguin.obj : mwin\bmp\penguin.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_demodexe) $(CompInheritOptsAt_demodexe) -o$@ mwin\bmp\penguin.c +| + +demo.obj : demos\mwin\demo.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_demodexe) $(CompInheritOptsAt_demodexe) -o$@ demos\mwin\demo.c +| + +Dep_minedexe = \ + mw.lib\ + minebomb.obj\ + minedone.obj\ + mineface.obj\ + mineflag.obj\ + minehitf.obj\ + minelost.obj\ + mine.obj + +mine.exe : $(Dep_minedexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_minedexe) $(LinkerInheritOptsAt_minedexe) + +$(BC_Lib_Path)\c0l.obj+ +minebomb.obj+ +minedone.obj+ +mineface.obj+ +mineflag.obj+ +minehitf.obj+ +minelost.obj+ +mine.obj +$<,$* +mw.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +minebomb.obj : demos\mwin\minebomb.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\minebomb.c +| + +minedone.obj : demos\mwin\minedone.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\minedone.c +| + +mineface.obj : demos\mwin\mineface.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\mineface.c +| + +mineflag.obj : demos\mwin\mineflag.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\mineflag.c +| + +minehitf.obj : demos\mwin\minehitf.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\minehitf.c +| + +minelost.obj : demos\mwin\minelost.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\minelost.c +| + +mine.obj : demos\mwin\mine.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_demosbmwinbminedc) $(CompInheritOptsAt_demosbmwinbminedc) -o$@ demos\mwin\mine.c +| + +Dep_malphadexe = \ + mw.lib\ + car8.obj\ + malpha.obj + +malpha.exe : $(Dep_malphadexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_malphadexe) $(LinkerInheritOptsAt_malphadexe) + +$(BC_Lib_Path)\c0l.obj+ +car8.obj+ +malpha.obj +$<,$* +mw.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +car8.obj : mwin\bmp\car8.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_malphadexe) $(CompInheritOptsAt_malphadexe) -o$@ mwin\bmp\car8.c +| + +malpha.obj : demos\mwin\malpha.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_malphadexe) $(CompInheritOptsAt_malphadexe) -o$@ demos\mwin\malpha.c +| + +Dep_mtestdexe = \ + mw.lib\ + mtest.obj + +mtest.exe : $(Dep_mtestdexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_mtestdexe) $(LinkerInheritOptsAt_mtestdexe) + +$(BC_Lib_Path)\c0l.obj+ +mtest.obj +$<,$* +mw.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +mtest.obj : demos\mwin\mtest.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_mtestdexe) $(CompInheritOptsAt_mtestdexe) -o$@ demos\mwin\mtest.c +| + +# Compiler configuration file +BccDos.cfg : + Copy &&| +-W- +-w +-R +-v +-vi +-H +-H=mw.csm +| $@ + + +clean : + del *.obj + del *.lib + del *.exe + del *.csm + del BccDos.cfg + +egavga.obj : + copy $(BGI_Path)\egavga.bgi . + $(BGI_Path)\bgiobj egavga + del egavga.bgi + diff --git a/packages/services/gfx/mw/current/src/tcnanox.mak b/packages/services/gfx/mw/current/src/tcnanox.mak new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/tcnanox.mak @@ -0,0 +1,719 @@ +# +# Borland C++ IDE generated makefile +# Generated 2000/4/20 at PM 05:57:12 +# +.AUTODEPEND + + +# +# Borland C++ tools +# +IMPLIB = Implib +BCCDOS = Bcc +BccDos.cfg +TLINK = TLink +TLIB = TLib +TASM = Tasm +# +# IDE macros +# + + +# +# Options +# +BC_Path = C:\BC5 +BC_Lib_Path = $(BC_Path)\LIB +BGI_Path = $(BC_Path)\BGI +MW_Path = D:\microwin +IDE_LinkFLAGSDOS = -L$(BC_Lib_Path) +IDE_BFLAGS = +CompLocalOptsAtDOS_nanoxdlib = -ml -f- +LinkerLocalOptsAtDOS_nanoxdlib = -c -Tde +ResLocalOptsAtDOS_nanoxdlib = +BLocalOptsAtDOS_nanoxdlib = +CompOptsAt_nanoxdlib = $(CompLocalOptsAtDOS_nanoxdlib) +CompInheritOptsAt_nanoxdlib = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE;$(MW_Path)\SRC\DRIVERS;$(MW_Path)\SRC\ENGINE;$(MW_Path)\SRC\NANOX -DMSDOS=1;DOS_TURBOC=1;NONETWORK=1 +LinkerInheritOptsAt_nanoxdlib = -x +LinkerOptsAt_nanoxdlib = $(LinkerLocalOptsAtDOS_nanoxdlib) +ResOptsAt_nanoxdlib = $(ResLocalOptsAtDOS_nanoxdlib) +BOptsAt_nanoxdlib = $(BLocalOptsAtDOS_nanoxdlib) +CompLocalOptsAtDOS_demodexe = -ml -f- +LinkerLocalOptsAtDOS_demodexe = -c -Tde +ResLocalOptsAtDOS_demodexe = +BLocalOptsAtDOS_demodexe = +CompOptsAt_demodexe = $(CompLocalOptsAtDOS_demodexe) +CompInheritOptsAt_demodexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_demodexe = -x +LinkerOptsAt_demodexe = $(LinkerLocalOptsAtDOS_demodexe) +ResOptsAt_demodexe = $(ResLocalOptsAtDOS_demodexe) +BOptsAt_demodexe = $(BLocalOptsAtDOS_demodexe) +CompLocalOptsAtDOS_demo2dexe = -ml -f- +LinkerLocalOptsAtDOS_demo2dexe = -c -Tde +ResLocalOptsAtDOS_demo2dexe = +BLocalOptsAtDOS_demo2dexe = +CompOptsAt_demo2dexe = $(CompLocalOptsAtDOS_demo2dexe) +CompInheritOptsAt_demo2dexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_demo2dexe = -x +LinkerOptsAt_demo2dexe = $(LinkerLocalOptsAtDOS_demo2dexe) +ResOptsAt_demo2dexe = $(ResLocalOptsAtDOS_demo2dexe) +BOptsAt_demo2dexe = $(BLocalOptsAtDOS_demo2dexe) +CompLocalOptsAtDOS_demo3dexe = -ml -f- +LinkerLocalOptsAtDOS_demo3dexe = -c -Tde +ResLocalOptsAtDOS_demo3dexe = +BLocalOptsAtDOS_demo3dexe = +CompOptsAt_demo3dexe = $(CompLocalOptsAtDOS_demo3dexe) +CompInheritOptsAt_demo3dexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_demo3dexe = -x +LinkerOptsAt_demo3dexe = $(LinkerLocalOptsAtDOS_demo3dexe) +ResOptsAt_demo3dexe = $(ResLocalOptsAtDOS_demo3dexe) +BOptsAt_demo3dexe = $(BLocalOptsAtDOS_demo3dexe) +CompLocalOptsAtDOS_demo4dexe = -ml -f- +LinkerLocalOptsAtDOS_demo4dexe = -c -Tde +ResLocalOptsAtDOS_demo4dexe = +BLocalOptsAtDOS_demo4dexe = +CompOptsAt_demo4dexe = $(CompLocalOptsAtDOS_demo4dexe) +CompInheritOptsAt_demo4dexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_demo4dexe = -x +LinkerOptsAt_demo4dexe = $(LinkerLocalOptsAtDOS_demo4dexe) +ResOptsAt_demo4dexe = $(ResLocalOptsAtDOS_demo4dexe) +BOptsAt_demo4dexe = $(BLocalOptsAtDOS_demo4dexe) +CompLocalOptsAtDOS_demo5dexe = -ml -f- +LinkerLocalOptsAtDOS_demo5dexe = -c -Tde +ResLocalOptsAtDOS_demo5dexe = +BLocalOptsAtDOS_demo5dexe = +CompOptsAt_demo5dexe = $(CompLocalOptsAtDOS_demo5dexe) +CompInheritOptsAt_demo5dexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_demo5dexe = -x +LinkerOptsAt_demo5dexe = $(LinkerLocalOptsAtDOS_demo5dexe) +ResOptsAt_demo5dexe = $(ResLocalOptsAtDOS_demo5dexe) +BOptsAt_demo5dexe = $(BLocalOptsAtDOS_demo5dexe) +CompLocalOptsAtDOS_demo6dexe = -ml -f- +LinkerLocalOptsAtDOS_demo6dexe = -c -Tde +ResLocalOptsAtDOS_demo6dexe = +BLocalOptsAtDOS_demo6dexe = +CompOptsAt_demo6dexe = $(CompLocalOptsAtDOS_demo6dexe) +CompInheritOptsAt_demo6dexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_demo6dexe = -x +LinkerOptsAt_demo6dexe = $(LinkerLocalOptsAtDOS_demo6dexe) +ResOptsAt_demo6dexe = $(ResLocalOptsAtDOS_demo6dexe) +BOptsAt_demo6dexe = $(BLocalOptsAtDOS_demo6dexe) +CompLocalOptsAtDOS_ftdemodexe = -ml -f- +LinkerLocalOptsAtDOS_ftdemodexe = -c -Tde +ResLocalOptsAtDOS_ftdemodexe = +BLocalOptsAtDOS_ftdemodexe = +CompOptsAt_ftdemodexe = $(CompLocalOptsAtDOS_ftdemodexe) +CompInheritOptsAt_ftdemodexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_ftdemodexe = -x +LinkerOptsAt_ftdemodexe = $(LinkerLocalOptsAtDOS_ftdemodexe) +ResOptsAt_ftdemodexe = $(ResLocalOptsAtDOS_ftdemodexe) +BOptsAt_ftdemodexe = $(BLocalOptsAtDOS_ftdemodexe) +CompLocalOptsAtDOS_infodexe = -ml -f- +LinkerLocalOptsAtDOS_infodexe = -c -Tde +ResLocalOptsAtDOS_infodexe = +BLocalOptsAtDOS_infodexe = +CompOptsAt_infodexe = $(CompLocalOptsAtDOS_infodexe) +CompInheritOptsAt_infodexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_infodexe = -x +LinkerOptsAt_infodexe = $(LinkerLocalOptsAtDOS_infodexe) +ResOptsAt_infodexe = $(ResLocalOptsAtDOS_infodexe) +BOptsAt_infodexe = $(BLocalOptsAtDOS_infodexe) +CompLocalOptsAtDOS_landminedexe = -ml -f- +LinkerLocalOptsAtDOS_landminedexe = -c -Tde +ResLocalOptsAtDOS_landminedexe = +BLocalOptsAtDOS_landminedexe = +CompOptsAt_landminedexe = $(CompLocalOptsAtDOS_landminedexe) +CompInheritOptsAt_landminedexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_landminedexe = -x +LinkerOptsAt_landminedexe = $(LinkerLocalOptsAtDOS_landminedexe) +ResOptsAt_landminedexe = $(ResLocalOptsAtDOS_landminedexe) +BOptsAt_landminedexe = $(BLocalOptsAtDOS_landminedexe) +CompLocalOptsAtDOS_movedexe = -ml -f- +LinkerLocalOptsAtDOS_movedexe = -c -Tde +ResLocalOptsAtDOS_movedexe = +BLocalOptsAtDOS_movedexe = +CompOptsAt_movedexe = $(CompLocalOptsAtDOS_movedexe) +CompInheritOptsAt_movedexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_movedexe = -x +LinkerOptsAt_movedexe = $(LinkerLocalOptsAtDOS_movedexe) +ResOptsAt_movedexe = $(ResLocalOptsAtDOS_movedexe) +BOptsAt_movedexe = $(BLocalOptsAtDOS_movedexe) +CompLocalOptsAtDOS_sliderdexe = -ml -f- +LinkerLocalOptsAtDOS_sliderdexe = -c -Tde +ResLocalOptsAtDOS_sliderdexe = +BLocalOptsAtDOS_sliderdexe = +CompOptsAt_sliderdexe = $(CompLocalOptsAtDOS_sliderdexe) +CompInheritOptsAt_sliderdexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_sliderdexe = -x +LinkerOptsAt_sliderdexe = $(LinkerLocalOptsAtDOS_sliderdexe) +ResOptsAt_sliderdexe = $(ResLocalOptsAtDOS_sliderdexe) +BOptsAt_sliderdexe = $(BLocalOptsAtDOS_sliderdexe) +CompLocalOptsAtDOS_waitdexe = -ml -f- +LinkerLocalOptsAtDOS_waitdexe = -c -Tde +ResLocalOptsAtDOS_waitdexe = +BLocalOptsAtDOS_waitdexe = +CompOptsAt_waitdexe = $(CompLocalOptsAtDOS_waitdexe) +CompInheritOptsAt_waitdexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_waitdexe = -x +LinkerOptsAt_waitdexe = $(LinkerLocalOptsAtDOS_waitdexe) +ResOptsAt_waitdexe = $(ResLocalOptsAtDOS_waitdexe) +BOptsAt_waitdexe = $(BLocalOptsAtDOS_waitdexe) +CompLocalOptsAtDOS_worlddexe = -ml -f- +LinkerLocalOptsAtDOS_worlddexe = -c -Tde +ResLocalOptsAtDOS_worlddexe = +BLocalOptsAtDOS_worlddexe = +CompOptsAt_worlddexe = $(CompLocalOptsAtDOS_worlddexe) +CompInheritOptsAt_worlddexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE +LinkerInheritOptsAt_worlddexe = -x +LinkerOptsAt_worlddexe = $(LinkerLocalOptsAtDOS_worlddexe) +ResOptsAt_worlddexe = $(ResLocalOptsAtDOS_worlddexe) +BOptsAt_worlddexe = $(BLocalOptsAtDOS_worlddexe) + +# +# Dependency List +# +Dep_nanox = \ + nanox.lib\ + demo.exe\ + demo2.exe\ + demo3.exe\ + demo4.exe\ + demo5.exe\ + demo6.exe\ + ftdemo.exe\ + info.exe\ + landmine.exe\ + move.exe\ + slider.exe\ + wait.exe\ + world.exe + +nanox : BccDos.cfg $(Dep_nanox) + echo MakeNode + +Dep_nanoxdlib = \ + egavga.obj\ + x6x13.obj\ + rom8x16.obj\ + winfreesansserif11x13.obj\ + winfreesystem14x16.obj\ + genfont.obj\ + mou_dos.obj\ + kbd_tc.obj\ + scr_tc.obj\ + devclip.obj\ + devpal4.obj\ + devpal2.obj\ + devpal1.obj\ + devmouse.obj\ + devkbd.obj\ + devfont.obj\ + devdraw.obj\ + devrgn.obj\ + devrgn2.obj\ + devarc.obj\ + error.obj\ + srvclip.obj\ + srvutil.obj\ + srvmain.obj\ + srvfunc.obj\ + srvevent.obj\ + stubs.obj + +nanox.lib : $(Dep_nanoxdlib) + $(TLIB) $< $(IDE_BFLAGS) $(BOptsAt_nanoxdlib) @&&| + -+egavga.obj & +-+x6x13.obj & +-+rom8x16.obj & +-+winfreesansserif11x13.obj & +-+winfreesystem14x16.obj & +-+genfont.obj & +-+mou_dos.obj & +-+kbd_tc.obj & +-+scr_tc.obj & +-+devclip.obj & +-+devpal4.obj & +-+devpal2.obj & +-+devpal1.obj & +-+devmouse.obj & +-+devkbd.obj & +-+devfont.obj & +-+devdraw.obj & +-+devrgn.obj & +-+devrgn2.obj & +-+devarc.obj & +-+error.obj & +-+srvclip.obj & +-+srvutil.obj & +-+srvmain.obj & +-+srvfunc.obj & +-+srvevent.obj & +-+stubs.obj +| + +x6x13.obj : fonts\x6x13.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ fonts\x6x13.c +| + +rom8x16.obj : fonts\rom8x16.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ fonts\rom8x16.c +| + +winfreesansserif11x13.obj : fonts\winfreesansserif11x13.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ fonts\winfreesansserif11x13.c +| + +winfreesystem14x16.obj : fonts\winfreesystem14x16.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ fonts\winfreesystem14x16.c +| + +genfont.obj : drivers\genfont.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ drivers\genfont.c +| + +mou_dos.obj : drivers\mou_dos.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ drivers\mou_dos.c +| + +kbd_tc.obj : drivers\kbd_tc.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ drivers\kbd_tc.c +| + +scr_tc.obj : drivers\scr_tc.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ drivers\scr_tc.c +| + +devclip.obj : engine\devclip.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devclip.c +| + +devpal4.obj : engine\devpal4.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devpal4.c +| + +devpal2.obj : engine\devpal2.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devpal2.c +| + +devpal1.obj : engine\devpal1.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devpal1.c +| + +devmouse.obj : engine\devmouse.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devmouse.c +| + +devkbd.obj : engine\devkbd.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devkbd.c +| + +devfont.obj : engine\devfont.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devfont.c +| + +devdraw.obj : engine\devdraw.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devdraw.c +| + +devrgn.obj : engine\devrgn.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devrgn.c +| + +devrgn2.obj : engine\devrgn2.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devrgn2.c +| + +devarc.obj : engine\devarc.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devarc.c +| + +error.obj : engine\error.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\error.c +| + +srvclip.obj : nanox\srvclip.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\srvclip.c +| + +srvutil.obj : nanox\srvutil.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\srvutil.c +| + +srvmain.obj : nanox\srvmain.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\srvmain.c +| + +srvfunc.obj : nanox\srvfunc.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\srvfunc.c +| + +srvevent.obj : nanox\srvevent.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\srvevent.c +| + +stubs.obj : nanox\stubs.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\stubs.c +| + +Dep_demodexe = \ + nanox.lib\ + demo.obj + +demo.exe : $(Dep_demodexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demodexe) $(LinkerInheritOptsAt_demodexe) + +$(BC_Lib_Path)\c0l.obj+ +demo.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +demo.obj : demos\nanox\demo.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_demodexe) $(CompInheritOptsAt_demodexe) -o$@ demos\nanox\demo.c +| + +Dep_demo2dexe = \ + nanox.lib\ + demo2.obj + +demo2.exe : $(Dep_demo2dexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demo2dexe) $(LinkerInheritOptsAt_demo2dexe) + +$(BC_Lib_Path)\c0l.obj+ +demo2.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +demo2.obj : demos\nanox\demo2.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_demo2dexe) $(CompInheritOptsAt_demo2dexe) -o$@ demos\nanox\demo2.c +| + +Dep_demo3dexe = \ + nanox.lib\ + demo3.obj + +demo3.exe : $(Dep_demo3dexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demo3dexe) $(LinkerInheritOptsAt_demo3dexe) + +$(BC_Lib_Path)\c0l.obj+ +demo3.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +demo3.obj : demos\nanox\demo3.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_demo3dexe) $(CompInheritOptsAt_demo3dexe) -o$@ demos\nanox\demo3.c +| + +Dep_demo4dexe = \ + nanox.lib\ + demo4.obj + +demo4.exe : $(Dep_demo4dexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demo4dexe) $(LinkerInheritOptsAt_demo4dexe) + +$(BC_Lib_Path)\c0l.obj+ +demo4.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +demo4.obj : demos\nanox\demo4.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_demo4dexe) $(CompInheritOptsAt_demo4dexe) -o$@ demos\nanox\demo4.c +| + +Dep_demo5dexe = \ + nanox.lib\ + demo5.obj + +demo5.exe : $(Dep_demo5dexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demo5dexe) $(LinkerInheritOptsAt_demo5dexe) + +$(BC_Lib_Path)\c0l.obj+ +demo5.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +demo5.obj : demos\nanox\demo5.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_demo5dexe) $(CompInheritOptsAt_demo5dexe) -o$@ demos\nanox\demo5.c +| + +Dep_demo6dexe = \ + nanox.lib\ + demo6.obj + +demo6.exe : $(Dep_demo6dexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demo6dexe) $(LinkerInheritOptsAt_demo6dexe) + +$(BC_Lib_Path)\c0l.obj+ +demo6.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +demo6.obj : demos\nanox\demo6.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_demo6dexe) $(CompInheritOptsAt_demo6dexe) -o$@ demos\nanox\demo6.c +| + +Dep_ftdemodexe = \ + nanox.lib\ + ftdemo.obj + +ftdemo.exe : $(Dep_ftdemodexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_ftdemodexe) $(LinkerInheritOptsAt_ftdemodexe) + +$(BC_Lib_Path)\c0l.obj+ +ftdemo.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +ftdemo.obj : demos\nanox\ftdemo.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_ftdemodexe) $(CompInheritOptsAt_ftdemodexe) -o$@ demos\nanox\ftdemo.c +| + +Dep_infodexe = \ + nanox.lib\ + info.obj + +info.exe : $(Dep_infodexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_infodexe) $(LinkerInheritOptsAt_infodexe) + +$(BC_Lib_Path)\c0l.obj+ +info.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +info.obj : demos\nanox\info.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_infodexe) $(CompInheritOptsAt_infodexe) -o$@ demos\nanox\info.c +| + +Dep_landminedexe = \ + nanox.lib\ + landmine.obj + +landmine.exe : $(Dep_landminedexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_landminedexe) $(LinkerInheritOptsAt_landminedexe) + +$(BC_Lib_Path)\c0l.obj+ +landmine.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +landmine.obj : demos\nanox\landmine.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_landminedexe) $(CompInheritOptsAt_landminedexe) -o$@ demos\nanox\landmine.c +| + +Dep_movedexe = \ + nanox.lib\ + move.obj + +move.exe : $(Dep_movedexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_movedexe) $(LinkerInheritOptsAt_movedexe) + +$(BC_Lib_Path)\c0l.obj+ +move.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +move.obj : demos\nanox\move.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_movedexe) $(CompInheritOptsAt_movedexe) -o$@ demos\nanox\move.c +| + +Dep_sliderdexe = \ + nanox.lib\ + slider.obj + +slider.exe : $(Dep_sliderdexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_sliderdexe) $(LinkerInheritOptsAt_sliderdexe) + +$(BC_Lib_Path)\c0l.obj+ +slider.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +slider.obj : demos\nanox\slider.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_sliderdexe) $(CompInheritOptsAt_sliderdexe) -o$@ demos\nanox\slider.c +| + +Dep_waitdexe = \ + nanox.lib\ + wait.obj + +wait.exe : $(Dep_waitdexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_waitdexe) $(LinkerInheritOptsAt_waitdexe) + +$(BC_Lib_Path)\c0l.obj+ +wait.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +wait.obj : demos\nanox\wait.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_waitdexe) $(CompInheritOptsAt_waitdexe) -o$@ demos\nanox\wait.c +| + +Dep_worlddexe = \ + nanox.lib\ + world.obj + +world.exe : $(Dep_worlddexe) + $(TLINK) @&&| + /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_worlddexe) $(LinkerInheritOptsAt_worlddexe) + +$(BC_Lib_Path)\c0l.obj+ +world.obj +$<,$* +nanox.lib+ +$(BC_Lib_Path)\graphics.lib+ +$(BC_Lib_Path)\fp87.lib+ +$(BC_Lib_Path)\mathl.lib+ +$(BC_Lib_Path)\cl.lib + + + +| +world.obj : demos\nanox\world.c + $(BCCDOS) -P- -c @&&| + $(CompOptsAt_worlddexe) $(CompInheritOptsAt_worlddexe) -o$@ demos\nanox\world.c +| + +# Compiler configuration file +BccDos.cfg : + Copy &&| +-W- +-w +-R +-v +-vi +-H +-H=nanox.csm +| $@ + + +clean : + del *.obj + del *.lib + del *.exe + del *.csm + del BccDos.cfg + +egavga.obj : + copy $(BGI_Path)\egavga.bgi . + $(BGI_Path)\bgiobj egavga + del egavga.bgi + diff --git a/packages/services/gfx/mw/current/src/test.sh b/packages/services/gfx/mw/current/src/test.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/test.sh @@ -0,0 +1,1 @@ +bin/nano-X & bin/nxkbd & bin/nanowm & bin/nxterm & bin/demo & sleep 10000 diff --git a/packages/services/gfx/mw/current/src/vnc.sh b/packages/services/gfx/mw/current/src/vnc.sh new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/vnc.sh @@ -0,0 +1,1 @@ +bin/nano-X & bin/vnc win98:0 diff --git a/packages/services/gfx/mw/current/src/xconfigure b/packages/services/gfx/mw/current/src/xconfigure new file mode 100644 --- /dev/null +++ b/packages/services/gfx/mw/current/src/xconfigure @@ -0,0 +1,1436 @@ +#!/usr/bin/wish -f +# +# Microwindows configuration interface: X11 version +# +# wish is available at http://dev.scriptics.com/software/tcltck +# +# (C) Martin Jolicoeur, 1999 +# +# Thu Mar 16 14:33:08 CET 2000, Fabio Parodi, +# added VTSWITCH button +# +# + +set configfile 0; + +# Configurable options +variable arch; +variable armtoolsprefix; +variable mipstoolsprefix; +variable rtemstoolsprefix; +variable optimize; +variable debug; +variable verbose +variable microwin; +variable nanox; +variable shlibs; +variable objframe; +variable nwidget; +variable microwindemo; +variable nanoxdemo; +variable screenpixtype; +variable server; +variable sharedmem; +variable havefileio; +variable havebmp; +variable havejpg; +variable incjpg; +variable libjpg; +variable haveft; +variable incft; +variable libft; +variable havet1; +variable inct1; +variable libt1; + +variable havehzk; +variable hzkdir; +variable hzkfontsize; + +variable updateregions; +variable erasemove; +variable havemsfonts; +variable graypalette; +variable screenlinux; +variable vgafb; +variable portraitfb; +variable x11e15; +variable x11screenwidth; +variable x11screenheight; +variable x11screendepth; +variable mouselinux; +variable keyblinux; +variable vtswitch; +variable sa1100ltlend; +variable rtemsbuild; +variable rtemsbsp; +variable screenelks; + + +wm title . "Microwindows configuration" +wm geometry . +100+100 + +# Create main menu +frame .main +frame .main.col1 +frame .main.col2 +button .main.col1.compile -text "Compiling options" -command "compileoptions;" +button .main.col1.platform -text "Platform" -command "platformoptions;" +button .main.col1.lib -text "Libraries to compile" -command "liboptions;" +button .main.col2.colors -text "Color options" -command "colorsoptions;" +button .main.col2.io -text "I/O" -command "iooptions;" +button .main.col2.misc -text "Miscellaneous options" -command "miscoptions;" +pack .main.col1.compile .main.col1.platform .main.col1.lib -side top -fill x +pack .main.col2.colors .main.col2.io .main.col2.misc -side top -fill x +pack .main.col1 .main.col2 -side left + +# Create ok, cancel, help buttons +frame .buttons +pack .buttons -side bottom -fill x -pady 2m +button .buttons.ok -text "Save & Exit" -command "writeconfig; destroy ." +button .buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" +button .buttons.cancel -text "Cancel" -command "destroy ." +pack .buttons.cancel .buttons.help .buttons.ok -side right -expand 1 + +pack .main .buttons -side bottom + + +################################################################################ +# +# Show the "compile" options dialog +# +################################################################################ +proc compileoptions {} { + + toplevel .compile + wm title .compile "Compiling options" + wm geometry .compile +100+100 + + frame .compile.buttons + pack .compile.buttons -side bottom -fill x -pady 2m + button .compile.buttons.ok -text "Ok" -command "destroy .compile" + button .compile.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .compile.buttons.help .compile.buttons.ok -side right -expand 1 + + frame .compile.a0 + frame .compile.a1 + frame .compile.a2 + checkbutton .compile.a0.b0 -text "Optimize" -variable optimize -relief flat + checkbutton .compile.a1.b1 -text "Debug" -variable debug -relief flat + checkbutton .compile.a2.b2 -text "Verbose" -variable verbose -relief flat + pack .compile.a0.b0 -side left + pack .compile.a1.b1 -side left + pack .compile.a2.b2 -side left + pack .compile.a0 -side top -pady 2 -anchor w -fill x + pack .compile.a1 -side top -pady 2 -anchor w -fill x + pack .compile.a2 -side top -pady 2 -anchor w -fill x + pack .compile.a0 .compile.a1 .compile.a2 -side top -anchor e +} + + +################################################################################ +# +# Show the "platform" options dialog +# +################################################################################ +proc platformoptions {} { + + toplevel .platform + wm title .platform "Platform options" + wm geometry .platform +100+100 + + frame .platform.buttons + pack .platform.buttons -side bottom -fill x -pady 2m + button .platform.buttons.ok -text "Ok" -command "destroy .platform" + button .platform.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .platform.buttons.help .platform.buttons.ok -side right -expand 1 + + frame .platform.a0 + frame .platform.a1 + frame .platform.a2 + frame .platform.a3 + frame .platform.a4 + frame .platform.a5 + + radiobutton .platform.a0.b0 -text "Linux (native)" -variable arch -relief flat -value 0 -anchor w + button .platform.a0.options -text "Options" -command {nativelinuxoptions;}; + radiobutton .platform.a1.b1 -text "Linux-ARM (x-compile)" -variable arch -relief flat -value 1 -anchor w + button .platform.a1.options -text "Options" -command {armlinuxoptions;}; + radiobutton .platform.a2.b2 -text "Linux-MIPS (x-compile)" -variable arch -relief flat -value 2 -anchor w + button .platform.a2.options -text "Options" -command {mipslinuxoptions;}; + radiobutton .platform.a3.b3 -text "RTEMS" -variable arch -relief flat -value 3 -anchor w + button .platform.a3.options -text "Options" -command {rtemsoptions;}; + radiobutton .platform.a4.b4 -text "Solaris" -variable arch -relief flat -value 4 -anchor w + button .platform.a4.options -text "Options" -command {nativelinuxoptions;}; + radiobutton .platform.a5.b5 -text "ELKS" -variable arch -relief flat -value 5 -anchor w + button .platform.a5.options -text "Options" -command {elksoptions;}; + pack .platform.a0.b0 .platform.a0.options -side left + pack .platform.a1.b1 .platform.a1.options -side left + pack .platform.a2.b2 .platform.a2.options -side left + pack .platform.a3.b3 .platform.a3.options -side left + pack .platform.a4.b4 .platform.a4.options -side left + pack .platform.a5.b5 .platform.a5.options -side left + pack .platform.a0 -side top -pady 2 -anchor w -fill x + pack .platform.a1 -side top -pady 2 -anchor w -fill x + pack .platform.a2 -side top -pady 2 -anchor w -fill x + pack .platform.a3 -side top -pady 2 -anchor w -fill x + pack .platform.a4 -side top -pady 2 -anchor w -fill x + pack .platform.a5 -side top -pady 2 -anchor w -fill x + pack .platform.a0.options .platform.a1.options .platform.a2.options \ + .platform.a3.options .platform.a4.options .platform.a5.options -side top -anchor e +} + + +################################################################################ +# +# Show the "libraries" options dialog +# +################################################################################ +proc liboptions {} { + + toplevel .lib + wm title .lib "Libraries to compile" + wm geometry .lib +100+100 + + frame .lib.buttons + pack .lib.buttons -side bottom -fill x -pady 2m + button .lib.buttons.ok -text "Ok" -command "destroy .lib" + button .lib.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .lib.buttons.help .lib.buttons.ok -side right -expand 1 + + frame .lib.a0 + frame .lib.a1 + frame .lib.a2 + frame .lib.a3 + checkbutton .lib.a0.b0 -text "NanoX" -variable nanox -relief flat + button .lib.a0.options -text "Options" -command {nanoxoptions;}; + checkbutton .lib.a1.b1 -text "Microwindows" -variable microwin -relief flat + button .lib.a1.options -text "Options" -command {mwinoptions;}; + checkbutton .lib.a2.b2 -text "Shared libs" -variable shlibs -relief flat + checkbutton .lib.a3.b3 -text "C++ obj framework" -variable objframe -relief flat + + pack .lib.a0.b0 .lib.a0.options -side left + pack .lib.a1.b1 .lib.a1.options -side left + pack .lib.a2.b2 -side left + pack .lib.a3.b3 -side left + pack .lib.a0 -side top -pady 2 -anchor w -fill x + pack .lib.a1 -side top -pady 2 -anchor w -fill x + pack .lib.a2 -side top -pady 2 -anchor w -fill x + pack .lib.a3 -side top -pady 2 -anchor w -fill x + pack .lib.a0.options .lib.a1.options -side top -anchor e +} + + +################################################################################ +# +# Show the "colors" options dialog +# +################################################################################ +proc colorsoptions {} { + global screenpixtype; + + toplevel .colors + wm title .colors "Colors options" + wm geometry .colors +100+100 + + frame .colors.buttons + pack .colors.buttons -side bottom -fill x -pady 2m + button .colors.buttons.ok -text "Ok" -command "colorsoptions_ok; destroy .colors" + button .colors.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .colors.buttons.help .colors.buttons.ok -side right -expand 1 + + frame .colors.a0 + frame .colors.a1 + label .colors.a0.label -text "ScreenPixType:" -anchor e + entry .colors.a0.pixtype -width 25 -relief sunken + checkbutton .colors.a1.b1 -text "Gray Palette (4bpp only)" -variable graypalette -relief flat + pack .colors.a0.label .colors.a0.pixtype -side left + pack .colors.a1.b1 -side left + pack .colors.a0 -side top -pady 2 -anchor w -fill x + pack .colors.a1 -side top -pady 2 -anchor w -fill x + pack .colors.a0 .colors.a1 -side top -anchor e + .colors.a0.pixtype insert 0 $screenpixtype; +} + +proc colorsoptions_ok {} { + global screenpixtype; + set screenpixtype [.colors.a0.pixtype get]; +} + + +################################################################################ +# +# Show the "I/O" options dialog +# +################################################################################ +proc iooptions {} { + global havebmp; + global havejpg; + global haveft; + global havet1; + + global havehzk; + + toplevel .io + wm title .io "I/O options" + wm geometry .io +100+100 + + frame .io.buttons + pack .io.buttons -side bottom -fill x -pady 2m + button .io.buttons.ok -text "Ok" -command "destroy .io" + button .io.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .io.buttons.help .io.buttons.ok -side right -expand 1 + + frame .io.a0 + frame .io.a1 + frame .io.a2 + frame .io.a3 + frame .io.a4 + + frame .io.a5 + + checkbutton .io.a0.b0 -text "Have File I/O" -variable havefileio -relief flat + label .io.a0.label -text "(If the above is disabled, this will disable all the features below)" -anchor e + checkbutton .io.a1.b0 -text "Have bmp support" -variable havebmp -relief flat + checkbutton .io.a2.b0 -text "Have jpeg support" -variable havejpg -relief flat + button .io.a2.options -text "Options" -command {jpegoptions;}; + checkbutton .io.a3.b0 -text "Have freetype support (truetype fonts)" -variable haveft -relief flat + button .io.a3.options -text "Options" -command {ftoptions;}; + checkbutton .io.a4.b0 -text "Have t1lib support (type 1 fonts)" -variable havet1 -relief flat + button .io.a4.options -text "Options" -command {t1options;}; + + checkbutton .io.a5.b0 -text "Have HZK support (Bitmap(Metrix) fonts)" -variable havehzk -relief flat + button .io.a5.options -text "Options" -command {hzkoptions;}; + + pack .io.a0.b0 .io.a0.label -side top -pady 2 -anchor w + pack .io.a1.b0 -side top -pady 2 -anchor w + pack .io.a2.b0 .io.a2.options -side left + pack .io.a3.b0 .io.a3.options -side left + pack .io.a4.b0 .io.a4.options -side left + pack .io.a5.b0 .io.a5.options -side left + + pack .io.a0 -side top -pady 2 -anchor w -fill x + pack .io.a1 -side top -pady 2 -anchor w -fill x + pack .io.a2 -side top -pady 2 -anchor w -fill x + pack .io.a3 -side top -pady 2 -anchor w -fill x + pack .io.a4 -side top -pady 2 -anchor w -fill x + pack .io.a5 -side top -pady 2 -anchor w -fill x + + pack .io.a2.options .io.a3.options .io.a4.options .io.a5.options -side top -anchor e +} + + +################################################################################ +# +# Show the "Miscellaneous" options dialog +# +################################################################################ +proc miscoptions {} { + + toplevel .misc + wm title .misc "Miscellaneous options" + wm geometry .misc +100+100 + + frame .misc.buttons + pack .misc.buttons -side bottom -fill x -pady 2m + button .misc.buttons.ok -text "Ok" -command "destroy .misc" + button .misc.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .misc.buttons.help .misc.buttons.ok -side right -expand 1 + + checkbutton .misc.b0 -text "Have MS fonts" -variable havemsfonts -relief flat + pack .misc.b0 -side top -pady 2 -anchor w +} + + +################################################################################ +# +# Show nanox options dialog +# +################################################################################ +proc nanoxoptions {} { + + toplevel .optnanox + wm title .optnanox "NanoX options" + wm geometry .optnanox +100+100 + + frame .optnanox.buttons + pack .optnanox.buttons -side bottom -fill x -pady 2m + button .optnanox.buttons.ok -text "Ok" -command "destroy .optnanox" + button .optnanox.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optnanox.buttons.help .optnanox.buttons.ok -side right -expand 1 + + frame .optnanox.a0 + checkbutton .optnanox.a0.server -text "Link app into server" -variable server -relief flat + checkbutton .optnanox.a0.sharedmem -text "Enable shared mem support (app/server only)" -variable sharedmem -relief flat + checkbutton .optnanox.a0.nwidget -text "Compile Nwidget library" -variable nwidget -relief flat + checkbutton .optnanox.a0.demo -text "Compile demos" -variable nanoxdemo -relief flat + pack .optnanox.a0.server -side top -pady 2 -anchor w + pack .optnanox.a0.sharedmem -side top -pady 2 -anchor w + pack .optnanox.a0.nwidget -side top -pady 2 -anchor w + pack .optnanox.a0.demo -side top -pady 2 -anchor w + pack .optnanox.a0 -side top -pady 2 -anchor w -fill x +} + + +################################################################################ +# +# Show microwindows options dialog +# +################################################################################ +proc mwinoptions {} { + + toplevel .optmwin + wm title .optmwin "MicroWindows options" + wm geometry .optmwin +100+100 + + frame .optmwin.buttons + pack .optmwin.buttons -side bottom -fill x -pady 2m + button .optmwin.buttons.ok -text "Ok" -command "destroy .optmwin" + button .optmwin.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optmwin.buttons.help .optmwin.buttons.ok -side right -expand 1 + + frame .optmwin.algo -borderwidth 1 -relief solid + frame .optmwin.demo -borderwidth 1 -relief solid + pack .optmwin.algo .optmwin.demo -side top -fill x -pady .5c -padx .5c + + frame .optmwin.algo.a0 + frame .optmwin.algo.a1 + label .optmwin.algo.label -text "Window move agorithm options" + pack .optmwin.algo.label -side top + checkbutton .optmwin.algo.a0.b0 -text "Update regions" -variable updateregions -relief flat + checkbutton .optmwin.algo.a1.b1 -text "Erase Move" -variable erasemove -relief flat + pack .optmwin.algo.a0.b0 -side top -pady 2 -anchor w + pack .optmwin.algo.a1.b1 -side top -pady 2 -anchor w + pack .optmwin.algo.a0 -side top -pady 2 -anchor w -fill x + pack .optmwin.algo.a1 -side top -pady 2 -anchor w -fill x + + frame .optmwin.demo.a0 + label .optmwin.demo.label -text "Other options" + pack .optmwin.demo.label -side top + checkbutton .optmwin.demo.a0.b0 -text "Compile demos" -variable microwindemo -relief flat + pack .optmwin.demo.a0.b0 -side top -pady 2 -anchor w + pack .optmwin.demo.a0 -side top -pady 2 -anchor w -fill x +} + + +################################################################################ +# +# Show native linux/Solaris options dialog +# +################################################################################ +proc nativelinuxoptions {} { + + toplevel .optnatlinux + wm title .optnatlinux "Native Linux/Solaris options" + wm geometry .optnatlinux +100+100 + + frame .optnatlinux.buttons + pack .optnatlinux.buttons -side bottom -fill x -pady 2m + button .optnatlinux.buttons.ok -text "Ok" -command "destroy .optnatlinux" + button .optnatlinux.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optnatlinux.buttons.help .optnatlinux.buttons.ok -side right -expand 1 + + button .optnatlinux.screen -text "Screen driver" -command "screenoptions;" + button .optnatlinux.mouse -text "Mouse driver" -command "mouseoptions;" + button .optnatlinux.kbd -text "Keyboard driver" -command "kbdoptions;" + pack .optnatlinux.screen .optnatlinux.mouse .optnatlinux.kbd -side top -fill x +} + + +################################################################################ +# +# Show arm linux options dialog +# +################################################################################ +proc armlinuxoptions {} { + global screenlinux; + global armtoolsprefix; + + toplevel .optarmlinux + wm title .optarmlinux "ARM Linux options" + wm geometry .optarmlinux +100+100 + + frame .optarmlinux.buttons + pack .optarmlinux.buttons -side bottom -fill x -pady 2m + button .optarmlinux.buttons.ok -text "Ok" -command "armlinuxoptions_ok; destroy .optarmlinux" + button .optarmlinux.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optarmlinux.buttons.help .optarmlinux.buttons.ok -side right -expand 1 + + frame .optarmlinux.comp -borderwidth 1 -relief solid + pack .optarmlinux.comp -side top -fill x -pady .5c -padx .5c + + frame .optarmlinux.comp.a0 + label .optarmlinux.comp.label -text "Compiler options" + pack .optarmlinux.comp.label -side top + label .optarmlinux.comp.a0.label -text "Tools Prefix:" -anchor e + entry .optarmlinux.comp.a0.prefix -width 25 -relief sunken + checkbutton .optarmlinux.comp.a0.sa1100ltlend \ +-text "SA1100 Little endian option (for 4 bpp only)" -variable sa1100ltlend -relief flat + pack .optarmlinux.comp.a0.label -side top -pady 2 -anchor w + pack .optarmlinux.comp.a0.prefix -side top -pady 2 -anchor c + pack .optarmlinux.comp.a0.sa1100ltlend -side top -pady 2 -anchor c + pack .optarmlinux.comp.a0 -side top -pady 2 -anchor w -fill x + .optarmlinux.comp.a0.prefix insert 0 $armtoolsprefix; + + button .optarmlinux.screen -text "Screen driver" -command "screenoptions;" + button .optarmlinux.mouse -text "Mouse driver" -command "mouseoptions;" + button .optarmlinux.kbd -text "Keyboard driver" -command "kbdoptions;" + pack .optarmlinux.comp .optarmlinux.screen .optarmlinux.mouse .optarmlinux.kbd -side top -fill x +} + +proc armlinuxoptions_ok {} { + global armtoolsprefix; + set armtoolsprefix [.optarmlinux.comp.a0.prefix get]; +} + + +################################################################################ +# +# Show mips linux options dialog +# +################################################################################ +proc mipslinuxoptions {} { + global screenlinux; + global mipstoolsprefix; + + toplevel .optmipslinux + wm title .optmipslinux "MIPS Linux options" + wm geometry .optmipslinux +100+100 + + frame .optmipslinux.buttons + pack .optmipslinux.buttons -side bottom -fill x -pady 2m + button .optmipslinux.buttons.ok -text "Ok" -command "mipslinuxoptions_ok; destroy .optmipslinux" + button .optmipslinux.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optmipslinux.buttons.help .optmipslinux.buttons.ok -side right -expand 1 + + frame .optmipslinux.comp -borderwidth 1 -relief solid + pack .optmipslinux.comp -side top -fill x -pady .5c -padx .5c + + frame .optmipslinux.comp.a0 + label .optmipslinux.comp.label -text "Compiler options" + pack .optmipslinux.comp.label -side top + label .optmipslinux.comp.a0.label -text "Tools Prefix:" -anchor e + entry .optmipslinux.comp.a0.prefix -width 25 -relief sunken + pack .optmipslinux.comp.a0.label -side top -pady 2 -anchor w + pack .optmipslinux.comp.a0.prefix -side top -pady 2 -anchor c + pack .optmipslinux.comp.a0 -side top -pady 2 -anchor w -fill x + .optmipslinux.comp.a0.prefix insert 0 $mipstoolsprefix; + + button .optmipslinux.screen -text "Screen driver" -command "screenoptions;" + button .optmipslinux.mouse -text "Mouse driver" -command "mouseoptions;" + button .optmipslinux.kbd -text "Keyboard driver" -command "kbdoptions;" + pack .optmipslinux.comp .optmipslinux.screen .optmipslinux.mouse .optmipslinux.kbd -side top -fill x +} + +proc mipslinuxoptions_ok {} { + global mipstoolsprefix; + set mipstoolsprefix [.optmipslinux.comp.a0.prefix get]; +} + + +################################################################################ +# +# Show rtems options dialog +# +################################################################################ +proc rtemsoptions {} { + global rtemstoolsprefix; + global rtemsbuild; + global rtemsbsp; + + toplevel .optrtems + wm title .optrtems "RTEMS options" + wm geometry .optrtems +100+100 + + frame .optrtems.buttons + pack .optrtems.buttons -side bottom -fill x -pady 2m + button .optrtems.buttons.ok -text "Ok" -command "rtemsoptions_ok; destroy .optrtems" + button .optrtems.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optrtems.buttons.help .optrtems.buttons.ok -side right -expand 1 + + frame .optrtems.comp -borderwidth 1 -relief solid + pack .optrtems.comp -side top -fill x -pady .5c -padx .5c + + frame .optrtems.comp.a0 + frame .optrtems.comp.a1 + frame .optrtems.comp.a2 + label .optrtems.comp.label -text "Compiler options" + pack .optrtems.comp.label -side top + label .optrtems.comp.a0.label -text "Tools Prefix:" -anchor e + entry .optrtems.comp.a0.prefix -width 25 -relief sunken + label .optrtems.comp.a1.label -text "Build:" -anchor e + entry .optrtems.comp.a1.build -width 25 -relief sunken + label .optrtems.comp.a2.label -text "BSP:" -anchor e + entry .optrtems.comp.a2.bsp -width 25 -relief sunken + pack .optrtems.comp.a0.label -side top -pady 2 -anchor w + pack .optrtems.comp.a0.prefix -side top -pady 2 -anchor c + pack .optrtems.comp.a1.label .optrtems.comp.a1.build -side top -pady 2 -anchor w + pack .optrtems.comp.a2.label .optrtems.comp.a2.bsp -side top -pady 2 -anchor w + pack .optrtems.comp.a0 -side top -pady 2 -anchor w -fill x + pack .optrtems.comp.a1 -side top -pady 2 -anchor w -fill x + pack .optrtems.comp.a2 -side top -pady 2 -anchor w -fill x + pack .optrtems.comp.a0.prefix .optrtems.comp.a1.build .optrtems.comp.a2.bsp -side top -anchor e + .optrtems.comp.a0.prefix insert 0 $rtemstoolsprefix; + .optrtems.comp.a1.build insert 0 $rtemsbuild; + .optrtems.comp.a2.bsp insert 0 $rtemsbsp; + + button .optrtems.screen -text "Screen driver" -command "screenoptions;" + button .optrtems.mouse -text "Mouse driver" -command "mouseoptions;" + button .optrtems.kbd -text "Keyboard driver" -command "kbdoptions;" + pack .optrtems.comp .optrtems.screen .optrtems.mouse .optrtems.kbd -side top -fill x +} + +proc rtemsoptions_ok {} { + global rtemstoolsprefix; + global rtemsbuild; + global rtemsbsp; + set rtemstoolsprefix [.optrtems.comp.a0.prefix get]; + set rtemsbuild [.optrtems.comp.a1.build get]; + set rtemsbsp [.optrtems.comp.a2.bsp get]; +} + + +################################################################################ +# +# Show jpeg options dialog +# +################################################################################ +proc jpegoptions {} { + global incjpg; + global libjpg; + + toplevel .optjpeg + wm title .optjpeg "JPEG support options" + wm geometry .optjpeg +100+100 + + frame .optjpeg.buttons + pack .optjpeg.buttons -side bottom -fill x -pady 2m + button .optjpeg.buttons.ok -text "Ok" -command "jpegoptions_ok; destroy .optjpeg" + button .optjpeg.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optjpeg.buttons.help .optjpeg.buttons.ok -side right -expand 1 + + frame .optjpeg.a0 + frame .optjpeg.a1 + label .optjpeg.a0.label -text "Libjpeg include dir:" -anchor e + entry .optjpeg.a0.incjpg -width 40 -relief sunken + label .optjpeg.a1.label -text "Libjpeg path:" -anchor e + entry .optjpeg.a1.libjpg -width 40 -relief sunken + pack .optjpeg.a0.label -side top -pady 2 -anchor w + pack .optjpeg.a0.incjpg -side top -pady 2 -anchor w + pack .optjpeg.a1.label -side top -pady 2 -anchor w + pack .optjpeg.a1.libjpg -side top -pady 2 -anchor w + pack .optjpeg.a0 -side top -pady 2 -anchor w -fill x + pack .optjpeg.a1 -side top -pady 2 -anchor w -fill x + + pack .optjpeg.a0.incjpg .optjpeg.a1.libjpg -side top -anchor e + + .optjpeg.a0.incjpg insert 0 $incjpg; + .optjpeg.a1.libjpg insert 0 $libjpg; +} + + +proc jpegoptions_ok {} { + global incjpg; + global libjpg; + set incjpg [.optjpeg.a0.incjpg get]; + set libjpg [.optjpeg.a1.libjpg get]; +} + + +################################################################################ +# +# Show freetype options dialog +# +################################################################################ +proc ftoptions {} { + global incft; + global libft; + + toplevel .optft + wm title .optft "Freetype support options" + wm geometry .optft +100+100 + + frame .optft.buttons + pack .optft.buttons -side bottom -fill x -pady 2m + button .optft.buttons.ok -text "Ok" -command "ftoptions_ok; destroy .optft" + button .optft.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optft.buttons.help .optft.buttons.ok -side right -expand 1 + + frame .optft.a0 + frame .optft.a1 + label .optft.a0.label -text "Freetype include dir:" -anchor e + entry .optft.a0.incft -width 40 -relief sunken + label .optft.a1.label -text "Freetype lib path:" -anchor e + entry .optft.a1.libft -width 40 -relief sunken + pack .optft.a0.label -side top -pady 2 -anchor w + pack .optft.a0.incft -side top -pady 2 -anchor w + pack .optft.a1.label -side top -pady 2 -anchor w + pack .optft.a1.libft -side top -pady 2 -anchor w + pack .optft.a0 -side top -pady 2 -anchor w -fill x + pack .optft.a1 -side top -pady 2 -anchor w -fill x + + pack .optft.a0.incft .optft.a1.libft -side top -anchor e + + .optft.a0.incft insert 0 $incft; + .optft.a1.libft insert 0 $libft; +} + + +proc ftoptions_ok {} { + global incft; + global libft; + set incft [.optft.a0.incft get]; + set libft [.optft.a1.libft get]; +} + + +################################################################################ +# +# Show t1lib options dialog +# +################################################################################ +proc t1options {} { + global inct1; + global libt1; + + toplevel .optt1 + wm title .optt1 "T1Lib support options" + wm geometry .optt1 +100+100 + + frame .optt1.buttons + pack .optt1.buttons -side bottom -fill x -pady 2m + button .optt1.buttons.ok -text "Ok" -command "t1options_ok; destroy .optt1" + button .optt1.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optt1.buttons.help .optt1.buttons.ok -side right -expand 1 + + frame .optt1.a0 + frame .optt1.a1 + label .optt1.a0.label -text "T1lib include dir:" -anchor e + entry .optt1.a0.inct1 -width 40 -relief sunken + label .optt1.a1.label -text "T1lib path:" -anchor e + entry .optt1.a1.libt1 -width 40 -relief sunken + pack .optt1.a0.label -side top -pady 2 -anchor w + pack .optt1.a0.inct1 -side top -pady 2 -anchor w + pack .optt1.a1.label -side top -pady 2 -anchor w + pack .optt1.a1.libt1 -side top -pady 2 -anchor w + pack .optt1.a0 -side top -pady 2 -anchor w -fill x + pack .optt1.a1 -side top -pady 2 -anchor w -fill x + + pack .optt1.a0.inct1 .optt1.a1.libt1 -side top -anchor e + + .optt1.a0.inct1 insert 0 $inct1; + .optt1.a1.libt1 insert 0 $libt1; +} + + +proc t1options_ok {} { + global inct1; + global libt1; + set inct1 [.optt1.a0.inct1 get]; + set libt1 [.optt1.a1.libt1 get]; +} + +################################################################################ +# +# Show hzk dir options dialog +# +################################################################################ +proc hzkoptions {} { + global hzkdir; + global hzkfontsize; + + toplevel .opthzk + wm title .opthzk "HZK support options" + wm geometry .opthzk +100+100 + + frame .opthzk.buttons + pack .opthzk.buttons -side bottom -fill x -pady 2m + button .opthzk.buttons.ok -text "Ok" -command "hzkoptions_ok; destroy .opthzk" + button .opthzk.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .opthzk.buttons.help .opthzk.buttons.ok -side right -expand 1 + + frame .opthzk.a0 + frame .opthzk.a1 + label .opthzk.a0.label -text "HZK fonts dir:" -anchor e + entry .opthzk.a0.hzkdir -width 40 -relief sunken + label .opthzk.a1.label -text "HZK fonts Size:(16 or 12 ,now)" -anchor e + entry .opthzk.a1.hzksize -width 40 -relief sunken + pack .opthzk.a0.label -side top -pady 2 -anchor w + pack .opthzk.a0.hzkdir -side top -pady 2 -anchor w + pack .opthzk.a1.label -side top -pady 2 -anchor w + pack .opthzk.a1.hzksize -side top -pady 2 -anchor w + pack .opthzk.a0 -side top -pady 2 -anchor w -fill x + pack .opthzk.a1 -side top -pady 2 -anchor w -fill x + + pack .opthzk.a0.hzkdir .opthzk.a1.hzksize -side top -anchor e + + .opthzk.a0.hzkdir insert 0 $hzkdir; + .opthzk.a1.hzksize insert 0 $hzkfontsize; +} + + +proc hzkoptions_ok {} { + global hzkdir; + global hzkfontsize; + set hzkdir [.opthzk.a0.hzkdir get]; + set hzkfontsize [.opthzk.a1.hzksize get]; + +} + + +################################################################################ +# +# Show screen driver options dialog +# +################################################################################ +proc screenoptions {} { + + toplevel .optscreen + wm title .optscreen "Screen driver options" + wm geometry .optscreen +100+100 + + frame .optscreen.buttons + pack .optscreen.buttons -side bottom -fill x -pady 2m + button .optscreen.buttons.ok -text "Ok" -command "destroy .optscreen" + button .optscreen.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optscreen.buttons.help .optscreen.buttons.ok -side right -expand 1 + + frame .optscreen.a0 + frame .optscreen.a1 + frame .optscreen.a2 + frame .optscreen.a3 + radiobutton .optscreen.a0.b0 -text "Framebuffer" -variable screenlinux -relief flat -value 0 -anchor w + button .optscreen.a0.options -text "Options" -command {fboptions;}; + radiobutton .optscreen.a1.b1 -text "X11" -variable screenlinux -relief flat -value 1 -anchor w + button .optscreen.a1.options -text "Options" -command {x11options;}; + radiobutton .optscreen.a2.b2 -text "VgaLib" -variable screenlinux -relief flat -value 2 -anchor w + radiobutton .optscreen.a3.b3 -text "HW Vga" -variable screenlinux -relief flat -value 3 -anchor w + pack .optscreen.a0.b0 .optscreen.a0.options -side left + pack .optscreen.a1.b1 .optscreen.a1.options -side left + pack .optscreen.a2.b2 -side top -pady 2 -anchor w + pack .optscreen.a3.b3 -side top -pady 2 -anchor w + pack .optscreen.a0 -side top -pady 2 -anchor w -fill x + pack .optscreen.a1 -side top -pady 2 -anchor w -fill x + pack .optscreen.a2 -side top -pady 2 -anchor w -fill x + pack .optscreen.a3 -side top -pady 2 -anchor w -fill x + pack .optscreen.a0.options .optscreen.a1.options -side top -anchor e +} + + +################################################################################ +# +# Show mouse options dialog +# +################################################################################ +proc mouseoptions {} { + + toplevel .optmouse + wm title .optmouse "Mouse driver options" + wm geometry .optmouse +100+100 + + frame .optmouse.buttons + pack .optmouse.buttons -side bottom -fill x -pady 2m + button .optmouse.buttons.ok -text "Ok" -command "destroy .optmouse" + button .optmouse.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optmouse.buttons.help .optmouse.buttons.ok -side right -expand 1 + + frame .optmouse.a0 + frame .optmouse.a1 + frame .optmouse.a2 + frame .optmouse.a3 + frame .optmouse.a4 + radiobutton .optmouse.a0.b0 -text "GPM mouse" -variable mouselinux -relief flat -value 0 -anchor w + radiobutton .optmouse.a1.b1 -text "Serial mouse" -variable mouselinux -relief flat -value 1 -anchor w + radiobutton .optmouse.a2.b2 -text "Touch Pad" -variable mouselinux -relief flat -value 2 -anchor w + radiobutton .optmouse.a3.b3 -text "Touch screen" -variable mouselinux -relief flat -value 3 -anchor w + radiobutton .optmouse.a4.b4 -text "No Mouse" -variable mouselinux -relief flat -value 4 -anchor w + pack .optmouse.a0.b0 -side top -pady 2 -anchor w + pack .optmouse.a1.b1 -side top -pady 2 -anchor w + pack .optmouse.a2.b2 -side top -pady 2 -anchor w + pack .optmouse.a3.b3 -side top -pady 2 -anchor w + pack .optmouse.a4.b4 -side top -pady 2 -anchor w + pack .optmouse.a0 -side top -pady 2 -anchor w -fill x + pack .optmouse.a1 -side top -pady 2 -anchor w -fill x + pack .optmouse.a2 -side top -pady 2 -anchor w -fill x + pack .optmouse.a3 -side top -pady 2 -anchor w -fill x + pack .optmouse.a4 -side top -pady 2 -anchor w -fill x +} + + +################################################################################ +# +# Show keyboard options dialog +# +################################################################################ +proc kbdoptions {} { + + toplevel .optkbd + wm title .optkbd "Keyboard driver options" + wm geometry .optkbd +100+100 + + frame .optkbd.buttons + pack .optkbd.buttons -side bottom -fill x -pady 2m + button .optkbd.buttons.ok -text "Ok" -command "destroy .optkbd" + button .optkbd.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optkbd.buttons.help .optkbd.buttons.ok -side right -expand 1 + + frame .optkbd.a0 + frame .optkbd.a1 + radiobutton .optkbd.a0.b0 -text "TTY" -variable keyblinux -relief flat -value 0 -anchor w + radiobutton .optkbd.a1.b0 -text "No keyboard" -variable keyblinux -relief flat -value 1 -anchor w + pack .optkbd.a0.b0 -side top -pady 2 -anchor w + pack .optkbd.a1.b0 -side top -pady 2 -anchor w + pack .optkbd.a0 -side top -pady 2 -anchor w -fill x + pack .optkbd.a1 -side top -pady 2 -anchor w -fill x +} + + +################################################################################ +# +# Show framebuffer options dialog +# +################################################################################ +proc fboptions {} { + + toplevel .optfb + wm title .optfb "Framebuffer options" + wm geometry .optfb +100+100 + + frame .optfb.buttons + pack .optfb.buttons -side bottom -fill x -pady 2m + button .optfb.buttons.ok -text "Ok" -command "destroy .optfb" + button .optfb.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optfb.buttons.help .optfb.buttons.ok -side right -expand 1 + + frame .optfb.a0 + frame .optfb.a1 + frame .optfb.a2 + checkbutton .optfb.a0.vgafb -text "VGA fb" -variable vgafb -relief flat + checkbutton .optfb.a1.portrait -text "Portrait mode" -variable portraitfb -relief flat + checkbutton .optfb.a2.vt -text "VTerm Switch code included" -variable vtswitch -relief flat + pack .optfb.a0.vgafb -side top -pady 2 -anchor w + pack .optfb.a1.portrait -side top -pady 2 -anchor w + pack .optfb.a2.vt -side top -pady 2 -anchor w + pack .optfb.a0 .optfb.a1 .optfb.a2 -side top -pady 2 -anchor w -fill x +} + + +################################################################################ +# +# Show X11 options dialog +# +################################################################################ +proc x11options {} { + global x11screenwidth; + global x11screenheight; + global x11screendepth; + global x11e15; + + toplevel .optx11 + wm title .optx11 "X11 options" + wm geometry .optx11 +100+100 + + frame .optx11.buttons + pack .optx11.buttons -side bottom -fill x -pady 2m + button .optx11.buttons.ok -text "Ok" -command "x11options_ok; destroy .optx11" + button .optx11.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optx11.buttons.help .optx11.buttons.ok -side right -expand 1 + + frame .optx11.a0 + frame .optx11.a1 + frame .optx11.a2 + frame .optx11.a3 + label .optx11.a0.label -text "Screen width:" -anchor e + entry .optx11.a0.width -width 5 -relief sunken + label .optx11.a1.label -text "Screen height:" -anchor e + entry .optx11.a1.height -width 5 -relief sunken + label .optx11.a2.label -text "Screen depth:" -anchor e + entry .optx11.a2.depth -width 5 -relief sunken + checkbutton .optx11.a3.x11e15 -text "Use predefined model E15" -variable x11e15 -relief flat + pack .optx11.a0.label .optx11.a0.width -side left + pack .optx11.a1.label .optx11.a1.height -side left + pack .optx11.a2.label .optx11.a2.depth -side left + pack .optx11.a3.x11e15 -side top -pady 2 -anchor w + pack .optx11.a0 -side top -pady 2 -anchor w -fill x + pack .optx11.a1 -side top -pady 2 -anchor w -fill x + pack .optx11.a2 -side top -pady 2 -anchor w -fill x + pack .optx11.a3 -side top -pady 2 -anchor w -fill x + pack .optx11.a0.width .optx11.a1.height .optx11.a2.depth -side top -anchor e + .optx11.a0.width insert 0 $x11screenwidth; + .optx11.a1.height insert 0 $x11screenheight; + .optx11.a2.depth insert 0 $x11screendepth; +} + +proc x11options_ok {} { + global x11screenwidth; + global x11screenheight; + global x11screendepth; + set x11screenwidth [.optx11.a0.width get]; + set x11screenheight [.optx11.a1.height get]; + set x11screendepth [.optx11.a2.depth get]; +} + + +################################################################################ +# +# Show elks options dialog +# +################################################################################ +proc elksoptions {} { + global screenelks; + + toplevel .optelks + wm title .optelks "ELKS options" + wm geometry .optelks +100+100 + + frame .optelks.buttons + pack .optelks.buttons -side bottom -fill x -pady 2m + button .optelks.buttons.ok -text "Ok" -command "destroy .optelks" + button .optelks.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok" + pack .optelks.buttons.help .optelks.buttons.ok -side right -expand 1 + + frame .optelks.sd -borderwidth 1 -relief solid + pack .optelks.sd -side top -fill x -pady .5c -padx .5c + + frame .optelks.sd.a0 + frame .optelks.sd.a1 + frame .optelks.sd.a2 + label .optelks.sd.label -text "Screen driver" + pack .optelks.sd.label -side top + radiobutton .optelks.sd.a0.b0 -text "ASM VGA (faster)" -variable screenelks -relief flat -value 0 -anchor w + radiobutton .optelks.sd.a1.b1 -text "C VGA " -variable screenelks -relief flat -value 1 -anchor w + radiobutton .optelks.sd.a2.b2 -text "Hercule" -variable screenelks -relief flat -value 2 -anchor w + pack .optelks.sd.a0.b0 -side top -pady 2 -anchor w + pack .optelks.sd.a1.b1 -side top -pady 2 -anchor w + pack .optelks.sd.a2.b2 -side top -pady 2 -anchor w + pack .optelks.sd.a0 -side top -pady 2 -anchor w -fill x + pack .optelks.sd.a1 -side top -pady 2 -anchor w -fill x + pack .optelks.sd.a2 -side top -pady 2 -anchor w -fill x +} + + +################################################################################ +# +# Read data from the configuration file +# +################################################################################ +proc readconfig {} { + global configfile; + + global arch; + global armtoolsprefix; + global mipstoolsprefix; + global rtemstoolsprefix; + global optimize; + global debug; + global verbose + global microwin; + global nanox; + global shlibs; + global objframe; + global nwidget; + global microwindemo; + global nanoxdemo; + global screenpixtype; + global server; + global sharedmem; + global havefileio; + global havebmp; + global havejpg; + global incjpg; + global libjpg; + global haveft; + global incft; + global libft; + global havet1; + global inct1; + global libt1; + global havehzk; + global hzkdir; + global hzkfontsize; + global updateregions; + global erasemove; + global havemsfonts; + global graypalette; + global screenlinux; + global vgafb; + global portraitfb; + global x11e15; + global x11screenwidth; + global x11screenheight; + global x11screendepth; + global mouselinux; + global keyblinux; + global vtswitch; + global sa1100ltlend; + global rtemsbuild; + global rtemsbsp; + global screenelks; + + set configfile [open "config" r+] + + set armtoolsprefix [getvalue "ARMTOOLSPREFIX" 0]; + set mipstoolsprefix [getvalue "MIPSTOOLSPREFIX" 0]; + set rtemstoolsprefix [getvalue "RTEMSTOOLSPREFIX" 0]; + + set arch [getvalue "ARCH" 0]; + switch -exact $arch { + LINUX-NATIVE {set arch 0;} + LINUX-ARM {set arch 1;} + LINUX-MIPS {set arch 2;} + RTEMS {set arch 3;} + SOLARIS {set arch 4;} + ELKS {set arch 5;} + default {set arch 0} + } + + set optimize [getvalue "OPTIMIZE" 1]; + set debug [getvalue "DEBUG" 1]; + set verbose [getvalue "VERBOSE" 1]; + + set vtswitch [getvalue "VTSWITCH" 1]; + + set microwin [getvalue "MICROWIN" 1]; + set nanox [getvalue "NANOX" 1]; + set shlibs [getvalue "SHAREDLIBS" 1]; + set objframe [getvalue "OBJFRAMEWORK" 1]; + set nwidget [getvalue "NWIDGET" 1]; + + set microwindemo [getvalue "MICROWINDEMO" 1] + set nanoxdemo [getvalue "NANOXDEMO" 1]; + + set screenpixtype [getvalue "SCREEN_PIXTYPE" 0] + set server [getvalue "LINK_APP_INTO_SERVER" 1]; + set sharedmem [getvalue "HAVE_SHAREDMEM_SUPPORT" 1]; + + set havefileio [getvalue "HAVE_FILEIO" 1]; + set havebmp [getvalue "HAVE_BMP_SUPPORT" 1]; + set havejpg [getvalue "HAVE_JPEG_SUPPORT" 1]; + set incjpg [getvalue "INCJPEG" 0]; + set libjpg [getvalue "LIBJPEG" 0]; + set haveft [getvalue "HAVE_FREETYPE_SUPPORT" 1]; + set incft [getvalue "INCFTLIB" 0]; + set libft [getvalue "LIBFTLIB" 0]; + set havet1 [getvalue "HAVE_T1LIB_SUPPORT" 1]; + set inct1 [getvalue "INCT1LIB" 0]; + set libt1 [getvalue "LIBT1LIB" 0]; + + set havehzk [getvalue "HAVE_HZK_SUPPORT" 1]; + set hzkdir [getvalue "HZK_FONT_DIR" 0]; + set hzkfontsize [getvalue "HZK_FONT_SIZE" 0]; + + set updateregions [getvalue "UPDATEREGIONS" 1] + set erasemove [getvalue "ERASEMOVE" 1] + + set havemsfonts [getvalue "HAVEMSFONTS" 1]; + + set graypalette [getvalue "GRAYPALETTE" 1]; + + set vgafb [getvalue "FBVGA" 1] + set portraitfb [getvalue "PORTRAIT_MODE" 1] + + set x11e15 [getvalue "SCREEN_E15 1" 1] + set x11screenwidth [getvalue "SCREEN_WIDTH" 0] + set x11screenheight [getvalue "SCREEN_HEIGHT" 0] + set x11screendepth [getvalue "SCREEN_DEPTH" 0] + + set sa1100ltlend [getvalue "SA1100_LCD_LTLEND" 1] + set rtemsbuild [getvalue "RTEMS_BUILD" 0] + set rtemsbsp [getvalue "RTEMS_BSP" 0] + + if {[getvalue "FRAMEBUFFER" 1] == 1} {set screenlinux 0;} + if {[getvalue "X11" 1] == 1} {set screenlinux 1} + if {[getvalue "VGALIB" 1] == 1} {set screenlinux 2} + if {[getvalue "HWVGA" 1] == 1} {set screenlinux 3} + + if {[getvalue "GPMMOUSE" 1] == 1} {set mouselinux 0;} + if {[getvalue "SERMOUSE" 1] == 1} {set mouselinux 1} + if {[getvalue "TPMOUSE" 1] == 1} {set mouselinux 2} + if {[getvalue "TSMOUSE" 1] == 1} {set mouselinux 3} + if {[getvalue "NOMOUSE" 1] == 1} {set mouselinux 4} + + if {[getvalue "TTYKBD" 1] == 1} {set keyblinux 0;} + if {[getvalue "NOKBD" 1] == 1} {set keyblinux 1;} + + if {[getvalue "ASMVGADRIVER" 1] == 1} {set screenelks 0;} + if {[getvalue "CVGADRIVER" 1] == 1} {set screenelks 1} + if {[getvalue "HERCDRIVER" 1] == 1} {set screenelks 2} + + close $configfile; +} + + +################################################################################ +# +# Get a value from the config file +# +################################################################################ +proc getvalue {name isyesorno} { + global configfile; + + set line 0; + + seek $configfile 0 start; + + while {[eof $configfile] == 0} { + set line [gets $configfile]; + + if {[regexp ($name)(\ |\t)*(=)(\ |\t)*(.*) $line all a b c d e] == 1} { + set $e [string trim $e] + + if {$isyesorno == 1} { + switch -exact $e { + N {return 0;} + Y {return 1;} + default {return 0} + } + } + + return $e + } + } +} + + +################################################################################ +# +# Write data to the configuration file +# +################################################################################ +proc writeconfig {} { + global arch; + global armtoolsprefix; + global mipstoolsprefix; + global rtemstoolsprefix; + global optimize; + global debug; + global verbose + global microwin; + global nanox; + global shlibs; + global objframe; + global nwidget; + global microwindemo; + global nanoxdemo; + global screenpixtype; + global server; + global sharedmem; + global havefileio; + global havebmp; + global havejpg; + global incjpg; + global libjpg; + global haveft; + global incft; + global libft; + global havet1; + global inct1; + global libt1; + global havehzk; + global hzkdir; + global hzkfontsize; + global updateregions; + global erasemove; + global havemsfonts; + global graypalette; + global screenlinux; + global vgafb; + global portraitfb; + global x11e15; + global x11screenwidth; + global x11screenheight; + global x11screendepth; + global mouselinux; + global keyblinux; + global vtswitch; + global sa1100ltlend; + global rtemsbuild; + global rtemsbsp; + global screenelks; + + if {$arch == 0} {putvalue "ARCH" "LINUX-NATIVE" + } elseif {$arch == 1} {putvalue "ARCH" "LINUX-ARM" + } elseif {$arch == 2} {putvalue "ARCH" "LINUX-MIPS" + } elseif {$arch == 3} {putvalue "ARCH" "RTEMS" + } elseif {$arch == 4} {putvalue "ARCH" "SOLARIS" + } elseif {$arch == 5} {putvalue "ARCH" "ELKS"} + + putvalue "ARMTOOLSPREFIX" $armtoolsprefix; + putvalue "MIPSTOOLSPREFIX" $mipstoolsprefix; + putvalue "RTEMSTOOLSPREFIX" $rtemstoolsprefix; + putvalue "OPTIMIZE" $optimize; + putvalue "DEBUG" $debug; + putvalue "VERBOSE" $verbose; + putvalue "MICROWIN" $microwin + putvalue "NANOX" $nanox; + putvalue "SHAREDLIBS" $shlibs; + putvalue "OBJFRAMEWORK" $objframe; + putvalue "NWIDGET" $nwidget; + putvalue "MICROWINDEMO" $microwindemo; + putvalue "NANOXDEMO" $nanoxdemo; + putvalue "SCREEN_PIXTYPE" $screenpixtype; + putvalue "LINK_APP_INTO_SERVER" $server; + putvalue "HAVE_SHAREDMEM_SUPPORT" $sharedmem; + putvalue "HAVE_FILEIO" $havefileio; + putvalue "HAVE_BMP_SUPPORT" $havebmp; + putvalue "HAVE_JPEG_SUPPORT" $havejpg; + putvalue "INCJPEG" $incjpg; + putvalue "LIBJPEG" $libjpg; + putvalue "HAVE_FREETYPE_SUPPORT" $haveft; + putvalue "INCFTLIB" $incft; + putvalue "LIBFTLIB" $libft; + putvalue "HAVE_T1LIB_SUPPORT" $havet1; + putvalue "INCT1LIB" $inct1; + putvalue "LIBT1LIB" $libt1; + putvalue "HAVE_HZK_SUPPORT" $havehzk; + putvalue "HZK_FONT_DIR" $hzkdir; + putvalue "HZK_FONT_SIZE" $hzkfontsize; + + putvalue "UPDATEREGIONS" $updateregions; + putvalue "ERASEMOVE" $erasemove; + putvalue "HAVEMSFONTS" $havemsfonts; + putvalue "GRAYPALETTE" $graypalette; + putvalue "PORTRAIT_MODE" $portraitfb; + putvalue "FBVGA" $vgafb; + putvalue "SCREEN_E15" $x11e15; + putvalue "SCREEN_WIDTH" $x11screenwidth; + putvalue "SCREEN_HEIGHT" $x11screenheight; + putvalue "SCREEN_DEPTH" $x11screendepth; + putvalue "RTEMS_BUILD" $rtemsbuild; + putvalue "RTEMS_BSP" $rtemsbsp; + putvalue "SA1100_LCD_LTLEND" $sa1100ltlend; + + if {$screenlinux == 0} { + putvalue "FRAMEBUFFER" 1; + putvalue "X11" 0; + putvalue "VGALIB" 0; + putvalue "HWVGA" 0; + } elseif {$screenlinux == 1} { + putvalue "FRAMEBUFFER" 0; + putvalue "X11" 1; + putvalue "VGALIB" 0; + putvalue "HWVGA" 0; + } elseif {$screenlinux == 2} { + putvalue "FRAMEBUFFER" 0; + putvalue "X11" 0; + putvalue "VGALIB" 1; + putvalue "HWVGA" 0; + } elseif {$screenlinux == 2} { + putvalue "FRAMEBUFFER" 0; + putvalue "X11" 0; + putvalue "VGALIB" 0; + putvalue "HWVGA" 1; + } + + if {$mouselinux == 0} { + putvalue "GPMMOUSE" 1; + putvalue "SERMOUSE" 0; + putvalue "TPMOUSE" 0; + putvalue "TSMOUSE" 0; + putvalue "NOMOUSE" 0; + } elseif {$mouselinux == 1} { + putvalue "GPMMOUSE" 0; + putvalue "SERMOUSE" 1; + putvalue "TPMOUSE" 0; + putvalue "TSMOUSE" 0; + putvalue "NOMOUSE" 0; + } elseif {$mouselinux == 2} { + putvalue "GPMMOUSE" 0; + putvalue "SERMOUSE" 0; + putvalue "TPMOUSE" 1; + putvalue "TSMOUSE" 0; + putvalue "NOMOUSE" 0; + } elseif {$mouselinux == 3} { + putvalue "GPMMOUSE" 0; + putvalue "SERMOUSE" 0; + putvalue "TPMOUSE" 0; + putvalue "TSMOUSE" 1; + putvalue "NOMOUSE" 0; + } elseif {$mouselinux == 4} { + putvalue "GPMMOUSE" 0; + putvalue "SERMOUSE" 0; + putvalue "TPMOUSE" 0; + putvalue "TSMOUSE" 0; + putvalue "NOMOUSE" 1; + } + + if {$keyblinux == 0} { + putvalue "TTYKBD" 1; + putvalue "NOKBD" 0; + } elseif {$keyblinux == 1} { + putvalue "TTYKBD" 0; + putvalue "NOKBD" 1; + } + + putvalue "VTSWITCH" $vtswitch; + + if {$screenelks == 0} { + putvalue "ASMVGADRIVER" 1; + putvalue "CVGADRIVER" 0; + putvalue "HERCDRIVER" 0; + } elseif {$screenelks == 1} { + putvalue "ASMVGADRIVER" 0; + putvalue "CVGADRIVER" 1; + putvalue "HERCDRIVER" 0; + } elseif {$screenelks == 2} { + putvalue "ASMVGADRIVER" 0; + putvalue "CVGADRIVER" 0; + putvalue "HERCDRIVER" 1; + } + + puts "Now type `make` ... Enjoy" +} + + +################################################################################ +# +# Write a value to the configuration file +# +################################################################################ +proc putvalue {name value} { + global configfile; + + set found 0; + set configfile [open "config" r+] + set tempconfigfile [open "config~" w+] + + if {$value == "0"} {set value "N"} elseif {$value == "1"} {set value "Y"} + + seek $configfile 0 start; + seek $tempconfigfile 0 start; + + while {[eof $configfile] == 0} { + set linelength [gets $configfile line]; + + if {[regexp ($name)(\ |\t)*(=)(\ |\t)*(.*) $line all a b c d e] == 1 && $found == 0} { + set $e [string trim $e] + + puts -nonewline $tempconfigfile $name + + set padding [expr 25 - [string length $name]] + + for {set i 0} {$i < $padding} {incr i} { + puts -nonewline $tempconfigfile " " + } + + puts $tempconfigfile "= $value" + + set found 1; + } else { + if {[eof $configfile] == 0} { + puts $tempconfigfile $line + } else { + puts -nonewline $tempconfigfile $line + } + } + } + + + close $tempconfigfile; + close $configfile; + + file rename -force "config~" "config" +} + +# Initialization ... +readconfig; diff --git a/packages/services/loader/current/cdl/loader.cdl b/packages/services/loader/current/cdl/loader.cdl --- a/packages/services/loader/current/cdl/loader.cdl +++ b/packages/services/loader/current/cdl/loader.cdl @@ -5,29 +5,38 @@ # Dynamic loader configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/services/loader/current/include/arm_elf.h b/packages/services/loader/current/include/arm_elf.h --- a/packages/services/loader/current/include/arm_elf.h +++ b/packages/services/loader/current/include/arm_elf.h @@ -8,29 +8,38 @@ // ARM specific ELF file format support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/include/dlfcn.h b/packages/services/loader/current/include/dlfcn.h --- a/packages/services/loader/current/include/dlfcn.h +++ b/packages/services/loader/current/include/dlfcn.h @@ -8,29 +8,38 @@ // ELF dynamic loader API definitions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/include/elf.h b/packages/services/loader/current/include/elf.h --- a/packages/services/loader/current/include/elf.h +++ b/packages/services/loader/current/include/elf.h @@ -8,29 +8,38 @@ // ELF file format definitions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/include/i386_elf.h b/packages/services/loader/current/include/i386_elf.h --- a/packages/services/loader/current/include/i386_elf.h +++ b/packages/services/loader/current/include/i386_elf.h @@ -8,29 +8,38 @@ // I386 specific ELF file format support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/include/loader.hxx b/packages/services/loader/current/include/loader.hxx --- a/packages/services/loader/current/include/loader.hxx +++ b/packages/services/loader/current/include/loader.hxx @@ -8,29 +8,38 @@ // ELF dynamic loader definitions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/include/mips_elf.h b/packages/services/loader/current/include/mips_elf.h --- a/packages/services/loader/current/include/mips_elf.h +++ b/packages/services/loader/current/include/mips_elf.h @@ -8,29 +8,38 @@ // MIPS specific ELF file format support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/include/ppc_elf.h b/packages/services/loader/current/include/ppc_elf.h --- a/packages/services/loader/current/include/ppc_elf.h +++ b/packages/services/loader/current/include/ppc_elf.h @@ -8,29 +8,38 @@ // PowerPC specific ELF file format support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/src/crtbeginS.c b/packages/services/loader/current/src/crtbeginS.c --- a/packages/services/loader/current/src/crtbeginS.c +++ b/packages/services/loader/current/src/crtbeginS.c @@ -5,29 +5,38 @@ // C runtime support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/src/crtendS.c b/packages/services/loader/current/src/crtendS.c --- a/packages/services/loader/current/src/crtendS.c +++ b/packages/services/loader/current/src/crtendS.c @@ -5,29 +5,38 @@ // C runtime support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/src/dlforce.c b/packages/services/loader/current/src/dlforce.c --- a/packages/services/loader/current/src/dlforce.c +++ b/packages/services/loader/current/src/dlforce.c @@ -5,29 +5,38 @@ // Dummy dynamic library // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/src/dload.cxx b/packages/services/loader/current/src/dload.cxx --- a/packages/services/loader/current/src/dload.cxx +++ b/packages/services/loader/current/src/dload.cxx @@ -5,29 +5,38 @@ // Dynamic loader API // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/src/loader.cxx b/packages/services/loader/current/src/loader.cxx --- a/packages/services/loader/current/src/loader.cxx +++ b/packages/services/loader/current/src/loader.cxx @@ -5,29 +5,38 @@ // Loader class implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/tests/entable.c b/packages/services/loader/current/tests/entable.c --- a/packages/services/loader/current/tests/entable.c +++ b/packages/services/loader/current/tests/entable.c @@ -5,29 +5,38 @@ // Convert binary file to C table // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/tests/foo.c b/packages/services/loader/current/tests/foo.c --- a/packages/services/loader/current/tests/foo.c +++ b/packages/services/loader/current/tests/foo.c @@ -5,29 +5,38 @@ // Test dynamic library // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/loader/current/tests/loadfoo.cxx b/packages/services/loader/current/tests/loadfoo.cxx --- a/packages/services/loader/current/tests/loadfoo.cxx +++ b/packages/services/loader/current/tests/loadfoo.cxx @@ -5,29 +5,38 @@ // Dynamic library test program // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/services/memalloc/common/current/ChangeLog b/packages/services/memalloc/common/current/ChangeLog --- a/packages/services/memalloc/common/current/ChangeLog +++ b/packages/services/memalloc/common/current/ChangeLog @@ -1,3 +1,28 @@ +2002-05-10 Jonathan Larmour + + * tests/heaptest.c (test_pat): Make failure messages clearer. + (cyg_start): Output what failures mean. + +2002-04-24 Yoshinori Sato + + * src/memfixed.cxx (resize_alloc): Don't set default args in func + definition. + +2002-01-30 Bart Veer + + * tests/malloc4.cxx: + Never call realloc() with a new size of 0, which frees the buffer. + Fix the volatility of ptr.p + +2002-01-23 Jesper Skov + + * tests/malloc4.cxx (myrand): Fix overflow. + +2002-01-15 Jonathan Larmour + + * tests/malloc4.cxx (myrand): Fix so that it really treats the limit + as a limit. + 2001-10-17 Jesper Skov * include/sepmetaimpl.inl: CYGINT_ISO_STRING_MEMFUNCS checks @@ -235,27 +260,36 @@ 2000-07-04 Jonathan Larmour \n", + bufptr, (int)bpat, (int)*bufptr ); if ( errors++ == ERRORTHRESHOLD ) CYG_TEST_FAIL_FINISH( testname ); } @@ -131,8 +140,8 @@ test_pat(unsigned char *buf, int size, if (addrpat) pat = (unsigned int)ibufptr; if ( *ibufptr != pat ) { - diag_printf( "Failed to compare int at 0x%08x (saw 0x%08x expected 0x%08x)\n", - ibufptr, *ibufptr, pat ); + diag_printf( "FAIL:\n", + ibufptr, pat, *ibufptr ); if ( errors++ == ERRORTHRESHOLD ) CYG_TEST_FAIL_FINISH( testname ); } @@ -144,8 +153,8 @@ test_pat(unsigned char *buf, int size, if (addrpat) bpat = ((int)bufptr)&0xFF; if ( *bufptr != bpat ) { - diag_printf( "Failed to compare byte at 0x%08x (saw 0x%08x expected 0x%08x)\n", - bufptr, *bufptr, bpat ); + diag_printf( "FAIL:\n", + bufptr, (int)bpat, (int)*bufptr ); if ( errors++ == ERRORTHRESHOLD ) CYG_TEST_FAIL_FINISH( testname ); } @@ -169,7 +178,9 @@ cyg_start(void) cyg_hal_invoke_constructors(); #endif CYG_TEST_INIT(); - CYG_TEST_INFO("Starting heaptest"); + CYG_TEST_INFO("Starting heaptest - testing all memory usable as heap"); + CYG_TEST_INFO("Any failures reported may indicate failing RAM hardware,"); + CYG_TEST_INFO("or an invalid memory map"); for (i=0; i + + * include/power.h: Use a POWER_INLINE macro for "inline" to allow + non-inline versions to be defined when the C compiler chooses not to + inline. + * src/power.cxx: Using POWER_INLINE, define the non-inline versions + here. + +2001-08-01 Bart Veer + + * doc/power.sgml, doc/*.html: + Major update to reflect the changes below and clarify + the expected behaviour. + + * include/power.h: + * src/power.cxx: + Merge from development version. Various issues such as + synchronization should now be resolved. + + * cdl/power.cdl: + Remove constraints requiring HAL support. + Add build-related options. + + * tests/powertest.cxx: + Start of a testcase for power management + + +2001-07-13 Bart Veer + + * Initial check-in + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/services/power/common/current/cdl/power.cdl b/packages/services/power/common/current/cdl/power.cdl new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/cdl/power.cdl @@ -0,0 +1,167 @@ +# ==================================================================== +# +# power.cdl +# +# Generic power management support +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): bartv +# Original data: bartv +# Contributors: +# Date: 2001-06-12 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_POWER { + display "Generic power management support" + doc services-power.html + parent CYGPKG_IO + include_dir "cyg/power" + compile power.cxx + compile -library=libextras.a power_data.cxx + + cdl_option CYGIMP_POWER_PROVIDE_STRINGS { + display "Provide a string for every power controller" + doc power-info.html#POWER-MANAGEMENT-INFO_IDS + default_value 1 + description " + Optionally each power controller can contain a string identifying + the hardware or functionality it is associated with. This string + is not required by the generic power management, but may be + useful when presenting the current state of each controller to + the user. + " + } + + cdl_option CYGIMP_POWER_PROVIDE_POLICY_DATA { + display "Reserve space in each power controller for use by the policy manager" + doc power-policy.html#POWER-POLICY-DATA + default_value 1 + description " + Optionally each power controller can provide a word of data + for use by the policy manager, for example to store a pointer + to some data structure controlled by the policy manager. If + the policy manager has no need for such additional data this + option can be safely disabled, saving a small amount of memory. + " + } + + cdl_component CYGPKG_POWER_THREAD { + display "Run a separate thread within the power management package" + doc power-intro.html#POWER-INTRO-OPERATION + active_if CYGPKG_KERNEL + default_value 1 + description " + Optionally the power management code can run in its own thread. This + can be useful if state changes can be requested from any code, + including DSRs. If on the other hand the power management policy code + runs in its own thread and is the only part of the system that + makes power management calls, a separate thread is redundant. + " + + cdl_option CYGNUM_POWER_THREAD_STACKSIZE { + display "Stack size for the power management thread" + default_value { is_loaded(CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE) ? CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE : + (2 * CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE) } + flavor data + description " + If a separate power management thread is being used then this + option allows the stack size to be controlled. If any power + controllers require an unusually large amount of stack then + they may impose a lower bound on this value, or alternatively + the user may need to increase the stack. + " + } + + cdl_option CYGNUM_POWER_THREAD_PRIORITY { + display "Thread priority to use" + active_if { CYGNUM_KERNEL_SCHED_PRIORITIES > 2 } + default_value 1 + flavor data + description " + This is the priority for the power management thread. + Typically it defaults to a high priority, thus ensuring + that when the system wakes up from a sleep state all of + the power controllers are activated early on and by the + time other threads run they do not have to worry about + various devices still being asleep. + " + } + } + + cdl_component CYGPKG_POWER_OPTIONS { + display "Power management build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_POWER_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the power management package. These flags are + used in addition to the set of global flags." + } + + cdl_option CYGPKG_POWER_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the power management package. These flags are + removed from the set of global flags if present." + } + + cdl_option CYGPKG_POWER_TESTS { + display "Power management tests" + flavor data + no_define + calculated { "tests/powertest" } + } + } +} diff --git a/packages/services/power/common/current/doc/makefile b/packages/services/power/common/current/doc/makefile new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/doc/makefile @@ -0,0 +1,55 @@ +#============================================================================= +# +# makefile +# +# For building the power management package documentation +# +#============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +#============================================================================= +#####DESCRIPTIONBEGIN#### +# +# Author(s): bartv +# Date: 2001-06-26 +#####DESCRIPTIONEND#### +#============================================================================= + +TOPLEVEL := ../../../../.. +MAIN_SGML := power.sgml +MAIN_HTML := services-power.html +MAIN_PDF := services-power.pdf +OTHER_SGML := +PICTURES := + +include $(TOPLEVEL)/pkgconf/rules.doc diff --git a/packages/services/power/common/current/doc/power-attached.html b/packages/services/power/common/current/doc/power-attached.html new file mode 100644 --- /dev/null +++ b/packages/services/power/common/current/doc/power-attached.html @@ -0,0 +1,253 @@ + + + + + + + + + + + +Attached and Detached Controllers +

H@_2FyHZxiXAZjuWG*QMW%aO{tW?86BC#f z?dt~whpU5w3c$~T*y*w0$O~{Z3*@65Bn}8k2!$jSKw@|3y$VbXC|$Bx3Ucnayq77+ z4=sS~yjE9pu{?H?P=Dmx^g!vfK!F}A%&A^b0L=l0xt~H1cOD@wpl~gyrms_zKq0cA z(1Vv>*-;)=!05Q?Y_zEkG>18uzC~9!OH;nH*(_*rb9P85G-#JAiik5f`3e2Nt>GjE z8)Jd3>=gYRf|*kmPiQ$06u>YA#UJ|$S2hdv^NWgEocdVa9s`T*f?&>4&`mc6=eT0W zQ#BdhPdK@fs6MDE>7dv$rr?Eo2`v)Z_w2)MtAe}opC8H>@xj5&?yeyPpC1bvvn_mn z8m7m=TFT9;&1F@}k9^GsEfto3EwoTt28T$v3pj2WY@G)F&M%W4_Hx291GjYQ)U}is zG=*E})febyW{rMG`~8bEg7gKv0UKtSdRd^$^jM!v25?4}ezj@;YPay!irS0#Rx4g5IqyKZ>n#BCk&;#^WQoo_R`HboLh$jq>B)x~cF$ zyt(1hK>5mmzcw849?AJb-6w$hX+l`}@6T}MM1OXRFsCUVRe4zrxYmO|uJtcN$s{tC^$Uyjhjm9(umu=A-Q%fc+|hZycr!%@!{+tgLZjeZ6d@XVy_R zC654-I+{z5OBW9+`2(Bv6PvYM0-I3|2E;%|g%$=LzjriR@826Q^ffN!HMCO(gIGCU zcfd(O$XA7pH)Si5t+?D-4L}+J`DoNm5ZINi2{i1j{=TC13sRdeSZ27<8&|H93a{-$ z;GwPgH0?U!1{zlFnyl5J>}T>h8l5S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+q#_Ehp}=D`LAYXG)#MCAYg diff --git a/doc/sgml/user-guide/pix/Image57.gif b/doc/sgml/user-guide/pix/Image57.gif new file mode 100644 index 0000000000000000000000000000000000000000..8f5af5fc31060b57a473c0346a9c4436cbae6a78 GIT binary patch literal 920 zc${fpmlqVcGN*P!=WIQ%3 zaBO7eV~W`EVL<}}laN%(ivR_ePEqZ+5|4`ykM&3?H}P~9CLQZ%mRyw+A&`2ok3F_e zrNXe`>}-qTS3MRBmY<*R(A+gAGeGTPyR-VHo|z_3y%>DF?P70k(sZ2Ry4I@oRiO5@ R74EC2@o*cyIoQBp4FG$dJX!z% diff --git a/doc/sgml/user-guide/pix/Image58.gif b/doc/sgml/user-guide/pix/Image58.gif new file mode 100644 index 0000000000000000000000000000000000000000..fcf5ef20970f6d45fb3a51b6d5603cb7e6c77bb0 GIT binary patch literal 926 zc${fpmlqVcGsu@^0WIQ%3 zaBO1c<6<}vu&{xFNmz^J!H2{nU80Iy6D%eyJl@Y{T69F>lhVm%CE2Qw8J`|_O;h8p zThd|l%(F>~`Nf@+o0t1fWNzY;^_r4#dbUNbR88cE6=&KE%>7!Tg0qg#G@h*$+p+bP XN0X0tl&jSR&B)Cjrju+X1Q@IV|0X@V diff --git a/doc/sgml/user-guide/pix/Image59.gif b/doc/sgml/user-guide/pix/Image59.gif new file mode 100644 index 0000000000000000000000000000000000000000..37ec9742e17a2654bbe8140fe12aab1512fabe4a GIT binary patch literal 2107 zc%1Fi`9Bj30LSsYdU%K&sn^;oDVry3qQ^1UQc}Zaay$>Mxv#A@#}kTN%~9(?^1^0g zi{#dFiN&!Fp^nU{WBJ%=u$GqsBP<5PpK@@CTpT zXT!XB^%bLK&QH-SOHsK~-c`y05G=cDnC+V#+I8Gr2U}#_kO6;bBDmH-ilxcs0SWIo zW-sc-rW?+VwUK{OJc;3~^;6HQXc-J}YL|L4wG@H6&2=mNbYs%ofQ4w0?&jxx3&kkJ zz6cytQ%Z9$pK6I7O4!7-n7Z+>>=6x($i{h2^rnKHp2Wa)&O0J@WmdgmXQ@*neBB>u zvOWJcgfyS;}P9egwXBh|}UUD<5rK4=~97kEQDp8C zmCOd=F3S3^1*IYqpsV!2@Y0pLW(;>PuL-y$+dT{|7f4m3{p~}yS!FPjZR;$G!-9=0 zz=d&^QA^4F(9?lTC(|h)HPf5GXYI%9Ocm4dm20I;+8unF*ZAAD^89J zgYp5DHAV~f`I$**{%TPM4GUqC#h|6BECeF2%F>x@kAIQY}mnLW0470>^H(6wVNWiERUD(bT=w^g%q744Ac&%=3)4}NoA$_*L%Wq zlbs$4t=Gm}Z-&7A4DafTC!D3tajNL+Wo+?OaMPxE`mY{+$xI|61)dkkXG`YdE(G14 z51=T0UT~Mru9H)GVA1c>j|7{$J~w?#90C*7^_!1>g{}>N2twoTh9bq{p37Q@`el}t zax=CXY0e_K04aN17Y7GHBfSi0NJ+F|>2I;7Lxo$MBb&P$4=YZN4RRDi{6F;SZNv&K zE^JnHHdi%f2LCnl*0 z;(2Zgnp7FM?}Z>TlWG5c^6wS5cCMk;klQZ-;V>C|UE+6L~xP z&K#38KOL^GtXr?t2H{wPK=^C&_V~>}?XEvf0-UqBI>saWc!ON^;SXeUu-ZcmTA7%8 zi`Q9Ay(RC0tXsr*Kgg$COpkNDj2_xHgS@dSyP}~t^^kb%C6pCPYzH$&C(Nt>$~9P{ zoEaI%0OWe406P*>Ao9L?2^czj7qg*po5{cYZWm9q`35S;1olp>hSy;7`Q08$WsojI-!F1EvTlVWDowM2!IzG9Y;AkfP>tte|12}jYe8;2WYChQbm zy@9quf{tf{bkslgW>)7wl#%sZS7B+^axBCs*`5Zr9Hl?NxGOn`QQB9wJsrOt&azMG z@HvUo&Uj`V6vbOQ+fg5Z*hkH)_ Mb^Gg&ssa%I0!%WYfB*mh diff --git a/doc/sgml/user-guide/pix/Image60.gif b/doc/sgml/user-guide/pix/Image60.gif new file mode 100644 index 0000000000000000000000000000000000000000..14883d3ed36870cc4c646415f39a98c071615bd8 GIT binary patch literal 43643 z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z7ngB4g9sagO#T11aVM8@WyMON&p-*cayOTAHRN(l1xPzrbUT+vdlW7}7fVN1bywFc zVAPi|H*{H7b_@4&m-IpvcXo4EZEF`S@F8_|7kC%vw-2?qd9gQqy|;Y9mweNAd(W4B)pvZ?*L|rs ze#KXQ;n#lO7k}$Ff9aQh&3AtN_kQ(PfcqDH1DFM(_kcICf7_5Q%C`*N5DnF^6S?q# z^EWjsn0nn1gDKbyH#iP45rR3G4I5a58JH|hID$J^g;SV?OPGY?(1S5}3-O_ZVc3Fe z*n`Kgfw})ThF6#cc9=JVSct2!c8A!Aj~I!QSc#XoH5Y(>zxRo$F@$e(ETUL8C3qUG z7<;GqgRvNdPg9GdF^n_Oi=`2QnHY_km_D_zC#X>)H8Fv&H;(-ff$3O&=XeY2IFIjG zkHfH!$MBEw*pK;`kmWd#54n)-*pL%>j~CgI6&aEnIg$tYktNxZDS46snUOL1k~O)K zIT@5aIgJi1$ym`^MVs!*_B~gmLam1S<@?8*_E5o5+|{ZRg)Q6 z%a@^1BfIf5dAXN0@s>StnccV#oB0wa(F8UTnx8out2vFcc_(+61R6LjKjW3LIhnPY zoXh{&oX;7ZqtS`M`Hia?n#Gx!WwVOGIhJ90mQ(YV;hC0K6Pxo{C-u3W+4!0}QJ-b` zozoeiC35UylzDfVm)qHzA-b65kfOV|qPZBOFIuB5nxiwiqc_^4LmH$<`lCx)q)nQn zPgvg zrnlOkPt&OXdYpm!o}0R@o0_UI+p#YjvY+~~w;HfBak1Navq!tMSNo_No3%CjuD@Ef zQG1uInXE+{pbuM{_j<1znyZ&_85bhBg}bVwTDOlIxszMDKk=yBnYh1Nm_Pfbk=eO7 z`?;UHs6m6SiMz9F*}1YM9LbYh$(NkTo7~Bt9Ll3y%BP<K7V>IR%LQ?X>V=-03rViOjc=ScTjR~GB7XzJ0YzEl>h($ diff --git a/doc/sgml/user-guide/pix/ToolsOptions.gif b/doc/sgml/user-guide/pix/ToolsOptions.gif new file mode 100644 index 0000000000000000000000000000000000000000..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+E3eZ+EJ)6$#Ah!iZP=nMg8R%dnBmjy31MRb$UH||9 diff --git a/doc/sgml/user-guide/pix/addplatform.gif b/doc/sgml/user-guide/pix/addplatform.gif new file mode 100644 index 0000000000000000000000000000000000000000..4d85ca06e786008a1008f4682631de99e1a672ba GIT binary patch literal 3040 zc$@*?3m^1HNk%w1VOasi0HXf@|NsC0|9jrw-p0emgo1}*y*TU5yZ>Og83HgAD4?bQ>b`Kyy6Y<2wyf`b@BhG{a7Zi~kH{ZD zFlZVKPH2;0NHGV`W^`ID45+13a!f9p&*-#zZC+~MaHg(+7 z;LqIA+w)pfD)#^e`6~MR{`~j!3B*URpuvL(6DnNDu%W|;5Fy6$_9mMwczR4h5w#Kj zlrCb&I)dW(hUBl0BRw**7qO+wmoQ_>oC#9^ftxsU=9G7l7QLT9g9?3RaVWKJ?vg59 z%CxD|r{^%1l4`5uF{@VznVM%WK!FxCXy5>g?`w*)U&pcl8`iAZ7B$ksC@VKD+k0rq z;$3?duHLz1!_uW|cSa600hZ9BSdS+(s>>LwoYvJq0Lz#!YtGDhv**sBKZ_1cdbH`% zs86d-&3d)#(o1y8#_2d7WTUuq>)vhKCvT$tXbK-rytwh>1#jc=y+@?5C|OKK=V)wW zu`MNwT@MCFqso)3A+hv0^MDEJ$MaJZo!hCOj;;)y5*Vql6a zw#XqTY{V$zj5OA0&h%!bT)deTbfi`{ot?QD zBaEu6ZpTY>zKm)Jd${f+TxvS71gf zEn|<vKGx;`g#pQzL56qkIgV_z zsOo@WyN2*nq>Ov0O<6o*LX_%6q*KRu+S*txdcGxu@`0c<4FMJv4piq34MgOgQ ziefMC{D#dxFFk(IPm0vu*k`Z3_B{9OHaDqMl+*M-b)S({6jps8hJc2jO8Zmz`F{L? zlJAQ7br9&>%Q1J`AlD%IS|mt>lX?_zeDRYXD(Y81`>_Il%=iXZ1n9usK#*Ak5P=3a z$iWVJ@PiTvTJgecs`2_1Daow@LZz+ytY8q)EO*f=8|_s9%88mcm{31n*qDab++@{op1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(fLa@zenu1beB{O)C_Kk1EV4KI@lERFtgD587q4_C`ug^58 zhguB*k3(R9zVy_;et6&&Ts435Z=Zbp!8?C@*H?ci8+&N+d#_-_b2D%2?$7AW8H5|r b2Xox<oO`x;Z<;<}vA_I(Gf|Vm diff --git a/doc/sgml/user-guide/pix/arrow.gif b/doc/sgml/user-guide/pix/arrow.gif new file mode 100644 index 0000000000000000000000000000000000000000..4db46042e7b1e67995b5ce6e6a6eac77395d3b1b GIT binary patch literal 847 zc$}?LA#Rmn5S+ZU;Wd~lR7w5=6tyIfU|LhC;|iG32ojLIXRx(<1_ZqVeh)!cctq_zYaak@vSePym4j22ipp6j6;Dlu~4Y1RESs>Fq)j z-RMCpqf;1S8Z#If2`Y$CLjx(mfi{+h-L33Nu&S%3N?GfSEOv2<3JVvT)m=T+3Muyv zYr1A?WR4y!vDBq0DU_qZq|MT_6b0F2Xk&R;5tQ7~|W=}%Cn2oePuXQ$()^E_dx7J0q zZl-k=E#I}A)$&fu9WDJ@3biz7vDD(BwMh$0t6P8bf5u_O?e9+y-yiY({_y`|{}MmW wF5aEv`gn4-!`0n(eZ+ouvVGis9#-jY`+7WmvcvoPUspJN`t0({iw$r706IH=(*OVf diff --git a/doc/sgml/user-guide/pix/bash.gif b/doc/sgml/user-guide/pix/bash.gif new file mode 100644 index 0000000000000000000000000000000000000000..411c8b6dbcbe06070ce2b6c8ce87f31cb6d3c324 GIT binary patch literal 15091 zc%0>1T}&L;6}~$=vmO>m7QAZ%!O8FwcMXnTMA6&)8*s>)zP$75YBCjQQ&*X;Gu>di$#fuDLuH1}41*aaGk}hoDl>Iv8q74A38;yI%0Ope zFfbVaDJIpZ3lF0-kRAHys%ogJsj5I`@tdxzx}oZ(ssnj}n})6$hH99q0pt|Qn!0Kl zs%fewppSS|1ziP01ycnemk9$pjb5T#KnTbZszzOS7zhx3$B&`wrmh3wL$mnJFm%Jz z4IsGa1#X&#ZkoCYh#s9nSse@=OdWuNLBYb)7!Je_6dQts%Ft=_5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N*`=uoA#6gTG52{A@2FRR=#i!!TDOH3mN$+nx3Qe>3<=N@+4T z(r1H3x%=b(3O&1$Y9zJCtUTuN|Dj1@YS_vDe`20!6`yB~(v1_zb$`DrNv8d~S!2)r E7YxaO8~^|S diff --git a/doc/sgml/user-guide/pix/botclear.gif b/doc/sgml/user-guide/pix/botclear.gif new file mode 100644 index 0000000000000000000000000000000000000000..0b907f94585297d0f8b40d04c8459a9db4a0b857 GIT binary patch literal 194 zc$@*k06qUlNk%w1VE_aW0FeLy|NsA#t=<3t00000EC2ui000CK06+qpjE||y?GK}z zwAzca-n{z{hT=$;=82~2%C_zc$MQ_q_KoNI&iDQg3<`(DqVb4KDwoWr^9hYgr_`$T zip^@b+^+Wv4vWX+viXcotJmzd`wfrF=k&V$j?e4&{J#GW7$`VMSZH{Nn5ekO*y#8O w87VnQS!sERnW?$S+3EQS8Y((UT55WVnyR|W+UoiW8!J0YTWfoZD^>siI~0Io=>Px# diff --git a/doc/sgml/user-guide/pix/build-tools-dialog.gif b/doc/sgml/user-guide/pix/build-tools-dialog.gif new file mode 100644 index 0000000000000000000000000000000000000000..5062ad600f811be9bc934a103ac5125f44416ec3 GIT binary patch literal 10855 zc$~#rUrbzAdOvgL&TwZK@C6TKjEQ@}UUxRwEqFr8uA}M>U`nH;nyiu$LD(7_a%F{X zMcl;Yp$~U}U_$JONbAaz?!(yWgOva_5ti(YAI7oGqI4dJ)Gd*<53IM5sx+3!Ti;H< z?>pz-xdR51O|?4@aOT`|&iD8He&0EF{^oCcI{xb9zxsa3{)w?e3_jRChYgls%wjCZ zSdlS~-x3Lyuvj9;5=EBa_|Qr)%VJiJSw&`X9Ggq9oW*iEmMgLx$En2xD_X3WW5psX za#)G+1mhOtImU~Ob6gmghP7ZajOHi@KUN}jWoj4fJ;VlGiECW;(%gsBN`C3r5uiwVwAWwZg51}#A?juxOKSQ^%X$s7&B z@9@c4R?)IJ+6Q9cTP|niidK%Jxu69+Eat3Y(JFGV9+ZNy7SCC{XmO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X zMOCPrMFm5!B#$3(0$Fy)fM%k>J=3}-U|KhtKN<1+GNVwq zOs41ChMZ~6ibsZ)y|X4m*A`9zdUQ<&eXY-*4zRA4)w0@k!-a1D?WO5vd)x&L_Y|f0 zUK9Z?d)IOLyM~r&7TtVzvGw3;PuY~xaZ7*EskDzb?JQF937Rghr7=pEYA!sO_!8@{TDCy zh(E8XD;tX1K9L)~&5&_E{$}(2>H5DswK!Upuk+l4?o!y!?raV3-TH1tzJ=RXR`Kea z`#0Vg@9Zj@|KWGp)$(1YG-IN4Cfq*zgEJRB?;L_~{@jsYb{^BML+Z`Li*19)S{Mi5 z`j3Wj6Id2T~6rQF|D;YDRFlYAlqNi}rt6!P*~Ip`d{uv$uig%y?kw}SE& z!Qe*J$F}&Tw!bN+r7)wUu%cZ{ifY> za0J9EL%xmgGWU0vWU#*DEqyyxadzJQ&BgU!rLRjBpRD0=zswGnd3!E{0k1m*nOOGj zZ_}?znm+v%>}xLGrWd{em(xifh|ONz?saSD(A$SohRxJ!LL;=$U%DvR*>tGn>7E%H zXlhWt)W4OccT3l{`$f*g@;Ci?0zA58A)9}`R>(rO?(G=CpJT8SySGUk?E{KsSZ&2C z#aTXI)z~ot@$pwwM}~Ihvp>XTRn9wj`!|q5J2utX5droIWRSQ|+M$J*tzpP^eBUoN z6uW(J6AJKB2~pGR?kI2!q|lDDoi_H&#;x_lymfvhP)d8s+p@REn`Z6Zb;6Tw`t~CB mJ`n=>53Ha51V07%e^u;73C?zU`=40!KFQNRX^3d-=>GxYdPX$> diff --git a/doc/sgml/user-guide/pix/build-tools2.gif b/doc/sgml/user-guide/pix/build-tools2.gif new file mode 100644 index 0000000000000000000000000000000000000000..c0ec541a128456a1c1303f76aaa889074a7a5737 GIT binary patch literal 5185 zc%1E%`#%$k|Hp~smMFJIMNw{@gOItLL+-cITw)=Y+~#uR5{3$4nOtIMTdrf9&25|A zY;wOg5p(AxMHEHIrT931!}r(k>!xV znj_W`kGui|numwy@bGZ^D7vz?c%%=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oC!2%QiJ0lKXA*aeM)}tgVEqe zBf^a605gI3-ed6V%;4IuK|l|=j?}Y^uKAw$b_e}-&q(k1<;GDo#&f0812CjzFvLGw zA&@kriX0O5tgylZ#Lo?%HXfGr9F|TRmgJO}G!Dzp4xj%$tZ?q#MdNo$p6}#1B`2?5 zuL^OO$sd0A$M1KV=SH-RM|3<#^pZyOpUXI0sO<; M>`|$6;yi}`13`8T)Bpeg diff --git a/doc/sgml/user-guide/pix/build3D.gif b/doc/sgml/user-guide/pix/build3D.gif new file mode 100644 index 0000000000000000000000000000000000000000..1696b33000e6ecc5366812b62c63d4039e17dda6 GIT binary patch literal 66517 zc%01IznkfOD=I3=%gakjO7ipbDuo=Fw(u7#tcN866v+n4FrPnVp+oSX^3OSzTM- z*!=!uYkOyRZ~x%%==kL4>Dl?k<*%#jo7=nJ_kSK9pZ-3-yuST|1Aq`Rg@%H`5D*@V z@kB%6a0E83QjS7n(P%UgkNws}WAS)Am2?!DVpGXvGLu%7@nlo!bULTSRE}bE*=)9; z+xgaHbNPI}L=~MNqTZ zY`e@Y%0(;pqYV?jq87!KRzr>Y`S+Y4b$dNaulE~-0$urXqbc+q@tl2y)JHlVT;+#* zqRFG_3^De$?9ByhIvA=@9cgFtnL?_1waM(M+v##0sW``MS6ksqn_F|4(PQi9&60qN zG4`IPqm8kk_|n{0-rJLf5Su4j9LI{HC%wVe zAG!QY%`N0zJC8Eo4>1)}QS?M2fs4o|$)i|IQemhZ_~$#Qj)n$5sqEHTPpCb0*YiUal+*YYo?_b6nBvY4)p>>S|gbh}ZR&_EimxjLsr!7~PO0$r?;r zoJ)A+#QDobJB8pY0!=f)9%CgorQxl9OZY`)w-hBK5qr4IgMEJR4d3|8 zzi0SK=l*-%l{4tZz0+A?ON6xkXi^Dy+}Wgp#r=DdKfcuSAXre%4(-G0kToqLJ~WVy-bCPp+Rp`NG0Rwip(#ElYfuaKS(P$g!pMH zopl<1F)Kq1Fo8N_atUw?h zPHcSG1TC(ibNcOHIWee#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Q8Fo~l*`8N9)kK+)Cc zW49|-SWr^8g(@%6>X=pYiF}QoQceF!lZ|JV9?QBc6poM(TD1WPcS73TZc7Z$#JUy@ zd!F{o$xGRS__{0UGPa6<<2gW_K_@t@f#0efp!Ug6{}YE(`|KPuAtvX%kKwZ6&j%j^ z{MRHQP5YnHJlB{Q?(!c~kQ33ZsiFeSJhak-nslh2J4Pwm*~e=i#rp_3KhWbQp+xt# zQV3>C>D4p}i{PI@HD3iqTRds9)aclb*F>dkVg{y}iM0+hONg?I0RuQZMut=VRKYk) zXSxS@|FDePPF+#XQ1Ahg4KWhE2Os-Bt2nCzT>)^IiWS2cdn~F3o90%aX`x_xtwaU- zB!l$c;0@&*z8@nz5yczD^BCN&*)U0!jTjF}9SBpC_lq(uymrlIn+~QNIPGr2eK*Jb zcb*)dwksD%GSqXW#pdj$K5Y-w*5m#rR2H1Yfh*B7)2e})_ibR%#|v}ea#JrM zt=W$80{WugD_^TGAWWP4wRIsB>bS>&4`fJI@E}napJ+WJE)+TVe_ zXK_!mojmhQhzSt~`Uwg8zJzz{rBg%!UE&()@~%{Vn)r&f#vvwa9W=44V3iF>(XfZn zdS}muF%q`P=?9DD0WSe27U;ORA;LIlx5pr5kv(rds;8x!YHPlSi1%whZWAz81(;dG z77W4&Fx`xlYX3h06anl0-hD;KD}W6H+KZjm)4ks8J&&l--9J#sxXrT}jRfYaVVk=H z7Yp8#@QX9xbgG#mSJYI0jF$S>jtea5 z0xsD>R=wjyUgW~jqg*=5jvgbYACne&=|e=X$>9eBS4N{^x)m=z>1z jgkI=|e&~pv=!(ARjNa&u{^*b%>5@L_lwRpC9tZ$C8wc># diff --git a/doc/sgml/user-guide/pix/build3D2.gif b/doc/sgml/user-guide/pix/build3D2.gif new file mode 100644 index 0000000000000000000000000000000000000000..12b55b7786b588890da75e1489442d79351e1ca5 GIT binary patch literal 33535 zc$~$3e^69cp6~6SG;M?3$Yqcir)j}3-Xx16S(44T7X)J%lLa?kn+{rt$mvtyC5<_{$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panQlnM)yDJs2hF7^e%J41Um3t;DV2*}4sr8_;<`p^;etJMg&{T0T$6?k zRG**6sN?YkxqDq^1)J--3U`w5Z-_E;A648LW&@8M`WhO~o`1( zfrI5uzNZylvkQjZP;^&@{Zfvn7F8^uz)xySx=EHHXqsJd;JKcu_Y-Q}#k@Zm*{;{7 z1#D5C+zc0-0*8$LQ1o5hM0aS$eXctJ^H>AhGV`mS{L$WP!GT=_;(vBVKfS54dRQhsb2ZK^ zjzbIi*g%gWcG&fBm>rE;1KWKxl1ICFiKg))`=W>TstcIkkPcB$r~6knF@AZ>6mF&w z6@F~Qlt-|st@PnOP@#h_Z=QW)#w{6s$~8sC2@(B+P^L75*<{q5m~bRhj8KW;sj}1i z{3iur`}^nsF?6^t6r$zk^~1Qje>t=ZQ)$8ow))u}YN}KevjpJrOd~hcEXJ=Y%9uNeGD}Qf{55#` zHX-(Q?|m{pa;|ZR+J~-n&;YP1ZPI;RUT|5{rP^rvs>&4BY^(*5A}R`GCaaE7*FgtU zVcF-#FgMxkB)2Y)$IBmCqirTHeykV#V_#`HORCzc!uxl4+{Y`+Ylj;X3+mokUHO;a ze1!tiPT$w!UrKq79GWA|EXsp9=%}rJWW0 zC;XvLqteHup7Th`ue3^$elIV=&x5zAK`*5Z#@6<;Ijwr{O+Ir{6gbfPP_0Y{}=Dt|4#q_ diff --git a/doc/sgml/user-guide/pix/buildoptions.gif b/doc/sgml/user-guide/pix/buildoptions.gif new file mode 100644 index 0000000000000000000000000000000000000000..32a72b3e1068d6c8b4ef245507398d4a2abe5c7a GIT binary patch literal 11835 zc%1E%bypPb^Y;-%N)eEdMn!3K0cnwrT}rw|8U$3jyJ6{O>7|!mU`gp%x;vyFMl&*Tdm8a9Ak}nhS+wLI8XKH2S|v^z_X1 z@WgZvvZuAP72ebeE%@&@QAkh-z{&RbKic;2$n-FBxV5QONKk_96Vv78SWgAuxSJPB8(N%+_K|H-Z zB@`uWoNXX!P*}l#y+Z(>*e*}Er)OFn|Cl&BI|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U! zce`14NXun$%56!}ZE3@8S>G*e_O^WIw!$?}3C~mM@na>+U5&t9?SGN$Mnuy6laB{H z^bV17*I0Dd)Nt3_ch@rO**cpav2ynp@4lVtzJukyQ{cX<0g~>$IVyGE>w4c8df%UN zKhSX7rfq}lyC0gpAKtmgj0kuRTH23NJ&dzFOb9%5;XNFSJxp6Z%(ywrp_QjDjwV2<2T)5WGrehtCP3AQIw?2s#Sjee$R**#KV|= zUv9_*d5jO9p%l5yFbvra&PDcD=Pq)_?z58q17 z*o?7eV0sM>hal7i$6S?3Up&{(OU?zj&1{X`{w3EE!eM8^P~;!_r3%BP+HPba`(S$j o-Yag~>rd<55mdbP2iJhj{&*Jk3fmi=?V)r5N3^XV6PC#T0g!scqyPW_ diff --git a/doc/sgml/user-guide/pix/ch-properties-dialog.gif b/doc/sgml/user-guide/pix/ch-properties-dialog.gif new file mode 100644 index 0000000000000000000000000000000000000000..93e6caea26ae3fe8a6b9436f17bc7ece0df49f96 GIT binary patch literal 8173 zc%1EXWm^=C^Yzk*3W_ucBH$9Dgv25#-O?o>-5@R?CDIEl-LdpiOT*GE-LRA{-6@^Y zEdTrW8J@S#d3R>!%r)nl8F@uHVUSr5P5{m}0Km(`dvS5NG`Cb%QTFig@LvD`03;^C zF8+(|9&Y`IwXLP4CCnrSJ&Nw_>+S98Mb;ycHOMkV8Se+)!^8h-4lz?0^dzQts2A0R zLN=p#-*PuB0LLCtjxl|(^c zS1_gzgRC#(v{hD*)YQ>5H_(Ko!F+!D zNU2EKyW8{fa9o^jVWv6cA)+{ND_Qng&W+YljzyhnP_evIb>trlh1I z1$MH3^?~E^_Oh%3|GB<-fEU1hynH~yASD$gDM_isq{PIy zM0+QD&Cin46iKTbaW$VX(|ZkgyaSQ3lV1!7~$ig+cI4I4ms@Bq{~3fFm=@ z%Kk^;Wd&vMTv$*543=945(W7LK;Z@dQ6E?)oYx9gRseta|M-8v+yBlT@V{RG5Mu#2 z#0&~mIh{eoFF3ypRONOnu6gJ z9*Z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``)nOW3ZOPV$Z>xt#6sO0@Hx#0ZsMnC!0Yzpd>QR@-(03 zLY~E<1X~f?^hK$y^RgxtQLEa(`ST(EDB2`@zi8P0Ya1ajn7*n^>*G1Yh|nzUC^`xp z5VESQ8f;Dr4t&OrlL-`VQcMfj!q2v?-6qc{ZuoGDj*q=7aw2_^_Pno_^J(3PG)KCc zKUVfVW2CKAYO&@$@+{`a@~>ioc>MT)j;`|(J zFQ6|~;Go6XqSK-Iq89hn{^*m^KIj`NgmV&y&7)n70Tar~D1j2I_4?^z!Csz9^tR1j zn(k@%@5~6}GF_>;iT--3dW7t|@9Ug~uz}j#U%lK01P<}zB6dis1Ni%ZTa7#_OiOTe ziBUKSZTlp==%aCkdj`E$S)g0(q;aJI%g$sDB}G;*>d37zI|H9fiK%z%`ILv z>(L+XZ&x3U?y)Jc5bkmhb!CaEWd2S=C4>pi!n_~Wql>2Eo8P*F*#qBICmj9GsGMSe z**mdUiggPbK(l@b70`)hv@Ut=Ue;@TFw<{4G8hvgDx2va*KiExjOKM;!Hd@HP->${ zAoy#!+?J@VN%|`3qvNKAS<^2=wNoZn&=yPXr0%mRW4S-A)`AVQXqQkhY*W-mWO{b= zM;|!rU#pGymY0hFEE zkGbF3gzm+%Pwk~!Mn{T96-x|y<8Y93n9BcFW+moeI6XJj(C1#^j&d-$oSSYZ^r#9E wb2O)(pXnFBz)v&|QtIfO_3{^F$&t3T*PEZ4?(?XxLpeGBn4g~~B?f%_Klax!82|tP diff --git a/doc/sgml/user-guide/pix/comprepos.gif b/doc/sgml/user-guide/pix/comprepos.gif new file mode 100644 index 0000000000000000000000000000000000000000..80f61dd9c5b72e67ce9c58a9cfc3ce0cbfdc91ae GIT binary patch literal 8717 zc$~#|5iqPOG3Jl650Lj zexE<$nHTqU%{?<`&N;LD;+B?`;^Q~I1*kv10sOxJ0stTY00ICY000yalLLVO5D)+X z0uVp|3WO;GK>!d40099IAOH%2=>|doAP4{g0U#g%6aq60L;yet00aR*AOI*78VdkK z0Y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{d>l&8^9czua$6bLm#JWtHo1Ieb%hGw0iJ;Ab%cR()JLYyY9qd?s(G1 zxrUudYjRduo8 z(NA2)8xHxmc3UzuY|Zp>{|mW;?j=3j;1Id9J=e3f4-r}xAQ2b@w%FdjeGTJ_b)MN5 z*Ci!cS|L7m&BHB?PxGzcRo`t@v0lDP+km$spQOYd3mf?9ZhxUb>fcPhTu@Qp#K`tEyi~uRujpUk}W-SXgPm{_?F0 zB?)Hy7$S&}+73T6hf*M!K>T~WywwQr&pRT%TH9?tz=Oyn(bLhIDKfs&$c)3swG^Yg ztAZj}9}3@ry9DszH=}vAfudOUzd#eefdBh)?AZ-}*=loNP7Ca&LR2Kvwx3V7vAq0pciCY- m+AOuy_1`Ble6y-2Z}9|QB6>bdiLoDvar_fo#C{F{2>u_+9C8@| diff --git a/doc/sgml/user-guide/pix/comprepos1.gif b/doc/sgml/user-guide/pix/comprepos1.gif new file mode 100644 index 0000000000000000000000000000000000000000..a910db740f60b270dffd90f747ec686b6baa53ae GIT binary patch literal 23462 zc%0Q-TWlOvnm%29ars_$?BE1XD0iHUp);(Lj@ce2i@F^r7!*bh8nu#Eh>RCnJ$P1f z(1`Kw^3Zl1VjE^RW)mqL%|qM6NQ{)u1sW-cJeZK|qNtIa5t0$w2PZ2eUXYy8Jn*p6 z+5bQ1)Tv9KYMdE%R-1?DxU1^ax%`*!|Nj5f)6X1C{Oyb1lFtLbB4ihVf7m{a4H73L zOGtr`3LzB#ipNPjOX39*uaG#!i`h8IW=Xa{vK5l0cyA$23RzMpkV1tNC_Y+=lS-CU z3ZzmY6$(8O8YeVMXo1iQp%gpDuAwh@81AO{9{iV$#|!azB_5~vTKFrQjb{t-Y$cwh zI10E}$i@qWc%c$6P#hH8Tgk>Ng?ObBuTU5xJQ}CjI4#6!B~B?08Rr0lhEc+>D9!-i z1YJX4@G!**;otDDkj+-IS&H+6*TP?gLbg!J7AQ^^MgbQqg>0pgtx%Xf3<~be(n6M2 zvXtUt;9|kkupBUdife;Yg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{osOm!LuOZW`iE{B`@V)e-9(6|eqoer9nXDi)HMj1 z)MW*vIq9jGZBi~!bie-rk^w85Z5<%-cF2=nb(saqvtHdkr!tt>%cFoU22wOOa9q|t z{^Ihzf`Me0Hh5f?tHwUZ7h~+kjq&Qb$slw1@}3^Y=VgQ+p%0QQ{=Rd?&ad^n!H$|a zqn8+d?;{uX0Yc9Ysez{W?B>!?th2`l9k3%Z{J1Nj;#d(8U+aXJRL$)>%4%8TU4HY! zncwTEe!OTxU6p9nTDS@;L`GMAa?kI(c6f46a^V)qza&02=g%6Mif@7lK8h;B%%nJO zNbE!ce}@eLm{kk;ewA;&v(C-@xuk55Ri5JgB%7nLRo+wfAekLeUu=H)s7PWvYK0cO z#ldb#q)ZgAN0v>NE%3_r7Ca_iJa;-+$0OV ze5$P$zt$AGVpIiME9&!c)O|p%$kVM!-!mmRA2rQra&X>k#e$;zzw>k&Mz7%Z&7S-; zY1f<_9>8st1;r>ck36;LIcW84$Meo=8&w6&y`AqW&<=m!!)F`= diff --git a/doc/sgml/user-guide/pix/comprepos2.gif b/doc/sgml/user-guide/pix/comprepos2.gif new file mode 100644 index 0000000000000000000000000000000000000000..69ce08048395408cf70b58590e388b0008d073b5 GIT binary patch literal 17868 zc%02#U2IfGmae}2<7?xecKas|c%bbV;-pCgG|qZwQFLt#>mUZ12(_T)AO}sZdgOgD zQMBt><)Pa)_(wdzES6}LhqjfGSjmkcbR?qT!Aw9xsF6%wJj#=?gp`+&%)D&gYR{>v z`_s3p8c#xImzR|7x^?U4)OWt~opbZA9~|xdr;q=KWPJZY$X){fusw|p5+}qYBuhw< z5Q;y=<0Nj9c$UPABu?>K-j~C-{im!#AOfzm~<7P2#Qk(_+F>A)N z*?6`X&r+Ne^evk4Vm4kZ#)}l@2#?088K>DeEygLuDdQSo(lASy7R43dn_y@d3m&Gp zAp9BrWlghaniSUuuZ5qoSunl)+Bq!c#;Hw&JI z?SS=D+#6gH34b=*4>AI0sUcnG*c6Gy^HQ#=!#hlv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6JmH8k?|@4p5P^O0Yg*g34^@G!-o&n5fXn)jH+ z9a6&QtMiC<6sS98a;~^AEj|YkIat{_kq%O#BNMjc*7XrpneO?}iX^07Rjw3q$#}eE zSc2hI;zm@uH9O>e)RjLcH-JO~=d}gpe%t?D>3ldV&7(By>rqx9P%d83Q>opZ17#VN zbcU5Tp!decxUw=)QK$)*<)EWv^`3|LUsVOb9S6TG;-H+09am1dPIWO$sxk#g3OVB^RM6ch>A@)mMS5G&n)NqCTG+o(E*4&Rb>QAYcQFrDe6TX z7NFRA$7^sm%rYyY+*GsT_okL)_6LMX`fAndbNKb@@vEuQ#Id{4{gkVk+0sANzCx*Q za13HL={M4cI1_WlpwtOM*~e4r#ZOAZo)NfORt5p6JNy1wA=idAt2CA!i!1L?S5cz& zd%r$9!85;Gu3TH+Zs~g8m)&CevaeCPIHU)CWv{PTpJs=*4nKdS{M0pUsdr9Q&*0Ch z>QNQ-l#6%NZdu<6ly(|d#(el89ftijKX(e4@N*q$`XnfgGG63bW*gLB`}^fjfk~<& z@s$q8xMIya)Zr7+sYBGGVYf}H3UX~uBK&jI{$C5cSZD!D-s%TZD^|8c`GFLK(&`VS zRt%2@!?mFIUP>-FH%VJh-NqAZs>CJiYzeVG{+og*atqS(R+QyMtcaDtq-Y!~94Prs J#IKQm`Cs1<6N3N% diff --git a/doc/sgml/user-guide/pix/config-f1.gif b/doc/sgml/user-guide/pix/config-f1.gif new file mode 100644 index 0000000000000000000000000000000000000000..6add8790123d7cd4716460ec8f794ecf50b48bf1 GIT binary patch literal 42236 zc$_SD19V-@`*o5Vr!gC&v2ELF(Ac)k#&(-DHX9o^ws~XQc5?Ie{r$f^d!GHwKC_-# zXPr5-Mp{;ihu3%%3JvNB;{U*kN5)D^#*0VGOGe8}OZzVoBcm1LWhG-}W#wgMrDf&i zV&~%J<%I}^AYhVarIo{DRfT{ErRPme2#hWFSeR)lDS#_Y&CQxeCW@^(>R@G)+ z%XSrTvkG`rHFT9V_4x?_F;q-8R9rk&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>uSo2=VXs49@^1&jaCa1J!Q{JMiO}uLRAH z2V5e_9W5-IT# z3vm)N(GoYY5q=eF%?;{6ep1&%IOp9Fc4pH5Dn25`4AUr z@eXP65@B(QUXd5;unpM|hAI&fEio7WP!fa25dY8=wePC_4)h$bd$h>6NUw5e5F4kF z$S9{8!LN35hj+wrcgFD?%`qKWha7ch9nsMp)v+AmaULV*w7QWSg{YoTZW>F^8b4?B z{L#y{@f!KDcrdJR0>>Kjks$YxA>+n-5^x0+U>?3g0W9(&F)|}Haw9piBR%pXK{6yo zawJKzBu(-pQ8Fb}awS=^C0+6*{$VmEWpXBIvLj8D1)*dg0d*-As_C6DT|UQk#iSjAOGAWS~E0+>1xpFDtQY+)KE9E+f+~Co?TO(=7=zEZZ_K6O%M8 z^D_%GGevVVS<^F5^D$F%H2JbMYcn)elQVS_GjCHibCWiK^Du>TF@F;@VY4?$vnY!a zFA>u!jgl&(^D_~%FQt}G z_Y_a#)KB&FPy2&(PzAM61NBh()KC)@Q2}*P9ko#bl_w=KCn>d3E%j0{HB&WpQ#rL$ zJ@r#THB>>hCrPy@W#Uv(HC0u0Rav!FUG-IAHCAPHR%x|XZS_`hHCJ_YS9!Hpef3mJ rHCTmpSc$b*jrCZOHCdH)S(&w2o%LCvHCm;0TB)^Kt+iMK0ssIzJ*}&@ diff --git a/doc/sgml/user-guide/pix/configitemlabels.gif b/doc/sgml/user-guide/pix/configitemlabels.gif new file mode 100644 index 0000000000000000000000000000000000000000..b89a43d655dfa1a5114dfe2a58c3204d5ca3ebbc GIT binary patch literal 29909 zc%0pRT})h8mhP^qQ*bDLa=-<~1SbV1?n)pDHYV*!qE>;8hslj2(&;JTYHVSfE-_&; zBEE?)Qujj@*!W)}QalQtJQO4oSvP=<8@FtShw`sbL?oh_Ohvx)fZg)Qie$-t8Rc!? zwbtI}oPDZJ;W(Y1q?-qObIv~dXYIAu`qt0h{O#Xu+x+w0zwv0^|HD`lgC8s(!UAhy zEY8?CV~dP&{H>*hwZvJ=I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S*El6GOzSJUti8sroFB zQUOa_)1aulPfQilIZDO-45spX!n_G9Fehw7Tcq#W`}d*{(7Mby<7uH`|B9iTP09^y zASNxl)VIUBGKA)=Nc2p%U=x~i*I86vh4TKReAkM?~2Hk}Zdv;Lj1d2}sgsYxTT&jh%9aCPwmpr_cFM z{erR|C@nHyq9Dhs+~N)Lu%6|)RiZ z=Rb6V{NXJgbvu{kBv3nhSW^CbbOWz_fXC!IEW$ zmw_@z-kZyh@rAM7z;CQ!{>D*y_uQPfSFl-j z20@|sf~>P1WMSkAeZMevtNmepJZcwLhf%(gpSxsDh1u77(s`pLesAv(z*Dh(vJ)a| z0WUO;mK5Oy+o<8HH)1YI;y|W*!&dZ#kCuQkmsvz;a9!rZd9T0QI?85dPkkU#mH+{~ zjgf&0Kt>yk#F1jptL7~1n|b@7_fL-$QO*%d9KmZz#_;4L7(vc60>W?JJ6Xv{KD=dJ z>|4KuWxBV&Dlg)CwNDOydx;joi20-Lw8RlP(*z!4qFy!#Ds%pN|yT zbTOQNE$3kqJ1uZH9-pq4EcNDOL?kK+L{wr&ssRV(YX=D}KId=35X+`nH%;EW2>QsX zHNc7Z%34FZKe|`Fm@LaDD3xyaIy!2`m_G~9u57+1{ygSKY z7$%{AhWFH`Ni+P5brJLeV0?#5rOA>iSx$grvy1Ai#2`NE^LUj%N7q~@rIJG#o7o`w z?}`Mvx=Be*`SWeN+m$m4E5rph#Q*(&PDNb$F_aE9Sh?a|o;5`d+U1<>de9qTFa3Y8 C8*`EX diff --git a/doc/sgml/user-guide/pix/configwin.gif b/doc/sgml/user-guide/pix/configwin.gif new file mode 100644 index 0000000000000000000000000000000000000000..2e3e0ae1feb4e76acfdb90782a3d434c155de04a GIT binary patch literal 12260 zc$@*`FB{NDNk%w1VUYo<0rvm^0s;aWEIyg0>;K-o|>Ni0s;a8{_gTJTv1wjhCFUq_V)IcqMqjBrk<_VnU$ulu9nWmf@gA@p3eRyDLpVzc)rTMjBaMW zy1mB2u4;BN&eG8;K2l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g~1k=IbvB#=j{vTk#7R|azD&2!BJlz#?E5A3rHP}CFP zT!}f=8bSR}oTUWMGer>%;F*8V5ifA4ef&HlCRIT|wnyaMg6DW>khc`_t^vu9n52iY zxj*c4o+9%6HAtR7ioGBYH=DN?o-G+Uo^zjo3lq@vpo$%Qs>&RN>q)7rqRYzCr|bzK z3<@kh#}AM%_M~Mq>9cse&LG1Z&h+Kv+X0!NK}sPLs|_fq$76-&jQ0SB#DEyV$-#mP z$_d2jNouq#u{J(C1BgGs$pi@SRbZwwoN*qStHoiQ1>k9(S-q&D%Yxhz1*-ZW(*#Z! z7|cO{X&eD9d5(S%l}$#_q2hvK1W8}E2#6p=6O3Yjh2{e0I5TgaL5&x)zG=KCp_nKD zy<3)5gJOwLWH>X2EGXI`unr6rwa(?E39M7H)SUs=I)}B)%%1|3z~+jFC#gA{;v#YJ zbB-imYKv(jV8~dMd|?*($d=itm;Dmt94cT9Y?c@s(oBFQPoON7`5aARsn!JapsbMWb%<% z55+Iavb4nvUoV;}IOnIB@L{vU-KzvA{vcmnVQLn@)r8Dac)bVkyg zVul3{_Yt$MfyEjcXA!FgqbkUT9BK%L_=H0@#HkTEg+m{)Un688`X8&Lv{Ig z>LiNw((PQaVZBUf{g_<+ftq@Ghg$wn{hvw=odxyB92!o&sQx3g0Z`LWWYM6s-SD?2 zPC=>hf8IcB5^4JHchEC0f(E63qu4OO(r*+ zKY8K)4Q&Qx*6C$7TMjoDHZ)l&wHORHLL6EizG$||Y`JUM0v&GAkZ*BP;wiPaz#Mpr z^1Nr6yhD~e_%KgCk>{h-D*4Fsb7YYoh7UAAaN47V;Nw3>t~wM~6&MLM)i%C*I0 zw)I)Gp@!SK6WY*9e8I=IGzWg`N4MT|KB0y`kZO$C=8Hb^DK`aF2LUZqK+ja!vqwtG G@c#f3dvMPH diff --git a/doc/sgml/user-guide/pix/connection.gif b/doc/sgml/user-guide/pix/connection.gif new file mode 100644 index 0000000000000000000000000000000000000000..fe824f12ce23f63cdd71239a5955df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*{7Tiy$X06$8|M%?U_c@in@ zAgvKdCo16@mB`@f0e3ht(0h**?J0s-GBAOGilV5V?9zyrAp-}{nb}ZWV=jv62T->9 zH5`l7Mz-b)5!2S(*tqKk+Uu_H?_+jJDu+!t`j*Q{2$)TuKAW8u``MB}<)6z8p@Jm9 z2?unP5WFZFXfqBfAIwYPFc@&~K*rN{$R=LpDi%0*G&jv@PbWwXXJ8JRp{=AT%LxIO zj%rxRKnF2$Ep%s<#fMZ(S{4liZM$GRJMr}2Q9hRpP<}-A3G#z`d4&98w?^wHIYfIN zA(#ywW`pTZ;FCs>Yarw!MwzgY%o(I3j4^Bgbe8<1qzGlP9za2uFb<&`(aHcC(neZe zfehK`APO8{cE+;UL zoZ^o);r~h^)XdneHJ_cgWnK!;Ql2*W?=vssh&SVqAKXc&lPW;+&KDho9t-P#f348r zguo}2D3yTERiZMY0)NPd@Sw8)V&!sIC1s*=Yw0fSrL diff --git a/doc/sgml/user-guide/pix/find-dialog.gif b/doc/sgml/user-guide/pix/find-dialog.gif new file mode 100644 index 0000000000000000000000000000000000000000..b494e30320dba73969e692998d58c8d98de3e558 GIT binary patch literal 4555 zc%1E(_d6Sk_s4@GimFNov0by;+D*_FwM(yR?bT8%irRb6NbT66K~gJRB_dK$dzMyf zRY|G6OV#Y<p(mDm z2B}066;q9)l8Dq^8j*4VC*m&n#TZ;MS{?>J-#cIaLBmz!5T4eiW`=NWcwB;CPuoQr z4p)rB6rkbing@H^+k4~V6Eqy2U~Oe>s%?lcGevl!9L=l^)!}|Ve&fC4L=pj4ha(mf z;2N6pa`1z_b80UY;qGVnA21HCE|1DVQQL+I#W-m>c^Yk*Kq8u&nL1jTVhS)}5n-A} znuq`drT|C4U-XWVmy z<0Iq52CCyTLqj7?KTkwh3<`(G2rEe+o*okFs9_N(O&A=Nih|3^Qz?YFm@v#m0T)9% zIS&g7Gc+>P)X+rdpwXFVgeSt(#PneA!10-*qqC#DGlqc2o&Uf750bsub-;hO005o= z=z#qC_1KO$Ae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4whcC}4rAf{cY&wi992Y3$WdAr8J$5T78Ibtxo;pQo^tUzHy^T`HVX81J4ZVqM0! zUUJv1Ohy$dL@B!&3chhtrXT~BS1nhW1}TS@tIC8|8Dy%Rl;uxSM)HYs`Tr_%8DAb+y0G)#f@-GOi)zon;*NLXAwNGrCwE3DWJsJ#avTVK) z?KWZ^PH`4$B-QFBmj@|sMI^teIP5OzCA8UBt=ZqEIS_T#xP>e9U32)i=E&3LXec>W zjT{dJ7!Qyho}j!+A+NrX(@x15(3UK<7PL)EE-O!(BHcX`mgP7BkOrOGPwgNz3eJY| PCX7;9L}B8*3Q+qWw0V`s diff --git a/doc/sgml/user-guide/pix/html-help.gif b/doc/sgml/user-guide/pix/html-help.gif new file mode 100644 index 0000000000000000000000000000000000000000..53814607817f030738c348c2612a8d78d3172f41 GIT binary patch literal 32002 zc$@$bK<~dtNk%w1VKf5y0p|b!0s;aWEIsigJy!*3x3*y;9r4 zT5_7k0zNu=hC=q*LWriq*3N2OS1+cbLN7{g-o9GS!fO8JO0KR-VuF@BVuE^zp6=R8 z-U0#|Hd5Z+VsLh2f`&@AsxsELN;6h|YHl*-=H{)u-QM1c#=>&eGBUQRI@-*FLP8?e z)}D%tjfs)wuCA^!W}bqc#_sCwN^-7Jb*ARx=JxjP_P)Muf3Ag{(Zb5QdTKHnQc@a9 zN`jTU_V)Isvc}HFg3ba0B2scCEI*#k{=U9?!NU2Ls>Yt0LRM;qR8mmZ($==NwtAYr zmZrusPIpRHQi`I+I%=Ypl9o`0x;kc_f^u@s%8GDudV-q9uEy>%GBQeJie7$}LT;v) zsn=hR%iiAJ#=^$c*Vo?K-fCD>YEEi&c6?ofw2GRdMoKnHQc74_a7{rzwY$GgN=DAk z&U<<@rn1@o{sNw^%l697N={0nq5j6k#x+7(ij<;nd6rUQV$RNDQqInnnu1taNS30S zN-{oyhlDCRLSjxzik_}gezv}TdQwVKDlU4q#^!TsX|AsJT7<+hHZrHCscLR%N^Y)} zmX&gTefIM9_Sz~#S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2#^D_6EBT zG6WDR7ftq%WNEIhYZgY3=RT9Js5tI-F;cZqD z*F{kmsLp;-PBzRU-H-Pd`fi^5QeHcVN|u!j+&z$r3GFj0lu?p*IzZURP3{oL;K&be zf_e{$!+}yYgj^^pGxqQ~`sSYgK?~EBdId)8HY^2I7pHnZ18F}WTAE}a_COHrp>aCe zWh?_B7W$_QX=oH2S7G}?;}6glO9- zy%~l{56FZkAdQ)x0%;_PZ`?lZ!jF~W-4F12zMt{Y>O}T+HXI z`AGrg7kzdQ>So_y85RZC@x+MUQ7(?=v0D^V75x0YoEpaGPp2Wy+yg^_U3;8J(~sH S8!PZ-3w`m|-s%srm;Vou%z&l< diff --git a/doc/sgml/user-guide/pix/memreloc.gif b/doc/sgml/user-guide/pix/memreloc.gif new file mode 100644 index 0000000000000000000000000000000000000000..e75043b8cee5137d04c017a553b1564d0975a9a9 GIT binary patch literal 18903 zc%0>2ZEO?Qnm(S4ow4JD$rlYF^iIOZO)=aJn9zuJuf~C7bGxN7ZLtz>5`~aj-lkM3 zYFSHrf7l6MrHvG%B4M;Y3{+RB%?Am|ijVwoprEL7C8I4$mAyaAy+W#}kWy*2y8q6; z?>RH}jAI8%soL9(PG2~Zpxb(3g-M582{AW@31Cfpg?m)sFpvVPu zMg#6>)E!N@qZFBfv59~?5p^dL?gRxM;Z-*cxM|c)6K+b8Wt0J!1}=duiV`3tm>TAS zmnjN_f5T5S5J&_96y*c5@K-b%h$aG2isAwn(3yw^5{W>9g7m-?j1ACefF=TzqB2lf z@HVIe&E<_(nDn=*@1W;4pHLYdwv(=27Wqf9%L$xoStl*vFDmz42A870c*qHHwf zfB%r5@BZZz_(y~dhG&-VI$!>-^Ri*g7x0f*{%7T>BuXaiHEow;b3;=3=Fa)c=Wm^m z*T3=~p{>aoH6nCa)YEk>rz&b~7urtOdBUS&$%gi1%5&6S`MbVvlJ|F?EZz9pr|ozD z((>_|#&^ZIBh?rwu&>?`k`FW=D_XPj{lCe*dp<0G!8aW$J=i+DW{m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|L!z_KMIU$dd~OZ(pvC-2TtU7_6!bhA{C- zp5$Khd`z*H`7%#dX~F+-Pqb>A_N2ga)s{SEfCg3_N3ePbP2&)4i9SBNS`2qf&a$&f z{(ZY%7P#+W@Gex$3avVzSS4tH#CSC&BpY_ehJtO8AR7MXAqN-)G{MB1N7;7*IWU-F l{QoA&U3G-ay(a`SKlA@58{tu5ldkX*n diff --git a/doc/sgml/user-guide/pix/mlt-region-general.gif b/doc/sgml/user-guide/pix/mlt-region-general.gif new file mode 100644 index 0000000000000000000000000000000000000000..781232dfa117da04b2d802aae6c45fe157fc3688 GIT binary patch literal 4819 zc%1E(_fr$x)`bNGX(|>F5W8Tc`MwHB6H!5WRaz+0A)wN`Lg*x+hCo69kzx{(0Fpo| z2uKfAx}YK=gf2=il27m4f8v|D&&=9u%|3hocFr6;g9}noWE`GpK~zhKl-!qXY_ykkN+oJ+By6m zm;YP-z6ou9&LJLE5qz9kWsN)hi<^@~E*Pfj2b8oz#c%j@cLbESr(e7a6*dSg z>xkjLAa2`9deepc$3@-0G0?L+Uo~Ldfqn~XhP)Fac+Ri}_n}ljTh@^^gpEI9&iNfL z8L|+6h-2-fyHis>ntQKdq3k+^_>t^Ah7 z=M_O5w!9j7XKikf@TBiu{odBsAFLJ4_4;_r|(%0B+JACTvM*5d%Hpap)JLZTOPE_kM}}SY!4}o zcu%LP&f=!iH8myZ2Kx=l6FQF$solXi2C!tjte7szZ!kCvegTgRV0|xYzmp=n zNURw_i`EQqr19^iwWOp zJ3fSy-C|j(;@;fb!DC{J%B`l%#kY^F_kLja4))kBXZ-4beM!5H)_e)k`)mDrH-4`V zO`cYt8N0hQ4|gB^jepj3e#CWC$1et#la6m2+wgHfnjGxSHr%*N)#~%RTd|S+;{qv! zwD9Mn(a9!wyD3F3^ZG9M4m}^Uk>%!HjTK3K9nXg=;9gja7T2^ss0oo3h+K`oNEGHp zUQ^@Q^@uI`cGPco5Y1e^@$!bey~kzUa>bASmQV1PQ1?5U&!fE(GG(WD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={epiP)y zK$z^=%CY(S4vmU;d(=!=EIp2{JT(zonRHt@vP^qD0dimDxUvYZX1z6v8DdmQ=Jiov z)^EbFdwcq)_Rpz)dpB8q`RFiOP%47ozTrNVVPwXM{Zq%96b}CY)ss+uHHO-ozOhn|VdHPiAv()=_%6=2It=rAUpIS`!Tg;^jxVR2! F{2$W`Z*c$s diff --git a/doc/sgml/user-guide/pix/mlt-section-general.gif b/doc/sgml/user-guide/pix/mlt-section-general.gif new file mode 100644 index 0000000000000000000000000000000000000000..806f1f52cc0c45390d3d72df5181425005f854e3 GIT binary patch literal 6660 zc%1E%^;Z)N`^FUmkg#}QG=ijbcXx>(jUe5iAUVoWqhrKig!HJ2L>gE>q7_Eb&je{-lw~Z$cBpLj-W>bH0q6&tKHz&?@Wgq zc}!crVA{X=HSQsiP(H_{;ij6cVPmN%8h@X6mk=!`dU?7% zVZ6mT+jM<#w2sVvpIvd)xWDcz#NOh0hkfvrh0gDShiuyMaK}U6>Fdi2O4nZxg;qjH z^zc?dlUKN;VTK1vpFpHxENkGmdcAMFDK^n>z;RVzvj^NM0|xFt5^UCEgg4>qvEt`5 z>k)C(Gr49@(pjv4fe-ETZJq}~=fCwbqJNl-eYjfqs`rc;5JP->KB{I4!rye2OtIfg zvn%w;OT46x$c}oNiBMR}5{`6UVUs&wEa5Z0O%q=K`%Ti&=S zYGtP2;$2)`waeyYT}HeIO{_XEvCz#Ju`aDrkxZwPan;t<`Z4*mGg)R@w8$CaWiR$3 znj2^CT`l~Lqf4XxYa2Tg@-X{%-`?+zH@jkvUZXfpM?byU<~eJg zFzg?7lduhQ^^oX`=k|0k83A&^{~+m-vcp>8UrAGkDf(((%~poeoK95_a{qQ%ZYM9L zIzVKopHsDC+xP+N|mEE*COl{_O(gy<{25k5$Wz~F&)BMs=g~kP* z`}*wMUDWEBT^tZvj^172mb%dGZ8wZc453@N0?&^|U9oqiuvnu@Mq&zVroy#J&n-hI z{?u=YTVulhe13-atFheRlJR6F;p*cTT7e_o>c=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3on&@C?ZC>wKGZ*sO3BQ(C?^M6r`5Hnv zUaf~TUD3+?*Fq;a?UWFu^a{|yVcp=|#TP2`tw%7w;alIcE*Tf%tF;D~!MAj>--ncI zF80E%E53FmX}ly@AZh(&-6pK_32sx6E?M^(_cen1+z+}p9t)v@jUG!e%5P5Rgw5{K igWmWzQf>_Km;Sd^+V#eJyJoG?d$)RC2hcNyC diff --git a/doc/sgml/user-guide/pix/open-dialog.gif b/doc/sgml/user-guide/pix/open-dialog.gif new file mode 100644 index 0000000000000000000000000000000000000000..0e232dbf1866471d48c9b111a37fadb128f38f3a GIT binary patch literal 6191 zc%0=|_dgVl|34x^Dl6IPT~>oiIV*&8Mu==mWk#X0<<30LKKtym&sk@jbM`#W-s9{o zWSo7zK7Yse`Qz*PdORP`$7}rXeDhXS3ixS(>I2mZ03abQK_+jJCP*kW>f+)8006*a z5deUnAK34byeyC}>GiGUOUy5mNTlI`VPX%lwXLINT(msG(^0%MOuKdfS%y03 zk}4HRl_GZ9AYFZ9T_e!){FWaWfyh7sWr5_at>KcrJ2ydWb^fJ-tH}rGVsR5D6_{sjoYXzIk!!^PvR32IU9#L|pp3 zob$+2#_^-y4t!fzg)<>WWNAE%TJb;UoAboJrRkQ8^5qj zB%-pB7yr-j@bcmT|N8|1Jq18T&!bk7-snfqDr(wMlF=M=^BxGHR+`xw%K6N0s-rZk z9ZIDX!t=Ha*%>4JzQDAzEW0aS{4)XZwmgTJEakF3)mfgaPDOo%o)d)0>(5e)5j7)V z@&|LZvp^}Jih|)n!*aW6LPeoLF(c>mA3F*Fe|nY&+Ib)6sIM|9(lRBeSD~kIZhPy~ zT~)<1^}bga`829a=9+_9#mu{_OBdQcwa3XN|8|(Ha-#E^>c*C@^rpWK<5*r6Ic0nvf5>XM8s7&0P=*2D>tQ|0cJX4#4LJhv3o0B&ul)HG=c%l zyn=2=0Ej~{qo69KA_1b@T@P5 zT?IAcP{nK$qj-zJ6^3Vh+J4tx&PKlev&5b^7s&H_^{xwGwZ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QaJJn3< zPz^3O;uwNBQA?bfB6_NREcd@Rs8Nb9?5u-?JW>_dQz3q1Y=^>nUgg}~(CAsR@4-^{ zBA4#&@szFE_Z~9!1nJ*9)u^K1?9Ha>J2GW=401P<=<||kyc!nw?>To4ojY}9a2>4E zh^OCQy5D@xHQQvKRfTxYx)#r%{JArfhDWK z@Xg=ya(;Or>j!}~GOAkh(6Q|IO zud4?-$ORR|=fyF1@7Ww{%$z_Sn{?eA7imtOdFcK1F9u<${SLDnT5g})e<7^hb?63| zC~iqYo^1|hkpJeMz!wDD=T+Nh9+-P_S`V71IB}xqtE!x?^YwxgIepVg|BrQ}g}%@>Y4kA4N$ zxhj)}?#RunJzmtJ%)~nOKapQx8~x?AHLK73l1&RJ#kXK*y>fSYCDL^zl(Yb&teb)R zvM8&XK5OQ|!%12zG0bb~LhkN->#6Y@^@l5e=VbG>6bc(0}EkI>u9q?vUG|K#xbfYj~w)E$eS>2UKwN9F}vG#`=AvX^<|;PKY5j|=PJ+Pu$} z>dSxk;@r37DI2;y8}O=RtI(90~gmF zZ2LjWRWklAc}$I*W=*aSB-dt;0W^mp%jCM8$CyXHi}EY(GlxDA-9NX#2Bm;O-*+rM zCt=G&_7O+%MMtn#<3;C3bGMJ9XT0GS$K$TY2^QW-^~e3A$Eh=3>HH_1FHevbUO9hG zu<>p={U_*)lM?>ZvR9`Vey)m5*6Os&bah%gb6R(C+Q5I-6v0}7I>C9tod0nW>d(4o z&U!>H&ieSz2VR{IJvoPbrc&BrsNdtg{e#L``*j6BW&Raq(Sox4hmvvYCP3!@03G^R AfB*mh diff --git a/doc/sgml/user-guide/pix/options.gif b/doc/sgml/user-guide/pix/options.gif new file mode 100644 index 0000000000000000000000000000000000000000..a176531f137602355f0eb170d5e83a68d1ee6fa9 GIT binary patch literal 11915 zc%02zT})ipwcc~)%y4Er;KQ%Sgt`ZcDK4=K9^<0cH#+>7OD(&?l{LZ?TNua)1*gJM z?2E4QFasEai6tV%mB-D)nD)U^02?l@NbHBP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ties-dialog.gif b/doc/sgml/user-guide/pix/properties-dialog.gif new file mode 100644 index 0000000000000000000000000000000000000000..9a463b0eaa8d588b753de658367a677d6245db53 GIT binary patch literal 15344 zc%0Q+T}&KTmcCV8T@+0>E^tFIVVuGt9-PKm>^506n~AD1&a#m+!kL*C^kRz;(rPUm zi9{PO(&nMNF^=s_Br+OH>1ZC>Xhs@s_+Pvtu^+&RM=0u*IuBNl{DdtaElyu{)hU#8P4hyUm(rZ0 zG0<4>HJAhD&(StGB^V5p1}!<73I)U1Ff@$C(Q^12e#2j>P~d1tm>-CRU!_u^#KEpG zUC;tv7I>+^Ihq+)C5?U2&>XFfwoBuuXbz5xfHO?vNT@W&H9zI$s0JWH>VZlv}T-Eg_GSmS(cOSI9Z3&{5j2#(;PTy$w?1Rk~odU zsW%tD|3ZHnXF;uPV7a(CtsQ)NWNZ1xr|;-bzWB?5mASk5-2BMxsXsit`|e|Zb>a5Z z%BT^ehIsO{GWF87nGZ^uu5X1*Nv>(^%Ip|-E`=UD`H%m()Bf3&#_zv8|G`eHnS@tu znP8Slxp_@D*mh4YAcgea+0n#w&4CNI)WPgVPN{2s?n?KKJ2TG5 zG5{jv1*RLuY?CA_Be#y4+3ZAx*`EjZ{ajmG2}L!QHFI)MX2zfqV~V}CF|f%lJ`xmpCI^NOO?`ELW1<35FTS*WbE2|X3v({Q zRF&}UqvnPw1%g`C7~Sr{CrYP@=7=2b|6uSz-{r{np1;&`?%|z@d6`CrKWuD;SS~jo zCfmVRA>A0vvYgcrPdZIcBdGa~JO?8)wXsuY*__8fWDZdEHt8%co>Ce1yL#~ZKl)|w8xMMtw(V*1N`5iAuxO6rEjM0(6j&a zwLaE=_29AA+rJHs8t^K#CWB9!N!uqu>42{<^j}k#q_rcHMk3D?O&bsHGjj5*rjtv{ zw5nMd6dNjUCoa`CJv08h@`KY?8lL*muZF%D+ccBUT&PCqP&ahW?bCTK;SSylr!rrP z1{aUi1$U@_QM~@Ht9R?#o6f60JUlb)k(w!ge%IA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ARJ5Yd;GT7E_nX2Ot+GM`1aRMgVcE9`M0ZmcG?rj`IYLT&Kh_&9THEx z^}h*zIExzN=a8%{wb;u)vC@9h6E5&V%d<}U52$M_Z_ z5zgfPUjilmzjwQL#&co!1425Id(Mz^afXVAE?u(9zl3OIFD<~dgMmLG?($kAXDqUI zTlJin;AORHDO20%p)wVB?)3q=5}#T3y6uRo1A4O48lx*y>%esJWMKWb*XR<}QAkqR z&53!s9EP`8!xvt?OZTfDOG(SH@~kpc>%Oh?XEh9%7*m&4#^?%H9Wbe>_nPP~*9hcg zaCvFu)h3P6lP=A`ta?h$vzV}nixw<0G+~A35ND3rqbJMI0HQ_lSU3w7LE{UMx`Ce{uVu{f`nPAtzYY# z-8R8X8WeNTDwqp3l2T-Yf$&18&C>IryrBpbu<`csYyVEAb@B^e8MPK_A7O zrOU?5i*WH(TZRV#9|acl4%n=FlDJ*kdN@0w*uEhLMKwncbPha2)B%gJK+T0$gZ3s1 zQxx~lvU>ZS=_G4`cxvyt6?hAU@*-W_a?zP~} zd^TMfI&>;iCdZ-6cvu^5U6VJqdy>$IY8$Ru}C55iS9{R`2kDQ;2z)ZTnNNnB6>z)+^D?qg&+Rwa zzBZ%EO7#$@lj@{azMFS;A**%>RxtXn&;_uimA)&>RDlXB;wqwQ!wI@k(|!kFqtTWL zK0v?YL0l-Y=i%Ky2yC%pVi(-8N3{Ap2eyar^?I1bJ(GZi8(#J0MGm=lXQuA4XGVsw z&|eukKC(Xf;Lc2NfemF|YbVT~1PaO8;&WD2B6`pd*3@ zz2duo14AI7_V8qPZ{N=Z;`s&>8pVI2I8G*%CbAH_7M+} z$HSJzsVby1( diff --git a/doc/sgml/user-guide/pix/properties-dialog2.gif b/doc/sgml/user-guide/pix/properties-dialog2.gif new file mode 100644 index 0000000000000000000000000000000000000000..9a463b0eaa8d588b753de658367a677d6245db53 GIT binary patch literal 15344 zc%0Q+T}&KTmcCV8T@+0>E^tFIVVuGt9-PKm>^506n~AD1&a#m+!kL*C^kR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($kAXDqUI zTlJin;AORHDO20%p)wVB?)3q=5}#T3y6uRo1A4O48lx*y>%esJWMKWb*XR<}QAkqR z&53!s9EP`8!xvt?OZTfDOG(SH@~kpc>%Oh?XEh9%7*m&4#^?%H9Wbe>_nPP~*9hcg zaCvFu)h3P6lP=A`ta?h$vzV}nixw<0G+~A35ND3rqbJMI0HQ_lSU3w7LE{UMx`Ce{uVu{f`nPAtzYY# z-8R8X8WeNTDwqp3l2T-Yf$&18&C>IryrBpbu<`csYyVEAb@B^e8MPK_A7O zrOU?5i*WH(TZRV#9|acl4%n=FlDJ*kdN@0w*uEhLMKwncbPha2)B%gJK+T0$gZ3s1 zQxx~lvU>ZS=_G4`cxvyt6?hAU@*-W_a?zP~} zd^TMfI&>;iCdZ-6cvu^5U6VJqdy>$IY8$Ru}C55iS9{R`2kDQ;2z)ZTnNNnB6>z)+^D?qg&+Rwa zzBZ%EO7#$@lj@{azMFS;A**%>RxtXn&;_uimA)&>RDlXB;wqwQ!wI@k(|!kFqtTWL zK0v?YL0l-Y=i%Ky2yC%pVi(-8N3{Ap2eyar^?I1bJ(GZi8(#J0MGm=lXQuA4XGVsw z&|eukKC(Xf;Lc2NfemF|YbVT~1PaO8;&WD2B6`pd*3@ zz2duo14AI7_V8qPZ{N=Z;`s&>8pVI2I8G*%CbAH_7M+} z$HSJzsVby1( diff --git a/doc/sgml/user-guide/pix/properties-dialog3.gif b/doc/sgml/user-guide/pix/properties-dialog3.gif new file mode 100644 index 0000000000000000000000000000000000000000..9a463b0eaa8d588b753de658367a677d6245db53 GIT binary patch literal 15344 zc%0Q+T}&KTmcCV8T@+0>E^tFIVVuGt9-PKm>^506n~AD1&a#m+!kL*C^kRz;(rPUm zi9{PO(&nMNF^=s_Br+OH>1ZC>Xhs@s_+Pvtu^+&RM=0u*IuBNl{DdtaElyu{)hU#8P4hyUm(rZ0 zG0<4>HJAhD&(StGB^V5p1}!<73I)U1Ff@$C(Q^12e#2j>P~d1tm>-CRU!_u^#KEpG zU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?h$vzV}nixw<0G+~A35ND3rqbJMI0HQ_lSU3w7LE{UMx`Ce{uVu{f`nPAtzYY# z-8R8X8WeNTDwqp3l2T-Yf$&18&C>IryrBpbu<`csYyVEAb@B^e8MPK_A7O zrOU?5i*WH(TZRV#9|acl4%n=FlDJ*kdN@0w*uEhLMKwncbPha2)B%gJK+T0$gZ3s1 zQxx~lvU>ZS=_G4`cxvyt6?hAU@*-W_a?zP~} zd^TMfI&>;iCdZ-6cvu^5U6VJqdy>$IY8$Ru}C55iS9{R`2kDQ;2z)ZTnNNnB6>z)+^D?qg&+Rwa zzBZ%EO7#$@lj@{azMFS;A**%>RxtXn&;_uimA)&>RDlXB;wqwQ!wI@k(|!kFqtTWL zK0v?YL0l-Y=i%Ky2yC%pVi(-8N3{Ap2eyar^?I1bJ(GZi8(#J0MGm=lXQuA4XGVsw z&|eukKC(Xf;Lc2NfemF|YbVT~1PaO8;&WD2B6`pd*3@ zz2duo14AI7_V8qPZ{N=Z;`s&>8pVI2I8G*%CbAH_7M+} z$HSJzsVby1( diff --git a/doc/sgml/user-guide/pix/propwin.gif b/doc/sgml/user-guide/pix/propwin.gif new file mode 100644 index 0000000000000000000000000000000000000000..ed1fb8ab0211ca8e652b3f73e491a01be2034cf0 GIT binary patch literal 6846 zc%1FivQHm9Yh z!E@n7#YLz}R9#IS90pHIPHS#y9_k+&8XoHE?pl~#fW|{n2oy91+SSpet*ia~<#Rb% zIU_@(h{y=#*UBQ|A^=rDL|BBQgQKUrr>D24@;l|Cf+8bRBS&Y)fS>?5MY#aK0PT<3 zmKK(lHkRk-=L`(bDU|KBbT|V8!+%wC3qwR0!|KZF_U3j`L6@U5YIUV(d(*M2pa|vc z$iNWMT;Dt~xv(&~(ACm4F*!k@P~hqCiQ$R5%DRbP6RQiW|4B=R4)u3Ilm8pFXmw@b zKa_pS`SJPo_V#ldIDGir5;pXIx-l?>|Cd%H{@a7D_QbCtz(>IO|6L6K-~UtM{~P}I z7Z{l73$y4CS6e!g|2pEz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tj;CkXE%jt+A z>zQ~?cA4A(5Z;GLP;e_|(?aLU75vX>;$Jhl=rWm_* za{8Kh3`kK;yvB6(`@)O7sixrH>Aq(ETNtWY;9nap)8G>_)jaglZSa?HR_QF0vWpiP G6#fUx=;6}< diff --git a/doc/sgml/user-guide/pix/regprops.gif b/doc/sgml/user-guide/pix/regprops.gif new file mode 100644 index 0000000000000000000000000000000000000000..fa6e7cd05c4f5222617aa713cee3f9cb6a40fa9b GIT binary patch literal 18574 zc%0o_U2GIrmcCtG-Cb_~P&T$P#$?KbVVxKflg7lGps1R^VWY{algU`dvMpo0t)B6) z+sP*0)@~lUZ9@nI$w?WP}Gr(G)a%VdFZf0iV`82w|TpJ z&bd|Xs&*<9bM86c{V9I+4+mSGJ@Ox}PS?LNww=Kbmfyw#3osUD zEXi1!F^<0l0xS?_fg}s0S%4!k9AM!v3ny7P&B7epCIc)PX2~Q=rdg6>*K~lT!z`U- z=`>4o7>V%!<6*{=jHemrI4}+kV?k$V&5;lOgad(OAdn6OII@M`!r?$T83?BXVUAJ& zF&PddlYwM9kmM*7v`vQt>0}_C4x~BA2wej_9N@_SPX{tgviz!d+CoE2bXVd%Sq#?l=Cb_UwOW{S&RzvGSt_&(w}HRcRVdCFJ7TJtvz+ zuO2Vi^xRv@&hyvascdYYJGt|NgYUMoj@fEugsnDCwfnFudbfS#%%*4m`Ky`N{`UqI zB0GnxSZ2brn5&_J?CM(IGTa?xk}O}A^lmLK$z@yH7P7&iqN=BQ|FZD)zLVv@{KpU5 zZrwic?#AYdIq&c}kkHre(sW&GWD}jmawtwR^F1*YXXx^)IAS6*v2j-<#8Q2dPpZ_S z+Wdfb-D7k8rB2dU#?Dlwbjepy8S%uKD>24q`gf?h3u?AUma_AG8E@C@3AKLjkY}=U zQ|xZ--XW#5Yu0P9U!k(vxf@T0G{z*4zfxgw9R^fuZu;YW8R_sJVs{r)eVOeq%=I73 zUg@hY@0tzYI)C7F^^W%G$gQ4hePhr|X8H(NU-nnt^s|JJX90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b28$efRu;}$=XZGvkO~vaBsPpCyZRaj8YK{3cy8*v6 zA7{0z84pu*W*2uTukEkd+>n^;hk3;j!5AhhO9Kg-c=YSAO&PVy>T$<+FL!WpA~Yt0 zS|;P8*SfLY!7PkPbG0IN%ggtLZ*w5WaY9oos}2dr8xXF5PdByrdH+<#6UCWh_>Twk zrxfy3IzEifanR7pk|f51CnIkM|M{0k^j&uyJF{p7e62#VcalglE4HrTFv}C+?V5x6 zp~v?zKjB{{3AHkoXu0@c1mm8kCjw%|$|m}%_wtbs+ZhB6U7GTZ78yVXb>=8^t0#LT zH+q}ZdWB!pwNd7yHFaU{)v}lStM7X2N_$EH+M(_#Q-2w7we`6Nd@INLjxbC1>h}Y6+ZsrO|?){ONbB#X;XEDZ*pjo1}{p5e}(+|JY zuS4Bw%<@^+Er)uQcRj=A|7hjc{^hTGo(<;x!7P^%%nAJYDXem{gx2cc{`HUWKrzz8 zACUrB5ofoDRU;xnl^9Z%&BuH&z?Si0u3s3C{dRLCQdYn z@PPoNPM6$SNUZu)fkp#@pAL9{6{+8Y4gw!WT2U|M%9bx<&a8Pe=gyu#gAOg)ZG){ZpgRb#ni6{o*u1xH}BrQe*+ILd^qvq#y1|In)}~_0;(H&TmV_{ za)h&SV{E`RasbxHzk?4iemwc|=Fg)~KXk$Nh1LHta87lAcaIMcG<_PtfCG-#A-uPM Yd{hO1fMV()n4p3SGT5MlDg^`pJL=a#ga7~l diff --git a/doc/sgml/user-guide/pix/repo3D1.gif b/doc/sgml/user-guide/pix/repo3D1.gif new file mode 100644 index 0000000000000000000000000000000000000000..f35d37ef4538a051e95e09c0aa5fdf26a4af1210 GIT binary patch literal 120465 zc%1B)Q+FH;xP@nu2`1{qw%ORWZQFL5q_J(=w$Z4u)wr>fh7Fo_&UgOCS?9TXZ}wX6 zTKl=!GIG+qd}dv6)`%}q02B&EL`1~H!y_jrXJcdIm`Jv{csL9ZlfiJZ zxnwj7LMfjw+fw>H4v)irXR@ViB8f~QmPoF(d@7Aj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3C{dRLCQdYn z@PPoNPM6$SNUZu)fkp#@pAL9{6{+8Y4gw!WT2U|M%9bx<&a8Pe=gyu#gAOg)ZG){ZpgRb#ni6{o*u1xH}BrQe*+ILd^qvq#y1|In)}~_0;(H&TmV_{ za)h&SV{E`RasbxHzk?4iemwc|=Fg)~KXk$Nh1LHta87lAcaIMcG<_PtfCG-#A-uPM Yd{hO1fMV()n4p3SGT5MlDg^`pJL=a#ga7~l diff --git a/doc/sgml/user-guide/pix/repos-relocate.gif b/doc/sgml/user-guide/pix/repos-relocate.gif new file mode 100644 index 0000000000000000000000000000000000000000..0f63c052174f946ebb801bb8c9a0895be6745057 GIT binary patch literal 3938 zc%0={`#Td37atNyCASnw7i_3px@@H)(JUG(a;=a{>#JylCU&!pk=w?m4KcYilICub zJ4Ny}x0sT~QgW%e&+Gl+{VU${+vju6=kuKNJm);mxom3#hIoCHN&-v*04ByJV)2Y% zSimXaY@&^g4JwTZ006|B?2j3f6DBh=GbTo$jsHR+$XG`#-q@Jm5RMDP^D{H^d=q1c zcoPaYQzim|(8L%do)_}_dE%KFem7s|1ZZ(}5ws~^*^~&y^J0NO!0+XEb$7M2wzM?1 za4WdnGA^fx!+y?YvY0~Q48Nb>)yr?`Y~eNXxHUX>-X>3lfFWJo{I1R}UJVZdwiIr< z^b1=$dE5#fvxv>B;PP4p+?q`vE_>68#bmRnCSVA=h>Z+%LpZ@8mmv5UR7?G40h`TY zGZ|Efxh20}z|P~ixw;`P!H`Y}WFW=c$qi->K?S4ut$c0;hh4(vvN#Y6OI|Avc^3t{ z1Q7~g{2B;4*t@I7WJZ91n43^&6kdH7hsEYpa1l-jZ&yTDz0St4$;>cfqaVU=G_ka^ zM1~@n3^pfkb4DgA*qaiF5L8$SDnLjF7{bX7;R+Lu&)~64=5r3j9KtQ*d3(WlC6*iG zFn&E`qu-KO0)p9Dq5_dy3VbW-^$ZJod)_aTsmx zI^e&z0Fajeq~x`rrP=TB@+t-%?WNC~NJ@ucOz7*J7K(-$a-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xZZDhN?QKYWsM~1*of5tz4a=h3?oUQI;jkiJ+1)D6PF}`pc4( z5woBj1Az-+sbEIxnd(&Yq15aCDF|$eyCcP7@wN#=^O7rdOF!7^j_O6xL2XeGZ0{}9 zzn3cH-QWy0TL^8%i8ka-gX*V3RB5xVG|$429vaQ%HO+6xCPyai((|+%@6rMbtsl60 zJ-n+H;+ig0r+V*oJJAs+ZcXpgdlbH${z;8~L?1=Cn@)^Sjc`>%57Ebj=}_A=ye;EG z2(`+Dk+C-Nud#@3~eC5n+Ekw36n0Xb<4?_Xn%S^2LKWs-yg d`;YcWN6elXWn?SVWGfD5?_9~=w_6Et_CJ4pWT^lE diff --git a/doc/sgml/user-guide/pix/resolve-conflicts.gif b/doc/sgml/user-guide/pix/resolve-conflicts.gif new file mode 100644 index 0000000000000000000000000000000000000000..00cc551c365a06dace2d24f131d89159cbfb6bcd GIT binary patch literal 28500 zc%0>Ze{dYto#&gLo>6No$t`K@2w9Mptcbxjtc)z9Bvh^?3rC^s?2rYoamhN_hFNbE zvjU8wyGqr~$ifH*Cn7&~EpP62Y_c0-gk&4L&I_u#u`$G9#YH4x#re3av6H(aEZ!1H zcEj#nRp0l=d)+;w(a2(JQ>ns#P*2mZ-}}Dr`~LWRzu)(o&wg%m+a0_9N1!wCWg*rH z_=oK$upwH6NC+_|#Iz6&{?*bVS`wmVOtegk76%_DT0|lt5@RAUEfNm)9cvL|2{AS% z#-_!XgRf4vi0Oow9uw2kV%mX`gwrCNgmA`$Gc6nk2gadcEO;4uJ2(&iOSH6%wX{sP zv^Y2|{FO+wB*t12(=7=Hsep%LiI%akma*xUF$al)zSD`8>9LmS>6U2+XoOc=oJ5N= z*5XXJI1ZAGYXG8wN+8R@72r%TG>io=JGdbH8~%+Y64Qxdk4-zkS6D7k0T0KV=`qJaHsh`&urD&&L9Qe368I{z z!@*6!6((>bB-+6}K{^sRFb?hD7GduM&V&CP*fC%vtPiGzzos3>A!%@Eza839hxW{& zU2%x-4sq5Y-Z{h_ht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ZUmf^W3gThMqu{#}ZE>BSRg;7~nx^TdiF> z?%a>65YVXUwM^ojO(LkVdDP~5JV%ybLy-1<(7vzEk2cA)ED9A#zUB|yj z2BT;0vkW-_34WD?ax)5o$rd`TRS(TzhcSYnyD2Ye;GA+>lh* zc;a)UQLL^-4iQP82<_oGzvX4;J4lW6^Wktpo6B#xkOQSg=u~fusgn4^Iz@dAll;<_ zh`hiLo$BpbZr`hzz^6o$Mz1+}i|dw_@!6zeyJb&o?Z(z*X7_&Y)vGr5wwskRe{7$1 z%@q^sxQ(mtCc?H+vstAFCdeYTF;8UX667wP>zyZr5*WA3Y$dDy=Dl3%?h(@j_Z zmP-2`YP5UJHm+V(|9aYv57SZ}G8FtuE_&+P?!9`mdee^WcOLrHXOnd8wqM%sBDLLT zS77aKJlyYZ@z$31EP`x$>!001ELf0_64 A>Hq)$ diff --git a/doc/sgml/user-guide/pix/settings-runtests.gif b/doc/sgml/user-guide/pix/settings-runtests.gif new file mode 100644 index 0000000000000000000000000000000000000000..ede5b80fe61492ea8fd0778e3c55b3ed7b01a75b GIT binary patch literal 8140 zc%1Ea=n_w|BwsdR^QNeI&2-N@3?E&|dm-6fq%E+O5$G%Ve@q;v>K_wxIE|Ay!7 zbKaeEW6qtqcjhW6$qNd79Y6{~IsgE8xOr}G&o$2xOll0YYl4-VXJcc(vbj-PPul{hos*g4>+dV2 zDg|-}@o=-=UhXd}LWLxyT%9dk-CaY1LJUp*^I)hARNmh{yFEKwm|SSAhgy79R#ugA zbpX-wvEDu1RaQfN{bQsAg<|4jggAJh?Uk(mP5t-^DTerZ`w9sPDXS_=NlK-prlcgM zfE+;Dn%aASWa!C#RrNNL0u-C;WJLV^JwLmdz9?CbOB0HvXO~)htp5D>s!dR2VdX*2{^c zkWsNoG3>UskU}x=nRbun4oU-&e(a2bRa&aoJG`!r*T-6FHoF7gU{kBM*8b^_Bw&~S zOH^r4Z!=SFec}-a8_W1)zcJp{a4?lGL-L){1wO1 z2&&}c#kY}i_BYdNov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LTg_Y3eQL9MOSYnK z%x*$i%2WWFTRy6ooiqu2Izry9kSNYh;ACIOXc0m^`IdA7WhKV&l?mglMv;e-bL>oetNHd8`C@ZQa74M SZJ5}13zF64emo3-$o~P5((P{m diff --git a/doc/sgml/user-guide/pix/settings-viewers.gif b/doc/sgml/user-guide/pix/settings-viewers.gif new file mode 100644 index 0000000000000000000000000000000000000000..58c3cf4799b74356dacb9a063885167bb09a398f GIT binary patch literal 8302 zc%1E4^*astr;sdOpLkHOm}xoPMhwI(`NddKHZ#ixWjO|=d{z^Y&t%B{|(FB0MNASLGXi392{;g?z6K4>@2pTs^b3s{+}Z`1%iWvbN0`> zbFlFbD;roW7Bh|+8XiJ-qtP8`7#s$xgH@DOaPx8>9Q?~Uz)WI>#xdxAG^zsyYesRi zv)=zl-xwOk4D}D8no+D=ug}iz|0^`Pf$m4a;3!BL6a|N&y0Nh4f2CmeC-)mGSZEp4 z)Lt)jGt=#f`;oRKQ{CTIyzc>W~bGufMOjqPVTQ zEjJhI*~tcG5(N|!cXc*%b$1O74%IjMH-o;qp8Uqj!P&t9W*7sjLz$V%%PWezI@rGE zWj((>uc$)#`p1X^fH83~Kz43aa|P?at*`E(g-~B_UmyS|uP84rCZ3#tL&{ zst(Qjx67HCshOFj86*n=$w~$S#Gz#s&@2cvE14Srgl0h@8OcB)acC73mQ_*lp9!rf ztbpc0LW3cYyb7QY&^I^+TKLcOg=9gwEg=E!C5eMu}DWrlrqg#&3^=KT=4 z`l6vsfa}hDpL$R`&chJmSMsouu>#qo4@Uj4(%;3Z1@c+)4P}^e-Fn-FGIH^U_#{+> z)=Ntd!U$h5t!@9_EDn0`eYHPJp|NVA#p`ruVW6>ku`LLfgkBL*v)mc^l1+M#yh69m zYOKt1*CVKBApMgacCe{_b0qf*r9GX8{Y<^h6dWICf@f-~#(W@KsRh12hj10d7rQ#P z=__Ny9aTaij#qn=*h~UaB*O71C#0Yc_*z`;{Y2a=CPb-TdN6l z)8BEQ0Jmyzp9)_b;XV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$!sF4NdVYS>CY3FH~*ehtMrYAz>^f-T61$ofGuZ*Wl`moYBDUEj zS371{9GI*wUuOrE^V^oy*AtD)pC|}0+m@-N(vUsjegDalX@UYQpY~ayu;PzR@z3at zpX0C$S_d1o5x0r?c6=5EOq|vO4b^-PyplifF{(iR^u{I2kNU!L$}Lxkb@>gPj>1^! z5`jeccf2aUi6gFPdct4M>y;)s0Fc!TsrSIvp9nIg;bo)DzQ~?!<8U{<{(NtVL;SR<- z1BtkH?|((R9rAhZu4dC{scBh_BxepLx*hzJb8B_k5%ZQjxUz#g?sbZpG!s4oUX^JU z+={D%R!uZs!(aKF!6`eIkYR+}S2$(unz-K|rC#wJ2(_G{nbpPLzp@PHKxJJ{;X%}#ZDz#C8wj-GRKi;p}T>*uR+lIP|(r9GQ5 zC`XU)jdKf!5uV6(VJDxdIqZ42XX{^-Q^5J$;{Cxnf=$Xk1Xp&cc)K5mto3^Y|NQb( zkXIL@h;y{g{0e1{S2tg)bG+yLDg%Lcuat<(&m_Nx%+=zIOEo7#Fv#-@BF{lf5m)fk S{04uI_pp1bD}(?KNAQ1bI(|q1 diff --git a/doc/sgml/user-guide/pix/targetlist.gif b/doc/sgml/user-guide/pix/targetlist.gif new file mode 100644 index 0000000000000000000000000000000000000000..0b05863dfaf7d7a48550886fe665720e54da8285 GIT binary patch literal 47216 zc$~$34|r7NneUm&naO05jFT|L5QCirLPsDp5Qa^ubti$u2-=NSFik`5fRas2?TsMb zY`432CJBf{+E9fO*LEYs7RCIrh6D_1VJ@@_h zopWaL2Y1`Mm*>&v%bD+-@8A2q@B6*)?|a`HZ>p*IqwR(xN27E~~$~B`|Gx{`RTr&*(Fn$`o1usKw1KYuW&E@5N<>lk$FFkH}{n{kC!(a*bDfvuerRhue@)(ywAW+LEZ7@^6|d%@$vF;1NsQBmK)9GMqjxx zUTzrJWgG)^8hQ!cGH?Xg5_}rI1uq*oAp9Ht^))w-H#ZwNK4=#H>g#Ln8*lD2aJbM5 z_;I|id3?Ni+h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Yf?9|CbCLD_Td4#^j}G&(zz_SAU7paw8K|ZML@x35~|CHbJEhzyxE%?n#q~{x}Up zswzI>^cxB~yenlYvcC0z|%J&kdv8tgg z8$otCo?Cy3{}R83$C_KCz|r$|f`bgD*5CS%%_9X+Yel)m|DQmchN7sPq8CUUuB-YEn%y(no3r=W=X7L0 zs4@kygw9{Y)TfYZ1~J*4fAl_Qjyz|{JZCLGXKOoWA3o=pKj+*%=ejxngnhwHcEQ8! u&RGz|_Z+Nt8YEC2B&hUahx<%8^FpNjLbUBdZ1_Ta{z9VsGzbk%?Ee6CVdgXd diff --git a/doc/sgml/user-guide/pix/toolsplatforms.gif b/doc/sgml/user-guide/pix/toolsplatforms.gif new file mode 100644 index 0000000000000000000000000000000000000000..c53447ebf10c05b4bcd7fc9a78525f34e6913633 GIT binary patch literal 13284 zc%1FJRa6v?6Zefsmx>?_N=m16cPuE~sDugXs0^Rr+sW8KSV-#PsowFbrpw&wpa+!rUCQ`2x5v{p({$>Y1NhnGj#&#(&&W@>n< zwi<3=Y+?IR`=uE7VSgrKD7)!Xi9++iGFZ!a{H%C^JP$R>{dF#@5(ETUN^ByT?@D zRBb)1u%fUQ43m--j!BJyx1nJFBSHRw{z?EPCod;ZW+4m$E6f8~SX&sFYj3V$!hV84 zdH?bM<*el4;^hA`rVs*>;uD59!@_?0gTRGKib@9W3~WEz+B(?UW}<{0K%n6V7^Lvw z|LOlqeE-!t&i{G=hX{-Fh=@_MGPg5~=sAzoKxJO{ucvIw1lWDoB8{pJK8w<<mogzjZAuT?qyGuh2 zf0x@s9+NTy8Y@@3e?RB7K{i&c_b0OHWCMKN=4u>g>H`^mxGp_SJNf`lBVgtbtJ!2=iW#$GI88U zHT#sw@d#iep+v+QtEf!O2|6NR{5~K|$mBIUMnIwE&AkQckkZ;RutL)@k#N7x?IPi; zT?u6ru=-BO>4GQXk_it8g^}{_kKwWeUaj`Bgy4;T z@z1E=buz@JnE36K!N=Z(kxQ&3hEd2^RfWA&AXCj9Zt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+Q`FtjXG1dK75%9t{|?2W_u@y{@TF_> zgJSQ%-RjS^Gt@}`m(^vX$AY+WNzsYF9wU*b ztzk;oS0Te2~MuRmn0F_Y@9b^YOgXMtg*q4oF48t9CQ&Dk@hRp@~~uB?i4 znPkQ7CWLa&E(LKPm1G@wR_c4Qd!|xol+zViITh?zzoJGS{2$eX+O%3PcHNU{j(xt`-Bljn`l;TFbefmHltRTS*aE+1&oGA^@Y}t!e?N+Ys0#EZ z{9RF%rl3N^&dXYsHNj`T?w;NoWl)>{0{&WE6gn2?UR%I?|5{UpXZ%l6Z6T)|w>BNC zu6>Ybe&rA+z)pI|x;h2;OqW~F13CddsV$bj=YAK)W0Vppa-A)~#AA>QorH+gmFfjT z4P)jF7M1FtCU72;8t7E{nh{hS!eiRaGhLNb2m7>9YWj*~x~96W+%=Hbsv9^>8&p`~ z4d=Bvh0efF>i!1Z^L}{DJKITFUl}RKXZyTtwpXOSDn5|Uo-M}IZC(r~4bJyTv}_LL zUSE@a&-X=zcYZ9XzP3n?-^s9SeyX~@t|E}%*^YN%&MB?>X&kSsN7=&CiFa{*V2UQe z%f(g7hQ>ZQ0r%vx#SM{$rr|&V&jQ}19fOAEX}ExQP1(|cdqWHQUckNhCHjpOEAeI= huHWNluLi3d;Fv(cfOX#G>+y!R3%HxzV_Y1W{{v8B!Y=>- diff --git a/doc/sgml/user-guide/pix/user-tools-dialog.gif b/doc/sgml/user-guide/pix/user-tools-dialog.gif new file mode 100644 index 0000000000000000000000000000000000000000..a00e2ab2c7c9017d99ea498f4010f3e063414aad GIT binary patch literal 4596 zc%1E)`8O1d_s7Yu^bli>EG1h)kwLO#FnNlxPm+ejSh7T8kbU0u1KsbsySuunjZ|tKl|rHriV3)Uoa#;0 z&CS!y&GCuxfsyggexoZ*Fdnk54cNr4*<=6mk~~w}!yIl3>N zs3K7FDL_4aRTbdw_DS2jHn_V#_&;D2P)9W>E2*u0fRay;S5aj!mMM)?h&2Re55eW( zf(k*o=z6;fg6h z9pLW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+1D!OSOm=#|Wpy`V8xrg z>~9QX7X8rd_81#LbZ$=4;s9;+ZC(XswgW*{U|hdopcUno2TF zEV{~Wb(+H5)RYzf-QFZgMzX%qoZ~#mJo1{;k8jq*6qhXITJ*peF0BO611SExYbW{7 zXfc%Gu>{M^UiOpmQmid+v6bmO98tvlLD}OE{+rSjGvgIMuH5WZZ)OCy7Fn@}hNNTn zGwv*$%KG^Sdk=zht2v+esW@`q1#%LUvKDy4l!Ln3OItU#Qyv#_s*-P*gd&A2{U;RI zq;Q-7;ybdiy7kW*beoQN>}xZTo2$Eu>FD?P(^jS6IMOxq>+cR zT#D(q5casH{eUma?dAoo4;1m*uMA(99}=4B)T~Mz1+J$>)K$GQe95_j zwQ@y5`hBnxXBo`38*|H9IGArYmQV&4(_%ADr)`*IWFb385gk2Tr^Mh0l-KN;afW@& zqaUP@-AuBDXWYs+*(~CUi;Pt|)^tM`YUw;ns9!~`4PiQbCE|rrF&%-KxO +eCos Programming Concepts and Techniques + +Programming with eCos is somewhat different from programming + in more traditional environments. eCos is a configurable open + source system, and you are able to configure and build a system + specifically to meet the needs of your application. +Various different directory hierarchies are involved in + configuring and building the system: the component + repository, the build tree, + and the install tree. These directories + exist in addition to the ones used to develop + applications. + + +CDL Concepts + +About this chapter +This chapter serves as a brief introduction to the + concepts involved in eCos (Embedded Configurable Operating + System). It describes the configuration architecture and the + underlying technology to a level required for the embedded + systems developer to configure eCos. It does not describe in + detail aspects such as how to write reusable components for + eCos: this information is given in the CDL + Writer’s Guide. + +Background +Software solutions for the embedded space place + particularly stringent demands on the developer, typically + represented as requirements for small memory footprint, high + performance and robustness. These demands are addressed in + eCos by providing the ability to perform compile-time + specialization: the developer can tailor the operating + system to suit the needs of the application. In order to + make this process manageable, eCos is built in the context + of a Configuration Infrastructure: a set of tools including + a Configuration Tool and a formal + description of the process of configuration by means of a + Component Definition Language. + + +Configurations +eCos is tailored at source level (that is, before + compilation or assembly) in order to create an eCos + configuration. In concrete terms, an + eCos configuration takes the form of a configuration save + file (with extension .ecc) and set of files used to build + user applications (including, when built, a library file + against which the application is linked). + + + +Component Repository +eCos is shipped in source in the form of a + component repository - a directory + hierarchy that contains the sources and other files which + are used to build a configuration. The component repository + can be added to by, for example, downloading from the + net. + + +Component Definition Language +Part of the component repository is a set of files + containing a definition of its structure. The form used for + this purpose is the Component Definition + Language (CDL). CDL defines the relationships + between components and other information used by tools such + as the eCosConfiguration Tool. + CDL is generally formulated by the writers of components: it + is not necessary to write or understand CDL in order for the + embedded systems developer to construct an eCos + configuration. + + +Packages +The building blocks of an eCos configuration are called + packages. Packages are the units of + software distribution. A set of core packages (such as + kernel, C library and math library) is provided by Red Hat: + additional third-party packages will be available in + future. +A package may exist in one of a number of versions. + The default version is the current version. + Only one version of a given package may be present in the component +repository at any given time. +Packages are organized in a tree hierarchy. Each package +is either at the top-level or is the child of another package. +The eCos Administration Tool can be used to add or remove +packages from the component repository. The eCos Configuration Tool can be used to include or exclude packages from the configuration +being built. + + +Configuration Items +Configuration items are the + individual entities that form a configuration. Each item + corresponds to the setting of a C pre-processor macro (for + example, + CYGHWR_HAL_ARM_PID_GDB_BAUD). + The code of eCos itself is written to test such preprocessor + macros so as to tailor the code. User code can do + likewise. +Configuration items come in the following flavors: + + +None: such entities serve only as +placeholders in the hierarchy, allowing other entities to be grouped +more easily. + + +Boolean entities are the most common +flavor; they correspond to units of functionality that can be either +enabled or disabled. If the entity is enabled then there will be +a #define; code will check the setting using, for example, #ifdef + + +Data entities encapsulate some arbitrary +data. Other properties such as a set or range of legal values can +be used to constrain the actual values, for example to an integer +or floating point value within a certain range. + + +Booldata entities combine the attributes +of Boolean and Data: they +can be enabled or disabled and, if enabled, will hold a data value. + + +Like packages, configuration items exist in a tree-based hierarchy: +each configuration item has a parent which may be another configuration +item or a package. Under some conditions (such as when packages +are added or removed from a configuration), items may be “re-parented” such +that their position in the tree changes. + +Expressions +Expressions are relationships between CDL items. There are +three types of expression in CDL: + + CDL Expressions + + + + Expression Type + Result + Common Use (see ) + + + + Ordinary + A single value + legal_values property + + + ListA range of + values (for example “1 to 10”) + legal_values property + + GoalTrue or False + requires and active_if properties + + +
+
+ + Properties +Each configuration item has a set of properties. The following +table describes the most commonly used: + + Configuration properties + + + Property +Use + + + + Flavor + The “type” of the item, as + described above + + EnabledWhether + the item is enabled + + Current_value +The current value of the item + + Default_value +An ordinary expression defining the default value of the + item + + Legal_valuesA + list expression defining the values the item may hold (for example, + 1 to10) + + Active_ifA + goal expression denoting the requirement for this item to be active +(see below: Inactive Items) + +RequiresA goal +expression denoting requirements this item places on others (see +below: Conflicts) + +CalculatedWhether +the item as non-modifiable + +MacroThe corresponding +C pre-processor macro + +FileThe C header +file in which the macro is defined + +URLThe URL of +a documentation page describing the item + +HardwareIndicates +that a particular package is related to specific hardware + + +
+ +A complete description of properties is contained in the CDL +Writer’s Guide. +
+ +Inactive Items +Descendants of an item that is disabled are inactive: their +values may not be changed. Items may also become inactive if +an active_if expression is used to make the item dependent +on an expression involving other items. + +
+ +Conflicts +Not all settings of configuration items will lead to a + coherent configuration; for example, the use of a timeout + facility might require the existence of timer support, so if + the one is required the other cannot be removed. Coherence + is policed by means of consistency rules (in particular, the + goal expressions that appear as CDL items + requires and + active_if attributes [see + above]). A violation of consistency rules creates a + conflict, which must be resolved in + order to ensure a consistent configuration. Conflict + resolution can be performed manually or with the assistance + of the eCos tools. Conflicts come in the following + flavors: + + +An unresolved conflict means that +there is a reference to an entity that is not yet in the current +configuration + + +An illegal value conflict is caused +when a configuration item is set to a value that is not permitted +(that is, a legal_values goal expression +is failing) + + +An evaluation exception conflict +is caused when the evaluation of an expression would fail (for example, +because of a division by zero) + + +An unsatisfied goal conflict is caused +by a failing requires goal expression + + +A bad data conflict arises only rarely, +and corresponds to badly constructed CDL. Such a conflict can only +be resolved by reference to the CDL writer. + + + + +Templates +A template is a saved configuration + - that is, a set of packages and configuration item + settings. Templates are provided with eCos to allow you to + get started quickly by instantiating (copying) a saved + configuration corresponding to one of a number of common + scenarios; for example, a basic eCos configuration template + is supplied that contains the infrastructure, kernel, C and + math libraries, plus their support packages. + +
+ +The Component Repository and Working Directories +Each of the file trees involved in eCos development has a + different role. + +Component Repository +The eCos component repository + contains directories for all the packages that are shipped + with eCos or provided by third parties. +The component repository should not be modified as part of +application development. +

+Component repository + +
+ +Purpose +The component respository is the master copy of source code +for all system and third party components. It also contains some +files needed to administer and build the system, such as ecosadmin.tcl. + + +How is it modified? +You modify it by importing new versions of packages from a +distribution or removing existing packages. These activities are +undertaken using the eCos Package Administration Tool. + + +When is it edited manually? +Files in the component repository should only be edited manually +as determined by the component maintainer. + + +User applications +User application source code should not go +into the component repository. + + +Examples of files in this hierarchy: + + +BASE_DIR/doc/ref/ecos-ref.html + +The top level HTML file for the + eCosReference + Manual. + + + +BASE_DIR/prebuilt/pid/tests/kernel/v1_3_x/tests/thread_gdb.exe + + + + + +BASE_DIR/prebuilt/linux/tests/kernel/v1_3_x/tests/thread_gdb.exe + +Prebuilt tests for the supported platforms, and + the synthetic Linux target. + + + +BASE_DIR/examples/twothreads.c + +One of the example programs. + + + +BASE_DIR/ecosadmin.tcl + +The Tcl program which is used to import new versions of packages +from a distribution or remove existing packages. + + + +BASE_DIR/packages/language/c/libm/&Version;/src/double/portable-api/s_tanh.c + +Implementation of the hyperbolic tangent function in the standard +math library. + + + +BASE_DIR/pkgconf/rules.mak + +A file with make rules, used +by the makefile. + + + + + + +Build Tree +The build tree is the directory + hierarchy in which all generated files + are placed. Generated files consist of the + makefile, the compiled object files, + and a dependency file (with a .d + extension) for each source file. + +Purpose +The build tree is where all intermediate object files are + placed. + + +How is it modified? +Recompiling can modify the object files. + + +User applications +User application source or binary code should + not go in the build tree. + + +Examples of files in this hierarchy + + +ecos-work/language/c/libc/v1_3_x/src + +The directory in which object files for + the C library are built. + + + + + + +Install Tree +The install tree is the location + for all files needed for application development. The + libtarget.a library, which contains the + custom-built eCos kernel and other components, is placed + in the install tree, along with all packages’ public + header files. If you build the tests, the test executable + programs will also be placed in the install + tree. +By default, the install tree is created by + ecosconfig in a subdirectory of the build + tree called install. This can be + modified with the option (see + ). + + +Purpose +The install tree is where the custom-built + libtarget.a library, which contains + the eCos kernel and other components, is located. The + install tree is also the location for all the header files + that are part of a published interface for their + component. + + +How is it modified? +Recompiling can replace + libtarget.a and the test + executables. + + +When is it edited manually? +Where a memory layout requires modification without + use of the eCos Configuration Tool, the memory layout + files must be edited directly in the install tree. These + files are located at + install/include/pkgconf/mlt_*.*. + Note that subsequent modification of the install tree + using the Configuration Tool will result in such manual + edits being lost. + + +User applications +User application source or binary code should + not go in the install tree. + + +Examples of files in this hierarchy + + +install/lib/libtarget.a + +The library containing the kernel and other components. + + + +install/include/cyg/kernel/kapi.h + +The header file for the kernel C language API. + + + +install/include/pkgconf/mlt_arm_pid_ram.ldi + +The linker script fragment describing the memory + layout for linking applications intended for + execution on an ARM PID development board using RAM + startup. + + + +install/include/stdio.h + +The C library header file for standard I/O. + + + + + + +Application Build Tree +This tree is not part of eCos itself: it is the + directory in which eCos end users write their own + applications. +Example applications and their + Makefile are located in the component + repository, in the directory + BASE_DIR/examples. + + +There is no imposed format on this directory, but there + are certain compiler and linker flags that must be used to + compile an eCos application. The basic set of flags is shown + in the example Makefile, and additional + details can be found in . + + + +Compiler and Linker Options +eCos is built using the GNU C and C++ compilers. + The versions of the tools Red Hat has + prepared for this release have some enhancements, such as + constructor priority ordering and selective linking, which + will eventually become part of the standard distribution. + +Some GCC options are required for eCos, +and others can be useful. This chapter gives a brief description +of the required options as well as some recommended eCos-specific options. +All other GCC options (described in the GNUPro manuals) +are available. + +Compiling a C Application +The following command lines demonstrate the + minimum set of options required to + compile and link an eCos program written in C. + +Remember that when this manual shows + gcc you should type the full name of + the cross compile,e.g. mn10300-elf-gcc, + mips-tx39-elf-gcc, + powerpc-eabi-gcc, + sparclite-elf-gcc, + arm-elf-gcc, + mips64vr4300-elf-gcc, + sh-elf-gcc. When compiling for the + synthetic Linux target, use the native gcc which must have + the features required by eCos. + +$ gcc -c -IINSTALL_DIR/include file.c +$ gcc -o program file.o -LINSTALL_DIR/lib -Ttarget.ld -nostdlib + +Certain targets may require extra options, for example + the SPARClite architectures require the option + . Examine the + BASE_DIR/packages/targets + file or + BASE_DIR/examples/Makefile + or the “Global compiler flags” option + (CYGBLD_GLOBAL_CFLAGS) in your generated + eCos configuration) to see if any extra options are + required, and if so, what they are. +The following command lines use some other options + which are recommended because they use the + selective linking feature: +$ gcc -c -IINSTALL_DIR/include -I. -ffunction-sections -fdata-sections -g -O2 file.c +$ gcc -o program file.o -ffunction-sections -fdata-sections -Wl,--gc-sections -g -O2 -LINSTALL_DIR/lib -Ttarget.ld -nostdlib + + + +Compiling a C++ Application +The following command lines demonstrate the + minimum set of options required to + compile and link an eCos program written in C++. + + +Remember that when this manual shows + g++ you should type the full + name of the cross compiler: + mn10300-elf-g++, + mips-tx39-elf-g++, + powerpc-eabi-g++, + sparclite-elf-g++, + arm-elf-g++, + mips64vr4300-elf-g++, or + sh-elf-g++. When compiling + for the synthetic Linux target, use the native + g++ which must + have the features required by eCos. +$ g++ -c -IINSTALL_DIR/include -fno-rtti -fno-exceptions file.cxx +$ g++ -o program file.o -LINSTALL_DIR/lib -Ttarget.ld -nostdlib + + + +Certain targets may require extra options, + for example the SPARClite architectures require the option + . Examine the + BASE_DIR/packages/targets + file or BASE_DIR/examples/Makefile + or the “Global compiler flags” option + (CYGBLD_GLOBAL_CFLAGS) in your generated + eCos configuration) to see if any extra options are + required, and if so, what they are. +The following command lines use some other options + which are recommended because they use the + selective linking feature: +$ g++ -c -IINSTALL_DIR/include -I. -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -g -O2 file.cxx +$ g++ -o program file.o -W1,--gc-sections -g -O2 -LINSTALL_DIR/lib -Ttarget.ld -nostdlib + + + + +Debugging Techniques +eCos applications and components can be debugged in + traditional ways, with printing statements and debugger + single-stepping, but there are situations in which these + techniques cannot be used. One example of this is when a + program is getting data at a high rate from a real-time + source, and cannot be slowed down or interrupted. +eCos’s infrastructure module provides a + tracing formalism, allowing the + kernel’s tracing macros to be configured in many useful + ways. eCos’s kernel provides instrumentation + buffers which also collect specific + (configurable) data about the system’s history and + performance. + +Tracing +To use eCos’s tracing facilities you must first + configure your system to use tracing. + You should enable the Asserts and Tracing component + () and the + component within it + (). These + options can be enabled with the Configuration + Tool or by editing the file + BUILD_DIR/pkgconf/infra.h + manually. +You should then examine all the tracing-related options in +the Package: Infrastructure chapter of the eCos Reference +Manual. One useful set of configuration options are: CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS and CYGDBG_INFRA_DEBUG_TRACE_MESSAGE, +which are both enabled by default when tracing is enabled. +The following “Hello world with tracing” shows +the output from running the hello world program (from the programming +tutorial in Getting Started with eCos) that was +built with tracing enabled: + +Hello world with tracing +$ mips-tx39-elf-run --board=jmr3904 hello +Hello, eCos world! +ASSERT FAIL: <2>cyg_trac.h [ 623] Cyg_TraceFunction_Report_::set_exitvoid() exitvoid used in typed function +TRACE: <1>mlqueue.cxx [ 395] Cyg_ThreadQueue_Implementation::enqueue() {{enter +TRACE: <1>mlqueue.cxx [ 395] Cyg_ThreadQueue_Implementation::enqueue() }}RETURNING UNSET! +TRACE: <1>mlqueue.cxx [ 126] Cyg_Scheduler_Implementation::add_thread() }}RETURNING UNSET! +TRACE: <1>thread.cxx [ 654] Cyg_Thread::resume() }}return void +TRACE: <1>cstartup.cxx [ 160] cyg_iso_c_start() }}return void +TRACE: <1>startup.cxx [ 142] cyg_package_start() }}return void +TRACE: <1>startup.cxx [ 150] cyg_user_start() {{enter +TRACE: <1>startup.cxx [ 150] cyg_user_start() (((void))) +TRACE: <1>startup.cxx [ 153] cyg_user_start() 'This is the system default cyg_user_start()' +TRACE: <1>startup.cxx [ 157] cyg_user_start() }}return void +TRACE: <1>sched.cxx [ 212] Cyg_Scheduler::start() {{enter +TRACE: <1>mlqueue.cxx [ 102] Cyg_Scheduler_Implementation::schedule() {{enter +TRACE: <1>mlqueue.cxx [ 437] Cyg_ThreadQueue_Implementation::highpri() {{enter +TRACE: <1>mlqueue.cxx [ 437] Cyg_ThreadQueue_Implementation::highpri() }}RETURNING UNSET! +TRACE: <1>mlqueue.cxx [ 102] Cyg_Scheduler_Implementation::schedule() }}RETURNING UNSET! +TRACE: <2>intr.cxx [ 450] Cyg_Interrupt::enable_interrupts() {{enter +TRACE: <2>intr.cxx [ 450] Cyg_Interrupt::enable_interrupts() }}RETURNING UNSET! +TRACE: <2>thread.cxx [ 69] Cyg_HardwareThread::thread_entry() {{enter +TRACE: <2>cstartup.cxx [ 127] invoke_main() {{enter +TRACE: <2>cstartup.cxx [ 127] invoke_main() ((argument is ignored)) +TRACE: <2>dummyxxmain.cxx [ 60] __main() {{enter +TRACE: <2>dummyxxmain.cxx [ 60] __main() (((void))) +TRACE: <2>dummyxxmain.cxx [ 63] __main() 'This is the system default __main()' +TRACE: <2>dummyxxmain.cxx [ 67] __main() }}return void +TRACE: <2>memcpy.c [ 112] _memcpy() {{enter +TRACE: <2>memcpy.c [ 112] _memcpy() ((dst=80002804, src=BFC14E58, n=19)) +TRACE: <2>memcpy.c [ 164] _memcpy() }}returning 80002804 +TRACE: <2>cstartup.cxx [ 137] invoke_main() 'main() has returned with code 0. Calling exit()' +TRACE: <2>exit.cxx [ 71] __libc_exit() {{enter +TRACE: <2>exit.cxx [ 71] __libc_exit() ((status=0 )) +TRACE: <2>atexit.cxx [ 84] cyg_libc_invoke_atexit_handlers() {{enter +TRACE: <2>atexit.cxx [ 84] cyg_libc_invoke_atexit_handlers() (((void))) + +Scheduler: + +Lock: 0 +Current Thread: <null> + +Threads: + +Idle Thread pri = 31 state = R id = 1 + stack base = 800021F0 ptr = 80002510 size = 00000400 + sleep reason NONE wake reason NONE + queue = 80000C54 wait info = 00000000 + +<null> pri = 0 state = R id = 2 + stack base = 80002A48 ptr = 8000A968 size = 00008000 + sleep reason NONE wake reason NONE + queue = 80000BD8 wait info = 00000000 + + + + +Kernel Instrumentation +Instrument buffers can be used to + find out how many events of a given type happened in the + kernel during execution of a program. +You can monitor a class of several types of events, or + you can just look at individual events. +Examples of events that can be + monitored are: + + + +scheduler events + + +thread operations + + +interrupts + + +mutex operations + + +binary semaphore operations + + +counting semaphore operations + + +clock ticks and interrupts + + +Examples of fine-grained scheduler event types are: + + +scheduler lock + + +scheduler unlock + + +rescheduling + + +time slicing + + +Information about the events is stored in an + event record. The structure that + defines this record has type struct + Instrument_Record: +The list of records is stored in an array called instrument_buffer +which you can let the kernel provide or you can provide yourself +by setting the configuration option CYGVAR_KERNEL_INSTRUMENT_EXTERNAL_BUFFER. +To write a program that examines the instrumentation + buffers: + + +Enable instrumentation buffers in the eCos kernel configuration. +The component macro is CYGPKG_KERNEL_INSTRUMENT. + + +To allocate the buffers yourself, enable the configuration +option CYGVAR_KERNEL_INSTRUMENT_EXTERNAL_BUFFER. + + +Include the header file +cyg/kernel/instrmnt.h +. +#include <cyg/kernel/instrmnt.h> + + +The Instrumentation_Record structure +is not published in the kernel header file. In the future there +will be a cleaner mechanism to access it, but for now you should +paste into your code in the following lines: + +struct Instrument_Record +{ + CYG_WORD16 type; // record type + CYG_WORD16 thread; // current thread id + CYG_WORD timestamp; // 32 bit timestamp + CYG_WORD arg1; // first arg + CYG_WORD arg2; // second arg +}; + + +Enable the events you want to record using +cyg_instrument_enable() +, and disable them later. Look at +cyg/kernel/instrmnt.h + and the examples below to see what events can be enabled. + + +Place the code you want to debug between the matching +functions +cyg_instrument_enable() + and +cyg_instrument_disable() +. + + +Examine the buffer. For now you need to look at the data +in there (the example program below shows how to do that), and future +versions of eCos will include a host-side tool to help you understand +the data. + + + +Using instrument buffers +This program is also provided in the + examples directory. + + +/* this is a program which uses eCos instrumentation buffers; it needs + to be linked with a kernel which was compiled with support for + instrumentation */ + +#include <stdio.h> +#include <pkgconf/kernel.h> +#include <cyg/kernel/instrmnt.h> +#include <cyg/kernel/kapi.h> + +#ifndef CYGVAR_KERNEL_INSTRUMENT_EXTERNAL_BUFFER +# error You must configure eCos with CYGVAR_KERNEL_INSTRUMENT_EXTERNAL_BUFFER +#endif + +struct Instrument_Record +{ + CYG_WORD16 type; // record type + CYG_WORD16 thread; // current thread id + CYG_WORD timestamp; // 32 bit timestamp + CYG_WORD arg1; // first arg + CYG_WORD arg2; // second arg +}; + +struct Instrument_Record instrument_buffer[20]; +cyg_uint32 instrument_buffer_size = 20; + +int main(void) +{ + int i; + + cyg_instrument_enable(CYG_INSTRUMENT_CLASS_CLOCK, 0); + cyg_instrument_enable(CYG_INSTRUMENT_CLASS_THREAD, 0); + cyg_instrument_enable(CYG_INSTRUMENT_CLASS_ALARM, 0); + + printf("Program to play with instrumentation buffer\n"); + + cyg_thread_delay(2); + + cyg_instrument_disable(CYG_INSTRUMENT_CLASS_CLOCK, 0); + cyg_instrument_disable(CYG_INSTRUMENT_CLASS_THREAD, 0); + cyg_instrument_disable(CYG_INSTRUMENT_CLASS_ALARM, 0); + + for (i = 0; i < instrument_buffer_size; ++i) { + printf("Record %02d: type 0x%04x, thread %d, ", + i, instrument_buffer[i].type, instrument_buffer[i].thread); + printf("time %5d, arg1 0x%08x, arg2 0x%08x\n", + instrument_buffer[i].timestamp, instrument_buffer[i].arg1, + instrument_buffer[i].arg2); + } + return 0; +} + +Here is how you could compile and run this program in the examples directory, +using (for example) the MN10300 compiler: +$ make XCC=mn10300-elf-gcc PKG_INSTALL_DIR=/tmp/ecos-work-mn10300/install instrument-test +mn10300-elf-gcc -c -o instrument-test.o -g -Wall -I/tmp/ecos-work-mn10300/install/include -ffunction-sections -fdata-sections instrument-test.c +mn10300-elf-gcc -nostartfiles -L/tmp/ecos-work-mn10300/install/lib -W1,--gc-sections -o instrument-test instrument-test.o -Ttarget.ld -nostdlib +$ mn10300-elf-run --board=stdeval1 instrument-test + +Instrument buffer output +Here is the output of the + instrument-test program. Notice that in + little over 2 seconds, and with very little activity, and + with few event types enabled, it gathered 17 records. In + larger programs it will be necessary to select very few + event types for debugging. +Program to play with instrumentation buffer +Record 00: type 0x0207, thread 2, time 6057, arg1 0x48001cd8, arg2 0x00000002 +Record 01: type 0x0202, thread 2, time 6153, arg1 0x48001cd8, arg2 0x00000000 +Record 02: type 0x0904, thread 2, time 6358, arg1 0x48001d24, arg2 0x00000000 +Record 03: type 0x0905, thread 2, time 6424, arg1 0x00000002, arg2 0x00000000 +Record 04: type 0x0906, thread 2, time 6490, arg1 0x00000000, arg2 0x00000000 +Record 05: type 0x0901, thread 2, time 6608, arg1 0x48009d74, arg2 0x48001d24 +Record 06: type 0x0201, thread 2, time 6804, arg1 0x48001cd8, arg2 0x480013e0 +Record 07: type 0x0803, thread 1, time 94, arg1 0x00000000, arg2 0x00000000 +Record 08: type 0x0801, thread 1, time 361, arg1 0x00000000, arg2 0x00000000 +Record 09: type 0x0802, thread 1, time 548, arg1 0x00000001, arg2 0x00000000 +Record 10: type 0x0803, thread 1, time 94, arg1 0x00000000, arg2 0x00000000 +Record 11: type 0x0801, thread 1, time 361, arg1 0x00000001, arg2 0x00000000 +Record 12: type 0x0903, thread 1, time 513, arg1 0x48009d74, arg2 0x48001d24 +Record 13: type 0x0208, thread 1, time 588, arg1 0x00000000, arg2 0x00000000 +Record 14: type 0x0203, thread 1, time 697, arg1 0x48001cd8, arg2 0x480013e0 +Record 15: type 0x0802, thread 1, time 946, arg1 0x00000002, arg2 0x00000000 +Record 16: type 0x0201, thread 1, time 1083, arg1 0x480013e0, arg2 0x48001cd8 +Record 17: type 0x0000, thread 0, time 0, arg1 0x00000000, arg2 0x00000000 +Record 18: type 0x0000, thread 0, time 0, arg1 0x00000000, arg2 0x00000000 +Record 19: type 0x0000, thread 0, time 0, arg1 0x00000000, arg2 0x00000000 + + + + + diff --git a/doc/sgml/user-guide/user-guide.sgml b/doc/sgml/user-guide/user-guide.sgml new file mode 100644 --- /dev/null +++ b/doc/sgml/user-guide/user-guide.sgml @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + + eCos User Guide + 2001, 2002Red Hat, Inc. + + + Documentation licensing terms +This material may be distributed only subject to the terms +and conditions set forth in the Open Publication License, v1.0 +or later (the latest version is presently available at +http://www.opencontent.org/openpub/). + + +Distribution of substantively modified versions of this +document is prohibited without the explicit permission of the +copyright holder. + +Distribution of the work or derivative of the work in any +standard (paper) book form is prohibited unless prior +permission is obtained from the copyright holder. + + + + Trademarks + Red Hat, the Red Hat Shadow Man logo®, eCos™, RedBoot™, +GNUPro®, and Insight™ are trademarks of Red Hat, Inc. +Sun Microsystems® and Solaris® are registered trademarks of +Sun Microsystems, Inc. +SPARC® is a registered trademark of SPARC International, Inc., and +is used under license by Sun Microsystems, Inc. +Intel® is a registered trademark of Intel Corporation. +Motorola™ is a trademark of Motorola, Inc. +ARM® is a registered trademark of Advanced RISC Machines, Ltd. +MIPS™ is a trademark of MIPS Technologies, Inc. +Toshiba® is a registered trademark of the Toshiba Corporation. +NEC® is a registered trademark if the NEC Corporation. +Cirrus Logic® is a registered trademark of Cirrus Logic, Inc. +Compaq® is a registered trademark of the Compaq Computer Corporation. + +Matsushita™ is a trademark of the Matsushita Electric Corporation. + +Samsung® and CalmRISC™ are trademarks or registered trademarks +of Samsung, Inc. +Linux® is a registered trademark of Linus Torvalds. +UNIX® is a registered trademark of The Open Group. +Microsoft®, Windows®, and Windows NT® are registered trademarks +of Microsoft Corporation, Inc. +All other brand and product names, trademarks, and copyrights are the +property of their respective owners. + + +Warranty +eCos and RedBoot are open source software, covered by the Red Hat eCos Public License, +and you are welcome to change it and/or distribute copies of it under certain +conditions. The supplied version of eCos and/or RedBoot is supported for customers of Red Hat. See http://sources.redhat.com/ecos/license-overview.html + +For non-customers, eCos and RedBoot software has NO WARRANTY. +Because this software is licensed free of charge, there are no warranties +for it, to the extent permitted by applicable law. Except when otherwise stated +in writing, the copyright holders and/or other parties provide the software +“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 software is with you. Should the software prove defective, you assume +the cost of all necessary servicing, repair or correction. + 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. + + + + + + + Preliminaries + + How to Contact Red Hat +
Red Hat Corporate Headquarters + 2600 Meridian Parkway + DurhamNC 27713 + USA + Telephone (toll free): +1 888 REDHAT 1 (+1 888 733 4281) + Telephone (main line): +1 919 547 0012 + Telephone (FAX line): +1 919 547 0024 +
+ Website: http://www.redhat.com/ + +
+
+
+ + &config-tool; + &programming-concepts-and-techniques; + &configuration; + +
diff --git a/examples/Makefile b/examples/Makefile deleted file mode 100644 --- a/examples/Makefile +++ /dev/null @@ -1,116 +0,0 @@ -# Mostly written by Jonathan Larmour, Red Hat, Inc. -# This file is in the public domain and may be used for any purpose - -# PKG_INSTALL_DIR might need to be edited. Right now it is set -# assuming that a user ran pkgconf.tcl in /cygdrive/c/ecos-work on Windows NT, -# or used the Configuration Tool with C:\ecos-work as a build-tree. -# -# You can also override it on the make command-line, e.g.: -# make PKG_INSTALL_DIR=/myecc/install -# or you can set it in your environment - -PKG_INSTALL_DIR = /cygdrive/c/ecos-work/install - -# You must also set XCC to the name of your cross-compiler, including any -# options it needs. - -# Uncomment one of the below, or invoke make with the name of the compiler -# you want, e.g.: -# make XCC="sparclite-elf-gcc -mcpu=sparclite -msoft-float" -# You can also set XCC in your environment - -#XCC = mn10300-elf-gcc # MN10300/AM31 -#XCC = mn10300-elf-gcc -mam33 # AM33 -#XCC = mips-tx39-elf-gcc # MIPS TX39 -#XCC = mips-tx49-elf-gcc -mips2 -EL # MIPS TX49 LITTLE-ENDIAN -#XCC = mips-tx49-elf-gcc -mips2 -EB # MIPS TX49 BIG-ENDIAN -#XCC = mips64vr4300-elf-gcc -mgp32 -EB # MIPS VR4300 -#XCC = sh-elf-gcc -m3 -mb # SH3 BIG-ENDIAN -#XCC = sh-elf-gcc -m3 -ml # SH3 LITTLE-ENDIAN -#XCC = powerpc-eabi-gcc -msoft-float -mcpu=860 # POWERPC -#XCC = arm-elf-gcc -mcpu=arm7di # AEB -#XCC = arm-elf-gcc -mcpu=arm7tdmi # PID7 -#XCC = arm-elf-gcc -mcpu=arm7tdmi -mbig-endian # PID7 BIG-ENDIAN -#XCC = arm-elf-gcc -mcpu=arm9 # PID9 -#XCC = thumb-elf-gcc -mthumb-interwork # PID7 THUMB -#XCC = thumb-elf-gcc -mthumb-interwork -mbig-endian # PID7 THUMB BIG-ENDIAN -#XCC = arm-elf-gcc -mcpu=arm710c -D__CL7111 # CIRRUS LOGIC CL7111 -#XCC = arm-elf-gcc -mcpu=arm7tdmi -D__EDB7211 # CIRRUS LOGIC EDB7211 -#XCC = arm-elf-gcc -mcpu=arm7tdmi -D__EDB7209 # CIRRUS LOGIC EDB7209 -#XCC = arm-elf-gcc -mcpu=arm7tdmi -D__EDB7209 -D__EDB7212 # CIRRUS LOGIC EDB7212 -#XCC = arm-elf-gcc -mcpu=arm7tdmi # ARM COGENT CMA230 -#XCC = arm-elf-gcc -mcpu=arm7tdmi -D__CMA222 # ARM COGENT CMA222 -#XCC = thumb-elf-gcc # ARM COGENT CMA230 THUMB -#XCC = arm-elf-gcc -mcpu=strongarm # EBSA285 -#XCC = arm-elf-gcc -mcpu=strongarm1100 # ASSABET/BRUTUS -#XCC = sparclite-elf-gcc -msoft-float -mcpu=sparclite # SPARCLITE -#XCC = i686-pc-linux-gnu-gcc # SYNTHETIC LINUX -#XCC = i386-elf-gcc # i386 PC -#XCC = v850-elf-gcc # NEC v850 - -###### VARIABLES -# Any of these can be overriden on the command-line or in your environment - -ifeq ($(findstring sh-elf-gcc,$(XCC)),sh-elf-gcc) -CFLAGS = -ggdb -else -CFLAGS = -g -endif - -CXXFLAGS = $(CFLAGS) - -EXTRACFLAGS = -Wall -I$(PKG_INSTALL_DIR)/include -ffunction-sections -fdata-sections - -EXTRACXXFLAGS = $(EXTRACFLAGS) -fno-exceptions -fno-rtti -fvtable-gc -finit-priority - -LDFLAGS = -nostartfiles -L$(PKG_INSTALL_DIR)/lib -Wl,--gc-sections -LIBS = -Ttarget.ld -nostdlib - -LD = $(XCC) -XCXX = $(XCC) - -###### RULES - -.PHONY: all clean CCCHECK - -all: hello twothreads simple-alarm serial - -clean: - -rm -f hello hello.o twothreads twothreads.o - -rm -f simple-alarm simple-alarm.o serial serial.o - -rm -f instrument-test instrument-test.o - -CCCHECK: -ifeq ($(XCC),) - @echo You must set XCC to the name of your cross-compiler - @false -endif - - -%.o: %.c - $(XCC) -c -o $*.o $(CFLAGS) $(EXTRACFLAGS) $< - -%.o: %.cxx - $(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $< - -%.o: %.C - $(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $< - -%.o: %.cc - $(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $< - -hello: CCCHECK hello.o - $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS) - -twothreads: CCCHECK twothreads.o - $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS) - -simple-alarm: CCCHECK simple-alarm.o - $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS) - -serial: CCCHECK serial.o - $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS) - -instrument-test: CCCHECK instrument-test.o - $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS) - diff --git a/examples/build_Makefile b/examples/build_Makefile deleted file mode 100644 --- a/examples/build_Makefile +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/sh - -# This script will create a generic Makefile template -# suitable for use with an installed eCos configuration. - -# usage: /build_Makefile [] -# env: ${SRCS} - the default list of source files -# ${DST} - the default target - -HOME=${1-`pwd`} -if [ ! -d ${HOME}/install ]; then - echo "Not an eCos install tree" - echo "usage: /build_Makefile []" - echo "env: \${SRCS} - the default list of source files" - echo " \${DST} - the default target" - exit -fi - -cat <Makefile -# -# Makefile for eCos tests -# - -# Copied from 'makefile' the "install" tree - -EOF - -grep export ${HOME}/makefile >>Makefile - -cat <>Makefile - -# -# Target specific flags, etc. -# - -EOF - -cat ${HOME}/install/include/pkgconf/ecos.mak >>Makefile - -cat <>Makefile - -# Simple build rules - -.c.o: - \$(CC) -c \$(ECOS_GLOBAL_CFLAGS) -I\$(PREFIX)/include \$*.c - -.o: - \$(CC) \$(ECOS_GLOBAL_LDFLAGS) -L\$(PREFIX)/lib -Ttarget.ld \$*.o -o \$@ - -SRCS=${SRCS-source_file.c} -OBJS=\${SRCS:%.c=%.o} -DST=${DST-result_prog} - -\${DST}: \${OBJS} - -EOF diff --git a/examples/hello.c b/examples/hello.c deleted file mode 100644 --- a/examples/hello.c +++ /dev/null @@ -1,8 +0,0 @@ -/* this is a simple hello world program */ -#include - -int main(void) -{ - printf("Hello, eCos world!\n"); - return 0; -} diff --git a/examples/instrument-test.c b/examples/instrument-test.c deleted file mode 100644 --- a/examples/instrument-test.c +++ /dev/null @@ -1,50 +0,0 @@ -/* this is a program which uses eCos instrumentation buffers; it needs - to be linked with a kernel which was compiled with support for - instrumentation */ - -#include -#include -#include -#include - -#ifndef CYGVAR_KERNEL_INSTRUMENT_EXTERNAL_BUFFER -# error You must configure eCos with CYGVAR_KERNEL_INSTRUMENT_EXTERNAL_BUFFER -#endif - -struct Instrument_Record -{ - CYG_WORD16 type; // record type - CYG_WORD16 thread; // current thread id - CYG_WORD timestamp; // 32 bit timestamp - CYG_WORD arg1; // first arg - CYG_WORD arg2; // second arg -}; - -struct Instrument_Record instrument_buffer[20]; -cyg_uint32 instrument_buffer_size = 20; - -int main(void) -{ - int i; - - cyg_instrument_enable(CYG_INSTRUMENT_CLASS_CLOCK, 0); - cyg_instrument_enable(CYG_INSTRUMENT_CLASS_THREAD, 0); - cyg_instrument_enable(CYG_INSTRUMENT_CLASS_ALARM, 0); - - printf("Program to play with instrumentation buffer\n"); - - cyg_thread_delay(2); - - cyg_instrument_disable(CYG_INSTRUMENT_CLASS_CLOCK, 0); - cyg_instrument_disable(CYG_INSTRUMENT_CLASS_THREAD, 0); - cyg_instrument_disable(CYG_INSTRUMENT_CLASS_ALARM, 0); - - for (i = 0; i < instrument_buffer_size; ++i) { - printf("Record %02d: type 0x%04x, thread %d, ", - i, instrument_buffer[i].type, instrument_buffer[i].thread); - printf("time %5d, arg1 0x%08x, arg2 0x%08x\n", - instrument_buffer[i].timestamp, instrument_buffer[i].arg1, - instrument_buffer[i].arg2); - } - return 0; -} diff --git a/examples/serial.c b/examples/serial.c deleted file mode 100644 --- a/examples/serial.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Written 1999-03-19 by Jonathan Larmour, Cygnus Solutions - * This file is in the public domain and may be used for any purpose - */ - -/* CONFIGURATION CHECKS */ - -#include /* which packages are enabled/disabled */ -#ifdef CYGPKG_KERNEL -# include -#endif -#ifdef CYGPKG_LIBC -# include -#endif -#ifdef CYGPKG_IO_SERIAL -# include -#endif - -#ifndef CYGFUN_KERNEL_API_C -# error Kernel API must be enabled to build this example -#endif - -#ifndef CYGPKG_LIBC_STDIO -# error C library standard I/O must be enabled to build this example -#endif - -#ifndef CYGPKG_IO_SERIAL_HALDIAG -# error I/O HALDIAG pseudo-device driver must be enabled to build this example -#endif - -/* INCLUDES */ - -#include /* printf */ -#include /* strlen */ -#include /* All the kernel specific stuff */ -#include /* I/O functions */ -#include /* CYGNUM_HAL_STACK_SIZE_TYPICAL */ - - - -/* DEFINES */ - -#define NTHREADS 1 -#define STACKSIZE ( CYGNUM_HAL_STACK_SIZE_TYPICAL + 4096 ) - -/* STATICS */ - -static cyg_handle_t thread[NTHREADS]; -static cyg_thread thread_obj[NTHREADS]; -static char stack[NTHREADS][STACKSIZE]; - -/* FUNCTIONS */ - -static void simple_prog(CYG_ADDRESS data) -{ - cyg_io_handle_t handle; - Cyg_ErrNo err; - const char test_string[] = "serial example is working correctly!\n"; - cyg_uint32 len = strlen(test_string); - - printf("Starting serial example\n"); - - err = cyg_io_lookup( "/dev/haldiag", &handle ); - - if (ENOERR == err) { - printf("Found /dev/haldiag. Writing string....\n"); - err = cyg_io_write( handle, test_string, &len ); - } - - if (ENOERR == err) { - printf("I think I wrote the string. Did you see it?\n"); - } - - printf("Serial example finished\n"); - -} - -void cyg_user_start(void) -{ - cyg_thread_create(4, simple_prog, (cyg_addrword_t) 0, "serial", - (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]); - cyg_thread_resume(thread[0]); -} diff --git a/examples/simple-alarm.c b/examples/simple-alarm.c deleted file mode 100644 --- a/examples/simple-alarm.c +++ /dev/null @@ -1,76 +0,0 @@ -/* this is a very simple program meant to demonstrate - a basic use of time, alarms and alarm-handling functions - in eCos */ - -#include - -#include - -#define NTHREADS 1 -#define STACKSIZE 4096 - -static cyg_handle_t thread[NTHREADS]; - -static cyg_thread thread_obj[NTHREADS]; -static char stack[NTHREADS][STACKSIZE]; - -static void alarm_prog( cyg_addrword_t data ); - -/* we install our own startup routine which sets up - threads and starts the scheduler */ -void cyg_user_start(void) -{ - cyg_thread_create(4, alarm_prog, (cyg_addrword_t) 0, - "alarm_thread", (void *) stack[0], - STACKSIZE, &thread[0], &thread_obj[0]); - cyg_thread_resume(thread[0]); -} - -/* we need to declare the alarm handling function (which is - defined below), so that we can pass it to - cyg_alarm_initialize() */ -cyg_alarm_t test_alarm_func; - -/* alarm_prog() is a thread which sets up an alarm which is then - handled by test_alarm_func() */ -static void alarm_prog(cyg_addrword_t data) -{ - cyg_handle_t test_counterH, system_clockH, test_alarmH; - cyg_tick_count_t ticks; - cyg_alarm test_alarm; - unsigned how_many_alarms = 0, prev_alarms = 0, tmp_how_many; - - system_clockH = cyg_real_time_clock(); - cyg_clock_to_counter(system_clockH, &test_counterH); - cyg_alarm_create(test_counterH, test_alarm_func, - (cyg_addrword_t) &how_many_alarms, - &test_alarmH, &test_alarm); - cyg_alarm_initialize(test_alarmH, cyg_current_time()+200, 200); - - /* get in a loop in which we read the current time and - print it out, just to have something scrolling by */ - for (;;) { - ticks = cyg_current_time(); - printf("Time is %llu\n", ticks); - /* note that we must lock access to how_many_alarms, since the - alarm handler might change it. this involves using the - annoying temporary variable tmp_how_many so that I can keep the - critical region short */ - cyg_scheduler_lock(); - tmp_how_many = how_many_alarms; - cyg_scheduler_unlock(); - if (prev_alarms != tmp_how_many) { - printf(" ---> alarm calls so far: %u\n", tmp_how_many); - prev_alarms = tmp_how_many; - } - cyg_thread_delay(30); - } -} - -/* test_alarm_func() is invoked as an alarm handler, so - it should be quick and simple. in this case it increments - the data that is passed to it. */ -void test_alarm_func(cyg_handle_t alarmH, cyg_addrword_t data) -{ - ++*((unsigned *) data); -} diff --git a/examples/twothreads.c b/examples/twothreads.c deleted file mode 100644 --- a/examples/twothreads.c +++ /dev/null @@ -1,62 +0,0 @@ -#include - -#include -#include -#include - -/* now declare (and allocate space for) some kernel objects, - like the two threads we will use */ -cyg_thread thread_s[2]; /* space for two thread objects */ - -char stack[2][4096]; /* space for two 4K stacks */ - -/* now the handles for the threads */ -cyg_handle_t simple_threadA, simple_threadB; - -/* and now variables for the procedure which is the thread */ -cyg_thread_entry_t simple_program; - -/* and now a mutex to protect calls to the C library */ -cyg_mutex_t cliblock; - -/* we install our own startup routine which sets up threads */ -void cyg_user_start(void) -{ - printf("Entering twothreads' cyg_user_start() function\n"); - - cyg_mutex_init(&cliblock); - - cyg_thread_create(4, simple_program, (cyg_addrword_t) 0, - "Thread A", (void *) stack[0], 4096, - &simple_threadA, &thread_s[0]); - cyg_thread_create(4, simple_program, (cyg_addrword_t) 1, - "Thread B", (void *) stack[1], 4096, - &simple_threadB, &thread_s[1]); - - cyg_thread_resume(simple_threadA); - cyg_thread_resume(simple_threadB); -} - -/* this is a simple program which runs in a thread */ -void simple_program(cyg_addrword_t data) -{ - int message = (int) data; - int delay; - - printf("Beginning execution; thread data is %d\n", message); - - cyg_thread_delay(200); - - for (;;) { - delay = 200 + (rand() % 50); - - /* note: printf() must be protected by a - call to cyg_mutex_lock() */ - cyg_mutex_lock(&cliblock); { - printf("Thread %d: and now a delay of %d clock ticks\n", - message, delay); - } - cyg_mutex_unlock(&cliblock); - cyg_thread_delay(delay); - } -} diff --git a/host/COPYING b/host/COPYING deleted file mode 100644 --- a/host/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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. - - - Copyright (C) 19yy - - 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) 19yy 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. - - , 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 Library General -Public License instead of this License. diff --git a/host/libcdl/ChangeLog b/host/libcdl/ChangeLog --- a/host/libcdl/ChangeLog +++ b/host/libcdl/ChangeLog @@ -1,3 +1,17 @@ +2002-03-04 Gary Thomas + + * build.cxx (update_header_file_info): + Suppress include files which and in "~" - these are backup + files and are transient. Keeping them can break a build + tree if the backup files are removed. + +2002-02-18 Bart Veer + + * transact.cxx (user_confirmation_required): + Making a valuable with a user_value inactive requires + user confirmation, it should not be done automatically + by the inference engine. + 2001-12-07 Bart Veer * doc/language.sgml, doc/*.html: diff --git a/host/libcdl/build.cxx b/host/libcdl/build.cxx --- a/host/libcdl/build.cxx +++ b/host/libcdl/build.cxx @@ -973,6 +973,9 @@ update_header_file_info(CdlConstBuildLoa if (0 == strncmp("pkgconf/", file_i->c_str(), 8)) { continue; } + if ('~' == *(file_i->rbegin())) { + continue; + } CdlBuildInfo_Header local_copy; local_copy.source = "include/" + *file_i; local_copy.destination = ""; diff --git a/host/libcdl/transact.cxx b/host/libcdl/transact.cxx --- a/host/libcdl/transact.cxx +++ b/host/libcdl/transact.cxx @@ -10,7 +10,7 @@ //####COPYRIGHTBEGIN#### // // ---------------------------------------------------------------------------- -// Copyright (C) 1999, 2000, 2001 Red Hat, Inc. +// Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. // // This file is part of the eCos host tools. // @@ -2267,7 +2267,9 @@ CdlTransactionBody::save_solution() // ---------------------------------------------------------------------------- // Can a solution be applied without e.g. overwriting a user value with // an inferred value. There is a setting inference_override which controls -// this. +// this. Making a previously enabled option inactive also requires +// user confirmation, thus preventing the inference engine from disabling +// entire components. bool CdlTransactionBody::user_confirmation_required() const { @@ -2286,6 +2288,17 @@ CdlTransactionBody::user_confirmation_re break; } } + std::set::const_iterator val_j; + for (val_j = deactivated.begin(); val_j != deactivated.end(); val_j++) { + CdlValuable valuable = dynamic_cast(*val_j); + if (0 != valuable) { + const CdlValue& old_value = parent->get_whole_value(valuable); + if ((old_value.get_source() > CdlTransactionBody::inference_override) && old_value.is_enabled()) { + result = true; + break; + } + } + } CYG_REPORT_RETVAL(result); return result; diff --git a/host/tools/Utils/common/Makefile.am b/host/tools/Utils/common/Makefile.am --- a/host/tools/Utils/common/Makefile.am +++ b/host/tools/Utils/common/Makefile.am @@ -6,29 +6,28 @@ ## utils ## ## ===================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -######COPYRIGHTEND#### +#####ECOSHOSTGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# This file is part of the eCos host tools. +# +# 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., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ------------------------------------------- +#####ECOSHOSTGPLCOPYRIGHTEND#### ## ===================================================================== #######DESCRIPTIONBEGIN#### ## diff --git a/host/tools/Utils/common/Makefile.in b/host/tools/Utils/common/Makefile.in --- a/host/tools/Utils/common/Makefile.in +++ b/host/tools/Utils/common/Makefile.in @@ -10,29 +10,28 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -######COPYRIGHTEND#### +#####ECOSHOSTGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# This file is part of the eCos host tools. +# +# 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., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ------------------------------------------- +#####ECOSHOSTGPLCOPYRIGHTEND#### #######DESCRIPTIONBEGIN#### ######DESCRIPTIONEND#### diff --git a/host/tools/Utils/common/Properties.cpp b/host/tools/Utils/common/Properties.cpp --- a/host/tools/Utils/common/Properties.cpp +++ b/host/tools/Utils/common/Properties.cpp @@ -382,6 +382,10 @@ bool CProperties::LoadFromFile(LPCTSTR p if(_TCHAR('\n')==buf[nLen-1]){ buf[--nLen]=_TCHAR('\0'); } + // Remove trailing '\r' + if(_TCHAR('\r')==buf[nLen-1]){ + buf[--nLen]=_TCHAR('\0'); + } // Check for continuation lines if(_TCHAR('\\')==buf[nLen-1]){ diff --git a/host/tools/Utils/common/acinclude.m4 b/host/tools/Utils/common/acinclude.m4 --- a/host/tools/Utils/common/acinclude.m4 +++ b/host/tools/Utils/common/acinclude.m4 @@ -5,29 +5,28 @@ dnl dnl acinclude.m4 dnl dnl ==================================================================== -dnl###COPYRIGHTBEGIN#### -dnl -dnl ------------------------------------------- -dnl The contents of this file are subject to the Red Hat eCos Public License -dnl Version 1.1 (the "License"); you may not use this file except in -dnl compliance with the License. You may obtain a copy of the License at -dnl http://www.redhat.com/ -dnl -dnl Software distributed under the License is distributed on an "AS IS" -dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -dnl License for the specific language governing rights and limitations under -dnl the License. -dnl -dnl The Original Code is eCos - Embedded Configurable Operating System, -dnl released September 30, 1998. -dnl -dnl The Initial Developer of the Original Code is Red Hat. -dnl Portions created by Red Hat are -dnl Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -dnl All Rights Reserved. -dnl ------------------------------------------- -dnl -dnl####COPYRIGHTEND#### +dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN#### +dnl ------------------------------------------- +dnl Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +dnl +dnl This file is part of the eCos host tools. +dnl +dnl This program is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by the Free +dnl Software Foundation; either version 2 of the License, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but WITHOUT +dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +dnl more details. +dnl +dnl You should have received a copy of the GNU General Public License along with +dnl this program; if not, write to the Free Software Foundation, Inc., +dnl 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl ------------------------------------------- +dnl ####ECOSHOSTGPLCOPYRIGHTEND#### dnl ==================================================================== dnl#####DESCRIPTIONBEGIN#### dnl diff --git a/host/tools/Utils/common/aclocal.m4 b/host/tools/Utils/common/aclocal.m4 --- a/host/tools/Utils/common/aclocal.m4 +++ b/host/tools/Utils/common/aclocal.m4 @@ -17,29 +17,28 @@ dnl dnl acinclude.m4 dnl dnl ==================================================================== -dnl###COPYRIGHTBEGIN#### -dnl -dnl ------------------------------------------- -dnl The contents of this file are subject to the Red Hat eCos Public License -dnl Version 1.1 (the "License"); you may not use this file except in -dnl compliance with the License. You may obtain a copy of the License at -dnl http://www.redhat.com/ -dnl -dnl Software distributed under the License is distributed on an "AS IS" -dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -dnl License for the specific language governing rights and limitations under -dnl the License. -dnl -dnl The Original Code is eCos - Embedded Configurable Operating System, -dnl released September 30, 1998. -dnl -dnl The Initial Developer of the Original Code is Red Hat. -dnl Portions created by Red Hat are -dnl Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -dnl All Rights Reserved. -dnl ------------------------------------------- -dnl -dnl####COPYRIGHTEND#### +dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN#### +dnl ------------------------------------------- +dnl Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +dnl +dnl This file is part of the eCos host tools. +dnl +dnl This program is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by the Free +dnl Software Foundation; either version 2 of the License, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but WITHOUT +dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +dnl more details. +dnl +dnl You should have received a copy of the GNU General Public License along with +dnl this program; if not, write to the Free Software Foundation, Inc., +dnl 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl ------------------------------------------- +dnl ####ECOSHOSTGPLCOPYRIGHTEND#### dnl ==================================================================== dnl#####DESCRIPTIONBEGIN#### dnl diff --git a/host/tools/Utils/common/configure.in b/host/tools/Utils/common/configure.in --- a/host/tools/Utils/common/configure.in +++ b/host/tools/Utils/common/configure.in @@ -6,29 +6,28 @@ dnl dnl Utils dnl dnl ==================================================================== -dnl###COPYRIGHTBEGIN#### -dnl -dnl ------------------------------------------- -dnl The contents of this file are subject to the Red Hat eCos Public License -dnl Version 1.1 (the "License"); you may not use this file except in -dnl compliance with the License. You may obtain a copy of the License at -dnl http://www.redhat.com/ -dnl -dnl Software distributed under the License is distributed on an "AS IS" -dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -dnl License for the specific language governing rights and limitations under -dnl the License. -dnl -dnl The Original Code is eCos - Embedded Configurable Operating System, -dnl released September 30, 1998. -dnl -dnl The Initial Developer of the Original Code is Red Hat. -dnl Portions created by Red Hat are -dnl Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -dnl All Rights Reserved. -dnl ------------------------------------------- -dnl -dnl####COPYRIGHTEND#### +dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN#### +dnl ------------------------------------------- +dnl Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +dnl +dnl This file is part of the eCos host tools. +dnl +dnl This program is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by the Free +dnl Software Foundation; either version 2 of the License, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but WITHOUT +dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +dnl more details. +dnl +dnl You should have received a copy of the GNU General Public License along with +dnl this program; if not, write to the Free Software Foundation, Inc., +dnl 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl ------------------------------------------- +dnl ####ECOSHOSTGPLCOPYRIGHTEND#### dnl ==================================================================== dnl#####DESCRIPTIONBEGIN#### dnl diff --git a/host/tools/configtool/ChangeLog b/host/tools/configtool/ChangeLog --- a/host/tools/configtool/ChangeLog +++ b/host/tools/configtool/ChangeLog @@ -1,3 +1,12 @@ +2002-02-08 Julian Smart + + * common/common/build.cxx: Added two missing backslashes + +2002-02-07 Jonathan Larmour + + * common/common/build.cxx: correctly substitute forward slashes + for backslashes. + 2002-01-02 Julian Smart * Modified these files: @@ -2801,6 +2810,7 @@ 1999-11-01 Simon FitzMaurice 0) fprintf (stream, "ifeq ($(HOST),CYGWIN)\n"); - fprintf (stream, "\t@mkdir -p `cygpath -w \"$(dir $@)\" | sed \"s/\\\\\\\\\\/\\\\//g\"`\n"); + fprintf (stream, "\t@mkdir -p `cygpath -w \"$(dir $@)\" | sed \"s@\\\\\\\\\\\\\\\\@/@g\"`\n"); fprintf (stream, "else\n"); fprintf (stream, "\t@mkdir -p $(dir $@)\n"); fprintf (stream, "endif\n"); diff --git a/host/tools/configtool/common/win32/listctrltoview.inl b/host/tools/configtool/common/win32/listctrltoview.inl --- a/host/tools/configtool/common/win32/listctrltoview.inl +++ b/host/tools/configtool/common/win32/listctrltoview.inl @@ -1,26 +1,25 @@ -//###COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSHOSTGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// This file is part of the eCos host tools. +// +// 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., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// ------------------------------------------- +//####ECOSHOSTGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/host/tools/configtool/common/win32/resource.h b/host/tools/configtool/common/win32/resource.h --- a/host/tools/configtool/common/win32/resource.h +++ b/host/tools/configtool/common/win32/resource.h @@ -1,26 +1,25 @@ -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSHOSTGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// This file is part of the eCos host tools. +// +// 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., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// ------------------------------------------- +//####ECOSHOSTGPLCOPYRIGHTEND#### #include "CTCommonres.h" #ifdef PLUGIN #include "eCosres.h" diff --git a/host/tools/configtool/standalone/common/ChangeLog b/host/tools/configtool/standalone/common/ChangeLog --- a/host/tools/configtool/standalone/common/ChangeLog +++ b/host/tools/configtool/standalone/common/ChangeLog @@ -1,3 +1,14 @@ +2002-02-05 Bart Veer + + * cdl_exec.cxx, cdl_exec.hxx, ecosconfig.cxx: + Add new options --enable-debug and --disable-debug + +2002-01-14 Bart Veer + + * cdl_exec.cxx: + Add missing under cygwin, needed for MAXPATHLEN. + Reported by Jifl. + 2001-12-29 Bart Veer * ecosconfig.cxx, cdl_exec.cxx, cdl_exec.hxx diff --git a/host/tools/configtool/standalone/common/Makefile.am b/host/tools/configtool/standalone/common/Makefile.am --- a/host/tools/configtool/standalone/common/Makefile.am +++ b/host/tools/configtool/standalone/common/Makefile.am @@ -6,29 +6,28 @@ ## ecostest ## ## ===================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -######COPYRIGHTEND#### +#####ECOSHOSTGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# This file is part of the eCos host tools. +# +# 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., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ------------------------------------------- +#####ECOSHOSTGPLCOPYRIGHTEND#### ## ===================================================================== #######DESCRIPTIONBEGIN#### ## diff --git a/host/tools/configtool/standalone/common/Makefile.in b/host/tools/configtool/standalone/common/Makefile.in --- a/host/tools/configtool/standalone/common/Makefile.in +++ b/host/tools/configtool/standalone/common/Makefile.in @@ -10,29 +10,28 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -######COPYRIGHTEND#### +#####ECOSHOSTGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# This file is part of the eCos host tools. +# +# 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., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ------------------------------------------- +#####ECOSHOSTGPLCOPYRIGHTEND#### #######DESCRIPTIONBEGIN#### ######DESCRIPTIONEND#### diff --git a/host/tools/configtool/standalone/common/acinclude.m4 b/host/tools/configtool/standalone/common/acinclude.m4 --- a/host/tools/configtool/standalone/common/acinclude.m4 +++ b/host/tools/configtool/standalone/common/acinclude.m4 @@ -5,29 +5,28 @@ dnl dnl acinclude.m4 dnl dnl ==================================================================== -dnl###COPYRIGHTBEGIN#### -dnl -dnl ------------------------------------------- -dnl The contents of this file are subject to the Red Hat eCos Public License -dnl Version 1.1 (the "License"); you may not use this file except in -dnl compliance with the License. You may obtain a copy of the License at -dnl http://www.redhat.com/ -dnl -dnl Software distributed under the License is distributed on an "AS IS" -dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -dnl License for the specific language governing rights and limitations under -dnl the License. -dnl -dnl The Original Code is eCos - Embedded Configurable Operating System, -dnl released September 30, 1998. -dnl -dnl The Initial Developer of the Original Code is Red Hat. -dnl Portions created by Red Hat are -dnl Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -dnl All Rights Reserved. -dnl ------------------------------------------- -dnl -dnl####COPYRIGHTEND#### +dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN#### +dnl ------------------------------------------- +dnl Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +dnl +dnl This file is part of the eCos host tools. +dnl +dnl This program is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by the Free +dnl Software Foundation; either version 2 of the License, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but WITHOUT +dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +dnl more details. +dnl +dnl You should have received a copy of the GNU General Public License along with +dnl this program; if not, write to the Free Software Foundation, Inc., +dnl 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl ------------------------------------------- +dnl ####ECOSHOSTGPLCOPYRIGHTEND#### dnl ==================================================================== dnl#####DESCRIPTIONBEGIN#### dnl diff --git a/host/tools/configtool/standalone/common/aclocal.m4 b/host/tools/configtool/standalone/common/aclocal.m4 --- a/host/tools/configtool/standalone/common/aclocal.m4 +++ b/host/tools/configtool/standalone/common/aclocal.m4 @@ -17,29 +17,28 @@ dnl dnl acinclude.m4 dnl dnl ==================================================================== -dnl###COPYRIGHTBEGIN#### -dnl -dnl ------------------------------------------- -dnl The contents of this file are subject to the Red Hat eCos Public License -dnl Version 1.1 (the "License"); you may not use this file except in -dnl compliance with the License. You may obtain a copy of the License at -dnl http://www.redhat.com/ -dnl -dnl Software distributed under the License is distributed on an "AS IS" -dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -dnl License for the specific language governing rights and limitations under -dnl the License. -dnl -dnl The Original Code is eCos - Embedded Configurable Operating System, -dnl released September 30, 1998. -dnl -dnl The Initial Developer of the Original Code is Red Hat. -dnl Portions created by Red Hat are -dnl Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -dnl All Rights Reserved. -dnl ------------------------------------------- -dnl -dnl####COPYRIGHTEND#### +dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN#### +dnl ------------------------------------------- +dnl Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +dnl +dnl This file is part of the eCos host tools. +dnl +dnl This program is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by the Free +dnl Software Foundation; either version 2 of the License, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but WITHOUT +dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +dnl more details. +dnl +dnl You should have received a copy of the GNU General Public License along with +dnl this program; if not, write to the Free Software Foundation, Inc., +dnl 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl ------------------------------------------- +dnl ####ECOSHOSTGPLCOPYRIGHTEND#### dnl ==================================================================== dnl#####DESCRIPTIONBEGIN#### dnl diff --git a/host/tools/configtool/standalone/common/cdl_exec.cxx b/host/tools/configtool/standalone/common/cdl_exec.cxx --- a/host/tools/configtool/standalone/common/cdl_exec.cxx +++ b/host/tools/configtool/standalone/common/cdl_exec.cxx @@ -1,7 +1,7 @@ //####COPYRIGHTBEGIN#### // // ---------------------------------------------------------------------------- -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. // // This program is part of the eCos host tools. // @@ -45,6 +45,7 @@ #endif #ifdef __CYGWIN__ #include +#include /* for MAXPATHLEN */ #include /* for cygwin_conv_to_win32_path() */ #endif #include "build.hxx" @@ -55,6 +56,8 @@ bool cdl_exec::quiet = false; bool cdl_exec::verbose = false; bool cdl_exec::ignore_errors = false; bool cdl_exec::no_updates = false; +bool cdl_exec::debug_level_set = false; +int cdl_exec::debug_level = 0; cdl_exec::cdl_exec (const std::string repository_arg, const std::string savefile_arg, const std::string install_arg, bool no_resolve_arg) @@ -105,6 +108,13 @@ cdl_exec::set_no_updates_mode(bool new_v no_updates = new_val; } +void +cdl_exec::set_debug_level(int new_level) +{ + debug_level_set = true; + debug_level = new_level; +} + // ---------------------------------------------------------------------------- void cdl_exec::init(bool load_config) @@ -153,6 +163,10 @@ bool cdl_exec::cmd_new (const std::strin transact.body(); transact.destroy(); + if (debug_level_set) { + this->update_debug_level(); + } + // Unless inference has been suppressed, make sure that the // inference engine gets invoked and that its results get // reported. @@ -191,6 +205,9 @@ cdl_exec::cmd_target (const std::string try { init(true); config->set_hardware (resolve_hardware_alias (cdl_target), &diagnostic_handler, &diagnostic_handler); + if (debug_level_set) { + this->update_debug_level(); + } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); @@ -220,6 +237,9 @@ cdl_exec::cmd_template (const std::strin try { init(true); config->set_template (cdl_template, cdl_version, &diagnostic_handler, &diagnostic_handler); + if (debug_level_set) { + this->update_debug_level(); + } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); @@ -248,6 +268,9 @@ cdl_exec::cmd_export (const std::string bool status = false; try { init(true); + if (debug_level_set) { + this->update_debug_level(); + } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); @@ -280,6 +303,9 @@ cdl_exec::cmd_import (const std::string try { init(true); config->add(cdl_savefile, &diagnostic_handler, &diagnostic_handler); + if (debug_level_set) { + this->update_debug_level(); + } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); @@ -311,6 +337,9 @@ cdl_exec::cmd_add (const std::vectorload_package (resolve_package_alias (cdl_packages [n]), "", &diagnostic_handler, &diagnostic_handler); } + if (debug_level_set) { + this->update_debug_level(); + } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); @@ -348,6 +377,9 @@ cdl_exec::cmd_remove (const std::vector< for (n = 0; n < cdl_packages.size (); n++) { config->unload_package (resolve_package_alias (cdl_packages [n])); } + if (debug_level_set) { + this->update_debug_level(); + } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); @@ -380,6 +412,9 @@ cdl_exec::cmd_version (const std::string config->change_package_version(resolve_package_alias (cdl_packages [n]), cdl_version, &diagnostic_handler, &diagnostic_handler, true); } + if (debug_level_set) { + this->update_debug_level(); + } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); @@ -408,6 +443,9 @@ cdl_exec::cmd_tree () bool status = false; try { init(true); + if (debug_level_set) { + this->update_debug_level(); + } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); @@ -556,6 +594,11 @@ cdl_exec::cmd_check () // change. // However, updating the savefile is worthwhile because it // will now contain more accurate information about the state. + // Enabling/disabling debugs is allowed for now because that + // is unlikely to introduce conflicts. + if (debug_level_set) { + this->update_debug_level(); + } if (!no_updates) { config->save (savefile); } @@ -643,6 +686,9 @@ cdl_exec::cmd_resolve () try { init(true); + if (debug_level_set) { + this->update_debug_level(); + } CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts (); report_conflicts(); @@ -879,3 +925,24 @@ cdl_exec::resolve_hardware_alias (const } return target; } + +// ---------------------------------------------------------------------------- +// Enable or disable debugging in a configuration. +void +cdl_exec::update_debug_level() +{ + CdlNode node = config->lookup("CYGPKG_INFRA_DEBUG"); + CdlValuable valuable = 0; + if (0 != node) { + valuable = dynamic_cast(node); + } + if (0 == valuable) { + throw CdlStringException("Cannot enable or disable debugging, the infrastructure package is absent"); + } + + if (debug_level > 0) { + valuable->enable(CdlValueSource_User); + } else { + valuable->disable(CdlValueSource_User); + } +} diff --git a/host/tools/configtool/standalone/common/cdl_exec.hxx b/host/tools/configtool/standalone/common/cdl_exec.hxx --- a/host/tools/configtool/standalone/common/cdl_exec.hxx +++ b/host/tools/configtool/standalone/common/cdl_exec.hxx @@ -1,7 +1,7 @@ //####COPYRIGHTBEGIN#### // // ---------------------------------------------------------------------------- -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. // // This program is part of the eCos host tools. // @@ -44,6 +44,7 @@ public: static void set_verbose_mode(bool); static void set_ignore_errors_mode(bool); static void set_no_updates_mode(bool); + static void set_debug_level(int); protected: static bool quiet; @@ -54,6 +55,8 @@ protected: std::string savefile; std::string install_prefix; bool no_resolve; + static bool debug_level_set; + static int debug_level; CdlPackagesDatabase pkgdata; CdlInterpreter interp; CdlConfiguration config; @@ -67,4 +70,5 @@ protected: static void transaction_callback(const CdlTransactionCallback&); std::string resolve_package_alias (const std::string alias); std::string resolve_hardware_alias (const std::string alias); + void update_debug_level(void); }; diff --git a/host/tools/configtool/standalone/common/configure.in b/host/tools/configtool/standalone/common/configure.in --- a/host/tools/configtool/standalone/common/configure.in +++ b/host/tools/configtool/standalone/common/configure.in @@ -6,29 +6,28 @@ dnl dnl configtool/standalone/common dnl dnl ==================================================================== -dnl###COPYRIGHTBEGIN#### -dnl -dnl ------------------------------------------- -dnl The contents of this file are subject to the Red Hat eCos Public License -dnl Version 1.1 (the "License"); you may not use this file except in -dnl compliance with the License. You may obtain a copy of the License at -dnl http://www.redhat.com/ -dnl -dnl Software distributed under the License is distributed on an "AS IS" -dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -dnl License for the specific language governing rights and limitations under -dnl the License. -dnl -dnl The Original Code is eCos - Embedded Configurable Operating System, -dnl released September 30, 1998. -dnl -dnl The Initial Developer of the Original Code is Red Hat. -dnl Portions created by Red Hat are -dnl Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -dnl All Rights Reserved. -dnl ------------------------------------------- -dnl -dnl####COPYRIGHTEND#### +dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN#### +dnl ------------------------------------------- +dnl Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +dnl +dnl This file is part of the eCos host tools. +dnl +dnl This program is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by the Free +dnl Software Foundation; either version 2 of the License, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but WITHOUT +dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +dnl more details. +dnl +dnl You should have received a copy of the GNU General Public License along with +dnl this program; if not, write to the Free Software Foundation, Inc., +dnl 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl ------------------------------------------- +dnl ####ECOSHOSTGPLCOPYRIGHTEND#### dnl ==================================================================== dnl#####DESCRIPTIONBEGIN#### dnl diff --git a/host/tools/configtool/standalone/common/ecosconfig.cxx b/host/tools/configtool/standalone/common/ecosconfig.cxx --- a/host/tools/configtool/standalone/common/ecosconfig.cxx +++ b/host/tools/configtool/standalone/common/ecosconfig.cxx @@ -91,6 +91,8 @@ int main (int argc, char * argv []) { bool ignore_errors = false; // -i, --ignore-errors bool no_updates = false; // -n, --no-updates, bool help = false; // --help + bool enable_debug_set = false; // --enable-debug or --disable-debug + int debug_level = 0; // --enable-debug=[0|1|2] // getopt() cannot easily be used here since this code has to // build with VC++ as well. @@ -117,6 +119,12 @@ int main (int argc, char * argv []) { version = true; } else if (0 == strcmp(arg, "--no-resolve")) { no_resolve = true; + } else if (0 == strcmp(arg, "--enable-debug")) { + enable_debug_set = true; + debug_level = 1; + } else if (0 == strcmp(arg, "--disable-debug")) { + enable_debug_set = true; + debug_level = 0; } else if (0 == strncmp(arg, "--srcdir", 8)) { // Duplicate use of --srcdir and other data-containing options should // be marked as an error. @@ -280,6 +288,9 @@ int main (int argc, char * argv []) { cdl_exec::set_verbose_mode(verbose); cdl_exec::set_ignore_errors_mode(ignore_errors); cdl_exec::set_no_updates_mode(no_updates); + if (enable_debug_set) { + cdl_exec::set_debug_level(debug_level); + } // Now identify and process the sub-command. const std::string command = argv [command_index]; @@ -448,5 +459,7 @@ void usage_message () { printf (" -v, --verbose : increase verbosity\n"); printf (" -i, --ignore-errors : ignore unresolved conflicts\n"); printf (" -n, --no-updates : read-only mode, do not modify the file system\n"); + printf (" --enable-debug : enable debugging in this configuration\n"); + printf (" --disable-debug : disable debugging in this configuration\n"); printf (" --help : display this message\n"); } diff --git a/host/tools/configtool/standalone/wxwin/CHANGES.txt b/host/tools/configtool/standalone/wxwin/CHANGES.txt --- a/host/tools/configtool/standalone/wxwin/CHANGES.txt +++ b/host/tools/configtool/standalone/wxwin/CHANGES.txt @@ -1,6 +1,30 @@ Release History for eCos Configuration Tool 2 ============================================= +*** Version 2.11, February 13th, 2002 + +- Enabled Run Tests dialog in release mode. + +- Corrected backslashes in makefiles. + +- Added radio button group style to make the + groups on the Viewers dialog separate. + +- Enabled the Run Tests settings dialog. + +- Reordered the Alt-n accelerators on the + View menu. + + +*** Version 2.10, January 25th, 2002 + +- 2002 added to the copyright message. + +- The tree and value panes now have a minimum width, + so you can't lose the splitter bar by double-clicking + on it. + + *** Version 2.09, December 11th 2001 - Hardware is now sorted alphabetically on UNIX. @@ -15,7 +39,7 @@ Release History for eCos Configuration T - Packages dialog improvements: added keyword search and 'Omit hardware' checkbox; added more information to the description window. -- added an "exact match" checkbox to the Packages dialog. That way if +- Added an "exact match" checkbox to the Packages dialog. That way if you type 'flash', you get exactly what you'd get if you type 'ecosconfig add flash'. @@ -148,8 +172,3 @@ Release History for eCos Configuration T *** Version 2.0, May 2001 - Initial public release - - - - - diff --git a/host/tools/configtool/standalone/wxwin/ConfigtoolVC.dsp b/host/tools/configtool/standalone/wxwin/ConfigtoolVC.dsp --- a/host/tools/configtool/standalone/wxwin/ConfigtoolVC.dsp +++ b/host/tools/configtool/standalone/wxwin/ConfigtoolVC.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Application" 0x0101 -CFG=ConfigtoolVC - Win32 ANSI Debug +CFG=ConfigtoolVC - Win32 ANSI Debug For Recent wxWin !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,7 +13,7 @@ CFG=ConfigtoolVC - Win32 ANSI Debug !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "ConfigtoolVC.mak" CFG="ConfigtoolVC - Win32 ANSI Debug" +!MESSAGE NMAKE /f "ConfigtoolVC.mak" CFG="ConfigtoolVC - Win32 ANSI Debug For Recent wxWin" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -21,6 +21,8 @@ CFG=ConfigtoolVC - Win32 ANSI Debug !MESSAGE "ConfigtoolVC - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE "ConfigtoolVC - Win32 ANSI Debug" (based on "Win32 (x86) Application") !MESSAGE "ConfigtoolVC - Win32 ANSI Release" (based on "Win32 (x86) Application") +!MESSAGE "ConfigtoolVC - Win32 ANSI Debug For Recent wxWin" (based on "Win32 (x86) Application") +!MESSAGE "ConfigtoolVC - Win32 ANSI Release for Recent wxWin" (based on "Win32 (x86) Application") !MESSAGE # Begin Project @@ -55,7 +57,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wininet.lib shlwapi.lib winmm.lib htmlhelp.lib cyginfra.lib cdl.lib tcl82.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"v:/ConfigToolWX/Release/configtool.exe" /libpath:"v:\cdl\release\lib" +# ADD LINK32 wx.lib wxmsw.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wininet.lib shlwapi.lib winmm.lib htmlhelp.lib cyginfra.lib cdl.lib tcl82.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"v:/ConfigToolWX/Release/configtool.exe" /libpath:"v:\cdl\release\lib" !ELSEIF "$(CFG)" == "ConfigtoolVC - Win32 Debug" @@ -81,7 +83,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wininet.lib winmm.lib shlwapi.lib htmlhelp.lib cyginfra.lib cdl.lib tcl82d.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"v:/ConfigToolWX/Debug/configtool.exe" /pdbtype:sept /libpath:"v:\cdl\debug\lib" +# ADD LINK32 wxd.lib wxmswd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wininet.lib winmm.lib shlwapi.lib htmlhelp.lib cyginfra.lib cdl.lib tcl82d.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"v:/ConfigToolWX/Debug/configtool.exe" /pdbtype:sept /libpath:"v:\cdl\debug\lib" !ELSEIF "$(CFG)" == "ConfigtoolVC - Win32 ANSI Debug" @@ -137,6 +139,60 @@ LINK32=link.exe # ADD BASE LINK32 wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wininet.lib shlwapi.lib winmm.lib htmlhelp.lib cyginfra.lib cdl.lib tcl82.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/configtool.exe" /libpath:"v:\cdl\release\lib" # ADD LINK32 wx.lib png.lib zlib.lib jpeg.lib tiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wininet.lib shlwapi.lib winmm.lib htmlhelp.lib cyginfra.lib cdl.lib tcl82.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"v:/ConfigToolWX/ANSIRelease/configtool.exe" /libpath:"v:\cdl\release\lib" +!ELSEIF "$(CFG)" == "ConfigtoolVC - Win32 ANSI Debug For Recent wxWin" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ConfigtoolVC___Win32_ANSI_Debug_For_Recent_wxWin" +# PROP BASE Intermediate_Dir "ConfigtoolVC___Win32_ANSI_Debug_For_Recent_wxWin" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "v:\ConfigToolWX\ANSIDebug" +# PROP Intermediate_Dir "v:\ConfigToolWX\ANSIDebug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "v:\cdl\Debug\include" /I "..\..\common\common" /I "..\..\..\Utils\common" /I "..\..\..\ecostest\common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"ecpch.h" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "v:\cdl\Debug\include" /I "..\..\common\common" /I "..\..\..\Utils\common" /I "..\..\..\ecostest\common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"ecpch.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wininet.lib winmm.lib shlwapi.lib htmlhelp.lib cyginfra.lib cdl.lib tcl82d.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"v:/ConfigToolWX/ANSIDebug/configtool.exe" /pdbtype:sept /libpath:"v:\cdl\debug\lib" +# ADD LINK32 wxmswd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wininet.lib winmm.lib shlwapi.lib htmlhelp.lib cyginfra.lib cdl.lib tcl82d.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"v:/ConfigToolWX/ANSIDebug/configtool.exe" /pdbtype:sept /libpath:"v:\cdl\debug\lib" + +!ELSEIF "$(CFG)" == "ConfigtoolVC - Win32 ANSI Release for Recent wxWin" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ConfigtoolVC___Win32_ANSI_Release_for_Recent_wxWin" +# PROP BASE Intermediate_Dir "ConfigtoolVC___Win32_ANSI_Release_for_Recent_wxWin" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "v:\ConfigToolWX\ANSIRelease" +# PROP Intermediate_Dir "v:\ConfigToolWX\ANSIRelease" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GR /GX /O1 /Ob2 /I "v:\cdl\Release\include" /I "..\..\common\common" /I "..\..\..\Utils\common" /I "..\..\..\ecostest\common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"ecpch.h" /FD /c +# ADD CPP /nologo /MD /W3 /GR /GX /O1 /Ob2 /I "v:\cdl\Release\include" /I "..\..\common\common" /I "..\..\..\Utils\common" /I "..\..\..\ecostest\common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"ecpch.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wx.lib png.lib zlib.lib jpeg.lib tiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wininet.lib shlwapi.lib winmm.lib htmlhelp.lib cyginfra.lib cdl.lib tcl82.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"v:/ConfigToolWX/ANSIRelease/configtool.exe" /libpath:"v:\cdl\release\lib" +# ADD LINK32 wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wininet.lib shlwapi.lib winmm.lib htmlhelp.lib cyginfra.lib cdl.lib tcl82.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"v:/ConfigToolWX/ANSIRelease/configtool.exe" /libpath:"v:\cdl\release\lib" + !ENDIF # Begin Target @@ -145,6 +201,8 @@ LINK32=link.exe # Name "ConfigtoolVC - Win32 Debug" # Name "ConfigtoolVC - Win32 ANSI Debug" # Name "ConfigtoolVC - Win32 ANSI Release" +# Name "ConfigtoolVC - Win32 ANSI Debug For Recent wxWin" +# Name "ConfigtoolVC - Win32 ANSI Release for Recent wxWin" # Begin Group "GUI files" # PROP Default_Filter "" @@ -345,6 +403,13 @@ SOURCE=.\mainwin.cpp !ELSEIF "$(CFG)" == "ConfigtoolVC - Win32 ANSI Release" +!ELSEIF "$(CFG)" == "ConfigtoolVC - Win32 ANSI Debug For Recent wxWin" + +# ADD BASE CPP /Yu +# ADD CPP /Yu + +!ELSEIF "$(CFG)" == "ConfigtoolVC - Win32 ANSI Release for Recent wxWin" + !ENDIF # End Source File diff --git a/host/tools/configtool/standalone/wxwin/Makefile b/host/tools/configtool/standalone/wxwin/Makefile --- a/host/tools/configtool/standalone/wxwin/Makefile +++ b/host/tools/configtool/standalone/wxwin/Makefile @@ -38,6 +38,9 @@ PROGRAM = configtool LEVEL = debug WXDEBUGFLAGS=--with-debug_flag --with-debug_info --enable-debug --enable-debug_cntxt ECCDEBUGFLAGS=--enable-debug +# IMPORTANT NOTE for recent versions of wxWindows, you must pass +# --static to wx-config. For older versions, comment this out. +#WXCONFIGFLAGS=--static CPPDEBUGOPTIONS=-ggdb LINKDEBUGOPTIONS= STRIPCOMMAND=echo @@ -58,7 +61,7 @@ CTBUILDDIR=$(BUILDDIR)/ct-build-$(LEVEL) # You have to specify this when invoking make. ECOSDIR=You_should_override_the_ECOSDIR_variable CTDIR=$(ECOSDIR)/host/tools/configtool/standalone/wxwin -WXCONFIG=$(WXBUILDDIR)/wx-config +WXCONFIG=$(WXBUILDDIR)/wx-config $(WXCONFIGFLAGS) # Where the binary will be installed locally LOCALBINDIR=/home/ecos/misctools/H-i686-pc-linux-gnu/bin # A suitable home for archives of the tool @@ -173,7 +176,7 @@ wx: cd $(WXBUILDDIR) ; \ if test ! -f Makefile ; then rm -f *.o *.d ; \ rm -f *.cache ; \ - $(WXDIR)/configure --disable-shared --enable-gui --with-gtk --enable-log $(WXDEBUGFLAGS) --with-threads --without-sockets -without-odbc -without-libjpeg ; \ + $(WXDIR)/configure --disable-shared --enable-gui --with-gtk --enable-log $(WXDEBUGFLAGS) --with-threads --disable-no_rtti --without-sockets --without-odbc --without-libjpeg ; \ fi; \ make @@ -397,3 +400,5 @@ installtarball: releasect $(CC) $(CPPDEBUGOPTIONS) -c $(EXTRACPPFLAGS) `$(WXCONFIG) $(INCLUDEPREFIX) --cflags` -o $@ $< +help: + @echo "Targets: full, ecc, wx, ct, cleanall, cleanct, cleanwx, installbinary, installtarball" \ No newline at end of file diff --git a/host/tools/configtool/standalone/wxwin/README.txt b/host/tools/configtool/standalone/wxwin/README.txt --- a/host/tools/configtool/standalone/wxwin/README.txt +++ b/host/tools/configtool/standalone/wxwin/README.txt @@ -382,6 +382,10 @@ Examples: Please see the FAQ for what to do if the wxWindows file dcclient.cpp fails to compile. + For more recent versions of wxWindows, you have to pass --static to wx-config. + If you get a lot of GTK+-related link errors, check the beginning of the makefile + and make sure WXCONFIGFLAGS=--static. + Building the Configuration Tool under Windows ============================================= diff --git a/host/tools/configtool/standalone/wxwin/TODO.txt b/host/tools/configtool/standalone/wxwin/TODO.txt --- a/host/tools/configtool/standalone/wxwin/TODO.txt +++ b/host/tools/configtool/standalone/wxwin/TODO.txt @@ -4,6 +4,8 @@ To-Do List for Configuration Tool 2.x - Implement Memory Layout Tool. - Verify Run Tests Dialog works for TCP/IP mode on Linux. + There's a problem under Windows too, apparently (2002-02-13), + whereby everything is greyed out. - Importing more than one package at a time can cause conflicts whereas importing one at a time causes no conflicts. @@ -35,3 +37,7 @@ To-Do List for Configuration Tool 2.x o optionally, the ability to hide inactive and/or calculated options and/or interfaces. They add a lot to visual clutter, but we do require the user to be _able_ to view them if need be. + +- List controls: sometimes it's not possible to scroll horizontally to see + all of a label, for example in the Properties window. Need to set the + column width according to the maximum size of labels in that column. diff --git a/host/tools/configtool/standalone/wxwin/choosereposdlg.cpp b/host/tools/configtool/standalone/wxwin/choosereposdlg.cpp --- a/host/tools/configtool/standalone/wxwin/choosereposdlg.cpp +++ b/host/tools/configtool/standalone/wxwin/choosereposdlg.cpp @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/10/02 -// Version: $Id: choosereposdlg.cpp,v 1.2 2001/03/23 13:38:04 julians Exp $ +// Version: $Id: choosereposdlg.cpp,v 1.3 2002/02/28 18:30:35 julians Exp $ // Purpose: // Description: Implementation file for ecChooseRepositoryDialog // Requires: @@ -185,7 +185,7 @@ void ecChooseRepositoryDialog::CreateCon void ecChooseRepositoryDialog::OnBrowse(wxCommandEvent& event) { - wxDirDialog dialog(this); + wxDirDialog dialog(this, wxT("Repository path")); if (wxID_OK == dialog.ShowModal()) { wxString path = dialog.GetPath(); diff --git a/host/tools/configtool/standalone/wxwin/configtooldoc.cpp b/host/tools/configtool/standalone/wxwin/configtooldoc.cpp --- a/host/tools/configtool/standalone/wxwin/configtooldoc.cpp +++ b/host/tools/configtool/standalone/wxwin/configtooldoc.cpp @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/10/05 -// Version: $Id: configtooldoc.cpp,v 1.42 2001/10/11 12:31:42 julians Exp $ +// Version: $Id: configtooldoc.cpp,v 1.43 2002/02/13 13:58:18 julians Exp $ // Purpose: // Description: Implementation file for the ecConfigToolDoc class // Requires: @@ -2233,32 +2233,38 @@ bool ecConfigToolDoc::NewMemoryLayout (c void ecConfigToolDoc::RunTests() { wxString strTarget(GetCdlConfig()->get_hardware ().c_str ()); + wxArrayString ar; + wxArrayString arTestsMissing; + int nTests; wxGetApp().GetSettings().GetRunTestsSettings().m_strTarget = strTarget; - if (NULL==CeCosTestPlatform::Get(strTarget)) { - wxString msg; - msg.Printf(_("%s is not a recognized platform - do you wish to add it?"), (const wxChar*) strTarget); - if (wxNO == wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_QUESTION|wxYES_NO)) - return; - - ecPlatformEditorDialog dlg(wxGetApp().GetTopWindow()); + wxBusyCursor busy; - dlg.m_strPlatform = strTarget; - dlg.m_strPrefix = GetCurrentTargetPrefix(); - dlg.m_strCaption=_("New Platform"); - if(wxID_CANCEL == dlg.ShowModal()) + GetCdlConfig()->get_build_info(m_BuildInfo); + if (NULL==CeCosTestPlatform::Get(strTarget)) { - return; + wxString msg; + msg.Printf(_("%s is not a recognized platform - do you wish to add it?"), (const wxChar*) strTarget); + if (wxNO == wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_QUESTION|wxYES_NO)) + return; + + ecPlatformEditorDialog dlg(wxGetApp().GetTopWindow()); + + dlg.m_strPlatform = strTarget; + dlg.m_strPrefix = GetCurrentTargetPrefix(); + dlg.m_strCaption=_("New Platform"); + if(wxID_CANCEL == dlg.ShowModal()) + { + return; + } + CeCosTestPlatform::Add(CeCosTestPlatform(dlg.m_strPlatform,dlg.m_strPrefix,dlg.m_strPrompt,dlg.m_strGDB,dlg.m_bServerSideGdb,dlg.m_strInferior)); + CeCosTestPlatform::Save(); } - CeCosTestPlatform::Add(CeCosTestPlatform(dlg.m_strPlatform,dlg.m_strPrefix,dlg.m_strPrompt,dlg.m_strGDB,dlg.m_bServerSideGdb,dlg.m_strInferior)); - CeCosTestPlatform::Save(); + + nTests = GetTestExeNames(ar, arTestsMissing); } - wxArrayString ar; - wxArrayString arTestsMissing; - int nTests = GetTestExeNames(ar, arTestsMissing); - const CeCosTestPlatform * etPlatform = CeCosTestPlatform::Get(strTarget); wxASSERT (NULL != etPlatform); diff --git a/host/tools/configtool/standalone/wxwin/dialogs/configtool.wdr b/host/tools/configtool/standalone/wxwin/dialogs/configtool.wdr index 1e24f33463cbc2d79d5d907f0f3d1e945e7ed76c..a55b49333b8ba12072558238c7c51960b4391f9c GIT binary patch literal 74131 zc%1D$O_Srsb=VI{)@+!KKG^8@ z+3&r6{rbGwzr}If9nL>)ajVA({u?8=Y3Qasaqr@@?m(95Cp_^Q{tIrui@&}Kr;;Em zr>{qUn)J&z@n0Xgw)q@2Z0o`_MxG1r{}%qMD_^S8S7JYSzi6Tvvb;a=&(7-h3)T2r zd;3!t-p43p#+C3eV~B zO3>sVlly`!opy%}v8##wVO!}-UnyNpkpFP~=9$>nq=q2BN^Z$wOM8uc>r1C??G^G> zQ+mN$72MqpyzMvlI1U;^BdIxTDBYGUH8d5zX;OC}{$FssjURbC;DI+d*tNnd=2Px3&lVtqJCut}j3# z-b5w;@5xGDRpfytDcw-XkGb?peiNCl!(Ea!$_3zShG(J-mMx%DcxEp=JZiKS)`*=| zd%FlKQ!vYuL?9~k50gEBgp&GK80w#=5k0OjEnS?U_TS(2sYmQgaH@Vz{H{i>aNO#!Q=UTl9v6&6Evefa`a&=~Zwng5 z(KlRrn>Y#z$L-ZBI5df*Ej8L=;|Xpq1I!Zg4Sqb z-caORCiOe`ucLdTDPOys+9u*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c+ zdVgROGth&Gb1GQFk}_V*Vq%X$18yf?xWrZ~dkJ$nuwT_?*vMhKUk?29Gp;_A}nK z7tRQ|bdsUb>$N1AYSo~DO|R9T*$Z!MP9BWr^Q3Dh(er7h=3$V$AY)pj{k4ntRxV5f Vg!Qhxscmh99G>zYp}@n{{|A;#&!GSS diff --git a/host/tools/configtool/standalone/wxwin/ecscrolwin.cpp b/host/tools/configtool/standalone/wxwin/ecscrolwin.cpp --- a/host/tools/configtool/standalone/wxwin/ecscrolwin.cpp +++ b/host/tools/configtool/standalone/wxwin/ecscrolwin.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: ecscrolwin.cpp,v 1.2 2001/05/02 10:36:15 julians Exp $ +// RCS-ID: $Id: ecscrolwin.cpp,v 1.3 2002/02/28 16:39:37 julians Exp $ // Copyright: (c) Julian Smart and Markus Holzem // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -122,7 +122,7 @@ bool ecScrolledWindow::Create(wxWindow * bool ok = wxPanel::Create(parent, id, pos, size, style, name); -#ifdef __WXMSW__ +#if defined(__WXMSW__) && (wxVERSION_NUMBER < 2302) // we need to process arrows ourselves for scrolling m_lDlgCode |= DLGC_WANTARROWS; #endif // __WXMSW__ diff --git a/host/tools/configtool/standalone/wxwin/ecscrolwin.h b/host/tools/configtool/standalone/wxwin/ecscrolwin.h --- a/host/tools/configtool/standalone/wxwin/ecscrolwin.h +++ b/host/tools/configtool/standalone/wxwin/ecscrolwin.h @@ -5,7 +5,7 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: ecscrolwin.h,v 1.1 2001/05/01 17:18:47 julians Exp $ +// RCS-ID: $Id: ecscrolwin.h,v 1.2 2002/02/28 18:30:35 julians Exp $ // Copyright: (c) Julian Smart and Markus Holzem // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -26,7 +26,12 @@ // 1 to use our own scroled window to insulate us from // wxWindows changes + +#if wxRELEASE_NUMBER < 2302 #define ecUSE_OWN_SCROLLED_WINDOW 1 +#else +#define ecUSE_OWN_SCROLLED_WINDOW 0 +#endif #if !ecUSE_OWN_SCROLLED_WINDOW #include "wx/scrolwin.h" diff --git a/host/tools/configtool/standalone/wxwin/finddlg.cpp b/host/tools/configtool/standalone/wxwin/finddlg.cpp --- a/host/tools/configtool/standalone/wxwin/finddlg.cpp +++ b/host/tools/configtool/standalone/wxwin/finddlg.cpp @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/09/11 -// Version: $Id: finddlg.cpp,v 1.3 2001/03/07 18:21:50 julians Exp $ +// Version: $Id: finddlg.cpp,v 1.5 2002/02/28 18:30:35 julians Exp $ // Purpose: // Description: Implementation file for ecFindDialog // Requires: @@ -199,14 +199,14 @@ bool ecFindDialog::TransferDataToWindow( // Convert to radiobox selection index from bool m_directionSelection = wxGetApp().GetSettings().m_findDirection ? 1 : 0 ; - wxPanel::TransferDataToWindow(); + wxWindow::TransferDataToWindow(); return TRUE; } bool ecFindDialog::TransferDataFromWindow() { - wxPanel::TransferDataFromWindow(); + wxWindow::TransferDataFromWindow(); // Convert from radiobox selection index to bool wxGetApp().GetSettings().m_findDirection = (m_directionSelection == 1); @@ -262,4 +262,4 @@ void ecFindDialog::OnCancel(wxCommandEve wxGetApp().GetMainFrame()->m_findDialog = NULL; event.Skip(); -} \ No newline at end of file +} diff --git a/host/tools/configtool/standalone/wxwin/mainwin.cpp b/host/tools/configtool/standalone/wxwin/mainwin.cpp --- a/host/tools/configtool/standalone/wxwin/mainwin.cpp +++ b/host/tools/configtool/standalone/wxwin/mainwin.cpp @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/08/24 -// Version: $Id: mainwin.cpp,v 1.53 2001/09/03 17:18:18 julians Exp $ +// Version: $Id: mainwin.cpp,v 1.57 2002/02/28 18:30:35 julians Exp $ // Purpose: // Description: Implementation file for the ConfigTool main window // Requires: @@ -311,13 +311,13 @@ ecMainFrame::ecMainFrame(wxDocManager *m viewMenu->Append(ecID_TOGGLE_PROPERTIES, _("&Properties\tAlt+1"), _("Shows or hides the properties window"), TRUE); viewMenu->Append(ecID_TOGGLE_OUTPUT, _("&Output\tAlt+2"), _("Shows the output window"), TRUE); viewMenu->Append(ecID_TOGGLE_SHORT_DESCR, _("&Short Description\tAlt+3"), _("Shows or hides the short description window"), TRUE); + + viewMenu->Append(ecID_TOGGLE_CONFLICTS, _("&Conflicts\tAlt+4"), _("Shows or hides the conflicts window"), TRUE); #if ecUSE_MLT - viewMenu->Append(ecID_TOGGLE_MEMORY, _("&Memory Layout\tAlt+4"), _("Shows or hides the memory layout window"), TRUE); + viewMenu->Append(ecID_TOGGLE_MEMORY, _("&Memory Layout\tAlt+5"), _("Shows or hides the memory layout window"), TRUE); + //viewMenu->Enable(ecID_TOGGLE_MEMORY, FALSE); #endif - //viewMenu->Enable(ecID_TOGGLE_MEMORY, FALSE); - - viewMenu->Append(ecID_TOGGLE_CONFLICTS, _("&Conflicts\tAlt+5"), _("Shows or hides the conflicts window"), TRUE); // Not clear what these do, so let's not have them. //viewMenu->Append(ecID_VIEW_NEXT, _("&Next\tAlt+F6"), _("Selects the next visible pane")); //viewMenu->Append(ecID_VIEW_PREVIOUS, _("&Previous\tShift+Alt+F6"), _("Selects the previous visible pane")); @@ -468,15 +468,16 @@ void ecMainFrame::CreateWindows() // Create a composite widget to represent the scrolling config window m_scrolledWindow = new ecSplitterScrolledWindow(m_configSashWindow, ecID_SCROLLED_WINDOW, wxDefaultPosition, - wxDefaultSize, wxNO_BORDER | wxCLIP_CHILDREN | wxVSCROLL); + wxSize(400, 100), wxNO_BORDER | wxCLIP_CHILDREN | wxVSCROLL); m_splitter = new wxThinSplitterWindow(m_scrolledWindow, ecID_SPLITTER_WINDOW, wxDefaultPosition, - wxDefaultSize, wxSP_3DBORDER | wxCLIP_CHILDREN /* | wxSP_LIVE_UPDATE */); + wxSize(400, 100), wxSP_3DBORDER | wxCLIP_CHILDREN /* | wxSP_LIVE_UPDATE */); m_splitter->SetSashSize(2); m_tree = new ecConfigTreeCtrl(m_splitter, ecID_TREE_CTRL, wxDefaultPosition, - wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER ); + wxSize(200, 100), wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER ); m_valueWindow = new ecValueWindow(m_splitter, ecID_VALUE_WINDOW, wxDefaultPosition, - wxDefaultSize, wxNO_BORDER); + wxSize(200, 100), wxNO_BORDER); m_splitter->SplitVertically(m_tree, m_valueWindow); + m_splitter->SetMinimumPaneSize(100); //m_splitter->AdjustScrollbars(); m_splitter->SetSashPosition(wxGetApp().GetSettings().m_configPaneWidth); m_scrolledWindow->SetTargetWindow(m_tree); @@ -1417,12 +1418,7 @@ void ecMainFrame::OnUpdatePackages(wxUpd void ecMainFrame::OnUpdateRunTests(wxUpdateUIEvent& event) { -#ifdef __WXDEBUG__ event.Enable(wxGetApp().GetConfigToolDoc() != NULL && !wxGetApp().GetConfigToolDoc()->GetInstallTree().IsEmpty() && (wxGetApp().m_pipedProcess == NULL)); -#else - // TODO: Not implemented yet - event.Enable( FALSE ); -#endif } void ecMainFrame::OnUpdateChooseRepository(wxUpdateUIEvent& event) diff --git a/host/tools/configtool/standalone/wxwin/settingsdlg.cpp b/host/tools/configtool/standalone/wxwin/settingsdlg.cpp --- a/host/tools/configtool/standalone/wxwin/settingsdlg.cpp +++ b/host/tools/configtool/standalone/wxwin/settingsdlg.cpp @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/09/11 -// Version: $Id: settingsdlg.cpp,v 1.14 2001/09/03 16:51:51 julians Exp $ +// Version: $Id: settingsdlg.cpp,v 1.16 2002/02/15 17:40:01 julians Exp $ // Purpose: // Description: Implementation file for ecSettingsDialog // Requires: @@ -58,6 +58,7 @@ #include "wx/cshelp.h" #include "wx/valgen.h" #include "wx/fontdlg.h" +#include "wx/mimetype.h" #include "settingsdlg.h" #include "configtool.h" @@ -68,12 +69,7 @@ // but probably we should eventually for consistency and ease of use #define ecUSE_PATHS_PAGE 0 -// Haven't implemented this yet -#ifdef __WXDEBUG__ #define ecUSE_RUN_PAGE 1 -#else -#define ecUSE_RUN_PAGE 0 -#endif /* * Settings dialog @@ -467,6 +463,7 @@ IMPLEMENT_CLASS(ecViewerOptionsDialog, w BEGIN_EVENT_TABLE(ecViewerOptionsDialog, wxPanel) EVT_BUTTON(ecID_VIEWER_DIALOG_BROWSE_HEADER, ecViewerOptionsDialog::OnBrowseForViewer) EVT_BUTTON(ecID_VIEWER_DIALOG_BROWSE_DOC, ecViewerOptionsDialog::OnBrowseForBrowser) + EVT_BUTTON(ecID_VIEWER_DIALOG_ASSOC_INFO, ecViewerOptionsDialog::OnShowAssociatedViewerInfo) EVT_UPDATE_UI(ecID_VIEWER_DIALOG_HEADER_TEXT, ecViewerOptionsDialog::OnUpdateViewerText) EVT_UPDATE_UI(ecID_VIEWER_DIALOG_BROWSE_HEADER, ecViewerOptionsDialog::OnUpdateViewerText) @@ -539,6 +536,69 @@ void ecViewerOptionsDialog::CreateContro item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + item0->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 ); + + wxStaticBox *item9 = new wxStaticBox( parent, -1, _("View documentation using") ); + wxSizer *item8 = new wxStaticBoxSizer( item9, wxVERTICAL ); + + wxRadioButton *item10 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_BUILTIN, _("&Built-in viewer"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + item8->Add( item10, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxSizer *item11 = new wxBoxSizer( wxHORIZONTAL ); + + wxRadioButton *item12 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_ASSOCIATED, _("Associated browser"), wxDefaultPosition, wxDefaultSize, 0 ); + item11->Add( item12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + item11->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 ); + + wxButton *item13 = new wxButton( parent, ecID_VIEWER_DIALOG_ASSOC_INFO, _("&About..."), wxDefaultPosition, wxDefaultSize, 0 ); + item11->Add( item13, 0, wxALIGN_CENTRE|wxALL, 5 ); + + item8->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 ); + + wxSizer *item14 = new wxBoxSizer( wxHORIZONTAL ); + + wxRadioButton *item15 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_THIS, _("This &browser:"), wxDefaultPosition, wxDefaultSize, 0 ); + item14->Add( item15, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); + + item14->Add( 20, 20, 1, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); + + wxButton *item16 = new wxButton( parent, ecID_VIEWER_DIALOG_BROWSE_DOC, _("Br&owse..."), wxDefaultPosition, wxDefaultSize, 0 ); + item14->Add( item16, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); + + item8->Add( item14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 ); + + wxTextCtrl *item17 = new wxTextCtrl( parent, ecID_VIEWER_DIALOG_DOC_TEXT, _(""), wxDefaultPosition, wxSize(80,-1), 0 ); + item8->Add( item17, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + item0->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + +#if 0 + wxSizer *item0 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBox *item2 = new wxStaticBox( parent, -1, _("View header files using") ); + wxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL ); + + wxRadioButton *item3 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_HEADER_ASSOCIATED, _("Associated viewer"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + item1->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxSizer *item4 = new wxBoxSizer( wxHORIZONTAL ); + + wxRadioButton *item5 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_HEADER_THIS, _("This &viewer:"), wxDefaultPosition, wxDefaultSize, 0 ); + item4->Add( item5, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); + + item4->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 ); + + wxButton *item6 = new wxButton( parent, ecID_VIEWER_DIALOG_BROWSE_HEADER, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 ); + item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 ); + + item1->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 0 ); + + wxTextCtrl *item7 = new wxTextCtrl( parent, ecID_VIEWER_DIALOG_HEADER_TEXT, _(""), wxDefaultPosition, wxSize(80,-1), 0 ); + item1->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + // item0->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 ); wxStaticBox *item9 = new wxStaticBox( parent, -1, _("View documentation using") ); @@ -566,6 +626,7 @@ void ecViewerOptionsDialog::CreateContro item8->Add( item15, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); +#endif // Disable this option because we don't yet have a built-in browser #if 0 // !ecUSE_EXPERIMENTAL_CODE @@ -587,6 +648,7 @@ void ecViewerOptionsDialog::CreateContro FindWindow(ecID_VIEWER_DIALOG_DOC_ASSOCIATED)->SetHelpText(_("Select the default browser to display HTML-based help.")); FindWindow(ecID_VIEWER_DIALOG_DOC_THIS)->SetHelpText(_("Select a browser of your choice to display HTML-based help.")); FindWindow(ecID_VIEWER_DIALOG_BROWSE_DOC)->SetHelpText(_("Browses for a browser to be used to display HTML-based help.")); + FindWindow(ecID_VIEWER_DIALOG_ASSOC_INFO)->SetHelpText(_("Shows information about the associated viewer.")); parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); @@ -630,6 +692,55 @@ void ecViewerOptionsDialog::OnBrowseForB } } +void ecViewerOptionsDialog::OnShowAssociatedViewerInfo(wxCommandEvent& event) +{ + wxString msg; + wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(wxT("html")); + if ( !ft ) + { + msg += wxT("It is not possible to determine the associated browser for HTML documents.\n\n"); + } + else + { + msg += wxT("The associated MIME type for HTML is:\n"); + wxString mimeType(wxT("Unknown")); + ft->GetMimeType(& mimeType); + msg += mimeType; + msg += wxT("\n"); + + wxString descr; + if (ft->GetDescription(& descr)) + { + msg += descr; + msg += wxT("\n"); + } + msg += wxT("\n"); + + wxString cmd; + wxString url(wxT("http://example-url.html")); + bool ok = ft->GetOpenCommand(&cmd, + wxFileType::MessageParameters(url, _T(""))); + + if (ok) + { + msg += wxT("The associated command is:\n"); + msg += cmd; + msg += wxT("\n"); + } + msg += wxT("\n"); + } + + msg += wxT("If this MIME type is not defined or looks wrong, please consult your "); + msg += wxT("Configuration Tool documentation for how to set up an association.\n"); +#if defined(__WXGTK__) + msg += wxT("On Unix, this can be done by adding an entry to your ~/.mailcap file."); +#endif + + delete ft; + + wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_INFORMATION|wxOK); +} + /* Path options dialog */ diff --git a/host/tools/configtool/standalone/wxwin/settingsdlg.h b/host/tools/configtool/standalone/wxwin/settingsdlg.h --- a/host/tools/configtool/standalone/wxwin/settingsdlg.h +++ b/host/tools/configtool/standalone/wxwin/settingsdlg.h @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/09/11 -// Version: $Id: settingsdlg.h,v 1.6 2001/04/24 16:34:55 julians Exp $ +// Version: $Id: settingsdlg.h,v 1.7 2002/02/07 18:22:14 julians Exp $ // Purpose: // Description: Header file for ecSettingsDialog // Requires: @@ -139,6 +139,7 @@ public: void OnUpdateBrowserText(wxUpdateUIEvent& event); void OnBrowseForViewer(wxCommandEvent& event); void OnBrowseForBrowser(wxCommandEvent& event); + void OnShowAssociatedViewerInfo(wxCommandEvent& event); DECLARE_EVENT_TABLE() }; @@ -152,6 +153,7 @@ public: #define ecID_VIEWER_DIALOG_DOC_THIS 10014 #define ecID_VIEWER_DIALOG_BROWSE_DOC 10015 #define ecID_VIEWER_DIALOG_DOC_TEXT 10016 +#define ecID_VIEWER_DIALOG_ASSOC_INFO 10017 /* Path options dialog */ diff --git a/host/tools/configtool/standalone/wxwin/setup/configtool.iss b/host/tools/configtool/standalone/wxwin/setup/configtool.iss --- a/host/tools/configtool/standalone/wxwin/setup/configtool.iss +++ b/host/tools/configtool/standalone/wxwin/setup/configtool.iss @@ -4,13 +4,13 @@ [Setup] MinVersion=4.0,4.0 - AppName=eCos Configuration Tool 2.09 + AppName=eCos Configuration Tool 2.11 AppId=eCos Configuration Tool CreateUninstallRegKey=1 UsePreviousAppDir=1 UsePreviousGroup=1 - AppVersion=2.09 - AppVerName=eCos Configuration Tool 2.09 + AppVersion=2.11 + AppVerName=eCos Configuration Tool 2.11 AppCopyright=Copyright © Red Hat Inc., 2001-2002 BackColor=$FF0000 BackColor2=$000000 @@ -29,7 +29,7 @@ AlwaysCreateUninstallIcon=1 Uninstallable=1 DefaultDirName=c:\Program Files\Red Hat\eCos Configuration Tool - DefaultGroupName=Red Hat eCos Configuration Tool 2.09 + DefaultGroupName=Red Hat eCos Configuration Tool 2.11 LicenseFile=v:\deliver\configtool\license.txt InfoBeforeFile=v:\deliver\configtool\readme.txt MessagesFile=compiler:default.isl @@ -213,7 +213,7 @@ ; DO NOT DELETE THEM or you may be unable to reload the script ;[ScriptSetup] -;VerNum=2.09 +;VerNum=2.11 ;InnoVer=1.3 ;AddVerTo=AppVerName ;SetupFilename=setup.exe diff --git a/host/tools/configtool/standalone/wxwin/setup/makesetup.sh b/host/tools/configtool/standalone/wxwin/setup/makesetup.sh --- a/host/tools/configtool/standalone/wxwin/setup/makesetup.sh +++ b/host/tools/configtool/standalone/wxwin/setup/makesetup.sh @@ -7,7 +7,7 @@ CONFIGTOOLDIR=$ECOSDIR/ecc/host/tools/co SRC=$CONFIGTOOLDIR BINARYSRC=/v/ConfigToolWX/ANSIRelease DEST=/v/deliver -LOCALARCHIVEDIR=//sandpiper/ecc-share/releng/eCosTools/eCosConfigurationTool +LOCALARCHIVEDIR=//home0/project/ecc-share/releng/eCosTools/eCosConfigurationTool INNOCOMPILER="/c/Program Files/Inno Setup 1.3/compil32.exe" INNO=1 INNOONLY=0 diff --git a/host/tools/configtool/standalone/wxwin/splittree.cpp b/host/tools/configtool/standalone/wxwin/splittree.cpp --- a/host/tools/configtool/standalone/wxwin/splittree.cpp +++ b/host/tools/configtool/standalone/wxwin/splittree.cpp @@ -6,7 +6,7 @@ // Author: Julian Smart // Modified by: // Created: 8/7/2000 -// RCS-ID: $Id: splittree.cpp,v 1.7 2001/06/11 14:49:49 julians Exp $ +// RCS-ID: $Id: splittree.cpp,v 1.9 2002/02/28 18:30:35 julians Exp $ // Copyright: (c) Julian Smart // // This program is part of the eCos host tools. @@ -77,7 +77,11 @@ END_EVENT_TABLE() wxRemotelyScrolledTreeCtrl::wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt, const wxSize& sz, long style): -wxTreeCtrl(parent, id, pt, sz, style) + wxTreeCtrl(parent, id, pt, sz, style +#if wxVERSON_NUMBER > 2301 + & ~wxTR_ROW_LINES +#endif + ) { m_companionWindow = NULL; } @@ -481,6 +485,10 @@ IMPLEMENT_CLASS(wxThinSplitterWindow, wx BEGIN_EVENT_TABLE(wxThinSplitterWindow, wxSplitterWindow) EVT_SIZE(wxThinSplitterWindow::OnSize) +// Not in older versions of wxWindows, unfortunately +#if 0 +EVT_SPLITTER_DOUBLECLICKED(-1, wxThinSplitterWindow::OnDoubleClickSash) +#endif END_EVENT_TABLE() wxThinSplitterWindow::wxThinSplitterWindow(wxWindow* parent, wxWindowID id, diff --git a/host/tools/configtool/standalone/wxwin/symbols.h b/host/tools/configtool/standalone/wxwin/symbols.h --- a/host/tools/configtool/standalone/wxwin/symbols.h +++ b/host/tools/configtool/standalone/wxwin/symbols.h @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2001/05/14 -// Version: $Id: symbols.h,v 1.13 2001/12/03 16:05:40 julians Exp $ +// Version: $Id: symbols.h,v 1.15 2002/02/13 13:58:18 julians Exp $ // Purpose: // Description: Some important symbols, such as the version // Requires: @@ -43,7 +43,7 @@ // //=========================================================================== -#define ecCONFIGURATION_TOOL_VERSION 2.09 +#define ecCONFIGURATION_TOOL_VERSION 2.11 // Use /ecos-x notation for drive specification #define ecUSE_ECOS_X_NOTATION 1 diff --git a/packages/ChangeLog b/packages/ChangeLog --- a/packages/ChangeLog +++ b/packages/ChangeLog @@ -1,3 +1,103 @@ +2002-05-08 Jesper Skov + + * ecos.db: Removed special SH2 SCIF driver. The changes have been + merged into the SH3 (now generic SH) driver. +2002-04-24 Yoshinori Sato + + * ecos.db: Add H8/300 serial driver. + +2002-04-25 Bob Koninckx + + * ecos.db: Add ports to Wuerz Elektronik and Axiom Manufacturing + MPC555 based eval boards. + +2002-04-24 Yoshinori Sato + + * ecos.db: Add H8/300 port. + + +2002-04-15 Nick Garnett + + * ecos.db: Changed integrator target to integrator_arm7. Tidied up + descriptions a little too. + +2002-04-09 Jesper Skov + + * pkgconf/rules.mak: Allow building of .cpp files. Not supported + by makefile generator yet, though. + + * ecos.db: Added SDL and SMPEG packages. + +2002-03-26 Jesper Skov + + * ecos.db: Added microwindows package. + +2002-03-18 Hugo Tyson + + * ecos.db: Add CYGPKG_HAL_SPARC_ERC32 and target sparc_erc32 - + also contributed by Jiri Gaisler . + +2002-03-15 Hugo Tyson + + * ecos.db: Add CYGPKG_HAL_SPARC, CYGPKG_HAL_SPARC_LEON, target + sparc_leon contributed by Jiri Gaisler . See + for information about the TSIM simulator + and Leon project per se. + +2002-03-10 Gary Thomas + + * ecos.db: Add keyboard driver. + +2002-03-09 Gary Thomas + + * ecos.db: Add touch screen driver for Aglient AAED-2000. + +2002-03-08 Nick Garnett + + * ecos.db: Fix Integrator aliases. + +2002-03-06 Nick Garnett + + * ecos.db: Added new target: integrator_arm9 for ARM9 based + integrator boards. + Renamed CYGPKG_DEVS_FLASH_INTEGRATOR to + CYGPKG_DEVS_FLASH_ARM_INTEGRATOR for consistency with other + packages. + +2002-02-18 Jesper Skov + + * ecos.db: Added SH2 etherc package. + +2002-02-08 Jonathan Larmour + + * pkgconf/rules.mak: Fix the below fix which had too _few_ backslashes! + +2002-02-04 Gary Thomas + + * ecos.db: Add [contributed] port to CerfCube & CerfPDA. + +2002-02-02 Jonathan Larmour + + * pkgconf/rules.mak: Fix bug with too many backslashes in sed. + +2002-01-29 Nick Garnett + + * ecos.db: Added CYGPKG_IO_SERIAL_ARM_IQ80321. + +2002-01-28 Gary Thomas + + * ecos.db: Split network support into generic and stack + implementations. Move BSD based stack to one implementation. + + Add FreeBSD based (new) stack as another. +2002-01-21 Jonathan Larmour + + * ecos.db: Add JFFS2 package. + +2002-01-21 Mark Salter + + * ecos.db: Add Intel 82544 ethernet for iq80321. + 2002-01-08 Jonathan Larmour * ecos.db: Add synthetic flash driver package, and add it to the @@ -11,6 +111,22 @@ 2001-12-20 Koichi Nagashima + + * ecos.db: Add XScale "Verde" (IOP80320) and IQ80321 packages. + +2001-12-06 Nick Garnett + + * ecos.db: Change names on i82544 package so they don't clash with + the i82559 package. + +2001-11-27 Nick Garnett + + * ecos.db: Added Intel i82543/82544 Gigabit ethernet card packages + and a pc_giga target. This latter is a temporary measure until we + work out how best to support targets that can have a variety of + different hardware configurations. + 2001-11-22 Jesper Skov * pkgconf/rules.mak: Added HOST_CC definition. This really belongs @@ -26,6 +142,14 @@ 2001-11-14 Jesper Skov + + * ecos.db: Added generic CS8900A package to AAED2000 template. + +2001-11-06 Mark Salter + + * ecos.db: Add malta_mips64_5kc target. + 2001-11-02 Jesper Skov * ecos.db: Added CS8900A package. @@ -35,6 +159,10 @@ 2001-10-30 Jonathan Larmour + + * ecos.db: Added AAED2000 packages. + 2001-10-19 Lars Lindqvist 2001-10-19 Jonathan Larmour @@ -44,11 +172,42 @@ 2001-10-12 Jonathan Larmour + + * ecos.db: Remove separate CYGPKG_DEVS_FLASH_STRATA_EDB7XXX package, + and instead use a consolidated CYGPKG_DEVS_FLASH_EDB7XXX package. + +2001-09-27 Hugo Tyson + + * ecos.db: Add CYGPKG_DEVS_ETH_INTEL_I21143 and + CYGPKG_DEVS_ETH_MIPS_VRC4375, and add them to the target vrc4375. + +2001-09-26 Gary Thomas + + * ecos.db: Add FLASH support for Fujitsu FR-V 400. + +2001-09-24 Jesper Skov + + * ecos.db: Added DNS package. + +2001-09-25 Gary Thomas + + * ecos.db: Add support for new Cogent [Cirrus Logic] EDB7312 platform. + +2001-09-20 Gary Thomas + + * ecos.db: Adding network driver for Fujitsu FR-V 400. + 2001-09-18 Jonathan Larmour * ecos.db: Add i386 PC wallclock driver package, and include it in the PC target. +2001-09-17 Gary Thomas + + * ecos.db: Add support for Fujitsu FRV family, including initial + target of frv400 (MB93091 eval board). + 2001-09-13 Jesper Skov * ecos.db: Added flash support to EDK7708. @@ -58,11 +217,26 @@ 2001-09-10 Nick Garnett + + * ecos.db: Added VRC4375 and VRC437X packages, added vrc4375 + target and reorganized vrc4373 target to match. + +2001-08-17 Jesper Skov + [from branch] + * ecos.db: Added flash package for excalibur. + Added excalibur platform. + 2001-07-31 Bart Veer * pkgconf/rules.mak: Fix header file dependencies for testcases. +2001-07-30 Gary Thomas + + * ecos.db: Add Samsung SNDS-100 evaulation board. Mostly based + on contribution from Grant Edwards + 2001-07-30 Jesper Skov * ecos.db: Added Dreamcast platform HAL, contributed by Takeshi @@ -73,6 +247,11 @@ 2001-07-27 Jonathan Larmour +2001-07-27 David Howells + + * ecos.db: Added ASB2305 platform, and it's serial and flash + support. + 2001-07-24 Gary Thomas * ecos.db: Add Atmel AT91/EB40 serial support. @@ -92,10 +271,17 @@ 2001-07-16 Julian Smart + + * ecos.db: Added se7751. + Added ether package. + 2001-07-06 Jesper Skov * ecos.db: Added wallclock driver for DS12887. Moved SH3 wallclock driver into SH directory. + Added wallclock and watchdog drivers to hs7729pci. + 2001-06-28 Jonathan Larmour * ecos.db: Clarify edb7xxx description. @@ -118,10 +304,18 @@ 2001-06-21 Jonathan Larmour + + * ecos.db: Added serial packages for SE77x9. + 2001-06-13 Jesper Skov * ecos.db: Added DP83902A driver. +2001-06-12 Jesper Skov + + * ecos.db: Added SE77x9 support packages. + 2001-06-08 Jonathan Larmour * ecos.db: PC target uses generic 16x5x serial driver now. @@ -147,11 +341,31 @@ 2001-05-31 Jonathan Larmour + + * ecos.db: Added VIA Rhine ethernet driver. Use on HS7729PCI. + +2001-05-30 Jesper Skov + + * ecos.db: Added PCI package to HS7729PCI. + +2001-05-28 Jesper Skov + + * ecos.db: Added flash package to HS7729PCI target. + +2001-05-25 Jesper Skov + + * ecos.db: Added HS7729PCI target. + 2001-05-23 Jesper Skov * ecos.db: Ocelot now uses generic AMD flash driver. Removed AMD29F040B driver. +2001-05-01 Mark Salter + + * ecos.db: Add calmrisc16 + 2001-04-30 Jonathan Larmour * ecos.db: Add generic 16x5x driver to iq80310 target. @@ -183,6 +397,15 @@ 2001-03-21 Jesper Skov + + * ecos.db: Added Malta board. + +2001-03-16 Mark Salter + + * ecos.db: Add calmrisc32. 2001-03-16 Jesper Skov @@ -344,6 +567,10 @@ 2000-08-24 Gary Thomas + + * ecos.db: Don't use set_value for asb + 2000-08-18 Nick Garnett * ecos.db: Added CYGPKG_FS_RAM package. @@ -367,6 +594,10 @@ 2000-08-14 Gary Thomas + + * ecos.db: Added asb packages. + 2000-08-10 Hugo Tyson * ecos.db (CYGPKG_IO_ETH_DRIVERS): Since this package is now @@ -1814,27 +2045,36 @@ 1998-07-23 Bart Veer + from Katholieke Universiteit Leuven. Includes FLASH, serial and wallclock + drivers. +* Added H8/300 port contributed by Yoshinori Sato + Initially for Akizuki H8/3068 board with ethernet and serial driver support, + and H8/300H simulator. +* Added RedBoot support for remote file I/O operations using the GDB remote + protocol. +* Added SPARC_LEON port contributed by Jiri Gaisler - + see for information about the TSIM simulator + and Leon project per se. +* Added port to CerfCube and CerfPDA, contributed by the manufacturer, + Intrinsyc. Includes ethernet drivers. +* Added alpha of JFFS2 journalling flash file system v2 support. * Add synthetic target synthetic flash driver, contributed by Andrew Lunn. * CqREEK SH7750 FLASH driver added, contributed by Koichi Nagashima * EDB7xxx ethernet driver rewritten to be a generic Cirrus Logic CS8900A @@ -11,6 +74,8 @@ * Flash driver added for the SH EDK7708 platform. * Added rudimentary ELF loader, including support for dynamic objects under services/loader. +* DNS lookup support added. Contributed by Andrew Lunn +* Cogent [Cirrus Logic] EDB7312 platform added. * Dallas wallclock driver implemented for x86 PC. * AMD PCNet ethernet driver added. * Generic SMP support added. @@ -281,6 +346,10 @@ o SPARClite Where supported by the targetted platform, it is now possible to use Multiple Vector Trapping (MVT). + o ARM + The ARM Multi-ICE JTAG debugging interface is now supported on the + relevant platforms. eCos has also been extended to provide thread + debugging when debugging via Multi-ICE. * CygMon o Integration of CygMon ROM monitor into eCos by porting it on top diff --git a/packages/compat/posix/current/ChangeLog b/packages/compat/posix/current/ChangeLog --- a/packages/compat/posix/current/ChangeLog +++ b/packages/compat/posix/current/ChangeLog @@ -1,3 +1,67 @@ +2002-04-09 Jonathan Larmour + + * src/signal.cxx (cyg_deliver_signals): Don't assert here for an + unhandled signal (unless there's no _exit). Trace it though. + +2002-04-08 Jonathan Larmour + + * src/sem.cxx (sem_getvalue): return 0, and put value in *sval. + +2002-04-03 Jonathan Larmour + + * cdl/posix.cdl: Allow clocks to be configured again. + +2002-03-05 Jesper Skov + + * src/pprivate.h: Correct conditional declaration of timespec + functions. + + * src/sched.cxx (sched_rr_get_interval): Return ENOSYS when + CYGPKG_POSIX_CLOCKS disabled. + +2002-02-27 Robin Farine + + * src/pthread.cxx (pthread_exit): While running thread static + storage destructors, set the thread's value associated with the + current key to NULL before invoking the destructor. + +2002-02-14 Nick Garnett + + * doc/posix.sgml: Generally fixed up and reformatted to make this + file readable by mere humans. Some omissions and outdated + information fixed, but not substantially changed from the + original. + + * cdl/posix.cdl: Changed some definitions and dependencies so that + disabling the timers does not disable threads too. This was + largely a consequence of trying to document the behaviour of these + options. + +2002-02-14 Jonathan Larmour + + * doc/posix.sgml: New file, originally accompanied by this ChangeLog: + 2001-12-22 Jonathan Larmour + + * ecos-elix.sgml: Do a minor cleanup of the function prototype + layouts. + Should be done better than this, but this is at least not + _completely_ wrong any more. + Also several more layout problems due to incorrect tags fixed. + + 2001-12-07 Jonathan Larmour + + * ecos-elix.sgml: Add getcwd as supported now. + + 2001-12-06 Jonathan Larmour + + * ecos-elix.sgml: Created from old framemaker version. + +2002-01-21 Jonathan Larmour + + * src/sched.cxx (sched_get_priority_min): Don't allow idle thread + priority as a valid priority. + Case #106952. + 2001-12-11 Nick Garnett * tests/mqueue2.c (cyg_user_start): Added CYG_TEST_INIT() to @@ -854,26 +918,35 @@ 2000-03-24 Nick Garnett +eCos EL/IX compatibility layer + + +POSIX Standard Support + + + + + eCos contains support for the POSIX Specification (ISO/IEC + 9945-1)[POSIX]. This support follows EL/IX level 1 + in the functionality supplied [ELIX]. + + + POSIX support is divided between the POSIX and the FILEIO + packages. The POSIX package provides support for threads, + signals, synchronization, timers and message queues. The FILEIO + package provides support for file and device I/O. The two + packages may be used together or separately, depending on + configuration. + + + This document takes a functional approach to the POSIX + library. Support for a function implies that the data types and + definitions necessary to support that function, and the objects + it manipulates, are also defined. Any exceptions to this are + noted, and unless otherwise noted, implemented functions behave + as specified in the POSIX standard. + + + This document only covers the differences between the eCos + implementation and the standard; it does not provide complete + documentation. For full information, see the POSIX standard + [POSIX]. Online, the Open Group Single Unix + Specification [SUS2] provides complete documentation + of a superset of POSIX. If you have access to a Unix system with + POSIX compatibility, then the manual pages for this will be of + use. There are also a number of books available. + [Lewine] covers the process, signal, file and I/O + functions, while [Lewis1], [Lewis2], + [Nichols] and [Norton] cover Pthreads and + related topics (see Bibliography, xref). However, many of these + books are oriented toward using POSIX in non-embedded systems, + so care should be taken in applying them to programming under + eCos. + + + The remainder of this chapter broadly follows the structure + of the POSIX Specification. References to the appropriate + section of the Standard are included. + + + Omitted functions marked with “// TBA” + are potential candidates for later implementation. + + + + + + +Process Primitives [POSIX Section 3] + + + + +Functions Implemented + + +int kill(pid_t pid, int sig); +int pthread_kill(pthread_t thread, int sig); +int sigaction(int sig, const struct sigaction *act, + struct sigaction *oact); +int sigqueue(pid_t pid, int sig, const union sigval value); +int sigprocmask(int how, const sigset_t *set, + sigset_t *oset); +int pthread_sigmask(int how, const sigset_t *set, + sigset_t *oset); +int sigpending(sigset_t *set); +int sigsuspend(const sigset_t *set); +int sigwait(const sigset_t *set, int *sig); +int sigwaitinfo(const sigset_t *set, siginfo_t *info); +int sigtimedwait(const sigset_t *set, siginfo_t *info, + const struct timespec *timeout); +int sigemptyset(sigset_t *set); +int sigfillset(sigset_t *set); +int sigaddset(sigset_t *set, int signo); +int sigdelset(sigset_t *set, int signo); +int sigismember(const sigset_t *set, int signo); +unsigned int alarm( unsigned int seconds ); +int pause( void ); +unsigned int sleep( unsigned int seconds ); + + + + + + +Functions Omitted + + +pid_t fork(void); +int execl( const char *path, const char *arg, ... ); +int execv( const char *path, char *const argv[] ); +int execle( const char *path, const char *arg, ... ); +int execve( const char *path, char *const argv[], + char *const envp[] ); +int execlp( const char *path, const char *arg, ... ); +int execvp( const char *path, char *const argv[] ); +int pthread_atfork( void(*prepare)(void), + void (*parent)(void), + void (*child)() ); +pid_t wait( int *stat_loc ); +pid_t waitpid( pid_t pid, int *stat_loc, + int options ); +void _exit( int status ); + + + + + + +Notes + + + + Signal handling may be enabled or disabled with the + CYGPKG_POSIX_SIGNALS option. Since signals are used + by other POSIX components, such as timers, disabling signals will + disable those components too. + + + + + + kill() and + sigqueue() may only take a + pid argument of zero, + which maps to the current process. + + + + + + The SIGEV_THREAD notification type is + not currently implemented. + + + + + + Job Control and Memory Protection signals are + not supported. + + + + + + An extra implementation defined + si_code value, + SI_EXCEPT, is defined to + distinguish hardware generated exceptions from + others. + + + + + + Extra signals are defined: + _SIGTRAP_,_SIGIOT_, + _SIGEMT_, and _SIGSYS_. These are + largely to maintain compatibility with the signal numbers used by + GDB. + + + + + + Signal delivery may currently occur at unexpected places in some + API functions. Using longjmp() to transfer + control out of a signal handler may result in the interrupted + function not being able to complete properly. This may result in + later function calls failing or deadlocking. + + + + + + + + + + + + +Process Environment [POSIX Section 4] + + + + +Functions Implemented + + +int uname( struct utsname *name ); +time_t time( time_t *tloc ); +char *getenv( const char *name ); +int isatty( int fd ); +long sysconf( int name ); + + + + + + +Functions Omitted + +pid_t getpid( void ); +pid_t getppid( void ); +uid_t getuid( void ); +uid_t geteuid( void ); +gid_t getgid( void ); +gid_t getegid( void ); +int setuid( uid_t uid ); +int setgid( gid_t gid ); +int getgroups( int gidsetsize, gid_t grouplist[] ); +char *getlogin( void ); +int getlogin_r( char *name, size_t namesize ); +pid_t getpgrp( void ); +pid_t setsid( void ); +int setpgid( pid_t pid, pid_t pgid ); +char *ctermid( char *s); +char *ttyname( int fd ); // TBA +int ttyname_r( int fd, char *name, size_t namesize); // TBA +clock_t times( struct tms *buffer ); // TBA + + + + + + +Notes + + + The fields of the utsname + structure are initialized as follows: + + sysname “eCos” + nodename “” (gethostname() is currently not available) + + release Major version number of the kernel + version Minor version number of the kernel + machine “” (Requires some config tool changes) + + + + The sizes of these strings are defined by + CYG_POSIX_UTSNAME_LENGTH and + CYG_POSIX_UTSNAME_NODENAME_LENGTH. The + latter defaults to the value of the former, but may also + be set independently to accommodate a longer node name. + + + + + + The time() function is currently + implemented in the C library. + + + + + A set of environment strings may be defined at configuration + time with the CYGDAT_LIBC_DEFAULT_ENVIRONMENT + option. The application may also define an environment by direct + assignment to the environ + variable. + + + + + + At present isatty() assumes that + any character device is a tty and that all other devices are not + ttys. Since the only kind of device that eCos currently supports + is serial character devices, this is an adequate + distinction. + + + + + + All system variables supported by sysconf will yield a + value. However, those that are irrelevant to eCos will + either return the default minimum defined in + <limits.h>, + or zero. + + + + + + + + + + + +Files and Directories [POSIX Section 5] + + + + +Functions Implemented + + +DIR *opendir( const char *dirname ); +struct dirent *readdir( DIR *dirp ); +int readdir_r( DIR *dirp, struct dirent *entry, + struct dirent **result ); +void rewinddir( DIR *dirp ); +int closedir( DIR *dirp ); +int chdir( const char *path ); +char *getcwd( char *buf, size_t size ); +int open( const char * path , int oflag , ... ); +int creat( const char * path, mode_t mode ); +int link( const char *existing, const char *new ); +int mkdir( const char *path, mode_t mode ); +int unlink( const char *path ); +int rmdir( const char *path ); +int rename( const char *old, const char *new ); +int stat( const char *path, struct stat *buf ); +int fstat( int fd, struct stat *buf ); +int access( const char *path, int amode ); +long pathconf(const char *path, int name); +long fpathconf(int fd, int name); + + + + + + +Functions Omitted + + +mode_t umask( mode_t cmask ); +int mkfifo( const char *path, mode_t mode ); +int chmod( const char *path, mode_t mode ); // TBA +int fchmod( int fd, mode_t mode ); // TBA +int chown( const char *path, uid_t owner, gid_t group ); +int utime( const char *path, const struct utimbuf *times ); // TBA +int ftruncate( int fd, off_t length ); // TBA + + + + + + +Notes + + + + + If a call to open() or creat() supplies + the third _mode_ parameter, it will + currently be ignored. + + + + + Most of the functionality of these functions depends on + the underlying filesystem. + + + + + Currently access() only checks the + F_OK mode explicitly, the others are + all assumed to be true by default. + + + + + The maximum number of open files allowed is supplied by + the CYGNUM_FILEIO_NFILE option. The maximum number + of file descriptors is supplied by the CYGNUM_FILEIO_NFD + option. + + + + + + + + + + +Input and Output [POSIX Section 6] + + + + +Functions Implemented + + +int dup( int fd ); +int dup2( int fd, int fd2 ); +int close(int fd); +ssize_t read(int fd, void *buf, size_t nbyte); +ssize_t write(int fd, const void *buf, size_t nbyte); +int fcntl( int fd, int cmd, ... ); +off_t lseek(int fd, off_t offset, int whence); +int fsync( int fd ); +int fdatasync( int fd ); + + + + + +Functions Omitted + +int pipe( int fildes[2] ); +int aio_read( struct aiocb *aiocbp ); // TBA +int aio_write( struct aiocb *aiocbp ); // TBA +int lio_listio( int mode, struct aiocb *const list[], + int nent, struct sigevent *sig); // TBA +int aio_error( struct aiocb *aiocbp ); // TBA +int aio_return( struct aiocb *aiocbp ); // TBA +int aio_cancel( int fd, struct aiocb *aiocbp ); // TBA +int aio_suspend( const struct aiocb *const list[], + int nent, const struct timespec *timeout ); // TBA +int aio_fsync( int op, struct aiocb *aiocbp ); +// TBA + + + + + + +Notes + + + + Only the F_DUPFD command + of fcntl() is currently implemented. + + + + + Most of the functionality of these functions depends on + the underlying filesystem. + + + + + + + + + + +Device and Class Specific Functions [POSIX Section 7] + + + + +Functions Implemented + +speed_t cfgetospeed( const struct termios *termios_p ); +int cfsetospeed( struct termios *termios_p, speed_t speed ); +speed_t cfgetispeed( const struct termios *termios_p ); +int cfsetispeed( struct termios *termios_p, speed_t speed ); +int tcgetattr( int fd, struct termios *termios_p ); +int tcsetattr( int fd, int optional_actions, + const struct termios *termios_p ); +int tcsendbreak( int fd, int duration ); +int tcdrain( int fd ); +int tcflush( int fd, int queue_selector ); +int tcsendbreak( int fd, int action ); + + + + + + +Functions Omitted + + +pid_t tcgetpgrp( int fd ); +int tcsetpgrp( int fd, pid_t pgrp ); + + + + + +Notes + + + + Only the functionality relevant to basic serial device + control is implemented. Only very limited support for + canonical input is provided, and then only via the + “tty” devices, not the “serial” + devices. None of the functionality relevant to job + control, controlling terminals and sessions is + implemented. + + + + + Only MIN = 0 and + TIME = 0 functionality is + provided. + + + + + Hardware flow control is supported if the underlying + device driver and serial port support it. + + + + + Support for break, framing and parity errors depends on + the functionality of the hardware and device driver. + + + + + + + + + + +C Language Services [POSIX Section 8] + + + + +Functions Implemented + +char *setlocale( int category, const char *locale ); +int fileno( FILE *stream ); +FILE *fdopen( int fd, const char *type ); +int getc_unlocked( FILE *stream); +int getchar_unlocked( void ); +int putc_unlocked( FILE *stream ); +int putchar_unlocked( void ); +char *strtok_r( char *s, const char *sep, + char **lasts ); +char *asctime_r( const struct tm *tm, char *buf ); +char *ctime_r( const time_t *clock, char *buf ); +struct tm *gmtime_r( const time_t *clock, + struct tm *result ); +struct tm *localtime_r( const time_t *clock, + struct tm *result ); +int rand_r( unsigned int *seed ); + + + + + + +Functions Omitted + +void flockfile( FILE *file ); +int ftrylockfile( FILE *file ); +void funlockfile( FILE *file ); +int sigsetjmp( sigjmp_buf env, int savemask ); // TBA +void siglongjmp( sigjmp_buf env, int val ); // TBA +void tzset(void); // TBA + + + + + + +Notes + + + + setlocale() is implemented in the C + library Internationalization package. + + + + + Functions fileno() and + fdopen() are implemented in the C + library STDIO package. + + + + + Functions getc_unlocked(), + getchar_unlocked(), + putc_unlocked() and + putchar_unlocked() are defined + but are currently identical to their non-unlocked + equivalents. + + + + + strtok_r(), asctime_r(), + ctime_r(), gmtime_r(), + localtime_r() and + rand_r() are all currently in + the C library, alongside their non-reentrant versions. + + + + + + + + + + +System Databases [POSIX Section 9] + + + + +Functions Implemented + + +<none> + + + + + + + +Functions Omitted + + +struct group *getgrgid( gid_t gid ); +int getgrgid( gid_t gid, struct group *grp, char *buffer, + size_t bufsize, struct group **result ); +struct group *getgrname( const char *name ); +int getgrname_r( const char *name, struct group *grp, + char *buffer, size_t bufsize, struct group **result ); +struct passwd *getpwuid( uid_t uid ); +int getpwuid_r( uid_t uid, struct passwd *pwd, + char *buffer, size_t bufsize, struct passwd **result ); +struct passwd *getpwnam( const char *name ); +int getpwnam_r( const char *name, struct passwd *pwd, + char *buffer, size_t bufsize, struct passwd **result ); + + + + + + +Notes + + + + None of the functions in this section are implemented. + + + + + + + + + + +Data Interchange Format [POSIX Section 10] + + +This section details tar and +cpio formats. Neither of these is supported by +eCos. + + + + + + + +Synchronization [POSIX Section 11] + + + + + +Functions Implemented + + +int sem_init(sem_t *sem, int pshared, unsigned int value); +int sem_destroy(sem_t *sem); +int sem_wait(sem_t *sem); +int sem_trywait(sem_t *sem); +int sem_post(sem_t *sem); +int sem_getvalue(sem_t *sem, int *sval); +int pthread_mutexattr_init( pthread_mutexattr_t *attr); +int pthread_mutexattr_destroy( pthread_mutexattr_t *attr); +int pthread_mutex_init(pthread_mutex_t *mutex, + const pthread_mutexattr_t *mutex_attr); +int pthread_mutex_destroy(pthread_mutex_t *mutex); +int pthread_mutex_lock(pthread_mutex_t *mutex); +int pthread_mutex_trylock(pthread_mutex_t *mutex); +int pthread_mutex_unlock(pthread_mutex_t *mutex); +int pthread_condattr_init(pthread_condattr_t *attr); +int pthread_condattr_destroy(pthread_condattr_t *attr); +int pthread_cond_init(pthread_cond_t *cond, + const pthread_condattr_t *attr); +int pthread_cond_destroy(pthread_cond_t *cond); +int pthread_cond_signal(pthread_cond_t *cond); +int pthread_cond_broadcast(pthread_cond_t *cond); +int pthread_cond_wait(pthread_cond_t *cond, + pthread_mutex_t *mutex); +int pthread_cond_timedwait(pthread_cond_t *cond, + pthread_mutex_t *mutex, + const struct timespec *abstime); + + + + + + +Functions Omitted + + +sem_t *sem_open(const char *name, int oflag, ...); // TBA +int sem_close(sem_t *sem); // TBA +int sem_unlink(const char *name); // TBA +int pthread_mutexattr_getpshared( const pthread_mutexattr_t *attr, + int *pshared ); +int pthread_mutexattr_setpshared( const pthread_mutexattr_t *attr, + int pshared ); +int pthread_condattr_getpshared( const pthread_condattr_t *attr, + int *pshared); +int pthread_condattr_setpshared( const pthread_condattr_t *attr, + int pshared); + + + + + +Notes + + + + The presence of semaphores is controlled by the + CYGPKG_POSIX_SEMAPHORES option. This in turn + causes the _POSIX_SEMAPHORES feature test + macro to be defined and the semaphore API to be made + available. + + + + + + The pshared argument to + sem_init() is not implemented, + its value is ignored. + + + + + + Functions sem_open(), + sem_close() and + sem_unlink() are present but + always return an error (ENOSYS). + + + + + + The exact priority inversion protocols supported may be + controlled with the + _POSIX_THREAD_PRIO_INHERIT and + _POSIX_THREAD_PRIO_PROTECT + configuration options. + + + + + + {_POSIX_THREAD_PROCESS_SHARED} is + not defined, so the + process-shared mutex + and condition variable attributes are not supported, and + neither are the functions + pthread_mutexattr_getpshared(), + pthread_mutexattr_setpshared(), + pthread_condattr_getpshared() and + pthread_condattr_setpshared(). + + + + + + Condition variables do not become bound to a particular + mutex when + pthread_cond_wait() is + called. Hence different threads may wait on a condition + variable with different mutexes. This is at variance with + the standard, which requires a condition variable to + become (dynamically) bound by the first waiter, and + unbound when the last finishes. However, this difference + is largely benign, and the cost of policing this feature + is non-trivial. + + + + + + + + + + +Memory Management [POSIX Section 12] + + + + +Functions Implemented + + +<none> + + + + + + +Functions Omitted + + +int mlockall( int flags ); +int munlockall( void ); +int mlock( const void *addr, size_t len ); +int munlock( const void *addr, size_t len ); +void mmap( void *addr, size_t len, int prot, int flags, + int fd, off_t off ); +int munmap( void *addr, size_t len ); +int mprotect( const void *addr, size_t len, int prot ); +int msync( void *addr, size_t len, int flags ); +int shm_open( const char *name, int oflag, mode_t mode ); +int shm_unlink( const char *name ); + + + + + + +Notes + +None of these functions are currently provided. Some may +be implemented in a restricted form in the future. + + + + + + + + + +Execution Scheduling [POSIX Section 13] + + + + +Functions Implemented + + +int sched_yield(void); +int sched_get_priority_max(int policy); +int sched_get_priority_min(int policy); +int sched_rr_get_interval(pid_t pid, struct timespec *t); +int pthread_attr_setscope(pthread_attr_t *attr, int scope); +int pthread_attr_getscope(const pthread_attr_t *attr, int *scope); +int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit); +int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit); +int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy); +int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy); +int pthread_attr_setschedparam( pthread_attr_t *attr, const struct sched_param *param); +int pthread_attr_getschedparam( const pthread_attr_t *attr, + struct sched_param *param); +int pthread_setschedparam(pthread_t thread, int policy, + const struct sched_param *param); +int pthread_getschedparam(pthread_t thread, int *policy, + struct sched_param *param); +int pthread_mutexattr_setprotocol( pthread_mutexattr_t *attr, + int protocol); +int pthread_mutexattr_getprotocol( pthread_mutexattr_t *attr, + int *protocol); +int pthread_mutexattr_setprioceiling( pthread_mutexattr_t *attr, + int prioceiling); +int pthread_mutexattr_getprioceiling( pthread_mutexattr_t *attr, + int *prioceiling); +int pthread_mutex_setprioceiling( pthread_mutex_t *mutex, + int prioceiling, + int *old_ceiling); +int pthread_mutex_getprioceiling( pthread_mutex_t *mutex, + int *prioceiling); + + + + + + +Functions Omitted + + +int sched_setparam(pid_t pid, const struct sched_param *param); +int sched_getparam(pid_t pid, struct sched_param *param); +int sched_setscheduler(pid_t pid, int policy, + const struct sched_param *param); +int sched_getscheduler(pid_t pid); + + + + + + +Notes + + + + The functions sched_setparam(), + sched_getparam(), + sched_setscheduler() and + sched_getscheduler() are present + but always return an error. + + + + + The scheduler policy SCHED_OTHER is + equivalent to SCHED_RR. + + + + + Only PTHREAD_SCOPE_SYSTEM + is supported as a + contentionscope + attribute. + + + + + The default thread scheduling attributes are: + + contentionscope PTHREAD_SCOPE_SYSTEM + inheritsched PTHREAD_INHERIT_SCHED + schedpolicy SCHED_OTHER + schedparam.sched 0 + + + + + + Mutex priority inversion protection is controlled by a + number of kernel configuration options. + If CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_INHERIT + is defined then + {_POSIX_THREAD_PRIO_INHERIT} + will be defined and PTHREAD_PRIO_INHERIT may + be set as the protocol in a + pthread_mutexattr_t + object. + If CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING + is defined then + {_POSIX_THREAD_PRIO_PROTECT} + will be defined and PTHREAD_PRIO_PROTECT may + be set as the protocol in a + pthread_mutexattr_t object. + + + + + The default attribute values set by + pthread_mutexattr_init() + is to set the protocol attribute to + PTHREAD_PRIO_NONE and the prioceiling + attribute to zero. + + + + + + + + + + + +Clocks and Timers [POSIX Section 14] + + + + +Functions Implemented + + +int clock_settime( clockid_t clock_id, +const struct timespec *tp); +int clock_gettime( clockid_t clock_id, struct timespec *tp); +int clock_getres( clockid_t clock_id, struct timespec *tp); +int timer_create( clockid_t clock_id, struct sigevent *evp, + timer_t *timer_id); +int timer_delete( timer_t timer_id ); +int timer_settime( timer_t timerid, int flags, + const struct itimerspec *value, + struct itimerspec *ovalue ); +int timer_gettime( timer_t timerid, struct itimerspec *value ); +int timer_getoverrun( timer_t timerid ); +int nanosleep( const struct timespec *rqtp, struct timespec *rmtp); + + + + + + + + +Functions Omitted + + +<none> + + + + + + + +Notes + + + + + Currently timer_getoverrun() only + reports timer notifications that are delayed in the timer + subsystem. If they are delayed in the signal subsystem, due to + signal masks for example, this is not counted as an overrun. + + + + + + The option CYGPKG_POSIX_TIMERS allows the timer support to be + enabled or disabled, and causes _POSIX_TIMERS to be defined + appropriately. This will cause other parts of the POSIX system to + have limited functionality. + + + + + + + + + + + + +Message Passing [POSIX Section 15] + + + + +Functions Implemented + + +mqd_t mq_open( const char *name, int oflag, ... ); +int mq_close( mqd_t mqdes ); +int mq_unlink( const char *name ); +int mq_send( mqd_t mqdes, const char *msg_ptr, + size_t msg_len, unsigned int msg_prio ); +ssize_t mq_receive( mqd_t mqdes, char *msg_ptr, + size_t msg_len, unsigned int *msg_prio ); +int mq_setattr( mqd_t mqdes, const struct mq_attr *mqstat, + struct mq_attr *omqstat ); +int mq_getattr( mqd_t mqdes, struct mq_attr *mqstat ); +int mq_notify( mqd_t mqdes, const struct sigevent *notification ); + + + + + + +Functions Omitted + + +<none> + + + + + + + +Notes + + + + + The presence of message queues is controlled by the + CYGPKG_POSIX_MQUEUES option. Setting this will + cause [_POSIX_MESSAGE_PASSING] to + be defined and the message queue API to be made available. + + + + + + Message queues are not currently filesystem objects. They live in + their own name and descriptor spaces. + + + + + + + + + + + +Thread Management [POSIX Section 16] + + + + +Functions Implemented + + +int pthread_attr_init(pthread_attr_t *attr); +int pthread_attr_destroy(pthread_attr_t *attr); +int pthread_attr_setdetachstate(pthread_attr_t *attr, + int detachstate); +int pthread_attr_getdetachstate(const pthread_attr_t *attr, + int *detachstate); +int pthread_attr_setstackaddr(pthread_attr_t *attr, + void *stackaddr); +int pthread_attr_getstackaddr(const pthread_attr_t *attr, + void **stackaddr); +int pthread_attr_setstacksize(pthread_attr_t *attr, + size_t stacksize); +int pthread_attr_getstacksize(const pthread_attr_t *attr, + size_t *stacksize); +int pthread_create( pthread_t *thread, + const pthread_attr_t *attr, + void *(*start_routine)(void *), + void *arg); +pthread_t pthread_self( void ); +int pthread_equal(pthread_t thread1, pthread_t thread2); +void pthread_exit(void *retval); +int pthread_join(pthread_t thread, void **thread_return); +int pthread_detach(pthread_t thread); +int pthread_once(pthread_once_t *once_control, + void (*init_routine)(void)); + + + + + + + +Functions Omitted + + +<none> + + + + + + + +Notes + + + + + The presence of thread support as a whole is controlled by the the + CYGPKG_POSIX_PTHREAD configuration option. Note that disabling + this will also disable many other features of the POSIX package, + since these are intimately bound up with the thread mechanism. + + + + + + The default (non-scheduling) thread attributes are: + + + detachstate PTHREAD_CREATE_JOINABLE + stackaddr unset + stacksize unset + + + + + + Dynamic thread stack allocation is only provided if there is an + implementation of + malloc() configured (i.e. a package + implements the + CYGINT_MEMALLOC_MALLOC_ALLOCATORS + interface). If there is no malloc() available, then the thread + creator must supply a stack. If only a stack address is supplied + then the stack is assumed to be PTHREAD_STACK_MIN + bytes long. This size is seldom useful for any but the most + trivial of threads. If a different sized stack is used, both + the stack address and stack size must be supplied. + + + + + + The value of PTHREAD_THREADS_MAX is supplied by + the CYGNUM_POSIX_PTHREAD_THREADS_MAX + option. This defines the maximum number of threads allowed. The + POSIX standard requires this value to be at least 64, and this + is the default value set. + + + + + + When the POSIX package is installed, the thread that calls + main() is initialized as a POSIX thread. The + priority of that thread is controlled by the + CYGNUM_POSIX_MAIN_DEFAULT_PRIORITY option. + + + + + + + + + + + +Thread-Specific Data [POSIX Section 17] + + + + +Functions Implemented + + +int pthread_key_create(pthread_key_t *key, + void (*destructor)(void *)); +int pthread_setspecific(pthread_key_t key, const void *pointer); +void *pthread_getspecific(pthread_key_t key); +int pthread_key_delete(pthread_key_t key); + + + + + + + +Functions Omitted + +<none> + + + + + + +Notes + + + + + The value of PTHREAD_DESTRUCTOR_ITERATIONS is + provided by the + CYGNUM_POSIX_PTHREAD_DESTRUCTOR_ITERATIONS + option. This controls the number of times that a key destructor + will be called while the data item remains non-NULL. + + + + + + The value of PTHREAD_KEYS_MAX is provided + by the CYGNUM_POSIX_PTHREAD_KEYS_MAX + option. This defines the maximum number of per-thread data items + supported. The POSIX standard calls for this to be a minimum of + 128, which is rather large for an embedded system. The default + value for this option is set to 128 for compatibility but it + should be reduced to a more usable value. + + + + + + + + + + + +Thread Cancellation [POSIX Section 18] + + + + +Functions Implemented + + +int pthread_cancel(pthread_t thread); +int pthread_setcancelstate(int state, int *oldstate); +int pthread_setcanceltype(int type, int *oldtype); +void pthread_testcancel(void); +void pthread_cleanup_push( void (*routine)(void *), + void *arg); +void pthread_cleanup_pop( int execute); + + + + + + + +Functions Omitted + +<none> + + + + + + +Notes + +Asynchronous cancellation is only partially implemented. In +particular, cancellation may occur in unexpected places in some +functions. It is strongly recommended that only synchronous +cancellation be used. + + + + + + + + +Non-POSIX Functions + + +In addition to the standard POSIX functions defined above, the +following non-POSIX functions are defined in the FILEIO package. + + + + + +General I/O Functions + +int ioctl( int fd, CYG_ADDRWORD com, CYG_ADDRWORD data ); +int select( int nfd, fd_set *in, fd_set *out, fd_set *ex, struct timeval *tv); + + + + + + + +Socket Functions + +int socket( int domain, int type, int protocol); +int bind( int s, const struct sockaddr *sa, unsigned int len); +int listen( int s, int len); +int accept( int s, struct sockaddr *sa, socklen_t *addrlen); +int connect( int s, const struct sockaddr *sa, socklen_t len); +int getpeername( int s, struct sockaddr *sa, socklen_t *len); +int getsockname( int s, struct sockaddr *sa, socklen_t *len); +int setsockopt( int s, int level, int optname, const void *optval, + socklen_t optlen); +int getsockopt( int s, int level, int optname, void *optval, + socklen_t *optlen); +ssize_t recvmsg( int s, struct msghdr *msg, int flags); +ssize_t recvfrom( int s, void *buf, size_t len, int flags, + struct sockaddr *from, socklen_t *fromlen); +ssize_t recv( int s, void *buf, size_t len, int flags); +ssize_t sendmsg( int s, const struct msghdr *msg, int flags); +ssize_t sendto( int s, const void *buf, size_t len, int flags, + const struct sockaddr *to, socklen_t tolen); +ssize_t send( int s, const void *buf, size_t len, int flags); +int shutdown( int s, int how); + + + + + + +Notes + + + + The precise behaviour of these functions depends mainly on the + functionality of the underlying filesystem or network stack to + which they are applied. + + + + + + + + + + + + + +References and Bibliography + + + [ELIX] + Embedded Linux API Specification + http://sources.redhat.com/elix/ + + + + [Lewine] + + Donald + A. + Lweine + + Posix Programmer’s Guide: Writing Portable Unix + Programs With the POSIX.1 Standard O’Reilly & + Associates; ISBN: 0937175730. + + + [Lewis1] + + Bil + Lewis + + + Daniel + J. + Berg + + Threads Primer: A Guide to Multithreaded Programming + Prentice Hall + ISBN: 013443698 + + + + [Lewis2] + + Bil + Lewis + + + Daniel + J. + Berg + + Multithreaded Programming With Pthreads + + Prentice Hall Computer Books + + ISBN: 0136807291 + + + + [Nichols] + + Bradford + Nichols + + + Dick + Buttlar + + + Jacqueline + Proulx + Farrell + + Pthreads Programming: A POSIX Standard for Better + Multiprocessing (O’Reilly Nutshell) + O’Reilly & Associates + + ISBN: 1565921151 + + + + [Norton] + + Scott + J. + Norton + + + Mark + D. + Depasquale + + Thread Time: The MultiThreaded Programming Guide + Prentice Hall + + ISBN: 0131900676 + + + + [POSIX] + Portable Operating System Interface(POSIX) - +Part 1: System Application Programming Interface (API)[C +Language] + ISO/IEC 9945-1:1996, IEEE + + + [SUS2] + Open Group; Single Unix Specification, Version 2 + http://www.opengroup.org/public/pubs/online/7908799/index.html + + + + + + + diff --git a/packages/compat/posix/current/include/export.h b/packages/compat/posix/current/include/export.h --- a/packages/compat/posix/current/include/export.h +++ b/packages/compat/posix/current/include/export.h @@ -7,29 +7,38 @@ // POSIX export header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/include/limits.h b/packages/compat/posix/current/include/limits.h --- a/packages/compat/posix/current/include/limits.h +++ b/packages/compat/posix/current/include/limits.h @@ -7,29 +7,38 @@ // POSIX limits header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/include/mutex.h b/packages/compat/posix/current/include/mutex.h --- a/packages/compat/posix/current/include/mutex.h +++ b/packages/compat/posix/current/include/mutex.h @@ -7,29 +7,38 @@ // POSIX mutex and condition variable function definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/include/muttypes.h b/packages/compat/posix/current/include/muttypes.h --- a/packages/compat/posix/current/include/muttypes.h +++ b/packages/compat/posix/current/include/muttypes.h @@ -7,29 +7,38 @@ // POSIX mutex types header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/include/pthread.h b/packages/compat/posix/current/include/pthread.h --- a/packages/compat/posix/current/include/pthread.h +++ b/packages/compat/posix/current/include/pthread.h @@ -7,29 +7,38 @@ // POSIX pthread header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/include/semaphore.h b/packages/compat/posix/current/include/semaphore.h --- a/packages/compat/posix/current/include/semaphore.h +++ b/packages/compat/posix/current/include/semaphore.h @@ -7,29 +7,38 @@ // POSIX semaphore header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/include/signal.h b/packages/compat/posix/current/include/signal.h --- a/packages/compat/posix/current/include/signal.h +++ b/packages/compat/posix/current/include/signal.h @@ -7,29 +7,38 @@ // POSIX signal header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/include/sigsetjmp.h b/packages/compat/posix/current/include/sigsetjmp.h --- a/packages/compat/posix/current/include/sigsetjmp.h +++ b/packages/compat/posix/current/include/sigsetjmp.h @@ -7,29 +7,38 @@ // POSIX sigsetjmp header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/include/time.h b/packages/compat/posix/current/include/time.h --- a/packages/compat/posix/current/include/time.h +++ b/packages/compat/posix/current/include/time.h @@ -7,29 +7,38 @@ // POSIX time header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/include/types.h b/packages/compat/posix/current/include/types.h --- a/packages/compat/posix/current/include/types.h +++ b/packages/compat/posix/current/include/types.h @@ -7,29 +7,38 @@ // POSIX types header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/include/utsname.h b/packages/compat/posix/current/include/utsname.h --- a/packages/compat/posix/current/include/utsname.h +++ b/packages/compat/posix/current/include/utsname.h @@ -7,29 +7,38 @@ // POSIX utsname header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/src/except.cxx b/packages/compat/posix/current/src/except.cxx --- a/packages/compat/posix/current/src/except.cxx +++ b/packages/compat/posix/current/src/except.cxx @@ -5,29 +5,38 @@ // POSIX exception translation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/src/misc.cxx b/packages/compat/posix/current/src/misc.cxx --- a/packages/compat/posix/current/src/misc.cxx +++ b/packages/compat/posix/current/src/misc.cxx @@ -5,29 +5,38 @@ // POSIX misc function implementations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/src/mqueue.cxx b/packages/compat/posix/current/src/mqueue.cxx --- a/packages/compat/posix/current/src/mqueue.cxx +++ b/packages/compat/posix/current/src/mqueue.cxx @@ -5,29 +5,38 @@ // Message queues tests // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/src/mutex.cxx b/packages/compat/posix/current/src/mutex.cxx --- a/packages/compat/posix/current/src/mutex.cxx +++ b/packages/compat/posix/current/src/mutex.cxx @@ -5,29 +5,38 @@ // POSIX pthreads implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/src/pprivate.h b/packages/compat/posix/current/src/pprivate.h --- a/packages/compat/posix/current/src/pprivate.h +++ b/packages/compat/posix/current/src/pprivate.h @@ -7,29 +7,38 @@ // POSIX types header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -228,7 +237,7 @@ externC void cyg_posix_thread_sigdestroy //----------------------------------------------------------------------------- // Functions exported by time.cxx to other parts of the POSIX subsystem. -#ifdef CYGPKG_POSIX_TIMERS +#ifdef CYGPKG_POSIX_CLOCKS externC void cyg_posix_clock_start(); externC cyg_tick_count cyg_timespec_to_ticks( const struct timespec *tp, @@ -236,7 +245,12 @@ externC cyg_tick_count cyg_timespec_to_t externC void cyg_ticks_to_timespec( cyg_tick_count ticks, struct timespec *tp ); +#endif + +#ifdef CYGPKG_POSIX_TIMERS + externC void cyg_posix_timer_asr( pthread_info *self ); + #endif //----------------------------------------------------------------------------- diff --git a/packages/compat/posix/current/src/pthread.cxx b/packages/compat/posix/current/src/pthread.cxx --- a/packages/compat/posix/current/src/pthread.cxx +++ b/packages/compat/posix/current/src/pthread.cxx @@ -5,29 +5,38 @@ // POSIX pthreads implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -699,8 +708,14 @@ externC void pthread_exit (void *retval) // Skip NULL data values if( self->thread_data[key] == NULL ) continue; - // If it passes all that, call the destructor - key_destructor[key]((void *)(self->thread_data[key])); + // If it passes all that, call the destructor. + // Note that NULLing the data value here is new + // behaviour in the 2001 POSIX standard. + { + void* value = self->thread_data[key]; + self->thread_data[key] = NULL; + key_destructor[key](value); + } // Record that we called a destructor destructors_called = true; diff --git a/packages/compat/posix/current/src/sched.cxx b/packages/compat/posix/current/src/sched.cxx --- a/packages/compat/posix/current/src/sched.cxx +++ b/packages/compat/posix/current/src/sched.cxx @@ -5,29 +5,38 @@ // POSIX scheduler API implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -196,7 +205,8 @@ int sched_get_priority_min (int policy) return -1; } - int pri = PTHREAD_POSIX_PRIORITY( CYG_THREAD_MIN_PRIORITY ); + // idle thread priority isn't valid for general use, so subtract 1 + int pri = PTHREAD_POSIX_PRIORITY( CYG_THREAD_MIN_PRIORITY-1 ); CYG_REPORT_RETVAL( pri ); return pri; @@ -209,6 +219,7 @@ int sched_rr_get_interval (pid_t pid, st { CYG_REPORT_FUNCTYPE( "returning %d" ); +#ifdef CYGPKG_POSIX_CLOCKS if( pid != 0 ) { errno = ESRCH; @@ -220,6 +231,11 @@ int sched_rr_get_interval (pid_t pid, st CYG_REPORT_RETVAL( 0 ); return 0; +#else + errno = ENOSYS; + CYG_REPORT_RETVAL( -1 ); + return -1; +#endif } // ------------------------------------------------------------------------- diff --git a/packages/compat/posix/current/src/sem.cxx b/packages/compat/posix/current/src/sem.cxx --- a/packages/compat/posix/current/src/sem.cxx +++ b/packages/compat/posix/current/src/sem.cxx @@ -5,29 +5,38 @@ // POSIX semaphore implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -188,16 +197,14 @@ externC int sem_post (sem_t *sem) externC int sem_getvalue (sem_t *sem, int *sval) { - int retval; - SEMA_ENTRY(); Cyg_Counting_Semaphore *sema = (Cyg_Counting_Semaphore *)sem; - retval = sema->peek(); + *sval = sema->peek(); - CYG_REPORT_RETVAL( retval ); - return retval; + CYG_REPORT_RETVAL( 0 ); + return 0; } // ------------------------------------------------------------------------- diff --git a/packages/compat/posix/current/src/signal.cxx b/packages/compat/posix/current/src/signal.cxx --- a/packages/compat/posix/current/src/signal.cxx +++ b/packages/compat/posix/current/src/signal.cxx @@ -5,29 +5,38 @@ // POSIX signal functions implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -389,6 +398,10 @@ cyg_bool cyg_deliver_signals() } else if ( ss->sa.sa_handler == SIG_DFL ) { + CYG_TRACE2( true, + "Unhandled POSIX signal: sig=%d, mask=%08x", + signo, oldmask ); + // FIXME: should do something better here #if CYGINT_ISO_EXIT _exit( -signo ); diff --git a/packages/compat/posix/current/src/startup.cxx b/packages/compat/posix/current/src/startup.cxx --- a/packages/compat/posix/current/src/startup.cxx +++ b/packages/compat/posix/current/src/startup.cxx @@ -5,29 +5,38 @@ // POSIX startup code // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/src/time.cxx b/packages/compat/posix/current/src/time.cxx --- a/packages/compat/posix/current/src/time.cxx +++ b/packages/compat/posix/current/src/time.cxx @@ -5,29 +5,38 @@ // POSIX time functions implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/mqueue1.c b/packages/compat/posix/current/tests/mqueue1.c --- a/packages/compat/posix/current/tests/mqueue1.c +++ b/packages/compat/posix/current/tests/mqueue1.c @@ -5,29 +5,38 @@ // POSIX Message queues tests // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/mqueue2.c b/packages/compat/posix/current/tests/mqueue2.c --- a/packages/compat/posix/current/tests/mqueue2.c +++ b/packages/compat/posix/current/tests/mqueue2.c @@ -5,29 +5,38 @@ // POSIX Message queues tests - mq_notify // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/mutex3.c b/packages/compat/posix/current/tests/mutex3.c --- a/packages/compat/posix/current/tests/mutex3.c +++ b/packages/compat/posix/current/tests/mutex3.c @@ -5,29 +5,38 @@ // Mutex test 3 - priority inheritance // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/pthread1.c b/packages/compat/posix/current/tests/pthread1.c --- a/packages/compat/posix/current/tests/pthread1.c +++ b/packages/compat/posix/current/tests/pthread1.c @@ -5,29 +5,38 @@ // POSIX pthread test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/pthread2.c b/packages/compat/posix/current/tests/pthread2.c --- a/packages/compat/posix/current/tests/pthread2.c +++ b/packages/compat/posix/current/tests/pthread2.c @@ -5,29 +5,38 @@ // POSIX pthread test 2 - per-thread data // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/pthread3.c b/packages/compat/posix/current/tests/pthread3.c --- a/packages/compat/posix/current/tests/pthread3.c +++ b/packages/compat/posix/current/tests/pthread3.c @@ -5,29 +5,38 @@ // POSIX pthread test 2 - cancellation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/signal1.c b/packages/compat/posix/current/tests/signal1.c --- a/packages/compat/posix/current/tests/signal1.c +++ b/packages/compat/posix/current/tests/signal1.c @@ -5,29 +5,38 @@ // POSIX signal test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/signal2.c b/packages/compat/posix/current/tests/signal2.c --- a/packages/compat/posix/current/tests/signal2.c +++ b/packages/compat/posix/current/tests/signal2.c @@ -5,29 +5,38 @@ // POSIX signal test 2 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/sigsetjmp.c b/packages/compat/posix/current/tests/sigsetjmp.c --- a/packages/compat/posix/current/tests/sigsetjmp.c +++ b/packages/compat/posix/current/tests/sigsetjmp.c @@ -5,29 +5,38 @@ // POSIX sigsetjmp test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/timer1.c b/packages/compat/posix/current/tests/timer1.c --- a/packages/compat/posix/current/tests/timer1.c +++ b/packages/compat/posix/current/tests/timer1.c @@ -5,29 +5,38 @@ // POSIX signal test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/posix/current/tests/tm_basic.cxx b/packages/compat/posix/current/tests/tm_basic.cxx --- a/packages/compat/posix/current/tests/tm_basic.cxx +++ b/packages/compat/posix/current/tests/tm_basic.cxx @@ -5,29 +5,38 @@ // Basic timing test / scaffolding // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/ChangeLog b/packages/compat/uitron/current/ChangeLog --- a/packages/compat/uitron/current/ChangeLog +++ b/packages/compat/uitron/current/ChangeLog @@ -1,3 +1,33 @@ +2002-02-19 Mark Salter + + * doc/uitron.sgml: Fixed typos and such. + +2002-02-14 Hugo Tyson + + * doc/uitron.sgml: General polishing... Tidied up broken emPHAsis + on closing parentheses of function lists. Reduced line length of + same to fit real paper, I hope. Added LITERAL tags all over + config option mentions. + + New stuff... Added a whole new section "[u]ITRON Configuration + FAQ" based on some email answers I have given in the past in + support of customers. + +2002-02-13 Hugo Tyson + + * doc/uitron.sgml: NEW FILE: Make id tags qualified with + compat-uitron- and add a couple of tags; tidy up formatting of + some function listings; correct comment on using functions in your + own DSRs and ISRs. + +2002-01-24 Jesper Skov + + * include/uit_func.inl (ena_int, dis_int): Wrap + HAL_MASK_INTERRUPT/HAL_UNMASK_INTERRUPT in interrupt + disable/restore pairs. + * tests/testintr.cxx (detach_isr, attach_isr): Change order of + mask/unmask and disable/restore. + 2001-04-30 Jonathan Larmour * src/uit_objs.cxx: Workaround xscale tools preprocessor bug @@ -796,27 +826,36 @@ Fri Jul 24 13:02:46 1998 Hugo Tyson = eintno, E_PAR ); + HAL_DISABLE_INTERRUPTS(old_ints); HAL_INTERRUPT_MASK( eintno ); + HAL_RESTORE_INTERRUPTS(old_ints); return E_OK; } @@ -1380,11 +1393,15 @@ CYG_UIT_FUNC_INLINE ER ena_int ( UINT eintno ) { + CYG_INTERRUPT_STATE old_ints; + #if 0 < CYGNUM_HAL_ISR_MIN CYG_UIT_PARAMCHECK( CYGNUM_HAL_ISR_MIN <= eintno, E_PAR ); #endif CYG_UIT_PARAMCHECK( CYGNUM_HAL_ISR_MAX >= eintno, E_PAR ); + HAL_DISABLE_INTERRUPTS(old_ints); HAL_INTERRUPT_UNMASK( eintno ); + HAL_RESTORE_INTERRUPTS(old_ints); return E_OK; } diff --git a/packages/compat/uitron/current/include/uit_ifnc.h b/packages/compat/uitron/current/include/uit_ifnc.h --- a/packages/compat/uitron/current/include/uit_ifnc.h +++ b/packages/compat/uitron/current/include/uit_ifnc.h @@ -7,29 +7,38 @@ // uITRON compatibility functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/include/uit_ifnc.inl b/packages/compat/uitron/current/include/uit_ifnc.inl --- a/packages/compat/uitron/current/include/uit_ifnc.inl +++ b/packages/compat/uitron/current/include/uit_ifnc.inl @@ -7,29 +7,38 @@ // uITRON compatibility functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/include/uit_objs.hxx b/packages/compat/uitron/current/include/uit_objs.hxx --- a/packages/compat/uitron/current/include/uit_objs.hxx +++ b/packages/compat/uitron/current/include/uit_objs.hxx @@ -7,29 +7,38 @@ // uITRON static objects // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/include/uit_type.h b/packages/compat/uitron/current/include/uit_type.h --- a/packages/compat/uitron/current/include/uit_type.h +++ b/packages/compat/uitron/current/include/uit_type.h @@ -7,29 +7,38 @@ // uITRON specific data types as required by the API // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/src/uit_func.cxx b/packages/compat/uitron/current/src/uit_func.cxx --- a/packages/compat/uitron/current/src/uit_func.cxx +++ b/packages/compat/uitron/current/src/uit_func.cxx @@ -5,29 +5,38 @@ // uITRON compatibility functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/src/uit_ifnc.cxx b/packages/compat/uitron/current/src/uit_ifnc.cxx --- a/packages/compat/uitron/current/src/uit_ifnc.cxx +++ b/packages/compat/uitron/current/src/uit_ifnc.cxx @@ -5,29 +5,38 @@ // uITRON compatibility functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/src/uit_objs.cxx b/packages/compat/uitron/current/src/uit_objs.cxx --- a/packages/compat/uitron/current/src/uit_objs.cxx +++ b/packages/compat/uitron/current/src/uit_objs.cxx @@ -5,29 +5,38 @@ // uITRON static objects // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/test1.c b/packages/compat/uitron/current/tests/test1.c --- a/packages/compat/uitron/current/tests/test1.c +++ b/packages/compat/uitron/current/tests/test1.c @@ -5,29 +5,38 @@ // uITRON "C" test program one // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/test2.c b/packages/compat/uitron/current/tests/test2.c --- a/packages/compat/uitron/current/tests/test2.c +++ b/packages/compat/uitron/current/tests/test2.c @@ -5,29 +5,38 @@ // uITRON "C" test program two // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/test3.c b/packages/compat/uitron/current/tests/test3.c --- a/packages/compat/uitron/current/tests/test3.c +++ b/packages/compat/uitron/current/tests/test3.c @@ -5,29 +5,38 @@ // uITRON "C" test program three // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/test4.c b/packages/compat/uitron/current/tests/test4.c --- a/packages/compat/uitron/current/tests/test4.c +++ b/packages/compat/uitron/current/tests/test4.c @@ -5,29 +5,38 @@ // uITRON "C" test program four // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/test5.c b/packages/compat/uitron/current/tests/test5.c --- a/packages/compat/uitron/current/tests/test5.c +++ b/packages/compat/uitron/current/tests/test5.c @@ -5,29 +5,38 @@ // uITRON "C" test program five // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/test6.c b/packages/compat/uitron/current/tests/test6.c --- a/packages/compat/uitron/current/tests/test6.c +++ b/packages/compat/uitron/current/tests/test6.c @@ -5,29 +5,38 @@ // uITRON "C" test program six // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/test7.c b/packages/compat/uitron/current/tests/test7.c --- a/packages/compat/uitron/current/tests/test7.c +++ b/packages/compat/uitron/current/tests/test7.c @@ -5,29 +5,38 @@ // uITRON "C" test program seven // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/test8.c b/packages/compat/uitron/current/tests/test8.c --- a/packages/compat/uitron/current/tests/test8.c +++ b/packages/compat/uitron/current/tests/test8.c @@ -5,29 +5,38 @@ // uITRON "C" test program eight // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/test9.c b/packages/compat/uitron/current/tests/test9.c --- a/packages/compat/uitron/current/tests/test9.c +++ b/packages/compat/uitron/current/tests/test9.c @@ -5,29 +5,38 @@ // uITRON "C" test program nine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/testcx2.cxx b/packages/compat/uitron/current/tests/testcx2.cxx --- a/packages/compat/uitron/current/tests/testcx2.cxx +++ b/packages/compat/uitron/current/tests/testcx2.cxx @@ -5,29 +5,38 @@ // uITRON "C++" test program two // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/testcx3.cxx b/packages/compat/uitron/current/tests/testcx3.cxx --- a/packages/compat/uitron/current/tests/testcx3.cxx +++ b/packages/compat/uitron/current/tests/testcx3.cxx @@ -5,29 +5,38 @@ // uITRON "C++" test program three // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/testcx4.cxx b/packages/compat/uitron/current/tests/testcx4.cxx --- a/packages/compat/uitron/current/tests/testcx4.cxx +++ b/packages/compat/uitron/current/tests/testcx4.cxx @@ -5,29 +5,38 @@ // uITRON "C++" test program four // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/testcx5.cxx b/packages/compat/uitron/current/tests/testcx5.cxx --- a/packages/compat/uitron/current/tests/testcx5.cxx +++ b/packages/compat/uitron/current/tests/testcx5.cxx @@ -5,29 +5,38 @@ // uITRON "C++" test program five // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/testcx6.cxx b/packages/compat/uitron/current/tests/testcx6.cxx --- a/packages/compat/uitron/current/tests/testcx6.cxx +++ b/packages/compat/uitron/current/tests/testcx6.cxx @@ -5,29 +5,38 @@ // uITRON "C++" test program six // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/testcx7.cxx b/packages/compat/uitron/current/tests/testcx7.cxx --- a/packages/compat/uitron/current/tests/testcx7.cxx +++ b/packages/compat/uitron/current/tests/testcx7.cxx @@ -5,29 +5,38 @@ // uITRON "C++" test program seven // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/testcx8.cxx b/packages/compat/uitron/current/tests/testcx8.cxx --- a/packages/compat/uitron/current/tests/testcx8.cxx +++ b/packages/compat/uitron/current/tests/testcx8.cxx @@ -5,29 +5,38 @@ // uITRON "C++" test program eight // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/testcx9.cxx b/packages/compat/uitron/current/tests/testcx9.cxx --- a/packages/compat/uitron/current/tests/testcx9.cxx +++ b/packages/compat/uitron/current/tests/testcx9.cxx @@ -5,29 +5,38 @@ // uITRON "C++" test program nine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/testcxx.cxx b/packages/compat/uitron/current/tests/testcxx.cxx --- a/packages/compat/uitron/current/tests/testcxx.cxx +++ b/packages/compat/uitron/current/tests/testcxx.cxx @@ -5,29 +5,38 @@ // uITRON "C++" test program // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/compat/uitron/current/tests/testintr.cxx b/packages/compat/uitron/current/tests/testintr.cxx --- a/packages/compat/uitron/current/tests/testintr.cxx +++ b/packages/compat/uitron/current/tests/testintr.cxx @@ -5,29 +5,38 @@ // uITRON "C" test program for ixxx_yyy interrupt safe operators // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -782,8 +791,8 @@ attach_isr( unsigned int (*isr)(unsigned int inuse; int old_ints; Cyg_RealTimeClock *prtc = (Cyg_RealTimeClock *)Cyg_Clock::real_time_clock; + HAL_DISABLE_INTERRUPTS(old_ints); HAL_INTERRUPT_MASK( CYGNUM_HAL_INTERRUPT_RTC ); - HAL_DISABLE_INTERRUPTS(old_ints); prtc->interrupt.detach(); #ifndef CYGIMP_KERNEL_INTERRUPTS_CHAIN // Only check that the vector was cleared when there's a specific @@ -804,8 +813,8 @@ attach_isr( unsigned int (*isr)(unsigned HAL_INTERRUPT_IN_USE( CYGNUM_HAL_INTERRUPT_RTC, inuse ); CYG_TEST_CHECK( inuse, "Failed to attach new ISR" ); ACK_CLOCK(); + HAL_INTERRUPT_UNMASK( CYGNUM_HAL_INTERRUPT_RTC ); HAL_RESTORE_INTERRUPTS(old_ints); - HAL_INTERRUPT_UNMASK( CYGNUM_HAL_INTERRUPT_RTC ); } void @@ -814,8 +823,8 @@ detach_isr( unsigned int (*isr)(unsigned int inuse; int old_ints; Cyg_RealTimeClock *prtc = (Cyg_RealTimeClock *)Cyg_Clock::real_time_clock; + HAL_DISABLE_INTERRUPTS(old_ints); HAL_INTERRUPT_MASK( CYGNUM_HAL_INTERRUPT_RTC ); - HAL_DISABLE_INTERRUPTS(old_ints); uit_intr.detach(); #ifndef CYGIMP_KERNEL_INTERRUPTS_CHAIN // See comment above in attach_isr. @@ -826,8 +835,8 @@ detach_isr( unsigned int (*isr)(unsigned HAL_INTERRUPT_IN_USE( CYGNUM_HAL_INTERRUPT_RTC, inuse ); CYG_TEST_CHECK( inuse, "Failed to attach clock ISR" ); ACK_CLOCK(); + HAL_INTERRUPT_UNMASK( CYGNUM_HAL_INTERRUPT_RTC ); HAL_RESTORE_INTERRUPTS(old_ints); - HAL_INTERRUPT_UNMASK( CYGNUM_HAL_INTERRUPT_RTC ); } diff --git a/packages/cygmon/current/ChangeLog b/packages/cygmon/current/ChangeLog --- a/packages/cygmon/current/ChangeLog +++ b/packages/cygmon/current/ChangeLog @@ -217,27 +217,36 @@ 1999-10-25 Gary Thomas // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/defs.h b/packages/cygmon/current/misc/bsp/defs.h --- a/packages/cygmon/current/misc/bsp/defs.h +++ b/packages/cygmon/current/misc/bsp/defs.h @@ -7,29 +7,38 @@ // Definitions of interest to Red Hat BSP. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/gdb-data.h b/packages/cygmon/current/misc/bsp/gdb-data.h --- a/packages/cygmon/current/misc/bsp/gdb-data.h +++ b/packages/cygmon/current/misc/bsp/gdb-data.h @@ -7,29 +7,38 @@ // Shared data specific to gdb stub. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/hex-utils.h b/packages/cygmon/current/misc/bsp/hex-utils.h --- a/packages/cygmon/current/misc/bsp/hex-utils.h +++ b/packages/cygmon/current/misc/bsp/hex-utils.h @@ -7,29 +7,38 @@ // Utilities for decoding hexadecimal encoded integers. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/mips/gdb-cpu.c b/packages/cygmon/current/misc/bsp/mips/gdb-cpu.c --- a/packages/cygmon/current/misc/bsp/mips/gdb-cpu.c +++ b/packages/cygmon/current/misc/bsp/mips/gdb-cpu.c @@ -5,29 +5,38 @@ // CPU specific support for GDB stub. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/mips/gdb-cpu.h b/packages/cygmon/current/misc/bsp/mips/gdb-cpu.h --- a/packages/cygmon/current/misc/bsp/mips/gdb-cpu.h +++ b/packages/cygmon/current/misc/bsp/mips/gdb-cpu.h @@ -7,29 +7,38 @@ // CPU specific definitions for GDB stub. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/mips/gdb.h b/packages/cygmon/current/misc/bsp/mips/gdb.h --- a/packages/cygmon/current/misc/bsp/mips/gdb.h +++ b/packages/cygmon/current/misc/bsp/mips/gdb.h @@ -7,29 +7,38 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/mips/insn.h b/packages/cygmon/current/misc/bsp/mips/insn.h --- a/packages/cygmon/current/misc/bsp/mips/insn.h +++ b/packages/cygmon/current/misc/bsp/mips/insn.h @@ -7,29 +7,38 @@ // MIPS instruction descriptions. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/mips/singlestep.c b/packages/cygmon/current/misc/bsp/mips/singlestep.c --- a/packages/cygmon/current/misc/bsp/mips/singlestep.c +++ b/packages/cygmon/current/misc/bsp/mips/singlestep.c @@ -5,29 +5,38 @@ // MIPS specific single-step support. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/mn10300/gdb-cpu.c b/packages/cygmon/current/misc/bsp/mn10300/gdb-cpu.c --- a/packages/cygmon/current/misc/bsp/mn10300/gdb-cpu.c +++ b/packages/cygmon/current/misc/bsp/mn10300/gdb-cpu.c @@ -5,29 +5,38 @@ // CPU specific support for GDB stub. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/mn10300/gdb-cpu.h b/packages/cygmon/current/misc/bsp/mn10300/gdb-cpu.h --- a/packages/cygmon/current/misc/bsp/mn10300/gdb-cpu.h +++ b/packages/cygmon/current/misc/bsp/mn10300/gdb-cpu.h @@ -7,29 +7,38 @@ // CPU specific definitions for GDB stub. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/mn10300/gdb.h b/packages/cygmon/current/misc/bsp/mn10300/gdb.h --- a/packages/cygmon/current/misc/bsp/mn10300/gdb.h +++ b/packages/cygmon/current/misc/bsp/mn10300/gdb.h @@ -7,29 +7,38 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/mn10300/insn.h b/packages/cygmon/current/misc/bsp/mn10300/insn.h --- a/packages/cygmon/current/misc/bsp/mn10300/insn.h +++ b/packages/cygmon/current/misc/bsp/mn10300/insn.h @@ -7,29 +7,38 @@ // MN10300 instruction descriptions. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/bsp/mn10300/singlestep.c b/packages/cygmon/current/misc/bsp/mn10300/singlestep.c --- a/packages/cygmon/current/misc/bsp/mn10300/singlestep.c +++ b/packages/cygmon/current/misc/bsp/mn10300/singlestep.c @@ -5,29 +5,38 @@ // MN10300 specific single-step support. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/cpu-mon.c b/packages/cygmon/current/misc/cpu-mon.c --- a/packages/cygmon/current/misc/cpu-mon.c +++ b/packages/cygmon/current/misc/cpu-mon.c @@ -5,29 +5,38 @@ // eCos BSP (for building Cygmon) // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/cpu_info.h b/packages/cygmon/current/misc/cpu_info.h --- a/packages/cygmon/current/misc/cpu_info.h +++ b/packages/cygmon/current/misc/cpu_info.h @@ -7,29 +7,38 @@ // Architecture specific information // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/ecos_bsp.c b/packages/cygmon/current/misc/ecos_bsp.c --- a/packages/cygmon/current/misc/ecos_bsp.c +++ b/packages/cygmon/current/misc/ecos_bsp.c @@ -5,29 +5,38 @@ // eCos BSP (for building Cygmon) // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/ecos_dummy.c b/packages/cygmon/current/misc/ecos_dummy.c --- a/packages/cygmon/current/misc/ecos_dummy.c +++ b/packages/cygmon/current/misc/ecos_dummy.c @@ -5,29 +5,38 @@ // eCos BSP (for building Cygmon) // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/fmt_util.h b/packages/cygmon/current/misc/fmt_util.h --- a/packages/cygmon/current/misc/fmt_util.h +++ b/packages/cygmon/current/misc/fmt_util.h @@ -7,29 +7,38 @@ // Interface to generic string parsing and formatting utilities. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/generic-stub.h b/packages/cygmon/current/misc/generic-stub.h --- a/packages/cygmon/current/misc/generic-stub.h +++ b/packages/cygmon/current/misc/generic-stub.h @@ -5,29 +5,38 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/generic_fmt32.c b/packages/cygmon/current/misc/generic_fmt32.c --- a/packages/cygmon/current/misc/generic_fmt32.c +++ b/packages/cygmon/current/misc/generic_fmt32.c @@ -5,29 +5,38 @@ // Generic address conversion routines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/generic_mem.c b/packages/cygmon/current/misc/generic_mem.c --- a/packages/cygmon/current/misc/generic_mem.c +++ b/packages/cygmon/current/misc/generic_mem.c @@ -5,29 +5,38 @@ // Routines for reading and writing memory. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/ledit.c b/packages/cygmon/current/misc/ledit.c --- a/packages/cygmon/current/misc/ledit.c +++ b/packages/cygmon/current/misc/ledit.c @@ -5,29 +5,38 @@ // Utterly simple line editor // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/ledit.h b/packages/cygmon/current/misc/ledit.h --- a/packages/cygmon/current/misc/ledit.h +++ b/packages/cygmon/current/misc/ledit.h @@ -5,29 +5,38 @@ // Header for the utterly simple line editor // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/mips/board.h b/packages/cygmon/current/misc/mips/board.h --- a/packages/cygmon/current/misc/mips/board.h +++ b/packages/cygmon/current/misc/mips/board.h @@ -7,29 +7,38 @@ // Cygmon board/platform configuration file // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/mips/cpu.h b/packages/cygmon/current/misc/mips/cpu.h --- a/packages/cygmon/current/misc/mips/cpu.h +++ b/packages/cygmon/current/misc/mips/cpu.h @@ -7,29 +7,38 @@ // MIPS specific processor defines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/mips/cpu_info.h b/packages/cygmon/current/misc/mips/cpu_info.h --- a/packages/cygmon/current/misc/mips/cpu_info.h +++ b/packages/cygmon/current/misc/mips/cpu_info.h @@ -7,29 +7,38 @@ // Architecture information for MIPS processors // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/mips/mips-mon.c b/packages/cygmon/current/misc/mips/mips-mon.c --- a/packages/cygmon/current/misc/mips/mips-mon.c +++ b/packages/cygmon/current/misc/mips/mips-mon.c @@ -6,29 +6,38 @@ // MIPS processors. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/mn10300/board.h b/packages/cygmon/current/misc/mn10300/board.h --- a/packages/cygmon/current/misc/mn10300/board.h +++ b/packages/cygmon/current/misc/mn10300/board.h @@ -7,29 +7,38 @@ // Cygmon board/platform configuration file // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -47,7 +56,11 @@ // These defines are only necessary for using target_reg union in monitor.h // It should be possible to remove that once the HAL integration is complete. +#if CYGHWR_HAL_MN10300_AM33_REVISION == 2 +#define HAVE_FLOAT_REGS 1 +#else #define HAVE_FLOAT_REGS 0 +#endif #define HAVE_DOUBLE_REGS 0 #define HAVE_CACHE 0 diff --git a/packages/cygmon/current/misc/mn10300/cpu.h b/packages/cygmon/current/misc/mn10300/cpu.h --- a/packages/cygmon/current/misc/mn10300/cpu.h +++ b/packages/cygmon/current/misc/mn10300/cpu.h @@ -7,29 +7,38 @@ // MN10300 specific processor defines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/mn10300/cpu_info.h b/packages/cygmon/current/misc/mn10300/cpu_info.h --- a/packages/cygmon/current/misc/mn10300/cpu_info.h +++ b/packages/cygmon/current/misc/mn10300/cpu_info.h @@ -7,29 +7,38 @@ // Architecture information for MN10300 processors // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/mn10300/mn10300-mon.c b/packages/cygmon/current/misc/mn10300/mn10300-mon.c --- a/packages/cygmon/current/misc/mn10300/mn10300-mon.c +++ b/packages/cygmon/current/misc/mn10300/mn10300-mon.c @@ -6,29 +6,38 @@ // MN10300 processors. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -87,6 +96,41 @@ struct regstruct regtab[] = {"mcrl", MCRL, 1}, {"mcvf", MCVF, 1}, {"mdrq", MDRQ, 1}, +#if CYGHWR_HAL_MN10300_AM33_REVISION == 2 + {"fpcr", FPCR, 1}, + {"fs0", FS0, 1}, + {"fs1", FS1, 1}, + {"fs2", FS2, 1}, + {"fs3", FS3, 1}, + {"fs4", FS4, 1}, + {"fs5", FS5, 1}, + {"fs6", FS6, 1}, + {"fs7", FS7, 1}, + {"fs8", FS8, 1}, + {"fs9", FS9, 1}, + {"fs10", FS10, 1}, + {"fs11", FS11, 1}, + {"fs12", FS12, 1}, + {"fs13", FS13, 1}, + {"fs14", FS14, 1}, + {"fs15", FS15, 1}, + {"fs16", FS16, 1}, + {"fs17", FS17, 1}, + {"fs18", FS18, 1}, + {"fs19", FS19, 1}, + {"fs20", FS20, 1}, + {"fs21", FS21, 1}, + {"fs22", FS22, 1}, + {"fs23", FS23, 1}, + {"fs24", FS24, 1}, + {"fs25", FS25, 1}, + {"fs26", FS26, 1}, + {"fs27", FS27, 1}, + {"fs28", FS28, 1}, + {"fs29", FS29, 1}, + {"fs30", FS30, 1}, + {"fs31", FS31, 1}, +#endif #endif { 0, 0, 1}, /* Terminating element must be last */ } ; @@ -96,6 +140,9 @@ initialize_mon(void) { } /* initialize_mon */ +#if CYGHWR_HAL_MN10300_AM33_REVISION == 2 +extern int fpu_regs_read; +#endif #ifdef CYGPKG_HAL_MN10300_AM33 extern int msp_read; @@ -105,6 +152,14 @@ void initialize_mon_each_time(void) { int i; +#if CYGHWR_HAL_MN10300_AM33_REVISION == 2 + // Make sure the regtab[] indicates the valid status of the FPU registers + for (i = 0; regtab[i].registername != NULL; i++) + { + if ((regtab[i].registernumber >= FP_START) && (regtab[i].registernumber <= FP_END)) + regtab[i].registervalid = fpu_regs_read; + } +#endif #ifdef CYGPKG_HAL_MN10300_AM33 // Make sure the regtab[] indicates the valid status of the MSP diff --git a/packages/cygmon/current/misc/monitor.c b/packages/cygmon/current/misc/monitor.c --- a/packages/cygmon/current/misc/monitor.c +++ b/packages/cygmon/current/misc/monitor.c @@ -5,29 +5,38 @@ // Monitor shell and main routines for CygMON the Wonder Monitor // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/monitor.h b/packages/cygmon/current/misc/monitor.h --- a/packages/cygmon/current/misc/monitor.h +++ b/packages/cygmon/current/misc/monitor.h @@ -5,29 +5,38 @@ // Main definitions for the CygMON ROM monitor // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/monitor_cmd.c b/packages/cygmon/current/misc/monitor_cmd.c --- a/packages/cygmon/current/misc/monitor_cmd.c +++ b/packages/cygmon/current/misc/monitor_cmd.c @@ -5,29 +5,38 @@ // Monitor commands for the CygMON ROM monitor // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/monitor_cmd.h b/packages/cygmon/current/misc/monitor_cmd.h --- a/packages/cygmon/current/misc/monitor_cmd.h +++ b/packages/cygmon/current/misc/monitor_cmd.h @@ -5,29 +5,38 @@ // Monitor command definitions for the CygMON ROM monitor // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/stub-tservice.h b/packages/cygmon/current/misc/stub-tservice.h --- a/packages/cygmon/current/misc/stub-tservice.h +++ b/packages/cygmon/current/misc/stub-tservice.h @@ -5,29 +5,38 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/tservice.h b/packages/cygmon/current/misc/tservice.h --- a/packages/cygmon/current/misc/tservice.h +++ b/packages/cygmon/current/misc/tservice.h @@ -8,29 +8,38 @@ // target dependent services. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/unistd.h b/packages/cygmon/current/misc/unistd.h --- a/packages/cygmon/current/misc/unistd.h +++ b/packages/cygmon/current/misc/unistd.h @@ -5,29 +5,38 @@ // Standard Unix/POSIX environment // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/cygmon/current/misc/utils.c b/packages/cygmon/current/misc/utils.c --- a/packages/cygmon/current/misc/utils.c +++ b/packages/cygmon/current/misc/utils.c @@ -5,29 +5,38 @@ // Monitor utilities. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/eth/amd/pcnet/current/ChangeLog b/packages/devs/eth/amd/pcnet/current/ChangeLog --- a/packages/devs/eth/amd/pcnet/current/ChangeLog +++ b/packages/devs/eth/amd/pcnet/current/ChangeLog @@ -1,3 +1,8 @@ +2002-02-19 Jesper Skov + + * src/if_pcnet.c: Fix a typo. Skip TX handling when there's no + outstanding TX packets. + 2001-12-17 Jesper Skov * src/if_pcnet.c (amd_pcnet_init): Fix warning. @@ -136,27 +141,36 @@ 2001-04-03 Jesper Skov #include // delays #include -#include -#include +#include +#include #ifdef CYGPKG_NET #include #include @@ -991,6 +1000,7 @@ pcnet_send(struct eth_drv_sc *sc, struct #endif // This delay seems to be necessary on some platforms + // (Malta 5kc for example). // Why it is needed is not clear, but removing it or // reducing it cause transmission failures in RedBoot (at least). CYGACC_CALL_IF_DELAY_US(100); @@ -1025,6 +1035,13 @@ pcnet_TxEvent(struct eth_drv_sc *sc, int DEBUG_FUNCTION(); + if (0 == cpd->tx_ring_owned) { +#if DEBUG & 1 + db_printf("%s: got TX completion when no outstanding packets\n", __FUNCTION__); +#endif + return; + } + INCR_STAT( tx_complete ); txd = cpd->tx_ring + cpd->tx_ring_alloc*PCNET_TD_SIZE; @@ -1231,7 +1248,7 @@ pcnet_recv(struct eth_drv_sc *sc, struct DEBUG_FUNCTION(); - rxd = cpd->rx_ring + cpd->rxpacket*PCNET_TD_SIZE; + rxd = cpd->rx_ring + cpd->rxpacket*PCNET_RD_SIZE; buf = cpd->rx_buffers + cpd->rxpacket*_BUF_SIZE; INCR_STAT( rx_deliver ); diff --git a/packages/devs/eth/arm/aaed2000/current/ChangeLog b/packages/devs/eth/arm/aaed2000/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/aaed2000/current/ChangeLog @@ -0,0 +1,74 @@ +2002-03-28 Gary Thomas + + * cdl/aaed2000_eth_drivers.cdl: Don't define CYGHWR_NET_DRIVERS, + as it's defined by the generic driver. + +2001-11-29 Jesper Skov + + * include/devs_eth_arm_aaed2000.inl: Always include ESA run-time + lookup. + +2001-11-19 Jesper Skov + + * include/devs_eth_arm_aaed2000.inl (_aaed2000_provide_eth0_esa): + Use VV calls instead of RedBoot functions. + +2001-11-09 Jesper Skov + + * include/devs_eth_arm_aaed2000.inl: RedBoot ESA options updated + and added reader for those. + +2001-11-08 Jesper Skov + + * cdl/aaed2000_eth_drivers.cdl: Added NET implement statements. + + * include/devs_eth_arm_aaed2000.inl: Moved the redboot eth0_esa + config here. + +2001-11-07 Jesper Skov + + * src/if_aaed2000.c: [deleted] + * src/cs8900.h: [deleted] + * include/devs_eth_arm_aaed2000.inl: [added] Definitions for + generic driver. + + * cdl/aaed2000_eth_drivers.cdl: Changes for using generic driver. + +2001-10-30 Jesper Skov + + * Imported sources from Gary Thomas. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/arm/aaed2000/current/cdl/aaed2000_eth_drivers.cdl b/packages/devs/eth/arm/aaed2000/current/cdl/aaed2000_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/aaed2000/current/cdl/aaed2000_eth_drivers.cdl @@ -0,0 +1,109 @@ +# ==================================================================== +# +# aaed2000_eth_drivers.cdl +# +# Ethernet driver for Agilent AAED2000 development system +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Original data: gthomas +# Contributors: +# Date: 2001-10-27 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_ARM_AAED2000 { + display "Ethernet driver for Agilent AAED2000 development board" + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_ARM_ARM9_AAED2000 + + include_dir cyg/io + + # FIXME: This really belongs in the CL CS8900A package + cdl_interface CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED { + display "Cirrus Logic CS8900A ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_CL_CS8900A_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_CL_CS8900A_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_ARM_AAED2000_ETH0 { + display "AAED2000 ethernet port driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + AAED2000 port." + + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED + + cdl_option CYGDAT_DEVS_ETH_ARM_AAED2000_ETH0_NAME { + display "Device name for the ETH0 ethernet driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device." + } + + cdl_component CYGSEM_DEVS_ETH_ARM_AAED2000_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + calculated 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_ARM_AAED2000_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } +} diff --git a/packages/devs/eth/arm/aaed2000/current/include/devs_eth_arm_aaed2000.inl b/packages/devs/eth/arm/aaed2000/current/include/devs_eth_arm_aaed2000.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/aaed2000/current/include/devs_eth_arm_aaed2000.inl @@ -0,0 +1,147 @@ +//========================================================================== +// +// devs_eth_arm_aaed2000.inl +// +// AAED2000 ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-11-06 +// Purpose: AAED2000 ethernet defintions +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR +#include + +#ifdef CYGPKG_REDBOOT +# include +# ifdef CYGSEM_REDBOOT_FLASH_CONFIG +# include +# include +# endif +#endif + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_ARM_AAED2000_ETH0 + +#if defined(CYGPKG_REDBOOT) && defined(CYGSEM_REDBOOT_FLASH_CONFIG) +RedBoot_config_option("Set " CYGDAT_DEVS_ETH_ARM_AAED2000_ETH0_NAME " network hardware address [MAC]", + eth0_esa, + ALWAYS_ENABLED, true, + CONFIG_BOOL, false + ); +RedBoot_config_option(CYGDAT_DEVS_ETH_ARM_AAED2000_ETH0_NAME " network hardware address [MAC]", + eth0_esa_data, + "eth0_esa", true, + CONFIG_ESA, 0 + ); +#endif // CYGPKG_REDBOOT && CYGSEM_REDBOOT_FLASH_CONFIG + +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +// Note that this section *is* active in an application, outside RedBoot, +// where the above section is not included. + +# include + +# ifndef CONFIG_ESA +# define CONFIG_ESA (6) +# endif +# ifndef CONFIG_BOOL +# define CONFIG_BOOL (1) +# endif + +cyg_bool +_aaed2000_provide_eth0_esa(struct cs8900a_priv_data* cpd) +{ + cyg_bool set_esa; + int ok; + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "eth0_esa", &set_esa, CONFIG_BOOL); + if (ok && set_esa) { + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "eth0_esa_data", cpd->esa, CONFIG_ESA); + } + + return ok && set_esa; +} + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + +static cs8900a_priv_data_t cs8900a_eth0_priv_data = { + base : (cyg_addrword_t) 0x10000300, + interrupt: CYGNUM_HAL_INTERRUPT_ETH, +#ifdef CYGSEM_DEVS_ETH_ARM_AAED2000_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_ARM_AAED2000_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +#endif +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + provide_esa : &_aaed2000_provide_eth0_esa, +#else + provide_esa : NULL, +#endif +}; + +ETH_DRV_SC(cs8900a_sc, + &cs8900a_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_ARM_AAED2000_ETH0_NAME, + cs8900a_start, + cs8900a_stop, + cs8900a_control, + cs8900a_can_send, + cs8900a_send, + cs8900a_recv, + cs8900a_deliver, // "pseudoDSR" called from fast net thread + cs8900a_poll, // poll function, encapsulates ISR and DSR + cs8900a_int_vector); + +NETDEVTAB_ENTRY(cs8900a_netdev, + "cs8900a_" CYGDAT_DEVS_ETH_ARM_AAED2000_ETH0_NAME, + cs8900a_init, + &cs8900a_sc); + +#endif // CYGPKG_DEVS_ETH_ARM_AAED2000_ETH0 + +#endif // __WANT_DEVS + +// EOF devs_eth_arm_aaed2000.inl diff --git a/packages/devs/eth/arm/cerf/current/ChangeLog b/packages/devs/eth/arm/cerf/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/cerf/current/ChangeLog @@ -0,0 +1,45 @@ +2002-03-28 Gary Thomas + + * cdl/cerf_eth_drivers.cdl: Don't define CYGHWR_NET_DRIVERS since it's + defined by the generic driver. + +2002-02-04 Gary Thomas + + * include/devs_eth_arm_cerf.inl: + * doc/README: + * cdl/cerf_eth_drivers.cdl: New file(s). Port to Intrinsyc CerfCube. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/arm/cerf/current/cdl/cerf_eth_drivers.cdl b/packages/devs/eth/arm/cerf/current/cdl/cerf_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/cerf/current/cdl/cerf_eth_drivers.cdl @@ -0,0 +1,119 @@ +# ==================================================================== +# +# cerf_eth_drivers.cdl +# +# Ethernet drivers - platform dependent support for Intrinsyc CerfCube +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Contributors: gthomas, jskov, ptruter +# Date: 2000-01-25 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_ARM_CERF { + display "Crystal LAN ethernet driver for Cerf boards" + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_ARM_SA11X0_CERF + + implements CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED + # implements CYGINT_DEVS_ETH_CL_CS8900A_STATIC_ESA + + requires CYGPKG_DEVS_ETH_CL_CS8900A + + include_dir cyg/io + + description "Ethernet driver for Crystal LAN based Cerf + boards." + + # FIXME: This really belongs in the CL CS8900A package + cdl_interface CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED { + display "CS8900A ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_CL_CS8900A_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_CL_CS8900A_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_ARM_CERF_ETH0 { + display "CERF ethernet port driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + CERF port." + + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED + implements CYGINT_DEVS_ETH_CL_CS8900A_STATIC_ESA + + cdl_option CYGDAT_DEVS_ETH_ARM_CERF_ETH0_NAME { + display "Device name for the ETH0 ethernet driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device." + } + + cdl_component CYGSEM_DEVS_ETH_ARM_CERF_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + calculated 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_ARM_CERF_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } + +} + diff --git a/packages/devs/eth/arm/cerf/current/doc/README b/packages/devs/eth/arm/cerf/current/doc/README new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/cerf/current/doc/README @@ -0,0 +1,3 @@ +Preliminary documentation for Intrinsyc CerfCube Ethernet driver +================================================================== + diff --git a/packages/devs/eth/arm/cerf/current/include/devs_eth_arm_cerf.inl b/packages/devs/eth/arm/cerf/current/include/devs_eth_arm_cerf.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/cerf/current/include/devs_eth_arm_cerf.inl @@ -0,0 +1,208 @@ +//========================================================================== +// +// devs_eth_arm_cerf.inl +// +// CERF ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-11-14 +// Purpose: CERF ethernet defintions +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include +#include +#include + +#ifdef CYGPKG_REDBOOT +# include +# ifdef CYGSEM_REDBOOT_FLASH_CONFIG +# include +# include +# endif +#endif + +#ifdef __WANT_CONFIG +# define CS8900A_step 2 +#endif + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_ARM_CERF_ETH0 + +#ifndef CYGSEM_DEVS_ETH_ARM_CERF_ETH0_SET_ESA +# if defined(CYGPKG_REDBOOT) && defined(CYGSEM_REDBOOT_FLASH_CONFIG) +RedBoot_config_option("Set " CYGDAT_DEVS_ETH_ARM_CERF_ETH0_NAME " network hardware address [MAC]", + eth0_esa, + ALWAYS_ENABLED, true, + CONFIG_BOOL, false + ); +RedBoot_config_option(CYGDAT_DEVS_ETH_ARM_CERF_ETH0_NAME " network hardware address [MAC]", + eth0_esa_data, + "eth0_esa", true, + CONFIG_ESA, 0 + ); +# endif // CYGPKG_REDBOOT && CYGSEM_REDBOOT_FLASH_CONFIG + +# ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +// Note that this section *is* active in an application, outside RedBoot, +// where the above section is not included. + +# include + +# ifndef CONFIG_ESA +# define CONFIG_ESA (6) +# endif +# ifndef CONFIG_BOOL +# define CONFIG_BOOL (1) +# endif + +cyg_bool +_cerf_provide_eth0_esa(struct cs8900a_priv_data* cpd) +{ + cyg_bool set_esa; + int ok; + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "eth0_esa", &set_esa, CONFIG_BOOL); + if (ok && set_esa) { + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "eth0_esa_data", cpd->esa, CONFIG_ESA); + } + return ok && set_esa; +} + +# endif // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +#endif // ! CYGSEM_DEVS_ETH_ARM_CERF_ETH0_SET_ESA + +// ------------------------------------------------------------------------ +// EEPROM access functions +// +#define PP_ECR 0x0040 +#define PP_EE_READ_CMD 0x0200 +#define PP_EE_WRITE_CMD 0x0100 +#define PP_EE_DATA 0x0042 +#define PP_EE_ADDR_W0 0x001C +#define PP_EE_ADDR_W1 0x001D +#define PP_EE_ADDR_W2 0x001E + +static __inline__ cyg_uint16 +read_eeprom(cyg_addrword_t base, cyg_uint16 offset) +{ + while (get_reg(base, PP_SelfStat) & PP_SelfStat_SIBSY) + ; + + put_reg(base, PP_ECR, (offset | PP_EE_READ_CMD)); + + while (get_reg(base, PP_SelfStat) & PP_SelfStat_SIBSY) + ; + + return get_reg(base, PP_EE_DATA); +} + +static __inline__ void +copy_eeprom(cyg_addrword_t base) +{ + cyg_uint16 esa_word; + int i; + for (i = 0; i < 6; i += 2) + { + esa_word = read_eeprom(base, PP_EE_ADDR_W0 + (i/2)); + put_reg(base, PP_IA+(i/2), esa_word); + } +} + +static __inline__ void +post_reset(cyg_addrword_t base) +{ + // Toggle A0 connected to the SBHE line on the Crystal chip. + *(char*)(0x20000000) = 1; + *(char*)(0x20000001) = 2; + *(char*)(0x20000000) = 3; + *(char*)(0x20000001) = 0; +} + +#undef CYGHWR_CL_CS8900A_PLF_POST_RESET +#define CYGHWR_CL_CS8900A_PLF_POST_RESET(base) post_reset(base) + +#undef CYGHWR_CL_CS8900A_PLF_RESET +#define CYGHWR_CL_CS8900A_PLF_RESET(base) copy_eeprom(base) + +static cs8900a_priv_data_t cs8900a_eth0_priv_data = { + base : (cyg_addrword_t) 0xf0000300, + interrupt:SA1110_IRQ_GPIO_ETH, +#ifdef CYGSEM_DEVS_ETH_ARM_CERF_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_ARM_CERF_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +# ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + provide_esa : &_cerf_provide_eth0_esa, +# else + provide_esa : NULL, +# endif +#endif + +}; + + +ETH_DRV_SC(cs8900a_sc, + &cs8900a_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_ARM_CERF_ETH0_NAME, + cs8900a_start, + cs8900a_stop, + cs8900a_control, + cs8900a_can_send, + cs8900a_send, + cs8900a_recv, + cs8900a_deliver, // "pseudoDSR" called from fast net thread + cs8900a_poll, // poll function, encapsulates ISR and DSR + cs8900a_int_vector); + +NETDEVTAB_ENTRY(cs8900a_netdev, + "cs8900a_" CYGDAT_DEVS_ETH_ARM_CERF_ETH0_NAME, + cs8900a_init, + &cs8900a_sc); + +#endif // CYGPKG_DEVS_ETH_ARM_CERF_ETH0 + +#endif // __WANT_DEVS + +// EOF devs_eth_arm_cerf.inl diff --git a/packages/devs/eth/arm/cerfpda/current/ChangeLog b/packages/devs/eth/arm/cerfpda/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/cerfpda/current/ChangeLog @@ -0,0 +1,45 @@ +2002-03-28 Gary Thomas + + * cdl/cerfpda_eth_drivers.cdl: Don't define CYGHWR_NET_DRIVERS since + it's defined in the generic driver. + +2002-02-04 Gary Thomas + + * include/devs_eth_arm_cerfpda.inl: + * doc/README: + * cdl/cerfpda_eth_drivers.cdl: New file(s). Port to CerfPDA. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/arm/cerfpda/current/cdl/cerfpda_eth_drivers.cdl b/packages/devs/eth/arm/cerfpda/current/cdl/cerfpda_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/cerfpda/current/cdl/cerfpda_eth_drivers.cdl @@ -0,0 +1,119 @@ +# ==================================================================== +# +# cerfpda_eth_drivers.cdl +# +# Ethernet drivers - platform dependent support for Intrinsyc CerfPDA +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Contributors: gthomas, jskov, ptruter +# Date: 2000-01-25 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_ARM_CERFPDA { + display "Crystal LAN ethernet driver for Cerfpda" + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_ARM_SA11X0_CERFPDA + + implements CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED + # implements CYGINT_DEVS_ETH_CL_CS8900A_STATIC_ESA + + requires CYGPKG_DEVS_ETH_CL_CS8900A + + include_dir cyg/io + + description "Ethernet driver for Crystal LAN based Cerf + boards." + + # FIXME: This really belongs in the CL CS8900A package + cdl_interface CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED { + display "CS8900A ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_CL_CS8900A_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_CL_CS8900A_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_ARM_CERFPDA_ETH0 { + display "CERFPDA ethernet port driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + CERFPDA port." + + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED + implements CYGINT_DEVS_ETH_CL_CS8900A_STATIC_ESA + + cdl_option CYGDAT_DEVS_ETH_ARM_CERFPDA_ETH0_NAME { + display "Device name for the ETH0 ethernet driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device." + } + + cdl_component CYGSEM_DEVS_ETH_ARM_CERFPDA_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + calculated 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_ARM_CERFPDA_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } + +} + diff --git a/packages/devs/eth/arm/cerfpda/current/doc/README b/packages/devs/eth/arm/cerfpda/current/doc/README new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/cerfpda/current/doc/README @@ -0,0 +1,2 @@ +Preliminary documentation for Intrinsyc CerfPDA Ethernet driver +================================================================== diff --git a/packages/devs/eth/arm/cerfpda/current/include/devs_eth_arm_cerfpda.inl b/packages/devs/eth/arm/cerfpda/current/include/devs_eth_arm_cerfpda.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/cerfpda/current/include/devs_eth_arm_cerfpda.inl @@ -0,0 +1,208 @@ +//========================================================================== +// +// devs_eth_arm_cerfpda.inl +// +// CERFPDA ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-11-14 +// Purpose: CERFPDA ethernet defintions +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include +#include +#include + +#ifdef CYGPKG_REDBOOT +# include +# ifdef CYGSEM_REDBOOT_FLASH_CONFIG +# include +# include +# endif +#endif + +#ifdef __WANT_CONFIG +# define CS8900A_step 2 +#endif + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_ARM_CERFPDA_ETH0 + +#ifndef CYGSEM_DEVS_ETH_ARM_CERFPDA_ETH0_SET_ESA +# if defined(CYGPKG_REDBOOT) && defined(CYGSEM_REDBOOT_FLASH_CONFIG) +RedBoot_config_option("Set " CYGDAT_DEVS_ETH_ARM_CERFPDA_ETH0_NAME " network hardware address [MAC]", + eth0_esa, + ALWAYS_ENABLED, true, + CONFIG_BOOL, false + ); +RedBoot_config_option(CYGDAT_DEVS_ETH_ARM_CERFPDA_ETH0_NAME " network hardware address [MAC]", + eth0_esa_data, + "eth0_esa", true, + CONFIG_ESA, 0 + ); +# endif // CYGPKG_REDBOOT && CYGSEM_REDBOOT_FLASH_CONFIG + +# ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +// Note that this section *is* active in an application, outside RedBoot, +// where the above section is not included. + +# include + +# ifndef CONFIG_ESA +# define CONFIG_ESA (6) +# endif +# ifndef CONFIG_BOOL +# define CONFIG_BOOL (1) +# endif + +cyg_bool +_cerfpda_provide_eth0_esa(struct cs8900a_priv_data* cpd) +{ + cyg_bool set_esa; + int ok; + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "eth0_esa", &set_esa, CONFIG_BOOL); + if (ok && set_esa) { + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "eth0_esa_data", cpd->esa, CONFIG_ESA); + } + return ok && set_esa; +} + +# endif // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +#endif // ! CYGSEM_DEVS_ETH_ARM_CERFPDA_ETH0_SET_ESA + +// ------------------------------------------------------------------------ +// EEPROM access functions +// +#define PP_ECR 0x0040 +#define PP_EE_READ_CMD 0x0200 +#define PP_EE_WRITE_CMD 0x0100 +#define PP_EE_DATA 0x0042 +#define PP_EE_ADDR_W0 0x001C +#define PP_EE_ADDR_W1 0x001D +#define PP_EE_ADDR_W2 0x001E + +static __inline__ cyg_uint16 +read_eeprom(cyg_addrword_t base, cyg_uint16 offset) +{ + while (get_reg(base, PP_SelfStat) & PP_SelfStat_SIBSY) + ; + + put_reg(base, PP_ECR, (offset | PP_EE_READ_CMD)); + + while (get_reg(base, PP_SelfStat) & PP_SelfStat_SIBSY) + ; + + return get_reg(base, PP_EE_DATA); +} + +static __inline__ void +copy_eeprom(cyg_addrword_t base) +{ + cyg_uint16 esa_word; + int i; + for (i = 0; i < 6; i += 2) + { + esa_word = read_eeprom(base, PP_EE_ADDR_W0 + (i/2)); + put_reg(base, PP_IA+(i/2), esa_word); + } +} + +static __inline__ void +post_reset(cyg_addrword_t base) +{ + // Toggle A0 connected to the SBHE line on the Crystal chip. + *(char*)(0x20000000) = 1; + *(char*)(0x20000001) = 2; + *(char*)(0x20000000) = 3; + *(char*)(0x20000001) = 0; +} + +#undef CYGHWR_CL_CS8900A_PLF_POST_RESET +#define CYGHWR_CL_CS8900A_PLF_POST_RESET(base) post_reset(base) + +#undef CYGHWR_CL_CS8900A_PLF_RESET +#define CYGHWR_CL_CS8900A_PLF_RESET(base) copy_eeprom(base) + +static cs8900a_priv_data_t cs8900a_eth0_priv_data = { + base : (cyg_addrword_t) 0xf0000300, + interrupt:SA1110_IRQ_GPIO_ETH, +#ifdef CYGSEM_DEVS_ETH_ARM_CERFPDA_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_ARM_CERFPDA_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +# ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + provide_esa : &_cerfpda_provide_eth0_esa, +# else + provide_esa : NULL, +# endif +#endif + +}; + + +ETH_DRV_SC(cs8900a_sc, + &cs8900a_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_ARM_CERFPDA_ETH0_NAME, + cs8900a_start, + cs8900a_stop, + cs8900a_control, + cs8900a_can_send, + cs8900a_send, + cs8900a_recv, + cs8900a_deliver, // "pseudoDSR" called from fast net thread + cs8900a_poll, // poll function, encapsulates ISR and DSR + cs8900a_int_vector); + +NETDEVTAB_ENTRY(cs8900a_netdev, + "cs8900a_" CYGDAT_DEVS_ETH_ARM_CERFPDA_ETH0_NAME, + cs8900a_init, + &cs8900a_sc); + +#endif // CYGPKG_DEVS_ETH_ARM_CERFPDA_ETH0 + +#endif // __WANT_DEVS + +// EOF devs_eth_arm_cerfpda.inl diff --git a/packages/devs/eth/arm/ebsa285/current/ChangeLog b/packages/devs/eth/arm/ebsa285/current/ChangeLog --- a/packages/devs/eth/arm/ebsa285/current/ChangeLog +++ b/packages/devs/eth/arm/ebsa285/current/ChangeLog @@ -1,3 +1,7 @@ +2002-05-14 Jesper Skov + + * include/devs_eth_ebsa285.inl: Fix warnings. + 2001-11-19 Hugo Tyson 2001-11-19 Anssi Pulkkinen @@ -411,29 +415,38 @@ 2000-02-08 Hugo Tyson " - puts $::cdl_system_header \ - "#define CYGBLD_DEVS_ETH_DEVICE_H " + # FIXME: This really belongs in the INTEL_I82559 package + cdl_interface CYGINT_DEVS_ETH_INTEL_I82559_REQUIRED { + display "Intel i82559 ethernet driver required" } - description "Ethernet driver for Intel EBSA285 with PRO/100+ boards." - compile -library=libextras.a if_ebsa285.c - - cdl_option CYGDBG_DEVS_ETH_ARM_EBSA285_CHATTER { - display "Prints ethernet device status info during startup" - default_value 0 - description " - The ethernet device initialization code can print lots of info - to confirm that it has found the devices on the PCI bus, read - the MAC address from EEPROM correctly, and so on, and also - displays the mode (10/100MHz, half/full duplex) of the - connection." - } - - cdl_option CYGNUM_DEVS_ETH_ARM_EBSA285_DEV_COUNT { - display "Number of supported interfaces." - legal_values 1 2 - default_value 2 - flavor data - description " - This option selects the number of PCI ethernet interfaces to - be supported by the driver." + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_INTEL_I82559_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_INTEL_I82559_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" } - cdl_component CYGDBG_DEVS_ETH_ARM_EBSA285_KEEP_STATISTICS { - display "Keep Ethernet statistics" - default_value 1 - description " - The ethernet device can maintain statistics about the network, - specifically a great variety of error rates which are useful - for network management. SNMP for example uses this - information. There is some performance cost in maintaining - this information; disable this option to recoup that." + cdl_component CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0 { + display "EBSA-285 ethernet port 0 driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + PCI ethernet network devices." - cdl_option CYGDBG_DEVS_ETH_ARM_EBSA285_KEEP_82559_STATISTICS { - display "Keep i82559 Internal statistics" - default_value 1 - description " - The i82559 keeps internal counters, and it is possible to - acquire these. But the i82559 (reputedly) does not service - the network whilst uploading the data to RAM from its - internal registers. If throughput is a problem, disable - this option to acquire only those statistics gathered by - software, so that the i82559 never sleeps." - } - } + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_INTEL_I82559_REQUIRED - cdl_component CYGPKG_DEVS_ETH_ARM_EBSA285_WRITE_EEPROM { - display "SIOCSIFHWADDR records MAC address in EEPROM" - default_value 0 - description " - The ioctl() socket call with operand SIOCSIFHWADDR sets the - interface hardware address - the MAC address or ethernet - address. This option causes the new MAC address to be written - into the EEPROM associated with the interface, so that the new - MAC address is permanently recorded. Doing this should be a - carefully chosen decision, hence this option." - } + cdl_option CYGDAT_DEVS_ETH_ARM_EBSA285_ETH0_NAME { + display "Device name for the ethernet port 0 driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + first PCI ethernet card." + } - cdl_component CYGPKG_DEVS_ETH_ARM_EBSA285_OPTIONS { - display "Intel EBSA285 with PRO/100+ ethernet driver build options" - flavor none - no_define - - cdl_option CYGPKG_DEVS_ETH_ARM_EBSA285_CFLAGS_ADD { - display "Additional compiler flags" - flavor data - no_define - default_value { "-D_KERNEL -D__ECOS" } - description " - This option modifies the set of compiler flags for - building the Intel EBSA285 with PRO/100+ ethernet driver - package. These flags are used in addition to the set of - global flags." + cdl_component CYGSEM_DEVS_ETH_ARM_EBSA285_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_ARM_EBSA285_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x00, 0xB5, 0xE0, 0xB5, 0xE0, 0x11}"} + description "The ethernet station address" + } } } + cdl_component CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1 { + display "EBSA-285 ethernet port 1 driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + nanoBridge port 1 - that is the connector on the corner of + the board, far from the reset switch." + + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH1 + implements CYGINT_DEVS_ETH_INTEL_I82559_REQUIRED + + cdl_option CYGDAT_DEVS_ETH_ARM_EBSA285_ETH1_NAME { + display "Device name for the ethernet port 1 driver" + flavor data + default_value {"\"eth1\""} + description " + This option sets the name of the ethernet device for the + second PCI ethernet card." + } + + cdl_component CYGSEM_DEVS_ETH_ARM_EBSA285_ETH1_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_ARM_EBSA285_ETH1_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x00, 0xB5, 0xE0, 0xB5, 0xE0, 0x12}"} + description "The ethernet station address" + } + } + } } # EOF ebsa285_eth_drivers.cdl diff --git a/packages/devs/eth/arm/ebsa285/current/include/devs_eth_ebsa285.inl b/packages/devs/eth/arm/ebsa285/current/include/devs_eth_ebsa285.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/ebsa285/current/include/devs_eth_ebsa285.inl @@ -0,0 +1,246 @@ +//========================================================================== +// +// devs/eth/arm/ebsa285/..../include/devs_eth_ebsa285.inl +// +// EBSA-285 ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov, hmt +// Contributors: jskov, gthomas +// Date: 2001-02-28 +// Purpose: EBSA285 ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_... +#include +#include // hal_virt_to_phys_address() + +// -------------------------------------------------------------- +// Platform specifics: + +// support SDRAM with gaps in it. +#define CYGHWR_DEVS_ETH_INTEL_I82559_PCIMEM_DISCONTIGUOUS + +// Interrupts are wire-or'd together. +#if 1 < CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT +#define CYGHWR_DEVS_ETH_INTEL_I82559_DEMUX_ALL +#endif // multiple devs, so demux_all needed + +// define multiple interrupt handling anyway: +//? #define CYGHWR_DEVS_ETH_INTRS (SA11X0_GPIO_PIN_10) + +// This brings in code to ensure missed interrupts are properly +// acknowledged so that another interrupt can occur in future. +// Only a problem with edge-triggered systems. + +/* #define CYGHWR_DEVS_ETH_INTEL_I82559_MISSED_INTERRUPT(p_i82559) \ + (CYGHWR_DEVS_ETH_INTRS != (CYGHWR_DEVS_ETH_INTRS & *SA11X0_GPIO_PIN_LEVEL)) +*/ + +// This brings on code to perform a selective reset on the device if the CU +// wedges. + +#define CYGHWR_DEVS_ETH_INTEL_I82559_DEAD_TO (368640) // 0.1S of OS timer + +/* #define CYGHWR_DEVS_ETH_INTEL_I82559_RESET_TIMEOUT( anon_uint ) \ + CYG_MACRO_START \ + (anon_uint) = *SA11X0_OSCR; \ + CYG_MACRO_END +*/ + +/* #define CYGHWR_DEVS_ETH_INTEL_I82559_TIMEOUT_FIRED( anon_uint ) \ + ((*SA11X0_OSCR - (anon_uint)) > CYGHWR_DEVS_ETH_INTEL_I82559_DEAD_TO) +*/ + +// The mask on an SA1110 is really an enable: 1 => enabled, 0 => masked. +// So to behave nestedly, we only need save the old value of the bits +// of interest. + +#define CYGPRI_DEVS_ETH_INTEL_I82559_MASK_INTERRUPTS(p_i82559,old) \ +CYG_MACRO_START \ + int cpu_intr; \ + int mybits = \ + (1 << (p_i82559->vector)) | \ + (1 << CYGNUM_HAL_INTERRUPT_PCI_IRQ); \ + \ + HAL_DISABLE_INTERRUPTS( cpu_intr ); \ + old = *SA110_IRQCONT_IRQENABLE; \ + *SA110_IRQCONT_IRQENABLECLEAR = mybits; /* clear mybits */ \ + HAL_RESTORE_INTERRUPTS( cpu_intr ); \ +CYG_MACRO_END + +// We must only unmask (enable) those which were unmasked before, +// according to the bits in old. +#define CYGPRI_DEVS_ETH_INTEL_I82559_UNMASK_INTERRUPTS(p_i82559,old) \ +CYG_MACRO_START \ + *SA110_IRQCONT_IRQENABLESET = old & \ + ((1 << (p_i82559->vector)) | \ + (1 << CYGNUM_HAL_INTERRUPT_PCI_IRQ)); \ +CYG_MACRO_END + +#define CYGPRI_DEVS_ETH_INTEL_I82559_ACK_INTERRUPTS(p_i82559) \ +CYG_MACRO_START \ +CYG_MACRO_END + + +// -------------------------------------------------------------- + +#define CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE +#define CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_SIZE + +#define CYGHWR_INTEL_I82559_PCI_VIRT_TO_BUS( _x_ ) virt_to_bus((cyg_uint32)_x_) +static inline cyg_uint32 virt_to_bus(cyg_uint32 p_memory) +{ return (p_memory - CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE); } + +// -------------------------------------------------------------- +// Construct the two interfaces + +#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0 + +static I82559 i82559_eth0_priv_data = { +#ifdef CYGSEM_DEVS_ETH_ARM_EBSA285_ETH0_SET_ESA + hardwired_esa: 1, + mac_address: CYGDAT_DEVS_ETH_ARM_EBSA285_ETH0_ESA +#else + hardwired_esa: 0, +#endif +}; + +ETH_DRV_SC(i82559_sc0, + &i82559_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_ARM_EBSA285_ETH0_NAME, // Name for device + i82559_start, + i82559_stop, + i82559_ioctl, + i82559_can_send, + i82559_send, + i82559_recv, + i82559_deliver, + i82559_poll, + i82559_int_vector + ); + +NETDEVTAB_ENTRY(i82559_netdev0, + "i82559_" CYGDAT_DEVS_ETH_ARM_EBSA285_ETH0_NAME, + i82559_init, + &i82559_sc0); + +#endif // CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0 + +#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1 + +static I82559 i82559_eth1_priv_data = { +#ifdef CYGSEM_DEVS_ETH_ARM_EBSA285_ETH1_SET_ESA + hardwired_esa: 1, + mac_address: CYGDAT_DEVS_ETH_ARM_EBSA285_ETH1_ESA +#else + hardwired_esa: 0, +#endif +}; + +ETH_DRV_SC(i82559_sc1, + &i82559_eth1_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_ARM_EBSA285_ETH1_NAME, // Name for device + i82559_start, + i82559_stop, + i82559_ioctl, + i82559_can_send, + i82559_send, + i82559_recv, + i82559_deliver, + i82559_poll, + i82559_int_vector + ); + +NETDEVTAB_ENTRY(i82559_netdev1, + "i82559_" CYGDAT_DEVS_ETH_ARM_EBSA285_ETH1_NAME, + i82559_init, + &i82559_sc1); + +#endif // CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1 + +// -------------------------------------------------------------- +// These arrays are used for sanity checking of pointers +I82559 * +i82559_priv_array[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0 + &i82559_eth0_priv_data, +#endif +#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1 + &i82559_eth1_priv_data, +#endif +}; + +#ifdef CYGDBG_USE_ASSERTS +// These are only used when assertions are enabled +cyg_netdevtab_entry_t * +i82559_netdev_array[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0 + &i82559_netdev0, +#endif +#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1 + &i82559_netdev1, +#endif +}; + +struct eth_drv_sc * +i82559_sc_array[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH0 + &i82559_sc0, +#endif +#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_ETH1 + &i82559_sc1, +#endif +}; +#endif // CYGDBG_USE_ASSERTS + +// -------------------------------------------------------------- +// Debugging + +//#define CYGDBG_DEVS_ETH_INTEL_I82559_CHATTER 1 + +// -------------------------------------------------------------- +// RedBoot configuration options for managing ESAs for us + +#define CYGHWR_DEVS_ETH_INTEL_I82559_HAS_ONE_EEPROM 0 +#define CYGHWR_DEVS_ETH_INTEL_I82559_HAS_ONE_EEPROM_MAC_ADJUST (1) + +// -------------------------------------------------------------- + +// EOF devs_eth_ebsa285.inl diff --git a/packages/devs/eth/arm/ebsa285/current/include/ebsa285_info.h b/packages/devs/eth/arm/ebsa285/current/include/ebsa285_info.h deleted file mode 100644 --- a/packages/devs/eth/arm/ebsa285/current/include/ebsa285_info.h +++ /dev/null @@ -1,202 +0,0 @@ -#ifndef CYGONCE_DEVS_ETH_ARM_EBSA285_EBSA285_INFO_H -#define CYGONCE_DEVS_ETH_ARM_EBSA285_EBSA285_INFO_H -/*========================================================================== -// -// ebsa285_info.h -// -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): hmt -// Contributors: hmt -// Date: 2000-05-03 -// Description: -// -//####DESCRIPTIONEND#### -*/ - -#include - -#ifdef CYGDBG_DEVS_ETH_ARM_EBSA285_KEEP_STATISTICS -# define KEEP_STATISTICS -# define nDISPLAY_STATISTICS -# define nDISPLAY_82559_STATISTICS -#else -# define nKEEP_STATISTICS -# define nDISPLAY_STATISTICS -# define nDISPLAY_82559_STATISTICS -#endif - - -// ------------------------------------------------------------------------ -// -// STATISTICAL COUNTER STRUCTURE -// -// ------------------------------------------------------------------------ -#ifdef KEEP_STATISTICS -typedef struct { -/* 0 */ cyg_uint32 tx_good; -/* 4 */ cyg_uint32 tx_max_collisions; -/* 8 */ cyg_uint32 tx_late_collisions; -/* 12 */ cyg_uint32 tx_underrun; -/* 16 */ cyg_uint32 tx_carrier_loss; -/* 20 */ cyg_uint32 tx_deferred; -/* 24 */ cyg_uint32 tx_single_collisions; -/* 28 */ cyg_uint32 tx_mult_collisions; -/* 32 */ cyg_uint32 tx_total_collisions; -/* 36 */ cyg_uint32 rx_good; -/* 40 */ cyg_uint32 rx_crc_errors; -/* 44 */ cyg_uint32 rx_align_errors; -/* 48 */ cyg_uint32 rx_resource_errors; -/* 52 */ cyg_uint32 rx_overrun_errors; -/* 56 */ cyg_uint32 rx_collisions; // Always 0 -/* 60 */ cyg_uint32 rx_short_frames; -// In this setup; can also be flow-control counts after. -// If these are to be used, a config command (as in set promiscuous mode) -// must be issued at start, to let those stats escape. Params are in -// comments around the config command setup... -/* 64 */ cyg_uint32 done; -} I82559_COUNTERS; - - -typedef struct { - cyg_uint32 interrupts; - cyg_uint32 rx_count; - cyg_uint32 rx_deliver; - cyg_uint32 rx_resource; - cyg_uint32 rx_restart; - cyg_uint32 tx_count; - cyg_uint32 tx_complete; - cyg_uint32 tx_dropped; -} STATISTICS; - - -extern STATISTICS statistics[2]; -#ifdef CYGDBG_DEVS_ETH_ARM_EBSA285_KEEP_82559_STATISTICS -extern I82559_COUNTERS i82559_counters[2]; -#endif - -#endif // KEEP_STATISTICS - -// ------------------------------------------------------------------------ -// -// DEVICES AND PACKET QUEUES -// -// ------------------------------------------------------------------------ -// The system seems to work OK with as few as 8 of RX and TX descriptors. -// It limps very painfully with only 4. -// Performance is better with more than 8. -// But the size of non-cached (so useless for anything else) -// memory window is 1Mb, so we might as well use it all. -// -// 128 for these uses the whole 1Mb, near enough. - -#ifndef MAX_RX_DESCRIPTORS -#define MAX_RX_DESCRIPTORS 128 // number of Rx descriptors -#endif -#ifndef MAX_TX_DESCRIPTORS -#define MAX_TX_DESCRIPTORS 128 // number of Tx descriptors -#endif - - -typedef struct i82559 { - cyg_uint8 // (split up for atomic byte access) - found:1, // was hardware discovered? - mac_addr_ok:1, // can we bring up? - active:1, // has this if been brung up? - spare1:5; - cyg_uint8 - spare2:8; - cyg_uint8 - tx_in_progress:1, // transmit in progress flag - tx_queue_full:1, // all Tx descriptors used flag - spare3:6; - cyg_uint8 index; // 0 or 1 or whatever - cyg_uint32 devid; // PCI device id - cyg_uint32 memory_address; // PCI memory address - cyg_uint32 io_address; // memory mapped I/O address - cyg_uint8 mac_address[6]; // mac (hardware) address - void *ndp; // Network Device Pointer - - int next_rx_descriptor; // descriptor index for RFDs - struct rfd *rx_ring[MAX_RX_DESCRIPTORS]; // location of Rx descriptors - - int tx_descriptor_add; // descriptor index for additions - int tx_descriptor_active; // descriptor index for active tx - int tx_descriptor_remove; // descriptor index for remove - - struct txcb *tx_ring[MAX_TX_DESCRIPTORS]; // location of Tx descriptors - unsigned long tx_keys[MAX_TX_DESCRIPTORS]; - // keys for tx q management - - // Interrupt handling stuff - cyg_vector_t vector; // interrupt vector - cyg_handle_t interrupt_handle; // handle for int.handler - cyg_interrupt interrupt_object; - -#ifdef KEEP_STATISTICS - void *p_statistics; // pointer to statistical counters -#endif - -} I82559; - - - -// ------------------------------------------------------------------------ -// -// 82559 GENERAL STATUS REGISTER -// -// ------------------------------------------------------------------------ -#define GEN_STATUS_FDX 0x04 // 1 = full duplex, 0 = half -#define GEN_STATUS_100MBPS 0x02 // 1 = 100 Mbps, 0 = 10 Mbps -#define GEN_STATUS_LINK 0x01 // 1 = link up, 0 = link down - -extern int i82559_status( struct eth_drv_sc *sc ); - -// ------------------------------------------------------------------------ - -#ifdef KEEP_STATISTICS -void update_statistics(struct i82559* p_i82559); -#endif - - -#ifdef CYGDBG_DEVS_ETH_ARM_EBSA285_KEEP_82559_STATISTICS -#define ETH_STATS_INIT( p ) \ - update_statistics( (struct i82559 *)((p)->driver_private) ) -#else -#define ETH_STATS_INIT( p ) // otherwise do nothing -#endif - -#define CYGDAT_DEVS_ETH_DESCRIPTION "Intel EtherPRO 10/100+ (i82559)" - -#define ETH_DEV_DOT3STATSETHERCHIPSET 1,3,6,1,2,1,10,7,8,2,5 - -#endif /* ifndef CYGONCE_DEVS_ETH_ARM_EBSA285_EBSA285_INFO_H */ - -/* EOF ebsa285_info.h */ - diff --git a/packages/devs/eth/arm/ebsa285/current/src/if_ebsa285.c b/packages/devs/eth/arm/ebsa285/current/src/if_ebsa285.c deleted file mode 100644 --- a/packages/devs/eth/arm/ebsa285/current/src/if_ebsa285.c +++ /dev/null @@ -1,2861 +0,0 @@ -//========================================================================== -// -// if_ebsa285.c -// -// Ethernet drivers -// Intel EBSA285 and PRO/100+ platform specific support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): hmt, gthomas -// Contributors: Ron Spence, Pacific Softworks -// Date: 2000-02-01 -// Purpose: -// Description: hardware driver for 82559 Intel PRO/100+ ethernet and -// Intel StrongARM EBSA-285 development boards -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CYGPKG_NET -#include -#include /* Needed for struct ifnet */ -#else -#include -#endif - -#ifdef CYGPKG_IO_PCI -#include -// So we can check the validity of the PCI window against the MLTs opinion, -// and thereby what the malloc heap consumes willy-nilly: -#include CYGHWR_MEMORY_LAYOUT_H -#else -#error "Need PCI package here" -#endif - -// Exported statistics and the like -#include -#include - -// ------------------------------------------------------------------------ - -#ifdef CYGDBG_DEVS_ETH_ARM_EBSA285_CHATTER -#define notDEBUG_82559 // This one prints stuff as packets come and go -#define DEBUG // Startup printing mainly -#define DEBUG_EE // Some EEPROM specific retries &c -#endif - -#define os_printf diag_printf -#define db_printf diag_printf - -// ------------------------------------------------------------------------ -// I/O access macros as inlines for type safety - -static inline void OUTB(cyg_uint8 value, cyg_uint32 io_address) -{ *((volatile cyg_uint8 *)io_address) = value; } - -static inline void OUTW(cyg_uint16 value, cyg_uint32 io_address) -{ *((volatile cyg_uint16 *)io_address) = value; } - -static inline void OUTL(cyg_uint32 value, cyg_uint32 io_address) -{ *((volatile cyg_uint32 *)io_address) = value; } - -static inline cyg_uint8 INB(cyg_uint32 io_address) -{ return *((volatile cyg_uint8 *)io_address); } - -static inline cyg_uint16 INW(cyg_uint32 io_address) -{ return *((volatile cyg_uint16 *)io_address); } - -static inline cyg_uint32 INL(cyg_uint32 io_address) -{ return *((volatile cyg_uint32 *)io_address); } - -#define VIRT_TO_BUS( _x_ ) virt_to_bus((cyg_uint32)(_x_)) -static inline cyg_uint32 virt_to_bus(cyg_uint32 p_memory) -{ return (p_memory - CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE); } - -#define BUS_TO_VIRT( _x_ ) bus_to_virt((cyg_uint32)(_x_)) -static inline cyg_uint32 bus_to_virt(cyg_uint32 p_memory) -{ return (p_memory + CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE); } - - -// ------------------------------------------------------------------------ -// -// 82559 REGISTER OFFSETS (I/O SPACE) -// -// ------------------------------------------------------------------------ -#define SCBStatus 0 // Rx/Command Unit command and status. -#define SCBCmd 2 // Rx/Command Unit command and status. -#define SCBPointer 4 // General purpose pointer. -#define SCBPort 8 // Misc. commands and operands. -#define SCBflash 12 // Flash memory control. -#define SCBeeprom 14 // EEPROM memory control. -#define SCBCtrlMDI 16 // MDI interface control. -#define SCBEarlyRx 20 // Early receive byte count. -#define SCBGenControl 28 // 82559 General Control Register -#define SCBGenStatus 29 // 82559 General Status register - - -// ------------------------------------------------------------------------ -// -// 82559 SCB STATUS WORD DEFNITIONS -// -// ------------------------------------------------------------------------ -#define SCB_STATUS_CX 0x8000 // CU finished command (transmit) -#define SCB_STATUS_FR 0x4000 // frame received -#define SCB_STATUS_CNA 0x2000 // CU left active state -#define SCB_STATUS_RNR 0x1000 // receiver left ready state -#define SCB_STATUS_MDI 0x0800 // MDI read/write cycle done -#define SCB_STATUS_SWI 0x0400 // software generated interrupt -#define SCB_STATUS_FCP 0x0100 // flow control pause interrupt - -#define SCB_INTACK_MASK 0xFD00 // all the above - -#define SCB_INTACK_TX (SCB_STATUS_CX | SCB_STATUS_CNA) -#define SCB_INTACK_RX (SCB_STATUS_FR | SCB_STATUS_RNR) - -// ------------------------------------------------------------------------ -// -// 82559 PORT INTERFACE COMMANDS -// -// ------------------------------------------------------------------------ -#define I82559_RESET 0x00000000 // software reset -#define I82559_SELFTEST 0x00000001 // 82559 selftest command -#define I82559_SELECTIVE_RESET 0x00000002 -#define I82559_DUMP 0x00000003 -#define I82559_DUMP_WAKEUP 0x00000007 - - - -// ------------------------------------------------------------------------ -// -// 82559 EEPROM INTERFACE -// -// ------------------------------------------------------------------------ -// EEPROM_Ctrl bits. -#define EE_SHIFT_CLK 0x01 // EEPROM shift clock. -#define EE_CS 0x02 // EEPROM chip select. -#define EE_DATA_WRITE 0x04 // EEPROM chip data in. -#define EE_DATA_READ 0x08 // EEPROM chip data out. -#define EE_ENB (0x4800 | EE_CS) - -// Delay between EEPROM clock transitions. -#define eeprom_delay(usec) udelay(usec); - -// The EEPROM commands include the always-set leading bit. -#define EE_WRITE_CMD(a) (5 << (a)) -#define EE_READ_CMD(a) (6 << (a)) -#define EE_ERASE_CMD(a) (7 << (a)) -#define EE_WRITE_EN_CMD(a) (19 << ((a)-2)) -#define EE_WRITE_DIS_CMD(a) (16 << ((a)-2)) -#define EE_ERASE_ALL_CMD(a) (18 << ((a)-2)) - -#define EE_TOP_CMD_BIT(a) ((a)+2) // Counts down to zero -#define EE_TOP_DATA_BIT (15) // Counts down to zero - -#define EEPROM_ENABLE_DELAY (10) // Delay at chip select - -#define EEPROM_SK_DELAY (2) // Delay between clock edges *and* data - // read or transition; 3 of these per bit. -#define EEPROM_DONE_DELAY (100) // Delay when all done - - -// ------------------------------------------------------------------------ -// -// SYSTEM CONTROL BLOCK COMMANDS -// -// ------------------------------------------------------------------------ -// CU COMMANDS -#define CU_NOP 0x0000 -#define CU_START 0x0010 -#define CU_RESUME 0x0020 -#define CU_STATSADDR 0x0040 // Load Dump Statistics ctrs addr -#define CU_SHOWSTATS 0x0050 // Dump statistics counters. -#define CU_ADDR_LOAD 0x0060 // Base address to add to CU commands -#define CU_DUMPSTATS 0x0070 // Dump then reset stats counters. - -// RUC COMMANDS -#define RUC_NOP 0x0000 -#define RUC_START 0x0001 -#define RUC_RESUME 0x0002 -#define RUC_ABORT 0x0004 -#define RUC_ADDR_LOAD 0x0006 // (seems not to clear on acceptance) -#define RUC_RESUMENR 0x0007 - -#define SCB_M 0x0100 // 0 = enable interrupt, 1 = disable -#define SCB_SI 0x0200 // 1 - cause device to interrupt - -#define CU_STATUS_MASK 0x00C0 -#define RU_STATUS_MASK 0x003C - -#define RU_STATUS_IDLE (0<<2) -#define RU_STATUS_SUS (1<<2) -#define RU_STATUS_NORES (2<<2) -#define RU_STATUS_READY (4<<2) -#define RU_STATUS_NO_RBDS_SUS ((1<<2)|(8<<2)) -#define RU_STATUS_NO_RBDS_NORES ((2<<2)|(8<<2)) -#define RU_STATUS_NO_RBDS_READY ((4<<2)|(8<<2)) - - - -#define MAX_MEM_RESERVED_IOCTL 1000 - -// ------------------------------------------------------------------------ -// -// RECEIVE FRAME DESCRIPTORS -// -// ------------------------------------------------------------------------ -typedef struct rfd { - volatile union { - cyg_uint32 u32_status; // result of receive operation - cyg_uint16 u16_status[2]; - } u_status; - volatile cyg_uint32 link; // offset from RU base to next RFD - volatile cyg_uint32 rdb_address; // pointer to Rx data buffer - volatile cyg_uint32 count:14, // number of bytes received + - f:1, // + EOF & F flags - eof:1, - size:16; // size of the data buffer - volatile cyg_uint8 buffer[0]; // data buffer (simple mode) -} RFD; - -// The status is split into two shorts to get atomic access to the EL bit; -// the upper word is not written by the device, so we can just hit it, -// leaving the lower word (which the device updates) alone. Otherwise -// there's a race condition between software moving the end-of-list (EL) -// bit round and the device writing into the previous slot. - -#define rxstatus u_status.u32_status -#define rxstatus_hi u_status.u16_status[1] -#define rxstatus_lo u_status.u16_status[0] - -#define RFD_STATUS_EL 0x80000000 // 1=last RFD in RFA -#define RFD_STATUS_S 0x40000000 // 1=suspend RU after receiving frame -#define RFD_STATUS_H 0x00100000 // 1=RFD is a header RFD -#define RFD_STATUS_SF 0x00080000 // 0=simplified, 1=flexible mode -#define RFD_STATUS_C 0x00008000 // completion of received frame -#define RFD_STATUS_OK 0x00002000 // frame received with no errors - -#define RFD_STATUS_HI_EL 0x8000 // 1=last RFD in RFA -#define RFD_STATUS_HI_S 0x4000 // 1=suspend RU after receiving frame -#define RFD_STATUS_HI_H 0x0010 // 1=RFD is a header RFD -#define RFD_STATUS_HI_SF 0x0008 // 0=simplified, 1=flexible mode - -#define RFD_STATUS_LO_C 0x8000 // completion of received frame -#define RFD_STATUS_LO_OK 0x2000 // frame received with no errors - -#define RFD_RX_CRC 0x00000800 // crc error -#define RFD_RX_ALIGNMENT 0x00000400 // alignment error -#define RFD_RX_RESOURCE 0x00000200 // out of space, no resources -#define RFD_RX_DMA_OVER 0x00000100 // DMA overrun -#define RFD_RX_SHORT 0x00000080 // short frame error -#define RFD_RX_LENGTH 0x00000020 // -#define RFD_RX_ERROR 0x00000010 // receive error -#define RFD_RX_NO_ADR_MATCH 0x00000004 // no address match -#define RFD_RX_IA_MATCH 0x00000002 // individual address does not match -#define RFD_RX_TCO 0x00000001 // TCO indication - - -typedef struct rbd { - volatile cyg_uint32 count:14, // bytes used in buffer - f:1, // buffer has been used (filled) - eof:1; // last receive buffer in frame - volatile cyg_uint32 next_rbd; // next RBD (RU base relative) - volatile cyg_uint32 buffer_address; // address of receive data buffer - volatile cyg_uint32 size:15, // size of the associated buffer - el:1; // buffer of this RBD is last -} RBD; - - -// ------------------------------------------------------------------------ -// -// TRANSMIT FRAME DESCRIPTORS -// -// ------------------------------------------------------------------------ -typedef struct txcb { - volatile cyg_uint32 txstatus:16, // result of transmit operation - command:16; // transmit command - volatile cyg_uint32 link; // offset from RU base to next RFD - volatile cyg_uint32 tbd_address; // pointer to Rx data buffer - volatile cyg_uint32 count:15, // number of bytes in transmit buffer - eof:1, - tx_threshold:8, - tbd_number:8; - volatile cyg_uint8 buffer[0]; // data buffer (simple mode) -} TxCB; - - -#define TxCB_CMD_TRANSMIT 0x0004 // transmit command -#define TxCB_CMD_SF 0x0008 // 0=simplified, 1=flexible mode -#define TxCB_CMD_NC 0x0010 // 0=CRC insert by controller -#define TxCB_CMD_I 0x2000 // generate interrupt on completion -#define TxCB_CMD_S 0x4000 // suspend on completion -#define TxCB_CMD_EL 0x8000 // last command block in CBL - - -// ------------------------------------------------------------------------ -// -// STRUCTURES ADDED FOR PROMISCUOUS MODE -// -// ------------------------------------------------------------------------ -typedef struct { - cyg_uint32 cb_status_word:13, - cb_ok:1, - cb_dc:1, - cb_complete:1, - cb_cmd:3, - cb_cmd_word:10, - cb_int:1, - cb_suspend:1, - cb_el:1; - cyg_uint32 cb_link_offset; -} CB_STRUCT; - - -typedef struct { - CB_STRUCT cb_entry; - cyg_uint8 config_bytes[24]; -} CONFIG_CMD_STRUCT; - -// ------------------------------------------------------------------------ -// -// STATISTICAL COUNTER STRUCTURE -// -// ------------------------------------------------------------------------ -#ifdef KEEP_STATISTICS -STATISTICS statistics[2]; -I82559_COUNTERS i82559_counters[2]; -#endif // KEEP_STATISTICS - -// ------------------------------------------------------------------------ -// -// DEVICES AND PACKET QUEUES -// -// ------------------------------------------------------------------------ - -#define MAX_RX_PACKET_SIZE 1536 // maximum Rx packet size -#define MAX_TX_PACKET_SIZE 1536 // maximum Tx packet size - - -// This is encapsulated here so that a change to > 2 interfaces can -// easily be accommodated. - -#define IF_BAD_82559( _p_ ) \ - CYG_ASSERT( (&i82559[0] == (_p_)) || (&i82559[1] == (_p_)), \ - "Bad pointer-to-i82559" ); \ - if ( (&i82559[0] != (_p_)) && (&i82559[1] != (_p_)) ) - -// ------------------------------------------------------------------------ -// Instantiate the interfaces that we have: - -// number of interfaces -#define MAX_82559 CYGNUM_DEVS_ETH_ARM_EBSA285_DEV_COUNT - -I82559 i82559[MAX_82559]; // i82559 device info. structure - -// eth0 - -ETH_DRV_SC(ebsa285_sc0, - &i82559[0], // Driver specific data - "eth0", // Name for this interface - i82559_start, - i82559_stop, - i82559_ioctl, - i82559_can_send, - i82559_send, - i82559_recv, - i82559_deliver, - i82559_poll, - i82559_int_vector - ); - -NETDEVTAB_ENTRY(ebsa285_netdev0, - "ebsa285-0", - ebsa285_i82559_init, - &ebsa285_sc0); - -#if (MAX_82559 > 1) - -// eth1 - -ETH_DRV_SC(ebsa285_sc1, - &i82559[1], // Driver specific data - "eth1", // Name for this interface - i82559_start, - i82559_stop, - i82559_ioctl, - i82559_can_send, - i82559_send, - i82559_recv, - i82559_deliver, - i82559_poll, - i82559_int_vector - ); - -NETDEVTAB_ENTRY(ebsa285_netdev1, - "ebsa285-1", - ebsa285_i82559_init, - &ebsa285_sc1); - -#else -int ebsa285_netdev1 = -1; // for asserts about valid addresses -int ebsa285_sc1 = -1; -#endif // eth1 is included - -// This is in a macro so that if more devices arrive it can easily be changed -#define CHECK_NDP_SC_LINK() CYG_MACRO_START \ - CYG_ASSERT( ((void *)ndp == (void *)&ebsa285_netdev0) || \ - ((void *)ndp == (void *)&ebsa285_netdev1), "Bad ndp" ); \ - CYG_ASSERT( ((void *)sc == (void *)&ebsa285_sc0) || \ - ((void *)sc == (void *)&ebsa285_sc1), "Bad sc" ); \ - CYG_ASSERT( (void *)p_i82559 == sc->driver_private, "sc pointer bad" );\ -CYG_MACRO_END - -// ------------------------------------------------------------------------ -// -// Managing the memory that is windowed onto the PCI bus -// -// ------------------------------------------------------------------------ - -static cyg_uint32 i82559_heap_size; -static cyg_uint8 *i82559_heap_base; -static cyg_uint8 *i82559_heap_free; - -static void *mem_reserved_ioctl = (void*)0; -// uncacheable memory reserved for ioctl calls - -// ------------------------------------------------------------------------ -// -// FUNCTION PROTOTYPES -// -// ------------------------------------------------------------------------ - -static int pci_init_find_82559s(void); - -static void i82559_reset(struct i82559* p_i82559); - -static void InitRxRing(struct i82559* p_i82559); -static void ResetRxRing(struct i82559* p_i82559); -static void InitTxRing(struct i82559* p_i82559); -static void ResetTxRing(struct i82559* p_i82559); - -#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_WRITE_EEPROM -static void program_eeprom(cyg_uint32 , cyg_uint32 , cyg_uint8 * ); -#endif -#ifdef CYGPKG_NET -static int i82559_configure(struct i82559* p_i82559, int promisc, int oversized); -#endif - -// debugging/logging only: -void dump_txcb(TxCB *p_txcb); -void DisplayStatistics(void); -void update_statistics(struct i82559* p_i82559); -void dump_rfd(RFD *p_rfd, int anyway ); -void dump_all_rfds( int intf ); -void dump_packet(cyg_uint8 *p_buffer, int length); - -// ------------------------------------------------------------------------ -// utilities -// ------------------------------------------------------------------------ - -static // inline -void wait_for_cmd_done(long scb_ioaddr) -{ - register int CSRstatus; - register int wait = 0x100000; - do CSRstatus = INB(scb_ioaddr + SCBCmd) ; - while( CSRstatus && --wait >= 0); - CYG_ASSERT( wait > 0, "wait_for_cmd_done" ); -} - -// Short circuit the drv_interrupt_XXX API once we are started: - -static inline int Mask82559Interrupt(struct i82559* p_i82559) -{ - int cpu_intr; - int old; - int mybits = - (1 << (p_i82559->vector)) | - (1 << CYGNUM_HAL_INTERRUPT_PCI_IRQ); - - HAL_DISABLE_INTERRUPTS( cpu_intr ); - old = *SA110_IRQCONT_IRQENABLE; - *SA110_IRQCONT_IRQENABLECLEAR = mybits; // clear mybits - HAL_RESTORE_INTERRUPTS( cpu_intr ); - - /* it may prove necessary to do something like this - if ( mybits != (mybits & old) ) - /# then at least one of them was disabled, so - # omit both from any restoration: #/ - old = 0; - */ - - return old; -} - -static inline void UnMask82559Interrupt(struct i82559* p_i82559, int old) -{ - // We must only unmask (enable) those which were unmasked before, - // according to the bits in old. - *SA110_IRQCONT_IRQENABLESET = old & - ((1 << (p_i82559->vector)) | - (1 << CYGNUM_HAL_INTERRUPT_PCI_IRQ)); -} - -#ifdef CYGDBG_USE_ASSERTS // an indication of a debug build -static int acknowledge82559interrupt_compensating = 0; -#endif - -static void Acknowledge82559Interrupt(struct i82559* p_i82559) -{ - int sources, mask; - cyg_uint32 ioaddr; - cyg_uint16 status; - int loops = 64; - - // EBSA does nothing in interrupt_acknowledge, so we can comment these - // all out. So this routine really boils down to - // "wait for the device to stop interrupting before we unmask" - // The calls are all left in place, for documentary purposes. - - cyg_drv_interrupt_acknowledge(p_i82559->vector); - cyg_drv_interrupt_acknowledge(CYGNUM_HAL_INTERRUPT_PCI_IRQ); - - // It appears that some time can be taken before the interrupt source - // *really* quietens down... this is ugly, but effective. - // Without it, we get "Spurious Interrupt!" failures. - ioaddr = p_i82559->io_address; // get I/O address for 82559 - mask = (1 << p_i82559->vector); // Do not include the MUX vector or we - sources = *SA110_IRQCONT_IRQSTATUS; //...get hung on the other 82559 - status = INW(ioaddr + SCBStatus); - while ( ((0 != (sources & mask)) || (0 != (status & SCB_INTACK_MASK))) - && --loops >= 0) { - OUTW( status & SCB_INTACK_MASK, ioaddr + SCBStatus); - cyg_drv_interrupt_acknowledge(p_i82559->vector); - cyg_drv_interrupt_acknowledge(CYGNUM_HAL_INTERRUPT_PCI_IRQ); -#ifdef CYGDBG_USE_ASSERTS - acknowledge82559interrupt_compensating++; // verify this is executed -#endif - sources = *SA110_IRQCONT_IRQSTATUS; - status = INW(ioaddr + SCBStatus); - } - CYG_ASSERT( loops >= 0, "Acknowledge82559Interrupt" ); -} - - -static void udelay(int delay) -{ - int i; - // the loop is going to take 3 ticks. At 228 MHz, to give uS, multiply - // by 228/3 = 76 near enough. No volatile is needed on i; gcc recognizes - // delay loops and does NOT elide them. - for ( i = 76 * delay; i ; i--) - ; -} - -// ------------------------------------------------------------------------ -// Memory management -// -// Simply carve off from the front of the PCI mapped window into real memory - -static void *pciwindow_mem_alloc(int size) -{ - void *p_memory; - int _size = size; - - CYG_ASSERT( - (CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE <= (int)i82559_heap_free) - && - ((CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE + - CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_SIZE) > (int)i82559_heap_free) - && - (0 < i82559_heap_size) - && - (CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_SIZE >= i82559_heap_size) - && - (CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE == (int)i82559_heap_base), - "Heap variables corrupted" ); - - p_memory = (void *)0; - size = (size + 3) & ~3; - if ( (i82559_heap_free+size) < (i82559_heap_base+i82559_heap_size) ) { - cyg_uint32 *p; - p_memory = (void *)i82559_heap_free; - i82559_heap_free += size; - for ( p = (cyg_uint32 *)p_memory; _size > 0; _size -= 4 ) - *p++ = 0; - } - - return p_memory; -} - - - -// ------------------------------------------------------------------------ -// -// GET EEPROM SIZE -// -// ------------------------------------------------------------------------ -static int get_eeprom_size(long ioaddr) -{ - unsigned short retval = 0; - int ee_addr = ioaddr + SCBeeprom; - int i, addrbits; - - // Should already be not-selected, but anyway: - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_ENABLE_DELAY); - OUTW(EE_ENB, ee_addr); - eeprom_delay(EEPROM_ENABLE_DELAY); - - // Shift the read command bits out. - for (i = 2; i >= 0; i--) { - short dataval = (6 & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(EE_ENB | dataval , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB | dataval , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - } - // Now clock out address zero, looking for the dummy 0 data bit - for ( i = 1; i <= 12; i++ ) { - OUTW(EE_ENB , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB | EE_SHIFT_CLK, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - retval = INW(ee_addr) & EE_DATA_READ; - if ( 0 == retval ) - break; // The dummy zero est arrive' - } - -#ifdef DEBUG_EE - os_printf( "eeprom data bits %d (ioaddr %x)\n", i, ee_addr ); -#endif - if ( 6 != i && 8 != i ) { -#ifdef DEBUG_EE - os_printf( "*****EEPROM data bits not 6 or 8*****\n" ); -#endif - i = 6; - } - addrbits = i; - - // clear the dataval, leave the clock low to read in the data regardless - OUTW(EE_ENB, ee_addr); - eeprom_delay(1); - - retval = INW(ee_addr); - if ( (EE_DATA_READ & retval) != 0 ) { -#ifdef DEBUG_EE - os_printf( "Size EEPROM: Dummy data bit not 0, reg %x\n" , retval ); -#endif - } - eeprom_delay(1); - - for (i = EE_TOP_DATA_BIT; i >= 0; i--) { - OUTW(EE_ENB | EE_SHIFT_CLK, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - retval = INW(ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - } - - // Terminate the EEPROM access. - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_DONE_DELAY); - - return addrbits; -} - - -// ------------------------------------------------------------------------ -// -// READ EEPROM -// -// ------------------------------------------------------------------------ -static int read_eeprom(long ioaddr, int location, int addr_len) -{ - unsigned short retval = 0; - int ee_addr = ioaddr + SCBeeprom; - int read_cmd = location | EE_READ_CMD(addr_len); - int i, tries = 10; - - try_again: - // Should already be not-selected, but anyway: - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_ENABLE_DELAY); - OUTW(EE_ENB, ee_addr); - eeprom_delay(EEPROM_ENABLE_DELAY); - - // Shift the read command bits out, changing only one bit per time. - for (i = EE_TOP_CMD_BIT(addr_len); i >= 0; i--) { - short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(EE_ENB | dataval , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB | dataval , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - } - - // clear the dataval, leave the clock low - OUTW(EE_ENB, ee_addr); - eeprom_delay(1); - - retval = INW(ee_addr); - // This should show a zero in the data read bit to confirm that the - // address transfer is compelete. If not, go to the start and try - // again! - if ( (0 != (retval & EE_DATA_READ)) && (tries-- > 0) ) { - // Terminate the EEPROM access. - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_DONE_DELAY); -#ifdef DEBUG_EE - os_printf( "Warning: Retrying EEPROM read word %d, address %x, try %d\n", - location, ee_addr, tries+1 ); -#endif - goto try_again; - } - - // This fires with one device on one of the customer boards! - // (but is OK on all other h/w. Worrying huh.) - if ( (EE_DATA_READ & retval) != 0 ) { -#ifdef DEBUG_EE - os_printf( "Read EEPROM: Dummy data bit not 0, reg %x\n" , retval ); -#endif - } - eeprom_delay(1); - retval = 0; - - for (i = EE_TOP_DATA_BIT; i >= 0; i--) { - OUTW(EE_ENB | EE_SHIFT_CLK, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - retval = (retval << 1) | ((INW(ee_addr) & EE_DATA_READ) ? 1 : 0); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - } - - // Terminate the EEPROM access. - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_DONE_DELAY); - - return retval; -} - - -// ------------------------------------------------------------------------ -// -// NETWORK INTERFACE INITIALIZATION -// -// Function : Init82559 -// -// Description : -// This routine resets, configures, and initializes the chip. -// It also clears the ethernet statistics structure, and selects -// which statistics are supported by this driver. -// -// ------------------------------------------------------------------------ -static bool -ebsa285_i82559_init(struct cyg_netdevtab_entry * ndp) -{ - static int initialized = 0; // only probe PCI et al *once* - - struct eth_drv_sc *sc; - cyg_uint32 selftest; - volatile cyg_uint32 *p_selftest; - cyg_uint32 ioaddr; - cyg_uint16 checksum; - int count; - int i, ints; - int addr_length; - cyg_uint8 mac_address[6]; - struct i82559 *p_i82559; - -#ifdef DEBUG - db_printf("ebsa285_i82559_init\n"); -#endif - - sc = (struct eth_drv_sc *)(ndp->device_instance); - p_i82559 = (struct i82559 *)(sc->driver_private); - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "Bad device private pointer %x\n", sc->driver_private ); -#endif - return 0; - } - - CHECK_NDP_SC_LINK(); - - if ( 0 == initialized++ ) { - // then this is the first time ever: - if ( ! pci_init_find_82559s() ) { -#ifdef DEBUG - os_printf( "pci_init_find_82559s failed" ); -#endif - return 0; - } - } - - if ( ! p_i82559->found ) // no device on PCI bus - return (0); - - ioaddr = p_i82559->io_address; // get I/O address for 82559 - -#ifdef DEBUG - os_printf("Init82559 %d @ %x\n82559 Self Test\n", - p_i82559->index, (int)ndp); -#endif - - ints = Mask82559Interrupt(p_i82559); - - wait_for_cmd_done(ioaddr); // make sure no command operating - - i82559_reset(p_i82559); - - // Perform a system self-test. (get enough mem to round address) - if ( (selftest = (cyg_uint32)pciwindow_mem_alloc(32) ) == 0) - return (0); - p_selftest = (cyg_uint32 *) ((selftest + 15) & ~0xf); - p_selftest[0] = p_selftest[1] = -1; - - OUTL( (VIRT_TO_BUS(p_selftest)) | I82559_SELFTEST, ioaddr + SCBPort); - count = 0x7FFFF; // Timeout for self-test. - do { - udelay(10); - } while ( (p_selftest[1] == -1) && (--count >= 0) ); - - Acknowledge82559Interrupt(p_i82559); - UnMask82559Interrupt(p_i82559, ints ); - - if (count < 0) { - // Test timed out. -#ifdef DEBUG - os_printf("Self test failed\n"); -#endif - return (0); - } -#ifdef DEBUG - os_printf(" General self-test: %s.\n" - " Serial sub-system self-test: %s.\n" - " Internal registers self-test: %s.\n" - " ROM checksum self-test: %s (%08X).\n", - p_selftest[1] & 0x1000 ? "failed" : "passed", - p_selftest[1] & 0x0020 ? "failed" : "passed", - p_selftest[1] & 0x0008 ? "failed" : "passed", - p_selftest[1] & 0x0004 ? "failed" : "passed", - p_selftest[0]); -#endif - - // read eeprom and get 82559's mac address - addr_length = get_eeprom_size(ioaddr); - // (this is the length of the *EEPROM*s address, not MAC address) - - for (checksum = 0, i = 0, count = 0; count < 64; count++) { - cyg_uint16 value; - // read word from eeprom - value = read_eeprom(ioaddr, count, addr_length); -#ifdef DEBUG_EE - // os_printf( "%2d: %04x\n", count, value ); -#endif - checksum += value; - if (count < 3) { - mac_address[i++] = value & 0xFF; - mac_address[i++] = (value >> 8) & 0xFF; - } - } - - // If the EEPROM checksum is wrong, the MAC address read from the - // EEPROM is probably wrong as well. In that case, we don't set - // mac_addr_ok, but continue the initialization. If then somebody calls - // i82559_start without calling eth_set_mac_address() first, we refuse - // to bring up the interface, because running with an invalid MAC - // address is not a very brilliant idea. - - if ((checksum & 0xFFFF) != 0xBABA) { - // selftest verified checksum, verify again -#ifdef DEBUG_EE - os_printf( "Warning: Invalid EEPROM checksum %04X for device %d\n", - checksum, p_i82559->index); -#endif - } else { - p_i82559->mac_addr_ok = 1; -#ifdef DEBUG_EE - os_printf("Valid EEPROM checksum\n"); -#endif - } -#ifdef DEBUG - os_printf("MAC Address = %02X %02X %02X %02X %02X %02X\n", - mac_address[0], mac_address[1], mac_address[2], mac_address[3], - mac_address[4], mac_address[5]); -#endif - - // record the MAC address in the device structure - p_i82559->mac_address[0] = mac_address[0]; - p_i82559->mac_address[1] = mac_address[1]; - p_i82559->mac_address[2] = mac_address[2]; - p_i82559->mac_address[3] = mac_address[3]; - p_i82559->mac_address[4] = mac_address[4]; - p_i82559->mac_address[5] = mac_address[5]; - - // and record the net dev pointer - p_i82559->ndp = (void *)ndp; - - InitRxRing(p_i82559); - InitTxRing(p_i82559); - - // Initialize upper level driver - if ( p_i82559->mac_addr_ok ) - (sc->funs->eth_drv->init)(sc, &(p_i82559->mac_address[0]) ); - else - (sc->funs->eth_drv->init)(sc, 0 ); - - return (1); -} - -// ------------------------------------------------------------------------ -// -// Function : i82559_start -// -// ------------------------------------------------------------------------ -static void i82559_start( struct eth_drv_sc *sc, - unsigned char *enaddr, int flags ) -{ - struct i82559 *p_i82559; - cyg_uint32 ioaddr; -#ifdef KEEP_STATISTICS - void *p_statistics; -#endif -#ifdef CYGPKG_NET - struct ifnet *ifp = &sc->sc_arpcom.ac_if; -#endif - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_start: Bad device pointer %x\n", p_i82559 ); -#endif - return; - } - - if ( ! p_i82559->mac_addr_ok ) { -#ifdef DEBUG - os_printf("i82559_start %d: invalid MAC address, " - "can't bring up interface\n", - p_i82559->index ); -#endif - return; - } - - if ( p_i82559->active ) - i82559_stop( sc ); - - ioaddr = p_i82559->io_address; // get 82559's I/O address - -#ifdef KEEP_STATISTICS -#ifdef CYGDBG_DEVS_ETH_ARM_EBSA285_KEEP_82559_STATISTICS - p_i82559->p_statistics = - p_statistics = pciwindow_mem_alloc(sizeof(I82559_COUNTERS)); - memset(p_statistics, 0xFFFFFFFF, sizeof(I82559_COUNTERS)); - wait_for_cmd_done(ioaddr); // make sure no command operating - // set statistics dump address - OUTL(VIRT_TO_BUS(p_statistics), ioaddr + SCBPointer); - OUTW(SCB_M | CU_STATSADDR, ioaddr + SCBCmd); - - wait_for_cmd_done(ioaddr); // make sure no command operating - OUTW(SCB_M | CU_DUMPSTATS, ioaddr + SCBCmd); // start register dump -#endif -#endif - - // Set the base address - wait_for_cmd_done(ioaddr); - OUTL(0, ioaddr + SCBPointer); // load ru base address = 0 - OUTW(SCB_M | RUC_ADDR_LOAD, ioaddr + SCBCmd); - udelay( 1000 ); // load pointer to Rx Ring - OUTL(VIRT_TO_BUS(p_i82559->rx_ring[0]), ioaddr + SCBPointer); - OUTW(RUC_START, ioaddr + SCBCmd); - - p_i82559->active = 1; - -#ifdef CYGPKG_NET - /* Enable promiscuous mode if requested, reception of oversized frames always. - * The latter is needed for VLAN support and shouldn't hurt even if we're not - * using VLANs. - */ - i82559_configure(p_i82559, !!(ifp->if_flags & IFF_PROMISC), 1); -#endif -#ifdef DEBUG - { - int status = i82559_status( sc ); - os_printf("i82559_start %d flg %x Link = %s, %s Mbps, %s Duplex\n", - p_i82559->index, - *(int *)p_i82559, - status & GEN_STATUS_LINK ? "Up" : "Down", - status & GEN_STATUS_100MBPS ? "100" : "10", - status & GEN_STATUS_FDX ? "Full" : "Half"); - } -#endif -} - -// ------------------------------------------------------------------------ -// -// Function : i82559_status -// -// ------------------------------------------------------------------------ -int i82559_status( struct eth_drv_sc *sc ) -{ - int status; - struct i82559 *p_i82559; - cyg_uint32 ioaddr; - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_status: Bad device pointer %x\n", p_i82559 ); -#endif - return 0; - } - - ioaddr = p_i82559->io_address; // get 82559's I/O address - - status = INB(ioaddr + SCBGenStatus); - - return status; -} - -// ------------------------------------------------------------------------ -// -// Function : BringDown82559 -// -// ------------------------------------------------------------------------ - -static void i82559_stop( struct eth_drv_sc *sc ) -{ - struct i82559 *p_i82559; - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_stop: Bad device pointer %x\n", p_i82559 ); -#endif - return; - } - -#ifdef DEBUG - os_printf("i82559_stop %d flg %x\n", p_i82559->index, *(int *)p_i82559 ); -#endif - - p_i82559->active = 0; // stop people tormenting it - i82559_reset(p_i82559); // that should stop it - - ResetRxRing( p_i82559 ); - ResetTxRing( p_i82559 ); -} - - -// ------------------------------------------------------------------------ -// -// Function : InitRxRing -// -// ------------------------------------------------------------------------ -static void InitRxRing(struct i82559* p_i82559) -{ - int i; - RFD *rfd; - RFD *p_rfd = 0; -#ifdef DEBUG_82559 - os_printf("InitRxRing %d\n", p_i82559->index); -#endif - for ( i = 0; i < MAX_RX_DESCRIPTORS; i++ ) { - rfd = (RFD *)pciwindow_mem_alloc(sizeof(RFD) + MAX_RX_PACKET_SIZE); - p_i82559->rx_ring[i] = rfd; - if ( i ) - p_rfd->link = VIRT_TO_BUS(rfd); - p_rfd = (RFD *)rfd; - } - // link last RFD to first: - p_rfd->link = VIRT_TO_BUS(p_i82559->rx_ring[0]); - - ResetRxRing( p_i82559 ); -} - -// ------------------------------------------------------------------------ -// -// Function : ResetRxRing -// -// ------------------------------------------------------------------------ -static void ResetRxRing(struct i82559* p_i82559) -{ - RFD *p_rfd; - int i; -#ifdef DEBUG_82559 - os_printf("ResetRxRing %d\n", p_i82559->index); -#endif - for ( i = 0; i < MAX_RX_DESCRIPTORS; i++ ) { - p_rfd = p_i82559->rx_ring[i]; - CYG_ASSERT( (cyg_uint8 *)p_rfd >= i82559_heap_base, "rfd under" ); - CYG_ASSERT( (cyg_uint8 *)p_rfd < i82559_heap_free, "rfd over" ); - CYG_ASSERT( p_i82559->rx_ring[ - ( i ? (i-1) : (MAX_RX_DESCRIPTORS-1) ) - ]->link == VIRT_TO_BUS(p_rfd), "rfd linked list broken" ); - p_rfd->rxstatus = 0; - p_rfd->count = 0; - p_rfd->f = 0; - p_rfd->eof = 0; - p_rfd->rdb_address = 0xFFFFFFFF; - p_rfd->size = MAX_RX_PACKET_SIZE; - } - p_i82559->next_rx_descriptor = 0; - // And set an end-of-list marker in the previous one. - p_rfd->rxstatus = RFD_STATUS_EL; -} - -// ------------------------------------------------------------------------ -// -// Function : PacketRxReady (Called from delivery thread) -// -// ------------------------------------------------------------------------ -static void PacketRxReady(struct i82559* p_i82559) -{ - RFD *p_rfd; - int next_descriptor; - int length, ints; - struct cyg_netdevtab_entry *ndp; - struct eth_drv_sc *sc; - cyg_uint32 ioaddr; - cyg_uint16 status; - - ndp = (struct cyg_netdevtab_entry *)(p_i82559->ndp); - sc = (struct eth_drv_sc *)(ndp->device_instance); - - CHECK_NDP_SC_LINK(); - - ioaddr = p_i82559->io_address; - - next_descriptor = p_i82559->next_rx_descriptor; - p_rfd = p_i82559->rx_ring[next_descriptor]; - - CYG_ASSERT( (cyg_uint8 *)p_rfd >= i82559_heap_base, "rfd under" ); - CYG_ASSERT( (cyg_uint8 *)p_rfd < i82559_heap_free, "rfd over" ); - - while ( p_rfd->rxstatus & RFD_STATUS_C ) { - p_rfd->rxstatus_hi |= RFD_STATUS_HI_EL; - length = p_rfd->count; - -#ifdef DEBUG_82559 - os_printf( "Device %d (eth%d), rx descriptor %d:\n", - p_i82559->index, p_i82559->index, next_descriptor ); -// dump_rfd( p_rfd, 1 ); -#endif - - p_i82559->next_rx_descriptor = next_descriptor; - // Check for bogusly short packets; can happen in promisc mode: - // Asserted against and checked by upper layer driver. -#ifdef CYGPKG_NET - if ( length > sizeof( struct ether_header ) ) - // then it is acceptable; offer the data to the network stack -#endif - (sc->funs->eth_drv->recv)( sc, length ); - - p_rfd->count = 0; - p_rfd->f = 0; - p_rfd->eof = 0; - p_rfd->rxstatus_lo = 0; - - // The just-emptied slot is now ready for re-use and already marked EL; - // we can now remove the EL marker from the previous one. - if ( 0 == next_descriptor ) - p_rfd = p_i82559->rx_ring[ MAX_RX_DESCRIPTORS-1 ]; - else - p_rfd = p_i82559->rx_ring[ next_descriptor-1 ]; - // The previous one: check it *was* marked before clearing. - CYG_ASSERT( p_rfd->rxstatus_hi & RFD_STATUS_HI_EL, "No prev EL" ); - p_rfd->rxstatus_hi = 0; // that word is not written by the device. - -#ifdef KEEP_STATISTICS - statistics[p_i82559->index].rx_deliver++; -#endif - if (++next_descriptor >= MAX_RX_DESCRIPTORS) - next_descriptor = 0; - p_rfd = p_i82559->rx_ring[next_descriptor]; - - CYG_ASSERT( (cyg_uint8 *)p_rfd >= i82559_heap_base, "rfd under" ); - CYG_ASSERT( (cyg_uint8 *)p_rfd < i82559_heap_free, "rfd over" ); - } - - // See if the RU has gone idle (usually because of out of resource - // condition) and restart it if needs be. - ints = Mask82559Interrupt(p_i82559); - status = INW(ioaddr + SCBStatus); - if ( RU_STATUS_READY != (status & RU_STATUS_MASK) ) { - // Acknowledge the RX INT sources - OUTW( SCB_INTACK_RX, ioaddr + SCBStatus); - // (see pages 6-10 & 6-90) - -#ifdef KEEP_STATISTICS - statistics[p_i82559->index].rx_restart++; -#endif - // There's an end-of-list marker out there somewhere... - // So mop it up; it takes a little time but this is infrequent. - ResetRxRing( p_i82559 ); - next_descriptor = 0; // re-initialize next desc. - // wait for SCB command complete - wait_for_cmd_done(ioaddr); - // load pointer to Rx Ring - OUTL(VIRT_TO_BUS(p_i82559->rx_ring[0]), - ioaddr + SCBPointer); - OUTW(RUC_START, ioaddr + SCBCmd); - Acknowledge82559Interrupt(p_i82559); - } - UnMask82559Interrupt(p_i82559, ints); - - p_i82559->next_rx_descriptor = next_descriptor; -} - -// and the callback function - -static void i82559_recv( struct eth_drv_sc *sc, - struct eth_drv_sg *sg_list, int sg_len ) -{ - struct i82559 *p_i82559; - RFD *p_rfd; - int next_descriptor; - int total_len; - struct eth_drv_sg *last_sg; - volatile cyg_uint8 *from_p; - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_recv: Bad device pointer %x\n", p_i82559 ); -#endif - return; - } - - next_descriptor = p_i82559->next_rx_descriptor; - p_rfd = p_i82559->rx_ring[next_descriptor]; - - CYG_ASSERT( (cyg_uint8 *)p_rfd >= i82559_heap_base, "rfd under" ); - CYG_ASSERT( (cyg_uint8 *)p_rfd < i82559_heap_free, "rfd over" ); - - CYG_ASSERT( p_rfd->rxstatus & RFD_STATUS_C, "No complete frame" ); - CYG_ASSERT( p_rfd->rxstatus & RFD_STATUS_EL, "No marked frame" ); - - CYG_ASSERT( p_rfd->rxstatus_lo & RFD_STATUS_LO_C, "No complete frame 2" ); - CYG_ASSERT( p_rfd->rxstatus_hi & RFD_STATUS_HI_EL, "No marked frame 2" ); - - if ( 0 == (p_rfd->rxstatus & RFD_STATUS_C) ) - return; - - total_len = p_rfd->count; - -#ifdef DEBUG_82559 - os_printf("Rx %d %x (status %x): %d sg's, %d bytes\n", - p_i82559->index, (int)p_i82559, p_rfd->rxstatus, sg_len, total_len); -#endif - - // Copy the data to the network stack - from_p = &p_rfd->buffer[0]; - - // check we have memory to copy into; we would be called even if - // caller was out of memory in order to maintain our state. - if ( 0 == sg_len || 0 == sg_list ) - return; // caller was out of mbufs - - CYG_ASSERT( 0 < sg_len, "sg_len underflow" ); - CYG_ASSERT( MAX_ETH_DRV_SG >= sg_len, "sg_len overflow" ); - - for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) { - cyg_uint8 *to_p; - int l; - - to_p = (cyg_uint8 *)(sg_list->buf); - l = sg_list->len; - - CYG_ASSERT( 0 <= l, "sg length -ve" ); - - if ( 0 >= l || 0 == to_p ) - return; // caller was out of mbufs - - if ( l > total_len ) - l = total_len; - - memcpy( to_p, (unsigned char *)from_p, l ); - from_p += l; - total_len -= l; - } - - CYG_ASSERT( 0 == total_len, "total_len mismatch in rx" ); - CYG_ASSERT( last_sg == sg_list, "sg count mismatch in rx" ); - CYG_ASSERT( &p_rfd->buffer[0] < from_p, "from_p wild in rx" ); - CYG_ASSERT( &p_rfd->buffer[0] + MAX_RX_PACKET_SIZE >= from_p, - "from_p overflow in rx" ); -} - - -// ------------------------------------------------------------------------ -// -// Function : InitTxRing -// -// ------------------------------------------------------------------------ -static void InitTxRing(struct i82559* p_i82559) -{ - int i; - cyg_uint32 ioaddr; - -#ifdef DEBUG_82559 - os_printf("InitTxRing %d\n", p_i82559->index); -#endif - ioaddr = p_i82559->io_address; - for ( i = 0; i < MAX_TX_DESCRIPTORS; i++) { - p_i82559->tx_ring[i] = (TxCB *)pciwindow_mem_alloc( - sizeof(TxCB) + MAX_TX_PACKET_SIZE); - } - - ResetTxRing(p_i82559); -} - -// ------------------------------------------------------------------------ -// -// Function : ResetTxRing -// -// ------------------------------------------------------------------------ -static void ResetTxRing(struct i82559* p_i82559) -{ - int i; - cyg_uint32 ioaddr; - -#ifdef DEBUG_82559 - os_printf("ResetTxRing %d\n", p_i82559->index); -#endif - ioaddr = p_i82559->io_address; - p_i82559->tx_descriptor_add = - p_i82559->tx_descriptor_active = - p_i82559->tx_descriptor_remove = 0; - p_i82559->tx_in_progress = - p_i82559->tx_queue_full = 0; - - for ( i = 0; i < MAX_TX_DESCRIPTORS; i++) { - TxCB *p_txcb = p_i82559->tx_ring[i]; - CYG_ASSERT( (cyg_uint8 *)p_txcb >= i82559_heap_base, "txcb under" ); - CYG_ASSERT( (cyg_uint8 *)p_txcb < i82559_heap_free, "txcb over" ); - - p_txcb->txstatus = 0; - p_txcb->command = 0; - p_txcb->link = VIRT_TO_BUS((cyg_uint32)p_txcb); - p_txcb->tbd_address = 0xFFFFFFFF; - p_txcb->tbd_number = 0; - p_txcb->tx_threshold = 16; - p_txcb->eof = 1; - p_txcb->count = 0; - p_i82559->tx_keys[i] = 0; - } - - wait_for_cmd_done(ioaddr); - OUTL(0, ioaddr + SCBPointer); - OUTW(SCB_M | CU_ADDR_LOAD, ioaddr + SCBCmd); -} - -// ------------------------------------------------------------------------ -// -// Function : TxMachine (Called from FG & ISR) -// -// This steps the Tx Machine onto the next record if necessary - allowing -// for missed interrupts, and so on. -// ------------------------------------------------------------------------ - -static void TxMachine(struct i82559* p_i82559) -{ - int tx_descriptor_active; - cyg_uint32 ioaddr; - - tx_descriptor_active = p_i82559->tx_descriptor_active; - ioaddr = p_i82559->io_address; - - // See if the CU is idle when we think it isn't; this is the only place - // tx_descriptor_active is advanced. (Also recovers from a dropped intr) - if ( p_i82559->tx_in_progress ) { - cyg_uint16 status; - status = INW(ioaddr + SCBStatus); - if ( 0 == (status & CU_STATUS_MASK) ) { - // It is idle. So ack the TX interrupts - OUTW( SCB_INTACK_TX, ioaddr + SCBStatus); - // (see pages 6-10 & 6-90) - - // and step on to the next queued tx. - p_i82559->tx_in_progress = 0; - if ( ++tx_descriptor_active >= MAX_TX_DESCRIPTORS ) - tx_descriptor_active = 0; - p_i82559->tx_descriptor_active = tx_descriptor_active; - } - } - - // is the CU idle, and there a next tx to set going? - if ( ( ! p_i82559->tx_in_progress ) - && (( p_i82559->tx_descriptor_add != tx_descriptor_active ) - || p_i82559->tx_queue_full ) ) { - TxCB *p_txcb; - p_txcb = p_i82559->tx_ring[tx_descriptor_active]; - CYG_ASSERT( (cyg_uint8 *)p_txcb >= i82559_heap_base, "txcb under" ); - CYG_ASSERT( (cyg_uint8 *)p_txcb < i82559_heap_free, "txcb over" ); -#ifdef DEBUG_82559 - os_printf("Tx %d %x: Starting Engines, KEY %x\n", - p_i82559->index, (int)p_i82559, key ); -#endif - // make sure no command operating - wait_for_cmd_done(ioaddr); - // start Tx operation - OUTL(VIRT_TO_BUS(p_txcb), ioaddr + SCBPointer); - OUTW(CU_START, ioaddr + SCBCmd); - p_i82559->tx_in_progress = 1; - } -} - -// ------------------------------------------------------------------------ -// -// Function : TxDone (Called from delivery thread) -// -// This returns Tx's from the Tx Machine to the stack (ie. reports -// completion) - allowing for missed interrupts, and so on. -// ------------------------------------------------------------------------ - -static void TxDone(struct i82559* p_i82559) -{ - struct cyg_netdevtab_entry *ndp; - struct eth_drv_sc *sc; - int tx_descriptor_remove = p_i82559->tx_descriptor_remove; - - ndp = (struct cyg_netdevtab_entry *)(p_i82559->ndp); - sc = (struct eth_drv_sc *)(ndp->device_instance); - - CHECK_NDP_SC_LINK(); - - // "Done" txen are from here to active, OR - // the remove one if the queue is full AND its status is nonzero: - while ( (tx_descriptor_remove != p_i82559->tx_descriptor_active) || - ( p_i82559->tx_queue_full && - (0 != p_i82559->tx_ring[ tx_descriptor_remove ]->txstatus) ) ) { - unsigned long key = p_i82559->tx_keys[ tx_descriptor_remove ]; - // Zero the key in global state before the callback: - p_i82559->tx_keys[ tx_descriptor_remove ] = 0; -#ifdef DEBUG_82559 - os_printf("TxDone %d %x: KEY %x\n", - p_i82559->index, (int)p_i82559, key ); -#endif - // tx_done() can now cope with a NULL key, no guard needed here - (sc->funs->eth_drv->tx_done)( sc, key, 1 /* status */ ); - - if ( ++tx_descriptor_remove >= MAX_TX_DESCRIPTORS ) - tx_descriptor_remove = 0; - p_i82559->tx_descriptor_remove = tx_descriptor_remove; - p_i82559->tx_queue_full = 0; - } -} - - -// ------------------------------------------------------------------------ -// -// Function : i82559_can_send -// -// ------------------------------------------------------------------------ - -static int -i82559_can_send(struct eth_drv_sc *sc) -{ - struct i82559 *p_i82559; - int ints; - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_send: Bad device pointer %x\n", p_i82559 ); -#endif - return 0; - } - - // Advance TxMachine atomically - ints = Mask82559Interrupt(p_i82559); - TxMachine(p_i82559); - Acknowledge82559Interrupt(p_i82559); // This can eat an Rx interrupt, so - PacketRxReady(p_i82559); - UnMask82559Interrupt(p_i82559,ints); - - return ! p_i82559->tx_queue_full; -} - -// ------------------------------------------------------------------------ -// -// Function : i82559_send -// -// ------------------------------------------------------------------------ - -static void -i82559_send(struct eth_drv_sc *sc, - struct eth_drv_sg *sg_list, int sg_len, int total_len, - unsigned long key) -{ - struct i82559 *p_i82559; - int tx_descriptor_add, ints; - TxCB *p_txcb; - cyg_uint32 ioaddr; - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_send: Bad device pointer %x\n", p_i82559 ); -#endif - return; - } - -#ifdef DEBUG_82559 - os_printf("Tx %d %x: %d sg's, %d bytes, KEY %x\n", - p_i82559->index, (int)p_i82559, sg_len, total_len, key ); -#endif - - if ( ! p_i82559->active ) - return; // device inactive, no return -#ifdef KEEP_STATISTICS - statistics[p_i82559->index].tx_count++; -#endif - ioaddr = p_i82559->io_address; // get device I/O address - - if ( p_i82559->tx_queue_full ) { -#ifdef KEEP_STATISTICS - statistics[p_i82559->index].tx_dropped++; -#endif -#ifdef DEBUG_82559 - os_printf( "i82559_send: Queue full, device %x, key %x\n", - p_i82559, key ); -#endif - } - else { - struct eth_drv_sg *last_sg; - volatile cyg_uint8 *to_p; - - tx_descriptor_add = p_i82559->tx_descriptor_add; - - p_i82559->tx_keys[tx_descriptor_add] = key; - - p_txcb = p_i82559->tx_ring[tx_descriptor_add]; - - CYG_ASSERT( (cyg_uint8 *)p_txcb >= i82559_heap_base, "txcb under" ); - CYG_ASSERT( (cyg_uint8 *)p_txcb < i82559_heap_free, "txcb over" ); - - p_txcb->txstatus = 0; - p_txcb->command = TxCB_CMD_TRANSMIT | TxCB_CMD_S - | TxCB_CMD_I | TxCB_CMD_EL; - p_txcb->link = VIRT_TO_BUS((cyg_uint32)p_txcb); - p_txcb->tbd_address = 0xFFFFFFFF; - p_txcb->tbd_number = 0; - p_txcb->tx_threshold = 16; - p_txcb->eof = 1; - p_txcb->count = total_len; - - // Copy from the sglist into the txcb - to_p = &p_txcb->buffer[0]; - - CYG_ASSERT( 0 < sg_len, "sg_len underflow" ); - CYG_ASSERT( MAX_ETH_DRV_SG >= sg_len, "sg_len overflow" ); - - for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) { - cyg_uint8 *from_p; - int l; - - from_p = (cyg_uint8 *)(sg_list->buf); - l = sg_list->len; - - if ( l > total_len ) - l = total_len; - - memcpy( (unsigned char *)to_p, from_p, l ); - to_p += l; - total_len -= l; - - if ( 0 > total_len ) - break; // Should exit via sg_last normally - } - - CYG_ASSERT( 0 == total_len, "length mismatch in tx" ); - CYG_ASSERT( last_sg == sg_list, "sg count mismatch in tx" ); - CYG_ASSERT( &p_txcb->buffer[0] < to_p, "to_p wild in tx" ); - CYG_ASSERT( &p_txcb->buffer[0] + MAX_TX_PACKET_SIZE >= to_p, - "to_p overflow in tx" ); - - // Next descriptor - if ( ++tx_descriptor_add >= MAX_TX_DESCRIPTORS) - tx_descriptor_add = 0; - p_i82559->tx_descriptor_add = tx_descriptor_add; - - // From this instant, interrupts can advance the world and start, - // even complete, this tx request... - - if ( p_i82559->tx_descriptor_remove == tx_descriptor_add ) - p_i82559->tx_queue_full = 1; - } - - // Try advancing the Tx Machine regardless - - // no more interrupts until started - ints = Mask82559Interrupt(p_i82559); - - // Check that either: - // tx is already active, there is other stuff queued, - // OR this tx just added is the current active one - // OR this tx just added is already complete - CYG_ASSERT( - // The machine is busy: - (p_i82559->tx_in_progress == 1) || - // or: The machine is idle and this just added is the next one - (((p_i82559->tx_descriptor_add-1) == p_i82559->tx_descriptor_active) - || ((0 == p_i82559->tx_descriptor_add) && - ((MAX_TX_DESCRIPTORS-1) == p_i82559->tx_descriptor_active))) || - // or: This tx is already complete - (p_i82559->tx_descriptor_add == p_i82559->tx_descriptor_active), - "Active/add mismatch" ); - - // Advance TxMachine atomically - TxMachine(p_i82559); - Acknowledge82559Interrupt(p_i82559); // This can eat an Rx interrupt, so - PacketRxReady(p_i82559); - UnMask82559Interrupt(p_i82559, ints); -} - -// ------------------------------------------------------------------------ -// -// Function : i82559_reset -// -// ------------------------------------------------------------------------ -static void i82559_reset(struct i82559* p_i82559) -{ - cyg_uint32 ioaddr; - int count; - - ioaddr = p_i82559->io_address; - // make sure no command operating - wait_for_cmd_done(ioaddr); - - OUTL(I82559_SELECTIVE_RESET, ioaddr + SCBPort); - - for (count = 10 ; count-- ; ) { - udelay(1000); - } - - OUTL(I82559_RESET, ioaddr + SCBPort); - - for (count = 10 ; count-- ; ) { - udelay(1000); - } -} - - -// ------------------------------------------------------------------------ -// -// INTERRUPT HANDLERS -// -// ------------------------------------------------------------------------ - -static cyg_uint32 eth_isr(cyg_vector_t vector, cyg_addrword_t data) -{ - struct i82559* p_i82559 = (struct i82559 *)data; - cyg_uint16 status; - cyg_uint32 ioaddr; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_isr: Bad device pointer %x\n", p_i82559 ); -#endif - return 0; - } - - ioaddr = p_i82559->io_address; - status = INW(ioaddr + SCBStatus); - // Acknowledge all INT sources that were active - OUTW( status & SCB_INTACK_MASK, ioaddr + SCBStatus); - // (see pages 6-10 & 6-90) - -#ifdef KEEP_STATISTICS - statistics[p_i82559->index].interrupts++; - - // receiver left ready state ? - if ( status & SCB_STATUS_RNR ) - statistics[p_i82559->index].rx_resource++; - - // frame receive interrupt ? - if ( status & SCB_STATUS_FR ) - statistics[p_i82559->index].rx_count++; - - // transmit interrupt ? - if ( status & SCB_STATUS_CX ) - statistics[p_i82559->index].tx_complete++; -#endif - - // Advance the Tx Machine regardless - TxMachine(p_i82559); - - // it should have settled down now... - Acknowledge82559Interrupt(p_i82559); - - return CYG_ISR_CALL_DSR; // schedule DSR -} - - -// ------------------------------------------------------------------------ -static int mux_device_index = 0; - -static cyg_uint32 eth_mux_isr(cyg_vector_t vector, cyg_addrword_t data) -{ - int device_index = mux_device_index; - struct i82559* p_i82559; - - mux_device_index ^= 1; // look at the other one first next time. - - do { - p_i82559 = &i82559[device_index]; - if ( p_i82559->active ) - (void)eth_isr( vector, (cyg_addrword_t)p_i82559 ); - device_index ^= 1; - } while ( device_index == mux_device_index ); - - return CYG_ISR_CALL_DSR; -} - -// ------------------------------------------------------------------------ - -static -void eth_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) -{ - struct i82559* p_i82559 = (struct i82559 *)data; - struct cyg_netdevtab_entry *ndp = - (struct cyg_netdevtab_entry *)(p_i82559->ndp); - struct eth_drv_sc *sc = (struct eth_drv_sc *)(ndp->device_instance); - - // but here, it must be a *sc: - eth_drv_dsr( vector, count, (cyg_addrword_t)sc ); -} - -// ------------------------------------------------------------------------ -// This is called from the function below (used to be uni-DSR) -static inline void -uni_deliver(struct i82559* p_i82559) -{ - // First pass any rx data up the stack - PacketRxReady(p_i82559); - - // Then scan for completed Txen and inform the stack - TxDone(p_i82559); -} - - -// ------------------------------------------------------------------------ -void i82559_deliver(struct eth_drv_sc *sc) -{ - struct i82559* p_i82559; - int device_index = mux_device_index; - - // Since this must mux both devices, the incoming arg is ignored. - - mux_device_index ^= 1; // look at the other one first next time. - do { - p_i82559 = &i82559[device_index]; - if ( p_i82559->active ) - uni_deliver( p_i82559 ); - device_index ^= 1; - } while ( device_index == mux_device_index ); -} - -// ------------------------------------------------------------------------ -// Device table entry to operate the chip in a polled mode. -// Only diddle the interface we were asked to! - -void i82559_poll(struct eth_drv_sc *sc) -{ - struct i82559 *p_i82559; - int ints; - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_poll: Bad device pointer %x\n", p_i82559 ); -#endif - return; - } - - // Do these atomically - ints = Mask82559Interrupt(p_i82559); - - // As it happens, this driver always requests the DSR to be called: - (void)eth_isr( CYGNUM_HAL_INTERRUPT_PCI_IRQ, (cyg_addrword_t)p_i82559 ); - - // (no harm in calling this ints-off also, when polled) - uni_deliver( p_i82559 ); - - Acknowledge82559Interrupt(p_i82559); - UnMask82559Interrupt(p_i82559, ints); -} - -// ------------------------------------------------------------------------ -// Determine interrupt vector used by a device - for attaching GDB stubs -// packet handler. -int -i82559_int_vector(struct eth_drv_sc *sc) -{ - struct i82559 *p_i82559; - p_i82559 = (struct i82559 *)sc->driver_private; - return (p_i82559->vector); -} - -#if 0 -int -i82559_int_op( struct eth_drv_sc *sc, int mask) -{ - struct i82559 *p_i82559; - p_i82559 = (struct i82559 *)sc->driver_private; - - if ( 1 == mask ) - return Mask82559Interrupt( p_i82559 ); - - if ( 0 == mask ) - UnMask82559Interrupt( p_i82559, 0x0fffffff ); // enable all - - return 0; -} -#endif - - -// ------------------------------------------------------------------------ -// -// Function : pci_init_find_82559s -// -// This is called exactly once at the start of time to: -// o scan the PCI bus for objects -// o record them in the device table -// o acquire all the info needed for the driver to access them -// o instantiate interrupts for them -// o attach those interrupts appropriately -// ------------------------------------------------------------------------ -static cyg_pci_match_func find_82559s_match_func; - -// Intel 82559 and 82557 are virtually identical, with different -// dev codes; also 82559ER (cutdown) = 0x1209. -static cyg_bool -find_82559s_match_func( cyg_uint16 v, cyg_uint16 d, cyg_uint32 c, void *p ) -{ - return - (0x8086 == v) && - ((0x1030 == d) || - (0x1229 == d) || - (0x1209 == d)); -} - -static int -pci_init_find_82559s( void ) -{ - cyg_pci_device_id devid; - cyg_pci_device dev_info; - cyg_uint16 cmd; - int device_index; - - // MUX interrupt - special case when 2 cards share one intr. - static cyg_handle_t mux_interrupt_handle = 0; - static cyg_interrupt mux_interrupt_object; - -#ifdef DEBUG - db_printf("pci_init_find_82559s()\n"); -#endif - - // allocate memory to be used in ioctls later - if (mem_reserved_ioctl != (void*)0) { -#ifdef DEBUG - db_printf("pci_init_find_82559s() called > once\n"); -#endif - return 0; - } - - - CYG_ASSERT( CYGMEM_SECTION_pci_window == - (char *)CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE, - "PCI window configured does not match PCI memory section base" ); - CYG_ASSERT( CYGMEM_SECTION_pci_window_SIZE == - CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_SIZE, - "PCI window configured does not match PCI memory section size" ); - - if ( CYGMEM_SECTION_pci_window != - (char *)CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE - || - CYGMEM_SECTION_pci_window_SIZE != - CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_SIZE ) { -#ifdef DEBUG - db_printf("pci_init_find_82559s(): PCI window misconfigured\n"); -#endif - return 0; - } - - // First initialize the heap in PCI window'd memory - i82559_heap_size = CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_SIZE; - i82559_heap_base = (cyg_uint8 *)CYGHWR_HAL_ARM_EBSA285_PCI_MEM_MAP_BASE; - i82559_heap_free = i82559_heap_base; - - mem_reserved_ioctl = pciwindow_mem_alloc(MAX_MEM_RESERVED_IOCTL); - - cyg_pci_init(); -#ifdef DEBUG - db_printf("Finished cyg_pci_init();\n"); -#endif - - devid = CYG_PCI_NULL_DEVID; - - for (device_index = 0; device_index < MAX_82559; device_index++) { - struct i82559 *p_i82559 = &i82559[device_index]; - - p_i82559->index = device_index; - - // See above for find_82559s_match_func - it selects any of several - // variants. This is necessary in case we have multiple mixed-type - // devices on one board in arbitrary orders. - if (cyg_pci_find_matching( &find_82559s_match_func, NULL, &devid )) { -#ifdef DEBUG - db_printf("eth%d = 82559\n", device_index); -#endif - cyg_pci_get_device_info(devid, &dev_info); - - if (cyg_pci_translate_interrupt(&dev_info, &p_i82559->vector)) { -#ifdef DEBUG - db_printf(" Wired to HAL vector %d\n", p_i82559->vector); -#endif - cyg_drv_interrupt_create( - p_i82559->vector, - 0, // Priority - unused - (CYG_ADDRWORD)p_i82559, // Data item passed to ISR & DSR - eth_isr, // ISR - eth_dsr, // DSR - &p_i82559->interrupt_handle, // handle to intr obj - &p_i82559->interrupt_object ); // space for int obj - - cyg_drv_interrupt_attach(p_i82559->interrupt_handle); - - // Don't unmask the interrupt yet, that could get us into a - // race. - - // ALSO attach it to interrupt #18 for multiplexed - // interrupts. This is for certain boards where the - // PCI backplane is wired "straight through" instead of - // with a rotation of interrupt lines in the different - // slots. - if ( ! mux_interrupt_handle ) { -#ifdef DEBUG - db_printf(" Also attaching to HAL vector %d\n", - CYGNUM_HAL_INTERRUPT_PCI_IRQ); -#endif - cyg_drv_interrupt_create( - CYGNUM_HAL_INTERRUPT_PCI_IRQ, - 0, // Priority - unused - (CYG_ADDRWORD)p_i82559,// Data item passed to ISR and DSR - eth_mux_isr, // ISR - eth_dsr, // DSR - &mux_interrupt_handle, - &mux_interrupt_object ); - - cyg_drv_interrupt_attach(mux_interrupt_handle); - } - } - else { - p_i82559->vector=0; -#ifdef DEBUG - db_printf(" Does not generate interrupts.\n"); -#endif - } - - if (cyg_pci_configure_device(&dev_info)) { -#ifdef DEBUG - int i; - db_printf("Found device on bus %d, devfn 0x%02x:\n", - CYG_PCI_DEV_GET_BUS(devid), - CYG_PCI_DEV_GET_DEVFN(devid)); - - if (dev_info.command & CYG_PCI_CFG_COMMAND_ACTIVE) { - db_printf(" Note that board is active. Probed" - " sizes and CPU addresses invalid!\n"); - } - db_printf(" Vendor 0x%04x", dev_info.vendor); - db_printf("\n Device 0x%04x", dev_info.device); - db_printf("\n Command 0x%04x, Status 0x%04x\n", - dev_info.command, dev_info.status); - - db_printf(" Class/Rev 0x%08x", dev_info.class_rev); - db_printf("\n Header 0x%02x\n", dev_info.header_type); - - db_printf(" SubVendor 0x%04x, Sub ID 0x%04x\n", - dev_info.header.normal.sub_vendor, - dev_info.header.normal.sub_id); - - for(i = 0; i < CYG_PCI_MAX_BAR; i++) { - db_printf(" BAR[%d] 0x%08x /", i, dev_info.base_address[i]); - db_printf(" probed size 0x%08x / CPU addr 0x%08x\n", - dev_info.base_size[i], dev_info.base_map[i]); - } - db_printf(" eth%d configured\n", device_index); -#endif - p_i82559->found = 1; - p_i82559->active = 0; - p_i82559->devid = devid; - p_i82559->memory_address = dev_info.base_map[0]; - p_i82559->io_address = dev_info.base_map[1]; -#ifdef DEBUG - db_printf(" memory address = 0x%08x\n", dev_info.base_map[0]); - db_printf(" I/O address = 0x%08x\n", dev_info.base_map[1]); -#endif - - // Don't use cyg_pci_set_device_info since it clears - // some of the fields we want to print out below. - cyg_pci_read_config_uint16(dev_info.devid, CYG_PCI_CFG_COMMAND, &cmd); - cmd |= CYG_PCI_CFG_COMMAND_IO // enable I/O space - | CYG_PCI_CFG_COMMAND_MEMORY // enable memory space - | CYG_PCI_CFG_COMMAND_MASTER; // enable bus master - cyg_pci_write_config_uint16(dev_info.devid, CYG_PCI_CFG_COMMAND, cmd); - - // Now the PCI part of the device is configured, reset it. This - // should make it safe to enable the interrupt - i82559_reset(p_i82559); - - if (p_i82559->vector != 0) { - cyg_drv_interrupt_acknowledge(p_i82559->vector); - cyg_drv_interrupt_unmask(p_i82559->vector); - } -#ifdef DEBUG - db_printf(" **** Device enabled for I/O and Memory and Bus Master\n"); -#endif - } - else { - p_i82559->found = 0; - p_i82559->active = 0; -#ifdef DEBUG - db_printf("Failed to configure device %d\n",device_index); -#endif - } - } - else { - p_i82559->found = 0; - p_i82559->active = 0; -#ifdef DEBUG - db_printf("eth%d not found\n", device_index); -#endif - } - } - - // Now enable the mux shared interrupt if it is in use - if (mux_interrupt_handle) { - cyg_drv_interrupt_acknowledge(CYGNUM_HAL_INTERRUPT_PCI_IRQ); - cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_PCI_IRQ); - } - - // Now a delay to ensure the hardware has "come up" before you try to - // use it. Yes, really, the full 2 seconds. It's only really - // necessary if DEBUG is off - otherwise all that printout wastes - // enough time. No kidding. - udelay( 2000000 ); - return 1; -} - -#ifdef CYGPKG_NET -// ------------------------------------------------------------------------ -// -// Function : i82559_configure -// -// Return : 0 = It worked. -// non0 = It failed. -// ------------------------------------------------------------------------ - -static int i82559_configure(struct i82559* p_i82559, int promisc, int oversized) -{ - cyg_uint32 ioaddr; - volatile CONFIG_CMD_STRUCT *ccs; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_configure: Bad device pointer %x\n", - p_i82559 ); -#endif - return -1; - } - - ioaddr = p_i82559->io_address; - wait_for_cmd_done(ioaddr); - // load cu base address = 0 */ - OUTL(0, ioaddr + SCBPointer); - // 32 bit linear addressing used - - OUTW(SCB_M | CU_ADDR_LOAD, ioaddr + SCBCmd); - // wait for SCB command complete - wait_for_cmd_done(ioaddr); - - ccs = (CONFIG_CMD_STRUCT *)mem_reserved_ioctl; - - // Check the malloc we did earlier worked - if (ccs == (void*)0) - return 2; // Failed - - ccs->cb_entry.cb_cmd=0x2; - ccs->cb_entry.cb_cmd_word=0x0; - ccs->cb_entry.cb_status_word=0x0; - ccs->cb_entry.cb_int=0; - ccs->cb_entry.cb_suspend=1; - ccs->cb_entry.cb_el=1; - ccs->cb_entry.cb_complete=0; - ccs->cb_entry.cb_link_offset=VIRT_TO_BUS((cyg_uint32)ccs); - - // Default values from the Intel Manual - ccs->config_bytes[0]=0x13; - ccs->config_bytes[1]=0x8; - ccs->config_bytes[2]=0x0; - ccs->config_bytes[3]=0x0; - ccs->config_bytes[4]=0x0; - ccs->config_bytes[5]=0x0; - ccs->config_bytes[6]=0x32 | (promisc ? 0x80 : 0x00); // | 0x32 for small stats, - ccs->config_bytes[7]=0x00 | (promisc ? 0x00 : 0x01); //\ | 0x12 for stats with PAUSE stats - ccs->config_bytes[8]=0x0; // [7]:discard short frames \ | 0x16 for PAUSE + TCO stats - ccs->config_bytes[9]=0x0; - ccs->config_bytes[10]=0x28; - ccs->config_bytes[11]=0x0; - ccs->config_bytes[12]=0x60; - ccs->config_bytes[13]=0x0; // arp - ccs->config_bytes[14]=0x0; // arp - - ccs->config_bytes[15]=0x80 | (promisc ? 1 : 0); // 0x81: promiscuous mode set - // 0x80: normal mode - ccs->config_bytes[16]=0x0; - ccs->config_bytes[17]=0x40; - ccs->config_bytes[18]=0x72 | (oversized ? 8 : 0); // Keep the Padding Enable bit - - // wait for SCB command complete - wait_for_cmd_done(ioaddr); - - OUTL(VIRT_TO_BUS(ccs), ioaddr + SCBPointer); - OUTW(SCB_M | CU_START, ioaddr + SCBCmd); - - udelay(10000); - - // now check for result ... - wait_for_cmd_done(ioaddr); - - if ( (!ccs->cb_entry.cb_ok) || (!ccs->cb_entry.cb_complete) ) - return 1; // Failed - - wait_for_cmd_done(ioaddr); - /* load pointer to Rx Ring */ - - OUTL(VIRT_TO_BUS(p_i82559->rx_ring[0]), - ioaddr + SCBPointer); - OUTW(RUC_START, ioaddr + SCBCmd); - - return 0; // OK -} -#endif - -// ------------------------------------------------------------------------ -// We use this as a templete when writing a new MAC address into the -// eeproms. The MAC address in the first few bytes is over written -// with the correct MAC address and then the whole lot is programmed -// into the serial EEPROM. The checksum is calculated on the fly and -// sent instead of the last two bytes. -// The values are copied from the Intel EtherPro10/100+ &c devices -// in the EBSA boards. - -#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_WRITE_EEPROM - -#define ee00 0x00, 0x00 // shorthand - -static char eeprom_burn[126] = { -/* halfword addresses! */ -/* 0: */ 0x00, 0x90, 0x27, 0x8c, 0x57, 0x82, 0x03, 0x02, -/* 4: */ ee00 , 0x01, 0x02, 0x01, 0x47, ee00 , -/* 8: */ 0x13, 0x72, 0x06, 0x83, 0xa2, 0x40, 0x0c, 0x00, -/* C: */ 0x86, 0x80, ee00 , ee00 , ee00 , -/* 10: */ ee00 , ee00 , ee00 , ee00 , -/* 14: */ ee00 , ee00 , ee00 , ee00 , -/* 18: */ ee00 , ee00 , ee00 , ee00 , -/* 1C: */ ee00 , ee00 , ee00 , ee00 , -/* 20: */ ee00 , ee00 , ee00 , ee00 , -/* 24: */ ee00 , ee00 , ee00 , ee00 , -/* 28: */ ee00 , ee00 , ee00 , ee00 , -/* 2C: */ ee00 , ee00 , ee00 , ee00 , -/* 30: */ 0x28, 0x01, ee00 , ee00 , ee00 , -/* 34: */ ee00 , ee00 , ee00 , ee00 , -/* 38: */ ee00 , ee00 , ee00 , ee00 , -/* 3C: */ ee00 , ee00 , ee00 -}; -#undef ee00 - -#endif - -// ------------------------------------------------------------------------ -// -// Function : eth_set_mac_address -// -// Return : 0 = It worked. -// non0 = It failed. -// ------------------------------------------------------------------------ -static int eth_set_mac_address(struct i82559* p_i82559, char *addr) -{ -#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_WRITE_EEPROM - int checksum, i, count; - // (this is the length of the *EEPROM*s address, not MAC address) - int addr_length; -#endif - cyg_uint32 ioaddr; - volatile CONFIG_CMD_STRUCT *ccs; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "eth_set_mac_address : Bad device pointer %x\n", - p_i82559 ); -#endif - return -1; - } - - ioaddr = p_i82559->io_address; - - wait_for_cmd_done(ioaddr); - - ccs = (CONFIG_CMD_STRUCT *)mem_reserved_ioctl; - if (ccs == (void*)0) - return 2; - - ccs->cb_entry.cb_cmd=0x1; - ccs->cb_entry.cb_cmd_word=0x0; - ccs->cb_entry.cb_status_word=0x0; - ccs->cb_entry.cb_int=0; - ccs->cb_entry.cb_suspend=1; - ccs->cb_entry.cb_el=1; - - memcpy((char *)(ccs->config_bytes),addr,6); - - ccs->config_bytes[6]=0x0; - ccs->config_bytes[7]=0x0; - - ioaddr = p_i82559->io_address; - - OUTL(VIRT_TO_BUS(ccs), ioaddr + SCBPointer); - OUTW(SCB_M | CU_START, ioaddr + SCBCmd); - // Next delay seems to be required, otherwise, - // cb_ok/cb_complete won't be set later. - - udelay(1000); - wait_for_cmd_done(ioaddr); - - // now check for result ... - if ( (!ccs->cb_entry.cb_ok) || (!ccs->cb_entry.cb_complete) ) - return 3; - -#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_WRITE_EEPROM - - addr_length = get_eeprom_size( ioaddr ); - - // now set this address in the device eeprom .... - (void)memcpy(eeprom_burn,addr,6); - - // No idea what these were for... - // eeprom_burn[20] &= 0xfe; - // eeprom_burn[20] |= p_i82559->index; - - program_eeprom( ioaddr, addr_length, eeprom_burn ); - - // update 82559 driver data structure ... - udelay( 100000 ); - - // by reading EEPROM to get the mac address back - for (checksum = 0, i = 0, count = 0; count < 64; count++) { - cyg_uint16 value; - // read word from eeprom - value = read_eeprom(ioaddr, count, addr_length); - checksum += value; - if (count < 3) { - p_i82559->mac_address[i++] = value & 0xFF; - p_i82559->mac_address[i++] = (value >> 8) & 0xFF; - } - } - -#ifdef DEBUG - os_printf("MAC Address = %02X %02X %02X %02X %02X %02X\n", - p_i82559->mac_address[0], p_i82559->mac_address[1], - p_i82559->mac_address[2], p_i82559->mac_address[3], - p_i82559->mac_address[4], p_i82559->mac_address[5]); -#endif - - p_i82559->mac_addr_ok = 1; - - for ( i = 0, count = 0; i < 6; i++ ) - if ( p_i82559->mac_address[i] != addr[i] ) - count++; - - if ( count ) { -#ifdef DEBUG - os_printf( "Warning: MAC Address read back wrong! %d bytes differ.\n", - count ); -#endif - p_i82559->mac_addr_ok = 0; - } - - // If the EEPROM checksum is wrong, the MAC address read from the - // EEPROM is probably wrong as well. In that case, we don't set - // mac_addr_ok. - if ((checksum & 0xFFFF) != 0xBABA) { -#ifdef DEBUG - os_printf( "Warning: Invalid EEPROM checksum %04X for device %d\n", - checksum, p_i82559->index); -#endif - p_i82559->mac_addr_ok = 0; - } -#else - p_i82559->mac_addr_ok = 1; -#endif // ! CYGPKG_DEVS_ETH_ARM_EBSA285_WRITE_EEPROM - - return p_i82559->mac_addr_ok ? 0 : 1; -} - -#ifdef CYGPKG_DEVS_ETH_ARM_EBSA285_WRITE_EEPROM -// ------------------------------------------------------------------------ -static void -write_eeprom(long ioaddr, int location, int addr_len, unsigned short value) -{ - int ee_addr = ioaddr + SCBeeprom; - int write_cmd = location | EE_WRITE_CMD(addr_len); - int i; - - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay( 100 ); - OUTW(EE_ENB, ee_addr); - eeprom_delay( 100 ); - -// os_printf("\n write_eeprom : write_cmd : %x",write_cmd); -// os_printf("\n addr_len : %x value : %x ",addr_len,value); - - /* Shift the write command bits out. */ - for (i = (addr_len+2); i >= 0; i--) { - short dataval = (write_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(EE_ENB | dataval, ee_addr); - eeprom_delay(100); - OUTW(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(150); - } - OUTW(EE_ENB, ee_addr); - - for (i = 15; i >= 0; i--) { - short dataval = (value & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(EE_ENB | dataval, ee_addr); - eeprom_delay(100); - OUTW(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(150); - } - - /* Terminate the EEPROM access. */ - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(150000); // let the write take effect -} - -// ------------------------------------------------------------------------ -static int write_enable_eeprom(long ioaddr, int addr_len) -{ - int ee_addr = ioaddr + SCBeeprom; - int write_en_cmd = EE_WRITE_EN_CMD(addr_len); - int i; - - OUTW(EE_ENB & ~EE_CS, ee_addr); - OUTW(EE_ENB, ee_addr); - -#ifdef DEBUG_82559 - os_printf("write_en_cmd : %x",write_en_cmd); -#endif - - // Shift the wr/er enable command bits out. - for (i = (addr_len+2); i >= 0; i--) { - short dataval = (write_en_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(EE_ENB | dataval, ee_addr); - eeprom_delay(100); - OUTW(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(150); - } - - // Terminate the EEPROM access. - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_DONE_DELAY); -} - - -// ------------------------------------------------------------------------ -static void -program_eeprom(cyg_uint32 ioaddr, cyg_uint32 eeprom_size, cyg_uint8 *data) -{ - cyg_uint32 i; - cyg_uint16 checksum = 0; - cyg_uint16 value; - - // First enable erase/write operations on the eeprom. - // This is done through the EWEN instruction. - write_enable_eeprom( ioaddr, eeprom_size ); - - for (i=0 ; i< 63 ; i++) { - value = ((unsigned short *)data)[i]; - checksum += value; -#ifdef DEBUG_82559 - os_printf("\n i : %x ... value to be written : %x",i,value); -#endif - write_eeprom( ioaddr, i, eeprom_size, value); -#ifdef DEBUG_82559 - os_printf("\n val read : %x ",read_eeprom(ioaddr,i,eeprom_size)); -#endif - } - value = 0xBABA - checksum; -#ifdef DEBUG_82559 - os_printf("\n i : %x ... checksum adjustment val to be written : %x",i,value); -#endif - write_eeprom( ioaddr, i, eeprom_size, value ); -} - -// ------------------------------------------------------------------------ -#endif // ! CYGPKG_DEVS_ETH_ARM_EBSA285_WRITE_EEPROM - - -// ------------------------------------------------------------------------ -// -// Function : eth_get_mac_address -// -// ------------------------------------------------------------------------ -#ifdef ETH_DRV_GET_MAC_ADDRESS -static int eth_get_mac_address(struct i82559* p_i82559, char *addr) -{ - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "eth_get_mac_address : Bad device pointer %x\n", - p_i82559 ); -#endif - return -1; - } - - memcpy( addr, (char *)(&p_i82559->mac_address[0]), 6 ); - return 0; -} -#endif -// ------------------------------------------------------------------------ -// -// Function : i82559_ioctl -// -// ------------------------------------------------------------------------ -static int i82559_ioctl(struct eth_drv_sc *sc, unsigned long key, - void *data, int data_length) -{ - struct i82559 *p_i82559; - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_ioctl/control: Bad device pointer %x\n", p_i82559 ); -#endif - return -1; - } - -#ifdef DEBUG - db_printf( "i82559_ioctl: device eth%d at %x; key is 0x%x, data at %x[%d]\n", - p_i82559->index, p_i82559, key, data, data_length ); -#endif - - switch ( key ) { - -#ifdef ETH_DRV_SET_MAC_ADDRESS - case ETH_DRV_SET_MAC_ADDRESS: - if ( 6 != data_length ) - return -2; - return eth_set_mac_address( p_i82559, data ); -#endif - -#ifdef ETH_DRV_GET_MAC_ADDRESS - case ETH_DRV_GET_MAC_ADDRESS: - return eth_get_mac_address( p_i82559, data ); -#endif - -#ifdef ETH_DRV_GET_IF_STATS_UD - case ETH_DRV_GET_IF_STATS_UD: // UD == UPDATE - ETH_STATS_INIT( sc ); // so UPDATE the statistics structure -#endif - // drop through -#ifdef ETH_DRV_GET_IF_STATS - case ETH_DRV_GET_IF_STATS: -#endif -#if defined(ETH_DRV_GET_IF_STATS) || defined (ETH_DRV_GET_IF_STATS_UD) - { - struct ether_drv_stats *p = (struct ether_drv_stats *)data; - int i; - static unsigned char my_chipset[] - = { ETH_DEV_DOT3STATSETHERCHIPSET }; - - strcpy( p->description, CYGDAT_DEVS_ETH_DESCRIPTION ); - CYG_ASSERT( 48 > strlen(p->description), "Description too long" ); - - for ( i = 0; i < SNMP_CHIPSET_LEN; i++ ) - if ( 0 == (p->snmp_chipset[i] = my_chipset[i]) ) - break; - - i = i82559_status( sc ); - - if ( !( i & GEN_STATUS_LINK) ) { - p->operational = 2; // LINK DOWN - p->duplex = 1; // UNKNOWN - p->speed = 0; - } - else { - p->operational = 3; // LINK UP - p->duplex = (i & GEN_STATUS_FDX) ? 3 : 2; // 2 = SIMPLEX, 3 = DUPLEX - p->speed = ((i & GEN_STATUS_100MBPS) ? 100 : 10) * 1000000; - } - -#ifdef KEEP_STATISTICS - { - I82559_COUNTERS *pc = &i82559_counters[ p_i82559->index ]; - STATISTICS *ps = &statistics[ p_i82559->index ]; - - // Admit to it... - p->supports_dot3 = true; - - // Those commented out are not available on this chip. - - p->tx_good = pc->tx_good ; - p->tx_max_collisions = pc->tx_max_collisions ; - p->tx_late_collisions = pc->tx_late_collisions ; - p->tx_underrun = pc->tx_underrun ; - p->tx_carrier_loss = pc->tx_carrier_loss ; - p->tx_deferred = pc->tx_deferred ; - //p->tx_sqetesterrors = pc->tx_sqetesterrors ; - p->tx_single_collisions = pc->tx_single_collisions; - p->tx_mult_collisions = pc->tx_mult_collisions ; - p->tx_total_collisions = pc->tx_total_collisions ; - p->rx_good = pc->rx_good ; - p->rx_crc_errors = pc->rx_crc_errors ; - p->rx_align_errors = pc->rx_align_errors ; - p->rx_resource_errors = pc->rx_resource_errors ; - p->rx_overrun_errors = pc->rx_overrun_errors ; - p->rx_collisions = pc->rx_collisions ; - p->rx_short_frames = pc->rx_short_frames ; - //p->rx_too_long_frames = pc->rx_too_long_frames ; - //p->rx_symbol_errors = pc->rx_symbol_errors ; - - p->interrupts = ps->interrupts ; - p->rx_count = ps->rx_count ; - p->rx_deliver = ps->rx_deliver ; - p->rx_resource = ps->rx_resource ; - p->rx_restart = ps->rx_restart ; - p->tx_count = ps->tx_count ; - p->tx_complete = ps->tx_complete ; - p->tx_dropped = ps->tx_dropped ; - } -#endif // KEEP_STATISTICS - - p->tx_queue_len = MAX_TX_DESCRIPTORS; - - return 0; // OK - } -#endif - - default: - break; - } - return -1; -} - -// ------------------------------------------------------------------------ -// -// Statistics update... -// -// ------------------------------------------------------------------------ - -#ifdef KEEP_STATISTICS -#ifdef CYGDBG_DEVS_ETH_ARM_EBSA285_KEEP_82559_STATISTICS -void update_statistics(struct i82559* p_i82559) -{ - I82559_COUNTERS *p_statistics; - cyg_uint32 *p_counter; - cyg_uint32 *p_register; - int reg_count, ints; - - ints = Mask82559Interrupt(p_i82559); - - // This points to the sthared memory stats area/command block - p_statistics = (I82559_COUNTERS *)(p_i82559->p_statistics); - - if ( (p_statistics->done & 0xFFFF) == 0xA007 ) { - p_counter = (cyg_uint32 *)&i82559_counters[ p_i82559->index ]; - p_register = (cyg_uint32 *)p_statistics; - for ( reg_count = 0; - reg_count < sizeof( I82559_COUNTERS ) / sizeof( cyg_uint32 ) - 1; - reg_count++ ) { - *p_counter += *p_register; - p_counter++; - p_register++; - } - p_statistics->done = 0; - // make sure no command operating - wait_for_cmd_done(p_i82559->io_address); - // start register dump - OUTW(CU_DUMPSTATS, p_i82559->io_address + SCBCmd); - } - Acknowledge82559Interrupt(p_i82559); // This can eat an Rx interrupt, so - PacketRxReady(p_i82559); - - UnMask82559Interrupt(p_i82559, ints); -} -#endif -#endif // KEEP_STATISTICS - -// ------------------------------------------------------------------------ -// -// -// CODE FOR DEBUGGING PURPOSES ONLY -// -// -// ------------------------------------------------------------------------ -void dump_txcb(TxCB *p_txcb) -{ - os_printf("TxCB @ %x\n", (int)p_txcb); - os_printf("status = %04X ", p_txcb->txstatus); - os_printf("command = %04X ", p_txcb->command); - os_printf("link = %08X ", p_txcb->link); - os_printf("tbd = %08X ", p_txcb->tbd_address); - os_printf("count = %d ", p_txcb->count); - os_printf("eof = %x ", p_txcb->eof); - os_printf("threshold = %d ", p_txcb->tx_threshold); - os_printf("tbd number = %d\n", p_txcb->tbd_number); -} - -// This is intended to be the body of a THREAD that prints stuff every 10 -// seconds or so: -#ifdef KEEP_STATISTICS -#ifdef DISPLAY_STATISTICS -void DisplayStatistics(void) -{ - int i; - I82559_COUNTERS *p_statistics; - cyg_uint32 *p_counter; - cyg_uint32 *p_register; - int reg_count; - int status; - - while ( 1 ) { -#ifdef DISPLAY_82559_STATISTICS - for ( i = 0; i < 2; i ++ ) { - p_statistics = (I82559_COUNTERS *)i82559[i].p_statistics; - if ( (p_statistics->done & 0xFFFF) == 0xA007 ) { - p_counter = (cyg_uint32 *)&i82559_counters[i]; - p_register = (cyg_uint32 *)&p_statistics->tx_good; - for ( reg_count = 20; reg_count != 0; reg_count--) { - *p_counter += *p_register; - p_counter++; - p_register++; - } - p_statistics->done = 0; - // make sure no command operating - wait_for_cmd_done(i82559[i].io_address); - // start register dump - OUTW(CU_DUMPSTATS, i82559[i].io_address + SCBCmd); - } - } -#endif - os_printf("\nRx\nPackets = %d %d\n", - statistics[0].rx_count, statistics[1].rx_count); - os_printf("Deliver %d %d\n", - statistics[0].rx_deliver, statistics[1].rx_deliver); - os_printf("Resource %d %d\n", - statistics[0].rx_resource, statistics[1].rx_resource); - os_printf("Restart %d %d\n", - statistics[0].rx_restart, statistics[1].rx_restart); - -#ifdef DISPLAY_82559_STATISTICS - os_printf("Count %d %d\n", - i82559_counters[0].rx_good, i82559_counters[1].rx_good); - os_printf("CRC %d %d\n", - i82559_counters[0].rx_crc_errors, i82559_counters[1].rx_crc_errors); - os_printf("Align %d %d\n", - i82559_counters[0].rx_align_errors, i82559_counters[1].rx_align_errors); - os_printf("Resource %d %d\n", - i82559_counters[0].rx_resource_errors, i82559_counters[1].rx_resource_errors); - os_printf("Overrun %d %d\n", - i82559_counters[0].rx_overrun_errors, i82559_counters[1].rx_overrun_errors); - os_printf("Collision %d %d\n", - i82559_counters[0].rx_collisions, i82559_counters[1].rx_collisions); - os_printf("Short %d %d\n", - i82559_counters[0].rx_short_frames, i82559_counters[1].rx_short_frames); -#endif - os_printf("\nTx\nPackets = %d %d\n", - statistics[0].tx_count, statistics[1].tx_count); - os_printf("Complete %d %d\n", - statistics[0].tx_complete, statistics[1].tx_complete); - os_printf("Dropped %d %d\n", - statistics[0].tx_dropped, statistics[1].tx_dropped); - os_printf("Count %d %d\n", - i82559_counters[0].tx_good, i82559_counters[1].tx_good); -#ifdef DISPLAY_82559_STATISTICS - os_printf("Collision %d %d\n", - i82559_counters[0].tx_max_collisions,i82559_counters[1].tx_max_collisions); - os_printf("Late Col. %d %d\n", - i82559_counters[0].tx_late_collisions,i82559_counters[1].tx_late_collisions); - os_printf("Underrun %d %d\n", - i82559_counters[0].tx_underrun,i82559_counters[1].tx_underrun); - os_printf("Carrier %d %d\n", - i82559_counters[0].tx_carrier_loss,i82559_counters[1].tx_carrier_loss); - os_printf("Deferred %d %d\n", - i82559_counters[0].tx_deferred, i82559_counters[1].tx_deferred); - os_printf("1 Col %d %d\n", - i82559_counters[0].tx_single_collisions, i82559_counters[0].tx_single_collisions); - os_printf("Mult. Col %d %d\n", - i82559_counters[0].tx_mult_collisions, i82559_counters[0].tx_mult_collisions); - os_printf("Total Col %d %d\n", - i82559_counters[0].tx_total_collisions, i82559_counters[0].tx_total_collisions); -#endif - status = INB(i82559[0].io_address + SCBGenStatus); - os_printf("Interface 0 Link = %s, %s Mbps, %s Duplex\n", - status & GEN_STATUS_LINK ? "Up" : "Down", - status & GEN_STATUS_100MBPS ? "100" : "10", - status & GEN_STATUS_FDX ? "Full" : "Half"); - - status = INB(i82559[1].io_address + SCBGenStatus); - os_printf("Interface 1 Link = %s, %s Mbps, %s Duplex\n", - status & GEN_STATUS_LINK ? "Up" : "Down", - status & GEN_STATUS_100MBPS ? "100" : "10", - status & GEN_STATUS_FDX ? "Full" : "Half"); - - cyg_thread_delay(1000); - } -} -#endif // DISPLAY_STATISTICS -#endif // KEEP_STATISTICS - -void dump_rfd(RFD *p_rfd, int anyway ) -{ - if ( (0 != p_rfd->rxstatus) || anyway ) { - os_printf("RFD @ %x = ", (int)p_rfd); - os_printf("status = %x ", p_rfd->rxstatus); - os_printf("link = %x ", p_rfd->link); -// os_printf("rdb_address = %x ", p_rfd->rdb_address); - os_printf("count = %x ", p_rfd->count); - os_printf("f = %x ", p_rfd->f); - os_printf("eof = %x ", p_rfd->eof); - os_printf("size = %x\n", p_rfd->size); - os_printf("[%04x %04x %04x] ", - *((cyg_uint16 *)(&(p_rfd->buffer[0]))), - *((cyg_uint16 *)(&(p_rfd->buffer[2]))), - *((cyg_uint16 *)(&(p_rfd->buffer[4]))) ); - os_printf("[%04x %04x %04x] %04x : ", - *((cyg_uint16 *)(&(p_rfd->buffer[6]))), - *((cyg_uint16 *)(&(p_rfd->buffer[8]))), - *((cyg_uint16 *)(&(p_rfd->buffer[10]))), - *((cyg_uint16 *)(&(p_rfd->buffer[12]))) ); - os_printf("(%04x %04x %04x %04x) ", - *((cyg_uint16 *)(&(p_rfd->buffer[14]))), - *((cyg_uint16 *)(&(p_rfd->buffer[16]))), - *((cyg_uint16 *)(&(p_rfd->buffer[18]))), - *((cyg_uint16 *)(&(p_rfd->buffer[20]))) ); - os_printf("[%04x %04x %04x] ", - *((cyg_uint16 *)(&(p_rfd->buffer[22]))), - *((cyg_uint16 *)(&(p_rfd->buffer[24]))), - *((cyg_uint16 *)(&(p_rfd->buffer[26]))) ); - os_printf("%d.%d.%d.%d ", - *((cyg_uint8 *)(&(p_rfd->buffer[28]))), - *((cyg_uint8 *)(&(p_rfd->buffer[29]))), - *((cyg_uint8 *)(&(p_rfd->buffer[30]))), - *((cyg_uint8 *)(&(p_rfd->buffer[31]))) ); - os_printf("[%04x %04x %04x] ", - *((cyg_uint16 *)(&(p_rfd->buffer[32]))), - *((cyg_uint16 *)(&(p_rfd->buffer[34]))), - *((cyg_uint16 *)(&(p_rfd->buffer[36]))) ); - os_printf("%d.%d.%d.%d ...\n", - *((cyg_uint8 *)(&(p_rfd->buffer[38]))), - *((cyg_uint8 *)(&(p_rfd->buffer[39]))), - *((cyg_uint8 *)(&(p_rfd->buffer[40]))), - *((cyg_uint8 *)(&(p_rfd->buffer[41]))) ); - } -} - -void dump_all_rfds( int intf ) -{ - struct i82559* p_i82559 = &i82559[intf]; - int i, j; - j = p_i82559->next_rx_descriptor; - os_printf("rx descriptors for interface %d (eth%d):\n", intf, intf ); - for ( i = 0; i < MAX_RX_DESCRIPTORS; i++ ) - dump_rfd( p_i82559->rx_ring[i], (i > (j-3) && (i <= j)) ); - os_printf("next rx descriptor = %x\n\n", j); -} - - -void dump_packet(cyg_uint8 *p_buffer, int length) -{ - int count; - - count = 0; - while ( length > 0 ) { - if ( count == 0 ) - os_printf("\n"); - count = (count + 1) & 0x0F; - os_printf("%02X ", *p_buffer++); - length--; - } - os_printf("\n"); -} - -// ------------------------------------------------------------------------ - -// EOF if_ebsa285.c diff --git a/packages/devs/eth/arm/ebsa285/current/tests/test_net_realtime.h b/packages/devs/eth/arm/ebsa285/current/tests/test_net_realtime.h --- a/packages/devs/eth/arm/ebsa285/current/tests/test_net_realtime.h +++ b/packages/devs/eth/arm/ebsa285/current/tests/test_net_realtime.h @@ -9,29 +9,38 @@ // realtime characteristics are preserved. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/eth/arm/edb7xxx/current/ChangeLog b/packages/devs/eth/arm/edb7xxx/current/ChangeLog --- a/packages/devs/eth/arm/edb7xxx/current/ChangeLog +++ b/packages/devs/eth/arm/edb7xxx/current/ChangeLog @@ -1,3 +1,14 @@ +2002-03-28 Gary Thomas + + * cdl/edb7xxx_eth_drivers.cdl: Don't define CYGHWR_NET_DRIVERS since + it's done by the generic driver. + +2002-02-05 Jonathan Larmour + + * cdl/edb7xxx_eth_drivers.cdl + (CYGSEM_DEVS_ETH_ARM_EDB7XXX_ETH0_SET_ESA): Can be set by user, so + don't use calculated. + 2001-11-20 Jesper Skov From hmt: * include/devs_eth_arm_edb7xxx.inl (_edb7xxx_provide_eth0_esa): @@ -25,6 +36,8 @@ 2001-09-25 Gary Thomas * src/if_edb7xxx.c (cs8900_send): Only start transmitter after @@ -169,29 +182,38 @@ 2000-02-08 John Dallaway on the BSE Flexanet/SA1110 board. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/devs/eth/arm/flexanet/current/cdl/flexanet_eth_drivers.cdl b/packages/devs/eth/arm/flexanet/current/cdl/flexanet_eth_drivers.cdl --- a/packages/devs/eth/arm/flexanet/current/cdl/flexanet_eth_drivers.cdl +++ b/packages/devs/eth/arm/flexanet/current/cdl/flexanet_eth_drivers.cdl @@ -6,29 +6,38 @@ # on the BSE Flexanet/SA1110 board. # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/devs/eth/arm/flexanet/current/include/devs_eth_flexanet.inl b/packages/devs/eth/arm/flexanet/current/include/devs_eth_flexanet.inl --- a/packages/devs/eth/arm/flexanet/current/include/devs_eth_flexanet.inl +++ b/packages/devs/eth/arm/flexanet/current/include/devs_eth_flexanet.inl @@ -5,29 +5,38 @@ // Flexanet ethernet I/O definitions. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/eth/arm/flexanet/current/src/if_flexanet.c b/packages/devs/eth/arm/flexanet/current/src/if_flexanet.c --- a/packages/devs/eth/arm/flexanet/current/src/if_flexanet.c +++ b/packages/devs/eth/arm/flexanet/current/src/if_flexanet.c @@ -5,29 +5,38 @@ // Ethernet device driver for Flexanet using SMSC LAN91C96 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/devs/eth/arm/integrator/current/ChangeLog b/packages/devs/eth/arm/integrator/current/ChangeLog --- a/packages/devs/eth/arm/integrator/current/ChangeLog +++ b/packages/devs/eth/arm/integrator/current/ChangeLog @@ -1,30 +1,51 @@ +2002-03-06 Nick Garnett + + * cdl/integrator_eth_drivers.cdl: Switched over to use generic + i82559 driver. + + * include/devs_eth_arm_integrator_i82559.inl: File added to + configure generic i82559 driver. + + * include/integrator_info.h: + * src/if_integrator.c: + Files removed. These were the old integrator-specific driver. + 2000-08-21 Philippe Robin * adapted from ebsa285 //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/devs/eth/arm/integrator/current/cdl/integrator_eth_drivers.cdl b/packages/devs/eth/arm/integrator/current/cdl/integrator_eth_drivers.cdl --- a/packages/devs/eth/arm/integrator/current/cdl/integrator_eth_drivers.cdl +++ b/packages/devs/eth/arm/integrator/current/cdl/integrator_eth_drivers.cdl @@ -6,29 +6,38 @@ # Intel PRO/100+ platform specific support for ARM Integrator # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # @@ -42,108 +51,62 @@ # ==================================================================== cdl_package CYGPKG_DEVS_ETH_ARM_INTEGRATOR { - display "Intel PRO/100+ ethernet driver for ARM Integrator" + display "Integrator board ethernet driver" + description "Ethernet driver for Integrator." parent CYGPKG_IO_ETH_DRIVERS - active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS active_if CYGPKG_HAL_ARM_INTEGRATOR - implements CYGHWR_NET_DRIVER_ETH0 - implements CYGHWR_NET_DRIVER_ETH1 - # yes, there should be two of these "implement"s - implements CYGHWR_NET_DRIVERS - implements CYGHWR_NET_DRIVERS - include_dir cyg/devs/eth + include_dir cyg/io - # SNMP demands to know stuff; this sadly makes us break the neat - # abstraction of the device having nothing exported. - # The other one is used by other tests: - include_files include/integrator_info.h - # and tell them that it is available - define_proc { - puts $::cdl_system_header \ - "#define CYGBLD_DEVS_ETH_DEVICE_H " - puts $::cdl_header \ - "#define CYGBLD_DEVS_ETH_INFO_H " + # FIXME: This really belongs in the INTEL_I82559 package + cdl_interface CYGINT_DEVS_ETH_INTEL_I82559_REQUIRED { + display "Intel i82559 ethernet driver required" } - description "Ethernet driver for Intel PRO/100+ boards on ARM Integrator." - compile -library=libextras.a if_integrator.c - - cdl_option CYGDBG_DEVS_ETH_ARM_INTEGRATOR_CHATTER { - display "Prints ethernet device status info during startup" - default_value 0 - description " - The ethernet device initialization code can print lots of info - to confirm that it has found the devices on the PCI bus, read - the MAC address from EEPROM correctly, and so on, and also - displays the mode (10/100MHz, half/full duplex) of the - connection." - } - - cdl_option CYGNUM_DEVS_ETH_ARM_INTEGRATOR_DEV_COUNT { - display "Number of supported interfaces." - legal_values 1 2 - default_value 1 - flavor data - description " - This option selects the number of PCI ethernet interfaces to - be supported by the driver." + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_INTEL_I82559_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_INTEL_I82559_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" } - cdl_component CYGDBG_DEVS_ETH_ARM_INTEGRATOR_KEEP_STATISTICS { - display "Keep Ethernet statistics" - default_value 1 - description " - The ethernet device can maintain statistics about the network, - specifically a great variety of error rates which are useful - for network management. SNMP for example uses this - information. There is some performance cost in maintaining - this information; disable this option to recoup that." + cdl_component CYGPKG_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0 { + display "Ethernet port 0 driver" + flavor bool + default_value 1 - cdl_option CYGDBG_DEVS_ETH_ARM_INTEGRATOR_KEEP_82559_STATISTICS { - display "Keep i82559 Internal statistics" - default_value 1 - description " - The i82559 keeps internal counters, and it is possible to - acquire these. But the i82559 (reputedly) does not service - the network whilst uploading the data to RAM from its - internal registers. If throughput is a problem, disable - this option to acquire only those statistics gathered by - software, so that the i82559 never sleeps." - } - } + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_INTEL_I82559_REQUIRED - cdl_component CYGPKG_DEVS_ETH_ARM_INTEGRATOR_WRITE_EEPROM { - display "SIOCSIFHWADDR records MAC address in EEPROM" - default_value 0 - description " - The ioctl() socket call with operand SIOCSIFHWADDR sets the - interface hardware address - the MAC address or ethernet - address. This option causes the new MAC address to be written - into the EEPROM associated with the interface, so that the new - MAC address is permanently recorded. Doing this should be a - carefully chosen decision, hence this option." - } + cdl_option CYGDAT_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0_NAME { + display "Device name for the ETH0 ethernet port 0 driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + i82559 ethernet port 0." + } - cdl_component CYGPKG_DEVS_ETH_ARM_INTEGRATOR_OPTIONS { - display "Intel PRO/100+ ethernet driver build options for ARM Integrator" - flavor none - no_define - - cdl_option CYGPKG_DEVS_ETH_ARM_INTEGRATOR_CFLAGS_ADD { - display "Additional compiler flags" - flavor data - no_define - default_value { "-D_KERNEL -D__ECOS" } - description " - This option modifies the set of compiler flags for - building the Intel EBSA285 with PRO/100+ ethernet driver - package. These flags are used in addition to the set of - global flags." + cdl_component CYGSEM_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x00, 0x00, 0x00, 0x00, 0x01}"} + description "The ethernet station address" + } } } - } # EOF integrator_eth_drivers.cdl diff --git a/packages/devs/eth/arm/integrator/current/include/devs_eth_arm_integrator_i82559.inl b/packages/devs/eth/arm/integrator/current/include/devs_eth_arm_integrator_i82559.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/integrator/current/include/devs_eth_arm_integrator_i82559.inl @@ -0,0 +1,118 @@ +//========================================================================== +// +// devs_eth_arm_integrator_i82559.inl +// +// Integrator i82559 ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-01-25 +// Purpose: Integrator i82559 ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR + +#include + +#ifdef CYGPKG_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0 + +#define CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE CYGARC_PHYSICAL_ADDRESS(CYGMEM_SECTION_pci_window) +#define CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE CYGMEM_SECTION_pci_window_SIZE + +#define CYGHWR_INTEL_I82559_PCI_VIRT_TO_BUS( _x_ ) (((cyg_uint32)(_x_))|INTEGRATOR_HDR0_SDRAM_BASE) +#define CYGHWR_INTEL_I82559_PCI_BUS_TO_VIRT( _x_ ) (((cyg_uint32)(_x_))&~INTEGRATOR_HDR0_SDRAM_BASE) + +static I82559 i82559_eth0_priv_data = { +#ifdef CYGSEM_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0_SET_ESA + hardwired_esa: 1, + mac_address: CYGDAT_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0_ESA +#else + hardwired_esa: 0, +#endif +}; + +ETH_DRV_SC(i82559_sc0, + &i82559_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0_NAME, // Name for device + i82559_start, + i82559_stop, + i82559_ioctl, + i82559_can_send, + i82559_send, + i82559_recv, + i82559_deliver, + i82559_poll, + i82559_int_vector + ); + +NETDEVTAB_ENTRY(i82559_netdev0, + "i82559_" CYGDAT_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0_NAME, + i82559_init, + &i82559_sc0); + +#endif // CYGPKG_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0 + + +// These arrays are used for sanity checking of pointers +I82559 * +i82559_priv_array[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0 + &i82559_eth0_priv_data, +#endif +}; + +#ifdef CYGDBG_USE_ASSERTS +// These are only used when assertions are enabled +cyg_netdevtab_entry_t * +i82559_netdev_array[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0 + &i82559_netdev0, +#endif +}; + +struct eth_drv_sc * +i82559_sc_array[CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_ARM_INTEGRATOR_I82559_ETH0 + &i82559_sc0, +#endif +}; +#endif // CYGDBG_USE_ASSERTS + +// EOF devs_eth_arm_integrator_i82559.inl diff --git a/packages/devs/eth/arm/integrator/current/include/integrator_info.h b/packages/devs/eth/arm/integrator/current/include/integrator_info.h deleted file mode 100644 --- a/packages/devs/eth/arm/integrator/current/include/integrator_info.h +++ /dev/null @@ -1,206 +0,0 @@ -#ifndef CYGONCE_DEVS_ETH_ARM_INTEGRATOR_INTEGRATOR_INFO_H -#define CYGONCE_DEVS_ETH_ARM_INTEGRATOR_INTEGRATOR_INFO_H -/*========================================================================== -// -// integrator_info.h -// -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): Philippe Robin -// Original data: hmt -// Contributors: -// Date: November 7, 2000 -// Description: -// -//####DESCRIPTIONEND#### -*/ - -#include - -#undef CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_SIZE -#define CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_SIZE 0x100000 - -#ifdef CYGDBG_DEVS_ETH_ARM_INTEGRATOR_KEEP_STATISTICS -# define KEEP_STATISTICS -# define nDISPLAY_STATISTICS -# define nDISPLAY_82559_STATISTICS -#else -# define nKEEP_STATISTICS -# define nDISPLAY_STATISTICS -# define nDISPLAY_82559_STATISTICS -#endif - - -// ------------------------------------------------------------------------ -// -// STATISTICAL COUNTER STRUCTURE -// -// ------------------------------------------------------------------------ -#ifdef KEEP_STATISTICS -typedef struct { -/* 0 */ cyg_uint32 tx_good; -/* 4 */ cyg_uint32 tx_max_collisions; -/* 8 */ cyg_uint32 tx_late_collisions; -/* 12 */ cyg_uint32 tx_underrun; -/* 16 */ cyg_uint32 tx_carrier_loss; -/* 20 */ cyg_uint32 tx_deferred; -/* 24 */ cyg_uint32 tx_single_collisions; -/* 28 */ cyg_uint32 tx_mult_collisions; -/* 32 */ cyg_uint32 tx_total_collisions; -/* 36 */ cyg_uint32 rx_good; -/* 40 */ cyg_uint32 rx_crc_errors; -/* 44 */ cyg_uint32 rx_align_errors; -/* 48 */ cyg_uint32 rx_resource_errors; -/* 52 */ cyg_uint32 rx_overrun_errors; -/* 56 */ cyg_uint32 rx_collisions; // Always 0 -/* 60 */ cyg_uint32 rx_short_frames; -// In this setup; can also be flow-control counts after. -// If these are to be used, a config command (as in set promiscuous mode) -// must be issued at start, to let those stats escape. Params are in -// comments around the config command setup... -/* 64 */ cyg_uint32 done; -} I82559_COUNTERS; - - -typedef struct { - cyg_uint32 interrupts; - cyg_uint32 rx_count; - cyg_uint32 rx_deliver; - cyg_uint32 rx_resource; - cyg_uint32 rx_restart; - cyg_uint32 tx_count; - cyg_uint32 tx_complete; - cyg_uint32 tx_dropped; -} STATISTICS; - - -extern STATISTICS statistics[2]; -#ifdef CYGDBG_DEVS_ETH_ARM_INTEGRATOR_KEEP_82559_STATISTICS -extern I82559_COUNTERS i82559_counters[2]; -#endif - -#endif // KEEP_STATISTICS - -// ------------------------------------------------------------------------ -// -// DEVICES AND PACKET QUEUES -// -// ------------------------------------------------------------------------ -// The system seems to work OK with as few as 8 of RX and TX descriptors. -// It limps very painfully with only 4. -// Performance is better with more than 8. -// But the size of non-cached (so useless for anything else) -// memory window is 1Mb, so we might as well use it all. -// -// 128 for these uses the whole 1Mb, near enough. - -#ifndef MAX_RX_DESCRIPTORS -#define MAX_RX_DESCRIPTORS 8 // number of Rx descriptors 128 -#endif -#ifndef MAX_TX_DESCRIPTORS -#define MAX_TX_DESCRIPTORS 8 // number of Tx descriptors -#endif - - -typedef struct i82559 { - cyg_uint8 // (split up for atomic byte access) - found:1, // was hardware discovered? - mac_addr_ok:1, // can we bring up? - active:1, // has this if been brung up? - spare1:5; - cyg_uint8 - spare2:8; - cyg_uint8 - tx_in_progress:1, // transmit in progress flag - tx_queue_full:1, // all Tx descriptors used flag - spare3:6; - cyg_uint8 index; // 0 or 1 or whatever - cyg_uint32 devid; // PCI device id - cyg_uint32 memory_address; // PCI memory address - cyg_uint32 io_address; // memory mapped I/O address - cyg_uint8 mac_address[6]; // mac (hardware) address - void *ndp; // Network Device Pointer - - int next_rx_descriptor; // descriptor index for RFDs - struct rfd *rx_ring[MAX_RX_DESCRIPTORS]; // location of Rx descriptors - - int tx_descriptor_add; // descriptor index for additions - int tx_descriptor_active; // descriptor index for active tx - int tx_descriptor_remove; // descriptor index for remove - - struct txcb *tx_ring[MAX_TX_DESCRIPTORS]; // location of Tx descriptors - unsigned long tx_keys[MAX_TX_DESCRIPTORS]; - // keys for tx q management - - // Interrupt handling stuff - cyg_vector_t vector; // interrupt vector - cyg_handle_t interrupt_handle; // handle for int.handler - cyg_interrupt interrupt_object; - -#ifdef KEEP_STATISTICS - void *p_statistics; // pointer to statistical counters -#endif - -} I82559; - - - -// ------------------------------------------------------------------------ -// -// 82559 GENERAL STATUS REGISTER -// -// ------------------------------------------------------------------------ -#define GEN_STATUS_FDX 0x04 // 1 = full duplex, 0 = half -#define GEN_STATUS_100MBPS 0x02 // 1 = 100 Mbps, 0 = 10 Mbps -#define GEN_STATUS_LINK 0x01 // 1 = link up, 0 = link down - -extern int i82559_status( struct eth_drv_sc *sc ); - -// ------------------------------------------------------------------------ - -#ifdef KEEP_STATISTICS -void update_statistics(struct i82559* p_i82559); -#endif - - -#ifdef CYGDBG_DEVS_ETH_ARM_INTEGRATOR_KEEP_82559_STATISTICS -#define ETH_STATS_INIT( p ) \ - update_statistics( (struct i82559 *)((p)->driver_private) ) -#else -#define ETH_STATS_INIT( p ) // otherwise do nothing -#endif - -#define CYGDAT_DEVS_ETH_DESCRIPTION "Intel EtherPRO 10/100+ (i82559)" - -#define ETH_DEV_DOT3STATSETHERCHIPSET 1,3,6,1,2,1,10,7,8,2,5 - -#endif /* ifndef CYGONCE_DEVS_ETH_ARM_INTEGRATOR_INTEGRATOR_INFO_H */ - -/* EOF integrator_info.h */ - diff --git a/packages/devs/eth/arm/integrator/current/src/if_integrator.c b/packages/devs/eth/arm/integrator/current/src/if_integrator.c deleted file mode 100644 --- a/packages/devs/eth/arm/integrator/current/src/if_integrator.c +++ /dev/null @@ -1,2712 +0,0 @@ -//========================================================================== -// -// if_integrator.c -// -// Ethernet drivers -// ARM Integrator with Intel PRO/100+ platform specific support -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): hmt, gthomas -// Contributors: Ron Spence, Philippe Robin -// Date: November 7, 2000 -// Purpose: -// Description: hardware driver for 82559 Intel PRO/100+ ethernet and -// ARM INTEGRATOR development boards -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CYGPKG_NET -#include -#include /* Needed for struct ifnet */ -#else -#include -#endif - -#ifdef CYGPKG_IO_PCI -#include -// So we can check the validity of the PCI window against the MLTs opinion, -// and thereby what the malloc heap consumes willy-nilly: -#include CYGHWR_MEMORY_LAYOUT_H -#else -#error "Need PCI package here" -#endif - -// Exported statistics and the like -#include -#include - -// ------------------------------------------------------------------------ - -#ifdef CYGDBG_DEVS_ETH_ARM_INTEGRATOR_CHATTER -#define noDEBUG_82559 // This one prints stuff as packets come and go -#define DEBUG // Startup printing mainly -#define DEBUG_EE // Some EEPROM specific retries &c -#endif - -#define os_printf diag_printf -#define db_printf diag_printf - -// ------------------------------------------------------------------------ -// I/O access macros as inlines for type safety - -static inline void OUTB(cyg_uint8 value, cyg_uint32 io_address) -{ *((volatile cyg_uint8 *)io_address) = value; } - -static inline void OUTW(cyg_uint16 value, cyg_uint32 io_address) -{ *((volatile cyg_uint16 *)io_address) = value; } - -static inline void OUTL(cyg_uint32 value, cyg_uint32 io_address) -{ *((volatile cyg_uint32 *)io_address) = value; } - -static inline cyg_uint8 INB(cyg_uint32 io_address) -{ return *((volatile cyg_uint8 *)io_address); } - -static inline cyg_uint16 INW(cyg_uint32 io_address) -{ return *((volatile cyg_uint16 *)io_address); } - -static inline cyg_uint32 INL(cyg_uint32 io_address) -{ return *((volatile cyg_uint32 *)io_address); } - -#define VIRT_TO_BUS( _x_ ) virt_to_bus((cyg_uint32)(_x_)) -static inline cyg_uint32 virt_to_bus(cyg_uint32 p_memory) -{ return (p_memory); } - -#define BUS_TO_VIRT( _x_ ) bus_to_virt((cyg_uint32)(_x_)) -static inline cyg_uint32 bus_to_virt(cyg_uint32 p_memory) -{ return (p_memory); } - - -// ------------------------------------------------------------------------ -// -// 82559 REGISTER OFFSETS (I/O SPACE) -// -// ------------------------------------------------------------------------ -#define SCBStatus 0 // Rx/Command Unit command and status. -#define SCBCmd 2 // Rx/Command Unit command and status. -#define SCBPointer 4 // General purpose pointer. -#define SCBPort 8 // Misc. commands and operands. -#define SCBflash 12 // Flash memory control. -#define SCBeeprom 14 // EEPROM memory control. -#define SCBCtrlMDI 16 // MDI interface control. -#define SCBEarlyRx 20 // Early receive byte count. -#define SCBGenControl 28 // 82559 General Control Register -#define SCBGenStatus 29 // 82559 General Status register - - -// ------------------------------------------------------------------------ -// -// 82559 SCB STATUS WORD DEFNITIONS -// -// ------------------------------------------------------------------------ -#define SCB_STATUS_CX 0x8000 // CU finished command (transmit) -#define SCB_STATUS_FR 0x4000 // frame received -#define SCB_STATUS_CNA 0x2000 // CU left active state -#define SCB_STATUS_RNR 0x1000 // receiver left ready state -#define SCB_STATUS_MDI 0x0800 // MDI read/write cycle done -#define SCB_STATUS_SWI 0x0400 // software generated interrupt -#define SCB_STATUS_FCP 0x0100 // flow control pause interrupt - -#define SCB_INTACK_MASK 0xFD00 // all the above - -#define SCB_INTACK_TX (SCB_STATUS_CX | SCB_STATUS_CNA) -#define SCB_INTACK_RX (SCB_STATUS_FR | SCB_STATUS_RNR) - -// ------------------------------------------------------------------------ -// -// 82559 PORT INTERFACE COMMANDS -// -// ------------------------------------------------------------------------ -#define I82559_RESET 0x00000000 // software reset -#define I82559_SELFTEST 0x00000001 // 82559 selftest command -#define I82559_SELECTIVE_RESET 0x00000002 -#define I82559_DUMP 0x00000003 -#define I82559_DUMP_WAKEUP 0x00000007 - - - -// ------------------------------------------------------------------------ -// -// 82559 EEPROM INTERFACE -// -// ------------------------------------------------------------------------ -// EEPROM_Ctrl bits. -#define EE_SHIFT_CLK 0x01 // EEPROM shift clock. -#define EE_CS 0x02 // EEPROM chip select. -#define EE_DATA_WRITE 0x04 // EEPROM chip data in. -#define EE_DATA_READ 0x08 // EEPROM chip data out. -#define EE_ENB (0x4800 | EE_CS) - -// Delay between EEPROM clock transitions. -#define eeprom_delay(usec) udelay(usec); - -// The EEPROM commands include the always-set leading bit. -#define EE_WRITE_CMD(a) (5 << (a)) -#define EE_READ_CMD(a) (6 << (a)) -#define EE_ERASE_CMD(a) (7 << (a)) -#define EE_WRITE_EN_CMD(a) (19 << ((a)-2)) -#define EE_WRITE_DIS_CMD(a) (16 << ((a)-2)) -#define EE_ERASE_ALL_CMD(a) (18 << ((a)-2)) - -#define EE_TOP_CMD_BIT(a) ((a)+2) // Counts down to zero -#define EE_TOP_DATA_BIT (15) // Counts down to zero - -#define EEPROM_ENABLE_DELAY (10) // Delay at chip select - -#define EEPROM_SK_DELAY (2) // Delay between clock edges *and* data - // read or transition; 3 of these per bit. -#define EEPROM_DONE_DELAY (100) // Delay when all done - - -// ------------------------------------------------------------------------ -// -// SYSTEM CONTROL BLOCK COMMANDS -// -// ------------------------------------------------------------------------ -// CU COMMANDS -#define CU_NOP 0x0000 -#define CU_START 0x0010 -#define CU_RESUME 0x0020 -#define CU_STATSADDR 0x0040 // Load Dump Statistics ctrs addr -#define CU_SHOWSTATS 0x0050 // Dump statistics counters. -#define CU_ADDR_LOAD 0x0060 // Base address to add to CU commands -#define CU_DUMPSTATS 0x0070 // Dump then reset stats counters. - -// RUC COMMANDS -#define RUC_NOP 0x0000 -#define RUC_START 0x0001 -#define RUC_RESUME 0x0002 -#define RUC_ABORT 0x0004 -#define RUC_ADDR_LOAD 0x0006 // (seems not to clear on acceptance) -#define RUC_RESUMENR 0x0007 - -#define SCB_M 0x0100 // 0 = enable interrupt, 1 = disable -#define SCB_SI 0x0200 // 1 - cause device to interrupt - -#define CU_STATUS_MASK 0x00C0 -#define RU_STATUS_MASK 0x003C - -#define RU_STATUS_IDLE (0<<2) -#define RU_STATUS_SUS (1<<2) -#define RU_STATUS_NORES (2<<2) -#define RU_STATUS_READY (4<<2) -#define RU_STATUS_NO_RBDS_SUS ((1<<2)|(8<<2)) -#define RU_STATUS_NO_RBDS_NORES ((2<<2)|(8<<2)) -#define RU_STATUS_NO_RBDS_READY ((4<<2)|(8<<2)) - - - -#define MAX_MEM_RESERVED_IOCTL 1000 - -// ------------------------------------------------------------------------ -// -// RECEIVE FRAME DESCRIPTORS -// -// ------------------------------------------------------------------------ -typedef struct rfd { - volatile union { - cyg_uint32 u32_status; // result of receive operation - cyg_uint16 u16_status[2]; - } u_status; - volatile cyg_uint32 link; // offset from RU base to next RFD - volatile cyg_uint32 rdb_address; // pointer to Rx data buffer - volatile cyg_uint32 count:14, // number of bytes received + - f:1, // + EOF & F flags - eof:1, - size:16; // size of the data buffer - volatile cyg_uint8 buffer[0]; // data buffer (simple mode) -} RFD; - -// The status is split into two shorts to get atomic access to the EL bit; -// the upper word is not written by the device, so we can just hit it, -// leaving the lower word (which the device updates) alone. Otherwise -// there's a race condition between software moving the end-of-list (EL) -// bit round and the device writing into the previous slot. - -#define rxstatus u_status.u32_status -#define rxstatus_hi u_status.u16_status[1] -#define rxstatus_lo u_status.u16_status[0] - -#define RFD_STATUS_EL 0x80000000 // 1=last RFD in RFA -#define RFD_STATUS_S 0x40000000 // 1=suspend RU after receiving frame -#define RFD_STATUS_H 0x00100000 // 1=RFD is a header RFD -#define RFD_STATUS_SF 0x00080000 // 0=simplified, 1=flexible mode -#define RFD_STATUS_C 0x00008000 // completion of received frame -#define RFD_STATUS_OK 0x00002000 // frame received with no errors - -#define RFD_STATUS_HI_EL 0x8000 // 1=last RFD in RFA -#define RFD_STATUS_HI_S 0x4000 // 1=suspend RU after receiving frame -#define RFD_STATUS_HI_H 0x0010 // 1=RFD is a header RFD -#define RFD_STATUS_HI_SF 0x0008 // 0=simplified, 1=flexible mode - -#define RFD_STATUS_LO_C 0x8000 // completion of received frame -#define RFD_STATUS_LO_OK 0x2000 // frame received with no errors - -#define RFD_RX_CRC 0x00000800 // crc error -#define RFD_RX_ALIGNMENT 0x00000400 // alignment error -#define RFD_RX_RESOURCE 0x00000200 // out of space, no resources -#define RFD_RX_DMA_OVER 0x00000100 // DMA overrun -#define RFD_RX_SHORT 0x00000080 // short frame error -#define RFD_RX_LENGTH 0x00000020 // -#define RFD_RX_ERROR 0x00000010 // receive error -#define RFD_RX_NO_ADR_MATCH 0x00000004 // no address match -#define RFD_RX_IA_MATCH 0x00000002 // individual address does not match -#define RFD_RX_TCO 0x00000001 // TCO indication - - -typedef struct rbd { - volatile cyg_uint32 count:14, // bytes used in buffer - f:1, // buffer has been used (filled) - eof:1; // last receive buffer in frame - volatile cyg_uint32 next_rbd; // next RBD (RU base relative) - volatile cyg_uint32 buffer_address; // address of receive data buffer - volatile cyg_uint32 size:15, // size of the associated buffer - el:1; // buffer of this RBD is last -} RBD; - - -// ------------------------------------------------------------------------ -// -// TRANSMIT FRAME DESCRIPTORS -// -// ------------------------------------------------------------------------ -typedef struct txcb { - volatile cyg_uint32 txstatus:16, // result of transmit operation - command:16; // transmit command - volatile cyg_uint32 link; // offset from RU base to next RFD - volatile cyg_uint32 tbd_address; // pointer to Rx data buffer - volatile cyg_uint32 count:15, // number of bytes in transmit buffer - eof:1, - tx_threshold:8, - tbd_number:8; - volatile cyg_uint8 buffer[0]; // data buffer (simple mode) -} TxCB; - - -#define TxCB_CMD_TRANSMIT 0x0004 // transmit command -#define TxCB_CMD_SF 0x0008 // 0=simplified, 1=flexible mode -#define TxCB_CMD_NC 0x0010 // 0=CRC insert by controller -#define TxCB_CMD_I 0x2000 // generate interrupt on completion -#define TxCB_CMD_S 0x4000 // suspend on completion -#define TxCB_CMD_EL 0x8000 // last command block in CBL - - -// ------------------------------------------------------------------------ -// -// STRUCTURES ADDED FOR PROMISCUOUS MODE -// -// ------------------------------------------------------------------------ -typedef struct { - cyg_uint32 cb_status_word:13, - cb_ok:1, - cb_dc:1, - cb_complete:1, - cb_cmd:3, - cb_cmd_word:10, - cb_int:1, - cb_suspend:1, - cb_el:1; - cyg_uint32 cb_link_offset; -} CB_STRUCT; - - -typedef struct { - CB_STRUCT cb_entry; - cyg_uint8 config_bytes[24]; -} CONFIG_CMD_STRUCT; - -// ------------------------------------------------------------------------ -// -// STATISTICAL COUNTER STRUCTURE -// -// ------------------------------------------------------------------------ -#ifdef KEEP_STATISTICS -STATISTICS statistics[2]; -I82559_COUNTERS i82559_counters[2]; -#endif // KEEP_STATISTICS - -// ------------------------------------------------------------------------ -// -// DEVICES AND PACKET QUEUES -// -// ------------------------------------------------------------------------ - -#define MAX_RX_PACKET_SIZE 1536 // maximum Rx packet size -#define MAX_TX_PACKET_SIZE 1536 // maximum Tx packet size - - -// This is encapsulated here so that a change to > 2 interfaces can -// easily be accommodated. - -#define IF_BAD_82559( _p_ ) \ - CYG_ASSERT( (&i82559[0] == (_p_)) || (&i82559[1] == (_p_)), \ - "Bad pointer-to-i82559" ); \ - if ( (&i82559[0] != (_p_)) && (&i82559[1] != (_p_)) ) - -// ------------------------------------------------------------------------ -// Instantiate the interfaces that we have: - -// number of interfaces -#define MAX_82559 CYGNUM_DEVS_ETH_ARM_INTEGRATOR_DEV_COUNT - -I82559 i82559[MAX_82559]; // i82559 device info. structure - -// eth0 - -ETH_DRV_SC(integrator_sc0, - &i82559[0], // Driver specific data - "eth0", // Name for this interface - i82559_start, - i82559_stop, - i82559_ioctl, - i82559_can_send, - i82559_send, - i82559_recv, - i82559_deliver, - i82559_poll, - i82559_int_vector); - -NETDEVTAB_ENTRY(integrator_netdev0, - "integrator-0", - integrator_i82559_init, - &integrator_sc0); - -#if (MAX_82559 > 1) - -// eth1 - -ETH_DRV_SC(integrator_sc1, - &i82559[1], // Driver specific data - "eth1", // Name for this interface - i82559_start, - i82559_stop, - i82559_ioctl, - i82559_can_send, - i82559_send, - i82559_recv, - i82559_deliver, - i82559_poll, - i82559_int_vector); - -NETDEVTAB_ENTRY(integrator_netdev1, - "integrator-1", - integrator_i82559_init, - &integrator_sc1); - -#else -int integrator_netdev1 = -1; // for asserts about valid addresses -int integrator_sc1 = -1; -#endif // eth1 is included - -// This is in a macro so that if more devices arrive it can easily be changed -#define CHECK_NDP_SC_LINK() CYG_MACRO_START \ - CYG_ASSERT( ((void *)ndp == (void *)&integrator_netdev0) || \ - ((void *)ndp == (void *)&integrator_netdev1), "Bad ndp" ); \ - CYG_ASSERT( ((void *)sc == (void *)&integrator_sc0) || \ - ((void *)sc == (void *)&integrator_sc1), "Bad sc" ); \ - CYG_ASSERT( (void *)p_i82559 == sc->driver_private, "sc pointer bad" );\ -CYG_MACRO_END - -// ------------------------------------------------------------------------ -// -// Managing the memory that is windowed onto the PCI bus -// -// ------------------------------------------------------------------------ - -static cyg_uint32 i82559_heap_size; -static cyg_uint8 *i82559_heap_base; -static cyg_uint8 *i82559_heap_free; - -static void *mem_reserved_ioctl = (void*)0; -// uncacheable memory reserved for ioctl calls - -static int mux_device_index = 0; - -// ------------------------------------------------------------------------ -// -// FUNCTION PROTOTYPES -// -// ------------------------------------------------------------------------ - -static int pci_init_find_82559s(void); - -static void i82559_reset(struct i82559* p_i82559); - -static void InitRxRing(struct i82559* p_i82559); -static void ResetRxRing(struct i82559* p_i82559); -static void InitTxRing(struct i82559* p_i82559); -static void ResetTxRing(struct i82559* p_i82559); - -#ifdef CYGPKG_DEVS_ETH_ARM_INTEGRATOR_WRITE_EEPROM -static void program_eeprom(cyg_uint32 , cyg_uint32 , cyg_uint8 * ); -#endif -#ifdef CYGPKG_NET -static int eth_set_promiscuous_mode(struct i82559* p_i82559); -#endif - -// debugging/logging only: -void dump_txcb(TxCB *p_txcb); -void DisplayStatistics(void); -void update_statistics(struct i82559* p_i82559); -void dump_rfd(RFD *p_rfd, int anyway ); -void dump_all_rfds( int intf ); -void dump_packet(cyg_uint8 *p_buffer, int length); - -// ------------------------------------------------------------------------ -// utilities -// ------------------------------------------------------------------------ - -static // inline -void wait_for_cmd_done(long scb_ioaddr) -{ - register int CSRstatus; - register int wait = 0x100000; - do CSRstatus = INB(scb_ioaddr + SCBCmd) ; - while( CSRstatus && --wait >= 0); - CYG_ASSERT( wait > 0, "wait_for_cmd_done" ); -} - -static inline void Mask82559Interrupt(struct i82559* p_i82559) -{ - cyg_drv_interrupt_mask(p_i82559->vector); -} - -static inline void UnMask82559Interrupt(struct i82559* p_i82559) -{ - cyg_drv_interrupt_unmask(p_i82559->vector); -} - -#ifdef CYGDBG_USE_ASSERTS // an indication of a debug build -static int acknowledge82559interrupt_compensating = 0; -#endif - -static void Acknowledge82559Interrupt(struct i82559* p_i82559) -{ - cyg_uint32 sources, mask; - cyg_uint32 ioaddr; - cyg_uint16 status; - int loops = 64; - - cyg_drv_interrupt_acknowledge(p_i82559->vector); - - // It appears that some time can be taken before the interrupt source - // *really* quietens down... this is ugly, but effective. - // Without it, we get "Spurious Interrupt!" failures. - ioaddr = p_i82559->io_address; // get I/O address for 82559 - mask = (1 << p_i82559->vector); // Do not include the MUX vector or we - sources = *(cyg_uint32 *)INTEGRATOR_IRQCONT_IRQSTATUS; //...get hung on the other 82559 - status = INW(ioaddr + SCBStatus); - - while ( ((0 != (sources & mask)) || (0 != (status & SCB_INTACK_MASK))) - && --loops >= 0) { - OUTW( status & SCB_INTACK_MASK, ioaddr + SCBStatus); - cyg_drv_interrupt_acknowledge(p_i82559->vector); - -#ifdef CYGDBG_USE_ASSERTS - acknowledge82559interrupt_compensating++; // verify this is executed -#endif - sources = *(cyg_uint32 *)INTEGRATOR_IRQCONT_IRQSTATUS; - status = INW(ioaddr + SCBStatus); - } - CYG_ASSERT( loops >= 0, "Acknowledge82559Interrupt" ); -} - - -static void udelay(int delay) -{ - int i; - // the loop is going to take 3 ticks. At 228 MHz, to give uS, multiply - // by 228/3 = 76 near enough. No volatile is needed on i; gcc recognizes - // delay loops and does NOT elide them. - for ( i = 76 * delay; i ; i--) - ; -} - -// ------------------------------------------------------------------------ -// Memory management -// -// Simply carve off from the front of the PCI mapped window into real memory - -static void *pciwindow_mem_alloc(int size) -{ - void *p_memory; - - CYG_ASSERT( - (CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_BASE <= (int)i82559_heap_free) - && - ((CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_BASE + - CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_SIZE) > (int)i82559_heap_free) - && - (0 < i82559_heap_size) - && - (CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_SIZE >= i82559_heap_size) - && - (CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_BASE == (int)i82559_heap_base), - "Heap variables corrupted" ); - - p_memory = (void *)0; - size = (size + 3) & ~3; - if ( (i82559_heap_free + size) < (i82559_heap_base + i82559_heap_size) ) { - cyg_uint32 *p; - p_memory = (void *)i82559_heap_free; - i82559_heap_free += size; - for ( p = (cyg_uint32 *)p_memory; size > 0; size -= 4 ) - *p++ = 0; - } - - return p_memory; -} - -// ------------------------------------------------------------------------ -// -// GET EEPROM SIZE -// -// ------------------------------------------------------------------------ -static int get_eeprom_size(long ioaddr) -{ - unsigned short retval = 0; - int ee_addr = ioaddr + SCBeeprom; - int i, addrbits; - - // Should already be not-selected, but anyway: - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_ENABLE_DELAY); - OUTW(EE_ENB, ee_addr); - eeprom_delay(EEPROM_ENABLE_DELAY); - - // Shift the read command bits out. - for (i = 2; i >= 0; i--) { - short dataval = (6 & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(EE_ENB | dataval , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB | dataval , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - } - // Now clock out address zero, looking for the dummy 0 data bit - for ( i = 1; i <= 12; i++ ) { - OUTW(EE_ENB , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB | EE_SHIFT_CLK, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - retval = INW(ee_addr) & EE_DATA_READ; - if ( 0 == retval ) - break; // The dummy zero est arrive' - } - -#ifdef DEBUG_EE - os_printf( "eeprom data bits %d (ioaddr %x)\n", i, ee_addr ); -#endif - if ( 6 != i && 8 != i ) { -#ifdef DEBUG_EE - os_printf( "*****EEPROM data bits not 6 or 8*****\n" ); -#endif - i = 6; - } - addrbits = i; - - // clear the dataval, leave the clock low to read in the data regardless - OUTW(EE_ENB, ee_addr); - eeprom_delay(1); - - retval = INW(ee_addr); - if ( (EE_DATA_READ & retval) != 0 ) { -#ifdef DEBUG_EE - os_printf( "Size EEPROM: Dummy data bit not 0, reg %x\n" , retval ); -#endif - } - eeprom_delay(1); - - for (i = EE_TOP_DATA_BIT; i >= 0; i--) { - OUTW(EE_ENB | EE_SHIFT_CLK, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - retval = INW(ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - } - - // Terminate the EEPROM access. - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_DONE_DELAY); - - return addrbits; -} - - -// ------------------------------------------------------------------------ -// -// READ EEPROM -// -// ------------------------------------------------------------------------ -static int read_eeprom(long ioaddr, int location, int addr_len) -{ - unsigned short retval = 0; - int ee_addr = ioaddr + SCBeeprom; - int read_cmd = location | EE_READ_CMD(addr_len); - int i, tries = 10; - - try_again: - // Should already be not-selected, but anyway: - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_ENABLE_DELAY); - OUTW(EE_ENB, ee_addr); - eeprom_delay(EEPROM_ENABLE_DELAY); - - // Shift the read command bits out, changing only one bit per time. - for (i = EE_TOP_CMD_BIT(addr_len); i >= 0; i--) { - short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(EE_ENB | dataval , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB | dataval , ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - } - - // clear the dataval, leave the clock low - OUTW(EE_ENB, ee_addr); - eeprom_delay(1); - - retval = INW(ee_addr); - // This should show a zero in the data read bit to confirm that the - // address transfer is compelete. If not, go to the start and try - // again! - if ( (0 != (retval & EE_DATA_READ)) && (tries-- > 0) ) { - // Terminate the EEPROM access. - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_DONE_DELAY); -#ifdef DEBUG_EE - os_printf( "Warning: Retrying EEPROM read word %d, address %x, try %d\n", - location, ee_addr, tries+1 ); -#endif - goto try_again; - } - - // This fires with one device on one of the customer boards! - // (but is OK on all other h/w. Worrying huh.) - if ( (EE_DATA_READ & retval) != 0 ) { -#ifdef DEBUG_EE - os_printf( "Read EEPROM: Dummy data bit not 0, reg %x\n" , retval ); -#endif - } - eeprom_delay(1); - retval = 0; - - for (i = EE_TOP_DATA_BIT; i >= 0; i--) { - OUTW(EE_ENB | EE_SHIFT_CLK, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - retval = (retval << 1) | ((INW(ee_addr) & EE_DATA_READ) ? 1 : 0); - eeprom_delay(EEPROM_SK_DELAY); - OUTW(EE_ENB, ee_addr); - eeprom_delay(EEPROM_SK_DELAY); - } - - // Terminate the EEPROM access. - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_DONE_DELAY); - - return retval; -} - - -// ------------------------------------------------------------------------ -// -// NETWORK INTERFACE INITIALIZATION -// -// Function : Init82559 -// -// Description : -// This routine resets, configures, and initializes the chip. -// It also clears the ethernet statistics structure, and selects -// which statistics are supported by this driver. -// -// ------------------------------------------------------------------------ -static bool -integrator_i82559_init(struct cyg_netdevtab_entry * ndp) -{ - static int initialized = 0; // only probe PCI et al *once* - - struct eth_drv_sc *sc; - cyg_uint32 selftest; - volatile cyg_uint32 *p_selftest; - cyg_uint32 ioaddr; - cyg_uint16 checksum; - int count; - int i; - int addr_length; - cyg_uint8 mac_address[6]; - struct i82559 *p_i82559; - -#ifdef DEBUG - db_printf("integrator_i82559_init\n"); -#endif - - sc = (struct eth_drv_sc *)(ndp->device_instance); - p_i82559 = (struct i82559 *)(sc->driver_private); - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "Bad device private pointer %x\n", sc->driver_private ); -#endif - return 0; - } - - CHECK_NDP_SC_LINK(); - - if ( 0 == initialized++ ) { - // then this is the first time ever: - if ( ! pci_init_find_82559s() ) { -#ifdef DEBUG - os_printf( "pci_init_find_82559s failed" ); -#endif - return 0; - } - } - - if ( ! p_i82559->found ) // no device on PCI bus - return (0); - - ioaddr = p_i82559->io_address; // get I/O address for 82559 - -#ifdef DEBUG - os_printf("Init82559 %d @ %x\n82559 Self Test\n", - p_i82559->index, (int)ndp); -#endif - - Mask82559Interrupt(p_i82559); - - wait_for_cmd_done(ioaddr); // make sure no command operating - - i82559_reset(p_i82559); - - // Perform a system self-test. (get enough mem to round address) - if ( (selftest = (cyg_uint32)pciwindow_mem_alloc(32) ) == 0) - return (0); - - p_selftest = (cyg_uint32 *) ((selftest + 15) & ~0xf); - p_selftest[0] = p_selftest[1] = -1; - - OUTL( (VIRT_TO_BUS(p_selftest)) | I82559_SELFTEST, ioaddr + SCBPort); - count = 0x7FFFF; // Timeout for self-test. - do { - udelay(10); - } while ( (p_selftest[1] == -1) && (--count >= 0) ); - - Acknowledge82559Interrupt(p_i82559); - UnMask82559Interrupt(p_i82559); - - if (count < 0) { - // Test timed out. -#ifdef DEBUG - os_printf("Self test failed\n"); -#endif - return (0); - } -#ifdef DEBUG - os_printf(" General self-test: %s.\n" - " Serial sub-system self-test: %s.\n" - " Internal registers self-test: %s.\n" - " ROM checksum self-test: %s (%08X).\n", - p_selftest[1] & 0x1000 ? "failed" : "passed", - p_selftest[1] & 0x0020 ? "failed" : "passed", - p_selftest[1] & 0x0008 ? "failed" : "passed", - p_selftest[1] & 0x0004 ? "failed" : "passed", - p_selftest[0]); -#endif - - // read eeprom and get 82559's mac address - addr_length = get_eeprom_size(ioaddr); - // (this is the length of the *EEPROM*s address, not MAC address) - - for (checksum = 0, i = 0, count = 0; count < 64; count++) { - cyg_uint16 value; - // read word from eeprom - value = read_eeprom(ioaddr, count, addr_length); -#ifdef DEBUG_EE - // os_printf( "%2d: %04x\n", count, value ); -#endif - checksum += value; - if (count < 3) { - mac_address[i++] = value & 0xFF; - mac_address[i++] = (value >> 8) & 0xFF; - } - } - - // If the EEPROM checksum is wrong, the MAC address read from the - // EEPROM is probably wrong as well. In that case, we don't set - // mac_addr_ok, but continue the initialization. If then somebody calls - // i82559_start without calling eth_set_mac_address() first, we refuse - // to bring up the interface, because running with an invalid MAC - // address is not a very brilliant idea. - - if ((checksum & 0xFFFF) != 0xBABA) { - // selftest verified checksum, verify again -#ifdef DEBUG_EE - os_printf( "Warning: Invalid EEPROM checksum %04X for device %d\n", - checksum, p_i82559->index); -#endif - } else { - p_i82559->mac_addr_ok = 1; -#ifdef DEBUG_EE - os_printf("Valid EEPROM checksum %x\n", checksum); -#endif - } -#ifdef DEBUG - os_printf("MAC Address = %02X %02X %02X %02X %02X %02X\n", - mac_address[0], mac_address[1], mac_address[2], mac_address[3], - mac_address[4], mac_address[5]); -#endif - - // record the MAC address in the device structure - p_i82559->mac_address[0] = mac_address[0]; - p_i82559->mac_address[1] = mac_address[1]; - p_i82559->mac_address[2] = mac_address[2]; - p_i82559->mac_address[3] = mac_address[3]; - p_i82559->mac_address[4] = mac_address[4]; - p_i82559->mac_address[5] = mac_address[5]; - - // and record the net dev pointer - p_i82559->ndp = (void *)ndp; - - InitRxRing(p_i82559); - InitTxRing(p_i82559); - - // Initialize upper level driver - if ( p_i82559->mac_addr_ok ) - (sc->funs->eth_drv->init)(sc, &(p_i82559->mac_address[0]) ); - else - (sc->funs->eth_drv->init)(sc, 0 ); - - return (1); -} - -// ------------------------------------------------------------------------ -// -// Function : i82559_start -// -// ------------------------------------------------------------------------ -static void i82559_start( struct eth_drv_sc *sc, - unsigned char *enaddr, int flags ) -{ - struct i82559 *p_i82559; - cyg_uint32 ioaddr; -#ifdef KEEP_STATISTICS - void *p_statistics; -#endif -#ifdef CYGPKG_NET - struct ifnet *ifp = &sc->sc_arpcom.ac_if; -#endif - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_start: Bad device pointer %x\n", p_i82559 ); -#endif - return; - } - - if ( ! p_i82559->mac_addr_ok ) { -#ifdef DEBUG - os_printf("i82559_start %d: invalid MAC address, " - "can't bring up interface\n", - p_i82559->index ); -#endif - return; - } - - if ( p_i82559->active ) - i82559_stop( sc ); - - ioaddr = p_i82559->io_address; // get 82559's I/O address - -#ifdef KEEP_STATISTICS -#ifdef CYGDBG_DEVS_ETH_ARM_INTEGRATOR_KEEP_82559_STATISTICS - p_i82559->p_statistics = - p_statistics = pciwindow_mem_alloc(sizeof(I82559_COUNTERS)); - memset(p_statistics, 0xFFFFFFFF, sizeof(I82559_COUNTERS)); - wait_for_cmd_done(ioaddr); // make sure no command operating - // set statistics dump address - OUTL(VIRT_TO_BUS(p_statistics), ioaddr + SCBPointer); - OUTW(SCB_M | CU_STATSADDR, ioaddr + SCBCmd); - - wait_for_cmd_done(ioaddr); // make sure no command operating - OUTW(SCB_M | CU_DUMPSTATS, ioaddr + SCBCmd); // start register dump -#endif -#endif - - // Set the base address - wait_for_cmd_done(ioaddr); - OUTL(0, ioaddr + SCBPointer); // load ru base address = 0 - OUTW(SCB_M | RUC_ADDR_LOAD, ioaddr + SCBCmd); - udelay( 1000 ); // load pointer to Rx Ring - OUTL(VIRT_TO_BUS(p_i82559->rx_ring[0]), ioaddr + SCBPointer); - OUTW(RUC_START, ioaddr + SCBCmd); - - p_i82559->active = 1; - -#ifdef CYGPKG_NET - if (( 0 -#ifdef ETH_DRV_FLAGS_PROMISC_MODE - != (flags & ETH_DRV_FLAGS_PROMISC_MODE) -#endif - ) || (ifp->if_flags & IFF_PROMISC) - ) { - eth_set_promiscuous_mode(p_i82559); - } -#endif - -#ifdef DEBUG - { - int status = i82559_status( sc ); - os_printf("i82559_start %d flg %x Link = %s, %s Mbps, %s Duplex\n", - p_i82559->index, - *(int *)p_i82559, - status & GEN_STATUS_LINK ? "Up" : "Down", - status & GEN_STATUS_100MBPS ? "100" : "10", - status & GEN_STATUS_FDX ? "Full" : "Half"); - } -#endif -} - -// ------------------------------------------------------------------------ -// -// Function : i82559_status -// -// ------------------------------------------------------------------------ -int i82559_status( struct eth_drv_sc *sc ) -{ - int status; - struct i82559 *p_i82559; - cyg_uint32 ioaddr; - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_status: Bad device pointer %x\n", p_i82559 ); -#endif - return 0; - } - - ioaddr = p_i82559->io_address; // get 82559's I/O address - - status = INB(ioaddr + SCBGenStatus); - - return status; -} - -// ------------------------------------------------------------------------ -// -// Function : BringDown82559 -// -// ------------------------------------------------------------------------ - -static void i82559_stop( struct eth_drv_sc *sc ) -{ - struct i82559 *p_i82559; - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_stop: Bad device pointer %x\n", p_i82559 ); -#endif - return; - } - -#ifdef DEBUG - os_printf("i82559_stop %d flg %x\n", p_i82559->index, *(int *)p_i82559 ); -#endif - - p_i82559->active = 0; // stop people tormenting it - i82559_reset(p_i82559); // that should stop it - - ResetRxRing( p_i82559 ); - ResetTxRing( p_i82559 ); -} - - -// ------------------------------------------------------------------------ -// -// Function : InitRxRing -// -// ------------------------------------------------------------------------ -static void InitRxRing(struct i82559* p_i82559) -{ - int i, j; - RFD *rfd; - RFD *p_rfd = 0; -#ifdef DEBUG_82559 - os_printf("InitRxRing %d\n", p_i82559->index); -#endif - for ( i = 0; i < MAX_RX_DESCRIPTORS; i++ ) { - rfd = (RFD *)pciwindow_mem_alloc(sizeof(RFD) + MAX_RX_PACKET_SIZE); - p_i82559->rx_ring[i] = rfd; - if ( i ) - p_rfd->link = VIRT_TO_BUS(rfd); - p_rfd = (RFD *)rfd; - } - // link last RFD to first: - p_rfd->link = VIRT_TO_BUS(p_i82559->rx_ring[0]); - - ResetRxRing( p_i82559 ); -} - -// ------------------------------------------------------------------------ -// -// Function : ResetRxRing -// -// ------------------------------------------------------------------------ -static void ResetRxRing(struct i82559* p_i82559) -{ - RFD *p_rfd; - int i; -#ifdef DEBUG_82559 - os_printf("ResetRxRing %d\n", p_i82559->index); -#endif - for ( i = 0; i < MAX_RX_DESCRIPTORS; i++ ) { - p_rfd = p_i82559->rx_ring[i]; - CYG_ASSERT( (cyg_uint8 *)p_rfd >= i82559_heap_base, "rfd under" ); - CYG_ASSERT( (cyg_uint8 *)p_rfd < i82559_heap_free, "rfd over" ); - CYG_ASSERT( p_i82559->rx_ring[ - ( i ? (i-1) : (MAX_RX_DESCRIPTORS-1) ) - ]->link == VIRT_TO_BUS(p_rfd), "rfd linked list broken" ); - p_rfd->rxstatus = 0; - p_rfd->count = 0; - p_rfd->f = 0; - p_rfd->eof = 0; - p_rfd->rdb_address = 0xFFFFFFFF; - p_rfd->size = MAX_RX_PACKET_SIZE; - } - p_i82559->next_rx_descriptor = 0; - // And set an end-of-list marker in the previous one. - p_rfd->rxstatus = RFD_STATUS_EL; -} - -// ------------------------------------------------------------------------ -// -// Function : PacketRxReady (Called from delivery thread) -// -// ------------------------------------------------------------------------ -static void PacketRxReady(struct i82559* p_i82559) -{ - RFD *p_rfd; - int next_descriptor; - int length; - struct cyg_netdevtab_entry *ndp; - struct eth_drv_sc *sc; - cyg_uint32 ioaddr; - cyg_uint16 status; - - ndp = (struct cyg_netdevtab_entry *)(p_i82559->ndp); - sc = (struct eth_drv_sc *)(ndp->device_instance); - - CHECK_NDP_SC_LINK(); - - ioaddr = p_i82559->io_address; - - next_descriptor = p_i82559->next_rx_descriptor; - p_rfd = p_i82559->rx_ring[next_descriptor]; - - CYG_ASSERT( (cyg_uint8 *)p_rfd >= i82559_heap_base, "rfd under" ); - CYG_ASSERT( (cyg_uint8 *)p_rfd < i82559_heap_free, "rfd over" ); - - while ( p_rfd->rxstatus & RFD_STATUS_C ) { - p_rfd->rxstatus_hi |= RFD_STATUS_HI_EL; - length = p_rfd->count; - -#ifdef DEBUG_82559 - os_printf( "Device %d (eth%d), rx descriptor %d:\n", - p_i82559->index, p_i82559->index, next_descriptor ); -// dump_rfd( p_rfd, 1 ); -#endif - - p_i82559->next_rx_descriptor = next_descriptor; - // Check for bogusly short packets; can happen in promisc mode: - // Asserted against and checked by upper layer driver. -#ifdef CYGPKG_NET - if ( length > sizeof( struct ether_header ) ) - // then it is acceptable; offer the data to the network stack -#endif - (sc->funs->eth_drv->recv)( sc, length ); - - p_rfd->count = 0; - p_rfd->f = 0; - p_rfd->eof = 0; - p_rfd->rxstatus_lo = 0; - - // The just-emptied slot is now ready for re-use and already marked EL; - // we can now remove the EL marker from the previous one. - if ( 0 == next_descriptor ) - p_rfd = p_i82559->rx_ring[ MAX_RX_DESCRIPTORS-1 ]; - else - p_rfd = p_i82559->rx_ring[ next_descriptor-1 ]; - // The previous one: check it *was* marked before clearing. - CYG_ASSERT( p_rfd->rxstatus_hi & RFD_STATUS_HI_EL, "No prev EL" ); - p_rfd->rxstatus_hi = 0; // that word is not written by the device. - -#ifdef KEEP_STATISTICS - statistics[p_i82559->index].rx_deliver++; -#endif - if (++next_descriptor >= MAX_RX_DESCRIPTORS) - next_descriptor = 0; - p_rfd = p_i82559->rx_ring[next_descriptor]; - - CYG_ASSERT( (cyg_uint8 *)p_rfd >= i82559_heap_base, "rfd under" ); - CYG_ASSERT( (cyg_uint8 *)p_rfd < i82559_heap_free, "rfd over" ); - } - - // See if the RU has gone idle (usually because of out of resource - // condition) and restart it if needs be. - Mask82559Interrupt(p_i82559); - status = INW(ioaddr + SCBStatus); - - if ( RU_STATUS_READY != (status & RU_STATUS_MASK) ) { - // Acknowledge the RX INT sources - OUTW( SCB_INTACK_RX, ioaddr + SCBStatus); - // (see pages 6-10 & 6-90) - -#ifdef KEEP_STATISTICS - statistics[p_i82559->index].rx_restart++; -#endif - // There's an end-of-list marker out there somewhere... - // So mop it up; it takes a little time but this is infrequent. - ResetRxRing( p_i82559 ); - next_descriptor = 0; // re-initialize next desc. - // wait for SCB command complete - wait_for_cmd_done(ioaddr); - // load pointer to Rx Ring - OUTL(VIRT_TO_BUS(p_i82559->rx_ring[0]), - ioaddr + SCBPointer); - OUTW(RUC_START, ioaddr + SCBCmd); - Acknowledge82559Interrupt(p_i82559); - } - UnMask82559Interrupt(p_i82559); - - p_i82559->next_rx_descriptor = next_descriptor; -} - -// and the callback function - -static void i82559_recv( struct eth_drv_sc *sc, - struct eth_drv_sg *sg_list, int sg_len ) -{ - struct i82559 *p_i82559; - RFD *p_rfd; - int next_descriptor; - int total_len; - struct eth_drv_sg *last_sg; - volatile cyg_uint8 *from_p; - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_recv: Bad device pointer %x\n", p_i82559 ); -#endif - return; - } - - next_descriptor = p_i82559->next_rx_descriptor; - p_rfd = p_i82559->rx_ring[next_descriptor]; - - CYG_ASSERT( (cyg_uint8 *)p_rfd >= i82559_heap_base, "rfd under" ); - CYG_ASSERT( (cyg_uint8 *)p_rfd < i82559_heap_free, "rfd over" ); - - CYG_ASSERT( p_rfd->rxstatus & RFD_STATUS_C, "No complete frame" ); - CYG_ASSERT( p_rfd->rxstatus & RFD_STATUS_EL, "No marked frame" ); - - CYG_ASSERT( p_rfd->rxstatus_lo & RFD_STATUS_LO_C, "No complete frame 2" ); - CYG_ASSERT( p_rfd->rxstatus_hi & RFD_STATUS_HI_EL, "No marked frame 2" ); - - if ( 0 == (p_rfd->rxstatus & RFD_STATUS_C) ) - return; - - total_len = p_rfd->count; - -#ifdef DEBUG_82559 - os_printf("Rx %d %x (status %x): %d sg's, %d bytes\n", - p_i82559->index, (int)p_i82559, p_rfd->rxstatus, sg_len, total_len); -#endif - - // Copy the data to the network stack - from_p = &p_rfd->buffer[0]; - - // check we have memory to copy into; we would be called even if - // caller was out of memory in order to maintain our state. - if ( 0 == sg_len || 0 == sg_list ) - return; // caller was out of mbufs - - CYG_ASSERT( 0 < sg_len, "sg_len underflow" ); - CYG_ASSERT( MAX_ETH_DRV_SG >= sg_len, "sg_len overflow" ); - - for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) { - cyg_uint8 *to_p; - int l; - - to_p = (cyg_uint8 *)(sg_list->buf); - l = sg_list->len; - - CYG_ASSERT( 0 <= l, "sg length -ve" ); - - if ( 0 >= l || 0 == to_p ) - return; // caller was out of mbufs - - if ( l > total_len ) - l = total_len; - - memcpy( to_p, (unsigned char *)from_p, l ); - from_p += l; - total_len -= l; - } - - CYG_ASSERT( 0 == total_len, "total_len mismatch in rx" ); - CYG_ASSERT( last_sg == sg_list, "sg count mismatch in rx" ); - CYG_ASSERT( &p_rfd->buffer[0] < from_p, "from_p wild in rx" ); - CYG_ASSERT( &p_rfd->buffer[0] + MAX_RX_PACKET_SIZE >= from_p, - "from_p overflow in rx" ); -} - - -// ------------------------------------------------------------------------ -// -// Function : InitTxRing -// -// ------------------------------------------------------------------------ -static void InitTxRing(struct i82559* p_i82559) -{ - int i, j; - cyg_uint32 ioaddr; - -#ifdef DEBUG_82559 - os_printf("InitTxRing %d\n", p_i82559->index); -#endif - ioaddr = p_i82559->io_address; - for ( i = 0; i < MAX_TX_DESCRIPTORS; i++) { - p_i82559->tx_ring[i] = (TxCB *)pciwindow_mem_alloc( - sizeof(TxCB) + MAX_TX_PACKET_SIZE); - } - ResetTxRing(p_i82559); -} - -// ------------------------------------------------------------------------ -// -// Function : ResetTxRing -// -// ------------------------------------------------------------------------ -static void ResetTxRing(struct i82559* p_i82559) -{ - int i; - cyg_uint32 ioaddr; - -#ifdef DEBUG_82559 - os_printf("ResetTxRing %d\n", p_i82559->index); -#endif - ioaddr = p_i82559->io_address; - p_i82559->tx_descriptor_add = - p_i82559->tx_descriptor_active = - p_i82559->tx_descriptor_remove = 0; - p_i82559->tx_in_progress = - p_i82559->tx_queue_full = 0; - - for ( i = 0; i < MAX_TX_DESCRIPTORS; i++) { - TxCB *p_txcb = p_i82559->tx_ring[i]; - CYG_ASSERT( (cyg_uint8 *)p_txcb >= i82559_heap_base, "txcb under" ); - CYG_ASSERT( (cyg_uint8 *)p_txcb < i82559_heap_free, "txcb over" ); - - p_txcb->txstatus = 0; - p_txcb->command = 0; - p_txcb->link = VIRT_TO_BUS((cyg_uint32)p_txcb); - p_txcb->tbd_address = 0xFFFFFFFF; - p_txcb->tbd_number = 0; - p_txcb->tx_threshold = 16; - p_txcb->eof = 1; - p_txcb->count = 0; - p_i82559->tx_keys[i] = 0; - } - - wait_for_cmd_done(ioaddr); - OUTL(0, ioaddr + SCBPointer); - OUTW(SCB_M | CU_ADDR_LOAD, ioaddr + SCBCmd); -} - -// ------------------------------------------------------------------------ -// -// Function : TxMachine (Called from FG & ISR) -// -// This steps the Tx Machine onto the next record if necessary - allowing -// for missed interrupts, and so on. -// ------------------------------------------------------------------------ - -static void TxMachine(struct i82559* p_i82559) -{ - int tx_descriptor_active; - cyg_uint32 ioaddr; - - tx_descriptor_active = p_i82559->tx_descriptor_active; - ioaddr = p_i82559->io_address; - - // See if the CU is idle when we think it isn't; this is the only place - // tx_descriptor_active is advanced. (Also recovers from a dropped intr) - if ( p_i82559->tx_in_progress ) { - cyg_uint16 status; - status = INW(ioaddr + SCBStatus); - if ( 0 == (status & CU_STATUS_MASK) ) { - // It is idle. So ack the TX interrupts - OUTW( SCB_INTACK_TX, ioaddr + SCBStatus); - // (see pages 6-10 & 6-90) - - // and step on to the next queued tx. - p_i82559->tx_in_progress = 0; - if ( ++tx_descriptor_active >= MAX_TX_DESCRIPTORS ) - tx_descriptor_active = 0; - p_i82559->tx_descriptor_active = tx_descriptor_active; - } - } - - // is the CU idle, and there a next tx to set going? - if ( ( ! p_i82559->tx_in_progress ) - && p_i82559->tx_descriptor_add != tx_descriptor_active ) { - TxCB *p_txcb; - p_txcb = p_i82559->tx_ring[tx_descriptor_active]; - CYG_ASSERT( (cyg_uint8 *)p_txcb >= i82559_heap_base, "txcb under" ); - CYG_ASSERT( (cyg_uint8 *)p_txcb < i82559_heap_free, "txcb over" ); -#ifdef DEBUG_82559 - os_printf("Tx %d %x: Starting Engines\n", - p_i82559->index, (int)p_i82559); -#endif - // make sure no command operating - wait_for_cmd_done(ioaddr); - // start Tx operation - OUTL(VIRT_TO_BUS(p_txcb), ioaddr + SCBPointer); - OUTW(CU_START, ioaddr + SCBCmd); - p_i82559->tx_in_progress = 1; - } -} - -// ------------------------------------------------------------------------ -// -// Function : TxDone (Called from delivery thread) -// -// This returns Tx's from the Tx Machine to the stack (ie. reports -// completion) - allowing for missed interrupts, and so on. -// ------------------------------------------------------------------------ - -static void TxDone(struct i82559* p_i82559) -{ - struct cyg_netdevtab_entry *ndp; - struct eth_drv_sc *sc; - int tx_descriptor_remove = p_i82559->tx_descriptor_remove; - - ndp = (struct cyg_netdevtab_entry *)(p_i82559->ndp); - sc = (struct eth_drv_sc *)(ndp->device_instance); - - CHECK_NDP_SC_LINK(); - - // "Done" txen are from here to active, OR - // the remove one if the queue is full AND its status is nonzero: - while ( (tx_descriptor_remove != p_i82559->tx_descriptor_active) || - ( p_i82559->tx_queue_full && - (0 != p_i82559->tx_ring[ tx_descriptor_remove ]->txstatus) ) ) { - unsigned long key = p_i82559->tx_keys[ tx_descriptor_remove ]; -#ifdef DEBUG_82559 - os_printf("TxDone %d %x: KEY %x\n", - p_i82559->index, (int)p_i82559, key ); -#endif - (sc->funs->eth_drv->tx_done)( sc, key, 1 /* status */ ); - - if ( ++tx_descriptor_remove >= MAX_TX_DESCRIPTORS ) - tx_descriptor_remove = 0; - p_i82559->tx_descriptor_remove = tx_descriptor_remove; - p_i82559->tx_queue_full = 0; - } -} - - -// ------------------------------------------------------------------------ -// -// Function : i82559_can_send -// -// ------------------------------------------------------------------------ - -static int -i82559_can_send(struct eth_drv_sc *sc) -{ - struct i82559 *p_i82559; - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_send: Bad device pointer %x\n", p_i82559 ); -#endif - return 0; - } - - // Advance TxMachine atomically - Mask82559Interrupt(p_i82559); - TxMachine(p_i82559); - Acknowledge82559Interrupt(p_i82559); - PacketRxReady(p_i82559); /* FIX: 16/07/01 added from ebsa */ - UnMask82559Interrupt(p_i82559); - - return ! p_i82559->tx_queue_full; -} - -// ------------------------------------------------------------------------ -// -// Function : i82559_send -// -// ------------------------------------------------------------------------ - -static void -i82559_send(struct eth_drv_sc *sc, - struct eth_drv_sg *sg_list, int sg_len, int total_len, - unsigned long key) -{ - struct i82559 *p_i82559; - int tx_descriptor_add; - TxCB *p_txcb; - cyg_uint32 ioaddr; - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_send: Bad device pointer %x\n", p_i82559 ); -#endif - return; - } - -#ifdef DEBUG_82559 - os_printf("Tx %d %x: %d sg's, %d bytes, KEY %x = %d\n", - p_i82559->index, (int)p_i82559, sg_len, total_len, key, *(int *)key); -#endif - - if ( ! p_i82559->active ) - return; // device inactive, no return - -#ifdef KEEP_STATISTICS - statistics[p_i82559->index].tx_count++; -#endif - ioaddr = p_i82559->io_address; // get device I/O address - - if ( p_i82559->tx_queue_full ) { -#ifdef KEEP_STATISTICS - statistics[p_i82559->index].tx_dropped++; -#endif -#ifdef DEBUG_82559 - os_printf( "i82559_send: Queue full, device %x, key %x\n", - p_i82559, key ); -#endif - } else { - struct eth_drv_sg *last_sg; - volatile cyg_uint8 *to_p; - - tx_descriptor_add = p_i82559->tx_descriptor_add; - - p_i82559->tx_keys[tx_descriptor_add] = key; - - p_txcb = p_i82559->tx_ring[tx_descriptor_add]; - - CYG_ASSERT( (cyg_uint8 *)p_txcb >= i82559_heap_base, "txcb under" ); - CYG_ASSERT( (cyg_uint8 *)p_txcb < i82559_heap_free, "txcb over" ); - - p_txcb->txstatus = 0; - p_txcb->command = TxCB_CMD_TRANSMIT | TxCB_CMD_S - | TxCB_CMD_I | TxCB_CMD_EL; - p_txcb->link = VIRT_TO_BUS((cyg_uint32)p_txcb); - p_txcb->tbd_address = 0xFFFFFFFF; - p_txcb->tbd_number = 0; - p_txcb->tx_threshold = 16; - p_txcb->eof = 1; - p_txcb->count = total_len; - - // Copy from the sglist into the txcb - to_p = &p_txcb->buffer[0]; - - CYG_ASSERT( 0 < sg_len, "sg_len underflow" ); - CYG_ASSERT( MAX_ETH_DRV_SG >= sg_len, "sg_len overflow" ); - - for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) { - cyg_uint8 *from_p; - int l; - - from_p = (cyg_uint8 *)(sg_list->buf); - l = sg_list->len; - - if ( l > total_len ) - l = total_len; - - memcpy( (unsigned char *)to_p, from_p, l ); - to_p += l; - total_len -= l; - - if ( 0 > total_len ) - break; // Should exit via sg_last normally - } - - CYG_ASSERT( 0 == total_len, "length mismatch in tx" ); - CYG_ASSERT( last_sg == sg_list, "sg count mismatch in tx" ); - CYG_ASSERT( &p_txcb->buffer[0] < to_p, "to_p wild in tx" ); - CYG_ASSERT( &p_txcb->buffer[0] + MAX_TX_PACKET_SIZE >= to_p, - "to_p overflow in tx" ); - - // Next descriptor - if ( ++tx_descriptor_add >= MAX_TX_DESCRIPTORS) - tx_descriptor_add = 0; - p_i82559->tx_descriptor_add = tx_descriptor_add; - - // From this instant, interrupts can advance the world and start, - // even complete, this tx request... - - if ( p_i82559->tx_descriptor_remove == tx_descriptor_add ) - p_i82559->tx_queue_full = 1; - } - - // Try advancing the Tx Machine regardless - - // no more interrupts until started - Mask82559Interrupt(p_i82559); - - // Check that either: - // tx is already active, there is other stuff queued, - // OR this tx just added is the current active one - // OR this tx just added is already complete - CYG_ASSERT( - // The machine is busy: - (p_i82559->tx_in_progress == 1) || - // or: The machine is idle and this just added is the next one - (((p_i82559->tx_descriptor_add-1) == p_i82559->tx_descriptor_active) - || ((0 == p_i82559->tx_descriptor_add) && - ((MAX_TX_DESCRIPTORS-1) == p_i82559->tx_descriptor_active))) || - // or: This tx is already complete - (p_i82559->tx_descriptor_add == p_i82559->tx_descriptor_active), - "Active/add mismatch" ); - - // Advance TxMachine atomically - TxMachine(p_i82559); - Acknowledge82559Interrupt(p_i82559); - PacketRxReady(p_i82559); /* FIX: 16/07/01 added from ebsa */ - UnMask82559Interrupt(p_i82559); -} - -// ------------------------------------------------------------------------ -// -// Function : i82559_reset -// -// ------------------------------------------------------------------------ -static void i82559_reset(struct i82559* p_i82559) -{ - cyg_uint32 ioaddr; - int count; - - ioaddr = p_i82559->io_address; - // make sure no command operating - wait_for_cmd_done(ioaddr); - - OUTL(I82559_SELECTIVE_RESET, ioaddr + SCBPort); - - for (count = 10 ; count-- ; ) { - udelay(1000); - } - - OUTL(I82559_RESET, ioaddr + SCBPort); - - for (count = 10 ; count-- ; ) { - udelay(1000); - } -} - - -// ------------------------------------------------------------------------ -// -// INTERRUPT HANDLERS -// -// ------------------------------------------------------------------------ - -static cyg_uint32 eth_isr(cyg_vector_t vector, cyg_addrword_t data) -{ - struct i82559* p_i82559 = (struct i82559 *)data; - cyg_uint16 status; - cyg_uint32 ioaddr; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_isr: Bad device pointer %x\n", (cyg_uint8 *)p_i82559 ); -#endif - return 0; - } - - ioaddr = p_i82559->io_address; - status = INW(ioaddr + SCBStatus); - - // Acknowledge all INT sources that were active - OUTW( status & SCB_INTACK_MASK, ioaddr + SCBStatus); - // (see pages 6-10 & 6-90) - -#ifdef KEEP_STATISTICS - statistics[p_i82559->index].interrupts++; - - // receiver left ready state ? - if ( status & SCB_STATUS_RNR ) - statistics[p_i82559->index].rx_resource++; - - // frame receive interrupt ? - if ( status & SCB_STATUS_FR ) - statistics[p_i82559->index].rx_count++; - - // transmit interrupt ? - if ( status & SCB_STATUS_CX ) - statistics[p_i82559->index].tx_complete++; -#endif - - // Advance the Tx Machine regardless - TxMachine(p_i82559); - - // it should have settled down now... - Acknowledge82559Interrupt(p_i82559); - - return CYG_ISR_CALL_DSR; // schedule DSR -} - - -// ------------------------------------------------------------------------ -static -void eth_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) -{ - struct i82559* p_i82559 = (struct i82559 *)data; - struct cyg_netdevtab_entry *ndp = - (struct cyg_netdevtab_entry *)(p_i82559->ndp); - struct eth_drv_sc *sc = (struct eth_drv_sc *)(ndp->device_instance); - - // but here, it must be a *sc: - eth_drv_dsr( vector, count, (cyg_addrword_t)sc ); -} - -// ------------------------------------------------------------------------ -// This is called from the function below (used to be uni-DSR) -static inline void -uni_deliver(struct i82559* p_i82559) -{ - // First pass any rx data up the stack - PacketRxReady(p_i82559); - - // Then scan for completed Txen and inform the stack - TxDone(p_i82559); -} - -// ------------------------------------------------------------------------ - -void i82559_deliver(struct eth_drv_sc *sc) -{ - struct i82559* p_i82559; - int device_index = mux_device_index; - - // Since this must mux both devices, the incoming arg is ignored. - mux_device_index ^= 1; // look at the other one first next time. - do { - p_i82559 = &i82559[device_index]; - if ( p_i82559->active ) - uni_deliver( p_i82559 ); - device_index ^= 1; - } while ( device_index == mux_device_index ); -} - -// ------------------------------------------------------------------------ -// Device table entry to operate the chip in a polled mode. - -void i82559_poll(struct eth_drv_sc *sc) -{ - struct i82559 *p_i82559; - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_poll: Bad device pointer %x\n", p_i82559 ); -#endif - return; - } -/**/ - // Do these atomically - Mask82559Interrupt(p_i82559); -/**/ - // As it happens, this driver always requests the DSR to be called: - (void)eth_isr( p_i82559->vector, (cyg_addrword_t)p_i82559 ); - - i82559_deliver( p_i82559 ); -/**/ - Acknowledge82559Interrupt(p_i82559); - UnMask82559Interrupt(p_i82559); -/**/ -} - -// ------------------------------------------------------------------------ -// Determine interrupt vector used by a device - for attaching GDB stubs -// packet handler. -int -i82559_int_vector(struct eth_drv_sc *sc) -{ - struct i82559 *p_i82559; - p_i82559 = (struct i82559 *)sc->driver_private; - return (p_i82559->vector); -} - -// ------------------------------------------------------------------------ -// -// Function : pci_init_find_82559s -// -// This is called exactly once at the start of time to: -// o scan the PCI bus for objects -// o record them in the device table -// o acquire all the info needed for the driver to access them -// o instantiate interrupts for them -// o attach those interrupts appropriately -// ------------------------------------------------------------------------ -static int -pci_init_find_82559s( void ) -{ - cyg_pci_device_id devid; - cyg_pci_device dev_info; - cyg_uint16 cmd; - int device_index; - -#ifdef DEBUG - db_printf("pci_init_find_82559s()\n"); -#endif - - // allocate memory to be used in ioctls later - if (mem_reserved_ioctl != (void*)0) { -#ifdef DEBUG - db_printf("pci_init_find_82559s() called > once\n"); -#endif - return 0; - } - - // First initialize the heap in PCI window'd memory - i82559_heap_size = CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_SIZE; - i82559_heap_base = (cyg_uint8 *)CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_BASE; - i82559_heap_free = i82559_heap_base; - - mem_reserved_ioctl = pciwindow_mem_alloc(MAX_MEM_RESERVED_IOCTL); - - cyg_pci_init(); - - devid = CYG_PCI_NULL_DEVID; - - for (device_index = 0; device_index < MAX_82559; device_index++) { - struct i82559 *p_i82559 = &i82559[device_index]; - p_i82559->index = device_index; - - if (cyg_pci_find_device(0x8086, 0x1229, &devid) ) { -#ifdef DEBUG - db_printf("eth%d = 82559\n", device_index); -#endif - cyg_pci_get_device_info(devid, &dev_info); - - if (cyg_pci_translate_interrupt(&dev_info, &p_i82559->vector)) { -#ifdef DEBUG - db_printf(" Wired to HAL vector %d\n", p_i82559->vector); -#endif - cyg_drv_interrupt_create( - p_i82559->vector, - 0, // Priority - unused - (CYG_ADDRWORD)p_i82559, // Data item passed to ISR & DSR - eth_isr, // ISR - eth_dsr, // DSR - &p_i82559->interrupt_handle, // handle to intr obj - &p_i82559->interrupt_object ); // space for int obj - - cyg_drv_interrupt_attach(p_i82559->interrupt_handle); - - // Don't unmask the interrupt yet, that could get us into a - // race. - } else { - p_i82559->vector=0; -#ifdef DEBUG - db_printf(" Does not generate interrupts.\n"); -#endif - } - - if (cyg_pci_configure_device(&dev_info)) { -#ifdef DEBUG - int i; - db_printf("Found device on bus %d, devfn 0x%02x:\n", - CYG_PCI_DEV_GET_BUS(devid), - CYG_PCI_DEV_GET_DEVFN(devid)); - - if (dev_info.command & CYG_PCI_CFG_COMMAND_ACTIVE) { - db_printf(" Note that board is active. Probed" - " sizes and CPU addresses invalid!\n"); - } - db_printf(" Vendor 0x%04x", dev_info.vendor); - db_printf("\n Device 0x%04x", dev_info.device); - db_printf("\n Command 0x%04x, Status 0x%04x\n", - dev_info.command, dev_info.status); - - db_printf(" Class/Rev 0x%08x", dev_info.class_rev); - db_printf("\n Header 0x%02x\n", dev_info.header_type); - - db_printf(" SubVendor 0x%04x, Sub ID 0x%04x\n", - dev_info.header.normal.sub_vendor, - dev_info.header.normal.sub_id); - - for(i = 0; i < CYG_PCI_MAX_BAR; i++) { - db_printf(" BAR[%d] 0x%08x /", i, dev_info.base_address[i]); - db_printf(" probed size 0x%08x / CPU addr 0x%08x\n", - dev_info.base_size[i], dev_info.base_map[i]); - } - db_printf(" eth%d configured\n", device_index); -#endif - p_i82559->found = 1; - p_i82559->active = 0; - p_i82559->devid = devid; - p_i82559->memory_address = dev_info.base_map[0]; - p_i82559->io_address = dev_info.base_map[1]; -#ifdef DEBUG - db_printf(" memory address = 0x%08x\n", dev_info.base_map[0]); - db_printf(" I/O address = 0x%08x\n", dev_info.base_map[1]); -#endif - - // Don't use cyg_pci_set_device_info since it clears - // some of the fields we want to print out below. - cyg_pci_read_config_uint16(dev_info.devid, CYG_PCI_CFG_COMMAND, &cmd); - cmd |= CYG_PCI_CFG_COMMAND_IO // enable I/O space - | CYG_PCI_CFG_COMMAND_MEMORY // enable memory space - | CYG_PCI_CFG_COMMAND_MASTER; // enable bus master - cyg_pci_write_config_uint16(dev_info.devid, CYG_PCI_CFG_COMMAND, cmd); - - // Now the PCI part of the device is configured, reset it. This - // should make it safe to enable the interrupt - i82559_reset(p_i82559); - - if (p_i82559->vector != 0) { - cyg_drv_interrupt_acknowledge(p_i82559->vector); - cyg_drv_interrupt_unmask(p_i82559->vector); - } -#ifdef DEBUG - db_printf(" **** Device enabled for I/O and Memory and Bus Master\n"); -#endif - } - else { - p_i82559->found = 0; - p_i82559->active = 0; -#ifdef DEBUG - db_printf("Failed to configure device %d\n",device_index); -#endif - } - } - else { - p_i82559->found = 0; - p_i82559->active = 0; -#ifdef DEBUG - db_printf("eth%d not found\n", device_index); -#endif - } - } - - // Now a delay to ensure the hardware has "come up" before you try to - // use it. Yes, really, the full 2 seconds. It's only really - // necessary if DEBUG is off - otherwise all that printout wastes - // enough time. No kidding. - udelay( 20000 ); - return 1; -} - -#ifdef CYGPKG_NET -// ------------------------------------------------------------------------ -// -// Function : eth_set_promiscuous_mode -// -// Return : 0 = It worked. -// non0 = It failed. -// ------------------------------------------------------------------------ - -static int eth_set_promiscuous_mode(struct i82559* p_i82559) -{ - cyg_uint32 ioaddr; - volatile CONFIG_CMD_STRUCT *ccs; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "eth_set_promiscuos_mode: Bad device pointer %x\n", - p_i82559 ); -#endif - return -1; - } - - ioaddr = p_i82559->io_address; - wait_for_cmd_done(ioaddr); - // load cu base address = 0 */ - OUTL(0, ioaddr + SCBPointer); - // 32 bit linear addressing used - - OUTW(SCB_M | CU_ADDR_LOAD, ioaddr + SCBCmd); - // wait for SCB command complete - wait_for_cmd_done(ioaddr); - - ccs = (CONFIG_CMD_STRUCT *)mem_reserved_ioctl; - - // Check the malloc we did earlier worked - if (ccs == (void*)0) - return 2; // Failed - - ccs->cb_entry.cb_cmd=0x2; - ccs->cb_entry.cb_cmd_word=0x0; - ccs->cb_entry.cb_status_word=0x0; - ccs->cb_entry.cb_int=0; - ccs->cb_entry.cb_suspend=1; - ccs->cb_entry.cb_el=1; - ccs->cb_entry.cb_complete=0; - ccs->cb_entry.cb_link_offset=VIRT_TO_BUS((cyg_uint32)&ccs); - - // Default values from the Intel Manual - ccs->config_bytes[0]=0x13; - ccs->config_bytes[1]=0x8; - ccs->config_bytes[2]=0x0; - ccs->config_bytes[3]=0x0; - ccs->config_bytes[4]=0x0; - ccs->config_bytes[5]=0x0; - ccs->config_bytes[6]=0xb2; // (promisc ? 0x80 : 0) | 0x32 for small stats, - ccs->config_bytes[7]=0x0; // \ ditto | 0x12 for stats with PAUSE stats - ccs->config_bytes[8]=0x0; // \ ditto | 0x16 for PAUSE + TCO stats - ccs->config_bytes[9]=0x0; - ccs->config_bytes[10]=0x28; - ccs->config_bytes[11]=0x0; - ccs->config_bytes[12]=0x60; - ccs->config_bytes[13]=0x0; // arp - ccs->config_bytes[14]=0x0; // arp - - ccs->config_bytes[15]=0x81; // promiscuous mode set - // \ or 0x80 for normal mode. - ccs->config_bytes[16]=0x0; - ccs->config_bytes[17]=0x40; - ccs->config_bytes[18]=0x72; // Keep the Padding Enable bit - - // wait for SCB command complete - wait_for_cmd_done(ioaddr); - - OUTL(VIRT_TO_BUS(ccs), ioaddr + SCBPointer); - OUTW(SCB_M | CU_START, ioaddr + SCBCmd); - - udelay(10000); - - // now check for result ... - wait_for_cmd_done(ioaddr); - - if ( (!ccs->cb_entry.cb_ok) || (!ccs->cb_entry.cb_complete) ) - return 1; // Failed - - wait_for_cmd_done(ioaddr); - /* load pointer to Rx Ring */ - - OUTL(VIRT_TO_BUS(p_i82559->rx_ring[0]), - ioaddr + SCBPointer); - OUTW(RUC_START, ioaddr + SCBCmd); - - return 0; // OK -} -#endif - -// ------------------------------------------------------------------------ -// We use this as a templete when writing a new MAC address into the -// eeproms. The MAC address in the first few bytes is over written -// with the correct MAC address and then the whole lot is programmed -// into the serial EEPROM. The checksum is calculated on the fly and -// sent instead of the last two bytes. -// The values are copied from the Intel EtherPro10/100+ &c devices -// in the Integrator boards. - -#ifdef CYGPKG_DEVS_ETH_ARM_INTEGRATOR_WRITE_EEPROM - -#define ee00 0x00, 0x00 // shorthand - -static char eeprom_burn[126] = { -/* halfword addresses! */ -/* 0: */ 0x00, 0x90, 0x27, 0x8c, 0x57, 0x82, 0x03, 0x02, -/* 4: */ ee00 , 0x01, 0x02, 0x01, 0x47, ee00 , -/* 8: */ 0x13, 0x72, 0x06, 0x83, 0xa2, 0x40, 0x0c, 0x00, -/* C: */ 0x86, 0x80, ee00 , ee00 , ee00 , -/* 10: */ ee00 , ee00 , ee00 , ee00 , -/* 14: */ ee00 , ee00 , ee00 , ee00 , -/* 18: */ ee00 , ee00 , ee00 , ee00 , -/* 1C: */ ee00 , ee00 , ee00 , ee00 , -/* 20: */ ee00 , ee00 , ee00 , ee00 , -/* 24: */ ee00 , ee00 , ee00 , ee00 , -/* 28: */ ee00 , ee00 , ee00 , ee00 , -/* 2C: */ ee00 , ee00 , ee00 , ee00 , -/* 30: */ 0x28, 0x01, ee00 , ee00 , ee00 , -/* 34: */ ee00 , ee00 , ee00 , ee00 , -/* 38: */ ee00 , ee00 , ee00 , ee00 , -/* 3C: */ ee00 , ee00 , ee00 -}; -#undef ee00 - -#endif - -// ------------------------------------------------------------------------ -// -// Function : eth_set_mac_address -// -// Return : 0 = It worked. -// non0 = It failed. -// ------------------------------------------------------------------------ -static int eth_set_mac_address(struct i82559* p_i82559, char *addr) -{ -#ifdef CYGPKG_DEVS_ETH_ARM_INTEGRATOR_WRITE_EEPROM - int checksum, i, count; - // (this is the length of the *EEPROM*s address, not MAC address) - int addr_length; -#endif - cyg_uint32 ioaddr; - volatile CONFIG_CMD_STRUCT *ccs; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "eth_set_mac_address : Bad device pointer %x\n", - p_i82559 ); -#endif - return -1; - } - - ioaddr = p_i82559->io_address; - - wait_for_cmd_done(ioaddr); - - ccs = (CONFIG_CMD_STRUCT *)mem_reserved_ioctl; - if (ccs == (void*)0) - return 2; - - ccs->cb_entry.cb_cmd=0x1; - ccs->cb_entry.cb_cmd_word=0x0; - ccs->cb_entry.cb_status_word=0x0; - ccs->cb_entry.cb_int=0; - ccs->cb_entry.cb_suspend=1; - ccs->cb_entry.cb_el=1; - - memcpy((char *)(ccs->config_bytes),addr,6); - - ccs->config_bytes[6]=0x0; - ccs->config_bytes[7]=0x0; - - ioaddr = p_i82559->io_address; - - OUTL(VIRT_TO_BUS(ccs), ioaddr + SCBPointer); - OUTW(SCB_M | CU_START, ioaddr + SCBCmd); - // Next delay seems to be required, otherwise, - // cb_ok/cb_complete won't be set later. - - udelay(1000); - wait_for_cmd_done(ioaddr); - - // now check for result ... - if ( (!ccs->cb_entry.cb_ok) || (!ccs->cb_entry.cb_complete) ) - return 3; - -#ifdef CYGPKG_DEVS_ETH_ARM_INTEGRATOR_WRITE_EEPROM - - addr_length = get_eeprom_size( ioaddr ); - - // now set this address in the device eeprom .... - (void)memcpy(eeprom_burn,addr,6); - - // No idea what these were for... - // eeprom_burn[20] &= 0xfe; - // eeprom_burn[20] |= p_i82559->index; - - program_eeprom( ioaddr, addr_length, eeprom_burn ); - - // update 82559 driver data structure ... - udelay( 100000 ); - - // by reading EEPROM to get the mac address back - for (checksum = 0, i = 0, count = 0; count < 64; count++) { - cyg_uint16 value; - // read word from eeprom - value = read_eeprom(ioaddr, count, addr_length); - checksum += value; - if (count < 3) { - p_i82559->mac_address[i++] = value & 0xFF; - p_i82559->mac_address[i++] = (value >> 8) & 0xFF; - } - } - -#ifdef DEBUG - os_printf("MAC Address = %02X %02X %02X %02X %02X %02X\n", - p_i82559->mac_address[0], p_i82559->mac_address[1], - p_i82559->mac_address[2], p_i82559->mac_address[3], - p_i82559->mac_address[4], p_i82559->mac_address[5]); -#endif - - p_i82559->mac_addr_ok = 1; - - for ( i = 0, count = 0; i < 6; i++ ) - if ( p_i82559->mac_address[i] != addr[i] ) - count++; - - if ( count ) { -#ifdef DEBUG - os_printf( "Warning: MAC Address read back wrong! %d bytes differ.\n", - count ); -#endif - p_i82559->mac_addr_ok = 0; - } - - // If the EEPROM checksum is wrong, the MAC address read from the - // EEPROM is probably wrong as well. In that case, we don't set - // mac_addr_ok. - if ((checksum & 0xFFFF) != 0xBABA) { -#ifdef DEBUG - os_printf( "Warning: Invalid EEPROM checksum %04X for device %d\n", - checksum, p_i82559->index); -#endif - p_i82559->mac_addr_ok = 0; - } -#else - p_i82559->mac_addr_ok = 1; -#endif // ! CYGPKG_DEVS_ETH_ARM_INTEGRATOR_WRITE_EEPROM - - return p_i82559->mac_addr_ok ? 0 : 1; -} - -#ifdef CYGPKG_DEVS_ETH_ARM_INTEGRATOR_WRITE_EEPROM -// ------------------------------------------------------------------------ -static void -write_eeprom(long ioaddr, int location, int addr_len, unsigned short value) -{ - int ee_addr = ioaddr + SCBeeprom; - int write_cmd = location | EE_WRITE_CMD(addr_len); - int i; - - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay( 100 ); - OUTW(EE_ENB, ee_addr); - eeprom_delay( 100 ); - -// os_printf("\n write_eeprom : write_cmd : %x",write_cmd); -// os_printf("\n addr_len : %x value : %x ",addr_len,value); - - /* Shift the write command bits out. */ - for (i = (addr_len+2); i >= 0; i--) { - short dataval = (write_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(EE_ENB | dataval, ee_addr); - eeprom_delay(100); - OUTW(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(150); - } - OUTW(EE_ENB, ee_addr); - - for (i = 15; i >= 0; i--) { - short dataval = (value & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(EE_ENB | dataval, ee_addr); - eeprom_delay(100); - OUTW(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(150); - } - - /* Terminate the EEPROM access. */ - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(150000); // let the write take effect -} - -// ------------------------------------------------------------------------ -static int write_enable_eeprom(long ioaddr, int addr_len) -{ - int ee_addr = ioaddr + SCBeeprom; - int write_en_cmd = EE_WRITE_EN_CMD(addr_len); - int i; - - OUTW(EE_ENB & ~EE_CS, ee_addr); - OUTW(EE_ENB, ee_addr); - -#ifdef DEBUG_82559 - os_printf("write_en_cmd : %x",write_en_cmd); -#endif - - // Shift the wr/er enable command bits out. - for (i = (addr_len+2); i >= 0; i--) { - short dataval = (write_en_cmd & (1 << i)) ? EE_DATA_WRITE : 0; - OUTW(EE_ENB | dataval, ee_addr); - eeprom_delay(100); - OUTW(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); - eeprom_delay(150); - } - - // Terminate the EEPROM access. - OUTW(EE_ENB & ~EE_CS, ee_addr); - eeprom_delay(EEPROM_DONE_DELAY); -} - - -// ------------------------------------------------------------------------ -static void -program_eeprom(cyg_uint32 ioaddr, cyg_uint32 eeprom_size, cyg_uint8 *data) -{ - cyg_uint32 i; - cyg_uint16 checksum = 0; - cyg_uint16 value; - - // First enable erase/write operations on the eeprom. - // This is done through the EWEN instruction. - write_enable_eeprom( ioaddr, eeprom_size ); - - for (i=0 ; i< 63 ; i++) { - value = ((unsigned short *)data)[i]; - checksum += value; -#ifdef DEBUG_82559 - os_printf("\n i : %x ... value to be written : %x",i,value); -#endif - write_eeprom( ioaddr, i, eeprom_size, value); -#ifdef DEBUG_82559 - os_printf("\n val read : %x ",read_eeprom(ioaddr,i,eeprom_size)); -#endif - } - value = 0xBABA - checksum; -#ifdef DEBUG_82559 - os_printf("\n i : %x ... checksum adjustment val to be written : %x",i,value); -#endif - write_eeprom( ioaddr, i, eeprom_size, value ); -} - -// ------------------------------------------------------------------------ -#endif // ! CYGPKG_DEVS_ETH_ARM_INTEGRATOR_WRITE_EEPROM - - -// ------------------------------------------------------------------------ -// -// Function : eth_get_mac_address -// -// ------------------------------------------------------------------------ -#ifdef ETH_DRV_GET_MAC_ADDRESS -static int eth_get_mac_address(struct i82559* p_i82559, char *addr) -{ - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "eth_get_mac_address : Bad device pointer %x\n", - p_i82559 ); -#endif - return -1; - } - - memcpy( addr, (char *)(&p_i82559->mac_address[0]), 6 ); - return 0; -} -#endif -// ------------------------------------------------------------------------ -// -// Function : i82559_ioctl -// -// ------------------------------------------------------------------------ -static int i82559_ioctl(struct eth_drv_sc *sc, unsigned long key, - void *data, int data_length) -{ - struct i82559 *p_i82559; - - p_i82559 = (struct i82559 *)sc->driver_private; - - IF_BAD_82559( p_i82559 ) { -#ifdef DEBUG - os_printf( "i82559_ioctl/control: Bad device pointer %x\n", p_i82559 ); -#endif - return -1; - } - -#ifdef DEBUG - db_printf( "i82559_ioctl: device eth%d at %x; key is 0x%x, data at %x[%d]\n", - p_i82559->index, p_i82559, key, data, data_length ); -#endif - - switch ( key ) { - -#ifdef ETH_DRV_SET_MAC_ADDRESS - case ETH_DRV_SET_MAC_ADDRESS: - if ( 6 != data_length ) - return -2; - return eth_set_mac_address( p_i82559, data ); -#endif - -#ifdef ETH_DRV_GET_MAC_ADDRESS - case ETH_DRV_GET_MAC_ADDRESS: - return eth_get_mac_address( p_i82559, data ); -#endif -#ifdef ETH_DRV_GET_IF_STATS_UD - case ETH_DRV_GET_IF_STATS_UD: // UD == UPDATE - ETH_STATS_INIT( sc ); // so UPDATE the statistics structure -#endif - // drop through -#ifdef ETH_DRV_GET_IF_STATS - case ETH_DRV_GET_IF_STATS: -#endif -#if defined(ETH_DRV_GET_IF_STATS) || defined (ETH_DRV_GET_IF_STATS_UD) - { - struct ether_drv_stats *p = (struct ether_drv_stats *)data; - int i; - static unsigned char my_chipset[] - = { ETH_DEV_DOT3STATSETHERCHIPSET }; - - strcpy( p->description, CYGDAT_DEVS_ETH_DESCRIPTION ); - CYG_ASSERT( 48 > strlen(p->description), "Description too long" ); - - for ( i = 0; i < SNMP_CHIPSET_LEN; i++ ) - if ( 0 == (p->snmp_chipset[i] = my_chipset[i]) ) - break; - - i = i82559_status( sc ); - - if ( !( i & GEN_STATUS_LINK) ) { - p->operational = 2; // LINK DOWN - p->duplex = 1; // UNKNOWN - p->speed = 0; - } - else { - p->operational = 3; // LINK UP - p->duplex = (i & GEN_STATUS_FDX) ? 3 : 2; // 2 = SIMPLEX, 3 = DUPLEX - p->speed = ((i & GEN_STATUS_100MBPS) ? 100 : 10) * 1000000; - } - -#ifdef KEEP_STATISTICS - { - I82559_COUNTERS *pc = &i82559_counters[ p_i82559->index ]; - STATISTICS *ps = &statistics[ p_i82559->index ]; - - // Admit to it... - p->supports_dot3 = true; - - // Those commented out are not available on this chip. - - p->tx_good = pc->tx_good ; - p->tx_max_collisions = pc->tx_max_collisions ; - p->tx_late_collisions = pc->tx_late_collisions ; - p->tx_underrun = pc->tx_underrun ; - p->tx_carrier_loss = pc->tx_carrier_loss ; - p->tx_deferred = pc->tx_deferred ; - //p->tx_sqetesterrors = pc->tx_sqetesterrors ; - p->tx_single_collisions = pc->tx_single_collisions; - p->tx_mult_collisions = pc->tx_mult_collisions ; - p->tx_total_collisions = pc->tx_total_collisions ; - p->rx_good = pc->rx_good ; - p->rx_crc_errors = pc->rx_crc_errors ; - p->rx_align_errors = pc->rx_align_errors ; - p->rx_resource_errors = pc->rx_resource_errors ; - p->rx_overrun_errors = pc->rx_overrun_errors ; - p->rx_collisions = pc->rx_collisions ; - p->rx_short_frames = pc->rx_short_frames ; - //p->rx_too_long_frames = pc->rx_too_long_frames ; - //p->rx_symbol_errors = pc->rx_symbol_errors ; - - p->interrupts = ps->interrupts ; - p->rx_count = ps->rx_count ; - p->rx_deliver = ps->rx_deliver ; - p->rx_resource = ps->rx_resource ; - p->rx_restart = ps->rx_restart ; - p->tx_count = ps->tx_count ; - p->tx_complete = ps->tx_complete ; - p->tx_dropped = ps->tx_dropped ; - } -#endif // KEEP_STATISTICS - - p->tx_queue_len = MAX_TX_DESCRIPTORS; - - return 0; // OK - } -#endif - - default: - break; - } - return -1; -} - -// ------------------------------------------------------------------------ -// -// Statistics update... -// -// ------------------------------------------------------------------------ - -#ifdef KEEP_STATISTICS -#ifdef CYGDBG_DEVS_ETH_ARM_INTEGRATOR_KEEP_82559_STATISTICS -void update_statistics(struct i82559* p_i82559) -{ - I82559_COUNTERS *p_statistics; - cyg_uint32 *p_counter; - cyg_uint32 *p_register; - int reg_count; - - Mask82559Interrupt(p_i82559); - - // This points to the sthared memory stats area/command block - p_statistics = (I82559_COUNTERS *)(p_i82559->p_statistics); - - if ( (p_statistics->done & 0xFFFF) == 0xA007 ) { - p_counter = (cyg_uint32 *)&i82559_counters[ p_i82559->index ]; - p_register = (cyg_uint32 *)p_statistics; - for ( reg_count = 0; - reg_count < sizeof( I82559_COUNTERS ) / sizeof( cyg_uint32 ) - 1; - reg_count++ ) { - *p_counter += *p_register; - p_counter++; - p_register++; - } - p_statistics->done = 0; - // make sure no command operating - wait_for_cmd_done(p_i82559->io_address); - // start register dump - OUTW(CU_DUMPSTATS, p_i82559->io_address + SCBCmd); - } - Acknowledge82559Interrupt(p_i82559); - UnMask82559Interrupt(p_i82559); -} -#endif -#endif // KEEP_STATISTICS - -// ------------------------------------------------------------------------ -// -// -// CODE FOR DEBUGGING PURPOSES ONLY -// -// -// ------------------------------------------------------------------------ -void dump_txcb(TxCB *p_txcb) -{ - os_printf("TxCB @ %x\n", (int)p_txcb); - os_printf("status = %04X ", p_txcb->txstatus); - os_printf("command = %04X ", p_txcb->command); - os_printf("link = %08X ", p_txcb->link); - os_printf("tbd = %08X ", p_txcb->tbd_address); - os_printf("count = %d ", p_txcb->count); - os_printf("eof = %x ", p_txcb->eof); - os_printf("threshold = %d ", p_txcb->tx_threshold); - os_printf("tbd number = %d\n", p_txcb->tbd_number); -} - -// This is intended to be the body of a THREAD that prints stuff every 10 -// seconds or so: -#ifdef KEEP_STATISTICS -#ifdef DISPLAY_STATISTICS -void DisplayStatistics(void) -{ - int i; - I82559_COUNTERS *p_statistics; - cyg_uint32 *p_counter; - cyg_uint32 *p_register; - int reg_count; - int status; - - while ( 1 ) { -#ifdef DISPLAY_82559_STATISTICS - for ( i = 0; i < 2; i ++ ) { - p_statistics = (I82559_COUNTERS *)i82559[i].p_statistics; - if ( (p_statistics->done & 0xFFFF) == 0xA007 ) { - p_counter = (cyg_uint32 *)&i82559_counters[i]; - p_register = (cyg_uint32 *)&p_statistics->tx_good; - for ( reg_count = 20; reg_count != 0; reg_count--) { - *p_counter += *p_register; - p_counter++; - p_register++; - } - p_statistics->done = 0; - // make sure no command operating - wait_for_cmd_done(i82559[i].io_address); - // start register dump - OUTW(CU_DUMPSTATS, i82559[i].io_address + SCBCmd); - } - } -#endif - os_printf("\nRx\nPackets = %d %d\n", - statistics[0].rx_count, statistics[1].rx_count); - os_printf("Deliver %d %d\n", - statistics[0].rx_deliver, statistics[1].rx_deliver); - os_printf("Resource %d %d\n", - statistics[0].rx_resource, statistics[1].rx_resource); - os_printf("Restart %d %d\n", - statistics[0].rx_restart, statistics[1].rx_restart); - -#ifdef DISPLAY_82559_STATISTICS - os_printf("Count %d %d\n", - i82559_counters[0].rx_good, i82559_counters[1].rx_good); - os_printf("CRC %d %d\n", - i82559_counters[0].rx_crc_errors, i82559_counters[1].rx_crc_errors); - os_printf("Align %d %d\n", - i82559_counters[0].rx_align_errors, i82559_counters[1].rx_align_errors); - os_printf("Resource %d %d\n", - i82559_counters[0].rx_resource_errors, i82559_counters[1].rx_resource_errors); - os_printf("Overrun %d %d\n", - i82559_counters[0].rx_overrun_errors, i82559_counters[1].rx_overrun_errors); - os_printf("Collision %d %d\n", - i82559_counters[0].rx_collisions, i82559_counters[1].rx_collisions); - os_printf("Short %d %d\n", - i82559_counters[0].rx_short_frames, i82559_counters[1].rx_short_frames); -#endif - os_printf("\nTx\nPackets = %d %d\n", - statistics[0].tx_count, statistics[1].tx_count); - os_printf("Complete %d %d\n", - statistics[0].tx_complete, statistics[1].tx_complete); - os_printf("Dropped %d %d\n", - statistics[0].tx_dropped, statistics[1].tx_dropped); - os_printf("Count %d %d\n", - i82559_counters[0].tx_good, i82559_counters[1].tx_good); -#ifdef DISPLAY_82559_STATISTICS - os_printf("Collision %d %d\n", - i82559_counters[0].tx_max_collisions,i82559_counters[1].tx_max_collisions); - os_printf("Late Col. %d %d\n", - i82559_counters[0].tx_late_collisions,i82559_counters[1].tx_late_collisions); - os_printf("Underrun %d %d\n", - i82559_counters[0].tx_underrun,i82559_counters[1].tx_underrun); - os_printf("Carrier %d %d\n", - i82559_counters[0].tx_carrier_loss,i82559_counters[1].tx_carrier_loss); - os_printf("Deferred %d %d\n", - i82559_counters[0].tx_deferred, i82559_counters[1].tx_deferred); - os_printf("1 Col %d %d\n", - i82559_counters[0].tx_single_collisions, i82559_counters[0].tx_single_collisions); - os_printf("Mult. Col %d %d\n", - i82559_counters[0].tx_mult_collisions, i82559_counters[0].tx_mult_collisions); - os_printf("Total Col %d %d\n", - i82559_counters[0].tx_total_collisions, i82559_counters[0].tx_total_collisions); -#endif - status = INB(i82559[0].io_address + SCBGenStatus); - os_printf("Interface 0 Link = %s, %s Mbps, %s Duplex\n", - status & GEN_STATUS_LINK ? "Up" : "Down", - status & GEN_STATUS_100MBPS ? "100" : "10", - status & GEN_STATUS_FDX ? "Full" : "Half"); - - status = INB(i82559[1].io_address + SCBGenStatus); - os_printf("Interface 1 Link = %s, %s Mbps, %s Duplex\n", - status & GEN_STATUS_LINK ? "Up" : "Down", - status & GEN_STATUS_100MBPS ? "100" : "10", - status & GEN_STATUS_FDX ? "Full" : "Half"); - - cyg_thread_delay(1000); - } -} -#endif // DISPLAY_STATISTICS -#endif // KEEP_STATISTICS - -void dump_rfd(RFD *p_rfd, int anyway ) -{ - if ( (0 != p_rfd->rxstatus) || anyway ) { - os_printf("RFD @ %x = ", (int)p_rfd); - os_printf("status = %x ", p_rfd->rxstatus); - os_printf("link = %x ", p_rfd->link); -// os_printf("rdb_address = %x ", p_rfd->rdb_address); - os_printf("count = %x ", p_rfd->count); - os_printf("f = %x ", p_rfd->f); - os_printf("eof = %x ", p_rfd->eof); - os_printf("size = %x\n", p_rfd->size); - os_printf("[%04x %04x %04x] ", - *((cyg_uint16 *)(&(p_rfd->buffer[0]))), - *((cyg_uint16 *)(&(p_rfd->buffer[2]))), - *((cyg_uint16 *)(&(p_rfd->buffer[4]))) ); - os_printf("[%04x %04x %04x] %04x : ", - *((cyg_uint16 *)(&(p_rfd->buffer[6]))), - *((cyg_uint16 *)(&(p_rfd->buffer[8]))), - *((cyg_uint16 *)(&(p_rfd->buffer[10]))), - *((cyg_uint16 *)(&(p_rfd->buffer[12]))) ); - os_printf("(%04x %04x %04x %04x) ", - *((cyg_uint16 *)(&(p_rfd->buffer[14]))), - *((cyg_uint16 *)(&(p_rfd->buffer[16]))), - *((cyg_uint16 *)(&(p_rfd->buffer[18]))), - *((cyg_uint16 *)(&(p_rfd->buffer[20]))) ); - os_printf("[%04x %04x %04x] ", - *((cyg_uint16 *)(&(p_rfd->buffer[22]))), - *((cyg_uint16 *)(&(p_rfd->buffer[24]))), - *((cyg_uint16 *)(&(p_rfd->buffer[26]))) ); - os_printf("%d.%d.%d.%d ", - *((cyg_uint8 *)(&(p_rfd->buffer[28]))), - *((cyg_uint8 *)(&(p_rfd->buffer[29]))), - *((cyg_uint8 *)(&(p_rfd->buffer[30]))), - *((cyg_uint8 *)(&(p_rfd->buffer[31]))) ); - os_printf("[%04x %04x %04x] ", - *((cyg_uint16 *)(&(p_rfd->buffer[32]))), - *((cyg_uint16 *)(&(p_rfd->buffer[34]))), - *((cyg_uint16 *)(&(p_rfd->buffer[36]))) ); - os_printf("%d.%d.%d.%d ...\n", - *((cyg_uint8 *)(&(p_rfd->buffer[38]))), - *((cyg_uint8 *)(&(p_rfd->buffer[39]))), - *((cyg_uint8 *)(&(p_rfd->buffer[40]))), - *((cyg_uint8 *)(&(p_rfd->buffer[41]))) ); - } -} - -void dump_all_rfds( int intf ) -{ - struct i82559* p_i82559 = &i82559[intf]; - int i, j; - j = p_i82559->next_rx_descriptor; - os_printf("rx descriptors for interface %d (eth%d):\n", intf, intf ); - for ( i = 0; i < MAX_RX_DESCRIPTORS; i++ ) - dump_rfd( p_i82559->rx_ring[i], (i > (j-3) && (i <= j)) ); - os_printf("next rx descriptor = %x\n\n", j); -} - - -void dump_packet(cyg_uint8 *p_buffer, int length) -{ - int count; - - count = 0; - while ( length > 0 ) { - if ( count == 0 ) - os_printf("\n"); - count = (count + 1) & 0x0F; - os_printf("%02X ", *p_buffer++); - length--; - } - os_printf("\n"); -} - -// ------------------------------------------------------------------------ - -// EOF if_integrator.c diff --git a/packages/devs/eth/arm/iq80310/current/ChangeLog b/packages/devs/eth/arm/iq80310/current/ChangeLog --- a/packages/devs/eth/arm/iq80310/current/ChangeLog +++ b/packages/devs/eth/arm/iq80310/current/ChangeLog @@ -67,29 +67,38 @@ 2000-11-06 Mark Salter + + * cdl/iq80321_eth_drivers.cdl: Change back default for + CYGSEM_DEVS_ETH_ARM_IQ80321_I82544_ETH0_SET_ESA now that diags + support setting of MAC address. + +2002-01-29 Nick Garnett + + * cdl/iq80321_eth_drivers.cdl: Changed default for + CYGSEM_DEVS_ETH_ARM_IQ80321_I82544_ETH0_SET_ESA from 0 to 1. Until + we get boards with properly populated EEPROMS we must supply the + MAC address in the configuration. + +2002-01-21 Mark Salter + + * Initial checkin. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + + + diff --git a/packages/devs/eth/arm/iq80321/current/cdl/iq80321_eth_drivers.cdl b/packages/devs/eth/arm/iq80321/current/cdl/iq80321_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/iq80321/current/cdl/iq80321_eth_drivers.cdl @@ -0,0 +1,117 @@ +# ==================================================================== +# +# iq80321_eth_drivers.cdl +# +# Ethernet drivers +# Intel IQ80321 and i82544 Gigabit support +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): hmt +# Original data: hmt +# Contributors: gthomas +# Date: 2000-02-01 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_ARM_IQ80321 { + display "Intel IQ80321 with i82544 ethernet driver" + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_ARM_XSCALE_IQ80321 + + include_dir cyg/io + + # FIXME: This really belongs in the INTEL_I82544 package + cdl_interface CYGINT_DEVS_ETH_INTEL_I82544_REQUIRED { + display "Intel i82544 ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_INTEL_I82544_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_INTEL_I82544_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + + cdl_component CYGPKG_DEVS_ETH_ARM_IQ80321_I82544_ETH0 { + display "IQ80321 builtin ethernet port driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + IQ80321 builtin port." + + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_INTEL_I82544_REQUIRED + + cdl_option CYGDAT_DEVS_ETH_ARM_IQ80321_I82544_ETH0_NAME { + display "Device name for the ETH0 ethernet port driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + IQ80321 builtin port." + } + + cdl_component CYGSEM_DEVS_ETH_ARM_IQ80321_I82544_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_ARM_IQ80321_I82544_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x00, 0xB5, 0xE0, 0xB5, 0xE0, 0x11}"} + description "The ethernet station address" + } + } + + } + +} + +# EOF iq80321_eth_drivers.cdl diff --git a/packages/devs/eth/arm/iq80321/current/include/devs_eth_iq80321.inl b/packages/devs/eth/arm/iq80321/current/include/devs_eth_iq80321.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/iq80321/current/include/devs_eth_iq80321.inl @@ -0,0 +1,130 @@ +//========================================================================== +// +// devs/eth/arm/iq80321/include/devs_eth_arm_iq80321.inl +// +// IQ80321 ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter +// Date: 2002-01-10 +// Purpose: IQ80321 ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHERNET +#include // HAL_DCACHE_LINE_SIZE +#include // CYGARC_UNCACHED_ADDRESS + +#ifdef CYGPKG_DEVS_ETH_ARM_IQ80321_I82544_ETH0 + +// Use auto speed detection +#define CYGHWR_DEVS_ETH_INTEL_I82544_USE_ASD + +#define CYGHWR_INTEL_I82544_PCI_VIRT_TO_BUS( _x_ ) ((cyg_uint32)CYGARC_VIRT_TO_BUS(_x_)) +#define CYGHWR_INTEL_I82544_PCI_BUS_TO_VIRT( _x_ ) ((cyg_uint32)CYGARC_BUS_TO_VIRT(_x_)) + +#define MAX_PACKET_SIZE 1536 +#define SIZEOF_DESCRIPTOR 16 + +#define CYGHWR_INTEL_I82544_PCI_MEM_MAP_SIZE \ + (((MAX_PACKET_SIZE + SIZEOF_DESCRIPTOR) * \ + (MAX_TX_DESCRIPTORS + MAX_RX_DESCRIPTORS)) + 64) + +static char pci_mem_buffer[CYGHWR_INTEL_I82544_PCI_MEM_MAP_SIZE + HAL_DCACHE_LINE_SIZE]; + +#define CYGHWR_INTEL_I82544_PCI_MEM_MAP_BASE \ + (CYGARC_UNCACHED_ADDRESS(((unsigned)pci_mem_buffer + HAL_DCACHE_LINE_SIZE - 1) & ~(HAL_DCACHE_LINE_SIZE - 1))) + +static I82544 i82544_eth0_priv_data = { +#ifdef CYGSEM_DEVS_ETH_ARM_IQ80321_I82544_ETH0_SET_ESA + hardwired_esa: 1, + mac_address: CYGDAT_DEVS_ETH_ARM_IQ80321_I82544_ETH0_ESA +#else + hardwired_esa: 0, +#endif +}; + +ETH_DRV_SC(i82544_sc0, + &i82544_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_ARM_IQ80321_I82544_ETH0_NAME, // Name for device + i82544_start, + i82544_stop, + i82544_ioctl, + i82544_can_send, + i82544_send, + i82544_recv, + i82544_deliver, + i82544_poll, + i82544_int_vector + ); + +NETDEVTAB_ENTRY(i82544_netdev0, + "i82544_" CYGDAT_DEVS_ETH_ARM_IQ80321_I82544_ETH0_NAME, + i82544_init, + &i82544_sc0); + +#endif // CYGPKG_DEVS_ETH_ARM_IQ80321_I82544_ETH0 + + +// These arrays are used for sanity checking of pointers +I82544 * +i82544_priv_array[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_ARM_IQ80321_I82544_ETH0 + &i82544_eth0_priv_data, +#endif +}; + +#ifdef CYGDBG_USE_ASSERTS +// These are only used when assertions are enabled +cyg_netdevtab_entry_t * +i82544_netdev_array[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_ARM_IQ80321_I82544_ETH0 + &i82544_netdev0, +#endif +}; + +struct eth_drv_sc * +i82544_sc_array[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_ARM_IQ80321_I82544_ETH0 + &i82544_sc0, +#endif +}; +#endif // CYGDBG_USE_ASSERTS + +// EOF devs_eth_arm_iq80321.inl diff --git a/packages/devs/eth/arm/ks32c5000/current/ChangeLog b/packages/devs/eth/arm/ks32c5000/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/ks32c5000/current/ChangeLog @@ -0,0 +1,34 @@ +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/arm/ks32c5000/current/cdl/ks32c5000_eth.cdl b/packages/devs/eth/arm/ks32c5000/current/cdl/ks32c5000_eth.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/ks32c5000/current/cdl/ks32c5000_eth.cdl @@ -0,0 +1,102 @@ +#========================================================================== +# +# ks32c5000_eth.cdl +# +# +# +#========================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +#========================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Contributors: gthomas, jskov +# Grant Edwards +# Date: 2001-07-31 +# Purpose: +# Description: +# +#####DESCRIPTIONEND#### +# +#========================================================================*/ + + +cdl_package CYGPKG_DEVS_ETH_ARM_KS32C5000 { + display "Samsung KS32C5000/S3C4510 ethernet driver" + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + include_dir net + description "Ethernet driver for Samsung KS32C5000" + compile -library=libextras.a ks5000_ether.c + + + cdl_component CYGPKG_DEVS_ETH_ARM_KS32C5000_OPTIONS { + display "Samsung ethernet driver build options" + flavor none + no_define + + cdl_option CYGPKG_DEVS_ETH_ARM_KS32C5000_PHY_ICS1890 { + display "ICS1890 PHY support" + flavor bool + default_value 0 + compile -library=libextras.a ics1890.c + } + + cdl_component CYGPKG_DEVS_ETH_ARM_KS32C5000_PHY_LXT970 { + display "LXT970 PHY support" + flavor bool + default_value 1 + compile -library=libextras.a lxt970.c + } + + cdl_option CYGPKG_DEVS_ETH_ARM_KS32C5000_MACADDR { + display "Ethernet address for eth0" + flavor data + default_value { "0x00,0x10,0x20,0x30,0x40,0x50" } + } + + cdl_option CYGPKG_DEVS_ETH_ARM_KS32C5000_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL -D__ECOS" } + description " + This option modifies the set of compiler flags for + building the Samsung KS32C5000 ethernet driver package. + These flags are used in addition to the set of global flags." + } + } +} diff --git a/packages/devs/eth/arm/ks32c5000/current/src/ics1890.c b/packages/devs/eth/arm/ks32c5000/current/src/ics1890.c new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/ks32c5000/current/src/ics1890.c @@ -0,0 +1,100 @@ +//========================================================================== +// +// ics1890.c +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include "std.h" +#include "ks5000_regs.h" +#include "phy.h" + +#define PHY_CNTL_REG 0x00 +#define PHY_STATUS_REG 0x01 +#define PHY_ID_REG1 0x02 +#define PHY_ID_REG2 0x03 +#define PHY_ANA_REG 0x04 +#define PHY_ANLPAR_REG 0x05 +#define PHY_ANE_REG 0x06 +#define PHY_ECNTL_REG1 0x10 +#define PHY_QPDS_REG 0x11 +#define PHY_10BOP_REG 0x12 +#define PHY_ECNTL_REG2 0x13 + +#define PHYHWADDR 0x20 + +#define Bit(n) (1<<(n)) + +#define RESET_PHY Bit(15) +#define ENABLE_LOOPBACK Bit(14) +#define DR_100MB Bit(13) +#define ENABLE_AN Bit(12) +#define PHY_MAC_ISOLATE Bit(10) +#define RESTART_AN Bit(9) +#define PHY_FULLDUPLEX Bit(8) +#define PHY_COL_TEST Bit(7) + +void PhyReset(void) +{ + MiiStationWrite(PHY_CNTL_REG, PHYHWADDR, RESET_PHY ) ; + MiiStationWrite(PHY_CNTL_REG, PHYHWADDR, ENABLE_AN | RESTART_AN) ; +} + +unsigned PhyStatus(void) +{ + unsigned status = MiiStationRead(PHY_QPDS_REG,PHYHWADDR); + unsigned r = 0; + if (status & Bit(0)) + r |= PhyStatus_LinkUp; + if (status & Bit(14)) + r |= PhyStatus_FullDuplex; + if (status & Bit(15)) + r |= PhyStatus_100Mb; + return r; +} diff --git a/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c b/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c @@ -0,0 +1,1427 @@ +//========================================================================== +// +// ks5000_ether.c +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include +#if defined(CYGPKG_IO) +#include +#include +#include +#else +// need to prvide fake values for errno +#define EIO 1 +#define EINVAL 2 +#endif + +#include +#include +#include +#include +#include + +#if defined(CYGPKG_REDBOOT) +#include +#endif + +#if !defined(CYGPKG_NET) +#define cyg_drv_interrupt_unmask(v) /* noop */ +#define cyg_drv_interrupt_mask(v) /* noop */ +#define cyg_drv_isr_lock() /* noop */ +#define cyg_drv_isr_unlock() /* noop */ +#define cyg_drv_mutex_init(m) /* noop */ +#define cyg_drv_mutex_lock(m) /* noop */ +#define cyg_drv_mutex_unlock(m) /* noop */ +#define cyg_drv_dsr_lock() /* noop */ +#define cyg_drv_dsr_unlock() /* noop */ +#endif + +#define HavePHY 1 +#define HavePHYinterrupt 0 + +#include "std.h" +#include "ks5000_regs.h" +#include "ks5000_ether.h" + +#if HavePHY +#include "phy.h" +#endif + +#if 1 +#define debug_printf(args...) diag_printf(args) +#else +#define debug_printf(args...) /* noop */ +#endif +#define Bit(n) (1<<(n)) + +// enable/disable software verification of rx CRC +// should be moved to user-controlled valud in CDL file + +#if defined(CYG_HAL_CPUTYPE_KS32C5000A) +#define SoftwareCRC 1 +#else +#define SoftwareCRC 0 +#endif + +#if HavePHY +// functions to read/write Phy chip registers via MII interface +// on 32c5000. These need to be non-static since they're used +// by PHY-specific routines in a different file. +#define PHYREGWRITE 0x0400 +#define MiiStart 0x0800 + +void MiiStationWrite(U32 RegAddr, U32 PhyAddr, U32 PhyWrData) +{ + STADATA = PhyWrData ; + STACON = RegAddr | PhyAddr | MiiStart | PHYREGWRITE ; + while (STACON & MiiStart) + ; + //debug_printf("PHY Wr %x:%02x := %04x\n",PhyAddr, RegAddr, PhyWrData) ; +} + +U32 MiiStationRead(U32 RegAddr, U32 PhyAddr) +{ + U32 PhyRdData; + STACON = RegAddr | PhyAddr | MiiStart; + while (STACON & MiiStart) + ; + PhyRdData = STADATA; + //debug_printf("PHY Rd %x:%02x %04x\n",PhyAddr,RegAddr,PhyRdData) ; + return PhyRdData ; +} +#endif + +// miscellaneous data structures + +typedef BYTE ETH_ADDR[6] __attribute__((packed)); + +typedef struct tagETH_HEADER +{ + ETH_ADDR daddr __attribute__((packed)); + ETH_ADDR saddr __attribute__((packed)); + WORD type __attribute__((packed)); +} ETH_HEADER __attribute__((packed)); + +#define ETH_HEADER_SIZE 14 + +// Tx/Rx common descriptor structure +typedef struct tagFRAME_DESCRIPTOR +{ + LWORD FrameDataPtr; + LWORD Reserved; /* cf: RX-reserved, TX-Reserved(25bits) + Control bits(7bits) */ + LWORD StatusAndFrameLength; + struct tagFRAME_DESCRIPTOR *NextFD; +} FRAME_DESCRIPTOR; + +typedef struct +{ + U8 DestinationAddr[6]; + U8 SourceAddr[6]; + U8 LengthOrType[2]; + U8 LLCData[1506]; +} MAC_FRAME; + +#if defined(CYGPKG_NET) +static cyg_drv_mutex_t txMutex; +struct ether_drv_stats ifStats; +#endif + +typedef struct +{ + LWORD BTxNLErr; + LWORD BTxNOErr; + LWORD BTxEmptyErr; +} BDMA_TX_ERR; + +typedef struct +{ + LWORD BRxNLErr; + LWORD BRxNOErr; + LWORD BRxMSOErr; + LWORD BRxEmptyErr; + LWORD sBRxSEarly; + LWORD noBufferAvail; + LWORD queueOverflow; + LWORD bad; +} BDMA_RX_ERR; + + +// interrupt entry counters +U32 ks5000_MAC_Rx_Cnt; +U32 ks5000_MAC_Tx_Cnt; +U32 ks5000_MAC_Phy_Cnt; +U32 ks5000_BDMA_Tx_Isr_Cnt; +U32 ks5000_BDMA_Tx_Dsr_Cnt; +U32 ks5000_BDMA_Rx_Isr_Cnt; +U32 ks5000_BDMA_Rx_Dsr_Cnt; + + +// packet and byte counters +static U32 MAC_Tx_Pkts; +static U32 MAC_Tx_Octets; +// static U32 BDMA_Rx_Pkts; +// static U32 BDMA_Rx_Octets; + +// configuration values +static volatile U32 MACConfigVar; +static volatile U32 CAMConfigVar = CAMCON_COMP_EN | CAMCON_BROAD_ACC; +static volatile U32 MACTxConfigVar = + /* MACTXCON_EN_UNDER | */ + MACTXCON_EN_DEFER | + MACTXCON_EN_NCARR | + MACTXCON_EN_EXCOLL | + MACTXCON_EN_LATE_COLL | + MACTXCON_ENTX_PAR | + MACTXCON_EN_COMP; +static volatile U32 MACRxConfigVar = + MACRXCON_RX_EN | + MACRXCON_EN_ALIGN | + MACRXCON_EN_CRC_ERR | + MACRXCON_EN_OVER | + MACRXCON_EN_LONG_ERR | + MACRXCON_EN_RX_PAR; + +static volatile U32 BDMATxConfigVar = + BDMATXCON_MSL111 | + BDMATXCON_STP_SKP | + 3; /* burst size - 1 */ + +#define EtherFramePadding 2 + +#if EtherFramePadding == 0 +#define BDMARXCON_ALIGN BDMARXCON_WA00 +#elif EtherFramePadding == 1 +#define BDMARXCON_ALIGN BDMARXCON_WA01 +#elif EtherFramePadding == 2 +#define BDMARXCON_ALIGN BDMARXCON_WA10 +#elif EtherFramePadding == 3 +#define BDMARXCON_ALIGN BDMARXCON_WA11 +#else +#error "EtherFramePadding must be 0,1,2 or 3" +#endif + +static volatile U32 BDMARxConfigVar = + BDMARXCON_DIE | + BDMARXCON_EN | + BDMARXCON_BIG | + BDMARXCON_MA_INC | + BDMARXCON_NOIE | + BDMARXCON_ALIGN | + BDMARXCON_STP_SKP | + 15; /* burst size - 1 */ + + +/* Global variables For BDMA Error Report */ + +static BDMA_TX_ERR BDMATxErrCnt = {0,0,0}; +static BDMA_RX_ERR BDMARxErrCnt = {0,0,0,0,0}; + + +#if SoftwareCRC +static U32 crc32( unsigned char *blk_adr, unsigned blk_len); +#endif +static void Init_TxFrameDescriptorArray(void); +static void Init_RxFrameDescriptorArray(void); + +// number of ethernet buffers should be enough to keep both rx +// and tx queues full plus some extras for in-process packets + +#if defined(CYGPKG_REDBOOT) +#define NUM_ETH_BUFFERS 10 +#define MAX_RX_FRAME_DESCRIPTORS 4 // Max number of Rx Frame Descriptors +#define MAX_TX_FRAME_DESCRIPTORS 4 // Max number of Tx Frame Descriptors +#else +#define NUM_ETH_BUFFERS 80 +#define MAX_RX_FRAME_DESCRIPTORS 32 // Max number of Rx Frame Descriptors +#define MAX_TX_FRAME_DESCRIPTORS 32 // Max number of Tx Frame Descriptors +#endif + +static FRAME_DESCRIPTOR _rxFrameDescrArray[MAX_RX_FRAME_DESCRIPTORS] __attribute__((aligned(16))); +static FRAME_DESCRIPTOR _txFrameDescrArray[MAX_TX_FRAME_DESCRIPTORS] __attribute__((aligned(16))); + +/* define aliases that will set the no-cache bit */ +#define rxFrameDescrArray ((FRAME_DESCRIPTOR*)(((unsigned)_rxFrameDescrArray)|0x4000000)) +#define txFrameDescrArray ((FRAME_DESCRIPTOR*)(((unsigned)_txFrameDescrArray)|0x4000000)) + +static FRAME_DESCRIPTOR *rxReadPointer; +static FRAME_DESCRIPTOR *txDonePointer; +static FRAME_DESCRIPTOR *txWritePointer; + +static cyg_drv_mutex_t oldRxMutex; +static cyg_drv_cond_t oldRxCond; + + +static bool configDone; + +/*---------------------------------------------------------------------- + * Data structures used to manage ethernet buffers + */ +#define MAX_ETH_FRAME_SIZE 1520 + +typedef struct tEthBufferTag +{ + unsigned char data[MAX_ETH_FRAME_SIZE+8]; + unsigned length; + unsigned userData; + struct tEthBufferTag *next; + struct tEthBufferTag *prev; +}tEthBuffer; + + +typedef struct +{ + tEthBuffer *head; + tEthBuffer *tail; +}tEthBufQueue; + +#define EmptyQueue {NULL,NULL} + +static void ethBufQueueClear(tEthBufQueue *q) +{ + q->head = NULL; + q->tail = NULL; +} + +static tEthBuffer *ethBufQueueGet(tEthBufQueue *q) +{ + tEthBuffer *r; + + r = q->head; + + if (r) + q->head = r->next; + + return r; +} + +static void ethBufQueuePut(tEthBufQueue *q, tEthBuffer *b) +{ + b->next = NULL; + + if (!q->head) + { + q->head = b; + q->tail = b; + } + else + { + q->tail->next = b; + q->tail = b; + } +} + +#if 0 +// not used at the moment +static bool ethBufQueueEmpty(tEthBufQueue *q) +{ + return q->head != NULL; +} +#endif + +/*---------------------------------------------------------------------- + * Free pool and routines to manipulate it. + */ + +static tEthBuffer __bufferPool[NUM_ETH_BUFFERS] __attribute__((aligned(16))); +#define bufferPool ((tEthBuffer*)((unsigned)__bufferPool|0x4000000)) + +static tEthBufQueue freeList; +static int freeCount; + +// do not call from ISR routine +static void freeBuffer(tEthBuffer *b) +{ + cyg_drv_isr_lock(); + ++freeCount; + ethBufQueuePut(&freeList,b); + cyg_drv_isr_unlock(); +} + +static int allocFail; + +void bufferListError(void) +{ + while (1) + ; +} + +// do not call from ISR routine +static tEthBuffer *allocBuffer(void) +{ + tEthBuffer *r; + cyg_drv_isr_lock(); + r = ethBufQueueGet(&freeList); + cyg_drv_isr_unlock(); + if (r) + --freeCount; + else + { + ++allocFail; + if (freeCount) + bufferListError(); + } + return r; +} + +// call only from ISR routine or init +static void isrFreeBuffer(tEthBuffer *b) +{ + ++freeCount; + ethBufQueuePut(&freeList,b); +} + +#if 0 +// not used at the moment + +// call only from ISR routine or init +static tEthBuffer *isrAllocBuffer(void) +{ + tEthBuffer *r; + r = ethBufQueueGet(&freeList); + if (r) + --freeCount; + else + { + ++allocFail; + if (freeCount) + bufferListError(); + } + return r; +} +#endif + +static void initFreeList(void) +{ + int i; + ethBufQueueClear(&freeList); + freeCount = 0; + for (i=0; iFrameDataPtr & FRM_OWNERSHIP_BDMA) + { + // queue is full! make sure transmit is running + BDMATXCON |= BDMATXCON_EN; + MACTXCON |= MACTXCON_TX_EN; + return 0; + } + + cyg_drv_mutex_lock(&txMutex); + + // free old buffer if we need to + + cyg_drv_isr_lock(); + if (txWritePointer->FrameDataPtr) + { + freeBuffer((tEthBuffer*)txWritePointer->FrameDataPtr); + txWritePointer->FrameDataPtr = 0; + } + cyg_drv_isr_unlock(); + + MAC_Tx_Pkts += 1; + MAC_Tx_Octets += buf->length; + + // fill in the packet descriptor + + txWritePointer->Reserved = (TXFDCON_PADDING_MODE | TXFDCON_CRC_MODE | + TXFDCON_SRC_ADDR_INC | TXFDCON_BIG_ENDIAN | + TXFDCON_WIDGET_ALIGN00 | TXFDCON_MAC_TX_INT_EN); + + txWritePointer->StatusAndFrameLength = buf->length; + txWritePointer->FrameDataPtr = ((unsigned)buf | FRM_OWNERSHIP_BDMA); + + txWritePointer = txWritePointer->NextFD; + + cyg_drv_mutex_unlock(&txMutex); + + // start transmit + +#if defined(CYGPKG_NET) + ++ifStats.tx_count; +#endif + + BDMATXCON |= BDMATXCON_EN; + MACTXCON |= MACTXCON_TX_EN; + return 1; +} + + +//====================================================================== +// check to see if there's a frame waiting + +static int rx_frame_avail(void) +{ + if (rxReadPointer->FrameDataPtr & FRM_OWNERSHIP_BDMA) + { + // queue is empty -- make sure Rx is running + if (!(BDMARXCON & BDMARXCON_EN)) + { + ++BDMARxErrCnt.queueOverflow; + BDMARXCON |= BDMARXCON_EN; + } + return 0; + } + else + return 1; +} + + +//====================================================================== +// de-queue a receive buffer +static tEthBuffer *ks32c5000_eth_get_recv_buffer(void) +{ + unsigned RxStatusAndLength; + tEthBuffer *RxBufPtr; + tEthBuffer *emptyBuf; +#if SoftwareCRC + unsigned crc, crclen; + int crcOK; +#else +# define crcOK 1 +#endif + + while (1) + { + if (rxReadPointer->FrameDataPtr & FRM_OWNERSHIP_BDMA) + { + // queue is empty -- make sure Rx is running + if (!(BDMARXCON & BDMARXCON_EN)) + { + ++BDMARxErrCnt.queueOverflow; + BDMARXCON |= BDMARXCON_EN; + } + return NULL; + } + + RxBufPtr = (tEthBuffer*)rxReadPointer->FrameDataPtr; + RxStatusAndLength = rxReadPointer->StatusAndFrameLength; + + // counting on short-circuit && evaluation below to only + // allocate a fresh buffer if rx packet is good!! + +#if defined (CYGPKG_NET) + ++ifStats.rx_count; +#endif + +#if SoftwareCRC + crclen = (RxStatusAndLength & 0xffff) - 4; + crc = crc32(RxBufPtr->data+2,crclen); + crcOK = ((U08)(crc>>0) == RxBufPtr->data[2+crclen+0] && + (U08)(crc>>8) == RxBufPtr->data[2+crclen+1] && + (U08)(crc>>16) == RxBufPtr->data[2+crclen+2] && + (U08)(crc>>24) == RxBufPtr->data[2+crclen+3]); +#endif + if ((RxStatusAndLength & (RXFDSTAT_GOOD<<16)) + && crcOK + && (emptyBuf = allocBuffer())) + { + // good packet and we've got a fresh buffer to take + // it's place in the receive queue + rxReadPointer->FrameDataPtr = (unsigned)emptyBuf | FRM_OWNERSHIP_BDMA; + rxReadPointer = rxReadPointer->NextFD; + RxBufPtr->length = RxStatusAndLength & 0xffff; +#if defined(CYGPKG_NET) + ++ifStats.rx_deliver; +#endif + return RxBufPtr; + } + else + { + // bad packet or out of buffers. either way we + // ignore this packet, and reuse the buffer +#if defined(CYGPKG_NET) + if (RxStatusAndLength & (RXFDSTAT_GOOD<<16) && crcOK) + ++ifStats.rx_resource; + else + ++ifStats.rx_crc_errors; +#endif + rxReadPointer->FrameDataPtr |= FRM_OWNERSHIP_BDMA; + rxReadPointer = rxReadPointer->NextFD; + } + } +} + +//====================================================================== +static int EthInit(U08* mac_address) +{ + if (mac_address) + debug_printf("EthInit(%02x:%02x:%02x:%02x:%02x:%02x)\n", + mac_address[0],mac_address[1],mac_address[2], + mac_address[3],mac_address[4],mac_address[5]); + else + debug_printf("EthInit(NULL)\n"); + +#if HavePHY + PhyReset(); +#endif + + /* Set the initial condition of the BDMA. */ + BDMARXCON = BDMARXCON_RESET; + BDMATXCON = BDMATXCON_RESET; + BDMARXLSZ = MAX_ETH_FRAME_SIZE; + + BDMARXPTR = (U32)rxReadPointer; + BDMATXPTR = (U32)txWritePointer; + + MACCON = MACON_SW_RESET; + MACCON = MACConfigVar; + + CAMCON = CAMConfigVar; + + // set up our MAC address + + if (mac_address) + { + *((volatile U32*)CAM_BaseAddr) = + (mac_address[0]<<24) | + (mac_address[1]<<16) | + (mac_address[2]<< 8) | + (mac_address[3]<< 0); + *((volatile U16*)(CAM_BaseAddr+4)) = + (mac_address[4]<< 8) | + (mac_address[5]<< 0); + } + + // CAM Enable + CAMEN = 0x0001; + + // update the Configuration of BDMA and MAC to begin Rx/Tx + + BDMARXCON = BDMARxConfigVar; + MACRXCON = MACRxConfigVar; + + BDMATXCON = BDMATxConfigVar; + MACTXCON = MACTxConfigVar; + + diag_printf("ks32C5000 eth: %02x:%02x:%02x:%02x:%02x:%02x ", + *((volatile unsigned char*)CAM_BaseAddr+0), + *((volatile unsigned char*)CAM_BaseAddr+1), + *((volatile unsigned char*)CAM_BaseAddr+2), + *((volatile unsigned char*)CAM_BaseAddr+3), + *((volatile unsigned char*)CAM_BaseAddr+4), + *((volatile unsigned char*)CAM_BaseAddr+5)); + +#if SoftwareCRC + diag_printf("Software CRC\n"); +#else + diag_printf("Hardware CRC\n"); +#endif + + return 0; +} + +//====================================================================== +static void Init_TxFrameDescriptorArray(void) +{ + FRAME_DESCRIPTOR *pFrameDescriptor; + int i; + + // Each Frame Descriptor's frame data pointer points is NULL + // if not in use, otherwise points to an ethBuffer + + pFrameDescriptor = txFrameDescrArray; + + for(i=0; i < MAX_TX_FRAME_DESCRIPTORS; i++) + { + pFrameDescriptor->FrameDataPtr = 0; + pFrameDescriptor->Reserved = 0; + pFrameDescriptor->StatusAndFrameLength = 0; + pFrameDescriptor->NextFD = pFrameDescriptor+1; + pFrameDescriptor++; + } + + // fix up the last pointer to loop back to the first + + txFrameDescrArray[MAX_TX_FRAME_DESCRIPTORS-1].NextFD = txFrameDescrArray; + + txDonePointer = txWritePointer = txFrameDescrArray; + + return; +} + + +//====================================================================== +static void Init_RxFrameDescriptorArray(void) +{ + FRAME_DESCRIPTOR *pFrameDescriptor; + int i; + + // Each Frame Descriptor's frame data pointer points to + // an ethBuffer struct + + pFrameDescriptor = rxFrameDescrArray; + + for(i=0; i < MAX_RX_FRAME_DESCRIPTORS; i++) + { + pFrameDescriptor->FrameDataPtr = ((unsigned)allocBuffer() | FRM_OWNERSHIP_BDMA); + pFrameDescriptor->Reserved = 0; + pFrameDescriptor->StatusAndFrameLength = 0; + pFrameDescriptor->NextFD = pFrameDescriptor+1; + pFrameDescriptor++; + } + + // fix up the last pointer to loop back to the first + + rxFrameDescrArray[MAX_RX_FRAME_DESCRIPTORS-1].NextFD = rxFrameDescrArray; + + rxReadPointer = rxFrameDescrArray; + + return; +} + +#if HavePHY + +#if HavePHYinterrupt +static unsigned linkStatus; + +static cyg_uint32 MAC_Phy_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + cyg_drv_interrupt_acknowledge(vector); + PhyInterruptAck(); + ++ks5000_MAC_Phy_Cnt; + linkStatus = PhyStatus(); + if (linkStatus & PhyStatus_FullDuplex) + MACConfigVar |= (1<<3); + else + MACConfigVar &= ~(1<<3); + +#if defined(CYGPKG_NET) + if (linkStatus & PhyStatus_FullDuplex) + ifStats.duplex = 3; + else + ifStats.duplex = 2; + + if (linkStatus & PhyStatus_LinkUp) + ifStats.operational = 3; + else + ifStats.operational = 2; + + if (linkStatus & PhyStatus_100Mb) + ifStats.speed = 100000000; + else + ifStats.speed = 10000000; +#endif + + MACCON = MACConfigVar; + return CYG_ISR_HANDLED; +} +#endif +#endif + +static void ks32c5000_handle_tx_complete(void) +{ + + // record status and then free any buffers we're done with + + while (txDonePointer->FrameDataPtr && !(txDonePointer->FrameDataPtr & FRM_OWNERSHIP_BDMA)) + { +#if defined(CYGPKG_NET) + U32 txStatus; + + txStatus = txDonePointer->StatusAndFrameLength>>16; + + ++ks5000_MAC_Tx_Cnt; + ++ifStats.interrupts; + + if (txStatus & MACTXSTAT_COMP) + ++ifStats.tx_complete; + + if (txStatus & (MACTXSTAT_EX_COLL | MACTXSTAT_DEFFERED | + MACTXSTAT_UNDER | MACTXSTAT_DEFER | + MACTXSTAT_NCARR | MACTXSTAT_SIG_QUAL | + MACTXSTAT_LATE_COLL | MACTXSTAT_PAR | + MACTXSTAT_PAUSED | MACTXSTAT_HALTED)) + { + // transmit failed, log errors + if (txStatus & MACTXSTAT_EX_COLL) + ++ifStats.tx_max_collisions; + if (txStatus & MACTXSTAT_DEFFERED) + ++ifStats.tx_deferred; + if (txStatus & MACTXSTAT_UNDER) + ++ifStats.tx_underrun; + if (txStatus & MACTXSTAT_DEFER) + ; + if (txStatus & MACTXSTAT_NCARR) + ++ifStats.tx_carrier_loss; + if (txStatus & MACTXSTAT_SIG_QUAL) + ++ifStats.tx_sqetesterrors; + if (txStatus & MACTXSTAT_LATE_COLL) + ++ifStats.tx_late_collisions; + if (txStatus & MACTXSTAT_PAR) + ; + if (txStatus & MACTXSTAT_PAUSED) + ; + if (txStatus & MACTXSTAT_HALTED) + ; + } + else + { + // transmit OK + int collisionCnt = txStatus & 0x0f; + ++ifStats.tx_good; + if (collisionCnt) + { + if (collisionCnt == 1) + ++ifStats.tx_single_collisions; + else + ++ifStats.tx_mult_collisions; + ifStats.tx_total_collisions += collisionCnt; + } + } +#endif + isrFreeBuffer((tEthBuffer*)txDonePointer->FrameDataPtr); + txDonePointer->FrameDataPtr = 0; + txDonePointer = txDonePointer->NextFD; + } +} + + +//====================================================================== +static cyg_uint32 MAC_Tx_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + cyg_drv_interrupt_acknowledge(vector); + ks32c5000_handle_tx_complete(); + return CYG_ISR_HANDLED; +} + +static unsigned accumulatedMaxRxStatus=0; + +//====================================================================== +static cyg_uint32 MAC_Rx_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + U32 IntMACRxStatus; + + cyg_drv_interrupt_acknowledge(vector); + + IntMACRxStatus = MACRXSTAT; + MACRXSTAT = IntMACRxStatus; + + accumulatedMaxRxStatus |= IntMACRxStatus; + + ++ks5000_MAC_Rx_Cnt; + +#if defined(CYGPKG_NET) + + ++ifStats.interrupts; + + if (IntMACRxStatus & MACRXSTAT_GOOD) + { + ++ifStats.rx_good; + + if (IntMACRxStatus & MACRXSTAT_CTL_RECD) + ; // we don't do anything with control packets + + return CYG_ISR_HANDLED; + } + + if (IntMACRxStatus & (MACRXSTAT_ALLIGN_ERR | MACRXSTAT_CRC_ERR | + MACRXSTAT_OVERFLOW | MACRXSTAT_LONG_ERR | + MACRXSTAT_PAR | MACRXSTAT_HALTED) ) + { + if (IntMACRxStatus & MACRXSTAT_ALLIGN_ERR) + ++ifStats.rx_align_errors; + if (IntMACRxStatus & MACRXSTAT_CRC_ERR) + ++ifStats.rx_crc_errors; + if (IntMACRxStatus & MACRXSTAT_OVERFLOW) + ++ifStats.rx_overrun_errors; + if (IntMACRxStatus & MACRXSTAT_LONG_ERR) + ++ifStats.rx_too_long_frames; + if (IntMACRxStatus & MACRXSTAT_PAR) + ++ifStats.rx_symbol_errors; + if (IntMACRxStatus & MACRXSTAT_HALTED) + ; + } +#endif + return CYG_ISR_HANDLED; +} + + + +//====================================================================== +// This interrupt only happens when errors occur +static cyg_uint32 BDMA_Tx_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + U32 IntBDMATxStatus; + + cyg_drv_interrupt_acknowledge(vector); + + IntBDMATxStatus = BDMASTAT; + BDMASTAT = IntBDMATxStatus; + + ++ks5000_BDMA_Tx_Isr_Cnt; +#if defined(CYGPKG_NET) + ++ifStats.interrupts; +#endif + if (IntBDMATxStatus & BDMASTAT_TX_CCP) + { + debug_printf("+-- Control Packet Transfered : %x\r",ERMPZCNT); + debug_printf(" Tx Control Frame Status : %x\r",ETXSTAT); + } + + if (IntBDMATxStatus & (BDMASTAT_TX_NL|BDMASTAT_TX_NO|BDMASTAT_TX_EMPTY) ) + { + if (IntBDMATxStatus & BDMASTAT_TX_NL) + BDMATxErrCnt.BTxNLErr++; + if (IntBDMATxStatus & BDMASTAT_TX_NO) + BDMATxErrCnt.BTxNOErr++; + if (IntBDMATxStatus & BDMASTAT_TX_EMPTY) + BDMATxErrCnt.BTxEmptyErr++; + } + + // free any buffers we're done with + + while (txDonePointer->FrameDataPtr && !(txDonePointer->FrameDataPtr & FRM_OWNERSHIP_BDMA)) + { + freeBuffer((tEthBuffer*)txDonePointer->FrameDataPtr); + txDonePointer->FrameDataPtr = 0; + txDonePointer = txDonePointer->NextFD; + } + + // don't call tx dsr for now -- it has nothing to do + + return CYG_ISR_HANDLED; +} + + +static void BDMA_Tx_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + ++ks5000_BDMA_Tx_Dsr_Cnt; +} + + + +//====================================================================== +static cyg_uint32 BDMA_Rx_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + U32 IntBDMARxStatus; + + cyg_drv_interrupt_acknowledge(vector); + + IntBDMARxStatus = BDMASTAT; + BDMASTAT = IntBDMARxStatus; + + ++ks5000_BDMA_Rx_Isr_Cnt; +#if defined(CYGPKG_NET) + ++ifStats.interrupts; +#endif + if (IntBDMARxStatus & (BDMASTAT_RX_NL | BDMASTAT_RX_NO | + BDMASTAT_RX_MSO | BDMASTAT_RX_EMPTY | + BDMASTAT_RX_SEARLY) ) + { +// printf("RxIsr %u\r\n", (unsigned)cyg_current_time()); + if (IntBDMARxStatus & BDMASTAT_RX_NL) + BDMARxErrCnt.BRxNLErr++; + if (IntBDMARxStatus & BDMASTAT_RX_NO) + BDMARxErrCnt.BRxNOErr++; + if (IntBDMARxStatus & BDMASTAT_RX_MSO) + BDMARxErrCnt.BRxMSOErr++; + if (IntBDMARxStatus & BDMASTAT_RX_EMPTY) + BDMARxErrCnt.BRxEmptyErr++; + if (IntBDMARxStatus & BDMASTAT_RX_SEARLY) + BDMARxErrCnt.sBRxSEarly++; + } + + return CYG_ISR_HANDLED|CYG_ISR_CALL_DSR; +} + +static void eth_handle_recv_buffer(tEthBuffer*); + +static cyg_handle_t bdmaRxIntrHandle; +static cyg_handle_t bdmaTxIntrHandle; +static cyg_handle_t macRxIntrHandle; +static cyg_handle_t macTxIntrHandle; + +static cyg_interrupt bdmaRxIntrObject; +static cyg_interrupt bdmaTxIntrObject; +static cyg_interrupt macRxIntrObject; +static cyg_interrupt macTxIntrObject; + +static int ethernetRunning; + +#if HavePHYinterrupt +static cyg_handle_t macPhyIntrHandle; +static cyg_interrupt macPhyIntrObject; +#endif + +static void ks32c5000_eth_deliver(struct eth_drv_sc *sc) +{ + unsigned short p; + tEthBuffer *rxBuffer; + extern void cyg_interrupt_post_dsr(CYG_ADDRWORD intr_obj); + + ++ks5000_BDMA_Rx_Dsr_Cnt; + + while (1) + { + if (!rx_frame_avail()) + { + // no more frames + return; + } + + if (!(rxBuffer=ks32c5000_eth_get_recv_buffer())) + { + // no buffers available + return; + } + + p = *((unsigned short*)(rxBuffer->data+EtherFramePadding+ETH_HEADER_SIZE-2)); + + if (ethernetRunning) + eth_handle_recv_buffer(rxBuffer); + else + freeBuffer(rxBuffer); + } +} + + +static void installInterrupts(void) +{ + extern struct eth_drv_sc ks32c5000_sc; + bool firstTime=true; + + debug_printf("ks5000_ether: installInterrupts()\n"); + + if (!firstTime) + return; + firstTime = false; + + initFreeList(); + Init_RxFrameDescriptorArray(); + Init_TxFrameDescriptorArray(); + + BDMARXPTR = (U32)rxReadPointer; + BDMATXPTR = (U32)txWritePointer; + + cyg_drv_mutex_init(&txMutex); + cyg_drv_mutex_init(&oldRxMutex); + cyg_drv_cond_init(&oldRxCond,&oldRxMutex); + + cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_EtherBDMARx,0,(unsigned)&ks32c5000_sc,BDMA_Rx_isr,eth_drv_dsr,&bdmaRxIntrHandle,&bdmaRxIntrObject); + cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_EtherBDMATx,0,0,BDMA_Tx_isr,BDMA_Tx_dsr,&bdmaTxIntrHandle,&bdmaTxIntrObject); + cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_EtherMacRx,0,0,MAC_Rx_isr,NULL,&macRxIntrHandle,&macRxIntrObject); + cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_EtherMacTx,0,0,MAC_Tx_isr,NULL,&macTxIntrHandle,&macTxIntrObject); +#if HavePHYinterrupt + cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_Ext0,0,0,MAC_Phy_isr,NULL,&macPhyIntrHandle,&macPhyIntrObject); + cyg_drv_interrupt_attach(macPhyIntrHandle); +#endif + + cyg_drv_interrupt_attach(bdmaRxIntrHandle); + cyg_drv_interrupt_attach(bdmaTxIntrHandle); + cyg_drv_interrupt_attach(macRxIntrHandle); + cyg_drv_interrupt_attach(macTxIntrHandle); + + cyg_drv_interrupt_acknowledge(CYGNUM_HAL_INTERRUPT_Ext0); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_Ext0); +} + +//====================================================================== +// Driver code that interfaces to the TCP/IP stack via the common +// Ethernet interface. + + +// don't have any private data, but if we did, this is where it would go +typedef struct +{ + int j; +}ks32c5000_priv_data_t; + +ks32c5000_priv_data_t ks32c5000_priv_data; + +#define eth_drv_tx_done(sc,key,retval) (sc)->funs->eth_drv->tx_done(sc,key,retval) +#define eth_drv_init(sc,enaddr) ((sc)->funs->eth_drv->init)(sc, myMacAddr) +#define eth_drv_recv(sc,len) ((sc)->funs->eth_drv->recv)(sc, len) + +static unsigned char myMacAddr[6] = { CYGPKG_DEVS_ETH_ARM_KS32C5000_MACADDR }; + +static bool ks32c5000_eth_init(struct cyg_netdevtab_entry *tab) +{ + struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance; + *(unsigned*)0x7ff5000 |= Bit(1)+Bit(3)+Bit(5); // enable debug output bits + // memcpy(myMacAddr,(unsigned char*)CAM_BaseAddr,6); + debug_printf("ks32c5000_eth_init()\n"); + debug_printf(" MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",myMacAddr[0],myMacAddr[1],myMacAddr[2],myMacAddr[3],myMacAddr[4],myMacAddr[5]); +#if defined(CYGPKG_NET) + ifStats.duplex = 1; //unknown + ifStats.operational = 1; //unknown + ifStats.tx_queue_len = MAX_TX_FRAME_DESCRIPTORS; +#endif + installInterrupts(); + EthInit(myMacAddr); +#if defined(CYGPKG_NET) + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EtherBDMARx); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EtherBDMATx); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EtherMacRx); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EtherMacTx); +#endif + configDone = 1; + ethernetRunning = 1; + eth_drv_init(sc, myMacAddr); + return true; +} + +static void ks32c5000_eth_start(struct eth_drv_sc *sc, unsigned char *enaddr, int flags) +{ + debug_printf("ks32c5000_eth_start()\n"); + if (!ethernetRunning) + { + cyg_drv_interrupt_mask(CYGNUM_HAL_INTERRUPT_EtherBDMARx); + cyg_drv_interrupt_mask(CYGNUM_HAL_INTERRUPT_EtherBDMATx); + cyg_drv_interrupt_mask(CYGNUM_HAL_INTERRUPT_EtherMacRx); + cyg_drv_interrupt_mask(CYGNUM_HAL_INTERRUPT_EtherMacTx); + EthInit(enaddr); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EtherBDMARx); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EtherBDMATx); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EtherMacRx); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EtherMacTx); + ethernetRunning = 1; + } +} + +static void ks32c5000_eth_stop(struct eth_drv_sc *sc) +{ + debug_printf("ks32c5000_eth_stop()\n"); + ethernetRunning = 0; +} + +static int ks32c5000_eth_control(struct eth_drv_sc *sc, + unsigned long cmd, + void *data, + int len) +{ + switch (cmd) + { +#if defined(CYGPKG_NET) + case ETH_DRV_GET_IF_STATS_UD: + case ETH_DRV_GET_IF_STATS: + { + struct ether_drv_stats *p = (struct ether_drv_stats*)data; + *p = ifStats; + strncpy(p->description,"description goes here",sizeof p->description); + strncpy(p->snmp_chipset,"chipset name",sizeof p->snmp_chipset); + return 0; + } +#endif + default: + return -1; + } +} + +static int ks32c5000_eth_can_send_count=0; +static int ks32c5000_eth_can_send_count_OK=0; + +// In case there are multiple Tx frames waiting, we should +// return how many empty Tx spots we have. For now we just +// return 0 or 1. +static int ks32c5000_eth_can_send(struct eth_drv_sc *sc) +{ + FRAME_DESCRIPTOR *TxFp, *StartFp; + + // find the next unused spot in the queue + + ++ks32c5000_eth_can_send_count; + + StartFp = TxFp = (FRAME_DESCRIPTOR*)BDMATXPTR; + + while (TxFp->FrameDataPtr & FRM_OWNERSHIP_BDMA) + { + TxFp = TxFp->NextFD; + if (TxFp == StartFp) + return 0; + } + ++ks32c5000_eth_can_send_count_OK; + return 1; +} + +static int ks5000_eth_send_count=0; + +static void ks32c5000_eth_send(struct eth_drv_sc *sc, + struct eth_drv_sg *sg_list, + int sg_len, + int total_len, + unsigned long key) +{ + unsigned char *dest; + unsigned len; + tEthBuffer *buf; + + if (total_len >= MAX_ETH_FRAME_SIZE) + { + eth_drv_tx_done(sc,key,-EINVAL); + return; + } + + ++ks5000_eth_send_count; + + // allocate buffer + + buf = allocBuffer(); + if (!buf) + { + // out of buffers + eth_drv_tx_done(sc,key,-EIO); + return; + } + + // copy data from scatter/gather list into BDMA data buffer + + len = 0; + dest = buf->data; + + while (sg_len) + { + memcpy(dest,(unsigned char*)sg_list->buf,sg_list->len); + len += sg_list->len; + dest += sg_list->len; + ++sg_list; + --sg_len; + } + + buf->length = len; + + // tell upper layer that we're done with this sglist + + eth_drv_tx_done(sc,key,0); + + // queue packet for transmit + + while(!ks32c5000_eth_buffer_send(buf)) + { +#if defined(CYGPKG_NET) + // wait a tick and try again. + cyg_thread_delay(1); +#else + // toss it. + freeBuffer(buf); + break; +#endif + } + +} + + +static int ks5000_eth_rcv_count=0; +static tEthBuffer *tcpIpRxBuffer; + +// called from DSR +static void eth_handle_recv_buffer(tEthBuffer* rxBuffer) +{ + extern struct eth_drv_sc ks32c5000_sc; + tcpIpRxBuffer = rxBuffer; + eth_drv_recv(&ks32c5000_sc,tcpIpRxBuffer->length-4); // discard 32-bit CRC +} + +static void ks32c5000_eth_recv(struct eth_drv_sc *sc, + struct eth_drv_sg *sg_list, + int sg_len) +{ + unsigned char *source; + + ++ks5000_eth_rcv_count; + + if (!tcpIpRxBuffer) + return; // no packet waiting, shouldn't be here! + + // copy data from eth buffer into scatter/gather list + + source = tcpIpRxBuffer->data + EtherFramePadding; + + while (sg_len) + { + if (sg_list->buf) + memcpy((unsigned char*)sg_list->buf,source,sg_list->len); + source += sg_list->len; + ++sg_list; + --sg_len; + } + + freeBuffer(tcpIpRxBuffer); + tcpIpRxBuffer = NULL; + return; +} + +// routine called to handle ethernet controller in polled mode +static void ks32c5000_eth_poll(struct eth_drv_sc *sc) +{ + ks32c5000_eth_deliver(sc); // handle rx frames + ks32c5000_handle_tx_complete(); +} + +static int ks32c5000_eth_int_vector(struct eth_drv_sc *sc) +{ + return CYGNUM_HAL_INTERRUPT_EtherBDMARx; +} + + +ETH_DRV_SC(ks32c5000_sc, + &ks32c5000_priv_data, // Driver specific data + "eth0", // Name for this interface + ks32c5000_eth_start, + ks32c5000_eth_stop, + ks32c5000_eth_control, + ks32c5000_eth_can_send, + ks32c5000_eth_send, + ks32c5000_eth_recv, + ks32c5000_eth_deliver, + ks32c5000_eth_poll, + ks32c5000_eth_int_vector + ); + +NETDEVTAB_ENTRY(ks32c5000_netdev, + "ks32c5000", + ks32c5000_eth_init, + &ks32c5000_sc); + + +#if SoftwareCRC + +static U32 crctable[256] = +{ +0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, +0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, +0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L, +0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L, 0x90BF1D91L, +0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL, +0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L, +0x136C9856L, 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL, +0x14015C4FL, 0x63066CD9L, 0xFA0F3D63L, 0x8D080DF5L, +0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L, 0xA2677172L, +0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL, +0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L, +0x32D86CE3L, 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L, +0x26D930ACL, 0x51DE003AL, 0xC8D75180L, 0xBFD06116L, +0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L, 0xB8BDA50FL, +0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L, +0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL, +0x76DC4190L, 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL, +0x71B18589L, 0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L, +0x7807C9A2L, 0x0F00F934L, 0x9609A88EL, 0xE10E9818L, +0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L, +0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL, +0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L, +0x65B0D9C6L, 0x12B7E950L, 0x8BBEB8EAL, 0xFCB9887CL, +0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L, +0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L, +0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL, +0x4369E96AL, 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L, +0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL, 0xDD0D7CC9L, +0x5005713CL, 0x270241AAL, 0xBE0B1010L, 0xC90C2086L, +0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL, +0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L, +0x59B33D17L, 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL, +0xEDB88320L, 0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL, +0xEAD54739L, 0x9DD277AFL, 0x04DB2615L, 0x73DC1683L, +0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L, +0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L, +0xF00F9344L, 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL, +0xF762575DL, 0x806567CBL, 0x196C3671L, 0x6E6B06E7L, +0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL, +0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L, +0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L, +0xD1BB67F1L, 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL, +0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L, 0x41047A60L, +0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL, 0x4669BE79L, +0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L, +0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL, +0xC5BA3BBEL, 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L, +0xC2D7FFA7L, 0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL, +0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL, 0x026D930AL, +0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L, +0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L, +0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L, +0x86D3D2D4L, 0xF1D4E242L, 0x68DDB3F8L, 0x1FDA836EL, +0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L, 0x18B74777L, +0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL, +0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L, +0xA00AE278L, 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L, +0xA7672661L, 0xD06016F7L, 0x4969474DL, 0x3E6E77DBL, +0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L, 0x37D83BF0L, +0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L, +0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L, +0xBAD03605L, 0xCDD70693L, 0x54DE5729L, 0x23D967BFL, +0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L, +0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL +}; + + +static U32 crc32( unsigned char *blk_adr, unsigned blk_len) +{ + U32 crc = 0xffffffff; + + while (blk_len--) + crc = crctable[(crc ^ *blk_adr++) & 0xffL] ^ (crc >> 8); + + return crc ^ 0xffffffff; +} + +#endif + + + + + diff --git a/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.h b/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.h new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.h @@ -0,0 +1,272 @@ +//========================================================================== +// +// ks5000_ether.h +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#ifndef KS32C5000_ETHER_H +#define KS32C5000_ETHER_H + +// Tx Frame Descriptor's control bits -- Refer the KS32C5000 Manual Page 7-15 +#define FRM_OWNERSHIP_BDMA 0x80000000 // 0:CPU, 1:BDMA +#define FRM_OWNERSHIP_CPU 0x7fffffff // 0:CPU, 1:BDMA + +#define TXFDCON_PADDING_MODE 0x00 +#define TXFDCON_NO_PADDING_MODE 0x01 +#define TXFDCON_NO_CRC_MODE 0x02 +#define TXFDCON_CRC_MODE 0x00 +#define TXFDCON_MAC_TX_INT_EN 0x04 +#define TXFDCON_LITTLE_ENDIAN 0x08 +#define TXFDCON_BIG_ENDIAN 0x00 +#define TXFDCON_SRC_ADDR_DEC 0x00 +#define TXFDCON_SRC_ADDR_INC 0x10 +#define TXFDCON_WIDGET_ALIGN00 0x00 // No Invalid bytes +#define TXFDCON_WIDGET_ALIGN01 0x01 // 1 Invalid byte +#define TXFDCON_WIDGET_ALIGN10 0x10 // 2 Invalid bytes +#define TXFDCON_WIDGET_ALIGN11 0x11 // 3 Invalid bytes + +// Tx Frame descriptor's Status +#define TXFDSTAT_EX_COLL 0x0010 // Excessive Collision +#define TXFDSTAT_DEFFER 0x0020 // Transmit deffered +#define TXFDSTAT_PAUSED 0x0040 // Paused : holding data transmission DMA to MAC +#define TXFDSTAT_INT_TX 0x0080 // Interrupt on Transmit +#define TXFDSTAT_UNDER 0x0100 // Underrun */ +#define TXFDSTAT_DEFER 0x0200 // Mac defers for Max_DEFERRAL:=0.32768ms + // for 100Mbits/s, := 3.2768ms for 10Mbits/s +#define TXFDSTAT_NCARR 0x0400 // No Carrier sense is detected during the + // entire transmission of a packet from SFD + // to CRC +#define TXFDSTAT_SQ_ERR 0x0800 // fake collision signal didn't come from + // PHY for 1.6us. +#define TXFDSTAT_LATE_COLL 0x1000 // Late collision +#define TXFDSTAT_PAR 0x2000 // Transmit Parity Error +#define TXFDSTAT_COMP 0x4000 // MAC transmit or discards one packet +#define TXFDSTAT_HALTED 0x8000 // Transmission was halted by clearing MACTXCON_TX_EN.. + +// Rx Frame descriptor's Status +#define RXFDSTAT_OV_MAX 0x0008 // Over Maximum Size +#define RXFDSTAT_CTL_RECD 0x0020 // set if packet received is a + // MAC control frame. +#define RXFDSTAT_INT_RX 0x0040 // Interrupt on Receive +#define RXFDSTAT_10STAT 0x0080 // set if packet was received via the + // 10bits interface reset if packet + // was received via MII +#define RXFDSTAT_ALIGN_ERR 0x0100 // Alignment Error +#define RXFDSTAT_CRC_ERR 0x0200 // CRC error +#define RXFDSTAT_OVERFLOW 0x0400 // MAC receive FIFO was full when it + // needed to store a received byte + +#define RXFDSTAT_LONG_ERR 0x0800 // received a frame longer than 1518bytes +#define RXFDSTAT_PAR 0x2000 // MAC receive FIFO has detected a parity error +#define RXFDSTAT_GOOD 0x4000 // successfully received a packet with no errors +#define RXFDSTAT_HALTED 0x8000 // Transmission was halted by clearing MACTXCON_TX_EN... + +// BDMARXCON : 0x9004 +// Buffered DMA Receiver Control Register +#define BDMARXCON_BRST 0x00001F // BDMA Rx Burst Size * BDMARXCON_BRST +#define BDMARXCON_STP_SKP 0x00020 // BDMA Rx Stop/Skip Frame or Interrupt(=1) +#define BDMARXCON_MA_INC 0x00040 // BDMA Rx Memory Address Inc/Dec +#define BDMARXCON_DIE 0x00080 // BDMA Rx Every Received Frame Interrupt Enable +#define BDMARXCON_NLIE 0x00100 // BDMA Rx NULL List Interrupt Enable +#define BDMARXCON_NOIE 0x00200 // BDMA Rx Not Owner Interrupt Enable +#define BDMARXCON_MSOIE 0x00400 // BDMA Rx Maximum Size over Interrupr Enable +#define BDMARXCON_LITTLE 0x00800 // BDMA Rx Big/Little Endian +#define BDMARXCON_BIG 0x00000 // BDMA Rx Big/Little Endian +#define BDMARXCON_WA00 0x00000 // BDMA Rx Word Alignment- no invalid byte +#define BDMARXCON_WA01 0x01000 // BDMA Rx Word Alignment- one invalid byte +#define BDMARXCON_WA10 0x02000 // BDMA Rx Word Alignment- two invalid byte +#define BDMARXCON_WA11 0x03000 // BDMA Rx Word Alignment- three invalid byte +#define BDMARXCON_EN 0x04000 // BDMA Rx Enable +#define BDMARXCON_RESET 0x08000 // BDMA Rx Reset +#define BDMARXCON_RX_EMPT 0x10000 // BDMA Rx Buffer empty interrupt +#define BDMARXCON_EARLY 0x20000 // BDMA Rx Early notify Interrupt + +// BDMATXCON : 0x9000 +// Buffered DMA Trasmit Control Register +#define BDMATXCON_BRST 0x000F // BDMA Tx Burst Size = 16 +#define BDMATXCON_STP_SKP 0x0020 // BDMA Tx Stop/Skip Frame or Interrupt in case + // of not Owner the current frame +#define BDMATXCON_CPIE 0x0080 // BDMA Tx Complete to send control + // packet Enable +#define BDMATXCON_NOIE 0x0200 // BDMA Tx Buffer Not Owner +#define BDMATXCON_TX_EMPTY 0x0400 // BDMA Tx Buffer Empty Interrupt +#define BDMATXCON_TX_NOIE 0x0200 // BDMA Tx not owner (queue empty) +#define BDMATXCON_TX_NULL 0x0100 // BDMA dscr pointer null + +// BDMA Tx buffer can be moved to the MAC Tx IO +// when the new frame comes in. +#define BDMATXCON_MSL000 0x00000 // No wait to fill the BDMA +#define BDMATXCON_MSL001 0x00800 // wait to fill 1/8 of the BDMA +#define BDMATXCON_MSL010 0x01000 // wait to fill 2/8 of the BDMA +#define BDMATXCON_MSL011 0x01800 // wait to fill 3/8 of the BDMA +#define BDMATXCON_MSL100 0x02000 // wait to fill 4/8 of the BDMA +#define BDMATXCON_MSL101 0x02800 // wait to fill 5/8 of the BDMA +#define BDMATXCON_MSL110 0x03000 // wait to fill 6/8 of the BDMA +#define BDMATXCON_MSL111 0x03800 // wait to fill 7/8 of the BDMA +#define BDMATXCON_EN 0x04000 // BDMA Tx Enable +#define BDMATXCON_RESET 0x08000 // BDMA Rx Reset + +// BDMASTAT : 0x9014 +// Buffered DMA Status Register +#define BDMASTAT_RX_RDF 0x00001 // BDMA Rx Done Every Received Frame +#define BDMASTAT_RX_NL 0x00002 // BDMA Rx NULL List +#define BDMASTAT_RX_NO 0x00004 // BDMA Rx Not Owner +#define BDMASTAT_RX_MSO 0x00008 // BDMA Rx Maximum Size Over +#define BDMASTAT_RX_EMPTY 0x00010 // BDMA Rx Buffer Empty +#define BDMASTAT_RX_SEARLY 0x00020 // Early Notify +#define BDMASTAT_RX_FRF 0x00080 // One more frame data in BDMA receive buffer +#define BDMASTAT_TX_CCP 0x10000 // BDMA Tx Complete to send Control Packet +#define BDMASTAT_TX_NL 0x20000 // BDMA Tx Null List +#define BDMASTAT_TX_NO 0x40000 // BDMA Tx Not Owner +#define BDMASTAT_TX_EMPTY 0x100000// BDMA Tx Buffer Empty + +// MACON : 0xa000 +// MAC Control Register +#define MACON_HALT_REG 0x0001 // stop transmission and reception + // after completion of ant current packets +#define MACON_HALT_IMM 0x0002 // Stop transmission and reception immediately +#define MACON_SW_RESET 0x0004 // reset all Ethernet controller state machines + // and FIFOs +#define MACON_FULL_DUP 0x0008 // allow transmission to begin while reception + // is occurring +#define MACON_MAC_LOOP 0x0010 // MAC loopback +#define MACON_CONN_M00 0x0000 // Automatic-default +#define MACON_CONN_M01 0x0020 // Force 10Mbits endec +#define MACON_CONN_M10 0x0040 // Force MII (rate determined by MII clock +#define MACON_LOOP10 0x0080 // Loop 10Mbps +#define MACON_MISS_ROLL 0x0400 // Missed error counter rolled over +#define MACON_EN_MISS_ROLL 0x2000 // Interrupt when missed error counter rolls + // over +#define MACON_LINK10 0x8000 // Link status 10Mbps + +// CAMCON : 0xa004 +// CAM control register +#define CAMCON_STATION_ACC 0x0001 // Accept any packet with a unicast station + // address +#define CAMCON_GROUP_ACC 0x0002 // Accept any packet with multicast-group + // station address +#define CAMCON_BROAD_ACC 0x0004 // Accept any packet with a broadcast station + // address +#define CAMCON_NEG_CAM 0x0008 // 0: Accept packets CAM recognizes, + // reject others + // 1: reject packets CAM recognizes, + // accept others +#define CAMCON_COMP_EN 0x0010 // Compare Enable mode + +// MACTXCON : 0xa008 +// Transmit Control Register +#define MACTXCON_TX_EN 0x0001 // transmit Enable +#define MACTXCON_TX_HALT 0x0002 // Transmit Halt Request +#define MACTXCON_NO_PAD 0x0004 // suppress Padding +#define MACTXCON_NO_CRC 0x0008 // Suppress CRC +#define MACTXCON_FBACK 0x0010 // Fast Back-off +#define MACTXCON_NO_DEF 0x0020 // Disable the defer counter +#define MACTXCON_SD_PAUSE 0x0040 // Send Pause +#define MACTXCON_MII10_EN 0x0080 // MII 10Mbps mode enable +#define MACTXCON_EN_UNDER 0x0100 // Enable Underrun +#define MACTXCON_EN_DEFER 0x0200 // Enable Deferral +#define MACTXCON_EN_NCARR 0x0400 // Enable No Carrier +#define MACTXCON_EN_EXCOLL 0x0800 // interrupt if 16 collision occur + // in the same packet +#define MACTXCON_EN_LATE_COLL 0x1000 // interrupt if collision occurs after + // 512 bit times(64 bytes times) +#define MACTXCON_ENTX_PAR 0x2000 // interrupt if the MAC transmit FIFO + // has a parity error +#define MACTXCON_EN_COMP 0x4000 // interrupt when the MAC transmits or + // discards one packet +// MACTXSTAT : 0xa00c +// Transmit Status Register +#define MACTXSTAT_EX_COLL 0x0010 // Excessive collision +#define MACTXSTAT_DEFFERED 0x0020 // set if 16 collisions occur for same packet +#define MACTXSTAT_PAUSED 0x0040 // packet waited because of pause during + // transmission +#define MACTXSTAT_INT_TX 0x0080 // set if transmission of packet causes an + // interrupt condiftion +#define MACTXSTAT_UNDER 0x0100 // MAC transmit FIFO becomes empty during + // transmission +#define MACTXSTAT_DEFER 0x0200 // MAC defers for MAC deferral +#define MACTXSTAT_NCARR 0x0400 // No carrier sense detected during the + // transmission of a packet +#define MACTXSTAT_SIG_QUAL 0x0800 // Signal Quality Error +#define MACTXSTAT_LATE_COLL 0x1000 // a collision occures after 512 bit times +#define MACTXSTAT_PAR 0x2000 // MAC transmit FIFO has detected a parity error +#define MACTXSTAT_COMP 0x4000 // MAC transmit or discards one packet +#define MACTXSTAT_HALTED 0x8000 // Transmission was halted by clearing + // MACTXCON_TX_EN or Halt immedite +// MACRXCON : 0xa010 +// Receive Control Register +#define MACRXCON_RX_EN 0x0001 +#define MACRXCON_HALT 0x0002 +#define MACRXCON_LONG_EN 0x0004 +#define MACRXCON_SHORT_EN 0x0008 +#define MACRXCON_STRIP_CRC 0x0010 +#define MACRXCON_PASS_CTL 0x0020 +#define MACRXCON_IGNORE_CRC 0x0040 +#define MACRXCON_EN_ALIGN 0x0100 +#define MACRXCON_EN_CRC_ERR 0x0200 +#define MACRXCON_EN_OVER 0x0400 +#define MACRXCON_EN_LONG_ERR 0x0800 +#define MACRXCON_EN_RX_PAR 0x2000 +#define MACRXCON_EN_GOOD 0x4000 + +// MACRXSTAT : 0xa014 +// Receive Status Register +#define MACRXSTAT_CTL_RECD 0x0020 +#define MACRXSTAT_INT_RX 0x0040 +#define MACRXSTAT_10STAT 0x0080 +#define MACRXSTAT_ALLIGN_ERR 0x0100 +#define MACRXSTAT_CRC_ERR 0x0200 +#define MACRXSTAT_OVERFLOW 0x0400 +#define MACRXSTAT_LONG_ERR 0x0800 +#define MACRXSTAT_PAR 0x2000 +#define MACRXSTAT_GOOD 0x4000 +#define MACRXSTAT_HALTED 0x8000 + +#endif diff --git a/packages/devs/eth/arm/ks32c5000/current/src/ks5000_regs.h b/packages/devs/eth/arm/ks32c5000/current/src/ks5000_regs.h new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/ks32c5000/current/src/ks5000_regs.h @@ -0,0 +1,227 @@ +//========================================================================== +// +// ks5000_regs.h +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +/*------------------------------------------------------------------------ + name : ks5000.h + purpose : This is the header file that will define all the + registers for the ks5000 processor. It will contain + the addresses for the registers and some values for + those registers. +========================================================================*/ +#ifndef _KS5000_REGS_H_ +#define _KS5000_REGS_H_ + +#include "std.h" + +#define BD_LAN_STOP {} +#define DEBUG 0 /* DEBUG mode */ + +#define VPint(a) (*((volatile unsigned int*)(a))) +#define VPshort(a) (*((volatile unsigned short int*)(a))) +#define VPchar(a) (*((volatile unsigned char*)(a))) + +#define Base_Addr 0x7ff0000 + +#define INTADDR (Reset_Addr+0x20) +#define SPSTR (VPint(Base_Addr)) + +// System Manager Register +#define SYSCFG (VPint(Base_Addr+0x0000)) +#define CLKCON (VPint(Base_Addr+0x3000)) +#define EXTACON0 (VPint(Base_Addr+0x3008)) +#define EXTACON1 (VPint(Base_Addr+0x300c)) +#define EXTDBWTH (VPint(Base_Addr+0x3010)) +#define ROMCON0 (VPint(Base_Addr+0x3014)) +#define ROMCON1 (VPint(Base_Addr+0x3018)) +#define ROMCON2 (VPint(Base_Addr+0x301c)) +#define ROMCON3 (VPint(Base_Addr+0x3020)) +#define ROMCON4 (VPint(Base_Addr+0x3024)) +#define ROMCON5 (VPint(Base_Addr+0x3028)) +#define DRAMCON0 (VPint(Base_Addr+0x302c)) +#define DRAMCON1 (VPint(Base_Addr+0x3030)) +#define DRAMCON2 (VPint(Base_Addr+0x3034)) +#define DRAMCON3 (VPint(Base_Addr+0x3038)) +#define REFEXTCON (VPint(Base_Addr+0x303c)) + +// Ethernet BDMA Register +#define BDMATXCON (VPint(Base_Addr+0x9000)) +#define BDMARXCON (VPint(Base_Addr+0x9004)) +#define BDMATXPTR (VPint(Base_Addr+0x9008)) +#define BDMARXPTR (VPint(Base_Addr+0x900c)) +#define BDMARXLSZ (VPint(Base_Addr+0x9010)) +#define BDMASTAT (VPint(Base_Addr+0x9014)) + +#define CAM_BASE (VPint(Base_Addr+0x9100)) +#define BDMATXBUF (VPint(Base_Addr+0x9200)) +#define BDMARXBUF (VPint(Base_Addr+0x9800)) +#define CAM_BaseAddr (Base_Addr+0x9100) + +// Ethernet MAC Register +#define MACCON (VPint(Base_Addr+0xa000)) +#define CAMCON (VPint(Base_Addr+0xa004)) +#define MACTXCON (VPint(Base_Addr+0xa008)) +#define MACTXSTAT (VPint(Base_Addr+0xa00c)) +#define MACRXCON (VPint(Base_Addr+0xa010)) +#define MACRXSTAT (VPint(Base_Addr+0xa014)) +#define STADATA (VPint(Base_Addr+0xa018)) +#define STACON (VPint(Base_Addr+0xa01c)) +#define CAMEN (VPint(Base_Addr+0xa028)) +#define EMISSCNT (VPint(Base_Addr+0xa03c)) +#define EPZCNT (VPint(Base_Addr+0xa040)) +#define ERMPZCNT (VPint(Base_Addr+0xa044)) +#define ETXSTAT (VPint(Base_Addr+0xa048)) +#define MACRXDESTR (VPint(Base_Addr+0xa064)) +#define MACRXSTATEM (VPint(Base_Addr+0xa090)) + +// HDLC Channel A +#define HCON0A (VPint(Base_Addr+0x7000)) +#define HCON1A (VPint(Base_Addr+0x7004)) +#define HSTATA (VPint(Base_Addr+0x7008)) +#define HINTENA (VPint(Base_Addr+0x700c)) +#define HTXFIFOCA (VPint(Base_Addr+0x7010)) +#define HTXFIFOTA (VPint(Base_Addr+0x7014)) +#define HRXFIFOA (VPint(Base_Addr+0x7018)) +#define HSADRA (VPint(Base_Addr+0x701c)) +#define HBRGTCA (VPint(Base_Addr+0x7020)) +#define HPRMBA (VPint(Base_Addr+0x7024)) +#define HDMATXMAA (VPint(Base_Addr+0x7028)) +#define HDMARXMAA (VPint(Base_Addr+0x702c)) +#define HDMATXCNTA (VPint(Base_Addr+0x7030)) +#define HDMARXCNTA (VPint(Base_Addr+0x7034)) +#define HDMARXBCNTA (VPint(Base_Addr+0x7038)) + +// HDLC Channel B +#define HCON0B (VPint(Base_Addr+0x8000)) +#define HCON1B (VPint(Base_Addr+0x8004)) +#define HSTATB (VPint(Base_Addr+0x8008)) +#define HINTENB (VPint(Base_Addr+0x800c)) +#define HTXFIFOCB (VPint(Base_Addr+0x8010)) +#define HTXFIFOTB (VPint(Base_Addr+0x8014)) +#define HRXFIFOB (VPint(Base_Addr+0x8018)) +#define HSADRB (VPint(Base_Addr+0x801c)) +#define HBRGTCB (VPint(Base_Addr+0x8020)) +#define HPRMBB (VPint(Base_Addr+0x8024)) +#define HDMATXMAB (VPint(Base_Addr+0x8028)) +#define HDMARXMAB (VPint(Base_Addr+0x802c)) +#define HDMATXCNTB (VPint(Base_Addr+0x8030)) +#define HDMARXCNTB (VPint(Base_Addr+0x8034)) +#define HDMARXBCNTB (VPint(Base_Addr+0x8038)) + +// I2C Bus Register +#define IICCON (VPint(Base_Addr+0xf000)) +#define IICBUF (VPint(Base_Addr+0xf004)) +#define IICPS (VPint(Base_Addr+0xf008)) +#define IICCOUNT (VPint(Base_Addr+0xf00c)) + +// GDMA 0 +#define GDMACON0 (VPint(Base_Addr+0xb000)) +#define GDMASRC0 (VPint(Base_Addr+0xb004)) +#define GDMADST0 (VPint(Base_Addr+0xb008)) +#define GDMACNT0 (VPint(Base_Addr+0xb00c)) + +// GDMA 1 +#define GDMACON1 (VPint(Base_Addr+0xc000)) +#define GDMASRC1 (VPint(Base_Addr+0xc004)) +#define GDMADST1 (VPint(Base_Addr+0xc008)) +#define GDMACNT1 (VPint(Base_Addr+0xc00c)) + +// UART 0 +#define UART0_LCR (VPint(Base_Addr+0xd000)) // line control register +#define UART0_CTRL (VPint(Base_Addr+0xd004)) // uart control register +#define UART0_LST (VPint(Base_Addr+0xd008)) // line status register +#define UART0_THR (VPint(Base_Addr+0xd00c)) // transmit holding reg. +#define UART0_RDR (VPint(Base_Addr+0xd010)) // receive data register +#define UART0_BRD (VPint(Base_Addr+0xd014)) // baud rate divisor + +// UART 1 +#define UART1_LCR (VPint(Base_Addr+0xe000)) // line control register +#define UART1_CTRL (VPint(Base_Addr+0xe004)) // uart control register +#define UART1_LST (VPint(Base_Addr+0xe008)) // line status register +#define UART1_THR (VPint(Base_Addr+0xe00c)) // transmit holding reg. +#define UART1_RDR (VPint(Base_Addr+0xe010)) // receive data register +#define UART1_BRD (VPint(Base_Addr+0xe014)) // baud rate divisor + +// Timer Register +#define TMOD (VPint(Base_Addr+0x6000)) +#define TDATA0 (VPint(Base_Addr+0x6004)) +#define TDATA1 (VPint(Base_Addr+0x6008)) +#define TCNT0 (VPint(Base_Addr+0x600c)) +#define TCNT1 (VPint(Base_Addr+0x6010)) + +// Timer Mode Register +#define TM0_RUN 0x01 /* Timer 0 enable */ +#define TM0_TOGGLE 0x02 /* 0, interval mode */ +#define TM0_OUT_1 0x04 /* Timer 0 Initial TOUT0 value */ +#define TM1_RUN 0x08 /* Timer 1 enable */ +#define TM1_TOGGLE 0x10 /* 0, interval mode */ +#define TM1_OUT_1 0x20 /* Timer 0 Initial TOUT0 value */ + +// I/O Port Interface +#define IOPMOD (VPint(Base_Addr+0x5000)) +#define IOPCON (VPint(Base_Addr+0x5004)) +#define IOPDATA (VPint(Base_Addr+0x5008)) + +// Interrupt Controller Register +#define INTMODE (VPint(Base_Addr+0x4000)) +#define INTPEND (VPint(Base_Addr+0x4004)) +#define INTMASK (VPint(Base_Addr+0x4008)) + +#define INTPRI0 (VPint(Base_Addr+0x400c)) +#define INTPRI1 (VPint(Base_Addr+0x4010)) +#define INTPRI2 (VPint(Base_Addr+0x4014)) +#define INTPRI3 (VPint(Base_Addr+0x4018)) +#define INTPRI4 (VPint(Base_Addr+0x401c)) +#define INTPRI5 (VPint(Base_Addr+0x4020)) +#define INTOFFSET (VPint(Base_Addr+0x4024)) + +#endif diff --git a/packages/devs/eth/arm/ks32c5000/current/src/lxt970.c b/packages/devs/eth/arm/ks32c5000/current/src/lxt970.c new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/ks32c5000/current/src/lxt970.c @@ -0,0 +1,155 @@ +//========================================================================== +// +// lxt970.c +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include "std.h" +#include "phy.h" + +// address of the LX970 phy +#define LX970_ADDR 0x20 + +// LX970 register offsets +#define LX970_CNTL_REG 0x00 +#define LX970_STATUS_REG 0x01 +#define LX970_ID_REG1 0x02 +#define LX970_ID_REG2 0x03 +#define LX970_ANA_REG 0x04 +#define LX970_ANLPAR_REG 0x05 +#define LX970_ANE_REG 0x06 +#define LX970_MIRROR_REG 0x10 +#define LX970_INTEN_REG 0x11 +#define LX970_INTSTAT_REG 0x12 +#define LX970_CONFIG_REG 0x13 +#define LX970_CHIPSTAT_REG 0x14 + +// LX970 Control register bit defines +#define LX970_CNTL_RESET 0x8000 +#define LX970_CNTL_LOOPBACK 0x4000 +#define LX970_CNTL_SPEED 0x2000 // 1=100Meg, 0=10Meg +#define LX970_CNTL_AN 0x1000 // 1=Enable auto negotiation, 0=disable it +#define LX970_CNTL_PWRDN 0x0800 // 1=Enable power down +#define LX970_CNTL_ISOLATE 0x0400 // 1=Isolate from MII +#define LX970_CNTL_RSTRT_AN 0x0200 // 1=Restart Auto Negotioation process +#define LX970_CNTL_FULL_DUP 0x0100 // 1=Enable full duplex mode, 0=half dup +#define LX970_CNTL_TST_COLL 0x0080 // 1=Enable collision test + +#define Bit(n) (1<<(n)) + +#define LX970_ANA_PAUSE_ENA Bit(10) +#define LX970_ANA_100T4 Bit(9) +#define LX970_ANA_100TX_FULL Bit(8) +#define LX970_ANA_100TX Bit(7) +#define LX970_ANA_10T_FULL Bit(6) +#define LX970_ANA_10T Bit(5) +#define LX970_ANA_SEL_802_3 Bit(0) + +#define LX970_CHIPSTAT_LINKUP Bit(13) +#define LX970_CHIPSTAT_FULLDUP Bit(12) +#define LX970_CHIPSTAT_100M Bit(11) +#define LX970_CHIPSTAT_ANEG_DONE Bit(9) +#define LX970_CHIPSTAT_PAGE_RX Bit(8) +#define LX970_CHIPSTAT_LOWVOLT Bit(2) + +// phy functions for Level1 PHY LXT970 + +void PhyReset(void) +{ + // first software reset the LX970 + MiiStationWrite(LX970_CNTL_REG, LX970_ADDR, LX970_CNTL_RESET); + MiiStationWrite(LX970_CNTL_REG, LX970_ADDR, 0); + + // set low level drive for MII lines, enable interrupt output + MiiStationWrite(17, LX970_ADDR, BIT3+BIT1); + + // default values for 100M encryption are wrong, so fix them + // and configure LEDC to be activity indicator + MiiStationWrite(19, LX970_ADDR, BIT7); + + // initialize auto-negotiation capabilities + MiiStationWrite(LX970_ANA_REG,LX970_ADDR, + LX970_ANA_PAUSE_ENA+ + LX970_ANA_100T4+ + LX970_ANA_100TX_FULL+ + LX970_ANA_100TX+ + LX970_ANA_10T_FULL+ + LX970_ANA_10T+ + LX970_ANA_SEL_802_3); +#if 1 + // Now start an auto negotiation + MiiStationWrite(LX970_CNTL_REG, LX970_ADDR, + LX970_CNTL_AN+ + LX970_CNTL_RSTRT_AN); +#else + // force to 10M full duplex + MiiStationWrite(LX970_CNTL_REG, LX970_ADDR, + LX970_CNTL_FULL_DUP); +#endif +} + +unsigned PhyStatus(void) +{ + unsigned lxt970Status = MiiStationRead(LX970_CHIPSTAT_REG,LX970_ADDR); + unsigned r = 0; + if (lxt970Status & LX970_CHIPSTAT_LINKUP) + r |= PhyStatus_LinkUp; + if (lxt970Status & LX970_CHIPSTAT_FULLDUP) + r |= PhyStatus_FullDuplex; + if (lxt970Status & LX970_CHIPSTAT_100M) + r |= PhyStatus_100Mb; + return r; +} + +void PhyInterruptAck(void) +{ + MiiStationRead(1,LX970_ADDR); + MiiStationRead(18,LX970_ADDR); +} diff --git a/packages/devs/eth/arm/ks32c5000/current/src/phy.h b/packages/devs/eth/arm/ks32c5000/current/src/phy.h new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/ks32c5000/current/src/phy.h @@ -0,0 +1,68 @@ +//========================================================================== +// +// phy.h +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#if !defined(_PHY_H) +#define _PHY_H + +void MiiStationWrite(U32 RegAddr, U32 PhyAddr, U32 PhyWrData); +U32 MiiStationRead(U32 RegAddr, U32 PhyAddr); + +void PhyReset(void); +unsigned PhyStatus(void); +void PhyInterruptAck(void); + +#define PhyStatus_LinkUp 0x0001 +#define PhyStatus_FullDuplex 0x0002 +#define PhyStatus_100Mb 0x0004 + +#endif diff --git a/packages/devs/eth/arm/ks32c5000/current/src/std.h b/packages/devs/eth/arm/ks32c5000/current/src/std.h new file mode 100644 --- /dev/null +++ b/packages/devs/eth/arm/ks32c5000/current/src/std.h @@ -0,0 +1,106 @@ +#ifndef _STD_H_ +#define _STD_H_ + +#ifndef BYTE +#define BYTE unsigned char +#endif + +#ifndef WORD +#define WORD unsigned short +#endif + +#ifndef LWORD +#define LWORD unsigned long +#endif + +#ifndef DWORD +#define DWORD unsigned long +#endif + +#ifndef VLWORD +#define VLWORD volatile unsigned long +#endif + +#ifndef BOOLEAN +#define BOOLEAN BYTE +#endif + +#ifndef BOOL +#define BOOL BYTE +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef NULL +#define NULL ((void *)0) +#endif + +#define S8 signed char +#define S08 signed char +#define S16 signed short +#define S32 signed long +#define U8 unsigned char +#define U08 unsigned char +#define U16 unsigned short +#define U32 unsigned long +#define REG8 volatile unsigned char +#define REG16 volatile unsigned short +#define REG32 volatile unsigned long + +#define UINT unsigned int + +#define std_Local static +#define std_Void void + +#define STD_YES 1 +#define STD_NO 0 + +#define STD_TRUE STD_YES +#define STD_FALSE STD_NO + +#define STD_OK STD_YES +#define STD_ERROR STD_NO + +#define STD_ON STD_YES +#define STD_OFF STD_NO + +#define BIT0 0x00000001 +#define BIT1 0x00000002 +#define BIT2 0x00000004 +#define BIT3 0x00000008 +#define BIT4 0x00000010 +#define BIT5 0x00000020 +#define BIT6 0x00000040 +#define BIT7 0x00000080 +#define BIT8 0x00000100 +#define BIT9 0x00000200 +#define BIT10 0x00000400 +#define BIT11 0x00000800 +#define BIT12 0x00001000 +#define BIT13 0x00002000 +#define BIT14 0x00004000 +#define BIT15 0x00008000 +#define BIT16 0x00010000 +#define BIT17 0x00020000 +#define BIT18 0x00040000 +#define BIT19 0x00080000 +#define BIT20 0x00100000 +#define BIT21 0x00200000 +#define BIT22 0x00400000 +#define BIT23 0x00800000 +#define BIT24 0x01000000 +#define BIT25 0x02000000 +#define BIT26 0x04000000 +#define BIT27 0x08000000 +#define BIT28 0x10000000 +#define BIT29 0x20000000 +#define BIT30 0x40000000 +#define BIT31 0x80000000 + +#endif diff --git a/packages/devs/eth/arm/nano/current/ChangeLog b/packages/devs/eth/arm/nano/current/ChangeLog --- a/packages/devs/eth/arm/nano/current/ChangeLog +++ b/packages/devs/eth/arm/nano/current/ChangeLog @@ -54,27 +54,36 @@ 2001-03-01 Hugo Tyson introduced on the same date. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/devs/eth/arm/nano/current/cdl/nano_eth_drivers.cdl b/packages/devs/eth/arm/nano/current/cdl/nano_eth_drivers.cdl --- a/packages/devs/eth/arm/nano/current/cdl/nano_eth_drivers.cdl +++ b/packages/devs/eth/arm/nano/current/cdl/nano_eth_drivers.cdl @@ -6,29 +6,38 @@ # on the BSE nanoEngine board. # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/devs/eth/arm/nano/current/include/devs_eth_nano.inl b/packages/devs/eth/arm/nano/current/include/devs_eth_nano.inl --- a/packages/devs/eth/arm/nano/current/include/devs_eth_nano.inl +++ b/packages/devs/eth/arm/nano/current/include/devs_eth_nano.inl @@ -5,29 +5,38 @@ // nanoBridge ethernet I/O definitions. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/eth/cf/current/ChangeLog b/packages/devs/eth/cf/current/ChangeLog --- a/packages/devs/eth/cf/current/ChangeLog +++ b/packages/devs/eth/cf/current/ChangeLog @@ -1,3 +1,7 @@ +2002-04-12 Gary Thomas + + * src/if_sc_lpe.c: Clean up warnings. + 2001-10-16 Jesper Skov * include/devs_eth_cf.inl: Added buffer parameters. @@ -110,29 +114,38 @@ 2000-07-14 Gary Thomas #include #include -#include -#include +#include +#include #ifdef CYGPKG_NET #include @@ -302,7 +311,7 @@ cyg_sc_lpe_init(struct cyg_netdevtab_ent return false; // Device is not ready until inserted, powered up, etc. #else // Initialize card - return sc_lpe_card_handler(sc); + return sc_lpe_card_handler((cyg_addrword_t)sc); #endif } diff --git a/packages/devs/eth/cl/cs8900a/current/ChangeLog b/packages/devs/eth/cl/cs8900a/current/ChangeLog --- a/packages/devs/eth/cl/cs8900a/current/ChangeLog +++ b/packages/devs/eth/cl/cs8900a/current/ChangeLog @@ -1,3 +1,25 @@ +2002-03-20 Gary Thomas +2002-03-06 Pieter Truter + + * src/if_cs8900a.c (cs8900a_isr): Need to acknowledge interrupt + here (in case DSR/poll causes a new one to occur). + +2002-02-18 Gary Thomas + + * cdl/cl_cs8900a_eth_drivers.cdl: + Add new interface CYGINT_IO_ETH_MULTICAST which is used to + insure that drivers support multicast addresses if IPv6 is used. + +2002-02-15 Gary Thomas + + * include/cs8900.h: + * src/if_cs8900a.c (cs8900a_control): Support multicast addresses. + +2002-02-04 Gary Thomas + + * src/if_cs8900a.c: + * include/cs8900.h: Add CYGHWR_CL_CS8900A_PLF_POST_RESET() macro. + 2001-11-29 Jesper Skov * src/if_cs8900a.c (cs8900a_init): Changed order of ESA source @@ -64,27 +86,36 @@ 2001-11-02 Jesper Skov #undef __ECOS #define __ECOS -#include -#include +#include +#include #include @@ -104,6 +113,7 @@ cs8900a_isr(cyg_vector_t vector, cyg_add { cs8900a_priv_data_t* cpd = (cs8900a_priv_data_t *)data; cyg_drv_interrupt_mask(cpd->interrupt); + cyg_drv_interrupt_acknowledge(cpd->interrupt); return (CYG_ISR_HANDLED|CYG_ISR_CALL_DSR); // Run the DSR } @@ -139,7 +149,6 @@ cs8900a_deliver(struct eth_drv_sc *sc) { cs8900a_priv_data_t *cpd = (cs8900a_priv_data_t *)sc->driver_private; // Allow interrupts to happen again - cyg_drv_interrupt_acknowledge(cpd->interrupt); cyg_drv_interrupt_unmask(cpd->interrupt); } #endif @@ -212,6 +221,9 @@ cs8900a_init(struct cyg_netdevtab_entry CYGHWR_CL_CS8900A_PLF_RESET(base); put_reg(base, PP_SelfCtl, PP_SelfCtl_Reset); // Reset chip + + CYGHWR_CL_CS8900A_PLF_POST_RESET(base); + while ((get_reg(base, PP_SelfStat) & PP_SelfStat_InitD) == 0) { if (--timeout <= 0) { #if DEBUG & 8 @@ -308,8 +320,8 @@ cs8900a_start(struct eth_drv_sc *sc, cyg put_reg(base, PP_IntReg, PP_IntReg_IRQ0); // Only possibility put_reg(base, PP_RxCFG, PP_RxCFG_RxOK | PP_RxCFG_CRC | PP_RxCFG_RUNT | PP_RxCFG_EXTRA); - put_reg(base, PP_RxCTL, PP_RxCTL_RxOK | PP_RxCTL_Broadcast | - PP_RxCTL_IA); + cpd->rxmode = PP_RxCTL_RxOK | PP_RxCTL_Broadcast | PP_RxCTL_IA; + put_reg(base, PP_RxCTL, cpd->rxmode); put_reg(base, PP_TxCFG, PP_TxCFG_TxOK | PP_TxCFG_Collision | PP_TxCFG_CRS | PP_TxCFG_SQE | PP_TxCFG_Late | PP_TxCFG_Jabber | PP_TxCFG_16Collisions); @@ -329,10 +341,27 @@ cs8900a_start(struct eth_drv_sc *sc, cyg static int cs8900a_control(struct eth_drv_sc *sc, unsigned long key, void *data, int data_length) { + cs8900a_priv_data_t *cpd = (cs8900a_priv_data_t *)sc->driver_private; + cyg_addrword_t base = cpd->base; + struct eth_drv_mc_list *mc_list = data; + switch (key) { case ETH_DRV_SET_MAC_ADDRESS: return 0; break; + case ETH_DRV_SET_MC_LIST: + case ETH_DRV_SET_MC_ALL: + // Note: this code always accepts all multicast addresses if any + // are desired. It would be possible to accept a subset by adjusting + // the Logical Address Filter (LAF), but that would require scanning + // this list and building a suitable mask. + if (mc_list->len) { + cpd->rxmode |= PP_RxCTL_Multicast; + } else { + cpd->rxmode &= ~PP_RxCTL_Multicast; + } + put_reg(base, PP_RxCTL, cpd->rxmode); // When is it safe to do this? + return 0; default: return 1; break; diff --git a/packages/devs/eth/frv/frv400/current/ChangeLog b/packages/devs/eth/frv/frv400/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/frv/frv400/current/ChangeLog @@ -0,0 +1,66 @@ +2002-03-28 Gary Thomas + + * cdl/frv400_eth_drivers.cdl: Don't define CYGHWR_NET_DRIVERS as this + is done in the generic driver. + +2001-12-10 Richard Sandiford + + * include/devs_eth_frv400.inl (_frv400_eth_int_clear): Don't + unmask the interrupt after clearing it. + +2001-10-16 Gary Thomas + + * include/devs_eth_frv400.inl: Specify buffer layout (change in + generic driver requires this). + +2001-10-15 Gary Thomas + + * include/devs_eth_frv400.inl: Allow configuration to force ESA + (in case EEPROM is bad), otherwise make sure EEPROM is used to + set chip address (ESA) before use. + +2001-10-12 Gary Thomas + + * include/devs_eth_frv400.inl: Add PCI scanning for device. + (_frv400_eth_int_clear): Need explicit interrupt acknowledge. + +2001-10-10 Gary Thomas + + * include/devs_eth_frv400.inl: + * cdl/frv400_eth_drivers.cdl: New device driver for onboard LAN, + based on RTL8029s which is the same as DP8390 (NE2000). + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/frv/frv400/current/cdl/frv400_eth_drivers.cdl b/packages/devs/eth/frv/frv400/current/cdl/frv400_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/frv/frv400/current/cdl/frv400_eth_drivers.cdl @@ -0,0 +1,134 @@ +# ==================================================================== +# +# frv400_eth_drivers.cdl +# +# Ethernet drivers - support for i82559 ethernet controller +# on the Fujitsu FR-V400 +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: jskov, hmt, gthomas +# Date: 2001-02-28 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_FRV_FRV400 { + display "FRV400 ethernet driver" + description " + Ethernet drivers for Fujitsu FR-V400 board." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_PCI + requires CYGPKG_DEVS_ETH_NS_DP83902A + + implements CYGHWR_NET_DRIVER_ETH0 + include_dir cyg/io + +# compile -library=libextras.a if_frv400.c + + # FIXME: This really belongs in the NS DP83902A package + cdl_interface CYGINT_DEVS_ETH_NS_DP83902A_REQUIRED { + display "NS DP83902A ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_NS_DP83902A_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_NS_DP83902A_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_FRV400_ETH0 { + display "CF ethernet port driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for a + CF card." + + implements CYGINT_DEVS_ETH_NS_DP83902A_REQUIRED + + cdl_option CYGDAT_DEVS_ETH_FRV400_ETH0_NAME { + display "Device name for the ETH0 ethernet driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device." + } + + cdl_component CYGSEM_DEVS_ETH_FRV400_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_FRV400_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } + + cdl_component CYGPKG_DEVS_ETH_FRV400_OPTIONS { + display "PCMCIA ethernet driver build options" + flavor none + no_define + + cdl_option CYGPKG_DEVS_ETH_FRV400_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL -D__ECOS" } + description " + This option modifies the set of compiler flags for + building the PCMCIA ethernet driver package. + These flags are used in addition + to the set of global flags." + } + } +} + +# EOF frv400_eth_drivers.cdl diff --git a/packages/devs/eth/frv/frv400/current/include/devs_eth_frv400.inl b/packages/devs/eth/frv/frv400/current/include/devs_eth_frv400.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/frv/frv400/current/include/devs_eth_frv400.inl @@ -0,0 +1,228 @@ +//========================================================================== +// +// devs/eth/frv/frv400/..../include/devs_eth_frv400.inl +// +// FRV400 ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov, hmt, gthomas +// Contributors: jskov +// Date: 2001-02-28 +// Purpose: FRV400 ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR +#include +#include + +#ifdef __WANT_CONFIG + +#define CYGHWR_NS_DP83902A_PLF_RESET(_dp_) \ + CYG_MACRO_START \ + cyg_uint8 _t; \ + HAL_READ_UINT8(_dp_->reset, _t); \ + CYGACC_CALL_IF_DELAY_US(10); \ + HAL_WRITE_UINT8(_dp_->reset, _t); \ + CYGACC_CALL_IF_DELAY_US(10000); \ + CYG_MACRO_END + +#define DP_IN(_b_, _o_, _d_) \ + CYG_MACRO_START \ + HAL_READ_UINT8(((cyg_addrword_t)(_b_)+(_o_))^0x03, (_d_)); \ + CYG_MACRO_END + +#define DP_OUT(_b_, _o_, _d_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT8(((cyg_addrword_t)(_b_)+(_o_))^0x03, (_d_)); \ + CYG_MACRO_END + +#define DP_IN_DATA(_b_, _d_) \ + CYG_MACRO_START \ + HAL_READ_UINT16((cyg_addrword_t)(_b_)^0x02, (_d_)); \ + CYG_MACRO_END + +#define DP_OUT_DATA(_b_, _d_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT16((cyg_addrword_t)(_b_)^0x02, (_d_)); \ + CYG_MACRO_END + +//#define CYGHWR_NS_DP83902A_PLF_16BIT_DATA +//#define CYGHWR_NS_DP83902A_PLF_BROKEN_TX_DMA + +#endif // __WANT_CONFIG + +#ifdef __WANT_DEVS + +#if defined(CYGSEM_DEVS_ETH_FRV400_ETH0_SET_ESA) +#if defined(CYGPKG_REDBOOT) +#include +#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +#include +#include +RedBoot_config_option("Network hardware address [MAC]", + lan_esa, + ALWAYS_ENABLED, true, + CONFIG_ESA, 0 + ); +#endif // CYGSEM_REDBOOT_FLASH_CONFIG +#endif // CYGPKG_REDBOOT +#include +#ifndef CONFIG_ESA +#define CONFIG_ESA 6 +#endif +#endif + +static cyg_bool +find_rtl8029_match_func( cyg_uint16 v, cyg_uint16 d, cyg_uint32 c, void *p ) +{ + return ((v == 0x10EC) && (d == 0x8029)); +} + +static void +_frv400_eth_init(dp83902a_priv_data_t *dp) +{ + cyg_pci_device_id devid; + cyg_pci_device dev_info; +#if defined(CYGSEM_DEVS_ETH_FRV400_ETH0_SET_ESA) + cyg_bool esa_ok; + unsigned char _esa[6]; +#else + unsigned char prom[32]; + int i; +#endif + + devid = CYG_PCI_NULL_DEVID; + if (cyg_pci_find_matching( &find_rtl8029_match_func, NULL, &devid )) { + cyg_pci_get_device_info(devid, &dev_info); + cyg_pci_translate_interrupt(&dev_info, &dp->interrupt); + dp->base = (cyg_uint8 *)(dev_info.base_map[0] & ~1); + dp->data = dp->base + 0x10; + dp->reset = dp->base + 0x1F; + diag_printf("RTL8029 at %p, interrupt: %x\n", dp->base, dp->interrupt); +#if defined(CYGSEM_DEVS_ETH_FRV400_ETH0_SET_ESA) + esa_ok = CYGACC_CALL_IF_FLASH_CFG_OP(CYGNUM_CALL_IF_FLASH_CFG_GET, + "lan_esa", _esa, CONFIG_ESA); + if (esa_ok) { + memcpy(dp->esa, _esa, sizeof(_esa)); + } +#else + // Read ESA from EEPROM + DP_OUT(dp->base, DP_DCR, 0x49); // Wordwide access + DP_OUT(dp->base, DP_RBCH, 0); // Remote byte count + DP_OUT(dp->base, DP_RBCL, 0); + DP_OUT(dp->base, DP_ISR, 0xFF); // Clear any pending interrupts + DP_OUT(dp->base, DP_IMR, 0x00); // Mask all interrupts + DP_OUT(dp->base, DP_RCR, 0x20); // Monitor + DP_OUT(dp->base, DP_TCR, 0x02); // loopback + DP_OUT(dp->base, DP_RBCH, 32); // Remote byte count + DP_OUT(dp->base, DP_RBCL, 0); + DP_OUT(dp->base, DP_RSAL, 0); // Remote address + DP_OUT(dp->base, DP_RSAH, 0); + DP_OUT(dp->base, DP_CR, DP_CR_START|DP_CR_RDMA); // Read data + for (i = 0; i < 32; i++) { + cyg_uint16 _val; + HAL_READ_UINT16(dp->data, _val); + prom[i] = _val; + } + // Set ESA into chip + DP_OUT(dp->base, DP_CR, DP_CR_NODMA | DP_CR_PAGE1); // Select page 1 + for (i = 0; i < 6; i++) { + DP_OUT(dp->base, DP_P1_PAR0+i, prom[i]); + } + DP_OUT(dp->base, DP_CR, DP_CR_NODMA | DP_CR_PAGE0); // Select page 0 +#endif + } +} + +#define CYGHWR_NS_DP83902A_PLF_INIT(dp) _frv400_eth_init(dp) + +#ifndef CYGPKG_NET +static void +_frv400_eth_int_clear(dp83902a_priv_data_t *dp) +{ + cyg_drv_interrupt_acknowledge(dp->interrupt); +} + +#define CYGHWR_NS_DP83902A_PLF_INT_CLEAR(dp) _frv400_eth_int_clear(dp) +#endif + +#ifdef CYGPKG_DEVS_ETH_FRV400_ETH0 + +static dp83902a_priv_data_t dp83902a_eth0_priv_data = { + base : (cyg_uint8*) 0, // + data : (cyg_uint8*) 0, // Filled in at runtime + reset: (cyg_uint8*) 0, // + interrupt: 0, // + tx_buf1: 0x40, // + tx_buf2: 0x48, // Buffer layout - change with care + rx_buf_start: 0x50, // + rx_buf_end: 0x80, // +#ifdef CYGSEM_DEVS_ETH_FRV400_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_FRV400_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +#endif +}; + +ETH_DRV_SC(dp83902a_sc, + &dp83902a_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_FRV400_ETH0_NAME, + dp83902a_start, + dp83902a_stop, + dp83902a_control, + dp83902a_can_send, + dp83902a_send, + dp83902a_recv, + dp83902a_deliver, // "pseudoDSR" called from fast net thread + dp83902a_poll, // poll function, encapsulates ISR and DSR + dp83902a_int_vector); + +NETDEVTAB_ENTRY(dp83902a_netdev, + "dp83902a_" CYGDAT_DEVS_ETH_FRV400_ETH0_NAME, + dp83902a_init, + &dp83902a_sc); + +#endif // CYGPKG_DEVS_ETH_FRV400_ETH0 + +#endif // __WANT_DEVS + +// -------------------------------------------------------------- + +// EOF devs_eth_frv400.inl diff --git a/packages/devs/eth/h8300/aki3068net/current/ChangeLog b/packages/devs/eth/h8300/aki3068net/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/h8300/aki3068net/current/ChangeLog @@ -0,0 +1,38 @@ +2002-04-24 Yoshinori Sato + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/h8300/aki3068net/current/cdl/h8300_aki3068net_eth_drivers.cdl b/packages/devs/eth/h8300/aki3068net/current/cdl/h8300_aki3068net_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/h8300/aki3068net/current/cdl/h8300_aki3068net_eth_drivers.cdl @@ -0,0 +1,131 @@ +# ==================================================================== +# +# h8300_aki3068net_eth_drivers.cdl +# +# Ethernet drivers - support for DP83902A(RTL8019AS) +# ethernet controller on the Akizuki H8/3068 Network micom. +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): +# Contributors: +# Date: +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_H8300_AKI3068NET { + display "aki3068net board ethernet driver" + description " + Ethernet driver for Akizuki + H8/3068 Netwotk Micom board" + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_H8300_H8300H_AKI3068NET + compile -library=libextras.a if_aki3068net.c + + include_dir cyg/io + + # FIXME: This really belongs in the NS DP83902A package + cdl_interface CYGINT_DEVS_ETH_NS_DP83902A_REQUIRED { + display "NS dp83902a ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_NS_DP83902A_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_NS_DP83902A_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_H8300_AKI3068NET_ETH0 { + display "Ethernet port 0 driver" + flavor bool + default_value 1 + + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + + implements CYGINT_DEVS_ETH_NS_DP83902A_REQUIRED + + cdl_option CYGDAT_DEVS_ETH_H8300_AKI3068NET_ETH0_NAME { + display "Device name for the ETH0 ethernet port 0 driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + RTL8019AS ethernet port 0." + } + + cdl_component CYGSEM_DEVS_ETH_H8300_AKI3068NET_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_H8300_AKI3068NET_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x00, 0x00, 0x00, 0x00, 0x01}"} + description "The ethernet station address" + } + } + } + + cdl_component CYGPKG_DEVS_ETH_H8300_AKI3068NET_OPTIONS { + display "PCMCIA ethernet driver build options" + flavor none + no_define + + cdl_option CYGPKG_DEVS_ETH_CF_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL -D__ECOS" } + description " + This option modifies the set of compiler flags for + building the PCMCIA ethernet driver package. + These flags are used in addition + to the set of global flags." + } + } +} diff --git a/packages/devs/eth/h8300/aki3068net/current/include/devs_eth_h8300_aki3068net.inl b/packages/devs/eth/h8300/aki3068net/current/include/devs_eth_h8300_aki3068net.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/h8300/aki3068net/current/include/devs_eth_h8300_aki3068net.inl @@ -0,0 +1,96 @@ +//========================================================================== +// +// devs_eth_h8300_aki3068net.inl +// +// DP83902(RTL8019AS) ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): +// Contributors: +// Date: +// Purpose: aki3068net ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR + + +#define CYGHWR_NS_DP83902A_PLF_INIT ns_dp83902a_plf_init + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_H8300_AKI3068NET_ETH0 + +static dp83902a_priv_data_t dp83902a_eth0_priv_data = { + base: 0x200000, + interrupt: 16, + tx_buf1: 0x40, + tx_buf2: 0x48, + rx_buf_start: 0x50, + rx_buf_end: 0x80, +#ifdef CYGSEM_DEVS_ETH_H8300_AKI3068NET_ETH0_SET_ESA + hardwired_esa: true, + mac_address: CYGDAT_DEVS_ETH_H8300_AKI3068NET_ETH0_ESA +#else + hardwired_esa: false, +#endif +}; + +ETH_DRV_SC(dp83902a_sc, + &dp83902a_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_H8300_AKI3068NET_ETH0_NAME, + dp83902a_start, + dp83902a_stop, + dp83902a_control, + dp83902a_can_send, + dp83902a_send, + dp83902a_recv, + dp83902a_deliver, // "pseudoDSR" called from fast net thread + dp83902a_poll, // poll function, encapsulates ISR and DSR + dp83902a_int_vector); + +NETDEVTAB_ENTRY(dp83902a_netdev, + "dp83902a_" CYGDAT_DEVS_ETH_H8300_AKI3068NET_ETH0_NAME, + dp83902a_init, + &dp83902a_sc); + +void ns_dp83902a_plf_init(dp83902a_priv_data_t *dp); + +#endif // CYGPKG_DEVS_ETH_H8300_AKI3068NET_ETH0 +#endif +// EOF devs_eth_h8300_aki3068net.inl diff --git a/packages/devs/eth/h8300/aki3068net/current/src/if_aki3068net.c b/packages/devs/eth/h8300/aki3068net/current/src/if_aki3068net.c new file mode 100644 --- /dev/null +++ b/packages/devs/eth/h8300/aki3068net/current/src/if_aki3068net.c @@ -0,0 +1,129 @@ +//========================================================================== +// +// if_aki3068net.c +// +// Ethernet device driver for Akizuki H8/3068 Netwotk micom +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): +// Contributors: +// Date: +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include +#include +#include +#include +#include + +#ifdef CYGPKG_NET +#include +#else +#include +#endif + +#define DP_CARD_RESET 0x1f + +#include + +void ns_dp83902a_plf_init(dp83902a_priv_data_t *dp) +{ + static struct { + unsigned short offset; + unsigned short data; + } init_data[] = { + {DP_DCR, 0x48}, // Bytewide access + {DP_RBCH, 0}, // Remote byte count + {DP_RBCL, 0}, + {DP_ISR, 0xFF}, // Clear any pending interrupts + {DP_IMR, 0x00}, // Mask all interrupts + {DP_RCR, 0x20}, // Monitor + {DP_TCR, 0x02}, // loopback + {DP_RBCH, 32}, // Remote byte count + {DP_RBCL, 0}, + {DP_RSAL, 0}, // Remote address + {DP_RSAH, 0}, + {DP_CR, DP_CR_START|DP_CR_RDMA} // Read data + }; + unsigned char prom[32]; + int cnt,tmp; + + HAL_READ_UINT8(dp->base+DP_CARD_RESET, tmp); + HAL_WRITE_UINT8(dp->base+DP_CARD_RESET, tmp); + dp->data = dp->base+DP_DATAPORT; + // Wait for card + do { + int cnt; + DP_IN(dp->base, DP_ISR, tmp); + for (cnt=0; cnt< 1024; cnt++); + } while (0 == (tmp & DP_ISR_RESET)); + + if (dp->hardwired_esa) + return ; + + for (cnt=0; cntbase, init_data[cnt].offset, init_data[cnt].data); + for (cnt = 0; cnt < 32; cnt++) + DP_IN_DATA(dp->data, prom[cnt]); + if ((prom[0] == 0xff) && (prom[2] == 0xff) && (prom[4] == 0xff)) { + dp->base = 0; + return ; + } + DP_OUT(dp->base, DP_CR, DP_CR_NODMA | DP_CR_PAGE1); + for (cnt = 0; cnt < 6; cnt ++) { + DP_OUT(dp->base, DP_P1_PAR0+cnt, prom[cnt*2]); + } +} diff --git a/packages/devs/eth/i386/pc/i82544/current/ChangeLog b/packages/devs/eth/i386/pc/i82544/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/i386/pc/i82544/current/ChangeLog @@ -0,0 +1,41 @@ +2001-11-27 Nick Garnett + + * include/devs_eth_i386_pc_i82544.inl: + * cdl/i386_pc_i82544_eth_drivers.cdl: + Platform specific configury and definitions to use the generic + i82543/i82544 driver for PC platforms. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/i386/pc/i82544/current/cdl/i386_pc_i82544_eth_drivers.cdl b/packages/devs/eth/i386/pc/i82544/current/cdl/i386_pc_i82544_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/i386/pc/i82544/current/cdl/i386_pc_i82544_eth_drivers.cdl @@ -0,0 +1,109 @@ +# ==================================================================== +# +# i386_pc_eth_drivers.cdl +# +# Ethernet drivers - support for i82544 ethernet controller +# on the PC. +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov, nickg +# Contributors: jskov +# Date: 2001-11-25 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_I386_PC_I82544 { + display "PC board ethernet driver" + description "Ethernet driver for PC." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_I386_PC + + include_dir cyg/io + + # FIXME: This really belongs in the INTEL_I82544 package + cdl_interface CYGINT_DEVS_ETH_INTEL_I82544_REQUIRED { + display "Intel i82544 ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_INTEL_I82544_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_INTEL_I82544_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_I386_PC_I82544_ETH0 { + display "Ethernet port 0 driver" + flavor bool + default_value 1 + + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_INTEL_I82544_REQUIRED + + cdl_option CYGDAT_DEVS_ETH_I386_PC_I82544_ETH0_NAME { + display "Device name for the ETH0 ethernet port 0 driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + i82544 ethernet port 0." + } + + cdl_component CYGSEM_DEVS_ETH_I386_PC_I82544_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_I386_PC_I82544_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x00, 0x00, 0x00, 0x00, 0x01}"} + description "The ethernet station address" + } + } + } +} diff --git a/packages/devs/eth/i386/pc/i82544/current/include/devs_eth_i386_pc_i82544.inl b/packages/devs/eth/i386/pc/i82544/current/include/devs_eth_i386_pc_i82544.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/i386/pc/i82544/current/include/devs_eth_i386_pc_i82544.inl @@ -0,0 +1,113 @@ +//========================================================================== +// +// devs/eth/mips/ocelot/include/devs_eth_mips_rm7000_ocelot.inl +// +// PC i82544 ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov, nickg +// Contributors:jskov +// Date: 2001-11-25 +// Purpose: PC i82544 ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR + +#ifdef CYGPKG_DEVS_ETH_I386_PC_I82544_ETH0 + +#define CYGHWR_INTEL_I82544_PCI_MEM_MAP_BASE (CYGARC_UNCACHED_ADDRESS(CYGMEM_SECTION_pci_window)) +#define CYGHWR_INTEL_I82544_PCI_MEM_MAP_SIZE CYGMEM_SECTION_pci_window_SIZE + +static I82544 i82544_eth0_priv_data = { +#ifdef CYGSEM_DEVS_ETH_I386_PC_I82544_ETH0_SET_ESA + hardwired_esa: 1, + mac_address: CYGDAT_DEVS_ETH_I386_PC_I82544_ETH0_ESA +#else + hardwired_esa: 0, +#endif +}; + +ETH_DRV_SC(i82544_sc0, + &i82544_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_I386_PC_I82544_ETH0_NAME, // Name for device + i82544_start, + i82544_stop, + i82544_ioctl, + i82544_can_send, + i82544_send, + i82544_recv, + i82544_deliver, + i82544_poll, + i82544_int_vector + ); + +NETDEVTAB_ENTRY(i82544_netdev0, + "i82544_" CYGDAT_DEVS_ETH_I386_PC_I82544_ETH0_NAME, + i82544_init, + &i82544_sc0); + +#endif // CYGPKG_DEVS_ETH_I386_PC_I82544_ETH0 + + +// These arrays are used for sanity checking of pointers +I82544 * +i82544_priv_array[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_I386_PC_I82544_ETH0 + &i82544_eth0_priv_data, +#endif +}; + +#ifdef CYGDBG_USE_ASSERTS +// These are only used when assertions are enabled +cyg_netdevtab_entry_t * +i82544_netdev_array[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_I386_PC_I82544_ETH0 + &i82544_netdev0, +#endif +}; + +struct eth_drv_sc * +i82544_sc_array[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_I386_PC_I82544_ETH0 + &i82544_sc0, +#endif +}; +#endif // CYGDBG_USE_ASSERTS + +// EOF devs_eth_i386_pc_i82544.inl diff --git a/packages/devs/eth/i386/pc/i82559/current/ChangeLog b/packages/devs/eth/i386/pc/i82559/current/ChangeLog --- a/packages/devs/eth/i386/pc/i82559/current/ChangeLog +++ b/packages/devs/eth/i386/pc/i82559/current/ChangeLog @@ -11,27 +11,36 @@ 2001-03-06 Nick Garnett + + * src/if_i21143.c (MII_DELAY): Greatly reduce this, now it's + working, so that we can poll for link status changes. I don't see + any other way to do this, since we would not necessarily be + transmitting (to get a link fail code) when a person re-plugs the + line. + (i21143_status_changed): New function; a quicker test for + negotiated line status changed. Polled from the deliver routine. + +2001-10-05 Hugo Tyson + + * src/if_i21143.c (i21143_ioctl): Implement SNMP statistics. + (i21143_can_send): Enable the "unsticking" poll of tx and rx + states; it seems not necessary, but it's also definitely not + harmful. + (generally): manage getting the link status better; it takes time + so cache the answer. Reset the system if it changed between + _stop() and _start(). + +2001-10-04 Hugo Tyson + + * src/if_i21143.c (i21143_reset): Set the "store and forward" bit + so that we can keep up with large transmits at 100Mbit. Otherwise + it underflows for packets of 700 bytes or so. + +2001-10-04 Hugo Tyson + + * src/if_i21143.c: Got ESA filtering set up OK by using perfect + filtering instead, with all the broadcast address except one with + our true ESA. Various changes to the debug printing too. + +2001-09-28 Hugo Tyson + + * src/if_i21143.c (i21143_init): Read the good ESA (MAC address) + from the serial EEPROM (or ROM) and use it if valid. + +2001-09-28 Hugo Tyson + + * src/if_i21143.c: Duh. Fix dangerously aliased local variable. + Having a thing like int fred[0] on the stack tends to screw up + other random variables. + +2001-09-27 Hugo Tyson + + * cdl/intel_i21143_eth_drivers.cdl: New file. + + * src/if_i21143.c: New file. Not working yet. + Reception only occurs if "Receive All" CSR_OPMODE_RA is set. + No transmission occurs to the wire though the machinery all works + beautifully. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + + + diff --git a/packages/devs/eth/intel/i21143/current/cdl/intel_i21143_eth_drivers.cdl b/packages/devs/eth/intel/i21143/current/cdl/intel_i21143_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/intel/i21143/current/cdl/intel_i21143_eth_drivers.cdl @@ -0,0 +1,102 @@ +# ==================================================================== +# +# intel_i21143_eth_drivers.cdl +# +# Intel 21143 ethernet driver +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): hmt +# Original data: +# Contributors: +# Date: 2000-09-17 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_INTEL_I21143 { + display "Intel 21143 ethernet driver" + description "Ethernet driver for Intel 21143 controller." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGINT_DEVS_ETH_INTEL_I21143_REQUIRED + + include_dir cyg/devs/eth + + compile -library=libextras.a if_i21143.c + + cdl_option CYGDBG_DEVS_ETH_INTEL_I21143_CHATTER { + display "Prints ethernet device status info during startup" + default_value 0 + description " + The ethernet device initialization code can print lots of info + to confirm that it has found the devices on the PCI bus, read + the MAC address from EEPROM correctly, and so on, and also + displays the mode (10/100MHz, half/full duplex) of the + connection." + } + + cdl_option CYGNUM_DEVS_ETH_INTEL_I21143_DEV_COUNT { + display "Number of supported interfaces." + calculated { CYGINT_DEVS_ETH_INTEL_I21143_REQUIRED } + flavor data + description " + This option selects the number of PCI ethernet interfaces to + be supported by the driver." + } + + cdl_component CYGPKG_DEVS_ETH_INTEL_I21143_OPTIONS { + display "Intel 21143 ethernet driver build options" + flavor none + no_define + + cdl_option CYGPKG_DEVS_ETH_INTEL_I21143_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL -D__ECOS" } + description " + This option modifies the set of compiler flags for + building the Intel 21143 ethernet driver + package. These flags are used in addition to the set of + global flags." + } + } +} +# EOF intel_i21143_eth_drivers.cdl diff --git a/packages/devs/eth/intel/i21143/current/src/if_i21143.c b/packages/devs/eth/intel/i21143/current/src/if_i21143.c new file mode 100644 --- /dev/null +++ b/packages/devs/eth/intel/i21143/current/src/if_i21143.c @@ -0,0 +1,2855 @@ +//========================================================================== +// +// if_i21143.c +// +// Intel 21143 ethernet driver +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or +// other sources, and are covered by the appropriate copyright +// disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: +// Date: 2000-09-17 +// Purpose: +// Description: hardware driver for 21143 Intel PRO/100+ ethernet +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#ifdef CYGPKG_IO_ETH_DRIVERS +#include +#endif +#include + +// Config for the instantiating package: +#include CYGDAT_DEVS_ETH_INTEL_I21143_CFG + +#include +#include +#include +#include +#include // HAL_DCACHE_STORE +#include +#include +#include +#include +#include + +#ifdef CYGPKG_NET +#include +#include /* Needed for struct ifnet */ +#endif + +#ifdef CYGPKG_IO_PCI +#include +#include CYGHWR_MEMORY_LAYOUT_H +#else +#error "Need PCI package here" +#endif + +// ------------------------------------------------------------------------ +// Exported statistics and the like +// defined in - already included. + +#define KEEP_STATISTICS + +#ifdef KEEP_STATISTICS +# define INCR_STAT( _x_ ) (p_i21143->stats. _x_ ++) +#else +# define INCR_STAT( _x_ ) CYG_EMPTY_STATEMENT +#endif + +// ------------------------------------------------------------------------ +// +// DEVICES AND PACKET QUEUES +// +// ------------------------------------------------------------------------ + +#define RX_DESCRIPTORS (4) // 4 packets. +#define RX_BUFFERS RX_DESCRIPTORS +#define TX_DESCRIPTORS MAX_ETH_DRV_SG // Enough for one tx, even if fragmented + +#define MAX_RX_PACKET_SIZE 1536 // maximum Rx packet size +#define MAX_TX_PACKET_SIZE 1536 // maximum Tx packet size + +// ------------------------------------------------------------------------ + +typedef struct buffer_descriptor { + volatile cyg_uint32 des0; + volatile cyg_uint32 des1; + volatile cyg_uint32 buf1; + volatile cyg_uint32 buf2; +} BUFDES; + + +typedef struct i21143 { + cyg_uint8 // (split up for atomic byte access) + found:1, // was hardware discovered? + mac_addr_ok:1, // can we bring up? + active:1, // has this if been brung up? + hardwired_esa:1, // set if ESA is hardwired via CDL + spare1:4; + cyg_uint8 tx_endbuf; // transmit in progress flag too +#define NO_TX_IN_PROGRESS (255) + cyg_uint8 index; // 0 or 1 or whatever + cyg_uint8 line_status; // line status when last inspected + cyg_uint32 devid; // PCI device id + cyg_uint32 io_address; // memory mapped I/O address + cyg_uint8 mac_address[6]; // mac (hardware) address + cyg_uint16 phy_autoneg_remote; // remote link status cache + void *ndp; // Network Device Pointer + + int next_rx_descriptor; // descriptor index for buffers + volatile BUFDES *rx_ring; // location of Rx descriptors + + volatile BUFDES *tx_ring; // location of Tx descriptors + unsigned long tx_keys[1]; // keys for tx q management + + // Interrupt handling stuff + cyg_vector_t vector; // interrupt vector + cyg_handle_t interrupt_handle; // handle for int.handler + cyg_interrupt interrupt_object; + + // Refer to following items only though uncached addresses from the + // tx_ring and rxring pointers: + volatile BUFDES _tx[TX_DESCRIPTORS]; + volatile BUFDES _rx[RX_DESCRIPTORS]; + + cyg_uint8 _rxbufs[ RX_BUFFERS ] [ MAX_RX_PACKET_SIZE ] ; + +#ifdef KEEP_STATISTICS + struct stats { + unsigned int tx_good; + unsigned int tx_max_collisions; + unsigned int tx_late_collisions; + unsigned int tx_underrun; + unsigned int tx_carrier_loss; + unsigned int tx_deferred; + unsigned int tx_sqetesterrors; + unsigned int tx_single_collisions; + unsigned int tx_mult_collisions; + unsigned int tx_total_collisions; + + unsigned int rx_good; + unsigned int rx_crc_errors; + unsigned int rx_align_errors; + unsigned int rx_resource_errors; +// unsigned int rx_overrun_errors; + unsigned int rx_collisions; + unsigned int rx_short_frames; + unsigned int rx_too_long_frames; + unsigned int rx_symbol_errors; + + unsigned int interrupts; + unsigned int rx_count; + unsigned int rx_deliver; + unsigned int rx_resource; + unsigned int rx_restart; + + unsigned int tx_count; + unsigned int tx_complete; + unsigned int tx_dropped; + } stats; +#endif // KEEP_STATISTICS +} I21143; + +// ------------------------------------------------------------------------ +// After defining that, now we can instantiate the device(s): + + +#include CYGDAT_DEVS_ETH_INTEL_I21143_INL + +// ------------------------------------------------------------------------ +// Access to cached/uncached/physical memory, to map from CPU-view +// addresses to PCI-bus master's view - however that is: +// +// We'll use these macros, so that different platforms can define them +// externally: +// o CYGHWR_PCI_VIRT_TO_BUS( x ) +// - address for the PCI device to use +// o CYGHWR_CACHED_TO_UNCACHED( x ) +// - access to memory that the PCI device will look at +// o CYGHWR_BUS_TO_UNCACHED( x ) +// - back from an address in the PCI structures to one for us to look at +// to see what it said. + +#ifndef CYGHWR_PCI_VIRT_TO_BUS +# ifdef CYGARC_PHYSICAL_ADDRESS +# define CYGHWR_PCI_VIRT_TO_BUS( _x_ ) CYGARC_PHYSICAL_ADDRESS( (_x_) ) +# else +# error No CYGHWR_PCI_VIRT_TO_BUS() defined! +//#define CYGHWR_PCI_VIRT_TO_BUS( _x_ ) (_x_) +# endif +#endif + +#ifndef CYGHWR_CACHED_TO_UNCACHED +# ifdef CYGARC_UNCACHED_ADDRESS +# define CYGHWR_CACHED_TO_UNCACHED( _x_ ) CYGARC_UNCACHED_ADDRESS( (_x_) ) +# else +# define CYGHWR_CACHED_TO_UNCACHED( _x_ ) (_x_) +# endif +#endif + +#ifndef CYGHWR_BUS_TO_UNCACHED +# ifdef CYGARC_UNCACHED_ADDRESS +# define CYGHWR_BUS_TO_UNCACHED( _x_ ) CYGARC_UNCACHED_ADDRESS( (_x_) ) +# else +# define CYGHWR_BUS_TO_UNCACHED( _x_ ) (_x_) +# endif +#endif + +// ------------------------------------------------------------------------ +// Prototypes and declarations + +static int pci_init_find_21143s( void ); +static int i21143_configure(struct i21143* p_i21143, int promisc); +static void i21143_reset(struct i21143* p_i21143); +static void InitTxRing(struct i21143* p_i21143); +static void InitRxRing(struct i21143* p_i21143); +static void eth_set_mac_address( struct i21143* p_i21143, cyg_uint8 *addr ); + +static void mii_write_register( int ioaddr, int regnum, int value ); +static int mii_read_register( int ioaddr, int regnum ); + +static int get_eeprom_size( int ioaddr ); +static int read_eeprom_word( int ioaddr, int addrbits, int address ); + +// ------------------------------------------------------------------------ +// +// 21143 GENERAL STATUS REGISTER +// +// ------------------------------------------------------------------------ +#define GEN_STATUS_FDX 0x04 // 1 = full duplex, 0 = half +#define GEN_STATUS_100MBPS 0x02 // 1 = 100 Mbps, 0 = 10 Mbps +#define GEN_STATUS_LINK 0x01 // 1 = link up, 0 = link down + +// returns status in terms of the above: +static int i21143_status( struct i21143* p_i21143 ); + +// A cheap check for changes: true if changed, is all: +static int i21143_status_changed( struct i21143* p_i21143 ); + +// ------------------------------------------------------------------------ + +#define CYGDAT_DEVS_ETH_DESCRIPTION "Intel i21143 10/100 Ethernet [DEC]" + +#define ETH_DEV_DOT3STATSETHERCHIPSET 1,3,6,1,2,1,10,7,8,2,5 + +// ------------------------------------------------------------------------ + +#ifdef CYGDBG_DEVS_ETH_INTEL_I21143_CHATTER +#define nDEBUG_TRAFFIC // This one prints stuff as packets come and go +#define DEBUG // Startup printing mainly +#define nDEBUG_EE // Some EEPROM specific retries &c +#define nDEBUG_TRAFFIC_TXDETAILS // tx bufs layout +#define nDEBUG_DUMP_REGS +#define nDEBUG_MAC +#define nDEBUG_STARTSTOPRESET +#endif + +// ------------------------------------------------------------------------ +// I/O access macros as inlines for type safety + +#if (CYG_BYTEORDER == CYG_MSBFIRST) + +#define HAL_CTOLE32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) >> 24) & 0xff)) +#define HAL_LE32TOC(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) >> 24) & 0xff)) + +#define HAL_CTOLE16(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8)) +#define HAL_LE16TOC(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8)) + +//static inline void OUTB(cyg_uint8 value, cyg_uint32 io_address) +//{ +// HAL_WRITE_UINT8( io_address, value); +//} +// +//static inline void OUTW(cyg_uint16 value, cyg_uint32 io_address) +//{ +// HAL_WRITE_UINT16( io_address, (((value & 0xff) << 8) | ((value & 0xff00) >> 8)) ); +//} + +static inline void OUTL(cyg_uint32 value, cyg_uint32 io_address) +{ + HAL_WRITE_UINT32( io_address, + ((((value) & 0xff) << 24) | (((value) & 0xff00) << 8) | (((value) & 0xff0000) >> 8) | (((value) >> 24) & 0xff)) ); +} + +//static inline cyg_uint8 INB(cyg_uint32 io_address) +//{ +// cyg_uint8 d; +// HAL_READ_UINT8( io_address, d ); +// return d; +//} +// +//static inline cyg_uint16 INW(cyg_uint32 io_address) +//{ +// cyg_uint16 d; +// HAL_READ_UINT16( io_address, d ); +// return (((d & 0xff) << 8) | ((d & 0xff00) >> 8)); +//} + +static inline cyg_uint32 INL(cyg_uint32 io_address) +{ + cyg_uint32 d; + HAL_READ_UINT32( io_address, d ); + return ((((d) & 0xff) << 24) | (((d) & 0xff00) << 8) | (((d) & 0xff0000) >> 8) | (((d) >> 24) & 0xff)); +} +#else + +// Maintaining the same styleee as above... +#define HAL_CTOLE32(x) ((((x)))) +#define HAL_LE32TOC(x) ((((x)))) + +#define HAL_CTOLE16(x) ((((x)))) +#define HAL_LE16TOC(x) ((((x)))) + +//static inline void OUTB(cyg_uint8 value, cyg_uint32 io_address) +//{ HAL_WRITE_UINT8( io_address, value ); } +// +//static inline void OUTW(cyg_uint16 value, cyg_uint32 io_address) +//{ HAL_WRITE_UINT16( io_address, value ); } + +static inline void OUTL(cyg_uint32 value, cyg_uint32 io_address) +{ HAL_WRITE_UINT32( io_address, value ); } + +//static inline cyg_uint8 INB(cyg_uint32 io_address) +// { cyg_uint8 _t_; HAL_READ_UINT8( io_address, _t_ ); return _t_; } +// +//static inline cyg_uint16 INW(cyg_uint32 io_address) +// { cyg_uint16 _t_; HAL_READ_UINT16( io_address, _t_ ); return _t_; } + +static inline cyg_uint32 INL(cyg_uint32 io_address) + { cyg_uint32 _t_; HAL_READ_UINT32( io_address, _t_ ); return _t_; } + +#endif // byteorder + +// ------------------------------------------------------------------------ + +static inline void udelay(int delay) +{ + CYGACC_CALL_IF_DELAY_US(delay); +} + +// ------------------------------------------------------------------------ +#ifdef DEBUG_DUMP_REGS +#define MII 1 +#define ETH 2 +#define BOTH 3 +void debug_dump_regs( cyg_uint32 ioaddr, int which ) +{ + int i; + + if ( MII & which ) + for ( i = 0; i <= 0x19 ; i++ ) { + int v; + if ( 0x08 == i ) i = 0x10; + v = mii_read_register( ioaddr, i ); + diag_printf( "MII/PHY register %2x%c = %04x\n", i, 'h', v ); + } + if ( ETH & which ) + for ( i = 0; i < 16; i++ ) { + cyg_uint32 v; + v = INL( (ioaddr + (i << 3)) ); + diag_printf( "21143 register CSR%2d (at %2x%c) = %08x\n", i, (i << 3), 'h', v ); + } +} +#endif +// ------------------------------------------------------------------------ +// +// REGISTERS (CSRs) and THEIR BITS +// +// ------------------------------------------------------------------------ + +// All registers are 32bit entities on 64bit boundaries. + +#define CSR0 (ioaddr + ( 0 << 3)) +#define CSR1 (ioaddr + ( 1 << 3)) +#define CSR2 (ioaddr + ( 2 << 3)) +#define CSR3 (ioaddr + ( 3 << 3)) +#define CSR4 (ioaddr + ( 4 << 3)) +#define CSR5 (ioaddr + ( 5 << 3)) +#define CSR6 (ioaddr + ( 6 << 3)) +#define CSR7 (ioaddr + ( 7 << 3)) +#define CSR8 (ioaddr + ( 8 << 3)) +#define CSR9 (ioaddr + ( 9 << 3)) +#define CSR10 (ioaddr + (10 << 3)) +#define CSR11 (ioaddr + (11 << 3)) +#define CSR12 (ioaddr + (12 << 3)) +#define CSR13 (ioaddr + (13 << 3)) +#define CSR14 (ioaddr + (14 << 3)) +#define CSR15 (ioaddr + (15 << 3)) + +#define CSR1_PM CSR1 +#define CSR2_PM CSR2 + +#define CSR_BUSMODE CSR0 +#define CSR_TXPOLL CSR1 +#define CSR_RXPOLL CSR2 +#define CSR_RXBASE CSR3 +#define CSR_TXBASE CSR4 +#define CSR_STATUS CSR5 +#define CSR_OPMODE CSR6 +#define CSR_INTR_ENABLE CSR7 +#define CSR_MISS_OFL_COUNT CSR8 +#define CSR_ROM_MII_MGT CSR9 +#define CSR_ROM_PGM_ADDR CSR10 +#define CSR_INTR_MITIGATION CSR11 +#define CSR_SIA_STATUS CSR12 +#define CSR_SIA_CONN CSR13 +#define CSR_SIA_TXRX CSR14 +#define CSR_SIA_GPPORT CSR15 + +#define CSR_WUFILTER CSR1_PM +#define CSR_WUEVENTS CSR2_PM + +// -------- BUSMODE +#define CSR_BUSMODE_PM (1<<26) +#define CSR_BUSMODE_WIE (1<<24) +#define CSR_BUSMODE_RLE (1<<23) +#define CSR_BUSMODE_RME (1<<21) +#define CSR_BUSMODE_DBO_BE (1<<20) +#define CSR_BUSMODE_DBO_LE ( 0 ) +#define CSR_BUSMODE_TAP_SHIFT (17) +#define CSR_BUSMODE_CAL_SHIFT (14) +#define CSR_BUSMODE_PBL_SHIFT ( 8) +#define CSR_BUSMODE_ENDIAN_BE (1<< 7) +#define CSR_BUSMODE_ENDIAN_LE ( 0 ) +#define CSR_BUSMODE_DSL_SHIFT ( 2) +#define CSR_BUSMODE_BAR (1<< 1) +#define CSR_BUSMODE_RESET (1<< 0) + +// -------- STATUS +#define CSR_STATUS_LC (1<<27) +#define CSR_STATUS_GPI (1<<26) +#define CSR_STATUS_EB (7 << 23) + +#define CSR_STATUS_TXSTATUS (7 << 20) +#define CSR_STATUS_TXSTATUS_STOPPED (0 << 20) +#define CSR_STATUS_TXSTATUS_SUSPENDED (6 << 20) + +#define CSR_STATUS_RXSTATUS (7 << 17) +#define CSR_STATUS_RXSTATUS_STOPPED (0 << 17) +#define CSR_STATUS_RXSTATUS_SUSPENDED (4 << 17) + +#define CSR_STATUS_NIS (1<<16) +#define CSR_STATUS_AIS (1<<15) +#define CSR_STATUS_ERI (1<<14) +#define CSR_STATUS_FBE (1<<13) +#define CSR_STATUS_LNF (1<<12) +#define CSR_STATUS_GTE (1<<11) +#define CSR_STATUS_ETI (1<<10) +#define CSR_STATUS_RWT (1<< 9) +#define CSR_STATUS_RX_STOPPED (1<< 8) +#define CSR_STATUS_RBU (1<< 7) +#define CSR_STATUS_RX_INTR (1<< 6) +#define CSR_STATUS_UNF (1<< 5) +#define CSR_STATUS_LNP_ANC (1<< 4) +#define CSR_STATUS_TJT (1<< 3) +#define CSR_STATUS_TBU (1<< 2) +#define CSR_STATUS_TX_STOPPED (1<< 1) +#define CSR_STATUS_TX_INTR (1<< 0) + +// -------- OPMODE + +#define CSR_OPMODE_SC (1<<31) +#define CSR_OPMODE_RA (1<<30) +#define CSR_OPMODE_IGNOREMSB (1<<26) +#define CSR_OPMODE_MUST_BE_ONE (1<<25) +#define CSR_OPMODE_SCR (1<<24) +#define CSR_OPMODE_PCS (1<<23) +#define CSR_OPMODE_TTM (1<<22) +#define CSR_OPMODE_SF (1<<21) +#define CSR_OPMODE_HBD (1<<19) +#define CSR_OPMODE_PS (1<<18) +#define CSR_OPMODE_PS_MIISYM (1<<18) +#define CSR_OPMODE_CA (1<<17) +#define CSR_OPMODE_TX_THRES_SHIFT (14) +#define CSR_OPMODE_TX_START (1<<13) +#define CSR_OPMODE_FC (1<<12) +#define CSR_OPMODE_LOOPBACK_SHIFT (10) +#define CSR_OPMODE_FD (1<< 9) +#define CSR_OPMODE_MULTICAST (1<< 7) +#define CSR_OPMODE_PROMISC (1<< 6) +#define CSR_OPMODE_SB (1<< 5) +#define CSR_OPMODE_IF (1<< 4) +#define CSR_OPMODE_PB (1<< 3) +#define CSR_OPMODE_HO (1<< 2) +#define CSR_OPMODE_RX_START (1<< 1) +#define CSR_OPMODE_HP (1<< 0) + +// -------- INTR_ENABLE +// uses the same bits as STATUS, hurrah! + +// -------- MISS_OFL_COUNT +#define CSR_MISS_OFL_COUNT_NO_RXBUFS_MASK (0x0001ffff) +#define CSR_MISS_OFL_COUNT_NO_RXBUFS_SHIFT ( 0) +#define CSR_MISS_OFL_COUNT_NO_RXFIFO_MASK (0x1ffe0000) +#define CSR_MISS_OFL_COUNT_NO_RXFIFO_SHIFT (17) + +// -------- ROM_MII_MGT +#define CSR_ROM_MII_MGT_MDI (1<<19) +#define CSR_ROM_MII_MGT_MOM (1<<18) +#define CSR_ROM_MII_MGT_MOM_READ (1<<18) +#define CSR_ROM_MII_MGT_MDO (1<<17) +#define CSR_ROM_MII_MGT_MDC (1<<16) +#define CSR_ROM_MII_MGT_RD (1<<14) +#define CSR_ROM_MII_MGT_WR (1<<13) +#define CSR_ROM_MII_MGT_BR (1<<12) +#define CSR_ROM_MII_MGT_SR (1<<11) +#define CSR_ROM_MII_MGT_REG (1<<10) +#define CSR_ROM_MII_MGT_SR_DO (1<< 3) +#define CSR_ROM_MII_MGT_SR_DI (1<< 2) +#define CSR_ROM_MII_MGT_SR_CK (1<< 1) +#define CSR_ROM_MII_MGT_SR_CS (1<< 0) + +#define CSR_ROM_MII_MGT_DATA (0xff) + +// -------- SIA defaults +#define CSR_SIA_CONN_DEFAULT (0) +#define CSR_SIA_TXRX_DEFAULT (0) +#define CSR_SIA_GPPORT_DEFAULT (8) + +// ------------------------------------------------------------------------ +// +// RECEIVE/TRANSMIT FRAME DESCRIPTORS +// +// ------------------------------------------------------------------------ + + +//#if (CYG_BYTEORDER == CYG_MSBFIRST) + +// Common to both Rx and Tx DES0 +#define DES0_STATUS_OWN (1<<31) +#define DES0_STATUS_OWN_DONE (0<<31) +#define DES0_STATUS_OWN_OPEN (1<<31) + +#define DES0_STATUS_ERROR (1<<15) + +// Rx specific results: +#define RDES0_STATUS_FF (1<<30) +#define RDES0_STATUS_DE (1<<14) +#define RDES0_STATUS_RF (1<<11) +#define RDES0_STATUS_MF (1<<10) +#define RDES0_STATUS_FIRST (1<< 9) +#define RDES0_STATUS_LAST (1<< 8) +#define RDES0_STATUS_TOOLONG (1<< 7) +#define RDES0_STATUS_LATECOLL (1<< 6) +#define RDES0_STATUS_FT (1<< 5) +#define RDES0_STATUS_RW (1<< 4) +#define RDES0_STATUS_RE (1<< 3) +#define RDES0_STATUS_DB (1<< 2) +#define RDES0_STATUS_CRC (1<< 1) +#define RDES0_STATUS_ZERO (1<< 0) + +#define RDES0_COUNT_MASK (0x3fff0000) +#define RDES0_COUNT_SHIFT ( 16 ) + +// Tx specific results: +#define TDES0_STATUS_TJTO (1<<14) +#define TDES0_STATUS_LO (1<<11) +#define TDES0_STATUS_NC (1<<10) +#define TDES0_STATUS_LC (1<< 9) +#define TDES0_STATUS_EC (1<< 8) +#define TDES0_STATUS_HF (1<< 7) +#define TDES0_STATUS_LF (1<< 2) +#define TDES0_STATUS_UFL (1<< 1) +#define TDES0_STATUS_DE (1<< 0) +#define TDES0_STATUS_CC_MASK (0x78) +#define TDES0_STATUS_CC_SHIFT ( 3 ) + +// Common to both Rx and Tx DES1 +#define DES1_ENDRING (1<<25) +#define DES1_2ACHAIN (1<<24) +#define DES1_B2SIZE_MASK (0x7ff << 11) +#define DES1_B2SIZE_SHIFT (11) +#define DES1_B1SIZE_MASK (0x7ff) +#define DES1_B1SIZE_SHIFT (0) + +// Rx DES1 has no special bits - Rx descriptors have no "controls" + +// Tx specific controls in DES1: +#define TDES1_CONTROL_INTERRUPT (1<<31) +#define TDES1_CONTROL_LAST (1<<30) +#define TDES1_CONTROL_FIRST (1<<29) +#define TDES1_CONTROL_SETUP_FT1 (1<<28) +#define TDES1_CONTROL_SETUP (1<<27) +#define TDES1_CONTROL_NO_CRC (1<<26) +#define TDES1_CONTROL_NO_PAD (1<<23) +#define TDES1_CONTROL_SETUP_FT0 (1<<22) + +// ------------------------------------------------------------------------ +// +// PHY common constants - registers are read over MII. +// +// I don't know how much they have in common, but I think MII is pretty +// standard, and the "mandated" registers ought to be common. + +#define PHY_CONTROL_REG (0) +#define PHY_STATUS_REG (1) +#define PHY_ID_ONE (2) +#define PHY_ID_TWO (3) +#define PHY_AUTONEG_ADVERT (4) +#define PHY_AUTONEG_REMOTE (5) + +#define PHY_CONTROL_RESET (1<<15) +#define PHY_CONTROL_LOOPBACK (1<<14) +#define PHY_CONTROL_SPEED100 (1<<13) +#define PHY_CONTROL_AUTONEG_EN (1<<12) +#define PHY_CONTROL_POWERDOWN (1<<11) +#define PHY_CONTROL_MII_DIS (1<<10) +#define PHY_CONTROL_AUTONEG_RST (1<< 9) +#define PHY_CONTROL_DPLX_FULL (1<< 8) +#define PHY_CONTROL_COLLTEST (1<< 7) + +#define PHY_STATUS_CAP_T4 (1<<15) +#define PHY_STATUS_CAP_100TXF (1<<14) +#define PHY_STATUS_CAP_100TXH (1<<13) +#define PHY_STATUS_CAP_10TF (1<<12) +#define PHY_STATUS_CAP_10TH (1<<11) +#define PHY_STATUS_CAP_SUPR (1<< 6) +#define PHY_STATUS_AUTONEG_ACK (1<< 5) +#define PHY_STATUS_REMOTEFAULT (1<< 4) +#define PHY_STATUS_CAP_AUTONEG (1<< 3) +#define PHY_STATUS_LINK_OK (1<< 2) +#define PHY_STATUS_JABBER (1<< 1) +#define PHY_STATUS_EXTREGS (1<< 0) + +// These are the same for both AUTONEG registers +#define PHY_AUTONEG_NEXT (1<<15) +#define PHY_AUTONEG_ACK (1<<14) +#define PHY_AUTONEG_REMOTEFAULT (1<<13) +#define PHY_AUTONEG_100BASET4 (1<< 9) +#define PHY_AUTONEG_100BASETX_FDX (1<< 8) +#define PHY_AUTONEG_100BASETX_HDX (1<< 7) +#define PHY_AUTONEG_10BASET_FDX (1<< 6) +#define PHY_AUTONEG_10BASET_HDX (1<< 5) +#define PHY_AUTONEG_CSMA_802_3 (1<< 0) + +// ------------------------------------------------------------------------ +// +// DEVICES AND PACKET QUEUES +// +// ------------------------------------------------------------------------ + +// Use arrays provided by platform header to verify pointers. +#ifdef CYGDBG_USE_ASSERTS +#define CHECK_NDP_SC_LINK() \ + CYG_MACRO_START \ + int zzz, valid_netdev = 0, valid_sc = 0; \ + for(zzz = 0; zzz < CYGNUM_DEVS_ETH_INTEL_I21143_DEV_COUNT; zzz++) { \ + if (i21143_netdev_array[zzz] == ndp) valid_netdev = 1; \ + if (i21143_sc_array[zzz] == sc) valid_sc = 1; \ + if (valid_sc || valid_netdev) break; \ + } \ + CYG_ASSERT( valid_netdev, "Bad ndp" ); \ + CYG_ASSERT( valid_sc, "Bad sc" ); \ + CYG_ASSERT( (void *)p_i21143 == i21143_sc_array[zzz]->driver_private, \ + "sc pointer bad" ); \ + CYG_MACRO_END +#else +#define CHECK_NDP_SC_LINK() +#endif + +#define IF_BAD_21143( _p_ ) \ +if (({ \ + int zzz, valid_p = 0; \ + for(zzz = 0; zzz < CYGNUM_DEVS_ETH_INTEL_I21143_DEV_COUNT; zzz++) { \ + if (i21143_priv_array[zzz] == (_p_)) { \ + valid_p = 1; \ + break; \ + } \ + } \ + CYG_ASSERT(valid_p, "Bad pointer-to-i21143"); \ + (!valid_p); \ +})) + + + +#if defined( DEBUG_TRAFFIC_TXDETAILS ) || defined( DEBUG_MAC ) +static void dump_tx_details( struct i21143 *p_i21143, char *s ) +{ + int i; + cyg_uint32 prev = 0x0f0f0f0f; + for ( i = 0; i < TX_DESCRIPTORS ; i++ ) { + if ( 0 != (p_i21143->tx_ring[i].des1 | + p_i21143->tx_ring[i].buf1 | + p_i21143->tx_ring[i].buf2) + || ((p_i21143->tx_ring[i].des0 != prev ) ) ) { + prev = p_i21143->tx_ring[i].des0; + diag_printf( "%10s: bd[%2d] = %08x %08x %8x %x", + s, + i, + p_i21143->tx_ring[i].des0, + p_i21143->tx_ring[i].des1, + p_i21143->tx_ring[i].buf1, + p_i21143->tx_ring[i].buf2 ); + diag_printf( " %s, %s%s %s\n", + p_i21143->tx_ring[i].des0 & DES0_STATUS_OWN_OPEN ? "Open" : "Done" , + p_i21143->tx_ring[i].des1 & TDES1_CONTROL_FIRST ? "First" : "" , + p_i21143->tx_ring[i].des1 & TDES1_CONTROL_LAST ? "Last" : "" , + p_i21143->tx_ring[i].des1 & TDES1_CONTROL_INTERRUPT ? "Interrupt" : "" ); + } + } +} +#endif + +// ------------------------------------------------------------------------ +// +// NETWORK INTERFACE INITIALIZATION +// +// Function : i21143_init +// +// Description : +// This routine resets, configures, and initializes the chip. +// +// ------------------------------------------------------------------------ +static bool +i21143_init(struct cyg_netdevtab_entry * ndp) +{ + static int initialized = 0; // only probe PCI et al *once* + + struct eth_drv_sc *sc; + struct i21143 *p_i21143; + cyg_uint8 mac_address[ETHER_ADDR_LEN]; + +#ifdef DEBUG + diag_printf("intel_i21143_init\n"); +#endif + + sc = (struct eth_drv_sc *)(ndp->device_instance); + p_i21143 = (struct i21143 *)(sc->driver_private); + + IF_BAD_21143( p_i21143 ) { +#ifdef DEBUG + diag_printf( "Bad device private pointer %x\n", sc->driver_private ); +#endif + return 0; + } + + CHECK_NDP_SC_LINK(); + + p_i21143->ndp = (void *)ndp; + + if ( 0 == initialized++ ) { + // then this is the first time ever: + if ( ! pci_init_find_21143s() ) { +#ifdef DEBUG + diag_printf( "pci_init_find_21143s failed" ); +#endif + return 0; + } + } + + // If this device is not present, exit + if (0 == p_i21143->found) + return 0; + + p_i21143->mac_addr_ok = 0; + + if ( p_i21143->hardwired_esa ) + eth_set_mac_address( p_i21143, NULL ); // use that already there + // (actually a NOP because !active) + else { + int ee_addrbits; + int val[3]; + int good = 0; + + ee_addrbits = get_eeprom_size( p_i21143->io_address ); +#ifdef DEBUG_EE + diag_printf( "EEPROM size = %d\n", ee_addrbits ); +#endif + if ( 6 == ee_addrbits || 8 == ee_addrbits ) { + int i; + for ( i = 0; i < 3; i++ ) { + val[i] = read_eeprom_word( p_i21143->io_address, + ee_addrbits, + i ); +#ifdef DEBUG_EE + diag_printf( "EEPROM: word at %04x = %04x\n", i, val[i] ); +#endif + } + if ( 0x0000 != (val[0] | val[1] | val[2] ) && // some nonzero bits + 0xffff != (val[0] & val[1] & val[2] ) && // not all ones + 0x0000 == (val[0] & 0x80) ) { // not multicast + mac_address[0] = val[0] & 0xff; + mac_address[1] = val[0] >> 8; + mac_address[2] = val[1] & 0xff; + mac_address[3] = val[1] >> 8; + mac_address[4] = val[2] & 0xff; + mac_address[5] = val[2] >> 8; + good = 1; +#ifdef DEBUG_MAC + diag_printf( "EEPROM ESA OK: %04x %04x %04x\n", + val[0], val[1], val[2] ); +#endif + } + } + if ( !good ) { + // Invent one + mac_address[0] = 0x01; + mac_address[1] = 0x23; + mac_address[2] = 0x45; + mac_address[3] = 0x67; + mac_address[4] = 0x98; + mac_address[5] = 0x76; + } + // Just copy into the structure - not into hardware 'cos !active + eth_set_mac_address( p_i21143, &mac_address[0] ); + } + +#if defined( DEBUG ) || defined( DEBUG_MAC ) + diag_printf("MAC Address %s, ESA = %02X %02X %02X %02X %02X %02X\n", + p_i21143->mac_addr_ok ? "OK" : "**BAD**", + p_i21143->mac_address[0], + p_i21143->mac_address[1], + p_i21143->mac_address[2], + p_i21143->mac_address[3], + p_i21143->mac_address[4], + p_i21143->mac_address[5]); +#endif + + // Initialize upper level driver + if ( p_i21143->mac_addr_ok ) + (sc->funs->eth_drv->init)(sc, &(p_i21143->mac_address[0]) ); + else + (sc->funs->eth_drv->init)(sc, NULL ); + + return (1); +} + +// ------------------------------------------------------------------------ +// +// Function : i21143_start +// +// ------------------------------------------------------------------------ +static void +i21143_start( struct eth_drv_sc *sc, unsigned char *enaddr, int flags ) +{ + struct i21143 *p_i21143; + cyg_uint32 ioaddr; + cyg_uint32 l; +#ifdef CYGPKG_NET + struct ifnet *ifp = &sc->sc_arpcom.ac_if; +#endif + + p_i21143 = (struct i21143 *)sc->driver_private; + ioaddr = p_i21143->io_address; // get 21143's I/O address + + IF_BAD_21143( p_i21143 ) { +#ifdef DEBUG + diag_printf( "i21143_start: Bad device pointer %x\n", p_i21143 ); +#endif + return; + } + + if ( ! p_i21143->mac_addr_ok ) { +#ifdef DEBUG + diag_printf("i21143_start %d: invalid MAC address, " + "can't bring up interface\n", + p_i21143->index ); +#endif + return; + } + +#ifdef DEBUG + diag_printf( "i21143_start: enters\n" ); +#endif + + if ( p_i21143->active ) + i21143_stop( sc ); + + // Update the cached copy of the status reg just in case + l = i21143_status( p_i21143 ); + if ( l != p_i21143->line_status ) { + // It has changed! + i21143_reset(p_i21143); // sets line_status itself + } + + // Enable device + p_i21143->active = 1; + + // Initialize tx status + p_i21143->tx_endbuf = NO_TX_IN_PROGRESS; + + eth_set_mac_address( p_i21143, NULL ); // to put it in the device + + // After eth_set_mac_address() initialize the data structs for use: + InitRxRing( p_i21143 ); + InitTxRing( p_i21143 ); + + // Enable promiscuous mode if requested. + i21143_configure(p_i21143, 0 +#ifdef CYGPKG_NET + || !!(ifp->if_flags & IFF_PROMISC) +#endif +#ifdef ETH_DRV_FLAGS_PROMISC_MODE + || !!(flags & ETH_DRV_FLAGS_PROMISC_MODE) +#endif + + ); +#ifdef DEBUG + { + int status = p_i21143->line_status; + diag_printf("i21143_start %d flg %x Link = %s, %s Mbps, %s Duplex\n", + p_i21143->index, + *(int *)p_i21143, + (GEN_STATUS_LINK & status) ? "Up" : "Down", + (GEN_STATUS_100MBPS & status) ? "100" : "10", + (GEN_STATUS_FDX & status) ? "Full" : "Half"); + } +#endif + + // Load pointer to Rx Ring and enable receiver + OUTL( CYGHWR_PCI_VIRT_TO_BUS( (cyg_uint32)p_i21143->rx_ring ), CSR_RXBASE ); + // Enable receive interrupts + l = INL( CSR_INTR_ENABLE ); + l |= 0 + | CSR_STATUS_NIS + | CSR_STATUS_AIS + // CSR_STATUS_ERI + // CSR_STATUS_FBE + // CSR_STATUS_LNF + // CSR_STATUS_GTE + // CSR_STATUS_ETI + // CSR_STATUS_RWT + | CSR_STATUS_RX_STOPPED + | CSR_STATUS_RBU + | CSR_STATUS_RX_INTR + // CSR_STATUS_UNF + // CSR_STATUS_LNP_ANC + // CSR_STATUS_TJT + | CSR_STATUS_TBU + | CSR_STATUS_TX_STOPPED + | CSR_STATUS_TX_INTR + ; + OUTL( l, CSR_INTR_ENABLE ); + // and start the receiver + l = INL( CSR_OPMODE ); + l |= (CSR_OPMODE_RX_START); + OUTL( l, CSR_OPMODE ); + INCR_STAT( rx_restart ); +#ifdef DEBUG_DUMP_REGS + debug_dump_regs( ioaddr, BOTH ); +#endif +} + +// ------------------------------------------------------------------------ +// +// Function : i21143_status +// +// ------------------------------------------------------------------------ +int +i21143_status( struct i21143* p_i21143 ) +{ + int status; + int i, j; + cyg_uint32 ioaddr; + + IF_BAD_21143( p_i21143 ) { +#ifdef DEBUG + diag_printf( "i21143_status: Bad device pointer %x\n", p_i21143 ); +#endif + return 0; + } + + ioaddr = p_i21143->io_address; // get 21143's I/O address + + // Some of these bits latch and only reflect "the truth" on a 2nd reading. + // So read and discard. + status = mii_read_register( ioaddr, PHY_CONTROL_REG ); + status = mii_read_register( ioaddr, PHY_STATUS_REG ); + // Use the "and" of the local and remote capabilities words to infer + // what is selected: + status = 0; + i = mii_read_register( ioaddr, PHY_STATUS_REG ); + if ( PHY_STATUS_LINK_OK & i ) + status |= GEN_STATUS_LINK; + + i = mii_read_register( ioaddr, PHY_AUTONEG_ADVERT ); + j = mii_read_register( ioaddr, PHY_AUTONEG_REMOTE ); + p_i21143->phy_autoneg_remote = j; +#if defined( DEBUG_TRAFFIC ) || defined( DEBUG_IOCTL ) + diag_printf( "MII: capabilities are %04x, %04x; common %04x\n", + i, j, i & j ); +#endif + j &= i; // select only common capabilities + + if ( (PHY_AUTONEG_100BASET4 | + PHY_AUTONEG_100BASETX_FDX | + PHY_AUTONEG_100BASETX_HDX) & j ) + status |= GEN_STATUS_100MBPS; + if ( (PHY_AUTONEG_100BASETX_FDX | PHY_AUTONEG_10BASET_FDX) & j ) + status |= GEN_STATUS_FDX; + + return status; +} + +int +i21143_status_changed( struct i21143* p_i21143 ) +{ + cyg_uint32 ioaddr; + int j; + ioaddr = p_i21143->io_address; // get 21143's I/O address + + j = mii_read_register( ioaddr, PHY_AUTONEG_REMOTE ); + return ( j != p_i21143->phy_autoneg_remote ); +} + +// ------------------------------------------------------------------------ +// +// Function : i21143_stop +// +// ------------------------------------------------------------------------ + +static void +i21143_stop( struct eth_drv_sc *sc ) +{ + struct i21143 *p_i21143; + + p_i21143 = (struct i21143 *)sc->driver_private; + + IF_BAD_21143( p_i21143 ) { +#ifdef DEBUG + diag_printf( "i21143_stop: Bad device pointer %x\n", p_i21143 ); +#endif + return; + } + +#ifdef DEBUG_STARTSTOPRESET + diag_printf("i21143_stop %d flg %x\n", p_i21143->index, *(int *)p_i21143 ); +#endif + + p_i21143->active = 0; // stop people tormenting it + + if ( NO_TX_IN_PROGRESS != p_i21143->tx_endbuf) { + cyg_uint32 key; + + CYG_ASSERT( TX_DESCRIPTORS > p_i21143->tx_endbuf, "tx_endbuf range" ); + + key = p_i21143->tx_keys[ 0 ]; + // Common "done" code - key nonzero => report done + if (key) { + p_i21143->tx_keys[ 0 ] = 0; + p_i21143->tx_endbuf = NO_TX_IN_PROGRESS; + // Then tell the stack we are done: + INCR_STAT( tx_complete ); + (sc->funs->eth_drv->tx_done)( sc, key, 0 ); + } + } + + i21143_reset(p_i21143); // that should stop it +} + + +// ------------------------------------------------------------------------ +// +// Function : InitRxRing +// +// ------------------------------------------------------------------------ +static void +InitRxRing(struct i21143* p_i21143) +{ + int i; + volatile BUFDES *bp; + + p_i21143->rx_ring = + (BUFDES *)CYGHWR_CACHED_TO_UNCACHED( &(p_i21143->_rx[0]) ); + + bp = p_i21143->rx_ring; + for ( i = 0 ; i < RX_DESCRIPTORS; i++ ) { + bp->des0 = DES0_STATUS_OWN_OPEN; // NIC owns it, not the CPU + bp->des1 = (MAX_RX_PACKET_SIZE << DES1_B1SIZE_SHIFT); + bp->buf1 = CYGHWR_PCI_VIRT_TO_BUS( &( p_i21143->_rxbufs[i][0] ) ); + bp->buf2 = 0; + bp++; + } + bp--; // last one + bp->des1 |= DES1_ENDRING; + + p_i21143->next_rx_descriptor = 0; +} + +// ------------------------------------------------------------------------ +// +// Function : PacketRxReady (Called from delivery thread & foreground) +// +// ------------------------------------------------------------------------ +static void +PacketRxReady(struct i21143* p_i21143) +{ + volatile BUFDES *bp; + int index; + struct eth_drv_sc *sc; + int count; + { + struct cyg_netdevtab_entry *ndp; + ndp = (struct cyg_netdevtab_entry *)(p_i21143->ndp); + sc = (struct eth_drv_sc *)(ndp->device_instance); + CHECK_NDP_SC_LINK(); + } + + CYG_ASSERT( 0 <= p_i21143->next_rx_descriptor, "rx descriptor underflow" ); + CYG_ASSERT( RX_DESCRIPTORS > p_i21143->next_rx_descriptor, "rx descriptor overflow" ); + + index = p_i21143->next_rx_descriptor; + + // Scan receive buffers + for ( count = 0; count < RX_DESCRIPTORS; count++ ) { + cyg_uint32 ldes0; + int length; + + bp = &p_i21143->rx_ring[ index ]; + + CYG_ASSERT( 0 == bp->buf2, "Corrupt bp->buf2" ); + CYG_ASSERT( 0 != bp->buf1, "Null bp->buf1" ); + CYG_ASSERT( (MAX_RX_PACKET_SIZE << DES1_B1SIZE_SHIFT) == (bp->des1 &~ DES1_ENDRING), + "Corrupt bp->des1" ); + + ldes0 = bp->des0; + +#ifdef DEBUG_TRAFFIC + diag_printf( "PacketRxReady: index %d des0 = %08x, %s, %s, %d bytes\n", + index, ldes0, + (ldes0 & DES0_STATUS_OWN) ? "open" : "done", + ((RDES0_STATUS_FIRST | RDES0_STATUS_LAST | DES0_STATUS_ERROR) & ldes0) + == (RDES0_STATUS_FIRST | RDES0_STATUS_LAST) ? "OK" : "--", + (RDES0_COUNT_MASK & ldes0) >> RDES0_COUNT_SHIFT ); +#endif + + if ( DES0_STATUS_OWN_OPEN == (ldes0 & DES0_STATUS_OWN) ) + // This buffer bilong the device + break; + + INCR_STAT( rx_count ); + + // Otherwise, this one is for us + if ( ((RDES0_STATUS_FIRST | RDES0_STATUS_LAST | DES0_STATUS_ERROR) & ldes0) + == (RDES0_STATUS_FIRST | RDES0_STATUS_LAST) ) { + // A complete packet and no error bit + + length = (RDES0_COUNT_MASK & ldes0) >> RDES0_COUNT_SHIFT; + + CYG_ASSERT( MAX_RX_PACKET_SIZE >= length, "Oversize Rx" ); + + // tell the callback the right packet + p_i21143->next_rx_descriptor = index; + + INCR_STAT( rx_good ); + +#ifdef CYGPKG_NET + if ( length > sizeof( struct ether_header ) ) + // then it is acceptable; offer the data to the network stack +#endif + (sc->funs->eth_drv->recv)( sc, length ); + + // All done! + } +#ifdef KEEP_STATISTICS + else { + if ( RDES0_STATUS_LAST & ldes0 ) { + // Then we have good error info; analyse and count the errors + if ( ldes0 & ( RDES0_STATUS_CRC ) ) + INCR_STAT( rx_crc_errors ); + if ( ldes0 & ( RDES0_STATUS_DB ) ) + INCR_STAT( rx_align_errors ); + if ( ldes0 & ( RDES0_STATUS_LATECOLL ) ) + INCR_STAT( rx_collisions ); + if ( ldes0 & ( RDES0_STATUS_TOOLONG ) ) + INCR_STAT( rx_too_long_frames ); + if ( ldes0 & ( RDES0_STATUS_RF ) ) + INCR_STAT( rx_short_frames ); + if ( ldes0 & ( RDES0_STATUS_RE ) ) + INCR_STAT( rx_symbol_errors ); + } + else + // Dunno what went wrong really... + INCR_STAT( rx_resource_errors ); + } +#endif // KEEP_STATISTICS + + // Open the buffer for the device to use + bp->des0 = DES0_STATUS_OWN_OPEN; // NIC owns it, not the CPU + + // Step i around the ring buffer... + index++; + if ( index >= RX_DESCRIPTORS ) + index = 0; + } + + // record the right packet for next time + p_i21143->next_rx_descriptor = index; + + CYG_ASSERT( 0 <= p_i21143->next_rx_descriptor, "rx descriptor underflow" ); + CYG_ASSERT( RX_DESCRIPTORS > p_i21143->next_rx_descriptor, "rx descriptor overflow" ); + + { // We should not have needed ioaddr before this point. + cyg_uint32 ioaddr; + cyg_uint32 l; + + // Now examine the state of the receive engine and prompt it accordingly. + ioaddr = p_i21143->io_address; // get 21143's I/O address + l = INL( CSR_STATUS ); + +#ifdef DEBUG_TRAFFIC + diag_printf( "PacketRxReady: done scan, next %d, status %08x %s\n", + p_i21143->next_rx_descriptor, l, + (CSR_STATUS_RXSTATUS & l) != CSR_STATUS_RXSTATUS_STOPPED ? + "Running" : "Stopped" ); +#endif + + if ( (CSR_STATUS_RXSTATUS & l) != CSR_STATUS_RXSTATUS_STOPPED ) { + // Then ping it into life + OUTL( 0, CSR_RXPOLL ); + } + else { + // Oh dear, it's stopped; we must initialize and start the rx machine + InitRxRing( p_i21143 ); + OUTL( CYGHWR_PCI_VIRT_TO_BUS( (cyg_uint32)p_i21143->rx_ring ), CSR_RXBASE ); + l = INL( CSR_OPMODE ); + l |= CSR_OPMODE_RX_START; + OUTL( l, CSR_OPMODE ); + INCR_STAT( rx_resource ); + INCR_STAT( rx_restart ); + } + } +} + + +// and the callback function + +static void +i21143_recv( struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len ) +{ + volatile BUFDES *bp; + struct i21143 *p_i21143; + cyg_uint32 from_p; + int total_len; + struct eth_drv_sg *last_sg; + + p_i21143 = (struct i21143 *)(sc->driver_private); + + CYG_ASSERT( 0 <= p_i21143->next_rx_descriptor, "rx descriptor underflow" ); + CYG_ASSERT( RX_DESCRIPTORS > p_i21143->next_rx_descriptor, "rx descriptor overflow" ); + + bp = &p_i21143->rx_ring[ p_i21143->next_rx_descriptor ]; + + CYG_ASSERT( 0 == bp->buf2, "Corrupt bp->buf2" ); + CYG_ASSERT( 0 != bp->buf1, "Null bp->buf1" ); + CYG_ASSERT( DES0_STATUS_OWN_DONE == (bp->des0 & DES0_STATUS_OWN), "bp not done" ); + + // Copy the data to the network stack + from_p = CYGHWR_BUS_TO_UNCACHED( bp->buf1 ); + total_len = (RDES0_COUNT_MASK & bp->des0) >> RDES0_COUNT_SHIFT; + +#ifdef DEBUG_TRAFFIC + diag_printf("Recv callback: index %d des0 = %08x: %d sg's, %d bytes\n", + p_i21143->next_rx_descriptor, bp->des0, sg_len, total_len); +#endif + + // check we have memory to copy into; we would be called even if + // caller was out of memory in order to maintain our state. + if ( 0 == sg_len || 0 == sg_list ) + return; // caller was out of mbufs + + INCR_STAT( rx_deliver ); + + CYG_ASSERT( 0 < sg_len, "sg_len underflow" ); + CYG_ASSERT( MAX_ETH_DRV_SG >= sg_len, "sg_len overflow" ); + + for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) { + cyg_uint8 *to_p; + int l; + + to_p = (cyg_uint8 *)(sg_list->buf); + l = sg_list->len; + + CYG_ASSERT( 0 <= l, "sg length -ve" ); + + if ( 0 >= l || 0 == to_p ) + return; // caller was out of mbufs + + if ( l > total_len ) + l = total_len; + + memcpy( to_p, (unsigned char *)from_p, l ); + from_p += l; + total_len -= l; + } + + CYG_ASSERT( 0 == total_len, "total_len mismatch in rx" ); + CYG_ASSERT( last_sg == sg_list, "sg count mismatch in rx" ); + CYG_ASSERT( CYGHWR_BUS_TO_UNCACHED( bp->buf1 ) < from_p, "from_p wild in rx" ); + CYG_ASSERT( CYGHWR_BUS_TO_UNCACHED( bp->buf1 ) + MAX_RX_PACKET_SIZE >= from_p, + "from_p overflow in rx" ); +} + + +// ------------------------------------------------------------------------ +// +// Function : InitTxRing +// +// ------------------------------------------------------------------------ +static void +InitTxRing(struct i21143* p_i21143) +{ + int i; + volatile BUFDES *bp; + + p_i21143->tx_ring = + (BUFDES *)CYGHWR_CACHED_TO_UNCACHED( &(p_i21143->_tx[0]) ); + + bp = p_i21143->tx_ring; + for ( i = 0 ; i < TX_DESCRIPTORS; i++ ) { + bp->des0 = DES0_STATUS_OWN_DONE; // CPU owns it, not the NIC + bp->des1 = 0; + bp->buf1 = bp->buf2 = 0; + bp++; + } + bp--; // last one + bp->des1 |= DES1_ENDRING; +} + +// ------------------------------------------------------------------------ +// +// Function : TxDone (Called from delivery thread) +// +// This returns Tx's from the Tx Machine to the stack (ie. reports +// completion) - allowing for missed interrupts, and so on. +// ------------------------------------------------------------------------ + +static void +TxDone(struct i21143* p_i21143) +{ + struct eth_drv_sc *sc; + unsigned long key = 0; + cyg_uint32 ioaddr; + + { + struct cyg_netdevtab_entry *ndp; + ndp = (struct cyg_netdevtab_entry *)(p_i21143->ndp); + sc = (struct eth_drv_sc *)(ndp->device_instance); + CHECK_NDP_SC_LINK(); + } + + ioaddr = p_i21143->io_address; // get 21143's I/O address + +#ifdef DEBUG_TRAFFIC_TXDETAILS + dump_tx_details( p_i21143, "TxDone" ); +#endif + + if ( NO_TX_IN_PROGRESS != p_i21143->tx_endbuf) { + cyg_uint32 l; + volatile BUFDES *bp; + cyg_uint32 des; + + CYG_ASSERT( TX_DESCRIPTORS > p_i21143->tx_endbuf, "tx_endbuf range" ); + + l = INL( CSR_STATUS ); // Important: read this first + + bp = p_i21143->tx_ring; + bp += p_i21143->tx_endbuf; // The descriptor with the "end" marker + + // It's not clear where error status gets written if the error is + // *before* the end-marked bufdesc. We'll see. + + des = bp->des1; + CYG_ASSERT( TDES1_CONTROL_LAST & des , "Last buf not marked" ); + CYG_ASSERT( TDES1_CONTROL_INTERRUPT & des , "No interrupt req" ); + CYG_ASSERT( 0 == (DES1_2ACHAIN & des), "Buffer chained" ); + CYG_ASSERT( 0 == ((TDES1_CONTROL_SETUP | + TDES1_CONTROL_SETUP_FT1 | + TDES1_CONTROL_SETUP_FT0 | + TDES1_CONTROL_NO_CRC | + TDES1_CONTROL_NO_PAD) + & des), "Buffer wierd flags" ); + des = bp->des0; + if ( DES0_STATUS_OWN_DONE == (des & DES0_STATUS_OWN) ) { + // Then it finished; somehow... + key = p_i21143->tx_keys[ 0 ]; +#ifdef DEBUG_TRAFFIC + diag_printf("TxDone: KEY %x, %d descs, status %08x\n", + key, p_i21143->tx_endbuf+1, des ); +#endif +#ifdef KEEP_STATISTICS + // Then look for an error code from the tx records... + if ( ! ( DES0_STATUS_ERROR & des ) ) + INCR_STAT( tx_good ); + // Not all the following are errors, so check all + if ( des & ( TDES0_STATUS_LO | TDES0_STATUS_NC ) ) + INCR_STAT( tx_carrier_loss ); + if ( des & ( TDES0_STATUS_LC ) ) + INCR_STAT( tx_late_collisions ); + if ( des & ( TDES0_STATUS_EC ) ) + INCR_STAT( tx_max_collisions ); + if ( des & ( TDES0_STATUS_LF ) ) + INCR_STAT( tx_sqetesterrors ); + if ( des & ( TDES0_STATUS_UFL ) ) + INCR_STAT( tx_underrun ); + if ( des & ( TDES0_STATUS_DE ) ) + INCR_STAT( tx_deferred ); + // Now count collisions per se: + des = ((des & TDES0_STATUS_CC_MASK) >> TDES0_STATUS_CC_SHIFT); + if ( 0 < des ) { + INCR_STAT( tx_total_collisions ); + if ( 1 < des ) + INCR_STAT( tx_mult_collisions ); + else + INCR_STAT( tx_single_collisions ); + } +#endif // KEEP_STATISTICS + } + else { + // a Tx is in progress, but it has not yet completed; + // probably wise to check on the tx machine status. + if ( ((CSR_STATUS_TXSTATUS & l) == CSR_STATUS_TXSTATUS_STOPPED) || + ((CSR_STATUS_TXSTATUS & l) == CSR_STATUS_TXSTATUS_SUSPENDED) ) { + // then it's not active right now! + key = p_i21143->tx_keys[ 0 ]; +#ifdef DEBUG_TRAFFIC + diag_printf("TxDone STOPPED! KEY %x, %d descs, status %08x, CSR_STATUS %08x\n", + key, p_i21143->tx_endbuf, des, l ); +#endif + INCR_STAT( tx_underrun ); // at a guess... + } + } + + // Common "done" code - key nonzero => report done + if (key) { + p_i21143->tx_keys[ 0 ] = 0; + p_i21143->tx_endbuf = NO_TX_IN_PROGRESS; + // Then tell the stack we are done: + INCR_STAT( tx_complete ); + (sc->funs->eth_drv->tx_done)( sc, key, 0 ); + } + } +} + + +// ------------------------------------------------------------------------ +// +// Function : i21143_can_send +// +// ------------------------------------------------------------------------ + +static int +i21143_can_send(struct eth_drv_sc *sc) +{ + struct i21143 *p_i21143; + + p_i21143 = (struct i21143 *)sc->driver_private; + + IF_BAD_21143( p_i21143 ) { +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_can_send: Bad device pointer %x\n", p_i21143 ); +#endif + return 0; + } + + if ( p_i21143->active ) { + if ( NO_TX_IN_PROGRESS != p_i21143->tx_endbuf ) + // Poll for Tx completion + TxDone( p_i21143 ); + + // Poll for receptions + PacketRxReady( p_i21143 ); + } + +#ifdef neverDEBUG_TRAFFIC + diag_printf( "i21143_can_send: returning %d\n", + (NO_TX_IN_PROGRESS == p_i21143->tx_endbuf) && p_i21143->active ); +#endif + + return (NO_TX_IN_PROGRESS == p_i21143->tx_endbuf) && p_i21143->active; +} + +// ------------------------------------------------------------------------ +// +// Function : i21143_send +// +// ------------------------------------------------------------------------ + +static void +i21143_send(struct eth_drv_sc *sc, + struct eth_drv_sg *sg_list, int sg_len, int total_len, + unsigned long key) +{ + struct i21143 *p_i21143; + cyg_uint32 ioaddr; + struct eth_drv_sg *last_sg; + volatile BUFDES *bp; + int bufcount; + cyg_uint32 x; + + p_i21143 = (struct i21143 *)sc->driver_private; + + IF_BAD_21143( p_i21143 ) { +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_send: Bad device pointer %x\n", p_i21143 ); +#endif + return; + } + + if ( NO_TX_IN_PROGRESS != p_i21143->tx_endbuf) { + // Then we cannot do this +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_send: tx busy %x, %d bufs key %x\n", + p_i21143, p_i21143->tx_endbuf, p_i21143->tx_keys[0] ); +#endif + CYG_FAIL( "Send call when already busy" ); + INCR_STAT( tx_dropped ); + return; + } + + ioaddr = p_i21143->io_address; + + bp = p_i21143->tx_ring; + bufcount = 0; + +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_send() key %x\n", key ); +#endif + + INCR_STAT( tx_count ); + + for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) { + cyg_uint8 *from_p; + int l; + + from_p = (cyg_uint8 *)(sg_list->buf); // normal cached address + l = sg_list->len; + + if ( l > total_len ) + l = total_len; + + // Ensure the mbuf contents really is in RAM where DMA can see it. + // (Must round to cache lines apparantly for some MIPS) + HAL_DCACHE_STORE( ((CYG_ADDRESS)from_p) &~(HAL_DCACHE_LINE_SIZE-1), + l + HAL_DCACHE_LINE_SIZE ); + + // There are two pointer, length pairs in each descriptor. We only + // bother using the first one - the code saved is small but so is + // the overhead of memory. + bp->buf1 = CYGHWR_PCI_VIRT_TO_BUS( from_p ); // uncached real RAM address + bp->buf2 = 0; + // Record length and add endring flag iff end of ring - never leave + // it blank in memory! + x = (l << DES1_B1SIZE_SHIFT) & DES1_B1SIZE_MASK; // plus zero buf2 size. + if ( (TX_DESCRIPTORS-1) == bufcount ) + x |= DES1_ENDRING; + bp->des1 = x; + + // Leave writing the zeroth bufdesc DES0 until all are complete: + // the tx engine will be stopped looking there. + if ( 0 < bufcount ) // then we can write DES0 also. + bp->des0 = DES0_STATUS_OWN_OPEN; + + total_len -= l; + bp++; + bufcount++; + + if ( 0 > total_len ) + break; // Should exit via sg_last normally + } + + CYG_ASSERT( 0 == total_len, "length mismatch in tx" ); + CYG_ASSERT( last_sg == sg_list, "sg count mismatch in tx" ); + + CYG_ASSERT( bp > &p_i21143->tx_ring[0], "bp underflow" ); + + bp--; // back to the last-used bp. + bufcount--; + p_i21143->tx_endbuf = bufcount; // record that we are busy + p_i21143->tx_keys[0] = key; // and the key to return + + CYG_ASSERT( bp < &p_i21143->tx_ring[ TX_DESCRIPTORS ], "bp underflow" ); + + // Mark this the last valid buffer. + bp->des1 |= TDES1_CONTROL_LAST | TDES1_CONTROL_INTERRUPT; + + CYG_ASSERT( &(p_i21143->tx_ring[bufcount]) == bp, "Bp/bufcount misstep" ); + + bp++; + bufcount++; + + // Make the rest be null links + for ( /* bp */ ; bp < &p_i21143->tx_ring[ TX_DESCRIPTORS ]; bp++ ) { + bp->buf1 = 0; + bp->buf2 = 0; + x = 0; // zero size for both buffers + if ( (TX_DESCRIPTORS-1) == bufcount ) + x |= DES1_ENDRING; + bp->des1 = x; + bp->des0 = DES0_STATUS_OWN_OPEN; + bufcount++; + } + + // Now it's safe to write the zeroth descriptor: + p_i21143->tx_ring->des1 |= TDES1_CONTROL_FIRST; + p_i21143->tx_ring->des0 = DES0_STATUS_OWN_OPEN; + +#ifdef DEBUG_TRAFFIC_TXDETAILS + dump_tx_details( p_i21143, "i21143_send" ); +#endif + + // And start off the tx system + x = INL( CSR_STATUS ); + +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_send: ready, status %08x %s\n", + x, + (CSR_STATUS_TXSTATUS & x) != CSR_STATUS_TXSTATUS_STOPPED ? + "Running" : "Stopped" ); +#endif + + if ( CSR_STATUS_TXSTATUS_STOPPED == (CSR_STATUS_TXSTATUS & x) ) { + cyg_uint32 l; + // Then we must initialize and start the tx machine + OUTL( CYGHWR_PCI_VIRT_TO_BUS( (cyg_uint32)p_i21143->tx_ring ), CSR_TXBASE ); + l = INL( CSR_OPMODE ); + l |= CSR_OPMODE_TX_START; + OUTL( l, CSR_OPMODE ); + } + else if ( CSR_STATUS_TXSTATUS_SUSPENDED == (CSR_STATUS_TXSTATUS & x) ) { + // Then we just have to ping it + OUTL( 0, CSR_TXPOLL ); + } + else { +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_send: tx not ready %x CSR_STATUS %08x\n", p_i21143, x ); +#endif + CYG_FAIL( "Tx is not ready to tx" ); + + // Try to recover by brutal means... + i21143_stop( sc ); // will return the key + i21143_start( sc, NULL, 0 ); + } +} + +// ------------------------------------------------------------------------ +// +// Function : i21143_reset +// +// ------------------------------------------------------------------------ +static void +i21143_reset(struct i21143* p_i21143) +{ + cyg_uint32 ioaddr = p_i21143->io_address; + cyg_uint32 l; + int i, status; + // First stop the tx and rx engines - doc suggests that's necessary + // before writing the reset reg, but it seems a little paranoid. + + l = INL( CSR_OPMODE ); + l &=~ (CSR_OPMODE_RX_START | CSR_OPMODE_TX_START); + OUTL( l, CSR_OPMODE ); + + for ( i = 0; i < 10000; i++) { + l = INL( CSR_STATUS ); + if ( ((CSR_STATUS_TXSTATUS & l) == CSR_STATUS_TXSTATUS_STOPPED) && + ((CSR_STATUS_RXSTATUS & l) == CSR_STATUS_RXSTATUS_STOPPED) ) + break; + } +#ifdef DEBUG_STARTSTOPRESET + diag_printf( "i21143_reset: rx and tx idle after %d iters, status %x\n", + i, l ); +#endif + + // Acknowledge all the interrupts from these activities + // within the device: + OUTL( 0xffffffff, CSR_STATUS ); // clear all bits + + // Now reset the device. We are going to re-init all params anyway, so + // ignore other settings: + OUTL( CSR_BUSMODE_RESET, CSR_BUSMODE ); + + udelay( 100 ); // let reset take effect. "50 PCI clock cycles" + + for ( i = 0; i < 10000; i++) { + l = INL( CSR_BUSMODE ); + if ( (CSR_BUSMODE_RESET & l) == 0 ) + break; + } +#ifdef DEBUG_STARTSTOPRESET + diag_printf( "i21143_reset: reset zero after %d iters, busmode %x\n", + i, l ); +#endif + + // Gross initialization + OUTL( 0 // No other options + // CSR_BUSMODE_PM + // CSR_BUSMODE_WIE + // CSR_BUSMODE_RLE + // CSR_BUSMODE_RME + // CSR_BUSMODE_DBO_BE + // CSR_BUSMODE_DBO_LE + // CSR_BUSMODE_TAP_SHIFT + | (1 << CSR_BUSMODE_CAL_SHIFT) + | (4 << CSR_BUSMODE_PBL_SHIFT) + // CSR_BUSMODE_ENDIAN_BE + // CSR_BUSMODE_ENDIAN_LE + // CSR_BUSMODE_DSL_SHIFT + // CSR_BUSMODE_BAR + // CSR_BUSMODE_RESET + + , CSR_BUSMODE ); + + // No interrupt sources enabled yet + OUTL( 0, CSR_INTR_ENABLE ); + + OUTL( 0 + // CSR_ROM_MII_MGT_MDI + | CSR_ROM_MII_MGT_MOM_READ + // CSR_ROM_MII_MGT_MDO + // CSR_ROM_MII_MGT_MDC + // CSR_ROM_MII_MGT_RD + // CSR_ROM_MII_MGT_WR + // CSR_ROM_MII_MGT_BR + // CSR_ROM_MII_MGT_SR + // CSR_ROM_MII_MGT_REG + // CSR_ROM_MII_MGT_SR_DO + // CSR_ROM_MII_MGT_SR_DI + // CSR_ROM_MII_MGT_SR_CK + // CSR_ROM_MII_MGT_SR_CS + | 0xff, + + CSR_ROM_MII_MGT ); + + // ----------------------------------- + // Now find out about the status of the PHY via MII +#if 0 + // Try resetting the PHY and power-cycling it: + mii_write_register( ioaddr, PHY_CONTROL_REG, PHY_CONTROL_RESET | PHY_CONTROL_AUTONEG_EN); + while (1) { + int v; + v = mii_read_register( ioaddr, PHY_CONTROL_REG ); + if ( 0 == (v & PHY_CONTROL_RESET) ) + break; + } + + mii_write_register( ioaddr, PHY_CONTROL_REG, + PHY_CONTROL_POWERDOWN | PHY_CONTROL_MII_DIS | PHY_CONTROL_AUTONEG_EN ); + udelay( 1000 ); + mii_write_register( ioaddr, PHY_CONTROL_REG, PHY_CONTROL_AUTONEG_EN | PHY_CONTROL_AUTONEG_RST ); + + udelay( 1000 ); + + while (1) { + int v; + v = mii_read_register( ioaddr, PHY_STATUS_REG ); + if ( PHY_STATUS_AUTONEG_ACK & v ) + break; + } +#endif + +#ifdef DEBUG_DUMP_REGS + debug_dump_regs( ioaddr, MII ); +#endif + + status = i21143_status( p_i21143 ); + p_i21143->line_status = status; // record it for SNMP info +#ifdef DEBUG_STARTSTOPRESET + diag_printf("i21143_reset %d flg %x Link = %s, %s Mbps, %s Duplex\n", + p_i21143->index, + *(int *)p_i21143, + (GEN_STATUS_LINK & status) ? "Up" : "Down", + (GEN_STATUS_100MBPS & status) ? "100" : "10", + (GEN_STATUS_FDX & status) ? "Full" : "Half"); +#endif + + OUTL( -1, CSR_ROM_PGM_ADDR ); + OUTL( 0, CSR_INTR_MITIGATION ); + + // CSR13, 14 = 0; select SIA mode temporarily. +// OUTL( CSR_OPMODE_MUST_BE_ONE, CSR_OPMODE); + OUTL( CSR_SIA_CONN_DEFAULT, CSR_SIA_CONN ); + OUTL( CSR_SIA_TXRX_DEFAULT, CSR_SIA_TXRX ); + OUTL( CSR_SIA_GPPORT_DEFAULT, CSR_SIA_GPPORT ); + + // Last one, CSR6 + l = 0 + | CSR_OPMODE_SC + // CSR_OPMODE_RA + // CSR_OPMODE_IGNOREMSB + | CSR_OPMODE_MUST_BE_ONE + // CSR_OPMODE_SCR do not set for MII mode + // CSR_OPMODE_PCS do not set for MII mode + // CSR_OPMODE_TTM set for 10Mb, not set for 100Mb + | CSR_OPMODE_SF // Set the store&forward bit so we can keep- + | CSR_OPMODE_HBD // -up at 100Mbit + | CSR_OPMODE_PS_MIISYM + | CSR_OPMODE_CA + // CSR_OPMODE_TX_THRES_SHIFT + // CSR_OPMODE_TX_START + // CSR_OPMODE_FC + // (0 << CSR_OPMODE_LOOPBACK_SHIFT) + // CSR_OPMODE_FD + // CSR_OPMODE_MULTICAST // Pass all multicast + // CSR_OPMODE_PROMISC // Promisc mode + // CSR_OPMODE_SB + // CSR_OPMODE_IF // Inverse filtering (!) + // CSR_OPMODE_PB + // CSR_OPMODE_HO // 0: Perfect filter + // CSR_OPMODE_RX_START // 1: hashing for /all/ addresses + // CSR_OPMODE_HP // 0: Perfect filter of N address + ; // 1: imperfect hash filter + 1 fixed addr + + if ( GEN_STATUS_FDX & status ) + l |= CSR_OPMODE_FD; + if ( ! (GEN_STATUS_100MBPS & status) ) + l |= CSR_OPMODE_TTM; + + OUTL( l, CSR_OPMODE ); + +} + +// ------------------------------------------------------------------------ +// +// INTERRUPT HANDLERS +// +// ------------------------------------------------------------------------ + +static cyg_uint32 +eth_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + cyg_drv_interrupt_mask( vector ); + +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_isr, vector %d\n", vector ); +#endif + + return CYG_ISR_CALL_DSR; // schedule DSR +} + + +// An indirection is used because (if we have multiple devices) we don't +// know all the "sc" values at the time the interrupts are created. +static +void eth_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + struct i21143* p_i21143 = (struct i21143 *)data; + struct cyg_netdevtab_entry *ndp = + (struct cyg_netdevtab_entry *)(p_i21143->ndp); + struct eth_drv_sc *sc = (struct eth_drv_sc *)(ndp->device_instance); + + INCR_STAT( interrupts ); + + // but here, it must be a *sc: + eth_drv_dsr( vector, count, (cyg_addrword_t)sc ); +} + +// ------------------------------------------------------------------------ +// Deliver routine: + +void +i21143_deliver(struct eth_drv_sc *sc) +{ + struct i21143* p_i21143 = (struct i21143 *)(sc->driver_private); + cyg_uint32 status; + cyg_uint32 ioaddr; + + IF_BAD_21143( p_i21143 ) { +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_deliver: Bad device pointer %x\n", p_i21143 ); +#endif + return; + } + + ioaddr = p_i21143->io_address; + status = INL( CSR_STATUS ); + +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_deliver: status %08x\n", status ); +#endif + + // Acknowledge all INT sources that were active + OUTL( status, CSR_STATUS ); + + // Search for link status changes + if ( i21143_status_changed( p_i21143 ) ) { +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_can_send: status changed\n" ); +#endif + i21143_stop( sc ); + i21143_start( sc, NULL, 0 ); + } + + if ( (CSR_STATUS_TBU | CSR_STATUS_TX_STOPPED | CSR_STATUS_TX_INTR) + & status ) { + TxDone( p_i21143 ); + } + + if ( (CSR_STATUS_RX_STOPPED | CSR_STATUS_RBU | CSR_STATUS_RX_INTR) + & status ) { + PacketRxReady( p_i21143 ); + } + + cyg_drv_interrupt_acknowledge(p_i21143->vector); + cyg_drv_interrupt_unmask( p_i21143->vector ); +} + +// ------------------------------------------------------------------------ +// Device table entry to operate the chip in a polled mode. +// Only diddle the interface we were asked to! + +void +i21143_poll(struct eth_drv_sc *sc) +{ + struct i21143 *p_i21143; + p_i21143 = (struct i21143 *)sc->driver_private; + + IF_BAD_21143( p_i21143 ) { +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_poll: Bad device pointer %x\n", p_i21143 ); +#endif + return; + } + + // As it happens, this driver always requests the DSR to be called: + (void)eth_isr( p_i21143->vector, (cyg_addrword_t)p_i21143 ); + + // (no harm in calling this ints-off also, when polled) + i21143_deliver( sc ); +} + +// ------------------------------------------------------------------------ +// Determine interrupt vector used by a device - for attaching GDB stubs +// packet handler. +int +i21143_int_vector(struct eth_drv_sc *sc) +{ + struct i21143 *p_i21143; + p_i21143 = (struct i21143 *)sc->driver_private; + return (p_i21143->vector); +} + +// ------------------------------------------------------------------------ +// +// Function : pci_init_find_21143s +// +// This is called exactly once at the start of time to: +// o scan the PCI bus for objects +// o record them in the device table +// o acquire all the info needed for the driver to access them +// o instantiate interrupts for them +// o attach those interrupts appropriately +// ------------------------------------------------------------------------ +static cyg_pci_match_func find_21143s_match_func; + +static cyg_bool +find_21143s_match_func( cyg_uint16 v, cyg_uint16 d, cyg_uint32 c, void *p ) +{ + return + (/* (0x8086 == v) || */ (0x1011 == v)) && // (Intel or) DEC + (0x0019 == d); // [DC21142/3][PCI/CardBus 10/100 Mbit Ethernet Ctlr] +} + +static int +pci_init_find_21143s( void ) +{ + cyg_pci_device_id devid; + cyg_pci_device dev_info; + cyg_uint32 l; + int device_index; + int found_devices = 0; + +#ifdef DEBUG + diag_printf("pci_init_find_21143s()\n"); +#endif + + cyg_pci_init(); +#ifdef DEBUG + diag_printf("Finished cyg_pci_init();\n"); +#endif + + devid = CYG_PCI_NULL_DEVID; + + for (device_index = 0; + device_index < CYGNUM_DEVS_ETH_INTEL_I21143_DEV_COUNT; + device_index++) { + struct i21143 *p_i21143 = i21143_priv_array[device_index]; + + p_i21143->index = device_index; + + // See above for find_21143s_match_func - it selects any of several + // variants. This is necessary in case we have multiple mixed-type + // devices on one board in arbitrary orders. + if (cyg_pci_find_matching( &find_21143s_match_func, NULL, &devid )) { +#ifdef DEBUG + diag_printf("eth%d = 21143\n", device_index); +#endif + cyg_pci_get_device_info(devid, &dev_info); + + p_i21143->interrupt_handle = 0; // Flag not attached. + if (cyg_pci_translate_interrupt(&dev_info, &p_i21143->vector)) { +#ifdef DEBUG + diag_printf(" Wired to HAL vector %d\n", p_i21143->vector); +#endif + cyg_drv_interrupt_create( + p_i21143->vector, + 0, // Priority - unused + (CYG_ADDRWORD)p_i21143, // Data item passed to ISR & DSR + eth_isr, // ISR + eth_dsr, // DSR + &p_i21143->interrupt_handle, // handle to intr obj + &p_i21143->interrupt_object ); // space for int obj + + cyg_drv_interrupt_attach(p_i21143->interrupt_handle); + + cyg_drv_interrupt_configure( p_i21143->vector, 1, 0 ); + + // Don't unmask the interrupt yet, that could get us into a + // race. + } + else { + p_i21143->vector=0; +#ifdef DEBUG + diag_printf(" Does not generate interrupts.\n"); +#endif + } + + if (cyg_pci_configure_device(&dev_info)) { +#ifdef DEBUG + int i; + diag_printf("Found device on bus %d, devfn 0x%02x:\n", + CYG_PCI_DEV_GET_BUS(devid), + CYG_PCI_DEV_GET_DEVFN(devid)); + + if (dev_info.command & CYG_PCI_CFG_COMMAND_ACTIVE) { + diag_printf(" Note that board is active. Probed" + " sizes and CPU addresses invalid!\n"); + } + diag_printf(" Vendor 0x%04x", dev_info.vendor); + diag_printf("\n Device 0x%04x", dev_info.device); + diag_printf("\n Command 0x%04x, Status 0x%04x\n", + dev_info.command, dev_info.status); + + diag_printf(" Class/Rev 0x%08x", dev_info.class_rev); + diag_printf("\n Header 0x%02x\n", dev_info.header_type); + + diag_printf(" SubVendor 0x%04x, Sub ID 0x%04x\n", + dev_info.header.normal.sub_vendor, + dev_info.header.normal.sub_id); + + for(i = 0; i < CYG_PCI_MAX_BAR; i++) { + diag_printf(" BAR[%d] 0x%08x /", i, dev_info.base_address[i]); + diag_printf(" probed size 0x%08x / CPU addr 0x%08x\n", + dev_info.base_size[i], dev_info.base_map[i]); + } + diag_printf(" eth%d configured\n", device_index); +#endif + found_devices++; + p_i21143->found = 1; + p_i21143->active = 0; + p_i21143->devid = devid; + p_i21143->io_address = dev_info.base_map[0]; +#ifdef DEBUG + diag_printf(" I/O address = 0x%08x\n", dev_info.base_map[0]); +#endif + +#ifdef pciDEBUG + diag_printf( "Before wakeup\n" ); + for ( i = 0; i <= 0xe0; i += 4 ) { + if ( i == 0x18 ) i = 0x28; + if ( i == 0x58 ) i = 0xdc; + cyg_pci_read_config_uint32( devid, i, &l ); + diag_printf( "PCI Config reg %02x = 0x%08x\n", i, l ); + } +#endif + // Awaken the device through the CFDD device-specific + // register - which boots up with it asleep - great. + l = 0; + cyg_pci_write_config_uint32( devid, 0x40, l ); +#ifdef pciDEBUG + diag_printf( "After wakeup\n" ); + for ( i = 0; i <= 0xe0; i += 4 ) { + if ( i == 0x18 ) i = 0x28; + if ( i == 0x58 ) i = 0xdc; + cyg_pci_read_config_uint32( devid, i, &l ); + diag_printf( "PCI Config reg %02x = 0x%08x\n", i, l ); + } +#endif + // Now the PCI part of the device is configured, reset + // it. This should make it safe to enable the + // interrupt + i21143_reset(p_i21143); + + // This is the indicator for "uses an interrupt" + if (p_i21143->interrupt_handle != 0) { + cyg_drv_interrupt_acknowledge(p_i21143->vector); + cyg_drv_interrupt_unmask(p_i21143->vector); + } +#ifdef DEBUG + diag_printf(" **** Device enabled for I/O only and Bus Master\n"); +#endif + } + else { + p_i21143->found = 0; + p_i21143->active = 0; +#ifdef DEBUG + diag_printf("Failed to configure device %d\n",device_index); +#endif + } + } + else { + p_i21143->found = 0; + p_i21143->active = 0; +#ifdef DEBUG + diag_printf("eth%d not found\n", device_index); +#endif + } + } + + if (0 == found_devices) + return 0; + + // Now a delay to ensure the hardware has "come up" before you try to + // use it. + udelay( 1000 ); + return 1; +} + +// ------------------------------------------------------------------------ +// +// Function : i21143_configure +// +// Return : 0 = It worked. +// non0 = It failed. +// ------------------------------------------------------------------------ + +static int i21143_configure(struct i21143* p_i21143, int promisc ) +{ + cyg_uint32 ioaddr; + cyg_uint32 l; + + IF_BAD_21143( p_i21143 ) { +#ifdef DEBUG + diag_printf( "configure: Bad device pointer %x\n", + p_i21143 ); +#endif + return -1; + } + + ioaddr = p_i21143->io_address; + + l = INL( CSR_OPMODE ); + if ( promisc ) + l |= CSR_OPMODE_PROMISC; + else + l &=~ CSR_OPMODE_PROMISC; + OUTL( l, CSR_OPMODE ); + + return 0; +} + +// ------------------------------------------------------------------------ +// +// Function : i21143_ioctl +// +// ------------------------------------------------------------------------ +static int +i21143_ioctl(struct eth_drv_sc *sc, unsigned long key, + void *data, int data_length) +{ + struct i21143 *p_i21143; + + p_i21143 = (struct i21143 *)sc->driver_private; + + IF_BAD_21143( p_i21143 ) { +#ifdef DEBUG + diag_printf( "i21143_ioctl/control: Bad device pointer %x\n", p_i21143 ); +#endif + return -1; + } + +#ifdef DEBUG_TRAFFIC + diag_printf( "i21143_ioctl: device eth%d at %x; key is 0x%x, data at %x[%d]\n", + p_i21143->index, p_i21143, key, data, data_length ); +#endif + + switch ( key ) { + +#ifdef ETH_DRV_SET_MAC_ADDRESS + case ETH_DRV_SET_MAC_ADDRESS: { + int act; + if ( 6 != data_length ) + return -2; + act = p_i21143->active; + i21143_stop( sc ); + eth_set_mac_address( p_i21143, data ); + if ( act ) + i21143_start( sc, NULL, 0 ); + return 0; + } +#endif + +#ifdef ETH_DRV_GET_IF_STATS_UD + case ETH_DRV_GET_IF_STATS_UD: // UD == UPDATE +// ETH_STATS_INIT( sc ); // so UPDATE the statistics structure +#endif + // drop through +#ifdef ETH_DRV_GET_IF_STATS + case ETH_DRV_GET_IF_STATS: +#endif +#if defined(ETH_DRV_GET_IF_STATS) || defined (ETH_DRV_GET_IF_STATS_UD) + { + struct ether_drv_stats *p = (struct ether_drv_stats *)data; + int i; + static unsigned char my_chipset[] + = { ETH_DEV_DOT3STATSETHERCHIPSET }; + + strcpy( p->description, CYGDAT_DEVS_ETH_DESCRIPTION ); + CYG_ASSERT( 48 > strlen(p->description), "Description too long" ); + + for ( i = 0; i < SNMP_CHIPSET_LEN; i++ ) + if ( 0 == (p->snmp_chipset[i] = my_chipset[i]) ) + break; + + i = p_i21143->line_status; // use cached copy - else sloooow + + if ( !( i & GEN_STATUS_LINK) ) { + p->operational = 2; // LINK DOWN + p->duplex = 1; // UNKNOWN + p->speed = 0; + } + else { + p->operational = 3; // LINK UP + p->duplex = (i & GEN_STATUS_FDX) ? 3 : 2; // 2 = SIMPLEX, 3 = DUPLEX + p->speed = ((i & GEN_STATUS_100MBPS) ? 100 : 10) * 1000000; + } + +#ifdef KEEP_STATISTICS + { + struct stats *ps = &p_i21143->stats; + + // Admit to it... + p->supports_dot3 = true; + + // Those commented out are not available on this chip. + + p->tx_good = ps->tx_good ; + p->tx_max_collisions = ps->tx_max_collisions ; + p->tx_late_collisions = ps->tx_late_collisions ; + p->tx_underrun = ps->tx_underrun ; + p->tx_carrier_loss = ps->tx_carrier_loss ; + p->tx_deferred = ps->tx_deferred ; + p->tx_sqetesterrors = ps->tx_sqetesterrors ; + p->tx_single_collisions = ps->tx_single_collisions; + p->tx_mult_collisions = ps->tx_mult_collisions ; + p->tx_total_collisions = ps->tx_total_collisions ; + + p->rx_good = ps->rx_good ; + p->rx_crc_errors = ps->rx_crc_errors ; + p->rx_align_errors = ps->rx_align_errors ; + p->rx_resource_errors = ps->rx_resource_errors ; +// p->rx_overrun_errors = ps->rx_overrun_errors ; + p->rx_collisions = ps->rx_collisions ; + p->rx_short_frames = ps->rx_short_frames ; + p->rx_too_long_frames = ps->rx_too_long_frames ; + p->rx_symbol_errors = ps->rx_symbol_errors ; + + p->interrupts = ps->interrupts ; + p->rx_count = ps->rx_count ; + p->rx_deliver = ps->rx_deliver ; + p->rx_resource = ps->rx_resource ; + p->rx_restart = ps->rx_restart ; + + p->tx_count = ps->tx_count ; + p->tx_complete = ps->tx_complete ; + p->tx_dropped = ps->tx_dropped ; + } +#endif // KEEP_STATISTICS + + p->tx_queue_len = 1; + + return 0; // OK + } +#endif + + default: + break; + } + return -1; +} + +// ------------------------------------------------------------------------ + +static void +eth_set_mac_address( struct i21143* p_i21143, cyg_uint8 *addr ) +{ + cyg_uint32 ioaddr = p_i21143->io_address; + cyg_uint32 l; + int i; + volatile BUFDES *bp; + cyg_uint8 *datap; + +#define SETUP_SIZE (192) + + cyg_uint32 buf[ SETUP_SIZE/4 ]; // for word alignment + + // We need to send a pseudo-transmit which contains setup data. + + if ( NULL == addr ) + addr = &p_i21143->mac_address[0]; + else { + p_i21143->mac_address[0] = addr[0]; + p_i21143->mac_address[1] = addr[1]; + p_i21143->mac_address[2] = addr[2]; + p_i21143->mac_address[3] = addr[3]; + p_i21143->mac_address[4] = addr[4]; + p_i21143->mac_address[5] = addr[5]; + } + + if ( ! p_i21143->active ) { + // Then do not torment the hardware - starting + // the interface will do that. + p_i21143->mac_addr_ok = 1; + return; + } + + InitTxRing( p_i21143 ); // Since we are about to use this struct + + bp = p_i21143->tx_ring; + + bp->des0 = DES0_STATUS_OWN_DONE; // Safety: not for the NIC yet + + bp->buf1 = CYGHWR_PCI_VIRT_TO_BUS( ((cyg_uint32)&buf[0]) ); + bp->buf2 = 0; + + datap = (cyg_uint8 *)CYGHWR_BUS_TO_UNCACHED( bp->buf1 ); + + bp->des1 = + DES1_ENDRING | + TDES1_CONTROL_SETUP | + //TDES1_CONTROL_SETUP_FT0 | // 0,0 <=> perfect filtering + //TDES1_CONTROL_SETUP_FT1 | + (SETUP_SIZE << DES1_B1SIZE_SHIFT); + // The filtering type is 00 = perfect filtering of 16 addresses + // (including the broadcast address, I think) + + for ( i = 0; i < SETUP_SIZE ; i++ ) + datap[i] = 0xff; // fill the space with the broadcast address + + // Insert the address: do it in an endian agnostic fashion. + // [If we were doing perfect plus hash table it would be slot + // 13 at offset 156. Lower halfwords only.] + // So we'll use slot 13 anyway; the other slots are all FFs. + + datap[156] = addr[0]; + datap[157] = addr[1]; + datap[158] = addr[1]; + datap[159] = addr[0]; + datap[160] = addr[2]; + datap[161] = addr[3]; + datap[162] = addr[3]; + datap[163] = addr[2]; + datap[164] = addr[4]; + datap[165] = addr[5]; + datap[166] = addr[5]; + datap[167] = addr[4]; + + // Make the rest be null links + for ( i = 1; i < TX_DESCRIPTORS; i++ ) { + int x; + p_i21143->tx_ring[ i ].buf1 = 0; + p_i21143->tx_ring[ i ].buf2 = 0; + x = 0; // zero size for both buffers + if ( (TX_DESCRIPTORS-1) == i ) + x |= DES1_ENDRING; + p_i21143->tx_ring[ i ].des1 = x; + p_i21143->tx_ring[ i ].des0 = DES0_STATUS_OWN_OPEN; + } + + // Tell the device the address + OUTL( CYGHWR_PCI_VIRT_TO_BUS( (cyg_uint32)bp ), CSR_TXBASE ); + // Open the descriptor to the device + bp->des0 = DES0_STATUS_OWN_OPEN; + +#ifdef DEBUG_MAC + dump_tx_details( p_i21143, "set_mac starting:" ); +#endif + // And set it going + l = INL( CSR_OPMODE ); + l |= CSR_OPMODE_TX_START; + OUTL( l, CSR_OPMODE ); + + // Wait for the buffer to be closed + for ( i = 0; i < 10000; i++ ) + if ( DES0_STATUS_OWN_DONE == (DES0_STATUS_OWN & bp->des0) ) + break; +#ifdef DEBUG_MAC + diag_printf( "eth_set_mac_address: %d loops: bufdesc status tdes0 %08x, tdes1 %08x\n", + i, bp->des0, bp->des1 ); +#endif + + // Wait for it to be done + for ( i = 0; i < 10000; i++ ) { + l = INL( CSR_STATUS ); + if ( ((CSR_STATUS_TXSTATUS & l) == CSR_STATUS_TXSTATUS_STOPPED) || + ((CSR_STATUS_TXSTATUS & l) == CSR_STATUS_TXSTATUS_SUSPENDED) ) + break; + } + +#ifdef DEBUG_MAC + diag_printf( "eth_set_mac_address: tx done after %d iters; status %x\n", + i, l ); +#endif + +#ifdef DEBUG_MAC + dump_tx_details( p_i21143, "set_mac all done:" ); +#endif + + // Kill the tx engine + l = INL( CSR_OPMODE ); + l &=~ CSR_OPMODE_TX_START; + OUTL( l, CSR_OPMODE ); + + for ( i = 0; i < 10000; i++ ) { + l = INL( CSR_STATUS ); + if ( ((CSR_STATUS_TXSTATUS & l) == CSR_STATUS_TXSTATUS_STOPPED) ) + break; + } +#ifdef DEBUG_MAC + diag_printf( "eth_set_mac_address: tx stopped after %d iters; status %x\n", + i, l ); +#endif + + // Acknowledge all the interrupts from these activities + // within the device: + OUTL( 0xffffffff, CSR_STATUS ); // clear all bits + + p_i21143->mac_addr_ok = 1; + +} + +// ------------------------------------------------------------------------ +// +// MDIO +// +// Device-specific bit-twiddling and line driving side-effects + +// CYGACC_CALL_IF_DELAY_US() drags in huge amounts of scheduler locking and +// the like 'cos it's a VV call! We only want a delay of 1uS tops, so: + +#define MII_DELAY() do { int z; for ( z = 0; z < 20; z++ ) ; } while (0) + +#if 0 +# define MII_PRINTF diag_printf +# define MII_STUFF "%4s | %4s | %4s | %4s [%08x]\n", \ + (l & (1<<19)) ? "MDI" : "---", \ + (l & (1<<18)) ? "Read" : "Wr", \ + (l & (1<<17)) ? "MDO" : "---", \ + (l & (1<<16)) ? "CLK" : "clk", \ + l +#else +# define MII_PRINTF( foo ) +# define MII_STUFF +#endif + +static inline void mii_clock_up( int ioaddr ) +{ + cyg_uint32 l; + l = INL( CSR_ROM_MII_MGT ); + l |= CSR_ROM_MII_MGT_MDC; + OUTL( l, CSR_ROM_MII_MGT ); + MII_PRINTF( "mii_clock_up : " MII_STUFF ); + MII_DELAY(); +} + +static inline void mii_clock_down( int ioaddr ) +{ + cyg_uint32 l; + l = INL( CSR_ROM_MII_MGT ); + l &=~ CSR_ROM_MII_MGT_MDC; + OUTL( l, CSR_ROM_MII_MGT ); + MII_PRINTF( "mii_clock_down: " MII_STUFF ); + MII_DELAY(); +} + +static inline void mii_read_mode( int ioaddr ) +{ + cyg_uint32 l; + l = INL( CSR_ROM_MII_MGT ); + l |= CSR_ROM_MII_MGT_MOM_READ; + OUTL( l, CSR_ROM_MII_MGT ); + MII_PRINTF( "mii_read_mode : " MII_STUFF ); + MII_DELAY(); +} + +static inline int mii_read_data_bit( int ioaddr ) +{ + cyg_uint32 l; + l = INL( CSR_ROM_MII_MGT ); + MII_PRINTF( "mii_read_data : " MII_STUFF ); + return CSR_ROM_MII_MGT_MDI == (CSR_ROM_MII_MGT_MDI & l); +} + +static inline void mii_write_data_bit( int ioaddr, int databit ) +{ + cyg_uint32 l; + l = INL( CSR_ROM_MII_MGT ); + if ( databit ) + l |= CSR_ROM_MII_MGT_MDO; + else + l &=~ CSR_ROM_MII_MGT_MDO; + l &=~ CSR_ROM_MII_MGT_MOM; // drive the mdio line + OUTL( l, CSR_ROM_MII_MGT ); + MII_PRINTF( "mii_write_data: " MII_STUFF ); + MII_DELAY(); +} + +// Pass ioaddr around "invisibly" +#define MII_CLOCK_UP() mii_clock_up(ioaddr) +#define MII_CLOCK_DOWN() mii_clock_down(ioaddr) +#define MII_READ_MODE() mii_read_mode(ioaddr) +#define MII_READ_DATA_BIT() mii_read_data_bit(ioaddr) +#define MII_WRITE_DATA_BIT( _d_ ) mii_write_data_bit(ioaddr,(_d_)) + +// ------------------------------------------------------------------------ +// +// MDIO +// +// Management data over the MII interface - nasty hand driven serial stuff +// + +static void mii_write_bits( int ioaddr, int val, int bitcount ) +{ + int i; + // These are deliberately signed ints so that we can send an overlong + // preamble if we want by saying "send -1 of width 40 bits and relying + // on sign extension. + for ( i = bitcount - 1; i >= 0; i-- ) { + MII_CLOCK_DOWN(); + MII_WRITE_DATA_BIT( (val >> i) & 1 ); + MII_CLOCK_UP(); + } +} + +static int mii_read_bits( int ioaddr, int bitcount ) +{ + int i; + int val = 0; + for ( i = bitcount - 1; i >= 0; i-- ) { + MII_CLOCK_DOWN(); + val <<= 1; + val |= MII_READ_DATA_BIT(); + MII_CLOCK_UP(); + } + return val; +} + +#define MII_WRITE_BITS( val, bitcount ) mii_write_bits( ioaddr, val, bitcount ) +#define MII_READ_BITS( bitcount ) mii_read_bits( ioaddr, bitcount ) + +// Now define subsections of the protocol in terms of the above + +#define MII_WRITE_PREAMBLE() MII_WRITE_BITS( -1, 40 ) // >32 x 1s +#define MII_WRITE_START() MII_WRITE_BITS( 1, 2 ) // 01 +#define MII_WRITE_WRITE_CMD() MII_WRITE_BITS( 1, 2 ) // 01 +#define MII_WRITE_READ_CMD() MII_WRITE_BITS( 2, 2 ) // 10 + +#define PHY_ADDRESS (1) + +#define MII_WRITE_PHY_ADDR() MII_WRITE_BITS( PHY_ADDRESS, 5 ) +#define MII_WRITE_REGNUM( _r_ ) MII_WRITE_BITS( (_r_), 5 ) + +#define MII_WRITE_TURNAROUND() MII_WRITE_BITS( 2, 2 ) + +#define MII_READ_TURNAROUND() CYG_MACRO_START \ + MII_READ_MODE(); /* to turn off driving the line */ \ + (void)(MII_READ_BITS( 2 )); /* discard TA "bits" */ \ +CYG_MACRO_END + +#define MII_IDLE() CYG_MACRO_START \ + MII_READ_MODE(); /* to turn off driving the line */ \ + ((void)MII_READ_BITS( 5 )); /* extra clocks in Hi-Z mode */ \ + MII_CLOCK_DOWN(); \ +CYG_MACRO_END + +#define MII_READ_REGVAL() MII_READ_BITS( 16 ) +#define MII_WRITE_REGVAL( _v_ ) MII_WRITE_BITS( (_v_), 16 ) + +static int mii_read_register( int ioaddr, int regnum ) +{ + int value; + MII_WRITE_PREAMBLE(); + MII_WRITE_START(); + MII_WRITE_READ_CMD(); + MII_WRITE_PHY_ADDR(); + MII_WRITE_REGNUM( regnum ); + MII_READ_TURNAROUND(); + value = MII_READ_REGVAL(); + MII_IDLE(); + return value; +} + +static void mii_write_register( int ioaddr, int regnum, int value ) +{ + MII_WRITE_PREAMBLE(); + MII_WRITE_START(); + MII_WRITE_WRITE_CMD(); + MII_WRITE_PHY_ADDR(); + MII_WRITE_REGNUM( regnum ); + MII_WRITE_TURNAROUND(); + MII_WRITE_REGVAL( value ); + MII_IDLE(); +} + +// ------------------------------------------------------------------------ +// +// Serial EEPROM access - much like the other Intel ethernet +// + +// CYGACC_CALL_IF_DELAY_US() drags in huge amounts of scheduler locking and +// the like 'cos it's a VV call! Waste of time, mostly. + +#define EE_DELAY() do { int z; for ( z = 0; z < 0x1000; z++ ) ; } while (0) + +#if 0 +# define EE_PRINTF diag_printf +# define EE_STUFF "%4s | %4s | %4s | %4s [%08x]\n", \ + (l & (1<<2)) ? "eeDI" : "---", \ + (l & (1<<0)) ? "eeCS" : "--", \ + (l & (1<<3)) ? "eeDO" : "---", \ + (l & (1<<1)) ? "CLK" : "clk", \ + l & 0xfffff +#else +# define EE_PRINTF( foo ) +# define EE_STUFF +#endif + + +static inline void ee_select( int ioaddr ) +{ + cyg_uint32 l; + l = CSR_ROM_MII_MGT_SR | CSR_ROM_MII_MGT_RD + | CSR_ROM_MII_MGT_MOM_READ; // Keep MII in read mode + OUTL( l, CSR_ROM_MII_MGT ); + EE_DELAY(); + l |= CSR_ROM_MII_MGT_SR_CS; + OUTL( l, CSR_ROM_MII_MGT ); + EE_PRINTF( "ee_select : " EE_STUFF ); + EE_DELAY(); +} + +static inline void ee_deselect( int ioaddr ) +{ + cyg_uint32 l; + l = CSR_ROM_MII_MGT_SR | CSR_ROM_MII_MGT_RD + | CSR_ROM_MII_MGT_MOM_READ; // Keep MII in read mode + OUTL( l, CSR_ROM_MII_MGT ); + EE_PRINTF( "ee_deselect 1: " EE_STUFF ); + EE_DELAY(); + EE_DELAY(); + EE_DELAY(); + l = 0 + | CSR_ROM_MII_MGT_MOM_READ; // Keep MII in read mode + OUTL( l, CSR_ROM_MII_MGT ); + EE_PRINTF( "ee_deselect 2: " EE_STUFF ); + EE_DELAY(); + EE_DELAY(); + EE_DELAY(); +} + +static inline void ee_clock_up( int ioaddr ) +{ + cyg_uint32 l; + l = INL( CSR_ROM_MII_MGT ); + l |= CSR_ROM_MII_MGT_SR_CK; + OUTL( l, CSR_ROM_MII_MGT ); + EE_PRINTF( "ee_clock_up : " EE_STUFF ); + EE_DELAY(); +} + +static inline void ee_clock_down( int ioaddr ) +{ + cyg_uint32 l; + l = INL( CSR_ROM_MII_MGT ); + l &=~ CSR_ROM_MII_MGT_SR_CK; + OUTL( l, CSR_ROM_MII_MGT ); + EE_PRINTF( "ee_clock_down: " EE_STUFF ); + EE_DELAY(); +} + +static inline int ee_read_data_bit( int ioaddr ) +{ + cyg_uint32 l; + l = INL( CSR_ROM_MII_MGT ); + EE_PRINTF( "ee_read_data : " EE_STUFF ); + return CSR_ROM_MII_MGT_SR_DO == (CSR_ROM_MII_MGT_SR_DO & l); +} + +static inline void ee_write_data_bit( int ioaddr, int databit ) +{ + cyg_uint32 l; + l = INL( CSR_ROM_MII_MGT ); + if ( databit ) + l |= CSR_ROM_MII_MGT_SR_DI; + else + l &=~ CSR_ROM_MII_MGT_SR_DI; + OUTL( l, CSR_ROM_MII_MGT ); + EE_PRINTF( "ee_write_data: " EE_STUFF ); + EE_DELAY(); +} + +// Pass ioaddr around "invisibly" +#define EE_SELECT() ee_select(ioaddr) +#define EE_DESELECT() ee_deselect(ioaddr) +#define EE_CLOCK_UP() ee_clock_up(ioaddr) +#define EE_CLOCK_DOWN() ee_clock_down(ioaddr) +#define EE_READ_DATA_BIT() ee_read_data_bit(ioaddr) +#define EE_WRITE_DATA_BIT( _d_ ) ee_write_data_bit(ioaddr,(_d_)) + +// ------------------------------------------------------------------------ + +static int +get_eeprom_size( int ioaddr ) +{ + int i, addrbits, tmp; + + // Should already be not-selected, but anyway: + EE_SELECT(); + + // Shift the read command bits out. + for (i = 3; i >= 0; i--) { // Doc says to shift out a zero then: + tmp = (6 & (1 << i)) ? 1 : 0; // "6" is the "read" command. + EE_WRITE_DATA_BIT(tmp); + EE_CLOCK_UP(); + EE_CLOCK_DOWN(); + } + // Now clock out address zero, looking for the dummy 0 data bit + for ( i = 1; i <= 12; i++ ) { + EE_WRITE_DATA_BIT(0); + EE_CLOCK_UP(); + tmp = EE_READ_DATA_BIT(); + EE_CLOCK_DOWN(); + if ( !tmp ) + break; + } + +#ifdef DEBUG_EE + diag_printf( "eeprom data bits %d\n", i ); +#endif + + if ( 6 != i && 8 != i && 1 != i) { +#ifdef DEBUG_EE + diag_printf( "*****EEPROM data bits not 6, 8 or 1*****\n" ); +#endif + addrbits = 1; // Flag no eeprom here. + } + else + addrbits = i; + + // read in the data regardless + tmp = 0; + for (i = 15; i >= 0; i--) { + EE_CLOCK_UP(); + if ( EE_READ_DATA_BIT() ) + tmp |= (1<= 0; i--) { // Doc says to shift out a zero then: + tmp = (6 & (1 << i)) ? 1 : 0; // "6" is the "read" command. + EE_WRITE_DATA_BIT(tmp); + EE_CLOCK_UP(); + EE_CLOCK_DOWN(); + } + // Now clock out address + for ( i = addrbits - 1; i >= 0 ; i-- ) { + tmp = (address & (1<= 0; i--) { + EE_CLOCK_UP(); + if ( EE_READ_DATA_BIT() ) + tmp |= (1< + + * src/if_i82544.c: Don't call PacketRxReady in standalone configuration + unless ready to accept a packet. Limit packet delivery to one packet at + a time in standalone configuration. + +2002-02-22 Mark Salter + + * src/if_i82544.c: Remove unnecessary eth_dsr declaration. + +2002-02-19 Mark Salter + + * src/if_i82544.c (pci_init_find_82544s): Don't use IRQ support if + CYGPKG_IO_ETH_DRIVERS_STAND_ALONE. + +2002-01-22 Mark Salter + + * src/if_i82544.c (i82544_send): Add HAL_DCACHE_STORE before passing + buffer to NIC. + +2002-01-21 Mark Salter + + * cdl/intel_i82544_eth_drivers.cdl: Add + CYGNUM_DEVS_ETH_INTEL_I82544_MAX_RX_DESCRIPTORS and + CYGNUM_DEVS_ETH_INTEL_I82544_MAX_TX_DESCRIPTORS. + + * src/if_i82544.c: Add appropriate BUS_TO_VIRT and VIRT_TO_BUS + conversions. + Remove check that assumes driver owns entire PCI window. + (i82544_setup): Add option to use auto-speed detection. + +2001-11-27 Nick Garnett + + * cdl/intel_i82544_eth_drivers.cdl: + * include/i82544_info.h: + * src/if_i82544.c: + Created driver by copying i82559 driver and editing. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + + + diff --git a/packages/devs/eth/intel/i82544/current/cdl/intel_i82544_eth_drivers.cdl b/packages/devs/eth/intel/i82544/current/cdl/intel_i82544_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/intel/i82544/current/cdl/intel_i82544_eth_drivers.cdl @@ -0,0 +1,183 @@ +# ==================================================================== +# +# intel_i82544_eth_drivers.cdl +# +# Intel 82544 ethernet driver +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): nickg, from i82559 original +# Original data: hmt +# Contributors: hmt, gthomas, jskov +# Date: 2001-10-25 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_INTEL_I82544 { + display "Intel 82544 ethernet driver" + description "Ethernet driver for Intel 82544 Gigabit controller." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + + active_if CYGINT_DEVS_ETH_INTEL_I82544_REQUIRED + + include_dir cyg/devs/eth + + # SNMP demands to know stuff; this sadly makes us break the neat + # abstraction of the device having nothing exported. + include_files include/i82544_info.h + # and tell them that it is available + define_proc { + puts $::cdl_system_header \ + "#define CYGBLD_DEVS_ETH_DEVICE_H " + + puts $::cdl_header "#include CYGDAT_DEVS_ETH_INTEL_I82544_CFG"; + } + + compile -library=libextras.a if_i82544.c + + cdl_option CYGDBG_DEVS_ETH_INTEL_I82544_CHATTER { + display "Prints ethernet device status info during startup" + default_value 0 + description " + The ethernet device initialization code can print lots of info + to confirm that it has found the devices on the PCI bus, read + the MAC address from EEPROM correctly, and so on, and also + displays the mode (10/100MHz, half/full duplex) of the + connection." + } + + cdl_option CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT { + display "Number of supported interfaces." + calculated { CYGINT_DEVS_ETH_INTEL_I82544_REQUIRED } + flavor data + description " + This option selects the number of PCI ethernet interfaces to + be supported by the driver." + } + + cdl_component CYGDBG_DEVS_ETH_INTEL_I82544_KEEP_STATISTICS { + display "Keep Ethernet statistics" + default_value 0 + description " + The ethernet device can maintain statistics about the network, + specifically a great variety of error rates which are useful + for network management. SNMP for example uses this + information. There is some performance cost in maintaining + this information; disable this option to recoup that." + + cdl_option CYGDBG_DEVS_ETH_INTEL_I82544_KEEP_82544_STATISTICS { + display "Keep i82544 Internal statistics" + default_value 1 + description " + The i82544 keeps internal counters, and it is possible to + acquire these. But the i82544 (reputedly) does not service + the network whilst uploading the data to RAM from its + internal registers. If throughput is a problem, disable + this option to acquire only those statistics gathered by + software, so that the i82544 never sleeps." + } + } + + cdl_component CYGPKG_DEVS_ETH_INTEL_I82544_WRITE_EEPROM { + display "SIOCSIFHWADDR records MAC address in EEPROM" + default_value 0 + description " + The ioctl() socket call with operand SIOCSIFHWADDR sets the + interface hardware address - the MAC address or ethernet + address. This option causes the new MAC address to be written + into the EEPROM associated with the interface, so that the new + MAC address is permanently recorded. Doing this should be a + carefully chosen decision, hence this option." + } + + cdl_option CYGNUM_DEVS_ETH_INTEL_I82544_MAX_RX_DESCRIPTORS { + display "Maximum number of RX descriptors" + flavor data + default_value { CYGPKG_REDBOOT ? 8 : 128 } + define MAX_RX_DESCRIPTORS + description " + An RX descriptor is used for each ethernet frame required + to be passed to the upper networking layers. This option + sets the maximum number of these. Higher numbers use more + memory, lower numbers will reduce performance. The system + appears to work OK with as few as 8 descriptors but limps + painfully with only 4. Performance is better with more than + 8, but assuming the size of non-cached (so useless for anything + else) memory window is 1Mb, we might as well use it all. + 128 RX and TX descriptors uses the whole 1Mb, near enough." + } + + cdl_option CYGNUM_DEVS_ETH_INTEL_I82544_MAX_TX_DESCRIPTORS { + display "Maximum number of TX descriptors" + flavor data + default_value { CYGPKG_REDBOOT ? 8 : 128 } + define MAX_TX_DESCRIPTORS + description " + A TX descriptor is used for each ethernet frame passed down + from upper networking layers for transmission. This option + sets the maximum number of these. Higher numbers use more + memory, lower numbers will reduce performance. The system + appears to work OK with as few as 8 descriptors but limps + painfully with only 4. Performance is better with more than + 8, but assuming the size of non-cached (so useless for anything + else) memory window is 1Mb, we might as well use it all. + 128 RX and TX descriptors uses the whole 1Mb, near enough." + } + + cdl_component CYGPKG_DEVS_ETH_INTEL_I82544_OPTIONS { + display "Intel 82544 ethernet driver build options" + flavor none + no_define + + cdl_option CYGPKG_DEVS_ETH_INTEL_I82544_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL -D__ECOS" } + description " + This option modifies the set of compiler flags for + building the Intel 82544 ethernet driver + package. These flags are used in addition to the set of + global flags." + } + } +} +# EOF intel_i82544_eth_drivers.cdl diff --git a/packages/devs/eth/intel/i82544/current/include/i82544_info.h b/packages/devs/eth/intel/i82544/current/include/i82544_info.h new file mode 100644 --- /dev/null +++ b/packages/devs/eth/intel/i82544/current/include/i82544_info.h @@ -0,0 +1,212 @@ +#ifndef CYGONCE_DEVS_ETH_INTEL_I82544_INFO_H +#define CYGONCE_DEVS_ETH_INTEL_I82544_INFO_H +/*========================================================================== +// +// i82544_info.h +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 2000-05-03 +// Description: +// +//####DESCRIPTIONEND#### +*/ + +#include + +#ifdef CYGDBG_DEVS_ETH_INTEL_I82544_KEEP_STATISTICS +# define KEEP_STATISTICS +# define nDISPLAY_STATISTICS +# define nDISPLAY_82544_STATISTICS +#else +# define nKEEP_STATISTICS +# define nDISPLAY_STATISTICS +# define nDISPLAY_82544_STATISTICS +#endif + + +// ------------------------------------------------------------------------ +// +// STATISTICAL COUNTER STRUCTURE +// +// ------------------------------------------------------------------------ +#ifdef KEEP_STATISTICS +typedef struct { +/* 0 */ cyg_uint32 tx_good; +/* 4 */ cyg_uint32 tx_max_collisions; +/* 8 */ cyg_uint32 tx_late_collisions; +/* 12 */ cyg_uint32 tx_underrun; +/* 16 */ cyg_uint32 tx_carrier_loss; +/* 20 */ cyg_uint32 tx_deferred; +/* 24 */ cyg_uint32 tx_single_collisions; +/* 28 */ cyg_uint32 tx_mult_collisions; +/* 32 */ cyg_uint32 tx_total_collisions; +/* 36 */ cyg_uint32 rx_good; +/* 40 */ cyg_uint32 rx_crc_errors; +/* 44 */ cyg_uint32 rx_align_errors; +/* 48 */ cyg_uint32 rx_resource_errors; +/* 52 */ cyg_uint32 rx_overrun_errors; +/* 56 */ cyg_uint32 rx_collisions; // Always 0 +/* 60 */ cyg_uint32 rx_short_frames; +// In this setup; can also be flow-control counts after. +// If these are to be used, a config command (as in set promiscuous mode) +// must be issued at start, to let those stats escape. Params are in +// comments around the config command setup... +/* 64 */ cyg_uint32 done; +} I82544_COUNTERS; + + +typedef struct { + cyg_uint32 interrupts; + cyg_uint32 rx_count; + cyg_uint32 rx_deliver; + cyg_uint32 rx_resource; + cyg_uint32 rx_restart; + cyg_uint32 tx_count; + cyg_uint32 tx_complete; + cyg_uint32 tx_dropped; +} STATISTICS; + + +extern STATISTICS statistics[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT]; +#ifdef CYGDBG_DEVS_ETH_INTEL_I82544_KEEP_82544_STATISTICS +extern I82544_COUNTERS i82544_counters[CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT]; +#endif + +#endif // KEEP_STATISTICS + +// ------------------------------------------------------------------------ +// +// DEVICES AND PACKET QUEUES +// +// ------------------------------------------------------------------------ +// The system seems to work OK with as few as 8 of RX and TX descriptors. +// It limps very painfully with only 4. +// Performance is better with more than 8. +// But the size of non-cached (so useless for anything else) +// memory window is 1Mb, so we might as well use it all. +// +// 128 for these uses the whole 1Mb, near enough. + +#ifndef MAX_RX_DESCRIPTORS +#define MAX_RX_DESCRIPTORS 128 // number of Rx descriptors +#endif +#ifndef MAX_TX_DESCRIPTORS +#define MAX_TX_DESCRIPTORS 128 // number of Tx descriptors +#endif + +typedef struct i82544 { + cyg_uint8 // (split up for atomic byte access) + found:1, // was hardware discovered? + mac_addr_ok:1, // can we bring up? + active:1, // has this if been brung up? + hardwired_esa:1, // set if ESA is hardwired via CDL + spare1:4; + cyg_uint8 // Count nested sends to reject + within_send:8; // nested requests to send + cyg_uint8 + tx_in_progress:1, // transmit in progress flag + tx_queue_full:1, // all Tx descriptors used flag + spare3:6; + + cyg_uint8 index; // 0 or 1 or whatever + cyg_uint32 devid; // PCI device id + cyg_uint32 device; // Device code from hardware + cyg_uint32 io_address; // memory mapped I/O address + cyg_uint8 mac_address[6]; // mac (hardware) address + void *ndp; // Network Device Pointer + + cyg_int32 next_rx_descriptor; // descriptor index for callback + cyg_int32 rx_pointer; // descriptor index for ring head + CYG_ADDRESS rx_ring; // location of Rx descriptors + + cyg_int32 tx_pointer; // next TXB to check for status. + CYG_ADDRESS tx_ring; // location of Tx descriptors + unsigned long tx_keys[MAX_TX_DESCRIPTORS]; // keys for tx q management + + // Interrupt handling stuff + cyg_vector_t vector; // interrupt vector + cyg_handle_t interrupt_handle; // handle for int.handler + cyg_interrupt interrupt_object; + +#ifdef KEEP_STATISTICS + void *p_statistics; // pointer to statistical counters +#endif + + cyg_uint32 platform_timeout; // Some platforms use a timeout + int tx_descriptor_timeout; // Is it fixated on this tx? + +} I82544; + + +// ------------------------------------------------------------------------ +// +// 82544 GENERAL STATUS REGISTER +// +// ------------------------------------------------------------------------ +#define GEN_STATUS_FDX 0x01 // 1 = full duplex, 0 = half +#define GEN_STATUS_BPS 0xC0 // 0 = 10M, 01 = 100M, 10&11 = 1000M +#define GEN_STATUS_BPS_SHIFT 6 +#define GEN_STATUS_LINK 0x02 // 1 = link up, 0 = link down + +extern int i82544_status( struct eth_drv_sc *sc ); + +// ------------------------------------------------------------------------ + +#ifdef KEEP_STATISTICS +void update_statistics(struct i82544* p_i82544); +#endif + + +#ifdef CYGDBG_DEVS_ETH_INTEL_I82544_KEEP_82544_STATISTICS +#define ETH_STATS_INIT( p ) \ + update_statistics( (struct i82544 *)((p)->driver_private) ) +#else +#define ETH_STATS_INIT( p ) // otherwise do nothing +#endif + +#define CYGDAT_DEVS_ETH_DESCRIPTION "Intel Gigabit Ethernet Controller (i82544)" + +#define ETH_DEV_DOT3STATSETHERCHIPSET 1,3,6,1,2,1,10,7,8,2,5 + +#endif /* ifndef CYGONCE_DEVS_ETH_INTEL_I82544_INFO_H */ + +/* EOF i82544_info.h */ + diff --git a/packages/devs/eth/intel/i82544/current/src/if_i82544.c b/packages/devs/eth/intel/i82544/current/src/if_i82544.c new file mode 100644 --- /dev/null +++ b/packages/devs/eth/intel/i82544/current/src/if_i82544.c @@ -0,0 +1,2834 @@ +//========================================================================== +// +// if_i82544.c +// +// Intel 82544 ethernet driver +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or +// other sources, and are covered by the appropriate copyright +// disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, gthomas +// Contributors: Ron Spence, Pacific Softworks, jskov +// Date: 2000-02-01 +// Purpose: +// Description: hardware driver for 82544 Intel PRO/100+ ethernet +// Notes: CU commands such as dump and config should, according +// to the docs, set the CU active state while executing. +// That does not seem to be the case though, and the +// driver polls the completion bit in the packet status +// word instead. +// +// Platform code may provide this vector: +// CYGNUM_DEVS_ETH_INTEL_I82544_SEPARATE_MUX_INTERRUPT if it +// requires the interrupts to be handled via demuxers +// attached to a distinct interrupt. +// +// Platform code may alternatively define: +// CYGHWR_DEVS_ETH_INTEL_I82544_DEMUX_ALL if it is necessary +// to demux all interrupt sources - for example if they are +// wire-or'd together on some hardware but distinct on +// others. In this circumstance it is permitted for +// cyg_pci_translate_interrupt [HAL_PCI_TRANSLATE_INTERRUPT] +// to return invalid for 2nd and subsequent devices. +// +// Platform code can also define these three: +// CYGPRI_DEVS_ETH_INTEL_I82544_MASK_INTERRUPTS(p_i82544,old) +// CYGPRI_DEVS_ETH_INTEL_I82544_UNMASK_INTERRUPTS(p_i82544,old) +// CYGPRI_DEVS_ETH_INTEL_I82544_ACK_INTERRUPTS(p_i82544) +// which are particularly useful when nested interrupt +// management is needed (which is always IMHO). +// +// Platform code can define this: +// CYGHWR_DEVS_ETH_INTEL_I82544_MISSED_INTERRUPT(p_i82544) +// to detect a dropped interrupt and loop again or +// direct-call the DSR to reschedule the delivery routine. +// Only a problem on edge-triggered interrupt systems. +// +// Platform code can also provide this macro: +// CYGPRI_DEVS_ETH_INTEL_I82544_INTERRUPT_ACK_LOOP(p_i82544) +// to handle delaying for acks to register on the interrupt +// controller as necessary on the EBSA. +// +// Platform can define CYGHWR_DEVS_ETH_INTEL_I82544_GET_ESA() +// as an external means to get ESAs, possibly from RedBoot +// configuration info that's stored in flash memory. +// +// Platform def CYGHWR_DEVS_ETH_INTEL_I82544_HAS_NO_EEPROM +// removes all code for dealing with the EEPROM for those +// targets where there is none fitted. Either an external +// means to get ESAs should be used, or we must rely on +// hard-wiring the ESA's into each executable by means of the +// usual CDL configuration. +// +// Platform def CYGHWR_DEVS_ETH_INTEL_I82544_HAS_ONE_EEPROM +// is for hardware with multiple devices, but only one with a +// serial EEPROM installed. The 2nd device would get either +// the same ESA - because they are certain to be on different +// segment and internets - or the same ESA incremented by +// CYGHWR_DEVS_ETH_INTEL_I82544_HAS_ONE_EEPROM_MAC_ADJUST. +// CYGHWR_DEVS_ETH_INTEL_I82544_HAS_ONE_EEPROM should be the +// number (0 or 1) of the device that does have the EEPROM. +// +// CYGHWR_DEVS_ETH_INTEL_I82544_PCIMEM_DISCONTIGUOUS enables +// checking code for breaks in the physical address of PCI +// window memory. This can happen on some boards where a +// smaller SDRAM is fitted than the hardware allows, so some +// higher-order address bits are ignored. We make SDRAM +// contiguous in mapped memory, but what the i82544 sees +// might be discontiguous. The checking code skips any +// allocated chunk who appears to contain such a break, and +// tries again. +// +// CYGHWR_DEVS_ETH_INTEL_I82544_RESET_TIMEOUT( int32 ) +// CYGHWR_DEVS_ETH_INTEL_I82544_TIMEOUT_FIRED( int32 ) if +// both defined give the driver a means to detect that we +// have been fixated on the same transmit operation for too +// long - we missed an interrupt or the device crashed. The +// int32 argument is used to hold a eg. the value of a +// fast-running hardware timer. +// +// Platform def CYGHWR_DEVS_ETH_INTEL_I82544_USE_ASD is +// used to select Auto Speed Detection for setting up the +// link parameters. +// +// FIXME: replace -1/-2 return values with proper E-defines +// FIXME: For 82557/8 compatibility i82544_configure() function +// probably needs some tweaking - config bits differ +// slightly but crucially. +// FIXME: EEPROM code not tested on a BE system. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#ifdef CYGPKG_IO_ETH_DRIVERS +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CYGPKG_NET +#include +#include /* Needed for struct ifnet */ +#endif + +#ifdef CYGPKG_IO_PCI +#include +// So we can check the validity of the PCI window against the MLTs opinion, +// and thereby what the malloc heap consumes willy-nilly: +#include CYGHWR_MEMORY_LAYOUT_H +#else +#error "Need PCI package here" +#endif + +#include + +#include CYGDAT_DEVS_ETH_INTEL_I82544_INL + +// ------------------------------------------------------------------------ + +#ifdef CYGDBG_DEVS_ETH_INTEL_I82544_CHATTER +#define DEBUG_82544 // This one prints stuff as packets come and go +#define DEBUG // Startup printing mainly +#define noDEBUG_EE // Some EEPROM specific retries &c +#endif + +#ifdef CYGDBG_USE_ASSERTS +static struct { + int can_send; + int deliver; + int stats; + int waitcmd_timeouts; + int waitcmd_timeouts_cu; + int lockup_timeouts; + int bad_cu_idles; +} missed_interrupt = { 0,0,0, 0,0, 0, 0 }; +#endif + +#ifndef CYGPKG_REDBOOT + +#define os_printf diag_printf +#define db_printf diag_printf + +#else + +static void os_printf( char *fmt, ... ) +{ + extern int start_console(void); + extern void end_console(int); + va_list a; + int old_console; + va_start( a, fmt ); + old_console = start_console(); + diag_vprintf( fmt, a ); + end_console(old_console); + va_end( a ); +} + +#define db_printf os_printf + +#endif + +// ------------------------------------------------------------------------ +// +// MEMORY ADDRESSING +// +// ------------------------------------------------------------------------ +// Macros for writing shared memory structures - no need for byte flipping + +#define READMEM8( _reg_, _val_ ) ((CYG_BYTE)(_val_) = *((volatile CYG_BYTE *)(_reg_))) +#define WRITEMEM8( _reg_, _val_ ) (*((volatile CYG_BYTE *)(_reg_)) = (CYG_BYTE)(_val_)) +#define READMEM16( _reg_, _val_ ) ((CYG_WORD16)(_val_) = *((volatile CYG_WORD16 *)(_reg_))) +#define WRITEMEM16( _reg_, _val_ ) (*((volatile CYG_WORD16 *)(_reg_)) = (CYG_WORD16)(_val_)) +#define READMEM32( _reg_, _val_ ) ((CYG_WORD32)(_val_) = *((volatile CYG_WORD32 *)(_reg_))) +#define WRITEMEM32( _reg_, _val_ ) (*((volatile CYG_WORD32 *)(_reg_)) = (CYG_WORD32)(_val_)) +#define READMEM64( _reg_, _val_ ) ((CYG_WORD64)(_val_) = *((volatile CYG_WORD64 *)(_reg_))) +#define WRITEMEM64( _reg_, _val_ ) (*((volatile CYG_WORD64 *)(_reg_)) = (CYG_WORD64)(_val_)) + +#define OUTL( _v_, _a_ ) WRITEMEM32( _a_, _v_ ) + +static inline cyg_uint32 INL(cyg_uint32 io_address) + { cyg_uint32 _t_; READMEM32( io_address, _t_ ); return _t_; } + + +// ------------------------------------------------------------------------ +// Map from CPU-view addresses to PCI-bus master's view - however that is: + +#ifdef CYGHWR_INTEL_I82544_PCI_VIRT_TO_BUS + +#define VIRT_TO_BUS( _x_ ) CYGHWR_INTEL_I82544_PCI_VIRT_TO_BUS( _x_ ) +#define BUS_TO_VIRT( _x_ ) CYGHWR_INTEL_I82544_PCI_BUS_TO_VIRT( _x_ ) + +#else // use default mappings: get a physical address to give to the device + +#define VIRT_TO_BUS( _x_ ) virt_to_bus((cyg_uint32)(_x_)) +static inline cyg_uint32 virt_to_bus(cyg_uint32 p_memory) +{ return CYGARC_PHYSICAL_ADDRESS(p_memory); } + +#endif // not defined CYGHWR_INTEL_I82544_PCI_VIRT_TO_BUS + +// ------------------------------------------------------------------------ +// +// 82544 REGISTER OFFSETS +// +// ------------------------------------------------------------------------ + +// General registers +#define I82544_CTRL 0x00000 +#define I82544_STATUS 0x00008 +#define I82544_EECD 0x00010 +#define I82544_CTRL_EXT 0x00018 +#define I82544_MDIC 0x00020 +#define I82544_FCAL 0x00028 +#define I82544_FCAH 0x0002c +#define I82544_FCT 0x00030 +#define I82544_VET 0x00038 +#define I82544_FCTTV 0x00170 +#define I82544_TXCW 0x00178 +#define I82544_RXCW 0x00180 +#define I82544_PBA 0x01000 + +// Interrupt control registers +#define I82544_ICR 0x000c0 +#define I82544_ICS 0x000c8 +#define I82544_IMS 0x000d0 +#define I82544_IMC 0x000d8 + +// Receive registers +#define I82544_RCTL 0x00100 +#define I82544_FCRTL 0x02160 +#define I82544_FCRTH 0x02168 +#define I82544_RDBAL 0x02800 +#define I82544_RDBAH 0x02804 +#define I82544_RDLEN 0x02808 +#define I82544_RDH 0x02810 +#define I82544_RDT 0x02818 +#define I82544_RDTR 0x02820 +#define I82544_RXDCTL 0x02828 +#define I82544_RXCSUM 0x05000 +#define I82544_MTA 0x05200 +#define I82544_RAT 0x05400 +#define I82544_VFTA 0x05600 + +#define I82544_RCTL_EN (1<<1) +#define I82544_RCTL_BAM (1<<15) + +// Transmit registers +#define I82544_TCTL 0x00400 +#define I82544_TIPG 0x00410 +#define I82544_TBT 0x00448 +#define I82544_AIT 0x00458 +#define I82544_TXDMAC 0x03000 +#define I82544_TDBAL 0x03800 +#define I82544_TDBAH 0x03804 +#define I82544_TDLEN 0x03808 +#define I82544_TDH 0x03810 +#define I82544_TDT 0x03818 +#define I82544_TIDV 0x03820 +#define I82544_TXDCTL 0x03828 +#define I82544_TSPMT 0x03830 + + +#define I82544_TCTL_EN (1<<1) +#define I82544_TCTL_PSP (1<<3) + + +// ------------------------------------------------------------------------ +// +// 82544 DEVICE CONTROL WORD DEFNITIONS +// +// ------------------------------------------------------------------------ + +#define I82544_CTRL_FD (1<<0) +#define I82544_CTRL_BEM (1<<1) +#define I82544_CTRL_LRST (1<<3) +#define I82544_CTRL_ASDE (1<<5) +#define I82544_CTRL_SLU (1<<6) +#define I82544_CTRL_ILOS (1<<7) +#define I82544_CTRL_SPEED (3<<8) +#define I82544_CTRL_FRCSPD (1<<11) +#define I82544_CTRL_FRCDPLX (1<<12) +#define I82544_CTRL_SWDPINSLO (15<<18) +#define I82544_CTRL_SWDPINSIO (15<<22) +#define I82544_CTRL_RST (1<<26) +#define I82544_CTRL_RFCE (1<<27) +#define I82544_CTRL_TFCE (1<<28) +#define I82544_CTRL_VME (1<<30) +#define I82544_CTRL_PHY_RST (1<<31) + +#define I82544_CTRL_PHY_RESET (1<<18) +#define I82544_CTRL_PHY_RESET_DIR (1<<22) +#define I82544_CTRL_MDIO (1<<20) +#define I82544_CTRL_MDIO_DIR (1<<24) +#define I82544_CTRL_MDC (1<<21) +#define I82544_CTRL_MDC_DIR (1<<25) + +#define I82544_CTRL_EXT_PHY_RESET4 (1<<4) +#define I82544_CTRL_EXT_PHY_RESET_DIR4 (1<<8) + +#define PHY_ADDRESS 1 + +// ------------------------------------------------------------------------ +// +// 82544 DEVICE STATUS WORD DEFNITIONS +// +// ------------------------------------------------------------------------ + +#define I82544_STATUS_FD 0x0001 +#define I82544_STATUS_LU 0x0002 +#define I82544_STATUS_TXOFF 0x0010 +#define I82544_STATUS_TBIMODE 0x0020 +#define I82544_STATUS_SPEED 0x00C0 +#define I82544_STATUS_ASDV 0x0300 +#define I82544_STATUS_PCI_SPD 0x0800 +#define I82544_STATUS_BUS64 0x1000 +#define I82544_STATUS_PCIX_MODE 0x2000 +#define I82544_STATUS_PCIXSPD 0xC000 + +// ------------------------------------------------------------------------ +// +// 82544 EEPROM INTERFACE +// +// ------------------------------------------------------------------------ + +// EEPROM_Ctrl bits. +#define EE_SHIFT_CLK 0x01 // EEPROM shift clock. +#define EE_CS 0x02 // EEPROM chip select. +#define EE_DATA_WRITE 0x04 // EEPROM chip data in. +#define EE_DATA_READ 0x08 // EEPROM chip data out. +#define EE_ENB (0x10|EE_CS) + + +// ------------------------------------------------------------------------ +// +// RECEIVE DESCRIPTORS +// +// ------------------------------------------------------------------------ + +#define I82544_RD_BUFFER 0 +#define I82544_RD_LENGTH 8 +#define I82544_RD_CSUM 10 +#define I82544_RD_STATUS 12 +#define I82544_RD_ERRORS 13 +#define I82544_RD_SPECIAL 14 +#define I82544_RD_SIZE 16 + +#define I82544_RD_STATUS_DD (1<<0) +#define I82544_RD_STATUS_EOP (1<<1) +#define I82544_RD_STATUS_IXSM (1<<2) +#define I82544_RD_STATUS_VP (1<<3) +#define I82544_RD_STATUS_TCPCS (1<<5) +#define I82544_RD_STATUS_IPCS (1<<6) +#define I82544_RD_STATUS_PIF (1<<7) + +// ------------------------------------------------------------------------ +// +// TRANSMIT DESCRIPTORS +// +// ------------------------------------------------------------------------ + +// Currently we only use the legacy Tx descriptor + +#define I82544_TD_BUFFER 0 +#define I82544_TD_LENGTH 8 +#define I82544_TD_CSO 10 +#define I82544_TD_CMD 11 +#define I82544_TD_STATUS 12 +#define I82544_TD_CSS 13 +#define I82544_TD_SPECIAL 14 +#define I82544_TD_SIZE 16 + +#define I82544_TD_CMD_EOP (1<<0) +#define I82544_TD_CMD_IFCS (1<<1) +#define I82544_TD_CMD_IC (1<<2) +#define I82544_TD_CMD_RS (1<<3) +#define I82544_TD_CMD_RPS (1<<4) +#define I82544_TD_CMD_DEXT (1<<5) +#define I82544_TD_CMD_VLE (1<<6) +#define I82544_TD_CMD_IDE (1<<7) + +#define I82544_TD_STATUS_DD (1<<0) +#define I82544_TD_STATUS_EC (1<<1) +#define I82544_TD_STATUS_LC (1<<2) +#define I82544_TD_STATUS_TU (1<<3) + +// ------------------------------------------------------------------------ +// +// DEVICES AND PACKET QUEUES +// +// ------------------------------------------------------------------------ + +#define MAX_RX_PACKET_SIZE 1536 // maximum Rx packet size +#define MAX_TX_PACKET_SIZE 1536 // maximum Tx packet size + + +// ------------------------------------------------------------------------ +// Use arrays provided by platform header to verify pointers. + +#ifdef CYGDBG_USE_ASSERTS +#define CHECK_NDP_SC_LINK() \ + CYG_MACRO_START \ + int i, valid_netdev = 0, valid_sc = 0; \ + for(i = 0; i < CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT; i++) { \ + if (i82544_netdev_array[i] == ndp) valid_netdev = 1; \ + if (i82544_sc_array[i] == sc) valid_sc = 1; \ + if (valid_sc || valid_netdev) break; \ + } \ + CYG_ASSERT( valid_netdev, "Bad ndp" ); \ + CYG_ASSERT( valid_sc, "Bad sc" ); \ + CYG_ASSERT( (void *)p_i82544 == i82544_sc_array[i]->driver_private, \ + "sc pointer bad" ); \ + CYG_MACRO_END +#else +#define CHECK_NDP_SC_LINK() +#endif + +#define IF_BAD_82544( _p_ ) \ +if (({ \ + int i, valid_p = 0; \ + for(i = 0; i < CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT; i++) { \ + if (i82544_priv_array[i] == (_p_)) { \ + valid_p = 1; \ + break; \ + } \ + } \ + CYG_ASSERT(valid_p, "Bad pointer-to-i82544"); \ + (!valid_p); \ +})) + +// ------------------------------------------------------------------------ +// +// Managing the memory that is windowed onto the PCI bus +// +// ------------------------------------------------------------------------ + +static cyg_uint32 i82544_heap_size; +static cyg_uint8 *i82544_heap_base; +static cyg_uint8 *i82544_heap_free; + +static void *mem_reserved_ioctl = (void*)0; +// uncacheable memory reserved for ioctl calls + +// ------------------------------------------------------------------------ +// +// FUNCTION PROTOTYPES +// +// ------------------------------------------------------------------------ + +static int pci_init_find_82544s(void); + +static void i82544_reset(struct i82544* p_i82544); +static void i82544_setup(struct i82544* p_i82544); +static int eth_set_mac_address(struct i82544* p_i82544, cyg_uint8 *addr, int eeprom ); + +static void InitRxRing(struct i82544* p_i82544); +static void InitTxRing(struct i82544* p_i82544); + +static cyg_uint32 +eth_isr(cyg_vector_t vector, cyg_addrword_t data); + +static int i82544_configure(struct i82544* p_i82544, int promisc, int oversized); + +// debugging/logging only: +//void dump_txcb(TxCB* p_txcb); +void DisplayStatistics(void); +void update_statistics(struct i82544* p_i82544); +//void dump_rfd(RFD* p_rfd, int anyway ); +void dump_all_rfds( int intf ); +void dump_packet(cyg_uint8 *p_buffer, int length); + +static void i82544_stop( struct eth_drv_sc *sc ); + +// ------------------------------------------------------------------------ + +static void +udelay(int delay) +{ + // Calling via the IF interface does not call hal_delay_us() as + // required. God only knows why, I cannot be bothered to find out + // why at present, so for now call hal_delay_us() directly. + +// CYGACC_CALL_IF_DELAY_US(delay); + extern void hal_delay_us( int ); + hal_delay_us( delay ); +} + +// ------------------------------------------------------------------------ +// If we are demuxing for all interrupt sources, we must mask and unmask +// *all* interrupt sources together. + +static inline int +Mask82544Interrupt(struct i82544* p_i82544) +{ + cyg_drv_interrupt_mask(p_i82544->vector); + + return 1; +} + +static inline void +UnMask82544Interrupt(struct i82544* p_i82544, int old) +{ + if (old & 1) + cyg_drv_interrupt_unmask(p_i82544->vector); +} + + +static inline void +Acknowledge82544Interrupt(struct i82544* p_i82544) +{ + cyg_drv_interrupt_acknowledge(p_i82544->vector); +} + +// ------------------------------------------------------------------------ +// Memory management +// +// Simply carve off from the front of the PCI mapped window into real memory + +static CYG_ADDRESS +pciwindow_mem_alloc(int size) +{ + CYG_ADDRESS p_memory; + int _size = size; + +#ifdef DEBUG +// db_printf("pciwindow_mem_alloc %d\n",size); +#endif + + CYG_ASSERT( + (CYGHWR_INTEL_I82544_PCI_MEM_MAP_BASE <= (int)i82544_heap_free) + && + ((CYGHWR_INTEL_I82544_PCI_MEM_MAP_BASE + + CYGHWR_INTEL_I82544_PCI_MEM_MAP_SIZE) > (int)i82544_heap_free) + && + (0 < i82544_heap_size) + && + (CYGHWR_INTEL_I82544_PCI_MEM_MAP_SIZE >= i82544_heap_size) + && + (CYGHWR_INTEL_I82544_PCI_MEM_MAP_BASE == (int)i82544_heap_base), + "Heap variables corrupted" ); + + p_memory = 0; + size = (size + 3) & ~3; + if ( (i82544_heap_free+size) < (i82544_heap_base+i82544_heap_size) ) { + cyg_uint32 *p; + p_memory = (CYG_ADDRESS)i82544_heap_free; + i82544_heap_free += size; + for ( p = (cyg_uint32 *)p_memory; _size > 0; _size -= 4 ) + *p++ = 0; + } + + CYG_ASSERT( + NULL == p_memory || + VIRT_TO_BUS( p_memory ) + size == VIRT_TO_BUS( i82544_heap_free ), + "Discontiguous PCI memory in real addresses" ); + + return p_memory; +} + + +// ------------------------------------------------------------------------ +// +// MDIO +// +// Device-specific bit-twiddling and line driving side-effects + +// CYGACC_CALL_IF_DELAY_US() drags in huge amounts of scheduler locking and +// the like 'cos it's a VV call! We only want a delay of 1uS tops, so: + +#define MII_DELAY() do { int z; for ( z = 0; z < 100; z++ ) ; } while (0) + +#if 0 +# define MII_PRINTF diag_printf +# define MII_STUFF "%4s | %4s | %4s | %4s [%08x]\n", \ + (*_ctrl & (1<<20)) ? "MDIO" : "---", \ + (*_ctrl & (1<<24)) ? "Wr" : "Rd", \ + (*_ctrl & (1<<21)) ? "CLK" : "clk", \ + *_ctrl +#else +# define MII_PRINTF( foo ) +# define MII_STUFF +#endif + +static inline cyg_uint32 mii_init( int ioaddr ) +{ + cyg_uint32 ctrl; + cyg_uint32 *_ctrl = &ctrl; + *_ctrl = INL( ioaddr + I82544_CTRL ); + *_ctrl &=~ I82544_CTRL_MDC; + *_ctrl |= I82544_CTRL_MDC_DIR; + *_ctrl &= ~I82544_CTRL_MDIO_DIR; + *_ctrl &= ~I82544_CTRL_MDIO; + OUTL( *_ctrl, ioaddr + I82544_CTRL ); + MII_PRINTF( "mii_init : " MII_STUFF ); + MII_DELAY(); + return *_ctrl; +} + +static inline void mii_clock_up( int ioaddr, cyg_uint32 *_ctrl ) +{ + *_ctrl |= I82544_CTRL_MDC; + OUTL( *_ctrl, ioaddr + I82544_CTRL ); + MII_PRINTF( "mii_clock_up : " MII_STUFF ); + MII_DELAY(); +} + +static inline void mii_clock_down( int ioaddr, cyg_uint32 *_ctrl ) +{ + *_ctrl &=~ I82544_CTRL_MDC; + OUTL( *_ctrl, ioaddr + I82544_CTRL ); + MII_PRINTF( "mii_clock_down: " MII_STUFF ); + MII_DELAY(); +} + +static inline void mii_read_mode( int ioaddr, cyg_uint32 *_ctrl ) +{ + *_ctrl &= ~I82544_CTRL_MDIO_DIR; + *_ctrl &= ~I82544_CTRL_MDIO; + OUTL( *_ctrl, ioaddr + I82544_CTRL ); + MII_PRINTF( "mii_read_mode : " MII_STUFF ); + MII_DELAY(); +} + +static inline int mii_read_data_bit( int ioaddr, cyg_uint32 *_ctrl ) +{ + *_ctrl = INL( ioaddr + I82544_CTRL ); + MII_PRINTF( "mii_read_data : " MII_STUFF ); + return I82544_CTRL_MDIO == (I82544_CTRL_MDIO & *_ctrl); +} + +static inline void mii_write_data_bit( int ioaddr, int databit, cyg_uint32 *_ctrl ) +{ + if ( databit ) + *_ctrl |= I82544_CTRL_MDIO; + else + *_ctrl &= ~I82544_CTRL_MDIO; + *_ctrl |= I82544_CTRL_MDIO_DIR; // drive the mdio line + OUTL( *_ctrl, ioaddr + I82544_CTRL ); + MII_PRINTF( "mii_write_data: " MII_STUFF ); + MII_DELAY(); +} + +// Pass ioaddr around "invisibly" +#define MII_INIT() cyg_uint32 _ctrl_val = mii_init(ioaddr); \ + cyg_uint32 *_ctrl = &_ctrl_val; + +#define MII_CLOCK_UP() mii_clock_up(ioaddr, _ctrl) +#define MII_CLOCK_DOWN() mii_clock_down(ioaddr, _ctrl) +#define MII_READ_MODE() mii_read_mode(ioaddr, _ctrl) +#define MII_READ_DATA_BIT() mii_read_data_bit(ioaddr, _ctrl) +#define MII_WRITE_DATA_BIT( _d_ ) mii_write_data_bit(ioaddr,(_d_),_ctrl) + +// ------------------------------------------------------------------------ +// +// MDIO +// +// Management data over the MII interface - nasty hand driven serial stuff +// + +static void mii_write_bits( int ioaddr, int val, int bitcount, cyg_uint32 *_ctrl ) +{ + int i; + // These are deliberately signed ints so that we can send an overlong + // preamble if we want by saying "send -1 of width 40 bits" and relying + // on sign extension. + for ( i = bitcount - 1; i >= 0; i-- ) { + MII_WRITE_DATA_BIT( (val >> i) & 1 ); + MII_DELAY(); + MII_CLOCK_UP(); + MII_CLOCK_DOWN(); + } +} + +static int mii_read_bits( int ioaddr, int bitcount, cyg_uint32 *_ctrl ) +{ + int i; + int val = 0; + for ( i = bitcount - 1; i >= 0; i-- ) { + MII_CLOCK_DOWN(); + val <<= 1; + val |= MII_READ_DATA_BIT(); + MII_CLOCK_UP(); + } + return val; +} + +#define MII_WRITE_BITS( val, bitcount ) mii_write_bits( ioaddr, val, bitcount, _ctrl ) +#define MII_READ_BITS( bitcount ) mii_read_bits( ioaddr, bitcount, _ctrl ) + +// Now define subsections of the protocol in terms of the above + +#define MII_WRITE_PREAMBLE() MII_WRITE_BITS( -1, 32 ) // >32 x 1s +#define MII_WRITE_START() MII_WRITE_BITS( 1, 2 ) // 01 +#define MII_WRITE_WRITE_CMD() MII_WRITE_BITS( 1, 2 ) // 01 +#define MII_WRITE_READ_CMD() MII_WRITE_BITS( 2, 2 ) // 10 + +#define MII_WRITE_PHY_ADDR(_p_) MII_WRITE_BITS( _p_, 5 ) +#define MII_WRITE_REGNUM( _r_ ) MII_WRITE_BITS( (_r_), 5 ) + +#define MII_WRITE_TURNAROUND() MII_WRITE_BITS( 2, 2 ) + +#define MII_READ_TURNAROUND() CYG_MACRO_START \ + MII_READ_MODE(); /* to turn off driving the line */ \ + (void)(MII_READ_BITS( 2 )); /* discard TA "bits" */ \ +CYG_MACRO_END + +#define MII_IDLE() CYG_MACRO_START \ + MII_READ_MODE(); /* to turn off driving the line */ \ + ((void)MII_READ_BITS( 5 )); /* extra clocks in Hi-Z mode */ \ + MII_CLOCK_DOWN(); \ +CYG_MACRO_END + +#define MII_READ_REGVAL() MII_READ_BITS( 16 ) +#define MII_WRITE_REGVAL( _v_ ) MII_WRITE_BITS( (_v_), 16 ) + +static int mii_read_register( struct i82544 *p_i82544, int phy, int regnum ) +{ + int value = 0; + cyg_uint32 ioaddr = p_i82544->io_address; + + if( p_i82544->device == 0x1004 ) + { + // An 82543, read MII register via software defined pins in + // CTRL register. + + MII_INIT(); + MII_WRITE_PREAMBLE(); + MII_WRITE_START(); + MII_WRITE_READ_CMD(); + MII_WRITE_PHY_ADDR(phy); + MII_WRITE_REGNUM( regnum ); + MII_READ_TURNAROUND(); + value = MII_READ_REGVAL(); + MII_IDLE(); + } + else if( p_i82544->device == 0x1008 ) + { + // An 82544, read MII register via MDIC register. + // UNTESTED + + cyg_uint32 mdic = (2<<26) | (phy<<21) | (regnum<<16); + + OUTL( mdic, ioaddr + I82544_MDIC ); + + // Wait for ready + do + { + mdic = INL( ioaddr + I82544_MDIC ); + } while( (mdic & (1<<28)) == 0 ); + + value = mdic & 0xFFFF; + } + return value; +} + +static void mii_write_register( struct i82544 *p_i82544, int phy, int regnum, int value ) +{ + cyg_uint32 ioaddr = p_i82544->io_address; + + if( p_i82544->device == 0x1004 ) + { + // An 82543, write MII register via software defined pins in + // CTRL register. + + MII_INIT(); + MII_WRITE_PREAMBLE(); + MII_WRITE_START(); + MII_WRITE_WRITE_CMD(); + MII_WRITE_PHY_ADDR(phy); + MII_WRITE_REGNUM( regnum ); + MII_WRITE_TURNAROUND(); + MII_WRITE_REGVAL( value ); + MII_IDLE(); + } + else if( p_i82544->device == 0x1008 ) + { + // An 82544, write MII register via MDIC register. + // UNTESTED + + cyg_uint32 mdic = (1<<26) | (phy<<21) | (regnum<<16) | (value&0xFFFF); + + OUTL( mdic, ioaddr + I82544_MDIC ); + + // Wait for ready + do + { + mdic = INL( ioaddr + I82544_MDIC ); + } while( (mdic & (1<<28)) == 0 ); + } +} + +// dump out the PHY registers +static void show_phy( struct i82544 *p_i82544, int phy ) +{ + int i; + + os_printf("PHY %d regs:",phy); + for( i = 0; i < 32; i++ ) + { + cyg_uint32 mdic; + + mdic = mii_read_register( p_i82544, phy, i ); + + if( (i%8)==0 ) os_printf("\n"); + + os_printf("%04x ",mdic); + } + os_printf("\n"); +} + +// ------------------------------------------------------------------------ +// +// GET EEPROM SIZE +// +// ------------------------------------------------------------------------ + +// ------------------------------------------------------------------------ +// +// Serial EEPROM access - much like the other Intel ethernet +// + +// CYGACC_CALL_IF_DELAY_US() drags in huge amounts of scheduler locking and +// the like 'cos it's a VV call! Waste of time, mostly. + +#define EE_DELAY() do { int z; for ( z = 0; z < 10000; z++ ) ; } while (0) + +#if 0 +# define EE_PRINTF diag_printf +# define EE_STUFF "%4s | %4s | %4s | %4s [%08x]\n", \ + (l & EE_SHIFT_CLK) ? "CLK" : "clk", \ + (l & EE_CS) ? "eeCS" : "--", \ + (l & EE_DATA_WRITE) ? "eeDW" : "---", \ + (l & EE_DATA_READ) ? "eeDR" : "---", \ + l & 0xfffff +#else +# define EE_PRINTF( foo ) +# define EE_STUFF +#endif + + +static inline void ee_select( int ioaddr ) +{ + cyg_uint32 l; + l = EE_ENB; + OUTL( l, ioaddr + I82544_EECD ); + EE_DELAY(); + l |= EE_CS; + OUTL( l, ioaddr + I82544_EECD ); + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_select : " EE_STUFF ); + EE_DELAY(); +} + +static inline void ee_deselect( int ioaddr ) +{ + cyg_uint32 l; + l = EE_ENB; + OUTL( l, ioaddr + I82544_EECD ); + EE_PRINTF( "ee_deselect 1 : " EE_STUFF ); + EE_DELAY(); + EE_DELAY(); + EE_DELAY(); + l = EE_ENB & ~EE_CS; + OUTL( l, ioaddr + I82544_EECD ); + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_deselect 2 : " EE_STUFF ); + EE_DELAY(); + EE_DELAY(); + EE_DELAY(); +} + +static inline void ee_clock_up( int ioaddr ) +{ + cyg_uint32 l; + l = INL( ioaddr + I82544_EECD ); + l |= EE_SHIFT_CLK; + OUTL( l, ioaddr + I82544_EECD ); + EE_DELAY(); + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_clock_up : " EE_STUFF ); + EE_DELAY(); +} + +static inline void ee_clock_down( int ioaddr ) +{ + cyg_uint32 l; + l = INL( ioaddr + I82544_EECD ); + l &=~ EE_SHIFT_CLK; + OUTL( l, ioaddr + I82544_EECD ); + EE_DELAY(); + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_clock_down : " EE_STUFF ); + EE_DELAY(); +} + +static inline int ee_read_data_bit( int ioaddr ) +{ + cyg_uint32 l; + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_read_data : " EE_STUFF ); + return EE_DATA_READ == (EE_DATA_READ & l); +} + +static inline void ee_write_data_bit( int ioaddr, int databit ) +{ + cyg_uint32 l; + l = INL( ioaddr + I82544_EECD ); + if ( databit ) + l |= EE_DATA_WRITE; + else + l &= ~EE_DATA_WRITE; + OUTL( l, ioaddr + I82544_EECD ); + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_write_data : " EE_STUFF ); + EE_DELAY(); +} + +// Pass ioaddr around "invisibly" +#define EE_SELECT() ee_select(ioaddr) +#define EE_DESELECT() ee_deselect(ioaddr) +#define EE_CLOCK_UP() ee_clock_up(ioaddr) +#define EE_CLOCK_DOWN() ee_clock_down(ioaddr) +#define EE_READ_DATA_BIT() ee_read_data_bit(ioaddr) +#define EE_WRITE_DATA_BIT( _d_ ) ee_write_data_bit(ioaddr,(_d_)) + +// ------------------------------------------------------------------------ + +static int +get_eeprom_size( struct i82544 *p_i82544 ) +{ +// int i, addrbits, tmp; +// cyg_uint32 ioaddr = p_i82544->io_address; + +#ifdef DEBUG_EE + diag_printf( "get_eeprom_size\n" ); +#endif + +#if 1 + return 6; +#else + // Should already be not-selected, but anyway: + EE_SELECT(); + +#ifdef DEBUG_EE + diag_printf( "send command\n" ); +#endif + + // Shift the read command bits out. + for (i = 3; i >= 0; i--) { // Doc says to shift out a zero then: + tmp = (6 & (1 << i)) ? 1 : 0; // "6" is the "read" command. + EE_WRITE_DATA_BIT(tmp); + EE_CLOCK_UP(); + EE_CLOCK_DOWN(); + } +#ifdef DEBUG_EE + diag_printf( "send address zero\n" ); +#endif + // Now clock out address zero, looking for the dummy 0 data bit + for ( i = 1; i <= 12; i++ ) { + EE_WRITE_DATA_BIT(0); + EE_CLOCK_UP(); + tmp = EE_READ_DATA_BIT(); + EE_CLOCK_DOWN(); + if ( !tmp ) + break; + } + +#ifdef DEBUG_EE + diag_printf( "eeprom data bits %d\n", i ); +#endif + + if ( 6 != i && 8 != i && 1 != i) { +#ifdef DEBUG_EE + diag_printf( "*****EEPROM data bits not 6, 8 or 1*****\n" ); +#endif + addrbits = 1; // Flag no eeprom here. + } + else + addrbits = i; + + // read in the data regardless + tmp = 0; + for (i = 15; i >= 0; i--) { + EE_CLOCK_UP(); + if ( EE_READ_DATA_BIT() ) + tmp |= (1<io_address; + + // Should already be not-selected, but anyway: + EE_SELECT(); + + // Shift the read command bits out. + for (i = 3; i >= 0; i--) { // Doc says to shift out a zero then: + tmp = (6 & (1 << i)) ? 1 : 0; // "6" is the "read" command. + EE_WRITE_DATA_BIT(tmp); + EE_CLOCK_UP(); + EE_CLOCK_DOWN(); + } + + // Now clock out address + for ( i = addrbits - 1; i >= 0 ; i-- ) { + tmp = (address & (1<= 0; i--) { + EE_CLOCK_UP(); + if ( EE_READ_DATA_BIT() ) + tmp |= (1<device_instance); + p_i82544 = (struct i82544 *)(sc->driver_private); + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG + os_printf( "Bad device private pointer %x\n", sc->driver_private ); +#endif + return 0; + } + + CHECK_NDP_SC_LINK(); + + if ( 0 == initialized++ ) { + // then this is the first time ever: + if ( ! pci_init_find_82544s() ) { +#ifdef DEBUG + os_printf( "pci_init_find_82544s failed" ); +#endif + return 0; + } + } + + // If this device is not present, exit + if (0 == p_i82544->found) + return 0; + + p_i82544->mac_addr_ok = 0; + + ioaddr = p_i82544->io_address; // get I/O address for 82544 + +#ifdef DEBUG + os_printf("Init82544 %d @ %x\n", p_i82544->index, (int)ndp); +#endif + + // Reset device + i82544_reset(p_i82544); + + i82544_setup(p_i82544); + + InitRxRing(p_i82544); + InitTxRing(p_i82544); + + + if (p_i82544->hardwired_esa) { + // Hardwire the address without consulting the EEPROM. + // When this flag is set, the p_i82544 will already contain + // the ESA. Copy it to a mac_address for call to set_mac_addr + mac_address[0] = p_i82544->mac_address[0]; + mac_address[1] = p_i82544->mac_address[1]; + mac_address[2] = p_i82544->mac_address[2]; + mac_address[3] = p_i82544->mac_address[3]; + mac_address[4] = p_i82544->mac_address[4]; + mac_address[5] = p_i82544->mac_address[5]; + + eth_set_mac_address(p_i82544, mac_address, 0); + + } else { + + // Acquire the ESA either from extenal means (probably RedBoot + // variables) or from the attached EEPROM - if there is one. + +#ifdef CYGHWR_DEVS_ETH_INTEL_I82544_GET_ESA + int ok = false; + CYGHWR_DEVS_ETH_INTEL_I82544_GET_ESA( p_i82544, mac_address, ok ); + if ( ok ) + eth_set_mac_address(p_i82544, mac_address, 0); + +#else // ! CYGHWR_DEVS_ETH_INTEL_I82544_GET_ESA + +#ifndef CYGHWR_DEVS_ETH_INTEL_I82544_HAS_NO_EEPROM + int addr_length, i; + cyg_uint16 checksum; + + // read eeprom and get 82544's mac address + addr_length = get_eeprom_size(p_i82544); + // (this is the length of the *EEPROM*s address, not MAC address) + + // If length is 1, it _probably_ means there's no EEPROM + // present. Couldn't find an explicit mention of this in the + // docs, but length=1 appears to be the behaviour in that case. + if (1 == addr_length) { +#ifdef DEBUG_EE + os_printf("Error: No EEPROM present for device %d\n", + p_i82544->index); +#endif + } else { + for (checksum = 0, i = 0, count = 0; count < 64; count++) { + cyg_uint16 value; + // read word from eeprom + value = read_eeprom_word(p_i82544, addr_length, count); +#ifdef DEBUG_EE + os_printf( "%02x: %04x\n", count, value ); +#endif + checksum += value; + if (count < 3) { + mac_address[i++] = value & 0xFF; + mac_address[i++] = (value >> 8) & 0xFF; + } + } + +#ifndef CYGHWR_DEVS_ETH_INTEL_I82544_HAS_ONE_EEPROM_WITHOUT_CRC + // If the EEPROM checksum is wrong, the MAC address read + // from the EEPROM is probably wrong as well. In that + // case, we don't set mac_addr_ok, but continue the + // initialization. If then somebody calls i82544_start + // without calling eth_set_mac_address() first, we refuse + // to bring up the interface, because running with an + // invalid MAC address is not a very brilliant idea. + + if ((checksum & 0xFFFF) != 0xBABA) { + // selftest verified checksum, verify again +#ifdef DEBUG_EE + os_printf("Warning: Invalid EEPROM checksum %04X for device %d\n", + checksum, p_i82544->index); +#endif + } else // trailing block +#endif + { + p_i82544->mac_addr_ok = 1; +#ifdef DEBUG_EE + os_printf("Valid EEPROM checksum\n"); +#endif + eth_set_mac_address(p_i82544, mac_address, 0); + } + } + + // record the MAC address in the device structure + p_i82544->mac_address[0] = mac_address[0]; + p_i82544->mac_address[1] = mac_address[1]; + p_i82544->mac_address[2] = mac_address[2]; + p_i82544->mac_address[3] = mac_address[3]; + p_i82544->mac_address[4] = mac_address[4]; + p_i82544->mac_address[5] = mac_address[5]; + +#endif // ! CYGHWR_DEVS_ETH_INTEL_I82544_HAS_NO_EEPROM +#endif // ! CYGHWR_DEVS_ETH_INTEL_I82544_GET_ESA + } + +#ifdef DEBUG + os_printf("i82544_init: MAC Address = %02X %02X %02X %02X %02X %02X\n", + p_i82544->mac_address[0], p_i82544->mac_address[1], + p_i82544->mac_address[2], p_i82544->mac_address[3], + p_i82544->mac_address[4], p_i82544->mac_address[5]); +#endif + + // and record the net dev pointer + p_i82544->ndp = (void *)ndp; + + p_i82544->within_send = 0; // init recursion level + + // Initialize upper level driver + if ( p_i82544->mac_addr_ok ) + (sc->funs->eth_drv->init)(sc, &(p_i82544->mac_address[0]) ); + else + (sc->funs->eth_drv->init)(sc, NULL ); + + +#ifdef DEBUG + + os_printf("CTRL %08x\n",INL( ioaddr + I82544_CTRL )); + os_printf("STATUS %08x\n",INL( ioaddr + I82544_STATUS )); + +#endif + + return (1); +} + +// ------------------------------------------------------------------------ +// +// Function : i82544_setup +// +// ------------------------------------------------------------------------ + +static void +i82544_setup( struct i82544 *p_i82544 ) +{ + cyg_uint32 ioaddr; + cyg_uint32 ctrl; + cyg_uint32 ctrl_ext; + + ioaddr = p_i82544->io_address; // get 82544's I/O address + + +#ifdef CYGHWR_DEVS_ETH_INTEL_I82544_USE_ASD + // Use Auto-negotiation + + ctrl = INL( ioaddr + I82544_CTRL ); + + // Set link up bit + ctrl |= I82544_CTRL_SLU | I82544_CTRL_ASDE; + ctrl &= ~(I82544_CTRL_ILOS | I82544_CTRL_FRCSPD | I82544_CTRL_FRCDPLX); + OUTL( ctrl, ioaddr + I82544_CTRL ); + udelay(20); + + // wait up to 5 seconds for link to come up + { + int delay_cnt = 500; + while ((mii_read_register( p_i82544, PHY_ADDRESS, 1 ) & 0x4) == 0) { + udelay(10000); + if (--delay_cnt <= 0) + break; + } + } + +#else + // The following sequence of resets and bit twiddling seem to be + // necessary to get the 82543 working. Not sure what is necessary + // for the 82544. + + ctrl = INL( ioaddr + I82544_CTRL ); + + // Set link up bit + ctrl |= I82544_CTRL_SLU; + ctrl &= ~I82544_CTRL_ILOS; + OUTL( ctrl, ioaddr + I82544_CTRL ); + udelay(20); + + // Force PHY physical reset + // We can only access the PHY after we have done this. + + ctrl_ext = INL( ioaddr + I82544_CTRL_EXT ); + ctrl_ext |= I82544_CTRL_EXT_PHY_RESET_DIR4; + OUTL( ctrl_ext, ioaddr + I82544_CTRL_EXT ); + udelay( 20000 ); + + ctrl_ext = INL( ioaddr + I82544_CTRL_EXT ); + ctrl_ext &= ~I82544_CTRL_EXT_PHY_RESET4; + OUTL( ctrl_ext, ioaddr + I82544_CTRL_EXT ); + udelay( 20000 ); + + ctrl_ext = INL( ioaddr + I82544_CTRL_EXT ); + ctrl_ext |= I82544_CTRL_EXT_PHY_RESET4; + OUTL( ctrl_ext, ioaddr + I82544_CTRL_EXT ); + udelay( 20000 ); + +#ifdef DEBUG + show_phy( p_i82544, PHY_ADDRESS ); +#endif + +#if 0 + // Reset PHY + // Does not appear to be necessary. + { + cyg_uint16 phy_ctrl; + phy_ctrl = mii_read_register( p_i82544, PHY_ADDRESS, 0 ); + phy_ctrl = 0x9000; +// os_printf("PHY ctrl %04x\n",phy_ctrl); + mii_write_register( p_i82544, PHY_ADDRESS, 0, phy_ctrl ); + do { + phy_ctrl = mii_read_register( p_i82544, PHY_ADDRESS, 0 ); +// os_printf("PHY ctrl %04x\n",phy_ctrl); + } while( phy_ctrl & 0x8000 ); + } + show_phy( p_i82544, PHY_ADDRESS ); +#endif + +#if 0 + // Tinker with PHY configuration. + // Only on 82543? May not be necessary at all, since disabling + // this does not see to make any difference. + { + cyg_uint16 data; + + // Set CRS on Tx bit in PHY specific CR + data = mii_read_register( p_i82544, PHY_ADDRESS, 16 ); + os_printf("PSCR %04x\n",data); + data |= 0x0800; + mii_write_register( p_i82544, PHY_ADDRESS, 16, data ); + + // Set TX clock to 25MHz in PHY extended CR + data = mii_read_register( p_i82544, PHY_ADDRESS, 20 ); + os_printf("PSECR %04x\n",data); + data |= 0x0070; + mii_write_register( p_i82544, PHY_ADDRESS, 20, data ); + } + show_phy( p_i82544, PHY_ADDRESS ); +#endif + +#if 1 + // Force speed renegotiation. + + { + cyg_uint16 phy_ctrl; + cyg_uint16 phy_stat; + + phy_ctrl = mii_read_register( p_i82544, PHY_ADDRESS, 0 ); + phy_ctrl |= 0x1200; +// os_printf("PHY ctrl %04x\n",phy_ctrl); + mii_write_register( p_i82544, PHY_ADDRESS, 0, phy_ctrl ); + // Wait for it to complete + do { + udelay(100); + phy_stat = mii_read_register( p_i82544, PHY_ADDRESS, 1 ); + phy_stat = mii_read_register( p_i82544, PHY_ADDRESS, 1 ); + } while( (phy_stat & 0x0020) == 0 ); + } + +#ifdef DEBUG + show_phy( p_i82544, PHY_ADDRESS ); +#endif +#endif + +#if 0 + // Reset link + OUTL( ctrl | I82544_CTRL_LRST, ioaddr + I82544_CTRL ); + udelay(20); + OUTL( ctrl, ioaddr + I82544_CTRL ); + udelay(20); + show_phy( p_i82544, PHY_ADDRESS ); +#endif + + + + // Transfer speed and duplicity settings from PHY to MAC + + // In theory the MAC is supposed to auto-configure from what the + // PHY has autonegotiated. In practice this does not seem to work + // (on the 82543 at least, it always thinks it is 1000MHz full + // duplex) and we have to transfer the settings from the PHY by + // hand. Additionally, the settings in the PHY ctrl register seem + // bogus, so we read the values out of the PHY specific status + // register instead. + + { + cyg_uint16 phy_pssr; + + phy_pssr = mii_read_register( p_i82544, PHY_ADDRESS, 17 ); + + ctrl = INL( ioaddr + I82544_CTRL ); +// os_printf("CTRL %08x\n",ctrl); + ctrl &= ~(I82544_CTRL_SPEED | I82544_CTRL_FD); + if( phy_pssr & (1<<13) ) + ctrl |= I82544_CTRL_FD; + + // Transfer speed + ctrl |= ((phy_pssr>>14)&3)<<8; + + ctrl |= I82544_CTRL_FRCDPLX | I82544_CTRL_FRCSPD; + + OUTL( ctrl, ioaddr + I82544_CTRL ); +// os_printf("CTRL %08x\n",ctrl); + } + + +#if 0 +#ifdef DEBUG + { + int status = i82544_status( sc ); + static int speed[4] = { 10, 100, 1000, 1000 }; + os_printf("i82544_start %d flg %x Link = %s, %d Mbps, %s Duplex\n", + p_i82544->index, + *(int *)p_i82544, + status & GEN_STATUS_LINK ? "Up" : "Down", + speed[(status & GEN_STATUS_BPS)>>GEN_STATUS_BPS_SHIFT], + status & GEN_STATUS_FDX ? "Full" : "Half"); + } +#endif +#endif + + // Hang around here for a bit to let the device settle down. We + // don't seem to get away without this. + + udelay( 1000000 ); + +#if 0 + + // Having done all that, the interface still does not work + // properly, UNLESS I now wait >= 45 seconds here. After that it + // seems happy. I cannot find any difference in the state of the + // PHY or the 82543 to explain this. + + show_phy( p_i82544, PHY_ADDRESS ); + os_printf("CTRL %08x\n",INL( ioaddr + I82544_CTRL )); + os_printf("STATUS %08x\n",INL( ioaddr + I82544_STATUS )); + os_printf("ICR %08x\n",INL( ioaddr + I82544_ICR )); + os_printf("RCTL %08x\n",INL( ioaddr + I82544_RCTL )); + os_printf("TCTL %08x\n",INL( ioaddr + I82544_TCTL )); + + os_printf("Waiting 45 seconds\n"); + { + int i; + cyg_uint32 status = INL( ioaddr + I82544_STATUS ); +// for( i = 0; i < 60; i++ ) // works +// for( i = 0; i < 45; i++ ) // works +// for( i = 0; i < 40; i++ ) // fails +// for( i = 0; i < 35; i++ ) // fails +// for( i = 0; i < 30; i++ ) // fails + { + cyg_uint32 s; + PC_WRITE_SCREEN_32( 60, i ); + udelay(1000000); + s = INL( ioaddr + I82544_STATUS ); + if( s != status ) + { + os_printf("%d STATUS change %08x\n",i,s); + status = s; + } + } + } + + show_phy( p_i82544, PHY_ADDRESS ); + os_printf("CTRL %08x\n",INL( ioaddr + I82544_CTRL )); + os_printf("STATUS %08x\n",INL( ioaddr + I82544_STATUS )); + os_printf("ICR %08x\n",INL( ioaddr + I82544_ICR )); + os_printf("RCTL %08x\n",INL( ioaddr + I82544_RCTL )); + os_printf("TCTL %08x\n",INL( ioaddr + I82544_TCTL )); + +#endif +#endif // CYGHWR_DEVS_ETH_INTEL_I82544_USE_ASD + + // Set up interrupts + + // Clear any pending interrupts + ctrl = INL( ioaddr + I82544_ICR ); + + // clear all mask bits + OUTL( 0xFFFFFFFF, ioaddr + I82544_IMC ); + + // Set interrupt bits for: + // 1 = Transmit queue empty + // 7 = Receiver timeout interrupt + OUTL( (1<<1)|(1<<7), ioaddr + I82544_IMS ); + +} + +// ------------------------------------------------------------------------ +// +// Function : i82544_start +// +// ------------------------------------------------------------------------ + +static void +i82544_start( struct eth_drv_sc *sc, unsigned char *enaddr, int flags ) +{ + struct i82544 *p_i82544; + cyg_uint32 ioaddr; + cyg_uint32 txctl, rxctl; + +#ifdef CYGPKG_NET + struct ifnet *ifp = &sc->sc_arpcom.ac_if; +#endif +#ifdef DEBUG + db_printf("i82544_start\n"); +#endif + + p_i82544 = (struct i82544 *)sc->driver_private; + ioaddr = p_i82544->io_address; // get 82544's I/O address + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG + os_printf( "i82544_start: Bad device pointer %x\n", p_i82544 ); +#endif + return; + } + + if ( ! p_i82544->mac_addr_ok ) { +#ifdef DEBUG + os_printf("i82544_start %d: invalid MAC address, " + "can't bring up interface\n", + p_i82544->index ); +#endif + return; + } + + if ( p_i82544->active ) + i82544_stop( sc ); + + // Enable device + p_i82544->active = 1; + + /* Enable promiscuous mode if requested, reception of oversized frames always. + * The latter is needed for VLAN support and shouldn't hurt even if we're not + * using VLANs. + */ + i82544_configure(p_i82544, 0 +#ifdef CYGPKG_NET + || !!(ifp->if_flags & IFF_PROMISC) +#endif +#ifdef ETH_DRV_FLAGS_PROMISC_MODE + || !!(flags & ETH_DRV_FLAGS_PROMISC_MODE) +#endif + , 1); + + // enable receiver + rxctl = INL( ioaddr + I82544_RCTL ); + rxctl |= I82544_RCTL_EN; + OUTL( rxctl, ioaddr + I82544_RCTL ); + + // Enable transmitter + txctl = INL( ioaddr + I82544_TCTL ); + txctl |= I82544_TCTL_EN; + OUTL( txctl, ioaddr + I82544_TCTL ); + +} + +// ------------------------------------------------------------------------ +// +// Function : i82544_status +// +// ------------------------------------------------------------------------ +int +i82544_status( struct eth_drv_sc *sc ) +{ + int status; + struct i82544 *p_i82544; + cyg_uint32 ioaddr; +#ifdef DEBUG + db_printf("i82544_status\n"); +#endif + + p_i82544 = (struct i82544 *)sc->driver_private; + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG + os_printf( "i82544_status: Bad device pointer %x\n", p_i82544 ); +#endif + return 0; + } + + ioaddr = p_i82544->io_address; // get 82544's I/O address + + status = INL(ioaddr + I82544_STATUS); + + return status; +} + +// ------------------------------------------------------------------------ +// +// Function : BringDown82544 +// +// ------------------------------------------------------------------------ + +static void +i82544_stop( struct eth_drv_sc *sc ) +{ + struct i82544 *p_i82544; + cyg_uint32 ioaddr; + cyg_uint32 txctl, rxctl; + +#ifdef DEBUG + db_printf("i82544_stop\n"); +#endif + + p_i82544 = (struct i82544 *)sc->driver_private; + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG + os_printf( "i82544_stop: Bad device pointer %x\n", p_i82544 ); +#endif + return; + } + +#ifdef DEBUG + os_printf("i82544_stop %d flg %x\n", p_i82544->index, *(int *)p_i82544 ); +#endif + + p_i82544->active = 0; // stop people tormenting it + + ioaddr = p_i82544->io_address; + + // disable receiver + rxctl = INL( ioaddr + I82544_RCTL ); + rxctl &= ~I82544_RCTL_EN; + OUTL( rxctl, ioaddr + I82544_RCTL ); + + // Enable transmitter + txctl = INL( ioaddr + I82544_TCTL ); + txctl &= ~I82544_TCTL_EN; + OUTL( txctl, ioaddr + I82544_TCTL ); + +} + + +// ------------------------------------------------------------------------ +// +// Function : InitRxRing +// +// ------------------------------------------------------------------------ + +static void +InitRxRing(struct i82544* p_i82544) +{ + int i; + CYG_ADDRESS rxring; + cyg_uint32 ioaddr = p_i82544->io_address; + cyg_uint32 rxctl; + +#ifdef DEBUG_82544 + os_printf("InitRxRing %d\n", p_i82544->index); +#endif + + // Allocate array of Rx desriptors + rxring = pciwindow_mem_alloc( + MAX_RX_DESCRIPTORS * I82544_RD_SIZE + 32 ); + + // assign ring structure, aligning it on a 16 byte boudary. + p_i82544->rx_ring = (rxring + 15) & ~15; + + // Allocate and fill in buffer pointers + for ( i = 0; i < MAX_RX_DESCRIPTORS; i++) { + CYG_ADDRESS rd = p_i82544->rx_ring + (i*I82544_RD_SIZE); + CYG_ADDRESS buf = pciwindow_mem_alloc(MAX_RX_PACKET_SIZE); + WRITEMEM64( rd + I82544_RD_BUFFER, VIRT_TO_BUS(buf) ); + } + + // Set the receiver queue registers + + OUTL( VIRT_TO_BUS(p_i82544->rx_ring), ioaddr + I82544_RDBAL ); + OUTL( 0, ioaddr + I82544_RDBAH ); + OUTL( MAX_RX_DESCRIPTORS * I82544_RD_SIZE, ioaddr + I82544_RDLEN ); + OUTL( 0, ioaddr + I82544_RDH ); + OUTL( MAX_RX_DESCRIPTORS - 5, ioaddr + I82544_RDT ); + + // zero out RAT + + for( i = 0; i < 32; i++ ) + OUTL( 0, ioaddr + I82544_RAT +(i*4) ); + + // Zero out MTA + for( i = 0; i < 128; i++ ) + OUTL( 0, ioaddr + I82544_MTA +(i*4) ); + + // Set up receiver to accept broadcasts + rxctl = INL( ioaddr + I82544_RCTL ); + rxctl |= I82544_RCTL_BAM; + OUTL( rxctl, ioaddr + I82544_RCTL ); + +#ifdef DEBUG_82544 + os_printf("RCTL %08x\n",rxctl); +#endif + + p_i82544->next_rx_descriptor = 0; + p_i82544->rx_pointer = 0; +} + +// ------------------------------------------------------------------------ +// +// Function : PacketRxReady (Called from delivery thread & foreground) +// +// ------------------------------------------------------------------------ + +static void +PacketRxReady(struct i82544* p_i82544) +{ + struct cyg_netdevtab_entry *ndp; + struct eth_drv_sc *sc; + cyg_int32 rxp; + cyg_uint32 ioaddr; + +#ifdef DEBUG_82544 +// db_printf("PacketRxReady\n"); +#endif + + ndp = (struct cyg_netdevtab_entry *)(p_i82544->ndp); + sc = (struct eth_drv_sc *)(ndp->device_instance); + + CHECK_NDP_SC_LINK(); + + ioaddr = p_i82544->io_address; + + + rxp = p_i82544->rx_pointer; + + for(;;) + { + cyg_int32 rxh, rxt; + CYG_ADDRESS dp; + cyg_uint8 status; + + rxh = INL( ioaddr + I82544_RDH ); + +#if 0 //def DEBUG_82544 + os_printf("rxp %04d rxh %04x\n",rxp,rxh); +#endif + + // If the head pointer has not advanced, there have been no + // packets received. + if( rxh == rxp ) + break; + + // Form packet address + dp = p_i82544->rx_ring + (rxp * I82544_RD_SIZE); + + // Get status + READMEM8( dp + I82544_RD_STATUS, status ); + +#if 0 //def DEBUG_82544 + { + cyg_uint16 length; + READMEM16( dp + I82544_RD_LENGTH, length ); + os_printf("rxp %04d status %02x length %d\n",rxp,status,length); + } +#endif + + if( status & I82544_RD_STATUS_EOP ) + { + cyg_uint16 length; + + READMEM16( dp + I82544_RD_LENGTH, length ); + +#ifdef DEBUG_82544 + os_printf("rxp %04d length %d\n",rxp,length); +#endif + CYG_ASSERT( MAX_RX_PACKET_SIZE >= length, "Oversize Rx" ); + + // tell the callback the right packet + p_i82544->next_rx_descriptor = rxp; + +#ifdef CYGPKG_NET + if ( length > sizeof( struct ether_header ) ) + // then it is acceptable; offer the data to the network stack +#endif + (sc->funs->eth_drv->recv)( sc, length ); + + // All done! + } + + // Advance rxp pointer + rxp = ( rxp + 1 ) % MAX_RX_DESCRIPTORS; + + // We can now also advance the tail pointer by 1 + rxt = INL( ioaddr + I82544_RDT ); + dp = p_i82544->rx_ring + (rxt * I82544_RD_SIZE); + WRITEMEM8( dp + I82544_RD_STATUS, status ); + rxt = ( rxt + 1 ) % MAX_RX_DESCRIPTORS; + OUTL( rxt, ioaddr + I82544_RDT ); + +#ifdef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + // Can't deliver more than one packet in polled standalone mode + break; +#endif + } + + // Save next rx pointer for next time. + p_i82544->rx_pointer = rxp; + +} + +// and the callback function + +static void +i82544_recv( struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len ) +{ + struct i82544 *p_i82544; + cyg_int32 rxp; + CYG_ADDRESS dp; + CYG_ADDRESS from_p; + cyg_uint16 total_len; + struct eth_drv_sg *last_sg; + +#ifdef DEBUG_82544 + db_printf("i82544_recv\n"); +#endif + + p_i82544 = (struct i82544 *)sc->driver_private; + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG_82544 + os_printf( "i82544_recv: Bad device pointer %x\n", p_i82544 ); +#endif + return; + } + + rxp = p_i82544->next_rx_descriptor; + // Form packet address + dp = p_i82544->rx_ring + (rxp * I82544_RD_SIZE); + +#if 0 //def DEBUG_82544 + { + int i; + os_printf("RxD %08x",dp); + for( i = 0; i < 16; i++ ) + { + cyg_uint8 b; + if( (i%8) == 0 ) os_printf("\n"); + READMEM8( dp + i, b ); + os_printf("%02x ",b); + } + os_printf("\n"); + } +#endif + // Copy the data to the network stack + READMEM64( dp + I82544_RD_BUFFER, from_p ); + from_p = BUS_TO_VIRT(from_p); + READMEM16( dp + I82544_RD_LENGTH, total_len ); + +#ifdef DEBUG_82544 + db_printf("RXP: %04x len %d\n",rxp,total_len); +#endif + + // check we have memory to copy into; we would be called even if + // caller was out of memory in order to maintain our state. + if ( 0 == sg_len || 0 == sg_list ) + return; // caller was out of mbufs + + CYG_ASSERT( 0 < sg_len, "sg_len underflow" ); + CYG_ASSERT( MAX_ETH_DRV_SG >= sg_len, "sg_len overflow" ); + + for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) { + cyg_uint8 *to_p; + int l; + + to_p = (cyg_uint8 *)(sg_list->buf); + l = sg_list->len; + + CYG_ASSERT( 0 <= l, "sg length -ve" ); + + if ( 0 >= l || 0 == to_p ) + return; // caller was out of mbufs + + if ( l > total_len ) + l = total_len; + +#if 0 //def DEBUG_82544 + { + int i,ll = l; + os_printf("Pkt len %d",l); + if( ll > 32 ) ll = 32; + for( i = 0; i < ll; i++ ) + { + cyg_uint8 b; + if( (i%8) == 0 ) os_printf("\n %04x: ",i); + b = ((cyg_uint8 *)from_p)[i]; + os_printf("%02x ",b); + } + os_printf("\n"); + + } +#endif + memcpy( to_p, (unsigned char *)from_p, l ); + from_p += l; + total_len -= l; + } + + CYG_ASSERT( 0 == total_len, "total_len mismatch in rx" ); + CYG_ASSERT( last_sg == sg_list, "sg count mismatch in rx" ); + +} + + +// ------------------------------------------------------------------------ +// +// Function : InitTxRing +// +// ------------------------------------------------------------------------ + +static void +InitTxRing(struct i82544* p_i82544) +{ + int i; + cyg_uint32 ioaddr = p_i82544->io_address; + CYG_ADDRESS txring; + cyg_uint32 txctl; + +#ifdef DEBUG_82544 + os_printf("InitTxRing %d\n", p_i82544->index); +#endif + + // Allocate array of Tx desriptors + txring = pciwindow_mem_alloc( + MAX_TX_DESCRIPTORS * I82544_TD_SIZE + 32 ); + + // assign ring structure, aligning it on a 16 byte boudary. + p_i82544->tx_ring = (txring + 15) & ~15; + + // Allocate and fill in buffer pointers + for ( i = 0; i < MAX_TX_DESCRIPTORS; i++) { + CYG_ADDRESS td = p_i82544->tx_ring + (i*I82544_TD_SIZE); + WRITEMEM64( td + I82544_TD_BUFFER, 0 ); + } + + // Set the transmitter queue registers + + OUTL( VIRT_TO_BUS(p_i82544->tx_ring), ioaddr + I82544_TDBAL ); + OUTL( 0, ioaddr + I82544_TDBAH ); + OUTL( MAX_TX_DESCRIPTORS * I82544_TD_SIZE, ioaddr + I82544_TDLEN ); + OUTL( 0, ioaddr + I82544_TDH ); + OUTL( 0, ioaddr + I82544_TDT ); + + // Set IPG values + OUTL( 8 | (8<<10) | (6<<20), ioaddr + I82544_TIPG ); + + // Program tx ctrl register + txctl = INL( ioaddr + I82544_TCTL ); + txctl |= (15<<4); // collision threshold + txctl |= (64<<12); // collision distance + txctl |= I82544_TCTL_PSP; + OUTL( txctl, ioaddr + I82544_TCTL ); + + p_i82544->tx_in_progress = 0; + p_i82544->tx_pointer = 0; + +} + +// ------------------------------------------------------------------------ +// +// Function : TxDone (Called from delivery thread) +// +// This returns Tx's from the Tx Machine to the stack (ie. reports +// completion) - allowing for missed interrupts, and so on. +// ------------------------------------------------------------------------ + +static void +TxDone(struct i82544* p_i82544) +{ + struct cyg_netdevtab_entry *ndp; + struct eth_drv_sc *sc; + cyg_uint32 ioaddr; + cyg_int32 txp = p_i82544->tx_pointer; + +#ifdef DEBUG_82544 +// db_printf("TxDone\n"); +#endif + + ndp = (struct cyg_netdevtab_entry *)(p_i82544->ndp); + sc = (struct eth_drv_sc *)(ndp->device_instance); + + CHECK_NDP_SC_LINK(); + + ioaddr = p_i82544->io_address; // get device I/O address + + if( !p_i82544->active ) + return; + + for(;;) + { + cyg_uint8 status; + cyg_uint8 cmd; + CYG_ADDRESS dp; + cyg_int32 txh; + + txh = INL( ioaddr + I82544_TDH ); + + // If there has been no advance on the transmit header, + // nothing to do. + if( txh == txp ) + break; + +#ifdef DEBUG_82544 + os_printf("TxDone: TxH %04d TxP %04d\n",txh,txp); +#endif + + // Get descriptor address + dp = p_i82544->tx_ring + (txp * I82544_TD_SIZE); + + READMEM8( dp + I82544_TD_CMD, cmd ); + READMEM8( dp + I82544_TD_STATUS, status ); +#ifdef DEBUG_82544 + os_printf("cmd %02x status %02x\n",cmd,status); +#endif + + // Zero out buffer and command + WRITEMEM64( dp + I82544_TD_BUFFER, 0 ); + WRITEMEM8( dp + I82544_TD_CMD, 0 ); + + if( cmd & I82544_TD_CMD_EOP ) + { + // A done end of packet descrptor + + if( p_i82544->tx_keys[txp] != 0 ) + { + // Call network stack with correct value of txp in structure. + // There may be recursive calls in here, so we need to make sure + // that txp is updated correctly. + p_i82544->tx_pointer = ( txp + 1 ) % MAX_TX_DESCRIPTORS; + (sc->funs->eth_drv->tx_done)( sc, p_i82544->tx_keys[txp], 0 ); + txp = p_i82544->tx_pointer; + continue; + } + } + + // Advance tx pointer + txp = ( txp + 1 ) % MAX_TX_DESCRIPTORS; + + } + + // restore txp to data structure. + p_i82544->tx_pointer = txp; + +} + + +// ------------------------------------------------------------------------ +// +// Function : i82544_can_send +// +// ------------------------------------------------------------------------ + +static int +i82544_can_send(struct eth_drv_sc *sc) +{ + struct i82544 *p_i82544; + cyg_uint32 ioaddr; + +#ifdef DEBUG_82544 +// db_printf("i82544_can_send\n"); +#endif + + p_i82544 = (struct i82544 *)sc->driver_private; + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG_82544 + os_printf( "i82544_send: Bad device pointer %x\n", p_i82544 ); +#endif + return 0; + } + + ioaddr = p_i82544->io_address; // get device I/O address + + if ( p_i82544->active ) + { + cyg_int32 txh, txt, diff; + + // Poll for Tx completion + TxDone( p_i82544 ); + +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + // We are not prepared to receive a packet now if we are in a polled + // standalone configuration. + + // Poll for receptions + PacketRxReady( p_i82544 ); +#endif + + // Now see whether the Tx queue has space for another + // transmit. We look at the difference between the head and + // tail pointer, and if there is space for at least 5 more + // descriptors, we allow a new transmission to go ahead. + txh = INL( ioaddr + I82544_TDH ); + txt = INL( ioaddr + I82544_TDT ); + + diff = (txh-1) - txt; + if( diff < 0 ) diff += MAX_TX_DESCRIPTORS; +#ifdef DEBUG_82544 +// os_printf("TxH %04d TxT %04d diff %04d\n",txh,txt,diff); +#endif + return diff > 5; + } + + return false; + +} + +// ------------------------------------------------------------------------ +// +// Function : i82544_send +// +// ------------------------------------------------------------------------ + +static void +i82544_send(struct eth_drv_sc *sc, + struct eth_drv_sg *sg_list, int sg_len, int total_len, + unsigned long key) +{ + struct i82544 *p_i82544; + cyg_uint32 ioaddr; + struct eth_drv_sg *last_sg; + cyg_int32 txt; + + +#ifdef DEBUG_82544 + db_printf("i82544_send\n"); +#endif + + p_i82544 = (struct i82544 *)sc->driver_private; + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG_82544 + os_printf( "i82544_send: Bad device pointer %x\n", p_i82544 ); +#endif + return; + } + +#ifdef DEBUG_82544 + os_printf("Tx %d %x: %d sg's, %d bytes, KEY %x\n", + p_i82544->index, (int)p_i82544, sg_len, total_len, key ); +#endif + + if ( ! p_i82544->active ) + return; // device inactive, no return + ioaddr = p_i82544->io_address; // get device I/O address + + // Get the tx tail pointer + txt = INL( ioaddr + I82544_TDT ); + + for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) + { + cyg_uint8 *from_p; + cyg_uint8 cmd = 0; + CYG_ADDRESS dp; + int l; + + from_p = (cyg_uint8 *)(sg_list->buf); // normal cached address + l = sg_list->len; + + if ( l > total_len ) + l = total_len; + + // Get the descriptor address from the tail pointer. + dp = p_i82544->tx_ring + (txt * I82544_TD_SIZE); + + total_len -= l; + +#ifdef HAL_DCACHE_STORE + HAL_DCACHE_STORE( ((CYG_ADDRESS)from_p) &~(HAL_DCACHE_LINE_SIZE-1), + l + (HAL_DCACHE_LINE_SIZE-1) ); +#endif + + WRITEMEM64( dp + I82544_TD_BUFFER, VIRT_TO_BUS(from_p) ); + WRITEMEM16( dp + I82544_TD_LENGTH, l ); + + // Set EOP bit on last packet + if( total_len <= 0 ) + cmd |= I82544_TD_CMD_EOP; + + // Get status back +// cmd |= I82544_TD_CMD_RPS | I82544_TD_CMD_RS; + + cmd |= I82544_TD_CMD_IFCS; + + // Write command byte + WRITEMEM8( dp + I82544_TD_CMD, cmd ); + + // Zero out rest of fields + WRITEMEM8( dp + I82544_TD_STATUS, 0 ); + WRITEMEM8( dp + I82544_TD_CSO, 0 ); + WRITEMEM8( dp + I82544_TD_CSS, 0 ); + WRITEMEM16( dp + I82544_TD_SPECIAL, 0 ); + + // Store the key for this transmission in the matching slot + // for the descriptor. + p_i82544->tx_keys[txt] = key; + + // Increment tx tail pointer + txt = (txt + 1) % MAX_TX_DESCRIPTORS; + + } + + // And finally, cause the transmission to happen by setting the + // tail pointer in the hardware. + OUTL( txt, ioaddr + I82544_TDT ); + +} + +// ------------------------------------------------------------------------ +// +// Function : i82544_reset +// +// ------------------------------------------------------------------------ +static void +i82544_reset(struct i82544* p_i82544) +{ + cyg_uint32 ioaddr = p_i82544->io_address; + cyg_uint32 ctrl; + +#ifdef DEBUG + db_printf("i82544_reset\n"); +#endif + + ctrl = INL( ioaddr + I82544_CTRL ); + + // reset controller + OUTL( ctrl | I82544_CTRL_RST, ioaddr + I82544_CTRL ); + udelay(20); + ctrl = INL( ioaddr + I82544_CTRL ); + +} + +// ------------------------------------------------------------------------ +// +// INTERRUPT HANDLERS +// +// ------------------------------------------------------------------------ + +static cyg_uint32 +eth_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + struct i82544* p_i82544 = (struct i82544 *)data; + cyg_uint16 status; + cyg_uint32 ioaddr; + +#ifdef DEBUG_82544 +// db_printf("eth_isr\n"); +#endif + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG_82544 + os_printf( "i82544_isr: Bad device pointer %x\n", p_i82544 ); +#endif + return 0; + } + + ioaddr = p_i82544->io_address; + + status = INL( ioaddr + I82544_ICR ); + +#ifdef DEBUG_82544 + db_printf("eth_isr %04x\n",status); +#endif + + return CYG_ISR_CALL_DSR; // schedule DSR +} + + +// ------------------------------------------------------------------------ + +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE +static void +eth_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + struct i82544* p_i82544 = (struct i82544 *)data; + struct cyg_netdevtab_entry *ndp = + (struct cyg_netdevtab_entry *)(p_i82544->ndp); + struct eth_drv_sc *sc = (struct eth_drv_sc *)(ndp->device_instance); + +#ifdef DEBUG_82544 + db_printf("eth_dsr\n"); +#endif + + eth_drv_dsr( vector, count, (cyg_addrword_t)sc ); + + cyg_drv_interrupt_acknowledge(p_i82544->vector); +} +#endif // !CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + +// ------------------------------------------------------------------------ +// Deliver routine: + +void +i82544_deliver(struct eth_drv_sc *sc) +{ + struct i82544* p_i82544 = (struct i82544 *)(sc->driver_private); + +#ifdef DEBUG + db_printf("i82544_deliver\n"); +#endif + + // First pass any rx data up the stack + PacketRxReady(p_i82544); + + // Then scan for completed Tx and inform the stack + TxDone(p_i82544); +} + +// ------------------------------------------------------------------------ +// Device table entry to operate the chip in a polled mode. +// Only diddle the interface we were asked to! + +void +i82544_poll(struct eth_drv_sc *sc) +{ + struct i82544 *p_i82544; + p_i82544 = (struct i82544 *)sc->driver_private; + +#ifdef DEBUG + db_printf("i82544_poll\n"); +#endif + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG + os_printf( "i82544_poll: Bad device pointer %x\n", p_i82544 ); +#endif + return; + } + + // As it happens, this driver always requests the DSR to be called: + (void)eth_isr( p_i82544->vector, (cyg_addrword_t)p_i82544 ); + + // (no harm in calling this ints-off also, when polled) + i82544_deliver( sc ); +} + +// ------------------------------------------------------------------------ +// Determine interrupt vector used by a device - for attaching GDB stubs +// packet handler. + +int +i82544_int_vector(struct eth_drv_sc *sc) +{ + struct i82544 *p_i82544; + p_i82544 = (struct i82544 *)sc->driver_private; + return (p_i82544->vector); +} + + +// ------------------------------------------------------------------------ +// +// Function : pci_init_find_82544s +// +// This is called exactly once at the start of time to: +// o scan the PCI bus for objects +// o record them in the device table +// o acquire all the info needed for the driver to access them +// o instantiate interrupts for them +// o attach those interrupts appropriately +// ------------------------------------------------------------------------ + +static cyg_pci_match_func find_82544s_match_func; + +// Intel 82543 and 82544 are virtually identical, with different +// dev codes +static cyg_bool +find_82544s_match_func( cyg_uint16 v, cyg_uint16 d, cyg_uint32 c, void *p ) +{ + return ((0x8086 == v) && + ((0x1004 == d) || // 82543 + (0x1008 == d) // 82544 + ) + ); +} + +static int +pci_init_find_82544s( void ) +{ + cyg_pci_device_id devid; + cyg_pci_device dev_info; + cyg_uint16 cmd; + int device_index; + int found_devices = 0; + +#ifdef DEBUG + db_printf("pci_init_find_82544s()\n"); +#endif + + // allocate memory to be used in ioctls later + if (mem_reserved_ioctl != (void*)0) { +#ifdef DEBUG + db_printf("pci_init_find_82544s() called > once\n"); +#endif + return 0; + } + + // First initialize the heap in PCI window'd memory + i82544_heap_size = CYGHWR_INTEL_I82544_PCI_MEM_MAP_SIZE; + i82544_heap_base = (cyg_uint8 *)CYGHWR_INTEL_I82544_PCI_MEM_MAP_BASE; + i82544_heap_free = i82544_heap_base; + +// mem_reserved_ioctl = pciwindow_mem_alloc(MAX_MEM_RESERVED_IOCTL); + + cyg_pci_init(); +#ifdef DEBUG + db_printf("Finished cyg_pci_init();\n"); +#endif + + devid = CYG_PCI_NULL_DEVID; + + for (device_index = 0; + device_index < CYGNUM_DEVS_ETH_INTEL_I82544_DEV_COUNT; + device_index++) { + struct i82544 *p_i82544 = i82544_priv_array[device_index]; + + p_i82544->index = device_index; + + // See above for find_82544s_match_func + if (cyg_pci_find_matching( &find_82544s_match_func, NULL, &devid )) { +#ifdef DEBUG + db_printf("eth%d = 82544\n", device_index); +#endif + cyg_pci_get_device_info(devid, &dev_info); + + p_i82544->interrupt_handle = 0; // Flag not attached. + if (cyg_pci_translate_interrupt(&dev_info, &p_i82544->vector)) { +#ifdef DEBUG + db_printf(" Wired to HAL vector %d\n", p_i82544->vector); +#endif +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + cyg_drv_interrupt_create( + p_i82544->vector, + 0, // Priority - unused + (CYG_ADDRWORD)p_i82544, // Data item passed to ISR & DSR +#ifdef CYGHWR_DEVS_ETH_INTEL_I82544_DEMUX_ALL + eth_mux_isr, // ISR +#else + eth_isr, // ISR +#endif + eth_dsr, // DSR + &p_i82544->interrupt_handle, // handle to intr obj + &p_i82544->interrupt_object ); // space for int obj + + cyg_drv_interrupt_attach(p_i82544->interrupt_handle); + + // Don't unmask the interrupt yet, that could get us into a + // race. +#ifdef CYGNUM_DEVS_ETH_INTEL_I82544_SEPARATE_MUX_INTERRUPT + // ALSO attach it to MUX interrupt for multiplexed + // interrupts. This is for certain boards where the + // PCI backplane is wired "straight through" instead of + // with a rotation of interrupt lines in the different + // slots. + { + static cyg_handle_t mux_interrupt_handle = 0; + static cyg_interrupt mux_interrupt_object; + + if ( ! mux_interrupt_handle ) { +#ifdef DEBUG + db_printf(" Also attaching to HAL vector %d\n", + CYGNUM_DEVS_ETH_INTEL_I82544_SEPARATE_MUX_INTERRUPT); +#endif + cyg_drv_interrupt_create( + CYGNUM_DEVS_ETH_INTEL_I82544_SEPARATE_MUX_INTERRUPT, + 0, // Priority - unused + (CYG_ADDRWORD)p_i82544,// Data item passed to ISR and DSR + eth_mux_isr, // ISR + eth_dsr, // DSR + &mux_interrupt_handle, + &mux_interrupt_object ); + + cyg_drv_interrupt_attach(mux_interrupt_handle); + } + } +#endif // CYGNUM_DEVS_ETH_INTEL_I82544_SEPARATE_MUX_INTERRUPT +#endif // !CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + } + else { + p_i82544->vector=0; +#ifdef DEBUG + db_printf(" Does not generate interrupts.\n"); +#endif + } + + if (cyg_pci_configure_device(&dev_info)) { +#ifdef DEBUG + int i; + db_printf("Found device on bus %d, devfn 0x%02x:\n", + CYG_PCI_DEV_GET_BUS(devid), + CYG_PCI_DEV_GET_DEVFN(devid)); + + if (dev_info.command & CYG_PCI_CFG_COMMAND_ACTIVE) { + db_printf(" Note that board is active. Probed" + " sizes and CPU addresses invalid!\n"); + } + db_printf(" Vendor 0x%04x", dev_info.vendor); + db_printf("\n Device 0x%04x", dev_info.device); + db_printf("\n Command 0x%04x, Status 0x%04x\n", + dev_info.command, dev_info.status); + + db_printf(" Class/Rev 0x%08x", dev_info.class_rev); + db_printf("\n Header 0x%02x\n", dev_info.header_type); + + db_printf(" SubVendor 0x%04x, Sub ID 0x%04x\n", + dev_info.header.normal.sub_vendor, + dev_info.header.normal.sub_id); + + for(i = 0; i < CYG_PCI_MAX_BAR; i++) { + db_printf(" BAR[%d] 0x%08x /", i, dev_info.base_address[i]); + db_printf(" probed size 0x%08x / CPU addr 0x%08x\n", + dev_info.base_size[i], dev_info.base_map[i]); + } + db_printf(" eth%d configured\n", device_index); +#endif + found_devices++; + p_i82544->found = 1; + p_i82544->active = 0; + p_i82544->devid = devid; + p_i82544->device = dev_info.device; + p_i82544->io_address = dev_info.base_map[0]; +#ifdef DEBUG + db_printf(" I/O address = 0x%08x device = %04x\n", dev_info.base_map[0], + dev_info.device); +#endif + + // Don't use cyg_pci_set_device_info since it clears + // some of the fields we want to print out below. + cyg_pci_read_config_uint16(dev_info.devid, + CYG_PCI_CFG_COMMAND, &cmd); + cmd |= (CYG_PCI_CFG_COMMAND_IO // enable I/O space + | CYG_PCI_CFG_COMMAND_MEMORY // enable memory space + | CYG_PCI_CFG_COMMAND_MASTER); // enable bus master + cyg_pci_write_config_uint16(dev_info.devid, + CYG_PCI_CFG_COMMAND, cmd); + + // Now the PCI part of the device is configured, reset + // it. This should make it safe to enable the + // interrupt + i82544_reset(p_i82544); + + // This is the indicator for "uses an interrupt" + if (p_i82544->interrupt_handle != 0) { + cyg_drv_interrupt_acknowledge(p_i82544->vector); +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + cyg_drv_interrupt_unmask(p_i82544->vector); +#endif // !CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + } +#ifdef DEBUG + db_printf(" **** Device enabled for I/O and Memory " + "and Bus Master\n"); +#endif + } + else { + p_i82544->found = 0; + p_i82544->active = 0; +#ifdef DEBUG + db_printf("Failed to configure device %d\n",device_index); +#endif + } + } + else { + p_i82544->found = 0; + p_i82544->active = 0; +#ifdef DEBUG + db_printf("eth%d not found\n", device_index); +#endif + } + } + + if (0 == found_devices) + return 0; + +#ifdef CYGNUM_DEVS_ETH_INTEL_I82544_SEPARATE_MUX_INTERRUPT + // Now enable the mux shared interrupt if it is in use + if (mux_interrupt_handle) { + cyg_drv_interrupt_acknowledge(CYGNUM_DEVS_ETH_INTEL_I82544_SEPARATE_MUX_INTERRUPT); + cyg_drv_interrupt_unmask(CYGNUM_DEVS_ETH_INTEL_I82544_SEPARATE_MUX_INTERRUPT); + } +#endif + + // Now a delay to ensure the hardware has "come up" before you try to + // use it. Yes, really, the full 2 seconds. It's only really + // necessary if DEBUG is off - otherwise all that printout wastes + // enough time. No kidding. + udelay( 2000000 ); + return 1; +} + +// ------------------------------------------------------------------------ +// +// Function : i82544_configure +// +// Return : 0 = It worked. +// non0 = It failed. +// ------------------------------------------------------------------------ + +static int i82544_configure(struct i82544* p_i82544, int promisc, int oversized) +{ + cyg_uint32 ioaddr; +// volatile CFG *ccs; +// volatile cyg_uint8* config_bytes; +// cyg_uint16 status; +// int count; + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG + os_printf( "eth_set_promiscuous_mode: Bad device pointer %x\n", + p_i82544 ); +#endif + return -1; + } + + ioaddr = p_i82544->io_address; + + // Not currently supported + + return 0; +} + +// ------------------------------------------------------------------------ +// +// Function : eth_set_mac_address +// +// Return : 0 = It worked. +// non0 = It failed. +// ------------------------------------------------------------------------ + +static int +eth_set_mac_address(struct i82544* p_i82544, cyg_uint8 *addr, int eeprom) +{ + cyg_uint32 ioaddr; + cyg_uint32 maclo, machi; + +#ifdef DEBUG + db_printf("eth_set_mac_address\n"); +#endif + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG + os_printf( "eth_set_mac_address : Bad device pointer %x\n", + p_i82544 ); +#endif + return -1; + } + + ioaddr = p_i82544->io_address; + + // Write MAC address to RAT[0] + + maclo = addr[0] | (addr[1]<<8) | (addr[2]<<16) | (addr[3]<<24); + machi = (1<<31) | (0<<16) | addr[4] | (addr[5]<<8); + +#ifdef DEBUG + os_printf("setting: lo %08x hi %08x\n",maclo,machi); +#endif + + OUTL( maclo , ioaddr + I82544_RAT ); + OUTL( machi, ioaddr + I82544_RAT + 4 ); + + + // record the MAC address in the device structure + p_i82544->mac_address[0] = addr[0]; + p_i82544->mac_address[1] = addr[1]; + p_i82544->mac_address[2] = addr[2]; + p_i82544->mac_address[3] = addr[3]; + p_i82544->mac_address[4] = addr[4]; + p_i82544->mac_address[5] = addr[5]; + p_i82544->mac_addr_ok = 1; + +#ifdef DEBUG + os_printf( "Set MAC Address = %02X %02X %02X %02X %02X %02X (ok %d)\n", + p_i82544->mac_address[0], + p_i82544->mac_address[1], + p_i82544->mac_address[2], + p_i82544->mac_address[3], + p_i82544->mac_address[4], + p_i82544->mac_address[5], + p_i82544->mac_addr_ok ); +#endif + + return p_i82544->mac_addr_ok ? 0 : 1; +} + +// ------------------------------------------------------------------------ +// +// Function : eth_get_mac_address +// +// ------------------------------------------------------------------------ +#ifdef ETH_DRV_GET_MAC_ADDRESS +static int +eth_get_mac_address(struct i82544* p_i82544, char *addr) +{ +#ifdef DEBUG + db_printf("eth_get_mac_address\n"); +#endif + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG + os_printf( "eth_get_mac_address : Bad device pointer %x\n", + p_i82544 ); +#endif + return -1; + } + + memcpy( addr, (char *)(&p_i82544->mac_address[0]), 6 ); + return 0; +} +#endif +// ------------------------------------------------------------------------ +// +// Function : i82544_ioctl +// +// ------------------------------------------------------------------------ +static int +i82544_ioctl(struct eth_drv_sc *sc, unsigned long key, + void *data, int data_length) +{ + struct i82544 *p_i82544; + +#ifdef DEBUG + db_printf("i82544_ioctl\n"); +#endif + + p_i82544 = (struct i82544 *)sc->driver_private; + + IF_BAD_82544( p_i82544 ) { +#ifdef DEBUG + os_printf( "i82544_ioctl/control: Bad device pointer %x\n", p_i82544 ); +#endif + return -1; + } + +#ifdef ioctlDEBUG + db_printf( "i82544_ioctl: device eth%d at %x; key is 0x%x, data at %x[%d]\n", + p_i82544->index, p_i82544, key, data, data_length ); +#endif + + switch ( key ) { + +#ifdef ETH_DRV_SET_MAC_ADDRESS + case ETH_DRV_SET_MAC_ADDRESS: + if ( 6 != data_length ) + return -2; + return eth_set_mac_address( p_i82544, data, 1 /* do write eeprom */ ); +#endif + +#ifdef ETH_DRV_GET_MAC_ADDRESS + case ETH_DRV_GET_MAC_ADDRESS: + return eth_get_mac_address( p_i82544, data ); +#endif + + default: + break; + } + return -1; +} + +// ------------------------------------------------------------------------ + +// EOF if_i82544.c diff --git a/packages/devs/eth/intel/i82559/current/ChangeLog b/packages/devs/eth/intel/i82559/current/ChangeLog --- a/packages/devs/eth/intel/i82559/current/ChangeLog +++ b/packages/devs/eth/intel/i82559/current/ChangeLog @@ -1,3 +1,55 @@ +2002-04-09 Hugo Tyson + + * src/if_i82559.c (i82559_stop): Free up any pending transmissions + to prevent MBUF store leaks if the calling thread - the one that's + shutting down the interface - priority ends up higher than (or + same as) the network service threads. + +2002-03-26 Jonathan Larmour + + * src/if_i82559.c (wait_for_cmd_done): Don't assert if RUC_ADDR_LOAD + command doesn't clear - on some chips it never does. + +2002-03-18 Hugo Tyson + + * src/if_i82559.c (pci_init_find_82559s): Move allocation of + statistics pointer for each device to here, out of + i82559_start(). It used to leak PCI window store every time the + interface cycled down/up. [Case 107110] + +2002-02-25 Mark Salter + + * src/if_i82559.c: Don't call PacketRxReady in standalone configuration + unless ready to accept a packet. Limit packet delivery to one packet at + a time in standalone configuration. + +2002-02-20 Hugo Tyson + + * include/i82559_info.h: New fields to record/control multicast + all reception, oversized packet reception and promiscuous mode + neatly. + + * src/if_i82559.c: Initial support for multicast address reception + filtering. + (i82559_restart): New routine to restart the device after fiddling + with its setup - a tail recursion from i82559_start(). + (i82559_configure): More generic flags passed in and handled. + (i82559_set_multicast): Routine to pass a set of addresses into + the device; it works out the bitmap et al for us! + (i82559_ioctl): Handle new case arms ETH_DRV_SET_MC_LIST and + ETH_DRV_SET_MC_ALL if defined. Reset and restart the device, + diddling its status between. + +2002-02-19 Mark Salter + + * src/if_i82559.c (pci_init_find_82559s): Don't use IRQ support if + CYGPKG_IO_ETH_DRIVERS_STAND_ALONE. + +2002-01-28 Mark Salter + + * src/if_i82559.c (pci_init_find_82559s): Removed CYG_ASSERT which + assumed system PCI window exists. + 2002-01-10 Jonathan Larmour * src/if_i82559.c (find_82559s_match_func): Add some more compatible PCI @@ -681,29 +733,38 @@ 2000-02-08 Hugo Tyson #include #include -#include -#include +#include +#include #ifdef CYGPKG_NET #include @@ -163,7 +172,7 @@ // Exported statistics and the like #include -#include +#include #include CYGDAT_DEVS_ETH_INTEL_I82559_INL // ------------------------------------------------------------------------ @@ -724,6 +733,7 @@ static inline cyg_uint32 virt_to_bus(cyg #define CFG_CMD_INT 0x0020 #define CFG_CMD_IAS 0x0100 // individual address setup #define CFG_CMD_CONFIGURE 0x0200 // configure +#define CFG_CMD_MULTICAST 0x0300 // Multicast-Setup #define CFG_STATUS_C 0x0080 #define CFG_STATUS_OK 0x0020 @@ -735,6 +745,7 @@ static inline cyg_uint32 virt_to_bus(cyg #define CFG_CMD_INT 0x2000 #define CFG_CMD_IAS 0x0001 // individual address setup #define CFG_CMD_CONFIGURE 0x0002 // configure +#define CFG_CMD_MULTICAST 0x0003 // Multicast-Setup #define CFG_STATUS_C 0x8000 #define CFG_STATUS_OK 0x2000 @@ -761,6 +772,9 @@ static inline cyg_uint32 virt_to_bus(cyg #endif // CYG_ADDRESSING_IS_GIBENDIAN +// Normal addressing +#define CFG_MC_LIST_BYTES 8 +#define CFG_MC_LIST_DATA 10 // ------------------------------------------------------------------------ // @@ -837,6 +851,7 @@ static void *mem_reserved_ioctl = (void* static int pci_init_find_82559s(void); static void i82559_reset(struct i82559* p_i82559); +static void i82559_restart(struct i82559 *p_i82559); static int eth_set_mac_address(struct i82559* p_i82559, char *addr, int eeprom ); static void InitRxRing(struct i82559* p_i82559); @@ -849,7 +864,13 @@ eth_dsr(cyg_vector_t vector, cyg_ucount3 static cyg_uint32 eth_isr(cyg_vector_t vector, cyg_addrword_t data); -static int i82559_configure(struct i82559* p_i82559, int promisc, int oversized); +static int i82559_configure(struct i82559* p_i82559, int promisc, + int oversized, int multicast_all); +#ifdef ETH_DRV_SET_MC_LIST +static int i82559_set_multicast(struct i82559* p_i82559, + int num_addrs, + cyg_uint8 *address_list ); +#endif // ETH_DRV_SET_MC_ALL #ifdef CYGPKG_DEVS_ETH_INTEL_I82559_WRITE_EEPROM static void program_eeprom(cyg_uint32 ioaddr, cyg_uint32 eeprom_size, cyg_uint8 *data); @@ -900,7 +921,10 @@ wait_for_cmd_done(long scb_ioaddr, cmd_w while( (0 != ((CU_CMD_MASK | RU_CMD_MASK) & status)) && --wait >= 0); } - CYG_ASSERT( wait > 0, "wait_for_cmd_done: cmd busy" ); + // special case - don't complain about RUC_ADDR_LOAD as it doesn't clear + // on some silicon + if ( RUC_ADDR_LOAD != (status & RU_CMD_MASK) ) + CYG_ASSERT( wait > 0, "wait_for_cmd_done: cmd busy" ); if (WAIT_CU == type) { // Also check CU is idle @@ -1497,6 +1521,10 @@ i82559_init(struct cyg_netdevtab_entry * p_i82559->within_send = 0; // init recursion level + p_i82559->promisc = 0; // None of these initially + p_i82559->multicast_all = 0; + p_i82559->oversized = 1; // Enable this for VLAN mode by default + InitRxRing(p_i82559); InitTxRing(p_i82559); @@ -1550,8 +1578,7 @@ i82559_start( struct eth_drv_sc *sc, uns #ifdef KEEP_STATISTICS #ifdef CYGDBG_DEVS_ETH_INTEL_I82559_KEEP_STATISTICS - p_i82559->p_statistics = - p_statistics = pciwindow_mem_alloc(sizeof(I82559_COUNTERS)); + p_statistics = p_i82559->p_statistics; memset(p_statistics, 0xFFFFFFFF, sizeof(I82559_COUNTERS)); // set statistics dump address wait_for_cmd_done(ioaddr, WAIT_CU); @@ -1574,17 +1601,24 @@ i82559_start( struct eth_drv_sc *sc, uns /* Enable promiscuous mode if requested, reception of oversized frames always. * The latter is needed for VLAN support and shouldn't hurt even if we're not - * using VLANs. + * using VLANs. Reset multicastALL reception choice. */ - i82559_configure(p_i82559, 0 + + p_i82559->promisc = 0 #ifdef CYGPKG_NET || !!(ifp->if_flags & IFF_PROMISC) #endif #ifdef ETH_DRV_FLAGS_PROMISC_MODE || !!(flags & ETH_DRV_FLAGS_PROMISC_MODE) #endif - , 1); - + ; + + p_i82559->multicast_all = 0; + + i82559_configure(p_i82559, + p_i82559->promisc, + p_i82559->oversized, + p_i82559->multicast_all ); #ifdef DEBUG { @@ -1598,11 +1632,18 @@ i82559_start( struct eth_drv_sc *sc, uns } #endif + i82559_restart(p_i82559); +} + +static void i82559_restart(struct i82559 *p_i82559) +{ + cyg_uint32 ioaddr; + ioaddr = p_i82559->io_address; // get 82559's I/O address + // Load pointer to Rx Ring and enable receiver wait_for_cmd_done(ioaddr, WAIT_RU); OUTL(VIRT_TO_BUS(p_i82559->rx_ring[0]), ioaddr + SCBPointer); OUTW(RUC_START, ioaddr + SCBCmd); - } // ------------------------------------------------------------------------ @@ -1659,6 +1700,36 @@ i82559_stop( struct eth_drv_sc *sc ) p_i82559->active = 0; // stop people tormenting it i82559_reset(p_i82559); // that should stop it + // Now that it's inactive, return all pending tx status to the higher + // layers: + // "Done" txen are from here to active, OR + // the remove one if the queue is full AND its status is nonzero: + while ( 1 ) { + int tx_descriptor_remove = p_i82559->tx_descriptor_remove; + unsigned long key = p_i82559->tx_keys[ tx_descriptor_remove ]; + + // Break out if "remove" is the active slot + // (AND the Q is not full, or the Tx is not complete yet) + if ( (tx_descriptor_remove == p_i82559->tx_descriptor_active) && + ( ! p_i82559->tx_queue_full) ) + break; + + // Zero the key in global state before the callback: + p_i82559->tx_keys[ tx_descriptor_remove ] = 0; + +#ifdef DEBUG_82559 + os_printf("Stop: TxDone %d %x: KEY %x TxCB %x\n", + p_i82559->index, (int)p_i82559, key, p_txcb ); +#endif + // tx_done() can now cope with a NULL key, no guard needed here + (sc->funs->eth_drv->tx_done)( sc, key, 1 /* status */ ); + + if ( ++tx_descriptor_remove >= MAX_TX_DESCRIPTORS ) + tx_descriptor_remove = 0; + p_i82559->tx_descriptor_remove = tx_descriptor_remove; + p_i82559->tx_queue_full = 0; + } + ResetRxRing( p_i82559 ); ResetTxRing( p_i82559 ); } @@ -1813,6 +1884,10 @@ PacketRxReady(struct i82559* p_i82559) CYG_ASSERT( (cyg_uint8 *)p_rfd >= i82559_heap_base, "rfd under" ); CYG_ASSERT( (cyg_uint8 *)p_rfd < i82559_heap_free, "rfd over" ); +#ifdef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + // Can't deliver more than one packet in polled standalone mode + break; +#endif } // See if the RU has gone idle (usually because of out of resource @@ -2163,7 +2238,11 @@ i82559_can_send(struct eth_drv_sc *sc) Check82559TxLockupTimeout(p_i82559); TxMachine(p_i82559); Acknowledge82559Interrupt(p_i82559); +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + // We are not prepared to receive a packet now if we are in a polled + // standalone configuration. PacketRxReady(p_i82559); +#endif #ifdef CYGHWR_DEVS_ETH_INTEL_I82559_MISSED_INTERRUPT if ( CYGHWR_DEVS_ETH_INTEL_I82559_MISSED_INTERRUPT(p_i82559) ) { #ifdef CYGDBG_USE_ASSERTS @@ -2184,7 +2263,11 @@ i82559_can_send(struct eth_drv_sc *sc) Check82559TxLockupTimeout(p_i82559); TxMachine(p_i82559); Acknowledge82559Interrupt(p_i82559); // This can eat an Rx interrupt, so +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + // We are not prepared to receive a packet now if we are in a polled + // standalone configuration. PacketRxReady(p_i82559); +#endif #ifdef CYGHWR_DEVS_ETH_INTEL_I82559_MISSED_INTERRUPT if ( CYGHWR_DEVS_ETH_INTEL_I82559_MISSED_INTERRUPT(p_i82559) ) { #ifdef CYGDBG_USE_ASSERTS @@ -2353,7 +2436,11 @@ i82559_send(struct eth_drv_sc *sc, if ( p_i82559->active ) { TxMachine(p_i82559); Acknowledge82559Interrupt(p_i82559); +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + // We are not prepared to receive a packet now if we are in a polled + // standalone configuration. PacketRxReady(p_i82559); +#endif } } } @@ -2363,7 +2450,11 @@ i82559_send(struct eth_drv_sc *sc, // Advance TxMachine atomically TxMachine(p_i82559); Acknowledge82559Interrupt(p_i82559); // This can eat an Rx interrupt, so +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + // We are not prepared to receive a packet now if we are in a polled + // standalone configuration. PacketRxReady(p_i82559); +#endif #endif // no CYGHWR_DEVS_ETH_INTEL_I82559_DEMUX_ALL p_i82559->within_send--; @@ -2693,16 +2784,6 @@ pci_init_find_82559s( void ) return 0; } -#ifdef CYGARC_UNCACHED_ADDRESS - CYG_ASSERT( CYGARC_UNCACHED_ADDRESS((CYG_ADDRWORD)CYGMEM_SECTION_pci_window) == - CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE, - "PCI window configured does not match PCI memory section base" ); -#else - CYG_ASSERT( (CYG_ADDRWORD)CYGMEM_SECTION_pci_window == - CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE, - "PCI window configured does not match PCI memory section base" ); -#endif - // First initialize the heap in PCI window'd memory i82559_heap_size = CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE; i82559_heap_base = (cyg_uint8 *)CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE; @@ -2731,6 +2812,9 @@ pci_init_find_82559s( void ) #ifdef DEBUG db_printf("eth%d = 82559\n", device_index); #endif + // Allocate it a stats window: + p_i82559->p_statistics = pciwindow_mem_alloc(sizeof(I82559_COUNTERS)); + cyg_pci_get_device_info(devid, &dev_info); p_i82559->interrupt_handle = 0; // Flag not attached. @@ -2738,6 +2822,8 @@ pci_init_find_82559s( void ) #ifdef DEBUG db_printf(" Wired to HAL vector %d\n", p_i82559->vector); #endif + +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE cyg_drv_interrupt_create( p_i82559->vector, 0, // Priority - unused @@ -2783,6 +2869,7 @@ pci_init_find_82559s( void ) } } #endif // CYGNUM_DEVS_ETH_INTEL_I82559_SEPARATE_MUX_INTERRUPT +#endif // !CYGPKG_IO_ETH_DRIVERS_STAND_ALONE } else { p_i82559->vector=0; @@ -2850,7 +2937,9 @@ pci_init_find_82559s( void ) // This is the indicator for "uses an interrupt" if (p_i82559->interrupt_handle != 0) { cyg_drv_interrupt_acknowledge(p_i82559->vector); +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE cyg_drv_interrupt_unmask(p_i82559->vector); +#endif // !CYGPKG_IO_ETH_DRIVERS_STAND_ALONE } #ifdef DEBUG db_printf(" **** Device enabled for I/O and Memory " @@ -2895,13 +2984,103 @@ pci_init_find_82559s( void ) // ------------------------------------------------------------------------ // +// Function : i82559_set_multicast +// +// ------------------------------------------------------------------------ +#ifdef ETH_DRV_SET_MC_LIST +static int i82559_set_multicast(struct i82559* p_i82559, + int num_addrs, + cyg_uint8 *address_list ) +{ + cyg_uint32 ioaddr; + volatile CFG *ccs; + volatile cyg_uint8* config_bytes; + cyg_uint16 status; + int count; + int i; + + IF_BAD_82559( p_i82559 ) { +#ifdef DEBUG + os_printf( "eth_set_promiscuos_mode: Bad device pointer %x\n", + p_i82559 ); +#endif + return -1; + } + + ioaddr = p_i82559->io_address; + wait_for_cmd_done(ioaddr, WAIT_CU); + // load cu base address = 0 */ + OUTL(0, ioaddr + SCBPointer); + // 32 bit linear addressing used + OUTW(SCB_M | CU_ADDR_LOAD, ioaddr + SCBCmd); + // wait for SCB command complete + wait_for_cmd_done(ioaddr, WAIT_CU); + + // Check the malloc we did earlier worked + ccs = (CFG *)mem_reserved_ioctl; + if (ccs == (void*)0) + return 2; // Failed + + // Prepare header + WRITEMEM16(ccs + CFG_CMD, + (CFG_CMD_EL | CFG_CMD_SUSPEND | CFG_CMD_MULTICAST)); + WRITEMEM16(ccs + CFG_STATUS, 0); + WRITEMEM32(ccs + CFG_CB_LINK_OFFSET, + HAL_CTOLE32(VIRT_TO_BUS((cyg_uint32)ccs))); + + count = 6 * num_addrs; // byte count + + WRITEMEM16(ccs + CFG_MC_LIST_BYTES, + HAL_CTOLE16( count ) ); + + config_bytes = ccs + CFG_MC_LIST_DATA; + + for ( i = 0; i < count; i++ ) + config_bytes[i] = address_list[i]; + + // Let chip read configuration + wait_for_cmd_done(ioaddr, WAIT_CU); + + OUTL(VIRT_TO_BUS(ccs), ioaddr + SCBPointer); + OUTW(SCB_M | CU_START, ioaddr + SCBCmd); + + // ...and wait for it to complete operation + count = 10000; + do { + udelay(1); + READMEM16(ccs + CFG_STATUS, status); + } while (0 == (status & CFG_STATUS_C) && (count-- > 0)); + + // Check status + if ((status & (CFG_STATUS_C | CFG_STATUS_OK)) + != (CFG_STATUS_C | CFG_STATUS_OK)) { + // Failed! +#ifdef DEBUG + os_printf("%s:%d Multicast setup failed\n", __FUNCTION__, __LINE__); +#endif + return 1; + } + + wait_for_cmd_done(ioaddr, WAIT_CU); + /* load pointer to Rx Ring */ + + OUTL(VIRT_TO_BUS(p_i82559->rx_ring[0]), ioaddr + SCBPointer); + OUTW(RUC_START, ioaddr + SCBCmd); + + return 0; +} +#endif // ETH_DRV_SET_MC_ALL + +// ------------------------------------------------------------------------ +// // Function : i82559_configure // // Return : 0 = It worked. // non0 = It failed. // ------------------------------------------------------------------------ -static int i82559_configure(struct i82559* p_i82559, int promisc, int oversized) +static int i82559_configure(struct i82559* p_i82559, int promisc, + int oversized, int multicast_all) { cyg_uint32 ioaddr; volatile CFG *ccs; @@ -2941,7 +3120,7 @@ static int i82559_configure(struct i8255 // Default values from the Intel Manual config_bytes = ccs + CFG_BYTES; - config_bytes[0]=0x13; + config_bytes[0]= 22; // All 22 bytes config_bytes[1]=0xc; config_bytes[2]=0x0; config_bytes[3]=0x0; @@ -2962,6 +3141,10 @@ static int i82559_configure(struct i8255 config_bytes[16]=0x0; config_bytes[17]=0x40; config_bytes[18]=0x72 | (oversized ? 8 : 0); // Keep the Padding Enable bit + + config_bytes[19]=0x80; // FDX pin enable is the default + config_bytes[20]=0x3f; // the default + config_bytes[21]=0x05 | (multicast_all ? 8 : 0); // Bit 3 is MultiCastALL enable // Let chip read configuration wait_for_cmd_done(ioaddr, WAIT_CU); @@ -3455,6 +3638,47 @@ i82559_ioctl(struct eth_drv_sc *sc, unsi } #endif +#ifdef ETH_DRV_SET_MC_LIST + case ETH_DRV_SET_MC_LIST: { + struct eth_drv_mc_list *mcl = (struct eth_drv_mc_list *)data; + + i82559_reset(p_i82559); + ResetRxRing( p_i82559 ); + ResetTxRing( p_i82559 ); + + p_i82559->multicast_all = 0; + + i82559_configure(p_i82559, + p_i82559->promisc, + p_i82559->oversized, + p_i82559->multicast_all ); + + i82559_set_multicast( p_i82559, + mcl->len, + &(mcl->addrs[0][0]) ); + + i82559_restart(p_i82559); + return 0; + } +#endif // ETH_DRV_SET_MC_LIST + +#ifdef ETH_DRV_SET_MC_ALL + case ETH_DRV_SET_MC_ALL: + i82559_reset(p_i82559); + ResetRxRing( p_i82559 ); + ResetTxRing( p_i82559 ); + + p_i82559->multicast_all = 1; + + i82559_configure(p_i82559, + p_i82559->promisc, + p_i82559->oversized, + p_i82559->multicast_all ); + + i82559_restart(p_i82559); + return 0; +#endif // ETH_DRV_SET_MC_ALL + default: break; } @@ -3482,7 +3706,7 @@ update_statistics(struct i82559* p_i8255 ints = Mask82559Interrupt(p_i82559); - // This points to the sthared memory stats area/command block + // This points to the shared memory stats area/command block p_statistics = (I82559_COUNTERS *)(p_i82559->p_statistics); if ( (p_statistics->done & 0xFFFF) == 0xA007 ) { diff --git a/packages/devs/eth/mips/atlas/current/ChangeLog b/packages/devs/eth/mips/atlas/current/ChangeLog --- a/packages/devs/eth/mips/atlas/current/ChangeLog +++ b/packages/devs/eth/mips/atlas/current/ChangeLog @@ -21,29 +21,38 @@ 2001-01-30 Gary Thomas #include #include -#include -#include +#include +#include #ifdef CYGPKG_IO_PCI #include @@ -99,7 +108,7 @@ RedBoot_config_option("Network hardware #include "saa9730.h" // Exported statistics and the like -#include +#include #define db_printf diag_printf diff --git a/packages/devs/eth/mips/atlas/current/src/if_buffers.S b/packages/devs/eth/mips/atlas/current/src/if_buffers.S --- a/packages/devs/eth/mips/atlas/current/src/if_buffers.S +++ b/packages/devs/eth/mips/atlas/current/src/if_buffers.S @@ -6,29 +6,38 @@ // # PCI ethernet device. // # // #======================================================================== -// ####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -// ####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // #======================================================================== // ######DESCRIPTIONBEGIN#### // # diff --git a/packages/devs/eth/mips/atlas/current/src/saa9730.h b/packages/devs/eth/mips/atlas/current/src/saa9730.h --- a/packages/devs/eth/mips/atlas/current/src/saa9730.h +++ b/packages/devs/eth/mips/atlas/current/src/saa9730.h @@ -7,29 +7,38 @@ // // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/eth/mips/malta/current/ChangeLog b/packages/devs/eth/mips/malta/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mips/malta/current/ChangeLog @@ -0,0 +1,70 @@ +2001-07-26 Jesper Skov + + * include/devs_eth_mips_mips32_malta.inl: Removed ESA init + definition again now driver has been fixed. + +2001-07-24 Jesper Skov + + * include/devs_eth_mips_mips32_malta.inl + (CYGHWR_AMD_PCNET_BROKEN_ESA_INIT): Defined. + +2001-07-18 Jesper Skov + + * cdl/mips_mips32_malta_eth_drivers.cdl: Default to use eeprom ESA. + +2001-07-12 Jesper Skov + + * include/devs_eth_mips_mips32_malta.inl: Let driver find base and + interrupt details. Updated esa options. + +2001-06-27 Jesper Skov + + * cdl/mips_mips32_malta_eth_drivers.cdl: Implements net drivers. + +2001-04-23 Mark Salter + + * include/devs_eth_mips_mips32_malta.inl: Adjust base address to + match changed PCI allocation base. This should really be gotten + at runtime from the PCI interface, not from a build time constant. + +2001-04-03 Jesper Skov + + * cdl/mips_mips32_malta_eth_drivers.cdl: Platform specific + information required to use the generic AMD PCNet driver for the + Malta platform. + * include/devs_eth_mips_mips32_malta.inl: Same. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/mips/malta/current/cdl/mips_mips32_malta_eth_drivers.cdl b/packages/devs/eth/mips/malta/current/cdl/mips_mips32_malta_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mips/malta/current/cdl/mips_mips32_malta_eth_drivers.cdl @@ -0,0 +1,130 @@ +# ==================================================================== +# +# malta_eth_drivers.cdl +# +# Ethernet drivers - support for AMD PCnet ethernet controller +# on the MIPS MALTA board. +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: jskov +# Date: 2001-04-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_MIPS_MIPS32_MALTA { + display "MIPS MALTA board ethernet driver" + description "Ethernet driver for MIPS MALTA board." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_MIPS_MALTA + + include_dir cyg/io + + # FIXME: This really belongs in the AMD_PCNET package + cdl_interface CYGINT_DEVS_ETH_AMD_PCNET_REQUIRED { + display "AMD PCNET ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_AMD_PCNET_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_AMD_PCNET_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0 { + display "MALTA ethernet port 0 driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + MALTA port 0." + + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_AMD_PCNET_REQUIRED + + cdl_option CYGNUM_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_RX_RING_SIZE { + display "Size of RX ring for ETH0" + flavor data + default_value 4 + legal_values { 4 8 16 32 64 128 } + description " + This option sets the size of the RX ring." + } + + cdl_option CYGNUM_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_TX_RING_SIZE { + display "Size of TX ring for ETH0" + flavor data + default_value 16 + legal_values { 4 8 16 32 64 128 } + description " + This option sets the size of the TX ring." + } + + cdl_option CYGDAT_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_NAME { + display "Device name for the ETH0 ethernet port 0 driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + MALTA port 0." + } + + cdl_component CYGSEM_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } +} diff --git a/packages/devs/eth/mips/malta/current/include/devs_eth_mips_mips32_malta.inl b/packages/devs/eth/mips/malta/current/include/devs_eth_mips_mips32_malta.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mips/malta/current/include/devs_eth_mips_mips32_malta.inl @@ -0,0 +1,109 @@ +//========================================================================== +// +// devs/eth/mips/malta/include/devs_eth_mips_mips32_malta.inl +// +// Malta ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-04-02 +// Purpose: Malta ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR + +#ifdef __WANT_CONFIG + +#define CYGHWR_AMD_PCNET_PCI_MEM_MAP_BASE CYGARC_UNCACHED_ADDRESS((cyg_uint32)(&CYGMEM_SECTION_pci_window[0])) +#define CYGHWR_AMD_PCNET_PCI_MEM_MAP_SIZE ((cyg_uint32)(CYGMEM_SECTION_pci_window_SIZE)) + +#endif // __WANT_CONFIG + + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0 + +static pcnet_priv_data amd_pcnet_eth0_priv_data = { +#ifdef CYGSEM_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +#endif + config_esa : NULL, + rx_ring : NULL, + rx_ring_cnt : (1<<2) /*CYGNUM_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_RX_RING_SIZE*/, + rx_ring_log_cnt : 2, + tx_ring : NULL, + tx_ring_cnt : (1<<2) /*CYGNUM_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_TX_RING_SIZE*/, + tx_ring_log_cnt : 2, +}; + +ETH_DRV_SC(amd_pcnet_sc, + &amd_pcnet_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_NAME, + pcnet_start, + pcnet_stop, + pcnet_control, + pcnet_can_send, + pcnet_send, + pcnet_recv, + pcnet_deliver, // "pseudoDSR" called from fast net thread + pcnet_poll, // poll function, encapsulates ISR and DSR + pcnet_int_vector); + +NETDEVTAB_ENTRY(pcnet_netdev, + "pcnet_" CYGDAT_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_NAME, + amd_pcnet_init, + &amd_pcnet_sc); +#endif // CYGPKG_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0 + +// These arrays are used for sanity checking of pointers +struct pcnet_priv_data * +pcnet_priv_array[CYGNUM_DEVS_ETH_AMD_PCNET_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0 + &amd_pcnet_eth0_priv_data, +#endif +}; + +#endif // __WANT_DEVS + +// EOF devs_eth_mips_mips32_malta.inl diff --git a/packages/devs/eth/mips/ocelot/current/ChangeLog b/packages/devs/eth/mips/ocelot/current/ChangeLog --- a/packages/devs/eth/mips/ocelot/current/ChangeLog +++ b/packages/devs/eth/mips/ocelot/current/ChangeLog @@ -19,27 +19,36 @@ 2001-11-29 Jesper Skov + + * src/if_upd985xx.c (upd985xx_eth_upd985xx_init): Fake an ESA if + we see all ones from the EEPROM as well as all zeros. + +2001-08-30 Hugo Tyson + + * cdl/upd985xx_eth_drivers.cdl: Make the "..._E2ONLY" workaround + option on by default since this is how it will be used - the CPU + load does suffer somewhat if promisc mode is set in the hardware. + This should be unset to allow the workaround for E1 at 100Mbit. + +2001-08-30 Hugo Tyson + + * src/if_upd985xx.c (PacketRxReady): Re-write the manual + implementation of ESA matching for workaround E1E2 when the device + is in promiscuous mode. It was having problems with the previous + version; this works better. + +2001-08-24 Hugo Tyson + + * cdl/upd985xx_eth_drivers.cdl: Configury for an alternate case + where we workaround hardware bug E2 only, as a subset of the E1E2 + complete fix. Added more description to the options too. + + * src/if_upd985xx.c (eth_upd985xx_configure): Handle an alternate + case where we workaround hardware bug E2 only. This means leaving + the device in normal mode (unless set to promisc) and doing MAC + address filtering by hand anyway. + +2001-08-20 Hugo Tyson + + * src/if_upd985xx.c: Guard all entrypoints that can mess with + hardware state by "active" check. If the net is included in an + app, but not used, it is init'd but not started - this can leave a + pending interrupt from RedBoot's use of the network to take us + completely by surprise. So init() acks and masks the interrupt, + can_send(), recv() and deliver() now demur if not active. + Also some additional STATIC's on entrypoint functions. + +2001-08-16 Hugo Tyson + + * src/if_upd985xx.c (upd985xx_eth_upd985xx_init): If the EEPROM + contains nothing (or isn't fitted?) fake an ESA so we can get + RedBoot going on the board without special configury. + +2001-08-16 Hugo Tyson + + * src/if_upd985xx.c (eth_upd985xx_configure): Use smaller numbers + for the Tx Fill Threshold [TX_FLTH] and DMA Tx Burst Size [DTBS] + because the hardware is even more broken than first throught - + this is new information on fault E4. I also tagged this with the + name of the option we would use if this were cdl controlled - but + since it's just setup I see no need to change it, so no CDL. + +2001-08-16 Hugo Tyson + + * src/if_upd985xx.c (TxDone): Since it still wedged occasionally, + with an "out of rx buffers" status but nothing else, this is a + much simplified workaround for bug E8. If we see the suspect + transmit status, simply reset the whole subsystem there and then. + This leaves it in far more of a known state. It's neater anyway. + +2001-08-15 Hugo Tyson + + * src/if_upd985xx.c (eth_upd985xx_send): Small hacks to recover + from various wedged states with bogus or unexpected ETH_ISR + values... 0x80000000: We detect this in the deliver routine and + totally reset the system. "out of rx buffers" with no "good rx": + we unmask and check for all these RX interrupts, not just "good + rx". Also PacketRxReady() shortcuts to resetting the receive + engine when it sees the problem. I suspect these might be caused + by the E8 workaround below, perhaps introducing some race + condition with turning off the receiver just when it rx'd - and of + course E1E2 means it receives far more packets. + +2001-08-07 Hugo Tyson + + * src/if_upd985xx.c: Workaround various bugs in the hardware; + these workarounds are conditionally compiled via CDL options named + CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_xxx in general; 'xxx' + is the reference for the mis-feature. All are enabled by default. + + To summarize: + (eth_upd985xx_reset): xxx=S1: insert reads between writes to the + device to avoid a possible deadlock; macro FLUSH_WRITES(). + (PacketRxReady): xxx=E1E2: we set the device in promiscuous mode + always, and implement ESA matching in code. The cost is small. + If promisc mode is set by the stack, we pass all packets. + (eth_upd985xx_send): xxx=E3: we copy any transmit that uses 3 or + more SGs into a static contiguous buffer and transmit from that + thus using only one buffer descriptor. + (eth_upd985xx_send): + (TxDone): xxx=E8: we make a note that a tx ended badly and when + starting the next tx, we disable and reset the transmitter. + + * cdl/upd985xx_eth_drivers.cdl: New subcomponent for controlling + these workarounds: CYGPKG_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS. + "Workarounds for Ethernet Hardware bugs" + +2001-07-16 Hugo Tyson + + * src/if_upd985xx.c (PacketRxReady): Test for, rather than assert, + packet size in range. The hardware can report a tiny packet as + AOK, with no bad in the status, despite the doc's reassurances. + +2001-07-13 Hugo Tyson + + * cdl/upd985xx_eth_drivers.cdl: Turn off the startup chatter. + +2001-07-13 Hugo Tyson + + * src/if_upd985xx.c (TxDone): Test a few more bits for tx + complete; it turns out you can get tx underruns when the CPU us + heavily loaded, as in the tcp_echo tests with high load. + +2001-07-13 Hugo Tyson + + * src/if_upd985xx.c (eth_upd985xx_send): Use HAL_DCACHE_STORE() + rather than syncing the whole of cache every sglist entry(=mbuf). + Turns out the cache op must be cache line aligned to work on the + 4120, boo, unlike other MIPS and unlike the doc, even. + +2001-07-12 Hugo Tyson + + * cdl/upd985xx_eth_drivers.cdl (CYGPKG_DEVS_ETH_MIPS_UPD985XX_ETH0): + Whole new section to address configuring the source of the MAC + address. Also allows configury of the device's name ("eth0") for + cohabitation with additional devices. + + * src/if_upd985xx.c (upd985xx_eth_upd985xx_init): Pick up the ESA + from EEPROM if it's available, also support a fixed ESA from CDL + configuration land. A few minor changes to the structure + initialization to accommodate this; also pick up the interrupt + vector from struct init. + (eth_set_mac_address): New routine available via the ioctl() + entry, for use when neither a fixed nor EEPROM address is + available. + +2001-07-12 Hugo Tyson + + * src/if_upd985xx.c (NUM_RXBUFS): Reduce NUM_RXBUFS to 8; IME + fewer results in lost rx's in typical systems. Enlarge rx buffers + slightly, to accommodate oversize VLAN packets. 128 bytes extra + should be enough. Implemented eth_upd985xx_configure() selection + of promiscuous mode and allow oversize packets - up to the allowed + oversize. Otherwise we would get confused if a packet ate more + than 1 rx buffer. + +2001-07-12 Hugo Tyson + + * src/if_upd985xx.c: Tidy up debug print defaults; make functions + static; add a few extra statistics to the device object; pass a + p_eth_upd985xx around more consistently for if we switch to + multiple devices in future; comment out mii_write(); handle + stopping the device with a tx pending; remove some commented-out + templates copied from another driver; and fill in SNMP statistics. + In other words, many minor changes. + +2001-07-11 Hugo Tyson + + * src/if_upd985xx.c (PacketRxReady): Recover from running out of + receive buffers. All very dodgy, but it seems to work. + Additional efforts are also made to reset the device, having + realized how hard it is to re-initialize the receive engine once + it has been awakened. + +2001-07-11 Hugo Tyson + + * src/if_upd985xx.c: Efficient Rx now essentially working, with a + simple circular buffer, always linked into a ring, and one entry + of which is always NULL,NULL to bring the rx machinery to a halt. + If it reaches thus far the rx mechanism seems to jam; will deal + with that next. + +2001-07-09 Hugo Tyson + + * src/if_upd985xx.c: Rejigged version of the rx buffer system; + still not working properly, still not a good match for the + hardware's elusive semantics. Committed anyway, to keep it around + for reference. + (eth_upd985xx_status): Also removed all the cruft about + renegotiating line status; it's not needed. + +2001-07-06 Hugo Tyson + + * include/upd985xx_eth.h (ETH_MADR_PHY_DEVICE_PHYS_ADDRESS): + Change name of PHY address symbol to generic not SEEQ. + Comment out the non-standard symbols for useful bits that the + previous PHY device supported. + + * src/if_upd985xx.c (eth_upd985xx_reset): If there is a valid ESA + in the MAC already, run with it - it would have come from the + not-fitted serial EEPROM, via some different registers. + (upd985xx_eth_upd985xx_init): Moved the call to reset about to + accommodate this. + (eth_upd985xx_status): Omit renegotiation of link properties and + use the intersection of the capabilities bits to report what + speed, duplex, we are running at. More portable. + (mii_write): + (mii_read): Change name of PHY address symbol to generic not SEEQ + 'cos the board has changed. + +2001-07-06 Hugo Tyson + + * ChangeLog: + * cdl/upd985xx_eth_drivers.cdl: + * include/upd985xx_eth.h: + * src/if_upd985xx.c: + New files. Initial checkin of limping along version of + NEC upd985xx ethernet driver. + + Limitations: + ESA is hard coded. + It talks to the PHY just to make sure - helped with debug anyway. + No SNMP data exported. + No ioctl() for promiscuous mode or VLAN mode. + Only one TX at once. + Only one RX buffer, so no RX until serviced. + It seems to loose interrupts - inevitably, for an eth device - and + there's no "catchup" defense against this yet. + + It's oriented to the "old" (already) board - so the particular PHY + and GPIO layout. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/mips/upd985xx/current/cdl/upd985xx_eth_drivers.cdl b/packages/devs/eth/mips/upd985xx/current/cdl/upd985xx_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mips/upd985xx/current/cdl/upd985xx_eth_drivers.cdl @@ -0,0 +1,205 @@ +# ==================================================================== +# +# upd985xx_eth_drivers.cdl +# +# Ethernet drivers +# NEC uPD985xx device specific support +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): hmt +# Original data: hmt +# Contributors: gthomas +# Date: 2001-06-28 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_MIPS_UPD985XX { + display "NEC uPD985xx ethernet driver" + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_MIPS_UPD985XX + + implements CYGHWR_NET_DRIVER_ETH0 + + implements CYGHWR_NET_DRIVERS + include_dir cyg/devs/eth + + description "Ethernet driver for NEC uPD985xx devices." + compile -library=libextras.a if_upd985xx.c + + cdl_option CYGDBG_DEVS_ETH_MIPS_UPD985XX_CHATTER { + display "Prints ethernet device status info during startup" + default_value 0 + description " + The ethernet device initialization code can print lots of info + to confirm that it has booted correctly." + } + + cdl_option CYGNUM_DEVS_ETH_MIPS_UPD985XX_DEV_COUNT { + display "Number of supported interfaces." + #legal_values 1 + #default_value 1 + calculated 1 + flavor data + description " + This option selects the number of ethernet interfaces to + be supported by the driver." + } + + cdl_component CYGPKG_DEVS_ETH_MIPS_UPD985XX_ETH0 { + display "Ethernet port 0 driver" + flavor bool + calculated 1 + description " + This option includes the ethernet device driver for + port 0 - that is the only connector + depending on your particular hardware." + + + cdl_option CYGDAT_DEVS_ETH_UPD985XX_ETH0_NAME { + display "Device name for the ethernet port 0 driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + ethernet port 0." + } + + cdl_component CYGSEM_DEVS_ETH_UPD985XX_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value false + requires !CYGSEM_DEVS_ETH_UPD985XX_ETH0_GET_EEPROM_ESA + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_UPD985XX_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x00, 0xBA, 0xCA, 0xDD, 0x1E, 0xDD}"} + description "The ethernet station address" + } + } + + cdl_option CYGSEM_DEVS_ETH_UPD985XX_ETH0_GET_EEPROM_ESA { + display "Get the ethernet station address from EEPROM" + flavor bool + default_value !CYGSEM_DEVS_ETH_UPD985XX_ETH0_SET_ESA + requires !CYGSEM_DEVS_ETH_UPD985XX_ETH0_SET_ESA + description "Enabling this option will allow the ethernet + station address to be read from a serial EEPROM (such as 93C06, + 93C46...). If this is not valid, your application must set the + ESA manually via an ioctl() call or similar." + } + } + + cdl_component CYGPKG_DEVS_ETH_MIPS_UPD985XX_OPTIONS { + display "NEC uPD985xx ethernet driver build options" + flavor none + no_define + + cdl_option CYGPKG_DEVS_ETH_MIPS_UPD985XX_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL -D__ECOS" } + description " + This option modifies the set of compiler flags for + building the NEC uPD985xx ethernet driver + package. These flags are used in addition to the set of + global flags." + } + } + + cdl_component CYGPKG_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS { + display "Workarounds for Ethernet Hardware bugs " + flavor bool + default_value 1 + description " + This component controls whether code workarounds for the numerous + hardware bugs in the uPD98503 Ethernet device are included. + These might not all be necessary depending on the speed and mode in + which the interface is used. Please refer to the manufacturer's + Behaviour Analysis Report to make your decision about which of + these options to enable or disable. + The default is to enable all workarounds for best reliability." + + cdl_option CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_S1 { + display "S1 - CPU to IBUS write restriction" + flavor bool + default_value 1 + description "Enable a workaround for hardware bug S1" + } + cdl_component CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E1E2 { + display "E1,E2 - Status queue corruption and MAC filtering" + flavor bool + default_value 1 + description "Enable a workaround for hardware bugs E1 and/or E2." + + cdl_option CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E1E2_E2ONLY { + display "Do not set device in promisc mode - solve E2 only" + flavor bool + default_value 1 + description "Work around bug E2 only - do not set the device + in promiscuous mode by default. + Setting this option prevents the work around + for bug E1." + } + } + cdl_option CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E3 { + display "E3 - Transmit descriptor error" + flavor bool + default_value 1 + description "Enable a workaround for hardware bug E3" + + } + cdl_option CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E8 { + display "E8 - Transmission error under abnormal conditions" + flavor bool + default_value 1 + description "Enable a workaround for hardware bug E8" + } + } +} + +# EOF upd985xx_eth_drivers.cdl diff --git a/packages/devs/eth/mips/upd985xx/current/include/upd985xx_eth.h b/packages/devs/eth/mips/upd985xx/current/include/upd985xx_eth.h new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mips/upd985xx/current/include/upd985xx_eth.h @@ -0,0 +1,465 @@ +#ifndef CYGONCE_HAL_UPD985XX_ETH_H +#define CYGONCE_HAL_UPD985XX_ETH_H +//========================================================================== +// +// upd985xx_eth.h +// +// Architecture specific abstractions for the on-chip ethernet +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, nickg +// Contributors: nickg +// Date: 2001-06-28 +// Purpose: Define architecture abstractions +// Description: This file contains any extra or modified definitions for +// this variant of the architecture's ethernet controller. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +// -------------------------------------------------------------------------- +// By default we use the definition of UPD985XX_SYSETH_REG( n ) from +// var_arch.h - if we port to a KORVA with multiple ethernet controllers we +// will have to vary this to account for the different base addresses. + +// (the noise at the end of these lines is the default value) +// +// Table 5-2. MAC Control Register Map +// +#define ETH_MACC1 UPD985XX_SYSETH_REG( 0x000) // MAC configuration register 1 R/W 0000_0000H +#define ETH_MACC2 UPD985XX_SYSETH_REG( 0x004) // MAC configuration register 2 R/W 0000_0000H +#define ETH_IPGT UPD985XX_SYSETH_REG( 0x008) // Back-to-Back IPG register R/W 0000_0013H +#define ETH_IPGR UPD985XX_SYSETH_REG( 0x00C) // Non Back-to-Back IPG register R/W 0000_0E13H +#define ETH_CLRT UPD985XX_SYSETH_REG( 0x010) // Collision register R/W 0000_370FH +#define ETH_LMAX UPD985XX_SYSETH_REG( 0x014) // Max packet length register R/W 0000_0600H +// N/A UPD985XX_SYSETH_REG( 0x018) // Reserved for future use - - +#define ETH_RETX UPD985XX_SYSETH_REG( 0x020) // Retry count register R/W 0000_0000H +// N/A UPD985XX_SYSETH_REG( 0x024) // Reserved for future use - - +#define ETH_LSA2 UPD985XX_SYSETH_REG( 0x054) // Station Address register 2 R/W 0000_0000H +#define ETH_LSA1 UPD985XX_SYSETH_REG( 0x058) // Station Address register 1 R/W 0000_0000H +#define ETH_PTVR UPD985XX_SYSETH_REG( 0x05C) // Pause timer value read register R 0000_0000H +// N/A UPD985XX_SYSETH_REG( 0x060) // Reserved for future use - - +#define ETH_VLTP UPD985XX_SYSETH_REG( 0x064) // VLAN type register R/W 0000_0000H +#define ETH_MIIC UPD985XX_SYSETH_REG( 0x080) // MII configuration register R/W 0000_0000H +// N/A UPD985XX_SYSETH_REG( 0x084) // Reserved for future use - - +#define ETH_MCMD UPD985XX_SYSETH_REG( 0x094) // MII command register W 0000_0000H +#define ETH_MADR UPD985XX_SYSETH_REG( 0x098) // MII address register R/W 0000_0000H +#define ETH_MWTD UPD985XX_SYSETH_REG( 0x09C) // MII write data register R/W 0000_0000H +#define ETH_MRDD UPD985XX_SYSETH_REG( 0x0A0) // MII read data register R 0000_0000H +#define ETH_MIND UPD985XX_SYSETH_REG( 0x0A4) // MII indicator register R 0000_0000H +// N/A UPD985XX_SYSETH_REG( 0x0A8) // Reserved for future use - - +#define ETH_AFR UPD985XX_SYSETH_REG( 0x0C8) // Address Filtering register R/W 0000_0000H +#define ETH_HT1 UPD985XX_SYSETH_REG( 0x0CC) // Hash table register 1 R/W 0000_0000H +#define ETH_HT2 UPD985XX_SYSETH_REG( 0x0D0) // Hash table register 2 R/W 0000_0000H +// N/A UPD985XX_SYSETH_REG( 0x0D4) // Reserved for future use - - +#define ETH_CAR1 UPD985XX_SYSETH_REG( 0x0DC) // Carry register 1 R/W 0000_0000H +#define ETH_CAR2 UPD985XX_SYSETH_REG( 0x0E0) // Carry register 2 R/W 0000_0000H +// N/A UPD985XX_SYSETH_REG( 0x0E4) // Reserved for future use - - +#define ETH_CAM1 UPD985XX_SYSETH_REG( 0x130) // Carry mask register 1 R/W 0000_0000H +#define ETH_CAM2 UPD985XX_SYSETH_REG( 0x134) // Carry mask register 2 R/W 0000_0000H +// N/A UPD985XX_SYSETH_REG( 0x138) // Reserved for future use - - +// +// Table 5-3. Statistics Counter Register Map +// +#define ETH_RBYT UPD985XX_SYSETH_REG( 0x140) // Receive Byte Counter R/W +#define ETH_RPKT UPD985XX_SYSETH_REG( 0x144) // Receive Packet Counter R/W +#define ETH_RFCS UPD985XX_SYSETH_REG( 0x148) // Receive FCS Error Counter R/W +#define ETH_RMCA UPD985XX_SYSETH_REG( 0x14C) // Receive Multicast Packet Counter R/W +#define ETH_RBCA UPD985XX_SYSETH_REG( 0x150) // Receive Broadcast Packet Counter R/W +#define ETH_RXCF UPD985XX_SYSETH_REG( 0x154) // Receive Control Frame Packet Counter R/W +#define ETH_RXPF UPD985XX_SYSETH_REG( 0x158) // Receive PAUSE Frame Packet Counter R/W +#define ETH_RXUO UPD985XX_SYSETH_REG( 0x15C) // Receive Unknown OP code Counter R/W +#define ETH_RALN UPD985XX_SYSETH_REG( 0x160) // Receive Alignment Error Counter R/W +#define ETH_RFLR UPD985XX_SYSETH_REG( 0x164) // Receive Frame Length Out of Range Counter R/W +#define ETH_RCDE UPD985XX_SYSETH_REG( 0x168) // Receive Code Error Counter R/W +#define ETH_RFCR UPD985XX_SYSETH_REG( 0x16C) // Receive False Carrier Counter R/W +#define ETH_RUND UPD985XX_SYSETH_REG( 0x170) // Receive Undersize Packet Counter R/W +#define ETH_ROVR UPD985XX_SYSETH_REG( 0x174) // Receive Oversize Packet Counter R/W +#define ETH_RFRG UPD985XX_SYSETH_REG( 0x178) // Receive Error Undersize Packet Counter R/W +#define ETH_RJBR UPD985XX_SYSETH_REG( 0x17C) // Receive Error Oversize Packet Counter R/W +#define ETH_R64 UPD985XX_SYSETH_REG( 0x180) // Receive 64 Byte Frame Counter R/W +#define ETH_R127 UPD985XX_SYSETH_REG( 0x184) // Receive 65 to 127 Byte Frame Counter R/W +#define ETH_R255 UPD985XX_SYSETH_REG( 0x188) // Receive 128 to 255 Byte Frame Counter R/W +#define ETH_R511 UPD985XX_SYSETH_REG( 0x18C) // Receive 256 to 511 Byte Frame Counter R/W +#define ETH_R1K UPD985XX_SYSETH_REG( 0x190) // Receive 512 to 1023 Byte Frame Counter R/W +#define ETH_RMAX UPD985XX_SYSETH_REG( 0x194) // Receive Over 1023 Byte Frame Counter R/W +#define ETH_RVBT UPD985XX_SYSETH_REG( 0x198) // Receive Valid Byte Counter R/W +#define ETH_TBYT UPD985XX_SYSETH_REG( 0x1C0) // Transmit Byte Counter R/W +#define ETH_TPCT UPD985XX_SYSETH_REG( 0x1C4) // Transmit Packet Counter R/W +#define ETH_TFCS UPD985XX_SYSETH_REG( 0x1C8) // Transmit CRC Error Packet Counter R/W +#define ETH_TMCA UPD985XX_SYSETH_REG( 0x1CC) // Transmit Multicast Packet Counter R/W +#define ETH_TBCA UPD985XX_SYSETH_REG( 0x1D0) // Transmit Broadcast Packet Counter R/W +#define ETH_TUCA UPD985XX_SYSETH_REG( 0x1D4) // Transmit Unicast Packet Counter R/W +#define ETH_TXPF UPD985XX_SYSETH_REG( 0x1D8) // Transmit PAUSE control Frame Counter R/W +#define ETH_TDFR UPD985XX_SYSETH_REG( 0x1DC) // Transmit Single Deferral Packet Counter R/W +#define ETH_TXDF UPD985XX_SYSETH_REG( 0x1E0) // Transmit Excessive Deferral Packet Counter R/W +#define ETH_TSCL UPD985XX_SYSETH_REG( 0x1E4) // Transmit Single Collision Packet Counter R/W +#define ETH_TMCL UPD985XX_SYSETH_REG( 0x1E8) // Transmit Multiple collision Packet Counter R/W +#define ETH_TLCL UPD985XX_SYSETH_REG( 0x1EC) // Transmit Late Collision Packet Counter R/W +#define ETH_TXCL UPD985XX_SYSETH_REG( 0x1F0) // Transmit Excessive Collision Packet Counter R/W +#define ETH_TNCL UPD985XX_SYSETH_REG( 0x1F4) // Transmit Total Collision Counter R/W +#define ETH_TCSE UPD985XX_SYSETH_REG( 0x1F8) // Transmit Carrier Sense Error Counter R/W +#define ETH_TIME UPD985XX_SYSETH_REG( 0x1FC) // Transmit Internal MAC Error Counter R/W +// +// Table 5-4. DMA and FIFO Management Registers Map +// +#define ETH_TXCR UPD985XX_SYSETH_REG( 0x200) // Transmit Configuration Register R/W 0000_0000H +#define ETH_TXFCR UPD985XX_SYSETH_REG( 0x204) // Transmit FIFO Control Register R/W FFFF_40C0H +#define ETH_TXDTR UPD985XX_SYSETH_REG( 0x208) // Transmit Data Register W 0000_0000H +#define ETH_TXSR UPD985XX_SYSETH_REG( 0x20C) // Transmit Status Register R 0000_0000H +// N/A UPD985XX_SYSETH_REG( 0x210) // Reserved for future use - - +#define ETH_TXDPR UPD985XX_SYSETH_REG( 0x214) // Transmit Descriptor Pointer R/W 0000_0000H +#define ETH_RXCR UPD985XX_SYSETH_REG( 0x218) // Receive Configuration Register R/W 0000_0000H +#define ETH_RXFCR UPD985XX_SYSETH_REG( 0x21C) // Receive FIFO Control Register R/W C040_0040H +#define ETH_RXDTR UPD985XX_SYSETH_REG( 0x220) // Receive Data Register R 0000_0000H +#define ETH_RXSR UPD985XX_SYSETH_REG( 0x224) // Receive Status Register R 0000_0000H +// N/A UPD985XX_SYSETH_REG( 0x228) // Reserved for future use - - +#define ETH_RXDPR UPD985XX_SYSETH_REG( 0x22C) // Receive Descriptor Pointer R/W 0000_0000H +#define ETH_RXPDR UPD985XX_SYSETH_REG( 0x230) // Receive Pool Descriptor Register R/W 0000_0000H +// +// Table 5-5. Interrupt and Configuration Registers Map +// +#define ETH_CCR UPD985XX_SYSETH_REG( 0x234) // Configuration Register R/W 0000_0000H +#define ETH_ISR UPD985XX_SYSETH_REG( 0x238) // Interrupt Service Register R 0000_0000H +#define ETH_MSR UPD985XX_SYSETH_REG( 0x23C) // Mask Serves Register R/W 0000_0000H + +// -------------------------------------------------------------------------- +// Now the fields within all those registers... +// +// Table 5-2. MAC Control Register Map +// +// ETH_MACC1 0x000 MAC configuration register 1 R/W 0000_0000H +#define ETH_MACC1_MACLB (1<<14) // MAC loopback: 0 +#define ETH_MACC1_TXFC (1<<11) // Transmit flow control enable: 0 +#define ETH_MACC1_RXFC (1<<10) // Receive flow control enable: 0 +#define ETH_MACC1_SRXEN (1<< 9) // Receive enable: 0 +#define ETH_MACC1_PARF (1<< 8) // Control packet pass: 0 +#define ETH_MACC1_PUREP (1<< 7) // Pure preamble: 0 +#define ETH_MACC1_FLCHT (1<< 6) // Length field check: 0 +#define ETH_MACC1_NOBO (1<< 5) // No Back Off: 0 +#define ETH_MACC1_CRCEN (1<< 3) // CRC append enable: 0 +#define ETH_MACC1_PADEN (1<< 2) // PAD append enable: 0 +#define ETH_MACC1_FDX (1<< 1) // Full duplex enable: 0 +#define ETH_MACC1_HUGEN (1<< 0) // Large packet enable: 0 +// ETH_MACC2 0x004 MAC configuration register 2 R/W 0000_0000H +#define ETH_MACC2_MCRST (1<<10) // MAC Control Block software reset: 0 +#define ETH_MACC2_RFRST (1<< 9) // Receive Function Block software reset: 0 +#define ETH_MACC2_TFRST (1<< 8) // Transmit Function Block software reset: 0 +#define ETH_MACC2_BPNB (1<< 6) // Back Pressure No Back Off: 0 +#define ETH_MACC2_APD (1<< 5) // Auto VLAN PAD: 0 +#define ETH_MACC2_VPD (1<< 4) // VLAN PAD mode: 0 + +// ETH_IPGT 0x008 Back-to-Back IPG register R/W 0000_0013H +// ETH_IPGR 0x00C Non Back-to-Back IPG register R/W 0000_0E13H +// ETH_CLRT 0x010 Collision register R/W 0000_370FH +// ETH_LMAX 0x014 Max packet length register R/W 0000_0600H +// N/A 0x018 Reserved for future use - - +// ETH_RETX 0x020 Retry count register R/W 0000_0000H +// N/A 0x024 Reserved for future use - - +// ETH_LSA2 0x054 Station Address register 2 R/W 0000_0000H +// ETH_LSA1 0x058 Station Address register 1 R/W 0000_0000H +// ETH_PTVR 0x05C Pause timer value read register R 0000_0000H +// N/A 0x060 Reserved for future use - - +// ETH_VLTP 0x064 VLAN type register R/W 0000_0000H +#define ETH_VLTP_VLTP (0x00008100) // magic number from example +// ETH_MIIC 0x080 MII configuration register R/W 0000_0000H +#define ETH_MIIC_MIRST (1<<15) // MII Management Interface Block software reset +#define ETH_MIIC_CLKS (0x0C) // 3:2 CLKS Select frequency range: +#define ETH_MIIC_25 (0x00) // 00: HCLK is equal to 25 MHz +#define ETH_MIIC_33 (0x04) // 01: HCLK is less than or equal to 33 MHz +#define ETH_MIIC_50 (0x08) // 10: HCLK is less than or equal to 50 MHz +#define ETH_MIIC_66 (0x0C) // 11: HCLK is less than or equal to 66 MHz +// ETH_MCMD 0x094 MII command register W 0000_0000H +#define ETH_MCMD_SCANC (1<< 1) // SCAN command: 0 +#define ETH_MCMD_RSTAT (1<< 0) // MII management read: 0 +// ETH_MADR 0x098 MII address register R/W 0000_0000H +#define ETH_MADR_PHY_ADDR_SHIFT (8) +// ETH_MWTD 0x09C MII write data register R/W 0000_0000H +// ETH_MRDD 0x0A0 MII read data register R 0000_0000H +// ETH_MIND 0x0A4 MII indicator register R 0000_0000H +#define ETH_MIND_NVALID (1<< 2) // SCAN command start status: 0 +#define ETH_MIND_SCANA (1<< 1) // SCAN command active: 0 +#define ETH_MIND_BUSY (1<< 0) // BUSY: 0 +// ETH_AFR 0x0C8 Address Filtering register R/W 0000_0000H +#define ETH_AFR_PRO (1<< 3) // Promiscuous mode: 0 +#define ETH_AFR_PRM (1<< 2) // Accept Multicast: 0 +#define ETH_AFR_AMC (1<< 1) // Accept Multicast ( qualified ): 0 +#define ETH_AFR_ABC (1<< 0) // Accept Broadcast: 0 +// ETH_HT1 0x0CC Hash table register 1 R/W 0000_0000H +// ETH_HT2 0x0D0 Hash table register 2 R/W 0000_0000H +// ETH_CAR1 0x0DC Carry register 1 R/W 0000_0000H +// ETH_CAR2 0x0E0 Carry register 2 R/W 0000_0000H +// ETH_CAM1 0x130 Carry mask register 1 R/W 0000_0000H +// ETH_CAM2 0x134 Carry mask register 2 R/W 0000_0000H +// +// Table 5-3. Statistics Counter Register Map +// +// +// Table 5-4. DMA and FIFO Management Registers Map +// +// ETH_TXCR 0x200 Transmit Configuration Register R/W 0000_0000H +#define ETH_TXCR_TXE (1<<31) // Transmit Enable: +#define ETH_TXCR_DTBS_SHIFT (16) // 18:16 DMA Transmit Burst Size: +#define ETH_TXCR_DTBS (0x70000) // 18:16 DMA Transmit Burst Size: +#define ETH_TXCR_DTBS_1 (0x00000) // 000: 1 Word (4 bytes) +#define ETH_TXCR_DTBS_2 (0x10000) // 001: 2 Word (8 bytes) +#define ETH_TXCR_DTBS_4 (0x20000) // 010: 4 Word (16 bytes) +#define ETH_TXCR_DTBS_8 (0x30000) // 011: 8 Word (32 bytes) +#define ETH_TXCR_DTBS_16 (0x40000) // 100: 16 Word (64 bytes) +#define ETH_TXCR_DTBS_32 (0x50000) // 101: 32 Word (128 bytes) +#define ETH_TXCR_DTBS_64 (0x60000) // 110: 64 Word (256 bytes) +#define ETH_TXCR_AFCE (1<< 0) // Auto Flow Control Enable: +// ETH_TXFCR 0x204 Transmit FIFO Control Register R/W FFFF_40C0H +#define ETH_TXFCR_TPTV_SHIFT (16) // 31:16 Transmit Pause Timer Value: FFFFH +#define ETH_TXFCR_TPTV (0xffff0000) // 31:16 Transmit Pause Timer Value: FFFFH +#define ETH_TXFCR_TX_DRTH_SHIFT (10) // 15:10 Transmit Drain Threshold Level: 10H +#define ETH_TXFCR_TX_DRTH (0x0000fc00) // 15:10 Transmit Drain Threshold Level: 10H +#define ETH_TXFCR_TX_FLTH_SHIFT (2) // 7:2 Transmit Fill Threshold Level: 03H +#define ETH_TXFCR_TX_FLTH (0x000000fc) // 7:2 Transmit Fill Threshold Level: 03H +#define ETH_TXFCR_TPTV_DEFAULT (0x10000000) // default 0x1000 slot time (1slot:512bit) +#define ETH_TXFCR_TX_DRTH_DEFAULT (0x00002000) // 001000b (8long, 32byte) +#define ETH_TXFCR_TX_FLTH_DEFAULT (0x000000c0) // default 110000b (48word, 192byte) +// ETH_TXDTR 0x208 Transmit Data Register W 0000_0000H +// ETH_TXSR 0x20C Transmit Status Register R 0000_0000H +#define ETH_TXSR_CSE (1<<31) // Carrier lost was detected during the transmission 0 +#define ETH_TXSR_TBP (1<<30) // Back pressure occurred when the packet was received 0 +#define ETH_TXSR_TPP (1<<29) // A packet request during the PAUSE operation was transmitted 0 +#define ETH_TXSR_TPCF (1<<28) // A PAUSE control frame was transmitted 0 +#define ETH_TXSR_TCFR (1<<27) // A control frame was transmitted 0 +#define ETH_TXSR_TUDR (1<<26) // The TPUR pin was set high and aborted. Note 2 0 +#define ETH_TXSR_TGNT (1<<25) // A huge packet was transmitted and aborted. 0 +#define ETH_TXSR_LCOL (1<<24) // Collision occurred +#define ETH_TXSR_ECOL (1<<23) // Excess collisions +#define ETH_TXSR_TEDFR (1<<22) // Excess deferred +#define ETH_TXSR_TDFR (1<<21) // Transmission deferral occurred +#define ETH_TXSR_TBRO (1<<20) // A broadcast packet was transmitted. 0 +#define ETH_TXSR_TMUL (1<<19) // A multicast packet was transmitted. 0 +#define ETH_TXSR_TDONE (1<<18) // Transmission was completed. 0 +#define ETH_TXSR_TFLOR (1<<17) // Value of the length field was huge +#define ETH_TXSR_TFLER (1<<16) // Value of the length field didn~t match the actual data count +#define ETH_TXSR_TCRCE (1<<15) // Attached CRC didn~t match the internal generated CRC + +#define ETH_TXSR_TCBC_SHIFT (11) // 14:11 collisions for the previous transmission +#define ETH_TXSR_TCBC (0x7800) // 14:11 collisions for the previous transmission +#define ETH_TXSR_TBYT_SHIFT (0) // 10:0 transmitted bytes not including collided bytes +#define ETH_TXSR_TBYT (0x07FF) // 10:0 transmitted bytes not including collided bytes + +// ETH_RXCR UPD985XX_SYSETH_REG( 0x218) // Receive Configuration Register R/W 0000_0000H +#define ETH_RXCR_RXE (1<<31) // Receive Enable: +#define ETH_RXCR_DRBS_SHIFT (16) // 18:16 DRBS DMA Transmit Burst Size: 0 +#define ETH_RXCR_DRBS (0x70000) // +#define ETH_RXCR_DRBS_1 (0x00000) // 000: 1 Word (4 bytes) +#define ETH_RXCR_DRBS_2 (0x10000) // 001: 2 Word (8 bytes) +#define ETH_RXCR_DRBS_4 (0x20000) // 010: 4 Word (16 bytes) +#define ETH_RXCR_DRBS_8 (0x30000) // 011: 8 Word (32 bytes) +#define ETH_RXCR_DRBS_16 (0x40000) // 100: 16 Word (64 bytes) +#define ETH_RXCR_DRBS_32 (0x50000) // 101: 32 Word (128 bytes) +#define ETH_RXCR_DRBS_64 (0x60000) // 110: 64 Word (256 bytes) + +// ETH_RXFCR 0x21C Receive FIFO Control Register R/W C040_0040H +#define ETH_RXFCR_UWM (0xfc000000) // 31:26 Upper Water Mark: 30H +#define ETH_RXFCR_UWM_SHIFT (26) // 31:26 Upper Water Mark: 30H +#define ETH_RXFCR_LWM (0x00fc0000) // 23:18 Lower Water Mark: 10H +#define ETH_RXFCR_LWM_SHIFT (18) // 23:18 Lower Water Mark: 10H +#define ETH_RXFCR_RX_DRTH (0x000000fc) // 7: 2 Receive Drain Threshold Level 10H +#define ETH_RXFCR_RX_DRTH_SHIFT (2) // 7: 2 Receive Drain Threshold Level 10H +#define ETH_RXFCR_UWM_DEFAULT (0xE0000000) // default 110000b ( 48word, 192byte ) +#define ETH_RXFCR_LWM_DEFAULT (0x00400000) // default 010000b (16word, 64byte) +#define ETH_RXFCR_DRTH16W (0x00000040) // default 010000b (16word, 64byte) + +// ETH_RXDTR 0x220 Receive Data Register R 0000_0000H +// ETH_RXSR 0x224 Receive Status Register R 0000_0000H +#define ETH_RXSR_RLENE (1<<31) // A toosmall or toolarge packet was received. +#define ETH_RXSR_VLAN (1<<30) // A VLAN was received. +#define ETH_RXSR_USOP (1<<29) // A control frame containing an unknown OP code was received. +#define ETH_RXSR_PRCF (1<<28) // A control frame containing the PAUSE OP code was received. +#define ETH_RXSR_RCFR (1<<27) // A control frame was received. +#define ETH_RXSR_DBNB (1<<26) // An alignment error occurred. +#define ETH_RXSR_RBRO (1<<25) // A broadcast packet was received. 0 +#define ETH_RXSR_RMUL (1<<24) // A multicast packet was received. 0 +#define ETH_RXSR_RXOK (1<<23) // A good packet was received. +#define ETH_RXSR_RLOR (1<<22) // The value of the length field was huge +#define ETH_RXSR_RLER (1<<21) // The value of the length field didn~t match +#define ETH_RXSR_RCRCE (1<<20) // A CRC error occurred. 0 +#define ETH_RXSR_RCV (1<<19) // RXER was detected. 0 +#define ETH_RXSR_CEPS (1<<18) // A False Carrier was detected. 0 +#define ETH_RXSR_REPS (1<<17) // A packet which had a preamble and SFD only or one data nibble +#define ETH_RXSR_PAIG (1<<16) // +#define ETH_RXSR_RBYT (0xffff) // 15:0 The received byte count 0 +#define ETH_RXSR_RBYT_SHIFT (0) // 15:0 The received byte count 0 +// ETH_RXDPR 0x22C Receive Descriptor Register R/W 0000_0000H +// ETH_RXPDR 0x230 Receive Pool Descriptor Register R/W 0000_0000H +#define ETH_RXPDR_AL (0x70000000) // 30:28 AL[2:0] Alert Level 0H +#define ETH_RXPDR_AL_SHIFT (28) +#define ETH_RXPDR_RNOD (0xffff) // 15:0 Remaining Number of Descriptor 0H +#define ETH_RXPDR_RNOD_SHIFT (0) +// +// Table 5-5. Interrupt and Configuration Registers Map +// +// ETH_CCR 0x234 Configuration Register R/W 0000_0000H +#define ETH_CCR_SRT (1) // Software Reset (cleared automatically to '0') +// ETH_ISR 0x238 Interrupt Service Register R 0000_0000H +#define ETH_ISR_XMTDN (1<<15) // Transmit Done +#define ETH_ISR_TBDR (1<<14) // Transmit Buffer Descriptor Request at Null +#define ETH_ISR_TFLE (1<<13) // Transmit Frame Length Exceed +#define ETH_ISR_UR (1<<12) // Underrun +#define ETH_ISR_TABR (1<<11) // Transmit Aborted +#define ETH_ISR_TCFRI (1<<10) // Control Frame Transmit +#define ETH_ISR_RCVDN (1<<7 ) // Receive Done +#define ETH_ISR_RBDRS (1<<6 ) // Receive Buffer Descriptor Request at alert level +#define ETH_ISR_RBDRU (1<<5 ) // Receive Buffer Descriptor Request at zero +#define ETH_ISR_OF (1<<4 ) // Overflow +#define ETH_ISR_LFAL (1<<3 ) // Link Failed +#define ETH_ISR_CARRY (1<<0 ) // Carry Flag: +// ETH_MSR 0x23C Mask Serves Register R/W 0000_0000H +// As above + +// -------------------------------------------------------------------------- +// And the "buffer descriptor" control structures in RAM... + + +#define ETH_BUF_LAST (1<<31) // Last Descriptor +#define ETH_BUF_D_L (1<<30) // Data Buffer / Link Pointer +#define ETH_BUF_D_L_DATA (1<<30) // Data Buffer / Link Pointer +#define ETH_BUF_D_L_LINK (0<<30) // Data Buffer / Link Pointer +#define ETH_BUF_OWN (1<<29) // Owner 1:Ethernet Controller 0: VR4120A +#define ETH_BUF_OWN_ETH (1<<29) +#define ETH_BUF_OWN_CPU (0<<29) + +#define ETH_BUF_DBRWE (1<<28) // Buffer Access Error +#define ETH_BUF_OK (1<<16) // Tx or Rx OK +#define ETH_BUF_SIZE (0xffff) // Byte Count + +#define ETH_BUF_TX_TUDR (1<<27) // Transmit Underrun Error +#define ETH_BUF_TX_CSE (1<<26) // Carrier Sense Lost Error +#define ETH_BUF_TX_LCOL (1<<25) // Late Collision +#define ETH_BUF_TX_ECOL (1<<24) // Excessive Collision +#define ETH_BUF_TX_EDFR (1<<23) // Excessive Deferral +#define ETH_BUF_TX_TGNT (1<<18) // Transmit Giant Frame +#define ETH_BUF_TX_HBF (1<<17) // Heart Beat Fail for ENDEC mode + +#define ETH_BUF_RX_OVRN (1<<24) // Overrun Error +#define ETH_BUF_RX_RUNT (1<<23) // Runt packet +#define ETH_BUF_RX_FRGE (1<<22) // Fragment Error +#define ETH_BUF_RX_RCV (1<<21) // Detects RXER +#define ETH_BUF_RX_FC (1<<20) // False Carrier +#define ETH_BUF_RX_CRCE (1<<19) // CRC Error +#define ETH_BUF_RX_FAE (1<<18) // Frame Alignment Error +#define ETH_BUF_RX_RFLE (1<<17) // Receive Frame Length Error + +#define ETH_BUF_RX_FTYP (0x0e000000) // 27:25 Frame Type[2:0] +#define ETH_BUF_RX_FTYP_SHIFT (25) // 27:25 Frame Type[2:0] +// I don't think we need to know these... +// 000 Broadcast Frame +// 001 Multicast Frame +// 010 Unicast Frame +// 011 VLAN Frame +// 100 PAUSE control frame +// 101 Control Frame (except pause) +// 11x Reserved for future use + + +// -------------------------------------------------------------------------- +// MII stuff for talking to the separate PHY +// Initially this was a SEEQ NQ80225 but now it is a LU3X31T-T64. + +//#define SEEQ_DEVICE_PHYS_ADDRESS (1) // this from the board documentation +#define LU3X31T_DEVICE_PHYS_ADDRESS (2) + +#define ETH_MADR_PHY_DEVICE_PHYS_ADDRESS \ + (LU3X31T_DEVICE_PHYS_ADDRESS << ETH_MADR_PHY_ADDR_SHIFT) + +// I don't know how much they have in common, but I think MII is pretty +// standard, and the "mandated" registers ought to be common. + +#define PHY_CONTROL_REG (0) +#define PHY_STATUS_REG (1) +#define PHY_ID_ONE (2) +#define PHY_ID_TWO (3) +#define PHY_AUTONEG_ADVERT (4) +#define PHY_AUTONEG_REMOTE (5) +#define PHY_STATUS_DETECT_REG (18) + +#define PHY_CONTROL_RESET (1<<15) +#define PHY_CONTROL_LOOPBACK (1<<14) +#define PHY_CONTROL_SPEED100 (1<<13) +#define PHY_CONTROL_AUTONEG_EN (1<<12) +#define PHY_CONTROL_POWERDOWN (1<<11) +#define PHY_CONTROL_MII_DIS (1<<10) +#define PHY_CONTROL_AUTONEG_RST (1<< 9) +#define PHY_CONTROL_DPLX_FULL (1<< 8) +#define PHY_CONTROL_COLLTEST (1<< 7) + +#define PHY_STATUS_CAP_T4 (1<<15) +#define PHY_STATUS_CAP_100TXF (1<<14) +#define PHY_STATUS_CAP_100TXH (1<<13) +#define PHY_STATUS_CAP_10TF (1<<12) +#define PHY_STATUS_CAP_10TH (1<<11) +#define PHY_STATUS_CAP_SUPR (1<< 6) +#define PHY_STATUS_AUTONEG_ACK (1<< 5) +#define PHY_STATUS_REMOTEFAULT (1<< 4) +#define PHY_STATUS_CAP_AUTONEG (1<< 3) +#define PHY_STATUS_LINK_OK (1<< 2) +#define PHY_STATUS_JABBER (1<< 1) +#define PHY_STATUS_EXTREGS (1<< 0) + +// These are the same for both AUTONEG registers +#define PHY_AUTONEG_NEXT (1<<15) +#define PHY_AUTONEG_ACK (1<<14) +#define PHY_AUTONEG_REMOTEFAULT (1<<13) +#define PHY_AUTONEG_100BASET4 (1<< 9) +#define PHY_AUTONEG_100BASETX_FDX (1<< 8) +#define PHY_AUTONEG_100BASETX_HDX (1<< 7) +#define PHY_AUTONEG_10BASET_FDX (1<< 6) +#define PHY_AUTONEG_10BASET_HDX (1<< 5) +#define PHY_AUTONEG_CSMA_802_3 (1<< 0) + +#if 0 +// Others are undocumented +#define PHY_STATUS_DETECT_SPEED100 (1<< 7) +#define PHY_STATUS_DETECT_DPLX_FULL (1<< 6) +#endif + +// Phew! +// -------------------------------------------------------------------------- +#endif // CYGONCE_HAL_UPD985XX_ETH_H +// End of upd985xx_eth.h diff --git a/packages/devs/eth/mips/upd985xx/current/src/if_upd985xx.c b/packages/devs/eth/mips/upd985xx/current/src/if_upd985xx.c new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mips/upd985xx/current/src/if_upd985xx.c @@ -0,0 +1,1619 @@ +//========================================================================== +// +// if_upd985xx.c +// +// Ethernet drivers +// NEC UPD985XX device ethernet specific support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, gthomas +// Contributors: +// Date: 2001-06-28 +// Purpose: +// Description: hardware driver for uPD985xx ethernet devices +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CYGPKG_NET +#include +#include /* Needed for struct ifnet */ +#else +#include +#endif + +#include + +#include + +// ------------------------------------------------------------------------ + +#ifdef CYGDBG_DEVS_ETH_MIPS_UPD985XX_CHATTER +#define nDEBUG_TRAFFIC // This one prints stuff as packets come and go +#define nDEBUG_IOCTL // ioctl() call printing +#define DEBUG // Startup printing mainly +#endif + +#define os_printf diag_printf +#define db_printf diag_printf + +#define STATIC static + +// ------------------------------------------------------------------------ +// I/O access macros as inlines for later changes to >1 device? +// +// (If we need to do this, then these macros would *assume* the +// presence of a valid p_eth_upd985xx just like we always have) + +static inline void OUTL( volatile cyg_uint32 *io_address, cyg_uint32 value ) +{ *io_address = value; } + +static inline cyg_uint32 INL( volatile cyg_uint32 *io_address ) +{ return *io_address; } + +// These map cachable addresses to uncachable ones and vice versa. +// This is all fixed on MIPS. 8-9xxxxxxx uncachable, A-Bxxxxxxx cachable. +#define VIRT_TO_BUS( _x_ ) virt_to_bus((cyg_uint32)(_x_)) +static inline cyg_uint8 *virt_to_bus(cyg_uint32 p_memory) +{ + return (cyg_uint8 *)(0xa0000000u + (p_memory & ~0xe0000000u)); +} +#define BUS_TO_VIRT( _x_ ) bus_to_virt((cyg_uint32)(_x_)) +static inline cyg_uint8 *bus_to_virt(cyg_uint32 p_memory) +{ + return (cyg_uint8 *)(0x80000000u + (p_memory & ~0xe0000000u)); +} + + +// ------------------------------------------------------------------------ +#ifdef CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_S1 +#define FLUSH_WRITES() CYG_MACRO_START \ + (void) INL( ETH_RXSR ); \ +CYG_MACRO_END +#else +#define FLUSH_WRITES() CYG_EMPTY_STATEMENT +#endif + +// ------------------------------------------------------------------------ +// +// DEVICES AND PACKET QUEUES +// +// ------------------------------------------------------------------------ + +// 128 bytes extra for VLAN packets should be enough; AFAICT usually the +// encapsulation is only 4 or 10 bytes extra. +#define MAX_ETHERNET_PACKET_SIZE 1536 // Ethernet Rx packet size +#define MAX_OVERSIZE_PACKET_SIZE 1664 // VLAN Rx packet size +#define MAX_RX_PACKET_SIZE MAX_OVERSIZE_PACKET_SIZE + +#define NUM_RXBUFS (8) + +// This one is the hardware definition. +struct bufdesc { + volatile cyg_uint32 attr; + cyg_uint8 *ptr; +}; + +// Rx databuffer. +STATIC cyg_uint8 rx_databuf[ NUM_RXBUFS ] [ MAX_RX_PACKET_SIZE ]; + +#ifdef CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E3 +// Tx databuffer +STATIC cyg_uint8 tx_databuf[ MAX_RX_PACKET_SIZE ]; +#endif + +struct eth_upd985xx { + cyg_uint8 active, index, tx_busy, mac_addr_ok; + cyg_uint8 vector; // interrupt numbers are small + cyg_uint8 phy_status; // from PHY_STATUS_ flags below + cyg_uint8 hardwired_esa; +#ifdef CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E1E2 + cyg_uint8 promisc; +#endif + cyg_uint8 mac_address[6]; + + cyg_handle_t interrupt_handle; + cyg_interrupt interrupt_object; + + struct cyg_netdevtab_entry *ndp; + + // these shall hold uncached addresses of the structures following... + volatile struct bufdesc *txring; + volatile struct bufdesc *rxring_active; + volatile struct bufdesc *rxring_next; + int rxring_active_index; + int rxring_next_index; + cyg_uint32 intrs; + cyg_uint32 tx_keys[1]; + + // ----------------------------------------------------------------- + // Statistics counters + cyg_uint32 count_rx_resource; + cyg_uint32 count_rx_restart; + cyg_uint32 count_interrupts; + cyg_uint32 count_bad_isr_restarts; + cyg_uint32 count_bad_tx_completion; + + // ----------------------------------------------------------------- + // DO NOT ACCESS THESE DIRECTLY - THE DEVICE HAS TO SEE THEM UNCACHED + + // Initially, enough for one whole transmission to be described in one go, + // plus a null link on the end. + struct bufdesc tx_bufdesc[ MAX_ETH_DRV_SG + 2 ]; + + // Pending rx buffers, of full size. + struct bufdesc rx_bufdesc[ NUM_RXBUFS+1 ]; + + // ----------------------------------------------------------------- +}; + +struct eth_upd985xx eth_upd985xx[CYGNUM_DEVS_ETH_MIPS_UPD985XX_DEV_COUNT] = { + { + index: 0, + vector: CYGNUM_HAL_INTERRUPT_ETHER, +#ifdef CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E1E2 + promisc: 0, +#endif +#ifdef CYGSEM_DEVS_ETH_UPD985XX_ETH0_SET_ESA + hardwired_esa: 1, + mac_address: CYGDAT_DEVS_ETH_UPD985XX_ETH0_ESA, + mac_addr_ok: 1, +#else + hardwired_esa: 0, + mac_addr_ok: 0, +#endif + } +}; + +// eth0 + +ETH_DRV_SC(upd985xx_sc0, + ð_upd985xx[0], // Driver specific data + CYGDAT_DEVS_ETH_UPD985XX_ETH0_NAME, // name for this interface + eth_upd985xx_start, + eth_upd985xx_stop, + eth_upd985xx_ioctl, + eth_upd985xx_can_send, + eth_upd985xx_send, + eth_upd985xx_recv, + eth_upd985xx_deliver, + eth_upd985xx_poll, + eth_upd985xx_int_vector + ); + +NETDEVTAB_ENTRY(upd985xx_netdev0, + "upd985xx-" CYGDAT_DEVS_ETH_UPD985XX_ETH0_NAME, + upd985xx_eth_upd985xx_init, + &upd985xx_sc0); + + +// This is in a macro so that if more devices arrive it can easily be changed +#define CHECK_NDP_SC_LINK() CYG_MACRO_START \ + CYG_ASSERT( ((void *)ndp == (void *)&upd985xx_netdev0), "Bad ndp" ); \ + CYG_ASSERT( ((void *)sc == (void *)&upd985xx_sc0), "Bad sc" ); \ + CYG_ASSERT( (void *)p_eth_upd985xx == sc->driver_private, \ + "sc pointer bad" ); \ + CYG_ASSERT( (void *)p_eth_upd985xx == (void *)ð_upd985xx[0], \ + "bad p_eth_upd985x" ); \ +CYG_MACRO_END + +#define NUM_ELEMENTS( _x_ ) (sizeof( (_x_) ) / sizeof( (_x_[0]) ) ) + +// ------------------------------------------------------------------------ +// +// FUNCTION PROTOTYPES +// +// ------------------------------------------------------------------------ +STATIC void InitRxRing(struct eth_upd985xx* p_eth_upd985xx); +STATIC void NextRxRing(struct eth_upd985xx* p_eth_upd985xx); +STATIC void InitTxRing(struct eth_upd985xx* p_eth_upd985xx); +STATIC void ResetTxRing(struct eth_upd985xx* p_eth_upd985xx); + +#ifdef CYGPKG_NET +STATIC int eth_upd985xx_configure(struct eth_upd985xx* p_eth_upd985xx, + int promisc, int oversized); +#endif + +STATIC void PacketRxReady(struct eth_upd985xx* p_eth_upd985xx); +STATIC void TxDone(struct eth_upd985xx* p_eth_upd985xx); + +#define PHY_STATUS_LINK (1) +#define PHY_STATUS_FDX (2) +#define PHY_STATUS_100MBPS (4) +STATIC int eth_upd985xx_status( struct eth_upd985xx *p_eth_upd985xx ); +STATIC int eth_set_mac_address( struct eth_upd985xx *p_eth_upd985xx, void *data ); + +// ------------------------------------------------------------------------ +// +// MII ACCESS TO PHY DEVICE +// +// ------------------------------------------------------------------------ + +STATIC cyg_bool mii_read( cyg_uint32 reg, cyg_uint32 *pvalue, + struct eth_upd985xx *p_eth_upd985xx ) +{ + int i = 1000; + // wait a bit for it to be idle + while ( 0 != ((ETH_MIND_NVALID | ETH_MIND_SCANA | ETH_MIND_BUSY) + & INL(ETH_MIND)) ) + if ( --i < 0 ) + return false; + // Tell it the register address and PHY address + OUTL( ETH_MADR, ETH_MADR_PHY_DEVICE_PHYS_ADDRESS | reg ); + OUTL( ETH_MCMD, ETH_MCMD_RSTAT ); // "do a read" + // wait for the read to complete + while ( 0 != ((ETH_MIND_NVALID | ETH_MIND_SCANA | ETH_MIND_BUSY) + & INL(ETH_MIND)) ) + if ( --i < 0 ) + return false; + // so get the data + *pvalue = INL( ETH_MRDD ); + return true; +} + +#if 0 +STATIC cyg_bool mii_write( cyg_uint32 reg, cyg_uint32 value, + struct eth_upd985xx *p_eth_upd985xx ) +{ + int i = 1000; + // wait a bit for it to be idle + while ( 0 != ((ETH_MIND_NVALID | ETH_MIND_SCANA | ETH_MIND_BUSY) + & INL(ETH_MIND)) ) + if ( --i < 0 ) + return false; + // Tell it the register address and PHY address + OUTL( ETH_MADR, ETH_MADR_PHY_DEVICE_PHYS_ADDRESS | reg ); + // And write the data: + OUTL( ETH_MWTD, value ); + // wait a bit for it to be idle + while ( 0 != ((ETH_MIND_NVALID | ETH_MIND_SCANA | ETH_MIND_BUSY) + & INL(ETH_MIND)) ) + if ( --i < 0 ) + return false; + return true; +} +#endif + +// ------------------------------------------------------------------------ +// +// INTERRUPT HANDLERS +// +// ------------------------------------------------------------------------ + +STATIC cyg_uint32 eth_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + cyg_drv_interrupt_mask( vector ); + + return CYG_ISR_CALL_DSR; // schedule DSR +} + +// ------------------------------------------------------------------------ +// This is a callback from the higher level thread in consequence of the DSR +STATIC void +eth_upd985xx_deliver(struct eth_drv_sc *sc) +{ + register int intrs; + struct eth_upd985xx *p_eth_upd985xx; + p_eth_upd985xx = (struct eth_upd985xx *)sc->driver_private; + + p_eth_upd985xx->count_interrupts++; + + intrs = INL( ETH_ISR ); // Read-clear + // Acknowledge once at the start anyway to prevent an interrupt loop in + // case of a transient - interrupts latch in the interrupt controller + // as well as in the ethernet device. + cyg_drv_interrupt_acknowledge(p_eth_upd985xx->vector); + +#ifdef DEBUG_TRAFFIC + os_printf("\n[[[[[[[ Deliver intrs = %x\n", intrs ); +#endif + + // Guard possible external entry points + if ( ! p_eth_upd985xx->active ) + return; // without unmasking the interrupt + + while ( intrs ) { + if ( 0xffff0000 & intrs ) { + // Then something very bad has happened + p_eth_upd985xx->count_bad_isr_restarts++; + CYG_ASSERT ( p_eth_upd985xx->active, "Device not active!" ); + eth_upd985xx_stop( sc ); + eth_upd985xx_start( sc, NULL, 0 ); + intrs = INL( ETH_ISR ); // Read-clear + } + p_eth_upd985xx->intrs = intrs; + if ( ( ETH_ISR_XMTDN | ETH_ISR_TABR ) & intrs ) { + // Scan for completed Txen and inform the stack + TxDone(p_eth_upd985xx); + } + if ( ( ETH_ISR_RCVDN | ETH_ISR_RBDRS | ETH_ISR_RBDRU ) & intrs ) { + // Pass any rx data up the stack + PacketRxReady(p_eth_upd985xx); + } + // Now we have made the interrupt causes go away, acknowledge and + // *then* read the ISR again. That way the race can result in a + // spurious interrupt rather than a lost interrupt. + cyg_drv_interrupt_acknowledge(p_eth_upd985xx->vector); + intrs = INL( ETH_ISR ); // Read-clear +#ifdef DEBUG_TRAFFIC + if ( intrs ) + os_printf("------- Again intrs = %x\n", intrs ); +#endif + } +#ifdef DEBUG_TRAFFIC + os_printf("]]]]]]]] Done intrs = %x\n\n", intrs ); +#endif + + cyg_drv_interrupt_unmask(p_eth_upd985xx->vector); +} + +// ------------------------------------------------------------------------ +// Device table entry to operate the chip in a polled mode. +// Only diddle the interface we were asked to! + +STATIC void +eth_upd985xx_poll(struct eth_drv_sc *sc) +{ + struct eth_upd985xx *p_eth_upd985xx; + + p_eth_upd985xx = (struct eth_upd985xx *)sc->driver_private; + + // As it happens, this driver always requests the DSR to be called: + (void)eth_isr( p_eth_upd985xx->vector, (cyg_addrword_t)sc ); + eth_upd985xx_deliver( sc ); +} + +// ------------------------------------------------------------------------ +// Determine interrupt vector used by a device - for attaching GDB stubs +// packet handler. +STATIC int +eth_upd985xx_int_vector(struct eth_drv_sc *sc) +{ + struct eth_upd985xx *p_eth_upd985xx; + p_eth_upd985xx = (struct eth_upd985xx *)sc->driver_private; + return (p_eth_upd985xx->vector); +} + +// ------------------------------------------------------------------------ + +STATIC int +eth_set_mac_address( struct eth_upd985xx *p_eth_upd985xx, void *data ) +{ + cyg_uint8 *p = (cyg_uint8 *)data; + cyg_uint8 *mac_address; + + mac_address = &p_eth_upd985xx->mac_address[0]; + + mac_address[5] = p[5]; + mac_address[4] = p[4]; + mac_address[3] = p[3]; + mac_address[2] = p[2]; + mac_address[1] = p[1]; + mac_address[0] = p[0]; + + p_eth_upd985xx->mac_addr_ok = 1; + + // Set the ESA in the device regs + OUTL( ETH_LSA2, + (p_eth_upd985xx->mac_address[1]) | + (p_eth_upd985xx->mac_address[0] << 8 ) ); + OUTL( ETH_LSA1, + (p_eth_upd985xx->mac_address[5]) | + (p_eth_upd985xx->mac_address[4] << 8 ) | + (p_eth_upd985xx->mac_address[3] << 16 ) | + (p_eth_upd985xx->mac_address[2] << 24) ); + + return 0; // OK +} + +// ------------------------------------------------------------------------ + +STATIC void +eth_upd985xx_reset( struct eth_upd985xx *p_eth_upd985xx ) +{ + int i; + + // Reset whole device: Software Reset (clears automatically) + OUTL( ETH_CCR, ETH_CCR_SRT ); + for ( i = 0; i < 10000; i++ ) /* nothing */; + // Reset internal units + OUTL( ETH_MACC2, ETH_MACC2_MCRST | ETH_MACC2_RFRST | ETH_MACC2_TFRST ); + for ( i = 0; i < 10000; i++ ) /* nothing */; + FLUSH_WRITES(); + OUTL( ETH_MACC2, 0 ); // (and release reset) + // Enable CRC adding, padding + FLUSH_WRITES(); + OUTL( ETH_MACC1, + ETH_MACC1_CRCEN | ETH_MACC1_PADEN | + ETH_MACC1_TXFC | ETH_MACC1_RXFC | ETH_MACC1_PARF ); + FLUSH_WRITES(); + OUTL( ETH_MACC2, ETH_MACC2_APD ); // Auto VLAN pad + FLUSH_WRITES(); + OUTL( ETH_HT1, 0 ); + FLUSH_WRITES(); + OUTL( ETH_HT2, 0 ); + + // Enable rx of broadcasts, multicasts, but not promiscuous... + FLUSH_WRITES(); +#if defined( CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E1E2 ) && \ + !defined( CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E1E2_E2ONLY ) + // Unless we are faking it. + OUTL( ETH_AFR, ETH_AFR_ABC | ETH_AFR_PRM | ETH_AFR_PRO ); +#else + OUTL( ETH_AFR, ETH_AFR_ABC | ETH_AFR_PRM ); +#endif + + FLUSH_WRITES(); + OUTL( ETH_IPGT, 0x00000013 ); + FLUSH_WRITES(); + OUTL( ETH_IPGR, 0x00000e13 ); + FLUSH_WRITES(); + OUTL( ETH_CLRT, 0x0000380f ); + FLUSH_WRITES(); + OUTL( ETH_LMAX, MAX_ETHERNET_PACKET_SIZE ); + + // Select a clock for the MII + FLUSH_WRITES(); + OUTL( ETH_MIIC, ETH_MIIC_66 ); // Example code sets to 66. + // Set VLAN type reg + FLUSH_WRITES(); + OUTL( ETH_VLTP, ETH_VLTP_VLTP ); + + // Set the ESA in the device regs + if ( p_eth_upd985xx->mac_addr_ok ) { + FLUSH_WRITES(); + OUTL( ETH_LSA2, + (p_eth_upd985xx->mac_address[1]) | + (p_eth_upd985xx->mac_address[0] << 8 ) ); + FLUSH_WRITES(); + OUTL( ETH_LSA1, + (p_eth_upd985xx->mac_address[5]) | + (p_eth_upd985xx->mac_address[4] << 8 ) | + (p_eth_upd985xx->mac_address[3] << 16 ) | + (p_eth_upd985xx->mac_address[2] << 24) ); + } + + FLUSH_WRITES(); + OUTL( ETH_RXFCR, ETH_RXFCR_UWM_DEFAULT | + ETH_RXFCR_LWM_DEFAULT | ETH_RXFCR_DRTH16W ); + + FLUSH_WRITES(); + // Fault E4 - use only 32 for FLTH, not the previously recommended 48 (words) + // Tag: CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E4 + // but no config opt is provided. + OUTL( ETH_TXFCR, ETH_TXFCR_TPTV_DEFAULT | + ETH_TXFCR_TX_DRTH_DEFAULT | (32 << ETH_TXFCR_TX_FLTH_SHIFT) ); + + // Transmit and receive config regs we hit when enabling those + // functions separately, and the wet string end of the receiver + // which is controlled by MACC1 |= ETH_MACC1_SRXEN; + + // Tx and Rx interrupts enabled internally; + // Tx done/aborted, and rx OK. + FLUSH_WRITES(); + OUTL( ETH_MSR, ETH_ISR_XMTDN | ETH_ISR_TABR | + ETH_ISR_RCVDN | ETH_ISR_RBDRS | ETH_ISR_RBDRU ); + FLUSH_WRITES(); +} + +// ------------------------------------------------------------------------ +// +// NETWORK INTERFACE INITIALIZATION +// +// ------------------------------------------------------------------------ +STATIC bool +upd985xx_eth_upd985xx_init(struct cyg_netdevtab_entry * ndp) +{ + struct eth_drv_sc *sc; + cyg_uint8 *mac_address; + struct eth_upd985xx *p_eth_upd985xx; + +#ifdef DEBUG + db_printf("upd985xx_eth_upd985xx_init\n"); +#endif + + sc = (struct eth_drv_sc *)(ndp->device_instance); + p_eth_upd985xx = (struct eth_upd985xx *)(sc->driver_private); + + CHECK_NDP_SC_LINK(); + + p_eth_upd985xx->tx_busy = 0; + + // record the net dev pointer + p_eth_upd985xx->ndp = (void *)ndp; + + mac_address = &p_eth_upd985xx->mac_address[0]; + +#ifdef CYGSEM_DEVS_ETH_UPD985XX_ETH0_GET_EEPROM_ESA + if ( ! p_eth_upd985xx->hardwired_esa ) { + cyg_uint8 *p; + union macar { + struct { + cyg_uint32 macar1, macar2, macar3; + } integers; + cyg_uint8 bytes[12]; + } eeprom; + + eeprom.integers.macar1 = INL( MACAR1 ); // MAC Address Register 1 + eeprom.integers.macar2 = INL( MACAR2 ); // MAC Address Register 2 + eeprom.integers.macar3 = INL( MACAR3 ); // MAC Address Register 3 + + if ( (0 != eeprom.integers.macar1 || + 0 != eeprom.integers.macar2 || + 0 != eeprom.integers.macar3 ) + && + (0xffffffff != eeprom.integers.macar1 || + 0xffffffff != eeprom.integers.macar2 || + 0xffffffff != eeprom.integers.macar3 ) ) { + // Then we have good data in the EEPROM +#ifdef DEBUG + os_printf( "EEPROM data %08x %08x %08x\n", + eeprom.integers.macar1, + eeprom.integers.macar2, + eeprom.integers.macar3 ); +#endif + p = &eeprom.bytes[0]; // pick up either set of ESA info + if ( 1 == p_eth_upd985xx->index ) + p += 6; + + mac_address[5] = p[5]; + mac_address[4] = p[4]; + mac_address[3] = p[3]; + mac_address[2] = p[2]; + mac_address[1] = p[1]; + mac_address[0] = p[0]; + p_eth_upd985xx->mac_addr_ok = 1; + } + else { + // Fake it so we can get RedBoot going on a board with no EEPROM + mac_address[0] = 0; + mac_address[1] = 0xBA; + mac_address[2] = 0xD0; + mac_address[3] = 0xEE; + mac_address[4] = 0x00; + mac_address[5] = p_eth_upd985xx->index; + p_eth_upd985xx->mac_addr_ok = 1; + } + } +#endif // CYGSEM_DEVS_ETH_UPD985XX_ETH0_GET_EEPROM_ESA + + // Init the underlying hardware and insert the ESA: + eth_upd985xx_reset(p_eth_upd985xx); + +#ifdef DEBUG + os_printf("MAC Address %s, ESA = %02X %02X %02X %02X %02X %02X\n", + p_eth_upd985xx->mac_addr_ok ? "OK" : "**BAD**", + mac_address[0], mac_address[1], mac_address[2], mac_address[3], + mac_address[4], mac_address[5]); +#endif + + // Set up the pointers to data structures + InitTxRing(p_eth_upd985xx); + + // Construct the interrupt handler + p_eth_upd985xx->active = 0; + cyg_drv_interrupt_acknowledge(p_eth_upd985xx->vector); + cyg_drv_interrupt_mask(p_eth_upd985xx->vector); + cyg_drv_interrupt_create( + p_eth_upd985xx->vector, + 0, // Priority - unused + (CYG_ADDRWORD)sc, // Data item passed to ISR & DSR + eth_isr, // ISR + eth_drv_dsr, // DSR (generic) + &p_eth_upd985xx->interrupt_handle, // handle to intr obj + &p_eth_upd985xx->interrupt_object ); // space for int obj + + cyg_drv_interrupt_attach(p_eth_upd985xx->interrupt_handle); + + // Initialize upper level driver + if ( p_eth_upd985xx->mac_addr_ok ) + (sc->funs->eth_drv->init)(sc, &(p_eth_upd985xx->mac_address[0]) ); + else + (sc->funs->eth_drv->init)(sc, 0 ); + + return (1); +} + +// ------------------------------------------------------------------------ +// +// Function : eth_upd985xx_start +// +// ------------------------------------------------------------------------ +STATIC void +eth_upd985xx_start( struct eth_drv_sc *sc, + unsigned char *enaddr, int flags ) +{ + struct eth_upd985xx *p_eth_upd985xx; + cyg_uint32 ss; +#ifdef CYGPKG_NET + struct ifnet *ifp = &sc->sc_arpcom.ac_if; +#endif + + p_eth_upd985xx = (struct eth_upd985xx *)sc->driver_private; + +#ifdef DEBUG + os_printf("eth_upd985xx_start %d flg %x\n", p_eth_upd985xx->index, *(int *)p_eth_upd985xx ); +#endif + + if ( p_eth_upd985xx->active ) + eth_upd985xx_stop( sc ); + + p_eth_upd985xx->active = 1; + +#ifdef CYGPKG_NET + /* Enable promiscuous mode if requested, reception of oversized frames always. + * The latter is needed for VLAN support and shouldn't hurt even if we're not + * using VLANs. + */ + eth_upd985xx_configure(p_eth_upd985xx, !!(ifp->if_flags & IFF_PROMISC), 1); +#endif + + // renegotiate link status + p_eth_upd985xx->phy_status = eth_upd985xx_status( p_eth_upd985xx ); + + if ( p_eth_upd985xx->phy_status & PHY_STATUS_FDX ) { + cyg_uint32 ss; + // then enable full duplex in the MAC + ss = INL( ETH_MACC1 ); + ss |= ETH_MACC1_FDX; + OUTL( ETH_MACC1, ss ); + } + +#ifdef DEBUG + { + int status = p_eth_upd985xx->phy_status; + os_printf("eth_upd985xx_start %d Link = %s, %s Mbps, %s Duplex\n", + p_eth_upd985xx->index, + status & PHY_STATUS_LINK ? "Up" : "Down", + status & PHY_STATUS_100MBPS ? "100" : "10", + status & PHY_STATUS_FDX ? "Full" : "Half" + ); + } +#endif + + + // Start the receive engine + p_eth_upd985xx->count_rx_restart++; + // Initialize all but one buffer: [B0,B1,B2,...Bx,NULL,LINK] + InitRxRing( p_eth_upd985xx ); + // Point the hardware at the list of buffers + OUTL( ETH_RXDPR, (cyg_uint32)p_eth_upd985xx->rxring_active ); + // Tell it about the buffers via the rx descriptor count + OUTL( ETH_RXPDR, ETH_RXPDR_AL | (NUM_RXBUFS-1) ); + // Ack any pending interrupts from the system + p_eth_upd985xx->intrs = INL( ETH_ISR ); // Read-clear + // Start the rx. + OUTL( ETH_RXCR, ETH_RXCR_RXE | ETH_RXCR_DRBS_16 ); + + // Enable the wet string end of the receiver + ss = INL( ETH_MACC1 ); + ss |= ETH_MACC1_SRXEN; + OUTL( ETH_MACC1, ss ); + + // And unmask the interrupt + cyg_drv_interrupt_acknowledge(p_eth_upd985xx->vector); + cyg_drv_interrupt_unmask(p_eth_upd985xx->vector); +} + +// ------------------------------------------------------------------------ +// +// Function : eth_upd985xx_status; 10/100 and Full/Half Duplex (FDX/HDX) +// +// ------------------------------------------------------------------------ +STATIC int eth_upd985xx_status( struct eth_upd985xx *p_eth_upd985xx ) +{ + int status; + int i, j; + // Some of these bits latch and only reflect "the truth" on a 2nd reading. + // So read and discard. + mii_read( PHY_CONTROL_REG, &i, p_eth_upd985xx ); + mii_read( PHY_STATUS_REG, &i, p_eth_upd985xx ); + // Use the "and" of the local and remote capabilities words to infer + // what is selected: + status = 0; + if ( mii_read( PHY_STATUS_REG, &i, p_eth_upd985xx ) ) { + if ( PHY_STATUS_LINK_OK & i ) + status |= PHY_STATUS_LINK; + } + if ( mii_read( PHY_AUTONEG_ADVERT, &j, p_eth_upd985xx ) && + mii_read( PHY_AUTONEG_REMOTE, &i, p_eth_upd985xx ) ) { +#if defined( DEBUG_TRAFFIC ) || defined( DEBUG_IOCTL ) + os_printf( "MII: capabilities are %04x, %04x; common %04x\n", + i, j, i & j ); +#endif + j &= i; // select only common capabilities + + if ( (PHY_AUTONEG_100BASET4 | + PHY_AUTONEG_100BASETX_FDX | + PHY_AUTONEG_100BASETX_HDX) & j ) + status |= PHY_STATUS_100MBPS; + if ( (PHY_AUTONEG_100BASETX_FDX | PHY_AUTONEG_10BASET_FDX) & j ) + status |= PHY_STATUS_FDX; + } + return status; +} + +// ------------------------------------------------------------------------ +// +// Function : eth_upd985xx_stop +// +// ------------------------------------------------------------------------ + +STATIC void eth_upd985xx_stop( struct eth_drv_sc *sc ) +{ + struct eth_upd985xx *p_eth_upd985xx; + + p_eth_upd985xx = (struct eth_upd985xx *)sc->driver_private; + + // No more interrupts + cyg_drv_interrupt_acknowledge(p_eth_upd985xx->vector); + cyg_drv_interrupt_mask(p_eth_upd985xx->vector); + +#ifdef DEBUG + os_printf("eth_upd985xx_stop %d flg %x\n", p_eth_upd985xx->index, *(int *)p_eth_upd985xx ); +#endif + + p_eth_upd985xx->active = 0; // stop people tormenting it + + if ( p_eth_upd985xx->tx_busy ) { + // Then it is finshed now, by force: + cyg_uint32 key = p_eth_upd985xx->tx_keys[ 0 ]; + // Turn off the transmitter (before the callback to the stack). + OUTL( ETH_TXCR, 0 ); +#ifdef DEBUG_TRAFFIC + os_printf("Stop: tidying up TX, KEY %x\n", key ); +#endif + // Leave tx_busy true so no recursion can occur here. + // Then tell the stack we are done: + if ( key ) { + (sc->funs->eth_drv->tx_done)( sc, key, 0 ); + } + } + p_eth_upd985xx->tx_keys[ 0 ] = 0; + p_eth_upd985xx->tx_busy = p_eth_upd985xx->active = 0; + + eth_upd985xx_reset(p_eth_upd985xx); + + ResetTxRing( p_eth_upd985xx ); +} + + +// ------------------------------------------------------------------------ +// +// Function : InitRxRing +// +// ------------------------------------------------------------------------ +STATIC void InitRxRing(struct eth_upd985xx* p_eth_upd985xx) +{ + int i; + struct bufdesc *bp; + + // first just blat the various flags and addresses: the first N + // bufdescs point to data buffers, the last one is NULL. + bp = (struct bufdesc *)VIRT_TO_BUS( &p_eth_upd985xx->rx_bufdesc[0] ); + // Record the initial active buffer: + p_eth_upd985xx->rxring_active = bp; + p_eth_upd985xx->rxring_active_index = 0; + for ( i = 0; i < NUM_RXBUFS - 1; i++, bp++ ) { + bp->ptr = VIRT_TO_BUS( &rx_databuf[i][0] ); + bp->attr = ( ETH_BUF_D_L_DATA | ETH_BUF_OWN_CPU + | (ETH_BUF_SIZE & sizeof( rx_databuf[0] )) ); + } + CYG_ASSERT( i == NUM_RXBUFS-1, "Penultimate rx buffer index mismatch" ); + CYG_ASSERT( (cyg_uint8 *)bp == + VIRT_TO_BUS( &p_eth_upd985xx->rx_bufdesc[NUM_RXBUFS-1] ), + "Penultimate rx buffer address mismatch" ); + + // NULL out the penultimate one + bp->ptr = NULL; + bp->attr = 0; + // And record it as next one to use + p_eth_upd985xx->rxring_next = bp; + p_eth_upd985xx->rxring_next_index = NUM_RXBUFS-1; + + // Step on to the extra entry at the end which makes a ring: + bp++; + CYG_ASSERT( (cyg_uint8 *)bp == + VIRT_TO_BUS( &p_eth_upd985xx->rx_bufdesc[NUM_RXBUFS] ), + "Ultimate rx buffer address mismatch" ); + + // Link the Ultimate back to the start + bp->ptr = (cyg_uint8 *)p_eth_upd985xx->rxring_active; // Zeroth entry + bp->attr = ETH_BUF_D_L_LINK; + + // All done. +} + + +// ------------------------------------------------------------------------ +// +// Function : NextRxRing +// +// ------------------------------------------------------------------------ + +STATIC void NextRxRing(struct eth_upd985xx* p_eth_upd985xx ) +{ + volatile struct bufdesc *next, *dead; + int iactive; + int inext; + + iactive = p_eth_upd985xx->rxring_active_index; + inext = p_eth_upd985xx->rxring_next_index; + + // Preconditions: + CYG_ASSERT( 0 <= inext && inext < NUM_RXBUFS, "Bad inext" ); + CYG_ASSERT( 0 <= iactive && iactive < NUM_RXBUFS, "Bad iactive" ); + CYG_ASSERT( VIRT_TO_BUS( &p_eth_upd985xx->rx_bufdesc[ inext ] ) + == (cyg_uint8 *)p_eth_upd985xx->rxring_next, "Next rx_bufdesc bad" ); + CYG_ASSERT( VIRT_TO_BUS( &p_eth_upd985xx->rx_bufdesc[ iactive ] ) + == (cyg_uint8 *)p_eth_upd985xx->rxring_active, "Active rx_bufdesc bad" ); + CYG_ASSERT( ETH_BUF_D_L_LINK == p_eth_upd985xx->rxring_next->attr, "Next not a link" ); + CYG_ASSERT( ETH_BUF_D_L_DATA & p_eth_upd985xx->rxring_active->attr, "Active not data" ); + CYG_ASSERT( NULL == p_eth_upd985xx->rxring_next->ptr, "Next not NULL" ); + CYG_ASSERT( VIRT_TO_BUS( &rx_databuf[iactive][0] ) == + p_eth_upd985xx->rxring_active->ptr, "Active bad data pointer" ); + CYG_ASSERT( (iactive - 1 == inext) || (0 == iactive && NUM_RXBUFS - 1 == inext), + "Chasing pointers mismatch" ); + + // Select the new bufdesc to be active - ie. next to scan for reception: + if ( ++iactive >= NUM_RXBUFS ) + iactive = 0; + dead = p_eth_upd985xx->rxring_active; // the one that just died + // Step ahead the new active buffer: + p_eth_upd985xx->rxring_active = (volatile struct bufdesc *) + VIRT_TO_BUS( &p_eth_upd985xx->rx_bufdesc[ iactive ] ); + p_eth_upd985xx->rxring_active_index = iactive; + + // Blow away the currently active entry; we have dealt with it already + // and it is needed for an end stop to the ring: + dead->ptr = NULL; + dead->attr = 0; + + // Select the next bufdesc to enliven + next = p_eth_upd985xx->rxring_next; + next->ptr = VIRT_TO_BUS( &rx_databuf[inext][0] ); + next->attr = ( ETH_BUF_D_L_DATA | ETH_BUF_OWN_CPU + | (ETH_BUF_SIZE & sizeof( rx_databuf[0] )) ); + + // And update the external info to reflect this: + if ( ++inext >= NUM_RXBUFS ) + inext = 0; + next = (volatile struct bufdesc *) + VIRT_TO_BUS( &p_eth_upd985xx->rx_bufdesc[ inext ] ); + + p_eth_upd985xx->rxring_next = next; + p_eth_upd985xx->rxring_next_index = inext; + + // Postconditions: + CYG_ASSERT( 0 <= inext && inext < NUM_RXBUFS, "Bad inext" ); + CYG_ASSERT( 0 <= iactive && iactive < NUM_RXBUFS, "Bad iactive" ); + CYG_ASSERT( VIRT_TO_BUS( &p_eth_upd985xx->rx_bufdesc[ inext ] ) + == (cyg_uint8 *)p_eth_upd985xx->rxring_next, "Next rx_bufdesc bad" ); + CYG_ASSERT( VIRT_TO_BUS( &p_eth_upd985xx->rx_bufdesc[ iactive ] ) + == (cyg_uint8 *)p_eth_upd985xx->rxring_active, "Active rx_bufdesc bad" ); + CYG_ASSERT( ETH_BUF_D_L_LINK == p_eth_upd985xx->rxring_next->attr, "Next not a link" ); + CYG_ASSERT( ETH_BUF_D_L_DATA & p_eth_upd985xx->rxring_active->attr, "Active not data" ); + CYG_ASSERT( NULL == p_eth_upd985xx->rxring_next->ptr, "Next not NULL" ); + CYG_ASSERT( VIRT_TO_BUS( &rx_databuf[iactive][0] ) == + p_eth_upd985xx->rxring_active->ptr, "Active bad data pointer" ); + CYG_ASSERT( (iactive - 1 == inext) || (0 == iactive && NUM_RXBUFS - 1 == inext), + "Chasing pointers mismatch" ); +} + +// ------------------------------------------------------------------------ +// +// Function : PacketRxReady (Called from delivery thread) +// +// ------------------------------------------------------------------------ +STATIC void PacketRxReady(struct eth_upd985xx* p_eth_upd985xx) +{ + struct cyg_netdevtab_entry *ndp; + struct eth_drv_sc *sc; + cyg_uint32 ss, length; + cyg_bool reset_required = 0; + + ndp = (struct cyg_netdevtab_entry *)(p_eth_upd985xx->ndp); + sc = (struct eth_drv_sc *)(ndp->device_instance); + + CHECK_NDP_SC_LINK(); + +#ifdef DEBUG_TRAFFIC + ss = INL( ETH_RXSR ); + os_printf("PacketRxReady: RXSR %x\n", ss ); +#endif + + if ( ETH_ISR_RBDRU & p_eth_upd985xx->intrs ) + reset_required = 1; // Out of buffers + if ( ! ETH_ISR_RCVDN & p_eth_upd985xx->intrs ) + reset_required = 1; // or if no reception completed, reset anyway + + // For all ready rx blocks... + do { + volatile struct bufdesc *bp; + + bp = p_eth_upd985xx->rxring_active; // Current rx candidate + + ss = bp->attr; +#ifdef DEBUG_TRAFFIC + os_printf("PacketRxReady attr %x at %x\n", ss, bp ); +#endif + if ( ETH_BUF_OWN_CPU == (ETH_BUF_OWN & ss) ) { + // Then the packet is untouched... + break; + } +#ifdef CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E1E2 + // Perform address recognition by hand, hardware is in promisc mode + // (we have settable "software" promisc mode too of course) + if ( ETH_BUF_OK & ss ) { + cyg_uint8 *esa = (cyg_uint8 *)bp->ptr; // (this is a non-cachable address) + int ok = 0; + if ( p_eth_upd985xx->promisc ) + ok = 1; // accept the packet + else + if ( p_eth_upd985xx->mac_address[0] == esa[0] && + p_eth_upd985xx->mac_address[1] == esa[1] && + p_eth_upd985xx->mac_address[2] == esa[2] && + p_eth_upd985xx->mac_address[3] == esa[3] && + p_eth_upd985xx->mac_address[4] == esa[4] && + p_eth_upd985xx->mac_address[5] == esa[5] ) + ok = 1; // Then they are equal - accept + else + if ( 0xff == esa[0] && + 0xff == esa[1] && + 0xff == esa[2] && + 0xff == esa[3] && + 0xff == esa[4] && + 0xff == esa[5] ) + ok = 1; // Then they are equal - accept + + if ( !ok ) + ss = 0; // Easiest way... + } +#endif + if ( ETH_BUF_OK & ss ) { + length = ETH_BUF_SIZE & ss; +#ifdef DEBUG_TRAFFIC + os_printf("PacketRxReady found a packet size %d attr %x\n", length, ss ); +#endif + // Asserts for the length in-range can fire, with good status + // in the block, so be defensive here instead. Belt and braces. + if ( 63 < length && length <= MAX_RX_PACKET_SIZE ) { + CYG_ASSERT( ETH_BUF_D_L_DATA == (ETH_BUF_D_L & ss), "Not data buffer" ); + CYG_ASSERT( length > 63, "Tiny packet" ); + CYG_ASSERT( length <= MAX_RX_PACKET_SIZE, "Too big packet" ); + CYG_ASSERT( ETH_BUF_LAST & ss, "Not last buffer" ); + (sc->funs->eth_drv->recv)( sc, length ); + } // Else drop it on the floor. + } + + // Step along to the next buffer descriptor... + NextRxRing( p_eth_upd985xx ); + if ( ! reset_required ) { + // And tell the device it can have a biscuit: + OUTL( ETH_RXPDR, ETH_RXPDR_AL | 1 ); + + // Now, before moving on to the next packet, find out if receptions + // had caught up with us before adding that new buffer: + ss = INL( ETH_RXPDR ); + ss &= ETH_RXPDR_RNOD; + ss >>= ETH_RXPDR_RNOD_SHIFT; + if ( 1 >= ss ) { + // Then it was zero before. So the rx engine is stopped. +#ifdef DEBUG_TRAFFIC + os_printf( "***ZERO rx buffers were left\n" ); +#endif + reset_required = 1; + } + // Otherwise we carry on as usual. + } + } while ( 1 ); + + if ( reset_required ) { + p_eth_upd985xx->count_rx_resource++; + // Disable the wet string end of the receiver + ss = INL( ETH_MACC1 ); + ss &=~ETH_MACC1_SRXEN; + OUTL( ETH_MACC1, ss ); + // Disable the DMA engine + OUTL( ETH_RXCR, 0 ); + // Reset the RxRing from scratch + InitRxRing( p_eth_upd985xx ); + // Point the hardware at the list of buffers + OUTL( ETH_RXDPR, (cyg_uint32)p_eth_upd985xx->rxring_active ); + // Tell it about the buffers via the rx descriptor count: + ss = INL( ETH_RXPDR ); + ss &= ETH_RXPDR_RNOD; + ss >>= ETH_RXPDR_RNOD_SHIFT; + // This awful register *increments* by what you write, even if the + // machinery is halted. Vile filthy evil rubbish. + OUTL( ETH_RXPDR, ETH_RXPDR_AL | ((NUM_RXBUFS-1) - ss) ); + ss = INL( ETH_RXPDR ); + CYG_ASSERT( (ETH_RXPDR_AL | (NUM_RXBUFS-1)) == ss, "RXPDR not right" ); + // Start the rx. + OUTL( ETH_RXCR, ETH_RXCR_RXE | ETH_RXCR_DRBS_16 ); + // Enable the wet string end of the receiver + ss = INL( ETH_MACC1 ); + ss |= ETH_MACC1_SRXEN; + OUTL( ETH_MACC1, ss ); + // All done. +#ifdef DEBUG_TRAFFIC + os_printf( "***Rx Machine restarted\n" ); +#endif + } +} + +// and the callback function + +STATIC void +eth_upd985xx_recv( struct eth_drv_sc *sc, + struct eth_drv_sg *sg_list, int sg_len ) +{ + struct eth_upd985xx *p_eth_upd985xx; + int total_len; + struct eth_drv_sg *last_sg; + cyg_uint8 *from_p; + volatile struct bufdesc *bp; + + p_eth_upd985xx = (struct eth_upd985xx *)sc->driver_private; + + // Guard possible external entry points + if ( ! p_eth_upd985xx->active ) + return; + + bp = p_eth_upd985xx->rxring_active; // Current rx candidate + +#ifdef DEBUG_TRAFFIC + os_printf("Rx status %x\n", bp->attr ); +#endif + + if ( 0 == (ETH_BUF_OK & bp->attr) ) + return; + + total_len = ETH_BUF_SIZE & bp->attr; + +#ifdef DEBUG_TRAFFIC + os_printf("Rx %d %x (status %x): %d sg's, %d bytes\n", + p_eth_upd985xx->index, (int)p_eth_upd985xx, + bp->attr, + sg_len, total_len); +#endif + + // Copy the data to the network stack + from_p = bp->ptr; // (this is a non-cachable address) + + // check we have memory to copy into; we would be called even if + // caller was out of memory in order to maintain our state. + if ( 0 == sg_len || 0 == sg_list ) + return; // caller was out of mbufs + + CYG_ASSERT( 0 < sg_len, "sg_len underflow" ); + CYG_ASSERT( MAX_ETH_DRV_SG >= sg_len, "sg_len overflow" ); + + for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) { + cyg_uint8 *to_p; + int l; + + to_p = (cyg_uint8 *)(sg_list->buf); + l = sg_list->len; + + CYG_ASSERT( 0 <= l, "sg length -ve" ); + + if ( 0 >= l || 0 == to_p ) + return; // caller was out of mbufs + + if ( l > total_len ) + l = total_len; + + memcpy( to_p, from_p, l ); + from_p += l; + total_len -= l; + } + + CYG_ASSERT( 0 == total_len, "total_len mismatch in rx" ); + CYG_ASSERT( last_sg == sg_list, "sg count mismatch in rx" ); + CYG_ASSERT( bp->ptr < from_p, "from_p wild in rx" ); + CYG_ASSERT( bp->ptr + MAX_RX_PACKET_SIZE >= from_p, + "from_p overflow in rx" ); +} + + +// ------------------------------------------------------------------------ +// +// Function : InitTxRing +// +// ------------------------------------------------------------------------ +STATIC void InitTxRing(struct eth_upd985xx* p_eth_upd985xx) +{ + int i; + volatile struct bufdesc *bp; + + p_eth_upd985xx->txring = + (struct bufdesc *)VIRT_TO_BUS( &p_eth_upd985xx->tx_bufdesc[0] ); + + bp = p_eth_upd985xx->txring; + + for ( i = 0; i < NUM_ELEMENTS( p_eth_upd985xx->tx_bufdesc ); i++, bp++ ) { + bp->ptr = NULL; + bp->attr = 0; + } + // Last one is a NULL link + bp--; + bp->ptr = NULL; + bp->attr = ETH_BUF_D_L_LINK; + + ResetTxRing(p_eth_upd985xx); +} + +// ------------------------------------------------------------------------ +// +// Function : ResetTxRing +// +// ------------------------------------------------------------------------ +STATIC void ResetTxRing(struct eth_upd985xx* p_eth_upd985xx) +{ + int i; + volatile struct bufdesc *bp; + bp = p_eth_upd985xx->txring; + for ( i = 0; i < NUM_ELEMENTS( p_eth_upd985xx->tx_bufdesc ) - 1; i++, bp++ ) { + bp->attr = + ETH_BUF_LAST | + ETH_BUF_D_L_DATA | + ETH_BUF_OWN_CPU | + (ETH_BUF_SIZE & 0); + } +} + +// ------------------------------------------------------------------------ +// +// Function : TxDone (Called from delivery thread) +// +// This returns Tx's from the Tx Machine to the stack (ie. reports +// completion) - allowing for missed interrupts, and so on. +// ------------------------------------------------------------------------ + +STATIC void TxDone(struct eth_upd985xx* p_eth_upd985xx) +{ + struct cyg_netdevtab_entry *ndp; + struct eth_drv_sc *sc; + + ndp = (struct cyg_netdevtab_entry *)(p_eth_upd985xx->ndp); + sc = (struct eth_drv_sc *)(ndp->device_instance); + + CHECK_NDP_SC_LINK(); + + if ( p_eth_upd985xx->tx_busy ) { + cyg_uint32 ss; + + ss = INL( ETH_TXSR ); // Get tx status + if ( ss & (ETH_TXSR_CSE | + ETH_TXSR_TUDR | + ETH_TXSR_TGNT | + ETH_TXSR_LCOL | + ETH_TXSR_ECOL | + ETH_TXSR_TEDFR | + ETH_TXSR_TDFR | + ETH_TXSR_TBRO | + ETH_TXSR_TMUL | + ETH_TXSR_TDONE ) ) { + // Then it finished; somehow... + cyg_uint32 key = p_eth_upd985xx->tx_keys[ 0 ]; + + // Turn off the transmitter (before the callback to the stack). + OUTL( ETH_TXCR, 0 ); + +#ifdef CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E8 + // Must take action after certain types of tx failure: + if ( ss & (ETH_TXSR_TUDR | + ETH_TXSR_LCOL | + ETH_TXSR_ECOL) ) { + p_eth_upd985xx->count_bad_tx_completion++; + CYG_ASSERT ( p_eth_upd985xx->active, "Device not active!" ); + eth_upd985xx_stop( sc ); + eth_upd985xx_start( sc, NULL, 0 ); + key = 0; // Important! Stop above already fed it back. + } +#endif + +#ifdef DEBUG_TRAFFIC + os_printf("TxDone %d %x: KEY %x\n", + p_eth_upd985xx->index, (int)p_eth_upd985xx, key ); +#endif + // Finished, ready for the next one + p_eth_upd985xx->tx_keys[ 0 ] = 0; + p_eth_upd985xx->tx_busy = 0; + // Then tell the stack we are done: + if (key) { + (sc->funs->eth_drv->tx_done)( sc, key, + 0 == (p_eth_upd985xx->intrs & ETH_ISR_TABR) ); + } + } + } +} + + +// ------------------------------------------------------------------------ +// +// Function : eth_upd985xx_can_send +// +// ------------------------------------------------------------------------ + +STATIC int +eth_upd985xx_can_send(struct eth_drv_sc *sc) +{ + struct eth_upd985xx *p_eth_upd985xx; + + p_eth_upd985xx = (struct eth_upd985xx *)sc->driver_private; + + // Guard possible external entry points + if ( ! p_eth_upd985xx->active ) + return 0; + + return ! p_eth_upd985xx->tx_busy; +} + +// ------------------------------------------------------------------------ +// +// Function : eth_upd985xx_send +// +// ------------------------------------------------------------------------ + +STATIC void +eth_upd985xx_send(struct eth_drv_sc *sc, + struct eth_drv_sg *sg_list, int sg_len, int total_len, + unsigned long key) +{ + struct eth_upd985xx *p_eth_upd985xx; + struct eth_drv_sg *last_sg; + volatile struct bufdesc *bp; +#ifdef CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E3 + struct eth_drv_sg local_sg[2]; +#endif + + p_eth_upd985xx = (struct eth_upd985xx *)sc->driver_private; + +#ifdef DEBUG_TRAFFIC + os_printf("Tx %d %x: %d sg's, %d bytes, KEY %x\n", + p_eth_upd985xx->index, (int)p_eth_upd985xx, sg_len, total_len, key ); +#endif + + if ( ! p_eth_upd985xx->active ) + return; // device inactive, no return + + CYG_ASSERT( ! p_eth_upd985xx->tx_busy, "Can't send when busy!" ); + + p_eth_upd985xx->tx_busy++; + + p_eth_upd985xx->tx_keys[0] = key; + bp = &p_eth_upd985xx->txring[0]; // Current free tx + CYG_ASSERT( 0 < sg_len, "sg_len underflow" ); + CYG_ASSERT( MAX_ETH_DRV_SG >= sg_len, "sg_len overflow" ); + +#ifdef CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E3 + // We must copy any Tx that is more than two SGs into just one buffer. + if ( sg_len > 2 ) { + cyg_uint8 *from_p, *to_p; + to_p = &tx_databuf[0]; // normal cached address + if ( sizeof( tx_databuf ) < total_len ) + total_len = sizeof( tx_databuf ); + for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) { + int l; + + from_p = (cyg_uint8 *)(sg_list->buf); // normal cached address + l = sg_list->len; + + if ( l > total_len ) + l = total_len; + + memcpy( to_p, from_p, l ); // All in cached memory + to_p += l; + total_len -= l; + + if ( 0 > total_len ) + break; // Should exit via sg_last normally + } + + // Set up SGs describing the single tx buffer + total_len = to_p - &tx_databuf[0]; + local_sg[0].buf = (CYG_ADDRESS)&tx_databuf[0]; + local_sg[0].len = (CYG_ADDRWORD)total_len; + local_sg[1].buf = (CYG_ADDRESS)0; + local_sg[1].len = (CYG_ADDRWORD)0; + + // And make the subsequent code use it. + sg_len = 1; + sg_list = &local_sg[0]; + } +#endif + + for ( last_sg = &sg_list[sg_len]; sg_list < last_sg; sg_list++ ) { + cyg_uint8 *from_p; + int l; + + from_p = (cyg_uint8 *)(sg_list->buf); // normal cached address + l = sg_list->len; + + if ( l > total_len ) + l = total_len; + + // Ensure the mbuf contents really is in RAM where DMA can see it. + // (Must round to cache lines apparantly for 4120) + HAL_DCACHE_STORE( ((CYG_ADDRESS)from_p) &~(HAL_DCACHE_LINE_SIZE-1), + l + HAL_DCACHE_LINE_SIZE ); + + bp->ptr = VIRT_TO_BUS( from_p ); // uncached real RAM address + bp->attr &=~(ETH_BUF_LAST | ETH_BUF_SIZE); + bp->attr |= ETH_BUF_SIZE & l; + bp->attr |= ETH_BUF_D_L_DATA; + + total_len -= l; + bp++; + + if ( 0 > total_len ) + break; // Should exit via sg_last normally + } + + CYG_ASSERT( bp > &p_eth_upd985xx->txring[0], "bp underflow" ); + CYG_ASSERT( bp < &p_eth_upd985xx->txring[ + NUM_ELEMENTS(p_eth_upd985xx->tx_bufdesc) + ], "bp underflow" ); + + bp--; + bp->attr |= ETH_BUF_LAST; + + // Make the rest be null links + for ( bp++; bp < + &p_eth_upd985xx->txring[NUM_ELEMENTS(p_eth_upd985xx->tx_bufdesc)]; + bp++ ) { + bp->attr = ETH_BUF_D_L_LINK; + bp->ptr = NULL; + } + + CYG_ASSERT( 0 == total_len, "length mismatch in tx" ); + CYG_ASSERT( last_sg == sg_list, "sg count mismatch in tx" ); + + // And start off the tx system + + // Point the hardware at the list of buffers + OUTL( ETH_TXDPR, (cyg_uint32)p_eth_upd985xx->txring ); + // and start the tx. + + // Fault E4 - use only 8 for DTBS, not the previously recommended 16. + // Tag: CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E4 + // but no config opt is provided. + + // Fault E7: ETH_TXCR_AFCE must not be used. + // Tag: CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E7 + // but no config opt is provided. + + OUTL( ETH_TXCR, ETH_TXCR_TXE | ETH_TXCR_DTBS_8 /* | ETH_TXCR_AFCE */ ); +} + +#ifdef CYGPKG_NET +// ------------------------------------------------------------------------ +// +// Function : eth_upd985xx_configure +// +// Return : 0 = It worked. +// non0 = It failed. +// ------------------------------------------------------------------------ + +STATIC int +eth_upd985xx_configure(struct eth_upd985xx* p_eth_upd985xx, int promisc, int oversized) +{ + int ss; + + // We implement permission of oversize packets by changing LMAX (rather + // than enabling HUGEN in ETH_MACC1) because we rely on only one + // reception per rx descriptor. General oversize packets could eat + // many rx descriptors and we would become ...confused. + + // Sanity check the numbers we're about to use. + CYG_ASSERT( sizeof( rx_databuf[0] ) >= MAX_OVERSIZE_PACKET_SIZE, + "Oversize packet would overflow rx buffer" ); + CYG_ASSERT( sizeof( rx_databuf[0] ) >= MAX_ETHERNET_PACKET_SIZE, + "Ethernet packet would overflow rx buffer" ); + if ( oversized ) + OUTL( ETH_LMAX, MAX_OVERSIZE_PACKET_SIZE ); + else + OUTL( ETH_LMAX, MAX_ETHERNET_PACKET_SIZE ); + +#ifdef CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E1E2 + ss = promisc ? 1 : 0; // avoid unused var warning + p_eth_upd985xx->promisc = ss; +#ifdef CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E1E2_E2ONLY + // Then we must also set the mode in the chip + ss = INL( ETH_AFR ); + if ( promisc ) + ss |= ETH_AFR_PRO; + else + ss &=~ETH_AFR_PRO; + OUTL( ETH_AFR, ss ); +#endif // CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_E1E2_E2ONLY +#else + ss = INL( ETH_AFR ); + if ( promisc ) + ss |= ETH_AFR_PRO; + else + ss &=~ETH_AFR_PRO; + OUTL( ETH_AFR, ss ); +#endif + return 0; // OK +} +#endif + +// ------------------------------------------------------------------------ +// +// Function : eth_upd985xx_ioctl +// +// ------------------------------------------------------------------------ +STATIC int +eth_upd985xx_ioctl(struct eth_drv_sc *sc, unsigned long key, + void *data, int data_length) +{ + struct eth_upd985xx *p_eth_upd985xx; + + p_eth_upd985xx = (struct eth_upd985xx *)sc->driver_private; + +#ifdef DEBUG_IOCTL + db_printf( "eth_upd985xx_ioctl: device eth%d at %x; key is 0x%x, data at %x[%d]\n", + p_eth_upd985xx->index, p_eth_upd985xx, key, data, data_length ); +#endif + + // DO NOT guard possible external entry points - want to be able eg. to + // set a mac address of a down interface before bringing it up! + + switch ( key ) { + +#ifdef ETH_DRV_SET_MAC_ADDRESS + case ETH_DRV_SET_MAC_ADDRESS: + if ( 6 != data_length ) + return -2; + return eth_set_mac_address( p_eth_upd985xx, data ); +#endif + +#ifdef ETH_DRV_GET_IF_STATS_UD + case ETH_DRV_GET_IF_STATS_UD: // UD == UPDATE +#endif + // drop through +#ifdef ETH_DRV_GET_IF_STATS + case ETH_DRV_GET_IF_STATS: +#endif +#if defined(ETH_DRV_GET_IF_STATS) || defined (ETH_DRV_GET_IF_STATS_UD) + { + struct ether_drv_stats *p = (struct ether_drv_stats *)data; + int i; + + // Chipset entry is no longer supported; RFC1573. + for ( i = 0; i < SNMP_CHIPSET_LEN; i++ ) + p->snmp_chipset[i] = 0; + + // This perhaps should be a config opt, so you can make up your own + // description, or supply it from the instantiation. + strcpy( p->description, "NEC uPD985xx on-chip ethernet (CANDY)" ); + // CYG_ASSERT( 48 > strlen(p->description), "Description too long" ); + + i = eth_upd985xx_status( p_eth_upd985xx ); + + if ( !( i & PHY_STATUS_LINK) ) { + p->operational = 2; // LINK DOWN + p->duplex = 1; // UNKNOWN + p->speed = 0; + } + else { + p->operational = 3; // LINK UP + p->duplex = (i & PHY_STATUS_FDX) ? 3 : 2; // 2 = SIMPLEX, 3 = DUPLEX + p->speed = ((i & PHY_STATUS_100MBPS) ? 100 : 10) * 1000000; + } + + // Admit to it... + p->supports_dot3 = true; + + // Those commented out are not available on this chip. + p->tx_good = INL( ETH_TPCT ) ; + p->tx_max_collisions = INL( ETH_TXCL ) ; + p->tx_late_collisions = INL( ETH_TLCL ) ; + //p->tx_underrun = INL( ) ; + p->tx_carrier_loss = INL( ETH_TCSE ) ; + p->tx_deferred = INL( ETH_TDFR ) + + INL( ETH_TXDF ) ; + //p->tx_sqetesterrors = INL( ) ; + p->tx_single_collisions = INL( ETH_TSCL ) ; + p->tx_mult_collisions = INL( ETH_TMCL ) ; + p->tx_total_collisions = INL( ETH_TSCL ) + + INL( ETH_TMCL ) + + INL( ETH_TLCL ) + + INL( ETH_TXCL ) ; + p->rx_good = INL( ETH_RPKT ) ; + p->rx_crc_errors = INL( ETH_RFCS ) ; + p->rx_align_errors = INL( ETH_RALN ) ; + p->rx_resource_errors = p_eth_upd985xx->count_rx_resource; + //p->rx_overrun_errors = INL( ) ; + //p->rx_collisions = INL( ) ; + p->rx_short_frames = INL( ETH_RUND ) ; + p->rx_too_long_frames = INL( ETH_ROVR ) ; + p->rx_symbol_errors = INL( ETH_RXUO ) ; + + p->interrupts = p_eth_upd985xx->count_interrupts; + p->rx_count = INL( ETH_RBYT ) ; + p->rx_deliver = INL( ETH_RPKT ) ; + p->rx_resource = p_eth_upd985xx->count_rx_resource; + p->rx_restart = p_eth_upd985xx->count_rx_resource + + p_eth_upd985xx->count_rx_restart; + p->tx_count = INL( ETH_TBYT ) ; + p->tx_complete = INL( ETH_TPCT ) ; + p->tx_dropped = INL( ETH_TNCL ) ; + + p->tx_queue_len = 1; + + return 0; // OK + } +#endif + + default: + break; + } + return -1; +} + +// ------------------------------------------------------------------------ + +// EOF if_upd985xx.c diff --git a/packages/devs/eth/mips/vrc4375/current/ChangeLog b/packages/devs/eth/mips/vrc4375/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mips/vrc4375/current/ChangeLog @@ -0,0 +1,41 @@ +2001-09-27 Hugo Tyson + + * cdl/vrc4375_eth_drivers.cdl: New file. + * include/devs_eth_vrc4375.inl: New file. + Instantiation data for the Intel 21143 Ethernet Device driver, + as used in the NEC MIPS vrc4375 'Blue Nile' board. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/mips/vrc4375/current/cdl/vrc4375_eth_drivers.cdl b/packages/devs/eth/mips/vrc4375/current/cdl/vrc4375_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mips/vrc4375/current/cdl/vrc4375_eth_drivers.cdl @@ -0,0 +1,116 @@ +# ==================================================================== +# +# vrc4375_eth_drivers.cdl +# +# Ethernet drivers - support for i21143 ethernet controller +# on the NEC VRC4375 "Blue Nile" board. +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): hmt +# Contributors: +# Date: 2001-09-17 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_MIPS_VRC4375 { + display "NEC vrc4375 ethernet driver" + description " + Ethernet driver for vrc4375 'Blue Nile' board with one Intel + i21143 Ethernet controller attached via the PCI bus." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_MIPS_VR4300_VRC4375 + + include_dir cyg/io + + cdl_interface CYGINT_DEVS_ETH_INTEL_I21143_REQUIRED { + display "Intel i21143 ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_INTEL_I21143_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_INTEL_I21143_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_MIPS_VRC4375_ETH0 { + display "Vrc4375 ethernet port 0 driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + vrc4375Engine or vrc4375Bridge port 0 - that is the connector one + slot in from the corner of the board, or the only connector + depending on your particular hardware." + + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_INTEL_I21143_REQUIRED + + cdl_option CYGDAT_DEVS_ETH_MIPS_VRC4375_ETH0_NAME { + display "Device name for the ethernet port 0 driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + ethernet port 0." + } + + cdl_component CYGSEM_DEVS_ETH_MIPS_VRC4375_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_MIPS_VRC4375_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x00, 0x12, 0x34, 0x55, 0x55, 0x66}"} + description "The ethernet station address" + } + } + } +} + +# EOF vrc4375_eth_drivers.cdl diff --git a/packages/devs/eth/mips/vrc4375/current/include/devs_eth_vrc4375.inl b/packages/devs/eth/mips/vrc4375/current/include/devs_eth_vrc4375.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mips/vrc4375/current/include/devs_eth_vrc4375.inl @@ -0,0 +1,127 @@ +//========================================================================== +// +// devs/eth/mips/vrc4375/..../include/devs_eth_vrc4375.inl +// +// vrc4375 ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: +// Date: 2001-09-17 +// Purpose: vrc4375 ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +// -------------------------------------------------------------- +// Construct the interface + +#ifdef CYGPKG_DEVS_ETH_MIPS_VRC4375_ETH0 + +static I21143 i21143_eth0_priv_data = { +#ifdef CYGSEM_DEVS_ETH_MIPS_VRC4375_ETH0_SET_ESA + hardwired_esa: 1, + mac_address: CYGDAT_DEVS_ETH_MIPS_VRC4375_ETH0_ESA +#else + hardwired_esa: 0, +#endif +}; + +ETH_DRV_SC(i21143_sc0, + &i21143_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_MIPS_VRC4375_ETH0_NAME, // Name for device + i21143_start, + i21143_stop, + i21143_ioctl, + i21143_can_send, + i21143_send, + i21143_recv, + i21143_deliver, + i21143_poll, + i21143_int_vector + ); + +NETDEVTAB_ENTRY(i21143_netdev0, + "i21143_" CYGDAT_DEVS_ETH_MIPS_VRC4375_ETH0_NAME, + i21143_init, + &i21143_sc0); + +#endif // CYGPKG_DEVS_ETH_MIPS_VRC4375_ETH0 + +// -------------------------------------------------------------- +// These arrays are used for sanity checking of pointers +I21143 * +i21143_priv_array[CYGNUM_DEVS_ETH_INTEL_I21143_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_MIPS_VRC4375_ETH0 + &i21143_eth0_priv_data, +#endif +#ifdef CYGPKG_DEVS_ETH_MIPS_VRC4375_ETH1 + &i21143_eth1_priv_data, +#endif +}; + +#ifdef CYGDBG_USE_ASSERTS +// These are only used when assertions are enabled +cyg_netdevtab_entry_t * +i21143_netdev_array[CYGNUM_DEVS_ETH_INTEL_I21143_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_MIPS_VRC4375_ETH0 + &i21143_netdev0, +#endif +#ifdef CYGPKG_DEVS_ETH_MIPS_VRC4375_ETH1 + &i21143_netdev1, +#endif +}; + +struct eth_drv_sc * +i21143_sc_array[CYGNUM_DEVS_ETH_INTEL_I21143_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_MIPS_VRC4375_ETH0 + &i21143_sc0, +#endif +#ifdef CYGPKG_DEVS_ETH_MIPS_VRC4375_ETH1 + &i21143_sc1, +#endif +}; +#endif // CYGDBG_USE_ASSERTS + +// -------------------------------------------------------------- +// Debugging + +//#define CYGDBG_DEVS_ETH_INTEL_I21143_CHATTER 1 + +// -------------------------------------------------------------- + +// EOF devs_eth_vrc4375.inl diff --git a/packages/devs/eth/mn10300/asb2305/current/ChangeLog b/packages/devs/eth/mn10300/asb2305/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mn10300/asb2305/current/ChangeLog @@ -0,0 +1,38 @@ +2001-07-27 David Howells + + * Ethernet support for ASB2305 platform added. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/mn10300/asb2305/current/cdl/mn10300_asb2305_eth.cdl b/packages/devs/eth/mn10300/asb2305/current/cdl/mn10300_asb2305_eth.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mn10300/asb2305/current/cdl/mn10300_asb2305_eth.cdl @@ -0,0 +1,130 @@ +# ==================================================================== +# +# mn10300_asb2305_eth.cdl +# +# Ethernet drivers - support for AMD PCnet ethernet controller +# on the ASB2305 board. +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): dhowells +# Contributors: jskov +# Date: 2001-07-23 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_MN10300_ASB2305 { + display "MN10300 ASB2305 board ethernet driver" + description "Ethernet driver for MN10300 ASB2305 onboard ethernet device." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_MN10300_AM33_ASB2305 + + include_dir cyg/io + + # FIXME: This really belongs in the AMD_PCNET package + cdl_interface CYGINT_DEVS_ETH_AMD_PCNET_REQUIRED { + display "AMD PCNET ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_AMD_PCNET_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_AMD_PCNET_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_MN10300_ASB2305_ETH0 { + display "ASB2305 ethernet port 0 driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + ASB2305 port 0." + + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_AMD_PCNET_REQUIRED + + cdl_option CYGNUM_DEVS_ETH_MN10300_ASB2305_ETH0_RX_RING_SIZE { + display "Size of RX ring for ETH0" + flavor data + default_value 4 + legal_values { 4 8 16 32 64 128 } + description " + This option sets the size of the RX ring." + } + + cdl_option CYGNUM_DEVS_ETH_MN10300_ASB2305_ETH0_TX_RING_SIZE { + display "Size of TX ring for ETH0" + flavor data + default_value 16 + legal_values { 4 8 16 32 64 128 } + description " + This option sets the size of the TX ring." + } + + cdl_option CYGDAT_DEVS_ETH_MN10300_ASB2305_ETH0_NAME { + display "Device name for the ETH0 ethernet port 0 driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + ASB2305 port 0." + } + + cdl_component CYGSEM_DEVS_ETH_MN10300_ASB2305_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_MN10300_ASB2305_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } +} diff --git a/packages/devs/eth/mn10300/asb2305/current/include/mn10300_asb2305_eth.inl b/packages/devs/eth/mn10300/asb2305/current/include/mn10300_asb2305_eth.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/mn10300/asb2305/current/include/mn10300_asb2305_eth.inl @@ -0,0 +1,109 @@ +//========================================================================== +// +// devs/eth/mn10300/asb2305/include/mn10300_asb2305_eth.inl +// +// ASB2305 ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dhowells +// Contributors:jskov +// Date: 2001-07-23 +// Purpose: ASB2305 ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR + +#ifdef __WANT_CONFIG + +#define CYGHWR_AMD_PCNET_PCI_MEM_MAP_BASE CYGARC_UNCACHED_ADDRESS((cyg_uint32)(&CYGMEM_SECTION_pci_window[0])) +#define CYGHWR_AMD_PCNET_PCI_MEM_MAP_SIZE ((cyg_uint32)(CYGMEM_SECTION_pci_window_SIZE)) + +#endif // __WANT_CONFIG + + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_MN10300_ASB2305_ETH0 + +static pcnet_priv_data amd_pcnet_eth0_priv_data = { +#ifdef CYGSEM_DEVS_ETH_MN10300_ASB2305_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_MN10300_ASB2305_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +#endif + config_esa : NULL, + rx_ring : NULL, + rx_ring_cnt : (1<<2) /*CYGNUM_DEVS_ETH_MN10300_ASB2305_ETH0_RX_RING_SIZE*/, + rx_ring_log_cnt : 2, + tx_ring : NULL, + tx_ring_cnt : (1<<2) /*CYGNUM_DEVS_ETH_MN10300_ASB2305_ETH0_TX_RING_SIZE*/, + tx_ring_log_cnt : 2, +}; + +ETH_DRV_SC(amd_pcnet_sc, + &amd_pcnet_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_MN10300_ASB2305_ETH0_NAME, + pcnet_start, + pcnet_stop, + pcnet_control, + pcnet_can_send, + pcnet_send, + pcnet_recv, + pcnet_deliver, // "pseudoDSR" called from fast net thread + pcnet_poll, // poll function, encapsulates ISR and DSR + pcnet_int_vector); + +NETDEVTAB_ENTRY(pcnet_netdev, + "pcnet_" CYGDAT_DEVS_ETH_MN10300_ASB2305_ETH0_NAME, + amd_pcnet_init, + &amd_pcnet_sc); +#endif // CYGPKG_DEVS_ETH_MN10300_ASB2305_ETH0 + +// These arrays are used for sanity checking of pointers +struct pcnet_priv_data * +pcnet_priv_array[CYGNUM_DEVS_ETH_AMD_PCNET_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_MN10300_ASB2305_ETH0 + &amd_pcnet_eth0_priv_data, +#endif +}; + +#endif // __WANT_DEVS + +// EOF mn10300_asb2305_eth.inl diff --git a/packages/devs/eth/ns/dp83902a/current/ChangeLog b/packages/devs/eth/ns/dp83902a/current/ChangeLog --- a/packages/devs/eth/ns/dp83902a/current/ChangeLog +++ b/packages/devs/eth/ns/dp83902a/current/ChangeLog @@ -1,3 +1,17 @@ +2002-04-12 Gary Thomas + + * src/if_dp83902a.c: Clean up warnings. + +2002-03-28 Gary Thomas + + * cdl/ns_dp83902a_eth_drivers.cdl: Fix spelling of _OPTIONS + component as this is magic (CDL requires that it match the + package or it is ignored). + +2002-01-14 Jesper Skov + + * src/if_dp83902a.c (dp83902a_ClearCounters): Fix warning. + 2001-12-10 Richard Sandiford * src/if_dp83902a.c (dp83902a_RxEvent): Remove unused argument. @@ -81,29 +95,38 @@ 2001-06-13 Jesper Skov #include #include -#define __ECOS -#include -#include +#include +#include #ifdef CYGPKG_NET #include @@ -671,7 +679,7 @@ dp83902a_TxEvent(struct eth_drv_sc *sc) // Read the tally counters to clear them. Called in response to a CNT // interrupt. -static int +static void dp83902a_ClearCounters(struct eth_drv_sc *sc) { struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *)sc->driver_private; diff --git a/packages/devs/eth/powerpc/fec/current/ChangeLog b/packages/devs/eth/powerpc/fec/current/ChangeLog --- a/packages/devs/eth/powerpc/fec/current/ChangeLog +++ b/packages/devs/eth/powerpc/fec/current/ChangeLog @@ -1,3 +1,43 @@ +2002-04-30 Nick Garnett + + * src/if_fec.c: Changed order of initialization and made code more + robust against hangups. Changed initialization of ESA from memcpy + to 32 bit assignments, since 855 seems fussy about this where 860 + is not. + +2002-04-22 Gary Thomas + + * src/if_fec.c (fec_eth_control): Fix compile error (multicast). + +2002-04-19 Gary Thomas + + * cdl/fec_eth_drivers.cdl: Add [minimal] multicast support. + + * src/if_fec.c: Cleaned out debug code. + +2002-04-18 Gary Thomas + + * src/if_fec.c: Finally working! Problem was that resetting the + interface is much more involved than simply set/reset the "enable". + +2002-04-17 Gary Thomas + + * src/if_fec.c: + * src/fec.h: Add code to poll PHY for link status on startup. + Still trying to get reliable results in general operation. + +2002-04-12 Gary Thomas + + * src/fec.h: + * src/if_fec.c: Lots of tinkering since this driver is somewhat + unreliable with the generic eCos stack (the RedBoot code seems + to work oddly enough). + +2002-02-19 Gary Thomas + + * src/if_fec.c (fec_eth_init): Args were backwards(!) getting + processor revision. + 2001-08-22 Gary Thomas * src/if_fec.c: @@ -46,29 +86,38 @@ 2001-01-22 Gary Thomas #include -#include -#include +#include +#include #include "fec.h" +// Define this to force the buffer descriptors into the EPPC memory +#define FEC_USE_EPPC_BD + +#ifndef FEC_USE_EPPC_BD +static struct fec_bd fec_eth_rxring[CYGNUM_DEVS_ETH_POWERPC_FEC_RxNUM]; +static struct fec_bd fec_eth_txring[CYGNUM_DEVS_ETH_POWERPC_FEC_TxNUM]; +#endif static unsigned char fec_eth_rxbufs[CYGNUM_DEVS_ETH_POWERPC_FEC_RxNUM+1] [CYGNUM_DEVS_ETH_POWERPC_FEC_BUFSIZE]; -static struct fec_bd fec_eth_rxring[CYGNUM_DEVS_ETH_POWERPC_FEC_RxNUM]; static unsigned char fec_eth_txbufs[CYGNUM_DEVS_ETH_POWERPC_FEC_TxNUM+1] [CYGNUM_DEVS_ETH_POWERPC_FEC_BUFSIZE]; -static struct fec_bd fec_eth_txring[CYGNUM_DEVS_ETH_POWERPC_FEC_TxNUM]; static struct fec_eth_info fec_eth0_info; static unsigned char _default_enaddr[] = { 0x08, 0x00, 0x3E, 0x28, 0x7A, 0xBA}; @@ -116,14 +130,49 @@ NETDEVTAB_ENTRY(fec_netdev, &fec_eth0_sc); #ifdef CYGPKG_NET +#define _FEC_USE_INTS +#ifdef _FEC_USE_INTS static cyg_interrupt fec_eth_interrupt; static cyg_handle_t fec_eth_interrupt_handle; -#endif +#else +#define STACK_SIZE CYGNUM_HAL_STACK_SIZE_MINIMUM +static char fec_fake_int_stack[STACK_SIZE]; +static cyg_thread fec_fake_int_thread_data; +static cyg_handle_t fec_fake_int_thread_handle; +static void fec_fake_int(cyg_addrword_t); +#endif // _FEC_USE_INTS +#endif // CYGPKG_NET static void fec_eth_int(struct eth_drv_sc *data); #define FEC_ETH_INT CYGNUM_HAL_INTERRUPT_SIU_LVL1 -#ifdef CYGPKG_NET +#ifdef CYGPKG_HAL_POWERPC_VIPER +extern int hal_viper_get_led(void); +extern void hal_viper_set_led(int); +#define _get_led() hal_viper_get_led() +#define _set_led(v) hal_viper_set_led(v) +#else +#define _get_led() +#define _set_led(v) +#endif + +#define LED_TxACTIVE 7 +#define LED_RxACTIVE 6 +#define LED_IntACTIVE 5 + +static void +set_led(int bit) +{ + _set_led(_get_led() | (1<iEvent = iEvent_MII; fec->MiiData = MII_Start | MII_Write | MII_Phy(addr) | MII_Reg(reg) | MII_TA | data; - while (!(fec->iEvent & iEvent_MII)) ; + while (!(fec->iEvent & iEvent_MII) && (--timeout > 0)) ; } -static unsigned short -phy_read(int reg, int addr) +static bool +phy_read(int reg, int addr, unsigned short *val) { volatile EPPC *eppc = (volatile EPPC *)eppc_base(); volatile struct fec *fec = (volatile struct fec *)((unsigned char *)eppc + FEC_OFFSET); + int timeout = 0x100000; fec->iEvent = iEvent_MII; fec->MiiData = MII_Start | MII_Read | MII_Phy(addr) | MII_Reg(reg) | MII_TA; - while (!(fec->iEvent & iEvent_MII)) ; - return fec->MiiData & 0x0000FFFF; + while (!(fec->iEvent & iEvent_MII)) { + if (--timeout <= 0) { + return false; + } + } + *val = fec->MiiData & 0x0000FFFF; + return true; } // -// Initialize the interface - performed at system startup -// This function must set up the interface, including arranging to -// handle interrupts, etc, so that it may be "started" cheaply later. -// -static bool -fec_eth_init(struct cyg_netdevtab_entry *tab) +// [re]Initialize the ethernet controller +// Done separately since shutting down the device requires a +// full reconfiguration when re-enabling. +// when +static bool +fec_eth_reset(struct eth_drv_sc *sc, unsigned char *enaddr, int flags) { - struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance; struct fec_eth_info *qi = (struct fec_eth_info *)sc->driver_private; volatile EPPC *eppc = (volatile EPPC *)eppc_base(); volatile struct fec *fec = (volatile struct fec *)((unsigned char *)eppc + FEC_OFFSET); struct fec_bd *rxbd, *txbd; unsigned char *RxBUF, *TxBUF; - unsigned short phy_state = 0; - int cache_state; + int cache_state, int_state; int i; - unsigned long proc_rev; - bool esa_ok; + + // Ignore unless device is idle/stopped + if ((qi->fec->eControl & eControl_EN) != 0) { + return true; + } + + // Make sure interrupts are off while we mess with the device + HAL_DISABLE_INTERRUPTS(int_state); // Ensure consistent state between cache and what the FEC sees HAL_DCACHE_IS_ENABLED(cache_state); HAL_DCACHE_SYNC(); HAL_DCACHE_DISABLE(); - qi->fec = fec; - -#ifdef CYGPKG_NET - // Set up to handle interrupts - cyg_drv_interrupt_create(FEC_ETH_INT, - CYGARC_SIU_PRIORITY_HIGH, - (cyg_addrword_t)sc, // Data item passed to interrupt handler - (cyg_ISR_t *)fec_eth_isr, - (cyg_DSR_t *)eth_drv_dsr, - &fec_eth_interrupt_handle, - &fec_eth_interrupt); - cyg_drv_interrupt_attach(fec_eth_interrupt_handle); - cyg_drv_interrupt_acknowledge(FEC_ETH_INT); - cyg_drv_interrupt_unmask(FEC_ETH_INT); -#endif - - // Shut down ethernet, in case it is already running + // Shut down ethernet controller, in case it is already running fec->eControl = eControl_RESET; - eppc->pip_pbdat &= ~0x00004000; // Reset PHY chip - CYGACC_CALL_IF_DELAY_US(1000); // 1ms - eppc->pip_pbdat |= 0x00004000; // Enable PHY chip + i = 0; + while ((fec->eControl & eControl_RESET) != 0) { + if (++i >= 500000) { + os_printf("FEC Ethernet does not reset\n"); + if (cache_state) + HAL_DCACHE_ENABLE(); + HAL_RESTORE_INTERRUPTS(int_state); + return false; + } + } fec->iMask = 0x0000000; // Disables all interrupts fec->iEvent = 0xFFFFFFFF; // Clear all interrupts fec->iVector = (1<<29); // Caution - must match FEC_ETH_INT above +#define ROUNDUP(b,s) (((unsigned long)(b) + (s-1)) & ~(s-1)) +#ifdef FEC_USE_EPPC_BD + txbd = (struct fec_bd *)(0x2C00 + (cyg_uint32)eppc); + rxbd = &txbd[CYGNUM_DEVS_ETH_POWERPC_FEC_TxNUM]; +#else txbd = fec_eth_txring; rxbd = fec_eth_rxring; - qi->tbase = txbd; - qi->txbd = txbd; - qi->tnext = txbd; - qi->rbase = rxbd; - qi->rxbd = rxbd; - qi->rnext = rxbd; +#endif + qi->tbase = qi->txbd = qi->tnext = txbd; + qi->rbase = qi->rxbd = qi->rnext = rxbd; + qi->txactive = 0; -#define ROUNDUP(b,s) (((unsigned long)(b) + (s-1)) & ~(s-1)) RxBUF = (unsigned char *)ROUNDUP(&fec_eth_rxbufs[0][0], 32); TxBUF = (unsigned char *)ROUNDUP(&fec_eth_txbufs[0][0], 32); @@ -255,23 +308,13 @@ fec_eth_init(struct cyg_netdevtab_entry txbd--; txbd->ctrl |= FEC_BD_Tx_Wrap; // Last buffer - // Set up parallel port for connection to ethernet tranceiver - eppc->pio_pdpar = 0x1FFF; - CYGARC_MFSPR( proc_rev, CYGARC_REG_PVR ); -#define PROC_REVB 0x0020 - if ((proc_rev & 0x0000FFFF) == PROC_REVB) { - eppc->pio_pddir = 0x1C58; - } else { - eppc->pio_pddir = 0x1FFF; - } - // Reset interrupts fec->iMask = 0x00000000; // No interrupts enabled fec->iEvent = 0xFFFFFFFF; // Clear all interrupts // Initialize shared PRAM - fec->RxRing = fec_eth_rxring; - fec->TxRing = fec_eth_txring; + fec->RxRing = qi->rbase; + fec->TxRing = qi->tbase; // Size of receive buffers fec->RxBufSize = CYGNUM_DEVS_ETH_POWERPC_FEC_BUFSIZE; @@ -282,7 +325,7 @@ fec_eth_init(struct cyg_netdevtab_entry fec->RxHash = IEEE_8023_MAX_FRAME; // Largest possible ethernet frame // Transmit control - fec->TxControl = 0; + fec->TxControl = 4+0; // Use largest possible Tx FIFO fec->TxWater = 3; @@ -298,6 +341,98 @@ fec_eth_init(struct cyg_netdevtab_entry fec->hash[1] = 0; // Device physical address + fec->addr[0] = *(unsigned long *)&enaddr[0]; + fec->addr[1] = *(unsigned long *)&enaddr[4]; + // os_printf("FEC ESA = %08x/%08x\n", fec->addr[0], fec->addr[1]); + + // Enable device + fec->eControl = eControl_EN | eControl_MUX; + fec->RxUpdate = 0x0F0F0F0F; // Any write tells machine to look for work + +#ifdef _FEC_USE_INTS + // Set up for interrupts + fec->iMask = iEvent_TFINT | iEvent_TXB | + iEvent_RFINT | iEvent_RXB; + fec->iEvent = 0xFFFFFFFF; // Clear all interrupts +#endif + + if (cache_state) + HAL_DCACHE_ENABLE(); + + // Set LED state + clear_led(LED_TxACTIVE); + clear_led(LED_RxACTIVE); + + HAL_RESTORE_INTERRUPTS(int_state); + return true; +} + +// +// Initialize the interface - performed at system startup +// This function must set up the interface, including arranging to +// handle interrupts, etc, so that it may be "started" cheaply later. +// +static bool +fec_eth_init(struct cyg_netdevtab_entry *tab) +{ + struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance; + struct fec_eth_info *qi = (struct fec_eth_info *)sc->driver_private; + volatile EPPC *eppc = (volatile EPPC *)eppc_base(); + volatile struct fec *fec = (volatile struct fec *)((unsigned char *)eppc + FEC_OFFSET); + unsigned short phy_state = 0; + int cache_state; + int i; + unsigned long proc_rev; + bool esa_ok, phy_ok; + int phy_timeout = 5*1000; // Wait 5 seconds max for link to clear + + // Ensure consistent state between cache and what the FEC sees + HAL_DCACHE_IS_ENABLED(cache_state); + HAL_DCACHE_SYNC(); + HAL_DCACHE_DISABLE(); + + qi->fec = fec; + fec_eth_stop(sc); // Make sure it's not running yet + +#ifdef CYGPKG_NET +#ifdef _FEC_USE_INTS + // Set up to handle interrupts + cyg_drv_interrupt_create(FEC_ETH_INT, + CYGARC_SIU_PRIORITY_HIGH, + (cyg_addrword_t)sc, // Data item passed to interrupt handler + (cyg_ISR_t *)fec_eth_isr, + (cyg_DSR_t *)eth_drv_dsr, + &fec_eth_interrupt_handle, + &fec_eth_interrupt); + cyg_drv_interrupt_attach(fec_eth_interrupt_handle); + cyg_drv_interrupt_acknowledge(FEC_ETH_INT); + cyg_drv_interrupt_unmask(FEC_ETH_INT); +#else // _FEC_USE_INTS + // Hack - use a thread to simulate interrupts + cyg_thread_create(1, // Priority + fec_fake_int, // entry + (cyg_addrword_t)sc, // entry parameter + "CS8900 int", // Name + &fec_fake_int_stack[0], // Stack + STACK_SIZE, // Size + &fec_fake_int_thread_handle, // Handle + &fec_fake_int_thread_data // Thread data structure + ); + cyg_thread_resume(fec_fake_int_thread_handle); // Start it +#endif +#endif + + // Set up parallel port for connection to ethernet tranceiver + eppc->pio_pdpar = 0x1FFF; + CYGARC_MFSPR( CYGARC_REG_PVR, proc_rev ); +#define PROC_REVB 0x0020 + if ((proc_rev & 0x0000FFFF) == PROC_REVB) { + eppc->pio_pddir = 0x1C58; + } else { + eppc->pio_pddir = 0x1FFF; + } + + // Get physical device address #ifdef CYGPKG_REDBOOT esa_ok = flash_get_config("fec_esa", enaddr, CONFIG_ESA); #else @@ -309,36 +444,50 @@ fec_eth_init(struct cyg_netdevtab_entry os_printf("FEC_ETH - Warning! ESA unknown\n"); memcpy(&enaddr, &_default_enaddr, sizeof(enaddr)); } - memcpy((void *)&fec->addr[0], &enaddr[0], sizeof(enaddr)); - // os_printf("FEC ESA = %08x/%08x\n", fec->addr[0], fec->addr[1]); - // Enable device - fec->eControl = eControl_EN | eControl_MUX; + // Configure the device + if (!fec_eth_reset(sc, enaddr, 0)) { + return false; + } + // Reset PHY (transceiver) + eppc->pip_pbdat &= ~0x00004000; // Reset PHY chip + CYGACC_CALL_IF_DELAY_US(10000); // 10ms + eppc->pip_pbdat |= 0x00004000; // Enable PHY chip // Enable transceiver (PHY) phy_write(PHY_BMCR, 0, PHY_BMCR_RESET); for (i = 0; i < 10; i++) { - phy_state = phy_read(PHY_BMCR, 0); + phy_ok = phy_read(PHY_BMCR, 0, &phy_state); + if (!phy_ok) break; if (!(phy_state & PHY_BMCR_RESET)) break; } - if (phy_state & PHY_BMCR_RESET) { + if (!phy_ok || (phy_state & PHY_BMCR_RESET)) { os_printf("FEC: Can't get PHY unit to reset: %x\n", phy_state); return false; } - phy_write(PHY_BMCR, 0, PHY_BMCR_AUTO_NEG); - // os_printf("MII: %x/%x\n", phy_state, phy_read(PHY_BMCR, 0)); - -#ifdef CYGPKG_NET - // Set up for interrupts - fec->iMask = iEvent_all & ~iEvent_MII; -#endif - - if (cache_state) - HAL_DCACHE_ENABLE(); + fec->iEvent = 0xFFFFFFFF; // Clear all interrupts + phy_write(PHY_BMCR, 0, PHY_BMCR_AUTO_NEG|PHY_BMCR_RESTART); + while (phy_timeout-- >= 0) { + int ev = fec->iEvent; + unsigned short state; + fec->iEvent = ev; + if (ev & iEvent_MII) { + phy_ok = phy_read(PHY_BMSR, 0, &state); + if (phy_ok && (state & PHY_BMSR_AUTO_NEG)) { +// os_printf("State: %x\n", state); + break; + } else { + CYGACC_CALL_IF_DELAY_US(1000); // 1ms + } + } + } + if (phy_timeout <= 0) { + os_printf("** FEC Warning: PHY auto-negotiation failed\n"); + } // Initialize upper level driver (sc->funs->eth_drv->init)(sc, (unsigned char *)&enaddr); - + return true; } @@ -363,11 +512,8 @@ fec_eth_stop(struct eth_drv_sc *sc) static void fec_eth_start(struct eth_drv_sc *sc, unsigned char *enaddr, int flags) { - struct fec_eth_info *qi = (struct fec_eth_info *)sc->driver_private; - // Enable the device! - qi->fec->eControl |= eControl_EN; - qi->fec->RxUpdate = 0x0F0F0F0F; // Any write tells machine to look for work + fec_eth_reset(sc, enaddr, flags); } // @@ -377,10 +523,25 @@ static int fec_eth_control(struct eth_drv_sc *sc, unsigned long key, void *data, int length) { +#ifdef ETH_DRV_SET_MC_ALL + struct eth_drv_mc_list *mc_list; + struct fec_eth_info *qi = (struct fec_eth_info *)sc->driver_private; + volatile struct fec *fec = qi->fec; +#endif + switch (key) { case ETH_DRV_SET_MAC_ADDRESS: return 0; break; +#ifdef ETH_DRV_SET_MC_ALL + case ETH_DRV_SET_MC_ALL: + case ETH_DRV_SET_MC_LIST: + fec->RxControl &= ~RxControl_PROM; + fec->hash[0] = 0xFFFFFFFF; + fec->hash[1] = 0xFFFFFFFF; + return 0; + break; +#endif default: return 1; break; @@ -396,13 +557,13 @@ static int fec_eth_can_send(struct eth_drv_sc *sc) { struct fec_eth_info *qi = (struct fec_eth_info *)sc->driver_private; - volatile struct fec_bd *txbd = qi->txbd; - return ((txbd->ctrl & FEC_BD_Tx_Ready) == 0); + return (qi->txactive < CYGNUM_DEVS_ETH_POWERPC_FEC_TxNUM); } // // This routine is called to send data to the hardware. +int _fec_eth_tx_count = 0; static void fec_eth_send(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len, int total_len, unsigned long key) @@ -429,32 +590,37 @@ fec_eth_send(struct eth_drv_sc *sc, stru #endif } } + // Set up buffer + bp = txbd->buffer; + for (i = 0; i < sg_len; i++) { + memcpy((void *)bp, (void *)sg_list[i].buf, sg_list[i].len); + bp += sg_list[i].len; + } + txbd->length = total_len; + txindex = ((unsigned long)txbd - (unsigned long)qi->tbase) / sizeof(*txbd); + qi->txkey[txindex] = key; + // Note: the MPC860 does not seem to snoop/invalidate the data cache properly! + HAL_DCACHE_IS_ENABLED(cache_state); + if (cache_state) { + HAL_DCACHE_FLUSH(txbd->buffer, txbd->length); // Make sure no stale data + } + // Send it on it's way + txbd->ctrl |= FEC_BD_Tx_Ready | FEC_BD_Tx_Last | FEC_BD_Tx_TC; +#ifndef FEC_USE_EPPC_BD + if (cache_state) { + HAL_DCACHE_FLUSH(fec_eth_txring, sizeof(fec_eth_txring)); // Make sure no stale data + } +#endif + _fec_eth_tx_count++; + qi->txactive++; + qi->fec->TxUpdate = 0x01000000; // Any write tells machine to look for work + set_led(LED_TxACTIVE); // Remember the next buffer to try if (txbd->ctrl & FEC_BD_Tx_Wrap) { qi->txbd = qi->tbase; } else { qi->txbd = txbd+1; } - txindex = ((unsigned long)txbd - (unsigned long)qi->tbase) / sizeof(*txbd); - qi->txkey[txindex] = key; - // Set up buffer - txbd->length = total_len; - bp = txbd->buffer; - for (i = 0; i < sg_len; i++) { - memcpy((void *)bp, (void *)sg_list[i].buf, sg_list[i].len); - bp += sg_list[i].len; - } - // Note: the MBX860 does not seem to snoop/invalidate the data cache properly! - HAL_DCACHE_IS_ENABLED(cache_state); - if (cache_state) { - HAL_DCACHE_FLUSH(txbd->buffer, txbd->length); // Make sure no stale data - } - // Send it on it's way - txbd->ctrl |= FEC_BD_Tx_Ready | FEC_BD_Tx_Last | FEC_BD_Tx_TC; - if (cache_state) { - HAL_DCACHE_FLUSH(fec_eth_txring, sizeof(fec_eth_txring)); // Make sure no stale data - } - qi->fec->TxUpdate = 0x0F0F0F0F; // Any write tells machine to look for work } // @@ -468,30 +634,39 @@ static void fec_eth_RxEvent(struct eth_drv_sc *sc) { struct fec_eth_info *qi = (struct fec_eth_info *)sc->driver_private; - volatile struct fec_bd *rxbd; + volatile struct fec_bd *rxbd, *rxfirst; int cache_state; - // Note: the MBX860 does not seem to snoop/invalidate the data cache properly! + // Note: the MPC860 does not seem to snoop/invalidate the data cache properly! HAL_DCACHE_IS_ENABLED(cache_state); +#ifndef FEC_USE_EPPC_BD if (cache_state) { HAL_DCACHE_FLUSH(fec_eth_rxring, sizeof(fec_eth_rxring)); // Make sure no stale data } - rxbd = qi->rnext; - while ((rxbd->ctrl & FEC_BD_Rx_Empty) == 0) { - qi->rxbd = rxbd; // Save for callback - (sc->funs->eth_drv->recv)(sc, rxbd->length); - rxbd->ctrl |= FEC_BD_Rx_Empty; +#endif + rxbd = rxfirst = qi->rnext; + while (true) { + if ((rxbd->ctrl & FEC_BD_Rx_Empty) == 0) { + qi->rxbd = rxbd; // Save for callback + set_led(LED_RxACTIVE); + (sc->funs->eth_drv->recv)(sc, rxbd->length); + } if (rxbd->ctrl & FEC_BD_Rx_Wrap) { rxbd = qi->rbase; } else { rxbd++; } + if (rxbd == rxfirst) { + break; + } } // Remember where we left off qi->rnext = (struct fec_bd *)rxbd; +#ifndef FEC_USE_EPPC_BD if (cache_state) { HAL_DCACHE_FLUSH(fec_eth_rxring, sizeof(fec_eth_rxring)); // Make sure no stale data } +#endif qi->fec->RxUpdate = 0x0F0F0F0F; // Any write tells machine to look for work } @@ -510,7 +685,7 @@ fec_eth_recv(struct eth_drv_sc *sc, stru int i, cache_state; bp = (unsigned char *)qi->rxbd->buffer; - // Note: the MBX860 does not seem to snoop/invalidate the data cache properly! + // Note: the MPC860 does not seem to snoop/invalidate the data cache properly! HAL_DCACHE_IS_ENABLED(cache_state); if (cache_state) { HAL_DCACHE_INVALIDATE(qi->rxbd->buffer, qi->rxbd->length); // Make sure no stale data @@ -521,24 +696,34 @@ fec_eth_recv(struct eth_drv_sc *sc, stru bp += sg_list[i].len; } } + qi->rxbd->ctrl |= FEC_BD_Rx_Empty; + clear_led(LED_RxACTIVE); } static void -fec_eth_TxEvent(struct eth_drv_sc *sc, int stat) +fec_eth_TxEvent(struct eth_drv_sc *sc) { struct fec_eth_info *qi = (struct fec_eth_info *)sc->driver_private; volatile struct fec_bd *txbd; - int txindex, cache_state; + int key, txindex, cache_state; HAL_DCACHE_IS_ENABLED(cache_state); +#ifndef FEC_USE_EPPC_BD if (cache_state) { HAL_DCACHE_FLUSH(fec_eth_txring, sizeof(fec_eth_txring)); // Make sure no stale data } +#endif txbd = qi->tnext; // Note: TC field is used to indicate the buffer has/had data in it while ((txbd->ctrl & (FEC_BD_Tx_Ready|FEC_BD_Tx_TC)) == FEC_BD_Tx_TC) { txindex = ((unsigned long)txbd - (unsigned long)qi->tbase) / sizeof(*txbd); - (sc->funs->eth_drv->tx_done)(sc, qi->txkey[txindex], 0); + if ((key = qi->txkey[txindex]) != 0) { + qi->txkey[txindex] = 0; + (sc->funs->eth_drv->tx_done)(sc, key, 0); + } + if (--qi->txactive == 0) { + clear_led(LED_TxACTIVE); + } txbd->ctrl &= ~FEC_BD_Tx_TC; if (txbd->ctrl & FEC_BD_Tx_Wrap) { txbd = qi->tbase; @@ -548,9 +733,11 @@ fec_eth_TxEvent(struct eth_drv_sc *sc, i } // Remember where we left off qi->tnext = (struct fec_bd *)txbd; +#ifndef FEC_USE_EPPC_BD if (cache_state) { HAL_DCACHE_FLUSH(fec_eth_txring, sizeof(fec_eth_txring)); // Make sure no stale data } +#endif } // @@ -564,7 +751,7 @@ fec_eth_int(struct eth_drv_sc *sc) while ((event = qi->fec->iEvent) != 0) { if ((event & iEvent_TFINT) != 0) { - fec_eth_TxEvent(sc, event); + fec_eth_TxEvent(sc); } if ((event & iEvent_RFINT) != 0) { fec_eth_RxEvent(sc); @@ -582,3 +769,18 @@ fec_eth_int_vector(struct eth_drv_sc *sc return (FEC_ETH_INT); } +#if defined(CYGPKG_NET) && ~defined(_FEC_USE_INTS) +void +fec_fake_int(cyg_addrword_t param) +{ + struct eth_drv_sc *sc = (struct eth_drv_sc *) param; + int int_state; + + while (true) { + cyg_thread_delay(1); // 10ms + HAL_DISABLE_INTERRUPTS(int_state); + fec_eth_int(sc); + HAL_RESTORE_INTERRUPTS(int_state); + } +} +#endif diff --git a/packages/devs/eth/powerpc/quicc/current/ChangeLog b/packages/devs/eth/powerpc/quicc/current/ChangeLog --- a/packages/devs/eth/powerpc/quicc/current/ChangeLog +++ b/packages/devs/eth/powerpc/quicc/current/ChangeLog @@ -143,29 +143,38 @@ 2000-02-21 Gary Thomas #include -#include -#include +#include +#include #include "quicc_eth.h" diff --git a/packages/devs/eth/powerpc/quicc/current/src/quicc_eth.h b/packages/devs/eth/powerpc/quicc/current/src/quicc_eth.h --- a/packages/devs/eth/powerpc/quicc/current/src/quicc_eth.h +++ b/packages/devs/eth/powerpc/quicc/current/src/quicc_eth.h @@ -5,29 +5,38 @@ // PowerPC QUICC (MPC8xx) ethernet // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/devs/eth/sh/etherc/current/ChangeLog b/packages/devs/eth/sh/etherc/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/etherc/current/ChangeLog @@ -0,0 +1,106 @@ +2002-03-18 Jonathan Larmour + + * src/if_etherc.c (etherc_RxEvent): ensure Receive Request is always + enabled. + +2002-03-18 Jesper Skov + + * src/sh_etherc.h: Removed some unused definitions. + + * src/if_etherc.c (etherc_poll): Move the bit of code that ensures RX + enabling down to the exit of the function so it is always executed. + +2002-03-07 Jesper Skov + + * src/if_etherc.c: Initialize interrupt field. Skip tests for + suspended device - they are wrong. + + * src/phyter.inl (_MII_RENEGOTIATE): split delay out in new + _MII_RENEGOTIATION_WAIT macro. + (_MII_SPEED_FORCE_10MB): Added. + + * src/if_etherc.c (sh_etherc_init): Added forced-10Mbit + option. Cleaned up some fix mes. + +2002-03-06 Jesper Skov + + * src/if_etherc.c: Disabled PHY errata workaround. Make sure + promisuous mode is disabled per default. Don't clear the wrap-bit + of the RD table. + + * src/sh_etherc.h: Added a definition. + +2002-02-21 Jesper Skov + + * src/if_etherc.c (_MII_HAS_EXTENDED): define. + +2002-02-20 Jesper Skov + + * src/if_etherc.c: Pad packets to minimum ethernet frame + length. Added PHY erratum workaround. + + * src/sh_etherc.h: Remove debug setting. + + * src/phyter.inl: Added here for now. + + * src/if_etherc.c: Include phyter.inl. + (sh_etherc_init): Fix ring initialization. Set to continuous + reception. + (etherc_start): Tell FIFO to dump data in memory. + (etherc_control): Use _MII functions to gather necessary + information. + (etherc_can_send): Same. + Added _MII accessor macros and some extra debug code. + +2002-02-19 Jesper Skov + + * src/sh_etherc.h: Moved debug print code here. Tweak debug + functions. + * src/if_etherc.c: Tweaked the init and TX code some. Don't check + for CYGARC_REG_EESR_ECI in the poll function as it does not appear + to get set when other requests are. Moved debug print code to + header file. + + * src/sh_etherc.h: More definitions. + + * src/if_etherc.c: Fix typos. Add interrupt attach code. Update + remaining functions to support this controller. + +2002-01-30 Jesper Skov + + * File structure cloned from PCNet driver. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/sh/etherc/current/cdl/sh_etherc_eth_drivers.cdl b/packages/devs/eth/sh/etherc/current/cdl/sh_etherc_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/etherc/current/cdl/sh_etherc_eth_drivers.cdl @@ -0,0 +1,105 @@ +# ==================================================================== +# +# sh_etherc_eth_drivers.cdl +# +# Ethernet drivers - support for SH EtherC ethernet controllers +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: jskov +# Date: 2002-01-30 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_SH_ETHERC { + display "SH EtherC CPU module ethernet driver" + description "Ethernet driver for SH EtherC CPU module controller." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + + active_if CYGINT_DEVS_ETH_SH_ETHERC_REQUIRED + + include_dir . + include_files ; # none _exported_ whatsoever + compile -library=libextras.a if_etherc.c + + define_proc { + puts $::cdl_header "#include "; + puts $::cdl_header "#include CYGDAT_DEVS_ETH_SH_ETHERC_CFG"; + } + + cdl_option CYGNUM_DEVS_ETH_SH_ETHERC_DEV_COUNT { + display "Number of supported interfaces." + calculated { CYGINT_DEVS_ETH_SH_ETHERC_REQUIRED } + flavor data + description " + This option selects the number of ethernet interfaces to + be supported by the driver." + } + + cdl_option CYGSEM_DEVS_ETH_SH_ETHERC_FORCE_10MBPS { + display "Force negotiation of a 10Mbps link" + flavor bool + default_value 0 + description " + If this option is enabled then the driver will force the chipset + to negotiate only for a 10Mbps link (rather than a 100Mbps + link)." + } + + cdl_component CYGPKG_DEVS_ETH_SH_ETHERC_OPTIONS { + display "ETHERC ethernet driver build options" + flavor none + no_define + + cdl_option CYGPKG_DEVS_ETH_SH_ETHERC_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL -D__ECOS" } + description " + This option modifies the set of compiler flags for + building the EtherC ethernet driver package. + These flags are used in addition + to the set of global flags." + } + } +} diff --git a/packages/devs/eth/sh/etherc/current/src/if_etherc.c b/packages/devs/eth/sh/etherc/current/src/if_etherc.c new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/etherc/current/src/if_etherc.c @@ -0,0 +1,1125 @@ +//========================================================================== +// +// dev/if_etherc.c +// +// Ethernet device driver for SH EtherC CPU module controller +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-30 +// Purpose: +// Description: Hardware driver for SH EtherC CPU module controller +// +// Notes: The KEEP_STATISTICS code is not implemented yet. Look +// for FIXME macro. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include +#include +#include +#include +#include +#include +#include // delays +#include +#include +#include +#ifdef CYGPKG_NET +#include +#include +#include /* Needed for struct ifnet */ +#include +#endif +#include CYGHWR_MEMORY_LAYOUT_H + +#define FIXME 0 + +// Set size so it is 16-byte aligned +#define _BUF_SIZE (1544+8) + +#define IEEE_8023_MIN_FRAME 64 // Smallest possible ethernet frame + +#ifdef CYGPKG_INFRA_DEBUG +// Then we log, OOI, the number of times we get a bad packet number +// from the tx done fifo. +int etherc_txfifo_good = 0; +int etherc_txfifo_bad = 0; +#endif + +#include "sh_etherc.h" +#define __WANT_DEVS +#include CYGDAT_DEVS_ETH_SH_ETHERC_INL +#undef __WANT_DEVS + +static void etherc_poll(struct eth_drv_sc *sc); + +static cyg_uint16 etherc_read_MII(struct etherc_priv_data *cpd, int id, int reg); +static void etherc_write_MII(struct etherc_priv_data *cpd, int id, int reg, cyg_uint16 value); +#define _MII_READ(_priv_, _id_, _reg_) etherc_read_MII(_priv_, _id_, _reg_) +#define _MII_WRITE(_priv_, _id_, _reg_, _val_) etherc_write_MII(_priv_, _id_, _reg_, _val_) +#define _MII_HAS_EXTENDED +#include "phyter.inl" + +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE +// This ISR is called when the ethernet interrupt occurs +static cyg_uint32 +etherc_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + struct etherc_priv_data *cpd = (struct etherc_priv_data *)data; + + DEBUG_FUNCTION(); + + INCR_STAT( interrupts ); + + cyg_drv_interrupt_mask(cpd->interrupt); + cyg_drv_interrupt_acknowledge(cpd->interrupt); + return (CYG_ISR_HANDLED|CYG_ISR_CALL_DSR); // Run the DSR +} + +static void +etherc_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + // This conditioning out is necessary because of explicit calls to this + // DSR - which would not ever be called in the case of a polled mode + // usage ie. in RedBoot. +#ifdef CYGPKG_IO_ETH_DRIVERS_NET + struct etherc_priv_data* cpd = (struct etherc_priv_data *)data; + struct cyg_netdevtab_entry *ndp = (struct cyg_netdevtab_entry *)(cpd->ndp); + struct eth_drv_sc *sc = (struct eth_drv_sc *)(ndp->device_instance); + + // but here, it must be a *sc: + eth_drv_dsr( vector, count, (cyg_addrword_t)sc ); +#else +# ifndef CYGPKG_REDBOOT +# error Empty Etherc ethernet DSR is compiled. Is this what you want? +# endif +#endif +} +#endif // CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + + +// The deliver function (ex-DSR) handles the ethernet [logical] processing +static void +etherc_deliver(struct eth_drv_sc *sc) +{ + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + + DEBUG_FUNCTION(); + + // Service the interrupt: + etherc_poll(sc); + // Allow interrupts to happen again + cyg_drv_interrupt_unmask(cpd->interrupt); +} + +static int +etherc_int_vector(struct eth_drv_sc *sc) +{ + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + + return (cpd->interrupt); +} + + +static bool +sh_etherc_init(struct cyg_netdevtab_entry *tab) +{ + struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance; + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + cyg_uint8 *p, *d; + cyg_uint32 reg; + int i; + bool esa_configured = true; + + DEBUG_FUNCTION(); + + cpd->txbusy = 0; + + // Ensure that addresses of ring descriptors and buffers are properly aligned + // and in uncached memory. + cpd->rx_buffers = (cyg_uint8*)CYGARC_UNCACHED_ADDRESS(((cyg_uint32)cpd->rx_buffers+16-1) & ~(16-1)); + cpd->rx_ring = (cyg_uint8*)CYGARC_UNCACHED_ADDRESS(((cyg_uint32)cpd->rx_ring+16-1) & ~(16-1)); + cpd->tx_buffers = (cyg_uint8*)CYGARC_UNCACHED_ADDRESS(((cyg_uint32)cpd->tx_buffers+16-1) & ~(16-1)); + cpd->tx_ring = (cyg_uint8*)CYGARC_UNCACHED_ADDRESS(((cyg_uint32)cpd->tx_ring+16-1) & ~(16-1)); + +#if DEBUG & 8 + db_printf("Etherc at base 0x%08x\n", cpd->base); +#endif + + // Find ESA - check possible sources in sequence and stop when + // one provides the ESA: + // RedBoot option (via provide_esa) + // Compile-time configuration + // EEPROM + // + if (NULL != cpd->provide_esa) { + esa_configured = cpd->provide_esa(cpd); +# if DEBUG & 8 + if (esa_configured) + diag_printf("Got ESA from RedBoot option\n"); +# endif + } + if (!esa_configured && cpd->hardwired_esa) { + // ESA is already set in cpd->esa[] + esa_configured = true; + } + if (!esa_configured) { +# if DEBUG & 8 + diag_printf("EtherC - no EEPROM, static ESA or RedBoot config option.\n"); +# endif + return false; + } + +#if DEBUG & 9 + db_printf("ETHERC ESA: %02x:%02x:%02x:%02x:%02x:%02x\n", + cpd->esa[0], cpd->esa[1], cpd->esa[2], + cpd->esa[3], cpd->esa[4], cpd->esa[5] ); +#endif + + // Prepare RX and TX rings + p = cpd->rx_ring; + d = cpd->rx_buffers; + for (i = 0; i < cpd->rx_ring_cnt; i++) { + _SU32(p, ETHERC_RD_STAT) = ETHERC_RD_STAT_RACT | ETHERC_RD_STAT_RFP_OTO; + _SU16(p, ETHERC_RD_RBL) = _BUF_SIZE; + _SU16(p, ETHERC_RD_RDL) = 0; + _SU32(p, ETHERC_RD_RBA) = (cyg_uint32)d; + _SU32(p, ETHERC_RD_PAD) = 0; + p += ETHERC_RD_SIZE; + d += _BUF_SIZE; + } + // Set ring-end marker + p -= ETHERC_RD_SIZE; + _SU32(p, ETHERC_RD_STAT) |= ETHERC_RD_STAT_RDLE; + cpd->rx_ring_next = 0; + + p = cpd->tx_ring; + d = cpd->tx_buffers; + for (i = 0; i < cpd->tx_ring_cnt; i++) { + _SU32(p, ETHERC_TD_STAT) = ETHERC_TD_STAT_TFP_OTO; + _SU16(p, ETHERC_TD_TDL) = 0; + _SU16(p, ETHERC_TD_PAD0) = 0; + _SU32(p, ETHERC_TD_TBA) = (cyg_uint32)d; + _SU32(p, ETHERC_TD_PAD1) = 0; + p += ETHERC_TD_SIZE; + d += _BUF_SIZE; + } + // Set ring-end marker + p -= ETHERC_RD_SIZE; + _SU32(p, ETHERC_TD_STAT) |= ETHERC_TD_STAT_TDLE; + cpd->tx_ring_free = cpd->tx_ring_alloc = cpd->tx_ring_owned = 0; + + // Reset ethernet module, then wait for (at least) 16 clocks. + put_reg(cpd, _REG_EDMR, CYGARC_REG_EDMR_SWR | CYGARC_REG_EDMR_DL16); + for (i = 0; i < 16; i++); + put_reg(cpd, _REG_EDMR, CYGARC_REG_EDMR_DL16); + + // Program ring data into controller + put_reg(cpd, _REG_RDLAR, (cyg_uint32)cpd->rx_ring); + put_reg(cpd, _REG_TDLAR, (cyg_uint32)cpd->tx_ring); + + // Set ESA + put_reg(cpd, _REG_MAHR, (cpd->esa[0] << 24) | (cpd->esa[1] << 16) | (cpd->esa[2] << 8) | cpd->esa[3]); + put_reg(cpd, _REG_MALR, (cpd->esa[4] << 8) | cpd->esa[5]); + + // Set receive mode: receive continuously + put_reg(cpd, _REG_RCR, CYGARC_REG_RCR_RNC); + + // Stop controller, set duplex mode + put_reg(cpd, _REG_ECMR, CYGARC_REG_ECMR_DM); + cpd->active = 0; + + // Clear pending interrupt flags + reg = get_reg(cpd, _REG_EESR); + put_reg(cpd, _REG_EESR, reg); + +#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE + // Attach ISR/DSRs. + cpd->interrupt = CYGNUM_HAL_INTERRUPT_EDMAC_EINT; + cyg_drv_interrupt_create(cpd->interrupt, + 1, // Priority + (cyg_addrword_t)cpd, // Data item passed to ISR & DSR + etherc_isr, // ISR + etherc_dsr, // DSR + &cpd->interrupt_handle, // handle to intr obj + &cpd->interrupt_object ); // space for int obj + + cyg_drv_interrupt_attach(cpd->interrupt_handle); + cyg_drv_interrupt_unmask(cpd->interrupt); + put_reg(cpd, _REG_EESIPR, CYGARC_REG_EESIPR_TCIP|CYGARC_REG_EESIPR_FRIP); +#if DEBUG & 8 + db_printf("Attached interrupt on vector %d\n", cpd->interrupt); +#endif +#endif + + // Record the net dev pointer + cpd->ndp = (void *)tab; + + + // Initialize the PHY +#ifdef CYGSEM_DEVS_ETH_SH_ETHERC_FORCE_10MBPS +#if DEBUG & 8 + db_printf("Forcing 10Mb link\n"); +#endif + _MII_SPEED_FORCE_10MB(cpd, 1); + _MII_RENEGOTIATE(cpd, 1); +#else + // Wait for automatic negotiation to complete + _MII_RENEGOTIATION_WAIT(cpd, 1); +#endif + + // Initialize upper level driver + (sc->funs->eth_drv->init)(sc, cpd->esa); + +#if DEBUG & 9 + db_printf("Done\n"); +#endif + return true; +} + +static void +etherc_suspend(struct etherc_priv_data *cpd) +{ + cyg_uint32 reg; +#if 0 + bool still_active; +#endif + + reg = get_reg(cpd, _REG_ECMR); + reg &= ~(CYGARC_REG_ECMR_TE | CYGARC_REG_ECMR_RE); + put_reg(cpd, _REG_ECMR, reg); + +#if 0 // + // Try to find out if controller stopped. Supposedly, it should + // communicate this by clearing the active signal of the active + // RX/TX descriptors. + + // Check RX + do { + still_active = false; + reg = get_reg(cpd, _REG_RDFAR); +#if 1 + { + int i; + cyg_uint8* p; + p = cpd->rx_ring; + for (i = 0; i < cpd->rx_ring_cnt; i++) { + if ((cyg_uint32)p == reg) { + if (_SU32(reg, ETHERC_RD_STAT) & ETHERC_RD_STAT_RACT) { + still_active = true; + break; + } + } + } + } +#else + if (_SU32(reg, ETHERC_RD_STAT) & ETHERC_RD_STAT_RACT) + still_active = true; +#endif + } while (still_active); + + // Check TX + do { + still_active = false; + reg = get_reg(cpd, _REG_TDFAR); +#if 1 + { + int i; + cyg_uint8* p; + p = cpd->tx_ring; + for (i = 0; i < cpd->tx_ring_cnt; i++) { + if ((cyg_uint32)p == reg) { + if (_SU32(reg, ETHERC_TD_STAT) & ETHERC_TD_STAT_TACT) { + still_active = true; + break; + } + } + } + } +#else + if (_SU32(reg, ETHERC_TD_STAT) & ETHERC_TD_STAT_TACT) + still_active = true; +#endif + } while (still_active); + + db_printf("all done\n"); +#endif + cpd->active = 0; +} + +static void +etherc_stop(struct eth_drv_sc *sc) +{ + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + + DEBUG_FUNCTION(); + + etherc_suspend(cpd); +} + +// +// This function is called to "start up" the interface. It may be called +// multiple times, even when the hardware is already running. It will be +// called whenever something "hardware oriented" changes and should leave +// the hardware ready to send/receive packets. +// +static void +etherc_start(struct eth_drv_sc *sc, unsigned char *enaddr, int flags) +{ + cyg_uint32 reg, prm_mode = 0; + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; +#ifdef CYGPKG_NET + struct ifnet *ifp = &sc->sc_arpcom.ac_if; +#endif + DEBUG_FUNCTION(); + + // If device is already active, suspend it + if (cpd->active) { + etherc_suspend(cpd); + } + +#ifdef CYGPKG_NET + if (( 0 +#ifdef ETH_DRV_FLAGS_PROMISC_MODE + != (flags & ETH_DRV_FLAGS_PROMISC_MODE) +#endif + ) || (ifp->if_flags & IFF_PROMISC) + ) { + // Then we select promiscuous mode. + prm_mode = CYGARC_REG_ECMR_PRM; + } +#endif + + // Unsuspend the device + reg = get_reg(cpd, _REG_ECMR); + reg |= CYGARC_REG_ECMR_TE | CYGARC_REG_ECMR_RE; + reg &= ~CYGARC_REG_ECMR_PRM; + reg |= prm_mode; + put_reg(cpd, _REG_ECMR, reg); + + put_reg(cpd, _REG_EDRRR, CYGARC_REG_EDRRR_RR); + + cpd->active = 1; +} + +// +// This routine is called to perform special "control" opertions +// +static int +etherc_control(struct eth_drv_sc *sc, unsigned long key, + void *data, int data_length) +{ + cyg_uint8 *esa = (cyg_uint8 *)data; + int i, res; + cyg_uint16 reg; + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + cyg_bool was_active = cpd->active; + + DEBUG_FUNCTION(); + + // If device is already active, suspend it + if (cpd->active) { + etherc_suspend(cpd); + } + + res = 0; // expect success + switch (key) { + case ETH_DRV_SET_MAC_ADDRESS: +#if 9 & DEBUG + db_printf("ETHERC - set ESA: %02x:%02x:%02x:%02x:%02x:%02x\n", + esa[0], esa[1], esa[2], esa[3], esa[4], esa[5] ); +#endif // DEBUG + + for ( i = 0; i < sizeof(cpd->esa); i++ ) + cpd->esa[i] = esa[i]; + put_reg(cpd, _REG_MAHR,(cpd->esa[0] << 24) | (cpd->esa[1] << 16) | (cpd->esa[2] << 8) | cpd->esa[3]); + put_reg(cpd, _REG_MALR, (cpd->esa[4] << 8) | cpd->esa[5]); + break; + +#ifdef ETH_DRV_GET_MAC_ADDRESS + case ETH_DRV_GET_MAC_ADDRESS: + // Extract the MAC address that is in the chip, and tell the + // system about it. + cyg_uint32 reg; + reg = get_reg(cpd, _REG_MAHR); + cpd->esa[0] = (reg >> 24) & 0xff; + cpd->esa[1] = (reg >> 16) & 0xff; + cpd->esa[2] = (reg >> 08) & 0xff; + cpd->esa[3] = (reg >> 00) & 0xff; + reg = get_reg(cpd, _REG_MALR); + cpd->esa[4] = (reg >> 08) & 0xff; + cpd->esa[5] = (reg >> 00) & 0xff; + break; +#endif + +#ifdef ETH_DRV_GET_IF_STATS_UD + case ETH_DRV_GET_IF_STATS_UD: // UD == UPDATE +#endif + // drop through +#ifdef ETH_DRV_GET_IF_STATS + case ETH_DRV_GET_IF_STATS: +#endif + +#if defined(ETH_DRV_GET_IF_STATS) || defined (ETH_DRV_GET_IF_STATS_UD) + { + struct ether_drv_stats *p = (struct ether_drv_stats *)data; + // Chipset entry is no longer supported; RFC1573. + for ( i = 0; i < SNMP_CHIPSET_LEN; i++ ) + p->snmp_chipset[i] = 0; + + // This perhaps should be a config opt, so you can make up your own + // description, or supply it from the instantiation. + strcpy( p->description, "SH Etherc" ); + // CYG_ASSERT( 48 > strlen(p->description), "Description too long" ); + + if (_MII_LINK_STATE(cpd, 1)) { + // Link is up + p->operational = 3; // LINK UP + if (_MII_DUPLEX_STATE(cpd, 1)) + p->duplex = 3; // 3 = DUPLEX + else + p->duplex = 2; // 2 = SIMPLEX + if (_MII_SPEED_STATE(cpd, 1)) + p->speed = 100 * 1000000; + else + p->speed = 10 * 1000000; + } else { + // Link is down + p->operational = 2; // LINK DOWN + p->duplex = 1; // UNKNOWN + p->speed = 0; + } +#if FIXME +#ifdef KEEP_STATISTICS + { + struct sh_etherc_stats *ps = &(cpd->stats); + + // Admit to it... + p->supports_dot3 = true; + + p->tx_good = ps->tx_good ; + p->tx_max_collisions = ps->tx_max_collisions ; + p->tx_late_collisions = ps->tx_late_collisions ; + p->tx_underrun = ps->tx_underrun ; + p->tx_carrier_loss = ps->tx_carrier_loss ; + p->tx_deferred = ps->tx_deferred ; + p->tx_sqetesterrors = ps->tx_sqetesterrors ; + p->tx_single_collisions = ps->tx_single_collisions; + p->tx_mult_collisions = ps->tx_mult_collisions ; + p->tx_total_collisions = ps->tx_total_collisions ; + p->rx_good = ps->rx_good ; + p->rx_crc_errors = ps->rx_crc_errors ; + p->rx_align_errors = ps->rx_align_errors ; + p->rx_resource_errors = ps->rx_resource_errors ; + p->rx_overrun_errors = ps->rx_overrun_errors ; + p->rx_collisions = ps->rx_collisions ; + p->rx_short_frames = ps->rx_short_frames ; + p->rx_too_long_frames = ps->rx_too_long_frames ; + p->rx_symbol_errors = ps->rx_symbol_errors ; + + p->interrupts = ps->interrupts ; + p->rx_count = ps->rx_count ; + p->rx_deliver = ps->rx_deliver ; + p->rx_resource = ps->rx_resource ; + p->rx_restart = ps->rx_restart ; + p->tx_count = ps->tx_count ; + p->tx_complete = ps->tx_complete ; + p->tx_dropped = ps->tx_dropped ; + } +#endif // KEEP_STATISTICS +#endif // FIXME + + p->tx_queue_len = 1; + break; + } +#endif + default: + res = 1; + break; + } + + // Restore controller state + if (was_active) { + // Unsuspend the device + reg = get_reg(cpd, _REG_ECMR); + reg |= CYGARC_REG_ECMR_RE | CYGARC_REG_ECMR_TE; + put_reg(cpd, _REG_ECMR, reg); + } + + return res; +} + +// +// This routine is called to see if it is possible to send another packet. +// It will return non-zero if a transmit is possible, zero otherwise. +// +static int +etherc_can_send(struct eth_drv_sc *sc) +{ + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + + DEBUG_FUNCTION(); + + if (!_MII_LINK_STATE(cpd, 1)) + return 0; // Link not connected + + return (0 == cpd->txbusy); +} + +// +// This routine is called to send data to the hardware. +static void +etherc_send(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len, + int total_len, unsigned long key) +{ + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + int i, len, plen, ring_entry; + + cyg_uint8* sdata = NULL; + cyg_uint8 *d, *buf, *txd; + + DEBUG_FUNCTION(); + + INCR_STAT( tx_count ); + + cpd->txbusy = 1; + cpd->txkey = key; + + // Find packet length + plen = 0; + for (i = 0; i < sg_len; i++) + plen += sg_list[i].len; + + CYG_ASSERT( plen == total_len, "sg data length mismatch" ); + + // Get next TX descriptor + ring_entry = cpd->tx_ring_free; + do { + if (cpd->tx_ring_owned == cpd->tx_ring_cnt) { + // Is this a dead end? Probably is. +#if DEBUG & 1 + db_printf("%s: Allocation failed! Retrying...\n", __FUNCTION__ ); +#endif + continue; + } + + cpd->tx_ring_free++; + cpd->tx_ring_owned++; + if (cpd->tx_ring_free == cpd->tx_ring_cnt) + cpd->tx_ring_free = 0; + } while (0); + + txd = cpd->tx_ring + ring_entry*ETHERC_TD_SIZE; + buf = cpd->tx_buffers + ring_entry*_BUF_SIZE; + CYG_ASSERT(0 == (_SU32(txd, ETHERC_TD_STAT) & ETHERC_TD_STAT_TACT), + "TX descriptor not free"); + +#if DEBUG & 4 + db_printf("#####Tx descriptor 0x%08x buffer 0x%08x\n", + txd, buf); +#endif + + // Put data into buffer + d = buf; + for (i = 0; i < sg_len; i++) { + sdata = (cyg_uint8 *)sg_list[i].buf; + len = sg_list[i].len; + + CYG_ASSERT( sdata, "No sg data pointer here" ); + while(len--) + *d++ = *sdata++; + } + CYG_ASSERT( sdata, "No sg data pointer outside" ); + + if (plen < IEEE_8023_MIN_FRAME) { +#if DEBUG & 1 + db_printf("Packet too short (%d) - padding to %d bytes.\n", plen, IEEE_8023_MIN_FRAME); +#endif + for (i = plen; i < IEEE_8023_MIN_FRAME; i++) + *d++ = 0; + plen = IEEE_8023_MIN_FRAME; + } + + _SU16(txd, ETHERC_TD_TDL) = plen; + _SU32(txd, ETHERC_TD_STAT) |= ETHERC_TD_STAT_TACT; + +#if DEBUG & 1 + db_printf("Last TX: LEN %04x STAT %08x PTR %08x\n", + _SU16(txd, ETHERC_TD_TDL), + _SU32(txd, ETHERC_TD_STAT), + _SU32(txd, ETHERC_TD_TBA)); +#endif + + // Set transmit demand + put_reg(cpd, _REG_EDTRR, CYGARC_REG_EDTRR_TR); + +#if DEBUG & 1 + { + cyg_uint32 reg; + reg = get_reg(cpd, _REG_EESR); + db_printf("%s:END: EESR at TX: 0x%08x\n", __FUNCTION__, reg); + } +#endif +} + +static void +etherc_TxEvent(struct eth_drv_sc *sc, int stat) +{ + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + int success = 1; + cyg_uint8 *txd; + cyg_uint32 pkt_stat; + + DEBUG_FUNCTION(); + + if (0 == cpd->tx_ring_owned) { +#if DEBUG & 1 + db_printf("%s: got TX completion when no outstanding packets\n", __FUNCTION__); +#endif + // Ack the TX int + put_reg(cpd, _REG_EESR, CYGARC_REG_EESR_TC); + return; + } + + + INCR_STAT( tx_complete ); + + txd = cpd->tx_ring + cpd->tx_ring_alloc*ETHERC_TD_SIZE; + pkt_stat = _SU32(txd, ETHERC_TD_STAT); + if (pkt_stat & ETHERC_TD_STAT_TACT) { +#if DEBUG & 1 + db_printf("%s: got TX completion when buffer is still owned\n", __FUNCTION__); +#endif + // first dirty ring entry not freed - wtf? + } + + if (pkt_stat & ETHERC_TD_STAT_TDFE) { + // We had an error. Tell the stack. + success = 0; +#if DEBUG & 1 + db_printf("%s: TX failure, retrying...\n", __FUNCTION__); +#endif + } + + cpd->tx_ring_alloc++; + if (cpd->tx_ring_alloc == cpd->tx_ring_cnt) + cpd->tx_ring_alloc = 0; + cpd->tx_ring_owned--; + +#if FIXME +#ifdef KEEP_STATISTICS + { + cyg_uint16 reg; + + reg = get_reg( sc, ETHERC_CSR_CSCR ); + + // Covering each bit in turn... + if ( reg & ETHERC_STATUS_TX_UNRN ) INCR_STAT( tx_underrun ); + //if ( reg & ETHERC_STATUS_LINK_OK ) INCR_STAT( ); + //if ( reg & ETHERC_STATUS_CTR_ROL ) INCR_STAT( ); + //if ( reg & ETHERC_STATUS_EXC_DEF ) INCR_STAT( ); + if ( reg & ETHERC_STATUS_LOST_CARR ) INCR_STAT( tx_carrier_loss ); + if ( reg & ETHERC_STATUS_LATCOL ) INCR_STAT( tx_late_collisions ); + //if ( reg & ETHERC_STATUS_WAKEUP ) INCR_STAT( ); + if ( reg & ETHERC_STATUS_TX_DEFR ) INCR_STAT( tx_deferred ); + //if ( reg & ETHERC_STATUS_LTX_BRD ) INCR_STAT( ); + if ( reg & ETHERC_STATUS_SQET ) INCR_STAT( tx_sqetesterrors ); + if ( reg & ETHERC_STATUS_16COL ) INCR_STAT( tx_max_collisions ); + //if ( reg & ETHERC_STATUS_LTX_MULT) INCR_STAT( ); + if ( reg & ETHERC_STATUS_MUL_COL ) INCR_STAT( tx_mult_collisions ); + if ( reg & ETHERC_STATUS_SNGL_COL ) INCR_STAT( tx_single_collisions ); + if ( reg & ETHERC_STATUS_TX_SUC ) INCR_STAT( tx_good ); + + cpd->stats.tx_total_collisions = + cpd->stats.tx_late_collisions + + cpd->stats.tx_max_collisions + + cpd->stats.tx_mult_collisions + + cpd->stats.tx_single_collisions; + + // We do not need to look in the Counter Register (ETHERC_COUNTER) + // because it just mimics the info we already have above. + } +#endif // KEEP_STATISTICS +#endif // FIXME + + // Ack the TX int + put_reg(cpd, _REG_EESR, CYGARC_REG_EESR_TC); + +#if DEBUG & 4 + db_printf("#####Tx packet freed 0x%08x\n", txd ); +#endif + + if ( cpd->txbusy ) { + cpd->txbusy = 0; + (sc->funs->eth_drv->tx_done)(sc, cpd->txkey, success); + } +} + + +// +// This function is called when a packet has been received. Its job is +// to prepare to unload the packet from the hardware. Once the length of +// the packet is known, the upper layer of the driver can be told. When +// the upper layer is ready to unload the packet, the internal function +// 'etherc_recv' will be called to actually fetch it from the hardware. +// +static void +etherc_RxEvent(struct eth_drv_sc *sc) +{ + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + cyg_uint8 *rxd; + cyg_uint32 rstat; + cyg_uint32 ints; + cyg_uint16 len; + + DEBUG_FUNCTION(); + + ints = get_reg(cpd, _REG_EESR); +#if DEBUG & 1 + db_printf("RxEvent - ESSR: 0x%08x\n", ints); +#endif + + while (1) { + // Get state of next (supposedly) full ring entry + cpd->rxpacket = cpd->rx_ring_next; + rxd = cpd->rx_ring + cpd->rxpacket*ETHERC_RD_SIZE; + rstat = _SU32(rxd, ETHERC_RD_STAT); + + // Keep going until we hit an entry that is owned by the + // controller. + if (rstat & ETHERC_RD_STAT_RACT) { +#if DEBUG & 1 + int i; + for (i = 0; i < cpd->rx_ring_cnt; i++) { + rxd = cpd->rx_ring + i*ETHERC_RD_SIZE; + rstat = _SU32(rxd, ETHERC_RD_STAT); + + if (!(rstat & ETHERC_RD_STAT_RACT)) { + int i; + cyg_uint32 rstat; + cyg_uint16 mlen, blen; + cyg_uint8* rxd; + + db_printf("%s: Inconsistent RX state for %d\n", __FUNCTION__, cpd->rxpacket); + for (i = 0; i < cpd->rx_ring_cnt; i++) { + rxd = cpd->rx_ring + i*ETHERC_RD_SIZE; + + rstat = _SU32(rxd, ETHERC_RD_STAT); + blen = _SU16(rxd, ETHERC_RD_RBL); + mlen = _SU16(rxd, ETHERC_RD_RDL); + db_printf(" %02d: 0x%08x:0x%04x:0x%04x\n", i, rstat, blen, mlen); + } + } + } +#endif + break; + } + +#if DEBUG & 4 + db_printf("#####Rx packet at index %d\n", cpd->rxpacket); +#endif + + // Increment counts + INCR_STAT( rx_count ); + cpd->rx_ring_next++; + if (cpd->rx_ring_next == cpd->rx_ring_cnt) cpd->rx_ring_next = 0; + + len = _SU16(rxd, ETHERC_RD_RDL); + +#ifdef KEEP_STATISTICS + //if ( rstat & ETHERC_RD_PTR_FRAM ) INCR_STAT( rx_frame_errors ); + //if ( rstat & ETHERC_RD_PTR_OFLO ) INCR_STAT( ); + if ( rstat & ETHERC_RD_STAT_RFOF ) INCR_STAT( rx_crc_errors ); + //if ( rstat & ETHERC_RD_PTR_BUFF ) INCR_STAT( ); +#endif // KEEP_STATISTICS + + if (0 == (rstat & ETHERC_RD_STAT_RFE)) { + // It's OK + INCR_STAT( rx_good ); + +#if DEBUG & 1 + db_printf("RxEvent good rx - stat: 0x%08x, len: 0x%04x\n", rstat, len); +#endif + // Check for bogusly short packets; can happen in promisc + // mode: Asserted against and checked by upper layer + // driver. +#ifdef CYGPKG_NET + if ( len > sizeof( struct ether_header ) ) + // then it is acceptable; offer the data to the network stack +#endif + (sc->funs->eth_drv->recv)(sc, len); + } else { + // Not OK for one reason or another... +#if DEBUG & 1 + db_printf("RxEvent - No RX bit: stat: 0x%08x, len: 0x%04x\n", + rstat, len); +#endif + } + + // Free packet (clear all status flags, and set RACT) + _SU32(rxd, ETHERC_RD_STAT) &= ETHERC_RD_STAT_CLEAR; + _SU32(rxd, ETHERC_RD_STAT) |= ETHERC_RD_STAT_RACT; + } + + // Ack RX interrupt set + put_reg(cpd, _REG_EESR, CYGARC_REG_EESR_FR); + // ensure Receive Request is enabled + put_reg(cpd, _REG_EDRRR, CYGARC_REG_EDRRR_RR); +#if DEBUG & 1 + ints = get_reg(cpd, _REG_EESR); + db_printf("RxEvent exit - ESSR: 0x%08x\n", ints); +#endif +} + +// +// This function is called as a result of the "eth_drv_recv()" call above. +// Its job is to actually fetch data for a packet from the hardware once +// memory buffers have been allocated for the packet. Note that the buffers +// may come in pieces, using a scatter-gather list. This allows for more +// efficient processing in the upper layers of the stack. +// +static void +etherc_recv(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len) +{ + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + int i, mlen=0, plen; + cyg_uint8 *data, *rxd, *buf; + + DEBUG_FUNCTION(); + + rxd = cpd->rx_ring + cpd->rxpacket*ETHERC_TD_SIZE; + buf = cpd->rx_buffers + cpd->rxpacket*_BUF_SIZE; + + INCR_STAT( rx_deliver ); + + plen = _SU16(rxd, ETHERC_RD_RDL); + + for (i = 0; i < sg_len; i++) { + data = (cyg_uint8*)sg_list[i].buf; + mlen = sg_list[i].len; + +#if DEBUG & 1 + db_printf("%s : mlen %04x, plen %04x\n", __FUNCTION__, mlen, plen); +#endif + if (data) { + while (mlen > 0) { + *data++ = *buf++; + mlen--; + plen--; + } + } + } +} + +static void +etherc_poll(struct eth_drv_sc *sc) +{ + cyg_uint32 event; + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + +// DEBUG_FUNCTION(); + + while (1) { + // Get the (unmasked) requests + event = get_reg(cpd, _REG_EESR); + if (0 == event) + break; + + if (event & CYGARC_REG_EESR_FR) { + etherc_RxEvent(sc); + } + else if (event & CYGARC_REG_EESR_TC) { + etherc_TxEvent(sc, event); + } + else if (event & CYGARC_REG_EESR_RDE) { +#if DEBUG & 1 + int i; + cyg_uint32 rstat; + cyg_uint16 mlen, blen; + cyg_uint8* rxd; + struct etherc_priv_data *cpd = + (struct etherc_priv_data *)sc->driver_private; + + db_printf("%s: Ran out of RX buffers (%04x)\n", __FUNCTION__, event); + for (i = 0; i < cpd->rx_ring_cnt; i++) { + rxd = cpd->rx_ring + i*ETHERC_RD_SIZE; + + rstat = _SU32(rxd, ETHERC_RD_STAT); + blen = _SU16(rxd, ETHERC_RD_RBL); + mlen = _SU16(rxd, ETHERC_RD_RDL); + db_printf(" %02d: 0x%08x:0x%04x:0x%04x\n", i, rstat, blen, mlen); + } +#endif + // Just clear the flag - RF is handled earlier in the loop + // so a new RX block should be ready when this code + // executes. + put_reg(cpd, _REG_EESR, CYGARC_REG_EESR_RDE); + } + else { +#if DEBUG & 1 + db_printf("%s: Unknown interrupt: 0x%04x\n", __FUNCTION__, event); +#endif + put_reg(cpd, _REG_EESR, event); + } + } + + // Make sure RX is enabled + if (cpd->active) { + cyg_uint32 reg; + reg = get_reg(cpd, _REG_ECMR); + reg |= CYGARC_REG_ECMR_RE; + put_reg(cpd, _REG_ECMR, reg); + } +} + +//---------------------------------------------------------------------------- +// MII accessors + +#define _MII_WRITE_BIT(_cpd_, _b_) \ + CYG_MACRO_START \ + cyg_uint32 _d_ = (_b_) ? CYGARC_REG_PIR_MDO : 0; \ + HAL_WRITE_UINT32(_cpd_->base+_REG_PIR, CYGARC_REG_PIR_MMD_WRITE | _d_); \ + HAL_WRITE_UINT32(_cpd_->base+_REG_PIR, CYGARC_REG_PIR_MMD_WRITE | _d_ | CYGARC_REG_PIR_MDC); \ + HAL_WRITE_UINT32(_cpd_->base+_REG_PIR, CYGARC_REG_PIR_MMD_WRITE | _d_); \ + CYG_MACRO_END + +#define _MII_READ_BIT(_cpd_, _b_) \ + CYG_MACRO_START \ + cyg_uint32 _d_; \ + HAL_WRITE_UINT32(_cpd_->base+_REG_PIR, CYGARC_REG_PIR_MMD_READ | CYGARC_REG_PIR_MDC); \ + HAL_READ_UINT32(_cpd_->base+_REG_PIR, _d_); \ + HAL_WRITE_UINT32(_cpd_->base+_REG_PIR, CYGARC_REG_PIR_MMD_READ); \ + (_b_) = (_d_ & CYGARC_REG_PIR_MDI) ? 1 : 0; \ + CYG_MACRO_END + +#define _MII_RELEASE(_cpd_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT32(_cpd_->base+_REG_PIR, CYGARC_REG_PIR_MMD_READ); \ + HAL_WRITE_UINT32(_cpd_->base+_REG_PIR, CYGARC_REG_PIR_MMD_READ | CYGARC_REG_PIR_MDC); \ + HAL_WRITE_UINT32(_cpd_->base+_REG_PIR, CYGARC_REG_PIR_MMD_READ); \ + CYG_MACRO_END + +#define _MII_RELEASE_INDEP(_cpd_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT32(_cpd_->base+_REG_PIR, CYGARC_REG_PIR_MMD_READ); \ + CYG_MACRO_END + + +static void +etherc_write_MII(struct etherc_priv_data *cpd, int id, int reg, cyg_uint16 value) +{ + int i; + + // Pre + for(i = 0; i < 32; i++) + _MII_WRITE_BIT(cpd, 1); + // Start of frame + _MII_WRITE_BIT(cpd, 0); + _MII_WRITE_BIT(cpd, 1); + // Operation (write) + _MII_WRITE_BIT(cpd, 0); + _MII_WRITE_BIT(cpd, 1); + // Phy address + for (i = 4; i >= 0; i--) + _MII_WRITE_BIT(cpd, (id & (1<= 0; i--) + _MII_WRITE_BIT(cpd, (reg & (1<= 0; i--) + _MII_WRITE_BIT(cpd, (value & (1<= 0; i--) + _MII_WRITE_BIT(cpd, (id & (1<= 0; i--) + _MII_WRITE_BIT(cpd, (reg & (1<= 0; i--) { + _MII_READ_BIT(cpd, b); + val = val << 1; + if (b) val |= 1; + } + + return val; +} + +// EOF if_etherc.c diff --git a/packages/devs/eth/sh/etherc/current/src/phyter.inl b/packages/devs/eth/sh/etherc/current/src/phyter.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/etherc/current/src/phyter.inl @@ -0,0 +1,186 @@ +#ifndef CYGONCE_DEVS_ETH_PHYTER_PHYTER_INL +#define CYGONCE_DEVS_ETH_PHYTER_PHYTER_INL +//========================================================================== +// +// phyther.inl +// +// Generic Phyter definitions and helpers +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-02-19 +// Purpose: phy/MII definitions +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Caller must define _MII_WRITE and _MII_READ macros +#ifndef _MII_WRITE +# error "_MII_WRITE(_priv_, _id_, _reg_, _val_) and _MII_READ(_priv_, _id_, _reg_) must be defined" +#endif + +// Caller can define _MII_HAS_EXTENDED to add support for extended registers + +//----------------------------------------------------------------------------- +// Helpers + +// Renegotiate link +// This function will delay for up to 2 seconds waiting for a renegotiation +// of the link. +#define _MII_RENEGOTIATE(_priv_, _id_) \ + CYG_MACRO_START \ + _MII_WRITE(_priv_, _id_, CYGARC_REG_MII_BMCR, CYGARC_REG_MII_BMCR_RENEGOTIATE); \ + _MII_RENEGOTIATION_WAIT(_priv_, _id_); \ + CYG_MACRO_END + +// Wait for renegotiation to complete +// This function will delay for up to 2 seconds waiting for a renegotiation +// of the link. +#define _MII_RENEGOTIATION_WAIT(_priv_, _id_) \ + CYG_MACRO_START \ + int _i; \ + cyg_uint16 _r; \ + for (_i = 0; _i < 2000; _i++) { \ + HAL_DELAY_US(1000); \ + _r = _MII_READ(_priv_, _id_, CYGARC_REG_MII_BMSR); \ + if (_r & CYGARC_REG_MII_BMSR_AN_COMPLETE) break; \ + } \ + CYG_MACRO_END + +// Link state query +#define _MII_LINK_STATE(_priv_, _id_) \ + ({ int _i; \ + if (_MII_READ(_priv_, _id_, CYGARC_REG_MII_BMSR) & CYGARC_REG_MII_BMSR_LINK) \ + (_i) = 1; \ + else \ + (_i) = 0; \ + _i; }) + +// Clear 100MB capability advertisement bits +// Caller has to start a new renegoatiation +#define _MII_SPEED_FORCE_10MB(_priv_, _id_) \ + CYG_MACRO_START \ + cyg_uint16 _d; \ + _d = _MII_READ(_priv_, _id_, CYGARC_REG_MII_ANAR); \ + _d &= ~(CYGARC_REG_MII_ANAR_T4|CYGARC_REG_MII_ANAR_TX_FD|CYGARC_REG_MII_ANAR_TX); \ + _MII_WRITE(_priv_, _id_, CYGARC_REG_MII_ANAR, _d); \ + CYG_MACRO_END + +#ifdef _MII_HAS_EXTENDED + +// Speed state query +// 0 = 10Mb, 1 = 100Mb +#define _MII_SPEED_STATE(_priv_, _id_) \ + ({ int _i; \ + if (_MII_READ(_priv_, _id_, CYGARC_REG_MII_PHYSTS) & CYGARC_REG_MII_PHYSTS_SPEED) \ + (_i) = 0; \ + else \ + (_i) = 1; \ + _i; }) + +// Duplex state query +// 0 = simplex, 1 = duplex +#define _MII_DUPLEX_STATE(_priv_, _id_) \ + ({ int _i; \ + if (_MII_READ(_priv_, _id_, CYGARC_REG_MII_PHYSTS) & CYGARC_REG_MII_PHYSTS_DUPLEX) \ + (_i) = 1; \ + else \ + (_i) = 0; \ + _i; }) + +#endif // _MII_HAS_EXTENDED + +// Dump registers +// Useful for debugging +#define _MII_DUMP_REGS(_priv_, _id_) \ + CYG_MACRO_START \ + int _i; \ + diag_printf("PHY registers:\n"); \ + for(_i = 0; _i <= CYGARC_REG_MII_LAST; _i++) \ + diag_printf(" %02d %04x\n", _i, _MII_READ(_priv_, _id_, _i)); \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- +// Phyter Registers + +// Generic +#define CYGARC_REG_MII_BMCR 0x00 +#define CYGARC_REG_MII_BMSR 0x01 +#define CYGARC_REG_MII_PHYIDR1 0x02 +#define CYGARC_REG_MII_PHYIDR2 0x03 +#define CYGARC_REG_MII_ANAR 0x04 +#define CYGARC_REG_MII_ANLPAR 0x05 +#define CYGARC_REG_MII_ANER 0x06 +#define CYGARC_REG_MII_ANNPTR 0x07 + +#define CYGARC_REG_MII_BMCR_RESET 0x8000 +#define CYGARC_REG_MII_BMCR_LOOPBACK 0x4000 +#define CYGARC_REG_MII_BMCR_RENEGOTIATE 0x3300 + +#define CYGARC_REG_MII_BMSR_AN_COMPLETE 0x0020 +#define CYGARC_REG_MII_BMSR_LINK 0x0004 + +#define CYGARC_REG_MII_ANAR_T4 0x0200 +#define CYGARC_REG_MII_ANAR_TX_FD 0x0100 +#define CYGARC_REG_MII_ANAR_TX 0x0080 +#define CYGARC_REG_MII_ANAR_10_FD 0x0040 +#define CYGARC_REG_MII_ANAR_10 0x0020 + +// Extended registers +#ifndef _MII_HAS_EXTENDED +# define CYGARC_REG_MII_LAST 0x0f +#else +# define CYGARC_REG_MII_PHYSTS 0x10 +# define CYGARC_REG_MII_FCSCR 0x14 +# define CYGARC_REG_MII_RECR 0x15 +# define CYGARC_REG_MII_PCSR 0x16 +# define CYGARC_REG_MII_PHYCTRL 0x19 +# define CYGARC_REG_MII_10BTSCR 0x1a +# define CYGARC_REG_MII_CDCTRL 0x1b +# define CYGARC_REG_MII_LAST 0x1f + + +# define CYGARC_REG_MII_PHYSTS_SPEED 0x00000002 +# define CYGARC_REG_MII_PHYSTS_DUPLEX 0x00000004 + +#endif + +#endif // CYGONCE_DEVS_ETH_PHYTER_PHYTER_INL diff --git a/packages/devs/eth/sh/etherc/current/src/sh_etherc.h b/packages/devs/eth/sh/etherc/current/src/sh_etherc.h new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/etherc/current/src/sh_etherc.h @@ -0,0 +1,344 @@ +#ifndef CYGONCE_DEVS_ETH_SH_ETHERC_H +#define CYGONCE_DEVS_ETH_SH_ETHERC_H +//========================================================================== +// +// sh_etherc.h +// +// SH EtherC Ethernet CPU module controller +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-30 +// Purpose: Hardware description of SH EtherC controller. +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +//------------------------------------------------------------------------ +// Get macros from platform header +#define __WANT_CONFIG +#include CYGDAT_DEVS_ETH_SH_ETHERC_INL +#undef __WANT_CONFIG + +//------------------------------------------------------------------------ +// Set to perms of: +// 0 disables all debug output +// 1 for process debug output +// 2 for added data IO output: get_reg, put_reg +// 4 for packet allocation/free output +// 8 for only startup status, so we can tell we're installed OK +#define DEBUG 0x0 + +#if DEBUG & 1 +#define DEBUG_FUNCTION() do { db_printf("%s\n", __FUNCTION__); } while (0) +#else +#define DEBUG_FUNCTION() do {} while(0) +#endif + +// ------------------------------------------------------------------------ +// Debug print function +#if defined(CYGPKG_REDBOOT) && DEBUG + +static void db_printf( char *fmt, ... ) +{ + extern int start_console(void); + extern void end_console(int); + va_list a; + int old_console; + va_start( a, fmt ); + old_console = start_console(); + diag_vprintf( fmt, a ); + end_console(old_console); + va_end( a ); +} + +#else + +#define db_printf diag_printf + +#endif + +// ------------------------------------------------------------------------ +// Macros for keeping track of statistics +#if defined(ETH_DRV_GET_IF_STATS) || defined (ETH_DRV_GET_IF_STATS_UD) +# define KEEP_STATISTICS +#endif + +#ifdef KEEP_STATISTICS +# define INCR_STAT( _x_ ) (cpd->stats. _x_ ++) +#else +# define INCR_STAT( _x_ ) CYG_EMPTY_STATEMENT +#endif + +//------------------------------------------------------------------------ +// Cache translation +#ifndef CYGARC_UNCACHED_ADDRESS +# define CYGARC_UNCACHED_ADDRESS(x) (x) +#endif + +// ------------------------------------------------------------------------ +// Macros for accessing structure elements + +#define _SU8( _base_, _offset_) \ + *((cyg_uint8 *)((CYG_ADDRWORD)_base_+(_offset_))) +#define _SU16( _base_, _offset_) \ + *((cyg_uint16 *)((CYG_ADDRWORD)_base_+(_offset_))) +#define _SU32( _base_, _offset_) \ + *((cyg_uint32 *)((CYG_ADDRWORD)_base_+(_offset_))) + +#define _SI8( _base_, _offset_) \ + *((cyg_int8 *)((CYG_ADDRWORD)_base_+(_offset_))) +#define _SI16( _base_, _offset_) \ + *((cyg_int16 *)((CYG_ADDRWORD)_base_+(_offset_))) +#define _SI32( _base_, _offset_) \ + *((cyg_int32 *)((CYG_ADDRWORD)_base_+(_offset_))) + +// ------------------------------------------------------------------------ +// Controller registers in offset form +#define _REG_EDMR 0x00 +#define _REG_EDTRR 0x04 +#define _REG_EDRRR 0x08 +#define _REG_TDLAR 0x0c +#define _REG_RDLAR 0x10 +#define _REG_EESR 0x14 +#define _REG_EESIPR 0x18 +#define _REG_TRSCER 0x1c +#define _REG_RMFCR 0x20 +#define _REG_TFTR 0x24 +#define _REG_FDR 0x28 +#define _REG_RCR 0x2c +#define _REG_EDOCR 0x30 +#define _REG_RBWAR 0x40 +#define _REG_RDFAR 0x44 +#define _REG_TBRAR 0x4c +#define _REG_TDFAR 0x50 + +#define _REG_ECMR 0x60 +#define _REG_ECSR 0x64 +#define _REG_ECSIPR 0x68 +#define _REG_PIR 0x6c +#define _REG_MAHR 0x70 +#define _REG_MALR 0x74 +#define _REG_RFLR 0x78 +#define _REG_PSR 0x7c +#define _REG_TROCR 0x80 +#define _REG_CDCR 0x84 +#define _REG_LCCR 0x88 +#define _REG_CNDCR 0x8c +#define _REG_IFLCR 0x90 +#define _REG_CECFR 0x94 +#define _REG_FRECR 0x98 +#define _REG_TSFRCR 0x9c +#define _REG_TLFRCR 0xa0 +#define _REG_RFCR 0xa4 +#define _REG_MAFCR 0xa8 + +//---------------------------------------------------------------------------- +// Receive buffer Descriptor +#define ETHERC_RD_STAT 0x00 // 32 bit +#define ETHERC_RD_RBL 0x04 // 16 bit - receive buffer length +#define ETHERC_RD_RDL 0x06 // 16 bit - receive data length (-CRC) +#define ETHERC_RD_RBA 0x08 // 32 bit - receive buffer address +#define ETHERC_RD_PAD 0x0c // 32 bit +#define ETHERC_RD_SIZE 0x10 + +#define ETHERC_RD_STAT_RACT 0x80000000 +#define ETHERC_RD_STAT_RDLE 0x40000000 +#define ETHERC_RD_STAT_RFP_OTO 0x30000000 // one buffer to one frame +#define ETHERC_RD_STAT_RFE 0x08000000 +#define ETHERC_RD_STAT_RFOF 0x00000200 +#define ETHERC_RD_STAT_RMAF 0x00000080 +#define ETHERC_RD_STAT_RRF 0x00000010 +#define ETHERC_RD_STAT_RTLF 0x00000008 +#define ETHERC_RD_STAT_RTSF 0x00000004 +#define ETHERC_RD_STAT_PRE 0x00000002 +#define ETHERC_RD_STAT_CERF 0x00000001 + +#define ETHERC_RD_STAT_CLEAR 0x70000000 + +// Transmit buffer Descriptor +#define ETHERC_TD_STAT 0x00 // 32 bit +#define ETHERC_TD_TDL 0x04 // 16 bit - transmit data length +#define ETHERC_TD_PAD0 0x06 // 16 bit +#define ETHERC_TD_TBA 0x08 // 32 bit - transmit buffer address +#define ETHERC_TD_PAD1 0x0c // 32 bit +#define ETHERC_TD_SIZE 0x10 + +#define ETHERC_TD_STAT_TACT 0x80000000 +#define ETHERC_TD_STAT_TDLE 0x40000000 +#define ETHERC_TD_STAT_TFP_OTO 0x30000000 // one buffer to one frame +#define ETHERC_TD_STAT_TDFE 0x08000000 +#define ETHERC_TD_STAT_ITF 0x00000010 +#define ETHERC_TD_STAT_CND 0x00000008 +#define ETHERC_TD_STAT_DLC 0x00000004 +#define ETHERC_TD_STAT_CD 0x00000002 +#define ETHERC_TD_STAT_TRO 0x00000001 + + +// Initialization Buffer +#define ETHERC_IB_MODE 0 +#define ETHERC_IB_PADR0 2 +#define ETHERC_IB_PADR1 4 +#define ETHERC_IB_PADR2 6 +#define ETHERC_IB_LADRF0 8 +#define ETHERC_IB_LADRF1 10 +#define ETHERC_IB_LADRF2 12 +#define ETHERC_IB_LADRF3 14 +#define ETHERC_IB_RDRA 16 +#define ETHERC_IB_TDRA 20 +#define ETHERC_IB_SIZE 24 + +#define ETHERC_IB_TDRA_CNT_shift 29 +#define ETHERC_IB_TDRA_PTR_mask 0x00ffffff +#define ETHERC_IB_RDRA_CNT_shift 29 +#define ETHERC_IB_RDRA_PTR_mask 0x00ffffff + +// ------------------------------------------------------------------------ + +#ifdef KEEP_STATISTICS +struct sh_etherc_stats { + unsigned int tx_good ; + unsigned int tx_max_collisions ; + unsigned int tx_late_collisions ; + unsigned int tx_underrun ; + unsigned int tx_carrier_loss ; + unsigned int tx_deferred ; + unsigned int tx_sqetesterrors ; + unsigned int tx_single_collisions; + unsigned int tx_mult_collisions ; + unsigned int tx_total_collisions ; + unsigned int rx_good ; + unsigned int rx_crc_errors ; + unsigned int rx_align_errors ; + unsigned int rx_resource_errors ; + unsigned int rx_overrun_errors ; + unsigned int rx_collisions ; + unsigned int rx_short_frames ; + unsigned int rx_too_long_frames ; + unsigned int rx_symbol_errors ; + unsigned int interrupts ; + unsigned int rx_count ; + unsigned int rx_deliver ; + unsigned int rx_resource ; + unsigned int rx_restart ; + unsigned int tx_count ; + unsigned int tx_complete ; + unsigned int tx_dropped ; +}; +#endif + +struct etherc_priv_data; +typedef cyg_bool (*provide_esa_t)(struct etherc_priv_data* cpd); + +typedef struct etherc_priv_data { + int index; + cyg_uint8 // (split up for atomic byte access) + mac_addr_ok:1, // can we bring up? + active:1, // has this if been brung up? + hardwired_esa:1, // set if ESA is hardwired via CDL + txbusy:1, // A packet has been sent + spare1:3; + + unsigned long txkey; // Used to ack when packet sent + unsigned char* base; // Base address of controller EPROM region + int interrupt; // Interrupt vector used by controller + unsigned char esa[6]; // Controller ESA + // Function to configure the ESA - may fetch ESA from EPROM or + // RedBoot config option. + void (*config_esa)(struct etherc_priv_data* cpd); + void *ndp; // Network Device Pointer + provide_esa_t provide_esa; + + cyg_handle_t interrupt_handle; + cyg_interrupt interrupt_object; + int devid; + + cyg_uint8* rx_buffers; // ptr to base of buffer mem + cyg_uint8* rx_ring; // ptr to base of rx ring memory + int rx_ring_cnt; // number of entries in ring + int rx_ring_next; // index of next full ring entry + + cyg_uint8* tx_buffers; + cyg_uint8* tx_ring; + int tx_ring_cnt; + int tx_ring_free; // index of next free ring entry + int tx_ring_alloc; // index of first controller owned ring + int tx_ring_owned; // number of controller owned ring entries + + int rxpacket; +#ifdef KEEP_STATISTICS + struct sh_etherc_stats stats; +#endif +#if DEBUG & 1 + cyg_uint32 txd; +#endif +} etherc_priv_data; + +// ------------------------------------------------------------------------ + +static __inline__ cyg_uint32 +get_reg(struct etherc_priv_data *cpd, int regno) +{ + cyg_int32 val; + + HAL_READ_UINT32(cpd->base+regno, val); + +#if DEBUG & 2 + db_printf("read reg %d val 0x%08x\n", regno, val); +#endif + return val; +} + +static __inline__ void +put_reg(struct etherc_priv_data *cpd, int regno, cyg_uint32 val) +{ + HAL_WRITE_UINT32(cpd->base+regno, val); + +#if DEBUG & 2 + db_printf("write reg %d val 0x%08x\n", regno, val); +#endif +} + +// ------------------------------------------------------------------------ +#endif // CYGONCE_DEVS_ETH_SH_ETHERC_H +// EOF sh_etherc.h diff --git a/packages/devs/eth/sh/hs7729pci/current/ChangeLog b/packages/devs/eth/sh/hs7729pci/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/hs7729pci/current/ChangeLog @@ -0,0 +1,58 @@ +2001-06-27 Jesper Skov + + * cdl/sh_hs7729pci_eth_drivers.cdl: Implements net drivers. + + * include/devs_eth_sh_hs7729pci.inl: Use uncached addresses for + shared mem. Removed fix me. + +2001-06-26 Jesper Skov + + * include/devs_eth_sh_hs7729pci.inl: Leave PCI definitions to + platform HAL. + +2001-06-25 Jesper Skov + + * include/devs_eth_sh_hs7729pci.inl: Split in config and driver + parts, fix some buglets. + +2001-05-31 Jesper Skov + + * cdl/sh_hs7729pci_eth_drivers.cdl: Platform specific + information required to use the generic VIA Rhine driver for the + HS7729PCI platform. + * include/devs_eth_sh_hs7729pci.inl: Same. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/sh/hs7729pci/current/cdl/sh_hs7729pci_eth_drivers.cdl b/packages/devs/eth/sh/hs7729pci/current/cdl/sh_hs7729pci_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/hs7729pci/current/cdl/sh_hs7729pci_eth_drivers.cdl @@ -0,0 +1,130 @@ +# ==================================================================== +# +# sh_hs7729pci_eth_drivers.cdl +# +# Ethernet drivers - support for VIA Rhine ethernet controller +# on the Hitachi HS7729PCI board. +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: jskov +# Date: 2001-05-31 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_SH_HS7729PCI { + display "SH HS7729PCI board ethernet driver" + description "Ethernet driver for SH HS7729PCI board." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_SH_SH7729_HS7729PCI + + include_dir cyg/io + + # FIXME: This really belongs in the VIA_RHINE package + cdl_interface CYGINT_DEVS_ETH_VIA_RHINE_REQUIRED { + display "VIA Rhine ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_VIA_RHINE_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_VIA_RHINE_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_SH_HS7729PCI_ETH0 { + display "HS7729PCI ethernet port 0 driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + HS7729PCI port 0." + + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_VIA_RHINE_REQUIRED + + cdl_option CYGNUM_DEVS_ETH_SH_HS7729PCI_ETH0_RX_RING_SIZE { + display "Size of RX ring for ETH0" + flavor data + default_value 4 + legal_values { 4 8 16 32 64 128 } + description " + This option sets the size of the RX ring." + } + + cdl_option CYGNUM_DEVS_ETH_SH_HS7729PCI_ETH0_TX_RING_SIZE { + display "Size of TX ring for ETH0" + flavor data + default_value 16 + legal_values { 4 8 16 32 64 128 } + description " + This option sets the size of the TX ring." + } + + cdl_option CYGDAT_DEVS_ETH_SH_HS7729PCI_ETH0_NAME { + display "Device name for the ETH0 ethernet port 0 driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + HS7729PCI port 0." + } + + cdl_component CYGSEM_DEVS_ETH_SH_HS7729PCI_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + calculated 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_SH_HS7729PCI_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } +} diff --git a/packages/devs/eth/sh/hs7729pci/current/include/devs_eth_sh_hs7729pci.inl b/packages/devs/eth/sh/hs7729pci/current/include/devs_eth_sh_hs7729pci.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/hs7729pci/current/include/devs_eth_sh_hs7729pci.inl @@ -0,0 +1,100 @@ +//========================================================================== +// +// devs_eth_sh_hs7729pci.inl +// +// HS7729PCI ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-05-31 +// Purpose: HS7729PCI ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR + +#ifdef __WANT_CONFIG + +#define CYGHWR_VIA_RHINE_PCI_MEM_MAP_BASE (CYGARC_UNCACHED_ADDRESS(&CYGMEM_SECTION_pci_window[0])) +#define CYGHWR_VIA_RHINE_PCI_MEM_MAP_SIZE (CYGMEM_SECTION_pci_window_SIZE) + +#endif // __WANT_CONFIG + + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_SH_HS7729PCI_ETH0 + +static rhine_priv_data via_rhine_eth0_priv_data = { +#ifdef CYGSEM_DEVS_ETH_SH_HS7729PCI_ETH0_SET_ESA + enaddr : CYGDAT_DEVS_ETH_SH_HS7729PCI_ETH0_ESA, +#endif + config_esa : NULL, // rely on the hardwired address for now + rx_ring : NULL, + rx_ring_cnt : (1<<2) /*CYGNUM_DEVS_ETH_SH_HS7729PCI_ETH0_RX_RING_SIZE*/, + rx_ring_log_cnt : 2, + tx_ring : NULL, + tx_ring_cnt : (1<<2) /*CYGNUM_DEVS_ETH_SH_HS7729PCI_ETH0_TX_RING_SIZE*/, + tx_ring_log_cnt : 2, +}; + +static rhine_priv_data *rhine_priv_array[1] = {&via_rhine_eth0_priv_data}; + +ETH_DRV_SC(via_rhine_sc, + &via_rhine_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_SH_HS7729PCI_ETH0_NAME, + rhine_start, + rhine_stop, + rhine_control, + rhine_can_send, + rhine_send, + rhine_recv, + rhine_deliver, // "pseudoDSR" called from fast net thread + rhine_poll, // poll function, encapsulates ISR and DSR + rhine_int_vector); + +NETDEVTAB_ENTRY(rhine_netdev, + "rhine_" CYGDAT_DEVS_ETH_SH_HS7729PCI_ETH0_NAME, + via_rhine_init, + &via_rhine_sc); +#endif // CYGPKG_DEVS_ETH_SH_HS7729PCI_ETH0 + +#endif // __WANT_DEVS + +// EOF devs_eth_sh_hs7729pci.inl diff --git a/packages/devs/eth/sh/se7751/current/ChangeLog b/packages/devs/eth/sh/se7751/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/se7751/current/ChangeLog @@ -0,0 +1,50 @@ +2002-02-18 Jesper Skov + + * cdl/sh_se7751_eth_drivers.cdl: Fix typos. + +2001-07-12 Jesper Skov + + * include/devs_eth_sh_se7751.inl: Driver finds the controller data + via PCI library. + +2001-07-10 Jesper Skov + + * cdl/sh_se7751_eth_drivers.cdl: Platform specific + information required to use the generic AMD PCNet driver for the + SE7751 platform. + * include/devs_eth_sh_se7751.inl: Same. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/sh/se7751/current/cdl/sh_se7751_eth_drivers.cdl b/packages/devs/eth/sh/se7751/current/cdl/sh_se7751_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/se7751/current/cdl/sh_se7751_eth_drivers.cdl @@ -0,0 +1,130 @@ +# ==================================================================== +# +# se7751_eth_drivers.cdl +# +# Ethernet drivers - support for AMD PCnet ethernet controller +# on the Hitachi SE7751 board. +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: jskov +# Date: 2001-04-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_SH_SE7751 { + display "Hitachi SE7751 board ethernet driver" + description "Ethernet driver for Hitachi SE7751 board." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_SH_SH7751_SE7751 + + include_dir cyg/io + + # FIXME: This really belongs in the AMD_PCNET package + cdl_interface CYGINT_DEVS_ETH_AMD_PCNET_REQUIRED { + display "AMD PCNET ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_AMD_PCNET_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_AMD_PCNET_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_SH_SE7751_ETH0 { + display "SE7751 ethernet port 0 driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + SE7751 port 0." + + implements CYGHWR_NET_DRIVERS + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_AMD_PCNET_REQUIRED + + cdl_option CYGNUM_DEVS_ETH_SH_SE7751_ETH0_RX_RING_SIZE { + display "Size of RX ring for ETH0" + flavor data + default_value 4 + legal_values { 4 8 16 32 64 128 } + description " + This option sets the size of the RX ring." + } + + cdl_option CYGNUM_DEVS_ETH_SH_SE7751_ETH0_TX_RING_SIZE { + display "Size of TX ring for ETH0" + flavor data + default_value 16 + legal_values { 4 8 16 32 64 128 } + description " + This option sets the size of the TX ring." + } + + cdl_option CYGDAT_DEVS_ETH_SH_SE7751_ETH0_NAME { + display "Device name for the ETH0 ethernet port 0 driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device for the + SE7751 port 0." + } + + cdl_component CYGSEM_DEVS_ETH_SH_SE7751_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + calculated 1 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_SH_SE7751_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } +} diff --git a/packages/devs/eth/sh/se7751/current/include/devs_eth_sh_se7751.inl b/packages/devs/eth/sh/se7751/current/include/devs_eth_sh_se7751.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/se7751/current/include/devs_eth_sh_se7751.inl @@ -0,0 +1,110 @@ +//========================================================================== +// +// devs/eth/sh/se7751/include/devs_eth_sh_se7751.inl +// +// SE7751 ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-07-10 +// Purpose: SE7751 ethernet defintions +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR + +#ifdef __WANT_CONFIG + +#define CYGHWR_AMD_PCNET_PCI_MEM_MAP_BASE (CYGARC_UNCACHED_ADDRESS(&CYGMEM_SECTION_pci_window[0])) +#define CYGHWR_AMD_PCNET_PCI_MEM_MAP_SIZE ((cyg_uint32)(CYGMEM_SECTION_pci_window_SIZE)) + +#endif // __WANT_CONFIG + + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_SH_SE7751_ETH0 + +// FIXME: find locations via PCI +static pcnet_priv_data amd_pcnet_eth0_priv_data = { +#ifdef CYGSEM_DEVS_ETH_SH_SE7751_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_SH_SE7751_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +#endif + config_esa : NULL, // rely on the hardwired address for now + rx_ring : NULL, + rx_ring_cnt : (1<<2) /*CYGNUM_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_RX_RING_SIZE*/, + rx_ring_log_cnt : 2, + tx_ring : NULL, + tx_ring_cnt : (1<<2) /*CYGNUM_DEVS_ETH_MIPS_MIPS32_MALTA_ETH0_TX_RING_SIZE*/, + tx_ring_log_cnt : 2, +}; + +ETH_DRV_SC(amd_pcnet_sc, + &amd_pcnet_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_SH_SE7751_ETH0_NAME, + pcnet_start, + pcnet_stop, + pcnet_control, + pcnet_can_send, + pcnet_send, + pcnet_recv, + pcnet_deliver, // "pseudoDSR" called from fast net thread + pcnet_poll, // poll function, encapsulates ISR and DSR + pcnet_int_vector); + +NETDEVTAB_ENTRY(pcnet_netdev, + "pcnet_" CYGDAT_DEVS_ETH_SH_SE7751_ETH0_NAME, + amd_pcnet_init, + &amd_pcnet_sc); +#endif // CYGPKG_DEVS_ETH_SH_SE7751_ETH0 + +// These arrays are used for sanity checking of pointers +struct pcnet_priv_data * +pcnet_priv_array[CYGNUM_DEVS_ETH_AMD_PCNET_DEV_COUNT] = { +#ifdef CYGPKG_DEVS_ETH_SH_SE7751_ETH0 + &amd_pcnet_eth0_priv_data, +#endif +}; + +#endif // __WANT_DEVS + +// EOF devs_eth_sh_se7751.inl diff --git a/packages/devs/eth/sh/se77x9/current/ChangeLog b/packages/devs/eth/sh/se77x9/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/se77x9/current/ChangeLog @@ -0,0 +1,76 @@ +2001-10-16 Jesper Skov + + * include/devs_eth_sh_se77x9.inl: Added buffer parameters. + +2001-10-10 Gary Thomas + + * include/devs_eth_sh_se77x9.inl (CYGHWR_NS_DP83902A_PLF_RESET): + Change in calling convention - now uses soft "reset" address from + device specific data. + +2001-07-12 Jesper Skov + + * include/devs_eth_sh_se77x9.inl: Fix typo. + +2001-06-16 Jesper Skov + + * include/devs_eth_sh_se77x9.inl: Use proper interrupt vector name. + +2001-06-15 Jesper Skov + + * include/devs_eth_sh_se77x9.inl: Split in devs/config parts. Use + proper delay in reset code. + Removed unused delays. Tell driver DMA HW is broken (I suspect the + FPGA - and yes, this took a very long time indeed to track down!). + + * cdl/sh_se77x9_eth_drivers.cdl: Removed ring size options. Force + use of ESA until I figure out how to read the EPROM. + +2001-06-14 Jesper Skov + + * cdl/sh_se77x9_eth_drivers.cdl: Made _SET_ESA option configurable. + + * include/devs_eth_sh_se77x9.inl: Added DATA I/O macros since the + platform needs to be treated like it was BE when accessing the + external devices. + +2001-06-13 Jesper Skov + + * include/devs_eth_sh_se77x9.inl: Remove debug hack. + + * Created. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/sh/se77x9/current/cdl/sh_se77x9_eth_drivers.cdl b/packages/devs/eth/sh/se77x9/current/cdl/sh_se77x9_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/se77x9/current/cdl/sh_se77x9_eth_drivers.cdl @@ -0,0 +1,109 @@ +# ==================================================================== +# +# sh_se77x9_eth_drivers.cdl +# +# Ethernet drivers - support for NS DP83902A ethernet controller +# on the Hitachi SE77X9 board. +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: jskov +# Date: 2001-06-13 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_SH_SE77X9 { + display "SH SE77X9 board ethernet driver" + description "Ethernet driver for SH SE77X9 board." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_SH_SH77X9_SE77X9 + + include_dir cyg/io + + # FIXME: This really belongs in the NS DP83902A package + cdl_interface CYGINT_DEVS_ETH_NS_DP83902A_REQUIRED { + display "NS DP83902A ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_NS_DP83902A_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_NS_DP83902A_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_SH_SE77X9_ETH0 { + display "SE77X9 ethernet port driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + SE77X9 port." + + implements CYGINT_DEVS_ETH_NS_DP83902A_REQUIRED + + cdl_option CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_NAME { + display "Device name for the ETH0 ethernet driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device." + } + + cdl_component CYGSEM_DEVS_ETH_SH_SE77X9_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + calculated 1 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } +} diff --git a/packages/devs/eth/sh/se77x9/current/include/devs_eth_sh_se77x9.inl b/packages/devs/eth/sh/se77x9/current/include/devs_eth_sh_se77x9.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/se77x9/current/include/devs_eth_sh_se77x9.inl @@ -0,0 +1,143 @@ +//========================================================================== +// +// devs_eth_sh_se77x9.inl +// +// SE77X9 ethernet I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-13 +// Purpose: SE77X9 ethernet defintions +// +// FIXME: M17 contains an EPROM. May contain the ESA, but don't +// know how to access it. +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR +#include + +#ifdef __WANT_CONFIG + + + +#define CYGHWR_NS_DP83902A_PLF_RESET(_dp_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT16(_dp_->reset, 0x0000); \ + CYGACC_CALL_IF_DELAY_US(10); \ + HAL_WRITE_UINT16(_dp_->reset, 0x0100); \ + CYG_MACRO_END + +#define DP_IN(_b_, _o_, _d_) \ + CYG_MACRO_START \ + cyg_uint16 _t; \ + HAL_READ_UINT16 ((cyg_addrword_t)(_b_)+2*(_o_), _t); \ + (_d_) = (_t >> 8) & 0xff; \ + CYG_MACRO_END + +#define DP_OUT(_b_, _o_, _d_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT16((cyg_addrword_t)(_b_)+2*(_o_), (_d_)<<8); \ + CYG_MACRO_END + +#define DP_IN_DATA(_b_, _d_) \ + CYG_MACRO_START \ + cyg_uint16 _t; \ + HAL_READ_UINT16 ((cyg_addrword_t)(_b_), _t); \ + (_d_) = ((_t >> 8) & 0xff) | ((_t & 0xff) << 8); \ + CYG_MACRO_END + +#define DP_OUT_DATA(_b_, _d_) \ + CYG_MACRO_START \ + cyg_uint16 _t; \ + _t = (_d_); \ + (_t) = (((_t) >> 8) & 0xff) | ((_t & 0xff) << 8); \ + HAL_WRITE_UINT16((cyg_addrword_t)(_b_), _t); \ + CYG_MACRO_END + +#define CYGHWR_NS_DP83902A_PLF_16BIT_DATA +#define CYGHWR_NS_DP83902A_PLF_BROKEN_TX_DMA + +#endif // __WANT_CONFIG + + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_SH_SE77X9_ETH0 + +static dp83902a_priv_data_t dp83902a_eth0_priv_data = { + base : (cyg_uint8*) 0xb0000000, + data : (cyg_uint8*) 0xb0040000, + reset: (cyg_uint8*) 0xb0080000, + interrupt: CYGNUM_HAL_INTERRUPT_LAN, + tx_buf1: 0x80, + tx_buf2: 0x88, + rx_buf_start: 0x90, + rx_buf_end: 0xff, +#ifdef CYGSEM_DEVS_ETH_SH_SE77X9_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +#endif +}; + +ETH_DRV_SC(dp83902a_sc, + &dp83902a_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_NAME, + dp83902a_start, + dp83902a_stop, + dp83902a_control, + dp83902a_can_send, + dp83902a_send, + dp83902a_recv, + dp83902a_deliver, // "pseudoDSR" called from fast net thread + dp83902a_poll, // poll function, encapsulates ISR and DSR + dp83902a_int_vector); + +NETDEVTAB_ENTRY(dp83902a_netdev, + "dp83902a_" CYGDAT_DEVS_ETH_SH_SE77X9_ETH0_NAME, + dp83902a_init, + &dp83902a_sc); +#endif // CYGPKG_DEVS_ETH_SH_SE77X9_ETH0 + +#endif // __WANT_DEVS + +// EOF devs_eth_sh_se77x9.inl diff --git a/packages/devs/eth/smsc/lan91cxx/current/ChangeLog b/packages/devs/eth/smsc/lan91cxx/current/ChangeLog --- a/packages/devs/eth/smsc/lan91cxx/current/ChangeLog +++ b/packages/devs/eth/smsc/lan91cxx/current/ChangeLog @@ -104,27 +104,36 @@ 2001-01-22 Hugo Tyson specifically. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/devs/eth/smsc/lan91cxx/current/cdl/smsc_lan91cxx_eth_drivers.cdl b/packages/devs/eth/smsc/lan91cxx/current/cdl/smsc_lan91cxx_eth_drivers.cdl --- a/packages/devs/eth/smsc/lan91cxx/current/cdl/smsc_lan91cxx_eth_drivers.cdl +++ b/packages/devs/eth/smsc/lan91cxx/current/cdl/smsc_lan91cxx_eth_drivers.cdl @@ -5,29 +5,38 @@ # Ethernet drivers - support for LAN91CXX compatible ethernet controllers # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c b/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c --- a/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c +++ b/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c @@ -5,29 +5,38 @@ // Ethernet device driver for SMSC LAN91CXX compatible controllers // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- @@ -75,8 +84,8 @@ #include #include #include -#include -#include +#include +#include #ifdef CYGPKG_NET #include #include diff --git a/packages/devs/eth/smsc/lan91cxx/current/src/smsc_lan91cxx.h b/packages/devs/eth/smsc/lan91cxx/current/src/smsc_lan91cxx.h --- a/packages/devs/eth/smsc/lan91cxx/current/src/smsc_lan91cxx.h +++ b/packages/devs/eth/smsc/lan91cxx/current/src/smsc_lan91cxx.h @@ -7,29 +7,38 @@ // SMCS LAN91C110 (LAN91CXX compatible) Ethernet chip // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //####BSDCOPYRIGHTBEGIN#### // // ------------------------------------------- diff --git a/packages/devs/eth/via/rhine/current/ChangeLog b/packages/devs/eth/via/rhine/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/via/rhine/current/ChangeLog @@ -0,0 +1,162 @@ +2001-08-22 Gary Thomas + + * src/via_rhine.h: + * src/if_rhine.c: + printf() is no longer a part of RedBoot. Thus all programs + must use diag_printf() and related functions instead. + +2001-07-05 Jesper Skov + + * src/via_rhine.h: Define IMR init value. + * src/if_rhine.c: And use it. + + * src/if_rhine.c: Remove unused code. + * src/via_rhine.h: Remove unused variable. + + * src/if_rhine.c (find_rhine_match_func): Added debug output. Fix + some warnings and an error. + +2001-07-04 Jesper Skov + + * src/if_rhine.c: Added D-Link pre-reset magic. Disabled driver + polls (leave it to interrupt handler). + + * src/via_rhine.h: Added more definitions. + + * src/if_rhine.c (rhine_can_send): Force MII status update by + reading from PHY controller. + +2001-07-02 Jesper Skov + + * src/via_rhine.h: Fail to build if CPU to PCI address translation + macros are not provided. + +2001-06-29 Jesper Skov + + * src/via_rhine.h: Fix macro typos. + + * src/if_rhine.c (rhine_poll): Put a mutex on this function. + +2001-06-28 Jesper Skov + + * src/if_rhine.c: Comment out unused function to silence warning. + Removed unused mem_base. Set interrupt priority to non-zero. + + * src/via_rhine.h (INCR_STAT): Fix typo. + +2001-06-27 Jesper Skov + + * src/if_rhine.c (rhine_can_send): Read MII status which appears + to make link magic work. Not at all clear why this is so, but it + works. + + * src/via_rhine.h: Disable debug output. + + * src/if_rhine.c (rhine_start): Name magic registers. + (rhine_start): Remove some verbose output. + + * src/via_rhine.h: Added register definitions. Removed unused key + IDs. + +2001-06-26 Jesper Skov + + * src/if_rhine.c: Rename PCI IO macros. + * src/via_rhine.h: Same. And include PCI header. + + * cdl/via_rhine_eth_drivers.cdl: Require PCI package. + +2001-06-25 Jesper Skov + + * src/if_rhine.c: Some cleanups, more debug code added, use macros + for accessing PCI IO space which platform can override. Some of + these changes from David Woodhouse. + * src/via_rhine.h: All macros moved to this file. + +2001-06-07 Jesper Skov + + * src/via_rhine.h: Rename MII definitions. + * src/if_rhine.c: Don't reset the controller when stopping. This + fixes the problem with the link state being weird. Clean up the + renegotiate code a bit. + + * src/if_rhine.c: Added code to gather statistics. + Some output cleanup, sanity checking of RX queue only when + assertions enabled. + +2001-06-06 Jesper Skov + + * src/via_rhine.h: MII definitions. + * src/if_rhine.c: Added MII accessor functions to allow a forced + renegotiate of the connection on a link fail. + + * src/if_rhine.c: Use PCI information to configure devices. Mask + interrupts in handlers. + (rhine_dsr): Oops, skipped driver synchronization. + + * src/via_rhine.h: Added more private data. + + * cdl/via_rhine_eth_drivers.cdl: Removed static ESA config option + - it belongs in the platform configury. Added device count for PCI + configury. + * src/if_rhine.c: Fix static ESA configury. + * src/via_rhine.h: Changed private data accordingly. + + * src/if_rhine.c: Fix buglet in handling of small packets, small + hacks to interrupt handling. + +2001-06-01 Jesper Skov + + * src/if_rhine.c: Tell stack the ESA. Pad short packets. + + * src/via_rhine.h: Added defs. + + * src/if_rhine.c: Mask off PCI addresses - need proper macros for + this, or rather, use PCI API to get correct addresses. Close RX/TX + descriptor loops. Load RX/TX base pointers into NIC. Enable TX. + +2001-05-31 Jesper Skov + + * src/via_rhine.h: Make TX/RX descriptor entries 32 bit only to + avoid endian issues with offsets. + + * src/if_rhine.c: Hacking code to (more or less) comply to + Rhine. Needs debugging though - manual is really thin! + +2001-05-30 Jesper Skov + + * Cloned from AMD PCNet driver. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/via/rhine/current/cdl/via_rhine_eth_drivers.cdl b/packages/devs/eth/via/rhine/current/cdl/via_rhine_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/via/rhine/current/cdl/via_rhine_eth_drivers.cdl @@ -0,0 +1,96 @@ +# ==================================================================== +# +# via_rhine_eth_drivers.cdl +# +# Ethernet drivers - support for VIA RHINE ethernet controllers +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Contributors: gthomas, jskov +# Date: 2001-05-30 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_VIA_RHINE { + display "VIA RHINE compatible ethernet driver" + description "Ethernet driver for VIA RHINE compatible controllers." + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_PCI + + active_if CYGINT_DEVS_ETH_VIA_RHINE_REQUIRED + + include_dir . + include_files ; # none _exported_ whatsoever + compile -library=libextras.a if_rhine.c + + define_proc { + puts $::cdl_header "#include "; + puts $::cdl_header "#include CYGDAT_DEVS_ETH_VIA_RHINE_CFG"; + } + + cdl_option CYGNUM_DEVS_ETH_VIA_RHINE_DEV_COUNT { + display "Number of supported interfaces." + calculated { CYGINT_DEVS_ETH_VIA_RHINE_REQUIRED } + flavor data + description " + This option selects the number of PCI ethernet interfaces to + be supported by the driver." + } + + cdl_component CYGPKG_DEVS_ETH_VIA_RHINE_OPTIONS { + display "RHINE ethernet driver build options" + flavor none + no_define + + cdl_option CYGPKG_DEVS_ETH_VIA_RHINE_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL -D__ECOS" } + description " + This option modifies the set of compiler flags for + building the RHINE ethernet driver package. + These flags are used in addition + to the set of global flags." + } + } +} diff --git a/packages/devs/eth/via/rhine/current/src/if_rhine.c b/packages/devs/eth/via/rhine/current/src/if_rhine.c new file mode 100644 --- /dev/null +++ b/packages/devs/eth/via/rhine/current/src/if_rhine.c @@ -0,0 +1,1317 @@ +//========================================================================== +// +// dev/if_rhine.c +// +// Ethernet device driver for VIA RHINE compatible controllers +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov, based on pcnet driver +// Contributors: gthomas, jskov, hmt +// Date: 2001-05-30 +// Purpose: +// Description: hardware driver for VIA Rhine ethernet +// +// FIXME: Make endian safe +// Make use of virtual addressing for memory shared over PCI +// (see _ADDR_MASK). +// Link failure not detected for some reason. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CYGPKG_NET +#include +#include +#include /* Needed for struct ifnet */ +#include +#endif +#include CYGHWR_MEMORY_LAYOUT_H + +#ifdef CYGPKG_IO_PCI +#include +#else +#error "Need PCI package here" +#endif + +#define _BUF_SIZE 1544 + +#ifdef CYGPKG_INFRA_DEBUG +// Then we log, OOI, the number of times we get a bad packet number +// from the tx done fifo. +int rhine_txfifo_good = 0; +int rhine_txfifo_bad = 0; +#endif + +#include "via_rhine.h" + +#define __WANT_DEVS +#include CYGDAT_DEVS_ETH_VIA_RHINE_INL +#undef __WANT_DEVS + +static void rhine_poll(struct eth_drv_sc *sc); + +// This ISR is called when the ethernet interrupt occurs +static cyg_uint32 +rhine_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + struct rhine_priv_data *cpd = (struct rhine_priv_data *)data; + + DEBUG_FUNCTION(); + + INCR_STAT( interrupts ); + + cyg_drv_interrupt_mask(cpd->interrupt); + cyg_drv_interrupt_acknowledge(cpd->interrupt); + return (CYG_ISR_HANDLED|CYG_ISR_CALL_DSR); // Run the DSR +} + +static void +rhine_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + // This conditioning out is necessary because of explicit calls to this + // DSR - which would not ever be called in the case of a polled mode + // usage ie. in RedBoot. +#ifdef CYGPKG_IO_ETH_DRIVERS_NET + struct rhine_priv_data* cpd = (struct rhine_priv_data *)data; + struct cyg_netdevtab_entry *ndp = (struct cyg_netdevtab_entry *)(cpd->ndp); + struct eth_drv_sc *sc = (struct eth_drv_sc *)(ndp->device_instance); + + // but here, it must be a *sc: + eth_drv_dsr( vector, count, (cyg_addrword_t)sc ); +#else +# ifndef CYGPKG_REDBOOT +# error Empty Rhine ethernet DSR is compiled. Is this what you want? +# endif +#endif +} + +// The deliver function (ex-DSR) handles the ethernet [logical] processing +static void +rhine_deliver(struct eth_drv_sc *sc) +{ + struct rhine_priv_data *cpd = (struct rhine_priv_data *)sc->driver_private; + + DEBUG_FUNCTION(); + + // Service the interrupt: + rhine_poll(sc); + // Allow interrupts to happen again + cyg_drv_interrupt_unmask(cpd->interrupt); +} + +static int +rhine_int_vector(struct eth_drv_sc *sc) +{ + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + + return (cpd->interrupt); +} + +// ------------------------------------------------------------------------ +// Physical interface +#if 0 // fix warning since this isn't actually used +static void +rhine_write_MII(struct rhine_priv_data *cpd, int id, int reg, cyg_uint16 value) +{ + cyg_uint8 stat; + int i = 1000; + + // Wait for a previous access to complete (within reason) + do { + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_MIICR, stat); + } while ((stat & (RHINE_MIICR_RCMD | RHINE_MIICR_WCMD)) && i-- > 0); + + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_MIICR, 0); + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_PHYADR, id); + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_MIIAD, reg); + HAL_PCI_IO_WRITE_UINT16(cpd->base + RHINE_MIIDATA, value); + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_MIICR, RHINE_MIICR_WCMD); +} +#endif + +static int +rhine_read_MII(struct rhine_priv_data *cpd, int id, int reg) +{ + int i = 1000; + cyg_uint8 stat; + cyg_uint16 val; + + // Wait for a previous access to complete (within reason) + do { + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_MIICR, stat); + } while ((stat & (RHINE_MIICR_RCMD | RHINE_MIICR_WCMD)) && i-- > 0); + + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_MIICR, 0); + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_PHYADR, id); + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_MIIAD, reg); + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_MIICR, RHINE_MIICR_RCMD); + + i = 1000; + do { + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_MIICR, stat); + } while ((stat & RHINE_MIICR_RCMD) && i-- > 0); + + HAL_PCI_IO_READ_UINT16(cpd->base + RHINE_MIIDATA, val); + return val; +} + +// ------------------------------------------------------------------------ +// Memory management +// +// Simply carve off from the front of the PCI mapped window into real memory +static cyg_uint32 rhine_heap_size; +static cyg_uint8 *rhine_heap_base; +static cyg_uint8 *rhine_heap_free; + +static void* +pciwindow_mem_alloc(int size) +{ + void *p_memory; + int _size = size; + + CYG_ASSERT( + (CYGHWR_VIA_RHINE_PCI_MEM_MAP_BASE <= (int)rhine_heap_free) + && + ((CYGHWR_VIA_RHINE_PCI_MEM_MAP_BASE + + CYGHWR_VIA_RHINE_PCI_MEM_MAP_SIZE) > (int)rhine_heap_free) + && + (0 < rhine_heap_size) + && + (CYGHWR_VIA_RHINE_PCI_MEM_MAP_SIZE >= rhine_heap_size) + && + (CYGHWR_VIA_RHINE_PCI_MEM_MAP_BASE == (int)rhine_heap_base), + "Heap variables corrupted" ); + + p_memory = (void *)0; + size = (size + 3) & ~3; + if ( (rhine_heap_free+size) < (rhine_heap_base+rhine_heap_size) ) { + cyg_uint32 *p; + p_memory = (void *)rhine_heap_free; + rhine_heap_free += size; + for ( p = (cyg_uint32 *)p_memory; _size > 0; _size -= 4 ) + *p++ = 0; + } + +#if DEBUG & 9 + diag_printf("Allocated %d bytes at %08x\n", size, p_memory); +#endif + + return p_memory; +} + +static cyg_pci_match_func find_rhine_match_func; + +static cyg_bool +find_rhine_match_func( cyg_uint16 v, cyg_uint16 d, cyg_uint32 c, void *p ) +{ +#if DEBUG & 9 + diag_printf("PCI match vendor %04x device %04x\n", v, d); +#endif + return + (0x1106 == v) && // vendor: VIA + ((0x3065 == d) || // device: DL10030A + (0x3043 == d)); // device: VT86C100A +} + +static int +pci_init_find_rhines( void ) +{ + cyg_pci_device_id devid; + cyg_pci_device dev_info; + cyg_uint16 cmd; + int device_index; + int found_devices = 0; + + DEBUG_FUNCTION(); + +#ifdef CYGARC_UNCACHED_ADDRESS + CYG_ASSERT( CYGARC_UNCACHED_ADDRESS((CYG_ADDRWORD)CYGMEM_SECTION_pci_window) == + CYGHWR_VIA_RHINE_PCI_MEM_MAP_BASE, + "PCI window configured does not match PCI memory section base" ); +#else + CYG_ASSERT( (CYG_ADDRWORD)CYGMEM_SECTION_pci_window == + CYGHWR_VIA_RHINE_PCI_MEM_MAP_BASE, + "PCI window configured does not match PCI memory section base" ); +#endif + CYG_ASSERT( CYGMEM_SECTION_pci_window_SIZE == + CYGHWR_VIA_RHINE_PCI_MEM_MAP_SIZE, + "PCI window configured does not match PCI memory section size" ); + + if ( +#ifdef CYGARC_UNCACHED_ADDRESS + CYGARC_UNCACHED_ADDRESS((CYG_ADDRWORD)CYGMEM_SECTION_pci_window) != +#else + (CYG_ADDRWORD)CYGMEM_SECTION_pci_window != +#endif + CYGHWR_VIA_RHINE_PCI_MEM_MAP_BASE + || + CYGMEM_SECTION_pci_window_SIZE != + CYGHWR_VIA_RHINE_PCI_MEM_MAP_SIZE ) { +#if DEBUG & 8 + diag_printf("pci_init_find_rhines(): PCI window misconfigured\n"); +#endif + return 0; + } + + // First initialize the heap in PCI window'd memory + rhine_heap_size = CYGHWR_VIA_RHINE_PCI_MEM_MAP_SIZE; + rhine_heap_base = (cyg_uint8 *)CYGHWR_VIA_RHINE_PCI_MEM_MAP_BASE; + rhine_heap_free = rhine_heap_base; + + cyg_pci_init(); +#if DEBUG & 8 + diag_printf("Finished cyg_pci_init();\n"); +#endif + + devid = CYG_PCI_NULL_DEVID; + + for (device_index = 0; + device_index < CYGNUM_DEVS_ETH_VIA_RHINE_DEV_COUNT; + device_index++) { + struct rhine_priv_data* cpd = rhine_priv_array[device_index]; + + cpd->index = device_index; + + // See above for find_rhine_match_func - it selects any of several + // variants. This is necessary in case we have multiple mixed-type + // devices on one board in arbitrary orders. + if (cyg_pci_find_matching( &find_rhine_match_func, NULL, &devid )) { +#if DEBUG & 8 + diag_printf("eth%d = rhine\n", device_index); +#endif + cyg_pci_get_device_info(devid, &dev_info); + + cpd->interrupt_handle = 0; // Flag not attached. + if (cyg_pci_translate_interrupt(&dev_info, &cpd->interrupt)) { +#if DEBUG & 8 + diag_printf(" Wired to HAL vector %d\n", cpd->interrupt); +#endif + cyg_drv_interrupt_create( + cpd->interrupt, + 1, // Priority - unused + (cyg_addrword_t)cpd,// Data item passed to ISR & DSR + rhine_isr, // ISR + rhine_dsr, // DSR + &cpd->interrupt_handle, // handle to intr obj + &cpd->interrupt_object ); // space for int obj + + cyg_drv_interrupt_attach(cpd->interrupt_handle); + + // Don't unmask the interrupt yet, that could get us into a + // race. + } + else { + cpd->interrupt = 0; +#if DEBUG & 8 + diag_printf(" Does not generate interrupts.\n"); +#endif + } + + if (cyg_pci_configure_device(&dev_info)) { +#if DEBUG & 8 + int i; + diag_printf("Found device on bus %d, devfn 0x%02x:\n", + CYG_PCI_DEV_GET_BUS(devid), + CYG_PCI_DEV_GET_DEVFN(devid)); + + if (dev_info.command & CYG_PCI_CFG_COMMAND_ACTIVE) { + diag_printf(" Note that board is active. Probed" + " sizes and CPU addresses invalid!\n"); + } + diag_printf(" Vendor 0x%04x", dev_info.vendor); + diag_printf("\n Device 0x%04x", dev_info.device); + diag_printf("\n Command 0x%04x, Status 0x%04x\n", + dev_info.command, dev_info.status); + + diag_printf(" Class/Rev 0x%08x", dev_info.class_rev); + diag_printf("\n Header 0x%02x\n", dev_info.header_type); + + diag_printf(" SubVendor 0x%04x, Sub ID 0x%04x\n", + dev_info.header.normal.sub_vendor, + dev_info.header.normal.sub_id); + + for(i = 0; i < CYG_PCI_MAX_BAR; i++) { + diag_printf(" BAR[%d] 0x%08x /", i, dev_info.base_address[i]); + diag_printf(" probed size 0x%08x / CPU addr 0x%08x\n", + dev_info.base_size[i], dev_info.base_map[i]); + } + diag_printf(" eth%d configured\n", device_index); +#endif + found_devices++; + cpd->found = 1; + cpd->active = 0; + cpd->devid = devid; + cpd->base = (unsigned char*) dev_info.base_map[0]; +#if DEBUG & 8 + diag_printf(" I/O address = 0x%08x\n", cpd->base); +#endif + + // Don't use cyg_pci_set_device_info since it clears + // some of the fields we want to print out below. + cyg_pci_read_config_uint16(dev_info.devid, + CYG_PCI_CFG_COMMAND, &cmd); + cmd |= (CYG_PCI_CFG_COMMAND_IO // enable I/O space + | CYG_PCI_CFG_COMMAND_MEMORY // enable memory space + | CYG_PCI_CFG_COMMAND_MASTER); // enable bus master + cyg_pci_write_config_uint16(dev_info.devid, + CYG_PCI_CFG_COMMAND, cmd); + + // Extra init code needed for D-Link controller. This + // is snuffed from the Linux driver and was provided + // by D-Link. I've been unable to find documentation + // for the part. + if (0x3065 == dev_info.device) { + cyg_uint8 tmp; + +#if DEBUG & 8 + diag_printf("Pre-reset init code for D-Link.\n"); +#endif + HAL_PCI_IO_READ_UINT8(cpd->base+RHINE_STICKYHW, tmp); + tmp &= 0xfc; + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_STICKYHW, tmp); + + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_WOL_CG_CLR, 0x80); + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_WOL_CR_CLR, 0xff); + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_PWR_CSR_CLR, 0xff); + } + + // Now the PCI part of the device is configured, reset + // it. This should make it safe to enable the + // interrupt + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_CR1, RHINE_CR1_SRST); + + // Reload ESA from EEPROM + { + cyg_uint8 tmp; + int i; + +#if DEBUG & 8 + diag_printf("Reload ESA from EEPROM..."); +#endif + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_EECSR, 0x20); + for (i = 0; i < 150; i++) { + HAL_PCI_IO_READ_UINT8(cpd->base+RHINE_EECSR, tmp); + if (!(tmp & 0x20)) { + break; + } + } +#if DEBUG & 8 + if (tmp & 0x20) + diag_printf("Timed out\n"); + else + diag_printf("Done\n"); +#endif + } + + // This is the indicator for "uses an interrupt" + if (cpd->interrupt_handle != 0) { + cyg_drv_interrupt_acknowledge(cpd->interrupt); + cyg_drv_interrupt_unmask(cpd->interrupt); +#if DEBUG & 8 + diag_printf(" Enabled interrupt %d\n", cpd->interrupt); +#endif + } +#if DEBUG & 8 + diag_printf(" **** Device enabled for I/O and Memory " + "and Bus Master\n"); +#endif + } + else { + cpd->found = 0; + cpd->active = 0; +#if DEBUG & 8 + diag_printf("Failed to configure device %d\n", device_index); +#endif + } + } + else { + cpd->found = 0; + cpd->active = 0; +#if DEBUG & 8 + diag_printf("eth%d not found\n", device_index); +#endif + } + } + + if (0 == found_devices) + return 0; + + return 1; +} + +static bool +via_rhine_init(struct cyg_netdevtab_entry *tab) +{ + static int initialized = 0; // only probe PCI et al *once* + struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance; + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + cyg_uint8 *d, *p, *p_next; + int i; + cyg_addrword_t ba; + + DEBUG_FUNCTION(); + + if ( 0 == initialized++ ) { + // then this is the first time ever: + if ( ! pci_init_find_rhines() ) { +#if DEBUG & 8 + diag_printf( "pci_init_find_rhines failed" ); +#endif + return false; + } + } + + // If this device is not present, exit + if (0 == cpd->found) + return 0; + +#if DEBUG & 8 + diag_printf( "Rhine device SC %08x CPD %08x\n", sc, cpd); +#endif + + // Look for physical MII device + for (i = 0; i < 32; i++) { + cyg_uint16 mii_status = rhine_read_MII(cpd, i, MII_BMSR); + if (mii_status != 0x0000 && mii_status != 0xffff) { + cpd->phys_id = i; +#if DEBUG & 8 + diag_printf("Found MII interface at id %d, status %04x, adv 0x%04x, link 0x%04x\n", + cpd->phys_id, mii_status, rhine_read_MII(cpd,i,4), rhine_read_MII(cpd,i,5)); +#endif + break; + } + } +#if DEBUG & 8 + if (i == 32) + diag_printf("No MII interface found!"); +#endif + + // Prepare ESA + if (cpd->hardwired_esa) { + // Force the NIC to use the specified ESA + p = cpd->base + RHINE_PAR0; + for (i = 0; i < 6; i++) + *p++ = cpd->esa[i]; + } else { + // Use the address from the serial EEPROM + p = cpd->base + RHINE_PAR0; + for (i = 0; i < 6; i++) + cpd->esa[i] = *p++; + } +#if DEBUG & 8 + diag_printf("RHINE - %s ESA: %02x:%02x:%02x:%02x:%02x:%02x\n", + (cpd->hardwired_esa) ? "static" : "eeprom", + cpd->esa[0], + cpd->esa[1], + cpd->esa[2], + cpd->esa[3], + cpd->esa[4], + cpd->esa[5] ); +#endif + + // Prepare RX and TX rings + p = cpd->rx_ring = (cyg_uint8*) CYGARC_UNCACHED_ADDRESS(pciwindow_mem_alloc((1<rx_ring_log_cnt)*RHINE_RD_SIZE)); + d = cpd->rx_buffers = (cyg_uint8*) CYGARC_UNCACHED_ADDRESS(pciwindow_mem_alloc(_BUF_SIZE*cpd->rx_ring_cnt)); + for (i = 0; i < cpd->rx_ring_cnt; i++) { + p_next = p + RHINE_RD_SIZE; + HAL_PCI_CPU_TO_BUS((cyg_uint32)d, ba); + _SU32(p, RHINE_RDES2) = ba; + _SU32(p, RHINE_RDES1) = _BUF_SIZE; + HAL_PCI_CPU_TO_BUS((cyg_uint32)p_next, ba); + _SU32(p, RHINE_RDES3) = ba; + _SU32(p, RHINE_RDES0) = RHINE_RDES0_OWN; +#if DEBUG & 8 + diag_printf("Set RDES at 0x%08lx to 0x%08x 0x%08x 0x%08x 0x%08x\n", + (unsigned long)p, + _SU32(p, RHINE_RDES0), _SU32(p, RHINE_RDES1), + _SU32(p, RHINE_RDES2), _SU32(p, RHINE_RDES3)); +#endif + p = p_next; + d += _BUF_SIZE; + } + // last entry wraps to the first + p -= RHINE_RD_SIZE; + HAL_PCI_CPU_TO_BUS((cyg_uint32)cpd->rx_ring, ba); + _SU32(p, RHINE_RDES3) = ba; +#if DEBUG & 8 + diag_printf("Set RDES at 0x%08lx to 0x%08x 0x%08x 0x%08x 0x%08x\n", + (unsigned long)p, + _SU32(p, RHINE_RDES0), _SU32(p, RHINE_RDES1), + _SU32(p, RHINE_RDES2), _SU32(p, RHINE_RDES3)); +#endif + cpd->rx_ring_next = 0; + // CPU to PCI space translation + HAL_PCI_CPU_TO_BUS((cyg_uint32)cpd->rx_ring, ba); + HAL_PCI_IO_WRITE_UINT32(cpd->base + RHINE_CUR_RX, ba); + + p = cpd->tx_ring = (cyg_uint8*) CYGARC_UNCACHED_ADDRESS(pciwindow_mem_alloc((1<tx_ring_log_cnt)*RHINE_TD_SIZE)); + d = cpd->tx_buffers = (cyg_uint8*) CYGARC_UNCACHED_ADDRESS(pciwindow_mem_alloc(_BUF_SIZE*cpd->tx_ring_cnt)); + for (i = 0; i < cpd->tx_ring_cnt; i++) { + + _SU32(p, RHINE_TDES0) = 0; + _SU32(p, RHINE_TDES1) = (RHINE_TDES1_IC|RHINE_TDES1_EDP|RHINE_TDES1_STP|RHINE_TDES1_C); + HAL_PCI_CPU_TO_BUS((cyg_uint32)d, ba); + _SU32(p, RHINE_TDES2) = ba; + HAL_PCI_CPU_TO_BUS((cyg_uint32)(p + RHINE_TD_SIZE), ba); + _SU32(p, RHINE_TDES3) = ba; +#if DEBUG & 8 + diag_printf("Set TDES at 0x%08lx to 0x%08x 0x%08x 0x%08x 0x%08x\n", + (unsigned long)p, + _SU32(p, RHINE_TDES0), _SU32(p, RHINE_TDES1), + _SU32(p, RHINE_TDES2), _SU32(p, RHINE_TDES3)); +#endif + p += RHINE_TD_SIZE; + d += _BUF_SIZE; + } + + // last entry wraps to the first + p -= RHINE_TD_SIZE; + HAL_PCI_CPU_TO_BUS((cyg_uint32)cpd->tx_ring, ba); + _SU32(p, RHINE_TDES3) = ba; +#if DEBUG & 8 + diag_printf("Set TDES at 0x%08lx to 0x%08x 0x%08x 0x%08x 0x%08x\n", + (unsigned long)p, + _SU32(p, RHINE_TDES0), _SU32(p, RHINE_TDES1), + _SU32(p, RHINE_TDES2), _SU32(p, RHINE_TDES3)); +#endif + cpd->tx_ring_free = cpd->tx_ring_alloc = cpd->tx_ring_owned = 0; + HAL_PCI_CPU_TO_BUS((cyg_uint32)cpd->tx_ring, ba); + HAL_PCI_IO_WRITE_UINT32(cpd->base + RHINE_CUR_TX, ba); + + cpd->txbusy = 0; + +#if DEBUG & 9 + { + cyg_uint8 tmp1, tmp2; + HAL_PCI_IO_READ_UINT8(cpd->base+RHINE_CR0, tmp1); + HAL_PCI_IO_READ_UINT8(cpd->base+RHINE_CR1, tmp2); + diag_printf("CR0: %02x CR1: %02x\n", tmp1, tmp2); + } +#endif + + // and record the net dev pointer + cpd->ndp = (void *)tab; + + // Initialize upper level driver + (sc->funs->eth_drv->init)(sc, cpd->esa); + +#if DEBUG & 9 + diag_printf("Done\n"); +#endif + return true; +} + +static void +rhine_stop(struct eth_drv_sc *sc) +{ + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + + DEBUG_FUNCTION(); + + // Stop chip + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_CR0, RHINE_CR0_STOP); +} + +// +// This function is called to "start up" the interface. It may be called +// multiple times, even when the hardware is already running. It will be +// called whenever something "hardware oriented" changes and should leave +// the hardware ready to send/receive packets. +// +static void +rhine_start(struct eth_drv_sc *sc, unsigned char *esa, int flags) +{ +#ifdef CYGPKG_NET + struct ifnet *ifp = &sc->sc_arpcom.ac_if; +#endif + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + + DEBUG_FUNCTION(); + // Disable device + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_CR0, RHINE_CR0_STOP); + // Ack old interrupts + HAL_PCI_IO_WRITE_UINT16(cpd->base + RHINE_ISR, 0xffff); + // Enable interrupts + HAL_PCI_IO_WRITE_UINT16(cpd->base + RHINE_IMR, RHINE_IMR_INIT); + // Enable duplex + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_CR1, RHINE_CR1_DPOLL /* | RHINE_CR1_FDX*/); + // Accept broadcast, multicast and small packets + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_RCR, RHINE_RCR_AB | RHINE_RCR_AM | RHINE_RCR_AR); + // Tweak some magic (undocumented) parameters + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_BCR0, RHINE_BCR0_MAGIC_INIT); + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_BCR1, RHINE_BCR1_MAGIC_INIT); + +#if 1 // FIXME + HAL_PCI_IO_WRITE_UINT8(cpd->base+RHINE_TCR, 0x20); +#endif + +#ifdef CYGPKG_NET + if (( 0 +#ifdef ETH_DRV_FLAGS_PROMISC_MODE + != (flags & ETH_DRV_FLAGS_PROMISC_MODE) +#endif + ) || (ifp->if_flags & IFF_PROMISC) + ) { + // Then we select promiscuous mode. + cyg_uint8 rcr; + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_RCR, rcr); + rcr |= RHINE_RCR_PRO; + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_RCR, rcr); + } +#endif + // Enable device + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_CR0, RHINE_CR0_STRT | RHINE_CR0_RXON | RHINE_CR0_TXON); +} + +// +// This routine is called to perform special "control" opertions +// +static int +rhine_control(struct eth_drv_sc *sc, unsigned long key, + void *data, int data_length) +{ + cyg_uint8 *esa = (cyg_uint8 *)data; + int i, res; + cyg_uint8 reg, old_stat; + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + + DEBUG_FUNCTION(); + + // Stop the controller while accessing (possibly altering) registers + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_CR0, old_stat); + reg = old_stat; + reg |= RHINE_CR0_STOP; + reg &= ~RHINE_CR0_STRT; + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_CR0, reg); + + res = 0; // expect success + switch (key) { + case ETH_DRV_SET_MAC_ADDRESS: +#if DEBUG & 9 + diag_printf("RHINE - set ESA: %02x:%02x:%02x:%02x:%02x:%02x\n", + esa[0], + esa[1], + esa[2], + esa[3], + esa[4], + esa[5] ); +#endif // DEBUG + + for ( i = 0; i < sizeof(cpd->esa); i++ ) { + cpd->esa[i] = esa[i]; + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_PAR0 + i, esa[i]); + } + break; + +#ifdef ETH_DRV_GET_MAC_ADDRESS + case ETH_DRV_GET_MAC_ADDRESS: + // Extract the MAC address that is in the chip, and tell the + // system about it. + for (i = 0; i < sizeof(cpd->esa); i++) { + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_PAR0 + i, esa[i]); + } + break; +#endif + +#ifdef ETH_DRV_GET_IF_STATS_UD + case ETH_DRV_GET_IF_STATS_UD: // UD == UPDATE +#endif + // drop through +#ifdef ETH_DRV_GET_IF_STATS + case ETH_DRV_GET_IF_STATS: +#endif + +#if defined(ETH_DRV_GET_IF_STATS) || defined (ETH_DRV_GET_IF_STATS_UD) + { + cyg_uint8 reg; + struct ether_drv_stats *p = (struct ether_drv_stats *)data; + // Chipset entry is no longer supported; RFC1573. + for ( i = 0; i < SNMP_CHIPSET_LEN; i++ ) + p->snmp_chipset[i] = 0; + + // This perhaps should be a config opt, so you can make up your own + // description, or supply it from the instantiation. + strcpy( p->description, "VIA Rhine" ); + // CYG_ASSERT( 48 > strlen(p->description), "Description too long" ); + + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_MIISR, reg); + if (reg & RHINE_MIISR_LNKFL) { + p->operational = 2; // LINK DOWN + p->duplex = 1; // UNKNOWN + p->speed = 0; + } + else { + p->operational = 3; // LINK UP + p->speed = (reg & RHINE_MIISR_SPEED) ? 10 * 1000000 : 100 * 1000000; + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_CR1, reg); + if (reg & RHINE_CR1_FDX) + p->duplex = 3; // 3 = DUPLEX + else + p->duplex = 2; // 2 = SIMPLEX + } + +#ifdef KEEP_STATISTICS + { + struct via_rhine_stats *ps = &(cpd->stats); + + // Admit to it... + p->supports_dot3 = true; + + p->tx_good = ps->tx_good ; + p->tx_max_collisions = ps->tx_max_collisions ; + p->tx_late_collisions = ps->tx_late_collisions ; + p->tx_underrun = ps->tx_underrun ; + p->tx_carrier_loss = ps->tx_carrier_loss ; + p->tx_deferred = ps->tx_deferred ; + p->tx_sqetesterrors = ps->tx_sqetesterrors ; + p->tx_single_collisions = ps->tx_single_collisions; + p->tx_mult_collisions = ps->tx_mult_collisions ; + p->tx_total_collisions = ps->tx_total_collisions ; + p->rx_good = ps->rx_good ; + p->rx_crc_errors = ps->rx_crc_errors ; + p->rx_align_errors = ps->rx_align_errors ; + p->rx_resource_errors = ps->rx_resource_errors ; + p->rx_overrun_errors = ps->rx_overrun_errors ; + p->rx_collisions = ps->rx_collisions ; + p->rx_short_frames = ps->rx_short_frames ; + p->rx_too_long_frames = ps->rx_too_long_frames ; + p->rx_symbol_errors = ps->rx_symbol_errors ; + + p->interrupts = ps->interrupts ; + p->rx_count = ps->rx_count ; + p->rx_deliver = ps->rx_deliver ; + p->rx_resource = ps->rx_resource ; + p->rx_restart = ps->rx_restart ; + p->tx_count = ps->tx_count ; + p->tx_complete = ps->tx_complete ; + p->tx_dropped = ps->tx_dropped ; + } +#endif // KEEP_STATISTICS + + p->tx_queue_len = 1; + break; + } +#endif + default: + res = 1; + break; + } + + // Restore controller state + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_CR0, old_stat); + + return res; +} + +// +// This routine is called to see if it is possible to send another packet. +// It will return non-zero if a transmit is possible, zero otherwise. +// +static int +rhine_can_send(struct eth_drv_sc *sc) +{ + cyg_uint8 stat; + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + + DEBUG_FUNCTION(); + + // This MII read forces the MIISR to get updated + (void) rhine_read_MII(cpd, cpd->phys_id, MII_BMSR); + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_MIISR, stat); + if (stat & RHINE_MIISR_LNKFL) { +#if DEBUG & 1 + diag_printf("*** Link failure\n"); +#endif + return false; // Link not connected + } + + return (cpd->txbusy == 0); +} + +// +// This routine is called to send data to the hardware. +static void +rhine_send(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len, + int total_len, unsigned long key) +{ + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + int i, len, plen, ring_entry; + + cyg_uint8* sdata = NULL; + cyg_uint8 *d, *buf, *txd; + cyg_uint16 status; + cyg_uint8 cr0; + + DEBUG_FUNCTION(); + + INCR_STAT( tx_count ); + + // Worry about the engine stopping. + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_CR0, status); + if ( 0 == (RHINE_CR0_STRT & status) ) { +#if DEBUG & 1 + diag_printf("%s: ENGINE RESTART: status %04x\n", __FUNCTION__, status); +#endif + status &= ~RHINE_CR0_STOP; + status |= RHINE_CR0_STRT; + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_CR0, status); + } + + cpd->txbusy = 1; + cpd->txkey = key; + + // Find packet length + plen = 0; + for (i = 0; i < sg_len; i++) + plen += sg_list[i].len; + + CYG_ASSERT( plen == total_len, "sg data length mismatch" ); + + // Get next TX descriptor + ring_entry = cpd->tx_ring_free; + do { + if (cpd->tx_ring_owned == cpd->tx_ring_cnt) { + // Is this a dead end? Probably is. +#if DEBUG & 1 + diag_printf("%s: Allocation failed! Retrying...\n", __FUNCTION__ ); +#endif + continue; + } + + cpd->tx_ring_free++; + cpd->tx_ring_owned++; + if (cpd->tx_ring_free == cpd->tx_ring_cnt) + cpd->tx_ring_free = 0; + } while (0); + + txd = cpd->tx_ring + ring_entry*RHINE_TD_SIZE; + buf = cpd->tx_buffers + ring_entry*_BUF_SIZE; + CYG_ASSERT(0 == (_SU32(txd, RHINE_TDES0) & RHINE_TDES0_OWN), + "TX descriptor not free"); + +#if DEBUG & 4 + diag_printf("##Tx descriptor index %d TDES %08x buffer %08x\n", + ring_entry, txd, buf); +#endif + + // Put data into buffer + d = buf; + for (i = 0; i < sg_len; i++) { + sdata = (cyg_uint8 *)sg_list[i].buf; + len = sg_list[i].len; + + CYG_ASSERT( sdata, "No sg data pointer here" ); + while(len--) + *d++ = *sdata++; + } + CYG_ASSERT( sdata, "No sg data pointer outside" ); + + // Annoyingly the chip doesn't pad to minimal packet size, so do + // that by steam + if (plen < 60) { + plen = 60; +#if DEBUG & 4 + diag_printf("Padded %d bytes packet to 60 bytes\n", plen); +#endif + } + + CYG_ASSERT( (plen & RHINE_TDES1_TLNG_mask) == plen, "packet too long"); + CYG_ASSERT( (plen & RHINE_TDES1_TLNG_mask) >= 60, "packet too short"); + _SU32(txd, RHINE_TDES1) &= ~RHINE_TDES1_TLNG_mask; + _SU32(txd, RHINE_TDES1) |= plen; + _SU32(txd, RHINE_TDES0) = RHINE_TDES0_OWN; + +#if DEBUG & 1 // FIXME + diag_printf("Before TX: Desc (@0x%08lx) %08x %08x %08x %08x\n Next (@0x%08lx) %08x %08x %08x %08x\n", + (unsigned long) txd, + _SU32(txd, RHINE_TDES0), _SU32(txd, RHINE_TDES1), + _SU32(txd, RHINE_TDES2), _SU32(txd, RHINE_TDES3), + ( (unsigned long)txd)+0x10, + _SU32(txd, (0x10+RHINE_TDES0)), _SU32(txd, (0x10+RHINE_TDES1)), + _SU32(txd,(0x10+ RHINE_TDES2)), _SU32(txd,(0x10+ RHINE_TDES3))); +#endif + + // Ack TX empty int + HAL_PCI_IO_WRITE_UINT16(cpd->base + RHINE_ISR, RHINE_ISR_PTX); + // Set transmit demand + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_CR0, cr0); + cr0 |= RHINE_CR0_TDMD; + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_CR0, cr0); + +#if DEBUG & 1 + HAL_PCI_IO_READ_UINT16(cpd->base + RHINE_ISR, status); + diag_printf("%s:END: ints at TX: %04x\n", __FUNCTION__, status); +#endif + +} + +static void +rhine_TxEvent(struct eth_drv_sc *sc, int stat) +{ + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + int success = 1; + cyg_uint8 *txd; + cyg_uint8 status; + + DEBUG_FUNCTION(); + + INCR_STAT( tx_complete ); + + txd = cpd->tx_ring + cpd->tx_ring_alloc*RHINE_TD_SIZE; +#if DEBUG & 4 + diag_printf("##Tx packet %d freed %08x %08x!\n", cpd->tx_ring_alloc, txd, _SU32(txd, RHINE_TDES0) ); +#endif + if ((_SU32(txd, RHINE_TDES0) & RHINE_TDES0_OWN)) { +#if DEBUG & 1 + diag_printf("%s: got TX completion when buffer is still owned\n", __FUNCTION__); +#endif + // first dirty ring entry not freed - wtf? + } + cpd->tx_ring_alloc++; + if (cpd->tx_ring_alloc == cpd->tx_ring_cnt) + cpd->tx_ring_alloc = 0; + cpd->tx_ring_owned--; + +#ifdef KEEP_STATISTICS + { + cyg_uint32 reg = _SU32(txd, RHINE_TDES0); + int collisions; + + // Covering each bit in turn... + if ( reg & RHINE_TDES0_TXOK ) INCR_STAT( tx_good ); + if ( reg & RHINE_TDES0_CRS ) INCR_STAT( tx_carrier_loss ); + if ( reg & RHINE_TDES0_OWC ) INCR_STAT( tx_late_collisions ); + if ( reg & RHINE_TDES0_ABT ) INCR_STAT( tx_max_collisions ); + + if ( reg & RHINE_TDES0_DFR ) INCR_STAT( tx_deferred ); + + collisions = ((reg & RHINE_TDES0_NCR_mask) >> RHINE_TDES0_NCR_shift); + if (1 == collisions) + INCR_STAT( tx_single_collisions ); + else if (1 < collisions) + INCR_STAT( tx_mult_collisions ); + + cpd->stats.tx_total_collisions = + cpd->stats.tx_late_collisions + + cpd->stats.tx_max_collisions + + cpd->stats.tx_mult_collisions + + cpd->stats.tx_single_collisions; + } +#endif // KEEP_STATISTICS + + // We do not really care about Tx failure. Ethernet is not a reliable + // medium. But we do care about the TX engine stopping. + HAL_PCI_IO_READ_UINT8(cpd->base + RHINE_CR0, status); + if ( 0 == (RHINE_CR0_STRT & status) ) { +#if DEBUG & 1 + diag_printf("%s: ENGINE RESTART: status %04x\n", __FUNCTION__, status); +#endif + status &= ~RHINE_CR0_STOP; + status |= RHINE_CR0_STRT; + HAL_PCI_IO_WRITE_UINT8(cpd->base + RHINE_CR0, status); + success = 0; // And treat this as an error... + } + + if ( cpd->txbusy ) { + cpd->txbusy = 0; + (sc->funs->eth_drv->tx_done)(sc, cpd->txkey, success); + } + + // Ack TX interrupt set + HAL_PCI_IO_WRITE_UINT16(cpd->base + RHINE_ISR, RHINE_ISR_PTX); +} + +// +// This function is called when a packet has been received. Its job is +// to prepare to unload the packet from the hardware. Once the length of +// the packet is known, the upper layer of the driver can be told. When +// the upper layer is ready to unload the packet, the internal function +// 'rhine_recv' will be called to actually fetch it from the hardware. +// +static void +rhine_RxEvent(struct eth_drv_sc *sc) +{ + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + cyg_uint8 *rxd; + cyg_uint32 rstat; + cyg_uint16 ints, len, mask; + + DEBUG_FUNCTION(); + + HAL_PCI_IO_READ_UINT16(cpd->base + RHINE_ISR, ints); +#if DEBUG & 1 + diag_printf("RxEvent - CSR: 0x%04x\n", ints); +#endif + if ( 0 == (RHINE_ISR_PRX & ints) ) + // Then there's no RX event pending + return; + + // Mask interrupt + HAL_PCI_IO_READ_UINT16(cpd->base + RHINE_IMR, mask); + mask &= ~RHINE_IMR_PRX; + HAL_PCI_IO_WRITE_UINT16(cpd->base + RHINE_IMR, mask); + + while (1) { + // Get state of next (supposedly) full ring entry + cpd->rxpacket = cpd->rx_ring_next; + rxd = cpd->rx_ring + cpd->rxpacket*RHINE_RD_SIZE; + rstat = _SU32(rxd, RHINE_RDES0); + + // Keep going until we hit an entry that is owned by the + // controller. + if (rstat & RHINE_RDES0_OWN) { +#ifdef CYGDBG_USE_ASSERTS + // Sanity check of queue + int i; + for (i = 0; i < cpd->rx_ring_cnt; i++) { + rxd = cpd->rx_ring + i*RHINE_RD_SIZE; + rstat = _SU32(rxd, RHINE_RDES0); + + if (!(rstat & RHINE_RDES0_OWN)) { + int i; + cyg_uint32 rstat; + cyg_uint8* rxd; + + diag_printf("####Rx %s Inconsistent RX state - next was %d\n", + __FUNCTION__, cpd->rx_ring_next); + for (i = 0; i < cpd->rx_ring_cnt; i++) { + rxd = cpd->rx_ring + i*RHINE_RD_SIZE; + rstat = _SU32(rxd, RHINE_RDES0); + diag_printf("#### %02d: 0x%08x\n", i, rstat); + } + } + break; + } +#endif + break; + } + +#if DEBUG & 4 + diag_printf("##Rx packet %d RDES %08x stat %08x\n", + cpd->rxpacket, rxd, rstat); +#endif + + // Increment counts + INCR_STAT( rx_count ); + cpd->rx_ring_next++; + if (cpd->rx_ring_next == cpd->rx_ring_cnt) cpd->rx_ring_next = 0; + + len = (rstat & RHINE_RDES0_FLNG_mask) >> RHINE_RDES0_FLNG_shift; + +#ifdef KEEP_STATISTICS + if ( rstat & RHINE_RDES0_CRC ) INCR_STAT( rx_crc_errors ); + if ( rstat & RHINE_RDES0_FAE ) INCR_STAT( rx_align_errors ); + if ( rstat & RHINE_RDES0_LONG ) INCR_STAT( rx_too_long_frames ); +#endif // KEEP_STATISTICS + + if (RHINE_RDES0_RXOK & rstat) { + // It's OK + INCR_STAT( rx_good ); + +#if DEBUG & 1 + diag_printf("RxEvent good rx - stat: 0x%08x, len: 0x%04x\n", rstat, len); + { + unsigned char *buf = cpd->rx_buffers + cpd->rxpacket*_BUF_SIZE; + + int i; + diag_printf("RDES: %08x %08x %08x %08x\n", + _SU32(rxd, RHINE_RDES0), _SU32(rxd, RHINE_RDES1), + _SU32(rxd, RHINE_RDES2), _SU32(rxd, RHINE_RDES3)); + + diag_printf("Packet data at %p\n", buf); + for (i=0;i sizeof( struct ether_header ) ) + // then it is acceptable; offer the data to the network stack +#endif + (sc->funs->eth_drv->recv)(sc, len); + } else { + // Not OK for one reason or another... +#if DEBUG & 1 + diag_printf("RxEvent - No RX bit: stat: 0x%08x, len: 0x%04x\n", + rstat, len); +#endif + } + + // Free packet (clear all status flags, and set OWN) + _SU32(rxd, RHINE_RDES0) = RHINE_RDES0_OWN; + } + + // Ack RX int + HAL_PCI_IO_WRITE_UINT16(cpd->base + RHINE_ISR, RHINE_ISR_PRX); + // And reenable the interrupt + HAL_PCI_IO_READ_UINT16(cpd->base + RHINE_IMR, mask); + mask |= RHINE_IMR_PRX; + HAL_PCI_IO_WRITE_UINT16(cpd->base + RHINE_IMR, mask); +} + +// +// This function is called as a result of the "eth_drv_recv()" call above. +// Its job is to actually fetch data for a packet from the hardware once +// memory buffers have been allocated for the packet. Note that the buffers +// may come in pieces, using a scatter-gather list. This allows for more +// efficient processing in the upper layers of the stack. +// +static void +rhine_recv(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len) +{ + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + int i, mlen=0, plen; + cyg_uint8 *data, *rxd, *buf; + + DEBUG_FUNCTION(); + + rxd = cpd->rx_ring + cpd->rxpacket*RHINE_RD_SIZE; + buf = cpd->rx_buffers + cpd->rxpacket*_BUF_SIZE; + + INCR_STAT( rx_deliver ); + + plen = (_SU32(rxd, RHINE_RDES0) & RHINE_RDES0_FLNG_mask) >> RHINE_RDES0_FLNG_shift; + + for (i = 0; i < sg_len; i++) { + data = (cyg_uint8*)sg_list[i].buf; + mlen = sg_list[i].len; + +#if DEBUG & 1 + diag_printf("%s : mlen %x, plen %x\n", __FUNCTION__, mlen, plen); +#endif + if (data) { + while (mlen > 0) { + *data++ = *buf++; + mlen--; + plen--; + } + } + } +} + +static void +rhine_poll(struct eth_drv_sc *sc) +{ + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + cyg_uint16 event, mask; + static volatile bool locked = false; + +// DEBUG_FUNCTION(); + + while (1) { + // Get the (unmasked) requests + HAL_PCI_IO_READ_UINT16(cpd->base + RHINE_ISR, event); + HAL_PCI_IO_READ_UINT16(cpd->base + RHINE_IMR, mask); + + event &= mask; + + if (0 == event) + break; + + if (event & RHINE_ISR_PRX) { + rhine_RxEvent(sc); + } + else if (event & RHINE_ISR_PTX) { + rhine_TxEvent(sc, event); + } + else if (event & RHINE_ISR_RU) { +#if DEBUG & 1 + int i; + cyg_uint32 rstat; + cyg_uint8* rxd; + struct rhine_priv_data *cpd = + (struct rhine_priv_data *)sc->driver_private; + + diag_printf("%s: Ran out of RX buffers (%04x)\n", __FUNCTION__, event); + for (i = 0; i < cpd->rx_ring_cnt; i++) { + rxd = cpd->rx_ring + i*RHINE_RD_SIZE; + + rstat = _SU32(rxd, RHINE_RDES0); + diag_printf(" %02d: 0x%08x\n", i, rstat); + } +#endif + HAL_PCI_IO_WRITE_UINT16(cpd->base + RHINE_ISR, RHINE_ISR_RU); + } + else { +#if DEBUG & 1 + diag_printf("%s: Unknown interrupt: 0x%04x\n", __FUNCTION__, event); +#endif + // Clear unhandled interrupts and hope for the best + // This should never happen though, since we only enable + // the sources we handle. + HAL_PCI_IO_WRITE_UINT16(cpd->base + RHINE_ISR, event); + } + } + + locked = false; +} +// EOF if_rhine.c diff --git a/packages/devs/eth/via/rhine/current/src/via_rhine.h b/packages/devs/eth/via/rhine/current/src/via_rhine.h new file mode 100644 --- /dev/null +++ b/packages/devs/eth/via/rhine/current/src/via_rhine.h @@ -0,0 +1,469 @@ +#ifndef CYGONCE_DEVS_ETH_VIA_RHINE_H +#define CYGONCE_DEVS_ETH_VIA_RHINE_H +//========================================================================== +// +// via_rhine.h +// +// VIA Rhine Ethernet chip +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-05-30 +// Purpose: Hardware description of VIA Rhine series. +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include // HAL_PCI_ macros + +//------------------------------------------------------------------------ +// Get macros from platform header +#define __WANT_CONFIG +#include CYGDAT_DEVS_ETH_VIA_RHINE_INL +#undef __WANT_CONFIG + +//------------------------------------------------------------------------ +// Set to perms of: +// 0 disables all debug output +// 1 for process debug output +// 2 for added data IO output: get_reg, put_reg +// 4 for packet allocation/free output +// 8 for only startup status, so we can tell we're installed OK +#define DEBUG 0x00 + +#if DEBUG & 1 +# define DEBUG_FUNCTION() do { diag_printf("%s\n", __FUNCTION__); } while (0) +#else +# define DEBUG_FUNCTION() do {} while(0) +#endif + +// ------------------------------------------------------------------------ +// Macros for keeping track of statistics +#if defined(ETH_DRV_GET_IF_STATS) || defined (ETH_DRV_GET_IF_STATS_UD) +#define KEEP_STATISTICS +#endif + +#ifdef KEEP_STATISTICS +#define INCR_STAT( _x_ ) (cpd->stats. _x_ ++) +#else +#define INCR_STAT( _x_ ) CYG_EMPTY_STATEMENT +#endif + +//------------------------------------------------------------------------ +// Cache translation +#ifndef CYGARC_UNCACHED_ADDRESS +# define CYGARC_UNCACHED_ADDRESS(x) (x) +#endif + +//------------------------------------------------------------------------ +// Address translation +#ifndef HAL_PCI_CPU_TO_BUS +# error "HAL PCI support must define translation macros" +#endif + +//------------------------------------------------------------------------ +// Macros for accessing structure elements + +#define _SU8( _base_, _offset_) \ + *((volatile cyg_uint8 *)((CYG_ADDRWORD)_base_+(_offset_))) +#define _SU16( _base_, _offset_) \ + *((volatile cyg_uint16 *)((CYG_ADDRWORD)_base_+(_offset_))) +#define _SU32( _base_, _offset_) \ + *((volatile cyg_uint32 *)((CYG_ADDRWORD)_base_+(_offset_))) + +#define _SI8( _base_, _offset_) \ + *((volatile cyg_int8 *)((CYG_ADDRWORD)_base_+(_offset_))) +#define _SI16( _base_, _offset_) \ + *((volatile cyg_int16 *)((CYG_ADDRWORD)_base_+(_offset_))) +#define _SI32( _base_, _offset_) \ + *((volatile cyg_int32 *)((CYG_ADDRWORD)_base_+(_offset_))) + +// ------------------------------------------------------------------------ +// Macros for accessing controller registers +#ifndef HAL_PCI_IO_READ_UINT8 +# define HAL_PCI_IO_READ_UINT8(addr, datum) HAL_READ_UINT8(addr, datum) +# define HAL_PCI_IO_WRITE_UINT8(addr, datum) HAL_WRITE_UINT8(addr, datum) +# define HAL_PCI_IO_READ_UINT16(addr, datum) HAL_READ_UINT16(addr, datum) +# define HAL_PCI_IO_WRITE_UINT16(addr, datum) HAL_WRITE_UINT16(addr, datum) +# define HAL_PCI_IO_READ_UINT32(addr, datum) HAL_READ_UINT32(addr, datum) +# define HAL_PCI_IO_WRITE_UINT32(addr, datum) HAL_WRITE_UINT32(addr, datum) +#endif + +// ------------------------------------------------------------------------ +// Control registers +#define RHINE_PAR0 0x00 +#define RHINE_PAR1 0x01 +#define RHINE_PAR2 0x02 +#define RHINE_PAR3 0x03 +#define RHINE_PAR4 0x04 +#define RHINE_PAR5 0x05 + +#define RHINE_RCR 0x06 +#define RHINE_TCR 0x07 +#define RHINE_CR0 0x08 +#define RHINE_CR1 0x09 + +#define RHINE_ISR 0x0c // 16 bit +#define RHINE_IMR 0x0e // 16 bit + +#define RHINE_CUR_RX 0x18 +#define RHINE_CUR_TX 0x1c + + +#define RHINE_PHYADR 0x6c +#define RHINE_MIISR 0x6d +#define RHINE_BCR0 0x6e +#define RHINE_BCR1 0x6f +#define RHINE_MIICR 0x70 +#define RHINE_MIIAD 0x71 +#define RHINE_MIIDATA 0x72 // 16 bit + + +#define RHINE_EECSR 0x74 + +#define RHINE_CFGA 0x78 +#define RHINE_CFGB 0x79 +#define RHINE_CFGC 0x7a +#define RHINE_CFGD 0x7b + +#define RHINE_STICKYHW 0x83 +#define RHINE_WOL_CR_CLR 0xa4 +#define RHINE_WOL_CG_CLR 0xa7 +#define RHINE_PWR_CSR_CLR 0xac + +#define RHINE_RCR_RRSF 0x80 +#define RHINE_RCR_RFT_64 0x00 +#define RHINE_RCR_RFT_SF 0x60 +#define RHINE_RCR_PRO 0x10 +#define RHINE_RCR_AB 0x08 +#define RHINE_RCR_AM 0x04 +#define RHINE_RCR_AR 0x02 +#define RHINE_RCR_SEP 0x01 + +#define RHINE_TCR_RTSF 0x80 +#define RHINE_TCR_TFT_64 0x00 +#define RHINE_TCR_TFT_SF 0x60 +#define RHINE_TCR_OFFSET 0x08 +#define RHINE_TCR_LB1 0x04 +#define RHINE_TCR_LB0 0x02 + +#define RHINE_CR0_RDMD 0x40 +#define RHINE_CR0_TDMD 0x20 +#define RHINE_CR0_TXON 0x10 +#define RHINE_CR0_RXON 0x08 +#define RHINE_CR0_STOP 0x04 +#define RHINE_CR0_STRT 0x02 +#define RHINE_CR0_INIT 0x01 + +#define RHINE_CR1_SRST 0x80 +#define RHINE_CR1_DPOLL 0x08 +#define RHINE_CR1_FDX 0x04 +#define RHINE_CR1_ETEN 0x02 +#define RHINE_CR1_EREN 0x01 + +#define RHINE_ISR_KEYI 0x8000 +#define RHINE_ISR_SRCI 0x4000 +#define RHINE_ISR_ABTI 0x2000 +#define RHINE_ISR_NORBF 0x1000 +#define RHINE_ISR_PKRACE 0x0800 +#define RHINE_ISR_OVFI 0x0400 +#define RHINE_ISR_ETI 0x0200 +#define RHINE_ISR_ERI 0x0100 +#define RHINE_ISR_CNT 0x0080 +#define RHINE_ISR_BE 0x0040 +#define RHINE_ISR_RU 0x0020 +#define RHINE_ISR_TU 0x0010 +#define RHINE_ISR_TXE 0x0008 +#define RHINE_ISR_RXE 0x0004 +#define RHINE_ISR_PTX 0x0002 +#define RHINE_ISR_PRX 0x0001 + +#define RHINE_IMR_KEYI 0x8000 +#define RHINE_IMR_SRCI 0x4000 +#define RHINE_IMR_ABTI 0x2000 +#define RHINE_IMR_NORBF 0x1000 +#define RHINE_IMR_PKRACE 0x0800 +#define RHINE_IMR_OVFI 0x0400 +#define RHINE_IMR_ETI 0x0200 +#define RHINE_IMR_ERI 0x0100 +#define RHINE_IMR_CNT 0x0080 +#define RHINE_IMR_BE 0x0040 +#define RHINE_IMR_RU 0x0020 +#define RHINE_IMR_TU 0x0010 +#define RHINE_IMR_TXE 0x0008 +#define RHINE_IMR_RXE 0x0004 +#define RHINE_IMR_PTX 0x0002 +#define RHINE_IMR_PRX 0x0001 + +#define RHINE_IMR_INIT (RHINE_IMR_PTX | RHINE_IMR_PRX | RHINE_IMR_RU) + +#define RHINE_BCR0_MAGIC_INIT 0x00 + +#define RHINE_BCR1_POT2 0x04 +#define RHINE_BCR1_POT1 0x02 +#define RHINE_BCR1_MAGIC_INIT (RHINE_BCR1_POT1|RHINE_BCR1_POT2) + + +#define RHINE_MIICR_MAUTO 0x80 +#define RHINE_MIICR_RCMD 0x40 +#define RHINE_MIICR_WCMD 0x20 +#define RHINE_MIICR_MDPM 0x10 +#define RHINE_MIICR_MOUT 0x08 +#define RHINE_MIICR_MDO 0x04 +#define RHINE_MIICR_MDI 0x02 +#define RHINE_MIICR_MDC 0x01 + +#define RHINE_MIISR_GPIO1POL 0x80 +#define RHINE_MIISR_MFDC 0x20 +#define RHINE_MIISR_PHYOPT 0x10 +#define RHINE_MIISR_MIIERR 0x08 +#define RHINE_MIISR_MRERR 0x04 +#define RHINE_MIISR_LNKFL 0x02 +#define RHINE_MIISR_SPEED 0x01 + +#define RHINE_EECSR_EEPR 0x80 +#define RHINE_EECSR_EMBP 0x40 +#define RHINE_EECSR_LOAD 0x20 +#define RHINE_EECSR_DPM 0x10 +#define RHINE_EECSR_ECS 0x08 +#define RHINE_EECSR_ECK 0x04 +#define RHINE_EECSR_EDI 0x02 +#define RHINE_EECSR_EDO 0x01 + + + +#define RHINE_CFGA_EELOAD 0x80 +#define RHINE_CFGA_JUMPER 0x40 +#define RHINE_CFGA_MMIEN 0x20 +#define RHINE_CFGA_MIIOPT 0x10 +#define RHINE_CFGA_AUTOOPT 0x08 +#define RHINE_CFGA_GPIO2I 0x04 +#define RHINE_CFGA_GPIO2O 0x02 +#define RHINE_CFGA_GPIO2OE 0x01 + +#define RHINE_CFGB_QPKTDIS 0x80 +#define RHINE_CFGB_TRACEN 0x40 +#define RHINE_CFGB_MRDM 0x20 +#define RHINE_CFGB_TXARBIT 0x10 +#define RHINE_CFGB_RXARBIT 0x08 +#define RHINE_CFGB_MWWAIT 0x04 +#define RHINE_CFGB_MRWAIT 0x02 +#define RHINE_CFGB_LATMEN 0x01 + +#define RHINE_CFGC_BROPT 0x40 +#define RHINE_CFGC_DLYEN 0x20 +#define RHINE_CFGC_BTSEL 0x08 +#define RHINE_CFGC_BPS2 0x04 +#define RHINE_CFGC_BPS1 0x02 +#define RHINE_CFGC_BPS0 0x01 + +#define RHINE_CFGD_GPIOEN 0x80 +#define RHINE_CFGD_DIAG 0x40 +#define RHINE_CFGD_MRDLEN 0x20 +#define RHINE_CFGD_MAGIC 0x10 +#define RHINE_CFGD_CRANDOM 0x08 +#define RHINE_CFGD_CAP 0x04 +#define RHINE_CFGD_MBA 0x02 +#define RHINE_CFGD_BAKOPT 0x01 + + + + +//---------------------------------------------------------------------------- +// Receive buffer Descriptor +#define RHINE_RDES0 0x00 // frame length, status registers +#define RHINE_RDES1 0x04 // receive length +#define RHINE_RDES2 0x08 // rx data buffer +#define RHINE_RDES3 0x0c // next +#define RHINE_RD_SIZE 0x10 + +#define RHINE_RDES0_OWN 0x80000000 +#define RHINE_RDES0_FLNG_mask 0x07ff0000 +#define RHINE_RDES0_FLNG_shift 16 +#define RHINE_RDES0_RXOK 0x00008000 +#define RHINE_RDES0_RES1 0x00004000 +#define RHINE_RDES0_MAR 0x00002000 +#define RHINE_RDES0_BAR 0x00001000 +#define RHINE_RDES0_PHY 0x00000800 +#define RHINE_RDES0_CHN 0x00000400 +#define RHINE_RDES0_STP 0x00000200 +#define RHINE_RDES0_EDP 0x00000100 +#define RHINE_RDES0_BUFF 0x00000080 +#define RHINE_RDES0_SERR 0x00000040 +#define RHINE_RDES0_RUNT 0x00000020 +#define RHINE_RDES0_LONG 0x00000010 +#define RHINE_RDES0_FOV 0x00000008 +#define RHINE_RDES0_FAE 0x00000004 +#define RHINE_RDES0_CRC 0x00000002 +#define RHINE_RDES0_RERR 0x00000001 + +#define RHINE_RD_RLEN_IC 0x00800000 +#define RHINE_RD_RLEN_C 0x00008000 +#define RHINE_RD_RLEN_RLEN_mask 0x000007ff + + +//---------------------------------------------------------------------------- +// Transmit buffer Descriptor +#define RHINE_TDES0 0x00 // status & own +#define RHINE_TDES1 0x04 // tx config & length +#define RHINE_TDES2 0x08 // tx data buffer +#define RHINE_TDES3 0x0c // next +#define RHINE_TD_SIZE 0x10 + +#define RHINE_TDES0_OWN 0x80000000 +#define RHINE_TDES0_TXOK 0x00008000 +#define RHINE_TDES0_JAB 0x00004000 +#define RHINE_TDES0_SERR 0x00002000 +#define RHINE_TDES0_RES1 0x00001000 +#define RHINE_TDES0_RES2 0x00000800 +#define RHINE_TDES0_CRS 0x00000400 +#define RHINE_TDES0_OWC 0x00000200 +#define RHINE_TDES0_ABT 0x00000100 +#define RHINE_TDES0_CDH 0x00000080 +#define RHINE_TDES0_NCR_mask 0x00000038 +#define RHINE_TDES0_NCR_shift 3 +#define RHINE_TDES0_RES3 0x00000004 +#define RHINE_TDES0_UDF 0x00000002 +#define RHINE_TDES0_DFR 0x00000001 + +#define RHINE_TDES1_TCR_mask 0x00ff0000 +#define RHINE_TDES1_TCR_shift 16 +#define RHINE_TDES1_IC 0x00800000 +#define RHINE_TDES1_EDP 0x00400000 +#define RHINE_TDES1_STP 0x00200000 +#define RHINE_TDES1_CRC 0x00010000 +#define RHINE_TDES1_C 0x00008000 +#define RHINE_TDES1_TLNG_mask 0x000007ff + +// ------------------------------------------------------------------------ + +#define MII_BMCR 0 +#define MII_BMSR 1 + +#define MII_BMCR_RENEGOTIATE 0x3300 + +#define MII_BMSR_AN_COMPLETE 0x0020 +#define MII_BMSR_LINK 0x0004 + +// ------------------------------------------------------------------------ + +#ifdef KEEP_STATISTICS +struct via_rhine_stats { + unsigned int tx_good ; + unsigned int tx_max_collisions ; + unsigned int tx_late_collisions ; + unsigned int tx_underrun ; + unsigned int tx_carrier_loss ; + unsigned int tx_deferred ; + unsigned int tx_sqetesterrors ; + unsigned int tx_single_collisions; + unsigned int tx_mult_collisions ; + unsigned int tx_total_collisions ; + unsigned int rx_good ; + unsigned int rx_crc_errors ; + unsigned int rx_align_errors ; + unsigned int rx_resource_errors ; + unsigned int rx_overrun_errors ; + unsigned int rx_collisions ; + unsigned int rx_short_frames ; + unsigned int rx_too_long_frames ; + unsigned int rx_symbol_errors ; + unsigned int interrupts ; + unsigned int rx_count ; + unsigned int rx_deliver ; + unsigned int rx_resource ; + unsigned int rx_restart ; + unsigned int tx_count ; + unsigned int tx_complete ; + unsigned int tx_dropped ; +}; +#endif + +typedef struct rhine_priv_data { + int index; + cyg_uint8 // (split up for atomic byte access) + found:1, // was hardware discovered? + mac_addr_ok:1, // can we bring up? + active:1, // has this if been brung up? + hardwired_esa:1, // set if ESA is hardwired via CDL + spare1:4; + + int txbusy; // A packet has been sent + unsigned long txkey; // Used to ack when packet sent + unsigned char* base; // Base address of controller IO region + cyg_vector_t interrupt; // Interrupt vector used by controller + unsigned char esa[6]; // Controller ESA + // Function to configure the ESA - may fetch ESA from EPROM or + // RedBoot config option. + void (*config_esa)(struct rhine_priv_data* cpd); + void *ndp; // Network Device Pointer + + cyg_handle_t interrupt_handle; + cyg_interrupt interrupt_object; + + int devid; + + int phys_id; // ID of physical MII controller + + cyg_uint8* rx_buffers; // ptr to base of buffer mem + cyg_uint8* rx_ring; // ptr to base of rx ring memory + int rx_ring_cnt; // number of entries in ring + int rx_ring_log_cnt; // log of above + int rx_ring_next; // index of next full ring entry + + cyg_uint8* tx_buffers; + cyg_uint8* tx_ring; + int tx_ring_cnt; + int tx_ring_log_cnt; + int tx_ring_free; // index of next free ring entry + int tx_ring_alloc; // index of first controller owned ring + int tx_ring_owned; // number of controller owned ring entries + + int rxpacket; +#ifdef KEEP_STATISTICS + struct via_rhine_stats stats; +#endif +} rhine_priv_data; + +// ------------------------------------------------------------------------ +#endif CYGONCE_DEVS_ETH_VIA_RHINE_H +// EOF via_rhine.h diff --git a/packages/devs/flash/amd/am29xxxxx/current/ChangeLog b/packages/devs/flash/amd/am29xxxxx/current/ChangeLog --- a/packages/devs/flash/amd/am29xxxxx/current/ChangeLog +++ b/packages/devs/flash/amd/am29xxxxx/current/ChangeLog @@ -1,3 +1,8 @@ +2002-04-24 Bob Koninckx + + * cdl/flash_amd_am29xxxxx.cdl: Support AM29LV200 and ST M29W200B. + * include/flash_am29xxxxx_parts.inl: Likewise. + 2002-01-03 Jonathan Larmour 2001-12-20 Koichi Nagashima @@ -140,27 +145,36 @@ 2000-10-20 Gary Thomas + + * cdl/flash_arm_aaed2000.cdl: Removed ARM Boot Monitor protection + requirement. + +2001-10-31 Jesper Skov + + * cdl/flash_arm_aaed2000.cdl: Require protection from ARM Boot + Monitor. + +2001-10-30 Jesper Skov + + * Imported sources from Gary Thomas. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/arm/aaed2000/current/cdl/flash_arm_aaed2000.cdl b/packages/devs/flash/arm/aaed2000/current/cdl/flash_arm_aaed2000.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/aaed2000/current/cdl/flash_arm_aaed2000.cdl @@ -0,0 +1,71 @@ +# ==================================================================== +# +# flash_arm_aaed2000.cdl +# +# FLASH memory - Hardware support on Agilent AAED2000 +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov, gthomas +# Original data: jskov +# Contributors: +# Date: 2001-10-27 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_ARM_AAED2000 { + display "Agilent AAED2000 FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_ARM_ARM9_AAED2000 + + implements CYGHWR_IO_FLASH_DEVICE + + compile aaed2000_flash.c + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED { + display "Generic AMD flash driver required" + } + + implements CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED + requires CYGHWR_DEVS_FLASH_AMD_AM29LV640 +} diff --git a/packages/devs/flash/arm/aaed2000/current/src/aaed2000_flash.c b/packages/devs/flash/arm/aaed2000/current/src/aaed2000_flash.c new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/aaed2000/current/src/aaed2000_flash.c @@ -0,0 +1,74 @@ +//========================================================================== +// +// aaed2000_flash.c +// +// Flash programming for Fujitsu/AMD device on Agilent AAED2000 +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov, gthomas +// Contributors: jskov +// Date: 2001-10-27 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +//-------------------------------------------------------------------------- +// Device properties + +#define CYGNUM_FLASH_INTERLEAVE (2) +#define CYGNUM_FLASH_SERIES (2) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (0x60000000) + +//static cyg_uint32 plf_flash_base; + +//-------------------------------------------------------------------------- +// Platform specific extras +#define CYGHWR_FLASH_AM29XXXXX_NO_WRITE_PROTECT // This feature fails :-( + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_am29xxxxx.inl" + +// ------------------------------------------------------------------------ +// EOF aaed2000_flash.c diff --git a/packages/devs/flash/arm/assabet/current/ChangeLog b/packages/devs/flash/arm/assabet/current/ChangeLog --- a/packages/devs/flash/arm/assabet/current/ChangeLog +++ b/packages/devs/flash/arm/assabet/current/ChangeLog @@ -43,27 +43,36 @@ 2000-08-24 Gary Thomas + + * include/cerf_strataflash.inl: + * cdl/flash_cerf.cdl: New file(s) - port to Intrinsyc CerfCube. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/arm/cerf/current/cdl/flash_cerf.cdl b/packages/devs/flash/arm/cerf/current/cdl/flash_cerf.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/cerf/current/cdl/flash_cerf.cdl @@ -0,0 +1,80 @@ +# ==================================================================== +# +# flash_cerf.cdl +# +# FLASH memory - Hardware support on Intrinsyc CerfCube +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Original data: gthomas +# Contributors: +# Date: 2000-07-26 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_CERF { + display "Intrinsyc SA1110 (Cerf) FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_ARM_SA11X0_CERF + + requires CYGPKG_DEVS_FLASH_STRATA + + implements CYGHWR_IO_FLASH_BLOCK_LOCKING + + include_dir cyg/io + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED { + display "Generic StrataFLASH driver required" + } + + implements CYGINT_DEVS_FLASH_STRATA_REQUIRED + + define_proc { + puts $::cdl_system_header "/***** strataflash driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG " + puts $::cdl_system_header "/***** strataflash driver proc output end *****/" + } +} + diff --git a/packages/devs/flash/arm/cerf/current/include/cerf_strataflash.inl b/packages/devs/flash/arm/cerf/current/include/cerf_strataflash.inl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/cerf/current/include/cerf_strataflash.inl @@ -0,0 +1,70 @@ +#ifndef CYGONCE_DEVS_FLASH_CERF_STRATAFLASH_INL +#define CYGONCE_DEVS_FLASH_CERF_STRATAFLASH_INL +//========================================================================== +// +// cerf_strataflash.inl +// +// Flash programming - device constants, etc. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas, hmt +// Contributors: gthomas +// Date: 2001-02-24 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== +#include // Hardware definitions +#include // Platform specifics + + +// The cerf has one 16-bit device. +// StrataFlash 28F128. + +#define CYGNUM_FLASH_DEVICES (1) +#define CYGNUM_FLASH_BASE_MASK (0xFF000000u) // 16Mb + +#define CYGNUM_FLASH_BASE (0x50000000u) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BLANK (1) + +#endif // CYGONCE_DEVS_FLASH_CERF_STRATAFLASH_INL +// ------------------------------------------------------------------------ +// EOF cerf_strataflash.inl diff --git a/packages/devs/flash/arm/cerfpda/current/ChangeLog b/packages/devs/flash/arm/cerfpda/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/cerfpda/current/ChangeLog @@ -0,0 +1,39 @@ +2002-02-04 Gary Thomas + + * include/cerfpda_strataflash.inl: + * cdl/flash_cerfpda.cdl: New file(s) - port to Intrinsyc CerfPDA. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/arm/cerfpda/current/cdl/flash_cerfpda.cdl b/packages/devs/flash/arm/cerfpda/current/cdl/flash_cerfpda.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/cerfpda/current/cdl/flash_cerfpda.cdl @@ -0,0 +1,80 @@ +# ==================================================================== +# +# flash_cerfpda.cdl +# +# FLASH memory - Hardware support on Intrinsyc CerfPDA +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Original data: gthomas +# Contributors: +# Date: 2000-07-26 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_CERFPDA { + display "Intrinsyc cerfpda FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_ARM_SA11X0_CERFPDA + + requires CYGPKG_DEVS_FLASH_STRATA + + implements CYGHWR_IO_FLASH_BLOCK_LOCKING + + include_dir cyg/io + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED { + display "Generic StrataFLASH driver required" + } + + implements CYGINT_DEVS_FLASH_STRATA_REQUIRED + + define_proc { + puts $::cdl_system_header "/***** strataflash driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG " + puts $::cdl_system_header "/***** strataflash driver proc output end *****/" + } +} + diff --git a/packages/devs/flash/arm/cerfpda/current/include/cerfpda_strataflash.inl b/packages/devs/flash/arm/cerfpda/current/include/cerfpda_strataflash.inl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/cerfpda/current/include/cerfpda_strataflash.inl @@ -0,0 +1,69 @@ +#ifndef CYGONCE_DEVS_FLASH_CERFPDA_STRATAFLASH_INL +#define CYGONCE_DEVS_FLASH_CERFPDA_STRATAFLASH_INL +//========================================================================== +// +// cerfpda_strataflash.inl +// +// Flash programming - device constants, etc. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas, hmt +// Contributors: gthomas +// Date: 2001-02-24 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== +#include // Hardware definitions +#include // Platform specifics + + +// The cerfpda has 2 16-bit device. +// StrataFlash 28F128. 16Mbyte. + +#define CYGNUM_FLASH_DEVICES (2) +#define CYGNUM_FLASH_BASE_MASK (0xFE000000u) // 32Mb +#define CYGNUM_FLASH_BASE (0x50000000u) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BLANK (1) + +#endif // CYGONCE_DEVS_FLASH_CERFPDA_STRATAFLASH_INL +// ------------------------------------------------------------------------ +// EOF cerfpda_strataflash.inl diff --git a/packages/devs/flash/arm/ebsa285/current/ChangeLog b/packages/devs/flash/arm/ebsa285/current/ChangeLog --- a/packages/devs/flash/arm/ebsa285/current/ChangeLog +++ b/packages/devs/flash/arm/ebsa285/current/ChangeLog @@ -45,27 +45,36 @@ 2000-08-14 Gary Thomas + + * cdl/flash_edb7xxx.cdl: Missed change in include file location + for StrataFLASH changes. + 2001-10-12 Jonathan Larmour * cdl/flash_edb7xxx.cdl: Move EP72xx flash into separate subcomponent. Clarify package description strings. + Move EP73xx strataflash support into here as another subcomponent. + + * cdl/flash_strata_edb7xxx.cdl: Delete. + +2001-09-25 Gary Thomas + + * include/edb7xxx_strataflash.inl: + * cdl/flash_strata_edb7xxx.cdl: New setup for EDB7312 which uses + Intel StrataFlash devices. + 2001-06-11 Gary Thomas * src/edb7xxx_flash.c: Remove dependency on printf() via user functions. @@ -36,27 +51,36 @@ 2000-08-15 Gary Thomas " + puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG " + puts $::cdl_system_header "/***** strataflash driver proc output end *****/" + } + } } diff --git a/packages/devs/flash/arm/edb7xxx/current/include/edb7xxx_strataflash.inl b/packages/devs/flash/arm/edb7xxx/current/include/edb7xxx_strataflash.inl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/edb7xxx/current/include/edb7xxx_strataflash.inl @@ -0,0 +1,66 @@ +#ifndef CYGONCE_DEVS_FLASH_EDB7XXX_STRATAFLASH_INL +#define CYGONCE_DEVS_FLASH_EDB7XXX_STRATAFLASH_INL +//========================================================================== +// +// edb7xxx_strataflash.inl +// +// Flash programming - device constants, etc. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-09-24 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +// The edb7xxx system has one 16-bit device. + +#define CYGNUM_FLASH_DEVICES (1) +#define CYGNUM_FLASH_BASE (0xE0000000u) +#define CYGNUM_FLASH_BASE_MASK (0xFE000000u) // 32Mb devices +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BLANK (1) + +#endif // CYGONCE_DEVS_FLASH_EDB7XXX_STRATAFLASH_INL +// ------------------------------------------------------------------------ +// EOF edb7xxx_strataflash.inl diff --git a/packages/devs/flash/arm/edb7xxx/current/src/edb7xxx_flash.c b/packages/devs/flash/arm/edb7xxx/current/src/edb7xxx_flash.c --- a/packages/devs/flash/arm/edb7xxx/current/src/edb7xxx_flash.c +++ b/packages/devs/flash/arm/edb7xxx/current/src/edb7xxx_flash.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/edb7xxx/current/src/flash.h b/packages/devs/flash/arm/edb7xxx/current/src/flash.h --- a/packages/devs/flash/arm/edb7xxx/current/src/flash.h +++ b/packages/devs/flash/arm/edb7xxx/current/src/flash.h @@ -5,29 +5,38 @@ // Flash programming - device constants, etc. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/edb7xxx/current/src/flash_erase_block.c b/packages/devs/flash/arm/edb7xxx/current/src/flash_erase_block.c --- a/packages/devs/flash/arm/edb7xxx/current/src/flash_erase_block.c +++ b/packages/devs/flash/arm/edb7xxx/current/src/flash_erase_block.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/edb7xxx/current/src/flash_program_buf.c b/packages/devs/flash/arm/edb7xxx/current/src/flash_program_buf.c --- a/packages/devs/flash/arm/edb7xxx/current/src/flash_program_buf.c +++ b/packages/devs/flash/arm/edb7xxx/current/src/flash_program_buf.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/edb7xxx/current/src/flash_query.c b/packages/devs/flash/arm/edb7xxx/current/src/flash_query.c --- a/packages/devs/flash/arm/edb7xxx/current/src/flash_query.c +++ b/packages/devs/flash/arm/edb7xxx/current/src/flash_query.c @@ -5,29 +5,38 @@ // Flash programming - query device // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/excalibur/current/ChangeLog b/packages/devs/flash/arm/excalibur/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/excalibur/current/ChangeLog @@ -0,0 +1,44 @@ +2001-08-17 Jesper Skov + [from branch] + * src/arm_excalibur_flash.c: Use all 4 flash parts. + + * cdl/flash_excalibur.cdl: Fix typo. + +2001-08-10 Jesper Skov + + * Created. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/arm/excalibur/current/cdl/flash_excalibur.cdl b/packages/devs/flash/arm/excalibur/current/cdl/flash_excalibur.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/excalibur/current/cdl/flash_excalibur.cdl @@ -0,0 +1,71 @@ +# ==================================================================== +# +# flash_excalibur.cdl +# +# FLASH memory - Hardware support on Altera ARM9/Excalibur +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: jskov +# Date: 2001-08-07 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_ARM_EXCALIBUR { + display "Altera ARM9/Excalibur FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_ARM_ARM9_EXCALIBUR + + implements CYGHWR_IO_FLASH_DEVICE + + compile arm_excalibur_flash.c + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED { + display "Generic Intel FlashFile driver required" + } + + implements CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED + + requires CYGHWR_DEVS_FLASH_INTEL_28F320C3 +} diff --git a/packages/devs/flash/arm/excalibur/current/src/arm_excalibur_flash.c b/packages/devs/flash/arm/excalibur/current/src/arm_excalibur_flash.c new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/excalibur/current/src/arm_excalibur_flash.c @@ -0,0 +1,72 @@ +//========================================================================== +// +// arm_excalibur_flash.c +// +// Flash programming for Intel FlashFile devices on ARM Excalibur board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-08-07 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +//-------------------------------------------------------------------------- +// Device properties + +// We use the four Intel 28F320C3 parts on the Excalibur board. +#define CYGNUM_FLASH_INTERLEAVE (1) +#define CYGNUM_FLASH_SERIES (4) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (EXCALIBUR_FLASH_PHYS_BASE) + +//-------------------------------------------------------------------------- +// Platform specific extras + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_28fxxx.inl" + +// ------------------------------------------------------------------------ +// EOF arm_excalibur_flash.c diff --git a/packages/devs/flash/arm/flexanet/current/ChangeLog b/packages/devs/flash/arm/flexanet/current/ChangeLog --- a/packages/devs/flash/arm/flexanet/current/ChangeLog +++ b/packages/devs/flash/arm/flexanet/current/ChangeLog @@ -3,27 +3,36 @@ 2001-07-27 Jordi Colomer * Add SA11x0/Flexanet flash driver support //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/devs/flash/arm/flexanet/current/cdl/flash_flexanet.cdl b/packages/devs/flash/arm/flexanet/current/cdl/flash_flexanet.cdl --- a/packages/devs/flash/arm/flexanet/current/cdl/flash_flexanet.cdl +++ b/packages/devs/flash/arm/flexanet/current/cdl/flash_flexanet.cdl @@ -5,29 +5,38 @@ # FLASH memory - Hardware support on Intel StrongARM SA1110 # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/devs/flash/arm/flexanet/current/include/flexanet_strataflash.inl b/packages/devs/flash/arm/flexanet/current/include/flexanet_strataflash.inl --- a/packages/devs/flash/arm/flexanet/current/include/flexanet_strataflash.inl +++ b/packages/devs/flash/arm/flexanet/current/include/flexanet_strataflash.inl @@ -7,29 +7,38 @@ // Flash programming - device constants, etc. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/integrator/current/ChangeLog b/packages/devs/flash/arm/integrator/current/ChangeLog --- a/packages/devs/flash/arm/integrator/current/ChangeLog +++ b/packages/devs/flash/arm/integrator/current/ChangeLog @@ -1,30 +1,55 @@ +2002-03-06 Nick Garnett + + * cdl/flash_integrator.cdl: Converted to use generic 28Fxxx flash + driver. + + * src/arm_integrator_flash.c: + This file added to parameterize generic FLASH driver. Also define + here CYGHWR_FLASH_WRITE_ENABLE() and CYGHWR_FLASH_WRITE_DISABLE() + to turn FLASH writing on and off. + + * src/flash.h: + * src/flash_erase_block.c: + * src/flash_program_buf.c: + * src/flash_query.c: + Files removed. These are the old flash driver. + 2001-10-30 Philippe Robin 2001-10-30 Jonathan Larmour * Initial version of ARM Integrator flash driver. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/devs/flash/arm/integrator/current/cdl/flash_integrator.cdl b/packages/devs/flash/arm/integrator/current/cdl/flash_integrator.cdl --- a/packages/devs/flash/arm/integrator/current/cdl/flash_integrator.cdl +++ b/packages/devs/flash/arm/integrator/current/cdl/flash_integrator.cdl @@ -2,83 +2,70 @@ # # flash_integrator.cdl # -# FLASH memory - Hardware support on ARM INTEGRATOR +# FLASH memory - Hardware support on ARM Integrator # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # -# Author(s): Philippe Robin -# Original data: gthomas -# Contributors: -# Date: November 7, 2000 +# Author(s): jskov, nickg +# Contributors: jskov +# Date: 2002-02-27 # #####DESCRIPTIONEND#### # # ==================================================================== -cdl_package CYGPKG_DEVS_FLASH_INTEGRATOR { - display "ARM INTEGRATOR FLASH memory support" +cdl_package CYGPKG_DEVS_FLASH_ARM_INTEGRATOR { + display "ARM Integrator FLASH memory support" parent CYGPKG_IO_FLASH active_if CYGPKG_IO_FLASH - active_if CYGPKG_HAL_ARM_INTEGRATOR - requires { CYGNUM_FLASH_WORKSPACE_SIZE == 0x10000 } - - implements CYGINT_REDBOOT_ARM_FLASH_SIB_SUPPORTED + requires CYGPKG_HAL_ARM_INTEGRATOR + implements CYGHWR_IO_FLASH_DEVICE - include_dir . -# include_files ; # none _exported_ whatsoever - description "FLASH memory device support for ARM INTEGRATOR" - compile integrator_flash.c + compile arm_integrator_flash.c - make -priority 1 { - flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c - echo " .globl flash_erase_block_end" >>flash_erase_block.s - echo "flash_erase_block_end:" >>flash_erase_block.s - $(CC) -c -o flash_erase_block.o flash_erase_block.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED { + display "Generic Intel FlashFile driver required" } - make -priority 1 { - flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c - echo " .globl flash_program_buf_end" >>flash_program_buf.s - echo "flash_program_buf_end:" >>flash_program_buf.s - $(CC) -c -o flash_program_buf.o flash_program_buf.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o - } - make -priority 1 { - flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c - echo " .globl flash_query_end" >>flash_query.s - echo "flash_query_end:" >>flash_query.s - $(CC) -c -o flash_query.o flash_query.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o - } + + implements CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED + + requires CYGHWR_DEVS_FLASH_INTEL_28F320S3 } - diff --git a/packages/devs/flash/arm/integrator/current/src/arm_integrator_flash.c b/packages/devs/flash/arm/integrator/current/src/arm_integrator_flash.c new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/integrator/current/src/arm_integrator_flash.c @@ -0,0 +1,106 @@ +//========================================================================== +// +// arm_integrator_flash.c +// +// Flash programming for Intel FlashFile devices on ARM Integrator board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-08-07 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +//-------------------------------------------------------------------------- +// Device properties + +// We use the eight Intel 28F320S3 parts on the Integrator board. +// These are arranged in a 2x4 grid, giving 32 bits wide by 32MB long. + +#define CYGNUM_FLASH_INTERLEAVE (2) +#define CYGNUM_FLASH_SERIES (4) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (0x24000000) + +//-------------------------------------------------------------------------- +// Platform specific extras + +#define CYGHWR_FLASH_WRITE_ENABLE() \ + { \ + volatile cyg_uint32 *ebi_csr1 = (volatile cyg_uint32 *)INTEGRATOR_EBI_CSR1; \ + \ + /* allow write access to EBI_CSR1 area (Flash) */ \ + *ebi_csr1 |= INTEGRATOR_EBI_WRITE_ENABLE; \ + \ + if (!(*ebi_csr1 & INTEGRATOR_EBI_WRITE_ENABLE)) { \ + *(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 0xA05F; \ + *ebi_csr1 |= INTEGRATOR_EBI_WRITE_ENABLE; \ + *(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 0; \ + } \ + \ + /* Enable Vpp and allow write access to Flash in system controller */ \ + *(volatile unsigned int *)INTEGRATOR_SC_CTRLS = FL_SC_CONTROL; \ + } + +#define CYGHWR_FLASH_WRITE_DISABLE() \ + { \ + volatile cyg_uint32 *ebi_csr1 = (volatile cyg_uint32 *)INTEGRATOR_EBI_CSR1; \ + \ + /* disable write access to EBI_CSR1 area (Flash) */ \ + *ebi_csr1 &= ~INTEGRATOR_EBI_WRITE_ENABLE; \ + \ + if (*ebi_csr1 & INTEGRATOR_EBI_WRITE_ENABLE) { \ + *(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 0xA05F; \ + *ebi_csr1 &= ~INTEGRATOR_EBI_WRITE_ENABLE; \ + *(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 1; \ + } \ + \ + /* Disable Vpp and disable write access to Flash in system controller */ \ + *(volatile unsigned int *)INTEGRATOR_SC_CTRLS = 0; \ + } + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_28fxxx.inl" + +// ------------------------------------------------------------------------ +// EOF arm_integrator_flash.c diff --git a/packages/devs/flash/arm/integrator/current/src/flash.h b/packages/devs/flash/arm/integrator/current/src/flash.h deleted file mode 100644 --- a/packages/devs/flash/arm/integrator/current/src/flash.h +++ /dev/null @@ -1,65 +0,0 @@ -//========================================================================== -// -// flash.h -// -// Flash programming - device constants, etc. -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: Philippe Robin -// Date: November 7, 2000 -// Purpose: -// Description: -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#ifndef _FLASH_HWR_H_ -#define _FLASH_HWR_H_ - -// INTEGRATOR FLASH layout -// 4x 28F008SA, one device per byte-lane -// each device is 16x64k blocks - -#define FLASH_Read_ID 0x90909090 -#define FLASH_Read_Status 0x70707070 -#define FLASH_Clear_Status 0x50505050 -#define FLASH_Status_Ready 0x80808080 -#define FLASH_Program 0x10101010 -#define FLASH_Block_Erase 0x20202020 -#define FLASH_Confirm 0xD0D0D0D0 -#define FLASH_Reset 0xFFFFFFFF - -#define FLASH_BLOCK_SIZE 0x20000 - -#define FLASH_Intel_code 0x89 -#define FLASH_28F320 0xD4 - -#endif // _FLASH_HWR_H_ diff --git a/packages/devs/flash/arm/integrator/current/src/flash_erase_block.c b/packages/devs/flash/arm/integrator/current/src/flash_erase_block.c deleted file mode 100644 --- a/packages/devs/flash/arm/integrator/current/src/flash_erase_block.c +++ /dev/null @@ -1,92 +0,0 @@ -//========================================================================== -// -// flash_erase_block.c -// -// Flash programming -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: Philippe Robin -// Date: November 7, 2000 -// Purpose: -// Description: -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include "flash.h" - -#include -#include -#include -#include - -// -// CAUTION! This code must be copied to RAM before execution. Therefore, -// it must not contain any code which might be position dependent! -// - -int -flash_erase_block(volatile cyg_uint32 *block) -{ - volatile cyg_uint32 stat = 0; - int timeout = 5000000; - int cache_on; - - HAL_DCACHE_IS_ENABLED(cache_on); - if (cache_on) { - HAL_DCACHE_SYNC(); - HAL_DCACHE_DISABLE(); - } - - HAL_FLASH_WRITE_ENABLE(); - // Clear any error conditions - *block = FLASH_Clear_Status; - - // Set to erase - *block = FLASH_Block_Erase; - *block = FLASH_Confirm; - while((stat & FLASH_Status_Ready) != FLASH_Status_Ready) { - *block = FLASH_Read_Status; - stat = *block; - if (--timeout == 0) break; - } - - // Restore ROM to "normal" mode - *block = FLASH_Reset; - - HAL_FLASH_WRITE_DISABLE(); - - if (cache_on) { - HAL_DCACHE_ENABLE(); - } - - return stat; -} diff --git a/packages/devs/flash/arm/integrator/current/src/flash_program_buf.c b/packages/devs/flash/arm/integrator/current/src/flash_program_buf.c deleted file mode 100644 --- a/packages/devs/flash/arm/integrator/current/src/flash_program_buf.c +++ /dev/null @@ -1,99 +0,0 @@ -//========================================================================== -// -// flash_program_buf.c -// -// Flash programming -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: Philippe Robin -// Date: November 7, 2000 -// Purpose: -// Description: -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include "flash.h" - -#include -#include -#include -#include - -// -// CAUTION! This code must be copied to RAM before execution. Therefore, -// it must not contain any code which might be position dependent! -// - -int -flash_program_buf(volatile unsigned long *addr, unsigned long *data, int len) -{ - unsigned long stat; - int timeout = 5000000; - int cache_on; - volatile unsigned long *orig_addr = addr; - - HAL_DCACHE_IS_ENABLED(cache_on); - if (cache_on) { - HAL_DCACHE_SYNC(); - HAL_DCACHE_DISABLE(); - } - - HAL_FLASH_WRITE_ENABLE(); - - // Clear any error conditions - *addr = FLASH_Clear_Status; - - while (len > 0) { - *addr = FLASH_Program; - *addr = *data++; - timeout = 5000000; - while(((stat = *addr) & FLASH_Status_Ready) != FLASH_Status_Ready) { - if (--timeout == 0) { - goto bad; - } - } - addr++; - len -= sizeof(unsigned long); - } - - // Restore ROM to "normal" mode - bad: - *orig_addr = FLASH_Reset; - - HAL_FLASH_WRITE_DISABLE(); - - if (cache_on) { - HAL_DCACHE_ENABLE(); - } - - return stat; -} diff --git a/packages/devs/flash/arm/integrator/current/src/flash_query.c b/packages/devs/flash/arm/integrator/current/src/flash_query.c deleted file mode 100644 --- a/packages/devs/flash/arm/integrator/current/src/flash_query.c +++ /dev/null @@ -1,93 +0,0 @@ -//========================================================================== -// -// flash_query.c -// -// Flash programming - query device -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: Philippe Robin -// Date: November 7, 2000 -// Purpose: -// Description: -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include "flash.h" - -#include -#include -#include -#include - -// -// CAUTION! This code must be copied to RAM before execution. Therefore, -// it must not contain any code which might be position dependent! -// - -#define CNT 20*1000*10 // Approx 200ms - -int -flash_query(unsigned char *data) -{ - volatile unsigned long *lROM; - volatile unsigned char *cROM; - int i, cnt; - int cache_on; - volatile cyg_uint8 *ptr = 0x24000000; - cyg_uint8 val; - - HAL_DCACHE_IS_ENABLED(cache_on); - if (cache_on) { - HAL_DCACHE_SYNC(); - HAL_DCACHE_DISABLE(); - } - - HAL_FLASH_WRITE_ENABLE(); - - lROM = 0x24000000; - cROM = 0x24000000; - - lROM[0] = FLASH_Read_ID; - for (cnt = CNT; cnt > 0; cnt--) ; - for (i = 0; i < 8; i++) { - *data++ = cROM[i]; - } - lROM[0] = FLASH_Reset; - - HAL_FLASH_WRITE_DISABLE(); - - if (cache_on) { - HAL_DCACHE_ENABLE(); - } - - return 0; -} diff --git a/packages/devs/flash/arm/integrator/current/src/integrator_flash.c b/packages/devs/flash/arm/integrator/current/src/integrator_flash.c deleted file mode 100644 --- a/packages/devs/flash/arm/integrator/current/src/integrator_flash.c +++ /dev/null @@ -1,1016 +0,0 @@ -//========================================================================== -// -// integrator_flash.c -// -// Flash programming -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: Philippe Robin -// Date: November 7, 2000 -// Purpose: -// Description: -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include -#include -#include - -#define _FLASH_PRIVATE_ -#include - -#include "flash.h" - -#define ARM_INTEGRATOR_FLASH - -extern int strncmp(const char *s1, const char *s2, int len); - -#define INTEGRATOR_NUM_REGIONS 256 - -int -flash_hwr_init(void) -{ - unsigned char data[96]; - extern char flash_query, flash_query_end; - typedef int code_fun(unsigned char *); - code_fun *_flash_query; - int code_len, stat, num_regions, region_size; - - // Copy 'program' code to RAM for execution - code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query; - _flash_query = (code_fun *)flash_info.work_space; - memcpy(_flash_query, &flash_query, code_len); - HAL_DCACHE_SYNC(); // Should guarantee this code will run - HAL_ICACHE_DISABLE(); // is also required to avoid old contents - - stat = (*_flash_query)(data); - - HAL_ICACHE_ENABLE(); - - if ( data[4] == FLASH_28F320 ) { - num_regions = INTEGRATOR_NUM_REGIONS; - region_size = FLASH_BLOCK_SIZE; - flash_info.block_size = region_size; - flash_info.blocks = num_regions; - flash_info.start = (void *)0x24000000; - flash_info.end = (void *)(0x24000000+(num_regions*region_size)); - return FLASH_ERR_OK; - } else { - diag_printf("Can't identify FLASH, sorry\n"); - diag_dump_buf(data, sizeof(data)); - return FLASH_ERR_HWR; - } -} - -// Map a hardware status to a package error -int -flash_hwr_map_error(int err) -{ - if (err & 0x7E) { - if (err & 0x10) { - return FLASH_ERR_PROGRAM; - } else - if (err & 0x20) { - return FLASH_ERR_ERASE; - } else - return FLASH_ERR_HWR; // FIXME - } else { - return FLASH_ERR_OK; - } -} - -// See if a range of FLASH addresses overlaps currently running code -bool -flash_code_overlaps(void *start, void *end) -{ - extern char _stext, _etext; - - return ((((unsigned long)&_stext >= (unsigned long)start) && - ((unsigned long)&_stext < (unsigned long)end)) || - (((unsigned long)&_etext >= (unsigned long)start) && - ((unsigned long)&_etext < (unsigned long)end))); -} - - -#ifdef ARM_INTEGRATOR_FLASH -#define FLASH_BASE 0x24000000 -#define FLASH_SIZE 0x02000000 - -/* type information :- - * 0xffff ffff - deleted (usual flash erased value) - * 0x0000 xxxx - Reserved for ARM usage: - * Bit 0 - ARM Executable Image - * Bit 1 - System Information Block - * Bit 2 - File System Block - * 0xyyyy 0000 - Available for customers (y != 0) - */ -#define TYPE_DELETED 0xFFFFFFFF -#define TYPE_ARM_MASK 0x0000FFFF -#define TYPE_CUSTOM_MASK 0xFFFF0000 -#define TYPE_ARM_EXEC 0x00000001 -#define TYPE_ARM_SIB 0x00000002 -#define TYPE_ARM_SYSBLOCK 0x00000004 - -/* Filetypes */ - -#define UNKNOWN_FILE 0x00000000 -#define MOT_S_RECORD 0x00000001 -#define INTEL_HEX 0x00000002 -#define ELF 0x00000004 -#define DWARF 0x00000008 -#define ARM_AOF 0x00000010 -#define ARM_AIF 0x00000020 -#define PLAIN_BINARY 0x00000040 -#define ARM_AIF_BIN 0x00000080 -#define MCS_TYPE 0x00000100 - -#define CONVERT_TYPE (MOT_S_RECORD | INTEL_HEX | MCS_TYPE | ELF) - -#define SIB_OWNER_STRING_SIZE 32 -#define MAX_SIB_SIZE 512 -#define MAX_SIB_INDEX 64 - -#define NoOfElements(array) (sizeof(array) / sizeof(array[0])) -#define AddressToBlock(address) ((((cyg_uint32)(address)) - FLASH_BASE) / FLASH_BLOCK_SIZE) -#define BlockToAddress(block) (((block) * FLASH_BLOCK_SIZE) + FLASH_BASE) -#define BlockBaseAddress(address) (((cyg_uint32)(address)) & ~(FLASH_BLOCK_SIZE - 1)) -#define FooterAddress(block) ((tFooter *)((BlockToAddress(block) + FLASH_BLOCK_SIZE) \ - - sizeof (tFooter))) -#define InFlash(address) ((((cyg_uint32)(address)) >= FLASH_BASE) && (((cyg_uint32)(address))\ - < (FLASH_BASE + FLASH_SIZE))) - -#define NO_OF_BLOCKS (FLASH_SIZE / FLASH_BLOCK_SIZE) - -#define SIB_HEADER_SIGNATURE 0xA00FFF9F /* This is an invalid instruction - MULGE pc,pc,pc */ -#define FLASH_FOOTER_SIGNATURE 0xA0FFFF9F /* This is an invalid instruction - SMULALGES pc,pc,pc */ - - -typedef struct SIBType { - cyg_uint32 signature; - cyg_uint32 size; - char owner[SIB_OWNER_STRING_SIZE]; - cyg_uint32 index; - cyg_uint32 revision; - cyg_uint32 checksum; -} tSIB; - -typedef struct SIBInfoType { - cyg_uint32 SIB_number; /* Unique number of SIB Block */ - cyg_uint32 SIB_Extension; /* Base of SIB Flash Block */ - char Label[16]; /* String space for ownership string */ - cyg_uint32 checksum; /* SIB Image checksum */ -} tSIBInfo; - -typedef struct FooterType { - void *infoBase; /* Address of first word of ImageFooter */ - char *blockBase; /* Start of area reserved by this footer */ - cyg_uint32 signature; /* 'Magic' number proves it's a footer */ - cyg_uint32 type; /* Area type: ARM Image, SIB, customer */ - cyg_uint32 checksum; /* Just this structure */ -} tFooter ; - -typedef struct ImageInfoType { - cyg_uint32 bootFlags; /* Boot flags, compression etc. */ - cyg_uint32 imageNumber; /* Unique number, selects for boot etc. */ - char *loadAddress; /* Address program should be loaded to */ - cyg_uint32 length; /* Actual size of image */ - char *address; /* Image is executed from here */ - char name[16]; /* Null terminated */ - char *headerBase; /* Flash Address of any stripped header */ - cyg_uint32 header_length; /* Length of header in memory */ - cyg_uint32 headerType; /* AIF, RLF, s-record etc. */ - cyg_uint32 checksum; /* Image checksum (inc. this struct) */ -} tImageInfo; - -/* globals */ - -static tFooter *active_flash_footers[NO_OF_BLOCKS]; -static tSIB *active_sibs[MAX_SIB_INDEX]; -static char active_id_string[SIB_OWNER_STRING_SIZE]; -static cyg_uint32 buffer[MAX_SIB_SIZE / sizeof(cyg_uint32)]; -static cyg_uint32 *free_ptr; -static cyg_uint32 free_space; - -// -// find_free_space() -// -// This routine searches backwards from the end of flash, this is to ensure -// that any SIB's are at the end of flash and therefore less likely to be -// overwritten by the boot monitor loader. -// -// RETURNS: NULL or pointer on area of free space - -static cyg_uint32 * -find_free_space(int size) -{ - tFooter *footer; - int required_blocks; - int free_blocks; - - //Calculate the number of blocks required. - required_blocks = (size / FLASH_BLOCK_SIZE) + 1; - - // Get a pointer to the last possible footer in flash. - footer = (tFooter *)(FLASH_BASE + FLASH_SIZE - sizeof(tFooter)); - - free_blocks = 0; - - while (free_blocks < required_blocks) { - // Skip pass any allocated blocks - while (footer->signature == FLASH_FOOTER_SIGNATURE) { - footer = (tFooter *)(footer->blockBase - sizeof (tFooter)); - - if ((cyg_uint32)footer < FLASH_BASE) - return NULL; - } - - // Count free blocks - free_blocks = 0; - - while (footer->signature != FLASH_FOOTER_SIGNATURE) { - free_blocks++; - - // Have we found enough. - if (free_blocks >= required_blocks) - break; - - footer = (tFooter *)((cyg_uint32)footer - FLASH_BLOCK_SIZE); - - if ((cyg_uint32)footer < FLASH_BASE) - return NULL; - } - } - - // Return the address of the first location of the free space. - return (cyg_uint32 *)BlockBaseAddress(footer); -} - -// -// arm_fis_find_free() -// - -bool -arm_fis_find_free(cyg_uint32 *addr, cyg_uint32 size) -{ - tFooter *footer; - int required_blocks; - int free_blocks; - - //Calculate the number of blocks required. - required_blocks = (size / FLASH_BLOCK_SIZE) + 1; - - footer = FooterAddress(AddressToBlock(*addr)); - free_blocks = 0; - - while (free_blocks < required_blocks) { - // Skip pass any allocated blocks - while (footer->signature == FLASH_FOOTER_SIGNATURE) { - footer = (tFooter *)((cyg_uint32)footer + FLASH_BLOCK_SIZE); - - if ((cyg_uint32)footer > (FLASH_BASE + FLASH_SIZE)) - return 0; - } - - // Count free blocks - free_blocks = 0; - *addr = (tFooter *)((cyg_uint32)footer + sizeof(tFooter) - FLASH_BLOCK_SIZE); - - while (footer->signature != FLASH_FOOTER_SIGNATURE) { - free_blocks++; - - // Have we found enough. - if (free_blocks >= required_blocks) - break; - - footer = (tFooter *)((cyg_uint32)footer + FLASH_BLOCK_SIZE); - - if ((cyg_uint32)footer > (FLASH_BASE + FLASH_SIZE)) - return 0; - } - } - - // Return the address of the first location of the free space. - return 1; -} - -// -// sib_checksum() - calculate SIB checksum. -// - -static cyg_uint32 -sib_checksum(tSIB *sib) -{ - cyg_uint32 checksum; - cyg_uint32 *ptr; - int size; - - checksum = 0; - size = sib->size; - ptr = (cyg_uint32 *)sib; - - while (size > 0) { - cyg_uint32 word; - - word = *ptr++; - - if (word > ~checksum) checksum++; - - checksum += word; - size -= sizeof (word); - } - - return ~checksum; -} - -// footer_checksum() - calculate the footer checksum. -static cyg_uint32 -footer_checksum(tFooter *footer) -{ - cyg_uint32 checksum; - cyg_uint32 *ptr; - int size; - - checksum = 0; - size = sizeof (tFooter); - ptr = (cyg_uint32 *)footer; - - while (size > 0) { - cyg_uint32 word; - - word = *ptr++; - - if (word > ~checksum) checksum++; - - checksum += word; - size -= sizeof (word); - } - - return ~checksum; -} - -// write_sib() - internal routine to write a SIB to flash. -// -// RETURN: -1 if error 0 otherwise - -static int -write_sib(tSIB *sib) -{ - cyg_uint32 *ptr; - - // Is there space available for this SIB. - if (sib->size > free_space) { - int required_space; - int count; - int block; - tFooter footer; - tFooter *footer_ptr; - - // If not then we need to allocate a new area in flash. - // - // First calculate the size required for the new area by - // adding up the size of all the active SIB's. - // - required_space = sib->size; - - for (count = 0; count < MAX_SIB_INDEX; count++) { - tSIB *sib2; - - sib2 = active_sibs[count]; - - if (sib2 != NULL) required_space += sib2->size; - } - - // Get a pointer to the free space. - free_ptr = find_free_space (required_space); - - // Build a flash footer to describe this area. - footer.blockBase = (char *)BlockBaseAddress(free_ptr); - footer.infoBase = NULL; - footer.type = TYPE_ARM_SIB; - footer.signature = FLASH_FOOTER_SIGNATURE; - footer.checksum = 0; - footer.checksum = footer_checksum (&footer); - - // Calculate the address where the footer will live in flash - // and write it to flash. - block = AddressToBlock((cyg_uint32)free_ptr + required_space + sizeof (tFooter)); - - footer_ptr = FooterAddress(block); - -#ifdef TO_CHECK - if (sysFlashWrite(FLASH_CAST(&footer), sizeof(tFooter), - ((cyg_uint32)footer_ptr - FLASH_BASE), - flashType, 0) != OK) - return -1; -#endif - if (flash_program_buf(footer_ptr, (unsigned long *)&footer, sizeof(tFooter)) < 0 ) - return -1; - - // Update the free space global varible. - free_space = ((AddressToBlock(footer_ptr) - block + 1) * FLASH_BLOCK_SIZE) - - sizeof (tFooter); - } - - // If the SIB that we are writing is already in flash then it need to - // be copied into memory as it may become unreadable when we start - // programming the flash (if it is in the same flash part). - if (InFlash(sib)) { - cyg_uint32 *src; - cyg_uint32 *dest; - int size; - tSIB *tmp_sib; - - size = sib->size; - src = (cyg_uint32 *)sib; - dest = buffer; - - while (size > 0) { - *dest++ = *src++; - size -= sizeof (cyg_uint32); - } - - // Increment the revision count. - tmp_sib = (tSIB *)buffer; - tmp_sib->revision = sib->revision + 1; - - ptr = buffer; - } else - ptr = (cyg_uint32 *)sib; - - // Write the SIB to flash. -#ifdef TO_CHECK - if (sysFlashWrite(FLASH_CAST(ptr), sib->size, (int)((cyg_uint32)free_ptr - FLASH_BASE), - flashType, 0) != OK) - return -1; -#endif - - if (flash_program_buf((cyg_uint32)free_ptr, ptr, sib->size) < 0 ) - return -1; - - // Update the free space, free pointer and active SIB's varibles - // to reflect this write. - free_space -= sib->size; - free_ptr = (cyg_uint32 *)((cyg_uint32)free_ptr - sib->size); - - active_sibs[sib->index] = sib; - - return 0; -} - -// delete_sib() - delete a SIB. -// -// This will delete at least a whole flash block and therefore any active -// SIB's will need to be rewritten. - -static int -delete_sib (tSIB *sib_to_delete) -{ - int block; - tFooter *footer; - tSIB *sib; - int delete_size; - - // Calculate the first address of this flash block and the - // first possible footer location. - // - block = AddressToBlock(sib_to_delete); - footer = FooterAddress(block); - - // Search for the footer for this block. - while (footer->signature != FLASH_FOOTER_SIGNATURE) - footer = (tFooter *)((cyg_uint32)footer + FLASH_BLOCK_SIZE); - - if (footer_checksum (footer) != 0) - return -1; - - // Now get the a pointer to the first SIB. - sib = (tSIB *)footer->blockBase; - - // Now search through all the SIB's. - while (sib->signature == SIB_HEADER_SIGNATURE) { - if (sib_checksum (sib) != 0) - break; - - // Any valid and active SIB will need to be rewritten. - if (sib->index < MAX_SIB_INDEX) { - if ((active_sibs[sib->index] == NULL) || - (sib->revision > active_sibs[sib->index]->revision)) { - write_sib (sib); - } - } - - // Move onto next SIB. - sib = (tSIB *)((cyg_uint32)sib + sib->size); - } - - // Calculate how much space needs to be deleted, it may be multiple - // blocks, and delete it. - delete_size = (AddressToBlock(footer) - block + 1) * FLASH_BLOCK_SIZE; - - // !! must add code for cases where (delete_size > block_size) -#ifdef TO_CHECK - return sysFlashEraseBlock((cyg_uint32 *)footer->blockBase, sysFlashTypeGet()); -#endif - return flash_erase_block((cyg_uint32 *)footer->blockBase); - } - -// SIB_Open() - Open all SIB's with the owner by 'id_string'. -// -// RETURN: -1 if error 0 otherwise - -int -SIB_Open(char *id_string, int *sib_count, int private_flag) -{ - int count; - tFooter *footer; - int no_of_sibs; - - // Initialize various globals. - memset(active_id_string, 0, SIB_OWNER_STRING_SIZE); - free_ptr = NULL; - free_space = 0; - *sib_count = 0; - - // Find all the active footers. - fLib_FindFooter((cyg_uint32 *)FLASH_BASE, FLASH_SIZE, active_flash_footers); - - // Initialise the active SIB array. - for (count = 0; count < MAX_SIB_INDEX; count++) - active_sibs[count] = NULL; - - // Populate the active SIB array with all the active SIB found in flash. - count = 0; - no_of_sibs = 0; - - while ((footer = active_flash_footers[count++]) != NULL) { - tSIB *sib; - - if (footer->type != TYPE_ARM_SIB) - continue; - - sib = (tSIB *)footer->blockBase; - - while (sib->signature == SIB_HEADER_SIGNATURE) { - char c; - char *ptr1; - char *ptr2; - - if (sib_checksum (sib) != 0) - return -1; - - ptr1 = id_string; - ptr2 = sib->owner; - - while ((c = *ptr1++) != '\0') { - if (c != *ptr2++) - break; - } - - if (c == '\0') { - // If two SIB's have the same name and index the one with the - // highest revision is considered to be the active one. - if (sib->index < MAX_SIB_INDEX) { - tSIB *current_sib; - - current_sib = active_sibs[sib->index]; - - if (current_sib == NULL) { - active_sibs[sib->index] = sib; - } else if (sib->revision > current_sib->revision) { - delete_sib(current_sib); - active_sibs[sib->index] = sib; - } else { - tSIB *old_sib; - - old_sib = sib; - sib = (tSIB *)((cyg_uint32)sib + sib->size); - - delete_sib(old_sib); - - continue; - } - } else - return -1; - - no_of_sibs++; - } - - sib = (tSIB *)((cyg_uint32)sib + sib->size); - } - } - - memcpy(active_id_string, id_string, SIB_OWNER_STRING_SIZE); - - *sib_count = no_of_sibs; - - return 0; -} - -// SIB_Close() - close access to SIBs - -int -SIB_Close(void) -{ - int count; - - memset(active_id_string, 0, SIB_OWNER_STRING_SIZE); - - // Initialise the active SIB array. - for (count = 0; count < MAX_SIB_INDEX; count++) - active_sibs[count] = NULL; - - return 0; -} - - -// SIB_GetSize() - Get the size of the user data in a SIB. - -int -SIB_GetSize(int sib_index, int *data_size) -{ - tSIB *sib; - - sib = active_sibs[sib_index]; - - if (sib == NULL) { - *data_size = 0; - return -1; - } - - *data_size = sib->size = sizeof(tSIB); - - return 0; -} - -// SIB_Program() - create or update a SIB with new user data. -// -// Return: 0 if OK -1 otherwise - -int -SIB_Program(int sib_index, void *data_block, int data_size) -{ - tSIB *old_sib; - tSIB *new_sib; - int sib_size; - cyg_uint32 *src; - cyg_uint32 *dest; - - // Calculate the size of the SIB as a whole. - sib_size = data_size + sizeof(tSIB); - - if (sib_size > MAX_SIB_SIZE) - return -1; - - // Create the new SIB in local memory - new_sib = (tSIB *)&buffer; - - new_sib->signature = SIB_HEADER_SIGNATURE; - new_sib->size = sib_size; - new_sib->index = sib_index; - - memcpy(new_sib->owner, active_id_string, SIB_OWNER_STRING_SIZE); - - // Increment the revision number if this is updating a SIB. - old_sib = active_sibs[sib_index]; - - if (old_sib == NULL) - new_sib->revision = 0; - else - new_sib->revision = old_sib->revision + 1; - - // Copy the user data into the SIB. - src = (cyg_uint32 *)data_block; - dest = (cyg_uint32 *)((cyg_uint32)new_sib + sizeof(tSIB)); - - while (data_size > 0) { - *dest++ = *src++; - data_size -= sizeof (cyg_uint32); - } - - // Finally calculate the checksum and call write_sib. - new_sib->checksum = 0; - new_sib->checksum = sib_checksum (new_sib); - - if (write_sib (new_sib) != 0) - return -1; - - // Delete the SIB that this one replaces if there is one. - if (old_sib != NULL) - delete_sib (old_sib); - - return 0; -} - -// SIB_Erase() - erase a SIB -// -// Return: -1 if error 0 otherwise - -int -SIB_Erase(int sib_index) -{ - tSIB *sib; - - sib = active_sibs[sib_index]; - - active_sibs[sib_index] = NULL; - - return delete_sib (sib); -} - -// fLib_FindFooter() - find footer in flash memory -// -// Scan the flash memory from start for size bytes, returning a list of pointers to the -// image footers. Pointer list should point to an area of ram supplied by the application -// and should be large enough to contain a pointer to each logical block of flash in the -// specified area. -// If the size is defined as zero, only the address of the next footer found is returned. -// Parameters: -// cyg_uint32 *start -// pointer to the address of the flash memory to be scanned -// cyg_uint32 size -// size of the flash memory in bytes -// tFooter **list -// pointer to a list of pointers to footers -// -// Returns: number of flash footers found. -// - -cyg_uint32 -fLib_FindFooter(cyg_uint32 *start, cyg_uint32 size, tFooter *list[]) -{ - cyg_uint32 *end ; - cyg_uint32 count = 0; - cyg_uint32 logical_block = FLASH_BLOCK_SIZE; - cyg_uint32 block_mask; - tFooter *test; - - end = flash_info.end; - - // Start looking at each block boundary to see if there is a - // structured footer there if so that is a footer to put in the footer list - // - // Initially we must get the nearest logical block boundary to the - // initial address - block_mask = logical_block - 1; - - start = (cyg_uint32*)((int)start | block_mask); - - test = (tFooter*)(start - (sizeof(tFooter) >> 2) ); - test = (tFooter*) ((char*)test + 1); - - // Now test should be at the first available footer location - - for ( ; (cyg_uint32*)test < end; test = (tFooter*)((char*)test + logical_block)) { - // initial check is to see if the type is deleted (ie empty block) - if (TYPE_DELETED != test->type) { - // next check for a signature in the footer - - if (FLASH_FOOTER_SIGNATURE == test->signature) { - cyg_uint32 check = 0; - cyg_uint32 *check_ptr = (cyg_uint32 *)test; - count = (sizeof(tFooter) - 4) >> 2; // sizeof will return bytes - - // We're pretty certain by now but lets check the checksum to make fully sure - for ( ; count > 0; count--) { - if (*check_ptr > ~check) - check++; - check += *check_ptr++; - } - - if (test->checksum == ~check) { - if (size != 0 ) - *list++ = test; - else { - // If the size was set at 0 - return only the first found footer - *list = test; - return 1; - } - } - } - } - // This should carry on through checking each logical block boundary to end */ - } - - // tidy up the array/list - *list = NULL; - return count; -} - -// -// fLib_DeleteImage(tFooter *foot, tFlash *flash) -// -// Delete the image in flash as detailed by the specified image footer. We will have to -// define the flash device to access the relevant flash delete routines -// Parameters -// tFooter *foot -// pointer to the footer which defines the image to be deleted -// -// Returns: 0 if successful, otherwise -1. -// - -static int -fLib_DeleteImage(tFooter *foot) -{ - cyg_uint32 delete_size , block_mask = flash_info.block_size; - cyg_uint8 *erase_addr = foot->blockBase; - cyg_uint8 complete_flag = 0; - - // presume that the erase size is chosen to cover the boundary size - block_mask -= 1; - - delete_size = ((tImageInfo*)foot->infoBase)->length + - ((tImageInfo*)foot->infoBase)->header_length + - sizeof (tImageInfo) + sizeof (tFooter); - delete_size |= block_mask; - delete_size += 1; /* for the boundary */ - - while (!complete_flag ) { - if ( delete_size > flash_info.block_size) { - delete_size -= flash_info.block_size; - } else - complete_flag = 1; - - flash_erase_block(erase_addr); - erase_addr += flash_info.block_size; - } - return 0; -} - -// -// fLib_FindImage(tFooter **list, cyg_uint32 imageNo, tFooter *foot) -// -// Scan the list of flash footers looking for a footer with an imageNumber which -// matches the specified number. -// If the specified footer pointer is not NULL, the footer is copied from flash. -// Parameters: -// tFooter **list -// pointer to a list of pointers to footers -// unsigned32 imageNo -// number of image to be located -// tFooter *foot -// pointer to where the found footer should be copied -// -// Returns: 1 if successful, otherwise 0 -// - -static int -fLib_FindImage(tFooter **list, char *name, tFooter *foot) -{ - // Initially, if there are no images in the flash we can just return so check - if (*list == NULL) - return 0; - - // Now we can start checking for the images that are in flash - while (*list != NULL) { - tImageInfo *im = (tImageInfo *)(*list)->infoBase; - if (strncmp(name, im->name, 16) == 0 ) { - *foot = **list; - return 1; - } - list++; - } - - return 0; -} - -#define FLASH_ADRS 0x23000000 - -int -markBlock() -{ - tFooter footer; - tFooter *current; - cyg_uint32 writeOffset; - - // Build a flash footer to describe this area. - footer.blockBase = (char *)FLASH_ADRS; - footer.infoBase = NULL; - footer.type = 0x10000; //TYPE_WRS_SIB; - footer.signature = FLASH_FOOTER_SIGNATURE; - footer.checksum = 0; - footer.checksum = footer_checksum (&footer); - - current = (tFooter *)(FLASH_ADRS + FLASH_BLOCK_SIZE - sizeof (tFooter)); - - if ( current->type == TYPE_ARM_SIB) - return 1; - - writeOffset = FLASH_ADRS + FLASH_BLOCK_SIZE - sizeof (tFooter); - - if (flash_program_buf(writeOffset, (unsigned long *)&footer, sizeof(tFooter)) < 0 ) - return 0; - -#ifdef TO_CHECK - if (sysFlashWrite(FLASH_CAST(&footer), sizeof(tFooter), - writeOffset, - flashType, 0) != OK) - return 0; -#endif -} - -void -arm_fis_list(void) -{ - int count = 0; - tFooter *footer; - - fLib_FindFooter((cyg_uint32 *)FLASH_BASE, FLASH_SIZE, active_flash_footers); - - diag_printf("Name FLASH addr Mem addr Length Entry point\n"); - while ((footer = active_flash_footers[count++]) != NULL) { - if (footer->type == TYPE_ARM_EXEC) { - diag_printf("%-16s 0x%08lX 0x%08lX 0x%06lX 0x%08lX\n", - ((tImageInfo *)footer->infoBase)->name, - FLASH_BASE, footer->blockBase, - ((tImageInfo *)footer->infoBase)->length, - ((tImageInfo *)footer->infoBase)->loadAddress); - } - } -} - -void -arm_fis_delete(char *name) -{ - tFooter footer; - - if ( name == NULL ) return; - - fLib_FindFooter((cyg_uint32 *)FLASH_BASE, FLASH_SIZE, active_flash_footers); - - if ( fLib_FindImage(active_flash_footers, name, &footer) ) { - diag_printf("Found Image %s, base 0x%x\n", name, footer.blockBase); - fLib_DeleteImage(&footer); - } -} - -static void -SIB_test(void) -{ - int count; - tFooter *footer; - - fLib_FindFooter((cyg_uint32 *)FLASH_BASE, FLASH_SIZE, active_flash_footers); - - - // Find everything that looks like a SIB. - count = 0; - - diag_printf("\n"); - while ((footer = active_flash_footers[count++]) != NULL) { - if (footer->type == TYPE_ARM_EXEC) { - diag_printf("Blk: %d Image Nb: %3d Name: %s Load address: 0x%x Length 0x%x\n\n", - AddressToBlock(footer->blockBase), - ((tImageInfo *) footer->infoBase)->imageNumber, - ((tImageInfo *)footer->infoBase)->name, - ((tImageInfo *)footer->infoBase)->loadAddress, - ((tImageInfo *)footer->infoBase)->length); - } else if (footer->type == TYPE_ARM_SIB) { - tSIB *sib; - - sib = (tSIB *)footer->blockBase; - diag_printf("SIB Address Owner Size Idx Rev\n"); - diag_printf("----------- ----- ---- --- ---\n"); - while (sib->signature == SIB_HEADER_SIGNATURE) { - if (sib_checksum (sib) == 0) { - diag_printf("0x%08X %-32s %4d %4d %4d\n\n", - (int)sib, sib->owner, sib->size, sib->index, sib->revision); - sib = (tSIB *)((cyg_uint32)sib + sib->size); - } else { - diag_printf("0x%08X *** Bad Checksum ***\n", (int)sib); - break; - } - } - - } - } -} -#endif // ARM_INTEGRATOR_FLASH diff --git a/packages/devs/flash/arm/ipaq/current/ChangeLog b/packages/devs/flash/arm/ipaq/current/ChangeLog --- a/packages/devs/flash/arm/ipaq/current/ChangeLog +++ b/packages/devs/flash/arm/ipaq/current/ChangeLog @@ -11,27 +11,36 @@ 2001-02-24 Gary Thomas + + * cdl/flash_iq80310.cdl: Invoke $(CC) with $(CFLAGS) to ensure the + correct flags are passed. + 2001-09-28 Jonathan Larmour * src/iq80310_flash.c (flash_hwr_init): Only re-enable icache if it @@ -37,27 +42,36 @@ 2000-11-19 Mark Salter >flash_erase_block.s echo "flash_erase_block_end:" >>flash_erase_block.s - $(CC) -c -o flash_erase_block.o flash_erase_block.s + $(CC) $(CFLAGS) -c -o flash_erase_block.o flash_erase_block.s $(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o } make -priority 1 { @@ -69,7 +78,7 @@ cdl_package CYGPKG_DEVS_FLASH_IQ80310 { $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c echo " .globl flash_program_buf_end" >>flash_program_buf.s echo "flash_program_buf_end:" >>flash_program_buf.s - $(CC) -c -o flash_program_buf.o flash_program_buf.s + $(CC) $(CFLAGS) -c -o flash_program_buf.o flash_program_buf.s $(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o } make -priority 1 { @@ -77,7 +86,7 @@ cdl_package CYGPKG_DEVS_FLASH_IQ80310 { $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c echo " .globl flash_query_end" >>flash_query.s echo "flash_query_end:" >>flash_query.s - $(CC) -c -o flash_query.o flash_query.s + $(CC) $(CFLAGS) -c -o flash_query.o flash_query.s $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o } make -priority 1 { @@ -85,7 +94,7 @@ cdl_package CYGPKG_DEVS_FLASH_IQ80310 { $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c echo " .globl flash_lock_block_end" >>flash_lock_block.s echo "flash_lock_block_end:" >>flash_lock_block.s - $(CC) -c -o flash_lock_block.o flash_lock_block.s + $(CC) $(CFLAGS) -c -o flash_lock_block.o flash_lock_block.s $(AR) rcs $(PREFIX)/lib/libtarget.a flash_lock_block.o } make -priority 1 { @@ -93,7 +102,7 @@ cdl_package CYGPKG_DEVS_FLASH_IQ80310 { $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_unlock_block.c echo " .globl flash_unlock_block_end" >>flash_unlock_block.s echo "flash_unlock_block_end:" >>flash_unlock_block.s - $(CC) -c -o flash_unlock_block.o flash_unlock_block.s + $(CC) $(CFLAGS) -c -o flash_unlock_block.o flash_unlock_block.s $(AR) rcs $(PREFIX)/lib/libtarget.a flash_unlock_block.o } } diff --git a/packages/devs/flash/arm/iq80310/current/src/flash.h b/packages/devs/flash/arm/iq80310/current/src/flash.h --- a/packages/devs/flash/arm/iq80310/current/src/flash.h +++ b/packages/devs/flash/arm/iq80310/current/src/flash.h @@ -5,29 +5,38 @@ // Flash programming - device constants, etc. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/iq80310/current/src/flash_erase_block.c b/packages/devs/flash/arm/iq80310/current/src/flash_erase_block.c --- a/packages/devs/flash/arm/iq80310/current/src/flash_erase_block.c +++ b/packages/devs/flash/arm/iq80310/current/src/flash_erase_block.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/iq80310/current/src/flash_lock_block.c b/packages/devs/flash/arm/iq80310/current/src/flash_lock_block.c --- a/packages/devs/flash/arm/iq80310/current/src/flash_lock_block.c +++ b/packages/devs/flash/arm/iq80310/current/src/flash_lock_block.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/iq80310/current/src/flash_program_buf.c b/packages/devs/flash/arm/iq80310/current/src/flash_program_buf.c --- a/packages/devs/flash/arm/iq80310/current/src/flash_program_buf.c +++ b/packages/devs/flash/arm/iq80310/current/src/flash_program_buf.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/iq80310/current/src/flash_query.c b/packages/devs/flash/arm/iq80310/current/src/flash_query.c --- a/packages/devs/flash/arm/iq80310/current/src/flash_query.c +++ b/packages/devs/flash/arm/iq80310/current/src/flash_query.c @@ -5,29 +5,38 @@ // Flash programming - query device // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/iq80310/current/src/flash_unlock_block.c b/packages/devs/flash/arm/iq80310/current/src/flash_unlock_block.c --- a/packages/devs/flash/arm/iq80310/current/src/flash_unlock_block.c +++ b/packages/devs/flash/arm/iq80310/current/src/flash_unlock_block.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/iq80310/current/src/iq80310_flash.c b/packages/devs/flash/arm/iq80310/current/src/iq80310_flash.c --- a/packages/devs/flash/arm/iq80310/current/src/iq80310_flash.c +++ b/packages/devs/flash/arm/iq80310/current/src/iq80310_flash.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/iq80321/current/ChangeLog b/packages/devs/flash/arm/iq80321/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/iq80321/current/ChangeLog @@ -0,0 +1,44 @@ +2002-01-28 Mark Salter + + * include/iq80321_strataflash.inl: Include cyg/hal/plf_io.h. + * include/iq80321_strataflash.inl: Doh. Just remove it as unneccessary. + +2002-01-09 Mark Salter + + * include/iq80321_strataflash.inl: Use platform provided FLASH addr. + + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/arm/iq80321/current/cdl/flash_iq80321.cdl b/packages/devs/flash/arm/iq80321/current/cdl/flash_iq80321.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/iq80321/current/cdl/flash_iq80321.cdl @@ -0,0 +1,80 @@ +# ==================================================================== +# +# flash_iq80321.cdl +# +# FLASH memory - Hardware support on Intel IQ80321 board +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): msalter +# Original data: gthomas +# Contributors: +# Date: 2001-12-07 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_IQ80321 { + display "Intel IQ80321 FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_ARM_XSCALE_IQ80321 + + requires CYGPKG_DEVS_FLASH_STRATA + + implements CYGHWR_IO_FLASH_BLOCK_LOCKING + + include_dir cyg/io + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED { + display "Generic StrataFLASH driver required" + } + + implements CYGINT_DEVS_FLASH_STRATA_REQUIRED + + define_proc { + puts $::cdl_system_header "/***** strataflash driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG " + puts $::cdl_system_header "/***** strataflash driver proc output end *****/" + } +} + diff --git a/packages/devs/flash/arm/iq80321/current/include/iq80321_strataflash.inl b/packages/devs/flash/arm/iq80321/current/include/iq80321_strataflash.inl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/arm/iq80321/current/include/iq80321_strataflash.inl @@ -0,0 +1,65 @@ +#ifndef CYGONCE_DEVS_FLASH_IQ80321_STRATAFLASH_INL +#define CYGONCE_DEVS_FLASH_IQ80321_STRATAFLASH_INL +//========================================================================== +// +// iq80321_strataflash.inl +// +// Flash programming - device constants, etc. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: gthomas +// Date: 2001-12-07 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// The iq80321 system has one 16-bit device. + +#define CYGNUM_FLASH_DEVICES (1) +#define CYGNUM_FLASH_BASE IQ80321_FLASH_ADDR +#define CYGNUM_FLASH_BASE_MASK (0xFF800000u) // 8Mb devices +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BLANK (1) + +#endif // CYGONCE_DEVS_FLASH_IQ80321_STRATAFLASH_INL +// ------------------------------------------------------------------------ +// EOF iq80321_strataflash.inl diff --git a/packages/devs/flash/arm/nano/current/ChangeLog b/packages/devs/flash/arm/nano/current/ChangeLog --- a/packages/devs/flash/arm/nano/current/ChangeLog +++ b/packages/devs/flash/arm/nano/current/ChangeLog @@ -8,27 +8,36 @@ 2001-02-15 Hugo Tyson * cdl/flash_nano.cdl: New file. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/devs/flash/arm/nano/current/cdl/flash_nano.cdl b/packages/devs/flash/arm/nano/current/cdl/flash_nano.cdl --- a/packages/devs/flash/arm/nano/current/cdl/flash_nano.cdl +++ b/packages/devs/flash/arm/nano/current/cdl/flash_nano.cdl @@ -5,29 +5,38 @@ # FLASH memory - Hardware support on Intel StrongARM SA1110 # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/devs/flash/arm/nano/current/include/nano_strataflash.inl b/packages/devs/flash/arm/nano/current/include/nano_strataflash.inl --- a/packages/devs/flash/arm/nano/current/include/nano_strataflash.inl +++ b/packages/devs/flash/arm/nano/current/include/nano_strataflash.inl @@ -7,29 +7,38 @@ // Flash programming - device constants, etc. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/arm/pid/current/ChangeLog b/packages/devs/flash/arm/pid/current/ChangeLog --- a/packages/devs/flash/arm/pid/current/ChangeLog +++ b/packages/devs/flash/arm/pid/current/ChangeLog @@ -8,27 +8,36 @@ 2001-02-20 Jesper Skov + +//-------------------------------------------------------------------------- +// Device properties + +#define CYGNUM_FLASH_INTERLEAVE (1) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (0xFF000000) + +//static cyg_uint32 plf_flash_base; + +//-------------------------------------------------------------------------- +// Platform specific extras +#define CYGHWR_FLASH_AM29XXXXX_NO_WRITE_PROTECT // This feature fails :-( + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_am29xxxxx.inl" + +// ------------------------------------------------------------------------ +// EOF frv400_flash.c diff --git a/packages/devs/flash/intel/28fxxx/current/ChangeLog b/packages/devs/flash/intel/28fxxx/current/ChangeLog --- a/packages/devs/flash/intel/28fxxx/current/ChangeLog +++ b/packages/devs/flash/intel/28fxxx/current/ChangeLog @@ -1,3 +1,16 @@ +2002-03-06 Nick Garnett + + * include/flash_28fxxx.inl: + Added CYGHWR_FLASH_WRITE_ENABLE() and CYGHWR_FLASH_WRITE_DISABLE() + macro calls to enable and disable FLASH writing in platform + hardware. Some platforms have extra protection for the FLASH + beyond that provided for the FLASH itself. + + * include/flash_28fxxx_parts.inl: + * cdl/flash_intel_28fxxx.cdl: + Added support for the 28f320S3 part. This mainly differs from the + C3 in that it does not have any bootblocks. + 2001-10-17 Jonathan Larmour * include/flash_28fxxx_parts.inl: Fix boot block start address. @@ -17,6 +30,7 @@ 2001-08-10 Jesper Skov block_size; } + CYGHWR_FLASH_WRITE_ENABLE(); + while (len > 0) { b_v = FLASH_P2V(b_p); @@ -311,6 +332,8 @@ flash_erase_block(void* block, unsigned len = flash_dev_info->bootblocks[len_ix++]; } + CYGHWR_FLASH_WRITE_DISABLE(); + return res; } @@ -334,7 +357,9 @@ flash_program_buf(void* addr, void* data // Base address of device(s) being programmed. ROM = FLASH_P2V((unsigned long)addr & flash_dev_info->base_mask); BA = FLASH_P2V((unsigned long)addr & ~(flash_dev_info->block_size - 1)); - + + CYGHWR_FLASH_WRITE_ENABLE(); + // Clear any error conditions ROM[0] = FLASH_Clear_Status; @@ -415,6 +440,8 @@ flash_program_buf(void* addr, void* data // Restore ROM to "normal" mode bad: ROM[0] = FLASH_Reset; + + CYGHWR_FLASH_WRITE_DISABLE(); // Ideally, we'd want to return not only the failure code, but also // the address/device that reported the error. @@ -454,6 +481,8 @@ flash_lock_block(void* block) len = flash_dev_info->block_size; } + CYGHWR_FLASH_WRITE_ENABLE(); + while (len > 0) { b_v = FLASH_P2V(b_p); @@ -487,6 +516,8 @@ flash_lock_block(void* block) len = flash_dev_info->bootblocks[len_ix++]; } + CYGHWR_FLASH_WRITE_DISABLE(); + return res; } @@ -523,6 +554,8 @@ flash_unlock_block(void* block, int bloc len = flash_dev_info->block_size; } + CYGHWR_FLASH_WRITE_ENABLE(); + while (len > 0) { b_v = FLASH_P2V(b_p); @@ -557,6 +590,8 @@ flash_unlock_block(void* block, int bloc len = flash_dev_info->bootblocks[len_ix++]; } + CYGHWR_FLASH_WRITE_DISABLE(); + return res; // FIXME: Unlocking need to support some other parts in the future diff --git a/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx_parts.inl b/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx_parts.inl --- a/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx_parts.inl +++ b/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx_parts.inl @@ -7,29 +7,38 @@ // Intel 28Fxxx part descriptors // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -96,6 +105,20 @@ }, #endif +#ifdef CYGHWR_DEVS_FLASH_INTEL_28F320S3 + { // 28F320S3 + device_id : FLASHWORD(0x00d4), + block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE, + block_count: 64, + device_size: 0x400000 * CYGNUM_FLASH_INTERLEAVE, + base_mask : ~(0x400000 * CYGNUM_FLASH_INTERLEAVE - 1), + locking : true, + buffered_w : false, + bootblock : false, + banked : false + }, +#endif + #ifdef CYGHWR_DEVS_FLASH_INTEL_28F160S5 { // 28F160S5 device_id : FLASHWORD(0x00d0), diff --git a/packages/devs/flash/intel/bootblock/current/ChangeLog b/packages/devs/flash/intel/bootblock/current/ChangeLog --- a/packages/devs/flash/intel/bootblock/current/ChangeLog +++ b/packages/devs/flash/intel/bootblock/current/ChangeLog @@ -39,27 +39,36 @@ 2000-11-15 Jesper Skov + + * src/flash_unlock_block.c: Getting the current block lock + state for flashes in 8-Bit mode is now working correctly. + +2002-04-16 Jonathan Larmour + + * cdl/flash_strata.cdl: Invoke $(CC) with $(CFLAGS) to ensure the + correct flags are passed. + +2002-04-12 Gary Thomas + + * src/strata.c: Clean up warnings. + +2002-01-22 Mark Salter + + * cdl/flash_strata.cdl: Add ".text" before "_end" markers in .s files. + 2001-10-23 Hugo Tyson * cdl/flash_strata.cdl: Provide an option so that RedBoot .ecm @@ -191,27 +209,36 @@ 2000-08-24 Gary Thomas >flash_erase_block.s echo " .globl flash_erase_block_end" >>flash_erase_block.s echo "flash_erase_block_end:" >>flash_erase_block.s - $(CC) -c -o flash_erase_block.o flash_erase_block.s + $(CC) $(CFLAGS) -c -o flash_erase_block.o flash_erase_block.s $(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o } make -priority 1 { flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c \ $(REPOSITORY)/$(PACKAGE)/src/strata.h $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c + echo " .text" >>flash_program_buf.s echo " .globl flash_program_buf_end" >>flash_program_buf.s echo "flash_program_buf_end:" >>flash_program_buf.s - $(CC) -c -o flash_program_buf.o flash_program_buf.s + $(CC) $(CFLAGS) -c -o flash_program_buf.o flash_program_buf.s $(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o } make -priority 1 { flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c \ $(REPOSITORY)/$(PACKAGE)/src/strata.h $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c + echo " .text" >>flash_query.s echo " .globl flash_query_end" >>flash_query.s echo "flash_query_end:" >>flash_query.s - $(CC) -c -o flash_query.o flash_query.s + $(CC) $(CFLAGS) -c -o flash_query.o flash_query.s $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o } @@ -113,18 +125,20 @@ cdl_package CYGPKG_DEVS_FLASH_STRATA { flash_lock_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c \ $(REPOSITORY)/$(PACKAGE)/src/strata.h $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c + echo " .text" >>flash_lock_block.s echo " .globl flash_lock_block_end" >>flash_lock_block.s echo "flash_lock_block_end:" >>flash_lock_block.s - $(CC) -c -o flash_lock_block.o flash_lock_block.s + $(CC) $(CFLAGS) -c -o flash_lock_block.o flash_lock_block.s $(AR) rcs $(PREFIX)/lib/libtarget.a flash_lock_block.o } make -priority 1 { flash_unlock_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_unlock_block.c \ $(REPOSITORY)/$(PACKAGE)/src/strata.h $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_unlock_block.c + echo " .text" >>flash_unlock_block.s echo " .globl flash_unlock_block_end" >>flash_unlock_block.s echo "flash_unlock_block_end:" >>flash_unlock_block.s - $(CC) -c -o flash_unlock_block.o flash_unlock_block.s + $(CC) $(CFLAGS) -c -o flash_unlock_block.o flash_unlock_block.s $(AR) rcs $(PREFIX)/lib/libtarget.a flash_unlock_block.o } } diff --git a/packages/devs/flash/intel/strata/current/src/flash_erase_block.c b/packages/devs/flash/intel/strata/current/src/flash_erase_block.c --- a/packages/devs/flash/intel/strata/current/src/flash_erase_block.c +++ b/packages/devs/flash/intel/strata/current/src/flash_erase_block.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/intel/strata/current/src/flash_lock_block.c b/packages/devs/flash/intel/strata/current/src/flash_lock_block.c --- a/packages/devs/flash/intel/strata/current/src/flash_lock_block.c +++ b/packages/devs/flash/intel/strata/current/src/flash_lock_block.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/intel/strata/current/src/flash_program_buf.c b/packages/devs/flash/intel/strata/current/src/flash_program_buf.c --- a/packages/devs/flash/intel/strata/current/src/flash_program_buf.c +++ b/packages/devs/flash/intel/strata/current/src/flash_program_buf.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/intel/strata/current/src/flash_query.c b/packages/devs/flash/intel/strata/current/src/flash_query.c --- a/packages/devs/flash/intel/strata/current/src/flash_query.c +++ b/packages/devs/flash/intel/strata/current/src/flash_query.c @@ -5,29 +5,38 @@ // Flash programming - query device // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c b/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c --- a/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c +++ b/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -91,7 +100,11 @@ flash_unlock_block(volatile flash_t *blo if (bpv == block) { is_locked[i] = 0; } else { +#if 8 == CYGNUM_FLASH_WIDTH + is_locked[i] = bpv[4]; +#else is_locked[i] = bpv[2]; +# endif } bp += block_size / sizeof(*bp); } diff --git a/packages/devs/flash/intel/strata/current/src/strata.c b/packages/devs/flash/intel/strata/current/src/strata.c --- a/packages/devs/flash/intel/strata/current/src/strata.c +++ b/packages/devs/flash/intel/strata/current/src/strata.c @@ -5,29 +5,38 @@ // Flash programming // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -55,7 +64,7 @@ extern void diag_dump_buf(void *buf, CYG_ADDRWORD len); -extern int strncmp(const char *s1, const char *s2, int len); +extern int strncmp(const char *s1, const char *s2, size_t len); extern void *memcpy( void *, const void *, size_t ); int @@ -159,7 +168,9 @@ flash_hwr_init(void) return FLASH_ERR_OK; } +#ifdef CYGOPT_FLASH_IS_BOOTBLOCK flash_type_unknown: +#endif (*flash_info.pf)("Can't identify FLASH, sorry, man %x, dev %x, id [%4s] stat %x\n", qp->manuf_code, qp->device_code, qp->id, stat ); diag_dump_buf(qp, sizeof(data)); diff --git a/packages/devs/flash/intel/strata/current/src/strata.h b/packages/devs/flash/intel/strata/current/src/strata.h --- a/packages/devs/flash/intel/strata/current/src/strata.h +++ b/packages/devs/flash/intel/strata/current/src/strata.h @@ -7,29 +7,38 @@ // strataFlash programming - device constants, etc. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/mips/atlas/current/ChangeLog b/packages/devs/flash/mips/atlas/current/ChangeLog --- a/packages/devs/flash/mips/atlas/current/ChangeLog +++ b/packages/devs/flash/mips/atlas/current/ChangeLog @@ -8,27 +8,36 @@ 2001-05-23 Jesper Skov + + * src/mips_malta_flash.c: Define width. + + * cdl/flash_malta.cdl: Require 28F160S5 support. + +2001-03-23 Jesper Skov + + * src/mips_malta_flash.c (CYGNUM_FLASH_BASE): Changed again to + non-cached area at 0x1e000000 to avoid problem with board ID + word. + +2001-03-22 Jesper Skov + + * src/mips_malta_flash.c (CYGNUM_FLASH_BASE): Changed. + +2001-03-21 Jesper Skov + + * Use generic Intel driver. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/mips/malta/current/cdl/flash_malta.cdl b/packages/devs/flash/mips/malta/current/cdl/flash_malta.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/mips/malta/current/cdl/flash_malta.cdl @@ -0,0 +1,71 @@ +# ==================================================================== +# +# flash_malta.cdl +# +# FLASH memory - Hardware support on MIPS Malta +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: +# Date: 2001-03-21 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_MALTA { + display "MIPS Malta FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_MIPS_MALTA + + implements CYGHWR_IO_FLASH_DEVICE + + compile mips_malta_flash.c + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED { + display "Generic Intel FlashFile driver required" + } + + implements CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED + + requires CYGHWR_DEVS_FLASH_INTEL_28F160S5 +} diff --git a/packages/devs/flash/mips/malta/current/src/mips_malta_flash.c b/packages/devs/flash/mips/malta/current/src/mips_malta_flash.c new file mode 100644 --- /dev/null +++ b/packages/devs/flash/mips/malta/current/src/mips_malta_flash.c @@ -0,0 +1,70 @@ +//========================================================================== +// +// mips_malta_flash.c +// +// Flash programming for Intel FlashFile devices on MIPS Malta board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-03-21 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +//-------------------------------------------------------------------------- +// Device properties + +// We use the two Intel FlashFile 28F160 parts on the Malta board. +#define CYGNUM_FLASH_INTERLEAVE (2) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (0xbe000000u) + +//-------------------------------------------------------------------------- +// Platform specific extras + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_28fxxx.inl" + +// ------------------------------------------------------------------------ +// EOF mips_malta_flash.c diff --git a/packages/devs/flash/mips/ocelot/current/ChangeLog b/packages/devs/flash/mips/ocelot/current/ChangeLog --- a/packages/devs/flash/mips/ocelot/current/ChangeLog +++ b/packages/devs/flash/mips/ocelot/current/ChangeLog @@ -17,27 +17,36 @@ 2000-12-05 Jesper Skov + From dhowells@redhat.com + * src/mn10300_asb2305_flash.c: New package/file(s). + * cdl/flash_asb2305.cdl: Same. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/mn10300/asb2305/current/cdl/flash_asb2305.cdl b/packages/devs/flash/mn10300/asb2305/current/cdl/flash_asb2305.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/mn10300/asb2305/current/cdl/flash_asb2305.cdl @@ -0,0 +1,81 @@ +# ==================================================================== +# +# flash_asb2305.cdl +# +# FLASH memory - Hardware support on Matsushita ASB2305 +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): dhowells +# Original data: dhowells +# Contributors: +# Date: 2001-05-15 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_MN10300_ASB2305 { + display "Matsushita MN10300 ASB2305 FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_MN10300_AM33_ASB2305 + + implements CYGHWR_IO_FLASH_DEVICE + + compile mn10300_asb2305_flash.c + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED { + display "Generic AMD AM29XXXXX driver required" + } + + cdl_option CYGHWR_DEVS_FLASH_MN10300_ASB2305_BANK { + display "Which flash bank to program" + flavor data + legal_values { "BootPROM" "SysFlash" } + default_value { "SysFlash" } + description " + This option controls which bank of flash will be programmable." + } + + implements CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED + requires CYGHWR_DEVS_FLASH_AMD_AM29DL324D + requires CYGHWR_DEVS_FLASH_AMD_AM29LV800 +} diff --git a/packages/devs/flash/mn10300/asb2305/current/src/mn10300_asb2305_flash.c b/packages/devs/flash/mn10300/asb2305/current/src/mn10300_asb2305_flash.c new file mode 100644 --- /dev/null +++ b/packages/devs/flash/mn10300/asb2305/current/src/mn10300_asb2305_flash.c @@ -0,0 +1,88 @@ +//========================================================================== +// +// mn10300_asb2305_flash.c +// +// Flash programming for Matsushita ASB2305 +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dhowells +// Contributors: dhowells +// Date: 2001-06-01 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== +#include + +//-------------------------------------------------------------------------- +// Device properties + +#if defined(CYGHWR_DEVS_FLASH_MN10300_ASB2305_BANK_SysFlash) +// We use a four chip parallel AM29DL324BE module plugged into the System Flash socket +// on the ASB2305 board. +#define CYGNUM_FLASH_INTERLEAVE (4) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (8) +#define CYGNUM_FLASH_16AS8 +#define CYGNUM_FLASH_BASE (0x84000000u) /* cached flash chip address */ + +#elif defined(CYGHWR_DEVS_FLASH_MN10300_ASB2305_BANK_BootPROM) +// We have a single AM29LV800TA soldered onto the board as the boot PROM +#define CYGNUM_FLASH_INTERLEAVE (1) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (0x80000000u) /* cached flash chip address */ + +#else +#error unknown flash bank selected +#endif + +//-------------------------------------------------------------------------- +// Platform specific extras + +// Offset of uncached shadow region +#define FLASH_P2V( _a_ ) ((volatile flash_data_t *)((CYG_ADDRWORD)(_a_)+0x20000000)) + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_am29xxxxx.inl" + +// ------------------------------------------------------------------------ +// EOF mn10300_asb2305_flash.c diff --git a/packages/devs/flash/mn10300/stb/current/ChangeLog b/packages/devs/flash/mn10300/stb/current/ChangeLog --- a/packages/devs/flash/mn10300/stb/current/ChangeLog +++ b/packages/devs/flash/mn10300/stb/current/ChangeLog @@ -8,27 +8,36 @@ 2001-06-08 Jesper Skov + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/powerpc/cme555/current/cdl/flash_cme555.cdl b/packages/devs/flash/powerpc/cme555/current/cdl/flash_cme555.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/powerpc/cme555/current/cdl/flash_cme555.cdl @@ -0,0 +1,71 @@ +# ==================================================================== +# +# flash_mbx.cdl +# +# FLASH memory - Hardware support on Axiom's CME555 +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Bob Koninckx +# Original data: Bob Koninckx +# Contributors: +# Date: 2001-12-18 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_CME555 { + display "CME555 FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_POWERPC_CME555 + + implements CYGHWR_IO_FLASH_DEVICE + + compile powerpc_cme555_flash.c + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED { + display "Generic AMD AM29F040 driver required" + } + + implements CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED + requires CYGHWR_DEVS_FLASH_AMD_AM29LV200 +} diff --git a/packages/devs/flash/powerpc/cme555/current/src/powerpc_cme555_flash.c b/packages/devs/flash/powerpc/cme555/current/src/powerpc_cme555_flash.c new file mode 100644 --- /dev/null +++ b/packages/devs/flash/powerpc/cme555/current/src/powerpc_cme555_flash.c @@ -0,0 +1,69 @@ +//========================================================================== +// +// powerpc_cme555_flash.c +// +// Flash programming for Atmel device on Axiom's CME555 board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2001-12-18 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +//-------------------------------------------------------------------------- +// Device properties + +#define CYGNUM_FLASH_INTERLEAVE (2) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (0x00800000) + +//-------------------------------------------------------------------------- +// Platform specific extras + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_am29xxxxx.inl" + +// ------------------------------------------------------------------------ +// EOF powerpc_mbx_flash.c diff --git a/packages/devs/flash/powerpc/ec555/current/ChangeLog b/packages/devs/flash/powerpc/ec555/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/flash/powerpc/ec555/current/ChangeLog @@ -0,0 +1,38 @@ +2002-04-24 Bob Koninckx + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/powerpc/ec555/current/cdl/flash_ec555.cdl b/packages/devs/flash/powerpc/ec555/current/cdl/flash_ec555.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/powerpc/ec555/current/cdl/flash_ec555.cdl @@ -0,0 +1,71 @@ +# ==================================================================== +# +# flash_ec555.cdl +# +# FLASH memory - Hardware support on ec555 board +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Bob Koninckx +# Original data: Bob Koninckx +# Contributors: +# Date: 2002-01-01 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_EC555 { + display "ec555 FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_POWERPC_EC555 + + implements CYGHWR_IO_FLASH_DEVICE + + compile powerpc_ec555_flash.c + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED { + display "Generic AMD AM29F040 driver required" + } + + implements CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED + requires CYGHWR_DEVS_FLASH_AMD_AM29LV800 +} diff --git a/packages/devs/flash/powerpc/ec555/current/src/powerpc_ec555_flash.c b/packages/devs/flash/powerpc/ec555/current/src/powerpc_ec555_flash.c new file mode 100644 --- /dev/null +++ b/packages/devs/flash/powerpc/ec555/current/src/powerpc_ec555_flash.c @@ -0,0 +1,69 @@ +//========================================================================== +// +// powerpc_ec555_flash.c +// +// Flash programming on ec555 board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2002-01-01 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +//-------------------------------------------------------------------------- +// Device properties + +#define CYGNUM_FLASH_INTERLEAVE (2) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (0x00800000) + +//-------------------------------------------------------------------------- +// Platform specific extras + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_am29xxxxx.inl" + +// ------------------------------------------------------------------------ +// EOF powerpc_ec555_flash.c diff --git a/packages/devs/flash/powerpc/mbx/current/ChangeLog b/packages/devs/flash/powerpc/mbx/current/ChangeLog --- a/packages/devs/flash/powerpc/mbx/current/ChangeLog +++ b/packages/devs/flash/powerpc/mbx/current/ChangeLog @@ -33,27 +33,36 @@ 2000-10-20 Gary Thomas + + * cdl/flash_sh_hs7729pci.cdl: Require AM29LV160 support. + +2001-05-29 Jesper Skov + + * src/sh_hs7729pci_flash.c (plf_flash_init): Automatically + determine location of flash. + +2001-05-28 Jesper Skov + + * src/sh_hs7729pci_flash.c (CYGNUM_FLASH_BASE): Hack address for + EPROM boot config for now. + + * Added flash support for HS7729PCI. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/sh/hs7729pci/current/cdl/flash_sh_hs7729pci.cdl b/packages/devs/flash/sh/hs7729pci/current/cdl/flash_sh_hs7729pci.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/sh/hs7729pci/current/cdl/flash_sh_hs7729pci.cdl @@ -0,0 +1,71 @@ +# ==================================================================== +# +# flash_sh_hs7729pci.cdl +# +# FLASH memory - Hardware support on Hitachi SH/HS7729PCI +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: jskov +# Contributors: +# Date: 2001-05-28 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_SH_HS7729PCI { + display "Hitachi SH/HS7729PCI FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_SH_SH7729_HS7729PCI + + implements CYGHWR_IO_FLASH_DEVICE + + compile sh_hs7729pci_flash.c + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED { + display "Generic AMD flash driver required" + } + + implements CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED + requires CYGHWR_DEVS_FLASH_AMD_AM29LV160 +} diff --git a/packages/devs/flash/sh/hs7729pci/current/src/sh_hs7729pci_flash.c b/packages/devs/flash/sh/hs7729pci/current/src/sh_hs7729pci_flash.c new file mode 100644 --- /dev/null +++ b/packages/devs/flash/sh/hs7729pci/current/src/sh_hs7729pci_flash.c @@ -0,0 +1,102 @@ +//========================================================================== +// +// sh_hs7729pci_flash.c +// +// Flash programming for Fujitsu/AMD device on SH HS7729PCI board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-05-28 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +//-------------------------------------------------------------------------- +// Device properties + +#define CYGNUM_FLASH_INTERLEAVE (2) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (plf_flash_base) + +static cyg_uint32 plf_flash_base; + +//-------------------------------------------------------------------------- +// Platform specific extras + +static void plf_flash_init(void); +#define CYGHWR_FLASH_AM29XXXXX_PLF_INIT() plf_flash_init() + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_am29xxxxx.inl" + +//-------------------------------------------------------------------------- +// Magic to determine location of flash +// This works by querying at the location where we expect the EPROM to +// be. Then the returned data is compared with the data at that location. +// If there's a match, assume that to be the location of the EPROM. +// Otherwise it's at the other location. +// +// This is done to avoid having separate configurations for the two board +// configurations. This is simple, has negligible overhead, and Just Works. +void +plf_flash_init(void) +{ + flash_data_t id[2]; + flash_data_t* p; + + plf_flash_base = 0xa0400000; + flash_dev_query(id); + + p = (flash_data_t*)0xa0400000; + if (id[0] == *p++ && id[1] == *p) + plf_flash_base = 0xa0000000; + + // Make that the cached region. + plf_flash_base &= ~0x20000000; +} + +// ------------------------------------------------------------------------ +// EOF sh_hs7729pci_flash.c diff --git a/packages/devs/flash/sh/se7751/current/ChangeLog b/packages/devs/flash/sh/se7751/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/flash/sh/se7751/current/ChangeLog @@ -0,0 +1,38 @@ +2001-07-09 Jesper Skov + + * Added flash support for SE7751. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/sh/se7751/current/cdl/flash_sh_se7751.cdl b/packages/devs/flash/sh/se7751/current/cdl/flash_sh_se7751.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/sh/se7751/current/cdl/flash_sh_se7751.cdl @@ -0,0 +1,71 @@ +# ==================================================================== +# +# flash_sh_se7751.cdl +# +# FLASH memory - Hardware support on Hitachi SH/SE7751 +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: jskov +# Contributors: +# Date: 2001-07-09 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_SH_SE7751 { + display "Hitachi SH/SE7751 FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_SH_SH7751_SE7751 + + implements CYGHWR_IO_FLASH_DEVICE + + compile sh_se7751_flash.c + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED { + display "Generic AMD flash driver required" + } + + implements CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED + requires CYGHWR_DEVS_FLASH_AMD_AM29LV160 +} diff --git a/packages/devs/flash/sh/se7751/current/src/sh_se7751_flash.c b/packages/devs/flash/sh/se7751/current/src/sh_se7751_flash.c new file mode 100644 --- /dev/null +++ b/packages/devs/flash/sh/se7751/current/src/sh_se7751_flash.c @@ -0,0 +1,102 @@ +//========================================================================== +// +// sh_se7751_flash.c +// +// Flash programming for Fujitsu/AMD device on SH SE7751 board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-07-09 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +//-------------------------------------------------------------------------- +// Device properties + +#define CYGNUM_FLASH_INTERLEAVE (2) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (plf_flash_base) + +static cyg_uint32 plf_flash_base; + +//-------------------------------------------------------------------------- +// Platform specific extras + +static void plf_flash_init(void); +#define CYGHWR_FLASH_AM29XXXXX_PLF_INIT() plf_flash_init() + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_am29xxxxx.inl" + +//-------------------------------------------------------------------------- +// Magic to determine location of flash +// This works by querying at the location where we expect the EPROM to +// be. Then the returned data is compared with the data at that location. +// If there's a match, assume that to be the location of the EPROM. +// Otherwise it's at the other location. +// +// This is done to avoid having separate configurations for the two board +// configurations. This is simple, has negligible overhead, and Just Works. +void +plf_flash_init(void) +{ + flash_data_t id[2]; + flash_data_t* p; + + plf_flash_base = 0xa1000000; + flash_dev_query(id); + + p = (flash_data_t*)0xa1000000; + if (id[0] == *p++ && id[1] == *p) + plf_flash_base = 0xa0000000; + + // Make that the cached region. + plf_flash_base &= ~0x20000000; +} + +// ------------------------------------------------------------------------ +// EOF sh_se7751_flash.c diff --git a/packages/devs/flash/sh/se77x9/current/ChangeLog b/packages/devs/flash/sh/se77x9/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/flash/sh/se77x9/current/ChangeLog @@ -0,0 +1,38 @@ +2001-06-12 Jesper Skov + + * Added flash support for SE77x9. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/flash/sh/se77x9/current/cdl/flash_sh_se77x9.cdl b/packages/devs/flash/sh/se77x9/current/cdl/flash_sh_se77x9.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/flash/sh/se77x9/current/cdl/flash_sh_se77x9.cdl @@ -0,0 +1,71 @@ +# ==================================================================== +# +# flash_sh_se77x9.cdl +# +# FLASH memory - Hardware support on Hitachi SH/SE77X9 +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: jskov +# Contributors: +# Date: 2001-05-28 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_SH_SE77X9 { + display "Hitachi SH/SE77X9 FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_SH_SH77X9_SE77X9 + + implements CYGHWR_IO_FLASH_DEVICE + + compile sh_se77x9_flash.c + + # Arguably this should do in the generic package + # but then there is a logic loop so you can never enable it. + cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED { + display "Generic AMD flash driver required" + } + + implements CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED + requires CYGHWR_DEVS_FLASH_AMD_AM29LV160 +} diff --git a/packages/devs/flash/sh/se77x9/current/src/sh_se77x9_flash.c b/packages/devs/flash/sh/se77x9/current/src/sh_se77x9_flash.c new file mode 100644 --- /dev/null +++ b/packages/devs/flash/sh/se77x9/current/src/sh_se77x9_flash.c @@ -0,0 +1,102 @@ +//========================================================================== +// +// sh_se77x9_flash.c +// +// Flash programming for Fujitsu/AMD device on SH SE77X9 board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-05-28 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +//-------------------------------------------------------------------------- +// Device properties + +#define CYGNUM_FLASH_INTERLEAVE (2) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (plf_flash_base) + +static cyg_uint32 plf_flash_base; + +//-------------------------------------------------------------------------- +// Platform specific extras + +static void plf_flash_init(void); +#define CYGHWR_FLASH_AM29XXXXX_PLF_INIT() plf_flash_init() + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_am29xxxxx.inl" + +//-------------------------------------------------------------------------- +// Magic to determine location of flash +// This works by querying at the location where we expect the EPROM to +// be. Then the returned data is compared with the data at that location. +// If there's a match, assume that to be the location of the EPROM. +// Otherwise it's at the other location. +// +// This is done to avoid having separate configurations for the two board +// configurations. This is simple, has negligible overhead, and Just Works. +void +plf_flash_init(void) +{ + flash_data_t id[2]; + flash_data_t* p; + + plf_flash_base = 0xa1000000; + flash_dev_query(id); + + p = (flash_data_t*)0xa1000000; + if (id[0] == *p++ && id[1] == *p) + plf_flash_base = 0xa0000000; + + // Make that the cached region. + plf_flash_base &= ~0x20000000; +} + +// ------------------------------------------------------------------------ +// EOF sh_se77x9_flash.c diff --git a/packages/devs/flash/synth/current/ChangeLog b/packages/devs/flash/synth/current/ChangeLog --- a/packages/devs/flash/synth/current/ChangeLog +++ b/packages/devs/flash/synth/current/ChangeLog @@ -1,3 +1,19 @@ +2002-01-23 Jonathan Larmour + + * cdl/flash_synth.cdl: Add CYGMEM_FLASH_SYNTH_BASE to allow + imposition of base address. + Add CYGSEM_FLASH_SYNTH_FILE_WRITEBACK to allow changes to be + reflected in the underlying file. + * src/synth.c (flash_hwr_init): Implement CYGMEM_FLASH_SYNTH_BASE and + CYGSEM_FLASH_SYNTH_FILE_WRITEBACK using appropriate args to mmap(). + Include to avoid warning. + +2002-01-11 Jonathan Larmour + + * src/synth.c (flash_hwr_init): Initialize to 0xff if the file + needs creating. + * cdl/flash_synth.cdl: requires errno codes. + 2002-01-08 Jonathan Larmour 2001-11-1 Andrew Lunn @@ -5,29 +21,38 @@ 2001-11-1 Andrew Lunn #include +#include +#include #define _FLASH_PRIVATE_ #include @@ -84,18 +95,54 @@ flash_hwr_init(void) flash_info.blocks = CYGNUM_FLASH_SYNTH_NUMBLOCKS; cyg_dev_flash_synth_flashfd = cyg_hal_sys_open(CYGDAT_FLASH_SYNTH_FILENAME, + CYG_HAL_SYS_O_RDWR, + CYG_HAL_SYS_S_IRWXU|CYG_HAL_SYS_S_IRWXG|CYG_HAL_SYS_S_IRWXO); + if (cyg_dev_flash_synth_flashfd == -ENOENT) { + long w, bytesleft; + char buf[128]; + + cyg_dev_flash_synth_flashfd = cyg_hal_sys_open( + CYGDAT_FLASH_SYNTH_FILENAME, CYG_HAL_SYS_O_RDWR|CYG_HAL_SYS_O_CREAT, CYG_HAL_SYS_S_IRWXU|CYG_HAL_SYS_S_IRWXG|CYG_HAL_SYS_S_IRWXO); + CYG_ASSERT( cyg_dev_flash_synth_flashfd >= 0, + "Opening of the file for the synth flash failed!"); + // fill with 0xff + memset( buf, 0xff, sizeof(buf) ); + bytesleft = CYGNUM_FLASH_SYNTH_BLOCKSIZE * CYGNUM_FLASH_SYNTH_NUMBLOCKS; + while (bytesleft > 0) + { + int bytesneeded; + bytesneeded = bytesleft < sizeof(buf) ? bytesleft : sizeof(buf); + + w = cyg_hal_sys_write( cyg_dev_flash_synth_flashfd, buf, + bytesneeded ); + CYG_ASSERT(w == bytesneeded, "initialization of flash file failed"); + bytesleft -= bytesneeded; + } // while + } CYG_ASSERT( cyg_dev_flash_synth_flashfd >= 0, "Opening of the file for the synth flash failed!"); if ( cyg_dev_flash_synth_flashfd <= 0 ) { return FLASH_ERR_HWR; } - cyg_dev_flash_synth_base = cyg_hal_sys_do_mmap( NULL, + cyg_dev_flash_synth_base = (flash_t *)cyg_hal_sys_do_mmap( +#ifdef CYGMEM_FLASH_SYNTH_BASE + CYGMEM_FLASH_SYNTH_BASE, +#else + NULL, +#endif (CYGNUM_FLASH_SYNTH_BLOCKSIZE * CYGNUM_FLASH_SYNTH_NUMBLOCKS), - CYG_HAL_SYS_PROT_READ, CYG_HAL_SYS_MAP_PRIVATE, - cyg_dev_flash_synth_flashfd, - 0 ); + CYG_HAL_SYS_PROT_READ, +#ifdef CYGSEM_FLASH_SYNTH_FILE_WRITEBACK + CYG_HAL_SYS_MAP_SHARED +#else + CYG_HAL_SYS_MAP_PRIVATE +#endif +#ifdef CYGMEM_FLASH_SYNTH_BASE + |CYG_HAL_SYS_MAP_FIXED +#endif + , cyg_dev_flash_synth_flashfd, 0 ); CYG_ASSERT( cyg_dev_flash_synth_base > 0, "mmap of flash file failed!" ); if (cyg_dev_flash_synth_base <= 0) { diff --git a/packages/devs/flash/synth/current/src/synth.h b/packages/devs/flash/synth/current/src/synth.h --- a/packages/devs/flash/synth/current/src/synth.h +++ b/packages/devs/flash/synth/current/src/synth.h @@ -7,29 +7,38 @@ // synth Flash programming - device constants, etc. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/flash/synth/current/tests/flash1.c b/packages/devs/flash/synth/current/tests/flash1.c --- a/packages/devs/flash/synth/current/tests/flash1.c +++ b/packages/devs/flash/synth/current/tests/flash1.c @@ -8,29 +8,38 @@ static char copyright[] = " // Test flash operations for the synth target synth flash driver // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the \"License\"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an \"AS IS\" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/kbd/arm/aaed2000/current/ChangeLog b/packages/devs/kbd/arm/aaed2000/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/kbd/arm/aaed2000/current/ChangeLog @@ -0,0 +1,39 @@ +2002-03-10 Gary Thomas + + * src/aaed2000_kbd.c: + * cdl/kbd_aaed2000.cdl: New file(s). Keyboard driver for AAED2000. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/kbd/arm/aaed2000/current/cdl/kbd_aaed2000.cdl b/packages/devs/kbd/arm/aaed2000/current/cdl/kbd_aaed2000.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/kbd/arm/aaed2000/current/cdl/kbd_aaed2000.cdl @@ -0,0 +1,100 @@ +#========================================================================== +# +# kbd_aaed2000.cdl +# +# eCos configuration data for the Agilent AAED2000 keyboard +# +#========================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +#========================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Contributors: gthomas +# Date: 2002-03-11 +# Purpose: +# Description: Keyboard driver for Agilent AAED2000 +# +#####DESCRIPTIONEND#### +# +#========================================================================== + +cdl_package CYGPKG_DEVS_KBD_AAED2000 { + display "Keypad driver for AAED2000" + include_dir cyg/io + + active_if CYGPKG_IO_FILEIO + requires CYGPKG_IO + requires CYGFUN_KERNEL_API_C + requires CYGPKG_HAL_ARM_ARM9_AAED2000 + active_if !CYGSEM_AAED2000_LCD_COMM + + compile -library=libextras.a aaed2000_kbd.c + + description "Keyboard driver for the AAED2000" + + cdl_component CYGPKG_DEVS_KBD_AAED2000_OPTIONS { + display "options" + flavor none + no_define + + cdl_option CYGPKG_DEVS_KBD_AAED2000_CFLAGS { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the keypad driver package. These flags + are used in addition to the set of global flags." + } + + cdl_option CYGDAT_DEVS_KBD_AAED2000_NAME { + display "Device name for the keyboard driver" + flavor data + default_value {"\"/dev/kbd\""} + description " This option specifies the name of the keypad device" + } + + cdl_option CYGNUM_DEVS_KBD_AAED2000_EVENT_BUFFER_SIZE { + display "Number of events the driver can buffer" + flavor data + default_value { 32 } + description " + This option defines the size of the keypad device internal + buffer. The cyg_io_read() function will return as many of these + as there is space for in the buffer passed." + } + } +} diff --git a/packages/devs/kbd/arm/aaed2000/current/src/aaed2000_kbd.c b/packages/devs/kbd/arm/aaed2000/current/src/aaed2000_kbd.c new file mode 100644 --- /dev/null +++ b/packages/devs/kbd/arm/aaed2000/current/src/aaed2000_kbd.c @@ -0,0 +1,246 @@ +//========================================================================== +// +// aaed2000_kbd.c +// +// Keyboard driver for the Agilent AAED2000 +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2002-03-11 +// Purpose: +// Description: Keyboardd driver for Agilent AAED2000 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include // For select() functionality +static cyg_selinfo kbd_select_info; +static cyg_bool kbd_select_active; + +#include + +// Functions in this module + +static Cyg_ErrNo kbd_read(cyg_io_handle_t handle, + void *buffer, + cyg_uint32 *len); +static cyg_bool kbd_select(cyg_io_handle_t handle, + cyg_uint32 which, + cyg_addrword_t info); +static Cyg_ErrNo kbd_set_config(cyg_io_handle_t handle, + cyg_uint32 key, + const void *buffer, + cyg_uint32 *len); +static Cyg_ErrNo kbd_get_config(cyg_io_handle_t handle, + cyg_uint32 key, + void *buffer, + cyg_uint32 *len); +static bool kbd_init(struct cyg_devtab_entry *tab); +static Cyg_ErrNo kbd_lookup(struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *st, + const char *name); + +CHAR_DEVIO_TABLE(aaed2000_kbd_handlers, + NULL, // Unsupported write() function + kbd_read, + kbd_select, + kbd_get_config, + kbd_set_config); + +CHAR_DEVTAB_ENTRY(aaed2000_kbd_device, + CYGDAT_DEVS_KBD_AAED2000_NAME, + NULL, // Base device name + &aaed2000_kbd_handlers, + kbd_init, + kbd_lookup, + NULL); // Private data pointer + +#define MAX_EVENTS CYGNUM_DEVS_KBD_AAED2000_EVENT_BUFFER_SIZE +static int num_events; +static int _event_put, _event_get; +static unsigned char _events[MAX_EVENTS]; + +static bool _is_open = false; + +#define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL +static char kbd_scan_stack[STACK_SIZE]; +static cyg_thread kbd_scan_thread_data; +static cyg_handle_t kbd_scan_thread_handle; +#define SCAN_FREQ 20 // Hz +//#define SCAN_FREQ 5 // Hz +#define SCAN_DELAY ((1000/SCAN_FREQ)/10) + +static void +kbd_scan(cyg_addrword_t param) +{ + unsigned char ch; + unsigned char *ev; + + diag_printf("Keyboard scan\n"); + while (true) { + cyg_thread_delay(SCAN_DELAY); + if (aaed2000_KeyboardTest()) { + ch = aaed2000_KeyboardGetc(); + if (num_events < MAX_EVENTS) { + num_events++; + ev = &_events[_event_put++]; + if (_event_put == MAX_EVENTS) { + _event_put = 0; + } + *ev = ch; + if (kbd_select_active) { + kbd_select_active = false; + cyg_selwakeup(&kbd_select_info); + } + } + } + } +} + +static Cyg_ErrNo +kbd_read(cyg_io_handle_t handle, + void *buffer, + cyg_uint32 *len) +{ + unsigned char *ev; + int tot = *len; + unsigned char *bp = (unsigned char *)buffer; + + cyg_scheduler_lock(); // Prevent interaction with DSR code + while (tot >= sizeof(*ev)) { + if (num_events > 0) { + ev = &_events[_event_get++]; + if (_event_get == MAX_EVENTS) { + _event_get = 0; + } + memcpy(bp, ev, sizeof(*ev)); + bp += sizeof(*ev); + tot -= sizeof(*ev); + num_events--; + } else { + break; // No more events + } + } + cyg_scheduler_unlock(); // Allow DSRs again + diag_dump_buf(buffer, tot); + *len -= tot; + return ENOERR; +} + +static cyg_bool +kbd_select(cyg_io_handle_t handle, + cyg_uint32 which, + cyg_addrword_t info) +{ + if (which == CYG_FREAD) { + cyg_scheduler_lock(); // Prevent interaction with DSR code + if (num_events > 0) { + cyg_scheduler_unlock(); // Reallow interaction with DSR code + return true; + } + if (!kbd_select_active) { + kbd_select_active = true; + cyg_selrecord(info, &kbd_select_info); + } + cyg_scheduler_unlock(); // Reallow interaction with DSR code + } + return false; +} + +static Cyg_ErrNo +kbd_set_config(cyg_io_handle_t handle, + cyg_uint32 key, + const void *buffer, + cyg_uint32 *len) +{ + return EINVAL; +} + +static Cyg_ErrNo +kbd_get_config(cyg_io_handle_t handle, + cyg_uint32 key, + void *buffer, + cyg_uint32 *len) +{ + return EINVAL; +} + +static bool +kbd_init(struct cyg_devtab_entry *tab) +{ + cyg_selinit(&kbd_select_info); + return true; +} + +static Cyg_ErrNo +kbd_lookup(struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *st, + const char *name) +{ + if (!_is_open) { + _is_open = true; + cyg_thread_create(1, // Priority + kbd_scan, // entry + 0, // entry parameter + "Keyboard scan", // Name + &kbd_scan_stack[0], // Stack + STACK_SIZE, // Size + &kbd_scan_thread_handle, // Handle + &kbd_scan_thread_data // Thread data structure + ); + cyg_thread_resume(kbd_scan_thread_handle); // Start it + } + return ENOERR; +} + + + diff --git a/packages/devs/kbd/arm/ipaq/current/ChangeLog b/packages/devs/kbd/arm/ipaq/current/ChangeLog --- a/packages/devs/kbd/arm/ipaq/current/ChangeLog +++ b/packages/devs/kbd/arm/ipaq/current/ChangeLog @@ -12,27 +12,36 @@ 2001-03-15 Gary Thomas + + * src/cerf_pcmcia.c: + * cdl/pcmcia_cerf.cdl: New file(s) - port to Intrinsyc CerfCube. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/pcmcia/arm/cerf/current/cdl/pcmcia_cerf.cdl b/packages/devs/pcmcia/arm/cerf/current/cdl/pcmcia_cerf.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/pcmcia/arm/cerf/current/cdl/pcmcia_cerf.cdl @@ -0,0 +1,66 @@ +# ==================================================================== +# +# pcmcia_cerf.cdl +# +# PCMCIA (Compact Flash) - Hardware support on Intrinsyc Cerf +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Original data: gthomas +# Contributors: +# Date: 2000-07-06 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_PCMCIA_CERF { + display "SA11x0/Cerf PCMCIA support" + + parent CYGPKG_IO_PCMCIA + active_if CYGPKG_IO_PCMCIA + active_if CYGPKG_HAL_ARM_SA11X0_CERF + + implements CYGHWR_IO_PCMCIA_DEVICE + + include_dir . + include_files ; # none _exported_ whatsoever + description "PCMCIA (Compact Flash) device support for SA11x0/Cerf" + compile cerf_pcmcia.c +} + diff --git a/packages/devs/pcmcia/arm/cerf/current/src/cerf_pcmcia.c b/packages/devs/pcmcia/arm/cerf/current/src/cerf_pcmcia.c new file mode 100644 --- /dev/null +++ b/packages/devs/pcmcia/arm/cerf/current/src/cerf_pcmcia.c @@ -0,0 +1,272 @@ +//========================================================================== +// +// devs/pcmcia/cerf/cerf_pcmcia.c +// +// PCMCIA support (Card Services) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-07-06 +// Purpose: PCMCIA support +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include // IO macros +#include // Register state info +#include // HAL interrupt macros +#include + +#ifdef CYGPKG_KERNEL +#include // Configuration header +#include +#endif +#include + +#include +#include + +#include // Board definitions +#include + +#ifdef CYGPKG_KERNEL +static cyg_interrupt cf_detect_interrupt; +static cyg_handle_t cf_detect_interrupt_handle; +static cyg_interrupt cf_irq_interrupt; +static cyg_handle_t cf_irq_interrupt_handle; + +// This ISR is called when a CompactFlash board is inserted +static int +cf_detect_isr(cyg_vector_t vector, cyg_addrword_t data, HAL_SavedRegisters *regs) +{ + cyg_interrupt_mask(SA1110_CF_DETECT); + return (CYG_ISR_HANDLED|CYG_ISR_CALL_DSR); // Run the DSR +} + +// This DSR handles the board insertion +static void +cf_detect_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + unsigned long new_state = *SA11X0_GPIO_PIN_LEVEL; + struct cf_slot *slot = (struct cf_slot *)data; + if ((new_state & SA1110_GPIO_CF_DETECT) == SA1110_GPIO_CF_PRESENT) { + slot->state = CF_SLOT_STATE_Inserted; + } else { + slot->state = CF_SLOT_STATE_Removed; // Implies powered up, etc. + } + cyg_interrupt_acknowledge(SA1110_CF_DETECT); + cyg_interrupt_unmask(SA1110_CF_DETECT); +} + +// This ISR is called when the card interrupt occurs +static int +cf_irq_isr(cyg_vector_t vector, cyg_addrword_t data, HAL_SavedRegisters *regs) +{ + cyg_drv_interrupt_mask(SA1110_CF_IRQ); + return (CYG_ISR_HANDLED|CYG_ISR_CALL_DSR); // Run the DSR +} + +// This DSR handles the card interrupt +static void +cf_irq_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + struct cf_slot *slot = (struct cf_slot *)data; +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + cyg_bool was_ctrlc_int; +#endif + + // Clear interrupt [edge indication] + cyg_drv_interrupt_acknowledge(SA1110_CF_IRQ); +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + was_ctrlc_int = HAL_CTRLC_CHECK(vector, data); + if (!was_ctrlc_int) // Fall through and run normal code +#endif + // Process interrupt + (slot->irq_handler.handler)(vector, count, slot->irq_handler.param); + // Allow interrupts to happen again + cyg_drv_interrupt_unmask(SA1110_CF_IRQ); +} +#endif + +// +// Fill in the details of a PCMCIA slot and initialize the device +// +void +cf_hwr_init(struct cf_slot *slot) +{ + static int int_init = 0; + unsigned long new_state = *SA11X0_GPIO_PIN_LEVEL; + if (!int_init) { + int_init = 1; +#ifdef CYGPKG_KERNEL + // Set up interrupts + cyg_drv_interrupt_create(SA1110_CF_DETECT, + 99, // Priority - what goes here? + (cyg_addrword_t) slot, // Data item passed to interrupt handler + (cyg_ISR_t *)cf_detect_isr, + (cyg_DSR_t *)cf_detect_dsr, + &cf_detect_interrupt_handle, + &cf_detect_interrupt); + cyg_drv_interrupt_attach(cf_detect_interrupt_handle); + cyg_drv_interrupt_configure(SA1110_CF_DETECT, true, true); // Detect either edge + cyg_drv_interrupt_acknowledge(SA1110_CF_DETECT); + cyg_drv_interrupt_unmask(SA1110_CF_DETECT); + cyg_drv_interrupt_create(SA1110_CF_IRQ, + 99, // Priority - what goes here? + (cyg_addrword_t) slot, // Data item passed to interrupt handler + (cyg_ISR_t *)cf_irq_isr, + (cyg_DSR_t *)cf_irq_dsr, + &cf_irq_interrupt_handle, + &cf_irq_interrupt); + cyg_drv_interrupt_attach(cf_irq_interrupt_handle); + cyg_drv_interrupt_unmask(SA1110_CF_IRQ); +#endif + cyg_drv_interrupt_configure(SA1110_CF_IRQ, false, false); // Falling edge + cyg_drv_interrupt_acknowledge(SA1110_CF_IRQ); + } + slot->attr = (unsigned char *)0x38000000; + slot->attr_length = 0x200; + slot->io = (unsigned char *)0x30000000; + slot->io_length = 0x04000000; + slot->mem = (unsigned char *)0x3C000000; + slot->mem_length = 0x04000000; + slot->int_num = SA1110_CF_IRQ; +#ifdef CYG_HAL_STARTUP_ROM + // Disable CF bus & power (idle/off) + cerf_BCR(SA1110_BCR_CF_POWER | + SA1110_BCR_CF_RESET | + SA1110_BCR_CF_BUS, + SA1110_BCR_CF_POWER_OFF | + SA1110_BCR_CF_RESET_DISABLE | + SA1110_BCR_CF_BUS_OFF); +#endif + if ((new_state & SA1110_GPIO_CF_DETECT) == SA1110_GPIO_CF_PRESENT) { + if ((_cerf_BCR & SA1110_BCR_CF_POWER) == SA1110_BCR_CF_POWER_ON) { + // Assume that the ROM environment has turned the bus on + slot->state = CF_SLOT_STATE_Ready; + } else { + slot->state = CF_SLOT_STATE_Inserted; + } + } else { + slot->state = CF_SLOT_STATE_Empty; + } +} + +void +cf_hwr_poll(struct cf_slot *slot) +{ + unsigned long new_state = *SA11X0_GPIO_PIN_LEVEL; + if ((new_state & SA1110_GPIO_CF_DETECT) == SA1110_GPIO_CF_PRESENT) { + slot->state = CF_SLOT_STATE_Inserted; + } else { + slot->state = CF_SLOT_STATE_Empty; + } +} + +static void +do_delay(int ticks) +{ +#ifdef CYGPKG_KERNEL + cyg_thread_delay(ticks); +#else + CYGACC_CALL_IF_DELAY_US(10000*ticks); +#endif +} + +// +// Transition the card/slot to a new state +// note: currently only supports transitions to Ready, Empty +// +bool +cf_hwr_change_state(struct cf_slot *slot, int new_state) +{ + int i, ptr, len; + unsigned char buf[256]; + + if (new_state == CF_SLOT_STATE_Ready) { + if (slot->state == CF_SLOT_STATE_Inserted) { + cerf_BCR(SA1110_BCR_CF_POWER | + SA1110_BCR_CF_RESET | + SA1110_BCR_CF_BUS, + SA1110_BCR_CF_POWER_ON | + SA1110_BCR_CF_RESET_DISABLE | + SA1110_BCR_CF_BUS_OFF); + do_delay(30); // At least 300 ms + slot->state = CF_SLOT_STATE_Powered; + cerf_BCR(SA1110_BCR_CF_POWER | + SA1110_BCR_CF_RESET | + SA1110_BCR_CF_BUS, + SA1110_BCR_CF_POWER_ON | + SA1110_BCR_CF_RESET_ENABLE | + SA1110_BCR_CF_BUS_ON); + do_delay(1); // At least 10 us + slot->state = CF_SLOT_STATE_Reset; + cerf_BCR(SA1110_BCR_CF_POWER | + SA1110_BCR_CF_RESET | + SA1110_BCR_CF_BUS, + SA1110_BCR_CF_POWER_ON | + SA1110_BCR_CF_RESET_DISABLE | + SA1110_BCR_CF_BUS_ON); + do_delay(5); // At least 20 ms + // Wait until the card is ready to talk + for (i = 0; i < 10; i++) { + ptr = 0; + if (cf_get_CIS(slot, CF_CISTPL_VERS_1, buf, &len, &ptr)) { + slot->state = CF_SLOT_STATE_Ready; + break; + } + do_delay(10); + } + } + } +} + +// +// Acknowledge interrupt (used in non-kernel environments) +// +void +cf_hwr_clear_interrupt(struct cf_slot *slot) +{ + // Clear interrupt [edge indication] + cyg_drv_interrupt_acknowledge(SA1110_CF_IRQ); +} diff --git a/packages/devs/pcmcia/arm/cerfpda/current/ChangeLog b/packages/devs/pcmcia/arm/cerfpda/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/pcmcia/arm/cerfpda/current/ChangeLog @@ -0,0 +1,39 @@ +2002-02-04 Gary Thomas + + * src/cerfpda_pcmcia.c: + * cdl/pcmcia_cerfpda.cdl: New file(s) - port to Intrinsyc CerfPDA. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/pcmcia/arm/cerfpda/current/cdl/pcmcia_cerfpda.cdl b/packages/devs/pcmcia/arm/cerfpda/current/cdl/pcmcia_cerfpda.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/pcmcia/arm/cerfpda/current/cdl/pcmcia_cerfpda.cdl @@ -0,0 +1,66 @@ +# ==================================================================== +# +# pcmcia_cerfpda.cdl +# +# PCMCIA (Compact Flash) - Hardware support on Intrinsyc CerfPDA +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Original data: gthomas +# Contributors: +# Date: 2000-07-06 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_PCMCIA_CERFPDA { + display "SA11x0/Cerfpda PCMCIA support" + + parent CYGPKG_IO_PCMCIA + active_if CYGPKG_IO_PCMCIA + active_if CYGPKG_HAL_ARM_SA11X0_CERFPDA + + implements CYGHWR_IO_PCMCIA_DEVICE + + include_dir . + include_files ; # none _exported_ whatsoever + description "PCMCIA (Compact Flash) device support for SA11x0/Cerfpda" + compile cerfpda_pcmcia.c +} + diff --git a/packages/devs/pcmcia/arm/cerfpda/current/src/cerfpda_pcmcia.c b/packages/devs/pcmcia/arm/cerfpda/current/src/cerfpda_pcmcia.c new file mode 100644 --- /dev/null +++ b/packages/devs/pcmcia/arm/cerfpda/current/src/cerfpda_pcmcia.c @@ -0,0 +1,272 @@ +//========================================================================== +// +// devs/pcmcia/cerfpda/cerfpda_pcmcia.c +// +// PCMCIA support (Card Services) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-07-06 +// Purpose: PCMCIA support +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include // IO macros +#include // Register state info +#include // HAL interrupt macros +#include + +#ifdef CYGPKG_KERNEL +#include // Configuration header +#include +#endif +#include + +#include +#include + +#include // Board definitions +#include + +#ifdef CYGPKG_KERNEL +static cyg_interrupt cf_detect_interrupt; +static cyg_handle_t cf_detect_interrupt_handle; +static cyg_interrupt cf_irq_interrupt; +static cyg_handle_t cf_irq_interrupt_handle; + +// This ISR is called when a CompactFlash board is inserted +static int +cf_detect_isr(cyg_vector_t vector, cyg_addrword_t data, HAL_SavedRegisters *regs) +{ + cyg_interrupt_mask(SA1110_CF_DETECT); + return (CYG_ISR_HANDLED|CYG_ISR_CALL_DSR); // Run the DSR +} + +// This DSR handles the board insertion +static void +cf_detect_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + unsigned long new_state = *SA11X0_GPIO_PIN_LEVEL; + struct cf_slot *slot = (struct cf_slot *)data; + if ((new_state & SA1110_GPIO_CF_DETECT) == SA1110_GPIO_CF_PRESENT) { + slot->state = CF_SLOT_STATE_Inserted; + } else { + slot->state = CF_SLOT_STATE_Removed; // Implies powered up, etc. + } + cyg_interrupt_acknowledge(SA1110_CF_DETECT); + cyg_interrupt_unmask(SA1110_CF_DETECT); +} + +// This ISR is called when the card interrupt occurs +static int +cf_irq_isr(cyg_vector_t vector, cyg_addrword_t data, HAL_SavedRegisters *regs) +{ + cyg_drv_interrupt_mask(SA1110_CF_IRQ); + return (CYG_ISR_HANDLED|CYG_ISR_CALL_DSR); // Run the DSR +} + +// This DSR handles the card interrupt +static void +cf_irq_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + struct cf_slot *slot = (struct cf_slot *)data; +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + cyg_bool was_ctrlc_int; +#endif + + // Clear interrupt [edge indication] + cyg_drv_interrupt_acknowledge(SA1110_CF_IRQ); +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + was_ctrlc_int = HAL_CTRLC_CHECK(vector, data); + if (!was_ctrlc_int) // Fall through and run normal code +#endif + // Process interrupt + (slot->irq_handler.handler)(vector, count, slot->irq_handler.param); + // Allow interrupts to happen again + cyg_drv_interrupt_unmask(SA1110_CF_IRQ); +} +#endif + +// +// Fill in the details of a PCMCIA slot and initialize the device +// +void +cf_hwr_init(struct cf_slot *slot) +{ + static int int_init = 0; + unsigned long new_state = *SA11X0_GPIO_PIN_LEVEL; + if (!int_init) { + int_init = 1; +#ifdef CYGPKG_KERNEL + // Set up interrupts + cyg_drv_interrupt_create(SA1110_CF_DETECT, + 99, // Priority - what goes here? + (cyg_addrword_t) slot, // Data item passed to interrupt handler + (cyg_ISR_t *)cf_detect_isr, + (cyg_DSR_t *)cf_detect_dsr, + &cf_detect_interrupt_handle, + &cf_detect_interrupt); + cyg_drv_interrupt_attach(cf_detect_interrupt_handle); + cyg_drv_interrupt_configure(SA1110_CF_DETECT, true, true); // Detect either edge + cyg_drv_interrupt_acknowledge(SA1110_CF_DETECT); + cyg_drv_interrupt_unmask(SA1110_CF_DETECT); + cyg_drv_interrupt_create(SA1110_CF_IRQ, + 99, // Priority - what goes here? + (cyg_addrword_t) slot, // Data item passed to interrupt handler + (cyg_ISR_t *)cf_irq_isr, + (cyg_DSR_t *)cf_irq_dsr, + &cf_irq_interrupt_handle, + &cf_irq_interrupt); + cyg_drv_interrupt_attach(cf_irq_interrupt_handle); + cyg_drv_interrupt_unmask(SA1110_CF_IRQ); +#endif + cyg_drv_interrupt_configure(SA1110_CF_IRQ, false, false); // Falling edge + cyg_drv_interrupt_acknowledge(SA1110_CF_IRQ); + } + slot->attr = (unsigned char *)0x38000000; + slot->attr_length = 0x200; + slot->io = (unsigned char *)0x30000000; + slot->io_length = 0x04000000; + slot->mem = (unsigned char *)0x3C000000; + slot->mem_length = 0x04000000; + slot->int_num = SA1110_CF_IRQ; +#ifdef CYG_HAL_STARTUP_ROM + // Disable CF bus & power (idle/off) + cerfpda_BCR(SA1110_BCR_CF_POWER | + SA1110_BCR_CF_RESET | + SA1110_BCR_CF_BUS, + SA1110_BCR_CF_POWER_OFF | + SA1110_BCR_CF_RESET_DISABLE | + SA1110_BCR_CF_BUS_OFF); +#endif + if ((new_state & SA1110_GPIO_CF_DETECT) == SA1110_GPIO_CF_PRESENT) { + if ((_cerfpda_BCR & SA1110_BCR_CF_POWER) == SA1110_BCR_CF_POWER_ON) { + // Assume that the ROM environment has turned the bus on + slot->state = CF_SLOT_STATE_Ready; + } else { + slot->state = CF_SLOT_STATE_Inserted; + } + } else { + slot->state = CF_SLOT_STATE_Empty; + } +} + +void +cf_hwr_poll(struct cf_slot *slot) +{ + unsigned long new_state = *SA11X0_GPIO_PIN_LEVEL; + if ((new_state & SA1110_GPIO_CF_DETECT) == SA1110_GPIO_CF_PRESENT) { + slot->state = CF_SLOT_STATE_Inserted; + } else { + slot->state = CF_SLOT_STATE_Empty; + } +} + +static void +do_delay(int ticks) +{ +#ifdef CYGPKG_KERNEL + cyg_thread_delay(ticks); +#else + CYGACC_CALL_IF_DELAY_US(10000*ticks); +#endif +} + +// +// Transition the card/slot to a new state +// note: currently only supports transitions to Ready, Empty +// +bool +cf_hwr_change_state(struct cf_slot *slot, int new_state) +{ + int i, ptr, len; + unsigned char buf[256]; + + if (new_state == CF_SLOT_STATE_Ready) { + if (slot->state == CF_SLOT_STATE_Inserted) { + cerfpda_BCR(SA1110_BCR_CF_POWER | + SA1110_BCR_CF_RESET | + SA1110_BCR_CF_BUS, + SA1110_BCR_CF_POWER_ON | + SA1110_BCR_CF_RESET_DISABLE | + SA1110_BCR_CF_BUS_OFF); + do_delay(30); // At least 300 ms + slot->state = CF_SLOT_STATE_Powered; + cerfpda_BCR(SA1110_BCR_CF_POWER | + SA1110_BCR_CF_RESET | + SA1110_BCR_CF_BUS, + SA1110_BCR_CF_POWER_ON | + SA1110_BCR_CF_RESET_ENABLE | + SA1110_BCR_CF_BUS_ON); + do_delay(1); // At least 10 us + slot->state = CF_SLOT_STATE_Reset; + cerfpda_BCR(SA1110_BCR_CF_POWER | + SA1110_BCR_CF_RESET | + SA1110_BCR_CF_BUS, + SA1110_BCR_CF_POWER_ON | + SA1110_BCR_CF_RESET_DISABLE | + SA1110_BCR_CF_BUS_ON); + do_delay(5); // At least 20 ms + // Wait until the card is ready to talk + for (i = 0; i < 10; i++) { + ptr = 0; + if (cf_get_CIS(slot, CF_CISTPL_VERS_1, buf, &len, &ptr)) { + slot->state = CF_SLOT_STATE_Ready; + break; + } + do_delay(10); + } + } + } +} + +// +// Acknowledge interrupt (used in non-kernel environments) +// +void +cf_hwr_clear_interrupt(struct cf_slot *slot) +{ + // Clear interrupt [edge indication] + cyg_drv_interrupt_acknowledge(SA1110_CF_IRQ); +} diff --git a/packages/devs/pcmcia/arm/ipaq/current/ChangeLog b/packages/devs/pcmcia/arm/ipaq/current/ChangeLog --- a/packages/devs/pcmcia/arm/ipaq/current/ChangeLog +++ b/packages/devs/pcmcia/arm/ipaq/current/ChangeLog @@ -1,3 +1,7 @@ +2002-04-12 Gary Thomas + + * src/ipaq_pcmcia.c: Clean up warnings. + 2001-07-13 Gary Thomas * src/ipaq_pcmcia.c (cf_hwr_change_state): Use VERS_1 instead of @@ -19,27 +23,36 @@ 2001-02-24 Gary Thomas + + * src/aaed2000_serial.c (aaed2000_serial_DSR): Reworked a little + to fill/empty FIFO. + +2001-11-13 Jesper Skov + + * src/aaed2000_serial.c: Removed ser1 structures. Fix reader. Make + DSR loop to empty FIFO. + +2001-11-12 Jesper Skov + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/serial/arm/aaed2000/current/cdl/ser_arm_aaed2000.cdl b/packages/devs/serial/arm/aaed2000/current/cdl/ser_arm_aaed2000.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/arm/aaed2000/current/cdl/ser_arm_aaed2000.cdl @@ -0,0 +1,161 @@ +# ==================================================================== +# +# ser_arm_aaed2000.cdl +# +# eCos serial Agilent/AAED2000 configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: jskov +# Date: 2001-11-12 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + + +cdl_package CYGPKG_IO_SERIAL_ARM_AAED2000 { + display "ARM AAED2000 serial device driver" + + parent CYGPKG_IO_SERIAL_DEVICES + active_if CYGPKG_IO_SERIAL + active_if CYGPKG_HAL_ARM_ARM9_AAED2000 + + requires CYGPKG_ERROR + include_dir cyg/io + include_files ; # none _exported_ whatsoever + description " + This option enables the serial device drivers for the + Agilent AAED2000." + doc redirect/ecos-device-drivers.html + + compile -library=libextras.a aaed2000_serial.c + + define_proc { + puts $::cdl_system_header "/***** serial driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_DEVICE_HEADER " + puts $::cdl_system_header "/***** serial driver proc output end *****/" + } + + cdl_component CYGPKG_IO_SERIAL_ARM_AAED2000_SERIAL0 { + display "Agilent AAED2000-1 serial port 0 driver" + flavor bool + default_value 1 + description " + This option includes the serial device driver for the Agilent AAED2000." + + cdl_option CYGDAT_IO_SERIAL_ARM_AAED2000_SERIAL0_NAME { + display "Device name for the Agilent AAED2000-1 serial port driver" + flavor data + default_value {"\"/dev/ser0\""} + description " + This option sets the name of the serial device for the Agilent AAED2000." + } + + cdl_option CYGNUM_IO_SERIAL_ARM_AAED2000_SERIAL0_BAUD { + display "Baud rate for the Agilent AAED2000 serial port driver" + flavor data + legal_values { 1200 2400 3600 4800 7200 9600 14400 19200 38400 57600 115200 230400 } + default_value 38400 + description " + This option specifies the default baud rate (speed) for the Agilent AAED2000." + } + + cdl_option CYGNUM_IO_SERIAL_ARM_AAED2000_SERIAL0_BUFSIZE { + display "Buffer size for the Agilent AAED2000 serial port driver" + flavor data + legal_values 0 to 8192 + default_value 128 + description " + This option specifies the size of the internal buffers used for + the Agilent AAED2000 serial driver." + } + } + + cdl_component CYGPKG_IO_SERIAL_ARM_AAED2000_OPTIONS { + display "Serial device driver build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_IO_SERIAL_ARM_AAED2000_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building these serial device drivers. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_IO_SERIAL_ARM_AAED2000_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building these serial device drivers. These flags are removed from + the set of global flags if present." + } + } + + cdl_component CYGPKG_IO_SERIAL_ARM_AAED2000_TESTING { + display "Testing parameters" + flavor bool + calculated 1 + active_if CYGPKG_IO_SERIAL_ARM_AAED2000_SERIAL0 + + cdl_option CYGPRI_SER_TEST_SER_DEV { + display "Serial device used for testing" + flavor data + default_value { CYGDAT_IO_SERIAL_ARM_AAED2000_SERIAL0_NAME } + } + + define_proc { + puts $::cdl_header "#define CYGPRI_SER_TEST_CRASH_ID \"aaed2000\"" + puts $::cdl_header "#define CYGPRI_SER_TEST_TTY_DEV \"/dev/tty0\"" + } + } +} + +# EOF ser_arm_aaed2000.cdl diff --git a/packages/devs/serial/arm/aaed2000/current/src/aaed2000_serial.c b/packages/devs/serial/arm/aaed2000/current/src/aaed2000_serial.c new file mode 100644 --- /dev/null +++ b/packages/devs/serial/arm/aaed2000/current/src/aaed2000_serial.c @@ -0,0 +1,339 @@ +//========================================================================== +// +// io/serial/arm/aaed2000_serial.c +// +// Agilent AAED2000 Serial I/O Interface Module (interrupt driven) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas, jskov +// Contributors:gthomas, jskov +// Date: 2001-11-12 +// Purpose: AAED2000 Serial I/O module (interrupt driven version) +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include +#include +#include // interrupt +#include // register base +#include +#include +#include + +#include "aaed2000_serial.h" + +typedef struct aaed2000_serial_info { + CYG_ADDRWORD base; + CYG_WORD int_num; + cyg_interrupt serial_interrupt; + cyg_handle_t serial_interrupt_handle; +} aaed2000_serial_info; + +static bool aaed2000_serial_init(struct cyg_devtab_entry *tab); +static bool aaed2000_serial_putc(serial_channel *chan, unsigned char c); +static Cyg_ErrNo aaed2000_serial_lookup(struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *sub_tab, + const char *name); +static unsigned char aaed2000_serial_getc(serial_channel *chan); +static Cyg_ErrNo aaed2000_serial_set_config(serial_channel *chan, + cyg_uint32 key, + const void *xbuf, cyg_uint32 *len); +static void aaed2000_serial_start_xmit(serial_channel *chan); +static void aaed2000_serial_stop_xmit(serial_channel *chan); + +static cyg_uint32 aaed2000_serial_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void aaed2000_serial_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); + +static SERIAL_FUNS(aaed2000_serial_funs, + aaed2000_serial_putc, + aaed2000_serial_getc, + aaed2000_serial_set_config, + aaed2000_serial_start_xmit, + aaed2000_serial_stop_xmit + ); + +#ifdef CYGPKG_IO_SERIAL_ARM_AAED2000_SERIAL0 +static aaed2000_serial_info aaed2000_serial_info0 = {0x80000800, + CYGNUM_HAL_INTERRUPT_UART3INTR}; +#if CYGNUM_IO_SERIAL_ARM_AAED2000_SERIAL0_BUFSIZE > 0 +static unsigned char aaed2000_serial_out_buf0[CYGNUM_IO_SERIAL_ARM_AAED2000_SERIAL0_BUFSIZE]; +static unsigned char aaed2000_serial_in_buf0[CYGNUM_IO_SERIAL_ARM_AAED2000_SERIAL0_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(aaed2000_serial_channel0, + aaed2000_serial_funs, + aaed2000_serial_info0, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_AAED2000_SERIAL0_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &aaed2000_serial_out_buf0[0], sizeof(aaed2000_serial_out_buf0), + &aaed2000_serial_in_buf0[0], sizeof(aaed2000_serial_in_buf0) + ); +#else +static SERIAL_CHANNEL(aaed2000_serial_channel0, + aaed2000_serial_funs, + aaed2000_serial_info0, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_AAED2000_SERIAL0_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT + ); +#endif + +DEVTAB_ENTRY(aaed2000_serial_io0, + CYGDAT_IO_SERIAL_ARM_AAED2000_SERIAL0_NAME, + 0, // Does not depend on a lower level interface + &cyg_io_serial_devio, + aaed2000_serial_init, + aaed2000_serial_lookup, // Serial driver may need initializing + &aaed2000_serial_channel0 + ); +#endif // CYGPKG_IO_SERIAL_ARM_AAED2000_SERIAL0 + +// Internal function to actually configure the hardware to desired baud rate, etc. +static bool +aaed2000_serial_config_port(serial_channel *chan, cyg_serial_info_t *new_config, bool init) +{ + aaed2000_serial_info *aaed2000_chan = (aaed2000_serial_info *)chan->dev_priv; + CYG_ADDRWORD base = aaed2000_chan->base; + unsigned short baud_divisor = select_baud[new_config->baud]; + cyg_uint32 _lcr, _intm; + if (baud_divisor == 0) return false; + + // Register writes don't take effect till the UART is enabled. + HAL_WRITE_UINT32(base+AAEC_UART_CTRL, AAEC_UART_CTRL_ENAB); + + // Disable port interrupts while changing hardware + HAL_READ_UINT32(base+AAEC_UART_INTM, _intm); + HAL_WRITE_UINT32(base+AAEC_UART_INTM, 0); + + _lcr = select_word_length[new_config->word_length - CYGNUM_SERIAL_WORD_LENGTH_5] | + select_stop_bits[new_config->stop] | + select_parity[new_config->parity]; + HAL_WRITE_UINT32(base+AAEC_UART_BAUD, baud_divisor); + if (init) { + _lcr |= AAEC_UART_LCR_FIFO; // Enable FIFO + if (chan->out_cbuf.len != 0) { + _intm = AAEC_UART_INT_RIS|AAEC_UART_INT_RTIS; + } else { + _intm = 0; + } + } + if (new_config != &chan->config) { + chan->config = *new_config; + } + + // Set line control and (re)enable interrupts + HAL_WRITE_UINT32(base+AAEC_UART_LCR, _lcr); + HAL_WRITE_UINT32(base+AAEC_UART_INTM, _intm); + + return true; +} + +// Function to initialize the device. Called at bootstrap time. +static bool +aaed2000_serial_init(struct cyg_devtab_entry *tab) +{ + serial_channel *chan = (serial_channel *)tab->priv; + aaed2000_serial_info *aaed2000_chan = (aaed2000_serial_info *)chan->dev_priv; +#ifdef CYGDBG_IO_INIT + diag_printf("AAED2000 SERIAL init - dev: 0x%08x.%d\n", + aaed2000_chan->base, aaed2000_chan->int_num); +#endif + (chan->callbacks->serial_init)(chan); // Really only required for interrupt driven devices + if (chan->out_cbuf.len != 0) { + cyg_drv_interrupt_create(aaed2000_chan->int_num, + 1, // Priority - unused + (cyg_addrword_t)chan, // Data item passed to interrupt handler + aaed2000_serial_ISR, + aaed2000_serial_DSR, + &aaed2000_chan->serial_interrupt_handle, + &aaed2000_chan->serial_interrupt); + cyg_drv_interrupt_attach(aaed2000_chan->serial_interrupt_handle); + cyg_drv_interrupt_unmask(aaed2000_chan->int_num); + } + aaed2000_serial_config_port(chan, &chan->config, true); + return true; +} + +// This routine is called when the device is "looked" up (i.e. attached) +static Cyg_ErrNo +aaed2000_serial_lookup(struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *sub_tab, + const char *name) +{ + serial_channel *chan = (serial_channel *)(*tab)->priv; + (chan->callbacks->serial_init)(chan); // Really only required for interrupt driven devices + return ENOERR; +} + +// Send a character to the device output buffer. +// Return 'true' if character is sent to device +static bool +aaed2000_serial_putc(serial_channel *chan, unsigned char c) +{ + aaed2000_serial_info *aaed2000_chan = (aaed2000_serial_info *)chan->dev_priv; + CYG_ADDRWORD base = aaed2000_chan->base; + cyg_uint32 _status; + + HAL_READ_UINT32(base+AAEC_UART_STATUS, _status); + if (_status & AAEC_UART_STATUS_TxFF) { + // No space + return false; + } else { + // Transmit buffer is empty + HAL_WRITE_UINT32(base+AAEC_UART_DATA, (cyg_uint32)c); + return true; + } +} + +// Fetch a character from the device input buffer, waiting if necessary +static unsigned char +aaed2000_serial_getc(serial_channel *chan) +{ + aaed2000_serial_info *aaed2000_chan = (aaed2000_serial_info *)chan->dev_priv; + CYG_ADDRWORD base = aaed2000_chan->base; + cyg_uint32 _status; + cyg_uint32 _c; + + do { + HAL_READ_UINT32(base+AAEC_UART_STATUS, _status); + } while (_status & AAEC_UART_STATUS_RxFE); + + HAL_READ_UINT32(base+AAEC_UART_DATA, _c); + return (unsigned char)_c; +} + +// Set up the device characteristics; baud rate, etc. +static Cyg_ErrNo +aaed2000_serial_set_config(serial_channel *chan, cyg_uint32 key, + const void *xbuf, cyg_uint32 *len) +{ + switch (key) { + case CYG_IO_SET_CONFIG_SERIAL_INFO: + { + cyg_serial_info_t *config = (cyg_serial_info_t *)xbuf; + if ( *len < sizeof(cyg_serial_info_t) ) { + return -EINVAL; + } + *len = sizeof(cyg_serial_info_t); + if ( true != aaed2000_serial_config_port(chan, config, false) ) + return -EINVAL; + } + break; + default: + return -EINVAL; + } + return ENOERR; +} + +// Enable the transmitter on the device +static void +aaed2000_serial_start_xmit(serial_channel *chan) +{ + aaed2000_serial_info *aaed2000_chan = (aaed2000_serial_info *)chan->dev_priv; + CYG_ADDRWORD base = aaed2000_chan->base; + cyg_uint32 _intm; + + HAL_READ_UINT32(base+AAEC_UART_INTM, _intm); + _intm |= AAEC_UART_INT_TIS; + HAL_WRITE_UINT32(base+AAEC_UART_INTM, _intm); +} + +// Disable the transmitter on the device +static void +aaed2000_serial_stop_xmit(serial_channel *chan) +{ + aaed2000_serial_info *aaed2000_chan = (aaed2000_serial_info *)chan->dev_priv; + CYG_ADDRWORD base = aaed2000_chan->base; + cyg_uint32 _intm; + + HAL_READ_UINT32(base+AAEC_UART_INTM, _intm); + _intm &= ~AAEC_UART_INT_TIS; + HAL_WRITE_UINT32(base+AAEC_UART_INTM, _intm); +} + +// Serial I/O - low level interrupt handler (ISR) +static cyg_uint32 +aaed2000_serial_ISR(cyg_vector_t vector, cyg_addrword_t data) +{ + serial_channel *chan = (serial_channel *)data; + aaed2000_serial_info *aaed2000_chan = (aaed2000_serial_info *)chan->dev_priv; + cyg_drv_interrupt_mask(aaed2000_chan->int_num); + cyg_drv_interrupt_acknowledge(aaed2000_chan->int_num); + return CYG_ISR_CALL_DSR; // Cause DSR to be run +} + +// Serial I/O - high level interrupt handler (DSR) +static void +aaed2000_serial_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + serial_channel *chan = (serial_channel *)data; + aaed2000_serial_info *aaed2000_chan = (aaed2000_serial_info *)chan->dev_priv; + CYG_ADDRWORD base = aaed2000_chan->base; + cyg_uint32 _intres, _c; + + HAL_READ_UINT32(base+AAEC_UART_INTRES, _intres); + _intres &= (AAEC_UART_INT_TIS | AAEC_UART_INT_RIS | AAEC_UART_INT_RTIS); + while (_intres) { + + // Empty Rx FIFO + if (_intres & (AAEC_UART_INT_RIS|AAEC_UART_INT_RTIS)) { + HAL_READ_UINT32(base+AAEC_UART_DATA, _c); + (chan->callbacks->rcv_char)(chan, (unsigned char)_c); + } + + // Fill into Tx FIFO. xmt_char will mask the interrupt when it + // runs out of chars, so doing this in a loop is OK. + if (_intres & AAEC_UART_INT_TIS) { + (chan->callbacks->xmt_char)(chan); + } + + HAL_READ_UINT32(base+AAEC_UART_INTRES, _intres); + _intres &= (AAEC_UART_INT_TIS | AAEC_UART_INT_RIS | AAEC_UART_INT_RTIS); + } + + cyg_drv_interrupt_unmask(aaed2000_chan->int_num); +} diff --git a/packages/devs/serial/arm/aaed2000/current/src/aaed2000_serial.h b/packages/devs/serial/arm/aaed2000/current/src/aaed2000_serial.h new file mode 100644 --- /dev/null +++ b/packages/devs/serial/arm/aaed2000/current/src/aaed2000_serial.h @@ -0,0 +1,106 @@ +#ifndef CYGONCE_ARM_AAED2000_SERIAL_H +#define CYGONCE_ARM_AAED2000_SERIAL_H + +// ==================================================================== +// +// aaed2000_serial.h +// +// Device I/O - Description of Agilent AAED2000 serial hardware +// +// ==================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +// ==================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas, jskov +// Contributors:gthomas, jskov +// Date: 2001-11-12 +// Purpose: Internal interfaces for serial I/O drivers +// Description: +// +//####DESCRIPTIONEND#### +// +// ==================================================================== + +static unsigned char select_word_length[] = { + AAEC_UART_LCR_WL5, // 5 bits / word (char) + AAEC_UART_LCR_WL6, + AAEC_UART_LCR_WL7, + AAEC_UART_LCR_WL8 +}; + +static unsigned char select_stop_bits[] = { + 0, + 0, // 1 stop bit + AAEC_UART_LCR_S2, // 1.5 stop bit (I think) + AAEC_UART_LCR_S2 // 2 stop bits +}; + +static unsigned char select_parity[] = { + 0, // No parity + AAEC_UART_LCR_PEN|AAEC_UART_LCR_EP, // Even parity + AAEC_UART_LCR_PEN, // Odd parity + 0, // Mark parity + 0, // Space parity +}; + +// Baud rate values, based on 7.3728MHz clock +// #define BAUD_RATE(_n_) ((7372800/((_n_)*16))-1) + +static unsigned short select_baud[] = { + 0, // Unused + 0x23ff, // 50 + 0x17ff, // 75 + 0x105c, // 110 + 0x0d60, // 134.5 + 0x0bff, // 150 + 0x08ff, // 200 + 0x05ff, // 300 + 0x02ff, // 600 + 0x017f, // 1200 + 0x00ff, // 1800 + 0x00bf, // 2400 + 0x007f, // 3600 + 0x005f, // 4800 + 0x003f, // 7200 + 0x002f, // 9600 + 0x001f, // 14400 + 0x0017, // 19200 + 0x000b, // 38400 + 0x0007, // 57600 + 0x0003, // 115200 + 0x0001, // 230400 +}; + +#endif // CYGONCE_ARM_AAED2000_SERIAL_H diff --git a/packages/devs/serial/arm/aeb/current/ChangeLog b/packages/devs/serial/arm/aeb/current/ChangeLog --- a/packages/devs/serial/arm/aeb/current/ChangeLog +++ b/packages/devs/serial/arm/aeb/current/ChangeLog @@ -1162,27 +1162,36 @@ 1999-03-03 Gary Thomas + + * include/arm_sa1110_cerfpda_ser.inl: + * cdl/ser_arm_cerfpda.cdl: New file(s) - port to Intrinsyc CerfPDA. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/serial/arm/cerfpda/current/cdl/ser_arm_cerfpda.cdl b/packages/devs/serial/arm/cerfpda/current/cdl/ser_arm_cerfpda.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/arm/cerfpda/current/cdl/ser_arm_cerfpda.cdl @@ -0,0 +1,132 @@ +# ==================================================================== +# +# ser_arm_cerfpda.cdl +# +# eCos serial CERFPDA configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: gthomas +# Contributors: +# Date: 1999-07-07 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + + +cdl_package CYGPKG_IO_SERIAL_ARM_CERFPDA { + display "Cerfpda 16x5x serial device driver" + + parent CYGPKG_IO_SERIAL_DEVICES + active_if CYGPKG_IO_SERIAL + active_if CYGPKG_HAL_ARM_SA11X0_CERFPDA + + requires CYGPKG_ERROR + include_dir cyg/io + + description " + This option enables the serial 16x5x device drivers for the + Cerfpda." + doc redirect/ecos-device-drivers.html + + # FIXME: This really belongs in the GENERIC_16X5X package + cdl_interface CYGINT_IO_SERIAL_GENERIC_16X5X_REQUIRED { + display "Generic 16x5x serial driver required" + } + define_proc { + puts $::cdl_header "#define CYGPRI_IO_SERIAL_GENERIC_16X5X_STEP 4" + } + + + define_proc { + puts $::cdl_system_header "/***** serial driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_GENERIC_16X5X_INL " + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_GENERIC_16X5X_CFG " + puts $::cdl_system_header "/***** serial driver proc output end *****/" + } + + + cdl_component CYGPKG_IO_SERIAL_ARM_CERFPDA_SERIAL1 { + display "Cerfpda serial port 1 driver" + flavor bool + default_value 1 + + implements CYGINT_IO_SERIAL_GENERIC_16X5X_REQUIRED + implements CYGINT_IO_SERIAL_FLOW_CONTROL_HW + implements CYGINT_IO_SERIAL_LINE_STATUS_HW + + description " + This option includes the serial device driver for the + Cerfpda port 1." + + cdl_option CYGDAT_IO_SERIAL_ARM_CERFPDA_SERIAL1_NAME { + display "Device name for cerfpda serial port 1 driver" + flavor data + default_value {"\"/dev/ser1\""} + description " + This option specifies the name of the serial device + for the Cerfpda port 1." + } + + cdl_option CYGNUM_IO_SERIAL_ARM_CERFPDA_SERIAL1_BAUD { + display "Baud rate for the cerfpda serial port 1 driver" + flavor data + legal_values { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400 + 3600 4800 7200 9600 14400 19200 38400 + 57600 115200 230400 } + default_value 38400 + description " + This option specifies the default baud rate (speed) + for the Cerfpda port 1." + } + + cdl_option CYGNUM_IO_SERIAL_ARM_CERFPDA_SERIAL1_BUFSIZE { + display "Buffer size for the cerfpda serial port 1 driver" + flavor data + legal_values 0 to 8192 + default_value 128 + description " + This option specifies the size of the internal + buffers used for the cerfpda port 1." + } + } + +} + +# EOF ser_arm_cerfpda.cdl diff --git a/packages/devs/serial/arm/cerfpda/current/include/arm_sa1110_cerfpda_ser.inl b/packages/devs/serial/arm/cerfpda/current/include/arm_sa1110_cerfpda_ser.inl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/arm/cerfpda/current/include/arm_sa1110_cerfpda_ser.inl @@ -0,0 +1,123 @@ +//========================================================================== +// +// io/serial/arm/arm_sa1110_cerpda_ser.inl +// +// Cerfpda Serial I/O definitions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jlarmour +// Date: 1999-02-04 +// Purpose: Cerfpda Serial I/O module (interrupt driven version) +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +//----------------------------------------------------------------------------- +// Baud rate specification + +static unsigned short select_baud[] = { + 0, // Unused + 0, // 50 + 18432,// 75 + 12657,// 110 + 10278,// 134.5 + 9216, // 150 + 6912, // 200 + 4608, // 300 + 2304, // 600 + 1152, // 1200 + 768, // 1800 + 576, // 2400 + 384, // 3600 + 288, // 4800 + 192, // 7200 + 144, // 9600 + 96, // 14400 + 72, // 19200 + 36, // 38400 + 24, // 57600 + 12, // 115200 + 6, // 230400 +}; + +#ifdef CYGPKG_IO_SERIAL_ARM_CERFPDA_SERIAL1 +static pc_serial_info cerfpda_serial_info1 = {0x18000000, SA1110_IRQ_GPIO_16X5X}; +#if CYGNUM_IO_SERIAL_ARM_CERFPDA_SERIAL1_BUFSIZE > 0 +static unsigned char cerfpda_serial_out_buf1[CYGNUM_IO_SERIAL_ARM_CERFPDA_SERIAL1_BUFSIZE]; +static unsigned char cerfpda_serial_in_buf1[CYGNUM_IO_SERIAL_ARM_CERFPDA_SERIAL1_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(cerfpda_serial_channel1, + pc_serial_funs, + cerfpda_serial_info1, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_CERFPDA_SERIAL1_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &cerfpda_serial_out_buf1[0], sizeof(cerfpda_serial_out_buf1), + &cerfpda_serial_in_buf1[0], sizeof(cerfpda_serial_in_buf1) + ); +#else +static SERIAL_CHANNEL(cerfpda_serial_channel1, + pc_serial_funs, + cerfpda_serial_info1, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_CERFPDA_SERIAL1_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT + ); +#endif + +DEVTAB_ENTRY(cerfpda_serial_io1, + CYGDAT_IO_SERIAL_ARM_CERFPDA_SERIAL1_NAME, + 0, // Does not depend on a lower level interface + &cyg_io_serial_devio, + pc_serial_init, + pc_serial_lookup, // Serial driver may need initializing + &cerfpda_serial_channel1 + ); +#endif // CYGPKG_IO_SERIAL_ARM_CERFPDA_SERIAL1 + +// EOF arm_sa1110_cerfpda_ser.inl diff --git a/packages/devs/serial/arm/cma230/current/ChangeLog b/packages/devs/serial/arm/cma230/current/ChangeLog --- a/packages/devs/serial/arm/cma230/current/ChangeLog +++ b/packages/devs/serial/arm/cma230/current/ChangeLog @@ -1159,27 +1159,36 @@ 1999-03-03 Gary Thomas + + * cdl/ser_arm_integrator.cdl: + Disable testing of 57600 and 115200 baud rates. The CPUs we are + currently using (ARM7TDMI and ARM966E) have no cache and are too + slow to handle the higher baud rates in the FIFO-free UARTs we + have. In the future we may need to revisit this an make it + conditional on the CPU available. + 2001-10-30 Philippe Robin 2001-10-30 Jonathan Larmour @@ -5,27 +14,36 @@ 2001-10-30 Jonathan Larmour + + * include/arm_iq80321_ser.inl: + * cdl/ser_arm_iq80321.cdl: + IQ80321 files created, by copying the IQ80310 versions and editing. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/serial/arm/iq80321/current/cdl/ser_arm_iq80321.cdl b/packages/devs/serial/arm/iq80321/current/cdl/ser_arm_iq80321.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/arm/iq80321/current/cdl/ser_arm_iq80321.cdl @@ -0,0 +1,152 @@ +# ==================================================================== +# +# ser_arm_iq80321.cdl +# +# eCos serial IQ80321 configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): msalter +# Original data: msalter +# Contributors: +# Date: 2000-10-10 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + + +cdl_package CYGPKG_IO_SERIAL_ARM_IQ80321 { + display "XScale IQ80321 serial device drivers" + + parent CYGPKG_IO_SERIAL_DEVICES + active_if CYGPKG_IO_SERIAL + active_if CYGPKG_HAL_ARM_XSCALE_IQ80321 + + requires CYGPKG_ERROR + include_dir cyg/io + + description " + This option enables the serial device drivers for the + IQ80321 evaluation board." + doc redirect/ecos-device-drivers.html + + # FIXME: This really belongs in the GENERIC_16X5X package + cdl_interface CYGINT_IO_SERIAL_GENERIC_16X5X_REQUIRED { + display "Generic 16x5x serial driver required" + } + define_proc { + puts $::cdl_header "#define CYGPRI_IO_SERIAL_GENERIC_16X5X_STEP 1" + } + + + define_proc { + puts $::cdl_system_header "/***** serial driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_GENERIC_16X5X_INL " + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_GENERIC_16X5X_CFG " + puts $::cdl_system_header "/***** serial driver proc output end *****/" + } + + cdl_component CYGPKG_IO_SERIAL_ARM_IQ80321_SERIAL0 { + display "ARM IQ80321 serial port 0 driver" + flavor bool + default_value 1 + + implements CYGINT_IO_SERIAL_GENERIC_16X5X_REQUIRED + implements CYGINT_IO_SERIAL_FLOW_CONTROL_HW + implements CYGINT_IO_SERIAL_LINE_STATUS_HW + + description " + This option includes the serial device driver for the Cyclone + IQ80321 port 0." + + cdl_option CYGDAT_IO_SERIAL_ARM_IQ80321_SERIAL0_NAME { + display "Device name for IQ80321 serial port 0 driver" + flavor data + default_value {"\"/dev/ser0\""} + description " + This option specifies the name of the serial device + for the Cyclone IQ80321 port 0." + } + + cdl_option CYGNUM_IO_SERIAL_ARM_IQ80321_SERIAL0_BAUD { + display "Baud rate for the Cyclone IQ80321 serial port 0 driver" + flavor data + legal_values { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400 + 3600 4800 7200 9600 14400 19200 38400 + 57600 115200 } + default_value 115200 + description " + This option specifies the default baud rate (speed) + for the Cyclone IQ80321 port 0." + } + + cdl_option CYGNUM_IO_SERIAL_ARM_IQ80321_SERIAL0_BUFSIZE { + display "Buffer size for the Cyclone IQ80321 serial port 0 driver" + flavor data + legal_values 0 to 8192 + default_value 128 + description " + This option specifies the size of the internal buffers + used for the Cyclone IQ80321 port 0." + } + } + + cdl_component CYGPKG_IO_SERIAL_ARM_IQ80321_TESTING { + display "Testing parameters" + flavor bool + calculated 1 + active_if CYGPKG_IO_SERIAL_ARM_IQ80321_SERIAL0 + + implements CYGINT_IO_SERIAL_TEST_SKIP_9600 + implements CYGINT_IO_SERIAL_TEST_SKIP_115200 + implements CYGINT_IO_SERIAL_TEST_SKIP_PARITY_EVEN + + cdl_option CYGPRI_SER_TEST_SER_DEV { + display "Serial device used for testing" + flavor data + default_value { CYGDAT_IO_SERIAL_ARM_IQ80321_SERIAL0_NAME } + } + + define_proc { + puts $::cdl_header "#define CYGPRI_SER_TEST_CRASH_ID \"iq80321\"" + puts $::cdl_header "#define CYGPRI_SER_TEST_TTY_DEV \"/dev/tty0\"" + } + } +} + +# EOF ser_arm_iq80321.cdl diff --git a/packages/devs/serial/arm/iq80321/current/include/arm_iq80321_ser.inl b/packages/devs/serial/arm/iq80321/current/include/arm_iq80321_ser.inl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/arm/iq80321/current/include/arm_iq80321_ser.inl @@ -0,0 +1,123 @@ +//========================================================================== +// +// io/serial/arm/arm_iq80321_ser.inl +// +// IQ80321 Serial I/O definitions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2000-10-10 +// Purpose: IQ80321 Serial I/O module (interrupt driven version) +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include // platform definitions + +//----------------------------------------------------------------------------- +// Baud rate specification + +static unsigned short select_baud[] = { + 0, // Unused + 0, // 50 + 0, // 75 + 1047, // 110 + 0, // 134.5 + 768, // 150 + 0, // 200 + 384, // 300 + 192, // 600 + 96, // 1200 + 24, // 1800 + 48, // 2400 + 0, // 3600 + 24, // 4800 + 16, // 7200 + 12, // 9600 + 8, // 14400 + 6, // 19200 + 3, // 38400 + 2, // 57600 + 1, // 115200 +}; + +#ifdef CYGPKG_IO_SERIAL_ARM_IQ80321_SERIAL0 +static pc_serial_info iq80321_serial_info0 = {IQ80321_UART_ADDR, + CYGNUM_HAL_INTERRUPT_UART}; +#if CYGNUM_IO_SERIAL_ARM_IQ80321_SERIAL0_BUFSIZE > 0 +static unsigned char iq80321_serial_out_buf0[CYGNUM_IO_SERIAL_ARM_IQ80321_SERIAL0_BUFSIZE]; +static unsigned char iq80321_serial_in_buf0[CYGNUM_IO_SERIAL_ARM_IQ80321_SERIAL0_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(iq80321_serial_channel0, + pc_serial_funs, + iq80321_serial_info0, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_IQ80321_SERIAL0_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &iq80321_serial_out_buf0[0], sizeof(iq80321_serial_out_buf0), + &iq80321_serial_in_buf0[0], sizeof(iq80321_serial_in_buf0) + ); +#else +static SERIAL_CHANNEL(iq80321_serial_channel0, + pc_serial_funs, + iq80321_serial_info0, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_IQ80321_SERIAL0_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT + ); +#endif + +DEVTAB_ENTRY(iq80321_serial_io0, + CYGDAT_IO_SERIAL_ARM_IQ80321_SERIAL0_NAME, + 0, // Does not depend on a lower level interface + &cyg_io_serial_devio, + pc_serial_init, + pc_serial_lookup, // Serial driver may need initializing + &iq80321_serial_channel0 + ); +#endif // CYGPKG_IO_SERIAL_ARM_IQ80321_SERIAL0 + +// EOF arm_iq80321_ser.inl diff --git a/packages/devs/serial/arm/pid/current/ChangeLog b/packages/devs/serial/arm/pid/current/ChangeLog --- a/packages/devs/serial/arm/pid/current/ChangeLog +++ b/packages/devs/serial/arm/pid/current/ChangeLog @@ -185,27 +185,36 @@ 1999-03-03 Gary Thomas + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/serial/h8300/h8300h/current/cdl/serial_h8300.cdl b/packages/devs/serial/h8300/h8300h/current/cdl/serial_h8300.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/h8300/h8300h/current/cdl/serial_h8300.cdl @@ -0,0 +1,114 @@ +# ==================================================================== +# +# serial_h8300.cdl +# +# eCos serial H8/300 SCI configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: +# Date: 1999-07-08 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + + +cdl_package CYGPKG_IO_SERIAL_H8300_SCI { + display "H8/300 SCI serial device drivers" + + parent CYGPKG_IO_SERIAL_DEVICES + active_if CYGPKG_IO_SERIAL + active_if CYGPKG_HAL_H8300 + + active_if CYGINT_IO_SERIAL_H8300_SCI_REQUIRED + + requires CYGPKG_ERROR + include_dir cyg/io + include_files ; # none _exported_ whatsoever + description " + This option enables the serial device drivers for the + SCI module in Hitachi H8/300 CPUs." + doc redirect/ecos-device-drivers.html + + compile -library=libextras.a h8300_sci_serial.c + + define_proc { + puts $::cdl_system_header "/***** serial driver proc output start *****/" + puts $::cdl_system_header "#ifndef CYGDAT_IO_SERIAL_DEVICE_HEADER" + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_DEVICE_HEADER " + puts $::cdl_system_header "#endif" + puts $::cdl_system_header "/***** serial driver proc output end *****/" + + puts $::cdl_header "#include "; + puts $::cdl_header "#include CYGDAT_IO_SERIAL_SH_SCI_CFG"; + } + + cdl_component CYGPKG_IO_SERIAL_SH_SCI_OPTIONS { + display "SCI serial device driver build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + cdl_option CYGPKG_IO_SERIAL_SH_SCI_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building these serial device drivers. These flags are + used in addition to the set of global flags." + } + + cdl_option CYGPKG_IO_SERIAL_SH_SCI_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building these serial device drivers. These flags are + removed from the set of global flags if present." + } + } +} + +# EOF serial_h8300.cdl diff --git a/packages/devs/serial/h8300/h8300h/current/src/h8300_sci_serial.c b/packages/devs/serial/h8300/h8300h/current/src/h8300_sci_serial.c new file mode 100644 --- /dev/null +++ b/packages/devs/serial/h8300/h8300h/current/src/h8300_sci_serial.c @@ -0,0 +1,576 @@ +//========================================================================== +// +// h8300_sci_serial.c +// +// H8/300 Serial SCI I/O Interface Module (interrupt driven) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:gthomas, jskov +// Date: 1999-05-24 +// Purpose: H8/300 Serial I/O module (interrupt driven version) +// Description: +// +// Note: Since interrupt sources from the same SCI channel share the same +// interrupt level, there is no risk of races when altering the +// channel's control register from ISRs and DSRs. However, when +// altering the control register from user-level code, interrupts +// must be disabled while the register is being accessed. +// +// FIXME: Receiving in polled mode prevents duplex transfers from working for +// some reason. +//####DESCRIPTIONEND#### +//========================================================================== + +#include +#include + +// FIXME: This is necessary since the SCIF driver may be overriding +// CYGDAT_IO_SERIAL_DEVICE_HEADER. Need a better way to include two +// different drivers. +#include + +#include +#include +#include +#include +#include + +#ifdef CYGDAT_IO_SERIAL_H8300_SCI +// The SCI controller register layout on the SH3/7708. +#define SCI_SCSMR 0 // serial mode register +#define SCI_SCBRR 1 // bit rate register +#define SCI_SCSCR 2 // serial control register +#define SCI_SCTDR 3 // transmit data register +#define SCI_SCSSR 4 // serial status register +#define SCI_SCRDR 5 // receive data register +#define SCI_SCSPTR -4 // serial port register + +static short select_word_length[] = { + -1, + -1, + CYGARC_REG_SCSMR_CHR, // 7 bits + 0 // 8 bits +}; + +static short select_stop_bits[] = { + -1, + 0, // 1 stop bit + -1, + CYGARC_REG_SCSMR_STOP // 2 stop bits +}; + +static short select_parity[] = { + 0, // No parity + CYGARC_REG_SCSMR_PE, // Even parity + CYGARC_REG_SCSMR_PE|CYGARC_REG_SCSMR_OE, // Odd parity + -1, + -1 +}; + +static unsigned short select_baud[] = { + 0, // Unused + CYGARC_SCBRR_CKSx(50)<<8 | CYGARC_SCBRR_N(50), + CYGARC_SCBRR_CKSx(75)<<8 | CYGARC_SCBRR_N(75), + CYGARC_SCBRR_CKSx(110)<<8 | CYGARC_SCBRR_N(110), + CYGARC_SCBRR_CKSx(134)<<8 | CYGARC_SCBRR_N(134), + CYGARC_SCBRR_CKSx(150)<<8 | CYGARC_SCBRR_N(150), + CYGARC_SCBRR_CKSx(200)<<8 | CYGARC_SCBRR_N(200), + CYGARC_SCBRR_CKSx(300)<<8 | CYGARC_SCBRR_N(300), + CYGARC_SCBRR_CKSx(600)<<8 | CYGARC_SCBRR_N(600), + CYGARC_SCBRR_CKSx(1200)<<8 | CYGARC_SCBRR_N(1200), + CYGARC_SCBRR_CKSx(1800)<<8 | CYGARC_SCBRR_N(1800), + CYGARC_SCBRR_CKSx(2400)<<8 | CYGARC_SCBRR_N(2400), + CYGARC_SCBRR_CKSx(3600)<<8 | CYGARC_SCBRR_N(3600), + CYGARC_SCBRR_CKSx(4800)<<8 | CYGARC_SCBRR_N(4800), + CYGARC_SCBRR_CKSx(7200)<<8 | CYGARC_SCBRR_N(7200), + CYGARC_SCBRR_CKSx(9600)<<8 | CYGARC_SCBRR_N(9600), + CYGARC_SCBRR_CKSx(14400)<<8 | CYGARC_SCBRR_N(14400), + CYGARC_SCBRR_CKSx(19200)<<8 | CYGARC_SCBRR_N(19200), + CYGARC_SCBRR_CKSx(38400)<<8 | CYGARC_SCBRR_N(38400), + CYGARC_SCBRR_CKSx(57600)<<8 | CYGARC_SCBRR_N(57600), + CYGARC_SCBRR_CKSx(115200)<<8 | CYGARC_SCBRR_N(115200), + CYGARC_SCBRR_CKSx(230400)<<8 | CYGARC_SCBRR_N(230400) +}; + + +typedef struct h8300_sci_info { + CYG_ADDRWORD data; // Pointer to data register + + CYG_WORD er_int_num, // Error interrupt number + rx_int_num, // Receive interrupt number + tx_int_num; // Transmit interrupt number + + CYG_ADDRWORD ctrl_base; // Base address of SCI controller + + cyg_interrupt serial_er_interrupt, + serial_rx_interrupt, + serial_tx_interrupt; + cyg_handle_t serial_er_interrupt_handle, + serial_rx_interrupt_handle, + serial_tx_interrupt_handle; + + bool tx_enabled; +} sh_sci_info; + +static bool h8300_serial_init(struct cyg_devtab_entry *tab); +static bool h8300_serial_putc(serial_channel *chan, unsigned char c); +static Cyg_ErrNo h8300_serial_lookup(struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *sub_tab, + const char *name); +static unsigned char h8300_serial_getc(serial_channel *chan); +static Cyg_ErrNo h8300_serial_set_config(serial_channel *chan, cyg_uint32 key, + const void *xbuf, cyg_uint32 *len); +static void h8300_serial_start_xmit(serial_channel *chan); +static void h8300_serial_stop_xmit(serial_channel *chan); + +static cyg_uint32 h8300_serial_tx_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void h8300_serial_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, + cyg_addrword_t data); +static cyg_uint32 h8300_serial_rx_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void h8300_serial_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, + cyg_addrword_t data); +static cyg_uint32 h8300_serial_er_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void h8300_serial_er_DSR(cyg_vector_t vector, cyg_ucount32 count, + cyg_addrword_t data); + +static SERIAL_FUNS(h8300_serial_funs, + h8300_serial_putc, + h8300_serial_getc, + h8300_serial_set_config, + h8300_serial_start_xmit, + h8300_serial_stop_xmit + ); + + +static h8300_sci_info h8300_serial_info = +{ + NULL, + CYGNUM_HAL_INTERRUPT_ERI0, + CYGNUM_HAL_INTERRUPT_RXI0, + CYGNUM_HAL_INTERRUPT_TXI0, + CYGARC_REG_SMR0 +}; + +#if CYGNUM_IO_SERIAL_H8300_H8300H_SERIAL1_BUFSIZE > 0 +static unsigned char h8300_serial_out_buf[CYGNUM_IO_SERIAL_H8300_CQ7708_SERIAL1_BUFSIZE]; +static unsigned char h8300_serial_in_buf[CYGNUM_IO_SERIAL_H8300_CQ7708_SERIAL1_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(h8300_serial_channel, + h8300_serial_funs, + h8300_serial_info, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_H8300_H8300H_SERIAL1_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &h8300_serial_out_buf[0], + sizeof(h8300_serial_out_buf), + &h8300_serial_in_buf[0], + sizeof(h8300_serial_in_buf) + ); +#else +static SERIAL_CHANNEL(h8300_serial_channel, + h8300_serial_funs, + h8300_serial_info, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_H8300_H8300H_SERIAL1_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT + ); +#endif + +DEVTAB_ENTRY(h8300_serial_io, + CYGDAT_IO_SERIAL_H8300_H8300H_SERIAL1_NAME, + 0, // Does not depend on a lower level interface + &cyg_io_serial_devio, + h8300_serial_init, + h8300_serial_lookup, // Serial driver may need initializing + &h8300_serial_channel + ); + +// Internal function to actually configure the hardware to desired baud rate, +// etc. +static bool +h8300_serial_config_port(serial_channel *chan, cyg_serial_info_t *new_config, + bool init) +{ + cyg_uint16 baud_divisor = select_baud[new_config->baud]; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + cyg_uint8 _scr, _smr; + + // Check configuration request + if ((-1 == select_word_length[(new_config->word_length - + CYGNUM_SERIAL_WORD_LENGTH_5)]) + || -1 == select_stop_bits[new_config->stop] + || -1 == select_parity[new_config->parity] + || baud_divisor == 0) + return false; + + // Disable SCI interrupts while changing hardware + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, 0); + + // Set databits, stopbits and parity. + _smr = select_word_length[(new_config->word_length - + CYGNUM_SERIAL_WORD_LENGTH_5)] | + select_stop_bits[new_config->stop] | + select_parity[new_config->parity]; + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSMR, _smr); + + // Set baud rate. + _smr &= ~CYGARC_REG_SCSMR_CKSx_MASK; + _smr |= baud_divisor >> 8; + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSMR, _smr); + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCBRR, baud_divisor & 0xff); + + // Clear the status register. + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSSR, 0); + + if (init) { + // Always enable transmitter and receiver. + _scr = CYGARC_REG_SCSCR_TE | CYGARC_REG_SCSCR_RE; + + if (chan->out_cbuf.len != 0) + _scr |= CYGARC_REG_SCSCR_TIE; // enable tx interrupts + + if (chan->in_cbuf.len != 0) + _scr |= CYGARC_REG_SCSCR_RIE; // enable rx interrupts + } + + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + + if (new_config != &chan->config) { + chan->config = *new_config; + } + return true; +} + +// Function to initialize the device. Called at bootstrap time. +static bool +h8300_serial_init(struct cyg_devtab_entry *tab) +{ + serial_channel *chan = (serial_channel *)tab->priv; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; +#ifdef CYGDBG_IO_INIT + diag_printf("SH SERIAL init - dev: %x.%d\n", + h8300_chan->data, h8300_chan->rx_int_num); +#endif + // Really only required for interrupt driven devices + (chan->callbacks->serial_init)(chan); + + if (chan->out_cbuf.len != 0) { + cyg_drv_interrupt_create(h8300_chan->tx_int_num, + 3, + (cyg_addrword_t)chan, // Data item passed to interrupt handler + h8300_serial_tx_ISR, + h8300_serial_tx_DSR, + &h8300_chan->serial_tx_interrupt_handle, + &h8300_chan->serial_tx_interrupt); + cyg_drv_interrupt_attach(h8300_chan->serial_tx_interrupt_handle); + cyg_drv_interrupt_unmask(h8300_chan->tx_int_num); + h8300_chan->tx_enabled = false; + } + if (chan->in_cbuf.len != 0) { + // Receive interrupt + cyg_drv_interrupt_create(h8300_chan->rx_int_num, + 3, + (cyg_addrword_t)chan, // Data item passed to interrupt handler + h8300_serial_rx_ISR, + h8300_serial_rx_DSR, + &h8300_chan->serial_rx_interrupt_handle, + &h8300_chan->serial_rx_interrupt); + cyg_drv_interrupt_attach(h8300_chan->serial_rx_interrupt_handle); + // Receive error interrupt + cyg_drv_interrupt_create(h8300_chan->er_int_num, + 3, + (cyg_addrword_t)chan, // Data item passed to interrupt handler + h8300_serial_er_ISR, + h8300_serial_er_DSR, + &h8300_chan->serial_er_interrupt_handle, + &h8300_chan->serial_er_interrupt); + cyg_drv_interrupt_attach(h8300_chan->serial_er_interrupt_handle); + // This unmasks both interrupt sources. + cyg_drv_interrupt_unmask(h8300_chan->rx_int_num); + } + h8300_serial_config_port(chan, &chan->config, true); + return true; +} + +// This routine is called when the device is "looked" up (i.e. attached) +static Cyg_ErrNo +h8300_serial_lookup(struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *sub_tab, + const char *name) +{ + serial_channel *chan = (serial_channel *)(*tab)->priv; + + // Really only required for interrupt driven devices + (chan->callbacks->serial_init)(chan); + return ENOERR; +} + +// Send a character to the device output buffer. +// Return 'true' if character is sent to device +static bool +h8300_serial_putc(serial_channel *chan, unsigned char c) +{ + cyg_uint8 _ssr; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSSR, _ssr); + if (_ssr & CYGARC_REG_SCSSR_TDRE) { +// Transmit buffer is empty + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCTDR, c); + // Clear empty flag. + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSSR, + CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_TDRE); + return true; + } else { +// No space + return false; + } +} + +// Fetch a character from the device input buffer, waiting if necessary +static unsigned char +h8300_serial_getc(serial_channel *chan) +{ + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + unsigned char c; + cyg_uint8 _ssr; + + do { + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSSR, _ssr); + } while ((_ssr & CYGARC_REG_SCSSR_RDRF) == 0); + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCRDR, c); + + // Clear buffer full flag. + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSSR, + CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_RDRF); + + return c; +} + +// Set up the device characteristics; baud rate, etc. +static Cyg_ErrNo +h8300_serial_set_config(serial_channel *chan, cyg_uint32 key, + const void *xbuf, cyg_uint32 *len) +{ + switch (key) { + case CYG_IO_SET_CONFIG_SERIAL_INFO: + { + cyg_serial_info_t *config = (cyg_serial_info_t *)xbuf; + if ( *len < sizeof(cyg_serial_info_t) ) { + return -EINVAL; + } + *len = sizeof(cyg_serial_info_t); + if ( true != h8300_serial_config_port(chan, config, false) ) + return -EINVAL; + } + break; + default: + return -EINVAL; + } + return ENOERR; +} + +// Enable the transmitter on the device +static void +h8300_serial_start_xmit(serial_channel *chan) +{ + cyg_uint8 _scr; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + + h8300_chan->tx_enabled = true; + + // Mask the interrupts (all sources of the unit) while changing + // the CR since a rx interrupt in the middle of this would result + // in a bad CR state. + cyg_drv_interrupt_mask(h8300_chan->rx_int_num); + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + _scr |= CYGARC_REG_SCSCR_TIE; // Enable xmit interrupt + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + + cyg_drv_interrupt_unmask(h8300_chan->rx_int_num); +} + +// Disable the transmitter on the device +static void +h8300_serial_stop_xmit(serial_channel *chan) +{ + cyg_uint8 _scr; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + + h8300_chan->tx_enabled = false; + + // Mask the interrupts (all sources of the unit) while changing + // the CR since a rx interrupt in the middle of this would result + // in a bad CR state. + cyg_drv_interrupt_mask(h8300_chan->rx_int_num); + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + _scr &= ~CYGARC_REG_SCSCR_TIE; // Disable xmit interrupt + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + + cyg_drv_interrupt_unmask(h8300_chan->rx_int_num); +} + +// Serial I/O - low level tx interrupt handler (ISR) +static cyg_uint32 +h8300_serial_tx_ISR(cyg_vector_t vector, cyg_addrword_t data) +{ + serial_channel *chan = (serial_channel *)data; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + cyg_uint8 _scr; + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + _scr &= ~CYGARC_REG_SCSCR_TIE; // mask out tx interrupts + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + + return CYG_ISR_CALL_DSR; // Cause DSR to be run +} + +// Serial I/O - high level tx interrupt handler (DSR) +static void +h8300_serial_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + serial_channel *chan = (serial_channel *)data; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + + (chan->callbacks->xmt_char)(chan); + + if (h8300_chan->tx_enabled) { + cyg_uint8 _scr; + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + _scr |= CYGARC_REG_SCSCR_TIE; // unmask tx interrupts + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + } +} + +// Serial I/O - low level RX interrupt handler (ISR) +static cyg_uint32 +h8300_serial_rx_ISR(cyg_vector_t vector, cyg_addrword_t data) +{ + serial_channel *chan = (serial_channel *)data; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + cyg_uint8 _scr; + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + _scr &= ~CYGARC_REG_SCSCR_RIE; // mask rx interrupts + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + return CYG_ISR_CALL_DSR; // Cause DSR to be run +} + +// Serial I/O - high level rx interrupt handler (DSR) +static void +h8300_serial_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + serial_channel *chan = (serial_channel *)data; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + cyg_uint8 _ssr, _scr; + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSSR, _ssr); + if (_ssr & CYGARC_REG_SCSSR_RDRF) { + cyg_uint8 _c; + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCRDR, _c); + // Clear buffer full flag. + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSSR, + CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_RDRF); + + (chan->callbacks->rcv_char)(chan, _c); + } + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + _scr |= CYGARC_REG_SCSCR_RIE; // unmask rx interrupts + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); +} + +static volatile int h8300_serial_error_orer = 0; +static volatile int h8300_serial_error_fer = 0; +static volatile int h8300_serial_error_per = 0; + +// Serial I/O - low level error interrupt handler (ISR) +static cyg_uint32 +h8300_serial_er_ISR(cyg_vector_t vector, cyg_addrword_t data) +{ + serial_channel *chan = (serial_channel *)data; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + cyg_uint8 _scr; + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + _scr &= ~CYGARC_REG_SCSCR_RIE; // mask rx interrupts + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + return CYG_ISR_CALL_DSR; // Cause DSR to be run +} + +// Serial I/O - high level error interrupt handler (DSR) +static void +h8300_serial_er_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + serial_channel *chan = (serial_channel *)data; + h8300_sci_info *h8300_chan = (h8300_sci_info *)chan->dev_priv; + cyg_uint8 _ssr, _ssr2, _scr; + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSSR, _ssr); + _ssr2 = CYGARC_REG_SCSSR_CLEARMASK; + + if (_ssr & CYGARC_REG_SCSSR_ORER) { + _ssr2 &= ~CYGARC_REG_SCSSR_ORER; + h8300_serial_error_orer++; + } + if (_ssr & CYGARC_REG_SCSSR_FER) { + _ssr2 &= ~CYGARC_REG_SCSSR_FER; + h8300_serial_error_fer++; + } + if (_ssr & CYGARC_REG_SCSSR_PER) { + _ssr2 &= ~CYGARC_REG_SCSSR_PER; + h8300_serial_error_per++; + } + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSSR, _ssr2); + + HAL_READ_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); + _scr |= CYGARC_REG_SCSCR_RIE; // unmask rx interrupts + HAL_WRITE_UINT8(h8300_chan->ctrl_base+SCI_SCSCR, _scr); +} + +#endif // ifdef CYGDAT_IO_SERIAL_H8300_SCI diff --git a/packages/devs/serial/i386/pc/current/ChangeLog b/packages/devs/serial/i386/pc/current/ChangeLog --- a/packages/devs/serial/i386/pc/current/ChangeLog +++ b/packages/devs/serial/i386/pc/current/ChangeLog @@ -1168,27 +1168,36 @@ 1999-03-03 Gary Thomas + + * src/upd985xx_serial.c (upd985xx_serial_init): Fix compile error. + +2001-09-10 Jonathan Larmour + + * cdl/ser_mips_upd985xx.cdl: + Fix 234000->230400 typo. + +2001-07-18 Hugo Tyson + + * src/upd985xx_serial.c: + * src/upd985xx_serial.h: + * cdl/ser_mips_upd985xx.cdl: + New files; implement asynchronous serial device for uPD985xx. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/serial/mips/upd985xx/current/cdl/ser_mips_upd985xx.cdl b/packages/devs/serial/mips/upd985xx/current/cdl/ser_mips_upd985xx.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/mips/upd985xx/current/cdl/ser_mips_upd985xx.cdl @@ -0,0 +1,166 @@ +# ==================================================================== +# +# ser_mips_upd985xx.cdl +# +# eCos serial MIPS/Upd985xx configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): hmt +# Contributors: gthomas +# Date: 2001-07-17 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + + +cdl_package CYGPKG_IO_SERIAL_MIPS_UPD985XX { + display "NEC uPD985xx serial device drivers" + + parent CYGPKG_IO_SERIAL_DEVICES + active_if CYGPKG_IO_SERIAL + active_if CYGPKG_HAL_MIPS_UPD985XX + + requires CYGPKG_ERROR + include_dir cyg/io + include_files ; # none _exported_ whatsoever + description " + This option enables the serial device drivers for the + NEC MIPS uPD985xx system-on-chip device." + doc redirect/ecos-device-drivers.html + + compile -library=libextras.a upd985xx_serial.c + + define_proc { + puts $::cdl_system_header "/***** serial driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_DEVICE_HEADER " + puts $::cdl_system_header "/***** serial driver proc output end *****/" + } + + cdl_component CYGPKG_IO_SERIAL_MIPS_UPD985XX_SERIAL0 { + display "MIPS UPD985XX serial port 0 driver" + flavor bool + default_value 1 + description " + This option includes the serial device driver for the MIPS UPD985XX + serial port." + + cdl_option CYGDAT_IO_SERIAL_MIPS_UPD985XX_SERIAL0_NAME { + display "Device name for MIPS UPD985XX serial port 0 driver" + flavor data + default_value {"\"/dev/ser0\""} + description " + This option specifies the name of the serial device for the + MIPS UPD985XX port 0." + } + + cdl_option CYGNUM_IO_SERIAL_MIPS_UPD985XX_SERIAL0_BAUD { + display "Baud rate for the MIPS UPD985XX serial port 0 driver" + flavor data + legal_values { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400 3600 + 4800 7200 9600 14400 19200 38400 57600 115200 230400 + } + default_value 38400 + description " + This option specifies the default baud rate (speed) for the + MIPS UPD985XX port 0." + } + + cdl_option CYGNUM_IO_SERIAL_MIPS_UPD985XX_SERIAL0_BUFSIZE { + display "Buffer size for the MIPS UPD985XX serial port 0 driver" + flavor data + legal_values 0 to 8192 + default_value 128 + description " + This option specifies the size of the internal buffers used + for the MIPS UPD985XX port 0." + } + } + + cdl_component CYGPKG_IO_SERIAL_MIPS_UPD985XX_OPTIONS { + display "Serial device driver build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_IO_SERIAL_MIPS_UPD985XX_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building these serial device drivers. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_IO_SERIAL_MIPS_UPD985XX_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building these serial device drivers. These flags are removed from + the set of global flags if present." + } + } + + cdl_component CYGPKG_IO_SERIAL_MIPS_UPD985XX_TESTING { + display "Testing parameters" + flavor bool + calculated 1 + active_if CYGPKG_IO_SERIAL_MIPS_UPD985XX_SERIAL0 + + cdl_option CYGPRI_SER_TEST_SER_DEV { + display "Serial device used for testing" + flavor data + default_value { CYGDAT_IO_SERIAL_MIPS_UPD985XX_SERIAL0_NAME } + } + + define_proc { + puts $::cdl_header "#define CYGPRI_SER_TEST_CRASH_ID \"upd985xx\"" + puts $::cdl_header "#define CYGPRI_SER_TEST_TTY_DEV \"/dev/tty0\"" + } + } +} + +# EOF ser_mips_upd985xx.cdl diff --git a/packages/devs/serial/mips/upd985xx/current/src/upd985xx_serial.c b/packages/devs/serial/mips/upd985xx/current/src/upd985xx_serial.c new file mode 100644 --- /dev/null +++ b/packages/devs/serial/mips/upd985xx/current/src/upd985xx_serial.c @@ -0,0 +1,313 @@ +//========================================================================== +// +// io/serial/mips/upd985xx/upd985xx_serial.c +// +// NEC MIPS uPD985xx Serial I/O Interface Module (interrupt driven) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: gthomas +// Date: 2001-07-17 +// Purpose: NEC MIPS uPD985xx Serial I/O module (interrupt driven version) +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "upd985xx_serial.h" + +typedef struct upd985xx_serial_info { +// CYG_ADDRWORD base; + CYG_WORD int_num; + cyg_interrupt serial_interrupt; + cyg_handle_t serial_interrupt_handle; +} upd985xx_serial_info; + +static bool upd985xx_serial_init(struct cyg_devtab_entry *tab); +static bool upd985xx_serial_putc(serial_channel *chan, unsigned char c); +static Cyg_ErrNo upd985xx_serial_lookup(struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *sub_tab, + const char *name); +static unsigned char upd985xx_serial_getc(serial_channel *chan); +static Cyg_ErrNo upd985xx_serial_set_config(serial_channel *chan, cyg_uint32 key, + const void *xbuf, cyg_uint32 *len); +static void upd985xx_serial_start_xmit(serial_channel *chan); +static void upd985xx_serial_stop_xmit(serial_channel *chan); + +static cyg_uint32 upd985xx_serial_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void upd985xx_serial_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); + +static SERIAL_FUNS(upd985xx_serial_funs, + upd985xx_serial_putc, + upd985xx_serial_getc, + upd985xx_serial_set_config, + upd985xx_serial_start_xmit, + upd985xx_serial_stop_xmit + ); + +#ifdef CYGPKG_IO_SERIAL_MIPS_UPD985XX_SERIAL0 +static upd985xx_serial_info upd985xx_serial_info0 = { + // base: (CYG_ADDRWORD)UPD985XX_UART3_CONTROL0, + int_num: CYGNUM_HAL_INTERRUPT_UART, +}; +#if CYGNUM_IO_SERIAL_MIPS_UPD985XX_SERIAL0_BUFSIZE > 0 +static unsigned char upd985xx_serial_out_buf0[CYGNUM_IO_SERIAL_MIPS_UPD985XX_SERIAL0_BUFSIZE]; +static unsigned char upd985xx_serial_in_buf0[CYGNUM_IO_SERIAL_MIPS_UPD985XX_SERIAL0_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS( + upd985xx_serial_channel0, + upd985xx_serial_funs, + upd985xx_serial_info0, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_UPD985XX_SERIAL0_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &upd985xx_serial_out_buf0[0], sizeof(upd985xx_serial_out_buf0), + &upd985xx_serial_in_buf0[0], sizeof(upd985xx_serial_in_buf0) + ); +#else +static SERIAL_CHANNEL( + upd985xx_serial_channel0, + upd985xx_serial_funs, + upd985xx_serial_info0, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_UPD985XX_SERIAL0_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT + ); +#endif + +DEVTAB_ENTRY(upd985xx_serial_io0, + CYGDAT_IO_SERIAL_MIPS_UPD985XX_SERIAL0_NAME, + 0, // Does not depend on a lower level interface + &cyg_io_serial_devio, + upd985xx_serial_init, + upd985xx_serial_lookup, // Serial driver may need initializing + &upd985xx_serial_channel0 + ); +#endif // CYGPKG_IO_SERIAL_MIPS_UPD985XX_SERIAL1 + +// Internal function to actually configure the hardware to desired baud rate, etc. +static bool +upd985xx_serial_config_port(serial_channel *chan, cyg_serial_info_t *new_config, bool init) +{ + unsigned char parity; + unsigned char word_length; + unsigned char stop_bits; + int baud; + + parity = select_parity[new_config->parity]; + word_length = select_word_length[new_config->word_length-CYGNUM_SERIAL_WORD_LENGTH_5]; + stop_bits = select_stop_bits[new_config->stop]; + baud = select_baud[new_config->baud]; + + if ((word_length == 0xFF) || + (parity == 0xFF) || + (stop_bits == 0xFF)) { + return false; // Unsupported configuration + } + + // First ensure we are accessing the right registers. + // Clear the divisor latch access bit + *UARTLCR &=~UARTLCR_DLAB; + + // Disable Receiver and Transmitter + // No such thing in uPD985xx - but we can mask interrupts: + *UARTIER = 0; + + // Clear sticky (writable) status bits. + // Ensure it's in 16550 mode at least: + *UARTFCR = UARTFCR_16550_MODE; + + // Set parity, word length, stop bits (keep DLAB clear) + *UARTLCR = word_length | parity | stop_bits; + + // Set the desired baud rate. + *UARTLCR |= UARTLCR_DLAB; + *UARTDLM = (baud >> 8) & 0xff; + *UARTDLL = baud & 0xff; + *UARTLCR &=~UARTLCR_DLAB; + + // Enable the receiver (with interrupts) and the transmitter. + *UARTIER = UARTIER_ERBFI; + + return true; +} + +// Function to initialize the device. Called at bootstrap time. +static bool +upd985xx_serial_init(struct cyg_devtab_entry *tab) +{ + serial_channel *chan = (serial_channel *)tab->priv; + upd985xx_serial_info *upd985xx_chan = (upd985xx_serial_info *)chan->dev_priv; + int res; +#ifdef CYGDBG_IO_INIT + diag_printf("UPD985XX SERIAL init - dev: %x.%d\n", 0 /* upd985xx_chan->base */, + upd985xx_chan->int_num); +#endif + (chan->callbacks->serial_init)(chan); // Really only required for interrupt driven devices + if (chan->out_cbuf.len != 0) { + cyg_drv_interrupt_create(upd985xx_chan->int_num, + 99, // Priority - unused + (cyg_addrword_t)chan, // Data item passed to interrupt handler + upd985xx_serial_ISR, + upd985xx_serial_DSR, + &upd985xx_chan->serial_interrupt_handle, + &upd985xx_chan->serial_interrupt); + cyg_drv_interrupt_attach(upd985xx_chan->serial_interrupt_handle); + cyg_drv_interrupt_unmask(upd985xx_chan->int_num); + } + res = upd985xx_serial_config_port(chan, &chan->config, true); + return res; +} + +// This routine is called when the device is "looked" up (i.e. attached) +static Cyg_ErrNo +upd985xx_serial_lookup(struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *sub_tab, + const char *name) +{ + serial_channel *chan = (serial_channel *)(*tab)->priv; + (chan->callbacks->serial_init)(chan); // Really only required for interrupt driven devices + return ENOERR; +} + +// Send a character to the device output buffer. +// Return 'true' if character is sent to device +static bool +upd985xx_serial_putc(serial_channel *chan, unsigned char c) +{ + if ( 0 == (UARTLSR_THRE & *UARTLSR) ) + return false; + *UARTTHR = (unsigned int)c; + return true; +} + +// Fetch a character from the device input buffer, waiting if necessary +static unsigned char +upd985xx_serial_getc(serial_channel *chan) +{ + while ( 0 == (UARTLSR_DR & *UARTLSR) ) + /* do nothing */ ; + + return (char)*UARTRBR; +} + +// Set up the device characteristics; baud rate, etc. +static Cyg_ErrNo +upd985xx_serial_set_config(serial_channel *chan, cyg_uint32 key, + const void *xbuf, cyg_uint32 *len) +{ + switch (key) { + case CYG_IO_SET_CONFIG_SERIAL_INFO: + { + cyg_serial_info_t *config = (cyg_serial_info_t *)xbuf; + if ( *len < sizeof(cyg_serial_info_t) ) { + return -EINVAL; + } + *len = sizeof(cyg_serial_info_t); + if ( true != upd985xx_serial_config_port(chan, config, false) ) + return -EINVAL; + } + break; + default: + return -EINVAL; + } + return ENOERR; +} + +// Enable the transmitter on the device +static void +upd985xx_serial_start_xmit(serial_channel *chan) +{ + (chan->callbacks->xmt_char)(chan); // Kick transmitter (if necessary) + *UARTIER |= UARTIER_ERBEI; // enable interrupts +} + +// Disable the transmitter on the device +static void +upd985xx_serial_stop_xmit(serial_channel *chan) +{ + *UARTIER &=~UARTIER_ERBEI; // disable interrupts +} + +// Serial I/O - low level interrupt handler (ISR) +static cyg_uint32 +upd985xx_serial_ISR(cyg_vector_t vector, cyg_addrword_t data) +{ + cyg_drv_interrupt_mask(vector); + return CYG_ISR_CALL_DSR; // Cause DSR to be run +} + +// Serial I/O - high level interrupt handler (DSR) +static void +upd985xx_serial_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + serial_channel *chan = (serial_channel *)data; + + int stat = *UARTIIR; + + stat &= UARTIIR_UIID_MASK; + + if (stat == UARTIIR_TX_EMPTY) { + (chan->callbacks->xmt_char)(chan); + } + if (stat == UARTIIR_RXD_AVAIL) { + while (0 != (UARTLSR_DR & *UARTLSR)) { + (chan->callbacks->rcv_char)(chan, (char)*UARTRBR); + } + } + cyg_drv_interrupt_acknowledge(vector); + cyg_drv_interrupt_unmask(vector); +} + +// ------------------------------------------------------------------------ +// EOF upd985xx_serial.c diff --git a/packages/devs/serial/mips/upd985xx/current/src/upd985xx_serial.h b/packages/devs/serial/mips/upd985xx/current/src/upd985xx_serial.h new file mode 100644 --- /dev/null +++ b/packages/devs/serial/mips/upd985xx/current/src/upd985xx_serial.h @@ -0,0 +1,109 @@ +#ifndef CYGONCE_MIPS_UPD985XX_SERIAL_H +#define CYGONCE_MIPS_UPD985XX_SERIAL_H +// ==================================================================== +// +// upd985xx_serial.h +// +// Device I/O - Description of NEC MIPS uPD985xx serial hardware +// +// ==================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +// ==================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: gthomas +// Date: 2001-07-17 +// Purpose: Internal interfaces for serial I/O drivers +// Description: +// +//####DESCRIPTIONEND#### +// +// ==================================================================== + +// Description of serial ports on NEC MIPS uPD985xx + +#include // Register definitions + +static unsigned char select_word_length[] = { + 0xFF, // 5 bits / word (char) + 0xFF, // 6 + UARTLCR_7, // 7 + UARTLCR_8 // 8 +}; + +static unsigned char select_stop_bits[] = { + 0xFF, // N/A + UARTLCR_STB1, // 1 stop bit + 0xFF, // 1.5 stop bit + UARTLCR_STB2 // 2 stop bits +}; + +static unsigned char select_parity[] = { + UARTLCR_NOP, // No parity + UARTLCR_EP, // Even parity + UARTLCR_OP, // Odd parity + 0xFF, // Mark parity + 0xFF, // Space parity +}; + +static cyg_int32 select_baud[] = { + 0, // Unused + UARTDLL_VAL( 50 ), // 50 + UARTDLL_VAL( 75 ), // 75 + UARTDLL_VAL( 110 ), // 110 + 0, // 134.5 + UARTDLL_VAL( 150 ), // 150 + UARTDLL_VAL( 200 ), // 200 + UARTDLL_VAL( 300 ), // 300 + UARTDLL_VAL( 600 ), // 600 + UARTDLL_VAL( 1200 ), // 1200 + UARTDLL_VAL( 1800 ), // 1800 + UARTDLL_VAL( 2400 ), // 2400 + UARTDLL_VAL( 3600 ), // 3600 + UARTDLL_VAL( 4800 ), // 4800 + UARTDLL_VAL( 7200 ), // 7200 + UARTDLL_VAL( 9600 ), // 9600 + UARTDLL_VAL( 14400 ), // 14400 + UARTDLL_VAL( 19200 ), // 19200 + UARTDLL_VAL( 38400 ), // 38400 + UARTDLL_VAL( 57600 ), // 57600 + UARTDLL_VAL( 115200 ), // 115200 + UARTDLL_VAL( 230400 ), // 230400 +}; + +#endif // CYGONCE_MIPS_UPD985XX_SERIAL_H + +// ------------------------------------------------------------------------ +// EOF upd985xx_serial.h diff --git a/packages/devs/serial/mips/vrc437x/current/ChangeLog b/packages/devs/serial/mips/vrc437x/current/ChangeLog --- a/packages/devs/serial/mips/vrc437x/current/ChangeLog +++ b/packages/devs/serial/mips/vrc437x/current/ChangeLog @@ -1178,27 +1178,36 @@ 1999-03-03 Gary Thomas + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/serial/powerpc/cme555/current/cdl/ser_powerpc_cme555.cdl b/packages/devs/serial/powerpc/cme555/current/cdl/ser_powerpc_cme555.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/powerpc/cme555/current/cdl/ser_powerpc_cme555.cdl @@ -0,0 +1,185 @@ +# ==================================================================== +# +# ser_powerpc_cme555.cdl +# +# eCos serial PowerPC/cme555 configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Bob Koninckx +# Original data: +# Contributors: +# Date: 1999-07-14 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_IO_SERIAL_POWERPC_CME555 { + display "cme555 PowerPC serial device drivers" + + parent CYGPKG_IO_SERIAL_DEVICES + active_if CYGPKG_IO_SERIAL + active_if CYGPKG_HAL_POWERPC_CME555 + + requires CYGPKG_ERROR + include_dir cyg/io + include_files ; # none _exported_ whatsoever + description " + This option enables the serial device drivers for the + cme555 mpc555 development board." + doc redirect/ecos-device-drivers.html + + compile -library=libextras.a cme555_serial_with_ints.c + + define_proc { + puts $::cdl_system_header "/***** serial driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_DEVICE_HEADER " + puts $::cdl_system_header "/***** serial driver proc output end *****/" + } + +cdl_component CYGPKG_IO_SERIAL_POWERPC_CME555_SERIAL_A { + display "cme555 PowerPC serial port A driver" + flavor bool + default_value 0 + description " + This option includes the serial device driver for the cme555 + PowerPC port A." + + cdl_option CYGDAT_IO_SERIAL_POWERPC_CME555_SERIAL_A_NAME { + display "Device name for cme555 PowerPC serial port A" + flavor data + default_value {"\"/dev/ser1\""} + description " + This option specifies the device name for the cme555 PowerPC + port A." + } + + cdl_option CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_A_BAUD { + display "Baud rate for the cme555 PowerPC serial port A driver" + flavor data + legal_values { 300 600 1200 2400 4800 9600 14400 19200 38400 57600 115200 } + default_value 38400 + description " + This option specifies the default baud rate (speed) for the + cme555 PowerPC port A." + } + + cdl_option CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_A_BUFSIZE { + display "Buffer size for the cme555 PowerPC serial port A driver" + flavor data + legal_values 0 to 8192 + default_value 128 + description " + This option specifies the size of the internal buffers used for + the cme555 PowerPC port A." + } +} + +cdl_component CYGPKG_IO_SERIAL_POWERPC_CME555_SERIAL_B { + display "cme555 PowerPC serial port B driver" + flavor bool + default_value 1 + description " + This option includes the serial device driver for the cme555 + PowerPC port B." + + cdl_option CYGDAT_IO_SERIAL_POWERPC_CME555_SERIAL_B_NAME { + display "Device name for cme555 PowerPC serial port B" + flavor data + default_value {"\"/dev/ser2\""} + description " + This option specifies the device name for the cme555 PowerPC + port B." + } + + cdl_option CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_B_BAUD { + display "Baud rate for the cme555 PowerPC serial port B driver" + flavor data + legal_values { 300 600 1200 2400 4800 9600 14400 19200 38400 57600 115200 } + default_value 38400 + description " + This option specifies the default baud rate (speed) for the + cme555 PowerPC port B." + } + + cdl_option CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_B_BUFSIZE { + display "Buffer size for the cme555 PowerPC serial port B driver" + flavor data + legal_values 0 to 8192 + default_value 128 + description " + This option specifies the size of the internal buffers used + for the cme555 PowerPC port B." + } +} + + cdl_component CYGPKG_IO_SERIAL_POWERPC_CME555_OPTIONS { + display "Serial device driver build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_IO_SERIAL_POWERPC_CME555_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building these serial device drivers. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_IO_SERIAL_POWERPC_CME555_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building these serial device drivers. These flags are removed from + the set of global flags if present." + } + } + +} + +# EOF ser_powerpc_cme555.cdl diff --git a/packages/devs/serial/powerpc/cme555/current/src/cme555_serial.h b/packages/devs/serial/powerpc/cme555/current/src/cme555_serial.h new file mode 100644 --- /dev/null +++ b/packages/devs/serial/powerpc/cme555/current/src/cme555_serial.h @@ -0,0 +1,157 @@ +#ifndef CYGONCE_DEVS_SERIAL_POWERPC_CME555_SERIAL_H +#define CYGONCE_DEVS_SERIAL_POWERPC_CME555_SERIAL_H +//========================================================================== +// +// cme555_serial.h +// +// PowerPC 5xx CME555 Serial I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: +// Date: 2002-04-25 +// Purpose: CME555 Serial I/O definitions. +// Description: +// +// +//####DESCRIPTIONEND#### +//========================================================================== + +//---------------------------------- +// Includes and forward declarations +//---------------------------------- + +//---------------------- +// Constants definitions +//---------------------- +// Base addresses for the two serial ports +#define MPC555_SERIAL_BASE_A 0x305008 +#define MPC555_SERIAL_BASE_B 0x305020 + +// The offset from the base for all serial registers +#define MPC555_SERIAL_SCCxR0 0 +#define MPC555_SERIAL_SCCxR1 2 +#define MPC555_SERIAL_SCxSR 4 +#define MPC555_SERIAL_SCxDR 6 + +// The bits in the serial registers +#define MPC555_SERIAL_SCCxR0_OTHR 0x8000 +#define MPC555_SERIAL_SCCxR0_LINKBD 0x4000 +#define MPC555_SERIAL_SCCxR0_SCxBR 0x1fff + +#define MPC555_SERIAL_SCCxR1_LOOPS 0x4000 +#define MPC555_SERIAL_SCCxR1_WOMS 0x2000 +#define MPC555_SERIAL_SCCxR1_ILT 0x1000 +#define MPC555_SERIAL_SCCxR1_PT 0x0800 +#define MPC555_SERIAL_SCCxR1_PE 0x0400 +#define MPC555_SERIAL_SCCxR1_M 0x0200 +#define MPC555_SERIAL_SCCxR1_WAKE 0x0100 +#define MPC555_SERIAL_SCCxR1_TIE 0x0080 +#define MPC555_SERIAL_SCCxR1_TCIE 0x0040 +#define MPC555_SERIAL_SCCxR1_RIE 0x0020 +#define MPC555_SERIAL_SCCxR1_ILIE 0x0010 +#define MPC555_SERIAL_SCCxR1_TE 0x0008 +#define MPC555_SERIAL_SCCxR1_RE 0x0004 +#define MPC555_SERIAL_SCCxR1_RWU 0x0002 +#define MPC555_SERIAL_SCCxR1_SBK 0x0001 + +#define MPC555_SERIAL_SCxSR_TDRE 0x0100 +#define MPC555_SERIAL_SCxSR_TC 0x0080 +#define MPC555_SERIAL_SCxSR_RDRF 0x0040 +#define MPC555_SERIAL_SCxSR_RAF 0x0020 +#define MPC555_SERIAL_SCxSR_IDLE 0x0010 +#define MPC555_SERIAL_SCxSR_OR 0x0008 +#define MPC555_SERIAL_SCxSR_NF 0x0004 +#define MPC555_SERIAL_SCxSR_FE 0x0002 +#define MPC555_SERIAL_SCxSR_PF 0x0001 + +// The available baud rates +// These are calculated for a busclock of 40 MHz +// It is not necessary to let the compiler calculate these +// values, we did not provide clockfrequency as a configuarion +// option anyway. +static unsigned short select_baud[] = { + 0, // Unused + 0, // 50 bps unsupported + 0, // 75 bps unsupported + 0, // 110 bps unsupported + 0, // 134_5 bps unsupported + 0, // 150 bps unsupported + 0, // 200 bps unsupported + 4167, // 300 bps + 2083, // 600 bps + 1042, // 1200 bps + 0, // 1800 bps unsupported + 521, // 2400 bps + 0, // 3600 bps unsupported + 260, // 4800 bps + 0, // 7200 bps unsupported + 130, // 9600 bps + 87, // 14400 bps + 65, // 19200 bps + 33, // 38400 bps + 22, // 57600 bps + 11, // 115200 bps + 0 // 230400 bps unsupported +}; + +static unsigned char select_word_length[] = { + 0, // 5 bits / word (char) not supported + 0, // 6 bits / word (char) not supported + 7, // 7 bits / word (char) ->> 7 bits per frame + 8 // 8 bits / word (char) ->> 8 bits per frame +}; + +static unsigned char select_stop_bits[] = { + 0, + 1, // 1 stop bit ->> 1 bit per frame + 0, // 1.5 stop bit not supported + 2 // 2 stop bits ->> 2 bits per frame +}; + +static unsigned char select_parity[] = { + 0, // No parity ->> 0 bits per frame + 1, // Even parity ->> 1 bit per frame + 1, // Odd parityv ->> 1 bit per frame + 0, // Mark parity not supported + 0, // Space parity not supported +}; + +#endif // CYGONCE_DEVS_SERIAL_POWERPC_CME555_SERIAL_H + +// EOF cme555_serial.h diff --git a/packages/devs/serial/powerpc/cme555/current/src/cme555_serial_with_ints.c b/packages/devs/serial/powerpc/cme555/current/src/cme555_serial_with_ints.c new file mode 100644 --- /dev/null +++ b/packages/devs/serial/powerpc/cme555/current/src/cme555_serial_with_ints.c @@ -0,0 +1,632 @@ +//========================================================================== +// +// cme555_serial_with_ints.c +// +// PowerPC 5xx CME555 Serial I/O Interface Module (interrupt driven) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: +// Date: 2002-04-25 +// Purpose: CME555 Serial I/O module (interrupt driven version) +// Description: +// +// +//####DESCRIPTIONEND#### +//========================================================================== +//---------------------------------- +// Includes and forward declarations +//---------------------------------- +#include +#include + +#include +#include +#include +#include +#include +#include + +// Only build this driver for the MPC555 based CME555 board +#ifdef CYGPKG_IO_SERIAL_POWERPC_CME555 + +#include "cme555_serial.h" + +//----------------- +// Type definitions +//----------------- +typedef struct mpc555_serial_info { + CYG_ADDRWORD base; // The base address of the serial port + CYG_WORD tx_interrupt_num; // trivial + CYG_WORD rx_interrupt_num; // trivial + cyg_priority_t tx_interrupt_priority; // trivial + cyg_priority_t rx_interrupt_priority; // trivial + bool tx_interrupt_enable; // tells if the transmit interrupt may be re-enabled + cyg_interrupt tx_interrupt; // the tx interrupt object + cyg_handle_t tx_interrupt_handle; // the tx interrupt handle + cyg_interrupt rx_interrupt; // the rx interrupt object + cyg_handle_t rx_interrupt_handle; // the rx interrupt handle +} mpc555_serial_info; + +//-------------------- +// Function prototypes +//-------------------- +static bool mpc555_serial_init(struct cyg_devtab_entry * tab); +static bool mpc555_serial_putc(serial_channel * chan, unsigned char c); +static Cyg_ErrNo mpc555_serial_lookup(struct cyg_devtab_entry ** tab, + struct cyg_devtab_entry * sub_tab, + const char * name); +static unsigned char mpc555_serial_getc(serial_channel *chan); +static Cyg_ErrNo mpc555_serial_set_config(serial_channel *chan, cyg_uint32 key, + const void *xbuf, cyg_uint32 *len); +static void mpc555_serial_start_xmit(serial_channel *chan); +static void mpc555_serial_stop_xmit(serial_channel *chan); + +// The interrupt servers +static cyg_uint32 mpc555_serial_tx_ISR(cyg_vector_t vector, cyg_addrword_t data); +static cyg_uint32 mpc555_serial_rx_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void mpc555_serial_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); +static void mpc555_serial_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); + +//------------------------------------------- +// Register the device driver with the kernel +//------------------------------------------- +static SERIAL_FUNS(mpc555_serial_funs, + mpc555_serial_putc, + mpc555_serial_getc, + mpc555_serial_set_config, + mpc555_serial_start_xmit, + mpc555_serial_stop_xmit); + +//------------------- +// Device driver data +//------------------- +#ifdef CYGPKG_IO_SERIAL_POWERPC_CME555_SERIAL_A +static mpc555_serial_info mpc555_serial_info0 = {MPC555_SERIAL_BASE_A, + CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX, + CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX, + CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX_PRIORITY, + CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX_PRIORITY, + false}; +#if CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_A_BUFSIZE > 0 +static unsigned char mpc555_serial_out_buf0[CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_A_BUFSIZE]; +static unsigned char mpc555_serial_in_buf0[CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_A_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(mpc555_serial_channel0, + mpc555_serial_funs, + mpc555_serial_info0, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_A_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &mpc555_serial_out_buf0[0], + sizeof(mpc555_serial_out_buf0), + &mpc555_serial_in_buf0[0], + sizeof(mpc555_serial_in_buf0)); +#else +static SERIAL_CHANNEL(mpc555_serial_channel0, + mpc555_serial_funs, + mpc555_serial_info0, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_A_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT); +#endif +DEVTAB_ENTRY(mpc555_serial_io0, + CYGDAT_IO_SERIAL_POWERPC_CME555_SERIAL_A_NAME, + 0, // does not depend on a lower level device driver + &cyg_io_serial_devio, + mpc555_serial_init, + mpc555_serial_lookup, + &mpc555_serial_channel0); +#endif // ifdef CYGPKG_IO_SERIAL_POWERPC_CME555_SERIAL_A + +#ifdef CYGPKG_IO_SERIAL_POWERPC_CME555_SERIAL_B +static mpc555_serial_info mpc555_serial_info1 = {MPC555_SERIAL_BASE_B, + CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX, + CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX, + CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX_PRIORITY, + CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX_PRIORITY, + false}; +#if CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_B_BUFSIZE > 0 +static unsigned char mpc555_serial_out_buf1[CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_B_BUFSIZE]; +static unsigned char mpc555_serial_in_buf1[CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_B_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(mpc555_serial_channel1, + mpc555_serial_funs, + mpc555_serial_info1, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_B_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &mpc555_serial_out_buf1[0], + sizeof(mpc555_serial_out_buf1), + &mpc555_serial_in_buf1[0], + sizeof(mpc555_serial_in_buf1)); +#else +static SERIAL_CHANNEL(mpc555_serial_channel1, + mpc555_serial_funs, + mpc555_serial_info1, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_CME555_SERIAL_B_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT); +#endif +DEVTAB_ENTRY(mpc555_serial_io1, + CYGDAT_IO_SERIAL_POWERPC_CME555_SERIAL_B_NAME, + 0, // does not depend on a lower level device driver + &cyg_io_serial_devio, + mpc555_serial_init, + mpc555_serial_lookup, + &mpc555_serial_channel1); +#endif // ifdef CYGPKG_IO_SERIAL_POWERPC_CME555_SERIAL_B + +//----------------------------- +// Device driver implementation +//----------------------------- + +// The arbitration isr. +// I think this is the best place to implement it. The device driver is the only place +// in the code where the knowledge is present about how the hardware is used +static cyg_uint32 hal_arbitration_isr_qsci(CYG_ADDRWORD a_vector, CYG_ADDRWORD a_data) +{ + cyg_uint16 status; + cyg_uint16 control; + +#ifdef CYGPKG_IO_SERIAL_POWERPC_CME555_SERIAL_A // Do not waist time on unused hardware + HAL_READ_UINT16(CYGARC_REG_IMM_SC1SR, status); + HAL_READ_UINT16(CYGARC_REG_IMM_SCC1R1, control); + if((status & CYGARC_REG_IMM_SCxSR_TDRE) && (control & CYGARC_REG_IMM_SCCxR1_TIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX); +// Don't waist time on unused interrupts +// if((status & CYGARC_REG_IMM_SCxSR_TC) && (control & CYGARC_REG_IMM_SCCxR1_TCIE)) +// return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TXC); + if((status & CYGARC_REG_IMM_SCxSR_RDRF) && (control & CYGARC_REG_IMM_SCCxR1_RIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX); +// Don't waist time on unused interrupts +// if((status & CYGARC_REG_IMM_SCxSR_IDLE) && (control & CYGARC_REG_IMM_SCCxR1_ILIE)) +// return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI0_IDLE); +#endif + +#ifdef CYGPKG_IO_SERIAL_POWERPC_CME555_SERIAL_B // Do not waist time on unused hardware + HAL_READ_UINT16(CYGARC_REG_IMM_SC2SR, status); + HAL_READ_UINT16(CYGARC_REG_IMM_SCC2R1, control); + if((status & CYGARC_REG_IMM_SCxSR_TDRE) && (control & CYGARC_REG_IMM_SCCxR1_TIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX); +// Don't waist time on unused interrupts +// if((status & CYGARC_REG_IMM_SCxSR_TC) && (control & CYGARC_REG_IMM_SCCxR1_TCIE)) +// return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXC); + if((status & CYGARC_REG_IMM_SCxSR_RDRF) && (control & CYGARC_REG_IMM_SCCxR1_RIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX); +// Don't waist time on unused interrupts +// if((status & CYGARC_REG_IMM_SCxSR_IDLE) && (control & CYGARC_REG_IMM_SCCxR1_ILIE)) +// return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_IDLE); + +#if 0 + // The driver doesn't use the queue operation of the hardware (It would need different code for serial 1 and 2 + // since oly one port supports queue mode). So the following is not needed. + // Leave it there. It is easyer for later implementations to remove the comments than finding + // out how the hardware works again. + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1SR, status); + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1CR, control); + if((status & CYGARC_REG_IMM_QSCI1SR_QTHF) && (control & CYGARC_REG_IMM_QSCI1CR_QTHFI)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQTHF); + if((status & CYGARC_REG_IMM_QSCI1SR_QBHF) && (control & CYGARC_REG_IMM_QSCI1CR_QBHFI)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQBHF); + if((status & CYGARC_REG_IMM_QSCI1SR_QTHE) && (control & CYGARC_REG_IMM_QSCI1CR_QTHEI)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQTHE); + if((status & CYGARC_REG_IMM_QSCI1SR_QBHE) && (control & CYGARC_REG_IMM_QSCI1CR_QBHEI)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQBHE); + + cyg_uint16 status; + cyg_uint16 control; + + HAL_READ_UINT16(CYGARC_REG_IMM_SPSR, status); + HAL_READ_UINT16(CYGARC_REG_IMM_SPCR2, control); + if((status & CYGARC_REG_IMM_SPSR_SPIF) && (control & CYGARC_REG_IMM_SPCR2_SPIFIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SPI_FI); + + HAL_READ_UINT16(CYGARC_REG_IMM_SPCR3, control); + if((status & CYGARC_REG_IMM_SPSR_MODF) && (control & CYGARC_REG_IMM_SPCR3_HMIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SPI_MODF); + + if((status & CYGARC_REG_IMM_SPSR_HALTA) && (control & CYGARC_REG_IMM_SPCR3_HMIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SPI_HALTA); +#endif + +#endif + + return 0; +} + +//-------------------------------------------------------------------------------- +// Internal function to actually configure the hardware to desired baud rate, etc. +//-------------------------------------------------------------------------------- +static bool mpc555_serial_config_port(serial_channel * chan, cyg_serial_info_t * new_config, bool init) +{ + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)(chan->dev_priv); + + cyg_addrword_t port = mpc555_chan->base; + cyg_uint16 baud_rate = select_baud[new_config->baud]; + unsigned char frame_length = 1; // The start bit + + cyg_uint16 old_isrstate; + cyg_uint16 sccxr; + + if(!baud_rate) + return false; // Invalid baud rate selected + + if((new_config->word_length != CYGNUM_SERIAL_WORD_LENGTH_7) && + (new_config->word_length != CYGNUM_SERIAL_WORD_LENGTH_8)) + return false; // Invalid word length selected + + if((new_config->parity != CYGNUM_SERIAL_PARITY_NONE) && + (new_config->parity != CYGNUM_SERIAL_PARITY_EVEN) && + (new_config->parity != CYGNUM_SERIAL_PARITY_ODD)) + return false; // Invalid parity selected + + if((new_config->stop != CYGNUM_SERIAL_STOP_1) && + (new_config->stop != CYGNUM_SERIAL_STOP_2)) + return false; // Invalid stop bits selected + + frame_length += select_word_length[new_config->word_length - CYGNUM_SERIAL_WORD_LENGTH_5]; + frame_length += select_stop_bits[new_config->stop]; + frame_length += select_parity[new_config->parity]; + + if((frame_length != 10) && (frame_length != 11)) + return false; // Invalid frame format selected + + // Disable port interrupts while changing hardware + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + old_isrstate = sccxr; + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_LOOPS); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_WOMS); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_ILT); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_PT); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_PE); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_M); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_WAKE); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_TE); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_RE); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_RWU); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_SBK); + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_TIE); + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_TCIE); + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_RIE); + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_ILIE); + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + + // Set databits, stopbits and parity. + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + + if(frame_length == 11) + sccxr |= (cyg_uint16)MPC555_SERIAL_SCCxR1_M; + else + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_M); + + switch(new_config->parity) + { + case CYGNUM_SERIAL_PARITY_NONE: + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_PE); + break; + case CYGNUM_SERIAL_PARITY_EVEN: + sccxr |= (cyg_uint16)MPC555_SERIAL_SCCxR1_PE; + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_PT); + break; + case CYGNUM_SERIAL_PARITY_ODD: + sccxr |= (cyg_uint16)MPC555_SERIAL_SCCxR1_PE; + sccxr |= (cyg_uint16)MPC555_SERIAL_SCCxR1_PT; + break; + default: + break; + } + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + + // Set baud rate. + baud_rate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR0_OTHR); + baud_rate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR0_LINKBD); + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR0, sccxr); + sccxr &= ~(MPC555_SERIAL_SCCxR0_SCxBR); + sccxr |= baud_rate; + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR0, sccxr); + + // Enable the device + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + sccxr |= MPC555_SERIAL_SCCxR1_TE; + sccxr |= MPC555_SERIAL_SCCxR1_RE; + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + + if(init) + { // enable the receiver interrupt + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + sccxr |= MPC555_SERIAL_SCCxR1_RIE; + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + } + else // Restore the old interrupt state + { + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + sccxr |= old_isrstate; + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + } + + if(new_config != &chan->config) + chan->config = *new_config; + + return true; +} + +//-------------------------------------------------------------- +// Function to initialize the device. Called at bootstrap time. +//-------------------------------------------------------------- +static hal_mpc5xx_arbitration_data arbiter; + +static bool mpc555_serial_init(struct cyg_devtab_entry * tab) +{ + serial_channel * chan = (serial_channel *)tab->priv; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + if(!mpc555_serial_config_port(chan, &chan->config, true)) + return false; + + (chan->callbacks->serial_init)(chan); // Really only required for interrupt driven devices + if(chan->out_cbuf.len != 0) + { + arbiter.priority = CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI; + arbiter.data = 0; + arbiter.arbiter = hal_arbitration_isr_qsci; + + // Install the arbitration isr, Make sure that is is not installed twice + hal_mpc5xx_remove_arbitration_isr(&arbiter); + hal_mpc5xx_install_arbitration_isr(&arbiter); + + // Create the Tx interrupt, do not enable it yet + cyg_drv_interrupt_create(mpc555_chan->tx_interrupt_num, + mpc555_chan->tx_interrupt_priority, + (cyg_addrword_t)chan, // Data item passed to interrupt handler + mpc555_serial_tx_ISR, + mpc555_serial_tx_DSR, + &mpc555_chan->tx_interrupt_handle, + &mpc555_chan->tx_interrupt); + cyg_drv_interrupt_attach(mpc555_chan->tx_interrupt_handle); + + // Create the Rx interrupt, this can be safely unmasked now + cyg_drv_interrupt_create(mpc555_chan->rx_interrupt_num, + mpc555_chan->rx_interrupt_priority, + (cyg_addrword_t)chan, + mpc555_serial_rx_ISR, + mpc555_serial_rx_DSR, + &mpc555_chan->rx_interrupt_handle, + &mpc555_chan->rx_interrupt); + cyg_drv_interrupt_attach(mpc555_chan->rx_interrupt_handle); + cyg_drv_interrupt_unmask(mpc555_chan->rx_interrupt_num); + } + + return true; +} + +//---------------------------------------------------------------------- +// This routine is called when the device is "looked" up (i.e. attached) +//---------------------------------------------------------------------- +static Cyg_ErrNo mpc555_serial_lookup(struct cyg_devtab_entry ** tab, + struct cyg_devtab_entry * sub_tab, + const char * name) +{ + serial_channel * chan = (serial_channel *)(*tab)->priv; + (chan->callbacks->serial_init)(chan); // Really only required for interrupt driven devices + + return ENOERR; +} + +//---------------------------------------------- +// Send a character to the device output buffer. +// Return 'true' if character is sent to device +//---------------------------------------------- +static bool mpc555_serial_putc(serial_channel * chan, unsigned char c) +{ + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + cyg_addrword_t port = mpc555_chan->base; + + cyg_uint16 scsr; + cyg_uint16 scdr; + + HAL_READ_UINT16(port + MPC555_SERIAL_SCxSR, scsr); + if(scsr & MPC555_SERIAL_SCxSR_TDRE) + { // Ok, we have space, write the character and return success + scdr = (cyg_uint16)c; + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCxDR, scdr); + return true; + } + else + // We cannot write to the transmitter, return failure + return false; +} + +//--------------------------------------------------------------------- +// Fetch a character from the device input buffer, waiting if necessary +//--------------------------------------------------------------------- +static unsigned char mpc555_serial_getc(serial_channel * chan) +{ + unsigned char c; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + cyg_addrword_t port = mpc555_chan->base; + + cyg_uint16 scsr; + cyg_uint16 scdr; + + do { + HAL_READ_UINT16(port + MPC555_SERIAL_SCxSR, scsr); + } while(!(scsr & MPC555_SERIAL_SCxSR_RDRF)); + + // Ok, data is received, read it out and return + HAL_READ_UINT16(port + MPC555_SERIAL_SCxDR, scdr); + c = (unsigned char)scdr; + + return c; +} + +//--------------------------------------------------- +// Set up the device characteristics; baud rate, etc. +//--------------------------------------------------- +static bool mpc555_serial_set_config(serial_channel * chan, cyg_uint32 key, + const void *xbuf, cyg_uint32 * len) +{ + switch(key) { + case CYG_IO_SET_CONFIG_SERIAL_INFO: + { + cyg_serial_info_t *config = (cyg_serial_info_t *)xbuf; + if(*len < sizeof(cyg_serial_info_t)) { + return -EINVAL; + } + *len = sizeof(cyg_serial_info_t); + if(true != mpc555_serial_config_port(chan, config, false)) + return -EINVAL; + } + break; + default: + return -EINVAL; + } + return ENOERR; +} + +//------------------------------------- +// Enable the transmitter on the device +//------------------------------------- +static void mpc555_serial_start_xmit(serial_channel * chan) +{ + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + mpc555_chan->tx_interrupt_enable = true; + cyg_drv_interrupt_unmask(mpc555_chan->tx_interrupt_num); + + // No need to call xmt_char, this will generate an interrupt immediately. +} + +//-------------------------------------- +// Disable the transmitter on the device +//-------------------------------------- +static void mpc555_serial_stop_xmit(serial_channel * chan) +{ + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + cyg_drv_dsr_lock(); + mpc555_chan->tx_interrupt_enable = false; + cyg_drv_interrupt_mask(mpc555_chan->tx_interrupt_num); + cyg_drv_dsr_unlock(); +} + +//----------------------------------------- +// The low level transmit interrupt handler +//----------------------------------------- +static cyg_uint32 mpc555_serial_tx_ISR(cyg_vector_t vector, cyg_addrword_t data) +{ + serial_channel * chan = (serial_channel *)data; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + cyg_drv_interrupt_mask(mpc555_chan->tx_interrupt_num); + cyg_drv_interrupt_acknowledge(mpc555_chan->tx_interrupt_num); + + return CYG_ISR_CALL_DSR; // cause the DSR to run +} + +//---------------------------------------- +// The low level receive interrupt handler +//---------------------------------------- +static cyg_uint32 mpc555_serial_rx_ISR(cyg_vector_t vector, cyg_addrword_t data) +{ + serial_channel * chan = (serial_channel *)data; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + cyg_drv_interrupt_mask(mpc555_chan->rx_interrupt_num); + cyg_drv_interrupt_acknowledge(mpc555_chan->rx_interrupt_num); + + return CYG_ISR_CALL_DSR; // cause the DSR to run +} + +//------------------------------------------ +// The high level transmit interrupt handler +//------------------------------------------ +static void mpc555_serial_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + serial_channel * chan = (serial_channel *)data; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + (chan->callbacks->xmt_char)(chan); + if(mpc555_chan->tx_interrupt_enable) + cyg_drv_interrupt_unmask(mpc555_chan->tx_interrupt_num); +} + +//----------------------------------------- +// The high level receive interrupt handler +//----------------------------------------- +#define MPC555_SERIAL_SCxSR_ERRORS (MPC555_SERIAL_SCxSR_OR | \ + MPC555_SERIAL_SCxSR_NF | \ + MPC555_SERIAL_SCxSR_FE | \ + MPC555_SERIAL_SCxSR_PF) + +static void mpc555_serial_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + serial_channel * chan = (serial_channel *)data; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + cyg_addrword_t port = mpc555_chan->base; + cyg_uint16 scdr; + cyg_uint16 scsr; + + // Allways read out the received character, in order to clear receiver flags + HAL_READ_UINT16(port + MPC555_SERIAL_SCxDR, scdr); + + HAL_READ_UINT16(port + MPC555_SERIAL_SCxSR, scsr); + if(scsr & (cyg_uint16)MPC555_SERIAL_SCxSR_ERRORS) + { + scsr &= ~((cyg_uint16)MPC555_SERIAL_SCxSR_ERRORS); + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCxSR, scsr); + } + else + { + (chan->callbacks->rcv_char)(chan, (cyg_uint8)scdr); + } + + cyg_drv_interrupt_unmask(mpc555_chan->rx_interrupt_num); +} + +#endif // CYGPKG_IO_SERIAL_POWERPC_CME555 + +// EOF cmd555_serial_with_ints.c diff --git a/packages/devs/serial/powerpc/cogent/current/ChangeLog b/packages/devs/serial/powerpc/cogent/current/ChangeLog --- a/packages/devs/serial/powerpc/cogent/current/ChangeLog +++ b/packages/devs/serial/powerpc/cogent/current/ChangeLog @@ -1157,27 +1157,36 @@ 1999-03-03 Gary Thomas + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/serial/powerpc/ec555/current/cdl/ser_powerpc_ec555.cdl b/packages/devs/serial/powerpc/ec555/current/cdl/ser_powerpc_ec555.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/powerpc/ec555/current/cdl/ser_powerpc_ec555.cdl @@ -0,0 +1,185 @@ +# ==================================================================== +# +# ser_powerpc_ec555.cdl +# +# eCos serial PowerPC/ec555 configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Bob Koninckx +# Original data: +# Contributors: +# Date: 1999-07-14 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_IO_SERIAL_POWERPC_EC555 { + display "ec555 PowerPC serial device drivers" + + parent CYGPKG_IO_SERIAL_DEVICES + active_if CYGPKG_IO_SERIAL + active_if CYGPKG_HAL_POWERPC_EC555 + + requires CYGPKG_ERROR + include_dir cyg/io + include_files ; # none _exported_ whatsoever + description " + This option enables the serial device drivers for the + ec555 mpc555 development board." + doc redirect/ecos-device-drivers.html + + compile -library=libextras.a ec555_serial_with_ints.c + + define_proc { + puts $::cdl_system_header "/***** serial driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_DEVICE_HEADER " + puts $::cdl_system_header "/***** serial driver proc output end *****/" + } + +cdl_component CYGPKG_IO_SERIAL_POWERPC_EC555_SERIAL_A { + display "ec555 PowerPC serial port A driver" + flavor bool + default_value 0 + description " + This option includes the serial device driver for the ec555 + PowerPC port A." + + cdl_option CYGDAT_IO_SERIAL_POWERPC_EC555_SERIAL_A_NAME { + display "Device name for ec555 PowerPC serial port A" + flavor data + default_value {"\"/dev/ser1\""} + description " + This option specifies the device name for the ec555 PowerPC + port A." + } + + cdl_option CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_A_BAUD { + display "Baud rate for the ec555 PowerPC serial port A driver" + flavor data + legal_values { 300 600 1200 2400 4800 9600 14400 19200 38400 57600 115200 } + default_value 38400 + description " + This option specifies the default baud rate (speed) for the + ec555 PowerPC port A." + } + + cdl_option CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_A_BUFSIZE { + display "Buffer size for the ec555 PowerPC serial port A driver" + flavor data + legal_values 0 to 8192 + default_value 128 + description " + This option specifies the size of the internal buffers used for + the ec555 PowerPC port A." + } +} + +cdl_component CYGPKG_IO_SERIAL_POWERPC_EC555_SERIAL_B { + display "ec555 PowerPC serial port B driver" + flavor bool + default_value 1 + description " + This option includes the serial device driver for the ec555 + PowerPC port B." + + cdl_option CYGDAT_IO_SERIAL_POWERPC_EC555_SERIAL_B_NAME { + display "Device name for ec555 PowerPC serial port B" + flavor data + default_value {"\"/dev/ser2\""} + description " + This option specifies the device name for the ec555 PowerPC + port B." + } + + cdl_option CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_B_BAUD { + display "Baud rate for the ec555 PowerPC serial port B driver" + flavor data + legal_values { 300 600 1200 2400 4800 9600 14400 19200 38400 57600 115200 } + default_value 38400 + description " + This option specifies the default baud rate (speed) for the + ec555 PowerPC port B." + } + + cdl_option CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_B_BUFSIZE { + display "Buffer size for the ec555 PowerPC serial port B driver" + flavor data + legal_values 0 to 8192 + default_value 128 + description " + This option specifies the size of the internal buffers used + for the ec555 PowerPC port B." + } +} + + cdl_component CYGPKG_IO_SERIAL_POWERPC_EC555_OPTIONS { + display "Serial device driver build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_IO_SERIAL_POWERPC_EC555_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building these serial device drivers. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_IO_SERIAL_POWERPC_EC555_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building these serial device drivers. These flags are removed from + the set of global flags if present." + } + } + +} + +# EOF ser_powerpc_ec555.cdl diff --git a/packages/devs/serial/powerpc/ec555/current/src/ec555_serial.h b/packages/devs/serial/powerpc/ec555/current/src/ec555_serial.h new file mode 100644 --- /dev/null +++ b/packages/devs/serial/powerpc/ec555/current/src/ec555_serial.h @@ -0,0 +1,157 @@ +#ifndef CYGONCE_DEVS_SERIAL_POWERPC_EC555_SERIAL_H +#define CYGONCE_DEVS_SERIAL_POWERPC_EC555_SERIAL_H +//========================================================================== +// +// ec555_serial.h +// +// PowerPC 5xx EC555 Serial I/O definitions. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: +// Date: 2002-04-25 +// Purpose: EC555 Serial I/O definitions. +// Description: +// +// +//####DESCRIPTIONEND#### +//========================================================================== + +//---------------------------------- +// Includes and forward declarations +//---------------------------------- + +//---------------------- +// Constants definitions +//---------------------- +// Base addresses for the two serial ports +#define MPC555_SERIAL_BASE_A 0x305008 +#define MPC555_SERIAL_BASE_B 0x305020 + +// The offset from the base for all serial registers +#define MPC555_SERIAL_SCCxR0 0 +#define MPC555_SERIAL_SCCxR1 2 +#define MPC555_SERIAL_SCxSR 4 +#define MPC555_SERIAL_SCxDR 6 + +// The bits in the serial registers +#define MPC555_SERIAL_SCCxR0_OTHR 0x8000 +#define MPC555_SERIAL_SCCxR0_LINKBD 0x4000 +#define MPC555_SERIAL_SCCxR0_SCxBR 0x1fff + +#define MPC555_SERIAL_SCCxR1_LOOPS 0x4000 +#define MPC555_SERIAL_SCCxR1_WOMS 0x2000 +#define MPC555_SERIAL_SCCxR1_ILT 0x1000 +#define MPC555_SERIAL_SCCxR1_PT 0x0800 +#define MPC555_SERIAL_SCCxR1_PE 0x0400 +#define MPC555_SERIAL_SCCxR1_M 0x0200 +#define MPC555_SERIAL_SCCxR1_WAKE 0x0100 +#define MPC555_SERIAL_SCCxR1_TIE 0x0080 +#define MPC555_SERIAL_SCCxR1_TCIE 0x0040 +#define MPC555_SERIAL_SCCxR1_RIE 0x0020 +#define MPC555_SERIAL_SCCxR1_ILIE 0x0010 +#define MPC555_SERIAL_SCCxR1_TE 0x0008 +#define MPC555_SERIAL_SCCxR1_RE 0x0004 +#define MPC555_SERIAL_SCCxR1_RWU 0x0002 +#define MPC555_SERIAL_SCCxR1_SBK 0x0001 + +#define MPC555_SERIAL_SCxSR_TDRE 0x0100 +#define MPC555_SERIAL_SCxSR_TC 0x0080 +#define MPC555_SERIAL_SCxSR_RDRF 0x0040 +#define MPC555_SERIAL_SCxSR_RAF 0x0020 +#define MPC555_SERIAL_SCxSR_IDLE 0x0010 +#define MPC555_SERIAL_SCxSR_OR 0x0008 +#define MPC555_SERIAL_SCxSR_NF 0x0004 +#define MPC555_SERIAL_SCxSR_FE 0x0002 +#define MPC555_SERIAL_SCxSR_PF 0x0001 + +// The available baud rates +// These are calculated for a busclock of 40 MHz +// It is not necessary to let the compiler calculate these +// values, we did not provide clockfrequency as a configuarion +// option anyway. +static unsigned short select_baud[] = { + 0, // Unused + 0, // 50 bps unsupported + 0, // 75 bps unsupported + 0, // 110 bps unsupported + 0, // 134_5 bps unsupported + 0, // 150 bps unsupported + 0, // 200 bps unsupported + 4167, // 300 bps + 2083, // 600 bps + 1042, // 1200 bps + 0, // 1800 bps unsupported + 521, // 2400 bps + 0, // 3600 bps unsupported + 260, // 4800 bps + 0, // 7200 bps unsupported + 130, // 9600 bps + 87, // 14400 bps + 65, // 19200 bps + 33, // 38400 bps + 22, // 57600 bps + 11, // 115200 bps + 0 // 230400 bps unsupported +}; + +static unsigned char select_word_length[] = { + 0, // 5 bits / word (char) not supported + 0, // 6 bits / word (char) not supported + 7, // 7 bits / word (char) ->> 7 bits per frame + 8 // 8 bits / word (char) ->> 8 bits per frame +}; + +static unsigned char select_stop_bits[] = { + 0, + 1, // 1 stop bit ->> 1 bit per frame + 0, // 1.5 stop bit not supported + 2 // 2 stop bits ->> 2 bits per frame +}; + +static unsigned char select_parity[] = { + 0, // No parity ->> 0 bits per frame + 1, // Even parity ->> 1 bit per frame + 1, // Odd parityv ->> 1 bit per frame + 0, // Mark parity not supported + 0, // Space parity not supported +}; + +#endif // CYGONCE_DEVS_SERIAL_POWERPC_EC555_SERIAL_H + +// EOF ec555_serial.h diff --git a/packages/devs/serial/powerpc/ec555/current/src/ec555_serial_with_ints.c b/packages/devs/serial/powerpc/ec555/current/src/ec555_serial_with_ints.c new file mode 100644 --- /dev/null +++ b/packages/devs/serial/powerpc/ec555/current/src/ec555_serial_with_ints.c @@ -0,0 +1,632 @@ +//========================================================================== +// +// ec555_serial_with_ints.c +// +// PowerPC 5xx EC555 Serial I/O Interface Module (interrupt driven) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: +// Date: 2002-04-25 +// Purpose: EC555 Serial I/O module (interrupt driven version) +// Description: +// +// +//####DESCRIPTIONEND#### +//========================================================================== +//---------------------------------- +// Includes and forward declarations +//---------------------------------- +#include +#include + +#include +#include +#include +#include +#include +#include + +// Only build this driver for the MPC555 based EC555 board +#ifdef CYGPKG_IO_SERIAL_POWERPC_EC555 + +#include "ec555_serial.h" + +//----------------- +// Type definitions +//----------------- +typedef struct mpc555_serial_info { + CYG_ADDRWORD base; // The base address of the serial port + CYG_WORD tx_interrupt_num; // trivial + CYG_WORD rx_interrupt_num; // trivial + cyg_priority_t tx_interrupt_priority; // trivial + cyg_priority_t rx_interrupt_priority; // trivial + bool tx_interrupt_enable; // tells if the transmit interrupt may be re-enabled + cyg_interrupt tx_interrupt; // the tx interrupt object + cyg_handle_t tx_interrupt_handle; // the tx interrupt handle + cyg_interrupt rx_interrupt; // the rx interrupt object + cyg_handle_t rx_interrupt_handle; // the rx interrupt handle +} mpc555_serial_info; + +//-------------------- +// Function prototypes +//-------------------- +static bool mpc555_serial_init(struct cyg_devtab_entry * tab); +static bool mpc555_serial_putc(serial_channel * chan, unsigned char c); +static Cyg_ErrNo mpc555_serial_lookup(struct cyg_devtab_entry ** tab, + struct cyg_devtab_entry * sub_tab, + const char * name); +static unsigned char mpc555_serial_getc(serial_channel *chan); +static Cyg_ErrNo mpc555_serial_set_config(serial_channel *chan, cyg_uint32 key, + const void *xbuf, cyg_uint32 *len); +static void mpc555_serial_start_xmit(serial_channel *chan); +static void mpc555_serial_stop_xmit(serial_channel *chan); + +// The interrupt servers +static cyg_uint32 mpc555_serial_tx_ISR(cyg_vector_t vector, cyg_addrword_t data); +static cyg_uint32 mpc555_serial_rx_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void mpc555_serial_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); +static void mpc555_serial_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); + +//------------------------------------------- +// Register the device driver with the kernel +//------------------------------------------- +static SERIAL_FUNS(mpc555_serial_funs, + mpc555_serial_putc, + mpc555_serial_getc, + mpc555_serial_set_config, + mpc555_serial_start_xmit, + mpc555_serial_stop_xmit); + +//------------------- +// Device driver data +//------------------- +#ifdef CYGPKG_IO_SERIAL_POWERPC_EC555_SERIAL_A +static mpc555_serial_info mpc555_serial_info0 = {MPC555_SERIAL_BASE_A, + CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX, + CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX, + CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX_PRIORITY, + CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX_PRIORITY, + false}; +#if CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_A_BUFSIZE > 0 +static unsigned char mpc555_serial_out_buf0[CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_A_BUFSIZE]; +static unsigned char mpc555_serial_in_buf0[CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_A_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(mpc555_serial_channel0, + mpc555_serial_funs, + mpc555_serial_info0, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_A_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &mpc555_serial_out_buf0[0], + sizeof(mpc555_serial_out_buf0), + &mpc555_serial_in_buf0[0], + sizeof(mpc555_serial_in_buf0)); +#else +static SERIAL_CHANNEL(mpc555_serial_channel0, + mpc555_serial_funs, + mpc555_serial_info0, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_A_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT); +#endif +DEVTAB_ENTRY(mpc555_serial_io0, + CYGDAT_IO_SERIAL_POWERPC_EC555_SERIAL_A_NAME, + 0, // does not depend on a lower level device driver + &cyg_io_serial_devio, + mpc555_serial_init, + mpc555_serial_lookup, + &mpc555_serial_channel0); +#endif // ifdef CYGPKG_IO_SERIAL_POWERPC_EC555_SERIAL_A + +#ifdef CYGPKG_IO_SERIAL_POWERPC_EC555_SERIAL_B +static mpc555_serial_info mpc555_serial_info1 = {MPC555_SERIAL_BASE_B, + CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX, + CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX, + CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX_PRIORITY, + CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX_PRIORITY, + false}; +#if CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_B_BUFSIZE > 0 +static unsigned char mpc555_serial_out_buf1[CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_B_BUFSIZE]; +static unsigned char mpc555_serial_in_buf1[CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_B_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(mpc555_serial_channel1, + mpc555_serial_funs, + mpc555_serial_info1, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_B_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &mpc555_serial_out_buf1[0], + sizeof(mpc555_serial_out_buf1), + &mpc555_serial_in_buf1[0], + sizeof(mpc555_serial_in_buf1)); +#else +static SERIAL_CHANNEL(mpc555_serial_channel1, + mpc555_serial_funs, + mpc555_serial_info1, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_POWERPC_EC555_SERIAL_B_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT); +#endif +DEVTAB_ENTRY(mpc555_serial_io1, + CYGDAT_IO_SERIAL_POWERPC_EC555_SERIAL_B_NAME, + 0, // does not depend on a lower level device driver + &cyg_io_serial_devio, + mpc555_serial_init, + mpc555_serial_lookup, + &mpc555_serial_channel1); +#endif // ifdef CYGPKG_IO_SERIAL_POWERPC_EC555_SERIAL_B + +//----------------------------- +// Device driver implementation +//----------------------------- + +// The arbitration isr. +// I think this is the best place to implement it. The device driver is the only place +// in the code where the knowledge is present about how the hardware is used +static cyg_uint32 hal_arbitration_isr_qsci(CYG_ADDRWORD a_vector, CYG_ADDRWORD a_data) +{ + cyg_uint16 status; + cyg_uint16 control; + +#ifdef CYGPKG_IO_SERIAL_POWERPC_EC555_SERIAL_A // Do not waist time on unused hardware + HAL_READ_UINT16(CYGARC_REG_IMM_SC1SR, status); + HAL_READ_UINT16(CYGARC_REG_IMM_SCC1R1, control); + if((status & CYGARC_REG_IMM_SCxSR_TDRE) && (control & CYGARC_REG_IMM_SCCxR1_TIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX); +// Don't waist time on unused interrupts +// if((status & CYGARC_REG_IMM_SCxSR_TC) && (control & CYGARC_REG_IMM_SCCxR1_TCIE)) +// return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TXC); + if((status & CYGARC_REG_IMM_SCxSR_RDRF) && (control & CYGARC_REG_IMM_SCCxR1_RIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX); +// Don't waist time on unused interrupts +// if((status & CYGARC_REG_IMM_SCxSR_IDLE) && (control & CYGARC_REG_IMM_SCCxR1_ILIE)) +// return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI0_IDLE); +#endif + +#ifdef CYGPKG_IO_SERIAL_POWERPC_EC555_SERIAL_B // Do not waist time on unused hardware + HAL_READ_UINT16(CYGARC_REG_IMM_SC2SR, status); + HAL_READ_UINT16(CYGARC_REG_IMM_SCC2R1, control); + if((status & CYGARC_REG_IMM_SCxSR_TDRE) && (control & CYGARC_REG_IMM_SCCxR1_TIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX); +// Don't waist time on unused interrupts +// if((status & CYGARC_REG_IMM_SCxSR_TC) && (control & CYGARC_REG_IMM_SCCxR1_TCIE)) +// return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXC); + if((status & CYGARC_REG_IMM_SCxSR_RDRF) && (control & CYGARC_REG_IMM_SCCxR1_RIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX); +// Don't waist time on unused interrupts +// if((status & CYGARC_REG_IMM_SCxSR_IDLE) && (control & CYGARC_REG_IMM_SCCxR1_ILIE)) +// return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_IDLE); + +#if 0 + // The driver doesn't use the queue operation of the hardware (It would need different code for serial 1 and 2 + // since oly one port supports queue mode). So the following is not needed. + // Leave it there. It is easyer for later implementations to remove the comments than finding + // out how the hardware works again. + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1SR, status); + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1CR, control); + if((status & CYGARC_REG_IMM_QSCI1SR_QTHF) && (control & CYGARC_REG_IMM_QSCI1CR_QTHFI)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQTHF); + if((status & CYGARC_REG_IMM_QSCI1SR_QBHF) && (control & CYGARC_REG_IMM_QSCI1CR_QBHFI)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQBHF); + if((status & CYGARC_REG_IMM_QSCI1SR_QTHE) && (control & CYGARC_REG_IMM_QSCI1CR_QTHEI)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQTHE); + if((status & CYGARC_REG_IMM_QSCI1SR_QBHE) && (control & CYGARC_REG_IMM_QSCI1CR_QBHEI)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQBHE); + + cyg_uint16 status; + cyg_uint16 control; + + HAL_READ_UINT16(CYGARC_REG_IMM_SPSR, status); + HAL_READ_UINT16(CYGARC_REG_IMM_SPCR2, control); + if((status & CYGARC_REG_IMM_SPSR_SPIF) && (control & CYGARC_REG_IMM_SPCR2_SPIFIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SPI_FI); + + HAL_READ_UINT16(CYGARC_REG_IMM_SPCR3, control); + if((status & CYGARC_REG_IMM_SPSR_MODF) && (control & CYGARC_REG_IMM_SPCR3_HMIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SPI_MODF); + + if((status & CYGARC_REG_IMM_SPSR_HALTA) && (control & CYGARC_REG_IMM_SPCR3_HMIE)) + return hal_call_isr(CYGNUM_HAL_INTERRUPT_IMB3_SPI_HALTA); +#endif + +#endif + + return 0; +} + +//-------------------------------------------------------------------------------- +// Internal function to actually configure the hardware to desired baud rate, etc. +//-------------------------------------------------------------------------------- +static bool mpc555_serial_config_port(serial_channel * chan, cyg_serial_info_t * new_config, bool init) +{ + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)(chan->dev_priv); + + cyg_addrword_t port = mpc555_chan->base; + cyg_uint16 baud_rate = select_baud[new_config->baud]; + unsigned char frame_length = 1; // The start bit + + cyg_uint16 old_isrstate; + cyg_uint16 sccxr; + + if(!baud_rate) + return false; // Invalid baud rate selected + + if((new_config->word_length != CYGNUM_SERIAL_WORD_LENGTH_7) && + (new_config->word_length != CYGNUM_SERIAL_WORD_LENGTH_8)) + return false; // Invalid word length selected + + if((new_config->parity != CYGNUM_SERIAL_PARITY_NONE) && + (new_config->parity != CYGNUM_SERIAL_PARITY_EVEN) && + (new_config->parity != CYGNUM_SERIAL_PARITY_ODD)) + return false; // Invalid parity selected + + if((new_config->stop != CYGNUM_SERIAL_STOP_1) && + (new_config->stop != CYGNUM_SERIAL_STOP_2)) + return false; // Invalid stop bits selected + + frame_length += select_word_length[new_config->word_length - CYGNUM_SERIAL_WORD_LENGTH_5]; + frame_length += select_stop_bits[new_config->stop]; + frame_length += select_parity[new_config->parity]; + + if((frame_length != 10) && (frame_length != 11)) + return false; // Invalid frame format selected + + // Disable port interrupts while changing hardware + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + old_isrstate = sccxr; + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_LOOPS); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_WOMS); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_ILT); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_PT); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_PE); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_M); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_WAKE); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_TE); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_RE); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_RWU); + old_isrstate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_SBK); + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_TIE); + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_TCIE); + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_RIE); + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_ILIE); + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + + // Set databits, stopbits and parity. + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + + if(frame_length == 11) + sccxr |= (cyg_uint16)MPC555_SERIAL_SCCxR1_M; + else + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_M); + + switch(new_config->parity) + { + case CYGNUM_SERIAL_PARITY_NONE: + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_PE); + break; + case CYGNUM_SERIAL_PARITY_EVEN: + sccxr |= (cyg_uint16)MPC555_SERIAL_SCCxR1_PE; + sccxr &= ~((cyg_uint16)MPC555_SERIAL_SCCxR1_PT); + break; + case CYGNUM_SERIAL_PARITY_ODD: + sccxr |= (cyg_uint16)MPC555_SERIAL_SCCxR1_PE; + sccxr |= (cyg_uint16)MPC555_SERIAL_SCCxR1_PT; + break; + default: + break; + } + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + + // Set baud rate. + baud_rate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR0_OTHR); + baud_rate &= ~((cyg_uint16)MPC555_SERIAL_SCCxR0_LINKBD); + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR0, sccxr); + sccxr &= ~(MPC555_SERIAL_SCCxR0_SCxBR); + sccxr |= baud_rate; + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR0, sccxr); + + // Enable the device + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + sccxr |= MPC555_SERIAL_SCCxR1_TE; + sccxr |= MPC555_SERIAL_SCCxR1_RE; + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + + if(init) + { // enable the receiver interrupt + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + sccxr |= MPC555_SERIAL_SCCxR1_RIE; + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + } + else // Restore the old interrupt state + { + HAL_READ_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + sccxr |= old_isrstate; + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCCxR1, sccxr); + } + + if(new_config != &chan->config) + chan->config = *new_config; + + return true; +} + +//-------------------------------------------------------------- +// Function to initialize the device. Called at bootstrap time. +//-------------------------------------------------------------- +static hal_mpc5xx_arbitration_data arbiter; + +static bool mpc555_serial_init(struct cyg_devtab_entry * tab) +{ + serial_channel * chan = (serial_channel *)tab->priv; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + if(!mpc555_serial_config_port(chan, &chan->config, true)) + return false; + + (chan->callbacks->serial_init)(chan); // Really only required for interrupt driven devices + if(chan->out_cbuf.len != 0) + { + arbiter.priority = CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI; + arbiter.data = 0; + arbiter.arbiter = hal_arbitration_isr_qsci; + + // Install the arbitration isr, Make sure that is is not installed twice + hal_mpc5xx_remove_arbitration_isr(&arbiter); + hal_mpc5xx_install_arbitration_isr(&arbiter); + + // Create the Tx interrupt, do not enable it yet + cyg_drv_interrupt_create(mpc555_chan->tx_interrupt_num, + mpc555_chan->tx_interrupt_priority, + (cyg_addrword_t)chan, // Data item passed to interrupt handler + mpc555_serial_tx_ISR, + mpc555_serial_tx_DSR, + &mpc555_chan->tx_interrupt_handle, + &mpc555_chan->tx_interrupt); + cyg_drv_interrupt_attach(mpc555_chan->tx_interrupt_handle); + + // Create the Rx interrupt, this can be safely unmasked now + cyg_drv_interrupt_create(mpc555_chan->rx_interrupt_num, + mpc555_chan->rx_interrupt_priority, + (cyg_addrword_t)chan, + mpc555_serial_rx_ISR, + mpc555_serial_rx_DSR, + &mpc555_chan->rx_interrupt_handle, + &mpc555_chan->rx_interrupt); + cyg_drv_interrupt_attach(mpc555_chan->rx_interrupt_handle); + cyg_drv_interrupt_unmask(mpc555_chan->rx_interrupt_num); + } + + return true; +} + +//---------------------------------------------------------------------- +// This routine is called when the device is "looked" up (i.e. attached) +//---------------------------------------------------------------------- +static Cyg_ErrNo mpc555_serial_lookup(struct cyg_devtab_entry ** tab, + struct cyg_devtab_entry * sub_tab, + const char * name) +{ + serial_channel * chan = (serial_channel *)(*tab)->priv; + (chan->callbacks->serial_init)(chan); // Really only required for interrupt driven devices + + return ENOERR; +} + +//---------------------------------------------- +// Send a character to the device output buffer. +// Return 'true' if character is sent to device +//---------------------------------------------- +static bool mpc555_serial_putc(serial_channel * chan, unsigned char c) +{ + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + cyg_addrword_t port = mpc555_chan->base; + + cyg_uint16 scsr; + cyg_uint16 scdr; + + HAL_READ_UINT16(port + MPC555_SERIAL_SCxSR, scsr); + if(scsr & MPC555_SERIAL_SCxSR_TDRE) + { // Ok, we have space, write the character and return success + scdr = (cyg_uint16)c; + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCxDR, scdr); + return true; + } + else + // We cannot write to the transmitter, return failure + return false; +} + +//--------------------------------------------------------------------- +// Fetch a character from the device input buffer, waiting if necessary +//--------------------------------------------------------------------- +static unsigned char mpc555_serial_getc(serial_channel * chan) +{ + unsigned char c; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + cyg_addrword_t port = mpc555_chan->base; + + cyg_uint16 scsr; + cyg_uint16 scdr; + + do { + HAL_READ_UINT16(port + MPC555_SERIAL_SCxSR, scsr); + } while(!(scsr & MPC555_SERIAL_SCxSR_RDRF)); + + // Ok, data is received, read it out and return + HAL_READ_UINT16(port + MPC555_SERIAL_SCxDR, scdr); + c = (unsigned char)scdr; + + return c; +} + +//--------------------------------------------------- +// Set up the device characteristics; baud rate, etc. +//--------------------------------------------------- +static bool mpc555_serial_set_config(serial_channel * chan, cyg_uint32 key, + const void *xbuf, cyg_uint32 * len) +{ + switch(key) { + case CYG_IO_SET_CONFIG_SERIAL_INFO: + { + cyg_serial_info_t *config = (cyg_serial_info_t *)xbuf; + if(*len < sizeof(cyg_serial_info_t)) { + return -EINVAL; + } + *len = sizeof(cyg_serial_info_t); + if(true != mpc555_serial_config_port(chan, config, false)) + return -EINVAL; + } + break; + default: + return -EINVAL; + } + return ENOERR; +} + +//------------------------------------- +// Enable the transmitter on the device +//------------------------------------- +static void mpc555_serial_start_xmit(serial_channel * chan) +{ + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + mpc555_chan->tx_interrupt_enable = true; + cyg_drv_interrupt_unmask(mpc555_chan->tx_interrupt_num); + + // No need to call xmt_char, this will generate an interrupt immediately. +} + +//-------------------------------------- +// Disable the transmitter on the device +//-------------------------------------- +static void mpc555_serial_stop_xmit(serial_channel * chan) +{ + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + cyg_drv_dsr_lock(); + mpc555_chan->tx_interrupt_enable = false; + cyg_drv_interrupt_mask(mpc555_chan->tx_interrupt_num); + cyg_drv_dsr_unlock(); +} + +//----------------------------------------- +// The low level transmit interrupt handler +//----------------------------------------- +static cyg_uint32 mpc555_serial_tx_ISR(cyg_vector_t vector, cyg_addrword_t data) +{ + serial_channel * chan = (serial_channel *)data; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + cyg_drv_interrupt_mask(mpc555_chan->tx_interrupt_num); + cyg_drv_interrupt_acknowledge(mpc555_chan->tx_interrupt_num); + + return CYG_ISR_CALL_DSR; // cause the DSR to run +} + +//---------------------------------------- +// The low level receive interrupt handler +//---------------------------------------- +static cyg_uint32 mpc555_serial_rx_ISR(cyg_vector_t vector, cyg_addrword_t data) +{ + serial_channel * chan = (serial_channel *)data; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + cyg_drv_interrupt_mask(mpc555_chan->rx_interrupt_num); + cyg_drv_interrupt_acknowledge(mpc555_chan->rx_interrupt_num); + + return CYG_ISR_CALL_DSR; // cause the DSR to run +} + +//------------------------------------------ +// The high level transmit interrupt handler +//------------------------------------------ +static void mpc555_serial_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + serial_channel * chan = (serial_channel *)data; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + + (chan->callbacks->xmt_char)(chan); + if(mpc555_chan->tx_interrupt_enable) + cyg_drv_interrupt_unmask(mpc555_chan->tx_interrupt_num); +} + +//----------------------------------------- +// The high level receive interrupt handler +//----------------------------------------- +#define MPC555_SERIAL_SCxSR_ERRORS (MPC555_SERIAL_SCxSR_OR | \ + MPC555_SERIAL_SCxSR_NF | \ + MPC555_SERIAL_SCxSR_FE | \ + MPC555_SERIAL_SCxSR_PF) + +static void mpc555_serial_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + serial_channel * chan = (serial_channel *)data; + mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv; + cyg_addrword_t port = mpc555_chan->base; + cyg_uint16 scdr; + cyg_uint16 scsr; + + // Allways read out the received character, in order to clear receiver flags + HAL_READ_UINT16(port + MPC555_SERIAL_SCxDR, scdr); + + HAL_READ_UINT16(port + MPC555_SERIAL_SCxSR, scsr); + if(scsr & (cyg_uint16)MPC555_SERIAL_SCxSR_ERRORS) + { + scsr &= ~((cyg_uint16)MPC555_SERIAL_SCxSR_ERRORS); + HAL_WRITE_UINT16(port + MPC555_SERIAL_SCxSR, scsr); + } + else + { + (chan->callbacks->rcv_char)(chan, (cyg_uint8)scdr); + } + + cyg_drv_interrupt_unmask(mpc555_chan->rx_interrupt_num); +} + +#endif // CYGPKG_IO_SERIAL_POWERPC_EC555 + +// EOF ec555_serial_with_ints.c diff --git a/packages/devs/serial/powerpc/quicc/current/ChangeLog b/packages/devs/serial/powerpc/quicc/current/ChangeLog --- a/packages/devs/serial/powerpc/quicc/current/ChangeLog +++ b/packages/devs/serial/powerpc/quicc/current/ChangeLog @@ -1186,27 +1186,36 @@ 1999-03-03 Gary Thomas + + * include/sh_sh3_cq7708_sci.inl: Serial register renaming. + +2002-04-23 Jesper Skov + + * include/sh_sh3_cq7708_sci.inl (sh_serial_info): Use variant + register definition for base. + 2000-10-03 Jesper Skov * cdl/ser_sh_cq7708.cdl: Added testing parameters. @@ -25,27 +34,36 @@ 2000-06-23 Jesper Skov 0 diff --git a/packages/devs/serial/sh/edk7708/current/ChangeLog b/packages/devs/serial/sh/edk7708/current/ChangeLog --- a/packages/devs/serial/sh/edk7708/current/ChangeLog +++ b/packages/devs/serial/sh/edk7708/current/ChangeLog @@ -1,3 +1,12 @@ +2002-05-08 Jesper Skov + + * include/sh_sh3_edk7708_sci.inl: Serial register renaming. + +2002-04-23 Jesper Skov + + * include/sh_sh3_edk7708_sci.inl (sh_serial_info): Use variant + register definition for base. + 2000-10-03 Jesper Skov * cdl/ser_sh_edk7708.cdl: Added testing parameters. @@ -1167,27 +1176,36 @@ 1999-03-03 Gary Thomas 0 diff --git a/packages/devs/serial/sh/sci/current/ChangeLog b/packages/devs/serial/sh/sci/current/ChangeLog --- a/packages/devs/serial/sh/sci/current/ChangeLog +++ b/packages/devs/serial/sh/sci/current/ChangeLog @@ -1,3 +1,12 @@ +2002-05-08 Jesper Skov + + * src/sh_sci_serial.c: Register renaming. + +2002-04-23 Jesper Skov + + * src/sh_sci_serial.c: Compute register offsets from register + definitions. Don't define SCI base. + 2001-02-26 Jesper Skov * src/sh_sci_serial.c (sh_serial_er_DSR): Enable interrupts on @@ -119,27 +128,36 @@ 1999-05-24 Jesper Skov ctrl_base+SCI_SCSMR, _smr); // Set baud rate. - _smr &= ~CYGARC_REG_SCSMR_CKSx_MASK; + _smr &= ~CYGARC_REG_SCI_SCSMR_CKSx_MASK; _smr |= baud_divisor >> 8; HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSMR, _smr); HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCBRR, baud_divisor & 0xff); @@ -217,13 +235,13 @@ sh_serial_config_port(serial_channel *ch if (init) { // Always enable transmitter and receiver. - _scr = CYGARC_REG_SCSCR_TE | CYGARC_REG_SCSCR_RE; + _scr = CYGARC_REG_SCI_SCSCR_TE | CYGARC_REG_SCI_SCSCR_RE; if (chan->out_cbuf.len != 0) - _scr |= CYGARC_REG_SCSCR_TIE; // enable tx interrupts + _scr |= CYGARC_REG_SCI_SCSCR_TIE; // enable tx interrupts if (chan->in_cbuf.len != 0) - _scr |= CYGARC_REG_SCSCR_RIE; // enable rx interrupts + _scr |= CYGARC_REG_SCI_SCSCR_RIE; // enable rx interrupts } HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); @@ -307,12 +325,12 @@ sh_serial_putc(serial_channel *chan, uns sh_sci_info *sh_chan = (sh_sci_info *)chan->dev_priv; HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSSR, _ssr); - if (_ssr & CYGARC_REG_SCSSR_TDRE) { + if (_ssr & CYGARC_REG_SCI_SCSSR_TDRE) { // Transmit buffer is empty HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCTDR, c); // Clear empty flag. HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSSR, - CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_TDRE); + CYGARC_REG_SCI_SCSSR_CLEARMASK & ~CYGARC_REG_SCI_SCSSR_TDRE); return true; } else { // No space @@ -330,13 +348,13 @@ sh_serial_getc(serial_channel *chan) do { HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSSR, _ssr); - } while ((_ssr & CYGARC_REG_SCSSR_RDRF) == 0); + } while ((_ssr & CYGARC_REG_SCI_SCSSR_RDRF) == 0); HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCRDR, c); // Clear buffer full flag. HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSSR, - CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_RDRF); + CYGARC_REG_SCI_SCSSR_CLEARMASK & ~CYGARC_REG_SCI_SCSSR_RDRF); return c; } @@ -379,7 +397,7 @@ sh_serial_start_xmit(serial_channel *cha cyg_drv_interrupt_mask(sh_chan->rx_int_num); HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); - _scr |= CYGARC_REG_SCSCR_TIE; // Enable xmit interrupt + _scr |= CYGARC_REG_SCI_SCSCR_TIE; // Enable xmit interrupt HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); cyg_drv_interrupt_unmask(sh_chan->rx_int_num); @@ -400,7 +418,7 @@ sh_serial_stop_xmit(serial_channel *chan cyg_drv_interrupt_mask(sh_chan->rx_int_num); HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); - _scr &= ~CYGARC_REG_SCSCR_TIE; // Disable xmit interrupt + _scr &= ~CYGARC_REG_SCI_SCSCR_TIE; // Disable xmit interrupt HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); cyg_drv_interrupt_unmask(sh_chan->rx_int_num); @@ -415,7 +433,7 @@ sh_serial_tx_ISR(cyg_vector_t vector, cy cyg_uint8 _scr; HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); - _scr &= ~CYGARC_REG_SCSCR_TIE; // mask out tx interrupts + _scr &= ~CYGARC_REG_SCI_SCSCR_TIE; // mask out tx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); return CYG_ISR_CALL_DSR; // Cause DSR to be run @@ -434,7 +452,7 @@ sh_serial_tx_DSR(cyg_vector_t vector, cy cyg_uint8 _scr; HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); - _scr |= CYGARC_REG_SCSCR_TIE; // unmask tx interrupts + _scr |= CYGARC_REG_SCI_SCSCR_TIE; // unmask tx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); } } @@ -448,7 +466,7 @@ sh_serial_rx_ISR(cyg_vector_t vector, cy cyg_uint8 _scr; HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); - _scr &= ~CYGARC_REG_SCSCR_RIE; // mask rx interrupts + _scr &= ~CYGARC_REG_SCI_SCSCR_RIE; // mask rx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); return CYG_ISR_CALL_DSR; // Cause DSR to be run } @@ -462,18 +480,18 @@ sh_serial_rx_DSR(cyg_vector_t vector, cy cyg_uint8 _ssr, _scr; HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSSR, _ssr); - if (_ssr & CYGARC_REG_SCSSR_RDRF) { + if (_ssr & CYGARC_REG_SCI_SCSSR_RDRF) { cyg_uint8 _c; HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCRDR, _c); // Clear buffer full flag. HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSSR, - CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_RDRF); + CYGARC_REG_SCI_SCSSR_CLEARMASK & ~CYGARC_REG_SCI_SCSSR_RDRF); (chan->callbacks->rcv_char)(chan, _c); } HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); - _scr |= CYGARC_REG_SCSCR_RIE; // unmask rx interrupts + _scr |= CYGARC_REG_SCI_SCSCR_RIE; // unmask rx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); } @@ -490,7 +508,7 @@ sh_serial_er_ISR(cyg_vector_t vector, cy cyg_uint8 _scr; HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); - _scr &= ~CYGARC_REG_SCSCR_RIE; // mask rx interrupts + _scr &= ~CYGARC_REG_SCI_SCSCR_RIE; // mask rx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); return CYG_ISR_CALL_DSR; // Cause DSR to be run } @@ -504,24 +522,24 @@ sh_serial_er_DSR(cyg_vector_t vector, cy cyg_uint8 _ssr, _ssr2, _scr; HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSSR, _ssr); - _ssr2 = CYGARC_REG_SCSSR_CLEARMASK; + _ssr2 = CYGARC_REG_SCI_SCSSR_CLEARMASK; - if (_ssr & CYGARC_REG_SCSSR_ORER) { - _ssr2 &= ~CYGARC_REG_SCSSR_ORER; + if (_ssr & CYGARC_REG_SCI_SCSSR_ORER) { + _ssr2 &= ~CYGARC_REG_SCI_SCSSR_ORER; sh_serial_error_orer++; } - if (_ssr & CYGARC_REG_SCSSR_FER) { - _ssr2 &= ~CYGARC_REG_SCSSR_FER; + if (_ssr & CYGARC_REG_SCI_SCSSR_FER) { + _ssr2 &= ~CYGARC_REG_SCI_SCSSR_FER; sh_serial_error_fer++; } - if (_ssr & CYGARC_REG_SCSSR_PER) { - _ssr2 &= ~CYGARC_REG_SCSSR_PER; + if (_ssr & CYGARC_REG_SCI_SCSSR_PER) { + _ssr2 &= ~CYGARC_REG_SCI_SCSSR_PER; sh_serial_error_per++; } HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSSR, _ssr2); HAL_READ_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); - _scr |= CYGARC_REG_SCSCR_RIE; // unmask rx interrupts + _scr |= CYGARC_REG_SCI_SCSCR_RIE; // unmask rx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCI_SCSCR, _scr); } diff --git a/packages/devs/serial/sh/scif/current/ChangeLog b/packages/devs/serial/sh/scif/current/ChangeLog --- a/packages/devs/serial/sh/scif/current/ChangeLog +++ b/packages/devs/serial/sh/scif/current/ChangeLog @@ -1,3 +1,21 @@ +2002-05-08 Jesper Skov + + * src/sh_scif_serial.c: Added SH2 support. Added break interrupt + support. Added IrDA support. Added async RX/TX support. Added + support for platforms to add config keys and handle flow + control. Register renaming. + + * cdl/ser_sh_scif.cdl: Added async RX/TX and IRDA support. Also + added interface for support of break interrupts. + +2002-01-30 Jesper Skov + + * src/sh_scif_serial.c (sh3_scif_tx_DSR): Stop single-character + transmit if transmitter gets disabled. This does not change the + (output) semantics of the code, but does prevent it from looping + over the full size of the FIFO calling the (inactive) xmt_char + callback. + 2001-02-27 Jesper Skov * src/sh_scif_serial.c (sh3_scif_er_DSR): Clear break flag. @@ -132,27 +150,36 @@ 2000-04-03 Jesper Skov 0) +#ifdef CYGINT_IO_SERIAL_SH_SCIF_DMA cyg_bool dma_enable; // Set if DMA mode cyg_uint32 dma_xmt_cr_flags; // CR flags for DMA mode CYG_WORD dma_xmt_int_num; // DMA xmt completion interrupt @@ -145,54 +188,59 @@ typedef struct sh3_scif_info { cyg_handle_t dma_xmt_interrupt_handle; volatile cyg_bool dma_xmt_running; // expect tx _dma_ interrupts #endif -} sh3_scif_info; +} sh_scif_info; -static bool sh3_scif_init(struct cyg_devtab_entry *tab); -static bool sh3_scif_putc(serial_channel *chan, unsigned char c); -static Cyg_ErrNo sh3_scif_lookup(struct cyg_devtab_entry **tab, +static bool sh_scif_init(struct cyg_devtab_entry *tab); +static bool sh_scif_putc(serial_channel *chan, unsigned char c); +static Cyg_ErrNo sh_scif_lookup(struct cyg_devtab_entry **tab, struct cyg_devtab_entry *sub_tab, const char *name); -static unsigned char sh3_scif_getc(serial_channel *chan); -static Cyg_ErrNo sh3_scif_set_config(serial_channel *chan, cyg_uint32 key, +static unsigned char sh_scif_getc(serial_channel *chan); +static Cyg_ErrNo sh_scif_set_config(serial_channel *chan, cyg_uint32 key, const void *xbuf, cyg_uint32 *len); -static void sh3_scif_start_xmit(serial_channel *chan); -static void sh3_scif_stop_xmit(serial_channel *chan); +static void sh_scif_start_xmit(serial_channel *chan); +static void sh_scif_stop_xmit(serial_channel *chan); -static cyg_uint32 sh3_scif_tx_ISR(cyg_vector_t vector, cyg_addrword_t data); -static void sh3_scif_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, +static cyg_uint32 sh_scif_tx_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void sh_scif_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); -static cyg_uint32 sh3_scif_rx_ISR(cyg_vector_t vector, cyg_addrword_t data); -static void sh3_scif_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, +static cyg_uint32 sh_scif_rx_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void sh_scif_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); -static cyg_uint32 sh3_scif_er_ISR(cyg_vector_t vector, cyg_addrword_t data); -static void sh3_scif_er_DSR(cyg_vector_t vector, cyg_ucount32 count, +static cyg_uint32 sh_scif_er_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void sh_scif_er_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); -#if (CYGINT_IO_SERIAL_SH_SCIF_DMA > 0) -static cyg_uint32 sh3_dma_xmt_ISR(cyg_vector_t vector, cyg_addrword_t data); -static void sh3_dma_xmt_DSR(cyg_vector_t vector, cyg_ucount32 count, - cyg_addrword_t data); +#ifdef CYGINT_IO_SERIAL_SH_SCIF_DMA +static cyg_uint32 sh_dma_xmt_ISR(cyg_vector_t vector, cyg_addrword_t data); +static void sh_dma_xmt_DSR(cyg_vector_t vector, cyg_ucount32 count, + cyg_addrword_t data); #endif -static SERIAL_FUNS(sh3_scif_funs, - sh3_scif_putc, - sh3_scif_getc, - sh3_scif_set_config, - sh3_scif_start_xmit, - sh3_scif_stop_xmit +static SERIAL_FUNS(sh_scif_funs, + sh_scif_putc, + sh_scif_getc, + sh_scif_set_config, + sh_scif_start_xmit, + sh_scif_stop_xmit ); // Get the board specification #include CYGDAT_IO_SERIAL_SH_SCIF_INL +// Allow platform to define handling of additional config keys +#ifndef CYGPRI_DEVS_SH_SCIF_SET_CONFIG_PLF +# define CYGPRI_DEVS_SH_SCIF_SET_CONFIG_PLF +#endif + // Internal function to actually configure the hardware to desired baud rate, // etc. static bool -sh3_scif_config_port(serial_channel *chan, cyg_serial_info_t *new_config, +sh_scif_config_port(serial_channel *chan, cyg_serial_info_t *new_config, bool init) { cyg_uint16 baud_divisor = select_baud[new_config->baud]; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; cyg_uint8 _scr, _smr; cyg_uint16 _sr; CYG_ADDRWORD base = sh_chan->ctrl_base; @@ -211,37 +259,90 @@ sh3_scif_config_port(serial_channel *cha // Reset FIFO. HAL_WRITE_UINT8(base+SCIF_SCFCR, - CYGARC_REG_SCFCR2_TFRST|CYGARC_REG_SCFCR2_RFRST); + CYGARC_REG_SCIF_SCFCR_TFRST|CYGARC_REG_SCIF_SCFCR_RFRST); - // Set databits, stopbits and parity. - _smr = select_word_length[(new_config->word_length - - CYGNUM_SERIAL_WORD_LENGTH_5)] | - select_stop_bits[new_config->stop] | - select_parity[new_config->parity]; +#ifdef CYGINT_IO_SERIAL_SH_SCIF_ASYNC_RXTX + sh_chan->async_rxtx_mode = false; +#endif +#ifdef CYGINT_IO_SERIAL_SH_SCIF_IRDA + if (sh_chan->irda_mode) { + // In IrDA mode, the configuration is hardwired and the mode + // bits should not be set +#ifdef CYGARC_REG_SCIF_SCSMR_IRMOD + _smr = CYGARC_REG_SCIF_SCSMR_IRMOD; +#elif defined(SCIF_SCIMR) + _smr = 0; + HAL_WRITE_UINT8(base+SCIF_SCIMR, CYGARC_REG_SCIF_SCIMR_IRMOD); +#endif + } else +#endif + { + // Set databits, stopbits and parity. + _smr = select_word_length[(new_config->word_length - + CYGNUM_SERIAL_WORD_LENGTH_5)] | + select_stop_bits[new_config->stop] | + select_parity[new_config->parity]; +#ifdef CYGINT_IO_SERIAL_SH_SCIF_IRDA +#ifdef SCIF_SCIMR + // Disable IrDA mode + HAL_WRITE_UINT8(base+SCIF_SCIMR, 0); +#endif +#endif + } HAL_WRITE_UINT8(base+SCIF_SCSMR, _smr); // Set baud rate. - _smr &= ~CYGARC_REG_SCSMR2_CKSx_MASK; + _smr &= ~CYGARC_REG_SCIF_SCSMR_CKSx_MASK; _smr |= baud_divisor >> 8; HAL_WRITE_UINT8(base+SCIF_SCSMR, _smr); HAL_WRITE_UINT8(base+SCIF_SCBRR, baud_divisor & 0xff); // FIXME: Should delay 1/ second here. - // Clear the status register (clear first). + // Clear the status register (read first). HAL_READ_UINT16(base+SCIF_SCSSR, _sr); HAL_WRITE_UINT16(base+SCIF_SCSSR, 0); // Bring FIFO out of reset and set FIFO trigger marks + // + // Note that the RX FIFO size must be smaller when flow control is + // enabled. This due to observations made by running the flow2 + // serial test. The automatic RTS de-assertion happens + // (apparently) when the FIFO fills past the trigger count - + // causing the sender to stop transmission. But there's a lag + // before transmission is stopped, and if the FIFO fills in that + // time, data will be lost. Thus, seeing as HW flow control is + // presumed used for prevention of data loss, set the trigger + // level so the sender has time to stop transmission before the + // FIFO fills up. + // + // The trigger setting of 8 allows test flow2 to complete without + // problems. It tests duplex data transmission at 115200 + // baud. Depending on the lag time between the de-assertion of RTS + // and actual transmission stop, it may be necessary to reduce the + // trigger level further. +#ifdef CYGOPT_IO_SERIAL_FLOW_CONTROL_HW HAL_WRITE_UINT8(base+SCIF_SCFCR, - CYGARC_REG_SCFCR2_RTRG_14|CYGARC_REG_SCFCR2_TTRG_8); + CYGARC_REG_SCIF_SCFCR_RTRG_8|CYGARC_REG_SCIF_SCFCR_TTRG_8); +#else + HAL_WRITE_UINT8(base+SCIF_SCFCR, + CYGARC_REG_SCIF_SCFCR_RTRG_14|CYGARC_REG_SCIF_SCFCR_TTRG_8); +#endif if (init) { - // Always enable transmitter and receiver. - _scr = CYGARC_REG_SCSCR2_TE | CYGARC_REG_SCSCR2_RE; + // Always enable received and (for normal mode) transmitter + _scr = CYGARC_REG_SCIF_SCSCR_TE | CYGARC_REG_SCIF_SCSCR_RE; +#ifdef CYGINT_IO_SERIAL_SH_SCIF_ASYNC_RXTX + if (sh_chan->async_rxtx_mode) + _scr = CYGARC_REG_SCIF_SCSCR_RE; +#endif +#ifdef CYGINT_IO_SERIAL_SH_SCIF_IRDA + if (sh_chan->irda_mode) + _scr = CYGARC_REG_SCIF_SCSCR_RE; +#endif if (chan->in_cbuf.len != 0) - _scr |= CYGARC_REG_SCSCR2_RIE; // enable rx interrupts + _scr |= CYGARC_REG_SCIF_SCSCR_RIE; // enable rx interrupts } HAL_WRITE_UINT8(base+SCIF_SCSCR, _scr); @@ -254,10 +355,10 @@ sh3_scif_config_port(serial_channel *cha // Function to initialize the device. Called at bootstrap time. static bool -sh3_scif_init(struct cyg_devtab_entry *tab) +sh_scif_init(struct cyg_devtab_entry *tab) { serial_channel *chan = (serial_channel *)tab->priv; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; #ifdef CYGDBG_IO_INIT diag_printf("SH SERIAL init - dev: %x.%d\n", sh_chan->ctrl_base, sh_chan->rx_int_num); @@ -269,8 +370,8 @@ sh3_scif_init(struct cyg_devtab_entry *t cyg_drv_interrupt_create(sh_chan->tx_int_num, 3, (cyg_addrword_t)chan, // Data item passed to interrupt handler - sh3_scif_tx_ISR, - sh3_scif_tx_DSR, + sh_scif_tx_ISR, + sh_scif_tx_DSR, &sh_chan->serial_tx_interrupt_handle, &sh_chan->serial_tx_interrupt); cyg_drv_interrupt_attach(sh_chan->serial_tx_interrupt_handle); @@ -282,8 +383,8 @@ sh3_scif_init(struct cyg_devtab_entry *t cyg_drv_interrupt_create(sh_chan->rx_int_num, 3, (cyg_addrword_t)chan, // Data item passed to interrupt handler - sh3_scif_rx_ISR, - sh3_scif_rx_DSR, + sh_scif_rx_ISR, + sh_scif_rx_DSR, &sh_chan->serial_rx_interrupt_handle, &sh_chan->serial_rx_interrupt); cyg_drv_interrupt_attach(sh_chan->serial_rx_interrupt_handle); @@ -291,21 +392,38 @@ sh3_scif_init(struct cyg_devtab_entry *t cyg_drv_interrupt_create(sh_chan->er_int_num, 3, (cyg_addrword_t)chan, // Data item passed to interrupt handler - sh3_scif_er_ISR, - sh3_scif_er_DSR, + sh_scif_er_ISR, + sh_scif_er_DSR, &sh_chan->serial_er_interrupt_handle, &sh_chan->serial_er_interrupt); cyg_drv_interrupt_attach(sh_chan->serial_er_interrupt_handle); - // This unmasks both interrupt sources. +#ifdef CYGINT_IO_SERIAL_SH_SCIF_BR_INTERRUPT + // Break error interrupt + cyg_drv_interrupt_create(sh_chan->br_int_num, + 3, + (cyg_addrword_t)chan, // Data item passed to interrupt handler + sh_scif_er_ISR, + sh_scif_er_DSR, + &sh_chan->serial_br_interrupt_handle, + &sh_chan->serial_br_interrupt); + cyg_drv_interrupt_attach(sh_chan->serial_br_interrupt_handle); +#endif + // This unmasks all interrupt sources. cyg_drv_interrupt_unmask(sh_chan->rx_int_num); } -#if (CYGINT_IO_SERIAL_SH_SCIF_DMA > 0) +#ifdef CYGINT_IO_SERIAL_SH_SCIF_DMA // Assign DMA channel and interrupt if requested if (sh_chan->dma_enable) { // FIXME: Need a cleaner way to assign DMA channels static int dma_channel = 0; +#if defined(CYGPKG_HAL_SH_SH2) + sh_chan->dma_xmt_int_num = dma_channel+CYGNUM_HAL_INTERRUPT_DMAC0_TE; +#elif defined(CYGPKG_HAL_SH_SH3) sh_chan->dma_xmt_int_num = dma_channel+CYGNUM_HAL_INTERRUPT_DMAC_DEI0; +#else +# error "No interrupt defined for variant" +#endif sh_chan->dma_xmt_base = (dma_channel*0x10)+CYGARC_REG_SAR0; dma_channel++; @@ -315,8 +433,8 @@ sh3_scif_init(struct cyg_devtab_entry *t cyg_drv_interrupt_create(sh_chan->dma_xmt_int_num, 3, (cyg_addrword_t)chan, // Data item passed to interrupt handler - sh3_dma_xmt_ISR, - sh3_dma_xmt_DSR, + sh_dma_xmt_ISR, + sh_dma_xmt_DSR, &sh_chan->dma_xmt_interrupt_handle, &sh_chan->dma_xmt_interrupt); cyg_drv_interrupt_attach(sh_chan->dma_xmt_interrupt_handle); @@ -325,13 +443,13 @@ sh3_scif_init(struct cyg_devtab_entry *t sh_chan->dma_xmt_running = false; #endif // CYGINT_IO_SERIAL_SH_SCIF_DMA - sh3_scif_config_port(chan, &chan->config, true); + sh_scif_config_port(chan, &chan->config, true); return true; } // This routine is called when the device is "looked" up (i.e. attached) static Cyg_ErrNo -sh3_scif_lookup(struct cyg_devtab_entry **tab, +sh_scif_lookup(struct cyg_devtab_entry **tab, struct cyg_devtab_entry *sub_tab, const char *name) { @@ -345,19 +463,19 @@ sh3_scif_lookup(struct cyg_devtab_entry // Send a character to the device output buffer. // Return 'true' if character is sent to device static bool -sh3_scif_putc(serial_channel *chan, unsigned char c) +sh_scif_putc(serial_channel *chan, unsigned char c) { cyg_uint16 _fdr, _sr; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCFDR, _fdr); - if (((_fdr & CYGARC_REG_SCFDR2_TCOUNT_MASK) >> CYGARC_REG_SCFDR2_TCOUNT_shift) < 15) { + if (((_fdr & CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK) >> CYGARC_REG_SCIF_SCFDR_TCOUNT_shift) < 15) { // Transmit FIFO has room for another char HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCFTDR, c); // Clear FIFO-empty/transmit end flags (read back sr first) HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, _sr); HAL_WRITE_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, - CYGARC_REG_SCSSR2_CLEARMASK & ~CYGARC_REG_SCSSR2_TDFE); + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~CYGARC_REG_SCIF_SCSSR_TDFE); return true; } else { // No space @@ -368,29 +486,29 @@ sh3_scif_putc(serial_channel *chan, unsi // Fetch a character from the device input buffer, waiting if necessary // Note: Input is running wo FIFO enabled, so the counter is not checked here. static unsigned char -sh3_scif_getc(serial_channel *chan) +sh_scif_getc(serial_channel *chan) { - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; unsigned char c; cyg_uint16 _sr; do { HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, _sr); - } while ((_sr & CYGARC_REG_SCSSR2_RDF) == 0); + } while ((_sr & CYGARC_REG_SCIF_SCSSR_RDF) == 0); HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCFRDR, c); // Clear buffer full flag (read back first) HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, _sr); HAL_WRITE_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, - CYGARC_REG_SCSSR2_CLEARMASK & ~CYGARC_REG_SCSSR2_RDF); + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~CYGARC_REG_SCIF_SCSSR_RDF); return c; } // Set up the device characteristics; baud rate, etc. static Cyg_ErrNo -sh3_scif_set_config(serial_channel *chan, cyg_uint32 key, +sh_scif_set_config(serial_channel *chan, cyg_uint32 key, const void *xbuf, cyg_uint32 *len) { switch (key) { @@ -401,30 +519,37 @@ sh3_scif_set_config(serial_channel *chan return -EINVAL; } *len = sizeof(cyg_serial_info_t); - if ( true != sh3_scif_config_port(chan, config, false) ) + if ( true != sh_scif_config_port(chan, config, false) ) return -EINVAL; } break; #ifdef CYGOPT_IO_SERIAL_FLOW_CONTROL_HW case CYG_IO_SET_CONFIG_SERIAL_HW_RX_FLOW_THROTTLE: { - // Control RX flow control by disabling/enabling RX interrupt. - // When disabled, FIFO will fill up and clear RTS. - cyg_uint8 _scscr, mask = 0; - sh3_scif_info *ser_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *ser_chan = (sh_scif_info *)chan->dev_priv; cyg_addrword_t base = ser_chan->ctrl_base; cyg_uint8 *f = (cyg_uint8 *)xbuf; if ( *len < *f ) return -EINVAL; - - if ( chan->config.flags & CYGNUM_SERIAL_FLOW_RTSCTS_RX ) - mask |= CYGARC_REG_SCSCR2_RIE; - HAL_READ_UINT8(base+SCIF_SCSCR, _scscr); - if (*f) // we should throttle - _scscr &= ~mask; - else // we should no longer throttle - _scscr |= mask; - HAL_WRITE_UINT8(base+SCIF_SCSCR, _scscr); + + if ( chan->config.flags & CYGNUM_SERIAL_FLOW_RTSCTS_RX ) { + // Control RX RTC/CTS flow control by disabling/enabling + // RX interrupt. When disabled, FIFO will fill up and + // clear RTS. + cyg_uint8 _scscr; + HAL_READ_UINT8(base+SCIF_SCSCR, _scscr); + if (*f) // we should throttle + _scscr &= ~CYGARC_REG_SCIF_SCSCR_RIE; + else // we should no longer throttle + _scscr |= CYGARC_REG_SCIF_SCSCR_RIE; + HAL_WRITE_UINT8(base+SCIF_SCSCR, _scscr); + } +#ifdef CYGHWR_SH_SCIF_FLOW_DSRDTR + if ( chan->config.flags & CYGNUM_SERIAL_FLOW_DSRDTR_RX ) { + // Control RX DSR/DTR flow control via platform specific macro + CYGHWR_SH_SCIF_FLOW_DSRDTR_RX(chan, *f); + } +#endif } break; case CYG_IO_SET_CONFIG_SERIAL_HW_FLOW_CONFIG: @@ -433,17 +558,18 @@ sh3_scif_set_config(serial_channel *chan if ( chan->config.flags & (CYGNUM_SERIAL_FLOW_RTSCTS_RX | CYGNUM_SERIAL_FLOW_RTSCTS_TX )){ cyg_uint8 _scfcr; - sh3_scif_info *ser_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *ser_chan = (sh_scif_info *)chan->dev_priv; cyg_addrword_t base = ser_chan->ctrl_base; cyg_uint8 *f = (cyg_uint8 *)xbuf; HAL_READ_UINT8(base+SCIF_SCFCR, _scfcr); if (*f) // enable RTS/CTS flow control - _scfcr |= CYGARC_REG_SCFCR1_MCE; + _scfcr |= CYGARC_REG_SCIF_SCFCR_MCE; else // disable RTS/CTS flow control - _scfcr &= ~CYGARC_REG_SCFCR1_MCE; + _scfcr &= ~CYGARC_REG_SCIF_SCFCR_MCE; HAL_WRITE_UINT8(base+SCIF_SCFCR, _scfcr); } +#ifndef CYGHWR_SH_SCIF_FLOW_DSRDTR // Clear DSR/DTR flag as it's not supported. if (chan->config.flags & (CYGNUM_SERIAL_FLOW_DSRDTR_RX|CYGNUM_SERIAL_FLOW_DSRDTR_TX)) { @@ -451,9 +577,15 @@ sh3_scif_set_config(serial_channel *chan CYGNUM_SERIAL_FLOW_DSRDTR_TX); return -EINVAL; } +#else + return CYGHWR_SH_SCIF_FLOW_DSRDTR_CONFIG(chan); +#endif } break; #endif + + CYGPRI_DEVS_SH_SCIF_SET_CONFIG_PLF + default: return -EINVAL; } @@ -461,11 +593,11 @@ sh3_scif_set_config(serial_channel *chan } -#if (CYGINT_IO_SERIAL_SH_SCIF_DMA > 0) +#ifdef CYGINT_IO_SERIAL_SH_SCIF_DMA // Must be called with serial interrupts disabled static xmt_req_reply_t -sh3_scif_start_dma_xmt(serial_channel *chan) +sh_scif_start_dma_xmt(serial_channel *chan) { int chars_avail; unsigned char* chars; @@ -475,7 +607,7 @@ sh3_scif_start_dma_xmt(serial_channel *c res = (chan->callbacks->data_xmt_req)(chan, chan->out_cbuf.len, &chars_avail, &chars); if (CYG_XMT_OK == res) { - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; cyg_uint32 dma_base = sh_chan->dma_xmt_base; cyg_uint32 scr; @@ -499,7 +631,7 @@ sh3_scif_start_dma_xmt(serial_channel *c // Enable serial interrupts HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, scr); - scr |= CYGARC_REG_SCSCR2_TIE; + scr |= CYGARC_REG_SCIF_SCSCR_TIE; HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, scr); } @@ -508,9 +640,9 @@ sh3_scif_start_dma_xmt(serial_channel *c // must be called with serial interrupts masked static void -sh3_scif_stop_dma_xmt(serial_channel *chan) +sh_scif_stop_dma_xmt(serial_channel *chan) { - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; cyg_uint32 dma_base = sh_chan->dma_xmt_base; cyg_uint32 cr; @@ -551,15 +683,15 @@ sh3_scif_stop_dma_xmt(serial_channel *ch // Serial xmt DMA completion interrupt handler (ISR) static cyg_uint32 -sh3_dma_xmt_ISR(cyg_vector_t vector, cyg_addrword_t data) +sh_dma_xmt_ISR(cyg_vector_t vector, cyg_addrword_t data) { serial_channel *chan = (serial_channel *)data; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; cyg_uint32 _cr; // mask serial interrupt HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _cr); - _cr &= ~CYGARC_REG_SCSCR2_TIE; // Disable xmit interrupt + _cr &= ~CYGARC_REG_SCIF_SCSCR_TIE; // Disable xmit interrupt HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _cr); // mask DMA interrupt and disable engine @@ -572,32 +704,32 @@ sh3_dma_xmt_ISR(cyg_vector_t vector, cyg // Serial xmt DMA completion interrupt handler (DSR) static void -sh3_dma_xmt_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +sh_dma_xmt_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) { serial_channel *chan = (serial_channel *)data; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; (chan->callbacks->data_xmt_done)(chan, sh_chan->dma_xmt_len); // Try to load the engine again. sh_chan->dma_xmt_running = - (CYG_XMT_OK == sh3_scif_start_dma_xmt(chan)) ? true : false; + (CYG_XMT_OK == sh_scif_start_dma_xmt(chan)) ? true : false; } #endif // CYGINT_IO_SERIAL_SH_SCIF_DMA // Enable the transmitter on the device static void -sh3_scif_start_xmit(serial_channel *chan) +sh_scif_start_xmit(serial_channel *chan) { cyg_uint8 _scr; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; xmt_req_reply_t _block_status = CYG_XMT_DISABLED; if (sh_chan->tx_enabled) return; -#if (CYGINT_IO_SERIAL_SH_SCIF_DMA > 0) +#ifdef CYGINT_IO_SERIAL_SH_SCIF_DMA // Check if the engine is already running. If so, return. Note // that there will never be a race on this flag - the caller of // this function is respecting a per-channel lock. @@ -607,7 +739,7 @@ sh3_scif_start_xmit(serial_channel *chan // but handle the case where the job doesn't start by falling // back to the FIFO/interrupt based code. if (sh_chan->dma_enable) { - _block_status = sh3_scif_start_dma_xmt(chan); + _block_status = sh_scif_start_dma_xmt(chan); CYG_ASSERT(_block_status != CYG_XMT_EMPTY, "start_xmit called with empty buffers!"); sh_chan->dma_xmt_running = @@ -622,7 +754,25 @@ sh3_scif_start_xmit(serial_channel *chan cyg_drv_isr_lock(); { HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); - _scr |= CYGARC_REG_SCSCR2_TIE; // Enable xmit interrupt + _scr |= CYGARC_REG_SCIF_SCSCR_TIE; // Enable xmit interrupt +#ifdef CYGINT_IO_SERIAL_SH_SCIF_IRDA + if (sh_chan->irda_mode) { + // Enable transmitter - this automatically disables + // the receiver in the hardware. Doing it explicitly + // (like for async RX/TX below) causes more spurious + // characters to be read when re-enabling the + // receiver. + _scr |= CYGARC_REG_SCIF_SCSCR_TE; + } +#endif +#ifdef CYGINT_IO_SERIAL_SH_SCIF_ASYNC_RXTX + if (sh_chan->async_rxtx_mode) { + // Enable transmitter + _scr |= CYGARC_REG_SCIF_SCSCR_TE; + // Disable receiver + _scr &= ~CYGARC_REG_SCIF_SCSCR_RE; + } +#endif HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); sh_chan->tx_enabled = true; } @@ -632,10 +782,30 @@ sh3_scif_start_xmit(serial_channel *chan // Disable the transmitter on the device static void -sh3_scif_stop_xmit(serial_channel *chan) +sh_scif_stop_xmit(serial_channel *chan) { cyg_uint8 _scr; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; + + // In IrDA and async mode the transmitter needs to be disabled, so + // wait for transmission to complete within reason: disable it + // after 0.1s + if (0 +#ifdef CYGINT_IO_SERIAL_SH_SCIF_IRDA + || sh_chan->irda_mode +#endif +#if defined(CYGINT_IO_SERIAL_SH_SCIF_ASYNC_RXTX) + || sh_chan->async_rxtx_mode +#endif + ) { + cyg_uint16 sr; + int i = 1000; + do { + HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, sr); + if (sr & CYGARC_REG_SCIF_SCSSR_TEND) break; + HAL_DELAY_US(100); + } while (i-- > 0); + } // Mask interrupts while changing the CR since a rx interrupt or // another thread doing the same in the middle of this would @@ -643,15 +813,42 @@ sh3_scif_stop_xmit(serial_channel *chan) cyg_drv_isr_lock(); { HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); - _scr &= ~CYGARC_REG_SCSCR2_TIE; // Disable xmit interrupt + _scr &= ~CYGARC_REG_SCIF_SCSCR_TIE; // Disable xmit interrupt +#ifdef CYGINT_IO_SERIAL_SH_SCIF_IRDA + if (sh_chan->irda_mode) { +#ifdef CYGHWR_IO_SERIAL_SH_SCIF_IRDA_TXRX_COMPENSATION + // In IrDA mode there will be generated spurious RX + // events when the TX unit is switched on. Eat that + // character. + cyg_uint8 _junk; + cyg_uint16 _sr; + HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCFRDR, _junk); + + // Clear buffer full flag (read back first) + HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, _sr); + HAL_WRITE_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~(CYGARC_REG_SCIF_SCSSR_RDF|CYGARC_REG_SCIF_SCSSR_DR)); +#endif + // Disable transmitter + _scr &= ~CYGARC_REG_SCIF_SCSCR_TE; + } +#endif +#ifdef CYGINT_IO_SERIAL_SH_SCIF_ASYNC_RXTX + if (sh_chan->async_rxtx_mode) { + // Enable receiver again + _scr |= CYGARC_REG_SCIF_SCSCR_RE; + // Disable transmitter + _scr &= ~CYGARC_REG_SCIF_SCSCR_TE; + } +#endif HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); } cyg_drv_isr_unlock(); -#if (CYGINT_IO_SERIAL_SH_SCIF_DMA > 0) +#ifdef CYGINT_IO_SERIAL_SH_SCIF_DMA // If the channel uses DMA, stop the DMA engine. if (sh_chan->dma_xmt_running) - sh3_scif_stop_dma_xmt(chan); + sh_scif_stop_dma_xmt(chan); else // dangling else! #endif // CYGINT_IO_SERIAL_SH_SCIF_DMA sh_chan->tx_enabled = false; @@ -659,14 +856,14 @@ sh3_scif_stop_xmit(serial_channel *chan) // Serial I/O - low level tx interrupt handler (ISR) static cyg_uint32 -sh3_scif_tx_ISR(cyg_vector_t vector, cyg_addrword_t data) +sh_scif_tx_ISR(cyg_vector_t vector, cyg_addrword_t data) { serial_channel *chan = (serial_channel *)data; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; cyg_uint8 _scr; HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); - _scr &= ~CYGARC_REG_SCSCR2_TIE; // mask out tx interrupts + _scr &= ~CYGARC_REG_SCIF_SCSCR_TIE; // mask out tx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); return CYG_ISR_CALL_DSR; // Cause DSR to be run @@ -674,10 +871,10 @@ sh3_scif_tx_ISR(cyg_vector_t vector, cyg // Serial I/O - high level tx interrupt handler (DSR) static void -sh3_scif_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +sh_scif_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) { serial_channel *chan = (serial_channel *)data; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; xmt_req_reply_t _block_status = CYG_XMT_DISABLED; cyg_uint16 _fdr, _sr; int _space, _chars_avail; @@ -690,9 +887,13 @@ sh3_scif_tx_DSR(cyg_vector_t vector, cyg if (!sh_chan->tx_enabled) return; +#ifdef CYGHWR_SH_SCIF_FLOW_DSRDTR + CYGHWR_SH_SCIF_FLOW_DSRDTR_TX(chan); +#endif + // How many chars can we stuff into the FIFO? HAL_READ_UINT16(_base+SCIF_SCFDR, _fdr); - _space = 16 - ((_fdr & CYGARC_REG_SCFDR2_TCOUNT_MASK) >> CYGARC_REG_SCFDR2_TCOUNT_shift); + _space = 16 - ((_fdr & CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK) >> CYGARC_REG_SCIF_SCFDR_TCOUNT_shift); // Try to do the transfer most efficiently _block_status = (chan->callbacks->data_xmt_req)(chan, _space, @@ -711,44 +912,45 @@ sh3_scif_tx_DSR(cyg_vector_t vector, cyg &_chars_avail, &_chars))); } else if (CYG_XMT_DISABLED == _block_status) { - // Transfer char-by-char - while (_space--) + // Transfer char-by-char, but stop if the transmitter + // gets disabled. + while (_space-- && sh_chan->tx_enabled) (chan->callbacks->xmt_char)(chan); } // Clear FIFO-empty/transmit end flags (read back sr first) HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, _sr); HAL_WRITE_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, - CYGARC_REG_SCSSR2_CLEARMASK & ~CYGARC_REG_SCSSR2_TDFE); + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~CYGARC_REG_SCIF_SCSSR_TDFE); if (sh_chan->tx_enabled) { cyg_uint8 _scr; HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); - _scr |= CYGARC_REG_SCSCR2_TIE; // unmask tx interrupts + _scr |= CYGARC_REG_SCIF_SCSCR_TIE; // unmask tx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); } } // Serial I/O - low level RX interrupt handler (ISR) static cyg_uint32 -sh3_scif_rx_ISR(cyg_vector_t vector, cyg_addrword_t data) +sh_scif_rx_ISR(cyg_vector_t vector, cyg_addrword_t data) { serial_channel *chan = (serial_channel *)data; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; cyg_uint8 _scr; HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); - _scr &= ~CYGARC_REG_SCSCR2_RIE; // mask rx interrupts + _scr &= ~CYGARC_REG_SCIF_SCSCR_RIE; // mask rx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); return CYG_ISR_CALL_DSR; // Cause DSR to be run } // Serial I/O - high level rx interrupt handler (DSR) static void -sh3_scif_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +sh_scif_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) { serial_channel *chan = (serial_channel *)data; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; cyg_uint8 _scr; cyg_uint16 _fdr, _sr; int _avail, _space_avail; @@ -758,103 +960,118 @@ sh3_scif_rx_DSR(cyg_vector_t vector, cyg HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCFDR, _fdr); HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, _sr); - _avail = _fdr & CYGARC_REG_SCFDR2_RCOUNT_MASK; - CYG_ASSERT(_avail > 0, "No data to be read in RX DSR"); - - _block_status = (chan->callbacks->data_rcv_req)(chan, _avail, - &_space_avail, &_space); - if (CYG_RCV_OK == _block_status) { - // Transfer the data in block(s). - do { - int i = _space_avail; - while(i--) { + _avail = _fdr & CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK; + if (_avail > 0) { + _block_status = (chan->callbacks->data_rcv_req)(chan, _avail, + &_space_avail, &_space); + if (CYG_RCV_OK == _block_status) { + // Transfer the data in block(s). + do { + int i = _space_avail; + while(i--) { + cyg_uint8 _c; + HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCFRDR, _c); + *_space++ = _c; + _avail--; + } + (chan->callbacks->data_rcv_done)(chan, _space_avail); + } while (_avail > 0 && + (CYG_RCV_OK == (chan->callbacks->data_rcv_req)(chan, _avail, + &_space_avail, + &_space))); + } else { + // Transfer the data char-by-char both for CYG_RCV_FULL + // and CYG_RCV_DISABLED, leaving all policy decisions with + // the IO driver. + while(_avail--) { cyg_uint8 _c; HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCFRDR, _c); - *_space++ = _c; - _avail--; + (chan->callbacks->rcv_char)(chan, _c); } - (chan->callbacks->data_rcv_done)(chan, _space_avail); - } while (_avail > 0 && - (CYG_RCV_OK == (chan->callbacks->data_rcv_req)(chan, _avail, - &_space_avail, - &_space))); + } } else { - // Transfer the data char-by-char both for CYG_RCV_FULL and - // CYG_RCV_DISABLED, leaving all policy decisions with the IO - // driver. - while(_avail--) { - cyg_uint8 _c; - HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCFRDR, _c); - (chan->callbacks->rcv_char)(chan, _c); - } + CYG_ASSERT(_avail > 0, "No data to be read in RX DSR"); } // Clear buffer full flag (read back first) HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, _sr); HAL_WRITE_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, - CYGARC_REG_SCSSR2_CLEARMASK & ~(CYGARC_REG_SCSSR2_RDF|CYGARC_REG_SCSSR2_DR)); + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~(CYGARC_REG_SCIF_SCSSR_RDF|CYGARC_REG_SCIF_SCSSR_DR)); HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); - _scr |= CYGARC_REG_SCSCR2_RIE; // unmask rx interrupts + _scr |= CYGARC_REG_SCIF_SCSCR_RIE; // unmask rx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); } // Serial I/O - low level error interrupt handler (ISR) static cyg_uint32 -sh3_scif_er_ISR(cyg_vector_t vector, cyg_addrword_t data) +sh_scif_er_ISR(cyg_vector_t vector, cyg_addrword_t data) { serial_channel *chan = (serial_channel *)data; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; cyg_uint8 _scr; HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); - _scr &= ~CYGARC_REG_SCSCR2_RIE; // mask rx interrupts + _scr &= ~CYGARC_REG_SCIF_SCSCR_RIE; // mask rx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); return CYG_ISR_CALL_DSR; // Cause DSR to be run } // Serial I/O - high level error interrupt handler (DSR) static void -sh3_scif_er_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +sh_scif_er_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) { serial_channel *chan = (serial_channel *)data; - sh3_scif_info *sh_chan = (sh3_scif_info *)chan->dev_priv; - cyg_uint16 _ssr, _ssr2; + sh_scif_info *sh_chan = (sh_scif_info *)chan->dev_priv; + cyg_uint16 _ssr, _ssr_mask; +#ifdef SCIF_SC2SSR + cyg_uint8 _ssr2; +#endif cyg_uint8 _scr; #ifdef CYGOPT_IO_SERIAL_SUPPORT_LINE_STATUS cyg_serial_line_status_t stat; #endif HAL_READ_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, _ssr); - _ssr2 = CYGARC_REG_SCSSR2_CLEARMASK; + _ssr_mask = CYGARC_REG_SCIF_SCSSR_CLEARMASK; // Clear the ER bit - _ssr2 &= ~CYGARC_REG_SCSSR2_ER; + _ssr_mask &= ~CYGARC_REG_SCIF_SCSSR_ER; + - if (_ssr & CYGARC_REG_SCSSR2_FER) { - // _ssr2 &= ~CYGARC_REG_SCSSR2_FER; // FER is read-only +#ifdef SCIF_SC2SSR + HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SC2SSR, _ssr2); + if (_ssr2 & CYGARC_REG_SCIF_SC2SSR_ORER) { + _ssr2 &= ~CYGARC_REG_SCIF_SC2SSR_ORER; + HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SC2SSR, _ssr2); + stat.which = CYGNUM_SERIAL_STATUS_OVERRUNERR; + (chan->callbacks->indicate_status)(chan, &stat ); + } +#endif + if (_ssr & CYGARC_REG_SCIF_SCSSR_FER) { + // _ssr_mask &= ~CYGARC_REG_SCIF_SCSSR_FER; // FER is read-only #ifdef CYGOPT_IO_SERIAL_SUPPORT_LINE_STATUS stat.which = CYGNUM_SERIAL_STATUS_FRAMEERR; (chan->callbacks->indicate_status)(chan, &stat ); #endif } - if (_ssr & CYGARC_REG_SCSSR2_PER) { - // _ssr2 &= ~CYGARC_REG_SCSSR2_PER; // PER is read-only + if (_ssr & CYGARC_REG_SCIF_SCSSR_PER) { + // _ssr_mask &= ~CYGARC_REG_SCIF_SCSSR_PER; // PER is read-only #ifdef CYGOPT_IO_SERIAL_SUPPORT_LINE_STATUS stat.which = CYGNUM_SERIAL_STATUS_PARITYERR; (chan->callbacks->indicate_status)(chan, &stat ); #endif } - if (_ssr & CYGARC_REG_SCSSR2_BRK) { - _ssr2 &= ~CYGARC_REG_SCSSR2_BRK; + if (_ssr & CYGARC_REG_SCIF_SCSSR_BRK) { + _ssr_mask &= ~CYGARC_REG_SCIF_SCSSR_BRK; #ifdef CYGOPT_IO_SERIAL_SUPPORT_LINE_STATUS stat.which = CYGNUM_SERIAL_STATUS_BREAK; (chan->callbacks->indicate_status)(chan, &stat ); #endif } - HAL_WRITE_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, _ssr2); + HAL_WRITE_UINT16(sh_chan->ctrl_base+SCIF_SCSSR, _ssr_mask); HAL_READ_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); - _scr |= CYGARC_REG_SCSCR2_RIE; // unmask rx interrupts + _scr |= CYGARC_REG_SCIF_SCSCR_RIE; // unmask rx interrupts HAL_WRITE_UINT8(sh_chan->ctrl_base+SCIF_SCSCR, _scr); } diff --git a/packages/devs/serial/sh/se77x9/current/ChangeLog b/packages/devs/serial/sh/se77x9/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/serial/sh/se77x9/current/ChangeLog @@ -0,0 +1,48 @@ +2002-05-08 Jesper Skov + + * include/sh_sh3_se77x9_scif.inl: CYGINT_IO_SERIAL_SH_SCIF_DMA is + now booldata. Rename sh3_scif to sh_scif. Register renaming. + +2001-06-19 Jesper Skov + + * cdl/ser_sh_se77x9.cdl: Disable COM1 driver for now since it + breaks eCos. + +2001-06-18 Jesper Skov + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/serial/sh/se77x9/current/cdl/ser_sh_se77x9.cdl b/packages/devs/serial/sh/se77x9/current/cdl/ser_sh_se77x9.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/sh/se77x9/current/cdl/ser_sh_se77x9.cdl @@ -0,0 +1,196 @@ +# ==================================================================== +# +# ser_sh_se77x9.cdl +# +# eCos serial SH/SE77X9 configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: +# Date: 2001-06-18 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + + +cdl_package CYGPKG_IO_SERIAL_SH_SE77X9 { + display "SH3 SE77X9 serial device drivers" + + parent CYGPKG_IO_SERIAL_DEVICES + active_if CYGPKG_IO_SERIAL + active_if CYGPKG_HAL_SH_SH77X9_SE77X9 + + requires CYGPKG_ERROR + include_dir cyg/io + + description " + This option enables the serial device drivers for the + Hitachi SH3 SE77X9 board, based on the generic SH SCI driver." + + doc redirect/ecos-device-drivers.html + + + # FIXME: This really belongs in the SH_SCIF package + cdl_interface CYGINT_IO_SERIAL_SH_SCIF_REQUIRED { + display "SH SCI driver required" + } + + # FIXME: This really belongs in the GENERIC_16X5X package + cdl_interface CYGINT_IO_SERIAL_GENERIC_16X5X_REQUIRED { + display "Generic 16x5x serial driver required" + } + + define_proc { + puts $::cdl_system_header "/***** serial driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_GENERIC_16X5X_INL " + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_GENERIC_16X5X_CFG " + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_SH_SCIF_INL " + puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_SH_SCIF_CFG " + puts $::cdl_system_header "/***** serial driver proc output end *****/" + } + + cdl_component CYGPKG_IO_SERIAL_SH_SE77X9_COM1 { + display "SH SE77X9 serial 1 driver (SuperIO)" + flavor bool + calculated 0 + description " + This option includes the serial device driver for the COM1 + port. FIXME: Disabled due to being broken." + + implements CYGINT_IO_SERIAL_GENERIC_16X5X_REQUIRED + implements CYGINT_IO_SERIAL_FLOW_CONTROL_HW + implements CYGINT_IO_SERIAL_LINE_STATUS_HW + + cdl_option CYGDAT_IO_SERIAL_SH_SE77X9_COM1_NAME { + display "Device name for COM1" + flavor data + default_value {"\"/dev/ser1\""} + description " + This option specifies the device name for COM1." + } + + cdl_option CYGNUM_IO_SERIAL_SH_SE77X9_COM1_BAUD { + display "Baud rate for COM1" + flavor data + legal_values { 4800 9600 14400 19200 38400 57600 115200 } + default_value 38400 + description " + This option specifies the default baud rate (speed) + for the COM1 port." + } + + cdl_option CYGNUM_IO_SERIAL_SH_SE77X9_COM1_BUFSIZE { + display "Buffer size for COM1" + flavor data + legal_values 0 to 8192 + default_value 128 + description " + This option specifies the size of the internal buffers + used for the COM1 port." + } + } + + # SCIF port + cdl_component CYGPKG_IO_SERIAL_SH_SE77X9_COM2 { + display "SE77X9 serial, SCIF port 2 driver" + flavor bool + default_value 1 + description " + This option includes the serial device driver for SCIF + port 2." + + implements CYGINT_IO_SERIAL_SH_SCIF_REQUIRED + implements CYGINT_IO_SERIAL_FLOW_CONTROL_HW + implements CYGINT_IO_SERIAL_LINE_STATUS_HW + + cdl_option CYGDAT_IO_SERIAL_SH_SE77X9_COM2_NAME { + display "Device name" + flavor data + default_value {"\"/dev/ser2\""} + description " + This option specifies the device name for the serial + port." + } + + cdl_option CYGNUM_IO_SERIAL_SH_SE77X9_COM2_BAUD { + display "Baud rate" + flavor data + legal_values { 4800 9600 14400 19200 38400 57600 115200 } + default_value 38400 + description " + This option specifies the default baud rate (speed) + for the serial driver." + } + + cdl_option CYGNUM_IO_SERIAL_SH_SE77X9_COM2_BUFSIZE { + display "Buffer size" + flavor data + legal_values 0 to 8192 + default_value 128 + description " + This option specifies the size of the internal buffers + used for the serial driver." + } + + cdl_option CYGSEM_IO_SERIAL_SH_SE77X9_COM2_DMA { + display "Enable SCIF serial driver DMA" + active_if CYGINT_HAL_SH_DMA_CHANNELS + implements CYGINT_HAL_SH_DMA_CHANNELS_USED + implements CYGINT_IO_SERIAL_SH_SCIF_DMA + default_value 1 + description " + Enable DMA for this port." + } + } + + cdl_component CYGPKG_IO_SERIAL_SH_SE77X9_TESTING { + display "Testing parameters" + flavor bool + calculated 1 + no_define + active_if CYGPKG_IO_SERIAL_SH_SE77X9_COM2 + + define_proc { + puts $::cdl_header "#define CYGPRI_SER_TEST_CRASH_ID \"sh-se77x9\"" + puts $::cdl_header "#define CYGPRI_SER_TEST_SER_DEV CYGDAT_IO_SERIAL_SH_SE77X9_COM2_NAME" + puts $::cdl_header "#define CYGPRI_SER_TEST_TTY_DEV \"/dev/tty2\"" + } + } +} +# EOF ser_sh_se77x9.cdl diff --git a/packages/devs/serial/sh/se77x9/current/include/sh_sh3_se77x9_16x5x.inl b/packages/devs/serial/sh/se77x9/current/include/sh_sh3_se77x9_16x5x.inl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/sh/se77x9/current/include/sh_sh3_se77x9_16x5x.inl @@ -0,0 +1,124 @@ +#ifndef CYGONCE_DEVS_SH_SE77X9_16X5X_H +#define CYGONCE_DEVS_SH_SE77X9_16X5X_H + +//========================================================================== +// +// io/serial/sh/sh_sh3_se77x9_16x5x.inl +// +// Serial I/O specification for Hitachi SE77X9 platform. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-18 +// Purpose: Specifies serial resources for the platform. +// Description: This file can be include from the 16x5x driver sources. +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include + +//----------------------------------------------------------------------------- +// Baud rate specification, based on raw 1.8462MHz clock (/16) + +static unsigned short select_baud[] = { + 0, // Unused + 2307, // 50 + 1538, // 75 + 1048, // 110 + 857, // 134.5 + 769, // 150 + 576, // 200 + 384, // 300 + 192, // 600 + 96, // 1200 + 64, // 1800 + 48, // 2400 + 32, // 3600 + 24, // 4800 + 16, // 7200 + 12, // 9600 + 8, // 14400 + 6, // 19200 + 3, // 38400 + 2, // 57600 + 1, // 115200 + 0, // 230400 +}; + +#ifdef CYGPKG_IO_SERIAL_SH_SE77X9_COM1 +static pc_serial_info se77x9_serial_info1 = {0xb04007f0, CYGNUM_HAL_INTERRUPT_COM1}; +#if CYGNUM_IO_SERIAL_SH_SE77X9_COM1_BUFSIZE > 0 +static unsigned char se77x9_serial_out_buf1[CYGNUM_IO_SERIAL_SH_SE77X9_COM1_BUFSIZE]; +static unsigned char se77x9_serial_in_buf1[CYGNUM_IO_SERIAL_SH_SE77X9_COM1_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(se77x9_serial_channel1, + pc_serial_funs, + se77x9_serial_info1, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_SH_SE77X9_COM1_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &se77x9_serial_out_buf1[0], sizeof(se77x9_serial_out_buf1), + &se77x9_serial_in_buf1[0], sizeof(se77x9_serial_in_buf1) + ); +#else +static SERIAL_CHANNEL(se77x9_serial_channel1, + pc_serial_funs, + se77x9_serial_info1, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_SH_SE77X9_COM1_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT + ); +#endif + +DEVTAB_ENTRY(se77x9_serial_io1, + CYGDAT_IO_SERIAL_SH_SE77X9_COM1_NAME, + 0, // Does not depend on a lower level interface + &cyg_io_serial_devio, + pc_serial_init, + pc_serial_lookup, // Serial driver may need initializing + &se77x9_serial_channel1 + ); +#endif // CYGPKG_IO_SERIAL_SH_SE77X9_COM1 + +#endif // CYGONCE_DEVS_SH_SE77X9_SCIF_H diff --git a/packages/devs/serial/sh/se77x9/current/include/sh_sh3_se77x9_scif.inl b/packages/devs/serial/sh/se77x9/current/include/sh_sh3_se77x9_scif.inl new file mode 100644 --- /dev/null +++ b/packages/devs/serial/sh/se77x9/current/include/sh_sh3_se77x9_scif.inl @@ -0,0 +1,114 @@ +#ifndef CYGONCE_DEVS_SH_SE77X9_SCIF_H +#define CYGONCE_DEVS_SH_SE77X9_SCIF_H + +//========================================================================== +// +// io/serial/sh/sh_sh3_se77x9_scif.inl +// +// Serial I/O specification for Hitachi SE77X9 platform. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-18 +// Purpose: Specifies serial resources for the platform. +// Description: This file can be include from either SCI or SCIF/IRDA driver +// sources and should specify driver information as required +// for the platform. +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include + +#ifdef CYGPKG_IO_SERIAL_SH_SE77X9_COM2 +static sh_scif_info se77x9_serial_info2 = { + er_int_num : CYGNUM_HAL_INTERRUPT_SCIF_ERI2, + rx_int_num : CYGNUM_HAL_INTERRUPT_SCIF_RXI2, + tx_int_num : CYGNUM_HAL_INTERRUPT_SCIF_TXI2, + ctrl_base : CYGARC_REG_SCIF_SCSMR2, +#ifdef CYGINT_IO_SERIAL_SH_SCIF_DMA +# ifdef CYGSEM_IO_SERIAL_SH_SE77X9_COM2_DMA + dma_enable : true,// we want DMA for this channel + dma_xmt_cr_flags : CYGARC_REG_CHCR_RS_SCIF_TX +# else + dma_enable : false // No DMA +# endif +#endif +}; + +#if CYGNUM_IO_SERIAL_SH_SE77X9_COM2_BUFSIZE > 0 +static unsigned char se77x9_serial_out_buf2[CYGNUM_IO_SERIAL_SH_SE77X9_COM2_BUFSIZE]; +static unsigned char se77x9_serial_in_buf2[CYGNUM_IO_SERIAL_SH_SE77X9_COM2_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(se77x9_serial_channel2, + sh_scif_funs, + se77x9_serial_info2, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_SH_SE77X9_COM2_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &se77x9_serial_out_buf2[0], + sizeof(se77x9_serial_out_buf2), + &se77x9_serial_in_buf2[0], + sizeof(se77x9_serial_in_buf2) + ); +#else +static SERIAL_CHANNEL(se77x9_serial_channel2, + sh_scif_funs, + se77x9_serial_info2, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_SH_SE77X9_COM2_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT + ); +#endif + +DEVTAB_ENTRY(sh_serial_io2, + CYGDAT_IO_SERIAL_SH_SE77X9_COM2_NAME, + 0, // Does not depend on a lower level interface + &cyg_io_serial_devio, + sh_scif_init, + sh_scif_lookup, // Serial driver may need initializing + &se77x9_serial_channel2 + ); +#endif // CYGPKG_IO_SERIAL_SH_SE77X9_COM2 + +#endif // CYGONCE_DEVS_SH_SE77X9_SCIF_H diff --git a/packages/devs/serial/sparclite/sleb/current/ChangeLog b/packages/devs/serial/sparclite/sleb/current/ChangeLog --- a/packages/devs/serial/sparclite/sleb/current/ChangeLog +++ b/packages/devs/serial/sparclite/sleb/current/ChangeLog @@ -1159,27 +1159,36 @@ 1999-03-03 Gary Thomas + + * src/aaed2000_ts.c: Update scan frequency to 20Hz. + +2002-03-09 Gary Thomas + + * src/aaed2000_ts.c: + * touch_aaed2000.cdl: New files(s). Touch screen driver for AAED2000. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/touch/arm/aaed2000/current/src/aaed2000_ts.c b/packages/devs/touch/arm/aaed2000/current/src/aaed2000_ts.c new file mode 100644 --- /dev/null +++ b/packages/devs/touch/arm/aaed2000/current/src/aaed2000_ts.c @@ -0,0 +1,369 @@ +//========================================================================== +// +// aaed2000_ts.c +// +// Touchscreen driver for the Agilent aaed2000 +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2002-03-05 +// Purpose: +// Description: Touchscreen driver for Agilent AAED2000 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // For select() functionality +static cyg_selinfo ts_select_info; +static cyg_bool ts_select_active; + +#include + +/* ADS7846 flags */ +#define ADS_START (1 << 7) +#define ADS_MEASURE_Y (0x01 << 4) +#define ADS_MEASURE_X (0x05 << 4) +#define ADS_MODE_12_BIT 0 +#define ADS_PD0 0 + +// Misc constants +#define TS_INT (1<<0) +#define X_THRESHOLD 0x80 +#define Y_THRESHOLD 0x80 + +// Functions in this module + +static Cyg_ErrNo ts_read(cyg_io_handle_t handle, + void *buffer, + cyg_uint32 *len); +static cyg_bool ts_select(cyg_io_handle_t handle, + cyg_uint32 which, + cyg_addrword_t info); +static Cyg_ErrNo ts_set_config(cyg_io_handle_t handle, + cyg_uint32 key, + const void *buffer, + cyg_uint32 *len); +static Cyg_ErrNo ts_get_config(cyg_io_handle_t handle, + cyg_uint32 key, + void *buffer, + cyg_uint32 *len); +static bool ts_init(struct cyg_devtab_entry *tab); +static Cyg_ErrNo ts_lookup(struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *st, + const char *name); + +CHAR_DEVIO_TABLE(aaed2000_ts_handlers, + NULL, // Unsupported write() function + ts_read, + ts_select, + ts_get_config, + ts_set_config); + +CHAR_DEVTAB_ENTRY(aaed2000_ts_device, + CYGDAT_DEVS_TOUCH_AAED2000_NAME, + NULL, // Base device name + &aaed2000_ts_handlers, + ts_init, + ts_lookup, + NULL); // Private data pointer + +struct _event { + short button_state; + short xPos, yPos; + short _unused; +}; +#define MAX_EVENTS CYGNUM_DEVS_TOUCH_AAED2000_EVENT_BUFFER_SIZE +static int num_events; +static int _event_put, _event_get; +static struct _event _events[MAX_EVENTS]; + +static bool _is_open = false; +#ifdef DEBUG_RAW_EVENTS +static unsigned char _ts_buf[512]; +static int _ts_buf_ptr = 0; +#endif + +#define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL +static char ts_scan_stack[STACK_SIZE]; +static cyg_thread ts_scan_thread_data; +static cyg_handle_t ts_scan_thread_handle; +#define SCAN_FREQ 20 // Hz +//#define SCAN_FREQ 5 // Hz +#define SCAN_DELAY ((1000/SCAN_FREQ)/10) + + +typedef struct { + short min; + short max; + short span; +} bounds; + +static bounds xBounds = {1024, 0, 1024}; +static bounds yBounds = {1024, 0, 1024}; + +static Cyg_ErrNo +ts_read(cyg_io_handle_t handle, + void *buffer, + cyg_uint32 *len) +{ + struct _event *ev; + int tot = *len; + unsigned char *bp = (unsigned char *)buffer; + + cyg_scheduler_lock(); // Prevent interaction with DSR code + while (tot >= sizeof(struct _event)) { + if (num_events > 0) { + ev = &_events[_event_get++]; + if (_event_get == MAX_EVENTS) { + _event_get = 0; + } + // Self calibrate + if (ev->xPos > xBounds.max) xBounds.max = ev->xPos; + if (ev->xPos < xBounds.min) xBounds.min = ev->xPos; + if (ev->yPos > yBounds.max) yBounds.max = ev->yPos; + if (ev->yPos < yBounds.min) yBounds.min = ev->yPos; + if ((xBounds.span = xBounds.max - xBounds.min) <= 1) { + xBounds.span = 1; + } + if ((yBounds.span = yBounds.max - yBounds.min) <= 1) { + yBounds.span = 1; + } + // Scale values - done here so these potentially lengthy + // operations take place outside of interrupt processing +#ifdef DEBUG + diag_printf("Raw[%d,%d], X[%d,%d,%d], Y[%d,%d,%d]", + ev->xPos, ev->yPos, + xBounds.max, xBounds.min, xBounds.span, + yBounds.max, yBounds.min, yBounds.span); +#endif + ev->xPos = 640 - (((xBounds.max - ev->xPos) * 640) / xBounds.span); + ev->yPos = 480 - (((yBounds.max - ev->yPos) * 480) / yBounds.span); +#ifdef DEBUG + diag_printf(", Cooked[%d,%d]\n", + ev->xPos, ev->yPos); +#endif + memcpy(bp, ev, sizeof(*ev)); + bp += sizeof(*ev); + tot -= sizeof(*ev); + num_events--; + } else { + break; // No more events + } + } + cyg_scheduler_unlock(); // Allow DSRs again + *len -= tot; + return ENOERR; +} + +static cyg_bool +ts_select(cyg_io_handle_t handle, + cyg_uint32 which, + cyg_addrword_t info) +{ + if (which == CYG_FREAD) { + cyg_scheduler_lock(); // Prevent interaction with DSR code + if (num_events > 0) { + cyg_scheduler_unlock(); // Reallow interaction with DSR code + return true; + } + if (!ts_select_active) { + ts_select_active = true; + cyg_selrecord(info, &ts_select_info); + } + cyg_scheduler_unlock(); // Reallow interaction with DSR code + } + return false; +} + +static Cyg_ErrNo +ts_set_config(cyg_io_handle_t handle, + cyg_uint32 key, + const void *buffer, + cyg_uint32 *len) +{ + return EINVAL; +} + +static Cyg_ErrNo +ts_get_config(cyg_io_handle_t handle, + cyg_uint32 key, + void *buffer, + cyg_uint32 *len) +{ + return EINVAL; +} + +static bool +ts_init(struct cyg_devtab_entry *tab) +{ + cyg_uint32 _dummy; + + // Initialize SSP interface +#if 0 + while (*(volatile cyg_uint32 *)AAEC_SSP_SR & AAEC_SSP_SR_RNE) { + _dummy = *(volatile cyg_uint32 *)AAEC_SSP_DR; // Drain FIFO + } +#endif + *(volatile cyg_uint32 *)AAEC_SSP_CR0 = + (1 << AAEC_SSP_CR0_SSE) | // SSP enable + (37 << AAEC_SSP_CR0_SCR) | // Serial clock rate + (AAEC_SSP_CR0_FRF_NAT << AAEC_SSP_CR0_FRF) | // MicroWire + ((12-1) << AAEC_SSP_CR0_SIZE); // 12 bit words + *(volatile cyg_uint32 *)AAEC_SSP_CR1 = + (1 << AAEC_SSP_CR1_FEN); // Enable FIFO + *(volatile cyg_uint32 *)AAEC_SSP_CPSR = 2; // Clock prescale + *(volatile cyg_uint32 *)AAEC_PFDDR &= ~(1<<0); // TS uses port F bit 0 + cyg_drv_interrupt_acknowledge(CYGNUM_HAL_INTERRUPT_TS); + cyg_selinit(&ts_select_info); + return true; +} + +static cyg_uint32 +read_ts(int axis) +{ + cyg_uint32 res; + + *(volatile cyg_uint32 *)AAEC_SSP_DR = (axis | ADS_START | ADS_MODE_12_BIT | ADS_PD0); + *(volatile cyg_uint32 *)AAEC_SSP_DR = (axis | ADS_START | ADS_MODE_12_BIT); + // Wait for data + while ((*(volatile cyg_uint32 *)AAEC_SSP_SR & AAEC_SSP_SR_RNE) == 0); + res = *(volatile cyg_uint32 *)AAEC_SSP_DR; // ignore first datum + // Wait for data + while ((*(volatile cyg_uint32 *)AAEC_SSP_SR & AAEC_SSP_SR_RNE) == 0); + res = *(volatile cyg_uint32 *)AAEC_SSP_DR; + return res; +} + +static void +ts_scan(cyg_addrword_t param) +{ + short lastX, lastY; + short x, y; + struct _event *ev; + bool pen_down; + + diag_printf("Touch Screen thread started\n"); + // Discard the first sample - it's always 0 + x = read_ts(ADS_MEASURE_X); + y = read_ts(ADS_MEASURE_Y); + lastX = lastY = -1; + pen_down = false; + while (true) { + cyg_thread_delay(SCAN_DELAY); + if ((*(volatile cyg_uint32 *)AAEC_PFDR & TS_INT) == 0) { + // Pen is down + x = read_ts(ADS_MEASURE_X); + y = read_ts(ADS_MEASURE_Y); +// diag_printf("X = %x, Y = %x\n", x, y); + if ((x < X_THRESHOLD) || (y < Y_THRESHOLD)) { + // Ignore 'bad' samples + continue; + } + lastX = x; lastY = y; + pen_down = true; + } else { + if (pen_down) { + // Capture first 'up' event + pen_down = false; + x = lastX; + y = lastY; + } else { + continue; // Nothing new to report + } + } + if (num_events < MAX_EVENTS) { + num_events++; + ev = &_events[_event_put++]; + if (_event_put == MAX_EVENTS) { + _event_put = 0; + } + ev->button_state = pen_down ? 0x04 : 0x00; + ev->xPos = x; + ev->yPos = y; + if (ts_select_active) { + ts_select_active = false; + cyg_selwakeup(&ts_select_info); + } + } +#ifdef DEBUG_RAW_EVENTS + memcpy(&_ts_buf[_ts_buf_ptr], pkt->data, 8); + _ts_buf_ptr += 8; + if (_ts_buf_ptr == 512) { + diag_printf("TS handler\n"); + diag_dump_buf(_ts_buf, 512); + _ts_buf_ptr = 0; + } +#endif + } +} + +static Cyg_ErrNo +ts_lookup(struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *st, + const char *name) +{ + if (!_is_open) { + _is_open = true; + cyg_thread_create(1, // Priority + ts_scan, // entry + 0, // entry parameter + "Touch Screen scan", // Name + &ts_scan_stack[0], // Stack + STACK_SIZE, // Size + &ts_scan_thread_handle, // Handle + &ts_scan_thread_data // Thread data structure + ); + cyg_thread_resume(ts_scan_thread_handle); // Start it + } + return ENOERR; +} diff --git a/packages/devs/touch/arm/aaed2000/current/touch_aaed2000.cdl b/packages/devs/touch/arm/aaed2000/current/touch_aaed2000.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/touch/arm/aaed2000/current/touch_aaed2000.cdl @@ -0,0 +1,100 @@ +#========================================================================== +# +# touch_aaed2000.cdl +# +# eCos configuration data for the Agilent AAED2000 touchscreen +# +#========================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +#========================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Contributors: gthomas +# Date: 2002-03-03 +# Purpose: +# Description: Touchscreen drivers for Agilent AAED2000 +# +#####DESCRIPTIONEND#### +# +#========================================================================== + +cdl_package CYGPKG_DEVS_TOUCH_AAED2000 { + display "Touch screen driver for aaed2000" + include_dir cyg/io + + active_if CYGPKG_IO_FILEIO + requires CYGPKG_IO + requires CYGFUN_KERNEL_API_C + requires CYGPKG_HAL_ARM_ARM9_AAED2000 + active_if !CYGSEM_AAED2000_LCD_COMM + + compile -library=libextras.a aaed2000_ts.c + + description "Touch screen driver for the AAED2000" + + cdl_component CYGPKG_DEVS_TOUCH_AAED2000_OPTIONS { + display "options" + flavor none + no_define + + cdl_option CYGPKG_DEVS_TOUCH_AAED2000_CFLAGS { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the touchscreen driver package. These flags + are used in addition to the set of global flags." + } + + cdl_option CYGDAT_DEVS_TOUCH_AAED2000_NAME { + display "Device name for the touch screen driver" + flavor data + default_value {"\"/dev/ts\""} + description " This option specifies the name of the touch screen device" + } + + cdl_option CYGNUM_DEVS_TOUCH_AAED2000_EVENT_BUFFER_SIZE { + display "Number of events the driver can buffer" + flavor data + default_value { 32 } + description " + This option defines the size of the touchscreen device internal + buffer. The cyg_io_read() function will return as many of these + as there is space for in the buffer passed." + } + } +} diff --git a/packages/devs/touch/arm/ipaq/current/ChangeLog b/packages/devs/touch/arm/ipaq/current/ChangeLog --- a/packages/devs/touch/arm/ipaq/current/ChangeLog +++ b/packages/devs/touch/arm/ipaq/current/ChangeLog @@ -20,27 +20,36 @@ 2001-03-05 Gary Thomas + + * src/usbs_upd985xx.c (ep0_init): + During a reset, also reset the tx_in_progress and + tx_pending locks. Otherwise if there are ongoing + transmits while the host is issuing a reset no + further transmits would be possible. + +2001-09-14 Bart Veer + + * src/usbs_upd985xx.c: + Various changes related to USB testing. Also include + potential work-arounds for some unconfirmed hardware + problems, but these are disabled for now. + + * src/usbs_upd985xx.c: + Change how the reset signal interrupt bit gets masked, to + cope with the way Windows initializes a new USB device. + +2001-08-09 Bart Veer + + * doc/usbs_upd985xx.sgml, doc/*.html: + Updated to describe the driver's current behaviour. + + * src/usbs_upd985xx.c, cdl/usbs_upd985xx.cdl: + Implement workaround for some hardware problems, + by serializing transmit operations. + +2001-08-08 Bart Veer + + * cdl/usbs_upd985xx.cdl, include/usbs_upd985xx.h, + src/usbs_upd985xx.c, src/usbs_upd985xx.cxx: + Implement workarounds for some hardware problems. + 1) flush the ibus after every write operation. + 2) implement support for endpoint 5 transfers, and + optionally for emulating bulk transfers over this + endpoint (normally this endpoint is used for interrupt + transfers). + All under the control of suitable configuration options, + which by default are set to work around the hardware problems. + +2001-08-06 Bart Veer + + * src/usbs_upd985xx.c: + Add initial support for USB testing. + +2001-07-02 Bart Veer + + * doc/usbs_upd985xx.sgml: + Document alignment restrictions for receive buffers, and + the optional platform-specific INIT macro. + + * doc/devs-usb-nec-upd985xx.html + Regenerate following above change. + + * src/usbs_upd985xx.c: + Remove FIXME related to cacheline alignment, not an issue + for MIPS. + Remove FIXME related to platform-specific USB startup, + now implemented. + +2001-06-28 Bart Veer + + * src/usbs_upd985xx.c, cdl/usbs_upd985xx.cdl: + Device driver now functional. + +2001-05-22 Bart Veer + + * USB device driver work started. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/usb/nec_upd985xx/current/cdl/usbs_upd985xx.cdl b/packages/devs/usb/nec_upd985xx/current/cdl/usbs_upd985xx.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/usb/nec_upd985xx/current/cdl/usbs_upd985xx.cdl @@ -0,0 +1,265 @@ +# ==================================================================== +# +# usbs_upd985xx.cdl +# +# USB device driver for the NEC uPD985xx family of processors. +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): bartv +# Original data: bartv +# Contributors: +# Date: 2001-05-22 +# +#####DESCRIPTIONEND#### +# ==================================================================== + +cdl_package CYGPKG_DEVS_USB_UPD985XX { + display "NEC uPD985xx USB Device Driver" + include_dir "cyg/io/usb" + parent CYGPKG_USB + implements CYGHWR_IO_USB_SLAVE + doc devs-usb-nec-upd985xx.html + + # Make sure that we are running on the right hardware. + requires CYGPKG_HAL_MIPS + requires CYGPKG_HAL_MIPS_UPD985XX + + description " + The NEC uPD985xx family of processors implements an + on-chip USB device controller, facilitating the use of this + processor in USB peripherals. This package provides a + suitable eCos device driver." + + cdl_component CYGFUN_DEVS_USB_UPD985XX_EP0 { + display "Support the control endpoint 0" + default_value CYGINT_IO_USB_SLAVE_CLIENTS + requires CYGPKG_IO_USB CYGPKG_IO_USB_SLAVE + compile usbs_upd985xx.c + compile -library=libextras.a usbs_upd985xx_data.cxx + description " + Enable support for endpoint 0. If this support is disabled + then the entire USB port is unusable." + + cdl_option CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY { + display "Provide a devtab entry for endpoint 0" + default_value CYGGLO_IO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES + requires CYGPKG_IO + description " + If endpoint 0 will only be accessed via the low-level + USB-specific calls then there is no need for an entry + in the device table, saving some memory. If the + application intends to access the endpoint by means + of open and ioctl calls then a devtab entry is needed. + " + } + + cdl_option CYGNUM_DEVS_USB_UPD985XX_EP0_TXBUFSIZE { + display "Size of statically-allocated endpoint 0 transmit buffer" + flavor data + default_value 256 + description " + The implementation of the support for endpoint 0 uses + a single static buffer to hold the response to the + current control message. Typically this buffer can be + fairly small since replies to control messages tend to + be small: typically some tens of bytes for the enumeration + data, perhaps a bit more for unicode-encoded string + descriptors. However if some application-specific protocol + depends on larger control messages then this buffer + size may need to be increased. + " + } + + cdl_option CYGNUM_DEVS_USB_UPD985XX_EP0_RXBUFSIZE { + display "Size of statically-allocated endpoint 0 transmit buffer" + flavor data + default_value 64 + requires { CYGNUM_DEVS_USB_UPD985XX_EP0_RXBUFSIZE >= 8 } + description " + The implementation of the support for endpoint 0 uses + a single static buffer to hold incoming control messages. + Typically this buffer can be small: standard control messages + involve an initial eight-byte header, sometimes followed by + a small amount of additional data. However if some + application-specific protocol depends on larger control + messages then this buffer size may need to be increased. + " + } + } + cdl_component CYGPKG_DEVS_USB_UPD985XX_EP3 { + display "Support endpoint 3, used for slave->host IN bulk transfers" + implements CYGHWR_IO_USB_SLAVE_IN_ENDPOINTS + requires CYGFUN_DEVS_USB_UPD985XX_EP0 + default_value 0 + description " + In the uPD985xx USB implementation endpoint 3 can only be + used for slave->host IN bulk transfers. If the intended application + only involves host->slave transfers then this endpoint is + not relevant. + + By default this endpoint is disabled: according to NEC erratum + U3 there may be problems when doing transfers of 192 bytes or + greater. Instead the interrupt endpoint 5 is used, with + software emulation of the bulk protocol. If the application + involves only transfers of less than 192 bytes then endpoint + 3 can be enabled. + " + + cdl_option CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY { + display "Provide a devtab entry for endpoint 3" + default_value CYGGLO_IO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES + requires CYGPKG_IO + description " + If endpoint 3 will only be accessed via the low-level + USB-specific calls then there is no need for an entry + in the device table, saving some memory. If the + application intends to access the endpoint by means + of open and read calls then a devtab entry is needed. + " + } + } + + cdl_component CYGPKG_DEVS_USB_UPD985XX_EP4 { + display "Support endpoint 4, used for slave->host OUT bulk transfers" + implements CYGHWR_IO_USB_SLAVE_OUT_ENDPOINTS + requires CYGFUN_DEVS_USB_UPD985XX_EP0 + default_value CYGFUN_DEVS_USB_UPD985XX_EP0 + description " + In the uPD985xx USB implementation endpoint 4 can only be + used for host->slave OUT bulk transfers. If the intended application + only involves slave->host transfers then the support for + endpoint 4 can be disabled. Note that this does not affect + control messages which always go via endpoint 0." + + cdl_option CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY { + display "Provide a devtab entry for endpoint 4" + default_value CYGGLO_IO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES + requires CYGPKG_IO + description " + If endpoint 4 will only be accessed via the low-level + USB-specific calls then there is no need for an entry + in the device table, saving some memory. If the + application intends to access the endpoint by means + of open and write calls then a devtab entry is needed." + } + } + + cdl_component CYGPKG_DEVS_USB_UPD985XX_EP5 { + display "Support endpoint 5, used for slave->host IN transfers" + implements CYGHWR_IO_USB_SLAVE_IN_ENDPOINTS + requires CYGFUN_DEVS_USB_UPD985XX_EP0 + default_value CYGFUN_DEVS_USB_UPD985XX_EP0 + description " + In the uPD985xx USB implementation endpoint 5 can only be + used for slave->host communication. This endpoint is + intended primarily for interrupt transfers, but can be + used for bulk transfers given a small amount of additional + software support." + + cdl_option CYGIMP_DEVS_USB_UPD985XX_EP5_BULK { + display "Implement bulk transfers rather than interrupt transfers" + default_value 1 + description " + Endpoint 5 is normally used for interrupt transfers, which + are limited to 64 bytes. However with a little bit of software + support it is possible to implement bulk transfers instead. + With some revisions of the silicon this provides a workaround + for problems with endpoint 3 - NEC erratum U3 should be consulted + for additional information." + } + + cdl_option CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY { + display "Provide a devtab entry for endpoint 5" + default_value CYGGLO_IO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES + requires CYGPKG_IO + description " + If endpoint 5 will only be accessed via the low-level + USB-specific calls then there is no need for an entry + in the device table, saving some memory. If the + application intends to access the endpoint by means + of open and write calls then a devtab entry is needed. + " + } + } + + cdl_option CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME { + display "Base name for devtab entries" + flavor data + active_if { CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY || + CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY || + CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY + } + default_value { "\"/dev/usbs\"" } + description " + If the uPD985xx USB device driver package provides devtab + entries for any of the endpoints then this option gives + control over the names of these entries. By default the + endpoints will be called \"/dev/usbs0c\", \"/dev/usbs3w\" + and \"/dev/usbs4r\" (assuming all three endpoints are + enabled. The common part \"/dev/usbs\" is determined + by this configuration option. It may be necessary to + change this if there are multiple USB slave-side + devices on the target hardware to prevent a name clash. + " + } + + cdl_option CYGIMP_DEVS_USB_UPD985XX_IBUS_WRITE_LIMIT { + display "Work around potential hardware problem with IBUS writes" + default_value 1 + description " + With some revisions of the silicon there may be problems if + a device driver performs multiple writes to the IBUS in + quick succession. By default this driver avoids such problems, + at the cost of some cpu cycles and a small amount of extra code. + NEC erratum S1 should be consulted for more details." + } + + cdl_option CYGIMP_DEVS_USB_UPD985XX_SERIALIZE_TRANSMITS { + display "Work around potential hardware problem with concurrent transmits" + default_value 1 + description " + With some revisions of the silicon there may be problems if + the device driver is asked to perform concurrent slave->host + transmissions on different endpoints, for example sending + a reply to a control message while there is a bulk transfer + in progress. This option enables a workaround for the + problem by ensuring that only one transmit operation is in + progress at any one time. NEC errata U3 and U4 should be + consulted for more details." + } +} diff --git a/packages/devs/usb/nec_upd985xx/current/doc/devs-usb-nec-upd985xx.html b/packages/devs/usb/nec_upd985xx/current/doc/devs-usb-nec-upd985xx.html new file mode 100644 --- /dev/null +++ b/packages/devs/usb/nec_upd985xx/current/doc/devs-usb-nec-upd985xx.html @@ -0,0 +1,372 @@ + + + + + + + + + + + +NEC uPD985xx USB Device Driver +

Name

NEC uPD985xx USB Support -- Device driver for the on-chip NEC uPD985xx USB device

NEC uPD985xx USB Hardware

The NEC uPD985xx family of processors is supplied with an on-chip USB +slave device, the UDC (USB Device Controller). This supports seven +endpoints. Endpoint 0 can only be used for control messages. Endpoints +1 and 2 are for isochronous transmits and receives respectively. +Endpoints 3 and 4 support bulk transmits and receives. Endpoints 5 and +6 normally support interrupt transmits and receives,but endpoint 5 can +also be configured to support bulk transmits. At this time only the +control endpoint 0, the bulk endpoints 3 and 4, and the interrupt +endpoint 5 are supported.

Endpoint Data Structures

The uPD985xx USB device driver can provide up to four data structures +corresponding to the four supported endpoints: a +usbs_control_endpoint structure +usbs_upd985xx_ep0; +usbs_tx_endpoint structures +usbs_upd985xx_ep3 and +usbs_upd985xx_ep5; and a +usbs_rx_endpoint +usbs_upd985xx_ep4. The header file +cyg/io/usb/usbs_nec_upd985xx.h +provides declarations for these.

Not all applications will require support for all the endpoints. For +example, if the intended use of the UDC only involves peripheral to +host transfers then usbs_upd985xx_ep4 is redundant. +The device driver provides configuration options to control the +presence of each endpoint:

  1. Endpoint 0 is controlled by +CYGFUN_DEVS_USB_UPD985XX_EP0. This defaults to +enabled if there are any higher-level packages that require USB +hardware or if the global preference +CYGGLO_IO_USB_SLAVE_APPLICATION is enabled, +otherwise it is disabled. Usually this has the desired effect. It may +be necessary to override this in special circumstances, for example if +the target board uses an external USB chip in preference to the UDC +and it is that external chip's device driver that should be used +rather than the on-chip UDC. It is not possible to disable endpoint 0 +and at the same time enable one or both of the other endpoints, since +a USB device is only usable if it can process the standard control +messages.

  2. Endpoint 3 is controlled by +CYGPKG_DEVS_USB_UPD985XX_EP3. By default this +endpoint is disabled: according to NEC erratum U3 there may be +problems when attempting bulk transfers of 192 bytes or greater. As an +alternative the device driver provides endpoint 5 configured to +support bulk transfers. Endpoint 3 can be enabled if the application +only requires bulk transfers of less than 192 bytes, or if this +erratum is not applicable to the system being developed for other +reasons.

  3. Similarly endpoint 4 is controlled by +CYGPKG_DEVS_USB_UPD985XX_EP4. This is enabled by +default whenever endpoint 0 is enabled, but it can be disabled +manually.

  4. Endpoint 5 is controlled by +CYGPKG_DEVS_USB_UPD985XX_EP5. This is enabled by +default whenever endpoint 0 is enabled, but it can be disabled +manually. There is also a configuration option +CYGIMP_DEVS_USB_UPD985XX_EP5_BULK, enabled by +default. This option allows the endpoint to be used for bulk +transfers rather than interrupt transfers.

The uPD985xx USB device driver implements the interface specified by the +common eCos USB Slave Support package. The documentation for that +package should be consulted for further details.

The device driver assumes a bulk packet size of 64 bytes, so this +value should be used in the endpoint descriptors in the enumeration +data provided by application code. The device driver also assumes +a control packet size of eight bytes, and again this should be +reflected in the enumeration data. If endpoint 5 is configured for +interrupt rather than bulk transfers then the maximum packet size is +limited to 64 bytes by the USB standard.

Devtab Entries

In addition to the endpoint data structures the uPD985xx USB device +driver can also provide devtab entries for each endpoint. This allows +higher-level code to use traditional I/O operations such as +open/read/write +rather than the USB-specific non-blocking functions like +usbs_start_rx_buffer. These devtab entries are +optional since they are not always required. The relevant +configuration options are +CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY, +CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY, +CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY, and +CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY. By +default these devtab entries are provided if the global preference +CYGGLO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES is enabled, +which is usually the case. Obviously a devtab entry for a given +endpoint will only be provided if the underlying endpoint is enabled. +For example, there will not be a devtab entry for endpoint 4 if +CYGPKG_DEVS_USB_UPD985XX_EP4 is disabled.

The names for the devtab entries are determined by using a +configurable base name and appending 0c, +3w, 4r or 5w. +The base name is determined by the configuration option +CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME and has a +default value of /dev/usbs, so the devtab entry for +endpoint 4 would default to /dev/usbs4r. If the +target hardware involves multiple USB devices then application +developers may have to change the base name to prevent a name clash +with other USB device drivers.

Restrictions

The current device driver imposes a restriction on certain bulk +receives on endpoint 4. If the protocol being used involves +variable-length transfers, in other words if the host is allowed to +send less data than a maximum-sized transfer, then the buffer passed +to the device driver for receives must be aligned to a 16-byte +cacheline boundary and it must be a multiple of this 16-byte cacheline +size. This restriction does not apply if the protocol only involves +fixed-size transfers.

Optional Hardware Workarounds

The NEC errata list a number of other problems that affect the +USB device driver. The device driver contains workarounds for these, +which are enabled by default but can be disabled if the application +developer knows that the relevant errata are not relevant to the +system being developed.

Erratum S1 lists a possible problem if the device driver attempts +multiple writes to the USB hardware. This is circumvented by a +dummy read operation after every write. If this workaround is not +required then the configuration option +CYGIMP_DEVS_USB_UPD985XX_IBUS_WRITE_LIMIT can be disabled.

Errata U3 and U4 describe various problems related to concurrent +transmissions on different endpoints. By default the device driver +works around this by serializing all transmit operations. For example +if the device driver needs to send a response to a control message on +endpoint 0 while there is an ongoing bulk transfer on endpoint 5, the +response is delayed until the bulk transfer has completed. Under +typical operating conditions this does not cause any problems: +endpoint 0 traffic usually happens only during initialization, when +the target is connected to the host, while endpoint 5 traffic only +happens after initialization. However if transmit serialization is +inappropriate for the system being developed then it can be disabled +using the configuration option +CYGIMP_DEVS_USB_UPD985XX_SERIALIZE_TRANSMITS.

Platform Dependencies

On some platforms it is necessary for the low-level USB device driver +to perform some additional operations during start-up. For example it +may be necessary to manipulate one of the processor's GPIO lines +before the host can detect a new USB peripheral and attempt to +communicate with it. This avoids problems if the target involves a +significant amount of work prior to device driver initialization, for +example a power-on self-test sequence. If the USB host attempted to +contact the target before the USB device driver had been initialized, +it would fail to get the expected responses and conclude that the +target was not a functional USB peripheral.

Platform-specific initialization code can be provided via a macro +UPD985XX_USB_PLATFORM_INIT. Typically this macro +would be defined in the platform HAL's header file +cyg/hal/plf_io.h. If the +current platform defines such a macro, the USB device driver will +invoke it during the endpoint 0 start-up operation.

\ No newline at end of file diff --git a/packages/devs/usb/nec_upd985xx/current/doc/makefile b/packages/devs/usb/nec_upd985xx/current/doc/makefile new file mode 100644 --- /dev/null +++ b/packages/devs/usb/nec_upd985xx/current/doc/makefile @@ -0,0 +1,55 @@ +#============================================================================= +# +# makefile +# +# For building the NEC uPD985xx USB device driver documentation +# +#============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +#============================================================================= +#####DESCRIPTIONBEGIN#### +# +# Author(s): bartv +# Date: 2001-01-11 +#####DESCRIPTIONEND#### +#============================================================================= + +TOPLEVEL := ../../../../.. +MAIN_SGML := usbs_upd985xx.sgml +MAIN_HTML := devs-usb-upd985xx.html +MAIN_PDF := devs-usb-upd985xx.pdf +OTHER_SGML := +PICTURES := + +include $(TOPLEVEL)/pkgconf/rules.doc diff --git a/packages/devs/usb/nec_upd985xx/current/doc/usbs_upd985xx.sgml b/packages/devs/usb/nec_upd985xx/current/doc/usbs_upd985xx.sgml new file mode 100644 --- /dev/null +++ b/packages/devs/usb/nec_upd985xx/current/doc/usbs_upd985xx.sgml @@ -0,0 +1,271 @@ + + + + + + + + + + + +####ECOSGPLCOPYRIGHTBEGIN#### + ------------------------------------------- + This file is part of eCos, the Embedded Configurable Operating System. + Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + + eCos is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 or (at your option) any later version. + + eCos is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with eCos; if not, write to the Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + + As a special exception, if other files instantiate templates or use macros + or inline functions from this file, or you compile this file and link it + with other works to produce a work based on this file, this file does not + by itself cause the resulting work to be covered by the GNU General Public + License. However the source code for this file must still be made available + in accordance with section (3) of the GNU General Public License. + + This exception does not invalidate any other reasons why a work based on + this file might be covered by the GNU General Public License. + + Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. + at http://sources.redhat.com/ecos/ecos-license + ------------------------------------------- +####ECOSGPLCOPYRIGHTEND#### + + + + + + + + + + + + + + + +NEC uPD985xx USB Device Driver + + +NEC uPD985xx USB Support +Device driver for the on-chip NEC uPD985xx USB device + + +NEC uPD985xx USB Hardware + +The NEC uPD985xx family of processors is supplied with an on-chip USB +slave device, the UDC (USB Device Controller). This supports seven +endpoints. Endpoint 0 can only be used for control messages. Endpoints +1 and 2 are for isochronous transmits and receives respectively. +Endpoints 3 and 4 support bulk transmits and receives. Endpoints 5 and +6 normally support interrupt transmits and receives, but endpoint 5 can +also be configured to support bulk transmits. At this time only the +control endpoint 0, the bulk endpoints 3 and 4, and the interrupt +endpoint 5 are supported. + + + +Endpoint Data Structures + +The uPD985xx USB device driver can provide up to four data structures +corresponding to the four supported endpoints: a +usbs_control_endpoint structure +usbs_upd985xx_ep0; +usbs_tx_endpoint structures +usbs_upd985xx_ep3 and +usbs_upd985xx_ep5; and a +usbs_rx_endpoint +usbs_upd985xx_ep4. The header file +cyg/io/usb/usbs_nec_upd985xx.h +provides declarations for these. + + +Not all applications will require support for all the endpoints. For +example, if the intended use of the UDC only involves peripheral to +host transfers then usbs_upd985xx_ep4 is redundant. +The device driver provides configuration options to control the +presence of each endpoint: + + + + +Endpoint 0 is controlled by +CYGFUN_DEVS_USB_UPD985XX_EP0. This defaults to +enabled if there are any higher-level packages that require USB +hardware or if the global preference +CYGGLO_IO_USB_SLAVE_APPLICATION is enabled, +otherwise it is disabled. Usually this has the desired effect. It may +be necessary to override this in special circumstances, for example if +the target board uses an external USB chip in preference to the UDC +and it is that external chip's device driver that should be used +rather than the on-chip UDC. It is not possible to disable endpoint 0 +and at the same time enable one or both of the other endpoints, since +a USB device is only usable if it can process the standard control +messages. + + + + +Endpoint 3 is controlled by +CYGPKG_DEVS_USB_UPD985XX_EP3. By default this +endpoint is disabled: according to NEC erratum U3 there may be +problems when attempting bulk transfers of 192 bytes or greater. As an +alternative the device driver provides support for endpoint 5, +configured to allow bulk transfers. Endpoint 3 can be enabled if the +application only requires bulk transfers of less than 192 bytes, or if +this erratum is not applicable to the system being developed for other +reasons. + + + + +Endpoint 4 is controlled by +CYGPKG_DEVS_USB_UPD985XX_EP4. This is enabled by +default whenever endpoint 0 is enabled, but it can be disabled +manually. + + + + +Endpoint 5 is controlled by +CYGPKG_DEVS_USB_UPD985XX_EP5. This is enabled by +default whenever endpoint 0 is enabled, but it can be disabled +manually. There is also a configuration option +CYGIMP_DEVS_USB_UPD985XX_EP5_BULK, enabled by +default. This option allows the endpoint to be used for bulk +transfers rather than interrupt transfers. + + + + +The uPD985xx USB device driver implements the interface specified by the +common eCos USB Slave Support package. The documentation for that +package should be consulted for further details. + + +The device driver assumes a bulk packet size of 64 bytes, so this +value should be used in the endpoint descriptors in the enumeration +data provided by application code. The device driver also assumes +a control packet size of eight bytes, and again this should be +reflected in the enumeration data. If endpoint 5 is configured for +interrupt rather than bulk transfers then the maximum packet size is +limited to 64 bytes by the USB standard. + + + +Devtab Entries + +In addition to the endpoint data structures the uPD985xx USB device +driver can also provide devtab entries for each endpoint. This allows +higher-level code to use traditional I/O operations such as +open/read/write +rather than the USB-specific non-blocking functions like +usbs_start_rx_buffer. These devtab entries are +optional since they are not always required. The relevant +configuration options are +CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY, +CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY, +CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY, and +CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY. By +default these devtab entries are provided if the global preference +CYGGLO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES is enabled, +which is usually the case. Obviously a devtab entry for a given +endpoint will only be provided if the underlying endpoint is enabled. +For example, there will not be a devtab entry for endpoint 4 if +CYGPKG_DEVS_USB_UPD985XX_EP4 is disabled. + + +The names for the devtab entries are determined by using a +configurable base name and appending 0c, +3w, 4r or 5w. +The base name is determined by the configuration option +CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME and has a +default value of /dev/usbs, so the devtab entry for +endpoint 4 would default to /dev/usbs4r. If the +target hardware involves multiple USB devices then application +developers may have to change the base name to prevent a name clash +with other USB device drivers. + + + +Restrictions + +The current device driver imposes a restriction on certain bulk +receives on endpoint 4. If the protocol being used involves +variable-length transfers, in other words if the host is allowed to +send less data than a maximum-sized transfer, then the buffer passed +to the device driver for receives must be aligned to a 16-byte +cacheline boundary and it must be a multiple of this 16-byte cacheline +size. This restriction does not apply if the protocol only involves +fixed-size transfers. + + + +Optional Hardware Workarounds + +The NEC errata list a number of other problems that affect the USB +device driver. The device driver contains workarounds for these, which +are enabled by default but can be disabled if the application +developer knows that the errata are not relevant to the system being +developed. + + +Erratum S1 lists a possible problem if the device driver attempts +multiple writes to the USB hardware. This is circumvented by a +dummy read operation after every write. If the workaround is not +required then the configuration option +CYGIMP_DEVS_USB_UPD985XX_IBUS_WRITE_LIMIT can be disabled. + + +Errata U3 and U4 describe various problems related to concurrent +transmissions on different endpoints. By default the device driver +works around this by serializing all transmit operations. For example +if the device driver needs to send a response to a control message on +endpoint 0 while there is an ongoing bulk transfer on endpoint 5, the +response is delayed until the bulk transfer has completed. Under +typical operating conditions this does not cause any problems: +endpoint 0 traffic usually happens only during initialization, when +the target is connected to the host, while endpoint 5 traffic only +happens after initialization. However if transmit serialization is +inappropriate for the system being developed then it can be disabled +using the configuration option +CYGIMP_DEVS_USB_UPD985XX_SERIALIZE_TRANSMITS. + + + +Platform Dependencies + +On some platforms it is necessary for the low-level USB device driver +to perform some additional operations during start-up. For example it +may be necessary to manipulate one of the processor's GPIO lines +before the host can detect a new USB peripheral and attempt to +communicate with it. This avoids problems if the target involves a +significant amount of work prior to device driver initialization, for +example a power-on self-test sequence. If the USB host attempted to +contact the target before the USB device driver had been initialized, +it would fail to get the expected responses and conclude that the +target was not a functional USB peripheral. + + +Platform-specific initialization code can be provided via a macro +UPD985XX_USB_PLATFORM_INIT. Typically this macro +would be defined in the platform HAL's header file +cyg/hal/plf_io.h. If the +current platform defines such a macro, the USB device driver will +invoke it during the endpoint 0 start-up operation. + + + + diff --git a/packages/devs/usb/nec_upd985xx/current/include/usbs_upd985xx.h b/packages/devs/usb/nec_upd985xx/current/include/usbs_upd985xx.h new file mode 100644 --- /dev/null +++ b/packages/devs/usb/nec_upd985xx/current/include/usbs_upd985xx.h @@ -0,0 +1,79 @@ +#ifndef CYGONCE_USBS_UPD985XX_H +# define CYGONCE_USBS_UPD985XX_H +//========================================================================== +// +// include/usbs_upd985xx.h +// +// The interface exported by the NEC uPD985xx USB device driver +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): bartv +// Contributors: bartv +// Date: 2000-05-22 +// Purpose: +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The NEC UPD985xx family comes with on-chip USB slave support. This + * provides seven endpoints. Endpoint 0 can only be used for control + * messages. Endpoints 1 and 2 can only be used for isochronous + * transfers, and are not supported at this time. Endpoints 3 and 4 + * are for bulk transfers, although endpoint 3 is normally disabled + * and endpoint 5 is used for bulk transfers instead. Endpoints 5 + * and 6 are normally used for interrupt transfers, but endpoint 5 can + * also be used bulk transfers. Endpoint 6 is not currently supported. + */ +extern usbs_control_endpoint usbs_upd985xx_ep0; +extern usbs_tx_endpoint usbs_upd985xx_ep3; +extern usbs_rx_endpoint usbs_upd985xx_ep4; +extern usbs_tx_endpoint usbs_upd985xx_ep5; + +#ifdef __cplusplus +} /* extern "C" { */ +#endif + + +#endif /* CYGONCE_USBS_UPD985XX_H */ diff --git a/packages/devs/usb/nec_upd985xx/current/src/usbs_upd985xx.c b/packages/devs/usb/nec_upd985xx/current/src/usbs_upd985xx.c new file mode 100644 --- /dev/null +++ b/packages/devs/usb/nec_upd985xx/current/src/usbs_upd985xx.c @@ -0,0 +1,2685 @@ +//========================================================================== +// +// usbs_upd985xx.c +// +// Driver for the NEC uPD985xx USB device +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): bartv +// Contributors: bartv +// Date: 2001-05-22 +// +// This code implements support for the on-chip USB port on the NEC +// uPD985xx family of processors. The code has been developed on the +// uPD98503 and may or may not work on other members of the uPD985xx +// family. +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +// For memcpy() +#include + +// ---------------------------------------------------------------------------- +// Toplevel FIXME's. +// +// The device supports remote wakeups, but this driver does not. Note that +// the device GET_STATUS, SET_FEATURE and CLEAR_FEATURE operations are +// affected by remote wakeup support. + +// ---------------------------------------------------------------------------- +// Debugging-related odds and ends. +#if 0 +# define DBG(a) diag_printf a +#else +# define DBG(a) +#endif + +// ---------------------------------------------------------------------------- +// Hardware definitions. +// +// The NEC uPD985Xx on-chip USB device provides the following: +// +// endpoint 0 - control messages only +// endpoint 1 - isochronous transmits +// endpoint 2 - isochronous receives +// endpoint 3 - bulk transmits +// endpoint 4 - bulk receives +// endpoint 5 - interrupt transmits +// endpoint 6 - interrupt receives + +// All acess to the USB controller registers goes via the IBUS, which +// always runs little-endian. Hence when the CPU is running +// little-endian no extra work is needed, but when running big-endian +// all register updates involve swapping. +#ifdef CYGPKG_HAL_MIPS_LSBFIRST +# define IBUS_SWAP32(_a_) (_a_) +# define IBUS_SWAPPTR(_type_, _a_) (_a_) +#else +# error IBUS_SWAP32() needs to be defined and tested +#endif + +// Move an address to kseg1. Or'ing in the relevant bits means +// that this macro will work even if the specified address is +// already in kseg1 +#define MIPS_TO_UNCACHED(_a_) ((void*)(((cyg_uint32)(_a_)) | MIPS_KSEG1_BASE)) + +// For now access the various registers directly. A structure might +// be marginally more inefficient in that if a function accesses +// several registers this could be handled by a single base plus +// offsets, rather than by separate addresses. +#define USBS_REGISTER(_a_) ((volatile cyg_uint32*)(MIPS_IO_BASE + UPD985XX_SYSUSB_OFF + (_a_))) +#define USBS_ADDRREG(_type_, _a_) ((_type_* volatile*)(MIPS_IO_BASE + UPD985XX_SYSUSB_OFF + (_a_))) + +#define USBS_GMR USBS_REGISTER(0x0000) +#define USBS_VER USBS_REGISTER(0x0004) +#define USBS_GSR1 USBS_REGISTER(0x0010) +#define USBS_IMR1 USBS_REGISTER(0x0014) +#define USBS_GSR2 USBS_REGISTER(0x0018) +#define USBS_IMR2 USBS_REGISTER(0x001C) +#define EP0_CR USBS_REGISTER(0x0020) +#define EP1_CR USBS_REGISTER(0x0024) +#define EP2_CR USBS_REGISTER(0x0028) +#define EP3_CR USBS_REGISTER(0x002C) +#define EP4_CR USBS_REGISTER(0x0030) +#define EP5_CR USBS_REGISTER(0x0034) +#define EP6_CR USBS_REGISTER(0x0038) +#define USBS_CMR USBS_REGISTER(0x0040) +#define USBS_CA USBS_ADDRREG(void, 0x0044) +#define USBS_TEPSR USBS_REGISTER(0x0048) +#define USBS_RP0IR USBS_REGISTER(0x0050) +#define USBS_RP0AR USBS_ADDRREG(RxBufferDescriptor, 0x0054) +#define USBS_RP1IR USBS_REGISTER(0x0058) +#define USBS_RP1AR USBS_ADDRREG(RxBufferDescriptor, 0x005C) +#define USBS_RP2IR USBS_REGISTER(0x0060) +#define USBS_RP2AR USBS_ADDRREG(RxBufferDescriptor, 0x0064) +#define USBS_TMSA USBS_ADDRREG(TxMailbox, 0x0070) +#define USBS_TMBA USBS_ADDRREG(TxMailbox, 0x0074) +#define USBS_TMRA USBS_ADDRREG(TxMailbox, 0x0078) +#define USBS_TMWA USBS_ADDRREG(TxMailbox, 0x007C) +#define USBS_RMSA USBS_ADDRREG(RxMailbox, 0x0080) +#define USBS_RMBA USBS_ADDRREG(RxMailbox, 0x0084) +#define USBS_RMRA USBS_ADDRREG(RxMailbox, 0x0088) +#define USBS_RMWA USBS_ADDRREG(RxMailbox, 0x008C) + +// There are additional counter registers from offset 0x100 onwards. +// These registers are not used by the driver, and anyway may not be +// available on all hardware. + +// The General Mode register USBS_GMR +#define USBS_GMR_VT (0x01 << 23) +#define USBS_GMR_FA_MASK (0x7F << 16) +#define USBS_GMR_FA_SHIFT 16 +#define USBS_GMR_SOFINTVL_MASK (0x00FF << 8) +#define USBS_GMR_SOFINTVL_SHIFT 8 +#define USBS_GMR_SOFINTVL_DEFAULT_VALUE (0x18 << 8) +#define USBS_GMR_AU (0x01 << 2) +#define USBS_GMR_LE (0x01 << 1) +#define USBS_GMR_RR (0x01 << 0) + +// The Frame Number/Version register +#define USBS_VER_UVER_MASK (0x0FFFF << 16) +#define USBS_VER_UVER_SHIFT 16 +#define USBS_VER_UFNR_MASK (0x03FF << 0) +#define USBS_VER_UFNR_SHIFT 0 + +// General status register 1 +#define USBS_GSR1_GSR2 (0x01 << 31) +#define USBS_GSR1_TMF (0x01 << 23) +#define USBS_GSR1_RMF (0x01 << 22) +#define USBS_GSR1_RPE2 (0x01 << 21) +#define USBS_GSR1_RPE1 (0x01 << 20) +#define USBS_GSR1_RPE0 (0x01 << 19) +#define USBS_GSR1_RPA2 (0x01 << 18) +#define USBS_GSR1_RPA1 (0x01 << 17) +#define USBS_GSR1_RPA0 (0x01 << 16) +#define USBS_GSR1_DER (0x01 << 10) +#define USBS_GSR1_EP2FO (0x01 << 9) +#define USBS_GSR1_EP1FU (0x01 << 8) +#define USBS_GSR1_EP6RF (0x01 << 7) +#define USBS_GSR1_EP5TF (0x01 << 6) +#define USBS_GSR1_EP4RF (0x01 << 5) +#define USBS_GSR1_EP3TF (0x01 << 4) +#define USBS_GSR1_EP2RF (0x01 << 3) +#define USBS_GSR1_EP1TF (0x01 << 2) +#define USBS_GSR1_EP0RF (0x01 << 1) +#define USBS_GSR1_EP0TF (0x01 << 0) + +// The Interrupt mask 1 bits correspond to the GSR1 bits above + +// General status register 2 +#define USBS_GSR2_FW (0x01 << 21) +#define USBS_GSR2_IFN (0x01 << 20) +#define USBS_GSR2_IEA (0x01 << 19) +#define USBS_GSR2_URSM (0x01 << 18) +#define USBS_GSR2_URST (0x01 << 17) +#define USBS_GSR2_USPD (0x01 << 16) +#define USBS_GSR2_EP2OS (0x01 << 7) +#define USBS_GSR2_EP2ED (0x01 << 6) +#define USBS_GSR2_EP2ND (0x01 << 5) +#define USBS_GSR2_EP1NT (0x01 << 4) +#define USBS_GSR2_EP1ET (0x01 << 3) +#define USBS_GSR2_EP1ND (0x01 << 2) +#define USBS_GSR2_ES (0x01 << 1) +#define USBS_GSR2_SL (0x01 << 0) + +// Interrupt mask 2 bits correspond to GSR2 + +// Endpoint control registers. +// EP0 - control messages +#define EP0_CR_EP0EN (0x01 << 31) +#define EP0_CR_ISS (0x01 << 20) +#define EP0_CR_INAK (0x01 << 19) +#define EP0_CR_OSS (0x01 << 18) +#define EP0_CR_NHSK0 (0x01 << 17) +#define EP0_CR_ONAK (0x01 << 16) +#define EP0_CR_MAXP0_MASK (0x7F << 0) +#define EP0_CR_MAXP0_SHIFT 0 + +// EP1 - isochronous transmits +#define EP1_CR_EP1EN (0x01 << 31) +#define EP1_CR_TM1 (0x01 << 19) +#define EP1_CR_TM1_MASK (0x01 << 19) +#define EP1_CR_TM1_SZLP (0x00 << 19) +#define EP1_CR_TM1_NZLP (0x01 << 19) +#define EP1_CR_MAXP1_MASK (0x3FF << 0) +#define EP1_CR_MAXP1_SHIFT 0 + +// EP2 - isochronous receives +#define EP2_CR_EP2EN (0x01 << 31) +#define EP2_CR_RM2_MASK (0x03 << 19) +#define EP2_CR_RM2_NORMAL (0x00 << 19) +#define EP2_CR_RM2_ASSEMBLE (0x02 << 19) +#define EP2_CR_RM2_SEPARATE (0x03 << 19) +#define EP2_CR_MAXP2_MASK (0x3FF << 0) +#define EP2_CR_MAXP2_SHIFT 0 + +// EP3 - bulk transmits +#define EP3_CR_EP3EN (0x01 << 31) +#define EP3_CR_TM3 (0x01 << 19) +#define EP3_CR_TM3_MASK (0x01 << 19) +#define EP3_CR_TM3_SZLP (0x00 << 19) +#define EP3_CR_TM3_NZLP (0x01 << 19) +#define EP3_CR_SS3 (0x01 << 18) +#define EP3_CR_NAK3 (0x01 << 16) +#define EP3_CR_MAXP3_MASK (0x7F << 0) +#define EP3_CR_MAXP3_SHIFT 0 + +// EP4 - bulk receives +#define EP4_CR_EP4EN (0x01 << 31) +#define EP4_CR_RM4_MASK (0x03 << 19) +#define EP4_CR_RM4_NORMAL (0x00 << 19) +#define EP4_CR_RM4_ASSEMBLE (0x02 << 19) +#define EP4_CR_RM4_SEPARATE (0x03 << 19) +#define EP4_CR_SS4 (0x01 << 18) +#define EP4_CR_NHSK4 (0x01 << 17) +#define EP4_CR_NAK4 (0x01 << 16) +#define EP4_CR_MAXP4_MASK (0x7F << 0) +#define EP4_CR_MAXP4_SHIFT 0 + +// EP5 - interrupt transmits +#define EP5_CR_EP5EN (0x01 << 31) +#define EP5_CR_FM (0x01 << 19) +#define EP5_CR_SS5 (0x01 << 18) +#define EP5_CR_NAK5 (0x01 << 16) +#define EP5_CR_MAXP5_MASK (0x7F << 0) +#define EP5_CR_MAXP5_SHIFT 0 + +// EP6 - interrupt receives +#define EP6_CR_EP6EN (0x01 << 31) +#define EP6_CR_SS6 (0x01 << 18) +#define EP6_CR_NHSK6 (0x01 << 17) +#define EP6_CR_NAK6 (0x01 << 16) +#define EP6_CR_MAXP6_MASK (0x7F << 0) +#define EP6_CR_MAXP6_SHIFT 0 + +// Some bits which can be applied to multiple transmit or receive +// endpoint control registers, thus avoiding unnecessary code +// duplication. These will not work for the isochronous endpoints +// because those are just too special. +#define EPtx_CR_EpxEN (0x01 << 31) +#define EPtx_CR_SSx (0x01 << 18) +#define EPtx_CR_NAKx (0x01 << 16) +#define EPtx_CR_MAXPx_MASK (0x7F << 0) +#define EPtx_CR_MAXPx_SHIFT 0 + +#define EPrx_CR_EPxEN (0x01 << 31) +#define EPrx_CR_SSx (0x01 << 18) +#define EPrx_CR_NHSKx (0x01 << 17) +#define EPrx_CR_NAKx (0x01 << 16) +#define EPrx_CR_MAXPx_MASK (0x7F << 0) +#define EPrx_CR_MAXPx_SHIFT 0 + +// USB command register +#define USBS_CMR_BUSY (0x01 << 31) +#define USBS_CMR_COMMAND_MASK (0x07 << 24) +#define USBS_CMR_COMMAND_SHIFT 24 +#define USBS_CMR_COMMAND_TX_EP0 (0x00 << 24) +#define USBS_CMR_COMMAND_TX_EP1 (0x01 << 24) +#define USBS_CMR_COMMAND_TX_EP3 (0x02 << 24) +#define USBS_CMR_COMMAND_TX_EP5 (0x03 << 24) +#define USBS_CMR_COMMAND_ADD_POOL0 (0x04 << 24) +#define USBS_CMR_COMMAND_ADD_POOL1 (0x05 << 24) +#define USBS_CMR_COMMAND_ADD_POOL2 (0x06 << 24) +#define USBS_CMR_SIZE_MASK (0x0FFFF << 0) +#define USBS_CMR_SIZE_SHIFT 0 + +// TX Endpoint status +#define USBS_TEPSR_EP5TS_MASK (0x03 << 24) +#define USBS_TEPSR_EP5TS_SHIFT 24 +#define USBS_TEPSR_EP5TS_IDLE (0x00 << 24) +#define USBS_TEPSR_EP5TS_ONE (0x01 << 24) +#define USBS_TEPSR_EP5TS_TWO (0x02 << 24) +#define USBS_TEPSR_EP3TS_MASK (0x03 << 16) +#define USBS_TEPSR_EP3TS_SHIFT 16 +#define USBS_TEPSR_EP3TS_IDLE (0x00 << 16) +#define USBS_TEPSR_EP3TS_ONE (0x01 << 16) +#define USBS_TEPSR_EP3TS_TWO (0x02 << 16) +#define USBS_TEPSR_EP1TS_MASK (0x03 << 8) +#define USBS_TEPSR_EP1TS_SHIFT 8 +#define USBS_TEPSR_EP1TS_IDLE (0x00 << 8) +#define USBS_TEPSR_EP1TS_ONE (0x01 << 8) +#define USBS_TEPSR_EP1TS_TWO (0x02 << 8) +#define USBS_TEPSR_EP0TS_MASK (0x03 << 0) +#define USBS_TEPSR_EP0TS_SHIFT 0 +#define USBS_TEPSR_EP0TS_IDLE (0x00 << 0) +#define USBS_TEPSR_EP0TS_ONE (0x01 << 0) +#define USBS_TEPSR_EP0TS_TWO (0x02 << 0) + +// Receive pools. The RP0IR, RP1IR and RP2IR registers +// all use the same bits. +#define USBS_RPxIR_AL_MASK (0x07 << 28) +#define USBS_RPxIR_AL_SHIFT 28 +#define USBS_RPxIR_AL_NONE (0 << 28) +#define USBS_RPxIR_RNOD_MASK (0x0FFFF << 0) +#define USBS_RPxIR_RNOD_SHIFT 0 + +// The other registers do not have special bits. + +// Data transfers involve buffer descriptors and mailboxes. The +// relevant data structures and fields need to be defined. For now +// assume 32-bit mode of operation, i.e. there will be no padding +// between two successive 32-bit entities + +// A transmit packet directory consists of up to 255 buffer +// descriptors. Each buffer descriptor specifies a buffer and a size +// of up to 64K. + +typedef struct TxBufferDescriptor { + cyg_uint32 control; + void* buffer; +} TxBufferDescriptor; + +#define TXBUFDESC_CTRL_LAST (0x01 << 31) +#define TXBUFDESC_CTRL_BUFDESC_MASK (0x01 << 30) +#define TXBUFDESC_CTRL_BUFDESC_SHIFT 30 +#define TXBUFDESC_CTRL_BUFDESC_LINK (0x00 << 30) +#define TXBUFDESC_CTRL_BUFDESC_BUFDESC (0x01 << 30) +#define TXBUFDESC_CTRL_SIZE_MASK (0x0FFFF << 0) +#define TXBUFDESC_CTRL_SIZE_SHIFT 0 + +// The result of a transmit operation gets written to a mailbox +// structure in memory. +typedef struct TxMailbox { + cyg_uint32 status; +} TxMailbox; + +#define TXMBOX_STATUS_IBUS_ERROR (0x01 << 10) +#define TXMBOX_STATUS_UNDERRUN (0x01 << 9) +#define TXMBOX_STATUS_MODE_MASK (0x01 << 8) +#define TXMBOX_STATUS_MODE_SHIFT 8 +#define TXMBOX_STATUS_MODE_SZLP (0x00 << 8) +#define TXMBOX_STATUS_MODE_NZLP (0x01 << 8) +#define TXMBOX_STATUS_EPN_MASK (0x07 << 0) +#define TXMBOX_STATUS_EPN_SHIFT 0 +#define TXMBOX_STATUS_EPN_EP0 (0x00 << 0) +#define TXMBOX_STATUS_EPN_EP1 (0x02 << 0) +#define TXMBOX_STATUS_EPN_EP3 (0x04 << 0) +#define TXMBOX_STATUS_EPN_EP5 (0x06 << 0) + +// Now for receive operations. This involves adding buffer descriptors +// to one of three pools. The pools are managed by registers. +typedef struct RxBufferDescriptor { + cyg_uint32 control; + void* buffer; +} RxBufferDescriptor; + +#define RXBUFDESC_CTRL_LAST (0x01 << 31) +#define RXBUFDESC_CTRL_BUFDESC_MASK (0x01 << 30) +#define RXBUFDESC_CTRL_BUFDESC_SHIFT 30 +#define RXBUFDESC_CTRL_BUFDESC_LINK (0x00 << 30) +#define RXBUFDESC_CTRL_BUFDESC_BUFDESC (0x01 << 30) +#define RXBUFDESC_CTRL_SIZE_MASK (0x0FFFF << 0) +#define RXBUFDESC_CTRL_SIZE_SHIFT 0 + +typedef struct RxMailbox { + cyg_uint32 status; + void* address; +} RxMailbox; + +#define RXMBOX_STATUS_EPN_MASK (0x07 << 29) +#define RXMBOX_STATUS_EPN_SHIFT 29 +#define RXMBOX_STATUS_EPN_EP0 (0x01 << 29) +#define RXMBOX_STATUS_EPN_EP2 (0x03 << 29) +#define RXMBOX_STATUS_EPN_EP4 (0x05 << 29) +#define RXMBOX_STATUS_EPN_EP6 (0x07 << 29) +#define RXMBOX_STATUS_CORRUPTION (0x01 << 25) +#define RXMBOX_STATUS_IBUS_ERROR (0x01 << 24) +#define RXMBOX_STATUS_SETUP_MASK (0x01 << 23) +#define RXMBOX_STATUS_SETUP_SHIFT 23 +#define RXMBOX_STATUS_SETUP_NORMAL (0x00 << 23) +#define RXMBOX_STATUS_SETUP_SETUP (0x01 << 23) +#define RXMBOX_STATUS_OVERRUN (0x01 << 22) +#define RXMBOX_STATUS_DATA_TOGGLE (0x01 << 21) +#define RXMBOX_STATUS_CRC (0x01 << 20) +#define RXMBOX_STATUS_BIT_STUFFING (0x01 << 19) +#define RXMBOX_STATUS_64K (0x01 << 18) +#define RXMBOX_STATUS_MODE_MASK (0x03 << 16) +#define RXMBOX_STATUS_MODE_SHIFT 16 +#define RXMBOX_STATUS_MODE_NORMAL (0x00 << 16) +#define RXMBOX_STATUS_MODE_NORMAL2 (0x01 << 16) +#define RXMBOX_STATUS_MODE_ASSEMBLE (0x02 << 16) +#define RXMBOX_STATUS_MODE_SEPARATE (0x03 << 16) +#define RXMBOX_STATUS_SIZE_MASK (0x0FFFF << 0) +#define RXMBOX_STATUS_SIZE_SHIFT 0 + + +// ---------------------------------------------------------------------------- +// Hardware work around - see NEC erratum S1, CPU to IBUS write restriction. +// Reading back from the USB device after every write prevents any problems. +// Strictly speaking it is only necessary to do this after every three +// writes, but if there is concurrent ethernet activity then doing it +// after eveyr write is safer. The frame number/version register seems +// like a good one to read back from. + +#ifdef CYGIMP_DEVS_USB_UPD985XX_IBUS_WRITE_LIMIT +# define FLUSH_IBUS() \ + CYG_MACRO_START \ + (void)*USBS_VER; \ + CYG_MACRO_END + +#else +# define FLUSH_IBUS() CYG_EMPTY_STATEMENT +#endif + +// ---------------------------------------------------------------------------- +// Static data. There is a data structure for each endpoint. The +// implementation is essentially a private class that inherits from +// common classes for control and data endpoints, but device drivers +// are supposed to be written in C so some ugliness is required. +// +// Devtab entries are defined in usbs_upd985xx_data.cxx to make sure +// that the linker does not garbage-collect them. + +// Support for the interrupt handling code. +static cyg_interrupt usbs_upd985xx_intr_data; +static cyg_handle_t usbs_upd985xx_intr_handle; + +// The various bits in the two interrupt status registers are read-once, +// i.e. reading the register clears the bits. Since much of the processing +// is deferred to DSR level, it is necessary to keep track of pending +// interrupts in separate variables. If another interrupt happens during +// DSR processing, these variables will be updated. The main DSR loops +// until there are no interesting bits left. Interrupts have to be +// disabled briefly when clearing bits. +static volatile cyg_uint32 usbs_upd985xx_gsr1 = 0; +static volatile cyg_uint32 usbs_upd985xx_gsr2 = 0; + +// Many of the interrupt bits are of no interest and it is convenient +// to mask them out in the ISR, thus avoiding unnecessary dsr +// invocations. +static cyg_uint32 usbs_upd985xx_gsr1_mask = 0; +static cyg_uint32 usbs_upd985xx_gsr2_mask = 0; + +// Sizes for the receive and transmit mboxes. +// NOTE: it is not clear what the optimal size for these +// mailboxes is. For receives maybe one per rx endpoint, +// plus a spare. For transmits maybe just two, since only +// one transmit at a time is supported. Mailboxes are +// relatively small, so for now four each should be ok. +#define RXMBOX_COUNT 4 +#define TXMBOX_COUNT 4 + +// There is one instance of this data structure. It is allocated +// in kseg0 cached memory, but during initialization a separate +// pointer value is set to the kseg1 uncached equivalent. This +// makes it easier to point the hardware at uncached memory without +// having to worry about cache line boundaries everywhere. + +typedef struct uncached_data { + // This partial cacheline does not actually store any data. + // However it ensures that the data does not share a cacheline + // with some other static, with updates to that other static + // causing funny side effects on the uncached data. There is a + // memory optimisation of subtracting sizeof(RxMailbox.status), + // i.e. exploit knowledge of alignment. + unsigned char cacheline_start[HAL_DCACHE_LINE_SIZE - sizeof(cyg_uint32)]; + + RxMailbox rx_mboxes[RXMBOX_COUNT]; + TxMailbox tx_mboxes[TXMBOX_COUNT]; + + // For transmits a single buffer descriptor per endpoint suffices. + // If transmit locking is enabled then actually a single buffer + // descriptor for the whole system would suffice. + TxBufferDescriptor ep0_tx_bufdesc; +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 + TxBufferDescriptor ep3_tx_bufdesc; +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 + TxBufferDescriptor ep5_tx_bufdesc; +#endif + + + // More buffer descriptors are needed than might be expected, see + // the start_rx routines. + RxBufferDescriptor ep0_rx_bufdescs[4]; +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP4 + RxBufferDescriptor ep4_rx_bufdescs[8]; +#endif + + +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP4 + // Space for the start and end of a transfer, avoiding problems + // with invalidating partial cache lines. + unsigned char ep4_head[HAL_DCACHE_LINE_SIZE]; + unsigned char ep4_tail[HAL_DCACHE_LINE_SIZE]; +#endif + + // The "big" buffers come last, reducing the offsets for the previous + // structures. It is not clear this really matters for MIPS. + // + // Endpoint 0 receive and transmit buffers. A transmit buffer is + // convenient because the hardware pretty much expects all of the + // data to be in contiguous memory, as opposed to the normal eCos + // USB driver model with refill buffers etc. An alternative + // implementation would keep the data in separate areas but would + // require lots of TxBufferDescriptors, so in memory terms the + // overheads of a single transmit buffer are not as big as might + // seem. It might be possible to get things working eight bytes + // at a time since the hardware appears to depend on zero-byte + // terminating packets in places, but that has not been attempted. + // + // A separate receive buffer is useful because it can be placed in + // uncached memory, avoiding the need for invalidation and + // worrying about other data in the cache lines. Note that this + // buffer may also get used for endpoint 6 interrupt receives + // because the two endpoints share a single pool. + unsigned char ep0_rx_buffer[CYGNUM_DEVS_USB_UPD985XX_EP0_RXBUFSIZE]; + unsigned char ep0_tx_buffer[CYGNUM_DEVS_USB_UPD985XX_EP0_TXBUFSIZE]; + + // Another cacheline to prevent overlap with other statics. + // This has to be full-sized since the previous field is only byte-aligned. + unsigned char cacheline_end[HAL_DCACHE_LINE_SIZE]; +} uncached_data; + +// This data structure is quite large so making it all uninitialized +// means a potentially big saving in ROM-booting systems. This +// requires additional effort by the endpoint initialization routines. +static uncached_data cached_copy; + +static uncached_data* uncached = (uncached_data*)0; + +// Endpoint 0. See the description below. + +static void usbs_upd985xx_ep0_start(usbs_control_endpoint*); +static void usbs_upd985xx_poll(usbs_control_endpoint*); + +typedef struct ep0_impl { + usbs_control_endpoint common; + cyg_bool rx_expecting_data; + cyg_bool rx_indicator_valid; + RxMailbox rx_indicator; + cyg_bool tx_indicator_valid; + TxMailbox tx_indicator; + cyg_bool tx_needs_zero_transfer; + cyg_uint32 tx_size; +} ep0_impl; + +static ep0_impl ep0 = { + common: + { + state: USBS_STATE_POWERED, // The hardware does not distinguish between detached, attached and powered. + enumeration_data: (usbs_enumeration_data*) 0, + start_fn: &usbs_upd985xx_ep0_start, + poll_fn: &usbs_upd985xx_poll, + interrupt_vector: CYGNUM_HAL_INTERRUPT_USB, + control_buffer: { 0, 0, 0, 0, 0, 0, 0, 0 }, + state_change_fn: (void (*)(usbs_control_endpoint*, void*, usbs_state_change, int)) 0, + state_change_data: (void*) 0, + standard_control_fn: (usbs_control_return (*)(usbs_control_endpoint*, void*)) 0, + standard_control_data: (void*) 0, + class_control_fn: (usbs_control_return (*)(usbs_control_endpoint*, void*)) 0, + class_control_data: (void*) 0, + vendor_control_fn: (usbs_control_return (*)(usbs_control_endpoint*, void*)) 0, + vendor_control_data: (void*) 0, + reserved_control_fn: (usbs_control_return (*)(usbs_control_endpoint*, void*)) 0, + reserved_control_data: (void*) 0, + buffer: (unsigned char*) 0, + buffer_size: 0, + fill_buffer_fn: (void (*)(usbs_control_endpoint*)) 0, + fill_data: (void*) 0, + fill_index: 0, + complete_fn: (usbs_control_return (*)(usbs_control_endpoint*, int)) 0 + }, + rx_expecting_data: false, + rx_indicator_valid: false, + rx_indicator: { 0, (void*) 0 }, + tx_indicator_valid: false, + tx_indicator: { 0 }, + tx_needs_zero_transfer: 0 +}; + +extern usbs_control_endpoint usbs_upd985xx_ep0 __attribute__((alias ("ep0"))); + +// Endpoint 1, isochronous transmits. This endpoint is not yet +// supported. Although the interface for bulk transmits should be +// mostly re-usable, there are some additional error conditions if +// either the host or the target fails to achieve the desired +// throughput. + +// Endpoint 2, isochronous receives. Not yet supported for now, just +// like endpoint 1. + +// Endpoints 3 and 5 can share some code. +#if defined(CYGPKG_DEVS_USB_UPD985XX_EP3) || defined(CYGPKG_DEVS_USB_UPD985XX_EP5) +// Endpoint 3, bulk transmits, and endpoint 5, either interrupt transmits +// or emulation of bulk transmits. The hardware does most +// of the work. +typedef struct ep35_impl { + usbs_tx_endpoint common; + cyg_bool tx_indicator_valid; + TxMailbox tx_indicator; + int send_command; + volatile cyg_uint32* cr; + TxBufferDescriptor* tx_bufdesc; +} ep35_impl; + +# ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 +static void ep3_start_tx(usbs_tx_endpoint*); +static void ep3_set_halted(usbs_tx_endpoint*, cyg_bool); + +static ep35_impl ep3 = { + common: { + start_tx_fn: &ep3_start_tx, + set_halted_fn: &ep3_set_halted, + complete_fn: (void (*)(void*, int)) 0, + complete_data: (void*) 0, + buffer: (const unsigned char*) 0, + buffer_size: 0, + halted: 0, + }, + tx_indicator_valid: false, + tx_indicator: { 0 }, + send_command: USBS_CMR_COMMAND_TX_EP3, + cr: EP3_CR, + tx_bufdesc: 0 // Needs run-time initialization +}; + +extern usbs_tx_endpoint usbs_upd985xx_ep3 __attribute__ ((alias ("ep3"))); +# endif + +# ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 +static void ep5_start_tx(usbs_tx_endpoint*); +static void ep5_set_halted(usbs_tx_endpoint*, cyg_bool); + +static ep35_impl ep5 = { + common: { + start_tx_fn: &ep5_start_tx, + set_halted_fn: &ep5_set_halted, + complete_fn: (void (*)(void*, int)) 0, + complete_data: (void*) 0, + buffer: (const unsigned char*) 0, + buffer_size: 0, + halted: 0, + }, + tx_indicator_valid: false, + tx_indicator: { 0 }, + send_command: USBS_CMR_COMMAND_TX_EP5, + cr: EP5_CR, + tx_bufdesc: 0 // Needs run-time initialization +}; + +extern usbs_tx_endpoint usbs_upd985xx_ep5 __attribute__ ((alias ("ep5"))); +# endif +#endif + + +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP4 +// Endpoint 4, bulk receives. Again the hardware does the hard work. +// Receive pool 2 is reserved for this endpoint. + +typedef struct ep4_impl { + usbs_rx_endpoint common; + cyg_uint32 head_size; + cyg_uint32 direct_size; + cyg_uint32 tail_size; + cyg_bool rx_indicator_valid; + RxMailbox rx_indicator; + cyg_int32 tail_index; +} ep4_impl; + +static void ep4_start_rx(usbs_rx_endpoint*); +static void ep4_set_halted(usbs_rx_endpoint*, cyg_bool); + +static ep4_impl ep4 = { + common: { + start_rx_fn: &ep4_start_rx, + set_halted_fn: &ep4_set_halted, + complete_fn: (void (*)(void*, int)) 0, + complete_data: (void*) 0, + buffer: (unsigned char*) 0, + buffer_size: 0, + halted: 0, + }, + rx_indicator_valid: false, + rx_indicator: { 0, (void*) 0 }, + tail_index: -1 +}; + +extern usbs_rx_endpoint usbs_upd985xx_ep4 __attribute__((alias ("ep4"))); +#endif + +// Endpoint 6, interrupt receives. Not yet implemented. There may +// be conflicts because the hardware is shared with endpoint 0. + +// ---------------------------------------------------------------------------- +// Mailbox support. +// +// The transmit and receive mailboxes are shared between the +// appropriate endpoints. This causes some complications if e.g. +// transmits on several endpoints complete at the same time. For +// example the tx mailbox might contain send indicators for endpoints +// 3 and 0, but the DSR code will process endpoint 0 before endpoint +// 3. +// +// This device driver works on the basis that there can be only one +// transmit and/or receive in progress for any given endpoint, so the +// relevant information can be extracted from the mailbox and put into +// the per-endpoint structures. The routines below can be used to +// move data from the mailboxes. They will be called in DSR context +// so there is no need to worry about locking. + +static void +drain_tx_mailbox(void) +{ + TxMailbox* tmra = IBUS_SWAPPTR(TxMailbox, *USBS_TMRA); + TxMailbox* tmwa = IBUS_SWAPPTR(TxMailbox, *USBS_TMWA); + if (tmra != tmwa) { + do { + TxMailbox mbox = *tmra; + tmra++; + if (tmra == &(uncached->tx_mboxes[TXMBOX_COUNT])) { + tmra = &(uncached->tx_mboxes[0]); + } + + switch(mbox.status & TXMBOX_STATUS_EPN_MASK) { + case TXMBOX_STATUS_EPN_EP0: + CYG_ASSERT(false == ep0.tx_indicator_valid, "Only one ep0 transmit should be in progress at a time"); + ep0.tx_indicator = mbox; + ep0.tx_indicator_valid = true; + break; +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 + case TXMBOX_STATUS_EPN_EP3: + CYG_ASSERT(false == ep3.tx_indicator_valid, "Only one ep3 transmit should be in progress at a time"); + ep3.tx_indicator = mbox; + ep3.tx_indicator_valid = true; + break; +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 + case TXMBOX_STATUS_EPN_EP5: + CYG_ASSERT(false == ep5.tx_indicator_valid, "Only one ep5 transmit should be in progress at a time"); + ep5.tx_indicator = mbox; + ep5.tx_indicator_valid = true; + break; +#endif + default: + break; + } + } while (tmra != tmwa); + *USBS_TMRA = IBUS_SWAPPTR(TxMailbox, tmra); FLUSH_IBUS(); + } +} + +static void +drain_rx_mailbox(void) +{ + RxMailbox* rmra = IBUS_SWAPPTR(RxMailbox, *USBS_RMRA); + RxMailbox* rmwa = IBUS_SWAPPTR(RxMailbox, *USBS_RMWA); + + if (rmra != rmwa) { + do { + RxMailbox mbox = *rmra; + rmra++; + if (rmra == &(uncached->rx_mboxes[RXMBOX_COUNT])) { + rmra = &(uncached->rx_mboxes[0]); + } + + switch(mbox.status & RXMBOX_STATUS_EPN_MASK) { + case RXMBOX_STATUS_EPN_EP0: + // Ignore zero-byte transfers. It is not clear why + // these happen, but they have been observed. + if (0 != (mbox.status & RXMBOX_STATUS_SIZE_MASK)) { + CYG_ASSERT(false == ep0.rx_indicator_valid, "Only one ep0 receive should be in progress at a time"); + ep0.rx_indicator = mbox; + ep0.rx_indicator_valid = true; + } + break; +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP4 + case RXMBOX_STATUS_EPN_EP4: + // If an error occurs then the hardware may report + // multiple rx completions, each with an IBUS error + // indicator. For now only the last rx indicator is + // taken into account, which means we could lose + // a successful receive that happens to be followed + // by an error. + // NOTE: any possibility of improving on this? +#if 1 + CYG_ASSERT(false == ep4.rx_indicator_valid, "Only one ep4 receive should be in progress at a time"); +#endif + ep4.rx_indicator = mbox; + ep4.rx_indicator_valid = true; + break; +#endif + default: + break; + } + } while (rmra != rmwa); + *USBS_RMRA = IBUS_SWAPPTR(RxMailbox, rmra); FLUSH_IBUS(); + } +} + +// ---------------------------------------------------------------------------- +// Transmit locking. +// +// According to NEC errata U3 and U4 the hardware may exhibit +// undesirable behaviour if there are concurrent transmissions. There +// are various ways of resolving this, but the simplest is to perform +// locking in software so that at most one transmit endpoint is in use +// at any one time. This approach works fine if transmissions only +// involve one tx endpoint plus the control endpoint because the +// control endpoint generally only gets used during initialization and +// the other endpoint only gets used after initialization. If multiple +// transmit endpoints are used then locking in software becomes less +// acceptable, especially if isochronous transfers are used because +// timing is important for those. +// +// There is a theoretical problem if e.g. there is a very large bulk +// transfer on a busy bus and it is necessary to respond to a control +// message. The control reply would be delayed, possibly causing a +// violation of the USB standard and a timeout on the host. + +#ifdef CYGIMP_DEVS_USB_UPD985XX_SERIALIZE_TRANSMITS +static void ep0_start_tx(void); +# if defined(CYGPKG_DEVS_USB_UPD985XX_EP3) || defined(CYGPKG_DEVS_USB_UPD985XX_EP5) +static void ep35_start_tx(ep35_impl*); +# endif + +static cyg_bool tx_in_progress = false; +static cyg_bool ep0_tx_pending = false; +# ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 +static cyg_bool ep3_tx_pending = false; +# endif +# ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 +static cyg_bool ep5_tx_pending = false; +# endif + +// Invoked from ep?_start_tx(). Scheduling may or may not be locked. +static cyg_bool +tx_try_lock(cyg_bool* which) +{ + cyg_bool result; + cyg_drv_dsr_lock(); + if (tx_in_progress) { + result = false; + *which = true; + } else { + result = true; + tx_in_progress = true; + } + cyg_drv_dsr_unlock(); + return result; +} + +// Invoked only from dsr context. +static void +tx_unlock(void) +{ + tx_in_progress = false; + if (ep0_tx_pending) { + ep0_tx_pending = false; + ep0_start_tx(); + return; + } +# ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 + if (ep3_tx_pending) { + ep3_tx_pending = false; + ep35_start_tx(&ep3); + return; + } +# endif +# ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 + if (ep5_tx_pending) { + ep5_tx_pending = false; + ep35_start_tx(&ep5); + return; + } +# endif +} + +# define TX_TRY_LOCK(_x_) tx_try_lock(_x_) +# define TX_UNLOCK() tx_unlock() + +#else + +# define TX_TRY_LOCK(_x_) 1 +# define TX_UNLOCK() CYG_EMPTY_STATEMENT + +#endif + + +// ---------------------------------------------------------------------------- +// Endpoint 0 +// +// As usual, control messages are more complicated than the rest. +// +// 1) during initialization a receive is initiated into the common +// eight-byte buffer, used for the standard header of the control +// packet. Until that header has been received and analysed, +// there is no way of knowing whether or not the host will be +// sending any more data. +// +// 2) the control packet may indicate that the host will be sending +// more data. A higher-level handler for the control message should +// have provided a suitable buffer, so a receive can be started +// into that buffer. A flag indicates whether we are currently +// receiving a new control packet or additional data. +// +// 3) the host may decide to cancel that extra data and send a new +// control message instead. There is a flag to indicate that +// the transfer included a SETUP token. +// +// 4) transmits only happen when the control packet involves returning +// data. Unfortunately there is a problem in that, with eCos, the +// return data will generally not be in a single contiguous buffer. +// Discontinuous data could be handled by having a separate buffer +// descriptor for each bit of data, but it is not known in advance +// how many buffer descriptors might be needed so allocating +// those statically presents a problem as well. Instead a single +// static buffer is used, and data from higher-level code is copied +// there. This introduces a new problem: how big should that buffer +// be? A configuration option is used for that. +// +// If endpoint 6 is in use as well then things get more complicated +// because a single receive pool will be shared between endpoints 0 +// and 6, and when adding a buffer to a pool there is no way of +// specifying the endpoint. Hence it will be necessary to receive +// into a static buffer and then copy into either an endpoint 0 or +// and endpoint 6 buffer. + +// Fill the transmit buffer by repeatedly invoking the refill function +// and copying into the ep0 tx buffer. The relevant fields in the +// ep0 structure are cleared immediately and the completion function +// is called, even though the data has not actually gone out. That avoids +// a possible race condition where the host sends a new control packet +// immediately, before the transmit-complete has been processed +// (unlikely in practice, not least because ep0_tx_dsr() will get called +// before ep0_rx_dsr()). +static int +ep0_fill_txbuffer(void) +{ + int filled = 0; + while (filled < CYGNUM_DEVS_USB_UPD985XX_EP0_TXBUFSIZE) { + if (0 != ep0.common.buffer_size) { + if ((filled + ep0.common.buffer_size) < CYGNUM_DEVS_USB_UPD985XX_EP0_TXBUFSIZE) { + memcpy(&(uncached->ep0_tx_buffer[filled]), ep0.common.buffer, ep0.common.buffer_size); + filled += ep0.common.buffer_size; + ep0.common.buffer_size = 0; + } else { + break; + } + } else if ((void (*)(usbs_control_endpoint*))0 != ep0.common.fill_buffer_fn) { + (*ep0.common.fill_buffer_fn)(&ep0.common); + } else { + break; + } + } + CYG_ASSERT((0 == ep0.common.buffer_size) && ((void (*)(usbs_control_endpoint*))0 == ep0.common.fill_buffer_fn), \ + "Endpoint 0 transmit buffer overflow"); + + if ((usbs_control_return (*)(usbs_control_endpoint*, int))0 != ep0.common.complete_fn) { + (*ep0.common.complete_fn)(&ep0.common, 0); + } + ep0.common.buffer = (unsigned char*) 0; + ep0.common.buffer_size = 0; + ep0.common.fill_buffer_fn = 0; + ep0.common.complete_fn = 0; + + return filled; +} + +// Start a new receive operation on endpoint 0. This needs to happen +// from a number of places, including from initialization. +// +// IMHO the hardware is somewhat overengineered here. All that is +// needed is to receive a single eight-byte control packet, or a +// small amount of additional control data. That could be achieved +// by using a single buffer descriptor in the uncached structure, +// plus a suitably-sized static uncached ep0_rx_buffer. +// +// But no, buffer descriptors must be linked and new buffers must +// be added to the end. When a control packet arrives, the +// receive pool continues to point at the old buffer descriptor. +// So we need two buffer descriptors plus two links, switching +// between them as appropriate. +// +// It is not at all clear what would happen if another packet +// started to happen while things were being updated. There is +// also potential confusion between endpoint 0 and endpoint 6 +// receives. + +static void +ep0_start_rx(cyg_uint32 size) +{ + // The buffer descriptor to be added. This will be either + // ep0_rxbufdescs[0] or ep0_rxbufdescs[2]; + RxBufferDescriptor* desc = &(uncached->ep0_rx_bufdescs[0]); + + CYG_ASSERTC(size > 0); + + // Block interrupts for the duration. This does not prevent + // problems if the hardware sees another packet and starts + // doing things, but should prevent some software race + // conditions. + cyg_drv_isr_lock(); + + // We are about to start a new rx operation, so the + // current indicator may get invalidated. + ep0.rx_indicator_valid = false; + + // Start by looking at the current pool0 status. There are + // three possibilities: during init or after reset, the pool + // will be empty; otherwise the pool should point at either + // rx_bufdescs[0] or rx_bufdescs[2], corresponding to the + // last received packet. + if (0 == (*USBS_RP0IR & USBS_RPxIR_RNOD_MASK)) { + // Nothing currently in the pool. Use ep0_rx_bufdescs[0], + // and no need to update a link. + } else if (desc == *USBS_RP0AR) { + // The pool already points at bufdescs[0], switch to bufdescs[2], + // and link from bufdescs[1]. + desc = &(uncached->ep0_rx_bufdescs[2]); + uncached->ep0_rx_bufdescs[1].buffer = (void*) desc; + } else { + // The pool should point at bufdescs[2], stick with bufdescs[0] + CYG_ASSERT(&(uncached->ep0_rx_bufdescs[2]) == *USBS_RP0AR, "Endpoint 0 rx buffer confusion"); + uncached->ep0_rx_bufdescs[3].buffer = (void*) desc; + } + + // Now fill in the buffer directory being added + desc[0].control = RXBUFDESC_CTRL_LAST | RXBUFDESC_CTRL_BUFDESC_BUFDESC | size; + desc[0].buffer = (void*) uncached->ep0_rx_buffer; + desc[1].control = RXBUFDESC_CTRL_BUFDESC_LINK; + desc[1].buffer = 0; + + while (0 != (*USBS_CMR & IBUS_SWAP32(USBS_CMR_BUSY))) { + // Do nothing: this situation should be short-lived. + } + *USBS_CA = IBUS_SWAPPTR(void, desc); FLUSH_IBUS(); + *USBS_CMR = IBUS_SWAP32(USBS_CMR_COMMAND_ADD_POOL0 | 1); FLUSH_IBUS(); + cyg_drv_isr_unlock(); +} + +// Ditto for transmits. The data is assumed to be in +// uncached->ep0_tx_buffer already. A size of 0 indicates +// a need to send a terminating packet explicitly. +static void +ep0_start_tx(void) +{ + if (!TX_TRY_LOCK(&ep0_tx_pending)) { + return; + } + + uncached->ep0_tx_bufdesc.buffer = uncached->ep0_tx_buffer; + uncached->ep0_tx_bufdesc.control = TXBUFDESC_CTRL_LAST | TXBUFDESC_CTRL_BUFDESC_BUFDESC | ep0.tx_size; + + cyg_drv_isr_lock(); + while (0 != (*USBS_CMR & IBUS_SWAP32(USBS_CMR_BUSY))) { + // Do nothing: this situation should be short-lived. + } + *USBS_CA = IBUS_SWAPPTR(void, &(uncached->ep0_tx_bufdesc)); FLUSH_IBUS(); + *USBS_CMR = IBUS_SWAP32(USBS_CMR_COMMAND_TX_EP0 | ep0.tx_size); FLUSH_IBUS(); + cyg_drv_isr_unlock(); +} + +// An endpoint 0 transmission has completed. Usually the only action +// that is needed is to drain the tx mailbox entry, otherwise it is +// possible that we could end up with ep0 transmits using up all +// available slots. The endpoint 0 hardware requires no further +// attention, and as far as higher-level code is concerned the +// transmission completed a long time ago when ep0_fill_txbuffer() +// called the completion function. +// +// There is one special case. If the host asked for e.g. a string +// descriptor and asked for 255 bytes, but the string was only +// e.g. 32 bytes, then there is a problem. The data will be +// transferred as four 8-byte packets, but it is necessary to +// terminate the transfer with a 0-byte packet. Endpoint 0 always +// operates in NZLP mode so the hardware will never generate +// this last packet. Instead it is necessary to set up an +// additional transfer of zero bytes. That could be done at the +// same time as the main data transfer, but then it would be +// necessary to poll the hardware and wait until it has finished +// processing that initial transfer. +static void +ep0_tx_dsr(void) +{ + if (!ep0.tx_indicator_valid) { + drain_tx_mailbox(); + if (!ep0.tx_indicator_valid) { + // A transmit interrupt when there does not appear to be + // any data? + CYG_FAIL("EP0 tx DSR invoked when there is no valid tx indicator"); + return; + } + } + // There is not actually anything worth looking at in the status. + ep0.tx_indicator_valid = false; + + if (ep0.tx_needs_zero_transfer) { + ep0.tx_needs_zero_transfer = false; + uncached->ep0_tx_bufdesc.buffer = uncached->ep0_tx_buffer; + uncached->ep0_tx_bufdesc.control = TXBUFDESC_CTRL_LAST | TXBUFDESC_CTRL_BUFDESC_BUFDESC | 0; + + cyg_drv_isr_lock(); + while (0 != (*USBS_CMR & IBUS_SWAP32(USBS_CMR_BUSY))) { + // Do nothing: this situation should be short-lived. + } + *USBS_CA = IBUS_SWAPPTR(void, &(uncached->ep0_tx_bufdesc)); FLUSH_IBUS(); + *USBS_CMR = IBUS_SWAP32(USBS_CMR_COMMAND_TX_EP0 | 0); FLUSH_IBUS(); + cyg_drv_isr_unlock(); + + } else { + TX_UNLOCK(); + } +} + +// An endpoint 0 receive has completed. This could be a new control +// message. Or it could be the data for a previous control message. Or +// it could be a new control message when expecting the data from +// a previous one. The ep0.rx_expecting_data field indicates +// whether or not a new control message is expected. +// +// At times an interrupt triggers and there is an rx indication for a +// zero-byte transfer. Such a transfer may be followed immediately by +// a real transfer. It is not understood why the zero-byte transfer +// occurs. They are ignored by the drain_rx_mailbox() code, to make +// sure that there is at most one valid rx indicator at a time. +static void +ep0_rx_dsr(void) +{ + // Start by checking the rx indicator to make sure that a packet + // really has been received. + if (!ep0.rx_indicator_valid) { + drain_rx_mailbox(); + if (!ep0.rx_indicator_valid) { + // Do not assert, in case of a spurious interrupt for a + // zero-byte transfer. + return; + } + } + + // We have a valid receive, with the data held in uncached->ep0_rx_buffer. + // Are we expecting the remaining data of a control transfer? + if (ep0.rx_expecting_data) { + // Was this data interrupted by a new setup packet? + if (0 != (ep0.rx_indicator.status & RXMBOX_STATUS_SETUP_SETUP)) { + // NOTE: it is not clear from the documentation exactly what + // happens here, e.g. is it guaranteed that the new control + // packet appears at the start of the buffer rather than + // after any data previously received? Given typical + // USB host-side implementations this scenario is considered + // sufficiently unlikely that no further investigation has + // been carried out. + + // Inform higher-level code that the receive has been aborted. + if ((usbs_control_return (*)(usbs_control_endpoint*, int)) 0 != ep0.common.complete_fn) { + (*ep0.common.complete_fn)(&ep0.common, -EIO); + } + ep0.rx_expecting_data = false; + ep0.common.buffer = (unsigned char*) 0; + ep0.common.buffer_size = 0; + ep0.common.fill_buffer_fn = 0; + ep0.common.complete_fn = (usbs_control_return (*)(usbs_control_endpoint*, int)) 0; + // Fall through the main control message handling code below. + } else { + // Data was expected and received. Transfer the data to the + // user's buffer, and perform completion. + usbs_control_return result; + cyg_uint32 size = ep0.rx_indicator.status & RXMBOX_STATUS_SIZE_MASK; + + CYG_ASSERT( (usbs_control_return (*)(usbs_control_endpoint*, int))0 != ep0.common.complete_fn, \ + "A completion function should be provided for OUT control messages"); + CYG_ASSERT(size == ep0.common.buffer_size, "Inconsistency between buffer and transfer sizes"); + memcpy(ep0.common.buffer, uncached->ep0_rx_buffer, size); + result = (*ep0.common.complete_fn)(&ep0.common, 0); + ep0.common.buffer = (unsigned char*) 0; + ep0.common.buffer_size = 0; + ep0.common.complete_fn = (usbs_control_return (*)(usbs_control_endpoint*, int)) 0; + ep0.rx_expecting_data = false; + + // Start another receive for the next control message. + // Note that there has been a window where there was no receive + // in progress for endpoint 0, even though according to the + // USB spec a device must always be able to accept new + // control messages. + ep0_start_rx(8); + return; + } + } + + // When we get here we should have an eight-byte control message + // in uncached->ep0_rx_buffer. This should get moved into + // the ep0.common.control_buffer so that higher-level code sees + // it in the appropriate location. + CYG_ASSERT((ep0.rx_indicator.address == &(uncached->ep0_rx_bufdescs[0])) || \ + (ep0.rx_indicator.address == &(uncached->ep0_rx_bufdescs[2])), \ + "Received ep0 data should involve the ep0 rx buffer descriptor"); + + CYG_ASSERT(8 == (ep0.rx_indicator.status & RXMBOX_STATUS_SIZE_MASK), "Control messages should be 8 bytes"); + memcpy(ep0.common.control_buffer, uncached->ep0_rx_buffer, 8); + + // If we have received a control packet then any reset signals really + // will have come from the host and must be processed normally. + // Make sure that reset interrupts are no longer masked off. + if (0 == (*USBS_IMR2 * IBUS_SWAP32(USBS_GSR2_URST))) { + *USBS_IMR2 |= IBUS_SWAP32(USBS_GSR2_URST); FLUSH_IBUS(); + usbs_upd985xx_gsr2_mask |= USBS_GSR2_URST; + } + + { + usbs_control_return result = USBS_CONTROL_RETURN_UNKNOWN; + usb_devreq* req = (usb_devreq*) ep0.common.control_buffer; + int length, direction, protocol, recipient; + + // Now we need to do some decoding of the data. A non-zero + // length field indicates that there will be a subsequent + // IN or OUT phase. The direction is controlled by the + // top bit of the first byte. The protocol is determined + // by other bits of the top byte. + length = (req->length_hi << 8) | req->length_lo; + direction = req->type & USB_DEVREQ_DIRECTION_MASK; + protocol = req->type & USB_DEVREQ_TYPE_MASK; + recipient = req->type & USB_DEVREQ_RECIPIENT_MASK; + + DBG(("ep0, new control request: type %x, code %x\n", req->type, req->request)); + DBG((" %s, length %d, value hi %x lo %x, index hi %x lo %x\n", + (USB_DEVREQ_DIRECTION_OUT == direction) ? "out" : "in", + length, req->value_hi, req->value_lo, req->index_hi, req->index_lo)); + + if (USB_DEVREQ_TYPE_STANDARD == protocol) { + + // First see if the request can be handled entirely in + // this module. + if (USB_DEVREQ_SET_ADDRESS == req->request) { + // The USB device address should be in value_lo. + // No more data is expected. + int old_state = ep0.common.state; + int address = req->value_lo; + if ((0 != length) || (address > 127)) { + result = USBS_CONTROL_RETURN_STALL; + } else { + *USBS_GMR = (*USBS_GMR & ~(USBS_GMR_FA_MASK | USBS_GMR_VT)) | (address << USBS_GMR_FA_SHIFT); FLUSH_IBUS(); + result = USBS_CONTROL_RETURN_HANDLED; + } + // Switch to addressed state, informing higher-level + // code of this. + if (USBS_STATE_ADDRESSED != (old_state & USBS_STATE_MASK)) { + ep0.common.state = USBS_STATE_ADDRESSED; + if ((void (*)(usbs_control_endpoint*, void*, usbs_state_change, int))0 != ep0.common.state_change_fn) { + (*ep0.common.state_change_fn)(&ep0.common, ep0.common.state_change_data, + USBS_STATE_CHANGE_ADDRESSED, old_state); + } + } + // End of SET_ADDRESS handling + } else if (USB_DEVREQ_GET_STATUS == req->request) { + // GET_STATUS on the device as a whole is used to + // check the remote-wakeup and self-powered bits. + // GET_STATUS on an endpoint is used to determine + // the halted condition. + // GET_STATUS on anything else has to be left to + // other code. + if (USB_DEVREQ_RECIPIENT_DEVICE == recipient) { + // The host should expect two bytes back. + if ((2 == length) && (USB_DEVREQ_DIRECTION_IN == direction)) { + ep0.common.control_buffer[0] = 0; // Not self-powered, no remote wakeup + ep0.common.control_buffer[1] = 0; + ep0.common.buffer = ep0.common.control_buffer; + ep0.common.buffer_size = 2; + result = USBS_CONTROL_RETURN_HANDLED; + } else { + result = USBS_CONTROL_RETURN_STALL; + } + + } else if (USB_DEVREQ_RECIPIENT_ENDPOINT == recipient) { + if ((2 == length) && (USB_DEVREQ_DIRECTION_IN == direction)) { + int endpoint = req->index_lo; + if (0 == endpoint) { + // get-status on endpoint 0 is either undefined or always valid. + // endpoint 0 is always up. + ep0.common.control_buffer[0] = 0; + result = USBS_CONTROL_RETURN_HANDLED; + } +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 + else if (((USB_DEVREQ_INDEX_DIRECTION_IN | 3) == endpoint) && + (USBS_STATE_CONFIGURED == (ep0.common.state & USBS_STATE_MASK))) { + ep0.common.control_buffer[0] = ep3.common.halted; + result = USBS_CONTROL_RETURN_HANDLED; + } +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP4 + else if (((USB_DEVREQ_INDEX_DIRECTION_OUT | 4) == endpoint) && + (USBS_STATE_CONFIGURED == (ep0.common.state & USBS_STATE_MASK))) { + ep0.common.control_buffer[0] = ep4.common.halted; + result = USBS_CONTROL_RETURN_HANDLED; + + } +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 + else if (((USB_DEVREQ_INDEX_DIRECTION_IN | 5) == endpoint) && + (USBS_STATE_CONFIGURED == (ep0.common.state & USBS_STATE_MASK))) { + ep0.common.control_buffer[0] = ep5.common.halted; + result = USBS_CONTROL_RETURN_HANDLED; + } +#endif + else { + // An invalid endpoint has been specified or the + // endpoint can only be examined in configured state. + result = USBS_CONTROL_RETURN_STALL; + } + if (USBS_CONTROL_RETURN_HANDLED == result) { + ep0.common.control_buffer[1] = 0; + ep0.common.buffer = ep0.common.control_buffer; + ep0.common.buffer_size = 2; + } + } else { + result = USBS_CONTROL_RETURN_STALL; + } + } // Endpoint or device get-status + + } else if (USB_DEVREQ_CLEAR_FEATURE == req->request) { + + // CLEAR_FEATURE operates in much the same way as + // GET_STATUS + if (USB_DEVREQ_RECIPIENT_DEVICE == recipient) { + + // No data should be transferred, and only remote-wakeup can be cleared. + if ((0 != length) || (USB_DEVREQ_FEATURE_DEVICE_REMOTE_WAKEUP != req->value_lo)) { + result = USBS_CONTROL_RETURN_STALL; + } else { + // Clearing remote-wakeup is a no-op. + result = USBS_CONTROL_RETURN_HANDLED; + } + + } else if (USB_DEVREQ_RECIPIENT_ENDPOINT == recipient) { + // The only feature that can be cleared is endpoint-halt, no data should be transferred. + if ((0 != length) || (USB_DEVREQ_FEATURE_ENDPOINT_HALT != req->value_lo)) { + result = USBS_CONTROL_RETURN_STALL; + } else { + int endpoint = req->index_lo; + if (0 == endpoint) { + // Clearing halt on endpoint 0 is always a no-op since that endpoint cannot be halted + } +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 + else if (((USB_DEVREQ_INDEX_DIRECTION_IN | 3) == endpoint) && + (USBS_STATE_CONFIGURED == (ep0.common.state & USBS_STATE_MASK))) { + ep3_set_halted(&ep3.common, false); + result = USBS_CONTROL_RETURN_HANDLED; + } +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP4 + else if (((USB_DEVREQ_INDEX_DIRECTION_OUT | 4) == endpoint) && + (USBS_STATE_CONFIGURED == (ep0.common.state & USBS_STATE_MASK))) { + ep4_set_halted(&ep4.common, false); + result = USBS_CONTROL_RETURN_HANDLED; + } +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 + else if (((USB_DEVREQ_INDEX_DIRECTION_IN | 5) == endpoint) && + (USBS_STATE_CONFIGURED == (ep0.common.state & USBS_STATE_MASK))) { + ep5_set_halted(&ep5.common, false); + result = USBS_CONTROL_RETURN_HANDLED; + } +#endif + else { + // Invalid endpoint or not in configured state. + result = USBS_CONTROL_RETURN_STALL; + } + } + } // Endpoing or device clear-feature + + } else if (USB_DEVREQ_SET_FEATURE == req->request) { + + // SET_FEATURE also operates in much the same way as + // GET_STATUS + if (USB_DEVREQ_RECIPIENT_DEVICE == recipient) { + // The only valid feature that can be set is remote-wakeup, + // which is not supported by this driver. + result = USBS_CONTROL_RETURN_STALL; + + } else if (USB_DEVREQ_RECIPIENT_ENDPOINT == recipient) { + + // Only the halt condition can be set, and no data should be transferred. + // Halting endpoint 0 should probably be disallowed although the + // standard does not explicitly say so. + if ((0 != length) || + (USB_DEVREQ_FEATURE_ENDPOINT_HALT != req->value_lo) || + (USBS_STATE_CONFIGURED != (ep0.common.state & USBS_STATE_MASK))) { + + result = USBS_CONTROL_RETURN_STALL; + + } else { + int endpoint = req->index_lo; + if (0) { + } +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 + else if ((USB_DEVREQ_INDEX_DIRECTION_IN | 3) == endpoint) { + ep3_set_halted(&ep3.common, true); + result = USBS_CONTROL_RETURN_HANDLED; + } +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP4 + else if ((USB_DEVREQ_INDEX_DIRECTION_OUT | 4) == endpoint) { + ep4_set_halted(&ep4.common, true); + result = USBS_CONTROL_RETURN_HANDLED; + } +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 + else if ((USB_DEVREQ_INDEX_DIRECTION_IN | 5) == endpoint) { + ep5_set_halted(&ep5.common, true); + result = USBS_CONTROL_RETURN_HANDLED; + } +#endif + else { + result = USBS_CONTROL_RETURN_STALL; + } + } + } // Endpoint or device set-feature + } + + // If the result has not been handled yet, pass it to + // the installed callback function (if any). + if (USBS_CONTROL_RETURN_UNKNOWN == result) { + if ((usbs_control_return (*)(usbs_control_endpoint*, void*))0 != ep0.common.standard_control_fn) { + result = (*ep0.common.standard_control_fn)(&ep0.common, ep0.common.standard_control_data); + } + } + + // If the result has still not been handled, leave it to + // the default implementation in the USB slave common place. + if (USBS_CONTROL_RETURN_UNKNOWN == result) { + result = usbs_handle_standard_control(&ep0.common); + } + } else { + // The other three types of control message can be + // handled by similar code. + usbs_control_return (*callback_fn)(usbs_control_endpoint*, void*); + void* callback_arg; + + if (USB_DEVREQ_TYPE_CLASS == protocol) { + callback_fn = ep0.common.class_control_fn; + callback_arg = ep0.common.class_control_data; + } else if (USB_DEVREQ_TYPE_VENDOR == protocol) { + callback_fn = ep0.common.vendor_control_fn; + callback_arg = ep0.common.vendor_control_data; + } else { + callback_fn = ep0.common.reserved_control_fn; + callback_arg = ep0.common.reserved_control_data; + } + + if ((usbs_control_return (*)(usbs_control_endpoint*, void*)) 0 == callback_fn) { + result = USBS_CONTROL_RETURN_STALL; + } else { + result = (*callback_fn)(&ep0.common, callback_arg); + } + } + + if (USBS_CONTROL_RETURN_HANDLED != result) { + // This control request cannot be handled. Generate a stall. + // These stalls will be cleared automaticaly by the next + // setup packet. + *EP0_CR |= (EP0_CR_ISS | EP0_CR_OSS); FLUSH_IBUS(); + } else { + // The control request has been handled. Is there any more + // data to be transferred? + if (0 == length) { + // Definitely start a receive for another control message + ep0_start_rx(8); + + // This operation is complete so we need to ack. It + // appears that the way to achieve this is to send a + // zero-byte packet. + ep0.tx_size = 0; + ep0_start_tx(); + + } else { + // Time to check the direction. + + if (USB_DEVREQ_DIRECTION_OUT == direction) { + // The host expects to send more data. Higher-level code + // should have provided an appropriate buffer. + CYG_ASSERT( (unsigned char*) 0 != ep0.common.buffer, "A receive buffer should have been provided"); + CYG_ASSERT( (usbs_control_return (*)(usbs_control_endpoint*, int))0 != ep0.common.complete_fn, \ + "A completion function should be provided for OUT control messages"); + CYG_ASSERT(length <= CYGNUM_DEVS_USB_UPD985XX_EP0_RXBUFSIZE, "Insufficient buffer space configured"); + + ep0.rx_expecting_data = true; + ep0_start_rx(length); + } else { + // The host expects to be able to read some data. + // This needs to go into a single contiguous + // buffer, and then the transfer can be started. + // Care has to be taken with various boundary conditions. + int actual_length = ep0_fill_txbuffer(); + if (actual_length > length) { + actual_length = length; + } + if ((length != actual_length) && (0 == (actual_length % 8))) { + ep0.tx_needs_zero_transfer = true; + } else { + ep0.tx_needs_zero_transfer = false; + } + ep0.tx_size = actual_length; + ep0_start_tx(); + + // And make sure that there is another receive in progress + // for the next setup packet. + ep0_start_rx(8); + } + } + } // Control message handled + } +} + +// Endpoint 0 initialization also takes care of initializing generic bits +// of the USB controller, for example letting through resume and suspend +// interrupts and setting up the mailboxes. Also, it is necessary to +// start a receive operation so that the first control message can +// be processed. This code gets called during device driver initialization +// and after a reset from the host. +static void +ep0_init(void) +{ + // Reset the various fields in the ep0 structure. + ep0.common.buffer = (unsigned char*) 0; + ep0.common.buffer_size = 0; + ep0.common.fill_buffer_fn = (void (*)(usbs_control_endpoint*)) 0; + ep0.common.fill_data = (void*) 0; + ep0.common.fill_index = 0; + ep0.common.complete_fn = (usbs_control_return (*)(usbs_control_endpoint*, int)) 0; + ep0.rx_expecting_data = false; + ep0.tx_indicator_valid = false; + ep0.rx_indicator_valid = false; + ep0.tx_needs_zero_transfer = false; + +#ifdef CYGIMP_DEVS_USB_UPD985XX_SERIALIZE_TRANSMITS + tx_in_progress = false; + ep0_tx_pending = false; +# ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 + ep3_tx_pending = false; +# endif +# ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 + ep5_tx_pending = false; +# endif +#endif + + // The general mode register. We do not have an address yet. The + // SOFINTVL field needs to be set to its default value. The other + // bits should be zero for now. + *USBS_GMR = USBS_GMR_SOFINTVL_DEFAULT_VALUE; FLUSH_IBUS(); + + // The version register and the status registers are read-only. + + // Interrupt masks. Endpoint 0 transmits and receives both have + // to be detected, as do the control operations. There should + // be no need to worry about full mailboxes or empty receive + // pools. DMA errors might be of interest, but it is not clear + // what to do about them since there does not appear to be + // a way of figuring out which transfer is affected. Frame number + // and addressing problems are ignored, there is nothing obvious + // that can be done about these. The other endpoints have their + // own initialization routines. + // + // Care has to be taken with reset interrupts. With some hardware + // the usb lines may be left floating during initialization, so + // the chip believes it sees continuous reset interrupts. There + // also appear to be problems if the host does generate a real + // reset signal, with interrupt storms lasting 10 or more + // milliseconds and preventing any other activity from taking + // place. What is done here is that reset interrupts are enabled + // if in the initial POWERED state. When a reset is detected, + // either a spurious one or a real reset from the host, + // handle_reset() will move the target to DEFAULT state, call + // ep0_init() again, and reset interrupts will be masked out. + // When a real control request is received from the host we + // know we have a good connection and the reset interrupt will + // be unmasked in ep0_rx_dsr(), so further resets from the + // host will be processed correctly. If the target is disconnected + // then we may again get a spurious reset interrupt, so we end + // up back in DEFAULT state and the reset interrupt would be + // masked again. + *USBS_IMR1 = IBUS_SWAP32(USBS_GSR1_GSR2 | USBS_GSR1_EP0TF | USBS_GSR1_EP0RF); FLUSH_IBUS(); + usbs_upd985xx_gsr1_mask = (USBS_GSR1_EP0TF | USBS_GSR1_EP0RF); + if (USBS_STATE_DEFAULT == (ep0.common.state & USBS_STATE_MASK)) { + *USBS_IMR2 = IBUS_SWAP32(USBS_GSR2_URSM | USBS_GSR2_USPD); FLUSH_IBUS(); + usbs_upd985xx_gsr2_mask = (USBS_GSR2_URSM | USBS_GSR2_USPD); + } else { + *USBS_IMR2 = IBUS_SWAP32(USBS_GSR2_URSM | USBS_GSR2_URST | USBS_GSR2_USPD); FLUSH_IBUS(); + usbs_upd985xx_gsr2_mask = (USBS_GSR2_URSM | USBS_GSR2_URST | USBS_GSR2_USPD); + } + + // Writing to the command register is a bad idea, because even + // writing 0 constitutes a command. Similarly there is no point + // in writing to the command address register. + + // The endpoint status register is read-only. + + // Set the rx pool information registers to disable alerts. + *USBS_RP0IR = IBUS_SWAP32(USBS_RPxIR_AL_NONE); FLUSH_IBUS(); + *USBS_RP1IR = IBUS_SWAP32(USBS_RPxIR_AL_NONE); FLUSH_IBUS(); + *USBS_RP2IR = IBUS_SWAP32(USBS_RPxIR_AL_NONE); FLUSH_IBUS(); + + // The pool address registers are read-only. The documentation + // that describes initialization says that these registers need to + // be filled in, but that seems wrong: providing receive buffers + // involves the command register. Presumably on early revisions it + // was necessary to fill in the address register. + + // Sort out the mailboxes. + *USBS_TMSA = IBUS_SWAPPTR(TxMailbox, &(uncached->tx_mboxes[0])); FLUSH_IBUS(); + *USBS_TMBA = IBUS_SWAPPTR(TxMailbox, &(uncached->tx_mboxes[TXMBOX_COUNT])); FLUSH_IBUS(); + *USBS_RMSA = IBUS_SWAPPTR(RxMailbox, &(uncached->rx_mboxes[0])); FLUSH_IBUS(); + *USBS_RMBA = IBUS_SWAPPTR(RxMailbox, &(uncached->rx_mboxes[RXMBOX_COUNT])); FLUSH_IBUS(); + // It is not clear whether these registers actually need to be initialized. + // The documentation suggests that they do, unlike TMWA and RMWA which + // are taken care of by the hardware. +#if 0 + *USBS_TMRA = IBUS_SWAPPTR(TxMailbox, &(uncached->tx_mboxes[0])); FLUSH_IBUS(); + *USBS_RMRA = IBUS_SWAPPTR(RxMailbox, &(uncached->rx_mboxes[0])); FLUSH_IBUS(); +#endif + + // Start a receive operation for a control message. + ep0_start_rx(8); + + // The endpoint 0 control register. Sticking with the default + // 8-byte packet size seems like a good idea. Setting the + // enabled bit here affects the state as seen by the host. + *EP0_CR = IBUS_SWAP32(EP0_CR_EP0EN | 8); FLUSH_IBUS(); + + // The other endpoint registers will be initialized by the appropriate + // _init() functions. Note that those other _init() functions should + // probably be called before the ep0-enabled bit is set. +} + +// ---------------------------------------------------------------------------- +// Endpoint 1 - isochronous transmits. +#if 0 +// A real implementation +#else +static inline void +ep1_init(void) +{ + *EP1_CR = IBUS_SWAP32(0); // Clear EP1EN bit, thus disabling the endpoint + FLUSH_IBUS(); +} +#endif + +// ---------------------------------------------------------------------------- +// Endpoint 2 - isochronous receives +#if 0 +// A real implementation +#else +static inline void +ep2_init(void) +{ + *EP2_CR = IBUS_SWAP32(0); // Clear EP2EN bit, thus disabling the endpoint + FLUSH_IBUS(); +} +#endif + +// ---------------------------------------------------------------------------- +// Generic transmit support. This is intended for use with both endpoints +// 3 and 5. For now the endpoint 0 code is too different. + +#if defined(CYGPKG_DEVS_USB_UPD985XX_EP3) || defined(CYGPKG_DEVS_USB_UPD985XX_EP5) + +// A utility routine for completing a transfer. This takes care of the +// callback as well as resetting the buffer. +static void +ep35_tx_complete(ep35_impl* ep, int result) +{ + void (*complete_fn)(void*, int) = ep->common.complete_fn; + void* complete_data = ep->common.complete_data; + + ep->common.buffer = (unsigned char*) 0; + ep->common.buffer_size = 0; + ep->common.complete_fn = (void (*)(void*, int)) 0; + ep->common.complete_data = (void*) 0; + + if ((void (*)(void*, int))0 != complete_fn) { + (*complete_fn)(complete_data, result); + } +} + +static void +ep35_start_tx(ep35_impl* ep) +{ + // Is this endpoint currently stalled? If so then a size of 0 can + // be used to block until the stall condition is clear, anything + // else should result in an immediate callback. + if (ep->common.halted) { + if (0 != ep->common.buffer_size) { + ep35_tx_complete(ep, -EAGAIN); + } + } else if (0 == ep->common.buffer_size) { + // A check to see if the endpoint is halted. It isn't. + ep35_tx_complete(ep, 0); + } else { + cyg_uint32 send_command; +#if 0 + diag_printf("Tx: %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep->common.buffer[0], ep->common.buffer[1], ep->common.buffer[2], ep->common.buffer[3], + ep->common.buffer[4], ep->common.buffer[5], ep->common.buffer[6], ep->common.buffer[7]); + diag_printf(" %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep->common.buffer[8], ep->common.buffer[9], ep->common.buffer[10], ep->common.buffer[11], + ep->common.buffer[12], ep->common.buffer[13], ep->common.buffer[14], ep->common.buffer[15]); + diag_printf(" %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep->common.buffer[16], ep->common.buffer[17], ep->common.buffer[18], ep->common.buffer[19], + ep->common.buffer[20], ep->common.buffer[21], ep->common.buffer[22], ep->common.buffer[23]); + diag_printf(" %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep->common.buffer[24], ep->common.buffer[25], ep->common.buffer[26], ep->common.buffer[27], + ep->common.buffer[28], ep->common.buffer[29], ep->common.buffer[30], ep->common.buffer[31]); + diag_printf(" %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep->common.buffer[32], ep->common.buffer[33], ep->common.buffer[34], ep->common.buffer[35], + ep->common.buffer[36], ep->common.buffer[37], ep->common.buffer[38], ep->common.buffer[39]); + diag_printf(" %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep->common.buffer[40], ep->common.buffer[41], ep->common.buffer[42], ep->common.buffer[43], + ep->common.buffer[44], ep->common.buffer[45], ep->common.buffer[46], ep->common.buffer[47]); +#endif + + // Update the static buffer descriptor. + ep->tx_bufdesc->buffer = MIPS_TO_UNCACHED(ep->common.buffer); + ep->tx_bufdesc->control = ep->common.buffer_size | TXBUFDESC_CTRL_LAST | TXBUFDESC_CTRL_BUFDESC_BUFDESC; + + // Make sure that the entire transmit buffer is flushed to + // memory. + HAL_DCACHE_STORE(ep->common.buffer, ep->common.buffer_size); + + // Issue the send command. It is known that no transmits are + // in progress for this endpoint so the upper bound of 2 + // pending transmits can be ignored. The send command involves + // writing to two registers in succession, so interrupts had + // better be disabled while doing this. + send_command = ep->send_command | ep->common.buffer_size; + cyg_drv_isr_lock(); + while (0 != (*USBS_CMR & IBUS_SWAP32(USBS_CMR_BUSY))) { + // Do nothing: this situation should be short-lived. + } + *USBS_CA = IBUS_SWAPPTR(void, (void*)ep->tx_bufdesc); FLUSH_IBUS(); + *USBS_CMR = IBUS_SWAP32(send_command); FLUSH_IBUS(); + cyg_drv_isr_unlock(); + } +} + +// The stalled state is controlled by a single bit in the appropriate +// control register. However there is a problem in that it is not +// possible to abort a transmission that is already going out. +// Furthermore there is no way of detecting whether or not any +// packets have already gone out for this transfer: setting the halt +// bit before any data has gone out is reasonably ok, doing so +// in the middle of a transfer could be confusing. +// +// The approach taken here is to check whether or not there is a +// current tx buffer. If not then the stall bit can be set immediately. +// Otherwise the halted flag is set here, and it is left to the dsr +// to set the stall bit when the transfer completes. This may not +// be totally standards-compliant, but is probably the best solution +// for now. +static void +ep35_set_halted(ep35_impl* ep, cyg_bool new_value) +{ + if (ep->common.halted == new_value) { + return; + } + + // Avoid race conditions with the DSR updating the buffer fields. + cyg_drv_dsr_lock(); + + if (new_value ){ + // Set the halted flag to prevent further transmits, and if + // there is no transmission currently in progress then set + // the stalled bit immediately. + ep->common.halted = true; + if ((void*)0 == ep->common.buffer) { + *(ep->cr) |= IBUS_SWAP32(EPtx_CR_SSx); FLUSH_IBUS(); + } + } else { + // Update the hardware (that may be a no-op if the stalled bit + // never got set by the DSR), and clear the halted flag. + *(ep->cr) &= IBUS_SWAP32(~EPtx_CR_SSx); FLUSH_IBUS(); + ep->common.halted = false; + + // If there is a pending request to wait until the endpoint stall + // condition is clear, inform higher-level code. This test may + // give false positives but those would be harmless. + if (0 == ep->common.buffer_size) { + ep35_tx_complete(ep, 0); + } + } + + cyg_drv_dsr_unlock(); +} + +// An interrupt has occured related to endpoint 3 or 5 - i.e. the EP3TF +// or EP5TF interrupts, nothing else seems especially relevant. It is +// necessary to extract the appropriate send indicator from the tx +// mailbox to determine whether or not the transmission was successful +// and report status to higher-level code. +static void +ep35_dsr(ep35_impl* ep) +{ + TxMailbox mbox; + + // Extract the transmit indicator if that has not happened + // already courtesy of another DSR. + if (!ep->tx_indicator_valid) { + drain_tx_mailbox(); + if (!ep->tx_indicator_valid) { + // A transmit interrupt when there does not appear to be + // any data? + CYG_FAIL("ep35_dsr invoked when there is no valid tx indicator"); + return; + } + } + mbox = ep->tx_indicator; + ep->tx_indicator_valid = false; + +#ifdef CYGIMP_DEVS_USB_UPD985XX_EP5_BULK + // If emulating bulk transfers over the interrupt endpoint, and + // the transfer is an exact multiple of 64 bytes, then an extra + // zero-byte terminating packet needs to be sent. Care has to be + // taken to do this only once. + if ( (ep == &ep5) && (0 == (ep5.common.buffer_size % 64)) ) { + static cyg_bool sending_zero = false; + if (!sending_zero) { + sending_zero = true; + uncached->ep5_tx_bufdesc.buffer = uncached->ep0_tx_buffer; + uncached->ep5_tx_bufdesc.control = 0 | TXBUFDESC_CTRL_LAST | TXBUFDESC_CTRL_BUFDESC_BUFDESC; + cyg_drv_isr_lock(); + while (0 != (*USBS_CMR & IBUS_SWAP32(USBS_CMR_BUSY))) { + // Do nothing: this situation should be short-lived. + } + *USBS_CA = IBUS_SWAPPTR(void, (void*) &(uncached->ep5_tx_bufdesc)); FLUSH_IBUS(); + *USBS_CMR = IBUS_SWAP32(USBS_CMR_COMMAND_TX_EP5 | 0); FLUSH_IBUS(); + cyg_drv_isr_unlock(); + + // Do not complete the transfer. Instead completion has to + // wait for another interrupt. + return; + } else { + // This interrupt was for the zero-byte packet, so drop through + sending_zero = false; + } + } +#endif + + // If the endpoint should be halted but there was a transmit + // in progress, update the hardware now. + if (ep->common.halted) { + *(ep->cr) |= IBUS_SWAP32(EPtx_CR_SSx); FLUSH_IBUS(); + } + + // Allow any blocked transmits to proceed. + TX_UNLOCK(); + + if (0 != (mbox.status & TXMBOX_STATUS_IBUS_ERROR)) { + // This appears to be the only type of error that can be + // detected. Possibly the transmit should be retried here + // rather than reported. + ep35_tx_complete(ep, -EPIPE); + } else { + ep35_tx_complete(ep, ep->common.buffer_size); + } +} +#endif // Endpoints 3 or 5 + +// ---------------------------------------------------------------------------- +// Endpoint 3 - bulk transmits. + +# ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 +static void +ep3_start_tx(usbs_tx_endpoint* endpoint) +{ + CYG_ASSERT( endpoint == &ep3.common, "USB data transfer involves the wrong endpoint"); + CYG_ASSERT( ep3.common.buffer_size < (64 * 1024), "Specified transfer size too large for current implementation"); + if (TX_TRY_LOCK(&ep3_tx_pending)) { + ep35_start_tx(&ep3); + } +} + +static void +ep3_set_halted(usbs_tx_endpoint* endpoint, cyg_bool new_value) +{ + CYG_ASSERT(endpoint = &ep3.common, "USB set-stall operation involves the wrong endpoint"); + ep35_set_halted(&ep3, new_value); +} + +// Initialization. This gets called during the device driver +// initialization and after a reset. The main job is to initialize the +// EP3 control register, but the relevant bits of the interrupt mask +// are set here as well. The tx mailboxes are shared with other +// endpoints, so that is handled by ep0_init(). Any traffic that +// happened before the reset needs to be cleaned up. +static void +ep3_init(void) +{ + // Assume 64 byte packets, terminate transfers with a zero-byte packet + // if necessary since this endpoint is used for bulk transfers. + *EP3_CR = IBUS_SWAP32(EP3_CR_EP3EN | EP3_CR_TM3_SZLP | 64); FLUSH_IBUS(); + *USBS_IMR1 |= IBUS_SWAP32(USBS_GSR1_EP3TF); FLUSH_IBUS(); + usbs_upd985xx_gsr1_mask |= IBUS_SWAP32(USBS_GSR1_EP3TF); + ep3.common.halted = false; + ep3.tx_indicator_valid = false; + ep3.tx_bufdesc = &(uncached->ep3_tx_bufdesc); + ep35_tx_complete(&ep3, -EPIPE); +} +#else +static inline void +ep3_init(void) +{ + *EP3_CR = 0; // Clear EP3EN bit, thus disabling the endpoint + FLUSH_IBUS(); +} +# endif // Endpoint 3 configured in + +// ---------------------------------------------------------------------------- +// Repeat for endpoint 5 +# ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 + +static void +ep5_start_tx(usbs_tx_endpoint* endpoint) +{ + CYG_ASSERT( endpoint == &ep5.common, "USB data transfer involves the wrong endpoint"); +#ifdef CYGIMP_DEVS_USB_UPD985XX_EP5_BULK + CYG_ASSERT( ep5.common.buffer_size < (64 * 1024), "Specified transfer size too large for current implementation"); +#else + CYG_ASSERT( ep5.common.buffer_size <= 64, "Specified transfer size too large for current implementation"); +#endif + if (TX_TRY_LOCK(&ep5_tx_pending)) { + ep35_start_tx(&ep5); + } +} + +static void +ep5_set_halted(usbs_tx_endpoint* endpoint, cyg_bool new_value) +{ + CYG_ASSERT(endpoint = &ep5.common, "USB set-stall operation involves the wrong endpoint"); + ep35_set_halted(&ep5, new_value); +} + +// Initialization. This gets called during the device driver +// initialization and after a reset. The main job is to initialize the +// EP5 control register, but the relevant bits of the interrupt mask +// are set here as well. The tx mailboxes are shared with other +// endpoints, so that is handled by ep0_init(). Any traffic that +// happened before the reset needs to be cleaned up. +static void +ep5_init(void) +{ + // Assume 64 byte packets, terminate transfers with a zero-byte packet + // if necessary since this endpoint is used for bulk transfers. + *EP5_CR = IBUS_SWAP32(EP5_CR_EP5EN | 64); FLUSH_IBUS(); + *USBS_IMR1 |= IBUS_SWAP32(USBS_GSR1_EP5TF); FLUSH_IBUS(); + usbs_upd985xx_gsr1_mask |= IBUS_SWAP32(USBS_GSR1_EP5TF); + ep5.common.halted = false; + ep5.tx_indicator_valid = false; + ep5.tx_bufdesc = &(uncached->ep5_tx_bufdesc); + ep35_tx_complete(&ep5, -EPIPE); +} +#else +static inline void +ep5_init(void) +{ + *EP5_CR = 0; // Clear EP5EN bit, thus disabling the endpoint + FLUSH_IBUS(); +} +#endif // Endpoint 5 configured in + + +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP4 +// ---------------------------------------------------------------------------- +// Endpoint 4 - bulk receives. +// +// Bulk receives are mostly straightforward, but the cache does involve +// a complication. The assumption is that the receive buffer will be in +// cached memory, and is unlikely to be cacheline-aligned. Clearly the bulk +// of the buffer has to be invalidated. However the receive buffer may share +// some cache lines with other data at the head and tail, and invalidating +// those would be wrong. +// +// The solution here is to split up a receive in to up to three areas, +// head, main, and tail, where the head and tail are statically +// allocated in uncached memory. Any one or two of these areas may be +// unused, depending on alignment and transfer size. The main area +// corresponds to the central section of the supplied receive buffer, +// will be cacheline-aligned, and invalidated at the start of a receive. +// Data will be copied from the head and tail areas into the receive +// buffer by the dsr on completion of the transfer. +// +// There are additional complications caused by the hardware's need for +// linked buffers. + +static void +ep4_rx_complete(int result) +{ + void (*complete_fn)(void*, int) = ep4.common.complete_fn; + void* complete_data = ep4.common.complete_data; + +#if 0 + *EP4_CR = IBUS_SWAP32(EP4_CR_EP4EN | EP4_CR_RM4_ASSEMBLE | EP4_CR_NAK4 | 64); FLUSH_IBUS(); +#endif + +#if 0 + if (result > 0) { + diag_printf("Rx: %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep4.common.buffer[0], ep4.common.buffer[1], ep4.common.buffer[2], ep4.common.buffer[3], + ep4.common.buffer[4], ep4.common.buffer[5], ep4.common.buffer[6], ep4.common.buffer[7]); + diag_printf(" %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep4.common.buffer[8], ep4.common.buffer[9], ep4.common.buffer[10], ep4.common.buffer[11], + ep4.common.buffer[12], ep4.common.buffer[13], ep4.common.buffer[14], ep4.common.buffer[15]); + diag_printf(" %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep4.common.buffer[16], ep4.common.buffer[17], ep4.common.buffer[18], ep4.common.buffer[19], + ep4.common.buffer[20], ep4.common.buffer[21], ep4.common.buffer[22], ep4.common.buffer[23]); + diag_printf(" %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep4.common.buffer[24], ep4.common.buffer[25], ep4.common.buffer[26], ep4.common.buffer[27], + ep4.common.buffer[28], ep4.common.buffer[29], ep4.common.buffer[30], ep4.common.buffer[31]); + diag_printf(" %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep4.common.buffer[32], ep4.common.buffer[33], ep4.common.buffer[34], ep4.common.buffer[35], + ep4.common.buffer[36], ep4.common.buffer[37], ep4.common.buffer[38], ep4.common.buffer[39]); + diag_printf(" %02x %02x %02x %02x %02x %02x %02x %02x\n", + ep4.common.buffer[40], ep4.common.buffer[41], ep4.common.buffer[42], ep4.common.buffer[43], + ep4.common.buffer[44], ep4.common.buffer[45], ep4.common.buffer[46], ep4.common.buffer[47]); + } +#endif + + ep4.common.buffer = (unsigned char*) 0; + ep4.common.buffer_size = 0; + ep4.common.complete_fn = (void (*)(void*, int)) 0; + ep4.common.complete_data = (void*) 0; + + if ((void (*)(void*, int))0 != complete_fn) { + (*complete_fn)(complete_data, result); + } +} + +static void +ep4_start_rx(usbs_rx_endpoint* ep) +{ + CYG_ASSERT( ep == &ep4.common, "USB data transfer involves the wrong endpoint"); + + // Is this endpoint currently stalled? If so then a size of 0 can + // be used to block until the stall condition is clear, anything + // else should result in an immediate callback. + if (ep4.common.halted) { + if (0 != ep4.common.buffer_size) { + ep4_rx_complete(-EAGAIN); + } + } else if (0 == ep4.common.buffer_size) { + // A check to see if the endpoint is halted. It isn't. + ep4_rx_complete(0); + } else { + + // Time to work out how much data should go into the uncached + // head and tail buffers, how much can go directly into the + // receive buffer, how much memory needs to be invalidated, and so on. + cyg_uint32 buffer_arith; + + // Where to start filling in buffer descriptors. + cyg_uint32 first_bufdesc; + + // And the current buffer descriptor. + cyg_uint32 current_bufdesc; + + CYG_ASSERT( ep4.common.buffer_size < (64 * 1024), "Specified transfer size too large for current implementation"); + + // If there has not been a receive operation, tail_index + // will still be set to -1. Otherwise it will be somewhere + // between 1 and 3, or between 5 and 7, depending on + // whether the previous receive operation used the + // first four buffer descriptors or the last four. + if (ep4.tail_index < 4) { + first_bufdesc = 4; + } else { + first_bufdesc = 0; + } + current_bufdesc = first_bufdesc; + + // Arithmetic, especially remainder operators, requires + // integers rather than a pointer. + buffer_arith = (cyg_uint32) ep4.common.buffer; + + // The size of the "head" area. This involves up to + // (cacheline-1) bytes, so that the main receive buffer + // is suitably aligned. + ep4.head_size = ((buffer_arith + HAL_DCACHE_LINE_SIZE - 1) & ~(HAL_DCACHE_LINE_SIZE - 1)) - buffer_arith; + if (ep4.head_size > ep4.common.buffer_size) { + ep4.head_size = ep4.common.buffer_size; + } + if (0 < ep4.head_size) { + // It is necessary to receive some data into the uncached head area. + uncached->ep4_rx_bufdescs[current_bufdesc].buffer = uncached->ep4_head; + uncached->ep4_rx_bufdescs[current_bufdesc].control = RXBUFDESC_CTRL_BUFDESC_BUFDESC | ep4.head_size; + current_bufdesc++; + } + + // Now for the size of the main area. This is the rest of the + // transfer size, minus the tail area. + ep4.direct_size = ep4.common.buffer_size - ep4.head_size; + ep4.direct_size &= ~(HAL_DCACHE_LINE_SIZE - 1); + if (ep4.direct_size > 0) { + uncached->ep4_rx_bufdescs[current_bufdesc].buffer = MIPS_TO_UNCACHED(ep4.common.buffer + ep4.head_size); + uncached->ep4_rx_bufdescs[current_bufdesc].control = RXBUFDESC_CTRL_BUFDESC_BUFDESC | ep4.direct_size; + current_bufdesc++; + HAL_DCACHE_INVALIDATE(ep4.common.buffer + ep4.head_size, ep4.direct_size); + } + + // And the size of the tail. This is the transfer size minus what we have accumulated so far. + ep4.tail_size = ep4.common.buffer_size - (ep4.head_size + ep4.direct_size); + if (ep4.tail_size > 0) { + uncached->ep4_rx_bufdescs[current_bufdesc].buffer = uncached->ep4_tail; + uncached->ep4_rx_bufdescs[current_bufdesc].control = RXBUFDESC_CTRL_BUFDESC_BUFDESC | ep4.tail_size; + current_bufdesc++; + } + + // Or the LAST bit into the last of these buffer descriptors. + uncached->ep4_rx_bufdescs[current_bufdesc - 1].control |= RXBUFDESC_CTRL_LAST; + + // Turn the current one into a link descriptor. + uncached->ep4_rx_bufdescs[current_bufdesc].control = RXBUFDESC_CTRL_BUFDESC_LINK; + uncached->ep4_rx_bufdescs[current_bufdesc].buffer = 0; + + // The buffer descriptors have now been sorted out. Time to + // add this receive buffer to the pool. Atomicity becomes + // important for some of these steps. + cyg_drv_isr_lock(); + + // Update the link pointer used for the last receive operation + // to point at the new set of buffer descriptors. + if (-1 != ep4.tail_index) { + uncached->ep4_rx_bufdescs[ep4.tail_index].buffer = (void*) &(uncached->ep4_rx_bufdescs[first_bufdesc]); + } + + // Keep track of the link pointer used for the last receive + // operation. + ep4.tail_index = current_bufdesc; + + while (0 != (*USBS_CMR & IBUS_SWAP32(USBS_CMR_BUSY))) { + // Do nothing: this situation should be short-lived. + } + *USBS_CA = IBUS_SWAPPTR(void, (void*)&(uncached->ep4_rx_bufdescs[first_bufdesc])); FLUSH_IBUS(); + *USBS_CMR = IBUS_SWAP32(USBS_CMR_COMMAND_ADD_POOL2 | 1); FLUSH_IBUS(); +#if 0 + *EP4_CR = IBUS_SWAP32(EP4_CR_EP4EN | EP4_CR_RM4_ASSEMBLE | 64); FLUSH_IBUS(); +#endif + cyg_drv_isr_unlock(); + } +} + +// The stalled state is controlled by a single bit in the appropriate +// control register. When it comes to ongoing receives, the reasoning +// here is much the same as for ep3_set_halted(). Arguably this is not +// quite right. set_halted() is most likely to be called in response +// to a control request from the host, and the host is unlikely to +// transmit any data at the same time as making this request. Hence the +// host will see the wrong behaviour: it can still make one transfer +// after asking for the stalled bit to be set. Since there does not +// appear to be any way to cancel a supplied receive, this behaviour +// still seems the most sensible. +static void +ep4_set_halted(usbs_rx_endpoint* ep, cyg_bool new_state) +{ + CYG_ASSERT(ep == &ep4.common, "USB set-stall operation involves the wrong endpoint"); + + if (ep4.common.halted == new_state) { + return; + } + + // Avoid race conditions with the DSR updating the buffer fields. + cyg_drv_dsr_lock(); + + if (new_state){ + // Set the halted flag to prevent further transmits, and if + // there is no receive currently in progress then set + // the stalled bit immediately. + ep4.common.halted = true; + if ((void*)0 == ep4.common.buffer) { + *EP4_CR |= IBUS_SWAP32(EP4_CR_SS4); FLUSH_IBUS(); + } + } else { + // Update the hardware (that may be a no-op if the stalled bit + // never got set by the DSR), and clear the halted flag. + *EP4_CR &= IBUS_SWAP32(~EP4_CR_SS4); FLUSH_IBUS(); + ep4.common.halted = false; + + // If there is a pending request to wait until the endpoint stall + // condition is clear, inform higher-level code. This test may + // give false positives but those would be harmless. + if (0 == ep4.common.buffer_size) { + ep4_rx_complete(0); + } + } + + cyg_drv_dsr_unlock(); +} + +// An interrupt has occured related to endpoint 4 - i.e. the EP4RF +// interrupt, nothing else seems especially relevant. The ISR will +// have set the NAK bit in the control register. It is necessary to +// extract the appropriate receive indicator from the rx mailbox to +// determine whether or not the transmission was successful and how +// much data was actually received, clear the interrupt bit, and +// report status to higher-level code. +static void +ep4_dsr(void) +{ + // Extract the transmit indicator if that has not happened + // already courtesy of another DSR. + if (!ep4.rx_indicator_valid) { + drain_rx_mailbox(); + if (!ep4.rx_indicator_valid) { + // A receive interrupt when there does not appear to be + // any data? It appears that this can happen when there + // are error conditions. +#if 1 + CYG_FAIL("EP4_DSR invoked when there is no valid rx indicator"); +#endif + return; + } + } + ep4.rx_indicator_valid = false; + + // If the endpoint should be halted but there was a transmit + // in progress, update the hardware now. + if (ep4.common.halted) { + *EP4_CR |= IBUS_SWAP32(EP4_CR_SS4); FLUSH_IBUS(); + } + if (0 != (ep4.rx_indicator.status & (RXMBOX_STATUS_IBUS_ERROR | 0))) { + // This appears to be the only type of error that can be + // detected. Everything else gets retried by the hardware, + // except when using the isochronous endpoint. + ep4_rx_complete(-EPIPE); + } else { + cyg_uint32 actual_size = ep4.rx_indicator.status & RXMBOX_STATUS_SIZE_MASK; + + // Either the transfer size must match the requested size, or the + // supplied buffer should have been aligned to cacheline boundaries. + // Anything else risks leaving the receive pool in a confused + // state and there is no way of cleaning things up. + CYG_ASSERT((actual_size == ep4.common.buffer_size) || ((0 == ep4.head_size) && (0 == ep4.tail_size)), \ + "Buffers should be cacheline aligned if the protocol involves partial transfers"); + + // If there was some data in the head, move it from uncached + // to cached. Ditto for tail. Note that these copies may be + // for data that has not actually been transferred if the + // actual transfer is less than expected, but overwriting bits + // of the receive buffer in such circumstances should be + // harmless. + if (ep4.head_size > 0) { + memcpy(ep4.common.buffer, uncached->ep4_head, ep4.head_size); + } + if (ep4.tail_size > 0) { + memcpy(ep4.common.buffer + ep4.head_size + ep4.direct_size, uncached->ep4_tail, ep4.tail_size); + } + ep4_rx_complete(actual_size); + } +} + +// Initialization. This gets called during the device driver +// initialization and after a reset. The main job is to initialize the +// EP4 control register, but the relevant bits of the interrupt mask +// are set here as well. The rx mailboxes are shared with other +// endpoints, so that is handled by ep0_init(). Any traffic that +// happened before the reset needs to be cleaned up. +static void +ep4_init(void) +{ + // Assume 64 byte packets, and use assemble mode so that we get a + // single rx indication per transfer. In practice the buffer + // directory will only ever contain one entry so there should be + // no discernible difference between normal, assemble, or separate + // mode. +#if 0 + *EP4_CR = IBUS_SWAP32(EP4_CR_EP4EN | EP4_CR_RM4_ASSEMBLE | EP4_CR_NAK4 | 64); FLUSH_IBUS(); +#else + *EP4_CR = IBUS_SWAP32(EP4_CR_EP4EN | EP4_CR_RM4_ASSEMBLE | 64); FLUSH_IBUS(); +#endif + + *USBS_IMR1 |= IBUS_SWAP32(USBS_GSR1_EP4RF); FLUSH_IBUS(); + usbs_upd985xx_gsr1_mask |= USBS_GSR1_EP4RF; + ep4.common.halted = false; + ep4.rx_indicator_valid = false; + ep4.tail_index = -1; + ep4_rx_complete(-EPIPE); +} +#else +static inline void +ep4_init(void) +{ + *EP4_CR = 0; // Clear EP4EN bit, thus disabling the endpoint + FLUSH_IBUS(); +} +#endif // Endpoint 4 configured in + +// ---------------------------------------------------------------------------- +// Endpoint 6 - interrupt receives +#if 0 +// A real implementation +#else +static inline void +ep6_init(void) +{ + *EP6_CR = 0; // Clear EP6EN bit, thus disabling the endpoint + FLUSH_IBUS(); +} +#endif + +// ---------------------------------------------------------------------------- +// Make sure the hardware is in a known state by completely resetting +// the USB controller. This gets called during device driver +// initialization, and again whenever the host issues a reset signal. +// The previous state is unknown. Even during eCos initialization +// RedBoot may have involved USB I/O, or some POST code may have +// performed loopback tests. The various endpoint init routines will +// also perform software resets as appropriate. + +static void +usbs_upd985xx_handle_reset(void) +{ + // Reset the USB hardware. This involves poking the warm reset + // register and then polling the matching status register. It is + // assumed that this poll will take a short time, and in practice + // the loop appears to terminate immediately. + *S_WRCR = S_WRCR_USBWR; FLUSH_IBUS(); + while (0 == (*S_WRSR & S_WRCR_USBWR)) { + // Do nothing. + } + + // Get all the endpoints into a known state - for disabled + // endpoints these init calls are inlined and just disable the + // relevant hardware. + ep0_init(); + ep1_init(); + ep2_init(); + ep3_init(); + ep4_init(); + ep5_init(); + ep6_init(); +} + +// ---------------------------------------------------------------------------- +// Start(). This is typically called by the application itself once +// everything else has been initialized, i.e. when the host should be +// able to start talking to this device. There is no actual bit in the +// chip itself to switch the USB pins from tri-state, so instead the +// platform HAL has to supply appropriate functionality. In the absence +// of such functionality things will only work if you start up eCos +// with the USB cable disconnected, then plug in the cable once +// start() has been called. +// +// The device driver initialization will have already set up the +// hardware, and the first action from the host should be a reset +// signal which will cause a re-initialization. There is no need +// to do anything else here. + +static void +usbs_upd985xx_ep0_start(usbs_control_endpoint* endpoint) +{ + CYG_ASSERT( endpoint == &ep0.common, "USB startup involves the wrong endpoint"); + + // If there is additional platform-specific initialization to + // perform, do it now. This macro can come from the platform HAL, + // but may not be available on all platforms. +#ifdef UPD985XX_USB_PLATFORM_INIT + UPD985XX_USB_PLATFORM_INIT(); +#endif +} + +// ---------------------------------------------------------------------------- +// The main DSR +// +// This gets called by the interrupt system or by the polling code +// when one or more USB-related events have occurred. The ISR code +// will have updated globals usbs_upd985xx_gsr1 and usbs_upd98x0x_gsr2 +// to indicate which events are pending. When running in interrupt +// mode it is possible that further interrupts will occur while the +// DSR is running, and hence that these globals will be updated +// while the DSR is running. This is handled by a loop. A side effect +// is that the DSR may get called when all the work has already +// been done by a previous DSR, but that is harmless. + +static void +usbs_upd985xx_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data) +{ + CYG_ASSERT(CYGNUM_HAL_INTERRUPT_USB == vector, "USB DSR should only be invoked for USB interrupts" ); + CYG_ASSERT(0 == data, "The USB DSR needs no global data pointer"); + + while ((0 != usbs_upd985xx_gsr1) || (0 != usbs_upd985xx_gsr2)) { + // Only update the globals in one place since it involves + // the overhead of two function calls. + cyg_uint32 gsr1, gsr2; + cyg_drv_isr_lock(); + gsr1 = usbs_upd985xx_gsr1; + gsr2 = usbs_upd985xx_gsr2; + usbs_upd985xx_gsr1 = 0; + usbs_upd985xx_gsr2 = 0; + cyg_drv_isr_unlock(); + + if (0 != gsr2) { + // Treat reset specially. If there has been a reset then none of + // the other bits are of any interest. + if (0 != (USBS_GSR2_URST & gsr2)) { + int old_state = ep0.common.state; + // Update the state. ep0_init() detects this state change and + // updates imr2 appropriate, preventing a continuous storm + // of reset interrupts. + ep0.common.state = USBS_STATE_DEFAULT; + usbs_upd985xx_handle_reset(); + // This state change must be reported to higher-level code + if ((void (*)(usbs_control_endpoint*, void*, usbs_state_change, int))0 != ep0.common.state_change_fn) { + (*ep0.common.state_change_fn)(&ep0.common, ep0.common.state_change_data, + USBS_STATE_CHANGE_RESET, old_state); + } + break; + } + // There is possible confusion if both suspend and resume + // bits are set. Was there a suspend, quickly followed by + // a resume? Were we already suspended, then resumed, now + // suspended again? For now this complication is ignored and + // resume is given priority over suspend. + if (0 != (USBS_GSR2_URSM & gsr2)) { + int old_state = ep0.common.state; + if (0 != (old_state & USBS_STATE_SUSPENDED)) { + ep0.common.state &= ~USBS_STATE_SUSPENDED; + if ((void (*)(usbs_control_endpoint*, void*, usbs_state_change, int))0 != ep0.common.state_change_fn) { + (*ep0.common.state_change_fn)(&ep0.common, ep0.common.state_change_data, + USBS_STATE_CHANGE_RESUMED, old_state); + } + } + } else if (0 != (USBS_GSR2_USPD & gsr2)) { + int old_state = ep0.common.state; + if (0 == (old_state & USBS_STATE_SUSPENDED)) { + ep0.common.state |= USBS_STATE_SUSPENDED; + if ((void (*)(usbs_control_endpoint*, void*, usbs_state_change, int))0 != ep0.common.state_change_fn) { + (*ep0.common.state_change_fn)(&ep0.common, ep0.common.state_change_data, + USBS_STATE_CHANGE_SUSPENDED, old_state); + } + } + } else { + // Handle error conditions on the isochronous endpoints? + } + } + if (0 != gsr1) { + + if (0 != (USBS_GSR1_EP0TF & gsr1)) { + ep0_tx_dsr(); + } + if (0 != (USBS_GSR1_EP0RF & gsr1)) { + ep0_rx_dsr(); + } +#if 0 + // EP1FU? + if (0 != (USBS_GSR1_EP1TF & gsr1)) { + ep1_dsr(); + } +#endif +#if 0 + // EP2FO? + if (0 != (USBS_GSR1_EP2RF & gsr1)) { + ep1_dsr(); + } +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 + if (0 != (USBS_GSR1_EP3TF & gsr1)) { + ep35_dsr(&ep3); + } +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP4 + if (0 != (USBS_GSR1_EP4RF & gsr1)) { + ep4_dsr(); + } +#endif +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 + if (0 != (USBS_GSR1_EP5TF & gsr1)) { + ep35_dsr(&ep5); + } +#endif +#if 0 + if (0 != (USBS_GSR1_EP6RF & gsr1)) { + ep6_dsr(); + } +#endif + } + } // while there are unprocessed interrupts +} + +// ---------------------------------------------------------------------------- +// Interrupt handling. +// +// There are two status registers to look at. These are read-once +// registers, i.e. reading the register causes all bits to be cleared, +// so the relevant state has to be preserved in volatile globals which +// can then be examined by the DSR. In theory the top bit of the first +// status register can be used to check whether or not there is +// anything of interest in the second one, but it seems quicker to +// just read both registers. After masking out interrupts that are of +// no interest, some global flags are updated. If this leaves a +// non-zero value then the DSR must be invoked. + +static cyg_uint32 +usbs_upd985xx_isr(cyg_vector_t vector, cyg_addrword_t data) +{ + CYG_ASSERT(CYGNUM_HAL_INTERRUPT_USB == vector, "USB ISR should only be invoked for USB interrupts"); + CYG_ASSERT(0 == data, "The UPD985xx ISR needs no global data pointer"); + + usbs_upd985xx_gsr1 |= IBUS_SWAP32(*USBS_GSR1) & usbs_upd985xx_gsr1_mask; + usbs_upd985xx_gsr2 |= IBUS_SWAP32(*USBS_GSR2) & usbs_upd985xx_gsr2_mask; + + cyg_drv_interrupt_acknowledge(vector); + return ((0 == usbs_upd985xx_gsr1) && (0 == usbs_upd985xx_gsr2)) ? + CYG_ISR_HANDLED : CYG_ISR_CALL_DSR; +} + +// ---------------------------------------------------------------------------- +// Polling support. It is not clear that this is going to work particularly +// well since according to the documentation the hardware does not generate +// NAKs automatically - instead the ISR has to set the appropriate bits +// sufficiently quickly to avoid confusing the host. +// +// Calling the isr directly avoids duplicating code, but means that +// cyg_drv_interrupt_acknowledge() will get called when not inside a +// real interrupt handler. This should be harmless. + +static void +usbs_upd985xx_poll(usbs_control_endpoint* endpoint) +{ + CYG_ASSERT(endpoint == &ep0.common, "USB poll involves the wrong endpoint"); + if (CYG_ISR_CALL_DSR == usbs_upd985xx_isr(CYGNUM_HAL_INTERRUPT_USB, 0)) { + usbs_upd985xx_dsr(CYGNUM_HAL_INTERRUPT_USB, 0, 0); + } +} + +// ---------------------------------------------------------------------------- +// Initialization +// +// This routine gets called from a prioritized static constructor during +// eCos startup. +void +usbs_upd985xx_init(void) +{ + // Make sure the uncached data structure is accessed through + // kseg1. + uncached = (uncached_data*) MIPS_TO_UNCACHED(&cached_copy); + + // Perform a full hardware reset. + usbs_upd985xx_handle_reset(); + + // It is possible and desirable to install the interrupt handler + // here, even though there will be no interrupts for a while yet. + // FIXME: is 99 a sensible interrupt priority :-? + cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_USB, + 99, // priority + 0, // data + &usbs_upd985xx_isr, + &usbs_upd985xx_dsr, + &usbs_upd985xx_intr_handle, + &usbs_upd985xx_intr_data); + + cyg_drv_interrupt_attach(usbs_upd985xx_intr_handle); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_USB); +} + +// ---------------------------------------------------------------------------- +// Testing support. + +usbs_testing_endpoint usbs_testing_endpoints[] = { + { + endpoint_type : USB_ENDPOINT_DESCRIPTOR_ATTR_CONTROL, + endpoint_number : 0, + endpoint_direction : USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN, + endpoint : (void*) &ep0.common, +#ifdef CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY + devtab_entry : CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "0c", +#else + devtab_entry : (const char*) 0, +#endif + min_size : 1, // zero-byte control transfers are meaningless +#if (CYGNUM_DEVS_USB_UPD985XX_EP0_RXBUFSIZE < CYGNUM_DEVS_USB_UPD985XX_EP0_TXBUFSIZE) + max_size : CYGNUM_DEVS_USB_UPD985XX_EP0_RXBUFSIZE, +#else + max_size : CYGNUM_DEVS_USB_UPD985XX_EP0_TXBUFSIZE, +#endif + max_in_padding : 0, + alignment : 0 + }, + +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP3 + { + endpoint_type : USB_ENDPOINT_DESCRIPTOR_ATTR_BULK, + endpoint_number : 3, + endpoint_direction : USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN, + endpoint : (void*) &ep3.common, +# ifdef CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY + devtab_entry : CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "3w", +# else + devtab_entry : (const char*) 0, +# endif + min_size : 0, + max_size : 0x0FFFF, // Driver limitation, only a single buffer descriptor is used + max_in_padding : 0, + alignment : HAL_DCACHE_LINE_SIZE + }, +#endif + +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP4 + { + endpoint_type : USB_ENDPOINT_DESCRIPTOR_ATTR_BULK, + endpoint_number : 4, + endpoint_direction : USB_ENDPOINT_DESCRIPTOR_ENDPOINT_OUT, + endpoint : (void*) &ep4.common, +# ifdef CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY + devtab_entry : CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "4r", +# else + devtab_entry : (const char*) 0, +# endif + min_size : 1, + max_size : 0x0FFFF, // Driver limitation + max_in_padding : 0, + alignment : HAL_DCACHE_LINE_SIZE + }, +#endif + +#ifdef CYGPKG_DEVS_USB_UPD985XX_EP5 + { +# ifdef CYGIMP_DEVS_USB_UPD985XX_EP5_BULK + endpoint_type : USB_ENDPOINT_DESCRIPTOR_ATTR_BULK, +# else + endpoint_type : USB_ENDPOINT_DESCRIPTOR_ATTR_INTERRUPT, +# endif + endpoint_number : 5, + endpoint_direction : USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN, + endpoint : (void*) &ep5.common, +# ifdef CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY + devtab_entry : CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "5w", +# else + devtab_entry : (const char*) 0, +# endif + min_size : 1, + max_size : 0x0FFFF, // Driver limitation, only a single buffer descriptor is used + max_in_padding : 0, + alignment : HAL_DCACHE_LINE_SIZE + }, +#endif + + USBS_TESTING_ENDPOINTS_TERMINATOR +}; diff --git a/packages/devs/usb/nec_upd985xx/current/src/usbs_upd985xx_data.cxx b/packages/devs/usb/nec_upd985xx/current/src/usbs_upd985xx_data.cxx new file mode 100644 --- /dev/null +++ b/packages/devs/usb/nec_upd985xx/current/src/usbs_upd985xx_data.cxx @@ -0,0 +1,190 @@ +//========================================================================== +// +// usbs_nec_upd9850x.c +// +// Static data for the NEC uPD9850x USB device driver +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): bartv +// Contributors: bartv +// Date: 2001-05-22 +// +// This file contains various objects that should go into extras.o +// rather than libtarget.a, e.g. devtab entries that would normally +// be eliminated by the selective linking. +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +// Initialization. The goal here is to call usbs_upd985xx_init() +// early on during system startup, to take care of things like +// registering interrupt handlers etc. which are best done +// during system init. +// +// If the endpoint 0 devtab entry is available then its init() +// function can be used to take care of this. However the devtab +// entries are optional so an alternative mechanism must be +// provided. Unfortunately although it is possible to give +// a C function the constructor attribute, it cannot be given +// an initpri attribute. Instead it is necessary to define a +// dummy C++ class. + +extern "C" void usbs_upd985xx_init(void); + +#ifndef CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY +class usbs_upd985xx_initialization { + public: + usbs_upd985xx_initialization() { + usbs_upd985xx_init(); + } +}; + +static usbs_upd985xx_initialization usbs_upd985xx_init_object CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO); +#endif + +// ---------------------------------------------------------------------------- +// The devtab entries. Each of these is optional, many applications +// will want to use the lower-level API rather than go via +// open/read/write/ioctl. + +#ifdef CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY + +// For endpoint 0 the only legal operations are get_config() and +// set_config(), and these are provided by the common package. + +static bool +usbs_upd985xx_devtab_ep0_init(struct cyg_devtab_entry* tab) +{ + CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab); + usbs_upd985xx_init(); + return true; +} + +static CHAR_DEVIO_TABLE(usbs_upd985xx_ep0_devtab_functions, + &cyg_devio_cwrite, + &cyg_devio_cread, + &cyg_devio_select, + &usbs_devtab_get_config, + &usbs_devtab_set_config); + +static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep0_devtab_entry, + CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "0c", + 0, + &usbs_upd985xx_ep0_devtab_functions, + &usbs_upd985xx_devtab_ep0_init, + 0, + (void*) &usbs_upd985xx_ep0); +#endif + +// ---------------------------------------------------------------------------- +// Common routines for ep3, ep4 and ep5 +#if defined(CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY) || \ + defined(CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY) || \ + defined(CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY) +static bool +usbs_upd985xx_devtab_dummy_init(struct cyg_devtab_entry* tab) +{ + CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab); + return true; +} +#endif + +// ---------------------------------------------------------------------------- +// ep3 devtab entry. This can only be used for slave->host, so only +// the cwrite() function makes sense. The same function table can be +// used for ep5. + +#if defined(CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY) || \ + defined(CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY) +static CHAR_DEVIO_TABLE(usbs_upd985xx_ep35_devtab_functions, + &usbs_devtab_cwrite, + &cyg_devio_cread, + &cyg_devio_select, + &usbs_devtab_get_config, + &usbs_devtab_set_config); + +# if defined(CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY) +static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep3_devtab_entry, + CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "3w", + 0, + &usbs_upd985xx_ep35_devtab_functions, + &usbs_upd985xx_devtab_dummy_init, + 0, + (void*) &usbs_upd985xx_ep3); + +# endif + +# if defined(CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY) +static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep5_devtab_entry, + CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "5w", + 0, + &usbs_upd985xx_ep35_devtab_functions, + &usbs_upd985xx_devtab_dummy_init, + 0, + (void*) &usbs_upd985xx_ep5); +# endif +#endif + +// ---------------------------------------------------------------------------- +// ep4 devtab entry. This can only be used for host->slave, so only the +// cread() function makes sense. + +#ifdef CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY + +static CHAR_DEVIO_TABLE(usbs_upd985xx_ep4_devtab_functions, + &cyg_devio_cwrite, + &usbs_devtab_cread, + &cyg_devio_select, + &usbs_devtab_get_config, + &usbs_devtab_set_config); + +static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep4_devtab_entry, + CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "4r", + 0, + &usbs_upd985xx_ep4_devtab_functions, + &usbs_upd985xx_devtab_dummy_init, + 0, + (void*) &usbs_upd985xx_ep4); +#endif + diff --git a/packages/devs/usb/sa11x0/current/ChangeLog b/packages/devs/usb/sa11x0/current/ChangeLog --- a/packages/devs/usb/sa11x0/current/ChangeLog +++ b/packages/devs/usb/sa11x0/current/ChangeLog @@ -1,3 +1,20 @@ +2002-02-11 Bart Veer + + * src/usbs_sa11x0.c: + Add a handler for the SET_INTERFACE standard control message. + This should not be needed, but appears to avoid hardware problems + when a compliance testing program sends certain requests. Also + improve the handling of halted endpoints since the hardware + does not allow transfers to be aborted. + +2002-01-23 Bart Veer + + * src/usbs_sa11x0.c: + Add missing assertions for non-NULL buffers + Try to improve the behaviour when the host sends data before + the target is ready. The hardware is not capable of handling + this situation, but some recovery is possible some of the time. + 2001-09-14 Bart Veer * src/usbs_sa11x0.c: @@ -130,27 +147,36 @@ 2000-11-21 Bart Veer - - - - - - - - - - - - - - - - - +####ECOSGPLCOPYRIGHTBEGIN#### + ------------------------------------------- + This file is part of eCos, the Embedded Configurable Operating System. + Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + + eCos is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 or (at your option) any later version. + + eCos is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with eCos; if not, write to the Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + + As a special exception, if other files instantiate templates or use macros + or inline functions from this file, or you compile this file and link it + with other works to produce a work based on this file, this file does not + by itself cause the resulting work to be covered by the GNU General Public + License. However the source code for this file must still be made available + in accordance with section (3) of the GNU General Public License. + + This exception does not invalidate any other reasons why a work based on + this file might be covered by the GNU General Public License. + + Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. + at http://sources.redhat.com/ecos/ecos-license + ------------------------------------------- +####ECOSGPLCOPYRIGHTEND#### @@ -230,4 +245,4 @@ will be raised and performance will suff - \ No newline at end of file + diff --git a/packages/devs/usb/sa11x0/current/include/usbs_sa11x0.h b/packages/devs/usb/sa11x0/current/include/usbs_sa11x0.h --- a/packages/devs/usb/sa11x0/current/include/usbs_sa11x0.h +++ b/packages/devs/usb/sa11x0/current/include/usbs_sa11x0.h @@ -7,29 +7,38 @@ // The interface exported by the SA11X0 USB device driver // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/usb/sa11x0/current/src/usbs_sa11x0.c b/packages/devs/usb/sa11x0/current/src/usbs_sa11x0.c --- a/packages/devs/usb/sa11x0/current/src/usbs_sa11x0.c +++ b/packages/devs/usb/sa11x0/current/src/usbs_sa11x0.c @@ -5,29 +5,38 @@ // Device driver for the SA11x0 USB port. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -871,6 +880,10 @@ usbs_sa11x0_ep0_dsr(void) // if the host needs to be told that the control message was // unacceptable and is cleared automatically by the hardware after // the stall is sent. + // NOTE: it is not clear the hardware actually works in this + // respect. The FORCE_STALL bit has been observed still set during + // the next interrupt, and the host appears to receive spurious + // data back in response to the next control packet. // // Sent-stall is set by the hardware following a protocol // violation, e.g. if there is an IN token when a new control @@ -1167,19 +1180,69 @@ usbs_sa11x0_ep0_dsr(void) result = USBS_CONTROL_RETURN_STALL; } } - } // Endpoing or device set-feature + } // Endpoint or device set-feature } // If the result has not been handled yet, pass it to - // the install callback function (if any). + // the installed callback function (if any). if (USBS_CONTROL_RETURN_UNKNOWN == result) { if ((usbs_control_return (*)(usbs_control_endpoint*, void*))0 != ep0.common.standard_control_fn) { result = (*ep0.common.standard_control_fn)(&ep0.common, ep0.common.standard_control_data); } } + +#if 1 + if ((USBS_CONTROL_RETURN_UNKNOWN == result) && + (USB_DEVREQ_SET_INTERFACE == req->request)) { + + // This code should not be necessary. For + // non-trivial applications which involve + // alternate interfaces and the like, this request + // should be handled by the application itself. + // For other applications, the default handler + // will ignore this request so we end up falling + // through without actually handling the request + // and hence returning a stall condition. That + // is legitimate behaviour according to the standard. + // + // However, there are appear to be problems with + // the SA1110 USB hardware when it comes to stall + // conditions: they appear to affect some + // subsequent messages from target to host as + // well. Hence rather than returning a stall + // condition this code instead generates a dummy + // reply, which is also valid according to the + // standard. This avoids complications with certain + // USB compliance testers. + if ((0 != length) || + (0 != req->value_hi) || (0 != req->index_hi) || + (USBS_STATE_CONFIGURED != (ep0.common.state & USBS_STATE_MASK))) { + + result = USBS_CONTROL_RETURN_STALL; + } else { + int interface_id; + int alternate; + + CYG_ASSERT( (1 == ep0.common.enumeration_data->device.number_configurations) && \ + (1 == ep0.common.enumeration_data->total_number_interfaces), \ + "Higher level code should have handled this request"); + + interface_id = req->index_lo; + alternate = req->value_lo; + if ((interface_id != ep0.common.enumeration_data->interfaces[0].interface_id) || + (alternate != ep0.common.enumeration_data->interfaces[0].alternate_setting)) { + result = USBS_CONTROL_RETURN_STALL; + } else { + result = USBS_CONTROL_RETURN_HANDLED; + } + + } + } +#endif + // If the result has still not been handled, leave it to - // the default implementation in the USB slave common place. + // the default implementation in the USB slave common package if (USBS_CONTROL_RETURN_UNKNOWN == result) { result = usbs_handle_standard_control(&ep0.common); } @@ -1332,8 +1395,8 @@ usbs_sa11x0_ep0_dsr(void) // receive-packet-complete bit cannot be set by software and the OUT // max register has a minimum size of eight bytes. Fortunately for // many protocols the target-side code has a chance to start a receive -// before the host is allowed to send, so this problem is ignored for -// now. +// before the host is allowed to send, so this problem is mostly +// ignored for now. // // Another potential problem arises if the host sends more data than // is expected for a given transfer. It would be possible to address @@ -1389,9 +1452,10 @@ ep1_start_rx_packet(void) // The full flexibility of the DMA engines is not required here, // specifically the automatic chaining between buffers A and B. // Instead always using buffer A is sufficient. To avoid the - // hardware switching to buffer B, an excessive size field is - // used, EP1_MTU rather than EP1_DMA_MTU, and hence the - // DMA transfer will never complete. + // However the hardware still requires the software to alternate + // between A and B. To avoid switching between buffers during a + // transfer an excessive size field is used, EP1_MTU rather than + // EP1_DMA_MTU, and hence the DMA transfer will never complete. // // With some silicon revisions writing to the DMA registers does // not always work either, so a retry is in order. Possibly @@ -1446,18 +1510,17 @@ ep1_clear_error(void) static int ep1_process_packet(void) { + int pkt_size; + // First, work out how much data has been processed by the DMA // engine. This is the amount originally poked into the size // register minus its current value. - int pkt_size; - *EP1_DMA_CONTROL_CLEAR = DMA_CONTROL_CLEAR_ALL; if (ep1.using_buf_a) { pkt_size = EP1_DMA_MTU - *EP1_DMA_BUF_A_SIZE; } else { pkt_size = EP1_DMA_MTU - *EP1_DMA_BUF_B_SIZE; } - CYG_ASSERT( 0 == (pkt_size % DMA_BURST_SIZE), "DMA transfers must be in multiples of the burst size"); // Move these bytes from physical memory to the target buffer. @@ -1561,6 +1624,8 @@ ep1_start_rx(usbs_rx_endpoint* endpoint) } else { int status = *EP1_CONTROL; + CYG_ASSERT((void*) 0 != ep1.common.buffer, "USB receives should not override the interrupt vectors"); + // This indicates the start of a transfer. ep1.fetched = 0; @@ -1580,8 +1645,9 @@ ep1_start_rx(usbs_rx_endpoint* endpoint) // No error but data in the fifo. This implies a small // initial packet, all held in the fifo. #ifdef CYGNUM_DEVS_USB_SA11X0_EP1_DMA_CHANNEL - *EP1_DMA_BUF_A_SIZE = EP1_MTU; -#endif + *EP1_DMA_BUF_A_SIZE = EP1_MTU; + ep1.using_buf_a = true; +#endif (void) ep1_process_packet(); ep1_rx_complete(ep1.fetched); } else { @@ -1610,19 +1676,14 @@ ep1_set_halted(usbs_rx_endpoint* endpoin // transfer then the stall bit may not get set for a while, so // poke() is inappropriate. *EP1_CONTROL = EP1_FORCE_STALL; - - // And abort any current transfer. - ep1_rx_complete(-EAGAIN); - } else { // The stall condition should be cleared. First take care of // things at the hardware level so that a new transfer is // allowed. usbs_sa11x0_poke(EP1_CONTROL, EP1_SENT_STALL, 0, EP1_SENT_STALL | EP1_FORCE_STALL); - + // Now allow new transfers to begin. ep1.common.halted = false; - ep1_rx_complete(0); } } @@ -1646,7 +1707,6 @@ usbs_sa11x0_ep1_dsr(void) // was in progress when the stall bit was set. The // set_halted() call above will have taken care of things. return; - } // The sent-stall bit should never get set, since we always @@ -1666,29 +1726,40 @@ usbs_sa11x0_ep1_dsr(void) } else { // Another packet has been received. Process it, which may // complete the transfer or it may leave more to be done. - int pkt_size = ep1_process_packet(); - INCR_STAT(ep1_receives); - if (0 != (EP1_PACKET_ERROR & *EP1_CONTROL)) { - CYG_ASSERT( 0, "an error has occurred inside ep1_process_packet()\n"); + // + // The hardware starts with the wrong default value for + // the receive-packet-complete bit, so a packet may arrive + // even though no rx operation has started yet. The + // packets must be ignored for now. start_rx_packet() + // will detect data in the fifo and do the right thing. + int pkt_size; - } else if ((ep1.fetched != ep1.common.buffer_size) && (0 != pkt_size) && (0 == (ep1.fetched % EP1_MTU))) { - ep1_start_rx_packet(); - } else if (ep1.fetched > ep1.common.buffer_size) { - // The host has sent too much data. - ep1_rx_complete(-EMSGSIZE); - } else { + if ((unsigned char*)0 != ep1.common.buffer) { + + pkt_size = ep1_process_packet(); + INCR_STAT(ep1_receives); + if (0 != (EP1_PACKET_ERROR & *EP1_CONTROL)) { + CYG_ASSERT( 0, "an error has occurred inside ep1_process_packet()\n"); + + } else if ((ep1.fetched != ep1.common.buffer_size) && (0 != pkt_size) && (0 == (ep1.fetched % EP1_MTU))) { + ep1_start_rx_packet(); + } else if (ep1.fetched > ep1.common.buffer_size) { + // The host has sent too much data. + ep1_rx_complete(-EMSGSIZE); + } else { #if 0 - int i; - diag_printf("------------------------------------------------------\n"); - diag_printf("rx: buf %x, total size %d\n", ep1.common.buffer, ep1.fetched); - for (i = 0; (i < ep1.fetched) && (i < 128); i+= 8) { - diag_printf("rx %x %x %x %x %x %x %x %x\n", - ep1.common.buffer[i+0], ep1.common.buffer[i+1], ep1.common.buffer[i+2], ep1.common.buffer[i+3], - ep1.common.buffer[i+4], ep1.common.buffer[i+5], ep1.common.buffer[i+6], ep1.common.buffer[i+7]); + int i; + diag_printf("------------------------------------------------------\n"); + diag_printf("rx: buf %x, total size %d\n", ep1.common.buffer, ep1.fetched); + for (i = 0; (i < ep1.fetched) && (i < 128); i+= 8) { + diag_printf("rx %x %x %x %x %x %x %x %x\n", + ep1.common.buffer[i+0], ep1.common.buffer[i+1], ep1.common.buffer[i+2], ep1.common.buffer[i+3], + ep1.common.buffer[i+4], ep1.common.buffer[i+5], ep1.common.buffer[i+6], ep1.common.buffer[i+7]); + } + diag_printf("------------------------------------------------------\n"); +#endif + ep1_rx_complete(ep1.fetched); } - diag_printf("------------------------------------------------------\n"); -#endif - ep1_rx_complete(ep1.fetched); } } } @@ -1964,6 +2035,7 @@ ep2_start_tx(usbs_tx_endpoint* endpoint) // transmission, but if there is one then there is no safe way // to recover. process_packet() and tx_packet() will hopefully // do the right thing. + CYG_ASSERT((void*) 0 != ep2.common.buffer, "Transmitting the interrupt vectors is unlikely to be useful"); #if 0 { int i; @@ -2004,16 +2076,12 @@ ep2_set_halted(usbs_tx_endpoint* endpoin // so poke() cannot be used. *EP2_CONTROL = EP2_FORCE_STALL; - // And abort any current transfer. - ep2_tx_complete(-EAGAIN); - + // If in the middle of a transfer then that cannot be aborted, + // the DMA engines etc. would get very confused. } else { - // First take care of the hardware so that a new transfer is - // allowed. Then allow new transfers to begin and inform - // higher-level code. + // Take care of the hardware so that a new transfer is allowed. usbs_sa11x0_poke(EP2_CONTROL, EP2_SENT_STALL, 0, EP2_SENT_STALL | EP2_FORCE_STALL); ep2.common.halted = false; - ep2_tx_complete(0); } } diff --git a/packages/devs/usb/sa11x0/current/src/usbs_sa11x0_data.cxx b/packages/devs/usb/sa11x0/current/src/usbs_sa11x0_data.cxx --- a/packages/devs/usb/sa11x0/current/src/usbs_sa11x0_data.cxx +++ b/packages/devs/usb/sa11x0/current/src/usbs_sa11x0_data.cxx @@ -5,29 +5,38 @@ // Static data for the SA11x0 USB device driver // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/devs/wallclock/dallas/ds12887/current/ChangeLog b/packages/devs/wallclock/dallas/ds12887/current/ChangeLog --- a/packages/devs/wallclock/dallas/ds12887/current/ChangeLog +++ b/packages/devs/wallclock/dallas/ds12887/current/ChangeLog @@ -11,28 +11,37 @@ 2001-07-06 Jesper Skov + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/wallclock/powerpc/mpc5xx/current/cdl/wallclock_mpc5xx.cdl b/packages/devs/wallclock/powerpc/mpc5xx/current/cdl/wallclock_mpc5xx.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/powerpc/mpc5xx/current/cdl/wallclock_mpc5xx.cdl @@ -0,0 +1,101 @@ +# ==================================================================== +# +# wallclock_mpc5xx.cdl +# +# eCos wallclock motorola MPC555-module driver configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Bob Koninckx +# Original data: nickg +# Contributors: +# Date: 2002-01-18 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVICES_WALLCLOCK_MPC5xx { + parent CYGPKG_IO_WALLCLOCK + active_if CYGPKG_IO_WALLCLOCK + display "mpc5xx RTC-module wallclock driver" + requires CYGPKG_HAL_POWERPC_MPC5xx + hardware + compile wallclock_mpc5xx.cxx + implements CYGINT_WALLCLOCK_HW_IMPLEMENTATIONS + active_if CYGIMP_WALLCLOCK_HARDWARE + + cdl_option CYGIMP_WALLCLOCK_HARDWARE { + parent CYGPKG_IO_WALLCLOCK_IMPLEMENTATION + display "Hardware wallclock" + default_value 1 + implements CYGINT_WALLCLOCK_IMPLEMENTATIONS + } + + cdl_component CYGPKG_DEVICES_WALLCLOCK_MPC5xx_OPTIONS { + display "mpc5xx RTC-module wallclock build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_DEVICES_WALLCLOCK_MPC5xx_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the wallclock device. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_DEVICES_WALLCLOCK_MPC5xx_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the wallclock device. These flags are removed from + the set of global flags if present." + } + + } +} diff --git a/packages/devs/wallclock/powerpc/mpc5xx/current/src/wallclock_mpc5xx.cxx b/packages/devs/wallclock/powerpc/mpc5xx/current/src/wallclock_mpc5xx.cxx new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/powerpc/mpc5xx/current/src/wallclock_mpc5xx.cxx @@ -0,0 +1,100 @@ +//========================================================================== +// +// wallclock_mpc5xx.cxx +// +// mpc5xx RTC module driver. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2002-01-18 +// Purpose: Wallclock driver for mpc5xx +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include // Wallclock device config + +#include // IO macros +#include // Common type definitions and support + +#include // The WallClock API +#include // Helpers + +#include // RTC register definitions + +#include // For debugging + +//----------------------------------------------------------------------------- +// Functions required for the hardware-driver API. + +// Returns the number of seconds elapsed since 1970-01-01 00:00:00. +cyg_uint32 +Cyg_WallClock::get_hw_seconds(void) +{ + cyg_uint32 now; + HAL_READ_UINT32(CYGARC_REG_IMM_RTC, now); + + return now; +} + +#ifndef CYGSEM_WALLCLOCK_SET_GET_MODE + +void +Cyg_WallClock::init_hw_seconds(void) +{ + cyg_uint32 key = 0x55ccaa33; + cyg_uint16 rtcsc; + + // Write zero to the time register + // and start up the RTC + HAL_WRITE_UINT32(CYGARC_REG_IMM_RTCK, key); + HAL_WRITE_UINT32(CYGARC_REG_IMM_RTCSCK, key); + + key = 0; + HAL_WRITE_UINT32(CYGARC_REG_IMM_RTC, key); + HAL_READ_UINT16(CYGARC_REG_IMM_RTCSC, rtcsc); + rtcsc |= 0x0001; + HAL_WRITE_UINT16(CYGARC_REG_IMM_RTCSC, rtcsc); +} + +#endif // CYGSEM_WALLCLOCK_SET_GET_MODE + +//----------------------------------------------------------------------------- +// End of wallclock_mpc5xx.cxx diff --git a/packages/devs/wallclock/sh/hs7729pci/current/ChangeLog b/packages/devs/wallclock/sh/hs7729pci/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/sh/hs7729pci/current/ChangeLog @@ -0,0 +1,38 @@ +2001-07-06 Jesper Skov + + New package. + +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### + + diff --git a/packages/devs/wallclock/sh/hs7729pci/current/cdl/wallclock_hs7729pci.cdl b/packages/devs/wallclock/sh/hs7729pci/current/cdl/wallclock_hs7729pci.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/sh/hs7729pci/current/cdl/wallclock_hs7729pci.cdl @@ -0,0 +1,65 @@ +# ==================================================================== +# +# wallclock_hs7729pci.cdl +# +# eCos wallclock for HS7729PCI driver configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: jskov +# Date: 2001-07-06 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVICES_WALLCLOCK_SH_HS7729PCI { + parent CYGPKG_IO_WALLCLOCK + active_if CYGPKG_IO_WALLCLOCK + display "HS7729PCI wallclock driver" + requires CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS12887 + requires CYGPKG_HAL_SH_SH7729_HS7729PCI + hardware + include_dir cyg/io + + define_proc { + puts $::cdl_system_header "/***** wallclock driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_WALLCLOCK_DALLAS_12887_INL " + puts $::cdl_system_header "/***** wallclock driver proc output end *****/" + } +} diff --git a/packages/devs/wallclock/sh/hs7729pci/current/include/devs_wallclock_sh_hs7729pci.inl b/packages/devs/wallclock/sh/hs7729pci/current/include/devs_wallclock_sh_hs7729pci.inl new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/sh/hs7729pci/current/include/devs_wallclock_sh_hs7729pci.inl @@ -0,0 +1,70 @@ +//========================================================================== +// +// wallclock_hs7729pci.inl +// +// HS7729PCI wallclock details +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-07-06 +// Purpose: Wallclock driver details for HS7729PCI +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define nDS_LINEAR +#define DS_ADDR 0xa80000e0 +#define DS_DATA 0xa80000e2 + +#define DS_READ_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + cyg_uint16 t; \ + HAL_READ_UINT16((_a_), t); \ + (_d_) = (t >> 8) & 0xff; \ + CYG_MACRO_END + +#define DS_WRITE_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT16((_a_), (_d_)<<8); \ + CYG_MACRO_END + + +//----------------------------------------------------------------------------- +// End of wallclock_hs7729pci.inl diff --git a/packages/devs/wallclock/sh/sh3/current/ChangeLog b/packages/devs/wallclock/sh/sh3/current/ChangeLog --- a/packages/devs/wallclock/sh/sh3/current/ChangeLog +++ b/packages/devs/wallclock/sh/sh3/current/ChangeLog @@ -47,28 +47,37 @@ 2000-03-17 Jesper Skov + + * src/LICENCE: New file. Contains license for JFFS2, now GPL+exception. + * src/background.c: Point at LICENSE file instead of existing text. + * src/build.c: Ditto. + * src/compr.c: Ditto. + * src/compr_rtime.c: Ditto. + * src/compr_rubin.c: Ditto. + * src/compr_zlib.c: Ditto. + * src/dir-ecos.c: Ditto. + * src/erase.c: Ditto. + * src/file-ecos.c: Ditto. + * src/gc.c: Ditto. + * src/jffs2.h: Ditto. + * src/list.h: Ditto. + * src/malloc-ecos.c: Ditto. + * src/nodelist.c: Ditto. + * src/nodelist.h: Ditto. + * src/nodemgmt.c: Ditto. + * src/os-ecos.h: Ditto. + * src/pushpull.h: Ditto. + * src/read.c: Ditto. + * src/readinode.c: Ditto. + * src/scan.c: Ditto. + * src/write.c: Ditto. + +2002-01-28 David Woodhouse + + * src/super-ecos.c: Removed. + * src/jffs2.c: Merge jffs2_write_super() and jffs2_put_super() into + the routines from which they were called, put jffs2_read_super() + in as a static function with a view to doing same RSN. + * src/jffs2port.h: Remove prototypes of functions that died. + * cdl/jffs2.cdl: Remove super-ecos.c + * src/dir-ecos.c src/write.c: Increase highest_version _before_ + assigning to new node, not after. + +2002-01-27 David Woodhouse + + * src/read.c (jffs2_read_inode_range): Deal correctly with + non-page-aligned read requests. We have to deal with the + case where we want to read from somewhere other than the + beginning of a frag. + * src/jffs2.c (jffs2_fo_read): Use jffs2_read_inode_range + instead of jffs2_readpage. + +2002-01-25 Jonathan Larmour + + * cdl/jffs2.cdl: We want CYGPKG_IO_FILEIO_INODE. + * src/dir-ecos.c (jffs2_symlink): Remove. eCos doesn't support symlinks. + (jffs2_mknod): Similar. + (jffs2_mkdir): Don't call d_instantiate - its a nop. + (jffs2_rename): Ditto. + * src/file-ecos.c (jffs2_commit_write): Don't set blocks. + * src/jffs2.c (jffs2_flash_writev): Rewrite to only write aligned + quantities to flash. + * src/jffs2port.h: Lots of decrufting. + * src/os-ecos.h: Ditto (a bit). + * src/readinode.c (jffs2_read_inode): Don't set blocks/blksize in inode. + * src/write.c (jffs2_new_inode): Ditto when __ECOS. + (jffs2_write_dnode): don't call writev with extra vectors + unnecessarily. + * src/super-ecos.c (jffs2_statfs): Remove - unused. + +2002-01-25 David Woodhouse + + * src/super-ecos.c: Cruftectomy. + * src/compr*.[ch] src/pushpull.h: Namespace cleanups merged from + mainstream sources. Bit push functions made inline. + * src/pushpull.c: Removed. + * cdl/jffs2.c: Remove reference to pushpull.c + * src/file-ecos.c: Cruftectomy. Lots of unused stuff here. + * src/jffs2.c src/jffs2port.h: Remove some functions from jffs2.c + which are no longer used, move some others to jffs2port.h as + inline functions so they don't pollute the namespace. + +2002-01-24 Jonathan Larmour + + * tests/fileio1.c: Check in listdir that the number of dirents is + correct, taking into account existing files in case it's live. + + * src/dir-ecos.c (jffs2_readdir): move to.... + + * src/jffs2.c (jffs2_fo_dirread): here. And fix the return code + in the process so it now works. + (filldir): Make inline and simpler. + * src/jffs2port.h: remove filldir related stuff. + +2002-01-24 David Woodhouse + + * src/dir-ecos.c: Cruftectomy. Remove most of the stuff that was + commented out. Remove jffs2_do_{create,link,unlink} to write.c + * src/write.c: Add jffs2_do_{create,link,unlink} as in mainline. + * src/nodelist.h: Prototypes for the above. + * src/jffs2port.h: Don't include . + +2002-01-23 Jonathan Larmour + + * src/jffs2.c (jffs2_mount): Allow multiple FSs, and integration + with flash block device. + (jffs2_flash_read): Use flash block device. + (jffs2_flash_erase): Ditto. + (jffs2_flash_write): Ditto. + (do_flash_init): Remove - now done by block device layer + * src/list.h: Remove and reimplement from scratch to avoid GPL. + * src/os-ecos.h: Keep flash block dev handle in superblock. + eCos does support obsoleting as it isn't NAND only. + * src/dir-ecos.c (jffs2_readdir): Return correct value on success. + Merge in changes mutatis mutandis from between v1.49 and v1.51 of + dir.c in main repository. + * cdl/jffs2.cdl: CYGPKG_MEMALLOC more accurately CYGINT_ISO_MALLOC. + Only jffs2.c needs to be in libextras.a + Requires Flash block devices as an alternative for hardcoding + the sector size, flash size and base address. + * src/super-ecos.c (jffs2_read_super): Use flash block device for + sector and flash sizes. + * tests/fileio1.c: mount using block device (defined by CDL). + No need to init here - done by flash block device layer. + +2002-01-21 David Woodhouse + + * src/read.c: Obtain inode lock around reading symlink target. + * src/dir-ecos.c: Fix the long-standing up() without down() in + jffs2_readdir() when only the '.' and '..' entries are read, from + v1.52 of master dir.c. Merge copyright date change from v1.50 - note + that the portability cleanups from v1.51 aren't yet merged. + * src/os-ecos.h: Add jffs2_can_mark_obsolete() and the macros + for getting at generic inode fields from a struct jffs2_inode_info* + * src/nodemgmt.c: Remove an #ifndef __ECOS and use + jffs2_can_mark_obsolete() instead. + * src/jffs2port.h: up() is cyg_drv_mutex_unlock() not _release() + * src/gc.c: Merge portability cleanups - get rid of a lot of + references to 'struct inode'. Also include the attempt at NAND + support in jffs2_garbage_collect_deletion_dirent(). + +2002-01-11 David Woodhouse + + * src/jffs2port.h: Switch semaphore emulation to cyg_drv_mutex_t, + remove some kernel includes which seem gratuitous. + * cdl/jffs2.cdl: Require CYGPKG_MEMALLOC + * src/compr_zlib.c src/compr.c: Merge changes from mainline code + to make mkfs.jffs2 compile again. + +2002-01-10 David Woodhouse + + * src/jffs2.c: The 'mode' arg passed to jffs2_open() shouldn't + have been called 'mode'. It's 'oflags'. You have to make up a + mode for the newly-created file yourself. + * src/nodelist.h src/read.c: Fix jffs2_getlink() so it takes + portable arguments, not a dentry. Move it to read.c and symlink.c + becomes obsolete. + * src/symlink-ecos.c: Removed. + * cdl/jffs2.cdl: Remove symlink-ecos.c + +2002-01-09 David Woodhouse + + * Import updated JFFS2 sources into eCos tree. + +2000-08-28 Dominic Ostrowski (dominic.ostrowski@3glab.com) + + * started on port of JFFS2 using ramfs as a template + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + + diff --git a/packages/fs/jffs2/current/cdl/jffs2.cdl b/packages/fs/jffs2/current/cdl/jffs2.cdl new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/cdl/jffs2.cdl @@ -0,0 +1,119 @@ +# ==================================================================== +# +# jffs2.cdl +# +# JFFS2 Filesystem configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): dominic ostrowski +# Original data: ported from JFFS2 by David Woodhouse +# Contributors: dominic.ostrowski@3glab.com +# Date: 2000-08-28 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_FS_JFFS2 { + display "JFFS2 filesystem" + doc doc/index.html + include_dir cyg/jffs2 + + requires CYGPKG_IO_FILEIO + requires CYGPKG_IO_FLASH + requires CYGPKG_COMPRESS_ZLIB + requires CYGINT_ISO_MALLOC + + requires CYGPKG_ISOINFRA + requires CYGPKG_ERROR + requires CYGINT_ISO_ERRNO + requires CYGINT_ISO_ERRNO_CODES + requires CYGPKG_IO_FLASH_BLOCK_DEVICE + requires CYGPKG_IO_FILEIO_INODE + + compile -library=libextras.a jffs2.c + compile build.c scan.c malloc-ecos.c nodelist.c crc32.c nodemgmt.c readinode.c erase.c dir-ecos.c write.c gc.c read.c compr.c compr_zlib.c compr_rtime.c compr_rubin.c file-ecos.c + + cdl_option CYGPKG_FS_JFFS2_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + # We add -D__ECOS to trigger eCos-specific code in places. + # We add -Werror because I find it useful. + default_value { "-D__ECOS -Werror" } + description " + This option modifies the set of compiler flags for + building the JFFS2 package. + These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_FS_JFFS2_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + # We remove -Wpointer-arith so that some of the hacky Linux-compat code + # (in file.c) compiled. We can probably remove it when that's replaced + # properly. + default_value { "-Wpointer-arith" } + description " + This option modifies the set of compiler flags for + building the JFFS2 package. These flags are removed from + the set of global flags if present." + } + + # ---------------------------------------------------------------- + # Tests + + cdl_option CYGPKG_FS_JFFS2_TESTS { + display "JFFS2 FS tests" + flavor data + no_define + calculated { "tests/fileio1.c" } + description " + This option specifies the set of tests for the JFFS2 FS package." + } + +} + +# End of jffs2.cdl + + + + + diff --git a/packages/fs/jffs2/current/doc/readme.txt b/packages/fs/jffs2/current/doc/readme.txt new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/doc/readme.txt @@ -0,0 +1,27 @@ +This package is a port of the JFFS2 flash filing system to eCos. It has been +developed on the Compaq Ipaq, and has not been tested on any other device. + +This code is subject to the original licensing terms, and additionally it +should be noted that this code is still in an early stage of development. + +As this code will write to flash directly, caution should be exercised in +its use. It may cause areas of the flash chips essential to the operation of +the device to become corrupted. + + +Minor modifications are necessary to the the eCos flash drivers + +io/flash/current/src/flash.c + +devs/flash/intel/strata/current/src/flash_program_buf.c + +to allow byte aligned rather than word aligned writes, and to ensure overwriting an existing +word is successful (these are supplied in jffs2/current/src). + + +Two test files are included fileio1.c (which performs the same tests as used for eCos RamFS), +and romfileio1.c (tests as eCos RomFS). + +romfileio1.c requires that a jffs2 filesystem image jffs2.img is present at the desired mount point. +This image was prepared on Linux with the tools originating with JFFS2 source from +www.infradead.org \ No newline at end of file diff --git a/packages/fs/jffs2/current/src/LICENCE b/packages/fs/jffs2/current/src/LICENCE new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/LICENCE @@ -0,0 +1,35 @@ +The files in this directory and elsewhere which refer to this LICENCE +file are part of JFFS2, the Journalling Flash File System v2. + + Copyright (C) 2001, 2002 Red Hat, Inc. + +JFFS2 is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2 or (at your option) any later +version. + +JFFS2 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 JFFS2; if not, write to the Free Software Foundation, Inc., +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +As a special exception, if other files instantiate templates or use +macros or inline functions from these files, or you compile these +files and link them with other works to produce a work based on these +files, these files do not by themselves cause the resulting work to be +covered by the GNU General Public License. However the source code for +these files must still be made available in accordance with section (3) +of the GNU General Public License. + +This exception does not invalidate any other reasons why a work based on +this file might be covered by the GNU General Public License. + +For information on obtaining alternative licences for JFFS2, see +http://sources.redhat.com/jffs2/jffs2-licence.html + + + $Id: LICENCE,v 1.1 2002/05/20 14:56:37 dwmw2 Exp $ diff --git a/packages/fs/jffs2/current/src/background.c b/packages/fs/jffs2/current/src/background.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/background.c @@ -0,0 +1,159 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: background.c,v 1.16 2001/10/08 09:22:38 dwmw2 Exp $ + * + */ + +#define __KERNEL_SYSCALLS__ + +#include +#include +#include +#include +#include +#include +#include +#include "nodelist.h" + + +static int jffs2_garbage_collect_thread(void *); +static int thread_should_wake(struct jffs2_sb_info *c); + +void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) +{ + spin_lock_bh(&c->erase_completion_lock); + if (c->gc_task && thread_should_wake(c)) + send_sig(SIGHUP, c->gc_task, 1); + spin_unlock_bh(&c->erase_completion_lock); +} + +/* This must only ever be called when no GC thread is currently running */ +int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) +{ + pid_t pid; + int ret = 0; + + if (c->gc_task) + BUG(); + + init_MUTEX_LOCKED(&c->gc_thread_start); + init_completion(&c->gc_thread_exit); + + pid = kernel_thread(jffs2_garbage_collect_thread, c, CLONE_FS|CLONE_FILES); + if (pid < 0) { + printk(KERN_WARNING "fork failed for JFFS2 garbage collect thread: %d\n", -pid); + complete(&c->gc_thread_exit); + ret = pid; + } else { + /* Wait for it... */ + D1(printk(KERN_DEBUG "JFFS2: Garbage collect thread is pid %d\n", pid)); + down(&c->gc_thread_start); + } + + return ret; +} + +void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) +{ + spin_lock_bh(&c->erase_completion_lock); + if (c->gc_task) { + D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid)); + send_sig(SIGKILL, c->gc_task, 1); + } + spin_unlock_bh(&c->erase_completion_lock); + wait_for_completion(&c->gc_thread_exit); +} + +static int jffs2_garbage_collect_thread(void *_c) +{ + struct jffs2_sb_info *c = _c; + + daemonize(); + current->tty = NULL; + c->gc_task = current; + up(&c->gc_thread_start); + + sprintf(current->comm, "jffs2_gcd_mtd%d", c->mtd->index); + + /* FIXME in the 2.2 backport */ + current->nice = 10; + + for (;;) { + spin_lock_irq(¤t->sigmask_lock); + siginitsetinv (¤t->blocked, sigmask(SIGHUP) | sigmask(SIGKILL) | sigmask(SIGSTOP) | sigmask(SIGCONT)); + recalc_sigpending(current); + spin_unlock_irq(¤t->sigmask_lock); + + if (!thread_should_wake(c)) { + set_current_state (TASK_INTERRUPTIBLE); + D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n")); + /* Yes, there's a race here; we checked thread_should_wake() before + setting current->state to TASK_INTERRUPTIBLE. But it doesn't + matter - We don't care if we miss a wakeup, because the GC thread + is only an optimisation anyway. */ + schedule(); + } + + if (current->need_resched) + schedule(); + + /* Put_super will send a SIGKILL and then wait on the sem. + */ + while (signal_pending(current)) { + siginfo_t info; + unsigned long signr; + + spin_lock_irq(¤t->sigmask_lock); + signr = dequeue_signal(¤t->blocked, &info); + spin_unlock_irq(¤t->sigmask_lock); + + switch(signr) { + case SIGSTOP: + D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGSTOP received.\n")); + set_current_state(TASK_STOPPED); + schedule(); + break; + + case SIGKILL: + D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGKILL received.\n")); + spin_lock_bh(&c->erase_completion_lock); + c->gc_task = NULL; + spin_unlock_bh(&c->erase_completion_lock); + complete_and_exit(&c->gc_thread_exit, 0); + + case SIGHUP: + D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGHUP received.\n")); + break; + default: + D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): signal %ld received\n", signr)); + + } + } + /* We don't want SIGHUP to interrupt us. STOP and KILL are OK though. */ + spin_lock_irq(¤t->sigmask_lock); + siginitsetinv (¤t->blocked, sigmask(SIGKILL) | sigmask(SIGSTOP) | sigmask(SIGCONT)); + recalc_sigpending(current); + spin_unlock_irq(¤t->sigmask_lock); + + D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): pass\n")); + jffs2_garbage_collect_pass(c); + } +} + +static int thread_should_wake(struct jffs2_sb_info *c) +{ + D1(printk(KERN_DEBUG "thread_should_wake(): nr_free_blocks %d, nr_erasing_blocks %d, dirty_size 0x%x\n", + c->nr_free_blocks, c->nr_erasing_blocks, c->dirty_size)); + if (c->nr_free_blocks + c->nr_erasing_blocks < JFFS2_RESERVED_BLOCKS_GCTRIGGER && + c->dirty_size > c->sector_size) + return 1; + else + return 0; +} diff --git a/packages/fs/jffs2/current/src/build.c b/packages/fs/jffs2/current/src/build.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/build.c @@ -0,0 +1,283 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: build.c,v 1.22 2002/01/09 16:30:57 dwmw2 Exp $ + * + */ + +#ifndef __ECOS +#include +#include +#endif +#include "nodelist.h" + +int jffs2_build_inode_pass1(struct jffs2_sb_info *, struct jffs2_inode_cache *); +int jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *, struct jffs2_inode_cache *); + + +#define for_each_inode(i, c, ic) for (i=0; iinocache_list[i]; ic; ic=ic->next) + +/* Scan plan: + - Scan physical nodes. Build map of inodes/dirents. Allocate inocaches as we go + - Scan directory tree from top down, setting nlink in inocaches + - Scan inocaches for inodes with nlink==0 +*/ +static int jffs2_build_filesystem(struct jffs2_sb_info *c) +{ + int ret; + int i; + struct jffs2_inode_cache *ic; + + /* First, scan the medium and build all the inode caches with + lists of physical nodes */ + ret = jffs2_scan_medium(c); + if (ret) + return ret; + + D1(printk(KERN_DEBUG "Scanned flash completely\n")); + /* Now build the data map for each inode, marking obsoleted nodes + as such, and also increase nlink of any children. */ + for_each_inode(i, c, ic) { + D1(printk(KERN_DEBUG "Pass 1: ino #%u\n", ic->ino)); + ret = jffs2_build_inode_pass1(c, ic); + if (ret) { + D1(printk(KERN_WARNING "Eep. jffs2_build_inode_pass1 for ino %d returned %d\n", ic->ino, ret)); + return ret; + } + } + D1(printk(KERN_DEBUG "Pass 1 complete\n")); + + /* Next, scan for inodes with nlink == 0 and remove them. If + they were directories, then decrement the nlink of their + children too, and repeat the scan. As that's going to be + a fairly uncommon occurrence, it's not so evil to do it this + way. Recursion bad. */ + do { + D1(printk(KERN_DEBUG "Pass 2 (re)starting\n")); + ret = 0; + for_each_inode(i, c, ic) { + D1(printk(KERN_DEBUG "Pass 2: ino #%u, nlink %d, ic %p, nodes %p\n", ic->ino, ic->nlink, ic, ic->nodes)); + if (ic->nlink) + continue; + + ret = jffs2_build_remove_unlinked_inode(c, ic); + if (ret) + break; + /* -EAGAIN means the inode's nlink was zero, so we deleted it, + and furthermore that it had children and their nlink has now + gone to zero too. So we have to restart the scan. */ + } + } while(ret == -EAGAIN); + + D1(printk(KERN_DEBUG "Pass 2 complete\n")); + + /* Finally, we can scan again and free the dirent nodes and scan_info structs */ + for_each_inode(i, c, ic) { + struct jffs2_scan_info *scan = ic->scan; + struct jffs2_full_dirent *fd; + D1(printk(KERN_DEBUG "Pass 3: ino #%u, ic %p, nodes %p\n", ic->ino, ic, ic->nodes)); + if (!scan) { + if (ic->nlink) { + D1(printk(KERN_WARNING "Why no scan struct for ino #%u which has nlink %d?\n", ic->ino, ic->nlink)); + } + continue; + } + ic->scan = NULL; + while(scan->dents) { + fd = scan->dents; + scan->dents = fd->next; + jffs2_free_full_dirent(fd); + } + kfree(scan); + } + D1(printk(KERN_DEBUG "Pass 3 complete\n")); + + return ret; +} + +int jffs2_build_inode_pass1(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic) +{ + struct jffs2_tmp_dnode_info *tn; + struct jffs2_full_dirent *fd; + struct jffs2_node_frag *fraglist = NULL; + struct jffs2_tmp_dnode_info *metadata = NULL; + + D1(printk(KERN_DEBUG "jffs2_build_inode building inode #%u\n", ic->ino)); + if (ic->ino > c->highest_ino) + c->highest_ino = ic->ino; + + if (!ic->scan->tmpnodes && ic->ino != 1) { + D1(printk(KERN_DEBUG "jffs2_build_inode: ino #%u has no data nodes!\n", ic->ino)); + } + /* Build the list to make sure any obsolete nodes are marked as such */ + while(ic->scan->tmpnodes) { + tn = ic->scan->tmpnodes; + ic->scan->tmpnodes = tn->next; + + if (metadata && tn->version > metadata->version) { + D1(printk(KERN_DEBUG "jffs2_build_inode_pass1 ignoring old metadata at 0x%08x\n", + metadata->fn->raw->flash_offset &~3)); + + jffs2_free_full_dnode(metadata->fn); + jffs2_free_tmp_dnode_info(metadata); + metadata = NULL; + } + + if (tn->fn->size) { + jffs2_add_full_dnode_to_fraglist (c, &fraglist, tn->fn); + jffs2_free_tmp_dnode_info(tn); + } else { + if (!metadata) { + metadata = tn; + } else { + D1(printk(KERN_DEBUG "jffs2_build_inode_pass1 ignoring new metadata at 0x%08x\n", + tn->fn->raw->flash_offset &~3)); + + jffs2_free_full_dnode(tn->fn); + jffs2_free_tmp_dnode_info(tn); + } + } + } + + /* OK. Now clear up */ + if (metadata) { + jffs2_free_full_dnode(metadata->fn); + jffs2_free_tmp_dnode_info(metadata); + } + metadata = NULL; + + while (fraglist) { + struct jffs2_node_frag *frag; + frag = fraglist; + fraglist = fraglist->next; + + if (frag->node && !(--frag->node->frags)) { + jffs2_free_full_dnode(frag->node); + } + jffs2_free_node_frag(frag); + } + + /* Now for each child, increase nlink */ + for(fd=ic->scan->dents; fd; fd = fd->next) { + struct jffs2_inode_cache *child_ic; + if (!fd->ino) + continue; + + child_ic = jffs2_get_ino_cache(c, fd->ino); + if (!child_ic) { + printk(KERN_NOTICE "Eep. Child \"%s\" (ino #%u) of dir ino #%u doesn't exist!\n", + fd->name, fd->ino, ic->ino); + continue; + } + + if (child_ic->nlink++ && fd->type == DT_DIR) { + printk(KERN_NOTICE "Child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n", fd->name, fd->ino, ic->ino); + /* What do we do about it? */ + } + D1(printk(KERN_DEBUG "Increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino)); + /* Can't free them. We might need them in pass 2 */ + } + return 0; +} + +int jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic) +{ + struct jffs2_raw_node_ref *raw; + struct jffs2_full_dirent *fd; + int ret = 0; + + if(!ic->scan) { + D1(printk(KERN_DEBUG "ino #%u was already removed\n", ic->ino)); + return 0; + } + + D1(printk(KERN_DEBUG "JFFS2: Removing ino #%u with nlink == zero.\n", ic->ino)); + + for (raw = ic->nodes; raw != (void *)ic; raw = raw->next_in_ino) { + D1(printk(KERN_DEBUG "obsoleting node at 0x%08x\n", raw->flash_offset&~3)); + jffs2_mark_node_obsolete(c, raw); + } + + if (ic->scan->dents) { + printk(KERN_NOTICE "Inode #%u was a directory with children - removing those too...\n", ic->ino); + + while(ic->scan->dents) { + struct jffs2_inode_cache *child_ic; + + fd = ic->scan->dents; + ic->scan->dents = fd->next; + + D1(printk(KERN_DEBUG "Removing child \"%s\", ino #%u\n", + fd->name, fd->ino)); + + child_ic = jffs2_get_ino_cache(c, fd->ino); + if (!child_ic) { + printk(KERN_NOTICE "Cannot remove child \"%s\", ino #%u, because it doesn't exist\n", fd->name, fd->ino); + continue; + } + jffs2_free_full_dirent(fd); + child_ic->nlink--; + } + ret = -EAGAIN; + } + kfree(ic->scan); + ic->scan = NULL; + + /* + We don't delete the inocache from the hash list and free it yet. + The erase code will do that, when all the nodes are completely gone. + */ + + return ret; +} + +int jffs2_do_mount_fs(struct jffs2_sb_info *c) +{ + int i; + + c->free_size = c->flash_size; + c->nr_blocks = c->flash_size / c->sector_size; + c->blocks = kmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks, GFP_KERNEL); + if (!c->blocks) + return -ENOMEM; + for (i=0; inr_blocks; i++) { + INIT_LIST_HEAD(&c->blocks[i].list); + c->blocks[i].offset = i * c->sector_size; + c->blocks[i].free_size = c->sector_size; + c->blocks[i].dirty_size = 0; + c->blocks[i].used_size = 0; + c->blocks[i].first_node = NULL; + c->blocks[i].last_node = NULL; + } + + spin_lock_init(&c->nodelist_lock); + init_MUTEX(&c->alloc_sem); + init_waitqueue_head(&c->erase_wait); + spin_lock_init(&c->erase_completion_lock); + spin_lock_init(&c->inocache_lock); + + INIT_LIST_HEAD(&c->clean_list); + INIT_LIST_HEAD(&c->dirty_list); + INIT_LIST_HEAD(&c->erasing_list); + INIT_LIST_HEAD(&c->erase_pending_list); + INIT_LIST_HEAD(&c->erase_complete_list); + INIT_LIST_HEAD(&c->free_list); + INIT_LIST_HEAD(&c->bad_list); + INIT_LIST_HEAD(&c->bad_used_list); + c->highest_ino = 1; + + if (jffs2_build_filesystem(c)) { + D1(printk(KERN_DEBUG "build_fs failed\n")); + jffs2_free_ino_caches(c); + jffs2_free_raw_node_refs(c); + kfree(c->blocks); + return -EIO; + } + return 0; +} diff --git a/packages/fs/jffs2/current/src/compr.c b/packages/fs/jffs2/current/src/compr.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/compr.c @@ -0,0 +1,139 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by Arjan van de Ven + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: compr.c,v 1.23 2002/01/25 01:49:26 dwmw2 Exp $ + * + */ + +#ifdef __KERNEL__ +#include +#include +#include +#include +#elif defined(__ECOS) +#include "jffs2.h" +#else /* Userland */ +#define KERN_DEBUG +#define KERN_NOTICE +#define KERN_WARNING +#define printk printf +#include +#include +#include +#include +#endif + +int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen); +void jffs2_zlib_decompress(unsigned char *data_in, unsigned char *cpage_out, uint32_t srclen, uint32_t destlen); +int jffs2_rtime_compress(unsigned char *data_in, unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen); +void jffs2_rtime_decompress(unsigned char *data_in, unsigned char *cpage_out, uint32_t srclen, uint32_t destlen); +int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen); +void jffs2_rubinmips_decompress(unsigned char *data_in, unsigned char *cpage_out, uint32_t srclen, uint32_t destlen); +int jffs2_dynrubin_compress(unsigned char *data_in, unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen); +void jffs2_dynrubin_decompress(unsigned char *data_in, unsigned char *cpage_out, uint32_t srclen, uint32_t destlen); + + +/* jffs2_compress: + * @data: Pointer to uncompressed data + * @cdata: Pointer to buffer for compressed data + * @datalen: On entry, holds the amount of data available for compression. + * On exit, expected to hold the amount of data actually compressed. + * @cdatalen: On entry, holds the amount of space available for compressed + * data. On exit, expected to hold the actual size of the compressed + * data. + * + * Returns: Byte to be stored with data indicating compression type used. + * Zero is used to show that the data could not be compressed - the + * compressed version was actually larger than the original. + * + * If the cdata buffer isn't large enough to hold all the uncompressed data, + * jffs2_compress should compress as much as will fit, and should set + * *datalen accordingly to show the amount of data which were compressed. + */ +unsigned char jffs2_compress(unsigned char *data_in, unsigned char *cpage_out, + uint32_t *datalen, uint32_t *cdatalen) +{ + int ret; + + ret = jffs2_zlib_compress(data_in, cpage_out, datalen, cdatalen); + if (!ret) { + return JFFS2_COMPR_ZLIB; + } +#if 0 /* Disabled 23/9/1. With zlib it hardly ever gets a look in */ + ret = jffs2_dynrubin_compress(data_in, cpage_out, datalen, cdatalen); + if (!ret) { + return JFFS2_COMPR_DYNRUBIN; + } +#endif +#if 0 /* Disabled 26/2/1. Obsoleted by dynrubin */ + ret = jffs2_rubinmips_compress(data_in, cpage_out, datalen, cdatalen); + if (!ret) { + return JFFS2_COMPR_RUBINMIPS; + } +#endif + /* rtime does manage to recompress already-compressed data */ + ret = jffs2_rtime_compress(data_in, cpage_out, datalen, cdatalen); + if (!ret) { + return JFFS2_COMPR_RTIME; + } +#if 0 + /* We don't need to copy. Let the caller special-case the COMPR_NONE case. */ + /* If we get here, no compression is going to work */ + /* But we might want to use the fragmentation part -- Arjan */ + memcpy(cpage_out,data_in,min(*datalen,*cdatalen)); + if (*datalen > *cdatalen) + *datalen = *cdatalen; +#endif + return JFFS2_COMPR_NONE; /* We failed to compress */ + +} + + +int jffs2_decompress(unsigned char comprtype, unsigned char *cdata_in, + unsigned char *data_out, uint32_t cdatalen, uint32_t datalen) +{ + switch (comprtype) { + case JFFS2_COMPR_NONE: + /* This should be special-cased elsewhere, but we might as well deal with it */ + memcpy(data_out, cdata_in, datalen); + break; + + case JFFS2_COMPR_ZERO: + memset(data_out, 0, datalen); + break; + + case JFFS2_COMPR_ZLIB: + jffs2_zlib_decompress(cdata_in, data_out, cdatalen, datalen); + break; + + case JFFS2_COMPR_RTIME: + jffs2_rtime_decompress(cdata_in, data_out, cdatalen, datalen); + break; + + case JFFS2_COMPR_RUBINMIPS: +#if 0 /* Disabled 23/9/1 */ + jffs2_rubinmips_decompress(cdata_in, data_out, cdatalen, datalen); +#else + printk(KERN_WARNING "JFFS2: Rubinmips compression encountered but support not compiled in!\n"); +#endif + break; + case JFFS2_COMPR_DYNRUBIN: +#if 1 /* Phase this one out */ + jffs2_dynrubin_decompress(cdata_in, data_out, cdatalen, datalen); +#else + printk(KERN_WARNING "JFFS2: Dynrubin compression encountered but support not compiled in!\n"); +#endif + break; + + default: + printk(KERN_NOTICE "Unknown JFFS2 compression type 0x%02x\n", comprtype); + return -EIO; + } + return 0; +} diff --git a/packages/fs/jffs2/current/src/compr_rtime.c b/packages/fs/jffs2/current/src/compr_rtime.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/compr_rtime.c @@ -0,0 +1,108 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by Arjan van de Ven + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: compr_rtime.c,v 1.8 2002/01/25 01:49:26 dwmw2 Exp $ + * + * + * Very simple lz77-ish encoder. + * + * Theory of operation: Both encoder and decoder have a list of "last + * occurances" for every possible source-value; after sending the + * first source-byte, the second byte indicated the "run" length of + * matches + * + * The algorithm is intended to only send "whole bytes", no bit-messing. + * + */ + +#ifdef __ECOS +#include "jffs2port.h" +#else +#include +#include +#include +#include +#endif + +/* _compress returns the compressed size, -1 if bigger */ +int jffs2_rtime_compress(unsigned char *data_in, unsigned char *cpage_out, + uint32_t *sourcelen, uint32_t *dstlen) +{ + int positions[256]; + int outpos = 0; + int pos=0; + + memset(positions,0,sizeof(positions)); + + while (pos < (*sourcelen) && outpos <= (*dstlen)-2) { + int backpos, runlen=0; + unsigned char value; + + value = data_in[pos]; + + cpage_out[outpos++] = data_in[pos++]; + + backpos = positions[value]; + positions[value]=pos; + + while ((backpos < pos) && (pos < (*sourcelen)) && + (data_in[pos]==data_in[backpos++]) && (runlen<255)) { + pos++; + runlen++; + } + cpage_out[outpos++] = runlen; + } + + if (outpos >= pos) { + /* We failed */ + return -1; + } + + /* Tell the caller how much we managed to compress, and how much space it took */ + *sourcelen = pos; + *dstlen = outpos; + return 0; +} + + +void jffs2_rtime_decompress(unsigned char *data_in, unsigned char *cpage_out, + uint32_t srclen, uint32_t destlen) +{ + int positions[256]; + int outpos = 0; + int pos=0; + + memset(positions,0,sizeof(positions)); + + while (outpos= outpos) { + while(repeat) { + cpage_out[outpos++] = cpage_out[backoffs++]; + repeat--; + } + } else { + memcpy(&cpage_out[outpos],&cpage_out[backoffs],repeat); + outpos+=repeat; + } + } + } +} + + diff --git a/packages/fs/jffs2/current/src/compr_rubin.c b/packages/fs/jffs2/current/src/compr_rubin.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/compr_rubin.c @@ -0,0 +1,329 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by Arjan van de Ven + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: compr_rubin.c,v 1.16 2002/01/25 01:49:26 dwmw2 Exp $ + * + */ + + +#ifdef __ECOS +#include "jffs2port.h" +#else +#include +#include +#endif +#include "compr_rubin.h" +#include "histo_mips.h" + + + +static void init_rubin(struct rubin_state *rs, int div, int *bits) +{ + int c; + + rs->q = 0; + rs->p = (long) (2 * UPPER_BIT_RUBIN); + rs->bit_number = (long) 0; + rs->bit_divider = div; + for (c=0; c<8; c++) + rs->bits[c] = bits[c]; +} + + +static int encode(struct rubin_state *rs, long A, long B, int symbol) +{ + + long i0, i1; + int ret; + + while ((rs->q >= UPPER_BIT_RUBIN) || ((rs->p + rs->q) <= UPPER_BIT_RUBIN)) { + rs->bit_number++; + + ret = pushbit(&rs->pp, (rs->q & UPPER_BIT_RUBIN) ? 1 : 0, 0); + if (ret) + return ret; + rs->q &= LOWER_BITS_RUBIN; + rs->q <<= 1; + rs->p <<= 1; + } + i0 = A * rs->p / (A + B); + if (i0 <= 0) { + i0 = 1; + } + if (i0 >= rs->p) { + i0 = rs->p - 1; + } + i1 = rs->p - i0; + + if (symbol == 0) + rs->p = i0; + else { + rs->p = i1; + rs->q += i0; + } + return 0; +} + + +static void end_rubin(struct rubin_state *rs) +{ + + int i; + + for (i = 0; i < RUBIN_REG_SIZE; i++) { + pushbit(&rs->pp, (UPPER_BIT_RUBIN & rs->q) ? 1 : 0, 1); + rs->q &= LOWER_BITS_RUBIN; + rs->q <<= 1; + } +} + + +static void init_decode(struct rubin_state *rs, int div, int *bits) +{ + init_rubin(rs, div, bits); + + /* behalve lower */ + rs->rec_q = 0; + + for (rs->bit_number = 0; rs->bit_number++ < RUBIN_REG_SIZE; rs->rec_q = rs->rec_q * 2 + (long) (pullbit(&rs->pp))) + ; +} + +static void __do_decode(struct rubin_state *rs, unsigned long p, unsigned long q) +{ + register unsigned long lower_bits_rubin = LOWER_BITS_RUBIN; + unsigned long rec_q; + int c, bits = 0; + + /* + * First, work out how many bits we need from the input stream. + * Note that we have already done the initial check on this + * loop prior to calling this function. + */ + do { + bits++; + q &= lower_bits_rubin; + q <<= 1; + p <<= 1; + } while ((q >= UPPER_BIT_RUBIN) || ((p + q) <= UPPER_BIT_RUBIN)); + + rs->p = p; + rs->q = q; + + rs->bit_number += bits; + + /* + * Now get the bits. We really want this to be "get n bits". + */ + rec_q = rs->rec_q; + do { + c = pullbit(&rs->pp); + rec_q &= lower_bits_rubin; + rec_q <<= 1; + rec_q += c; + } while (--bits); + rs->rec_q = rec_q; +} + +static int decode(struct rubin_state *rs, long A, long B) +{ + unsigned long p = rs->p, q = rs->q; + long i0, threshold; + int symbol; + + if (q >= UPPER_BIT_RUBIN || ((p + q) <= UPPER_BIT_RUBIN)) + __do_decode(rs, p, q); + + i0 = A * rs->p / (A + B); + if (i0 <= 0) { + i0 = 1; + } + if (i0 >= rs->p) { + i0 = rs->p - 1; + } + + threshold = rs->q + i0; + symbol = rs->rec_q >= threshold; + if (rs->rec_q >= threshold) { + rs->q += i0; + i0 = rs->p - i0; + } + + rs->p = i0; + + return symbol; +} + + + +static int out_byte(struct rubin_state *rs, unsigned char byte) +{ + int i, ret; + struct rubin_state rs_copy; + rs_copy = *rs; + + for (i=0;i<8;i++) { + ret = encode(rs, rs->bit_divider-rs->bits[i],rs->bits[i],byte&1); + if (ret) { + /* Failed. Restore old state */ + *rs = rs_copy; + return ret; + } + byte=byte>>1; + } + return 0; +} + +static int in_byte(struct rubin_state *rs) +{ + int i, result = 0, bit_divider = rs->bit_divider; + + for (i = 0; i < 8; i++) + result |= decode(rs, bit_divider - rs->bits[i], rs->bits[i]) << i; + + return result; +} + + + +static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in, + unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen) + { + int outpos = 0; + int pos=0; + struct rubin_state rs; + + init_pushpull(&rs.pp, cpage_out, *dstlen * 8, 0, 32); + + init_rubin(&rs, bit_divider, bits); + + while (pos < (*sourcelen) && !out_byte(&rs, data_in[pos])) + pos++; + + end_rubin(&rs); + + if (outpos > pos) { + /* We failed */ + return -1; + } + + /* Tell the caller how much we managed to compress, + * and how much space it took */ + + outpos = (pushedbits(&rs.pp)+7)/8; + + if (outpos >= pos) + return -1; /* We didn't actually compress */ + *sourcelen = pos; + *dstlen = outpos; + return 0; +} +#if 0 +/* _compress returns the compressed size, -1 if bigger */ +int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out, + uint32_t *sourcelen, uint32_t *dstlen) +{ + return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen); +} +#endif +int jffs2_dynrubin_compress(unsigned char *data_in, unsigned char *cpage_out, + uint32_t *sourcelen, uint32_t *dstlen) +{ + int bits[8]; + unsigned char histo[256]; + int i; + int ret; + uint32_t mysrclen, mydstlen; + + mysrclen = *sourcelen; + mydstlen = *dstlen - 8; + + if (*dstlen <= 12) + return -1; + + memset(histo, 0, 256); + for (i=0; i 255) bits[i] = 255; + cpage_out[i] = bits[i]; + } + + ret = rubin_do_compress(256, bits, data_in, cpage_out+8, &mysrclen, &mydstlen); + if (ret) + return ret; + + /* Add back the 8 bytes we took for the probabilities */ + mydstlen += 8; + + if (mysrclen <= mydstlen) { + /* We compressed */ + return -1; + } + + *sourcelen = mysrclen; + *dstlen = mydstlen; + return 0; +} + +static void rubin_do_decompress(int bit_divider, int *bits, unsigned char *cdata_in, + unsigned char *page_out, uint32_t srclen, uint32_t destlen) +{ + int outpos = 0; + struct rubin_state rs; + + init_pushpull(&rs.pp, cdata_in, srclen, 0, 0); + init_decode(&rs, bit_divider, bits); + + while (outpos < destlen) { + page_out[outpos++] = in_byte(&rs); + } +} + + +void jffs2_rubinmips_decompress(unsigned char *data_in, unsigned char *cpage_out, + uint32_t sourcelen, uint32_t dstlen) +{ + rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen); +} + +void jffs2_dynrubin_decompress(unsigned char *data_in, unsigned char *cpage_out, + uint32_t sourcelen, uint32_t dstlen) +{ + int bits[8]; + int c; + + for (c=0; c<8; c++) + bits[c] = data_in[c]; + + rubin_do_decompress(256, bits, data_in+8, cpage_out, sourcelen-8, dstlen); +} diff --git a/packages/fs/jffs2/current/src/compr_rubin.h b/packages/fs/jffs2/current/src/compr_rubin.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/compr_rubin.h @@ -0,0 +1,21 @@ +/* Rubin encoder/decoder header */ +/* work started at : aug 3, 1994 */ +/* last modification : aug 15, 1994 */ +/* $Id: compr_rubin.h,v 1.6 2002/01/25 01:49:26 dwmw2 Exp $ */ + +#include "pushpull.h" + +#define RUBIN_REG_SIZE 16 +#define UPPER_BIT_RUBIN (((long) 1)<<(RUBIN_REG_SIZE-1)) +#define LOWER_BITS_RUBIN ((((long) 1)<<(RUBIN_REG_SIZE-1))-1) + + +struct rubin_state { + unsigned long p; + unsigned long q; + unsigned long rec_q; + long bit_number; + struct pushpull pp; + int bit_divider; + int bits[8]; +}; diff --git a/packages/fs/jffs2/current/src/compr_zlib.c b/packages/fs/jffs2/current/src/compr_zlib.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/compr_zlib.c @@ -0,0 +1,169 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: compr_zlib.c,v 1.12 2002/01/25 01:49:26 dwmw2 Exp $ + * + */ + +/* Be careful - there are three environments are supported by this file. + * - Linux kernel. + * - eCos kernel. + * - Userspace (mkfs.jffs2). + */ + +#ifdef __ECOS + /* Compiling in eCos (or RedBoot) */ +#include +#include "jffs2port.h" +#include "nodelist.h" + +#elif defined(__KERNEL__) + /* Compiling in Linux kernel */ +#include +#include +#include /* for min() */ +#include +#include +#include "nodelist.h" + +static void *zalloc(void *opaque, unsigned nr, unsigned size) +{ + /* How much does it request? Should we use vmalloc? Or be dynamic? */ + return kmalloc(nr * size, GFP_KERNEL); +} + +static void zfree(void *opaque, void *addr) +{ + kfree(addr); +} +#ifdef CONFIG_ZLIB /* 2.5 kernels will have a shared zlib, at last. */ +#include +#else +#include "zlib.h" +#endif + +#else + /* Compiling in Linux(ish) userspace */ +#define min(x,y) ((x)<(y)?(x):(y)) +#ifndef D1 +#define D1(x) +#endif +#define KERN_DEBUG +#define KERN_NOTICE +#define KERN_WARNING +#define printk printf +#include +#include +#include +#endif + + /* Plan: call deflate() with avail_in == *sourcelen, + avail_out = *dstlen - 12 and flush == Z_FINISH. + If it doesn't manage to finish, call it again with + avail_in == 0 and avail_out set to the remaining 12 + bytes for it to clean up. + Q: Is 12 bytes sufficient? + */ +#define STREAM_END_SPACE 12 + +int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, + uint32_t *sourcelen, uint32_t *dstlen) +{ + z_stream strm; + int ret; + + if (*dstlen <= STREAM_END_SPACE) + return -1; + +#ifdef __KERNEL__ /* Linux needs own alloc/free funcs */ + strm.zalloc = zalloc; + strm.zfree = zfree; +#else /* eCos and userspace don't */ + strm.zalloc = (void *)0; + strm.zfree = (void *)0; +#endif + + if (Z_OK != deflateInit(&strm, 3)) { + printk(KERN_WARNING "deflateInit failed\n"); + return -1; + } + strm.next_in = data_in; + strm.total_in = 0; + + strm.next_out = cpage_out; + strm.total_out = 0; + + while (strm.total_out < *dstlen - STREAM_END_SPACE && strm.total_in < *sourcelen) { + strm.avail_out = *dstlen - (strm.total_out + STREAM_END_SPACE); + strm.avail_in = min((unsigned)(*sourcelen-strm.total_in), strm.avail_out); + D1(printk(KERN_DEBUG "calling deflate with avail_in %d, avail_out %d\n", + strm.avail_in, strm.avail_out)); + ret = deflate(&strm, Z_PARTIAL_FLUSH); + D1(printk(KERN_DEBUG "deflate returned with avail_in %d, avail_out %d, total_in %ld, total_out %ld\n", + strm.avail_in, strm.avail_out, strm.total_in, strm.total_out)); + if (ret != Z_OK) { + D1(printk(KERN_DEBUG "deflate in loop returned %d\n", ret)); + deflateEnd(&strm); + return -1; + } + } + strm.avail_out += STREAM_END_SPACE; + strm.avail_in = 0; + ret = deflate(&strm, Z_FINISH); + if (ret != Z_STREAM_END) { + D1(printk(KERN_DEBUG "final deflate returned %d\n", ret)); + deflateEnd(&strm); + return -1; + } + deflateEnd(&strm); + + D1(printk(KERN_DEBUG "zlib compressed %ld bytes into %ld\n", strm.total_in, strm.total_out)); + + if (strm.total_out >= strm.total_in) + return -1; + + + *dstlen = strm.total_out; + *sourcelen = strm.total_in; + return 0; +} + +void jffs2_zlib_decompress(unsigned char *data_in, unsigned char *cpage_out, + uint32_t srclen, uint32_t destlen) +{ + z_stream strm; + int ret; + +#ifdef __KERNEL__ + strm.zalloc = zalloc; + strm.zfree = zfree; +#else + strm.zalloc = (void *)0; + strm.zfree = (void *)0; +#endif + + if (Z_OK != inflateInit(&strm)) { + printk(KERN_WARNING "inflateInit failed\n"); + return; + } + strm.next_in = data_in; + strm.avail_in = srclen; + strm.total_in = 0; + + strm.next_out = cpage_out; + strm.avail_out = destlen; + strm.total_out = 0; + + while((ret = inflate(&strm, Z_FINISH)) == Z_OK) + ; + if (ret != Z_STREAM_END) { + printk(KERN_NOTICE "inflate returned %d\n", ret); + } + inflateEnd(&strm); +} diff --git a/packages/fs/jffs2/current/src/crc32.c b/packages/fs/jffs2/current/src/crc32.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/crc32.c @@ -0,0 +1,97 @@ +/* + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + * + * First, the polynomial itself and its table of feedback terms. The + * polynomial is + * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 + * + * Note that we take it "backwards" and put the highest-order term in + * the lowest-order bit. The X^32 term is "implied"; the LSB is the + * X^31 term, etc. The X^0 term (usually shown as "+1") results in + * the MSB being 1 + * + * Note that the usual hardware shift register implementation, which + * is what we're using (we're merely optimizing it by doing eight-bit + * chunks at a time) shifts bits into the lowest-order term. In our + * implementation, that means shifting towards the right. Why do we + * do it this way? Because the calculated CRC must be transmitted in + * order from highest-order term to lowest-order term. UARTs transmit + * characters in order from LSB to MSB. By storing the CRC this way + * we hand it to the UART in the order low-byte to high-byte; the UART + * sends each low-bit to hight-bit; and the result is transmission bit + * by bit from highest- to lowest-order term without requiring any bit + * shuffling on our part. Reception works similarly + * + * The feedback terms table consists of 256, 32-bit entries. Notes + * + * The table can be generated at runtime if desired; code to do so + * is shown later. It might not be obvious, but the feedback + * terms simply represent the results of eight shift/xor opera + * tions for all combinations of data and CRC register values + * + * The values must be right-shifted by eight bits by the "updcrc + * logic; the shift must be unsigned (bring in zeroes). On some + * hardware you could probably optimize the shift in assembler by + * using byte-swap instructions + * polynomial $edb88320 + */ + +/* $Id: crc32.c,v 1.4 2002/01/03 15:20:44 dwmw2 Exp $ */ + +#include "crc32.h" + +const uint32_t crc32_table[256] = { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL +}; diff --git a/packages/fs/jffs2/current/src/crc32.h b/packages/fs/jffs2/current/src/crc32.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/crc32.h @@ -0,0 +1,25 @@ +#ifndef CRC32_H +#define CRC32_H + +/* $Id: crc32.h,v 1.4 2002/01/03 15:20:44 dwmw2 Exp $ */ + +#ifdef __ECOS +#include "jffs2port.h" +#else +#include +#endif + +extern const uint32_t crc32_table[256]; + +/* Return a 32-bit CRC of the contents of the buffer. */ + +static inline uint32_t +crc32(uint32_t val, const void *ss, int len) +{ + const unsigned char *s = ss; + while (--len >= 0) + val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8); + return val; +} + +#endif diff --git a/packages/fs/jffs2/current/src/dir-ecos.c b/packages/fs/jffs2/current/src/dir-ecos.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/dir-ecos.c @@ -0,0 +1,333 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * In sync with: + * $Id: dir.c,v 1.57 2002/01/28 22:25:07 dwmw2 Exp $ + * + */ + +#include "nodelist.h" +#include "crc32.h" + +/***********************************************************************/ + + +/* We keep the dirent list sorted in increasing order of name hash, + and we use the same hash function as the dentries. Makes this + nice and simple +*/ +struct inode *jffs2_lookup(struct inode *dir_i, struct qstr *d_name) +{ + struct jffs2_inode_info *dir_f; + struct jffs2_sb_info *c; + struct jffs2_full_dirent *fd = NULL, *fd_list; + uint32_t ino = 0; + struct inode *inode = NULL; + + D1(printk(KERN_DEBUG "jffs2_lookup()\n")); + + dir_f = JFFS2_INODE_INFO(dir_i); + c = JFFS2_SB_INFO(dir_i->i_sb); + + down(&dir_f->sem); + + /* NB: The 2.2 backport will need to explicitly check for '.' and '..' here */ + for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= d_name->hash; fd_list = fd_list->next) { + if (fd_list->nhash == d_name->hash && + (!fd || fd_list->version > fd->version) && + strlen(fd_list->name) == d_name->len && + !strncmp(fd_list->name, d_name->name, d_name->len)) { + fd = fd_list; + } + } + if (fd) + ino = fd->ino; + up(&dir_f->sem); + if (ino) { + inode = iget(dir_i->i_sb, ino); + if (!inode) { + printk(KERN_WARNING "iget() failed for ino #%u\n", ino); + return (ERR_PTR(-EIO)); + } + } + + return inode; +} + +/***********************************************************************/ + + + +int jffs2_create(struct inode *dir_i, struct qstr *d_name, int mode, + struct inode **new_i) +{ + struct jffs2_raw_inode *ri; + struct jffs2_inode_info *f, *dir_f; + struct jffs2_sb_info *c; + struct inode *inode; + int ret; + + ri = jffs2_alloc_raw_inode(); + if (!ri) + return -ENOMEM; + + c = JFFS2_SB_INFO(dir_i->i_sb); + + D1(printk(KERN_DEBUG "jffs2_create()\n")); + + inode = jffs2_new_inode(dir_i, mode, ri); + + if (IS_ERR(inode)) { + D1(printk(KERN_DEBUG "jffs2_new_inode() failed\n")); + jffs2_free_raw_inode(ri); + return PTR_ERR(inode); + } + + f = JFFS2_INODE_INFO(inode); + dir_f = JFFS2_INODE_INFO(dir_i); + + ret = jffs2_do_create(c, dir_f, f, ri, + d_name->name, d_name->len); + + if (ret) { + jffs2_clear_inode(inode); + make_bad_inode(inode); + iput(inode); + jffs2_free_raw_inode(ri); + return ret; + } + + jffs2_free_raw_inode(ri); + + D1(printk(KERN_DEBUG "jffs2_create: Created ino #%lu with mode %o, nlink %d(%d)\n", + inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->nlink)); + *new_i = inode; + return 0; +} + +/***********************************************************************/ + + +int jffs2_unlink(struct inode *dir_i, struct inode *d_inode, struct qstr *d_name) +{ + struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); + struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); + struct jffs2_inode_info *dead_f = JFFS2_INODE_INFO(d_inode); + int ret; + + ret = jffs2_do_unlink(c, dir_f, d_name->name, + d_name->len, dead_f); + d_inode->i_nlink = dead_f->inocache->nlink; + return ret; +} +/***********************************************************************/ + + +int jffs2_link (struct inode *old_d_inode, struct inode *dir_i, struct qstr *d_name) +{ + struct jffs2_sb_info *c = JFFS2_SB_INFO(old_d_inode->i_sb); + struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_d_inode); + struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); + int ret; + + /* XXX: This is ugly */ + uint8_t type = (old_d_inode->i_mode & S_IFMT) >> 12; + if (!type) type = DT_REG; + + ret = jffs2_do_link(c, dir_f, f->inocache->ino, type, d_name->name, d_name->len); + + if (!ret) { + down(&f->sem); + old_d_inode->i_nlink = ++f->inocache->nlink; + up(&f->sem); + } + return ret; +} + +int jffs2_mkdir (struct inode *dir_i, struct qstr *d_name, int mode, struct inode **new_i) +{ + struct jffs2_inode_info *f, *dir_f; + struct jffs2_sb_info *c; + struct inode *inode; + struct jffs2_raw_inode *ri; + struct jffs2_raw_dirent *rd; + struct jffs2_full_dnode *fn; + struct jffs2_full_dirent *fd; + int namelen; + uint32_t alloclen, phys_ofs; + uint32_t writtenlen; + int ret; + + mode |= S_IFDIR; + + ri = jffs2_alloc_raw_inode(); + if (!ri) + return -ENOMEM; + + c = JFFS2_SB_INFO(dir_i->i_sb); + + /* Try to reserve enough space for both node and dirent. + * Just the node will do for now, though + */ + namelen = d_name->len; + ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL); + + if (ret) { + jffs2_free_raw_inode(ri); + return ret; + } + + inode = jffs2_new_inode(dir_i, mode, ri); + + if (IS_ERR(inode)) { + jffs2_free_raw_inode(ri); + jffs2_complete_reservation(c); + return PTR_ERR(inode); + } + + f = JFFS2_INODE_INFO(inode); + + ri->data_crc = 0; + ri->node_crc = crc32(0, ri, sizeof(*ri)-8); + + fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, &writtenlen); + + jffs2_free_raw_inode(ri); + + if (IS_ERR(fn)) { + /* Eeek. Wave bye bye */ + up(&f->sem); + jffs2_complete_reservation(c); + jffs2_clear_inode(inode); + return PTR_ERR(fn); + } + /* No data here. Only a metadata node, which will be + obsoleted by the first data write + */ + f->metadata = fn; + up(&f->sem); + + /* Work out where to put the dirent node now. */ + writtenlen = PAD(writtenlen); + phys_ofs += writtenlen; + alloclen -= writtenlen; + + if (alloclen < sizeof(*rd)+namelen) { + /* Not enough space left in this chunk. Get some more */ + jffs2_complete_reservation(c); + ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_NORMAL); + if (ret) { + /* Eep. */ + jffs2_clear_inode(inode); + return ret; + } + } + + rd = jffs2_alloc_raw_dirent(); + if (!rd) { + /* Argh. Now we treat it like a normal delete */ + jffs2_complete_reservation(c); + jffs2_clear_inode(inode); + return -ENOMEM; + } + + dir_f = JFFS2_INODE_INFO(dir_i); + down(&dir_f->sem); + + rd->magic = JFFS2_MAGIC_BITMASK; + rd->nodetype = JFFS2_NODETYPE_DIRENT; + rd->totlen = sizeof(*rd) + namelen; + rd->hdr_crc = crc32(0, rd, sizeof(struct jffs2_unknown_node)-4); + + rd->pino = dir_i->i_ino; + rd->version = ++dir_f->highest_version; + rd->ino = inode->i_ino; + rd->mctime = CURRENT_TIME; + rd->nsize = namelen; + rd->type = DT_DIR; + rd->node_crc = crc32(0, rd, sizeof(*rd)-8); + rd->name_crc = crc32(0, d_name->name, namelen); + + fd = jffs2_write_dirent(c, dir_f, rd, d_name->name, namelen, phys_ofs, &writtenlen); + + jffs2_complete_reservation(c); + jffs2_free_raw_dirent(rd); + + if (IS_ERR(fd)) { + /* dirent failed to write. Delete the inode normally + as if it were the final unlink() */ + up(&dir_f->sem); + jffs2_clear_inode(inode); + return PTR_ERR(fd); + } + + /* Link the fd into the inode's list, obsoleting an old + one if necessary. */ + jffs2_add_fd_to_list(c, fd, &dir_f->dents); + up(&dir_f->sem); + + *new_i = inode; + return 0; +} + +int jffs2_rmdir (struct inode *dir_i, struct inode *d_inode, struct qstr *d_name) +{ + struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode); + struct jffs2_full_dirent *fd; + + for (fd = f->dents ; fd; fd = fd->next) { + if (fd->ino) + return EPERM; //-ENOTEMPTY; + } + return jffs2_unlink(dir_i, d_inode, d_name); +} + +int jffs2_rename (struct inode *old_dir_i, struct inode *d_inode, struct qstr *old_d_name, + struct inode *new_dir_i, struct qstr *new_d_name) +{ + int ret; + struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); + uint8_t type; + + /* XXX: We probably ought to alloc enough space for + both nodes at the same time. Writing the new link, + then getting -ENOSPC, is quite bad :) + */ + + /* Make a hard link */ + + /* XXX: This is ugly */ + type = (d_inode->i_mode & S_IFMT) >> 12; + if (!type) type = DT_REG; + + ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i), + d_inode->i_ino, type, + new_d_name->name, new_d_name->len); + + if (ret) + return ret; + + /* Unlink the original */ + ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), + old_d_name->name, old_d_name->len, NULL); + + /* We don't touch inode->i_nlink */ + + if (ret) { + /* Oh shit. We really ought to make a single node which can do both atomically */ + struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode); + down(&f->sem); + d_inode->i_nlink = f->inocache->nlink++; + up(&f->sem); + + printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret); + } + return ret; +} + diff --git a/packages/fs/jffs2/current/src/erase.c b/packages/fs/jffs2/current/src/erase.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/erase.c @@ -0,0 +1,376 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: erase.c,v 1.30 2002/01/09 13:25:57 dwmw2 Exp $ + * + */ + +#ifndef __ECOS +#include +#include +#include +#include +#endif +#include "nodelist.h" +#include "crc32.h" + +struct erase_priv_struct { + struct jffs2_eraseblock *jeb; + struct jffs2_sb_info *c; +}; + +#ifndef __ECOS +static void jffs2_erase_callback(struct erase_info *); +#endif +static void jffs2_erase_succeeded(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); +static void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); + +void jffs2_erase_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) +{ + int ret; +#ifdef __ECOS + ret = jffs2_flash_erase(c, jeb); + if (!ret) { + jffs2_erase_succeeded(c, jeb); + return; + } +#else /* Linux */ + struct erase_info *instr; + + instr = kmalloc(sizeof(struct erase_info) + sizeof(struct erase_priv_struct), GFP_KERNEL); + if (!instr) { + printk(KERN_WARNING "kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n"); + spin_lock_bh(&c->erase_completion_lock); + list_del(&jeb->list); + list_add(&jeb->list, &c->erase_pending_list); + c->erasing_size -= c->sector_size; + spin_unlock_bh(&c->erase_completion_lock); + return; + } + + memset(instr, 0, sizeof(*instr)); + + instr->mtd = c->mtd; + instr->addr = jeb->offset; + instr->len = c->sector_size; + instr->callback = jffs2_erase_callback; + instr->priv = (unsigned long)(&instr[1]); + + ((struct erase_priv_struct *)instr->priv)->jeb = jeb; + ((struct erase_priv_struct *)instr->priv)->c = c; + + ret = c->mtd->erase(c->mtd, instr); + if (!ret) + return; + + kfree(instr); +#endif + if (ret == -ENOMEM || ret == -EAGAIN) { + /* Erase failed immediately. Refile it on the list */ + D1(printk(KERN_DEBUG "Erase at 0x%08x failed: %d. Refiling on erase_pending_list\n", jeb->offset, ret)); + spin_lock_bh(&c->erase_completion_lock); + list_del(&jeb->list); + list_add(&jeb->list, &c->erase_pending_list); + c->erasing_size -= c->sector_size; + spin_unlock_bh(&c->erase_completion_lock); + return; + } + + if (ret == -EROFS) + printk(KERN_WARNING "Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n", jeb->offset); + else + printk(KERN_WARNING "Erase at 0x%08x failed immediately: errno %d\n", jeb->offset, ret); + + spin_lock_bh(&c->erase_completion_lock); + list_del(&jeb->list); + list_add(&jeb->list, &c->bad_list); + c->nr_erasing_blocks--; + c->bad_size += c->sector_size; + c->erasing_size -= c->sector_size; + spin_unlock_bh(&c->erase_completion_lock); + wake_up(&c->erase_wait); +} + +void jffs2_erase_pending_blocks(struct jffs2_sb_info *c) +{ + struct jffs2_eraseblock *jeb; + + spin_lock_bh(&c->erase_completion_lock); + while (!list_empty(&c->erase_pending_list)) { + + jeb = list_entry(c->erase_pending_list.next, struct jffs2_eraseblock, list); + + D1(printk(KERN_DEBUG "Starting erase of pending block 0x%08x\n", jeb->offset)); + + list_del(&jeb->list); + c->erasing_size += c->sector_size; + c->free_size -= jeb->free_size; + c->used_size -= jeb->used_size; + c->dirty_size -= jeb->dirty_size; + jeb->used_size = jeb->dirty_size = jeb->free_size = 0; + jffs2_free_all_node_refs(c, jeb); + list_add(&jeb->list, &c->erasing_list); + spin_unlock_bh(&c->erase_completion_lock); + + jffs2_erase_block(c, jeb); +#ifndef __ECOS + /* Be nice */ + if (current->need_resched) + schedule(); +#endif + spin_lock_bh(&c->erase_completion_lock); + } + spin_unlock_bh(&c->erase_completion_lock); + D1(printk(KERN_DEBUG "jffs2_erase_pending_blocks completed\n")); +} + + +static void jffs2_erase_succeeded(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) +{ + D1(printk(KERN_DEBUG "Erase completed successfully at 0x%08x\n", jeb->offset)); + spin_lock(&c->erase_completion_lock); + list_del(&jeb->list); + list_add_tail(&jeb->list, &c->erase_complete_list); + spin_unlock(&c->erase_completion_lock); +} + +#ifndef __ECOS +static inline void jffs2_erase_failed(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) +{ + spin_lock(&c->erase_completion_lock); + c->erasing_size -= c->sector_size; + c->bad_size += c->sector_size; + list_del(&jeb->list); + list_add(&jeb->list, &c->bad_list); + c->nr_erasing_blocks--; + spin_unlock(&c->erase_completion_lock); + wake_up(&c->erase_wait); +} + +static void jffs2_erase_callback(struct erase_info *instr) +{ + struct erase_priv_struct *priv = (void *)instr->priv; + + if(instr->state != MTD_ERASE_DONE) { + printk(KERN_WARNING "Erase at 0x%08x finished, but state != MTD_ERASE_DONE. State is 0x%x instead.\n", instr->addr, instr->state); + jffs2_erase_failed(priv->c, priv->jeb); + } else { + jffs2_erase_succeeded(priv->c, priv->jeb); + } + /* Make sure someone picks up the block off the erase_complete list */ + OFNI_BS_2SFFJ(priv->c)->s_dirt = 1; + kfree(instr); +} +#endif + +/* Hmmm. Maybe we should accept the extra space it takes and make + this a standard doubly-linked list? */ +static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c, + struct jffs2_raw_node_ref *ref, struct jffs2_eraseblock *jeb) +{ + struct jffs2_inode_cache *ic = NULL; + struct jffs2_raw_node_ref **prev; + + prev = &ref->next_in_ino; + + /* Walk the inode's list once, removing any nodes from this eraseblock */ + while (1) { + if (!(*prev)->next_in_ino) { + /* We're looking at the jffs2_inode_cache, which is + at the end of the linked list. Stash it and continue + from the beginning of the list */ + ic = (struct jffs2_inode_cache *)(*prev); + prev = &ic->nodes; + continue; + } + + if (((*prev)->flash_offset & ~(c->sector_size -1)) == jeb->offset) { + /* It's in the block we're erasing */ + struct jffs2_raw_node_ref *this; + + this = *prev; + *prev = this->next_in_ino; + this->next_in_ino = NULL; + + if (this == ref) + break; + + continue; + } + /* Not to be deleted. Skip */ + prev = &((*prev)->next_in_ino); + } + + /* PARANOIA */ + if (!ic) { + printk(KERN_WARNING "inode_cache not found in remove_node_refs()!!\n"); + return; + } + + D1(printk(KERN_DEBUG "Removed nodes in range 0x%08x-0x%08x from ino #%u\n", + jeb->offset, jeb->offset + c->sector_size, ic->ino)); + + D2({ + int i=0; + struct jffs2_raw_node_ref *this; + printk(KERN_DEBUG "After remove_node_refs_from_ino_list: \n" KERN_DEBUG); + + this = ic->nodes; + + while(this) { + printk( "0x%08x(%d)->", this->flash_offset & ~3, this->flash_offset &3); + if (++i == 5) { + printk("\n" KERN_DEBUG); + i=0; + } + this = this->next_in_ino; + } + printk("\n"); + }); + + if (ic->nodes == (void *)ic) { + D1(printk(KERN_DEBUG "inocache for ino #%u is all gone now. Freeing\n", ic->ino)); + jffs2_del_ino_cache(c, ic); + jffs2_free_inode_cache(ic); + } +} + +static void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) +{ + struct jffs2_raw_node_ref *ref; + D1(printk(KERN_DEBUG "Freeing all node refs for eraseblock offset 0x%08x\n", jeb->offset)); + while(jeb->first_node) { + ref = jeb->first_node; + jeb->first_node = ref->next_phys; + + /* Remove from the inode-list */ + if (ref->next_in_ino) + jffs2_remove_node_refs_from_ino_list(c, ref, jeb); + /* else it was a non-inode node or already removed, so don't bother */ + + jffs2_free_raw_node_ref(ref); + } + jeb->last_node = NULL; +} + +void jffs2_erase_pending_trigger(struct jffs2_sb_info *c) +{ + OFNI_BS_2SFFJ(c)->s_dirt = 1; +} + +void jffs2_mark_erased_blocks(struct jffs2_sb_info *c) +{ + static struct jffs2_unknown_node marker = {JFFS2_MAGIC_BITMASK, JFFS2_NODETYPE_CLEANMARKER, sizeof(struct jffs2_unknown_node)}; + struct jffs2_eraseblock *jeb; + struct jffs2_raw_node_ref *marker_ref; + unsigned char *ebuf; + size_t retlen; + int ret; + + marker.hdr_crc = crc32(0, &marker, sizeof(struct jffs2_unknown_node)-4); + + spin_lock_bh(&c->erase_completion_lock); + while (!list_empty(&c->erase_complete_list)) { + jeb = list_entry(c->erase_complete_list.next, struct jffs2_eraseblock, list); + list_del(&jeb->list); + spin_unlock_bh(&c->erase_completion_lock); + + marker_ref = jffs2_alloc_raw_node_ref(); + if (!marker_ref) { + printk(KERN_WARNING "Failed to allocate raw node ref for clean marker\n"); + /* Come back later */ + jffs2_erase_pending_trigger(c); + return; + } + + ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL); + if (!ebuf) { + printk(KERN_WARNING "Failed to allocate page buffer for verifying erase at 0x%08x. Assuming it worked\n", jeb->offset); + } else { + uint32_t ofs = jeb->offset; + + D1(printk(KERN_DEBUG "Verifying erase at 0x%08x\n", jeb->offset)); + while(ofs < jeb->offset + c->sector_size) { + uint32_t readlen = min((uint32_t)PAGE_SIZE, jeb->offset + c->sector_size - ofs); + int i; + + ret = jffs2_flash_read(c, ofs, readlen, &retlen, ebuf); + if (ret < 0) { + printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret); + goto bad; + } + if (retlen != readlen) { + printk(KERN_WARNING "Short read from newly-erased block at 0x%08x. Wanted %d, got %d\n", ofs, readlen, retlen); + goto bad; + } + for (i=0; ierase_completion_lock); + c->erasing_size -= c->sector_size; + c->bad_size += c->sector_size; + + list_add_tail(&jeb->list, &c->bad_list); + c->nr_erasing_blocks--; + spin_unlock_bh(&c->erase_completion_lock); + wake_up(&c->erase_wait); + return; + } + } + ofs += readlen; + } + kfree(ebuf); + } + + /* Write the erase complete marker */ + D1(printk(KERN_DEBUG "Writing erased marker to block at 0x%08x\n", jeb->offset)); + ret = jffs2_flash_write(c, jeb->offset, sizeof(marker), &retlen, (char *)&marker); + if (ret) { + printk(KERN_WARNING "Write clean marker to block at 0x%08x failed: %d\n", + jeb->offset, ret); + goto bad2; + } + if (retlen != sizeof(marker)) { + printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %d, got %d\n", + jeb->offset, sizeof(marker), retlen); + goto bad2; + } + + marker_ref->next_in_ino = NULL; + marker_ref->next_phys = NULL; + marker_ref->flash_offset = jeb->offset; + marker_ref->totlen = PAD(sizeof(marker)); + + jeb->first_node = jeb->last_node = marker_ref; + + jeb->free_size = c->sector_size - marker_ref->totlen; + jeb->used_size = marker_ref->totlen; + jeb->dirty_size = 0; + + spin_lock_bh(&c->erase_completion_lock); + c->erasing_size -= c->sector_size; + c->free_size += jeb->free_size; + c->used_size += jeb->used_size; + + ACCT_SANITY_CHECK(c,jeb); + ACCT_PARANOIA_CHECK(jeb); + + list_add_tail(&jeb->list, &c->free_list); + c->nr_erasing_blocks--; + c->nr_free_blocks++; + wake_up(&c->erase_wait); + } + spin_unlock_bh(&c->erase_completion_lock); +} diff --git a/packages/fs/jffs2/current/src/file-ecos.c b/packages/fs/jffs2/current/src/file-ecos.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/file-ecos.c @@ -0,0 +1,217 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: file.c,v 1.63 2002/01/07 11:18:05 dwmw2 Exp $ + * + */ + +//#include +//#include /* for min() */ +//#include +//#include +//#include +#include "jffs2.h" +#include "nodelist.h" +#include "crc32.h" + +int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg) +{ + struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); + struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); + unsigned char *pg_buf; + int ret; + + D1(printk(KERN_DEBUG "jffs2_do_readpage_nolock(): ino #%lu, page at offset 0x%lx\n", inode->i_ino, pg->index << PAGE_CACHE_SHIFT)); + + if (!PageLocked(pg)) + PAGE_BUG(pg); + + pg_buf = (char *)kmap(pg); + /* FIXME: Can kmap fail? */ + + ret = jffs2_read_inode_range(c, f, pg_buf, pg->index << PAGE_CACHE_SHIFT, PAGE_CACHE_SIZE); + + if (ret) { + ClearPageUptodate(pg); + SetPageError(pg); + } else { + SetPageUptodate(pg); + ClearPageError(pg); + } + + flush_dcache_page(pg); + kunmap(pg); + + D1(printk(KERN_DEBUG "readpage finished\n")); + return 0; +} + +int jffs2_do_readpage_unlock(struct inode *inode, struct page *pg) +{ + int ret = jffs2_do_readpage_nolock(inode, pg); + UnlockPage(pg); + return ret; +} + + +//int jffs2_readpage (struct file *filp, struct page *pg) +int jffs2_readpage (struct inode *d_inode, struct page *pg) +{ + // struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode); + int ret; + + // down(&f->sem); + ret = jffs2_do_readpage_unlock(d_inode, pg); + // up(&f->sem); + return ret; +} + +//int jffs2_prepare_write (struct file *filp, struct page *pg, unsigned start, unsigned end) +int jffs2_prepare_write (struct inode *d_inode, struct page *pg, unsigned start, unsigned end) +{ + struct inode *inode = d_inode; + struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); + uint32_t pageofs = pg->index << PAGE_CACHE_SHIFT; + int ret = 0; + + down(&f->sem); + //D1(printk(KERN_DEBUG "jffs2_prepare_write() nrpages %ld\n", inode->i_mapping->nrpages)); + D1(printk(KERN_DEBUG "jffs2_prepare_write()\n")); + + if (pageofs > inode->i_size) { + /* Make new hole frag from old EOF to new page */ + struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); + struct jffs2_raw_inode ri; + struct jffs2_full_dnode *fn; + uint32_t phys_ofs, alloc_len; + + D1(printk(KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n", + (unsigned int)inode->i_size, pageofs)); + + ret = jffs2_reserve_space(c, sizeof(ri), &phys_ofs, &alloc_len, ALLOC_NORMAL); + if (ret) { + up(&f->sem); + return ret; + } + memset(&ri, 0, sizeof(ri)); + + ri.magic = JFFS2_MAGIC_BITMASK; + ri.nodetype = JFFS2_NODETYPE_INODE; + ri.totlen = sizeof(ri); + ri.hdr_crc = crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4); + + ri.ino = f->inocache->ino; + ri.version = ++f->highest_version; + ri.mode = inode->i_mode; + ri.uid = inode->i_uid; + ri.gid = inode->i_gid; + ri.isize = max((uint32_t)inode->i_size, pageofs); + ri.atime = ri.ctime = ri.mtime = CURRENT_TIME; + ri.offset = inode->i_size; + ri.dsize = pageofs - inode->i_size; + ri.csize = 0; + ri.compr = JFFS2_COMPR_ZERO; + ri.node_crc = crc32(0, &ri, sizeof(ri)-8); + ri.data_crc = 0; + + fn = jffs2_write_dnode(c, f, &ri, NULL, 0, phys_ofs, NULL); + jffs2_complete_reservation(c); + if (IS_ERR(fn)) { + ret = PTR_ERR(fn); + up(&f->sem); + return ret; + } + ret = jffs2_add_full_dnode_to_inode(c, f, fn); + if (f->metadata) { + jffs2_mark_node_obsolete(c, f->metadata->raw); + jffs2_free_full_dnode(f->metadata); + f->metadata = NULL; + } + if (ret) { + D1(printk(KERN_DEBUG "Eep. add_full_dnode_to_inode() failed in prepare_write, returned %d\n", ret)); + jffs2_mark_node_obsolete(c, fn->raw); + jffs2_free_full_dnode(fn); + up(&f->sem); + return ret; + } + inode->i_size = pageofs; + } + + + /* Read in the page if it wasn't already present */ + // eCos has no concept of uptodate and by default always reads pages afresh + if (!Page_Uptodate(pg) && (start || end < PAGE_SIZE)) + ret = jffs2_do_readpage_nolock(inode, pg); + //D1(printk(KERN_DEBUG "end prepare_write(). nrpages %ld\n", inode->i_mapping->nrpages)); + D1(printk(KERN_DEBUG "end prepare_write()\n")); + up(&f->sem); + return ret; +} + +//int jffs2_commit_write (struct file *filp, struct page *pg, unsigned start, unsigned end) +int jffs2_commit_write (struct inode *d_inode, struct page *pg, unsigned start, unsigned end) +{ + /* Actually commit the write from the page cache page we're looking at. + * For now, we write the full page out each time. It sucks, but it's simple + */ + struct inode *inode = d_inode; + struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); + struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); + struct jffs2_raw_inode *ri; + int ret = 0; + uint32_t writtenlen = 0; + + D1(printk(KERN_DEBUG "jffs2_commit_write(): ino #%lu, page at 0x%lx, range %d-%d\n", + inode->i_ino, pg->index << PAGE_CACHE_SHIFT, start, end)); + + + ri = jffs2_alloc_raw_inode(); + if (!ri) { + D1(printk(KERN_DEBUG "jffs2_commit_write(): Allocation of raw inode failed\n")); + return -ENOMEM; + } + + /* Set the fields that the generic jffs2_write_inode_range() code can't find */ + ri->ino = inode->i_ino; + ri->mode = inode->i_mode; + ri->uid = inode->i_uid; + ri->gid = inode->i_gid; + ri->isize = (uint32_t)inode->i_size; + ri->atime = ri->ctime = ri->mtime = CURRENT_TIME; + + /* We rely on the fact that generic_file_write() currently kmaps the page for us. */ + ret = jffs2_write_inode_range(c, f, ri, page_address(pg) + start, + (pg->index << PAGE_CACHE_SHIFT) + start, end - start, &writtenlen); + + if (ret) { + /* There was an error writing. */ + SetPageError(pg); + } + + if (writtenlen) { + if (inode->i_size < (pg->index << PAGE_CACHE_SHIFT) + start + writtenlen) { + inode->i_size = (pg->index << PAGE_CACHE_SHIFT) + start + writtenlen; + inode->i_ctime = inode->i_mtime = ri->ctime; + } + } + + jffs2_free_raw_inode(ri); + + if (start+writtenlen < end) { + /* generic_file_write has written more to the page cache than we've + actually written to the medium. Mark the page !Uptodate so that + it gets reread */ + D1(printk(KERN_DEBUG "jffs2_commit_write(): Not all bytes written. Marking page !uptodate\n")); + SetPageError(pg); + ClearPageUptodate(pg); + } + + D1(printk(KERN_DEBUG "jffs2_commit_write() returning %d\n",writtenlen?writtenlen:ret)); + return writtenlen?writtenlen:ret; +} diff --git a/packages/fs/jffs2/current/src/gc.c b/packages/fs/jffs2/current/src/gc.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/gc.c @@ -0,0 +1,726 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: gc.c,v 1.60 2002/01/20 16:55:52 dwmw2 Exp $ + * + */ + +#ifndef __ECOS +#include +#include +#include +#include +#include +#include +#endif +#include "nodelist.h" +#include "crc32.h" + +static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, + struct jffs2_inode_info *f, struct jffs2_full_dnode *fd); +static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, + struct jffs2_inode_info *f, struct jffs2_full_dirent *fd); +static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, + struct jffs2_inode_info *f, struct jffs2_full_dirent *fd); +static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, + struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, + uint32_t start, uint32_t end); +static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, + struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, + uint32_t start, uint32_t end); + +/* Called with erase_completion_lock held */ +static struct jffs2_eraseblock *jffs2_find_gc_block(struct jffs2_sb_info *c) +{ + struct jffs2_eraseblock *ret; + struct list_head *nextlist = NULL; + + /* Pick an eraseblock to garbage collect next. This is where we'll + put the clever wear-levelling algorithms. Eventually. */ + if (!list_empty(&c->bad_used_list) && c->nr_free_blocks > JFFS2_RESERVED_BLOCKS_GCBAD) { + D1(printk(KERN_DEBUG "Picking block from bad_used_list to GC next\n")); + nextlist = &c->bad_used_list; + } else if (jiffies % 100 && !list_empty(&c->dirty_list)) { + /* Most of the time, pick one off the dirty list */ + D1(printk(KERN_DEBUG "Picking block from dirty_list to GC next\n")); + nextlist = &c->dirty_list; + } else if (!list_empty(&c->clean_list)) { + D1(printk(KERN_DEBUG "Picking block from clean_list to GC next\n")); + nextlist = &c->clean_list; + } else if (!list_empty(&c->dirty_list)) { + D1(printk(KERN_DEBUG "Picking block from dirty_list to GC next (clean_list was empty)\n")); + + nextlist = &c->dirty_list; + } else { + /* Eep. Both were empty */ + printk(KERN_NOTICE "jffs2: No clean _or_ dirty blocks to GC from! Where are they all?\n"); + return NULL; + } + + ret = list_entry(nextlist->next, struct jffs2_eraseblock, list); + list_del(&ret->list); + c->gcblock = ret; + ret->gc_node = ret->first_node; + if (!ret->gc_node) { + printk(KERN_WARNING "Eep. ret->gc_node for block at 0x%08x is NULL\n", ret->offset); + BUG(); + } + return ret; +} + +/* jffs2_garbage_collect_pass + * Make a single attempt to progress GC. Move one node, and possibly + * start erasing one eraseblock. + */ +int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) +{ + struct jffs2_eraseblock *jeb; + struct jffs2_inode_info *f; + struct jffs2_raw_node_ref *raw; + struct jffs2_node_frag *frag; + struct jffs2_full_dnode *fn = NULL; + struct jffs2_full_dirent *fd; + uint32_t start = 0, end = 0, nrfrags = 0; + uint32_t inum; + struct inode *inode; + int ret = 0; + + if (down_interruptible(&c->alloc_sem)) + return -EINTR; + + spin_lock_bh(&c->erase_completion_lock); + + /* First, work out which block we're garbage-collecting */ + jeb = c->gcblock; + + if (!jeb) + jeb = jffs2_find_gc_block(c); + + if (!jeb) { + printk(KERN_NOTICE "jffs2: Couldn't find erase block to garbage collect!\n"); + spin_unlock_bh(&c->erase_completion_lock); + up(&c->alloc_sem); + return -EIO; + } + + D1(printk(KERN_DEBUG "garbage collect from block at phys 0x%08x\n", jeb->offset)); + + if (!jeb->used_size) + goto eraseit; + + raw = jeb->gc_node; + + while(raw->flash_offset & 1) { + D1(printk(KERN_DEBUG "Node at 0x%08x is obsolete... skipping\n", raw->flash_offset &~3)); + jeb->gc_node = raw = raw->next_phys; + if (!raw) { + printk(KERN_WARNING "eep. End of raw list while still supposedly nodes to GC\n"); + printk(KERN_WARNING "erase block at 0x%08x. free_size 0x%08x, dirty_size 0x%08x, used_size 0x%08x\n", + jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size); + spin_unlock_bh(&c->erase_completion_lock); + up(&c->alloc_sem); + BUG(); + } + } + D1(printk(KERN_DEBUG "Going to garbage collect node at 0x%08x\n", raw->flash_offset &~3)); + if (!raw->next_in_ino) { + /* Inode-less node. Clean marker, snapshot or something like that */ + spin_unlock_bh(&c->erase_completion_lock); + jffs2_mark_node_obsolete(c, raw); + goto eraseit_lock; + } + + inum = jffs2_raw_ref_to_inum(raw); + D1(printk(KERN_DEBUG "Inode number is #%u\n", inum)); + + spin_unlock_bh(&c->erase_completion_lock); + + D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass collecting from block @0x%08x. Node @0x%08x, ino #%u\n", jeb->offset, raw->flash_offset&~3, inum)); + + inode = iget(OFNI_BS_2SFFJ(c), inum); + if (is_bad_inode(inode)) { + printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u\n", inum); + /* NB. This will happen again. We need to do something appropriate here. */ + iput(inode); + up(&c->alloc_sem); + return -EIO; + } + + f = JFFS2_INODE_INFO(inode); + down(&f->sem); + + /* Now we have the lock for this inode. Check that it's still the one at the head + of the list. */ + + if (raw->flash_offset & 1) { + D1(printk(KERN_DEBUG "node to be GC'd was obsoleted in the meantime.\n")); + /* They'll call again */ + goto upnout; + } + /* OK. Looks safe. And nobody can get us now because we have the semaphore. Move the block */ + if (f->metadata && f->metadata->raw == raw) { + fn = f->metadata; + ret = jffs2_garbage_collect_metadata(c, jeb, f, fn); + goto upnout; + } + + for (frag = f->fraglist; frag; frag = frag->next) { + if (frag->node && frag->node->raw == raw) { + fn = frag->node; + end = frag->ofs + frag->size; + if (!nrfrags++) + start = frag->ofs; + if (nrfrags == frag->node->frags) + break; /* We've found them all */ + } + } + if (fn) { + /* We found a datanode. Do the GC */ + if((start >> PAGE_CACHE_SHIFT) < ((end-1) >> PAGE_CACHE_SHIFT)) { + /* It crosses a page boundary. Therefore, it must be a hole. */ + ret = jffs2_garbage_collect_hole(c, jeb, f, fn, start, end); + } else { + /* It could still be a hole. But we GC the page this way anyway */ + ret = jffs2_garbage_collect_dnode(c, jeb, f, fn, start, end); + } + goto upnout; + } + + /* Wasn't a dnode. Try dirent */ + for (fd = f->dents; fd; fd=fd->next) { + if (fd->raw == raw) + break; + } + + if (fd && fd->ino) { + ret = jffs2_garbage_collect_dirent(c, jeb, f, fd); + } else if (fd) { + ret = jffs2_garbage_collect_deletion_dirent(c, jeb, f, fd); + } else { + printk(KERN_WARNING "Raw node at 0x%08x wasn't in node lists for ino #%u\n", + raw->flash_offset&~3, f->inocache->ino); + if (raw->flash_offset & 1) { + printk(KERN_WARNING "But it's obsolete so we don't mind too much\n"); + } else { + ret = -EIO; + } + } + upnout: + up(&f->sem); + iput(inode); + + eraseit_lock: + /* If we've finished this block, start it erasing */ + spin_lock_bh(&c->erase_completion_lock); + + eraseit: + if (c->gcblock && !c->gcblock->used_size) { + D1(printk(KERN_DEBUG "Block at 0x%08x completely obsoleted by GC. Moving to erase_pending_list\n", c->gcblock->offset)); + /* We're GC'ing an empty block? */ + list_add_tail(&c->gcblock->list, &c->erase_pending_list); + c->gcblock = NULL; + c->nr_erasing_blocks++; + jffs2_erase_pending_trigger(c); + } + spin_unlock_bh(&c->erase_completion_lock); + up(&c->alloc_sem); + + return ret; +} + +static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, + struct jffs2_inode_info *f, struct jffs2_full_dnode *fn) +{ + struct jffs2_full_dnode *new_fn; + struct jffs2_raw_inode ri; + unsigned short dev; + char *mdata = NULL, mdatalen = 0; + uint32_t alloclen, phys_ofs; + int ret; + + if ((JFFS2_F_I_MODE(f) & S_IFMT) == S_IFBLK || + (JFFS2_F_I_MODE(f) & S_IFMT) == S_IFCHR) { + /* For these, we don't actually need to read the old node */ + /* FIXME: for minor or major > 255. */ + dev = ((JFFS2_F_I_RDEV_MAJ(f) << 8) | + JFFS2_F_I_RDEV_MIN(f)); + mdata = (char *)&dev; + mdatalen = sizeof(dev); + D1(printk(KERN_DEBUG "jffs2_garbage_collect_metadata(): Writing %d bytes of kdev_t\n", mdatalen)); + } else if ((JFFS2_F_I_MODE(f) & S_IFMT) == S_IFLNK) { + mdatalen = fn->size; + mdata = kmalloc(fn->size, GFP_KERNEL); + if (!mdata) { + printk(KERN_WARNING "kmalloc of mdata failed in jffs2_garbage_collect_metadata()\n"); + return -ENOMEM; + } + ret = jffs2_read_dnode(c, fn, mdata, 0, mdatalen); + if (ret) { + printk(KERN_WARNING "read of old metadata failed in jffs2_garbage_collect_metadata(): %d\n", ret); + kfree(mdata); + return ret; + } + D1(printk(KERN_DEBUG "jffs2_garbage_collect_metadata(): Writing %d bites of symlink target\n", mdatalen)); + + } + + ret = jffs2_reserve_space_gc(c, sizeof(ri) + mdatalen, &phys_ofs, &alloclen); + if (ret) { + printk(KERN_WARNING "jffs2_reserve_space_gc of %d bytes for garbage_collect_metadata failed: %d\n", + sizeof(ri)+ mdatalen, ret); + goto out; + } + + memset(&ri, 0, sizeof(ri)); + ri.magic = JFFS2_MAGIC_BITMASK; + ri.nodetype = JFFS2_NODETYPE_INODE; + ri.totlen = sizeof(ri) + mdatalen; + ri.hdr_crc = crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4); + + ri.ino = f->inocache->ino; + ri.version = ++f->highest_version; + ri.mode = JFFS2_F_I_MODE(f); + ri.uid = JFFS2_F_I_UID(f); + ri.gid = JFFS2_F_I_GID(f); + ri.isize = JFFS2_F_I_SIZE(f); + ri.atime = JFFS2_F_I_ATIME(f); + ri.ctime = JFFS2_F_I_CTIME(f); + ri.mtime = JFFS2_F_I_MTIME(f); + ri.offset = 0; + ri.csize = mdatalen; + ri.dsize = mdatalen; + ri.compr = JFFS2_COMPR_NONE; + ri.node_crc = crc32(0, &ri, sizeof(ri)-8); + ri.data_crc = crc32(0, mdata, mdatalen); + + new_fn = jffs2_write_dnode(c, f, &ri, mdata, mdatalen, phys_ofs, NULL); + + if (IS_ERR(new_fn)) { + printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn)); + ret = PTR_ERR(new_fn); + goto out; + } + jffs2_mark_node_obsolete(c, fn->raw); + jffs2_free_full_dnode(fn); + f->metadata = new_fn; + out: + if ((JFFS2_F_I_MODE(f) & S_IFMT) == S_IFLNK) + kfree(mdata); + return ret; +} + +static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, + struct jffs2_inode_info *f, struct jffs2_full_dirent *fd) +{ + struct jffs2_full_dirent *new_fd; + struct jffs2_raw_dirent rd; + uint32_t alloclen, phys_ofs; + int ret; + + rd.magic = JFFS2_MAGIC_BITMASK; + rd.nodetype = JFFS2_NODETYPE_DIRENT; + rd.nsize = strlen(fd->name); + rd.totlen = sizeof(rd) + rd.nsize; + rd.hdr_crc = crc32(0, &rd, sizeof(struct jffs2_unknown_node)-4); + + rd.pino = f->inocache->ino; + rd.version = ++f->highest_version; + rd.ino = fd->ino; + rd.mctime = max(JFFS2_F_I_MTIME(f), JFFS2_F_I_CTIME(f)); + rd.type = fd->type; + rd.node_crc = crc32(0, &rd, sizeof(rd)-8); + rd.name_crc = crc32(0, fd->name, rd.nsize); + + ret = jffs2_reserve_space_gc(c, sizeof(rd)+rd.nsize, &phys_ofs, &alloclen); + if (ret) { + printk(KERN_WARNING "jffs2_reserve_space_gc of %d bytes for garbage_collect_dirent failed: %d\n", + sizeof(rd)+rd.nsize, ret); + return ret; + } + new_fd = jffs2_write_dirent(c, f, &rd, fd->name, rd.nsize, phys_ofs, NULL); + + if (IS_ERR(new_fd)) { + printk(KERN_WARNING "jffs2_write_dirent in garbage_collect_dirent failed: %ld\n", PTR_ERR(new_fd)); + return PTR_ERR(new_fd); + } + jffs2_add_fd_to_list(c, new_fd, &f->dents); + return 0; +} + +static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, + struct jffs2_inode_info *f, struct jffs2_full_dirent *fd) +{ + struct jffs2_full_dirent **fdp = &f->dents; + int found = 0; + + /* On a medium where we can't actually mark nodes obsolete + pernamently, such as NAND flash, we need to work out + whether this deletion dirent is still needed to actively + delete a 'real' dirent with the same name that's still + somewhere else on the flash. */ + if (!jffs2_can_mark_obsolete(c)) { + struct jffs2_raw_dirent rd; + struct jffs2_raw_node_ref *raw; + int ret; + size_t retlen; + int name_len = strlen(fd->name); + uint32_t name_crc = crc32(0, fd->name, name_len); + char *namebuf = NULL; + + for (raw = f->inocache->nodes; raw != (void *)f->inocache; raw = raw->next_in_ino) { + /* We only care about obsolete ones */ + if (!(raw->flash_offset & 1)) + continue; + + /* Doesn't matter if there's one in the same erase block. We're going to + delete it too at the same time. */ + if ((raw->flash_offset & ~(c->sector_size-1)) == + (fd->raw->flash_offset & ~(c->sector_size-1))) + continue; + + /* This is an obsolete node belonging to the same directory */ + ret = jffs2_flash_read(c, raw->flash_offset & ~3, sizeof(struct jffs2_unknown_node), &retlen, (char *)&rd); + if (ret) { + printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Read error (%d) reading header from obsolete node at %08x\n", ret, raw->flash_offset & ~3); + /* If we can't read it, we don't need to continune to obsolete it. Continue */ + continue; + } + if (retlen != sizeof(struct jffs2_unknown_node)) { + printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%d not %d) reading header from obsolete node at %08x\n", + retlen, sizeof(struct jffs2_unknown_node), raw->flash_offset & ~3); + continue; + } + if (rd.nodetype != JFFS2_NODETYPE_DIRENT || + PAD(rd.totlen) != PAD(sizeof(rd) + name_len)) + continue; + + /* OK, it's a dirent node, it's the right length. We have to take a + closer look at it... */ + ret = jffs2_flash_read(c, raw->flash_offset & ~3, sizeof(rd), &retlen, (char *)&rd); + if (ret) { + printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Read error (%d) reading from obsolete node at %08x\n", ret, raw->flash_offset & ~3); + /* If we can't read it, we don't need to continune to obsolete it. Continue */ + continue; + } + if (retlen != sizeof(struct jffs2_unknown_node)) { + printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%d not %d) reading from obsolete node at %08x\n", + retlen, sizeof(struct jffs2_unknown_node), raw->flash_offset & ~3); + continue; + } + + /* If the name CRC doesn't match, skip */ + if (rd.name_crc != name_crc) + continue; + /* If the name length doesn't match, or it's another deletion dirent, skip */ + if (rd.nsize != name_len || !rd.ino) + continue; + + /* OK, check the actual name now */ + if (!namebuf) { + namebuf = kmalloc(name_len + 1, GFP_KERNEL); + if (!namebuf) + return -ENOMEM; + } + /* We read the extra byte before it so it's a word-aligned read */ + ret = jffs2_flash_read(c, (raw->flash_offset & ~3)+sizeof(rd)-1, name_len+1, &retlen, namebuf); + if (ret) { + printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Read error (%d) reading name from obsolete node at %08x\n", ret, raw->flash_offset & ~3); + /* If we can't read it, we don't need to continune to obsolete it. Continue */ + continue; + } + if (retlen != sizeof(rd)) { + printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%d not %d) reading name from obsolete node at %08x\n", + retlen, name_len, raw->flash_offset & ~3); + continue; + } + if (memcmp(namebuf+1, fd->name, name_len)) + continue; + + /* OK. The name really does match. There really is still an older node on + the flash which our deletion dirent obsoletes. So we have to write out + a new deletion dirent to replace it */ + + if (namebuf) + kfree(namebuf); + + return jffs2_garbage_collect_dirent(c, jeb, f, fd); + } + if (namebuf) + kfree(namebuf); + } + + /* No need for it any more. Just mark it obsolete and remove it from the list */ + while (*fdp) { + if ((*fdp) == fd) { + found = 1; + *fdp = fd->next; + break; + } + fdp = &(*fdp)->next; + } + if (!found) { + printk(KERN_WARNING "Deletion dirent \"%s\" not found in list for ino #%u\n", fd->name, f->inocache->ino); + } + jffs2_mark_node_obsolete(c, fd->raw); + jffs2_free_full_dirent(fd); + return 0; +} + +static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, + struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, + uint32_t start, uint32_t end) +{ + struct jffs2_raw_inode ri; + struct jffs2_node_frag *frag; + struct jffs2_full_dnode *new_fn; + uint32_t alloclen, phys_ofs; + int ret; + + D1(printk(KERN_DEBUG "Writing replacement hole node for ino #%u from offset 0x%x to 0x%x\n", + f->inocache->ino, start, end)); + + memset(&ri, 0, sizeof(ri)); + + if(fn->frags > 1) { + size_t readlen; + uint32_t crc; + /* It's partially obsoleted by a later write. So we have to + write it out again with the _same_ version as before */ + ret = jffs2_flash_read(c, fn->raw->flash_offset & ~3, sizeof(ri), &readlen, (char *)&ri); + if (readlen != sizeof(ri) || ret) { + printk(KERN_WARNING "Node read failed in jffs2_garbage_collect_hole. Ret %d, retlen %d. Data will be lost by writing new hold node\n", ret, readlen); + goto fill; + } + if (ri.nodetype != JFFS2_NODETYPE_INODE) { + printk(KERN_WARNING "jffs2_garbage_collect_hole: Node at 0x%08x had node type 0x%04x instead of JFFS2_NODETYPE_INODE(0x%04x)\n", + fn->raw->flash_offset & ~3, ri.nodetype, JFFS2_NODETYPE_INODE); + return -EIO; + } + if (ri.totlen != sizeof(ri)) { + printk(KERN_WARNING "jffs2_garbage_collect_hole: Node at 0x%08x had totlen 0x%x instead of expected 0x%x\n", + fn->raw->flash_offset & ~3, ri.totlen, sizeof(ri)); + return -EIO; + } + crc = crc32(0, &ri, sizeof(ri)-8); + if (crc != ri.node_crc) { + printk(KERN_WARNING "jffs2_garbage_collect_hole: Node at 0x%08x had CRC 0x%08x which doesn't match calculated CRC 0x%08x\n", + fn->raw->flash_offset & ~3, ri.node_crc, crc); + /* FIXME: We could possibly deal with this by writing new holes for each frag */ + printk(KERN_WARNING "Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n", + start, end, f->inocache->ino); + goto fill; + } + if (ri.compr != JFFS2_COMPR_ZERO) { + printk(KERN_WARNING "jffs2_garbage_collect_hole: Node 0x%08x wasn't a hole node!\n", fn->raw->flash_offset & ~3); + printk(KERN_WARNING "Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n", + start, end, f->inocache->ino); + goto fill; + } + } else { + fill: + ri.magic = JFFS2_MAGIC_BITMASK; + ri.nodetype = JFFS2_NODETYPE_INODE; + ri.totlen = sizeof(ri); + ri.hdr_crc = crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4); + + ri.ino = f->inocache->ino; + ri.version = ++f->highest_version; + ri.offset = start; + ri.csize = end - start; + ri.dsize = 0; + ri.compr = JFFS2_COMPR_ZERO; + } + ri.mode = JFFS2_F_I_MODE(f); + ri.uid = JFFS2_F_I_UID(f); + ri.gid = JFFS2_F_I_GID(f); + ri.isize = JFFS2_F_I_SIZE(f); + ri.atime = JFFS2_F_I_ATIME(f); + ri.ctime = JFFS2_F_I_CTIME(f); + ri.mtime = JFFS2_F_I_MTIME(f); + ri.data_crc = 0; + ri.node_crc = crc32(0, &ri, sizeof(ri)-8); + + ret = jffs2_reserve_space_gc(c, sizeof(ri), &phys_ofs, &alloclen); + if (ret) { + printk(KERN_WARNING "jffs2_reserve_space_gc of %d bytes for garbage_collect_hole failed: %d\n", + sizeof(ri), ret); + return ret; + } + new_fn = jffs2_write_dnode(c, f, &ri, NULL, 0, phys_ofs, NULL); + + if (IS_ERR(new_fn)) { + printk(KERN_WARNING "Error writing new hole node: %ld\n", PTR_ERR(new_fn)); + return PTR_ERR(new_fn); + } + if (ri.version == f->highest_version) { + jffs2_add_full_dnode_to_inode(c, f, new_fn); + if (f->metadata) { + jffs2_mark_node_obsolete(c, f->metadata->raw); + jffs2_free_full_dnode(f->metadata); + f->metadata = NULL; + return 0; + } + } + for (frag = f->fraglist; frag; frag = frag->next) { + if (frag->ofs > fn->size + fn->ofs) + break; + if (frag->node == fn) { + frag->node = new_fn; + new_fn->frags++; + fn->frags--; + } + } + if (fn->frags) { + printk(KERN_WARNING "jffs2_garbage_collect_hole: Old node still has frags!\n"); + BUG(); + } + if (!new_fn->frags) { + printk(KERN_WARNING "jffs2_garbage_collect_hole: New node has no frags!\n"); + BUG(); + } + + jffs2_mark_node_obsolete(c, fn->raw); + jffs2_free_full_dnode(fn); + + return 0; +} + +static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, + struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, + uint32_t start, uint32_t end) +{ + struct jffs2_full_dnode *new_fn; + struct jffs2_raw_inode ri; + uint32_t alloclen, phys_ofs, offset, orig_end; + int ret = 0; + unsigned char *comprbuf = NULL, *writebuf; + struct page *pg; + unsigned char *pg_ptr; + /* FIXME: */ struct inode *inode = OFNI_EDONI_2SFFJ(f); + + memset(&ri, 0, sizeof(ri)); + + D1(printk(KERN_DEBUG "Writing replacement dnode for ino #%u from offset 0x%x to 0x%x\n", + f->inocache->ino, start, end)); + + orig_end = end; + + + /* If we're looking at the last node in the block we're + garbage-collecting, we allow ourselves to merge as if the + block was already erasing. We're likely to be GC'ing a + partial page, and the next block we GC is likely to have + the other half of this page right at the beginning, which + means we'd expand it _then_, as nr_erasing_blocks would have + increased since we checked, and in doing so would obsolete + the partial node which we'd have written here. Meaning that + the GC would churn and churn, and just leave dirty blocks in + it's wake. + */ + if(c->nr_free_blocks + c->nr_erasing_blocks > JFFS2_RESERVED_BLOCKS_GCMERGE - (fn->raw->next_phys?0:1)) { + /* Shitloads of space */ + /* FIXME: Integrate this properly with GC calculations */ + start &= ~(PAGE_CACHE_SIZE-1); + end = min_t(uint32_t, start + PAGE_CACHE_SIZE, JFFS2_F_I_SIZE(f)); + D1(printk(KERN_DEBUG "Plenty of free space, so expanding to write from offset 0x%x to 0x%x\n", + start, end)); + if (end < orig_end) { + printk(KERN_WARNING "Eep. jffs2_garbage_collect_dnode extended node to write, but it got smaller: start 0x%x, orig_end 0x%x, end 0x%x\n", start, orig_end, end); + end = orig_end; + } + } + + /* First, use readpage() to read the appropriate page into the page cache */ + /* Q: What happens if we actually try to GC the _same_ page for which commit_write() + * triggered garbage collection in the first place? + * A: I _think_ it's OK. read_cache_page shouldn't deadlock, we'll write out the + * page OK. We'll actually write it out again in commit_write, which is a little + * suboptimal, but at least we're correct. + */ + //pg = read_cache_page(inode->i_mapping, start >> PAGE_CACHE_SHIFT, (void *)jffs2_do_readpage_unlock, inode); + pg = read_cache_page(start >> PAGE_CACHE_SHIFT, (void *)jffs2_do_readpage_unlock, inode); + + if (IS_ERR(pg)) { + printk(KERN_WARNING "read_cache_page() returned error: %ld\n", PTR_ERR(pg)); + return PTR_ERR(pg); + } + pg_ptr = (char *)kmap(pg); + comprbuf = kmalloc(end - start, GFP_KERNEL); + + offset = start; + while(offset < orig_end) { + uint32_t datalen; + uint32_t cdatalen; + char comprtype = JFFS2_COMPR_NONE; + + ret = jffs2_reserve_space_gc(c, sizeof(ri) + JFFS2_MIN_DATA_LEN, &phys_ofs, &alloclen); + + if (ret) { + printk(KERN_WARNING "jffs2_reserve_space_gc of %d bytes for garbage_collect_dnode failed: %d\n", + sizeof(ri)+ JFFS2_MIN_DATA_LEN, ret); + break; + } + cdatalen = min(alloclen - sizeof(ri), end - offset); + datalen = end - offset; + + writebuf = pg_ptr + (offset & (PAGE_CACHE_SIZE -1)); + + if (comprbuf) { + comprtype = jffs2_compress(writebuf, comprbuf, &datalen, &cdatalen); + } + if (comprtype) { + writebuf = comprbuf; + } else { + datalen = cdatalen; + } + ri.magic = JFFS2_MAGIC_BITMASK; + ri.nodetype = JFFS2_NODETYPE_INODE; + ri.totlen = sizeof(ri) + cdatalen; + ri.hdr_crc = crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4); + + ri.ino = f->inocache->ino; + ri.version = ++f->highest_version; + ri.mode = JFFS2_F_I_MODE(f); + ri.uid = JFFS2_F_I_UID(f); + ri.gid = JFFS2_F_I_GID(f); + ri.isize = JFFS2_F_I_SIZE(f); + ri.atime = JFFS2_F_I_ATIME(f); + ri.ctime = JFFS2_F_I_CTIME(f); + ri.mtime = JFFS2_F_I_MTIME(f); + ri.offset = offset; + ri.csize = cdatalen; + ri.dsize = datalen; + ri.compr = comprtype; + ri.node_crc = crc32(0, &ri, sizeof(ri)-8); + ri.data_crc = crc32(0, writebuf, cdatalen); + + new_fn = jffs2_write_dnode(c, f, &ri, writebuf, cdatalen, phys_ofs, NULL); + + if (IS_ERR(new_fn)) { + printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn)); + ret = PTR_ERR(new_fn); + break; + } + ret = jffs2_add_full_dnode_to_inode(c, f, new_fn); + offset += datalen; + if (f->metadata) { + jffs2_mark_node_obsolete(c, f->metadata->raw); + jffs2_free_full_dnode(f->metadata); + f->metadata = NULL; + } + } + if (comprbuf) kfree(comprbuf); + + kunmap(pg); + /* XXX: Does the page get freed automatically? */ + /* AAA: Judging by the unmount getting stuck in __wait_on_page, nope. */ + page_cache_release(pg); + return ret; +} + diff --git a/packages/fs/jffs2/current/src/histo.h b/packages/fs/jffs2/current/src/histo.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/histo.h @@ -0,0 +1,3 @@ +/* This file provides the bit-probabilities for the input file */ +#define BIT_DIVIDER 629 +static int bits[9] = { 179,167,183,165,159,198,178,119,}; /* ia32 .so files */ diff --git a/packages/fs/jffs2/current/src/histo_mips.h b/packages/fs/jffs2/current/src/histo_mips.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/histo_mips.h @@ -0,0 +1,2 @@ +#define BIT_DIVIDER_MIPS 1043 +static int bits_mips[8] = { 277,249,290,267,229,341,212,241}; /* mips32 */ diff --git a/packages/fs/jffs2/current/src/jffs2.c b/packages/fs/jffs2/current/src/jffs2.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/jffs2.c @@ -0,0 +1,1968 @@ +//========================================================================== +// +// jffs2.c +// +// JFFS2 file system +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dominic.ostrowski@3glab.com +// Contributors: nickg, richard.panton@3glab.com +// Date: 2000-07-25 +// Purpose: JFFS2 file system +// Description: This is the JFFS2 flash filesystem for eCos. +// +//####DESCRIPTIONEND#### +// +//========================================================================== +// +// General Description +// =================== +// +// +//========================================================================== + +#include "jffs2port.h" +#include "jffs2.h" +#include "jffs2_fs_sb.h" +#include "jffs2_fs_i.h" +#include "nodelist.h" + +#include +#include +#include +#include +#include + +//========================================================================== +// Forward definitions + +// Filesystem operations +static int jffs2_mount ( cyg_fstab_entry *fste, cyg_mtab_entry *mte ); +static int jffs2_umount ( cyg_mtab_entry *mte ); +static int jffs2_open ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int mode, cyg_file *fte ); +static int jffs2_ops_unlink ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); +static int jffs2_ops_mkdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); +static int jffs2_ops_rmdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); +static int jffs2_ops_rename ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, + cyg_dir dir2, const char *name2 ); +static int jffs2_ops_link ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, + cyg_dir dir2, const char *name2, int type ); +static int jffs2_opendir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + cyg_file *fte ); +static int jffs2_chdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + cyg_dir *dir_out ); +static int jffs2_stat ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + struct stat *buf); +static int jffs2_getinfo ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int key, void *buf, int len ); +static int jffs2_setinfo ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int key, void *buf, int len ); + +// File operations +static int jffs2_fo_read (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); +static int jffs2_fo_write (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); +static int jffs2_fo_lseek (struct CYG_FILE_TAG *fp, off_t *pos, int whence ); +static int jffs2_fo_ioctl (struct CYG_FILE_TAG *fp, CYG_ADDRWORD com, + CYG_ADDRWORD data); +static int jffs2_fo_fsync (struct CYG_FILE_TAG *fp, int mode ); +static int jffs2_fo_close (struct CYG_FILE_TAG *fp); +static int jffs2_fo_fstat (struct CYG_FILE_TAG *fp, struct stat *buf ); +static int jffs2_fo_getinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ); +static int jffs2_fo_setinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ); + +// Directory operations +static int jffs2_fo_dirread (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); +static int jffs2_fo_dirlseek (struct CYG_FILE_TAG *fp, off_t *pos, int whence ); + + +//========================================================================== +// Filesystem table entries + +// ------------------------------------------------------------------------- +// Fstab entry. +// This defines the entry in the filesystem table. +// For simplicity we use _FILESYSTEM synchronization for all accesses since +// we should never block in any filesystem operations. + +FSTAB_ENTRY( jffs2_fste, "jffs2", 0, + CYG_SYNCMODE_FILE_FILESYSTEM|CYG_SYNCMODE_IO_FILESYSTEM, + jffs2_mount, + jffs2_umount, + jffs2_open, + jffs2_ops_unlink, + jffs2_ops_mkdir, + jffs2_ops_rmdir, + jffs2_ops_rename, + jffs2_ops_link, + jffs2_opendir, + jffs2_chdir, + jffs2_stat, + jffs2_getinfo, + jffs2_setinfo); + +// ------------------------------------------------------------------------- +// File operations. +// This set of file operations are used for normal open files. + +static cyg_fileops jffs2_fileops = +{ + jffs2_fo_read, + jffs2_fo_write, + jffs2_fo_lseek, + jffs2_fo_ioctl, + cyg_fileio_seltrue, + jffs2_fo_fsync, + jffs2_fo_close, + jffs2_fo_fstat, + jffs2_fo_getinfo, + jffs2_fo_setinfo +}; + +// ------------------------------------------------------------------------- +// Directory file operations. +// This set of operations are used for open directories. Most entries +// point to error-returning stub functions. Only the read, lseek and +// close entries are functional. + +static cyg_fileops jffs2_dirops = +{ + jffs2_fo_dirread, + (cyg_fileop_write *)cyg_fileio_enosys, + jffs2_fo_dirlseek, + (cyg_fileop_ioctl *)cyg_fileio_enosys, + cyg_fileio_seltrue, + (cyg_fileop_fsync *)cyg_fileio_enosys, + jffs2_fo_close, + (cyg_fileop_fstat *)cyg_fileio_enosys, + (cyg_fileop_getinfo *)cyg_fileio_enosys, + (cyg_fileop_setinfo *)cyg_fileio_enosys +}; + + +//========================================================================== +// STATIC VARIABLES !!! + +static char read_write_buffer[PAGE_CACHE_SIZE]; //avoids malloc when user may be under memory pressure +static char gc_buffer[PAGE_CACHE_SIZE]; //avoids malloc when user may be under memory pressure + +//========================================================================== +// Directory operations + +struct jffs2_dirsearch +{ + struct inode *dir; // directory to search + const char *path; // path to follow + struct inode *node; // Node found + const char *name; // last name fragment used + int namelen; // name fragment length + cyg_bool last; // last name in path? +}; + +typedef struct jffs2_dirsearch jffs2_dirsearch; + +//========================================================================== +// Ref count and nlink management + +// ------------------------------------------------------------------------- +// dec_refcnt() +// Decrment the reference count on an inode. If this makes the ref count +// zero, then this inode can be freed. + +static int dec_refcnt( struct inode *node ) +{ + int err = ENOERR; + node->i_count--; + + // In JFFS2 inode's are temporary in ram structures that are free'd when the usage i_count drops to 0 + // The i_nlink however is managed by JFFS2 and is unrelated to usage + if( node->i_count == 0) + { + // This inode is not in use, so delete it. + iput(node); + } + + return err; +} + +// FIXME: This seems like real cruft. Wouldn't it be better just to do the +// right thing? +static void icache_evict(struct inode *root_i, struct inode *i) { + struct inode *cached_inode; + struct inode *next_inode; + + D2(printf("icache_evict\n")); + // If this is an absolute search path from the root, + // remove all cached inodes with i_count of zero (these are only + // held where needed for dotdot filepaths) + if(i == root_i) { + for(cached_inode = root_i; cached_inode != NULL; cached_inode = next_inode) { + next_inode = cached_inode->i_cache_next; + if (cached_inode->i_count == 0) { + cached_inode->i_cache_prev->i_cache_next = cached_inode->i_cache_next; // Prveious entry points ahead of us + if (cached_inode->i_cache_next != NULL) + cached_inode->i_cache_next->i_cache_prev = cached_inode->i_cache_prev; // Next entry points behind us + jffs2_clear_inode(cached_inode); + D2(printf("free icache_evict inode %x $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n", cached_inode)); + free(cached_inode); + } + } + } +} + +//========================================================================== +// Directory search + +// ------------------------------------------------------------------------- +// init_dirsearch() +// Initialize a dirsearch object to start a search + +static void init_dirsearch( jffs2_dirsearch *ds, + struct inode *dir, + const char *name) +{ + D2(printf("init_dirsearch name = %s\n", name)); + D2(printf("init_dirsearch dir = %x\n", dir)); + ds->dir = dir; + ds->path = name; + ds->node = dir; + ds->name = name; + ds->namelen = 0; + ds->last = false; +} + + +// ------------------------------------------------------------------------- +// find_entry() +// Search a single directory for the next name in a path and update the +// dirsearch object appropriately. + +static int find_entry( jffs2_dirsearch *ds ) +{ + unsigned long hash; + struct qstr this; + unsigned int c; + const char * hashname; + + struct inode *dir = ds->dir; + const char *name = ds->path; + const char *n = name; + char namelen = 0; + struct inode *d; + + D2(printf("find_entry\n")); + + // check that we really have a directory + if( !S_ISDIR(dir->i_mode) ) + return ENOTDIR; + + // Isolate the next element of the path name. + while( *n != '\0' && *n != '/' ) + n++, namelen++; + + // If we terminated on a NUL, set last flag. + if( *n == '\0' ) + ds->last = true; + + // update name in dirsearch object + ds->name = name; + ds->namelen = namelen; + + if (name[0] == '.') switch (namelen) { + default: + break; + case 2: + // Dot followed by not Dot, treat as any other name + if (name[1] != '.') + break; + // Dot Dot + // Move back up the search path + D2(printf("find_entry found ..\n")); + ds->node = ds->dir->i_parent; + if(ds->dir->i_count == 0) { + iput(ds->dir); // This inode may be evicted + ds->dir = NULL; + } + return ENOERR; + case 1: + // Dot is consumed + D2(printf("find_entry found .\n")); + ds->node = ds->dir; + return ENOERR; + } + + // Here we have the name and its length set up. + // Search the directory for a matching entry + + hashname = name; + this.name = hashname; + c = *(const unsigned char *)hashname; + + hash = init_name_hash(); + do { + hashname++; + hash = partial_name_hash(c, hash); + c = *(const unsigned char *)hashname; + } while (c && (c != '/')); + this.len = hashname - (const char *) this.name; + this.hash = end_name_hash(hash); + + D2(printf("find_entry for name = %s\n", ds->path)); + d = jffs2_lookup(dir, &this); + D2(printf("find_entry got dir = %x\n", d)); + + if( d == NULL ) + return ENOENT; + + // The back path for dotdot to follow + d->i_parent = dir; + // pass back the node we have found + ds->node = d; + + return ENOERR; + +} + +// ------------------------------------------------------------------------- +// jffs2_find() +// Main interface to directory search code. This is used in all file +// level operations to locate the object named by the pathname. + +static int jffs2_find( jffs2_dirsearch *d ) +{ + int err; + + D2(printf("jffs2_find for path =%s\n", d->path)); + // Short circuit empty paths + if( *(d->path) == '\0' ) + return ENOERR; + + // iterate down directory tree until we find the object + // we want. + for(;;) + { + err = find_entry( d ); + + if( err != ENOERR ) + return err; + + if( d->last ) + return ENOERR; + + // every inode traversed in the find is temporary and should be free'd + //iput(d->dir); + + // Update dirsearch object to search next directory. + d->dir = d->node; + d->path += d->namelen; + if( *(d->path) == '/' ) d->path++; // skip dirname separators + } +} + +//========================================================================== +// Pathconf support +// This function provides support for pathconf() and fpathconf(). + +static int jffs2_pathconf( struct inode *node, struct cyg_pathconf_info *info ) +{ + int err = ENOERR; + D2(printf("jffs2_pathconf\n")); + + switch( info->name ) + { + case _PC_LINK_MAX: + info->value = LINK_MAX; + break; + + case _PC_MAX_CANON: + info->value = -1; // not supported + err = EINVAL; + break; + + case _PC_MAX_INPUT: + info->value = -1; // not supported + err = EINVAL; + break; + + case _PC_NAME_MAX: + info->value = NAME_MAX; + break; + + case _PC_PATH_MAX: + info->value = PATH_MAX; + break; + + case _PC_PIPE_BUF: + info->value = -1; // not supported + err = EINVAL; + break; + + + case _PC_ASYNC_IO: + info->value = -1; // not supported + err = EINVAL; + break; + + case _PC_CHOWN_RESTRICTED: + info->value = -1; // not supported + err = EINVAL; + break; + + case _PC_NO_TRUNC: + info->value = 0; + break; + + case _PC_PRIO_IO: + info->value = 0; + break; + + case _PC_SYNC_IO: + info->value = 0; + break; + + case _PC_VDISABLE: + info->value = -1; // not supported + err = EINVAL; + break; + + default: + err = EINVAL; + break; + } + + return err; +} + +//========================================================================== +// Filesystem operations + +// ------------------------------------------------------------------------- +// jffs2_mount() +// Process a mount request. This mainly creates a root for the +// filesystem. +static int jffs2_read_super(struct super_block *sb) +{ + struct jffs2_sb_info *c; + struct inode *root_i; + Cyg_ErrNo err; + cyg_uint32 len; + cyg_io_flash_getconfig_devsize_t ds; + cyg_io_flash_getconfig_blocksize_t bs; + + D1(printk(KERN_DEBUG "jffs2: read_super\n")); + + c = JFFS2_SB_INFO(sb); + memset(c, 0, sizeof(*c)); + + len = sizeof(ds); + err = cyg_io_get_config( sb->s_dev, + CYG_IO_GET_CONFIG_FLASH_DEVSIZE, + &ds, &len ); + if ( err != ENOERR ) { + D1(printf("jffs2: cyg_io_get_config failed to get dev size: %d\n", + err)); + return err; + } + len = sizeof(bs); + bs.offset = 0; + err = cyg_io_get_config( sb->s_dev, + CYG_IO_GET_CONFIG_FLASH_BLOCKSIZE, + &bs, &len ); + if ( err != ENOERR ) { + D1(printf("jffs2: cyg_io_get_config failed to get block size: %d\n", + err)); + return err; + } + + c->sector_size = bs.block_size; + c->flash_size = ds.dev_size; + + err = jffs2_do_mount_fs(c); + if (err) + return -err; + + D1(printk(KERN_DEBUG "jffs2_read_super(): Getting root inode\n")); + root_i = iget(sb, 1); + if (is_bad_inode(root_i)) { + D1(printk(KERN_WARNING "get root inode failed\n")); + err = EIO; + goto out_nodes; + } + + D1(printk(KERN_DEBUG "jffs2_read_super(): d_alloc_root()\n")); + sb->s_root = d_alloc_root(root_i); + if (!sb->s_root) { + err = ENOMEM; + goto out_root_i; + } + sb->s_blocksize = PAGE_CACHE_SIZE; + sb->s_blocksize_bits = PAGE_CACHE_SHIFT; + sb->s_magic = JFFS2_SUPER_MAGIC; + + return 0; + + out_root_i: + iput(root_i); + out_nodes: + jffs2_free_ino_caches(c); + jffs2_free_raw_node_refs(c); + free(c->blocks); + + return err; +} + +static int jffs2_mount ( cyg_fstab_entry *fste, cyg_mtab_entry *mte ) +{ + extern cyg_mtab_entry mtab[], mtab_end; + struct super_block *jffs2_sb = NULL; + struct jffs2_sb_info *c; + cyg_mtab_entry *m; + cyg_io_handle_t t; + Cyg_ErrNo err; + + D2(printf("jffs2_mount\n")); + + err = cyg_io_lookup( mte->devname, &t ); + if( err != ENOERR ) + return -err; + + // Iterate through the mount table to see if we're mounted + // FIXME: this should be done better - perhaps if the superblock + // can be stored as an inode in the icache. + for( m = &mtab[0]; m != &mtab_end; m++ ) + { + // stop if there are more than the configured maximum + if( m-&mtab[0] >= CYGNUM_FILEIO_MTAB_MAX ) + { + m = &mtab_end; + break; + } + if ( m->valid && strcmp( m->fsname, "jffs2" ) == 0 && + strcmp( m->devname, mte->devname) == 0 ) { + jffs2_sb = (struct super_block *)m->data; + } + } + + if ( jffs2_sb == NULL) { + jffs2_sb = malloc(sizeof(struct super_block)); + + if(jffs2_sb == NULL) + return ENOSPC; + + c = JFFS2_SB_INFO(jffs2_sb); + memset(jffs2_sb, 0, sizeof(struct super_block)); + jffs2_sb->s_dev = t; + + err = jffs2_read_super(jffs2_sb); + + if (err) { + free(jffs2_sb); + return err; + } + + jffs2_sb->s_root->i_parent = jffs2_sb->s_root; // points to itself, no dotdot paths above mountpoint + jffs2_sb->s_root->i_cache_prev = NULL; // root inode, so always null + jffs2_sb->s_root->i_cache_next = NULL; + jffs2_sb->s_root->i_count = 1; // Ensures the root inode is always in ram until umount + + D2(printf("jffs2_mount erasing pending blocks\n")); + jffs2_erase_pending_blocks(c); + jffs2_mark_erased_blocks(c); + } + mte->data = (CYG_ADDRWORD)jffs2_sb; + + jffs2_sb->s_mount_count++; + mte->root = (cyg_dir)jffs2_sb->s_root; + D2(printf("jffs2_mounted superblock at %x\n", mte->root)); + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_umount() +// Unmount the filesystem. + +static int jffs2_umount ( cyg_mtab_entry *mte ) +{ + struct inode *root = (struct inode *)mte->root; + struct super_block *jffs2_sb = root->i_sb; + struct jffs2_sb_info *c = JFFS2_SB_INFO(jffs2_sb); + + D2(printf("jffs2_umount\n")); + + // Decrement the mount count + jffs2_sb->s_mount_count--; + + // Only really umount if this is the only mount + if (jffs2_sb->s_mount_count == 0) { + + // Check for open/inuse root or any cached inodes +//if( root->i_count != 1 || root->i_cache_next != NULL) // root icount was set to 1 on mount + if( root->i_cache_next != NULL) // root icount was set to 1 on mount + return EBUSY; + + dec_refcnt(root); // Time to free the root inode + + //Clear root inode + //root_i = NULL; + + // Clean up the super block and root inode + jffs2_free_ino_caches(c); + jffs2_free_raw_node_refs(c); + free(c->blocks); + + // Clear root pointer + mte->root = CYG_DIR_NULL; + + mte->fs->data = 0; // fstab entry, visible to all mounts. No current mount + // That's all folks. + D2(printf("jffs2_umount No current mounts\n")); + } + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_open() +// Open a file for reading or writing. + +static int jffs2_open ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int mode, cyg_file *file ) +{ + + jffs2_dirsearch ds; + struct inode *node = NULL; + int err; + + D2(printf("jffs2_open\n")); + + icache_evict((struct inode *)mte->root, (struct inode *)dir); + + init_dirsearch( &ds, (struct inode *)dir, name ); + + err = jffs2_find( &ds ); + + if( err == ENOENT ) + { + if( ds.last && (mode & O_CREAT) ) + { + unsigned long hash; + struct qstr this; + unsigned int c; + const char * hashname; + + // No node there, if the O_CREAT bit is set then we must + // create a new one. The dir and name fields of the dirsearch + // object will have been updated so we know where to put it. + + hashname = ds.name; + this.name = hashname; + c = *(const unsigned char *)hashname; + + hash = init_name_hash(); + do { + hashname++; + hash = partial_name_hash(c, hash); + c = *(const unsigned char *)hashname; + } while (c && (c != '/')); + this.len = hashname - (const char *) this.name; + this.hash = end_name_hash(hash); + + err = jffs2_create(ds.dir, &this, 0644, &node); + + if( err != 0 ) + { + //Possible orphaned inode on the flash - but will be gc'd + return err; + } + + err = ENOERR; + } + } + else if( err == ENOERR ) + { + // The node exists. If the O_CREAT and O_EXCL bits are set, we + // must fail the open. + + if( (mode & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) ) + err = EEXIST; + else node = ds.node; + } + + if( err == ENOERR && (mode & O_TRUNC ) ) + { + // If the O_TRUNC bit is set we must clean out the file data. + + node->i_size = 0; + + // Update file times + node->i_ctime = + node->i_mtime = cyg_timestamp(); + } + + if( err != ENOERR ) return err; + + // Check that we actually have a file here + if( S_ISDIR(node->i_mode) ) return EISDIR; + + node->i_count++; // Count successful open + + // Initialize the file object + + file->f_flag |= mode & CYG_FILE_MODE_MASK; + file->f_type = CYG_FILE_TYPE_FILE; + file->f_ops = &jffs2_fileops; + file->f_offset = (mode&O_APPEND) ? node->i_size : 0; + file->f_data = (CYG_ADDRWORD)node; + file->f_xops = 0; + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_ops_unlink() +// Remove a file link from its directory. + +static int jffs2_ops_unlink ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ) +{ + unsigned long hash; + struct qstr this; + unsigned int c; + const char * hashname; + jffs2_dirsearch ds; + int err; + + D2(printf("jffs2_ops_unlink\n")); + + icache_evict((struct inode *)mte->root, (struct inode *)dir); + + init_dirsearch( &ds, (struct inode *)dir, name ); + + err = jffs2_find( &ds ); + + if( err != ENOERR ) return err; + + // Cannot unlink directories, use rmdir() instead + if( S_ISDIR(ds.node->i_mode) ) + return EPERM; + + // Delete it from its directory + + hashname = ds.name; + this.name = hashname; + c = *(const unsigned char *)hashname; + + hash = init_name_hash(); + do { + hashname++; + hash = partial_name_hash(c, hash); + c = *(const unsigned char *)hashname; + } while (c && (c != '/')); + this.len = hashname - (const char *) this.name; + this.hash = end_name_hash(hash); + + err = jffs2_unlink(ds.dir, ds.node, &this); + + return err; +} + +// ------------------------------------------------------------------------- +// jffs2_ops_mkdir() +// Create a new directory. + +static int jffs2_ops_mkdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ) +{ + jffs2_dirsearch ds; + struct inode *node = NULL; + int err; + + D2(printf("jffs2_ops_mkdir\n")); + + icache_evict((struct inode *)mte->root, (struct inode *)dir); + + init_dirsearch( &ds, (struct inode *)dir, name ); + + err = jffs2_find( &ds ); + + if( err == ENOENT ) + { + if( ds.last ) + { + unsigned long hash; + struct qstr this; + unsigned int c; + const char * hashname; + // The entry does not exist, and it is the last element in + // the pathname, so we can create it here. + + hashname = ds.name; + this.name = hashname; + c = *(const unsigned char *)hashname; + + hash = init_name_hash(); + do { + hashname++; + hash = partial_name_hash(c, hash); + c = *(const unsigned char *)hashname; + } while (c && (c != '/')); + this.len = hashname - (const char *) this.name; + this.hash = end_name_hash(hash); + + err = jffs2_mkdir(ds.dir, &this, 0, &node); + + if( err != 0 ) + return ENOSPC; + + } + // If this was not the last element, then and intermediate + // directory does not exist. + } + else + { + // If there we no error, something already exists with that + // name, so we cannot create another one. + + if( err == ENOERR ) + err = EEXIST; + } + + return err; +} + +// ------------------------------------------------------------------------- +// jffs2_ops_rmdir() +// Remove a directory. + +static int jffs2_ops_rmdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ) +{ + unsigned long hash; + struct qstr this; + unsigned int c; + const char * hashname; + jffs2_dirsearch ds; + int err; + + D2(printf("jffs2_ops_rmdir\n")); + + icache_evict((struct inode *)mte->root, (struct inode *)dir); + + init_dirsearch( &ds, (struct inode *)dir, name ); + + err = jffs2_find( &ds ); + + if( err != ENOERR ) return err; + + // Check that this is actually a directory. + if( !S_ISDIR(ds.node->i_mode) ) + return EPERM; + + // Delete the entry. + hashname = ds.name; + this.name = hashname; + c = *(const unsigned char *)hashname; + + hash = init_name_hash(); + do { + hashname++; + hash = partial_name_hash(c, hash); + c = *(const unsigned char *)hashname; + } while (c && (c != '/')); + this.len = hashname - (const char *) this.name; + this.hash = end_name_hash(hash); + + err = jffs2_rmdir(ds.dir, ds.node, &this); + + return err; + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_ops_rename() +// Rename a file/dir. + +static int jffs2_ops_rename ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, + cyg_dir dir2, const char *name2 ) +{ + unsigned long hash; + struct qstr this1,this2; + unsigned int c; + const char * hashname; + jffs2_dirsearch ds1, ds2; + int err; + + D2(printf("jffs2_ops_rename\n")); + + init_dirsearch( &ds1, (struct inode *)dir1, name1 ); + + err = jffs2_find( &ds1 ); + + if( err != ENOERR ) return err; + + init_dirsearch( &ds2, (struct inode *)dir2, name2 ); + + err = jffs2_find( &ds2 ); + + // Allow through renames to non-existent objects. + if( ds2.last && err == ENOENT ) + ds2.node = NULL, err = ENOERR; + + if( err != ENOERR ) return err; + + // Null rename, just return + if( ds1.node == ds2.node ) + return ENOERR; + + hashname = ds1.name; + this1.name = hashname; + c = *(const unsigned char *)hashname; + + hash = init_name_hash(); + do { + hashname++; + hash = partial_name_hash(c, hash); + c = *(const unsigned char *)hashname; + } while (c && (c != '/')); + this1.len = hashname - (const char *) this1.name; + this1.hash = end_name_hash(hash); + + hashname = ds2.name; + this2.name = hashname; + c = *(const unsigned char *)hashname; + + hash = init_name_hash(); + do { + hashname++; + hash = partial_name_hash(c, hash); + c = *(const unsigned char *)hashname; + } while (c && (c != '/')); + this2.len = hashname - (const char *) this2.name; + this2.hash = end_name_hash(hash); + + // First deal with any entry that is at the destination + if( ds2.node ) + { + // Check that we are renaming like-for-like + + if( !S_ISDIR(ds1.node->i_mode) && S_ISDIR(ds2.node->i_mode) ) + return EISDIR; + + if( S_ISDIR(ds1.node->i_mode) && !S_ISDIR(ds2.node->i_mode) ) + return ENOTDIR; + + // Now delete the destination directory entry + + err = jffs2_unlink(ds2.dir, ds2.node, &this2); + + if( err != 0 ) return err; + + } + + // Now we know that there is no clashing node at the destination, + // make a new direntry at the destination and delete the old entry + // at the source. + + err = jffs2_rename(ds1.dir, ds1.node, &this1, ds2.dir, &this2); + + // Update directory times + if( err == 0 ) + ds1.dir->i_ctime = + ds1.dir->i_mtime = + ds2.dir->i_ctime = + ds2.dir->i_mtime = cyg_timestamp(); + + return err; +} + +// ------------------------------------------------------------------------- +// jffs2_ops_link() +// Make a new directory entry for a file. + +static int jffs2_ops_link ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, + cyg_dir dir2, const char *name2, int type ) +{ + unsigned long hash; + struct qstr this; + unsigned int c; + const char * hashname; + jffs2_dirsearch ds1, ds2; + int err; + + D2(printf("jffs2_ops_link\n")); + + // Only do hard links for now in this filesystem + if( type != CYG_FSLINK_HARD ) + return EINVAL; + + init_dirsearch( &ds1, (struct inode *)dir1, name1 ); + + err = jffs2_find( &ds1 ); + + if( err != ENOERR ) return err; + + init_dirsearch( &ds2, (struct inode *)dir2, name2 ); + + err = jffs2_find( &ds2 ); + + // Don't allow links to existing objects + if( err == ENOERR ) return EEXIST; + + // Allow through links to non-existing terminal objects + if( ds2.last && err == ENOENT ) + ds2.node = NULL, err = ENOERR; + + if( err != ENOERR ) return err; + + // Now we know that there is no existing node at the destination, + // make a new direntry at the destination. + + hashname = ds2.name; + this.name = hashname; + c = *(const unsigned char *)hashname; + + hash = init_name_hash(); + do { + hashname++; + hash = partial_name_hash(c, hash); + c = *(const unsigned char *)hashname; + } while (c && (c != '/')); + this.len = hashname - (const char *) this.name; + this.hash = end_name_hash(hash); + + err = jffs2_link(ds2.dir, ds1.node, &this); + + if( err == 0 ) + ds1.node->i_ctime = + ds2.dir->i_ctime = + ds2.dir->i_mtime = cyg_timestamp(); + + return err; +} + +// ------------------------------------------------------------------------- +// jffs2_opendir() +// Open a directory for reading. + +static int jffs2_opendir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + cyg_file *file ) +{ + jffs2_dirsearch ds; + int err; + + D2(printf("jffs2_opendir\n")); + + icache_evict((struct inode *)mte->root, (struct inode *)dir); + + init_dirsearch( &ds, (struct inode *)dir, name ); + + err = jffs2_find( &ds ); + + if( err != ENOERR ) return err; + + // check it is really a directory. + if( !S_ISDIR(ds.node->i_mode) ) return ENOTDIR; + + ds.node->i_count++; // Count successful open + + // Initialize the file object, setting the f_ops field to a + // special set of file ops. + + file->f_type = CYG_FILE_TYPE_FILE; + file->f_ops = &jffs2_dirops; + file->f_offset = 0; + file->f_data = (CYG_ADDRWORD)ds.node; + file->f_xops = 0; + + + return ENOERR; + +} + +// ------------------------------------------------------------------------- +// jffs2_chdir() +// Change directory support. + +static int jffs2_chdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + cyg_dir *dir_out ) +{ + D2(printf("jffs2_chdir\n")); + + if( dir_out != NULL ) + { + // This is a request to get a new directory pointer in + // *dir_out. + + jffs2_dirsearch ds; + int err; + + icache_evict((struct inode *)mte->root, (struct inode *)dir); + + init_dirsearch( &ds, (struct inode *)dir, name ); + + err = jffs2_find( &ds ); + + if( err != ENOERR ) return err; + + // check it is a directory + if( !S_ISDIR(ds.node->i_mode) ) + return ENOTDIR; + + // Increment ref count to keep this directory in existance + // while it is the current cdir. + ds.node->i_count++; + + // Pass it out + *dir_out = (cyg_dir)ds.node; + } + else + { + // If no output dir is required, this means that the mte and + // dir arguments are the current cdir setting and we should + // forget this fact. + + struct inode *node = (struct inode *)dir; + + // Just decrement directory reference count. + dec_refcnt( node ); + } + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_stat() +// Get struct stat info for named object. + +static int jffs2_stat ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + struct stat *buf) +{ + jffs2_dirsearch ds; + int err; + + D2(printf("jffs2_stat\n")); + + icache_evict((struct inode *)mte->root, (struct inode *)dir); + + init_dirsearch( &ds, (struct inode *)dir, name ); + + err = jffs2_find( &ds ); + + if( err != ENOERR ) return err; + + // Fill in the status + buf->st_mode = ds.node->i_mode; + buf->st_ino = (ino_t)ds.node; + buf->st_dev = 0; + buf->st_nlink = ds.node->i_nlink; + buf->st_uid = 0; + buf->st_gid = 0; + buf->st_size = ds.node->i_size; + buf->st_atime = ds.node->i_atime; + buf->st_mtime = ds.node->i_mtime; + buf->st_ctime = ds.node->i_ctime; + + return err; + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_getinfo() +// Getinfo. Currently only support pathconf(). + +static int jffs2_getinfo ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int key, void *buf, int len ) +{ + jffs2_dirsearch ds; + int err; + + D2(printf("jffs2_getinfo\n")); + + icache_evict((struct inode *)mte->root, (struct inode *)dir); + + init_dirsearch( &ds, (struct inode *)dir, name ); + + err = jffs2_find( &ds ); + + if( err != ENOERR ) return err; + + switch( key ) + { + case FS_INFO_CONF: + err = jffs2_pathconf( ds.node, (struct cyg_pathconf_info *)buf ); + break; + + default: + err = EINVAL; + } + return err; + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_setinfo() +// Setinfo. Nothing to support here at present. + +static int jffs2_setinfo ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int key, void *buf, int len ) +{ + // No setinfo keys supported at present + + D2(printf("jffs2_setinfo\n")); + + return EINVAL; +} + + +//========================================================================== +// File operations + +// ------------------------------------------------------------------------- +// jffs2_fo_read() +// Read data from the file. + +static int jffs2_fo_read (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio) +{ + struct inode *inode = (struct inode *)fp->f_data; + struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); + struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); + int i; + ssize_t resid = uio->uio_resid; + off_t pos = fp->f_offset; + + down(&f->sem); + + // Loop over the io vectors until there are none left + for( i = 0; i < uio->uio_iovcnt && pos < inode->i_size; i++ ) + { + int ret; + cyg_iovec *iov = &uio->uio_iov[i]; + off_t len = min(iov->iov_len, inode->i_size - pos); + + D2(printf("jffs2_fo_read inode size %d\n", inode->i_size)); + + ret = jffs2_read_inode_range(c, f, (unsigned char *)iov->iov_base, + pos, len); + if (ret) { + D1(printf("jffs2_fo_read(): read_inode_range failed %d\n", + ret)); + uio->uio_resid = resid; + up(&f->sem); + return -ret; + } + resid -= len; + pos += len; + } + + // We successfully read some data, update the node's access time + // and update the file offset and transfer residue. + + inode->i_atime = cyg_timestamp(); + + uio->uio_resid = resid; + fp->f_offset = pos; + + up(&f->sem); + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_fo_write() +// Write data to file. + +static int jffs2_fo_write (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio) +{ + struct page write_page; + off_t page_start_pos; + struct inode *node = (struct inode *)fp->f_data; + off_t pos = fp->f_offset; + ssize_t resid = uio->uio_resid; + int i; + + memset(&read_write_buffer, 0, PAGE_CACHE_SIZE); + write_page.virtual = &read_write_buffer; + + // If the APPEND mode bit was supplied, force all writes to + // the end of the file. + if( fp->f_flag & CYG_FAPPEND ) + pos = fp->f_offset = node->i_size; + + // Check that pos is within current file size, or at the very end. + if( pos < 0 || pos > node->i_size ) + return EINVAL; + + // Now loop over the iovecs until they are all done, or + // we get an error. + for( i = 0; i < uio->uio_iovcnt; i++ ) + { + cyg_iovec *iov = &uio->uio_iov[i]; + char *buf = (char *)iov->iov_base; + off_t len = iov->iov_len; + + // loop over the vector writing it to the file until it has + // all been done. + while( len > 0 ) + { + //cyg_uint8 *fbuf; + //size_t bsize; + size_t writtenlen; + off_t l = len; + int err; + + write_page.index = 0; + + page_start_pos = pos; + while(page_start_pos >= (PAGE_CACHE_SIZE)) { + write_page.index++; + page_start_pos -= PAGE_CACHE_SIZE; + } + + if( l > PAGE_CACHE_SIZE - page_start_pos) + l = PAGE_CACHE_SIZE - page_start_pos; + + D2(printf("jffs2_fo_write write_page.index %d\n", write_page.index)); + D2(printf("jffs2_fo_write page_start_pos %d\n", page_start_pos)); + D2(printf("jffs2_fo_write transfer size %d\n", l)); + + err = jffs2_prepare_write(node, &write_page, page_start_pos, page_start_pos + l); + + if( err != 0 ) + return err; + + // copy data in + memcpy(&read_write_buffer[page_start_pos], buf, l); + + writtenlen = jffs2_commit_write(node, &write_page, page_start_pos, page_start_pos + l); + + if( writtenlen != l ) + return ENOSPC; + + // Update working vars + len -= l; + buf += l; + pos += l; + resid -= l; + } + } + + // We wrote some data successfully, update the modified and access + // times of the node, increase its size appropriately, and update + // the file offset and transfer residue. + node->i_mtime = + node->i_ctime = cyg_timestamp(); + if( pos > node->i_size ) + node->i_size = pos; + + uio->uio_resid = resid; + fp->f_offset = pos; + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_fo_lseek() +// Seek to a new file position. + +static int jffs2_fo_lseek (struct CYG_FILE_TAG *fp, off_t *apos, int whence ) +{ + struct inode *node = (struct inode *)fp->f_data; + off_t pos = *apos; + + D2(printf("jffs2_fo_lseek\n")); + + switch( whence ) + { + case SEEK_SET: + // Pos is already where we want to be. + break; + + case SEEK_CUR: + // Add pos to current offset. + pos += fp->f_offset; + break; + + case SEEK_END: + // Add pos to file size. + pos += node->i_size; + break; + + default: + return EINVAL; + } + + // Check that pos is still within current file size, or at the + // very end. + if( pos < 0 || pos > node->i_size ) + return EINVAL; + + // All OK, set fp offset and return new position. + *apos = fp->f_offset = pos; + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_fo_ioctl() +// Handle ioctls. Currently none are defined. + +static int jffs2_fo_ioctl (struct CYG_FILE_TAG *fp, CYG_ADDRWORD com, + CYG_ADDRWORD data) +{ + // No Ioctls currenly defined. + + D2(printf("jffs2_fo_ioctl\n")); + + return EINVAL; +} + +// ------------------------------------------------------------------------- +// jffs2_fo_fsync(). +// Force the file out to data storage. + +static int jffs2_fo_fsync (struct CYG_FILE_TAG *fp, int mode ) +{ + // Data is always permanently where it belongs, nothing to do + // here. + + D2(printf("jffs2_fo_fsync\n")); + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_fo_close() +// Close a file. We just decrement the refcnt and let it go away if +// that is all that is keeping it here. + +static int jffs2_fo_close (struct CYG_FILE_TAG *fp) +{ + struct inode *node = (struct inode *)fp->f_data; + + D2(printf("jffs2_fo_close\n")); + + dec_refcnt( node ); + + fp->f_data = 0; // zero data pointer + + return ENOERR; +} + +// ------------------------------------------------------------------------- +//jffs2_fo_fstat() +// Get file status. + +static int jffs2_fo_fstat (struct CYG_FILE_TAG *fp, struct stat *buf ) +{ + struct inode *node = (struct inode *)fp->f_data; + + D2(printf("jffs2_fo_fstat\n")); + + // Fill in the status + buf->st_mode = node->i_mode; + buf->st_ino = (ino_t)node; + buf->st_dev = 0; + buf->st_nlink = node->i_nlink; + buf->st_uid = 0; + buf->st_gid = 0; + buf->st_size = node->i_size; + buf->st_atime = node->i_atime; + buf->st_mtime = node->i_mtime; + buf->st_ctime = node->i_ctime; + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_fo_getinfo() +// Get info. Currently only supports fpathconf(). + +static int jffs2_fo_getinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ) +{ + struct inode *node = (struct inode *)fp->f_data; + int err; + + D2(printf("jffs2_fo_getinfo\n")); + + switch( key ) + { + case FS_INFO_CONF: + err = jffs2_pathconf( node, (struct cyg_pathconf_info *)buf ); + break; + + default: + err = EINVAL; + } + return err; + + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_fo_setinfo() +// Set info. Nothing supported here. + +static int jffs2_fo_setinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ) +{ + // No setinfo key supported at present + + D2(printf("jffs2_fo_setinfo\n")); + + return ENOERR; +} + + +//========================================================================== +// Directory operations + +// ------------------------------------------------------------------------- +// jffs2_fo_dirread() +// Read a single directory entry from a file. + +static __inline void +filldir(char *nbuf, int nlen, const char * name, int namlen) +{ + int len = nlen < namlen ? nlen : namlen; + memcpy(nbuf, name, len); + nbuf[len] = '\0'; +} + +static int jffs2_fo_dirread (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio) +{ + struct inode *d_inode = (struct inode *)fp->f_data; + struct dirent *ent = (struct dirent *)uio->uio_iov[0].iov_base; + char *nbuf = ent->d_name; + int nlen = sizeof(ent->d_name)-1; + off_t len = uio->uio_iov[0].iov_len; + struct jffs2_inode_info *f; + struct jffs2_sb_info *c; + struct inode *inode = d_inode; + struct jffs2_full_dirent *fd; + unsigned long offset, curofs; + int found = 1; + + if( len < sizeof(struct dirent) ) + return EINVAL; + + D1(printk(KERN_DEBUG "jffs2_readdir() for dir_i #%lu\n", d_inode->i_ino)); + + f = JFFS2_INODE_INFO(inode); + c = JFFS2_SB_INFO(inode->i_sb); + + offset = fp->f_offset; + + if (offset == 0) { + D1(printk(KERN_DEBUG "Dirent 0: \".\", ino #%lu\n", inode->i_ino)); + filldir(nbuf, nlen, ".", 1); + goto out; + } + if (offset == 1) { + filldir(nbuf, nlen, "..", 2); + goto out; + } + + curofs=1; + down(&f->sem); + for (fd = f->dents; fd; fd = fd->next) { + + curofs++; + /* First loop: curofs = 2; offset = 2 */ + if (curofs < offset) { + D2(printk(KERN_DEBUG "Skipping dirent: \"%s\", ino #%u, type %d, because curofs %ld < offset %ld\n", + fd->name, fd->ino, fd->type, curofs, offset)); + continue; + } + if (!fd->ino) { + D2(printk(KERN_DEBUG "Skipping deletion dirent \"%s\"\n", fd->name)); + offset++; + continue; + } + D2(printk(KERN_DEBUG "Dirent %ld: \"%s\", ino #%u, type %d\n", offset, fd->name, fd->ino, fd->type)); + filldir(nbuf, nlen, fd->name, strlen(fd->name)); + goto out_sem; + } + /* Reached the end of the directory */ + found = 0; + out_sem: + up(&f->sem); + out: + fp->f_offset = ++offset; + if (found) { + uio->uio_resid -= sizeof(struct dirent); + } + return ENOERR; +} + +// ------------------------------------------------------------------------- +// jffs2_fo_dirlseek() +// Seek directory to start. + +static int jffs2_fo_dirlseek (struct CYG_FILE_TAG *fp, off_t *pos, int whence ) +{ + // Only allow SEEK_SET to zero + + D2(printf("jffs2_fo_dirlseek\n")); + + if( whence != SEEK_SET || *pos != 0) + return EINVAL; + + *pos = fp->f_offset = 0; + + return ENOERR; +} + + +//========================================================================== +// +// Called by JFFS2 +// =============== +// +// +//========================================================================== + + +struct page *read_cache_page(unsigned long index, + int (*filler)(void *,struct page*), + void *data) +{ + // Only called in gc.c jffs2_garbage_collect_dnode + // but gets a real page for the specified inode + + int err; + struct page *gc_page = malloc(sizeof(struct page)); + +printf("read_cache_page\n"); + memset(&gc_buffer, 0, PAGE_CACHE_SIZE); + + if(gc_page != NULL) { + gc_page->virtual = &gc_buffer; + gc_page->index = index; + + err = filler(data, gc_page); + if (err < 0) { + free(gc_page); + gc_page = NULL; + } + } + + return gc_page; +} + +void page_cache_release(struct page * pg) { + + // Only called in gc.c jffs2_garbage_collect_dnode + // but should free the page malloc'd by read_cache_page + +printf("page_cache_release\n"); + free(pg); +} + +struct inode * new_inode(struct super_block *sb) { + + // Only called in write.c jffs2_new_inode + // Always adds itself to inode cache + + struct inode * inode; + struct inode * cached_inode; + + inode = malloc(sizeof(struct inode)); + if (inode == NULL) + return 0; + + D2(printf("malloc new_inode %x ####################################\n", inode)); + + memset(inode, 0, sizeof(struct inode)); + inode->i_sb = sb; + inode->i_ino = 1; + inode->i_count = 0;//1; // Let ecos manage the open count + + inode->i_nlink = 1; // Let JFFS2 manage the link count + inode->i_size = 0; + + inode->i_cache_next = NULL; // Newest inode, about to be cached + + // Add to the icache + for(cached_inode = sb->s_root; cached_inode != NULL; cached_inode = cached_inode->i_cache_next) { + if (cached_inode->i_cache_next == NULL) { + cached_inode->i_cache_next = inode; // Current last in cache points to newcomer + inode->i_cache_prev = cached_inode; // Newcomer points back to last + break; + } + } + + return inode; +} + +struct inode * iget(struct super_block *sb, cyg_uint32 ino) { + + // Substitute for iget drops straight through to reading the + // inode from disk if it is not in the inode cache + + // Called in super.c jffs2_read_super, dir.c jffs2_lookup, + // and gc.c jffs2_garbage_collect_pass + + // Must first check for cached inode + // If this fails let new_inode create one + + struct inode * inode; + + D2(printf("iget\n")); + + // Check for this inode in the cache + for(inode = sb->s_root; inode != NULL; inode = inode->i_cache_next) { + if (inode->i_ino == ino) + return inode; + } + inode = NULL; + + // Not cached, so malloc it + inode = new_inode(sb); + if (inode == NULL) + return 0; + + inode->i_ino = ino; + jffs2_read_inode(inode); + + return inode; +} + +void iput(struct inode * i) { + + // Called in dec_refcnt, jffs2_find + // (and jffs2_open and jffs2_ops_mkdir?) + // super.c jffs2_read_super, + // and gc.c jffs2_garbage_collect_pass + + struct inode *cached_inode; + + D2(printf("free iput inode %x $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n", i)); + if (i && i->i_count) { + /* Added by dwmw2. iget/iput in Linux track the use count, + don't just unconditionally free it */ + printf("iput called for used inode\n"); + return; + } + if (i != NULL) { + // Remove from the icache + for(cached_inode = i->i_sb->s_root; cached_inode != NULL; cached_inode = cached_inode->i_cache_next) { + if (cached_inode == i) { + cached_inode->i_cache_prev->i_cache_next = cached_inode->i_cache_next; // Prveious entry points ahead of us + if (cached_inode->i_cache_next != NULL) + cached_inode->i_cache_next->i_cache_prev = cached_inode->i_cache_prev; // Next entry points behind us + break; + } + } + // inode has been seperated from the cache + jffs2_clear_inode(i); + free(i); + } +} + +static int return_EIO(void) +{ + return -EIO; +} + +#define EIO_ERROR ((void *) (return_EIO)) + +void make_bad_inode(struct inode * inode) { + + // In readinode.c JFFS2 checks whether the inode has appropriate + // content for its marked type + + D2(printf("make_bad_inode\n")); + + inode->i_mode = S_IFREG; + inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; + inode->i_op = EIO_ERROR; + inode->i_fop = EIO_ERROR; +} + +int is_bad_inode(struct inode * inode) { + + // Called in super.c jffs2_read_super, + // and gc.c jffs2_garbage_collect_pass + + D2(printf("is_bad_inode\n")); + + return (inode->i_op == EIO_ERROR); + /*if(i == NULL) + return 1; + return 0;*/ +} + +cyg_bool jffs2_flash_read(struct jffs2_sb_info *c, cyg_uint32 read_buffer_offset, const size_t size, size_t * return_size, char * write_buffer) { + Cyg_ErrNo err; + cyg_uint32 len = size; + struct super_block *sb = OFNI_BS_2SFFJ( c ); + + //D2(printf("FLASH READ\n")); + //D2(printf("read address = %x\n", CYGNUM_FS_JFFS2_BASE_ADDRESS + read_buffer_offset)); + //D2(printf("write address = %x\n", write_buffer)); + //D2(printf("size = %x\n", size)); + err = cyg_io_bread( sb->s_dev, write_buffer, &len, read_buffer_offset ); + + *return_size = (size_t)len; + return ( err != ENOERR ); +} + +cyg_bool jffs2_flash_write(struct jffs2_sb_info *c, cyg_uint32 write_buffer_offset, const size_t size, size_t * return_size, char * read_buffer) { + + Cyg_ErrNo err; + cyg_uint32 len = size; + struct super_block *sb = OFNI_BS_2SFFJ( c ); + + // D2(printf("FLASH WRITE ENABLED!!!\n")); + // D2(printf("write address = %x\n", CYGNUM_FS_JFFS2_BASE_ADDRESS + write_buffer_offset)); + // D2(printf("read address = %x\n", read_buffer)); + // D2(printf("size = %x\n", size)); + + err = cyg_io_bwrite( sb->s_dev, read_buffer, &len, write_buffer_offset ); + *return_size = (size_t)len; + + return ( err != ENOERR ); +} + +int +jffs2_flash_writev(struct jffs2_sb_info *c, const struct iovec *vecs, + unsigned long count, loff_t to, size_t *retlen) +{ + unsigned long i; + size_t totlen = 0, thislen; + int ret = 0; + + for (i=0; i 256 ) + { + // cop out and malloc + unsigned long j; + ssize_t sizetomalloc=0, totvecsize=0; + char *cbuf, *cbufptr; + + for (j=i;j totvecsize ) // in case it was aligned up + thislen = totvecsize; + totlen += thislen; + free(cbuf); + goto writev_out; + } + else + { + // otherwise optimize for the common case + int buf[256/sizeof(int)]; // int, so int aligned + size_t lentowrite; + + lentowrite = vecs[i].iov_len; + // pad up in case its unaligned + lentowrite += sizeof(int)-1; + lentowrite &= ~(sizeof(int)-1); + memcpy( buf, vecs[i].iov_base, lentowrite ); + + ret = jffs2_flash_write(c, to, lentowrite, &thislen, + (char *)&buf ); + if ( thislen > vecs[i].iov_len ) + thislen = vecs[i].iov_len; + } // else + } + else + ret = jffs2_flash_write(c, to, vecs[i].iov_len, &thislen, + vecs[i].iov_base); + totlen += thislen; + if (ret || thislen != vecs[i].iov_len) + break; + to += vecs[i].iov_len; + } +writev_out: + if (retlen) + *retlen = totlen; + + return ret; +} + +cyg_bool jffs2_flash_erase(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) { + cyg_io_flash_getconfig_erase_t e; + void *err_addr; + Cyg_ErrNo err; + cyg_uint32 len = sizeof(e); + struct super_block *sb = OFNI_BS_2SFFJ( c ); + + e.offset = jeb->offset; + e.len = c->sector_size; + e.err_address = &err_addr; + + // D2(printf("FLASH ERASE ENABLED!!!\n")); + // D2(printf("erase address = %x\n", CYGNUM_FS_JFFS2_BASE_ADDRESS + jeb->offset)); + // D2(printf("size = %x\n", c->sector_size)); + + err = cyg_io_get_config( sb->s_dev, CYG_IO_GET_CONFIG_FLASH_ERASE, + &e, &len ); + + return ( err != ENOERR || e.flasherr != 0 ); +} + +// ------------------------------------------------------------------------- +// EOF jffs2.c diff --git a/packages/fs/jffs2/current/src/jffs2.h b/packages/fs/jffs2/current/src/jffs2.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/jffs2.h @@ -0,0 +1,145 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: jffs2.h,v 1.22 2002/01/09 13:27:58 dwmw2 Exp $ + * + */ + +#ifndef __LINUX_JFFS2_H__ +#define __LINUX_JFFS2_H__ + +#ifdef __ECOS +#include "jffs2port.h" +#else +#include +#endif + +#define JFFS2_SUPER_MAGIC 0x72b6 + +/* Values we may expect to find in the 'magic' field */ +#define JFFS2_OLD_MAGIC_BITMASK 0x1984 +#define JFFS2_MAGIC_BITMASK 0x1985 +#define KSAMTIB_CIGAM_2SFFJ 0x5981 /* For detecting wrong-endian fs */ +#define JFFS2_EMPTY_BITMASK 0xffff +#define JFFS2_DIRTY_BITMASK 0x0000 + +/* We only allow a single char for length, and 0xFF is empty flash so + we don't want it confused with a real length. Hence max 254. +*/ +#define JFFS2_MAX_NAME_LEN 254 + +/* How small can we sensibly write nodes? */ +#define JFFS2_MIN_DATA_LEN 128 + +#define JFFS2_COMPR_NONE 0x00 +#define JFFS2_COMPR_ZERO 0x01 +#define JFFS2_COMPR_RTIME 0x02 +#define JFFS2_COMPR_RUBINMIPS 0x03 +#define JFFS2_COMPR_COPY 0x04 +#define JFFS2_COMPR_DYNRUBIN 0x05 +#define JFFS2_COMPR_ZLIB 0x06 +/* Compatibility flags. */ +#define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ +#define JFFS2_NODE_ACCURATE 0x2000 +/* INCOMPAT: Fail to mount the filesystem */ +#define JFFS2_FEATURE_INCOMPAT 0xc000 +/* ROCOMPAT: Mount read-only */ +#define JFFS2_FEATURE_ROCOMPAT 0x8000 +/* RWCOMPAT_COPY: Mount read/write, and copy the node when it's GC'd */ +#define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000 +/* RWCOMPAT_DELETE: Mount read/write, and delete the node when it's GC'd */ +#define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000 + +#define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1) +#define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2) +#define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) + +// Maybe later... +//#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) +//#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4) + +/* Same as the non_ECC versions, but with extra space for real + * ECC instead of just the checksum. For use on NAND flash + */ +//#define JFFS2_NODETYPE_DIRENT_ECC (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 5) +//#define JFFS2_NODETYPE_INODE_ECC (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 6) + +#define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at + mount time, don't wait for it to + happen later */ +#define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific + compression type */ + + +struct jffs2_unknown_node +{ + /* All start like this */ + uint16_t magic; + uint16_t nodetype; + uint32_t totlen; /* So we can skip over nodes we don't grok */ + uint32_t hdr_crc; +} __attribute__((packed)); + +struct jffs2_raw_dirent +{ + uint16_t magic; + uint16_t nodetype; /* == JFFS_NODETYPE_DIRENT */ + uint32_t totlen; + uint32_t hdr_crc; + uint32_t pino; + uint32_t version; + uint32_t ino; /* == zero for unlink */ + uint32_t mctime; + uint8_t nsize; + uint8_t type; + uint8_t unused[2]; + uint32_t node_crc; + uint32_t name_crc; + uint8_t name[0]; +} __attribute__((packed)); + +/* The JFFS2 raw inode structure: Used for storage on physical media. */ +/* The uid, gid, atime, mtime and ctime members could be longer, but + are left like this for space efficiency. If and when people decide + they really need them extended, it's simple enough to add support for + a new type of raw node. +*/ +struct jffs2_raw_inode +{ + uint16_t magic; /* A constant magic number. */ + uint16_t nodetype; /* == JFFS_NODETYPE_INODE */ + uint32_t totlen; /* Total length of this node (inc data, etc.) */ + uint32_t hdr_crc; + uint32_t ino; /* Inode number. */ + uint32_t version; /* Version number. */ + uint32_t mode; /* The file's type or mode. */ + uint16_t uid; /* The file's owner. */ + uint16_t gid; /* The file's group. */ + uint32_t isize; /* Total resultant size of this inode (used for truncations) */ + uint32_t atime; /* Last access time. */ + uint32_t mtime; /* Last modification time. */ + uint32_t ctime; /* Change time. */ + uint32_t offset; /* Where to begin to write. */ + uint32_t csize; /* (Compressed) data size */ + uint32_t dsize; /* Size of the node's data. (after decompression) */ + uint8_t compr; /* Compression algorithm used */ + uint8_t usercompr; /* Compression algorithm requested by the user */ + uint16_t flags; /* See JFFS2_INO_FLAG_* */ + uint32_t data_crc; /* CRC for the (compressed) data. */ + uint32_t node_crc; /* CRC for the raw inode (excluding data) */ +// uint8_t data[dsize]; +} __attribute__((packed)); + +union jffs2_node_union { + struct jffs2_raw_inode i; + struct jffs2_raw_dirent d; + struct jffs2_unknown_node u; +}; + +#endif /* __LINUX_JFFS2_H__ */ diff --git a/packages/fs/jffs2/current/src/jffs2_fs_i.h b/packages/fs/jffs2/current/src/jffs2_fs_i.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/jffs2_fs_i.h @@ -0,0 +1,55 @@ +/* $Id: jffs2_fs_i.h,v 1.10 2002/01/09 11:44:23 dwmw2 Exp $ */ + +#ifndef _JFFS2_FS_I +#define _JFFS2_FS_I + +/* Include the pipe_inode_info at the beginning so that we can still + use the storage space in the inode when we have a pipe inode. + This sucks. +*/ + +#undef THISSUCKS /* Only for 2.2 */ +#ifdef THISSUCKS +#include +#endif + +struct jffs2_inode_info { +#ifdef THISSUCKS + struct pipe_inode_info pipecrap; +#endif + /* We need an internal semaphore similar to inode->i_sem. + Unfortunately, we can't used the existing one, because + either the GC would deadlock, or we'd have to release it + before letting GC proceed. Or we'd have to put ugliness + into the GC code so it didn't attempt to obtain the i_sem + for the inode(s) which are already locked */ + struct semaphore sem; + + /* The highest (datanode) version number used for this ino */ + uint32_t highest_version; + + /* List of data fragments which make up the file */ + struct jffs2_node_frag *fraglist; + + /* There may be one datanode which isn't referenced by any of the + above fragments, if it contains a metadata update but no actual + data - or if this is a directory inode */ + /* This also holds the _only_ dnode for symlinks/device nodes, + etc. */ + struct jffs2_full_dnode *metadata; + + /* Directory entries */ + struct jffs2_full_dirent *dents; + + /* Some stuff we just have to keep in-core at all times, for each inode. */ + struct jffs2_inode_cache *inocache; + + /* Keep a pointer to the last physical node in the list. We don't + use the doubly-linked lists because we don't want to increase + the memory usage that much. This is simpler */ + // struct jffs2_raw_node_ref *lastnode; + uint16_t flags; + uint8_t usercompr; +}; + +#endif /* _JFFS2_FS_I */ diff --git a/packages/fs/jffs2/current/src/jffs2_fs_sb.h b/packages/fs/jffs2/current/src/jffs2_fs_sb.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/jffs2_fs_sb.h @@ -0,0 +1,81 @@ +/* $Id: jffs2_fs_sb.h,v 1.18 2002/01/09 11:44:23 dwmw2 Exp $ */ + +#ifndef _JFFS2_FS_SB +#define _JFFS2_FS_SB + +#ifdef __ECOS +#include "list.h" +#else +#include +#include +#include +#include +#include +#endif + +#define INOCACHE_HASHSIZE 1 + +#define JFFS2_SB_FLAG_RO 1 + +/* A struct for the overall file system control. Pointers to + jffs2_sb_info structs are named `c' in the source code. + Nee jffs_control +*/ +struct jffs2_sb_info { + struct mtd_info *mtd; + + uint32_t highest_ino; + unsigned int flags; + spinlock_t nodelist_lock; + + // pid_t thread_pid; /* GC thread's PID */ + struct task_struct *gc_task; /* GC task struct */ +#ifndef __ECOS + struct semaphore gc_thread_start; /* GC thread start mutex */ + struct completion gc_thread_exit; /* GC thread exit completion port */ +#endif + // uint32_t gc_minfree_threshold; /* GC trigger thresholds */ + // uint32_t gc_maxdirty_threshold; + + struct semaphore alloc_sem; /* Used to protect all the following + fields, and also to protect against + out-of-order writing of nodes. + And GC. + */ + uint32_t flash_size; + uint32_t used_size; + uint32_t dirty_size; + uint32_t free_size; + uint32_t erasing_size; + uint32_t bad_size; + uint32_t sector_size; + // uint32_t min_free_size; + // uint32_t max_chunk_size; + + uint32_t nr_free_blocks; + uint32_t nr_erasing_blocks; + + uint32_t nr_blocks; + struct jffs2_eraseblock *blocks; /* The whole array of blocks. Used for getting blocks + * from the offset (blocks[ofs / sector_size]) */ + struct jffs2_eraseblock *nextblock; /* The block we're currently filling */ + + struct jffs2_eraseblock *gcblock; /* The block we're currently garbage-collecting */ + + struct list_head clean_list; /* Blocks 100% full of clean data */ + struct list_head dirty_list; /* Blocks with some dirty space */ + struct list_head erasing_list; /* Blocks which are currently erasing */ + struct list_head erase_pending_list; /* Blocks which need erasing */ + struct list_head erase_complete_list; /* Blocks which are erased and need the clean marker written to them */ + struct list_head free_list; /* Blocks which are free and ready to be used */ + struct list_head bad_list; /* Bad blocks. */ + struct list_head bad_used_list; /* Bad blocks with valid data in. */ + + spinlock_t erase_completion_lock; /* Protect free_list and erasing_list + against erase completion handler */ + wait_queue_head_t erase_wait; /* For waiting for erases to complete */ + struct jffs2_inode_cache *inocache_list[INOCACHE_HASHSIZE]; + spinlock_t inocache_lock; +}; + +#endif /* _JFFS2_FB_SB */ diff --git a/packages/fs/jffs2/current/src/jffs2port.h b/packages/fs/jffs2/current/src/jffs2port.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/jffs2port.h @@ -0,0 +1,340 @@ +#ifndef __LINUX_JFFS2PORT_H__ +#define __LINUX_JFFS2PORT_H__ + +#include +#include +//#include +#include +//#include + +#include // tracing macros +#include // assertion macros + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include + +#include + +#include "list.h" + +// ARM related constants +#define PAGE_SHIFT 0xC +#define PAGE_SIZE (0x1 << PAGE_SHIFT) +#define PAGE_CACHE_SHIFT PAGE_SHIFT +#define PAGE_CACHE_SIZE PAGE_SIZE + +//#define BITS_PER_LONG 32 + +// Linux types +#define printf diag_printf +#define printk diag_printf +#define BUG() diag_printf("BUG()\n") + +#define uint8_t cyg_uint8 +#define uint16_t cyg_uint16 +#define uint32_t cyg_uint32 +#define loff_t off_t + +#define min(x,y) (x" // system is unusable +#define KERN_ALERT "<1>" // action must be taken immediately +#define KERN_CRIT "<2>" // critical conditions +#define KERN_ERR "<3>" // error conditions +#define KERN_WARNING "<4>" // warning conditions +#define KERN_NOTICE "<5>" // normal but significant condition +#define KERN_INFO "<6>" // informational +#define KERN_DEBUG "<7>" // debug-level messages + +// Structures used by VFS + +typedef unsigned short kdev_t; + +struct qstr { + const unsigned char * name; + unsigned int len; + unsigned int hash; +}; + +#define DNAME_INLINE_LEN 16 + +struct dentry { + atomic_t d_count; + unsigned int d_flags; + struct inode * d_inode; /* Where the name belongs to - NULL is negative */ + struct dentry * d_parent; /* parent directory */ + struct list_head d_hash; /* lookup hash list */ + struct list_head d_child; /* child of parent list */ + struct list_head d_subdirs; /* our children */ + struct list_head d_alias; /* inode alias list */ + struct qstr d_name; + struct dentry_operations *d_op; + struct super_block * d_sb; /* The root of the dentry tree */ + unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */ +}; + +struct file { + struct dentry *f_dentry; + unsigned int f_flags; + mode_t f_mode; + loff_t f_pos; + unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin; +}; + +#define ATTR_MODE 1 +#define ATTR_UID 2 +#define ATTR_GID 4 +#define ATTR_SIZE 8 +#define ATTR_ATIME 16 +#define ATTR_MTIME 32 +#define ATTR_CTIME 64 +#define ATTR_ATIME_SET 128 +#define ATTR_MTIME_SET 256 +#define ATTR_FORCE 512 /* Not a change, but a change it */ +#define ATTR_ATTR_FLAG 1024 + +typedef unsigned short umode_t; + +struct iattr { + unsigned int ia_valid; + umode_t ia_mode; + uid_t ia_uid; + gid_t ia_gid; + loff_t ia_size; + time_t ia_atime; + time_t ia_mtime; + time_t ia_ctime; +}; + +struct page { + unsigned long index; + void *virtual; +}; + +struct nameidata { + struct dentry *dentry; + struct qstr last; + unsigned int flags; + int last_type; +}; + +struct file_operations { + //struct module *owner; + //loff_t (*llseek) (struct file *, loff_t, int); + ssize_t (*read) (struct file *, char *, size_t, loff_t *); + //ssize_t (*write) (struct file *, const char *, size_t, loff_t *); + int (*readdir) (struct file *, char *, int); + //unsigned int (*poll) (struct file *, struct poll_table_struct *); + int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); + //int (*mmap) (struct file *, struct vm_area_struct *); + //int (*open) (struct inode *, struct file *); + //int (*flush) (struct file *); + //int (*release) (struct inode *, struct file *); + int (*fsync) (struct file *, struct dentry *, int datasync); + //int (*fasync) (int, struct file *, int); + //int (*lock) (struct file *, int, struct file_lock *); + //ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *); + //ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *); +}; + +struct inode_operations { + int (*create) (struct inode *,struct dentry *,int); + struct dentry * (*lookup) (struct inode *,struct dentry *); + int (*link) (struct dentry *,struct inode *,struct dentry *); + int (*unlink) (struct inode *,struct dentry *); + int (*symlink) (struct inode *,struct dentry *,const char *); + int (*mkdir) (struct inode *,struct dentry *,int); + int (*rmdir) (struct inode *,struct dentry *); + int (*mknod) (struct inode *,struct dentry *,int,int); + int (*rename) (struct inode *, struct dentry *, + struct inode *, struct dentry *); + int (*readlink) (struct dentry *, char *,int); + int (*follow_link) (struct dentry *, struct nameidata *); + //void (*truncate) (struct inode *); + int (*permission) (struct inode *, int); + //int (*revalidate) (struct dentry *); + int (*setattr) (struct dentry *, struct iattr *); + //int (*getattr) (struct dentry *, struct iattr *); +}; + +/* + * File types + */ +#define DT_UNKNOWN 0 +#define DT_DIR 4 +#define DT_REG 8 + +struct iovec { + void *iov_base; + ssize_t iov_len; +}; + +// FIXME: we must provide some translation so that Linux-created jffs2 +// partitions can be read on eCos and vice versa + +#define S_IFMT 0xF9 // Quick fix for clash on ecos / linux mode bits +#define S_IFDIR __stat_mode_DIR +#define S_IFREG __stat_mode_REG +#define S_IFBLK __stat_mode_BLK +#define S_IFCHR __stat_mode_CHR +#define S_IFLNK 0x101 +#define S_IFSOCK 0x102 +#define S_IFIFO __stat_mode_FIFO +#define S_IRUGO 0x103 +#define S_IXUGO 0x104 +#define S_IRWXUGO 0x105 + + +// called by JFFS2 + +#define to_kdev_t(rdev) (rdev) +#define MAJOR(rdev) (rdev)>>8 +#define MINOR(rdev) (rdev) + +#define page_address(page) ((page)->virtual) + +static __inline__ void * kmap(struct page * page) { + return page_address(page); +} + +#define kunmap(page) do { } while (0) + +//struct page * read_cache_page(cyg_uint32 start, void * f, struct inode * i); +struct page *read_cache_page(unsigned long index, int (*filler)(void *,struct page*), void *data); +void page_cache_release(struct page * pg); + +struct inode * new_inode(struct super_block *sb); +struct inode * iget(struct super_block *sb, cyg_uint32 ino); +void iput(struct inode * i); +void make_bad_inode(struct inode * inode); +int is_bad_inode(struct inode * inode); + +#define insert_inode_hash(inode) do { } while (0) + +#define d_alloc_root(root_inode) root_inode + +#define flush_dcache_page(page) do { } while (0) + +struct jffs2_sb_info; +struct jffs2_eraseblock; + +cyg_bool jffs2_flash_read(struct jffs2_sb_info *c, cyg_uint32 read_buffer_offset, const size_t size, size_t * return_size, char * write_buffer); +cyg_bool jffs2_flash_write(struct jffs2_sb_info *c, cyg_uint32 write_buffer_offset, const size_t size, size_t * return_size, char * read_buffer); +int jffs2_flash_writev(struct jffs2_sb_info *c, const struct iovec *vecs, unsigned long count, loff_t to, size_t *retlen); +cyg_bool jffs2_flash_erase(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); + +static inline void wake_up(wait_queue_head_t *erase_wait) +{ /* Only used for waking up threads blocks on erases. Not used in eCos */ } + +// calls to JFFS2 + +// dir-ecos.c +struct inode *jffs2_lookup(struct inode *dir_i, struct qstr *name); +int jffs2_readdir (struct inode *d_inode, unsigned long f_pos, char *nbuf, int nlen); +int jffs2_create(struct inode *dir_i, struct qstr *d_name, int mode, struct inode **new_i); +int jffs2_mkdir (struct inode *dir_i, struct qstr *d_name, int mode, struct inode **new_i); +int jffs2_link (struct inode *old_d_inode, struct inode *dir_i, struct qstr *d_name); +int jffs2_unlink(struct inode *dir_i, struct inode *d_inode, struct qstr *d_name); +int jffs2_rmdir (struct inode *dir_i, struct inode *d_inode, struct qstr *d_name); +int jffs2_rename (struct inode *old_dir_i, struct inode *d_inode, struct qstr *old_d_name, + struct inode *new_dir_i, struct qstr *new_d_name); + +#define init_name_hash() 0 +static inline unsigned long partial_name_hash(unsigned long c, unsigned long prevhash) +{ + prevhash = (prevhash << 4) | (prevhash >> (8*sizeof(unsigned long)-4)); + return prevhash ^ c; +} + +static inline unsigned long end_name_hash(unsigned long hash) +{ + if (sizeof(hash) > sizeof(unsigned int)) + hash += hash >> 4*sizeof(hash); + return (unsigned int) hash; +} + +static inline unsigned int full_name_hash(const unsigned char * name, unsigned int len) { + + unsigned long hash = init_name_hash(); + while (len--) + hash = partial_name_hash(*name++, hash); + return end_name_hash(hash); +} + +#endif /* __LINUX_JFFS2PORT_H__ */ + + + + + + + + + + diff --git a/packages/fs/jffs2/current/src/list.h b/packages/fs/jffs2/current/src/list.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/list.h @@ -0,0 +1,95 @@ +#ifndef CYGONCE_FS_JFFS2_LIST_H +#define CYGONCE_FS_JFFS2_LIST_H + +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2002 Red Hat, Inc. + * + * Created by Jonathan Larmour + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: $ + * + */ + +/* -----------------------------------------------------------------------*/ + +/* Doubly linked list implementation to replace the GPL'd one used in + the Linux kernel. */ + +#include +#include + +/* TYPES */ + +struct list_head { + struct list_head *next; + struct list_head *prev; +}; + +/* MACROS */ + +#define INIT_LIST_HEAD( _list_ ) \ +CYG_MACRO_START \ +(_list_)->next = (_list_)->prev = (_list_); \ +CYG_MACRO_END + +/* FUNCTIONS */ + +/* Insert an entry _after_ the specified entry */ +static __inline__ void +list_add( struct list_head *newent, struct list_head *afterthisent ) +{ + struct list_head *next = afterthisent->next; + newent->next = next; + newent->prev = afterthisent; + afterthisent->next = newent; + next->prev = newent; +} /* list_add() */ + +/* Insert an entry _before_ the specified entry */ +static __inline__ void +list_add_tail( struct list_head *newent, struct list_head *beforethisent ) +{ + struct list_head *prev = beforethisent->prev; + newent->prev = prev; + newent->next = beforethisent; + beforethisent->prev = newent; + prev->next = newent; +} /* list_add_tail() */ + +/* Delete the specified entry */ +static __inline__ void +list_del( struct list_head *ent ) +{ + ent->prev->next = ent->next; + ent->next->prev = ent->prev; +} /* list_del() */ + +/* Is this list empty? */ +static __inline__ int +list_empty( struct list_head *list ) +{ + return ( list->next == list ); +} /* list_empty() */ + +/* list_entry - Assuming you have a struct of type _type_ that contains a + list which has the name _member_ in that struct type, then given the + address of that list in the struct, _list_, this returns the address + of the container structure */ + +#define list_entry( _list_, _type_, _member_ ) \ + ((_type_ *)((char *)(_list_)-(char *)(offsetof(_type_,_member_)))) + +/* list_for_each - using _ent_, iterate through list _list_ */ + +#define list_for_each( _ent_, _list_ ) \ + for ( (_ent_) = (_list_)->next; \ + (_ent_) != (_list_); \ + (_ent_) = (_ent_)->next ) + +/* -----------------------------------------------------------------------*/ +#endif /* #ifndef CYGONCE_FS_JFFS2_LIST_H */ +/* EOF list.h */ diff --git a/packages/fs/jffs2/current/src/malloc-ecos.c b/packages/fs/jffs2/current/src/malloc-ecos.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/malloc-ecos.c @@ -0,0 +1,98 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id$ + * + */ + +#include "nodelist.h" + +struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize) +{ + return malloc(sizeof(struct jffs2_full_dirent) + namesize); +} + +void jffs2_free_full_dirent(struct jffs2_full_dirent *x) +{ + free(x); +} + +struct jffs2_full_dnode *jffs2_alloc_full_dnode(void) +{ + return malloc(sizeof(struct jffs2_full_dnode)); +} + +void jffs2_free_full_dnode(struct jffs2_full_dnode *x) +{ + free(x); +} + +struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void) +{ + return malloc(sizeof(struct jffs2_raw_dirent)); +} + +void jffs2_free_raw_dirent(struct jffs2_raw_dirent *x) +{ + free(x); +} + +struct jffs2_raw_inode *jffs2_alloc_raw_inode(void) +{ + return malloc(sizeof(struct jffs2_raw_inode)); +} + +void jffs2_free_raw_inode(struct jffs2_raw_inode *x) +{ + free(x); +} + +struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void) +{ + return malloc(sizeof(struct jffs2_tmp_dnode_info)); +} + +void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x) +{ + free(x); +} + +struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void) +{ + return malloc(sizeof(struct jffs2_raw_node_ref)); +} + +void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x) +{ + free(x); +} + +struct jffs2_node_frag *jffs2_alloc_node_frag(void) +{ + return malloc(sizeof(struct jffs2_node_frag)); +} + +void jffs2_free_node_frag(struct jffs2_node_frag *x) +{ + free(x); +} + +struct jffs2_inode_cache *jffs2_alloc_inode_cache(void) +{ + struct jffs2_inode_cache *ret = malloc(sizeof(struct jffs2_inode_cache)); + D1(printk(KERN_DEBUG "Allocated inocache at %p\n", ret)); + return ret; +} + +void jffs2_free_inode_cache(struct jffs2_inode_cache *x) +{ + D1(printk(KERN_DEBUG "Freeing inocache at %p\n", x)); + free(x); +} + diff --git a/packages/fs/jffs2/current/src/nodelist.c b/packages/fs/jffs2/current/src/nodelist.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/nodelist.c @@ -0,0 +1,339 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: nodelist.c,v 1.36 2002/01/09 16:52:59 dwmw2 Exp $ + * + */ + +#ifndef __ECOS +#include +#include +#include +#endif +#include "nodelist.h" + +void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list) +{ + struct jffs2_full_dirent **prev = list; + D1(printk(KERN_DEBUG "jffs2_add_fd_to_list( %p, %p (->%p))\n", new, list, *list)); + + while ((*prev) && (*prev)->nhash <= new->nhash) { + if ((*prev)->nhash == new->nhash && !strcmp((*prev)->name, new->name)) { + /* Duplicate. Free one */ + if (new->version < (*prev)->version) { + D1(printk(KERN_DEBUG "Eep! Marking new dirent node obsolete\n")); + D1(printk(KERN_DEBUG "New dirent is \"%s\"->ino #%u. Old is \"%s\"->ino #%u\n", new->name, new->ino, (*prev)->name, (*prev)->ino)); + jffs2_mark_node_obsolete(c, new->raw); + jffs2_free_full_dirent(new); + } else { + D1(printk(KERN_DEBUG "Marking old dirent node (ino #%u) obsolete\n", (*prev)->ino)); + new->next = (*prev)->next; + jffs2_mark_node_obsolete(c, ((*prev)->raw)); + jffs2_free_full_dirent(*prev); + *prev = new; + } + goto out; + } + prev = &((*prev)->next); + } + new->next = *prev; + *prev = new; + + out: + D1(while(*list) { + printk(KERN_DEBUG "Dirent \"%s\" (hash 0x%08x, ino #%u\n", (*list)->name, (*list)->nhash, (*list)->ino); + list = &(*list)->next; + }); +} + +/* Put a new tmp_dnode_info into the list, keeping the list in + order of increasing version +*/ +void jffs2_add_tn_to_list(struct jffs2_tmp_dnode_info *tn, struct jffs2_tmp_dnode_info **list) +{ + struct jffs2_tmp_dnode_info **prev = list; + + while ((*prev) && (*prev)->version < tn->version) { + prev = &((*prev)->next); + } + tn->next = (*prev); + *prev = tn; +} + +static void jffs2_free_tmp_dnode_info_list(struct jffs2_tmp_dnode_info *tn) +{ + struct jffs2_tmp_dnode_info *next; + + while (tn) { + next = tn; + tn = tn->next; + jffs2_free_full_dnode(next->fn); + jffs2_free_tmp_dnode_info(next); + } +} + +static void jffs2_free_full_dirent_list(struct jffs2_full_dirent *fd) +{ + struct jffs2_full_dirent *next; + + while (fd) { + next = fd->next; + jffs2_free_full_dirent(fd); + fd = next; + } +} + + +/* Get tmp_dnode_info and full_dirent for all non-obsolete nodes associated + with this ino, returning the former in order of version */ + +int jffs2_get_inode_nodes(struct jffs2_sb_info *c, ino_t ino, struct jffs2_inode_info *f, + struct jffs2_tmp_dnode_info **tnp, struct jffs2_full_dirent **fdp, + uint32_t *highest_version) +{ + struct jffs2_raw_node_ref *ref = f->inocache->nodes; + struct jffs2_tmp_dnode_info *tn, *ret_tn = NULL; + struct jffs2_full_dirent *fd, *ret_fd = NULL; + + union jffs2_node_union node; + size_t retlen; + int err; + + D1(printk(KERN_DEBUG "jffs2_get_inode_nodes(): ino #%lu\n", ino)); + if (!f->inocache->nodes) { + printk(KERN_WARNING "Eep. no nodes for ino #%lu\n", ino); + } + for (ref = f->inocache->nodes; ref && ref->next_in_ino; ref = ref->next_in_ino) { + /* Work out whether it's a data node or a dirent node */ + if (ref->flash_offset & 1) { + /* FIXME: On NAND flash we may need to read these */ + D1(printk(KERN_DEBUG "node at 0x%08x is obsoleted. Ignoring.\n", ref->flash_offset &~3)); + continue; + } + err = jffs2_flash_read(c, (ref->flash_offset & ~3), min(ref->totlen, sizeof(node)), &retlen, (void *)&node); + if (err) { + printk(KERN_WARNING "error %d reading node at 0x%08x in get_inode_nodes()\n", err, (ref->flash_offset) & ~3); + goto free_out; + } + + + /* Check we've managed to read at least the common node header */ + if (retlen < min(ref->totlen, sizeof(node.u))) { + printk(KERN_WARNING "short read in get_inode_nodes()\n"); + err = -EIO; + goto free_out; + } + + switch (node.u.nodetype) { + case JFFS2_NODETYPE_DIRENT: + D1(printk(KERN_DEBUG "Node at %08x is a dirent node\n", ref->flash_offset &~3)); + if (retlen < sizeof(node.d)) { + printk(KERN_WARNING "short read in get_inode_nodes()\n"); + err = -EIO; + goto free_out; + } + if (node.d.version > *highest_version) + *highest_version = node.d.version; + if (ref->flash_offset & 1) { + /* Obsoleted */ + continue; + } + fd = jffs2_alloc_full_dirent(node.d.nsize+1); + if (!fd) { + err = -ENOMEM; + goto free_out; + } + memset(fd,0,sizeof(struct jffs2_full_dirent) + node.d.nsize+1); + fd->raw = ref; + fd->version = node.d.version; + fd->ino = node.d.ino; + fd->type = node.d.type; + /* memcpy as much of the name as possible from the raw + dirent we've already read from the flash + */ + if (retlen > sizeof(struct jffs2_raw_dirent)) + memcpy(&fd->name[0], &node.d.name[0], min((uint32_t)node.d.nsize, (retlen-sizeof(struct jffs2_raw_dirent)))); + + /* Do we need to copy any more of the name directly + from the flash? + */ + if (node.d.nsize + sizeof(struct jffs2_raw_dirent) > retlen) { + int already = retlen - sizeof(struct jffs2_raw_dirent); + + err = jffs2_flash_read(c, (ref->flash_offset & ~3) + retlen, + node.d.nsize - already, &retlen, &fd->name[already]); + if (!err && retlen != node.d.nsize - already) + err = -EIO; + + if (err) { + printk(KERN_WARNING "Read remainder of name in jffs2_get_inode_nodes(): error %d\n", err); + jffs2_free_full_dirent(fd); + goto free_out; + } + } + fd->nhash = full_name_hash(fd->name, node.d.nsize); + fd->next = NULL; + /* Wheee. We now have a complete jffs2_full_dirent structure, with + the name in it and everything. Link it into the list + */ + D1(printk(KERN_DEBUG "Adding fd \"%s\", ino #%u\n", fd->name, fd->ino)); + jffs2_add_fd_to_list(c, fd, &ret_fd); + break; + + case JFFS2_NODETYPE_INODE: + D1(printk(KERN_DEBUG "Node at %08x is a data node\n", ref->flash_offset &~3)); + if (retlen < sizeof(node.i)) { + printk(KERN_WARNING "read too short for dnode\n"); + err = -EIO; + goto free_out; + } + if (node.d.version > *highest_version) + *highest_version = node.i.version; + D1(printk(KERN_DEBUG "version %d, highest_version now %d\n", node.d.version, *highest_version)); + + if (ref->flash_offset & 1) { + D1(printk(KERN_DEBUG "obsoleted\n")); + /* Obsoleted */ + continue; + } + tn = jffs2_alloc_tmp_dnode_info(); + if (!tn) { + D1(printk(KERN_DEBUG "alloc tn failed\n")); + err = -ENOMEM; + goto free_out; + } + + tn->fn = jffs2_alloc_full_dnode(); + if (!tn->fn) { + D1(printk(KERN_DEBUG "alloc fn failed\n")); + err = -ENOMEM; + jffs2_free_tmp_dnode_info(tn); + goto free_out; + } + tn->version = node.i.version; + tn->fn->ofs = node.i.offset; + tn->fn->size = node.i.dsize; + tn->fn->raw = ref; + D1(printk(KERN_DEBUG "dnode @%08x: ver %u, offset %04x, dsize %04x\n", ref->flash_offset &~3, node.i.version, node.i.offset, node.i.dsize)); + jffs2_add_tn_to_list(tn, &ret_tn); + break; + + default: + switch(node.u.nodetype & JFFS2_COMPAT_MASK) { + case JFFS2_FEATURE_INCOMPAT: + printk(KERN_NOTICE "Unknown INCOMPAT nodetype %04X at %08X\n", node.u.nodetype, ref->flash_offset & ~3); + break; + case JFFS2_FEATURE_ROCOMPAT: + printk(KERN_NOTICE "Unknown ROCOMPAT nodetype %04X at %08X\n", node.u.nodetype, ref->flash_offset & ~3); + break; + case JFFS2_FEATURE_RWCOMPAT_COPY: + printk(KERN_NOTICE "Unknown RWCOMPAT_COPY nodetype %04X at %08X\n", node.u.nodetype, ref->flash_offset & ~3); + break; + case JFFS2_FEATURE_RWCOMPAT_DELETE: + printk(KERN_NOTICE "Unknown RWCOMPAT_DELETE nodetype %04X at %08X\n", node.u.nodetype, ref->flash_offset & ~3); + break; + } + } + } + *tnp = ret_tn; + *fdp = ret_fd; + return 0; + + free_out: + jffs2_free_tmp_dnode_info_list(ret_tn); + jffs2_free_full_dirent_list(ret_fd); + return err; +} + +struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, int ino) +{ + struct jffs2_inode_cache *ret; + + D2(printk(KERN_DEBUG "jffs2_get_ino_cache(): ino %u\n", ino)); + spin_lock (&c->inocache_lock); + ret = c->inocache_list[ino % INOCACHE_HASHSIZE]; + while (ret && ret->ino < ino) { + ret = ret->next; + } + + spin_unlock(&c->inocache_lock); + + if (ret && ret->ino != ino) + ret = NULL; + + D2(printk(KERN_DEBUG "jffs2_get_ino_cache found %p for ino %u\n", ret, ino)); + return ret; +} + +void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new) +{ + struct jffs2_inode_cache **prev; + D2(printk(KERN_DEBUG "jffs2_add_ino_cache: Add %p (ino #%u)\n", new, new->ino)); + spin_lock(&c->inocache_lock); + + prev = &c->inocache_list[new->ino % INOCACHE_HASHSIZE]; + + while ((*prev) && (*prev)->ino < new->ino) { + prev = &(*prev)->next; + } + new->next = *prev; + *prev = new; + spin_unlock(&c->inocache_lock); +} + +void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old) +{ + struct jffs2_inode_cache **prev; + D2(printk(KERN_DEBUG "jffs2_del_ino_cache: Del %p (ino #%u)\n", old, old->ino)); + spin_lock(&c->inocache_lock); + + prev = &c->inocache_list[old->ino % INOCACHE_HASHSIZE]; + + while ((*prev) && (*prev)->ino < old->ino) { + prev = &(*prev)->next; + } + if ((*prev) == old) { + *prev = old->next; + } + spin_unlock(&c->inocache_lock); +} + +void jffs2_free_ino_caches(struct jffs2_sb_info *c) +{ + int i; + struct jffs2_inode_cache *this, *next; + + for (i=0; iinocache_list[i]; + while (this) { + next = this->next; + D2(printk(KERN_DEBUG "jffs2_free_ino_caches: Freeing ino #%u at %p\n", this->ino, this)); + jffs2_free_inode_cache(this); + this = next; + } + c->inocache_list[i] = NULL; + } +} + +void jffs2_free_raw_node_refs(struct jffs2_sb_info *c) +{ + int i; + struct jffs2_raw_node_ref *this, *next; + + for (i=0; inr_blocks; i++) { + this = c->blocks[i].first_node; + while(this) { + next = this->next_phys; + jffs2_free_raw_node_ref(this); + this = next; + } + c->blocks[i].first_node = c->blocks[i].last_node = NULL; + } +} + diff --git a/packages/fs/jffs2/current/src/nodelist.h b/packages/fs/jffs2/current/src/nodelist.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/nodelist.h @@ -0,0 +1,327 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: nodelist.h,v 1.60 2002/01/24 00:45:11 dwmw2 Exp $ + * + */ + +#ifndef __JFFS2_NODELIST_H__ +#define __JFFS2_NODELIST_H__ + +#ifdef __ECOS +#include "jffs2port.h" +#include "jffs2.h" +#include "jffs2_fs_sb.h" +#include "jffs2_fs_i.h" +#include "os-ecos.h" +#else +#include +#include + +#include /* For min/max in older kernels */ +#include +#include +#include +#include "os-linux.h" +#endif + + +#ifndef CONFIG_JFFS2_FS_DEBUG +#define CONFIG_JFFS2_FS_DEBUG 2 +#endif + +#if CONFIG_JFFS2_FS_DEBUG > 0 +#define D1(x) x +#else +#define D1(x) +#endif + +#if CONFIG_JFFS2_FS_DEBUG > 1 +#define D2(x) x +#else +#define D2(x) +#endif + +/* + This is all we need to keep in-core for each raw node during normal + operation. As and when we do read_inode on a particular inode, we can + scan the nodes which are listed for it and build up a proper map of + which nodes are currently valid. JFFSv1 always used to keep that whole + map in core for each inode. +*/ +struct jffs2_raw_node_ref +{ + struct jffs2_raw_node_ref *next_in_ino; /* Points to the next raw_node_ref + for this inode. If this is the last, it points to the inode_cache + for this inode instead. The inode_cache will have NULL in the first + word so you know when you've got there :) */ + struct jffs2_raw_node_ref *next_phys; + // uint32_t ino; + uint32_t flash_offset; + uint32_t totlen; +// uint16_t nodetype; + + /* flash_offset & 3 always has to be zero, because nodes are + always aligned at 4 bytes. So we have a couple of extra bits + to play with. So we set the least significant bit to 1 to + signify that the node is obsoleted by later nodes. + */ +}; + +/* + Used for keeping track of deletion nodes &c, which can only be marked + as obsolete when the node which they mark as deleted has actually been + removed from the flash. +*/ +struct jffs2_raw_node_ref_list { + struct jffs2_raw_node_ref *rew; + struct jffs2_raw_node_ref_list *next; +}; + +/* For each inode in the filesystem, we need to keep a record of + nlink, because it would be a PITA to scan the whole directory tree + at read_inode() time to calculate it, and to keep sufficient information + in the raw_node_ref (basically both parent and child inode number for + dirent nodes) would take more space than this does. We also keep + a pointer to the first physical node which is part of this inode, too. +*/ +struct jffs2_inode_cache { + struct jffs2_scan_info *scan; /* Used during scan to hold + temporary lists of nodes, and later must be set to + NULL to mark the end of the raw_node_ref->next_in_ino + chain. */ + struct jffs2_inode_cache *next; + struct jffs2_raw_node_ref *nodes; + uint32_t ino; + int nlink; +}; + +struct jffs2_scan_info { + struct jffs2_full_dirent *dents; + struct jffs2_tmp_dnode_info *tmpnodes; +}; +/* + Larger representation of a raw node, kept in-core only when the + struct inode for this particular ino is instantiated. +*/ + +struct jffs2_full_dnode +{ + struct jffs2_raw_node_ref *raw; + uint32_t ofs; /* Don't really need this, but optimisation */ + uint32_t size; + uint32_t frags; /* Number of fragments which currently refer + to this node. When this reaches zero, + the node is obsolete. + */ +}; + +/* + Even larger representation of a raw node, kept in-core only while + we're actually building up the original map of which nodes go where, + in read_inode() +*/ +struct jffs2_tmp_dnode_info +{ + struct jffs2_tmp_dnode_info *next; + struct jffs2_full_dnode *fn; + uint32_t version; +}; + +struct jffs2_full_dirent +{ + struct jffs2_raw_node_ref *raw; + struct jffs2_full_dirent *next; + uint32_t version; + uint32_t ino; /* == zero for unlink */ + unsigned int nhash; + unsigned char type; + unsigned char name[0]; +}; +/* + Fragments - used to build a map of which raw node to obtain + data from for each part of the ino +*/ +struct jffs2_node_frag +{ + struct jffs2_node_frag *next; + struct jffs2_full_dnode *node; /* NULL for holes */ + uint32_t size; + uint32_t ofs; /* Don't really need this, but optimisation */ + uint32_t node_ofs; /* offset within the physical node */ +}; + +struct jffs2_eraseblock +{ + struct list_head list; + int bad_count; + uint32_t offset; /* of this block in the MTD */ + + uint32_t used_size; + uint32_t dirty_size; + uint32_t free_size; /* Note that sector_size - free_size + is the address of the first free space */ + struct jffs2_raw_node_ref *first_node; + struct jffs2_raw_node_ref *last_node; + + struct jffs2_raw_node_ref *gc_node; /* Next node to be garbage collected */ + + /* For deletia. When a dirent node in this eraseblock is + deleted by a node elsewhere, that other node can only + be marked as obsolete when this block is actually erased. + So we keep a list of the nodes to mark as obsolete when + the erase is completed. + */ + // MAYBE struct jffs2_raw_node_ref_list *deletia; +}; + +#define ACCT_SANITY_CHECK(c, jeb) do { \ + if (jeb->used_size + jeb->dirty_size + jeb->free_size != c->sector_size) { \ + printk(KERN_NOTICE "Eeep. Space accounting for block at 0x%08x is screwed\n", jeb->offset); \ + printk(KERN_NOTICE "free 0x%08x + dirty 0x%08x + used %08x != total %08x\n", \ + jeb->free_size, jeb->dirty_size, jeb->used_size, c->sector_size); \ + BUG(); \ + } \ + if (c->used_size + c->dirty_size + c->free_size + c->erasing_size + c->bad_size != c->flash_size) { \ + printk(KERN_NOTICE "Eeep. Space accounting superblock info is screwed\n"); \ + printk(KERN_NOTICE "free 0x%08x + dirty 0x%08x + used %08x + erasing %08x + bad %08x != total %08x\n", \ + c->free_size, c->dirty_size, c->used_size, c->erasing_size, c->bad_size, c->flash_size); \ + BUG(); \ + } \ +} while(0) + +#define ACCT_PARANOIA_CHECK(jeb) do { \ + uint32_t my_used_size = 0; \ + struct jffs2_raw_node_ref *ref2 = jeb->first_node; \ + while (ref2) { \ + if (!(ref2->flash_offset & 1)) \ + my_used_size += ref2->totlen; \ + ref2 = ref2->next_phys; \ + } \ + if (my_used_size != jeb->used_size) { \ + printk(KERN_NOTICE "Calculated used size %08x != stored used size %08x\n", my_used_size, jeb->used_size); \ + BUG(); \ + } \ + } while(0) + +#define ALLOC_NORMAL 0 /* Normal allocation */ +#define ALLOC_DELETION 1 /* Deletion node. Best to allow it */ +#define ALLOC_GC 2 /* Space requested for GC. Give it or die */ + +#define JFFS2_RESERVED_BLOCKS_BASE 3 /* Number of free blocks there must be before we... */ +#define JFFS2_RESERVED_BLOCKS_WRITE (JFFS2_RESERVED_BLOCKS_BASE + 2) /* ... allow a normal filesystem write */ +#define JFFS2_RESERVED_BLOCKS_DELETION (JFFS2_RESERVED_BLOCKS_BASE + 1) /* ... allow a normal filesystem deletion */ +#define JFFS2_RESERVED_BLOCKS_GCTRIGGER (JFFS2_RESERVED_BLOCKS_BASE + 3) /* ... wake up the GC thread */ +#define JFFS2_RESERVED_BLOCKS_GCBAD (JFFS2_RESERVED_BLOCKS_BASE + 1) /* ... pick a block from the bad_list to GC */ +#define JFFS2_RESERVED_BLOCKS_GCMERGE (JFFS2_RESERVED_BLOCKS_BASE) /* ... merge pages when garbage collecting */ + + +#define PAD(x) (((x)+3)&~3) + +static inline int jffs2_raw_ref_to_inum(struct jffs2_raw_node_ref *raw) +{ + while(raw->next_in_ino) { + raw = raw->next_in_ino; + } + + return ((struct jffs2_inode_cache *)raw)->ino; +} + +/* nodelist.c */ +D1(void jffs2_print_frag_list(struct jffs2_inode_info *f)); +void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list); +void jffs2_add_tn_to_list(struct jffs2_tmp_dnode_info *tn, struct jffs2_tmp_dnode_info **list); +int jffs2_get_inode_nodes(struct jffs2_sb_info *c, ino_t ino, struct jffs2_inode_info *f, + struct jffs2_tmp_dnode_info **tnp, struct jffs2_full_dirent **fdp, + uint32_t *highest_version); +struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, int ino); +void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new); +void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old); +void jffs2_free_ino_caches(struct jffs2_sb_info *c); +void jffs2_free_raw_node_refs(struct jffs2_sb_info *c); + +/* nodemgmt.c */ +int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len, int prio); +int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len); +int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new, uint32_t len, int dirty); +void jffs2_complete_reservation(struct jffs2_sb_info *c); +void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *raw); + +/* write.c */ +struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_inode *ri); +struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const unsigned char *data, uint32_t datalen, uint32_t flash_ofs, uint32_t *writelen); +struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_dirent *rd, const unsigned char *name, uint32_t namelen, uint32_t flash_ofs, uint32_t *writelen); +int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, + struct jffs2_raw_inode *ri, unsigned char *buf, + uint32_t offset, uint32_t writelen, uint32_t *retlen); +int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const char *name, int namelen); +int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, const char *name, int namelen, struct jffs2_inode_info *dead_f); +int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint32_t ino, uint8_t type, const char *name, int namelen); + + +/* readinode.c */ +void jffs2_truncate_fraglist (struct jffs2_sb_info *c, struct jffs2_node_frag **list, uint32_t size); +int jffs2_add_full_dnode_to_fraglist(struct jffs2_sb_info *c, struct jffs2_node_frag **list, struct jffs2_full_dnode *fn); +int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn); +void jffs2_read_inode (struct inode *); +int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, + uint32_t ino, struct jffs2_raw_inode *latest_node); +void jffs2_clear_inode (struct inode *); +void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f); + +/* malloc.c */ +int jffs2_create_slab_caches(void); +void jffs2_destroy_slab_caches(void); + +struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize); +void jffs2_free_full_dirent(struct jffs2_full_dirent *); +struct jffs2_full_dnode *jffs2_alloc_full_dnode(void); +void jffs2_free_full_dnode(struct jffs2_full_dnode *); +struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void); +void jffs2_free_raw_dirent(struct jffs2_raw_dirent *); +struct jffs2_raw_inode *jffs2_alloc_raw_inode(void); +void jffs2_free_raw_inode(struct jffs2_raw_inode *); +struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void); +void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *); +struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void); +void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *); +struct jffs2_node_frag *jffs2_alloc_node_frag(void); +void jffs2_free_node_frag(struct jffs2_node_frag *); +struct jffs2_inode_cache *jffs2_alloc_inode_cache(void); +void jffs2_free_inode_cache(struct jffs2_inode_cache *); + +/* gc.c */ +int jffs2_garbage_collect_pass(struct jffs2_sb_info *c); + +/* read.c */ +int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_full_dnode *fd, unsigned char *buf, int ofs, int len); +int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, + unsigned char *buf, uint32_t offset, uint32_t len); +char *jffs2_getlink(struct jffs2_sb_info *c, struct jffs2_inode_info *f); + + +/* compr.c */ +unsigned char jffs2_compress(unsigned char *data_in, unsigned char *cpage_out, + uint32_t *datalen, uint32_t *cdatalen); +int jffs2_decompress(unsigned char comprtype, unsigned char *cdata_in, + unsigned char *data_out, uint32_t cdatalen, uint32_t datalen); + +/* scan.c */ +int jffs2_scan_medium(struct jffs2_sb_info *c); + +/* build.c */ +int jffs2_do_mount_fs(struct jffs2_sb_info *c); + +/* erase.c */ +void jffs2_erase_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); +void jffs2_erase_pending_blocks(struct jffs2_sb_info *c); +void jffs2_mark_erased_blocks(struct jffs2_sb_info *c); +void jffs2_erase_pending_trigger(struct jffs2_sb_info *c); + +#endif /* __JFFS2_NODELIST_H__ */ diff --git a/packages/fs/jffs2/current/src/nodemgmt.c b/packages/fs/jffs2/current/src/nodemgmt.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/nodemgmt.c @@ -0,0 +1,367 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: nodemgmt.c,v 1.52 2002/01/19 23:16:41 dwmw2 Exp $ + * + */ + +#ifndef __ECOS +#include +#include +#include +#include +#endif +#include "nodelist.h" + +/** + * jffs2_reserve_space - request physical space to write nodes to flash + * @c: superblock info + * @minsize: Minimum acceptable size of allocation + * @ofs: Returned value of node offset + * @len: Returned value of allocation length + * @prio: Allocation type - ALLOC_{NORMAL,DELETION} + * + * Requests a block of physical space on the flash. Returns zero for success + * and puts 'ofs' and 'len' into the appriopriate place, or returns -ENOSPC + * or other error if appropriate. + * + * If it returns zero, jffs2_reserve_space() also downs the per-filesystem + * allocation semaphore, to prevent more than one allocation from being + * active at any time. The semaphore is later released by jffs2_commit_allocation() + * + * jffs2_reserve_space() may trigger garbage collection in order to make room + * for the requested allocation. + */ + +static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len); + +int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len, int prio) +{ + int ret = -EAGAIN; + int blocksneeded = JFFS2_RESERVED_BLOCKS_WRITE; + /* align it */ + minsize = PAD(minsize); + + if (prio == ALLOC_DELETION) + blocksneeded = JFFS2_RESERVED_BLOCKS_DELETION; + + D1(printk(KERN_DEBUG "jffs2_reserve_space(): Requested 0x%x bytes\n", minsize)); + down(&c->alloc_sem); + + D1(printk(KERN_DEBUG "jffs2_reserve_space(): alloc sem got\n")); + + spin_lock_bh(&c->erase_completion_lock); + + /* this needs a little more thought */ + while(ret == -EAGAIN) { + while(c->nr_free_blocks + c->nr_erasing_blocks < blocksneeded) { + int ret; + + up(&c->alloc_sem); + if (c->dirty_size < c->sector_size) { + D1(printk(KERN_DEBUG "Short on space, but total dirty size 0x%08x < sector size 0x%08x, so -ENOSPC\n", c->dirty_size, c->sector_size)); + spin_unlock_bh(&c->erase_completion_lock); + return -ENOSPC; + } + D1(printk(KERN_DEBUG "Triggering GC pass. nr_free_blocks %d, nr_erasing_blocks %d, free_size 0x%08x, dirty_size 0x%08x, used_size 0x%08x, erasing_size 0x%08x, bad_size 0x%08x (total 0x%08x of 0x%08x)\n", + c->nr_free_blocks, c->nr_erasing_blocks, c->free_size, c->dirty_size, c->used_size, c->erasing_size, c->bad_size, + c->free_size + c->dirty_size + c->used_size + c->erasing_size + c->bad_size, c->flash_size)); + spin_unlock_bh(&c->erase_completion_lock); + + ret = jffs2_garbage_collect_pass(c); + if (ret) + return ret; +#ifndef __ECOS + if (current->need_resched) + schedule(); + + if (signal_pending(current)) + return -EINTR; +#endif + down(&c->alloc_sem); + spin_lock_bh(&c->erase_completion_lock); + } + + ret = jffs2_do_reserve_space(c, minsize, ofs, len); + if (ret) { + D1(printk(KERN_DEBUG "jffs2_reserve_space: ret is %d\n", ret)); + } + } + spin_unlock_bh(&c->erase_completion_lock); + if (ret) + up(&c->alloc_sem); + return ret; +} + +int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len) +{ + int ret = -EAGAIN; + minsize = PAD(minsize); + + D1(printk(KERN_DEBUG "jffs2_reserve_space_gc(): Requested 0x%x bytes\n", minsize)); + + spin_lock_bh(&c->erase_completion_lock); + while(ret == -EAGAIN) { + ret = jffs2_do_reserve_space(c, minsize, ofs, len); + if (ret) { + D1(printk(KERN_DEBUG "jffs2_reserve_space_gc: looping, ret is %d\n", ret)); + } + } + spin_unlock_bh(&c->erase_completion_lock); + return ret; +} + +/* Called with alloc sem _and_ erase_completion_lock */ +static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len) +{ + struct jffs2_eraseblock *jeb = c->nextblock; + + restart: + if (jeb && minsize > jeb->free_size) { + /* Skip the end of this block and file it as having some dirty space */ + c->dirty_size += jeb->free_size; + c->free_size -= jeb->free_size; + jeb->dirty_size += jeb->free_size; + jeb->free_size = 0; + D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to dirty_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n", + jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); + list_add_tail(&jeb->list, &c->dirty_list); + c->nextblock = jeb = NULL; + } + + if (!jeb) { + struct list_head *next; + /* Take the next block off the 'free' list */ + + if (list_empty(&c->free_list)) { + + DECLARE_WAITQUEUE(wait, current); + + if (!c->nr_erasing_blocks) { +// if (list_empty(&c->erasing_list) && list_empty(&c->erase_pending_list) && list_empty(c->erase_complete_list)) { + /* Ouch. We're in GC, or we wouldn't have got here. + And there's no space left. At all. */ + printk(KERN_CRIT "Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasingempty: %s, erasependingempty: %s)\n", + c->nr_erasing_blocks, c->nr_free_blocks, list_empty(&c->erasing_list)?"yes":"no", list_empty(&c->erase_pending_list)?"yes":"no"); + return -ENOSPC; + } + /* Make sure this can't deadlock. Someone has to start the erases + of erase_pending blocks */ +#ifdef __ECOS + /* In eCos, we don't have a handy kernel thread doing the erases for + us. We do them ourselves right now. */ + jffs2_erase_pending_blocks(c); + jffs2_mark_erased_blocks(c); +#else + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&c->erase_wait, &wait); + D1(printk(KERN_DEBUG "Waiting for erases to complete. erasing_blocks is %d. (erasingempty: %s, erasependingempty: %s)\n", + c->nr_erasing_blocks, list_empty(&c->erasing_list)?"yes":"no", list_empty(&c->erase_pending_list)?"yes":"no")); + if (!list_empty(&c->erase_pending_list)) { + D1(printk(KERN_DEBUG "Triggering pending erases\n")); + jffs2_erase_pending_trigger(c); + } + spin_unlock_bh(&c->erase_completion_lock); + schedule(); + remove_wait_queue(&c->erase_wait, &wait); + spin_lock_bh(&c->erase_completion_lock); + if (signal_pending(current)) { + return -EINTR; + } +#endif + /* An erase may have failed, decreasing the + amount of free space available. So we must + restart from the beginning */ + return -EAGAIN; + } + + next = c->free_list.next; + list_del(next); + c->nextblock = jeb = list_entry(next, struct jffs2_eraseblock, list); + c->nr_free_blocks--; + if (jeb->free_size != c->sector_size - sizeof(struct jffs2_unknown_node)) { + printk(KERN_WARNING "Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\n", jeb->offset, jeb->free_size); + goto restart; + } + } + /* OK, jeb (==c->nextblock) is now pointing at a block which definitely has + enough space */ + *ofs = jeb->offset + (c->sector_size - jeb->free_size); + *len = jeb->free_size; + D1(printk(KERN_DEBUG "jffs2_do_reserve_space(): Giving 0x%x bytes at 0x%x\n", *len, *ofs)); + return 0; +} + +/** + * jffs2_add_physical_node_ref - add a physical node reference to the list + * @c: superblock info + * @ofs: physical location of this physical node + * @len: length of this physical node + * @ino: inode number with which this physical node is associated + * + * Should only be used to report nodes for which space has been allocated + * by jffs2_reserve_space. + * + * Must be called with the alloc_sem held. + */ + +int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new, uint32_t len, int dirty) +{ + struct jffs2_eraseblock *jeb; + + len = PAD(len); + jeb = &c->blocks[(new->flash_offset & ~3) / c->sector_size]; + D1(printk(KERN_DEBUG "jffs2_add_physical_node_ref(): Node at 0x%x, size 0x%x\n", new->flash_offset & ~3, len)); +#if 1 + if (jeb != c->nextblock || (new->flash_offset & ~3) != jeb->offset + (c->sector_size - jeb->free_size)) { + printk(KERN_WARNING "argh. node added in wrong place\n"); + jffs2_free_raw_node_ref(new); + return -EINVAL; + } +#endif + if (!jeb->first_node) + jeb->first_node = new; + if (jeb->last_node) + jeb->last_node->next_phys = new; + jeb->last_node = new; + + spin_lock_bh(&c->erase_completion_lock); + jeb->free_size -= len; + c->free_size -= len; + if (dirty) { + new->flash_offset |= 1; + jeb->dirty_size += len; + c->dirty_size += len; + } else { + jeb->used_size += len; + c->used_size += len; + } + spin_unlock_bh(&c->erase_completion_lock); + if (!jeb->free_size && !jeb->dirty_size) { + /* If it lives on the dirty_list, jffs2_reserve_space will put it there */ + D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n", + jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); + list_add_tail(&jeb->list, &c->clean_list); + c->nextblock = NULL; + } + ACCT_SANITY_CHECK(c,jeb); + ACCT_PARANOIA_CHECK(jeb); + + return 0; +} + + +void jffs2_complete_reservation(struct jffs2_sb_info *c) +{ + D1(printk(KERN_DEBUG "jffs2_complete_reservation()\n")); + jffs2_garbage_collect_trigger(c); + up(&c->alloc_sem); +} + +void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref) +{ + struct jffs2_eraseblock *jeb; + int blocknr; + struct jffs2_unknown_node n; + int ret; + size_t retlen; + + if(!ref) { + printk(KERN_NOTICE "EEEEEK. jffs2_mark_node_obsolete called with NULL node\n"); + return; + } + if (ref->flash_offset & 1) { + D1(printk(KERN_DEBUG "jffs2_mark_node_obsolete called with already obsolete node at 0x%08x\n", ref->flash_offset &~3)); + return; + } + blocknr = ref->flash_offset / c->sector_size; + if (blocknr >= c->nr_blocks) { + printk(KERN_NOTICE "raw node at 0x%08x is off the end of device!\n", ref->flash_offset); + BUG(); + } + jeb = &c->blocks[blocknr]; + if (jeb->used_size < ref->totlen) { + printk(KERN_NOTICE "raw node of size 0x%08x freed from erase block %d at 0x%08x, but used_size was already 0x%08x\n", + ref->totlen, blocknr, ref->flash_offset, jeb->used_size); + BUG(); + } + + spin_lock_bh(&c->erase_completion_lock); + jeb->used_size -= ref->totlen; + jeb->dirty_size += ref->totlen; + c->used_size -= ref->totlen; + c->dirty_size += ref->totlen; + ref->flash_offset |= 1; + + ACCT_SANITY_CHECK(c, jeb); + + ACCT_PARANOIA_CHECK(jeb); + + if (jeb == c->nextblock) { + D2(printk(KERN_DEBUG "Not moving nextblock 0x%08x to dirty/erase_pending list\n", jeb->offset)); + } else if (jeb == c->gcblock) { + D2(printk(KERN_DEBUG "Not moving gcblock 0x%08x to dirty/erase_pending list\n", jeb->offset)); +#if 0 /* We no longer do this here. It can screw the wear levelling. If you have a lot of static + data and a few blocks free, and you just create new files and keep deleting/overwriting + them, then you'd keep erasing and reusing those blocks without ever moving stuff around. + So we leave completely obsoleted blocks on the dirty_list and let the GC delete them + when it finds them there. That way, we still get the 'once in a while, take a clean block' + to spread out the flash usage */ + } else if (!jeb->used_size) { + D1(printk(KERN_DEBUG "Eraseblock at 0x%08x completely dirtied. Removing from (dirty?) list...\n", jeb->offset)); + list_del(&jeb->list); + D1(printk(KERN_DEBUG "...and adding to erase_pending_list\n")); + list_add_tail(&jeb->list, &c->erase_pending_list); + c->nr_erasing_blocks++; + jffs2_erase_pending_trigger(c); + // OFNI_BS_2SFFJ(c)->s_dirt = 1; + D1(printk(KERN_DEBUG "Done OK\n")); +#endif + } else if (jeb->dirty_size == ref->totlen) { + D1(printk(KERN_DEBUG "Eraseblock at 0x%08x is freshly dirtied. Removing from clean list...\n", jeb->offset)); + list_del(&jeb->list); + D1(printk(KERN_DEBUG "...and adding to dirty_list\n")); + list_add_tail(&jeb->list, &c->dirty_list); + } + spin_unlock_bh(&c->erase_completion_lock); + + if (!jffs2_can_mark_obsolete(c)) + return; + if (jffs2_is_readonly(c)) + return; + + D1(printk(KERN_DEBUG "obliterating obsoleted node at 0x%08x\n", ref->flash_offset &~3)); + ret = jffs2_flash_read(c, ref->flash_offset &~3, sizeof(n), &retlen, (char *)&n); + if (ret) { + printk(KERN_WARNING "Read error reading from obsoleted node at 0x%08x: %d\n", ref->flash_offset &~3, ret); + return; + } + if (retlen != sizeof(n)) { + printk(KERN_WARNING "Short read from obsoleted node at 0x%08x: %d\n", ref->flash_offset &~3, retlen); + return; + } + if (PAD(n.totlen) != PAD(ref->totlen)) { + printk(KERN_WARNING "Node totlen on flash (0x%08x) != totlen in node ref (0x%08x)\n", n.totlen, ref->totlen); + return; + } + if (!(n.nodetype & JFFS2_NODE_ACCURATE)) { + D1(printk(KERN_DEBUG "Node at 0x%08x was already marked obsolete (nodetype 0x%04x\n", ref->flash_offset &~3, n.nodetype)); + return; + } + n.nodetype &= ~JFFS2_NODE_ACCURATE; + ret = jffs2_flash_write(c, ref->flash_offset&~3, sizeof(n), &retlen, (char *)&n); + if (ret) { + printk(KERN_WARNING "Write error in obliterating obsoleted node at 0x%08x: %d\n", ref->flash_offset &~3, ret); + return; + } + if (retlen != sizeof(n)) { + printk(KERN_WARNING "Short write in obliterating obsoleted node at 0x%08x: %d\n", ref->flash_offset &~3, retlen); + return; + } +} diff --git a/packages/fs/jffs2/current/src/os-ecos.h b/packages/fs/jffs2/current/src/os-ecos.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/os-ecos.h @@ -0,0 +1,135 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id$ + * + */ + +#ifndef __JFFS2_OS_ECOS_H__ +#define __JFFS2_OS_ECOS_H__ + +#include + +#define CONFIG_JFFS2_FS_DEBUG 0 + + /* Read-only operation not currently implemented on eCos */ +#define jffs2_is_readonly(c) (0) + +/* NAND flash not currently supported on eCos */ +#define jffs2_can_mark_obsolete(c) (1) + +#define JFFS2_INODE_INFO(i) (&(i)->jffs2_i) +#define OFNI_EDONI_2SFFJ(f) ((struct inode *) ( ((char *)f) - ((char *)(&((struct inode *)NULL)->jffs2_i)) ) ) + +#define JFFS2_F_I_SIZE(f) (OFNI_EDONI_2SFFJ(f)->i_size) +#define JFFS2_F_I_MODE(f) (OFNI_EDONI_2SFFJ(f)->i_mode) +#define JFFS2_F_I_UID(f) (OFNI_EDONI_2SFFJ(f)->i_uid) +#define JFFS2_F_I_GID(f) (OFNI_EDONI_2SFFJ(f)->i_gid) +#define JFFS2_F_I_CTIME(f) (OFNI_EDONI_2SFFJ(f)->i_ctime) +#define JFFS2_F_I_MTIME(f) (OFNI_EDONI_2SFFJ(f)->i_mtime) +#define JFFS2_F_I_ATIME(f) (OFNI_EDONI_2SFFJ(f)->i_atime) + +/* FIXME: eCos doesn't hav a concept of device major/minor numbers */ +#define JFFS2_F_I_RDEV_MIN(f) (MINOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev))) +#define JFFS2_F_I_RDEV_MAJ(f) (MAJOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev))) + +struct inode { + //struct list_head i_hash; + //struct list_head i_list; + struct list_head i_dentry; + + cyg_uint32 i_ino; + atomic_t i_count; + //kdev_t i_dev; + mode_t i_mode; + nlink_t i_nlink; + uid_t i_uid; + gid_t i_gid; + kdev_t i_rdev; + off_t i_size; + time_t i_atime; + time_t i_mtime; + time_t i_ctime; + unsigned long i_blksize; + unsigned long i_blocks; + //unsigned long i_version; + //struct semaphore i_sem; + //struct semaphore i_zombie; + struct inode_operations *i_op; + struct file_operations *i_fop; // former ->i_op->default_file_ops + struct super_block *i_sb; + //wait_queue_head_t i_wait; + //struct file_lock *i_flock; + //struct address_space *i_mapping; + //struct address_space i_data; + //struct dquot *i_dquot[MAXQUOTAS]; + //struct pipe_inode_info *i_pipe; + //struct block_device *i_bdev; + + //unsigned long i_state; + + unsigned int i_flags; + //unsigned char i_sock; + + atomic_t i_writecount; + //unsigned int i_attr_flags; + //uint32_t i_generation; + struct jffs2_inode_info jffs2_i; + + struct inode *i_parent; + + struct inode *i_cache_prev; + struct inode *i_cache_next; +}; + +#define JFFS2_SB_INFO(sb) (&(sb)->jffs2_sb) + +#define OFNI_BS_2SFFJ(c) ((struct super_block *) ( ((char *)c) - ((char *)(&((struct super_block *)NULL)->jffs2_sb)) ) ) + +struct super_block { + unsigned long s_blocksize; + unsigned char s_blocksize_bits; + unsigned char s_dirt; + //struct super_operations *s_op; + unsigned long s_flags; + unsigned long s_magic; + //struct dentry *s_root; + struct inode *s_root; + struct jffs2_sb_info jffs2_sb; + unsigned long s_mount_count; + cyg_io_handle_t s_dev; +}; + +/* background.c */ +static inline void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) +{ + /* We don't have a GC thread in eCos (yet) */ +} + +/* dir.c */ +extern struct file_operations jffs2_dir_operations; +extern struct inode_operations jffs2_dir_inode_operations; + +/* file.c */ +extern struct file_operations jffs2_file_operations; +extern struct inode_operations jffs2_file_inode_operations; +extern struct address_space_operations jffs2_file_address_operations; +int jffs2_null_fsync(struct file *, struct dentry *, int); +int jffs2_setattr (struct dentry *dentry, struct iattr *iattr); +int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg); +int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); +//int jffs2_readpage (struct file *, struct page *); +int jffs2_readpage (struct inode *d_inode, struct page *pg); +//int jffs2_prepare_write (struct file *, struct page *, unsigned, unsigned); +int jffs2_prepare_write (struct inode *d_inode, struct page *pg, unsigned start, unsigned end); +//int jffs2_commit_write (struct file *, struct page *, unsigned, unsigned); +int jffs2_commit_write (struct inode *d_inode, struct page *pg, unsigned start, unsigned end); + + +#endif /* __JFFS2_OS_ECOS_H__ */ diff --git a/packages/fs/jffs2/current/src/pushpull.h b/packages/fs/jffs2/current/src/pushpull.h new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/pushpull.h @@ -0,0 +1,76 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: pushpull.h,v 1.6 2002/01/25 01:49:26 dwmw2 Exp $ + * + */ + +#ifndef __PUSHPULL_H__ +#define __PUSHPULL_H__ + +#ifndef __ECOS +#include +#else +#include +#endif + +struct pushpull { + unsigned char *buf; + unsigned int buflen; + unsigned int ofs; + unsigned int reserve; +}; + + +static inline void init_pushpull(struct pushpull *pp, char *buf, unsigned buflen, unsigned ofs, unsigned reserve) +{ + pp->buf = buf; + pp->buflen = buflen; + pp->ofs = ofs; + pp->reserve = reserve; +} + +static inline int pushbit(struct pushpull *pp, int bit, int use_reserved) +{ + if (pp->ofs >= pp->buflen - (use_reserved?0:pp->reserve)) { + return -ENOSPC; + } + + if (bit) { + pp->buf[pp->ofs >> 3] |= (1<<(7-(pp->ofs &7))); + } + else { + pp->buf[pp->ofs >> 3] &= ~(1<<(7-(pp->ofs &7))); + } + pp->ofs++; + + return 0; +} + +static inline int pushedbits(struct pushpull *pp) +{ + return pp->ofs; +} + +static inline int pullbit(struct pushpull *pp) +{ + int bit; + + bit = (pp->buf[pp->ofs >> 3] >> (7-(pp->ofs & 7))) & 1; + + pp->ofs++; + return bit; +} + +static inline int pulledbits(struct pushpull *pp) +{ + return pp->ofs; +} + +#endif /* __PUSHPULL_H__ */ diff --git a/packages/fs/jffs2/current/src/read.c b/packages/fs/jffs2/current/src/read.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/read.c @@ -0,0 +1,226 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: read.c,v 1.19 2002/01/14 23:30:26 dwmw2 Exp $ + * + */ + +#ifndef __ECOS +#include +#include +#include +#endif +#include "nodelist.h" +#include "crc32.h" + +int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_full_dnode *fd, unsigned char *buf, int ofs, int len) +{ + struct jffs2_raw_inode *ri; + size_t readlen; + uint32_t crc; + unsigned char *decomprbuf = NULL; + unsigned char *readbuf = NULL; + int ret = 0; + + ri = jffs2_alloc_raw_inode(); + if (!ri) + return -ENOMEM; + + ret = jffs2_flash_read(c, fd->raw->flash_offset & ~3, sizeof(*ri), &readlen, (char *)ri); + if (ret) { + jffs2_free_raw_inode(ri); + printk(KERN_WARNING "Error reading node from 0x%08x: %d\n", fd->raw->flash_offset & ~3, ret); + return ret; + } + if (readlen != sizeof(*ri)) { + jffs2_free_raw_inode(ri); + printk(KERN_WARNING "Short read from 0x%08x: wanted 0x%x bytes, got 0x%x\n", + fd->raw->flash_offset & ~3, sizeof(*ri), readlen); + return -EIO; + } + crc = crc32(0, ri, sizeof(*ri)-8); + + D1(printk(KERN_DEBUG "Node read from %08x: node_crc %08x, calculated CRC %08x. dsize %x, csize %x, offset %x, buf %p\n", fd->raw->flash_offset & ~3, ri->node_crc, crc, ri->dsize, ri->csize, ri->offset, buf)); + if (crc != ri->node_crc) { + printk(KERN_WARNING "Node CRC %08x != calculated CRC %08x for node at %08x\n", ri->node_crc, crc, fd->raw->flash_offset & ~3); + ret = -EIO; + goto out_ri; + } + + D1(if(ofs + len > ri->dsize) { + printk(KERN_WARNING "jffs2_read_dnode() asked for %d bytes at %d from %d-byte node\n", len, ofs, ri->dsize); + ret = -EINVAL; + goto out_ri; + }); + + + if (ri->compr == JFFS2_COMPR_ZERO) { + memset(buf, 0, len); + goto out_ri; + } + + /* Cases: + Reading whole node and it's uncompressed - read directly to buffer provided, check CRC. + Reading whole node and it's compressed - read into comprbuf, check CRC and decompress to buffer provided + Reading partial node and it's uncompressed - read into readbuf, check CRC, and copy + Reading partial node and it's compressed - read into readbuf, check checksum, decompress to decomprbuf and copy + */ + if (ri->compr == JFFS2_COMPR_NONE && len == ri->dsize) { + readbuf = buf; + } else { + readbuf = kmalloc(ri->csize, GFP_KERNEL); + if (!readbuf) { + ret = -ENOMEM; + goto out_ri; + } + } + if (ri->compr != JFFS2_COMPR_NONE) { + if (len < ri->dsize) { + decomprbuf = kmalloc(ri->dsize, GFP_KERNEL); + if (!decomprbuf) { + ret = -ENOMEM; + goto out_readbuf; + } + } else { + decomprbuf = buf; + } + } else { + decomprbuf = readbuf; + } + + D2(printk(KERN_DEBUG "Read %d bytes to %p\n", ri->csize, readbuf)); + ret = jffs2_flash_read(c, (fd->raw->flash_offset &~3) + sizeof(*ri), ri->csize, &readlen, readbuf); + + if (!ret && readlen != ri->csize) + ret = -EIO; + if (ret) + goto out_decomprbuf; + + crc = crc32(0, readbuf, ri->csize); + if (crc != ri->data_crc) { + printk(KERN_WARNING "Data CRC %08x != calculated CRC %08x for node at %08x\n", ri->data_crc, crc, fd->raw->flash_offset & ~3); + ret = -EIO; + goto out_decomprbuf; + } + D2(printk(KERN_DEBUG "Data CRC matches calculated CRC %08x\n", crc)); + if (ri->compr != JFFS2_COMPR_NONE) { + D2(printk(KERN_DEBUG "Decompress %d bytes from %p to %d bytes at %p\n", ri->csize, readbuf, ri->dsize, decomprbuf)); + ret = jffs2_decompress(ri->compr, readbuf, decomprbuf, ri->csize, ri->dsize); + if (ret) { + printk(KERN_WARNING "Error: jffs2_decompress returned %d\n", ret); + goto out_decomprbuf; + } + } + + if (len < ri->dsize) { + memcpy(buf, decomprbuf+ofs, len); + } + out_decomprbuf: + if(decomprbuf != buf && decomprbuf != readbuf) + kfree(decomprbuf); + out_readbuf: + if(readbuf != buf) + kfree(readbuf); + out_ri: + jffs2_free_raw_inode(ri); + + return ret; +} + +int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, + unsigned char *buf, uint32_t offset, uint32_t len) +{ + uint32_t end = offset + len; + struct jffs2_node_frag *frag = f->fraglist; + int ret; + + D1(printk(KERN_DEBUG "jffs2_read_inode_range: ino #%u, range 0x%08x-0x%08x\n", + f->inocache->ino, offset, offset+len)); + + while(frag && frag->ofs + frag->size <= offset) { + D2(printk(KERN_DEBUG "skipping frag %d-%d; before the region we care about\n", frag->ofs, frag->ofs + frag->size)); + frag = frag->next; + } + /* XXX FIXME: Where a single physical node actually shows up in two + frags, we read it twice. Don't do that. */ + /* Now we're pointing at the first frag which overlaps our page */ + while(offset < end) { + D2(printk(KERN_DEBUG "jffs2_read_inode_range: offset %d, end %d\n", offset, end)); + if (!frag || frag->ofs > offset) { + uint32_t holesize = end - offset; + if (frag) { + D1(printk(KERN_NOTICE "Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n", f->inocache->ino, frag->ofs, offset)); + holesize = min(holesize, frag->ofs - offset); + D1(jffs2_print_frag_list(f)); + } + D1(printk(KERN_DEBUG "Filling non-frag hole from %d-%d\n", offset, offset+holesize)); + memset(buf, 0, holesize); + buf += holesize; + offset += holesize; + continue; + } else if (!frag->node) { + uint32_t holeend = min(end, frag->ofs + frag->size); + D1(printk(KERN_DEBUG "Filling frag hole from %d-%d (frag 0x%x 0x%x)\n", offset, holeend, frag->ofs, frag->ofs + frag->size)); + memset(buf, 0, holeend - offset); + buf += holeend - offset; + offset = holeend; + frag = frag->next; + continue; + } else { + uint32_t readlen; + uint32_t frag_ofs = offset - frag->ofs; /* Offset within this frag from which we want to start reading */ + readlen = min(frag->size - frag_ofs, end - offset); + D1(printk(KERN_DEBUG "Reading %d-%d from node at 0x%x\n", frag->ofs+frag_ofs, frag->ofs+frag_ofs+readlen, frag->node->raw->flash_offset & ~3)); + ret = jffs2_read_dnode(c, frag->node, buf, frag->ofs + frag_ofs - frag->node->ofs, readlen); + D2(printk(KERN_DEBUG "node read done\n")); + if (ret) { + D1(printk(KERN_DEBUG"jffs2_read_inode_range error %d\n",ret)); + memset(buf, 0, frag->size - frag_ofs); + return ret; + } + + buf += frag->size - frag_ofs; + offset += frag->size - frag_ofs; + frag = frag->next; + D2(printk(KERN_DEBUG "node read was OK. Looping\n")); + } + } + return 0; +} + +/* Core function to read symlink target. */ +char *jffs2_getlink(struct jffs2_sb_info *c, struct jffs2_inode_info *f) +{ + char *buf; + int ret; + + down(&f->sem); + + if (!f->metadata) { + printk(KERN_NOTICE "No metadata for symlink inode #%u\n", f->inocache->ino); + up(&f->sem); + return ERR_PTR(-EINVAL); + } + buf = kmalloc(f->metadata->size+1, GFP_USER); + if (!buf) { + up(&f->sem); + return ERR_PTR(-ENOMEM); + } + buf[f->metadata->size]=0; + + ret = jffs2_read_dnode(c, f->metadata, buf, 0, f->metadata->size); + + up(&f->sem); + + if (ret) { + kfree(buf); + return ERR_PTR(ret); + } + return buf; +} diff --git a/packages/fs/jffs2/current/src/readinode.c b/packages/fs/jffs2/current/src/readinode.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/readinode.c @@ -0,0 +1,503 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: readinode.c,v 1.64 2002/01/09 13:25:58 dwmw2 Exp $ + * + */ + +/* Given an inode, probably with existing list of fragments, add the new node + * to the fragment list. + */ + +#ifndef __ECOS +#include +#include +#include +#include +#endif +#include "nodelist.h" +#include "crc32.h" + + +D1(void jffs2_print_frag_list(struct jffs2_inode_info *f) +{ + struct jffs2_node_frag *this = f->fraglist; + + while(this) { + if (this->node) + printk(KERN_DEBUG "frag %04x-%04x: 0x%08x on flash (*%p->%p)\n", this->ofs, this->ofs+this->size, this->node->raw->flash_offset &~3, this, this->next); + else + printk(KERN_DEBUG "frag %04x-%04x: hole (*%p->%p)\n", this->ofs, this->ofs+this->size, this, this->next); + this = this->next; + } + if (f->metadata) { + printk(KERN_DEBUG "metadata at 0x%08x\n", f->metadata->raw->flash_offset &~3); + } +}) + + +int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn) +{ + int ret; + D1(printk(KERN_DEBUG "jffs2_add_full_dnode_to_inode(ino #%u, f %p, fn %p)\n", f->inocache->ino, f, fn)); + + ret = jffs2_add_full_dnode_to_fraglist(c, &f->fraglist, fn); + + D2(jffs2_print_frag_list(f)); + return ret; +} + +static void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this) +{ + if (this->node) { + this->node->frags--; + if (!this->node->frags) { + /* The node has no valid frags left. It's totally obsoleted */ + D2(printk(KERN_DEBUG "Marking old node @0x%08x (0x%04x-0x%04x) obsolete\n", + this->node->raw->flash_offset &~3, this->node->ofs, this->node->ofs+this->node->size)); + jffs2_mark_node_obsolete(c, this->node->raw); + jffs2_free_full_dnode(this->node); + } else { + D2(printk(KERN_DEBUG "Not marking old node @0x%08x (0x%04x-0x%04x) obsolete. frags is %d\n", + this->node->raw->flash_offset &~3, this->node->ofs, this->node->ofs+this->node->size, + this->node->frags)); + } + + } + jffs2_free_node_frag(this); +} + +/* Doesn't set inode->i_size */ +int jffs2_add_full_dnode_to_fraglist(struct jffs2_sb_info *c, struct jffs2_node_frag **list, struct jffs2_full_dnode *fn) +{ + + struct jffs2_node_frag *this, **prev, *old; + struct jffs2_node_frag *newfrag, *newfrag2; + uint32_t lastend = 0; + + + newfrag = jffs2_alloc_node_frag(); + if (!newfrag) { + return -ENOMEM; + } + + D2(if (fn->raw) + printk(KERN_DEBUG "adding node %04x-%04x @0x%08x on flash, newfrag *%p\n", fn->ofs, fn->ofs+fn->size, fn->raw->flash_offset &~3, newfrag); + else + printk(KERN_DEBUG "adding hole node %04x-%04x on flash, newfrag *%p\n", fn->ofs, fn->ofs+fn->size, newfrag)); + + prev = list; + this = *list; + + if (!fn->size) { + jffs2_free_node_frag(newfrag); + return 0; + } + + newfrag->ofs = fn->ofs; + newfrag->size = fn->size; + newfrag->node = fn; + newfrag->node->frags = 1; + newfrag->next = (void *)0xdeadbeef; + + /* Skip all the nodes which are completed before this one starts */ + while(this && fn->ofs >= this->ofs+this->size) { + lastend = this->ofs + this->size; + + D2(printk(KERN_DEBUG "j_a_f_d_t_f: skipping frag 0x%04x-0x%04x; phys 0x%08x (*%p->%p)\n", + this->ofs, this->ofs+this->size, this->node?(this->node->raw->flash_offset &~3):0xffffffff, this, this->next)); + prev = &this->next; + this = this->next; + } + + /* See if we ran off the end of the list */ + if (!this) { + /* We did */ + if (lastend < fn->ofs) { + /* ... and we need to put a hole in before the new node */ + struct jffs2_node_frag *holefrag = jffs2_alloc_node_frag(); + if (!holefrag) + return -ENOMEM; + holefrag->ofs = lastend; + holefrag->size = fn->ofs - lastend; + holefrag->next = NULL; + holefrag->node = NULL; + *prev = holefrag; + prev = &holefrag->next; + } + newfrag->next = NULL; + *prev = newfrag; + return 0; + } + + D2(printk(KERN_DEBUG "j_a_f_d_t_f: dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p->%p)\n", + this->ofs, this->ofs+this->size, this->node?(this->node->raw->flash_offset &~3):0xffffffff, this, this->next)); + + /* OK. 'this' is pointing at the first frag that fn->ofs at least partially obsoletes, + * - i.e. fn->ofs < this->ofs+this->size && fn->ofs >= this->ofs + */ + if (fn->ofs > this->ofs) { + /* This node isn't completely obsoleted. The start of it remains valid */ + if (this->ofs + this->size > fn->ofs + fn->size) { + /* The new node splits 'this' frag into two */ + newfrag2 = jffs2_alloc_node_frag(); + if (!newfrag2) { + jffs2_free_node_frag(newfrag); + return -ENOMEM; + } + D1(printk(KERN_DEBUG "split old frag 0x%04x-0x%04x -->", this->ofs, this->ofs+this->size); + if (this->node) + printk("phys 0x%08x\n", this->node->raw->flash_offset &~3); + else + printk("hole\n"); + ) + newfrag2->ofs = fn->ofs + fn->size; + newfrag2->size = (this->ofs+this->size) - newfrag2->ofs; + newfrag2->next = this->next; + newfrag2->node = this->node; + if (this->node) + this->node->frags++; + newfrag->next = newfrag2; + this->next = newfrag; + this->size = newfrag->ofs - this->ofs; + return 0; + } + /* New node just reduces 'this' frag in size, doesn't split it */ + this->size = fn->ofs - this->ofs; + newfrag->next = this->next; + this->next = newfrag; + this = newfrag->next; + } else { + D2(printk(KERN_DEBUG "Inserting newfrag (*%p) in before 'this' (*%p)\n", newfrag, this)); + *prev = newfrag; + newfrag->next = this; + } + /* OK, now we have newfrag added in the correct place in the list, but + newfrag->next points to a fragment which may be overlapping it + */ + while (this && newfrag->ofs + newfrag->size >= this->ofs + this->size) { + /* 'this' frag is obsoleted. */ + old = this; + this = old->next; + jffs2_obsolete_node_frag(c, old); + } + /* Now we're pointing at the first frag which isn't totally obsoleted by + the new frag */ + newfrag->next = this; + + if (!this || newfrag->ofs + newfrag->size == this->ofs) { + return 0; + } + /* Still some overlap */ + this->size = (this->ofs + this->size) - (newfrag->ofs + newfrag->size); + this->ofs = newfrag->ofs + newfrag->size; + return 0; +} + +void jffs2_truncate_fraglist (struct jffs2_sb_info *c, struct jffs2_node_frag **list, uint32_t size) +{ + D1(printk(KERN_DEBUG "Truncating fraglist to 0x%08x bytes\n", size)); + + while (*list) { + if ((*list)->ofs >= size) { + struct jffs2_node_frag *this = *list; + *list = this->next; + D1(printk(KERN_DEBUG "Removing frag 0x%08x-0x%08x\n", this->ofs, this->ofs+this->size)); + jffs2_obsolete_node_frag(c, this); + continue; + } else if ((*list)->ofs + (*list)->size > size) { + D1(printk(KERN_DEBUG "Truncating frag 0x%08x-0x%08x\n", (*list)->ofs, (*list)->ofs + (*list)->size)); + (*list)->size = size - (*list)->ofs; + } + list = &(*list)->next; + } +} + +/* Scan the list of all nodes present for this ino, build map of versions, etc. */ + +int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, + uint32_t ino, struct jffs2_raw_inode *latest_node) +{ + struct jffs2_tmp_dnode_info *tn_list, *tn; + struct jffs2_full_dirent *fd_list; + struct jffs2_full_dnode *fn = NULL; + uint32_t crc; + size_t retlen; + int ret; + + init_MUTEX(&f->sem); + + D2(printk(KERN_DEBUG "jffs2_do_read_inode(): getting inocache\n")); + + f->inocache = jffs2_get_ino_cache(c, ino); + + D2(printk(KERN_DEBUG "jffs2_do_read_inode(): Got inocache at %p\n", f->inocache)); + + if (!f->inocache && ino == 1) { + /* Special case - no root inode on medium */ + f->inocache = jffs2_alloc_inode_cache(); + if (!f->inocache) { + printk(KERN_CRIT "jffs2_do_read_inode(): Cannot allocate inocache for root inode\n"); + return -ENOMEM; + } + D1(printk(KERN_DEBUG "jffs2_do_read_inode(): Creating inocache for root inode\n")); + memset(f->inocache, 0, sizeof(struct jffs2_inode_cache)); + f->inocache->ino = f->inocache->nlink = 1; + f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; + jffs2_add_ino_cache(c, f->inocache); + } + if (!f->inocache) { + printk(KERN_WARNING "jffs2_do_read_inode() on nonexistent ino %u\n", ino); + return -ENOENT; + } + D1(printk(KERN_DEBUG "jffs2_do_read_inode(): ino #%u nlink is %d\n", ino, f->inocache->nlink)); + + /* Grab all nodes relevant to this ino */ + ret = jffs2_get_inode_nodes(c, ino, f, &tn_list, &fd_list, &f->highest_version); + + if (ret) { + printk(KERN_CRIT "jffs2_get_inode_nodes() for ino %u returned %d\n", ino, ret); + return ret; + } + f->dents = fd_list; + + while (tn_list) { + static uint32_t mdata_ver = 0; + + tn = tn_list; + + fn = tn->fn; + + if (f->metadata && tn->version > mdata_ver) { + D1(printk(KERN_DEBUG "Obsoleting old metadata at 0x%08x\n", f->metadata->raw->flash_offset &~3)); + jffs2_mark_node_obsolete(c, f->metadata->raw); + jffs2_free_full_dnode(f->metadata); + f->metadata = NULL; + + mdata_ver = 0; + } + + if (fn->size) { + jffs2_add_full_dnode_to_inode(c, f, fn); + } else { + /* Zero-sized node at end of version list. Just a metadata update */ + D1(printk(KERN_DEBUG "metadata @%08x: ver %d\n", fn->raw->flash_offset &~3, tn->version)); + f->metadata = fn; + mdata_ver = tn->version; + } + tn_list = tn->next; + jffs2_free_tmp_dnode_info(tn); + } + if (!fn) { + /* No data nodes for this inode. */ + if (ino != 1) { + printk(KERN_WARNING "jffs2_do_read_inode(): No data nodes found for ino #%u\n", ino); + if (!fd_list) { + return -EIO; + } + printk(KERN_WARNING "jffs2_do_read_inode(): But it has children so we fake some modes for it\n"); + } + latest_node->mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO; + latest_node->atime = latest_node->ctime = latest_node->mtime = 0; + latest_node->isize = 0; + latest_node->gid = 0; + latest_node->uid = 0; + return 0; + } + + ret = jffs2_flash_read(c, fn->raw->flash_offset & ~3, sizeof(*latest_node), &retlen, (void *)latest_node); + if (ret || retlen != sizeof(*latest_node)) { + printk(KERN_NOTICE "MTD read in jffs2_do_read_inode() failed: Returned %d, %ld of %d bytes read\n", + ret, (long)retlen, sizeof(*latest_node)); + /* FIXME: If this fails, there seems to be a memory leak. Find it. */ + jffs2_do_clear_inode(c, f); + return ret?ret:-EIO; + } + + crc = crc32(0, latest_node, sizeof(*latest_node)-8); + if (crc != latest_node->node_crc) { + printk(KERN_NOTICE "CRC failed for read_inode of inode %u at physical location 0x%x\n", ino, fn->raw->flash_offset & ~3); + jffs2_do_clear_inode(c, f); + return -EIO; + } + + switch(latest_node->mode & S_IFMT) { + case S_IFREG: + /* If it was a regular file, truncate it to the latest node's isize */ + jffs2_truncate_fraglist(c, &f->fraglist, latest_node->isize); + break; + + case S_IFLNK: + /* Hack to work around broken isize in old symlink code. + Remove this when dwmw2 comes to his senses and stops + symlinks from being an entirely gratuitous special + case. */ + if (!latest_node->isize) + latest_node->isize = latest_node->dsize; + /* fall through... */ + + case S_IFBLK: + case S_IFCHR: + /* Xertain inode types should have only one data node, and it's + kept as the metadata node */ + if (f->metadata) { + printk(KERN_WARNING "Argh. Special inode #%u with mode 0%o had metadata node\n", ino, latest_node->mode); + jffs2_do_clear_inode(c, f); + return -EIO; + } + if (!f->fraglist) { + printk(KERN_WARNING "Argh. Special inode #%u with mode 0%o has no fragments\n", ino, latest_node->mode); + jffs2_do_clear_inode(c, f); + return -EIO; + } + /* ASSERT: f->fraglist != NULL */ + if (f->fraglist->next) { + printk(KERN_WARNING "Argh. Special inode #%u with mode 0%o had more than one node\n", ino, latest_node->mode); + /* FIXME: Deal with it - check crc32, check for duplicate node, check times and discard the older one */ + jffs2_do_clear_inode(c, f); + return -EIO; + } + /* OK. We're happy */ + f->metadata = f->fraglist->node; + jffs2_free_node_frag(f->fraglist); + f->fraglist = NULL; + break; + } + + return 0; +} + +void jffs2_read_inode (struct inode *inode) +{ + struct jffs2_inode_info *f; + struct jffs2_sb_info *c; + struct jffs2_raw_inode latest_node; + int ret; + + D1(printk(KERN_DEBUG "jffs2_read_inode(): inode->i_ino == %lu\n", inode->i_ino)); + + f = JFFS2_INODE_INFO(inode); + c = JFFS2_SB_INFO(inode->i_sb); + + memset(f, 0, sizeof(*f)); + + ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node); + + if (ret) { + make_bad_inode(inode); + return; + } + inode->i_mode = latest_node.mode; + inode->i_uid = latest_node.uid; + inode->i_gid = latest_node.gid; + inode->i_size = latest_node.isize; + inode->i_atime = latest_node.atime; + inode->i_mtime = latest_node.mtime; + inode->i_ctime = latest_node.ctime; + + inode->i_nlink = f->inocache->nlink; + +#ifndef __ECOS + inode->i_blksize = PAGE_SIZE; + inode->i_blocks = (inode->i_size + 511) >> 9; + +/* ifdef ugliness - when we sanify the eCos version of inode cache this whole + routine will probably be replaced */ + + switch (inode->i_mode & S_IFMT) { + unsigned short rdev; + + case S_IFLNK: + inode->i_op = &jffs2_symlink_inode_operations; + break; + + case S_IFDIR: + inode->i_op = &jffs2_dir_inode_operations; + inode->i_fop = &jffs2_dir_operations; + break; + + case S_IFREG: + inode->i_op = &jffs2_file_inode_operations; + inode->i_fop = &jffs2_file_operations; + inode->i_mapping->a_ops = &jffs2_file_address_operations; + inode->i_mapping->nrpages = 0; + break; + + case S_IFBLK: + case S_IFCHR: + /* Read the device numbers from the media */ + D1(printk(KERN_DEBUG "Reading device numbers from flash\n")); + if (jffs2_read_dnode(c, f->metadata, (char *)&rdev, 0, sizeof(rdev)) < 0) { + /* Eep */ + printk(KERN_NOTICE "Read device numbers for inode %lu failed\n", (unsigned long)inode->i_ino); + jffs2_do_clear_inode(c, f); + make_bad_inode(inode); + return; + } + + case S_IFSOCK: + case S_IFIFO: + inode->i_op = &jffs2_file_inode_operations; + init_special_inode(inode, inode->i_mode, kdev_t_to_nr(MKDEV(rdev>>8, rdev&0xff))); + break; + + default: + printk(KERN_WARNING "jffs2_read_inode(): Bogus imode %o for ino %lu\n", inode->i_mode, (unsigned long)inode->i_ino); + } +#endif /* !__ECOS */ + D1(printk(KERN_DEBUG "jffs2_read_inode() returning\n")); +} + +void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f) +{ + struct jffs2_node_frag *frag, *frags; + struct jffs2_full_dirent *fd, *fds; + + frags = f->fraglist; + fds = f->dents; + if (f->metadata) { + if (!f->inocache->nlink) + jffs2_mark_node_obsolete(c, f->metadata->raw); + jffs2_free_full_dnode(f->metadata); + } + + while (frags) { + frag = frags; + frags = frag->next; + D2(printk(KERN_DEBUG "jffs2_do_clear_inode: frag at 0x%x-0x%x: node %p, frags %d--\n", frag->ofs, frag->ofs+frag->size, frag->node, frag->node?frag->node->frags:0)); + + if (frag->node && !(--frag->node->frags)) { + /* Not a hole, and it's the final remaining frag of this node. Free the node */ + if (!f->inocache->nlink) + jffs2_mark_node_obsolete(c, frag->node->raw); + + jffs2_free_full_dnode(frag->node); + } + jffs2_free_node_frag(frag); + } + while(fds) { + fd = fds; + fds = fd->next; + jffs2_free_full_dirent(fd); + } +} + +void jffs2_clear_inode (struct inode *inode) +{ + /* We can forget about this inode for now - drop all + * the nodelists associated with it, etc. + */ + struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); + struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); + + D1(printk(KERN_DEBUG "jffs2_clear_inode(): ino #%lu mode %o\n", inode->i_ino, inode->i_mode)); + + jffs2_do_clear_inode(c, f); +} + diff --git a/packages/fs/jffs2/current/src/scan.c b/packages/fs/jffs2/current/src/scan.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/scan.c @@ -0,0 +1,666 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: scan.c,v 1.57 2002/01/09 13:25:58 dwmw2 Exp $ + * + */ + +#ifndef __ECOS +#include +#include +#include +#include +#endif +#include "nodelist.h" +#include "crc32.h" + + +#define DIRTY_SPACE(x) do { typeof(x) _x = (x); \ + c->free_size -= _x; c->dirty_size += _x; \ + jeb->free_size -= _x ; jeb->dirty_size += _x; \ + }while(0) +#define USED_SPACE(x) do { typeof(x) _x = (x); \ + c->free_size -= _x; c->used_size += _x; \ + jeb->free_size -= _x ; jeb->used_size += _x; \ + }while(0) + +#define noisy_printk(noise, args...) do { \ + if (*(noise)) { \ + printk(KERN_NOTICE args); \ + (*(noise))--; \ + if (!(*(noise))) { \ + printk(KERN_NOTICE "Further such events for this erase block will not be printed\n"); \ + } \ + } \ +} while(0) + +static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); + +/* These helper functions _must_ increase ofs and also do the dirty/used space accounting. + * Returning an error will abort the mount - bad checksums etc. should just mark the space + * as dirty. + */ +static int jffs2_scan_empty(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t *ofs, int *noise); +static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t *ofs); +static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t *ofs); + + +int jffs2_scan_medium(struct jffs2_sb_info *c) +{ + int i, ret; + uint32_t empty_blocks = 0; + + if (!c->blocks) { + printk(KERN_WARNING "EEEK! c->blocks is NULL!\n"); + return -EINVAL; + } + for (i=0; inr_blocks; i++) { + struct jffs2_eraseblock *jeb = &c->blocks[i]; + + ret = jffs2_scan_eraseblock(c, jeb); + if (ret < 0) + return ret; + + ACCT_PARANOIA_CHECK(jeb); + + /* Now decide which list to put it on */ + if (ret == 1) { + /* + * Empty block. Since we can't be sure it + * was entirely erased, we just queue it for erase + * again. It will be marked as such when the erase + * is complete. Meanwhile we still count it as empty + * for later checks. + */ + list_add(&jeb->list, &c->erase_pending_list); + empty_blocks++; + c->nr_erasing_blocks++; + } else if (jeb->used_size == PAD(sizeof(struct jffs2_unknown_node)) && !jeb->first_node->next_in_ino) { + /* Only a CLEANMARKER node is valid */ + if (!jeb->dirty_size) { + /* It's actually free */ + list_add(&jeb->list, &c->free_list); + c->nr_free_blocks++; + } else { + /* Dirt */ + D1(printk(KERN_DEBUG "Adding all-dirty block at 0x%08x to erase_pending_list\n", jeb->offset)); + list_add(&jeb->list, &c->erase_pending_list); + c->nr_erasing_blocks++; + } + } else if (jeb->used_size > c->sector_size - (2*sizeof(struct jffs2_raw_inode))) { + /* Full (or almost full) of clean data. Clean list */ + list_add(&jeb->list, &c->clean_list); + } else if (jeb->used_size) { + /* Some data, but not full. Dirty list. */ + /* Except that we want to remember the block with most free space, + and stick it in the 'nextblock' position to start writing to it. + Later when we do snapshots, this must be the most recent block, + not the one with most free space. + */ + if (jeb->free_size > 2*sizeof(struct jffs2_raw_inode) && + (!c->nextblock || c->nextblock->free_size < jeb->free_size)) { + /* Better candidate for the next writes to go to */ + if (c->nextblock) + list_add(&c->nextblock->list, &c->dirty_list); + c->nextblock = jeb; + } else { + list_add(&jeb->list, &c->dirty_list); + } + } else { + /* Nothing valid - not even a clean marker. Needs erasing. */ + /* For now we just put it on the erasing list. We'll start the erases later */ + printk(KERN_NOTICE "JFFS2: Erase block at 0x%08x is not formatted. It will be erased\n", jeb->offset); + list_add(&jeb->list, &c->erase_pending_list); + c->nr_erasing_blocks++; + } + } + if (c->nr_erasing_blocks) { + if (!c->used_size && empty_blocks != c->nr_blocks) { + printk(KERN_NOTICE "Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes\n"); + return -EIO; + } + jffs2_erase_pending_trigger(c); + } + return 0; +} + +static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) { + struct jffs2_unknown_node node; + uint32_t ofs, prevofs; + uint32_t hdr_crc, nodetype; + int err; + int noise = 0; + + ofs = jeb->offset; + prevofs = jeb->offset - 1; + + D1(printk(KERN_DEBUG "jffs2_scan_eraseblock(): Scanning block at 0x%x\n", ofs)); + + err = jffs2_scan_empty(c, jeb, &ofs, &noise); + if (err) return err; + if (ofs == jeb->offset + c->sector_size) { + D1(printk(KERN_DEBUG "Block at 0x%08x is empty (erased)\n", jeb->offset)); + return 1; /* special return code */ + } + + noise = 10; + + while(ofs < jeb->offset + c->sector_size) { + size_t retlen; + ACCT_PARANOIA_CHECK(jeb); + + if (ofs & 3) { + printk(KERN_WARNING "Eep. ofs 0x%08x not word-aligned!\n", ofs); + ofs = (ofs+3)&~3; + continue; + } + if (ofs == prevofs) { + printk(KERN_WARNING "ofs 0x%08x has already been seen. Skipping\n", ofs); + DIRTY_SPACE(4); + ofs += 4; + continue; + } + prevofs = ofs; + + if (jeb->offset + c->sector_size < ofs + sizeof(node)) { + D1(printk(KERN_DEBUG "Fewer than %d bytes left to end of block. Not reading\n", sizeof(struct jffs2_unknown_node))); + DIRTY_SPACE((jeb->offset + c->sector_size)-ofs); + break; + } + + err = jffs2_flash_read(c, ofs, sizeof(node), &retlen, (char *)&node); + + if (err) { + D1(printk(KERN_WARNING "mtd->read(0x%x bytes from 0x%x) returned %d\n", sizeof(node), ofs, err)); + return err; + } + if (retlen < sizeof(node)) { + D1(printk(KERN_WARNING "Read at 0x%x gave only 0x%x bytes\n", ofs, retlen)); + DIRTY_SPACE(retlen); + ofs += retlen; + continue; + } + + if (node.magic == JFFS2_EMPTY_BITMASK && node.nodetype == JFFS2_EMPTY_BITMASK) { + D1(printk(KERN_DEBUG "Found empty flash at 0x%x\n", ofs)); + err = jffs2_scan_empty(c, jeb, &ofs, &noise); + if (err) return err; + continue; + } + + if (ofs == jeb->offset && node.magic == KSAMTIB_CIGAM_2SFFJ) { + printk(KERN_WARNING "Magic bitmask is backwards at offset 0x%08x. Wrong endian filesystem?\n", ofs); + DIRTY_SPACE(4); + ofs += 4; + continue; + } + if (node.magic == JFFS2_DIRTY_BITMASK) { + D1(printk(KERN_DEBUG "Empty bitmask at 0x%08x\n", ofs)); + DIRTY_SPACE(4); + ofs += 4; + continue; + } + if (node.magic == JFFS2_OLD_MAGIC_BITMASK) { + printk(KERN_WARNING "Old JFFS2 bitmask found at 0x%08x\n", ofs); + printk(KERN_WARNING "You cannot use older JFFS2 filesystems with newer kernels\n"); + DIRTY_SPACE(4); + ofs += 4; + continue; + } + if (node.magic != JFFS2_MAGIC_BITMASK) { + /* OK. We're out of possibilities. Whinge and move on */ + noisy_printk(&noise, "jffs2_scan_eraseblock(): Magic bitmask 0x%04x not found at 0x%08x: 0x%04x instead\n", JFFS2_MAGIC_BITMASK, ofs, node.magic); + DIRTY_SPACE(4); + ofs += 4; + continue; + } + /* We seem to have a node of sorts. Check the CRC */ + nodetype = node.nodetype; + node.nodetype |= JFFS2_NODE_ACCURATE; + hdr_crc = crc32(0, &node, sizeof(node)-4); + node.nodetype = nodetype; + if (hdr_crc != node.hdr_crc) { + noisy_printk(&noise, "jffs2_scan_eraseblock(): Node at 0x%08x {0x%04x, 0x%04x, 0x%08x) has invalid CRC 0x%08x (calculated 0x%08x)\n", + ofs, node.magic, node.nodetype, node.totlen, node.hdr_crc, hdr_crc); + DIRTY_SPACE(4); + ofs += 4; + continue; + } + + switch(node.nodetype | JFFS2_NODE_ACCURATE) { + case JFFS2_NODETYPE_INODE: + err = jffs2_scan_inode_node(c, jeb, &ofs); + if (err) return err; + break; + + case JFFS2_NODETYPE_DIRENT: + err = jffs2_scan_dirent_node(c, jeb, &ofs); + if (err) return err; + break; + + case JFFS2_NODETYPE_CLEANMARKER: + if (node.totlen != sizeof(struct jffs2_unknown_node)) { + printk(KERN_NOTICE "CLEANMARKER node found at 0x%08x has totlen 0x%x != normal 0x%x\n", + ofs, node.totlen, sizeof(struct jffs2_unknown_node)); + DIRTY_SPACE(PAD(sizeof(struct jffs2_unknown_node))); + } else if (jeb->first_node) { + printk(KERN_NOTICE "CLEANMARKER node found at 0x%08x, not first node in block (0x%08x)\n", ofs, jeb->offset); + DIRTY_SPACE(PAD(sizeof(struct jffs2_unknown_node))); + ofs += PAD(sizeof(struct jffs2_unknown_node)); + continue; + } else { + struct jffs2_raw_node_ref *marker_ref = jffs2_alloc_raw_node_ref(); + if (!marker_ref) { + printk(KERN_NOTICE "Failed to allocate node ref for clean marker\n"); + return -ENOMEM; + } + marker_ref->next_in_ino = NULL; + marker_ref->next_phys = NULL; + marker_ref->flash_offset = ofs; + marker_ref->totlen = sizeof(struct jffs2_unknown_node); + jeb->first_node = jeb->last_node = marker_ref; + + USED_SPACE(PAD(sizeof(struct jffs2_unknown_node))); + } + ofs += PAD(sizeof(struct jffs2_unknown_node)); + break; + + default: + switch (node.nodetype & JFFS2_COMPAT_MASK) { + case JFFS2_FEATURE_ROCOMPAT: + printk(KERN_NOTICE "Read-only compatible feature node (0x%04x) found at offset 0x%08x\n", node.nodetype, ofs); + c->flags |= JFFS2_SB_FLAG_RO; + if (!(jffs2_is_readonly(c))) + return -EROFS; + DIRTY_SPACE(PAD(node.totlen)); + ofs += PAD(node.totlen); + continue; + + case JFFS2_FEATURE_INCOMPAT: + printk(KERN_NOTICE "Incompatible feature node (0x%04x) found at offset 0x%08x\n", node.nodetype, ofs); + return -EINVAL; + + case JFFS2_FEATURE_RWCOMPAT_DELETE: + printk(KERN_NOTICE "Unknown but compatible feature node (0x%04x) found at offset 0x%08x\n", node.nodetype, ofs); + DIRTY_SPACE(PAD(node.totlen)); + ofs += PAD(node.totlen); + break; + + case JFFS2_FEATURE_RWCOMPAT_COPY: + printk(KERN_NOTICE "Unknown but compatible feature node (0x%04x) found at offset 0x%08x\n", node.nodetype, ofs); + USED_SPACE(PAD(node.totlen)); + ofs += PAD(node.totlen); + break; + } + } + } + D1(printk(KERN_DEBUG "Block at 0x%08x: free 0x%08x, dirty 0x%08x, used 0x%08x\n", jeb->offset, + jeb->free_size, jeb->dirty_size, jeb->used_size)); + return 0; +} + +/* We're pointing at the first empty word on the flash. Scan and account for the whole dirty region */ +static int jffs2_scan_empty(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t *startofs, int *noise) +{ + uint32_t *buf; + uint32_t scanlen = (jeb->offset + c->sector_size) - *startofs; + uint32_t curofs = *startofs; + + buf = kmalloc(min((uint32_t)PAGE_SIZE, scanlen), GFP_KERNEL); + if (!buf) { + printk(KERN_WARNING "Scan buffer allocation failed\n"); + return -ENOMEM; + } + while(scanlen) { + size_t retlen; + int ret, i; + + ret = jffs2_flash_read(c, curofs, min((uint32_t)PAGE_SIZE, scanlen), &retlen, (char *)buf); + if(ret) { + D1(printk(KERN_WARNING "jffs2_scan_empty(): Read 0x%x bytes at 0x%08x returned %d\n", min((uint32_t)PAGE_SIZE, scanlen), curofs, ret)); + kfree(buf); + return ret; + } + if (retlen < 4) { + D1(printk(KERN_WARNING "Eep. too few bytes read in scan_empty()\n")); + kfree(buf); + return -EIO; + } + for (i=0; i<(retlen / 4); i++) { + if (buf[i] != 0xffffffff) { + curofs += i*4; + + noisy_printk(noise, "jffs2_scan_empty(): Empty block at 0x%08x ends at 0x%08x (with 0x%08x)! Marking dirty\n", *startofs, curofs, buf[i]); + DIRTY_SPACE(curofs - (*startofs)); + *startofs = curofs; + kfree(buf); + return 0; + } + } + scanlen -= retlen&~3; + curofs += retlen&~3; + } + + D1(printk(KERN_DEBUG "Empty flash detected from 0x%08x to 0x%08x\n", *startofs, curofs)); + kfree(buf); + *startofs = curofs; + return 0; +} + +static struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uint32_t ino) +{ + struct jffs2_inode_cache *ic; + + ic = jffs2_get_ino_cache(c, ino); + if (ic) + return ic; + + ic = jffs2_alloc_inode_cache(); + if (!ic) { + printk(KERN_NOTICE "jffs2_scan_make_inode_cache(): allocation of inode cache failed\n"); + return NULL; + } + memset(ic, 0, sizeof(*ic)); + ic->scan = kmalloc(sizeof(struct jffs2_scan_info), GFP_KERNEL); + if (!ic->scan) { + printk(KERN_NOTICE "jffs2_scan_make_inode_cache(): allocation of scan info for inode cache failed\n"); + jffs2_free_inode_cache(ic); + return NULL; + } + memset(ic->scan, 0, sizeof(*ic->scan)); + ic->ino = ino; + ic->nodes = (void *)ic; + jffs2_add_ino_cache(c, ic); + if (ino == 1) + ic->nlink=1; + return ic; +} + +static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t *ofs) +{ + struct jffs2_raw_node_ref *raw; + struct jffs2_full_dnode *fn; + struct jffs2_tmp_dnode_info *tn, **tn_list; + struct jffs2_inode_cache *ic; + struct jffs2_raw_inode ri; + uint32_t crc; + uint16_t oldnodetype; + int ret; + size_t retlen; + + D1(printk(KERN_DEBUG "jffs2_scan_inode_node(): Node at 0x%08x\n", *ofs)); + + ret = jffs2_flash_read(c, *ofs, sizeof(ri), &retlen, (char *)&ri); + if (ret) { + printk(KERN_NOTICE "jffs2_scan_inode_node(): Read error at 0x%08x: %d\n", *ofs, ret); + return ret; + } + if (retlen != sizeof(ri)) { + printk(KERN_NOTICE "Short read: 0x%x bytes at 0x%08x instead of requested %x\n", + retlen, *ofs, sizeof(ri)); + return -EIO; + } + + /* We sort of assume that the node was accurate when it was + first written to the medium :) */ + oldnodetype = ri.nodetype; + ri.nodetype |= JFFS2_NODE_ACCURATE; + crc = crc32(0, &ri, sizeof(ri)-8); + ri.nodetype = oldnodetype; + + if(crc != ri.node_crc) { + printk(KERN_NOTICE "jffs2_scan_inode_node(): CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", + *ofs, ri.node_crc, crc); + /* FIXME: Why do we believe totlen? */ + DIRTY_SPACE(4); + *ofs += 4; + return 0; + } + + if (ri.csize) { + /* Check data CRC too */ + unsigned char *dbuf; + uint32_t crc; + + dbuf = kmalloc(PAGE_CACHE_SIZE, GFP_KERNEL); + if (!dbuf) { + printk(KERN_NOTICE "jffs2_scan_inode_node(): allocation of temporary data buffer for CRC check failed\n"); + return -ENOMEM; + } + ret = jffs2_flash_read(c, *ofs+sizeof(ri), ri.csize, &retlen, dbuf); + if (ret) { + printk(KERN_NOTICE "jffs2_scan_inode_node(): Read error at 0x%08x: %d\n", *ofs+sizeof(ri), ret); + kfree(dbuf); + return ret; + } + if (retlen != ri.csize) { + printk(KERN_NOTICE "Short read: 0x%x bytes at 0x%08x instead of requested %x\n", + retlen, *ofs+ sizeof(ri), ri.csize); + kfree(dbuf); + return -EIO; + } + crc = crc32(0, dbuf, ri.csize); + kfree(dbuf); + if (crc != ri.data_crc) { + printk(KERN_NOTICE "jffs2_scan_inode_node(): Data CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", + *ofs, ri.data_crc, crc); + DIRTY_SPACE(PAD(ri.totlen)); + *ofs += PAD(ri.totlen); + return -0; + } + } + + /* Wheee. It worked */ + raw = jffs2_alloc_raw_node_ref(); + if (!raw) { + printk(KERN_NOTICE "jffs2_scan_inode_node(): allocation of node reference failed\n"); + return -ENOMEM; + } + tn = jffs2_alloc_tmp_dnode_info(); + if (!tn) { + jffs2_free_raw_node_ref(raw); + return -ENOMEM; + } + fn = jffs2_alloc_full_dnode(); + if (!fn) { + jffs2_free_tmp_dnode_info(tn); + jffs2_free_raw_node_ref(raw); + return -ENOMEM; + } + ic = jffs2_scan_make_ino_cache(c, ri.ino); + if (!ic) { + jffs2_free_full_dnode(fn); + jffs2_free_tmp_dnode_info(tn); + jffs2_free_raw_node_ref(raw); + return -ENOMEM; + } + + /* Build the data structures and file them for later */ + raw->flash_offset = *ofs; + raw->totlen = PAD(ri.totlen); + raw->next_phys = NULL; + raw->next_in_ino = ic->nodes; + ic->nodes = raw; + if (!jeb->first_node) + jeb->first_node = raw; + if (jeb->last_node) + jeb->last_node->next_phys = raw; + jeb->last_node = raw; + + D1(printk(KERN_DEBUG "Node is ino #%u, version %d. Range 0x%x-0x%x\n", + ri.ino, ri.version, ri.offset, ri.offset+ri.dsize)); + + for (tn_list = &ic->scan->tmpnodes; *tn_list; tn_list = &((*tn_list)->next)) { + if ((*tn_list)->version < ri.version) + continue; + if ((*tn_list)->version > ri.version) + break; + /* Wheee. We've found another instance of the same version number. + We should obsolete one of them. + */ + D1(printk(KERN_DEBUG "Duplicate version %d found in ino #%u. Previous one is at 0x%08x\n", ri.version, ic->ino, (*tn_list)->fn->raw->flash_offset &~3)); + if (!jeb->used_size) { + D1(printk(KERN_DEBUG "No valid nodes yet found in this eraseblock 0x%08x, so obsoleting the new instance at 0x%08x\n", + jeb->offset, raw->flash_offset & ~3)); + ri.nodetype &= ~JFFS2_NODE_ACCURATE; + /* Perhaps we could also mark it as such on the medium. Maybe later */ + } + break; + } + + if (ri.nodetype & JFFS2_NODE_ACCURATE) { + memset(fn,0,sizeof(*fn)); + + fn->ofs = ri.offset; + fn->size = ri.dsize; + fn->frags = 0; + fn->raw = raw; + + tn->next = NULL; + tn->fn = fn; + tn->version = ri.version; + + USED_SPACE(PAD(ri.totlen)); + jffs2_add_tn_to_list(tn, &ic->scan->tmpnodes); + /* Make sure the one we just added is the _last_ in the list + with this version number, so the older ones get obsoleted */ + while (tn->next && tn->next->version == tn->version) { + + D1(printk(KERN_DEBUG "Shifting new node at 0x%08x after other node at 0x%08x for version %d in list\n", + fn->raw->flash_offset&~3, tn->next->fn->raw->flash_offset &~3, ri.version)); + + if(tn->fn != fn) + BUG(); + tn->fn = tn->next->fn; + tn->next->fn = fn; + tn = tn->next; + } + } else { + jffs2_free_full_dnode(fn); + jffs2_free_tmp_dnode_info(tn); + raw->flash_offset |= 1; + DIRTY_SPACE(PAD(ri.totlen)); + } + *ofs += PAD(ri.totlen); + return 0; +} + +static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t *ofs) +{ + struct jffs2_raw_node_ref *raw; + struct jffs2_full_dirent *fd; + struct jffs2_inode_cache *ic; + struct jffs2_raw_dirent rd; + uint16_t oldnodetype; + int ret; + uint32_t crc; + size_t retlen; + + D1(printk(KERN_DEBUG "jffs2_scan_dirent_node(): Node at 0x%08x\n", *ofs)); + + ret = jffs2_flash_read(c, *ofs, sizeof(rd), &retlen, (char *)&rd); + if (ret) { + printk(KERN_NOTICE "jffs2_scan_dirent_node(): Read error at 0x%08x: %d\n", *ofs, ret); + return ret; + } + if (retlen != sizeof(rd)) { + printk(KERN_NOTICE "Short read: 0x%x bytes at 0x%08x instead of requested %x\n", + retlen, *ofs, sizeof(rd)); + return -EIO; + } + + /* We sort of assume that the node was accurate when it was + first written to the medium :) */ + oldnodetype = rd.nodetype; + rd.nodetype |= JFFS2_NODE_ACCURATE; + crc = crc32(0, &rd, sizeof(rd)-8); + rd.nodetype = oldnodetype; + + if (crc != rd.node_crc) { + printk(KERN_NOTICE "jffs2_scan_dirent_node(): Node CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", + *ofs, rd.node_crc, crc); + /* FIXME: Why do we believe totlen? */ + DIRTY_SPACE(4); + *ofs += 4; + return 0; + } + + fd = jffs2_alloc_full_dirent(rd.nsize+1); + if (!fd) { + return -ENOMEM; +} + ret = jffs2_flash_read(c, *ofs + sizeof(rd), rd.nsize, &retlen, &fd->name[0]); + if (ret) { + jffs2_free_full_dirent(fd); + printk(KERN_NOTICE "jffs2_scan_dirent_node(): Read error at 0x%08x: %d\n", + *ofs + sizeof(rd), ret); + return ret; + } + if (retlen != rd.nsize) { + jffs2_free_full_dirent(fd); + printk(KERN_NOTICE "Short read: 0x%x bytes at 0x%08x instead of requested %x\n", + retlen, *ofs + sizeof(rd), rd.nsize); + return -EIO; + } + crc = crc32(0, fd->name, rd.nsize); + if (crc != rd.name_crc) { + printk(KERN_NOTICE "jffs2_scan_dirent_node(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", + *ofs, rd.name_crc, crc); + fd->name[rd.nsize]=0; + D1(printk(KERN_NOTICE "Name for which CRC failed is (now) '%s', ino #%d\n", fd->name, rd.ino)); + jffs2_free_full_dirent(fd); + /* FIXME: Why do we believe totlen? */ + DIRTY_SPACE(PAD(rd.totlen)); + *ofs += PAD(rd.totlen); + return 0; + } + raw = jffs2_alloc_raw_node_ref(); + if (!raw) { + jffs2_free_full_dirent(fd); + printk(KERN_NOTICE "jffs2_scan_dirent_node(): allocation of node reference failed\n"); + return -ENOMEM; + } + ic = jffs2_scan_make_ino_cache(c, rd.pino); + if (!ic) { + jffs2_free_full_dirent(fd); + jffs2_free_raw_node_ref(raw); + return -ENOMEM; + } + + raw->totlen = PAD(rd.totlen); + raw->flash_offset = *ofs; + raw->next_phys = NULL; + raw->next_in_ino = ic->nodes; + ic->nodes = raw; + if (!jeb->first_node) + jeb->first_node = raw; + if (jeb->last_node) + jeb->last_node->next_phys = raw; + jeb->last_node = raw; + + if (rd.nodetype & JFFS2_NODE_ACCURATE) { + fd->raw = raw; + fd->next = NULL; + fd->version = rd.version; + fd->ino = rd.ino; + fd->name[rd.nsize]=0; + fd->nhash = full_name_hash(fd->name, rd.nsize); + fd->type = rd.type; + + USED_SPACE(PAD(rd.totlen)); + jffs2_add_fd_to_list(c, fd, &ic->scan->dents); + } else { + raw->flash_offset |= 1; + jffs2_free_full_dirent(fd); + + DIRTY_SPACE(PAD(rd.totlen)); + } + *ofs += PAD(rd.totlen); + return 0; +} diff --git a/packages/fs/jffs2/current/src/write.c b/packages/fs/jffs2/current/src/write.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/src/write.c @@ -0,0 +1,665 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001, 2002 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + * $Id: write.c,v 1.40 2002/01/28 22:25:08 dwmw2 Exp $ + * + */ + +#ifndef __ECOS +#include +#include +#include +#include +#endif +#include "nodelist.h" +#include "crc32.h" + + +int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint32_t mode, struct jffs2_raw_inode *ri) +{ + struct jffs2_inode_cache *ic; + + ic = jffs2_alloc_inode_cache(); + if (!ic) { + return -ENOMEM; + } + memset(ic, 0, sizeof(*ic)); + + init_MUTEX_LOCKED(&f->sem); + f->inocache = ic; + f->inocache->nlink = 1; + f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; + f->inocache->ino = ri->ino = ++c->highest_ino; + D1(printk(KERN_DEBUG "jffs2_do_new_inode(): Assigned ino# %d\n", ri->ino)); + jffs2_add_ino_cache(c, f->inocache); + + ri->magic = JFFS2_MAGIC_BITMASK; + ri->nodetype = JFFS2_NODETYPE_INODE; + ri->totlen = PAD(sizeof(*ri)); + ri->hdr_crc = crc32(0, ri, sizeof(struct jffs2_unknown_node)-4); + ri->mode = mode; + f->highest_version = ri->version = 1; + + return 0; +} + +/* jffs2_new_inode: allocate a new inode and inocache, add it to the hash, + fill in the raw_inode while you're at it. */ +struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_inode *ri) +{ + struct inode *inode; + struct super_block *sb = dir_i->i_sb; + struct jffs2_sb_info *c; + struct jffs2_inode_info *f; + int ret; + + D1(printk(KERN_DEBUG "jffs2_new_inode(): dir_i %ld, mode 0x%x\n", dir_i->i_ino, mode)); + + c = JFFS2_SB_INFO(sb); + + inode = new_inode(sb); + + if (!inode) + return ERR_PTR(-ENOMEM); + + /* Alloc jffs2_inode_info when that's split in 2.5 */ + + f = JFFS2_INODE_INFO(inode); + memset(f, 0, sizeof(*f)); + + memset(ri, 0, sizeof(*ri)); + /* Set OS-specific defaults for new inodes */ +#ifdef __ECOS + ri->uid = ri->gid = 0; +#else + ri->uid = current->fsuid; + + if (dir_i->i_mode & S_ISGID) { + ri->gid = dir_i->i_gid; + if (S_ISDIR(mode)) + ri->mode |= S_ISGID; + } else { + ri->gid = current->fsgid; + } +#endif + ri->mode = mode; + ret = jffs2_do_new_inode (c, f, mode, ri); + if (ret) { + make_bad_inode(inode); + iput(inode); + return ERR_PTR(ret); + } + inode->i_nlink = 1; + inode->i_ino = ri->ino; + inode->i_mode = ri->mode; + inode->i_gid = ri->gid; + inode->i_uid = ri->uid; + inode->i_atime = inode->i_ctime = inode->i_mtime = + ri->atime = ri->mtime = ri->ctime = CURRENT_TIME; +#ifndef __ECOS + inode->i_blksize = PAGE_SIZE; + inode->i_blocks = 0; +#endif + inode->i_size = 0; + + insert_inode_hash(inode); + + return inode; +} + +#ifndef __ECOS +/* This ought to be in core MTD code. All registered MTD devices without writev should have + this put in place. Bug the MTD maintainer */ +static int mtd_fake_writev(struct mtd_info *mtd, const struct iovec *vecs, unsigned long count, loff_t to, size_t *retlen) +{ + unsigned long i; + size_t totlen = 0, thislen; + int ret = 0; + + for (i=0; iwrite(mtd, to, vecs[i].iov_len, &thislen, vecs[i].iov_base); + totlen += thislen; + if (ret || thislen != vecs[i].iov_len) + break; + to += vecs[i].iov_len; + } + if (retlen) + *retlen = totlen; + return ret; +} + + +static inline int jffs2_flash_writev(struct jffs2_sb_info *c, const struct iovec *vecs, unsigned long count, loff_t to, size_t *retlen) +{ + if (c->mtd->writev) + return c->mtd->writev(c->mtd, vecs, count, to, retlen); + else + return mtd_fake_writev(c->mtd, vecs, count, to, retlen); +} +#endif + +static void writecheck(struct jffs2_sb_info *c, uint32_t ofs) +{ + unsigned char buf[16]; + size_t retlen; + int ret, i; + + ret = jffs2_flash_read(c, ofs, 16, &retlen, buf); + if (ret && retlen != 16) { + D1(printk(KERN_DEBUG "read failed or short in writecheck(). ret %d, retlen %d\n", ret, retlen)); + return; + } + ret = 0; + for (i=0; i<16; i++) { + if (buf[i] != 0xff) + ret = 1; + } + if (ret) { + printk(KERN_WARNING "ARGH. About to write node to 0x%08x on flash, but there's data already there:\n", ofs); + printk(KERN_WARNING "0x%08x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", + ofs, + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], + buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]); + } +} + + + + +/* jffs2_write_dnode - given a raw_inode, allocate a full_dnode for it, + write it to the flash, link it into the existing inode/fragment list */ + +struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const unsigned char *data, uint32_t datalen, uint32_t flash_ofs, uint32_t *writelen) + +{ + struct jffs2_raw_node_ref *raw; + struct jffs2_full_dnode *fn; + size_t retlen; + struct iovec vecs[2]; + int ret; + + D1(if(ri->hdr_crc != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) { + printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dnode()\n"); + BUG(); + } + ); + vecs[0].iov_base = ri; + vecs[0].iov_len = sizeof(*ri); + vecs[1].iov_base = (unsigned char *)data; + vecs[1].iov_len = datalen; + + writecheck(c, flash_ofs); + + if (ri->totlen != sizeof(*ri) + datalen) { + printk(KERN_WARNING "jffs2_write_dnode: ri->totlen (0x%08x) != sizeof(*ri) (0x%08x) + datalen (0x%08x)\n", ri->totlen, sizeof(*ri), datalen); + } + raw = jffs2_alloc_raw_node_ref(); + if (!raw) + return ERR_PTR(-ENOMEM); + + fn = jffs2_alloc_full_dnode(); + if (!fn) { + jffs2_free_raw_node_ref(raw); + return ERR_PTR(-ENOMEM); + } + raw->flash_offset = flash_ofs; + raw->totlen = PAD(ri->totlen); + raw->next_phys = NULL; + + fn->ofs = ri->offset; + fn->size = ri->dsize; + fn->frags = 0; + fn->raw = raw; + + ret = jffs2_flash_writev(c, vecs, datalen?2:1, flash_ofs, &retlen); + if (ret || (retlen != sizeof(*ri) + datalen)) { + printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %d\n", + sizeof(*ri)+datalen, flash_ofs, ret, retlen); + /* Mark the space as dirtied */ + if (retlen) { + /* Doesn't belong to any inode */ + raw->next_in_ino = NULL; + + /* Don't change raw->size to match retlen. We may have + written the node header already, and only the data will + seem corrupted, in which case the scan would skip over + any node we write before the original intended end of + this node */ + jffs2_add_physical_node_ref(c, raw, sizeof(*ri)+datalen, 1); + jffs2_mark_node_obsolete(c, raw); + } else { + printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); + jffs2_free_raw_node_ref(raw); + } + + /* Release the full_dnode which is now useless, and return */ + jffs2_free_full_dnode(fn); + if (writelen) + *writelen = retlen; + return ERR_PTR(ret?ret:-EIO); + } + /* Mark the space used */ + jffs2_add_physical_node_ref(c, raw, retlen, 0); + + /* Link into per-inode list */ + raw->next_in_ino = f->inocache->nodes; + f->inocache->nodes = raw; + + D1(printk(KERN_DEBUG "jffs2_write_dnode wrote node at 0x%08x with dsize 0x%x, csize 0x%x, node_crc 0x%08x, data_crc 0x%08x, totlen 0x%08x\n", flash_ofs, ri->dsize, ri->csize, ri->node_crc, ri->data_crc, ri->totlen)); + if (writelen) + *writelen = retlen; + + f->inocache->nodes = raw; + return fn; +} + +struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_dirent *rd, const unsigned char *name, uint32_t namelen, uint32_t flash_ofs, uint32_t *writelen) +{ + struct jffs2_raw_node_ref *raw; + struct jffs2_full_dirent *fd; + size_t retlen; + struct iovec vecs[2]; + int ret; + + D1(printk(KERN_DEBUG "jffs2_write_dirent(ino #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x)\n", rd->pino, name, name, rd->ino, rd->name_crc)); + writecheck(c, flash_ofs); + + D1(if(rd->hdr_crc != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) { + printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dirent()\n"); + BUG(); + } + ); + + vecs[0].iov_base = rd; + vecs[0].iov_len = sizeof(*rd); + vecs[1].iov_base = (unsigned char *)name; + vecs[1].iov_len = namelen; + + raw = jffs2_alloc_raw_node_ref(); + + if (!raw) + return ERR_PTR(-ENOMEM); + + fd = jffs2_alloc_full_dirent(namelen+1); + if (!fd) { + jffs2_free_raw_node_ref(raw); + return ERR_PTR(-ENOMEM); + } + raw->flash_offset = flash_ofs; + raw->totlen = PAD(rd->totlen); + raw->next_in_ino = f->inocache->nodes; + f->inocache->nodes = raw; + raw->next_phys = NULL; + + fd->version = rd->version; + fd->ino = rd->ino; + fd->nhash = full_name_hash(name, strlen(name)); + fd->type = rd->type; + memcpy(fd->name, name, namelen); + fd->name[namelen]=0; + fd->raw = raw; + + ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen); + if (ret || (retlen != sizeof(*rd) + namelen)) { + printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %d\n", + sizeof(*rd)+namelen, flash_ofs, ret, retlen); + /* Mark the space as dirtied */ + if (retlen) { + jffs2_add_physical_node_ref(c, raw, sizeof(*rd)+namelen, 1); + jffs2_mark_node_obsolete(c, raw); + } else { + printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); + jffs2_free_raw_node_ref(raw); + } + + /* Release the full_dnode which is now useless, and return */ + jffs2_free_full_dirent(fd); + if (writelen) + *writelen = retlen; + return ERR_PTR(ret?ret:-EIO); + } + /* Mark the space used */ + jffs2_add_physical_node_ref(c, raw, retlen, 0); + if (writelen) + *writelen = retlen; + + f->inocache->nodes = raw; + return fd; +} + +/* The OS-specific code fills in the metadata in the jffs2_raw_inode for us, so that + we don't have to go digging in struct inode or its equivalent. It should set: + mode, uid, gid, (starting)isize, atime, ctime, mtime */ +int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, + struct jffs2_raw_inode *ri, unsigned char *buf, + uint32_t offset, uint32_t writelen, uint32_t *retlen) +{ + int ret = 0; + uint32_t writtenlen = 0; + + D1(printk(KERN_DEBUG "jffs2_write_inode_range(): Ino #%u, ofs 0x%x, len 0x%x\n", + f->inocache->ino, offset, writelen)); + + while(writelen) { + struct jffs2_full_dnode *fn; + unsigned char *comprbuf = NULL; + unsigned char comprtype = JFFS2_COMPR_NONE; + uint32_t phys_ofs, alloclen; + uint32_t datalen, cdatalen; + + D2(printk(KERN_DEBUG "jffs2_commit_write() loop: 0x%x to write to 0x%x\n", writelen, offset)); + + ret = jffs2_reserve_space(c, sizeof(*ri) + JFFS2_MIN_DATA_LEN, &phys_ofs, &alloclen, ALLOC_NORMAL); + if (ret) { + D1(printk(KERN_DEBUG "jffs2_reserve_space returned %d\n", ret)); + break; + } + down(&f->sem); + datalen = writelen; + cdatalen = min(alloclen - sizeof(*ri), writelen); + + comprbuf = kmalloc(cdatalen, GFP_KERNEL); + if (comprbuf) { + comprtype = jffs2_compress(buf, comprbuf, &datalen, &cdatalen); + } + if (comprtype == JFFS2_COMPR_NONE) { + /* Either compression failed, or the allocation of comprbuf failed */ + if (comprbuf) + kfree(comprbuf); + comprbuf = buf; + datalen = cdatalen; + } + /* Now comprbuf points to the data to be written, be it compressed or not. + comprtype holds the compression type, and comprtype == JFFS2_COMPR_NONE means + that the comprbuf doesn't need to be kfree()d. + */ + + ri->magic = JFFS2_MAGIC_BITMASK; + ri->nodetype = JFFS2_NODETYPE_INODE; + ri->totlen = sizeof(*ri) + cdatalen; + ri->hdr_crc = crc32(0, ri, sizeof(struct jffs2_unknown_node)-4); + + ri->ino = f->inocache->ino; + ri->version = ++f->highest_version; + ri->isize = max(ri->isize, offset + datalen); + ri->offset = offset; + ri->csize = cdatalen; + ri->dsize = datalen; + ri->compr = comprtype; + ri->node_crc = crc32(0, ri, sizeof(*ri)-8); + ri->data_crc = crc32(0, comprbuf, cdatalen); + + fn = jffs2_write_dnode(c, f, ri, comprbuf, cdatalen, phys_ofs, NULL); + + jffs2_complete_reservation(c); + + if (comprtype != JFFS2_COMPR_NONE) + kfree(comprbuf); + + if (IS_ERR(fn)) { + ret = PTR_ERR(fn); + up(&f->sem); + break; + } + ret = jffs2_add_full_dnode_to_inode(c, f, fn); + if (f->metadata) { + jffs2_mark_node_obsolete(c, f->metadata->raw); + jffs2_free_full_dnode(f->metadata); + f->metadata = NULL; + } + up(&f->sem); + if (ret) { + /* Eep */ + D1(printk(KERN_DEBUG "Eep. add_full_dnode_to_inode() failed in commit_write, returned %d\n", ret)); + jffs2_mark_node_obsolete(c, fn->raw); + jffs2_free_full_dnode(fn); + break; + } + if (!datalen) { + printk(KERN_WARNING "Eep. We didn't actually write any data in jffs2_write_inode_range()\n"); + ret = -EIO; + break; + } + D1(printk(KERN_DEBUG "increasing writtenlen by %d\n", datalen)); + writtenlen += datalen; + offset += datalen; + writelen -= datalen; + buf += datalen; + } + *retlen = writtenlen; + return ret; +} + +int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const char *name, int namelen) +{ + struct jffs2_raw_dirent *rd; + struct jffs2_full_dnode *fn; + struct jffs2_full_dirent *fd; + uint32_t alloclen, phys_ofs; + uint32_t writtenlen; + int ret; + + /* Try to reserve enough space for both node and dirent. + * Just the node will do for now, though + */ + ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL); + D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen)); + if (ret) + return ret; + + ri->data_crc = 0; + ri->node_crc = crc32(0, ri, sizeof(*ri)-8); + + fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, &writtenlen); + + D1(printk(KERN_DEBUG "jffs2_do_create created file with mode 0x%x\n", ri->mode)); + + if (IS_ERR(fn)) { + D1(printk(KERN_DEBUG "jffs2_write_dnode() failed\n")); + /* Eeek. Wave bye bye */ + up(&f->sem); + jffs2_complete_reservation(c); + return PTR_ERR(fn); + } + /* No data here. Only a metadata node, which will be + obsoleted by the first data write + */ + f->metadata = fn; + + /* Work out where to put the dirent node now. */ + writtenlen = PAD(writtenlen); + phys_ofs += writtenlen; + alloclen -= writtenlen; + up(&f->sem); + + if (alloclen < sizeof(*rd)+namelen) { + /* Not enough space left in this chunk. Get some more */ + jffs2_complete_reservation(c); + ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_NORMAL); + + if (ret) { + /* Eep. */ + D1(printk(KERN_DEBUG "jffs2_reserve_space() for dirent failed\n")); + return ret; + } + } + + rd = jffs2_alloc_raw_dirent(); + if (!rd) { + /* Argh. Now we treat it like a normal delete */ + jffs2_complete_reservation(c); + return -ENOMEM; + } + + down(&dir_f->sem); + + rd->magic = JFFS2_MAGIC_BITMASK; + rd->nodetype = JFFS2_NODETYPE_DIRENT; + rd->totlen = sizeof(*rd) + namelen; + rd->hdr_crc = crc32(0, rd, sizeof(struct jffs2_unknown_node)-4); + + rd->pino = dir_f->inocache->ino; + rd->version = ++dir_f->highest_version; + rd->ino = ri->ino; + rd->mctime = CURRENT_TIME; + rd->nsize = namelen; + rd->type = DT_REG; + rd->node_crc = crc32(0, rd, sizeof(*rd)-8); + rd->name_crc = crc32(0, name, namelen); + + fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, &writtenlen); + + jffs2_complete_reservation(c); + jffs2_free_raw_dirent(rd); + + if (IS_ERR(fd)) { + /* dirent failed to write. Delete the inode normally + as if it were the final unlink() */ + up(&dir_f->sem); + return PTR_ERR(fd); + } + + /* Link the fd into the inode's list, obsoleting an old + one if necessary. */ + jffs2_add_fd_to_list(c, fd, &dir_f->dents); + up(&dir_f->sem); + + return 0; +} + + +int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, const char *name, int namelen, struct jffs2_inode_info *dead_f) +{ + struct jffs2_raw_dirent *rd; + struct jffs2_full_dirent *fd; + uint32_t alloclen, phys_ofs; + int ret; + + rd = jffs2_alloc_raw_dirent(); + if (!rd) + return -ENOMEM; + + ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_DELETION); + if (ret) { + jffs2_free_raw_dirent(rd); + return ret; + } + + down(&dir_f->sem); + + /* Build a deletion node */ + rd->magic = JFFS2_MAGIC_BITMASK; + rd->nodetype = JFFS2_NODETYPE_DIRENT; + rd->totlen = sizeof(*rd) + namelen; + rd->hdr_crc = crc32(0, rd, sizeof(struct jffs2_unknown_node)-4); + + rd->pino = dir_f->inocache->ino; + rd->version = ++dir_f->highest_version; + rd->ino = 0; + rd->mctime = CURRENT_TIME; + rd->nsize = namelen; + rd->type = DT_UNKNOWN; + rd->node_crc = crc32(0, rd, sizeof(*rd)-8); + rd->name_crc = crc32(0, name, namelen); + + fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, NULL); + + jffs2_complete_reservation(c); + jffs2_free_raw_dirent(rd); + + if (IS_ERR(fd)) { + up(&dir_f->sem); + return PTR_ERR(fd); + } + + /* File it. This will mark the old one obsolete. */ + jffs2_add_fd_to_list(c, fd, &dir_f->dents); + up(&dir_f->sem); + + if (dead_f) { /* Null if this was a rename not a real unlink */ + + down(&dead_f->sem); + + while (dead_f->dents) { + /* There can be only deleted ones */ + fd = dead_f->dents; + + dead_f->dents = fd->next; + + if (fd->ino) { + printk(KERN_WARNING "Deleting inode #%u with active dentry \"%s\"->ino #%u\n", + dead_f->inocache->ino, fd->name, fd->ino); + } else { + D1(printk(KERN_DEBUG "Removing deletion dirent for \"%s\" from dir ino #%u\n", fd->name, dead_f->inocache->ino)); + } + jffs2_mark_node_obsolete(c, fd->raw); + jffs2_free_full_dirent(fd); + } + + dead_f->inocache->nlink--; + /* NB: Caller must set inode nlink if appropriate */ + up(&dead_f->sem); + } + + return 0; +} + + +int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint32_t ino, uint8_t type, const char *name, int namelen) +{ + struct jffs2_raw_dirent *rd; + struct jffs2_full_dirent *fd; + uint32_t alloclen, phys_ofs; + int ret; + + rd = jffs2_alloc_raw_dirent(); + if (!rd) + return -ENOMEM; + + ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_NORMAL); + if (ret) { + jffs2_free_raw_dirent(rd); + return ret; + } + + down(&dir_f->sem); + + /* Build a deletion node */ + rd->magic = JFFS2_MAGIC_BITMASK; + rd->nodetype = JFFS2_NODETYPE_DIRENT; + rd->totlen = sizeof(*rd) + namelen; + rd->hdr_crc = crc32(0, rd, sizeof(struct jffs2_unknown_node)-4); + + rd->pino = dir_f->inocache->ino; + rd->version = ++dir_f->highest_version; + rd->ino = ino; + rd->mctime = CURRENT_TIME; + rd->nsize = namelen; + + rd->type = type; + + rd->node_crc = crc32(0, rd, sizeof(*rd)-8); + rd->name_crc = crc32(0, name, namelen); + + fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, NULL); + + jffs2_complete_reservation(c); + jffs2_free_raw_dirent(rd); + + if (IS_ERR(fd)) { + up(&dir_f->sem); + return PTR_ERR(fd); + } + + /* File it. This will mark the old one obsolete. */ + jffs2_add_fd_to_list(c, fd, &dir_f->dents); + up(&dir_f->sem); + + return 0; +} diff --git a/packages/fs/jffs2/current/support/jffs2/etc/group b/packages/fs/jffs2/current/support/jffs2/etc/group new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/support/jffs2/etc/group @@ -0,0 +1,31 @@ +root:x:0:root +bin:x:1:root,bin,daemon +daemon:x:2:root,bin,daemon +sys:x:3:root,bin,adm +adm:x:4:root,adm,daemon +tty:x:5: +disk:x:6:root +lp:x:7:daemon,lp +mem:x:8: +kmem:x:9: +wheel:x:10:root +mail:x:12:mail +news:x:13:news +uucp:x:14:uucp +man:x:15: +games:x:20: +gopher:x:30: +dip:x:40: +ftp:x:50: +nobody:x:99: +users:x:100: +floppy:x:19: +utmp:x:22: +xfs:x:43: +console:x:31: +gdm:x:42: +pppusers:x:44: +popusers:x:45: +slipusers:x:46: +slocate:x:21: +dostrows:x:500: diff --git a/packages/fs/jffs2/current/support/jffs2/etc/passwd b/packages/fs/jffs2/current/support/jffs2/etc/passwd new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/support/jffs2/etc/passwd @@ -0,0 +1,19 @@ +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/bin: +daemon:x:2:2:daemon:/sbin: +adm:x:3:4:adm:/var/adm: +lp:x:4:7:lp:/var/spool/lpd: +sync:x:5:0:sync:/sbin:/bin/sync +shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown +halt:x:7:0:halt:/sbin:/sbin/halt +mail:x:8:12:mail:/var/spool/mail: +news:x:9:13:news:/var/spool/news: +uucp:x:10:14:uucp:/var/spool/uucp: +operator:x:11:0:operator:/root: +games:x:12:100:games:/usr/games: +gopher:x:13:30:gopher:/usr/lib/gopher-data: +ftp:x:14:50:FTP User:/home/ftp: +nobody:x:99:99:Nobody:/: +xfs:x:43:43:X Font Server:/etc/X11/fs:/bin/false +gdm:x:42:42::/home/gdm:/bin/bash +dostrowski:x:500:500:Dominic Ostrowski:/home/dostrowski:/bin/bash diff --git a/packages/fs/jffs2/current/support/jffs2/jffs2.img b/packages/fs/jffs2/current/support/jffs2/jffs2.img new file mode 100644 index 0000000000000000000000000000000000000000..964095dbf8e5266fde4f0095b94be8889ac12f47 GIT binary patch literal 2376 zc$}S-c`(~s8^@C%qAJwZy7tRpY_+ttwPFdWrPLBz$%|_*Nl0wbDpIbXs#V&nmb6q_ zT3outUer>{rPO{acCWn)(rV;QZrvHo+kg6-dFDKG=A7sAob&yCPofxz1_uBDlG|H% zfUJ=nE5-o8XW(ac3U~ugHwYC=H)v;#fdBK6&67(L#eg&wRz8PTxXj)J+70$T4o(1| zNc%<1SmNhCU;J;(#63LF4|r`oX+PwpJ}Pcy^VC`SKtA2_Uls=|*!#c`0N_QGrHM}C zatYQ8hl})K{=>{;RoC+mY~t8u7R7&O-UNN`^VuGzD{BFJ9?Z(~S1+}J1f#^FP}cSy z7^24EOIzhMerwspvbzNoLv-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T8@2kA?8>{cvNiBe zlmc|~TC_SVM7bYkt}FNJoRc}V8`jA>y$uS_FgO{|?|vi||}F0eoV diff --git a/packages/fs/jffs2/current/tests/fileio1.c b/packages/fs/jffs2/current/tests/fileio1.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/tests/fileio1.c @@ -0,0 +1,669 @@ +//========================================================================== +// +// fileio1.c +// +// Test fileio system +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 2000-05-25 +// Purpose: Test fileio system +// Description: This test uses the testfs to check out the initialization +// and basic operation of the fileio system +// +// +// +// +// +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include + +#include // base kernel types +#include // tracing macros +#include // assertion macros +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include // HAL polled output + +#include // Address of JFFS2 + +//========================================================================== + +#if 0 +MTAB_ENTRY( jffs2_mte1, + "/", + "jffs2", + CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1, + 0); +#endif + +//========================================================================== + +#define SHOW_RESULT( _fn, _res ) \ +diag_printf(": " #_fn "() returned %d %s\n", _res, _res<0?strerror(errno):""); + +//========================================================================== + +#define IOSIZE 100 + +#define LONGNAME1 "long_file_name_that_should_take_up_more_than_one_directory_entry_1" +#define LONGNAME2 "long_file_name_that_should_take_up_more_than_one_directory_entry_2" + + +//========================================================================== + +#ifndef CYGPKG_LIBC_STRING + +char *strcat( char *s1, const char *s2 ) +{ + char *s = s1; + while( *s1 ) s1++; + while( (*s1++ = *s2++) != 0); + return s; +} + +#endif + +//========================================================================== + +static void listdir( char *name, int statp, int numexpected, int *numgot ) +{ + int err; + DIR *dirp; + int num=0; + + diag_printf(": reading directory %s\n",name); + + dirp = opendir( name ); + if( dirp == NULL ) SHOW_RESULT( opendir, -1 ); + + for(;;) + { + struct dirent *entry = readdir( dirp ); + + if( entry == NULL ) + break; + num++; + diag_printf(": entry %14s",entry->d_name); + if( statp ) + { + char fullname[PATH_MAX]; + struct stat sbuf; + + if( name[0] ) + { + strcpy(fullname, name ); + if( !(name[0] == '/' && name[1] == 0 ) ) + strcat(fullname, "/" ); + } + else fullname[0] = 0; + + strcat(fullname, entry->d_name ); + + err = stat( fullname, &sbuf ); + if( err < 0 ) + { + if( errno == ENOSYS ) + diag_printf(" "); + else SHOW_RESULT( stat, err ); + } + else + { + diag_printf(" [mode %08x ino %08x nlink %d size %d]", + sbuf.st_mode,sbuf.st_ino,sbuf.st_nlink,sbuf.st_size); + } + } + + diag_printf("\n"); + } + + err = closedir( dirp ); + if( err < 0 ) SHOW_RESULT( stat, err ); + if (numexpected >= 0 && num != numexpected) + CYG_TEST_FAIL("Wrong number of dir entries\n"); + if ( numgot != NULL ) + *numgot = num; +} + +//========================================================================== + +static void createfile( char *name, size_t size ) +{ + char buf[IOSIZE]; + int fd; + ssize_t wrote; + int i; + int err; + + diag_printf(": create file %s size %d\n",name,size); + + err = access( name, F_OK ); + if( err < 0 && errno != EACCES ) SHOW_RESULT( access, err ); + + for( i = 0; i < IOSIZE; i++ ) buf[i] = i%256; + + fd = open( name, O_WRONLY|O_CREAT ); + if( fd < 0 ) SHOW_RESULT( open, fd ); + + while( size > 0 ) + { + ssize_t len = size; + if ( len > IOSIZE ) len = IOSIZE; + + wrote = write( fd, buf, len ); + if( wrote != len ) SHOW_RESULT( write, wrote ); + + size -= wrote; + } + + err = close( fd ); + if( err < 0 ) SHOW_RESULT( close, err ); +} + +//========================================================================== + +#if 0 +static void maxfile( char *name ) +{ + char buf[IOSIZE]; + int fd; + ssize_t wrote; + int i; + int err; + size_t size = 0; + + diag_printf(": create maximal file %s\n",name); + + err = access( name, F_OK ); + if( err < 0 && errno != EACCES ) SHOW_RESULT( access, err ); + + for( i = 0; i < IOSIZE; i++ ) buf[i] = i%256; + + fd = open( name, O_WRONLY|O_CREAT ); + if( fd < 0 ) SHOW_RESULT( open, fd ); + + do + { + wrote = write( fd, buf, IOSIZE ); + if( wrote < 0 ) SHOW_RESULT( write, wrote ); + + size += wrote; + + } while( wrote == IOSIZE ); + + diag_printf(": file size == %d\n",size); + + err = close( fd ); + if( err < 0 ) SHOW_RESULT( close, err ); +} +#endif + +//========================================================================== + +static void checkfile( char *name ) +{ + char buf[IOSIZE]; + int fd; + ssize_t done; + int i; + int err; + off_t pos = 0; + + diag_printf(": check file %s\n",name); + + err = access( name, F_OK ); + if( err != 0 ) SHOW_RESULT( access, err ); + + fd = open( name, O_RDONLY ); + if( fd < 0 ) SHOW_RESULT( open, fd ); + + for(;;) + { + done = read( fd, buf, IOSIZE ); + if( done < 0 ) SHOW_RESULT( read, done ); + + if( done == 0 ) break; + + for( i = 0; i < done; i++ ) + if( buf[i] != i%256 ) + { + diag_printf("buf[%d+%d](%02x) != %02x\n",pos,i,buf[i],i%256); + CYG_TEST_FAIL("Data read not equal to data written\n"); + } + + pos += done; + } + + err = close( fd ); + if( err < 0 ) SHOW_RESULT( close, err ); +} + +//========================================================================== + +static void copyfile( char *name2, char *name1 ) +{ + + int err; + char buf[IOSIZE]; + int fd1, fd2; + ssize_t done, wrote; + + diag_printf(": copy file %s -> %s\n",name2,name1); + + err = access( name1, F_OK ); + if( err < 0 && errno != EACCES ) SHOW_RESULT( access, err ); + + err = access( name2, F_OK ); + if( err != 0 ) SHOW_RESULT( access, err ); + + fd1 = open( name1, O_WRONLY|O_CREAT ); + if( fd1 < 0 ) SHOW_RESULT( open, fd1 ); + + fd2 = open( name2, O_RDONLY ); + if( fd2 < 0 ) SHOW_RESULT( open, fd2 ); + + for(;;) + { + done = read( fd2, buf, IOSIZE ); + if( done < 0 ) SHOW_RESULT( read, done ); + + if( done == 0 ) break; + + wrote = write( fd1, buf, done ); + if( wrote != done ) SHOW_RESULT( write, wrote ); + + if( wrote != done ) break; + } + + err = close( fd1 ); + if( err < 0 ) SHOW_RESULT( close, err ); + + err = close( fd2 ); + if( err < 0 ) SHOW_RESULT( close, err ); + +} + +//========================================================================== + +static void comparefiles( char *name2, char *name1 ) +{ + int err; + char buf1[IOSIZE]; + char buf2[IOSIZE]; + int fd1, fd2; + ssize_t done1, done2; + int i; + + diag_printf(": compare files %s == %s\n",name2,name1); + + err = access( name1, F_OK ); + if( err != 0 ) SHOW_RESULT( access, err ); + + err = access( name1, F_OK ); + if( err != 0 ) SHOW_RESULT( access, err ); + + fd1 = open( name1, O_RDONLY ); + if( fd1 < 0 ) SHOW_RESULT( open, fd1 ); + + fd2 = open( name2, O_RDONLY ); + if( fd2 < 0 ) SHOW_RESULT( open, fd2 ); + + for(;;) + { + done1 = read( fd1, buf1, IOSIZE ); + if( done1 < 0 ) SHOW_RESULT( read, done1 ); + + done2 = read( fd2, buf2, IOSIZE ); + if( done2 < 0 ) SHOW_RESULT( read, done2 ); + + if( done1 != done2 ) + diag_printf("Files different sizes\n"); + + if( done1 == 0 ) break; + + for( i = 0; i < done1; i++ ) + if( buf1[i] != buf2[i] ) + { + diag_printf("buf1[%d](%02x) != buf1[%d](%02x)\n",i,buf1[i],i,buf2[i]); + CYG_TEST_FAIL("Data in files not equal\n"); + } + } + + err = close( fd1 ); + if( err < 0 ) SHOW_RESULT( close, err ); + + err = close( fd2 ); + if( err < 0 ) SHOW_RESULT( close, err ); + +} + +//========================================================================== + +void checkcwd( const char *cwd ) +{ + static char cwdbuf[PATH_MAX]; + char *ret; + + ret = getcwd( cwdbuf, sizeof(cwdbuf)); + if( ret == NULL ) SHOW_RESULT( getcwd, ret ); + + if( strcmp( cwdbuf, cwd ) != 0 ) + { + diag_printf( "cwdbuf %s cwd %s\n",cwdbuf, cwd ); + CYG_TEST_FAIL( "Current directory mismatch"); + } +} + +//========================================================================== +// main + +int main( int argc, char **argv ) +{ + int err; + //int i; + int existingdirents=-1; + + CYG_TEST_INIT(); + + // -------------------------------------------------------------- + + err = mount( CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1, "/", "jffs2" ); + if( err < 0 ) SHOW_RESULT( mount, err ); + + err = chdir( "/" ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + + checkcwd( "/" ); + + listdir( "/", true, -1, &existingdirents ); + if ( existingdirents < 2 ) + CYG_TEST_FAIL("Not enough dir entries\n"); + + // -------------------------------------------------------------- + + createfile( "/foo", 202 ); + checkfile( "foo" ); + copyfile( "foo", "fee"); + checkfile( "fee" ); + comparefiles( "foo", "/fee" ); + diag_printf(": mkdir bar\n"); + err = mkdir( "/bar", 0 ); + if( err < 0 ) SHOW_RESULT( mkdir, err ); + + listdir( "/" , true, existingdirents+3, NULL ); + + copyfile( "fee", "/bar/fum" ); + checkfile( "bar/fum" ); + comparefiles( "/fee", "bar/fum" ); + + diag_printf(": cd bar\n"); + err = chdir( "bar" ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + + checkcwd( "/bar" ); + + diag_printf(": rename /foo bundy\n"); + err = rename( "/foo", "bundy" ); + if( err < 0 ) SHOW_RESULT( rename, err ); + + listdir( "/", true, existingdirents+2, NULL ); + listdir( "" , true, 4, NULL ); + + checkfile( "/bar/bundy" ); + comparefiles("/fee", "bundy" ); + + // -------------------------------------------------------------- + + createfile( LONGNAME1, 123 ); + checkfile( LONGNAME1 ); + copyfile( LONGNAME1, LONGNAME2 ); + + listdir( "", false, 6, NULL ); + + diag_printf(": unlink " LONGNAME1 "\n"); + err = unlink( LONGNAME1 ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + + diag_printf(": unlink " LONGNAME2 "\n"); + err = unlink( LONGNAME2 ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + + + // -------------------------------------------------------------- + + diag_printf(": unlink fee\n"); + err = unlink( "/fee" ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + + diag_printf(": unlink fum\n"); + err = unlink( "fum" ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + + diag_printf(": unlink /bar/bundy\n"); + err = unlink( "/bar/bundy" ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + + diag_printf(": cd /\n"); + err = chdir( "/" ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + + checkcwd( "/" ); + + diag_printf(": rmdir /bar\n"); + err = rmdir( "/bar" ); + if( err < 0 ) SHOW_RESULT( rmdir, err ); + + listdir( "/", false, existingdirents, NULL ); + + // -------------------------------------------------------------- + + diag_printf(": mount /jffs2 \n"); + err = mount( CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1, "/jffs2", "jffs2" ); + if( err < 0 ) SHOW_RESULT( mount, err ); + + createfile( "/jffs2/tinky", 456 ); + copyfile( "/jffs2/tinky", "/jffs2/laalaa" ); + checkfile( "/jffs2/tinky"); + checkfile( "/jffs2/laalaa"); + comparefiles( "/jffs2/tinky", "/jffs2/laalaa" ); + + diag_printf(": cd /jffs2\n"); + err = chdir( "/jffs2" ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + + checkcwd( "/jffs2" ); + + diag_printf(": mkdir noonoo\n"); + err = mkdir( "noonoo", 0 ); + if( err < 0 ) SHOW_RESULT( mkdir, err ); + + listdir( "." , true, existingdirents+3, NULL); + + diag_printf(": cd noonoo\n"); + err = chdir( "noonoo" ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + + checkcwd( "/jffs2/noonoo" ); + + createfile( "tinky", 678 ); + checkfile( "tinky" ); + + createfile( "dipsy", 3456 ); + checkfile( "dipsy" ); + copyfile( "dipsy", "po" ); + checkfile( "po" ); + comparefiles( "dipsy", "po" ); + + + /*for(i=0;i<2048;i++) { + diag_printf(": churningchurningchurning................................ITERATION = %d\n", i); + createfile( "churningchurningchurning", 4096 ); + diag_printf(": unlink churningchurningchurning\n"); + err = unlink( "churningchurningchurning" ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + }*/ + + + listdir( ".", true, 5, NULL ); + listdir( "", true, 5, NULL ); + listdir( "..", true, existingdirents+3, NULL ); + + // -------------------------------------------------------------- + + diag_printf(": unlink tinky\n"); + err = unlink( "tinky" ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + + diag_printf(": unlink dipsy\n"); + err = unlink( "dipsy" ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + + diag_printf(": unlink po\n"); + err = unlink( "po" ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + + diag_printf(": cd ..\n"); + err = chdir( ".." ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + checkcwd( "/jffs2" ); + + diag_printf(": rmdir noonoo\n"); + err = rmdir( "noonoo" ); + if( err < 0 ) SHOW_RESULT( rmdir, err ); + + // -------------------------------------------------------------- + + err = mkdir( "x", 0 ); + if( err < 0 ) SHOW_RESULT( mkdir, err ); + + err = mkdir( "x/y", 0 ); + if( err < 0 ) SHOW_RESULT( mkdir, err ); + + err = mkdir( "x/y/z", 0 ); + if( err < 0 ) SHOW_RESULT( mkdir, err ); + + err = mkdir( "x/y/z/w", 0 ); + if( err < 0 ) SHOW_RESULT( mkdir, err ); + + diag_printf(": cd /jffs2/x/y/z/w\n"); + err = chdir( "/jffs2/x/y/z/w" ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + checkcwd( "/jffs2/x/y/z/w" ); + + diag_printf(": cd ..\n"); + err = chdir( ".." ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + checkcwd( "/jffs2/x/y/z" ); + + diag_printf(": cd .\n"); + err = chdir( "." ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + checkcwd( "/jffs2/x/y/z" ); + + diag_printf(": cd ../../y\n"); + err = chdir( "../../y" ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + checkcwd( "/jffs2/x/y" ); + + diag_printf(": cd ../..\n"); + err = chdir( "../.." ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + checkcwd( "/jffs2" ); + + diag_printf(": rmdir x/y/z/w\n"); + err = rmdir( "x/y/z/w" ); + if( err < 0 ) SHOW_RESULT( rmdir, err ); + + diag_printf(": rmdir x/y/z\n"); + err = rmdir( "x/y/z" ); + if( err < 0 ) SHOW_RESULT( rmdir, err ); + + diag_printf(": rmdir x/y\n"); + err = rmdir( "x/y" ); + if( err < 0 ) SHOW_RESULT( rmdir, err ); + + diag_printf(": rmdir x\n"); + err = rmdir( "x" ); + if( err < 0 ) SHOW_RESULT( rmdir, err ); + + // -------------------------------------------------------------- + + diag_printf(": unlink tinky\n"); + err = unlink( "tinky" ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + + diag_printf(": unlink laalaa\n"); + err = unlink( "laalaa" ); + if( err < 0 ) SHOW_RESULT( unlink, err ); + + diag_printf(": cd /\n"); + err = chdir( "/" ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + checkcwd( "/" ); + + diag_printf(": umount /jffs2\n"); + err = umount( "/jffs2" ); + if( err < 0 ) SHOW_RESULT( umount, err ); + + diag_printf(": umount /\n"); + err = umount( "/" ); + if( err < 0 ) SHOW_RESULT( umount, err ); + + CYG_TEST_PASS_FINISH("fileio1"); +} + +// ------------------------------------------------------------------------- +// EOF fileio1.c diff --git a/packages/fs/jffs2/current/tests/romfileio1.c b/packages/fs/jffs2/current/tests/romfileio1.c new file mode 100644 --- /dev/null +++ b/packages/fs/jffs2/current/tests/romfileio1.c @@ -0,0 +1,368 @@ +//========================================================================== +// +// fileio1.c +// +// Test fileio system +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, richard.panton@3glab.com +// Date: 2000-05-25 +// Purpose: Test fileio system +// Description: This test uses the testfs to check out the initialization +// and basic operation of the fileio system +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include + +#include // base kernel types +#include // tracing macros +#include // assertion macros + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include // HAL polled output + +#include // Address of JFFS2 + +//========================================================================== + +/* MTAB_ENTRY( jffs2_mte1, + "/", + "jffs2", + "", + (CYG_ADDRWORD) CYGNUM_FS_JFFS2_BASE_ADDRESS ); */ + + +//========================================================================== + +#define SHOW_RESULT( _fn, _res ) \ +diag_printf(": " #_fn "() returned %d %s\n", _res, _res<0?strerror(errno):""); + +#define CHKFAIL_TYPE( _fn, _res, _type ) { \ +if ( _res != -1 ) \ + diag_printf(": " #_fn "() returned %d (expected -1)\n", _res); \ +else if ( errno != _type ) \ + diag_printf(": " #_fn "() failed with errno %d (%s),\n expected %d (%s)\n", errno, strerror(errno), _type, strerror(_type) ); \ +} + +//========================================================================== + +#define IOSIZE 100 + +#define LONGNAME1 "long_file_name_that_should_take_up_more_than_one_directory_entry_1" +#define LONGNAME2 "long_file_name_that_should_take_up_more_than_one_directory_entry_2" + + +//========================================================================== + +#ifndef CYGPKG_LIBC_STRING + +char *strcat( char *s1, const char *s2 ) +{ + char *s = s1; + while( *s1 ) s1++; + while( (*s1++ = *s2++) != 0); + return s; +} + +#endif + +//========================================================================== + +static void listdir( char *name, int statp ) +{ + int err; + DIR *dirp; + + diag_printf(": reading directory %s\n",name); + + dirp = opendir( name ); + if( dirp == NULL ) SHOW_RESULT( opendir, -1 ); + + for(;;) + { + struct dirent *entry = readdir( dirp ); + + if( entry == NULL ) + break; + + diag_printf(": entry %14s",entry->d_name); + if( statp ) + { + char fullname[PATH_MAX]; + struct stat sbuf; + + if( name[0] ) + { + strcpy(fullname, name ); + if( !(name[0] == '/' && name[1] == 0 ) ) + strcat(fullname, "/" ); + } + else fullname[0] = 0; + + strcat(fullname, entry->d_name ); + + err = stat( fullname, &sbuf ); + if( err < 0 ) + { + if( errno == ENOSYS ) + diag_printf(" "); + else SHOW_RESULT( stat, err ); + } + else + { + diag_printf(" [mode %08x ino %08x nlink %d size %d]", + sbuf.st_mode,sbuf.st_ino,sbuf.st_nlink,sbuf.st_size); + } + } + + diag_printf("\n"); + } + + err = closedir( dirp ); + if( err < 0 ) SHOW_RESULT( stat, err ); +} + +//========================================================================== + +static void copyfile( char *name2, char *name1 ) +{ + + int err; + char buf[IOSIZE]; + int fd1, fd2; + ssize_t done, wrote; + + diag_printf(": copy file %s -> %s\n",name2,name1); + + err = access( name1, F_OK ); + if( err < 0 && errno != EACCES ) SHOW_RESULT( access, err ); + + err = access( name2, F_OK ); + if( err != 0 ) SHOW_RESULT( access, err ); + + fd1 = open( name1, O_WRONLY|O_CREAT ); + if( fd1 < 0 ) SHOW_RESULT( open, fd1 ); + + fd2 = open( name2, O_RDONLY ); + if( fd2 < 0 ) SHOW_RESULT( open, fd2 ); + + for(;;) + { + done = read( fd2, buf, IOSIZE ); + if( done < 0 ) SHOW_RESULT( read, done ); + + if( done == 0 ) break; + + wrote = write( fd1, buf, done ); + if( wrote != done ) SHOW_RESULT( write, wrote ); + + if( wrote != done ) break; + } + + err = close( fd1 ); + if( err < 0 ) SHOW_RESULT( close, err ); + + err = close( fd2 ); + if( err < 0 ) SHOW_RESULT( close, err ); + +} + +//========================================================================== + +static void comparefiles( char *name2, char *name1 ) +{ + int err; + char buf1[IOSIZE]; + char buf2[IOSIZE]; + int fd1, fd2; + ssize_t done1, done2; + int i; + + diag_printf(": compare files %s == %s\n",name2,name1); + + err = access( name1, F_OK ); + if( err != 0 ) SHOW_RESULT( access, err ); + + err = access( name1, F_OK ); + if( err != 0 ) SHOW_RESULT( access, err ); + + fd1 = open( name1, O_RDONLY ); + if( fd1 < 0 ) SHOW_RESULT( open, fd1 ); + + fd2 = open( name2, O_RDONLY ); + if( fd2 < 0 ) SHOW_RESULT( open, fd2 ); + + for(;;) + { + done1 = read( fd1, buf1, IOSIZE ); + if( done1 < 0 ) SHOW_RESULT( read, done1 ); + + done2 = read( fd2, buf2, IOSIZE ); + if( done2 < 0 ) SHOW_RESULT( read, done2 ); + + if( done1 != done2 ) + diag_printf("Files different sizes\n"); + + if( done1 == 0 ) break; + + for( i = 0; i < done1; i++ ) + if( buf1[i] != buf2[i] ) + { + diag_printf("buf1[%d](%02x) != buf1[%d](%02x)\n",i,buf1[i],i,buf2[i]); + CYG_TEST_FAIL("Data in files not equal\n"); + } + } + + err = close( fd1 ); + if( err < 0 ) SHOW_RESULT( close, err ); + + err = close( fd2 ); + if( err < 0 ) SHOW_RESULT( close, err ); + +} + +//========================================================================== +// main + +int main( int argc, char **argv ) +{ + int err; + char address[16]; + + CYG_TEST_INIT(); + + // -------------------------------------------------------------- + + err = mount( "", "/", "jffs2" ); + + diag_printf(": JFFS2 root follows\n"); + diag_printf(": Note that dev cannot be stat()ed\n"); + listdir( "/", true ); + + diag_printf(": cd /etc\n" ); + err = chdir( "/etc" ); + if ( err < 0 ) SHOW_RESULT( chdir, err ); + + diag_printf(": JFFS2 list of '' follows\n"); + listdir( "", true ); + + diag_printf(": JFFS2 list of /etc follows\n"); + listdir( "/etc", true ); + + //diag_printf(": JFFS2 list of . follows\n"); + //listdir( ".", true ); + + err = mount( "", "/var", "ramfs" ); + if( err < 0 ) SHOW_RESULT( mount, err ); + + copyfile( "/etc/passwd", "/var/passwd_copy" ); + + comparefiles( "/etc/passwd", "/var/passwd_copy" ); + + diag_printf(": JFFS2 list of / follows\n"); + diag_printf(": Note that /var now gives stat() info for RAMFS\n"); + listdir( "/", true ); + + diag_printf(": Mount JFFS2 again onto /mnt\n"); + //sprintf( address, "%p", (void*)CYGNUM_FS_JFFS2_BASE_ADDRESS ); + err = mount( "", "/mnt", "jffs2" ); + if( err < 0 ) SHOW_RESULT( mount, err ); + + comparefiles( "/etc/passwd", "/mnt/etc/passwd" ); + + + err = mkdir( "/foo", 0 ); + CHKFAIL_TYPE( mkdir, err, EROFS ); + + err = rename( "/var", "/tmp" ); // RAMFS is mounted here + CHKFAIL_TYPE( rename, err, EXDEV ); + + err = rename( "/var/passwd_copy", "/mnt/etc/passwd_copy" ); + CHKFAIL_TYPE( rename, err, EXDEV ); + + err = rename( "/etc", "/tmp" ); + CHKFAIL_TYPE( rename, err, EROFS ); + + diag_printf(": cd /etc\n"); + err = chdir( "/etc" ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + + err = chdir( "/mnt/etc" ); + if( err < 0 ) SHOW_RESULT( chdir, err ); + + //listdir( ".", true ); + + diag_printf(": unlink /tmp\n"); + err = unlink( "/tmp" ); + CHKFAIL_TYPE( unlink, err, EROFS ); + + diag_printf(": mount random area\n"); + //sprintf(address, "%p", (void*)(CYGNUM_FS_JFFS2_BASE_ADDRESS + 0x20000)); + err = mount( "", "/tmp", "jffs2" ); + SHOW_RESULT( mount, err ); + + err = umount( "/mnt" ); + if( err < 0 ) SHOW_RESULT( umount, err ); + + err = umount( "/var" ); + if( err < 0 ) SHOW_RESULT( umount, err ); + + err = umount( "/" ); + if( err < 0 ) SHOW_RESULT( umount, err ); + + + CYG_TEST_PASS_FINISH("fileio1"); +} + +// ------------------------------------------------------------------------- +// EOF fileio1.c diff --git a/packages/fs/ram/current/ChangeLog b/packages/fs/ram/current/ChangeLog --- a/packages/fs/ram/current/ChangeLog +++ b/packages/fs/ram/current/ChangeLog @@ -1,3 +1,8 @@ +2002-01-25 Jonathan Larmour + + * tests/fileio1.c (main): Check in listdir that the number of + dirents is correct. + 2001-07-26 Jonathan Larmour * src/ramfs.c (findbuffer_indirect1): Determine correct offset in @@ -23,29 +28,38 @@ 2000-08-18 Nick Garnett : reading directory %s\n",name); @@ -123,7 +133,7 @@ static void listdir( char *name, int sta if( entry == NULL ) break; - + num++; diag_printf(": entry %14s",entry->d_name); if( statp ) { @@ -159,6 +169,10 @@ static void listdir( char *name, int sta err = closedir( dirp ); if( err < 0 ) SHOW_RESULT( stat, err ); + if (numexpected >= 0 && num != numexpected) + CYG_TEST_FAIL("Wrong number of dir entries\n"); + if ( numgot != NULL ) + *numgot = num; } //========================================================================== @@ -396,6 +410,7 @@ void checkcwd( const char *cwd ) int main( int argc, char **argv ) { int err; + int existingdirents=-1; CYG_TEST_INIT(); @@ -409,6 +424,10 @@ int main( int argc, char **argv ) checkcwd( "/" ); + listdir( "/", true, -1, &existingdirents ); + if ( existingdirents < 2 ) + CYG_TEST_FAIL("Not enough dir entries\n"); + // -------------------------------------------------------------- createfile( "/foo", 202 ); @@ -416,11 +435,11 @@ int main( int argc, char **argv ) copyfile( "foo", "fee"); checkfile( "fee" ); comparefiles( "foo", "/fee" ); - + diag_printf(": mkdir bar\n"); err = mkdir( "/bar", 0 ); if( err < 0 ) SHOW_RESULT( mkdir, err ); - listdir( "/" , true); + listdir( "/" , true, existingdirents+3, NULL ); copyfile( "fee", "/bar/fum" ); checkfile( "bar/fum" ); @@ -435,9 +454,9 @@ int main( int argc, char **argv ) diag_printf(": rename /foo bundy\n"); err = rename( "/foo", "bundy" ); if( err < 0 ) SHOW_RESULT( rename, err ); - - listdir( "/", true ); - listdir( "" , true ); + + listdir( "/", true, existingdirents+2, NULL ); + listdir( "" , true, 4, NULL ); checkfile( "/bar/bundy" ); comparefiles("/fee", "bundy" ); @@ -448,7 +467,7 @@ int main( int argc, char **argv ) checkfile( LONGNAME1 ); copyfile( LONGNAME1, LONGNAME2 ); - listdir( "", false ); + listdir( "", false, 6, NULL ); diag_printf(": unlink " LONGNAME1 "\n"); err = unlink( LONGNAME1 ); @@ -482,8 +501,8 @@ int main( int argc, char **argv ) diag_printf(": rmdir /bar\n"); err = rmdir( "/bar" ); if( err < 0 ) SHOW_RESULT( rmdir, err ); - - listdir( "/", false ); + + listdir( "/", false, existingdirents, NULL ); // -------------------------------------------------------------- @@ -507,7 +526,7 @@ int main( int argc, char **argv ) err = mkdir( "noonoo", 0 ); if( err < 0 ) SHOW_RESULT( mkdir, err ); - listdir( "." , true ); + listdir( "." , true, existingdirents+3, NULL); diag_printf(": cd noonoo\n"); err = chdir( "noonoo" ); @@ -524,9 +543,9 @@ int main( int argc, char **argv ) checkfile( "po" ); comparefiles( "dipsy", "po" ); - listdir( ".", true ); - listdir( "", true ); - listdir( "..", true ); + listdir( ".", true, 5, NULL ); + listdir( "", true, 5, NULL ); + listdir( "..", true, existingdirents+3, NULL ); // -------------------------------------------------------------- diff --git a/packages/fs/rom/current/ChangeLog b/packages/fs/rom/current/ChangeLog --- a/packages/fs/rom/current/ChangeLog +++ b/packages/fs/rom/current/ChangeLog @@ -1,3 +1,18 @@ +2002-04-15 Bart Veer + + * support/file2c.tcl: + Do not use an alignment attribute, since it is not honoured on + all targets. + + * src/romfs.c: + Remove alignment restrictions, since they are not actually needed + yet and alignment is hard to guarantee on all targets. + +2002-01-21 Jonathan Larmour + + * support/mk_romfs.c: Open image file in binary mode (for cygwin). + Spotted by Warren Jasper. + 2001-11-23 Jonathan Larmour * cdl/romfs.cdl (CYGTST_ROMFS_BUILD_TESTS): Try gcc and cc if $HOST_CC @@ -41,29 +56,38 @@ 2000-10-25 Richard Panton (richard.pant //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/fs/rom/current/cdl/romfs.cdl b/packages/fs/rom/current/cdl/romfs.cdl --- a/packages/fs/rom/current/cdl/romfs.cdl +++ b/packages/fs/rom/current/cdl/romfs.cdl @@ -5,29 +5,38 @@ # ROM Filesystem configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/fs/rom/current/src/romfs.c b/packages/fs/rom/current/src/romfs.c --- a/packages/fs/rom/current/src/romfs.c +++ b/packages/fs/rom/current/src/romfs.c @@ -5,29 +5,38 @@ // ROM file system // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -99,11 +108,6 @@ // Each file has its data stored in a single contiguous memory block // referenced by the offset in the node. // -// [ The start of the data for each node is aligned to a boundary - a four ] -// [ byte boundary in the case of data files, or a PAGESIZE boudary in the ] -// [ case of executable files. This alignment is enforced by the mk_romfs ] -// [ program, and has no effect on the code contained in this file. ] -// //========================================================================== #include @@ -134,9 +138,6 @@ #include //========================================================================== -// Alignment values. Must tie in with the similar defintions given in mk_romfs.c -#define ROMFS_DIRENT_ALIGNMENT 32 - // Eventually we want to eXecute In Place from the ROM in a protected // environment, so we'll need executables to be aligned to a boundary // suitable for MMU protection. A suitable boundary would be the 4k @@ -394,9 +395,6 @@ static romfs_dirent *find_direntry( romf if( err != ENOERR || size == 0) return NULL; - if ( (int)buf & (ROMFS_DIRENT_ALIGNMENT-1) ) - return NULL; - d = (romfs_dirent *)buf; // Is this the directory entry we're looking for? diff --git a/packages/fs/rom/current/support/Makefile b/packages/fs/rom/current/support/Makefile --- a/packages/fs/rom/current/support/Makefile +++ b/packages/fs/rom/current/support/Makefile @@ -1,27 +1,36 @@ #========================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http:#www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### #========================================================================== CC = gcc diff --git a/packages/fs/rom/current/support/file2c.tcl b/packages/fs/rom/current/support/file2c.tcl --- a/packages/fs/rom/current/support/file2c.tcl +++ b/packages/fs/rom/current/support/file2c.tcl @@ -16,29 +16,38 @@ # Convert a file into a header that can be #included from C. # #=============================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### #=============================================================================== ######DESCRIPTIONBEGIN#### # @@ -83,7 +92,7 @@ if { $status != 0 } { } append result "/* This is a generated file. Do not edit. */\n\n" -append result "static const unsigned char filedata\[\] __attribute__((aligned(32))) = {\n" +append result "static const unsigned char filedata\[\] = {\n" set datalength [ string length $data ] diff --git a/packages/fs/rom/current/support/mk_romfs.c b/packages/fs/rom/current/support/mk_romfs.c --- a/packages/fs/rom/current/support/mk_romfs.c +++ b/packages/fs/rom/current/support/mk_romfs.c @@ -5,29 +5,38 @@ // Create ROM file system image // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -704,7 +713,7 @@ int main(int ac, char *av[]) { verb_printf(VERB_MINIMUM, "Phase 3 - Construct ROMFS image file (%ld kb)\n", ALIGN_TO( coffset, 1024 )/1024); if ( dowrite ) { - if ( (fd = open( av[2], O_WRONLY|O_CREAT|O_TRUNC, 0666 )) < 0 ) { + if ( (fd = open( av[2], O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666 )) < 0 ) { fatal_error(EXIT_WRITE,"Failed to open output file '%s', errno=%d\n", av[2], errno ); } } else { diff --git a/packages/fs/rom/current/tests/fileio1.c b/packages/fs/rom/current/tests/fileio1.c --- a/packages/fs/rom/current/tests/fileio1.c +++ b/packages/fs/rom/current/tests/fileio1.c @@ -5,29 +5,38 @@ // Test fileio system // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/aeb/current/ChangeLog b/packages/hal/arm/aeb/current/ChangeLog --- a/packages/hal/arm/aeb/current/ChangeLog +++ b/packages/hal/arm/aeb/current/ChangeLog @@ -1,3 +1,24 @@ +2002-05-13 Jesper Skov + + * cdl/hal_arm_aeb.cdl: Removed implemntation of + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + +2002-04-24 Jesper Skov + + * cdl/hal_arm_aeb.cdl: CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES defined. + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + +2002-01-23 Jesper Skov + + * include/hal_cache.h (HAL_UCACHE_SYNC): Fixed to use word + access. + * include/hal_platform_setup.h: Set up mapping for cache + region. It should fall back to SDR8, but that does not appear to + work for some reason. + 2001-10-02 Jonathan Larmour * cdl/hal_arm_aeb.cdl (CYGBLD_BUILD_REDBOOT_BIN): cygtclsh80 on @@ -552,27 +573,36 @@ 1998-12-15 Gary Thomas " puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + + puts $::cdl_header "#define CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES 100000" } cdl_component CYG_HAL_STARTUP { diff --git a/packages/hal/arm/aeb/current/include/hal_cache.h b/packages/hal/arm/aeb/current/include/hal_cache.h --- a/packages/hal/arm/aeb/current/include/hal_cache.h +++ b/packages/hal/arm/aeb/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -103,15 +112,14 @@ // Synchronize the contents of the cache with memory. #define HAL_UCACHE_SYNC() \ { \ - register volatile cyg_uint8 *cache_SRAM = \ - (volatile cyg_uint8*) CYG_DEVICE_CACHE_MEM; \ + register volatile cyg_uint32 *cache_SRAM = \ + (volatile cyg_uint32*) CYG_DEVICE_CACHE_MEM; \ register int i; \ register cyg_uint8 old_ccr; \ HAL_READ_UINT8(CYG_DEVICE_CCR, old_ccr); \ HAL_WRITE_UINT8(CYG_DEVICE_CCR, CCR_F); \ for (i = 0; i < HAL_DCACHE_SETS; i++) { \ - *cache_SRAM = 0; \ - cache_SRAM += HAL_DCACHE_LINE_SIZE; \ + cyg_uint32 tmp = *cache_SRAM++; \ } \ HAL_WRITE_UINT8(CYG_DEVICE_CCR, CCR_I); \ HAL_WRITE_UINT8(CYG_DEVICE_CCR, old_ccr); \ diff --git a/packages/hal/arm/aeb/current/include/hal_diag.h b/packages/hal/arm/aeb/current/include/hal_diag.h --- a/packages/hal/arm/aeb/current/include/hal_diag.h +++ b/packages/hal/arm/aeb/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/aeb/current/include/hal_platform_ints.h b/packages/hal/arm/aeb/current/include/hal_platform_ints.h --- a/packages/hal/arm/aeb/current/include/hal_platform_ints.h +++ b/packages/hal/arm/aeb/current/include/hal_platform_ints.h @@ -7,29 +7,38 @@ // HAL Interrupt and clock assignments for AEB-1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/aeb/current/include/hal_platform_setup.h b/packages/hal/arm/aeb/current/include/hal_platform_setup.h --- a/packages/hal/arm/aeb/current/include/hal_platform_setup.h +++ b/packages/hal/arm/aeb/current/include/hal_platform_setup.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -57,19 +66,14 @@ #ifdef CYGHWR_HAL_ARM_AEB_REVISION_C // AEB rev C has 256kB of memory. Cache is working (set cachable) -#if 0 #define AEB_SRAM .long 0xFFFFA008,0x00008000,0x00048000,0x00007c04 #define AEB_BAD .long 0xFFFFA00C,0x00048000,0x01000000,0x00000000 -#else -// FIXME: There is a cache problem of some sort. Either eCos or the -// chip. Leave cache disabled till I find the time to fix it. Jesper -#define AEB_SRAM .long 0xFFFFA008,0x00008000,0x00048000,0x00007804 -#define AEB_BAD .long 0xFFFFA00C,0x00048000,0x01000000,0x00000000 -#endif +#define AEB_CACHE .long 0xFFFFA010,0x60000000,0x61000000,0x00007801 #else // AEB rev B has 128kB of memory. Cache is broken (clear cachable) #define AEB_SRAM .long 0xFFFFA008,0x00008000,0x00028000,0x00007804 #define AEB_BAD .long 0xFFFFA00C,0x00028000,0x01000000,0x00000000 +#define AEB_CACHE .long 0xFFFFA010,0x60000000,0x61000000,0x00007801 #endif #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS @@ -94,6 +98,7 @@ 10: ldr r2,[r1,#0] /* segment address */ segment_register_setups: ;\ AEB_SRAM /* segment 2 */ ;\ AEB_BAD /* segment 3 */ ;\ + AEB_CACHE /* segment 1 */ ;\ .long 0 ;\ 20: #else diff --git a/packages/hal/arm/aeb/current/include/plf_io.h b/packages/hal/arm/aeb/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/aeb/current/include/plf_io.h @@ -0,0 +1,58 @@ +#ifndef CYGONCE_HAL_ARM_AEB_PLF_IO_H +#define CYGONCE_HAL_ARM_AEB_PLF_IO_H + +/*============================================================================= +// +// plf_io.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#endif // CYGONCE_HAL_ARM_AEB_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/aeb/current/include/plf_stub.h b/packages/hal/arm/aeb/current/include/plf_stub.h --- a/packages/hal/arm/aeb/current/include/plf_stub.h +++ b/packages/hal/arm/aeb/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/aeb/current/src/Notes_GDB_stub b/packages/hal/arm/aeb/current/src/Notes_GDB_stub --- a/packages/hal/arm/aeb/current/src/Notes_GDB_stub +++ b/packages/hal/arm/aeb/current/src/Notes_GDB_stub @@ -1,27 +1,36 @@ =========================================================================== -####COPYRIGHTBEGIN#### - - ------------------------------------------- - The contents of this file are subject to the Red Hat eCos Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.redhat.com/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations under - the License. - - The Original Code is eCos - Embedded Configurable Operating System, - released September 30, 1998. - - The Initial Developer of the Original Code is Red Hat. - Portions created by Red Hat are - Copyright (C) 1998, 1999, 2000 Red Hat, Inc. - All Rights Reserved. - ------------------------------------------- - -####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### =========================================================================== 1999-01-05, revised 1999-03-11, revised 2000.01.26 diff --git a/packages/hal/arm/aeb/current/src/aeb_misc.c b/packages/hal/arm/aeb/current/src/aeb_misc.c --- a/packages/hal/arm/aeb/current/src/aeb_misc.c +++ b/packages/hal/arm/aeb/current/src/aeb_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for ARM AEB-1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/aeb/current/src/flash_cksum.tcl b/packages/hal/arm/aeb/current/src/flash_cksum.tcl --- a/packages/hal/arm/aeb/current/src/flash_cksum.tcl +++ b/packages/hal/arm/aeb/current/src/flash_cksum.tcl @@ -16,29 +16,38 @@ # Compute the checksum for a AEB-1 flash module # #=============================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### #=============================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/hal/arm/aeb/current/src/gdb_module.c b/packages/hal/arm/aeb/current/src/gdb_module.c --- a/packages/hal/arm/aeb/current/src/gdb_module.c +++ b/packages/hal/arm/aeb/current/src/gdb_module.c @@ -5,29 +5,38 @@ // ARM AEB-1 eval board GDB stubs (module wrapper) // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/aeb/current/src/hal_diag.c b/packages/hal/arm/aeb/current/src/hal_diag.c --- a/packages/hal/arm/aeb/current/src/hal_diag.c +++ b/packages/hal/arm/aeb/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/arch/current/ChangeLog b/packages/hal/arm/arch/current/ChangeLog --- a/packages/hal/arm/arch/current/ChangeLog +++ b/packages/hal/arm/arch/current/ChangeLog @@ -1,3 +1,130 @@ +2002-05-20 Gary Thomas + + * include/hal_io.h: Fix ...STRING macros - not using index. + Pointed out by Thomas Koeller . + +2002-05-09 Nick Garnett + + * src/vectors.S (handle_IRQ_or_FIQ): Save SVC mode LR in interrupt + handling as well as exceptions. + + * src/context.S (hal_thread_switch_context): Use correct size + for skipping new HAL_SavedRegisters fields. + +2002-05-08 Jonathan Larmour + + * cdl/hal_arm.cdl: Remove -malignment-traps here - add it only from + packages when needed. + +2002-05-08 Nick Garnett + + * src/vectors.S: Added code to save and restore value of SVC mode + LR during exception processing. If the exception comes from a + non-SVC mode then handling it originally corrupted the SVC mode + LR. If the program subsequent returned to SVC mode it was likely + to have problems. The registers for modes other than SVC and the + exception mode are not touched, so we do not have to save/restore + those. + + * src/hal_mk_defs.c: Added definitions for armreg_r10 and + armreg_svclr. + + * include/hal_arch.h: Added svc_lr field to HAL_SavedRegisters to + save SVC mode link register during exception handling. + +2002-04-30 Jesper Skov + + * cdl/hal_arm.cdl: Forcibly add -malignment-traps to the compiler + options to work around problem with recent compiler. This can be + removed when the tools are respun. + +2002-04-29 Jonathan Larmour + + * src/vectors.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-25 Gary Thomas + + * src/vectors.S: Safer clearing of BSS. + +2002-04-15 Jonathan Larmour + + * src/hal_syscall.c (hal_syscall_handler): Add extra sig argument to + __do_syscall. + +2002-04-15 Mark Salter + + * src/vectors.S: Rewrite exception handling to allow exceptions + in any privileged mode. + * src/hal_mk_defs.c (main): Add some regs. + * include/hal_arch.h (HAL_SavedRegisters): Slight rearrangement. + * src/context.S (hal_thread_switch_context): Use new context layout. + (hal_thread_load_context): Ditto. + +2002-04-11 Jesper Skov + + * src/arm.ld: Fixed .sbss rule. + +2002-04-10 Jonathan Larmour + + * src/arm.ld: Define .gnu.linkonce sections properly. + Remove sbss from data section. + +2002-03-27 Gary Thomas + + * src/vectors.S: Use interrupt stack during system initialzation + if configured since this stack will be much larger than the default + idle thread stack. Some configurations (think networking) may use + lots of stack space during system startup and the assumption that + the idle thread stack does not need much space fails miserably. + +2002-02-19 Mark Salter + + * src/arm_stub.c (target_thumb_ins): Check architecture version + to decide how to handle pop insn. + (v5T_semantics): New function. Returns true for v5 and later. + +2002-02-08 Jesper Skov + + * src/arm_stub.c (target_thumb_ins): The result of a POP + instruction changing the PC must be the address of a THUMB + instruction. + +2002-01-29 Jesper Skov + + * src/redboot_linux_exec.c: Include hal_io.h instead of CRUFT_H. + (do_exec): Add nops after loop copying trampoline code. Removed + one argument to the assembly: code only works if virt==phys + mapping anyway. This should be rewritten to be safe for all + possible targets. + +2002-01-28 Jesper Skov + + * include/hal_io.h: Include var_io.h if present, otherwise include + plf_io.h. This makes the ARM HAL match the other HALs better in + this regard, allowing platform IO definitions to override variant + IO definitions while allowing sharing code between platforms of + the same variant. + +2002-01-25 Jesper Skov + + * cdl/hal_arm.cdl: Added RedBoot options. + * src/redboot_linux_exec.c: Added generic version of the RedBoot + exec command to be shared by all ARM platforms. Still needs some + cleaning up after CYGARC_ memory macros find their proper home. + +2002-01-08 Hugo Tyson + + * cdl/hal_arm.cdl (CYGOPT_HAL_ARM_SYSCALL_GPROF_SUPPORT): New + option, implements CYGINT_REDBOOT_BSP_SYSCALLS_GPROF_SUPPORT so + RedBoot knows we can do this. Only active if indeed we can. + + * include/hal_arch.h (HAL_GET_PROFILE_INFO): New macro, to extract + the interrupted PC and SP from a struct HAL_SavedRegisters. Used + for histogram-style profiling. + 2001-11-02 Hugo Tyson * include/arm_stub.h (CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION): Nasty @@ -446,6 +573,7 @@ 2000-02-09 Jesper Skov * cdl/hal_arm.cdl: Add missing CYGIMP_HAL_PROCESS_ALL_EXCEPTIONS + and CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT options from include/pkgconf/hal_arm.h 2000-02-01 Jesper Skov @@ -650,6 +778,12 @@ 1999-10-11 Jesper Skov + + * include/pkgconf/hal_arm.h: + * src/vectors.S: + * src/arm_stub.c: Add thread debug support via Multi-ICE. + 1999-10-08 Jonathan Larmour * src/arm.ld (SECTION_bss): Make *(.bss*) rather than just .bss, to @@ -1308,27 +1442,36 @@ 1998-10-16 Bart Veer cpsr = _regval_[25]; \ CYG_MACRO_END +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) || defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) +#define HAL_GET_PROFILE_INFO( _thepc_, _thesp_ ) \ + CYG_MACRO_START \ + extern HAL_SavedRegisters *hal_saved_interrupt_state; \ + if ( hal_saved_interrupt_state ) { \ + (_thepc_) = (char *)(hal_saved_interrupt_state->pc); \ + (_thesp_) = (char *)(hal_saved_interrupt_state->sp); \ + } \ + CYG_MACRO_END +#endif + //-------------------------------------------------------------------------- // HAL setjmp diff --git a/packages/hal/arm/arch/current/include/hal_intr.h b/packages/hal/arm/arch/current/include/hal_intr.h --- a/packages/hal/arm/arch/current/include/hal_intr.h +++ b/packages/hal/arm/arch/current/include/hal_intr.h @@ -8,29 +8,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/arch/current/include/hal_io.h b/packages/hal/arm/arch/current/include/hal_io.h --- a/packages/hal/arm/arch/current/include/hal_io.h +++ b/packages/hal/arm/arch/current/include/hal_io.h @@ -8,29 +8,38 @@ // HAL device IO register support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -56,6 +65,15 @@ #include //----------------------------------------------------------------------------- +// Include plf_io.h for platforms. Either via var_io.h or directly. +#ifdef CYGBLD_HAL_ARM_VAR_IO_H +#include +#else +#include +#endif + + +//----------------------------------------------------------------------------- // IO Register address. // This type is for recording the address of an IO register. @@ -93,7 +111,7 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG CYG_MACRO_START \ cyg_count32 _i_; \ for( _i_ = 0; _i_ < (_count_); _i_++) \ - (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_)); \ + (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_))[_i_]; \ CYG_MACRO_END #define HAL_WRITE_UINT8_STRING( _register_, _buf_, _count_ ) \ @@ -132,7 +150,7 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG cyg_count32 _i_; \ volatile CYG_BYTE* _r_ = ((CYG_ADDRWORD)(_register_)^3); \ for( _i_ = 0; _i_ < (_count_); _i_++; \ - (_buf_)[_i_] = _r_; \ + (_buf_)[_i_] = _r_[_i_]; \ CYG_MACRO_END #define HAL_WRITE_UINT8_STRING( _register_, _buf_, _count_ ) \ @@ -140,7 +158,7 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG cyg_count32 _i_; \ volatile CYG_BYTE* _r_ = ((CYG_ADDRWORD)(_register_)^3); \ for( _i_ = 0; _i_ < (_count_); _i_++) \ - _r_ = (_buf_)[_i_]; \ + _r_[_i_] = (_buf_)[_i_]; \ CYG_MACRO_END #endif // Big-endian @@ -176,14 +194,14 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG CYG_MACRO_START \ cyg_count32 _i_; \ for( _i_ = 0; _i_ < (_count_); _i_++) \ - (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_)); \ + (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_))[_i_]; \ CYG_MACRO_END #define HAL_WRITE_UINT16_STRING( _register_, _buf_, _count_) \ CYG_MACRO_START \ cyg_count32 _i_; \ for( _i_ = 0; _i_ < (_count_); _i_++) \ - ((volatile CYG_WORD16 *)(_register_)) = (_buf_)[_i_]; \ + ((volatile CYG_WORD16 *)(_register_))[_i_] = (_buf_)[_i_]; \ CYG_MACRO_END @@ -216,7 +234,7 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG cyg_count32 _i_; \ volatile CYG_WORD16* _r_ = ((CYG_ADDRWORD)(_register_)^3); \ for( _i_ = 0 = 0; _i_ < (_count_); _i_++) \ - (_buf_)[_i_] = _r_; \ + (_buf_)[_i_] = _r_[_i_]; \ CYG_MACRO_END #define HAL_WRITE_UINT16_STRING( _register_, _buf_, _count_) \ @@ -224,7 +242,7 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG cyg_count32 _i_; \ volatile CYG_WORD16* _r_ = ((CYG_ADDRWORD)(_register_)^3); \ for( _i_ = 0 = 0; _i_ < (_count_); _i_++) \ - _r_ = (_buf_)[_i_]; \ + _r_[_i_] = (_buf_)[_i_]; \ CYG_MACRO_END @@ -260,14 +278,14 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG CYG_MACRO_START \ cyg_count32 _i_; \ for( _i_ = 0; _i_ < (_count_); _i_++) \ - (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_)); \ + (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_))[_i_]; \ CYG_MACRO_END #define HAL_WRITE_UINT32_STRING( _register_, _buf_, _count_) \ CYG_MACRO_START \ cyg_count32 _i_; \ for( _i_ = 0; _i_ < (_count_); _i_++) \ - ((volatile CYG_WORD32 *)(_register_)) = (_buf_)[_i_]; \ + ((volatile CYG_WORD32 *)(_register_))[_i_] = (_buf_)[_i_]; \ CYG_MACRO_END // Enforce a flow "barrier" to prevent optimizing compiler from reordering @@ -275,11 +293,5 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG #define HAL_IO_BARRIER() //----------------------------------------------------------------------------- -// Include plf_io.h for platforms that define it. -#ifdef CYGBLD_HAL_PLATFORM_IO_H -#include CYGBLD_HAL_PLATFORM_IO_H -#endif - -//----------------------------------------------------------------------------- #endif // ifndef CYGONCE_HAL_IO_H // End of hal_io.h diff --git a/packages/hal/arm/arch/current/include/hal_mmu.h b/packages/hal/arm/arch/current/include/hal_mmu.h --- a/packages/hal/arm/arch/current/include/hal_mmu.h +++ b/packages/hal/arm/arch/current/include/hal_mmu.h @@ -8,29 +8,38 @@ // MMU definitions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/arch/current/src/arm.ld b/packages/hal/arm/arch/current/src/arm.ld --- a/packages/hal/arm/arch/current/src/arm.ld +++ b/packages/hal/arm/arch/current/src/arm.ld @@ -3,29 +3,38 @@ // MLT linker script for ARM // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= #include @@ -96,7 +105,7 @@ OUTPUT_FORMAT(elf32-bigarm) .text _vma_ : _lma_ \ { _stext = ABSOLUTE(.); \ PROVIDE (__stext = ABSOLUTE(.)); \ - *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) \ + *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) \ *(.glue_7) *(.glue_7t) \ } > _region_ \ _etext = .; PROVIDE (__etext = .); @@ -112,7 +121,7 @@ OUTPUT_FORMAT(elf32-bigarm) #else #define SECTION_rodata(_region_, _vma_, _lma_) \ .rodata _vma_ : _lma_ \ - { FORCE_OUTPUT; *(.rodata*) } \ + { FORCE_OUTPUT; *(.rodata*) *(.gnu.linkonce.r.*) } \ > _region_ #define SECTION_rodata1(_region_, _vma_, _lma_) \ @@ -213,13 +222,14 @@ OUTPUT_FORMAT(elf32-bigarm) #define SECTION_data(_region_, _vma_, _lma_) \ .data _vma_ : _lma_ \ - { __ram_data_start = ABSOLUTE (.); *(.data*) *(.data1) MERGE_IN_RODATA \ + { __ram_data_start = ABSOLUTE (.); \ + *(.data*) *(.data1) *(.gnu.linkonce.d.*) MERGE_IN_RODATA \ . = ALIGN (4); \ KEEP(*( SORT (.ecos.table.*))) ; \ . = ALIGN (4); \ __CTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.ctors*))) __CTOR_END__ = ABSOLUTE (.); \ __DTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) __DTOR_END__ = ABSOLUTE (.); \ - *(.dynamic) *(.sdata*) *(.sbss*) \ + *(.dynamic) *(.sdata*) *(.gnu.linkonce.s.*) \ . = ALIGN (4); *(.2ram.*) } \ > _region_ \ __rom_data_start = LOADADDR (.data); \ @@ -229,7 +239,8 @@ OUTPUT_FORMAT(elf32-bigarm) #define SECTION_bss(_region_, _vma_, _lma_) \ .bss _vma_ : _lma_ \ { __bss_start = ABSOLUTE (.); \ - *(.scommon) *(.dynbss) *(.bss*) *(COMMON) \ + *(.scommon) *(.dynsbss) *(.sbss*) *(.gnu.linkonce.sb.*) \ + *(.dynbss) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON) \ __bss_end = ABSOLUTE (.); } \ > _region_ diff --git a/packages/hal/arm/arch/current/src/arm_stub.c b/packages/hal/arm/arch/current/src/arm_stub.c --- a/packages/hal/arm/arch/current/src/arm_stub.c +++ b/packages/hal/arm/arch/current/src/arm_stub.c @@ -5,29 +5,38 @@ // Helper functions for stub, generic to all ARM processors // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // @@ -157,6 +166,18 @@ static unsigned short ss_saved_thumb_ins #define FIXME() {diag_printf("FIXME - %s\n", __FUNCTION__); } +// return non-zero for v5 and later +static int +v5T_semantics(void) +{ + unsigned id; + + asm volatile ("mrc p15,0,%0,c0,c0,0\n" + : "=r" (id) : /* no inputs */); + + return ((id >> 16) & 0xff) >= 5; +} + static int ins_will_execute(unsigned long ins) { @@ -461,6 +482,9 @@ target_thumb_ins(unsigned long pc, unsig offset += 4; new_pc = *(cyg_uint32 *)(sp + offset); + + if (!v5T_semantics()) + new_pc = MAKE_THUMB_ADDR(new_pc); } break; case 0xd: @@ -706,5 +730,95 @@ cyg_hal_gdb_break_is_set (void) return 0; } +#ifdef CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT +#define ICE_THREAD_KEY0 0xDEAD0001 +#define ICE_THREAD_KEY1 0xDEAD0002 + +#define ICE_THREAD_INBUFSIZ 2048 +#define ICE_THREAD_OUTBUFSIZ 2048 +#define ICE_THREAD_STACKSIZE 4096 + +static cyg_uint8 ice_thread_inbuf[ICE_THREAD_INBUFSIZ]; +static cyg_uint8 ice_thread_outbuf[ICE_THREAD_OUTBUFSIZ]; +static cyg_uint8 ice_thread_stack[ICE_THREAD_STACKSIZE]; + +static void ice_thread_proc(void); + +struct { + cyg_uint32 _key0; // Must be ICE_KEY0 + cyg_uint8 *in_buffer; + cyg_int32 in_buffer_size; + cyg_uint8 *out_buffer; + cyg_int32 out_buffer_size; + cyg_uint8 *stack; + cyg_int32 stack_size; + void (*fun)(void); + cyg_uint32 _key1; // Must be ICE_KEY1 +} hal_arm_ice_thread_handler = { + ICE_THREAD_KEY0, + ice_thread_inbuf, + ICE_THREAD_INBUFSIZ, + ice_thread_outbuf, + ICE_THREAD_OUTBUFSIZ, + ice_thread_stack, + ICE_THREAD_STACKSIZE, + ice_thread_proc, + ICE_THREAD_KEY1, +}; + +static int +ice_thread_query(void) +{ + switch (ice_thread_inbuf[1]) { + case 'L': // get thread list + stub_pkt_getthreadlist(&ice_thread_inbuf[2], ice_thread_outbuf, sizeof(ice_thread_outbuf)); + break; + case 'P': // thread or process information + stub_pkt_getthreadinfo(&ice_thread_inbuf[2], ice_thread_outbuf, sizeof(ice_thread_outbuf)); + break; + case 'C': // current thread + stub_pkt_currthread(&ice_thread_inbuf[2], ice_thread_outbuf, sizeof(ice_thread_outbuf)); + break; + default: + return 0; + } + return 1; +} + +static int +ice_thread_set(void) +{ + return 0; +} + +static void +ice_thread_proc(void) +{ + switch (ice_thread_inbuf[0]) { + case 'g': // Fetch thread registers + stub_format_registers(ice_thread_outbuf); + return; + case 'P': // Update a single register + case 'G': // Update all registers + stub_update_registers(ice_thread_inbuf, ice_thread_outbuf); + return; + case 'H': // Thread set/query + stub_pkt_changethread(&ice_thread_inbuf[1], ice_thread_outbuf, sizeof(ice_thread_outbuf)); + return; + case 'q': // Thread queries + if (ice_thread_query()) return; + break; + case 'Q': // Thread set operations + if (ice_thread_set()) return; + break; + case 'T': // Thread alive? + stub_pkt_thread_alive(&ice_thread_inbuf[1], ice_thread_outbuf, sizeof(ice_thread_outbuf)); + return; + default: + } + strcpy(ice_thread_outbuf, "ENN"); // Dunno +} + +#endif // CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT #endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS diff --git a/packages/hal/arm/arch/current/src/context.S b/packages/hal/arm/arch/current/src/context.S --- a/packages/hal/arm/arch/current/src/context.S +++ b/packages/hal/arm/arch/current/src/context.S @@ -5,29 +5,38 @@ // # ARM context switch code // # // #=========================================================================== -// ####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -// ####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // #=========================================================================== // ######DESCRIPTIONBEGIN#### // # @@ -83,9 +92,10 @@ // They are saved here though so that the information can match the HAL_SavedRegisters FUNC_START_ARM(hal_thread_switch_context, r2) - mov ip,sp // saved stack pointer - stmfd sp!,{fp,ip,lr,pc} // filler - stmfd sp!,{r0-r10,fp,ip,lr,pc} + sub ip,sp,#20 // skip svc_sp, svc_lr, vector, cpsr, and pc + stmfd ip!,{sp,lr} + mov sp,ip + stmfd sp!,{r0-r10,fp,ip} mrs r2,cpsr str r2,[sp,#armreg_cpsr] str sp,[r1] // return new stack pointer @@ -110,7 +120,7 @@ FUNC_START_ARM(hal_thread_load_context, msr cpsr,r0 ldr r0,[fp,#armreg_cpsr] msr spsr,r0 - ldmfd fp,{r0-r10,fp,sp,lr} + ldmfd fp,{r0-r10,fp,ip,sp,lr} #ifdef __thumb__ mrs r1,spsr // r1 is scratch // [r0 holds initial thread arg] diff --git a/packages/hal/arm/arch/current/src/hal_misc.c b/packages/hal/arm/arch/current/src/hal_misc.c --- a/packages/hal/arm/arch/current/src/hal_misc.c +++ b/packages/hal/arm/arch/current/src/hal_misc.c @@ -5,29 +5,38 @@ // HAL miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/arch/current/src/hal_mk_defs.c b/packages/hal/arm/arch/current/src/hal_mk_defs.c --- a/packages/hal/arm/arch/current/src/hal_mk_defs.c +++ b/packages/hal/arm/arch/current/src/hal_mk_defs.c @@ -5,29 +5,38 @@ // HAL (architecture) "make defs" program // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -71,6 +80,9 @@ main(void) { DEFINE(armreg_r0, offsetof(HAL_SavedRegisters, d[HAL_THREAD_CONTEXT_R0])); DEFINE(armreg_r4, offsetof(HAL_SavedRegisters, d[HAL_THREAD_CONTEXT_R4])); + DEFINE(armreg_r8, offsetof(HAL_SavedRegisters, d[HAL_THREAD_CONTEXT_R8])); + DEFINE(armreg_r9, offsetof(HAL_SavedRegisters, d[HAL_THREAD_CONTEXT_R9])); + DEFINE(armreg_r10, offsetof(HAL_SavedRegisters, d[HAL_THREAD_CONTEXT_R10])); DEFINE(armreg_sp, offsetof(HAL_SavedRegisters, sp)); DEFINE(armreg_fp, offsetof(HAL_SavedRegisters, fp)); DEFINE(armreg_ip, offsetof(HAL_SavedRegisters, ip)); @@ -78,6 +90,8 @@ main(void) DEFINE(armreg_pc, offsetof(HAL_SavedRegisters, pc)); DEFINE(armreg_cpsr, offsetof(HAL_SavedRegisters, cpsr)); DEFINE(armreg_vector, offsetof(HAL_SavedRegisters, vector)); + DEFINE(armreg_svclr, offsetof(HAL_SavedRegisters, svc_lr)); + DEFINE(armreg_svcsp, offsetof(HAL_SavedRegisters, svc_sp)); DEFINE(ARMREG_SIZE, sizeof(HAL_SavedRegisters)); DEFINE(CYGNUM_HAL_ISR_COUNT, CYGNUM_HAL_ISR_COUNT); DEFINE(CYGNUM_HAL_VSR_COUNT, CYGNUM_HAL_VSR_COUNT); diff --git a/packages/hal/arm/arch/current/src/hal_syscall.c b/packages/hal/arm/arch/current/src/hal_syscall.c --- a/packages/hal/arm/arch/current/src/hal_syscall.c +++ b/packages/hal/arm/arch/current/src/hal_syscall.c @@ -5,29 +5,38 @@ // // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -62,7 +71,8 @@ extern int __do_syscall(int func, // syscall function number long arg1, long arg2, // up to four args. long arg3, long arg4, - int *retval); // syscall return value + int *retval, // syscall return value + int *sig); // signal to return (or 0) #define SYS_exit 1 #define SYS_interrupt 1000 @@ -71,7 +81,7 @@ int hal_syscall_handler(void) { int func, arg1, arg2, arg3, arg4; - int err; + int err, sig; #if 0 union arm_insn inst; @@ -108,9 +118,9 @@ hal_syscall_handler(void) return SIGINT; } - if (__do_syscall(func, arg1, arg2, arg3, arg4, &err)) { + if (__do_syscall(func, arg1, arg2, arg3, arg4, &err, &sig)) { put_register(R0, err); - return 0; + return sig; } return SIGTRAP; diff --git a/packages/hal/arm/arch/current/src/redboot_linux_exec.c b/packages/hal/arm/arch/current/src/redboot_linux_exec.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arch/current/src/redboot_linux_exec.c @@ -0,0 +1,411 @@ +//========================================================================== +// +// redboot_linux_boot.c +// +// RedBoot command to boot Linux on ARM platforms +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//####OTHERCOPYRIGHTBEGIN#### +// +// The structure definitions below are taken from include/asm-arm/setup.h in +// the Linux kernel, Copyright (C) 1997-1999 Russell King. Their presence +// here is for the express purpose of communication with the Linux kernel +// being booted and is considered 'fair use' by the original author and +// are included with his permission. +// +//####OTHERCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov, +// Russell King +// Date: 2001-02-20 +// Purpose: +// Description: +// +// This code is part of RedBoot (tm). +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +#include +#include +#include CYGHWR_MEMORY_LAYOUT_H + +#include + +#ifndef CYGARC_PHYSICAL_ADDRESS +# error +# define CYGARC_PHYSICAL_ADDRESS(x) (x) +#endif + +// FIXME: This should be a CDL variable, and CYGSEM_REDBOOT_ARM_LINUX_BOOT +// active_if CYGHWR_HAL_ARM_REDBOOT_MACHINE_TYPE>0 +#ifdef HAL_PLATFORM_MACHINE_TYPE +#define CYGHWR_REDBOOT_ARM_MACHINE_TYPE HAL_PLATFORM_MACHINE_TYPE + +// Exported CLI function(s) +static void do_exec(int argc, char *argv[]); +RedBoot_cmd("exec", + "Execute an image - with MMU off", + "[-w timeout] [-b [-l ]]\n" + " [-r [-s ]]\n" + " [-c \"kernel command line\"] []", + do_exec + ); + +// +// Parameter info for Linux kernel +// ** C A U T I O N ** This setup must match "asm-arm/setup.h" +// +// Info is passed at a fixed location, using a sequence of tagged +// data entries. +// + +typedef unsigned long u32; +typedef unsigned short u16; +typedef unsigned char u8; + +//========================================================================= +// From Linux + +#define ATAG_NONE 0x00000000 +struct tag_header { + u32 size; // Size of tag (hdr+data) in *longwords* + u32 tag; +}; + +#define ATAG_CORE 0x54410001 +struct tag_core { + u32 flags; /* bit 0 = read-only */ + u32 pagesize; + u32 rootdev; +}; + +#define ATAG_MEM 0x54410002 +struct tag_mem32 { + u32 size; + u32 start; +}; + +#define ATAG_VIDEOTEXT 0x54410003 +struct tag_videotext { + u8 x; + u8 y; + u16 video_page; + u8 video_mode; + u8 video_cols; + u16 video_ega_bx; + u8 video_lines; + u8 video_isvga; + u16 video_points; +}; + +#define ATAG_RAMDISK 0x54410004 +struct tag_ramdisk { + u32 flags; /* b0 = load, b1 = prompt */ + u32 size; + u32 start; +}; + +#define ATAG_INITRD 0x54410005 +struct tag_initrd { + u32 start; + u32 size; +}; + +#define ATAG_SERIAL 0x54410006 +struct tag_serialnr { + u32 low; + u32 high; +}; + +#define ATAG_REVISION 0x54410007 +struct tag_revision { + u32 rev; +}; + +#define ATAG_VIDEOLFB 0x54410008 +struct tag_videolfb { + u16 lfb_width; + u16 lfb_height; + u16 lfb_depth; + u16 lfb_linelength; + u32 lfb_base; + u32 lfb_size; + u8 red_size; + u8 red_pos; + u8 green_size; + u8 green_pos; + u8 blue_size; + u8 blue_pos; + u8 rsvd_size; + u8 rsvd_pos; +}; + +#define ATAG_CMDLINE 0x54410009 +struct tag_cmdline { + char cmdline[1]; +}; + +#define ATAG_ACORN 0x41000101 +struct tag_acorn { + u32 memc_control_reg; + u32 vram_pages; + u8 sounddefault; + u8 adfsdrives; +}; + +#define ATAG_MEMCLK 0x41000402 +struct tag_memclk { + u32 fmemclk; +}; + +struct tag { + struct tag_header hdr; + union { + struct tag_core core; + struct tag_mem32 mem; + struct tag_videotext videotext; + struct tag_ramdisk ramdisk; + struct tag_initrd initrd; + struct tag_serialnr serialnr; + struct tag_revision revision; + struct tag_videolfb videolfb; + struct tag_cmdline cmdline; + + /* + * Acorn specific + */ + struct tag_acorn acorn; + + /* + * DC21285 specific + */ + struct tag_memclk memclk; + } u; +}; + +// End of inclusion from +//========================================================================= + +// Round up a quantity to a longword (32 bit) length +#define ROUNDUP(n) (((n)+3)&~3) + +static void +do_exec(int argc, char *argv[]) +{ + unsigned long entry; + unsigned long oldints; + bool wait_time_set; + int wait_time, res; + bool base_addr_set, length_set, cmd_line_set; + bool ramdisk_addr_set, ramdisk_size_set; + unsigned long base_addr, length; + unsigned long ramdisk_addr, ramdisk_size; + struct option_info opts[6]; + char line[8]; + char *cmd_line; + struct tag *params = (struct tag *)0x0100; + + entry = (unsigned long)CYGARC_PHYSICAL_ADDRESS(CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS); // Default Linux execute address + base_addr = load_address; + length = load_address_end - load_address; + ramdisk_size = 4096*1024; + init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, + (void **)&wait_time, (bool *)&wait_time_set, "wait timeout"); + init_opts(&opts[1], 'b', true, OPTION_ARG_TYPE_NUM, + (void **)&base_addr, (bool *)&base_addr_set, "base address"); + init_opts(&opts[2], 'l', true, OPTION_ARG_TYPE_NUM, + (void **)&length, (bool *)&length_set, "length"); + init_opts(&opts[3], 'c', true, OPTION_ARG_TYPE_STR, + (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line"); + init_opts(&opts[4], 'r', true, OPTION_ARG_TYPE_NUM, + (void **)&ramdisk_addr, (bool *)&ramdisk_addr_set, "ramdisk_addr"); + init_opts(&opts[5], 's', true, OPTION_ARG_TYPE_NUM, + (void **)&ramdisk_size, (bool *)&ramdisk_size_set, "ramdisk_size"); + if (!scan_opts(argc, argv, 1, opts, 6, (void *)&entry, OPTION_ARG_TYPE_NUM, "[physical] starting address")) + { + return; + } + + // Set up parameters to pass to kernel + + // CORE tag must be present & first + params->hdr.size = (sizeof(struct tag_core) + sizeof(struct tag_header))/sizeof(long); + params->hdr.tag = ATAG_CORE; + params->u.core.flags = 0; + params->u.core.pagesize = 0; + params->u.core.rootdev = 0; + params = (struct tag *)((long *)params + params->hdr.size); + + /* Next ATAG_MEM. */ + params->hdr.size = (sizeof(struct tag_mem32) + sizeof(struct tag_header))/sizeof(long); + params->hdr.tag = ATAG_MEM; + params->u.mem.start = CYGARC_PHYSICAL_ADDRESS(CYGMEM_REGION_ram); + /* Round up so there's only one bit set in the memory size. + * Don't double it if it's already a power of two, though. + */ + params->u.mem.size = 1<u.mem.size < CYGMEM_REGION_ram_SIZE << 1) + params->u.mem.size <<= 1; + params = (struct tag *)((long *)params + params->hdr.size); + + if (ramdisk_addr_set) { + params->hdr.size = (sizeof(struct tag_initrd) + sizeof(struct tag_header))/sizeof(long); + params->hdr.tag = ATAG_INITRD; + params->u.initrd.start = CYGARC_PHYSICAL_ADDRESS(ramdisk_addr); + params->u.initrd.size = ramdisk_size; + params = (struct tag *)((long *)params + params->hdr.size); + } + if (cmd_line_set) { + params->hdr.size = (ROUNDUP(strlen(cmd_line)) + sizeof(struct tag_header))/sizeof(long); + params->hdr.tag = ATAG_CMDLINE; + strcpy(params->u.cmdline.cmdline, cmd_line); + params = (struct tag *)((long *)params + params->hdr.size); + } + // Mark end of parameter list + params->hdr.size = 0; + params->hdr.tag = ATAG_NONE; + + if (wait_time_set) { + int script_timeout_ms = wait_time * 1000; +#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT + unsigned char *hold_script = script; + script = (unsigned char *)0; +#endif + diag_printf("About to start execution at %p - abort with ^C within %d seconds\n", + (void *)entry, wait_time); + while (script_timeout_ms >= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) { + res = _rb_gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT); + if (res == _GETS_CTRLC) { +#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT + script = hold_script; // Re-enable script +#endif + return; + } + script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT; + } + } + if (!base_addr_set) { + diag_printf("Using base address %p and length %p\n", + (void*)base_addr, (void*)length); + } else if (base_addr_set && !length_set) { + diag_printf("Length required for non-standard base address\n"); + return; + } + HAL_DISABLE_INTERRUPTS(oldints); + HAL_DCACHE_SYNC(); + HAL_ICACHE_DISABLE(); + HAL_DCACHE_DISABLE(); + HAL_DCACHE_SYNC(); + HAL_ICACHE_INVALIDATE_ALL(); + HAL_DCACHE_INVALIDATE_ALL(); + + // Tricky code. We are currently running with the MMU on and the + // memory map convoluted from 1-1. The trampoline code between + // labels 1 and 2 must be copied to RAM and then executed at the + // non-mapped address. Then when the code turns off the MMU, the + // control flow is unchanged and control can be passed safely to + // the program to be executed. + // Note: This only works if phys=virt (or there are appropriate + // double mapping of the memory). This should be rewritten + // so a jump follows immediately after the MMU disable + // operation. + // + // This magic was created in order to + // be able to execute standard Linux kernels with as little + // change/perturberance as possible. + asm volatile ("\n" // Copy code between labels 1-2 to the + " ldr r2,=1f;\n" // trampoline address... + " ldr r3,=2f;\n" + " mov r5,%0;\n" + "4:\n" + " ldr r1,[r2],#4;\n" + " str r1,[r5],#4;\n" + " cmp r2,r3;\n" + " bne 4b;\n" + " nop;nop;nop;nop;nop;nop;nop;nop;\n" + " mov r5,%1;\n" + " mov r2,%2;\n" + " mov r3,%3;\n" + " mov r7,%4;\n" + " mov r6,%5;\n" + " mov pc,%0;\n" //... and jump to it. + " \n" + "1:\n" + " mrs r1,cpsr;\n" // Put processor in IRQ mode + " bic r0,r1,#0x1F;\n" + " orr r0,r0,#0x12;\n" + " msr cpsr,r0;\n" + " msr spsr,r1;\n" + " mov lr,r5;\n" // Set kernel entry point + " mov sp,r5;\n" // Give the kernel a stack just below the entry point + " mov r1,#0;\n" // Turn off MMU and caches + " mcr p15,0,r1,c1,c0;\n" + " nop;nop;nop;\n" + " cmp r2,r6;\n" // Default kernel load address. Relocate + " beq 10f;\n" // kernel image there if necessary, and + " cmp r3,#0;\n" // if size is non-zero + " beq 10f;\n" + "05:\n" + " ldr r4,[r2],#4;\n" + " str r4,[r6],#4;\n" + " sub r3,r3,#4;\n" + " cmp r3,#0;\n" + " bne 05b;\n" + "10:\n" + " mov r0,#0;\n" // Set board type and start the kernel + " mov r1,r7;\n" + " movs pc,lr;\n" + "2:\n" + : : + "r"(CYGARC_PHYSICAL_ADDRESS(CYGHWR_REDBOOT_ARM_TRAMPOLINE_ADDRESS)), + "r"(entry), + "r"(CYGARC_PHYSICAL_ADDRESS(base_addr)), + "r"(length), + "r"(CYGHWR_REDBOOT_ARM_MACHINE_TYPE), + "r"(CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS) : + "r7","r6","r5","r2","r3","r1"); +} + +#endif // HAL_PLATFORM_MACHINE_TYPE - otherwise we do not support this stuff... + +// EOF redboot_linux_exec.c diff --git a/packages/hal/arm/arch/current/src/vectors.S b/packages/hal/arm/arch/current/src/vectors.S --- a/packages/hal/arm/arch/current/src/vectors.S +++ b/packages/hal/arm/arch/current/src/vectors.S @@ -5,29 +5,38 @@ // # ARM exception vectors // # // #======================================================================== -// ####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -// ####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // #======================================================================== // ######DESCRIPTIONBEGIN#### // # @@ -133,7 +142,7 @@ #define UNMAPPED_PTR(name) \ .##name: .word UNMAPPED(name) - .file "vectors.S" +// .file "vectors.S" // CYGHWR_LED_MACRO can be defined in hal_platform_setup.h. It's free to @@ -232,6 +241,14 @@ hal_virtual_vector_table: .endr #endif +#ifdef CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT + .balign 16 // Should be at 0x50 +ice_thread_vector: + .long 0 // Must be 'MICE' + .long 0 // Pointer to thread support vector + .long 0 // eCos executing flag + .long 0 // Must be 'GDB ' +#endif // CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT .balign 32 // Other vectors - this may include "fixed" locations @@ -274,6 +291,18 @@ warm_reset: ldr r2,[r1,#0x08] // software interrupt str r2,[r0,#0x08] +#ifdef CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT + ldr r2,=ice_thread_vector + sub r2,r2,r1 // compute fixed (low memory) address + ldr r3,=0x4D494345 // 'MICE' + str r3,[r2],#4 + ldr r3,=hal_arm_ice_thread_handler + str r3,[r2],#4 + mov r3,#1 + str r3,[r2],#4 + ldr r3,=0x47444220 // 'GDB ' + str r3,[r2],#4 +#endif // CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT #if defined(CYGSEM_HAL_ARM_PID_ANGEL_BOOT) // Ugly hack to get into supervisor mode @@ -373,7 +402,13 @@ 2: msr spsr,r0 // initialize stack +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + // use interrupt stack for system initialization since it's bigger + // than the "startup" stack in this configuration + ldr sp,.__interrupt_stack +#else ldr sp,.__startup_stack +#endif // clear BSS ldr r1,.__bss_start @@ -383,7 +418,7 @@ 2: beq 2f 1: str r0,[r1],#4 cmp r1,r2 - bne 1b + bls 1b 2: // Run kernel + application in THUMB mode @@ -427,6 +462,9 @@ 2: LED 1 // This starts up the eCos kernel +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + ldr sp,.__startup_stack +#endif bl cyg_start _start_hang: b _start_hang @@ -450,174 +488,134 @@ init_done: // // Exception handlers -// Assumption: get here from a Supervisor context [mode] +// Assumption: get here from a non-user context [mode] // .code 32 undefined_instruction: ldr sp,.__undef_exception_stack // get good stack - stmfd sp!,{r0,fp,ip,lr} - mrs r0,spsr - stmfd sp!,{r0} - mov ip,sp // save SP which will vanish with - // mode switch - mrs r0,cpsr // switch to Supervisor Mode - bic r0,r0,#CPSR_MODE_BITS - orr r0,r0,#CPSR_SUPERVISOR_MODE - msr cpsr,r0 // sp,lr are now old values - mov fp,sp -#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS - ldr sp,.__GDB_stack - cmp fp,sp // already on GDB stack? - bhi 10f - ldr r0,.__GDB_stack_base - cmp fp,r0 - bls 10f // no - switch to GDB stack - // (already in sp) - mov sp,fp // yes - no switch -10: -#endif - sub sp,sp,#ARMREG_SIZE // make space for frame - stmea sp,{r0-r10,fp} // save immediately visible registers - ldmfd ip,{r0-r4} // saved registers - // Adjust PC according to CPU mode - tst r0,#CPSR_THUMB_ENABLE - subeq r4,r4,#4 // PC at time of interrupt (ARM) - subne r4,r4,#2 // PC at time of interrupt (thumb) - str r0,[sp,#armreg_cpsr] // CPSR at time of interrupt - str r1,[sp,#armreg_r0] // saved R0 - str r2,[sp,#armreg_fp] // saved FP - str r3,[sp,#armreg_ip] // saved IP - str r4,[sp,#armreg_pc] // PC at time of interrupt - str lr,[sp,#armreg_lr] // LR at time of interrupt - add r0,ip,#ARMREG_SIZE - str fp,[sp,#armreg_sp] // SP at time of interrupt -#ifdef CYGHWR_HAL_ARM_DUMP_EXCEPTIONS - mov r0,sp - bl cyg_hal_report_undefined_instruction -#endif - mov v1,#CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION + stmfd sp!,{r0-r5} // save some supervisor regs + mrs r1,spsr + tst r1,#CPSR_THUMB_ENABLE + subeq r0,lr,#4 // PC at time of interrupt (ARM) + subne r0,lr,#2 // PC at time of interrupt (thumb) + mov r2,#CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION + mov r3,sp b call_exception_handler .code 32 software_interrupt: - sub sp,sp,#ARMREG_SIZE+16 // make space for frame - stmea sp,{r0-r10,fp} // save immediately visible registers - mrs r0,spsr - // Adjust PC according to CPU mode - tst r0,#CPSR_THUMB_ENABLE - subeq r3,lr,#4 // PC at time of interrupt (ARM) - subne r3,lr,#2 // PC at time of interrupt (thumb) - str r0,[sp,#armreg_cpsr] // CPSR at time of interrupt - str ip,[sp,#armreg_ip] // saved IP - str r3,[sp,#armreg_pc] // PC at time of interrupt - str lr,[sp,#armreg_lr] // LR at time of interrupt - add r0,sp,#ARMREG_SIZE+16 - str r0,[sp,#armreg_sp] // SP at time of interrupt -#ifdef CYGHWR_HAL_ARM_DUMP_EXCEPTIONS - mov r0,sp - bl cyg_hal_report_software_interrupt -#endif - mov v1,#CYGNUM_HAL_EXCEPTION_INTERRUPT + stmfd sp!,{r8} + ldr r8,.__undef_exception_stack // get good stack + stmfd r8!,{r0-r5} // save some supervisor regs + mov r3,r8 + ldmfd sp!,{r8} + mrs r1,spsr + tst r1,#CPSR_THUMB_ENABLE + subeq r0,lr,#4 // PC at time of SWI (ARM) + subne r0,lr,#2 // PC at time of SWI (thumb) + mov r2,#CYGNUM_HAL_EXCEPTION_INTERRUPT b call_exception_handler .code 32 abort_prefetch: ldr sp,.__undef_exception_stack // get good stack - sub lr,lr,#4 // PC at time of interrupt - stmfd sp!,{r0,fp,ip,lr} - mrs r0,spsr - stmfd sp!,{r0} - mov ip,sp // save SP which will vanish with - // mode switch - mrs r0,cpsr // switch to Supervisor Mode - bic r0,r0,#CPSR_MODE_BITS - orr r0,r0,#CPSR_SUPERVISOR_MODE - msr cpsr,r0 // sp,lr are now old values - mov fp,sp -#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS - ldr sp,.__GDB_stack - cmp fp,sp // already on GDB stack? - bhi 10f - ldr r0,.__GDB_stack_base - cmp fp,r0 - bls 10f // no - switch to GDB stack - // (already in sp) - mov sp,fp // yes - no switch -10: -#endif - sub sp,sp,#ARMREG_SIZE // make space for frame - stmea sp,{r0-r10,fp} // save immediately visible registers - ldmfd ip,{r0-r4} // saved registers - str r0,[sp,#armreg_cpsr] // CPSR at time of interrupt - str r1,[sp,#armreg_r0] // saved R0 - str r2,[sp,#armreg_fp] // saved FP - str r3,[sp,#armreg_ip] // saved IP - str r4,[sp,#armreg_pc] // PC at time of interrupt - str lr,[sp,#armreg_lr] // LR at time of interrupt - add r0,ip,#ARMREG_SIZE - str fp,[sp,#armreg_sp] // SP at time of interrupt -#ifdef CYGHWR_HAL_ARM_DUMP_EXCEPTIONS - mov r0,sp - bl cyg_hal_report_abort_prefetch -#endif - mov v1,#CYGNUM_HAL_EXCEPTION_CODE_ACCESS + stmfd sp!,{r0-r5} // save some supervisor regs + sub r0,lr,#4 // PC at time of interrupt + mrs r1,spsr + mov r2,#CYGNUM_HAL_EXCEPTION_CODE_ACCESS + mov r3,sp b call_exception_handler .code 32 abort_data: ldr sp,.__undef_exception_stack // get good stack - sub lr,lr,#4 // PC at time of interrupt - stmfd sp!,{r0,fp,ip,lr} - mrs r0,spsr - stmfd sp!,{r0} - mov ip,sp // save SP which will vanish with - // mode switch - mrs r0,cpsr // switch to Supervisor Mode - bic r0,r0,#CPSR_MODE_BITS - orr r0,r0,#CPSR_SUPERVISOR_MODE - msr cpsr,r0 // sp,lr are now old values - mov fp,sp -#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS - ldr sp,.__GDB_stack - cmp fp,sp // already on GDB stack? - bhi 10f - ldr r0,.__GDB_stack_base - cmp fp,r0 - bls 10f // no - switch to GDB stack - // (already in sp) - mov sp,fp // yes - no switch -10: -#endif - sub sp,sp,#ARMREG_SIZE // make space for frame - stmea sp,{r0-r10,fp} // save immediately visible registers - ldmfd ip,{r0-r4} // saved registers - str r0,[sp,#armreg_cpsr] // CPSR at time of interrupt - str r1,[sp,#armreg_r0] // saved R0 - str r2,[sp,#armreg_fp] // saved FP - str r3,[sp,#armreg_ip] // saved IP - str r4,[sp,#armreg_pc] // PC at time of interrupt - str lr,[sp,#armreg_lr] // LR at time of interrupt - add r0,ip,#ARMREG_SIZE - str fp,[sp,#armreg_sp] // SP at time of interrupt -#ifdef CYGHWR_HAL_ARM_DUMP_EXCEPTIONS - mov r0,sp - bl cyg_hal_report_abort_data -#endif - mov v1,#CYGNUM_HAL_EXCEPTION_DATA_ACCESS + stmfd sp!,{r0-r5} // save some supervisor regs + sub r0,lr,#4 // PC at time of interrupt + mrs r1,spsr + mov r2,#CYGNUM_HAL_EXCEPTION_DATA_ACCESS + mov r3,sp b call_exception_handler - // // Dispatch an exception handler. .code 32 call_exception_handler: - str v1,[sp,#armreg_vector] - mov r0,sp + // + // On Entry: + // + // r4,r5 = scratch + // r3 = pointer to temp save area + // r2 = vector number + // r1 = exception psr + // r0 = exception pc + // + // [r3+20]: exception r5 + // [r3+16]: exception r4 + // [r3+12]: exception r3 + // [r3+8] : exception r2 + // [r3+4] : exception r1 + // [r3] : exception r0 + + mrs r4,cpsr // switch to Supervisor Mode + bic r4,r4,#CPSR_MODE_BITS + orr r4,r4,#CPSR_SUPERVISOR_MODE + msr cpsr,r4 + + mov r5,sp // save original svc sp + mov r4,lr // and original svc lr +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + // Make sure we use the GDB stack. + ldr sp,.__GDB_stack + cmp r5,sp // already on GDB stack? + bhi 10f + ldr r4,.__GDB_stack_base + cmp r5,r4 + movhi sp,r5 +10: +#endif + // + // r5 holds original svc sp, current sp is stack to use + // r4 holds original svc lr, which must also be preserved + // - THUMB_MODE(r9,10) + stmfd sp!,{r0-r2,r4,r5} // push svc_sp, svc_lr, vector, psr, pc + + // switch to pre-exception mode to get banked regs + mov r0,sp // r0 survives mode switch + mrs r2,cpsr // Save current psr for return + orr r1,r1,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE + msr cpsr,r1 + stmfd r0!,{r8-r12,sp,lr} + msr cpsr,r2 // back to svc mode + mov sp,r0 // update stack pointer + + // now save pre-exception r0-r7 on current stack + ldmfd r3,{r0-r5} + stmfd sp!,{r0-r7} + // SP needs fixing if exception occured in SVC mode. + // The original SVC LR is still in place so that + // does not need to be fixed here. + ldr r1,[sp,#armreg_cpsr] + and r1,r1,#CPSR_MODE_BITS + cmp r1,#CPSR_SUPERVISOR_MODE + ldreq r1,[sp,#armreg_svcsp] + streq r1,[sp,#armreg_sp] + +#ifdef CYGHWR_HAL_ARM_DUMP_EXCEPTIONS + mov r0,sp + ldr r1,.__dump_procs + ldr r2,[sp,#armreg_vector] + mov lr,pc + ldr pc,[r1,r2,lsl #2] +#endif + + // call exception handler + mov r0,sp + THUMB_MODE(r9,10) bl exception_handler + #ifdef CYGHWR_HAL_ARM_DUMP_EXCEPTIONS mov r0,sp bl cyg_hal_report_exception_handler_returned @@ -625,30 +623,52 @@ call_exception_handler: ARM_MODE(r1,10) -// Restore [interrupted] context - mov ip,sp // get stack pointer + // + // Return from exception + // +return_from_exception: + + ldr r0,[sp,#armreg_cpsr] + msr spsr,r0 - mrs r0,cpsr // move back to IRQ mode + // return to supervisor mode is simple + and r1,r0,#CPSR_MODE_BITS + cmp r1,#CPSR_SUPERVISOR_MODE + ldmeqfd sp,{r0-r14,pc}^ + + // + // return to other non-user modes is a little trickier + // + + // switch to pre-exception mode and restore r8-r14 + add r2,sp,#armreg_r8 + mrs r1,cpsr orr r0,r0,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE msr cpsr,r0 - nop - nop + ldmfd r2,{r8-r14} + msr cpsr, r1 // back to svc mode + + // move sp,lr and pc for final load + ldr r0,[sp,#armreg_svcsp] + str r0,[sp,#armreg_r8] + ldr r0,[sp,#armreg_svclr] + str r0,[sp,#armreg_r9] + ldr r0,[sp,#armreg_pc] + str r0,[sp,#armreg_r10] - ldr lr,[ip,#armreg_lr] - ldr sp,[sp,#armreg_sp] - - bic r0,r0,#CPSR_MODE_BITS - orr r0,r0,#CPSR_IRQ_MODE - msr cpsr,r0 + // restore r0-r7,sp,lr and return from exception + ldmfd sp,{r0-r7,sp,lr,pc}^ - mov sp,ip - ldr lr,[sp,#armreg_pc] - ldr r0,[sp,#armreg_cpsr] - ldr ip,[sp,#armreg_ip] - msr spsr,r0 - ldmfd sp,{r0-r10,fp} +#ifdef CYGHWR_HAL_ARM_DUMP_EXCEPTIONS +__dump_procs: + .word 0 // placeholder for reset + .word cyg_hal_report_undefined_instruction + .word cyg_hal_report_software_interrupt + .word cyg_hal_report_abort_prefetch + .word cyg_hal_report_abort_data + .word 0 // reserved +#endif - movs pc,lr // restore PC from LR, CPSR from SPSR // Handle device interrupts // This is slightly more complicated than the other exception handlers because @@ -656,7 +676,7 @@ call_exception_handler: .code 32 FIQ: - // We can get here from supervisor mode or from IRQ mode. + // We can get here from any non-user mode. mrs r8,spsr // CPSR at time of interrupt and r9,r8,#CPSR_MODE_BITS // isolate pre-interrupt mode cmp r9,#CPSR_IRQ_MODE @@ -667,7 +687,7 @@ FIQ: msr spsr,r8 subs pc,lr,#4 1: - // If FIQ interrupted supervisor mode, switch to IRQ mode and + // If FIQ interrupted other non-user mode, switch to IRQ mode and // fall through to IRQ handler. ldr sp,.__exception_stack // get good stack to save lr and spsr stmdb sp,{r8,lr} @@ -679,36 +699,47 @@ FIQ: // now it looks like we got an IRQ instead of an FIQ except that // FIQ is disabled so we don't recurse. - IRQ: // Note: I use this exception stack while saving the context because // the current SP does not seem to be always valid in this CPU mode. ldr sp,.__exception_stack // get good stack - sub lr,lr,#4 // PC at time of interrupt - stmfd sp!,{r0,fp,ip,lr} - mrs r0,spsr - stmfd sp!,{r0} + stmfd sp!,{r0-r5} // save some supervisor regs + sub r0,lr,#4 // PC at time of interrupt + mrs r1,spsr + mov r2,#CYGNUM_HAL_VECTOR_IRQ + mov r3,sp + +handle_IRQ_or_FIQ: + + mrs r4,cpsr // switch to Supervisor Mode + bic r4,r4,#CPSR_MODE_BITS + orr r4,r4,#CPSR_SUPERVISOR_MODE + msr cpsr,r4 -handle_IRQ_or_FIQ: - mov ip,sp // save SP which will vanish with - // mode switch - mrs r0,cpsr // switch to Supervisor Mode - bic r0,r0,#CPSR_MODE_BITS - orr r0,r0,#CPSR_SUPERVISOR_MODE|CPSR_FIQ_DISABLE|CPSR_IRQ_DISABLE - msr cpsr,r0 // sp,lr are now old values - mov fp,sp // save old SP - sub sp,sp,#ARMREG_SIZE // make space for frame - stmea sp,{r0-r10,fp} // save immediately visible registers - ldmfd ip,{r0-r4} // saved registers - str r0,[sp,#armreg_cpsr] // CPSR at time of interrupt - str r1,[sp,#armreg_r0] // saved R0 - str r2,[sp,#armreg_fp] // saved FP - str r3,[sp,#armreg_ip] // saved IP - str r4,[sp,#armreg_pc] // PC at time of interrupt - str lr,[sp,#armreg_lr] // LR at time of interrupt - str fp,[sp,#armreg_sp] // SP at time of interrupt - mov r0,#CYGNUM_HAL_VECTOR_IRQ // FIXME: we don't distinguish - str r0,[sp,#armreg_vector] // FIQ and IRQ here + mov r5,sp // save original svc sp + mov r4,lr // save original svc lr + stmfd sp!,{r0-r2,r4,r5} // push svc_sp, svc_lr, vector, psr, pc + + // switch to pre-exception mode to get banked regs + mov r0,sp // r0 survives mode switch + mrs r2,cpsr // Save current psr for return + orr r1,r1,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE + msr cpsr,r1 + stmfd r0!,{r8-r12,sp,lr} + msr cpsr,r2 // back to svc mode + mov sp,r0 // update stack pointer + + // now save pre-exception r0-r7 on current stack + ldmfd r3,{r0-r5} + stmfd sp!,{r0-r7} + + // sp needs fixing if exception occured in SVC mode. + ldr r1,[sp,#armreg_cpsr] + and r1,r1,#CPSR_MODE_BITS + cmp r1,#CPSR_SUPERVISOR_MODE + ldreq r1,[sp,#armreg_svcsp] + streq r1,[sp,#armreg_sp] + mov v6,sp // Save pointer to register frame // mov r0,sp @@ -835,28 +866,8 @@ 17: // mov r0,sp // bl show_frame_out - mov ip,sp // get stack pointer - - mrs r0,cpsr // move back to IRQ mode - orr r0,r0,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE - msr cpsr,r0 - nop - nop - - ldr lr,[ip,#armreg_lr] - ldr sp,[sp,#armreg_sp] - - bic r0,r0,#CPSR_MODE_BITS - orr r0,r0,#CPSR_IRQ_MODE - msr cpsr,r0 - - mov sp,ip - ldr lr,[sp,#armreg_pc] - ldr r0,[sp,#armreg_cpsr] - ldr ip,[sp,#armreg_ip] - msr spsr,r0 - ldmfd sp,{r0-r10,fp} - movs pc,lr // restore PC from LR, CPSR from SPSR + // return from IRQ is same as return from exception + b return_from_exception #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK // Execute pending DSRs the interrupt stack @@ -1001,6 +1012,9 @@ PTR(cyg_scheduler_sched_lock) PTR(irq_level) PTR(__interrupt_stack) #endif +#ifdef CYGHWR_HAL_ARM_DUMP_EXCEPTIONS +PTR(__dump_procs) +#endif // // Identification - useful to find out when a system was configured diff --git a/packages/hal/arm/arm9/aaed2000/current/ChangeLog b/packages/hal/arm/arm9/aaed2000/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/ChangeLog @@ -0,0 +1,374 @@ +2002-05-14 Jesper Skov + + * src/aaed2000_misc.c (hal_mmu_init): Fixed warning. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_arm9_aaed2000.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-04-15 Jesper Skov + + * cdl/hal_arm_arm9_aaed2000.cdl: Switch to use arm-elf. + +2002-03-26 Jesper Skov + + * src/lcd_support.c (lcd_comm_init): Fix missing rename. Disable + assembly that breaks GCC. + +2002-03-10 Gary Thomas + + * src/kbd_drvr.c: New file. + + * src/lcd_support.c: + * src/aaed2000_misc.c: + * cdl/hal_arm_arm9_aaed2000.cdl: Split out keyboard driver. + +2002-03-09 Gary Thomas + + * src/aaed2000_misc.c (plf_hardware_init): + Configure touch screen interrupt. + + * include/pkgconf/mlt_arm_arm9_aaed2000_romram.ldi: + * include/pkgconf/mlt_arm_arm9_aaed2000_romram.h: + * include/pkgconf/mlt_arm_arm9_aaed2000_romram.mlt: + * include/pkgconf/mlt_arm_arm9_aaed2000_ram.mlt: + * include/pkgconf/mlt_arm_arm9_aaed2000_ram.ldi: + * include/pkgconf/mlt_arm_arm9_aaed2000_ram.h: + LCD screen needs 0xA0000 bytes. + + * include/lcd_support.h: Remove warnings (when built for eCos). + + * include/aaed2000.h: Add definitions for Synchronous Serial Port + (SSP) which is used by the touch screen. + +2002-01-29 Jesper Skov + + * cdl/hal_arm_arm9_aaed2000.cdl: Use generic linux exec command. + * src/redboot_linux_exec.c: Removed. + +2002-01-28 Jesper Skov + + * cdl/hal_arm_arm9_aaed2000.cdl: Removed explicit plf_io.h + declaration. + +2002-01-10 Jesper Skov + + * src/lcd_support.c (KeyboardScan): Increase debouce stability + period to counter the incresed CPU/bus speed. 100 seems fine, + using 120 for good measure. + +2001-12-12 Jesper Skov + + * include/aaed2000.h: Increase waitstates. + +2001-12-11 Jesper Skov + + * cdl/hal_arm_arm9_aaed2000.cdl: Removed custom clocking. Changed + clocking mode to generic instead of Agilent specific. + * include/aaed2000.h: Same. Also add idle cycles to static mem + controller options. Don't do autoprecharge of SDRAM. + + * include/hal_platform_setup.h: Add idle cycles to static mem + controller options. Change CPU clock to synchronous mode. Correct + SDRAM refresh count calculation. + + +2001-11-29 Jesper Skov + + * src/lcd_support.c (KeyboardScan): Instead of just debouncing for + a fixed time (loop of 1000), look for changes in the state and + break out early if the reading is stable. + +2001-11-27 Jesper Skov + + * include/aaed2000.h (AAEC_CSC_CLKSET_INIT): Fix definition. + + * src/lcd_support.c: Swap " and @. + +2001-11-22 Jesper Skov + + * cdl/hal_arm_arm9_aaed2000.cdl: Use HOST_CC instead of 'cc'. + +2001-11-16 Jesper Skov + + * include/hal_platform_setup.h: Removed unused code. Don't mess + with the system setup in RAM startup mode. + +2001-11-15 Jesper Skov + + * src/redboot_linux_exec.c (do_exec): Use CYGARC_PHYSICAL_ADDRESS + instead of UNMAPPED_ADDR. + + * include/plf_io.h: Added CYGARC_PHYSICAL_ADDRESS and + CYGARC_VIRTUAL_ADDRESS. + + * include/aaed2000.h: Added definitions for memory areas. + + * src/redboot_linux_exec.c (do_exec): Use load start/end + parameters as defaults. Don't copy image if specified length is + zero. + +2001-11-14 Jesper Skov + + * cdl/hal_arm_arm9_aaed2000.cdl: Use 508kHz timer for kernel + clock. + * src/aaed2000_misc.c (hal_clock_initialize): Same. + + * src/hal_diag.c (cyg_hal_plf_serial_putc): Wait for TX to + complete before returning. + +2001-11-14 Gary Thomas + + * src/lcd_support.c (KeyboardScan): Reduce bounce time. + (lcd_comm_getc_timeout): Scan code is slow - adjust timeout. + +2001-11-13 Jesper Skov + + * include/plf_io.h: Include platform header. + +2001-11-12 Jesper Skov + + * include/pkgconf/mlt_arm_arm9_aaed2000_rom.ldi: Updated. + * include/pkgconf/mlt_arm_arm9_aaed2000_rom.h: Same. + * include/pkgconf/mlt_arm_arm9_aaed2000_rom.mlt: Same. + + * src/lcd_support.c: Fix compiler warning. + + * src/hal_diag.c: Calculate baud rate clock properly. + Removed some unused code. Clear more registers on init. + Added interrupt handling code. Also enable RX timeout. + + * src/aaed2000_misc.c: Added more interrupt ack details. Minor + reorg of code. + + * include/aaed2000.h: Fixed SDRAM RAS definition. Added some + interrupt-end registers. + + * cdl/hal_arm_arm9_aaed2000.cdl: Set default baud rates to 38400. + +2001-11-12 Gary Thomas + + * include/lcd_support.h: Add frame buffer type (RGB555). + + * src/lcd_support.c: + * cdl/hal_arm_arm9_aaed2000.cdl: Reorg LCD support, separating + basic LCD functionality with virtual screen [console] support. + +2001-11-10 Gary Thomas + + * src/aaed2000_misc.c (hal_interrupt_acknowledge): + (hal_interrupt_configure): + + * include/aaed2000.h: Flush out interrupt control & support. + Ethernet now works interrupt driven. + +2001-11-09 Jesper Skov + + * misc/redboot_primary_RAM.ecm: Added. + * misc/redboot_primary_ROMRAM.ecm: Added. + +2001-11-08 Jesper Skov + + * src/aaed2000_misc.c: Set up RTC. Added interrupt handling. + + * cdl/hal_arm_arm9_aaed2000.cdl: Calculate correct RTC + period. Removed prescaler option. + + + * include/hal_platform_setup.h: Also set up ether/GPIO access + details for RAM startup (to support running under the ARM + monitor). + +2001-11-08 Gary Thomas + + * src/lcd_support.c: + * src/banner.xpm: Minor adjustments to logo & screen colors. + +2001-11-07 Jesper Skov + + * include/hal_platform_ints.h: Added descriptions for external + interrupt sources. + + * src/aaed2000_misc.c: Fixed warnings. + * src/lcd_support.c: Same. + + * misc/redboot_ROMRAM.ecm: Removed ESA settings. + * misc/redboot_ROM.ecm: Same. + * misc/redboot_RAM.ecm: Same. + +2001-11-06 Jesper Skov + + * include/hal_platform_setup.h: Set SDRAM refresh rate according + to bus speed. + + * include/aaed2000.h: Added more "clock and state" definitions. + + * cdl/hal_arm_arm9_aaed2000.cdl: Added configury for cpu/bus clock + speeds. + + * include/aaed2000.h: Added more interrupt controller + definitions. + + * include/hal_platform_setup.h: Disable interrupts and MMU/cache + before setting up SDRAM. + +2001-11-06 Gary Thomas + + * src/lcd_support.c: Remove unnecessary HAL_VIRT_TO_PHYS_ADDRESS(). + Tighten up reset/init timings. Improve lcd_clear() so it runs a + bit faster. + (lcd_drawc): + (lcd_scroll): Add hand-crafted optimizations. + + * include/pkgconf/mlt_arm_arm9_aaed2000_romram.mlt: + * include/pkgconf/mlt_arm_arm9_aaed2000_romram.ldi: + * include/pkgconf/mlt_arm_arm9_aaed2000_romram.h: + * include/pkgconf/mlt_arm_arm9_aaed2000_ram.mlt: + * include/pkgconf/mlt_arm_arm9_aaed2000_ram.ldi: + * include/pkgconf/mlt_arm_arm9_aaed2000_ram.h: + Setup for true ROMRAM mode. + +2001-11-05 Jesper Skov + + * src/arm_mon.c: Fill memory with the flash clear value (0xff). + + * include/aaed2000.h: Added SDRAM details. + + * include/hal_platform_setup.h: Initialize bus controllers, + including [presently disabled] SDRAM setup. + + * src/aaed2000_misc.c (plf_hardware_init): Removed bus controller + setup. + +2001-11-05 Gary Thomas + + * src/lcd_support.c: Minor tinkering, mostly with scrolling. + + * src/aaed2000_misc.c (hal_delay_us): Rewrite using timer #3. + + * include/aaed2000.h: Add timer definitions. + +2001-11-04 Gary Thomas + + * include/lcd_support.h: + * src/lcd_support.c: + * src/font.h: + * src/banner.xpm: New file(s) - LCD/KBD virtual console support. + + * include/pkgconf/mlt_arm_arm9_aaed2000_romram.mlt: + * include/pkgconf/mlt_arm_arm9_aaed2000_romram.ldi: + * include/pkgconf/mlt_arm_arm9_aaed2000_romram.h: + * include/pkgconf/mlt_arm_arm9_aaed2000_ram.mlt: + * include/pkgconf/mlt_arm_arm9_aaed2000_ram.ldi: + * include/pkgconf/mlt_arm_arm9_aaed2000_ram.h: Leave space for LCD. + + * include/aaed2000.h: Add definitions for LCD, extended GPIO. + + * src/aaed2000_misc.c (plf_if_init): + * cdl/hal_arm_arm9_aaed2000.cdl: Add LCD/KBD as virtual console. + +2001-11-02 Jesper Skov + + * src/redboot_linux_exec.c: Updated header + + * src/hal_diag.c: Changed interrupt vector. + + * src/aaed2000_misc.c (plf_hardware_init): Cleanup. Fixed + warnings. + + * include/plf_stub.h: Header updated. + + * cdl/hal_arm_arm9_aaed2000.cdl: Changed clock setting. + + * include/hal_platform_setup.h: Removed unused LED macro. + + * include/hal_diag.h: Cleaned up. + + * include/aaed2000.h: Removed non-AAEC definitions. + + * include/hal_platform_ints.h: Added AAEC vectors. + +2001-11-02 Gary Thomas + + * src/aaed2000_misc.c (hal_mmu_init): Map in Compact Flash / PCMCIA. + +2001-11-01 Jesper Skov + + * src/redboot_linux_exec.c (do_exec): Workaround for compiler + bug. + + * include/aaed2000.h: Fix daft register address typos. + + * src/hal_diag.c (cyg_hal_plf_serial_init_channel): Enable device + before setting it up (from dwmw2). + + * include/hal_platform_ints.h: Try to soft reset the board. + + * include/pkgconf/mlt_arm_arm9_aaed2000_rom.ldi: Changed base + address to flash+128k + * include/pkgconf/mlt_arm_arm9_aaed2000_rom.mlt: Same. + * include/pkgconf/mlt_arm_arm9_aaed2000_rom.h: Same. + + * src/arm_mon.c (IMAGE_BASE, LOAD_ADDRESS): Moved RedBoot to flash + base +0x20000. Made LOAD_ADDRESS depend on startup type. + + * misc/redboot_ROMRAM.ecm: Move FIS and config blocks to their + default positions (at end of flash). Removed + CYGNUM_REDBOOT_FLASH_RESERVED_BASE setting. + * misc/redboot_ROM.ecm: Removed CYGNUM_REDBOOT_FLASH_RESERVED_BASE + setting. + * misc/redboot_RAM.ecm: Same. + +2001-10-31 Jesper Skov + + * src/arm_mon.c: Added. + + * include/plf_io.h (_ADDR_REDBOOT_TO_ARM): undo mistaken commit. + + * src/aaed2000_misc.c (plf_hardware_init): Added PIO setup. + + * include/plf_io.h (_ADDR_REDBOOT_TO_ARM): added. + + * cdl/hal_arm_arm9_aaed2000.cdl: define CYGBLD_HAL_PLATFORM_IO_H. + +2001-10-30 Jesper Skov + + * Updated MLT files for the new tools. + + * Imported sources from Gary Thomas. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/arm/arm9/aaed2000/current/cdl/hal_arm_arm9_aaed2000.cdl b/packages/hal/arm/arm9/aaed2000/current/cdl/hal_arm_arm9_aaed2000.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/cdl/hal_arm_arm9_aaed2000.cdl @@ -0,0 +1,555 @@ +# ==================================================================== +# +# hal_arm_arm9_aaed2000.cdl +# +# Agilent AAED2000 platform HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Original data: gthomas +# Contributors: +# Date: 2001-10-27 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== +cdl_package CYGPKG_HAL_ARM_ARM9_AAED2000 { + display "Agilent Aaed2000 evaluation board" + parent CYGPKG_HAL_ARM_ARM9 + requires CYGPKG_HAL_ARM_ARM9_ARM920T + hardware + include_dir cyg/hal + define_header hal_arm_arm9_aaed2000.h + description " + This HAL platform package provides generic + support for the Agilent based board, known as 'aaed2000'." + + compile aaed2000_misc.c hal_diag.c kbd_drvr.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_PLF_IF_INIT + + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_VARIANT_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + + puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM9\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"AAED2000 system\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\[\" __Xstr(CYGHWR_REDBOOT_BOOTMONITOR) \"\]\" " + puts $::cdl_header "#define HAL_PLATFORM_MACHINE_TYPE 106" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + default_value {"RAM"} + legal_values {"RAM" "ROM" "ROMRAM" } + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the Aaed2000 eval board it is possible to build + the system for either RAM bootstrap or ROM bootstrap(s). Select + 'ram' when building programs to load into RAM using eCos GDB + stubs. Select 'rom' when building a stand-alone application + which will be put into ROM, or for the special case of + building the eCos GDB stubs themselves." + } + + cdl_component CYGNUM_HAL_ARM_AAED2000_CLOCK { + display "Board (CPU and bus) speed" + flavor data + legal_values {"150/75MHz" "166/83MHz"} + default_value {"150/75MHz"} + description " + This option controls the CPU and bus frequencies. It + does so by presetting the PLL details when one of the + frequency combinations are selected. It's also possible + to customize the PLL values by selecting 'Custom' + and adjusting the options accordingly. See the 'Clock and Control' + section of the CPU manual for further information." + + # Note: there are options for these settings, even though they + # are compute. That's because I initially thought the cpu/bus + # speed could be calculated properly - for now they are also + # just set as a result of the _CLOCK choice. + # See table 5-7 in the manual for the setting of these parameters. + cdl_option CYGNUM_HAL_ARM_AAED2000_CLOCK_REF { + display "CPU clock reference clock (crystal)" + flavor data + calculated 14745600 + description " + This is the CPU reference clock. It is 14.7456MHz and + cannot be changed." + } + + cdl_option CYGNUM_HAL_ARM_AAED2000_CLOCK_HCLKDIV { + display "CPU clock HCLKDIV" + flavor data + calculated { CYGNUM_HAL_ARM_AAED2000_CLOCK == "150/75MHz" ? 1 : + CYGNUM_HAL_ARM_AAED2000_CLOCK == "166/83MHz" ? 1 : + 0 } + description " + The HCLKDIV value." + } + + cdl_option CYGNUM_HAL_ARM_AAED2000_CLOCK_PREDIV { + display "CPU clock PREDIV" + flavor data + calculated { CYGNUM_HAL_ARM_AAED2000_CLOCK == "150/75MHz" ? 12 : + CYGNUM_HAL_ARM_AAED2000_CLOCK == "166/83MHz" ? 18 : + 0 } + description " + The PREDIV value." + } + + cdl_option CYGNUM_HAL_ARM_AAED2000_CLOCK_MAINDIV1 { + display "CPU clock MAINDIV1" + flavor data + calculated { CYGNUM_HAL_ARM_AAED2000_CLOCK == "150/75MHz" ? 13 : + CYGNUM_HAL_ARM_AAED2000_CLOCK == "166/83MHz" ? 13 : + 0 } + description " + The MAINDIV1 value." + } + + cdl_option CYGNUM_HAL_ARM_AAED2000_CLOCK_MAINDIV2 { + display "CPU clock MAINDIV2" + flavor data + calculated { CYGNUM_HAL_ARM_AAED2000_CLOCK == "150/75MHz" ? 17 : + CYGNUM_HAL_ARM_AAED2000_CLOCK == "166/83MHz" ? 28 : + 0 } + description " + The MAINDIV2 value." + } + + cdl_option CYGNUM_HAL_ARM_AAED2000_CLOCK_PCLKDIV { + display "CPU clock PCLKDIV" + flavor data + calculated { CYGNUM_HAL_ARM_AAED2000_CLOCK == "150/75MHz" ? 1 : + CYGNUM_HAL_ARM_AAED2000_CLOCK == "166/83MHz" ? 1 : + 0 } + description " + The PCLKDIV value." + } + + cdl_option CYGNUM_HAL_ARM_AAED2000_CLOCK_PS { + display "CPU clock PS" + flavor data + calculated { CYGNUM_HAL_ARM_AAED2000_CLOCK == "150/75MHz" ? 1 : + CYGNUM_HAL_ARM_AAED2000_CLOCK == "166/83MHz" ? 1 : + 0 } + description " + The PCLKDIV value." + } + + + cdl_option CYGNUM_HAL_ARM_AAED2000_CPU_CLOCK { + display "CPU speed" + flavor data + calculated { CYGNUM_HAL_ARM_AAED2000_CLOCK == "150/75MHz" ? 150890000 : + CYGNUM_HAL_ARM_AAED2000_CLOCK == "166/83MHz" ? 165888000 : + 0 } + description " + This is the actual CPU operating frequency." + } + + cdl_option CYGNUM_HAL_ARM_AAED2000_BUS_CLOCK { + display "Bus speed" + flavor data + calculated { CYGNUM_HAL_ARM_AAED2000_CLOCK == "150/75MHz" ? 75445000 : + CYGNUM_HAL_ARM_AAED2000_CLOCK == "166/83MHz" ? 82944000 : + 0 } + description " + This is the actual bus operating frequency." + } + } + + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants" + flavor none + no_define + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + # The timer used runs at 508kHz + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated ((508000/CYGNUM_HAL_RTC_DENOMINATOR)-1) + } + } + + cdl_component CYGSEM_AAED2000_LCD_SUPPORT { + display "Support LCD" + flavor bool + default_value 1 + compile lcd_support.c + description " + Enabling this option will enable the use the LCD as a + simple framebuffer, suitable for use with a windowing + package." + + cdl_option CYGSEM_AAED2000_LCD_PORTRAIT_MODE { + display "LCD portrait mode" + flavor bool + default_value 0 + description " + Setting this option will orient the data on the LCD screen + in portrait (480x640) mode." + } + + cdl_component CYGSEM_AAED2000_LCD_COMM { + display "Support LCD/keyboard for comminication channel" + active_if CYGPKG_REDBOOT + flavor bool + default_value 1 + description " + Enabling this option will use the LCD and keyboard for a + communications channel, suitable for RedBoot, etc." + + cdl_option CYGOPT_AAED2000_LCD_COMM_LOGO { + display "RedHat logo location" + flavor booldata + legal_values { "TOP" "BOTTOM" } + default_value { "TOP" } + description " + Use this option to control where the RedHat logo is placed + on the LCD screen." + } + } + } + + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1+CYGSEM_AAED2000_LCD_COMM + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The aaed2000 board has two serial ports. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + The aaed2000 board has two serial ports. This option + chooses which port will be used for diagnostic output." + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + no_define + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + parent CYGPKG_NONE + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "arm-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mcpu=arm9 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which are used to + compile all packages by default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-Wl,--gc-sections -Wl,-static -g -O2 -nostdlib" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.srec : /bin/gdb_module.img + $(OBJCOPY) --remove-section=.fixed_vectors $< gdb_module.tmp + $(OBJCOPY) -O srec --change-address 0x10000000 gdb_module.tmp $@ + } + } + } + + cdl_component CYGPKG_HAL_ARM_ARM9_AAED2000_OPTIONS { + display "ARM9/AAED2000 build options" + flavor none + no_define + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_HAL_ARM_ARM9_AAED2000_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the ARM9 AAED2000 HAL. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_HAL_ARM_ARM9_AAED2000_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the ARM9 AAED2000 HAL. These flags are removed from + the set of global flags if present." + } + + cdl_option CYGPKG_HAL_ARM_ARM9_AAED2000_TESTS { + display "ARM9/AAED2000 tests" + flavor data + no_define + calculated { "" } + description " + This option specifies the set of tests for the ARM9 Aaed2000 HAL." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "arm_arm9_aaed2000_ram" : \ + CYG_HAL_STARTUP == "ROM" ? "arm_arm9_aaed2000_rom" : \ + "arm_arm9_aaed2000_romram" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" || CYG_HAL_STARTUP == "ROMRAM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"GDB_stubs\" provides support when GDB stubs are included in + the ROM monitor or boot ROM." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + # The backup image is not needed, since ROMRAM is the normal + # RedBoot startup type. + requires {!CYGPKG_REDBOOT_FLASH || CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP == 0} + + # RedBoot details + requires { CYGSEM_REDBOOT_ARM_LINUX_BOOT } + requires { CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT == 0xf0008000 } + define_proc { + puts $::cdl_header "#define CYGHWR_REDBOOT_ARM_TRAMPOLINE_ADDRESS 0x00001f00" + } + + cdl_option CYGHWR_REDBOOT_BOOTMONITOR { + display "Controls where RedBoot is in the boot chain" + default_value {"Primary"} + legal_values {"Primary"} + flavor data + active_if CYGPKG_REDBOOT_FLASH + description " + This option selects whether RedBoot sits in the boot chain. + Presently it's only supported as the primary booter." + + } + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to the various relocated SREC images needed + for flash updating." + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } + +} diff --git a/packages/hal/arm/arm9/aaed2000/current/include/aaed2000.h b/packages/hal/arm/arm9/aaed2000/current/include/aaed2000.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/aaed2000.h @@ -0,0 +1,378 @@ +#ifndef CYGONCE_AAED2000_H +#define CYGONCE_AAED2000_H +/*============================================================================= +// +// aaed2000.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Date: 2001-10-30 +// Purpose: Agilent/AAED2000 platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +//--------------------------------------------------------------------------- +// Memory layout details needed by conversion macro +#define AAED2000_SDRAM_PHYS_BASE 0xF0000000 +#define AAED2000_SDRAM_VIRT_BASE 0x00000000 +#define AAED2000_SDRAM_SIZE 0x02000000 +#define AAED2000_SDRAM_MASK (AAED2000_SDRAM_SIZE-1) + +#define AAED2000_FLASH_PHYS_BASE 0x00000000 +#define AAED2000_FLASH_VIRT_BASE 0x60000000 +#define AAED2000_FLASH_SIZE 0x02000000 +#define AAED2000_FLASH_MASK (AAED2000_FLASH_SIZE-1) + +//--------------------------------------------------------------------------- +// Clock and state controller +#define AAEC_CSC_BLEOI 0x80000410 // battery low end of interrupt +#define AAEC_CSC_MCEOI 0x80000414 // media changed end of interrupt +#define AAEC_CSC_TEOI 0x80000418 // tick end of interrupt +#define AAEC_CSC_CLKSET 0x80000420 + +#define AAEC_CSC_CLKSET_PLL 0x80000000 +#define AAEC_CSC_CLKSET_SMCROM 0x01000000 +#define AAEC_CSC_CLKSET_PS(_n_) ((_n_)<<18) // values 0-3 +#define AAEC_CSC_CLKSET_PCLKDIV(_n_) ((_n_)<<16) // values 0-3 +#define AAEC_CSC_CLKSET_MAINDIV2(_n_) ((_n_)<<11) // values 0-31 +#define AAEC_CSC_CLKSET_MAINDIV1(_n_) ((_n_)<<7) // values 0-15 +#define AAEC_CSC_CLKSET_PREDIV(_n_) ((_n_)<<2) // values 0-31 +#define AAEC_CSC_CLKSET_HCLKDIV(_n_) ((_n_)) // values 0-3 + + +#define CYGNUM_HAL_ARM_AAED2000_BUS_CLOCK_MHZ ((CYGNUM_HAL_ARM_AAED2000_BUS_CLOCK+500000)/1000000) + +#define AAEC_CSC_CLKSET_INIT \ + ( AAEC_CSC_CLKSET_HCLKDIV(CYGNUM_HAL_ARM_AAED2000_CLOCK_HCLKDIV) \ + | AAEC_CSC_CLKSET_PREDIV(CYGNUM_HAL_ARM_AAED2000_CLOCK_PREDIV) \ + | AAEC_CSC_CLKSET_MAINDIV1(CYGNUM_HAL_ARM_AAED2000_CLOCK_MAINDIV1) \ + | AAEC_CSC_CLKSET_MAINDIV2(CYGNUM_HAL_ARM_AAED2000_CLOCK_MAINDIV2) \ + | AAEC_CSC_CLKSET_PCLKDIV(CYGNUM_HAL_ARM_AAED2000_CLOCK_PCLKDIV) \ + | AAEC_CSC_CLKSET_PS(CYGNUM_HAL_ARM_AAED2000_CLOCK_PS) \ + | AAEC_CSC_CLKSET_SMCROM) + +//--------------------------------------------------------------------------- +// Interrupt controller +#define AAEC_INT_SR 0x80000500 +#define AAEC_INT_RSR 0x80000504 // Raw [unmasked] interrupt status +#define AAEC_INT_ENS 0x80000508 +#define AAEC_INT_ENC 0x8000050c +#define AAEC_INT_TEST1 0x80000514 +#define AAEC_INT_TEST2 0x80000518 + +#define AAEC_INTS_T3OI CYGNUM_HAL_INTERRUPT_TC3OI // Timer #3 overflow + +//--------------------------------------------------------------------------- +// UARTs +#define AAEC_UART1 0x80000600 +#define AAEC_UART2 0x80000700 +#define AAEC_UART3 0x80000800 + +#define AAEC_UART2_UMS2EOI 0x80000714 // modem end of interrupt +#define AAEC_UART2_UMS3EOI 0x80000814 // modem end of interrupt + +#define AAEC_UART_DATA 0x0000 // Data/FIFO register +#define AAEC_UART_LCR 0x0004 // Control register +#define AAEC_UART_LCR_BRK 0x0001 // Send break +#define AAEC_UART_LCR_PEN 0x0002 // Enable parity +#define AAEC_UART_LCR_EP 0x0004 // Odd/Even parity +#define AAEC_UART_LCR_S2 0x0008 // One/Two stop bits +#define AAEC_UART_LCR_FIFO 0x0010 // Enable FIFO +#define AAEC_UART_LCR_WL5 0x0000 // Word length - 5 bits +#define AAEC_UART_LCR_WL6 0x0020 // Word length - 6 bits +#define AAEC_UART_LCR_WL7 0x0040 // Word length - 7 bits +#define AAEC_UART_LCR_WL8 0x0060 // Word length - 8 bits +#define AAEC_UART_BAUD 0x0008 // Baud rate +#define AAEC_UART_CTRL 0x000C // Control register +#define AAEC_UART_CTRL_ENAB 0x0001 // Enable uart +#define AAEC_UART_CTRL_SIR 0x0002 // Enable SIR IrDA +#define AAEC_UART_CTRL_SIRLP 0x0004 // Enable low power IrDA +#define AAEC_UART_CTRL_RXP 0x0008 // Receive pin polarity +#define AAEC_UART_CTRL_TXP 0x0010 // Transmit pin polarity +#define AAEC_UART_CTRL_MXP 0x0020 // Modem pin polarity +#define AAEC_UART_CTRL_LOOP 0x0040 // Loopback mode +#define AAEC_UART_CTRL_SIRBD 0x0080 // blanking disable +#define AAEC_UART_STATUS 0x0010 // Status +#define AAEC_UART_STATUS_CTS 0x0001 // Clear-to-send status +#define AAEC_UART_STATUS_DSR 0x0002 // Data-set-ready status +#define AAEC_UART_STATUS_DCD 0x0004 // Data-carrier-detect status +#define AAEC_UART_STATUS_TxBSY 0x0008 // Transmitter busy +#define AAEC_UART_STATUS_RxFE 0x0010 // Receive FIFO empty +#define AAEC_UART_STATUS_TxFF 0x0020 // Transmit FIFO full +#define AAEC_UART_STATUS_RxFF 0x0040 // Receive FIFO full +#define AAEC_UART_STATUS_TxFE 0x0080 // Transmit FIFO empty +#define AAEC_UART_INT 0x0014 // Interrupt status +#define AAEC_UART_INTM 0x0018 // Interrupt mask register +#define AAEC_UART_INTRES 0x001c // Interrupt result (masked interrupt status) +#define AAEC_UART_INT_RIS 0x0001 // Rx interrupt +#define AAEC_UART_INT_TIS 0x0002 // Tx interrupt +#define AAEC_UART_INT_MIS 0x0004 // Modem status interrupt +#define AAEC_UART_INT_RTIS 0x0008 // Rx timeout interrupt +//#define AAEC_UART_MCTRL 0x0100 // Modem control + +//--------------------------------------------------------------------------- +// Pump control +#define AAEC_PUMP_CONTROL 0x80000900 // Control +#define AAEC_PUMP_FREQUENCY 0x80000908 // Frequency + +//--------------------------------------------------------------------------- +// Codec +#define AAEC_COD_CDEOI 0x80000a0c // codec end of interrupt + +//--------------------------------------------------------------------------- +// Synchronous Serial Peripheral (SSP) +#define AAEC_SSP_CR0 0x80000B00 // Control Register 0 +#define AAEC_SSP_CR0_SCR 8 // Serial clock rate - Bits 15..8 +#define AAEC_SSP_CR0_SCR_MASK (0x7F<ON, 1=>OFF) +#define AAED_EXT_GPIO_LED1 0x40000000 // LED 1 (0=>ON, 1=>OFF) +#define AAED_EXT_GPIO_LED2 0x80000000 // LED 2 (0=>ON, 1=>OFF) + +/*---------------------------------------------------------------------------*/ +/* end of aaed2000.h */ +#endif /* CYGONCE_AAED2000_H */ diff --git a/packages/hal/arm/arm9/aaed2000/current/include/hal_diag.h b/packages/hal/arm/arm9/aaed2000/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/hal_diag.h @@ -0,0 +1,72 @@ +#ifndef CYGONCE_HAL_DIAG_H +#define CYGONCE_HAL_DIAG_H +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-10-30 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include +#include + + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +// Not the best place for this, but ... +extern void hal_delay_us(cyg_int32 usecs); + +#define HAL_DELAY_US(n) hal_delay_us(n); + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_DIAG_H */ diff --git a/packages/hal/arm/arm9/aaed2000/current/include/hal_platform_ints.h b/packages/hal/arm/arm9/aaed2000/current/include/hal_platform_ints.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/hal_platform_ints.h @@ -0,0 +1,116 @@ +#ifndef CYGONCE_HAL_PLATFORM_INTS_H +#define CYGONCE_HAL_PLATFORM_INTS_H +//========================================================================== +// +// hal_platform_ints.h +// +// HAL Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-11-02 +// Purpose: Define Interrupt support +// Description: The interrupt details for the Agilent AAED2000 are defined here. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// These are interrupts on the AAEC-2000 core + +#define CYGNUM_HAL_INTERRUPT_GPIO0FIQ 0 +#define CYGNUM_HAL_INTERRUPT_TS CYGNUM_HAL_INTERRUPT_GPIO0FIQ +#define CYGNUM_HAL_INTERRUPT_BLINT 1 +#define CYGNUM_HAL_INTERRUPT_WEINT 2 +#define CYGNUM_HAL_INTERRUPT_MCINT 3 +#define CYGNUM_HAL_INTERRUPT_CSINT 4 +#define CYGNUM_HAL_INTERRUPT_GPIO1INTR 5 +#define CYGNUM_HAL_INTERRUPT_ETH CYGNUM_HAL_INTERRUPT_GPIO1INTR +#define CYGNUM_HAL_INTERRUPT_GPIO2INTR 6 +#define CYGNUM_HAL_INTERRUPT_PCMCIA_CD2 CYGNUM_HAL_INTERRUPT_GPIO2INTR +#define CYGNUM_HAL_INTERRUPT_GPIO3INTR 7 +#define CYGNUM_HAL_INTERRUPT_PCMCIA_CD1 CYGNUM_HAL_INTERRUPT_GPIO3INTR +#define CYGNUM_HAL_INTERRUPT_TC1OI 8 +#define CYGNUM_HAL_INTERRUPT_TC2OI 9 +#define CYGNUM_HAL_INTERRUPT_RTCMI 10 +#define CYGNUM_HAL_INTERRUPT_TINTR 11 +#define CYGNUM_HAL_INTERRUPT_UART1INTR 12 +#define CYGNUM_HAL_INTERRUPT_UART2INTR 13 +#define CYGNUM_HAL_INTERRUPT_LCDINTR 14 +#define CYGNUM_HAL_INTERRUPT_SSEOTI 15 +#define CYGNUM_HAL_INTERRUPT_UART3INTR 16 +#define CYGNUM_HAL_INTERRUPT_SCIINTR 17 +#define CYGNUM_HAL_INTERRUPT_AACINTR 18 +#define CYGNUM_HAL_INTERRUPT_MMCINTR 19 +#define CYGNUM_HAL_INTERRUPT_USBINTR 20 +#define CYGNUM_HAL_INTERRUPT_DMAINTR 21 +#define CYGNUM_HAL_INTERRUPT_TC3OI 22 +#define CYGNUM_HAL_INTERRUPT_GPIO4INTR 23 +#define CYGNUM_HAL_INTERRUPT_SCI_VCCEN CYGNUM_HAL_INTERRUPT_GPIO4INTR +#define CYGNUM_HAL_INTERRUPT_GPIO5INTR 24 +#define CYGNUM_HAL_INTERRUPT_SCI_DETECT CYGNUM_HAL_INTERRUPT_GPIO5INTR +#define CYGNUM_HAL_INTERRUPT_GPIO6INTR 25 +#define CYGNUM_HAL_INTERRUPT_PCMCIA_RDY1 CYGNUM_HAL_INTERRUPT_GPIO6INTR +#define CYGNUM_HAL_INTERRUPT_GPIO7INTR 26 +#define CYGNUM_HAL_INTERRUPT_PCMCIA_RDY2 CYGNUM_HAL_INTERRUPT_GPIO7INTR +#define CYGNUM_HAL_INTERRUPT_BMIINTR 27 + +#define CYGNUM_HAL_INTERRUPT_NONE -1 + +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX (CYGNUM_HAL_INTERRUPT_BMIINTR) + +#define CYGNUM_HAL_ISR_COUNT (CYGNUM_HAL_ISR_MAX-CYGNUM_HAL_ISR_MIN+1) + +// The vector used by the Real time clock +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_TC1OI + +//---------------------------------------------------------------------------- +// Reset. + +externC void cyg_hal_arm9_soft_reset(CYG_ADDRESS); +#define HAL_PLATFORM_RESET() cyg_hal_arm9_soft_reset(0) + +#define HAL_PLATFORM_RESET_ENTRY 0x00000000 + +#endif // CYGONCE_HAL_PLATFORM_INTS_H diff --git a/packages/hal/arm/arm9/aaed2000/current/include/hal_platform_setup.h b/packages/hal/arm/arm9/aaed2000/current/include/hal_platform_setup.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/hal_platform_setup.h @@ -0,0 +1,270 @@ +#ifndef CYGONCE_HAL_PLATFORM_SETUP_H +#define CYGONCE_HAL_PLATFORM_SETUP_H +/*============================================================================= +// +// hal_platform_setup.h +// +// Platform specific support for HAL (assembly code) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-10-27 +// Purpose: ARM9/AAED2000 platform specific support routines +// Description: +// Usage: #include +// Only used by "vectors.S" +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include // System-wide configuration info +#include CYGBLD_HAL_VARIANT_H // Variant specific configuration +#include CYGBLD_HAL_PLATFORM_H // Platform specific configuration +#include // MMU definitions +#include // Platform specific hardware definitions + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) +#define PLATFORM_SETUP1 _platform_setup1 +#define CYGHWR_HAL_ARM_HAS_MMU +#define CYGSEM_HAL_ROM_RESET_USES_JUMP + +// We need this here - can't rely on a translation table until MMU has +// been initialized + .macro RAW_LED_MACRO x + ldr r0,=0x30000000 + ldr r1,[r0] + bic r1,r1,#0xE0000000 + orr r1,r1,#((0x7 & ~(\x))<<29) + str r1, [r0] + .endm + +// This macro represents the initial startup code for the platform + .macro _platform_setup1 + RAW_LED_MACRO 0 +#ifndef CYG_HAL_STARTUP_RAM + // Prevent all interrupts + ldr r0,=AAEC_INT_ENC + mov r1,#-1 + str r1,[r0] + + // Disable and clear caches + mrc p15,0,r0,c1,c0,0 + bic r0,r0,#0x1000 // disable ICache + bic r0,r0,#0x000f // disable DCache, write buffer, + // MMU and alignment faults + mcr p15,0,r0,c1,c0,0 + nop + nop + mov r0,#0 + mcr p15,0,r0,c7,c6,0 // clear data cache +#if 0 + mrc p15,0,r0,c15,c1,0 // disable streaming + orr r0,r0,#0x80 + mcr p15,0,r0,c15,c1,0 +#endif + + // Initialize memory controllers + + // Static memory controller + // Area0: Flash: 32bit wide + ldr r0,=AAEC_SMCBCR0 + ldr r1,=(AAEC_SMCBCR_MW32 | AAEC_SMCBCR_WST(_CS0_WST) | AAEC_SMCBCR_IDCY(_CS0_IDCY)) + str r1,[r0] + // Area1: Ethernet: 16bit wide + ldr r0,=AAEC_SMCBCR1 + ldr r1,=(AAEC_SMCBCR_MW16 | AAEC_SMCBCR_WST(_CS1_WST) | AAEC_SMCBCR_IDCY(_CS1_IDCY)) + str r1,[r0] + // Area3: GPIO: 32bit wide + ldr r0,=AAEC_SMCBCR3 + ldr r1,=(AAEC_SMCBCR_MW32 | AAEC_SMCBCR_WST(_CS3_WST) | AAEC_SMCBCR_IDCY(_CS3_IDCY)) + str r1,[r0] + RAW_LED_MACRO 1 + + // Set clock frequencies + // First set CPU to synchronous mode + mrc p15, 0, r0, c1, c0, 0 + // configure for synchronous mode: FCLK >= HCLK by integer + // multiple + orr r0, r0, #0x40000000 + // configure for FastBus mode - FCLK and HCLK *must* be equal + // bic r0, r0, #0x40000000 + bic r0, r0, #0x80000000 + mcr p15, 0, r0, c1, c0, 0 + + ldr r0,=AAEC_CSC_CLKSET + ldr r1,=AAEC_CSC_CLKSET_INIT + str r1,[r0] + // follow clock change by 5 NOPs + nop;nop;nop;nop;nop + + + // Synchronous memory controller (as per table 4-12) + + ldr r0,=AAEC_SMC_DEV0 + ldr r1,=AAEC_SMC_DEV_INIT + str r1,[r0] + str r1,[r0, #4] + str r1,[r0, #8] + str r1,[r0, #12] + + // step1: delay 100usecs + ldr r2,=AAEC_TMR_T1_BASE + ldr r3,=AAEC_TMR_TxCONTROL_508KHZ_uS(100) + str r3,[r2, #AAEC_TMR_TxLOAD_OFFSET] + ldr r3,=(AAEC_TMR_TxCONTROL_ENABLE|AAEC_TMR_TxCONTROL_MODE_FREE|AAEC_TMR_TxCONTROL_508KHZ) + str r3,[r2, #AAEC_TMR_TxCONTROL_OFFSET] +1: ldr r3,[r2, #AAEC_TMR_TxVALUE_OFFSET] + cmp r3,#0 + bne 1b + str r3,[r2, #AAEC_TMR_TxCONTROL_OFFSET] + + // step2: issue NOP command + ldr r0,=AAEC_SMC_GLOBAL + ldr r1,=AAEC_SMC_GLOBAL_CMD_NOP + str r1,[r0] + + // step3: wait 200usecs + ldr r3,=AAEC_TMR_TxCONTROL_508KHZ_uS(200) + str r3,[r2, #AAEC_TMR_TxLOAD_OFFSET] + ldr r3,=(AAEC_TMR_TxCONTROL_ENABLE|AAEC_TMR_TxCONTROL_MODE_FREE|AAEC_TMR_TxCONTROL_508KHZ) + str r3,[r2, #AAEC_TMR_TxCONTROL_OFFSET] +1: ldr r3,[r2, #AAEC_TMR_TxVALUE_OFFSET] + cmp r3,#0 + bne 1b + str r3,[r2, #AAEC_TMR_TxCONTROL_OFFSET] + + // step4: PreCharge All + ldr r1,=AAEC_SMC_GLOBAL_CMD_PREALL + str r1,[r0] + + // step5: set refresh time to 10 + ldr r3,=AAEC_SMC_REFRESH_TIME + mov r4,#10 + str r4,[r3] + + // step6: wait 80 clock cycles, allowing 8 refresh cycles for SDRAM + mov r3, #100 +1: subs r3, r3, #1 + bne 1b + + // step7: set normal refresh count + // We need to do a refresh every 15.6usecs. The counter runs + // at bus clock, so the delay is (15.6usecs*bus speed) or + // (156*(bus speed/10)/1000000). + ldr r3,=AAEC_SMC_REFRESH_TIME + ldr r4,=(156*(CYGNUM_HAL_ARM_AAED2000_BUS_CLOCK/10)/1000000) + str r4,[r3] + + // step8: set mode + ldr r1,=AAEC_SMC_GLOBAL_CMD_MODE + str r1,[r0] + + // step9: program mode + // from page 36: SDRAM, WBL=0, TM=0, CAS=3, Sequential, BL=4 + ldr r3,=0xf000c800 + ldr r3,[r3] + + // step10: enable SDRAM + // step8: set mode + ldr r1,=AAEC_SMC_GLOBAL_CMD_ENABLE + str r1,[r0] + RAW_LED_MACRO 2 +#endif +#ifdef CYG_HAL_STARTUP_ROMRAM + // Compute [logical] base address of this image in ROM + bl 10f +10: mov r9,lr + ldr r8,=~0xFF01FFFF // Bits to ignore + and r9,r9,r8 + orr r9,r9,#0x60000000 // Turn into ROM address +#endif + + // Set up a stack [for calling C code] + ldr r1,=__startup_stack + ldr r2,=AAED2000_SDRAM_PHYS_BASE + orr sp,r1,r2 + + // Create MMU tables + RAW_LED_MACRO 4 + bl hal_mmu_init + RAW_LED_MACRO 5 + + // Enable MMU + ldr r2,=10f +#ifdef CYG_HAL_STARTUP_ROMRAM + ldr r1,=__exception_handlers + sub r1,r2,r1 + add r2,r9,r1 // r9 has ROM offset +#endif + ldr r1,=MMU_Control_Init|MMU_Control_M + mcr MMU_CP,0,r1,MMU_Control,c0 + mov pc,r2 /* Change address spaces */ + nop + nop + nop +10: + RAW_LED_MACRO 6 + +#ifdef CYG_HAL_STARTUP_ROMRAM + mov r0,r9 // Relocate FLASH/ROM to RAM + ldr r1,=__exception_handlers // ram base & length + ldr r2,=__rom_data_end +20: ldr r3,[r0],#4 + str r3,[r1],#4 + cmp r1,r2 + bne 20b + ldr r0,=30f + mov pc,r0 + nop + nop + nop + nop +30: +#endif + RAW_LED_MACRO 7 + .endm + +#else // defined(CYG_HAL_STARTUP_RAM) +#define PLATFORM_SETUP1 +#endif + +//----------------------------------------------------------------------------- +// end of hal_platform_setup.h +#endif // CYGONCE_HAL_PLATFORM_SETUP_H diff --git a/packages/hal/arm/arm9/aaed2000/current/include/lcd_support.h b/packages/hal/arm/arm9/aaed2000/current/include/lcd_support.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/lcd_support.h @@ -0,0 +1,76 @@ +#ifndef _LCD_SUPPORT_H_ +#define _LCD_SUPPORT_H_ +//========================================================================== +// +// lcd_support.h +// +// Agilent AAED-2000 - LCD support routines +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-09-29 +// Description: Simple LCD support +//####DESCRIPTIONEND#### + +struct lcd_info { + short height, width; // Pixels + short bpp; // Depth (bits/pixel) + short type; + short rlen; // Length of one raster line in bytes + void *fb; // Frame buffer +}; + +// Frame buffer types - used by MicroWindows +#define FB_TRUE_RGB555 0x02 + +// Exported functions +void lcd_init(int depth); +void lcd_clear(void); +int lcd_getinfo(struct lcd_info *info); +void lcd_on(bool enable); +#ifdef CYGSEM_AAED2000_LCD_COMM +void lcd_moveto(int X, int Y); +void lcd_putc(cyg_int8 c); +int lcd_printf(char const *fmt, ...); +void lcd_setbg(int red, int green, int blue); +void lcd_setfg(int red, int green, int blue); +void lcd_comm_init(void); +#endif + +#endif // _LCD_SUPPORT_H_ diff --git a/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_ram.h b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_ram.h @@ -0,0 +1,20 @@ +// eCos memory layout - Tue Oct 30 16:49:43 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x1F60000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_lcd (0x1f60000) +#define CYGMEM_REGION_lcd_SIZE (0xa0000) +#define CYGMEM_REGION_lcd_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x1F60000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_ram.ldi b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_ram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Tue Oct 30 16:49:43 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x1F80000 + lcd : ORIGIN = 0x1f60000, LENGTH = 0xA0000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x40000, LMA_EQ_VMA) + SECTION_RELOCS (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_got (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_ram.mlt b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_ram.mlt @@ -0,0 +1,16 @@ +version 0 +region ram 0 1fa0000 0 ! +region lcd 1fa0000 a0000 1 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section rom_vectors 0 1 0 1 1 1 1 1 40000 40000 RELOCS RELOCS ! +section RELOCS 0 1 0 1 0 1 0 1 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 got got ! +section got 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_rom.h b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_rom.h @@ -0,0 +1,20 @@ +// eCos memory layout - Mon Nov 12 14:25:25 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x2000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0x60000000) +#define CYGMEM_REGION_rom_SIZE (0x200000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x2000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_rom.ldi b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_rom.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Mon Nov 12 14:25:25 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x2000000 + rom : ORIGIN = 0x60000000, LENGTH = 0x200000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x60000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_RELOCS (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_got (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_data (ram, 0x8000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_rom.mlt b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_rom.mlt @@ -0,0 +1,16 @@ +version 0 +region ram 0 2000000 0 ! +region rom 60000000 200000 1 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section data 0 1 1 1 1 1 0 0 8000 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 60000000 60000000 text text ! +section text 0 4 0 1 0 1 0 1 RELOCS RELOCS ! +section RELOCS 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 got got ! +section got 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 0 0 1 data ! diff --git a/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_romram.h b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_romram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_romram.h @@ -0,0 +1,20 @@ +// eCos memory layout - Tue Oct 30 16:49:43 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x1F60000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_lcd (0x1f60000) +#define CYGMEM_REGION_lcd_SIZE (0xA0000) +#define CYGMEM_REGION_lcd_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x1Fa0000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_romram.ldi b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_romram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_romram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Tue Oct 30 16:49:43 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x1F40000 + lcd : ORIGIN = 0x1f60000, LENGTH = 0xa0000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x8000, LMA_EQ_VMA) + SECTION_RELOCS (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_got (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_romram.mlt b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_romram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/pkgconf/mlt_arm_arm9_aaed2000_romram.mlt @@ -0,0 +1,16 @@ +version 0 +region ram 0 1f40000 0 ! +region lcd 1f60000 a0000 1 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section rom_vectors 0 1 0 1 1 1 1 1 8000 8000 RELOCS RELOCS ! +section RELOCS 0 1 0 1 0 1 0 1 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 got got ! +section got 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/arm/arm9/aaed2000/current/include/plf_io.h b/packages/hal/arm/arm9/aaed2000/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/plf_io.h @@ -0,0 +1,90 @@ +#ifndef CYGONCE_HAL_PLF_IO_H +#define CYGONCE_HAL_PLF_IO_H +//============================================================================= +// +// plf_io.h +// +// Platform specific registers +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-10-31 +// Purpose: ARM/AAED2000 platform specific registers +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +//----------------------------------------------------------------------------- +// Address space translation macros +// FIXME: The SDRAM translation is only correct for the first block +#define CYGARC_PHYSICAL_ADDRESS(_x_) \ +({ CYG_ADDRWORD _p = (CYG_ADDRWORD)(_x_); \ + if (_p >= AAED2000_SDRAM_VIRT_BASE && \ + _p < (AAED2000_SDRAM_VIRT_BASE+AAED2000_SDRAM_SIZE)) \ + _p = (_p & AAED2000_SDRAM_MASK) + AAED2000_SDRAM_PHYS_BASE; \ + else if (_p >= AAED2000_FLASH_VIRT_BASE && \ + _p < (AAED2000_FLASH_VIRT_BASE+AAED2000_FLASH_SIZE)) \ + _p = (_p & AAED2000_FLASH_MASK) + AAED2000_FLASH_PHYS_BASE; \ + _p; }) + +#define CYGARC_VIRTUAL_ADDRESS(_x_) \ +({ CYG_ADDRWORD _p = (CYG_ADDRWORD)(_x_); \ + if (_p >= AAED2000_SDRAM_PHYS_BASE && \ + _p < (AAED2000_SDRAM_PHYS_BASE+AAED2000_SDRAM_SIZE)) \ + _p = (_p & AAED2000_SDRAM_MASK) + AAED2000_SDRAM_VIRT_BASE; \ + else if (_p >= AAED2000_FLASH_PHYS_BASE && \ + _p < (AAED2000_FLASH_PHYS_BASE+AAED2000_FLASH_SIZE)) \ + _p = (_p & AAED2000_FLASH_MASK) + AAED2000_FLASH_VIRT_BASE; \ + _p; }) + + + +//----------------------------------------------------------------------------- +// Macro used for translating from flash address used by RedBoot to that +// used by ARM Boot monitor. +#define _ADDR_REDBOOT_TO_ARM(x) (((CYG_ADDRESS)x & ~0x60000000) | 0x04000000) + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_HAL_PLF_IO_H diff --git a/packages/hal/arm/arm9/aaed2000/current/include/plf_stub.h b/packages/hal/arm/arm9/aaed2000/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/include/plf_stub.h @@ -0,0 +1,84 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov, gthomas +// Date: 2001-10-30 +// Purpose: Platform HAL stub support for Agilent AAED2000 boards. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 +#define HAL_STUB_PLATFORM_INIT_BREAK_IRQ() CYG_EMPTY_STATEMENT + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/arm/arm9/aaed2000/current/misc/redboot_primary_RAM.ecm b/packages/hal/arm/arm9/aaed2000/current/misc/redboot_primary_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/misc/redboot_primary_RAM.ecm @@ -0,0 +1,120 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware aaed2000 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_ARM9 current ; + package -hardware CYGPKG_HAL_ARM_ARM9_AAED2000 current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_AAED2000 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -hardware CYGPKG_DEVS_ETH_ARM_AAED2000 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGPKG_HAL_ARM_ARM9_ARM920T { + inferred_value 1 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00040000 +}; + +cdl_option CYGBLD_REDBOOT_FLASH_BOOT_OFFSET { + inferred_value 0x0 +}; + +cdl_option CYGNUM_REDBOOT_FLASH_RESERVED_BASE { + inferred_value 0x0 +}; + +cdl_option CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK { + inferred_value -1 +}; + +cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP { + inferred_value 0 +}; + +cdl_option CYGOPT_REDBOOT_FIS_DIRECTORY_ARM_SIB_ID { + inferred_value 0 +}; + +cdl_option CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK { + inferred_value -2 +}; + +cdl_option CYGHWR_REDBOOT_BOOTMONITOR { + user_value Primary +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV640 { + inferred_value 1 +}; + + diff --git a/packages/hal/arm/arm9/aaed2000/current/misc/redboot_primary_ROMRAM.ecm b/packages/hal/arm/arm9/aaed2000/current/misc/redboot_primary_ROMRAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/misc/redboot_primary_ROMRAM.ecm @@ -0,0 +1,126 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware aaed2000 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_ARM9 current ; + package -hardware CYGPKG_HAL_ARM_ARM9_AAED2000 current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_AAED2000 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -hardware CYGPKG_DEVS_ETH_ARM_AAED2000 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGPKG_HAL_ARM_ARM9_ARM920T { + inferred_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROMRAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00040000 +}; + +cdl_option CYGBLD_REDBOOT_FLASH_BOOT_OFFSET { + inferred_value 0x0 +}; + +cdl_option CYGNUM_REDBOOT_FLASH_RESERVED_BASE { + inferred_value 0x0 +}; + +cdl_option CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK { + inferred_value -1 +}; + +cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP { + inferred_value 0 +}; + +cdl_option CYGOPT_REDBOOT_FIS_DIRECTORY_ARM_SIB_ID { + inferred_value 0 +}; + +cdl_option CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK { + inferred_value -2 +}; + +cdl_option CYGHWR_REDBOOT_BOOTMONITOR { + user_value Primary +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV640 { + inferred_value 1 +}; diff --git a/packages/hal/arm/arm9/aaed2000/current/misc/smpeg.ecm b/packages/hal/arm/arm9/aaed2000/current/misc/smpeg.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/misc/smpeg.ecm @@ -0,0 +1,308 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware aaed2000 ; + template net ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_ARM9 current ; + package -hardware CYGPKG_HAL_ARM_ARM9_AAED2000 current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_AAED2000 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -hardware CYGPKG_DEVS_ETH_ARM_AAED2000 current ; + package -hardware CYGPKG_DEVS_KBD_AAED2000 current ; + package -hardware CYGPKG_DEVS_TOUCH_AAED2000 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_IO current ; + package -template CYGPKG_IO_SERIAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_KERNEL current ; + package -template CYGPKG_MEMALLOC current ; + package -template CYGPKG_LIBC current ; + package -template CYGPKG_LIBC_TIME current ; + package -template CYGPKG_LIBC_STDLIB current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_LIBC_I18N current ; + package -template CYGPKG_LIBC_SETJMP current ; + package -template CYGPKG_LIBC_STARTUP current ; + package -template CYGPKG_LIBC_STDIO current ; + package -template CYGPKG_LIBM current ; + package -template CYGPKG_POSIX current ; + package -template CYGPKG_IO_WATCHDOG current ; + package -template CYGPKG_IO_WALLCLOCK current ; + package -template CYGPKG_ERROR current ; + package -template CYGPKG_IO_FILEIO current ; + package -template CYGPKG_NET current ; + package -template CYGPKG_NET_OPENBSD_STACK current ; + package -template CYGPKG_NS_DNS current ; + package -template CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_FS_ROM current ; + package CYGPKG_MICROWINDOWS current ; + package CYGPKG_FS_JFFS2 current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_FS_RAM current ; +}; + +cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + user_value arm-elf +}; + +cdl_option CYGBLD_GLOBAL_CFLAGS { + user_value "-mcpu=arm9 -msoft-float -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" +}; + +cdl_option CYGPKG_HAL_ARM_ARM9_ARM920T { + inferred_value 1 +}; + +cdl_option CYGPKG_IO_NFILE { + user_value 32 +}; + +cdl_component CYGPKG_INFRA_DEBUG { + user_value 1 +}; + +cdl_option CYGBLD_ISO_CTYPE_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILETYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_STREAMS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILEACCESS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_CHAR_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_DIRECT_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_ERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMER_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_CLOCK_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_CLOCKS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_NUMBERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGSETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DIRENT_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREADTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PMUTEXTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_BSDTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_UTSNAME_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SEMAPHORES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_MUTEX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_LIMITS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_OPEN_MAX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_NETDB_PROTO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_NETDB_SERV_HEADER { + inferred_value 1 +}; + +cdl_option CYGIMP_KERNEL_SCHED_SORTED_QUEUES { + inferred_value 1 +}; + +cdl_option CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE { + inferred_value 1 +}; + +cdl_component CYGSEM_KERNEL_SCHED_ASR_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGSEM_KERNEL_SCHED_ASR_GLOBAL { + inferred_value 1 +}; + +cdl_option FOPEN_MAX { + user_value 32 +}; + +cdl_option CYGNUM_FILEIO_NFILE { + user_value 32 +}; + +cdl_option CYGNUM_FILEIO_NFD { + user_value 32 +}; + +cdl_component CYGPKG_IO_FILEIO_INODE { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_ECOS { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NANOWM { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NXKBD { + inferred_value 1 +}; + +cdl_option CYGPKG_MICROWINDOWS_CFLAGS_ADD { + inferred_value "-I\$(PREFIX)/include/microwin -D__ECOS=1 -DMSDOS=0 -DELKS=0 -D__rtems__=0 -D_MINIX=0 -DNOTYET=0 -DUNIX=1 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DxHAVE_JPEG_SUPPORT=1 -DHAVESELECT=1 -DMWPIXEL_FORMAT=MWPF_TRUECOLOR555" +}; + +cdl_component CYGPKG_IO_FLASH_BLOCK_DEVICE { + inferred_value 1 +}; + +cdl_option CYGNUM_IO_FLASH_BLOCK_OFFSET_1 { + user_value 0x01000000 +}; + +cdl_option CYGNUM_IO_FLASH_BLOCK_LENGTH_1 { + user_value 0x00400000 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV640 { + inferred_value 1 +}; + + diff --git a/packages/hal/arm/arm9/aaed2000/current/misc/toyota_fullscr.ecm b/packages/hal/arm/arm9/aaed2000/current/misc/toyota_fullscr.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/misc/toyota_fullscr.ecm @@ -0,0 +1,326 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware aaed2000 ; + template net ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_ARM9 current ; + package -hardware CYGPKG_HAL_ARM_ARM9_AAED2000 current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_AAED2000 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -hardware CYGPKG_DEVS_ETH_ARM_AAED2000 current ; + package -hardware CYGPKG_DEVS_KBD_AAED2000 current ; + package -hardware CYGPKG_DEVS_TOUCH_AAED2000 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_IO current ; + package -template CYGPKG_IO_SERIAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_KERNEL current ; + package -template CYGPKG_MEMALLOC current ; + package -template CYGPKG_LIBC current ; + package -template CYGPKG_LIBC_TIME current ; + package -template CYGPKG_LIBC_STDLIB current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_LIBC_I18N current ; + package -template CYGPKG_LIBC_SETJMP current ; + package -template CYGPKG_LIBC_STARTUP current ; + package -template CYGPKG_LIBC_STDIO current ; + package -template CYGPKG_LIBM current ; + package -template CYGPKG_POSIX current ; + package -template CYGPKG_IO_WATCHDOG current ; + package -template CYGPKG_IO_WALLCLOCK current ; + package -template CYGPKG_ERROR current ; + package -template CYGPKG_IO_FILEIO current ; + package -template CYGPKG_NET current ; + package -template CYGPKG_NET_OPENBSD_STACK current ; + package -template CYGPKG_NS_DNS current ; + package -template CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_FS_ROM current ; + package CYGPKG_MICROWINDOWS current ; + package CYGPKG_FS_JFFS2 current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_FS_RAM current ; + package CYGPKG_SDL current ; + package CYGPKG_SMPEG current ; +}; + +cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + user_value arm-elf +}; + +cdl_option CYGBLD_GLOBAL_CFLAGS { + user_value "-mcpu=arm9 -msoft-float -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" +}; + +cdl_option CYGPKG_HAL_ARM_ARM9_ARM920T { + inferred_value 1 +}; + +cdl_option CYGPKG_IO_NFILE { + user_value 32 +}; + +cdl_component CYGPKG_INFRA_DEBUG { + user_value 1 +}; + +cdl_option CYGBLD_ISO_CTYPE_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILETYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_STREAMS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILEACCESS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_CHAR_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_DIRECT_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_ERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMER_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_CLOCK_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_CLOCKS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_NUMBERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGSETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DIRENT_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREADTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PMUTEXTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_BSDTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_UTSNAME_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SEMAPHORES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_MUTEX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_LIMITS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_OPEN_MAX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_NETDB_PROTO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_NETDB_SERV_HEADER { + inferred_value 1 +}; + +cdl_option CYGIMP_KERNEL_SCHED_SORTED_QUEUES { + inferred_value 1 +}; + +cdl_option CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE { + inferred_value 1 +}; + +cdl_component CYGSEM_KERNEL_SCHED_ASR_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGSEM_KERNEL_SCHED_ASR_GLOBAL { + inferred_value 1 +}; + +cdl_option FOPEN_MAX { + user_value 32 +}; + +cdl_option CYGNUM_FILEIO_NFILE { + user_value 32 +}; + +cdl_option CYGNUM_FILEIO_NFD { + user_value 32 +}; + +cdl_component CYGPKG_IO_FILEIO_INODE { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_ECOS { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NANOWM { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NXKBD { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NANOX_DEMOS { + inferred_value 1 +}; + +cdl_option CYGPKG_MICROWINDOWS_CFLAGS_ADD { + inferred_value "-I\$(PREFIX)/include/microwin -D__ECOS=1 -DMSDOS=0 -DELKS=0 -D__rtems__=0 -D_MINIX=0 -DNOTYET=0 -DUNIX=1 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DxHAVE_JPEG_SUPPORT=1 -DHAVESELECT=1 -DMWPIXEL_FORMAT=MWPF_TRUECOLOR555" +}; + +cdl_component CYGPKG_IO_FLASH_BLOCK_DEVICE { + inferred_value 1 +}; + +cdl_option CYGNUM_IO_FLASH_BLOCK_OFFSET_1 { + user_value 0x01000000 +}; + +cdl_option CYGNUM_IO_FLASH_BLOCK_LENGTH_1 { + user_value 0x00400000 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV640 { + inferred_value 1 +}; + +cdl_option CYGPKG_SDL_CFLAGS_ADD { + inferred_value "-I\$(PREFIX)/include/SDL -I\$(REPOSITORY)/\$(PACKAGE)/src/src -I\$(REPOSITORY)/\$(PACKAGE)/src/src/audio -I\$(REPOSITORY)/\$(PACKAGE)/src/src/events -I\$(REPOSITORY)/\$(PACKAGE)/src/src/joystick -I\$(REPOSITORY)/\$(PACKAGE)/src/src/thread -I\$(REPOSITORY)/\$(PACKAGE)/src/src/thread/ecos -I\$(REPOSITORY)/\$(PACKAGE)/src/src/timer -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video/fbcon -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video/svga -DDISABLE_JOYSTICK -DDISABLE_CDROM -DUSE_INPUT_EVENTS -DSDL_USE_PTHREADS -DPTHREAD_NO_RECURSIVE_MUTEX -D__ECOS=1 -DENABLE_FBCON" +}; + +cdl_option CYGBLD_SMPEG_BUILD_PLAYMPEG { + user_value 1 +}; + +cdl_component CYGBLD_SMPEG_BUILD_TOYOTA_DEMO { + user_value 1 +}; + + diff --git a/packages/hal/arm/arm9/aaed2000/current/misc/toyota_window.ecm b/packages/hal/arm/arm9/aaed2000/current/misc/toyota_window.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/misc/toyota_window.ecm @@ -0,0 +1,334 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware aaed2000 ; + template net ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_ARM9 current ; + package -hardware CYGPKG_HAL_ARM_ARM9_AAED2000 current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_AAED2000 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -hardware CYGPKG_DEVS_ETH_ARM_AAED2000 current ; + package -hardware CYGPKG_DEVS_KBD_AAED2000 current ; + package -hardware CYGPKG_DEVS_TOUCH_AAED2000 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_IO current ; + package -template CYGPKG_IO_SERIAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_KERNEL current ; + package -template CYGPKG_MEMALLOC current ; + package -template CYGPKG_LIBC current ; + package -template CYGPKG_LIBC_TIME current ; + package -template CYGPKG_LIBC_STDLIB current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_LIBC_I18N current ; + package -template CYGPKG_LIBC_SETJMP current ; + package -template CYGPKG_LIBC_STARTUP current ; + package -template CYGPKG_LIBC_STDIO current ; + package -template CYGPKG_LIBM current ; + package -template CYGPKG_POSIX current ; + package -template CYGPKG_IO_WATCHDOG current ; + package -template CYGPKG_IO_WALLCLOCK current ; + package -template CYGPKG_ERROR current ; + package -template CYGPKG_IO_FILEIO current ; + package -template CYGPKG_NET current ; + package -template CYGPKG_NET_OPENBSD_STACK current ; + package -template CYGPKG_NS_DNS current ; + package -template CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_FS_ROM current ; + package CYGPKG_MICROWINDOWS current ; + package CYGPKG_FS_JFFS2 current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_FS_RAM current ; + package CYGPKG_SDL current ; + package CYGPKG_SMPEG current ; +}; + +cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + user_value arm-elf +}; + +cdl_option CYGBLD_GLOBAL_CFLAGS { + user_value "-mcpu=arm9 -msoft-float -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" +}; + +cdl_option CYGPKG_HAL_ARM_ARM9_ARM920T { + inferred_value 1 +}; + +cdl_option CYGPKG_IO_NFILE { + user_value 32 +}; + +cdl_component CYGPKG_INFRA_DEBUG { + user_value 1 +}; + +cdl_option CYGBLD_ISO_CTYPE_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILETYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_STREAMS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILEACCESS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_CHAR_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_DIRECT_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_ERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMER_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_CLOCK_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_CLOCKS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_NUMBERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGSETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DIRENT_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREADTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PMUTEXTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_BSDTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_UTSNAME_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SEMAPHORES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_MUTEX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_LIMITS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_OPEN_MAX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_NETDB_PROTO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_NETDB_SERV_HEADER { + inferred_value 1 +}; + +cdl_option CYGIMP_KERNEL_SCHED_SORTED_QUEUES { + inferred_value 1 +}; + +cdl_option CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE { + inferred_value 1 +}; + +cdl_component CYGSEM_KERNEL_SCHED_ASR_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGSEM_KERNEL_SCHED_ASR_GLOBAL { + inferred_value 1 +}; + +cdl_option FOPEN_MAX { + user_value 32 +}; + +cdl_option CYGNUM_FILEIO_NFILE { + user_value 32 +}; + +cdl_option CYGNUM_FILEIO_NFD { + user_value 32 +}; + +cdl_component CYGPKG_IO_FILEIO_INODE { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_ECOS { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NANOWM { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NXKBD { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NANOX_DEMOS { + inferred_value 1 +}; + +cdl_option CYGPKG_MICROWINDOWS_CFLAGS_ADD { + inferred_value "-I\$(PREFIX)/include/microwin -D__ECOS=1 -DMSDOS=0 -DELKS=0 -D__rtems__=0 -D_MINIX=0 -DNOTYET=0 -DUNIX=1 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DxHAVE_JPEG_SUPPORT=1 -DHAVESELECT=1 -DMWPIXEL_FORMAT=MWPF_TRUECOLOR555" +}; + +cdl_component CYGPKG_IO_FLASH_BLOCK_DEVICE { + inferred_value 1 +}; + +cdl_option CYGNUM_IO_FLASH_BLOCK_OFFSET_1 { + user_value 0x01000000 +}; + +cdl_option CYGNUM_IO_FLASH_BLOCK_LENGTH_1 { + user_value 0x00400000 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV640 { + inferred_value 1 +}; + +cdl_option CYGSEM_SDL_FBCON_FORCEGRAREA { + inferred_value 1 +}; + +cdl_option CYGPKG_SDL_CFLAGS_ADD { + inferred_value "-I\$(PREFIX)/include/SDL -I\$(REPOSITORY)/\$(PACKAGE)/src/src -I\$(REPOSITORY)/\$(PACKAGE)/src/src/audio -I\$(REPOSITORY)/\$(PACKAGE)/src/src/events -I\$(REPOSITORY)/\$(PACKAGE)/src/src/joystick -I\$(REPOSITORY)/\$(PACKAGE)/src/src/thread -I\$(REPOSITORY)/\$(PACKAGE)/src/src/thread/ecos -I\$(REPOSITORY)/\$(PACKAGE)/src/src/timer -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video/fbcon -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video/svga -DDISABLE_JOYSTICK -DDISABLE_CDROM -DUSE_INPUT_EVENTS -DSDL_USE_PTHREADS -DPTHREAD_NO_RECURSIVE_MUTEX -D__ECOS=1 -DENABLE_FBCON" +}; + +cdl_option CYGBLD_SMPEG_BUILD_PLAYMPEG { + user_value 1 +}; + +cdl_component CYGBLD_SMPEG_BUILD_TOYOTA_DEMO { + user_value 1 +}; + +cdl_option CYGFUN_SMPEG_BUILD_TOYOTA_DEMO_WINDOWED { + user_value 1 +}; + + diff --git a/packages/hal/arm/arm9/aaed2000/current/src/aaed2000_misc.c b/packages/hal/arm/arm9/aaed2000/current/src/aaed2000_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/src/aaed2000_misc.c @@ -0,0 +1,538 @@ +//========================================================================== +// +// aaed2000_misc.c +// +// HAL misc board support code for ARM9/AAED2000 +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: hmt, Travis C. Furrer , jskov +// Date: 2000-05-21 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // IO macros +#include // Register state info +#include +#include // Interrupt names +#include +#include // Platform specifics + +#include // diag_printf + +externC void* memset(void *, int, size_t); + + +// ------------------------------------------------------------------------- +// MMU initialization: +// +// These structures are laid down in memory to define the translation +// table. +// + +/* + * ARM Translation Table Base Bit Masks */ +#define ARM_TRANSLATION_TABLE_MASK 0xFFFFC000 + +/* + * ARM Domain Access Control Bit Masks + */ +#define ARM_ACCESS_TYPE_NO_ACCESS(domain_num) (0x0 << (domain_num)*2) +#define ARM_ACCESS_TYPE_CLIENT(domain_num) (0x1 << (domain_num)*2) +#define ARM_ACCESS_TYPE_MANAGER(domain_num) (0x3 << (domain_num)*2) + +struct ARM_MMU_FIRST_LEVEL_FAULT { + int id : 2; + int sbz : 30; +}; +#define ARM_MMU_FIRST_LEVEL_FAULT_ID 0x0 + +struct ARM_MMU_FIRST_LEVEL_PAGE_TABLE { + int id : 2; + int imp : 2; + int domain : 4; + int sbz : 1; + int base_address : 23; +}; +#define ARM_MMU_FIRST_LEVEL_PAGE_TABLE_ID 0x1 + +struct ARM_MMU_FIRST_LEVEL_SECTION { + int id : 2; + int b : 1; + int c : 1; + int imp : 1; + int domain : 4; + int sbz0 : 1; + int ap : 2; + int sbz1 : 8; + int base_address : 12; +}; +#define ARM_MMU_FIRST_LEVEL_SECTION_ID 0x2 + +struct ARM_MMU_FIRST_LEVEL_RESERVED { + int id : 2; + int sbz : 30; +}; +#define ARM_MMU_FIRST_LEVEL_RESERVED_ID 0x3 + +#define ARM_MMU_FIRST_LEVEL_DESCRIPTOR_ADDRESS(ttb_base, table_index) \ + (unsigned long *)((unsigned long)(ttb_base) + ((table_index) << 2)) + +#define ARM_FIRST_LEVEL_PAGE_TABLE_SIZE 0x4000 + +#define ARM_MMU_SECTION(ttb_base, actual_base, virtual_base, \ + cacheable, bufferable, perm) \ + CYG_MACRO_START \ + register union ARM_MMU_FIRST_LEVEL_DESCRIPTOR desc; \ + \ + desc.word = 0; \ + desc.section.id = ARM_MMU_FIRST_LEVEL_SECTION_ID; \ + desc.section.imp = 1; \ + desc.section.domain = 0; \ + desc.section.c = (cacheable); \ + desc.section.b = (bufferable); \ + desc.section.ap = (perm); \ + desc.section.base_address = (actual_base); \ + *ARM_MMU_FIRST_LEVEL_DESCRIPTOR_ADDRESS(ttb_base, (virtual_base)) \ + = desc.word; \ + CYG_MACRO_END + +#define X_ARM_MMU_SECTION(abase,vbase,size,cache,buff,access) \ + { int i; int j = abase; int k = vbase; \ + for (i = size; i > 0 ; i--,j++,k++) \ + { \ + ARM_MMU_SECTION(ttb_base, j, k, cache, buff, access); \ + } \ + } + +union ARM_MMU_FIRST_LEVEL_DESCRIPTOR { + unsigned long word; + struct ARM_MMU_FIRST_LEVEL_FAULT fault; + struct ARM_MMU_FIRST_LEVEL_PAGE_TABLE page_table; + struct ARM_MMU_FIRST_LEVEL_SECTION section; + struct ARM_MMU_FIRST_LEVEL_RESERVED reserved; +}; + +#define ARM_UNCACHEABLE 0 +#define ARM_CACHEABLE 1 +#define ARM_UNBUFFERABLE 0 +#define ARM_BUFFERABLE 1 + +#define ARM_ACCESS_PERM_NONE_NONE 0 +#define ARM_ACCESS_PERM_RO_NONE 0 +#define ARM_ACCESS_PERM_RO_RO 0 +#define ARM_ACCESS_PERM_RW_NONE 1 +#define ARM_ACCESS_PERM_RW_RO 2 +#define ARM_ACCESS_PERM_RW_RW 3 + +void +hal_mmu_init(void) +{ + unsigned long ttb_base = AAED2000_SDRAM_PHYS_BASE + 0x4000; + unsigned long i; + + /* + * Set the TTB register + */ + asm volatile ("mcr p15,0,%0,c2,c0,0" : : "r"(ttb_base) /*:*/); + + /* + * Set the Domain Access Control Register + */ + i = ARM_ACCESS_TYPE_MANAGER(0) | + ARM_ACCESS_TYPE_NO_ACCESS(1) | + ARM_ACCESS_TYPE_NO_ACCESS(2) | + ARM_ACCESS_TYPE_NO_ACCESS(3) | + ARM_ACCESS_TYPE_NO_ACCESS(4) | + ARM_ACCESS_TYPE_NO_ACCESS(5) | + ARM_ACCESS_TYPE_NO_ACCESS(6) | + ARM_ACCESS_TYPE_NO_ACCESS(7) | + ARM_ACCESS_TYPE_NO_ACCESS(8) | + ARM_ACCESS_TYPE_NO_ACCESS(9) | + ARM_ACCESS_TYPE_NO_ACCESS(10) | + ARM_ACCESS_TYPE_NO_ACCESS(11) | + ARM_ACCESS_TYPE_NO_ACCESS(12) | + ARM_ACCESS_TYPE_NO_ACCESS(13) | + ARM_ACCESS_TYPE_NO_ACCESS(14) | + ARM_ACCESS_TYPE_NO_ACCESS(15); + asm volatile ("mcr p15,0,%0,c3,c0,0" : : "r"(i) /*:*/); + + /* + * First clear all TT entries - ie Set them to Faulting + */ + memset((void *)ttb_base, 0, ARM_FIRST_LEVEL_PAGE_TABLE_SIZE); + + /* Actual Virtual Size Attributes Function */ + /* Base Base MB cached? buffered? access permissions */ + /* xxx00000 xxx00000 */ + X_ARM_MMU_SECTION(0x000, 0x600, 32, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Boot flash ROMspace CS0 */ + X_ARM_MMU_SECTION(0x100, 0x100, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Ethernet */ + X_ARM_MMU_SECTION(0x300, 0x300, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* AAED2000 board registers */ + X_ARM_MMU_SECTION(0x400, 0x400, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* PCMCIA slot - I/O */ + X_ARM_MMU_SECTION(0x440, 0x440, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* PCMCIA slot - stat*/ + X_ARM_MMU_SECTION(0x480, 0x480, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* PCMCIA slot - attribute */ + X_ARM_MMU_SECTION(0x4C0, 0x4C0, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* PCMCIA slot - common */ + X_ARM_MMU_SECTION(0x500, 0x500, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* CF slot - I/O */ + X_ARM_MMU_SECTION(0x540, 0x540, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* CF slot - stat*/ + X_ARM_MMU_SECTION(0x580, 0x580, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* CF slot - attribute */ + X_ARM_MMU_SECTION(0x5C0, 0x5C0, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* CF slot - common */ + X_ARM_MMU_SECTION(0x800, 0x800, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* AAEC2000 registers */ + // DRAM is non-contiguous, laid out in weird and wonderful ways... + X_ARM_MMU_SECTION(0xF00, 0x000, 4, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SDRAM */ + X_ARM_MMU_SECTION(0xF10, 0x004, 4, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SDRAM */ + X_ARM_MMU_SECTION(0xF40, 0x008, 4, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SDRAM */ + X_ARM_MMU_SECTION(0xF50, 0x00C, 4, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SDRAM */ + X_ARM_MMU_SECTION(0xF80, 0x010, 4, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SDRAM */ + X_ARM_MMU_SECTION(0xF90, 0x014, 4, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SDRAM */ + X_ARM_MMU_SECTION(0xFC0, 0x018, 4, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SDRAM */ + X_ARM_MMU_SECTION(0xFD0, 0x01C, 4, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* SDRAM */ + // Map in DRAM raw as well + X_ARM_MMU_SECTION(0xF00, 0xF00, 256, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Raw SDRAM */ +} + +// +// Platform specific initialization +// +void +plf_hardware_init(void) +{ + HAL_WRITE_UINT8(AAEC_PCDR, 0x22); + HAL_WRITE_UINT8(AAEC_PCCDR, 0); + HAL_WRITE_UINT8(AAEC_PBDDR, 0x83); + HAL_WRITE_UINT8(AAEC_PINMUX, + AAEC_PINMUX_UART3CON | AAEC_PINMUX_PD0CON | AAEC_PINMUX_PE0CON); + + // FIXME - all platform interrupt sources should be configured here + HAL_INTERRUPT_CONFIGURE(CYGNUM_HAL_INTERRUPT_TS, 0, 0 ); // Low pulse + HAL_INTERRUPT_CONFIGURE(CYGNUM_HAL_INTERRUPT_ETH, 0, 1 ); // High pulse +} + +// +// Support for platform specific I/O channels +// + +externC void lcd_comm_init(void); + +void +plf_if_init(void) +{ + aaed2000_KeyboardInit(); +#ifdef CYGSEM_AAED2000_LCD_COMM + // Initialize I/O channel + lcd_comm_init(); +#endif +} + +// ------------------------------------------------------------------------- +void hal_clock_initialize(cyg_uint32 period) +{ + // Use timer1 for the kernel clock + HAL_WRITE_UINT32(AAEC_TMR_T1LOAD, period); + HAL_WRITE_UINT32(AAEC_TMR_T1CONTROL, + AAEC_TMR_TxCONTROL_ENABLE + | AAEC_TMR_TxCONTROL_MODE_PERIODIC + | AAEC_TMR_TxCONTROL_508KHZ); + + // Unmask timer 0 interrupt + HAL_INTERRUPT_CONFIGURE( CYGNUM_HAL_INTERRUPT_RTC, 1, 1 ); + HAL_INTERRUPT_UNMASK( CYGNUM_HAL_INTERRUPT_RTC ); +} + +// This routine is called during a clock interrupt. +void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + // Clear pending interrupt bit + HAL_INTERRUPT_ACKNOWLEDGE(vector); +} + +// Read the current value of the clock, returning the number of hardware +// "ticks" that have occurred (i.e. how far away the current value is from +// the start) + +// Note: The "contract" for this function is that the value is the number +// of hardware clocks that have happened since the last interrupt (i.e. +// when it was reset). + +void hal_clock_read(cyg_uint32 *pvalue) +{ + cyg_uint32 ctr; + + HAL_READ_UINT32(AAEC_TMR_T1VALUE, ctr); + ctr = CYGNUM_HAL_RTC_PERIOD - ctr; + *pvalue = ctr; +} + +// +// Delay for some number of micro-seconds +// Use timer #3 which runs at [fixed] 7.3728 MHz +// Since this is only a 16 bit counter, it may be necessary +// to run a loop to achieve sufficiently large delay values. +// +// Note: The 7.3728MHz value does not seem to work in practice +// It seems to be off by about a factor of 2. +// +void hal_delay_us(cyg_int32 usecs) +{ + static struct _tmr_vals { + int us_val, tmr_val; + } tmr_vals[] = { + { 2*1000, 7372 }, + { 2*100, 737 }, + { 2*10, 74 }, + { 2*1, 7 }, + { 0, 0 } + }; + struct _tmr_vals *vals = tmr_vals; + cyg_uint32 state; + + while (vals->tmr_val) { + while (usecs >= vals->us_val) { + // disable timer #3 + HAL_WRITE_UINT32(AAEC_TMR_T3CONTROL, 0); + HAL_WRITE_UINT32(AAEC_TMR_T3EOI, 0); + // configure for tmr_val + HAL_WRITE_UINT32(AAEC_TMR_T3LOAD, vals->tmr_val); + // enable + HAL_WRITE_UINT32(AAEC_TMR_T3CONTROL, + AAEC_TMR_TxCONTROL_ENABLE | AAEC_TMR_TxCONTROL_MODE_FREE); + // wait for overflow + do { + HAL_READ_UINT32(AAEC_INT_RSR, state); + } while ((state & (1<us_val; + } + vals++; + } +} + +// ------------------------------------------------------------------------- + +// This routine is called to respond to a hardware interrupt (IRQ). It +// should interrogate the hardware and return the IRQ vector number. +int hal_IRQ_handler(void) +{ + int irq = CYGNUM_HAL_INTERRUPT_NONE; + int vec; + cyg_uint32 sr; + + HAL_READ_UINT32(AAEC_INT_SR, sr); + for (vec = 0; vec <= CYGNUM_HAL_INTERRUPT_BMIINTR; vec++) { + if (sr & (1<= CYGNUM_HAL_ISR_MIN , "Invalid vector"); + + if (vector <= CYGNUM_HAL_INTERRUPT_BMIINTR) { + HAL_WRITE_UINT32(AAEC_INT_ENC, (1 << vector)); + } +} + +void hal_interrupt_unmask(int vector) +{ + CYG_ASSERT(vector <= CYGNUM_HAL_ISR_MAX && + vector >= CYGNUM_HAL_ISR_MIN , "Invalid vector"); + + if (vector <= CYGNUM_HAL_INTERRUPT_BMIINTR) { + HAL_WRITE_UINT32(AAEC_INT_ENS, (1 << vector)); + } +} + +void hal_interrupt_acknowledge(int vector) +{ + cyg_haladdress eoi; + int gpio; + CYG_ASSERT(vector <= CYGNUM_HAL_ISR_MAX && + vector >= CYGNUM_HAL_ISR_MIN , "Invalid vector"); + + if (vector <= CYGNUM_HAL_INTERRUPT_BMIINTR) { + // Must be cleared at the source + if ((eoi = AAED2000_INTMAP[vector].eoi) != 0) { + HAL_WRITE_UINT32(eoi, 0); // Any write clears interrupt + } else if ((gpio = AAED2000_INTMAP[vector].gpio_int) >= 0) { + // GPIO interrupts require special care + HAL_WRITE_UINT32(AAEC_GPIO_FEOI, (1<= CYGNUM_HAL_ISR_MIN , "Invalid vector"); + if (vector <= CYGNUM_HAL_INTERRUPT_BMIINTR) { + if ((gpio = AAED2000_INTMAP[vector].gpio_int) >= 0) { + // Only GPIO interrupts can be configured + int mask = (1<> 28) { + case 0x0: // DRAM + if ((virt & 0x0E000000) == 0) { + dram_page = _dram_map[((virt & 0x01C00000) >> 22)]; + phys = dram_page | virt; + } else { + phys = 0xFFFFFFFF; + } + break; + case 0x6: // FLASH + phys = (virt & 0x0FFFFFFF); + break; + case 0x1: + case 0x2: + case 0x7: + case 0x9: + case 0xA: + case 0xB: + case 0xC: + case 0xD: + case 0xE: + // Not mapped + phys = 0xFFFFFFFF; + break; + case 0x3: + case 0x4: + case 0x5: + case 0x8: + case 0xF: + // Mapped 1-1 + phys = virt; + break; + } + return phys; +} diff --git a/packages/hal/arm/arm9/aaed2000/current/src/banner.xpm b/packages/hal/arm/arm9/aaed2000/current/src/banner.xpm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/src/banner.xpm @@ -0,0 +1,332 @@ +#ifdef CYGSEM_AAED2000_LCD_COMM_PORTRAIT_MODE +/* XPM */ +static char * banner_xpm[] = { +"240 39 65 1", +" c None", +". c #020206", +"+ c #FAFAFA", +"@ c #E61606", +"# c #C2C0C1", +"$ c #EAE5E7", +"% c #BB0F06", +"& c #949394", +"* c #F1B8C0", +"= c #6C686A", +"- c #710206", +"; c #F3A19B", +"> c #404043", +", c #B9B7B8", +"' c #EC8F9A", +") c #353536", +"! c #EA6C6F", +"~ c #29282B", +"{ c #E85A5C", +"] c #E27A7A", +"^ c #300507", +"/ c #1D1C1D", +"( c #626262", +"_ c #E74844", +": c #141415", +"< c #E2554D", +"[ c #C6C6C6", +"} c #5B595C", +"| c #E6342D", +"1 c #9B9B9B", +"2 c #7C0806", +"3 c #060606", +"4 c #737072", +"5 c #C20E06", +"6 c #DEDEDE", +"7 c #E23734", +"8 c #EEEAEA", +"9 c #F4C0C3", +"0 c #820807", +"a c #505050", +"b c #FEFEFA", +"c c #CA1206", +"d c #A7A6A7", +"e c #7F7E7F", +"f c #E62419", +"g c #950E07", +"h c #F6C6CA", +"i c #550206", +"j c #0F0E0F", +"k c #CE1206", +"l c #F4F2F1", +"m c #1C0206", +"n c #CBCACB", +"o c #4B4A4B", +"p c #E2322E", +"q c #A90B06", +"r c #888888", +"s c #B0B0B0", +"t c #EEAFB6", +"u c #F8D4D4", +"v c #FAE1E3", +"w c #DB1506", +"x c #D3D2D2", +"y c #430306", +"z c #DF9D9B", +"................................................................................................................................................................................................................................................", +".................................................................................................................................bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...", +".................................................................................................................................bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...", +"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...", +"..........3/~~~~~//3.............................................................................................................+++++++++++++++++++++++866xxxxxxxxxxxxxxxxxxxxxxxxxx$++++uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuvvb++++++++++++++...", +"......../a&d,##sn,d&a/...........................................................................................................bbbbbbbbbbbbbbbbbbbbb8d4~/3........................3ebbbb@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@pp,1~.3m^^mj^^^^.33~1s)...................................................j33.................................................+++++++++++++++++bs/..........:::..................3e+bbb@w@@@@@@@@@ff@@@@@@@@@@@@@@@@@@@@@@@@@@f'l+++++++b+...", +"...o#4j..mqg5g0qi^^im..j4,~................................................~}eo~.................................................bbbbbbbbbbbbbbbbb8~3.......jorsds&(:.............:>>dbbbb@@@@@@@@@{';tt;3j~3............................................bbbbbbbbbbbbbbbbbr...3.3.3),8+bbb+l6=3........3:rx8$lb+bb@@@w@wf_9l+bbbb89{fw@w@w@|'$l++lvu!f@@@@@!+bbbbb+b+...", +"3:11:3...q-i025kqqq%q..33:&&:333333333333333333333333333333333333333333333.:dbb8)j4#)33333333333333333333333:33333333333333333333bbbbbbbbbbbbbbbb8)..3.3.:=$bbbbbbb++l&:3333333}6bbbbb+b+b@@@@@@!vbbbb++bbbb!f@@@@ftb+bbb+b+'f@@@@@@vbbbbbbbb...", +".a[:..3..cy.j^2kcq@cqy..3.~#o.............................................3~d++$).eba....................../4/3..................+++++++++++++++b,/3.....}$+++++b+bbbblr.....3axbbbbbbbbbb@w@@@{8b++bbbbbbbbl]f@@@{lb++bbbbv_w@@@@@@;++++b+b+...", +"/d4...3..wg22k0@wwwwwg.3.3.4&:..................3..3.......3............333/db+xa.4+(:.3..........3j:3...3.&x(j..................bbbbbbbbbbbbbbbb1j.....36bbblda~)ex+bbl)....3$b++bl*''t$b@@@@7ub+bbu'''u+b++l_@@f'bbbv!_{;'@@w@@@@@!bbbbbbbb...", +"od~.yyqqmqqw@5wk5qkq@0m....~s>...............3)~)/:oo~j.j:)a>o~.......j~oo))dbb$)jel}/:>>~j....3:/))))33.~~s6a~//................bbbbbbbbbbbbbbbb&3.3.33rbbb6>.3.33/s+bbsj..3rbbb+v!w@w@pt@@@f'bbbb;f@@@@'8bbbt@w@hbbbtf@@wf@@@@w@@@!bbb+b+b+...", +"e&j^%w%@-mi-qk5wk@wk5cy....jre333333333333333~d#d>=x6r::)e,666#a:333:/r[6x#4sbb6)3e+a>r#n,=/33:34&,n[&)::e&6ld1&o3333333333333333bbbbbbbbbbbbbb+be33.3.:nbb+e///////}bbb6)33/n+bb8!f@@@@@fw@@p*+bb*f@w@@@f'lbbbf@@u+bb$z7f@@@@@@@@@@!bbbbbbbb...", +"s(.^ww55k33mm^-wqwq@kc--y...=d.............33)8b6d6++d/)dlb+++b6}..3~,lbbbb$6bb$)34+enlxnl$e~.j>$8xn6l,)3#$ll8$l=................+++++++++++++b+be....3o6+bb6xxnxxxx6+bbb4..>$bbbhf@@w@@@@@@@_lb+8<@@@@@@@_ubb+_@@;+bb++v*!@@@@@@@w@{b+b+b+b+...", +"6>3m-qwwqk-^m..0www5q%%w%g3.)[...............>8++8+b+&/,bb8,d6+b8o3/,bbb866bb+b$)jrl$,>33~nla..)r~3.jel&:j:d$o/~:................bbbbbbbbbbbbbbbbe.....}8bbbbb+b+b++bb+blr..(8++b'w@@@w@@@@@@xbbd:(lbb$(>o,b+b$).eb#~.333(8s...3....:un~..s6a.3.................bbbbbbbbbbbbbbbbe333.3}8b++666x666xx6x6x43.}8b+b'@@@@@@@@w@@{bbb*p@w@@@@@@hbbb]@@@!*bbb+b+bu|@@@@@@{b+b+b+b+...", +"[/3.3mq@kwqkwc5%qkk%kq5wwwg3/x)3333333333333.)8bbl(/j3[b+,~/3:1bb8:1bb84.3.>xb+6o34le.....~xx/3..3/j:j,8)33d$}j.33333333333333333bbbbbbbbbbbb+bbbe33...a8+b+o~))~~)))))))/..}8bbbz@@@@@@@@@@@6+b,/3..~db+$)3e8}.3.33/,l..3en8$6n86)..s$o...................bbbbbbbbbbbbbb+b&3....:sbbb6}3.3..)r&&re/..:sbb++zf@@@@f!@@@ftbb+v_@@@@@7hbbbv@@@f_7@@@|u++bz@@@@@@!bbbbbbbb...", +"x)..../dl(myg@kq@kk5qw5q0m.3)x.............3.)$bb&:..~bb+ll8blll88o6bbs/.3.~dbb$)3r+}...../,6..(lxe))),8).3d8}...................bbbbbbbbbbbbbb++&:.3...>++b+6&):/en++b+r33..>bb+b+h_fw_'$@@@@!vbb+u'p@|!ubbbb]@@@~x++6).../,bl$)3ela....3~[6j>xn>33..s8)..d6o3333333333333333333bbbbbbbbbb+bbbbbs:..3..31++bb+l8l+bbbbn3....3rlbbbb+ll+bb@@@@ftbbb+l+lllb+b+t|@@f*+++llb+b+l_@@@@@@;bbbbbbbb...", +"&r}s#x=/ebb+=~~/>~))~:3.33.3ee...............)$+b1/333nbbx).:33:..:dbb843j:o6bb6)3eb}...../#6j=8&...j3#8)..s6o...................+++++++++b++bbbb6)..3333/s++bbbbbb++bx>....3./&lbb+bb++bb@@@w@fh+bb++bb+b+b97@w@_bb++bbbbbl'f@w@@@whb+b+b+b+...", +"axx++b81&bb+8n#[xnxxn:.3..3/d>...........3..3)$bb&:..3=bbl,4a>a4e/.=8bb8e}e#bbb$)34+}.33..~#$3=l1:333/l$>..d$}3..................bbbbbbbbbbbb+bbbb=.......~1b+bb+b+bb,>j3.33.../(6+b+bbbbb@@@@@@7;lbbb+bbb+*_@@@@p'8bb++b++'p@@@@@@|bbbbbbbbb...", +"~#bbbbb+++bbbbb6r&xb[....33=s/...........3.33)8bb1j3../s+bb+l8ll8)./,bbb+ll+l+b$)3e+}...3./,$.o6n>/))dl8)33&le):3................bbbbbbbbbbbb++bbb6j..333..jas68886n4:..3..3..333/a&dnb+b+@@@@@w@f_*v8v88h!f@@@@@@@|!thuu'7@@@@@@@@9bb+b+b+b+...", +".(8b+bb+b+b+b++n=}6+&.:~>~),a.3333333333..3.3)8b+&j...3~dl+++bbblo33)xlbb+bxs8b$).ela..3..~#l..el61s6618)3.)$xd,a3333333333333333bbbbbbbb+bbbbb+b++e:.......3.~}((~:..3.....33...3...rbb+b@@w@@@@@@@|_<_7@@w@@@@@@@@@@@@@@@@@@@w@f!v+bbbbbbbb...", +"3/dbb+bbbbbbbb+bl8bx)je#xxnd:...............3~d,,(..3.33~(sn6xxs4/333)e#6xs>od#d~.as).....:e1.3/en6x,a~,~..3=n$6}................+++++++b++bbbbbbbb843..3.....3...3...........3...3..ebbbb@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@{vb+b+b+b+b+...", +".3~8+bbbb+b+bbbbbb8()#8bbb8:...........3....33:::3.3.....j:////:33....3////33:::333:j3.....::...j///j3j/3.333///j................bbbbbbbbbb+bbb+bbbb8&:3..33........3.3.33...3...3...ebbbb@@@@@@@@@@@@@@@@@@@@@@@@@w@@@@@@@@@@@f{lbbbbbbbbbbb...", +".33a$b+bbbbbbb++bb#}xbbbb6>............3.33.333333...3....3.33.3..3........3.....33...3.33..3....3.3...33........................bbbbbbbbbb++bbbb++bbb#(>:33....3.3...3..3....3...3.3eb++b@@w@@@@@@@@@@@@@@w@@@@@@@@@w@@@@@wf|!*l+bb+b+b+b+b+...", +".3.j}6b+b+b++bbbbb68bbbbnoj.3333333333..3.......3...3..3...........3333......333.....3.3...3.....33.....3..33.3.33333333333333333bbbbbb+bbbbb+b++bbb++bl6dd&1&1&1&&&1&&&&&11&&&11&&1&n+bbb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;t*lbbb+bbbbbbbbbb...", +"....3>xlbbbb+bb++b+b++l[)33..................3....3..3..3....3.33......3...3.....33......3..333.....3.3..3..3....................+++++b++bbbbbbbbb+bbbb+b+bbb+bbbbb+bbbbb++bbb+bbb+bbbbbb+bbbb+b+b++bbb++++++++++++bbbbbbbb+b+b+bb+b+b+b+b+b+...", +".3...3:exlbbbbbbb+bblne:33...........3....33.....3.....3..3...3.......3.33.....33..3...........3...3.3..3.....3..................bbbbbbbb+bbb+bbbbbbbbbbbb+bbbb+b+bbb+bb+bbbb+bbb+bbbbbb+bbb+bbbb+bb+bbbbbbbb++b+bbbb++bbbbbbbbbbbbbbbbbbbbbb...", +".3.3.33.)=s6++bbbb6d4~33.............3.33..3.333...3....3.33....3........3..........3.33..3......3....3..........................bbbbbbbb++bbbb++bbb++b+bbbbbbbbb+b+b++bbb+bbb+bbb++b++bbbbbbbbbbbbb+bbbbbbbbbbbbb+bbbb+bbbbbbb+bb+b+b+b+b+b+...", +".................................................................................................................................bbbb+bbbbb+b++bbb++bbbbbbb+b+b+bbbbbbbbbbb+bbb+bbbb+bbbbb+b+b+bbb+bb+++b+b+bbbb+bb+bb+b+bb+b+bb+bbbbbbbbbbbb...", +".................................................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...", +"................................................................................................................................................................................................................................................"}; +#else +#if 0 +/* XPM */ +static char * banner_xpm[] = { +"320 54 17 1", +" c None", +". c #030305", +"+ c #949394", +"@ c #CFC9CD", +"# c #525052", +"$ c #B7B6B8", +"% c #E2515E", +"& c #FDFDFB", +"* c #737073", +"= c #820204", +"- c #E33533", +"; c #343232", +"> c #E895AE", +", c #E51604", +"' c #E67284", +") c #EABAD4", +"! c #D8D7D9", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"..............*+@&&&&&&$+*..................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+#;;...................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--%>&&&&&&&&&&&&&&&&&&&&&&&&", +"...........#$&&@+*##;#++@&&$#...............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&&&&", +".........#$&$*...........;#!&$;.............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&+..........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,>&&&&&&&&&&&&&&&&&&&&", +"........+&$#................#$&+............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&", +"......;!&*....................*&@...........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&#............................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&", +".....;!@;.....====;.=====......;!@;....................................................................;.;..................................................................&&&&&&&&&&&&&&&&&&&&&&&&+...............;;;;..........................&&&&&&,,,,,,,,,,,,,,,---,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,>&&&&&&&&&&&&&&&&&", +"....;&@......,,=,,=,,=...==......!!.................................................................;#!$*#..................................................................&&&&&&&&&&&&&&&&&&&&&&&!.............#+&&&&&&@*...................;***&&&&&&,,,,,,,,,,,,')&&&&&&>-,,,,,,,,,,,,,,%>!&&)>'-,,,,,,,,,,&&&&&&&&&&&&&&&&&", +"....@@;.....=,,,,,,=,,=..=,.......!!.................................................................#&&&&+;...;............................................................&&&&&&&&&&&&&&&&&&&&&&&#...........;@&&&&&&&&&&&+...............*&&&&&&&&&&&,,,,,,,,,,'&&&&&&&&&&&)-,,,,,,,,,,-)&&&&&&&&&)-,,,,,,,,'&&&&&&&&&&&&&&&&", +"...$&;......====,=,,,====,==......;!+................................................................#&&&&@..;>+;...........................................................&&&&&&&&&&&&&&&&&&&&&&&...........*&&&&&&&&&&&&&&$............#&&&&&&&&&&&&&,,,,,,,,,)&&&&&&&&&&&&&&%,,,,,,,,-&&&&&&&&&&&&%,,,,,,,,,&&&&&&&&&&&&&&&&", +"..#&;.......,=.....=,,,,,,,,.......*&#...............................................................#&&&&@...&&*...............................;...........................&&&&&&&&&&&&&&&&&&&&&&+..........+&&&&&&&&&&&&&&&&@..........#&&&&&&&&&&&&&&,,,,,,,,)&&&&&&&&&&&&&&&&',,,,,,,)&&&&&&&&&&&!,,,,,,,,,,>&&&&&&&&&&&&&&&", +"..!$........,=...;==,=,=,=,==.......$$..............................................................;#&&&&@...&&*..............................#$*..........................&&&&&&&&&&&&&&&&&&&&&&#.........#&&&&&&&&&&&&&&&&&&$........#&&&&&&&&&&&&&&&,,,,,,,)&&&&&&&&&&&&&&&&&&%,,,,,%&&&&&&&&&&&&-,,,,,,,,,,'&&&&&&&&&&&&&&&", +".*&;........,,===,,=,,,,,,,,,.......;&#..............................................................#&&&&$;..!&*;...................;.........!&+;.........................&&&&&&&&&&&&&&&&&&&&&&;.........&&&&&&&*;...#$&&&&&&#.......&&&&&&&&!'''>!&&,,,,,,'&&&&&&&)'''>&&&&&&&&,,,,,'&&&&&)-,,%)),,,,,,,,,,,-&&&&&&&&&&&&&&&", +".@+.....===.,=,,,,=,,=,=,=,,=........$$.......................;.;.;.;.;......;.;.;..............;.;.;#&&&&@..;!&*.;.;.;..........;.;.;.;....;.;!&+.;.;......................&&&&&&&&&&&&&&&&&&&&&&;........+&&&&&@........#&&&&&!......+&&&&&&&',,,,,,'&,,,,,,&&&&&&&-,,,,,,>&&&&&&',,,,)&&&&&%,,,,,-,,,,,,,,,,,-&&&&&&&&&&&&&&&", +";&#..=,,,,,..=,=,,,,,,,,,=,,,=.......#&;.....................#***;.;+$$#;..;.#+$$@+*..........#+$$$*.#&&&&@...!&*.;;*++#;.......;.#*++*;.;..;;;!&+;;;;......................&&&&&&&&&&&&&&&&&&&&&&.........&&&&&!..........+&&&&&#.....&&&&&&&-,,,,,,,,%,,,,,%&&&&&&-,,,,,,,,'&&&&&&,,,,)&&&&&>,,,,,,,,,,,,,,,,,-&&&&&&&&&&&&&&&", +"*&...,=,=,,=...===,=,=,,,,,=,=........!*.....................!&&&*;@&&&*..;#@&&&&&&&$;.....;.$&&&&&&!*&&&&@..;&&*.$!&&&&$#....;.+!&&&&&!*..;$!&&&&!&&!......................&&&&&&&&&&&&&&&&&&&&&&........#&&&&&*;;;;;;;;;;#&&&&&+....#&&&&&&',,,,,,,,,,,,,,,>&&&&&%,,,,,,,,,,)&&&&&-,,,)&&&&&&!'-,,,,,,,,,,,,,,-&&&&&&&&&&&&&&&", +"$$...,,,,=,,.......=,,=,=,,,,====.....@$.....................!&&&+!&&&&+;.*!&&&&&&&&&!.....;!&&&&&&&&!&&&&@...!&*!&&!$!&&&;;...*&&!@$@!&&*..$&!&&!&!&!......................&&&&&&&&&&&&&&&&&&&&&&........+&&&&&&&&&&&&&&&&&&&&&&&....+&&&&&&,,,,,,,,,,,,,,,,&&&&&!,,,,,,,,,,,%&&&&&',,,'&&&&&&&&&)',,,,,,,,,,,,-&&&&&&&&&&&&&&&", +"&+...==,,,,=,=......=,,,,=,=,=,,=,....*!.....................!&&&!&&&&&*.#&&&&&!!&&&&&@....!&&&&&&&&&&&&&&@..;!&!&$;...#!&!....#@*....;@&&...;.!&+.;;;......................&&&&&&&&&&&&&&&&&&&&&&........$&&&&&&&&&&&&&&&&&&&&&&&....$&&&&&),,,,,,,,,,,,,,,,&&&&&',,,,,,,,,,,,&&&&&',,,-&&&&&&&&&&&&-,,,,,,,,,,-&&&&&&&&&&&&&&&", +"&#....==,=,,,,,==....,=,,,,,=,=,,,,...#&.....................!&&&&&&&!&*.@&&&&*;.;@&&&&#;.+&&&&&@+*+&&&&&&@...&&&+......*&&*............!&+....!&+..........................&&&&&&&&&&&&&&&&&&&&&&........$&&&&&&&&&&&&&&&&&&&&&&&....$&&&&&),,,,,,,,,,,,,,,-&&&&&',,,,,,,,,,,,&&&&&),,,,%&&&&&&&&&&&&-,,,,,,,,,-&&&&&&&&&&&&&&&", +"&;.....=,,,=,=,,,===.=,,=,,,,,,,=,==..#&;....................@&&&&&@*;;.*&&&&*.....&&&&$..&&&&&$....#&&&&&@...&&!........@&$...........;)&$....&&+..........................&&&&&&&&&&&&&&&&&&&&&&........$&&&&&$$$$$$$$$$$$$$$$$$....$&&&&&),,,,,,,,,,,,,,,,&&&&&',,,,,,,,,,,,&&&&&>,,,,,->&&&&&&&&&&&,,,,,,,,,-&&&&&&&&&&&&&&&", +"&;......=,,,,,=,,,,,,,=,,,=,=,=,,,,=..;&#....................!&&&&!.....@&&&!;.;.;.$&&&&.#&&&&!;.....+&&&&$;..!&+........+&@;......;.;..+&!....!&+;.........................&&&&&&&&&&&&&&&&&&&&&&........+&&&&&;.....................$&&&&&!,,,,,,,,,,,,,,,,&&&&&),,,,,,,,,,,-&&&&&',,,,,,,,%>&&&&&&&&-,,,,,,,,-&&&&&&&&&&&&&&&", +"&;........==,,,,=,=,=,,,=,,,,,,,=,,...#&;....................!&&&&*.....!&&&!+$+$$+@&&&&.+&&&&$......#&&&&@..;&&*........+&!.....;.;*+$$@&@....!&+..........................&&&&&&&&&&&&&&&&&&&&&&........*&&&&&+................;....*&&&&&&-,,,,,,,,,,,,,,,)&&&&&-,,,,,,,,,,>&&&&&%,,,,,,,,,,,'&&&&&&',,,,,,,,-&&&&&&&&&&&&&&&", +"&#.........==,=,,,,,,=,,,=,=,=,,=,=...#&;....................@&&&&#....;&&&&&&&&&&&&&&&&;$&&&&+......#&&&&@...!&*........*&&....;*@&&&&&&&!....!&+..........................&&&&&&&&&&&&&&&&&&&&&&........;&&&&&&;.........;;;;;;;....;&&&&&&!,,,,,,,,,-,,,,,'&&&&&),,,,,,,,,-&&&&&&,,,,,,,,,,,,,>&&&&&',,,,,,,,-&&&&&&&&&&&&&&&", +"&;.......;&@.==,=,,=,,,=,,,,,,,,,=....#&.....................!&&&!;....#&&&&&&&&&&&&&&&&.@&&&&#.....;#&&&&@..;!&*........*&!....$&&!!$++@&@....&&+..........................&&&&&&&&&&&&&&&&&&&&&&;........$&&&&&&;.......@&&&&&&;.....$&&&&&&),,,,,,,-!,,,,,-&&&&&&>,,,,,,,-&&&&&&>,,,,,')-,,,,,>&&&&&',,,,,,,,-&&&&&&&&&&&&&&&", +"&*.......*&&$...=,,,=,,,,=,=,=,==.....*&.....................@&&&&;....;&&&&&!&!&&!&&!&!;$&&&&*......#&&&&@...&&*........*&!...$&&+;....+&!....!&$..........................&&&&&&&&&&&&&&&&&&&&&&;........;&&&&&&&$#;.;+&&&&&&&+......;&&&&&&&&'-,,%>&&,,,,,,>&&&&&&&'-,-%>&&&&&&&-,,,,-&&&'-,,'&&&&&&-,,,,,,,,-&&&&&&&&&&&&&&&", +"@+.......;&&&@&;...==,=,,,,,,==.......+$.....................!&&&&;.....&&&&$..########;.$&&&&$......*&&&&@..;!&*........+&!.;#&&*......+&!....!&+..........................&&&&&&&&&&&&&&&&&&&&&&#.........+&&&&&&&&&&&&&&&&&&!........*&&&&&&&&&&&&&&&,,,,,,-&&&&&&&&&&&&&&&&&&&',,,,,>&&&&&&&&&&&&&&,,,,,,,,,'&&&&&&&&&&&&&&&", +"+!.#*++$;.;&&&&&;.....................!*.....................@&&&&;;....!&&&&............*&&&&!......+&&&&@...&&*........*&!..$&!.......+&!....!&+..........................&&&&&&&&&&&&&&&&&&&&&&+..........@&&&&&&&&&&&&&&&&&;.........+&&&&&&&&&&&&&&,,,,,,,-&&&&&&&&&&&&&&&&&),,,,,-&&&&&&&&&&&&&&',,,,,,,,,>&&&&&&&&&&&&&&&", +"#&#+&&&&&;.;&&&&!+;##*+#*+#*;........;&;.....................!&&&&;.....+&&&&)..;.;.;.....&&&&&$.;.;#&&&&&@...&&*........+&!.;)&$.....;.@&@....&&+..........................&&&&&&&&&&&&&&&&&&&&&&&...........@&&&&&&&&&&&&&&&;...........+&&&&&&&&&&&&&,,,,,,,,%&&&&&&&&&&&&&&&),,,,,,'&&&&&&&&&&&&&>,,,,,,,,,,&&&&&&&&&&&&&&&&", +".!&&&&&&&&$@&&&&&&&&&&&&&&&&.........+@......................@&&&&;......&&&&&!+*##*+!+...$&&&&&)+*$!&&&&&@...!&*........*&!..@&);.....;&&!....!&+;.........................&&&&&&&&&&&&&&&&&&&&&&&#...........+&&&&&&&&&&&&$;.............;$&&&&&&&&&&&,,,,,,,,,-)&&&&&&&&&&&&',,,,,,,,-)&&&&&&&&&&',,,,,,,,,,%&&&&&&&&&&&&&&&&", +".+&&&&&&&&&&&&&&&&&&&*$+@&&$........;&*......................!&&&&;......*&&&&&&&&&&&&!...;&&&&&&&&&&&&&&&@...&&*........*&!..+&&;;.;.;!&&!....@&@.;........................&&&&&&&&&&&&&&&&&&&&&&&!............;+&&&&&&&&@#.................;*$$$&&&&&&,,,,,,,,,,,%)&&&&&&&&>-,,,,,,,,,,,-')!&&&)',,,,,,,,,,,,&&&&&&&&&&&&&&&&&", +"..&&&&&&&&&&&&&&&&&&!;..$&&+........+!.......................!&&&&;.......+&&&&&&&&&&&&....*&&&&&&&&&!@&&&!...&&*........+&&...!&&+#*+&&$&!....*&&+*+*......................&&&&&&&&&&&&&&&&&&&&&&&&*..............#++++#;........................&&&&&&,,,,,,,,,,,,,-%''''%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&", +"..*&&&&&&&&&&&&&&&&&&&!!&&&;..**+*+*&#.......................!&&&!;........*!&&&&&&&&&@;....*!&&&&&&!;$&&&@...!&*........*&!...#!&&&&&&+.&!.....$&&&&!......................&&&&&&&&&&&&&&&&&&&&&&&&&#............................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%&&&&&&&&&&&&&&&&&&", +"...$&&&&&&&&&&&&&&&&&&&&&&*..;&&&&&&$........................*++++...........*+$@@$$+#........*$@@$*..#+++*...*+;........;+*....;+@!@$#..++......+@!!+......................&&&&&&&&&&&&&&&&&&&&&&&&&&;...........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%&&&&&&&&&&&&&&&&&&&", +"...;&&&&&&&&&&&&&&&&&&&&&$.;@&&&&&&&........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&*..........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&&", +"....;&&&&&&&&&&&&&&&&&&&&;.&&&&&&&&;........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&@;........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%!&&&&&&&&&&&&&&&&&&&&&", +".....*&&&&&&&&&&&&&&&&&&$+&&&&&&&&;.........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&!+;;....................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--'!&&&&&&&&&&&&&&&&&&&&&&&", +"......;&&&&&&&&&&&&&&&&&&&&&&&&&!;..........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".......;@&&&&&&&&&&&&&&&&&&&&&&$;...........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".........*&&&&&&&&&&&&&&&&&&&&*.............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"...........+!&&&&&&&&&&&&&&!*...............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".............#+@&&&&&&&&!+;.................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".................;####;.....................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"................................................................................................................................................................................................................................................................................................................................"}; +#else +/* XPM */ +static char * banner_xpm[] = { +"640 56 88 1", +" c None", +". c #D8D8F8", +"+ c #D8D8F8", +"@ c #E3E3E3", +"# c #8F8E8F", +"$ c #828181", +"% c #575657", +"& c #1F1E1F", +"* c #B9B8B9", +"= c #F1F1F1", +"- c #9D9C9D", +"; c #494849", +"> c #D5D5D5", +", c #737373", +"' c #0099CC", +") c #DFF2F9", +"! c #2D2C2C", +"~ c #7ACAE4", +"{ c #2C1F20", +"] c #522123", +"^ c #852326", +"/ c #ABAAAB", +"( c #9A2428", +"_ c #C4262A", +": c #CC0000", +"< c #DD272C", +"[ c #702224", +"} c #452022", +"| c #D1272B", +"1 c #381F21", +"2 c #AFDFEF", +"3 c #5E2123", +"4 c #EFF9FC", +"5 c #CFECF5", +"6 c #B7262A", +"7 c #EFEFEF", +"8 c #616161", +"9 c #000000", +"0 c #CC0000", +"a c #E56B7B", +"b c #F6F6F6", +"c c #BFE5F2", +"d c #60BFDF", +"e c #9C9C9C", +"f c #191919", +"g c #E58EA2", +"h c #109FCF", +"i c #8FD2E9", +"j c #50B9DC", +"k c #656565", +"l c #AB2529", +"m c #20A6D2", +"n c #30ACD6", +"o c #3B393A", +"p c #C7C7C7", +"q c #25252F", +"r c #3E3E3E", +"s c #2F2F2F", +"t c #E22F2F", +"u c #E23E3E", +"v c #9FD9EC", +"w c #DEDEDE", +"x c #CECECE", +"y c #E8BBD3", +"z c #E25666", +"A c #E89FB8", +"B c #EFCEEA", +"C c #E52525", +"D c #8B8B8B", +"E c #E57B8E", +"F c #ACACAC", +"G c #505050", +"H c #40B3D9", +"I c #E24B50", +"J c #BEBEBE", +"K c #707070", +"L c #414141", +"M c #CFCFCF", +"N c #9F9F9F", +"O c #101010", +"P c #BFBFBF", +"Q c #7F7F7F", +"R c #AFAFAF", +"S c #202020", +"T c #606060", +"U c #DFDFDF", +"V c #8F8F8F", +"W c #303030", +"...........................................................................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".........................@#$%%&&%%#*.......................................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"....................=-&&&&&&&&&&&&&&&&&;@..................................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"...................>&&&&&&&&&&&&&&&&&&&&&,.................................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".................,&&&&&&&&&&&&&&&&&&&&&&&&&&@..............................................................................................................................................................................................................................................................................................................++++++++++++++++++++++++++++++++')+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"................-&&&&&&&&&&&&&&&&&&&&&&&&&&&!#.............................................................................................................................................................................................................................................................................................................++++++++++++++++++++++++++++++++~++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"..............*&&&&&&&&&&&&&&&&&{]^^]{&&&&&&&&!/...........................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".............-&&&&&&&&(_:<([{&][::::::}&&&&&&&&&...........................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"............,&&&&&&&[:::::::::::_^]{&]::&&&&&&&&&%.........................................................................................................................................................................................................................................................................................................++++++++++++++++++++++++++++++++'~+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"...........,&&&&&&&&|::::::::::::::<&&::1&&&&&&&&&.........................................................................................................................................................................................................................................................................................................++++++++++++++++++++++++++++++++'2+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"..........#&&&&&&&&&::::::::::::::3][(:::]&&&&&&&&&,.......................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++45++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".........*&&&&&&&&&&::(::::::::::::::::::6&&&&&&&&&&...........................................................................................................................+++++789999999999999999999999999999999999999999++++++0000000000000000000000000000000000000000000000000ab++++................................................................++++++++++++++++cc+++++++++++++++++++++++++++++d'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".........&&&&&&&&&&}::&&^[]}]^::::::::::::&&&&&&&&&&;..........................................................................................................................++++ef99999999999999999999999999999999999999999++++++000000000000000000000000000000000000000000000000000g+++................................................................++++++++++++++++44++++++++++++++c4+++++++++++++)5++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"........#&&&&&&&&&&[::&&&&&&&&::::::::::::1&&&&&&&&&&..........................................................................................................................+++89999999999999999999999999999999999999999999++++++0000000000000000000000000000000000000000000000000000a++................................................................++++++++++++++++++4hh)+++++++++~''c+++++++++i'j++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".......k&&&&&&&&&&&|:::]1l::::::::::::::::<{&&&&&&&&&%.........................................................................................................................++899999999999999999999999999999999999999999999++++++00000000000000000000000000000000000000000000000000000a+................................................................++++++++++++++++++5''c+++++++++c'm++++++++++~'n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".......&&&&&&&&&&&&::::::::::::::::::::::::l&&&&&&&&&&o...........................................................#&#p.........................................................+e999999999999999qrrs99999999999999999999999999++++++000000000000000tuu000000000000000000000000000000000000g................................................................+++++++++++++++++++cv+++++++++++c4++++++++++4i)++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"......p&&&&&&&&&&&&<::::::::::::::::::::::::&&&&&&&&&&&...........................................................#&&&k........................................................wf9999999999998e7+++++x,f999999999999999999s,,,++++++000000000000ay+++++bgu00000000000000zAB++yAaC0000000000................................................................++++++++++++++++++++++~~)++++++++++++++++2v++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".....@&&&&&[_:::::(&::::::::::::::::::::::::&&&&&&&&&&&>..........................................................#&&&&....#p..................................................899999999999rx++++++++++7D99999999999999f,7++++++++++0000000000Eb++++++++++yu0000000000ty+++++++++yu00000000................................................................++++++++++++++++++++++''m+++++++++++++++)''c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".....#&&&&}:::::::]&]_::::::::::::::::::::::&&&&&&&&&&&,..........................................................#&&&&....&&..................................................99999999999,++++++++++++++Ff99999999999G7++++++++++++000000000y++++++++++++++z00000000tb+++++++++++z00000000................................................................++++++++++++++++++++++h'v+++++4h''j++++++Hn4+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".....&&&&(::::::::(&&&&{(|::::::::::::::::::[&&&&&&&&&&&*.........................................................#&&&&....&&...................................@..............9999999999D++++++++++++++++xf9999999998++++++++++++++00000000y++++++++++++++++E0000000y+++++++++++B000000000................................................................+++++++++++++++++++++++++++v4+c''''++i5++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".....&&&&6:::::::::&&&&&&&3^<:::::::::::::::^&&&&&&&&&&&$.........................................................#&&&&....&&.................................=#%..............9999999998++++++++++++++++++F99999999G+++++++++++++++0000000y++++++++++++++++++I00000I+++++++b++++u000000000................................................................+++++++++++++++++++++++++4n'h))'''n+v''~+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".....&&&&(:::::::::<&&&&&&&&&&]<::::::::::::1]::6]&&&&&&&.........................................................#&&&&....&&.................................p&%..............99999999f7+++++7,s999GJ++++++8999999f7+++++++BEaagB++000000a+++++++yaaagb++++++b00000E+++++yC00Iyy0000000000................................................................+++++++++++++++++++++++++i'''d+~'h5+h''')+++++++++++++++++++++++++++++KLLLLK++++++++++++++++++MLLLK+++LLLK+++++++++++++++++++++++++++++++++++++++NLLLLLLLLLLLLM+++++++++++++++++++++++NLLLM+++++++++++++++++++++++++++++++++NLLLM+++++++++++++++++++++++++++NLLLN++++++++++++++++++++++++++++++++++++", +"....p&&&&1::::::::::l1&&&&&&&&&[::::::::::::{|::::1&&&&&&.........................................................#&&&&....&&.................................p&%..............99999999e+++++xf99999998+++++w999999e++++++ba000000a+000000b+++++bu000000g++++++E0000y+++++I00000C0000000000................................................................+++++++++++++++++++++++++5'''v++++++H''m++++++++++++++++++++++++++++++99999O++++++++++++++++++P999L+++999L+++++++++++++++++++++++++++++++++++++++Q999999999999P+++++++++++++++++++++++Q999P+++++++++++++++++++++++++++++++++Q999P+++++++++++++++++++++++++++Q999Q++++++++++++++++++++++++++++++++++++", +"....$&&&&&&::::::::::::l&&&&&&&&:::::::::::<:::::::<&&&&&..............####..=#&&p.....=k&&&&&/.........../%&&&!p.#&&&&....&&....#%%%>..........=#%%%#>.....pp-&;ppppp.........99999999+++++wf999999999D+++++G9999f+++++++t00000000z00000z+++++bt00000000a+++++b0000y+++++A0000000000000000................................................................++++++++++++++++++++++++++2H~+++++++4Hj5+++++++++++++++++++++++++++++R999999P+++++++++++++++++P999L+++999L++++++++++++++++++++++++++++++NL+++++++Q999999999999P+++++++++++++++++++++++Q999P+++++++++++++++++++++++++++++++++Q999P+++++++++++++++++++++++++++Q999Q++++++++++++++++++++++++++++++++++++", +"....%&&&&&&_::::::::::::|(&&&&&&::::::::::::::::::::&&&&&..............&&&&..!&&&p....-!&&&&&&&o.........-&&&&&&&%#&&&&....&&..p%&&&&&%........,!&&&&&&>....&&&&&&&&&&.........9999999G+++++,rrrrrrrrrrG+++++e9999G++++++a000000000000000A+++++z0000000000y+++++u000y++++++BaC0000000000000................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++K999999Q+++++++++++++++++7PPPM+++999L++++++++++++++++++++++++++++RS99+++++++PQQQT9999QQQQU+++++++++++++++++++++++Q999P+++++++++++++++++++++++++++++++++Q999P+++++++++++++++++++++++++++UPPPU++++++++++++++++++++++++++++++++++++", +"....&&&&&&&&&:::::::::::::::<(]&&|::::::::::::::::::(&&&&..............&&&&=!&&&&p...;&&&&&&&&&&&-.....=&&&&&&&&&&&&&&&....&&.,&o=..@!&&*...../&,=.../!&@...pp-&;ppppp.........9999999D++++++++++++++++++++++79999D++++++0000000000000000+++++B00000000000I+++++E000E+++++++++ya00000000000................................................................++++++++++++++++++)c)++5h'h+++++++++++~''H+++5c++++++++++++++++++++++S999999L+++++++++++++++++++++++++999L++++++++++++++++++++++++++++L999+++++++++++P9999++++++++++++++++++++++++++++Q999P+++++++++++++++++++++++++++++++++Q999P++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"....&&&&&&&&&[::::::::::::::::::::::::::::::::::::::6&&&&..............&&&&,&&&&&p...&&&&&;%&&&&&&.....,&&&&&&&&&&&&&&&....&&#&#.....@;&!......@......@&,.....p&%..............9999999J+++++++++++++++++++++++9999J+++++y0000000000000000+++++E000000000000+++++E000C+++++++++++bu000000000................................................................++++++++++c4+5H~+)h'h)+m'''++++++++++5''''++2''++4jj++))++++++++++++U999Q99997+++++UVQV7MPPP++7PPPM+++999L++++7RQQQR7++++PPPP+NQQM++7PW999PP+++++++++P9999+++++7NQQQP+++++++MQQQVU++++Q999PPQQN++++PPPP+NQQM++++++PQQQNU++++Q999P++++UVQQQM++++++MQQN+PPPM++UPPPU++++UNQQQM++++++UNQQVM++++++++++++++", +"....&&&&&&&&&&&(::::::::::::::::::::::::::::::::::::^&&&&p.............&&&&&&&&%%>.@&&&&>....=&&&&*...o&&&&&p.../!&&&&&....&&&$........&&..............k&-....p&%..............9999999J+++++++++++++++++++++++9999J+++++y000000000000000t+++++a000000000000+++++y0000z++++++++++++u00000000................................................................++++++++++c4+5H~+)h'h4+m'''++++++++++5''''++2''++4jd++))++++++++++++N999PL999R++++MO999OS999++P999L+++999L+++MO99999OM+++9999W9999Q+P9999999+++++++++P9999++++NO99999WM+++7L999999K+++Q999W9999W7++9999W9999Q+++7W999999N+++Q999P+++K999999L7+++Q9999L999L++Q999Q+++Q999999L7+++K999999T+++++++++++++", +"....&&&&&&&&&&&&}:::::::::::::::::::::::::::::::::::3&&&&p.............&&&&&&%p....,&&&&......&&&&k...&&&&&!.....>&&&&&....&&o=........!&p............./&k....p&%..............9999999J+++++JJJJJJJJJJJJJJJJJJ9999J+++++y0000000000000000+++++a000000000000+++++A00000tg++++++++++b00000000................................................................++++++++++++++++++)c)++5h'h+++++++++++~''H+++5c+++++++++++++++++++++L9997K999K++++S999999999++P999L+++999L++7O9999999O7++99999999997P9999999+++++++++P9999+++P99999999W+++T99999999Q++Q999999999V++99999999997++L99999999R++Q999P++N99999999L++U999999999L++Q999Q++R99999999L++Q999SS999Q++++++++++++", +"....&&&&&&&&&&&&&&{<::::::::::::::::::::::::::::::::&&&&&..............&&&&&o......&&&&*......-&&&&p.=&&&&,.......o&&&&....&&=.........#&$..............&&....p&%..............9999999D+++++s999999999999999999999F+++++B0000000000000000+++++y00000000000t+++++E00000000zAb+++++++u0000000................................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++O99W+R999S+++U999S7V9999++P999L+++999L++V999V+V999V++9999M7S999P7PW999PP+++++++++P9999+++T999R+L999R+U999S7M999O++Q999T+K999Q++9999M7S999P+M999L7R999L++Q999P++W999M7W999U+V999Q+L999L++Q999Q++L999M+L999M+L99O77999L++++++++++++", +"....&&&&&&&&&&&&!#${<::::::::::::::::::::::::::::::_&&&&&..............&&&&&/......&&&&.......p&&&&-.*&&&&*.......$&&&&....&&..........*&%..............&&....p&%..............9999999,+++++e9999999999999999q9999,++++++u000000000000000y+++++C0000000000g+++++z00000000000E++++++a0000000................................................................++++++++++++++++++++++++++2H~+++++++4Hj5+++++++++++++++++++++++++++M999T+79999U++P999Q++9999++P999L+++999L++L9997++999L++9999++L999P++L999+++++++++++P9999+++S99O++P999Q+P999Q++L9997+Q999P+P999Q++9999++L999P+V999N++S999++Q999P++999L++Q999R+Q999P+R999L++Q999Q++999L++R999N+S999M+LLLK++++++++++++", +"....%&&&&&&&&&&#++++&&[6::::::::::::::::::::::::::}&&&&&&..............&&&&o.......&&&&&&&&&&&&&&&&$.,&&&&........#&&&&....&&..........p&%.......-%&&&&&&&....p&%..............9999999q++++++r99999999frrrrrrr9999q++++++B000000000t00000E+++++y000000000u++++++0000000000000g+++++E0000000................................................................+++++++++++++++++++++++++c'''v++++++j''m+++++++++++++++++++++++++++Q999N++S999N++P999Q++9999++P999L+++999L++L999PPP999L++9999++L999P++L999+++++++++++P9999+++999WPPV999T+Q999V++NQQQU+Q999P+P999Q++9999++L999P+Q999P++L999++Q999P+U999L++P999Q+L999U+P999L++Q999Q++999WPPV999Q+T9999TU+++++++++++++++", +"....$&&&&&&&&&&p++++o&&&(<:::::::::::::::::::::::l&&&&&&&..............&&&&%.......&&&&&&&&&&&&&&&&%.%&&&&........#&&&&....&&..........p&%.....=,&&&&&&%&&....p&%..............99999999J+++++7r999999fx++++++q99999J++++++y0000000tB00000C++++++A0000000ub+++++A00000EyC00000g+++++E0000000................................................................+++++++++++++++++++++++++i'''d+~'h5+h''')++++++++++++++++++++++++++W999VPPL999L++P999N++9999++P999L+++999L++L999999999L++9999++L999P++L999+++++++++++P9999+++9999999999L+Q999P++++++++Q999P+P999Q++9999++L999P+Q999P++L999++Q999P+P999L++P999Q+L999++P999L++Q999Q+U9999999999Q+US99999TU+++++++++++++", +"....p&&&&&&&&&&#+++++p+=&&&&(|::::::::::::::::6[&&&&&&&&&..............&&&&%......>&&&&&&&&&&&&&&&&#.%&&&&........#&&&&....&&..........p&%..../&&p......&&....p&%..............99999999r+++++++FGs9rD7++++++D999999r+++++++bEu00Ig++000000g++++++bau0CIg+++++++C0000C++bEu00a++++++u0000000................................................................+++++++++++++++++++++++++4n'h))'''n+v''d++++++++++++++++++++++++++799999999999O++P999P++9999++P999L+++999L++L999999999L++9999++L999P++L999+++++++++++P9999+++9999999999L+Q999P++++++++Q999P+P999Q++9999++L999P+Q999P++L999++Q999P+P999L++P999Q+L999++P999L++Q999Q+U9999999999Q++7T99999OM++++++++++++", +".....&&&&&&&&&&!@+++++++&&&&&&[(::::::::::::l[&&&&&&&&&&&..............&&&&%.......&&&o############p.%&&&&........#&&&&....&&..........p&%...p&&,.......&&....p&%..............999999999e++++++++++++++++++wf9999999,+++++++++++++++000000Cb++++++++++++++++++E00000g+++++++++++++b00000000................................................................++++++++++++++++++++++++++4v4+c''''++i5+++++++++++++++++++++++++++R999999999999M+P999P++9999++P999L+++999L++L999+++++++++9999++L999P++L999+++++++++++P9999+++999L++++++++Q999V++UPPP7+Q999P+P999Q++9999++L999P+Q999P++L999++Q999P+M999L++P999Q+L999++P999L++Q999Q++999L+++++++++++7QO999S++++++++++++", +".....&&&&&&p++-&&++++++++/&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$..............&&&&%.......&&&&>.............-&&&&*.......k&&&&....&&..........p&%...&&=........&&....p&%..............9999999999x++++++++++++++++7s999999999e++++++++++++++0000000t+++++++++++++++++y00000C++++++++++++++E00000000................................................................++++++++++++++++++++++h'v+++++4h''j++++++Hn4++++++++++++++++++++++T999WLLLLO999V+P999Q++9999++P999L+++999L++L9997+7LLLK++9999++L999P++L999+++++++++++P9999+++O99O++MLLLN+R999Q++L999P+Q999P+P999Q++9999++L999P+Q999R++L999++Q999P++999L++Q999V+K999M+P999L++Q999Q++999L++NLLLN+QQQN+UO999++++++++++++", +".....%%%%/@++++&&p++++++++o&&&&&&&&&&&&&&&&&&&&&&&&&&&&&>..............&&&&%.......&&&&,.............>&&&&,.......!&&&&....&&..........p&%...&&.........&&....p&%..............9999999999fx++++++++++++++7r99999999999D+++++++++++++00000000Ib++++++++++++++y000000a+++++++++++++g000000000................................................................++++++++++++++++++++++''h++++++2'H4+++++c''i++++++++++++++++++++++S999U++++Q999L+P999L+R9999++P999L+++999L++K999N+R999T++9999++L999P++L9997++++++++++P9999+++L999U+Q999V+M999T++S9997+Q999P+P999Q++9999++L999P+P999K+7999W++Q999P++S99O++T999P+Q999Q+T999L++Q999Q++S9997+T999R+O99O++L999++++++++++++", +".....++++++++++=$&o+++++++++++++++++++++++@&&&&&&&&&&&&$...............&&&&%.......o&&&&>.............&&&&&!...../&&&&&....&&..........p&%...&&......../&&....p&%..............G99999999999D++++++++++++Jq9999999999999rJ+++++++++++000000000ty++++++++++++E00000000uy++++++++++E0000000000................................................................++++++++++++++++++++++~~)++++++++++++++++2v++++++++++++++++++++++U999S+++++P9999++O999S99999++P999L+++999L++P999OQS999N++9999++L999P++L999WK+++++++++P9999+++V999WKO999U++S999KL999L++Q999P+P999Q++9999++L999P+7O99OKL999Q++Q999P++T999LK999O++M9999S9999L++Q999Q++K999WK999O7+L999LK999S++++++++++++", +".....+++++++++++++++++++++++++++++++++++++-&&&&&&&&&&&&@...............&&&&%......./&&&&&#......*,....&&&&&&-=..$&&&&&&....&&..........p&%...&&........o&&....=&o..............w999999999999qe++++++++xG99999999999999999s,FJJ++++++00000000000zy+++++++bgC00000000000CEyB++bya000000000000................................................................+++++++++++++++++++cv+++++++++++c4++++++++++4i)++++++++++++++++++V999T++++++9999R+N9999O9999++P999L+++999L+++T9999999T+++9999++L999P++R9999L+++++++++P9999+++7W9999999V+++R9999999OM++Q999P+P999Q++9999++L999P++N9999999S7++Q999P++UO9999999N+++T9999O999L++Q999Q++7O9999999N++R99999999R++++++++++++", +"......++++++++++++++++++++++++++++++++++++&&&&&&&&&&&&&................&&&&%........@&&&&&&&&&&&&&....=;&&&&&&&&&&&!&&&....&&..........p&%...&&-....../&&&.....;&/.............+,99999999999999GDDDD8q999999999999999999999999++++++0000000000000CzEEEEI0000000000000000000000000000000000E................................................................++++++++++++++++++5''5+++++++++c'm++++++++++~'m++++++++++++++++++QLLLR++++++KLLLN++PQQQU9999++MLLLK+++LLLK++++QS999WN++++LLLL++KLLLM+++RL99K+++++++++MLLLL++++7TS999LR+++++PL999OTM+++NLLLM+MLLLN++LLLL++KLLLM+++RW999OT7+++NLLLM+++UTO999LP+++++NQQVP999L++NLLLN+++7TO999LP++++RL9999LM+++++++++++++", +".......+++++++++++++++++++++++++##++,+++++&&&&&&&&&&&&%................&&&&%.........!&&&&&&&&&&&&.....>&&&&&&&&&&$,&&&....&&..........p&%...,&&/....k&%&&.....#&!.....=@......++G99999999999999999999999999999999999999999999++++++00000000000000000000000000000000000000000000000000000z+................................................................++++++++++++++++++)hh)+++++++++~''c+++++++++i'H++++++++++++++++++++++++++++++++++7PPPU++9999+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++UPPP7+P999L+++++++++++++++++++++++++++++++++++++++++++", +".......+++++++++++++++++++++++++%o!!$+++++&&&&&&&&&&&%.#k..............&&&&%........../o&&&&&&&&&!......=,&&&&&&!-.#&&&....&&..........p&%....=&&&&&&&#.&&......&&&&&&.,%......++7r9999999999999999999999999999999999999999999++++++0000000000000000000000000000000000000000000000000000z++................................................................++++++++++++++++++++4++++++++++c'n+++++++++++4+++++++++++++++++++++++++++++++++++U999L+7999W+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++V999N+R999Q+++++++++++++++++++++++++++++++++++++++++++", +"........+++++++++++++++++++++++++++++++++*&&&$+++++++......................................=................pp...................................pp...............>p...........++++,999999999999999999999999999999999999999999++++++000000000000000000000000000000000000000000000000000a+++................................................................++++++++++++++++cc+++++++++++++++++++++++++++++~'+++++++++++++++++++++++++++++++++S999TW999Q+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++U999OKO999P+++++++++++++++++++++++++++++++++++++++++++", +".........+++++++++++++++++++++++++++++++=o&&%++++++++..........................................................................................................................+++++xr9999999999999999999999999999999999999999++++++0000000000000000000000000000000000000000000000000IB++++................................................................+++++++++++++++++++++++++++++++++++++++++++++++45+++++++++++++++++++++++++++++++++MO999999W7++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Q9999999K++++++++++++++++++++++++++++++++++++++++++++", +".........+++++++++++++++++++++++++++++++&&;/++++++++.......................................................................................................................................................................................................................................................................................................++++++++++++++++++++++++++++++++'2+++++++++++++++++++++++++++++++++++++++++++++++++UVLLLTN+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++MQLLLQM+++++++++++++++++++++++++++++++++++++++++++++", +"..........+++++++++++++++++++++++++++++p&&++++++++++.......................................................................................................................................................................................................................................................................................................++++++++++++++++++++++++++++++++'~+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"...........+++++++++++++++++++++++++++-&/+++++++++.........................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"............++++++++++++++++++++++++++!&++++++++++.........................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".............++++++++++++++++++++++++=++++++++++...........................................................................................................................................................................................................................................................................................................++++++++++++++++++++++++++++++++~++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"..............++++++++++++++++++++++++++++++++++...........................................................................................................................................................................................................................................................................................................++++++++++++++++++++++++++++++++')+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"................++++++++++++++++++++++++++++++.............................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".................++++++++++++++++++++++++++++..............................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"...................+++++++++++++++++++++++.................................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +".....................+++++++++++++++++++...................................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"..........................++++++++++.......................................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"...........................................................................................................................................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"}; +#endif +#endif diff --git a/packages/hal/arm/arm9/aaed2000/current/src/font.h b/packages/hal/arm/arm9/aaed2000/current/src/font.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/src/font.h @@ -0,0 +1,160 @@ +//========================================================================== +// +// font.h +// +// LCD display font +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-02-25 +// Description: Simple LCD font +//####DESCRIPTIONEND#### + +#ifndef _LCD_FONT_H_ +#define _LCD_FONT_H_ + +// 8x8 Font - from Helios + +#define FIRST_CHAR 0x20 +#define LAST_CHAR 0x7F +#define FONT_HEIGHT 8 +#define FONT_WIDTH 8 +#define CURSOR_ON 0x7F +#define CURSOR_OFF 0x20 +static char font_table[LAST_CHAR-FIRST_CHAR+1][8] = +{ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */ + { 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00 }, /* ! */ + { 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* " */ + { 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00 }, /* # */ + { 0x30, 0xFC, 0x16, 0x7C, 0xD0, 0x7E, 0x18, 0x00 }, /* $ */ + { 0x06, 0x66, 0x30, 0x18, 0x0C, 0x66, 0x60, 0x00 }, /* % */ + { 0x1C, 0x36, 0x36, 0x1C, 0xB6, 0x66, 0xDC, 0x00 }, /* & */ + { 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ' */ + { 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00 }, /* ( */ + { 0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00 }, /* ) */ + { 0x00, 0x18, 0x7E, 0x3C, 0x7E, 0x18, 0x00, 0x00 }, /* * */ + { 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00 }, /* + */ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x0C }, /* , */ + { 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00 }, /* - */ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 }, /* . */ + { 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00 }, /* / */ + { 0x3C, 0x66, 0x76, 0x7E, 0x6E, 0x66, 0x3C, 0x00 }, /* 0 */ + { 0x18, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00 }, /* 1 */ + { 0x3C, 0x66, 0x60, 0x30, 0x18, 0x0C, 0x7E, 0x00 }, /* 2 */ + { 0x3C, 0x66, 0x60, 0x38, 0x60, 0x66, 0x3C, 0x00 }, /* 3 */ + { 0x30, 0x38, 0x3C, 0x36, 0x7E, 0x30, 0x30, 0x00 }, /* 4 */ + { 0x7E, 0x06, 0x3E, 0x60, 0x60, 0x66, 0x3C, 0x00 }, /* 5 */ + { 0x38, 0x0C, 0x06, 0x3E, 0x66, 0x66, 0x3C, 0x00 }, /* 6 */ + { 0x7E, 0x60, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00 }, /* 7 */ + { 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00 }, /* 8 */ + { 0x3C, 0x66, 0x66, 0x7C, 0x60, 0x30, 0x1C, 0x00 }, /* 9 */ + { 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00 }, /* : */ + { 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x0C }, /* ; */ + { 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x00 }, /* < */ + { 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00 }, /* = */ + { 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x00 }, /* > */ + { 0x3C, 0x66, 0x30, 0x18, 0x18, 0x00, 0x18, 0x00 }, /* ? */ + { 0x3C, 0x66, 0x76, 0x56, 0x76, 0x06, 0x3C, 0x00 }, /* @ */ + { 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00 }, /* A */ + { 0x3E, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3E, 0x00 }, /* B */ + { 0x3C, 0x66, 0x06, 0x06, 0x06, 0x66, 0x3C, 0x00 }, /* C */ + { 0x1E, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1E, 0x00 }, /* D */ + { 0x7E, 0x06, 0x06, 0x3E, 0x06, 0x06, 0x7E, 0x00 }, /* E */ + { 0x7E, 0x06, 0x06, 0x3E, 0x06, 0x06, 0x06, 0x00 }, /* F */ + { 0x3C, 0x66, 0x06, 0x76, 0x66, 0x66, 0x3C, 0x00 }, /* G */ + { 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00 }, /* H */ + { 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00 }, /* I */ + { 0x7C, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1C, 0x00 }, /* J */ + { 0x66, 0x36, 0x1E, 0x0E, 0x1E, 0x36, 0x66, 0x00 }, /* K */ + { 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7E, 0x00 }, /* L */ + { 0xC6, 0xEE, 0xFE, 0xD6, 0xD6, 0xC6, 0xC6, 0x00 }, /* M */ + { 0x66, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x66, 0x00 }, /* N */ + { 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00 }, /* O */ + { 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x06, 0x00 }, /* P */ + { 0x3C, 0x66, 0x66, 0x66, 0x56, 0x36, 0x6C, 0x00 }, /* Q */ + { 0x3E, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x66, 0x00 }, /* R */ + { 0x3C, 0x66, 0x06, 0x3C, 0x60, 0x66, 0x3C, 0x00 }, /* S */ + { 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, /* T */ + { 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00 }, /* U */ + { 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00 }, /* V */ + { 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0xEE, 0xC6, 0x00 }, /* W */ + { 0x66, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00 }, /* X */ + { 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00 }, /* Y */ + { 0x7E, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x7E, 0x00 }, /* Z */ + { 0x3E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3E, 0x00 }, /* [ */ + { 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, 0x00 }, /* \ */ + { 0x7C, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7C, 0x00 }, /* ] */ + { 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ^ */ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF }, /* _ */ + { 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ` */ + { 0x00, 0x00, 0x3C, 0x60, 0x7C, 0x66, 0x7C, 0x00 }, /* a */ + { 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x3E, 0x00 }, /* b */ + { 0x00, 0x00, 0x3C, 0x66, 0x06, 0x66, 0x3C, 0x00 }, /* c */ + { 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x00 }, /* d */ + { 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00 }, /* e */ + { 0x38, 0x0C, 0x0C, 0x3E, 0x0C, 0x0C, 0x0C, 0x00 }, /* f */ + { 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x3C }, /* g */ + { 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x00 }, /* h */ + { 0x18, 0x00, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00 }, /* i */ + { 0x18, 0x00, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x0E }, /* j */ + { 0x06, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x00 }, /* k */ + { 0x1C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00 }, /* l */ + { 0x00, 0x00, 0x6C, 0xFE, 0xD6, 0xD6, 0xC6, 0x00 }, /* m */ + { 0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x00 }, /* n */ + { 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00 }, /* o */ + { 0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06 }, /* p */ + { 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0xE0 }, /* q */ + { 0x00, 0x00, 0x36, 0x6E, 0x06, 0x06, 0x06, 0x00 }, /* r */ + { 0x00, 0x00, 0x7C, 0x06, 0x3C, 0x60, 0x3E, 0x00 }, /* s */ + { 0x0C, 0x0C, 0x3E, 0x0C, 0x0C, 0x0C, 0x38, 0x00 }, /* t */ + { 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x00 }, /* u */ + { 0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00 }, /* v */ + { 0x00, 0x00, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00 }, /* w */ + { 0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00 }, /* x */ + { 0x00, 0x00, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x3C }, /* y */ + { 0x00, 0x00, 0x7E, 0x30, 0x18, 0x0C, 0x7E, 0x00 }, /* z */ + { 0x30, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x30, 0x00 }, /* { */ + { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, /* | */ + { 0x0C, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0C, 0x00 }, /* } */ + { 0x8C, 0xD6, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ~ */ + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } /* Block cursor */ +}; + +#endif // _LCD_FONT_H_ diff --git a/packages/hal/arm/arm9/aaed2000/current/src/hal_diag.c b/packages/hal/arm/arm9/aaed2000/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/src/hal_diag.c @@ -0,0 +1,298 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors:nickg, gthomas +// Date: 2001-04-23 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include CYGBLD_HAL_VARIANT_H // Variant specific configuration +#include CYGBLD_HAL_PLATFORM_H // Platform specific configuration + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // basic machine info +#include // interrupt macros +#include // IO macros +#include +#include +#include // interface API +#include // Helper functions +#include // platform definitions + +// The controller is clocked at 7.3728MHz +#define BAUD_RATE(_n_) ((7372800/((_n_)*16))-1) + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8 *base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +static channel_data_t aaed2000_ser_channels[1] = { + { (cyg_uint8 *)AAEC_UART3, 1000, CYGNUM_HAL_INTERRUPT_UART3INTR }, +}; + +//----------------------------------------------------------------------------- + +static void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8* base = chan->base; + + // Enable first. + // Register writes don't take effect till the UART is enabled. + HAL_WRITE_UINT32(base+AAEC_UART_CTRL, AAEC_UART_CTRL_ENAB); + + HAL_WRITE_UINT32(base+AAEC_UART_STATUS, 0); + HAL_WRITE_UINT32(base+AAEC_UART_INTM, 0); + HAL_WRITE_UINT32(base+AAEC_UART_BAUD, + BAUD_RATE(CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD)); + // 8-1-no parity. + HAL_WRITE_UINT32(base+AAEC_UART_LCR, AAEC_UART_LCR_FIFO | AAEC_UART_LCR_WL8); +} + +void +cyg_hal_plf_serial_putc(void *__ch_data, char c) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint32 status; + + do { + HAL_READ_UINT32(base+AAEC_UART_STATUS, status); + } while ((status & AAEC_UART_STATUS_TxFF) != 0); + + HAL_WRITE_UINT32(base+AAEC_UART_DATA, c); + + do { + HAL_READ_UINT32(base+AAEC_UART_STATUS, status); + } while (status & AAEC_UART_STATUS_TxBSY); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint32 status; + cyg_uint32 c; + + HAL_READ_UINT32(base+AAEC_UART_STATUS, status); + if ((status & AAEC_UART_STATUS_RxFE) != 0) + return false; + + HAL_READ_UINT32(base+AAEC_UART_DATA, c); + *ch = c; + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + return ch; +} + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); +} + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_bool res; + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(100); + } + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + cyg_uint32 intm; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + int ret = 0; + + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + HAL_READ_UINT32(base+AAEC_UART_INTM, intm); + intm |= AAEC_UART_INT_RIS|AAEC_UART_INT_RTIS; + HAL_WRITE_UINT32(base+AAEC_UART_INTM, intm); + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + HAL_READ_UINT32(base+AAEC_UART_INTM, intm); + intm &= ~(AAEC_UART_INT_RIS|AAEC_UART_INT_RTIS); + HAL_WRITE_UINT32(base+AAEC_UART_INTM, intm); + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + char c; + cyg_uint32 lsr, _c; + CYGARC_HAL_SAVE_GP(); + + cyg_drv_interrupt_acknowledge(chan->isr_vector); + + *__ctrlc = 0; + HAL_READ_UINT32(base+AAEC_UART_STATUS, lsr); + if ( (lsr & AAEC_UART_STATUS_RxFE) != 0 ) { + HAL_READ_UINT32(base+AAEC_UART_DATA, _c); + c = (char)_c; + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Init channels + cyg_hal_plf_serial_init_channel(&aaed2000_ser_channels[0]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &aaed2000_ser_channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +/*---------------------------------------------------------------------------*/ +/* End of hal_diag.c */ diff --git a/packages/hal/arm/arm9/aaed2000/current/src/kbd_drvr.c b/packages/hal/arm/arm9/aaed2000/current/src/kbd_drvr.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/src/kbd_drvr.c @@ -0,0 +1,489 @@ +//========================================================================== +// +// kbd_drvr.c +// +// Agilent AAED2000 - keyboard driver +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-11-03 +// Description: Keyboard driver +//####DESCRIPTIONEND#### + +#include + +#include +#include // IO macros +#include // Virtual vector support +#include // Register state info +#include // HAL interrupt macros + +#include // Board definitions +#include + +//----------------------------------------------------------------------------- +// Keyboard definitions + +// Standard [PC keyboard] scan codes + +#define LSHIFT 0x2a +#define RSHIFT 0x36 +#define CTRL 0x1d +#define ALT 0x38 +#define CAPS 0x3a +#define NUMS 0x45 + +#define BREAK 0x80 + +// Bits for KBFlags + +#define KBNormal 0x0000 +#define KBShift 0x0001 +#define KBCtrl 0x0002 +#define KBAlt 0x0004 +#define KBIndex 0x0007 // mask for the above + +#define KBExtend 0x0010 +#define KBAck 0x0020 +#define KBResend 0x0040 +#define KBShiftL (0x0080 | KBShift) +#define KBShiftR (0x0100 | KBShift) +#define KBCtrlL (0x0200 | KBCtrl) +#define KBCtrlR (0x0400 | KBCtrl) +#define KBAltL (0x0800 | KBAlt) +#define KBAltR (0x1000 | KBAlt) +#define KBCapsLock 0x2000 +#define KBNumLock 0x4000 + +#define KBArrowUp 0x48 +#define KBArrowRight 0x4D +#define KBArrowLeft 0x4B +#define KBArrowDown 0x50 + +//----------------------------------------------------------------------------- +// Keyboard Variables + +static int KBFlags = 0; + +static CYG_BYTE KBPending = 0xFF; + +static CYG_BYTE KBScanTable[128][4] = { +// Normal Shift Control Alt +// 0x00 + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0x1b, 0x1b, 0x1b, 0xFF, }, + { '1', '!', 0xFF, 0xFF, }, + { '2', '@', 0xFF, 0xFF, }, + { '3', '#', 0xFF, 0xFF, }, + { '4', '$', 0xFF, 0xFF, }, + { '5', '%', 0xFF, 0xFF, }, + { '6', '^', 0xFF, 0xFF, }, + { '7', '&', 0xFF, 0xFF, }, + { '8', '*', 0xFF, 0xFF, }, + { '9', '(', 0xFF, 0xFF, }, + { '0', ')', 0xFF, 0xFF, }, + { '-', '_', 0xFF, 0xFF, }, + { '=', '+', 0xFF, 0xFF, }, + { '\b', '\b', 0xFF, 0xFF, }, + { '\t', '\t', 0xFF, 0xFF, }, +// 0x10 + { 'q', 'Q', 0x11, 0xFF, }, + { 'w', 'W', 0x17, 0xFF, }, + { 'e', 'E', 0x05, 0xFF, }, + { 'r', 'R', 0x12, 0xFF, }, + { 't', 'T', 0x14, 0xFF, }, + { 'y', 'Y', 0x19, 0xFF, }, + { 'u', 'U', 0x15, 0xFF, }, + { 'i', 'I', 0x09, 0xFF, }, + { 'o', 'O', 0x0F, 0xFF, }, + { 'p', 'P', 0x10, 0xFF, }, + { '[', '{', 0x1b, 0xFF, }, + { ']', '}', 0x1d, 0xFF, }, + { '\r', '\r', '\n', 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 'a', 'A', 0x01, 0xFF, }, + { 's', 'S', 0x13, 0xFF, }, +// 0x20 + { 'd', 'D', 0x04, 0xFF, }, + { 'f', 'F', 0x06, 0xFF, }, + { 'g', 'G', 0x07, 0xFF, }, + { 'h', 'H', 0x08, 0xFF, }, + { 'j', 'J', 0x0a, 0xFF, }, + { 'k', 'K', 0x0b, 0xFF, }, + { 'l', 'L', 0x0c, 0xFF, }, + { ';', ':', 0xFF, 0xFF, }, + { 0x27, '"', 0xFF, 0xFF, }, + { '`', '~', 0xFF, 0xFF, }, + { '`', '~', 0xFF, 0xFF, }, + { '\\', '|', 0x1C, 0xFF, }, + { 'z', 'Z', 0x1A, 0xFF, }, + { 'x', 'X', 0x18, 0xFF, }, + { 'c', 'C', 0x03, 0xFF, }, + { 'v', 'V', 0x16, 0xFF, }, +// 0x30 + { 'b', 'B', 0x02, 0xFF, }, + { 'n', 'N', 0x0E, 0xFF, }, + { 'm', 'M', 0x0D, 0xFF, }, + { ',', '<', 0xFF, 0xFF, }, + { '.', '>', 0xFF, 0xFF, }, + { '/', '?', 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { ' ', ' ', ' ', ' ', }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xF1, 0xE1, 0xFF, 0xFF, }, + { 0xF2, 0xE2, 0xFF, 0xFF, }, + { 0xF3, 0xE3, 0xFF, 0xFF, }, + { 0xF4, 0xE4, 0xFF, 0xFF, }, + { 0xF5, 0xE5, 0xFF, 0xFF, }, +// 0x40 + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + + { 0x15, 0x15, 0x15, 0x15, }, + { 0x10, 0x10, 0x10, 0x10, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, +// 0x50 + { 0x04, 0x04, 0x04, 0x04, }, + { 0x0e, 0x0e, 0x0e, 0x0e, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, +// 0x60 + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, +// 0x70 + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, +}; + +static int KBIndexTab[8] = { 0, 1, 2, 2, 3, 3, 3, 3 }; + +//----------------------------------------------------------------------------- + +#define AAED2000_KBD_COLS 8 +#define AAED2000_KBD_ROWS 12 + +static unsigned int KB_rowState[AAED2000_KBD_COLS]; // Last known state Row x Col + +// Map AAED2000 row/col to [PC standard] scancodes +static const int scancode[AAED2000_KBD_ROWS][AAED2000_KBD_COLS] = +{ + {0x0A/*9*/, 0x25/*k*/, 0x17/*i*/, 0x09/*8*/, 0x24/*j*/, 0x15/*y*/, 0x08/*7*/, 0x00/*?*/}, + {0x0B/*0*/, 0x32/*m*/, 0x19/*p*/, 0x26/*l*/, 0x23/*h*/, 0x16/*u*/, 0x07/*8*/, 0x00/*?*/}, + {0x0C/*-*/, 0x18/*o*/, 0x1A/*{*/, 0x27/*:*/, 0x30/*b*/, 0x31/*n*/, 0x22/*g*/, 0x33/*<*/}, + {0x0D/*+*/, 0x34/*>*/, 0x1B/*}*/, 0x28/*'*/, 0x48/*?*/, 0x14/*t*/, 0x00/*?*/, 0x00/*?*/}, + {0x0E/*?*/, 0x35/*?*/, 0x2B/*|*/, 0x1C/*?*/, 0x4B/*?*/, 0x00/*?*/, 0x06/*5*/, 0x50/*?*/}, + {0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/}, + {0x39/* */, 0x21/*f*/, 0x00/*?*/, 0x00/*?*/, 0x2E/*c*/, 0x13/*r*/, 0x05/*4*/, 0x2F/*v*/}, + {0x4D/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x20/*d*/, 0x12/*e*/, 0x04/*3*/, 0x38/*?*/}, + {0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x1F/*s*/, 0x11/*w*/, 0x03/*2*/, 0x2D/*x*/}, + {0x53/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x1E/*a*/, 0x10/*q*/, 0x02/*1*/, 0x2C/*z*/}, + {0x00/*?*/, 0x2A/*?*/, 0x36/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/}, + {0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x00/*?*/, 0x3A/*?*/, 0x0F/*?*/, 0x29/*~*/, 0x1D/*?*/} +}; + +static bool +KeyboardScan(CYG_BYTE *code) +{ + int row, col, i, down, up; + unsigned int state, prev_state; + int stable; + + for (col = 0; col < AAED2000_KBD_COLS; col++) { + HAL_WRITE_UINT8(AAEC_KSCAN, col+8); // Assert column #n + + for (i = 0, stable = 0, prev_state = 0; + (i < 1000) && (stable < 120); i++) { + HAL_READ_UINT32(AAED_EXT_GPIO, state); + if (state != prev_state) { + prev_state = state; + stable = 0; + } else { + stable++; + } + } + state &= (1<1 + up = ~state & KB_rowState[col]; // Bits that went 1->0 + for (row = 0; row < AAED2000_KBD_ROWS; row++) { + if ((up|down) & (1< (SCREEN_WIDTH-SCREEN_PAN)) screen_pan = SCREEN_WIDTH-SCREEN_PAN; + lcd_refresh(); +#endif + break; + + } + + // Clear Extend flag if set + KBFlags &= ~KBExtend; + + // Ignore all other BREAK codes + if( scancode & 0x80 ) return 0xFF; + + // Here the scancode is for something we can turn + // into an ASCII value + + ascii = KBScanTable[scancode & 0x7F][KBIndexTab[KBFlags & KBIndex]]; + + return ascii; +} /* KeyboardAscii */ + +//----------------------------------------------------------------------------- + +int +aaed2000_KeyboardTest(void) +{ + // If there is a pending character, return True + if( KBPending != 0xFF ) return true; + + // If there is something waiting at the port, get it + for(;;) { + CYG_BYTE code, c; + + if (!KeyboardScan(&code)) { + // No new activity + break; + } + + // Translate to ASCII + c = KeyboardAscii(code); + + // if it is a real ASCII char, save it and + // return True. + if( c != 0xFF ) { + KBPending = c; + return true; + } + } + + // Otherwise return False + return false; + +} /* KeyboardTest */ + +int +aaed2000_KeyboardGetc(void) +{ + unsigned char ch = KBPending; + KBPending = 0xFF; + return ch; +} + +cyg_bool +aaed2000_KeyboardInit(void) +{ + int i; + + for (i = 0; i < AAED2000_KBD_COLS; i++) { + KB_rowState[i] = 0; + } + KBFlags = 0; + + return true; +} /* KeyboardInit */ diff --git a/packages/hal/arm/arm9/aaed2000/current/src/lcd_support.c b/packages/hal/arm/arm9/aaed2000/current/src/lcd_support.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/aaed2000/current/src/lcd_support.c @@ -0,0 +1,999 @@ +//========================================================================== +// +// Lcd_support.c +// +// Agilent AAED2000 - LCD support routines +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-11-03 +// Description: Simple LCD support +//####DESCRIPTIONEND#### + +#include + +#include +#include // IO macros +#include // Virtual vector support +#include // Register state info +#include // HAL interrupt macros + +#include // Board definitions +#include +#include + +#include + +#ifdef CYGPKG_ISOINFRA +# include +# ifdef CYGINT_ISO_STDIO_FORMATTED_IO +# include // sscanf +# endif +#endif + +#include CYGHWR_MEMORY_LAYOUT_H +#define LCD_FRAMEBUFFER CYGMEM_REGION_lcd +static cyg_uint32 lcd_framebuffer; + +#ifndef FALSE +#define FALSE 0 +#define TRUE 1 +#endif + +// Physical dimensions of LCD display +#define DISPLAY_WIDTH 640 +#define DISPLAY_HEIGHT 480 + +// Logical layout +#ifdef CYGSEM_AAED2000_LCD_PORTRAIT_MODE +#define LCD_WIDTH DISPLAY_HEIGHT +#define LCD_HEIGHT DISPLAY_WIDTH +#else +#define LCD_WIDTH DISPLAY_WIDTH +#define LCD_HEIGHT DISPLAY_HEIGHT +#endif +#define LCD_DEPTH 16 + +#define RGB_RED(x) (((x)&0x1F)<<0) +#define RGB_GREEN(x) (((x)&0x1F)<<5) +#define RGB_BLUE(x) (((x)&0x1F)<<10) + +// Physical screen info +//static int lcd_depth = LCD_DEPTH; // Should be 1, 2, or 4 +static int lcd_bpp; +#ifdef CYGSEM_AAED2000_LCD_PORTRAIT_MODE +static int lcd_width = LCD_WIDTH; +#endif +static int lcd_height = LCD_HEIGHT; + +// Black on light blue +static int bg = RGB_RED(0x17) | RGB_GREEN(0x17) | RGB_BLUE(0x1F); +#ifdef CYGSEM_AAED2000_LCD_COMM +static int fg = RGB_RED(0) | RGB_GREEN(0) | RGB_BLUE(0); +#endif + +// Compute the location for a pixel within the framebuffer +static cyg_uint32 * +lcd_fb(int row, int col) +{ + return (cyg_uint32 *)(lcd_framebuffer+(((row*DISPLAY_WIDTH)+col)*2)); +} + +void +lcd_on(bool enable) +{ + cyg_uint32 ctl; + + if (!enable) return; // FIXME - need a way to [safely] blank screen + + // Turn on PWM [pulse wave modulated] voltage pump + HAL_WRITE_UINT32(AAEC_PUMP_CONTROL, 0x800); // Magic FIXME + HAL_WRITE_UINT32(AAEC_PUMP_FREQUENCY, 0x3733); // Magic FIXME + // Turn on Power + HAL_READ_UINT32(AAED_EXT_GPIO, ctl); + ctl |= AAED_EXT_GPIO_LCD_PWR_EN; + HAL_WRITE_UINT32(AAED_EXT_GPIO, ctl); + // Power must be on for 0..20ms before enabling signals + CYGACC_CALL_IF_DELAY_US(500); // 500us should be long enough + HAL_READ_UINT32(AAEC_LCD_CONTROL, ctl); + ctl |= AAEC_LCD_CONTROL_ENAB | AAEC_LCD_CONTROL_PWR_ENAB; + HAL_WRITE_UINT32(AAEC_LCD_CONTROL, ctl); +} + +// Initialize LCD hardware + +void +lcd_init(int depth) +{ + cyg_uint32 ctl; + + HAL_VIRT_TO_PHYS_ADDRESS(LCD_FRAMEBUFFER, lcd_framebuffer); + lcd_clear(); + HAL_READ_UINT32(AAEC_LCD_CONTROL, ctl); + if (ctl & (AAEC_LCD_CONTROL_ENAB | AAEC_LCD_CONTROL_PWR_ENAB)) { + // LCD currently on - turn it off carefully + ctl &= ~(AAEC_LCD_CONTROL_ENAB | AAEC_LCD_CONTROL_PWR_ENAB); + HAL_WRITE_UINT32(AAEC_LCD_CONTROL, ctl); + // Now wait a little + CYGACC_CALL_IF_DELAY_US(500); + // Turn off Power + HAL_READ_UINT32(AAED_EXT_GPIO, ctl); + ctl &= ~AAED_EXT_GPIO_LCD_PWR_EN; + HAL_WRITE_UINT32(AAED_EXT_GPIO, ctl); + // Now wait for 1.0 second + CYGACC_CALL_IF_DELAY_US(1000*1000); + } + HAL_WRITE_UINT32(AAEC_LCD_CONTROL, 0x00010028); // Magic FIXME + HAL_WRITE_UINT32(AAEC_LCD_TIMING0, 0x2B135F9C); // Magic FIXME + HAL_WRITE_UINT32(AAEC_LCD_TIMING1, 0x211401DF); // Magic FIXME + HAL_WRITE_UINT32(AAEC_LCD_TIMING2, 0x067F1820); // Magic FIXME + HAL_WRITE_UINT32(AAEC_LCD_TIMING3, 0x00000000); // Magic FIXME + HAL_WRITE_UINT32(AAEC_LCD_UPBASE, lcd_framebuffer); + HAL_WRITE_UINT32(AAEC_LCD_LPBASE, lcd_framebuffer); +#if 0 // For some reason, this crashes miserably + lcd_framebuffer = LCD_FRAMEBUFFER; // Logical operations use cached space +#endif + lcd_on(true); + lcd_bpp = 16; +} + +// Get information about the frame buffer +int +lcd_getinfo(struct lcd_info *info) +{ + if (lcd_bpp == 0) { + return 0; // LCD not initialized + } + info->width = DISPLAY_WIDTH; + info->height = DISPLAY_HEIGHT; + info->bpp = lcd_bpp; + info->fb = (void*)LCD_FRAMEBUFFER; + info->rlen = DISPLAY_WIDTH * 2; + info->type = FB_TRUE_RGB555; + return 1; // Information valid +} + +// Clear screen +void +lcd_clear(void) +{ +#ifndef CYGSEM_AAED2000_LCD_PORTRAIT_MODE + cyg_uint32 *fb_row0, *fb_rown; + cyg_uint32 _bg = (bg<<16)|bg; + + fb_row0 = lcd_fb(0, 0); + fb_rown = lcd_fb(lcd_height, 0); + while (fb_row0 != fb_rown) { + *fb_row0++ = _bg; + } +#else + int row, col; + for (row = 0; row < lcd_height; row++) { + for (col = 0; col < lcd_width; col++) { + set_pixel(row, col, bg); + } + } +#endif +} + +#ifdef CYGSEM_AAED2000_LCD_COMM + +// +// Additional support for LCD/Keyboard as 'console' device +// + +#ifdef CYGOPT_AAED2000_LCD_COMM_LOGO +#include "banner.xpm" +#endif +#include "font.h" + +// Virtual screen info +static int curX = 0; // Last used position +static int curY = 0; +//static int width = LCD_WIDTH / (FONT_WIDTH*NIBBLES_PER_PIXEL); +//static int height = LCD_HEIGHT / (FONT_HEIGHT*SCREEN_SCALE); + +#define SCREEN_PAN 20 +#define SCREEN_WIDTH 80 +#define SCREEN_HEIGHT (LCD_HEIGHT/FONT_HEIGHT) +#define VISIBLE_SCREEN_WIDTH (LCD_WIDTH/FONT_WIDTH) +#define VISIBLE_SCREEN_HEIGHT (LCD_HEIGHT/FONT_HEIGHT) +static char screen[SCREEN_HEIGHT][SCREEN_WIDTH]; +static int screen_height = SCREEN_HEIGHT; +static int screen_width = SCREEN_WIDTH; +static int screen_pan = 0; + +// Usable area on screen [logical pixel rows] +static int screen_start = 0; +static int screen_end = LCD_HEIGHT/FONT_HEIGHT; + +static bool cursor_enable = true; + +// Functions +static void lcd_drawc(cyg_int8 c, int x, int y); + +// Note: val is a 16 bit, RGB555 value which must be mapped +// onto a 12 bit value. +#define RED(v) ((v>>12) & 0x0F) +#define GREEN(v) ((v>>7) & 0x0F) +#define BLUE(v) ((v>>1) & 0x0F) +#ifdef CYGSEM_AAED2000_LCD_PORTRAIT_MODE +#error PORTRAIT MODE NOT IMPLEMENTED +// Translate coordinates, rotating clockwise 90 degrees +static void +set_pixel(int row, int col, unsigned short val) +{ +// fp->pixels[col][(DISPLAY_WIDTH-1)-row] = val; + int _row = (240-1) - col; + int _col = row; + unsigned char *pxptr = (unsigned char *)(0xC0000000 + (_row * 480) + ((_col * 3) / 2)); + + diag_printf("%s\n", __FUNCTION__); return; + if ((row >= LCD_HEIGHT) || (col >= LCD_WIDTH)) return; + if (0) + { + int old = start_console(); + diag_printf("row=%d/%d, col=%d/%d, pxptr = %p\n", row, _row, col, _col, pxptr); + end_console(old); + } + if ((row % 2) == 0) { + // Even row + *pxptr++ = RED(val) | (GREEN(val) << 4); + *pxptr = (*pxptr & 0xF0) | BLUE(val); + } else { + // Odd row + *pxptr = (*pxptr & 0x0F) | (RED(val) << 4); + *++pxptr = GREEN(val) | (BLUE(val) << 4); + } +} +#else + +static void +set_pixel(int row, int col, unsigned short val) +{ + unsigned short *pix = (unsigned short *)lcd_fb(row, col); + *pix = val; +} +#endif + +static int +_hexdigit(char c) +{ + if ((c >= '0') && (c <= '9')) { + return c - '0'; + } else + if ((c >= 'A') && (c <= 'F')) { + return (c - 'A') + 0x0A; + } else + if ((c >= 'a') && (c <= 'f')) { + return (c - 'a') + 0x0a; + } + + return 0; +} + +static int +_hex(char *cp) +{ + return (_hexdigit(*cp)<<4) | _hexdigit(*(cp+1)); +} + +static unsigned short +parse_color(char *cp) +{ + int red, green, blue; + + while (*cp && (*cp != 'c')) cp++; + if (cp) { + cp += 2; + if (*cp == '#') { + red = _hex(cp+1); + green = _hex(cp+3); + blue = _hex(cp+5); +#ifdef USE_RGB565 + return RGB_RED(red>>3) | RGB_GREEN(green>>2) | RGB_BLUE(blue>>3); +#else + return RGB_RED(red>>3) | RGB_GREEN(green>>3) | RGB_BLUE(blue>>3); +#endif + } else { + // Should be "None" + return 0xFFFF; + } + } else { + return 0xFFFF; + } +} + +#ifndef CYGINT_ISO_STDIO_FORMATTED_IO +static int +get_int(char **_cp) +{ + char *cp = *_cp; + char c; + int val = 0; + + while ((c = *cp++) && (c != ' ')) { + if ((c >= '0') && (c <= '9')) { + val = val * 10 + (c - '0'); + } else { + return -1; + } + } + *_cp = cp; + return val; +} +#endif + +#ifdef CYGOPT_AAED2000_LCD_COMM_LOGO +int +show_xpm(char *xpm[], int screen_pos) +{ + int i, row, col, offset; + char *cp; + int nrows, ncols, nclrs; + unsigned short colors[256]; // Mapped by character index + + cp = xpm[0]; +#ifdef CYGINT_ISO_STDIO_FORMATTED_IO + if (sscanf(cp, "%d %d %d", &ncols, &nrows, &nclrs) != 3) { +#else + if (((ncols = get_int(&cp)) < 0) || + ((nrows = get_int(&cp)) < 0) || + ((nclrs = get_int(&cp)) < 0)) { + +#endif + diag_printf("Can't parse XPM data, sorry\n"); + return 0; + } + // printf("%d rows, %d cols, %d colors\n", nrows, ncols, nclrs); + + for (i = 0; i < 256; i++) { + colors[i] = 0x0000; + } + for (i = 0; i < nclrs; i++) { + cp = xpm[i+1]; + colors[(unsigned int)*cp] = parse_color(&cp[1]); + // printf("Color[%c] = %x\n", *cp, colors[(unsigned int)*cp]); + } + +#ifdef CYGOPT_AAED2000_LCD_COMM_LOGO_TOP + offset = screen_pos; +#else + offset = screen_pos-nrows; +#endif + for (row = 0; row < nrows; row++) { + cp = xpm[nclrs+1+row]; + for (col = 0; col < ncols; col++) { + set_pixel(row+offset, col, colors[(unsigned int)*cp++]); + } + } +#ifdef CYGOPT_AAED2000_LCD_COMM_LOGO_TOP + screen_start = (nrows + (FONT_HEIGHT-1))/FONT_HEIGHT; + screen_end = LCD_HEIGHT/FONT_HEIGHT; + return offset+nrows; +#else + screen_start = 0; + screen_height = offset / FONT_HEIGHT; + screen_end = screen_height; + return offset; +#endif +} +#endif + +void +lcd_screen_clear(void) +{ + int row, col, pos; + for (row = 0; row < screen_height; row++) { + for (col = 0; col < screen_width; col++) { + screen[row][col] = ' '; + } + } +#ifdef CYGOPT_AAED2000_LCD_COMM_LOGO + // Note: Row 0 seems to wrap incorrectly +#ifdef CYGOPT_AAED2000_LCD_COMM_LOGO_TOP + pos = 0; +#else + pos = (LCD_HEIGHT-1); +#endif + show_xpm(banner_xpm, pos); +#endif // CYGOPT_AAED2000_LCD_COMM_LOGO + curX = 0; curY = screen_start; + if (cursor_enable) { + lcd_drawc(CURSOR_ON, curX-screen_pan, curY); + } +} + +// Position cursor +void +lcd_moveto(int X, int Y) +{ + if (cursor_enable) { + lcd_drawc(screen[curY][curX], curX-screen_pan, curY); + } + if (X < 0) X = 0; + if (X >= screen_width) X = screen_width-1; + curX = X; + if (Y < screen_start) Y = screen_start; + if (Y >= screen_height) Y = screen_height-1; + curY = Y; + if (cursor_enable) { + lcd_drawc(CURSOR_ON, curX-screen_pan, curY); + } +} + +// Render a character at position (X,Y) with current background/foreground +static void +lcd_drawc(cyg_int8 c, int x, int y) +{ + cyg_uint8 bits; + int l, p; + int xoff, yoff; +#ifndef CYGSEM_AAED2000_LCD_PORTRAIT_MODE + cyg_uint32 *fb; +#endif + + + if ((x < 0) || (x >= VISIBLE_SCREEN_WIDTH) || + (y < 0) || (y >= screen_height)) return; + for (l = 0; l < FONT_HEIGHT; l++) { + bits = font_table[c-FIRST_CHAR][l]; + yoff = y*FONT_HEIGHT + l; + xoff = x*FONT_HEIGHT; +#ifndef CYGSEM_AAED2000_LCD_PORTRAIT_MODE + // Caution - only works for little-endian & font sizes multiple of 2 + fb = lcd_fb(yoff, xoff); + for (p = 0; p < FONT_WIDTH; p += 2) { + switch (bits & 0x03) { + case 0: + *fb++ = (bg << 16) | bg; + break; + case 1: + *fb++ = (bg << 16) | fg; + break; + case 2: + *fb++ = (fg << 16) | bg; + break; + case 3: + *fb++ = (fg << 16) | fg; + break; + } + bits >>= 2; + } +#else + for (p = 0; p < FONT_WIDTH; p++) { + set_pixel(yoff, xoff + p, (bits & 0x01) ? fg : bg); + bits >>= 1; + } +#endif + } +} + +static void +lcd_refresh(void) +{ + int row, col; + + for (row = screen_start; row < screen_height; row++) { + for (col = 0; col < VISIBLE_SCREEN_WIDTH; col++) { + if ((col+screen_pan) < screen_width) { + lcd_drawc(screen[row][col+screen_pan], col, row); + } else { + lcd_drawc(' ', col, row); + } + } + } + if (cursor_enable) { + lcd_drawc(CURSOR_ON, curX-screen_pan, curY); + } +} + +static void +lcd_scroll(void) +{ + int col; + cyg_uint8 *c1; + cyg_uint32 *lc0, *lc1, *lcn; +#ifndef CYGSEM_AAED2000_LCD_PORTRAIT_MODE + cyg_uint32 *fb_row0, *fb_row1, *fb_rown; +#endif + + // First scroll up the virtual screen +#if ((SCREEN_WIDTH%4) != 0) +#error Scroll code optimized for screen with multiple of 4 columns +#endif + lc0 = (cyg_uint32 *)&screen[0][0]; + lc1 = (cyg_uint32 *)&screen[1][0]; + lcn = (cyg_uint32 *)&screen[screen_height][0]; + while (lc1 != lcn) { + *lc0++ = *lc1++; + } + c1 = &screen[screen_height-1][0]; + for (col = 0; col < screen_width; col++) { + *c1++ = 0x20; + } +#ifdef CYGSEM_AAED2000_LCD_PORTRAIT_MODE + // Redrawing the screen in this mode is hard :-) + lcd_refresh(); +#else + fb_row0 = lcd_fb(screen_start*FONT_HEIGHT, 0); + fb_row1 = lcd_fb((screen_start+1)*FONT_HEIGHT, 0); + fb_rown = lcd_fb(screen_end*FONT_HEIGHT, 0); +#if 1 + while (fb_row1 != fb_rown) { + *fb_row0++ = *fb_row1++; + } +#else + // Optimized ARM assembly "move" code + asm __volatile( + "mov r0,%0;" + "mov r1,%1;" + "mov r2,%2;" + "10: ldmia r1!,{r3-r10};" + "stmia r0!,{r3-r10};" + "cmp r1,r2;" + "bne 10b" + : + : "r"(fb_row0), "r"(fb_row1), "r"(fb_rown) + : "r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","r10" + ); +#endif + // Erase bottom line + for (col = 0; col < screen_width; col++) { + lcd_drawc(' ', col, screen_end-1); + } +#endif +} + +// Draw one character at the current position +void +lcd_putc(cyg_int8 c) +{ + if (cursor_enable) { + lcd_drawc(screen[curY][curX], curX-screen_pan, curY); + } + switch (c) { + case '\r': + curX = 0; + break; + case '\n': + curY++; + break; + case '\b': + curX--; + if (curX < 0) { + curY--; + if (curY < 0) curY = 0; + curX = screen_width-1; + } + break; + default: + if (((cyg_uint8)c < FIRST_CHAR) || ((cyg_uint8)c > LAST_CHAR)) c = '.'; + screen[curY][curX] = c; + lcd_drawc(c, curX-screen_pan, curY); + curX++; + if (curX == screen_width) { + curY++; + curX = 0; + } + } + if (curY >= screen_height) { + lcd_scroll(); + curY = (screen_height-1); + } + if (cursor_enable) { + lcd_drawc(CURSOR_ON, curX-screen_pan, curY); + } +} + +// Basic LCD 'printf()' support + +#include + +#define is_digit(c) ((c >= '0') && (c <= '9')) + +static int +_cvt(unsigned long val, char *buf, long radix, char *digits) +{ + char temp[80]; + char *cp = temp; + int length = 0; + if (val == 0) { + /* Special case */ + *cp++ = '0'; + } else { + while (val) { + *cp++ = digits[val % radix]; + val /= radix; + } + } + while (cp != temp) { + *buf++ = *--cp; + length++; + } + *buf = '\0'; + return (length); +} + +static int +lcd_vprintf(void (*putc)(cyg_int8), const char *fmt0, va_list ap) +{ + char c, sign, *cp; + int left_prec, right_prec, zero_fill, length, pad, pad_on_right; + char buf[32]; + long val; + while ((c = *fmt0++)) { + cp = buf; + length = 0; + if (c == '%') { + c = *fmt0++; + left_prec = right_prec = pad_on_right = 0; + if (c == '-') { + c = *fmt0++; + pad_on_right++; + } + if (c == '0') { + zero_fill = TRUE; + c = *fmt0++; + } else { + zero_fill = FALSE; + } + while (is_digit(c)) { + left_prec = (left_prec * 10) + (c - '0'); + c = *fmt0++; + } + if (c == '.') { + c = *fmt0++; + zero_fill++; + while (is_digit(c)) { + right_prec = (right_prec * 10) + (c - '0'); + c = *fmt0++; + } + } else { + right_prec = left_prec; + } + sign = '\0'; + switch (c) { + case 'd': + case 'x': + case 'X': + val = va_arg(ap, long); + switch (c) { + case 'd': + if (val < 0) { + sign = '-'; + val = -val; + } + length = _cvt(val, buf, 10, "0123456789"); + break; + case 'x': + length = _cvt(val, buf, 16, "0123456789abcdef"); + break; + case 'X': + length = _cvt(val, buf, 16, "0123456789ABCDEF"); + break; + } + break; + case 's': + cp = va_arg(ap, char *); + length = strlen(cp); + break; + case 'c': + c = va_arg(ap, long /*char*/); + (*putc)(c); + continue; + default: + (*putc)('?'); + } + pad = left_prec - length; + if (sign != '\0') { + pad--; + } + if (zero_fill) { + c = '0'; + if (sign != '\0') { + (*putc)(sign); + sign = '\0'; + } + } else { + c = ' '; + } + if (!pad_on_right) { + while (pad-- > 0) { + (*putc)(c); + } + } + if (sign != '\0') { + (*putc)(sign); + } + while (length-- > 0) { + (*putc)(c = *cp++); + if (c == '\n') { + (*putc)('\r'); + } + } + if (pad_on_right) { + while (pad-- > 0) { + (*putc)(' '); + } + } + } else { + (*putc)(c); + if (c == '\n') { + (*putc)('\r'); + } + } + } + + // FIXME + return 0; +} + +int +_lcd_printf(char const *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = lcd_vprintf(lcd_putc, fmt, ap); + va_end(ap); + return (ret); +} + +void +lcd_setbg(int red, int green, int blue) +{ + bg = RGB_RED(red) | RGB_GREEN(green) | RGB_BLUE(blue); +} + +void +lcd_setfg(int red, int green, int blue) +{ + fg = RGB_RED(red) | RGB_GREEN(green) | RGB_BLUE(blue); +} + +// +// Support LCD/keyboard (PS2) as a virtual I/O channel +// Adapted from i386/pcmb_screen.c +// + +static int _timeout = 500; + +static cyg_bool +lcd_comm_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + if( !aaed2000_KeyboardTest() ) + return false; + *ch = aaed2000_KeyboardGetc(); + return true; +} + +static cyg_uint8 +lcd_comm_getc(void* __ch_data) +{ + cyg_uint8 ch; + + while (!lcd_comm_getc_nonblock(__ch_data, &ch)) ; + return ch; +} + +static void +lcd_comm_putc(void* __ch_data, cyg_uint8 c) +{ + lcd_putc(c); +} + +static void +lcd_comm_write(void* __ch_data, const cyg_uint8* __buf, cyg_uint32 __len) +{ +#if 0 + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + lcd_comm_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +#endif +} + +static void +lcd_comm_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ +#if 0 + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = lcd_comm_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +#endif +} + +static cyg_bool +lcd_comm_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + cyg_bool res; + + delay_count = _timeout * 2; // delay in .5 ms steps + for(;;) { + res = lcd_comm_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + CYGACC_CALL_IF_DELAY_US(500); + } + return res; +} + +static int +lcd_comm_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int vector = 0; + int ret = -1; + static int irq_state = 0; + + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + ret = irq_state; + irq_state = 1; + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = _timeout; + _timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + break; + } + case __COMMCTL_FLUSH_OUTPUT: + ret = 0; + break; + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +lcd_comm_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ +#if 0 + char ch; + + cyg_drv_interrupt_acknowledge(__vector); + *__ctrlc = 0; + if (lcd_comm_getc_nonblock(__ch_data, &ch)) { + if (ch == 0x03) { + *__ctrlc = 1; + } + } + return CYG_ISR_HANDLED; +#else + return 0; +#endif +} + +void +lcd_comm_init(void) +{ + static int init = 0; + + if (!init) { + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + init = 1; + lcd_on(false); + if (!aaed2000_KeyboardInit()) { + // No keyboard - no LCD display + return; + } + // Initialize screen + cursor_enable = true; + lcd_init(16); + lcd_screen_clear(); + + // Setup procs in the vector table + CYGACC_CALL_IF_SET_CONSOLE_COMM(1); // FIXME - should be controlled by CDL + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + //CYGACC_COMM_IF_CH_DATA_SET(*comm, chan); + CYGACC_COMM_IF_WRITE_SET(*comm, lcd_comm_write); + CYGACC_COMM_IF_READ_SET(*comm, lcd_comm_read); + CYGACC_COMM_IF_PUTC_SET(*comm, lcd_comm_putc); + CYGACC_COMM_IF_GETC_SET(*comm, lcd_comm_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, lcd_comm_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, lcd_comm_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, lcd_comm_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); + } +} + +#ifdef CYGPKG_REDBOOT +#include + +// Get here when RedBoot is idle. If it's been long enough, then +// dim the LCD. The problem is - how to determine other activities +// so at this doesn't get in the way. In the default case, this will +// be called from RedBoot every 10ms (CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) + +#define MAX_IDLE_TIME (30*100) + +static void +idle(bool is_idle) +{ + static int idle_time = 0; + static bool was_idled = false; + + if (is_idle) { + if (!was_idled) { + if (++idle_time == MAX_IDLE_TIME) { + was_idled = true; + lcd_on(false); + } + } + } else { + idle_time = 0; + if (was_idled) { + was_idled = false; + lcd_on(true); + } + } +} + +RedBoot_idle(idle, RedBoot_AFTER_NETIO); +#endif +#endif diff --git a/packages/hal/arm/arm9/excalibur/current/ChangeLog b/packages/hal/arm/arm9/excalibur/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/ChangeLog @@ -0,0 +1,323 @@ +2002-05-14 Jesper Skov + + * src/excalibur_misc.c: Fixed warning. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_arm9_excalibur.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-04-18 Jonathan Larmour + + * cdl/hal_arm_arm9_excalibur.cdl: Use --no-target-default-spec to + avoid problems with newer tools. + +2002-04-02 Jesper Skov + + * include/pkgconf/mlt_arm_arm9_excalibur_redboot.h: Added new + REDBOOT startup mode that is similar in function to the ROMRAM + starup mode, with the exception that (RedBoot) application memory + is linked at 0x07f80000 instead of 0x00008000, thus freeing up + memory at 0x8000 to applications linked without the correct linker + map. + * include/pkgconf/mlt_arm_arm9_excalibur_redboot.mlt: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_redboot.ldi: Same. + + * cdl/hal_arm_arm9_excalibur.cdl: Added REDBOOT startup mode + handling. + + * include/hal_platform_setup.h: Handle REDBOOT startup mode like + ROMRAM mode. + + * misc/redboot_REDBOOT.ecm: Configuration for use of the REDBOOT + startup mode. + +2002-01-29 Jesper Skov + + * include/plf_io.h (CYGARC_PHYSICAL_ADDRESS): Added. + + * cdl/hal_arm_arm9_excalibur.cdl: Use generic linux exec command. + * src/redboot_linux_exec.c: Removed. + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + +2001-12-21 Jesper Skov + + * include/pkgconf/mlt_arm_arm9_excalibur_romram.ldi: Increase RAM + size to 128MB. + * include/pkgconf/mlt_arm_arm9_excalibur_romram.mlt: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_romram.h: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_rom.ldi: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_rom.mlt: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_rom.h: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_ram.ldi: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_ram.mlt: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_ram.h: Same. + + * include/hal_platform_setup.h: Make Altera's init code the + default after finding the buglet that made it fail. + + * include/excalibur.h: Added some registers, cut out some unused + definitions. + * cdl/hal_arm_arm9_excalibur.cdl: Increased clocks to 150/75MHz. + +2001-12-20 Jesper Skov + + * include/hal_platform_setup.h: Added SDRAM configuration code + from Altera. Clean up code. Added printhex8 function. + +2001-12-18 Jesper Skov + + * cdl/hal_arm_arm9_excalibur.cdl: Added some clock comments. + * include/excalibur.h: Added CLK definitions. + * include/hal_platform_setup.h: Added code (from Altera) to change + clocking to 150/75/75MHz. They don't work though. + Oops, get the math right. + +2001-12-17 Jesper Skov + + * include/excalibur.h (_MMAP_PLD1_INIT): Changed to 0x0f000000. + * src/excalibur_misc.c (hal_mmu_init): Added mapping for + PLD1. Still causes access error though... + +2001-12-14 Jesper Skov + + * include/pkgconf/mlt_arm_arm9_excalibur_romram.h: Changed ROM + location. + * include/pkgconf/mlt_arm_arm9_excalibur_romram.ldi: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_romram.mlt: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_rom.h: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_rom.ldi: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_rom.mlt: Same. + + * include/excalibur.h: Change memory mapping to match that + expected by Linux. + * cdl/hal_arm_arm9_excalibur.cdl: Relocate .hex file accordingly. + Also suppress reservation of space for RedBoot[backup] image. + Finally, increase default baud rate to 57600. + * src/excalibur_misc.c (hal_mmu_init): Change memory mapping. + +2001-12-06 Jesper Skov + + * src/redboot_linux_exec.c: Added. + + * misc/redboot_ROMRAM.ecm: Don't disable dcache. + * misc/redboot_RAM.ecm: Same. + + * cdl/hal_arm_arm9_excalibur.cdl: Added Linux platform + identifier [for Camelot platform - may have to change]. Build file + with exec command. + +2001-12-03 Jesper Skov + + * cdl/hal_arm_arm9_excalibur.cdl: Cache should be safe to use + now. Bug in variant HAL macro. + +2001-08-17 Jesper Skov + + * cdl/hal_arm_arm9_excalibur.cdl: Point to + excalibur_program_new_stack. + * src/excalibur_misc.c (excalibur_program_new_stack): Added. + + * misc/redboot_ROMRAM.ecm: Clean up inferred/user_values. + +2001-08-16 Jesper Skov + + * misc/redboot_ROMRAM.ecm: Added threads. [made it inferred] + Enable syscall support. + + * include/hal_platform_setup.h: Enable flash parts 1-3 on + expansion bus. + + * include/excalibur.h: Added expansion bus config defs. + +2001-08-15 Jesper Skov + + * src/excalibur_misc.c (hal_clock_initialize): Be a little more + careful initializing the timer. + + * cdl/hal_arm_arm9_excalibur.cdl: Fix RTC period calculation. + + * misc/redboot_ROMRAM.ecm: Added flash and compression. + * misc/redboot_RAM.ecm: Added. + + * include/pkgconf/mlt_arm_arm9_excalibur_ram.mlt: More space to + RedBoot. + * include/pkgconf/mlt_arm_arm9_excalibur_ram.ldi: Same. + + * src/hal_diag.c (cyg_hal_plf_serial_isr): Also use RX int + workaround here. + + * src/excalibur_misc.c (hal_IRQ_handler): INT_ID doesn't do the + helpful thing, so decode by steam. + + * cdl/hal_arm_arm9_excalibur.cdl: Disable D-cache again. + +2001-08-14 Jesper Skov + + * src/excalibur_misc.c (hal_mmu_init): Don't let flash be cached: + appears to cause a bus lock when accessed from RAM. + + * include/hal_platform_setup.h: Only copy code when in ROMRAM + startup configuration. + + * src/excalibur_misc.c (hal_delay_us): Use timer. + + * include/hal_platform_setup.h: Better ROMRAM startup. + + * cdl/hal_arm_arm9_excalibur.cdl: Allow caches again. Up baud rate. + + * src/hal_diag.c (cyg_hal_plf_serial_putc): Work around HW bug in + transmitter. + + * cdl/hal_arm_arm9_excalibur.cdl: Added ROMRAM startup mode. + + * include/pkgconf/mlt_arm_arm9_excalibur_romram.ldi: Added. + * include/pkgconf/mlt_arm_arm9_excalibur_romram.mlt: Added. + * include/pkgconf/mlt_arm_arm9_excalibur_romram.h: Added. + + * src/hal_diag.c: Use RI flag in ISR instead of polling the FIFO + count register. Appears that FIFO jams on overruns somehow, and + messes up the ISR state in the process. Try to work around that by + checking both FIFO count and ISR RI flag. It works. Sort of. + + * src/excalibur_misc.c (hal_delay_us): Do nothing for now. Real + code changed a bit too. + + * include/excalibur.h: Fixed typo in FIFO register defs. + + * cdl/hal_arm_arm9_excalibur.cdl: Changed baud rate to 9600 until + cache issue is resolved. + +2001-08-13 Jesper Skov + + * src/excalibur_misc.c (hal_mmu_init): Fix comment error. + + * include/hal_platform_setup.h: Clear instruction cache on startup. + + * include/excalibur.h: Minor reorg, comment question resolved. + + * cdl/hal_arm_arm9_excalibur.cdl: Require ARM922T support. + + * include/hal_platform_setup.h: Write buffer cannot be disabled. + +2001-08-10 Jesper Skov + + * src/excalibur_misc.c (hal_delay_us): Don't use prescaling. + + * include/hal_platform_setup.h: Set up EBI1-3 (flash parts 1-3) - + doesn't work though. + + * include/hal_platform_ints.h: Added reset code. + + * include/excalibur.h: Added watchdog defs. Updated EBI regions. + +2001-08-09 Jesper Skov + + * include/hal_platform_setup.h: Remove SRAM hack. + * include/excalibur.h: Same. + + * include/hal_platform_setup.h: Cleanup. + Missing LED cleanup. Move PLD init. + + * cdl/hal_arm_arm9_excalibur.cdl: Disable caches for now. + + * src/excalibur_misc.c: Added debug code, disable PLD interrupts. + + * include/hal_platform_setup.h: Added some (overkill) delays, + moved PLD mmap init, do SDRAM init, don't touch unused mmap + entries. Do DPSRAM init (not that it should make a difference). + + * include/excalibur.h: Fixed mmap sizes. Fixed SDRAM map + size. Added some debug code. Added DPSRAM defs. + +2001-08-08 Jesper Skov + + * include/hal_platform_setup.h: Jump to ROM, disable ROM + mapping. Wait after SDRAM refresh operations. + Output debug via LED macro. + + * include/excalibur.h: Altera SDRAM settings. + + * include/hal_platform_setup.h: Adding more initialization and + (temporary) UART debug code. Fixing instruction addressing modes. + + * include/excalibur.h: Adding more definitions. + + * cdl/hal_arm_arm9_excalibur.cdl: Added ihex build rule for + RedBoot. + +2001-08-07 Jesper Skov + + * include/excalibur.h: Added SDRAM controller details. + + * cdl/hal_arm_arm9_excalibur.cdl: Added SDRAM clock. + + * include/hal_platform_setup.h: Added hardwired SDRAM init. + + * src/hal_diag.c: Use peripheral clock. Fix compiler error. + + * src/excalibur_misc.c: Updated memory mapping. Fix compiler + errors and warnings. + + * include/pkgconf/mlt_arm_arm9_excalibur_ram.ldi: Updated. + * include/pkgconf/mlt_arm_arm9_excalibur_ram.mlt: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_ram.h: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_rom.ldi: Updated. + * include/pkgconf/mlt_arm_arm9_excalibur_rom.mlt: Same. + * include/pkgconf/mlt_arm_arm9_excalibur_rom.h: Same. + + * include/hal_platform_setup.h: Set up memory map. + + * include/excalibur.h: Added memory mapping registers and memory + map layout. + + * cdl/hal_arm_arm9_excalibur.cdl: Package display changed to match + top-level. Added clock definitions (must add configury eventually). + +2001-08-06 Jesper Skov + + * src/excalibur_misc.c: Clock, irq and MMU code. + + * include/excalibur.h: Register definitions. + + * src/hal_diag.c: Serial driver added. + + * Created HAL for Altera Excalibur. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/arm/arm9/excalibur/current/cdl/hal_arm_arm9_excalibur.cdl b/packages/hal/arm/arm9/excalibur/current/cdl/hal_arm_arm9_excalibur.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/cdl/hal_arm_arm9_excalibur.cdl @@ -0,0 +1,427 @@ +# ==================================================================== +# +# hal_arm_arm9_excalibur.cdl +# +# Altera ARM9/EXCALIBUR platform HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Contributors: jskov, gthomas +# Date: 2001-08-06 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== +cdl_package CYGPKG_HAL_ARM_ARM9_EXCALIBUR { + display "Altera ARM9/Excalibur board" + parent CYGPKG_HAL_ARM_ARM9 + requires CYGPKG_HAL_ARM_ARM9_ARM922T + hardware + include_dir cyg/hal + define_header hal_arm_arm9_excalibur.h + description " + This HAL platform package provides generic + support for the Altera ARM9 based board, known as 'excalibur'." + + compile excalibur_misc.c hal_diag.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_VARIANT_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM9\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"EXCALIBUR system\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + puts $::cdl_header "#define HAL_ARCH_PROGRAM_NEW_STACK excalibur_program_new_stack" + + puts $::cdl_header "#define HAL_PLATFORM_MACHINE_TYPE 62" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + default_value {"RAM"} + legal_values {"RAM" "ROM" "ROMRAM" "REDBOOT" } + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the Excalibur eval board it is possible to build + the system for either RAM bootstrap or ROM bootstrap(s). Select + 'ram' when building programs to load into RAM using eCos GDB + stubs. Select 'rom' when building a stand-alone application + which will be put into ROM, or for the special case of + building the eCos GDB stubs themselves. Select 'redboot' when + building RedBoot to place RedBoot at top of memory, leaving + the bottom of memory (from 0x8000) to applications." + } + + # Both PLLs are in bypass mode on startup. + # FIXME: Add proper configury + cdl_option CYGNUM_HAL_ARM_EXCALIBUR_CPU_CLOCK { + display "CPU bus speed" + flavor data + calculated { 150000000 } + description " + This is the actual CPU operating frequency (AHB1)." + } + + cdl_option CYGNUM_HAL_ARM_EXCALIBUR_PERIPHERAL_CLOCK { + display "Peripheral bus speed" + flavor data + calculated { CYGNUM_HAL_ARM_EXCALIBUR_CPU_CLOCK / 2 } + description " + This is the peripheral bus operating frequency (AHB2)." + } + + cdl_option CYGNUM_HAL_ARM_EXCALIBUR_SDRAM_CLOCK { + display "SDRAM clock" + flavor data + calculated { 75000000 } + description " + This is the SDRAM bus operating frequency (SD_CLK)." + } + + cdl_option CYGNUM_HAL_ARM_EXCALIBUR_TIMER_PRESCALE { + display "Timer prescale" + flavor data + legal_values 0 to 255 + default_value 16 + description " + This is the prescale value used on the clock used to drive + the kernel counter. Note that some parts of the code may fail + if this is changed due to over/underflows of expressions." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants" + flavor none + no_define + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated (CYGNUM_HAL_ARM_EXCALIBUR_PERIPHERAL_CLOCK/(CYGNUM_HAL_ARM_EXCALIBUR_TIMER_PRESCALE*CYGNUM_HAL_RTC_DENOMINATOR))-1 + } + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 57600 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 57600 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The excalibur board has two serial ports. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + The excalibur board has two serial ports. This option + chooses which port will be used for diagnostic output." + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + no_define + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + parent CYGPKG_NONE + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "arm-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mcpu=arm9 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which are used to + compile all packages by default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "--no-target-default-spec -Wl,--gc-sections -Wl,-static -g -O2 -nostdlib" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.srec : /bin/gdb_module.img + $(OBJCOPY) --remove-section=.fixed_vectors $< gdb_module.tmp + } + } + } + + cdl_component CYGPKG_HAL_ARM_ARM9_EXCALIBUR_OPTIONS { + display "ARM9/EXCALIBUR build options" + flavor none + no_define + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_HAL_ARM_ARM9_EXCALIBUR_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the ARM9 EXCALIBUR HAL. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_HAL_ARM_ARM9_EXCALIBUR_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the ARM9 EXCALIBUR HAL. These flags are removed from + the set of global flags if present." + } + + cdl_option CYGPKG_HAL_ARM_ARM9_EXCALIBUR_TESTS { + display "ARM9/EXCALIBUR tests" + flavor data + no_define + calculated { "" } + description " + This option specifies the set of tests for the ARM9 Excalibur HAL." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "arm_arm9_excalibur_ram" : \ + CYG_HAL_STARTUP == "ROM" ? "arm_arm9_excalibur_rom" : \ + CYG_HAL_STARTUP == "ROMRAM" ? "arm_arm9_excalibur_romram" : \ + "arm_arm9_excalibur_redboot" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + CYG_HAL_STARTUP == "ROMRAM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + CYG_HAL_STARTUP == "ROMRAM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" || CYG_HAL_STARTUP == "ROMRAM" || CYG_HAL_STARTUP == "REDBOOT" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + \"GDB_stubs\" provides support when GDB stubs are included in + the ROM monitor or boot ROM." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + # The backup image is not needed, since ROMRAM/REDBOOT is the normal + # RedBoot startup type. + requires {!CYGPKG_REDBOOT_FLASH || CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP == 0} + + # RedBoot details + requires { CYGSEM_REDBOOT_ARM_LINUX_BOOT } + requires { CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT == 0x00008000 } + define_proc { + puts $::cdl_header "#define CYGHWR_REDBOOT_ARM_TRAMPOLINE_ADDRESS 0x00001f00" + } + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to the various relocated SREC images needed + for flash updating." + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) --change-address 0xc0000000 -O ihex $< $(@:.bin=.hex) + $(OBJCOPY) -O binary $< $@ + } + } + } + +} diff --git a/packages/hal/arm/arm9/excalibur/current/include/excalibur.h b/packages/hal/arm/arm9/excalibur/current/include/excalibur.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/excalibur.h @@ -0,0 +1,377 @@ +#ifndef CYGONCE_EXCALIBUR_H +#define CYGONCE_EXCALIBUR_H + +//============================================================================= +// +// excalibur.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-08-06 +// Purpose: Altera/EXCALIBUR platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#define EXCALIBUR_BASE EXCALIBUR_REGS_PHYS_BASE + +//----------------------------------------------------------------------------- +// Boot control +// Note: this register is actually write-bit-to-clear-it +#define EXCALIBUR_BOOT_CR (EXCALIBUR_BASE + 0x0000) + +#define EXCALIBUR_BOOT_CR_BM 0x00000001 +#define EXCALIBUR_BOOT_CR_HM 0x00000002 +#define EXCALIBUR_BOOT_CR_RE 0x00000004 + +//----------------------------------------------------------------------------- +// DPSRAM config +#define EXCALIBUR_DPSRAM_BASE (EXCALIBUR_BASE + 0x0030) +#define _DPSRAM0_SR 0x0000 +#define _DPSRAM0_LCR 0x0004 +#define _DPSRAM1_SR 0x0008 +#define _DPSRAM1_LCR 0x000c + +#define _DPSRAM0_LCR_INIT 0x00000000 +#define _DPSRAM1_LCR_INIT 0x00000000 + +//----------------------------------------------------------------------------- +// IO controller +#define EXCALIBUR_IOCR_BASE (EXCALIBUR_BASE + 0x0040) +#define _IOCR_SDRAM 0x0000 +#define _IOCR_EBI 0x0004 +#define _IOCR_UART 0x0008 +#define _IOCR_TRACE 0x000c + +#define _IOCR_OC_PCI 0x00000008 +#define _IOCR_OC_FAST 0x00000004 +#define _IOCR_OC_SLOW 0x00000000 +#define _IOCR_IO_STRIPE 0x00000002 +#define _IOCR_LOCK 0x00000001 + +#define EXCALIBUR_IOCR_SDRAM_INIT (_IOCR_OC_FAST | _IOCR_IO_STRIPE | _IOCR_LOCK) +#define EXCALIBUR_IOCR_EBI_INIT (_IOCR_OC_SLOW | _IOCR_IO_STRIPE | _IOCR_LOCK) +#define EXCALIBUR_IOCR_UART_INIT (_IOCR_OC_SLOW | _IOCR_IO_STRIPE | _IOCR_LOCK) + + +//----------------------------------------------------------------------------- +// Memory mapping +#define EXCALIBUR_MMAP_BASE (EXCALIBUR_BASE + 0x0080) +#define _MMAP_REGISTERS 0x0000 +#define _MMAP_SRAM0 0x0010 +#define _MMAP_SRAM1 0x0014 +#define _MMAP_DPSRAM0 0x0020 +#define _MMAP_DPSRAM1 0x0024 +#define _MMAP_SDRAM0 0x0030 +#define _MMAP_SDRAM1 0x0034 +#define _MMAP_EBI0 0x0040 +#define _MMAP_EBI1 0x0044 +#define _MMAP_EBI2 0x0048 +#define _MMAP_EBI3 0x004c +#define _MMAP_PLD0 0x0050 +#define _MMAP_PLD1 0x0054 +#define _MMAP_PLD2 0x0058 +#define _MMAP_PLD3 0x005c + +#define _MMAP_SIZE_16K (13<<7) +#define _MMAP_SIZE_64K (15<<7) +#define _MMAP_SIZE_128K (16<<7) +#define _MMAP_SIZE_1M (19<<7) +#define _MMAP_SIZE_4M (21<<7) +#define _MMAP_SIZE_16M (23<<7) +#define _MMAP_SIZE_32M (24<<7) +#define _MMAP_SIZE_64M (25<<7) + +#define _MMAP_PREFETCH 0x00000000 +#define _MMAP_NOPREFETCH 0x00000002 + +#define _MMAP_ENABLE 0x00000001 +#define _MMAP_DISABLE 0x00000000 + +#define _MMAP_REGISTERS_INIT (EXCALIBUR_REGS_PHYS_BASE + 0x00000000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE) +#define _MMAP_SRAM0_INIT (EXCALIBUR_SRAM_PHYS_BASE + 0x00000000 | _MMAP_SIZE_128K | _MMAP_PREFETCH | _MMAP_ENABLE) +#define _MMAP_SRAM1_INIT (EXCALIBUR_SRAM_PHYS_BASE + 0x00020000 | _MMAP_SIZE_128K | _MMAP_PREFETCH | _MMAP_ENABLE) +#define _MMAP_DPSRAM0_INIT (EXCALIBUR_SRAM_PHYS_BASE + 0x00040000 | _MMAP_SIZE_64K | _MMAP_PREFETCH | _MMAP_ENABLE) +#define _MMAP_DPSRAM1_INIT (EXCALIBUR_SRAM_PHYS_BASE + 0x00050000 | _MMAP_SIZE_64K | _MMAP_PREFETCH | _MMAP_ENABLE) +#define _MMAP_SDRAM0_INIT (EXCALIBUR_SDRAM_PHYS_BASE + 0x00000000 | _MMAP_SIZE_64M | _MMAP_PREFETCH | _MMAP_ENABLE) +#define _MMAP_SDRAM1_INIT (EXCALIBUR_SDRAM_PHYS_BASE + 0x04000000 | _MMAP_SIZE_64M | _MMAP_PREFETCH | _MMAP_ENABLE) +#define _MMAP_EBI0_INIT (EXCALIBUR_FLASH_PHYS_BASE + 0x00000000 | _MMAP_SIZE_4M | _MMAP_PREFETCH | _MMAP_ENABLE) +#define _MMAP_EBI1_INIT (EXCALIBUR_FLASH_PHYS_BASE + 0x00400000 | _MMAP_SIZE_4M | _MMAP_PREFETCH | _MMAP_ENABLE) +#define _MMAP_EBI2_INIT (EXCALIBUR_FLASH_PHYS_BASE + 0x00800000 | _MMAP_SIZE_4M | _MMAP_PREFETCH | _MMAP_ENABLE) +#define _MMAP_EBI3_INIT (EXCALIBUR_FLASH_PHYS_BASE + 0x00c00000 | _MMAP_SIZE_4M | _MMAP_PREFETCH | _MMAP_ENABLE) +#define _MMAP_PLD0_INIT (EXCALIBUR_PLD_PHYS_BASE + 0x00000000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE) +//#define _MMAP_PLD1_INIT (EXCALIBUR_PLD_PHYS_BASE + 0x00004000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE) +#define _MMAP_PLD1_INIT (0x0f000000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE) +#define _MMAP_PLD2_INIT (EXCALIBUR_PLD_PHYS_BASE + 0x00008000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE) +#define _MMAP_PLD3_INIT (EXCALIBUR_PLD_PHYS_BASE + 0x0000c000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE) + +#define EXCALIBUR_SDRAM_PHYS_BASE 0x00000000 +#define EXCALIBUR_FLASH_PHYS_BASE 0x40000000 +#define EXCALIBUR_SRAM_PHYS_BASE 0x08000000 +#define EXCALIBUR_PLD_PHYS_BASE 0x80000000 +#define EXCALIBUR_REGS_PHYS_BASE 0x7fffc000 + + + + +//----------------------------------------------------------------------------- +// Timers +#define EXCALIBUR_TIMER0_CR (EXCALIBUR_BASE+0x0200) +#define EXCALIBUR_TIMER0_PRE (EXCALIBUR_BASE+0x0210) +#define EXCALIBUR_TIMER0_LIMIT (EXCALIBUR_BASE+0x0220) +#define EXCALIBUR_TIMER0_READ (EXCALIBUR_BASE+0x0230) + +#define EXCALIBUR_TIMER1_CR (EXCALIBUR_BASE+0x0240) +#define EXCALIBUR_TIMER1_PRE (EXCALIBUR_BASE+0x0250) +#define EXCALIBUR_TIMER1_LIMIT (EXCALIBUR_BASE+0x0260) +#define EXCALIBUR_TIMER1_READ (EXCALIBUR_BASE+0x0270) + +#define EXCALIBUR_TIMER_CR_MODE_HEARBEAT 0x00000000 +#define EXCALIBUR_TIMER_CR_MODE_ONE_SHOT 0x00000001 +#define EXCALIBUR_TIMER_CR_IE 0x00000004 +#define EXCALIBUR_TIMER_CR_CI 0x00000008 +#define EXCALIBUR_TIMER_CR_S 0x00000010 + +//----------------------------------------------------------------------------- +// Serial +#define EXCALIBUR_UART0_BASE (EXCALIBUR_BASE+0x0280) +#define _UART_RSR 0x0000 +#define _UART_RDS 0x0004 +#define _UART_RD 0x0008 +#define _UART_TSR 0x000c +#define _UART_TD 0x0010 +#define _UART_FCR 0x0014 +#define _UART_IES 0x0018 +#define _UART_IEC 0x001c +#define _UART_ISR 0x0020 +#define _UART_IID 0x0024 +#define _UART_MC 0x0028 +#define _UART_MCR 0x002c +#define _UART_MSR 0x0030 +#define _UART_DIV_LO 0x0034 +#define _UART_DIV_HI 0x0038 + +#define _UART_RSR_RX_LEVEL 0x0000001f + +#define _UART_TSR_TXI 0x00000080 + +#define _UART_FCR_TC 0x00000001 +#define _UART_FCR_RC 0x00000002 +#define _UART_FCR_TX_THR_15 0x0000001c +#define _UART_FCR_RX_THR_1 0x00000000 + +#define _UART_INTS_RE 0x00000001 +#define _UART_INTS_RI _UART_INTS_RE +#define _UART_INTS_TE 0x00000002 +#define _UART_INTS_TI _UART_INTS_TE +#define _UART_INTS_TIE 0x00000004 +#define _UART_INTS_TII _UART_INTS_TIE +#define _UART_INTS_ME 0x00000008 +#define _UART_INTS_MI _UART_INTS_ME + + +#define _UART_MC_8BIT 0x00000003 +#define _UART_MC_1STOP 0x00000000 +#define _UART_MC_PARITY_NONE 0x00000000 + +//----------------------------------------------------------------------------- +// Clock controller +#define EXCALIBUR_CLK_BASE (EXCALIBUR_BASE + 0x0300) +#define _CLK_PLL1_NCNT 0x0000 +#define _CLK_PLL1_MCNT 0x0004 +#define _CLK_PLL1_KCNT 0x0008 +#define _CLK_PLL1_CTRL 0x000c +#define _CLK_PLL2_NCNT 0x0010 +#define _CLK_PLL2_MCNT 0x0014 +#define _CLK_PLL2_KCNT 0x0018 +#define _CLK_PLL2_CTRL 0x001c +#define _CLK_DERIVE 0x0020 +#define _CLK_STATUS 0x0024 +#define _CLK_AHB1_COUNT 0x0028 + +#define _CLK_PLL1_CTRL_P 0x00000001 +#define _CLK_PLL2_CTRL_P 0x00000001 + +#define _CLK_DERIVE_BP1 (1<<12) +#define _CLK_DERIVE_BP2 (1<<13) + +#define _CLK_STATUS_L1 0x00000001 +#define _CLK_STATUS_L2 0x00000002 +#define _CLK_STATUS_C1 0x00000004 +#define _CLK_STATUS_C2 0x00000008 + +// Settings from Altera example code. Note that this differs from the +// magic values described in the manual. I think the values are +// supposed to disable the PLLs, making the core run at 25MHz and +// peripherals at 12.5MHz +#define _CLK_PLL1_CTRL_INIT 0x00001064 +#define _CLK_PLL2_CTRL_INIT 0x00001064 +#define _CLK_DERIVE_INIT 0x00003010 + +//----------------------------------------------------------------------------- +// Expansion Bus Interface +#define EXCALIBUR_EBI_CR (EXCALIBUR_BASE + 0x0380) + +#define EXCALIBUR_EBI_CR_EO 0x00000008 + +#define EXCALIBUR_EBI_CR_INIT (EXCALIBUR_EBI_CR_EO) + +//----------------------------------------------------------------------------- +// SDRAM controller +#define EXCALIBUR_SDRAM_BASE (EXCALIBUR_BASE + 0x0400) +#define _SDRAM_TIMING1 0x0000 +#define _SDRAM_TIMING2 0x0004 +#define _SDRAM_CONFIG 0x0008 +#define _SDRAM_REFRESH 0x000c +#define _SDRAM_ADDR 0x0010 +#define _SDRAM_INIT 0x001c +#define _SDRAM_MODE0 0x0020 +#define _SDRAM_MODE1 0x0024 +#define EXCALIBUR_SDRAM_WIDTH (EXCALIBUR_BASE + 0x007c) + + +#define _SDRAM_WIDTH_W 0x00000002 +#define _SDRAM_WIDTH_LK 0x00000001 + +#if 0 +// Max delays +#define _SDRAM_TIMING1_INIT 0x00009124 +// CAS-2, 8 words burst, 3 clock refresh +#define _SDRAM_TIMING2_INIT 0x00000788 +// SDR +#define _SDRAM_CONFIG_INIT 0x00000000 +// Refresh period of 15us - at a clock of 75MHz that's 1125 cycles +#define _SDRAM_REFRESH_INIT 1125 +// Rows (12) & columns (10) +#define _SDRAM_ADDR_INIT 0x0000ca80 +// SDRAM mode (from Micron MT48LC16M8A2 manual) +// M0-2: burst length = 3 (8 words) +// M3 : burst type = 0 (sequential vs interleaved) +// M4-6: CAS latency = 2 +// M7-8: operating mode = 0 +// M9 : write burst mode = 0 (writes are also in burst) +#define _SDRAM_MODE0_INIT ((2<<4)|3) +// Unused (for DDR) +#define _SDRAM_MODE1_INIT 0x00000000 +#endif + +#define _SDRAM_INIT_EN 0x00008000 +#define _SDRAM_INIT_PR 0x00004000 +#define _SDRAM_INIT_LM 0x00002000 +#define _SDRAM_INIT_LEM 0x00001000 +#define _SDRAM_INIT_RF 0x00000800 +#define _SDRAM_INIT_BS 0x00000400 +#define _SDRAM_INIT_SR 0x00000200 + +#if (CYGNUM_HAL_ARM_EXCALIBUR_SDRAM_CLOCK != 75000000) +# error "Hardwired for a 75MHz SDRAM clock" +#endif + +//----------------------------------------------------------------------------- +// Watchdog controller +#define EXCALIBUR_WDOG_CR (EXCALIBUR_BASE+0x0a00) +#define EXCALIBUR_WDOG_COUNT (EXCALIBUR_BASE+0x0a04) +#define EXCALIBUR_WDOG_RELOAD (EXCALIBUR_BASE+0x0a08) + +//----------------------------------------------------------------------------- +// Interrupt controller +#define EXCALIBUR_INT_MASK_SET (EXCALIBUR_BASE+0x0c00) +#define EXCALIBUR_INT_MASK_CLEAR (EXCALIBUR_BASE+0x0c04) +#define EXCALIBUR_INT_SOURCE_STATUS (EXCALIBUR_BASE+0x0c08) +#define EXCALIBUR_INT_REQUEST_STATUS (EXCALIBUR_BASE+0x0c0c) +#define EXCALIBUR_INT_ID (EXCALIBUR_BASE+0x0c10) +#define EXCALIBUR_INT_PLD_PRIORITY (EXCALIBUR_BASE+0x0c14) +#define EXCALIBUR_INT_INT_MODE (EXCALIBUR_BASE+0x0c18) +#define EXCALIBUR_INT_PRIORITY_0 (EXCALIBUR_BASE+0x0c80) +#define EXCALIBUR_INT_PRIORITY_1 (EXCALIBUR_BASE+0x0c84) +#define EXCALIBUR_INT_PRIORITY_2 (EXCALIBUR_BASE+0x0c88) +#define EXCALIBUR_INT_PRIORITY_3 (EXCALIBUR_BASE+0x0c8c) +#define EXCALIBUR_INT_PRIORITY_4 (EXCALIBUR_BASE+0x0c90) +#define EXCALIBUR_INT_PRIORITY_5 (EXCALIBUR_BASE+0x0c94) +#define EXCALIBUR_INT_PRIORITY_6 (EXCALIBUR_BASE+0x0c98) +#define EXCALIBUR_INT_PRIORITY_7 (EXCALIBUR_BASE+0x0c9c) +#define EXCALIBUR_INT_PRIORITY_8 (EXCALIBUR_BASE+0x0ca0) +#define EXCALIBUR_INT_PRIORITY_9 (EXCALIBUR_BASE+0x0ca4) +#define EXCALIBUR_INT_PRIORITY_10 (EXCALIBUR_BASE+0x0ca8) +#define EXCALIBUR_INT_PRIORITY_11 (EXCALIBUR_BASE+0x0cac) +#define EXCALIBUR_INT_PRIORITY_12 (EXCALIBUR_BASE+0x0cb0) +#define EXCALIBUR_INT_PRIORITY_13 (EXCALIBUR_BASE+0x0cb4) +#define EXCALIBUR_INT_PRIORITY_14 (EXCALIBUR_BASE+0x0cb8) +#define EXCALIBUR_INT_PRIORITY_15 (EXCALIBUR_BASE+0x0cbc) +#define EXCALIBUR_INT_PRIORITY_16 (EXCALIBUR_BASE+0x0cc0) + +#define EXCALIBUR_INT_SOURCE_P0 0x00000001 +#define EXCALIBUR_INT_SOURCE_P1 0x00000002 +#define EXCALIBUR_INT_SOURCE_P2 0x00000004 +#define EXCALIBUR_INT_SOURCE_P3 0x00000008 +#define EXCALIBUR_INT_SOURCE_P4 0x00000010 +#define EXCALIBUR_INT_SOURCE_P5 0x00000020 +#define EXCALIBUR_INT_SOURCE_IP 0x00000040 +#define EXCALIBUR_INT_SOURCE_UA 0x00000080 +#define EXCALIBUR_INT_SOURCE_T0 0x00000100 +#define EXCALIBUR_INT_SOURCE_T1 0x00000200 +#define EXCALIBUR_INT_SOURCE_PS 0x00000400 +#define EXCALIBUR_INT_SOURCE_EE 0x00000800 +#define EXCALIBUR_INT_SOURCE_PE 0x00001000 +#define EXCALIBUR_INT_SOURCE_AE 0x00002000 +#define EXCALIBUR_INT_SOURCE_CT 0x00004000 +#define EXCALIBUR_INT_SOURCE_CR 0x00008000 +#define EXCALIBUR_INT_SOURCE_FC 0x00010000 + +#define EXCALIBUR_INT_PRIORITY_FIQ 0x00000040 +#define EXCALIBUR_INT_PRIORITY_LVL_mask 0x0000003f + +//----------------------------------------------------------------------------- +// PLD +#define EXCALIBUR_PLD_BASE EXCALIBUR_PLD_PHYS_BASE + +#define EXCALIBUR_PLD_LEDS (EXCALIBUR_PLD_BASE + 0x0100) + + + +#endif // CYGONCE_EXCALIBUR_H +//----------------------------------------------------------------------------- +// end of excalibur.h diff --git a/packages/hal/arm/arm9/excalibur/current/include/hal_diag.h b/packages/hal/arm/arm9/excalibur/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/hal_diag.h @@ -0,0 +1,77 @@ +#ifndef CYGONCE_HAL_DIAG_H +#define CYGONCE_HAL_DIAG_H + +//============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-08-06 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include +#include + +//----------------------------------------------------------------------------- + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +// Not the best place for this, but ... +extern void hal_delay_us(cyg_int32 usecs); + +#define HAL_DELAY_US(n) hal_delay_us(n); + +#endif // CYGONCE_HAL_DIAG_H +//----------------------------------------------------------------------------- +// end of hal_diag.h diff --git a/packages/hal/arm/arm9/excalibur/current/include/hal_platform_ints.h b/packages/hal/arm/arm9/excalibur/current/include/hal_platform_ints.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/hal_platform_ints.h @@ -0,0 +1,100 @@ +#ifndef CYGONCE_HAL_PLATFORM_INTS_H +#define CYGONCE_HAL_PLATFORM_INTS_H +//========================================================================== +// +// hal_platform_ints.h +// +// HAL Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-08-06 +// Purpose: Define Interrupt support +// Description: The interrupt details for the Altera/Excalibur are defined here. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +// These are interrupts on the Excalibur + +#define CYGNUM_HAL_INTERRUPT_PLD_0 0 +#define CYGNUM_HAL_INTERRUPT_PLD_1 1 +#define CYGNUM_HAL_INTERRUPT_PLD_2 2 +#define CYGNUM_HAL_INTERRUPT_PLD_3 3 +#define CYGNUM_HAL_INTERRUPT_PLD_4 4 +#define CYGNUM_HAL_INTERRUPT_PLD_5 5 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL 6 +#define CYGNUM_HAL_INTERRUPT_UART 7 +#define CYGNUM_HAL_INTERRUPT_TIMER_0 8 +#define CYGNUM_HAL_INTERRUPT_TIMER_1 9 +#define CYGNUM_HAL_INTERRUPT_PLL 10 +#define CYGNUM_HAL_INTERRUPT_EBI_ERROR 11 +#define CYGNUM_HAL_INTERRUPT_PLD_ERROR 12 +#define CYGNUM_HAL_INTERRUPT_AHB_ERROR 13 +#define CYGNUM_HAL_INTERRUPT_COMMTX 14 +#define CYGNUM_HAL_INTERRUPT_COMMRX 15 +#define CYGNUM_HAL_INTERRUPT_FAST_COMMS 16 + +#define CYGNUM_HAL_INTERRUPT_NONE -1 + +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX (CYGNUM_HAL_INTERRUPT_FAST_COMMS) + +#define CYGNUM_HAL_ISR_COUNT (CYGNUM_HAL_ISR_MAX-CYGNUM_HAL_ISR_MIN+1) + +// The vector used by the Real time clock +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_TIMER_0 + +//---------------------------------------------------------------------------- +// Reset. + +// Writing a bad value to the watchdog reload register causes a reset. +#define HAL_PLATFORM_RESET() \ + HAL_WRITE_UINT32(EXCALIBUR_WDOG_RELOAD, 0) + +#define HAL_PLATFORM_RESET_ENTRY EXCALIBUR_FLASH_PHYS_BASE + +#endif // CYGONCE_HAL_PLATFORM_INTS_H diff --git a/packages/hal/arm/arm9/excalibur/current/include/hal_platform_setup.h b/packages/hal/arm/arm9/excalibur/current/include/hal_platform_setup.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/hal_platform_setup.h @@ -0,0 +1,507 @@ +#ifndef CYGONCE_HAL_PLATFORM_SETUP_H +#define CYGONCE_HAL_PLATFORM_SETUP_H +//============================================================================= +// +// hal_platform_setup.h +// +// Platform specific support for HAL (assembly code) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov, gthomas +// Date: 2001-08-06 +// Purpose: ARM9/EXCALIBUR platform specific support routines +// Description: +// Usage: #include +// Only used by "vectors.S" +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include // System-wide configuration info +#include CYGBLD_HAL_VARIANT_H // Variant specific configuration +#include CYGBLD_HAL_PLATFORM_H // Platform specific configuration +#include CYGHWR_MEMORY_LAYOUT_H +#include // MMU definitions +#include // Platform specific hardware definitions + +#define nDEBUG +#define n_ALTERA_CACHEHACK // doesn't have any apparent effect + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) || defined(CYG_HAL_STARTUP_REDBOOT) +#define PLATFORM_SETUP1 _platform_setup1 +#define CYGHWR_HAL_ARM_HAS_MMU +#define CYGSEM_HAL_ROM_RESET_USES_JUMP + +#define CYG_DEVICE_SERIAL_BAUD_DIV (CYGNUM_HAL_ARM_EXCALIBUR_PERIPHERAL_CLOCK/CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD/16) +#define CYG_DEVICE_SERIAL_BAUD_LSB (CYG_DEVICE_SERIAL_BAUD_DIV&0xff) +#define CYG_DEVICE_SERIAL_BAUD_MSB ((CYG_DEVICE_SERIAL_BAUD_DIV>>8)&0xff) + +// We need this here - can't rely on a translation table until MMU has +// been initialized + .macro RAW_LED_MACRO x +#ifdef DEBUG + ldr r0,=(EXCALIBUR_UART0_BASE+_UART_TD) + mov r1,#(\x + 0x41) + str r1,[r0] +#endif + .endm + +// This macro represents the initial startup code for the platform + .macro _platform_setup1 + // IO controller init + ldr r1,=EXCALIBUR_IOCR_BASE + ldr r2,=EXCALIBUR_IOCR_SDRAM_INIT + str r2,[r1,#_IOCR_SDRAM] + ldr r2,=EXCALIBUR_IOCR_EBI_INIT + str r2,[r1,#_IOCR_EBI] + ldr r2,=EXCALIBUR_IOCR_UART_INIT + str r2,[r1,#_IOCR_UART] + + // Expansion bus init + ldr r1,=EXCALIBUR_EBI_CR + ldr r2,=EXCALIBUR_EBI_CR_INIT + str r2,[r1] + +#ifdef DEBUG + // Init UART for debug tracing + ldr r4,=EXCALIBUR_UART0_BASE + ldr r2,=(_UART_MC_8BIT | _UART_MC_1STOP | _UART_MC_PARITY_NONE) + str r2,[r4,#_UART_MC] + ldr r2,=CYG_DEVICE_SERIAL_BAUD_LSB + str r2,[r4,#_UART_DIV_LO] + ldr r2,=CYG_DEVICE_SERIAL_BAUD_MSB + str r2,[r4,#_UART_DIV_HI] + ldr r2,=(_UART_FCR_TC | _UART_FCR_RC | _UART_FCR_TX_THR_15 | _UART_FCR_RX_THR_1) + str r2,[r4,#_UART_FCR] +#endif + + // Setup the PLLs see the label PLL_ADDR below for the input + // clock frequency and the desired output frequencies of PLL1 + // and PLL2 Load the value into K,M,N for PLL 1 and 2 + adr r0,2f + ldmia r0,{r0-r11} + str r6,[r0] + str r7,[r1] + str r8,[r2] + str r9,[r3] + str r10,[r4] + str r11,[r5] + + // Turn on the PLLs + ldr r3,=EXCALIBUR_CLK_BASE + ldr r1,=(0x1035 | _CLK_PLL1_CTRL_P) + str r1,[r3, #_CLK_PLL1_CTRL] + str r1,[r3, #_CLK_PLL2_CTRL] + + // Ensure the PLLs are not in bypass + ldr r1,=(0x10 | _CLK_DERIVE_BP1 | _CLK_DERIVE_BP2) + str r1,[r3, #_CLK_DERIVE] + orr r1,r1,#0x300 /* Use PLL2 for AHB and for the SDRAM */ + str r1,[r3, #_CLK_DERIVE] + ldr r2,=(_CLK_DERIVE_BP1 | _CLK_DERIVE_BP2) + bic r1,r1,r2 + str r1,[r3, #_CLK_DERIVE] + + // Poll waiting for the PLL's to lock and the bits to not be + // in bypass mode + ldr r2,=_CLK_STATUS_L2 /*_CLK_STATUS_L1 | _CLK_STATUS_L2*/ +1: ldr r1, [r3, #_CLK_STATUS] + and r1, r1, r2 + cmp r1, r2 + bne 1b + + // Clear the interrupt caused by the change in lock status + ldr r2, =(_CLK_STATUS_C1 | _CLK_STATUS_C2) + str r2, [r3, #_CLK_STATUS] + + b 3f + + // PLL Registers Addresses +2: .long EXCALIBUR_CLK_BASE+_CLK_PLL1_KCNT + .long EXCALIBUR_CLK_BASE+_CLK_PLL1_MCNT + .long EXCALIBUR_CLK_BASE+_CLK_PLL1_NCNT + .long EXCALIBUR_CLK_BASE+_CLK_PLL2_KCNT + .long EXCALIBUR_CLK_BASE+_CLK_PLL2_MCNT + .long EXCALIBUR_CLK_BASE+_CLK_PLL2_NCNT + // PLL Registers Values ensure this follows on from the + // addresses the code depends on it + .long 0x40000 // CLK_PLL1_KCNT_VAL = 1 + .long 0x20101 // CLK_PLL1_MCNT_VAL = 2 + .long 0x40000 // CLK_PLL1_NCNT_VAL = 1 + .long 0x40000 // CLK_PLL2_KCNT_VAL = 1 + .long 0x20303 // CLK_PLL2_MCNT_VAL = 6 + .long 0x40000 // CLK_PLL2_NCNT_VAL = 1 +3: + + RAW_LED_MACRO 0 + + // Jump to ROM + ldr r1,=(EXCALIBUR_MMAP_BASE + _MMAP_EBI0) + ldr r2,=_MMAP_EBI0_INIT + str r2,[r1] + ldr r1,=CYGMEM_REGION_rom + add pc,pc,r1 + nop + nop + + // Disable ROM mapping + ldr r1,=EXCALIBUR_BOOT_CR + ldr r2,=EXCALIBUR_BOOT_CR_BM + str r2,[r1] + + RAW_LED_MACRO 1 + + // Disable and clear caches + + mrc p15,0,r0,c1,c0,0 + bic r0,r0,#0x1000 // disable ICache + bic r0,r0,#0x0007 // disable DCache, + // MMU and alignment faults + mcr p15,0,r0,c1,c0,0 + nop + nop + nop + nop + nop + nop + nop + nop + mov r0,#0 + mcr p15,0,r0,c7,c6,0 // clear data cache + mcr p15,0,r0,c7,c5,0 // clear instruction cache + +#if 0 + mrc p15,0,r0,c15,c1,0 // disable streaming + orr r0,r0,#0x80 + mcr p15,0,r0,c15,c1,0 +#endif + + RAW_LED_MACRO 2 + + // Set memory mapping + ldr r1,=EXCALIBUR_MMAP_BASE + ldr r2,=_MMAP_REGISTERS_INIT + str r2,[r1,#_MMAP_REGISTERS] + ldr r2,=_MMAP_SRAM0_INIT + str r2,[r1,#_MMAP_SRAM0] + ldr r2,=_MMAP_SRAM1_INIT + str r2,[r1,#_MMAP_SRAM1] + ldr r2,=_MMAP_DPSRAM0_INIT + str r2,[r1,#_MMAP_DPSRAM0] + ldr r2,=_MMAP_DPSRAM1_INIT + str r2,[r1,#_MMAP_DPSRAM1] + ldr r2,=_MMAP_SDRAM0_INIT + str r2,[r1,#_MMAP_SDRAM0] + ldr r2,=_MMAP_SDRAM1_INIT + str r2,[r1,#_MMAP_SDRAM1] + ldr r2,=_MMAP_PLD0_INIT + str r2,[r1,#_MMAP_PLD0] + ldr r2,=_MMAP_PLD1_INIT + str r2,[r1,#_MMAP_PLD1] + ldr r2,=_MMAP_PLD2_INIT + str r2,[r1,#_MMAP_PLD2] + ldr r2,=_MMAP_PLD3_INIT + str r2,[r1,#_MMAP_PLD3] + ldr r2,=_MMAP_EBI1_INIT + str r2,[r1,#_MMAP_EBI1] + ldr r2,=_MMAP_EBI2_INIT + str r2,[r1,#_MMAP_EBI2] + ldr r2,=_MMAP_EBI3_INIT + str r2,[r1,#_MMAP_EBI3] + + RAW_LED_MACRO 3 + + // FIXME: Disable MMAP registers? + + RAW_LED_MACRO 4 + + // DPSRAM init + ldr r2,=EXCALIBUR_DPSRAM_BASE + ldr r1,=_DPSRAM0_LCR_INIT + str r1,[r2,#_DPSRAM0_LCR] + ldr r1,=_DPSRAM1_LCR_INIT + str r1,[r2,#_DPSRAM1_LCR] + + RAW_LED_MACRO 5 + +#ifdef _ALTERA_CACHEHACK + mrc p15,0,r0,c1,c0,0 + orr r0,r0,#0x1000 // enable ICache + mcr p15,0,r0,c1,c0,0 + nop + nop + nop + nop + nop + nop + nop + nop +#endif // _ALTERA_CACHEHACK + + // Setup the SDR + + // All the clock values below assume the SDR is running @ 100 MHz + + // 1. Wait for the PLL's to lock this was already done in + // Setup_plls Then wait another 100uS, which given we're + // running @ 150MHz is 15,000 clock cycles + mov r3,#0x3b00 // (15104) +1: subs r3,r3,#1 + bne 1b + + + // 2. Set up all the SDRAM Controllers configuration settings + // These are done using LDMIA's as it's more efficient, they're + // done in the order they appear in the datasheet with the + // exception of SDRAM_INIT which has to be written last + + // Load the address of the first seven SDRAM registers and the + // contents + adr r0,SDRAM_REGS_ADDR + ldmia r0,{r0-r5} + + adr r6,SDRAM_REGS_VALUE + ldmia r6,{r6-r11} + str r6,[r0] + str r7,[r1] + str r8,[r2] + str r9,[r3] + str r10,[r4] + str r11,[r5] + + ldr r11,=EXCALIBUR_SDRAM_BASE + ldr r0,=EXCALIBUR_SDRAM_WIDTH + ldr r1,=(_SDRAM_WIDTH_W | _SDRAM_WIDTH_LK) /* 32 bit wide */ + str r1,[r0] + +#ifdef _ALTERA_CACHEHACK + // OK we have a minor "feature/bug" in the chip which requires + // us to be a little clever now. The code between the labels + // Cache_Start and Cache_stop starts the SDRAM controller and + // issues the pre_charge command + + // It must execute within one refresh period, so we must load + // this code and the code it calls (Issue_SDRAM_Command) into + // cache, as typical flashes have a cycle time of ~100nS If we + // are doing byte loads that's ~400ns per instruction. Depending + // upon the size of the DDR the refresh period can be as low as + // 7us (smallest we found). + adr r1,SDR_Cache_Start + adr r2,SDR_Cache_Stop + adr r3,Issue_SDRAM_Command + adr r4,End_Issue_SDRAM_Command + +SDR_Load_Code: + mcr p15,0,r1,c7,c13,1 + add r1,r1,#32 + cmp r1,r2 + ble SDR_Load_Code + +SDR_Load_Code2: + mcr p15,0,r3,c7,c13,1 + add r3,r3,#32 + cmp r3,r4 + ble SDR_Load_Code2 +#endif // _ALTERA_CACHEHACK + + // setup the timer for later + ldr r4,=EXCALIBUR_TIMER0_LIMIT + mvn r5, #1 + str r5, [r4] + + ldr r4,=_SDRAM_INIT_PR + ldr r5,=_SDRAM_INIT_RF + ldr r6,=_SDRAM_INIT_LM + ldr r9,=EXCALIBUR_TIMER0_READ + ldr r10,=EXCALIBUR_TIMER0_CR + + // Enable the controller by setting the EN bit in the + // SDRAM_INIT register + mov r1,#_SDRAM_INIT_EN +SDR_Cache_Start: + str r1,[r11, #_SDRAM_INIT] + + // Short delay + mov r3, #EXCALIBUR_TIMER_CR_S + str r3, [r10] + ldr r3, [r9] + add r3,r3,#200 +short_delay: + ldr r8, [r9] + cmp r3, r8 + bgt short_delay + mov r3, #0 + str r3, [r10] + + // 4. Issue pre-charge all command + mov r1,r4 + bl Issue_SDRAM_Command + + // 5. Issue two Refresh Commands + mov r1, r5 + mov r4,#2 +SDR_RF_Command: + bl Issue_SDRAM_Command + subs r4,r4,#1 + bne SDR_RF_Command + + // 6. Issue a load mode command with the DLL being Reset + mov r1, r6 + bl Issue_SDRAM_Command + +SDR_Cache_Stop: + b 10f + + + //-------------------------------------------- + // Issue a command from the SDRAM controller + // Assumes: + // r1 is the command to be issued + // r2 and r3 are trashed +Issue_SDRAM_Command: + mov r2,#_SDRAM_INIT_EN + orr r2,r2,r1 + str r2,[r11, #_SDRAM_INIT] + + // OK chip bug, the busy bit does not work properly, so we need + // to insert a delay of 50 SDRAM clock cycles here NB Obviously + // this must change when either the SDRAM clock or the processor + // clock change + ldr r2,=(EXCALIBUR_CLK_BASE+_CLK_AHB1_COUNT) + ldr r3, [r2] + add r3,r3,#200 // CPU 150 MHz SDRAM 75 MHz +clock_cycles: + ldr r8, [r2] + cmp r3, r8 + bgt clock_cycles + mov pc, lr +End_Issue_SDRAM_Command: + + + // SDRAM Register Addresses +SDRAM_REGS_ADDR: + .long EXCALIBUR_SDRAM_BASE+_SDRAM_TIMING1 + .long EXCALIBUR_SDRAM_BASE+_SDRAM_TIMING2 + .long EXCALIBUR_SDRAM_BASE+_SDRAM_CONFIG + .long EXCALIBUR_SDRAM_BASE+_SDRAM_REFRESH + .long EXCALIBUR_SDRAM_BASE+_SDRAM_ADDR + .long EXCALIBUR_SDRAM_BASE+_SDRAM_MODE0 + .long EXCALIBUR_SDRAM_BASE+_SDRAM_MODE1 + +SDRAM_REGS_VALUE: + .long 0x00004892 /* SDRAM_TIMING1_VAL */ + .long 0x000007b0 /* SDRAM_TIMING2_VAL */ + .long 0x00000000 /* DDR */ + .long 0x00000492 /* SDRAM_REFRESH_VAL */ + .long 0x0000Ca80 /* SDRAM_ADDR_VAL */ + .long 0x00000023 /* SDRAM_MODE0_VAL */ + .long 0x00000000 /* SDRAM_MODE1_VAL */ +10: +#ifdef _ALTERA_CACHEHACK + mrc p15,0,r0,c1,c0,0 + bic r0,r0,#0x1000 // disable ICache + mcr p15,0,r0,c1,c0,0 + nop + nop + nop + nop + nop + nop + nop + nop +#endif // _ALTERA_CACHEHACK + + RAW_LED_MACRO 6 + +#if defined(CYG_HAL_STARTUP_ROMRAM) || defined(CYG_HAL_STARTUP_REDBOOT) + ldr r0,=__rom_vectors_lma // Relocate FLASH/ROM to SDRAM + ldr r1,=__rom_vectors_vma // ram base & length + ldr r2,=__ram_data_end +20: ldr r3,[r0],#4 + str r3,[r1],#4 + cmp r1,r2 + bne 20b + ldr r0,=30f + nop + mov pc,r0 + nop +30: nop +#endif + + RAW_LED_MACRO 7 + + // Set up a stack [for calling C code] + ldr r1,=__startup_stack + ldr r2,=EXCALIBUR_SDRAM_PHYS_BASE + orr sp,r1,r2 + + // Create MMU tables + bl hal_mmu_init + + RAW_LED_MACRO 8 + + // Enable MMU + ldr r2,=10f + ldr r1,=MMU_Control_Init|MMU_Control_M + mcr MMU_CP,0,r1,MMU_Control,c0 + mov pc,r2 // Change address spaces + nop + nop + nop +10: + + RAW_LED_MACRO 9 + .endm + +#else // defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) || defined(CYG_HAL_STARTUP_REDBOOT) +#define PLATFORM_SETUP1 +#endif + +//----------------------------------------------------------------------------- +#ifdef DEBUG +#define CYGHWR_LED_MACRO \ + ldr r0,=(EXCALIBUR_UART0_BASE+_UART_TD); \ + mov r1,#((\x) + 0x61); \ + str r1,[r0]; +#endif + +//----------------------------------------------------------------------------- +// end of hal_platform_setup.h +#endif // CYGONCE_HAL_PLATFORM_SETUP_H diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_ram.h b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_ram.h @@ -0,0 +1,17 @@ +// eCos memory layout - Tue Aug 07 11:15:51 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x8000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x8000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_ram.ldi b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_ram.ldi @@ -0,0 +1,27 @@ +// eCos memory layout - Tue Aug 07 11:15:51 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x8000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x30000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_ram.mlt b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_ram.mlt @@ -0,0 +1,13 @@ +version 0 +region ram 0 8000000 0 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section rom_vectors 0 1 0 1 1 1 1 1 30000 30000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_redboot.h b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_redboot.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_redboot.h @@ -0,0 +1,20 @@ +// eCos memory layout - Tue Apr 02 09:21:22 2002 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x8000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0x40000000) +#define CYGMEM_REGION_rom_SIZE (0x100000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x7f80000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_redboot.ldi b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_redboot.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_redboot.ldi @@ -0,0 +1,28 @@ +// eCos memory layout - Tue Apr 02 09:21:22 2002 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x8000000 + rom : ORIGIN = 0x40000000, LENGTH = 0x100000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = 0x8000; + SECTION_rom_vectors (ram, 0x7f80000, AT (0x40000000)) + SECTION_text (ram, ALIGN (0x4), FOLLOWING (.rom_vectors)) + SECTION_fini (ram, ALIGN (0x4), FOLLOWING (.text)) + SECTION_rodata (ram, ALIGN (0x4), FOLLOWING (.fini)) + SECTION_rodata1 (ram, ALIGN (0x4), FOLLOWING (.rodata)) + SECTION_fixup (ram, ALIGN (0x4), FOLLOWING (.rodata1)) + SECTION_gcc_except_table (ram, ALIGN (0x4), FOLLOWING (.fixup)) + SECTION_data (ram, ALIGN (0x1), FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTIONS_END +} diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_redboot.mlt b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_redboot.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_redboot.mlt @@ -0,0 +1,14 @@ +version 0 +region ram 0 8000000 0 ! +region rom 40000000 100000 1 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section heap1 0 1 0 0 1 0 1 0 8000 8000 ! +section rom_vectors 0 1 1 1 1 1 1 1 7f80000 40000000 text text ! +section text 0 4 1 1 0 1 0 1 fini fini ! +section fini 0 4 1 1 0 1 0 1 rodata rodata ! +section rodata 0 4 1 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 1 1 0 1 0 1 fixup fixup ! +section fixup 0 4 1 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 1 1 0 1 0 1 data data ! +section data 0 1 1 1 0 1 0 0 bss ! +section bss 0 4 0 1 0 0 0 0 ! diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_rom.h b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_rom.h @@ -0,0 +1,20 @@ +// eCos memory layout - Tue Aug 07 11:20:45 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x8000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0x40000000) +#define CYGMEM_REGION_rom_SIZE (0x100000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x8000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_rom.ldi b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_rom.ldi @@ -0,0 +1,28 @@ +// eCos memory layout - Tue Aug 07 11:20:45 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x8000000 + rom : ORIGIN = 0x40000000, LENGTH = 0x100000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x40000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_data (ram, 0x8000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_rom.mlt b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_rom.mlt @@ -0,0 +1,14 @@ +version 0 +region ram 0 8000000 0 ! +region rom 40000000 100000 1 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section data 0 1 1 1 1 1 0 0 8000 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 40000000 40000000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 0 0 1 data ! diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_romram.h b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_romram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_romram.h @@ -0,0 +1,20 @@ +// eCos memory layout - Tue Aug 14 12:49:58 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x8000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0x40000000) +#define CYGMEM_REGION_rom_SIZE (0x100000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x8000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_romram.ldi b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_romram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_romram.ldi @@ -0,0 +1,28 @@ +// eCos memory layout - Tue Aug 14 12:49:58 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x8000000 + rom : ORIGIN = 0x40000000, LENGTH = 0x100000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x8000, AT (0x40000000)) + SECTION_text (ram, ALIGN (0x4), FOLLOWING (.rom_vectors)) + SECTION_fini (ram, ALIGN (0x4), FOLLOWING (.text)) + SECTION_rodata (ram, ALIGN (0x4), FOLLOWING (.fini)) + SECTION_rodata1 (ram, ALIGN (0x4), FOLLOWING (.rodata)) + SECTION_fixup (ram, ALIGN (0x4), FOLLOWING (.rodata1)) + SECTION_gcc_except_table (ram, ALIGN (0x4), FOLLOWING (.fixup)) + SECTION_data (ram, ALIGN (0x1), FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_romram.mlt b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_romram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/pkgconf/mlt_arm_arm9_excalibur_romram.mlt @@ -0,0 +1,14 @@ +version 0 +region ram 0 8000000 0 ! +region rom 40000000 100000 1 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section rom_vectors 0 1 1 1 1 1 1 1 8000 40000000 text text ! +section text 0 4 1 1 0 1 0 1 fini fini ! +section fini 0 4 1 1 0 1 0 1 rodata rodata ! +section rodata 0 4 1 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 1 1 0 1 0 1 fixup fixup ! +section fixup 0 4 1 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 1 1 0 1 0 1 data data ! +section data 0 1 1 1 0 1 0 0 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/arm/arm9/excalibur/current/include/plf_io.h b/packages/hal/arm/arm9/excalibur/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/plf_io.h @@ -0,0 +1,62 @@ +#ifndef CYGONCE_HAL_ARM_ARM9_EXCALIBUR_PLF_IO_H +#define CYGONCE_HAL_ARM_ARM9_EXCALIBUR_PLF_IO_H + +/*============================================================================= +// +// plf_io.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#define CYGARC_PHYSICAL_ADDRESS(x) (x) + +#endif // CYGONCE_HAL_ARM_ARM9_EXCALIBUR_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/arm9/excalibur/current/include/plf_stub.h b/packages/hal/arm/arm9/excalibur/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/include/plf_stub.h @@ -0,0 +1,84 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov, gthomas +// Date: 2001-08-06 +// Purpose: Platform HAL stub support for Altera/Excalibur boards. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 +#define HAL_STUB_PLATFORM_INIT_BREAK_IRQ() CYG_EMPTY_STATEMENT + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/arm/arm9/excalibur/current/misc/redboot_RAM.ecm b/packages/hal/arm/arm9/excalibur/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/misc/redboot_RAM.ecm @@ -0,0 +1,60 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware excalibur_arm9 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_ARM9 current ; + package -hardware CYGPKG_HAL_ARM_ARM9_EXCALIBUR current ; + package -hardware CYGPKG_DEVS_FLASH_INTEL_28FXXX current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_EXCALIBUR current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGPKG_HAL_ARM_ARM9_ARM922T { + inferred_value 1 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_INTEL_28F320C3 { + inferred_value 1 +}; + + diff --git a/packages/hal/arm/arm9/excalibur/current/misc/redboot_REDBOOT.ecm b/packages/hal/arm/arm9/excalibur/current/misc/redboot_REDBOOT.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/misc/redboot_REDBOOT.ecm @@ -0,0 +1,72 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware excalibur_arm9 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_ARM9 current ; + package -hardware CYGPKG_HAL_ARM_ARM9_EXCALIBUR current ; + package -hardware CYGPKG_DEVS_FLASH_INTEL_28FXXX current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_EXCALIBUR current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGPKG_HAL_ARM_ARM9_ARM922T { + inferred_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value REDBOOT +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_INTEL_28F320C3 { + inferred_value 1 +}; + + diff --git a/packages/hal/arm/arm9/excalibur/current/misc/redboot_ROMRAM.ecm b/packages/hal/arm/arm9/excalibur/current/misc/redboot_ROMRAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/misc/redboot_ROMRAM.ecm @@ -0,0 +1,72 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware excalibur_arm9 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_ARM9 current ; + package -hardware CYGPKG_HAL_ARM_ARM9_EXCALIBUR current ; + package -hardware CYGPKG_DEVS_FLASH_INTEL_28FXXX current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_EXCALIBUR current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGPKG_HAL_ARM_ARM9_ARM922T { + inferred_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROMRAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_INTEL_28F320C3 { + inferred_value 1 +}; + + diff --git a/packages/hal/arm/arm9/excalibur/current/src/excalibur_misc.c b/packages/hal/arm/arm9/excalibur/current/src/excalibur_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/src/excalibur_misc.c @@ -0,0 +1,398 @@ +//========================================================================== +// +// excalibur_misc.c +// +// HAL misc board support code for ARM9/EXCALIBUR +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Date: 2001-08-06 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // IO macros +#include // Register state info +#include +#include // Interrupt names +#include +#include // Platform specifics + +#include // diag_printf + +externC void *memset(void*, int, size_t); + +// ------------------------------------------------------------------------- +// MMU initialization: +// +// These structures are laid down in memory to define the translation +// table. +// + +// ARM Translation Table Base Bit Masks +#define ARM_TRANSLATION_TABLE_MASK 0xFFFFC000 + +// ARM Domain Access Control Bit Masks +#define ARM_ACCESS_TYPE_NO_ACCESS(domain_num) (0x0 << (domain_num)*2) +#define ARM_ACCESS_TYPE_CLIENT(domain_num) (0x1 << (domain_num)*2) +#define ARM_ACCESS_TYPE_MANAGER(domain_num) (0x3 << (domain_num)*2) + +struct ARM_MMU_FIRST_LEVEL_FAULT { + int id : 2; + int sbz : 30; +}; +#define ARM_MMU_FIRST_LEVEL_FAULT_ID 0x0 + +struct ARM_MMU_FIRST_LEVEL_PAGE_TABLE { + int id : 2; + int imp : 2; + int domain : 4; + int sbz : 1; + int base_address : 23; +}; +#define ARM_MMU_FIRST_LEVEL_PAGE_TABLE_ID 0x1 + +struct ARM_MMU_FIRST_LEVEL_SECTION { + int id : 2; + int b : 1; + int c : 1; + int imp : 1; + int domain : 4; + int sbz0 : 1; + int ap : 2; + int sbz1 : 8; + int base_address : 12; +}; +#define ARM_MMU_FIRST_LEVEL_SECTION_ID 0x2 + +struct ARM_MMU_FIRST_LEVEL_RESERVED { + int id : 2; + int sbz : 30; +}; +#define ARM_MMU_FIRST_LEVEL_RESERVED_ID 0x3 + +#define ARM_MMU_FIRST_LEVEL_DESCRIPTOR_ADDRESS(ttb_base, table_index) \ + (unsigned long *)((unsigned long)(ttb_base) + ((table_index) << 2)) + +#define ARM_FIRST_LEVEL_PAGE_TABLE_SIZE 0x4000 + +#define ARM_MMU_SECTION(ttb_base, actual_base, virtual_base, \ + cacheable, bufferable, perm) \ + CYG_MACRO_START \ + register union ARM_MMU_FIRST_LEVEL_DESCRIPTOR desc; \ + \ + desc.word = 0; \ + desc.section.id = ARM_MMU_FIRST_LEVEL_SECTION_ID; \ + desc.section.imp = 1; \ + desc.section.domain = 0; \ + desc.section.c = (cacheable); \ + desc.section.b = (bufferable); \ + desc.section.ap = (perm); \ + desc.section.base_address = (actual_base); \ + *ARM_MMU_FIRST_LEVEL_DESCRIPTOR_ADDRESS(ttb_base, (virtual_base)) \ + = desc.word; \ + CYG_MACRO_END + +#define X_ARM_MMU_SECTION(abase,vbase,size,cache,buff,access) \ + { int i; int j = abase; int k = vbase; \ + for (i = size; i > 0 ; i--,j++,k++) \ + { \ + ARM_MMU_SECTION(ttb_base, j, k, cache, buff, access); \ + } \ + } + +union ARM_MMU_FIRST_LEVEL_DESCRIPTOR { + unsigned long word; + struct ARM_MMU_FIRST_LEVEL_FAULT fault; + struct ARM_MMU_FIRST_LEVEL_PAGE_TABLE page_table; + struct ARM_MMU_FIRST_LEVEL_SECTION section; + struct ARM_MMU_FIRST_LEVEL_RESERVED reserved; +}; + +#define ARM_UNCACHEABLE 0 +#define ARM_CACHEABLE 1 +#define ARM_UNBUFFERABLE 0 +#define ARM_BUFFERABLE 1 + +#define ARM_ACCESS_PERM_NONE_NONE 0 +#define ARM_ACCESS_PERM_RO_NONE 0 +#define ARM_ACCESS_PERM_RO_RO 0 +#define ARM_ACCESS_PERM_RW_NONE 1 +#define ARM_ACCESS_PERM_RW_RO 2 +#define ARM_ACCESS_PERM_RW_RW 3 + +void +hal_mmu_init(void) +{ + unsigned long ttb_base = EXCALIBUR_SDRAM_PHYS_BASE + 0x4000; + unsigned long i; + + // Set the TTB register + asm volatile ("mcr p15,0,%0,c2,c0,0" : : "r"(ttb_base) /*:*/); + + // Set the Domain Access Control Register + i = ARM_ACCESS_TYPE_MANAGER(0) | + ARM_ACCESS_TYPE_NO_ACCESS(1) | + ARM_ACCESS_TYPE_NO_ACCESS(2) | + ARM_ACCESS_TYPE_NO_ACCESS(3) | + ARM_ACCESS_TYPE_NO_ACCESS(4) | + ARM_ACCESS_TYPE_NO_ACCESS(5) | + ARM_ACCESS_TYPE_NO_ACCESS(6) | + ARM_ACCESS_TYPE_NO_ACCESS(7) | + ARM_ACCESS_TYPE_NO_ACCESS(8) | + ARM_ACCESS_TYPE_NO_ACCESS(9) | + ARM_ACCESS_TYPE_NO_ACCESS(10) | + ARM_ACCESS_TYPE_NO_ACCESS(11) | + ARM_ACCESS_TYPE_NO_ACCESS(12) | + ARM_ACCESS_TYPE_NO_ACCESS(13) | + ARM_ACCESS_TYPE_NO_ACCESS(14) | + ARM_ACCESS_TYPE_NO_ACCESS(15); + asm volatile ("mcr p15,0,%0,c3,c0,0" : : "r"(i) /*:*/); + + // First clear all TT entries - ie Set them to Faulting + memset((void *)ttb_base, 0, ARM_FIRST_LEVEL_PAGE_TABLE_SIZE); + + // Memory layout. This is set up in hal_platform_setup.h with + // definitions from excalibur.h + // + // SDRAM0_BASE_ADDRESS: 0x00000000, 64M + // SDRAM1_BASE_ADDRESS: 0x04000000, 64M + // SPSRAM0_BASE_ADDRESS: 0x08000000, 128k + // SPSRAM1_BASE_ADDRESS: 0x08020000, 128k + // DPSRAM0_BASE_ADDRESS: 0x08040000, 64k + // DPSRAM1_BASE_ADDRESS: 0x08050000, 64k + // PLD1_BASE_ADDRESS: 0x0f000000, 16k + // EBI0_BASE_ADDRESS: 0x40000000, 16M + // REGISTERS_BASE_ADDRESS: 0x7fffc000, 16k + // PLD0_BASE_ADDRESS: 0x80000000, 128k + + // Actual Virtual Size Attributes Function + // Base Base MB cached? buffered? access permissions + // xxx00000 xxx00000 + X_ARM_MMU_SECTION(0x000, 0x000, 128, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); // SDRAM (& LCD registers?) + X_ARM_MMU_SECTION(0x080, 0x080, 1, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); // SRAM regions + X_ARM_MMU_SECTION(0x0f0, 0x0f0, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); // PLD1 + X_ARM_MMU_SECTION(0x400, 0x400, 16, ARM_UNCACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); // Boot flash ROMspace CS0 + X_ARM_MMU_SECTION(0x800, 0x800, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); // PLD0/2/3 + X_ARM_MMU_SECTION(0x7ff, 0x7ff, 1, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); // EXCALIBUR registers +} + +//---------------------------------------------------------------------------- +// Platform specific initialization + +void +plf_hardware_init(void) +{ + // Disable PLD interrupts + HAL_WRITE_UINT32(EXCALIBUR_INT_MASK_CLEAR, + EXCALIBUR_INT_SOURCE_P0 | EXCALIBUR_INT_SOURCE_P1 | + EXCALIBUR_INT_SOURCE_P2 | EXCALIBUR_INT_SOURCE_P3 | + EXCALIBUR_INT_SOURCE_P4 | EXCALIBUR_INT_SOURCE_P5); + // Make PLD0 generate IRQ + HAL_WRITE_UINT32(EXCALIBUR_INT_PRIORITY_0, 0); +} + +// ------------------------------------------------------------------------- +void +hal_clock_initialize(cyg_uint32 period) +{ + cyg_uint32 cr; + + HAL_WRITE_UINT32(EXCALIBUR_TIMER0_CR, 0); + HAL_WRITE_UINT32(EXCALIBUR_TIMER0_PRE, CYGNUM_HAL_ARM_EXCALIBUR_TIMER_PRESCALE - 1); + HAL_WRITE_UINT32(EXCALIBUR_TIMER0_LIMIT, period); + cr = EXCALIBUR_TIMER_CR_MODE_HEARBEAT | EXCALIBUR_TIMER_CR_IE; + HAL_WRITE_UINT32(EXCALIBUR_TIMER0_CR, cr); + HAL_WRITE_UINT32(EXCALIBUR_TIMER0_CR, cr | EXCALIBUR_TIMER_CR_S); + + // Unmask timer 0 interrupt + HAL_INTERRUPT_CONFIGURE( CYGNUM_HAL_INTERRUPT_RTC, 1, 1 ); + HAL_INTERRUPT_UNMASK( CYGNUM_HAL_INTERRUPT_RTC ); +} + +// This routine is called during a clock interrupt. +void +hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + cyg_uint32 cr; + + // Clear pending interrupt bit + HAL_READ_UINT32(EXCALIBUR_TIMER0_CR, cr); + cr |= EXCALIBUR_TIMER_CR_CI; + HAL_WRITE_UINT32(EXCALIBUR_TIMER0_CR, cr); +} + +// Read the current value of the clock, returning the number of hardware +// "ticks" that have occurred (i.e. how far away the current value is from +// the start) + +void +hal_clock_read(cyg_uint32 *pvalue) +{ + cyg_uint32 ctr; + + HAL_READ_UINT32(EXCALIBUR_TIMER0_READ, ctr); + *pvalue = ctr; +} + +// +// Delay for some number of micro-seconds +// +void +hal_delay_us(cyg_int32 usecs) +{ + // Use timer 2 + cyg_uint32 cr; + // Divide by 1000000 in two steps to preserve precision. + cyg_uint32 wait_clocks = ((CYGNUM_HAL_ARM_EXCALIBUR_PERIPHERAL_CLOCK/100000)*usecs)/10; + + HAL_WRITE_UINT32(EXCALIBUR_TIMER1_CR, 0); + HAL_WRITE_UINT32(EXCALIBUR_TIMER1_PRE, 0); + HAL_WRITE_UINT32(EXCALIBUR_TIMER1_LIMIT, wait_clocks); + cr = EXCALIBUR_TIMER_CR_MODE_ONE_SHOT|EXCALIBUR_TIMER_CR_CI; + HAL_WRITE_UINT32(EXCALIBUR_TIMER1_CR, cr); + HAL_WRITE_UINT32(EXCALIBUR_TIMER1_CR, cr | EXCALIBUR_TIMER_CR_S); + + // wait for start bit to clear + do { + HAL_READ_UINT32(EXCALIBUR_TIMER1_CR, cr); + } while ((EXCALIBUR_TIMER_CR_S & cr) != 0); + + //clear interrupt flag + HAL_WRITE_UINT32(EXCALIBUR_TIMER1_CR, 0); +} + +// ------------------------------------------------------------------------- + +// This routine is called to respond to a hardware interrupt (IRQ). It +// should interrogate the hardware and return the IRQ vector number. +int +hal_IRQ_handler(void) +{ + int vec; + cyg_uint32 isr; + + HAL_READ_UINT32(EXCALIBUR_INT_REQUEST_STATUS, isr); + for (vec = CYGNUM_HAL_INTERRUPT_PLD_0; + vec <= CYGNUM_HAL_INTERRUPT_FAST_COMMS; vec++) { + if (isr & (1<= CYGNUM_HAL_ISR_MIN , "Invalid vector"); + + HAL_WRITE_UINT32(EXCALIBUR_INT_MASK_CLEAR, 1<= CYGNUM_HAL_ISR_MIN , "Invalid vector"); + + HAL_WRITE_UINT32(EXCALIBUR_INT_MASK_SET, 1<= CYGNUM_HAL_ISR_MIN , "Invalid vector"); + +} + +void +hal_interrupt_configure(int vector, int level, int up) +{ + CYG_ASSERT(vector <= CYGNUM_HAL_ISR_MAX && + vector >= CYGNUM_HAL_ISR_MIN, "Invalid vector"); + CYG_ASSERT(level || up, "Cannot do falling edge"); + +} + +void +hal_interrupt_set_level(int vector, int level) +{ + cyg_uint32 reg; + CYG_ASSERT(vector <= CYGNUM_HAL_ISR_MAX && + vector >= CYGNUM_HAL_ISR_MIN, "Invalid vector"); + CYG_ASSERT(level <= 63 && level >= 0, "Invalid level"); + + HAL_READ_UINT32(EXCALIBUR_INT_PRIORITY_0+4*vector, reg); + reg &= ~EXCALIBUR_INT_PRIORITY_LVL_mask; + reg |= (level & EXCALIBUR_INT_PRIORITY_LVL_mask); + HAL_WRITE_UINT32(EXCALIBUR_INT_PRIORITY_0+4*vector, reg); +} + +#include CYGHWR_MEMORY_LAYOUT_H +typedef void code_fun(void); +void excalibur_program_new_stack(void *func) +{ + register CYG_ADDRESS stack_ptr asm("sp"); + register CYG_ADDRESS old_stack asm("r4"); + register code_fun *new_func asm("r0"); + old_stack = stack_ptr; + stack_ptr = CYGMEM_REGION_ram + CYGMEM_REGION_ram_SIZE - sizeof(CYG_ADDRESS); + new_func = (code_fun*)func; + new_func(); + stack_ptr = old_stack; + return; +} diff --git a/packages/hal/arm/arm9/excalibur/current/src/hal_diag.c b/packages/hal/arm/arm9/excalibur/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/excalibur/current/src/hal_diag.c @@ -0,0 +1,335 @@ +//============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-08-06 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include CYGBLD_HAL_VARIANT_H // Variant specific configuration +#include CYGBLD_HAL_PLATFORM_H // Platform specific configuration + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // basic machine info +#include // interrupt macros +#include // IO macros +#include +#include +#include // interface API +#include // Helper functions +#include // platform definitions + +//----------------------------------------------------------------------------- + +#define CYG_DEVICE_SERIAL_BAUD_DIV (CYGNUM_HAL_ARM_EXCALIBUR_PERIPHERAL_CLOCK/CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD/16) +#define CYG_DEVICE_SERIAL_BAUD_LSB (CYG_DEVICE_SERIAL_BAUD_DIV&0xff) +#define CYG_DEVICE_SERIAL_BAUD_MSB ((CYG_DEVICE_SERIAL_BAUD_DIV>>8)&0xff) + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint32 base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +//----------------------------------------------------------------------------- + +static void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + cyg_uint32 base = ((channel_data_t*)__ch_data)->base; + + // 8-1-no parity. + HAL_WRITE_UINT32(base+_UART_MC, _UART_MC_8BIT | _UART_MC_1STOP | _UART_MC_PARITY_NONE); + + HAL_WRITE_UINT32(base+_UART_DIV_LO, CYG_DEVICE_SERIAL_BAUD_LSB); + HAL_WRITE_UINT32(base+_UART_DIV_HI, CYG_DEVICE_SERIAL_BAUD_MSB); + HAL_WRITE_UINT32(base+_UART_FCR, (_UART_FCR_TC | _UART_FCR_RC | + _UART_FCR_TX_THR_15 | _UART_FCR_RX_THR_1)); // clear & enableFIFO + + // enable RX interrupts - otherwise ISR cannot be polled. Actual + // interrupt control of serial happens via INT_MASK + HAL_WRITE_UINT32(base+_UART_IES, _UART_INTS_RE); +} + +void +cyg_hal_plf_serial_putc(void *__ch_data, char c) +{ + cyg_uint32 base = ((channel_data_t*)__ch_data)->base; + cyg_uint32 tsr; + CYGARC_HAL_SAVE_GP(); + + do { + HAL_READ_UINT32(base+_UART_TSR, tsr); + // Wait for TXI flag to be set - or for the register to be + // zero (works around a HW bug it seems). + } while (tsr && (tsr & _UART_TSR_TXI) == 0); + + HAL_WRITE_UINT32(base+_UART_TD, (cyg_uint32)(unsigned char)c); + + CYGARC_HAL_RESTORE_GP(); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint32 base = ((channel_data_t*)__ch_data)->base; + cyg_uint32 rsr, isr, data; + + HAL_READ_UINT32(base+_UART_ISR, isr); + if (0 == (isr & _UART_INTS_RI)) { + HAL_READ_UINT32(base+_UART_RSR, rsr); + if (0 == rsr) + return false; + } + + HAL_READ_UINT32(base+_UART_RD, data); + *ch = (cyg_uint8)(data & 0xff); + + // Read RSR to clear interrupt, and RDS to clear errors + HAL_READ_UINT32(base+_UART_RSR, data); + HAL_READ_UINT32(base+_UART_RDS, data); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +static channel_data_t excalibur_ser_channels[1] = { + { (cyg_uint32)EXCALIBUR_UART0_BASE, 1000, CYGNUM_HAL_INTERRUPT_UART } +}; + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + // Need to keep it enabled to allow polling using ISR + //HAL_WRITE_UINT32(chan->base+_UART_IES, _UART_INTS_RE); + + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + // Need to keep it enabled to allow polling using ISR + // HAL_WRITE_UINT32(chan->base+_UART_IEC, _UART_INTS_RE); + + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint32 isr, ch, rsr; + char c; + CYGARC_HAL_SAVE_GP(); + + cyg_drv_interrupt_acknowledge(chan->isr_vector); + + *__ctrlc = 0; + HAL_READ_UINT32(chan->base+_UART_ISR, isr); + HAL_READ_UINT32(chan->base+_UART_RSR, rsr); + + // Again, check both RI and the RX FIFO count. + if ( ((isr & _UART_INTS_RI) != 0 ) || (rsr) ) { + + HAL_READ_UINT32(chan->base+_UART_RD, ch); + + c = (char)ch; + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(excalibur_ser_channels[0].isr_vector); + + // Init channels + cyg_hal_plf_serial_init_channel(&excalibur_ser_channels[0]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &excalibur_ser_channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +//----------------------------------------------------------------------------- +// LEDs +void +hal_diag_led(int n) +{ +} + +//----------------------------------------------------------------------------- +// End of hal_diag.c diff --git a/packages/hal/arm/arm9/var/current/ChangeLog b/packages/hal/arm/arm9/var/current/ChangeLog --- a/packages/hal/arm/arm9/var/current/ChangeLog +++ b/packages/hal/arm/arm9/var/current/ChangeLog @@ -1,3 +1,21 @@ +2002-03-06 Nick Garnett + + * include/hal_cache.h: Added support for ARM966E. This does not + have a cache, so this involved adding support for cacheless ARM9s + in general. + + * cdl/hal_arm_arm9.cdl: Added option for ARM966E. + +2002-01-28 Jesper Skov + + * include/hal_cache.h: Only define HAL_VIRT_TO_PHYS_ADDRESS if it + isn't already defined. This needs renaming and a cleanup, but this + quick #ifdef hack fixes a compiler warning. + + * cdl/hal_arm_arm9.cdl: Declare var_io.h. + + * include/var_io.h: Added. + 2001-11-16 Jesper Skov * src/arm9_misc.c (hal_hardware_init): Don't invalidate caches on @@ -101,27 +119,36 @@ 2000-11-14 Jesper Skov Physical translations - +#ifndef HAL_VIRT_TO_PHYS_ADDRESS extern cyg_uint32 hal_virt_to_phys_address(cyg_uint32 phys); #define HAL_VIRT_TO_PHYS_ADDRESS(_va, _pa) \ _pa = hal_virt_to_phys_address(_va) - +#endif //----------------------------------------------------------------------------- #endif // ifndef CYGONCE_HAL_CACHE_H // End of hal_cache.h diff --git a/packages/hal/arm/arm9/var/current/include/var_io.h b/packages/hal/arm/arm9/var/current/include/var_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/arm9/var/current/include/var_io.h @@ -0,0 +1,61 @@ +#ifndef CYGONCE_VAR_IO_H +#define CYGONCE_VAR_IO_H + +//============================================================================= +// +// var_io.h +// +// Variant specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Variant io definitions +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include // Platform specifics + +//----------------------------------------------------------------------------- +// end of var_io.h +#endif // CYGONCE_VAR_IO_H diff --git a/packages/hal/arm/arm9/var/current/src/arm9_misc.c b/packages/hal/arm/arm9/var/current/src/arm9_misc.c --- a/packages/hal/arm/arm9/var/current/src/arm9_misc.c +++ b/packages/hal/arm/arm9/var/current/src/arm9_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for ARM9 // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/at91/current/ChangeLog b/packages/hal/arm/at91/current/ChangeLog --- a/packages/hal/arm/at91/current/ChangeLog +++ b/packages/hal/arm/at91/current/ChangeLog @@ -1,3 +1,8 @@ +2002-05-08 Gary Thomas + + * misc/redboot_ROMRAM.ecm: + * misc/redboot_ROM.ecm: Disable 'fconfig' since the FLASH is too small. + 2001-08-17 George Hampton 2001-08-17 Gary Thomas @@ -98,27 +103,36 @@ 2001-07-16 Gary Thomas + + * cdl/hal_arm_cma230.cdl: Removed implemntation of + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + +2002-04-24 Jesper Skov + + * cdl/hal_arm_cma230.cdl: CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES + defined. + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + 2001-06-08 Jonathan Larmour * include/hal_cache.h: Correctly indicate absence of cache in CMA230 @@ -322,27 +336,36 @@ 1999-06-04 Gary Thomas " puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + + puts $::cdl_header "#define CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES 100000" } cdl_option CYGHWR_HAL_ARM_CMA2XX_VARIANT { diff --git a/packages/hal/arm/cma230/current/include/hal_cache.h b/packages/hal/arm/cma230/current/include/hal_cache.h --- a/packages/hal/arm/cma230/current/include/hal_cache.h +++ b/packages/hal/arm/cma230/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/cma230/current/include/hal_cma230.h b/packages/hal/arm/cma230/current/include/hal_cma230.h --- a/packages/hal/arm/cma230/current/include/hal_cma230.h +++ b/packages/hal/arm/cma230/current/include/hal_cma230.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/cma230/current/include/hal_diag.h b/packages/hal/arm/cma230/current/include/hal_diag.h --- a/packages/hal/arm/cma230/current/include/hal_diag.h +++ b/packages/hal/arm/cma230/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/cma230/current/include/hal_platform_extras.h b/packages/hal/arm/cma230/current/include/hal_platform_extras.h --- a/packages/hal/arm/cma230/current/include/hal_platform_extras.h +++ b/packages/hal/arm/cma230/current/include/hal_platform_extras.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/cma230/current/include/hal_platform_ints.h b/packages/hal/arm/cma230/current/include/hal_platform_ints.h --- a/packages/hal/arm/cma230/current/include/hal_platform_ints.h +++ b/packages/hal/arm/cma230/current/include/hal_platform_ints.h @@ -7,29 +7,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/cma230/current/include/hal_platform_setup.h b/packages/hal/arm/cma230/current/include/hal_platform_setup.h --- a/packages/hal/arm/cma230/current/include/hal_platform_setup.h +++ b/packages/hal/arm/cma230/current/include/hal_platform_setup.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/cma230/current/include/plf_io.h b/packages/hal/arm/cma230/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/cma230/current/include/plf_io.h @@ -0,0 +1,60 @@ +#ifndef CYGONCE_HAL_ARM_CMA230_PLF_IO_H +#define CYGONCE_HAL_ARM_CMA230_PLF_IO_H + +/*============================================================================= +// +// plf_io.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#endif // CYGONCE_HAL_ARM_CMA230_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/cma230/current/include/plf_stub.h b/packages/hal/arm/cma230/current/include/plf_stub.h --- a/packages/hal/arm/cma230/current/include/plf_stub.h +++ b/packages/hal/arm/cma230/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/cma230/current/src/cma230_misc.c b/packages/hal/arm/cma230/current/src/cma230_misc.c --- a/packages/hal/arm/cma230/current/src/cma230_misc.c +++ b/packages/hal/arm/cma230/current/src/cma230_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for ARM CMA230-1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/cma230/current/src/hal_diag.c b/packages/hal/arm/cma230/current/src/hal_diag.c --- a/packages/hal/arm/cma230/current/src/hal_diag.c +++ b/packages/hal/arm/cma230/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/e7t/current/ChangeLog b/packages/hal/arm/e7t/current/ChangeLog --- a/packages/hal/arm/e7t/current/ChangeLog +++ b/packages/hal/arm/e7t/current/ChangeLog @@ -1,3 +1,12 @@ +2002-04-15 Jesper Skov + + * include/hal_platform_setup.h (PLATFORM_SETUP1): Changed ldm/stm + to ldmia/stmia. + +2002-03-06 Jesper Skov + + * misc/redboot_ROM.ecm: Added zlib package. + 2001-10-02 Jonathan Larmour * cdl/hal_arm_e7t.cdl (CYGBLD_BUILD_REDBOOT_BIN): cygtclsh80 on @@ -115,27 +124,36 @@ 2001-03-16 Jesper Skov +}; +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/e7t/current/src/e7t_misc.c b/packages/hal/arm/e7t/current/src/e7t_misc.c --- a/packages/hal/arm/e7t/current/src/e7t_misc.c +++ b/packages/hal/arm/e7t/current/src/e7t_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for ARM E7T // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/e7t/current/src/flash_cksum.tcl b/packages/hal/arm/e7t/current/src/flash_cksum.tcl --- a/packages/hal/arm/e7t/current/src/flash_cksum.tcl +++ b/packages/hal/arm/e7t/current/src/flash_cksum.tcl @@ -16,29 +16,38 @@ # Compute the checksum for a AEB-1 flash module # #=============================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### #=============================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/hal/arm/e7t/current/src/hal_diag.c b/packages/hal/arm/e7t/current/src/hal_diag.c --- a/packages/hal/arm/e7t/current/src/hal_diag.c +++ b/packages/hal/arm/e7t/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/e7t/current/src/redboot_module.c b/packages/hal/arm/e7t/current/src/redboot_module.c --- a/packages/hal/arm/e7t/current/src/redboot_module.c +++ b/packages/hal/arm/e7t/current/src/redboot_module.c @@ -5,29 +5,38 @@ // ARM E7T board RedBoot module wrapper // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/ebsa285/current/ChangeLog b/packages/hal/arm/ebsa285/current/ChangeLog --- a/packages/hal/arm/ebsa285/current/ChangeLog +++ b/packages/hal/arm/ebsa285/current/ChangeLog @@ -1,3 +1,44 @@ +2002-05-14 Jesper Skov + + * src/ebsa285_misc.c: Fixed warning. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_ebsa285.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-04-29 Jonathan Larmour + + * src/mem285.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-26 Nick Garnett + + * misc/redboot_ROMRAM.ecm: Brought up to date with RAM and ROM ecm + files. + +2002-04-24 Jesper Skov + + * cdl/hal_arm_ebsa285.cdl: CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES + defined. + +2002-04-03 Gary Thomas + + * misc/redboot_ROM.ecm: + * misc/redboot_RAM.ecm: Update for new RedBoot support, using generic + network drivers. + +2002-03-05 Jesper Skov + + * misc/redboot_ROM.ecm: Added dns+zlib packages. + * misc/redboot_RAM.ecm: Same. + +2002-01-28 Jesper Skov + + * cdl/hal_arm_ebsa285.cdl: Removed explicit plf_io.h declaration. + 2001-11-02 Andrew Lunn 2001-11-02 Jonathan Larmour @@ -755,27 +796,36 @@ 1999-07-14 Hugo Tyson " puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " - puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_IO_H " puts $::cdl_header "#define HAL_PLATFORM_CPU \"StrongARM 110\"" puts $::cdl_header "#define HAL_PLATFORM_BOARD \"EBSA-285\"" puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" puts $::cdl_header "#define HAL_ARCH_PROGRAM_NEW_STACK ebsa285_program_new_stack" + + puts $::cdl_header "#define CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES 1000000" } cdl_component CYG_HAL_STARTUP { @@ -157,7 +167,7 @@ cdl_package CYGPKG_HAL_ARM_EBSA285 { active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE flavor data legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 - default_value 0 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT description " The EBSA285 board has only one serial port. This option chooses which port will be used for diagnostic output." diff --git a/packages/hal/arm/ebsa285/current/include/hal_cache.h b/packages/hal/arm/ebsa285/current/include/hal_cache.h --- a/packages/hal/arm/ebsa285/current/include/hal_cache.h +++ b/packages/hal/arm/ebsa285/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/ebsa285/current/include/hal_diag.h b/packages/hal/arm/ebsa285/current/include/hal_diag.h --- a/packages/hal/arm/ebsa285/current/include/hal_diag.h +++ b/packages/hal/arm/ebsa285/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/ebsa285/current/include/hal_ebsa285.h b/packages/hal/arm/ebsa285/current/include/hal_ebsa285.h --- a/packages/hal/arm/ebsa285/current/include/hal_ebsa285.h +++ b/packages/hal/arm/ebsa285/current/include/hal_ebsa285.h @@ -9,29 +9,38 @@ // and ARM memory control in general. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/ebsa285/current/include/hal_platform_ints.h b/packages/hal/arm/ebsa285/current/include/hal_platform_ints.h --- a/packages/hal/arm/ebsa285/current/include/hal_platform_ints.h +++ b/packages/hal/arm/ebsa285/current/include/hal_platform_ints.h @@ -7,29 +7,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/ebsa285/current/include/hal_platform_setup.h b/packages/hal/arm/ebsa285/current/include/hal_platform_setup.h --- a/packages/hal/arm/ebsa285/current/include/hal_platform_setup.h +++ b/packages/hal/arm/ebsa285/current/include/hal_platform_setup.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/ebsa285/current/include/plf_io.h b/packages/hal/arm/ebsa285/current/include/plf_io.h --- a/packages/hal/arm/ebsa285/current/include/plf_io.h +++ b/packages/hal/arm/ebsa285/current/include/plf_io.h @@ -8,29 +8,38 @@ // Platform specific IO support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/ebsa285/current/include/plf_stub.h b/packages/hal/arm/ebsa285/current/include/plf_stub.h --- a/packages/hal/arm/ebsa285/current/include/plf_stub.h +++ b/packages/hal/arm/ebsa285/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/ebsa285/current/misc/redboot_RAM.ecm b/packages/hal/arm/ebsa285/current/misc/redboot_RAM.ecm --- a/packages/hal/arm/ebsa285/current/misc/redboot_RAM.ecm +++ b/packages/hal/arm/ebsa285/current/misc/redboot_RAM.ecm @@ -15,26 +15,32 @@ cdl_configuration eCos { package -hardware CYGPKG_HAL_ARM_EBSA285 current ; package -hardware CYGPKG_IO_PCI current ; package -hardware CYGPKG_DEVS_ETH_ARM_EBSA285 current ; + package -hardware CYGPKG_DEVS_ETH_INTEL_I82559 current ; package -hardware CYGPKG_IO_SERIAL_ARM_EBSA285 current ; package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285 current ; package -hardware CYGPKG_DEVS_FLASH_EBSA285 current ; package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_FLASH current ; package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; }; cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; -cdl_option CYGDBG_DEVS_ETH_ARM_EBSA285_CHATTER { - user_value 0 +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 }; -cdl_option CYGNUM_DEVS_ETH_ARM_EBSA285_DEV_COUNT { - user_value 1 +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 }; cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { @@ -69,7 +75,36 @@ cdl_component CYGBLD_BUILD_REDBOOT { user_value 1 }; -cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { - inferred_value 1 +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 }; +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/ebsa285/current/misc/redboot_ROM.ecm b/packages/hal/arm/ebsa285/current/misc/redboot_ROM.ecm --- a/packages/hal/arm/ebsa285/current/misc/redboot_ROM.ecm +++ b/packages/hal/arm/ebsa285/current/misc/redboot_ROM.ecm @@ -15,26 +15,32 @@ cdl_configuration eCos { package -hardware CYGPKG_HAL_ARM_EBSA285 current ; package -hardware CYGPKG_IO_PCI current ; package -hardware CYGPKG_DEVS_ETH_ARM_EBSA285 current ; + package -hardware CYGPKG_DEVS_ETH_INTEL_I82559 current ; package -hardware CYGPKG_IO_SERIAL_ARM_EBSA285 current ; package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285 current ; package -hardware CYGPKG_DEVS_FLASH_EBSA285 current ; package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_FLASH current ; package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; }; cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; -cdl_option CYGDBG_DEVS_ETH_ARM_EBSA285_CHATTER { - user_value 0 +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 }; -cdl_option CYGNUM_DEVS_ETH_ARM_EBSA285_DEV_COUNT { - user_value 1 +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 }; cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { @@ -58,7 +64,7 @@ cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SU }; cdl_option CYGSEM_HAL_ROM_MONITOR { - user_value 1 + inferred_value 1 }; cdl_option CYGSEM_HAL_USE_ROM_MONITOR { @@ -73,7 +79,36 @@ cdl_component CYGBLD_BUILD_REDBOOT { user_value 1 }; -cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { - inferred_value 1 +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 }; +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/ebsa285/current/misc/redboot_ROMRAM.ecm b/packages/hal/arm/ebsa285/current/misc/redboot_ROMRAM.ecm --- a/packages/hal/arm/ebsa285/current/misc/redboot_ROMRAM.ecm +++ b/packages/hal/arm/ebsa285/current/misc/redboot_ROMRAM.ecm @@ -11,30 +11,36 @@ cdl_configuration eCos { description "" ; hardware ebsa285 ; template redboot ; - package -hardware CYGPKG_HAL_ARM v1_5_2 ; - package -hardware CYGPKG_HAL_ARM_EBSA285 v1_5_2 ; - package -hardware CYGPKG_IO_PCI v1_5_2 ; - package -hardware CYGPKG_DEVS_ETH_ARM_EBSA285 v1_5_2 ; - package -hardware CYGPKG_IO_SERIAL_ARM_EBSA285 v1_5_2 ; - package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285 v1_5_2 ; - package -hardware CYGPKG_DEVS_FLASH_EBSA285 v1_5_2 ; - package -template CYGPKG_HAL v1_5_2 ; - package -template CYGPKG_INFRA v1_5_2 ; - package -template CYGPKG_REDBOOT v1_5_2 ; - package CYGPKG_IO_FLASH v1_5_2 ; - package CYGPKG_IO_ETH_DRIVERS v1_5_2 ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_EBSA285 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_ARM_EBSA285 current ; + package -hardware CYGPKG_DEVS_ETH_INTEL_I82559 current ; + package -hardware CYGPKG_IO_SERIAL_ARM_EBSA285 current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285 current ; + package -hardware CYGPKG_DEVS_FLASH_EBSA285 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; }; cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; -cdl_option CYGDBG_DEVS_ETH_ARM_EBSA285_CHATTER { - user_value 0 +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 }; -cdl_option CYGNUM_DEVS_ETH_ARM_EBSA285_DEV_COUNT { - user_value 1 +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 }; cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { @@ -58,7 +64,7 @@ cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SU }; cdl_option CYGSEM_HAL_ROM_MONITOR { - user_value 1 + inferred_value 1 }; cdl_option CYGSEM_HAL_USE_ROM_MONITOR { @@ -73,7 +79,36 @@ cdl_component CYGBLD_BUILD_REDBOOT { user_value 1 }; -cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { - inferred_value 1 +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 }; +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/ebsa285/current/src/ebsa285_misc.c b/packages/hal/arm/ebsa285/current/src/ebsa285_misc.c --- a/packages/hal/arm/ebsa285/current/src/ebsa285_misc.c +++ b/packages/hal/arm/ebsa285/current/src/ebsa285_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for StrongARM EBSA285-1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -60,6 +69,8 @@ #include // diag_printf +externC void* memset( void *, int, size_t ); + /* * Toggle LED for debugging purposes. */ diff --git a/packages/hal/arm/ebsa285/current/src/hal_diag.c b/packages/hal/arm/ebsa285/current/src/hal_diag.c --- a/packages/hal/arm/ebsa285/current/src/hal_diag.c +++ b/packages/hal/arm/ebsa285/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/ebsa285/current/src/mem285.S b/packages/hal/arm/ebsa285/current/src/mem285.S --- a/packages/hal/arm/ebsa285/current/src/mem285.S +++ b/packages/hal/arm/ebsa285/current/src/mem285.S @@ -5,29 +5,38 @@ // # StrongARM EBSA-285 memory setup // # // #======================================================================== -// ####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -// ####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // #======================================================================== // ######DESCRIPTIONBEGIN#### // # @@ -45,7 +54,7 @@ // # // #======================================================================== - .file "mem285.S" +// .file "mem285.S" .title "SDRAM Init for Intel(R) SA-110 21285 Companion Chip" #include diff --git a/packages/hal/arm/ebsa285/current/src/redboot_cmds.c b/packages/hal/arm/ebsa285/current/src/redboot_cmds.c --- a/packages/hal/arm/ebsa285/current/src/redboot_cmds.c +++ b/packages/hal/arm/ebsa285/current/src/redboot_cmds.c @@ -5,29 +5,38 @@ // EBSA-285 [platform] specific RedBoot commands // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/ebsa285/current/support/linux/safl_util/safl.c b/packages/hal/arm/ebsa285/current/support/linux/safl_util/safl.c --- a/packages/hal/arm/ebsa285/current/support/linux/safl_util/safl.c +++ b/packages/hal/arm/ebsa285/current/support/linux/safl_util/safl.c @@ -5,29 +5,38 @@ // # Linux driver for Intel(R) StrongARM(R) PCI-based coprocessor boards. // # // #======================================================================== -// ####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -// ####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // #======================================================================== // ######DESCRIPTIONBEGIN#### // # diff --git a/packages/hal/arm/ebsa285/current/tests/sdram0.cxx b/packages/hal/arm/ebsa285/current/tests/sdram0.cxx --- a/packages/hal/arm/ebsa285/current/tests/sdram0.cxx +++ b/packages/hal/arm/ebsa285/current/tests/sdram0.cxx @@ -5,29 +5,38 @@ // SDRAM function test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/ChangeLog b/packages/hal/arm/edb7xxx/current/ChangeLog --- a/packages/hal/arm/edb7xxx/current/ChangeLog +++ b/packages/hal/arm/edb7xxx/current/ChangeLog @@ -1,18 +1,191 @@ +2002-05-07 Gary Thomas + + * cdl/hal_arm_edb7xxx.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-04-29 Jonathan Larmour + + * misc/i2s_audio_fiq.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-03-21 Jonathan Larmour + + * misc/edb7312_redboot_RAM.ecm: memalloc package no longer required. + * misc/edb7312_redboot_ROM.ecm: Ditto. + * misc/edb7312_redboot_ROMRAM.ecm: Ditto. + +2002-03-21 Hugo Tyson + + * include/hal_edb7xxx.h: Include the package config file too; some + versions need to be told their clock setup to select + initialization constants in this file. It remains + assembler-clean, no problem. + +2002-03-05 Jesper Skov + + * misc/edb7312_redboot_RAM.ecm: Added memalloc package. + * misc/edb7312_redboot_ROM.ecm: Same. + +2002-03-04 Hugo Tyson + + * include/hal_platform_setup.h (IO_LA_END): Set IO_LA_END (IO + logical address space end) higher so that we can readback the + value of the PLL Multiplier at 0x8000a5a8 - just for debugging. + + * src/edb7xxx_misc.c (hal_hardware_init): Add more nops after + setting PLL Multiplier for 90MHz. + + * cdl/hal_arm_edb7xxx.cdl: Change default timer tick rate for + faster version. + +2002-03-01 Hugo Tyson + + * cdl/hal_arm_edb7xxx.cdl: Add 90317 to legal_values for + CYGHWR_HAL_ARM_EDB7XXX_PROCESSOR_CLOCK. + + * include/hal_edb7xxx.h (EP7312_PLL_MR): Define additional + register and contents for 90Mhz operation. Redefine baud rate + calculator for 90Mhz operation. + + * src/edb7xxx_misc.c (hal_hardware_init): If the CPU clock speed + is 90317, set the PLL multiplier register to gear-up 22.5%, and + add some waitstates to all the memory access so it still works. + +2002-02-22 Gary Thomas + + * src/lcd_support.c (idle): Only [re]enable LCD if being used + as the console device. This keeps it from coming on when there + is serial line activity [just an anoyance]. + +2002-02-01 Hugo Tyson + + * misc/edb7312_redboot_ROMRAM.ecm: + * misc/edb7312_redboot_ROM.ecm: + * misc/edb7312_redboot_RAM.ecm: CYGBLD_REDBOOT_MIN_IMAGE_SIZE set + to 0x40000 to contain the size of RedBoot. + +2002-01-28 Jonathan Larmour + + * include/hal_edb7xxx.h: Add extra useful definitions for the 7312. + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + +2002-01-22 Jonathan Larmour + + * misc/edb7312_redboot_ROM.ecm: Fix + CYGPKG_DEVS_FLASH_STRATA_EDB7XXX -> CYGPKG_DEVS_FLASH_EDB7XXX + 2001-12-06 Jonathan Larmour * misc/edb7212_redboot.ecm: * misc/edb7212_redboot_ROM.ecm: + * misc/edb7312_redboot_RAM.ecm: + * misc/edb7312_redboot_ROM.ecm: + * misc/edb7312_redboot_ROMRAM.ecm: Fix target descriptions to be edb7xxx. +2001-11-13 Gary Thomas + + * src/edb7xxx_misc.c (hal_hardware_init): Set clock speed. + +2001-11-10 Gary Thomas + + * src/edb7xxx_misc.c (hal_clock_reset): DRAM refresh not needed. + +2001-11-06 Gary Thomas + + * include/pkgconf/mlt_arm_edb7312_romram.mlt: + * include/pkgconf/mlt_arm_edb7312_romram.ldi: + * include/pkgconf/mlt_arm_edb7312_romram.h: + * include/pkgconf/mlt_arm_edb7312_ram.mlt: + * include/pkgconf/mlt_arm_edb7312_ram.ldi: + * include/pkgconf/mlt_arm_edb7312_ram.h: New ROMRAM setup. + +2001-10-14 Gary Thomas + + * misc/edb7312_redboot_ROMRAM.ecm: + * misc/edb7312_redboot_RAM.ecm: Update for new FLASH driver layout. + 2001-10-12 Jonathan Larmour * cdl/hal_arm_edb7xxx.cdl: Clarify package description strings. +2001-10-03 Gary Thomas + + * src/edb7xxx_misc.c: + * include/hal_platform_ints.h: + * include/hal_edb7xxx.h: EP7312 has slightly different peripherals. + +2001-10-03 Gary Thomas + + * src/edb7xxx_misc.c: Fix sly problem on EDB7312 only which + caused RESET vector to be destroyed. + +2001-10-03 Gary Thomas + + * misc/edb7312_redboot_ROMRAM.ecm: + * include/pkgconf/mlt_arm_edb7312_romram.mlt: + * include/pkgconf/mlt_arm_edb7312_romram.ldi: + * include/pkgconf/mlt_arm_edb7312_romram.h: New files. + + * include/pkgconf/mlt_arm_edb7312_ram.mlt: + * include/pkgconf/mlt_arm_edb7312_ram.ldi: + * include/pkgconf/mlt_arm_edb7312_ram.h: + * include/hal_platform_setup.h: + * cdl/hal_arm_edb7xxx.cdl: Add support for ROMRAM startup mode. + Currently only tested on EDB7312. + +2001-09-30 Gary Thomas + + * src/lcd_support.c: Reorg - comm init also initializes display. + Don't export the comm if no keyboard. Lots of little changes + trying to get keyboard initialization correct. Works sometimes. + + * src/edb7xxx_misc.c (hal_hardware_init): Change PS/2 timing. + Also, LCD comm channel now initializes LCD display. + + * cdl/hal_arm_edb7xxx.cdl: Change LCD defaults to landscape mode + with Red Hat logo at top. + +2001-09-29 Gary Thomas + + * cdl/hal_arm_edb7xxx.cdl: + * src/edb7xxx_misc.c (hal_hardware_init): + * include/lcd_support.h: + * src/lcd_support.c: + * src/font.h: + * src/banner.xpm: New file(s). Adding LCD/keyboard console. + 2001-09-26 Gary Thomas + + * support/io.c: + * support/download_file.c: + * support/dl_edb7xxx.c: Change around internal functions (add + some flexibility). + + * include/hal_platform_setup.h: Rewrote most of this code as + assembly macros which are easier to conditionalize. Now supports + EDB7312 as well. + + * src/edb7xxx_misc.c (hal_hardware_init): + * include/pkgconf/mlt_arm_edb7312_rom.mlt: + * include/pkgconf/mlt_arm_edb7312_rom.ldi: + * include/pkgconf/mlt_arm_edb7312_rom.h: + * include/pkgconf/mlt_arm_edb7312_ram.mlt: + * include/pkgconf/mlt_arm_edb7312_ram.ldi: + * include/pkgconf/mlt_arm_edb7312_ram.h: + * include/hal_edb7xxx.h: + * cdl/hal_arm_edb7xxx.cdl: Add support for EDB7312 platform. + 2001-07-25 Jonathan Larmour * include/pkgconf/mlt_arm_edb7211_ram.h: @@ -914,27 +1087,36 @@ 1999-05-20 Gary Thomas " : \ + CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.ldi" ) : \ + CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7209" ? + (CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.ldi" ) : \ + CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7211" ? + (CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.ldi" ) : \ + CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7212" ? + (CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.ldi" ) : \ + CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7312" ? + (CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROMRAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.ldi" ) : \ + "BOGUS.ldi" } + } else { calculated { CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "CL7111" ? (CYG_HAL_STARTUP == "RAM" ? "" : \ @@ -493,12 +611,32 @@ CL-PS7111 and EP7xxx based development b CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.ldi" ) : \ "BOGUS.ldi" } } + } cdl_option CYGHWR_MEMORY_LAYOUT_H { display "Memory layout header file" flavor data no_define define -file system.h CYGHWR_MEMORY_LAYOUT_H + if (1) { + calculated { + CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "CL7111" ? + (CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.h" ) : \ + CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7209" ? + (CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.h" ) : \ + CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7211" ? + (CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.h" ) : \ + CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7212" ? + (CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.h" ) : \ + CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7312" ? + (CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROMRAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.h" ) : \ + "BOGUS.h" } + } else { calculated { CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "CL7111" ? (CYG_HAL_STARTUP == "RAM" ? "" : \ @@ -513,6 +651,7 @@ CL-PS7111 and EP7xxx based development b CYG_HAL_STARTUP == "ROM" ? "" : "BOGUS.h" ) : \ "BOGUS.h" } } + } } cdl_option CYGSEM_HAL_ROM_MONITOR { diff --git a/packages/hal/arm/edb7xxx/current/include/hal_cache.h b/packages/hal/arm/edb7xxx/current/include/hal_cache.h --- a/packages/hal/arm/edb7xxx/current/include/hal_cache.h +++ b/packages/hal/arm/edb7xxx/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/include/hal_diag.h b/packages/hal/arm/edb7xxx/current/include/hal_diag.h --- a/packages/hal/arm/edb7xxx/current/include/hal_diag.h +++ b/packages/hal/arm/edb7xxx/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/include/hal_edb7xxx.h b/packages/hal/arm/edb7xxx/current/include/hal_edb7xxx.h --- a/packages/hal/arm/edb7xxx/current/include/hal_edb7xxx.h +++ b/packages/hal/arm/edb7xxx/current/include/hal_edb7xxx.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -49,6 +58,10 @@ // to sanitise (mangle) the names. Also, care should be taken to keep this // clean for use in assembly code (no "C" constructs). +// Comment above notwithstanding, this is needed for the clock UART_DIVISOR +// selection below. +#include + #define PADR 0x80000000 // Port A data register #define PBDR 0x80000001 // Port B data register #define PDDR 0x80000003 // Port D data register @@ -107,6 +120,19 @@ #define SYSCON3_CLKCTL(n) (n<<1) // Processor block speed ((n+1)*18.432)MHz #if defined(__EDB7209) #define SYSCON3_I2SSEL (1<<3) // Enable i2s instead of ssi#2 +#define SYSCON3_FASTWAKE (1<<8) // Determines wakeup in relationship + // to the 4 kHZ or 8 Hz clock +#define SYSCON3_DAIEN (1<<9) // Enables the DAI +#endif +#if defined(__EDB7312) || defined(__EDB7209) +#define SYSCON3_ADCCKNSEN (1<<4) // Determines on which edge ADC + // data is transmitted and read + // in relationship to ADCCLK +#if defined(__EDB7312) +#define SYSCON3_DAISEL (1<<3) // Enable DAI instead of SSI +#define SYSCON3_128FS (1<<9) // Select DAI frame size +#define SYSCON3_ENPD67 (1<<10) // Configures Port D bits 6 and 7 +#endif #endif #define SYSFLG1 0x80000140 // System flags #1 @@ -135,6 +161,11 @@ #define SYSFLG2 0x80001140 // System flags #2 +#ifdef __EDB7312 +#define SDCONF 0x80002300 // SDRAM configuration +#define SDRFOR 0x80002340 // SDRAM refresh +#endif + #define INTSR1 0x80000240 // Interrupt status register #1 #define INTSR1_EXTFIQ (1<<0) // External fast interrupt #define INTSR1_BLINT (1<<1) // Battery low interrupt @@ -169,6 +200,9 @@ #if defined(__EDB7209) #define INTSR3_I2SINT (1<<0) // I2S interface interrupt #endif +#if defined(__EDB7312) +#define INTSR3_DAIINT (1<<0) // DAI interface interrupt +#endif #define INTMR3 0x80002280 // Interrupt mask #3 #define UARTDR1 0x80000480 // UART #1 data register @@ -188,6 +222,11 @@ #define UBLCR_WRDLEN8 (3<<17) #define UART_DIVISOR 230400 #define UART_BITRATE(baud) ((UART_DIVISOR/(baud))-1) +#if 90317 == CYGHWR_HAL_ARM_EDB7XXX_PROCESSOR_CLOCK +#undef UART_DIVISOR +// The speed enhancement is 22.5% +#define UART_DIVISOR (230400 * 1225/1000) +#endif #define MEMCFG1 0x80000180 // Memory configuration register #1 #define MEMCFG2 0x800001C0 // Memory configuration register #2 @@ -255,7 +294,10 @@ #define MCSR 0x80002100 // MCP status register #endif -#if defined(__EDB7209) +#if defined(__EDB7209) || \ +defined(__EDB7312) || \ +1 + #define I2S_CTL 0x80002000 // I2S (Audio interface) control #define I2S_CTL_FLAG 0x0404 // Magic #define I2S_CTL_EN (1<<16) // Enable interface @@ -264,7 +306,9 @@ #define I2S_CTL_LCRM (1<<20) // Left channel receive interrupt #define I2S_CTL_RCTM (1<<21) // Right channel transmit interrupt #define I2S_CTL_RCRM (1<<22) // Right channel receive interrupt +#if defined(__EDB7209) #define I2S_CTL_LBM (1<<23) // Loop-back mode +#endif #define I2S_RIGHT_FIFO 0x80002040 // Right channel FIFO access #define I2S_LEFT_FIFO 0x80002080 // Left channel FIFO access #define I2S_FIFO_CTL 0x800020C0 // FIFO control @@ -288,6 +332,68 @@ #define I2S_STAT_FIFO (1<<12) // A FIFO operation has completed #endif +#ifdef __EDB7312 +// If DAI_ headers wishes to be used instead (for consistency) +#define DAI_CTL I2S_CTL +#define DAI_CTL_FLAG I2S_CTL_FLAG +#define DAI_CTL_EN I2S_CTL_EN +#define DAI_CTL_ECS I2S_CTL_ECS +#define DAI_CTL_LCTM I2S_CTL_LCTM +#define DAI_CTL_LCRM I2S_CTL_LCRM +#define DAI_CTL_RCTM I2S_CTL_RCTM +#define DAI_CTL_RCRM I2S_CTL_RCRM + +#define DAI_RIGHT_FIFO I2S_RIGHT_FIFO +#define DAI_LEFT_FIFO I2S_LEFT_FIFO + +#define DAI_FIFO_CTL I2S_FIFO_CTL +#define DAI_FIFO_CTL_RIGHT_ENABLE I2S_FIFO_CTL_RIGHT_ENABLE +#define DAI_FIFO_CTL_RIGHT_DISABLE I2S_FIFO_CTL_RIGHT_DISABLE +#define DAI_FIFO_CTL_LEFT_ENABLE I2S_FIFO_CTL_LEFT_ENABLE +#define DAI_FIFO_CTL_LEFT_DISABLE I2S_FIFO_CTL_LEFT_DISABLE + +#define DAI_STAT I2S_STAT +#define DAI_STAT_RCTSR I2S_STAT_RCTSR +#define DAI_STAT_RCRSR I2S_STAT_RCRSR +#define DAI_STAT_LCTSR I2S_STAT_LCTSR +#define DAI_STAT_LCRSR I2S_STAT_LCRSR +#define DAI_STAT_RCTUR I2S_STAT_RCTUR +#define DAI_STAT_RCROR I2S_STAT_RCROR +#define DAI_STAT_LCTUR I2S_STAT_LCTUR +#define DAI_STAT_LCROR I2S_STAT_LCROR +#define DAI_STAT_RCTNF I2S_STAT_RCTNF +#define DAI_STAT_RCRNE I2S_STAT_RCRNE +#define DAI_STAT_LCTNF I2S_STAT_LCTNF +#define DAI_STAT_LCRNE I2S_STAT_LCRNE +#define DAI_STAT_FIFO I2S_STAT_FIFO + +// Additional 7312 register +#define DAI_MODE 0x80002600 // I2S mode control register +#define DAI_MODE_I2SF64 (1<<0) // Frame size +#define DAI_MODE_CLKEN (1<<1) // Enable audio clock generator +#define DAI_MODE_CLKSRC (1<<2) // Select audio clock source +#define DAI_MODE_MCLK (1<<3) // Enables MCLK (BUZ) (256 frame size) +#define DAI_MODE_LBM (1<<5) // Loopback mode + +#define DAI_MODE_AUDDIV_MASK 0x7F00 // Mask for the frequency divisor + // for the sample frequency and + // bit clock + +#define SYSCON3_I2SSEL SYSCON3_DAISEL // Backward compatiblity + // for sample i2s_audio_fiq.s + +#define INTSR3_I2SINT INTSR3_DAIINT // Backward compatiblity + // for sample i2s_audio_fiq.s + + +// Further additional 7312 register for special 90MHz variant: +// PLL_Multiplier_Register 0x80002610 - the location of the PLL multiplier register +// Value_For_90_MHz_Operation 0x31000000 +#define EP7312_PLL_MR 0x80002610 +#define EP7312_PLL_MR_FOR_90MHz 0x31000000 + +#endif + #define LEDFLSH 0x800022C0 // LED flash control #define LEDFLSH_ENABLE (1<<6) // LED enabled #define LEDFLSH_DUTY(n) ((n-1)<<2) // LED on ratio diff --git a/packages/hal/arm/edb7xxx/current/include/hal_platform_extras.h b/packages/hal/arm/edb7xxx/current/include/hal_platform_extras.h --- a/packages/hal/arm/edb7xxx/current/include/hal_platform_extras.h +++ b/packages/hal/arm/edb7xxx/current/include/hal_platform_extras.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/include/hal_platform_ints.h b/packages/hal/arm/edb7xxx/current/include/hal_platform_ints.h --- a/packages/hal/arm/edb7xxx/current/include/hal_platform_ints.h +++ b/packages/hal/arm/edb7xxx/current/include/hal_platform_ints.h @@ -7,29 +7,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -75,6 +84,9 @@ #if defined(__EDB7209) #define CYGNUM_HAL_INTERRUPT_I2SINT 22 #endif +#if defined(__EDB7312) +#define CYGNUM_HAL_INTERRUPT_DAIINT 22 +#endif #define CYGNUM_HAL_ISR_MIN 0 #if defined(__CL7111) diff --git a/packages/hal/arm/edb7xxx/current/include/hal_platform_setup.h b/packages/hal/arm/edb7xxx/current/include/hal_platform_setup.h --- a/packages/hal/arm/edb7xxx/current/include/hal_platform_setup.h +++ b/packages/hal/arm/edb7xxx/current/include/hal_platform_setup.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -111,7 +120,7 @@ #endif #define SRAM_PA 0x60000000 #define IO_LA_START 0x80000000 -#define IO_LA_END 0x80003000 +#define IO_LA_END 0x8000f000 #define IO_PA 0x80000000 @@ -253,6 +262,27 @@ 15: mcr MMU_CP,0,r1,MMU_TLB,c7,0 /* .endm #endif // CYG_HAL_STARTUP_RAM +#ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7312 + .macro INIT_MEMORY_CONFIG + mov r0,#(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SUPERVISOR_MODE) + msr cpsr,r0 + ldr r10,=UARTDR1 + ldr r11,=SYSFLG1 + ldr r12,=SYSFLG1_UTXFF1 + ldr r1,=SDCONF + ldr r2,=0x00000522 + str r2,[r1] + ldr r1,=SDRFOR + ldr r2,=0x00000240 + str r2,[r1] + ldr r1,=MEMCFG1 + ldr r2,=0x1F101710 + str r2,[r1] + ldr r1,=MEMCFG2 + ldr r2,=0x00001F13 + str r2,[r1] + .endm +#else #if CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7209 // No DRAM controller .macro INIT_MEMORY_CONFIG @@ -278,6 +308,7 @@ 15: mcr MMU_CP,0,r1,MMU_TLB,c7,0 /* strb r2,[r1] .endm #endif +#endif #if defined(CYGSEM_HAL_STATIC_MMU_TABLES) #define PLATFORM_SETUP1 \ @@ -374,6 +405,8 @@ 20: // The 16M EDB72xx boards are arranged as: // 0xC0000000..0xC07FFFFF // 0xC1000000..0xC17FFFFF +// The 16M EDB7312 board is arranged as: +// 0xC0000000..0xC0FFFFFF .macro MAP_DRAM /* Map DRAM */ ldr r3,=DRAM_LA_START @@ -385,10 +418,15 @@ 10: mov r6,r2 /* Set up page table desc orr r6,r6,r7 str r6,[r1],#4 /* Store PTE, update pointer */ ldr r8,=MMU_SECTION_SIZE/MMU_PAGE_SIZE +#if !defined(__EDB7312) +// EDB7312 has contiguous SDRAM ldr r9,=DRAM_PA_START+0x00800000 /* Skip at 8M boundary */ 12: cmp r5,r9 bne 15f ldr r5,=DRAM_PA_START+0x01000000 /* Next chunk of DRAM */ +#else +12: +#endif 15: mov r6,r5 /* Build page table entry */ ldr r7,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable orr r6,r6,r7 diff --git a/packages/hal/arm/edb7xxx/current/include/lcd_support.h b/packages/hal/arm/edb7xxx/current/include/lcd_support.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/lcd_support.h @@ -0,0 +1,74 @@ +#ifndef _LCD_SUPPORT_H_ +#define _LCD_SUPPORT_H_ +//========================================================================== +// +// lcd_support.h +// +// Cirrus Logic EDB7XXX - LCD support routines +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-09-29 +// Description: Simple LCD support +//####DESCRIPTIONEND#### + +struct lcd_info { + short height, width; // Pixels + short bpp; // Depth (bits/pixel) + short type; + short rlen; // Length of one raster line in bytes + void *fb; // Frame buffer +}; + +// Frame buffer types +#define FB_TRUE_RGB565 0x01 + +// Exported functions +void lcd_init(int depth); +void lcd_clear(void); +void lcd_moveto(int X, int Y); +void lcd_putc(cyg_int8 c); +int lcd_printf(char const *fmt, ...); +void lcd_setbg(int red, int green, int blue); +void lcd_setfg(int red, int green, int blue); +void lcd_comm_init(void); +int lcd_getinfo(struct lcd_info *info); +void lcd_on(bool enable); + +#endif // _LCD_SUPPORT_H_ diff --git a/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_ram.h b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_ram.h @@ -0,0 +1,20 @@ +// eCos memory layout - Fri Oct 20 05:43:59 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0xfd0000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_sram (0x60000000) +#define CYGMEM_REGION_sram_SIZE (0x9c00) +#define CYGMEM_REGION_sram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xfd0000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_ram.ldi b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_ram.ldi @@ -0,0 +1,29 @@ +// eCos memory layout - Fri Oct 20 05:43:59 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0xfd0000 + sram : ORIGIN = 0x60000000, LENGTH = 0x9c00 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x40000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTION_sram (sram, 0x60000000, LMA_EQ_VMA) + SECTIONS_END +} diff --git a/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_ram.mlt b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_ram.mlt @@ -0,0 +1,15 @@ +version 0 +region ram 0 fd0000 0 ! +region sram 60000000 9c00 0 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section rom_vectors 0 1 0 1 1 1 1 1 40000 40000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section sram 0 1 0 1 1 0 1 0 60000000 60000000 ! diff --git a/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_rom.h b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_rom.h @@ -0,0 +1,23 @@ +// eCos memory layout - Fri Oct 20 05:42:50 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0xfd7000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_sram (0x60000000) +#define CYGMEM_REGION_sram_SIZE (0x9c00) +#define CYGMEM_REGION_sram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0xe0000000) +#define CYGMEM_REGION_rom_SIZE (0x800000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xfd7000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_rom.ldi b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_rom.ldi @@ -0,0 +1,31 @@ +// eCos memory layout - Fri Oct 20 05:42:50 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0xfd7000 + sram : ORIGIN = 0x60000000, LENGTH = 0x9c00 + rom : ORIGIN = 0xe0000000, LENGTH = 0x800000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0xe0000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_mmu_tables (rom, ALIGN (0x4000), LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_data (ram, 0x1000, FOLLOWING (.mmu_tables)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTION_sram (sram, 0x60000000, LMA_EQ_VMA) + SECTIONS_END +} diff --git a/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_rom.mlt b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_rom.mlt @@ -0,0 +1,17 @@ +version 0 +region ram 0 fd7000 0 ! +region sram 60000000 9c00 0 ! +region rom e0000000 800000 1 !This is ROM bank 0, physical address 0x00000000.When running eCos, this space is remapped to 0xE0000000. +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section data 0 1 1 1 1 1 0 0 1000 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section sram 0 1 0 1 1 0 1 0 60000000 60000000 ! +section rom_vectors 0 1 0 1 1 1 1 1 e0000000 e0000000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 mmu_tables mmu_tables ! +section mmu_tables 0 4000 0 1 0 0 0 1 data ! diff --git a/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_romram.h b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_romram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_romram.h @@ -0,0 +1,20 @@ +// eCos memory layout - Fri Oct 20 05:43:59 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0xfd0000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_sram (0x60000000) +#define CYGMEM_REGION_sram_SIZE (0x9c00) +#define CYGMEM_REGION_sram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xfd0000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_romram.ldi b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_romram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_romram.ldi @@ -0,0 +1,29 @@ +// eCos memory layout - Fri Oct 20 05:43:59 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0xfd0000 + sram : ORIGIN = 0x60000000, LENGTH = 0x9c00 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x1000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTION_sram (sram, 0x60000000, LMA_EQ_VMA) + SECTIONS_END +} diff --git a/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_romram.mlt b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_romram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/pkgconf/mlt_arm_edb7312_romram.mlt @@ -0,0 +1,15 @@ +version 0 +region ram 0 fd0000 0 ! +region sram 60000000 9c00 0 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section rom_vectors 0 1 0 1 1 1 1 1 1000 1000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section sram 0 1 0 1 1 0 1 0 60000000 60000000 ! diff --git a/packages/hal/arm/edb7xxx/current/include/plf_io.h b/packages/hal/arm/edb7xxx/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/include/plf_io.h @@ -0,0 +1,60 @@ +#ifndef CYGONCE_HAL_ARM_EDB7XXX_PLF_IO_H +#define CYGONCE_HAL_ARM_EDB7XXX_PLF_IO_H + +/*============================================================================= +// +// plf_io.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#endif // CYGONCE_HAL_ARM_EDB7XXX_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/edb7xxx/current/include/plf_stub.h b/packages/hal/arm/edb7xxx/current/include/plf_stub.h --- a/packages/hal/arm/edb7xxx/current/include/plf_stub.h +++ b/packages/hal/arm/edb7xxx/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/misc/edb7312_redboot_RAM.ecm b/packages/hal/arm/edb7xxx/current/misc/edb7312_redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/misc/edb7312_redboot_RAM.ecm @@ -0,0 +1,107 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware edb7xxx ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_EDB7XXX current ; + package -hardware CYGPKG_DEVS_ETH_ARM_EDB7XXX current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -hardware CYGPKG_IO_SERIAL_ARM_EDB7XXX current ; + package -hardware CYGPKG_DEVS_FLASH_EDB7XXX current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGHWR_HAL_ARM_EDB7XXX_VARIANT { + user_value EP7312 +}; + +cdl_option CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT { + user_value EDB7312 +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00040000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/edb7xxx/current/misc/edb7312_redboot_ROM.ecm b/packages/hal/arm/edb7xxx/current/misc/edb7312_redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/misc/edb7312_redboot_ROM.ecm @@ -0,0 +1,97 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware edb7xxx ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_EDB7XXX current ; + package -hardware CYGPKG_DEVS_ETH_ARM_EDB7XXX current ; + package -hardware CYGPKG_IO_SERIAL_ARM_EDB7XXX current ; + package -hardware CYGPKG_DEVS_FLASH_EDB7XXX current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGHWR_HAL_ARM_EDB7XXX_VARIANT { + user_value EP7312 +}; + +cdl_option CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT { + user_value EDB7312 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00040000 +}; diff --git a/packages/hal/arm/edb7xxx/current/misc/edb7312_redboot_ROMRAM.ecm b/packages/hal/arm/edb7xxx/current/misc/edb7312_redboot_ROMRAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/misc/edb7312_redboot_ROMRAM.ecm @@ -0,0 +1,108 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware edb7xxx ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_EDB7XXX current ; + package -hardware CYGPKG_DEVS_ETH_ARM_EDB7XXX current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -hardware CYGPKG_IO_SERIAL_ARM_EDB7XXX current ; + package -hardware CYGPKG_DEVS_FLASH_EDB7XXX current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGHWR_HAL_ARM_EDB7XXX_VARIANT { + user_value EP7312 +}; + +cdl_option CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT { + user_value EDB7312 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROMRAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00040000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/edb7xxx/current/misc/i2s_audio_fiq.S b/packages/hal/arm/edb7xxx/current/misc/i2s_audio_fiq.S --- a/packages/hal/arm/edb7xxx/current/misc/i2s_audio_fiq.S +++ b/packages/hal/arm/edb7xxx/current/misc/i2s_audio_fiq.S @@ -5,29 +5,38 @@ // # FIQ handler for EB7209 audio stream // # // #======================================================================== -// ####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -// ####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // #======================================================================== // ######DESCRIPTIONBEGIN#### // # @@ -43,7 +52,7 @@ #include - .file "i2s_audio_FIQ.S" +// .file "i2s_audio_FIQ.S" .extern cur_buf .extern next_buf diff --git a/packages/hal/arm/edb7xxx/current/misc/i2s_audio_test.c b/packages/hal/arm/edb7xxx/current/misc/i2s_audio_test.c --- a/packages/hal/arm/edb7xxx/current/misc/i2s_audio_test.c +++ b/packages/hal/arm/edb7xxx/current/misc/i2s_audio_test.c @@ -5,29 +5,38 @@ // Cirrus CL7209 eval board CS4340 audio test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/misc/kbd_support.c b/packages/hal/arm/edb7xxx/current/misc/kbd_support.c --- a/packages/hal/arm/edb7xxx/current/misc/kbd_support.c +++ b/packages/hal/arm/edb7xxx/current/misc/kbd_support.c @@ -5,29 +5,38 @@ // Cirrus Logic EDB7xxx eval board ASCII keyboard support functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/misc/kbd_test.c b/packages/hal/arm/edb7xxx/current/misc/kbd_test.c --- a/packages/hal/arm/edb7xxx/current/misc/kbd_test.c +++ b/packages/hal/arm/edb7xxx/current/misc/kbd_test.c @@ -5,29 +5,38 @@ // Cirrus Logic EDB7xxx eval board ASCII keyboard test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/misc/lcd_panel_support.c b/packages/hal/arm/edb7xxx/current/misc/lcd_panel_support.c --- a/packages/hal/arm/edb7xxx/current/misc/lcd_panel_support.c +++ b/packages/hal/arm/edb7xxx/current/misc/lcd_panel_support.c @@ -5,29 +5,38 @@ // Cirrus Logic EDB7xxx eval board LCD touch panel support code // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/misc/lcd_support.c b/packages/hal/arm/edb7xxx/current/misc/lcd_support.c --- a/packages/hal/arm/edb7xxx/current/misc/lcd_support.c +++ b/packages/hal/arm/edb7xxx/current/misc/lcd_support.c @@ -5,29 +5,38 @@ // Cirrus EDB7xxx eval board LCD support code // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/misc/lcd_test.c b/packages/hal/arm/edb7xxx/current/misc/lcd_test.c --- a/packages/hal/arm/edb7xxx/current/misc/lcd_test.c +++ b/packages/hal/arm/edb7xxx/current/misc/lcd_test.c @@ -5,29 +5,38 @@ // Cirrus EDB7XXX eval board LCD test code // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/misc/panel_test.c b/packages/hal/arm/edb7xxx/current/misc/panel_test.c --- a/packages/hal/arm/edb7xxx/current/misc/panel_test.c +++ b/packages/hal/arm/edb7xxx/current/misc/panel_test.c @@ -5,29 +5,38 @@ // Cirrus Logic EDB7xxx eval board LCD touch panel test code // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/misc/prog_flash.c b/packages/hal/arm/edb7xxx/current/misc/prog_flash.c --- a/packages/hal/arm/edb7xxx/current/misc/prog_flash.c +++ b/packages/hal/arm/edb7xxx/current/misc/prog_flash.c @@ -5,29 +5,38 @@ // Cirrus CL7211 eval board FLASH program tool // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/src/banner.xpm b/packages/hal/arm/edb7xxx/current/src/banner.xpm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/src/banner.xpm @@ -0,0 +1,182 @@ +#ifdef CYGSEM_EDB7XXX_LCD_COMM_PORTRAIT_MODE +/* XPM */ +static char * banner_xpm[] = { +"240 39 65 1", +" c None", +". c #020206", +"+ c #FAFAFA", +"@ c #E61606", +"# c #C2C0C1", +"$ c #EAE5E7", +"% c #BB0F06", +"& c #949394", +"* c #F1B8C0", +"= c #6C686A", +"- c #710206", +"; c #F3A19B", +"> c #404043", +", c #B9B7B8", +"' c #EC8F9A", +") c #353536", +"! c #EA6C6F", +"~ c #29282B", +"{ c #E85A5C", +"] c #E27A7A", +"^ c #300507", +"/ c #1D1C1D", +"( c #626262", +"_ c #E74844", +": c #141415", +"< c #E2554D", +"[ c #C6C6C6", +"} c #5B595C", +"| c #E6342D", +"1 c #9B9B9B", +"2 c #7C0806", +"3 c #060606", +"4 c #737072", +"5 c #C20E06", +"6 c #DEDEDE", +"7 c #E23734", +"8 c #EEEAEA", +"9 c #F4C0C3", +"0 c #820807", +"a c #505050", +"b c #FEFEFA", +"c c #CA1206", +"d c #A7A6A7", +"e c #7F7E7F", +"f c #E62419", +"g c #950E07", +"h c #F6C6CA", +"i c #550206", +"j c #0F0E0F", +"k c #CE1206", +"l c #F4F2F1", +"m c #1C0206", +"n c #CBCACB", +"o c #4B4A4B", +"p c #E2322E", +"q c #A90B06", +"r c #888888", +"s c #B0B0B0", +"t c #EEAFB6", +"u c #F8D4D4", +"v c #FAE1E3", +"w c #DB1506", +"x c #D3D2D2", +"y c #430306", +"z c #DF9D9B", +"................................................................................................................................................................................................................................................", +".................................................................................................................................bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...", +".................................................................................................................................bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...", +"333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...", +"..........3/~~~~~//3.............................................................................................................+++++++++++++++++++++++866xxxxxxxxxxxxxxxxxxxxxxxxxx$++++uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuvvb++++++++++++++...", +"......../a&d,##sn,d&a/...........................................................................................................bbbbbbbbbbbbbbbbbbbbb8d4~/3........................3ebbbb@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@pp,1~.3m^^mj^^^^.33~1s)...................................................j33.................................................+++++++++++++++++bs/..........:::..................3e+bbb@w@@@@@@@@@ff@@@@@@@@@@@@@@@@@@@@@@@@@@f'l+++++++b+...", +"...o#4j..mqg5g0qi^^im..j4,~................................................~}eo~.................................................bbbbbbbbbbbbbbbbb8~3.......jorsds&(:.............:>>dbbbb@@@@@@@@@{';tt;3j~3............................................bbbbbbbbbbbbbbbbbr...3.3.3),8+bbb+l6=3........3:rx8$lb+bb@@@w@wf_9l+bbbb89{fw@w@w@|'$l++lvu!f@@@@@!+bbbbb+b+...", +"3:11:3...q-i025kqqq%q..33:&&:333333333333333333333333333333333333333333333.:dbb8)j4#)33333333333333333333333:33333333333333333333bbbbbbbbbbbbbbbb8)..3.3.:=$bbbbbbb++l&:3333333}6bbbbb+b+b@@@@@@!vbbbb++bbbb!f@@@@ftb+bbb+b+'f@@@@@@vbbbbbbbb...", +".a[:..3..cy.j^2kcq@cqy..3.~#o.............................................3~d++$).eba....................../4/3..................+++++++++++++++b,/3.....}$+++++b+bbbblr.....3axbbbbbbbbbb@w@@@{8b++bbbbbbbbl]f@@@{lb++bbbbv_w@@@@@@;++++b+b+...", +"/d4...3..wg22k0@wwwwwg.3.3.4&:..................3..3.......3............333/db+xa.4+(:.3..........3j:3...3.&x(j..................bbbbbbbbbbbbbbbb1j.....36bbblda~)ex+bbl)....3$b++bl*''t$b@@@@7ub+bbu'''u+b++l_@@f'bbbv!_{;'@@w@@@@@!bbbbbbbb...", +"od~.yyqqmqqw@5wk5qkq@0m....~s>...............3)~)/:oo~j.j:)a>o~.......j~oo))dbb$)jel}/:>>~j....3:/))))33.~~s6a~//................bbbbbbbbbbbbbbbb&3.3.33rbbb6>.3.33/s+bbsj..3rbbb+v!w@w@pt@@@f'bbbb;f@@@@'8bbbt@w@hbbbtf@@wf@@@@w@@@!bbb+b+b+...", +"e&j^%w%@-mi-qk5wk@wk5cy....jre333333333333333~d#d>=x6r::)e,666#a:333:/r[6x#4sbb6)3e+a>r#n,=/33:34&,n[&)::e&6ld1&o3333333333333333bbbbbbbbbbbbbb+be33.3.:nbb+e///////}bbb6)33/n+bb8!f@@@@@fw@@p*+bb*f@w@@@f'lbbbf@@u+bb$z7f@@@@@@@@@@!bbbbbbbb...", +"s(.^ww55k33mm^-wqwq@kc--y...=d.............33)8b6d6++d/)dlb+++b6}..3~,lbbbb$6bb$)34+enlxnl$e~.j>$8xn6l,)3#$ll8$l=................+++++++++++++b+be....3o6+bb6xxnxxxx6+bbb4..>$bbbhf@@w@@@@@@@_lb+8<@@@@@@@_ubb+_@@;+bb++v*!@@@@@@@w@{b+b+b+b+...", +"6>3m-qwwqk-^m..0www5q%%w%g3.)[...............>8++8+b+&/,bb8,d6+b8o3/,bbb866bb+b$)jrl$,>33~nla..)r~3.jel&:j:d$o/~:................bbbbbbbbbbbbbbbbe.....}8bbbbb+b+b++bb+blr..(8++b'w@@@w@@@@@@xbbd:(lbb$(>o,b+b$).eb#~.333(8s...3....:un~..s6a.3.................bbbbbbbbbbbbbbbbe333.3}8b++666x666xx6x6x43.}8b+b'@@@@@@@@w@@{bbb*p@w@@@@@@hbbb]@@@!*bbb+b+bu|@@@@@@{b+b+b+b+...", +"[/3.3mq@kwqkwc5%qkk%kq5wwwg3/x)3333333333333.)8bbl(/j3[b+,~/3:1bb8:1bb84.3.>xb+6o34le.....~xx/3..3/j:j,8)33d$}j.33333333333333333bbbbbbbbbbbb+bbbe33...a8+b+o~))~~)))))))/..}8bbbz@@@@@@@@@@@6+b,/3..~db+$)3e8}.3.33/,l..3en8$6n86)..s$o...................bbbbbbbbbbbbbb+b&3....:sbbb6}3.3..)r&&re/..:sbb++zf@@@@f!@@@ftbb+v_@@@@@7hbbbv@@@f_7@@@|u++bz@@@@@@!bbbbbbbb...", +"x)..../dl(myg@kq@kk5qw5q0m.3)x.............3.)$bb&:..~bb+ll8blll88o6bbs/.3.~dbb$)3r+}...../,6..(lxe))),8).3d8}...................bbbbbbbbbbbbbb++&:.3...>++b+6&):/en++b+r33..>bb+b+h_fw_'$@@@@!vbb+u'p@|!ubbbb]@@@~x++6).../,bl$)3ela....3~[6j>xn>33..s8)..d6o3333333333333333333bbbbbbbbbb+bbbbbs:..3..31++bb+l8l+bbbbn3....3rlbbbb+ll+bb@@@@ftbbb+l+lllb+b+t|@@f*+++llb+b+l_@@@@@@;bbbbbbbb...", +"&r}s#x=/ebb+=~~/>~))~:3.33.3ee...............)$+b1/333nbbx).:33:..:dbb843j:o6bb6)3eb}...../#6j=8&...j3#8)..s6o...................+++++++++b++bbbb6)..3333/s++bbbbbb++bx>....3./&lbb+bb++bb@@@w@fh+bb++bb+b+b97@w@_bb++bbbbbl'f@w@@@whb+b+b+b+...", +"axx++b81&bb+8n#[xnxxn:.3..3/d>...........3..3)$bb&:..3=bbl,4a>a4e/.=8bb8e}e#bbb$)34+}.33..~#$3=l1:333/l$>..d$}3..................bbbbbbbbbbbb+bbbb=.......~1b+bb+b+bb,>j3.33.../(6+b+bbbbb@@@@@@7;lbbb+bbb+*_@@@@p'8bb++b++'p@@@@@@|bbbbbbbbb...", +"~#bbbbb+++bbbbb6r&xb[....33=s/...........3.33)8bb1j3../s+bb+l8ll8)./,bbb+ll+l+b$)3e+}...3./,$.o6n>/))dl8)33&le):3................bbbbbbbbbbbb++bbb6j..333..jas68886n4:..3..3..333/a&dnb+b+@@@@@w@f_*v8v88h!f@@@@@@@|!thuu'7@@@@@@@@9bb+b+b+b+...", +".(8b+bb+b+b+b++n=}6+&.:~>~),a.3333333333..3.3)8b+&j...3~dl+++bbblo33)xlbb+bxs8b$).ela..3..~#l..el61s6618)3.)$xd,a3333333333333333bbbbbbbb+bbbbb+b++e:.......3.~}((~:..3.....33...3...rbb+b@@w@@@@@@@|_<_7@@w@@@@@@@@@@@@@@@@@@@w@f!v+bbbbbbbb...", +"3/dbb+bbbbbbbb+bl8bx)je#xxnd:...............3~d,,(..3.33~(sn6xxs4/333)e#6xs>od#d~.as).....:e1.3/en6x,a~,~..3=n$6}................+++++++b++bbbbbbbb843..3.....3...3...........3...3..ebbbb@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@{vb+b+b+b+b+...", +".3~8+bbbb+b+bbbbbb8()#8bbb8:...........3....33:::3.3.....j:////:33....3////33:::333:j3.....::...j///j3j/3.333///j................bbbbbbbbbb+bbb+bbbb8&:3..33........3.3.33...3...3...ebbbb@@@@@@@@@@@@@@@@@@@@@@@@@w@@@@@@@@@@@f{lbbbbbbbbbbb...", +".33a$b+bbbbbbb++bb#}xbbbb6>............3.33.333333...3....3.33.3..3........3.....33...3.33..3....3.3...33........................bbbbbbbbbb++bbbb++bbb#(>:33....3.3...3..3....3...3.3eb++b@@w@@@@@@@@@@@@@@w@@@@@@@@@w@@@@@wf|!*l+bb+b+b+b+b+...", +".3.j}6b+b+b++bbbbb68bbbbnoj.3333333333..3.......3...3..3...........3333......333.....3.3...3.....33.....3..33.3.33333333333333333bbbbbb+bbbbb+b++bbb++bl6dd&1&1&1&&&1&&&&&11&&&11&&1&n+bbb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;t*lbbb+bbbbbbbbbb...", +"....3>xlbbbb+bb++b+b++l[)33..................3....3..3..3....3.33......3...3.....33......3..333.....3.3..3..3....................+++++b++bbbbbbbbb+bbbb+b+bbb+bbbbb+bbbbb++bbb+bbb+bbbbbb+bbbb+b+b++bbb++++++++++++bbbbbbbb+b+b+bb+b+b+b+b+b+...", +".3...3:exlbbbbbbb+bblne:33...........3....33.....3.....3..3...3.......3.33.....33..3...........3...3.3..3.....3..................bbbbbbbb+bbb+bbbbbbbbbbbb+bbbb+b+bbb+bb+bbbb+bbb+bbbbbb+bbb+bbbb+bb+bbbbbbbb++b+bbbb++bbbbbbbbbbbbbbbbbbbbbb...", +".3.3.33.)=s6++bbbb6d4~33.............3.33..3.333...3....3.33....3........3..........3.33..3......3....3..........................bbbbbbbb++bbbb++bbb++b+bbbbbbbbb+b+b++bbb+bbb+bbb++b++bbbbbbbbbbbbb+bbbbbbbbbbbbb+bbbb+bbbbbbb+bb+b+b+b+b+b+...", +".................................................................................................................................bbbb+bbbbb+b++bbb++bbbbbbb+b+b+bbbbbbbbbbb+bbb+bbbb+bbbbb+b+b+bbb+bb+++b+b+bbbb+bb+bb+b+bb+b+bb+bbbbbbbbbbbb...", +".................................................................................................................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...", +"................................................................................................................................................................................................................................................"}; +#else +/* XPM */ +static char * banner_xpm[] = { +"320 54 17 1", +" c None", +". c #030305", +"+ c #949394", +"@ c #CFC9CD", +"# c #525052", +"$ c #B7B6B8", +"% c #E2515E", +"& c #FDFDFB", +"* c #737073", +"= c #820204", +"- c #E33533", +"; c #343232", +"> c #E895AE", +", c #E51604", +"' c #E67284", +") c #EABAD4", +"! c #D8D7D9", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"..............*+@&&&&&&$+*..................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+#;;...................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--%>&&&&&&&&&&&&&&&&&&&&&&&&", +"...........#$&&@+*##;#++@&&$#...............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&&&&", +".........#$&$*...........;#!&$;.............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&+..........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,>&&&&&&&&&&&&&&&&&&&&", +"........+&$#................#$&+............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&", +"......;!&*....................*&@...........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&#............................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&", +".....;!@;.....====;.=====......;!@;....................................................................;.;..................................................................&&&&&&&&&&&&&&&&&&&&&&&&+...............;;;;..........................&&&&&&,,,,,,,,,,,,,,,---,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,>&&&&&&&&&&&&&&&&&", +"....;&@......,,=,,=,,=...==......!!.................................................................;#!$*#..................................................................&&&&&&&&&&&&&&&&&&&&&&&!.............#+&&&&&&@*...................;***&&&&&&,,,,,,,,,,,,')&&&&&&>-,,,,,,,,,,,,,,%>!&&)>'-,,,,,,,,,,&&&&&&&&&&&&&&&&&", +"....@@;.....=,,,,,,=,,=..=,.......!!.................................................................#&&&&+;...;............................................................&&&&&&&&&&&&&&&&&&&&&&&#...........;@&&&&&&&&&&&+...............*&&&&&&&&&&&,,,,,,,,,,'&&&&&&&&&&&)-,,,,,,,,,,-)&&&&&&&&&)-,,,,,,,,'&&&&&&&&&&&&&&&&", +"...$&;......====,=,,,====,==......;!+................................................................#&&&&@..;>+;...........................................................&&&&&&&&&&&&&&&&&&&&&&&...........*&&&&&&&&&&&&&&$............#&&&&&&&&&&&&&,,,,,,,,,)&&&&&&&&&&&&&&%,,,,,,,,-&&&&&&&&&&&&%,,,,,,,,,&&&&&&&&&&&&&&&&", +"..#&;.......,=.....=,,,,,,,,.......*&#...............................................................#&&&&@...&&*...............................;...........................&&&&&&&&&&&&&&&&&&&&&&+..........+&&&&&&&&&&&&&&&&@..........#&&&&&&&&&&&&&&,,,,,,,,)&&&&&&&&&&&&&&&&',,,,,,,)&&&&&&&&&&&!,,,,,,,,,,>&&&&&&&&&&&&&&&", +"..!$........,=...;==,=,=,=,==.......$$..............................................................;#&&&&@...&&*..............................#$*..........................&&&&&&&&&&&&&&&&&&&&&&#.........#&&&&&&&&&&&&&&&&&&$........#&&&&&&&&&&&&&&&,,,,,,,)&&&&&&&&&&&&&&&&&&%,,,,,%&&&&&&&&&&&&-,,,,,,,,,,'&&&&&&&&&&&&&&&", +".*&;........,,===,,=,,,,,,,,,.......;&#..............................................................#&&&&$;..!&*;...................;.........!&+;.........................&&&&&&&&&&&&&&&&&&&&&&;.........&&&&&&&*;...#$&&&&&&#.......&&&&&&&&!'''>!&&,,,,,,'&&&&&&&)'''>&&&&&&&&,,,,,'&&&&&)-,,%)),,,,,,,,,,,-&&&&&&&&&&&&&&&", +".@+.....===.,=,,,,=,,=,=,=,,=........$$.......................;.;.;.;.;......;.;.;..............;.;.;#&&&&@..;!&*.;.;.;..........;.;.;.;....;.;!&+.;.;......................&&&&&&&&&&&&&&&&&&&&&&;........+&&&&&@........#&&&&&!......+&&&&&&&',,,,,,'&,,,,,,&&&&&&&-,,,,,,>&&&&&&',,,,)&&&&&%,,,,,-,,,,,,,,,,,-&&&&&&&&&&&&&&&", +";&#..=,,,,,..=,=,,,,,,,,,=,,,=.......#&;.....................#***;.;+$$#;..;.#+$$@+*..........#+$$$*.#&&&&@...!&*.;;*++#;.......;.#*++*;.;..;;;!&+;;;;......................&&&&&&&&&&&&&&&&&&&&&&.........&&&&&!..........+&&&&&#.....&&&&&&&-,,,,,,,,%,,,,,%&&&&&&-,,,,,,,,'&&&&&&,,,,)&&&&&>,,,,,,,,,,,,,,,,,-&&&&&&&&&&&&&&&", +"*&...,=,=,,=...===,=,=,,,,,=,=........!*.....................!&&&*;@&&&*..;#@&&&&&&&$;.....;.$&&&&&&!*&&&&@..;&&*.$!&&&&$#....;.+!&&&&&!*..;$!&&&&!&&!......................&&&&&&&&&&&&&&&&&&&&&&........#&&&&&*;;;;;;;;;;#&&&&&+....#&&&&&&',,,,,,,,,,,,,,,>&&&&&%,,,,,,,,,,)&&&&&-,,,)&&&&&&!'-,,,,,,,,,,,,,,-&&&&&&&&&&&&&&&", +"$$...,,,,=,,.......=,,=,=,,,,====.....@$.....................!&&&+!&&&&+;.*!&&&&&&&&&!.....;!&&&&&&&&!&&&&@...!&*!&&!$!&&&;;...*&&!@$@!&&*..$&!&&!&!&!......................&&&&&&&&&&&&&&&&&&&&&&........+&&&&&&&&&&&&&&&&&&&&&&&....+&&&&&&,,,,,,,,,,,,,,,,&&&&&!,,,,,,,,,,,%&&&&&',,,'&&&&&&&&&)',,,,,,,,,,,,-&&&&&&&&&&&&&&&", +"&+...==,,,,=,=......=,,,,=,=,=,,=,....*!.....................!&&&!&&&&&*.#&&&&&!!&&&&&@....!&&&&&&&&&&&&&&@..;!&!&$;...#!&!....#@*....;@&&...;.!&+.;;;......................&&&&&&&&&&&&&&&&&&&&&&........$&&&&&&&&&&&&&&&&&&&&&&&....$&&&&&),,,,,,,,,,,,,,,,&&&&&',,,,,,,,,,,,&&&&&',,,-&&&&&&&&&&&&-,,,,,,,,,,-&&&&&&&&&&&&&&&", +"&#....==,=,,,,,==....,=,,,,,=,=,,,,...#&.....................!&&&&&&&!&*.@&&&&*;.;@&&&&#;.+&&&&&@+*+&&&&&&@...&&&+......*&&*............!&+....!&+..........................&&&&&&&&&&&&&&&&&&&&&&........$&&&&&&&&&&&&&&&&&&&&&&&....$&&&&&),,,,,,,,,,,,,,,-&&&&&',,,,,,,,,,,,&&&&&),,,,%&&&&&&&&&&&&-,,,,,,,,,-&&&&&&&&&&&&&&&", +"&;.....=,,,=,=,,,===.=,,=,,,,,,,=,==..#&;....................@&&&&&@*;;.*&&&&*.....&&&&$..&&&&&$....#&&&&&@...&&!........@&$...........;)&$....&&+..........................&&&&&&&&&&&&&&&&&&&&&&........$&&&&&$$$$$$$$$$$$$$$$$$....$&&&&&),,,,,,,,,,,,,,,,&&&&&',,,,,,,,,,,,&&&&&>,,,,,->&&&&&&&&&&&,,,,,,,,,-&&&&&&&&&&&&&&&", +"&;......=,,,,,=,,,,,,,=,,,=,=,=,,,,=..;&#....................!&&&&!.....@&&&!;.;.;.$&&&&.#&&&&!;.....+&&&&$;..!&+........+&@;......;.;..+&!....!&+;.........................&&&&&&&&&&&&&&&&&&&&&&........+&&&&&;.....................$&&&&&!,,,,,,,,,,,,,,,,&&&&&),,,,,,,,,,,-&&&&&',,,,,,,,%>&&&&&&&&-,,,,,,,,-&&&&&&&&&&&&&&&", +"&;........==,,,,=,=,=,,,=,,,,,,,=,,...#&;....................!&&&&*.....!&&&!+$+$$+@&&&&.+&&&&$......#&&&&@..;&&*........+&!.....;.;*+$$@&@....!&+..........................&&&&&&&&&&&&&&&&&&&&&&........*&&&&&+................;....*&&&&&&-,,,,,,,,,,,,,,,)&&&&&-,,,,,,,,,,>&&&&&%,,,,,,,,,,,'&&&&&&',,,,,,,,-&&&&&&&&&&&&&&&", +"&#.........==,=,,,,,,=,,,=,=,=,,=,=...#&;....................@&&&&#....;&&&&&&&&&&&&&&&&;$&&&&+......#&&&&@...!&*........*&&....;*@&&&&&&&!....!&+..........................&&&&&&&&&&&&&&&&&&&&&&........;&&&&&&;.........;;;;;;;....;&&&&&&!,,,,,,,,,-,,,,,'&&&&&),,,,,,,,,-&&&&&&,,,,,,,,,,,,,>&&&&&',,,,,,,,-&&&&&&&&&&&&&&&", +"&;.......;&@.==,=,,=,,,=,,,,,,,,,=....#&.....................!&&&!;....#&&&&&&&&&&&&&&&&.@&&&&#.....;#&&&&@..;!&*........*&!....$&&!!$++@&@....&&+..........................&&&&&&&&&&&&&&&&&&&&&&;........$&&&&&&;.......@&&&&&&;.....$&&&&&&),,,,,,,-!,,,,,-&&&&&&>,,,,,,,-&&&&&&>,,,,,')-,,,,,>&&&&&',,,,,,,,-&&&&&&&&&&&&&&&", +"&*.......*&&$...=,,,=,,,,=,=,=,==.....*&.....................@&&&&;....;&&&&&!&!&&!&&!&!;$&&&&*......#&&&&@...&&*........*&!...$&&+;....+&!....!&$..........................&&&&&&&&&&&&&&&&&&&&&&;........;&&&&&&&$#;.;+&&&&&&&+......;&&&&&&&&'-,,%>&&,,,,,,>&&&&&&&'-,-%>&&&&&&&-,,,,-&&&'-,,'&&&&&&-,,,,,,,,-&&&&&&&&&&&&&&&", +"@+.......;&&&@&;...==,=,,,,,,==.......+$.....................!&&&&;.....&&&&$..########;.$&&&&$......*&&&&@..;!&*........+&!.;#&&*......+&!....!&+..........................&&&&&&&&&&&&&&&&&&&&&&#.........+&&&&&&&&&&&&&&&&&&!........*&&&&&&&&&&&&&&&,,,,,,-&&&&&&&&&&&&&&&&&&&',,,,,>&&&&&&&&&&&&&&,,,,,,,,,'&&&&&&&&&&&&&&&", +"+!.#*++$;.;&&&&&;.....................!*.....................@&&&&;;....!&&&&............*&&&&!......+&&&&@...&&*........*&!..$&!.......+&!....!&+..........................&&&&&&&&&&&&&&&&&&&&&&+..........@&&&&&&&&&&&&&&&&&;.........+&&&&&&&&&&&&&&,,,,,,,-&&&&&&&&&&&&&&&&&),,,,,-&&&&&&&&&&&&&&',,,,,,,,,>&&&&&&&&&&&&&&&", +"#&#+&&&&&;.;&&&&!+;##*+#*+#*;........;&;.....................!&&&&;.....+&&&&)..;.;.;.....&&&&&$.;.;#&&&&&@...&&*........+&!.;)&$.....;.@&@....&&+..........................&&&&&&&&&&&&&&&&&&&&&&&...........@&&&&&&&&&&&&&&&;...........+&&&&&&&&&&&&&,,,,,,,,%&&&&&&&&&&&&&&&),,,,,,'&&&&&&&&&&&&&>,,,,,,,,,,&&&&&&&&&&&&&&&&", +".!&&&&&&&&$@&&&&&&&&&&&&&&&&.........+@......................@&&&&;......&&&&&!+*##*+!+...$&&&&&)+*$!&&&&&@...!&*........*&!..@&);.....;&&!....!&+;.........................&&&&&&&&&&&&&&&&&&&&&&&#...........+&&&&&&&&&&&&$;.............;$&&&&&&&&&&&,,,,,,,,,-)&&&&&&&&&&&&',,,,,,,,-)&&&&&&&&&&',,,,,,,,,,%&&&&&&&&&&&&&&&&", +".+&&&&&&&&&&&&&&&&&&&*$+@&&$........;&*......................!&&&&;......*&&&&&&&&&&&&!...;&&&&&&&&&&&&&&&@...&&*........*&!..+&&;;.;.;!&&!....@&@.;........................&&&&&&&&&&&&&&&&&&&&&&&!............;+&&&&&&&&@#.................;*$$$&&&&&&,,,,,,,,,,,%)&&&&&&&&>-,,,,,,,,,,,-')!&&&)',,,,,,,,,,,,&&&&&&&&&&&&&&&&&", +"..&&&&&&&&&&&&&&&&&&!;..$&&+........+!.......................!&&&&;.......+&&&&&&&&&&&&....*&&&&&&&&&!@&&&!...&&*........+&&...!&&+#*+&&$&!....*&&+*+*......................&&&&&&&&&&&&&&&&&&&&&&&&*..............#++++#;........................&&&&&&,,,,,,,,,,,,,-%''''%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&", +"..*&&&&&&&&&&&&&&&&&&&!!&&&;..**+*+*&#.......................!&&&!;........*!&&&&&&&&&@;....*!&&&&&&!;$&&&@...!&*........*&!...#!&&&&&&+.&!.....$&&&&!......................&&&&&&&&&&&&&&&&&&&&&&&&&#............................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%&&&&&&&&&&&&&&&&&&", +"...$&&&&&&&&&&&&&&&&&&&&&&*..;&&&&&&$........................*++++...........*+$@@$$+#........*$@@$*..#+++*...*+;........;+*....;+@!@$#..++......+@!!+......................&&&&&&&&&&&&&&&&&&&&&&&&&&;...........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%&&&&&&&&&&&&&&&&&&&", +"...;&&&&&&&&&&&&&&&&&&&&&$.;@&&&&&&&........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&*..........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&&", +"....;&&&&&&&&&&&&&&&&&&&&;.&&&&&&&&;........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&@;........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%!&&&&&&&&&&&&&&&&&&&&&", +".....*&&&&&&&&&&&&&&&&&&$+&&&&&&&&;.........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&!+;;....................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--'!&&&&&&&&&&&&&&&&&&&&&&&", +"......;&&&&&&&&&&&&&&&&&&&&&&&&&!;..........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".......;@&&&&&&&&&&&&&&&&&&&&&&$;...........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".........*&&&&&&&&&&&&&&&&&&&&*.............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"...........+!&&&&&&&&&&&&&&!*...............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".............#+@&&&&&&&&!+;.................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".................;####;.....................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"................................................................................................................................................................................................................................................................................................................................"}; +#endif diff --git a/packages/hal/arm/edb7xxx/current/src/edb7xxx_misc.c b/packages/hal/arm/edb7xxx/current/src/edb7xxx_misc.c --- a/packages/hal/arm/edb7xxx/current/src/edb7xxx_misc.c +++ b/packages/hal/arm/edb7xxx/current/src/edb7xxx_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for ARM EDB7XXX-1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -73,8 +82,11 @@ static cyg_handle_t batlow_interrupt_ha #define CPU_CLOCK 2 #elif (CYGHWR_HAL_ARM_EDB7XXX_PROCESSOR_CLOCK == 73728) #define CPU_CLOCK 3 +#elif (CYGHWR_HAL_ARM_EDB7XXX_PROCESSOR_CLOCK == 90317) +#define CPU_CLOCK 3 // Yes, the same +#define CPU_CLOCK_90MHZ #else -#err Invalid CPU clock frequency +#error Invalid CPU clock frequency #endif static cyg_uint32 _period; @@ -130,6 +142,7 @@ void hal_clock_reset(cyg_uint32 vector, *tc2d = period; _period = period; } +#if !defined(__EDB7312) #ifndef CYGPKG_HAL_ARM_EDB7209 // EP7209 has no DRAM/controller, thus no problem enable_FIQ(); // Should be safe here @@ -139,6 +152,7 @@ void hal_clock_reset(cyg_uint32 vector, dram_delay_loop(); #endif #endif +#endif // !defined(__EDB7312) } // Read the current value of the clock, returning the number of hardware "ticks" @@ -217,6 +231,9 @@ static cyg_uint32 hal_interrupt_bitmap[] #if defined(__EDB7209) INTSR3_I2SINT // CYGNUM_HAL_INTERRUPT_I2SINT 22 #endif +#if defined(__EDB7312) + INTSR3_DAIINT // CYGNUM_HAL_INTERRUPT_DAIINT 22 +#endif }; static cyg_uint32 hal_interrupt_mask_regmap[] = { @@ -248,6 +265,9 @@ static cyg_uint32 hal_interrupt_mask_reg #if defined(__EDB7209) INTMR3, // CYGNUM_HAL_INTERRUPT_I2SINT 22 #endif +#if defined(__EDB7312) + INTMR3, // CYGNUM_HAL_INTERRUPT_DAIINT 22 +#endif }; static cyg_uint32 hal_interrupt_clear_map[] = { @@ -279,6 +299,9 @@ static cyg_uint32 hal_interrupt_clear_ma #if defined(__EDB7209) 0, // CYGNUM_HAL_INTERRUPT_I2SINT 22 #endif +#if defined(__EDB7312) + 0, // CYGNUM_HAL_INTERRUPT_DAIINT 22 +#endif }; static struct regmap { @@ -292,6 +315,9 @@ static struct regmap { #if defined(__EDB7209) { CYGNUM_HAL_INTERRUPT_I2SINT, CYGNUM_HAL_INTERRUPT_I2SINT, INTSR3, INTMR3}, #endif +#if defined(__EDB7312) + { CYGNUM_HAL_INTERRUPT_DAIINT, CYGNUM_HAL_INTERRUPT_DAIINT, INTSR3, INTMR3}, +#endif { CYGNUM_HAL_INTERRUPT_CSINT, CYGNUM_HAL_INTERRUPT_SSEOTI, INTSR1, INTMR1}, { CYGNUM_HAL_INTERRUPT_KBDINT, CYGNUM_HAL_INTERRUPT_URXINT2, INTSR2, INTMR2}, { 0, 0, 0, 0 } @@ -329,6 +355,8 @@ void hal_hardware_init(void) *(volatile cyg_uint32 *)INTMR2 = 0; #if !defined(__CL7111) *(volatile cyg_uint32 *)INTMR3 = 0; +#endif +#if !defined(__CL7111) && !defined(__EDB7312) *(volatile cyg_uint8 *)SYSCON3 = SYSCON3_CLKCTL(CPU_CLOCK); #endif @@ -400,13 +428,49 @@ void hal_hardware_init(void) *(volatile cyg_uint32 *)SYSCON2 = SYSCON2_KBWEN; #endif +#if defined(__EDB7312) + *(volatile cyg_uint32 *)MEMCFG1 = 0x1F101710; + *(volatile cyg_uint32 *)MEMCFG2 = 0x00001F93; + // Set up GPIO lines + *(volatile cyg_uint8 *)PADDR = 0x00; // Keyboard data 0-7 input + *(volatile cyg_uint8 *)PBDDR = 0xF2; + *(volatile cyg_uint8 *)PDDDR = 0x2F; + *(volatile cyg_uint8 *)PDDDR = 0x10; // Directions are inverted! + *(volatile cyg_uint8 *)PDDR = 0x00; // Everything off + *(volatile cyg_uint8 *)PEDDR = 0x01; + // Initialize system control + *(volatile cyg_uint32 *)SYSCON1 = 0x00040100; + *(volatile cyg_uint32 *)SYSCON2 = 0x00000102; + +#ifdef CPU_CLOCK_90MHZ + // We must slow down the RAM timings compared to default by adding + // wait states or it does not work. + // Slow them all down to Random=5, Seq=3 waitstates by replacing + // that field throughout the default value copied from above: + *(volatile cyg_uint32 *)MEMCFG1 = (0x1F101710 & ~0x3c3c3c3c) | 0x0c0c0c0c; + *(volatile cyg_uint32 *)MEMCFG2 = (0x00001F93 & ~0x00003c3c) | 0x00000c0c; +#endif // CPU_CLOCK_90MHZ + + *(volatile cyg_uint32 *)SYSCON3 = 0x00000208 | SYSCON3_CLKCTL(CPU_CLOCK); + +#ifdef CPU_CLOCK_90MHZ + // Let the clock change settle before hitting the PLL multiplier + // register to change up by a further 22.5% + asm volatile( "nop;nop;nop;nop;nop;nop;nop;nop;"); + *(volatile cyg_uint32 *)EP7312_PLL_MR = EP7312_PLL_MR_FOR_90MHz; + asm volatile( "nop;nop;nop;nop;nop;nop;nop;nop;"); +#endif // CPU_CLOCK_90MHZ + +#endif // Reset all interrupt masks (disable all interrupt sources) for (vector = CYGNUM_HAL_ISR_MIN; vector < CYGNUM_HAL_ISR_COUNT; vector++) { icr = (volatile cyg_uint32 *)hal_interrupt_clear_map[vector]; if (icr) *icr = 0; // Just a write clears the latch } +#ifndef __EDB7312 // Turn on the DIAG LED to let the world know the board is alive *(volatile unsigned char *)LEDFLSH = LEDFLSH_ENABLE|LEDFLSH_DUTY(16)|LEDFLSH_PERIOD(1); +#endif #ifdef CYGHWR_HAL_ARM_EDB7XXX_BATLOW cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_BLINT, 99, // Priority - what goes here? @@ -425,6 +489,10 @@ void hal_hardware_init(void) // Set up eCos/ROM interfaces hal_if_init(); +#ifdef CYGSEM_EDB7XXX_LCD_COMM + // Initialize I/O channel + lcd_comm_init(); +#endif } // diff --git a/packages/hal/arm/edb7xxx/current/src/font.h b/packages/hal/arm/edb7xxx/current/src/font.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/src/font.h @@ -0,0 +1,160 @@ +//========================================================================== +// +// font.h +// +// LCD display font +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-02-25 +// Description: Simple LCD font +//####DESCRIPTIONEND#### + +#ifndef _LCD_FONT_H_ +#define _LCD_FONT_H_ + +// 8x8 Font - from Helios + +#define FIRST_CHAR 0x20 +#define LAST_CHAR 0x7F +#define FONT_HEIGHT 8 +#define FONT_WIDTH 8 +#define CURSOR_ON 0x7F +#define CURSOR_OFF 0x20 +static char font_table[LAST_CHAR-FIRST_CHAR+1][8] = +{ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */ + { 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00 }, /* ! */ + { 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* " */ + { 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00 }, /* # */ + { 0x30, 0xFC, 0x16, 0x7C, 0xD0, 0x7E, 0x18, 0x00 }, /* $ */ + { 0x06, 0x66, 0x30, 0x18, 0x0C, 0x66, 0x60, 0x00 }, /* % */ + { 0x1C, 0x36, 0x36, 0x1C, 0xB6, 0x66, 0xDC, 0x00 }, /* & */ + { 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ' */ + { 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00 }, /* ( */ + { 0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00 }, /* ) */ + { 0x00, 0x18, 0x7E, 0x3C, 0x7E, 0x18, 0x00, 0x00 }, /* * */ + { 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00 }, /* + */ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x0C }, /* , */ + { 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00 }, /* - */ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 }, /* . */ + { 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00 }, /* / */ + { 0x3C, 0x66, 0x76, 0x7E, 0x6E, 0x66, 0x3C, 0x00 }, /* 0 */ + { 0x18, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00 }, /* 1 */ + { 0x3C, 0x66, 0x60, 0x30, 0x18, 0x0C, 0x7E, 0x00 }, /* 2 */ + { 0x3C, 0x66, 0x60, 0x38, 0x60, 0x66, 0x3C, 0x00 }, /* 3 */ + { 0x30, 0x38, 0x3C, 0x36, 0x7E, 0x30, 0x30, 0x00 }, /* 4 */ + { 0x7E, 0x06, 0x3E, 0x60, 0x60, 0x66, 0x3C, 0x00 }, /* 5 */ + { 0x38, 0x0C, 0x06, 0x3E, 0x66, 0x66, 0x3C, 0x00 }, /* 6 */ + { 0x7E, 0x60, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00 }, /* 7 */ + { 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00 }, /* 8 */ + { 0x3C, 0x66, 0x66, 0x7C, 0x60, 0x30, 0x1C, 0x00 }, /* 9 */ + { 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00 }, /* : */ + { 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x0C }, /* ; */ + { 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x00 }, /* < */ + { 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00 }, /* = */ + { 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x00 }, /* > */ + { 0x3C, 0x66, 0x30, 0x18, 0x18, 0x00, 0x18, 0x00 }, /* ? */ + { 0x3C, 0x66, 0x76, 0x56, 0x76, 0x06, 0x3C, 0x00 }, /* @ */ + { 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00 }, /* A */ + { 0x3E, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3E, 0x00 }, /* B */ + { 0x3C, 0x66, 0x06, 0x06, 0x06, 0x66, 0x3C, 0x00 }, /* C */ + { 0x1E, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1E, 0x00 }, /* D */ + { 0x7E, 0x06, 0x06, 0x3E, 0x06, 0x06, 0x7E, 0x00 }, /* E */ + { 0x7E, 0x06, 0x06, 0x3E, 0x06, 0x06, 0x06, 0x00 }, /* F */ + { 0x3C, 0x66, 0x06, 0x76, 0x66, 0x66, 0x3C, 0x00 }, /* G */ + { 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00 }, /* H */ + { 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00 }, /* I */ + { 0x7C, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1C, 0x00 }, /* J */ + { 0x66, 0x36, 0x1E, 0x0E, 0x1E, 0x36, 0x66, 0x00 }, /* K */ + { 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7E, 0x00 }, /* L */ + { 0xC6, 0xEE, 0xFE, 0xD6, 0xD6, 0xC6, 0xC6, 0x00 }, /* M */ + { 0x66, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x66, 0x00 }, /* N */ + { 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00 }, /* O */ + { 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x06, 0x00 }, /* P */ + { 0x3C, 0x66, 0x66, 0x66, 0x56, 0x36, 0x6C, 0x00 }, /* Q */ + { 0x3E, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x66, 0x00 }, /* R */ + { 0x3C, 0x66, 0x06, 0x3C, 0x60, 0x66, 0x3C, 0x00 }, /* S */ + { 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, /* T */ + { 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00 }, /* U */ + { 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00 }, /* V */ + { 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0xEE, 0xC6, 0x00 }, /* W */ + { 0x66, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00 }, /* X */ + { 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00 }, /* Y */ + { 0x7E, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x7E, 0x00 }, /* Z */ + { 0x3E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3E, 0x00 }, /* [ */ + { 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, 0x00 }, /* \ */ + { 0x7C, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7C, 0x00 }, /* ] */ + { 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ^ */ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF }, /* _ */ + { 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ` */ + { 0x00, 0x00, 0x3C, 0x60, 0x7C, 0x66, 0x7C, 0x00 }, /* a */ + { 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x3E, 0x00 }, /* b */ + { 0x00, 0x00, 0x3C, 0x66, 0x06, 0x66, 0x3C, 0x00 }, /* c */ + { 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x00 }, /* d */ + { 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00 }, /* e */ + { 0x38, 0x0C, 0x0C, 0x3E, 0x0C, 0x0C, 0x0C, 0x00 }, /* f */ + { 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x3C }, /* g */ + { 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x00 }, /* h */ + { 0x18, 0x00, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00 }, /* i */ + { 0x18, 0x00, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x0E }, /* j */ + { 0x06, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x00 }, /* k */ + { 0x1C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00 }, /* l */ + { 0x00, 0x00, 0x6C, 0xFE, 0xD6, 0xD6, 0xC6, 0x00 }, /* m */ + { 0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x00 }, /* n */ + { 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00 }, /* o */ + { 0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06 }, /* p */ + { 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0xE0 }, /* q */ + { 0x00, 0x00, 0x36, 0x6E, 0x06, 0x06, 0x06, 0x00 }, /* r */ + { 0x00, 0x00, 0x7C, 0x06, 0x3C, 0x60, 0x3E, 0x00 }, /* s */ + { 0x0C, 0x0C, 0x3E, 0x0C, 0x0C, 0x0C, 0x38, 0x00 }, /* t */ + { 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x00 }, /* u */ + { 0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00 }, /* v */ + { 0x00, 0x00, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00 }, /* w */ + { 0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00 }, /* x */ + { 0x00, 0x00, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x3C }, /* y */ + { 0x00, 0x00, 0x7E, 0x30, 0x18, 0x0C, 0x7E, 0x00 }, /* z */ + { 0x30, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x30, 0x00 }, /* { */ + { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, /* | */ + { 0x0C, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0C, 0x00 }, /* } */ + { 0x8C, 0xD6, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ~ */ + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } /* Block cursor */ +}; + +#endif // _LCD_FONT_H_ diff --git a/packages/hal/arm/edb7xxx/current/src/hal_diag.c b/packages/hal/arm/edb7xxx/current/src/hal_diag.c --- a/packages/hal/arm/edb7xxx/current/src/hal_diag.c +++ b/packages/hal/arm/edb7xxx/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/src/lcd_support.c b/packages/hal/arm/edb7xxx/current/src/lcd_support.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/edb7xxx/current/src/lcd_support.c @@ -0,0 +1,1381 @@ +//========================================================================== +// +// lcd_support.c +// +// Cirrus Logic EDB7XXX - LCD support routines +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-09-29 +// Description: Simple LCD support +//####DESCRIPTIONEND#### + +#include + +#include +#include // IO macros +#include // Virtual vector support +#include // Register state info +#include // HAL interrupt macros + +#include // Board definitions +#include +#include + +#ifdef CYGPKG_ISOINFRA +# include +# ifdef CYGINT_ISO_STDIO_FORMATTED_IO +# include // sscanf +# endif +#endif + +#ifndef FALSE +#define FALSE 0 +#define TRUE 1 +#endif + +#ifdef CYGOPT_EDB7XXX_LCD_COMM_LOGO +#include "banner.xpm" +#endif +#include "font.h" + +// Physical dimensions of LCD display +#define DISPLAY_WIDTH 320 +#define DISPLAY_HEIGHT 240 + +// Logical layout +#ifdef CYGSEM_EDB7XXX_LCD_COMM_PORTRAIT_MODE +#define LCD_WIDTH 240 +#define LCD_HEIGHT 320 +#else +#define LCD_WIDTH 320 +#define LCD_HEIGHT 240 +#endif +#define LCD_DEPTH 16 + +#define USE_RGB565 +#ifdef USE_RGB565 +#define RGB_RED(x) (((x)&0x1F)<<11) +#define RGB_GREEN(x) (((x)&0x3F)<<5) +#define RGB_BLUE(x) ((x)&0x1F) +#else +#define RGB_RED(x) (((x)&0x0F)<<12) +#define RGB_GREEN(x) (((x)&0x0F)<<7) +#define RGB_BLUE(x) (((x)&0x0F)<<1) +#endif + +// Physical screen info +//static int lcd_depth = LCD_DEPTH; // Should be 1, 2, or 4 +static int lcd_bpp; +static int lcd_width = LCD_WIDTH; +static int lcd_height = LCD_HEIGHT; + +// Virtual screen info +static int curX = 0; // Last used position +static int curY = 0; +//static int width = LCD_WIDTH / (FONT_WIDTH*NIBBLES_PER_PIXEL); +//static int height = LCD_HEIGHT / (FONT_HEIGHT*SCREEN_SCALE); + +static int fg = RGB_RED(15) | RGB_GREEN(63) | RGB_BLUE(8); +static int bg = RGB_RED(0) | RGB_GREEN(0) | RGB_BLUE(15/*31*/); + +#define SCREEN_PAN 20 +#define SCREEN_WIDTH 80 +#define SCREEN_HEIGHT (LCD_HEIGHT/FONT_HEIGHT) +#define VISIBLE_SCREEN_WIDTH (LCD_WIDTH/FONT_WIDTH) +#define VISIBLE_SCREEN_HEIGHT (LCD_HEIGHT/FONT_HEIGHT) +static char screen[SCREEN_HEIGHT][SCREEN_WIDTH]; +static int screen_start = 0; +static int screen_height = SCREEN_HEIGHT; +static int screen_width = SCREEN_WIDTH; +static int screen_pan = 0; + +static bool cursor_enable = true; + +// Functions +static void lcd_drawc(cyg_int8 c, int x, int y); + +// Note: val is a 16 bit, RGB565 value which must be mapped +// onto a 12 bit value. +#define RED(v) ((v>>12) & 0x0F) +#define GREEN(v) ((v>>7) & 0x0F) +#define BLUE(v) ((v>>1) & 0x0F) +#ifdef CYGSEM_EDB7XXX_LCD_COMM_PORTRAIT_MODE +// Translate coordinates, rotating clockwise 90 degrees +static void +set_pixel(int row, int col, unsigned short val) +{ +// fp->pixels[col][(DISPLAY_WIDTH-1)-row] = val; + int _row = (240-1) - col; + int _col = row; + unsigned char *pxptr = (unsigned char *)(0xC0000000 + (_row * 480) + ((_col * 3) / 2)); + + if ((row >= LCD_HEIGHT) || (col >= LCD_WIDTH)) return; + if (0) + { + int old = start_console(); + diag_printf("row=%d/%d, col=%d/%d, pxptr = %p\n", row, _row, col, _col, pxptr); + end_console(old); + } + if ((row % 2) == 0) { + // Even row + *pxptr++ = RED(val) | (GREEN(val) << 4); + *pxptr = (*pxptr & 0xF0) | BLUE(val); + } else { + // Odd row + *pxptr = (*pxptr & 0x0F) | (RED(val) << 4); + *++pxptr = GREEN(val) | (BLUE(val) << 4); + } +} +#else +static void +set_pixel(int row, int col, unsigned short val) +{ + int vpx = (row * 320) + col; // Virtual pixel address + int rem = (vpx * 3) % 2; + unsigned char *pxptr = (unsigned char *)(0xC0000000 + ((vpx * 3) / 2)); + + if ((row >= LCD_HEIGHT) || (col >= LCD_WIDTH)) return; + if (rem) { + *pxptr = (*pxptr & 0x0F) | (RED(val) << 4); + *++pxptr = GREEN(val) | (BLUE(val) << 4); + } else { + *pxptr++ = RED(val) | (GREEN(val) << 4); + *pxptr = (*pxptr & 0xF0) | BLUE(val); + } +} +#endif + +static int +_hexdigit(char c) +{ + if ((c >= '0') && (c <= '9')) { + return c - '0'; + } else + if ((c >= 'A') && (c <= 'F')) { + return (c - 'A') + 0x0A; + } else + if ((c >= 'a') && (c <= 'f')) { + return (c - 'a') + 0x0a; + } +} + +static int +_hex(char *cp) +{ + return (_hexdigit(*cp)<<4) | _hexdigit(*(cp+1)); +} + +static unsigned short +parse_color(char *cp) +{ + int red, green, blue; + + while (*cp && (*cp != 'c')) cp++; + if (cp) { + cp += 2; + if (*cp == '#') { + red = _hex(cp+1); + green = _hex(cp+3); + blue = _hex(cp+5); +#ifdef USE_RGB565 + return RGB_RED(red>>3) | RGB_GREEN(green>>2) | RGB_BLUE(blue>>3); +#else + return RGB_RED(red>>3) | RGB_GREEN(green>>3) | RGB_BLUE(blue>>3); +#endif + } else { + // Should be "None" + return 0xFFFF; + } + } else { + return 0xFFFF; + } +} + +#ifndef CYGINT_ISO_STDIO_FORMATTED_IO +static int +get_int(char **_cp) +{ + char *cp = *_cp; + char c; + int val = 0; + + while ((c = *cp++) && (c != ' ')) { + if ((c >= '0') && (c <= '9')) { + val = val * 10 + (c - '0'); + } else { + return -1; + } + } + *_cp = cp; + return val; +} +#endif + +#ifdef CYGOPT_EDB7XXX_LCD_COMM_LOGO +int +show_xpm(char *xpm[], int screen_pos) +{ + int i, row, col, offset; + char *cp; + int nrows, ncols, nclrs; + unsigned short colors[256]; // Mapped by character index + + cp = xpm[0]; +#ifdef CYGINT_ISO_STDIO_FORMATTED_IO + if (sscanf(cp, "%d %d %d", &ncols, &nrows, &nclrs) != 3) { +#else + if (((ncols = get_int(&cp)) < 0) || + ((nrows = get_int(&cp)) < 0) || + ((nclrs = get_int(&cp)) < 0)) { + +#endif + diag_printf("Can't parse XPM data, sorry\n"); + return 0; + } + // printf("%d rows, %d cols, %d colors\n", nrows, ncols, nclrs); + + for (i = 0; i < 256; i++) { + colors[i] = 0x0000; + } + for (i = 0; i < nclrs; i++) { + cp = xpm[i+1]; + colors[(unsigned int)*cp] = parse_color(&cp[1]); + // printf("Color[%c] = %x\n", *cp, colors[(unsigned int)*cp]); + } + +#ifdef CYGOPT_EDB7XXX_LCD_COMM_LOGO_TOP + offset = screen_pos; +#else + offset = screen_pos-nrows; +#endif + for (row = 0; row < nrows; row++) { + cp = xpm[nclrs+1+row]; + for (col = 0; col < ncols; col++) { + set_pixel(row+offset, col, colors[(unsigned int)*cp++]); + } + } +#ifdef CYGOPT_EDB7XXX_LCD_COMM_LOGO_TOP + screen_start = (nrows + (FONT_HEIGHT-1))/FONT_HEIGHT; + return offset+nrows; +#else + screen_height = offset / FONT_HEIGHT; + return offset; +#endif +} +#endif + +// Control state of LCD display + +#define LCD_DCDC 0x02 +#define LCD_ENABLE 0x04 +#define LCD_BACKLIGHT 0x08 +#define LCD_INIT (LCD_DCDC|LCD_ENABLE|LCD_BACKLIGHT) + +void +lcd_on(bool enable) +{ + static bool enabled = true; + + if (enable) { + if (!enabled) { + *(volatile cyg_uint8 *)PDDR |= (LCD_ENABLE|LCD_BACKLIGHT); + *(volatile cyg_uint32 *)SYSCON1 |= SYSCON1_LCDEN; + } + enabled = true; + } else { + if (enabled) { + *(volatile cyg_uint32 *)SYSCON1 &= ~SYSCON1_LCDEN; + *(volatile cyg_uint8 *)PDDR &= ~(LCD_ENABLE|LCD_BACKLIGHT); + } + enabled = false; + } +} + +// Initialize LCD hardware + +void +lcd_init(int depth) +{ + // Hardwired for EDB7312 + *(volatile cyg_uint32 *)LCDCON = 0xE60F7C1F; + *(volatile cyg_uint32 *)PALLSW = 0x76543210; + *(volatile cyg_uint32 *)PALMSW = 0xFEDCBA98; + *(volatile cyg_uint8 *)PDDR |= LCD_INIT; // Enable video + backlight + DC-DC converter + *(volatile cyg_uint8 *)FRBADDR = 0x0C; // Highest order nibble of LCD frame address + *(volatile cyg_uint32 *)PMPCON = 0x800; // 96KHz, 50% + lcd_on(true); + lcd_clear(); +} + +// Get information about the frame buffer +int +lcd_getinfo(struct lcd_info *info) +{ +#if 0 // this is all wrong + if (lcd_bpp == 0) { + return 0; // LCD not initialized + } + info->width = DISPLAY_WIDTH; + info->height = DISPLAY_HEIGHT; + info->bpp = lcd_bpp; + info->fb = 0xC0000000; + info->rlen = DISPLAY_WIDTH * 2; + info->type = FB_TRUE_RGB565; + return 1; // Information valid +#else + return 0; +#endif +} + +// Clear screen +void +lcd_clear(void) +{ + int row, col; + int pos; + +#ifndef USE_RGB565 + int val; + for (row = 0; row < lcd_height; row++) { + for (col = 0; col < lcd_width; col++) { + set_pixel(row, col, RGB_RED(31)); + } + } + CYGACC_CALL_IF_DELAY_US(10000000); + + for (row = 0; row < lcd_height; row++) { + for (col = 0; col < lcd_width; col++) { + set_pixel(row, col, RGB_GREEN(31)); + } + } + CYGACC_CALL_IF_DELAY_US(10000000); + val = 0; + for (pos = 0; pos < 16; pos++) { + val = (1<= screen_width) X = screen_width-1; + curX = X; + if (Y < screen_start) Y = screen_start; + if (Y >= screen_height) Y = screen_height-1; + curY = Y; + if (cursor_enable) { + lcd_drawc(CURSOR_ON, curX-screen_pan, curY); + } +} + +// Render a character at position (X,Y) with current background/foreground +static void +lcd_drawc(cyg_int8 c, int x, int y) +{ + cyg_uint8 bits; + int l, p; + + if ((x < 0) || (x >= VISIBLE_SCREEN_WIDTH) || + (y < 0) || (y >= screen_height)) return; + for (l = 0; l < FONT_HEIGHT; l++) { + bits = font_table[c-FIRST_CHAR][l]; + for (p = 0; p < FONT_WIDTH; p++) { + if (bits & 0x01) { + set_pixel(y*FONT_HEIGHT+l, x*FONT_WIDTH + p, fg); + } else { + set_pixel(y*FONT_HEIGHT+l, x*FONT_WIDTH + p, bg); + } + bits >>= 1; + } + } +} + +static void +lcd_refresh(void) +{ + int row, col; + + for (row = screen_start; row < screen_height; row++) { + for (col = 0; col < VISIBLE_SCREEN_WIDTH; col++) { + if ((col+screen_pan) < screen_width) { + lcd_drawc(screen[row][col+screen_pan], col, row); + } else { + lcd_drawc(' ', col, row); + } + } + } + if (cursor_enable) { + lcd_drawc(CURSOR_ON, curX-screen_pan, curY); + } +} + +static void +lcd_scroll(void) +{ + int row, col; + cyg_uint8 *c1, *c2; + + // First scroll up the virtual screen + for (row = (screen_start+1); row < screen_height; row++) { + c1 = &screen[row-1][0]; + c2 = &screen[row][0]; + for (col = 0; col < screen_width; col++) { + *c1++ = *c2++; + } + } + c1 = &screen[screen_height-1][0]; + for (col = 0; col < screen_width; col++) { + *c1++ = 0x20; + } + lcd_refresh(); +} + +// Draw one character at the current position +void +lcd_putc(cyg_int8 c) +{ + if (cursor_enable) { + lcd_drawc(screen[curY][curX], curX-screen_pan, curY); + } + switch (c) { + case '\r': + curX = 0; + break; + case '\n': + curY++; + break; + case '\b': + curX--; + if (curX < 0) { + curY--; + if (curY < 0) curY = 0; + curX = screen_width-1; + } + break; + default: + if (((cyg_uint8)c < FIRST_CHAR) || ((cyg_uint8)c > LAST_CHAR)) c = '.'; + screen[curY][curX] = c; + lcd_drawc(c, curX-screen_pan, curY); + curX++; + if (curX == screen_width) { + curY++; + curX = 0; + } + } + if (curY >= screen_height) { + lcd_scroll(); + curY = (screen_height-1); + } + if (cursor_enable) { + lcd_drawc(CURSOR_ON, curX-screen_pan, curY); + } +} + +// Basic LCD 'printf()' support + +#include + +#define is_digit(c) ((c >= '0') && (c <= '9')) + +static int +_cvt(unsigned long val, char *buf, long radix, char *digits) +{ + char temp[80]; + char *cp = temp; + int length = 0; + if (val == 0) { + /* Special case */ + *cp++ = '0'; + } else { + while (val) { + *cp++ = digits[val % radix]; + val /= radix; + } + } + while (cp != temp) { + *buf++ = *--cp; + length++; + } + *buf = '\0'; + return (length); +} + +static int +lcd_vprintf(void (*putc)(cyg_int8), const char *fmt0, va_list ap) +{ + char c, sign, *cp; + int left_prec, right_prec, zero_fill, length, pad, pad_on_right; + char buf[32]; + long val; + while ((c = *fmt0++)) { + cp = buf; + length = 0; + if (c == '%') { + c = *fmt0++; + left_prec = right_prec = pad_on_right = 0; + if (c == '-') { + c = *fmt0++; + pad_on_right++; + } + if (c == '0') { + zero_fill = TRUE; + c = *fmt0++; + } else { + zero_fill = FALSE; + } + while (is_digit(c)) { + left_prec = (left_prec * 10) + (c - '0'); + c = *fmt0++; + } + if (c == '.') { + c = *fmt0++; + zero_fill++; + while (is_digit(c)) { + right_prec = (right_prec * 10) + (c - '0'); + c = *fmt0++; + } + } else { + right_prec = left_prec; + } + sign = '\0'; + switch (c) { + case 'd': + case 'x': + case 'X': + val = va_arg(ap, long); + switch (c) { + case 'd': + if (val < 0) { + sign = '-'; + val = -val; + } + length = _cvt(val, buf, 10, "0123456789"); + break; + case 'x': + length = _cvt(val, buf, 16, "0123456789abcdef"); + break; + case 'X': + length = _cvt(val, buf, 16, "0123456789ABCDEF"); + break; + } + break; + case 's': + cp = va_arg(ap, char *); + length = strlen(cp); + break; + case 'c': + c = va_arg(ap, long /*char*/); + (*putc)(c); + continue; + default: + (*putc)('?'); + } + pad = left_prec - length; + if (sign != '\0') { + pad--; + } + if (zero_fill) { + c = '0'; + if (sign != '\0') { + (*putc)(sign); + sign = '\0'; + } + } else { + c = ' '; + } + if (!pad_on_right) { + while (pad-- > 0) { + (*putc)(c); + } + } + if (sign != '\0') { + (*putc)(sign); + } + while (length-- > 0) { + (*putc)(c = *cp++); + if (c == '\n') { + (*putc)('\r'); + } + } + if (pad_on_right) { + while (pad-- > 0) { + (*putc)(' '); + } + } + } else { + (*putc)(c); + if (c == '\n') { + (*putc)('\r'); + } + } + } +} + +int +_lcd_printf(char const *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = lcd_vprintf(lcd_putc, fmt, ap); + va_end(ap); + return (ret); +} + +void +lcd_setbg(int red, int green, int blue) +{ + bg = RGB_RED(red) | RGB_GREEN(green) | RGB_BLUE(blue); +} + +void +lcd_setfg(int red, int green, int blue) +{ + fg = RGB_RED(red) | RGB_GREEN(green) | RGB_BLUE(blue); +} + +#ifdef CYGSEM_EDB7XXX_LCD_COMM + +// +// Support LCD/keyboard (PS2) as a virtual I/O channel +// Adapted from i386/pcmb_screen.c +// + +static int _timeout = 500; + +//----------------------------------------------------------------------------- +// Keyboard definitions + +#define KBDATAPORT 0x40010000 // data I/O port +#define KBCMDPORT 0x40010001 // command port (write) +#define KBSTATPORT 0x40010001 // status port (read) +#define KBINRDY 0x01 +#define KBOUTRDY 0x02 +#define KBTXTO 0x40 // Transmit timeout - nothing there +#define KBTEST 0xAB + +// Scan codes + +#define LSHIFT 0x2a +#define RSHIFT 0x36 +#define CTRL 0x1d +#define ALT 0x38 +#define CAPS 0x3a +#define NUMS 0x45 + +#define BREAK 0x80 + +// Bits for KBFlags + +#define KBNormal 0x0000 +#define KBShift 0x0001 +#define KBCtrl 0x0002 +#define KBAlt 0x0004 +#define KBIndex 0x0007 // mask for the above + +#define KBExtend 0x0010 +#define KBAck 0x0020 +#define KBResend 0x0040 +#define KBShiftL (0x0080 | KBShift) +#define KBShiftR (0x0100 | KBShift) +#define KBCtrlL (0x0200 | KBCtrl) +#define KBCtrlR (0x0400 | KBCtrl) +#define KBAltL (0x0800 | KBAlt) +#define KBAltR (0x1000 | KBAlt) +#define KBCapsLock 0x2000 +#define KBNumLock 0x4000 + +#define KBArrowUp 0x48 +#define KBArrowRight 0x4D +#define KBArrowLeft 0x4B +#define KBArrowDown 0x50 + +//----------------------------------------------------------------------------- +// Keyboard Variables + +static int KBFlags = 0; + +static CYG_BYTE KBPending = 0xFF; + +static CYG_BYTE KBScanTable[128][4] = { +// Normal Shift Control Alt +// 0x00 + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0x1b, 0x1b, 0x1b, 0xFF, }, + { '1', '!', 0xFF, 0xFF, }, + { '2', '"', 0xFF, 0xFF, }, + { '3', '#', 0xFF, 0xFF, }, + { '4', '$', 0xFF, 0xFF, }, + { '5', '%', 0xFF, 0xFF, }, + { '6', '^', 0xFF, 0xFF, }, + { '7', '&', 0xFF, 0xFF, }, + { '8', '*', 0xFF, 0xFF, }, + { '9', '(', 0xFF, 0xFF, }, + { '0', ')', 0xFF, 0xFF, }, + { '-', '_', 0xFF, 0xFF, }, + { '=', '+', 0xFF, 0xFF, }, + { '\b', '\b', 0xFF, 0xFF, }, + { '\t', '\t', 0xFF, 0xFF, }, +// 0x10 + { 'q', 'Q', 0x11, 0xFF, }, + { 'w', 'W', 0x17, 0xFF, }, + { 'e', 'E', 0x05, 0xFF, }, + { 'r', 'R', 0x12, 0xFF, }, + { 't', 'T', 0x14, 0xFF, }, + { 'y', 'Y', 0x19, 0xFF, }, + { 'u', 'U', 0x15, 0xFF, }, + { 'i', 'I', 0x09, 0xFF, }, + { 'o', 'O', 0x0F, 0xFF, }, + { 'p', 'P', 0x10, 0xFF, }, + { '[', '{', 0x1b, 0xFF, }, + { ']', '}', 0x1d, 0xFF, }, + { '\r', '\r', '\n', 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 'a', 'A', 0x01, 0xFF, }, + { 's', 'S', 0x13, 0xFF, }, +// 0x20 + { 'd', 'D', 0x04, 0xFF, }, + { 'f', 'F', 0x06, 0xFF, }, + { 'g', 'G', 0x07, 0xFF, }, + { 'h', 'H', 0x08, 0xFF, }, + { 'j', 'J', 0x0a, 0xFF, }, + { 'k', 'K', 0x0b, 0xFF, }, + { 'l', 'L', 0x0c, 0xFF, }, + { ';', ':', 0xFF, 0xFF, }, + { 0x27, '@', 0xFF, 0xFF, }, + { '#', '~', 0xFF, 0xFF, }, + { '`', '~', 0xFF, 0xFF, }, + { '\\', '|', 0x1C, 0xFF, }, + { 'z', 'Z', 0x1A, 0xFF, }, + { 'x', 'X', 0x18, 0xFF, }, + { 'c', 'C', 0x03, 0xFF, }, + { 'v', 'V', 0x16, 0xFF, }, +// 0x30 + { 'b', 'B', 0x02, 0xFF, }, + { 'n', 'N', 0x0E, 0xFF, }, + { 'm', 'M', 0x0D, 0xFF, }, + { ',', '<', 0xFF, 0xFF, }, + { '.', '>', 0xFF, 0xFF, }, + { '/', '?', 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { ' ', ' ', ' ', ' ', }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xF1, 0xE1, 0xFF, 0xFF, }, + { 0xF2, 0xE2, 0xFF, 0xFF, }, + { 0xF3, 0xE3, 0xFF, 0xFF, }, + { 0xF4, 0xE4, 0xFF, 0xFF, }, + { 0xF5, 0xE5, 0xFF, 0xFF, }, +// 0x40 + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + + { 0x15, 0x15, 0x15, 0x15, }, + { 0x10, 0x10, 0x10, 0x10, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, +// 0x50 + { 0x04, 0x04, 0x04, 0x04, }, + { 0x0e, 0x0e, 0x0e, 0x0e, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, +// 0x60 + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, +// 0x70 + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, + { 0xFF, 0xFF, 0xFF, 0xFF, }, +}; + +static int KBIndexTab[8] = { 0, 1, 2, 2, 3, 3, 3, 3 }; + +//----------------------------------------------------------------------------- + +static __inline__ cyg_uint8 +inb(cyg_uint32 port) +{ + cyg_uint8 val; + HAL_READ_UINT8(port, val); + return val; +} + +static __inline__ +outb(cyg_uint32 port, cyg_uint8 val) +{ + HAL_WRITE_UINT8(port, val); +} + +static cyg_bool +KeyboardInit(void) +{ + unsigned char c, s; + int i; + + /* flush input queue */ + while ((inb(KBSTATPORT) & KBINRDY)) { + (void)inb(KBDATAPORT); + } + + /* Send self-test - controller local */ + while (inb(KBSTATPORT) & KBOUTRDY) ; + outb(KBCMDPORT,0xAA); + while ((inb(KBSTATPORT) & KBINRDY) == 0) ; /* wait input ready */ + if ((c = inb(KBDATAPORT)) != 0x55) { +#ifdef DEBUG_KBD_INIT + diag_printf("Keyboard self test failed - result: %x\n", c); +#endif + return false; + } + + /* Enable interrupts and keyboard controller */ + while (inb(KBSTATPORT) & KBOUTRDY) ; + outb(KBCMDPORT,0x60); + while (inb(KBSTATPORT) & KBOUTRDY) ; + outb(KBCMDPORT,0x45); + CYGACC_CALL_IF_DELAY_US(10000); // 10ms + + while (inb(KBSTATPORT) & KBOUTRDY) ; + outb(KBCMDPORT,0xAE); // Enable keyboard + + /* See if a keyboard is connected */ + while (inb(KBSTATPORT) & KBOUTRDY) ; + outb(KBDATAPORT,0xFF); + while (((s = inb(KBSTATPORT)) & (KBINRDY|KBTXTO)) == 0) ; /* wait input ready */ + if ((s & KBTXTO) || ((c = inb(KBDATAPORT)) != 0xFA)) { +#ifdef DEBUG_KBD_INIT + diag_printf("Keyboard reset failed - no ACK: %x, stat: %x\n", c, s); +#endif + return false; + } + while (((s = inb(KBSTATPORT)) & KBINRDY) == 0) ; /* wait input ready */ + if ((s & KBTXTO) || ((c = inb(KBDATAPORT)) != 0xAA)) { +#ifdef DEBUG_KBD_INIT + diag_printf("Keyboard reset failed - bad code: %x, stat: %x\n", c, s); +#endif + return false; + } + + // Set scan mode + while (inb(KBSTATPORT) & KBOUTRDY) ; + outb(KBCMDPORT,0x20); + while ((inb(KBSTATPORT) & KBINRDY) == 0) ; /* wait input ready */ + if (! (inb(KBDATAPORT) & 0x40)) { + /* + * Quote from PS/2 System Reference Manual: + * + * "Address hex 0060 and address hex 0064 should be + * written only when the input-buffer-full bit and + * output-buffer-full bit in the Controller Status + * register are set 0." (KBINRDY and KBOUTRDY) + */ + + while (inb(KBSTATPORT) & (KBINRDY | KBOUTRDY)) ; + outb(KBDATAPORT,0xF0); + while (inb(KBSTATPORT) & (KBINRDY | KBOUTRDY)) ; + outb(KBDATAPORT,0x01); + } + + KBFlags = 0; + return true; +} /* KeyboardInit */ + +//----------------------------------------------------------------------------- + +static CYG_BYTE +KeyboardAscii(CYG_BYTE scancode) +{ + CYG_BYTE ascii = 0xFF; + + // Start by handling all shift/ctl keys: + + switch( scancode ) { + case 0xe0: + KBFlags |= KBExtend; + return 0xFF; + + case 0xfa: + KBFlags |= KBAck; + return 0xFF; + + case 0xfe: + KBFlags |= KBResend; + return 0xFF; + + case LSHIFT: + KBFlags |= KBShiftL; + return 0xFF; + + case LSHIFT | BREAK: + KBFlags &= ~KBShiftL; + return 0xFF; + + case RSHIFT: + KBFlags |= KBShiftR; + return 0xFF; + + case RSHIFT | BREAK: + KBFlags &= ~KBShiftR; + return 0xFF; + + case CTRL: + if( KBFlags & KBExtend ) + { + KBFlags |= KBCtrlR; + KBFlags &= ~KBExtend; + } + else KBFlags |= KBCtrlL; + return 0xFF; + + case CTRL | BREAK: + if( KBFlags & KBExtend ) + { + KBFlags &= ~KBCtrlR; + KBFlags &= ~KBExtend; + } + else KBFlags &= ~KBCtrlL; + return 0xFF; + + + case ALT: + if( KBFlags & KBExtend ) + { + KBFlags |= KBAltR; + KBFlags &= ~KBExtend; + } + else KBFlags |= KBAltL; + return 0xFF; + + case ALT | BREAK: + if( KBFlags & KBExtend ) + { + KBFlags &= ~KBAltR; + KBFlags &= ~KBExtend; + } + else KBFlags &= ~KBAltL; + return 0xFF; + + case CAPS: + KBFlags ^= KBCapsLock; + case CAPS | BREAK: + return 0xFF; + + case NUMS: + KBFlags ^= KBNumLock; + case NUMS | BREAK: + return 0xFF; + + case KBArrowUp: + case KBArrowDown: + screen_pan = 0; + lcd_refresh(); + break; + case KBArrowLeft: + screen_pan -= SCREEN_PAN; + if (screen_pan < 0) screen_pan = 0; + lcd_refresh(); + break; + case KBArrowRight: + screen_pan += SCREEN_PAN; + if (screen_pan > (SCREEN_WIDTH-SCREEN_PAN)) screen_pan = SCREEN_WIDTH-SCREEN_PAN; + lcd_refresh(); + break; + + } + + // Clear Extend flag if set + KBFlags &= ~KBExtend; + + // Ignore all other BREAK codes + if( scancode & 0x80 ) return 0xFF; + + // Here the scancode is for something we can turn + // into an ASCII value + + ascii = KBScanTable[scancode & 0x7F][KBIndexTab[KBFlags & KBIndex]]; + + return ascii; + +} /* KeyboardAscii */ + +//----------------------------------------------------------------------------- + +static int +KeyboardTest(void) +{ + // If there is a pending character, return True + if( KBPending != 0xFF ) return true; + + // If there is something waiting at the port, get it + for(;;) { + CYG_BYTE stat, code; + CYG_BYTE c; + + HAL_READ_UINT8( KBSTATPORT, stat ); + + if( (stat & KBINRDY) == 0 ) + break; + + HAL_READ_UINT8( KBDATAPORT, code ); + + // Translate to ASCII + c = KeyboardAscii(code); + + // if it is a real ASCII char, save it and + // return True. + if( c != 0xFF ) { + KBPending = c; + return true; + } + } + + // Otherwise return False + return false; + +} /* KeyboardTest */ + +static cyg_bool +lcd_comm_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + if( !KeyboardTest() ) + return false; + *ch = KBPending; + KBPending = 0xFF; + return true; +} + +static cyg_uint8 +lcd_comm_getc(void* __ch_data) +{ + cyg_uint8 ch; + + while (!lcd_comm_getc_nonblock(__ch_data, &ch)) ; + return ch; +} + +static void +lcd_comm_putc(void* __ch_data, cyg_uint8 c) +{ + lcd_putc(c); +} + +static void +lcd_comm_write(void* __ch_data, const cyg_uint8* __buf, cyg_uint32 __len) +{ +#if 0 + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + lcd_comm_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +#endif +} + +static void +lcd_comm_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ +#if 0 + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = lcd_comm_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +#endif +} + +static cyg_bool +lcd_comm_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + cyg_bool res; + + delay_count = _timeout * 10; // delay in .1 ms steps + for(;;) { + res = lcd_comm_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + CYGACC_CALL_IF_DELAY_US(100); + } + return res; +} + +static int +lcd_comm_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int vector = 0; + int ret = -1; + static int irq_state = 0; + + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + ret = irq_state; + irq_state = 1; + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = _timeout; + _timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + break; + } + case __COMMCTL_FLUSH_OUTPUT: + ret = 0; + break; + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +lcd_comm_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ +#if 0 + char ch; + + cyg_drv_interrupt_acknowledge(__vector); + *__ctrlc = 0; + if (lcd_comm_getc_nonblock(__ch_data, &ch)) { + if (ch == 0x03) { + *__ctrlc = 1; + } + } + return CYG_ISR_HANDLED; +#endif +} + +#define LCD_COMM_CHANNEL 2 + +void +lcd_comm_init(void) +{ + static int init = 0; + + if (!init) { + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + init = 1; + lcd_on(false); + if (!KeyboardInit()) { + // No keyboard - no LCD display + return; + } + // Initialize screen + cursor_enable = true; + lcd_init(16); + + // Setup procs in the vector table + CYGACC_CALL_IF_SET_CONSOLE_COMM(LCD_COMM_CHANNEL); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + //CYGACC_COMM_IF_CH_DATA_SET(*comm, chan); + CYGACC_COMM_IF_WRITE_SET(*comm, lcd_comm_write); + CYGACC_COMM_IF_READ_SET(*comm, lcd_comm_read); + CYGACC_COMM_IF_PUTC_SET(*comm, lcd_comm_putc); + CYGACC_COMM_IF_GETC_SET(*comm, lcd_comm_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, lcd_comm_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, lcd_comm_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, lcd_comm_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); + } +} + +#ifdef CYGPKG_REDBOOT +#include + +// Get here when RedBoot is idle. If it's been long enough, then +// dim the LCD. The problem is - how to determine other activities +// so that this doesn't get in the way. In the default case, this will +// be called from RedBoot every 10ms (CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) + +#define MAX_IDLE_TIME (30*100) + +static void +idle(bool is_idle) +{ + static int idle_time = 0; + static bool was_idled = false; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + if (is_idle) { + if (!was_idled) { + if (++idle_time == MAX_IDLE_TIME) { + was_idled = true; + lcd_on(false); + } + } + } else { + idle_time = 0; + if (was_idled) { + was_idled = false; + lcd_on(cur == LCD_COMM_CHANNEL); + } + } +} + +RedBoot_idle(idle, RedBoot_AFTER_NETIO); +#endif +#endif diff --git a/packages/hal/arm/edb7xxx/current/support/io.c b/packages/hal/arm/edb7xxx/current/support/io.c --- a/packages/hal/arm/edb7xxx/current/support/io.c +++ b/packages/hal/arm/edb7xxx/current/support/io.c @@ -5,29 +5,38 @@ // Linux I/O support for Cirrus Logic EDB7xxx eval board tools // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/edb7xxx/current/tests/dram_test.c b/packages/hal/arm/edb7xxx/current/tests/dram_test.c --- a/packages/hal/arm/edb7xxx/current/tests/dram_test.c +++ b/packages/hal/arm/edb7xxx/current/tests/dram_test.c @@ -5,29 +5,38 @@ // eCos generic DRAM test code // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/integrator/current/ChangeLog b/packages/hal/arm/integrator/current/ChangeLog --- a/packages/hal/arm/integrator/current/ChangeLog +++ b/packages/hal/arm/integrator/current/ChangeLog @@ -1,29 +1,117 @@ +2002-05-07 Gary Thomas + + * cdl/hal_arm_integrator.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-03-19 Nick Garnett + + * include/plf_io.h: Added volatiles to PCI config accesses. These + should have been noticed ages ago! + +2002-03-14 Nick Garnett + + * include/plf_stub.h: Added data access check macros + CYG_HAL_STUB_PERMIT_DATA_READ() and + CYG_HAL_STUB_PERMIT_DATA_WRITE() for use by GDB stubs. + + * cdl/hal_arm_integrator.cdl: Added -fno-schedule-insns to ARM7 + compile line option. There seem to be some issues in the ethernet + driver when scheduling instructions. + +2002-03-08 Nick Garnett + + * src/integrator_misc.c (cyg_plf_pci_init): Only actually init PCI + bridge for non-RAM configurations. Reinitializing during RAM + startup kills any PCI devices. This is particularly a problem if + we are debugging via the ethernet. + +2002-03-07 Jesper Skov + + * misc/redboot_ROMRAM.ecm: Added zlib. + + * cdl/hal_arm_integrator.cdl: Require more flash for the RedBoot + image, but remove the backup image to compensate. + +2002-03-06 Nick Garnett + + * src/integrator_misc.c: + Added hal_delay_us() and initialized clock in plf_hardware_init() + to make it work in RedBoot. + Moved PCI initialization from macro to cyg_plf_pci_init(). + + * src/hal_diag.c: Fixed ISR to operate correctly. Removed legacy + code. + + * misc/redboot_ROMRAM.ecm: Added this file to support ROMRAM + startup redboot. + + * include/pkgconf/mlt_arm_integrator_ram.ldi: + * include/pkgconf/mlt_arm_integrator_ram.h: + * include/pkgconf/mlt_arm_integrator_rom.ldi: + * include/pkgconf/mlt_arm_integrator_rom.h: + * include/pkgconf/mlt_arm_integrator_romram.ldi: + * include/pkgconf/mlt_arm_integrator_romram.h: + Added ROMRAM startup files. Fixed up ROM and RAM files to reflect + use of PCI window. + Note: MLT files not updated! + + * include/plf_io.h: Moved contents of HAL_PCI_INIT() out to + src/integrator_misc.c. Added CYGARC_PHYSICAL_ADDRESS(). Fixed 32 + bit PCI config accesses to use two 16 bit accesses - the stright + 32 bit accesses do not seem to work. + + * include/hal_platform_setup.h: Added support for ROMRAM startup. + Tidied up a bit. + + * include/hal_platform_ints.h: Added HAL_DELAY_US() and + implemented HAL_PLATFORM_RESET(). + + * include/hal_integrator.h: Move HAL_FLASH_WRITE_ENABLE() and + HAL_FLASH_WRITE_DISABLE() out to integrator FLASH device driver. + + * cdl/hal_arm_integrator.cdl: + Added support for ARM7 and ARM9 variants. Generally tidied up. + +2002-01-28 Jesper Skov + + * cdl/hal_arm_integrator.cdl: Removed explicit declaration of + plf_io.h + 2001-10-30 Philippe Robin * Initial version of integrator package. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/arm/integrator/current/cdl/hal_arm_integrator.cdl b/packages/hal/arm/integrator/current/cdl/hal_arm_integrator.cdl --- a/packages/hal/arm/integrator/current/cdl/hal_arm_integrator.cdl +++ b/packages/hal/arm/integrator/current/cdl/hal_arm_integrator.cdl @@ -5,29 +5,38 @@ # INTEGRATOR board HAL package configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # @@ -55,28 +64,45 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { implements CYGINT_HAL_DEBUG_GDB_STUBS implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT - implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED - implements CYGINT_HAL_ARM_THUMB_ARCH - implements CYGINT_HAL_ARM_BIGENDIAN - implements CYGINT_HAL_ARM_ARCH_ARM7 - implements CYGINT_HAL_ARM_ARCH_ARM9 define_proc { puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " - puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_IO_H " puts $::cdl_header "" - puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM 7TDMI\"" puts $::cdl_header "#define HAL_PLATFORM_BOARD \"INTEGRATOR\"" puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" puts $::cdl_header "" } + cdl_component CYGPKG_HAL_ARM_INTEGRATOR_ARM7 { + display "ARM 7 specialization" + active_if !CYGPKG_HAL_ARM_ARM9 + calculated !CYGPKG_HAL_ARM_ARM9 + implements CYGINT_HAL_ARM_ARCH_ARM7 + + define_proc { + puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM 7TDMI\"" + } + } + + cdl_component CYGPKG_HAL_ARM_INTEGRATOR_ARM9 { + display "ARM 9 specialization" + active_if CYGPKG_HAL_ARM_ARM9 + calculated CYGPKG_HAL_ARM_ARM9 + + requires CYGPKG_HAL_ARM_ARM9_ARM966E + + define_proc { + puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM 9\"" + } + + } + cdl_component CYG_HAL_STARTUP { display "Startup type" flavor data - legal_values {"RAM" "ROM"} + legal_values {"RAM" "ROM" "ROMRAM"} default_value {"RAM"} no_define define -file system.h CYG_HAL_STARTUP @@ -90,30 +116,6 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { } - cdl_option CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_BASE { - display "Base of memory accessible via PCI space" - flavor data - legal_values 0 to 0x80000000 - default_value 0x80000000 - active_if CYGPKG_IO_PCI - description " - This option determines the base of the INTEGRATOR memory - which can be accessed via the PCI bus. Change in 256kB - increments." - } - - cdl_option CYGHWR_HAL_ARM_INTEGRATOR_PCI_MEM_MAP_SIZE { - display "Size of memory accessible via PCI space" - flavor data - legal_values 0 to 0x100000 - default_value 0x100000 - active_if CYGPKG_IO_PCI - description " - This option determines the size of the INTEGRATOR memory - which can be accessed via the PCI bus. Change in 256kB - increments." - } - cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { display "Default console channel." flavor data @@ -131,17 +133,6 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { diagnostic and GDB port are the same." } - cdl_option CYGHWR_HAL_ARM_INTEGRATOR_GDB_PORT { - display "GDB serial port" - flavor data - legal_values 0 1 - default_value 1 - description " - The INTEGRATOR board has two separate serial ports. This option - chooses which of these ports will be used to connect to a host - running GDB." - } - cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { display "GDB serial port baud rate" flavor data @@ -174,7 +165,7 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE flavor data legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 - default_value 1 + default_value 0 description " The INTEGRATOR board has two serial ports. This option chooses which port will be used to connect to a host @@ -186,7 +177,7 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE flavor data legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 - default_value 0 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT description " The INTEGRATOR board has two serial ports. This option chooses which port will be used for diagnostic output." @@ -237,12 +228,11 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { display "Global compiler flags" flavor data no_define - default_value { (CYGBLD_ARM_ENABLE_THUMB_INTERWORK && CYGHWR_HAL_ARM_BIGENDIAN) ? "-mthumb-interwork -mbig-endian -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : - CYGBLD_ARM_ENABLE_THUMB_INTERWORK ? "-mthumb-interwork -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : - (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -mbig-endian -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : - (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && ! CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : - (CYGHWR_HAL_ARM_CPU_FAMILY != "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm7tdmi -mbig-endian -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : - "-mcpu=arm7tdmi -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + default_value { + CYGPKG_HAL_ARM_INTEGRATOR_ARM9 ? "-mcpu=arm9 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : + "-mcpu=arm7tdmi -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -fno-schedule-insns -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" + } + description " This option controls the global compiler flags which are used to compile all packages by default. Individual packages may define @@ -253,12 +243,9 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { display "Global linker flags" flavor data no_define - default_value { ((CYGHWR_THUMB || CYGSEM_HAL_ROM_MONITOR) && CYGHWR_HAL_ARM_BIGENDIAN) ? "-mthumb-interwork -mbig-endian -g -nostdlib -Wl,--gc-sections -Wl,-static" : - (CYGHWR_THUMB || CYGSEM_HAL_ROM_MONITOR) ? "-mthumb-interwork -g -nostdlib -Wl,--gc-sections -Wl,-static" : - (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -mbig-endian -g -nostdlib -Wl,--gc-sections -Wl,-static" : - (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && ! CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -g -nostdlib -Wl,--gc-sections -Wl,-static" : - (CYGHWR_HAL_ARM_CPU_FAMILY != "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm7tdmi -mbig-endian -g -nostdlib -Wl,--gc-sections -Wl,-static" : - "-mcpu=arm7tdmi -g -nostdlib -Wl,--gc-sections -Wl,-static" } + default_value { + CYGPKG_HAL_ARM_INTEGRATOR_ARM9 ? "-Wl,-Map,map -mcpu=arm9 -g -nostdlib -Wl,--gc-sections -Wl,-static" : + "-Wl,-Map,map -mcpu=arm7tdmi -g -nostdlib -Wl,--gc-sections -Wl,-static" } description " This option controls the global linker flags. Individual packages may define options which override these global flags." @@ -268,7 +255,7 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { display "Build GDB stub ROM image" default_value 0 requires CYGBLD_BUILD_COMMON_GDB_STUBS - requires { CYG_HAL_STARTUP == "ROM" } + requires { CYG_HAL_STARTUP != "RAM" } requires CYGSEM_HAL_ROM_MONITOR requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT @@ -343,16 +330,18 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { display "Memory layout" flavor data no_define - calculated { CYG_HAL_STARTUP == "RAM" ? "arm_integrator_ram" : \ - "arm_integrator_rom" } + calculated { CYG_HAL_STARTUP == "RAM" ? "arm_integrator_ram" : \ + CYG_HAL_STARTUP == "ROMRAM" ? "arm_integrator_romram" : \ + "arm_integrator_rom" } cdl_option CYGHWR_MEMORY_LAYOUT_LDI { display "Memory layout linker script fragment" flavor data no_define define -file system.h CYGHWR_MEMORY_LAYOUT_LDI - calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ - "" } + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROMRAM" ? "" : \ + "" } } cdl_option CYGHWR_MEMORY_LAYOUT_H { @@ -360,8 +349,9 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { flavor data no_define define -file system.h CYGHWR_MEMORY_LAYOUT_H - calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ - "" } + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROMRAM" ? "" : \ + "" } } } @@ -371,7 +361,7 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { flavor bool default_value 0 parent CYGPKG_HAL_ROM_MONITOR - requires { CYG_HAL_STARTUP == "ROM" } + requires { CYG_HAL_STARTUP != "RAM" } description " Enable this option if this program is to be used as a ROM monitor, i.e. applications will be loaded into RAM on the board, and this @@ -438,20 +428,43 @@ cdl_package CYGPKG_HAL_ARM_INTEGRATOR { This option lists the target's requirements for a valid Redboot configuration." - cdl_option CYGBLD_BUILD_REDBOOT_BIN { - display "Build Redboot ROM binary image" - active_if CYGBLD_BUILD_REDBOOT + requires { !CYGPKG_REDBOOT_FLASH || (CYGBLD_REDBOOT_MIN_IMAGE_SIZE == 0x40000) } + requires { !CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP } + + cdl_option CYGBLD_BUILD_REDBOOT_BIN_ROM { + display "Build Redboot ROM startup ROM binary image" + active_if { CYGBLD_BUILD_REDBOOT && CYG_HAL_STARTUP == "ROM" } default_value 1 no_define description "This option enables the conversion of the Redboot ELF - image to a binary image suitable for ROM programming." + image to S-Record and binary image suitable for ROM + programming." make -priority 325 { /bin/redboot.bin : /bin/redboot.elf $(OBJCOPY) --strip-debug $< $(@:.bin=.img) - $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O srec --gap-fill 0 $< $(@:.bin=.srec) $(OBJCOPY) -O binary $< $@ } } + + cdl_option CYGBLD_BUILD_REDBOOT_BIN_ROMRAM { + display "Build Redboot ROMRAM startup ROM binary image" + active_if { CYGBLD_BUILD_REDBOOT && CYG_HAL_STARTUP == "ROMRAM" } + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to S-Record and binary images suitable for ROM + programming." + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec --adjust-vma 0x24000000 --gap-fill 0 $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + + } } diff --git a/packages/hal/arm/integrator/current/include/hal_cache.h b/packages/hal/arm/integrator/current/include/hal_cache.h --- a/packages/hal/arm/integrator/current/include/hal_cache.h +++ b/packages/hal/arm/integrator/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/integrator/current/include/hal_diag.h b/packages/hal/arm/integrator/current/include/hal_diag.h --- a/packages/hal/arm/integrator/current/include/hal_diag.h +++ b/packages/hal/arm/integrator/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/integrator/current/include/hal_integrator.h b/packages/hal/arm/integrator/current/include/hal_integrator.h --- a/packages/hal/arm/integrator/current/include/hal_integrator.h +++ b/packages/hal/arm/integrator/current/include/hal_integrator.h @@ -8,29 +8,38 @@ // HAL Description of INTEGRATOR board // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -393,41 +402,5 @@ #define INTEGRATOR_SC_PCIENABLE (INTEGRATOR_SC_BASE + INTEGRATOR_SC_PCIENABLE_OFFSET) #define INTEGRATOR_SC_LOCK (INTEGRATOR_SC_BASE + INTEGRATOR_SC_LOCK_OFFSET) - -#define HAL_FLASH_WRITE_ENABLE() \ - { \ - volatile cyg_uint32 *ebi_csr1 = (volatile cyg_uint32 *)INTEGRATOR_EBI_CSR1; \ - \ - /* allow write access to EBI_CSR1 area (Flash) */ \ - *ebi_csr1 |= INTEGRATOR_EBI_WRITE_ENABLE; \ - \ - if (!(*ebi_csr1 & INTEGRATOR_EBI_WRITE_ENABLE)) { \ - *(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 0xA05F; \ - *ebi_csr1 |= INTEGRATOR_EBI_WRITE_ENABLE; \ - *(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 0; \ - } \ - \ - /* Enable Vpp and allow write access to Flash in system controller */ \ - *(volatile unsigned int *)INTEGRATOR_SC_CTRLS = FL_SC_CONTROL; \ - } - -#define HAL_FLASH_WRITE_DISABLE() \ - { \ - volatile cyg_uint32 *ebi_csr1 = (volatile cyg_uint32 *)INTEGRATOR_EBI_CSR1; \ - \ - /* disable write access to EBI_CSR1 area (Flash) */ \ - *ebi_csr1 &= ~INTEGRATOR_EBI_WRITE_ENABLE; \ - \ - if (*ebi_csr1 & INTEGRATOR_EBI_WRITE_ENABLE) { \ - *(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 0xA05F; \ - *ebi_csr1 &= ~INTEGRATOR_EBI_WRITE_ENABLE; \ - *(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 1; \ - } \ - \ - /* Disable Vpp and disable write access to Flash in system controller */ \ - *(volatile unsigned int *)INTEGRATOR_SC_CTRLS = 0; \ - } - - #endif //CYGONCE_HAL_INTEGRATOR_H diff --git a/packages/hal/arm/integrator/current/include/hal_platform_ints.h b/packages/hal/arm/integrator/current/include/hal_platform_ints.h --- a/packages/hal/arm/integrator/current/include/hal_platform_ints.h +++ b/packages/hal/arm/integrator/current/include/hal_platform_ints.h @@ -7,29 +7,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -81,10 +90,21 @@ #define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_TIMERINT2 //---------------------------------------------------------------------------- +// Microsecond delay support. + +extern void hal_delay_us(cyg_uint32 usecs); +#define HAL_DELAY_US(n) hal_delay_us(n); + +//---------------------------------------------------------------------------- // Reset. -#define HAL_PLATFORM_RESET() CYG_EMPTY_STATEMENT +#define HAL_PLATFORM_RESET() \ +{ \ + HAL_WRITE_UINT8( INTEGRATOR_SC_CTRLS , 1 ); \ +} -#define HAL_PLATFORM_RESET_ENTRY 0x4000000 +#define HAL_PLATFORM_RESET_ENTRY 0x24000000 + +//---------------------------------------------------------------------------- #endif // CYGONCE_HAL_PLATFORM_INTS_H diff --git a/packages/hal/arm/integrator/current/include/hal_platform_setup.h b/packages/hal/arm/integrator/current/include/hal_platform_setup.h --- a/packages/hal/arm/integrator/current/include/hal_platform_setup.h +++ b/packages/hal/arm/integrator/current/include/hal_platform_setup.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -47,12 +56,17 @@ #include +#ifdef CYG_HAL_STARTUP_ROMRAM +#define CYGSEM_HAL_ROM_RESET_USES_JUMP +#endif + // Define macro used to diddle the LEDs during early initialization. // Can use r0+r1. Argument in \x. // Control the LEDs PP0-PP3. This requires the jumpers on pins 9-16 to // be set on LK11 in order to be visible. Otherwise the parallel port // data pins are diddled instead. + #ifdef CYGHWR_HAL_ARM_INTEGRATOR_DIAG_LEDS #define CYGHWR_LED_MACRO \ mov r1, #(15 & (\x)) ;\ @@ -60,21 +74,63 @@ strb r1, [r0, #INTEGRATOR_DBG_LEDS_OFFSET] ; #endif -#define PLATFORM_SETUP1 \ - ldr r0,=INTEGRATOR_DBG_BASE ;\ - ldr r1,=0 ;\ - strb r1, [r0, #INTEGRATOR_DBG_LEDS_OFFSET] ;\ - ldr r0, =INTEGRATOR_HDR_BASE ;\ - ldr r1, [r0, #INTEGRATOR_HDR_CTRL_OFFSET] ;\ - orr r1, r1, #INTEGRATOR_HDR_CTRL_REMAP ;\ - str r1, [r0, #INTEGRATOR_HDR_CTRL_OFFSET] ;\ - ldr r1, =INTEGRATOR_IRQCONT_BASE ;\ - ldr r0, =0xFFFFFFFF ;\ - str r0, [r1, #INTEGRATOR_IRQENABLECLEAR] ;\ - str r0, [r1, #INTEGRATOR_FIQENABLECLEAR] ;\ - ldr r0,=INTEGRATOR_DBG_BASE ;\ - ldr r1,=0xF ;\ - strb r1, [r0, #INTEGRATOR_DBG_LEDS_OFFSET] ; +#define PLATFORM_SETUP1 platform_setup1 + + .macro platform_setup1 +#ifdef CYG_HAL_STARTUP_ROMRAM + // This warps execution away from location 0+x to 0x24000000+x + // so that we can turn the FLASH remapping off. + orr pc,pc,#0x24000000 + nop + nop + nop + nop +#endif + ldr r0,=INTEGRATOR_DBG_BASE + ldr r1,=0 + strb r1, [r0, #INTEGRATOR_DBG_LEDS_OFFSET] + ldr r0, =INTEGRATOR_HDR_BASE + ldr r1, [r0, #INTEGRATOR_HDR_CTRL_OFFSET] + orr r1, r1, #INTEGRATOR_HDR_CTRL_REMAP + str r1, [r0, #INTEGRATOR_HDR_CTRL_OFFSET] + ldr r1, =INTEGRATOR_IRQCONT_BASE + ldr r0, =0xFFFFFFFF + str r0, [r1, #INTEGRATOR_IRQENABLECLEAR] + str r0, [r1, #INTEGRATOR_FIQENABLECLEAR] + ldr r0,=INTEGRATOR_DBG_BASE + ldr r1,=0xF + strb r1, [r0, #INTEGRATOR_DBG_LEDS_OFFSET] + + LED 7 +#ifdef CYG_HAL_STARTUP_ROMRAM +#if 0 + // Compute [logical] base address of this image in ROM + bl 10f +10: mov r9,lr // R9 = ROM address of 10: + ldr r8,=10b // R8 = RAM address of 10: + sub r9,r9,r8 // R9 = ROM-RAM + ldr r0,=__exception_handlers // R0 = RAM address of __exception_handlers + add r0,r0,r9 // R0 = ROM address of __exception_handlers +#endif + + ldr r0,=0x24000000 + ldr r1,=__exception_handlers // ram base & length + ldr r2,=__rom_data_end +20: ldr r3,[r0],#4 + str r3,[r1],#4 + cmp r1,r2 + bne 20b + ldr r0,=30f + mov pc,r0 + nop + nop + nop + nop +30: +#endif + LED 6 + + .endm /*---------------------------------------------------------------------------*/ /* end of hal_platform_setup.h */ diff --git a/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_ram.h b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_ram.h --- a/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_ram.h +++ b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_ram.h @@ -9,5 +9,13 @@ #define CYGMEM_REGION_ram_SIZE (0x01000000) #define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) extern char CYG_LABEL_NAME (_reserved) []; -#define CYGMEM_SECTION_reserved (CYG_LABEL_NAME (_reserved)) -#define CYGMEM_SECTION_reserved_SIZE (0x8000) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xf00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_ram.ldi b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_ram.ldi --- a/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_ram.ldi +++ b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_ram.ldi @@ -2,6 +2,8 @@ // This is a generated file - do not edit +#include + MEMORY { ram : ORIGIN = 0, LENGTH = 0x01000000 @@ -10,15 +12,19 @@ MEMORY SECTIONS { SECTIONS_BEGIN - __reserved = 0; . = __reserved + 0x8000; - SECTION_rom_vectors (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x40000, LMA_EQ_VMA) + SECTION_RELOCS (ram, ALIGN (0x1), LMA_EQ_VMA) SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_got (ram, ALIGN (0x4), LMA_EQ_VMA) SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0xf00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; SECTIONS_END } diff --git a/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_rom.h b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_rom.h --- a/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_rom.h +++ b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_rom.h @@ -11,6 +11,14 @@ #define CYGMEM_REGION_rom (0x24000000) #define CYGMEM_REGION_rom_SIZE (0x02000000) #define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) -extern char CYG_LABEL_NAME (_reserved) []; -#define CYGMEM_SECTION_reserved (CYG_LABEL_NAME (_reserved)) -#define CYGMEM_SECTION_reserved_SIZE (0x800) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xf00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) + diff --git a/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_rom.ldi b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_rom.ldi --- a/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_rom.ldi +++ b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_rom.ldi @@ -2,6 +2,8 @@ // This is a generated file - do not edit +#include + MEMORY { ram : ORIGIN = 0, LENGTH = 0x01000000 @@ -16,10 +18,13 @@ SECTIONS SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_got (rom, ALIGN (0x4), LMA_EQ_VMA) SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) - __reserved = 0; . = __reserved + 0x800; + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) SECTION_data (ram, ALIGN (0x4), FOLLOWING (.gcc_except_table)) SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0xf00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; SECTIONS_END } diff --git a/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_romram.h b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_romram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_romram.h @@ -0,0 +1,21 @@ +// eCos memory layout - Tue Feb 29 14:11:30 2000 + +// This is a generated file - do not edit + +#include +#include + +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x01000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +extern char CYG_LABEL_NAME (_reserved) []; +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xf00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_romram.ldi b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_romram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/integrator/current/include/pkgconf/mlt_arm_integrator_romram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Tue Feb 29 14:11:30 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x01000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x00000000, LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x00000020, LMA_EQ_VMA) + SECTION_RELOCS (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_got (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0xf00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; + SECTIONS_END +} diff --git a/packages/hal/arm/integrator/current/include/plf_io.h b/packages/hal/arm/integrator/current/include/plf_io.h --- a/packages/hal/arm/integrator/current/include/plf_io.h +++ b/packages/hal/arm/integrator/current/include/plf_io.h @@ -8,29 +8,38 @@ // Platform specific IO support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -49,138 +58,12 @@ #include -#include // IO macros #include // Interrupt vectors +__externC void cyg_plf_pci_init(void); + // Initialization of the PCI bus. -#define HAL_PCI_INIT() \ - CYG_MACRO_START \ - volatile int i, j; \ - \ - /* setting this register will take the V3 out of reset */ \ - \ - *(cyg_uint32 *)(INTEGRATOR_SC_PCIENABLE) = 1; \ - \ - /* wait a few usecs to settle the device and the PCI bus */ \ - \ - for (i = 0; i < 100 ; i++) \ - j = i + 1; \ - \ - /* Now write the Base I/O Address Word to V3_BASE + 0x6C */ \ - \ - *(cyg_uint16 *)(V3_BASE + V3_LB_IO_BASE) = (cyg_uint16)(V3_BASE >> 16); \ - \ - do { \ - *(cyg_uint8 *)(V3_BASE + V3_MAIL_DATA) = 0xAA; \ - *(cyg_uint8 *)(V3_BASE + V3_MAIL_DATA + 4) = 0x55; \ - } while (*(cyg_uint8 *)(V3_BASE + V3_MAIL_DATA) != 0xAA || \ - *(cyg_uint8 *)(V3_BASE + V3_MAIL_DATA + 4) != 0x55); \ - \ - /* Make sure that V3 register access is not locked, if it is, unlock it */ \ - \ - if ((*(cyg_uint16 *)(V3_BASE + V3_SYSTEM) & V3_SYSTEM_M_LOCK) \ - == V3_SYSTEM_M_LOCK) \ - *(cyg_uint16 *)(V3_BASE + V3_SYSTEM) = 0xA05F; \ - \ - /* Ensure that the slave accesses from PCI are disabled while we */ \ - /* setup windows */ \ - \ - *(cyg_uint16 *)(V3_BASE + V3_PCI_CMD) &= \ - ~(V3_COMMAND_M_MEM_EN | V3_COMMAND_M_IO_EN); \ - \ - /* Clear RST_OUT to 0; keep the PCI bus in reset until we've finished */ \ - \ - *(cyg_uint16 *)(V3_BASE + V3_SYSTEM) &= ~V3_SYSTEM_M_RST_OUT; \ - \ - /* Make all accesses from PCI space retry until we're ready for them */ \ - \ - *(cyg_uint16 *)(V3_BASE + V3_PCI_CFG) |= V3_PCI_CFG_M_RETRY_EN; \ - \ - /* Set up any V3 PCI Configuration Registers that we absolutely have to */ \ - /* LB_CFG controls Local Bus protocol. */ \ - /* Enable LocalBus byte strobes for READ accesses too. */ \ - /* set bit 7 BE_IMODE and bit 6 BE_OMODE */ \ - \ - *(cyg_uint16 *)(V3_BASE + V3_LB_CFG) |= 0x0C0; \ - \ - /* PCI_CMD controls overall PCI operation. */ \ - /* Enable PCI bus master. */ \ - \ - *(cyg_uint16 *)(V3_BASE + V3_PCI_CMD) |= 0x04; \ - \ - /* PCI_MAP0 controls where the PCI to CPU memory window is on Local Bus*/ \ - \ - *(cyg_uint32 *)(V3_BASE + V3_PCI_MAP0) = (INTEGRATOR_BOOT_ROM_BASE) | \ - (V3_PCI_MAP_M_ADR_SIZE_512M | \ - V3_PCI_MAP_M_REG_EN | \ - V3_PCI_MAP_M_ENABLE); \ - \ - /* PCI_BASE0 is the PCI address of the start of the window */ \ - \ - *(cyg_uint32 *)(V3_BASE + V3_PCI_BASE0) = INTEGRATOR_BOOT_ROM_BASE; \ - \ - /* PCI_MAP1 is LOCAL address of the start of the window */ \ - \ - *(cyg_uint32 *)(V3_BASE + V3_PCI_MAP1) = (INTEGRATOR_HDR0_SDRAM_BASE) | \ - (V3_PCI_MAP_M_ADR_SIZE_1024M | V3_PCI_MAP_M_REG_EN | \ - V3_PCI_MAP_M_ENABLE); \ - \ - /* PCI_BASE1 is the PCI address of the start of the window */ \ - \ - *(cyg_uint32 *)(V3_BASE + V3_PCI_BASE1) = INTEGRATOR_HDR0_SDRAM_BASE; \ - \ - /* Set up the windows from local bus memory into PCI configuration, */ \ - /* I/O and Memory. */ \ - /* PCI I/O, LB_BASE2 and LB_MAP2 are used exclusively for this. */ \ - \ - *(cyg_uint16 *)(V3_BASE +V3_LB_BASE2) = \ - ((CPU_PCI_IO_ADRS >> 24) << 8) | V3_LB_BASE_M_ENABLE; \ - *(cyg_uint16 *)(V3_BASE + V3_LB_MAP2) = 0; \ - \ - /* PCI Configuration, use LB_BASE1/LB_MAP1. */ \ - \ - /* PCI Memory use LB_BASE0/LB_MAP0 and LB_BASE1/LB_MAP1 */ \ - /* Map first 256Mbytes as non-prefetchable via BASE0/MAP0 */ \ - /* (INTEGRATOR_PCI_BASE == PCI_MEM_BASE) */ \ - \ - *(cyg_uint32 *)(V3_BASE + V3_LB_BASE0) = \ - INTEGRATOR_PCI_BASE | (0x80 | V3_LB_BASE_M_ENABLE); \ - \ - *(cyg_uint16 *)(V3_BASE + V3_LB_MAP0) = \ - ((INTEGRATOR_PCI_BASE >> 20) << 0x4) | 0x0006; \ - \ - /* Map second 256 Mbytes as prefetchable via BASE1/MAP1 */ \ - \ - *(cyg_uint32 *)(V3_BASE + V3_LB_BASE1) = \ - INTEGRATOR_PCI_BASE | (0x84 | V3_LB_BASE_M_ENABLE); \ - \ - *(cyg_uint16 *)(V3_BASE + V3_LB_MAP1) = \ - (((INTEGRATOR_PCI_BASE + SZ_256M) >> 20) << 4) | 0x0006;\ - \ - /* Allow accesses to PCI Configuration space */ \ - /* and set up A1, A0 for type 1 config cycles */ \ - \ - *(cyg_uint16 *)(V3_BASE + V3_PCI_CFG) = \ - ((*(cyg_uint16 *)(V3_BASE + V3_PCI_CFG)) & \ - ~(V3_PCI_CFG_M_RETRY_EN | V3_PCI_CFG_M_AD_LOW1) ) | \ - V3_PCI_CFG_M_AD_LOW0; \ - \ - /* now we can allow in PCI MEMORY accesses */ \ - \ - *(cyg_uint16 *)(V3_BASE + V3_PCI_CMD) = \ - (*(cyg_uint16 *)(V3_BASE + V3_PCI_CMD)) | V3_COMMAND_M_MEM_EN; \ - \ - /* Set RST_OUT to take the PCI bus is out of reset, PCI devices can */ \ - /* initialise and lock the V3 system register so that no one else */ \ - /* can play with it */ \ - \ - *(cyg_uint16 *)(V3_BASE + V3_SYSTEM) = \ - (*(cyg_uint16 *)(V3_BASE + V3_SYSTEM)) | V3_SYSTEM_M_RST_OUT; \ - \ - *(cyg_uint16 *)(V3_BASE + V3_SYSTEM) = \ - (*(cyg_uint16 *)(V3_BASE + V3_SYSTEM)) | V3_SYSTEM_M_LOCK; \ - \ - CYG_MACRO_END +#define HAL_PCI_INIT() cyg_plf_pci_init() // V3 access routines @@ -267,22 +150,23 @@ #define HAL_PCI_CFG_READ_UINT8( __bus, __devfn, __offset, __val ) \ { \ _V3OpenConfigWindow(); \ - __val = *(cyg_uint8 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset); \ + __val = *(volatile cyg_uint8 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset); \ _V3CloseConfigWindow(); \ } #define HAL_PCI_CFG_READ_UINT16( __bus, __devfn, __offset, __val ) \ { \ _V3OpenConfigWindow(); \ - __val = *(cyg_uint16 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset); \ + __val = *(volatile cyg_uint16 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset); \ _V3CloseConfigWindow(); \ } -#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \ - { \ - _V3OpenConfigWindow(); \ - __val = *(cyg_uint32 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset); \ - _V3CloseConfigWindow(); \ +#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \ + { \ + _V3OpenConfigWindow(); \ + __val = *(volatile cyg_uint16 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset); \ + __val |= (*(volatile cyg_uint16 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, (__offset+2)))<<16; \ + _V3CloseConfigWindow(); \ } // Write a value to the PCI configuration space of the appropriate @@ -290,22 +174,23 @@ #define HAL_PCI_CFG_WRITE_UINT8( __bus, __devfn, __offset, __val ) \ { \ _V3OpenConfigWindow(); \ - *(cyg_uint8 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset) = __val; \ + *(volatile cyg_uint8 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset) = __val; \ _V3CloseConfigWindow(); \ } #define HAL_PCI_CFG_WRITE_UINT16( __bus, __devfn, __offset, __val ) \ { \ _V3OpenConfigWindow(); \ - *(cyg_uint16 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset) = __val; \ + *(volatile cyg_uint16 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset) = __val; \ _V3CloseConfigWindow(); \ } -#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \ - { \ - _V3OpenConfigWindow(); \ - *(cyg_uint32 *)HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset) = __val; \ - _V3CloseConfigWindow(); \ +#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \ + { \ + _V3OpenConfigWindow(); \ + *(volatile cyg_uint16 *)HAL_PCI_CONFIG_ADDRESS((__bus), (__devfn), (__offset)) = ((__val) & 0xFFFF); \ + *(volatile cyg_uint16 *)HAL_PCI_CONFIG_ADDRESS((__bus), (__devfn), ((__offset)+2)) = (((__val)>>16) & 0xFFFF); \ + _V3CloseConfigWindow(); \ } //----------------------------------------------------------------------------- @@ -358,5 +243,9 @@ CYG_MACRO_END //----------------------------------------------------------------------------- + +#define CYGARC_PHYSICAL_ADDRESS(x) (x) + +//----------------------------------------------------------------------------- // end of plf_io.h #endif // CYGONCE_PLF_IO_H diff --git a/packages/hal/arm/integrator/current/include/plf_stub.h b/packages/hal/arm/integrator/current/include/plf_stub.h --- a/packages/hal/arm/integrator/current/include/plf_stub.h +++ b/packages/hal/arm/integrator/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -68,8 +77,23 @@ externC void cyg_hal_plf_comms_init(void //---------------------------------------------------------------------------- // Stub initializer. + #define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT +//---------------------------------------------------------------------------- +// Memory access checks. + +// Addresses in the range 0x30000000-0x3fffffff cause the CPU to just +// hang - no timeout, no exception. These macros allow GDB to avoid +// making accidental accesses to this area. + +#define CYG_HAL_STUB_PERMIT_DATA_READ(_addr_, _count_) \ +( ((CYG_ADDRESS)(_addr_) > 0x3fffffff) || ((((CYG_ADDRESS)(_addr_))+(_count_))< 0x30000000) ) + +#define CYG_HAL_STUB_PERMIT_DATA_WRITE(_addr_, __count_) \ + CYG_HAL_STUB_PERMIT_DATA_READ(_addr_, _count_) + + #endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS //----------------------------------------------------------------------------- diff --git a/packages/hal/arm/integrator/current/misc/redboot_RAM.ecm b/packages/hal/arm/integrator/current/misc/redboot_RAM.ecm --- a/packages/hal/arm/integrator/current/misc/redboot_RAM.ecm +++ b/packages/hal/arm/integrator/current/misc/redboot_RAM.ecm @@ -11,15 +11,6 @@ cdl_configuration eCos { description "" ; hardware integrator ; template redboot ; - package -hardware CYGPKG_HAL_ARM current ; - package -hardware CYGPKG_HAL_ARM_INTEGRATOR current ; - package -hardware CYGPKG_IO_PCI current ; - package -hardware CYGPKG_DEVS_ETH_ARM_INTEGRATOR current ; - package -hardware CYGPKG_IO_SERIAL_ARM_INTEGRATOR current ; - package -hardware CYGPKG_DEVS_FLASH_INTEGRATOR current ; - package -template CYGPKG_HAL current ; - package -template CYGPKG_INFRA current ; - package -template CYGPKG_REDBOOT current ; package CYGPKG_IO_FLASH current ; package CYGPKG_IO_ETH_DRIVERS current ; }; @@ -48,10 +39,6 @@ cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SU inferred_value 0 }; -cdl_option CYGSEM_HAL_VIRTUAL_VECTOR_DIAG { - user_value 1 -}; - cdl_option CYGSEM_HAL_USE_ROM_MONITOR { inferred_value 0 0 }; diff --git a/packages/hal/arm/integrator/current/misc/redboot_ROM.ecm b/packages/hal/arm/integrator/current/misc/redboot_ROM.ecm --- a/packages/hal/arm/integrator/current/misc/redboot_ROM.ecm +++ b/packages/hal/arm/integrator/current/misc/redboot_ROM.ecm @@ -11,15 +11,6 @@ cdl_configuration eCos { description "" ; hardware integrator ; template redboot ; - package -hardware CYGPKG_HAL_ARM current ; - package -hardware CYGPKG_HAL_ARM_INTEGRATOR current ; - package -hardware CYGPKG_IO_PCI current ; - package -hardware CYGPKG_DEVS_ETH_ARM_INTEGRATOR current ; - package -hardware CYGPKG_IO_SERIAL_ARM_INTEGRATOR current ; - package -hardware CYGPKG_DEVS_FLASH_INTEGRATOR current ; - package -template CYGPKG_HAL current ; - package -template CYGPKG_INFRA current ; - package -template CYGPKG_REDBOOT current ; package CYGPKG_IO_FLASH current ; package CYGPKG_IO_ETH_DRIVERS current ; }; @@ -48,10 +39,6 @@ cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SU inferred_value 0 }; -#cdl_option CYGSEM_HAL_VIRTUAL_VECTOR_DIAG { -# user_value 1 -#}; - cdl_option CYGSEM_HAL_ROM_MONITOR { user_value 1 }; diff --git a/packages/hal/arm/integrator/current/misc/redboot_ROMRAM.ecm b/packages/hal/arm/integrator/current/misc/redboot_ROMRAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/integrator/current/misc/redboot_ROMRAM.ecm @@ -0,0 +1,112 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware integrator ; + template redboot ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROMRAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + inferred_value 0x00040000 +}; + +cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP { + inferred_value 0 +}; + +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; diff --git a/packages/hal/arm/integrator/current/src/Notes_GDB_stub b/packages/hal/arm/integrator/current/src/Notes_GDB_stub --- a/packages/hal/arm/integrator/current/src/Notes_GDB_stub +++ b/packages/hal/arm/integrator/current/src/Notes_GDB_stub @@ -1,27 +1,36 @@ =========================================================================== -####COPYRIGHTBEGIN#### - - ------------------------------------------- - The contents of this file are subject to the Red Hat eCos Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.redhat.com/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations under - the License. - - The Original Code is eCos - Embedded Configurable Operating System, - released September 30, 1998. - - The Initial Developer of the Original Code is Red Hat. - Portions created by Red Hat are - Copyright (C) 1998, 1999, 2000 Red Hat, Inc. - All Rights Reserved. - ------------------------------------------- - -####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### =========================================================================== How to build and install the GDB module on ARM Integrator diff --git a/packages/hal/arm/integrator/current/src/flash.c b/packages/hal/arm/integrator/current/src/flash.c --- a/packages/hal/arm/integrator/current/src/flash.c +++ b/packages/hal/arm/integrator/current/src/flash.c @@ -5,29 +5,38 @@ // ARM INTEGRATOR A/P FLASH program tool // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/integrator/current/src/hal_diag.c b/packages/hal/arm/integrator/current/src/hal_diag.c --- a/packages/hal/arm/integrator/current/src/hal_diag.c +++ b/packages/hal/arm/integrator/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -307,12 +316,15 @@ cyg_hal_plf_serial_isr(void *__ch_data, int res = 0; channel_data_t* chan = (channel_data_t*)__ch_data; char c; + cyg_uint32 status; CYGARC_HAL_SAVE_GP(); cyg_drv_interrupt_acknowledge(chan->isr_vector); *__ctrlc = 0; - if ( !RX_EMPTY(chan->base) ) { + status = GET_STATUS(chan->base); + + if ( RX_DATA(status) ) { c = GET_CHAR(chan->base); if( cyg_hal_is_break( &c , 1 ) ) @@ -367,6 +379,8 @@ cyg_hal_plf_serial_init(void) // Restore original console CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); + + } void @@ -433,237 +447,10 @@ hal_diag_alpha_led_char(char c1, char c2 } hal_diag_alpha_led(current); + } #endif // CYGHWR_HAL_ARM_INTEGRATOR_DIAG_LEDS -//============================================================================= -// Compatibility with older stubs -//============================================================================= -#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG - -#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS -#include // cyg_hal_gdb_interrupt -#endif - -#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL==0 -// This is the base address of the A-channel -#define CYG_DEVICE_SERIAL_BASE INTEGRATOR_UART0_BASE -#define CYG_DEVICE_SERIAL_INT 1 -#else -// This is the base address of the B-channel -#define CYG_DEVICE_SERIAL_BASE INTEGRATOR_UART1_BASE -#define CYG_DEVICE_SERIAL_INT 2 -#endif - -static channel_data_t integrator_ser_channel = { - (cyg_uint8*)CYG_DEVICE_SERIAL_BASE, 0, CYG_DEVICE_SERIAL_INT -}; - -// Assumption: all diagnostic output must be GDB packetized unless this is a ROM (i.e. -// totally stand-alone) system. - -#if defined(CYG_HAL_STARTUP_ROM) || !defined(CYGDBG_HAL_DIAG_TO_DEBUG_CHAN) -#define HAL_DIAG_USES_HARDWARE -#endif - -#ifndef HAL_DIAG_USES_HARDWARE -#if (CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL != CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL) -#define HAL_DIAG_USES_HARDWARE -#endif -#endif - -#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT2 -// Attempt to provide CtrlC support? -static cyg_interrupt gdb_interrupt; -static cyg_handle_t gdb_interrupt_handle; - -// This ISR is called only for serial receive interrupts. -int -cyg_hal_gdb_isr(cyg_vector_t vector, cyg_addrword_t data, HAL_SavedRegisters *regs) -{ - cyg_uint8 c; - - hal_diag_read_char(&c); // Fetch the character - cyg_drv_interrupt_acknowledge(CYG_DEVICE_SERIAL_INT); - if( 3 == c ) { // ^C - // Ctrl-C: set a breakpoint at PC so GDB will display the - // correct program context when stopping rather than the - // interrupt handler. - cyg_hal_gdb_interrupt (regs->pc); - } - return 0; // No need to run DSR -} - -int -cyg_hal_gdb_isr_attach(void) -{ - cyg_drv_interrupt_create(CYG_DEVICE_SERIAL_INT, - 99, // Priority - what goes here? - 0, // Data item passed to interrupt handler - cyg_hal_gdb_isr, - 0, - &gdb_interrupt_handle, - &gdb_interrupt); - cyg_drv_interrupt_attach(gdb_interrupt_handle); -} -#endif // CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT - -#ifdef HAL_DIAG_USES_HARDWARE - -void hal_diag_init(void) -{ - static int init = 0; - int i; - char *msg = "\n\rARM eCos\n\r"; - - if (init++) return; - - cyg_hal_plf_serial_init_channel(&integrator_ser_channel); - - while (*msg) { - cyg_hal_plf_serial_putc(&integrator_ser_channel, *msg++); - for (i=0; i < 1000; i++) ; - } -} - -#ifdef DEBUG_DIAG -#ifndef CYG_HAL_STARTUP_ROM -#define DIAG_BUFSIZE 2048 -static char diag_buffer[DIAG_BUFSIZE]; -static int diag_bp = 0; -#endif // CYG_HAL_STARTUP_ROM -#endif // DEBUG_DIAG - -void hal_diag_write_char(char c) -{ - hal_diag_init(); - - cyg_hal_plf_serial_putc(&integrator_ser_channel, c); - -#ifdef DEBUG_DIAG - diag_buffer[diag_bp++] = c; - if (diag_bp == DIAG_BUFSIZE) diag_bp = 0; -#endif -} - -void hal_diag_read_char(char *c) -{ - *c = cyg_hal_plf_serial_getc(&integrator_ser_channel); -} - -#else // HAL_DIAG relies on GDB - -// Initialize diag port - assume GDB channel is already set up -void hal_diag_init(void) -{ - if (0) cyg_hal_plf_serial_init_channel(&integrator_ser_channel); // avoid warning -} - -// Actually send character down the wire -static void -hal_diag_write_char_serial(char c) -{ - hal_diag_init(); - - cyg_hal_plf_serial_putc(&integrator_ser_channel, c); -} - -static bool -hal_diag_read_serial(char *c) -{ - return cyg_hal_plf_serial_getc_nonblock(&integrator_ser_channel, c); -} - -void -hal_diag_read_char(char *c) -{ - while (!hal_diag_read_serial(c)) ; -} - -void -hal_diag_write_char(char c) -{ - static char line[100]; - static int pos = 0; - - // No need to send CRs - if( c == '\r' ) return; - - line[pos++] = c; - - if( c == '\n' || pos == sizeof(line) ) - { - CYG_INTERRUPT_STATE old; - - // Disable interrupts. This prevents GDB trying to interrupt us - // while we are in the middle of sending a packet. The serial - // receive interrupt will be seen when we re-enable interrupts - // later. - -#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS - CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old); -#else - HAL_DISABLE_INTERRUPTS(old); -#endif - - while(1) - { - static char hex[] = "0123456789ABCDEF"; - cyg_uint8 csum = 0; - int i; - char c1; - - hal_diag_write_char_serial('$'); - hal_diag_write_char_serial('O'); - csum += 'O'; - for( i = 0; i < pos; i++ ) - { - char ch = line[i]; - char h = hex[(ch>>4)&0xF]; - char l = hex[ch&0xF]; - hal_diag_write_char_serial(h); - hal_diag_write_char_serial(l); - csum += h; - csum += l; - } - hal_diag_write_char_serial('#'); - hal_diag_write_char_serial(hex[(csum>>4)&0xF]); - hal_diag_write_char_serial(hex[csum&0xF]); - - // Wait for the ACK character '+' from GDB here and handle - // receiving a ^C instead. This is the reason for this clause - // being a loop. - if (!hal_diag_read_serial(&c1)) - continue; // No response - try sending packet again - - if( c1 == '+' ) - break; // a good acknowledge - -#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT - cyg_drv_interrupt_acknowledge(CYG_DEVICE_SERIAL_INT); - if( c1 == 3 ) { - // Ctrl-C: breakpoint. - cyg_hal_gdb_interrupt ((target_register_t)__builtin_return_address(0)); - break; - } -#endif - // otherwise, loop round again - } - - pos = 0; - - // And re-enable interrupts -#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS - CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old); -#else - HAL_RESTORE_INTERRUPTS(old); -#endif - - } -} -#endif - -#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG /*---------------------------------------------------------------------------*/ /* End of hal_diag.c */ diff --git a/packages/hal/arm/integrator/current/src/integrator_misc.c b/packages/hal/arm/integrator/current/src/integrator_misc.c --- a/packages/hal/arm/integrator/current/src/integrator_misc.c +++ b/packages/hal/arm/integrator/current/src/integrator_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for ARM INTEGRATOR7 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -91,17 +100,61 @@ void hal_clock_read(cyg_uint32 *pvalue) // and decreases } +// Delay for some usecs. +void hal_delay_us(cyg_uint32 delay) +{ +#if 0 + int i; + for( i = 0; i < delay; i++ ); + +#else + cyg_uint32 now, last, diff, ticks; + + // The timer actually runs at 1.25 ticks per micrsecond. + // Adjust the supplied delay to compensate. + + delay *= 4; + delay /= 5; + + hal_clock_read(&last); + diff = ticks = 0; + + while (delay > ticks) { + hal_clock_read(&now); + + // Cope with wrap-around of timer + if (now < last) + diff = ((_period - last) + now); + else + diff = (now - last); + + last = now; + + ticks += diff; + } +#endif +} + + +#if defined(CYGPKG_HAL_ARM_INTEGRATOR_ARM7) void hal_hardware_init(void) +#elif defined(CYGPKG_HAL_ARM_INTEGRATOR_ARM9) +void plf_hardware_init(void) +#endif { // Any hardware/platform initialization that needs to be done. // Clear all interrupt sources HAL_WRITE_UINT32(CYG_DEVICE_IRQ_EnableClear, 0xFFFF); +#ifndef CYGFUN_HAL_COMMON_KERNEL_SUPPORT + HAL_CLOCK_INITIALIZE( CYGNUM_HAL_RTC_PERIOD ); +#endif + // FIXME: The line with the thumb check is a hack, allowing // the farm to run test. Problem is that virtual vector table // API needs to be ARM/Thumb consistent. Will fix later. -#ifndef __thumb__ +#if !defined(__thumb__) && !defined(CYGPKG_HAL_ARM_INTEGRATOR_ARM9) // Set up eCos/ROM interfaces hal_if_init(); #endif @@ -173,6 +226,143 @@ void hal_show_IRQ(int vector, int data, { // diag_printf("IRQ - vector: %x, data: %x, handler: %x\n", vector, data, handler); } - + +/*---------------------------------------------------------------------------*/ + +__externC void cyg_plf_pci_init(void) +{ + // Only do this for non-RAM startups. If we do it during RAM + // startup and we are using the ethernet for debugging, this kills + // the ethernet controller. +#ifndef CYG_HAL_STARTUP_RAM + + volatile int i, j; + + /* setting this register will take the V3 out of reset */ + + *(volatile cyg_uint32 *)(INTEGRATOR_SC_PCIENABLE) = 1; + + /* wait a few usecs to settle the device and the PCI bus */ + + for (i = 0; i < 100 ; i++) + j = i + 1; + + /* Now write the Base I/O Address Word to V3_BASE + 0x6C */ + + *(volatile cyg_uint16 *)(V3_BASE + V3_LB_IO_BASE) = (cyg_uint16)(V3_BASE >> 16); + + do { + *(volatile cyg_uint8 *)(V3_BASE + V3_MAIL_DATA) = 0xAA; + *(volatile cyg_uint8 *)(V3_BASE + V3_MAIL_DATA + 4) = 0x55; + } while (*(volatile cyg_uint8 *)(V3_BASE + V3_MAIL_DATA) != 0xAA || + *(volatile cyg_uint8 *)(V3_BASE + V3_MAIL_DATA + 4) != 0x55); + + /* Make sure that V3 register access is not locked, if it is, unlock it */ + + if ((*(volatile cyg_uint16 *)(V3_BASE + V3_SYSTEM) & V3_SYSTEM_M_LOCK) + == V3_SYSTEM_M_LOCK) + *(volatile cyg_uint16 *)(V3_BASE + V3_SYSTEM) = 0xA05F; + + /* Ensure that the slave accesses from PCI are disabled while we */ + /* setup windows */ + + *(volatile cyg_uint16 *)(V3_BASE + V3_PCI_CMD) &= + ~(V3_COMMAND_M_MEM_EN | V3_COMMAND_M_IO_EN); + + /* Clear RST_OUT to 0; keep the PCI bus in reset until we've finished */ + + *(volatile cyg_uint16 *)(V3_BASE + V3_SYSTEM) &= ~V3_SYSTEM_M_RST_OUT; + + /* Make all accesses from PCI space retry until we're ready for them */ + + *(volatile cyg_uint16 *)(V3_BASE + V3_PCI_CFG) |= V3_PCI_CFG_M_RETRY_EN; + + /* Set up any V3 PCI Configuration Registers that we absolutely have to */ + /* LB_CFG controls Local Bus protocol. */ + /* Enable LocalBus byte strobes for READ accesses too. */ + /* set bit 7 BE_IMODE and bit 6 BE_OMODE */ + + *(volatile cyg_uint16 *)(V3_BASE + V3_LB_CFG) |= 0x0C0; + + /* PCI_CMD controls overall PCI operation. */ + /* Enable PCI bus master. */ + + *(volatile cyg_uint16 *)(V3_BASE + V3_PCI_CMD) |= 0x04; + + /* PCI_MAP0 controls where the PCI to CPU memory window is on Local Bus*/ + + *(volatile cyg_uint32 *)(V3_BASE + V3_PCI_MAP0) = (INTEGRATOR_BOOT_ROM_BASE) | + (V3_PCI_MAP_M_ADR_SIZE_512M | + V3_PCI_MAP_M_REG_EN | + V3_PCI_MAP_M_ENABLE); + + /* PCI_BASE0 is the PCI address of the start of the window */ + + *(volatile cyg_uint32 *)(V3_BASE + V3_PCI_BASE0) = INTEGRATOR_BOOT_ROM_BASE; + + /* PCI_MAP1 is LOCAL address of the start of the window */ + + *(volatile cyg_uint32 *)(V3_BASE + V3_PCI_MAP1) = (INTEGRATOR_HDR0_SDRAM_BASE) | + (V3_PCI_MAP_M_ADR_SIZE_1024M | V3_PCI_MAP_M_REG_EN | + V3_PCI_MAP_M_ENABLE); + + /* PCI_BASE1 is the PCI address of the start of the window */ + + *(volatile cyg_uint32 *)(V3_BASE + V3_PCI_BASE1) = INTEGRATOR_HDR0_SDRAM_BASE; + + /* Set up the windows from local bus memory into PCI configuration, */ + /* I/O and Memory. */ + /* PCI I/O, LB_BASE2 and LB_MAP2 are used exclusively for this. */ + + *(volatile cyg_uint16 *)(V3_BASE +V3_LB_BASE2) = + ((CPU_PCI_IO_ADRS >> 24) << 8) | V3_LB_BASE_M_ENABLE; + *(volatile cyg_uint16 *)(V3_BASE + V3_LB_MAP2) = 0; + + /* PCI Configuration, use LB_BASE1/LB_MAP1. */ + + /* PCI Memory use LB_BASE0/LB_MAP0 and LB_BASE1/LB_MAP1 */ + /* Map first 256Mbytes as non-prefetchable via BASE0/MAP0 */ + /* (INTEGRATOR_PCI_BASE == PCI_MEM_BASE) */ + + *(volatile cyg_uint32 *)(V3_BASE + V3_LB_BASE0) = + INTEGRATOR_PCI_BASE | (0x80 | V3_LB_BASE_M_ENABLE); + + *(volatile cyg_uint16 *)(V3_BASE + V3_LB_MAP0) = + ((INTEGRATOR_PCI_BASE >> 20) << 0x4) | 0x0006; + + /* Map second 256 Mbytes as prefetchable via BASE1/MAP1 */ + + *(volatile cyg_uint32 *)(V3_BASE + V3_LB_BASE1) = + INTEGRATOR_PCI_BASE | (0x84 | V3_LB_BASE_M_ENABLE); + + *(volatile cyg_uint16 *)(V3_BASE + V3_LB_MAP1) = + (((INTEGRATOR_PCI_BASE + SZ_256M) >> 20) << 4) | 0x0006; + + /* Allow accesses to PCI Configuration space */ + /* and set up A1, A0 for type 1 config cycles */ + + *(volatile cyg_uint16 *)(V3_BASE + V3_PCI_CFG) = + ((*(volatile cyg_uint16 *)(V3_BASE + V3_PCI_CFG)) & + ~(V3_PCI_CFG_M_RETRY_EN | V3_PCI_CFG_M_AD_LOW1) ) | + V3_PCI_CFG_M_AD_LOW0; + + /* now we can allow in PCI MEMORY accesses */ + + *(volatile cyg_uint16 *)(V3_BASE + V3_PCI_CMD) = + (*(volatile cyg_uint16 *)(V3_BASE + V3_PCI_CMD)) | V3_COMMAND_M_MEM_EN; + + /* Set RST_OUT to take the PCI bus is out of reset, PCI devices can */ + /* initialise and lock the V3 system register so that no one else */ + /* can play with it */ + + *(volatile cyg_uint16 *)(V3_BASE + V3_SYSTEM) = + (*(volatile cyg_uint16 *)(V3_BASE + V3_SYSTEM)) | V3_SYSTEM_M_RST_OUT; + + *(volatile cyg_uint16 *)(V3_BASE + V3_SYSTEM) = + (*(volatile cyg_uint16 *)(V3_BASE + V3_SYSTEM)) | V3_SYSTEM_M_LOCK; + +#endif +} + /*---------------------------------------------------------------------------*/ /* End of hal_misc.c */ diff --git a/packages/hal/arm/integrator/current/src/prog_flash.c b/packages/hal/arm/integrator/current/src/prog_flash.c --- a/packages/hal/arm/integrator/current/src/prog_flash.c +++ b/packages/hal/arm/integrator/current/src/prog_flash.c @@ -5,29 +5,38 @@ // ARM INTEGRATOR eval board FLASH program tool // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/ChangeLog b/packages/hal/arm/iq80310/current/ChangeLog --- a/packages/hal/arm/iq80310/current/ChangeLog +++ b/packages/hal/arm/iq80310/current/ChangeLog @@ -1,3 +1,66 @@ +2002-05-14 Jesper Skov + + * include/plf_io.h (CYGARC_VIRT_TO_BUS, CYGARC_UNCACHED_ADDRESS): + Fixed compiler warnings. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_iq80310.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-04-22 Jonathan Larmour + + * misc/redboot_RAM.ecm: Enable GDB remote file I/O support. + * misc/redboot_RAMA.ecm: Ditto. + * misc/redboot_ROM.ecm: Ditto. + * misc/redboot_ROMA.ecm: Ditto. + +2002-04-16 John Dallaway + + * cdl/hal_arm_iq80321.cdl: Use arm-elf toolchain by default. + +2002-03-06 Jesper Skov + + * misc/redboot_RAM.ecm: Added dns and zlib support. + * misc/redboot_ROM.ecm: Same. + +2002-02-22 Mark Salter + + * src/iq80310_misc.c (cyg_hal_plf_hw_breakpoint): Fix use of wrong reg. + +2002-02-06 Mark Salter + + * include/hal_platform_setup.h: Fix condition of some I2C bit tests. + +2002-02-04 Mark Salter + + * include/hal_platform_setup.h: Fix bad insns in I2C code. + +2002-01-28 Jesper Skov + + * src/iq80310_misc.c (hal_hardware_init): Fix warning. + + * cdl/hal_arm_iq80310.cdl: Removed explicit plf_io.h declaration. + +2002-01-16 Hugo Tyson + + * include/hal_platform_ints.h (HAL_CLOCK_REINITIALIZE): Better + names for macro args, and the freqency is now signed. -ve means + don't set the clock, just tell me what you would do. + + * src/iq80310_misc.c (hal_clock_reinitialize): Always return a + nearby good value; don't set h/w if <0. Convoluted logic changes + to support that. + +2002-01-14 Hugo Tyson + + * include/hal_platform_ints.h (HAL_CLOCK_REINITIALIZE): New macro + which calls the below, also a prototype for it. + + * src/iq80310_misc.c (hal_clock_reinitialize): New routine to + reset the clock to a different frequency. This is for GPROF type + profiling use only; not general purpose eCos usage. + 2002-01-04 Mark Salter * include/hal_platform_setup.h: Turn on ECC for uncached alias of RAM. @@ -299,27 +362,36 @@ 2000-11-04 Mark Salter " puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " - puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_IO_H " puts $::cdl_header "#define HAL_PLATFORM_CPU \"XScale\"" puts $::cdl_header "#define HAL_PLATFORM_BOARD \"IQ80310\"" puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" @@ -122,7 +130,7 @@ cdl_package CYGPKG_HAL_ARM_IQ80310 { active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE flavor data legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 - default_value 0 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT description " The EBSA285 board has only one serial port. This option chooses which port will be used for diagnostic output." @@ -184,7 +192,7 @@ cdl_package CYGPKG_HAL_ARM_IQ80310 { display "Global command prefix" flavor data no_define - default_value { "xscale-elf" } + default_value { "arm-elf" } description " This option specifies the command prefix used when invoking the build tools." @@ -194,7 +202,7 @@ cdl_package CYGPKG_HAL_ARM_IQ80310 { display "Global compiler flags" flavor data no_define - default_value { "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -mapcs-frame" } + default_value { "-mcpu=xscale -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -mapcs-frame" } description " This option controls the global compiler flags which are used to compile all packages by default. Individual packages may define @@ -205,7 +213,7 @@ cdl_package CYGPKG_HAL_ARM_IQ80310 { display "Global linker flags" flavor data no_define - default_value { "-Wl,--gc-sections -Wl,-static -g -O2 -nostdlib" } + default_value { "-mcpu=xscale -Wl,--gc-sections -Wl,-static -g -O2 -nostdlib" } description " This option controls the global linker flags. Individual packages may define options which override these global flags." diff --git a/packages/hal/arm/iq80310/current/include/hal_cache.h b/packages/hal/arm/iq80310/current/include/hal_cache.h --- a/packages/hal/arm/iq80310/current/include/hal_cache.h +++ b/packages/hal/arm/iq80310/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/include/hal_diag.h b/packages/hal/arm/iq80310/current/include/hal_diag.h --- a/packages/hal/arm/iq80310/current/include/hal_diag.h +++ b/packages/hal/arm/iq80310/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/include/hal_iq80310.h b/packages/hal/arm/iq80310/current/include/hal_iq80310.h --- a/packages/hal/arm/iq80310/current/include/hal_iq80310.h +++ b/packages/hal/arm/iq80310/current/include/hal_iq80310.h @@ -9,29 +9,38 @@ // and ARM memory control in general. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/include/hal_platform_ints.h b/packages/hal/arm/iq80310/current/include/hal_platform_ints.h --- a/packages/hal/arm/iq80310/current/include/hal_platform_ints.h +++ b/packages/hal/arm/iq80310/current/include/hal_platform_ints.h @@ -7,29 +7,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -137,4 +146,18 @@ extern void hal_delay_us(cyg_uint32 usec #define HAL_PLATFORM_RESET_ENTRY 0x00000000 +// ------------------------------------------------------------------------ +// Dynamically set the timer interrupt rate. +// Not for application use at all. + +externC void +hal_clock_reinitialize( int *pfreq, /* inout */ + unsigned int *pperiod, /* inout */ + unsigned int old_hz ); /* in */ + +#define HAL_CLOCK_REINITIALIZE( _freq, _period, _old_hz ) \ + hal_clock_reinitialize( &_freq, &_period, _old_hz ) + #endif // CYGONCE_HAL_PLATFORM_INTS_H + +// EOF hal_platform_ints.h diff --git a/packages/hal/arm/iq80310/current/include/hal_platform_setup.h b/packages/hal/arm/iq80310/current/include/hal_platform_setup.h --- a/packages/hal/arm/iq80310/current/include/hal_platform_setup.h +++ b/packages/hal/arm/iq80310/current/include/hal_platform_setup.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -362,10 +371,8 @@ cmp r1, r9 beq i2c_error // Kick out of SDRAM initialization if timeout occurs ldr r0, [r12] // Load I2C Status Reg into R0 - str r2, =ISR_EMPTY // Poll status register - and r3, r2, r0 // Bit #6 is checked: IDBR Transmit Empty - cmp r3, r2 // If bit = 0 then branch to 0 and check again - bne 0b + ands r3, r0, #ISR_EMPTY // Bit #6 is checked: IDBR Transmit Empty + beq 0b str r0, [r12] // Write back status to clear // *** Write pointer register on EEPROM to 0x00000000 *** @@ -387,10 +394,8 @@ cmp r1, r9 beq i2c_error // Kick out of SDRAM initialization if timeout occurs ldr r0, [r12] // Load I2C Status Reg into R0 - ld (r12), r10 - str r2, =ISR_EMPTY // Poll status register - and r3, r2, r0 // Bit #6 is checked: IDBR Transmit Empty - cmp r3, r2 // If bit = 0 then branch to 0 and check again (r3 = 0x00) - bne 0b + ands r3, r0, #ISR_EMPTY // Bit #6 is checked: IDBR Transmit Empty + beq 0b str r0, [r12] // Write back status to clear // *** Read SDRAM PD data *** @@ -415,10 +420,8 @@ cmp r1, r9 beq i2c_error // Kick out of SDRAM initialization if timeout occurs ldr r0, [r12] // Load I2C Status Reg into R0 - ld (r12), r10 - str r2, =ISR_EMPTY // Poll status register - and r3, r2, r0 // Bit #6 is checked: IDBR Transmit Empty - cmp r3, r2 // If bit = 0 then branch to 0 and check again (r3 = 0x00) - bne 0b + ands r3, r0, #ISR_EMPTY // Bit #6 is checked: IDBR Transmit Empty + beq 0b str r0, [r12] // Write back status to clear sdram_loop: @@ -445,10 +448,8 @@ cmp r1, r9 beq i2c_error // Kick out of SDRAM initialization if timeout occurs ldr r0, [r12] // Load I2C Status Reg into R0 - str r2, =ISR_FULL // Poll status register - and r3, r2, r0 // Bit #6 is checked: IDBR Transmit Empty - cmp r3, r2 // If bit = 0 then branch to 0 and check again - bne 0b + ands r3, r0, #ISR_FULL // Bit #6 is checked: IDBR Transmit Empty + beq 0b str r0, [r12] // Write back status to clear // Read the data byte diff --git a/packages/hal/arm/iq80310/current/include/plf_io.h b/packages/hal/arm/iq80310/current/include/plf_io.h --- a/packages/hal/arm/iq80310/current/include/plf_io.h +++ b/packages/hal/arm/iq80310/current/include/plf_io.h @@ -8,29 +8,38 @@ // Platform specific IO support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -198,9 +207,9 @@ externC void cyg_hal_plf_pci_init(void); // Some of SDRAM is aliased as uncached memory for drivers. #define CYGARC_UNCACHED_ADDRESS(_x_) \ - (((((unsigned long)(_x_)) >> 28)==0xA) ? (((unsigned long)(_x_))|0x40000000) : (_x_)) + (((((unsigned long)(_x_)) >> 28)==0xA) ? (((unsigned long)(_x_))|0x40000000) : (unsigned long)(_x_)) #define CYGARC_VIRT_TO_BUS(_x_) \ - (((((unsigned long)(_x_)) >> 28)==0xA) ? (_x_) : (((unsigned long)(_x_))&~0x40000000)) + (((((unsigned long)(_x_)) >> 28)==0xA) ? (unsigned long)(_x_) : (((unsigned long)(_x_))&~0x40000000)) //----------------------------------------------------------------------------- diff --git a/packages/hal/arm/iq80310/current/include/plf_stub.h b/packages/hal/arm/iq80310/current/include/plf_stub.h --- a/packages/hal/arm/iq80310/current/include/plf_stub.h +++ b/packages/hal/arm/iq80310/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/misc/redboot_RAM.ecm b/packages/hal/arm/iq80310/current/misc/redboot_RAM.ecm --- a/packages/hal/arm/iq80310/current/misc/redboot_RAM.ecm +++ b/packages/hal/arm/iq80310/current/misc/redboot_RAM.ecm @@ -16,19 +16,37 @@ cdl_configuration eCos { package -hardware CYGPKG_IO_PCI current ; package -hardware CYGPKG_DEVS_ETH_INTEL_I82559 current ; package -hardware CYGPKG_DEVS_ETH_ARM_IQ80310 current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; package -hardware CYGPKG_IO_SERIAL_ARM_IQ80310 current ; package -hardware CYGPKG_DEVS_FLASH_IQ80310 current ; package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_FLASH current ; package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; }; cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_IO_ETH_DRIVERS_NUM_PKT { + user_value 2 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { user_value 0 }; @@ -57,30 +75,58 @@ cdl_component CYG_HAL_STARTUP { user_value RAM }; -cdl_option CYGBLD_BUILD_REDBOOT { +cdl_component CYGBLD_BUILD_REDBOOT { user_value 1 }; -cdl_option CYGSEM_REDBOOT_FLASH_CONFIG { - user_value 1 -}; - -cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { - inferred_value 1 -}; - cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { - inferred_value 0x40000 + inferred_value 0x40000 }; -cdl_option CYGNUM_IO_ETH_DRIVERS_NUM_PKT { - user_value 2 +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 }; cdl_option CYGSEM_REDBOOT_FIS_CRC_CHECK { - user_value 0 + user_value 0 +}; + +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 }; cdl_option CYGSEM_IO_FLASH_VERIFY_PROGRAM { - user_value 0 + user_value 0 }; + +cdl_option CYGPKG_HAL_GDB_FILEIO { + user_value 1 +}; diff --git a/packages/hal/arm/iq80310/current/misc/redboot_RAMA.ecm b/packages/hal/arm/iq80310/current/misc/redboot_RAMA.ecm --- a/packages/hal/arm/iq80310/current/misc/redboot_RAMA.ecm +++ b/packages/hal/arm/iq80310/current/misc/redboot_RAMA.ecm @@ -88,3 +88,7 @@ cdl_option CYGSEM_REDBOOT_FIS_CRC_CHECK cdl_option CYGSEM_IO_FLASH_VERIFY_PROGRAM { user_value 0 }; + +cdl_option CYGPKG_HAL_GDB_FILEIO { + user_value 1 +}; diff --git a/packages/hal/arm/iq80310/current/misc/redboot_ROM.ecm b/packages/hal/arm/iq80310/current/misc/redboot_ROM.ecm --- a/packages/hal/arm/iq80310/current/misc/redboot_ROM.ecm +++ b/packages/hal/arm/iq80310/current/misc/redboot_ROM.ecm @@ -16,19 +16,37 @@ cdl_configuration eCos { package -hardware CYGPKG_IO_PCI current ; package -hardware CYGPKG_DEVS_ETH_INTEL_I82559 current ; package -hardware CYGPKG_DEVS_ETH_ARM_IQ80310 current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; package -hardware CYGPKG_IO_SERIAL_ARM_IQ80310 current ; package -hardware CYGPKG_DEVS_FLASH_IQ80310 current ; package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_FLASH current ; package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; }; cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_IO_ETH_DRIVERS_NUM_PKT { + user_value 2 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { user_value 0 }; @@ -61,30 +79,58 @@ cdl_component CYG_HAL_STARTUP { user_value ROM }; -cdl_option CYGBLD_BUILD_REDBOOT { +cdl_component CYGBLD_BUILD_REDBOOT { user_value 1 }; -cdl_option CYGSEM_REDBOOT_FLASH_CONFIG { - user_value 1 -}; - -cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { - inferred_value 1 -}; - cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { - inferred_value 0x40000 + inferred_value 0x40000 }; -cdl_option CYGNUM_IO_ETH_DRIVERS_NUM_PKT { - user_value 2 +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 }; cdl_option CYGSEM_REDBOOT_FIS_CRC_CHECK { - user_value 0 + user_value 0 +}; + +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 }; cdl_option CYGSEM_IO_FLASH_VERIFY_PROGRAM { - user_value 0 + user_value 0 }; + +cdl_option CYGPKG_HAL_GDB_FILEIO { + user_value 1 +}; diff --git a/packages/hal/arm/iq80310/current/misc/redboot_ROMA.ecm b/packages/hal/arm/iq80310/current/misc/redboot_ROMA.ecm --- a/packages/hal/arm/iq80310/current/misc/redboot_ROMA.ecm +++ b/packages/hal/arm/iq80310/current/misc/redboot_ROMA.ecm @@ -96,3 +96,7 @@ cdl_option CYGSEM_REDBOOT_FIS_CRC_CHECK cdl_option CYGSEM_IO_FLASH_VERIFY_PROGRAM { user_value 0 }; + +cdl_option CYGPKG_HAL_GDB_FILEIO { + user_value 1 +}; diff --git a/packages/hal/arm/iq80310/current/src/diag/7_segment_displays.h b/packages/hal/arm/iq80310/current/src/diag/7_segment_displays.h --- a/packages/hal/arm/iq80310/current/src/diag/7_segment_displays.h +++ b/packages/hal/arm/iq80310/current/src/diag/7_segment_displays.h @@ -5,29 +5,38 @@ // Definitions for IQ80310 7-segment display. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/cycduart.c b/packages/hal/arm/iq80310/current/src/diag/cycduart.c --- a/packages/hal/arm/iq80310/current/src/diag/cycduart.c +++ b/packages/hal/arm/iq80310/current/src/diag/cycduart.c @@ -3,29 +3,38 @@ // cycduart.c - Cyclone UART Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/cycduart.h b/packages/hal/arm/iq80310/current/src/diag/cycduart.h --- a/packages/hal/arm/iq80310/current/src/diag/cycduart.h +++ b/packages/hal/arm/iq80310/current/src/diag/cycduart.h @@ -3,29 +3,38 @@ // cycduart.h - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/diag.c b/packages/hal/arm/iq80310/current/src/diag/diag.c --- a/packages/hal/arm/iq80310/current/src/diag/diag.c +++ b/packages/hal/arm/iq80310/current/src/diag/diag.c @@ -5,29 +5,38 @@ // Additional RedBoot commands to run board diags. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/ether_test.c b/packages/hal/arm/iq80310/current/src/diag/ether_test.c --- a/packages/hal/arm/iq80310/current/src/diag/ether_test.c +++ b/packages/hal/arm/iq80310/current/src/diag/ether_test.c @@ -3,29 +3,38 @@ // ether_test.c - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/ether_test.h b/packages/hal/arm/iq80310/current/src/diag/ether_test.h --- a/packages/hal/arm/iq80310/current/src/diag/ether_test.h +++ b/packages/hal/arm/iq80310/current/src/diag/ether_test.h @@ -3,29 +3,38 @@ // ether_test.h - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/external_timer.c b/packages/hal/arm/iq80310/current/src/diag/external_timer.c --- a/packages/hal/arm/iq80310/current/src/diag/external_timer.c +++ b/packages/hal/arm/iq80310/current/src/diag/external_timer.c @@ -3,29 +3,38 @@ // external_timer.c - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/flash.c b/packages/hal/arm/iq80310/current/src/diag/flash.c --- a/packages/hal/arm/iq80310/current/src/diag/flash.c +++ b/packages/hal/arm/iq80310/current/src/diag/flash.c @@ -3,29 +3,38 @@ // flash.c - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/i557_eep.c b/packages/hal/arm/iq80310/current/src/diag/i557_eep.c --- a/packages/hal/arm/iq80310/current/src/diag/i557_eep.c +++ b/packages/hal/arm/iq80310/current/src/diag/i557_eep.c @@ -3,29 +3,38 @@ // i557_eep.c - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/i557_eep.h b/packages/hal/arm/iq80310/current/src/diag/i557_eep.h --- a/packages/hal/arm/iq80310/current/src/diag/i557_eep.h +++ b/packages/hal/arm/iq80310/current/src/diag/i557_eep.h @@ -3,29 +3,38 @@ // i557_eep.h - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/interrupts.c b/packages/hal/arm/iq80310/current/src/diag/interrupts.c --- a/packages/hal/arm/iq80310/current/src/diag/interrupts.c +++ b/packages/hal/arm/iq80310/current/src/diag/interrupts.c @@ -3,29 +3,38 @@ // interrupts.c - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/io_utils.c b/packages/hal/arm/iq80310/current/src/diag/io_utils.c --- a/packages/hal/arm/iq80310/current/src/diag/io_utils.c +++ b/packages/hal/arm/iq80310/current/src/diag/io_utils.c @@ -3,29 +3,38 @@ // io_utils.c - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/iq80310.h b/packages/hal/arm/iq80310/current/src/diag/iq80310.h --- a/packages/hal/arm/iq80310/current/src/diag/iq80310.h +++ b/packages/hal/arm/iq80310/current/src/diag/iq80310.h @@ -3,29 +3,38 @@ // iq80310.h - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/irq.S b/packages/hal/arm/iq80310/current/src/diag/irq.S --- a/packages/hal/arm/iq80310/current/src/diag/irq.S +++ b/packages/hal/arm/iq80310/current/src/diag/irq.S @@ -3,29 +3,38 @@ // irq.S - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/memtest.c b/packages/hal/arm/iq80310/current/src/diag/memtest.c --- a/packages/hal/arm/iq80310/current/src/diag/memtest.c +++ b/packages/hal/arm/iq80310/current/src/diag/memtest.c @@ -3,29 +3,38 @@ // memtest.c - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/pci_bios.h b/packages/hal/arm/iq80310/current/src/diag/pci_bios.h --- a/packages/hal/arm/iq80310/current/src/diag/pci_bios.h +++ b/packages/hal/arm/iq80310/current/src/diag/pci_bios.h @@ -3,29 +3,38 @@ // pci_bios.h - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/pci_serv.c b/packages/hal/arm/iq80310/current/src/diag/pci_serv.c --- a/packages/hal/arm/iq80310/current/src/diag/pci_serv.c +++ b/packages/hal/arm/iq80310/current/src/diag/pci_serv.c @@ -3,29 +3,38 @@ // pci_serv.c - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/test_menu.c b/packages/hal/arm/iq80310/current/src/diag/test_menu.c --- a/packages/hal/arm/iq80310/current/src/diag/test_menu.c +++ b/packages/hal/arm/iq80310/current/src/diag/test_menu.c @@ -3,29 +3,38 @@ // test_menu.c - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/test_menu.h b/packages/hal/arm/iq80310/current/src/diag/test_menu.h --- a/packages/hal/arm/iq80310/current/src/diag/test_menu.h +++ b/packages/hal/arm/iq80310/current/src/diag/test_menu.h @@ -3,29 +3,38 @@ // test_menu.h - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/diag/xscale_test.c b/packages/hal/arm/iq80310/current/src/diag/xscale_test.c --- a/packages/hal/arm/iq80310/current/src/diag/xscale_test.c +++ b/packages/hal/arm/iq80310/current/src/diag/xscale_test.c @@ -3,29 +3,38 @@ // xscale_test.c - Cyclone Diagnostics // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/hal_diag.c b/packages/hal/arm/iq80310/current/src/hal_diag.c --- a/packages/hal/arm/iq80310/current/src/hal_diag.c +++ b/packages/hal/arm/iq80310/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/iq80310/current/src/iq80310_misc.c b/packages/hal/arm/iq80310/current/src/iq80310_misc.c --- a/packages/hal/arm/iq80310/current/src/iq80310_misc.c +++ b/packages/hal/arm/iq80310/current/src/iq80310_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for XScale IQ80310 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -78,8 +87,6 @@ static cyg_uint32 nmi_sb_ISR(cyg_vector_ void hal_hardware_init(void) { - unsigned rtmp = 0; - // Route INTA-INTD to IRQ pin // The Yavapai manual is incorrect in that a '1' value // routes to the IRQ line, not a '0' value. @@ -119,12 +126,16 @@ void hal_hardware_init(void) HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SBDG_ERR, &nmi_sb_ISR, CYGNUM_HAL_INTERRUPT_SBDG_ERR, 0); HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SBDG_ERR); +#if 0 // Enable FIQ -#if 0 - asm volatile ("mrs %0,cpsr\n" - "bic %0,%0,#0x40\n" - "msr cpsr,%0\n" - : "=r"(rtmp) : ); + { + unsigned rtmp = 0; + + asm volatile ("mrs %0,cpsr\n" + "bic %0,%0,#0x40\n" + "msr cpsr,%0\n" + : "=r"(rtmp) : ); + } #endif } @@ -259,6 +270,81 @@ void hal_clock_initialize(cyg_uint32 per EXT_TIMER_CNT_ENAB(); } +// Dynamically set the timer interrupt rate. +// Not for eCos application use at all, just special GPROF code in RedBoot. + +void +hal_clock_reinitialize( int *pfreq, /* inout */ + unsigned int *pperiod, /* inout */ + unsigned int old_hz ) /* in */ +{ + unsigned int newp = 0, period, i = 0; + int hz; + int do_set_hw; + +// Arbitrary choice somewhat - so the CPU can make +// progress with the clock set like this, we hope. +#define MIN_TICKS (500) +#define MAX_TICKS (0xffffff) // 24-bit timer + + if ( ! pfreq || ! pperiod ) + return; // we cannot even report a problem! + + hz = *pfreq; + period = *pperiod; + +// Requested HZ: +// 0 => tell me the current value (no change, implemented in caller) +// - 1 => tell me the slowest (no change) +// - 2 => tell me the default (no change, implemented in caller) +// -nnn => tell me what you would choose for nnn (no change) +// MIN_INT => tell me the fastest (no change) +// +// 1 => tell me the slowest (sets the clock) +// MAX_INT => tell me the fastest (sets the clock) + + do_set_hw = (hz > 0); + if ( hz < 0 ) + hz = -hz; + + // Be paranoid about bad args, and very defensive about underflows + if ( 0 < hz && 0 < period && 0 < old_hz ) { + + newp = period * old_hz / (unsigned)hz; + + if ( newp < MIN_TICKS ) { + newp = MIN_TICKS; + // recalculate to get the exact delay for this integral hz + // and hunt hz down to an acceptable value if necessary + i = period * old_hz / newp; + if ( i ) do { + newp = period * old_hz / i; + i--; + } while (newp < MIN_TICKS && i); + } + else if ( newp > MAX_TICKS ) { + newp = MAX_TICKS; + // recalculate to get the exact delay for this integral hz + // and hunt hz up to an acceptable value if necessary + i = period * old_hz / newp; + if ( i ) do { + newp = period * old_hz / i; + i++; + } while (newp > MAX_TICKS && i); + } + + // Recalculate the actual value installed. + i = period * old_hz / newp; + } + + *pfreq = i; + *pperiod = newp; + + if ( do_set_hw ) { + hal_clock_initialize( newp ); + } +} + // This routine is called during a clock interrupt. void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) @@ -1002,7 +1088,7 @@ int cyg_hal_plf_hw_breakpoint(int setfla unsigned x = (addr | 1); if (get_ibcr0() == x) set_ibcr0(0); - else if (get_ibcr0() == x) + else if (get_ibcr1() == x) set_ibcr1(0); else return -1; diff --git a/packages/hal/arm/iq80310/current/src/iq80310_pci.c b/packages/hal/arm/iq80310/current/src/iq80310_pci.c --- a/packages/hal/arm/iq80310/current/src/iq80310_pci.c +++ b/packages/hal/arm/iq80310/current/src/iq80310_pci.c @@ -5,29 +5,38 @@ // HAL board support code for XScale IQ80310 PCI // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/pid/current/ChangeLog b/packages/hal/arm/pid/current/ChangeLog --- a/packages/hal/arm/pid/current/ChangeLog +++ b/packages/hal/arm/pid/current/ChangeLog @@ -1,3 +1,21 @@ +2002-05-13 Jesper Skov + + * cdl/hal_arm_pid.cdl: Removed implemntation of + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_pid.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-04-24 Jesper Skov + + * cdl/hal_arm_pid.cdl: CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES defined. + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + 2001-06-08 Jonathan Larmour * include/hal_cache.h: Correctly indicate absence of cache. @@ -785,27 +803,36 @@ 1998-11-18 Gary Thomas +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#endif // CYGONCE_HAL_ARM_PID_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/pid/current/include/plf_stub.h b/packages/hal/arm/pid/current/include/plf_stub.h --- a/packages/hal/arm/pid/current/include/plf_stub.h +++ b/packages/hal/arm/pid/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/pid/current/misc/dl.c b/packages/hal/arm/pid/current/misc/dl.c --- a/packages/hal/arm/pid/current/misc/dl.c +++ b/packages/hal/arm/pid/current/misc/dl.c @@ -5,29 +5,38 @@ // ARM PID7 eval board FLASH program tool // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/pid/current/src/Notes_GDB_stub b/packages/hal/arm/pid/current/src/Notes_GDB_stub --- a/packages/hal/arm/pid/current/src/Notes_GDB_stub +++ b/packages/hal/arm/pid/current/src/Notes_GDB_stub @@ -1,27 +1,36 @@ =========================================================================== -####COPYRIGHTBEGIN#### - - ------------------------------------------- - The contents of this file are subject to the Red Hat eCos Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.redhat.com/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations under - the License. - - The Original Code is eCos - Embedded Configurable Operating System, - released September 30, 1998. - - The Initial Developer of the Original Code is Red Hat. - Portions created by Red Hat are - Copyright (C) 1998, 1999, 2000 Red Hat, Inc. - All Rights Reserved. - ------------------------------------------- - -####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### =========================================================================== 27 Oct 1999, revised on 2000.01.28 diff --git a/packages/hal/arm/pid/current/src/flash.c b/packages/hal/arm/pid/current/src/flash.c --- a/packages/hal/arm/pid/current/src/flash.c +++ b/packages/hal/arm/pid/current/src/flash.c @@ -5,29 +5,38 @@ // ARM PID7 eval board FLASH program tool // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/pid/current/src/hal_diag.c b/packages/hal/arm/pid/current/src/hal_diag.c --- a/packages/hal/arm/pid/current/src/hal_diag.c +++ b/packages/hal/arm/pid/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/pid/current/src/pid_misc.c b/packages/hal/arm/pid/current/src/pid_misc.c --- a/packages/hal/arm/pid/current/src/pid_misc.c +++ b/packages/hal/arm/pid/current/src/pid_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for ARM PID7 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/pid/current/src/prog_flash.c b/packages/hal/arm/pid/current/src/prog_flash.c --- a/packages/hal/arm/pid/current/src/prog_flash.c +++ b/packages/hal/arm/pid/current/src/prog_flash.c @@ -5,29 +5,38 @@ // ARM PID7 eval board FLASH program tool // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/assabet/current/ChangeLog b/packages/hal/arm/sa11x0/assabet/current/ChangeLog --- a/packages/hal/arm/sa11x0/assabet/current/ChangeLog +++ b/packages/hal/arm/sa11x0/assabet/current/ChangeLog @@ -1,3 +1,22 @@ +2002-05-14 Jesper Skov + + * src/assabet_misc.c: Fixed warning. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_sa11x0_assabet.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + + +2002-03-05 Jesper Skov + + * misc/redboot_RAM.ecm: Updated. Added zlib+dns packages. + * misc/redboot_ROM.ecm: Same. + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + 2001-10-20 Nicolas Pitre * include/hal_platform_setup.h: Wake up from deep sleep mode. @@ -288,27 +307,36 @@ 2000-05-10 Gary Thomas +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#endif // CYGONCE_HAL_ARM_SA11X0_ASSABET_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/sa11x0/assabet/current/include/plf_mmap.h b/packages/hal/arm/sa11x0/assabet/current/include/plf_mmap.h --- a/packages/hal/arm/sa11x0/assabet/current/include/plf_mmap.h +++ b/packages/hal/arm/sa11x0/assabet/current/include/plf_mmap.h @@ -7,29 +7,38 @@ // Platform specific memory map support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/assabet/current/misc/lcd_test.c b/packages/hal/arm/sa11x0/assabet/current/misc/lcd_test.c --- a/packages/hal/arm/sa11x0/assabet/current/misc/lcd_test.c +++ b/packages/hal/arm/sa11x0/assabet/current/misc/lcd_test.c @@ -5,29 +5,38 @@ // SA1110/Assabet - Compact Flash test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/assabet/current/misc/redboot_RAM.ecm b/packages/hal/arm/sa11x0/assabet/current/misc/redboot_RAM.ecm --- a/packages/hal/arm/sa11x0/assabet/current/misc/redboot_RAM.ecm +++ b/packages/hal/arm/sa11x0/assabet/current/misc/redboot_RAM.ecm @@ -16,20 +16,39 @@ cdl_configuration eCos { package -hardware CYGPKG_HAL_ARM_SA11X0_ASSABET current ; package -hardware CYGPKG_IO_SERIAL_ARM_SA11X0 current ; package -hardware CYGPKG_DEVS_PCMCIA_ASSABET current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; package -hardware CYGPKG_DEVS_FLASH_ASSABET current ; + package -hardware CYGPKG_IO_USB current ; + package -hardware CYGPKG_IO_USB_SLAVE current ; + package -hardware CYGPKG_DEVS_USB_SA11X0 current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_ETH_CF current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_PCMCIA current ; - package CYGPKG_DEVS_ETH_CF current ; package CYGPKG_IO_FLASH current ; package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; }; cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { user_value 0 }; @@ -70,8 +89,44 @@ cdl_component CYGSEM_REDBOOT_FLASH_CONFI user_value 1 }; -cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGSEM_REDBOOT_ARM_LINUX_BOOT { inferred_value 1 }; +cdl_option CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT { + inferred_value 0xC0008000 +}; +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/sa11x0/assabet/current/misc/redboot_ROM.ecm b/packages/hal/arm/sa11x0/assabet/current/misc/redboot_ROM.ecm --- a/packages/hal/arm/sa11x0/assabet/current/misc/redboot_ROM.ecm +++ b/packages/hal/arm/sa11x0/assabet/current/misc/redboot_ROM.ecm @@ -16,20 +16,39 @@ cdl_configuration eCos { package -hardware CYGPKG_HAL_ARM_SA11X0_ASSABET current ; package -hardware CYGPKG_IO_SERIAL_ARM_SA11X0 current ; package -hardware CYGPKG_DEVS_PCMCIA_ASSABET current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; package -hardware CYGPKG_DEVS_FLASH_ASSABET current ; + package -hardware CYGPKG_IO_USB current ; + package -hardware CYGPKG_IO_USB_SLAVE current ; + package -hardware CYGPKG_DEVS_USB_SA11X0 current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_ETH_CF current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_PCMCIA current ; - package CYGPKG_DEVS_ETH_CF current ; package CYGPKG_IO_FLASH current ; package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; }; cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { user_value 0 }; @@ -74,4 +93,40 @@ cdl_component CYGSEM_REDBOOT_FLASH_CONFI user_value 1 }; +cdl_option CYGSEM_REDBOOT_ARM_LINUX_BOOT { + inferred_value 1 +}; +cdl_option CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT { + inferred_value 0xC0008000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/sa11x0/assabet/current/src/assabet_misc.c b/packages/hal/arm/sa11x0/assabet/current/src/assabet_misc.c --- a/packages/hal/arm/sa11x0/assabet/current/src/assabet_misc.c +++ b/packages/hal/arm/sa11x0/assabet/current/src/assabet_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for StrongARM SA1110/Assabet // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -63,6 +72,8 @@ // All the MM table layout is here: #include +externC void* memset(void *, int, size_t); + void hal_mmu_init(void) { diff --git a/packages/hal/arm/sa11x0/assabet/current/src/lcd_support.c b/packages/hal/arm/sa11x0/assabet/current/src/lcd_support.c --- a/packages/hal/arm/sa11x0/assabet/current/src/lcd_support.c +++ b/packages/hal/arm/sa11x0/assabet/current/src/lcd_support.c @@ -5,29 +5,38 @@ // SA1110/Assabet - LCD support routines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/brutus/current/ChangeLog b/packages/hal/arm/sa11x0/brutus/current/ChangeLog --- a/packages/hal/arm/sa11x0/brutus/current/ChangeLog +++ b/packages/hal/arm/sa11x0/brutus/current/ChangeLog @@ -1,3 +1,11 @@ +2002-05-14 Jesper Skov + + * src/brutus_misc.c (hal_mmu_init): Fixed warning. + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + 2001-08-15 Gary Thomas * include/plf_mmap.h (HAL_VIRT_TO_PHYS_ADDRESS): @@ -145,27 +153,36 @@ 2000-05-10 Gary Thomas +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#endif // CYGONCE_HAL_ARM_SA11X0_BRUTUS_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/sa11x0/brutus/current/include/plf_mmap.h b/packages/hal/arm/sa11x0/brutus/current/include/plf_mmap.h --- a/packages/hal/arm/sa11x0/brutus/current/include/plf_mmap.h +++ b/packages/hal/arm/sa11x0/brutus/current/include/plf_mmap.h @@ -7,29 +7,38 @@ // Platform specific memory map support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/brutus/current/src/brutus_misc.c b/packages/hal/arm/sa11x0/brutus/current/src/brutus_misc.c --- a/packages/hal/arm/sa11x0/brutus/current/src/brutus_misc.c +++ b/packages/hal/arm/sa11x0/brutus/current/src/brutus_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for StrongARM SA1110/Brutus // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -63,6 +72,8 @@ // All the MM table layout is here: #include +externC void* memset(void *, int, size_t); + void hal_mmu_init(void) { diff --git a/packages/hal/arm/sa11x0/cerf/current/ChangeLog b/packages/hal/arm/sa11x0/cerf/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/ChangeLog @@ -0,0 +1,75 @@ +2002-05-14 Jesper Skov + + * src/cerf_misc.c (hal_mmu_init): Fixed warning. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_sa11x0_cerf.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-05-01 Gary Thomas + + * include/plf_mmap.h: Fix mapping macros (I/O region). + +2002-04-16 Gary Thomas + + * src/cerf_misc.c (hal_mmu_init): Add unmapped DRAM. + +2002-02-05 Gary Thomas + + * misc/redboot_ROM.ecm: + * misc/redboot_RAM.ecm: Update with ZLIB, latest template. + + * cdl/hal_arm_sa11x0_cerf.cdl: Add product info for RedBoot. + +2002-02-04 Gary Thomas + + * src/cerf_misc.c: + * misc/redboot_ROM.ecm: + * misc/redboot_RAM.ecm: + * include/pkgconf/mlt_arm_sa11x0_cerf_rom.mlt: + * include/pkgconf/mlt_arm_sa11x0_cerf_rom.ldi: + * include/pkgconf/mlt_arm_sa11x0_cerf_rom.h: + * include/pkgconf/mlt_arm_sa11x0_cerf_ram.mlt: + * include/pkgconf/mlt_arm_sa11x0_cerf_ram.ldi: + * include/pkgconf/mlt_arm_sa11x0_cerf_ram.h: + * include/plf_mmap.h: + * include/plf_io.h: + * include/hal_platform_setup.h: + * include/cerf.h: + * cdl/hal_arm_sa11x0_cerf.cdl: New file(s) - port to Intrinsyc CerfCube. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/arm/sa11x0/cerf/current/cdl/hal_arm_sa11x0_cerf.cdl b/packages/hal/arm/sa11x0/cerf/current/cdl/hal_arm_sa11x0_cerf.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/cdl/hal_arm_sa11x0_cerf.cdl @@ -0,0 +1,373 @@ +# ==================================================================== +# +# hal_arm_sa11x0_cerf.cdl +# +# ARM SA1110/Cerf platform HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Original data: gthomas +# Contributors: +# Date: 2000-05-08 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== +cdl_package CYGPKG_HAL_ARM_SA11X0_CERF { + display "ARM SA1110/Cerf evaluation board" + parent CYGPKG_HAL_ARM_SA11X0 + hardware + include_dir cyg/hal + define_header hal_arm_sa11x0_cerf.h + description " + This HAL platform package provides generic + support for the Intel StrongARM SA1110 based evalation board, + known as 'cerf'." + + compile cerf_misc.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + + implements CYGHWR_HAL_ARM_SA11X0_UART1 + implements CYGHWR_HAL_ARM_SA11X0_UART3 + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_VARIANT_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "#define HAL_PLATFORM_CPU \"StrongARM 1110\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"Intrinsyc CerfCube\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + puts $::cdl_header "#define HAL_PLATFORM_MACHINE_TYPE 31" + } + + cdl_option CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK_OVERRIDE_DEFAULT { + display "Processor clock rate" + calculated 191700 + flavor data + description "The Cerf is optimal at this speed. Caution - selecting + higher speeds may be unreliable." + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + default_value {"RAM"} + legal_values {"RAM" "ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the Cerf eval board it is possible to build + the system for either RAM bootstrap or ROM bootstrap(s). Select + 'ram' when building programs to load into RAM using eCos GDB + stubs. Select 'rom' when building a stand-alone application + which will be put into ROM, or for the special case of + building the eCos GDB stubs themselves." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 2 + + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The cerf board has 3 serial ports. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + The cerf board has 3 serial ports. This option + chooses which port will be used for diagnostic output." + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + no_define + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + parent CYGPKG_NONE + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "arm-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mcpu=strongarm1100 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which are used to + compile all packages by default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-Wl,--gc-sections -Wl,-static -g -O2 -nostdlib" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) --remove-section=.fixed_vectors -O binary $< $@ + } + } + } + + cdl_component CYGPKG_HAL_ARM_SA11X0_CERF_OPTIONS { + display "StrongARM SA1110/CERF build options" + flavor none + no_define + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + cdl_option CYGSEM_HAL_ARM_SA11X0_CERF_NEPONSET_TIMINGS { + display "Enable special timings for Neponset board" + flavor bool + default_value 0 + description " + Enable this option to force initialization of memory timing + parameters suitable for use with the Neponset expansion board. + This is optional as it does not work for some versions of + Cerf without the board plugged in." + } + + cdl_option CYGPKG_HAL_ARM_SA11X0_CERF_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the StrongARM Cerf HAL. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_HAL_ARM_SA11X0_CERF_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the StrongARM Cerf HAL. These flags are removed from + the set of global flags if present." + } + + cdl_option CYGPKG_HAL_ARM_SA11X0_CERF_TESTS { + display "StrongARM SA1110/Cerf tests" + flavor data + no_define +# calculated { "tests/dram-test" } + calculated { "" } + description " + This option specifies the set of tests for the StrongARM Cerf HAL." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "arm_sa11x0_cerf_ram" : \ + "arm_sa11x0_cerf_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"GDB_stubs\" provides support when GDB stubs are included in + the ROM monitor or boot ROM." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } + +} diff --git a/packages/hal/arm/sa11x0/cerf/current/include/cerf.h b/packages/hal/arm/sa11x0/cerf/current/include/cerf.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/include/cerf.h @@ -0,0 +1,152 @@ +#ifndef CYGONCE_CERF_H +#define CYGONCE_CERF_H + +/*============================================================================= +// +// cerf.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-05-08 +// Purpose: Intel SA1110/Cerf platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + + +#ifndef __ASSEMBLER__ +// +// Board Control Register +// Note: This register is write-only. Thus a shadow copy is provided so that +// it may be safely updated/shared by multiple threads. +// +extern unsigned long _cerf_BCR; // Shadow copy + +extern void cerf_BCR(unsigned long mask, unsigned long value); + +#endif + +// +// Signal assertion levels +// +#define SA1110_LOGIC_ONE(m) (m & 0xFFFFFFFF) +#define SA1110_LOGIC_ZERO(m) (m & 0x00000000) + +// +// SA1110/Cerf Board Control Register +// +#define SA1110_BOARD_CONTROL REG32_PTR(0x10000000) +#define SA1110_BCR_MIN 0x00000000 // Reset state + +#define SA1110_BCR_CF_POWER 0x00000000 // 1 = CompactFlash power on (##### NA ######) +#define SA1110_BCR_CF_POWER_ON SA1110_LOGIC_ONE(SA1110_BCR_CF_POWER) +#define SA1110_BCR_CF_POWER_OFF SA1110_LOGIC_ZERO(SA1110_BCR_CF_POWER) +#define SA1110_BCR_CF_RESET 0x00000000 // 1 = CompactFlash reset (##### NA #####) +#define SA1110_BCR_CF_RESET_ENABLE SA1110_LOGIC_ONE(SA1110_BCR_CF_RESET) +#define SA1110_BCR_CF_RESET_DISABLE SA1110_LOGIC_ZERO(SA1110_BCR_CF_RESET) +#define SA1110_BCR_SOFT_RESET 0x00000004 // 0 = resets UCB1300, ADI7171, UDA1341 +#define SA1110_BCR_IRDA_FREQ 0x00000008 // 0 = SIR, 1 = MIR/FIR +#define SA1110_BCR_IRDA_MD 0x00000030 // IrDA Mode & range +#define SA1110_BCR_IRDA_MD_MAX 0x00000000 // Max range and power +#define SA1110_BCR_IRDA_MD_OFF 0x00000010 // Shutdown +#define SA1110_BCR_IRDA_MD_23 0x00000020 // 2/3 power +#define SA1110_BCR_IRDA_MD_13 0x00000030 // 1/3 power +#define SA1110_BCR_STEREO_LB 0x00000040 // 1 = Stereo loopback on +#define SA1110_BCR_CF_BUS 0x00000000 // 0 = CompactFlash bus on (##### NA #####) +#define SA1110_BCR_CF_BUS_ON SA1110_LOGIC_ZERO(SA1110_BCR_CF_BUS) +#define SA1110_BCR_CF_BUS_OFF SA1110_LOGIC_ONE(SA1110_BCR_CF_BUS) +#define SA1110_BCR_AUDIO_ON 0x00000100 // 1 = UDA1341, MIC, DAA power on +#define SA1110_BCR_BACKLIGHT 0x00000200 // 1 = LCD backlight on +#define SA1110_BCR_LCD_BPP 0x00000400 // 1 = 16 RGB, 0 = 12 RGB +#define SA1110_BCR_LCD_16BPP SA1110_LOGIC_ONE(SA1110_BCR_LCD_BPP) +#define SA1110_BCR_LCD_12BPP SA1110_LOGIC_ZERO(SA1110_BCR_LCD_BPP) +#define SA1110_BCR_LCD 0x00000800 // 1 = LCD panel and controller on +#define SA1110_BCR_LCD_ON SA1110_LOGIC_ONE(SA1110_BCR_LCD) +#define SA1110_BCR_LCD_OFF SA1110_LOGIC_ZERO(SA1110_BCR_LCD) +#define SA1110_BCR_RS232_ENABLE 0x00001000 // 1 = Enable RD232 signals +#define SA1110_BCR_RED_LED 0x00000001 // 0 = Red LED on +#define SA1110_BCR_RED_LED_ON SA1110_LOGIC_ZERO(SA1110_BCR_RED_LED) +#define SA1110_BCR_RED_LED_OFF SA1110_LOGIC_ONE(SA1110_BCR_RED_LED) +#define SA1110_BCR_GREEN_LED 0x00000002 // 0 = Green LED on +#define SA1110_BCR_GREEN_LED_ON SA1110_LOGIC_ZERO(SA1110_BCR_GREEN_LED) +#define SA1110_BCR_GREEN_LED_OFF SA1110_LOGIC_ONE(SA1110_BCR_GREEN_LED) +#define SA1110_BCR_MOTOR 0x00000004 // 1 = Vibrator motor on +#define SA1110_BCR_MOTOR_ON SA1110_LOGIC_ONE(SA1110_BCR_MOTOR) +#define SA1110_BCR_MOTOR_OFF SA1110_LOGIC_ZERO(SA1110_BCR_MOTOR) +#define SA1110_BCR_COM_DTR 0x00010000 // COM port Data Terminal Ready +#define SA1110_BCR_COM_RTS 0x00020000 // COM port Request To Send +#define SA1110_BCR_RADIO_WAKE 0x00040000 // 1 = Wake up CPU with radio +#define SA1110_BCR_MUTE 0x00200000 // 1 = Audio muted + +#define SA1110_BCR_ETH_SLEEP (1 << 27) // Output pin to put Crystal LAN in sleep mode. + +// +// Special purpose GPIO interrupt mappings +// +#define SA1110_CF_IRQ CYGNUM_HAL_INTERRUPT_GPIO22 +#define SA1110_CF_DETECT CYGNUM_HAL_INTERRUPT_GPIO23 +#define SA1110_IRQ_GPIO_ETH CYGNUM_HAL_INTERRUPT_GPIO26 +// +// GPIO layout +// +#define SA1110_GPIO_CF_DETECT 0x00800000 // 0 = Compact Flash detect +#define SA1110_GPIO_CF_PRESENT SA1110_LOGIC_ZERO(SA1110_GPIO_CF_DETECT) +//#define SA1110_GPIO_CF_ABSENT SA1110_LOGIC_ONE(SA1110_GPIO_CF_DETECT) + +// +// LCD Controller +// +#define SA1110_LCCR0 SA11X0_REGISTER(0x30100000) +#define SA1110_LCSR SA11X0_REGISTER(0x30100004) +#define SA1110_DBAR1 SA11X0_REGISTER(0x30100010) +#define SA1110_DCAR1 SA11X0_REGISTER(0x30100014) +#define SA1110_DBAR2 SA11X0_REGISTER(0x30100018) +#define SA1110_DCAR2 SA11X0_REGISTER(0x3010001C) +#define SA1110_LCCR1 SA11X0_REGISTER(0x30100020) +#define SA1110_LCCR2 SA11X0_REGISTER(0x30100024) +#define SA1110_LCCR3 SA11X0_REGISTER(0x30100028) + +/*---------------------------------------------------------------------------*/ +/* end of cerf.h */ +#endif /* CYGONCE_CERF_H */ diff --git a/packages/hal/arm/sa11x0/cerf/current/include/hal_platform_setup.h b/packages/hal/arm/sa11x0/cerf/current/include/hal_platform_setup.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/include/hal_platform_setup.h @@ -0,0 +1,323 @@ +#ifndef CYGONCE_HAL_PLATFORM_SETUP_H +#define CYGONCE_HAL_PLATFORM_SETUP_H + +/*============================================================================= +// +// hal_platform_setup.h +// +// Platform specific support for HAL (assembly code) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-05-08 +// Purpose: Intel SA1110/Assabet platform specific support routines +// Description: +// Usage: #include +// Only used by "vectors.S" +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include // System-wide configuration info +#include CYGBLD_HAL_VARIANT_H // Variant (SA11x0) specific configuration +#include CYGBLD_HAL_PLATFORM_H // Platform specific configuration +#include // Variant specific hardware definitions +#include // MMU definitions +#include // Platform specific hardware definitions + +#if defined(CYG_HAL_STARTUP_ROM) +#define PLATFORM_SETUP1 _platform_setup1 +#define CYGHWR_HAL_ARM_HAS_MMU + +#if (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 59000) +#define SA11X0_PLL_CLOCK 0x0 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 73700) +#define SA11X0_PLL_CLOCK 0x1 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 88500) +#define SA11X0_PLL_CLOCK 0x2 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 103200) +#define SA11X0_PLL_CLOCK 0x3 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 118000) +#define SA11X0_PLL_CLOCK 0x4 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 132700) +#define SA11X0_PLL_CLOCK 0x5 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 147500) +#define SA11X0_PLL_CLOCK 0x6 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 162200) +#define SA11X0_PLL_CLOCK 0x7 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 176900) +#define SA11X0_PLL_CLOCK 0x8 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 191700) +#define SA11X0_PLL_CLOCK 0x9 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 206400) +#define SA11X0_PLL_CLOCK 0xA +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 221200) +#define SA11X0_PLL_CLOCK 0xB +#else +#error Invalid processor clock speed +#endif + +#define CAS0_WAVEFORM_VALUE 0xAAAAAA9F +#define CAS1_WAVEFORM_VALUE 0xAAAAAAAA +#define CAS2_WAVEFORM_VALUE 0xAAAAAAAA + +#define MSC0VALUE 0xFFFCFFFC +#define MSC1VALUE 0xFFFFFFFF +#define MSC2VALUE 0xFFFFFFFF + +#define DRAM_CONFIG_VALUE 0x72547254 +#define RFSH_CONFIG_VALUE 0x003002D1 + +// Macros that handle the red debug LED wired to GPIO-1 + + .macro _LED_ON,led + ldr r1,=SA11X0_GPIO_PIN_OUTPUT_SET + mov r0,#(1<<\led) + str r0,[r1] + // Delay + ldr r1,=10000 +10: sub r1,r1,#1 + cmp r1,#0 + bne 10b + .endm + + .macro _LED_OFF,led + ldr r1,=SA11X0_GPIO_PIN_OUTPUT_CLEAR + mov r0,#(1<<\led) + str r0,[r1] + // Delay + ldr r1,=10000 +10: sub r1,r1,#1 + cmp r1,#0 + bne 10b + .endm + +// This macro represents the initial startup code for the platform + .macro _platform_setup1 + + // Disable all interrupts (ICMR not specified on power-up) + ldr r1,=SA11X0_ICMR + mov r0,#0 + str r0,[r1] + + // Initialize the CPU. + mov r0, #0x0 // Get a zero to turn things off + mcr p15, 0, r0, c1, c0, 0 // MMU off + mcr p15, 0, r0, c8, c7, 0 // Flush TLB + mcr p15, 0, r0, c7, c7, 0 // Flush caches + nop + nop + nop + nop + + // Disable IRQs and FIQs + mov r0, #(CPSR_IRQ_DISABLE | \ + CPSR_FIQ_DISABLE | \ + CPSR_SUPERVISOR_MODE) + msr cpsr, r0 + + // Set up GPIOs (LED1 off) + ldr r1,=SA11X0_GPIO_PIN_DIRECTION + ldr r2,=0x0320000f // Set LT1348,DREN,RXEN,CF and LEDs to be output + str r2,[r1] + ldr r3,=SA11X0_GPIO_PIN_OUTPUT_SET + ldr r2,=0x0300000f // Set the LT1348,DREN,RXEN and LEDs to 1. + str r2,[r3] + ldr r3,=SA11X0_GPIO_PIN_OUTPUT_CLEAR + ldr r2,=0x0020000f // Set CF reset,LEDS OFF + str r2,[r3] + + // Turn on LED 0 + _LED_ON 0 + + // Disable clock switching + mcr p15,0,r0,\ + SA11X0_TEST_CLOCK_AND_IDLE_REGISTER,\ + SA11X0_DISABLE_CLOCK_SWITCHING_RM,\ + SA11X0_DISABLE_CLOCK_SWITCHING_OPCODE + + // Set up processor clock + ldr r1,=SA11X0_PWR_MGR_PLL_CONFIG + ldr r2,=SA11X0_PLL_CLOCK + str r2,[r1] + + // Turn clock switching back on + mcr p15,0,r0,\ + SA11X0_TEST_CLOCK_AND_IDLE_REGISTER,\ + SA11X0_ENABLE_CLOCK_SWITCHING_RM,\ + SA11X0_ENABLE_CLOCK_SWITCHING_OPCODE + nop + nop + + // Let the PLL settle down + ldr r1,=20000 +10: sub r1,r1,#1 + cmp r1,#0 + bne 10b + + // Turn on LED 1 + _LED_ON 1 + + // Initialize DRAM controller + ldr r1,=dram_table + ldr r2,=__exception_handlers + sub r1,r1,r2 + ldr r2,[r1],#4 // First control register +10: ldr r3,[r1],#4 + str r3,[r2] + ldr r2,[r1],#4 // Next control register + cmp r2,#0 + bne 10b + + // Turn on LED 2 + _LED_ON 2 + + // Enable UART + ldr r1,=SA1110_GPCLK_CONTROL_0 + ldr r2,=SA1110_GPCLK_SUS_UART + str r2,[r1] + + // Release DRAM hold (set by RESET) + ldr r1,=SA11X0_PWR_MGR_SLEEP_STATUS + ldr r2,=SA11X0_DRAM_CONTROL_HOLD + str r2,[r1] + + // Perform 8 reads from unmapped/unenabled DRAM + ldr r1,=SA11X0_RAM_BANK0_BASE + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + + // Enable DRAM bank 0 + ldr r1,=SA11X0_DRAM_CONFIGURATION + ldr r2,=DRAM_CONFIG_VALUE + ldr r3,=0x00030003 + orr r2, r2, r3 + str r2,[r1] + + // Wait for the DRAM to come up. + mov r1, #0x400 +0: subs r1, r1, #1 + bne 0b + + // Turn on LED 3 + _LED_ON 3 + + b 19f + +// DRAM controller initialization +dram_table: + .word SA11X0_DRAM0_CAS_0, CAS0_WAVEFORM_VALUE + .word SA11X0_DRAM0_CAS_1, CAS1_WAVEFORM_VALUE + .word SA11X0_DRAM0_CAS_2, CAS2_WAVEFORM_VALUE + .word SA11X0_DRAM2_CAS_0, CAS0_WAVEFORM_VALUE + .word SA11X0_DRAM2_CAS_1, CAS1_WAVEFORM_VALUE + .word SA11X0_DRAM2_CAS_2, CAS2_WAVEFORM_VALUE + .word SA11X0_REFRESH_CONFIGURATION, RFSH_CONFIG_VALUE + .word SA11X0_DRAM_CONFIGURATION, DRAM_CONFIG_VALUE + .word SA11X0_STATIC_CONTROL_0, MSC0VALUE + .word SA11X0_STATIC_CONTROL_1, MSC1VALUE + .word SA11X0_STATIC_CONTROL_2, MSC2VALUE + .word 0, 0 + +19: + // Wakeup from deep sleep mode + ldr r1,=SA11X0_RESET_STATUS + ldr r2,[r1] + cmp r2,#SA11X0_SLEEP_MODE_RESET + bne 45f + ldr r1,=SA11X0_PWR_MGR_SCRATCHPAD + ldr r1,[r1] + mov pc,r1 + nop +45: nop + + // Release peripheral hold (set by RESET) + ldr r1,=SA11X0_PWR_MGR_SLEEP_STATUS + ldr r2,=SA11X0_PERIPHERAL_CONTROL_HOLD + str r2,[r1] + + // Set up a stack [for calling C code] + ldr r1,=__startup_stack + ldr r2,=SA11X0_RAM_BANK0_BASE + orr sp,r1,r2 + + // Create MMU tables + bl hal_mmu_init + + // Turn OFF LED 0 + _LED_OFF 0 + + // Enable MMU + ldr r2,=10f + ldr r1,=MMU_Control_Init|MMU_Control_M + mcr MMU_CP,0,r1,MMU_Control,c0 + mov pc,r2 /* Change address spaces */ + nop + nop + nop + +10: + // Turn OFF LED 1 + _LED_OFF 1 + + // Save shadow copy of BCR, also hardware configuration + ldr r1,=_cerf_BCR + str r2,[r1] + .endm + +#else // defined(CYG_HAL_STARTUP_ROM) +#define PLATFORM_SETUP1 +#endif + +#define PLATFORM_VECTORS _platform_vectors + .macro _platform_vectors + .globl _cerf_BCR +_cerf_BCR: .long 0 // Board Control register shadow + .endm + +/*---------------------------------------------------------------------------*/ +/* end of hal_platform_setup.h */ +#endif /* CYGONCE_HAL_PLATFORM_SETUP_H */ diff --git a/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_ram.h b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_ram.h @@ -0,0 +1,17 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x2000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x2000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_ram.ldi b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_ram.ldi @@ -0,0 +1,27 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x2000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x20000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_ram.mlt b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_ram.mlt @@ -0,0 +1,13 @@ +version 0 +region ram 0 2000000 0 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section rom_vectors 0 1 0 1 1 1 1 1 20000 20000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_rom.h b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_rom.h @@ -0,0 +1,20 @@ +// eCos memory layout - Fri Oct 20 05:56:55 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x2000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0x50000000) +#define CYGMEM_REGION_rom_SIZE (0x1000000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x2000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_rom.ldi b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_rom.ldi @@ -0,0 +1,28 @@ +// eCos memory layout - Fri Oct 20 05:56:55 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x2000000 + rom : ORIGIN = 0x50000000, LENGTH = 0x1000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x50000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_data (ram, 0x8000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_rom.mlt b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/include/pkgconf/mlt_arm_sa11x0_cerf_rom.mlt @@ -0,0 +1,14 @@ +version 0 +region ram 0 2000000 0 ! +region rom 50000000 1000000 1 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section data 0 1 1 1 1 1 0 0 8000 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 50000000 50000000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 0 0 1 data ! diff --git a/packages/hal/arm/sa11x0/cerf/current/include/plf_io.h b/packages/hal/arm/sa11x0/cerf/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/include/plf_io.h @@ -0,0 +1,60 @@ +#ifndef CYGONCE_HAL_ARM_SA11X0_CERF_PLF_IO_H +#define CYGONCE_HAL_ARM_SA11X0_CERF_PLF_IO_H + +/*============================================================================= +// +// plf_io.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#endif // CYGONCE_HAL_ARM_SA11X0_CERF_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/sa11x0/cerf/current/include/plf_mmap.h b/packages/hal/arm/sa11x0/cerf/current/include/plf_mmap.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/include/plf_mmap.h @@ -0,0 +1,140 @@ +#ifndef CYGONCE_HAL_SA11X0_PLATFORM_PLF_MMAP_H +#define CYGONCE_HAL_SA11X0_PLATFORM_PLF_MMAP_H +/*============================================================================= +// +// plf_mmap.h +// +// Platform specific memory map support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 2001-01-04 +// Purpose: Intel SA11x0 series platform-specific memory mapping macros +// Description: Macros to convert a cached, virtual address to +// 1) an uncached adddress for the same memory (if available) +// 2) the equivalent physical address for giving to external +// hardware eg. DMA engines. +// +// NB: this mapping is expressed here statically, independent +// of the actual mapping installed in the MMAP table. So if +// someone changes that, or its initialisation is changed, +// then this module must change. This is intended to be +// efficient at a cost of generality. It is also intended to +// be called with constants (such as &my_struct) as input +// args, so that all the work can be done at compile time, +// with optimization on. +// +// Usage: #include +// (which includes this file itself) +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +// Get the pagesize for a particular virtual address: + +// This does not depend on the vaddr. +#define HAL_MM_PAGESIZE( vaddr, pagesize ) CYG_MACRO_START \ + (pagesize) = SZ_1M; \ +CYG_MACRO_END + +// Get the physical address from a virtual address: + +// Only RAM and ROM are mapped; we just pass through all other values, +// rather than detecting nonexistent areas here. + +#define HAL_VIRT_TO_PHYS_ADDRESS( vaddr, paddr ) CYG_MACRO_START \ + cyg_uint32 _v_ = (cyg_uint32)(vaddr); \ + if ( 32 * SZ_1M > _v_ ) /* 32Mb of SDRAM Bank 0 from 0-32Mb */ \ + _v_ += 0xc00u * SZ_1M; \ + else if ( 0x500u * SZ_1M > _v_ ) /* Space between RAM and mapped ROM */\ + /* no change */ ; \ + else if ( 0x520u * SZ_1M > _v_ ) /* Mapped boot ROM size 32Mb */ \ + _v_ -= 0x500u * SZ_1M; \ + else if ( 0xf00u * SZ_1M > _v_ ) /* Space between ROM and mapped I/O */\ + /* no change */ ; \ + else if ( 0xf10u * SZ_1M > _v_ ) /* Mapped I/O size 16Mb */ \ + _v_ = (_v_ - 0xf00u * SZ_1M) + (0x080u * SZ_1M); \ + else /* Rest of it */ \ + /* no change */ ; \ + (paddr) = _v_; \ +CYG_MACRO_END + +// Get the virtual address for a physical address: + +// Only RAM and ROM are mapped; we just pass through all other values, +// rather than detecting nonexistent areas here. + +#define HAL_PHYS_TO_VIRT_ADDRESS( paddr, vaddr ) CYG_MACRO_START \ + cyg_uint32 _p_ = (cyg_uint32)(paddr); \ + if ( 32 * SZ_1M > _p_ ) /* 32Mb Boot ROM mapped to 0x500Mb */ \ + _p_ += 0x500u * SZ_1M; \ + else if ( 0x080u * SZ_1M > _p_ ) /* Space between ROM and I/O */ \ + /* no change */ ; \ + else if ( 0x090u * SZ_1M > _p_ ) /* I/O size 16Mb */ \ + _p_ = (_p_ - 0x080u * SZ_1M) + (0xf00u * SZ_1M); \ + else if ( 0xc00u * SZ_1M > _p_ ) /* Space between I/O and SDRAM */ \ + /* no change */ ; \ + else if ( 0xc20u * SZ_1M > _p_ ) /* Raw RAM size 32Mb */ \ + _p_ -= 0xc00u * SZ_1M; \ + else /* Rest of it */ \ + /* no change */ ; \ + (vaddr) = _p_ ; \ +CYG_MACRO_END + +// Get a non-cacheable address for accessing the same store as a virtual +// (assumed cachable) address: + +// Only RAM is mapped: ROM is only available cachable, everything else is +// not cachable anyway. + +#define HAL_VIRT_TO_UNCACHED_ADDRESS( vaddr, uaddr ) CYG_MACRO_START \ + cyg_uint32 _v_ = (cyg_uint32)(vaddr); \ + if ( 32 * SZ_1M > _v_ ) /* 32Mb of SDRAM Bank 0 from 0-32Mb */ \ + _v_ += 0xc00u * SZ_1M; \ + else /* Everything else is already uncacheable or is ROM */ \ + /* no change */ ; \ + (uaddr) = _v_ ; \ +CYG_MACRO_END + +//--------------------------------------------------------------------------- +#endif // CYGONCE_HAL_SA11X0_PLATFORM_PLF_MMAP_H +// EOF plf_mmap.h diff --git a/packages/hal/arm/sa11x0/cerf/current/misc/redboot_RAM.ecm b/packages/hal/arm/sa11x0/cerf/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/misc/redboot_RAM.ecm @@ -0,0 +1,131 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware cerf ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_SA11X0 current ; + package -hardware CYGPKG_HAL_ARM_SA11X0_CERF current ; + package -hardware CYGPKG_IO_SERIAL_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_PCMCIA_CERF current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -hardware CYGPKG_DEVS_FLASH_CERF current ; + package -hardware CYGPKG_IO_USB current ; + package -hardware CYGPKG_IO_USB_SLAVE current ; + package -hardware CYGPKG_DEVS_USB_SA11X0 current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_ETH_CF current ; + package -hardware CYGPKG_DEVS_ETH_ARM_CERF current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_component CYGPKG_REDBOOT_NETWORKING { + user_value 1 +}; + +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGSEM_REDBOOT_ARM_LINUX_BOOT { + inferred_value 1 +}; + +cdl_option CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT { + inferred_value 0xC0008000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/sa11x0/cerf/current/misc/redboot_ROM.ecm b/packages/hal/arm/sa11x0/cerf/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/misc/redboot_ROM.ecm @@ -0,0 +1,131 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware cerf ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_SA11X0 current ; + package -hardware CYGPKG_HAL_ARM_SA11X0_CERF current ; + package -hardware CYGPKG_IO_SERIAL_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_PCMCIA_CERF current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -hardware CYGPKG_DEVS_FLASH_CERF current ; + package -hardware CYGPKG_IO_USB current ; + package -hardware CYGPKG_IO_USB_SLAVE current ; + package -hardware CYGPKG_DEVS_USB_SA11X0 current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_ETH_CF current ; + package -hardware CYGPKG_DEVS_ETH_ARM_CERF current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_component CYGPKG_REDBOOT_NETWORKING { + user_value 1 +}; + +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_ARM_LINUX_BOOT { + inferred_value 1 +}; + +cdl_option CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT { + inferred_value 0xC0008000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/sa11x0/cerf/current/src/cerf_misc.c b/packages/hal/arm/sa11x0/cerf/current/src/cerf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerf/current/src/cerf_misc.c @@ -0,0 +1,166 @@ +//========================================================================== +// +// cerf_misc.c +// +// HAL misc board support code for StrongARM SA1110/Cerf +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: hmt +// Travis C. Furrer +// Date: 2000-05-21 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // IO macros +#include // Register state info +#include +#include // Interrupt names +#include +#include // Hardware definitions +#include // Platform specifics + +#include // diag_printf + +// All the MM table layout is here: +#include + +externC void* memset(void *, int, size_t); + +void +hal_mmu_init(void) +{ + unsigned long ttb_base = SA11X0_RAM_BANK0_BASE + 0x4000; + unsigned long i; + + /* + * Set the TTB register + */ + asm volatile ("mcr p15,0,%0,c2,c0,0" : : "r"(ttb_base) /*:*/); + + /* + * Set the Domain Access Control Register + */ + i = ARM_ACCESS_DACR_DEFAULT; + asm volatile ("mcr p15,0,%0,c3,c0,0" : : "r"(i) /*:*/); + + /* + * First clear all TT entries - ie Set them to Faulting + */ + memset((void *)ttb_base, 0, ARM_FIRST_LEVEL_PAGE_TABLE_SIZE); + + /* Actual Virtual Size Attributes Function */ + /* Base Base MB cached? buffered? access permissions */ + /* xxx00000 xxx00000 */ + X_ARM_MMU_SECTION(0x000, 0x500, 16, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Boot flash ROMspace */ + X_ARM_MMU_SECTION(0x080, 0xf00, 16, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Ethernet Adaptor */ + X_ARM_MMU_SECTION(0x100, 0x100, 128, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Board Registers */ + X_ARM_MMU_SECTION(0x200, 0x200, 512, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* PCMCIA Socket A */ + X_ARM_MMU_SECTION(0x300, 0x300, 512, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* PCMCIA Sockets B */ + X_ARM_MMU_SECTION(0x800, 0x800, 0x400, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* StrongARM(R) Registers */ + X_ARM_MMU_SECTION(0xC00, 0x000, 32, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* DRAM Bank 0 */ + X_ARM_MMU_SECTION(0xC00, 0xC00, 32, ARM_UNCACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* DRAM Bank 0 */ + X_ARM_MMU_SECTION(0xE00, 0xE00, 128, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Zeros (Cache Clean) Bank */ + +} + +// +// Board control register support +// Update the board control register (write only). Only the bits +// specified by 'mask' are changed to 'value'. +// + +void +cerf_BCR(unsigned long mask, unsigned long value) +{ + _cerf_BCR = (_cerf_BCR & ~mask) | (mask & value); + *SA1110_BOARD_CONTROL = _cerf_BCR; +} + +// +// Platform specific initialization +// + +void +plf_hardware_init(void) +{ + // Force "alternate" use of GPIO pins used for LCD screen + *SA11X0_GPIO_ALTERNATE_FUNCTION |= 0x080003FC; // Bits 2..9 + *SA11X0_GPIO_PIN_DIRECTION |= 0x080003FC; // Bits 2..9 + *SA11X0_GPIO_PIN_OUTPUT_CLEAR = 0x080003FC; // Bits 2..9 + *SA11X0_GPIO_PIN_OUTPUT_SET = 0x08000000; // CRYSTAL WAKEUP(GPIO27) + + // Toggle A0 connected to the SBHE line on the Crystal chip. + *(char*)(0x20000000) = 1; + *(char*)(0x20000001) = 2; + *(char*)(0x20000000) = 3; + *(char*)(0x20000001) = 0; + + // Configure the ethernet GPIO interrupt to the rising-edge + HAL_INTERRUPT_CONFIGURE(SA1110_IRQ_GPIO_ETH, 0, 1); +} + +#include CYGHWR_MEMORY_LAYOUT_H +typedef void code_fun(void); +void cerf_program_new_stack(void *func) +{ + register CYG_ADDRESS stack_ptr asm("sp"); + register CYG_ADDRESS old_stack asm("r4"); + register code_fun *new_func asm("r0"); + old_stack = stack_ptr; + stack_ptr = CYGMEM_REGION_ram + CYGMEM_REGION_ram_SIZE - sizeof(CYG_ADDRESS); + new_func = (code_fun*)func; + new_func(); + stack_ptr = old_stack; + return; +} + +// ------------------------------------------------------------------------ +// EOF cerf_misc.c diff --git a/packages/hal/arm/sa11x0/cerfpda/current/ChangeLog b/packages/hal/arm/sa11x0/cerfpda/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/ChangeLog @@ -0,0 +1,82 @@ +2002-05-14 Jesper Skov + + * src/cerfpda_misc.c: Fixed warning. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_sa11x0_cerfpda.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-05-01 Gary Thomas + + * include/plf_mmap.h: Fix mapping macros (I/O region). + +2002-04-16 Gary Thomas + + * src/cerfpda_misc.c (hal_mmu_init): Add unmapped DRAM. + +2002-02-05 Gary Thomas + + * cdl/hal_arm_sa11x0_cerfpda.cdl: Add product info for RedBoot. + +2002-02-04 Gary Thomas + + * src/lcd_support.c: + * src/cerfpda_misc.c: + * src/banner.xpm: + * misc/redhat2.xpm: + * misc/redhat.xpm: + * misc/redboot_ROM.ecm: + * misc/redboot_RAM.ecm: + * misc/redboot.xpm: + * misc/logo.xpm: + * misc/lcd_test.c: + * misc/escw.xpm: + * misc/eCos2.xpm: + * misc/eCos.xpm: + * include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.mlt: + * include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.ldi: + * include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.h: + * include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.mlt: + * include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.ldi: + * include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.h: + * include/plf_mmap.h: + * include/plf_io.h: + * include/hal_platform_setup.h: + * include/cerfpda.h: + * cdl/hal_arm_sa11x0_cerfpda.cdl: New file(s) - port to CerfPDA. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/arm/sa11x0/cerfpda/current/cdl/hal_arm_sa11x0_cerfpda.cdl b/packages/hal/arm/sa11x0/cerfpda/current/cdl/hal_arm_sa11x0_cerfpda.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/cdl/hal_arm_sa11x0_cerfpda.cdl @@ -0,0 +1,372 @@ +# ==================================================================== +# +# hal_arm_sa11x0_cerfpda.cdl +# +# ARM SA1110/Cerf platform HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Original data: gthomas +# Contributors: +# Date: 2000-05-08 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== +cdl_package CYGPKG_HAL_ARM_SA11X0_CERFPDA { + display "ARM SA1110/Cerf evaluation board" + parent CYGPKG_HAL_ARM_SA11X0 + hardware + include_dir cyg/hal + define_header hal_arm_sa11x0_cerfpda.h + description " + This HAL platform package provides generic + support for the Intel StrongARM SA1110 based evalation board, + known as 'cerfpda'." + + compile cerfpda_misc.c lcd_support.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + + implements CYGHWR_HAL_ARM_SA11X0_UART3 + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_VARIANT_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "#define HAL_PLATFORM_CPU \"StrongARM 1110\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"Intrinsyc CerfPDA\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + puts $::cdl_header "#define HAL_PLATFORM_MACHINE_TYPE 31" + } + + cdl_option CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK_OVERRIDE_DEFAULT { + display "Processor clock rate" + calculated 191700 + flavor data + description "The Cerf is optimal at this speed. Caution - selecting + higher speeds may be unreliable." + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + default_value {"RAM"} + legal_values {"RAM" "ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the Cerf eval board it is possible to build + the system for either RAM bootstrap or ROM bootstrap(s). Select + 'ram' when building programs to load into RAM using eCos GDB + stubs. Select 'rom' when building a stand-alone application + which will be put into ROM, or for the special case of + building the eCos GDB stubs themselves." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 2 + + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The cerfpda board has 3 serial ports. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + The cerfpda board has 3 serial ports. This option + chooses which port will be used for diagnostic output." + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + no_define + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + parent CYGPKG_NONE + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "arm-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mcpu=strongarm1100 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which are used to + compile all packages by default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-Wl,--gc-sections -Wl,-static -g -O2 -nostdlib" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) --remove-section=.fixed_vectors -O binary $< $@ + } + } + } + + cdl_component CYGPKG_HAL_ARM_SA11X0_CERFPDA_OPTIONS { + display "StrongARM SA1110/CERFPDA build options" + flavor none + no_define + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + cdl_option CYGSEM_HAL_ARM_SA11X0_CERFPDA_NEPONSET_TIMINGS { + display "Enable special timings for Neponset board" + flavor bool + default_value 0 + description " + Enable this option to force initialization of memory timing + parameters suitable for use with the Neponset expansion board. + This is optional as it does not work for some versions of + Cerf without the board plugged in." + } + + cdl_option CYGPKG_HAL_ARM_SA11X0_CERFPDA_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the StrongARM Cerf HAL. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_HAL_ARM_SA11X0_CERFPDA_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the StrongARM Cerf HAL. These flags are removed from + the set of global flags if present." + } + + cdl_option CYGPKG_HAL_ARM_SA11X0_CERFPDA_TESTS { + display "StrongARM SA1110/CerfPda tests" + flavor data + no_define +# calculated { "tests/dram-test" } + calculated { "" } + description " + This option specifies the set of tests for the StrongARM Cerf HAL." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "arm_sa11x0_cerfpda_ram" : \ + "arm_sa11x0_cerfpda_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"GDB_stubs\" provides support when GDB stubs are included in + the ROM monitor or boot ROM." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } + +} diff --git a/packages/hal/arm/sa11x0/cerfpda/current/include/cerfpda.h b/packages/hal/arm/sa11x0/cerfpda/current/include/cerfpda.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/include/cerfpda.h @@ -0,0 +1,153 @@ +#ifndef CYGONCE_CERF_H +#define CYGONCE_CERF_H + +/*============================================================================= +// +// cerfpda.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-05-08 +// Purpose: Intel SA1110/Assabet platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + + +#ifndef __ASSEMBLER__ +// +// Board Control Register +// Note: This register is write-only. Thus a shadow copy is provided so that +// it may be safely updated/shared by multiple threads. +// +extern unsigned long _cerfpda_BCR; // Shadow copy + +extern void cerfpda_BCR(unsigned long mask, unsigned long value); + +#endif + +// +// Signal assertion levels +// +#define SA1110_LOGIC_ONE(m) (m & 0xFFFFFFFF) +#define SA1110_LOGIC_ZERO(m) (m & 0x00000000) + +// +// SA1110/Cerf Board Control Register +// +#define SA1110_BOARD_CONTROL REG32_PTR(0x10000000) +#define SA1110_BCR_MIN 0x00000000 // Reset state + +#define SA1110_BCR_CF_POWER 0x00000000 // 1 = CompactFlash power on (##### NA ######) +#define SA1110_BCR_CF_POWER_ON SA1110_LOGIC_ONE(SA1110_BCR_CF_POWER) +#define SA1110_BCR_CF_POWER_OFF SA1110_LOGIC_ZERO(SA1110_BCR_CF_POWER) +#define SA1110_BCR_CF_RESET 0x00000000 // 1 = CompactFlash reset (##### NA #####) +#define SA1110_BCR_CF_RESET_ENABLE SA1110_LOGIC_ONE(SA1110_BCR_CF_RESET) +#define SA1110_BCR_CF_RESET_DISABLE SA1110_LOGIC_ZERO(SA1110_BCR_CF_RESET) +#define SA1110_BCR_SOFT_RESET 0x00000004 // 0 = resets UCB1300, ADI7171, UDA1341 +#define SA1110_BCR_IRDA_FREQ 0x00000008 // 0 = SIR, 1 = MIR/FIR +#define SA1110_BCR_IRDA_MD 0x00000030 // IrDA Mode & range +#define SA1110_BCR_IRDA_MD_MAX 0x00000000 // Max range and power +#define SA1110_BCR_IRDA_MD_OFF 0x00000010 // Shutdown +#define SA1110_BCR_IRDA_MD_23 0x00000020 // 2/3 power +#define SA1110_BCR_IRDA_MD_13 0x00000030 // 1/3 power +#define SA1110_BCR_STEREO_LB 0x00000040 // 1 = Stereo loopback on +#define SA1110_BCR_CF_BUS 0x00000000 // 0 = CompactFlash bus on (##### NA #####) +#define SA1110_BCR_CF_BUS_ON SA1110_LOGIC_ZERO(SA1110_BCR_CF_BUS) +#define SA1110_BCR_CF_BUS_OFF SA1110_LOGIC_ONE(SA1110_BCR_CF_BUS) +#define SA1110_BCR_AUDIO_ON 0x00000100 // 1 = UDA1341, MIC, DAA power on +#define SA1110_BCR_BACKLIGHT 0x00000200 // 1 = LCD backlight on +#define SA1110_BCR_LCD_BPP 0x00000400 // 1 = 16 RGB, 0 = 12 RGB +#define SA1110_BCR_LCD_16BPP SA1110_LOGIC_ONE(SA1110_BCR_LCD_BPP) +#define SA1110_BCR_LCD_12BPP SA1110_LOGIC_ZERO(SA1110_BCR_LCD_BPP) +#define SA1110_BCR_LCD 0x00000800 // 1 = LCD panel and controller on +#define SA1110_BCR_LCD_ON SA1110_LOGIC_ONE(SA1110_BCR_LCD) +#define SA1110_BCR_LCD_OFF SA1110_LOGIC_ZERO(SA1110_BCR_LCD) +#define SA1110_BCR_RS232_ENABLE 0x00001000 // 1 = Enable RS232 signals +#define SA1110_BCR_RED_LED 0x00000001 // 0 = Red LED on +#define SA1110_BCR_RED_LED_ON SA1110_LOGIC_ZERO(SA1110_BCR_RED_LED) +#define SA1110_BCR_RED_LED_OFF SA1110_LOGIC_ONE(SA1110_BCR_RED_LED) +#define SA1110_BCR_GREEN_LED 0x00000002 // 0 = Green LED on +#define SA1110_BCR_GREEN_LED_ON SA1110_LOGIC_ZERO(SA1110_BCR_GREEN_LED) +#define SA1110_BCR_GREEN_LED_OFF SA1110_LOGIC_ONE(SA1110_BCR_GREEN_LED) +#define SA1110_BCR_MOTOR 0x00000004 // 1 = Vibrator motor on +#define SA1110_BCR_MOTOR_ON SA1110_LOGIC_ONE(SA1110_BCR_MOTOR) +#define SA1110_BCR_MOTOR_OFF SA1110_LOGIC_ZERO(SA1110_BCR_MOTOR) +#define SA1110_BCR_COM_DTR 0x00010000 // COM port Data Terminal Ready +#define SA1110_BCR_COM_RTS 0x00020000 // COM port Request To Send +#define SA1110_BCR_RADIO_WAKE 0x00040000 // 1 = Wake up CPU with radio +#define SA1110_BCR_MUTE 0x00200000 // 1 = Audio muted + +#define SA1110_BCR_ETH_SLEEP (1 << 27) // Output pin to put Crystal LAN in sleep mode. + +// +// Special purpose GPIO interrupt mappings +// +#define SA1110_CF_IRQ CYGNUM_HAL_INTERRUPT_GPIO22 +#define SA1110_CF_DETECT CYGNUM_HAL_INTERRUPT_GPIO23 +#define SA1110_IRQ_GPIO_ETH CYGNUM_HAL_INTERRUPT_GPIO26 +#define SA1110_IRQ_GPIO_16X5X CYGNUM_HAL_INTERRUPT_GPIO3 +// +// GPIO layout +// +#define SA1110_GPIO_CF_DETECT 0x00800000 // 0 = Compact Flash detect +#define SA1110_GPIO_CF_PRESENT SA1110_LOGIC_ZERO(SA1110_GPIO_CF_DETECT) +//#define SA1110_GPIO_CF_ABSENT SA1110_LOGIC_ONE(SA1110_GPIO_CF_DETECT) + +// +// LCD Controller +// +#define SA1110_LCCR0 SA11X0_REGISTER(0x30100000) +#define SA1110_LCSR SA11X0_REGISTER(0x30100004) +#define SA1110_DBAR1 SA11X0_REGISTER(0x30100010) +#define SA1110_DCAR1 SA11X0_REGISTER(0x30100014) +#define SA1110_DBAR2 SA11X0_REGISTER(0x30100018) +#define SA1110_DCAR2 SA11X0_REGISTER(0x3010001C) +#define SA1110_LCCR1 SA11X0_REGISTER(0x30100020) +#define SA1110_LCCR2 SA11X0_REGISTER(0x30100024) +#define SA1110_LCCR3 SA11X0_REGISTER(0x30100028) + +/*---------------------------------------------------------------------------*/ +/* end of cerfpda.h */ +#endif /* CYGONCE_CERF_H */ diff --git a/packages/hal/arm/sa11x0/cerfpda/current/include/hal_platform_setup.h b/packages/hal/arm/sa11x0/cerfpda/current/include/hal_platform_setup.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/include/hal_platform_setup.h @@ -0,0 +1,324 @@ +#ifndef CYGONCE_HAL_PLATFORM_SETUP_H +#define CYGONCE_HAL_PLATFORM_SETUP_H + +/*============================================================================= +// +// hal_platform_setup.h +// +// Platform specific support for HAL (assembly code) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-05-08 +// Purpose: Intel SA1110/Assabet platform specific support routines +// Description: +// Usage: #include +// Only used by "vectors.S" +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include // System-wide configuration info +#include CYGBLD_HAL_VARIANT_H // Variant (SA11x0) specific configuration +#include CYGBLD_HAL_PLATFORM_H // Platform specific configuration +#include // Variant specific hardware definitions +#include // MMU definitions +#include // Platform specific hardware definitions + +#if defined(CYG_HAL_STARTUP_ROM) +#define PLATFORM_SETUP1 _platform_setup1 +#define CYGHWR_HAL_ARM_HAS_MMU + +#if (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 59000) +#define SA11X0_PLL_CLOCK 0x0 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 73700) +#define SA11X0_PLL_CLOCK 0x1 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 88500) +#define SA11X0_PLL_CLOCK 0x2 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 103200) +#define SA11X0_PLL_CLOCK 0x3 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 118000) +#define SA11X0_PLL_CLOCK 0x4 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 132700) +#define SA11X0_PLL_CLOCK 0x5 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 147500) +#define SA11X0_PLL_CLOCK 0x6 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 162200) +#define SA11X0_PLL_CLOCK 0x7 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 176900) +#define SA11X0_PLL_CLOCK 0x8 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 191700) +#define SA11X0_PLL_CLOCK 0x9 +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 206400) +#define SA11X0_PLL_CLOCK 0xA +#elif (CYGHWR_HAL_ARM_SA11X0_PROCESSOR_CLOCK == 221200) +#define SA11X0_PLL_CLOCK 0xB +#else +#error Invalid processor clock speed +#endif + + +#define CAS0_WAVEFORM_VALUE 0xAAAAAA9F +#define CAS1_WAVEFORM_VALUE 0xAAAAAAAA +#define CAS2_WAVEFORM_VALUE 0xAAAAAAAA + +#define MSC0VALUE 0xFFFCFFF8 +#define MSC1VALUE 0xFFFFFFFF +#define MSC2VALUE 0xFFFFFFFF + +#define DRAM_CONFIG_VALUE 0x72647264 +#define RFSH_CONFIG_VALUE 0x00300161 + +// Macros that handle the red debug LED wired to GPIO-1 + + .macro _LED_ON,led + ldr r1,=SA11X0_GPIO_PIN_OUTPUT_SET + mov r0,#(1<<\led) + str r0,[r1] + // Delay + ldr r1,=10000 +10: sub r1,r1,#1 + cmp r1,#0 + bne 10b + .endm + + .macro _LED_OFF,led + ldr r1,=SA11X0_GPIO_PIN_OUTPUT_CLEAR + mov r0,#(1<<\led) + str r0,[r1] + // Delay + ldr r1,=10000 +10: sub r1,r1,#1 + cmp r1,#0 + bne 10b + .endm + +// This macro represents the initial startup code for the platform + .macro _platform_setup1 + + // Disable all interrupts (ICMR not specified on power-up) + ldr r1,=SA11X0_ICMR + mov r0,#0 + str r0,[r1] + + // Initialize the CPU. + mov r0, #0x0 // Get a zero to turn things off + mcr p15, 0, r0, c1, c0, 0 // MMU off + mcr p15, 0, r0, c8, c7, 0 // Flush TLB + mcr p15, 0, r0, c7, c7, 0 // Flush caches + nop + nop + nop + nop + + // Disable IRQs and FIQs + mov r0, #(CPSR_IRQ_DISABLE | \ + CPSR_FIQ_DISABLE | \ + CPSR_SUPERVISOR_MODE) + msr cpsr, r0 + + // Set up GPIOs (LED1 off) + ldr r1,=SA11X0_GPIO_PIN_DIRECTION + ldr r2,=0x0320000f // Set LT1348,DREN,RXEN,CF and LEDs to be output + str r2,[r1] + ldr r3,=SA11X0_GPIO_PIN_OUTPUT_SET + ldr r2,=0x0300000f // Set the LT1348,DREN,RXEN and LEDs to 1. + str r2,[r3] + ldr r3,=SA11X0_GPIO_PIN_OUTPUT_CLEAR + ldr r2,=0x0020000f // Set CF reset,LEDS OFF + str r2,[r3] + + // Turn on LED 0 + _LED_ON 0 + + // Disable clock switching + mcr p15,0,r0,\ + SA11X0_TEST_CLOCK_AND_IDLE_REGISTER,\ + SA11X0_DISABLE_CLOCK_SWITCHING_RM,\ + SA11X0_DISABLE_CLOCK_SWITCHING_OPCODE + + // Set up processor clock + ldr r1,=SA11X0_PWR_MGR_PLL_CONFIG + ldr r2,=SA11X0_PLL_CLOCK + str r2,[r1] + + // Turn clock switching back on + mcr p15,0,r0,\ + SA11X0_TEST_CLOCK_AND_IDLE_REGISTER,\ + SA11X0_ENABLE_CLOCK_SWITCHING_RM,\ + SA11X0_ENABLE_CLOCK_SWITCHING_OPCODE + nop + nop + + // Let the PLL settle down + ldr r1,=20000 +10: sub r1,r1,#1 + cmp r1,#0 + bne 10b + + // Turn on LED 1 + _LED_ON 1 + + // Initialize DRAM controller + ldr r1,=dram_table + ldr r2,=__exception_handlers + sub r1,r1,r2 + ldr r2,[r1],#4 // First control register +10: ldr r3,[r1],#4 + str r3,[r2] + ldr r2,[r1],#4 // Next control register + cmp r2,#0 + bne 10b + + // Turn on LED 2 + _LED_ON 2 + + // Enable UART + ldr r1,=SA1110_GPCLK_CONTROL_0 + ldr r2,=SA1110_GPCLK_SUS_UART + str r2,[r1] + + // Release DRAM hold (set by RESET) + ldr r1,=SA11X0_PWR_MGR_SLEEP_STATUS + ldr r2,=SA11X0_DRAM_CONTROL_HOLD + str r2,[r1] + + // Perform 8 reads from unmapped/unenabled DRAM + ldr r1,=SA11X0_RAM_BANK0_BASE + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + ldr r2,[r1] + + // Enable DRAM bank 0 + ldr r1,=SA11X0_DRAM_CONFIGURATION + ldr r2,=DRAM_CONFIG_VALUE + ldr r3,=0x00030003 + orr r2, r2, r3 + str r2,[r1] + + // Wait for the DRAM to come up. + mov r1, #0x400 +0: subs r1, r1, #1 + bne 0b + + // Turn on LED 3 + _LED_ON 3 + + b 19f + +// DRAM controller initialization +dram_table: + .word SA11X0_DRAM0_CAS_0, CAS0_WAVEFORM_VALUE + .word SA11X0_DRAM0_CAS_1, CAS1_WAVEFORM_VALUE + .word SA11X0_DRAM0_CAS_2, CAS2_WAVEFORM_VALUE + .word SA11X0_DRAM2_CAS_0, CAS0_WAVEFORM_VALUE + .word SA11X0_DRAM2_CAS_1, CAS1_WAVEFORM_VALUE + .word SA11X0_DRAM2_CAS_2, CAS2_WAVEFORM_VALUE + .word SA11X0_REFRESH_CONFIGURATION, RFSH_CONFIG_VALUE + .word SA11X0_DRAM_CONFIGURATION, DRAM_CONFIG_VALUE + .word SA11X0_STATIC_CONTROL_0, MSC0VALUE + .word SA11X0_STATIC_CONTROL_1, MSC1VALUE + .word SA11X0_STATIC_CONTROL_2, MSC2VALUE + .word 0, 0 + +19: + // Wakeup from deep sleep mode + ldr r1,=SA11X0_RESET_STATUS + ldr r2,[r1] + cmp r2,#SA11X0_SLEEP_MODE_RESET + bne 45f + ldr r1,=SA11X0_PWR_MGR_SCRATCHPAD + ldr r1,[r1] + mov pc,r1 + nop +45: nop + + // Release peripheral hold (set by RESET) + ldr r1,=SA11X0_PWR_MGR_SLEEP_STATUS + ldr r2,=SA11X0_PERIPHERAL_CONTROL_HOLD + str r2,[r1] + + // Set up a stack [for calling C code] + ldr r1,=__startup_stack + ldr r2,=SA11X0_RAM_BANK0_BASE + orr sp,r1,r2 + + // Create MMU tables + bl hal_mmu_init + + // Turn OFF LED 0 + _LED_OFF 0 + + // Enable MMU + ldr r2,=10f + ldr r1,=MMU_Control_Init|MMU_Control_M + mcr MMU_CP,0,r1,MMU_Control,c0 + mov pc,r2 /* Change address spaces */ + nop + nop + nop + +10: + // Turn OFF LED 1 + _LED_OFF 1 + + // Save shadow copy of BCR, also hardware configuration + ldr r1,=_cerfpda_BCR + str r2,[r1] + .endm + +#else // defined(CYG_HAL_STARTUP_ROM) +#define PLATFORM_SETUP1 +#endif + +#define PLATFORM_VECTORS _platform_vectors + .macro _platform_vectors + .globl _cerfpda_BCR +_cerfpda_BCR: .long 0 // Board Control register shadow + .endm + +/*---------------------------------------------------------------------------*/ +/* end of hal_platform_setup.h */ +#endif /* CYGONCE_HAL_PLATFORM_SETUP_H */ diff --git a/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.h b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.h @@ -0,0 +1,17 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x4000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x4000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.ldi b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.ldi @@ -0,0 +1,27 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x4000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x20000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.mlt b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_ram.mlt @@ -0,0 +1,13 @@ +version 0 +region ram 0 4000000 0 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section rom_vectors 0 1 0 1 1 1 1 1 20000 20000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.h b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.h @@ -0,0 +1,20 @@ +// eCos memory layout - Fri Oct 20 05:56:55 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x4000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0x50000000) +#define CYGMEM_REGION_rom_SIZE (0x2000000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x4000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.ldi b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.ldi @@ -0,0 +1,28 @@ +// eCos memory layout - Fri Oct 20 05:56:55 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x4000000 + rom : ORIGIN = 0x50000000, LENGTH = 0x2000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x50000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_data (ram, 0x8000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.mlt b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/include/pkgconf/mlt_arm_sa11x0_cerfpda_rom.mlt @@ -0,0 +1,14 @@ +version 0 +region ram 0 4000000 0 ! +region rom 50000000 2000000 1 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section data 0 1 1 1 1 1 0 0 8000 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 50000000 50000000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 0 0 1 data ! diff --git a/packages/hal/arm/sa11x0/cerfpda/current/include/plf_io.h b/packages/hal/arm/sa11x0/cerfpda/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/include/plf_io.h @@ -0,0 +1,60 @@ +#ifndef CYGONCE_HAL_ARM_SA11X0_CERFPDA_PLF_IO_H +#define CYGONCE_HAL_ARM_SA11X0_CERFPDA_PLF_IO_H + +/*============================================================================= +// +// plf_io.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#endif // CYGONCE_HAL_ARM_SA11X0_CERFPDA_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/sa11x0/cerfpda/current/include/plf_mmap.h b/packages/hal/arm/sa11x0/cerfpda/current/include/plf_mmap.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/include/plf_mmap.h @@ -0,0 +1,158 @@ +#ifndef CYGONCE_HAL_SA11X0_PLATFORM_PLF_MMAP_H +#define CYGONCE_HAL_SA11X0_PLATFORM_PLF_MMAP_H +/*============================================================================= +// +// plf_mmap.h +// +// Platform specific memory map support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 2001-01-04 +// Purpose: Intel SA11x0 series platform-specific memory mapping macros +// Description: Macros to convert a cached, virtual address to +// 1) an uncached adddress for the same memory (if available) +// 2) the equivalent physical address for giving to external +// hardware eg. DMA engines. +// +// NB: this mapping is expressed here statically, independent +// of the actual mapping installed in the MMAP table. So if +// someone changes that, or its initialisation is changed, +// then this module must change. This is intended to be +// efficient at a cost of generality. It is also intended to +// be called with constants (such as &my_struct) as input +// args, so that all the work can be done at compile time, +// with optimization on. +// +// Usage: #include +// (which includes this file itself) +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +// Get the pagesize for a particular virtual address: + +// This does not depend on the vaddr. +#define HAL_MM_PAGESIZE( vaddr, pagesize ) CYG_MACRO_START \ + (pagesize) = SZ_1M; \ +CYG_MACRO_END + +// Get the physical address from a virtual address: + +// Only RAM and ROM are mapped; we just pass through all other values, +// rather than detecting nonexistent areas here. + +#define HAL_VIRT_TO_PHYS_ADDRESS( vaddr, paddr ) CYG_MACRO_START \ + cyg_uint32 _v_ = (cyg_uint32)(vaddr); \ + if ( 32 * SZ_1M > _v_ ) /* 32Mb of SDRAM Bank 0 from 0-32Mb */ \ + _v_ += 0xc00u * SZ_1M; \ + else if ( 0x500u * SZ_1M > _v_ ) /* Space between RAM and mapped ROM */\ + /* no change */ ; \ + else if ( 0x520u * SZ_1M > _v_ ) /* Mapped boot ROM size 32Mb */ \ + _v_ -= 0x500u * SZ_1M; \ + else if ( 0xf00u * SZ_1M > _v_ ) /* Space between ROM and mapped I/O */\ + /* no change */ ; \ + else if ( 0xf10u * SZ_1M > _v_ ) /* Mapped I/O size 16Mb */ \ + _v_ = (_v_ - 0xf00u * SZ_1M) + (0x080u * SZ_1M); \ + else /* Rest of it */ \ + /* no change */ ; \ + (paddr) = _v_; \ +CYG_MACRO_END + +// Get the virtual address for a physical address: + +// Only RAM and ROM are mapped; we just pass through all other values, +// rather than detecting nonexistent areas here. + +#define HAL_PHYS_TO_VIRT_ADDRESS( paddr, vaddr ) CYG_MACRO_START \ + cyg_uint32 _p_ = (cyg_uint32)(paddr); \ + if ( 32 * SZ_1M > _p_ ) /* 32Mb Boot ROM mapped to 0x500Mb */ \ + _p_ += 0x500u * SZ_1M; \ + else if ( 0x080u * SZ_1M > _p_ ) /* Space between ROM and I/O */ \ + /* no change */ ; \ + else if ( 0x090u * SZ_1M > _p_ ) /* I/O size 16Mb */ \ + _p_ = (_p_ - 0x080u * SZ_1M) + (0xf00u * SZ_1M); \ + else if ( 0xc00u * SZ_1M > _p_ ) /* Space between I/O and SDRAM */ \ + /* no change */ ; \ + else if ( 0xc20u * SZ_1M > _p_ ) /* Raw RAM size 32Mb */ \ + _p_ -= 0xc00u * SZ_1M; \ + else /* Rest of it */ \ + /* no change */ ; \ + (vaddr) = _p_ ; \ +CYG_MACRO_END + +// Get the virtual address for a physical address: + +// Only RAM and ROM are mapped; we just pass through all other values, +// rather than detecting nonexistent areas here. + +#define HAL_PHYS_TO_VIRT_ADDRESS( paddr, vaddr ) CYG_MACRO_START \ + cyg_uint32 _p_ = (cyg_uint32)(paddr); \ + if ( 32 * SZ_1M > _p_ ) /* 32Mb Boot ROM mapped to 0x500Mb */ \ + _p_ += 0x500u * SZ_1M; \ + else if ( 0xc00u * SZ_1M > _p_ ) /* Space between ROM and SDRAM */ \ + /* no change */ ; \ + else if ( 0xc20u * SZ_1M > _p_ ) /* Raw RAM size 32Mb */ \ + _p_ -= 0xc00u * SZ_1M; \ + else /* Rest of it */ \ + /* no change */ ; \ + (vaddr) = _p_ ; \ +CYG_MACRO_END + +// Get a non-cacheable address for accessing the same store as a virtual +// (assumed cachable) address: + +// Only RAM is mapped: ROM is only available cachable, everything else is +// not cachable anyway. + +#define HAL_VIRT_TO_UNCACHED_ADDRESS( vaddr, uaddr ) CYG_MACRO_START \ + cyg_uint32 _v_ = (cyg_uint32)(vaddr); \ + if ( 32 * SZ_1M > _v_ ) /* 32Mb of SDRAM Bank 0 from 0-32Mb */ \ + _v_ += 0xc00u * SZ_1M; \ + else /* Everything else is already uncacheable or is ROM */ \ + /* no change */ ; \ + (uaddr) = _v_ ; \ +CYG_MACRO_END + +//--------------------------------------------------------------------------- +#endif // CYGONCE_HAL_SA11X0_PLATFORM_PLF_MMAP_H +// EOF plf_mmap.h diff --git a/packages/hal/arm/sa11x0/cerfpda/current/misc/eCos.xpm b/packages/hal/arm/sa11x0/cerfpda/current/misc/eCos.xpm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/misc/eCos.xpm @@ -0,0 +1,254 @@ +/* XPM */ +static char * eCos_xpm[] = { +"320 240 11 1", +" c None", +". c #FFFFFF", +"+ c #C7C7C7", +"@ c #AAAAAA", +"# c #727272", +"$ c #555555", +"% c #1D1D1D", +"& c #000000", +"* c #393939", +"= c #8E8E8E", +"- c #E3E3E3", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"......................................................................................................................................+@#$$$%&&&$$$#@+..........................................................................................................................................................................", +"..................................................................................................................................+#*&&&&&&&&&&&&&&&&&&$=-......................................................................................................................................................................", +"...............................................................................................................................-#%&&&&&&&&&&&&&&&&&&&&&&&&*@....................................................................................................................................................................", +".............................................................................................................................+*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%=..................................................................................................................................................................", +"...........................................................................................................................+*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*-................................................................................................................................................................", +".........................................................................................................................-*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@...............................................................................................................................................................", +"........................................................................................................................=&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$..............................................................................................................................................................", +"......................................................................................................................-*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.............................................................................................................................................................", +".....................................................................................................................@%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$............................................................................................................................................................", +"....................................................................................................................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@...........................................................................................................................................................", +"...................................................................................................................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-..........................................................................................................................................................", +"..................................................................................................................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*..........................................................................................................................................................", +".................................................................................................................$&&&&&&&&&&&&&&&&&&&&&&&&&$$*&&&&&&&&&&&&&&&&&&&&&&&&+.........................................................................................................................................................", +"................................................................................................................@&&&&&&&&&&&&&&&&&&&&*#@........+=%&&&&&&&&&&&&&&&&&&&$.........................................................................................................................................................", +"...............................................................................................................@&&&&&&&&&&&&&&&&&&&#-..............+*&&&&&&&&&&&&&&&&&&.........................................................................................................................................................", +"..............................................................................................................+&&&&&&&&&&&&&&&&&&#-..................#&&&&&&&&&&&&&&&&&@........................................................................................................................................................", +".............................................................................................................-%&&&&&&&&&&&&&&&&%+.....................@&&&&&&&&&&&&&&&&$........................................................................................................................................................", +".............................................................................................................$&&&&&&&&&&&&&&&&*-.......................#&&&&&&&&&&&&&&&*........................................................................................................................................................", +"............................................................................................................@&&&&&&&&&&&&&&&&$..........................%&&&&&&&&&&&&&&&........................................................................................................................................................", +"..................................................................@@@$$$$@@@...............................-%&&&&&&&&&&&&&&&$...........................=&&&&&&&&&&&&&&&.............................@@@#$$$$@@@...............................................+@@=$$$$#@@+.....................................................", +".............................................................-@$%&&&&&&&&&&&&%#+...........................#&&&&&&&&&&&&&&&%.............................&&&&&&&&&&&&&&&........................-=$%&&&&&&&&&&&&&%#@......................................-=$%&&&&&&&&&&&&&&%$@.................................................", +"...........................................................=*&&&&&&&&&&&&&&&&&&&%=........................+&&&&&&&&&&&&&&&%-.............................*&&&&&&&&&&&&&&.....................-#%&&&&&&&&&&&&&&&&&&&&%#-................................-=*&&&&&&&&&&&&&&&&&&&&&&#+..............................................", +"........................................................-#&&&&&&&&&&&&&&&&&&&&&&&&%=......................*&&&&&&&&&&&&&&&@..............................$&&&&&&&&&&&&&&...................+*&&&&&&&&&&&&&&&&&&&&&&&&&&#.............................-#&&&&&&&&&&&&&&&&&&&&&&&&&&&$-............................................", +".......................................................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&$-...................+&&&&&&&&&&&&&&&#...............................#&&&&&&&&&&&&&&.................-*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+..........................=&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@...........................................", +".....................................................+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%-..................*&&&&&&&&&&&&&&%................................@&&&&&&&&&&&&&%................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.......................-*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@..........................................", +"....................................................=&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%-................+&&&&&&&&&&&&&&&=................................@&&&&&&&&&&&&&$..............-*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.....................-%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........................................", +"...................................................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*................$&&&&&&&&&&&&&&*.............................................................@%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@...................-%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+........................................", +"..................................................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#..............-&&&&&&&&&&&&&&&+............................................................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-.................-%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*........................................", +".................................................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+.............=&&&&&&&&&&&&&&*............................................................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*.................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+.......................................", +"................................................=&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*.............%&&&&&&&&&&&&&&@...........................................................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&=...............#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.......................................", +"...............................................+&&&&&&&&&&&&&&&&&&&%$$%&&&&&&&&&&&&&&&&&&&+...........+&&&&&&&&&&&&&&%...........................................................-&&&&&&&&&&&&&&&&&&&&%$$%&&&&&&&&&&&&&&&&&&&&%..............+&&&&&&&&&&&&&&&&&&&$$$*&&&&&&&&&&&&&&&&&&&&.......................................", +"..............................................-%&&&&&&&&&&&&&&&%#+......@*&&&&&&&&&&&&&&&&$...........#&&&&&&&&&&&&&&=..........................................................-%&&&&&&&&&&&&&&&&&$@......@$&&&&&&&&&&&&&&&&&&@.............*&&&&&&&&&&&&&&&#@........@$&&&&&&&&&&&&&&&&-......................................", +"..............................................#&&&&&&&&&&&&&&&=...........+%&&&&&&&&&&&&&&&...........%&&&&&&&&&&&&&&-..........................................................$&&&&&&&&&&&&&&&&$-..........+%&&&&&&&&&&&&&&&&$............+&&&&&&&&&&&&&&$-............-%&&&&&&&&&&&&&&@......................................", +".............................................+&&&&&&&&&&&&&&%-.............-%&&&&&&&&&&&&&&@.........+&&&&&&&&&&&&&&*..........................................................@&&&&&&&&&&&&&&&&@.............-%&&&&&&&&&&&&&&&&............*&&&&&&&&&&&&&*...............-%&&&&&&&&&&&&&@......................................", +".............................................*&&&&&&&&&&&&&%-...............=&&&&&&&&&&&&&&$.........=&&&&&&&&&&&&&&=..........................................................%&&&&&&&&&&&&&&%+...............-&&&&&&&&&&&&&&&&+..........-&&&&&&&&&&&&&&+................#&&&&&&&&&&&&&@......................................", +"............................................=&&&&&&&&&&&&&%-.................%&&&&&&&&&&&&&%.........$&&&&&&&&&&&&&&-.........................................................#&&&&&&&&&&&&&&&-.................=&&&&&&&&&&&&&&&@..........@&&&&&&&&&&&&&&.................@&&&&&&&&&&&&&@......................................", +"............................................%&&&&&&&&&&&&&+..................#&&&&&&&&&&&&&&.........&&&&&&&&&&&&&&%.........................................................-&&&&&&&&&&&&&&&@...................&&&&&&&&&&&&&&&#..........$&&&&&&&&&&&&&&.................@&&&&&&&&&&&&&.......................................", +"...........................................=&&&&&&&&&&&&&$...................@&&&&&&&&&&&&&&........+&&&&&&&&&&&&&&$.........................................................#&&&&&&&&&&&&&&#....................$&&&&&&&&&&&&&&$..........*&&&&&&&&&&&&&&=................=$$$$$$$$$$$$$.......................................", +"...........................................*&&&&&&&&&&&&&+...................+&&&&&&&&&&&&&&@.......@&&&&&&&&&&&&&&@........................................................-&&&&&&&&&&&&&&%.....................@&&&&&&&&&&&&&&$..........&&&&&&&&&&&&&&&&#-...................................................................", +"..........................................+&&&&&&&&&&&&&*.....................&&&&&&&&&&&&&&@.......$&&&&&&&&&&&&&&+........................................................=&&&&&&&&&&&&&&+.....................+&&&&&&&&&&&&&&$..........&&&&&&&&&&&&&&&&&&#+.................................................................", +"..........................................$&&&&&&&&&&&&&=.....................&&&&&&&&&&&&&&+.......*&&&&&&&&&&&&&&.........................................................%&&&&&&&&&&&&&*.......................&&&&&&&&&&&&&&$..........&&&&&&&&&&&&&&&&&&&&%$@..............................................................", +"..........................................&&&&&&&&&&&&&&-.....................&&&&&&&&&&&&&&........&&&&&&&&&&&&&&*........................................................+&&&&&&&&&&&&&&+.......................&&&&&&&&&&&&&&$..........%&&&&&&&&&&&&&&&&&&&&&&&*=-..........................................................", +".........................................@&&&&&&&&&&&&&&$$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&&&&&........&&&&&&&&&&&&&&$........................................................#&&&&&&&&&&&&&*........................&&&&&&&&&&&&&&$..........$&&&&&&&&&&&&&&&&&&&&&&&&&&%#@.......................................................", +".........................................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.......@&&&&&&&&&&&&&&$........................................................%&&&&&&&&&&&&&=........................&&&&&&&&&&&&&&@..........+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$@....................................................", +".........................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%.......@&&&&&&&&&&&&&&=.......................................................+&&&&&&&&&&&&&&-........................&&&&&&&&&&&&&&@...........*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#+.................................................", +"........................................+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.......@&&&&&&&&&&&&&&@.......................................................=&&&&&&&&&&&&&*........................+&&&&&&&&&&&&&&+...........+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*-...............................................", +"........................................=&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#.......#&&&&&&&&&&&&&&@.......................................................$&&&&&&&&&&&&&#........................@&&&&&&&&&&&&&&.............@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&=..............................................", +"........................................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.......$&&&&&&&&&&&&&&@.......................................................&&&&&&&&&&&&&&@........................@&&&&&&&&&&&&&%..............@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.............................................", +"........................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-.......$&&&&&&&&&&&&&&@......................................................+&&&&&&&&&&&&&&-........................$&&&&&&&&&&&&&$...............-%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$............................................", +"........................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&........$&&&&&&&&&&&&&&@.................................+$$$$$$$$$$$$$$......@&&&&&&&&&&&&&&.........................%&&&&&&&&&&&&&@.................=%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................................", +".......................................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$........$&&&&&&&&&&&&&&@.................................*&&&&&&&&&&&&&$......#&&&&&&&&&&&&&%........................-&&&&&&&&&&&&&&-...................=%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-..........................................", +".......................................@&&&&&&&&&&&&&&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@........$&&&&&&&&&&&&&&$................................-&&&&&&&&&&&&&&@......$&&&&&&&&&&&&&$........................@&&&&&&&&&&&&&%......................@$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#..........................................", +".......................................=&&&&&&&&&&&&&&.............................................$&&&&&&&&&&&&&&$................................#&&&&&&&&&&&&&&-......$&&&&&&&&&&&&&$........................*&&&&&&&&&&&&&#.........................@$&&&&&&&&&&&&&&&&&&&&&&&&&&&&..........................................", +".......................................$&&&&&&&&&&&&&&.............................................$&&&&&&&&&&&&&&%...............................-&&&&&&&&&&&&&&$.......&&&&&&&&&&&&&&$.......................-&&&&&&&&&&&&&&+............................@$&&&&&&&&&&&&&&&&&&&&&&&&&-.........................................", +".......................................$&&&&&&&&&&&&&&.............................................=&&&&&&&&&&&&&&&-..............................#&&&&&&&&&&&&&&@.......&&&&&&&&&&&&&&$.......................#&&&&&&&&&&&&&%................................+#%&&&&&&&&&&&&&&&&&&&&&@.........................................", +".......................................$&&&&&&&&&&&&&&.............................................@&&&&&&&&&&&&&&&=.............................+&&&&&&&&&&&&&&%........&&&&&&&&&&&&&&$......................-&&&&&&&&&&&&&&#...................................+#%&&&&&&&&&&&&&&&&&&@.........................................", +".......................................$&&&&&&&&&&&&&&.............................................+&&&&&&&&&&&&&&&%............................-%&&&&&&&&&&&&&&=........&&&&&&&&&&&&&&%......................#&&&&&&&&&&&&&&-......................................@*&&&&&&&&&&&&&&&&@.........................................", +".......................................$&&&&&&&&&&&&&&..............................................&&&&&&&&&&&&&&&&=...........................$&&&&&&&&&&&&&&%.........&&&&&&&&&&&&&&&.....................-&&&&&&&&&&&&&&$.........................................=&&&&&&&&&&&&&&&@.........................................", +".......................................$&&&&&&&&&&&&&&+.............................................*&&&&&&&&&&&&&&&%-.........................$&&&&&&&&&&&&&&&=.........&&&&&&&&&&&&&&&@....................*&&&&&&&&&&&&&&+.......-@@@@@@@@@@@@@+....................#&&&&&&&&&&&&&&-.........................................", +".......................................@&&&&&&&&&&&&&&=...................*&&&&&&&&&&&&&-...........=&&&&&&&&&&&&&&&&$.......................-*&&&&&&&&&&&&&&&%..........%&&&&&&&&&&&&&&$...................#&&&&&&&&&&&&&&*........@&&&&&&&&&&&&&$....................@&&&&&&&&&&&&&&..........................................", +".......................................@&&&&&&&&&&&&&&%..................=&&&&&&&&&&&&&#............+&&&&&&&&&&&&&&&&&$.....................+%&&&&&&&&&&&&&&&&@..........$&&&&&&&&&&&&&&&-.................@&&&&&&&&&&&&&&&+........$&&&&&&&&&&&&&%....................@&&&&&&&&&&&&&*..........................................", +"........................................&&&&&&&&&&&&&&&=................@&&&&&&&&&&&&&%-.............*&&&&&&&&&&&&&&&&&*-.................-$&&&&&&&&&&&&&&&&&$...........#&&&&&&&&&&&&&&&*................@&&&&&&&&&&&&&&&#.........$&&&&&&&&&&&&&&+...................*&&&&&&&&&&&&&=..........................................", +"........................................*&&&&&&&&&&&&&&&+..............@&&&&&&&&&&&&&&=..............=&&&&&&&&&&&&&&&&&&&#-.............+$&&&&&&&&&&&&&&&&&&%-...........@&&&&&&&&&&&&&&&&$..............$&&&&&&&&&&&&&&&%-.........$&&&&&&&&&&&&&&%-.................#&&&&&&&&&&&&&&-..........................................", +"........................................=&&&&&&&&&&&&&&&&@...........-*&&&&&&&&&&&&&&$................%&&&&&&&&&&&&&&&&&&&&*=@-....-@=$&&&&&&&&&&&&&&&&&&&&&+.............&&&&&&&&&&&&&&&&&$-..........+%&&&&&&&&&&&&&&&&@..........=&&&&&&&&&&&&&&&%+..............-$&&&&&&&&&&&&&&*...........................................", +"........................................-&&&&&&&&&&&&&&&&&*@.......@*&&&&&&&&&&&&&&&%-................=&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@..............$&&&&&&&&&&&&&&&&&%=-......@*&&&&&&&&&&&&&&&&&#...........@&&&&&&&&&&&&&&&&&*=-........-@$&&&&&&&&&&&&&&&&+...........................................", +".........................................#&&&&&&&&&&&&&&&&&&&*$$$%&&&&&&&&&&&&&&&&&&@..................*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&=...............+&&&&&&&&&&&&&&&&&&&&%$$$%&&&&&&&&&&&&&&&&&&&*.............&&&&&&&&&&&&&&&&&&&&&*$$$$*&&&&&&&&&&&&&&&&&&&*............................................", +".........................................-&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@...................-&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.................*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%-.............#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-............................................", +"..........................................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.....................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&=..................-&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%-..............-&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.............................................", +"...........................................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.......................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@....................=&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%-................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@..............................................", +"...........................................-%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%-......................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$-..................*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@...............................................", +"............................................-%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+...........................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#.........................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#....................-%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@................................................", +".............................................-%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$-.............................+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*+...........................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+......................-%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*-.................................................", +"..............................................-*&&&&&&&&&&&&&&&&&&&&&&&&&&&%@................................-#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%=..............................=&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#..........................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%=...................................................", +"................................................=%&&&&&&&&&&&&&&&&&&&&&&&%=....................................-$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*@.................................-*&&&&&&&&&&&&&&&&&&&&&&&&&&#-............................+*&&&&&&&&&&&&&&&&&&&&&&&&&&&&%=-....................................................", +".................................................-#%&&&&&&&&&&&&&&&&&&&*@........................................-#%&&&&&&&&&&&&&&&&&&&&&&&*#-.....................................+$&&&&&&&&&&&&&&&&&&&&&*=.................................+*&&&&&&&&&&&&&&&&&&&&&&&&$@.......................................................", +"....................................................@$&&&&&&&&&&&&&%$@-.............................................+=$&&&&&&&&&&&&&&&&*$@-..........................................-@$&&&&&&&&&&&&&&&$=-.....................................-=$&&&&&&&&&&&&&&&&&*#@..........................................................", +".......................................................-@@$$$$$#@@......................................................-@@=$$$$$$#@@+...................................................-@@#$$$$$=@@...............................................@@=$$$$$$$=@@-..............................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................"}; diff --git a/packages/hal/arm/sa11x0/cerfpda/current/misc/eCos2.xpm b/packages/hal/arm/sa11x0/cerfpda/current/misc/eCos2.xpm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/misc/eCos2.xpm @@ -0,0 +1,260 @@ +/* XPM */ +static char * eCos2_xpm[] = { +"320 240 17 1", +" c None", +". c #020204", +"+ c #909091", +"@ c #D2D2D2", +"# c #535352", +"$ c #EC9199", +"% c #E84F4D", +"& c #F4B2B4", +"* c #ED6B65", +"= c #FEFEFC", +"- c #EA1A05", +"; c #323232", +"> c #B1B1B1", +", c #747474", +"' c #F4D1DA", +") c #E7362D", +"! c #171717", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".======================@@@@@@>@>@>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>@@================''&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'&'&'&''''==================.", +".===================='=@>>>+++,,,+,########################################################################################################+@================'$************************************************************************************************************************************$*$*$$$&&&''================.", +".=====================@>>,,###;#;;;!.......................................................................................................#>================&*----------------------------------------------------------------------------------------------------------------------------------))))))%%%*$$''================.", +".================@@>>++,,##;;;;;;;!........................................................................................................#>================&*------------------------------------------------------------------------------------------------------------------------------------)))))))%**$$&&'''===========.", +".=============='@>+,,##;;;;!!!!.!!!........................................................................................................#>================&*------------------------------------------------------------------------------------------------------------------------------------)---)-)))%%***$$&'==========.", +".===============>+,;!......................................................................................................................#>================&%-------------------------------------------------------------------------------------------------------------------------------------------------)%*$'==========.", +".==========@@@>>,,;;!......................................................................................................................#>================&*-------------------------------------------------------------------------------------------------------------------------------------------------))%*$$&''======.", +".==========@>+,##;!!.......................................................................................................................#>================&%--------------------------------------------------------------------------------------------------------------------------------------------------))%%*$$&''====.", +".=========@>>,#!!..........................................................................................................................#>================&*-------------------------------------------------------------------------------------------------------------------------------------------------------)*$&'====.", +".=======@@>+##;.!..........................................................................................................................#>================&%-------------------------------------------------------------------------------------------------------------------------------------------------------)%*$&''==.", +".======@>+,#;;!............................................................................................................................#>================&*--------------------------------------------------------------------------------------------------------------------------------------------------------))%$$&'=.", +".======@+,;!...............................................................................................................................#>================&%----------------------------------------------------------------------------------------------------------------------------------------------------------)%*&'=.", +".====@@+,;;!...............................................................................................................................#>================&*-----------------------------------------------------------------------------------------------------------------------------------------------------------)%*&'.", +".===@>+,#!!!...............................................................................................................................#>================&%-----------------------------------------------------------------------------------------------------------------------------------------------------------))%*$.", +".===@+#;;..................................................................................................................................#>================&*-------------------------------------------------------------------------------------------------------------------------------------------------------------)%*.", +".='@>+;;!..........................................!.!!!!!!!!..............................................................................#>================&%-------------------------------------------------------------------------------------------------------------------------------------------------------------))%.", +".=@>+#!!..........................................!!!!;!;!!!!!.............................................................................#>================&*----------------------------------------------))))))----------------------------------------------------------------------------------------------------------)).", +".@>+,;............................................!;;;;;;#;;;!!............................................................................#>================&%---------------------------------------------))))))))-----------------------------------------------------------------------------------------------------------.", +".@>,#!...................................!!;;;;####,,,++,+,,,,####;;;;!!.........................................................!!!;!;!;!;,>================&*------------------------------------)))%%%*****$*$$*$*%*%%%)))-----------------------------------------------))))%%%%*%*%%%%))))))------------------------------.", +".>,;;!..................................!;;##,,+>>>>>>@>>@>@>>>>+++,##;!!!......................................................!!;;#######,@================&%----------------------------------))%**$$&&&&&&'&&&&&&&&&&$$*%%)-------------------------------------------)%%%$*$$$&&&&&&$$$$**%%))----------------------------.", +".+#!!...................................!;,,++>@@================@@>+,#;!!.....................................................!!;##,,,,,,,+@================&*----------------------------------)%*$$&''================'&$*%%)-----------------------------------------))%*$$&&''=====''&&$&$**%)----------------------------.", +".,#!................................!;;;,,++>>@@==================@@>>+,##;;!!...........................................!!;;;##,,,+>++++>+@@================&%------------------------------))%%*$$&'''=================''&&$**%%))----------------------------------))%%$$$&'''''======'@'@&&&$$$**%%))----------------------.", +".#;!..............................!!;;,++>@@@'===================='@@@@>>+,#;!.........................................!.!;#,,>>>>@>@@@@@@@@=================&*----------------------------)%%*$&&&'''===================='''''&$$*%)---------------------------------%*$$&'''''=========='''=''''&&&$$*%-)--------------------.", +".#!...............................!;;,+@@================================@>+#;.........................................!!;#,+@@==============================&%----------------------------)%$&'===============================''&$*))-------------------------------)%$&''========================='@&$*))--------------------.", +".;!.............................!;;,,>>=@=============================='=@@>+#;;!...................................!!;##,+>>@===============================&*--------------------------)%*$$&'================================''&$$*))---------------------------)%*$&@'===========================''$*%)--------------------.", +".!.............................!;#,+>@@==================================='@>+,#;!!.................................;;#+>>>@'@===============================&%-------------------------)%$$'''===================================''&$*))-------------------------)%$&''===============================&$%)--------------------.", +"...............................;;,>@=========================================>>,#!.................................!;#+>=====================================&*-------------------------%$&''========================================'$%))------------------------)*&==================================&$%%)-------------------.", +"............................!!;#,+@@=========================================@>>,#;;.............................!;;,,>@=====================================&%----------------------))%*&''========================================='&$*%)---------------------)%*$&==================================&*))--------------------.", +"............................!;#+>@@===========================================@@>+,;!...........................!;;,+@@@=====================================&*----------------------)*$&''===========================================''$$%%)-------------------)*$&@================================'@&*)---------------------.", +"............................;#+>@===============================================@@+#!!..........................!##+@========================================&%----------------------)$&'==============================================='&*%)-------------------%$&''================================''$%----------------------.", +"..........................!!#+>@@===============================================@@>,#;!.......................!!;,+>@========================================&*--------------------)%*&'@===============================================''&*%-------------------*$@'================================''$*%----------------------.", +".........................!;;,>@'==================================================@>,#;......................!;;,+@@=========================================&%-------------------)*$&&='================================================''&*))---------------))*&'================================='$*%)----------------------.", +".........................!##+@====================================================@@>,;......................!;#+@===========================================&*-------------------%$&''===================================================='$%)---------------)%$'=================================='$))-----------------------.", +".........................;,+>@=================@@>@>>>>>>>>>>>>@@'@==============='@@+#!!....................;#,>@====================='='''''''''''''=======&%------------------)*$@'===================='''''''''''''===================='$$*)-------------)%%$'=============='=''&&&$&&&&&''''='=$*))-----------------------.", +".......................!!#,@@================@@@+++,,#########,+>>@@===============@@>,;;!.................!!#,>@======================''&&$&$$$&&&&''''=====&*----------------))%$&===================='''&$$$$$&$&&&''===================='&$%-------------)%*$'==============''&$*********$$'''''$*-------------------------.", +"........................!#>@==================@+,#;;!........!;#,+@@'================@>##!..................!,>'======================''&$$*******$$$'''=====&%----------------)%*$&===================''&$$********$$&'======================&%-------------)**&'==============@&$%-------))%*$&@&&$%-------------------------.", +"......................!;#,>=============='=@>++,#;;!!!.......!!;#,,+>@@==============@>+#;................!;;,>====================''&&$$*%%%%%%%%***$$&&''==&*----------------)*$''================'''&$$**%%%%%%%%***$&&''==================&*)------------)*$&'============='&$*%--------))%*$$$$%)-------------------------.", +"......................!#,>>==============@@>+##;!;!!..........!!!;##,+>@=============@@>,;................;#,+@==================='&$**%%%))))))))))%%%*$$''=&%----------------%$''================='&***%%)))))))))))%%**$&''================'$%%-----------%*&''============='&*%)---------))))%%%))-------------------------.", +"......................;#+@@==============@@+#!!!...................;##+@===============@+#................;,+@@==================='$*%)----------------)%*$'=&*----------------*&===================&*%)-----------------%*$&'================'&**)----------%$&@==============&$%))---------------)---------------------------.", +"......................#+>@@=============@>+,;!.....................!;#,>@@============'=>#!!..............;+>@@================''&$*%%-----------------))%*&&$%----------------*&================'@&$*-)-----------------)%*$&''=============='&&*)----------%$&''============='$*%)-------------------------------------------.", +"......................;+'=============@=>+#;;.......................!!#,>@'=============>,;!!...........!!#+@=================='$**%))------------------))%*$*)--------------)%*&================'$*%)--------------------))%$$&'==============''$%----------%$&@=============='&**)-------------------------------------------.", +"......................#>===============@+#!!..........................;#+>@=============>+#;!...........!!,>===================&*)------------------------)%%%--------------)%%$'================&*)))----------------------)%*&'================&%----------%$&''============='@$*)-------------------------------------------.", +"....................!!,>=============@@>+#;!!!!!!!!!!!!!!!!!!!!!!!!!!!;#,>@=============@+,#!..........!!;,>=================''$*)-------------------------)))--------------)%*$'=============''&$%--------------------------)%$&'===============&*----------)$&'===============''$*%%))---------------------------------------.", +"...................!!;,>=============@>+,#;;;!;!;!;!;!;!;!;!;!;!;!;!;;;#,+@=============@>,#;...........;;+>================''$*%---------------------------)---------------)*$&'============='&$*%-------------------------)-)*&''==============&*)---------%$@''============='=''&$**%%)-------------------------------------.", +"...................!;#+>=============@>,##;;#;;;#;;;#;;;#;;;#;;;#;;#;;###,@=============@@+,;..........!;#+@================'$*%)-------------------------------------------)*$@'============='$%%)----------------------------%$&''============='*%)--------%*&'==================''&$*%))------------------------------------.", +"...................;;,+@=============@>>+++,,++,,++,,++,,++,,++,,+,,+,,,+>@============='@>,;..........!##+@================'$%))-------------------------------------------%$&'==============&*))-----------------------------)*$''============='$%%--------%*&''=================='@&$$$**%%%))------------------------------.", +"...................;#,>@==============@@@>@>@>>@>>@>@>>@>>>@>>>@>@>@>@>@@@===============@@+#..........;#,>@================&*))--------------------------------------------%&'='===========''&*)------------------------------)%*$'============='$*%)-------)*$&'=================='''''&&&$$**%))----------------------------.", +"...................;#+>@===================================================================+#..........;#+>@================&*----------------------------------------------*&=============='@$%-------------------------------))%$'============='&*%)-------)**&'========================='@&$$*%-----------------------------.", +"...................;,+>@===================================================================+#..........;,+>@==============='&%----------------------------------------------*&=============''&$%--------------------------------))*&============='&**)-------)%%$'=========================='@'&$$**))-------------------------.", +"...................;,>@@===================================================================>#..........;,>@'==============''$%----------------------------------------------*&============='&$*)---------------------------------)*&============='&*%)--------)%$&============================''''&&$%)------------------------.", +"...................;+>@====================================================================>#..........;+>@=============='''$%----------------------------------------------%&============='&$%)----------------------------------*&============='&**)----------*&==================================&*%)-----------------------.", +"...................;+>@@===================================================================>#..........;,@@@==============@&*%----------------------------------------------*&============='&*%)----------------------------------*&=============@&$*)----------%$''================================@&**)----------------------.", +"...................;+>@====================================================================>#..........#,>@==============''@$%---------------------------------------------)*&============='$**)----------------------------------*&=============''$*%----------%*$&'==============================='''$*)---------------------.", +"...................;,@@@===================================================================>#..........#,@@'=============''&$)---------------------------------------------)*&============='$*%)----------------------------------*&==============@&$)----------))%$'==================================&$))--------------------.", +"...................#,>@================@=@='=@=@=@=@='=@='=@=@=@='=@='=@='=@='=@='=@=@=@=@'+#..........;,@@==============='&$%--------------------------------------------)-*'============='$*%)----------------------------------*&=============''&$%-----------)%*$&'''=============================='$$%)-------------------.", +"...................;+>@@==============@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+#..........#,>@@============='@&$)----------------------------------------------*&============='$*%-----------------------------------*&==============&&*)-------------%%*$$&''============================''&$%-------------------.", +"...................;+>@==============@@@>>@>>@>@>>@>>@>@>>@>>@>@>@>@>@>@>@>@>@>@>@>>@>>@>@>,;..........;+>@==============='&$%----------------------------------------------*&============='$*%)----------------------------------%&============='&&*%--------------))%*$&'===============================$*-------------------.", +"...................;,>@@=============@>+++,+,,,,+,+,+,,,+,+,+,,,,,+,,,+,,,+,,,+,,,+,,+,+,,+#;..........#,>@@============='@&$)----------------------------------------------*&============='&$*)----------------------------------*&=============@&$*)----------------)%*$$&&&'''''=======================&*-------------------.", +"...................;,+>@=============@+###;;#;#;#;;#;#;#;;;#;#;##;;#;#;#;#;#;#;#;#;#;;#;#;;;!..........;,>@===============''$%----------------------------------------------*&============='@$*%---------------------------------)*&============='&$%)---------------)-))%%**$$&&'''======================&*)------------------.", +"...................;#+>@=============>,;!!.............................................................;,>@@==============@'$%----------------------------------------------*&============='@&$)---------------------------------)*&============='&**)----------------------))%*$$''======================&$))-----------------.", +"...................;#+>@=============@+#;!................................................!............;,+>@==============''&%----------------------------------------------%&'=============''$%-------------------------------))%$'============='$*%)-----------------------))%**$$&&'''================='$%))----------------.", +"...................;#,>@=============@>,#;...............................................!!!...........;#+>@================&*)---------------------------------------------%$''==============&*-------------------------------)%*$'============='$*%-------------------------))))%%**$&''================&$%%-----------------.", +"...................!#,>@=============@>+,;...............................................!!!!..........;#,>@================&$))--------------------------------------------%$&''=============&*-------------------------------)*$&'============='$%%)-------------------------------)%*&'================'$*%)----------------.", +"...................!;#+@==============@>,#!...........................!.!!!!!!!!!!!!!!!!!;;!!..........!;#+@================'$*%)-------------------------------------------%*&''============='$%%----------------------------)%$&''=============&$))--------------------------------)%%$&''=============='&*%)----------------.", +"...................!;;,>==============@=+,;!!.......................!.!!;!;!;!;!;!;!;!;;;;;!!..........!;;,>================''$*%-------------------------------------------)*$&'============='&$*)---------------------------)*$'===============&*)----------------------------------))*$&''============='$*%)----------------.", +"....................!;,>================>,;;!.......................!!;;;#;;;#;;;#;;#;;;;;;;!...........!;,>=================@'$%---------------------------)---------------)%$&'============='@&$)--------------------------))$'================&*-------------------------------------)*$&'============='&$%)----------------.", +"....................!!#>@===============@>,#;!.....................;;##,,+,+,,++,,+,,+++,#;!!...........!!#>=================''&*%)-----------------------)%*%)-------------)%%$'==============''$*%)-----------------------%**$'==============''&%--------------))))%))----------------)*$&'============='&*%)----------------.", +".....................!#+@@=============='@>+#;!!..................!;,+>>>>@>@>>@>@>@>>>>+#;!!.............#+@@================='$$*)---------------------)%*$*)--------------))$&================'$*%)--------------------))%$&'==============='&$%--------------%%**$*)----------------)*$&'============='&$%)----------------.", +"......................;+>@@================>,;;!.................!!#+@@=================>,;!..............;,>@@=================@&*%---------------------)*$'$%---------------)*&================'&&*)--------------------))$&================''$*)-------------)%$$&&$%)---------------%*$&'============='$**)----------------.", +"......................;#+@@=============='=@>+##;;!!!!!.....!!;;;##+>'@================@+#!!..............;,+@@================='@&$%%)))-----------)))%**$''$%----------------%&''===============''$$%%))------------)))%*$$@================'&**)-------------%*&&&@&$*%%)))--------))%$&''============='$*%-----------------.", +"......................;##+@================@@>>+,##;;!!!..!!;;##,+>>@================@@>,#................!##+@=================='''&$*%%))-------))%%*$$&''=&*----------------%$&''=============='''&&$*%%))------)))%%*$$&'================='$%)--------------*$'''=''&$*%%))-------)%$&'==============='$%%-----------------.", +"......................!;;+>===================@@>+,##;;!!.!;;#,+>@===================@>+#;................!;;+>======================'$$*%))------)%**$&'====&%----------------)*$&'===================@$*%%))-----))%**$&'===================&*)-------------)-*&=======@$$*%))-----)%*$'================'*))-----------------.", +"......................!!;#>@===================@@>++,,,,###,,++>@@===================>+,;;................!!;#>@@====================''$$$$***%****$$&&@=====&*----------------)%*&'==================='&&$$$*******$*$&&@'=================''$%--------------)%$'=======''$$$$*******$$''================&*))-----------------.", +".......................!!#+>@@================'=@@@@@@>>>>>>@@@@@@================='=>,;;!.................!!;,+@@===================='''&'&&&&&&'&&''''=====&%-----------------))$&===================='''&'&&&&&&&&'''''=================''&*%-------------)%*$'========'''''&&&&&&&'''=================&*-------------------.", +".........................;#+@@=====================================================@@>#!!....................;#,>@===========================================&*-----------------)-*&======================================================='&**)-------------)*$&'========================================&*-------------------.", +".........................!#,+>====================================================@>>,;!.....................!;#,>@'=========================================&%-------------------%*&''==================================================='&$*))-------------%$&''=====================================''@$%-------------------.", +".........................!!;,>@@==================================================@+,#;.......................!!#+@@@========================================&*-------------------)%*&'==================================================''&*))--------------%$'=======================================''$*%-------------------.", +"............................;+@@================================================@=>,;!!.........................;,+@@========================================&%--------------------))*&==================================================@&*%---------------)*&========================================'&$%)-------------------.", +"............................;#+>@@=============================================@@>,#!!..........................!##+>@=======================================&*---------------------)%$''==============================================''&$*)--------------))$&======================================''&$%))-------------------.", +"............................;;#+>@@============================================@>,#;.!..........................!;;#+>@@=====================================&%----------------------)**&'============================================''$*%)--------------))%$'======================================'&$*))--------------------.", +".............................!!#+@@===========================================@>,;;!...............................;#+>@=====================================&*----------------------))%$&===========================================''@$%----------------)%*$'====================================='&$%)----------------------.", +".!............................!;,+>>@@=====================================@@>>+#;!................................!;#,>>@@'=================================&%-----------------------))**&'''=====================================''&$**)----------------))%*$&'''===============================''&$*%)----------------------.", +".!!............................!;;,+>@@===================================@@>+,#;!!................................!;;##++>@@================================&*------------------------))**$&''===================================''&$*%))-----------------))%*$$&''=============================''&**))-----------------------.", +".;!...............................;#+>@===================================@>+#!!......................................!;;,+@@'===============================&%---------------------------)%$@''=================================='&**)-----------------------)%*$@''============================'$$%)-------------------------.", +".#;...............................!;,,+>@@@===========================@@>>++#;!!......................................!!;##,+>>@@@@@=@=@='===================&*---------------------------)%**&&'''==========================''''&$**))------------------------)%*$$&&'''''='============='''''&&$**))-------------------------.", +".,;...............................!!;##,++>@@=======================@@@>+,#;;!!.........................................!!;###,,+>>>@@@@@@@@=================&%----------------------------))%**$&&''=======================''&$$**%))--------------------------))%%***$&&''''''========='''&$$**%%))--------------------------.", +".+#...................................!!#,+@@=======================@@+,#;!.................................................!!;##,++>>>>>>@@@================&*-------------------------------))%*$&@'======================'&$*%------------------------------------))**$&&@'''=======''@'$$*%)-------------------------------.", +".>#;!.................................!!;#,,+>>>>@@@@@@@@@@@@@@@@>>>++,#;;!..................................................!!;;###,,,++,,>@================&%--------------------------------)%**$$&&'&'''''''''''''''&&&&$$*%)-------------------------------------)%%***$$$$&&&&&&&&&$$**%))-------------------------------.", +".>+#;!.................................!!!;;##,,++>>>>>>>>>>>>+++,,###;!!!...................................................!.!!;;;;;#;;#;+>================&*---------------------------------)))%%***$$$$&&&&&&&&&$$$$***%))))--------------------------------------))%%%%%%*%******%%%%%)))--------------------------------.", +".@+,#;........................................!;##,++++++++++,,##;;!.......................................................................#>================&%----------------------------------------)%%***********$**%))----------------------------------------------------------------------------------------------------.", +".@@+,;!!......................................!;;##############;;!!!.......................................................................#>================&*----------------------------------------)))%%**%**%**%%%)))----------------------------------------------------------------------------------------------------).", +".=@@+,;!!......................................!!!;;;;;;;;;;;;!;!!!........................................................................#>================&%------------------------------------------))))))))))))))))----------------------------------------------------------------------------------------------------)).", +".===@+#;!..................................................................................................................................#>================&*-------------------------------------------------------------------------------------------------------------------------------------------------------------)%%.", +".===@>,,;!.................................................................................................................................#>================&%-------------------------------------------------------------------------------------------------------------------------------------------------------------%*$.", +".==='@>+#;!!...............................................................................................................................#>================&*-----------------------------------------------------------------------------------------------------------------------------------------------------------)%*$'.", +".======>,;;!...............................................................................................................................#>================&%----------------------------------------------------------------------------------------------------------------------------------------------------------)%%$'=.", +".======@>,#;;!.............................................................................................................................#>================&*---------------------------------------------------------------------------------------------------------------------------------------------------------)%*$&'=.", +".======@@@+,#;!............................................................................................................................#>================&%-------------------------------------------------------------------------------------------------------------------------------------------------------))%*$''==.", +".=========@>,#!............................................................................................................................#>================&*-------------------------------------------------------------------------------------------------------------------------------------------------------)%*&'====.", +".=========@>++##;!!........................................................................................................................#>================&%----------------------------------------------------------------------------------------------------------------------------------------------------))%*$$&'====.", +".==========@@>>+,#;!!......................................................................................................................#>================&*--------------------------------------------------------------------------------------------------------------------------------------------------))%$$$&''=====.", +".=============@@+,;;!......................................................................................................................#>================&%-------------------------------------------------------------------------------------------------------------------------------------------------))%*&''========.", +".=============@@>>,,##;;;!!!!.!............................................................................................................#>================&*--------------------------------------------------------------------------------------------------------------------------------------------)))%%**$$''=========.", +".===============@@>>+++,##;!;!!!...........................................................................................................#>================&%-----------------------------------------------------------------------------------------------------------------------------------------)))%%**$$&''''=========.", +".====================@@++,#;;;!!!..........................................................................................................#>================&*---------------------------------------------------------------------------------------------------------------------------------------))))%*$$&@'==============.", +".===================@=@@>>++,,,,###########################################################################################################+@================'$*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%******$$$&&'='==============.", +".=====================@@@@@>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>@================''&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'''''================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================.", +".==============================================================================================================================================================================================================================================================================================================================."}; diff --git a/packages/hal/arm/sa11x0/cerfpda/current/misc/escw.xpm b/packages/hal/arm/sa11x0/cerfpda/current/misc/escw.xpm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/misc/escw.xpm @@ -0,0 +1,264 @@ +/* XPM */ +static char * escw_xpm[] = { +"320 240 21 1", +" c None", +". c #28CAE0", +"+ c #6F8695", +"@ c #3FB3C7", +"# c #579DAE", +"$ c #FF0000", +"% c #E61619", +"& c #9E5A64", +"* c #CE2D32", +"= c #B7434A", +"- c #87707C", +"; c #FFFFFF", +"> c #C7C7C7", +", c #AAAAAA", +"' c #727272", +") c #555555", +"! c #1D1D1D", +"~ c #000000", +"{ c #393939", +"] c #8E8E8E", +"^ c #E3E3E3", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"....................+++++++++++++++++++++++++@......................................................................#+++++++#........................#++++++++@................@++++++++#.......................................................................................................................................", +"....................$$$$$$$$$$$$$$$$$$$$$$$$$$%&@...................................................................$$$$$$$$&........................*$$$$$$$$#................&$$$$$$$$&.......................................................................................................................................", +"...................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.................................................................@$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+.......................................................................................................................................", +"...................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+................................................................+$$$$$$$$........................#$$$$$$$$*.................$$$$$$$$$@.......................................................................................................................................", +"...................=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...............................................................&$$$$$$$%........................-$$$$$$$$=................@$$$$$$$$$..........................................$$$$$$$$&.....................................................................................", +"...................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%...............................................................=$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.........................................+$$$$$$$$+.....................................................................................", +"..................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-..............................................................$$$$$$$$-........................%$$$$$$$$@................=$$$$$$$$&.........................................+$$$$$$$$@.....................................................................................", +"..................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.............................................................#$$$$$$$$#........................$$$$$$$$$.................*$$$$$$$$+.........................................=$$$$$$$$......................................................................................", +"..................=$$$$$$$$+............+&$$$$$$$$$$$.............................................................+$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$..........................................*$$$$$$$=......................................................................................", +"..................*$$$$$$$$#..............@%$$$$$$$$$.............................................................=$$$$$$$*........................&$$$$$$$$&................#$$$$$$$$%..........................................$$$$$$$$-......................................................................................", +"..................$$$$$$$$$................#$$$$$$$$$.............................................................*$$$$$$$=........................=$$$$$$$$+................-$$$$$$$$=.........................................#$$$$$$$$+......................................................................................", +".................#$$$$$$$$=.................*$$$$$$$%...............#++==-+#.........................@++==++......$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-..............@++-===-++.................+$$$$$$$$.......................................................................................", +".................-$$$$$$$$&.................=$$$$$$$=............+=$$$$$$$$$$=#....................-*$$$$$$$$&@..+$$$$$$$$@.......................@$$$$$$$$%.................%$$$$$$$$#...........+=$$$$$$$$$$$$*-..........#+++*$$$$$$$$++++@..................................................................................", +".................=$$$$$$$$+.................*$$$$$$$-.........@&$$$$$$$$$$$$$$$=@................-%$$$$$$$$$$$%@.-$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$..........-%$$$$$$$$$$$$$$$$%+........$$$$$$$$$$$$$$$$$+..................................................................................", +".................%$$$$$$$$@................@$$$$$$$$@........+%$$$$$$$$$$$$$$$$$%@.............@*$$$$$$$$$$$$$$%@=$$$$$$$=........................=$$$$$$$$-................+$$$$$$$$*........@*$$$$$$$$$$$$$$$$$$$$+......#$$$$$$$$$$$$$$$$$@..................................................................................", +".................$$$$$$$$$.................&$$$$$$$=........=$$$$$$$$$$$$$$$$$$$$%@...........#%$$$$$$$$$$$$$$$$&%$$$$$$$&........................*$$$$$$$$#................&$$$$$$$$=.......@%$$$$$$$$$$$$$$$$$$$$$$@.....+$$$$$$$$$$$$$$$$$...................................................................................", +"................+$$$$$$$$=................#$$$$$$$$#.......=$$$$$$$$$$$$$$$$$$$$$$*..........+$$$$$$$$$$$$$$$$$$$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+.......%$$$$$$$$$$$$$$$$$$$$$$$&.....=$$$$$$$$$$$$$$$$=...................................................................................", +"................-$$$$$$$$&...............@%$$$$$$$&.......-$$$$$$$$$$$$$$$$$$$$$$$$+........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$@.......................#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@......&$$$$$$$$$$$$$$$$$$$$$$$$%.....*$$$$$$$$$$$$$$$$-...................................................................................", +"................=$$$$$$$$+..............-%$$$$$$$*.......#$$$$$$$$$%&+@@+=$$$$$$$$$*........%$$$$$$$$$%-#.+&$$$$$$$$$$$$%........................-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$......@$$$$$$$$$*++..#+*$$$$$$$$$.....++++$$$$$$$$*++++@...................................................................................", +"................$$$$$$$$$-++++++++++++=%$$$$$$$$%@.......%$$$$$$$$&.......+$$$$$$$$$#......&$$$$$$$$$&......@%$$$$$$$$$$=........................=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=......&$$$$$$$$+........%$$$$$$$$........#$$$$$$$$+........................................................................................", +"...............@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=@.......&$$$$$$$$+.........&$$$$$$$$-.....@$$$$$$$$$+........+$$$$$$$$$$-........................%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&......%$$$$$$$+.........=$$$$$$$*........+$$$$$$$$@........................................................................................", +"...............+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-........@$$$$$$$$=..........@$$$$$$$$=.....*$$$$$$$$-..........*$$$$$$$$$+........................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.....#$$$$$$$*..........*$$$$$$$=........=$$$$$$$$.........................................................................................", +"...............&$$$$$$$$$$$$$$$$$$$$$$$$$$$$&@.........&$$$$$$$%............%$$$$$$$=....#$$$$$$$$*...........&$$$$$$$$$........................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$......#=======+.........@$$$$$$$$+........%$$$$$$$=.........................................................................................", +"...............*$$$$$$$$$$$$$$$$$$$$$$$$$$$&@..........%$$$$$$$&............=$$$$$$$=....&$$$$$$$$@...........+$$$$$$$$*........................-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%.......................@%$$$$$$$$#........$$$$$$$$&.........................................................................................", +"...............$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........+$$$$$$$$@............=$$$$$$$=....$$$$$$$$=............+$$$$$$$$=........................=$$$$$$$$&++++++++++++++++&$$$$$$$$=....................++=$$$$$$$$$$........+$$$$$$$$+.........................................................................................", +"..............#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.......=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=...+$$$$$$$$#............+$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-.............@+-=*$$$$$$$$$$$$$$*........-$$$$$$$$@.........................................................................................", +"..............+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+......$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=...=$$$$$$$%.............+$$$$$$$$#.......................@$$$$$$$$*.................%$$$$$$$$#..........#=%$$$$$$$$$$$$$$$$$$$=........=$$$$$$$%..........................................................................................", +"..............=$$$$$$$$+............+*$$$$$$$$$=.....+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...$$$$$$$$&.............+$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.........+%$$$$$$$$$$$$$$$$$$$$$$+........%$$$$$$$=..........................................................................................", +"..............%$$$$$$$$@..............=$$$$$$$$=.....-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#..#$$$$$$$$+.............=$$$$$$$=........................&$$$$$$$$+................+$$$$$$$$*.......@=$$$$$$$$$$$$$$$$$$$$$$$$@........$$$$$$$$-..........................................................................................", +"..............$$$$$$$$$...............@$$$$$$$$=.....=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...+$$$$$$$$#.............*$$$$$$$&........................*$$$$$$$$#................-$$$$$$$$=......@%$$$$$$$$$$$$$$*&&$$$$$$$$........+$$$$$$$$+..........................................................................................", +".............+$$$$$$$$=................$$$$$$$$&.....*$$$$$$$$=====================&...-$$$$$$$$.............@$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+......%$$$$$$$$$%=-+@...&$$$$$$$=........-$$$$$$$$...........................................................................................", +".............-$$$$$$$$&...............#$$$$$$$$+.....$$$$$$$$%.........................=$$$$$$$$.............-$$$$$$$$@.......................#$$$$$$$$*.................%$$$$$$$$@.....=$$$$$$$$*#........*$$$$$$$&........=$$$$$$$*...........................................................................................", +".............=$$$$$$$$+...............-$$$$$$$$+.....$$$$$$$$=.........................=$$$$$$$$.............*$$$$$$$%........................+$$$$$$$$&................@$$$$$$$$$.....#$$$$$$$$=.........@$$$$$$$$+........%$$$$$$$=...........................................................................................", +".............$$$$$$$$$................=$$$$$$$$......$$$$$$$$=.........................=$$$$$$$$............#$$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.....*$$$$$$$*..........-$$$$$$$$@........$$$$$$$$+...........................................................................................", +"............@$$$$$$$$%................$$$$$$$$$......$$$$$$$$=.........................=$$$$$$$$+...........%$$$$$$$$-........................%$$$$$$$$@................&$$$$$$$$&....@$$$$$$$$#..........%$$$$$$$%........+$$$$$$$$#...........................................................................................", +"............+$$$$$$$$=...............#$$$$$$$$=......%$$$$$$$$...........@========@....&$$$$$$$$&..........=$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+....+$$$$$$$$..........-$$$$$$$$=........&$$$$$$$$............................................................................................", +"............&$$$$$$$$-...............&$$$$$$$$&......=$$$$$$$$-..........=$$$$$$$*.....+$$$$$$$$%@........+$$$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.....=$$$$$$$$.........@$$$$$$$$$-........=$$$$$$$=............................................................................................", +"............*$$$$$$$$+...............=$$$$$$$$+......+$$$$$$$$$+.......@=$$$$$$$$@.....#$$$$$$$$$=.......=$$$$$$$$$$*........................-$$$$$$$$&................@$$$$$$$$%.....=$$$$$$$$-.......#%$$$$$$$$$+........$$$$$$$$-............................................................................................", +"............$$$$$$$$$................$$$$$$$$$#.......$$$$$$$$$$&#...#&$$$$$$$$$-.......%$$$$$$$$$*#..@-%$$$$$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.....=$$$$$$$$$-@...+&$$$$$$$$$$$........@$$$$$$$$=............................................................................................", +"...........#$$$$$$$$*...............@$$$$$$$$$........&$$$$$$$$$$$$$$$$$$$$$$$$=........&$$$$$$$$$$$$$$$$$$$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-.....-$$$$$$$$$$$$$$$$$$$$$$$$$$%........+$$$$$$$$$%==-........................................................................................", +"...........+$$$$$$$$=...............+$$$$$$$$$.........%$$$$$$$$$$$$$$$$$$$$$$=.........@$$$$$$$$$$$$$$$$$$$$$$$$$$$#.......................@$$$$$$$$%.................*$$$$$$$$+.....#$$$$$$$$$$$$$$$$$$$$$$$$$$=........+$$$$$$$$$$$$&........................................................................................", +"...........=$$$$$$$$+...............+$$$$$$$$$@........@$$$$$$$$$$$$$$$$$$$$$=...........-$$$$$$$$$$$$$$$$$=$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.......*$$$$$$$$$$$$$$$$*%$$$$$$$*........+$$$$$$$$$$$$+........................................................................................", +"...........%$$$$$$$$#...............+$$$$$$$$$=.........#%$$$$$$$$$$$$$$$$$$+.............=$$$$$$$$$$$$$$$+=$$$$$$$=........................&$$$$$$$$-................#$$$$$$$$*.......@$$$$$$$$$$$$$$$=.$$$$$$$$$+........$$$$$$$$$$$$@........................................................................................", +"...........$$$$$$$$$................@$$$$$$$$$*..........@*$$$$$$$$$$$$$$$&@...............=$$$$$$$$$$$$%@.%$$$$$$$&........................*$$$$$$$$+................-$$$$$$$$=........+$$$$$$$$$$$$%+..%$$$$$$$$*........&$$$$$$$$$$$.........................................................................................", +"..........@+++++++++.................+++++++++#............#*$$$$$$$$$$%&@..................+%$$$$$$$$%-...++++++++@........................+++++++++.................#++++++++@.........@*$$$$$$$$%&@...#++++++++#.........&$$$$$$$$$=.........................................................................................", +".............................................................@+&====&+@.......................#-====-#.....................................................................................@+====&+..........................@+=====&+@.........................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>,')))!~~~)))',>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>'{~~~~~~~~~~~~~~~~~~)]^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^'!~~~~~~~~~~~~~~~~~~~~~~~~{,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~)){~~~~~~~~~~~~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~~{',;;;;;;;;>]!~~~~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~'^;;;;;;;;;;;;;;>{~~~~~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~~~~~'^;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^!~~~~~~~~~~~~~~~~!>;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~{^;;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;!~~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,,,)))),,,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^!~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,,,')))),,,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>,,]))))',,>;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;^,)!~~~~~~~~~~~~!'>;;;;;;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;^])!~~~~~~~~~~~~~!',;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^])!~~~~~~~~~~~~~~!),;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;]{~~~~~~~~~~~~~~~~~~~!];;;;;;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~~!^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;^'!~~~~~~~~~~~~~~~~~~~~!'^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^]{~~~~~~~~~~~~~~~~~~~~~~'>;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;^'~~~~~~~~~~~~~~~~~~~~~~~~!];;;;;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;>{~~~~~~~~~~~~~~~~~~~~~~~~~~';;;;;;;;;;;;;;;;;;;;;;;;;;;;;^'~~~~~~~~~~~~~~~~~~~~~~~~~~~)^;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~~~~~~~~~~~~~~~)^;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~~';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;^{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!>;;;;;;;;;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;>!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!^;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;^{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!^;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~);;;;;;;;;;;;;;^{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;^!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;^!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~';;;;;;;;;;;;;;^~~~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;^!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>;;;;;;;;;;;;;]~~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{;;;;;;;;;;;;;!~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~];;;;;;;;;;;;;;;'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~);;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;>~~~~~~~~~~~~~~~~~~~!))!~~~~~~~~~~~~~~~~~~~>;;;;;;;;;;;>~~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~~~~~~~!))!~~~~~~~~~~~~~~~~~~~~!;;;;;;;;;;;;;;>~~~~~~~~~~~~~~~~~~~))){~~~~~~~~~~~~~~~~~~~~;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;^!~~~~~~~~~~~~~~~!'>;;;;;;,{~~~~~~~~~~~~~~~~);;;;;;;;;;;'~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^!~~~~~~~~~~~~~~~~~),;;;;;;,)~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;{~~~~~~~~~~~~~~~',;;;;;;;;,)~~~~~~~~~~~~~~~~^;;;;;;;;;..............", +".................................................;;;;;;;;;;;;'~~~~~~~~~~~~~~~];;;;;;;;;;;>!~~~~~~~~~~~~~~~;;;;;;;;;;;!~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~)^;;;;;;;;;;>!~~~~~~~~~~~~~~~~);;;;;;;;;;;;>~~~~~~~~~~~~~~)^;;;;;;;;;;;;^!~~~~~~~~~~~~~~,;;;;;;;;;..............", +".................................................;;;;;;;;;;;>~~~~~~~~~~~~~~!^;;;;;;;;;;;;;^!~~~~~~~~~~~~~~,;;;;;;;;;>~~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;^!~~~~~~~~~~~~~~~~;;;;;;;;;;;;{~~~~~~~~~~~~~{;;;;;;;;;;;;;;;^!~~~~~~~~~~~~~,;;;;;;;;;..............", +".................................................;;;;;;;;;;;{~~~~~~~~~~~~~!^;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~);;;;;;;;;]~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;!~~~~~~~~~~~~~~!>;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~~~>;;;;;;;;;;^~~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~,;;;;;;;;;..............", +".................................................;;;;;;;;;;]~~~~~~~~~~~~~!^;;;;;;;;;;;;;;;;;!~~~~~~~~~~~~~!;;;;;;;;;)~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~,;;;;;;;;;;,~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~,;;;;;;;;;..............", +".................................................;;;;;;;;;;!~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~;;;;;;;;;~~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~~';;;;;;;;;;)~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~;;;;;;;;;;..............", +".................................................;;;;;;;;;]~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~;;;;;;;;>~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~';;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~);;;;;;;;;;{~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;])))))))))))));;;;;;;;;;..............", +".................................................;;;;;;;;;{~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~,;;;;;;;,~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~);;;;;;;;;;~~~~~~~~~~~~~~~~'^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;>~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~,;;;;;;;)~~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~);;;;;;;;;;~~~~~~~~~~~~~~~~~~'>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;)~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~>;;;;;;;{~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;!~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~);;;;;;;;;;~~~~~~~~~~~~~~~~~~~~!),;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~;;;;;;;;~~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~);;;;;;;;;;!~~~~~~~~~~~~~~~~~~~~~~~{]^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;,~~~~~~~~~~~~~~))))))))))))))))))))))~~~~~~~~~~~~~~;;;;;;;;~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~);;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~!',;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;;;;;;;,~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;!~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~,;;;;;;;;;;>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~),;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!;;;;;;;,~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~,;;;;;;;;;;;{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'>;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~);;;;;;;,~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~>;;;;;;;;;;;>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{^;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~';;;;;;;'~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~';;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;)~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~!;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;..............", +".................................................;;;;;;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^;;;;;;;)~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~);;;;;;;;;;;;;;;^!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;..............", +".................................................;;;;;;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;;;;;;;;)~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>))))))))))))));;;;;;,~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;!~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;]!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~';;;;;;;;;;;;;;..............", +".................................................;;;;;,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~);;;;;;;;)~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~);;;;;;'~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;;;]!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^;;;;;;;;;;;;;..............", +".................................................;;;;;,~~~~~~~~~~~~~~)))))))))))))))))))))))))))))))))))),;;;;;;;;)~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~,;;;;;;)~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;;,)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~';;;;;;;;;;;;;..............", +".................................................;;;;;]~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~^;;;;;;)~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~';;;;;;;;;;;;;;;;;;;;;;;;;,)~~~~~~~~~~~~~~~~~~~~~~~~~~~~;;;;;;;;;;;;;..............", +".................................................;;;;;)~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~);;;;;;;~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;;;;;;;;;;;;;,)~~~~~~~~~~~~~~~~~~~~~~~~~^;;;;;;;;;;;;..............", +".................................................;;;;;)~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~,;;;;;;;~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>'!~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;..............", +".................................................;;;;;)~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~!;;;;;;;;~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>'!~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;..............", +".................................................;;;;;)~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>~~~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;;;;;;;;^!~~~~~~~~~~~~~~];;;;;;;;~~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,{~~~~~~~~~~~~~~~~,;;;;;;;;;;;;..............", +".................................................;;;;;)~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;~~~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~!;;;;;;;;;~~~~~~~~~~~~~~~;;;;;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~,;;;;;;;;;;;;..............", +".................................................;;;;;)~~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~~~!^;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~];;;;;;;;;~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~~>;;;;;;;^,,,,,,,,,,,,,>;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~^;;;;;;;;;;;;..............", +".................................................;;;;;,~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~^;;;;;;;;;;;]~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;;;^{~~~~~~~~~~~~~~~!;;;;;;;;;;!~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~{;;;;;;;;,~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~;;;;;;;;;;;;;..............", +".................................................;;;;;,~~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~';;;;;;;;;;;;>~~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;;;;;>!~~~~~~~~~~~~~~~~,;;;;;;;;;;)~~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~>;;;;;;;;)~~~~~~~~~~~~~!;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~{;;;;;;;;;;;;;..............", +".................................................;;;;;;~~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;,~~~~~~~~~~~~~!^;;;;;;;;;;;;;{~~~~~~~~~~~~~~~~~{^;;;;;;;;;;;;;;;;;^)~~~~~~~~~~~~~~~~~);;;;;;;;;;;'~~~~~~~~~~~~~~~{;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~';;;;;;;;;)~~~~~~~~~~~~~~>;;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~];;;;;;;;;;;;;..............", +".................................................;;;;;;{~~~~~~~~~~~~~~~>;;;;;;;;;;;;;;,~~~~~~~~~~~~~~];;;;;;;;;;;;;;]~~~~~~~~~~~~~~~~~~~'^;;;;;;;;;;;;;>)~~~~~~~~~~~~~~~~~~!^;;;;;;;;;;;,~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;)~~~~~~~~~~~~~~~!^;;;;;;;;;)~~~~~~~~~~~~~~!^;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~^;;;;;;;;;;;;;..............", +".................................................;;;;;;]~~~~~~~~~~~~~~~~,;;;;;;;;;;;^{~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;!~~~~~~~~~~~~~~~~~~~~{],^;;;;^,])~~~~~~~~~~~~~~~~~~~~~>;;;;;;;;;;;;;~~~~~~~~~~~~~~~~~)^;;;;;;;;;;>!~~~~~~~~~~~~~~~~,;;;;;;;;;;]~~~~~~~~~~~~~~~!>;;;;;;;;;;;;;;^)~~~~~~~~~~~~~~{;;;;;;;;;;;;;;..............", +".................................................;;;;;;^~~~~~~~~~~~~~~~~~{,;;;;;;;,{~~~~~~~~~~~~~~~!^;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~!]^;;;;;;,{~~~~~~~~~~~~~~~~~';;;;;;;;;;;,~~~~~~~~~~~~~~~~~{]^;;;;;;;;^,)~~~~~~~~~~~~~~~~>;;;;;;;;;;;;;;..............", +".................................................;;;;;;;'~~~~~~~~~~~~~~~~~~~{)))!~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~];;;;;;;;;;;;;;;>~~~~~~~~~~~~~~~~~~~~!)))!~~~~~~~~~~~~~~~~~~~{;;;;;;;;;;;;;~~~~~~~~~~~~~~~~~~~~~{)))){~~~~~~~~~~~~~~~~~~~{;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~);;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!^;;;;;;;;;;;;;'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~];;;;;;;;;;;;;;;;;;^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!^;;;;;;;;;;;;;;^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!^;;;;;;;;;;;;;;;;'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;^!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!^;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~)^;;;;;;;;;;;;;;;;;;{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;^!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!>;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~';;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~';;;;;;;;;;;;;;;;;;;;^!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;^!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~)^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{>;;;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!>;;;;;;;;;;;;;;;;;;;;;;^!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{^;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;^{~~~~~~~~~~~~~~~~~~~~~~~~~~~!,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~';;;;;;;;;;;;;;;;;;;;;;;;;;)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!];;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;]!~~~~~~~~~~~~~~~~~~~~~~~!];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^{~~~~~~~~~~~~~~~~~~~~~~~~~~'^;;;;;;;;;;;;;;;;;;;;;;;;;;;;>{~~~~~~~~~~~~~~~~~~~~~~~~~~~~!]^;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;^'!~~~~~~~~~~~~~~~~~~~{,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^'!~~~~~~~~~~~~~~~~~~~~~~~{'^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>)~~~~~~~~~~~~~~~~~~~~~{];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>{~~~~~~~~~~~~~~~~~~~~~~~~),;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;,)~~~~~~~~~~~~~!),^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;>])~~~~~~~~~~~~~~~~{),^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^,)~~~~~~~~~~~~~~~)]^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^])~~~~~~~~~~~~~~~~~{',;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;^,,)))))',,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^,,]))))))',,>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;^,,')))))],,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,,])))))))],,^;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +".................................................;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"....................+++++++++++++++++++++++++@......................................................................#+++++++#........................#++++++++@................@++++++++#.......................................................................................................................................", +"....................$$$$$$$$$$$$$$$$$$$$$$$$$$%&@...................................................................$$$$$$$$&........................*$$$$$$$$#................&$$$$$$$$&.......................................................................................................................................", +"...................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.................................................................@$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+.......................................................................................................................................", +"...................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+................................................................+$$$$$$$$........................#$$$$$$$$*.................$$$$$$$$$@.......................................................................................................................................", +"...................=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...............................................................&$$$$$$$%........................-$$$$$$$$=................@$$$$$$$$$..........................................$$$$$$$$&.....................................................................................", +"...................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%...............................................................=$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.........................................+$$$$$$$$+.....................................................................................", +"..................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-..............................................................$$$$$$$$-........................%$$$$$$$$@................=$$$$$$$$&.........................................+$$$$$$$$@.....................................................................................", +"..................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.............................................................#$$$$$$$$#........................$$$$$$$$$.................*$$$$$$$$+.........................................=$$$$$$$$......................................................................................", +"..................=$$$$$$$$+............+&$$$$$$$$$$$.............................................................+$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$..........................................*$$$$$$$=......................................................................................", +"..................*$$$$$$$$#..............@%$$$$$$$$$.............................................................=$$$$$$$*........................&$$$$$$$$&................#$$$$$$$$%..........................................$$$$$$$$-......................................................................................", +"..................$$$$$$$$$................#$$$$$$$$$.............................................................*$$$$$$$=........................=$$$$$$$$+................-$$$$$$$$=.........................................#$$$$$$$$+......................................................................................", +".................#$$$$$$$$=.................*$$$$$$$%...............#++==-+#.........................@++==++......$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-..............@++-===-++.................+$$$$$$$$.......................................................................................", +".................-$$$$$$$$&.................=$$$$$$$=............+=$$$$$$$$$$=#....................-*$$$$$$$$&@..+$$$$$$$$@.......................@$$$$$$$$%.................%$$$$$$$$#...........+=$$$$$$$$$$$$*-..........#+++*$$$$$$$$++++@..................................................................................", +".................=$$$$$$$$+.................*$$$$$$$-.........@&$$$$$$$$$$$$$$$=@................-%$$$$$$$$$$$%@.-$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$..........-%$$$$$$$$$$$$$$$$%+........$$$$$$$$$$$$$$$$$+..................................................................................", +".................%$$$$$$$$@................@$$$$$$$$@........+%$$$$$$$$$$$$$$$$$%@.............@*$$$$$$$$$$$$$$%@=$$$$$$$=........................=$$$$$$$$-................+$$$$$$$$*........@*$$$$$$$$$$$$$$$$$$$$+......#$$$$$$$$$$$$$$$$$@..................................................................................", +".................$$$$$$$$$.................&$$$$$$$=........=$$$$$$$$$$$$$$$$$$$$%@...........#%$$$$$$$$$$$$$$$$&%$$$$$$$&........................*$$$$$$$$#................&$$$$$$$$=.......@%$$$$$$$$$$$$$$$$$$$$$$@.....+$$$$$$$$$$$$$$$$$...................................................................................", +"................+$$$$$$$$=................#$$$$$$$$#.......=$$$$$$$$$$$$$$$$$$$$$$*..........+$$$$$$$$$$$$$$$$$$$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+.......%$$$$$$$$$$$$$$$$$$$$$$$&.....=$$$$$$$$$$$$$$$$=...................................................................................", +"................-$$$$$$$$&...............@%$$$$$$$&.......-$$$$$$$$$$$$$$$$$$$$$$$$+........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$@.......................#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@......&$$$$$$$$$$$$$$$$$$$$$$$$%.....*$$$$$$$$$$$$$$$$-...................................................................................", +"................=$$$$$$$$+..............-%$$$$$$$*.......#$$$$$$$$$%&+@@+=$$$$$$$$$*........%$$$$$$$$$%-#.+&$$$$$$$$$$$$%........................-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$......@$$$$$$$$$*++..#+*$$$$$$$$$.....++++$$$$$$$$*++++@...................................................................................", +"................$$$$$$$$$-++++++++++++=%$$$$$$$$%@.......%$$$$$$$$&.......+$$$$$$$$$#......&$$$$$$$$$&......@%$$$$$$$$$$=........................=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=......&$$$$$$$$+........%$$$$$$$$........#$$$$$$$$+........................................................................................", +"...............@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=@.......&$$$$$$$$+.........&$$$$$$$$-.....@$$$$$$$$$+........+$$$$$$$$$$-........................%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&......%$$$$$$$+.........=$$$$$$$*........+$$$$$$$$@........................................................................................", +"...............+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-........@$$$$$$$$=..........@$$$$$$$$=.....*$$$$$$$$-..........*$$$$$$$$$+........................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.....#$$$$$$$*..........*$$$$$$$=........=$$$$$$$$.........................................................................................", +"...............&$$$$$$$$$$$$$$$$$$$$$$$$$$$$&@.........&$$$$$$$%............%$$$$$$$=....#$$$$$$$$*...........&$$$$$$$$$........................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$......#=======+.........@$$$$$$$$+........%$$$$$$$=.........................................................................................", +"...............*$$$$$$$$$$$$$$$$$$$$$$$$$$$&@..........%$$$$$$$&............=$$$$$$$=....&$$$$$$$$@...........+$$$$$$$$*........................-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%.......................@%$$$$$$$$#........$$$$$$$$&.........................................................................................", +"...............$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........+$$$$$$$$@............=$$$$$$$=....$$$$$$$$=............+$$$$$$$$=........................=$$$$$$$$&++++++++++++++++&$$$$$$$$=....................++=$$$$$$$$$$........+$$$$$$$$+.........................................................................................", +"..............#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.......=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=...+$$$$$$$$#............+$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-.............@+-=*$$$$$$$$$$$$$$*........-$$$$$$$$@.........................................................................................", +"..............+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+......$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=...=$$$$$$$%.............+$$$$$$$$#.......................@$$$$$$$$*.................%$$$$$$$$#..........#=%$$$$$$$$$$$$$$$$$$$=........=$$$$$$$%..........................................................................................", +"..............=$$$$$$$$+............+*$$$$$$$$$=.....+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...$$$$$$$$&.............+$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.........+%$$$$$$$$$$$$$$$$$$$$$$+........%$$$$$$$=..........................................................................................", +"..............%$$$$$$$$@..............=$$$$$$$$=.....-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#..#$$$$$$$$+.............=$$$$$$$=........................&$$$$$$$$+................+$$$$$$$$*.......@=$$$$$$$$$$$$$$$$$$$$$$$$@........$$$$$$$$-..........................................................................................", +"..............$$$$$$$$$...............@$$$$$$$$=.....=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...+$$$$$$$$#.............*$$$$$$$&........................*$$$$$$$$#................-$$$$$$$$=......@%$$$$$$$$$$$$$$*&&$$$$$$$$........+$$$$$$$$+..........................................................................................", +".............+$$$$$$$$=................$$$$$$$$&.....*$$$$$$$$=====================&...-$$$$$$$$.............@$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+......%$$$$$$$$$%=-+@...&$$$$$$$=........-$$$$$$$$...........................................................................................", +".............-$$$$$$$$&...............#$$$$$$$$+.....$$$$$$$$%.........................=$$$$$$$$.............-$$$$$$$$@.......................#$$$$$$$$*.................%$$$$$$$$@.....=$$$$$$$$*#........*$$$$$$$&........=$$$$$$$*...........................................................................................", +".............=$$$$$$$$+...............-$$$$$$$$+.....$$$$$$$$=.........................=$$$$$$$$.............*$$$$$$$%........................+$$$$$$$$&................@$$$$$$$$$.....#$$$$$$$$=.........@$$$$$$$$+........%$$$$$$$=...........................................................................................", +".............$$$$$$$$$................=$$$$$$$$......$$$$$$$$=.........................=$$$$$$$$............#$$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.....*$$$$$$$*..........-$$$$$$$$@........$$$$$$$$+...........................................................................................", +"............@$$$$$$$$%................$$$$$$$$$......$$$$$$$$=.........................=$$$$$$$$+...........%$$$$$$$$-........................%$$$$$$$$@................&$$$$$$$$&....@$$$$$$$$#..........%$$$$$$$%........+$$$$$$$$#...........................................................................................", +"............+$$$$$$$$=...............#$$$$$$$$=......%$$$$$$$$...........@========@....&$$$$$$$$&..........=$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+....+$$$$$$$$..........-$$$$$$$$=........&$$$$$$$$............................................................................................", +"............&$$$$$$$$-...............&$$$$$$$$&......=$$$$$$$$-..........=$$$$$$$*.....+$$$$$$$$%@........+$$$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.....=$$$$$$$$.........@$$$$$$$$$-........=$$$$$$$=............................................................................................", +"............*$$$$$$$$+...............=$$$$$$$$+......+$$$$$$$$$+.......@=$$$$$$$$@.....#$$$$$$$$$=.......=$$$$$$$$$$*........................-$$$$$$$$&................@$$$$$$$$%.....=$$$$$$$$-.......#%$$$$$$$$$+........$$$$$$$$-............................................................................................", +"............$$$$$$$$$................$$$$$$$$$#.......$$$$$$$$$$&#...#&$$$$$$$$$-.......%$$$$$$$$$*#..@-%$$$$$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.....=$$$$$$$$$-@...+&$$$$$$$$$$$........@$$$$$$$$=............................................................................................", +"...........#$$$$$$$$*...............@$$$$$$$$$........&$$$$$$$$$$$$$$$$$$$$$$$$=........&$$$$$$$$$$$$$$$$$$$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-.....-$$$$$$$$$$$$$$$$$$$$$$$$$$%........+$$$$$$$$$%==-........................................................................................", +"...........+$$$$$$$$=...............+$$$$$$$$$.........%$$$$$$$$$$$$$$$$$$$$$$=.........@$$$$$$$$$$$$$$$$$$$$$$$$$$$#.......................@$$$$$$$$%.................*$$$$$$$$+.....#$$$$$$$$$$$$$$$$$$$$$$$$$$=........+$$$$$$$$$$$$&........................................................................................", +"...........=$$$$$$$$+...............+$$$$$$$$$@........@$$$$$$$$$$$$$$$$$$$$$=...........-$$$$$$$$$$$$$$$$$=$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.......*$$$$$$$$$$$$$$$$*%$$$$$$$*........+$$$$$$$$$$$$+........................................................................................", +"...........%$$$$$$$$#...............+$$$$$$$$$=.........#%$$$$$$$$$$$$$$$$$$+.............=$$$$$$$$$$$$$$$+=$$$$$$$=........................&$$$$$$$$-................#$$$$$$$$*.......@$$$$$$$$$$$$$$$=.$$$$$$$$$+........$$$$$$$$$$$$@........................................................................................", +"...........$$$$$$$$$................@$$$$$$$$$*..........@*$$$$$$$$$$$$$$$&@...............=$$$$$$$$$$$$%@.%$$$$$$$&........................*$$$$$$$$+................-$$$$$$$$=........+$$$$$$$$$$$$%+..%$$$$$$$$*........&$$$$$$$$$$$.........................................................................................", +"..........@+++++++++.................+++++++++#............#*$$$$$$$$$$%&@..................+%$$$$$$$$%-...++++++++@........................+++++++++.................#++++++++@.........@*$$$$$$$$%&@...#++++++++#.........&$$$$$$$$$=.........................................................................................", +".............................................................@+&====&+@.......................#-====-#.....................................................................................@+====&+..........................@+=====&+@.........................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................"}; diff --git a/packages/hal/arm/sa11x0/cerfpda/current/misc/lcd_test.c b/packages/hal/arm/sa11x0/cerfpda/current/misc/lcd_test.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/misc/lcd_test.c @@ -0,0 +1,345 @@ +//========================================================================== +// +// lcd_test.c +// +// SA1110/CerfCube - LCD test +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-06-05 +// Description: Tool used to test LCD stuff +//####DESCRIPTIONEND#### + +#include // Configuration header +#include +#include + +#include // IO macros +#include // Register state info +#include // HAL interrupt macros + +#include // Board definitions +#include +#include + +#include "eCos.xpm" +#include "eCos2.xpm" +#include "redhat.xpm" +#include "redhat2.xpm" +#include "redboot.xpm" +#include "escw.xpm" +#include "logo.xpm" + +#ifndef FALSE +#define FALSE 0 +#define TRUE 1 +#endif + +#define STACK_SIZE 4096 +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +// FUNCTIONS + +static void +cyg_test_exit(void) +{ + while (TRUE) ; +} + +static void +lcd_test(cyg_addrword_t p) +{ + int i, pix, row, col; + int on; + + diag_printf("LCD test here\n"); + + lcd_init(16); +#if 0 + for (i = 0; i < 16; i++) { + on = true; + diag_printf("Fill with 0x%x\n", i); + for (row = 0; row < 240; row++) { + for (col = 0; col < 320/2; col++) { + if (on) { + fp->pixels[row][col] = RGB_RED(i)|RGB_GREEN(i)|RGB_BLUE(i); + } else { + fp->pixels[row][col] = 0xFFFF; + } + } + for (col = 320/2; col < 320; col++) { + if (!on) { + fp->pixels[row][col] = RGB_RED(i)|RGB_GREEN(i)|RGB_BLUE(i); + } else { + fp->pixels[row][col] = 0xFFFF; + } + } + if ((row & 0x0F) == 0x0F) { + if (on) { + on = false; + } else { + on = true; + } + } + } + cyg_thread_delay(100); + } +#endif +#if 0 + for (i = 0; i < 4; i++) { + for (row = 0; row < 240; row++) { + for (col = 0; col < 320; col++) { + switch (row/40) { + case 0: + pix = col / 20; // 0..15 + fp->pixels[row][col] = RGB_RED(pix); + break; + case 1: + pix = col / 10; // 0..31 + fp->pixels[row][col] = RGB_GREEN(pix); + break; + case 2: + pix = col / 20; // 0..15 + fp->pixels[row][col] = RGB_BLUE(pix); + break; + case 3: + pix = col / 20; // 0..15 + fp->pixels[row][col] = RGB_BLUE(pix) | RGB_GREEN(pix); + break; + case 4: + pix = col / 20; // 0..15 + fp->pixels[row][col] = RGB_BLUE(15) | RGB_GREEN(pix); + break; + case 5: + fp->pixels[row][col] = 0xFFFF; + break; + } + } + } + cyg_thread_delay(100); +#if 0 + for (row = 0; row < 240; row++) { + for (col = 0; col < 320; col++) { + pix = col / 20; // 0..15 + switch (row/60) { + case 0: + fp->pixels[row][col] = RGB_RED(pix); + break; + case 1: + fp->pixels[row][col] = RGB_GREEN(pix); + break; + case 2: + fp->pixels[row][col] = RGB_BLUE(pix); + break; + case 3: + fp->pixels[row][col] = 0xFFFF; + break; + } + } + } + cyg_thread_delay(100); +#endif +#if 0 + on = true; + for (row = 0; row < 240; row++) { + for (col = 0; col < 320/2; col++) { + if (on) { + fp->pixels[row][col] = RGB_GREEN(15); + } else { + fp->pixels[row][col] = RGB_BLUE(8); + } + } + for (col = 320/2; col < 320; col++) { + if (!on) { + fp->pixels[row][col] = RGB_GREEN(15); + } else { + fp->pixels[row][col] = RGB_BLUE(8); + } + } + if ((row & 0x0F) == 0x0F) { + if (on) { + on = false; + } else { + on = true; + } + } + } +#endif + } +#endif +#if 0 + for (row = 0; row < 240; row++) { + for (col = 0; col < 320; col++) { + if (col == 59) { + fp->pixels[row][col] = 0x0000; + } else { + fp->pixels[row][col] = 0xFFFF; + } + } + } + cyg_thread_delay(100); +#endif +#if 0 + for (i = 0; i < 16; i++) { + diag_printf("Value 0x%04x\n", (1<pixels[row][col] = (1<pixels[row][col] = RGB_RED(i); + } + } + cyg_thread_delay(100); + } +#endif +#if 0 + for (i = 0; i < 64; i++) { + diag_printf("Green at %d\n", i); + for (row = 0; row < 240; row++) { + for (col = 0; col < 320; col++) { + fp->pixels[row][col] = RGB_GREEN(i); + } + } + cyg_thread_delay(100); + } +#endif +#if 0 + for (i = 0; i < 32; i++) { + diag_printf("BLUE at %d\n", i); + for (row = 0; row < 240; row++) { + for (col = 0; col < 320; col++) { + fp->pixels[row][col] = RGB_BLUE(i); + } + } + cyg_thread_delay(100); + } +#endif + + while (true) { + for (i = 0; i < 1; i++) { + show_xpm(redboot_xpm); + cyg_thread_delay(15); + show_xpm(eCos_xpm); + cyg_thread_delay(25); + show_xpm(redboot_xpm); + cyg_thread_delay(15); + show_xpm(redhat_xpm); + cyg_thread_delay(25); + show_xpm(redboot_xpm); + cyg_thread_delay(25); + show_xpm(redboot_xpm); + cyg_thread_delay(15); + show_xpm(escw_xpm); + cyg_thread_delay(25); + show_xpm(redboot_xpm); + cyg_thread_delay(15); + show_xpm(eCos2_xpm); + cyg_thread_delay(25); + show_xpm(redboot_xpm); + cyg_thread_delay(15); + show_xpm(redhat2_xpm); + cyg_thread_delay(25); + show_xpm(logo_xpm); + cyg_thread_delay(25); + show_xpm(redboot_xpm); + cyg_thread_delay(50); + } + +#if 0 + // This doesn't seem to do anything on my unit + cerf_BCR(SA1110_BCR_MOTOR, SA1110_BCR_MOTOR_ON); + cyg_thread_delay(2*100); + cerf_BCR(SA1110_BCR_MOTOR, SA1110_BCR_MOTOR_OFF); +#endif + + show_xpm(redboot_xpm); + cyg_thread_delay(15); + lcd_clear(); + lcd_printf("\n\n**** Hello world!\n"); + cyg_thread_delay(5); + for (i = 0; i < 64; i++) { + lcd_printf("... testing line #%d\n", i); + } + cyg_thread_delay(50); + + show_xpm(redboot_xpm); + cyg_thread_delay(15); + set_bg(0,0,0); + set_fg(31,63,0); + lcd_clear(); + for (i = 0; i < 32; i++) { + lcd_printf("... testing line #%d\n", i); + } + cyg_thread_delay(50); + } // while + + lcd_clear(); + lcd_printf("*****"); + cyg_thread_delay(200); + + cyg_test_exit(); +} + +externC void +cyg_start( void ) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + lcd_test, // entry + 0, // entry parameter + "LCD test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} // cyg_package_start() diff --git a/packages/hal/arm/sa11x0/cerfpda/current/misc/logo.xpm b/packages/hal/arm/sa11x0/cerfpda/current/misc/logo.xpm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/misc/logo.xpm @@ -0,0 +1,260 @@ +/* XPM */ +static char * logo_xpm[] = { +"320 240 17 1", +" c None", +". c #030305", +"+ c #949394", +"@ c #D3D0D3", +"# c #525051", +"$ c #B7B6B8", +"% c #E2515E", +"& c #FEFEFC", +"* c #820204", +"= c #737073", +"- c #E33533", +"; c #343232", +"> c #E895AE", +", c #E51604", +"' c #E67284", +") c #EABAD4", +"! c #2C1416", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&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&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"................................................................................................................................................................................................................................................................................................................................", +".................................*..............................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"..................................!...................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"..................................!...................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".....................!=+@&&&&&&$+=!...................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"...................#$&&$+=#;##=+@&&$#.................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".................;$&$=!..........!#@&$;...............................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"...............!+&$#................#$&+..............................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+=;#...................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-%%>&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"..............;@&=....................=&@!............................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&&&&&&&&", +".............;&$;.....****!!*****!.....;$@;..................................................................!!!!!!...................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+!.........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,>&&&&&&&&&&&&&&&&&&&&&&&&", +"............;@@!.....*,,,*,*,*...**.....!@@!.................................................................#@@=#!...................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&=...........................................&&&&&&,,,-,,-,,-,,-,,-,,-,,-,,-,,-,,-,,-,,-,,-,,-,,,,,,,,,'&&&&&&&&&&&&&&&&&&&&&&&", +"...........!@@!.....*,,*,,,,,**..*,......!@@.................................................................#&&&&+!.!!!!.............................................&&&&&&&&&&&&&&&&&&&&&&&&&&&#............................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-,,,,,,,'&&&&&&&&&&&&&&&&&&&&&&", +"...........$&;......***,,,*,,,****,*......;&+...............................................................!#&&&&@..!$+!.............................................&&&&&&&&&&&&&&&&&&&&&&&&&&+...............;;;;..........................&&&&&&-,,,,,,,,,,,,,,--%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,>&&&&&&&&&&&&&&&&&&&&&", +"..........#&;.......,*.....*,*,,,,,*.......=&;...............................................................#&&&&$!..&&=!.............................!!!............&&&&&&&&&&&&&&&&&&&&&&&&&@!............#+&&&&&&@=!..................;===&&&&&&,,,,-,,,-,,,')&&&&&&>%,,,-,,,-,,,-,,'>@&&))'-,,,-,,,,,,&&&&&&&&&&&&&&&&&&&&&", +"..........@$........,*...!**,,*,*,,,*.......$$..............................................................!#&&&&@..!@&=.............................!#$=............&&&&&&&&&&&&&&&&&&&&&&&&&=...........;@&&&&&&&&&&&+..............!=&&&&&&&&&&&,,,,,,,,,-'&&&&&&&&&&&)%,,,,,,,,,,-)&&&&&&&&&)%,,,,,,,,'&&&&&&&&&&&&&&&&&&&&", +".........=&;.......!*,**,*,,*,,,,,*,,.......;&#..........................!...!..........!....................#&&&&$!..&&=!...!..............!!!........@&+!!..........&&&&&&&&&&&&&&&&&&&&&&&&&...........=&&&&&&&&&&&&&&$!...........#&&&&&&&&&&&&&,,-,,,,,,)&&&&&&&&&&&&&&%,,,,,-,,-&&&&&&&&&&&&%,,,,,,,,,&&&&&&&&&&&&&&&&&&&&", +".........@+....!***!,*,,,*,,,,,*,,,*,!.......$$......................!!!!!!!!!!!...!.!!!!!!............!!!!!!#&&&&@..!@&=!!!!!!!.......!.!!!.!!!!...!!!@&+!!!!........&&&&&&&&&&&&&&&&&&&&&&&&+..........+&&&&&&&&&&&&&&&&@!.........#&&&&&&&&&&&&&&,,,,-,,,)&&&&&&&&&&&&&&&&'-,,,,,,)&&&&&&&&&&&@,,,,-,,,,,>&&&&&&&&&&&&&&&&&&&", +"........;&#..*,*,,,..*,*,,,*,*,,,*,,,*.......#&;.....................#===;!!+$$#!..!!#+$$$+#!........!#+$$$=!#&&&&$!..&&=!!;=+=#!!.....!!!#=++=;.!.!!#!&&+;;;;!.......&&&&&&&&&&&&&&&&&&&&&&&&=.........#&&&&&&&&&&&&&&&&&&$........#&&&&&&&&&&&&&&&,,,,,,,)&&&&&&&&&&&&&&&&&&%,,,,,%&&&&&&&&&&&&-,-,,,,,,,,'&&&&&&&&&&&&&&&&&&&", +"........=&...,,,,*,*...**,,,,,*,,,,*,*........&=....................!@&&&=;@&&&+.!!#@&&&&&&&$;.....!!$&&&&&&@=@&&&@..!@&=!$&&&&&$#!...!!+@&&&&&@=!.!$&@&&&@&&@........&&&&&&&&&&&&&&&&&&&&&&&&;........!&&&&&&&=;...#$&&&&&&#......!&&&&&&&&@'''>@&&,,,,,,'&&&&&&&)'''>&&&&&&&&,,,,,'&&&&&)-,,%)),,,,,,,,-,,-&&&&&&&&&&&&&&&&&&&", +"........$$...,*,,,,*!......*,,,*,*,,,****.....$$.....................@&&&+@&&&&=!!#&&&&&&&&&&@!....;@&&&&&&&&&&&&&$!..&&#@&&@$@&&@#!...=&&@@$$&&&=!.$&@&&&@&&@........&&&&&&&&&&&&&&&&&&&&&&&&;........+&&&&&@!.......#&&&&&@......+&&&&&&&',,,,,,'&,,,,-,&&&&&&&-,,,,,,>&&&&&&',-,,)&&&&&%,,,,,-,,,,,-,,,,,%&&&&&&&&&&&&&&&&&&&", +"........&=...**,*,,,,*......*,,,,,,*,*,*,,....+@.....................@&&&@&&&&&+!;&&&&&@@&&&&&@....@&&&&&&&&&&&&&&@...&&@&$!...#&&@....#@=....!$&@..!;.@&+.;!;........&&&&&&&&&&&&&&&&&&&&&&&&.........&&&&&@!.........+&&&&&#....!&&&&&&&-,,,,,,,,',,,,,%&&&&&&-,,,,,,,,'&&&&&&,,,,)&&&&&>,,,,,,,,,,,,,,,,,-&&&&&&&&&&&&&&&&&&&", +".......;&#....*,,,*,*,,**....*,*,*,,,*,,,*,...#&.....................@&&&&&&&@&=!@&&&&=!.;@&&&&#!.+&&&&&@==$@&&&&&$!..@&&+......#&&=!...........&&+....&&+!...........&&&&&&&&&&&&&&&&&&&&&&&&........#&&&&&=;;;;#;;;#;#&&&&&+....#&&&&&&',,,,,,,,,,,,,,,>&&&&&%,,,,,,,,,,)&&&&&-,,,)&&&&&&@'-,,,,-,,,,,,,,,%&&&&&&&&&&&&&&&&&&&", +".......;&#.....*,,,,*,,*,,**!*,,,,*,,,*,,,,*..;&;....................@&&&&&@=;;.#&&&&=!....&&&&$.!@&&&&$....#&&&&&@..!&&@........@&$.........!.!$&$....@&+............&&&&&&&&&&&&&&&&&&&&&&&&........+&&&&&&&&&&&&&&&&&&&&&&&....+&&&&&&,,,,,,,,,,,-,,,,&&&&&@,,,,,,,,,,,%&&&&&>,,,'&&&&&&&&&)',,,,,,,,-,,,-&&&&&&&&&&&&&&&&&&&", +".......#&;......**,,,,*,,*,,,*,,*,,,*,,,*,**..#&;....................@&&&&@.....@&&&@!!!!!!$&&&@!#&&&&@;.....+&&&&$!..@&+!.......+&@!.....!!!!!!+&@....&&+!...........&&&&&&&&&&&&&&&&&&&&&&&&........$&&&&&&&&&&&&&&&&&&&&&&&....$&&&&&),,,,-,,,,,,,,,-,&&&&&',,,,,,,,,,,,&&&&&',,-,&&&&&&&&&&&&-,-,,-,,,,,%&&&&&&&&&&&&&&&&&&&", +".......;&;........**,,,,,,*,,*,,,*,,,*,,,,,...#&#....................@&&&&=.....@&&&@++$+$+@&&&&!+&&&&$.....!#&&&&@..!&&=........+&@....!!!;=+$$@&@....@&+............&&&&&&&&&&&&&&&&&&&&&&&&........$&&&&&&&&&&&&&&&&&&&&&&&....$&&&&&),,,,,,-,,,,,,,,-&&&&&'-,,-,,-,,,,,&&&&&),,,,%&&&&&&&&&&&&-,,,,,,,,,-&&&&&&&&&&&&&&&&&&&", +".......#&;.........*,*,*,,,,,,,*,,,*,,,*,**...;&;....................@&&&&;!...;&&&&&&&&&&&&&&&&!$&&&&=!.....#&&&&$!..@&=!.......=&&....!=@&&&&&&&@....&&+!...........&&&&&&&&&&&&&&&&&&&&&&&&........$&&&&&$$@$$$@$$$@$$$$$$$....$&&&&&),-,,,,,,,,,-,,,,&&&&&',,,,,,,,,,,,&&&&&>,,,,,->&&&&&&&&&&&,,,,,,-,,-&&&&&&&&&&&&&&&&&&&", +".......;&#.......;@@!**,*,*,*,,,*,,,*,,,,*....#&.....................@&&&&;....#&&&&&&&&&&&&&&&&!$&&&&#......#&&&&@..!&&=........=&@...!+&&&@$++$&@....@&+............&&&&&&&&&&&&&&&&&&&&&&&&........+&&&&&;.....................$&&&&&@,,,,,,,-,,,,,,,,&&&&&),,,,,,,,-,,-&&&&&'-,,,,,,,%>&&&&&&&&%,,,,,,,,-&&&&&&&&&&&&&&&&&&&", +"........&=.......+&&$...*,,,,,*,,,*,,,*,*.....=&.....................@&&&&!!...;&&&&&@&@&&@&&@&@;$&&&&=......#&&&&$!..@&=!.......=&&.!.$&&+!....+&@....@&+!...........&&&&&&&&&&&&&&&&&&&&&&&&........=&&&&&+................!....=&&&&&&-,,,-,,,,,,,,,,,)&&&&&-,,,,-,,,,,>&&&&&%,,,-,,,,,,,'&&&&&&',,-,,,,,%&&&&&&&&&&&&&&&&&&&", +"........@+.......;&&&@&;...**,,*,,,*,**.......+$.....................@&&&&;.....&&&&$.!;#######;!+&&&&$.....!#&&&&@..!&&=.......!=&@.!#&&=.....!+&@....@&+............&&&&&&&&&&&&&&&&&&&&&&&&........;&&&&&&;........!;;#;;#;....;&&&&&&@,,,,,,,,,-,,,,,'&&&&&)-,,,,,,,,-&&&&&&,,,,,,,,,,,,,>&&&&&',,,,,,,,-&&&&&&&&&&&&&&&&&&&", +"........+@.#=++$;.;&&&&@;.......!.!...........@=.....................@&&&&;!....@&&&&............=&&&&@..!..!+&&&&$!..@&=!.......=&&.!$&@.......+&@....&&+!...........&&&&&&&&&&&&&&&&&&&&&&&&;........$&&&&&&;......!@&&&&&&;.....$&&&&&&),,,,,,--@,,-,,-&&&&&&>,,,,,,,%&&&&&&>,,,,,>)-,,,,,>&&&&&',,,,-,,,%&&&&&&&&&&&&&&&&&&&", +"........#&#+&&&&&;.;&&&&&+;#;+=#==#=;........;&;.....................$&&&&;.....+&&&&).!!!!!!!...!&&&&&+.!!!#@&&&&@..!&&=.......!=&@.!@&$.....!!$&@....@&+............&&&&&&&&&&&&&&&&&&&&&&&&;........#&&&&&&&$#;.;+&&&&&&&+......#&&&&&&&&'%,,%>&&,,,,,,>&&&&&&&'%,-%>&&&&&&&-,-,,,&&&'%,,'&&&&&&%,,,,,,,,-&&&&&&&&&&&&&&&&&&&", +".........@&&&&&&&&$@&&&&&&&&&&&&&&&&.........+@......................@&&&@;!....!&&&&&@+=##=+@+...$&&&&&@+=$&&&&&&$...@&=!.......=&&..@&@!..!.!;&&@....@&+!...........&&&&&&&&&&&&&&&&&&&&&&&&#.........+&&&&&&&&&&&&&&&&&&@!.......=&&&&&&&&&&&&&&&,,,,,,-&&&&&&&&&&&&&&&&&&&',,,,,>&&&&&&&&&&&&&&,,,-,,,,,'&&&&&&&&&&&&&&&&&&&", +".........+&&&&&&&&&&&&&&&&&&&+$+@&&$........;&=......................@&&&&;......=&&&&&&&&&&&&@...;&&&&&&&&&&&&&&&@...&&=........=&@..+&&#!!!!!@&&@....$&@!!!.........&&&&&&&&&&&&&&&&&&&&&&&&+..........@&&&&&&&&&&&&&&&&&;.........+&&&&&&&&&&&&&&,,,,,,,-&&&&&&&&&&&&&&&&&),,,,,-&&&&&&&&&&&&&&',,,,,-,,,>&&&&&&&&&&&&&&&&&&&", +".........!&&&&&&&&&&&&&&&&&&@;..$&&+........+@.......................@&&&&;.......+&&&&&&&&&&&&....=&&&&&&&&&@@&&&@...&&=........+&&...@&&===$&&$&@....=&&$=+=........&&&&&&&&&&&&&&&&&&&&&&&&&..........!@&&&&&&&&&&&&&&&;...........+&&&&&&&&&&&&&,,-,,,,,%&&&&&&&&&&&&&&&),,,,,,'&&&&&&&&&&&&&>,,,,,,,,,,&&&&&&&&&&&&&&&&&&&&", +"..........=&&&&&&&&&&&&&&&&&&&@@&&&;..#+=+==&#.......................@&&&&;........=@&&&&&&&&&@!....=@&&&&&&@!$&&&@...@&=........=&@...#@&&&&&&+.&&.....$&&&&@........&&&&&&&&&&&&&&&&&&&&&&&&&#...........+&&&&&&&&&&&&$!.............#$&&&&&&&&&&&,,,,,,,,,-)&&&&&&&&&&&&>,,,-,,,,-)&&&&&&&&&&',,,,,,,,,,%&&&&&&&&&&&&&&&&&&&&", +"...........$&&&&&&&&&&&&&&&&&&&&&&=..#&&&&&&$........................=+++=!..........=+$@$$$+#........=$@@$=..#+++=...=+;........;+=....;+@@@+#..+=.....!+$@@+........&&&&&&&&&&&&&&&&&&&&&&&&&@............!+&&&&&&&&@#.................;=$$$&&&&&&,,,,,,,,,,,%)&&&&&&&&>,,,,,,,,,,,,-')@&&&)',,,-,,,,,-,,&&&&&&&&&&&&&&&&&&&&&", +"...........;&&&&&&&&&&&&&&&&&&&&&$.;$&&&&&&&!.........................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&=..............#++++#;........................&&&&&&,,,,,,,,,,,,,-%''''%,,,,,,,,,,,,,,,,,,,,,,,,,,,,-,,,,,'&&&&&&&&&&&&&&&&&&&&&", +"............;&&&&&&&&&&&&&&&&&&&&;!&&&&&&&&;..........................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&#............................................&&&&&&,,-,,,,,,,,,,,,,-,,,,,,,-,,,-,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&&&&", +".............=&&&&&&&&&&&&&&&&&&$+&&&&&&&@;...........................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&;...........................................&&&&&&,,,,-,,,-,,,,,,,,,,,,,,,,,,,,-,,-,,,,,,,,,,,-,,,,,,,%&&&&&&&&&&&&&&&&&&&&&&&", +"..............;&&&&&&&&&&&&&&&&&&&&&&&&&&;............................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&=..........................................&&&&&&,,,,,,,,,,,,,-,,,,,,-,,,,,,,,,,,,,,-,,,-,,,,,,,-,,-'&&&&&&&&&&&&&&&&&&&&&&&&", +"...............;@&&&&&&&&&&&&&&&&&&&&&&$!.............................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@;........................................&&&&&&,,,,,,,,,-,,,,,,-,,,,,,,-,,,,,,,,,,,,,,,,-,,,,,,,%)&&&&&&&&&&&&&&&&&&&&&&&&&", +".................=&&&&&&&&&&&&&&&&&&&&#...............................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@+;;....................................&&&&&&,,,,-,,,,,,,,,,,,,,,,-,,,,,,,-,,,,,,-,,,,,,,-,%'@&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"..................!+@&&&&&&&&&&&&&&@=!................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".....................#+@&&&&&&&&@+;...................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".........................;#;##;.......................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"......................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&..........................................................................................................................................................", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&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&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"}; diff --git a/packages/hal/arm/sa11x0/cerfpda/current/misc/redboot.xpm b/packages/hal/arm/sa11x0/cerfpda/current/misc/redboot.xpm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/misc/redboot.xpm @@ -0,0 +1,254 @@ +/* XPM */ +static char * redboot_xpm[] = { +"320 240 11 1", +" c None", +". c #FFFF00", +"+ c #FFAA00", +"@ c #FFE300", +"# c #FFC700", +"$ c #FF0000", +"% c #FF1D00", +"& c #FF7200", +"* c #FF5500", +"= c #FF3900", +"- c #FF8E00", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +".......................................................................+++++++++++++++++++++++++@......................................................................#+++++++#........@++++++++++++++++++++++.................................................................................................................", +".......................................................................$$$$$$$$$$$$$$$$$$$$$$$$$$%&@...................................................................$$$$$$$$&........*$$$$$$$$$$$$$$$$$$$$$$$%*#.............................................................................................................", +"......................................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.................................................................@$$$$$$$$+........%$$$$$$$$$$$$$$$$$$$$$$$$$$=@...........................................................................................................", +"......................................................................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+................................................................+$$$$$$$$.........$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+..........................................................................................................", +"......................................................................*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...............................................................&$$$$$$$%........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@.....................................................................................*$$$$$$$%...........", +"......................................................................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%...............................................................*$$$$$$$*........-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.....................................................................................$$$$$$$$*...........", +".....................................................................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-..............................................................$$$$$$$$-........*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#....................................................................................$$$$$$$$-...........", +".....................................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*.............................................................#$$$$$$$$#........%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...................................................................................+$$$$$$$$+...........", +".....................................................................*$$$$$$$$+............+&$$$$$$$$$$$.............................................................+$$$$$$$$........@$$$$$$$$=............+=$$$$$$$$$%...................................................................................-$$$$$$$$............", +".....................................................................=$$$$$$$$#..............@%$$$$$$$$$.............................................................*$$$$$$$=........+$$$$$$$$*..............-$$$$$$$$$...................................................................................*$$$$$$$=............", +".....................................................................$$$$$$$$$................#$$$$$$$$$.............................................................=$$$$$$$*........&$$$$$$$$+...............%$$$$$$$$...................................................................................%$$$$$$$*............", +"....................................................................#$$$$$$$$*.................=$$$$$$$%...............#++**-+#.........................@++**++......$$$$$$$$+........*$$$$$$$$#...............*$$$$$$$$..................@++&**++@............................#++**&++....................$$$$$$$$+............", +"....................................................................-$$$$$$$$&.................*$$$$$$$*............+*$$$$$$$$$$*#....................-=$$$$$$$$&@..+$$$$$$$$@........$$$$$$$$$................*$$$$$$$*...............+*$$$$$$$$$$%&@.....................@-=$$$$$$$$$$=-............@+++&$$$$$$$$&+++#........", +"....................................................................*$$$$$$$$+.................=$$$$$$$-.........@&$$$$$$$$$$$$$$$*@................-%$$$$$$$$$$$%@.-$$$$$$$$........#$$$$$$$$=................$$$$$$$$-.............-%$$$$$$$$$$$$$$$&..................@&$$$$$$$$$$$$$$$%+..........*$$$$$$$$$$$$$$$$*........", +"....................................................................%$$$$$$$$@................@$$$$$$$$@........+%$$$$$$$$$$$$$$$$$%@.............@=$$$$$$$$$$$$$$%@*$$$$$$$*........+$$$$$$$$&...............-$$$$$$$$@...........#%$$$$$$$$$$$$$$$$$$%@...............-$$$$$$$$$$$$$$$$$$$*.........%$$$$$$$$$$$$$$$$-........", +"....................................................................$$$$$$$$$.................&$$$$$$$*........*$$$$$$$$$$$$$$$$$$$$%@...........#%$$$$$$$$$$$$$$$$&%$$$$$$$&........*$$$$$$$$+..............@$$$$$$$$&...........-$$$$$$$$$$$$$$$$$$$$$%@............@*$$$$$$$$$$$$$$$$$$$$$*........$$$$$$$$$$$$$$$$$+........", +"...................................................................+$$$$$$$$*................#$$$$$$$$#.......*$$$$$$$$$$$$$$$$$$$$$$=..........+$$$$$$$$$$$$$$$$$$$$$$$$$$$+........=$$$$$$$$@.............@%$$$$$$$%@..........*$$$$$$$$$$$$$$$$$$$$$$$=...........@%$$$$$$$$$$$$$$$$$$$$$$$-......+$$$$$$$$$$$$$$$$$.........", +"...................................................................-$$$$$$$$&...............@%$$$$$$$&.......-$$$$$$$$$$$$$$$$$$$$$$$$+........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$@........$$$$$$$$$............#&$$$$$$$$$#..........&$$$$$$$$$$$$$$$$$$$$$$$$$-..........%$$$$$$$$$$$$$$$$$$$$$$$$$@.....-$$$$$$$$$$$$$$$$=.........", +"...................................................................*$$$$$$$$+..............-%$$$$$$$=.......#$$$$$$$$$%&+@@+*$$$$$$$$$=........%$$$$$$$$$%-#.+&$$$$$$$$$$$$%........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+..........+$$$$$$$$$$&+@@+&$$$$$$$$$$=.........*$$$$$$$$$%-+.#+=$$$$$$$$$$-.....#+++=$$$$$$$$++++#.........", +"...................................................................$$$$$$$$$-++++++++++++*%$$$$$$$$%@.......%$$$$$$$$&.......+$$$$$$$$$#......&$$$$$$$$$&......@%$$$$$$$$$$*........-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%+..........@$$$$$$$$$=@......@%$$$$$$$$$@.......-$$$$$$$$$&.......+$$$$$$$$$=.........%$$$$$$$*..............", +"..................................................................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*@.......&$$$$$$$$+.........&$$$$$$$$-.....@$$$$$$$$$+........+$$$$$$$$$$-........*$$$$$$$$$$$$$$$$$$$$$$$$$$$$=@...........=$$$$$$$$*.........#$$$$$$$$$+......@$$$$$$$$$+.........&$$$$$$$$$.........$$$$$$$$-..............", +"..................................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-........@$$$$$$$$*..........@$$$$$$$$*.....=$$$$$$$$-..........=$$$$$$$$$+........%$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...........#$$$$$$$$*...........*$$$$$$$$*......&$$$$$$$$+...........$$$$$$$$$+.......+$$$$$$$$+..............", +"..................................................................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$&@.........&$$$$$$$%............%$$$$$$$*....#$$$$$$$$=...........&$$$$$$$$$........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........=$$$$$$$%@...........+$$$$$$$$*.....@$$$$$$$$*............*$$$$$$$$+.......&$$$$$$$$...............", +"..................................................................=$$$$$$$$$$$$$$$$$$$$$$$$$$$&@..........%$$$$$$$&............*$$$$$$$*....&$$$$$$$$@...........+$$$$$$$$=........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........#$$$$$$$$-.............$$$$$$$$*.....&$$$$$$$$@............+$$$$$$$$+.......*$$$$$$$%...............", +"..................................................................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........+$$$$$$$$@............*$$$$$$$*....$$$$$$$$*............+$$$$$$$$*........&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#.......&$$$$$$$%..............$$$$$$$$*.....%$$$$$$$&.............+$$$$$$$$+.......$$$$$$$$*...............", +".................................................................#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*.......*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...+$$$$$$$$#............+$$$$$$$$+........*$$$$$$$$&++++++++++++*$$$$$$$$$$=.......$$$$$$$$-..............$$$$$$$$*....+$$$$$$$$@.............+$$$$$$$$+......@$$$$$$$$-...............", +".................................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+......$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...*$$$$$$$%.............+$$$$$$$$#........$$$$$$$$$..............@*$$$$$$$$$......+$$$$$$$$@..............$$$$$$$$+....*$$$$$$$=..............+$$$$$$$$.......+$$$$$$$$#...............", +".................................................................*$$$$$$$$+............+=$$$$$$$$$*.....+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...$$$$$$$$&.............+$$$$$$$$........@$$$$$$$$=................%$$$$$$$$+.....&$$$$$$$%..............@$$$$$$$$+....%$$$$$$$&..............-$$$$$$$$.......&$$$$$$$$................", +".................................................................%$$$$$$$$@..............*$$$$$$$$*.....-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#..#$$$$$$$$+.............*$$$$$$$*........+$$$$$$$$*................-$$$$$$$$+.....=$$$$$$$*..............+$$$$$$$$@...@$$$$$$$$+..............*$$$$$$$=.......*$$$$$$$=................", +".................................................................$$$$$$$$$...............@$$$$$$$$*.....*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...+$$$$$$$$#.............=$$$$$$$&........*$$$$$$$$+................+$$$$$$$$+.....$$$$$$$$&..............&$$$$$$$%....+$$$$$$$$#..............%$$$$$$$&.......$$$$$$$$*................", +"................................................................+$$$$$$$$*................$$$$$$$$&.....=$$$$$$$$*********************&...-$$$$$$$$.............@$$$$$$$$+........=$$$$$$$$#................+$$$$$$$$+.....$$$$$$$$+..............=$$$$$$$*....+$$$$$$$$..............@$$$$$$$$+......@$$$$$$$$+................", +"................................................................-$$$$$$$$&...............#$$$$$$$$+.....$$$$$$$$%.........................*$$$$$$$$.............-$$$$$$$$@........$$$$$$$$$.................*$$$$$$$$.....+$$$$$$$$+.............@$$$$$$$$+....*$$$$$$$$..............-$$$$$$$$.......+$$$$$$$$@................", +"................................................................*$$$$$$$$+...............-$$$$$$$$+.....$$$$$$$$*.........................*$$$$$$$$.............=$$$$$$$%........#$$$$$$$$=................@$$$$$$$$=.....+$$$$$$$$+.............&$$$$$$$$.....*$$$$$$$$..............%$$$$$$$*.......&$$$$$$$$.................", +"................................................................$$$$$$$$$................*$$$$$$$$......$$$$$$$$*.........................*$$$$$$$$............#$$$$$$$$*........-$$$$$$$$*................&$$$$$$$$-.....+$$$$$$$$+............@%$$$$$$$&.....*$$$$$$$$.............+$$$$$$$$#.......*$$$$$$$*.................", +"...............................................................@$$$$$$$$%................$$$$$$$$$......$$$$$$$$*.........................*$$$$$$$$+...........%$$$$$$$$-........*$$$$$$$$+...............+$$$$$$$$$@.....+$$$$$$$$*............&$$$$$$$$@.....*$$$$$$$$+............%$$$$$$$=........$$$$$$$$&.................", +"...............................................................+$$$$$$$$*...............#$$$$$$$$*......%$$$$$$$$...........@********@....&$$$$$$$$&..........*$$$$$$$$$+........%$$$$$$$$#..............+$$$$$$$$$&......+$$$$$$$$%...........+$$$$$$$$*......*$$$$$$$$&...........*$$$$$$$$+.......#$$$$$$$$+.................", +"...............................................................&$$$$$$$$-...............&$$$$$$$$&......*$$$$$$$$-..........*$$$$$$$=.....+$$$$$$$$%@........+$$$$$$$$$$.........$$$$$$$$$............@+=$$$$$$$$$%@.......$$$$$$$$$-.........+$$$$$$$$$@......+$$$$$$$$$@.........*$$$$$$$$=........+$$$$$$$$..................", +"...............................................................=$$$$$$$$+...............*$$$$$$$$+......+$$$$$$$$$+.......@*$$$$$$$$@.....#$$$$$$$$$*.......*$$$$$$$$$$=........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+........%$$$$$$$$$+.......-$$$$$$$$$-.......#$$$$$$$$$%@......@*$$$$$$$$$@........*$$$$$$$=..................", +"...............................................................$$$$$$$$$................$$$$$$$$$#.......$$$$$$$$$$&#...#&$$$$$$$$$-.......%$$$$$$$$$=#..@-%$$$$$$$$$$$*........&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&.........&$$$$$$$$$$&#...+=$$$$$$$$$=.........%$$$$$$$$$%-@..@-%$$$$$$$$$-.........=$$$$$$$%@.................", +"..............................................................#$$$$$$$$=...............@$$$$$$$$$........&$$$$$$$$$$$$$$$$$$$$$$$$*........&$$$$$$$$$$$$$$$$$$$$$$$$$$$+........*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........@$$$$$$$$$$$$$$$$$$$$$$$$$%@.........-$$$$$$$$$$$$$$$$$$$$$$$$$*..........$$$$$$$$$$***..............", +"..............................................................+$$$$$$$$*...............+$$$$$$$$$.........%$$$$$$$$$$$$$$$$$$$$$$*.........@$$$$$$$$$$$$$$$$$$$$$$$$$$$#........$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-............&$$$$$$$$$$$$$$$$$$$$$$$%@...........%$$$$$$$$$$$$$$$$$$$$$$$*...........$$$$$$$$$$$$%..............", +"..............................................................*$$$$$$$$+...............+$$$$$$$$$@........@$$$$$$$$$$$$$$$$$$$$$*...........-$$$$$$$$$$$$$$$$$*$$$$$$$$........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%#..............*$$$$$$$$$$$$$$$$$$$$$=@............@%$$$$$$$$$$$$$$$$$$$$$&............$$$$$$$$$$$$*..............", +"..............................................................%$$$$$$$$#...............+$$$$$$$$$*.........#%$$$$$$$$$$$$$$$$$$+.............*$$$$$$$$$$$$$$$+*$$$$$$$*........+$$$$$$$$$$$$$$$$$$$$$$$$$$$%-................@=$$$$$$$$$$$$$$$$$$$&...............+%$$$$$$$$$$$$$$$$$$%+.............*$$$$$$$$$$$-..............", +"..............................................................$$$$$$$$$................@$$$$$$$$$=..........@=$$$$$$$$$$$$$$$&@...............*$$$$$$$$$$$$%@.%$$$$$$$&........&$$$$$$$$$$$$$$$$$$$$$$$$=&#....................&$$$$$$$$$$$$$$$$=#.................@=$$$$$$$$$$$$$$$$&@..............#$$$$$$$$$$$+..............", +".............................................................@+++++++++.................+++++++++#............#=$$$$$$$$$$%&@..................+%$$$$$$$$%-...++++++++@........#++++++++++++++++++++++@.........................@&%$$$$$$$$$$%&#.....................#*$$$$$$$$$$$=-@.................+%$$$$$$$$$...............", +"................................................................................................................@+&****&+@.......................#-****-#..........................................................................#+******+#...........................+-*****&+@......................+&*****+#...............", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................+++++++++++++++++++++++++@......................................................................#+++++++#........@++++++++++++++++++++++........................................................................................................................................................................", +"................$$$$$$$$$$$$$$$$$$$$$$$$$$%&@...................................................................$$$$$$$$&........*$$$$$$$$$$$$$$$$$$$$$$$%*#....................................................................................................................................................................", +"...............+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.................................................................@$$$$$$$$+........%$$$$$$$$$$$$$$$$$$$$$$$$$$=@..................................................................................................................................................................", +"...............&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+................................................................+$$$$$$$$.........$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.................................................................................................................................................................", +"...............*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...............................................................&$$$$$$$%........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@.....................................................................................*$$$$$$$%..................................................................", +"...............$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%...............................................................*$$$$$$$*........-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.....................................................................................$$$$$$$$*..................................................................", +"..............@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-..............................................................$$$$$$$$-........*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#....................................................................................$$$$$$$$-..................................................................", +"..............+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*.............................................................#$$$$$$$$#........%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...................................................................................+$$$$$$$$+..................................................................", +"..............*$$$$$$$$+............+&$$$$$$$$$$$.............................................................+$$$$$$$$........@$$$$$$$$=............+=$$$$$$$$$%...................................................................................-$$$$$$$$...................................................................", +"..............=$$$$$$$$#..............@%$$$$$$$$$.............................................................*$$$$$$$=........+$$$$$$$$*..............-$$$$$$$$$...................................................................................*$$$$$$$=...................................................................", +"..............$$$$$$$$$................#$$$$$$$$$.............................................................=$$$$$$$*........&$$$$$$$$+...............%$$$$$$$$...................................................................................%$$$$$$$*...................................................................", +".............#$$$$$$$$*.................=$$$$$$$%...............#++**-+#.........................@++**++......$$$$$$$$+........*$$$$$$$$#...............*$$$$$$$$..................@++&**++@............................#++**&++....................$$$$$$$$+...................................................................", +".............-$$$$$$$$&.................*$$$$$$$*............+*$$$$$$$$$$*#....................-=$$$$$$$$&@..+$$$$$$$$@........$$$$$$$$$................*$$$$$$$*...............+*$$$$$$$$$$%&@.....................@-=$$$$$$$$$$=-............@+++&$$$$$$$$&+++#...............................................................", +".............*$$$$$$$$+.................=$$$$$$$-.........@&$$$$$$$$$$$$$$$*@................-%$$$$$$$$$$$%@.-$$$$$$$$........#$$$$$$$$=................$$$$$$$$-.............-%$$$$$$$$$$$$$$$&..................@&$$$$$$$$$$$$$$$%+..........*$$$$$$$$$$$$$$$$*...............................................................", +".............%$$$$$$$$@................@$$$$$$$$@........+%$$$$$$$$$$$$$$$$$%@.............@=$$$$$$$$$$$$$$%@*$$$$$$$*........+$$$$$$$$&...............-$$$$$$$$@...........#%$$$$$$$$$$$$$$$$$$%@...............-$$$$$$$$$$$$$$$$$$$*.........%$$$$$$$$$$$$$$$$-...............................................................", +".............$$$$$$$$$.................&$$$$$$$*........*$$$$$$$$$$$$$$$$$$$$%@...........#%$$$$$$$$$$$$$$$$&%$$$$$$$&........*$$$$$$$$+..............@$$$$$$$$&...........-$$$$$$$$$$$$$$$$$$$$$%@............@*$$$$$$$$$$$$$$$$$$$$$*........$$$$$$$$$$$$$$$$$+...............................................................", +"............+$$$$$$$$*................#$$$$$$$$#.......*$$$$$$$$$$$$$$$$$$$$$$=..........+$$$$$$$$$$$$$$$$$$$$$$$$$$$+........=$$$$$$$$@.............@%$$$$$$$%@..........*$$$$$$$$$$$$$$$$$$$$$$$=...........@%$$$$$$$$$$$$$$$$$$$$$$$-......+$$$$$$$$$$$$$$$$$................................................................", +"............-$$$$$$$$&...............@%$$$$$$$&.......-$$$$$$$$$$$$$$$$$$$$$$$$+........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$@........$$$$$$$$$............#&$$$$$$$$$#..........&$$$$$$$$$$$$$$$$$$$$$$$$$-..........%$$$$$$$$$$$$$$$$$$$$$$$$$@.....-$$$$$$$$$$$$$$$$=................................................................", +"............*$$$$$$$$+..............-%$$$$$$$=.......#$$$$$$$$$%&+@@+*$$$$$$$$$=........%$$$$$$$$$%-#.+&$$$$$$$$$$$$%........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+..........+$$$$$$$$$$&+@@+&$$$$$$$$$$=.........*$$$$$$$$$%-+.#+=$$$$$$$$$$-.....#+++=$$$$$$$$++++#................................................................", +"............$$$$$$$$$-++++++++++++*%$$$$$$$$%@.......%$$$$$$$$&.......+$$$$$$$$$#......&$$$$$$$$$&......@%$$$$$$$$$$*........-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%+..........@$$$$$$$$$=@......@%$$$$$$$$$@.......-$$$$$$$$$&.......+$$$$$$$$$=.........%$$$$$$$*.....................................................................", +"...........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*@.......&$$$$$$$$+.........&$$$$$$$$-.....@$$$$$$$$$+........+$$$$$$$$$$-........*$$$$$$$$$$$$$$$$$$$$$$$$$$$$=@...........=$$$$$$$$*.........#$$$$$$$$$+......@$$$$$$$$$+.........&$$$$$$$$$.........$$$$$$$$-.....................................................................", +"...........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-........@$$$$$$$$*..........@$$$$$$$$*.....=$$$$$$$$-..........=$$$$$$$$$+........%$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...........#$$$$$$$$*...........*$$$$$$$$*......&$$$$$$$$+...........$$$$$$$$$+.......+$$$$$$$$+.....................................................................", +"...........&$$$$$$$$$$$$$$$$$$$$$$$$$$$$&@.........&$$$$$$$%............%$$$$$$$*....#$$$$$$$$=...........&$$$$$$$$$........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........=$$$$$$$%@...........+$$$$$$$$*.....@$$$$$$$$*............*$$$$$$$$+.......&$$$$$$$$......................................................................", +"...........=$$$$$$$$$$$$$$$$$$$$$$$$$$$&@..........%$$$$$$$&............*$$$$$$$*....&$$$$$$$$@...........+$$$$$$$$=........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........#$$$$$$$$-.............$$$$$$$$*.....&$$$$$$$$@............+$$$$$$$$+.......*$$$$$$$%......................................................................", +"...........$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........+$$$$$$$$@............*$$$$$$$*....$$$$$$$$*............+$$$$$$$$*........&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#.......&$$$$$$$%..............$$$$$$$$*.....%$$$$$$$&.............+$$$$$$$$+.......$$$$$$$$*......................................................................", +"..........#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*.......*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...+$$$$$$$$#............+$$$$$$$$+........*$$$$$$$$&++++++++++++*$$$$$$$$$$=.......$$$$$$$$-..............$$$$$$$$*....+$$$$$$$$@.............+$$$$$$$$+......@$$$$$$$$-......................................................................", +"..........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+......$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...*$$$$$$$%.............+$$$$$$$$#........$$$$$$$$$..............@*$$$$$$$$$......+$$$$$$$$@..............$$$$$$$$+....*$$$$$$$=..............+$$$$$$$$.......+$$$$$$$$#......................................................................", +"..........*$$$$$$$$+............+=$$$$$$$$$*.....+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...$$$$$$$$&.............+$$$$$$$$........@$$$$$$$$=................%$$$$$$$$+.....&$$$$$$$%..............@$$$$$$$$+....%$$$$$$$&..............-$$$$$$$$.......&$$$$$$$$.......................................................................", +"..........%$$$$$$$$@..............*$$$$$$$$*.....-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#..#$$$$$$$$+.............*$$$$$$$*........+$$$$$$$$*................-$$$$$$$$+.....=$$$$$$$*..............+$$$$$$$$@...@$$$$$$$$+..............*$$$$$$$=.......*$$$$$$$=.......................................................................", +"..........$$$$$$$$$...............@$$$$$$$$*.....*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...+$$$$$$$$#.............=$$$$$$$&........*$$$$$$$$+................+$$$$$$$$+.....$$$$$$$$&..............&$$$$$$$%....+$$$$$$$$#..............%$$$$$$$&.......$$$$$$$$*.......................................................................", +".........+$$$$$$$$*................$$$$$$$$&.....=$$$$$$$$*********************&...-$$$$$$$$.............@$$$$$$$$+........=$$$$$$$$#................+$$$$$$$$+.....$$$$$$$$+..............=$$$$$$$*....+$$$$$$$$..............@$$$$$$$$+......@$$$$$$$$+.......................................................................", +".........-$$$$$$$$&...............#$$$$$$$$+.....$$$$$$$$%.........................*$$$$$$$$.............-$$$$$$$$@........$$$$$$$$$.................*$$$$$$$$.....+$$$$$$$$+.............@$$$$$$$$+....*$$$$$$$$..............-$$$$$$$$.......+$$$$$$$$@.......................................................................", +".........*$$$$$$$$+...............-$$$$$$$$+.....$$$$$$$$*.........................*$$$$$$$$.............=$$$$$$$%........#$$$$$$$$=................@$$$$$$$$=.....+$$$$$$$$+.............&$$$$$$$$.....*$$$$$$$$..............%$$$$$$$*.......&$$$$$$$$........................................................................", +".........$$$$$$$$$................*$$$$$$$$......$$$$$$$$*.........................*$$$$$$$$............#$$$$$$$$*........-$$$$$$$$*................&$$$$$$$$-.....+$$$$$$$$+............@%$$$$$$$&.....*$$$$$$$$.............+$$$$$$$$#.......*$$$$$$$*........................................................................", +"........@$$$$$$$$%................$$$$$$$$$......$$$$$$$$*.........................*$$$$$$$$+...........%$$$$$$$$-........*$$$$$$$$+...............+$$$$$$$$$@.....+$$$$$$$$*............&$$$$$$$$@.....*$$$$$$$$+............%$$$$$$$=........$$$$$$$$&........................................................................", +"........+$$$$$$$$*...............#$$$$$$$$*......%$$$$$$$$...........@********@....&$$$$$$$$&..........*$$$$$$$$$+........%$$$$$$$$#..............+$$$$$$$$$&......+$$$$$$$$%...........+$$$$$$$$*......*$$$$$$$$&...........*$$$$$$$$+.......#$$$$$$$$+........................................................................", +"........&$$$$$$$$-...............&$$$$$$$$&......*$$$$$$$$-..........*$$$$$$$=.....+$$$$$$$$%@........+$$$$$$$$$$.........$$$$$$$$$............@+=$$$$$$$$$%@.......$$$$$$$$$-.........+$$$$$$$$$@......+$$$$$$$$$@.........*$$$$$$$$=........+$$$$$$$$.........................................................................", +"........=$$$$$$$$+...............*$$$$$$$$+......+$$$$$$$$$+.......@*$$$$$$$$@.....#$$$$$$$$$*.......*$$$$$$$$$$=........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+........%$$$$$$$$$+.......-$$$$$$$$$-.......#$$$$$$$$$%@......@*$$$$$$$$$@........*$$$$$$$=.........................................................................", +"........$$$$$$$$$................$$$$$$$$$#.......$$$$$$$$$$&#...#&$$$$$$$$$-.......%$$$$$$$$$=#..@-%$$$$$$$$$$$*........&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&.........&$$$$$$$$$$&#...+=$$$$$$$$$=.........%$$$$$$$$$%-@..@-%$$$$$$$$$-.........=$$$$$$$%@........................................................................", +".......#$$$$$$$$=...............@$$$$$$$$$........&$$$$$$$$$$$$$$$$$$$$$$$$*........&$$$$$$$$$$$$$$$$$$$$$$$$$$$+........*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........@$$$$$$$$$$$$$$$$$$$$$$$$$%@.........-$$$$$$$$$$$$$$$$$$$$$$$$$*..........$$$$$$$$$$***.....................................................................", +".......+$$$$$$$$*...............+$$$$$$$$$.........%$$$$$$$$$$$$$$$$$$$$$$*.........@$$$$$$$$$$$$$$$$$$$$$$$$$$$#........$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-............&$$$$$$$$$$$$$$$$$$$$$$$%@...........%$$$$$$$$$$$$$$$$$$$$$$$*...........$$$$$$$$$$$$%.....................................................................", +".......*$$$$$$$$+...............+$$$$$$$$$@........@$$$$$$$$$$$$$$$$$$$$$*...........-$$$$$$$$$$$$$$$$$*$$$$$$$$........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%#..............*$$$$$$$$$$$$$$$$$$$$$=@............@%$$$$$$$$$$$$$$$$$$$$$&............$$$$$$$$$$$$*.....................................................................", +".......%$$$$$$$$#...............+$$$$$$$$$*.........#%$$$$$$$$$$$$$$$$$$+.............*$$$$$$$$$$$$$$$+*$$$$$$$*........+$$$$$$$$$$$$$$$$$$$$$$$$$$$%-................@=$$$$$$$$$$$$$$$$$$$&...............+%$$$$$$$$$$$$$$$$$$%+.............*$$$$$$$$$$$-.....................................................................", +".......$$$$$$$$$................@$$$$$$$$$=..........@=$$$$$$$$$$$$$$$&@...............*$$$$$$$$$$$$%@.%$$$$$$$&........&$$$$$$$$$$$$$$$$$$$$$$$$=&#....................&$$$$$$$$$$$$$$$$=#.................@=$$$$$$$$$$$$$$$$&@..............#$$$$$$$$$$$+.....................................................................", +"......@+++++++++.................+++++++++#............#=$$$$$$$$$$%&@..................+%$$$$$$$$%-...++++++++@........#++++++++++++++++++++++@.........................@&%$$$$$$$$$$%&#.....................#*$$$$$$$$$$$=-@.................+%$$$$$$$$$......................................................................", +".........................................................@+&****&+@.......................#-****-#..........................................................................#+******+#...........................+-*****&+@......................+&*****+#......................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +".................................................................+++++++++++++++++++++++++@......................................................................#+++++++#........@++++++++++++++++++++++.......................................................................................................................", +".................................................................$$$$$$$$$$$$$$$$$$$$$$$$$$%&@...................................................................$$$$$$$$&........*$$$$$$$$$$$$$$$$$$$$$$$%*#...................................................................................................................", +"................................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.................................................................@$$$$$$$$+........%$$$$$$$$$$$$$$$$$$$$$$$$$$=@.................................................................................................................", +"................................................................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+................................................................+$$$$$$$$.........$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+................................................................................................................", +"................................................................*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...............................................................&$$$$$$$%........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@.....................................................................................*$$$$$$$%.................", +"................................................................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%...............................................................*$$$$$$$*........-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.....................................................................................$$$$$$$$*.................", +"...............................................................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-..............................................................$$$$$$$$-........*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#....................................................................................$$$$$$$$-.................", +"...............................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*.............................................................#$$$$$$$$#........%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...................................................................................+$$$$$$$$+.................", +"...............................................................*$$$$$$$$+............+&$$$$$$$$$$$.............................................................+$$$$$$$$........@$$$$$$$$=............+=$$$$$$$$$%...................................................................................-$$$$$$$$..................", +"...............................................................=$$$$$$$$#..............@%$$$$$$$$$.............................................................*$$$$$$$=........+$$$$$$$$*..............-$$$$$$$$$...................................................................................*$$$$$$$=..................", +"...............................................................$$$$$$$$$................#$$$$$$$$$.............................................................=$$$$$$$*........&$$$$$$$$+...............%$$$$$$$$...................................................................................%$$$$$$$*..................", +"..............................................................#$$$$$$$$*.................=$$$$$$$%...............#++**-+#.........................@++**++......$$$$$$$$+........*$$$$$$$$#...............*$$$$$$$$..................@++&**++@............................#++**&++....................$$$$$$$$+..................", +"..............................................................-$$$$$$$$&.................*$$$$$$$*............+*$$$$$$$$$$*#....................-=$$$$$$$$&@..+$$$$$$$$@........$$$$$$$$$................*$$$$$$$*...............+*$$$$$$$$$$%&@.....................@-=$$$$$$$$$$=-............@+++&$$$$$$$$&+++#..............", +"..............................................................*$$$$$$$$+.................=$$$$$$$-.........@&$$$$$$$$$$$$$$$*@................-%$$$$$$$$$$$%@.-$$$$$$$$........#$$$$$$$$=................$$$$$$$$-.............-%$$$$$$$$$$$$$$$&..................@&$$$$$$$$$$$$$$$%+..........*$$$$$$$$$$$$$$$$*..............", +"..............................................................%$$$$$$$$@................@$$$$$$$$@........+%$$$$$$$$$$$$$$$$$%@.............@=$$$$$$$$$$$$$$%@*$$$$$$$*........+$$$$$$$$&...............-$$$$$$$$@...........#%$$$$$$$$$$$$$$$$$$%@...............-$$$$$$$$$$$$$$$$$$$*.........%$$$$$$$$$$$$$$$$-..............", +"..............................................................$$$$$$$$$.................&$$$$$$$*........*$$$$$$$$$$$$$$$$$$$$%@...........#%$$$$$$$$$$$$$$$$&%$$$$$$$&........*$$$$$$$$+..............@$$$$$$$$&...........-$$$$$$$$$$$$$$$$$$$$$%@............@*$$$$$$$$$$$$$$$$$$$$$*........$$$$$$$$$$$$$$$$$+..............", +".............................................................+$$$$$$$$*................#$$$$$$$$#.......*$$$$$$$$$$$$$$$$$$$$$$=..........+$$$$$$$$$$$$$$$$$$$$$$$$$$$+........=$$$$$$$$@.............@%$$$$$$$%@..........*$$$$$$$$$$$$$$$$$$$$$$$=...........@%$$$$$$$$$$$$$$$$$$$$$$$-......+$$$$$$$$$$$$$$$$$...............", +".............................................................-$$$$$$$$&...............@%$$$$$$$&.......-$$$$$$$$$$$$$$$$$$$$$$$$+........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$@........$$$$$$$$$............#&$$$$$$$$$#..........&$$$$$$$$$$$$$$$$$$$$$$$$$-..........%$$$$$$$$$$$$$$$$$$$$$$$$$@.....-$$$$$$$$$$$$$$$$=...............", +".............................................................*$$$$$$$$+..............-%$$$$$$$=.......#$$$$$$$$$%&+@@+*$$$$$$$$$=........%$$$$$$$$$%-#.+&$$$$$$$$$$$$%........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+..........+$$$$$$$$$$&+@@+&$$$$$$$$$$=.........*$$$$$$$$$%-+.#+=$$$$$$$$$$-.....#+++=$$$$$$$$++++#...............", +".............................................................$$$$$$$$$-++++++++++++*%$$$$$$$$%@.......%$$$$$$$$&.......+$$$$$$$$$#......&$$$$$$$$$&......@%$$$$$$$$$$*........-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%+..........@$$$$$$$$$=@......@%$$$$$$$$$@.......-$$$$$$$$$&.......+$$$$$$$$$=.........%$$$$$$$*....................", +"............................................................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*@.......&$$$$$$$$+.........&$$$$$$$$-.....@$$$$$$$$$+........+$$$$$$$$$$-........*$$$$$$$$$$$$$$$$$$$$$$$$$$$$=@...........=$$$$$$$$*.........#$$$$$$$$$+......@$$$$$$$$$+.........&$$$$$$$$$.........$$$$$$$$-....................", +"............................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-........@$$$$$$$$*..........@$$$$$$$$*.....=$$$$$$$$-..........=$$$$$$$$$+........%$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...........#$$$$$$$$*...........*$$$$$$$$*......&$$$$$$$$+...........$$$$$$$$$+.......+$$$$$$$$+....................", +"............................................................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$&@.........&$$$$$$$%............%$$$$$$$*....#$$$$$$$$=...........&$$$$$$$$$........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........=$$$$$$$%@...........+$$$$$$$$*.....@$$$$$$$$*............*$$$$$$$$+.......&$$$$$$$$.....................", +"............................................................=$$$$$$$$$$$$$$$$$$$$$$$$$$$&@..........%$$$$$$$&............*$$$$$$$*....&$$$$$$$$@...........+$$$$$$$$=........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........#$$$$$$$$-.............$$$$$$$$*.....&$$$$$$$$@............+$$$$$$$$+.......*$$$$$$$%.....................", +"............................................................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........+$$$$$$$$@............*$$$$$$$*....$$$$$$$$*............+$$$$$$$$*........&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#.......&$$$$$$$%..............$$$$$$$$*.....%$$$$$$$&.............+$$$$$$$$+.......$$$$$$$$*.....................", +"...........................................................#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*.......*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...+$$$$$$$$#............+$$$$$$$$+........*$$$$$$$$&++++++++++++*$$$$$$$$$$=.......$$$$$$$$-..............$$$$$$$$*....+$$$$$$$$@.............+$$$$$$$$+......@$$$$$$$$-.....................", +"...........................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+......$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*...*$$$$$$$%.............+$$$$$$$$#........$$$$$$$$$..............@*$$$$$$$$$......+$$$$$$$$@..............$$$$$$$$+....*$$$$$$$=..............+$$$$$$$$.......+$$$$$$$$#.....................", +"...........................................................*$$$$$$$$+............+=$$$$$$$$$*.....+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...$$$$$$$$&.............+$$$$$$$$........@$$$$$$$$=................%$$$$$$$$+.....&$$$$$$$%..............@$$$$$$$$+....%$$$$$$$&..............-$$$$$$$$.......&$$$$$$$$......................", +"...........................................................%$$$$$$$$@..............*$$$$$$$$*.....-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#..#$$$$$$$$+.............*$$$$$$$*........+$$$$$$$$*................-$$$$$$$$+.....=$$$$$$$*..............+$$$$$$$$@...@$$$$$$$$+..............*$$$$$$$=.......*$$$$$$$=......................", +"...........................................................$$$$$$$$$...............@$$$$$$$$*.....*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...+$$$$$$$$#.............=$$$$$$$&........*$$$$$$$$+................+$$$$$$$$+.....$$$$$$$$&..............&$$$$$$$%....+$$$$$$$$#..............%$$$$$$$&.......$$$$$$$$*......................", +"..........................................................+$$$$$$$$*................$$$$$$$$&.....=$$$$$$$$*********************&...-$$$$$$$$.............@$$$$$$$$+........=$$$$$$$$#................+$$$$$$$$+.....$$$$$$$$+..............=$$$$$$$*....+$$$$$$$$..............@$$$$$$$$+......@$$$$$$$$+......................", +"..........................................................-$$$$$$$$&...............#$$$$$$$$+.....$$$$$$$$%.........................*$$$$$$$$.............-$$$$$$$$@........$$$$$$$$$.................*$$$$$$$$.....+$$$$$$$$+.............@$$$$$$$$+....*$$$$$$$$..............-$$$$$$$$.......+$$$$$$$$@......................", +"..........................................................*$$$$$$$$+...............-$$$$$$$$+.....$$$$$$$$*.........................*$$$$$$$$.............=$$$$$$$%........#$$$$$$$$=................@$$$$$$$$=.....+$$$$$$$$+.............&$$$$$$$$.....*$$$$$$$$..............%$$$$$$$*.......&$$$$$$$$.......................", +"..........................................................$$$$$$$$$................*$$$$$$$$......$$$$$$$$*.........................*$$$$$$$$............#$$$$$$$$*........-$$$$$$$$*................&$$$$$$$$-.....+$$$$$$$$+............@%$$$$$$$&.....*$$$$$$$$.............+$$$$$$$$#.......*$$$$$$$*.......................", +".........................................................@$$$$$$$$%................$$$$$$$$$......$$$$$$$$*.........................*$$$$$$$$+...........%$$$$$$$$-........*$$$$$$$$+...............+$$$$$$$$$@.....+$$$$$$$$*............&$$$$$$$$@.....*$$$$$$$$+............%$$$$$$$=........$$$$$$$$&.......................", +".........................................................+$$$$$$$$*...............#$$$$$$$$*......%$$$$$$$$...........@********@....&$$$$$$$$&..........*$$$$$$$$$+........%$$$$$$$$#..............+$$$$$$$$$&......+$$$$$$$$%...........+$$$$$$$$*......*$$$$$$$$&...........*$$$$$$$$+.......#$$$$$$$$+.......................", +".........................................................&$$$$$$$$-...............&$$$$$$$$&......*$$$$$$$$-..........*$$$$$$$=.....+$$$$$$$$%@........+$$$$$$$$$$.........$$$$$$$$$............@+=$$$$$$$$$%@.......$$$$$$$$$-.........+$$$$$$$$$@......+$$$$$$$$$@.........*$$$$$$$$=........+$$$$$$$$........................", +".........................................................=$$$$$$$$+...............*$$$$$$$$+......+$$$$$$$$$+.......@*$$$$$$$$@.....#$$$$$$$$$*.......*$$$$$$$$$$=........+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+........%$$$$$$$$$+.......-$$$$$$$$$-.......#$$$$$$$$$%@......@*$$$$$$$$$@........*$$$$$$$=........................", +".........................................................$$$$$$$$$................$$$$$$$$$#.......$$$$$$$$$$&#...#&$$$$$$$$$-.......%$$$$$$$$$=#..@-%$$$$$$$$$$$*........&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&.........&$$$$$$$$$$&#...+=$$$$$$$$$=.........%$$$$$$$$$%-@..@-%$$$$$$$$$-.........=$$$$$$$%@.......................", +"........................................................#$$$$$$$$=...............@$$$$$$$$$........&$$$$$$$$$$$$$$$$$$$$$$$$*........&$$$$$$$$$$$$$$$$$$$$$$$$$$$+........*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*..........@$$$$$$$$$$$$$$$$$$$$$$$$$%@.........-$$$$$$$$$$$$$$$$$$$$$$$$$*..........$$$$$$$$$$***....................", +"........................................................+$$$$$$$$*...............+$$$$$$$$$.........%$$$$$$$$$$$$$$$$$$$$$$*.........@$$$$$$$$$$$$$$$$$$$$$$$$$$$#........$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-............&$$$$$$$$$$$$$$$$$$$$$$$%@...........%$$$$$$$$$$$$$$$$$$$$$$$*...........$$$$$$$$$$$$%....................", +"........................................................*$$$$$$$$+...............+$$$$$$$$$@........@$$$$$$$$$$$$$$$$$$$$$*...........-$$$$$$$$$$$$$$$$$*$$$$$$$$........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%#..............*$$$$$$$$$$$$$$$$$$$$$=@............@%$$$$$$$$$$$$$$$$$$$$$&............$$$$$$$$$$$$*....................", +"........................................................%$$$$$$$$#...............+$$$$$$$$$*.........#%$$$$$$$$$$$$$$$$$$+.............*$$$$$$$$$$$$$$$+*$$$$$$$*........+$$$$$$$$$$$$$$$$$$$$$$$$$$$%-................@=$$$$$$$$$$$$$$$$$$$&...............+%$$$$$$$$$$$$$$$$$$%+.............*$$$$$$$$$$$-....................", +"........................................................$$$$$$$$$................@$$$$$$$$$=..........@=$$$$$$$$$$$$$$$&@...............*$$$$$$$$$$$$%@.%$$$$$$$&........&$$$$$$$$$$$$$$$$$$$$$$$$=&#....................&$$$$$$$$$$$$$$$$=#.................@=$$$$$$$$$$$$$$$$&@..............#$$$$$$$$$$$+....................", +".......................................................@+++++++++.................+++++++++#............#=$$$$$$$$$$%&@..................+%$$$$$$$$%-...++++++++@........#++++++++++++++++++++++@.........................@&%$$$$$$$$$$%&#.....................#*$$$$$$$$$$$=-@.................+%$$$$$$$$$.....................", +"..........................................................................................................@+&****&+@.......................#-****-#..........................................................................#+******+#...........................+-*****&+@......................+&*****+#.....................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................"}; diff --git a/packages/hal/arm/sa11x0/cerfpda/current/misc/redboot_RAM.ecm b/packages/hal/arm/sa11x0/cerfpda/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/misc/redboot_RAM.ecm @@ -0,0 +1,75 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware cerfpda ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_SA11X0 current ; + package -hardware CYGPKG_HAL_ARM_SA11X0_CERFPDA current ; + package -hardware CYGPKG_IO_SERIAL_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_ETH_ARM_CERFPDA current ; + package -hardware CYGPKG_DEVS_FLASH_CERFPDA current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_component CYGPKG_REDBOOT_NETWORKING { + user_value 1 +}; + +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + + diff --git a/packages/hal/arm/sa11x0/cerfpda/current/misc/redboot_ROM.ecm b/packages/hal/arm/sa11x0/cerfpda/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/misc/redboot_ROM.ecm @@ -0,0 +1,75 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware cerfpda ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_SA11X0 current ; + package -hardware CYGPKG_HAL_ARM_SA11X0_CERFPDA current ; + package -hardware CYGPKG_IO_SERIAL_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_ETH_ARM_CERFPDA current ; + package -hardware CYGPKG_DEVS_FLASH_CERFPDA current ; + + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_component CYGPKG_REDBOOT_NETWORKING { + user_value 1 +}; + +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + diff --git a/packages/hal/arm/sa11x0/cerfpda/current/misc/redhat.xpm b/packages/hal/arm/sa11x0/cerfpda/current/misc/redhat.xpm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/misc/redhat.xpm @@ -0,0 +1,254 @@ +/* XPM */ +static char * redhat_xpm[] = { +"320 240 11 1", +" c None", +". c #FFFFFF", +"+ c #FFAAAA", +"@ c #FFE3E3", +"# c #FFC7C7", +"$ c #FF0000", +"% c #FF1D1D", +"& c #FF7272", +"* c #FF3939", +"= c #FF5555", +"- c #FF8E8E", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"......................+++++++++++++++++++++++++@......................................................................#+++++++#........................#++++++++@................@++++++++#.....................................................................................................................................", +"......................$$$$$$$$$$$$$$$$$$$$$$$$$$%&@...................................................................$$$$$$$$&........................*$$$$$$$$#................&$$$$$$$$&.....................................................................................................................................", +".....................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.................................................................@$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+.....................................................................................................................................", +".....................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+................................................................+$$$$$$$$........................#$$$$$$$$*.................$$$$$$$$$@.....................................................................................................................................", +".....................=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...............................................................&$$$$$$$%........................-$$$$$$$$=................@$$$$$$$$$..........................................$$$$$$$$&...................................................................................", +".....................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%...............................................................=$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.........................................+$$$$$$$$+...................................................................................", +"....................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-..............................................................$$$$$$$$-........................%$$$$$$$$@................=$$$$$$$$&.........................................+$$$$$$$$@...................................................................................", +"....................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.............................................................#$$$$$$$$#........................$$$$$$$$$.................*$$$$$$$$+.........................................=$$$$$$$$....................................................................................", +"....................=$$$$$$$$+............+&$$$$$$$$$$$.............................................................+$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$..........................................*$$$$$$$=....................................................................................", +"....................*$$$$$$$$#..............@%$$$$$$$$$.............................................................=$$$$$$$*........................&$$$$$$$$&................#$$$$$$$$%..........................................$$$$$$$$-....................................................................................", +"....................$$$$$$$$$................#$$$$$$$$$.............................................................*$$$$$$$=........................=$$$$$$$$+................-$$$$$$$$=.........................................#$$$$$$$$+....................................................................................", +"...................#$$$$$$$$=.................*$$$$$$$%...............#++==-+#.........................@++==++......$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-..............@++-===-++.................+$$$$$$$$.....................................................................................", +"...................-$$$$$$$$&.................=$$$$$$$=............+=$$$$$$$$$$=#....................-*$$$$$$$$&@..+$$$$$$$$@.......................@$$$$$$$$%.................%$$$$$$$$#...........+=$$$$$$$$$$$$*-..........#+++*$$$$$$$$++++@................................................................................", +"...................=$$$$$$$$+.................*$$$$$$$-.........@&$$$$$$$$$$$$$$$=@................-%$$$$$$$$$$$%@.-$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$..........-%$$$$$$$$$$$$$$$$%+........$$$$$$$$$$$$$$$$$+................................................................................", +"...................%$$$$$$$$@................@$$$$$$$$@........+%$$$$$$$$$$$$$$$$$%@.............@*$$$$$$$$$$$$$$%@=$$$$$$$=........................=$$$$$$$$-................+$$$$$$$$*........@*$$$$$$$$$$$$$$$$$$$$+......#$$$$$$$$$$$$$$$$$@................................................................................", +"...................$$$$$$$$$.................&$$$$$$$=........=$$$$$$$$$$$$$$$$$$$$%@...........#%$$$$$$$$$$$$$$$$&%$$$$$$$&........................*$$$$$$$$#................&$$$$$$$$=.......@%$$$$$$$$$$$$$$$$$$$$$$@.....+$$$$$$$$$$$$$$$$$.................................................................................", +"..................+$$$$$$$$=................#$$$$$$$$#.......=$$$$$$$$$$$$$$$$$$$$$$*..........+$$$$$$$$$$$$$$$$$$$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+.......%$$$$$$$$$$$$$$$$$$$$$$$&.....=$$$$$$$$$$$$$$$$=.................................................................................", +"..................-$$$$$$$$&...............@%$$$$$$$&.......-$$$$$$$$$$$$$$$$$$$$$$$$+........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$@.......................#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@......&$$$$$$$$$$$$$$$$$$$$$$$$%.....*$$$$$$$$$$$$$$$$-.................................................................................", +"..................=$$$$$$$$+..............-%$$$$$$$*.......#$$$$$$$$$%&+@@+=$$$$$$$$$*........%$$$$$$$$$%-#.+&$$$$$$$$$$$$%........................-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$......@$$$$$$$$$*++..#+*$$$$$$$$$.....++++$$$$$$$$*++++@.................................................................................", +"..................$$$$$$$$$-++++++++++++=%$$$$$$$$%@.......%$$$$$$$$&.......+$$$$$$$$$#......&$$$$$$$$$&......@%$$$$$$$$$$=........................=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=......&$$$$$$$$+........%$$$$$$$$........#$$$$$$$$+......................................................................................", +".................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=@.......&$$$$$$$$+.........&$$$$$$$$-.....@$$$$$$$$$+........+$$$$$$$$$$-........................%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&......%$$$$$$$+.........=$$$$$$$*........+$$$$$$$$@......................................................................................", +".................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-........@$$$$$$$$=..........@$$$$$$$$=.....*$$$$$$$$-..........*$$$$$$$$$+........................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.....#$$$$$$$*..........*$$$$$$$=........=$$$$$$$$.......................................................................................", +".................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$&@.........&$$$$$$$%............%$$$$$$$=....#$$$$$$$$*...........&$$$$$$$$$........................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$......#=======+.........@$$$$$$$$+........%$$$$$$$=.......................................................................................", +".................*$$$$$$$$$$$$$$$$$$$$$$$$$$$&@..........%$$$$$$$&............=$$$$$$$=....&$$$$$$$$@...........+$$$$$$$$*........................-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%.......................@%$$$$$$$$#........$$$$$$$$&.......................................................................................", +".................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........+$$$$$$$$@............=$$$$$$$=....$$$$$$$$=............+$$$$$$$$=........................=$$$$$$$$&++++++++++++++++&$$$$$$$$=....................++=$$$$$$$$$$........+$$$$$$$$+.......................................................................................", +"................#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.......=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=...+$$$$$$$$#............+$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-.............@+-=*$$$$$$$$$$$$$$*........-$$$$$$$$@.......................................................................................", +"................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+......$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=...=$$$$$$$%.............+$$$$$$$$#.......................@$$$$$$$$*.................%$$$$$$$$#..........#=%$$$$$$$$$$$$$$$$$$$=........=$$$$$$$%........................................................................................", +"................=$$$$$$$$+............+*$$$$$$$$$=.....+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...$$$$$$$$&.............+$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.........+%$$$$$$$$$$$$$$$$$$$$$$+........%$$$$$$$=........................................................................................", +"................%$$$$$$$$@..............=$$$$$$$$=.....-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#..#$$$$$$$$+.............=$$$$$$$=........................&$$$$$$$$+................+$$$$$$$$*.......@=$$$$$$$$$$$$$$$$$$$$$$$$@........$$$$$$$$-........................................................................................", +"................$$$$$$$$$...............@$$$$$$$$=.....=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...+$$$$$$$$#.............*$$$$$$$&........................*$$$$$$$$#................-$$$$$$$$=......@%$$$$$$$$$$$$$$*&&$$$$$$$$........+$$$$$$$$+........................................................................................", +"...............+$$$$$$$$=................$$$$$$$$&.....*$$$$$$$$=====================&...-$$$$$$$$.............@$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+......%$$$$$$$$$%=-+@...&$$$$$$$=........-$$$$$$$$.........................................................................................", +"...............-$$$$$$$$&...............#$$$$$$$$+.....$$$$$$$$%.........................=$$$$$$$$.............-$$$$$$$$@.......................#$$$$$$$$*.................%$$$$$$$$@.....=$$$$$$$$*#........*$$$$$$$&........=$$$$$$$*.........................................................................................", +"...............=$$$$$$$$+...............-$$$$$$$$+.....$$$$$$$$=.........................=$$$$$$$$.............*$$$$$$$%........................+$$$$$$$$&................@$$$$$$$$$.....#$$$$$$$$=.........@$$$$$$$$+........%$$$$$$$=.........................................................................................", +"...............$$$$$$$$$................=$$$$$$$$......$$$$$$$$=.........................=$$$$$$$$............#$$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.....*$$$$$$$*..........-$$$$$$$$@........$$$$$$$$+.........................................................................................", +"..............@$$$$$$$$%................$$$$$$$$$......$$$$$$$$=.........................=$$$$$$$$+...........%$$$$$$$$-........................%$$$$$$$$@................&$$$$$$$$&....@$$$$$$$$#..........%$$$$$$$%........+$$$$$$$$#.........................................................................................", +"..............+$$$$$$$$=...............#$$$$$$$$=......%$$$$$$$$...........@========@....&$$$$$$$$&..........=$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+....+$$$$$$$$..........-$$$$$$$$=........&$$$$$$$$..........................................................................................", +"..............&$$$$$$$$-...............&$$$$$$$$&......=$$$$$$$$-..........=$$$$$$$*.....+$$$$$$$$%@........+$$$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.....=$$$$$$$$.........@$$$$$$$$$-........=$$$$$$$=..........................................................................................", +"..............*$$$$$$$$+...............=$$$$$$$$+......+$$$$$$$$$+.......@=$$$$$$$$@.....#$$$$$$$$$=.......=$$$$$$$$$$*........................-$$$$$$$$&................@$$$$$$$$%.....=$$$$$$$$-.......#%$$$$$$$$$+........$$$$$$$$-..........................................................................................", +"..............$$$$$$$$$................$$$$$$$$$#.......$$$$$$$$$$&#...#&$$$$$$$$$-.......%$$$$$$$$$*#..@-%$$$$$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.....=$$$$$$$$$-@...+&$$$$$$$$$$$........@$$$$$$$$=..........................................................................................", +".............#$$$$$$$$*...............@$$$$$$$$$........&$$$$$$$$$$$$$$$$$$$$$$$$=........&$$$$$$$$$$$$$$$$$$$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-.....-$$$$$$$$$$$$$$$$$$$$$$$$$$%........+$$$$$$$$$%==-......................................................................................", +".............+$$$$$$$$=...............+$$$$$$$$$.........%$$$$$$$$$$$$$$$$$$$$$$=.........@$$$$$$$$$$$$$$$$$$$$$$$$$$$#.......................@$$$$$$$$%.................*$$$$$$$$+.....#$$$$$$$$$$$$$$$$$$$$$$$$$$=........+$$$$$$$$$$$$&......................................................................................", +".............=$$$$$$$$+...............+$$$$$$$$$@........@$$$$$$$$$$$$$$$$$$$$$=...........-$$$$$$$$$$$$$$$$$=$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.......*$$$$$$$$$$$$$$$$*%$$$$$$$*........+$$$$$$$$$$$$+......................................................................................", +".............%$$$$$$$$#...............+$$$$$$$$$=.........#%$$$$$$$$$$$$$$$$$$+.............=$$$$$$$$$$$$$$$+=$$$$$$$=........................&$$$$$$$$-................#$$$$$$$$*.......@$$$$$$$$$$$$$$$=.$$$$$$$$$+........$$$$$$$$$$$$@......................................................................................", +".............$$$$$$$$$................@$$$$$$$$$*..........@*$$$$$$$$$$$$$$$&@...............=$$$$$$$$$$$$%@.%$$$$$$$&........................*$$$$$$$$+................-$$$$$$$$=........+$$$$$$$$$$$$%+..%$$$$$$$$*........&$$$$$$$$$$$.......................................................................................", +"............@+++++++++.................+++++++++#............#*$$$$$$$$$$%&@..................+%$$$$$$$$%-...++++++++@........................+++++++++.................#++++++++@.........@*$$$$$$$$%&@...#++++++++#.........&$$$$$$$$$=.......................................................................................", +"...............................................................@+&====&+@.......................#-====-#.....................................................................................@+====&+..........................@+=====&+@.......................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +".......................................................................................+++++++++++++++++++++++++@......................................................................#+++++++#........................#++++++++@................@++++++++#....................................................................", +".......................................................................................$$$$$$$$$$$$$$$$$$$$$$$$$$%&@...................................................................$$$$$$$$&........................*$$$$$$$$#................&$$$$$$$$&....................................................................", +"......................................................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.................................................................@$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+....................................................................", +"......................................................................................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+................................................................+$$$$$$$$........................#$$$$$$$$*.................$$$$$$$$$@....................................................................", +"......................................................................................=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...............................................................&$$$$$$$%........................-$$$$$$$$=................@$$$$$$$$$..........................................$$$$$$$$&..................", +"......................................................................................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%...............................................................=$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.........................................+$$$$$$$$+..................", +".....................................................................................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-..............................................................$$$$$$$$-........................%$$$$$$$$@................=$$$$$$$$&.........................................+$$$$$$$$@..................", +".....................................................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.............................................................#$$$$$$$$#........................$$$$$$$$$.................*$$$$$$$$+.........................................=$$$$$$$$...................", +".....................................................................................=$$$$$$$$+............+&$$$$$$$$$$$.............................................................+$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$..........................................*$$$$$$$=...................", +".....................................................................................*$$$$$$$$#..............@%$$$$$$$$$.............................................................=$$$$$$$*........................&$$$$$$$$&................#$$$$$$$$%..........................................$$$$$$$$-...................", +".....................................................................................$$$$$$$$$................#$$$$$$$$$.............................................................*$$$$$$$=........................=$$$$$$$$+................-$$$$$$$$=.........................................#$$$$$$$$+...................", +"....................................................................................#$$$$$$$$=.................*$$$$$$$%...............#++==-+#.........................@++==++......$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-..............@++-===-++.................+$$$$$$$$....................", +"....................................................................................-$$$$$$$$&.................=$$$$$$$=............+=$$$$$$$$$$=#....................-*$$$$$$$$&@..+$$$$$$$$@.......................@$$$$$$$$%.................%$$$$$$$$#...........+=$$$$$$$$$$$$*-..........#+++*$$$$$$$$++++@...............", +"....................................................................................=$$$$$$$$+.................*$$$$$$$-.........@&$$$$$$$$$$$$$$$=@................-%$$$$$$$$$$$%@.-$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$..........-%$$$$$$$$$$$$$$$$%+........$$$$$$$$$$$$$$$$$+...............", +"....................................................................................%$$$$$$$$@................@$$$$$$$$@........+%$$$$$$$$$$$$$$$$$%@.............@*$$$$$$$$$$$$$$%@=$$$$$$$=........................=$$$$$$$$-................+$$$$$$$$*........@*$$$$$$$$$$$$$$$$$$$$+......#$$$$$$$$$$$$$$$$$@...............", +"....................................................................................$$$$$$$$$.................&$$$$$$$=........=$$$$$$$$$$$$$$$$$$$$%@...........#%$$$$$$$$$$$$$$$$&%$$$$$$$&........................*$$$$$$$$#................&$$$$$$$$=.......@%$$$$$$$$$$$$$$$$$$$$$$@.....+$$$$$$$$$$$$$$$$$................", +"...................................................................................+$$$$$$$$=................#$$$$$$$$#.......=$$$$$$$$$$$$$$$$$$$$$$*..........+$$$$$$$$$$$$$$$$$$$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+.......%$$$$$$$$$$$$$$$$$$$$$$$&.....=$$$$$$$$$$$$$$$$=................", +"...................................................................................-$$$$$$$$&...............@%$$$$$$$&.......-$$$$$$$$$$$$$$$$$$$$$$$$+........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$@.......................#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@......&$$$$$$$$$$$$$$$$$$$$$$$$%.....*$$$$$$$$$$$$$$$$-................", +"...................................................................................=$$$$$$$$+..............-%$$$$$$$*.......#$$$$$$$$$%&+@@+=$$$$$$$$$*........%$$$$$$$$$%-#.+&$$$$$$$$$$$$%........................-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$......@$$$$$$$$$*++..#+*$$$$$$$$$.....++++$$$$$$$$*++++@................", +"...................................................................................$$$$$$$$$-++++++++++++=%$$$$$$$$%@.......%$$$$$$$$&.......+$$$$$$$$$#......&$$$$$$$$$&......@%$$$$$$$$$$=........................=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=......&$$$$$$$$+........%$$$$$$$$........#$$$$$$$$+.....................", +"..................................................................................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=@.......&$$$$$$$$+.........&$$$$$$$$-.....@$$$$$$$$$+........+$$$$$$$$$$-........................%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&......%$$$$$$$+.........=$$$$$$$*........+$$$$$$$$@.....................", +"..................................................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-........@$$$$$$$$=..........@$$$$$$$$=.....*$$$$$$$$-..........*$$$$$$$$$+........................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.....#$$$$$$$*..........*$$$$$$$=........=$$$$$$$$......................", +"..................................................................................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$&@.........&$$$$$$$%............%$$$$$$$=....#$$$$$$$$*...........&$$$$$$$$$........................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$......#=======+.........@$$$$$$$$+........%$$$$$$$=......................", +"..................................................................................*$$$$$$$$$$$$$$$$$$$$$$$$$$$&@..........%$$$$$$$&............=$$$$$$$=....&$$$$$$$$@...........+$$$$$$$$*........................-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%.......................@%$$$$$$$$#........$$$$$$$$&......................", +"..................................................................................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........+$$$$$$$$@............=$$$$$$$=....$$$$$$$$=............+$$$$$$$$=........................=$$$$$$$$&++++++++++++++++&$$$$$$$$=....................++=$$$$$$$$$$........+$$$$$$$$+......................", +".................................................................................#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.......=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=...+$$$$$$$$#............+$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-.............@+-=*$$$$$$$$$$$$$$*........-$$$$$$$$@......................", +".................................................................................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+......$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=...=$$$$$$$%.............+$$$$$$$$#.......................@$$$$$$$$*.................%$$$$$$$$#..........#=%$$$$$$$$$$$$$$$$$$$=........=$$$$$$$%.......................", +".................................................................................=$$$$$$$$+............+*$$$$$$$$$=.....+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...$$$$$$$$&.............+$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.........+%$$$$$$$$$$$$$$$$$$$$$$+........%$$$$$$$=.......................", +".................................................................................%$$$$$$$$@..............=$$$$$$$$=.....-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#..#$$$$$$$$+.............=$$$$$$$=........................&$$$$$$$$+................+$$$$$$$$*.......@=$$$$$$$$$$$$$$$$$$$$$$$$@........$$$$$$$$-.......................", +".................................................................................$$$$$$$$$...............@$$$$$$$$=.....=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...+$$$$$$$$#.............*$$$$$$$&........................*$$$$$$$$#................-$$$$$$$$=......@%$$$$$$$$$$$$$$*&&$$$$$$$$........+$$$$$$$$+.......................", +"................................................................................+$$$$$$$$=................$$$$$$$$&.....*$$$$$$$$=====================&...-$$$$$$$$.............@$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+......%$$$$$$$$$%=-+@...&$$$$$$$=........-$$$$$$$$........................", +"................................................................................-$$$$$$$$&...............#$$$$$$$$+.....$$$$$$$$%.........................=$$$$$$$$.............-$$$$$$$$@.......................#$$$$$$$$*.................%$$$$$$$$@.....=$$$$$$$$*#........*$$$$$$$&........=$$$$$$$*........................", +"................................................................................=$$$$$$$$+...............-$$$$$$$$+.....$$$$$$$$=.........................=$$$$$$$$.............*$$$$$$$%........................+$$$$$$$$&................@$$$$$$$$$.....#$$$$$$$$=.........@$$$$$$$$+........%$$$$$$$=........................", +"................................................................................$$$$$$$$$................=$$$$$$$$......$$$$$$$$=.........................=$$$$$$$$............#$$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.....*$$$$$$$*..........-$$$$$$$$@........$$$$$$$$+........................", +"...............................................................................@$$$$$$$$%................$$$$$$$$$......$$$$$$$$=.........................=$$$$$$$$+...........%$$$$$$$$-........................%$$$$$$$$@................&$$$$$$$$&....@$$$$$$$$#..........%$$$$$$$%........+$$$$$$$$#........................", +"...............................................................................+$$$$$$$$=...............#$$$$$$$$=......%$$$$$$$$...........@========@....&$$$$$$$$&..........=$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+....+$$$$$$$$..........-$$$$$$$$=........&$$$$$$$$.........................", +"...............................................................................&$$$$$$$$-...............&$$$$$$$$&......=$$$$$$$$-..........=$$$$$$$*.....+$$$$$$$$%@........+$$$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.....=$$$$$$$$.........@$$$$$$$$$-........=$$$$$$$=.........................", +"...............................................................................*$$$$$$$$+...............=$$$$$$$$+......+$$$$$$$$$+.......@=$$$$$$$$@.....#$$$$$$$$$=.......=$$$$$$$$$$*........................-$$$$$$$$&................@$$$$$$$$%.....=$$$$$$$$-.......#%$$$$$$$$$+........$$$$$$$$-.........................", +"...............................................................................$$$$$$$$$................$$$$$$$$$#.......$$$$$$$$$$&#...#&$$$$$$$$$-.......%$$$$$$$$$*#..@-%$$$$$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.....=$$$$$$$$$-@...+&$$$$$$$$$$$........@$$$$$$$$=.........................", +"..............................................................................#$$$$$$$$*...............@$$$$$$$$$........&$$$$$$$$$$$$$$$$$$$$$$$$=........&$$$$$$$$$$$$$$$$$$$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-.....-$$$$$$$$$$$$$$$$$$$$$$$$$$%........+$$$$$$$$$%==-.....................", +"..............................................................................+$$$$$$$$=...............+$$$$$$$$$.........%$$$$$$$$$$$$$$$$$$$$$$=.........@$$$$$$$$$$$$$$$$$$$$$$$$$$$#.......................@$$$$$$$$%.................*$$$$$$$$+.....#$$$$$$$$$$$$$$$$$$$$$$$$$$=........+$$$$$$$$$$$$&.....................", +"..............................................................................=$$$$$$$$+...............+$$$$$$$$$@........@$$$$$$$$$$$$$$$$$$$$$=...........-$$$$$$$$$$$$$$$$$=$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.......*$$$$$$$$$$$$$$$$*%$$$$$$$*........+$$$$$$$$$$$$+.....................", +"..............................................................................%$$$$$$$$#...............+$$$$$$$$$=.........#%$$$$$$$$$$$$$$$$$$+.............=$$$$$$$$$$$$$$$+=$$$$$$$=........................&$$$$$$$$-................#$$$$$$$$*.......@$$$$$$$$$$$$$$$=.$$$$$$$$$+........$$$$$$$$$$$$@.....................", +"..............................................................................$$$$$$$$$................@$$$$$$$$$*..........@*$$$$$$$$$$$$$$$&@...............=$$$$$$$$$$$$%@.%$$$$$$$&........................*$$$$$$$$+................-$$$$$$$$=........+$$$$$$$$$$$$%+..%$$$$$$$$*........&$$$$$$$$$$$......................", +".............................................................................@+++++++++.................+++++++++#............#*$$$$$$$$$$%&@..................+%$$$$$$$$%-...++++++++@........................+++++++++.................#++++++++@.........@*$$$$$$$$%&@...#++++++++#.........&$$$$$$$$$=......................", +"................................................................................................................................@+&====&+@.......................#-====-#.....................................................................................@+====&+..........................@+=====&+@......................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"...........................+++++++++++++++++++++++++@......................................................................#+++++++#........................#++++++++@................@++++++++#................................................................................................................................", +"...........................$$$$$$$$$$$$$$$$$$$$$$$$$$%&@...................................................................$$$$$$$$&........................*$$$$$$$$#................&$$$$$$$$&................................................................................................................................", +"..........................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.................................................................@$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+................................................................................................................................", +"..........................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+................................................................+$$$$$$$$........................#$$$$$$$$*.................$$$$$$$$$@................................................................................................................................", +"..........................=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...............................................................&$$$$$$$%........................-$$$$$$$$=................@$$$$$$$$$..........................................$$$$$$$$&..............................................................................", +"..........................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%...............................................................=$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.........................................+$$$$$$$$+..............................................................................", +".........................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-..............................................................$$$$$$$$-........................%$$$$$$$$@................=$$$$$$$$&.........................................+$$$$$$$$@..............................................................................", +".........................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.............................................................#$$$$$$$$#........................$$$$$$$$$.................*$$$$$$$$+.........................................=$$$$$$$$...............................................................................", +".........................=$$$$$$$$+............+&$$$$$$$$$$$.............................................................+$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$..........................................*$$$$$$$=...............................................................................", +".........................*$$$$$$$$#..............@%$$$$$$$$$.............................................................=$$$$$$$*........................&$$$$$$$$&................#$$$$$$$$%..........................................$$$$$$$$-...............................................................................", +".........................$$$$$$$$$................#$$$$$$$$$.............................................................*$$$$$$$=........................=$$$$$$$$+................-$$$$$$$$=.........................................#$$$$$$$$+...............................................................................", +"........................#$$$$$$$$=.................*$$$$$$$%...............#++==-+#.........................@++==++......$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-..............@++-===-++.................+$$$$$$$$................................................................................", +"........................-$$$$$$$$&.................=$$$$$$$=............+=$$$$$$$$$$=#....................-*$$$$$$$$&@..+$$$$$$$$@.......................@$$$$$$$$%.................%$$$$$$$$#...........+=$$$$$$$$$$$$*-..........#+++*$$$$$$$$++++@...........................................................................", +"........................=$$$$$$$$+.................*$$$$$$$-.........@&$$$$$$$$$$$$$$$=@................-%$$$$$$$$$$$%@.-$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$..........-%$$$$$$$$$$$$$$$$%+........$$$$$$$$$$$$$$$$$+...........................................................................", +"........................%$$$$$$$$@................@$$$$$$$$@........+%$$$$$$$$$$$$$$$$$%@.............@*$$$$$$$$$$$$$$%@=$$$$$$$=........................=$$$$$$$$-................+$$$$$$$$*........@*$$$$$$$$$$$$$$$$$$$$+......#$$$$$$$$$$$$$$$$$@...........................................................................", +"........................$$$$$$$$$.................&$$$$$$$=........=$$$$$$$$$$$$$$$$$$$$%@...........#%$$$$$$$$$$$$$$$$&%$$$$$$$&........................*$$$$$$$$#................&$$$$$$$$=.......@%$$$$$$$$$$$$$$$$$$$$$$@.....+$$$$$$$$$$$$$$$$$............................................................................", +".......................+$$$$$$$$=................#$$$$$$$$#.......=$$$$$$$$$$$$$$$$$$$$$$*..........+$$$$$$$$$$$$$$$$$$$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+.......%$$$$$$$$$$$$$$$$$$$$$$$&.....=$$$$$$$$$$$$$$$$=............................................................................", +".......................-$$$$$$$$&...............@%$$$$$$$&.......-$$$$$$$$$$$$$$$$$$$$$$$$+........@$$$$$$$$$$$$$$$$$$$$$$$$$$$$@.......................#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@......&$$$$$$$$$$$$$$$$$$$$$$$$%.....*$$$$$$$$$$$$$$$$-............................................................................", +".......................=$$$$$$$$+..............-%$$$$$$$*.......#$$$$$$$$$%&+@@+=$$$$$$$$$*........%$$$$$$$$$%-#.+&$$$$$$$$$$$$%........................-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$......@$$$$$$$$$*++..#+*$$$$$$$$$.....++++$$$$$$$$*++++@............................................................................", +".......................$$$$$$$$$-++++++++++++=%$$$$$$$$%@.......%$$$$$$$$&.......+$$$$$$$$$#......&$$$$$$$$$&......@%$$$$$$$$$$=........................=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=......&$$$$$$$$+........%$$$$$$$$........#$$$$$$$$+.................................................................................", +"......................@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=@.......&$$$$$$$$+.........&$$$$$$$$-.....@$$$$$$$$$+........+$$$$$$$$$$-........................%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&......%$$$$$$$+.........=$$$$$$$*........+$$$$$$$$@.................................................................................", +"......................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-........@$$$$$$$$=..........@$$$$$$$$=.....*$$$$$$$$-..........*$$$$$$$$$+........................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+.....#$$$$$$$*..........*$$$$$$$=........=$$$$$$$$..................................................................................", +"......................&$$$$$$$$$$$$$$$$$$$$$$$$$$$$&@.........&$$$$$$$%............%$$$$$$$=....#$$$$$$$$*...........&$$$$$$$$$........................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$......#=======+.........@$$$$$$$$+........%$$$$$$$=..................................................................................", +"......................*$$$$$$$$$$$$$$$$$$$$$$$$$$$&@..........%$$$$$$$&............=$$$$$$$=....&$$$$$$$$@...........+$$$$$$$$*........................-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%.......................@%$$$$$$$$#........$$$$$$$$&..................................................................................", +"......................$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&........+$$$$$$$$@............=$$$$$$$=....$$$$$$$$=............+$$$$$$$$=........................=$$$$$$$$&++++++++++++++++&$$$$$$$$=....................++=$$$$$$$$$$........+$$$$$$$$+..................................................................................", +".....................#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=.......=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=...+$$$$$$$$#............+$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-.............@+-=*$$$$$$$$$$$$$$*........-$$$$$$$$@..................................................................................", +".....................+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+......$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=...=$$$$$$$%.............+$$$$$$$$#.......................@$$$$$$$$*.................%$$$$$$$$#..........#=%$$$$$$$$$$$$$$$$$$$=........=$$$$$$$%...................................................................................", +".....................=$$$$$$$$+............+*$$$$$$$$$=.....+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+...$$$$$$$$&.............+$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.........+%$$$$$$$$$$$$$$$$$$$$$$+........%$$$$$$$=...................................................................................", +".....................%$$$$$$$$@..............=$$$$$$$$=.....-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#..#$$$$$$$$+.............=$$$$$$$=........................&$$$$$$$$+................+$$$$$$$$*.......@=$$$$$$$$$$$$$$$$$$$$$$$$@........$$$$$$$$-...................................................................................", +".....................$$$$$$$$$...............@$$$$$$$$=.....=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$...+$$$$$$$$#.............*$$$$$$$&........................*$$$$$$$$#................-$$$$$$$$=......@%$$$$$$$$$$$$$$*&&$$$$$$$$........+$$$$$$$$+...................................................................................", +"....................+$$$$$$$$=................$$$$$$$$&.....*$$$$$$$$=====================&...-$$$$$$$$.............@$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+......%$$$$$$$$$%=-+@...&$$$$$$$=........-$$$$$$$$....................................................................................", +"....................-$$$$$$$$&...............#$$$$$$$$+.....$$$$$$$$%.........................=$$$$$$$$.............-$$$$$$$$@.......................#$$$$$$$$*.................%$$$$$$$$@.....=$$$$$$$$*#........*$$$$$$$&........=$$$$$$$*....................................................................................", +"....................=$$$$$$$$+...............-$$$$$$$$+.....$$$$$$$$=.........................=$$$$$$$$.............*$$$$$$$%........................+$$$$$$$$&................@$$$$$$$$$.....#$$$$$$$$=.........@$$$$$$$$+........%$$$$$$$=....................................................................................", +"....................$$$$$$$$$................=$$$$$$$$......$$$$$$$$=.........................=$$$$$$$$............#$$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.....*$$$$$$$*..........-$$$$$$$$@........$$$$$$$$+....................................................................................", +"...................@$$$$$$$$%................$$$$$$$$$......$$$$$$$$=.........................=$$$$$$$$+...........%$$$$$$$$-........................%$$$$$$$$@................&$$$$$$$$&....@$$$$$$$$#..........%$$$$$$$%........+$$$$$$$$#....................................................................................", +"...................+$$$$$$$$=...............#$$$$$$$$=......%$$$$$$$$...........@========@....&$$$$$$$$&..........=$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$+....+$$$$$$$$..........-$$$$$$$$=........&$$$$$$$$.....................................................................................", +"...................&$$$$$$$$-...............&$$$$$$$$&......=$$$$$$$$-..........=$$$$$$$*.....+$$$$$$$$%@........+$$$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.....=$$$$$$$$.........@$$$$$$$$$-........=$$$$$$$=.....................................................................................", +"...................*$$$$$$$$+...............=$$$$$$$$+......+$$$$$$$$$+.......@=$$$$$$$$@.....#$$$$$$$$$=.......=$$$$$$$$$$*........................-$$$$$$$$&................@$$$$$$$$%.....=$$$$$$$$-.......#%$$$$$$$$$+........$$$$$$$$-.....................................................................................", +"...................$$$$$$$$$................$$$$$$$$$#.......$$$$$$$$$$&#...#&$$$$$$$$$-.......%$$$$$$$$$*#..@-%$$$$$$$$$$$=........................=$$$$$$$$+................+$$$$$$$$=.....=$$$$$$$$$-@...+&$$$$$$$$$$$........@$$$$$$$$=.....................................................................................", +"..................#$$$$$$$$*...............@$$$$$$$$$........&$$$$$$$$$$$$$$$$$$$$$$$$=........&$$$$$$$$$$$$$$$$$$$$$$$$$$$+........................$$$$$$$$$.................=$$$$$$$$-.....-$$$$$$$$$$$$$$$$$$$$$$$$$$%........+$$$$$$$$$%==-.................................................................................", +"..................+$$$$$$$$=...............+$$$$$$$$$.........%$$$$$$$$$$$$$$$$$$$$$$=.........@$$$$$$$$$$$$$$$$$$$$$$$$$$$#.......................@$$$$$$$$%.................*$$$$$$$$+.....#$$$$$$$$$$$$$$$$$$$$$$$$$$=........+$$$$$$$$$$$$&.................................................................................", +"..................=$$$$$$$$+...............+$$$$$$$$$@........@$$$$$$$$$$$$$$$$$$$$$=...........-$$$$$$$$$$$$$$$$$=$$$$$$$$........................+$$$$$$$$=.................$$$$$$$$$.......*$$$$$$$$$$$$$$$$*%$$$$$$$*........+$$$$$$$$$$$$+.................................................................................", +"..................%$$$$$$$$#...............+$$$$$$$$$=.........#%$$$$$$$$$$$$$$$$$$+.............=$$$$$$$$$$$$$$$+=$$$$$$$=........................&$$$$$$$$-................#$$$$$$$$*.......@$$$$$$$$$$$$$$$=.$$$$$$$$$+........$$$$$$$$$$$$@.................................................................................", +"..................$$$$$$$$$................@$$$$$$$$$*..........@*$$$$$$$$$$$$$$$&@...............=$$$$$$$$$$$$%@.%$$$$$$$&........................*$$$$$$$$+................-$$$$$$$$=........+$$$$$$$$$$$$%+..%$$$$$$$$*........&$$$$$$$$$$$..................................................................................", +".................@+++++++++.................+++++++++#............#*$$$$$$$$$$%&@..................+%$$$$$$$$%-...++++++++@........................+++++++++.................#++++++++@.........@*$$$$$$$$%&@...#++++++++#.........&$$$$$$$$$=..................................................................................", +"....................................................................@+&====&+@.......................#-====-#.....................................................................................@+====&+..........................@+=====&+@..................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................"}; diff --git a/packages/hal/arm/sa11x0/cerfpda/current/misc/redhat2.xpm b/packages/hal/arm/sa11x0/cerfpda/current/misc/redhat2.xpm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/misc/redhat2.xpm @@ -0,0 +1,260 @@ +/* XPM */ +static char * redhat2_xpm[] = { +"320 240 17 1", +" c None", +". c #020204", +"+ c #939192", +"@ c #4A4849", +"# c #810404", +"$ c #2A272A", +"% c #726F72", +"& c #D1D0D1", +"* c #4D0304", +"= c #B2B0B1", +"- c #8E3A34", +"; c #FAF9F8", +"> c #C90204", +", c #8C797D", +"' c #3C383B", +") c #1A1919", +"! c #5B585B", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................$$@@!%%,,,,,,,,,,,%!!@'').......................................................................................................................................................................................................................................................................", +"..............................))'%,+=&&;;;;;;;;;;;&==+,%')).....................................................................................................................................................................................................................................................................", +"..........................))'!%++======&==+==+===&=======,%!'$..................................................................................................................................................................................................................................................................", +"..........................$@,&&;;;&==+,%!@@'@@'@!,+==&;;;;&=,@$.................................................................................................................................................................................................................................................................", +"......................))'!,======+%%!!@'$$)$$)$$'@@@!!%++=&&=+,!')..............................................................................................................................................................................................................................................................", +"......................)@,&&;&&+%'))...................)$'%+&;;;=%$).............................................................................................................................................................................................................................................................", +"....................$!%=====%!@$$.......................$'@!++===+%@$...........................................................................................................................................................................................................................................................", +"..................))!+&;&=,@$...............................$@,&&;&=@...........................................................................................................................................................................................................................................................", +".................)@%+&==+%'$)...............................))@!+==&+%'.........................................................................................................................................................................................................................................................", +"................)$,&&;=%'.......................................'%=;&&%)).......................................................................................................................................................................................................................................................", +"...............)!+=&=+!')........*******..)..*********..........)'!+=&+%@)......................................................................................................................................)..)..)..)......................................................................................................", +"..............)$+;&&,').........*#######*)))*#########*)).........)$%&&&,$)...................................................................................................................................))))))))))))).....................................................................................................", +".............)!+=&=%@)........**##>#>#>######>##**********.........)@%+&=,@...................................................................................................................................)'!%%%!@'')).*....................................................................................................", +"............)$+;&&%)..........#>>>>>>>>>>>>>>>>#*.....*###*.........))%&&&,))...............................................................................................................................))'@+&&&++!@'))......*..*...........................................................................................", +"............@,=&=%@).........*#>>>>>>>>>>>>>>>>##*....*##>*...........@%=&=%'.................................................................................................................................$@+&&;&==+,!$).....).).)..........................................................................................", +"..........))%&&&%)..........*#>>>>>>>>>>>>>>>>>>##*...*##>*...........))%&&&%.................................................................................................................................'!=;;;;;;;&+!)).*.*)))))).........................................................................................", +"..........'%+&=,@)..........*##>#>>>>>>>>>>>>>>>>#****##>>#*............@%=&+@$...............................................................................................................................'!=;;;;;;;&=!..*.)'!!!')*.........................................................................................", +"..........!&&;+$)...........*#####>>>>>>>>>>>>>>>#####>>>>>#*...........)$+;&+@.............................................................................................................................))$@+;;;;;;;&&%...))!===!).*........................................................................................", +"........)),&=+!)............*>##***#####*##>>>>>>#>#>#>>>>>#*............)!==&%$)............................................................................................................................)$!=;;;;;;;&&!)...)%&&&,@$).............................................................*).........................", +"........)@=;=@$.............*>>#*....)....*#>>>>>>>>>>>>>>>>#.............$%=;='$.............................................................................................................................$@=;;;;;;;&&%))...%;;;=%')).........................................................*.))))).......................", +"........@+=&,)).............*>##*....).).**##>>>>>>>>>>>>>>>#*............)'+&=,'............................................................................................................................)$!+;;;;;;;&&!....*,;;;=%'*.........................................................))$@!!'$*......................", +"........%&&&!...............#>>#*.....))*###>>>>>>>>>>>>>>>>>#*.............!=&=!...........................................................................................................................))'@=;;;;;;;&&%...)),&;;=%'*.........................................................)'!,=+%'.......................", +"......)'+;=%'...............#>>##*****###>#>>>>>>>>>>>>>>>>>>#*.............'%=&+))..........................................................................................................................)$!=;;;;;;;&&!)...),;;;=%'.........................................)................)@+=&=,@)......................", +"......'!=;+$).............))*>>>####>>>>>>>>>>>>>>>>>>>>>>>>>>#.............)'+;+@$................................................*.*..*.*..*.*..*.*............*.*..*.*..............................*..*..*$@=;;;;;;;&&%))...,&;;=%@))*.*.*..*.*....................*..*.*.))))).*........*.*.*%&;;&=!)$)).*.................", +"......@+=&%)........******))#>>>>#>#>>>>>>>>>>>>>>>>>>>>>>>>>>*..............),&=,'.............................................)*.).).).).)).).)).)...........*).).)).).)..........................)..).).)).'!+;;;;;;;&&!....),;;;=%@)).).).)).).)...................).).).)))))).)........).).)%&;;&+!)))).).................", +"......%&=+!.......))*#####*)#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#)).............%=&=!..........................................*)))))))))))))))))))))))*......*.))))))))))))).*...................*.))))))))))))'@=;;;;;;;&&%..*.)+&;;=%@)))))))))))))).*.............*.*)))))))))))))))).....)))))),&;;&+!))))))))...............", +".....),;=%'....***#*##>#>##)**#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#*..............',=&,)..........................................)'@@@@@@$$))))'@!%!%@$)......).)$'@!!%%%%!!!'$$..................))$'!!%%%%!!@$)'!+;;;;;;;&&!)...),;;;=%'))))$'@@!@@@')).)...........).)))$''@@!@!@'$$)))*...*.)$$$),;;;&+!))$$$$$)...............", +"....)'+;+@$...*#>>>>>>>>>>#)).*#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#*.............$@=;+')........................................*$!%%%%%%@$)))$!,====,@')).*.*)))'!,+===&=&=+,!')).*.............*)$@%+======+,@)'!=;;;;;;;&&%))...,&;;=%@)))$'!,,+,,%!'))))........*.)))))'!%,,++,,!@$)))))..*)$$@$),&;;&=!)$'''''$)).............", +"....$!=;+))...*#>>>>>>>>>>#*...***#>>#>>>>>>>>>>>>>>>>>>>>>>>>>#*.............))+;+!$.........................................!+======,!'$@,+&&&&&=!'*.).))'@%+==&&&&;&&&&==,%').*..........))'!,+=&&&;&&&&=+,%!=;;;;;;;&&!....),;;;=%@)'%,+==&&=&=+,%@'*........)))'@%%+===&=&===+,!@$)*.).'%,++,=;;;&&+,++++++@...............", +"....@,=;%.....#>>>>>>>>>>>>#*.....*###>>>>>>>>>>>>>>>>>>>>>>>>##*...............%;=%'........................................*%&;;;;;;=,@$,&;;;;;;&,@.))))'@,&&;;;;;;;;;;;;;&=%$).........))))%=&;;;;;;;;;;;;&=%=;;;;;;;&&%....),&;;=%@)!=&;;;;;;;;;&&,!$.*......)))!+=&&;;;;;;;;;;&=%'..*))%=&;;;;;;;;;;;&;;;;&%...............", +"....@+=&%.....*>>>>>>>>>>>>#*......****####>>>>>>>>>>>>>>>>>>>>#******..........%&=+@.........................................%&;;;;;;&+,,=;;;;;;;=+@*))$'%+&&;;;;;;;;;;;;;;;&=,@..........$@,=&&;;;;;;;;;;;;;&=&;;;;;;;&&!)...),;;;=%%%=&&;&;&;&;;;;&=+%$)*......$@,&&;;;&;&&;&;;;;&=,'$).)!=&;&&;;;;;;&;;&;&;&,...............", +"....%=&=!.....#>>>>>>>>>>>>>#))...........*#>>>>>>>>>>>>>>>>>>########*.........!===!.........................................%&;;;;;;&+=&&;;;;;;;=,@)))@!=;;;;;;;;;;;;;;;;;;;;&,)).......)',&;;;;;;;;;;;;;;;;;;;;;;;;;;&&%)....,&;;=!+&;;;;&&&&&&&;;;;;+@$))*....'%=;;;;&&&&=&&&&;;;;=%@).*!=&;;;;;;;;;&;&;;;;&%...............", +"....%&&+!.....*>>>>>>>>>>>>>>***...........*##>>>>>>>>>>>>>>>>>##>#>#>#**.......!==&%.........................................,&;;;;;;&=&;;;;;;;;;&,!))$%=&;;;;;;;;;;;;;;;;;;;;;=%'*......@,=;;;;;;;;;;;;;;;;;;;;;;;;;;;&&%.....,;;;&=&;&&=+,%!!%%+=&;;;=+@)......$!=&&=+,%!!!!%,,=&;;&=!)..'%%,,%=;;;&&=%,,,+,+'...............", +"....,;&,@.....*#>>>>>>>>>>>>>>>#*...........*#>>>>>>>>>>>>>>>>>##>>>>>>>*.......'+=&%.........................................%&;;;;;;;;;;;;;;;;;;=+@)$@+&;;;;;;;;;;&&;;;;;;;;;;&&!.....*.%&&;;;;;;;;;;;;;;;;;;;;;;;;;;;&&!...)),;&;;&;;&=%)).....'!=&;;;&%......*$@,&+%'.......)),&&;;;%*...)$$).,&;;&+!.)$$$$$)...............", +"...)+;=!'......*##>>>>>>>>>>>>>###****.......*#>>>>>>>>>>>>>>>>#>>>>>>>>##*.....'!=;%.........................................%&;;;;;;;;;;;;;;;;;;=,@)@+&;;;;;;;&=+,%%%+=;;;;;;;;&,')).*$@+;;;;;;;;;;;&&=&&&;;;;;;;;;;;;&&%....)%;;;;;&&+!')......)$%=&;;&+'$.....)$@!!')........)'%=;;;+'$..).)..,&;;&+!*).))).................", +"..)'+;='$.......*#>>>>>>>>>>>>>>>>####*.......#>>>>>>>>>>>>>>>>>>>>>>>>>>>*.....$'=;,.........................................%&;;;;;;;;;;;;;;;;&;=%@)%&;;;;;;;;&,@)).)',&;;;;;;;;=!')).@,&;;;;;;;;;&&=,,%,==;;;;;;;;;;;&&%))...,&;;;;&+!...........$!=;;;=%@)).....................,&;;&,'*......,&;;&+!)......................", +"..)'+;='$........*#>>>>>>>>>>>>>>>>>#>#*****..*>>>>>>>>>>>>>>>>>>>>>>>>>>>#*....$@+;+)........................................%&&;;;;;;;;;;;&=++++%'''+&;;;;;;&=,'$...))@%=;;;;;;;&,@.*)%=&;;;;;;;;&=%!@''@!,+&;;;;;;;;;;=%....),;;;;;+!$...........)',;;;&,@......................*%&;;&+!.......%;;;&+!.......................", +"..$@=;+@$.........*#>>>>>>>>>>>>>>>>>>>>>###*)*#>>>>>>>>>>>>>>>>>>>>>>>>>>>#*...)@=;+$).......................................%&;;;;;;;;;;&&+!@$''$.'%=;;;;;;;=,@..*..*..),;;;;;;;&=!..),;;;;;;;;;&=!.......'!+;;;;;;;;;&&!...)),&;;;&%...............%&&;&=!.............*.*.*.*.))%&&;&=!.......%&;;&+@.......................", +"..)@+;+')..........**>>>>>>>>>>>>>>>>>>>>#>>####>>>>>>>>>>>>>>>>>>>>>>>>>>>#*...$'=;+@).......................................%&&;;;;;;;;;=%!'$)))).@+&;;;;;;;+@$)).)).)))%&;;;;;;;&%)$'+;;;;;;;;;=%'.......)$,=;;;;;;;;&&%....),;;;&=!...............!=;;;=%)...........).).).).)))!=&;;&%.......%;;;&+!)......................", +"..$@=;+$)...........*#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>##*...$'=;+@$.......................................%&;;;;;;;;;&%.........!&&;;;;;;&,)))))))))))!=&;;;;;;;,)'@=;;;;;;;;;,)).........@+&;;;;;;;&&%))...,&;;&+!)).............!+&;;&%)..........*)))))))))))!+&;&&%.......%&;;&+!)......................", +"..)@+;+')............**##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#*....$@+;=').......................................%&&;;;;;;;&=@.........%&;;;;;;;&=!!!!!!!!!!!+=;;;;;;;&,)@%=;;;;;;;;&%..........)'%=;;;;;;;&&!)...),;;;=,@...............@+&;;&%)........)))))$'@@!!!!%+=&;;&%.......%;;;&+!.......................", +"..$@=;+$)...............*#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#.....)@=;=@$.......................................%&;;;;;;;;=%'........*%;;;;;;;;&==+===========;;;;;;;;+)!+&;;;;;;;&=!..........)'!=;;;;;;;&&!..*.)+&;;=%'..............*@,=;;;%........)))))$'!%,+==+==&;;;&%.......%&;;&+@.......................", +"..)@+;=')................*##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#*.....$'+;+').......................................%&;;;;;;;;=@$).......),;;;;;;;;;&&&&&&&&&&&&&;;;;;;;;;,)!=&;;;;;;;&+!..........)'!=;;;;;;;;=%)...),;;;=%'...............'+=;;&%.......))$'!%,+===&&&&&&;;;&&%.......%&;;&+!.......................", +"..$@=;+@$.................*#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#*.....$@=;+$).......................................!&;;;;;;;;+'$)......)$,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+)%=&;;;;;;;&,!)).........$@=;;;;;;;&&%))...%&;;=%@)).............',=;;;,......*.)'%+&&;;;;;;;;;;;;;;&%.......,&;;&+!)).....................", +"..)'+;=')..............)@%,,-##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>**......$'=;+)........................................%&&;;;;;;;+'$)......)'+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,)%=;;;;;;;;=%'...........'!+;;;;;;;&&!....),;;;=%'...............@,&;;&,......)'%,=&&;;&;&&&&&&&&;;&&%.......%;;;&+!.......................", +"..)'+;=@$.............)',;&&%)*###>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>##*.......)@+;,.........................................%&;;;;;;;;+')......*$@=;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+)%&&;;;;;;;=!$.........))'@=;;;;;;;&&%..*))+&;;=%'...............',=;;;%.....))!=&;;;;;&&&===++=&&;;&%.......%&;;&+@.......................", +"...)+;=!$.............$!=;;&=%'*****#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#*........'%=;,.........................................%&;;;;;;;;+').......$@+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%)%=;;;;;;;;=!'...........'@=;;;;;;;&&!)....,;;;=%@...............@,=;;&,....*$%+&;;&&=+,%%!!@@@%=&;;&!.......%&;;&+!.......................", +"....,;=%'.............@,=;;;&=!.....*#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>##*.........',=;%.........................................!&;;;;;;;;+'$)).....)@+;;;;;;;;;;;&;&;;;;;;;;;;;;;;;;&,)%&&;;;;;;;=,'...........$!+;;;;;;;&&%))...,&;;=%@)).............'+=;;&,.*.*.!=&;;;&+!)).......@+&;&&%.......,&;;&+!)).....................", +"....%;=,@.............$!=;;;;&=!%%@))**####>>>>>>>>>>>>>>>>>>>>>>>##**..........@+=&%.........................................%&&;;;;;;;,').......))+;;;;;;;;&=%,,++++++++++++++++++!)!=&;;;;;;;&+@...........'!=;;;;;;;&&!....),;;;=%'...............',=;;;%..))',&;;&=+@')........!+&;;&%.......%;;;&+!.......................", +"....!&=+@.............)$+;;;;;;&&;+$).....*###>>>>>>>>>>>>>>>>####*.............!+==!.........................................%&;;;;;;;;+').........%;;;;;;;&=!.))$'@@!!@!@@@!@!!@@'$)!=&;;;;;;;&=!.........))'!=;;;;;;;&&%..*))+&;;=%'...............@,&;&;%*))'!=;;;=%'.........))@+&;;&%.......%&;;&+@.......................", +"....!==&!.))''@'@@!!')))!+&;;;;&;;=+@).....*****############*#****..............!&=+@.........................................%&;;;;;;;;+'$.........%;;;;;;;;&,..))))$$$$$$$$$$$$$))).!+&;;;;;;;&&%..........)@,=;;;;;;;&&!)....,;;;=%'...............@%=;;&,..)@+&;;&+@)..........)@+&;&&%.......%;;;&+!.......................", +"....!+&&%.)@!+,,++==%$).$@+;;;;;;;;;+').............))))))......................%&=%'.........................................!&;;;;;;;;+$$)).......%&;;;;;;;;,.*.......*.*.*.........',=;;;;;;;;&%*.*..*.*.)$!+&;;;;;;;&&%))...,&;;=%@)).............',&;;;%*.*!=&;;&%.............@+&;;&%.......%&;;&+!)).....................", +"....'%=;,$@%+&=&&&&&&+@))$!+&;;;;;;;=+%'')$)$)''@'')'@@@@'''$).................),;+!$.........................................%&&;;;;;;;+').........!&&;;;;;;;=!'..)..).).).).).......$@=;;;;;;;;;=@$.*.).).$',&&;;;;;;;&&!...).,;;;=%'...............@,=;;&,..)%&&;&&%*..........))!=&;;&!.......%;;;&+!.......................", +"....$'=;=@%+&;;;;;;;;;+$).$@=;;;;;;;;;=,!@@@@@!,+,!@!%%+!'!%@$)...............)'+;+$).........................................%&;;;;;;;;+').........@=&;;;;;;;&&!*)))))))))))))))......),;;;;;;;;;&=!.))))))$!+;;;;;;;;;;=%...))+&;;=%'...............',=;;;%*.)%&;;&=!........*))))%=&;&&%.......%&;;&+!.......................", +"....))+;===&;;;;;;;;;;&+%!%,&;;;;;;;;;&&=+=+=+=&=&=====&====%)................$%=&+)..........................................%&&;;;;;;;+'$.........$!=;;;;;;;;&=%!!@''''''@@!!,!@$....)%&;;;;;;;;;&+%!@@@!!,=&;;;;;;;;;&&!.....,;;;=%@...............@,=;;&%..)!&&;;=%).........))$,&;;;&%.......,&;;&+!*......................", +"......%&;;;;;;;;;;;;;;;;&&=&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,.................@+=&!...........................................%&;;;;;;;;+$$)).......)),;;;;;;;;;;&=+,%!!!!!%,+=&=+!.....!&&;;;;;;;;;&&=,,%+=&&;;;;;;;;;;&&%.....,&;;=%@)).............'+=;;;%*..!&;;&&%).*.*.*.*)))'+;;;;&%.......%&;;&+!)).*...................", +"......!=&;;;;;;;;;;;;;;;;&;&;;;;;;;;;;;;;;;;;;&&&&&&&;;;;;;&%................)%&=+!...........................................%&;;;;;;;;+')..........)!=&;;;;;;;;;&&===+=====&&;&=!.....'%=;;;;;;;;;;&&&==&&&;;;;;;;;;;;;&!.....,;;;=%'...............',=;;&%...!=&;;&+')).).).).)!,=;;;&&%.......%&&;&=%)).)...................", +"......@,&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;=,======;;;;;=!...............)'+;=!'...........................................%&;;;;;;;;+')...........@,&;;;;;;;;;;;;;;;;;;;;;;;;&%.....$'+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&%.....,&;;=%'...............'+=;;;%..*!+&;;;+@'))))))))),&;;;;;&%.......!=;;&&%)))))).................", +"......$@=;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&=!!!!@+&&;;;&=!...............'!=;+')...........................................,&;;;;;;;;+$)...........)@,&&;;;;;;;;;;;;;;;;;;;;;;&,.....))!=&;;;;;;;;;;;;;;;;;;;;&;;;;;;;&%.....,;;;=%'...............@,=;;&,...$!=;;;&+,@@''@@%%+=;&;;;;&%.......@+&;;&=!@@@@@'$...............", +".......),;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&,')...!&&;;;&+@...............@==&%.............................................%&;;;;;;;;+').............!+&;;;;;;;;;;;;;;;;;;;;;;;,.......'%=;;;;;;;;;;;;;;;;;;&&&;;;;;;;&%*....%;;;=,'...............'+=;;;%*....%&;;;;=+,!!%++&;;;&&&;;;%.......'%=;;;&=+%,,,,'...............", +".......)!=&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&+,%%%=&;;;;=%'...)'''@'@'@''',&=+@.............................................%&;;;;;;;;+').............$@,=&;;;;;;;;;;;;;;;;;;;;&,)......)'%=&;;;;;;;;;;;;;;;=+==&;;;;;&&%.....%;;;=%'...............',=;;&%.....!+&;;;&&====&&&;&&+!=;;&%.......)'+&;;&&&==&==!...............", +"........'%=;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&;;;;;;+$)...$%%,,+,,,+%%=;=@$.............................................%&;;;;;;;;+$)...............'%+&;;;;;;;;;;;;;;;;;;;&%$).......'%=&;;;;;;;;;;;;;&,$%=&;;;;;;&%.....%&;;=%'...............',=;;;%.....$!+&;;;;;;;;;;;;&=!.%;;;%.........!&&;;;;;;;;&%...............", +"........)'+&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&=%)..)$!==&=&=&=&=&&&,)).............................................!+=&&&&===%$)...............)'@%+=&&&;&;&;&;&&&&=+,%')........)'@%+&&&;;;&;&&=+%')@,=&&&&&=+!.....!===+@$...............$!+&==@.....)$!+=&&;&;;&;&==%@$.!===!.........'%+&&;&;;&&&!...............", +"..........!&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;=!'...)@+;;;;;;;;;;;;=!...............................................'%,+++++++@)....................'!+===&&&&&=&=++%!$...............@++&=&&&&=+,'...$@%++++++%'.....@,++!$)...............)'!+,,'.......)'!==&&&&&==%@$...@+,,@..........)!+=&&&&&=+@...............", +"..........'%=;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&+'$)'%,=&;;;;;;;;;;;=%'...............................................)'@@@@@!@'$)....................)''!!%!%!%!%!!!@'$)...............$'!!%%%!%!!')...)$'@@'@@@').....)''@')................))'@@')........)'@!%%%%%!!@$)...)@@'$..........)$@!%%%%%!@$...............", +"..........)'+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;=!.)$,&&;;;;;;;;;;;;;,)..................................................................................................................................................................................................................................................", +"...........)!+&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;=%@.@+=;;;;;;;;;;;;;=+@)..................................................................................................................................................................................................................................................", +"............)$+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+'$),;;;;;;;;;;;;;;;+$)...................................................................................................................................................................................................................................................", +".............)%=&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&+!%+=;;;;;;;;;;;;;&+@)....................................................................................................................................................................................................................................................", +"..............'%=;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&==+&;;;;;;;;;;;;;;;+$).....................................................................................................................................................................................................................................................", +"..............)'%+&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&;;;;;;;;;;;;;=+@)......................................................................................................................................................................................................................................................", +"................)$+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+$).......................................................................................................................................................................................................................................................", +".................)@+=;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&=,@)).......................................................................................................................................................................................................................................................", +"..................)'%&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&=%)..........................................................................................................................................................................................................................................................", +"...................)'!+=&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&=+%')..........................................................................................................................................................................................................................................................", +"......................'%=;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;=%$.............................................................................................................................................................................................................................................................", +"......................)'!,=&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&==,!').............................................................................................................................................................................................................................................................", +"........................))@,=&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&=%@)................................................................................................................................................................................................................................................................", +"..........................$@!%+==&&;;;;;;;;;;;;;;;;;;;&&=+,%@'))................................................................................................................................................................................................................................................................", +"..............................)@%+=&;;;;;;;;;;;;;;;;&&=+%').....................................................................................................................................................................................................................................................................", +"..............................)$'@!!%,++===+====+++,,%!!$)......................................................................................................................................................................................................................................................................", +"......................................)$''@@'''@'').............................................................................................................................................................................................................................................................................", +".......................................))$)$$$$$))..............................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................"}; diff --git a/packages/hal/arm/sa11x0/cerfpda/current/src/banner.xpm b/packages/hal/arm/sa11x0/cerfpda/current/src/banner.xpm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/src/banner.xpm @@ -0,0 +1,74 @@ +/* XPM */ +static char * banner_xpm[] = { +"320 54 17 1", +" c None", +". c #030305", +"+ c #949394", +"@ c #CFC9CD", +"# c #525052", +"$ c #B7B6B8", +"% c #E2515E", +"& c #FDFDFB", +"* c #737073", +"= c #820204", +"- c #E33533", +"; c #343232", +"> c #E895AE", +", c #E51604", +"' c #E67284", +") c #EABAD4", +"! c #D8D7D9", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"..............*+@&&&&&&$+*..................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+#;;...................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--%>&&&&&&&&&&&&&&&&&&&&&&&&", +"...........#$&&@+*##;#++@&&$#...............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&&&&", +".........#$&$*...........;#!&$;.............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&+..........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,>&&&&&&&&&&&&&&&&&&&&", +"........+&$#................#$&+............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&", +"......;!&*....................*&@...........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&#............................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&", +".....;!@;.....====;.=====......;!@;....................................................................;.;..................................................................&&&&&&&&&&&&&&&&&&&&&&&&+...............;;;;..........................&&&&&&,,,,,,,,,,,,,,,---,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,>&&&&&&&&&&&&&&&&&", +"....;&@......,,=,,=,,=...==......!!.................................................................;#!$*#..................................................................&&&&&&&&&&&&&&&&&&&&&&&!.............#+&&&&&&@*...................;***&&&&&&,,,,,,,,,,,,')&&&&&&>-,,,,,,,,,,,,,,%>!&&)>'-,,,,,,,,,,&&&&&&&&&&&&&&&&&", +"....@@;.....=,,,,,,=,,=..=,.......!!.................................................................#&&&&+;...;............................................................&&&&&&&&&&&&&&&&&&&&&&&#...........;@&&&&&&&&&&&+...............*&&&&&&&&&&&,,,,,,,,,,'&&&&&&&&&&&)-,,,,,,,,,,-)&&&&&&&&&)-,,,,,,,,'&&&&&&&&&&&&&&&&", +"...$&;......====,=,,,====,==......;!+................................................................#&&&&@..;>+;...........................................................&&&&&&&&&&&&&&&&&&&&&&&...........*&&&&&&&&&&&&&&$............#&&&&&&&&&&&&&,,,,,,,,,)&&&&&&&&&&&&&&%,,,,,,,,-&&&&&&&&&&&&%,,,,,,,,,&&&&&&&&&&&&&&&&", +"..#&;.......,=.....=,,,,,,,,.......*&#...............................................................#&&&&@...&&*...............................;...........................&&&&&&&&&&&&&&&&&&&&&&+..........+&&&&&&&&&&&&&&&&@..........#&&&&&&&&&&&&&&,,,,,,,,)&&&&&&&&&&&&&&&&',,,,,,,)&&&&&&&&&&&!,,,,,,,,,,>&&&&&&&&&&&&&&&", +"..!$........,=...;==,=,=,=,==.......$$..............................................................;#&&&&@...&&*..............................#$*..........................&&&&&&&&&&&&&&&&&&&&&&#.........#&&&&&&&&&&&&&&&&&&$........#&&&&&&&&&&&&&&&,,,,,,,)&&&&&&&&&&&&&&&&&&%,,,,,%&&&&&&&&&&&&-,,,,,,,,,,'&&&&&&&&&&&&&&&", +".*&;........,,===,,=,,,,,,,,,.......;&#..............................................................#&&&&$;..!&*;...................;.........!&+;.........................&&&&&&&&&&&&&&&&&&&&&&;.........&&&&&&&*;...#$&&&&&&#.......&&&&&&&&!'''>!&&,,,,,,'&&&&&&&)'''>&&&&&&&&,,,,,'&&&&&)-,,%)),,,,,,,,,,,-&&&&&&&&&&&&&&&", +".@+.....===.,=,,,,=,,=,=,=,,=........$$.......................;.;.;.;.;......;.;.;..............;.;.;#&&&&@..;!&*.;.;.;..........;.;.;.;....;.;!&+.;.;......................&&&&&&&&&&&&&&&&&&&&&&;........+&&&&&@........#&&&&&!......+&&&&&&&',,,,,,'&,,,,,,&&&&&&&-,,,,,,>&&&&&&',,,,)&&&&&%,,,,,-,,,,,,,,,,,-&&&&&&&&&&&&&&&", +";&#..=,,,,,..=,=,,,,,,,,,=,,,=.......#&;.....................#***;.;+$$#;..;.#+$$@+*..........#+$$$*.#&&&&@...!&*.;;*++#;.......;.#*++*;.;..;;;!&+;;;;......................&&&&&&&&&&&&&&&&&&&&&&.........&&&&&!..........+&&&&&#.....&&&&&&&-,,,,,,,,%,,,,,%&&&&&&-,,,,,,,,'&&&&&&,,,,)&&&&&>,,,,,,,,,,,,,,,,,-&&&&&&&&&&&&&&&", +"*&...,=,=,,=...===,=,=,,,,,=,=........!*.....................!&&&*;@&&&*..;#@&&&&&&&$;.....;.$&&&&&&!*&&&&@..;&&*.$!&&&&$#....;.+!&&&&&!*..;$!&&&&!&&!......................&&&&&&&&&&&&&&&&&&&&&&........#&&&&&*;;;;;;;;;;#&&&&&+....#&&&&&&',,,,,,,,,,,,,,,>&&&&&%,,,,,,,,,,)&&&&&-,,,)&&&&&&!'-,,,,,,,,,,,,,,-&&&&&&&&&&&&&&&", +"$$...,,,,=,,.......=,,=,=,,,,====.....@$.....................!&&&+!&&&&+;.*!&&&&&&&&&!.....;!&&&&&&&&!&&&&@...!&*!&&!$!&&&;;...*&&!@$@!&&*..$&!&&!&!&!......................&&&&&&&&&&&&&&&&&&&&&&........+&&&&&&&&&&&&&&&&&&&&&&&....+&&&&&&,,,,,,,,,,,,,,,,&&&&&!,,,,,,,,,,,%&&&&&',,,'&&&&&&&&&)',,,,,,,,,,,,-&&&&&&&&&&&&&&&", +"&+...==,,,,=,=......=,,,,=,=,=,,=,....*!.....................!&&&!&&&&&*.#&&&&&!!&&&&&@....!&&&&&&&&&&&&&&@..;!&!&$;...#!&!....#@*....;@&&...;.!&+.;;;......................&&&&&&&&&&&&&&&&&&&&&&........$&&&&&&&&&&&&&&&&&&&&&&&....$&&&&&),,,,,,,,,,,,,,,,&&&&&',,,,,,,,,,,,&&&&&',,,-&&&&&&&&&&&&-,,,,,,,,,,-&&&&&&&&&&&&&&&", +"&#....==,=,,,,,==....,=,,,,,=,=,,,,...#&.....................!&&&&&&&!&*.@&&&&*;.;@&&&&#;.+&&&&&@+*+&&&&&&@...&&&+......*&&*............!&+....!&+..........................&&&&&&&&&&&&&&&&&&&&&&........$&&&&&&&&&&&&&&&&&&&&&&&....$&&&&&),,,,,,,,,,,,,,,-&&&&&',,,,,,,,,,,,&&&&&),,,,%&&&&&&&&&&&&-,,,,,,,,,-&&&&&&&&&&&&&&&", +"&;.....=,,,=,=,,,===.=,,=,,,,,,,=,==..#&;....................@&&&&&@*;;.*&&&&*.....&&&&$..&&&&&$....#&&&&&@...&&!........@&$...........;)&$....&&+..........................&&&&&&&&&&&&&&&&&&&&&&........$&&&&&$$$$$$$$$$$$$$$$$$....$&&&&&),,,,,,,,,,,,,,,,&&&&&',,,,,,,,,,,,&&&&&>,,,,,->&&&&&&&&&&&,,,,,,,,,-&&&&&&&&&&&&&&&", +"&;......=,,,,,=,,,,,,,=,,,=,=,=,,,,=..;&#....................!&&&&!.....@&&&!;.;.;.$&&&&.#&&&&!;.....+&&&&$;..!&+........+&@;......;.;..+&!....!&+;.........................&&&&&&&&&&&&&&&&&&&&&&........+&&&&&;.....................$&&&&&!,,,,,,,,,,,,,,,,&&&&&),,,,,,,,,,,-&&&&&',,,,,,,,%>&&&&&&&&-,,,,,,,,-&&&&&&&&&&&&&&&", +"&;........==,,,,=,=,=,,,=,,,,,,,=,,...#&;....................!&&&&*.....!&&&!+$+$$+@&&&&.+&&&&$......#&&&&@..;&&*........+&!.....;.;*+$$@&@....!&+..........................&&&&&&&&&&&&&&&&&&&&&&........*&&&&&+................;....*&&&&&&-,,,,,,,,,,,,,,,)&&&&&-,,,,,,,,,,>&&&&&%,,,,,,,,,,,'&&&&&&',,,,,,,,-&&&&&&&&&&&&&&&", +"&#.........==,=,,,,,,=,,,=,=,=,,=,=...#&;....................@&&&&#....;&&&&&&&&&&&&&&&&;$&&&&+......#&&&&@...!&*........*&&....;*@&&&&&&&!....!&+..........................&&&&&&&&&&&&&&&&&&&&&&........;&&&&&&;.........;;;;;;;....;&&&&&&!,,,,,,,,,-,,,,,'&&&&&),,,,,,,,,-&&&&&&,,,,,,,,,,,,,>&&&&&',,,,,,,,-&&&&&&&&&&&&&&&", +"&;.......;&@.==,=,,=,,,=,,,,,,,,,=....#&.....................!&&&!;....#&&&&&&&&&&&&&&&&.@&&&&#.....;#&&&&@..;!&*........*&!....$&&!!$++@&@....&&+..........................&&&&&&&&&&&&&&&&&&&&&&;........$&&&&&&;.......@&&&&&&;.....$&&&&&&),,,,,,,-!,,,,,-&&&&&&>,,,,,,,-&&&&&&>,,,,,')-,,,,,>&&&&&',,,,,,,,-&&&&&&&&&&&&&&&", +"&*.......*&&$...=,,,=,,,,=,=,=,==.....*&.....................@&&&&;....;&&&&&!&!&&!&&!&!;$&&&&*......#&&&&@...&&*........*&!...$&&+;....+&!....!&$..........................&&&&&&&&&&&&&&&&&&&&&&;........;&&&&&&&$#;.;+&&&&&&&+......;&&&&&&&&'-,,%>&&,,,,,,>&&&&&&&'-,-%>&&&&&&&-,,,,-&&&'-,,'&&&&&&-,,,,,,,,-&&&&&&&&&&&&&&&", +"@+.......;&&&@&;...==,=,,,,,,==.......+$.....................!&&&&;.....&&&&$..########;.$&&&&$......*&&&&@..;!&*........+&!.;#&&*......+&!....!&+..........................&&&&&&&&&&&&&&&&&&&&&&#.........+&&&&&&&&&&&&&&&&&&!........*&&&&&&&&&&&&&&&,,,,,,-&&&&&&&&&&&&&&&&&&&',,,,,>&&&&&&&&&&&&&&,,,,,,,,,'&&&&&&&&&&&&&&&", +"+!.#*++$;.;&&&&&;.....................!*.....................@&&&&;;....!&&&&............*&&&&!......+&&&&@...&&*........*&!..$&!.......+&!....!&+..........................&&&&&&&&&&&&&&&&&&&&&&+..........@&&&&&&&&&&&&&&&&&;.........+&&&&&&&&&&&&&&,,,,,,,-&&&&&&&&&&&&&&&&&),,,,,-&&&&&&&&&&&&&&',,,,,,,,,>&&&&&&&&&&&&&&&", +"#&#+&&&&&;.;&&&&!+;##*+#*+#*;........;&;.....................!&&&&;.....+&&&&)..;.;.;.....&&&&&$.;.;#&&&&&@...&&*........+&!.;)&$.....;.@&@....&&+..........................&&&&&&&&&&&&&&&&&&&&&&&...........@&&&&&&&&&&&&&&&;...........+&&&&&&&&&&&&&,,,,,,,,%&&&&&&&&&&&&&&&),,,,,,'&&&&&&&&&&&&&>,,,,,,,,,,&&&&&&&&&&&&&&&&", +".!&&&&&&&&$@&&&&&&&&&&&&&&&&.........+@......................@&&&&;......&&&&&!+*##*+!+...$&&&&&)+*$!&&&&&@...!&*........*&!..@&);.....;&&!....!&+;.........................&&&&&&&&&&&&&&&&&&&&&&&#...........+&&&&&&&&&&&&$;.............;$&&&&&&&&&&&,,,,,,,,,-)&&&&&&&&&&&&',,,,,,,,-)&&&&&&&&&&',,,,,,,,,,%&&&&&&&&&&&&&&&&", +".+&&&&&&&&&&&&&&&&&&&*$+@&&$........;&*......................!&&&&;......*&&&&&&&&&&&&!...;&&&&&&&&&&&&&&&@...&&*........*&!..+&&;;.;.;!&&!....@&@.;........................&&&&&&&&&&&&&&&&&&&&&&&!............;+&&&&&&&&@#.................;*$$$&&&&&&,,,,,,,,,,,%)&&&&&&&&>-,,,,,,,,,,,-')!&&&)',,,,,,,,,,,,&&&&&&&&&&&&&&&&&", +"..&&&&&&&&&&&&&&&&&&!;..$&&+........+!.......................!&&&&;.......+&&&&&&&&&&&&....*&&&&&&&&&!@&&&!...&&*........+&&...!&&+#*+&&$&!....*&&+*+*......................&&&&&&&&&&&&&&&&&&&&&&&&*..............#++++#;........................&&&&&&,,,,,,,,,,,,,-%''''%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&", +"..*&&&&&&&&&&&&&&&&&&&!!&&&;..**+*+*&#.......................!&&&!;........*!&&&&&&&&&@;....*!&&&&&&!;$&&&@...!&*........*&!...#!&&&&&&+.&!.....$&&&&!......................&&&&&&&&&&&&&&&&&&&&&&&&&#............................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%&&&&&&&&&&&&&&&&&&", +"...$&&&&&&&&&&&&&&&&&&&&&&*..;&&&&&&$........................*++++...........*+$@@$$+#........*$@@$*..#+++*...*+;........;+*....;+@!@$#..++......+@!!+......................&&&&&&&&&&&&&&&&&&&&&&&&&&;...........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%&&&&&&&&&&&&&&&&&&&", +"...;&&&&&&&&&&&&&&&&&&&&&$.;@&&&&&&&........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&*..........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'&&&&&&&&&&&&&&&&&&&&", +"....;&&&&&&&&&&&&&&&&&&&&;.&&&&&&&&;........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&@;........................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%!&&&&&&&&&&&&&&&&&&&&&", +".....*&&&&&&&&&&&&&&&&&&$+&&&&&&&&;.........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&!+;;....................................&&&&&&,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--'!&&&&&&&&&&&&&&&&&&&&&&&", +"......;&&&&&&&&&&&&&&&&&&&&&&&&&!;..........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".......;@&&&&&&&&&&&&&&&&&&&&&&$;...........................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".........*&&&&&&&&&&&&&&&&&&&&*.............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"...........+!&&&&&&&&&&&&&&!*...............................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".............#+@&&&&&&&&!+;.................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +".................;####;.....................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"............................................................................................................................................................................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"................................................................................................................................................................................................................................................................................................................................"}; diff --git a/packages/hal/arm/sa11x0/cerfpda/current/src/cerfpda_misc.c b/packages/hal/arm/sa11x0/cerfpda/current/src/cerfpda_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/src/cerfpda_misc.c @@ -0,0 +1,169 @@ +//========================================================================== +// +// cerfpda_misc.c +// +// HAL misc board support code for StrongARM SA1110/Cerf +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: hmt +// Travis C. Furrer +// Date: 2000-05-21 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // IO macros +#include // Register state info +#include +#include // Interrupt names +#include +#include // Hardware definitions +#include // Platform specifics + +#include // diag_printf + +// All the MM table layout is here: +#include + +externC void* memset(void *, int, size_t); + +void +hal_mmu_init(void) +{ + unsigned long ttb_base = SA11X0_RAM_BANK0_BASE + 0x4000; + unsigned long i; + + /* + * Set the TTB register + */ + asm volatile ("mcr p15,0,%0,c2,c0,0" : : "r"(ttb_base) /*:*/); + + /* + * Set the Domain Access Control Register + */ + i = ARM_ACCESS_DACR_DEFAULT; + asm volatile ("mcr p15,0,%0,c3,c0,0" : : "r"(i) /*:*/); + + /* + * First clear all TT entries - ie Set them to Faulting + */ + memset((void *)ttb_base, 0, ARM_FIRST_LEVEL_PAGE_TABLE_SIZE); + + /* Actual Virtual Size Attributes Function */ + /* Base Base MB cached? buffered? access permissions */ + /* xxx00000 xxx00000 */ + X_ARM_MMU_SECTION(0x000, 0x500, 32, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Boot flash ROMspace */ + X_ARM_MMU_SECTION(0x080, 0xf00, 16, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Ethernet Adaptor */ + X_ARM_MMU_SECTION(0x100, 0x100, 512, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Board Registers */ + X_ARM_MMU_SECTION(0x200, 0x200, 512, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* PCMCIA Socket A */ + X_ARM_MMU_SECTION(0x300, 0x300, 512, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* PCMCIA Sockets B */ + X_ARM_MMU_SECTION(0x800, 0x800, 0x400, ARM_UNCACHEABLE, ARM_UNBUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* StrongARM(R) Registers */ + X_ARM_MMU_SECTION(0xC00, 0x000, 64, ARM_UNCACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* DRAM Bank 0 */ + X_ARM_MMU_SECTION(0xC00, 0xC00, 64, ARM_UNCACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* DRAM Bank 0 */ + X_ARM_MMU_SECTION(0xE00, 0xE00, 128, ARM_CACHEABLE, ARM_BUFFERABLE, ARM_ACCESS_PERM_RW_RW); /* Zeros (Cache Clean) Bank */ + +} + +// +// Board control register support +// Update the board control register (write only). Only the bits +// specified by 'mask' are changed to 'value'. +// + +void +cerfpda_BCR(unsigned long mask, unsigned long value) +{ + _cerfpda_BCR = (_cerfpda_BCR & ~mask) | (mask & value); + *SA1110_BOARD_CONTROL = _cerfpda_BCR; +} + +// +// Platform specific initialization +// + +void +plf_hardware_init(void) +{ + // Force "alternate" use of GPIO pins used for LCD screen + *SA11X0_GPIO_ALTERNATE_FUNCTION |= 0x080003FC; // Bits 2..9 + *SA11X0_GPIO_PIN_DIRECTION |= 0x080003FC; // Bits 2..9 + *SA11X0_GPIO_PIN_OUTPUT_CLEAR = 0x080003FC; // Bits 2..9 + *SA11X0_GPIO_PIN_OUTPUT_SET = 0x08000000; // CRYSTAL WAKEUP(GPIO27) + + // Toggle A0 connected to the SBHE line on the Crystal chip. + *(char*)(0x20000000) = 1; + *(char*)(0x20000001) = 2; + *(char*)(0x20000000) = 3; + *(char*)(0x20000001) = 0; + + // Configure the ethernet GPIO interrupt to rising-edge + HAL_INTERRUPT_CONFIGURE(SA1110_IRQ_GPIO_ETH, 0, 1); + + // Configure the 16x5x GPIO interrupt to rising-edge + HAL_INTERRUPT_CONFIGURE(SA1110_IRQ_GPIO_16X5X, 0, 1); +} + +#include CYGHWR_MEMORY_LAYOUT_H +typedef void code_fun(void); +void cerfpda_program_new_stack(void *func) +{ + register CYG_ADDRESS stack_ptr asm("sp"); + register CYG_ADDRESS old_stack asm("r4"); + register code_fun *new_func asm("r0"); + old_stack = stack_ptr; + stack_ptr = CYGMEM_REGION_ram + CYGMEM_REGION_ram_SIZE - sizeof(CYG_ADDRESS); + new_func = (code_fun*)func; + new_func(); + stack_ptr = old_stack; + return; +} + +// ------------------------------------------------------------------------ +// EOF cerfpda_misc.c diff --git a/packages/hal/arm/sa11x0/cerfpda/current/src/lcd_support.c b/packages/hal/arm/sa11x0/cerfpda/current/src/lcd_support.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/cerfpda/current/src/lcd_support.c @@ -0,0 +1,633 @@ +//========================================================================== +// +// lcd_support.c +// +// SA1110/CerfCube - LCD support routines +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-06-05 +// Description: Tool used to test LCD stuff +//####DESCRIPTIONEND#### + +#include + +#include +#include // IO macros +#include // Register state info +#include // HAL interrupt macros + +#include // Board definitions +#include +#include + +#ifdef CYGPKG_ISOINFRA +# include +# ifdef CYGINT_ISO_STDIO_FORMATTED_IO +# include // sscanf +# endif +#endif + +#include "banner.xpm" + +#ifndef FALSE +#define FALSE 0 +#define TRUE 1 +#endif + +static struct lcd_frame { + unsigned short palette[16]; + unsigned short pixels[240][320]; + unsigned char pad[256]; +} lcd_frame_buffer; + +#define RGB_RED(x) (((x)&0x1F)<<11) +#define RGB_GREEN(x) (((x)&0x3F)<<5) +#define RGB_BLUE(x) ((x)&0x1F) + +static volatile struct lcd_frame *fp; + +static int +_hexdigit(char c) +{ + if ((c >= '0') && (c <= '9')) { + return c - '0'; + } else + if ((c >= 'A') && (c <= 'F')) { + return (c - 'A') + 0x0A; + } else + if ((c >= 'a') && (c <= 'f')) { + return (c - 'a') + 0x0a; + } +} + +static int +_hex(char *cp) +{ + return (_hexdigit(*cp)<<4) | _hexdigit(*(cp+1)); +} + +static unsigned short +parse_color(char *cp) +{ + int red, green, blue; + + if (*cp == '#') { + red = _hex(cp+1); + green = _hex(cp+3); + blue = _hex(cp+5); + return RGB_RED(red>>3) | RGB_GREEN(green>>2) | RGB_BLUE(blue>>3); + } else { + // Should be "None" + return 0xFFFF; + } +} + +#ifndef CYGINT_ISO_STDIO_FORMATTED_IO +static int +get_int(char **_cp) +{ + char *cp = *_cp; + char c; + int val = 0; + + while ((c = *cp++) && (c != ' ')) { + if ((c >= '0') && (c <= '9')) { + val = val * 10 + (c - '0'); + } else { + return -1; + } + } + *_cp = cp; + return val; +} +#endif + +void +show_xpm(char *xpm[]) +{ + int i, row, col; + char *cp; + int nrows, ncols, nclrs; + unsigned short colors[256]; // Mapped by character index + + cp = xpm[0]; +#ifdef CYGINT_ISO_STDIO_FORMATTED_IO + if (sscanf(cp, "%d %d %d", &ncols, &nrows, &nclrs) != 3) { +#else + if (((ncols = get_int(&cp)) < 0) || + ((nrows = get_int(&cp)) < 0) || + ((nclrs = get_int(&cp)) < 0)) { +#endif + diag_printf("Can't parse XPM data, sorry\n"); + return; + } + // diag_printf("%d rows, %d cols, %d colors\n", nrows, ncols, nclrs); + + for (i = 0; i < 256; i++) { + colors[i] = 0x0000; + } + for (i = 0; i < nclrs; i++) { + cp = xpm[i+1]; + colors[(unsigned int)*cp] = parse_color(&cp[4]); +// printf("Color[%c] = %x\n", *cp, colors[(unsigned int)*cp]); + } + + for (row = 0; row < nrows; row++) { + cp = xpm[nclrs+1+row]; + for (col = 0; col < ncols; col++) { + fp->pixels[row][col] = colors[(unsigned int)*cp++]; + } + } + // cyg_thread_delay(100); +} + +// 8x8 Font - from Helios + +#define FIRST_CHAR 0x20 +#define LAST_CHAR 0x7E +#define FONT_HEIGHT 8 +#define FONT_WIDTH 8 +#define CURSOR_ON 0x5F +#define CURSOR_OFF 0x20 +static const char font_table[LAST_CHAR-FIRST_CHAR+1][8] = +{ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */ + { 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00 }, /* ! */ + { 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* " */ + { 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00 }, /* # */ + { 0x30, 0xFC, 0x16, 0x7C, 0xD0, 0x7E, 0x18, 0x00 }, /* $ */ + { 0x06, 0x66, 0x30, 0x18, 0x0C, 0x66, 0x60, 0x00 }, /* % */ + { 0x1C, 0x36, 0x36, 0x1C, 0xB6, 0x66, 0xDC, 0x00 }, /* & */ + { 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ' */ + { 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00 }, /* ( */ + { 0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00 }, /* ) */ + { 0x00, 0x18, 0x7E, 0x3C, 0x7E, 0x18, 0x00, 0x00 }, /* * */ + { 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00 }, /* + */ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x0C }, /* , */ + { 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00 }, /* - */ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 }, /* . */ + { 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00 }, /* / */ + { 0x3C, 0x66, 0x76, 0x7E, 0x6E, 0x66, 0x3C, 0x00 }, /* 0 */ + { 0x18, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00 }, /* 1 */ + { 0x3C, 0x66, 0x60, 0x30, 0x18, 0x0C, 0x7E, 0x00 }, /* 2 */ + { 0x3C, 0x66, 0x60, 0x38, 0x60, 0x66, 0x3C, 0x00 }, /* 3 */ + { 0x30, 0x38, 0x3C, 0x36, 0x7E, 0x30, 0x30, 0x00 }, /* 4 */ + { 0x7E, 0x06, 0x3E, 0x60, 0x60, 0x66, 0x3C, 0x00 }, /* 5 */ + { 0x38, 0x0C, 0x06, 0x3E, 0x66, 0x66, 0x3C, 0x00 }, /* 6 */ + { 0x7E, 0x60, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00 }, /* 7 */ + { 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00 }, /* 8 */ + { 0x3C, 0x66, 0x66, 0x7C, 0x60, 0x30, 0x1C, 0x00 }, /* 9 */ + { 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00 }, /* : */ + { 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x0C }, /* ; */ + { 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x00 }, /* < */ + { 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00 }, /* = */ + { 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x00 }, /* > */ + { 0x3C, 0x66, 0x30, 0x18, 0x18, 0x00, 0x18, 0x00 }, /* ? */ + { 0x3C, 0x66, 0x76, 0x56, 0x76, 0x06, 0x3C, 0x00 }, /* @ */ + { 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00 }, /* A */ + { 0x3E, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3E, 0x00 }, /* B */ + { 0x3C, 0x66, 0x06, 0x06, 0x06, 0x66, 0x3C, 0x00 }, /* C */ + { 0x1E, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1E, 0x00 }, /* D */ + { 0x7E, 0x06, 0x06, 0x3E, 0x06, 0x06, 0x7E, 0x00 }, /* E */ + { 0x7E, 0x06, 0x06, 0x3E, 0x06, 0x06, 0x06, 0x00 }, /* F */ + { 0x3C, 0x66, 0x06, 0x76, 0x66, 0x66, 0x3C, 0x00 }, /* G */ + { 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00 }, /* H */ + { 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00 }, /* I */ + { 0x7C, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1C, 0x00 }, /* J */ + { 0x66, 0x36, 0x1E, 0x0E, 0x1E, 0x36, 0x66, 0x00 }, /* K */ + { 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7E, 0x00 }, /* L */ + { 0xC6, 0xEE, 0xFE, 0xD6, 0xD6, 0xC6, 0xC6, 0x00 }, /* M */ + { 0x66, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x66, 0x00 }, /* N */ + { 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00 }, /* O */ + { 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x06, 0x00 }, /* P */ + { 0x3C, 0x66, 0x66, 0x66, 0x56, 0x36, 0x6C, 0x00 }, /* Q */ + { 0x3E, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x66, 0x00 }, /* R */ + { 0x3C, 0x66, 0x06, 0x3C, 0x60, 0x66, 0x3C, 0x00 }, /* S */ + { 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, /* T */ + { 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00 }, /* U */ + { 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00 }, /* V */ + { 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0xEE, 0xC6, 0x00 }, /* W */ + { 0x66, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00 }, /* X */ + { 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00 }, /* Y */ + { 0x7E, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x7E, 0x00 }, /* Z */ + { 0x3E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3E, 0x00 }, /* [ */ + { 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, 0x00 }, /* \ */ + { 0x7C, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7C, 0x00 }, /* ] */ + { 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ^ */ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF }, /* _ */ + { 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ` */ + { 0x00, 0x00, 0x3C, 0x60, 0x7C, 0x66, 0x7C, 0x00 }, /* a */ + { 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x3E, 0x00 }, /* b */ + { 0x00, 0x00, 0x3C, 0x66, 0x06, 0x66, 0x3C, 0x00 }, /* c */ + { 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x00 }, /* d */ + { 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00 }, /* e */ + { 0x38, 0x0C, 0x0C, 0x3E, 0x0C, 0x0C, 0x0C, 0x00 }, /* f */ + { 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x3C }, /* g */ + { 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x00 }, /* h */ + { 0x18, 0x00, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00 }, /* i */ + { 0x18, 0x00, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x0E }, /* j */ + { 0x06, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x00 }, /* k */ + { 0x1C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00 }, /* l */ + { 0x00, 0x00, 0x6C, 0xFE, 0xD6, 0xD6, 0xC6, 0x00 }, /* m */ + { 0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x00 }, /* n */ + { 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00 }, /* o */ + { 0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06 }, /* p */ + { 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0xE0 }, /* q */ + { 0x00, 0x00, 0x36, 0x6E, 0x06, 0x06, 0x06, 0x00 }, /* r */ + { 0x00, 0x00, 0x7C, 0x06, 0x3C, 0x60, 0x3E, 0x00 }, /* s */ + { 0x0C, 0x0C, 0x3E, 0x0C, 0x0C, 0x0C, 0x38, 0x00 }, /* t */ + { 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x00 }, /* u */ + { 0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00 }, /* v */ + { 0x00, 0x00, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00 }, /* w */ + { 0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00 }, /* x */ + { 0x00, 0x00, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x3C }, /* y */ + { 0x00, 0x00, 0x7E, 0x30, 0x18, 0x0C, 0x7E, 0x00 }, /* z */ + { 0x30, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x30, 0x00 }, /* { */ + { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, /* | */ + { 0x0C, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0C, 0x00 }, /* } */ + { 0x8C, 0xD6, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00 } /* ~ */ +}; + +#define LCD_WIDTH 320 +#define LCD_HEIGHT 240 +#define LCD_DEPTH 16 + +// This can be 1 or 2 +#define SCREEN_SCALE 2 +#define NIBBLES_PER_PIXEL (1*SCREEN_SCALE) +#define PIXELS_PER_BYTE (2/NIBBLES_PER_PIXEL) +#define PIXEL_MASK ((1<palette); + *SA1110_LCCR1 = 0x1D1D0930; + *SA1110_LCCR2 = 0xEF; + *SA1110_LCCR3 = 0x0c; + fp->palette[0] = 0x2000; // Tell controller 16 bits +// *SA1110_LCCR0 = 0xBB; // B&W + *SA1110_LCCR0 = 0xB9; // Color +// cerfpda_BCR(SA1110_BCR_LCD_BPP, SA1110_BCR_LCD_12BPP); + cerfpda_BCR(SA1110_BCR_LCD_BPP, SA1110_BCR_LCD_16BPP); + cerfpda_BCR(SA1110_BCR_LCD, SA1110_BCR_LCD_ON); + cerfpda_BCR(SA1110_BCR_BACKLIGHT, SA1110_BCR_BACKLIGHT); +} + +// Clear screen +void +lcd_clear(void) +{ + int row, col; + for (row = 0; row < lcd_height; row++) { + for (col = 0; col < lcd_width; col++) { + fp->pixels[row][col] = bg; + } + } + for (row = 0; row < SCREEN_HEIGHT; row++) { + for (col = 0; col < SCREEN_WIDTH; col++) { + screen[row][col] = ' '; + } + } + // Note: Row 0 seems to wrap incorrectly + curX = 0; curY = SCREEN_START; + lcd_drawc(CURSOR_ON, curX, curY); + show_xpm(banner_xpm); +} + +// Position cursor +void +lcd_moveto(int X, int Y) +{ + lcd_drawc(CURSOR_OFF, curX, curY); + if (X < 0) X = 0; + if (X >= SCREEN_WIDTH) X = SCREEN_WIDTH-1; + curX = X; + if (Y < SCREEN_START) Y = SCREEN_START; + if (Y >= SCREEN_HEIGHT) Y = SCREEN_HEIGHT-1; + curY = Y; + lcd_drawc(CURSOR_ON, curX, curY); +} + +// Render a character at position (X,Y) with current background/foreground +static void +lcd_drawc(cyg_int8 c, int x, int y) +{ + // Currently hard-coded for 16bpp + cyg_uint8 bits; + cyg_uint16 *pixels; + int l, p; + + screen[curY][curX] = c; + for (l = 0; l < FONT_HEIGHT; l++) { + bits = font_table[c-FIRST_CHAR][l]; + pixels = &fp->pixels[curY*FONT_HEIGHT+l][curX*FONT_WIDTH]; + for (p = 0; p < 8; p++) { + if (bits & 0x01) { + *pixels++ = fg; + } else { + *pixels++ = bg; + } + bits >>= 1; + } + } +} + +static void +lcd_scroll(void) +{ + int row, col; + cyg_uint8 *c1, *c2; + cyg_uint16 *p1, *p2; + + // First scroll up the virtual screen + for (row = SCREEN_START; row < SCREEN_HEIGHT; row++) { + c1 = &screen[row-1][0]; + c2 = &screen[row][0]; + for (col = 0; col < SCREEN_WIDTH; col++) { + *c1++ = *c2++; + } + } + c1 = &screen[SCREEN_HEIGHT-1][0]; + for (col = 0; col < SCREEN_WIDTH; col++) { + *c1++ = 0x20; + } + // Now the physical screen + for (row = FONT_HEIGHT*(SCREEN_START+1); row < LCD_HEIGHT; row++) { + p1 = &fp->pixels[row-FONT_HEIGHT][0]; + p2 = &fp->pixels[row][0]; + for (col = 0; col < LCD_WIDTH; col++) { + *p1++ = *p2++; + } + } + for (row = LCD_HEIGHT-FONT_HEIGHT; row < LCD_HEIGHT; row++) { + p1 = &fp->pixels[row][0]; + for (col = 0; col < LCD_WIDTH; col++) { + *p1++ = bg; + } + } +} + +// Draw one character at the current position +void +lcd_putc(cyg_int8 c) +{ + lcd_drawc(CURSOR_OFF, curX, curY); + switch (c) { + case '\r': + curX = 0; + break; + case '\n': + curY++; + if (curY == SCREEN_HEIGHT) { + lcd_scroll(); + curY--; + } + break; + case '\b': + curX--; + if (curX < 0) { + curY--; + if (curY < 0) curY = 0; + curX = SCREEN_WIDTH-1; + } + break; + default: + lcd_drawc(c, curX, curY); + curX++; + if (curX == SCREEN_WIDTH) { + curY++; + curX = 0; + } + } + lcd_drawc(CURSOR_ON, curX, curY); +} + +// Basic LCD 'printf()' support + +#include + +#define is_digit(c) ((c >= '0') && (c <= '9')) + +static int +_cvt(unsigned long val, char *buf, long radix, char *digits) +{ + char temp[80]; + char *cp = temp; + int length = 0; + if (val == 0) { + /* Special case */ + *cp++ = '0'; + } else { + while (val) { + *cp++ = digits[val % radix]; + val /= radix; + } + } + while (cp != temp) { + *buf++ = *--cp; + length++; + } + *buf = '\0'; + return (length); +} + +int +lcd_vprintf(void (*putc)(cyg_int8), const char *fmt0, va_list ap) +{ + char c, sign, *cp; + int left_prec, right_prec, zero_fill, length, pad, pad_on_right; + char buf[32]; + long val; + while ((c = *fmt0++)) { + cp = buf; + length = 0; + if (c == '%') { + c = *fmt0++; + left_prec = right_prec = pad_on_right = 0; + if (c == '-') { + c = *fmt0++; + pad_on_right++; + } + if (c == '0') { + zero_fill = TRUE; + c = *fmt0++; + } else { + zero_fill = FALSE; + } + while (is_digit(c)) { + left_prec = (left_prec * 10) + (c - '0'); + c = *fmt0++; + } + if (c == '.') { + c = *fmt0++; + zero_fill++; + while (is_digit(c)) { + right_prec = (right_prec * 10) + (c - '0'); + c = *fmt0++; + } + } else { + right_prec = left_prec; + } + sign = '\0'; + switch (c) { + case 'd': + case 'x': + case 'X': + val = va_arg(ap, long); + switch (c) { + case 'd': + if (val < 0) { + sign = '-'; + val = -val; + } + length = _cvt(val, buf, 10, "0123456789"); + break; + case 'x': + length = _cvt(val, buf, 16, "0123456789abcdef"); + break; + case 'X': + length = _cvt(val, buf, 16, "0123456789ABCDEF"); + break; + } + break; + case 's': + cp = va_arg(ap, char *); + length = strlen(cp); + break; + case 'c': + c = va_arg(ap, long /*char*/); + (*putc)(c); + continue; + default: + (*putc)('?'); + } + pad = left_prec - length; + if (sign != '\0') { + pad--; + } + if (zero_fill) { + c = '0'; + if (sign != '\0') { + (*putc)(sign); + sign = '\0'; + } + } else { + c = ' '; + } + if (!pad_on_right) { + while (pad-- > 0) { + (*putc)(c); + } + } + if (sign != '\0') { + (*putc)(sign); + } + while (length-- > 0) { + (*putc)(c = *cp++); + if (c == '\n') { + (*putc)('\r'); + } + } + if (pad_on_right) { + while (pad-- > 0) { + (*putc)(' '); + } + } + } else { + (*putc)(c); + if (c == '\n') { + (*putc)('\r'); + } + } + } +} + +int +lcd_printf(char const *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = lcd_vprintf(lcd_putc, fmt, ap); + va_end(ap); + return (ret); +} + +void +set_bg(int red, int green, int blue) +{ + bg = RGB_RED(red) | RGB_GREEN(green) | RGB_BLUE(blue); +} + +void +set_fg(int red, int green, int blue) +{ + fg = RGB_RED(red) | RGB_GREEN(green) | RGB_BLUE(blue); +} diff --git a/packages/hal/arm/sa11x0/flexanet/current/ChangeLog b/packages/hal/arm/sa11x0/flexanet/current/ChangeLog --- a/packages/hal/arm/sa11x0/flexanet/current/ChangeLog +++ b/packages/hal/arm/sa11x0/flexanet/current/ChangeLog @@ -1,3 +1,17 @@ +2002-05-14 Jesper Skov + + * src/flexanet_misc.c: Fixed warning. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_sa11x0_flexanet.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + 2001-10-30 Jordi Colomer * include/flexanet.h: minor changes to the GPIO usage. @@ -13,27 +27,36 @@ 2001-07-27 Jordi Colomer * Initial version of support for BSE Flexanet/SA1110 handheld board. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/arm/sa11x0/flexanet/current/cdl/hal_arm_sa11x0_flexanet.cdl b/packages/hal/arm/sa11x0/flexanet/current/cdl/hal_arm_sa11x0_flexanet.cdl --- a/packages/hal/arm/sa11x0/flexanet/current/cdl/hal_arm_sa11x0_flexanet.cdl +++ b/packages/hal/arm/sa11x0/flexanet/current/cdl/hal_arm_sa11x0_flexanet.cdl @@ -5,29 +5,38 @@ # Flexanet handhelds core board configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # @@ -124,25 +133,25 @@ cdl_package CYGPKG_HAL_ARM_SA11X0_FLEXAN This option chooses which port will be used to connect to a host running GDB." } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + calculated 0 + } cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { display "Diagnostic serial port" active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE flavor data legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 - default_value 0 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT description " The flexanet board has two serial ports (UART1 and UART3). This option chooses which port will be used for diagnostic output." } - - cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { - display "Default console channel." - flavor data - legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 - calculated 0 - } cdl_component CYGBLD_GLOBAL_OPTIONS { display "Global build options" diff --git a/packages/hal/arm/sa11x0/flexanet/current/include/flexanet.h b/packages/hal/arm/sa11x0/flexanet/current/include/flexanet.h --- a/packages/hal/arm/sa11x0/flexanet/current/include/flexanet.h +++ b/packages/hal/arm/sa11x0/flexanet/current/include/flexanet.h @@ -8,29 +8,38 @@ // Platform specific support (register layout, etc) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/flexanet/current/include/hal_platform_setup.h b/packages/hal/arm/sa11x0/flexanet/current/include/hal_platform_setup.h --- a/packages/hal/arm/sa11x0/flexanet/current/include/hal_platform_setup.h +++ b/packages/hal/arm/sa11x0/flexanet/current/include/hal_platform_setup.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/flexanet/current/include/plf_io.h b/packages/hal/arm/sa11x0/flexanet/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/flexanet/current/include/plf_io.h @@ -0,0 +1,60 @@ +#ifndef CYGONCE_HAL_ARM_SA11X0_FLEXANET_PLF_IO_H +#define CYGONCE_HAL_ARM_SA11X0_FLEXANET_PLF_IO_H + +/*============================================================================= +// +// plf_io.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#endif // CYGONCE_HAL_ARM_SA11X0_FLEXANET_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/sa11x0/flexanet/current/include/plf_mmap.h b/packages/hal/arm/sa11x0/flexanet/current/include/plf_mmap.h --- a/packages/hal/arm/sa11x0/flexanet/current/include/plf_mmap.h +++ b/packages/hal/arm/sa11x0/flexanet/current/include/plf_mmap.h @@ -7,29 +7,38 @@ // Platform specific memory map support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/flexanet/current/src/flexanet_misc.c b/packages/hal/arm/sa11x0/flexanet/current/src/flexanet_misc.c --- a/packages/hal/arm/sa11x0/flexanet/current/src/flexanet_misc.c +++ b/packages/hal/arm/sa11x0/flexanet/current/src/flexanet_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for StrongARM SA1110/Flexanet // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -62,6 +71,8 @@ // All the MM table layout is here: #include +externC void* memset(void *, int, size_t); + void hal_mmu_init(void) { diff --git a/packages/hal/arm/sa11x0/ipaq/current/ChangeLog b/packages/hal/arm/sa11x0/ipaq/current/ChangeLog --- a/packages/hal/arm/sa11x0/ipaq/current/ChangeLog +++ b/packages/hal/arm/sa11x0/ipaq/current/ChangeLog @@ -1,3 +1,42 @@ +2002-05-14 Jesper Skov + + * src/atmel_support.c: Fixed warning. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_sa11x0_ipaq.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + + +2002-04-12 Gary Thomas + + * src/redboot_cmds.c: + * src/lcd_support.c: + * src/kbd.xpm: + * src/ipaq_misc.c: + * src/atmel_support.c: Clean up warnings. + +2002-04-03 Jesper Skov + + * src/lcd_support.c: Don't use sscanf - it may rely on stuff that + is only initialized later. + + * src/ipaq_misc.c (plf_if_init): lcd_init is always called. + +2002-03-06 Mark Salter + + * src/lcd_support.c (lcd_init): Tweak LCD settings. + +2002-02-21 Gary Thomas + + * src/lcd_support.c (lcd_on): Only enable LCD if LCD/TS is being used + as the console. This keeps the LCD backlight off which in turn makes + the unit run cooler (and longer). + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + 2001-09-28 Richard Panton * include/hal_platform_setup.h: Use correct MMU control register bits @@ -299,27 +338,36 @@ 2001-02-24 Gary Thomas +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#endif // CYGONCE_HAL_ARM_SA11X0_IPAQ_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/sa11x0/ipaq/current/include/plf_mmap.h b/packages/hal/arm/sa11x0/ipaq/current/include/plf_mmap.h --- a/packages/hal/arm/sa11x0/ipaq/current/include/plf_mmap.h +++ b/packages/hal/arm/sa11x0/ipaq/current/include/plf_mmap.h @@ -7,29 +7,38 @@ // Platform specific memory map support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/ipaq/current/misc/redboot_RAM.ecm b/packages/hal/arm/sa11x0/ipaq/current/misc/redboot_RAM.ecm --- a/packages/hal/arm/sa11x0/ipaq/current/misc/redboot_RAM.ecm +++ b/packages/hal/arm/sa11x0/ipaq/current/misc/redboot_RAM.ecm @@ -26,11 +26,13 @@ cdl_configuration eCos { package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_PCMCIA current ; package CYGPKG_IO_ETH_DRIVERS current ; package CYGPKG_IO_FLASH current ; package CYGPKG_COMPRESS_ZLIB current ; - package CYGPKG_ISOINFRA current ; package CYGPKG_MEMALLOC current ; }; @@ -38,6 +40,10 @@ cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { user_value 6144 }; @@ -74,4 +80,40 @@ cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BA user_value 0 }; +cdl_option CYGSEM_REDBOOT_ARM_LINUX_BOOT { + inferred_value 1 +}; +cdl_option CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT { + inferred_value 0xC0008000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/sa11x0/ipaq/current/misc/redboot_ROM.ecm b/packages/hal/arm/sa11x0/ipaq/current/misc/redboot_ROM.ecm --- a/packages/hal/arm/sa11x0/ipaq/current/misc/redboot_ROM.ecm +++ b/packages/hal/arm/sa11x0/ipaq/current/misc/redboot_ROM.ecm @@ -26,11 +26,13 @@ cdl_configuration eCos { package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_PCMCIA current ; package CYGPKG_IO_ETH_DRIVERS current ; package CYGPKG_IO_FLASH current ; package CYGPKG_COMPRESS_ZLIB current ; - package CYGPKG_ISOINFRA current ; package CYGPKG_MEMALLOC current ; }; @@ -38,6 +40,10 @@ cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + cdl_option CYGNUM_IO_ETH_DRIVERS_NUM_PKT { user_value 3 }; @@ -90,4 +96,40 @@ cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BA user_value 0 }; +cdl_option CYGSEM_REDBOOT_ARM_LINUX_BOOT { + inferred_value 1 +}; +cdl_option CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT { + inferred_value 0xC0008000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/sa11x0/ipaq/current/misc/toyota_fullscr.ecm b/packages/hal/arm/sa11x0/ipaq/current/misc/toyota_fullscr.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/ipaq/current/misc/toyota_fullscr.ecm @@ -0,0 +1,316 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware ipaq ; + template net ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_SA11X0 current ; + package -hardware CYGPKG_HAL_ARM_SA11X0_IPAQ current ; + package -hardware CYGPKG_IO_SERIAL_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_PCMCIA_IPAQ current ; + package -hardware CYGPKG_DEVS_FLASH_IPAQ current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_TOUCH_IPAQ current ; + package -hardware CYGPKG_DEVS_KBD_IPAQ current ; + package -hardware CYGPKG_DEVS_ETH_CF current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_IO current ; + package -template CYGPKG_IO_SERIAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_KERNEL current ; + package -template CYGPKG_MEMALLOC current ; + package -template CYGPKG_LIBC current ; + package -template CYGPKG_LIBC_TIME current ; + package -template CYGPKG_LIBC_STDLIB current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_LIBC_I18N current ; + package -template CYGPKG_LIBC_SETJMP current ; + package -template CYGPKG_LIBC_STARTUP current ; + package -template CYGPKG_LIBC_STDIO current ; + package -template CYGPKG_LIBM current ; + package -template CYGPKG_POSIX current ; + package -template CYGPKG_IO_WATCHDOG current ; + package -template CYGPKG_IO_WALLCLOCK current ; + package -template CYGPKG_ERROR current ; + package -template CYGPKG_IO_FILEIO current ; + package -template CYGPKG_NET current ; + package -template CYGPKG_NET_OPENBSD_STACK current ; + package -template CYGPKG_NS_DNS current ; + package -template CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MICROWINDOWS current ; + package CYGPKG_FS_JFFS2 current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_SDL current ; + package CYGPKG_SMPEG current ; + package CYGPKG_FS_RAM current ; +}; + +cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + user_value arm-elf +}; + +cdl_option CYGPKG_IO_NFILE { + user_value 32 +}; + +cdl_component CYGPKG_INFRA_DEBUG { + user_value 1 +}; + +cdl_option CYGBLD_ISO_CTYPE_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILETYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_STREAMS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILEACCESS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_CHAR_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_DIRECT_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_ERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMER_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_CLOCK_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_CLOCKS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_NUMBERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGSETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DIRENT_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREADTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PMUTEXTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_BSDTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_UTSNAME_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SEMAPHORES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_MUTEX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_LIMITS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_OPEN_MAX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_NETDB_PROTO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_NETDB_SERV_HEADER { + inferred_value 1 +}; + +cdl_option CYGIMP_KERNEL_SCHED_SORTED_QUEUES { + inferred_value 1 +}; + +cdl_option CYGNUM_KERNEL_SCHED_TIMESLICE_TICKS { + user_value 2 +}; + +cdl_option CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE { + inferred_value 1 +}; + +cdl_component CYGSEM_KERNEL_SCHED_ASR_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGSEM_KERNEL_SCHED_ASR_GLOBAL { + inferred_value 1 +}; + +cdl_option FOPEN_MAX { + user_value 32 +}; + +cdl_option CYGNUM_FILEIO_NFILE { + user_value 32 +}; + +cdl_option CYGNUM_FILEIO_NFD { + user_value 32 +}; + +cdl_component CYGPKG_IO_FILEIO_INODE { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_ECOS { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NANOWM { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NXKBD { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NANOX_DEMOS { + inferred_value 1 +}; + +cdl_option CYGPKG_MICROWINDOWS_CFLAGS_ADD { + inferred_value "-I\$(PREFIX)/include/microwin -D__ECOS=1 -DMSDOS=0 -DELKS=0 -D__rtems__=0 -D_MINIX=0 -DNOTYET=0 -DUNIX=1 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DxHAVE_JPEG_SUPPORT=1 -DHAVESELECT=1 -DMWPIXEL_FORMAT=MWPF_TRUECOLOR565" +}; + +cdl_component CYGPKG_IO_FLASH_BLOCK_DEVICE { + inferred_value 1 +}; + +cdl_option CYGNUM_IO_FLASH_BLOCK_LENGTH_1 { + user_value 0x00200000 +}; + +cdl_option CYGPKG_SDL_CFLAGS_ADD { + inferred_value "-I\$(PREFIX)/include/SDL -I\$(REPOSITORY)/\$(PACKAGE)/src/src -I\$(REPOSITORY)/\$(PACKAGE)/src/src/audio -I\$(REPOSITORY)/\$(PACKAGE)/src/src/events -I\$(REPOSITORY)/\$(PACKAGE)/src/src/joystick -I\$(REPOSITORY)/\$(PACKAGE)/src/src/thread -I\$(REPOSITORY)/\$(PACKAGE)/src/src/thread/ecos -I\$(REPOSITORY)/\$(PACKAGE)/src/src/timer -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video/fbcon -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video/svga -DDISABLE_JOYSTICK -DDISABLE_CDROM -DUSE_INPUT_EVENTS -DSDL_USE_PTHREADS -DPTHREAD_NO_RECURSIVE_MUTEX -D__ECOS=1 -DENABLE_FBCON" +}; + +cdl_option CYGBLD_SMPEG_BUILD_PLAYMPEG { + inferred_value 1 +}; + +cdl_component CYGBLD_SMPEG_BUILD_TOYOTA_DEMO { + user_value 1 +}; + + diff --git a/packages/hal/arm/sa11x0/ipaq/current/misc/toyota_window.ecm b/packages/hal/arm/sa11x0/ipaq/current/misc/toyota_window.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/ipaq/current/misc/toyota_window.ecm @@ -0,0 +1,324 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware ipaq ; + template net ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_SA11X0 current ; + package -hardware CYGPKG_HAL_ARM_SA11X0_IPAQ current ; + package -hardware CYGPKG_IO_SERIAL_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_PCMCIA_IPAQ current ; + package -hardware CYGPKG_DEVS_FLASH_IPAQ current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_TOUCH_IPAQ current ; + package -hardware CYGPKG_DEVS_KBD_IPAQ current ; + package -hardware CYGPKG_DEVS_ETH_CF current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_IO current ; + package -template CYGPKG_IO_SERIAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_KERNEL current ; + package -template CYGPKG_MEMALLOC current ; + package -template CYGPKG_LIBC current ; + package -template CYGPKG_LIBC_TIME current ; + package -template CYGPKG_LIBC_STDLIB current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_LIBC_I18N current ; + package -template CYGPKG_LIBC_SETJMP current ; + package -template CYGPKG_LIBC_STARTUP current ; + package -template CYGPKG_LIBC_STDIO current ; + package -template CYGPKG_LIBM current ; + package -template CYGPKG_POSIX current ; + package -template CYGPKG_IO_WATCHDOG current ; + package -template CYGPKG_IO_WALLCLOCK current ; + package -template CYGPKG_ERROR current ; + package -template CYGPKG_IO_FILEIO current ; + package -template CYGPKG_NET current ; + package -template CYGPKG_NET_OPENBSD_STACK current ; + package -template CYGPKG_NS_DNS current ; + package -template CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MICROWINDOWS current ; + package CYGPKG_FS_JFFS2 current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_SDL current ; + package CYGPKG_SMPEG current ; + package CYGPKG_FS_RAM current ; +}; + +cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + user_value arm-elf +}; + +cdl_option CYGPKG_IO_NFILE { + user_value 32 +}; + +cdl_component CYGPKG_INFRA_DEBUG { + user_value 1 +}; + +cdl_option CYGBLD_ISO_CTYPE_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILETYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_STREAMS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FILEACCESS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_CHAR_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_DIRECT_IO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDIO_ERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRERROR_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMER_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_CLOCK_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_TIMERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_CLOCKS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_NUMBERS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGNAL_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SIGSETJMP_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DIRENT_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREADTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PMUTEXTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_BSDTYPES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_UTSNAME_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_SEMAPHORES_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_IMPL_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_PTHREAD_MUTEX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_POSIX_LIMITS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_OPEN_MAX_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_NETDB_PROTO_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_NETDB_SERV_HEADER { + inferred_value 1 +}; + +cdl_option CYGIMP_KERNEL_SCHED_SORTED_QUEUES { + inferred_value 1 +}; + +cdl_option CYGNUM_KERNEL_SCHED_TIMESLICE_TICKS { + user_value 2 +}; + +cdl_option CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE { + inferred_value 1 +}; + +cdl_component CYGSEM_KERNEL_SCHED_ASR_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGSEM_KERNEL_SCHED_ASR_GLOBAL { + inferred_value 1 +}; + +cdl_option FOPEN_MAX { + user_value 32 +}; + +cdl_option CYGNUM_FILEIO_NFILE { + user_value 32 +}; + +cdl_option CYGNUM_FILEIO_NFD { + user_value 32 +}; + +cdl_component CYGPKG_IO_FILEIO_INODE { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_ECOS { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NANOWM { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NXKBD { + inferred_value 1 +}; + +cdl_option CYGBLD_MICROWINDOWS_NANOX_DEMOS { + inferred_value 1 +}; + +cdl_option CYGPKG_MICROWINDOWS_CFLAGS_ADD { + inferred_value "-I\$(PREFIX)/include/microwin -D__ECOS=1 -DMSDOS=0 -DELKS=0 -D__rtems__=0 -D_MINIX=0 -DNOTYET=0 -DUNIX=1 -DHAVE_FILEIO -DHAVE_BMP_SUPPORT=1 -DHAVE_PNM_SUPPORT=1 -DHAVE_XPM_SUPPORT=1 -DxHAVE_JPEG_SUPPORT=1 -DHAVESELECT=1 -DMWPIXEL_FORMAT=MWPF_TRUECOLOR565" +}; + +cdl_component CYGPKG_IO_FLASH_BLOCK_DEVICE { + inferred_value 1 +}; + +cdl_option CYGNUM_IO_FLASH_BLOCK_LENGTH_1 { + user_value 0x00200000 +}; + +cdl_option CYGSEM_SDL_FBCON_FORCEGRAREA { + inferred_value 1 +}; + +cdl_option CYGPKG_SDL_CFLAGS_ADD { + inferred_value "-I\$(PREFIX)/include/SDL -I\$(REPOSITORY)/\$(PACKAGE)/src/src -I\$(REPOSITORY)/\$(PACKAGE)/src/src/audio -I\$(REPOSITORY)/\$(PACKAGE)/src/src/events -I\$(REPOSITORY)/\$(PACKAGE)/src/src/joystick -I\$(REPOSITORY)/\$(PACKAGE)/src/src/thread -I\$(REPOSITORY)/\$(PACKAGE)/src/src/thread/ecos -I\$(REPOSITORY)/\$(PACKAGE)/src/src/timer -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video/fbcon -I\$(REPOSITORY)/\$(PACKAGE)/src/src/video/svga -DDISABLE_JOYSTICK -DDISABLE_CDROM -DUSE_INPUT_EVENTS -DSDL_USE_PTHREADS -DPTHREAD_NO_RECURSIVE_MUTEX -D__ECOS=1 -DENABLE_FBCON" +}; + +cdl_option CYGBLD_SMPEG_BUILD_PLAYMPEG { + inferred_value 1 +}; + +cdl_component CYGBLD_SMPEG_BUILD_TOYOTA_DEMO { + user_value 1 +}; + +cdl_option CYGFUN_SMPEG_BUILD_TOYOTA_DEMO_WINDOWED { + user_value 1 +}; + + diff --git a/packages/hal/arm/sa11x0/ipaq/current/src/atmel_support.c b/packages/hal/arm/sa11x0/ipaq/current/src/atmel_support.c --- a/packages/hal/arm/sa11x0/ipaq/current/src/atmel_support.c +++ b/packages/hal/arm/sa11x0/ipaq/current/src/atmel_support.c @@ -5,29 +5,38 @@ // SA1110/iPAQ - Atmel micro-controller support routines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -64,6 +73,8 @@ static cyg_handle_t atmel_interrupt_han #include // Interfaces, commands +externC void *memcpy(void *, const void *, size_t); + struct sa11x0_serial { volatile cyg_uint32 utcr0; volatile cyg_uint32 utcr1; @@ -82,7 +93,7 @@ int atmel_putq_put, atmel_putq_get; bool atmel_use_ints; -bool +void atmel_putc(unsigned char c) { atmel_putq[atmel_putq_put++] = c; @@ -325,6 +336,7 @@ atmel_send(int cmd, unsigned char *data, *dp = cksum; pkt.len = len + 3; atmel_pkt_send(&pkt); + return true; } #define MAX_TS_EVENTS 32 @@ -338,7 +350,6 @@ ts_event_handler(atmel_pkt *pkt) unsigned char *buf = pkt->data; static bool up = true; static int down_count = 0; - static short last_x, last_y; struct ts_event *tse; if (num_ts_events == MAX_TS_EVENTS) { @@ -452,7 +463,7 @@ key_get_event(struct key_event *ke) #ifdef CYGPKG_REDBOOT void -atmel_check(void) +atmel_check(bool is_idle) { } RedBoot_idle(atmel_check, RedBoot_BEFORE_NETIO); diff --git a/packages/hal/arm/sa11x0/ipaq/current/src/font.h b/packages/hal/arm/sa11x0/ipaq/current/src/font.h --- a/packages/hal/arm/sa11x0/ipaq/current/src/font.h +++ b/packages/hal/arm/sa11x0/ipaq/current/src/font.h @@ -5,29 +5,38 @@ // SA1110/iPAQ - LCD display font // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/ipaq/current/src/ipaq_misc.c b/packages/hal/arm/sa11x0/ipaq/current/src/ipaq_misc.c --- a/packages/hal/arm/sa11x0/ipaq/current/src/ipaq_misc.c +++ b/packages/hal/arm/sa11x0/ipaq/current/src/ipaq_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for StrongARM SA1110/iPAQ // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -66,6 +75,8 @@ // All the MM table layout is here: #include +#include // memset() + void hal_mmu_init(void) { @@ -154,9 +165,9 @@ plf_hardware_init(void) void plf_if_init(void) { -#ifdef CYGSEM_IPAQ_LCD_COMM // Initialize screen lcd_init(16); +#ifdef CYGSEM_IPAQ_LCD_COMM // Initialize I/O channel lcd_comm_init(); #endif diff --git a/packages/hal/arm/sa11x0/ipaq/current/src/kbd.xpm b/packages/hal/arm/sa11x0/ipaq/current/src/kbd.xpm --- a/packages/hal/arm/sa11x0/ipaq/current/src/kbd.xpm +++ b/packages/hal/arm/sa11x0/ipaq/current/src/kbd.xpm @@ -664,4 +664,4 @@ static char * keynum_xpm[] = { ".................................................................................................................................................................................................................................................", "................................................................................................................................................................................................................................................."}; -#endif \ No newline at end of file +#endif diff --git a/packages/hal/arm/sa11x0/ipaq/current/src/lcd_support.c b/packages/hal/arm/sa11x0/ipaq/current/src/lcd_support.c --- a/packages/hal/arm/sa11x0/ipaq/current/src/lcd_support.c +++ b/packages/hal/arm/sa11x0/ipaq/current/src/lcd_support.c @@ -5,29 +5,38 @@ // SA1110/iPAQ - LCD support routines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -59,6 +68,12 @@ # endif #endif +// Gross hack to force use of simple internal functions. +// Using libc sscanf fails (as far as I could tell from a quick look) +// when assertions are enabled because some of the C++ contructors have +// not been run yet. jskov +#undef CYGINT_ISO_STDIO_FORMATTED_IO + #ifndef FALSE #define FALSE 0 #define TRUE 1 @@ -162,6 +177,7 @@ static int if ((c >= 'a') && (c <= 'f')) { return (c - 'a') + 0x0a; } + return 0; } static int @@ -279,9 +295,9 @@ lcd_init(int depth) fp = (struct lcd_frame *)hal_virt_to_phys_address((cyg_uint32)lcd_frame_buffer); // Enable LCD in 320x240 16bpp *SA1110_DBAR1 = (unsigned long)&(fp->palette); - *SA1110_LCCR1 = 0x09100C00 + DISPLAY_WIDTH - 16; - *SA1110_LCCR2 = 0x08010C00 + DISPLAY_HEIGHT - 1; - *SA1110_LCCR3 = 0x0030000a; + *SA1110_LCCR1 = 0x0b100800 + DISPLAY_WIDTH - 16; + *SA1110_LCCR2 = 0x0a010400 + DISPLAY_HEIGHT - 1; + *SA1110_LCCR3 = 0x00300010; fp->palette[0] = 0x2000; // Tell controller true color / 16 bits *SA1110_LCCR0 = 0xB9; // Color ipaq_EGPIO(SA1110_EIO_LCD_3V3|SA1110_EIO_LCD_CTRL|SA1110_EIO_LCD_5V|SA1110_EIO_LCD_VDD, @@ -545,6 +561,7 @@ lcd_putc(cyg_int8 c) // Basic LCD 'printf()' support #include +#include #define is_digit(c) ((c >= '0') && (c <= '9')) @@ -578,6 +595,7 @@ lcd_vprintf(void (*putc)(cyg_int8), cons int left_prec, right_prec, zero_fill, length, pad, pad_on_right; char buf[32]; long val; + while ((c = *fmt0++)) { cp = buf; length = 0; @@ -680,6 +698,7 @@ lcd_vprintf(void (*putc)(cyg_int8), cons } } } + return 0; // Should be length of string written } int @@ -1163,6 +1182,7 @@ lcd_comm_isr(void *__ch_data, int* __ctr } return CYG_ISR_HANDLED; #endif + return 0; } static bool @@ -1262,6 +1282,8 @@ close(int c1, int c2) return (diff < 50); } +#define LCD_COMM_CHANNEL 1 // Logical I/O channel used for LCD/TS console + void lcd_comm_init(void) { @@ -1275,7 +1297,7 @@ lcd_comm_init(void) int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); // Setup procs in the vector table - CYGACC_CALL_IF_SET_CONSOLE_COMM(1); + CYGACC_CALL_IF_SET_CONSOLE_COMM(LCD_COMM_CHANNEL); comm = CYGACC_CALL_IF_CONSOLE_PROCS(); //CYGACC_COMM_IF_CH_DATA_SET(*comm, chan); CYGACC_COMM_IF_WRITE_SET(*comm, lcd_comm_write); @@ -1401,13 +1423,16 @@ lcd_comm_init(void) } } -// Control state of LCD display +// Control state of LCD display - only called by logical I/O layers void lcd_on(bool enable) { static bool enabled = true; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + if (cur != LCD_COMM_CHANNEL) + enable = false; // Only enable display if LCD is the active "console" if (enable) { if (!enabled) { ipaq_EGPIO(SA1110_EIO_LCD_3V3|SA1110_EIO_LCD_CTRL|SA1110_EIO_LCD_5V|SA1110_EIO_LCD_VDD, diff --git a/packages/hal/arm/sa11x0/ipaq/current/src/redboot_cmds.c b/packages/hal/arm/sa11x0/ipaq/current/src/redboot_cmds.c --- a/packages/hal/arm/sa11x0/ipaq/current/src/redboot_cmds.c +++ b/packages/hal/arm/sa11x0/ipaq/current/src/redboot_cmds.c @@ -5,29 +5,38 @@ // iPAQ [platform] specific RedBoot commands // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -52,24 +61,28 @@ #include // Exported CLI function(s) +static void do_gpio(int argc, char *argv[]); RedBoot_cmd("gpio", "Query and/or set the GPIO status", "[-s bits] [-c bits]", do_gpio ); +static void do_egpio(int argc, char *argv[]); RedBoot_cmd("egpio", "Query and/or set the EGPIO status", "[-s bits] [-c bits]", do_egpio ); +static void do_mem(int argc, char *argv[]); RedBoot_cmd("mem", "Set a memory location", "[-h|-b] [-a
] ", do_mem ); +static void do_physaddr(int argc, char *argv[]); RedBoot_cmd("physaddr", "Converts a virtual to a physical address", "
", @@ -190,6 +203,9 @@ do_physaddr(int argc, char *argv[]) { // be called from RedBoot every 10ms (CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) #define MAX_IDLE_TIME (30*100) +#ifdef CYGSEM_IPAQ_LCD_COMM +extern void lcd_on(bool); +#endif static void idle(bool is_idle) diff --git a/packages/hal/arm/sa11x0/nano/current/ChangeLog b/packages/hal/arm/sa11x0/nano/current/ChangeLog --- a/packages/hal/arm/sa11x0/nano/current/ChangeLog +++ b/packages/hal/arm/sa11x0/nano/current/ChangeLog @@ -1,3 +1,31 @@ +2002-05-14 Jesper Skov + + * src/nano_misc.c: Fixed warning. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_sa11x0_nano.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-03-06 Jesper Skov + + * misc/redboot_RAM.ecm: Updated. Added zlib. + * misc/redboot_ROM.ecm: Same. + +2002-01-30 Jonathan Larmour + + * include/nano.h (HAL_PCI_DO_CONFIG_ACCESS): If requesting vendor + config, check it isn't 0 or 256 which would be bogus - instead + this indicates the device is absent, e.g. the second eth controller + that is found on the commEngine, but not on the nanoEngine. + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + + * cdl/hal_arm_sa11x0_nano.cdl: Remove explicit plf_io.h + declaration. + 2001-05-02 Hugo Tyson * src/nano_misc.c (hal_mmu_init): Set up PCI memory in the new @@ -145,27 +173,36 @@ 2001-02-14 Hugo Tyson SA1110 CPU + 2x i82559 ethernets. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/arm/sa11x0/nano/current/cdl/hal_arm_sa11x0_nano.cdl b/packages/hal/arm/sa11x0/nano/current/cdl/hal_arm_sa11x0_nano.cdl --- a/packages/hal/arm/sa11x0/nano/current/cdl/hal_arm_sa11x0_nano.cdl +++ b/packages/hal/arm/sa11x0/nano/current/cdl/hal_arm_sa11x0_nano.cdl @@ -5,29 +5,38 @@ # ARM SA1110/nanoEngine platform HAL package configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # @@ -64,7 +73,6 @@ cdl_package CYGPKG_HAL_ARM_SA11X0_NANO { puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " puts $::cdl_system_header "#define CYGBLD_HAL_VARIANT_H " puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " - puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_IO_H " puts $::cdl_header "#define HAL_PLATFORM_CPU \"StrongARM 1110\"" puts $::cdl_header "#define HAL_PLATFORM_BOARD \"nanoEngine\"" puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"by Bright Star Engineering\"" @@ -154,24 +162,24 @@ cdl_package CYGPKG_HAL_ARM_SA11X0_NANO { chooses which port will be used to connect to a host running GDB." } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + calculated 0 + } cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { display "Diagnostic serial port" active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE flavor data legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 - default_value 0 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT description " The nanoEngine board has two serial ports. This option chooses which port will be used for diagnostic output." } - - cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { - display "Default console channel." - flavor data - legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 - calculated 0 - } cdl_component CYGBLD_GLOBAL_OPTIONS { display "Global build options" diff --git a/packages/hal/arm/sa11x0/nano/current/include/hal_platform_setup.h b/packages/hal/arm/sa11x0/nano/current/include/hal_platform_setup.h --- a/packages/hal/arm/sa11x0/nano/current/include/hal_platform_setup.h +++ b/packages/hal/arm/sa11x0/nano/current/include/hal_platform_setup.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/nano/current/include/nano.h b/packages/hal/arm/sa11x0/nano/current/include/nano.h --- a/packages/hal/arm/sa11x0/nano/current/include/nano.h +++ b/packages/hal/arm/sa11x0/nano/current/include/nano.h @@ -8,29 +8,38 @@ // Platform specific support (register layout, etc) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -191,8 +200,13 @@ CYG_MACRO_END cyg_uint32 __doaddr = HAL_PCI_CONFIG_ADDRESS( __bus, __devfn, __offset ); \ if ( 0xffffffffu == __doaddr ) \ __val = (__type)0xffffffffu; \ - else \ + else { \ __action( __doaddr, __val ); \ + /* nasty kludge to detect the absence of a second eth device on nanoEngines \ + * rather than commEngines. The vendor should never be 0 or 256. */ \ + if ( (__offset) == CYG_PCI_CFG_VENDOR && ((__val) == 0 || (__val) == 256) ) \ + __val = (__type)0xffffffffu; \ + } \ } // Read/write a value from the PCI configuration space of the appropriate diff --git a/packages/hal/arm/sa11x0/nano/current/include/plf_io.h b/packages/hal/arm/sa11x0/nano/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/nano/current/include/plf_io.h @@ -0,0 +1,60 @@ +#ifndef CYGONCE_HAL_ARM_SA11X0_NANO_PLF_IO_H +#define CYGONCE_HAL_ARM_SA11X0_NANO_PLF_IO_H + +/*============================================================================= +// +// plf_io.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#endif // CYGONCE_HAL_ARM_SA11X0_NANO_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/sa11x0/nano/current/include/plf_mmap.h b/packages/hal/arm/sa11x0/nano/current/include/plf_mmap.h --- a/packages/hal/arm/sa11x0/nano/current/include/plf_mmap.h +++ b/packages/hal/arm/sa11x0/nano/current/include/plf_mmap.h @@ -7,29 +7,38 @@ // Platform specific memory map support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/nano/current/misc/redboot_POST.ecm b/packages/hal/arm/sa11x0/nano/current/misc/redboot_POST.ecm --- a/packages/hal/arm/sa11x0/nano/current/misc/redboot_POST.ecm +++ b/packages/hal/arm/sa11x0/nano/current/misc/redboot_POST.ecm @@ -11,20 +11,52 @@ cdl_configuration eCos { description "" ; hardware nano ; template redboot ; - - # This causes the network to be enabled. + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_SA11X0 current ; + package -hardware CYGPKG_HAL_ARM_SA11X0_NANO current ; + package -hardware CYGPKG_IO_SERIAL_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_FLASH_NANO current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_ARM_NANO current ; + package -hardware CYGPKG_DEVS_ETH_INTEL_I82559 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_ETH_DRIVERS current ; - - # Flash logical driver - package CYGPKG_IO_FLASH current; - - package CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; }; cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_component CYGPKG_DEVS_ETH_ARM_NANO_ETH1 { + user_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { inferred_value 1 }; @@ -33,49 +65,80 @@ cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SU inferred_value 0 }; +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { inferred_value 0 0 }; -cdl_option CYGBLD_BUILD_REDBOOT { - user_value 1 -}; - cdl_component CYG_HAL_STARTUP { user_value ROM }; -### commented out here because it is calculated on this target -#cdl_component CYGBLD_HAL_STARTUP_ROM_POST_BEFORE_ECOS { -# user_value 1 -#}; +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGNUM_REDBOOT_FLASH_RESERVED_BASE { + user_value 0x40000 +}; + +cdl_option CYGOPT_REDBOOT_FIS_RESERVED_BASE { + user_value 1 +}; + +cdl_option CYGOPT_REDBOOT_FIS_REDBOOT { + user_value 0 +}; + +cdl_component CYGOPT_REDBOOT_FIS_REDBOOT_POST { + user_value 1 +}; + +cdl_option CYGNUM_REDBOOT_FIS_REDBOOT_POST_OFFSET { + user_value 1 0x40000 +}; + +cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP { + user_value 1 +}; -cdl_option CYGSEM_HAL_ROM_MONITOR { - user_value 1 +cdl_option CYGSEM_REDBOOT_ARM_LINUX_BOOT { + inferred_value 1 +}; + +cdl_option CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT { + inferred_value 0xC0008000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 }; -# now configuration of the Flash Image System initialization: -cdl_option CYGNUM_REDBOOT_FLASH_RESERVED_BASE { - user_value 0x40000 -} -cdl_option CYGOPT_REDBOOT_FIS_RESERVED_BASE { - user_value 1 -} -cdl_option CYGOPT_REDBOOT_FIS_REDBOOT { - user_value 0 ; # This platform supports only "POST" startup -} -cdl_component CYGOPT_REDBOOT_FIS_REDBOOT_POST { - user_value 1 -} -cdl_option CYGNUM_REDBOOT_FIS_REDBOOT_POST_OFFSET { - user_value 1 0x40000 -} -cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP { - user_value 1 -} - -# disable the 2nd ethernet device -cdl_option CYGPKG_DEVS_ETH_ARM_NANO_ETH1 { - user_value 0 -} diff --git a/packages/hal/arm/sa11x0/nano/current/misc/redboot_RAM.ecm b/packages/hal/arm/sa11x0/nano/current/misc/redboot_RAM.ecm --- a/packages/hal/arm/sa11x0/nano/current/misc/redboot_RAM.ecm +++ b/packages/hal/arm/sa11x0/nano/current/misc/redboot_RAM.ecm @@ -11,20 +11,52 @@ cdl_configuration eCos { description "" ; hardware nano ; template redboot ; - - # This causes the network to be enabled. + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_SA11X0 current ; + package -hardware CYGPKG_HAL_ARM_SA11X0_NANO current ; + package -hardware CYGPKG_IO_SERIAL_ARM_SA11X0 current ; + package -hardware CYGPKG_DEVS_FLASH_NANO current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_ARM_NANO current ; + package -hardware CYGPKG_DEVS_ETH_INTEL_I82559 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_ETH_DRIVERS current ; - - # Flash logical driver - package CYGPKG_IO_FLASH current; - - package CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; }; cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_component CYGPKG_DEVS_ETH_ARM_NANO_ETH1 { + user_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { inferred_value 1 }; @@ -37,35 +69,72 @@ cdl_option CYGSEM_HAL_USE_ROM_MONITOR { inferred_value 0 0 }; -cdl_option CYGBLD_BUILD_REDBOOT { - user_value 1 -}; - cdl_component CYG_HAL_STARTUP { user_value RAM }; -# now configuration of the Flash Image System initialization: +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + cdl_option CYGNUM_REDBOOT_FLASH_RESERVED_BASE { - user_value 0x40000 -} + user_value 0x40000 +}; + cdl_option CYGOPT_REDBOOT_FIS_RESERVED_BASE { - user_value 1 -} + user_value 1 +}; + cdl_option CYGOPT_REDBOOT_FIS_REDBOOT { - user_value 0 ; # This platform supports only "POST" startup -} + user_value 0 +}; + cdl_component CYGOPT_REDBOOT_FIS_REDBOOT_POST { - user_value 1 -} + user_value 1 +}; + cdl_option CYGNUM_REDBOOT_FIS_REDBOOT_POST_OFFSET { - user_value 1 0x40000 -} + user_value 1 0x40000 +}; + cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP { - user_value 1 -} + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_ARM_LINUX_BOOT { + inferred_value 1 +}; + +cdl_option CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT { + inferred_value 0xC0008000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; -# disable the 2nd ethernet device -cdl_option CYGPKG_DEVS_ETH_ARM_NANO_ETH1 { - user_value 0 -} +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/sa11x0/nano/current/src/nano_misc.c b/packages/hal/arm/sa11x0/nano/current/src/nano_misc.c --- a/packages/hal/arm/sa11x0/nano/current/src/nano_misc.c +++ b/packages/hal/arm/sa11x0/nano/current/src/nano_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for StrongARM SA1110/nanoEngine // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -67,6 +76,8 @@ cyg_uint32 cyg_pci_window_real_base = 0; #endif +externC void* memset(void *, int, size_t); + void hal_mmu_init(void) { diff --git a/packages/hal/arm/sa11x0/sa1100mm/current/ChangeLog b/packages/hal/arm/sa11x0/sa1100mm/current/ChangeLog --- a/packages/hal/arm/sa11x0/sa1100mm/current/ChangeLog +++ b/packages/hal/arm/sa11x0/sa1100mm/current/ChangeLog @@ -1,3 +1,16 @@ +2002-05-14 Jesper Skov + + * src/sa1100mm_misc.c (hal_mmu_init): Fixed warning. + +2002-05-07 Gary Thomas + + * cdl/hal_arm_sa11x0_sa1100mm.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-01-28 Jesper Skov + + * include/plf_io.h: Added. + 2001-04-16 Gary Thomas * cdl/hal_arm_sa11x0_sa1100mm.cdl: Need CDL for UART interfaces. @@ -80,27 +93,36 @@ 2000-10-25 Drew Moseley +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#endif // CYGONCE_HAL_ARM_SA11X0_SA1100MM_PLF_IO_H +// EOF plf_io.h diff --git a/packages/hal/arm/sa11x0/sa1100mm/current/include/plf_mmap.h b/packages/hal/arm/sa11x0/sa1100mm/current/include/plf_mmap.h --- a/packages/hal/arm/sa11x0/sa1100mm/current/include/plf_mmap.h +++ b/packages/hal/arm/sa11x0/sa1100mm/current/include/plf_mmap.h @@ -7,29 +7,38 @@ // Platform specific memory map support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/sa1100mm/current/include/sa1100mm.h b/packages/hal/arm/sa11x0/sa1100mm/current/include/sa1100mm.h --- a/packages/hal/arm/sa11x0/sa1100mm/current/include/sa1100mm.h +++ b/packages/hal/arm/sa11x0/sa1100mm/current/include/sa1100mm.h @@ -8,29 +8,38 @@ // Platform specific support (registers, etc) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/sa1100mm/current/src/sa1100mm_misc.c b/packages/hal/arm/sa11x0/sa1100mm/current/src/sa1100mm_misc.c --- a/packages/hal/arm/sa11x0/sa1100mm/current/src/sa1100mm_misc.c +++ b/packages/hal/arm/sa11x0/sa1100mm/current/src/sa1100mm_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for StrongARM SA1110/Multimedia // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -63,6 +72,8 @@ // All the MM table layout is here: #include +externC void* memset(void *, int, size_t); + void hal_mmu_init(void) { diff --git a/packages/hal/arm/sa11x0/var/current/ChangeLog b/packages/hal/arm/sa11x0/var/current/ChangeLog --- a/packages/hal/arm/sa11x0/var/current/ChangeLog +++ b/packages/hal/arm/sa11x0/var/current/ChangeLog @@ -1,3 +1,59 @@ +2002-05-18 Gary Thomas + + * src/hal_diag.c (cyg_hal_plf_serial_control): Fix return value + when changing the baud rate. + +2002-05-01 Gary Thomas + + * tests/mmap_test.c: Diagnostic prints for failure cases. + +2002-04-24 Jesper Skov + + * cdl/hal_arm_sa11x0.cdl: CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES added. + +2002-01-29 Jesper Skov + + * cdl/hal_arm_sa11x0.cdl: Removed CRUFT_H. + + * include/hal_sa11x0.h: Moved CYGARC_PHYSICAL_ADDRESS definition + to: + * include/var_io.h: this file. + +2002-01-28 Jesper Skov + + * cdl/hal_arm_sa11x0.cdl: Declare var_io.h file. + Tug RedBoot requirements away in a component properly controlled + by the RedBoot presence. + * include/var_io.h: Added. + +2002-01-25 Jesper Skov + + * include/hal_sa11x0.h (CYGARC_PHYSICAL_ADDRESS): Added. + + * src/redboot_linux_exec.c: Moved to arch directory. + * cdl/hal_arm_sa11x0.cdl: Replaced options with requirements to + arch options. + +2002-01-25 David Woodhouse + + * src/redboot_linux_exec.c (do_exec): Trick the compiler into + thinking that the end1 and lab1 labels are both actually used, + so it doesn't move them around. + +2002-01-22 David Woodhouse + + * src/redboot_linux_exec.c (do_exec): Pass ATAG_MEM to Linux + kernel, having tried to obtain the appropriate numbers from the + MLT header file. This could probably do with some improvement - + the actual information we need isn't necessarily present in the + required form. + +2002-01-14 David Woodhouse + + * src/redboot_linux_exec.c (do_exec): Use load start/end + parameters as defaults. Don't copy image if specified length is + zero. + 2001-10-31 Jonathan Larmour * cdl/hal_arm_sa11x0.cdl: Indicate support of variable baud rates. @@ -353,27 +409,36 @@ 2000-05-10 Gary Thomas " + puts $::cdl_header "#define CYGBLD_HAL_VAR_INTS_H " + puts $::cdl_system_header "#define CYGBLD_HAL_ARM_VAR_IO_H" + + puts $::cdl_header "#define CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES 1000000" } compile hal_diag.c sa11x0_misc.c @@ -135,24 +146,19 @@ cdl_package CYGPKG_HAL_ARM_SA11X0 { This option specifies the set of tests for the SA11x0 HAL." } - cdl_component CYGPKG_REDBOOT_SA11X0_OPTIONS { - display "Redboot for SA11x0 options" + + cdl_component CYGPKG_REDBOOT_HAL_SA11X0_OPTIONS { + display "Redboot HAL variant options" flavor none no_define parent CYGPKG_REDBOOT active_if CYGPKG_REDBOOT - description " - This option lists the target's requirements for a valid Redboot - configuration." - cdl_option CYGSEM_REDBOOT_SA11X0_LINUX_BOOT { - display "Support booting Linux via RedBoot" - flavor bool - default_value 1 - description " - This option enables RedBoot to support booting of a Linux kernel." - - compile -library=libextras.a redboot_linux_exec.c + # RedBoot details + requires { CYGSEM_REDBOOT_ARM_LINUX_BOOT } + requires { CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT == 0xc0008000 } + define_proc { + puts $::cdl_header "#define CYGHWR_REDBOOT_ARM_TRAMPOLINE_ADDRESS 0x00001f00" } } } diff --git a/packages/hal/arm/sa11x0/var/current/include/hal_cache.h b/packages/hal/arm/sa11x0/var/current/include/hal_cache.h --- a/packages/hal/arm/sa11x0/var/current/include/hal_cache.h +++ b/packages/hal/arm/sa11x0/var/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/var/current/include/hal_diag.h b/packages/hal/arm/sa11x0/var/current/include/hal_diag.h --- a/packages/hal/arm/sa11x0/var/current/include/hal_diag.h +++ b/packages/hal/arm/sa11x0/var/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/var/current/include/hal_mm.h b/packages/hal/arm/sa11x0/var/current/include/hal_mm.h --- a/packages/hal/arm/sa11x0/var/current/include/hal_mm.h +++ b/packages/hal/arm/sa11x0/var/current/include/hal_mm.h @@ -8,29 +8,38 @@ // ARM SA11x0 MM common definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/var/current/include/hal_sa11x0.h b/packages/hal/arm/sa11x0/var/current/include/hal_sa11x0.h --- a/packages/hal/arm/sa11x0/var/current/include/hal_sa11x0.h +++ b/packages/hal/arm/sa11x0/var/current/include/hal_sa11x0.h @@ -5,29 +5,38 @@ // HAL misc board support definitions for StrongARM SA11x0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/var/current/include/hal_var_ints.h b/packages/hal/arm/sa11x0/var/current/include/hal_var_ints.h --- a/packages/hal/arm/sa11x0/var/current/include/hal_var_ints.h +++ b/packages/hal/arm/sa11x0/var/current/include/hal_var_ints.h @@ -7,29 +7,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/var/current/include/plf_stub.h b/packages/hal/arm/sa11x0/var/current/include/plf_stub.h --- a/packages/hal/arm/sa11x0/var/current/include/plf_stub.h +++ b/packages/hal/arm/sa11x0/var/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/var/current/include/var_io.h b/packages/hal/arm/sa11x0/var/current/include/var_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/sa11x0/var/current/include/var_io.h @@ -0,0 +1,68 @@ +#ifndef CYGONCE_VAR_IO_H +#define CYGONCE_VAR_IO_H + +//============================================================================= +// +// var_io.h +// +// Variant specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Variant io definitions +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include // Platform specifics + +//----------------------------------------------------------------------------- + +// Memory mapping details +#ifndef CYGARC_PHYSICAL_ADDRESS +# define CYGARC_PHYSICAL_ADDRESS(x) (((unsigned long)x & 0x0FFFFFFF) + SA11X0_RAM_BANK0_BASE) +#endif + +//----------------------------------------------------------------------------- +// end of var_io.h +#endif // CYGONCE_VAR_IO_H diff --git a/packages/hal/arm/sa11x0/var/current/src/hal_diag.c b/packages/hal/arm/sa11x0/var/current/src/hal_diag.c --- a/packages/hal/arm/sa11x0/var/current/src/hal_diag.c +++ b/packages/hal/arm/sa11x0/var/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -251,7 +260,9 @@ cyg_hal_plf_serial_control(void *__ch_da break; case __COMMCTL_SETBAUD: chan->baud_rate = va_arg(ap, cyg_int32); + // Should we verify this value here? init_channel(chan); + ret = 0; break; case __COMMCTL_IRQ_ENABLE: irq_state = 1; diff --git a/packages/hal/arm/sa11x0/var/current/src/redboot_linux_exec.c b/packages/hal/arm/sa11x0/var/current/src/redboot_linux_exec.c deleted file mode 100644 --- a/packages/hal/arm/sa11x0/var/current/src/redboot_linux_exec.c +++ /dev/null @@ -1,362 +0,0 @@ -//========================================================================== -// -// redboot_linux_boot.c -// -// RedBoot command to boot Linux on StrongARM/SA11x0 -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####OTHERCOPYRIGHTBEGIN#### -// -// The structure definitions below are taken from include/asm-arm/setup.h in -// the Linux kernel, Copyright (C) 1997-1999 Russell King. Their presence -// here is for the express purpose of communication with the Linux kernel -// being booted and is considered 'fair use' by the original author and -// are included with his permission. -// -//####OTHERCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Russell King -// Date: 2001-02-20 -// Purpose: -// Description: -// -// This code is part of RedBoot (tm). -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include - -#include // Board definitions -#include -#include - -#ifdef HAL_PLATFORM_MACHINE_TYPE - -// Exported CLI function(s) -static void do_exec(int argc, char *argv[]); -RedBoot_cmd("exec", - "Execute an image - with MMU off", - "[-w timeout] [-b [-l ]]\n" - " [-r [-s ]]\n" - " [-c \"kernel command line\"] []", - do_exec - ); - -typedef void code_fun(void); -#define UNMAPPED_ADDR(x) (((unsigned long)x & 0x0FFFFFFF) + SA11X0_RAM_BANK0_BASE) - -// -// Parameter info for Linux kernel -// ** C A U T I O N ** This setup must match "asm-arm/setup.h" -// -// Info is passed at a fixed location, using a sequence of tagged -// data entries. -// - -typedef unsigned long u32; -typedef unsigned short u16; -typedef unsigned char u8; - -//========================================================================= -// From Linux - -#define ATAG_NONE 0x00000000 -struct tag_header { - u32 size; // Size of tag (hdr+data) in *longwords* - u32 tag; -}; - -#define ATAG_CORE 0x54410001 -struct tag_core { - u32 flags; /* bit 0 = read-only */ - u32 pagesize; - u32 rootdev; -}; - -#define ATAG_MEM 0x54410002 -struct tag_mem32 { - u32 size; - u32 start; -}; - -#define ATAG_VIDEOTEXT 0x54410003 -struct tag_videotext { - u8 x; - u8 y; - u16 video_page; - u8 video_mode; - u8 video_cols; - u16 video_ega_bx; - u8 video_lines; - u8 video_isvga; - u16 video_points; -}; - -#define ATAG_RAMDISK 0x54410004 -struct tag_ramdisk { - u32 flags; /* b0 = load, b1 = prompt */ - u32 size; - u32 start; -}; - -#define ATAG_INITRD 0x54410005 -struct tag_initrd { - u32 start; - u32 size; -}; - -#define ATAG_SERIAL 0x54410006 -struct tag_serialnr { - u32 low; - u32 high; -}; - -#define ATAG_REVISION 0x54410007 -struct tag_revision { - u32 rev; -}; - -#define ATAG_VIDEOLFB 0x54410008 -struct tag_videolfb { - u16 lfb_width; - u16 lfb_height; - u16 lfb_depth; - u16 lfb_linelength; - u32 lfb_base; - u32 lfb_size; - u8 red_size; - u8 red_pos; - u8 green_size; - u8 green_pos; - u8 blue_size; - u8 blue_pos; - u8 rsvd_size; - u8 rsvd_pos; -}; - -#define ATAG_CMDLINE 0x54410009 -struct tag_cmdline { - char cmdline[1]; -}; - -#define ATAG_ACORN 0x41000101 -struct tag_acorn { - u32 memc_control_reg; - u32 vram_pages; - u8 sounddefault; - u8 adfsdrives; -}; - -#define ATAG_MEMCLK 0x41000402 -struct tag_memclk { - u32 fmemclk; -}; - -struct tag { - struct tag_header hdr; - union { - struct tag_core core; - struct tag_mem32 mem; - struct tag_videotext videotext; - struct tag_ramdisk ramdisk; - struct tag_initrd initrd; - struct tag_serialnr serialnr; - struct tag_revision revision; - struct tag_videolfb videolfb; - struct tag_cmdline cmdline; - - /* - * Acorn specific - */ - struct tag_acorn acorn; - - /* - * DC21285 specific - */ - struct tag_memclk memclk; - } u; -}; - -// End of inclusion from -//========================================================================= - -static void -do_exec(int argc, char *argv[]) -{ - unsigned long entry; - unsigned long oldints; - code_fun *fun, *prg; - bool wait_time_set; - int wait_time, res, i; - bool base_addr_set, length_set, cmd_line_set; - bool ramdisk_addr_set, ramdisk_size_set; - unsigned long base_addr, length; - unsigned long ramdisk_addr, ramdisk_size; - struct option_info opts[6]; - char line[8]; - unsigned long *_prg, *ip; - char *cmd_line; - struct tag *params = (struct tag *)0x0100; - - entry = (unsigned long)UNMAPPED_ADDR(0xC0008000); // Default Linux execute address - base_addr = 0x8000; - ramdisk_size = 4096*1024; - init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, - (void **)&wait_time, (bool *)&wait_time_set, "wait timeout"); - init_opts(&opts[1], 'b', true, OPTION_ARG_TYPE_NUM, - (void **)&base_addr, (bool *)&base_addr_set, "base address"); - init_opts(&opts[2], 'l', true, OPTION_ARG_TYPE_NUM, - (void **)&length, (bool *)&length_set, "length"); - init_opts(&opts[3], 'c', true, OPTION_ARG_TYPE_STR, - (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line"); - init_opts(&opts[4], 'r', true, OPTION_ARG_TYPE_NUM, - (void **)&ramdisk_addr, (bool *)&ramdisk_addr_set, "ramdisk_addr"); - init_opts(&opts[5], 's', true, OPTION_ARG_TYPE_NUM, - (void **)&ramdisk_size, (bool *)&ramdisk_size_set, "ramdisk_size"); - if (!scan_opts(argc, argv, 1, opts, 6, (void *)&entry, OPTION_ARG_TYPE_NUM, "[physical] starting address")) - { - return; - } - - // Set up parameters to pass to kernel - if (cmd_line_set || ramdisk_addr_set) { - // CORE tag must be present & first - params->hdr.size = (sizeof(struct tag_core) + sizeof(struct tag_header))/sizeof(long); - params->hdr.tag = ATAG_CORE; - params->u.core.flags = 0; - params->u.core.pagesize = 0; - params->u.core.rootdev = 0; - params = (struct tag *)((long *)params + params->hdr.size); - } - if (ramdisk_addr_set) { - params->hdr.size = (sizeof(struct tag_initrd) + sizeof(struct tag_header))/sizeof(long); - params->hdr.tag = ATAG_INITRD; - params->u.initrd.start = UNMAPPED_ADDR(ramdisk_addr); - params->u.initrd.size = ramdisk_size; - params = (struct tag *)((long *)params + params->hdr.size); - } - if (cmd_line_set) { -// Round up a quantity to a longword (32 bit) length -#define ROUNDUP(n) (((n)+3)&~3) - params->hdr.size = (ROUNDUP(strlen(cmd_line)) + sizeof(struct tag_header))/sizeof(long); - params->hdr.tag = ATAG_CMDLINE; - strcpy(params->u.cmdline.cmdline, cmd_line); - params = (struct tag *)((long *)params + params->hdr.size); - } - // Mark end of parameter list - params->hdr.size = 0; - params->hdr.tag = ATAG_NONE; - - if (wait_time_set) { - int script_timeout_ms = wait_time * 1000; -#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT - unsigned char *hold_script = script; - script = (unsigned char *)0; -#endif - diag_printf("About to start execution at %p - abort with ^C within %d seconds\n", - (void *)entry, wait_time); - while (script_timeout_ms >= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) { - res = _rb_gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT); - if (res == _GETS_CTRLC) { -#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT - script = hold_script; // Re-enable script -#endif - return; - } - script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT; - } - } - if (base_addr_set && !length_set) { - diag_printf("Length required for non-standard base address\n"); - return; - } - ip = (unsigned long *)&&lab1; - _prg = (unsigned long *)0x1F00; // Should be a very safe location to execute from - fun = (code_fun *)entry; - prg = (code_fun *)UNMAPPED_ADDR(_prg); - base_addr = UNMAPPED_ADDR(base_addr); - for (i = 0; i < (unsigned long)&&end1-(unsigned long)&&lab1; i++) { - *_prg++ = *ip++; - } - HAL_DISABLE_INTERRUPTS(oldints); - HAL_DCACHE_SYNC(); - HAL_ICACHE_DISABLE(); - HAL_DCACHE_DISABLE(); - HAL_DCACHE_SYNC(); - HAL_ICACHE_INVALIDATE_ALL(); - HAL_DCACHE_INVALIDATE_ALL(); - // Now call this code - asm volatile ("mov r5,%0;" - "mov r2,%1;" - "mov r3,%2;" - "mov r1,%3;" - "mov r7,%4;" - "ldr r6,=0xC0008000;" // Unmapped address Linux wants to load at - "mov pc,r1" : : - "r"(fun),"r"(base_addr),"r"(length),"r"(prg),"r"(HAL_PLATFORM_MACHINE_TYPE) : - "r7","r6","r5","r2","r3","r1"); - lab1: - // Tricky code. We are currently running with the MMU on and the - // memory map convoluted from 1-1. This code must be copied to RAM - // and then executed at the non-mapped address. Then when the code - // turns off the MMU, the control flow is unchanged and control can - // be passed safely to the program to be executed. - // This magic was created in order to be able to execute standard - // Linux kernels with as little change/perturberance as possible. - asm volatile ("mrs r1,cpsr;" - "bic r0,r1,#0x1F;" // Put processor in IRQ mode - "orr r0,r0,#0x12;" - "msr cpsr,r0;" - "msr spsr,r1;" - "mov lr,r5;" - "mov sp,r5;" // Give the kernel a stack just below the entry point - "mov r1,#0;" - "mcr p15,0,r1,c1,c0;" // Turns off MMU, caches - "nop;nop;nop;" - "cmp r2,r6;" // Default kernel load address - "beq 10f;" - "05:;" - "ldr r4,[r2],#4;" - "str r4,[r6],#4;" - "sub r3,r3,#4;" - "cmp r3,#0;" - "bne 05b;" - "10:;" - "mov r0,#0;" // Set up SA11x0[Assabet] load magic - "mov r1,r7;" - "movs pc,lr" : : ); - end1: -} - -#endif // HAL_PLATFORM_MACHINE_TYPE - otherwise we do not support this stuff... - -// EOF redboot_linux_exec.c diff --git a/packages/hal/arm/sa11x0/var/current/src/sa11x0_misc.c b/packages/hal/arm/sa11x0/var/current/src/sa11x0_misc.c --- a/packages/hal/arm/sa11x0/var/current/src/sa11x0_misc.c +++ b/packages/hal/arm/sa11x0/var/current/src/sa11x0_misc.c @@ -5,29 +5,38 @@ // HAL misc board support code for StrongARM SA11x0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/arm/sa11x0/var/current/tests/mmap_test.c b/packages/hal/arm/sa11x0/var/current/tests/mmap_test.c --- a/packages/hal/arm/sa11x0/var/current/tests/mmap_test.c +++ b/packages/hal/arm/sa11x0/var/current/tests/mmap_test.c @@ -5,29 +5,38 @@ // Memory mapping test for ARM SA11x0 platforms // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -238,11 +247,13 @@ cyg_start( void ) if ( p1 ) { vpcount++; // Then there is a physical address for this virtual address + if (p1 != p2) diag_printf("v1: %p, p1: %p, p2: %p\n", v1, p1, p2); CYG_TEST_CHECK( p1 == p2, "Scan: truly mapped physical address mismatch" ); v3 = hal_phys_to_virt_address( p2 ); HAL_PHYS_TO_VIRT_ADDRESS( p2, v2 ); + if (v2 != v3) diag_printf("v1: %p, p1: %p, v2: %p, v3: %p\n", v1, p1, v2, v3); CYG_TEST_CHECK( v3 == v2, "Scan: backmapped virtual address mismatch" ); // But the virtual address might be elsewhere, ie. a cached @@ -251,6 +262,7 @@ cyg_start( void ) // Then it is [also] elsewhere, apparently. Check that its // otherness maps right back to this physical address. p1 = hal_virt_to_phys_address( v2 ); + if (p1 != p2) diag_printf("v1: %p, p1: %p, p2: %p\n", v1, p1, p2); CYG_TEST_CHECK( p1 == p2, "Scan: phys(virt(phys(x))) mismatch" ); } @@ -261,6 +273,7 @@ cyg_start( void ) if ( p1 ) { uncachedcount++; // Then there is an uncached address for this virtual address + if (p1 != p2) diag_printf("v1: %p, p1: %p, p2: %p\n", v1, p1, p2); CYG_TEST_CHECK( p1 == p2, "Uncached address of stackmem mismatch" ); } diff --git a/packages/hal/arm/snds/current/ChangeLog b/packages/hal/arm/snds/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/ChangeLog @@ -0,0 +1,113 @@ +2002-05-07 Gary Thomas + + * cdl/hal_arm_snds.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2001-12-06 Jesper Skov + + * include/hal_platform_setup.h (PLATFORM_SETUP1): Don't trust the + syscfg SDRAM request bit as suggested by manual - always set it to + what works. Use relative loads to get a pointer to the tables with + system controller setup data. + + * src/snds100_misc.c: Don't mess up the syscfg register. + +2001-10-19 Jesper Skov + + * include/plf_io.h (KS32C_REFEXTCON): Split in DRAM and SDRAM + settings. + + * include/hal_platform_setup.h: Fix KS32C_REFEXTCON parameters, + and set some LEDs to help debugging. + + * cdl/hal_arm_snds.cdl: On the SNDS100 board the CPU runs at + 50MHZ. + + * include/pkgconf/mlt_arm_snds_rom.ldi: Moved flash to + 0x01800000. + * include/pkgconf/mlt_arm_snds_rom.mlt: Same. + * include/pkgconf/mlt_arm_snds_rom.h: Same. + + * include/hal_platform_setup.h: Added LED macro. Use relative + branch in reset vector. Moved flash to 0x01800000. + +2001-10-18 Jesper Skov + + * src/hal_diag.c: Definition names updated. + * src/snds100_misc.c: Same. + + * include/pkgconf/mlt_arm_snds_rom.ldi: Added. + * include/pkgconf/mlt_arm_snds_rom.mlt: Same. + * include/pkgconf/mlt_arm_snds_rom.h: Same. + + * include/pkgconf/mlt_arm_snds_ram.ldi: Updated layout. + * include/pkgconf/mlt_arm_snds_ram.mlt: Same. + * include/pkgconf/mlt_arm_snds_ram.h: Same. + + * include/hal_platform_setup.h: Fixed instruction typo. + + * include/hal_platform_ints.h: Vector definitions renamed to match + those in E7T HAL. + + * include/hal_cache.h: Replaced with E7T HAL version. + + * cdl/hal_arm_snds.cdl: Added default baud rate option, ROM + startup mode, and removed PID tools make rules. + +2001-10-12 Jesper Skov + + * src/hal_diag.c: Copied here from E7T HAL. + * src/snds100_misc.c: Functions replaced with E7T HAL + versions. + + * include/plf_io.h: Added. + + * include/hal_platform_setup.h (PLATFORM_SETUP1): Code matching + board mon. + +2001-10-05 Jonathan Larmour + + * include/hal_cache.h: Don't define cache dimensions at all rather + than using 0. + +2001-08-22 Gary Thomas + + * src/snds100_misc.c: + * src/hal_diag.c: + printf() is no longer a part of RedBoot. Thus all programs + must use diag_printf() and related functions instead. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/arm/snds/current/cdl/hal_arm_snds.cdl b/packages/hal/arm/snds/current/cdl/hal_arm_snds.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/cdl/hal_arm_snds.cdl @@ -0,0 +1,389 @@ +#========================================================================== +# +# hal_arm_snds.cdl +# +# +# +#========================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +#========================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Contributors: gthomas, jskov +# Grant Edwards +# Date: 2001-07-31 +# Purpose: +# Description: +# +#####DESCRIPTIONEND#### +# +#========================================================================*/ + + +cdl_package CYGPKG_HAL_ARM_SNDS { + display "Samsung SNDS Evaluation Board" + parent CYGPKG_HAL_ARM + define_header hal_arm_snds.h + include_dir cyg/hal + hardware + description " + The SNDS HAL package provides the support needed to run + eCos on a Samsung SNDS Eval board" + + compile hal_diag.c snds100_misc.c + + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_ARM_ARCH_ARM7 + implements CYGINT_HAL_ARM_THUMB_ARCH + # FIXME: Add endian option + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "" + puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM 7TDMI\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"Samsung SNDS\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + puts $::cdl_header "" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM"} + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the SNDS board it is possible to build + the system for either RAM bootstrap or ROM bootstrap. + RAM bootstrap generally requires that the board + is equipped with ROMs containing a suitable ROM monitor or + equivalent software that allows GDB to download the eCos + application on to the board. The ROM bootstrap typically + requires that the eCos application be blown into EPROMs or + equivalent technology." + } + + cdl_component CYG_HAL_CPUTYPE { + display "cpu type" + flavor data + legal_values {"KS32C5000A" "S3C4510A"} + default_value {"S3C4510A"} + no_define + define -file system.h CYG_HAL_CPUTYPE + description "Which version of processor is on board." + } + + cdl_component CYGNUM_HAL_CPUCLOCK { + display "cpu clock" + flavor data + legal_values 10000000 to 100000000 + default_value 50000000 + no_define + define -file system.h CYGNUM_HAL_CPUCLOCK + description "Frequency of cpu clock in Hz." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of diag/debug communication channels on the board" + flavor data + calculated 2 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description "The SNDS board has two diag/debug + serial ports. This option chooses which port will + be used to connect to a host running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + The SNDS board has two diag/debug serial ports. This option + chooses which port will be used for diagnostic output." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD { + display "Console/GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option controls the default baud rate used for the + Console/GDB connection." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants" + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated (CYGNUM_HAL_CPUCLOCK/CYGNUM_HAL_RTC_DENOMINATOR) + } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "arm-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + if {1} { + default_value { (CYGHWR_THUMB && CYGHWR_HAL_ARM_BIGENDIAN) ? "-mthumb-interwork -mbig-endian -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : + CYGHWR_THUMB ? "-mthumb-interwork -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : + (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -mbig-endian -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : + (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && ! CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : + (CYGHWR_HAL_ARM_CPU_FAMILY != "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm7tdmi -mbig-endian -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : + "-mcpu=arm7tdmi -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + } else { + default_value { (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -mbig-endian -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : + (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && ! CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : + (CYGHWR_HAL_ARM_CPU_FAMILY != "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm7tdmi -mbig-endian -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : + "-mcpu=arm7tdmi -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + } + description " + This option controls the global compiler flags which are used to + compile all packages by default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + if {1} { + default_value { (CYGHWR_THUMB && CYGHWR_HAL_ARM_BIGENDIAN) ? "-mthumb-interwork -mbig-endian -g -nostdlib -Wl,--gc-sections -Wl,-static" : + CYGHWR_THUMB ? "-mthumb-interwork -g -nostdlib -Wl,--gc-sections -Wl,-static" : + (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -mbig-endian -g -nostdlib -Wl,--gc-sections -Wl,-static" : + (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && ! CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -g -nostdlib -Wl,--gc-sections -Wl,-static" : + (CYGHWR_HAL_ARM_CPU_FAMILY != "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm7tdmi -mbig-endian -g -nostdlib -Wl,--gc-sections -Wl,-static" : + "-mcpu=arm7tdmi -g -nostdlib -Wl,--gc-sections -Wl,-static" } + } else { + default_value { (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -mbig-endian -g -nostdlib -Wl,--gc-sections -Wl,-static" : + (CYGHWR_HAL_ARM_CPU_FAMILY == "ARM9") && ! CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm9 -g -nostdlib -Wl,--gc-sections -Wl,-static" : + (CYGHWR_HAL_ARM_CPU_FAMILY != "ARM9") && CYGHWR_HAL_ARM_BIGENDIAN ? "-mcpu=arm7tdmi -mbig-endian -g -nostdlib -Wl,--gc-sections -Wl,-static" : + "-mcpu=arm7tdmi -g -nostdlib -Wl,--gc-sections -Wl,-static" } + } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "arm_snds_ram" : \ + "arm_snds_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + ""} + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + ""} + } + } + + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_component CYGPKG_CYGMON_HAL_OPTIONS { + display "CygMon HAL options" + flavor none + no_define + parent CYGPKG_CYGMON + active_if CYGPKG_CYGMON + requires CYGPKG_IO_SERIAL_ARM_SNDS + requires {(CYGDAT_CYGMON_CONSOLE_DEV != "\"/dev/ser0\"") || \ + (CYGPKG_IO_SERIAL_ARM_SNDS_SERIAL0 && \ + (CYGNUM_IO_SERIAL_ARM_SNDS_SERIAL0_BUFSIZE == 512))} + requires {(CYGDAT_CYGMON_CONSOLE_DEV != "\"/dev/ser1\"") || \ + (CYGPKG_IO_SERIAL_ARM_SNDS_SERIAL1 && \ + (CYGNUM_IO_SERIAL_ARM_SNDS_SERIAL1_BUFSIZE == 512))} + description " + This option also lists the target's requirements for a valid CygMon + configuration." + + + cdl_option CYGDAT_CYGMON_CONSOLE_DEV { + display "Serial port for default console" + flavor data + default_value { "\"/dev/ser0\"" } + description " + This option selects the physical device to use as the default + console device for CygMon." + + } + + cdl_option CYGBLD_BUILD_CYGMON_BIN { + display "Build CygMon ROM binary image" + active_if CYGBLD_BUILD_CYGMON + default_value 1 + no_define + description "This option enables the conversion of the CygMon ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + /bin/cygmon.bin : /bin/cygmon.elf + $(OBJCOPY) --strip-debug --change-addresses=0xFC060000 $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } + +} diff --git a/packages/hal/arm/snds/current/include/hal_cache.h b/packages/hal/arm/snds/current/include/hal_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/hal_cache.h @@ -0,0 +1,291 @@ +#ifndef CYGONCE_HAL_CACHE_H +#define CYGONCE_HAL_CACHE_H +//============================================================================= +// +// hal_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors: nickg, gthomas +// Date: 1998-09-28 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include + +//----------------------------------------------------------------------------- +// Cache dimensions - one unified cache + +#define HAL_CACHE_UNIFIED + +#define HAL_UCACHE_SIZE 0x2000 // Size of cache in bytes +#define HAL_UCACHE_LINE_SIZE 16 // Size of a cache line +#define HAL_UCACHE_WAYS 2 // Associativity of the cache + +#define HAL_UCACHE_SETS (HAL_UCACHE_SIZE/(HAL_UCACHE_LINE_SIZE*HAL_UCACHE_WAYS)) + +//----------------------------------------------------------------------------- +// Global control of cache + +// Enable the cache +#define HAL_UCACHE_ENABLE() \ + CYG_MACRO_START \ + cyg_uint32 syscfg; \ + HAL_READ_UINT32(KS32C_SYSCFG, syscfg); \ + syscfg |= KS32C_SYSCFG_CE; \ + HAL_WRITE_UINT32(KS32C_SYSCFG, syscfg); \ + CYG_MACRO_END + +// Disable the cache +#define HAL_UCACHE_DISABLE() \ + CYG_MACRO_START \ + cyg_uint32 syscfg; \ + HAL_READ_UINT32(KS32C_SYSCFG, syscfg); \ + syscfg &= ~KS32C_SYSCFG_CE; \ + HAL_WRITE_UINT32(KS32C_SYSCFG, syscfg); \ + CYG_MACRO_END + +// Invalidate the entire cache +#define HAL_UCACHE_INVALIDATE_ALL() \ + CYG_MACRO_START \ + register cyg_uint32* tag = (cyg_uint32*)KS32C_CACHE_TAG_ADDR; \ + register int i; \ + for (i = 0; i < HAL_UCACHE_SETS/4; i++) { \ + *tag++ = 0; \ + *tag++ = 0; \ + *tag++ = 0; \ + *tag++ = 0; \ + } \ + CYG_MACRO_END + +// Synchronize the contents of the cache with memory. +// No action necessary. Cache is write-through. +#define HAL_UCACHE_SYNC() + +// Query the state of the cache +#define HAL_UCACHE_IS_ENABLED(_state_) \ + CYG_MACRO_START \ + cyg_uint32 syscfg; \ + HAL_READ_UINT32(KS32C_SYSCFG, syscfg); \ + (_state_) = (syscfg & KS32C_SYSCFG_CE) ? 1 : 0; \ + CYG_MACRO_END + +// Purge contents of cache +#define HAL_UCACHE_PURGE_ALL() HAL_UCACHE_INVALIDATE_ALL() + +// Set the cache refill burst size +//#define HAL_UCACHE_BURST_SIZE(_size_) + +// Set the cache write mode +//#define HAL_UCACHE_WRITE_MODE( _mode_ ) + +//#define HAL_UCACHE_WRITETHRU_MODE 0 +//#define HAL_UCACHE_WRITEBACK_MODE 1 + +// Load the contents of the given address range into the cache +// and then lock the cache so that it stays there. +//#define HAL_UCACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_UCACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_UCACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_UCACHE_ALLOCATE( _base_ , _size_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +//#define HAL_UCACHE_FLUSH( _base_ , _size_ ) + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_UCACHE_INVALIDATE( _base_ , _size_ ) + +// Write dirty cache lines to memory for the given address range. +//#define HAL_UCACHE_STORE( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_UCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_UCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_UCACHE_ZERO( _base_ , _size_ ) + +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data and instruction cache macros map onto the both-cache macros + +//----------------------------------------------------------------------------- +// Global control of data cache + +#define HAL_DCACHE_SIZE HAL_UCACHE_SIZE +#define HAL_DCACHE_LINE_SIZE HAL_UCACHE_LINE_SIZE +#define HAL_DCACHE_WAYS HAL_UCACHE_WAYS +#define HAL_DCACHE_SETS HAL_UCACHE_SETS + +// Enable the data cache +#define HAL_DCACHE_ENABLE() HAL_UCACHE_ENABLE() + +// Disable the data cache +#define HAL_DCACHE_DISABLE() HAL_UCACHE_DISABLE() + +// Invalidate the entire cache +#define HAL_DCACHE_INVALIDATE_ALL() HAL_UCACHE_INVALIDATE_ALL() + +// Synchronize the contents of the cache with memory. +#define HAL_DCACHE_SYNC() HAL_UCACHE_SYNC() + +// Query the state of the data cache +#define HAL_DCACHE_IS_ENABLED(_state_) HAL_UCACHE_IS_ENABLED(_state_) + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_size_) + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) + +//#define HAL_DCACHE_WRITETHRU_MODE 0 +//#define HAL_DCACHE_WRITEBACK_MODE 1 + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +//#define HAL_DCACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_DCACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_DCACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +//#define HAL_DCACHE_FLUSH( _base_ , _size_ ) + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) + +// Write dirty cache lines to memory for the given address range. +//#define HAL_DCACHE_STORE( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_DCACHE_ZERO( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +// Global control of Instruction cache + +#define HAL_ICACHE_SIZE HAL_UCACHE_SIZE +#define HAL_ICACHE_LINE_SIZE HAL_UCACHE_LINE_SIZE +#define HAL_ICACHE_WAYS HAL_UCACHE_WAYS +#define HAL_ICACHE_SETS HAL_UCACHE_SETS + +// Enable the instruction cache +#define HAL_ICACHE_ENABLE() HAL_UCACHE_ENABLE() + +// Disable the instruction cache +#define HAL_ICACHE_DISABLE() HAL_UCACHE_DISABLE() + +// Invalidate the entire cache +#define HAL_ICACHE_INVALIDATE_ALL() HAL_UCACHE_INVALIDATE_ALL() + + +// Synchronize the contents of the cache with memory. +#define HAL_ICACHE_SYNC() HAL_UCACHE_SYNC() + +// Query the state of the instruction cache +#define HAL_ICACHE_IS_ENABLED(_state_) HAL_UCACHE_IS_ENABLED(_state_) + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_size_) + +// Load the contents of the given address range into the instruction cache +// and then lock the cache so that it stays there. + +//#define HAL_ICACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_ICACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_ICACHE_INVALIDATE( _base_ , _size_ ) + +#endif // ifndef CYGONCE_HAL_CACHE_H +// End of hal_cache.h diff --git a/packages/hal/arm/snds/current/include/hal_diag.h b/packages/hal/arm/snds/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/hal_diag.h @@ -0,0 +1,83 @@ +//========================================================================== +// +// hal_diag.h +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#ifndef CYGONCE_HAL_DIAG_H +#define CYGONCE_HAL_DIAG_H + +#include +#include + +#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +//// Not the best place for this, but ... +extern void hal_delay_us(cyg_int32 usecs); +#define HAL_DELAY_US(n) hal_delay_us(n); + +#else // old way of doing diagnostic I/O + +externC void hal_diag_init(void); +externC void hal_diag_write_char(char c); +externC void hal_diag_read_char(char *c); + +#define HAL_DIAG_INIT() hal_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +#endif // defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) +#endif /* CYGONCE_HAL_DIAG_H */ diff --git a/packages/hal/arm/snds/current/include/hal_platform_ints.h b/packages/hal/arm/snds/current/include/hal_platform_ints.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/hal_platform_ints.h @@ -0,0 +1,108 @@ +#ifndef CYGONCE_HAL_PLATFORM_INTS_H +#define CYGONCE_HAL_PLATFORM_INTS_H +//========================================================================== +// +// hal_platform_ints.h +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#define CYGNUM_HAL_INTERRUPT_EXT0 0 +#define CYGNUM_HAL_INTERRUPT_EXT1 1 +#define CYGNUM_HAL_INTERRUPT_EXT2 2 +#define CYGNUM_HAL_INTERRUPT_EXT3 3 +#define CYGNUM_HAL_INTERRUPT_UART0_TX 4 +#define CYGNUM_HAL_INTERRUPT_UART0_RX 5 +#if !defined(CYG_HAL_CPUTYPE) +#error CYG_HAL_CPUTYPE not defined +#endif +#if defined(CYG_HAL_CPUTYPE_KS32C5000A) +#define CYGNUM_HAL_INTERRUPT_UART0_ERR 6 +#define CYGNUM_HAL_INTERRUPT_UART1_TX 7 +#define CYGNUM_HAL_INTERRUPT_UART1_RX 8 +#define CYGNUM_HAL_INTERRUPT_UART1_ERR 9 +#define CYGNUM_HAL_INTERRUPT_DMA0 10 +#define CYGNUM_HAL_INTERRUPT_DMA1 11 +#define CYGNUM_HAL_INTERRUPT_TIMER0 12 +#define CYGNUM_HAL_INTERRUPT_TIMER1 13 +#define CYGNUM_HAL_INTERRUPT_HDLCA 14 +#define CYGNUM_HAL_INTERRUPT_HDLCB 15 +#else +#define CYGNUM_HAL_INTERRUPT_UART1_TX 6 +#define CYGNUM_HAL_INTERRUPT_UART1_RX 7 +#define CYGNUM_HAL_INTERRUPT_DMA0 8 +#define CYGNUM_HAL_INTERRUPT_DMA1 9 +#define CYGNUM_HAL_INTERRUPT_TIMER0 10 +#define CYGNUM_HAL_INTERRUPT_TIMER1 11 +#define CYGNUM_HAL_INTERRUPT_HDLCA_TX 12 +#define CYGNUM_HAL_INTERRUPT_HDLCA_RX 13 +#define CYGNUM_HAL_INTERRUPT_HDLCB_TX 14 +#define CYGNUM_HAL_INTERRUPT_HDLCB_RX 15 +#endif +#define CYGNUM_HAL_INTERRUPT_ETH_BDMA_TX 16 +#define CYGNUM_HAL_INTERRUPT_ETH_BDMA_RX 17 +#define CYGNUM_HAL_INTERRUPT_ETH_MAC_TX 18 +#define CYGNUM_HAL_INTERRUPT_ETH_MAC_RX 19 +#define CYGNUM_HAL_INTERRUPT_I2C 20 + +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX 20 +#define CYGNUM_HAL_ISR_COUNT 21 + +// The vector used by the Real time clock + +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_TIMER0 + +//---------------------------------------------------------------------------- +// Reset. +#define HAL_PLATFORM_RESET() + +#define HAL_PLATFORM_RESET_ENTRY 0x01010000 + +#endif // CYGONCE_HAL_PLATFORM_INTS_H diff --git a/packages/hal/arm/snds/current/include/hal_platform_setup.h b/packages/hal/arm/snds/current/include/hal_platform_setup.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/hal_platform_setup.h @@ -0,0 +1,328 @@ +#ifndef CYGONCE_HAL_PLATFORM_SETUP_H +#define CYGONCE_HAL_PLATFORM_SETUP_H +//========================================================================== +// +// hal_platform_setup.h +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +// does normal DRAM setup, which doesn't fail?!?! + +#include + +#define CYGHWR_LED_MACRO \ + ldr r0,=KS32C_IOPDATA ;\ + mov r1, #((255 & (~(\x)))) ;\ + str r1, [r0] ; + +#if CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE==4096 +// Override default to a more sensible value +#undef CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE +#define CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE 2048 +#endif + +// Use relative branch since we are going to switch the address space +// around. +#define CYGSEM_HAL_ROM_RESET_USES_JUMP + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +#define PLATFORM_SETUP1 \ + ldr r1,=KS32C_IOPMOD ;\ + ldr r2,=0xff /* set led display to output */ ;\ + str r2,[r1,#0x00] ;\ + LED 0xaa ;\ + ;\ + /* Normal DRAM mode */ ;\ + ldr r3, =0x03ffff90 /* cache+wb disabled, regs @ 0x03ff0000 */;\ + ldr r0, =KS32C_SYSCFG ;\ + str r3,[r0] ;\ + ldr lr,=10f ;\ +1: mov r1,pc ;\ + sub r1,r1,#8 ;\ + ldr r0,=1b ;\ + sub r1,r1,r0 ;\ + ldr r0,=30f ;\ + add r0,r0,r1 ;\ + ldmia r0,{r1-r12} ;\ + ldr r0,=KS32C_EXTDBWTH ;\ + stmia r0,{r1-r12} ;\ + mov pc,lr ;\ +10: LED 0x80 ;\ + \ + /* Check that it worked, otherwise try Sync DRAM setup */ ;\ + ldr r1,=0x00000000 ;\ + str r1,[r1] ;\ + ldr r2,[r1] ;\ + cmp r2,r1 ;\ + beq 99f ;\ + \ + /* Sync DRAM mode */ ;\ + LED 0x81 ;\ + ldr r3, =0x83ffff90 /* sdram c+wb disabled, regs @ 0x03ff0000 */;\ + ldr r0, =KS32C_SYSCFG ;\ + str r3,[r0] ;\ + ldr lr,=99f ;\ +1: mov r1,pc ;\ + sub r1,r1,#8 ;\ + ldr r0,=1b ;\ + sub r1,r1,r0 ;\ + ldr r0,=40f ;\ + add r0,r0,r1 ;\ + ldmia r0,{r1-r12} ;\ + ldr r0,=KS32C_EXTDBWTH ;\ + stmia r0,{r1-r12} ;\ + mov pc,lr ;\ + ;\ + /* The below are set with a store-multiple instruction */ ;\ + ;\ + /* Normal DRAM setup */ ;\ + /* Flash is 16 bit, everything else 32 bit */ ;\ + /* .long KS32C_EXTDBWTH */ ;\ +30: .long ( (KS32C_EXTDBWTH_16BIT<> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x01880000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_ROMCON1 */ ;\ + .long ( (KS32C_ROMCON_PMC_ROM) \ + |(KS32C_ROMCON_TPA_5C) \ + |(KS32C_ROMCON_TACC_5C) \ + |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_ROMCON2 */ ;\ + .long ( (KS32C_ROMCON_PMC_ROM) \ + |(KS32C_ROMCON_TPA_5C) \ + |(KS32C_ROMCON_TACC_5C) \ + |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_ROMCON3 */ ;\ + .long ( (KS32C_ROMCON_PMC_ROM) \ + |(KS32C_ROMCON_TPA_5C) \ + |(KS32C_ROMCON_TACC_3C) \ + |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_ROMCON4 */ ;\ + .long ( (KS32C_ROMCON_PMC_ROM) \ + |(KS32C_ROMCON_TPA_5C) \ + |(KS32C_ROMCON_TACC_5C) \ + |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_ROMCON5 */ ;\ + .long ( (KS32C_ROMCON_PMC_ROM) \ + |(KS32C_ROMCON_TPA_5C) \ + |(KS32C_ROMCON_TACC_5C) \ + |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_DRAMCON0 */ ;\ + .long ( (KS32C_DRAMCON_RESERVED) \ + |(KS32C_DRAMCON_CAN_10) \ + |(KS32C_DRAMCON_TRP_3C) \ + |(KS32C_DRAMCON_TRC_1C) \ + |(KS32C_DRAMCON_TCP_1C) \ + |(KS32C_DRAMCON_TCS_2C) \ + |(KS32C_DRAMCON_EDO) \ + |((0x00000000 >> 16) << KS32C_DRAMCON_BASE_shift) \ + |((0x00400000 >> 16) << KS32C_DRAMCON_NEXT_shift)) ;\ + /* .long KS32C_DRAMCON1 */ ;\ + .long ( (KS32C_DRAMCON_RESERVED) \ + |(KS32C_DRAMCON_CAN_10) \ + |(KS32C_DRAMCON_TRP_1C) \ + |(KS32C_DRAMCON_TRC_1C) \ + |(KS32C_DRAMCON_TCP_1C) \ + |(KS32C_DRAMCON_TCS_2C) \ + |(KS32C_DRAMCON_EDO) \ + |((0x00400000 >> 16) << KS32C_DRAMCON_BASE_shift) \ + |((0x00800000 >> 16) << KS32C_DRAMCON_NEXT_shift)) ;\ + /* .long KS32C_DRAMCON2 */ ;\ + .long ( (KS32C_DRAMCON_RESERVED) \ + |(KS32C_DRAMCON_CAN_10) \ + |(KS32C_DRAMCON_TRP_1C) \ + |(KS32C_DRAMCON_TRC_1C) \ + |(KS32C_DRAMCON_TCP_1C) \ + |(KS32C_DRAMCON_TCS_2C) \ + |((0x00800000 >> 16) << KS32C_DRAMCON_BASE_shift) \ + |((0x00c00000 >> 16) << KS32C_DRAMCON_NEXT_shift)) ;\ + /* .long KS32C_DRAMCON3 */ ;\ + .long ( (KS32C_DRAMCON_RESERVED) \ + |(KS32C_DRAMCON_CAN_10) \ + |(KS32C_DRAMCON_TRP_1C) \ + |(KS32C_DRAMCON_TRC_1C) \ + |(KS32C_DRAMCON_TCP_1C) \ + |(KS32C_DRAMCON_TCS_2C) \ + |((0x00c00000 >> 16) << KS32C_DRAMCON_BASE_shift) \ + |((0x01000000 >> 16) << KS32C_DRAMCON_NEXT_shift)) ;\ + /* .long KS32C_REFEXTCON */ ;\ + .long (((2048+1-(16*CYGNUM_HAL_CPUCLOCK/1000000)) << KS32C_REFEXTCON_RCV_shift) \ + |(KS32C_REFEXTCON_TCSR_1C) \ + |(KS32C_REFEXTCON_TCHR_1C) \ + |(KS32C_REFEXTCON_REN) \ + |(KS32C_REFEXTCON_VSF) \ + |(KS32C_REFEXTCON_BASE)) ;\ + ;\ + /* Sync DRAM setup */ ;\ + /* Flash is 16 bit, everything else 32 bit */ ;\ + /* .long KS32C_EXTDBWTH */ ;\ +40: .long ( (KS32C_EXTDBWTH_16BIT<> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x01880000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_ROMCON1 */ ;\ + .long ( (KS32C_ROMCON_PMC_ROM) \ + |(KS32C_ROMCON_TPA_5C) \ + |(KS32C_ROMCON_TACC_5C) \ + |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_ROMCON2 */ ;\ + .long ( (KS32C_ROMCON_PMC_ROM) \ + |(KS32C_ROMCON_TPA_5C) \ + |(KS32C_ROMCON_TACC_5C) \ + |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_ROMCON3 */ ;\ + .long ( (KS32C_ROMCON_PMC_ROM) \ + |(KS32C_ROMCON_TPA_5C) \ + |(KS32C_ROMCON_TACC_5C) \ + |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_ROMCON4 */ ;\ + .long ( (KS32C_ROMCON_PMC_ROM) \ + |(KS32C_ROMCON_TPA_5C) \ + |(KS32C_ROMCON_TACC_5C) \ + |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_ROMCON5 */ ;\ + .long ( (KS32C_ROMCON_PMC_ROM) \ + |(KS32C_ROMCON_TPA_5C) \ + |(KS32C_ROMCON_TACC_5C) \ + |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift) \ + |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift)) ;\ + /* .long KS32C_DRAMCON0 */ ;\ + .long ( (KS32C_DRAMCON_RESERVED) \ + |(KS32C_DRAMCON_CAN_8) \ + |(KS32C_DRAMCON_TRP_4C) \ + |(KS32C_DRAMCON_TRC_2C) \ + |((0x00000000 >> 16) << KS32C_DRAMCON_BASE_shift) \ + |((0x00400000 >> 16) << KS32C_DRAMCON_NEXT_shift)) ;\ + /* .long KS32C_DRAMCON1 */ ;\ + .long ( (KS32C_DRAMCON_RESERVED) \ + |(KS32C_DRAMCON_CAN_8) \ + |(KS32C_DRAMCON_TRP_2C) \ + |(KS32C_DRAMCON_TRC_2C) \ + |((0x00400000 >> 16) << KS32C_DRAMCON_BASE_shift) \ + |((0x00800000 >> 16) << KS32C_DRAMCON_NEXT_shift)) ;\ + /* .long KS32C_DRAMCON2 */ ;\ + .long ( (KS32C_DRAMCON_RESERVED) \ + |(KS32C_DRAMCON_CAN_8) \ + |(KS32C_DRAMCON_TRP_2C) \ + |(KS32C_DRAMCON_TRC_2C) \ + |((0x00800000 >> 16) << KS32C_DRAMCON_BASE_shift) \ + |((0x00c00000 >> 16) << KS32C_DRAMCON_NEXT_shift)) ;\ + /* .long KS32C_DRAMCON3 */ ;\ + .long ( (KS32C_DRAMCON_RESERVED) \ + |(KS32C_DRAMCON_CAN_8) \ + |(KS32C_DRAMCON_TRP_2C) \ + |(KS32C_DRAMCON_TRC_2C) \ + |((0x00c00000 >> 16) << KS32C_DRAMCON_BASE_shift) \ + |((0x01000000 >> 16) << KS32C_DRAMCON_NEXT_shift)) ;\ + /* .long KS32C_REFEXTCON */ ;\ + .long (((2048+1-(8*CYGNUM_HAL_CPUCLOCK/1000000)) << KS32C_REFEXTCON_RCV_shift) \ + |(KS32C_REFEXTCON_TRC_4C) \ + |(KS32C_REFEXTCON_REN) \ + |(KS32C_REFEXTCON_VSF) \ + |(KS32C_REFEXTCON_BASE)) ;\ +99: LED 0x82 ;\ + ldr r3,=0x00000000 ;\ + str r3,[r3] ;\ + ldr r4,[r3] ;\ + cmp r4,r3 ;\ + beq 15f ;\ +11: LED 0x83 ;\ + b 11b ;\ +15: LED 0x84 +#else +#define PLATFORM_SETUP1 +#endif + +//----------------------------------------------------------------------------- +// end of hal_platform_setup.h +#endif // CYGONCE_HAL_PLATFORM_SETUP_H diff --git a/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_ram.h b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_ram.h @@ -0,0 +1,15 @@ +// eCos memory layout - Tue Feb 29 14:11:30 2000 + +// This is a generated file - do not edit + +#include +#include + +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x01000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x01000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_ram.ldi b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_ram.ldi @@ -0,0 +1,24 @@ +// eCos memory layout - Tue Feb 29 14:11:30 2000 + +// This is a generated file - do not edit + +MEMORY +{ + ram : ORIGIN = 0x000000, LENGTH = 0x01000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x200, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x00020000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTIONS_END +} diff --git a/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_ram.mlt b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_ram.mlt @@ -0,0 +1,13 @@ +version 0 +region ram 0 1000000 0 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section rom_vectors 0 1 0 1 1 1 1 1 20000 20000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_rom.h b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_rom.h @@ -0,0 +1,20 @@ +// eCos memory layout - Wed Apr 11 13:49:55 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x1000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0x1800000) +#define CYGMEM_REGION_rom_SIZE (0x80000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x1000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_rom.ldi b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_rom.ldi @@ -0,0 +1,28 @@ +// eCos memory layout - Wed Apr 11 13:49:55 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x1000000 + rom : ORIGIN = 0x1800000, LENGTH = 0x80000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x1800000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_data (ram, 0x20000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_rom.mlt b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/pkgconf/mlt_arm_snds_rom.mlt @@ -0,0 +1,15 @@ +version 0 +region ram 0 1000000 0 ! +region rom 1800000 80000 1 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section data 0 1 1 1 1 1 0 0 1000000 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section reserved_bootmon 20000 1 0 0 1 1 1 1 1800000 1800000 rom_vectors rom_vectors ! +section rom_vectors 0 8 0 1 0 1 0 1 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 0 0 1 data ! diff --git a/packages/hal/arm/snds/current/include/plf_io.h b/packages/hal/arm/snds/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/plf_io.h @@ -0,0 +1,281 @@ +#ifndef CYGONCE_HAL_PLF_IO_H +#define CYGONCE_HAL_PLF_IO_H +//============================================================================= +// +// plf_io.h +// +// Platform specific registers +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-03-16 +// Purpose: ARM/KS32C platform specific registers +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +// non-caching by accessing addr|0x04000000 + +#define KS32C_REG_BASE 0x07ff0000 + +// ----------------------------------------------------------------------------- +// System config (register bases and caching) +#define KS32C_SYSCFG (KS32C_REG_BASE + 0x0000) + +#define KS32C_SYSCFG_SDM 0x80000000 +#define KS32C_SYSCFG_PD_ID_MASK 0x3c000000 +#define KS32C_SYSCFG_SRBBP_MASK 0x03ff0000 // address/64k +#define KS32C_SYSCFG_ISBBP_MASK 0x0000ffc0 // a25-a16 +#define KS32C_SYSCFG_CM_MASK 0x00000030 +#define KS32C_SYSCFG_CM_4R_4C 0x00000000 +#define KS32C_SYSCFG_CM_0R_8C 0x00000010 +#define KS32C_SYSCFG_CM_8R_0C 0x00000020 +#define KS32C_SYSCFG_WE 0x00000004 // only KS32C50100? +#define KS32C_SYSCFG_CE 0x00000002 +#define KS32C_SYSCFG_SE 0x00000001 + +#define KS32C_CLKCON (KS32C_REG_BASE + 0x3000) + +#define KS32C_EXTACON0 (KS32C_REG_BASE + 0x3008) +#define KS32C_EXTACON1 (KS32C_REG_BASE + 0x300c) + +//----------------------------------------------------------------------------- +// Memory banks data width +#define KS32C_EXTDBWTH (KS32C_REG_BASE + 0x3010) + +#define KS32C_EXTDBWTH_MASK 3 +#define KS32C_EXTDBWTH_8BIT 1 +#define KS32C_EXTDBWTH_16BIT 2 +#define KS32C_EXTDBWTH_32BIT 3 + +#define KS32C_EXTDBWTH_DSR0_shift 0 +#define KS32C_EXTDBWTH_DSR1_shift 2 +#define KS32C_EXTDBWTH_DSR2_shift 4 +#define KS32C_EXTDBWTH_DSR3_shift 6 +#define KS32C_EXTDBWTH_DSR4_shift 8 +#define KS32C_EXTDBWTH_DSR5_shift 10 +#define KS32C_EXTDBWTH_DSD0_shift 12 +#define KS32C_EXTDBWTH_DSD1_shift 14 +#define KS32C_EXTDBWTH_DSD2_shift 16 +#define KS32C_EXTDBWTH_DSD3_shift 18 +#define KS32C_EXTDBWTH_DSX0_shift 20 +#define KS32C_EXTDBWTH_DSX1_shift 22 +#define KS32C_EXTDBWTH_DSX2_shift 24 +#define KS32C_EXTDBWTH_DSX3_shift 26 + +// ----------------------------------------------------------------------------- +// Bank locations and timing +#define KS32C_ROMCON0 (KS32C_REG_BASE + 0x3014) +#define KS32C_ROMCON1 (KS32C_REG_BASE + 0x3018) +#define KS32C_ROMCON2 (KS32C_REG_BASE + 0x301c) +#define KS32C_ROMCON3 (KS32C_REG_BASE + 0x3020) +#define KS32C_ROMCON4 (KS32C_REG_BASE + 0x3024) +#define KS32C_ROMCON5 (KS32C_REG_BASE + 0x3028) + +#define KS32C_ROMCON_PMC_MASK 0x00000003 +#define KS32C_ROMCON_PMC_ROM 0x00000000 +#define KS32C_ROMCON_PMC_4W_PAGE 0x00000001 +#define KS32C_ROMCON_PMC_8W_PAGE 0x00000002 +#define KS32C_ROMCON_PMC_16W_PAGE 0x00000003 + +#define KS32C_ROMCON_TPA_MASK 0x0000000c +#define KS32C_ROMCON_TPA_5C 0x00000000 +#define KS32C_ROMCON_TPA_2C 0x00000004 +#define KS32C_ROMCON_TPA_3C 0x00000008 +#define KS32C_ROMCON_TPA_4C 0x0000000c + +#define KS32C_ROMCON_TACC_MASK 0x00000070 +#define KS32C_ROMCON_TACC_DISABLE 0x00000000 +#define KS32C_ROMCON_TACC_2C 0x00000010 +#define KS32C_ROMCON_TACC_3C 0x00000020 +#define KS32C_ROMCON_TACC_4C 0x00000030 +#define KS32C_ROMCON_TACC_5C 0x00000040 +#define KS32C_ROMCON_TACC_6C 0x00000050 +#define KS32C_ROMCON_TACC_7C 0x00000060 + +#define KS32C_ROMCON_BASE_MASK 0x000ff700 +#define KS32C_ROMCON_BASE_shift 10 + +#define KS32C_ROMCON_NEXT_MASK 0x7ff00000 +#define KS32C_ROMCON_NEXT_shift 20 + + + +#define KS32C_DRAMCON0 (KS32C_REG_BASE + 0x302c) +#define KS32C_DRAMCON1 (KS32C_REG_BASE + 0x3030) +#define KS32C_DRAMCON2 (KS32C_REG_BASE + 0x3034) +#define KS32C_DRAMCON3 (KS32C_REG_BASE + 0x3038) + +#define KS32C_DRAMCON_CAN_8 0x00000000 +#define KS32C_DRAMCON_CAN_9 0x40000000 +#define KS32C_DRAMCON_CAN_10 0x80000000 +#define KS32C_DRAMCON_CAN_11 0xc0000000 +#define KS32C_DRAMCON_TRP_1C 0x00000000 +#define KS32C_DRAMCON_TRP_2C 0x00000100 +#define KS32C_DRAMCON_TRP_3C 0x00000200 +#define KS32C_DRAMCON_TRP_4C 0x00000300 +#define KS32C_DRAMCON_TRC_1C 0x00000000 +#define KS32C_DRAMCON_TRC_2C 0x00000080 +#define KS32C_DRAMCON_RESERVED 0x00000010 +#define KS32C_DRAMCON_TCP_1C 0x00000000 +#define KS32C_DRAMCON_TCP_2C 0x00000008 +#define KS32C_DRAMCON_TCS_1C 0x00000000 +#define KS32C_DRAMCON_TCS_2C 0x00000002 +#define KS32C_DRAMCON_TCS_3C 0x00000004 +#define KS32C_DRAMCON_TCS_4C 0x00000006 +#define KS32C_DRAMCON_EDO 0x00000001 + +#define KS32C_DRAMCON_BASE_MASK 0x000ff700 +#define KS32C_DRAMCON_BASE_shift 10 + +#define KS32C_DRAMCON_NEXT_MASK 0x7ff00000 +#define KS32C_DRAMCON_NEXT_shift 20 + + +#define KS32C_REFEXTCON (KS32C_REG_BASE + 0x303c) + +// DRAM +#define KS32C_REFEXTCON_TCSR_1C 0x00000000 +#define KS32C_REFEXTCON_TCHR_1C 0x00000000 +// SDRAM +#define KS32C_REFEXTCON_TRC_4C 0x00060000 +// DRAM+SDRAM +#define KS32C_REFEXTCON_REN 0x00010000 +#define KS32C_REFEXTCON_VSF 0x00008000 +#define KS32C_REFEXTCON_BASE 0x00000360 + +#define KS32C_REFEXTCON_RCV_shift 21 + +//----------------------------------------------------------------------------- +// INTC + +#define KS32C_INTMOD (KS32C_REG_BASE + 0x4000) +#define KS32C_INTPND (KS32C_REG_BASE + 0x4004) +#define KS32C_INTMSK (KS32C_REG_BASE + 0x4008) +#define KS32C_INTPRI0 (KS32C_REG_BASE + 0x400c) +#define KS32C_INTPRI1 (KS32C_REG_BASE + 0x4010) +#define KS32C_INTPRI2 (KS32C_REG_BASE + 0x4014) +#define KS32C_INTPRI3 (KS32C_REG_BASE + 0x4018) +#define KS32C_INTPRI4 (KS32C_REG_BASE + 0x401c) +#define KS32C_INTPRI5 (KS32C_REG_BASE + 0x4020) +#define KS32C_INTOFFSET (KS32C_REG_BASE + 0x4024) +#define KS32C_PNDPRI (KS32C_REG_BASE + 0x4028) +#define KS32C_PNDTEST (KS32C_REG_BASE + 0x402c) +#define KS32C_INTOFFSET_FIQ (KS32C_REG_BASE + 0x4030) +#define KS32C_INTOFFSET_IRQ (KS32C_REG_BASE + 0x4034) + +#define KS32C_INTMSK_GLOBAL (1<<21) + +//----------------------------------------------------------------------------- +// PIO + +#define KS32C_IOPMOD (KS32C_REG_BASE + 0x5000) +#define KS32C_IOPCON (KS32C_REG_BASE + 0x5004) +#define KS32C_IOPDATA (KS32C_REG_BASE + 0x5008) + +//----------------------------------------------------------------------------- +// Timers + +#define KS32C_TMOD (KS32C_REG_BASE + 0x6000) +#define KS32C_TDATA0 (KS32C_REG_BASE + 0x6004) +#define KS32C_TDATA1 (KS32C_REG_BASE + 0x6008) +#define KS32C_TCNT0 (KS32C_REG_BASE + 0x600c) +#define KS32C_TCNT1 (KS32C_REG_BASE + 0x6010) + +#define KS32C_TMOD_TE0 0x00000001 +#define KS32C_TMOD_TMD0 0x00000002 +#define KS32C_TMOD_TCLR0 0x00000004 +#define KS32C_TMOD_TE1 0x00000008 +#define KS32C_TMOD_TMD1 0x00000010 +#define KS32C_TMOD_TCLR1 0x00000020 + + +//----------------------------------------------------------------------------- +// UART + +#define KS32C_UART0_BASE (KS32C_REG_BASE + 0xd000) +#define KS32C_UART1_BASE (KS32C_REG_BASE + 0xe000) + +#define KS32C_UART_LCON 0x0000 +#define KS32C_UART_CON 0x0004 +#define KS32C_UART_STAT 0x0008 +#define KS32C_UART_TXBUF 0x000c +#define KS32C_UART_RXBUF 0x0010 +#define KS32C_UART_BRDIV 0x0014 +#define KS32C_UART_BRDCNT 0x0018 +#define KS32C_UART_BRDCLK 0x001c + +#define KS32C_UART_LCON_5_DBITS 0x00 +#define KS32C_UART_LCON_6_DBITS 0x01 +#define KS32C_UART_LCON_7_DBITS 0x02 +#define KS32C_UART_LCON_8_DBITS 0x03 +#define KS32C_UART_LCON_1_SBITS 0x00 +#define KS32C_UART_LCON_2_SBITS 0x04 +#define KS32C_UART_LCON_NO_PARITY 0x00 +#define KS32C_UART_LCON_EVEN_PARITY 0x00 +#define KS32C_UART_LCON_ODD_PARITY 0x28 +#define KS32C_UART_LCON_1_PARITY 0x30 +#define KS32C_UART_LCON_0_PARITY 0x38 +#define KS32C_UART_LCON_SCS 0x40 +#define KS32C_UART_LCON_IR 0x80 + +#define KS32C_UART_CON_RXM_MASK 0x03 +#define KS32C_UART_CON_RXM_INT 0x01 +#define KS32C_UART_CON_TXM_MASK 0x0c +#define KS32C_UART_CON_TXM_INT 0x08 +#define KS32C_UART_CON_RX_ERR_INT 0x04 + + +#define KS32C_UART_STAT_DTR 0x10 +#define KS32C_UART_STAT_RDR 0x20 +#define KS32C_UART_STAT_TXE 0x40 // tx empty +#define KS32C_UART_STAT_TC 0x80 // tx complete + +//----------------------------------------------------------------------------- +// Cache +#define KS32C_CACHE_SET0_ADDR 0x14000000 +#define KS32C_CACHE_SET1_ADDR 0x14800000 +#define KS32C_CACHE_TAG_ADDR 0x15000000 + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_HAL_PLF_IO_H diff --git a/packages/hal/arm/snds/current/include/plf_stub.h b/packages/hal/arm/snds/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/include/plf_stub.h @@ -0,0 +1,77 @@ +//========================================================================== +// +// plf_stub.h +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +#include // CYG_UNUSED_PARAM +#include // architecture stub support +// Define serial stuff. +externC void cyg_hal_plf_comms_init(void); +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 +#define HAL_STUB_PLATFORM_INIT_BREAK_IRQ() CYG_EMPTY_STATEMENT +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +// Reset. +externC void hal_reset(void); +#define HAL_STUB_PLATFORM_RESET() hal_reset() +#define HAL_STUB_PLATFORM_RESET_ENTRY 0 + +#endif // CYGONCE_HAL_PLF_STUB_H diff --git a/packages/hal/arm/snds/current/misc/redboot_RAM.ecm b/packages/hal/arm/snds/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/misc/redboot_RAM.ecm @@ -0,0 +1,72 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware snds ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_SNDS current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_ARM_BIGENDIAN { + user_value 1 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/snds/current/misc/redboot_ROM.ecm b/packages/hal/arm/snds/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/misc/redboot_ROM.ecm @@ -0,0 +1,80 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware snds ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_SNDS current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_ARM_BIGENDIAN { + user_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/arm/snds/current/src/hal_diag.c b/packages/hal/arm/snds/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/src/hal_diag.c @@ -0,0 +1,378 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-03-16 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // base types + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interface API +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // Helper functions +#include // CYG_ISR_HANDLED + +#include // SIO registers + +#define SIO_BRDDIV (((CYGNUM_HAL_CPUCLOCK/2/16/CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD)<<4)) + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector_rx; + int isr_vector_tx; +} channel_data_t; + +//----------------------------------------------------------------------------- + +char hextab[] = "0123456789ABCDEF"; + +void putc_ser(int c) +{ + cyg_uint8* base = (cyg_uint8*)KS32C_UART1_BASE; + cyg_uint32 status; + do { + HAL_READ_UINT32(base+KS32C_UART_STAT, status); + } while ((status & KS32C_UART_STAT_TXE) == 0); + + HAL_WRITE_UINT32(base+KS32C_UART_TXBUF, c); +} + +void putint(int a) +{ + int i; + putc_ser('0'); + putc_ser('x'); + for (i = 0; i < 8; i++) { + putc_ser(hextab[(a>>(28-(4*i))) & 0x0f]); + } + putc_ser('\r'); + putc_ser('\n'); +} + +void +init_ser(void) +{ + cyg_uint8* base = (cyg_uint8*)KS32C_UART1_BASE; + + // 8-1-no parity. + HAL_WRITE_UINT32(base+KS32C_UART_LCON, + KS32C_UART_LCON_8_DBITS|KS32C_UART_LCON_1_SBITS|KS32C_UART_LCON_NO_PARITY); + + // Mask interrupts. + HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_UART0_RX); + HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_UART0_TX); + + HAL_WRITE_UINT32(base+KS32C_UART_BRDIV, SIO_BRDDIV); +} + +//----------------------------------------------------------------------------- + +static void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + + // 8-1-no parity. + HAL_WRITE_UINT32(base+KS32C_UART_LCON, + KS32C_UART_LCON_8_DBITS|KS32C_UART_LCON_1_SBITS|KS32C_UART_LCON_NO_PARITY); + + HAL_WRITE_UINT32(base+KS32C_UART_BRDIV, SIO_BRDDIV); + + // Mask interrupts + HAL_INTERRUPT_MASK(((channel_data_t*)__ch_data)->isr_vector_rx); + HAL_INTERRUPT_MASK(((channel_data_t*)__ch_data)->isr_vector_tx); + + // Enable RX and TX + HAL_WRITE_UINT32(base+KS32C_UART_CON, KS32C_UART_CON_RXM_INT|KS32C_UART_CON_TXM_INT); +} + +void +cyg_hal_plf_serial_putc(void *__ch_data, char c) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint32 status, ch; + CYGARC_HAL_SAVE_GP(); + + do { + HAL_READ_UINT32(base+KS32C_UART_STAT, status); + } while ((status & KS32C_UART_STAT_TXE) == 0); + + ch = (cyg_uint32)c; + HAL_WRITE_UINT32(base+KS32C_UART_TXBUF, ch); + + CYGARC_HAL_RESTORE_GP(); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8* base = chan->base; + cyg_uint32 stat; + cyg_uint32 c; + + HAL_READ_UINT32(base+KS32C_UART_STAT, stat); + if ((stat & KS32C_UART_STAT_RDR) == 0) + return false; + + HAL_READ_UINT32(base+KS32C_UART_RXBUF, c); + *ch = (cyg_uint8)(c & 0xff); + + HAL_INTERRUPT_ACKNOWLEDGE(chan->isr_vector_rx); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + HAL_INTERRUPT_ACKNOWLEDGE(chan->isr_vector_rx); + HAL_INTERRUPT_UNMASK(chan->isr_vector_rx); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + HAL_INTERRUPT_MASK(chan->isr_vector_rx); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector_rx; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint32 c; + cyg_uint8 ch; + cyg_uint32 stat; + CYGARC_HAL_SAVE_GP(); + + *__ctrlc = 0; + HAL_READ_UINT32(chan->base+KS32C_UART_STAT, stat); + if ( (stat & KS32C_UART_STAT_RDR) != 0 ) { + + HAL_READ_UINT32(chan->base+KS32C_UART_RXBUF, c); + ch = (cyg_uint8)(c & 0xff); + if( cyg_hal_is_break( &ch , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + HAL_INTERRUPT_ACKNOWLEDGE(chan->isr_vector_rx); + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static channel_data_t ks32c_ser_channels[2] = { + { (cyg_uint8*)KS32C_UART0_BASE, 1000, CYGNUM_HAL_INTERRUPT_UART0_RX, CYGNUM_HAL_INTERRUPT_UART0_TX }, + { (cyg_uint8*)KS32C_UART1_BASE, 1000, CYGNUM_HAL_INTERRUPT_UART1_RX, CYGNUM_HAL_INTERRUPT_UART1_TX } +}; + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Init channels + cyg_hal_plf_serial_init_channel(&ks32c_ser_channels[0]); + cyg_hal_plf_serial_init_channel(&ks32c_ser_channels[1]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &ks32c_ser_channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Set channel 1 + CYGACC_CALL_IF_SET_CONSOLE_COMM(1); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &ks32c_ser_channels[1]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +//----------------------------------------------------------------------------- +// LED +void +hal_diag_led(int mask) +{ +#if 0 + cyg_uint32 l; + + HAL_READ_UINT32(KS32C_IOPDATA, l); + l &= ~0x000000f0; + l |= (mask & 0xf) << 4; + HAL_WRITE_UINT32(KS32C_IOPDATA, l); +#endif +} + +//----------------------------------------------------------------------------- +// End of hal_diag.c diff --git a/packages/hal/arm/snds/current/src/ks32c5000.h b/packages/hal/arm/snds/current/src/ks32c5000.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/src/ks32c5000.h @@ -0,0 +1,240 @@ +//========================================================================== +// +// ks32c5000.h +// +// +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +/* + * structure definitions for Samsung KS32C5000 peripheral registers + */ + +typedef volatile unsigned int reg; + +#define Bit(n) (1<<(n)) + + +/* + * Interrupt Controller + */ + +typedef struct +{ + reg intmod; // Interrupt mode register + reg intpnd; // Interrupt pending register + reg intmsk; // Interrupt mask register + reg intpri0; // Interrupt priority register + reg intpri1; + reg intpri2; + reg intpri3; + reg intpri4; + reg intpri5; + reg intoffset; // Interrupt offset register +} tInterruptController; + + +/* The following bit masks are for use in the intmod, intpnd, and + * intmsk registers + */ + +#define IntMaskExt0 Bit(0) +#define IntMaskExt1 Bit(1) +#define IntMaskExt2 Bit(2) +#define IntMaskExt3 Bit(3) +#define IntMaskUart0Tx Bit(4) +#define IntMaskUart0Rx Bit(5) +#if defined(CYG_HAL_CPUTYPE_KS32C5000A) +#define IntMaskUart0Err Bit(6) +#define IntMaskUart1Tx Bit(7) +#define IntMaskUart1Rx Bit(8) +#define IntMaskUart1Err Bit(9) +#define IntMaskDma0 Bit(10) +#define IntMaskDma1 Bit(11) +#define IntMaskTimer0 Bit(12) +#define IntMaskTimer1 Bit(13) +#define IntMaskHDLCA Bit(14) +#define IntMaskHDLCB Bit(15) +#else +#define IntMaskUart1Tx Bit(6) +#define IntMaskUart1Rx Bit(7) +#define IntMaskDma0 Bit(8) +#define IntMaskDma1 Bit(9) +#define IntMaskTimer0 Bit(10) +#define IntMaskTimer1 Bit(11) +#define IntMaskHDLCATx Bit(12) +#define IntMaskHDLCARx Bit(13) +#define IntMaskHDLCBTx Bit(14) +#define IntMaskHDLCBRx Bit(15) +#endif +#define IntMaskEtherBDMATx Bit(16) +#define IntMaskEtherBDMARx Bit(17) +#define IntMaskEtherMacTx Bit(18) +#define IntMaskEtherMacRx Bit(19) +#define IntMaskI2C Bit(20) +#define IntMaskGlobal Bit(21) + +/* + * Timers + */ + +typedef struct +{ + reg tmod; // Timer mode + reg tdata0; // Timer 0 Data + reg tdata1; // Timer 1 Data + reg tcnt0; // Timer 0 Count + reg tcnt1; // Timer 1 Count +}tTimers; + +#define TimerModeEnable0 Bit(0) +#define TimerModeToggle0 Bit(1) +#define TimerModeInitOut0 Bit(2) +#define TimerModeEnable1 Bit(3) +#define TimerModeToggle1 Bit(4) +#define TimerModeInitOut1 Bit(5) + + +/* + * UART + */ + +typedef struct +{ + reg ulcon; // UART Line Control + reg ucon; // UART Control + reg ustat; // UART Status + reg utxbuf; // UART Tx Buffer + reg urxbuf; // UART Rx Buffer + reg brdiv; // UART Baud Rate Divisor + reg brdcnt; // UART Baud Rate Counter + reg brdclk; // UART Baud Rate Clock +}tUart; + +/* UART Line Control */ + +#define UartLineWordLenMask 0x03 +#define UartLineWordLen5 0 +#define UartLineWordLen6 1 +#define UartLineWordLen7 2 +#define UartLineWordLen8 3 + +#define UartLineStopMask (1 << 2) +#define UartLineStop1 (0 << 2) +#define UartLineStop2 (1 << 2) + +#define UartLineParityMask (0x07 << 3) +#define UartLineParityNone (0 << 3) +#define UartLineParityOdd (4 << 3) +#define UartLineParityEven (5 << 3) +#define UartLineParityMark (6 << 3) +#define UartLineParitySpace (7 << 3) + +#define UartLineInfraRedEnable Bit(7) + + +/* UART Control */ + + +#define UartControlRxModeMask 3 +#define UartControlRxModeDisabled 0 +#define UartControlRxModeInterrupt 1 +#define UartControlRxModeDma0 2 +#define UartControlRxModeDma1 3 + +#define UartControlRxStatusIntEnable Bit(2) + +#define UartControlTxModeMask (0x3 <<3) +#define UartControlTxModeDisable (0 <<3) +#define UartControlTxModeInterrupt (1 <<3) +#define UartControlTxModeDma0 (2 <<3) +#define UartControlTxModeDma1 (3 <<3) + +#define UartControlDSR Bit(5) + +#define UartControlSendBreak Bit(6) + +#define UartControlLoopback Bit(7) + + +/* UART Status */ + +#define UartStatusRxOverrunError Bit(0) +#define UartStatusRxParityError Bit(1) +#define UartStatusRxFrameError Bit(2) +#define UartStatusRxBreak Bit(3) +#define UartStatusDTR Bit(4) +#define UartStatusRxDataAvail Bit(5) +#define UartStatusTxBufEmpty Bit(6) +#define UartStatusTxDone Bit(7) + + + + + +// macros for external timing control registers + +#define Tcos0(n) (((n)&7)<<0) +#define Tacs0(n) (((n)&7)<<3) +#define Tcoh0(n) (((n)&7)<<6) +#define Tacc0(n) (((n)&7)<<9) + +#define Tcos1(n) (((n)&7)<<16) +#define Tacs1(n) (((n)&7)<<19) +#define Tcoh1(n) (((n)&7)<<22) +#define Tacc1(n) (((n)&7)<<25) + +#define Tcos2(n) (((n)&7)<<0) +#define Tacs2(n) (((n)&7)<<3) +#define Tcoh2(n) (((n)&7)<<6) +#define Tacc2(n) (((n)&7)<<9) + +#define Tcos3(n) (((n)&7)<<16) +#define Tacs3(n) (((n)&7)<<19) +#define Tcoh3(n) (((n)&7)<<22) +#define Tacc3(n) (((n)&7)<<25) diff --git a/packages/hal/arm/snds/current/src/snds100_misc.c b/packages/hal/arm/snds/current/src/snds100_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/snds/current/src/snds100_misc.c @@ -0,0 +1,286 @@ +//========================================================================== +// +// snds100_misc.c +// +// HAL misc board support code for Samsung SNDS100 +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Grant Edwards +// Date: 2001-07-31 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // base types +#include // tracing macros +#include // assertion macros +#include // diag_printf() + +#include // IO macros +#include // Register state info +#include +#include +#include // necessary? +#include // calling interface +#include // helper functions +#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT +#include // HAL ISR support +#endif + +#include "ks32c5000.h" +#include + +//====================================================================== +// Use Timer0 for kernel clock + +static cyg_uint32 _period; + +#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT +static cyg_interrupt abort_interrupt; +static cyg_handle_t abort_interrupt_handle; + +// This ISR is called only for the Abort button interrupt +static int +ks32c_abort_isr(cyg_vector_t vector, cyg_addrword_t data, HAL_SavedRegisters *regs) +{ + cyg_hal_user_break((CYG_ADDRWORD*)regs); + cyg_drv_interrupt_acknowledge(CYGNUM_HAL_INTERRUPT_EXT0); + return 0; // No need to run DSR +} +#endif + +void hal_clock_initialize(cyg_uint32 period) +{ + cyg_uint32 tmod; + + // Disable timer 0 + HAL_READ_UINT32(KS32C_TMOD, tmod); + tmod &= ~(KS32C_TMOD_TE0); + HAL_WRITE_UINT32(KS32C_TMOD, 0); + + tmod &= ~(KS32C_TMOD_TMD0 | KS32C_TMOD_TCLR0); + tmod |= KS32C_TMOD_TE0; + + // Set counter + HAL_WRITE_UINT32(KS32C_TDATA0, period); + + // And enable timer + HAL_WRITE_UINT32(KS32C_TMOD, tmod); + + _period = period; + +#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_EXT0, + 99, // Priority + 0, // Data item passed to interrupt handler + ks32c_abort_isr, + 0, + &abort_interrupt_handle, + &abort_interrupt); + cyg_drv_interrupt_attach(abort_interrupt_handle); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EXT0); +#endif +} + +void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + _period = period; +} + +void hal_clock_read(cyg_uint32 *pvalue) +{ + cyg_uint32 value; + + HAL_READ_UINT32(KS32C_TCNT0, value); + *pvalue = _period - value; +} + +//====================================================================== +// Interrupt controller stuff + +extern volatile tInterruptController ks32c5000_int; // Interrupt controller registers +extern volatile unsigned long EXTACON0; // Extern access control reg +extern volatile unsigned long EXTACON1; // Extern access control reg +extern volatile unsigned long IOPCON; // I/O Port Control reg +extern volatile unsigned long IOPMOD; +extern volatile unsigned long SYSCON; + +void hal_hardware_init(void) +{ + cyg_uint32 intmask, syscfg; + + // Set up eCos/ROM interfaces + hal_if_init(); + + // Enable cache + HAL_READ_UINT32(KS32C_SYSCFG, syscfg); + syscfg &= ~KS32C_SYSCFG_CM_MASK; + syscfg |= KS32C_SYSCFG_CM_0R_8C|KS32C_SYSCFG_WE; + HAL_WRITE_UINT32(KS32C_SYSCFG, syscfg); + HAL_UCACHE_INVALIDATE_ALL(); + HAL_UCACHE_ENABLE(); + + // Clear global interrupt mask bit + HAL_READ_UINT32(KS32C_INTMSK, intmask); + intmask &= ~KS32C_INTMSK_GLOBAL; + HAL_WRITE_UINT32(KS32C_INTMSK, intmask); +} + + +// This routine is called to respond to a hardware interrupt (IRQ). It +// should interrogate the hardware and return the IRQ vector number. + +int hal_IRQ_handler(void) +{ + // Do hardware-level IRQ handling + cyg_uint32 irq_status; + HAL_READ_UINT32(KS32C_INTOFFSET_IRQ, irq_status); + irq_status = irq_status / 4; + if (CYGNUM_HAL_ISR_MAX >= irq_status) + return irq_status; + // It's a bit bogus to test for FIQs after IRQs, but we use the + // latter more, so don't impose the overhead of checking for FIQs + HAL_READ_UINT32(KS32C_INTOFFSET_FIQ, irq_status); + irq_status = irq_status / 4; + if (CYGNUM_HAL_ISR_MAX >= irq_status) + return irq_status; + return CYGNUM_HAL_INTERRUPT_NONE; +} + + +// +// Interrupt control +// + +void hal_interrupt_mask(int vector) +{ + cyg_uint32 mask, old_mask; + HAL_READ_UINT32(KS32C_INTMSK, mask); + old_mask = mask; + mask |= (1<= ticks); + // then wait for it to be reloaded + do { + HAL_READ_UINT32(KS32C_TCNT1, count); + } while (count < ticks); + + // Then disable timer 1 again + tmod &= ~KS32C_TMOD_TE1; + HAL_WRITE_UINT32(KS32C_TMOD, tmod); +} + +// No way to reset board + +void hal_reset(void) +{ + CYG_INTERRUPT_STATE old; + HAL_DISABLE_INTERRUPTS(old); + while (1) + ; +} diff --git a/packages/hal/arm/xscale/iq80321/current/ChangeLog b/packages/hal/arm/xscale/iq80321/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/ChangeLog @@ -0,0 +1,249 @@ +2002-05-07 Gary Thomas + + * cdl/hal_arm_xscale_iq80321.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-04-22 Jonathan Larmour + + * misc/redboot_RAM.ecm: Enable GDB remote file I/O support. + * misc/redboot_RAM_ALTMAP.ecm: Ditto. + * misc/redboot_ROM.ecm: Ditto. + * misc/redboot_ROM_ALTMAP.ecm: Ditto. + +2002-04-16 John Dallaway + + * cdl/hal_arm_xscale_iq80321.cdl: Use arm-elf toolchain by default. + +2002-03-25 Mark Salter + + * include/hal_platform_extras.h: Use X=1,C=1,B=1 for RAM. + * include/hal_platform_setup.h: Fix handling of x16 DIMM modules and + registered vs. non-registered handling. + +2002-03-06 Jesper Skov + + * misc/redboot_RAM.ecm: Added zlib and DNS packages. + * misc/redboot_ROM.ecm: Same. + +2002-02-27 Mark Salter + + * cdl/hal_arm_xscale_iq80321.cdl: Enable battery test by default. + + * include/hal_platform_setup.h: Get battery test data before enabling + ECC. + +2002-02-24 Mark Salter + + * src/diag/xscale_test.c: Don't include battery test unless + CYGSEM_HAL_ARM_IQ80321_BATTERY_TEST is defined. + * src/diag/battery.c: Ditto + + * include/iq80321.h (SDRAM_BATTERY_TEST_ADDR): Use uncached addresses. + + * cdl/hal_arm_xscale_iq80321.cdl: CYGSEM_HAL_ARM_IQ80321_BATTERY_TEST + added. + + * include/hal_platform_setup.h: Don't save/restore battery test value + unless CYGSEM_HAL_ARM_IQ80321_BATTERY_TEST is defined. + Use latest criteria and numbers for DRAM drive strengths. + +2002-02-22 Mark Salter + + * src/iq80321_pci.c (cyg_hal_plf_pci_init): Improve handling of PC BIOS. + + * include/plf_io.h: Fix Fab D IDSELs. + + * include/hal_platform_setup.h: Support battery backup test. + Plug in new drive strength numbers from Intel. + + * cdl/hal_arm_xscale_iq80321.cdl: Add battery.c and timer.c to diags. + + * src/diag/io_utils.c (diag_ishex): Renamed from ishex and made global. + (diag_hex2dec): Renamed from hex2dec and made global. + + * src/diag/i82544.c (get_mac_address): New function. + (enet_setup): Use get_mac_address for user entry. + + * src/diag/pcitest.c (pci_test): Mask BAR config bits from address. + Remove debugging printfs. + + * src/diag/xscale_test.c: Add new tests to menu. + + * include/iq80321.h (SDRAM_BASE): Remove duplicate define. Add battery + status defines. + +2002-02-20 Mark Salter + + * src/diag/i82544.c (enet_setup): Use macros for device IDs. + * src/diag/pcitest.c (pci_test): Ditto. + + * include/plf_io.h: Define PCI slot and NIC device IDs based on + CYGSEM_HAL_ARM_IQ80321_FAB_C flag. + Add macros to convert between virtual and physical addresses + needed for hw watchpoints and breakpoints. + (HAL_PCI_TRANSLATE_INTERRUPT): Fix test for onboard NIC. + + * include/hal_plf_ints.h: Define ethernet and UART interrupt numbers + based on CYGSEM_HAL_ARM_IQ80321_FAB_C flag. + + * cdl/hal_arm_xscale_iq80321.cdl (CYGSEM_HAL_ARM_IQ80321_FAB_C): New + option to distinguish between fab C and later boards. + +2002-01-31 Mark Salter + + * cdl/hal_arm_xscale_iq80321.cdl: Set default for + CYGSEM_HAL_ARM_IQ80321_CLEAR_PCI_RETRY back to 1. + + * src/iq80321_pci.c (cyg_hal_plf_pci_init): Fixed to work with PC BIOS. + Moved PCI CFG support to verde_pci.c + * include/plf_io.h: Removed HAL_PCI_CFG_* support to var_io.h + +2002-01-30 Mark Salter + + * include/iq80321.h: Remove unneeded CCLKCFG values. + * include/hal_platform_setup.h: Remove write to non-existant CCLKCFG. + +2002-01-30 Nick Garnett + + * cdl/hal_arm_xscale_iq80321.cdl: Set default for + CYGSEM_HAL_ARM_IQ80321_CLEAR_PCI_RETRY to 0 rather that 1. This + allows PC-hosted boards to prevent the PC booting and conflicting + over access to the i82544. It also allows us to build tests for + the testfarm without having to do extra configury. + If/when we get a resolution to the conflict problem, we can change + this. + +2002-01-30 Mark Salter + + * src/diag/i82544.c: New file. + * src/diag/pcitests.c: New file. + * cdl/hal_arm_xscale_iq80321.cdl: Add new diag files to compile list. + * src/diag/xscale_test.c: General cleanup. + * src/diag/test_menu.h (MENU_RTN): Fix typedef to reflect reality. + * src/diag/memtest.c: Largely rewritten for portability. + * src/diag/io_utils.c: Rewrote to use RedBoot io support. + * src/diag/diag.c: Remove unused cruft. + + * src/iq80321_pci.c (cyg_hal_plf_pci_init): Don't try to set bus + and device number for Verde. + (pci_config_setup): Fix handling of bus number. + + * misc/redboot_RAM.ecm: Remove override of default + CYGSEM_DEVS_ETH_ARM_IQ80321_I82544_ETH0_SET_ESA. + * misc/redboot_RAM_ALTMAP.ecm: Ditto. + * misc/redboot_ROM.ecm: Ditto. + * misc/redboot_ROM_ALTMAP.ecm: Ditto. + +2002-01-28 Jesper Skov + + * cdl/hal_arm_xscale_iq80321.cdl: Removed explicit declaration of + plf_io.h + +2002-01-25 Mark Salter + + * include/hal_platform_setup.h: Fix I2C cleanup on last byte read. + +2002-01-24 Mark Salter + + * cdl/hal_arm_xscale_iq80321.cdl: Add + CYGSEM_HAL_ARM_IQ80321_CLEAR_PCI_RETRY + + * src/iq80321_pci.c (cyg_hal_plf_pci_init): Only init GBE_PIO_PIN. + Clear retry bit if CYGSEM_HAL_ARM_IQ80321_CLEAR_PCI_RETRY defined. + + * include/iq80321.h (IQ80321_GBE_GPIO_PIN): Define. + + * include/plf_io.h (HAL_PCI_TRANSLATE_INTERRUPT): Test for both + private and public ethernet device numbers. + +2002-01-23 Mark Salter + + * src/iq80321_pci.c (cyg_hal_plf_pci_init): Remove unneeded cruft. + + * include/pkgconf/mlt_arm_xscale_iq80321_ram_altmap.ldi: New file. + * include/pkgconf/mlt_arm_xscale_iq80321_ram_altmap.h: Newfile. + * include/pkgconf/mlt_arm_xscale_iq80321_rom_altmap.ldi: New file. + * include/pkgconf/mlt_arm_xscale_iq80321_rom_altmap.h: Newfile. + * misc/redboot_ROM_ALTMAP.ecm: New file. + * misc/redboot_RAM_ALTMAP.ecm: New file. + + * cdl/hal_arm_xscale_iq80321.cdl: Support alternate memory map. + * include/hal_platform_extras.h: Ditto. + * include/iq80321.h: Define alternate SDRAM virtual base. + * include/plf_io.h: Support alternative PCI window virtual addresses. + + * include/hal_plf_ints.h: Remove HAL_PLATFORM_RESET. + +2002-01-22 Mark Salter + + * misc/redboot_ROM.ecm: Add ethernet and min flash image size. + * misc/redboot_RAM.ecm: Add ethernet and min flash image size. + +2002-01-21 Mark Salter + + * include/hal_plf_ints.h: Rename CYGNUM_HAL_INTERRUPT_82544 to + CYGNUM_HAL_INTERRUPT_ETHERNET. + + * cdl/hal_arm_xscale_iq80321.cdl: Add iq80321_pci.c to compile list. + Use plf_io.h as CYGBLD_HAL_PLATFORM_IO_H. + + * include/plf_io.h: New file. IQ80321 IO macros. + + * src/iq80321_pci.c: New file. IQ80321 PCI-X support. + + * include/iq80321.h (REG_DISPLAY): New ASM macro to display register + contents on LEDs. + (SDRAM_DEVID): New define. I2C address for SDRAM module. + + * include/pkgconf/mlt_arm_xscale_iq80321_rom.ldi: Add mmu_tables. + + * include/hal_platform_extras.h: Put MMU table in .mmu_tables section. + + * include/hal_platform_setup.h: Add runtime SDRAM sizing/config. + +2002-01-09 Mark Salter + + * include/pkgconf/mlt*: Rearrange flash address and delete PCI window. + + * include/hal_platform_setup.h: Use uncached access to scrub RAM. + Cached access should work, so this may indicate a potential bug. + + * include/iq80321.h: Move cache flush and flash base. + + * include/hal_platform_extras.h: Page table rearrangement. + + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/arm/xscale/iq80321/current/cdl/hal_arm_xscale_iq80321.cdl b/packages/hal/arm/xscale/iq80321/current/cdl/hal_arm_xscale_iq80321.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/cdl/hal_arm_xscale_iq80321.cdl @@ -0,0 +1,408 @@ +# ==================================================================== +# +# hal_arm_xscale_iq80321.cdl +# +# Intel XScale IQ80321 platform HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): msalter +# Contributors: hmt +# Date: 2001-12-03 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== +cdl_package CYGPKG_HAL_ARM_XSCALE_IQ80321 { + display "Intel XScale IQ80321 evaluation board" + parent CYGPKG_HAL_ARM_XSCALE + hardware + include_dir cyg/hal + define_header hal_arm_xscale_iq80321.h + description " + This HAL platform package provides + support for the Intel XScale IQ80321 board." + + compile iq80321_misc.c hal_diag.c iq80321_pci.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_ARM_MEM_REAL_REGION_TOP + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_VARIANT_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "#define CYGBLD_HAL_PLF_INTS_H " + puts $::cdl_header "#define HAL_PLATFORM_CPU \"XScale\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"IQ80321\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + default_value {"RAM"} + legal_values {"RAM" "ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targeting the IQ80321 eval board it is possible to build + the system for either RAM bootstrap or ROM bootstrap(s). Select + 'ram' when building programs to load into RAM using onboard + debug software such as Angel or eCos GDB stubs. Select 'rom' + when building a stand-alone application which will be put + into ROM. Selection of 'stubs' is for the special case of + building the eCos GDB stubs themselves." + } + + cdl_component CYG_HAL_MEMORY_MAP { + display "MMU Mapping" + flavor data + default_value {"NORMAL"} + legal_values {"NORMAL" "ALTERNATE"} + no_define + define -file system.h CYG_HAL_MEMORY_MAP + description " + When targeting the IQ80321 eval board it is possible to build + the system for two MMU mappings. Select 'NORMAL' when building + programs to map all of RAM to virtual address 0x00000000. Select + ALTERNATE when building programs to map RAM at 0xA0000000. In + the ALTERNATE case, the first 1MB of RAM is also mapped at virtual + address 0x00000000 for CPU exception vectors." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 115200 ; + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 115200 ; + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + description " + Channel 0 is the only serial port on the board." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The IQ80321 has only one serial port." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + The IQ80321 has only one serial port." + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + no_define + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + parent CYGPKG_NONE + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "arm-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mcpu=xscale -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -mapcs-frame" } + description " + This option controls the global compiler flags which are used to + compile all packages by default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-mcpu=xscale -Wl,--gc-sections -Wl,-static -g -O2 -nostdlib" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) --remove-section=.fixed_vectors -O binary $< $@ + } + } + } + + cdl_component CYGPKG_HAL_ARM_XSCALE_IQ80321_OPTIONS { + display "Intel XScale IQ80321 build options" + flavor none + no_define + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + cdl_option CYGPKG_HAL_ARM_XSCALE_IQ80321_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the XScale IQ80321 HAL. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_HAL_ARM_XSCALE_IQ80321_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the XScale IQ80321 HAL. These flags are removed from + the set of global flags if present." + } + + cdl_option CYGNUM_HAL_BREAKPOINT_LIST_SIZE { + display "Number of breakpoints supported by the HAL." + flavor data + default_value 32 + description " + This option determines the number of breakpoints supported by the HAL." + } + + cdl_option CYGSEM_HAL_ARM_IQ80321_FAB_C { + display "Use Fab C IDSEL and IRQ steering" + flavor bool + default_value 0 + description " + This option controls whether or not the HAL uses PCI IDSEL and IRQ + routing appropriate for Fab C boards. Fab D and later boards have + different IDSELs and interrupt routing. Default is to not build + for Fab C." + } + + cdl_option CYGSEM_HAL_ARM_IQ80321_CLEAR_PCI_RETRY { + display "Clear PCI Retry bit" + flavor bool + default_value 1 + description " + This option controls whether or not the HAL allows the host PC + to completely boot. In some cases, it may not be desired to allow + this if RedBoot is used to automatically launch an application + which needs to run some setup code before allowing the PC to + finish booting. In that case, the application code, not RedBoot + will clear the PCI retry bit." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "arm_xscale_iq80321_ram" : \ + "arm_xscale_iq80321_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? \ + CYG_HAL_MEMORY_MAP == "NORMAL" ? "" : \ + "" : \ + CYG_HAL_MEMORY_MAP == "NORMAL" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? \ + CYG_HAL_MEMORY_MAP == "NORMAL" ? "" : \ + "" : \ + CYG_HAL_MEMORY_MAP == "NORMAL" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"GDB_stubs\" provides support when GDB stubs are included in + the ROM monitor or boot ROM." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + # compile -library=libextras.a redboot_cmds.c + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + compile -library=libextras.a diag/diag.c diag/io_utils.c \ + diag/xscale_test.c \ + diag/memtest.c diag/test_menu.c diag/i82544.c \ + diag/pcitest.c diag/battery.c diag/timer.c + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + + cdl_option CYGSEM_HAL_ARM_IQ80321_BATTERY_TEST { + display "Include Battery Test in Diagnostics Menu" + flavor bool + default_value 1 + description " + This option controls whether or not the battery test is included + in the IQ80321 diagnostics." + } + } + +} diff --git a/packages/hal/arm/xscale/iq80321/current/include/hal_diag.h b/packages/hal/arm/xscale/iq80321/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/hal_diag.h @@ -0,0 +1,94 @@ +#ifndef CYGONCE_HAL_DIAG_H +#define CYGONCE_HAL_DIAG_H + +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors: nickg, gthomas +// Date: 1998-09-11 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include +#include + +/*---------------------------------------------------------------------------*/ + +#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +// Not the best place for this, but ... +extern void hal_delay_us(cyg_int32 usecs); + +#define HAL_DELAY_US(n) hal_delay_us(n); + +#else + +/*---------------------------------------------------------------------------*/ +/* functions implemented in hal_diag.c */ + +externC void hal_diag_init(void); +externC void hal_diag_write_char(char c); +externC void hal_diag_read_char(char *c); + +#define HAL_DIAG_INIT() hal_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +#endif + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_DIAG_H */ diff --git a/packages/hal/arm/xscale/iq80321/current/include/hal_platform_extras.h b/packages/hal/arm/xscale/iq80321/current/include/hal_platform_extras.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/hal_platform_extras.h @@ -0,0 +1,279 @@ +#ifndef CYGONCE_HAL_PLATFORM_EXTRAS_H +#define CYGONCE_HAL_PLATFORM_EXTRAS_H + +/*============================================================================= +// +// hal_platform_extras.h +// +// Platform specific MMU table. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-12-03 +// Purpose: Intel XScale IQ80321 platform specific mmu table +// Description: +// Usage: #include +// Only used by "vectors.S" +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#if defined(CYG_HAL_STARTUP_ROM) + .section .mmu_tables, "a" + +#ifdef CYG_HAL_MEMORY_MAP_NORMAL + mmu_table: + // This page table sets up the preferred mapping: + // + // Virtual Address Physical Address Size (MB) Description + // --------------- ---------------- --------- ----------- + // 0x00000000 0xA0000000 512 DRAM + // 0x20000000 0x00000000 2048 ATU Outbound Direct + // 0xA0000000 0x80000000 257 ATU Outbound Xlate + // 0xB0100000 0x90100000 255 Unused + // 0xC0000000 0xA0000000 512 Uncached DRAM alias + // 0xE0000000 0xE0000000 1 Cache Flush + // 0xE0100000 0xE0100000 255 Unused + // 0xF0000000 0xF0000000 8 FLASH (PBIU CS0) + // 0xF0800000 0xF0800000 224 Unused + // 0xFE800000 0xFE800000 1 PBIU CS1-CS5 + // 0xFE900000 0xFE900000 22 Unused + // 0xFFF00000 0xFFF00000 1 Verde PMMR + + // 512MB ECC DRAM + // In flash based table: X=1, C=1, B=1, ECC + .set __base,0xA00 + .rept 0x200 - 0x000 + FL_SECTION_ENTRY __base,1,3,1,0,1,1 + .set __base,__base+1 + .endr + + // 2048MB ATU Outbound direct + // X=0, Non-cacheable, Non-bufferable + .set __base,0x000 + .rept 0xA00 - 0x200 + FL_SECTION_ENTRY __base,0,3,0,0,0,0 + .set __base,__base+1 + .endr + + // 257MB ATU Outbound translation + // X=0, Non-cacheable, Non-bufferable + .rept 0xB01 - 0xA00 + FL_SECTION_ENTRY __base,0,3,0,0,0,0 + .set __base,__base+1 + .endr + + // Nothing here + .rept 0xC00 - 0xB01 + FL_SECTION_ENTRY __base,0,0,0,0,0,0 + .set __base,__base+1 + .endr + + // Uncached/unbuffered alias for 512MB ECC DRAM + .set __base,0xA00 + .rept 0xE00 - 0xC00 + FL_SECTION_ENTRY __base,0,3,1,0,0,0 + .set __base,__base+1 + .endr + + // Cache flush region. + // Don't need physical memory, just a cached area. + .set __base,0xE00 + .rept 0xE01 - 0xE00 + FL_SECTION_ENTRY __base,1,3,0,0,1,1 + .set __base,__base+1 + .endr + + // Nothing here + .rept 0xF00 - 0xE01 + FL_SECTION_ENTRY __base,0,0,0,0,0,0 + .set __base,__base+1 + .endr + + // 8MB of FLASH + // X=0, Cacheable, Non-bufferable + .rept 0xF08 - 0xF00 + FL_SECTION_ENTRY __base,0,3,0,0,1,0 + .set __base,__base+1 + .endr + + // Nothing here + .rept 0xFE8 - 0xF08 + FL_SECTION_ENTRY __base,0,0,0,0,0,0 + .set __base,__base+1 + .endr + + // PBIU CS1 - CS5 + // X=0, Non-cacheable, Non-bufferable + .rept 0xFE9 - 0xFE8 + FL_SECTION_ENTRY __base,0,3,0,0,0,0 + .set __base,__base+1 + .endr + + // Nothing here + .rept 0xFFF - 0xFE9 + FL_SECTION_ENTRY __base,0,0,0,0,0,0 + .set __base,__base+1 + .endr + + // Verde PMMR + // X=0, Non-cacheable, Non-bufferable + .rept 0x1000 - 0xFFF + FL_SECTION_ENTRY __base,0,3,0,0,0,0 + .set __base,__base+1 + .endr +#else /* CYG_HAL_MEMORY_MAP_NORMAL */ + mmu_table: + // This page table sets up an alternate mapping: + // + // Virtual Address Physical Address Size (MB) Description + // --------------- ---------------- --------- ----------- + // 0x00000000 0xA0000000 1 DRAM + // 0x00100000 0x00100000 2047 ATU Outbound Direct + // 0x80000000 0x80000000 257 ATU Outbound Xlate + // 0x90100000 0x90100000 255 Invalid + // 0xA0000000 0xA0000000 512 DRAM + // 0xC0000000 0xA0000000 512 Uncached DRAM alias + // 0xE0000000 0xE0000000 1 Cache Flush + // 0xE0100000 0xE0100000 255 Invalid + // 0xF0000000 0xF0000000 8 FLASH (PBIU CS0) + // 0xF0800000 0xF0800000 224 Invalid + // 0xFE800000 0xFE800000 1 PBIU CS1-CS5 + // 0xFE900000 0xFE900000 22 Invalid + // 0xFFF00000 0xFFF00000 1 Verde PMMR + + // 1MB ECC DRAM + // This is a duplicate mapping of the first MB of RAM. It is mapped + // here for CPU exception vectors. + .set __base,0xA00 + .rept 0x001 - 0x000 + FL_SECTION_ENTRY __base,1,3,1,0,1,1 + .set __base,__base+1 + .endr + .set __base,0x001 + + // 2047MB ATU Outbound direct + // X=0, Non-cacheable, Non-bufferable + .rept 0x800 - 0x001 + FL_SECTION_ENTRY __base,0,3,0,0,0,0 + .set __base,__base+1 + .endr + + // 257MB ATU Outbound translation + // X=0, Non-cacheable, Non-bufferable + .rept 0x901 - 0x800 + FL_SECTION_ENTRY __base,0,3,0,0,0,0 + .set __base,__base+1 + .endr + + // Nothing here. Invalid. + .rept 0xA00 - 0x901 + FL_SECTION_ENTRY __base,0,0,0,0,0,0 + .set __base,__base+1 + .endr + + // 512MB ECC DRAM + // X=1, C=1, B=1, ECC + .rept 0xC00 - 0xA00 + FL_SECTION_ENTRY __base,1,3,1,0,1,1 + .set __base,__base+1 + .endr + + // Uncached/unbuffered alias for 512MB ECC DRAM + .set __base,0xA00 + .rept 0xE00 - 0xC00 + FL_SECTION_ENTRY __base,0,3,1,0,0,0 + .set __base,__base+1 + .endr + + // Cache flush region. + // Don't need physical memory, just a cached area. + .set __base,0xE00 + .rept 0xE01 - 0xE00 + FL_SECTION_ENTRY __base,1,3,0,0,1,1 + .set __base,__base+1 + .endr + + // Nothing here + .rept 0xF00 - 0xE01 + FL_SECTION_ENTRY __base,0,0,0,0,0,0 + .set __base,__base+1 + .endr + + // 8MB of FLASH + // X=0, Cacheable, Non-bufferable + .rept 0xF08 - 0xF00 + FL_SECTION_ENTRY __base,0,3,0,0,1,0 + .set __base,__base+1 + .endr + + // Nothing here + .rept 0xFE8 - 0xF08 + FL_SECTION_ENTRY __base,0,0,0,0,0,0 + .set __base,__base+1 + .endr + + // PBIU CS1 - CS5 + // X=0, Non-cacheable, Non-bufferable + .rept 0xFE9 - 0xFE8 + FL_SECTION_ENTRY __base,0,3,0,0,0,0 + .set __base,__base+1 + .endr + + // Nothing here + .rept 0xFFF - 0xFE9 + FL_SECTION_ENTRY __base,0,0,0,0,0,0 + .set __base,__base+1 + .endr + + // Verde PMMR + // X=0, Non-cacheable, Non-bufferable + .rept 0x1000 - 0xFFF + FL_SECTION_ENTRY __base,0,3,0,0,0,0 + .set __base,__base+1 + .endr +#endif /* CYG_HAL_MEMORY_MAP_NORMAL */ + + +#endif /* CYG_HAL_STARTUP_ROM */ + +/*---------------------------------------------------------------------------*/ +/* end of hal_platform_setup.h */ +#endif /* CYGONCE_HAL_PLATFORM_SETUP_H */ diff --git a/packages/hal/arm/xscale/iq80321/current/include/hal_platform_setup.h b/packages/hal/arm/xscale/iq80321/current/include/hal_platform_setup.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/hal_platform_setup.h @@ -0,0 +1,916 @@ +#ifndef CYGONCE_HAL_PLATFORM_SETUP_H +#define CYGONCE_HAL_PLATFORM_SETUP_H + +/*============================================================================= +// +// hal_platform_setup.h +// +// Platform specific support for HAL (assembly code) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-12-03 +// Purpose: Intel XScale IQ80321 platform specific support routines +// Description: +// Usage: #include +// Only used by "vectors.S" +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include // System-wide configuration info +#include CYGBLD_HAL_VARIANT_H // Variant specific configuration +#include CYGBLD_HAL_PLATFORM_H // Platform specific configuration +#include // Variant specific hardware definitions +#include // MMU definitions +#include // more MMU definitions +#include // Platform specific hardware definitions +#include + +#if defined(CYG_HAL_STARTUP_ROM) +#define PLATFORM_SETUP1 _platform_setup1 +#define PLATFORM_EXTRAS +#define CYGHWR_HAL_ARM_HAS_MMU + +.macro NOPs count + .rept \count + nop + nop + .endr +.endm + +// ------------------------------------------------------------------------ +// Define macro used to diddle the LEDs during early initialization. +// Can use r0+r1. Argument in \x. +#define CYGHWR_LED_MACRO \ + b 667f ;\ + 666: ;\ + .byte DISPLAY_0, DISPLAY_1, DISPLAY_2, DISPLAY_3 ;\ + .byte DISPLAY_4, DISPLAY_5, DISPLAY_6, DISPLAY_7 ;\ + .byte DISPLAY_8, DISPLAY_9, DISPLAY_A, DISPLAY_B ;\ + .byte DISPLAY_C, DISPLAY_D, DISPLAY_E, DISPLAY_F ;\ + 667: ;\ + ldr r0, =666b ;\ + add r0, r0, #\x ;\ + ldrb r1, [r0] ;\ + ldr r0, =DISPLAY_RIGHT ;\ + str r1, [r0] + +#define PAUSE \ + ldr r1,=0x8000; \ + 555: sub r1,r1,#1; \ + cmp r1,#0; \ + bne 555b; + +#define DCACHE_SIZE (32 * 1024) + +// ------------------------------------------------------------------------ +// MCU Register Values + +// ------------------------------------------------------------------------ +// This macro represents the initial startup code for the platform + .macro _platform_setup1 + // This is where we wind up immediately after reset. At this point, we + // are executing from the boot address (0x00000000), not the eventual + // flash address. Do some basic setup using position independent code + // then switch to real flash address + +// FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME +// This is a quick and dirty workaround to an apparent gas/ld +// bug. The computed UNMAPPED_PTR(reset_vector) is off by 0x20. + .rept 0x20/4 + nop + .endr +// FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME + + ldr r0,=(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SUPERVISOR_MODE) + msr cpsr, r0 + + // enable coprocessor access + ldr r0, =0x20c1 // CP13,CP7,CP6,CP0 + mcr p15, 0, r0, c15, c1, 0 + + // Drain write and fill buffer + mcr p15, 0, r0, c7, c10, 4 + CPWAIT r0 + + // Setup PBIU chip selects + ldr r8, =PBIU_PBCR + + ldr r2, =PBLR_SZ_4K + ldr r1, =IQ80321_UART_ADDR | PBAR_FLASH | PBAR_RCWAIT_20 | PBAR_ADWAIT_20 | PBAR_BUS_8 + str r1, [r8, #0x10] // PBIU_PBAR1 + str r2, [r8, #0x14] // PBIU_PBLR1 + + ldr r1, =IQ80321_DISPLAY_RIGHT_ADDR | PBAR_FLASH | PBAR_RCWAIT_20 | PBAR_ADWAIT_20 | PBAR_BUS_32 + str r1, [r8, #0x18] // PBIU_PBAR2 + str r2, [r8, #0x1C] // PBIU_PBLR2 + + ldr r1, =IQ80321_DISPLAY_LEFT_ADDR | PBAR_FLASH | PBAR_RCWAIT_20 | PBAR_ADWAIT_20 | PBAR_BUS_32 + str r1, [r8, #0x20] // PBIU_PBAR3 + str r2, [r8, #0x24] // PBIU_PBLR3 + + ldr r1, =IQ80321_ROTARY_SWITCH_ADDR | PBAR_FLASH | PBAR_RCWAIT_20 | PBAR_ADWAIT_20 | PBAR_BUS_32 + str r1, [r8, #0x28] // PBIU_PBAR4 + str r2, [r8, #0x2C] // PBIU_PBLR4 + + ldr r1, =IQ80321_BATTERY_STATUS_ADDR | PBAR_FLASH | PBAR_RCWAIT_20 | PBAR_ADWAIT_20 | PBAR_BUS_32 + str r1, [r8, #0x30] // PBIU_PBAR5 + str r2, [r8, #0x34] // PBIU_PBLR5 + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_1 + // ==================================================================== + + // Enable the Icache + mrc p15, 0, r0, c1, c0, 0 + orr r0, r0, #MMU_Control_I + mcr p15, 0, r0, c1, c0, 0 + CPWAIT r0 + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_2 + // ==================================================================== + + // value to write into PBIU_PBAR0 to establish runtime flash address + ldr r1, =IQ80321_FLASH_ADDR | PBAR_FLASH | PBAR_RCWAIT_20 | PBAR_ADWAIT_20 | PBAR_BUS_16 + + // value to write into PBIU_PBLR0 to establish runtime flash address + ldr r2, =PBLR_SZ_8M + + // value to load into pc to jump to real runtime address + ldr r7, =1f + + ldr r9, =IQ80321_DISPLAY_RIGHT_ADDR + ldr r10,=IQ80321_DISPLAY_LEFT_ADDR + ldr r11,=DISPLAY_F + + b icache_boundary + .p2align 5 +icache_boundary: + // Here is where we switch from boot address (0x000000000) to the + // actual flash runtime address. We align to cache boundary so we + // execute from cache during the switchover. Cachelines are 8 words. + str r1, [r8, #0x08] // PBIU_PBAR0 + str r2, [r8, #0x0c] // PBIU_PBLR0 + nop + nop + mov pc, r7 + str r11, [r9] // We should never reach this point. If we do, + str r11, [r10] // display FF and loop forever. + 0: b 0b + 1: + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_3 + // ==================================================================== + + // Set the TTB register + ldr r0, =mmu_table + mcr p15, 0, r0, c2, c0, 0 + + // Enable permission checks in all domains + ldr r0, =0x55555555 + mcr p15, 0, r0, c3, c0, 0 + + // Enable the MMU + mrc p15, 0, r0, c1, c0, 0 + orr r0, r0, #MMU_Control_M + orr r0, r0, #MMU_Control_R + mcr p15, 0, r0, c1, c0, 0 + CPWAIT r0 + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_4 + // ==================================================================== + + // + // *** I2C interface initialization *** + // + + // Pointers to I2C Registers + ldr r11, =I2C_ICR0 // address of the I2C Control Register in r11. + ldr r12, =I2C_ISR0 // address of the I2C Status Register in r12. + ldr r13, =I2C_IDBR0 // address of the I2C Data Buffer Register in r13. + + // Write 0 to avoid interfering with I2C bus. + // (See GPIO section in 80321 manual) + ldr r2, =GPIO_GPOD + mov r3, #0 + strb r3, [r2] + + // Reset I2C Unit + mov r1, #ICR_RESET + str r1, [r11] + ldr r1, =0x7ff + str r1, [r12] + mov r1, #0 + str r1, [r11] + + // Setup I2C Slave Address Register + ldr r2, =I2C_ISAR0 // Load address of the I2C Slave Address Register in r2. + mov r1, #I2C_DEVID // Load slave address r1. + str r1, [r2] // Save the value 0x02 (I2C_DEVID) in the register. + + // Enable I2C Interface Unit - status will be polled + ldr r1, =ICR_GCALL | ICR_ENB | ICR_SCLENB + str r1, [r11] + + // + // *** Now read the SPD Data *** + // + + // Initialize regs for loop + mov r4, #0 // SDRAM size + mov r5, #0 // R5 has running checksum calculation + mov r6, #0 // Counter incremented before byte is read + mov r7, #64 // Number of bytes to read in the Presence Detect EEPROM of SDRAM + mov r8, #0 // Flags: b0-b6 == bankcnt, b7 = x16 flag + mov r9, #RFR_15_6us // Refresh rate (assume normal 15.6us) + mov r10, #0 // Bank size + mov r14, #0 // ECC flag + + ldr r0, [r12] // Load I2C Status Reg into R0 + str r0, [r12] // Clear status + + /* FREE REGISTERS ARE R0 - R3 */ + + // *** Put out address, with WRITE mode *** + + // Set SDRAM module address and write mode + mov r1, #SDRAM_DEVID // Load slave address for SDRAM module. 0xA2 (Presence Detect Data) + bic r1, r1, #IDBR_MODE // Clear read bit (bit #0) + str r1, [r13] // Store to data register + + // Initiate dummy write to set EEPROM pointer to 0 + ldr r1, [r11] // read the current Control Register value + bic r1, r1, #ICR_STOP // No stop bit + orr r1, r1, #ICR_START | ICR_TRANSFER + str r1, [r11] // Store to control register + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_9, DISPLAY_0 + // ==================================================================== + + // Wait for transmit empty status + mov r1, #I2C_TIMOUT // Initialize I2C timeout counter + 0: subs r1, r1, #1 // Increment I2C timeout counter (r1 = r1 + 1) + beq i2c_error // Kick out of SDRAM initialization if timeout occurs + ldr r0, [r12] // Load I2C Status Reg into R0 + ands r3, r0, #ISR_EMPTY // Bit #6 is checked, IDBR Transmit Empty + beq 0b // If bit = 0 then branch to 0 and check again + str r0, [r12] // Write back status to clear + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_9, DISPLAY_1 + // ==================================================================== + + // Write pointer register on EEPROM to 0x00000000 + mov r1, #0 // Load base address of SDRAM module EEPROM + str r1, [r13] // Store to data register + + // Send address to EEPROM + ldr r1, [r11] // read the current Control Register value + bic r1, r1, #ICR_START | ICR_STOP + orr r1, r1, #ICR_TRANSFER // Set transfer bit - bit is self_clearing + str r1, [r11] // Store to control register + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_9, DISPLAY_2 + // ==================================================================== + + // Wait for transmit empty status + mov r1, #I2C_TIMOUT // Initialize I2C timeout counter + 0: subs r1, r1, #1 // Increment I2C timeout counter (r1 = r1 + 1) + beq i2c_error // Kick out of SDRAM initialization if timeout occurs + ldr r0, [r12] // Load I2C Status Reg into R0 - ld (r12), r10 + ands r3, r0, #ISR_EMPTY // Bit #6 is checked, IDBR Transmit Empty + beq 0b // If bit = 0 then branch to 0 and check again + str r0, [r12] // Write back status to clear +1: + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_9, DISPLAY_3 + // ==================================================================== + + // *** Read SDRAM PD data *** + + // *** Put out address, with READ mode *** + + // Set SDRAM module address and read mode + mov r0, #SDRAM_DEVID // Load slave address for SDRAM module (0xA2) + orr r1, r0, #IDBR_MODE // Set read bit (bit #0) + str r1, [r13] // Store to data register + + // Send next read request + ldr r1, [r11] // read the current Control Register value + bic r1, r1, #ICR_STOP // No stop bit + orr r1, r1, #ICR_START | ICR_TRANSFER + str r1, [r11] // Store to control register + + // Wait for transmit empty status + mov r1, #I2C_TIMOUT // Initialize I2C timeout counter + 0: subs r1, r1, #1 // Increment I2C timeout counter (r1 = r1 + 1) + beq i2c_error // Kick out of SDRAM initialization if timeout occurs + ldr r0, [r12] // Load I2C Status Reg into R0 - ld (r12), r10 + ands r3, r0, #ISR_EMPTY // Bit #6 is checked, IDBR Transmit Empty + beq 0b // If bit = 0 then branch to 0 and check again + str r0, [r12] // Write back status to clear + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_9, DISPLAY_4 + // ==================================================================== + + spd_loop: + // read the next Byte of Serial Presence Detect data + + ldr r1, [r11] // read the current Control Register value + bic r1, r1, #ICR_START // No start bit (already started) + orr r1, r1, #ICR_TRANSFER // Set transfer bit - bit is self_clearing + + // we have to set NACK before reading the last byte + add r2, r6, #1 + cmp r2, r7 // r7 = 64 (decimal) so if r6 = 64, this is the last byte to be read + orreq r1, r1, #ICR_ACK | ICR_STOP + str r1, [r11] // Store to control register + + // Wait for read full status + mov r1, #I2C_TIMOUT // Initialize I2C timeout counter + 0: subs r1, r1, #1 // decrement timeout + beq i2c_error // Kick out of SDRAM initialization if timeout occurs + ldr r0, [r12] // Load I2C Status Reg into R0 + ands r3, r0, #ISR_FULL // Bit #7 is checked + beq 0b // If bit = 0 then branch to 0 and check again + str r0, [r12] // Write back status to clear + + ldr r1, [r13] // Read the byte + + // check for checksum byte + subs r2, r6, #SPD_CHECKSUM + addne r5, r5, r1 // Add it to the checksum if not the checksum byte + bne 1f // skip checksum comparison + and r5, r5, #0xff // against the calculated checksum + cmp r1, r5 + beq spd_continue + + // bad checksum + HEX_DISPLAY r2, r3, DISPLAY_7, DISPLAY_7 + 0: b 0b + + 1: + // Check for bank count byte + subs r2, r6, #SPD_BANKCNT + moveq r8, r1 // Store bank count + beq spd_continue + + // Check for ECC + subs r2, r6, #SPD_CONFIG + bne 1f + subs r2, r1, #2 + addeq r14, r14, #1 + b spd_continue + 1: + + // Check for refresh rate + subs r2, r6, #SPD_REFRESH + bne 1f + + ands r2, r1, #0x7f + moveq r9, #RFR_15_6us + subs r3, r2, #1 + moveq r9, #RFR_3_9us + subs r3, r2, #2 + moveq r9, #RFR_7_8us + + b spd_continue + + 1: + // Check for SDRAM width byte + subs r2, r6, #SPD_SDRAM_WIDTH + bne 1f + + ands r2, r1, #0x10 // Check for data width of 16 + orr r8, r8, r2, lsl #3 // set b7 in r8 if x16 + +#if 0 // drive strength doesn't depend on width + ldreq r2, =x8_table // x8 if bit not set + ldrne r2, =x16_table // x16 if bit not set + b init_drive_strength + + x16_table: + .word 0x18 // Data Bus Pull Up + .word 0x18 // Data Bus Pull Down + .word 0x22 // Clock Pull Up + .word 0x20 // Clock Pull Down + .word 0x30 // Clock Enable Pull Up + .word 0x30 // Clock Enable Pull Down + .word 0x30 // Chip Select Pull Up + .word 0x30 // Chip Select Pull Down + .word 0x18 // Receive Enable Pull Up + .word 0x18 // Receive Enable Pull Down + .word 0x3c // Address Bus Pull Up + .word 0x3c // Address Bus Pull Down + + x8_table: + .word 0x18 // Data Bus Pull Up + .word 0x18 // Data Bus Pull Down + .word 0x22 // Clock Pull Up + .word 0x20 // Clock Pull Down + .word 0x30 // Clock Enable Pull Up + .word 0x30 // Clock Enable Pull Down + .word 0x30 // Chip Select Pull Up + .word 0x30 // Chip Select Pull Down + .word 0x18 // Receive Enable Pull Up + .word 0x18 // Receive Enable Pull Down + .word 0x3c // Address Bus Pull Up + .word 0x3c // Address Bus Pull Down +#else + b spd_continue + + registered_table: + .word 13 // Data Bus Pull Up + .word 13 // Data Bus Pull Down + .word 34 // Clock Pull Up + .word 32 // Clock Pull Down + .word 48 // Clock Enable Pull Up + .word 48 // Clock Enable Pull Down + .word 13 // Chip Select Pull Up + .word 13 // Chip Select Pull Down + .word 13 // Receive Enable Pull Up + .word 13 // Receive Enable Pull Down + .word 13 // Address Bus Pull Up + .word 13 // Address Bus Pull Down + + unbuffered_table: + .word 13 // Data Bus Pull Up + .word 13 // Data Bus Pull Down + .word 34 // Clock Pull Up + .word 32 // Clock Pull Down + .word 48 // Clock Enable Pull Up + .word 48 // Clock Enable Pull Down + .word 24 // Chip Select Pull Up + .word 24 // Chip Select Pull Down + .word 13 // Receive Enable Pull Up + .word 13 // Receive Enable Pull Down + .word 24 // Address Bus Pull Up + .word 24 // Address Bus Pull Down +#endif + + init_drive_strength: + + ldr r1, =MCU_DBUDSR + mov r3, #12 // 12 contiguous registers to set + 0: + ldr r0, [r2], #4 // load value + str r0, [r1], #4 // store to register + subs r3, r3, #1 + bne 0b + b spd_continue + 1: + + // Check for module attribute byte + subs r2, r6, #SPD_MOD_ATTRIB + bne 1f + ldr r0, =MCU_SDCR + mov r2, #SDCR_INIT_VAL + ands r3, r1, #SPD_ATTRIB_REG_CTL // check for registered modules + beq 2f + orr r2, r2, #2 + str r2, [r0] + ldr r2, =registered_table + b init_drive_strength + 2: + str r2, [r0] + ldr r2, =unbuffered_table + b init_drive_strength + 1: + + // Check for bank size byte + subs r2, r6, #SPD_BANKSZ + bne 1f + mov r10, r1, lsl #2 // Store bank size in Mbytes (shift left 2 bits) + and r3, r8, #0x7f // isolate bank count + mul r2, r3, r10 // Multiply by bank count to get DRAM size in MB + mov r4, r2, lsl #20 // Convert size to bytes - r4 contains DRAM size in bytes + b spd_continue + 1: + + spd_continue: + // Continue reading bytes if not done + add r6, r6, #1 // Increment byte counter + cmp r6, r7 + bne spd_loop + + b i2c_disable + + .ltorg + i2c_error: + // hit the leds if an error occurred + HEX_DISPLAY r2, r3, DISPLAY_5, DISPLAY_5 + b i2c_error + i2c_disable: + // Disable I2C Interface Unit + ldr r1, [r11] + bic r1, r1, #ICR_ENB | ICR_SCLENB // Disable I2C unit + str r1, [r11] + + // At this point, r4 = SDRAM size in bytes, r8 = Bank count, r10 = bank size in MB + + + // *** SDRAM setup *** + + // Set the DDR SDRAM Base Register - SDBR (the lowest address for memory) + ldr r0, =MCU_SDBR + mov r1, #SDRAM_PHYS_BASE + str r1, [r0] + + // Set up bank 0 register + subs r1, r10, #32 + moveq r0, #SBR_32MEG // Program SDRAM Bank0 Boundary register to 32 MB + beq 1f + subs r1, r10, #64 // do we have 64 MB banks? + moveq r0, #SBR_64MEG // Program SDRAM Bank0 Boundary register to 64 MB + beq 1f + subs r1, r10, #128 // do we have 128 MB banks? + moveq r0, #SBR_128MEG // Program SDRAM Bank0 Boundary register to 128 MB + beq 1f + subs r1, r10, #256 // do we have 256 MB banks? + moveq r0, #SBR_256MEG // Program SDRAM Bank0 Boundary register to 64 MB + beq 1f + subs r1, r10, #512 // do we have 512 MB banks? + moveq r0, #SBR_512MEG // Program SDRAM Bank0 Boundary register to 64 MB + beq 1f + + bank_err: + HEX_DISPLAY r2, r3, DISPLAY_F, DISPLAY_F + b bank_err + 1: + mov r1, #SDRAM_PHYS_BASE + mov r2, #0x1f + and r2, r2, r1, lsr #25 + add r2, r2, r0 + + ands r1, r8, #0x80 + and r8, r8, #0x7f + beq 1f + // x16 + subs r1, r10, #128 + addeq r2, r2, #0x80000000 + 1: + ldr r1, =MCU_SBR0 + str r2, [r1] // store SBR0 + + subs r1, r8, #2 // do we have 2 banks??? + addeq r2, r2, r0 // SBR1 == SBR0+r0 if two banks + ldr r1, =MCU_SBR1 + str r2, [r1] + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_5 + // ==================================================================== + + DELAY_FOR 0x1800000, r0 + + // Disable the refresh counter by setting the RFR to zero. + // (from section 7.2.2.6 of the Verde technical specification) + ldr r0, =MCU_RFR + mov r1, #0 + str r1, [r0] + + // Issue one NOP cycle after the 200 us device deselect. A NOP is + // accomplished by setting the SDIR to 0101. + ldr r0, =MCU_SDIR + mov r1, #SDIR_CMD_NOP + str r1, [r0] + + // Issue a precharge-all command to the DDR SDRAM interface by setting + // the SDIR to 0100. + mov r1, #SDIR_CMD_PRECHARGE_ALL + str r1, [r0] + + // Issue an extended-mode-register-set command to enable the DLL by + // writing 0110 to the SDIR. + NOPs 8 + + mov r1, #SDIR_CMD_ENABLE_DLL + str r1, [r0] + + // After waiting T mrd cycles (4 clocks at 200 MHz), issue a + // mode-register-set command by writing to the SDIR to program the DDR + // SDRAM parameters and to Reset the DLL. Setting the SDIR to 0010 + // programs the MCU for CAS Latency of two while setting the SDIR to 0011 + // programs the MCU for CAS Latency of two and one-half. The MCU supports + // the following DDR SDRAM mode parameters: + // a. CAS Latency (CL) = two or two and one-half + // b. Wrap Type (WT) = Sequential + // c. Burst Length (BL) = four + NOPs 8 + + mov r1, #SDIR_CMD_CAS_LAT_2_A // Set CAS Latency to 2 + str r1, [r0] + + // After waiting T mrd cycles (4 clocks at 200 MHz), issue a precharge-all + // command to the DDR SDRAM interface by setting the SDIR to 0100. + NOPs 8 + + mov r1, #SDIR_CMD_PRECHARGE_ALL + str r1, [r0] + + // After waiting T rp cycles (4 clocks at 200 MHz), provide two + // auto-refresh cycles. An auto-refresh cycle is accomplished by + // setting the SDIR to 0111. Software must ensure at least T rfc + // cycles (16 clocks at 200 MHz) between each auto-refresh command. + NOPs 8 + + mov r1, #SDIR_CMD_AUTO_REFRESH // 1st of two auto-refresh cycle commands + str r1, [r0] + + NOPs 8 + + str r1, [r0] // 2nd of two auto-refresh cycle commands + + NOPs 8 + + // Issues a mode-register-set command by writing to the SDIR to program the + // DDR SDRAM parameters without resetting the DLL. Setting the SDIR to 0000 + // programs the MCU for CAS Latency of two while setting the SDIR to 0001 + // programs the MCU for CAS Latency of two and one-half. The MCU supports + // the following DDR SDRAM mode parameters: + // a. CAS Latency (CL) = two or two and one-half + // b. Wrap Type (WT) = Sequential + // c. Burst Length (BL) = four + mov r1, #SDIR_CMD_CAS_LAT_2_B // Set CAS Latency to 2 + str r1, [r0] + + NOPs 8 + + mov r1, #0xF // DDR Normal Operation + str r1, [r0] + + // Re-enable the refresh counter by setting the RFR to the required value. + // + ldr r0, =MCU_RFR + str r9, [r0] + + // DSDR - Data Strobe Delay Register (Section 7.6.25) + ldr r0, =MCU_DSDR + ldr r1, =DSDR_REC_VAL + str r1, [r0] + + // REDR - Receive Enable Delay Register (Section 7.6.26) + ldr r0, =MCU_REDR + ldr r1, =REDR_REC_VAL + str r1, [r0] + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_6 + // ==================================================================== + + // delay before using SDRAM + DELAY_FOR 0x1800000, r0 + + // Enable the Dcache + mrc p15, 0, r0, c1, c0, 0 + orr r0, r0, #MMU_Control_C + mcr p15, 0, r0, c1, c0, 0 + CPWAIT r0 + + // Enable branch target buffer + mrc p15, 0, r0, c1, c0, 0 + orr r0, r0, #MMU_Control_BTB + mcr p15, 0, r0, c1, c0, 0 + CPWAIT r0 + + mcr p15, 0, r0, c7, c10, 4 // drain the write & fill buffers + CPWAIT r0 + + mcr p15, 0, r0, c7, c7, 0 // flush Icache, Dcache and BTB + CPWAIT r0 + + mcr p15, 0, r0, c8, c7, 0 // flush instuction and data TLBs + CPWAIT r0 + + mcr p15, 0, r0, c7, c10, 4 // drain the write & fill buffers + CPWAIT r0 + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_S, DISPLAY_L + // ==================================================================== + + ldr r0, =MCU_ECTST // clear test register + mov r1, #0 + str r1, [r0] + + ldr r0, =MCU_ECCR + mov r1, #0x0 // disable ECC, disable reporting + str r1, [r0] + +#ifdef CYGSEM_HAL_ARM_IQ80321_BATTERY_TEST + // Battery Backup SDRAM Memory Test + // Move test pattern into register prior to memory scrub + ldr r9, =SDRAM_BATTERY_TEST_ADDR + ldr r10, [r9] +#endif + + orrs r14, r14, r14 + beq no_ecc1 + + ldr r0, =MCU_ECCR + mov r1, #0x8 // enable ECC, disable reporting + str r1, [r0] + + no_ecc1: + + // scrub init + mov r12, r4 // size of memory to scrub + mov r8, r4 // save DRAM size + mov r0, #0 + mov r1, #0 + mov r2, #0 + mov r3, #0 + mov r4, #0 + mov r5, #0 + mov r6, #0 + mov r7, #0 + + ldr r11, =SDRAM_UNCACHED_BASE + + // scrub Loop + 0: + stmia r11!, {r0-r7} + subs r12, r12, #32 + bne 0b + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_S, DISPLAY_E + // ==================================================================== + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_7 + // ==================================================================== + + // clean, drain, flush the main Dcache + ldr r1, =DCACHE_FLUSH_AREA // use a CACHEABLE area of + // memory that's mapped above SDRAM + mov r0, #1024 // number of lines in the Dcache + 0: + mcr p15, 0, r1, c7, c2, 5 // allocate a Dcache line + add r1, r1, #32 // increment to the next cache line + subs r0, r0, #1 // decrement the loop count + bne 0b + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_8 + // ==================================================================== + + // clean, drain, flush the mini Dcache + ldr r2, =DCACHE_FLUSH_AREA + DCACHE_SIZE + mov r0, #64 // number of lines in the Dcache + 0: + mcr p15, 0, r2, c7, c2, 5 // allocate a Dcache line + add r2, r2, #32 // increment to the next cache line + subs r0, r0, #1 // decrement the loop count + bne 0b + + mcr p15, 0, r0, c7, c6, 0 // flush Dcache + CPWAIT r0 + + mcr p15, 0, r0, c7, c10, 4 // drain the write & fill buffers + CPWAIT r0 + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_9 + // ==================================================================== + orrs r14, r14, r14 + beq no_ecc2 + + ldr r0, =MCU_MCISR + mov r1, #7 + str r1, [r0] + + ldr r0, =MCU_ECCR + ldr r1, =0x0f // enable ECC + str r1, [r0] + + no_ecc2: + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_A + // ==================================================================== + +#ifdef CYGSEM_HAL_ARM_IQ80321_BATTERY_TEST + // Battery Backup SDRAM Memory Test + // Store test pattern back into memory + str r10, [r9] +#endif + + // Save SDRAM size + ldr r1, =hal_dram_size /* [see hal_intr.h] */ + str r8, [r1] + + // Move mmu tables into RAM so page table walks by the cpu + // don't interfere with FLASH programming. + ldr r0, =mmu_table + add r2, r0, #0x4000 // End of tables + mov r1, #SDRAM_BASE + orr r1, r1, #0x4000 // RAM tables + + // everything can go as-is + 1: + ldr r3, [r0], #4 + str r3, [r1], #4 + cmp r0, r2 + bne 1b + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_B + // ==================================================================== + + // clean, drain, flush the main Dcache + ldr r1, =DCACHE_FLUSH_AREA // use a CACHEABLE area of memory + mov r0, #1024 // number of lines in the Dcache + 0: + mcr p15, 0, r1, c7, c2, 5 // allocate a Dcache line + add r1, r1, #32 // increment to the next cache line + subs r0, r0, #1 // decrement the loop count + bne 0b + + // clean, drain, flush the mini Dcache + ldr r2, =DCACHE_FLUSH_AREA + DCACHE_SIZE + mov r0, #64 // number of lines in the Dcache + 0: + mcr p15, 0, r2, c7, c2, 5 // allocate a Dcache line + add r2, r2, #32 // increment to the next cache line + subs r0, r0, #1 // decrement the loop count + bne 0b + + mcr p15, 0, r0, c7, c6, 0 // flush Dcache + CPWAIT r0 + + mcr p15, 0, r0, c7, c10, 4 // drain the write & fill buffers + CPWAIT r0 + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_C + // ==================================================================== + + // Set the TTB register to DRAM mmu_table + ldr r0, =(SDRAM_PHYS_BASE | 0x4000) // RAM tables + mov r1, #0 + mcr p15, 0, r1, c7, c5, 0 // flush I cache + mcr p15, 0, r1, c7, c10, 4 // drain WB + mcr p15, 0, r0, c2, c0, 0 // load page table pointer + mcr p15, 0, r1, c8, c7, 0 // flush TLBs + CPWAIT r0 + + // ==================================================================== + HEX_DISPLAY r0, r1, DISPLAY_A, DISPLAY_D + // ==================================================================== + .endm // _platform_setup1 + +#else // defined(CYG_HAL_STARTUP_ROM) +#define PLATFORM_SETUP1 +#endif + +#define PLATFORM_VECTORS _platform_vectors + .macro _platform_vectors + .endm + +/*---------------------------------------------------------------------------*/ +/* end of hal_platform_setup.h */ +#endif /* CYGONCE_HAL_PLATFORM_SETUP_H */ diff --git a/packages/hal/arm/xscale/iq80321/current/include/hal_plf_ints.h b/packages/hal/arm/xscale/iq80321/current/include/hal_plf_ints.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/hal_plf_ints.h @@ -0,0 +1,68 @@ +#ifndef CYGONCE_HAL_PLF_INTS_H +#define CYGONCE_HAL_PLF_INTS_H +//========================================================================== +// +// hal_plf_ints.h +// +// HAL Platform Interrupt support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-12-03 +// Purpose: Define Interrupt support +// Description: The interrupt details for a specific platform is defined here. +// Usage: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// start with variant ints +#include CYGBLD_HAL_VAR_INTS_H + +#ifdef CYGSEM_HAL_ARM_IQ80321_FAB_C +#define CYGNUM_HAL_INTERRUPT_ETHERNET CYGNUM_HAL_INTERRUPT_XINT2 +#define CYGNUM_HAL_INTERRUPT_UART CYGNUM_HAL_INTERRUPT_XINT3 +#else +#define CYGNUM_HAL_INTERRUPT_ETHERNET CYGNUM_HAL_INTERRUPT_XINT0 +#define CYGNUM_HAL_INTERRUPT_UART CYGNUM_HAL_INTERRUPT_XINT1 +#endif + +#endif // CYGONCE_HAL_PLF_INTS_H diff --git a/packages/hal/arm/xscale/iq80321/current/include/iq80321.h b/packages/hal/arm/xscale/iq80321/current/include/iq80321.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/iq80321.h @@ -0,0 +1,231 @@ +#ifndef CYGONCE_HAL_ARM_XSCALE_IQ80321_IQ80321_H +#define CYGONCE_HAL_ARM_XSCALE_IQ80321_IQ80321_H + +/*============================================================================= +// +// iq80321.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-12-03 +// Purpose: Intel IQ80321 platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include CYGHWR_MEMORY_LAYOUT_H +#include +#include // IO Processor defines + +#define IQ80321_FLASH_ADDR 0xf0000000 // Verde PBIU CS0 +#define IQ80321_UART_ADDR 0xfe800000 // Verde PBIU CS1 +#define IQ80321_DISPLAY_RIGHT_ADDR 0xfe850000 // Verde PBIU CS2 +#define IQ80321_DISPLAY_LEFT_ADDR 0xfe840000 // Verde PBIU CS3 +#define IQ80321_ROTARY_SWITCH_ADDR 0xfe8d0000 // Verde PBIU CS4 +#define IQ80321_BATTERY_STATUS_ADDR 0xfe8f0000 // Verde PBIU CS5 + +#define SDRAM_PHYS_BASE 0xa0000000 +#ifdef CYG_HAL_MEMORY_MAP_NORMAL +#define SDRAM_BASE 0x00000000 +#else +#define SDRAM_BASE 0xa0000000 +#endif +#define SDRAM_SIZE 0x08000000 // 128MB +#define SDRAM_MAX 0x20000000 // 512MB + +// These must match setup in the page table in hal_platform_extras.h +#define SDRAM_UNCACHED_BASE 0xc0000000 +#define DCACHE_FLUSH_AREA 0xe0000000 + +// Pin used to enable Gigabit Ethernet NIC +// The GPIO pin only has effect when switch S7E1-5 is closed (ON). +#define IQ80321_GBE_GPIO_PIN 4 + +// ------------------------------------------------------------------------ +// SDRAM configuration + +// I2C slave address to which the unit responds when in slave-receive mode +#define I2C_DEVID 0x02 +#define SDRAM_DEVID 0xAE + +// Timeout limit for SDRAM EEPROM to respond +#define I2C_TIMOUT 0x1000000 + +// ------------------------------------------------------------------------ +// Battery Status +// +#define IQ80321_BATTERY_DISCHARGE 0x10 +#define IQ80321_BATTERY_CHARGE 0x04 +#define IQ80321_BATTERY_PRESENT 0x02 + +// Address used for battery backup test +#define SDRAM_BATTERY_TEST_ADDR (SDRAM_UNCACHED_BASE + 0x100000) + +// ------------------------------------------------------------------------ +// 7 Segment Display +#define DISPLAY_LEFT IQ80321_DISPLAY_LEFT_ADDR +#define DISPLAY_RIGHT IQ80321_DISPLAY_RIGHT_ADDR + +#define DISPLAY_0 0x03 +#define DISPLAY_1 0x9f +#define DISPLAY_2 0x25 +#define DISPLAY_3 0x0d +#define DISPLAY_4 0x99 +#define DISPLAY_5 0x49 +#define DISPLAY_6 0x41 +#define DISPLAY_7 0x1f +#define DISPLAY_8 0x01 +#define DISPLAY_9 0x19 +#define DISPLAY_A 0x11 +#define DISPLAY_B 0xc1 +#define DISPLAY_C 0x63 +#define DISPLAY_D 0x85 +#define DISPLAY_E 0x61 +#define DISPLAY_F 0x71 +#define DISPLAY_G 0x43 /* 0100001-1 */ +#define DISPLAY_H 0x91 /* 1001000-1 */ +#define DISPLAY_I 0xf3 /* 1111001-1 */ +#define DISPLAY_J 0x8f /* 1000111-1 */ +#define DISPLAY_K 0x90 /* 1001000-0 *//* cannot do a K, H with a decimal point */ +#define DISPLAY_L 0xe3 /* 1110001-1 */ +#define DISPLAY_M 0x7e /* 0111111-0 *//* Cannot do an M, overscore with the decimal point */ +#define DISPLAY_N 0x13 /* 0001001-1 */ +#define DISPLAY_O 0x03 /* 0000001-1 */ +#define DISPLAY_P 0x31 /* 0011000-1 */ +#define DISPLAY_Q 0x02 /* 0000001-0 */ +#define DISPLAY_R 0x10 /* 0001000-0 *//* same as an "A", except with the decimal point */ +#define DISPLAY_S 0x48 /* 0100100-0 *//* same as a "5", except with the decimal point */ +#define DISPLAY_T 0x1e /* 0001111-0 *//* same as a "7", except with the decimal point */ +#define DISPLAY_U 0x13 /* 1000001-1 */ +#define DISPLAY_V 0x82 /* 1000001-0 *//* same as a "U", except with the decimal point */ +#define DISPLAY_W 0xee /* 1110111-0 *//* Cannot do an W, underscore with the decimal point */ +#define DISPLAY_X 0xb0 /* 1011000-0 *//* cannot do an X, upside-down h, with decimal point */ +#define DISPLAY_Y 0x8b /* 1000101-1 */ +#define DISPLAY_Z 0x6c /* 0110110-0 *//* cannot do a Z, dash/dash/dash with decimal point */ + +#define DISPLAY_OFF 0xff /* 1111111-1 */ +#define DISPLAY_ON 0x00 /* 0000000-0 */ + +#define DISPLAY_SPACE 0xff /* 1111111-1 */ +#define DISPLAY_ERROR 0x60 /* 0110000-0 */ +#define DISPLAY_UNDERSCORE 0xef /* 1110111-1 */ +#define DISPLAY_DASH 0xfd /* 1111110-1 */ +#define DISPLAY_PERIOD 0xfe /* 1111111-0 */ +#define DISPLAY_EXCLAMATION 0x9e /* 1001111-0 */ + +#ifdef __ASSEMBLER__ + // Display 'lvalue:rvalue' on the hex display + // lvalue and rvalue must be of the form 'DISPLAY_x' + // where 'x' is a hex digit from 0-F. + .macro HEX_DISPLAY reg0, reg1, lvalue, rvalue + ldr \reg0, =DISPLAY_LEFT // display left digit + ldr \reg1, =\lvalue + strb \reg1, [\reg0] + ldr \reg0, =DISPLAY_RIGHT + ldr \reg1, =\rvalue // display right digit + strb \reg1, [\reg0] +#if 0 + // delay + ldr \reg0, =0x7800000 + mov \reg1, #0 + 0: + add \reg1, \reg1, #1 + cmp \reg1, \reg0 + ble 0b +#endif + .endm + + .macro REG_DISPLAY reg0, reg1, reg2 + b 667f + 666: + .byte DISPLAY_0, DISPLAY_1, DISPLAY_2, DISPLAY_3 + .byte DISPLAY_4, DISPLAY_5, DISPLAY_6, DISPLAY_7 + .byte DISPLAY_8, DISPLAY_9, DISPLAY_A, DISPLAY_B + .byte DISPLAY_C, DISPLAY_D, DISPLAY_E, DISPLAY_F + 667: + ldr \reg0, =666b + add \reg0, \reg0, \reg2, lsr #4 + ldrb \reg1, [\reg0] + ldr \reg0, =DISPLAY_LEFT + str \reg1, [\reg0] + ldr \reg0, =666b + and \reg2, \reg2, #0xf + add \reg0, \reg0, \reg2 + ldrb \reg1, [\reg0] + ldr \reg0, =DISPLAY_RIGHT + str \reg1, [\reg0] + + // delay + ldr \reg0, =0x7800000 + mov \reg1, #0 + 0: + add \reg1, \reg1, #1 + cmp \reg1, \reg0 + ble 0b + .endm +#else +static inline void HEX_DISPLAY(int lval, int rval) +{ + int i; + static unsigned char hchars[] = { + DISPLAY_0, DISPLAY_1, DISPLAY_2, DISPLAY_3, + DISPLAY_4, DISPLAY_5, DISPLAY_6, DISPLAY_7, + DISPLAY_8, DISPLAY_9, DISPLAY_A, DISPLAY_B, + DISPLAY_C, DISPLAY_D, DISPLAY_E, DISPLAY_F + }; + volatile unsigned int *ldisp = (volatile unsigned int *)DISPLAY_LEFT; + volatile unsigned int *rdisp = (volatile unsigned int *)DISPLAY_RIGHT; + + *ldisp = hchars[lval & 0xf]; + *rdisp = hchars[rval & 0xf]; + + for (i = 0; i < 0x10000000; i++); +} +#endif // __ASSEMBLER__ + +// ------------------------------------------------------------------------ + +#endif // CYGONCE_HAL_ARM_XSCALE_IQ80321_IQ80321_H +// EOF iq80321.h diff --git a/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram.h b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram.h @@ -0,0 +1,18 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x2000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x1e00000 - (size_t) CYG_LABEL_NAME (__heap1)) + diff --git a/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram.ldi b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram.ldi @@ -0,0 +1,27 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x2000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x20000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram.mlt b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram.mlt @@ -0,0 +1,14 @@ +version 0 +region ram 0 2000000 0 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section rom_vectors 0 1 0 1 1 1 1 1 20000 20000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! + diff --git a/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram_altmap.h b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram_altmap.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram_altmap.h @@ -0,0 +1,19 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0xA0000000) +#define CYGMEM_REGION_ram_SIZE (0x2000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xa1e00000 - (size_t) CYG_LABEL_NAME (__heap1)) + + diff --git a/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram_altmap.ldi b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram_altmap.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_ram_altmap.ldi @@ -0,0 +1,28 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ramalias : ORIGIN = 0x0, LENGTH = 0x100000 + ram : ORIGIN = 0xA0000000, LENGTH = 0x2000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ramalias, 0x20, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0xA0020000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom.h b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom.h @@ -0,0 +1,20 @@ +// eCos memory layout - Fri Oct 20 05:56:55 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x2000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0xF0000000) +#define CYGMEM_REGION_rom_SIZE (0x40000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x1e00000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom.ldi b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom.ldi @@ -0,0 +1,29 @@ +// eCos memory layout - Fri Oct 20 05:56:55 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x2000000 + rom : ORIGIN = 0xF0000000, LENGTH = 0x40000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0xF0000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_mmu_tables (rom, ALIGN (0x4000), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA) + SECTION_data (ram, 0x8000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom.mlt b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom.mlt @@ -0,0 +1,14 @@ +version 0 +region ram 0 2000000 0 ! +region rom F0000000 40000 1 ! +section fixed_vectors 0 1 0 1 1 0 1 0 20 20 ! +section data 0 1 1 1 1 1 0 0 8000 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 F0000000 F0000000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 4 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 0 0 1 data ! diff --git a/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom_altmap.h b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom_altmap.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom_altmap.h @@ -0,0 +1,20 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0xA0000000) +#define CYGMEM_REGION_ram_SIZE (0x2000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0xF0000000) +#define CYGMEM_REGION_rom_SIZE (0x40000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xa1e00000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom_altmap.ldi b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom_altmap.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/pkgconf/mlt_arm_xscale_iq80321_rom_altmap.ldi @@ -0,0 +1,31 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#include +#include + +MEMORY +{ + ramalias : ORIGIN = 0x0, LENGTH = 0x100000 + ram : ORIGIN = 0xA0000000, LENGTH = 0x2000000 + rom : ORIGIN = 0xF0000000, LENGTH = 0x40000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0xF0000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_mmu_tables (rom, ALIGN (0x4000), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ramalias, 0x20, LMA_EQ_VMA) + SECTION_data (ram, 0xA0008000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/arm/xscale/iq80321/current/include/plf_io.h b/packages/hal/arm/xscale/iq80321/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/plf_io.h @@ -0,0 +1,181 @@ +#ifndef CYGONCE_PLF_IO_H +#define CYGONCE_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// Platform specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2002-01-10 +// Purpose: Intel IQ80321 PCI IO support macros +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include // IO macros +#include +#include CYGBLD_HAL_PLF_INTS_H + +// Initialize the PCI bus. +externC void cyg_hal_plf_pci_init(void); +#define HAL_PCI_INIT() cyg_hal_plf_pci_init() + +//----------------------------------------------------------------------------- +// Resources + +#define _PCI_MEM_BASE 0x80000000 +#define _PCI_MEM_DAC_BASE 0x00000000 +#define _PCI_IO_BASE 0x90000000 +#define _PCI_MEM_LIMIT 0x83ffffff +#define _PCI_IO_LIMIT 0x9000ffff + +extern cyg_uint32 hal_pci_alloc_base_memory; +extern cyg_uint32 hal_pci_alloc_base_io; + +extern cyg_uint32 hal_pci_physical_memory_base; +extern cyg_uint32 hal_pci_physical_io_base; + +extern cyg_uint32 hal_pci_inbound_window_base; +extern cyg_uint32 hal_pci_inbound_window_mask; + +#define HAL_PCI_PHYSICAL_MEMORY_BASE hal_pci_physical_memory_base +#define HAL_PCI_PHYSICAL_IO_BASE hal_pci_physical_io_base + +// Map PCI device resources starting from these addresses in PCI space. +#define HAL_PCI_ALLOC_BASE_MEMORY hal_pci_alloc_base_memory +#define HAL_PCI_ALLOC_BASE_IO hal_pci_alloc_base_io + +#ifdef CYGSEM_HAL_ARM_IQ80321_FAB_C +#define __INTA_ROUTING CYGNUM_HAL_INTERRUPT_XINT0 +#define __INTB_ROUTING CYGNUM_HAL_INTERRUPT_XINT1 + +#define __NIC_PUB 3 +#define __NIC_PRIV 5 + +#define __SLOT_PUB 4 +#define __SLOT_PRIV 6 +#else +#define __INTA_ROUTING CYGNUM_HAL_INTERRUPT_XINT2 +#define __INTB_ROUTING CYGNUM_HAL_INTERRUPT_XINT3 + +#define __NIC_PUB 8 +#define __NIC_PRIV 4 + +#define __SLOT_PUB 2 +#define __SLOT_PRIV 6 +#endif + +// Translate the PCI interrupt requested by the device (INTA#, INTB#, +// INTC# or INTD#) to the associated CPU interrupt (i.e., HAL vector). +#define HAL_PCI_TRANSLATE_INTERRUPT( __bus, __devfn, __vec, __valid) \ + CYG_MACRO_START \ + cyg_uint32 __dev = CYG_PCI_DEV_GET_DEV(__devfn); \ + cyg_uint32 __fn = CYG_PCI_DEV_GET_FN(__devfn); \ + cyg_uint32 __xbus = ((*ATU_PCIXSR >> 8) & 0xff); \ + if (__xbus == 0xff) __xbus = 0; \ + __valid = false; \ + if (__fn==0 && (__dev==__NIC_PUB || __dev==__NIC_PRIV) && __bus==__xbus) { \ + __vec = CYGNUM_HAL_INTERRUPT_ETHERNET; \ + __valid = true; \ + } else { \ + cyg_uint8 __req; \ + HAL_PCI_CFG_READ_UINT8(__bus, __devfn, CYG_PCI_CFG_INT_PIN, __req); \ + switch(__req) { \ + case 1: /* INTA */ \ + __vec=CYGNUM_HAL_INTERRUPT_XINT0; __valid=true; break; \ + case 2: /* INTB */ \ + __vec=CYGNUM_HAL_INTERRUPT_XINT1; __valid=true; break; \ + } \ + } \ + CYG_MACRO_END + +// SDRAM is aliased as uncached memory for drivers. +#ifdef CYG_HAL_MEMORY_MAP_NORMAL +#define CYGARC_UNCACHED_ADDRESS(_x_) \ + (((((unsigned long)(_x_)) >> 29)==0x0) ? (((unsigned long)(_x_))|0xC0000000) : (_x_)) +#else +#define CYGARC_UNCACHED_ADDRESS(_x_) \ + (((((unsigned long)(_x_)) >> 29)==0x5) ? (((unsigned long)(_x_))+0x20000000) : (_x_)) +#endif + +#define CYGARC_VIRT_TO_BUS(_x_) \ + (((unsigned long)(_x_) & 0x1fffffff) | hal_pci_inbound_window_base) +#define CYGARC_BUS_TO_VIRT(_x_) \ + (((unsigned long)(_x_) & hal_pci_inbound_window_mask) | 0xC0000000) + + +static inline unsigned cygarc_physical_address(unsigned va) +{ + unsigned *ram_mmutab = (unsigned *)(SDRAM_BASE | 0x4000); + unsigned pte; + + pte = ram_mmutab[va >> 20]; + + return (pte & 0xfff00000) | (va & 0xfffff); +} + +#define CYGARC_PHYSICAL_ADDRESS(_x_) cygarc_physical_address(_x_) + +#ifdef CYG_HAL_MEMORY_MAP_NORMAL +static inline unsigned cygarc_virtual_address(unsigned pa) +{ + if (0xa0000000 <= pa && pa < 0xc0000000) + return pa - 0xa0000000; + if (pa < 0x90100000) + return pa + 0x20000000; + return pa; +} + +#define CYGARC_VIRTUAL_ADDRESS(_x_) cygarc_virtual_address(_x_) +#else +#define CYGARC_VIRTUAL_ADDRESS(_x_) (_x_) +#endif + + + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_PLF_IO_H diff --git a/packages/hal/arm/xscale/iq80321/current/include/plf_mmap.h b/packages/hal/arm/xscale/iq80321/current/include/plf_mmap.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/include/plf_mmap.h @@ -0,0 +1,75 @@ +#ifndef CYGONCE_HAL_SA11X0_PLATFORM_PLF_MMAP_H +#define CYGONCE_HAL_SA11X0_PLATFORM_PLF_MMAP_H +/*============================================================================= +// +// plf_mmap.h +// +// Platform specific memory map support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 2001-01-04 +// Purpose: Intel SA11x0 series platform-specific memory mapping macros +// Description: Macros to convert a cached, virtual address to +// 1) an uncached adddress for the same memory (if available) +// 2) the equivalent physical address for giving to external +// hardware eg. DMA engines. +// +// NB: this mapping is expressed here statically, independent +// of the actual mapping installed in the MMAP table. So if +// someone changes that, or its initialisation is changed, +// then this module must change. This is intended to be +// efficient at a cost of generality. It is also intended to +// be called with constants (such as &my_struct) as input +// args, so that all the work can be done at compile time, +// with optimization on. +// +// Usage: #include +// (which includes this file itself) +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + + +//--------------------------------------------------------------------------- +#endif // CYGONCE_HAL_SA11X0_PLATFORM_PLF_MMAP_H +// EOF plf_mmap.h diff --git a/packages/hal/arm/xscale/iq80321/current/misc/redboot_RAM.ecm b/packages/hal/arm/xscale/iq80321/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/misc/redboot_RAM.ecm @@ -0,0 +1,126 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware iq80321 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_XSCALE_VERDE current ; + package -hardware CYGPKG_HAL_ARM_XSCALE_IQ80321 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -hardware CYGPKG_IO_SERIAL_ARM_IQ80321 current ; + package -hardware CYGPKG_DEVS_ETH_INTEL_I82544 current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -hardware CYGPKG_DEVS_FLASH_IQ80321 current ; + package -hardware CYGPKG_DEVS_ETH_ARM_IQ80321 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + inferred_value 0x40000 +}; + +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGSEM_REDBOOT_ARM_LINUX_BOOT { + inferred_value 1 +}; + +cdl_option CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT { + inferred_value 0xC0008000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_GDB_FILEIO { + user_value 1 +}; diff --git a/packages/hal/arm/xscale/iq80321/current/misc/redboot_RAM_ALTMAP.ecm b/packages/hal/arm/xscale/iq80321/current/misc/redboot_RAM_ALTMAP.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/misc/redboot_RAM_ALTMAP.ecm @@ -0,0 +1,69 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware iq80321 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_XSCALE_VERDE current ; + package -hardware CYGPKG_HAL_ARM_XSCALE_IQ80321 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_INTEL_I82544 current ; + package -hardware CYGPKG_DEVS_ETH_ARM_IQ80321 current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + inferred_value 0x40000 +}; + +cdl_component CYG_HAL_MEMORY_MAP { + user_value ALTERNATE +}; + +cdl_option CYGPKG_HAL_GDB_FILEIO { + user_value 1 +}; diff --git a/packages/hal/arm/xscale/iq80321/current/misc/redboot_ROM.ecm b/packages/hal/arm/xscale/iq80321/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/misc/redboot_ROM.ecm @@ -0,0 +1,130 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware iq80321 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_XSCALE_VERDE current ; + package -hardware CYGPKG_HAL_ARM_XSCALE_IQ80321 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -hardware CYGPKG_IO_SERIAL_ARM_IQ80321 current ; + package -hardware CYGPKG_DEVS_ETH_INTEL_I82544 current ; + package -hardware CYGPKG_DEVS_FLASH_STRATA current ; + package -hardware CYGPKG_DEVS_FLASH_IQ80321 current ; + package -hardware CYGPKG_DEVS_ETH_ARM_IQ80321 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + inferred_value 0x40000 +}; + +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGSEM_REDBOOT_ARM_LINUX_BOOT { + inferred_value 1 +}; + +cdl_option CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT { + inferred_value 0xC0008000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_GDB_FILEIO { + user_value 1 +}; diff --git a/packages/hal/arm/xscale/iq80321/current/misc/redboot_ROM_ALTMAP.ecm b/packages/hal/arm/xscale/iq80321/current/misc/redboot_ROM_ALTMAP.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/misc/redboot_ROM_ALTMAP.ecm @@ -0,0 +1,73 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware iq80321 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_XSCALE_VERDE current ; + package -hardware CYGPKG_HAL_ARM_XSCALE_IQ80321 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_INTEL_I82544 current ; + package -hardware CYGPKG_DEVS_ETH_ARM_IQ80321 current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + inferred_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + inferred_value 0x40000 +}; + +cdl_component CYG_HAL_MEMORY_MAP { + user_value ALTERNATE +}; + +cdl_option CYGPKG_HAL_GDB_FILEIO { + user_value 1 +}; diff --git a/packages/hal/arm/xscale/iq80321/current/src/diag/battery.c b/packages/hal/arm/xscale/iq80321/current/src/diag/battery.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/diag/battery.c @@ -0,0 +1,156 @@ +//============================================================================= +// +// battery.c +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Scott Coulter, Jeff Frazier, Eric Breeden +// Contributors: Mark Salter +// Date: 2001-01-25 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include +#include "test_menu.h" + +extern void diag_wait(void); + +#define TEST_PATTERN 0x55555555 + +// test battery status +void +battery_status(MENU_ARG arg) +{ + unsigned char status; + + // read battery status port + status = *(unsigned char *)IQ80321_BATTERY_STATUS_ADDR; + + // examine bit b0 BATT_PRES# + if (status & IQ80321_BATTERY_PRESENT) + diag_printf("A battery is installed.\n"); + else { + diag_printf("No battery installed.\n"); + diag_wait(); + return; + } + + if (status & IQ80321_BATTERY_CHARGE) + diag_printf("Battery is fully charged.\n"); + else + diag_printf("Battery is charging.\n"); + + if (status & IQ80321_BATTERY_DISCHARGE) + diag_printf("Battery is fully discharged.\n"); + else + diag_printf("Battery voltage measures within normal operating range.\n"); + + diag_wait(); +} + + +#ifdef CYGSEM_HAL_ARM_IQ80321_BATTERY_TEST +// Data to be written to address and read after the board has +// been powered off and powered back on + +static void +battery_test_write (MENU_ARG arg) +{ + *(volatile unsigned *)SDRAM_BATTERY_TEST_ADDR = TEST_PATTERN; + + diag_printf("The value '%p' is now written to DRAM at address %p.\n", + TEST_PATTERN, SDRAM_BATTERY_TEST_ADDR); + diag_printf("\nYou may now power the board off, wait 60 seconds and power it back on.\n"); + diag_printf("Then come back into the battery test menu and check data in DRAM.\n"); + diag_wait(); +} + + +static void +battery_test_read (MENU_ARG arg) +{ + cyg_uint32 value; + + value = *(volatile unsigned *)SDRAM_BATTERY_TEST_ADDR; + + diag_printf ("Value written at address %p: %p\n", + SDRAM_BATTERY_TEST_ADDR, TEST_PATTERN); + diag_printf ("Value read: %p\n", value); + + if (value == TEST_PATTERN) + diag_printf ("\nThe battery test is a success !"); + else { + diag_printf ("\n****************************\n"); + diag_printf ("* The battery test failed. *\n"); + diag_printf ("****************************\n"); + } + + diag_wait(); +} + + +void +battery_test_menu (MENU_ARG arg) +{ + // Test Menu Table + static MENU_ITEM batteryMenu[] = { + {"Write data to SDRAM", battery_test_write, NULL}, + {"Check data from SDRAM", battery_test_read, NULL}, + }; + + unsigned int num_menu_items = (sizeof (batteryMenu) / sizeof (batteryMenu[0])); + + char *menu_title = "\n Battery Backup SDRAM memory test."; + + diag_printf ("\n*************************************************************************\n"); + diag_printf ("* This test will enable you to perform a battery test in 4 steps: *\n"); + diag_printf ("* 1/ Select option 1 to write test pattern, *\n"); + diag_printf ("* 2/ Power the board off and wait 60 seconds, *\n"); + diag_printf ("* 3/ Power the board back on, *\n"); + diag_printf ("* 4/ Select option 2 to read back and compare test pattern *\n"); + diag_printf ("*************************************************************************"); + + menu (batteryMenu, num_menu_items, menu_title, MENU_OPT_NONE); + diag_printf ("\n"); +} +#endif // CYGSEM_HAL_ARM_IQ80321_BATTERY_TEST + diff --git a/packages/hal/arm/xscale/iq80321/current/src/diag/diag.c b/packages/hal/arm/xscale/iq80321/current/src/diag/diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/diag/diag.c @@ -0,0 +1,93 @@ +//========================================================================== +// +// diag.c +// +// Additional RedBoot commands to run board diags. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2000-10-10 +// Purpose: +// Description: +// +// This code is part of RedBoot (tm). +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define DEFINE_VARS +#include +#include +#include +#include +#include CYGHWR_MEMORY_LAYOUT_H + +#include +#include + + +int pci_config_cycle = 0; /* skip exception handling when performing pci config cycle */ + +static void do_hdwr_diag(int argc, char *argv[]); + +RedBoot_cmd("diag", + "Run board diagnostics", + "", + do_hdwr_diag + ); + +void hdwr_diag (void); + +void do_hdwr_diag(int arg, char *argv[]) +{ + hal_virtual_comm_table_t* __chan; + + // Turn off interrupts on debug channel. + // All others should already be disabled. + __chan = CYGACC_CALL_IF_DEBUG_PROCS(); + if (__chan) + CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_IRQ_DISABLE); + + hdwr_diag(); +} + + + + diff --git a/packages/hal/arm/xscale/iq80321/current/src/diag/i82544.c b/packages/hal/arm/xscale/iq80321/current/src/diag/i82544.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/diag/i82544.c @@ -0,0 +1,457 @@ +//============================================================================= +// +// i82544.c.c - Diagnostic support for i82544 NIC +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Mark Salter +// Contributors: +// Date: 2002-01-25 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include +#include "test_menu.h" + +extern int diag_ishex(char theChar); +extern int diag_hex2dec(char hex); + +#define READMEM8( _reg_, _val_ ) ((CYG_BYTE)(_val_) = *((volatile CYG_BYTE *)(_reg_))) +#define WRITEMEM8( _reg_, _val_ ) (*((volatile CYG_BYTE *)(_reg_)) = (CYG_BYTE)(_val_)) +#define READMEM16( _reg_, _val_ ) ((CYG_WORD16)(_val_) = *((volatile CYG_WORD16 *)(_reg_))) +#define WRITEMEM16( _reg_, _val_ ) (*((volatile CYG_WORD16 *)(_reg_)) = (CYG_WORD16)(_val_)) +#define READMEM32( _reg_, _val_ ) ((CYG_WORD32)(_val_) = *((volatile CYG_WORD32 *)(_reg_))) +#define WRITEMEM32( _reg_, _val_ ) (*((volatile CYG_WORD32 *)(_reg_)) = (CYG_WORD32)(_val_)) +#define READMEM64( _reg_, _val_ ) ((CYG_WORD64)(_val_) = *((volatile CYG_WORD64 *)(_reg_))) +#define WRITEMEM64( _reg_, _val_ ) (*((volatile CYG_WORD64 *)(_reg_)) = (CYG_WORD64)(_val_)) + +#define OUTL( _v_, _a_ ) WRITEMEM32( _a_, _v_ ) + +static inline cyg_uint32 INL(cyg_uint32 io_address) + { cyg_uint32 _t_; READMEM32( io_address, _t_ ); return _t_; } + +// ------------------------------------------------------------------------ +// +// Serial EEPROM access - much like the other Intel ethernet +// + +#define EE_SHIFT_CLK 0x01 // EEPROM shift clock. +#define EE_CS 0x02 // EEPROM chip select. +#define EE_DATA_WRITE 0x04 // EEPROM chip data in. +#define EE_DATA_READ 0x08 // EEPROM chip data out. +#define EE_ENB (0x10|EE_CS) + +#define EE_DELAY() do { int z; for ( z = 0; z < 10000; z++ ) ; } while (0) + +#if 0 +# define EE_PRINTF diag_printf +# define EE_STUFF "%4s | %4s | %4s | %4s [%08x]\n", \ + (l & EE_SHIFT_CLK) ? "CLK" : "clk", \ + (l & EE_CS) ? "eeCS" : "--", \ + (l & EE_DATA_WRITE) ? "eeDW" : "---", \ + (l & EE_DATA_READ) ? "eeDR" : "---", \ + l & 0xfffff +#else +# define EE_PRINTF( foo ) +# define EE_STUFF +#endif + +#define I82544_EECD 0x00010 + +static inline void +ee_select( int ioaddr ) +{ + cyg_uint32 l; + l = EE_ENB; + OUTL( l, ioaddr + I82544_EECD ); + EE_DELAY(); + l |= EE_CS; + OUTL( l, ioaddr + I82544_EECD ); + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_select : " EE_STUFF ); + EE_DELAY(); +} + +static inline void +ee_deselect( int ioaddr ) +{ + cyg_uint32 l; + l = EE_ENB; + OUTL( l, ioaddr + I82544_EECD ); + EE_PRINTF( "ee_deselect 1 : " EE_STUFF ); + EE_DELAY(); + EE_DELAY(); + EE_DELAY(); + l = EE_ENB & ~EE_CS; + OUTL( l, ioaddr + I82544_EECD ); + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_deselect 2 : " EE_STUFF ); + EE_DELAY(); + EE_DELAY(); + EE_DELAY(); +} + +static inline void +ee_clock_up( int ioaddr ) +{ + cyg_uint32 l; + l = INL( ioaddr + I82544_EECD ); + l |= EE_SHIFT_CLK; + OUTL( l, ioaddr + I82544_EECD ); + EE_DELAY(); + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_clock_up : " EE_STUFF ); + EE_DELAY(); +} + +static inline void +ee_clock_down( int ioaddr ) +{ + cyg_uint32 l; + l = INL( ioaddr + I82544_EECD ); + l &=~ EE_SHIFT_CLK; + OUTL( l, ioaddr + I82544_EECD ); + EE_DELAY(); + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_clock_down : " EE_STUFF ); + EE_DELAY(); +} + +static inline int +ee_read_data_bit( int ioaddr ) +{ + cyg_uint32 l; + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_read_data : " EE_STUFF ); + return EE_DATA_READ == (EE_DATA_READ & l); +} + +static inline void +ee_write_data_bit( int ioaddr, int databit ) +{ + cyg_uint32 l; + l = INL( ioaddr + I82544_EECD ); + if ( databit ) + l |= EE_DATA_WRITE; + else + l &= ~EE_DATA_WRITE; + OUTL( l, ioaddr + I82544_EECD ); + l = INL( ioaddr + I82544_EECD ); + EE_PRINTF( "ee_write_data : " EE_STUFF ); + EE_DELAY(); +} + +// Pass ioaddr around "invisibly" +#define EE_SELECT() ee_select(ioaddr) +#define EE_DESELECT() ee_deselect(ioaddr) +#define EE_CLOCK_UP() ee_clock_up(ioaddr) +#define EE_CLOCK_DOWN() ee_clock_down(ioaddr) +#define EE_READ_DATA_BIT() ee_read_data_bit(ioaddr) +#define EE_WRITE_DATA_BIT( _d_ ) ee_write_data_bit(ioaddr,(_d_)) + +// ------------------------------------------------------------------------ + +static int +read_eeprom_word( cyg_uint32 ioaddr, int addrbits, int address ) +{ + int i, tmp; + + // Should already be not-selected, but anyway: + EE_SELECT(); + + // Shift the read command bits out. + for (i = 3; i >= 0; i--) { // Doc says to shift out a zero then: + tmp = (6 & (1 << i)) ? 1 : 0; // "6" is the "read" command. + EE_WRITE_DATA_BIT(tmp); + EE_CLOCK_UP(); + EE_CLOCK_DOWN(); + } + + // Now clock out address + for ( i = addrbits - 1; i >= 0 ; i-- ) { + tmp = (address & (1<= 0; i--) { + EE_CLOCK_UP(); + if ( EE_READ_DATA_BIT() ) + tmp |= (1<= 0; i--) { // Doc says to shift out a zero then: + tmp = (5 & (1 << i)) ? 1 : 0; // "5" is the "write" command. + EE_WRITE_DATA_BIT(tmp); + EE_CLOCK_UP(); + EE_CLOCK_DOWN(); + } + + // Now clock out address + for ( i = addrbits - 1; i >= 0 ; i-- ) { + tmp = (address & (1<= 0; i--) { + tmp = (value & (1 << i)) ? 1 : 0; + EE_WRITE_DATA_BIT(tmp); + EE_CLOCK_UP(); + EE_CLOCK_DOWN(); + } + + // Terminate the EEPROM access. + EE_DESELECT(); + + CYGACC_CALL_IF_DELAY_US((cyg_int32)15*1000); +} + +// ------------------------------------------------------------------------ +static int +write_enable_eeprom(cyg_uint32 ioaddr, int addrbits) +{ + int i, tmp; + + // Should already be not-selected, but anyway: + EE_SELECT(); + + // Shift the EWEN command bits out. + for (i = 5; i >= 0; i--) { // Doc says to shift out a zero then: + tmp = (0x13 & (1 << i)) ? 1 : 0; // "0x13" is the "EWEN" command. + EE_WRITE_DATA_BIT(tmp); + EE_CLOCK_UP(); + EE_CLOCK_DOWN(); + } + + // Shift the rest of the address bits out. (ignored) + // Two bits were used for the EWEN command above. + tmp = 0; + for (i = (addrbits-3); i >= 0; i--) { + EE_WRITE_DATA_BIT(tmp); + EE_CLOCK_UP(); + EE_CLOCK_DOWN(); + } + + // Terminate the EEPROM access. + EE_DESELECT(); +} + + +// ------------------------------------------------------------------------ +static void +program_eeprom(cyg_uint32 ioaddr, int addrbits, cyg_uint16 *data) +{ + cyg_uint32 i; + cyg_uint16 checksum = 0; + + // First enable erase/write operations on the eeprom. + // This is done through the EWEN instruction. + write_enable_eeprom(ioaddr, addrbits); + + for (i = 0; i < 63; i++, data++) { + checksum += *data; + write_eeprom_word(ioaddr, addrbits, i, *data); + } + checksum = 0xBABA - checksum; + write_eeprom_word(ioaddr, addrbits, i, checksum); +} + +// Get MAC address from user. +// Acceptable formats are: +// nn.nn.nn.nn.nn.nn +// nn:nn:nn:nn:nn:nn +// nn-nn-nn-nn-nn-nn +// nn nn nn nn nn nn +// nnnnnnnnnnnn +static void +get_mac_address(char *addr_buf) +{ + char input[40], mac[6], *p; + int got, i; + + do { + got = 0; + diag_printf ("\nCurrent MAC address: %02x:%02x:%02x:%02x:%02x:%02x\n", + addr_buf[0], addr_buf[1], addr_buf[2], + addr_buf[3], addr_buf[4], addr_buf[5]); + diag_printf ("Enter desired MAC address: "); + while (_rb_gets(input, sizeof(input), 0) != _GETS_OK) + ; + + p = input; + while (*p && *p == ' '); + + if (p[0] == '\0' || p[1] == '\0') + continue; + + for (; got < 6; got++) { + if (!diag_ishex(p[0]) || !diag_ishex(p[1])) + break; + mac[got] = (diag_hex2dec(p[0]) * 16) + diag_hex2dec(p[1]); + p += 2; + if (*p == '.' || *p == ':' || *p == ' ' || *p == '-') + p++; + } + } while (got != 6); + + for (i = 0; i < 6; i++) + *addr_buf++ = mac[i]; +} + + +static cyg_uint16 eeprom_defaults[] = { +/* halfword addresses! */ +/* 0: */ 0x0000, 0x0000, 0x0000, 0x0000, +/* 4: */ 0x0000, 0x0000, 0x0000, 0x0000, +/* 8: */ 0x0000, 0x0000, 0x4e0b, 0x1008, +/* C: */ 0x8086, 0x1008, 0x8086, 0xf02c, +/* 10: */ 0xffff, 0xffff, 0xffff, 0xffff, +/* 14: */ 0xffff, 0xffff, 0xffff, 0xffff, +/* 18: */ 0xffff, 0xffff, 0xffff, 0xffff, +/* 1C: */ 0xffff, 0xffff, 0xffff, 0xffff, +/* 20: */ 0xdfde, 0x0002, 0x1414, 0xffff, +/* 24: */ 0xffff, 0xffff, 0xffff, 0xffff, +/* 28: */ 0xffff, 0xffff, 0xffff, 0xffff, +/* 2C: */ 0xffff, 0xffff, 0xffff, 0xffff, +/* 30: */ 0xffff, 0xffff, 0xffff, 0xffff, +/* 34: */ 0xffff, 0xffff, 0xffff, 0xffff, +/* 38: */ 0xffff, 0xffff, 0xffff, 0xffff, +/* 3C: */ 0xffff, 0xffff, 0xffff, 0x0000, +}; + +/* Setup Serial EEPROM for Ethernet Configuration */ +void +enet_setup (MENU_ARG arg) +{ + cyg_pci_device dev_info; + cyg_pci_device_id devid; + cyg_uint16 cksum; + cyg_uint16 eeprom_data[64]; + cyg_uint32 nic_addr; + int i, bus; + + // First, look for NIC at private and public addresses + + bus = (*ATU_PCIXSR >> 8) & 0xff; + if (bus == 0xff) + bus = 0; + + devid = CYG_PCI_DEV_MAKE_ID(bus, CYG_PCI_DEV_MAKE_DEVFN(__NIC_PUB, 0)); + cyg_pci_get_device_info(devid, &dev_info); + + if (dev_info.vendor != 0x8086) { + devid = CYG_PCI_DEV_MAKE_ID(bus, CYG_PCI_DEV_MAKE_DEVFN(__NIC_PRIV, 0)); + cyg_pci_get_device_info(devid, &dev_info); + if (dev_info.vendor != 0x8086) { + diag_printf("No i82544 device found\n"); + return; + } + } + + nic_addr = dev_info.base_map[0]; + + // Now read complete EEPROM contents + for (i = cksum = 0; i < 64; i++) { + eeprom_data[i] = read_eeprom_word(nic_addr, 6, i); + cksum += eeprom_data[i]; + } + + // If not valid, initialize to defaults + if (cksum != 0xBABA || (eeprom_data[0x0a] & 0xC000) != 0x4000) { + diag_printf ("Current EEPROM contents invalid. Restoring defaults.\n"); + for (i = 0; i < 63; i++) + eeprom_data[i] = eeprom_defaults[i]; + } + + get_mac_address((char *)eeprom_data); + + // Now compute checksum on complete EEPROM contents + for (i = cksum = 0; i < 63; i++) + cksum += eeprom_data[i]; + + eeprom_data[63] = 0xBABA - cksum; + + diag_printf ("Writing to the Serial EEPROM... "); + program_eeprom(nic_addr, 6, eeprom_data); + diag_printf ("Done\n"); + + /* now that we have finished writing the configuration data, we must ask the + operator to reset the board to have the configuration changes take effect. + After the reset, the standard Enet. port diagnostics can be run on the + board under test */ + + diag_printf ("\n******** Reset The Board To Have Changes Take Effect ********\n"); +} + + diff --git a/packages/hal/arm/xscale/iq80321/current/src/diag/io_utils.c b/packages/hal/arm/xscale/iq80321/current/src/diag/io_utils.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/diag/io_utils.c @@ -0,0 +1,135 @@ +//============================================================================= +// +// io_utils.c - Cyclone Diagnostics +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Scott Coulter, Jeff Frazier, Eric Breeden +// Contributors: Mark Salter +// Date: 2001-01-25 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +/* + * i/o routines for tests. Greg Ames, 9/17/90. + * + * Version: @(#)test_io.c 1.2 8/26/93 + */ +#include + +/* Returns true if theChar is a valid hex digit, false if not */ +int +diag_ishex(char theChar) +{ + switch(theChar) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'a': + case 'B': + case 'b': + case 'C': + case 'c': + case 'D': + case 'd': + case 'E': + case 'e': + case 'F': + case 'f': + return 1; + default: + return 0; + } +} + +/* Convert ascii code of hex digit to number (0-15) */ +int +diag_hex2dec(char hex) +{ + if ((hex >= '0') && (hex <= '9')) + return hex - '0'; + else if ((hex >= 'a') && (hex <= 'f')) + return hex - 'a' + 10; + else + return hex - 'A' + 10; +} + +/* Input a number as (at most 8) hex digits - returns value entered */ +CYG_ADDRWORD +hexIn(void) +{ + char input[40], *p; + CYG_ADDRWORD num; + + while (_rb_gets(input, sizeof(input), 0) != _GETS_OK) + ; + + for (num = 0, p = input; diag_ishex(*p); p++) + num = num*16 + diag_hex2dec(*p); + + return num; +} + + +/* Input a number as decimal digits - returns value entered */ +CYG_ADDRWORD +decIn(void) +{ + char input[40], *p; + CYG_ADDRWORD num; + + while (_rb_gets(input, sizeof(input), 0) != _GETS_OK) + ; + + for (num = 0, p = input; '0' <= *p && *p <= '9'; p++) + num = num*10 + (*p - '0'); + + return num; +} + diff --git a/packages/hal/arm/xscale/iq80321/current/src/diag/memtest.c b/packages/hal/arm/xscale/iq80321/current/src/diag/memtest.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/diag/memtest.c @@ -0,0 +1,371 @@ +//============================================================================= +// +// memtest.c +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Scott Coulter, Jeff Frazier, Eric Breeden +// Contributors: Mark Salter +// Date: 2001-01-25 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +/************************************************************************* +* Memtest.c - this file performs an address/address bar memory test. +* +* Modification History +* -------------------- +* 01sep00 ejb Ported to StrongARM2 +* 18dec00 snc +* 02feb01 jwf for snc +* 25jan02 Rewritten for RedBoot by Mark Salter +*/ + +#include + +#define FAILED 1 +#define PASSED 0 + +// Do walking one's test +// +static int +onesTest(CYG_ADDRWORD *testAddr) +{ + CYG_ADDRWORD theOne, dataRead; + int fail, loopCount = 0; // To keep track of when to print CR + + diag_printf("\n"); + + // Loop for all bits in an address + for (theOne = 1, fail = 0; theOne && !fail; theOne <<= 1) { + + testAddr[0] = theOne; // Write test data + testAddr[1] = ~0L; // Drive d0-dn hi + dataRead = *testAddr; // Read back data + + diag_printf("%08x%s", dataRead, (++loopCount % 8) ? "" : "\n"); + + if (dataRead != theOne) // Verify data + return FAILED; // Signal failure + } + return PASSED; +} + + +// Do 32-bit word address test +// +static int +Addr32 (cyg_uint32 *start, cyg_uint32 *end, CYG_ADDRWORD *badAddr) +{ + cyg_uint32 *currentAddr; /* Current address being tested */ + cyg_uint32 data; + + for(currentAddr = start; currentAddr <= end; currentAddr++) + *currentAddr = (cyg_uint32)(CYG_ADDRWORD)currentAddr; + + for (currentAddr = start; currentAddr <= end; currentAddr++) { + data = *currentAddr; + if (data != (cyg_uint32)(CYG_ADDRWORD)currentAddr) { + diag_printf ("\n\nBad Read, Address = %p, Data Read = 0x%08x\n\n", + currentAddr, data); + *badAddr = (CYG_ADDRWORD)currentAddr; + return FAILED; + } + } + return PASSED; +} + + +// Do inverse long word address test +// +static int +Bar32 (cyg_uint32 *start, cyg_uint32 *end, CYG_ADDRWORD *badAddr) +{ + cyg_uint32 *currentAddr, data; + + for(currentAddr = start; currentAddr <= end; currentAddr++) + *currentAddr = ~(CYG_ADDRWORD)currentAddr; + + for (currentAddr = start; currentAddr <= end; currentAddr++) { + data = *currentAddr; + if (data != (~(CYG_ADDRWORD)currentAddr) & 0xffffffff) { + diag_printf ("\n\nBad Read, Address = %p, Data Read = 0x%08x\n\n", + currentAddr, data); + *badAddr = (CYG_ADDRWORD)currentAddr; + return FAILED; + } + } + return PASSED; +} + +// Do byte address test +// +static int +Addr8 (cyg_uint8 *start, cyg_uint8 *end, CYG_ADDRWORD *badAddr) +{ + cyg_uint8 *currentAddr; // Current address being tested + + for (currentAddr = start; currentAddr <= end; currentAddr++) + *currentAddr = (cyg_uint8)(CYG_ADDRWORD)currentAddr; + + for (currentAddr = start; currentAddr <= end; currentAddr++) + if (*currentAddr != (cyg_uint8)(CYG_ADDRWORD)currentAddr) { + *badAddr = (CYG_ADDRWORD)currentAddr; + return FAILED; + } + return PASSED; +} + +// Do inverse byte address test +// +static int +Bar8 (cyg_uint8 *start, cyg_uint8 *end, CYG_ADDRWORD *badAddr) +{ + cyg_uint8 *currentAddr; // Current address being tested + + for(currentAddr = start; currentAddr <= end; currentAddr++) + *currentAddr = ~(CYG_ADDRWORD)currentAddr; + + for(currentAddr = start; currentAddr <= end; currentAddr++) + if (*currentAddr != (~(CYG_ADDRWORD)currentAddr & 0xff)) { + *badAddr = (CYG_ADDRWORD)currentAddr; + return FAILED; + } + return PASSED; +} + +// This routine is called if one of the memory tests fails. It dumps +// the 8 32-bit words before and the 8 after the failure address +// +void +dumpMem (CYG_ADDRWORD badAddr) +{ + cyg_uint32 *addr; + cyg_uint16 *saddr; + int i; + + // Print out first line of mem dump + diag_printf("\n%p: %08x %08x %08x %08x", + (char *)badAddr - 32, + *(cyg_uint32 *)(badAddr - 32), + *(cyg_uint32 *)(badAddr - 28), + *(cyg_uint32 *)(badAddr - 24), + *(cyg_uint32 *)(badAddr - 20)); + + diag_printf("\n%p: %08x %08x %08x %08x", + (char *)badAddr - 16, + *(cyg_uint32 *)(badAddr - 16), + *(cyg_uint32 *)(badAddr - 12), + *(cyg_uint32 *)(badAddr - 8), + *(cyg_uint32 *)(badAddr - 4)); + + // Print out contents of fault addr + diag_printf("\n%p: %08x", + (char *)badAddr, *(cyg_uint32 *)badAddr); + + diag_printf("\n%p: %08x %08x %08x %08x", + (char *)badAddr + 4, + *(cyg_uint32 *)(badAddr + 4), + *(cyg_uint32 *)(badAddr + 8), + *(cyg_uint32 *)(badAddr + 12), + *(cyg_uint32 *)(badAddr + 16)); + + diag_printf("\n%p: %08x %08x %08x %08x", + (char *)badAddr + 20, + *(cyg_uint32 *)(badAddr + 20), + *(cyg_uint32 *)(badAddr + 24), + *(cyg_uint32 *)(badAddr + 28), + *(cyg_uint32 *)(badAddr + 32)); + + /* DEBUG */ + diag_printf ("\n\nReading back data in 32bit chunks:\n"); + for (addr = (cyg_uint32 *)(badAddr - 16), i = 0; i <= 8; i++, addr++) + diag_printf ("Address = %p, Data = 0x%08x\n", addr, *addr); + diag_printf ("\n"); + + diag_printf ("Reading back data in 16bit chunks:\n"); + for (saddr = (cyg_uint16 *)(badAddr - 16), i = 0; i <= 16; i++, saddr++) + diag_printf ("Address = %p, Data = 0x%08x\n", saddr, *saddr); + diag_printf ("\n"); +} + +// Returns 1 if passed, 0 if failed. +// +int +memTest (CYG_ADDRWORD startAddr, CYG_ADDRWORD endAddr) +{ + CYG_ADDRWORD badAddr; // Addr test failed at + + diag_printf("\nWalking 1's test: "); + if (onesTest((CYG_ADDRWORD *)startAddr) == FAILED) + goto failed; + diag_printf("passed"); + + diag_printf("\n32-bit address test: "); + if (Addr32((cyg_uint32 *)startAddr, (cyg_uint32 *)endAddr, &badAddr) == FAILED) + goto failed; + diag_printf("passed"); + + diag_printf("\n32-bit address bar test: "); + if (Bar32((cyg_uint32 *)startAddr, (cyg_uint32 *)endAddr, &badAddr) == FAILED) + goto failed; + diag_printf("passed"); + + diag_printf("\n8-bit address test: "); + if (Addr8((cyg_uint8 *)startAddr, (cyg_uint8 *)endAddr, &badAddr) == FAILED) + goto failed; + diag_printf("passed"); + + diag_printf("\nByte address bar test: "); + if (Bar8((cyg_uint8 *)startAddr, (cyg_uint8 *)endAddr, &badAddr) == FAILED) + goto failed; + diag_printf("passed"); + + return 1; + + failed: + diag_printf("failed"); + dumpMem(badAddr); + return 0; +} + + +/* 02/02/01 jwf */ +/* Do alternating inverse long word address test */ +static int +ABar32(cyg_uint32 *start, /* Starting address of test */ + cyg_uint32 *end, /* Ending address */ + CYG_ADDRWORD *badAddr) /* Failure address */ +{ + register cyg_uint32 *currentAddr; /* Current address being tested */ + int fail = 0; /* Test hasn't failed yet */ + cyg_uint32 data; + + /* In this test, the contents of each longword address toggles + between the Address and the Address BAR */ + for(currentAddr = start; currentAddr <= end; currentAddr++) { + + if ((CYG_ADDRWORD)currentAddr & 4) /* Address ending in 0x4 or 0xc */ + *currentAddr = ~(cyg_uint32)(CYG_ADDRWORD)currentAddr; + + else /* Address ending in 0x0 or 0x8 */ + *currentAddr = (cyg_uint32)(CYG_ADDRWORD)currentAddr; + } + + for (currentAddr = start; currentAddr <= end && !fail; currentAddr++) { + data = *currentAddr; + + switch ((CYG_ADDRWORD)currentAddr & 0xf) { + case 0x0: + case 0x8: + if (data != (cyg_uint32)(CYG_ADDRWORD)currentAddr) { + fail = 1; + diag_printf ("\nFailed at Address %p, Expected 0x%08X, Read 0x%08X\n", + currentAddr, (cyg_uint32)(CYG_ADDRWORD)currentAddr, data); + } + break; + + case 0x4: + case 0xc: + if (data != ~(cyg_uint32)(CYG_ADDRWORD)currentAddr) { + fail = 1; + diag_printf ("\nFailed at Address %p, Expected 0x%08X, Read 0x%08X\n", + currentAddr, ~(cyg_uint32)(CYG_ADDRWORD)currentAddr, data); + } + break; + + default: + fail = 1; + diag_printf ("\nFailed at Address %p, Unaligned address\n", currentAddr); + break; + } + } + + if (fail) { + *badAddr = (CYG_ADDRWORD)(--currentAddr); + return FAILED; + } else + return PASSED; +} + + +/* 02/02/01 jwf */ +/* + * Returns 1 if passed, 0 if failed. + */ +int +LoopMemTest (CYG_ADDRWORD startAddr, CYG_ADDRWORD endAddr) +{ + CYG_ADDRWORD badAddr; /* Addr test failed at */ + volatile int junk; + + while (1) { + diag_printf("\n"); + + diag_printf("\n32-bit address test: "); + if (Addr32((cyg_uint32 *)startAddr, (cyg_uint32 *)endAddr, &badAddr) == FAILED) + break; + diag_printf("passed"); + + diag_printf("\n32-bit address bar test: "); + if (Bar32((cyg_uint32 *)startAddr, (cyg_uint32 *)endAddr, &badAddr) == FAILED) + break; + diag_printf("passed"); + + diag_printf("\nAlternating Long word, Long word address bar test: "); + if (ABar32((cyg_uint32 *)startAddr, (cyg_uint32 *)endAddr, &badAddr) == FAILED) + break; + diag_printf("passed"); + } + + diag_printf("failed at Address %p\n", badAddr); + diag_printf("Performing Continuous Write/Read/!Write/Read...\n\n"); + while (1) { + *(volatile int *)badAddr = badAddr; + junk = *(volatile int *)badAddr; + *(volatile int *)badAddr = ~badAddr; + junk = *(volatile int *)badAddr; + } + + return 1; // not reached +} + + diff --git a/packages/hal/arm/xscale/iq80321/current/src/diag/pcitest.c b/packages/hal/arm/xscale/iq80321/current/src/diag/pcitest.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/diag/pcitest.c @@ -0,0 +1,122 @@ +//============================================================================= +// +// pcitest.c +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Scott Coulter, Jeff Frazier, Eric Breeden +// Contributors: Mark Salter +// Date: 2001-01-25 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include +#include "test_menu.h" + +extern int memTest (CYG_ADDRWORD startAddr, CYG_ADDRWORD endAddr); + +// +// PCI Bus Test +// +// This test assumes that an IQ80310 eval board +// is installed in the secondary PCI slot. This +// second board must be configured with 32 Meg +// of SDRAM minimum. +// +// +void +pci_test (MENU_ARG arg) +{ + cyg_pci_device dev_info; + cyg_pci_device_id devid; + cyg_uint32 mem_size; + cyg_uint16 cmd; + cyg_uint32 *start, *end; + int bus; + + // First, look for iq80310 at private and public addresses + + bus = (*ATU_PCIXSR >> 8) & 0xff; + if (bus == 0xff) + bus = 0; + + devid = CYG_PCI_DEV_MAKE_ID(bus, CYG_PCI_DEV_MAKE_DEVFN(__SLOT_PUB, 1)); + cyg_pci_get_device_info(devid, &dev_info); + + if (dev_info.vendor != 0x8086 || dev_info.device != 0x530d) { + devid = CYG_PCI_DEV_MAKE_ID(bus, CYG_PCI_DEV_MAKE_DEVFN(__SLOT_PRIV, 1)); + cyg_pci_get_device_info(devid, &dev_info); + + if (dev_info.vendor != 0x8086 || dev_info.device != 0x530d) { + diag_printf("No iq80310 in PCI slot.\n"); + return; + } + } + + cyg_pci_set_memory_base(HAL_PCI_ALLOC_BASE_MEMORY + 0x2000000); + cyg_pci_set_io_base(HAL_PCI_ALLOC_BASE_IO); + + cyg_pci_configure_device(&dev_info); + + diag_printf ("iq80310 DRAM starts at PCI address %p, CPU address %p\n", + dev_info.base_address[0] & CYG_PRI_CFG_BAR_MEM_MASK, + dev_info.base_map[0]); + + // enable memory space and bus master + cyg_pci_read_config_uint16(dev_info.devid, CYG_PCI_CFG_COMMAND, &cmd); + cmd |= (CYG_PCI_CFG_COMMAND_MEMORY | CYG_PCI_CFG_COMMAND_MASTER); + cyg_pci_write_config_uint16(dev_info.devid, CYG_PCI_CFG_COMMAND, cmd); + + start = (cyg_uint32 *)dev_info.base_map[0]; + // skip over 1st Mbyte of target DRAM + start += 0x100000/sizeof(*start); + // 32MB test + mem_size = 0x2000000 - 0x100000; + end = start + mem_size/sizeof(*start) - 1; + + diag_printf("Testing memory from %p to %p.\n", start, end); + + memTest((CYG_ADDRWORD)start, (CYG_ADDRWORD)end); + + diag_printf ("Memory test done.\n"); +} + diff --git a/packages/hal/arm/xscale/iq80321/current/src/diag/test_menu.c b/packages/hal/arm/xscale/iq80321/current/src/diag/test_menu.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/diag/test_menu.c @@ -0,0 +1,252 @@ +//============================================================================= +// +// test_menu.c - Cyclone Diagnostics +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Scott Coulter, Jeff Frazier, Eric Breeden +// Contributors: +// Date: 2001-01-25 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +/***************************************************************************** +* test_menu.c - Menu dispatching routine +* +* modification history +* -------------------- +* 30aug00 ejb Ported to IQ80310 Cygmon +*/ + +/* +DESCRIPTION: + +A table-driven menu dispatcher +*/ + + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // IO macros +#include // Register state info +#include +#include // Interrupt names +#include +#include // Hardware definitions +#include // Platform specifics + +#include // diag_printf +#include "test_menu.h" + +#define QUIT -1 +#define MAX_INPUT_LINE_SIZE 80 + +extern long decIn(void); + +/* + * Internal routines + */ +static int menuGetChoice (MENU_ITEM menuTable[], + int numMenuItems, + char *title, + unsigned long options); +static void printMenu (MENU_ITEM menuTable[], + int numMenuItems, + char *title); + + +/*************************************************************************** +* +* menu - a table-driven menu dispatcher +* +* RETURNS: +* +* The menu item argument, or NULL if the item chosen is QUIT. +*/ +MENU_ARG menu ( + MENU_ITEM menuTable[], + int numMenuItems, + char *title, + unsigned long options + ) +{ +int item; /* User's menu item choice */ + + /* + * Get the user's first choice. Always display the menu the first time. + */ + item = menuGetChoice (menuTable, numMenuItems, title, MENU_OPT_NONE); + if (item == QUIT) + return (MENU_ARG)0; + + /* + * If the user just wants a value returned, return the argument. If the + * argument is null, return the item number itself. + */ + if (options & MENU_OPT_VALUE) + { + if (menuTable[item].arg) + return (menuTable[item].arg); + else + return ((void *)item); + } + + /* + * Process menu items until the user selects QUIT + */ + while (1) + { + /* + * Call the action routine for the chosen item. If the argument is + * NULL, pass the item number itself. + */ + if (menuTable[item].actionRoutine != NULL) { + if (menuTable[item].arg == NULL) { + diag_printf("\n"); + (*menuTable[item].actionRoutine) ((void *)item); + } else { + diag_printf("\n"); + (*menuTable[item].actionRoutine) (menuTable[item].arg); + } + } + + /* + * Get the next choice, using any display options the user specified. + */ + item = menuGetChoice (menuTable, numMenuItems, title, options); + if (item == QUIT) + return (NULL); + } + +} /* end menu () */ + + +/*************************************************************************** +* +* menuGetChoice - Get the user's menu choice. +* +* If display is not suppressed, display the menu, then prompt the user for +* a choice. If the choice is out of range or invalid, display the menu and +* prompt again. Continue to display and prompt until a valid choice is made. +* +* RETURNS: +* The item number of the user's menu choice. (-1 if they chose QUIT) +*/ + +static int +menuGetChoice ( + MENU_ITEM menuTable[], + int numMenuItems, + char *title, + unsigned long options + ) +{ +/*char inputLine[MAX_INPUT_LINE_SIZE];*/ + +int choice; + + /* + * Suppress display of the menu the first time if we're asked + */ + if (!(options & MENU_OPT_SUPPRESS_DISP)) + printMenu (menuTable, numMenuItems, title); + + /* + * Prompt for a selection. Redisplay the menu and prompt again + * if there's an error in the selection. + */ + choice = -1; + + while (choice < 0 || choice > numMenuItems) + { + + diag_printf ("\nEnter the menu item number (0 to quit): "); + + choice = decIn (); + + if (choice < 0 || choice > numMenuItems) + + printMenu (menuTable, numMenuItems, title); + + } + + if (choice == 0) + + return (QUIT); + + return (choice - 1); + +} /* end menuGetChoice () */ + + +/*************************************************************************** +* +* printMenu - Print the menu +* +* +*/ + +static void +printMenu ( + MENU_ITEM menuTable[], + int numMenuItems, + char *title + ) +{ + int i; + + + diag_printf("\n%s\n\n", title); + + for (i = 0; i < numMenuItems; i++) + { + diag_printf ("%2d - %s\n", i+1, menuTable[i].itemName); + } + + diag_printf(" 0 - quit"); + +} /* end printMenu () */ diff --git a/packages/hal/arm/xscale/iq80321/current/src/diag/test_menu.h b/packages/hal/arm/xscale/iq80321/current/src/diag/test_menu.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/diag/test_menu.h @@ -0,0 +1,144 @@ +//============================================================================= +// +// test_menu.h - Cyclone Diagnostics +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Scott Coulter, Jeff Frazier, Eric Breeden +// Contributors: +// Date: 2001-01-25 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +/***************************************************************************** +* test_menu.h - Menu dispatching header +* +* modification history +* -------------------- +* 30aug00 ejb Ported from MPC8240 Breeze to StrongARM2 Cygmon +*/ +/* +DESCRIPTION + +Include file for the table-driven menu module menu.c. This module displays +a menu of numbered items, prompts the user for a choice, then calls an action +routine associated with the choice. It then redisplays the menu and prompts +for another choice. A choice of zero (0) exits the menu routine. + +To use this menu module, construct a table of type MENU_ITEM, with one entry +for each menu item. An entry consists of a string to print out with the +menu, an action routine, and an argument for the action routine. There is +no need to have an "exit" or "quit" item, since the menu routine handles +that by assigning at the zero (0) item number. For example, a simple menu +of tests would be constructed this way: + + IMPORT VOID doTestA (); + IMPORT VOID doTestB (); + + #define TESTA_ARG 0 + #define TESTB_ARG 1 + + LOCAL MENU_ITEM testMenu[] = + { + {"Test A", doTestA, (MENU_ARG)TESTA_ARG}, + {"Test B", doTestB, (MENU_ARG)TESTB_ARG}, + }; + + #define NUM_ITEMS NELEMENTS(testMenu) + #define MENU_TITLE "Test Menu" + +Then, in the test top level routine, call the routine menu(), declared as: + + STATUS menu (menuTable, numMenuItems, title, options) + MENU_ITEM menuTable[]; + int numMenuItems; + char *title; + ULONG options; + +For example: + + status = menu (testMenu, NUM_ITEMS, MENU_TITLE, MENU_OPT_NONE); + +*/ + +/* + * The following types define an entry in the menu table. Each entry describes + * one menu item, including a string to describe that item, an action + * routine to call when that item is chosen, and an argument to pass when the + * action routine is called. + */ +typedef volatile void *MENU_ARG; +typedef void (*MENU_RTN) (MENU_ARG arg); +typedef struct menuItem +{ + char *itemName; /* string to print with the menu */ + MENU_RTN actionRoutine; /* routine to call when item is chosen */ + MENU_ARG arg; /* argument to actionRoutine */ +} MENU_ITEM; + + +/* + * Menu options + * + * These options control the display of the menu. + * + * MENU_OPT_NONE - The normal behavior. The menu is always displayed before + * prompting the user for a choice. + * + * MENU_OPT_SUPPRESS_DISP - The menu is displayed before prompting the user + * for a choice except after executing a previously valid choice. This option + * is useful for large menus consisting of simple commands that produce only + * a line or two of output. In this case, after the user executes a valid + * choice, the redisplay of a large menu may cause output to scroll off the + * screen. The menu is redisplayed if the user enters an invalid choice. + */ +#define MENU_OPT_NONE 0x00 +#define MENU_OPT_SUPPRESS_DISP 0x01 +#define MENU_OPT_VALUE 0x02 + + + + +MENU_ARG menu (MENU_ITEM menuTable[], + int numMenuItems, + char *title, + unsigned long options); + diff --git a/packages/hal/arm/xscale/iq80321/current/src/diag/timer.c b/packages/hal/arm/xscale/iq80321/current/src/diag/timer.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/diag/timer.c @@ -0,0 +1,68 @@ +//============================================================================= +// +// timer.c +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Scott Coulter, Jeff Frazier, Eric Breeden +// Contributors: Mark Salter +// Date: 2002-02-20 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include "test_menu.h" + +extern void hal_delay_us(cyg_int32 delay); + +void +timer_test(MENU_ARG arg) +{ + int j, i; + + diag_printf ("\nTimer test. Dots should appear at 1 second intervals:\n"); + + for (j = 0; j < 20; j++) { + diag_printf ("."); + for (i = 0; i < 1000; i++) + hal_delay_us(1000); + } +} diff --git a/packages/hal/arm/xscale/iq80321/current/src/diag/xscale_test.c b/packages/hal/arm/xscale/iq80321/current/src/diag/xscale_test.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/diag/xscale_test.c @@ -0,0 +1,325 @@ +//============================================================================= +// +// xscale_test.c - Cyclone Diagnostics +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Scott Coulter, Jeff Frazier, Eric Breeden +// Contributors: Mark Salter +// Date: 2001-01-25 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +/************************************************************************/ +/* */ +/* Modification History */ +/* -------------------- */ +/* 11oct00, ejb, Created for IQ80310 StrongARM2 */ +/* 18dec00 jwf */ +/* 02feb01 jwf added tests: _coy_tight_loop, cache_loop, LoopMemTest, */ +/* special_mem_test written by snc */ +/* 07feb01 jwf added function calls to a variable delay time generator */ +/* 09feb01 jwf added function version_info to show version information */ +/* about OS, BOARD, CPLD, 80200 ID, 80312 ID. */ +/************************************************************************/ + + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // IO macros +#include // Register state info +#include +#include // Interrupt names +#include +#include // Hardware definitions +#include // Platform specifics + +#include // diag_printf +#include +#include + +#include "test_menu.h" + +extern CYG_ADDRWORD hexIn(void); + +extern int memTest (long startAddr, long endAddr); +extern int LoopMemTest (long startAddr, long endAddr); + +void hdwr_diag (void); + +extern void enet_setup (MENU_ARG arg); + +static void memory_tests (MENU_ARG arg); +static void repeat_mem_test (MENU_ARG arg); +static void special_mem_test (MENU_ARG arg); +static void rotary_switch (MENU_ARG arg); +static void seven_segment_display (MENU_ARG arg); +static void cache_loop (MENU_ARG arg); +extern void pci_test (MENU_ARG arg); +extern void battery_status(MENU_ARG arg); +extern void battery_test_menu (MENU_ARG arg); +extern void timer_test (MENU_ARG arg); + + +/* Test Menu Table */ +static MENU_ITEM testMenu[] = +{ + {"Memory Tests", memory_tests, 0}, + {"Repeating Memory Tests", repeat_mem_test, 0}, + {"Repeat-On-Fail Memory Test", special_mem_test, 0}, + {"Rotary Switch S1 Test", rotary_switch, 0}, + {"7 Segment LED Tests", seven_segment_display, 0}, + {"i82544 Ethernet Configuration", enet_setup, 0}, + {"Battery Status Test", battery_status, 0}, +#ifdef CYGSEM_HAL_ARM_IQ80321_BATTERY_TEST + {"Battery Backup SDRAM Memory Test", battery_test_menu, 0}, +#endif + {"Timer Test", timer_test, 0}, + {"PCI Bus test", pci_test, 0}, + {"CPU Cache Loop (No return)", cache_loop, 0} +}; + +#define NUM_MENU_ITEMS (sizeof (testMenu) / sizeof (testMenu[0])) +#define MENU_TITLE "\n IQ80321 Hardware Tests" + +void +diag_wait(void) +{ + char buf[1]; + diag_printf ("Press return to continue.\n"); + while (_rb_gets(buf, sizeof(buf), 0) != _GETS_OK) + ; +} + +void +hdwr_diag (void) +{ + diag_printf ("Entering Hardware Diagnostics - Disabling Data Cache!\n"); + + cyg_pci_init(); + + HAL_DCACHE_SYNC(); + HAL_DCACHE_DISABLE(); + + menu (testMenu, NUM_MENU_ITEMS, MENU_TITLE, MENU_OPT_NONE); + + diag_printf ("Exiting Hardware Diagnostics!\n\n"); + HAL_DCACHE_ENABLE(); +} + +static void +cache_loop (MENU_ARG arg) +{ + diag_printf ("Putting Processor in a Tight Loop Forever...\n\n"); + + asm ( "0: mov r0,r0\n" + "b 0b\n"); +} + + +// *************************************************************************** +// memory_tests - Basic Memory Tests +// +// Memory tests can be run one of two ways - with the cache turned OFF to test +// physical memory, or with cache turned ON to test the caching +// +static void +memory_tests (MENU_ARG arg) +{ + CYG_ADDRWORD start_addr, end_addr; + long mem_size; + + diag_printf("Base address of memory to test (in hex): "); + start_addr = hexIn(); + + diag_printf ("\nSize of memory to test (in hex): "); + mem_size = hexIn(); + + end_addr = start_addr + mem_size - 1; + + diag_printf("\nTesting memory from %p to %p.\n", start_addr, end_addr); + memTest(start_addr, end_addr); + diag_printf ("\nMemory test done.\n"); +} + + +// *************************************************************************** +// repeat_mem_test - Repeating Memory Tests +// +static void +repeat_mem_test (MENU_ARG arg) +{ + CYG_ADDRWORD start_addr, mem_size, end_addr; + char cache_disable[10]; + + diag_printf ("Turn off Data Cache? (y/n): "); + while (_rb_gets(cache_disable, sizeof(cache_disable), 0) != _GETS_OK) + ; + diag_printf ("\nBase address of memory to test (in hex): "); + start_addr = hexIn(); + diag_printf ("\nSize of memory to test (in hex): "); + mem_size = hexIn(); + end_addr = start_addr + mem_size - 1; + diag_printf("\nTesting memory from %p to %p", start_addr, end_addr); + while (memTest (start_addr, end_addr)) + ; +} + +// **************************************************************************** +// special_mem_test - Repeat-On-Fail Memory Test +// +// Memory tests can be run one of two ways - with the cache turned OFF to test +// physical memory, or with cache turned ON to test the caching +// +static void +special_mem_test (MENU_ARG arg) +{ + long start_addr; + long mem_size; + long end_addr; + + diag_printf ("Base address of memory to test (in hex): "); + start_addr = hexIn(); + diag_printf ("\nSize of memory to test (in hex): "); + mem_size = hexIn(); + + end_addr = start_addr + mem_size - 1; + diag_printf("\nTesting memory from %p to %p.\n", start_addr, end_addr); + + LoopMemTest(start_addr, end_addr); + + diag_printf ("\n\nMemory test done.\n"); + diag_wait(); +} + +static unsigned char led_data[] = { + DISPLAY_0, DISPLAY_1, DISPLAY_2, DISPLAY_3, DISPLAY_4, DISPLAY_5, DISPLAY_6, DISPLAY_7, + DISPLAY_8, DISPLAY_9, DISPLAY_A, DISPLAY_B, DISPLAY_C, DISPLAY_D, DISPLAY_E, DISPLAY_F, + DISPLAY_PERIOD, DISPLAY_OFF +}; + +// sequential test for LSD and MSD 7 segment Leds +// +void +seven_segment_display (MENU_ARG arg) +{ + unsigned char SevSegDecode; + int DisplaySequence; + int SelectLed; + + *(volatile unsigned char *)DISPLAY_LEFT = DISPLAY_OFF; + *(volatile unsigned char *)DISPLAY_RIGHT = DISPLAY_OFF; + + SelectLed=0; /* initialize 7 segment LED selection */ + + for (SelectLed = 0; SelectLed < 2; SelectLed++) { + /* run test data sequence for a 7 segment LED */ + for (DisplaySequence = 0; DisplaySequence <= 17; ++DisplaySequence ) { + /* fetch 7 segment decode byte */ + SevSegDecode = led_data[DisplaySequence]; + + /* display test data on selected 7 segment LED */ + /* the test data sequence for a 7 segment led will be seen as:*/ + /* 0 1 2 3 4 5 6 7 8 9 A b C d e F . */ + if (SelectLed) + *(volatile unsigned char *) DISPLAY_LEFT = SevSegDecode; + else + *(volatile unsigned char *) DISPLAY_RIGHT = SevSegDecode; + + CYGACC_CALL_IF_DELAY_US((cyg_int32)4*100000); + } + } + + *(volatile unsigned char *)DISPLAY_LEFT = DISPLAY_S; + *(volatile unsigned char *)DISPLAY_RIGHT = DISPLAY_S; +} + + +// tests rotary switch status, S1 positions 0-3, a 2 bit output code +static void +rotary_switch (MENU_ARG arg) +{ + char recv_data[1]; + const unsigned char MAX_SWITCH_SAMPLES = 9; + unsigned char RotarySwitch[MAX_SWITCH_SAMPLES]; // multiple samples of a 4 bit switch code + unsigned char index; // index for Rotary Switch array + unsigned char debounce; // keeps tally of equal rotary switch data reads in a loop + unsigned char SevSegDecode; // holds decode data for a 7 segment LED display + + *(volatile unsigned char *)DISPLAY_LEFT = DISPLAY_OFF; + *(volatile unsigned char *)DISPLAY_RIGHT = DISPLAY_OFF; + diag_printf("\n\nThe 7-Segment LSD LED shows the Rotary Switch position selected, i.e., 0-F."); + diag_printf("\n\nSlowly dial the Rotary Switch through each position 0-F and confirm reading."); + + diag_printf( "\n\nStrike to exit this test." ); + while (_rb_gets(recv_data, sizeof(recv_data), 50) != _GETS_OK) { + do { + for(index = 0; index <= MAX_SWITCH_SAMPLES; index++) { + RotarySwitch[index] = *(volatile unsigned char *) IQ80321_ROTARY_SWITCH_ADDR; + RotarySwitch[index] &= 0x0f; + } + debounce = 0; + for(index = 1; index <= MAX_SWITCH_SAMPLES; index++) { + if (RotarySwitch[0] == RotarySwitch[index]) + debounce++; // keep tally of equal rotary switch code samples + } + } while (debounce < (MAX_SWITCH_SAMPLES - 1)); + + // decipher state of rotary switch position + if (RotarySwitch[0] > 16) + RotarySwitch[0] = 16; + SevSegDecode = led_data[RotarySwitch[0]]; + + // display the rotary switch position on the 7 segment LSD LED as: 0, 1, 2, 3, etc. + *(volatile unsigned char *)DISPLAY_RIGHT = SevSegDecode; + } + +} // end rotary_switch() + + + + diff --git a/packages/hal/arm/xscale/iq80321/current/src/hal_diag.c b/packages/hal/arm/xscale/iq80321/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/hal_diag.c @@ -0,0 +1,403 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors:nickg, gthomas, msalter +// Date: 1998-03-02 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include CYGBLD_HAL_VARIANT_H // Variant specific configuration +#include CYGBLD_HAL_PLATFORM_H // Platform specific configuration + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // basic machine info +#include // interrupt macros +#include // IO macros +#include +#include +#include // interface API +#include // Helper functions +#include // platform definitions + +/*---------------------------------------------------------------------------*/ +/* From serial_16550.h */ + +//----------------------------------------------------------------------------- +// Based on 1.8432 MHz xtal +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==9600 +#define CYG_DEV_SERIAL_BAUD_MSB 0x00 +#define CYG_DEV_SERIAL_BAUD_LSB 0x0c +#endif +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==19200 +#define CYG_DEV_SERIAL_BAUD_MSB 0x00 +#define CYG_DEV_SERIAL_BAUD_LSB 0x06 +#endif +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==38400 +#define CYG_DEV_SERIAL_BAUD_MSB 0x00 +#define CYG_DEV_SERIAL_BAUD_LSB 0x03 +#endif +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==57600 +#define CYG_DEV_SERIAL_BAUD_MSB 0x00 +#define CYG_DEV_SERIAL_BAUD_LSB 0x02 +#endif +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==115200 +#define CYG_DEV_SERIAL_BAUD_MSB 0x00 +#define CYG_DEV_SERIAL_BAUD_LSB 0x01 +#endif + +#ifndef CYG_DEV_SERIAL_BAUD_MSB +#error Missing/incorrect serial baud rate defined - CDL error? +#endif + +// Define the serial registers. +#define CYG_DEV_RBR 0x00 // receiver buffer register, read, dlab = 0 +#define CYG_DEV_THR 0x00 // transmitter holding register, write, dlab = 0 +#define CYG_DEV_DLL 0x00 // divisor latch (LS), read/write, dlab = 1 +#define CYG_DEV_IER 0x01 // interrupt enable register, read/write, dlab = 0 +#define CYG_DEV_DLM 0x01 // divisor latch (MS), read/write, dlab = 1 +#define CYG_DEV_IIR 0x02 // interrupt identification register, read, dlab = 0 +#define CYG_DEV_FCR 0x02 // fifo control register, write, dlab = 0 +#define CYG_DEV_LCR 0x03 // line control register, write +#define CYG_DEV_MCR 0x04 // modem control register, write +#define CYG_DEV_LSR 0x05 // line status register, read +#define CYG_DEV_MSR 0x06 // modem status register, read +#define CYG_DEV_SCR 0x07 // scratch pad register + +// Interrupt Enable Register +#define SIO_IER_RCV 0x01 +#define SIO_IER_XMT 0x02 +#define SIO_IER_LS 0x04 +#define SIO_IER_MS 0x08 + +// The line status register bits. +#define SIO_LSR_DR 0x01 // data ready +#define SIO_LSR_OE 0x02 // overrun error +#define SIO_LSR_PE 0x04 // parity error +#define SIO_LSR_FE 0x08 // framing error +#define SIO_LSR_BI 0x10 // break interrupt +#define SIO_LSR_THRE 0x20 // transmitter holding register empty +#define SIO_LSR_TEMT 0x40 // transmitter register empty +#define SIO_LSR_ERR 0x80 // any error condition + +// The modem status register bits. +#define SIO_MSR_DCTS 0x01 // delta clear to send +#define SIO_MSR_DDSR 0x02 // delta data set ready +#define SIO_MSR_TERI 0x04 // trailing edge ring indicator +#define SIO_MSR_DDCD 0x08 // delta data carrier detect +#define SIO_MSR_CTS 0x10 // clear to send +#define SIO_MSR_DSR 0x20 // data set ready +#define SIO_MSR_RI 0x40 // ring indicator +#define SIO_MSR_DCD 0x80 // data carrier detect + +// The line control register bits. +#define SIO_LCR_WLS0 0x01 // word length select bit 0 +#define SIO_LCR_WLS1 0x02 // word length select bit 1 +#define SIO_LCR_STB 0x04 // number of stop bits +#define SIO_LCR_PEN 0x08 // parity enable +#define SIO_LCR_EPS 0x10 // even parity select +#define SIO_LCR_SP 0x20 // stick parity +#define SIO_LCR_SB 0x40 // set break +#define SIO_LCR_DLAB 0x80 // divisor latch access bit + +// Modem Control Register +#define SIO_MCR_DTR 0x01 +#define SIO_MCR_RTS 0x02 + + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + + +//----------------------------------------------------------------------------- + +static void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 lcr; + + // 8-1-no parity. + HAL_WRITE_UINT8(base+CYG_DEV_LCR, SIO_LCR_WLS0 | SIO_LCR_WLS1); + HAL_READ_UINT8(base+CYG_DEV_LCR, lcr); + lcr |= SIO_LCR_DLAB; + HAL_WRITE_UINT8(base+CYG_DEV_LCR, lcr); + HAL_WRITE_UINT8(base+CYG_DEV_DLL, CYG_DEV_SERIAL_BAUD_LSB); + HAL_WRITE_UINT8(base+CYG_DEV_DLM, CYG_DEV_SERIAL_BAUD_MSB); + lcr &= ~SIO_LCR_DLAB; + HAL_WRITE_UINT8(base+CYG_DEV_LCR, lcr); + HAL_WRITE_UINT8(base+CYG_DEV_FCR, 0x07); // Enable & clear FIFO +} + +void +cyg_hal_plf_serial_putc(void *__ch_data, char c) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 lsr; + CYGARC_HAL_SAVE_GP(); + + do { + HAL_READ_UINT8(base+CYG_DEV_LSR, lsr); + } while ((lsr & SIO_LSR_THRE) == 0); + + HAL_WRITE_UINT8(base+CYG_DEV_THR, c); + + CYGARC_HAL_RESTORE_GP(); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 lsr; + + HAL_READ_UINT8(base+CYG_DEV_LSR, lsr); + if ((lsr & SIO_LSR_DR) == 0) + return false; + + HAL_READ_UINT8(base+CYG_DEV_RBR, *ch); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +static channel_data_t plf_ser_channels[1] = { + { (cyg_uint8*)IQ80321_UART_ADDR, 1000, CYGNUM_HAL_INTERRUPT_UART } +}; + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + HAL_WRITE_UINT8(chan->base+CYG_DEV_IER, SIO_IER_RCV); + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + HAL_WRITE_UINT8(chan->base+CYG_DEV_IER, 0); + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + char c; + cyg_uint8 lsr; + CYGARC_HAL_SAVE_GP(); + + cyg_drv_interrupt_acknowledge(chan->isr_vector); + + *__ctrlc = 0; + HAL_READ_UINT8(chan->base+CYG_DEV_LSR, lsr); + if ( (lsr & SIO_LSR_DR) != 0 ) { + + HAL_READ_UINT8(chan->base+CYG_DEV_RBR, c); + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(plf_ser_channels[0].isr_vector); + + // Init channels + cyg_hal_plf_serial_init_channel(&plf_ser_channels[0]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &plf_ser_channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +/*---------------------------------------------------------------------------*/ + +cyg_uint8 cyg_hal_led_segment[16] = { + DISPLAY_0, DISPLAY_1, DISPLAY_2, DISPLAY_3, + DISPLAY_4, DISPLAY_5, DISPLAY_6, DISPLAY_7, + DISPLAY_8, DISPLAY_9, DISPLAY_A, DISPLAY_B, + DISPLAY_C, DISPLAY_D, DISPLAY_E, DISPLAY_F }; + +void +hal_diag_led(int n) +{ + HAL_WRITE_UINT8(DISPLAY_RIGHT, cyg_hal_led_segment[n & 0x0f]); +} + +/*---------------------------------------------------------------------------*/ +/* End of hal_diag.c */ diff --git a/packages/hal/arm/xscale/iq80321/current/src/iq80321_misc.c b/packages/hal/arm/xscale/iq80321/current/src/iq80321_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/iq80321_misc.c @@ -0,0 +1,124 @@ +//========================================================================== +// +// iq80321_misc.c +// +// HAL misc board support code for Intel XScale IQ80321 +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-12-03 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // IO macros +#include // Register state info +#include +#include // Interrupt names +#include +#include // Hardware definitions +#include // Platform specifics + +#include // diag_printf + +#ifdef CYGPKG_IO_PCI +cyg_uint32 cyg_pci_window_real_base = 0; +#endif + +// +// Platform specific initialization +// + +void +plf_hardware_init(void) +{ + INTCTL_WRITE(0); // mask all irqs + INTSTR_WRITE(0); // everything goes to IRQ + *PIRSR = 0x0f; + +// RAM startup only - rewrite relevent bits depending on config +#ifndef CYG_HAL_STARTUP_ROM + HAL_DCACHE_SYNC(); // Force data out + HAL_DCACHE_INVALIDATE_ALL(); // Flush TLBs: make new mmu state effective +#endif // ! CYG_HAL_STARTUP_ROM - RAM start only +} + +// +// Memory layout - runtime variations of all kinds. +// +externC cyg_uint8 * +hal_arm_mem_real_region_top( cyg_uint8 *regionend ) +{ + CYG_ASSERT( hal_dram_size > 0, "Didn't detect DRAM size!" ); + CYG_ASSERT( hal_dram_size <= 256<<20, + "More than 256MB reported - that can't be right" ); + CYG_ASSERT( 0 == (hal_dram_size & 0xfffff), + "hal_dram_size not whole Mb" ); + // is it the "normal" end of the DRAM region? If so, it should be + // replaced by the real size + if ( regionend == + ((cyg_uint8 *)CYGMEM_REGION_ram + CYGMEM_REGION_ram_SIZE) ) { + regionend = (cyg_uint8 *)CYGMEM_REGION_ram + hal_dram_size; + } + // Also, we must check for the top of the heap having moved. This is + // because the heap does not abut the top of memory. +#ifdef CYGMEM_SECTION_heap1 + if ( regionend == + ((cyg_uint8 *)CYGMEM_SECTION_heap1 + CYGMEM_SECTION_heap1_SIZE) ) { + // hal_dram_size excludes the PCI window on this platform. + if ( regionend > (cyg_uint8 *)CYGMEM_REGION_ram + hal_dram_size ) + regionend = (cyg_uint8 *)CYGMEM_REGION_ram + hal_dram_size; + } +#endif + return regionend; +} + +// ------------------------------------------------------------------------ +// EOF iq80321_misc.c diff --git a/packages/hal/arm/xscale/iq80321/current/src/iq80321_pci.c b/packages/hal/arm/xscale/iq80321/current/src/iq80321_pci.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/iq80321/current/src/iq80321_pci.c @@ -0,0 +1,201 @@ +//========================================================================== +// +// iq80321_pci.c +// +// HAL support code for IQ80321 PCI +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2002-01-04 +// Purpose: PCI support +// Description: Implementations of HAL PCI interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include +#include CYGBLD_HAL_PLATFORM_H +#include CYGHWR_MEMORY_LAYOUT_H + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // IO macros +#include // calling interface API +#include // Register state info +#include +#include // Interrupt names +#include +#include +#include + +#ifdef CYGPKG_IO_PCI + +cyg_uint32 hal_pci_alloc_base_memory; +cyg_uint32 hal_pci_alloc_base_io; +cyg_uint32 hal_pci_physical_memory_base; +cyg_uint32 hal_pci_physical_io_base; +cyg_uint32 hal_pci_inbound_window_base; +cyg_uint32 hal_pci_inbound_window_mask; + +// +// Verde ATU Window Usage: +// Inbound Window 0 - Access to Verde memory mapped registers. +// Inbound Window 1 - Used to reserve space for outbound window. +// Inbound Window 2 - Access to SDRAM +// Inbound Window 3 - Not used. +// +// Direct Outbound Window - Direct mapped. +// Outbound Translate Window 0 - Access to Inbound Window 1 PCI space +// Outbound Translate Window 1 - Unused. +// Outbound IO Window - Unused. +// + + +#ifdef CYGSEM_HAL_ARM_IQ80321_CLEAR_PCI_RETRY +// Wait for BIOS to configure Verde PCI. +// Returns true if BIOS done, false if timeout +bool +cyg_hal_plf_wait_for_bios(void) +{ + int delay = 200; // 20 seconds, tops + + // 64-bit prefetchable + *ATU_IABAR1 = CYG_PRI_CFG_BAR_MEM_TYPE_64 | CYG_PRI_CFG_BAR_MEM_PREFETCH; + *ATU_IAUBAR1 = 0; + + // clear RETRY + *ATU_PCSR &= ~PCSR_CFG_RETRY; + + while (delay-- > 0) { + if (*ATU_ATUCMD & CYG_PCI_CFG_COMMAND_MEMORY) + return true; + hal_delay_us(100000); + } + return false; +} +#endif // CYGSEM_HAL_ARM_IQ80321_CLEAR_PCI_RETRY + +void +cyg_hal_plf_pci_init(void) +{ + cyg_uint32 dram_limit = (0xFFFFFFFF - (hal_dram_size - 1)) & 0xFFFFFFC0; + + // Enable NIC through GPIO pin. This may not have an effect depending + // on switch settings. + *GPIO_GPOE &= ~(1 << IQ80321_GBE_GPIO_PIN); + *GPIO_GPOD |= (1 << IQ80321_GBE_GPIO_PIN); + + // Inbound window 2 is used for SDRAM access. + // set inbound ATU translate value register to base of local DRAM + *ATU_IATVR2 = SDRAM_PHYS_BASE; + + // set inbound ATU limit register to include all of installed DRAM. + // This value used as a mask. + // Allow pci access to all memory + *ATU_IALR2 = dram_limit; + + hal_pci_inbound_window_mask = ~dram_limit; + + // set inbound ATU limit 1 to reserve 64MB for outbound window 0. + *ATU_IALR1 = (0xFFFFFFFF - ((64 * 1024 * 1024) - 1)) & 0xFFFFFFC0; + +#ifdef CYGSEM_HAL_ARM_IQ80321_CLEAR_PCI_RETRY + if (!(*ATU_PCSR & PCSR_CFG_RETRY) || !cyg_hal_plf_wait_for_bios()) +#endif // CYGSEM_HAL_ARM_IQ80321_CLEAR_PCI_RETRY + { +#ifdef CYG_HAL_STARTUP_ROM + // 64-bit prefetchable + *ATU_IABAR2 = SDRAM_PHYS_BASE | \ + CYG_PRI_CFG_BAR_MEM_TYPE_64 | \ + CYG_PRI_CFG_BAR_MEM_PREFETCH; + *ATU_IAUBAR2 = 0; + + // Outbound window will be set based on the memory reserved + // by inbound window 1 + *ATU_IABAR1 = _PCI_MEM_BASE | \ + CYG_PRI_CFG_BAR_MEM_TYPE_64 | \ + CYG_PRI_CFG_BAR_MEM_PREFETCH; + + // allow ATU to act as a bus master, respond to PCI memory accesses, + // and assert S_SERR# + *ATU_ATUCMD = (CYG_PCI_CFG_COMMAND_SERR | \ + CYG_PCI_CFG_COMMAND_PARITY | \ + CYG_PCI_CFG_COMMAND_MASTER | \ + CYG_PCI_CFG_COMMAND_MEMORY); +#endif // CYG_HAL_STARTUP_ROM + } + + hal_pci_alloc_base_memory = *ATU_IABAR1 & CYG_PRI_CFG_BAR_MEM_MASK; + hal_pci_alloc_base_io = _PCI_IO_BASE; + + hal_pci_inbound_window_base = *ATU_IABAR2 & CYG_PRI_CFG_BAR_MEM_MASK; + + + // set the outbound window PCI address + *ATU_OMWTVR0 = hal_pci_alloc_base_memory; + *ATU_OUMWTVR0 = 0; + + // outbound I/O window + *ATU_OIOWTVR = hal_pci_alloc_base_io; + + hal_pci_physical_memory_base = _PCI_MEM_BASE - hal_pci_alloc_base_memory; + hal_pci_physical_io_base = _PCI_IO_BASE - hal_pci_alloc_base_io; + +#ifdef CYG_HAL_MEMORY_MAP_NORMAL + // Adjust for Virt - Phys in CPU space + hal_pci_physical_memory_base += 0x20000000; + hal_pci_physical_io_base += 0x20000000; +#endif + + cyg_pci_set_memory_base(HAL_PCI_ALLOC_BASE_MEMORY); + cyg_pci_set_io_base(HAL_PCI_ALLOC_BASE_IO); + + // enable outbound ATU + *ATU_ATUCR = 2; + + *ATU_APMCSR = 3; +} + +#endif // CYGPKG_IO_PCI + + diff --git a/packages/hal/arm/xscale/verde/current/ChangeLog b/packages/hal/arm/xscale/verde/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/verde/current/ChangeLog @@ -0,0 +1,146 @@ +2002-04-01 Rory Bolt + + * include/hal_var_ints.h: Fix definition for DMA1_ERR. + +2002-02-25 Mark Salter + + * src/verde_misc.c: Timer source clock is always exactly 200MHz. + +2002-02-22 Mark Salter + + * src/verde_misc.c: Fix hw watch/break support. + +2002-02-20 Mark Salter + + * include/plf_stub.h: Add HW watchpoint/breakpoint support. + * src/verde_misc.c: Ditto. + +2002-02-19 Mark Salter + + * src/verde_misc.c (hal_hardware_init): Initialize debug unit to + sane state. + +2002-01-31 Mark Salter + + * src/verde_pci.c: New file. PCI support common to verde. + * cdl/hal_arm_xscale_verde.cdl: Add verde_pci.c to compile list. + * include/var_io.h: Move HAL_PCI_CFG_* macros from plf_io.h + (CYGARC_PHYSICAL_ADDRESS): Fix conversion. + +2002-01-30 Mark Salter + + * src/verde_misc.c (hal_delay_us): Fix delay calculation. + +2002-01-29 Jesper Skov + + * include/var_io.h (CYGARC_PHYSICAL_ADDRESS): Added. + + * cdl/hal_arm_xscale_verde.cdl: Use common ARM linux exec + command. + * src/redboot_linux_exec.c: Removed. + +2002-01-28 Jesper Skov + + * cdl/hal_arm_xscale_verde.cdl: Declare var_io.h + + * include/var_io.h: Added. + + * src/verde_misc.c: Don't include CYGBLD_HAL_PLATFORM_IO_H. + + * include/hal_cache.h: Include hal_io.h + +2002-01-24 Nick Garnett + + * cdl/hal_arm_xscale_verde.cdl: Removed CYGHWR_HAL_ARM_VERDE_P_CLK + and CYGHWR_HAL_ARM_VERDE_BUS_CLK options in favour of a more + dynamic determination of the P_CLK value. CYGNUM_HAL_RTC_PERIOD is + now a simple number of microseconds which is converted to the + actual clock value in the HAL. + + * src/verde_misc.c: Rearranged clock code to make use of + dynamically determined P_CLK value to set timer value. + +2002-01-23 Mark Salter + + * include/hal_verde.h: Add PCSR bit defines. + + * include/hal_var_ints.h (HAL_PLATFORM_RESET): Use HW feature to + perform reset. + +2002-01-23 Nick Garnett + + * cdl/hal_arm_xscale_verde.cdl: + Added CYGHWR_HAL_ARM_VERDE_P_CLK, which defines the external clock + frequency applied to the Verde chip. All other CPU frequencies are + derived from this. + Added CYGHWR_HAL_ARM_VERDE_BUS_CLK which calculates the internal + bus clock from the P_CLK value. + Rewrote calculation for CYGNUM_HAL_RTC_PERIOD to derive the period + from the bus clock and CYGNUM_HAL_RTC_DENOMINATOR. + + * src/verde_misc.c: + Reorganized hal_IRQ_handler() to do the right thing. + Added test to hal_interrupt_acknowledge() to acknowledge timer + interrupts. Also removed misleading comment from hal_clock_reset(). + + * include/hal_verde.h: Added TISR_WRITE(). + +2002-01-21 Mark Salter + + * include/hal_verde.h: Add definitions for ATU, I2C, etc. + + * include/hal_cache.h: Turn write buffer coalescing on and off + along with Dcache. + +2002-01-18 Hugo Tyson + + * include/hal_var_ints.h (HAL_CLOCK_REINITIALIZE): New macro + which calls the below, also a prototype for it. + + * src/verde_misc.c (hal_clock_reinitialize): New routine to + reset the clock to a different frequency. This is for GPROF type + profiling use only; not general purpose eCos usage. + +2002-01-09 Mark Salter + + * src/verde_misc.c: Add MCU ISR handler for ECC scrubbing. + + * include/hal_verde.h (MCU_MCISR): Define. + + * include/hal_cache.h (HAL_DCACHE_SYNC): Use platform defined + constant instead of hardcoded flush area base. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/arm/xscale/verde/current/cdl/hal_arm_xscale_verde.cdl b/packages/hal/arm/xscale/verde/current/cdl/hal_arm_xscale_verde.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/verde/current/cdl/hal_arm_xscale_verde.cdl @@ -0,0 +1,136 @@ +# ==================================================================== +# +# hal_arm_xscale_verde.cdl +# +# Intel XScale architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): msalter +# Original data: msalter +# Contributors: +# Date: 2001-12-03 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== +cdl_package CYGPKG_HAL_ARM_XSCALE_VERDE { + display "Intel XScale 80321 IO Processor" + parent CYGPKG_HAL_ARM + hardware + include_dir cyg/hal + define_header hal_arm_xscale_verde.h + description " + This HAL variant package provides generic + support for the Intel 80321 IO processors. It is also + necessary to select a specific target platform HAL + package." + + implements CYGINT_HAL_ARM_ARCH_XSCALE + implements CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + + # Let the architectural HAL see this variant's interrupts file + define_proc { + puts $::cdl_header \ + "#define CYGBLD_HAL_VAR_INTS_H " + + puts $::cdl_system_header "#define CYGBLD_HAL_ARM_VAR_IO_H" + } + + compile verde_misc.c verde_pci.c + + cdl_option CYGHWR_HAL_ARM_XSCALE_PROCESSOR_CCLK { + display "Processor clock rate" + flavor data + default_value { CYGHWR_HAL_ARM_XSCALE_PROCESSOR_CCLK_DEFAULT ? + CYGHWR_HAL_ARM_XSCALE_PROCESSOR_CCLK_DEFAULT : 600000} + description " + The XScale processor can run at various frequencies. + These values are expressed in KHz." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants" + flavor none + no_define + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + default_value 100 + description " + This option selects the heartbeat rate for the real-time clock. + The rate is specified in ticks per second. Change this value + with caution - too high and your system will become saturated + just handling clock interrupts, too low and some operations + such as thread scheduling may become sluggish." + } + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated 1000000/CYGNUM_HAL_RTC_DENOMINATOR + description " + This value gives the RTC period in microseconds. It is + translated into the actual clock period value in the clock + init and read functions." + } + } + + cdl_component CYGPKG_REDBOOT_XSCALE_OPTIONS { + display "Redboot for XScale options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + # RedBoot details + requires { CYGSEM_REDBOOT_ARM_LINUX_BOOT } + requires { CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS_DEFAULT == 0xc0008000 } + define_proc { + puts $::cdl_header "#define CYGHWR_REDBOOT_ARM_TRAMPOLINE_ADDRESS 0x00001f00" + } + } +} diff --git a/packages/hal/arm/xscale/verde/current/include/hal_cache.h b/packages/hal/arm/xscale/verde/current/include/hal_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/verde/current/include/hal_cache.h @@ -0,0 +1,398 @@ +#ifndef CYGONCE_HAL_CACHE_H +#define CYGONCE_HAL_CACHE_H + +//============================================================================= +// +// hal_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: +// Date: 2001-12-03 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include // System-wide configuration info +#include // DCACHE_FLUSH_AREA +#include +#include +#include + +//----------------------------------------------------------------------------- +// Cache dimensions + +#define HAL_DCACHE_SIZE 0x8000 // Size of data cache in bytes +#define HAL_DCACHE_LINE_SIZE 32 // Size of a data cache line +#define HAL_DCACHE_WAYS 32 // Associativity of the cache +#define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS)) + +#define HAL_ICACHE_SIZE 0x8000 // Size of icache in bytes +#define HAL_ICACHE_LINE_SIZE 32 // Size of ins cache line +#define HAL_ICACHE_WAYS 32 // Associativity of the cache +#define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS)) + +//----------------------------------------------------------------------------- +// Global control of Instruction cache + +// Enable the instruction cache +#define HAL_ICACHE_ENABLE() \ +CYG_MACRO_START \ + asm volatile ( \ + "mrc p15,0,r1,c1,c0,0;" \ + "orr r1,r1,#0x1000;" /* enable ICache */ \ + "mcr p15,0,r1,c1,c0,0;" \ + : \ + : \ + : "r1" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Disable the instruction cache (and invalidate it, required semanitcs) +#define HAL_ICACHE_DISABLE() \ +CYG_MACRO_START \ + asm volatile ( \ + "mrc p15,0,r1,c1,c0,0;" \ + "bic r1,r1,#0x1000;" /* disable Icache */ \ + "mcr p15,0,r1,c1,c0,0;" \ + "mcr p15,0,r1,c7,c5,0;" /* invalidate instruction cache */ \ + "nop;" /* next few instructions may be via cache */ \ + "nop;" \ + "nop;" \ + "nop;" \ + "nop;" \ + "nop" \ + : \ + : \ + : "r1" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Query the state of the instruction cache +#define HAL_ICACHE_IS_ENABLED(_state_) \ +CYG_MACRO_START \ + register cyg_uint32 reg; \ + asm volatile ("mrc p15,0,%0,c1,c0,0" \ + : "=r"(reg) \ + : \ + ); \ + (_state_) = (0 != (0x1000 & reg)); /* Bit 12 is ICache enable */ \ +CYG_MACRO_END + +// Invalidate the entire cache +#define HAL_ICACHE_INVALIDATE_ALL() \ +CYG_MACRO_START \ + asm volatile ( \ + "mcr p15,0,r1,c7,c5,0;" /* clear instruction cache */ \ + "mcr p15,0,r1,c8,c5,0;" /* flush I TLB only */ \ + /* cpuwait */ \ + "mrc p15,0,r1,c2,c0,0;" /* arbitrary read */ \ + "mov r1,r1;" \ + "sub pc,pc,#4;" \ + "nop;" /* next few instructions may be via cache */ \ + "nop;" \ + "nop;" \ + "nop;" \ + "nop;" \ + "nop" \ + : \ + : \ + : "r1" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Synchronize the contents of the cache with memory. +// (which includes flushing out pending writes) +#define HAL_ICACHE_SYNC() \ +CYG_MACRO_START \ + HAL_DCACHE_SYNC(); /* ensure data gets to RAM */ \ + HAL_ICACHE_INVALIDATE_ALL(); /* forget all we know */ \ +CYG_MACRO_END + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_size_) +// This feature is not available on the SA11X0. + +// Load the contents of the given address range into the instruction cache +// and then lock the cache so that it stays there. +//#define HAL_ICACHE_LOCK(_base_, _size_) +// This feature is not available on the SA11X0. + +// Undo a previous lock operation +//#define HAL_ICACHE_UNLOCK(_base_, _size_) +// This feature is not available on the SA11X0. + +// Unlock entire cache +//#define HAL_ICACHE_UNLOCK_ALL() +// This feature is not available on the SA11X0. + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_ICACHE_INVALIDATE( _base_ , _size_ ) +// This feature is not available on the SA11X0. + +//----------------------------------------------------------------------------- +// Global control of data cache + +// Enable the data cache +#define HAL_DCACHE_ENABLE() \ +CYG_MACRO_START \ + asm volatile ( \ + "mrc p15,0,r1,c7,c10,4;" /* drain write buffer */ \ + "mrc p15,0,r1,c1,c0,0;" \ + "orr r1,r1,#0x0007;" /* enable DCache (also ensures the */ \ + /* MMU and alignment faults are */ \ + /* enabled) */ \ + "mcr p15,0,r1,c1,c0,0;" \ + "mrc p15,0,r1,c1,c0,1;" \ + "bic r1,r1,#1;" \ + "mcr p15,0,r1,c1,c0,1;" \ + : \ + : \ + : "r1" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Disable the data cache (and invalidate it, required semanitcs) +#define HAL_DCACHE_DISABLE() \ +CYG_MACRO_START \ + asm volatile ( \ + "mrc p15,0,r1,c1,c0,0;" /* disable cache */ \ + "bic r1,r1,#4;" \ + "mcr p15,0,r1,c1,c0,0;" \ + "mrc p15,0,r1,c1,c0,1;" /* disable coalescing */ \ + "orr r1,r1,#1;" \ + "mcr p15,0,r1,c1,c0,1;" \ + "mcr p15,0,r1,c7,c6,0;" /* invalidate data cache */ \ + /* cpuwait */ \ + "mrc p15,0,r1,c2,c0,0;" /* arbitrary read */ \ + "mov r1,r1;" \ + "sub pc,pc,#4;" \ + : \ + : \ + : "r1" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Query the state of the data cache +#define HAL_DCACHE_IS_ENABLED(_state_) \ +CYG_MACRO_START \ + register int reg; \ + asm volatile ("mrc p15,0,%0,c1,c0,0" \ + : "=r"(reg) \ + : \ + /*:*/ \ + ); \ + (_state_) = (0 != (4 & reg)); /* Bit 2 is DCache enable */ \ +CYG_MACRO_END + +// Flush the entire dcache (and then both TLBs, just in case) +#define HAL_DCACHE_INVALIDATE_ALL() \ +CYG_MACRO_START /* this macro can discard dirty cache lines. */ \ + /* this macro can discard dirty cache lines. */ \ + asm volatile ( \ + "mcr p15,0,r1,c7,c6,0;" /* invalidate data cache */ \ + "mcr p15,0,r1,c8,c7,0;" /* flush I+D TLBs */ \ + : \ + : \ + : "r1" /* Clobber list */ \ + ); \ +CYG_MACRO_END + + +// Synchronize the contents of the cache with memory. +#define HAL_DCACHE_SYNC() \ +CYG_MACRO_START \ + /* The best way to evict a dirty line is by using the */ \ + /* line allocate operation on non-existent memory. */ \ + asm volatile ( \ + "mov r0, %0;" /* cache flush region */ \ + "add r1, r0, #0x8800;" /* 32KB main + 2KB mini cache */ \ + "667: " \ + "mcr p15,0,r0,c7,c2,5;" /* allocate a line */ \ + "add r0, r0, #32;" /* 32 bytes/line */ \ + "teq r1, r0;" \ + "bne 667b;" \ + "mcr p15,0,r0,c7,c6,0;" /* invalidate data cache */ \ + /* cpuwait */ \ + "mrc p15,0,r1,c2,c0,0;" /* arbitrary read */ \ + "mov r1,r1;" \ + "sub pc,pc,#4;" \ + "mcr p15,0,r0,c7,c10,4;" /* and drain the write buffer */ \ + /* cpuwait */ \ + "mrc p15,0,r1,c2,c0,0;" /* arbitrary read */ \ + "mov r1,r1;" \ + "sub pc,pc,#4;" \ + "nop" \ + : \ + : "i" (DCACHE_FLUSH_AREA) \ + : "r0","r1" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_size_) +// This feature is not available on the SA11X0. + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) +// This feature is not available on the SA11X0. + +#define HAL_DCACHE_WRITETHRU_MODE 0 +#define HAL_DCACHE_WRITEBACK_MODE 1 + +// Get the current writeback mode - or only writeback mode if fixed +#define HAL_DCACHE_QUERY_WRITE_MODE( _mode_ ) CYG_MACRO_START \ + _mode_ = HAL_DCACHE_WRITEBACK_MODE; \ +CYG_MACRO_END + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +//#define HAL_DCACHE_LOCK(_base_, _size_) +// This feature is not available on the SA11X0. + +// Undo a previous lock operation +//#define HAL_DCACHE_UNLOCK(_base_, _size_) +// This feature is not available on the SA11X0. + +// Unlock entire cache +//#define HAL_DCACHE_UNLOCK_ALL() +// This feature is not available on the SA11X0. + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) +// This feature is not available on the SA11X0. + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +#define HAL_DCACHE_FLUSH( _base_ , _size_ ) \ +CYG_MACRO_START \ + HAL_DCACHE_STORE( _base_ , _size_ ); \ + HAL_DCACHE_INVALIDATE( _base_ , _size_ ); \ +CYG_MACRO_END + +// Invalidate cache lines in the given range without writing to memory. +#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) \ +CYG_MACRO_START \ + register int addr, enda; \ + for ( addr = (~(HAL_DCACHE_LINE_SIZE - 1)) & (int)(_base_), \ + enda = (int)(_base_) + (_size_); \ + addr < enda ; \ + addr += HAL_DCACHE_LINE_SIZE ) \ + { \ + asm volatile ( \ + "mcr p15,0,%0,c7,c6,1;" /* flush entry away */ \ + : \ + : "r"(addr) \ + : "memory" \ + ); \ + } \ +CYG_MACRO_END + +// Write dirty cache lines to memory for the given address range. +#define HAL_DCACHE_STORE( _base_ , _size_ ) \ +CYG_MACRO_START \ + register int addr, enda; \ + for ( addr = (~(HAL_DCACHE_LINE_SIZE - 1)) & (int)(_base_), \ + enda = (int)(_base_) + (_size_); \ + addr < enda ; \ + addr += HAL_DCACHE_LINE_SIZE ) \ + { \ + asm volatile ("mcr p15,0,%0,c7,c10,1;" /* push entry to RAM */ \ + : \ + : "r"(addr) \ + : "memory" \ + ); \ + } \ + /* and also drain the write buffer */ \ + asm volatile ( \ + "mov r1,#0;" \ + "mcr p15,0,r1,c7,c10,4;" \ + : \ + : \ + : "r1", "memory" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) +// This feature is available on the SA11X0, but due to tricky +// coherency issues with the read buffer (see SA11X0 developer's +// manual page 6-7) we don't bother to implement it here. + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) +// This feature is not available on the SA11X0. + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_DCACHE_ZERO( _base_ , _size_ ) +// This feature is not available on the SA11X0. + +//----------------------------------------------------------------------------- +// Now include the details of the platform's Memory Map setup: + +#include + +// and define the (considerably less efficient) routines that are available +// for testing the actual memory map in force. + +externC cyg_uint32 hal_virt_to_phys_address( cyg_uint32 vaddr ); +externC cyg_uint32 hal_phys_to_virt_address( cyg_uint32 paddr ); +externC cyg_uint32 hal_virt_to_uncached_address( cyg_uint32 vaddr ); + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_CACHE_H +// End of hal_cache.h diff --git a/packages/hal/arm/xscale/verde/current/include/hal_mm.h b/packages/hal/arm/xscale/verde/current/include/hal_mm.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/verde/current/include/hal_mm.h @@ -0,0 +1,227 @@ +#ifndef CYGONCE_HAL_MM_H +#define CYGONCE_HAL_MM_H + +//============================================================================= +// +// hal_mm.h +// +// Intel XScale MM common definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: gthomas +// Date: 2001-12-03 +// Purpose: Intel XScale MM common definitions +// Description: The macros defined here provide common definitions for +// memory management initialization. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + + +#ifdef __ASSEMBLER__ + +// form a first-level section entry +.macro FL_SECTION_ENTRY base,x,ap,p,d,c,b +.word (\base << 20) | (\x << 12) | (\ap << 10) | (\p << 9) |\ + (\d << 5) | (\c << 3) | (\b << 2) | 2 +.endm + +// form a first-level page table entry +.macro FL_PT_ENTRY base,p,d +// I wanted to use logical operations here, but since I am using symbols later +// to fill in the parameters, I had to use addition to force the assembler to +// do it right +.word \base + (\p << 9) + (\d << 5) + 1 +.endm + +// form a second level small page entry +.macro SL_SMPAGE_ENTRY base,ap3,ap2,ap1,ap0,c,b +.word (\base << 12) | (\ap3 << 10) | (\ap2 << 8) | (\ap1 << 6) |\ + (\ap0 << 4) | (\c << 3) | (\b << 2) | 2 +.endm + +// form a second level extended small page entry +.macro SL_XSMPAGE_ENTRY base,x,ap,c,b +.word (\base << 12) | (\x << 6) | (\ap << 4) | (\c << 3) | (\b << 2) | 3 +.endm + +#else + +// ------------------------------------------------------------------------- +// MMU initialization: +// +// These structures are laid down in memory to define the translation +// table. +// + +/* + * XScale Translation Table Base Bit Masks + */ +#define ARM_TRANSLATION_TABLE_MASK 0xFFFFC000 + +/* + * XScale Domain Access Control Bit Masks + */ +#define ARM_ACCESS_TYPE_NO_ACCESS(domain_num) (0x0 << (domain_num)*2) +#define ARM_ACCESS_TYPE_CLIENT(domain_num) (0x1 << (domain_num)*2) +#define ARM_ACCESS_TYPE_MANAGER(domain_num) (0x3 << (domain_num)*2) + +struct ARM_MMU_FIRST_LEVEL_FAULT { + unsigned int id : 2; + unsigned int sbz : 30; +}; +#define ARM_MMU_FIRST_LEVEL_FAULT_ID 0x0 + +struct ARM_MMU_FIRST_LEVEL_PAGE_TABLE { + unsigned int id : 2; + unsigned int imp : 2; + unsigned int domain : 4; + unsigned int p : 1; + unsigned int base_address : 23; +}; +#define ARM_MMU_FIRST_LEVEL_PAGE_TABLE_ID 0x1 + +struct ARM_MMU_FIRST_LEVEL_SECTION { + unsigned int id : 2; + unsigned int b : 1; + unsigned int c : 1; + unsigned int imp : 1; + unsigned int domain : 4; + unsigned int p : 1; + unsigned int ap : 2; + unsigned int tex : 8; + unsigned int base_address : 12; +}; +#define ARM_MMU_FIRST_LEVEL_SECTION_ID 0x2 + +struct ARM_MMU_FIRST_LEVEL_RESERVED { + unsigned int id : 2; + unsigned int sbz : 30; +}; +#define ARM_MMU_FIRST_LEVEL_RESERVED_ID 0x3 + +#define ARM_MMU_FIRST_LEVEL_DESCRIPTOR_ADDRESS(ttb_base, table_index) \ + (unsigned long *)((unsigned long)(ttb_base) + ((table_index) << 2)) + +#define ARM_FIRST_LEVEL_PAGE_TABLE_SIZE 0x4000 + +#define ARM_MMU_SECTION(ttb_base, actual_base, virtual_base, \ + cacheable, bufferable, perm) \ + CYG_MACRO_START \ + register union ARM_MMU_FIRST_LEVEL_DESCRIPTOR desc; \ + \ + desc.word = 0; \ + desc.section.id = ARM_MMU_FIRST_LEVEL_SECTION_ID; \ + desc.section.domain = 0; \ + desc.section.c = (cacheable); \ + desc.section.b = (bufferable); \ + desc.section.ap = (perm); \ + desc.section.base_address = (actual_base); \ + *ARM_MMU_FIRST_LEVEL_DESCRIPTOR_ADDRESS(ttb_base, (virtual_base)) \ + = desc.word; \ + CYG_MACRO_END + +#define X_ARM_MMU_SECTION(abase,vbase,size,cache,buff,access) \ + { int i; int j = abase; int k = vbase; \ + for (i = size; i > 0 ; i--,j++,k++) \ + { \ + ARM_MMU_SECTION(ttb_base, j, k, cache, buff, access); \ + } \ + } + +union ARM_MMU_FIRST_LEVEL_DESCRIPTOR { + unsigned long word; + struct ARM_MMU_FIRST_LEVEL_FAULT fault; + struct ARM_MMU_FIRST_LEVEL_PAGE_TABLE page_table; + struct ARM_MMU_FIRST_LEVEL_SECTION section; + struct ARM_MMU_FIRST_LEVEL_RESERVED reserved; +}; + +#define ARM_UNCACHEABLE 0 +#define ARM_CACHEABLE 1 +#define ARM_UNBUFFERABLE 0 +#define ARM_BUFFERABLE 1 + +#define ARM_ACCESS_PERM_NONE_NONE 0 +#define ARM_ACCESS_PERM_RO_NONE 0 +#define ARM_ACCESS_PERM_RO_RO 0 +#define ARM_ACCESS_PERM_RW_NONE 1 +#define ARM_ACCESS_PERM_RW_RO 2 +#define ARM_ACCESS_PERM_RW_RW 3 + +/* + * Initialization for the Domain Access Control Register + */ +#define ARM_ACCESS_DACR_DEFAULT ( \ + ARM_ACCESS_TYPE_MANAGER(0) | \ + ARM_ACCESS_TYPE_NO_ACCESS(1) | \ + ARM_ACCESS_TYPE_NO_ACCESS(2) | \ + ARM_ACCESS_TYPE_NO_ACCESS(3) | \ + ARM_ACCESS_TYPE_NO_ACCESS(4) | \ + ARM_ACCESS_TYPE_NO_ACCESS(5) | \ + ARM_ACCESS_TYPE_NO_ACCESS(6) | \ + ARM_ACCESS_TYPE_NO_ACCESS(7) | \ + ARM_ACCESS_TYPE_NO_ACCESS(8) | \ + ARM_ACCESS_TYPE_NO_ACCESS(9) | \ + ARM_ACCESS_TYPE_NO_ACCESS(10) | \ + ARM_ACCESS_TYPE_NO_ACCESS(11) | \ + ARM_ACCESS_TYPE_NO_ACCESS(12) | \ + ARM_ACCESS_TYPE_NO_ACCESS(13) | \ + ARM_ACCESS_TYPE_NO_ACCESS(14) | \ + ARM_ACCESS_TYPE_NO_ACCESS(15) ) + +#endif // ifdef __ASSEMBLER__ + +// ------------------------------------------------------------------------ +// XScale extras. +#define MMU_Control_BTB 0x800 + + +#endif // ifndef CYGONCE_HAL_MM_H +// End of hal_mm.h + + + + + diff --git a/packages/hal/arm/xscale/verde/current/include/hal_var_ints.h b/packages/hal/arm/xscale/verde/current/include/hal_var_ints.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/verde/current/include/hal_var_ints.h @@ -0,0 +1,139 @@ +#ifndef CYGONCE_HAL_VAR_INTS_H +#define CYGONCE_HAL_VAR_INTS_H +//========================================================================== +// +// hal_var_ints.h +// +// HAL Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-12-03 +// Purpose: Define Interrupt support +// Description: The interrupt details for XScale CPUs are defined here. +// Usage: +// #include +// #include CYGBLD_HAL_VARIANT_H +// #include CYGBLD_HAL_VAR_INTS_H +// +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include // registers + +#define CYGNUM_HAL_INTERRUPT_NONE -1 +#define CYGNUM_HAL_INTERRUPT_DMA0_EOT 0 +#define CYGNUM_HAL_INTERRUPT_DMA0_EOC 1 +#define CYGNUM_HAL_INTERRUPT_DMA1_EOT 2 +#define CYGNUM_HAL_INTERRUPT_DMA1_EOC 3 +#define CYGNUM_HAL_INTERRUPT_RSVD_4 4 +#define CYGNUM_HAL_INTERRUPT_RSVD_5 5 +#define CYGNUM_HAL_INTERRUPT_AA_EOT 6 +#define CYGNUM_HAL_INTERRUPT_AA_EOC 7 +#define CYGNUM_HAL_INTERRUPT_CORE_PMON 8 +#define CYGNUM_HAL_INTERRUPT_TIMER0 9 +#define CYGNUM_HAL_INTERRUPT_TIMER1 10 +#define CYGNUM_HAL_INTERRUPT_I2C_0 11 +#define CYGNUM_HAL_INTERRUPT_I2C_1 12 +#define CYGNUM_HAL_INTERRUPT_MESSAGING 13 +#define CYGNUM_HAL_INTERRUPT_ATU_BIST 14 +#define CYGNUM_HAL_INTERRUPT_PERFMON 15 +#define CYGNUM_HAL_INTERRUPT_CORE_PMU 16 +#define CYGNUM_HAL_INTERRUPT_BIU_ERR 17 +#define CYGNUM_HAL_INTERRUPT_ATU_ERR 18 +#define CYGNUM_HAL_INTERRUPT_MCU_ERR 19 +#define CYGNUM_HAL_INTERRUPT_DMA0_ERR 20 +#define CYGNUM_HAL_INTERRUPT_DMA1_ERR 21 +#define CYGNUM_HAL_INTERRUPT_RSVD_22 22 +#define CYGNUM_HAL_INTERRUPT_AA_ERR 23 +#define CYGNUM_HAL_INTERRUPT_MSG_ERR 24 +#define CYGNUM_HAL_INTERRUPT_SSP 25 +#define CYGNUM_HAL_INTERRUPT_RSVD_26 26 +#define CYGNUM_HAL_INTERRUPT_XINT0 27 +#define CYGNUM_HAL_INTERRUPT_XINT1 28 +#define CYGNUM_HAL_INTERRUPT_XINT2 29 +#define CYGNUM_HAL_INTERRUPT_XINT3 30 +#define CYGNUM_HAL_INTERRUPT_HPI 31 + +#define CYGNUM_HAL_VAR_ISR_MAX 31 + +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX 31 + +#define CYGNUM_HAL_ISR_COUNT (CYGNUM_HAL_ISR_MAX+1) + +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_TIMER0 + +#endif // CYGONCE_HAL_VAR_INTS_H + +// ------------------------------------------------------------------------ +// Dynamically set the timer interrupt rate. +// Not for application use at all. + +externC void +hal_clock_reinitialize( int *pfreq, /* inout */ + unsigned int *pperiod, /* inout */ + unsigned int old_hz ); /* in */ + +#define HAL_CLOCK_REINITIALIZE( _freq, _period, _old_hz ) \ + hal_clock_reinitialize( &_freq, &_period, _old_hz ) + +//---------------------------------------------------------------------------- +// Reset. +#define HAL_PLATFORM_RESET() \ + CYG_MACRO_START \ + cyg_uint32 ctrl; \ + \ + /* By disabling interupts we will just hang in the loop below */ \ + /* if for some reason the software reset fails. */ \ + HAL_DISABLE_INTERRUPTS(ctrl); \ + \ + *ATU_PCSR = PCSR_RESET_I_BUS | PCSR_RESET_P_BUS; \ + \ + for(;;); /* hang here forever if reset fails */ \ + CYG_MACRO_END + +// Fallback (never really used) +#define HAL_PLATFORM_RESET_ENTRY 0x00000000 + +// EOF hal_var_ints.h diff --git a/packages/hal/arm/xscale/verde/current/include/hal_verde.h b/packages/hal/arm/xscale/verde/current/include/hal_verde.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/verde/current/include/hal_verde.h @@ -0,0 +1,477 @@ +/*============================================================================= +// +// hal_verde.h +// +// Verde I/O Coprocessor support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-12-03 +// Purpose: +// Description: Verde I/O Processor support. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ +#ifndef CYGONCE_HAL_ARM_XSCALE_HAL_VERDE_H +#define CYGONCE_HAL_ARM_XSCALE_HAL_VERDE_H + +#include + +#ifdef __ASSEMBLER__ + // Useful CPU macros + + // Delay a bit + .macro DELAY_FOR cycles, reg0 + ldr \reg0, =\cycles + subs \reg0, \reg0, #1 + subne pc, pc, #0xc + .endm + + // wait for coprocessor write complete + .macro CPWAIT reg + mrc p15,0,\reg,c2,c0,0 + mov \reg,\reg + sub pc,pc,#4 + .endm + + // Enable the BTB + .macro BTB_INIT reg + mrc p15, 0, \reg, c1, c0, 0 + orr \reg, \reg, #MMU_Control_BTB + mcr p15, 0, \reg, c1, c0, 0 + CPWAIT \reg + .endm +#else +static inline void CPWAIT(void) { + cyg_uint32 tmp; + asm volatile ("mrc p15,0,%0,c2,c0,0\n" + "mov %0,%0\n" + "sub pc,pc,#4" : "=r" (tmp)); +} +#endif + + +#ifdef __ASSEMBLER__ + +#define REG8_VAL(a) (a) +#define REG16_VAL(a) (a) +#define REG32_VAL(a) (a) + +#define REG8_PTR(a) (a) +#define REG16_PTR(a) (a) +#define REG32_PTR(a) (a) + +#else /* __ASSEMBLER__ */ + +#define REG8_VAL(a) ((unsigned char)(a)) +#define REG16_VAL(a) ((unsigned short)(a)) +#define REG32_VAL(a) ((unsigned int)(a)) + +#define REG8_PTR(a) ((volatile unsigned char *)(a)) +#define REG16_PTR(a) ((volatile unsigned short *)(a)) +#define REG32_PTR(a) ((volatile unsigned int *)(a)) + +#endif /* __ASSEMBLER__ */ + + +// -------------------------------------------------------------------------- +// Address Translation Unit (Chapter 3) +#define ATU_ATUVID REG16_PTR(0xffffe100) +#define ATU_ATUDID REG16_PTR(0xffffe102) +#define ATU_ATUCMD REG16_PTR(0xffffe104) +#define ATU_ATUSR REG16_PTR(0xffffe106) +#define ATU_ATURID REG8_PTR(0xffffe108) +#define ATU_ATUCCR REG8_PTR(0xffffe109) +#define ATU_ATUCLSR REG8_PTR(0xffffe10c) +#define ATU_ATULT REG8_PTR(0xffffe10d) +#define ATU_ATUHTR REG8_PTR(0xffffe10e) +#define ATU_ATUBIST REG8_PTR(0xffffe10f) +#define ATU_IABAR0 REG32_PTR(0xffffe110) +#define ATU_IAUBAR0 REG32_PTR(0xffffe114) +#define ATU_IABAR1 REG32_PTR(0xffffe118) +#define ATU_IAUBAR1 REG32_PTR(0xffffe11c) +#define ATU_IABAR2 REG32_PTR(0xffffe120) +#define ATU_IAUBAR2 REG32_PTR(0xffffe124) +#define ATU_ASVIR REG16_PTR(0xffffe12c) +#define ATU_ASIR REG16_PTR(0xffffe12e) +#define ATU_ERBAR REG32_PTR(0xffffe130) +#define ATU_ATUILR REG8_PTR(0xffffe13c) +#define ATU_ATUIPR REG8_PTR(0xffffe13d) +#define ATU_ATUMGNT REG8_PTR(0xffffe13e) +#define ATU_ATUMLAT REG8_PTR(0xffffe13f) +#define ATU_IALR0 REG32_PTR(0xffffe140) +#define ATU_IATVR0 REG32_PTR(0xffffe144) +#define ATU_ERLR REG32_PTR(0xffffe148) +#define ATU_ERTVR REG32_PTR(0xffffe14c) +#define ATU_IALR1 REG32_PTR(0xffffe150) +#define ATU_IALR2 REG32_PTR(0xffffe154) +#define ATU_IATVR2 REG32_PTR(0xffffe158) +#define ATU_OIOWTVR REG32_PTR(0xffffe15c) +#define ATU_OMWTVR0 REG32_PTR(0xffffe160) +#define ATU_OUMWTVR0 REG32_PTR(0xffffe164) +#define ATU_OMWTVR1 REG32_PTR(0xffffe168) +#define ATU_OUMWTVR1 REG32_PTR(0xffffe16c) +#define ATU_OUDWTVR REG32_PTR(0xffffe178) +#define ATU_ATUCR REG32_PTR(0xffffe180) +#define ATU_PCSR REG32_PTR(0xffffe184) +#define ATU_ATUISR REG32_PTR(0xffffe188) +#define ATU_ATUIMR REG32_PTR(0xffffe18c) +#define ATU_IABAR3 REG32_PTR(0xffffe190) +#define ATU_IAUBAR3 REG32_PTR(0xffffe194) +#define ATU_IALR3 REG32_PTR(0xffffe198) +#define ATU_IATVR3 REG32_PTR(0xffffe19c) +#define ATU_OCCAR REG32_PTR(0xffffe1a4) +#define ATU_OCCDR REG32_PTR(0xffffe1ac) +#define ATU_PDSCR REG32_PTR(0xffffe1bc) +#define ATU_PMCAPID REG8_PTR(0xffffe1c0) +#define ATU_PMNEXT REG8_PTR(0xffffe1c1) +#define ATU_APMCR REG16_PTR(0xffffe1c2) +#define ATU_APMCSR REG16_PTR(0xffffe1c4) +#define ATU_PCIXCAPID REG8_PTR(0xffffe1e0) +#define ATU_PCIXNEXT REG8_PTR(0xffffe1e1) +#define ATU_PCIXCMD REG16_PTR(0xffffe1e2) +#define ATU_PCIXSR REG32_PTR(0xffffe1e4) + +#define PCSR_RESET_I_BUS 0x20 +#define PCSR_RESET_P_BUS 0x10 +#define PCSR_CFG_RETRY 0x04 + + +// -------------------------------------------------------------------------- +// Application Accelerator Unit (Chapter 6) +#define AAU_ACR REG32_PTR(0xffffe800) +#define AAU_ASR REG32_PTR(0xffffe804) +#define AAU_ADAR REG32_PTR(0xffffe808) +#define AAU_ANDAR REG32_PTR(0xffffe80c) +#define AAU_SAR1 REG32_PTR(0xffffe810) +#define AAU_SAR2 REG32_PTR(0xffffe814) +#define AAU_SAR3 REG32_PTR(0xffffe818) +#define AAU_SAR4 REG32_PTR(0xffffe81c) +#define AAU_DAR REG32_PTR(0xffffe820) +#define AAU_ABCR REG32_PTR(0xffffe824) +#define AAU_ADCR REG32_PTR(0xffffe828) +#define AAU_SAR5 REG32_PTR(0xffffe82c) +#define AAU_SAR6 REG32_PTR(0xffffe830) +#define AAU_SAR7 REG32_PTR(0xffffe834) +#define AAU_SAR8 REG32_PTR(0xffffe838) +#define AAU_EDCR0 REG32_PTR(0xffffe83c) +#define AAU_SAR9 REG32_PTR(0xffffe840) +#define AAU_SAR10 REG32_PTR(0xffffe844) +#define AAU_SAR11 REG32_PTR(0xffffe848) +#define AAU_SAR12 REG32_PTR(0xffffe84c) +#define AAU_SAR13 REG32_PTR(0xffffe850) +#define AAU_SAR14 REG32_PTR(0xffffe854) +#define AAU_SAR15 REG32_PTR(0xffffe858) +#define AAU_SAR16 REG32_PTR(0xffffe85c) +#define AAU_EDCR1 REG32_PTR(0xffffe860) +#define AAU_SAR17 REG32_PTR(0xffffe864) +#define AAU_SAR18 REG32_PTR(0xffffe868) +#define AAU_SAR19 REG32_PTR(0xffffe86c) +#define AAU_SAR20 REG32_PTR(0xffffe870) +#define AAU_SAR21 REG32_PTR(0xffffe874) +#define AAU_SAR22 REG32_PTR(0xffffe878) +#define AAU_SAR23 REG32_PTR(0xffffe87c) +#define AAU_SAR24 REG32_PTR(0xffffe880) +#define AAU_EDCR2 REG32_PTR(0xffffe884) +#define AAU_SAR25 REG32_PTR(0xffffe888) +#define AAU_SAR26 REG32_PTR(0xffffe88c) +#define AAU_SAR27 REG32_PTR(0xffffe890) +#define AAU_SAR28 REG32_PTR(0xffffe894) +#define AAU_SAR29 REG32_PTR(0xffffe898) +#define AAU_SAR30 REG32_PTR(0xffffe89c) +#define AAU_SAR31 REG32_PTR(0xffffe8a0) +#define AAU_SAR32 REG32_PTR(0xffffe8a4) +#define AAU_RES0 REG32_PTR(0xffffe8a8) +#define AAU_RES1 REG32_PTR(0xffffe900) +#define AAU_RES2 REG32_PTR(0xfffff000) + +#define ACR_ENABLE 1 +#define ACR_RESUME 2 + +#define ASR_ACTIVE 0x400 + + +// -------------------------------------------------------------------------- +// Memory Controller (Chapter 7) +#define MCU_SDIR REG32_PTR(0xffffe500) +#define MCU_SDCR REG32_PTR(0xffffe504) +#define MCU_SDBR REG32_PTR(0xffffe508) +#define MCU_SBR0 REG32_PTR(0xffffe50c) +#define MCU_SBR1 REG32_PTR(0xffffe510) +#define MCU_ECCR REG32_PTR(0xffffe534) +#define MCU_ELOG0 REG32_PTR(0xffffe538) +#define MCU_ELOG1 REG32_PTR(0xffffe53c) +#define MCU_ECAR0 REG32_PTR(0xffffe540) +#define MCU_ECAR1 REG32_PTR(0xffffe544) +#define MCU_ECTST REG32_PTR(0xffffe548) +#define MCU_MCISR REG32_PTR(0xffffe54c) +#define MCU_RFR REG32_PTR(0xffffe550) +#define MCU_DBUDSR REG32_PTR(0xffffe554) +#define MCU_DBDDSR REG32_PTR(0xffffe558) +#define MCU_CUDSR REG32_PTR(0xffffe55c) +#define MCU_CDDSR REG32_PTR(0xffffe560) +#define MCU_CEUDSR REG32_PTR(0xffffe564) +#define MCU_CEDDSR REG32_PTR(0xffffe568) +#define MCU_CSUDSR REG32_PTR(0xffffe56c) +#define MCU_CSDDSR REG32_PTR(0xffffe570) +#define MCU_REUDSR REG32_PTR(0xffffe574) +#define MCU_REDDSR REG32_PTR(0xffffe578) +#define MCU_ABUDSR REG32_PTR(0xffffe57c) +#define MCU_ABDDSR REG32_PTR(0xffffe580) +#define MCU_DSDR REG32_PTR(0xffffe584) +#define MCU_REDR REG32_PTR(0xffffe588) +#define MCU_RES10 REG32_PTR(0xffffe58c) + +// Banksize specific component of SBRx register bits +#define SBR_32MEG 1 +#define SBR_64MEG 2 +#define SBR_128MEG 4 +#define SBR_256MEG 8 +#define SBR_512MEG 16 + +// Refresh rates for 200MHz +#define RFR_3_9us 0x300 +#define RFR_7_8us 0x600 +#define RFR_15_6us 0xC00 + +#define DSDR_REC_VAL 0x00000231 +#define REDR_REC_VAL 0x00000000 +#define SDCR_INIT_VAL 0x00000018 // 64-bit - unbuffered DIMM & turn off compensations (SECRET BITS!!!) + +// SDRAM MODE COMMANDS +#define SDIR_CMD_NOP 0x00000005 +#define SDIR_CMD_PRECHARGE_ALL 0x00000004 +#define SDIR_CMD_ENABLE_DLL 0x00000006 +#define SDIR_CMD_CAS_LAT_2_A 0x00000002 +#define SDIR_CMD_CAS_LAT_2_B 0x00000000 +#define SDIR_CMD_AUTO_REFRESH 0x00000007 + + +// -------------------------------------------------------------------------- +// Peripheral Bus Interface Unit (Chapter 8) +#define PBIU_PBCR REG32_PTR(0xffffe680) +#define PBIU_PBSR REG32_PTR(0xffffe684) +#define PBIU_PBAR0 REG32_PTR(0xffffe688) +#define PBIU_PBLR0 REG32_PTR(0xffffe68c) +#define PBIU_PBAR1 REG32_PTR(0xffffe690) +#define PBIU_PBLR1 REG32_PTR(0xffffe694) +#define PBIU_PBAR2 REG32_PTR(0xffffe698) +#define PBIU_PBLR2 REG32_PTR(0xffffe69c) +#define PBIU_PBAR3 REG32_PTR(0xffffe6a0) +#define PBIU_PBLR3 REG32_PTR(0xffffe6a4) +#define PBIU_PBAR4 REG32_PTR(0xffffe6a8) +#define PBIU_PBLR4 REG32_PTR(0xffffe6ac) +#define PBIU_PBAR5 REG32_PTR(0xffffe6b0) +#define PBIU_PBLR5 REG32_PTR(0xffffe6b4) +#define PBIU_PBVR0 REG32_PTR(0xffffe6c0) +#define PBIU_PBVR1 REG32_PTR(0xffffe6c4) +#define PBIU_PBVR2 REG32_PTR(0xffffe6c8) +#define PBIU_PBVR3 REG32_PTR(0xffffe6cc) +#define PBIU_PBVR4 REG32_PTR(0xffffe6d0) +#define PBIU_PBVR5 REG32_PTR(0xffffe6d8) +#define PBIU_PBVR6 REG32_PTR(0xffffe6dc) + +#define PBCR_ENABLE 1 + +#define PBCR_ERR_VALID 0x01 +#define PBCR_ERR_WRITE 0x02 +#define PBCR_ERR_TYPEMASK 0x0C + +#define PBAR_FLASH 0x200 +#define PBAR_RCWAIT_1 0x000 +#define PBAR_RCWAIT_4 0x040 +#define PBAR_RCWAIT_8 0x080 +#define PBAR_RCWAIT_12 0x0C0 +#define PBAR_RCWAIT_16 0x100 +#define PBAR_RCWAIT_20 0x1C0 +#define PBAR_ADWAIT_4 0x000 +#define PBAR_ADWAIT_8 0x004 +#define PBAR_ADWAIT_12 0x008 +#define PBAR_ADWAIT_16 0x00C +#define PBAR_ADWAIT_20 0x01C +#define PBAR_BUS_8 0x000 +#define PBAR_BUS_16 0x001 +#define PBAR_BUS_32 0x002 + +#define PBLR_SZ_4K 0xfffff000 +#define PBLR_SZ_8K 0xffffe000 +#define PBLR_SZ_16K 0xffffc000 +#define PBLR_SZ_32K 0xffff8000 +#define PBLR_SZ_64K 0xffff0000 +#define PBLR_SZ_128K 0xfffe0000 +#define PBLR_SZ_256K 0xfffc0000 +#define PBLR_SZ_512K 0xfff80000 +#define PBLR_SZ_1M 0xfff00000 +#define PBLR_SZ_2M 0xffe00000 +#define PBLR_SZ_4M 0xffc00000 +#define PBLR_SZ_8M 0xff800000 +#define PBLR_SZ_16M 0xff000000 +#define PBLR_SZ_32M 0xfe000000 +#define PBLR_SZ_64M 0xfc000000 +#define PBLR_SZ_128M 0xf8000000 +#define PBLR_SZ_256M 0xf0000000 +#define PBLR_SZ_512M 0xe0000000 +#define PBLR_SZ_1G 0xc0000000 +#define PBLR_SZ_2G 0x80000000 +#define PBLR_SZ_DISABLE 0x00000000 + +// -------------------------------------------------------------------------- +// I2C (Chapter 9) +#define I2C_ICR0 REG32_PTR(0xfffff680) +#define I2C_ICR1 REG32_PTR(0xfffff6A0) +#define I2C_ISR0 REG32_PTR(0xfffff684) +#define I2C_ISR1 REG32_PTR(0xfffff6A4) +#define I2C_ISAR0 REG32_PTR(0xfffff688) +#define I2C_ISAR1 REG32_PTR(0xfffff6A8) +#define I2C_IDBR0 REG32_PTR(0xfffff68c) +#define I2C_IDBR1 REG32_PTR(0xfffff6Ac) +#define I2C_IBMR0 REG32_PTR(0xfffff694) +#define I2C_IBMR1 REG32_PTR(0xfffff6b4) + +// Control Register bits +#define ICR_START 0x0001 /* 1:send a Start condition to the I2C when in master mode */ +#define ICR_STOP 0x0002 /* 1:send a Stop condition after next byte transferred in master mode */ +#define ICR_ACK 0x0004 /* Ack/Nack control: 1:Nack, 0:Ack (negative or positive pulse) */ +#define ICR_TRANSFER 0x0008 /* 1:send/receive byte, 0:cleared by I2C unit when done */ +#define ICR_ABORT 0x0010 /* 1:I2C sends STOP w/out data permission, 0:ICR bit used only */ +#define ICR_SCLENB 0x0020 /* I2C clock output: 1:Enabled, 0:Disabled. ICCR configured before ! */ +#define ICR_ENB 0x0040 /* I2C unit: 1:Enabled, 0:Disabled */ +#define ICR_GCALL 0x0080 /* General Call: 1:Disabled, 0:Enabled */ +#define ICR_IEMPTY 0x0100 /* 1: IDBR Transmit Empty Interrupt Enable */ +#define ICR_IFULL 0x0200 /* 1: IDBR Receive Full Interrupt Enable */ +#define ICR_IERR 0x0400 /* 1: Bus Error Interrupt Enable */ +#define ICR_ISTOP 0x0800 /* 1: Slave Stop Detected Interrupt Enable */ +#define ICR_IARB 0x1000 /* 1: Arbitration Loss Detected Interrupt Enable */ +#define ICR_ISADDR 0x2000 /* 1: Slave Address Detected Interrupt Enable */ +#define ICR_RESET 0x4000 /* 1: I2C unit reset */ + +// Status Register bits +#define ISR_RWMODE 0x0001 /* 1: I2C in master receive = slave transmit mode */ +#define ISR_ACK 0x0002 /* 1: I2C received/sent a Nack, 0: Ack */ +#define ISR_BUSY 0x0004 /* 1: Processor's I2C unit busy */ +#define ISR_BUSBUSY 0x0008 /* 1: I2C bus busy. Processor's I2C unit not involved */ +#define ISR_STOP 0x0010 /* 1: Slave Stop detected (when in slave mode: receive or transmit) */ +#define ISR_ARB 0x0020 /* 1: Arbitration Loss Detected */ +#define ISR_EMPTY 0x0040 /* 1: Transfer finished on I2C bus. If enabled in ICR, interrupt signaled */ +#define ISR_FULL 0x0080 /* 1: IDBR received new byte from I2C bus. If ICR, interrupt signaled */ +#define ISR_GCALL 0x0100 /* 1: I2C unit received a General Call address */ +#define ISR_SADDR 0x0200 /* 1: I2C unit detected a 7-bit address matching the general call or ISAR */ +#define ISR_ERROR 0x0400 /* Bit set by unit when a Bus Error detected */ + +#define IDBR_MASK 0x000000ff +#define IDBR_MODE 0x01 + + +// -------------------------------------------------------------------------- +// Timers (Chapter 14) +#define TU_TMR0 REG32_PTR(0xffffe7e0) +#define TU_TMR1 REG32_PTR(0xffffe7e4) +#define TU_TCR0 REG32_PTR(0xffffe7e8) +#define TU_TCR1 REG32_PTR(0xffffe7ec) +#define TU_TRR0 REG32_PTR(0xffffe7f0) +#define TU_TRR1 REG32_PTR(0xffffe7f4) +#define TU_TISR REG32_PTR(0xffffe7f8) +#define TU_WDTCR REG32_PTR(0xffffe7fc) + +#define TMR_TC 0x01 // terminal count +#define TMR_ENABLE 0x02 // timer enable +#define TMR_RELOAD 0x04 // auto reload enable +#define TMR_CLK_1 0x00 // CCLK (core clock) +#define TMR_CLK_4 0x10 // CCLK/4 +#define TMR_CLK_8 0x20 // CCLK/8 +#define TMR_CLK_16 0x30 // CCLK/16 + +#ifndef __ASSEMBLER__ +// For full read/write access, you have to use coprocessor insns. +#define TMR0_READ(val) asm volatile ("mrc p6, 0, %0, c0, c1, 0" : "=r" (val)) +#define _TMR0_WRITE(val) asm volatile ("mcr p6, 0, %0, c0, c1, 0" : : "r" (val)) +#define TMR1_READ(val) asm volatile ("mrc p6, 0, %0, c1, c1, 0" : "=r" (val)) +#define _TMR1_WRITE(val) asm volatile ("mcr p6, 0, %0, c1, c1, 0" : : "r" (val)) +#define TCR0_READ(val) asm volatile ("mrc p6, 0, %0, c2, c1, 0" : "=r" (val)) +#define _TCR0_WRITE(val) asm volatile ("mcr p6, 0, %0, c2, c1, 0" : : "r" (val)) +#define TCR1_READ(val) asm volatile ("mrc p6, 0, %0, c3, c1, 0" : "=r" (val)) +#define _TCR1_WRITE(val) asm volatile ("mcr p6, 0, %0, c3, c1, 0" : : "r" (val)) +#define TRR0_READ(val) asm volatile ("mrc p6, 0, %0, c4, c1, 0" : "=r" (val)) +#define _TRR0_WRITE(val) asm volatile ("mcr p6, 0, %0, c4, c1, 0" : : "r" (val)) +#define TRR1_READ(val) asm volatile ("mrc p6, 0, %0, c5, c1, 0" : "=r" (val)) +#define _TRR1_WRITE(val) asm volatile ("mcr p6, 0, %0, c5, c1, 0" : : "r" (val)) +#define TISR_READ(val) asm volatile ("mrc p6, 0, %0, c6, c1, 0" : "=r" (val)) +#define _TISR_WRITE(val) asm volatile ("mcr p6, 0, %0, c6, c1, 0" : : "r" (val)) +#define _WDTCR_READ(val) asm volatile ("mrc p6, 0, %0, c7, c1, 0" : "=r" (val)) +#define _WDTCR_WRITE(val) asm volatile ("mcr p6, 0, %0, c7, c1, 0" : : "r" (val)) + +static inline void TMR0_WRITE(cyg_uint32 val) { _TMR0_WRITE(val); } +static inline void TMR1_WRITE(cyg_uint32 val) { _TMR1_WRITE(val); } +static inline void TCR0_WRITE(cyg_uint32 val) { _TCR0_WRITE(val); } +static inline void TCR1_WRITE(cyg_uint32 val) { _TCR1_WRITE(val); } +static inline void TRR0_WRITE(cyg_uint32 val) { _TRR0_WRITE(val); } +static inline void TRR1_WRITE(cyg_uint32 val) { _TRR1_WRITE(val); } +static inline void TISR_WRITE(cyg_uint32 val) { _TISR_WRITE(val); } +#endif + +// -------------------------------------------------------------------------- +// Interrupts (Chapter 15) +#define INTCTL REG32_PTR(0xffffe7d0) +#define INTSTR REG32_PTR(0xffffe7d4) +#define IINTSRC REG32_PTR(0xffffe7d8) +#define FINTSRC REG32_PTR(0xffffe7dc) +#define PIRSR REG32_PTR(0xffffe1ec) + +#ifndef __ASSEMBLER__ +#define INTCTL_READ(val) asm volatile ("mrc p6, 0, %0, c0, c0, 0" : "=r" (val)) +#define _INTCTL_WRITE(val) asm volatile ("mcr p6, 0, %0, c0, c0, 0" : : "r" (val)) +#define INTSTR_READ(val) asm volatile ("mrc p6, 0, %0, c4, c0, 0" : "=r" (val)) +#define _INTSTR_WRITE(val) asm volatile ("mcr p6, 0, %0, c4, c0, 0" : : "r" (val)) +#define IINTSRC_READ(val) asm volatile ("mrc p6, 0, %0, c8, c0, 0" : "=r" (val)) +#define FINTSRC_READ(val) asm volatile ("mrc p6, 0, %0, c9, c0, 0" : "=r" (val)) + +static inline void INTCTL_WRITE(cyg_uint32 val) { _INTCTL_WRITE(val); } +static inline void INTSTR_WRITE(cyg_uint32 val) { _INTSTR_WRITE(val); } +#endif + +// -------------------------------------------------------------------------- +// GPIO (Chapter 15) +#define GPIO_GPOE REG8_PTR(0xffffe7c4) +#define GPIO_GPID REG8_PTR(0xffffe7c8) +#define GPIO_GPOD REG8_PTR(0xffffe7cc) + +#endif // CYGONCE_HAL_ARM_XSCALE_HAL_VERDE_H +// EOF hal_verde.h diff --git a/packages/hal/arm/xscale/verde/current/include/plf_stub.h b/packages/hal/arm/xscale/verde/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/verde/current/include/plf_stub.h @@ -0,0 +1,92 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors:jskov +// Travis C. Furrer +// Date: 2000-05-08 +// Purpose: Platform HAL stub support for Intel XScale boards. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include // CYG_UNUSED_PARAM + +#include // registers +#include // IO macros +#include // Interrupt macros +#include // architecture stub support + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +extern int cyg_hal_plf_hw_breakpoint(int setflag, void *addr, int len); +extern int cyg_hal_plf_hw_watchpoint(int setflag, void *addr, int len, int type); +extern int cyg_hal_plf_is_stopped_by_hardware(void **paddr); + +#define HAL_STUB_HW_BREAKPOINT(f,a,l) cyg_hal_plf_hw_breakpoint((f),(a),(l)) +#define HAL_STUB_HW_WATCHPOINT(f,a,l,t) cyg_hal_plf_hw_watchpoint((f),(a),(l),(t)) +#define HAL_STUB_IS_STOPPED_BY_HARDWARE(p) cyg_hal_plf_is_stopped_by_hardware(&(p)) + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/arm/xscale/verde/current/include/var_io.h b/packages/hal/arm/xscale/verde/current/include/var_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/verde/current/include/var_io.h @@ -0,0 +1,113 @@ +#ifndef CYGONCE_HAL_ARM_VERDE_VAR_IO_H +#define CYGONCE_HAL_ARM_VERDE_VAR_IO_H + +/*============================================================================= +// +// var_io.h +// +// Platform specific support (register layout, etc) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-28 +// Purpose: Platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +//----------------------------------------------------------------------------- + +extern cyg_uint32 cyg_hal_plf_pci_cfg_read_dword (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset); +extern cyg_uint16 cyg_hal_plf_pci_cfg_read_word (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset); +extern cyg_uint8 cyg_hal_plf_pci_cfg_read_byte (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset); +extern void cyg_hal_plf_pci_cfg_write_dword (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint32 val); +extern void cyg_hal_plf_pci_cfg_write_word (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint16 val); +extern void cyg_hal_plf_pci_cfg_write_byte (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint8 val); + +// Read a value from the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +#define HAL_PCI_CFG_READ_UINT8( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_plf_pci_cfg_read_byte((__bus), (__devfn), (__offset)) + +#define HAL_PCI_CFG_READ_UINT16( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_plf_pci_cfg_read_word((__bus), (__devfn), (__offset)) + +#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_plf_pci_cfg_read_dword((__bus), (__devfn), (__offset)) + +// Write a value to the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +#define HAL_PCI_CFG_WRITE_UINT8( __bus, __devfn, __offset, __val ) \ + cyg_hal_plf_pci_cfg_write_byte((__bus), (__devfn), (__offset), (__val)) + +#define HAL_PCI_CFG_WRITE_UINT16( __bus, __devfn, __offset, __val ) \ + cyg_hal_plf_pci_cfg_write_word((__bus), (__devfn), (__offset), (__val)) + +#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \ + cyg_hal_plf_pci_cfg_write_dword((__bus), (__devfn), (__offset), (__val)) + + +// Memory mapping details +#ifndef CYGARC_PHYSICAL_ADDRESS +# define CYGARC_PHYSICAL_ADDRESS(x) (((unsigned long)x & 0x1FFFFFFF) + SDRAM_PHYS_BASE) +#endif + + +#endif // CYGONCE_HAL_ARM_VERDE_VAR_IO_H +// EOF var_io.h diff --git a/packages/hal/arm/xscale/verde/current/src/verde_misc.c b/packages/hal/arm/xscale/verde/current/src/verde_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/verde/current/src/verde_misc.c @@ -0,0 +1,628 @@ +//========================================================================== +// +// verde_misc.c +// +// HAL misc board support code for Intel Verde I/O Coprocessor +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-12-03 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include +#include CYGBLD_HAL_PLATFORM_H +#include CYGHWR_MEMORY_LAYOUT_H + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // IO macros +#include // Stub macros +#include // calling interface API +#include // Register state info +#include +#include // Interrupt names +#include +#include +#include // diag_printf +#include // CYG_ISR_HANDLED + +// Most initialization has already been done before we get here. +// All we do here is set up the interrupt environment. +// FIXME: some of the stuff in hal_platform_setup could be moved here. + +externC void plf_hardware_init(void); + +static cyg_uint32 mcu_ISR(cyg_vector_t vector, cyg_addrword_t data); + +void +hal_hardware_init(void) +{ + // Initialize debug control unit to sane state + asm volatile ("mov r0,#0\n" + "mcr p15,0,r0,c14,c8,0\n" // ibcr0 + "mcr p15,0,r0,c14,c9,0\n" // ibcr1 + "mcr p15,0,r0,c14,c4,0\n" // dbcon + "mov r0,#0x80000000\n" + "mcr p14,0,r0,c10,c0,0\n" // dcsr + : /* no outputs */ + : /* no inputs */ + : "r0" ); + + // Perform any platform specific initializations + plf_hardware_init(); + + // Let the timer run at a default rate (for delays) + hal_clock_initialize(CYGNUM_HAL_RTC_PERIOD); + + // Set up eCos/ROM interfaces + hal_if_init(); + + // Enable caches + HAL_DCACHE_ENABLE(); + HAL_ICACHE_ENABLE(); + + // attach interrupt handlers for MCU errors + HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_MCU_ERR, &mcu_ISR, CYGNUM_HAL_INTERRUPT_MCU_ERR, 0); + HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_MCU_ERR); +} + +// ------------------------------------------------------------------------- +// This routine is called to respond to a hardware interrupt (IRQ). It +// should interrogate the hardware and return the IRQ vector number. + +int +hal_IRQ_handler(void) +{ + cyg_uint32 sources, mask; + int index; + + INTCTL_READ(mask); + IINTSRC_READ(sources); + + sources &= mask; // just the unmasked ones + + if (sources) { + HAL_LSBIT_INDEX( index, sources ); + return index; + } + return CYGNUM_HAL_INTERRUPT_NONE; // This shouldn't happen! +} + +static inline void +_scrub_ecc(unsigned p) +{ + asm volatile ("ldrb r4, [%0]\n" + "strb r4, [%0]\n" : : "r"(p) : "r4"); +} + +static cyg_uint32 +mcu_ISR(cyg_vector_t vector, cyg_addrword_t data) +{ + cyg_uint32 eccr_reg, mcisr_reg; + + // Read current state of ECC register + eccr_reg = *MCU_ECCR; + + // and the interrupt status + mcisr_reg = *MCU_MCISR; + + // Turn off all ecc error reporting + *MCU_ECCR = 0xc; + +#ifdef DEBUG_ECC + diag_printf("mcu_ISR entry: ECCR = 0x%X, MCISR = 0x%X\n", eccr_reg, mcisr_reg); +#endif + + // Check for ECC Error 0 + if(mcisr_reg & 1) { + +#ifdef DEBUG_ECC + diag_printf("ELOG0 = 0x%X\n", *MCU_ELOG0); + diag_printf("ECC Error Detected at Address 0x%X\n",*MCU_ECAR0); +#endif + + // Check for single-bit error + if(!(*MCU_ELOG0 & 0x00000100)) { + // call ECC restoration function + _scrub_ecc((*MCU_ECAR0 - SDRAM_PHYS_BASE) + SDRAM_UNCACHED_BASE); + + // Clear the MCISR + *MCU_MCISR = 1; + } else { +#ifdef DEBUG_ECC + diag_printf("Multi-bit or nibble error\n"); +#endif + } + } + + // Check for ECC Error 1 + if(mcisr_reg & 2) { + +#ifdef DEBUG_ECC + diag_printf("ELOG1 = 0x%X\n",*MCU_ELOG1); + diag_printf("ECC Error Detected at Address 0x%X\n",*MCU_ECAR1); +#endif + + // Check for single-bit error + if(!(*MCU_ELOG1 & 0x00000100)) { + // call ECC restoration function + _scrub_ecc((*MCU_ECAR1 - SDRAM_PHYS_BASE) + SDRAM_UNCACHED_BASE); + + // Clear the MCISR + *MCU_MCISR = 2; + } + else { +#ifdef DEBUG_ECC + diag_printf("Multi-bit or nibble error\n"); +#endif + } + } + + // Check for ECC Error N + if(mcisr_reg & 4) { + // Clear the MCISR + *MCU_MCISR = 4; + diag_printf("Uncorrectable error during RMW\n"); + } + + // Restore ECCR register + *MCU_ECCR = eccr_reg; + +#ifdef DEBUG_ECC + diag_printf("mcu_ISR exit: MCISR = 0x%X\n", *MCU_MCISR); +#endif + + return CYG_ISR_HANDLED; +} + +// +// Interrupt control +// + +void +hal_interrupt_mask(int vector) +{ + if (vector <= CYGNUM_HAL_INTERRUPT_HPI) { + int mask; + + INTCTL_READ(mask); + mask &= ~(1 << vector); + INTCTL_WRITE(mask); + CPWAIT(); + } +} + +void +hal_interrupt_unmask(int vector) +{ + if (vector <= CYGNUM_HAL_INTERRUPT_HPI) { + int mask; + + INTCTL_READ(mask); + mask |= (1 << vector); + INTCTL_WRITE(mask); + CPWAIT(); + } +} + +void +hal_interrupt_acknowledge(int vector) +{ + // If this is a timer interrupt, write a 1 to the appropriate bit + // in the TISR register. + if( vector == CYGNUM_HAL_INTERRUPT_TIMER0 || + vector == CYGNUM_HAL_INTERRUPT_TIMER1 ) + { + TISR_WRITE(1<<(vector-CYGNUM_HAL_INTERRUPT_TIMER0)); + } +} + + +void hal_interrupt_configure(int vector, int level, int up) +{ +} + +void hal_interrupt_set_level(int vector, int level) +{ +} + + +/*------------------------------------------------------------------------*/ +// RTC Support + +static cyg_uint32 _period; + +#define CLOCK_MULTIPLIER 200 + +void +hal_clock_initialize(cyg_uint32 period) +{ + cyg_uint32 val; + cyg_uint32 tmr_period; + _period = period; + + tmr_period = period * CLOCK_MULTIPLIER; + + // disable timer + TMR0_WRITE(0); + + // clear interrupts + TISR_WRITE(1); + + // set reload/count value + TRR0_WRITE(tmr_period); + TCR0_WRITE(tmr_period); + + // let it run + TMR0_WRITE(TMR_ENABLE | TMR_RELOAD | TMR_CLK_1); + + TMR0_READ(val); +} + + +// Dynamically set the timer interrupt rate. +// Not for eCos application use at all, just special GPROF code in RedBoot. + +void +hal_clock_reinitialize( int *pfreq, /* inout */ + unsigned int *pperiod, /* inout */ + unsigned int old_hz ) /* in */ +{ + unsigned int newp = 0, period, i = 0; + int hz; + int do_set_hw; + +// Arbitrary choice somewhat - so the CPU can make +// progress with the clock set like this, we hope. +#define MIN_TICKS (2000) +#define MAX_TICKS N/A: 32-bit counter + + if ( ! pfreq || ! pperiod ) + return; // we cannot even report a problem! + + hz = *pfreq; + period = *pperiod; + +// Requested HZ: +// 0 => tell me the current value (no change, implemented in caller) +// - 1 => tell me the slowest (no change) +// - 2 => tell me the default (no change, implemented in caller) +// -nnn => tell me what you would choose for nnn (no change) +// MIN_INT => tell me the fastest (no change) +// +// 1 => tell me the slowest (sets the clock) +// MAX_INT => tell me the fastest (sets the clock) + + do_set_hw = (hz > 0); + if ( hz < 0 ) + hz = -hz; + + // Be paranoid about bad args, and very defensive about underflows + if ( 0 < hz && 0 < period && 0 < old_hz ) { + + newp = period * old_hz / (unsigned)hz; + + if ( newp < MIN_TICKS ) { + newp = MIN_TICKS; + // recalculate to get the exact delay for this integral hz + // and hunt hz down to an acceptable value if necessary + i = period * old_hz / newp; + if ( i ) do { + newp = period * old_hz / i; + i--; + } while (newp < MIN_TICKS && i); + } + // So long as period * old_hz fits in 32 bits, there is no need to + // worry about overflow; hz >= 1 in the initial divide. If the + // clock cannot do a whole second (period * old_hz >= 2^32), we + // will get overflow here, and random returned HZ values. + + // Recalculate the actual value installed. + i = period * old_hz / newp; + } + + *pfreq = i; + *pperiod = newp; + + if ( do_set_hw ) { + hal_clock_initialize( newp ); + } +} + +// This routine is called during a clock interrupt. +void +hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ +} + +// Read the current value of the clock, returning the number of hardware +// "ticks" that have occurred (i.e. how far away the current value is from +// the start) +void +hal_clock_read(cyg_uint32 *pvalue) +{ + cyg_uint32 timer_val; + + TCR0_READ(timer_val); + + // Translate timer value back into microseconds + + timer_val /= CLOCK_MULTIPLIER; + + *pvalue = _period - timer_val; +} + +// Delay for some usecs. +void +hal_delay_us(cyg_int32 delay) +{ +#define _TICKS_PER_USEC CLOCK_MULTIPLIER + cyg_uint32 now, prev, diff, usecs; + cyg_uint32 tmr_period = _period * CLOCK_MULTIPLIER; + + diff = usecs = 0; + TCR0_READ(prev); + + while (delay > usecs) { + TCR0_READ(now); + + if (prev < now) + diff += (prev + (tmr_period - now)); + else + diff += (prev - now); + + prev = now; + + if (diff >= _TICKS_PER_USEC) { + usecs += (diff / _TICKS_PER_USEC); + diff %= _TICKS_PER_USEC; + } + } +} + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +/*------------------------------------------------------------------------*/ +// HW Debug support + +static inline void set_ibcr0(unsigned x) +{ + asm volatile ("mcr p15,0,%0,c14,c8,0" : : "r"(x) ); +} + +static inline unsigned get_ibcr0(void) +{ + unsigned x; + asm volatile ("mrc p15,0,%0,c14,c8,0" : "=r"(x) : ); + return x; +} + +static inline void set_ibcr1(unsigned x) +{ + asm volatile ("mcr p15,0,%0,c14,c9,0" : : "r"(x) ); +} + +static inline unsigned get_ibcr1(void) +{ + unsigned x; + asm volatile ("mrc p15,0,%0,c14,c9,0" : "=r"(x) : ); + return x; +} + +static inline void set_dbr0(unsigned x) +{ + asm volatile ("mcr p15,0,%0,c14,c0,0" : : "r"(x) ); +} + +static inline unsigned get_dbr0(void) +{ + unsigned x; + asm volatile ("mrc p15,0,%0,c14,c0,0" : "=r"(x) : ); + return x; +} + +static inline void set_dbr1(unsigned x) +{ + asm volatile ("mcr p15,0,%0,c14,c3,0" : : "r"(x) ); +} + +static inline unsigned get_dbr1(void) +{ + unsigned x; + asm volatile ("mrc p15,0,%0,c14,c3,0" : "=r"(x) : ); + return x; +} + +static inline void set_dbcon(unsigned x) +{ + asm volatile ("mcr p15,0,%0,c14,c4,0" : : "r"(x) ); +} + +static inline unsigned get_dbcon(void) +{ + unsigned x; + asm volatile ("mrc p15,0,%0,c14,c4,0" : "=r"(x) : ); + return x; +} + +static inline void set_dcsr(unsigned x) +{ + asm volatile ("mcr p14,0,%0,c10,c0,0" : : "r"(x) ); +} + +static inline unsigned get_dcsr(void) +{ + unsigned x; + asm volatile ("mrc p14,0,%0,c10,c0,0" : "=r"(x) : ); + return x; +} + +int cyg_hal_plf_hw_breakpoint(int setflag, void *vaddr, int len) +{ + unsigned int addr = (unsigned)vaddr; + + if (setflag) { + if (!(get_ibcr0() & 1)) + set_ibcr0(addr | 1); + else if (!(get_ibcr1() & 1)) + set_ibcr1(addr | 1); + else + return -1; + } else { + unsigned x = (addr | 1); + if (get_ibcr0() == x) + set_ibcr0(0); + else if (get_ibcr1() == x) + set_ibcr1(0); + else + return -1; + } + + return 0; +} + +int cyg_hal_plf_hw_watchpoint(int setflag, void *vaddr, int len, int type) +{ + unsigned int mode, addr = (unsigned)vaddr; + unsigned dbcon = get_dbcon(); +#ifndef USE_TWO_WATCHPOINTS + unsigned int mask, bit_nr; + + mask = 0x80000000; + bit_nr = 31; + while (bit_nr) { + if (len & mask) + break; + bit_nr--; + mask >>= 1; + } + mask = ~(0xffffffff << bit_nr); +#endif + + if (setflag) { + /* set a watchpoint */ + if (type == 2) + mode = 1; // break on write + else if (type == 3) + mode = 3; // break on read + else if (type == 4) + mode = 2; // break on any access + else + return 1; + +#ifndef USE_TWO_WATCHPOINTS + mode |= 0x100; +#endif + + if (!(dbcon & 3)) { + set_dbr0(addr); +#ifndef USE_TWO_WATCHPOINTS + set_dbr1(mask); +#endif + set_dbcon(dbcon | mode); +#ifdef USE_TWO_WATCHPOINTS + } else if (!(dbcon & (3 << 2))) { + set_dbr1(addr); + set_dbcon(dbcon | (mode << 2)); +#endif + } else + return 1; + + } else { + /* clear a watchpoint */ + if ((dbcon & 3) && get_dbr0() == addr) + set_dbcon(dbcon & ~3); +#ifdef USE_TWO_WATCHPOINTS + else if ((dbcon & (3 << 2)) && get_dbr1() == addr) + set_dbcon(dbcon & ~(3 << 2)); +#endif + else + return 1; + } + return 0; +} + +// Return indication of whether or not we stopped because of a +// watchpoint or hardware breakpoint. If stopped by a watchpoint, +// also set '*data_addr_p' to the data address which triggered the +// watchpoint. +int cyg_hal_plf_is_stopped_by_hardware(void **data_addr_p) +{ + unsigned fsr, dcsr, dbcon, kind = 0; + + // Check for debug event + asm volatile ("mrc p15,0,%0,c5,c0,0" : "=r"(fsr) : ); + if ((fsr & 0x200) == 0) + return HAL_STUB_HW_STOP_NONE; + + // There was a debug event. Check the MOE for details + dcsr = get_dcsr(); + switch ((dcsr >> 2) & 7) { + case 1: // HW breakpoint + case 3: // BKPT breakpoint + return HAL_STUB_HW_STOP_BREAK; + case 2: // Watchpoint + dbcon = get_dbcon(); + if ((kind = (dbcon & 3)) != 0) + *data_addr_p = (void *)get_dbr0(); + else if (!(dbcon & 0x100) && (kind = (dbcon & (3 << 2))) != 0) + *data_addr_p = (void *)get_dbr1(); + if (kind == 1) + return HAL_STUB_HW_STOP_WATCH; + if (kind == 2) + return HAL_STUB_HW_STOP_AWATCH; + if (kind == 3) + return HAL_STUB_HW_STOP_RWATCH; + // should never get here + break; + } + return HAL_STUB_HW_STOP_NONE; +} +#endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +/*------------------------------------------------------------------------*/ +// EOF verde_misc.c + diff --git a/packages/hal/arm/xscale/verde/current/src/verde_pci.c b/packages/hal/arm/xscale/verde/current/src/verde_pci.c new file mode 100644 --- /dev/null +++ b/packages/hal/arm/xscale/verde/current/src/verde_pci.c @@ -0,0 +1,273 @@ +//========================================================================== +// +// verde_pci.c +// +// HAL support code for Verde PCI +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2002-01-30 +// Purpose: PCI support +// Description: Implementations of HAL PCI interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // IO macros +#include // calling interface API +#include // Register state info +#include +#include // Interrupt names +#include +#include +#include + +#ifdef CYGPKG_IO_PCI + +// Use "naked" attribute to suppress C prologue/epilogue +// This is a data abort handler which simply returns. Data aborts +// occur during configuration cycles if no device is present. +static void __attribute__ ((naked)) +__pci_abort_handler(void) +{ + asm ( "subs pc, lr, #4\n" ); +} + +static cyg_uint32 orig_abort_vec; + +#define DEBUG_CONFIG_VERBOSE 0 + +static inline void +pci_config_setup(cyg_uint32 bus, cyg_uint32 devfn, cyg_uint32 offset) +{ + cyg_uint32 dev = CYG_PCI_DEV_GET_DEV(devfn); + cyg_uint32 fn = CYG_PCI_DEV_GET_FN(devfn); + cyg_uint8 localbus; + + localbus = (*ATU_PCIXSR >> 8) & 0xff; + if (localbus == 0xff) + localbus = 0; + + /* Offsets must be dword-aligned */ + offset &= ~3; + + /* Immediate bus use type 0 config, all others use type 1 config */ +#if DEBUG_CONFIG_VERBOSE + diag_printf("config: localbus[%d] bus[%d] dev[%d] fn[%d] offset[0x%x]\n", + localbus, bus, dev, fn, offset); +#endif + + if (bus == localbus) + *ATU_OCCAR = ( (1 << (dev + 16)) | (fn << 8) | offset | 0 ); + else + *ATU_OCCAR = ( (bus << 16) | (dev << 11) | (fn << 8) | offset | 1 ); + + orig_abort_vec = ((volatile cyg_uint32 *)0x20)[4]; + ((volatile unsigned *)0x20)[4] = (unsigned)__pci_abort_handler; +} + +static inline int +pci_config_cleanup(cyg_uint32 bus) +{ + cyg_uint32 status = 0, err = 0; + + status = *ATU_ATUSR; + if ((status & 0xF900) != 0) { + err = 1; + *ATU_ATUSR = status & 0xF900; + } + + ((volatile unsigned *)0x20)[4] = orig_abort_vec; + + return err; +} + + +cyg_uint32 +cyg_hal_plf_pci_cfg_read_dword (cyg_uint32 bus, cyg_uint32 devfn, cyg_uint32 offset) +{ + cyg_uint32 config_data; + int err; + + pci_config_setup(bus, devfn, offset); + + config_data = *ATU_OCCDR; + + err = pci_config_cleanup(bus); + +#if DEBUG_CONFIG_VERBOSE + diag_printf("config read dword: data[0x%x] err[%d]\n", + config_data, err); +#endif + if (err) + return 0xffffffff; + else + return config_data; +} + + +void +cyg_hal_plf_pci_cfg_write_dword (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint32 data) +{ + int err; + + pci_config_setup(bus, devfn, offset); + + *ATU_OCCDR = data; + + err = pci_config_cleanup(bus); + +#if DEBUG_CONFIG_VERBOSE + diag_printf("config write dword: data[0x%x] err[%d]\n", + data, err); +#endif +} + + +cyg_uint16 +cyg_hal_plf_pci_cfg_read_word (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset) +{ + cyg_uint16 config_data; + int err; + + pci_config_setup(bus, devfn, offset & ~3); + + config_data = (cyg_uint16)(((*ATU_OCCDR) >> ((offset % 0x4) * 8)) & 0xffff); + + err = pci_config_cleanup(bus); + +#if DEBUG_CONFIG_VERBOSE + diag_printf("config read word: data[0x%x] err[%d]\n", + config_data, err); +#endif + if (err) + return 0xffff; + else + return config_data; +} + +void +cyg_hal_plf_pci_cfg_write_word (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint16 data) +{ + int err; + cyg_uint32 mask, temp; + + pci_config_setup(bus, devfn, offset & ~3); + + mask = ~(0x0000ffff << ((offset % 0x4) * 8)); + + temp = (cyg_uint32)(((cyg_uint32)data) << ((offset % 0x4) * 8)); + *ATU_OCCDR = (*ATU_OCCDR & mask) | temp; + + err = pci_config_cleanup(bus); + +#if DEBUG_CONFIG_VERBOSE + diag_printf("config write word: data[0x%x] err[%d]\n", + data, err); +#endif +} + +cyg_uint8 +cyg_hal_plf_pci_cfg_read_byte (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset) +{ + int err; + cyg_uint8 config_data; + + pci_config_setup(bus, devfn, offset & ~3); + + config_data = (cyg_uint8)(((*ATU_OCCDR) >> ((offset % 0x4) * 8)) & 0xff); + + err = pci_config_cleanup(bus); + +#if DEBUG_CONFIG_VERBOSE + diag_printf("config read byte: data[0x%x] err[%d]\n", + config_data, err); +#endif + if (err) + return 0xff; + else + return config_data; +} + + +void +cyg_hal_plf_pci_cfg_write_byte (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint8 data) +{ + int err; + cyg_uint32 mask, temp; + + pci_config_setup(bus, devfn, offset & ~3); + + mask = ~(0x000000ff << ((offset % 0x4) * 8)); + temp = (cyg_uint32)(((cyg_uint32)data) << ((offset % 0x4) * 8)); + *ATU_OCCDR = (*ATU_OCCDR & mask) | temp; + + err = pci_config_cleanup(bus); + +#if DEBUG_CONFIG_VERBOSE + diag_printf("config write byte: data[0x%x] err[%d]\n", + data, err); +#endif +} + +#endif // CYGPKG_IO_PCI + + diff --git a/packages/hal/calmrisc16/arch/current/ChangeLog b/packages/hal/calmrisc16/arch/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/ChangeLog @@ -0,0 +1,57 @@ +2002-04-15 Jonathan Larmour + + * src/hal_syscall.c (hal_syscall_handler): Add extra sig argument to + __do_syscall. + +2001-11-16 Nick Garnett + + * src/hal_misc.c (hal_msbit_index): Fixed this function so that it + actually works! + +2001-06-08 Jonathan Larmour + + * include/hal_cache.h: Correctly indicate absence of cache. + +2001-05-03 Mark Salter + + * src/vectors.S: Removed unneeded debugging functions. Fixed + register save/restore. + + * src/calm16-stub.c: Remove unneeded {get,put}_register functions. + + * include/calm16-stub.h: Clean out some cruft. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/calmrisc16/arch/current/cdl/hal_calm16.cdl b/packages/hal/calmrisc16/arch/current/cdl/hal_calm16.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/cdl/hal_calm16.cdl @@ -0,0 +1,101 @@ +# ==================================================================== +# +# hal_calm16.cdl +# +# CalmRISC16 architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): msalter +# Original data: bartv, nickg +# Contributors: +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_CALM16 { + display "CalmRISC16 architecture" + parent CYGPKG_HAL + hardware + include_dir cyg/hal + define_header hal_calm16.h + description " + The CalmRISC16 architecture HAL package provides generic support + for this processor architecture. It is also necessary to + select a CPU variant and a specific target platform HAL + package." + + cdl_interface CYGINT_HAL_CALM16_VARIANT { + display "Number of variant implementations in this configuration" + requires 1 == CYGINT_HAL_CALM16_VARIANT + } + + compile hal_misc.c context.S calm16-stub.c hal_syscall.c + + make { + /lib/vectors.o : /src/vectors.S + $(CC) -Wp,-MD,vectors.tmp $(INCLUDE_PATH) $(CFLAGS) -c -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 vectors.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm vectors.tmp + } + + cdl_option CYGHWR_HAL_CALM16_CPU_FREQ { + display "CPU frequency" + flavor data + legal_values 0 to 1000000 + default_value 50 + description " + This option contains the frequency of the CPU in MegaHertz. + Choose the frequency to match the processor you have. This + may affect thing like serial device, interval clock and + memory access speed settings." + } + + cdl_option CYGDBG_HAL_CALM16_DEBUG_GDB_CTRLC_SUPPORT { + display "Architecture GDB CTRLC support" + calculated { CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT || CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT } + active_if { CYGINT_HAL_DEBUG_GDB_CTRLC_UNSUPPORTED == 0 } + description " + If either the CTRLC or BREAK support options in hal.h are set + then set our own option to turn on shared generic support for + control C handling." + } +} diff --git a/packages/hal/calmrisc16/arch/current/include/arch.inc b/packages/hal/calmrisc16/arch/current/include/arch.inc new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/include/arch.inc @@ -0,0 +1,157 @@ +#ifndef CYGONCE_HAL_ARCH_INC +#define CYGONCE_HAL_ARCH_INC +##============================================================================= +## +## arch.inc +## +## CalmRISC16 assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: nickg, dmoseley +## Date: 1997-10-16 +## Purpose: Architecture definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the CalmRISC16 CPU family. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include + +##----------------------------------------------------------------------------- +## CalmRISC16 thread and interrupt saved state. This must match the layout of +## the HAL_SavedRegisters in hal_arch.h. Do not change this without changing +## the layout there, or viceversa. + + +##----------------------------------------------------------------------------- +## CPU specific macros. These provide a common assembler interface to +## operations that may have CPU specific implementations on different +## variants of the architecture. + + # Initialize CPU + .macro hal_cpu_init + .endm + + # Enable interrupts + .macro hal_cpu_int_enable + .endm + + # Disable interrupts + .macro hal_cpu_int_disable + .endm + +#------------------------------------------------------------------------------ +# MMU macros. + +#ifndef CYGPKG_HAL_CALM16_MMU_DEFINED + + .macro hal_mmu_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# MEMC macros. + +#ifndef CYGPKG_HAL_CALM16_MEMC_DEFINED + + .macro hal_memc_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# Cache macros. + +#ifndef CYGPKG_HAL_CALM16_CACHE_DEFINED + + .macro hal_cache_init + .endm +#endif + + +#------------------------------------------------------------------------------ +# Diagnostics macros. + +#ifndef CYGPKG_HAL_CALM16_DIAG_DEFINED + + .macro hal_diag_init + .endm + + .macro hal_diag_excpt_start + .endm + + .macro hal_diag_intr_start + .endm + + .macro hal_diag_restore + .endm +#endif + +#------------------------------------------------------------------------------ +# Timer initialization. + +#ifndef CYGPKG_HAL_CALM16_TIMER_DEFINED + + .macro hal_timer_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# Monitor initialization. + +#ifndef CYGPKG_HAL_CALM16_MON_DEFINED + + .macro hal_mon_init + .endm + +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_ARCH_INC +# end of arch.inc diff --git a/packages/hal/calmrisc16/arch/current/include/basetype.h b/packages/hal/calmrisc16/arch/current/include/basetype.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/include/basetype.h @@ -0,0 +1,78 @@ +#ifndef CYGONCE_HAL_BASETYPE_H +#define CYGONCE_HAL_BASETYPE_H + +//============================================================================= +// +// basetype.h +// +// Standard types for this architecture. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, msalter +// Date: 1998-02-05 +// Purpose: Define architecture base types. +// Usage: Included by , do not use directly +// +//####DESCRIPTIONEND#### +// + +#include + +//----------------------------------------------------------------------------- +// Characterize the architecture + +#define CYG_BYTEORDER CYG_MSBFIRST // Big endian + + + +//----------------------------------------------------------------------------- +// CalmRISC16 toolchain uses labels with undersores. + +#define CYG_LABEL_DEFN(_name_) _##_name_ + +//----------------------------------------------------------------------------- +// Define the standard variable sizes + +#define cyg_halint16 int +#define cyg_halint32 long +#define cyg_halcount32 long + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_BASETYPE_H +// End of basetype.h diff --git a/packages/hal/calmrisc16/arch/current/include/calm16-regs.h b/packages/hal/calmrisc16/arch/current/include/calm16-regs.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/include/calm16-regs.h @@ -0,0 +1,78 @@ +#ifndef CYGONCE_HAL_CALM16_REGS_H +#define CYGONCE_HAL_CALM16_REGS_H +//======================================================================== +// +// calm16-regs.h +// +// Register defines for CalmRISC 16 processors +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Red Hat, msalter +// Contributors: Red Hat, msalter +// Date: 2001-02-12 +// Purpose: +// Description: Register defines for CalmRISC 16 processors +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#include + +#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS + +// This value must agree with NUMREGS in calm16-stub.h. + +#define NUM_REGS 23 + +#define REG_SIZE 4 + +// Status register fields +#define SR_T 0x8000 // TRUE flag +#define SR_PM 0x0040 // Privilege Mode +#define SR_Z1 0x0020 // R7 Zero flag. +#define SR_Z0 0x0010 // R6 Zero flag +#define SR_V 0x0008 // Overflow flag +#define SR_TE 0x0004 // Trace Enable +#define SR_IE 0x0002 // IRQ Enable +#define SR_FE 0x0001 // FIQ Enable + +#endif // ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS + +#endif // ifndef CYGONCE_HAL_CALM16_REGS_H diff --git a/packages/hal/calmrisc16/arch/current/include/calm16-stub.h b/packages/hal/calmrisc16/arch/current/include/calm16-stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/include/calm16-stub.h @@ -0,0 +1,156 @@ +#ifndef CYGONCE_HAL_MIPS_STUB_H +#define CYGONCE_HAL_MIPS_STUB_H +//======================================================================== +// +// mips-stub.h +// +// CalmRISC16-specific definitions for generic stub +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Red Hat, msalter +// Contributors: Red Hat, msalter +// Date: 2001-02-12 +// Purpose: +// Description: CalmRISC16-specific definitions for generic stub +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TARGET_HAS_HARVARD_MEMORY 1 +typedef unsigned long target_addr_t; +#define TARGET_ADDR_IS_PROGMEM(x) (((unsigned long)(x)) >= 0x400000UL) +#define TARGET_ADDR_TO_PTR(x) ((char *) (((unsigned long)(x)) & 0x3fffff)) + +#define NUMREGS 39 + +typedef unsigned long target_register_t; + +enum regnames { + REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7, + REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, + REG_E8, REG_E9, REG_E10, REG_E11, REG_E12, REG_E13, REG_E14, REG_E15, + REG_A8, REG_A9, REG_A10, REG_A11, REG_A12, REG_A13, REG_A14, REG_A15, + REG_PC, REG_SPC_FIQ, REG_SPC_IRQ, + REG_SR, REG_SSR_FIQ, REG_SSR_IRQ, REG_SSR_SWI +}; + +#define REG_LR REG_A14 +#define REG_SP REG_A15 + +#define PC REG_PC +#define SP REG_A15 + +#define REGSIZE(X) 4 +#define REGBYTE(X) ((X)*4) + +typedef enum regnames regnames_t; + +/* Given a trap value TRAP, return the corresponding signal. */ +extern int __computeSignal (unsigned int trap_number); + +/* Return the SPARC trap number corresponding to the last-taken trap. */ +extern int __get_trap_number (void); + +/* Return the currently-saved value corresponding to register REG. */ +extern target_register_t get_register (regnames_t reg); + +/* Store VALUE in the register corresponding to WHICH. */ +extern void put_register (regnames_t which, target_register_t value); + +/* Set the currently-saved pc register value to PC. This also updates NPC + as needed. */ +#if !defined(SET_PC_PROTOTYPE_EXISTS) && !defined(set_pc) +#define SET_PC_PROTOTYPE_EXISTS +extern void set_pc (target_register_t pc); +#endif + +/* Set things up so that the next user resume will execute one instruction. + This may be done by setting breakpoints or setting a single step flag + in the saved user registers, for example. */ +#ifndef __single_step +void __single_step (void); +#endif + +/* Clear the single-step state. */ +void __clear_single_step (void); + +extern int __is_bsp_syscall(void); + +extern int hal_syscall_handler(void); + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ +#ifndef __is_breakpoint_function +extern int __is_breakpoint_function (void); +#endif + +/* Skip the current instruction. */ +extern void __skipinst (void); + +extern void __install_breakpoints (void); + +extern void __clear_breakpoints (void); + +extern void __install_breakpoint_list (void); + +extern void __clear_breakpoint_list (void); + +extern unsigned char __read_prog_uint8(void *addr); +extern unsigned short __read_prog_uint16(void *addr); +extern unsigned long __read_prog_uint32(void *addr); + +extern void __write_prog_uint8(void *addr, unsigned char val); +extern void __write_prog_uint16(void *addr, unsigned short val); +extern void __write_prog_uint32(void *addr, unsigned long val); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // ifndef CYGONCE_HAL_MIPS_STUB_H diff --git a/packages/hal/calmrisc16/arch/current/include/calm16.inc b/packages/hal/calmrisc16/arch/current/include/calm16.inc new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/include/calm16.inc @@ -0,0 +1,94 @@ +#ifndef CYGONCE_HAL_CALM16_INC +#define CYGONCE_HAL_CALM16_INC + +##============================================================================= +## +## calm16.inc +## +## CalmRISC16 assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: CalmRISC16 definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the MIPS CPU family. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + + +#------------------------------------------------------------------------------ + +#ifdef __USER_LABEL_PREFIX__ +#define __GLUE(a,b) a##b +#define _GLUE(a,b) __GLUE(a,b) +#define SYM_NAME(x) _GLUE(_,x) + +.macro FUNC_START name + .type _\name,@function + .globl _\name +_\name: +.endm + +.macro FUNC_END name +_\name\(_end): +.endm +#else +#define SYM_NAME(x) x +.macro FUNC_START name + .type \name,@function + .globl \name +\name: +.endm + +.macro FUNC_END name +\name\(_end): +.endm +#endif + + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_CALM16_INC +# end of calm16.inc diff --git a/packages/hal/calmrisc16/arch/current/include/hal_arch.h b/packages/hal/calmrisc16/arch/current/include/hal_arch.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/include/hal_arch.h @@ -0,0 +1,345 @@ +#ifndef CYGONCE_HAL_HAL_ARCH_H +#define CYGONCE_HAL_HAL_ARCH_H + +//========================================================================== +// +// hal_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-02-17 +// Purpose: Define architecture abstractions +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#ifndef __ASSEMBLER__ +#include +#include + +#include + +//-------------------------------------------------------------------------- +// Processor saved states: +// The layout of this structure is also defined in "arch.inc", for assembly +// code. Do not change this without changing that (or vice versa). +// Notes: This structure is carefully laid out. It is a multiple of 8 +// bytes and the pc and badvr fields are positioned to ensure that +// they are on 8 byte boundaries. + + +typedef struct +{ + CYG_WORD16 vector; + CYG_WORD32 spc_fiq; + CYG_WORD32 spc_irq; + CYG_WORD16 ssr_fiq; + CYG_WORD16 ssr_irq; + CYG_WORD16 ssr_swi; + CYG_WORD16 r[8]; + CYG_WORD32 a[8]; +} HAL_SavedRegisters; + +//-------------------------------------------------------------------------- +// Exception handling function. +// This function is defined by the kernel according to this prototype. It is +// invoked from the HAL to deal with any CPU exceptions that the HAL does +// not want to deal with itself. It usually invokes the kernel's exception +// delivery mechanism. + +externC void cyg_hal_deliver_exception( CYG_WORD code, CYG_ADDRWORD data ); + +//-------------------------------------------------------------------------- +// Bit manipulation macros + +externC cyg_uint32 hal_lsbit_index(cyg_uint32 mask); +externC cyg_uint32 hal_msbit_index(cyg_uint32 mask); + +#define HAL_LSBIT_INDEX(index, mask) index = hal_lsbit_index(mask); + +#define HAL_MSBIT_INDEX(index, mask) index = hal_msbit_index(mask); + +//-------------------------------------------------------------------------- +// Context Initialization + +// Optional FPU context initialization +#define HAL_THREAD_INIT_FPU_CONTEXT( _regs_, _id_ ) + +// Initialize the context of a thread. +// Arguments: +// _sparg_ name of variable containing current sp, will be written with new sp +// _thread_ thread object address, passed as argument to entry point +// _entry_ entry point address. +// _id_ bit pattern used in initializing registers, for debugging. +#define HAL_THREAD_INIT_CONTEXT( _sparg_, _thread_, _entry_, _id_ ) \ +{ \ +} + +//-------------------------------------------------------------------------- +// Context switch macros. +// The arguments are pointers to locations where the stack pointer +// of the current thread is to be stored, and from where the sp of the +// next thread is to be fetched. + +externC void hal_thread_switch_context( CYG_ADDRESS to, CYG_ADDRESS from ); +externC void hal_thread_load_context( CYG_ADDRESS to ) + __attribute__ ((noreturn)); + +#define HAL_THREAD_SWITCH_CONTEXT(_fspptr_,_tspptr_) \ + hal_thread_switch_context( (CYG_ADDRESS)_tspptr_, \ + (CYG_ADDRESS)_fspptr_); + +#define HAL_THREAD_LOAD_CONTEXT(_tspptr_) \ + hal_thread_load_context( (CYG_ADDRESS)_tspptr_ ); + +//-------------------------------------------------------------------------- +// Execution reorder barrier. +// When optimizing the compiler can reorder code. In multithreaded systems +// where the order of actions is vital, this can sometimes cause problems. +// This macro may be inserted into places where reordering should not happen. +// The "memory" keyword is potentially unnecessary, but it is harmless to +// keep it. + +#define HAL_REORDER_BARRIER() asm volatile ( "" : : : "memory" ) + +//-------------------------------------------------------------------------- +// Breakpoint support +// HAL_BREAKPOINT() is a code sequence that will cause a breakpoint to +// happen if executed. +// HAL_BREAKINST is the value of the breakpoint instruction and +// HAL_BREAKINST_SIZE is its size in bytes. +// HAL_BREAKINST_TYPE is the type. + +#define HAL_BREAKPOINT(_label_) \ +asm volatile (" .globl _" #_label_ "\n" \ + "_" #_label_":" \ + " break\n" \ + ); + +#define HAL_BREAKINST 0x9e99 +#define HAL_BREAKINST_SIZE 2 +#define HAL_BREAKINST_TYPE cyg_uint16 + +//-------------------------------------------------------------------------- +// Thread register state manipulation for GDB support. + +// Default to a 32 bit register size for GDB register dumps. +#ifndef CYG_HAL_GDB_REG +#define CYG_HAL_GDB_REG CYG_WORD32 +#endif + +// Translate a stack pointer as saved by the thread context macros above into +// a pointer to a HAL_SavedRegisters structure. +#define HAL_THREAD_GET_SAVED_REGISTERS( _sp_, _regs_ ) \ + (_regs_) = (HAL_SavedRegisters *)(_sp_) + +// Copy a set of registers from a HAL_SavedRegisters structure into a +// GDB ordered array. +#define HAL_GET_GDB_REGISTERS( _aregval_ , _regs_ ) \ +{ \ + CYG_HAL_GDB_REG *_regval_ = (CYG_HAL_GDB_REG *)(_aregval_); \ + int _i_; \ + \ + for( _i_ = 0; _i_ < 8; _i_++ ) \ + _regval_[_i_] = ((CYG_WORD32)((_regs_)->r[_i_])) << 16; \ + \ + for( _i_ = 0; _i_ < 8; _i_++ ) \ + _regval_[_i_+8] = ((_regs_)->a[_i_]) << 16; \ + \ + for( _i_ = 0; _i_ < 8; _i_++ ) \ + _regval_[_i_+16] = ((_regs_)->a[_i_]) & 0xffff0000UL; \ + \ + for( _i_ = 0; _i_ < 8; _i_++ ) \ + _regval_[_i_+24] = (_regs_)->a[_i_]; \ + \ + _regval_[REG_SSR_FIQ] = ((CYG_WORD32)((_regs_)->ssr_fiq)) << 16; \ + _regval_[REG_SSR_IRQ] = ((CYG_WORD32)((_regs_)->ssr_irq)) << 16; \ + _regval_[REG_SSR_SWI] = ((CYG_WORD32)((_regs_)->ssr_swi)) << 16; \ + _regval_[REG_SPC_FIQ] = (_regs_)->spc_fiq; \ + _regval_[REG_SPC_IRQ] = (_regs_)->spc_irq; \ + switch ((_regs_)->vector) { \ + case CYGNUM_HAL_VECTOR_SWI: \ + _regval_[REG_SR] = _regval_[REG_SSR_SWI]; \ + _regval_[REG_PC] = (_regs_)->a[6]; break; \ + case CYGNUM_HAL_VECTOR_FIQ: \ + _regval_[REG_SR] = _regval_[REG_SSR_FIQ]; \ + _regval_[REG_PC] = (_regs_)->spc_fiq; break; \ + default: \ + _regval_[REG_SR] = _regval_[REG_SSR_IRQ]; \ + _regval_[REG_PC] = (_regs_)->spc_irq; break; \ + } \ +} + +// Copy a GDB ordered array into a HAL_SavedRegisters structure. +#define HAL_SET_GDB_REGISTERS( _regs_ , _aregval_ ) \ +{ \ + CYG_HAL_GDB_REG *_regval_ = (CYG_HAL_GDB_REG *)(_aregval_); \ + int _i_; \ + \ + for( _i_ = 0; _i_ < 8; _i_++ ) \ + (_regs_)->r[_i_] = _regval_[_i_] >> 16; \ + \ + for( _i_ = 0; _i_ < 8; _i_++ ) \ + (_regs_)->a[_i_] = _regval_[_i_+24]; \ + \ + (_regs_)->ssr_fiq = _regval_[REG_SSR_FIQ] >> 16; \ + (_regs_)->ssr_irq = _regval_[REG_SSR_IRQ] >> 16; \ + (_regs_)->ssr_swi = _regval_[REG_SSR_SWI] >> 16; \ + (_regs_)->spc_fiq = _regval_[REG_SPC_FIQ]; \ + (_regs_)->spc_irq = _regval_[REG_SPC_IRQ]; \ + switch (__get_trap_number()) { \ + case CYGNUM_HAL_VECTOR_SWI: \ + (_regs_)->ssr_swi = _regval_[REG_SR] >> 16; \ + (_regs_)->a[6] = _regval_[REG_PC]; break; \ + case CYGNUM_HAL_VECTOR_FIQ: \ + (_regs_)->ssr_fiq = _regval_[REG_SR] >> 16; \ + (_regs_)->spc_fiq = _regval_[REG_PC]; break; \ + default: \ + (_regs_)->ssr_irq = _regval_[REG_SR] >> 16; \ + (_regs_)->spc_irq = _regval_[REG_PC]; break; \ + } \ +} + +#define CYGARC_HAL_GET_PC_REG(_regs_, _val_) \ +{ \ + switch ((_regs_)->vector) { \ + case CYGNUM_HAL_VECTOR_SWI: \ + (_val_) = (_regs_)->a[6]; break; \ + case CYGNUM_HAL_VECTOR_FIQ: \ + (_val_) = (_regs_)->spc_fiq; break; \ + default: \ + (_val_) = (_regs_)->spc_irq; break; \ + } \ +} + +//-------------------------------------------------------------------------- +// HAL setjmp +// Note: These definitions are repeated in context.S. If changes are +// required remember to update both sets. + +#define CYGARC_JMP_BUF_R4 0 +#define CYGARC_JMP_BUF_R5 2 +#define CYGARC_JMP_BUF_A12 4 +#define CYGARC_JMP_BUF_A13 8 +#define CYGARC_JMP_BUF_A14 12 +#define CYGARC_JMP_BUF_A15 16 + +#define CYGARC_JMP_BUF_SIZE 20 + +typedef cyg_uint16 hal_jmp_buf[CYGARC_JMP_BUF_SIZE/sizeof(cyg_uint16)]; + +externC int hal_setjmp(hal_jmp_buf env); +externC void hal_longjmp(hal_jmp_buf env, int val); + +//------------------------------------------------------------------------- +// Idle thread code. +// This macro is called in the idle thread loop, and gives the HAL the +// chance to insert code. Typical idle thread behaviour might be to halt the +// processor. + +externC void hal_idle_thread_action(cyg_uint32 loop_count); + +#define HAL_IDLE_THREAD_ACTION(_count_) hal_idle_thread_action(_count_) + +//-------------------------------------------------------------------------- +// Minimal and sensible stack sizes: the intention is that applications +// will use these to provide a stack size in the first instance prior to +// proper analysis. Idle thread stack should be this big. + +// THESE ARE NOT INTENDED TO BE MICROMETRICALLY ACCURATE FIGURES. +// THEY ARE HOWEVER ENOUGH TO START PROGRAMMING. +// YOU MUST MAKE YOUR STACKS LARGER IF YOU HAVE LARGE "AUTO" VARIABLES! + +// This is not a config option because it should not be adjusted except +// under "enough rope" sort of disclaimers. + +// Typical case stack frame size: return link + 4 pushed registers + some locals. +#define CYGNUM_HAL_STACK_FRAME_SIZE (48) + +// Stack needed for a context switch: +#define CYGNUM_HAL_STACK_CONTEXT_SIZE ((32+10)*CYG_HAL_MIPS_REG_SIZE) + +// Interrupt + call to ISR, interrupt_end() and the DSR +#define CYGNUM_HAL_STACK_INTERRUPT_SIZE (4+2*CYGNUM_HAL_STACK_CONTEXT_SIZE) + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// An interrupt stack which is large enough for all possible interrupt +// conditions (and only used for that purpose) exists. "User" stacks +// can be much smaller + +#define CYGNUM_HAL_STACK_SIZE_MINIMUM (CYGNUM_HAL_STACK_CONTEXT_SIZE+ \ + CYGNUM_HAL_STACK_INTERRUPT_SIZE*2+ \ + CYGNUM_HAL_STACK_FRAME_SIZE*8) +#define CYGNUM_HAL_STACK_SIZE_TYPICAL (CYGNUM_HAL_STACK_SIZE_MINIMUM+1024) + +#else // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// No separate interrupt stack exists. Make sure all threads contain +// a stack sufficiently large. + +#define CYGNUM_HAL_STACK_SIZE_MINIMUM (4096) +#define CYGNUM_HAL_STACK_SIZE_TYPICAL (4096) + +#endif + +#endif /* __ASSEMBLER__ */ + + +//-------------------------------------------------------------------------- +// Macros for switching context between two eCos instances (jump from +// code in ROM to code in RAM or vice versa). +#define CYGARC_HAL_SAVE_GP() +#define CYGARC_HAL_RESTORE_GP() + +//-------------------------------------------------------------------------- +// Defines for status register bit access + +#define CYGARC_SR_PM (1<<6) +#define CYGARC_SR_TE (1<<2) +#define CYGARC_SR_IE (1<<1) +#define CYGARC_SR_FE (1<<0) + +//-------------------------------------------------------------------------- +#endif // CYGONCE_HAL_HAL_ARCH_H +// End of hal_arch.h diff --git a/packages/hal/calmrisc16/arch/current/include/hal_cache.h b/packages/hal/calmrisc16/arch/current/include/hal_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/include/hal_cache.h @@ -0,0 +1,265 @@ +#ifndef CYGONCE_HAL_CACHE_H +#define CYGONCE_HAL_CACHE_H + +//============================================================================= +// +// hal_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 1998-02-17 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include + + +//----------------------------------------------------------------------------- +// Cache dimensions. +// These really should be defined in var_cache.h. If they are not, then provide +// a set of numbers that are typical of many variants. + +#ifndef HAL_DCACHE_SIZE + +// Data cache +//#define HAL_DCACHE_SIZE 0 // Size of data cache in bytes +//#define HAL_DCACHE_LINE_SIZE 0 // Size of a data cache line +//#define HAL_DCACHE_WAYS 0 // Associativity of the cache + +// Instruction cache +//#define HAL_ICACHE_SIZE 0 // Size of cache in bytes +//#define HAL_ICACHE_LINE_SIZE 0 // Size of a cache line +//#define HAL_ICACHE_WAYS 0 // Associativity of the cache + +//#define HAL_DCACHE_SETS 0 +//#define HAL_ICACHE_SETS 0 + +#endif + +//----------------------------------------------------------------------------- +// Global control of data cache + +// Enable the data cache +// There is no default mechanism for enabling or disabling the caches. +#ifndef HAL_DCACHE_ENABLE_DEFINED +#define HAL_DCACHE_ENABLE() +#endif + +// Disable the data cache +#ifndef HAL_DCACHE_DISABLE_DEFINED +#define HAL_DCACHE_DISABLE() +#endif + +#ifndef HAL_DCACHE_IS_ENABLED_DEFINED +#define HAL_DCACHE_IS_ENABLED(_state_) (_state_) = 1; +#endif + +// Invalidate the entire cache +// We simply use HAL_DCACHE_SYNC() to do this. For writeback caches this +// is not quite what we want, but there is no index-invalidate operation +// available. +#ifndef HAL_DCACHE_INVALIDATE_ALL_DEFINED +#define HAL_DCACHE_INVALIDATE_ALL() HAL_DCACHE_SYNC() +#endif + +// Synchronize the contents of the cache with memory. +// This uses the index-writeback-invalidate operation. +#ifndef HAL_DCACHE_SYNC_DEFINED +#define HAL_DCACHE_SYNC() \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_size_) + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) + +//#define HAL_DCACHE_WRITETHRU_MODE 0 +//#define HAL_DCACHE_WRITEBACK_MODE 1 + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +// This uses the fetch-and-lock cache operation. +#ifndef HAL_DCACHE_LOCK_DEFINED +#define HAL_DCACHE_LOCK(_base_, _asize_) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Undo a previous lock operation. +// Do this by flushing the cache, which is defined to clear the lock bit. +#ifndef HAL_DCACHE_UNLOCK_DEFINED +#define HAL_DCACHE_UNLOCK(_base_, _size_) \ + HAL_DCACHE_FLUSH( _base_, _size_ ) +#endif + +// Unlock entire cache +#ifndef HAL_DCACHE_UNLOCK_ALL_DEFINED +#define HAL_DCACHE_UNLOCK_ALL() \ + HAL_DCACHE_INVALIDATE_ALL() +#endif + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +// This uses the hit-writeback-invalidate cache operation. +#ifndef HAL_DCACHE_FLUSH_DEFINED +#define HAL_DCACHE_FLUSH( _base_ , _asize_ ) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Invalidate cache lines in the given range without writing to memory. +// This uses the hit-invalidate cache operation. +#ifndef HAL_DCACHE_INVALIDATE_DEFINED +#define HAL_DCACHE_INVALIDATE( _base_ , _asize_ ) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Write dirty cache lines to memory for the given address range. +// This uses the hit-writeback cache operation. +#ifndef HAL_DCACHE_STORE_DEFINED +#define HAL_DCACHE_STORE( _base_ , _asize_ ) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_DCACHE_ZERO( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +// Global control of Instruction cache + +// Enable the instruction cache +// There is no default mechanism for enabling or disabling the caches. +#ifndef HAL_ICACHE_ENABLE_DEFINED +#define HAL_ICACHE_ENABLE() +#endif + +// Disable the instruction cache +#ifndef HAL_ICACHE_DISABLE_DEFINED +#define HAL_ICACHE_DISABLE() +#endif + +#ifndef HAL_ICACHE_IS_ENABLED_DEFINED +#define HAL_ICACHE_IS_ENABLED(_state_) (_state_) = 1; +#endif + +// Invalidate the entire cache +// This uses the index-invalidate cache operation. +#ifndef HAL_ICACHE_INVALIDATE_ALL_DEFINED +#define HAL_ICACHE_INVALIDATE_ALL() \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Synchronize the contents of the cache with memory. +// Simply force the cache to reload. +#ifndef HAL_ICACHE_SYNC_DEFINED +#define HAL_ICACHE_SYNC() HAL_ICACHE_INVALIDATE_ALL() +#endif + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_size_) + +// Load the contents of the given address range into the instruction cache +// and then lock the cache so that it stays there. +// This uses the fetch-and-lock cache operation. +#ifndef HAL_ICACHE_LOCK_DEFINED +#define HAL_ICACHE_LOCK(_base_, _asize_) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Undo a previous lock operation. +// Do this by invalidating the cache, which is defined to clear the lock bit. +#ifndef HAL_ICACHE_UNLOCK_DEFINED +#define HAL_ICACHE_UNLOCK(_base_, _size_) \ + HAL_ICACHE_INVALIDATE( _base_, _size_ ) +#endif + +// Unlock entire cache +//#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +// This uses the hit-invalidate cache operation. +#ifndef HAL_ICACHE_INVALIDATE_DEFINED +#define HAL_ICACHE_INVALIDATE( _base_ , _asize_ ) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_CACHE_H +// End of hal_cache.h diff --git a/packages/hal/calmrisc16/arch/current/include/hal_intr.h b/packages/hal/calmrisc16/arch/current/include/hal_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/include/hal_intr.h @@ -0,0 +1,299 @@ +#ifndef CYGONCE_HAL_HAL_INTR_H +#define CYGONCE_HAL_HAL_INTR_H + +//========================================================================== +// +// hal_intr.h +// +// HAL Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jskov, +// gthomas, jlarmour, msalter +// Date: 1999-02-16 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include +#include + +#include + +//-------------------------------------------------------------------------- +// MIPS vectors. + +// These are the exception codes presented in the Cause register and +// correspond to VSRs. These values are the ones to use for HAL_VSR_GET/SET + + +#define CYGNUM_HAL_VECTOR_RESET 0 // Reset +#define CYGNUM_HAL_VECTOR_FIQ 1 // External Fast Interrupt +#define CYGNUM_HAL_VECTOR_IRQ 2 // External Interrupt +#define CYGNUM_HAL_VECTOR_TRACE 3 // Trace Request +#define CYGNUM_HAL_VECTOR_SWI 4 // SWI + +#define CYGNUM_HAL_VSR_MIN 0 +#define CYGNUM_HAL_VSR_MAX 4 +#define CYGNUM_HAL_VSR_COUNT 5 + +// Min/Max exception numbers and how many there are +#define CYGNUM_HAL_EXCEPTION_MIN 0 +#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_VSR_MAX + +#define CYGNUM_HAL_EXCEPTION_COUNT \ + ( CYGNUM_HAL_EXCEPTION_MAX - CYGNUM_HAL_EXCEPTION_MIN + 1 ) + + +#ifndef CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED +#define CYGNUM_HAL_FAST_INTERRUPT 0 +#define CYGNUM_HAL_INTERRUPT 1 + +// Min/Max ISR numbers and how many there are +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX 1 +#define CYGNUM_HAL_ISR_COUNT 2 + +#define CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED +#endif + +//-------------------------------------------------------------------------- +// Static data used by HAL + +// ISR tables +externC volatile CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT]; +externC volatile CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_ISR_COUNT]; +externC volatile CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT]; + +// VSR table +externC volatile CYG_ADDRESS hal_vsr_table[CYGNUM_HAL_VSR_MAX+1]; + +//-------------------------------------------------------------------------- +// Default ISR +// The #define is used to test whether this routine exists, and to allow +// us to call it. + +externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +#define HAL_DEFAULT_ISR hal_default_isr + +//-------------------------------------------------------------------------- +// Interrupt state storage + +typedef cyg_uint32 CYG_INTERRUPT_STATE; + +//-------------------------------------------------------------------------- +// Interrupt control macros +// Beware of nops in this code. They fill delay slots and avoid CP0 hazards +// that might otherwise cause following code to run in the wrong state or +// cause a resource conflict. + +#define HAL_DISABLE_INTERRUPTS(_old_) +#define HAL_ENABLE_INTERRUPTS() +#define HAL_RESTORE_INTERRUPTS(_old_) +#define HAL_QUERY_INTERRUPTS( _state_ ) + +//-------------------------------------------------------------------------- +// Routine to execute DSRs using separate interrupt stack + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK +externC void hal_interrupt_stack_call_pending_DSRs(void); +#define HAL_INTERRUPT_STACK_CALL_PENDING_DSRS() \ + hal_interrupt_stack_call_pending_DSRs() + +// these are offered solely for stack usage testing +// if they are not defined, then there is no interrupt stack. +#define HAL_INTERRUPT_STACK_BASE cyg_interrupt_stack_base +#define HAL_INTERRUPT_STACK_TOP cyg_interrupt_stack +// use them to declare these extern however you want: +// extern char HAL_INTERRUPT_STACK_BASE[]; +// extern char HAL_INTERRUPT_STACK_TOP[]; +// is recommended +#endif + +//-------------------------------------------------------------------------- +// Vector translation. +// For chained interrupts we only have a single vector though which all +// are passed. For unchained interrupts we have a vector per interrupt. + +#ifndef HAL_TRANSLATE_VECTOR + +#if defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN) + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) (_index_) = 0 + +#else + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) (_index_) = (_vector_) + +#endif + +#endif + +//-------------------------------------------------------------------------- +// Interrupt and VSR attachment macros + +#define HAL_INTERRUPT_IN_USE( _vector_, _state_) \ + CYG_MACRO_START \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR ((_vector_), _index_); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)HAL_DEFAULT_ISR ) \ + (_state_) = 0; \ + else \ + (_state_) = 1; \ + CYG_MACRO_END + +#define HAL_INTERRUPT_ATTACH( _vector_, _isr_, _data_, _object_ ) \ +{ \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR( _vector_, _index_ ); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)HAL_DEFAULT_ISR ) \ + { \ + hal_interrupt_handlers[_index_] = (CYG_ADDRESS)_isr_; \ + hal_interrupt_data[_index_] = (CYG_ADDRWORD)_data_; \ + hal_interrupt_objects[_index_] = (CYG_ADDRESS)_object_; \ + } \ +} + +#define HAL_INTERRUPT_DETACH( _vector_, _isr_ ) \ +{ \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR( _vector_, _index_ ); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)_isr_ ) \ + { \ + hal_interrupt_handlers[_index_] = (CYG_ADDRESS)HAL_DEFAULT_ISR; \ + hal_interrupt_data[_index_] = 0; \ + hal_interrupt_objects[_index_] = 0; \ + } \ +} + +#define HAL_VSR_GET( _vector_, _pvsr_ ) \ + *(_pvsr_) = (void (*)())hal_vsr_table[_vector_]; + + +#define HAL_VSR_SET( _vector_, _vsr_, _poldvsr_ ) CYG_MACRO_START \ + if( (void*)_poldvsr_ != NULL) \ + *(CYG_ADDRESS *)_poldvsr_ = (CYG_ADDRESS)hal_vsr_table[_vector_]; \ + hal_vsr_table[_vector_] = (CYG_ADDRESS)_vsr_; \ +CYG_MACRO_END + +// This is an ugly name, but what it means is: grab the VSR back to eCos +// internal handling, or if you like, the default handler. But if +// cooperating with GDB and CygMon, the default behaviour is to pass most +// exceptions to CygMon. This macro undoes that so that eCos handles the +// exception. So use it with care. + +externC void __default_exception_vsr(void); +externC void __default_interrupt_vsr(void); +externC void __break_vsr_springboard(void); + +#define HAL_VSR_SET_TO_ECOS_HANDLER( _vector_, _poldvsr_ ) CYG_MACRO_START \ + HAL_VSR_SET( _vector_, _vector_ == CYGNUM_HAL_VECTOR_INTERRUPT \ + ? (CYG_ADDRESS)__default_interrupt_vsr \ + : _vector_ == CYGNUM_HAL_VECTOR_BREAKPOINT \ + ? (CYG_ADDRESS)__break_vsr_springboard \ + : (CYG_ADDRESS)__default_exception_vsr, \ + _poldvsr_ ); \ +CYG_MACRO_END + +//-------------------------------------------------------------------------- +// Interrupt controller access +// The default code here simply uses the fields present in the CP0 status +// and cause registers to implement this functionality. +// Beware of nops in this code. They fill delay slots and avoid CP0 hazards +// that might otherwise cause following code to run in the wrong state or +// cause a resource conflict. + +#ifndef CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED + +#define HAL_INTERRUPT_MASK( _vector_ ) + +#define HAL_INTERRUPT_UNMASK( _vector_ ) + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) + +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) + +#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) + +#define CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED + +#endif + +//-------------------------------------------------------------------------- +// Clock control. +// This code uses the count and compare registers that are present in many +// MIPS variants. +// Beware of nops in this code. They fill delay slots and avoid CP0 hazards +// that might otherwise cause following code to run in the wrong state or +// cause a resource conflict. + +#ifndef CYGHWR_HAL_CLOCK_CONTROL_DEFINED + +externC CYG_WORD32 cyg_hal_clock_period; +#define CYGHWR_HAL_CLOCK_PERIOD_DEFINED + +#define HAL_CLOCK_INITIALIZE( _period_ ) + +#define HAL_CLOCK_RESET( _vector_, _period_ ) + +#define HAL_CLOCK_READ( _pvalue_ ) + +#define CYGHWR_HAL_CLOCK_CONTROL_DEFINED + +#endif + + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_HAL_INTR_H +// End of hal_intr.h diff --git a/packages/hal/calmrisc16/arch/current/include/hal_io.h b/packages/hal/calmrisc16/arch/current/include/hal_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/include/hal_io.h @@ -0,0 +1,158 @@ +#ifndef CYGONCE_HAL_HAL_IO_H +#define CYGONCE_HAL_HAL_IO_H + +//============================================================================= +// +// hal_io.h +// +// HAL device IO register support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 1998-02-17 +// Purpose: Define IO register support +// Description: The macros defined here provide the HAL APIs for handling +// device IO control registers. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +#include + +//----------------------------------------------------------------------------- +// IO Register address. +// This type is for recording the address of an IO register. + +typedef volatile CYG_ADDRWORD HAL_IO_REGISTER; + +//----------------------------------------------------------------------------- +// HAL IO macros. +#ifndef HAL_IO_MACROS_DEFINED + +//----------------------------------------------------------------------------- +// BYTE Register access. +// Individual and vectorized access to 8 bit registers. + +#define HAL_READ_UINT8( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_BYTE *)(_register_))) + +#define HAL_WRITE_UINT8( _register_, _value_ ) \ + (*((volatile CYG_BYTE *)(_register_)) = (_value_)) + +#define HAL_READ_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_BYTE *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + + +//----------------------------------------------------------------------------- +// 16 bit access. +// Individual and vectorized access to 16 bit registers. + +#define HAL_READ_UINT16( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_WORD16 *)(_register_))) + +#define HAL_WRITE_UINT16( _register_, _value_ ) \ + (*((volatile CYG_WORD16 *)(_register_)) = (_value_)) + +#define HAL_READ_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_WORD16 *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + +//----------------------------------------------------------------------------- +// 32 bit access. +// Individual and vectorized access to 32 bit registers. + +#define HAL_READ_UINT32( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_WORD32 *)(_register_))) + +#define HAL_WRITE_UINT32( _register_, _value_ ) \ + (*((volatile CYG_WORD32 *)(_register_)) = (_value_)) + +#define HAL_READ_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_WORD32 *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + +#define HAL_IO_MACROS_DEFINED + +#endif + + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_HAL_IO_H +// End of hal_io.h diff --git a/packages/hal/calmrisc16/arch/current/src/calm16-stub.c b/packages/hal/calmrisc16/arch/current/src/calm16-stub.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/src/calm16-stub.c @@ -0,0 +1,271 @@ +//======================================================================== +// +// calm16-stub.h +// +// Helper functions for stub, generic to all CalmRISC16 processors +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Red Hat, msalter +// Contributors: Red Hat, msalter +// Date: 2001-02-12 +// Purpose: +// Description: Helper functions for stub, generic to CalmRISC16 processors +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#include + +#include + +#ifdef CYGPKG_REDBOOT +#include +#endif + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS + +#include +#include + +typedef cyg_uint16 t_inst; + +/*---------------------------------------------------------------------- + * Asynchronous interrupt support + */ + +static struct +{ + t_inst *targetAddr; + t_inst savedInstr; +} asyncBuffer; + +/* Called to asynchronously interrupt a running program. + Must be passed address of instruction interrupted. + This is typically called in response to a debug port + receive interrupt. +*/ + +void +install_async_breakpoint(void *pc) +{ + asyncBuffer.targetAddr = pc; + asyncBuffer.savedInstr = *(t_inst *)pc; + *(t_inst *)pc = *(t_inst *)_breakinst; + __instruction_cache(CACHE_FLUSH); + __data_cache(CACHE_FLUSH); +} + +/*--------------------------------------------------------------------*/ +/* Given a trap value TRAP, return the corresponding signal. */ + +int __computeSignal (unsigned int trap_number) +{ + switch (trap_number) { + case CYGNUM_HAL_VECTOR_FIQ: +// case CYGNUM_HAL_VECTOR_IRQ: + return SIGINT; + } + return SIGTRAP; +} + +/* Return the trap number corresponding to the last-taken trap. */ + +int __get_trap_number (void) +{ + // The vector is not not part of the GDB register set so get it + // directly from the save context. + return _hal_registers->vector; +} + +#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) +int __is_bsp_syscall(void) +{ + return __get_trap_number() >= CYGNUM_HAL_VECTOR_SWI; +} +#endif + + +/* Set the current pc register value based on current vector. */ + +void set_pc (target_register_t pc) +{ + put_register (REG_PC, pc); + switch (__get_trap_number()) { + case CYGNUM_HAL_VECTOR_FIQ: + put_register (REG_SPC_FIQ, pc); + break; + case CYGNUM_HAL_VECTOR_SWI: + put_register (REG_LR, pc); + break; + default: + put_register (REG_SPC_IRQ, pc); + break; + } +} + +/* Get the current pc register value based on current vector. */ + +target_register_t get_pc(void) +{ + switch (__get_trap_number()) { + case CYGNUM_HAL_VECTOR_SWI: + return get_register (REG_LR); + case CYGNUM_HAL_VECTOR_FIQ: + return get_register (REG_SPC_FIQ); + default: + break; + } + return get_register (REG_SPC_IRQ); +} + + +/*---------------------------------------------------------------------- + * Single-step support + */ + +/* Set things up so that the next user resume will execute one instruction. + This may be done by setting breakpoints or setting a single step flag + in the saved user registers, for example. */ + +void __single_step (void) +{ + put_register(REG_SR, get_register(REG_SR) | ((target_register_t)CYGARC_SR_TE << 16)); +} + + +/* Clear the single-step state. */ + +void __clear_single_step (void) +{ + put_register(REG_SR, get_register(REG_SR) & ~((target_register_t)CYGARC_SR_TE << 16)); +} + + +void __install_breakpoints () +{ + /* Install the breakpoints in the breakpoint list */ + __install_breakpoint_list(); +} + +void __clear_breakpoints (void) +{ + __clear_breakpoint_list(); +} + + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ + +int +__is_breakpoint_function () +{ + return get_pc() == (target_register_t)(unsigned long)&_breakinst; +} + + +/* Skip the current instruction. Since this is only called by the + stub when the PC points to a breakpoint or trap instruction, + we can safely just skip 2. */ + +void __skipinst (void) +{ + set_pc(get_pc() + 2); +} + +unsigned short __read_prog_uint16(void *addr) +{ + unsigned val; + asm("ldc %0, @%1" : "=r"(val) : "r"(addr) ); + return val; +} + +unsigned char __read_prog_uint8(void *addr) +{ + unsigned short s; + int is_odd = ((unsigned long)addr & 1) == 1; + + s = __read_prog_uint16((void *)((unsigned long)addr & ~1)); + if (is_odd) + return s & 0xff; + else + return (s >> 8) & 0xff; +} + +unsigned long __read_prog_uint32(void *addr) +{ + unsigned long u; + + u = (unsigned long)__read_prog_uint16(addr) << 16; + u |= __read_prog_uint16((void *)((unsigned long)addr + 2)); + + return u; +} + +void __write_prog_uint16(void *addr, unsigned short val) +{ + hal_plf_write_prog_halfword((unsigned long)addr, val); +} + +void __write_prog_uint32(void *addr, unsigned long val) +{ + hal_plf_write_prog_halfword((unsigned long)addr, (val >> 16) & 0xffff); + hal_plf_write_prog_halfword((unsigned long)addr + 2, val & 0xffff); +} + +void __write_prog_uint8(void *addr, unsigned char val) +{ + unsigned short s; + int is_odd = ((unsigned long)addr & 1) == 1; + + s = __read_prog_uint16((void *)((unsigned long)addr & ~1)); + + if (is_odd) + s = (s & 0xff00) | val; + else + s = (s & 0xff) | (val << 8); + + hal_plf_write_prog_halfword((unsigned long)addr & ~1, s); +} + +#endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS diff --git a/packages/hal/calmrisc16/arch/current/src/context.S b/packages/hal/calmrisc16/arch/current/src/context.S new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/src/context.S @@ -0,0 +1,132 @@ +##=============================================================================## +## context.S +## +## CalmRISC16 context switch code +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: CalmRISC16 context switch code +## Description: This file contains implementations of the thread context +## switch routines. It also contains the longjmp() and setjmp() +## routines. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#------------------------------------------------------------------------------ +# hal_thread_switch_context +# Switch thread contexts +# A0 = address of sp of next thread to execute +# A1 = address of sp save location of current thread + + .global hal_thread_switch_context +hal_thread_switch_context: + // FIXME + # Now load the destination thread by dropping through + # to hal_thread_load_context + +#------------------------------------------------------------------------------ +# hal_thread_load_context +# Load thread context +# A0 = address of sp of next thread to execute +# Note that this function is also the second half of hal_thread_switch_context +# and is simply dropped into from it. + + .global hal_thread_load_context +hal_thread_load_context: + // FIXME + +#------------------------------------------------------------------------------ +# HAL longjmp, setjmp implementations +# hal_setjmp saves only callee save registers into given buffer +# Note: These definitions are repeated in hal_arch.h. If changes are required +# remember to update both sets. + +#define CYGARC_JMP_BUF_R4 0 +#define CYGARC_JMP_BUF_R5 2 +#define CYGARC_JMP_BUF_A12 4 +#define CYGARC_JMP_BUF_A13 8 +#define CYGARC_JMP_BUF_A14 12 +#define CYGARC_JMP_BUF_A15 16 + +#define CYGARC_JMP_BUF_SIZE 20 + +// FIXME: The follwing restricts us to using only 32 bit registers +// in jump buffers. If/when we move to a full 64 bit architecture, +// this will need to change, as will the instructions that we use to +// save and restore them. + +#define jmpbuf_regsize 4 + + .globl hal_setjmp +hal_setjmp: + ldw a8,@[sp+2] // jmpbuf + ldw @[a8+0],r4 + ldw @[a8+2],r5 + ldw @[a8+4],a12 + ldw @[a8+8],a13 + ldw @[a8+12],a14 + ldw @[a8+16],a15 + retd + ld r0,#0 + .end hal_setjmp + + .globl hal_longjmp +hal_longjmp: + ldw a8,@[sp+2] + ldw r0,@[sp+6] + ldw r4,@[a8+0] + ldw r5,@[a8+2] + ldw a12,@[a8+4] + ldw a13,@[a8+8] + ldw a14,@[a8+12] + ldw a15,@[a8+16] + and r0,r0 + retd + incc r0 + .end hal_longjmp + + +#------------------------------------------------------------------------------ +# end of context.S diff --git a/packages/hal/calmrisc16/arch/current/src/hal_misc.c b/packages/hal/calmrisc16/arch/current/src/hal_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/src/hal_misc.c @@ -0,0 +1,325 @@ +//========================================================================== +// +// hal_misc.c +// +// HAL miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour +// Date: 1999-01-21 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // Base types +#include // tracing macros +#include // assertion macros + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include // architectural definitions + +#include // Interrupt handling + +#include // Cache handling + +/*------------------------------------------------------------------------*/ +/* If required, define a variable to store the clock period. */ + +#ifdef CYGHWR_HAL_CLOCK_PERIOD_DEFINED + +CYG_WORD32 cyg_hal_clock_period; + +#endif + +/*------------------------------------------------------------------------*/ +/* First level C exception handler. */ + +externC void __handle_exception (void); + +externC HAL_SavedRegisters *_hal_registers; + +externC void* volatile __mem_fault_handler; + +externC cyg_uint32 cyg_hal_exception_handler(HAL_SavedRegisters *regs) +{ + int vec = regs->vector; + + // adjust PC after 'break' insns + if (vec == CYGNUM_HAL_VECTOR_IRQ) { + if (__read_prog_uint16((void *)(regs->spc_irq - 2)) == HAL_BREAKINST) + regs->spc_irq -= 2; + } + +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) + + // If we caught an exception inside the stubs, see if we were expecting it + // and if so jump to the saved address + if (__mem_fault_handler) { + switch (vec) { + case CYGNUM_HAL_VECTOR_SWI: + regs->a[6] = (CYG_ADDRWORD)__mem_fault_handler; + break; + case CYGNUM_HAL_VECTOR_FIQ: + regs->spc_fiq = (CYG_ADDRWORD)__mem_fault_handler; + break; + default: + regs->spc_irq = (CYG_ADDRWORD)__mem_fault_handler; + break; + } + return 0; // Caught an exception inside stubs + } + + // Set the pointer to the registers of the current exception + // context. At entry the GDB stub will expand the + // HAL_SavedRegisters structure into a (bigger) register array. + _hal_registers = regs; + __handle_exception(); + +#elif defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && defined(CYGPKG_HAL_EXCEPTIONS) + + // We should decode the vector and pass a more appropriate + // value as the second argument. For now we simply pass a + // pointer to the saved registers. We should also divert + // breakpoint and other debug vectors into the debug stubs. + + cyg_hal_deliver_exception( vec, (CYG_ADDRWORD)regs ); + +#else + + CYG_FAIL("Exception!!!"); + +#endif + return 0; +} + +/*------------------------------------------------------------------------*/ +/* default ISR */ + +#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ +#if defined(CYGDBG_HAL_CALM32_DEBUG_GDB_CTRLC_SUPPORT) && \ + defined(CYGHWR_HAL_GDB_PORT_VECTOR) && \ + defined(HAL_CTRLC_ISR) + +#ifndef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if( vector == CYGHWR_HAL_GDB_PORT_VECTOR ) +#endif + { + cyg_uint32 result = HAL_CTRLC_ISR( vector, data ); + if( result != 0 ) return result; + } + +#if defined(CYGSEM_HAL_USE_ROM_MONITOR_CygMon) +#if defined(HAL_DIAG_IRQ_CHECK) + { + cyg_uint32 ret; + /* let ROM monitor handle unexpected interrupts */ + HAL_DIAG_IRQ_CHECK(vector, ret); + if (ret<=0) + return ret; + } +#endif // def HAL_DIAG_IRQ_CHECK +#endif // def CYGSEM_HAL_USE_ROM_MONITOR_CygMon +#endif + + CYG_TRACE1(true, "Interrupt: %d", vector); + CYG_FAIL("Spurious Interrupt!!!"); + return 0; +} + +#else // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + +externC cyg_uint32 hal_arch_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ +#if defined(CYGDBG_HAL_CALM16_DEBUG_GDB_CTRLC_SUPPORT) && \ + defined(CYGHWR_HAL_GDB_PORT_VECTOR) && \ + defined(HAL_CTRLC_ISR) + +#if defined(CYGSEM_HAL_USE_ROM_MONITOR_CygMon) +#if defined(HAL_DIAG_IRQ_CHECK) + { + cyg_uint32 ret; + /* let ROM monitor handle unexpected interrupts */ + HAL_DIAG_IRQ_CHECK(vector, ret); + if (ret<=0) + return ret; + } +#endif // def HAL_DIAG_IRQ_CHECK +#endif // def CYGSEM_HAL_USE_ROM_MONITOR_CygMon +#endif + + return 0; +} + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + +/*------------------------------------------------------------------------*/ +/* data copy and bss zero functions */ + +typedef void (CYG_SYM_ADDRESS)(void); + +// All these must use this type of address to stop them being given relocations +// relative to $gp (i.e. assuming they would be in .sdata) +extern CYG_SYM_ADDRESS __ram_data_start; +extern CYG_SYM_ADDRESS __ram_data_end; +extern CYG_SYM_ADDRESS __rom_data_start; + +#ifdef CYG_HAL_STARTUP_ROM +void hal_copy_data(void) +{ + short *p = (short *)&__ram_data_start; + short *q = (short *)&__rom_data_start; + short x; + + while( p != (short *)&__ram_data_end ) { + asm volatile( "ldc %0,@%1\n" : "=r"(x) : "r"(q) ); + *p++ = x; + q++; + } +} +#endif + +extern CYG_SYM_ADDRESS __bss_start; +extern CYG_SYM_ADDRESS __bss_end; + +void hal_zero_bss(void) +{ + short *p = (short *)&__bss_start; + + while( p != (short *)&__bss_end ) + *p++ = 0; +} + +/*------------------------------------------------------------------------*/ + +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG +cyg_bool cyg_hal_stop_constructors; +#endif + +typedef void (*pfunc) (void); +extern pfunc __CTOR_LIST__[]; +extern pfunc __CTOR_END__[]; + +void +cyg_hal_invoke_constructors(void) +{ +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG + static pfunc *p = &__CTOR_END__[-1]; + + cyg_hal_stop_constructors = 0; + for (; p >= __CTOR_LIST__; p--) { + (*p) (); + if (cyg_hal_stop_constructors) { + p--; + break; + } + } +#else + pfunc *p; + + for (p = &__CTOR_END__[-1]; p >= __CTOR_LIST__; p--) + (*p) (); +#endif + +} // cyg_hal_invoke_constructors() + +/*------------------------------------------------------------------------*/ +/* Determine the index of the ls bit of the supplied mask. */ + +cyg_uint32 hal_lsbit_index(cyg_uint32 mask) +{ + cyg_uint32 n = mask; + + static const signed char tab[64] = + { -1, 0, 1, 12, 2, 6, 0, 13, 3, 0, 7, 0, 0, 0, 0, 14, 10, + 4, 0, 0, 8, 0, 0, 25, 0, 0, 0, 0, 0, 21, 27 , 15, 31, 11, + 5, 0, 0, 0, 0, 0, 9, 0, 0, 24, 0, 0 , 20, 26, 30, 0, 0, 0, + 0, 23, 0, 19, 29, 0, 22, 18, 28, 17, 16, 0 + }; + + n &= ~(n-1UL); + n = (n<<16)-n; + n = (n<<6)+n; + n = (n<<4)+n; + + return tab[n>>26]; +} + +/*------------------------------------------------------------------------*/ +/* Determine the index of the ms bit of the supplied mask. */ + +cyg_uint32 hal_msbit_index(cyg_uint32 mask) +{ + cyg_uint32 x = mask; + cyg_uint32 w; + + /* Phase 1: make word with all ones from that one to the right */ + x |= x >> 16; + x |= x >> 8; + x |= x >> 4; + x |= x >> 2; + x |= x >> 1; + + /* Phase 2: calculate number of "1" bits in the word */ + w = (x & 0x55555555) + ((x >> 1) & 0x55555555); + w = (w & 0x33333333) + ((w >> 2) & 0x33333333); + w = w + (w >> 4); + w = (w & 0x000F000F) + ((w >> 8) & 0x000F000F); + return (cyg_uint32)((w + (w >> 16)) & 0xFF) - 1; + +} + +/*------------------------------------------------------------------------*/ +/* Idle thread action */ + +#include + +void hal_idle_thread_action( cyg_uint32 count ) +{ +} + +/*------------------------------------------------------------------------*/ +/* End of hal_misc.c */ diff --git a/packages/hal/calmrisc16/arch/current/src/hal_syscall.c b/packages/hal/calmrisc16/arch/current/src/hal_syscall.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/src/hal_syscall.c @@ -0,0 +1,142 @@ +//============================================================================= +// +// hal_syscall.c +// +// +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter +// Date: 2000-11-5 +// Purpose: +// Description: +// +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGPKG_REDBOOT +#include +#endif + +#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) + +#include // Our header +#include // HAL_BREAKINST +#include // HAL_xCACHE_x +#include // interrupt disable/restore + +#include // ROM calling interface +#include // Helper functions + +extern CYG_ADDRWORD __do_syscall(CYG_ADDRWORD func, // syscall function number + CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, // up to four args. + CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, + CYG_ADDRWORD *retval, // syscall return value + CYG_ADDRWORD *sig); // signal to return (or 0) + +// These are required by the ANSI C part of newlib (excluding system() of +// course). +#define SYS_exit 1 +#define SYS_open 2 +#define SYS_close 3 +#define SYS_read 4 +#define SYS_write 5 +#define SYS_lseek 6 +#define SYS_unlink 7 +#define SYS_getpid 8 +#define SYS_kill 9 +#define SYS_fstat 10 +//#define SYS_sbrk 11 - not currently a system call, but reserved. + +// ARGV support. +#define SYS_argvlen 12 +#define SYS_argv 13 + +// These are extras added for one reason or another. +#define SYS_chdir 14 +#define SYS_stat 15 +#define SYS_chmod 16 +#define SYS_utime 17 +#define SYS_time 18 + +#define SYS_interrupt 1000 +#define SYS_meminfo 1001 + +int +hal_syscall_handler(void) +{ + int func, lret = 0; + unsigned short *sp = (unsigned short *)get_register(REG_SP); + CYG_ADDRWORD arg1, arg2, arg3, arg4; + long err, sig; + + // Shift this right because GDB wants 16-bit register values + // to be left-justified in a 32-bit field. Yuck. + func = get_register(REG_R0) >> 16; + arg1 = get_register(REG_A8); + arg2 = get_register(REG_A9); + arg3 = get_register(REG_A10); + arg4 = get_register(REG_A11); + + if (func == SYS_exit) { + // We want to stop in exit so that the user may poke around + // to see why his app exited. + return SIGTRAP; + } + + if (func == SYS_interrupt) { + // A console interrupt landed us here. + // Invoke the debug agent so as to cause a SIGINT. + return SIGINT; + } + + if (__do_syscall(func, arg1, arg2, arg3, arg4, &err, &sig)) { + put_register(REG_R2, ((err < 0) ? -err : 0) << 16); + put_register(REG_A8, err); + return (int)sig; + } + + return SIGTRAP; +} + +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS diff --git a/packages/hal/calmrisc16/arch/current/src/vectors.S b/packages/hal/calmrisc16/arch/current/src/vectors.S new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/arch/current/src/vectors.S @@ -0,0 +1,504 @@ +##============================================================================= +## +## vectors.S +## +## CalmRISC16 exception vectors +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: CalmRISC16 exception vectors +## Description: This file defines the code placed into the exception +## vectors. It also contains the first level default VSRs +## that save and restore state for both exceptions and +## interrupts. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#ifdef CYGPKG_KERNEL +# include +#endif + +#include +#include + +##----------------------------------------------------------------------------- +## Hardware supplied vectors + +//========================================================================== +// Hardware exception vectors. +// This entire section will be copied to location 0x0000 at startup time. +// + .section ".vectors","ax" + .global SYM_NAME(reset_vector) +SYM_NAME(reset_vector): + .short 0x100 ; reset + .short 0x110 ; fiq + .short 0x120 ; irq + .short 0x130 ; trq + .rept 62 + brad 0f ; swi + nop + .endr + + ;; 0x100 - reset + ld a8,SYM_NAME(_start) + jmp a8 + + .p2align 4 + ;; 0x110 - fiq + push a8 + ld a8,0 + ldw a8,@[a8+0] + jmp a8 + + .p2align 4 + ;; 0x120 - irq + push a8 + ld a8,0 + ldw a8,@[a8+4] + jmp a8 + + .p2align 4 + ;; 0x130 - trq + push a8 + ld a8,0 + ldw a8,@[a8+8] + jmp a8 + + .p2align 4 + ;; 0x140 - swi + 0: + push a8 + ld a8,0 + ldw a8,@[a8+12] + jmp a8 + +##----------------------------------------------------------------------------- +## Startup code + + .text + +FUNC_START _start + ld r0,0 + cld #28,r0 + cld #29,r0 + cld #30,r0 + cld #31,r0 + 2: + # Initialize hardware + hal_cpu_init + hal_diag_init + hal_memc_init + hal_cache_init + hal_timer_init + + # load initial stack pointer + ld sp,__startup_stack + + hal_mon_init + +#ifdef CYG_HAL_STARTUP_ROM + # Copy data from ROM to RAM + + .extern SYM_NAME(hal_copy_data) + jsr SYM_NAME(hal_copy_data) +#endif + # Zero BSS + + .extern SYM_NAME(hal_zero_bss) + jsr SYM_NAME(hal_zero_bss) + + # Call variant and platform HAL + # initialization routines. + + .extern SYM_NAME(hal_variant_init) + jsr SYM_NAME(hal_variant_init) + + .extern SYM_NAME(hal_platform_init) + jsr SYM_NAME(hal_platform_init) + + # Call constructors + .extern SYM_NAME(cyg_hal_invoke_constructors) + jsr SYM_NAME(cyg_hal_invoke_constructors) + +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) + .extern SYM_NAME(initialize_stub) + jsr SYM_NAME(initialize_stub) +#endif +#if defined(CYGDBG_HAL_CALM16_DEBUG_GDB_CTRLC_SUPPORT) + .extern SYM_NAME(hal_ctrlc_isr_init) + jsr SYM_NAME(hal_ctrlc_isr_init) +#endif + + # Call cyg_start + setsr fe + setsr ie + + .extern SYM_NAME(cyg_start) + ld lr,SYM_NAME(_start) + jmp SYM_NAME(cyg_start) + +FUNC_END _start + +#if 0 +FUNC_START __txchar + ldw r0,@[sp+2] + 99: + cld r6,#29 + cmp eq,r6,#0 + brfd 99b + nop + cld #30,r0 + ld r6,1 + cld #29,r6 + jmp lr +FUNC_END __txchar +#endif + + .macro switch_stack_and_save_regs + // a8 already pushed on the current stack + push r0 + + ld r0,e15 + and r0,#0x3f + cmp ugt,r0,#%hi(__GDB_stack) + brt 80f + // sp <= __GDB_stack + cmp eq,r0,#%hi(__GDB_stack) + brf 80f + // %hi(sp) == %hi(__GDB_stack) + ld a8,#__GDB_stack + cmp ugt,r15,r8 + brt 80f + // don't need switch + pop r0 + pop a8 + sub sp,#4 + push a14 + ld a14,sp + add a14,#8 + ldw @[sp+6],a14 + bra 85f + 80: + // switch to GDB stack + pop r0 + ld a8,sp + ld sp,#__GDB_stack + add a8,#4 + push a8 + push a14 + sub a8,#2 + ldw a8,@[a8+0] + 85: + // at this point, we're using the correct stack + // and a15/a14 have been pushed + push a13,a12 + push a11,a10 + push a9,a8 + push r7,r6 + push r5,r4 + push r3,r2 + push r1,r0 + + ld r0,ssr_swi + push r0 + ld r0,ssr_irq + push r0 + ld r0,ssr_fiq + push r0 + ld r0,spcl_irq + push r0 + ld r0,spch_irq + push r0 + ld r0,spcl_fiq + push r0 + ld r0,spch_fiq + push r0 + .endm // switch_stack_and_save_regs + + + .macro restore_regs + pop r0 + ld spch_fiq,r0 + pop r0 + ld spcl_fiq,r0 + pop r0 + ld spch_irq,r0 + pop r0 + ld spcl_irq,r0 + pop r0 + ld ssr_fiq,r0 + pop r0 + ld ssr_irq,r0 + pop r0 + ld ssr_swi,r0 + + pop r0,r1 + pop r2,r3 + pop r4,r5 + pop r6,r7 + pop a8,a9 + pop a10,a11 + pop a12,a13 + pop a14 + ldw sp,@[sp+2] + .endm + +##------------------------------------------------------------------------------ +## Default interrupt VSR. +## Saves machine state and calls appropriate ISR. + +FUNC_START __default_irq_vsr + + // IRQ is overloaded for use by the break insn. + // For RedBoot (or any stub) on the core eval boards, we treat + // IRQ as an exception. + + switch_stack_and_save_regs + ld r0,2 + push r0 + +#if 0 + // push interrupt_data arg + + ld a8,#SYM_NAME(hal_interrupt_data) + ldw a8,@[a8 + 4] + push a8 + + // push vector arg + push r0 + ld r0,0 + push r0 + + // call handler + ld a8,#SYM_NAME(hal_interrupt_handlers) + ldw a8,@[a8 + 4] + jsr a8 + add sp,#10 +#else + // call exception handler + ld a8,sp + add a8,#2 + push a8 + jsr SYM_NAME(cyg_hal_exception_handler) + add sp,#6 +#endif + + restore_regs + ret_irq +FUNC_END __default_irq_vsr + +##------------------------------------------------------------------------------ +## Default fast interrupt VSR. +## Saves machine state and calls appropriate ISR. + +FUNC_START __default_fiq_vsr + + switch_stack_and_save_regs + ld r0,1 + push r0 + + // push interrupt_data arg + ld a8,#SYM_NAME(hal_interrupt_data) + ldw a8,@[a8 + 0] + push a8 + + // push vector arg + push r0 + ld r0,0 + push r0 + + // call handler + ld a8,#SYM_NAME(hal_interrupt_handlers) + ldw a8,@[a8 + 0] + jsr a8 + add sp,#10 + + restore_regs + ret_fiq +FUNC_END __default_fiq_vsr + +##------------------------------------------------------------------------------ +## Default trace VSR. +## Saves machine state and calls appropriate handler. + +FUNC_START __default_trq_vsr + switch_stack_and_save_regs + ld r0,3 + push r0 + + // call exception handler + ld a8,sp + add a8,#2 + push a8 + jsr SYM_NAME(cyg_hal_exception_handler) + add sp,#6 + + restore_regs + ret_irq +FUNC_END __default_trq_vsr + +##------------------------------------------------------------------------------ +## Default swi VSR. +## Saves machine state and calls appropriate handler. + +FUNC_START __default_swi_vsr + switch_stack_and_save_regs + ld r0,4 + push r0 + + // call exception handler + ld a8,sp + add a8,#2 + push a8 + jsr SYM_NAME(cyg_hal_exception_handler) + add sp,#6 + + restore_regs + ret_swi +FUNC_END __default_swi_vsr + +##----------------------------------------------------------------------------- +## Short circuit in case any code tries to use "__gccmain()" + +FUNC_START __gccmain + jmp lr +FUNC_END __gccmain + +##----------------------------------------------------------------------------- +## Stacks. +## Used during intialization and for executing ISRs. + + .section ".bss" + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + .p2align 2 +__GDB_stack_base: + .rept 0x1000 + .byte 0 + .endr +__GDB_stack: + .long 0 +#endif + .p2align 2 +__startup_stack_base: + .rept 0x1000 + .byte 0 + .endr + .p2align 2 +__startup_stack: + .long 0 + +##----------------------------------------------------------------------------- +## VSR table. +## The main interrupt code indirects through here to find the VSR +## to execute for each architecture defined interrupt. +## This is only used for simulated targets, on real targets a fixed location VSR +## table is now allocated at 0x000000. + +#ifndef CYG_HAL_CALM16_VSR_TABLE_DEFINED + +## .section ".vsr_table","a" + + .data + + .globl SYM_NAME(hal_vsr_table) + +SYM_NAME(hal_vsr_table): + .long SYM_NAME(__default_fiq_vsr) // FIQ + .long SYM_NAME(__default_irq_vsr) // IRQ + .long SYM_NAME(__default_trq_vsr) // TRQ + .long SYM_NAME(__default_swi_vsr) // SWI +#endif + + .data + .balign 16 +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + // Vectors used to communicate between eCos and ROM environments + .globl SYM_NAME(hal_virtual_vector_table) +SYM_NAME(hal_virtual_vector_table): + .rept 64 + .long 0 + .endr +#endif + +#------------------------------------------------------------------------------ +# Interrupt vector tables. +# These tables contain the isr, data and object pointers used to deliver +# interrupts to user code. +# hal_interrupt_level contains the interrupt level set by +# HAL_INTERRUPT_CONFIGURE(). +# This is a default set that provide support only for the single external +# interrupt. Platforms or boards are expected to define their own versions +# of these if they have their own interrupt mappings. + +#ifndef CYG_HAL_CALM16_ISR_TABLES_DEFINED + + .extern SYM_NAME(hal_default_isr) + + .data + + .globl SYM_NAME(hal_interrupt_handlers) +SYM_NAME(hal_interrupt_handlers): + .long SYM_NAME(hal_default_isr) + .long SYM_NAME(hal_default_isr) + + + .globl SYM_NAME(hal_interrupt_data) +SYM_NAME(hal_interrupt_data): + .long 0 + .long 0 + + .globl SYM_NAME(hal_interrupt_objects) +SYM_NAME(hal_interrupt_objects): + .long 0 + .long 0 + +#endif + +##----------------------------------------------------------------------------- +## end of vectors.S + + diff --git a/packages/hal/calmrisc16/ceb/current/ChangeLog b/packages/hal/calmrisc16/ceb/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/ChangeLog @@ -0,0 +1,39 @@ +2001-05-09 Mark Salter + + * include/plf_intr.h: Make hal_delay_us argument a cyg_uint32. + * src/plf_misc.c (hal_delay_us): Ditto. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/calmrisc16/ceb/current/cdl/hal_calm16_ceb.cdl b/packages/hal/calmrisc16/ceb/current/cdl/hal_calm16_ceb.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/cdl/hal_calm16_ceb.cdl @@ -0,0 +1,270 @@ +# ==================================================================== +# +# hal_calm16_ceb.cdl +# +# CalmRISC16 Core Eval Board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): msalter +# Original data: bartv +# Contributors: +# Date: 2001-02-12 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_CALM16_CEB { + display "CalmRISC16 core evaluation board" + parent CYGPKG_HAL_CALM16 + include_dir cyg/hal + description " + The Core eval board HAL package should be used when targetting the + actual hardware." + + compile hal_diag.c platform.S plf_misc.c ser.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_GUARANTEED + + cdl_option CYGBLD_HAL_TARGET_H { + display "Variant header" + flavor data + no_define + calculated { "" } + define -file system.h CYGBLD_HAL_TARGET_H + description "Variant header." + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_system_header "" + puts $::cdl_system_header "/* Make sure we get the CORE type definitions for HAL_PLATFORM_CPU */" + puts $::cdl_system_header "#include CYGBLD_HAL_TARGET_H" + puts $::cdl_system_header "#define HAL_PLATFORM_BOARD \"Ceb\"" + puts $::cdl_system_header "#define HAL_PLATFORM_EXTRA \"\"" + puts $::cdl_system_header "" + } + + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM"} + default_value {"ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + Currently only ROM startup type is supported." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 57600 + default_value 57600 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 57600 + default_value 57600 + description " + This option controls the baud rate used for the GDB connection." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + parent CYGBLD_GLOBAL_OPTIONS + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + + + cdl_option CYGNUM_HAL_BREAKPOINT_LIST_SIZE { + display "Number of breakpoints supported by the HAL." + flavor data + default_value 25 + description " + This option determines the number of breakpoints supported by the HAL." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The Atlas board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The Atlas board has only one serial port. This option + chooses which port will be used for diagnostic output." + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "calm16_ceb_ram" : \ + "calm16_ceb_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "Generic" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for three different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"CygMon\" provides support for the Cygnus ROM Monitor. + And finally, \"GDB_stubs\" provides support when GDB stubs are + included in the ROM monitor or boot ROM." + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 1 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + compile -library=libextras.a + + make -priority 325 { + /bin/redboot.srec : /bin/redboot.elf + $(OBJCOPY) --strip-all $< $(@:.srec=.img) + $(OBJCOPY) -O srec $< $@ + } + } + } + +} diff --git a/packages/hal/calmrisc16/ceb/current/include/hal_diag.h b/packages/hal/calmrisc16/ceb/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/include/hal_diag.h @@ -0,0 +1,95 @@ +#ifndef CYGONCE_HAL_DIAG_H +#define CYGONCE_HAL_DIAG_H + +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors: nickg, gthomas +// Date: 1998-09-11 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include + +#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +#else // everything by steam + +/*---------------------------------------------------------------------------*/ +/* functions implemented in hal_diag.c */ + +externC void hal_diag_init(void); +externC void hal_diag_write_char(char c); +externC void hal_diag_read_char(char *c); + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +/*---------------------------------------------------------------------------*/ +// LED + +externC void hal_diag_led(int n); + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_DIAG_H */ diff --git a/packages/hal/calmrisc16/ceb/current/include/pkgconf/mlt_calm16_ceb_rom.h b/packages/hal/calmrisc16/ceb/current/include/pkgconf/mlt_calm16_ceb_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/include/pkgconf/mlt_calm16_ceb_rom.h @@ -0,0 +1,20 @@ +// eCos memory layout - Fri Oct 20 06:10:29 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x00000400) +#define CYGMEM_REGION_ram_SIZE (0x7fc00) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0x400000) +#define CYGMEM_REGION_rom_SIZE (0x80000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x80000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/calmrisc16/ceb/current/include/pkgconf/mlt_calm16_ceb_rom.ldi b/packages/hal/calmrisc16/ceb/current/include/pkgconf/mlt_calm16_ceb_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/include/pkgconf/mlt_calm16_ceb_rom.ldi @@ -0,0 +1,40 @@ +// eCos memory layout - Fri Oct 20 06:10:29 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x000000, LENGTH = 0x80000 + rom : ORIGIN = 0x400000, LENGTH = 0x80000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_vectors (rom, 0x400000, LMA_EQ_VMA) + SECTION_ROMISC (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_RELOCS (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_init (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_data (ram, 0x00000000, FOLLOWING (.fini)) + SECTION_data1 (ram, ALIGN (0x40), FOLLOWING (.data)) + SECTION_rodata (ram, ALIGN (0x40), FOLLOWING (.data1)) + SECTION_rodata1 (ram, ALIGN (0x40), FOLLOWING (.rodata)) + SECTION_eh_frame (ram, ALIGN (0x40), FOLLOWING (.rodata1)) + SECTION_gcc_except_table (ram, ALIGN (0x40), FOLLOWING (.eh_frame)) + SECTION_ctors (ram, ALIGN (0x40), FOLLOWING (.gcc_except_table)) + SECTION_dtors (ram, ALIGN (0x40), FOLLOWING (.ctors)) + SECTION_devtab (ram, ALIGN (0x40), FOLLOWING (.dtors)) + SECTION_got (ram, ALIGN (0x40), FOLLOWING (.devtab)) + SECTION_dynamic (ram, ALIGN (0x40), FOLLOWING (.got)) + SECTION_sdata (ram, ALIGN (0x40), FOLLOWING (.dynamic)) + SECTION_lit8 (ram, ALIGN (0x40), FOLLOWING (.sdata)) + SECTION_lit4 (ram, ALIGN (0x40), FOLLOWING (.lit8)) + SECTION_sbss (ram, ALIGN (0x40), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x40), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/calmrisc16/ceb/current/include/platform.inc b/packages/hal/calmrisc16/ceb/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/include/platform.inc @@ -0,0 +1,96 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## CalmRISC16 core eval board assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: Core eval board definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the core eval board. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include +#include + +#define CYGPKG_HAL_RESET_VECTOR_FIRST_CODE + .macro hal_reset_vector_first_code + .endm + +#define CYGPKG_HAL_EARLY_INIT + .macro hal_early_init + .endm + +#------------------------------------------------------------------------------ +# Diagnostic macros + +#ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED + + .macro hal_diag_init + .endm + + .macro hal_diag_excpt_start + .endm + + .macro hal_diag_intr_start + .endm + + .macro hal_diag_restore + .endm + +#define CYGPKG_HAL_MIPS_DIAG_DEFINED + +#endif // ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/packages/hal/calmrisc16/ceb/current/include/plf_cache.h b/packages/hal/calmrisc16/ceb/current/include/plf_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/include/plf_cache.h @@ -0,0 +1,73 @@ +#ifndef CYGONCE_PLF_CACHE_H +#define CYGONCE_PLF_CACHE_H + +//============================================================================= +// +// plf_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 1998-02-17 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include + +//============================================================================= + +// Nothing here at present. + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_PLF_CACHE_H +// End of plf_cache.h + diff --git a/packages/hal/calmrisc16/ceb/current/include/plf_intr.h b/packages/hal/calmrisc16/ceb/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/include/plf_intr.h @@ -0,0 +1,125 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// Atlas Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jskov, +// gthomas, jlarmour, dmoseley +// Date: 2000-06-06 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the Atlas board. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include +#include + +//-------------------------------------------------------------------------- +// Interrupt vectors. + +#ifndef CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED + +// These are decoded via the IP bits of the cause +// register when an external interrupt is delivered. + +#define CYGNUM_HAL_INTERRUPT_IRQ 0 +#define CYGNUM_HAL_INTERRUPT_FIQ 1 + +// Min/Max ISR numbers and how many there are +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX 1 +#define CYGNUM_HAL_ISR_COUNT 2 + +#define CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED + +#endif + +//-------------------------------------------------------------------------- +// Interrupt controller access. + + + +//-------------------------------------------------------------------------- +// Control-C support. + +#if defined(CYGDBG_HAL_MIPS_DEBUG_GDB_CTRLC_SUPPORT) + +# define CYGHWR_HAL_GDB_PORT_VECTOR CYGNUM_HAL_INTERRUPT_SER + +externC cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +# define HAL_CTRLC_ISR hal_ctrlc_isr + +#endif + + +//-------------------------------------------------------------------------- +// Microsecond delay function provided in hal_misc.c +externC void hal_delay_us(cyg_uint32 us); + +#define HAL_DELAY_US(n) hal_delay_us(n) + +//---------------------------------------------------------------------------- +// Reset. +#ifndef CYGHWR_HAL_RESET_DEFINED +#define CYGHWR_HAL_RESET_DEFINED +#define HAL_PLATFORM_RESET() + +#define HAL_PLATFORM_RESET_ENTRY 0x00000000 + +#endif // CYGHWR_HAL_RESET_DEFINED + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/calmrisc16/ceb/current/include/plf_io.h b/packages/hal/calmrisc16/ceb/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/include/plf_io.h @@ -0,0 +1,119 @@ +#ifndef CYGONCE_PLF_IO_H +#define CYGONCE_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// Platform specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-02-12 +// Purpose: CalmRISC16 platform IO support +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +// coprocessor regs +#define HAL_COP_SR_RBR 0x1c +#define HAL_COP_SR_TBR 0x1d +#define HAL_COP_TBR 0x1e +#define HAL_COP_RBR 0x1f + +#ifndef __ASSEMBLER__ + +static inline void cyg_hal_plf_write_sr_rbr(int val) +{ + asm volatile ("cld %0,%1\n" : : "i"(HAL_COP_SR_RBR), "r"(val)); +} + +static inline void cyg_hal_plf_write_sr_tbr(int val) +{ + asm volatile ("cld %0,%1\n" : : "i"(HAL_COP_SR_TBR), "r"(val)); +} + +static inline void cyg_hal_plf_write_rbr(int val) +{ + asm volatile ("cld %0,%1\n" : : "i"(HAL_COP_RBR), "r"(val)); +} + +static inline void cyg_hal_plf_write_tbr(int val) +{ + asm volatile ("cld %0,%1\n" : : "i"(HAL_COP_TBR), "r"(val)); +} + +static inline int cyg_hal_plf_read_sr_rbr(void) +{ + int val; + asm volatile ("cld %0,%1\n" : "=r"(val) : "i"(HAL_COP_SR_RBR)); + return val; +} + +static inline int cyg_hal_plf_read_sr_tbr(void) +{ + int val; + asm volatile ("cld %0,%1\n" : "=r"(val) : "i"(HAL_COP_SR_TBR)); + return val; +} + +static inline int cyg_hal_plf_read_rbr(void) +{ + int val; + asm volatile ("cld %0,%1\n" : "=r"(val) : "i"(HAL_COP_RBR)); + return val; +} + +static inline int cyg_hal_plf_read_tbr(void) +{ + int val; + asm volatile ("cld %0,%1\n" : "=r"(val) : "i"(HAL_COP_TBR)); + return val; +} +#endif + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_PLF_IO_H diff --git a/packages/hal/calmrisc16/ceb/current/include/plf_stub.h b/packages/hal/calmrisc16/ceb/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/include/plf_stub.h @@ -0,0 +1,94 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter +// Date: 2001-02-12 +// Purpose: Platform HAL stub support for CalmRISC16 eval boards. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 +#define HAL_STUB_PLATFORM_INIT_BREAK_IRQ() CYG_EMPTY_STATEMENT + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +//----------------------------------------------------------------------------- +// Syscall support. +#ifdef CYGPKG_CYGMON +// Cygmon provides syscall handling for this board +#define SIGSYSCALL SIGSYS +extern int __get_syscall_num (void); +#endif + +extern void hal_plf_write_prog_halfword(unsigned long addr, unsigned short val); + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/calmrisc16/ceb/current/misc/readme.txt b/packages/hal/calmrisc16/ceb/current/misc/readme.txt new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/misc/readme.txt @@ -0,0 +1,80 @@ +RedBoot for the Samsung CalmRISC16 core evaluation board +May 7th 2001 +README +======================================================================== + +This ReadMe contains instructions for running Redboot on the Samsung +calmRISC16 core evaluation board, and building RedBoot and ecosconfig. + +You will need the GNUPro calmrisc16-elf toolchain which should be +installed in /usr/cygnus. + +Overview +-------- +This implementation of RedBoot supports the calmRISC16 core evaluation board. +The core board has no communication channel and requires an MDSChip board to +provide a serial channel for host communication. The calmRISC16 is a harvard +architecture with separate 22-bit program and data addresses. The instruction +set provides no instruction for writing to program memory. The MDSChip board +firmware (called CalmBreaker) provides a pseudo register interface so that +code running on the core has access to a serial channel and a mechanism to +write to program memory. The serial channel is fixed at 57600-8-N-1 by the +firmware. The CalmBreaker firmware also provides a serial protocol which +allows a host to download a program and to start or stop the core board. + + +Downloading and running RedBoot +-------------------------------- +All storage on the core board is volatile, so RedBoot must be downloaded to +the board after every power cycle. Downloads require the use of a utility +program. The source file and build instructions for this utility are provided +in the RedBoot sources at: + + .../packages/hal/calmrisc16/ceb/current/support + +To download the RedBoot image, first press the reset button on the MDSChip +board. The green 'Run' LED on the core board should go off. Now, use the +utility to download the RedBoot image with: + + % calmbreaker -p /dev/term/b --reset --srec-code -f redboot.elf + +Note that the '-p /dev/term/b' specifies the serial port to use and will vary +from system to syetm. The download will take about two minutes. After it +finishes, start RedBoot with: + + % calmbreaker -p /dev/term/b --run + +The 'Run' LED on the core board should be on. Connecting to the MDSboard with +a terminal and typing enter should result in RedBoot reprinting the command +prompt. + +Rebuilding RedBoot +------------------ + +Assuming that the provided RedBoot source tree is located in the current +directory, the build process is: + + % export TOPDIR=`pwd` + % export ECOS_REPOSITORY=${TOPDIR}/packages + % mkdir ${TOPDIR}/build + % cd ${TOPDIR}/build + % ecosconfig new calm16_ceb redboot + % ecosconfig import ${ECOS_REPOSITORY}/hal/calmrisc16/current/misc/redboot_ROM.ecm + % ecosconfig tree + % make + + +Building ecosconfig +------------------- + +An ecosconfig binary is supplied in the bin directory, but you may wish +to build it from source. + +Detailed instructions for building the command-line tool ecosconfig +can be found in host/README. For example: + + mkdir $TEMP/redboot-build + cd $TEMP/redboot-build + $TOPDIR/host/configure --prefix=$TEMP/redboot-build --with-tcl=/usr + make + diff --git a/packages/hal/calmrisc16/ceb/current/misc/redboot_ROM.ecm b/packages/hal/calmrisc16/ceb/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/misc/redboot_ROM.ecm @@ -0,0 +1,65 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware ceb ; + template redboot ; + package -hardware CYGPKG_HAL_CALM16 current ; + package -hardware CYGPKG_HAL_CALM16_CORE current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_option CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; + + diff --git a/packages/hal/calmrisc16/ceb/current/src/hal_diag.c b/packages/hal/calmrisc16/ceb/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/src/hal_diag.c @@ -0,0 +1,183 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, dmoseley +// Date: 1998-03-02 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include // base types +#include // tracing macros +#include // assertion macros + +#include +#include + +#include + +#include + +//----------------------------------------------------------------------------- +// Select which diag channels to use + +//#define CYG_KERNEL_DIAG_LCD +#define CYG_KERNEL_DIAG_SERIAL + +/*---------------------------------------------------------------------------*/ + +void hal_diag_led(int x) +{ +} + +externC void diag_write_string (const char*); + +#ifdef CYG_KERNEL_DIAG_SERIAL +extern void cyg_hal_plf_comms_init(void); +extern void cyg_hal_plf_serial_putc(void*, cyg_uint8); +extern cyg_uint8 cyg_hal_plf_serial_getc(void*); +#endif + +void hal_diag_init(void) +{ +#if defined(CYGSEM_HAL_ROM_MONITOR) && !defined(CYG_KERNEL_DIAG_SERIAL) + // It's handy to have the LCD initialized at reset when using it + // for debugging output. + // The serial port likely doesn't work yet. Let's wait. + diag_write_string ("eCos ROM " __TIME__ "\n"); + diag_write_string (__DATE__ "\n"); +#endif + +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_comms_init(); +#endif +} + +#if defined(CYG_KERNEL_DIAG_LCD) +static void hal_diag_clear_lcd(void) +{ + volatile int i = 0x20000; + while (--i) ; + + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS0, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS1, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS2, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS3, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS4, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS5, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS6, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS7, ' '); +} +#endif /* defined(CYG_KERNEL_DIAG_LCD) */ + +void hal_diag_write_char(char c) +{ +#if defined(CYG_KERNEL_DIAG_LCD) + static volatile CYG_WORD* reg = HAL_DISPLAY_ASCIIPOS0; +#endif + + unsigned long __state; + + HAL_DISABLE_INTERRUPTS(__state); + + if(c == '\n') + { +#if defined(CYG_KERNEL_DIAG_LCD) + reg = HAL_DISPLAY_ASCIIPOS0; + hal_diag_clear_lcd(); +#endif +#if defined (CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_putc(NULL, '\r'); + cyg_hal_plf_serial_putc(NULL, '\n'); +#endif + } + else if (c == '\r') + { + // Ignore '\r' + } + else + { +#if defined(CYG_KERNEL_DIAG_LCD) + if (reg == HAL_DISPLAY_ASCIIPOS0) + hal_diag_clear_lcd(); + + HAL_WRITE_UINT32(reg, c); + + // Advance to next LED position. + if (reg == HAL_DISPLAY_ASCIIPOS0) + reg = HAL_DISPLAY_ASCIIPOS1; + else if (reg == HAL_DISPLAY_ASCIIPOS1) + reg = HAL_DISPLAY_ASCIIPOS2; + else if (reg == HAL_DISPLAY_ASCIIPOS2) + reg = HAL_DISPLAY_ASCIIPOS3; + else if (reg == HAL_DISPLAY_ASCIIPOS3) + reg = HAL_DISPLAY_ASCIIPOS4; + else if (reg == HAL_DISPLAY_ASCIIPOS4) + reg = HAL_DISPLAY_ASCIIPOS5; + else if (reg == HAL_DISPLAY_ASCIIPOS5) + reg = HAL_DISPLAY_ASCIIPOS6; + else if (reg == HAL_DISPLAY_ASCIIPOS6) + reg = HAL_DISPLAY_ASCIIPOS7; + else // reg == HAL_DISPLAY_ASCIIPOS7 or UNKNOWN + reg = HAL_DISPLAY_ASCIIPOS0; +#endif +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_putc(NULL, c); +#endif + } + + HAL_RESTORE_INTERRUPTS(__state); +} + +void hal_diag_read_char(char* c) +{ + *c = cyg_hal_plf_serial_getc(NULL); +} + +/*---------------------------------------------------------------------------*/ +/* End of hal_diag.c */ diff --git a/packages/hal/calmrisc16/ceb/current/src/platform.S b/packages/hal/calmrisc16/ceb/current/src/platform.S new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/src/platform.S @@ -0,0 +1,99 @@ +## +#============================================================================= +## platform.S +## +## CalmRISC16 CEB platform code +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: CalmRISC16 platform code +## Description: Platform specific code for CalmRISC16 core evb +## +## +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#ifdef CYGPKG_KERNEL +# include +#endif + +#include +#include +#include + +##----------------------------------------------------------------------------- + +##----------------------------------------------------------------------------- +# Platform Initialization. +# This code performs platform specific initialization. + +##----------------------------------------------------------------------------- +## MEMC initialization. +## + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) + +#endif /* defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) */ + +##----------------------------------------------------------------------------- +# This code sets up a stack for applications running on redboot +FUNC_START ceb_program_new_stack +#if 0 + push r4 + push lr + ld r4,sp + ldw sp,0xffff0 + jsr r0 + nop + ld sp,r4 + pop lr + jmpd lr + pop r4 +#endif +FUNC_END ceb_program_new_stack + +##----------------------------------------------------------------------------- +## end of platform.S diff --git a/packages/hal/calmrisc16/ceb/current/src/plf_misc.c b/packages/hal/calmrisc16/ceb/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/src/plf_misc.c @@ -0,0 +1,122 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour, dmoseley, msalter +// Date: 2000-06-06 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include + +#include // Base types +#include // tracing macros +#include // assertion macros + +#include // architectural definitions + +#include // Interrupt handling + +#include // Cache handling + +#include + +/*------------------------------------------------------------------------*/ + +#if defined(CYGPKG_CYGMON) +#include CYGHWR_MEMORY_LAYOUT_H +extern unsigned long cygmon_memsize; +#endif + +extern void __txchar(unsigned ch); + +void hal_platform_init(void) +{ + // Set up eCos/ROM interfaces + hal_if_init(); +} + + +/*------------------------------------------------------------------------*/ +/* Delay for some number of useconds. */ +void +hal_delay_us(cyg_uint32 us) +{ + us /= 3; + while (us-- > 0); +} + +/*------------------------------------------------------------------------*/ +/* Reset support */ + +void hal_ceb_reset(void) +{ +} + +void hal_plf_write_prog_halfword(unsigned long addr, unsigned short val) +{ + unsigned short pch = addr >> 16; + unsigned short pcl = addr & 0xffff; + + while(cyg_hal_plf_read_sr_tbr() & 1); // while TXD_FULL + cyg_hal_plf_write_tbr(pch); + cyg_hal_plf_write_sr_tbr(0x03); // addr_high short + + while(cyg_hal_plf_read_sr_tbr() & 1); // while TXD_FULL + cyg_hal_plf_write_tbr(pcl); + cyg_hal_plf_write_sr_tbr(0x05); // addr_low short + + while(cyg_hal_plf_read_sr_tbr() & 1); // while TXD_FULL + cyg_hal_plf_write_tbr(val); + cyg_hal_plf_write_sr_tbr(0x07); // program data value + + while(cyg_hal_plf_read_sr_tbr() & 1); // while TXD_FULL +} + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/packages/hal/calmrisc16/ceb/current/src/ser.c b/packages/hal/calmrisc16/ceb/current/src/ser.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/src/ser.c @@ -0,0 +1,293 @@ +//============================================================================= +// +// ser.c +// +// Simple driver for the MDSChip serial port +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter +// Date: 2001-02-12 +// Description: Simple driver for the MDSChip serial port +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interface API +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // Helper functions +#include // CYG_ISR_HANDLED + +// We have no control over baud rate +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==57600 +#define CYG_DEV_SERIAL_BAUD_DIVISOR BAUD_57600 +#endif + +#ifndef CYG_DEV_SERIAL_BAUD_DIVISOR +#error Missing/incorrect serial baud rate defined - CDL error? +#endif + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +static const channel_data_t channels[1] = { + { (cyg_uint8*)0, 1000, 0} +}; + +//----------------------------------------------------------------------------- +// The minimal init, get and put functions. All by polling. + +void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + cyg_hal_plf_write_sr_rbr(0); + cyg_hal_plf_write_sr_tbr(0); + cyg_hal_plf_write_tbr(0); + cyg_hal_plf_write_rbr(0); +} + +void +cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 __ch) +{ + // wait for tx rdy + while (cyg_hal_plf_read_sr_tbr() != 0) ; + + // Now, write it + cyg_hal_plf_write_tbr(__ch); + + // and set TBR + cyg_hal_plf_write_sr_tbr(1); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + if (cyg_hal_plf_read_sr_rbr() == 0) + return false; + + *ch = cyg_hal_plf_read_rbr(); + + cyg_hal_plf_write_sr_rbr(0); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + return ch; +} + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); +} + + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan; + cyg_bool res; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + CYGACC_CALL_IF_DELAY_US(100); + } + + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan; + int ret = 0; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + HAL_INTERRUPT_SET_LEVEL(chan->isr_vector, 1); + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + break; + case __COMMCTL_SETBAUD: + { + cyg_uint32 baud_rate; + va_list ap; + + va_start(ap, __func); + baud_rate = va_arg(ap, cyg_uint32); + va_end(ap); + + switch (baud_rate) + { + case 57600: break; + default: return -1; + } + } + break; + + case __COMMCTL_GETBAUD: + break; + default: + break; + } + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + *__ctrlc = 0; + return 0; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(channels[0].isr_vector); + + // Init channels + cyg_hal_plf_serial_init_channel((void*)&channels[0]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +//----------------------------------------------------------------------------- +// end of ser16c550c.c + diff --git a/packages/hal/calmrisc16/ceb/current/support/README b/packages/hal/calmrisc16/ceb/current/support/README new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/support/README @@ -0,0 +1,23 @@ + +The support directory provides a tool for downloading code to the calmRISC +board. This simple application communicates over a serial line (57600-8-N-1) +with the MDSChip board which in turn controls the core eval board. + +Building the tool: + + % gcc -g -O2 calmbreaker.c -o calmbreaker + +Using the tool: + + calmbreaker [--reset] [--run] [-p serialdev] [--srec-code | --srec-data] + [-f filename] + + --reset ==> Reset the board. Stops the core. + --run ==> Start the core running at the reset vector + -p ==> Specify the serial device + --srec-code ==> Download s-records to program memory + --srec-date ==> Download s-records to data memory + -f ==> Specify s-record file. If -f is missing, use + stdin. + + diff --git a/packages/hal/calmrisc16/ceb/current/support/calmbreaker.c b/packages/hal/calmrisc16/ceb/current/support/calmbreaker.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/ceb/current/support/calmbreaker.c @@ -0,0 +1,541 @@ +/*============================================================================= +// +// calmbreaker.c +// +// Host to CalmBreaker communication utility. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-03-02 +// Purpose: +// Description: Host to CalmBreaker communication utility. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include +#include + +int ser_fd; // The com port +int is_risc16; + +void +tty_setup(int fd) +{ + struct termios t; + + memset(&t, 0, sizeof(struct termios)); + + t.c_oflag = 0; + t.c_lflag = 0; + + t.c_cflag &= ~(CSIZE | PARENB); + t.c_cflag |= CS8 | CREAD /*| CSTOPB*/; + t.c_cflag |= CLOCAL; // ignore modem status lines + + t.c_iflag = IGNBRK | IGNPAR /* | ISTRIP */ ; + + t.c_lflag &= ~ICANON; // non-canonical mode + t.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHOKE); + + t.c_cc[VMIN] = 0; + t.c_cc[VTIME] = 10; // 1 second timeout + + t.c_cflag &= ~CRTSCTS; + + /* set speed */ + cfsetispeed(&t, B57600); + cfsetospeed(&t, B57600); + + tcdrain(fd); + + if (tcsetattr(fd, TCSANOW, &t) < 0) + { + perror("tcssetattr"); + exit(1); + } +} + +static void +do_putc(unsigned char ch) +{ + // keep retrying until sent or an error is returned + while (write(ser_fd, &ch, 1) == 0); +} + +static int +do_getc(unsigned char *ucp) +{ + return read(ser_fd, ucp, 1); +} + +static int +wait_for_ack(void) +{ + unsigned char ch; + int i; + + // try for 5 seconds + for (i = 0; i < 5; i++) { + if (do_getc(&ch)) { + if (ch == '+') + return 1; + printf("Bad ack [0x%x]\n", ch); + } + } + printf("No ack\n"); + return 0; +} + +// Add prefix and checksum to packet and send to MDS board. +void +send_packet_noack(unsigned char *pkt, int len) +{ + unsigned char cksum = 0; + + do_putc(':'); + + while (len-- > 0) { + cksum += *pkt; + do_putc(*pkt++); + } + + do_putc(0x100 - cksum); +} + +// Add prefix and checksum to packet and send to MDS board. +void +send_packet(unsigned char *pkt, int len) +{ + send_packet_noack(pkt, len); + wait_for_ack(); +} + + + +// Send a packet of code or data (max 0xff bytes) +int +send_data_packet(int is_data, unsigned addr, unsigned char *buf, int buflen) +{ + unsigned char uc, cksum = 0; + int i; + + do_putc(':'); + + // code or data? + uc = is_data ? 0x52 : 0x51; + cksum += uc; + do_putc(uc); + + // code/data nwords? + uc = buflen >> 1; + cksum += uc; + do_putc(uc); + + // code/data address + uc = (unsigned char)(addr >> 24); + cksum += uc; + do_putc(uc); + uc = (unsigned char)(addr >> 16); + cksum += uc; + do_putc(uc); + uc = (unsigned char)(addr >> 8); + cksum += uc; + do_putc(uc); + uc = (unsigned char)addr; + cksum += uc; + do_putc(uc); + + while (buflen-- > 0) { + cksum += *buf; + do_putc(*buf++); + } + + do_putc(0x100 - cksum); + + return wait_for_ack(); +} + + +void +send_command(unsigned char uc) +{ + send_packet(&uc, 1); +} + +void +send_command_noack(unsigned char uc) +{ + send_packet_noack(&uc, 1); +} + +// Simple single-byte commands +void target_reset(void) { send_command(0x20); } +void target_singlestep(void) { send_command(0x22); } +void target_singlecycle(void) { send_command(0x23); } +void target_stop(void) { send_command(0x24); } +void target_run(void) { send_command_noack(0x25); } + +#define DOWNLOAD_CHUNK_SIZE 254 + +int +download_words(int is_data, unsigned addr, unsigned char *buf, int buflen) +{ + while (buflen >= DOWNLOAD_CHUNK_SIZE) { + if (!send_data_packet(is_data, addr, buf, DOWNLOAD_CHUNK_SIZE)) { + printf("Error downloading %d bytes of %s to 0x%x\n", + DOWNLOAD_CHUNK_SIZE, (is_data ? "data" : "code"), addr); + return 0; + } + addr += DOWNLOAD_CHUNK_SIZE; + buf += DOWNLOAD_CHUNK_SIZE; + buflen -= DOWNLOAD_CHUNK_SIZE; + } + if (buflen && !send_data_packet(is_data, addr, buf, buflen)) { + printf("Error downloading %d bytes of %s to 0x%x\n", + buflen, (is_data ? "data" : "code"), addr); + return 0; + } + return 1; +} + +static inline int +gethexnibble(FILE *fp) +{ + int ch; + + ch = getc(fp); + if (ch >= '0' && ch <= '9') + return (ch - '0'); + if (ch >= 'a' && ch <= 'f') + return (ch - 'a' + 10); + if (ch >= 'A' && ch <= 'F') + return (ch - 'A' + 10); + + if (ch == EOF) + fprintf(stderr, "Unexpected EOF\n"); + else + fprintf(stderr, "Bad hex char\n"); + + return -1; +} + + +static inline int +gethexbyte(FILE *fp) +{ + int nib; + unsigned char n; + + if ((nib = gethexnibble(fp)) < 0) + return -1; + n = nib << 4; + if ((nib = gethexnibble(fp)) < 0) + return -1; + n |= nib; + return n; +} + +static inline int +chk_cksum(FILE *fp, unsigned int cksum) +{ + int n; + + if ((n = gethexbyte(fp)) < 0) + return -1; + + cksum = ~cksum & 0xff; + + if (cksum != n) { + fprintf(stderr, "Bad cksum[%02x]\n", cksum); + return -1; + } + return 0; +} + +int +load_srec(FILE *fp, int is_data) +{ + int count, dcount, data, n, addr_bytes = 0, is_term, is_comment; + unsigned long address, cksum; + unsigned char data_buf[256]; + + is_comment = is_term = 0; + + do { + if ((n = getc(fp)) == EOF) + return 1; + } while (n != 'S'); + + switch (n = gethexnibble(fp)) { + case 0: + case 5: + is_comment = 1; + break; + + case 1: + case 2: + case 3: + addr_bytes = n + 1; + break; + + case 7: + case 8: + case 9: + is_term = 1; + addr_bytes = 11 - n; + break; + + default: + if (n < 0) + return -1; + fprintf(stderr, "Bad record type: %d\n", n); + return -1; + } + + if ((count = gethexbyte(fp)) < 0) + return -1; + + cksum = count; + + --count; // don't count chksum + + if (is_comment) { + while (count > 0) { + if ((n = gethexbyte(fp)) < 0) + return -1; + cksum += n; + --count; + } + if (chk_cksum(fp,cksum) < 0) + return -1; + return 0; + } + + address = 0; + while (count > 0 && addr_bytes) { + if ((n = gethexbyte(fp)) < 0) + return -1; + cksum += n; + address = (address << 8) | n; + --addr_bytes; + --count; + } + + if (is_risc16 && (address & 0x400000)) + address &= 0x3fffff; + + if (is_term) { + if (count || addr_bytes) { + fprintf(stderr, "Malformed record cnt[%d] abytes[%d]\n", + count, addr_bytes); + return -1; + } + if (chk_cksum(fp, cksum) == 0) { + fprintf(stderr, "Setting start address: 0x%08x\n", address); + return 1; + } + return -1; + } + + for (dcount = 0; dcount < count; dcount++) { + if ((data = gethexbyte(fp)) < 0) + return -1; + cksum += data; + data_buf[dcount] = data; + } + + if (chk_cksum(fp, cksum) < 0) + return -1; + + if (dcount & 1) + dcount++; + + if (!download_words(is_data, address, data_buf, dcount)) + return -1; + + return 0; +} + + +int +load_hex(FILE *fp, int is_data) +{ + int count, n, i; + unsigned long address; + unsigned char data_buf[256]; + + do { + if ((n = getc(fp)) == EOF) + return 1; + } while (n == '\r' || n == '\n'); + + if (n == '#') { + do { + if ((n = getc(fp)) == EOF) + return 1; + } while (n != '\r' && n != '\n'); + return 0; + } + + if (n != ':') { + fprintf(stderr, "Unrecognized HEX line start.\n"); + return -1; + } + + if ((count = gethexbyte(fp)) < 0) + return -1; + + address = 0; + for (i = 0; i < 4; i++) { + if ((n = gethexbyte(fp)) < 0) + return -1; + address = (address << 8) | n; + } + + // skip type byte + if ((n = gethexbyte(fp)) < 0) + return -1; + + for (i = 0; i < count; i++) { + if ((n = gethexbyte(fp)) < 0) + return -1; + data_buf[i] = n; + } + + // skip chksum byte + if ((n = gethexbyte(fp)) < 0) + return -1; + + if (count & 1) + ++count; + + if (!download_words(is_data, address, data_buf, count)) + return -1; + + return 0; +} + + +int +main(int argc, char *argv[]) +{ + int i; + int do_download = 0, is_data, is_hex; + int do_run = 0, do_reset = 0; + char *filename = NULL; + char *portname = "/dev/ttyS0"; + FILE *infile; + + if (argc == 1) { + fprintf(stderr, "Usage: mds_talk [--run] [--reset] [--srec-code | --srec-date | --hex-code | --hex-data] [-f filename] [-p serial_dev]\n"); + exit(1); + } + + is_risc16 = 0; + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--srec-code")) { + do_download = 1; + is_data = 0; + is_hex = 0; + } else if (!strcmp(argv[i], "--srec-data")) { + do_download = 1; + is_data = 1; + is_hex = 0; + } else if (!strcmp(argv[i], "--hex-code")) { + do_download = 1; + is_data = 0; + is_hex = 1; + } else if (!strcmp(argv[i], "--hex-data")) { + do_download = 1; + is_data = 1; + is_hex = 1; + } else if (!strcmp(argv[i], "--reset")) + do_reset = 1; + else if (!strcmp(argv[i], "--run")) + do_run = 1; + else if (!strcmp(argv[i], "-f")) { + if (++i >= argc) { + fprintf(stderr, "Missing filename\n"); + exit(1); + } + filename = argv[i]; + } else if (!strcmp(argv[i], "-p")) { + if (++i >= argc) { + fprintf(stderr, "Missing serial port name\n"); + exit(1); + } + portname = argv[i]; + } else if (!strcmp(argv[i], "--risc16")) { + is_risc16 = 1; + } else { + fprintf(stderr, "Unknown argument \"%s\"\n", argv[i]); + exit(1); + } + } + + if ((ser_fd = open(portname, O_RDWR | O_NOCTTY)) < 0) { + fprintf(stderr, "Can't open port %s\n", portname); + exit(1); + } + tty_setup(ser_fd); + + if (filename) { + if ((infile = fopen(filename, "r")) == NULL) { + fprintf(stderr, "Can't open file %s\n", filename); + exit(1); + } + } else + infile = stdin; + + if (do_reset) + target_reset(); + + if (do_download) { + if (is_hex) + while (!load_hex(infile, is_data)) ; + else + while (!load_srec(infile, is_data)) ; + } + + if (do_run) + target_run(); +} diff --git a/packages/hal/calmrisc16/core/current/ChangeLog b/packages/hal/calmrisc16/core/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/core/current/ChangeLog @@ -0,0 +1,38 @@ +2001-06-08 Jonathan Larmour + + * include/var_cache.h: Correctly indicate absence of cache. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/calmrisc16/core/current/cdl/hal_calm16_core.cdl b/packages/hal/calmrisc16/core/current/cdl/hal_calm16_core.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/core/current/cdl/hal_calm16_core.cdl @@ -0,0 +1,129 @@ +# ==================================================================== +# +# hal_calm16_core.cdl +# +# CalmRISC16 core variant architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): msalter +# Original data: bartv, nickg +# Contributors: +# Date: 2001-02-12 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_CALM16_CORE { + display "Core variant" + parent CYGPKG_HAL_CALM16 + hardware + include_dir cyg/hal + description " + The Calm16 core architecture HAL package provides generic support + for this processor architecture. It is also necessary to + select a specific target platform HAL package." + + implements CYGINT_HAL_CALM16_VARIANT + + define_proc { + puts $::cdl_header "#include " + } + + compile var_misc.c variant.S + + make { + /lib/target.ld: /src/calm16_core.ld + $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 target.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm target.tmp + } + + cdl_option CYGBLD_LINKER_SCRIPT { + display "Linker script" + flavor data + no_define + calculated { "src/calm16_core.ld" } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "calmrisc16-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -fno-builtin" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-g -nostdlib -Wl,-static -Wl,-Map,redboot.map" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + } + +} diff --git a/packages/hal/calmrisc16/core/current/include/var_arch.h b/packages/hal/calmrisc16/core/current/include/var_arch.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/core/current/include/var_arch.h @@ -0,0 +1,65 @@ +#ifndef CYGONCE_HAL_VAR_ARCH_H +#define CYGONCE_HAL_VAR_ARCH_H + +//========================================================================== +// +// var_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Original work: nickg, dmoseley +// Date: 1999-02-17 +// Purpose: Define architecture abstractions +// Description: This file contains any extra or modified definitions for +// this variant of the architecture. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#ifndef __ASSEMBLER__ +#include +#include +#endif + +//-------------------------------------------------------------------------- +#endif // CYGONCE_HAL_VAR_ARCH_H +// End of var_arch.h diff --git a/packages/hal/calmrisc16/core/current/include/var_cache.h b/packages/hal/calmrisc16/core/current/include/var_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/core/current/include/var_cache.h @@ -0,0 +1,182 @@ +#ifndef CYGONCE_VAR_CACHE_H +#define CYGONCE_VAR_CACHE_H + +//============================================================================= +// +// var_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-02-12 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include +#include +#include + + +//----------------------------------------------------------------------------- +// Cache dimensions + +// Data cache +//#define HAL_DCACHE_SIZE 0 // Size of data cache in bytes +//#define HAL_DCACHE_LINE_SIZE 0 // Size of a data cache line +//#define HAL_DCACHE_WAYS 0 // Associativity of the cache + +// Instruction cache +//#define HAL_ICACHE_SIZE 0 // Size of cache in bytes +//#define HAL_ICACHE_LINE_SIZE 0 // Size of a cache line +//#define HAL_ICACHE_WAYS 0 // Associativity of the cache + +//#define HAL_DCACHE_SETS 0 +//#define HAL_ICACHE_SETS 0 + +//#define HAL_DCACHE_WRITETHRU_MODE 1 +//#define HAL_DCACHE_WRITEBACK_MODE 0 + +//----------------------------------------------------------------------------- +// Global control of data cache + +// Invalidate the entire cache +#define HAL_DCACHE_INVALIDATE_ALL_DEFINED +#define HAL_DCACHE_INVALIDATE_ALL() + +// Synchronize the contents of the cache with memory. +#define HAL_DCACHE_SYNC_DEFINED +#define HAL_DCACHE_SYNC() + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_asize_) + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +#define HAL_DCACHE_LOCK_DEFINED +#define HAL_DCACHE_LOCK(_base_, _asize_) + +// Undo a previous lock operation +#define HAL_DCACHE_UNLOCK_DEFINED +#define HAL_DCACHE_UNLOCK(_base_, _asize_) + +// Unlock entire cache +#define HAL_DCACHE_UNLOCK_ALL_DEFINED +#define HAL_DCACHE_UNLOCK_ALL() + + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _asize_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +#define HAL_DCACHE_FLUSH_DEFINED +#define HAL_DCACHE_FLUSH( _base_ , _asize_ ) + + +// Write dirty cache lines to memory for the given address range. +#define HAL_DCACHE_STORE_DEFINED +#define HAL_DCACHE_STORE( _base_ , _asize_ ) + +// Invalidate cache lines in the given range without writing to memory. +#define HAL_DCACHE_INVALIDATE_DEFINED +#define HAL_DCACHE_INVALIDATE( _base_ , _asize_ ) + + +//----------------------------------------------------------------------------- +// Global control of Instruction cache + +// Invalidate the entire cache +#define HAL_ICACHE_INVALIDATE_ALL_DEFINED +#define HAL_ICACHE_INVALIDATE_ALL() + +// Synchronize the contents of the cache with memory. +#define HAL_ICACHE_SYNC_DEFINED +#define HAL_ICACHE_SYNC() + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_asize_) + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +#define HAL_ICACHE_LOCK_DEFINED +#define HAL_ICACHE_LOCK(_base_, _asize_) + +// Undo a previous lock operation +#define HAL_ICACHE_UNLOCK_DEFINED +#define HAL_ICACHE_UNLOCK(_base_, _asize_) + +// Unlock entire cache +#define HAL_ICACHE_UNLOCK_ALL_DEFINED +#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +#define HAL_ICACHE_INVALIDATE_DEFINED +#define HAL_ICACHE_INVALIDATE( _base_ , _asize_ ) + +//----------------------------------------------------------------------------- +// For the flash driver. + +#define HAL_FLASH_CACHES_WANT_OPTIMAL + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_VAR_CACHE_H +// End of var_cache.h diff --git a/packages/hal/calmrisc16/core/current/include/var_intr.h b/packages/hal/calmrisc16/core/current/include/var_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/core/current/include/var_intr.h @@ -0,0 +1,71 @@ +#ifndef CYGONCE_HAL_VAR_INTR_H +#define CYGONCE_HAL_VAR_INTR_H + +//========================================================================== +// +// imp_intr.h +// +// CalmRISC16 Core Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-02-12 +// Purpose: MIPS32 Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for variants of the MIPS32 +// architecture. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include + +#include + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_VAR_INTR_H +// End of var_intr.h diff --git a/packages/hal/calmrisc16/core/current/include/variant.inc b/packages/hal/calmrisc16/core/current/include/variant.inc new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/core/current/include/variant.inc @@ -0,0 +1,129 @@ +#ifndef CYGONCE_HAL_VARIANT_INC +#define CYGONCE_HAL_VARIANT_INC +##============================================================================= +## +## variant.inc +## +## CalmRISC16 Core family assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: Calm16 Core family definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the CalmRISC16 family. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include + +#include + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include + +##----------------------------------------------------------------------------- +## Define CPU variant for architecture HAL. + +#define CYG_HAL_CALM16_CORE + +#------------------------------------------------------------------------------ +# Cache macros. + +#ifndef CYGPKG_HAL_CALM16_CACHE_DEFINED + + .macro hal_cache_init + .endm + +#define CYGPKG_HAL_CALM16_CACHE_DEFINED + +#endif + +#------------------------------------------------------------------------------ +# Monitor initialization. + +#ifndef CYGPKG_HAL_CALM16_MON_DEFINED + +#if defined(CYG_HAL_STARTUP_ROM) || \ + ( defined(CYG_HAL_STARTUP_RAM) && \ + !defined(CYGSEM_HAL_USE_ROM_MONITOR)) + # If we are starting up from ROM, or we are starting in + # RAM and NOT using a ROM monitor, initialize the VSR table. + + .macro hal_mon_init + .endm + +#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR) + + # Initialize the VSR table entries + # We only take control of the interrupt vector, + # the rest are left to the ROM for now... + + .macro hal_mon_init + .endm + +#else + + .macro hal_mon_init + .endm + +#endif + + +#define CYGPKG_HAL_CALM16_MON_DEFINED + +#endif + +#------------------------------------------------------------------------------ +# Decide whether the VSR table is defined externally, or is to be defined +# here. + +//#define CYG_HAL_CALM16_VSR_TABLE_DEFINED + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_VARIANT_INC +# end of variant.inc diff --git a/packages/hal/calmrisc16/core/current/src/calm16_core.ld b/packages/hal/calmrisc16/core/current/src/calm16_core.ld new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/core/current/src/calm16_core.ld @@ -0,0 +1,357 @@ +//=========================================================================== +// +// MLT linker script for CalmRISC16 Core +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + +#include + +OUTPUT_FORMAT("elf32-calmrisc16", "elf32-calmrisc16", + "elf32-calmrisc16") + +OUTPUT_ARCH(calmrisc16) + +STARTUP(vectors.o) +ENTRY(_reset_vector) +#ifdef EXTRAS +INPUT(extras.o) +#endif +GROUP(libtarget.a libgcc.a) + +#define ALIGN_LMA 0x40 +#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1)) +#define LMA_EQ_VMA +#define FORCE_OUTPUT . = . + +#define SECTIONS_BEGIN + +#if defined(CYG_HAL_STARTUP_RAM) + +/* this version for RAM startup */ +#define SECTION_vectors(_region_, _vma_, _lma_) \ + .vectors _vma_ : _lma_ \ + { KEEP (*(.vectors)) } \ + > _region_ + +#elif defined(CYG_HAL_STARTUP_ROM) + +/* this version for ROM startup */ +#define SECTION_vectors(_region_, _vma_, _lma_) \ + .vectors _vma_ : _lma_ \ + { KEEP (*(.vectors)) } > _region_ + +#endif /* ROM startup version of ROM vectors */ + +#define SECTION_ROMISC(_region_, _vma_, _lma_) \ + .interp _vma_ : _lma_ { *(.interp) } > _region_ \ + .hash : FOLLOWING(.interp) { *(.hash) } > _region_ \ + .dynsym : FOLLOWING(.hash) { *(.dynsym) } > _region_ \ + .dynstr : FOLLOWING(.dynsym) { *(.dynstr) } > _region_ \ + .gnu.version : FOLLOWING(.dynstr) { *(.gnu.version) } > _region_ \ + .gnu.version_d : FOLLOWING(.gnu.version) { *(.gnu.version_d) } > _region_ \ + .gnu.version_r : FOLLOWING(.gnu.version_d) { *(.gnu.version_r) } > _region_ + +#define SECTION_RELOCS(_region_, _vma_, _lma_) \ + .rel.text : \ + { \ + *(.rel.text) \ + *(.rel.text.*) \ + *(.rel.gnu.linkonce.t*) \ + } > _region_ \ + .rela.text : \ + { \ + *(.rela.text) \ + *(.rela.text.*) \ + *(.rela.gnu.linkonce.t*) \ + } > _region_ \ + .rel.data : \ + { \ + *(.rel.data) \ + *(.rel.data.*) \ + *(.rel.gnu.linkonce.d*) \ + } > _region_ \ + .rela.data : \ + { \ + *(.rela.data) \ + *(.rela.data.*) \ + *(.rela.gnu.linkonce.d*) \ + } > _region_ \ + .rel.rodata : \ + { \ + *(.rel.rodata) \ + *(.rel.rodata.*) \ + *(.rel.gnu.linkonce.r*) \ + } > _region_ \ + .rela.rodata : \ + { \ + *(.rela.rodata) \ + *(.rela.rodata.*) \ + *(.rela.gnu.linkonce.r*) \ + } > _region_ \ + .rel.got : { *(.rel.got) } > _region_ \ + .rela.got : { *(.rela.got) } > _region_ \ + .rel.ctors : { *(.rel.ctors) } > _region_ \ + .rela.ctors : { *(.rela.ctors) } > _region_ \ + .rel.dtors : { *(.rel.dtors) } > _region_ \ + .rela.dtors : { *(.rela.dtors) } > _region_ \ + .rel.init : { *(.rel.init) } > _region_ \ + .rela.init : { *(.rela.init) } > _region_ \ + .rel.fini : { *(.rel.fini) } > _region_ \ + .rela.fini : { *(.rela.fini) } > _region_ \ + .rel.bss : { *(.rel.bss) } > _region_ \ + .rela.bss : { *(.rela.bss) } > _region_ \ + .rel.plt : { *(.rel.plt) } > _region_ \ + .rela.plt : { *(.rela.plt) } > _region_ \ + .rel.dyn : { *(.rel.dyn) } > _region_ + +#define SECTION_init(_region_, _vma_, _lma_) \ + .init _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; KEEP (*(.init)) \ + } > _region_ =0x9e90 + +#define SECTION_text(_region_, _vma_, _lma_) \ + .text _vma_ : _lma_ \ + { \ + _stext = .; _ftext = . ; \ + *(.text) \ + *(.text.*) \ + *(.stub) \ + *(.gnu.warning) \ + *(.gnu.linkonce.t*) \ + } > _region_ =0x9e90 \ + _etext = .; PROVIDE (etext = .); + +#define SECTION_fini(_region_, _vma_, _lma_) \ + .fini _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; KEEP (*(.fini)) \ + } > _region_ =0x9e90 + +#define SECTION_rodata(_region_, _vma_, _lma_) \ + .rodata _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) \ + } > _region_ + +#define SECTION_rodata1(_region_, _vma_, _lma_) \ + .rodata1 _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.rodata1) *(.rodata1.*) \ + } > _region_ + +#define SECTION_vsr_table(_region_, _vma_, _lma_) \ + .vsr_table _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.vsr_table) \ + } > _region_ + +#define SECTION_data(_region_, _vma_, _lma_) \ + .data _vma_ : _lma_ \ + { \ + ___ram_data_start = ABSOLUTE (.); _fdata = . ; \ + *(.data) *(.data.*) *(.gnu.linkonce.d*) \ + . = ALIGN (8); \ + SORT(CONSTRUCTORS) \ + } > _region_ \ + ___rom_data_start = LOADADDR(.data); + +#define SECTION_data1(_region_, _vma_, _lma_) \ + .data1 _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.data1) *(.data1.*) \ + } > _region_ + +#define SECTION_eh_frame(_region_, _vma_, _lma_) \ + .eh_frame _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.eh_frame) \ + } > _region_ + +#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ + .gcc_except_table _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.gcc_except_table) \ + } > _region_ + + + /* 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. */ + + /* We don't want to include the .ctors section 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 */ + +/* FIXME: We shouldn't need to define __CTOR_LIST__/__CTOR_END__ + and __DTOR_LIST__/__DTOR_END__ except by the PROVIDE lines. + However this doesn't work for old (99r1-era) toolchains, so + leave it for now. */ + +#define SECTION_ctors(_region_, _vma_, _lma_) \ + .ctors _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; \ + KEEP (*crtbegin.o(.ctors)) \ + ___CTOR_LIST__ = .; \ + PROVIDE (___CTOR_LIST__ = .); \ + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) \ + KEEP (*(SORT(.ctors.*))) \ + KEEP (*(.ctors)) \ + ___CTOR_END__ = .; \ + PROVIDE (___CTOR_END__ = .); \ + } > _region_ + +#define SECTION_dtors(_region_, _vma_, _lma_) \ + .dtors _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; \ + KEEP (*crtbegin.o(.dtors)) \ + ___DTOR_LIST__ = .; \ + PROVIDE (___DTOR_LIST__ = .); \ + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) \ + KEEP (*(SORT(.dtors.*))) \ + KEEP (*(.dtors)) \ + ___DTOR_END__ = .; \ + PROVIDE (___DTOR_END__ = .); \ + } > _region_ + +#define SECTION_devtab(_region_, _vma_, _lma_) \ + .devtab _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; \ + KEEP(*( SORT (.ecos.table.*))) ; \ + } > _region_ + +#define SECTION_got(_region_, _vma_, _lma_) \ + _gp = ALIGN(16) + 0x7ff0; \ + .got _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.got.plt) *(.got) \ + } > _region_ + +#define SECTION_dynamic(_region_, _vma_, _lma_) \ + .dynamic _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.dynamic) \ + } > _region_ + + /* 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. */ + +#define SECTION_sdata(_region_, _vma_, _lma_) \ + .sdata _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnulinkonce.s*) \ + } > _region_ + +#define SECTION_lit8(_region_, _vma_, _lma_) \ + .lit8 _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.lit8) \ + } > _region_ + +#define SECTION_lit4(_region_, _vma_, _lma_) \ + .lit4 : FOLLOWING(.lit8) \ + { \ + FORCE_OUTPUT; *(.lit4) \ + } > _region_ \ + ___ram_data_end = .; _edata = . ; \ + PROVIDE (edata = .); + +#define SECTION_sbss(_region_, _vma_, _lma_) \ + ___bss_start = .; _fbss = .; \ + .sbss _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.dynsbss) *(.sbss) *(.sbss.*) *(.gnu.linkonce.sb.*) *(.scommon) \ + } > _region_ + +#define SECTION_bss(_region_, _vma_, _lma_) \ + .bss _vma_ : _lma_ \ + { \ + *(.dynbss) *(.bss) *(.bss.*) *(.gnu.linkonce.b.*) *(COMMON) \ + } > _region_ \ + ___bss_end = .; + +/* The /DISCARD/ section ensures that the output will not contain a + * .mdebug section as it confuses GDB. This is a workaround for CR 100804. + */ + +#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); \ + /* 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) } \ + .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) } + +#include CYGHWR_MEMORY_LAYOUT_LDI + diff --git a/packages/hal/calmrisc16/core/current/src/var_misc.c b/packages/hal/calmrisc16/core/current/src/var_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/core/current/src/var_misc.c @@ -0,0 +1,107 @@ +//========================================================================== +// +// var_misc.c +// +// HAL implementation miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour, dmoseley, msalter +// Date: 2000-07-14 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // Base types +#include // tracing macros +#include // assertion macros + +#include + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include +#include +#include +#include + +/*------------------------------------------------------------------------*/ +// Array which stores the configured priority levels for the configured +// interrupts. + +volatile CYG_BYTE hal_interrupt_level[CYGNUM_HAL_ISR_COUNT]; + +/*------------------------------------------------------------------------*/ + +void hal_variant_init(void) +{ +} + + +/*------------------------------------------------------------------------*/ +// Initialize the caches + +int hal_init_icache(unsigned long config1_val) +{ + return 0; +} + +int hal_init_dcache(unsigned long config1_val) +{ + return 0; +} + +void hal_c_cache_init(unsigned long config1_val) +{ +} + +void hal_icache_sync(void) +{ +} + +void hal_dcache_sync(void) +{ +} + +/*------------------------------------------------------------------------*/ +/* End of var_misc.c */ diff --git a/packages/hal/calmrisc16/core/current/src/variant.S b/packages/hal/calmrisc16/core/current/src/variant.S new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc16/core/current/src/variant.S @@ -0,0 +1,76 @@ +##============================================================================= +## +## variant.S +## +## CalmRISC16 Core variant code +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: CalmRISC16 Core variant code +## Description: Variant specific code for CalmRISC16 architecture. +## +## +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS + +#ifdef CYGPKG_KERNEL +# include +#endif + +#include + +#include +#include + +##----------------------------------------------------------------------------- +# Variant Initialization. +# This code performs variant specific initialization. + +##----------------------------------------------------------------------------- +## end of variant.S + diff --git a/packages/hal/calmrisc32/arch/current/ChangeLog b/packages/hal/calmrisc32/arch/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/ChangeLog @@ -0,0 +1,56 @@ +2002-04-15 Jonathan Larmour + + * src/hal_syscall.c (hal_syscall_handler): Add extra sig argument to + __do_syscall. + +2001-11-16 Nick Garnett + + * src/hal_misc.c (hal_msbit_index): Fixed this function so that it + actually works! + +2001-06-08 Jonathan Larmour + + * include/hal_cache.h: Correctly indicate absence of cache. + +2001-03-26 Mark Salter + + * src/vectors.S: Fix saving of R8 in exception handlers. + + * src/calm32-stub.c (__read_prog_uint32): Add missing return val. + + * include/calm32-stub.h: Add extern declaration for __sp_regnum. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/calmrisc32/arch/current/cdl/hal_calm32.cdl b/packages/hal/calmrisc32/arch/current/cdl/hal_calm32.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/cdl/hal_calm32.cdl @@ -0,0 +1,101 @@ +# ==================================================================== +# +# hal_calm32.cdl +# +# CalmRISC32 architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): msalter +# Original data: bartv, nickg +# Contributors: +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_CALM32 { + display "CalmRISC32 architecture" + parent CYGPKG_HAL + hardware + include_dir cyg/hal + define_header hal_calm32.h + description " + The CalmRISC32 architecture HAL package provides generic support + for this processor architecture. It is also necessary to + select a CPU variant and a specific target platform HAL + package." + + cdl_interface CYGINT_HAL_CALM32_VARIANT { + display "Number of variant implementations in this configuration" + requires 1 == CYGINT_HAL_CALM32_VARIANT + } + + compile hal_misc.c context.S calm32-stub.c hal_syscall.c + + make { + /lib/vectors.o : /src/vectors.S + $(CC) -Wp,-MD,vectors.tmp $(INCLUDE_PATH) $(CFLAGS) -c -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 vectors.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm vectors.tmp + } + + cdl_option CYGHWR_HAL_CALM32_CPU_FREQ { + display "CPU frequency" + flavor data + legal_values 0 to 1000000 + default_value 50 + description " + This option contains the frequency of the CPU in MegaHertz. + Choose the frequency to match the processor you have. This + may affect thing like serial device, interval clock and + memory access speed settings." + } + + cdl_option CYGDBG_HAL_CALM32_DEBUG_GDB_CTRLC_SUPPORT { + display "Architecture GDB CTRLC support" + calculated { CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT || CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT } + active_if { CYGINT_HAL_DEBUG_GDB_CTRLC_UNSUPPORTED == 0 } + description " + If either the CTRLC or BREAK support options in hal.h are set + then set our own option to turn on shared generic support for + control C handling." + } +} diff --git a/packages/hal/calmrisc32/arch/current/include/arch.inc b/packages/hal/calmrisc32/arch/current/include/arch.inc new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/include/arch.inc @@ -0,0 +1,157 @@ +#ifndef CYGONCE_HAL_ARCH_INC +#define CYGONCE_HAL_ARCH_INC +##============================================================================= +## +## arch.inc +## +## CalmRISC32 assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: nickg, dmoseley +## Date: 1997-10-16 +## Purpose: Architecture definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the CalmRISC32 CPU family. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include + +##----------------------------------------------------------------------------- +## CalmRISC32 thread and interrupt saved state. This must match the layout of +## the HAL_SavedRegisters in hal_arch.h. Do not change this without changing +## the layout there, or viceversa. + + +##----------------------------------------------------------------------------- +## CPU specific macros. These provide a common assembler interface to +## operations that may have CPU specific implementations on different +## variants of the architecture. + + # Initialize CPU + .macro hal_cpu_init + .endm + + # Enable interrupts + .macro hal_cpu_int_enable + .endm + + # Disable interrupts + .macro hal_cpu_int_disable + .endm + +#------------------------------------------------------------------------------ +# MMU macros. + +#ifndef CYGPKG_HAL_CALM32_MMU_DEFINED + + .macro hal_mmu_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# MEMC macros. + +#ifndef CYGPKG_HAL_CALM32_MEMC_DEFINED + + .macro hal_memc_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# Cache macros. + +#ifndef CYGPKG_HAL_CALM32_CACHE_DEFINED + + .macro hal_cache_init + .endm +#endif + + +#------------------------------------------------------------------------------ +# Diagnostics macros. + +#ifndef CYGPKG_HAL_CALM32_DIAG_DEFINED + + .macro hal_diag_init + .endm + + .macro hal_diag_excpt_start + .endm + + .macro hal_diag_intr_start + .endm + + .macro hal_diag_restore + .endm +#endif + +#------------------------------------------------------------------------------ +# Timer initialization. + +#ifndef CYGPKG_HAL_CALM32_TIMER_DEFINED + + .macro hal_timer_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# Monitor initialization. + +#ifndef CYGPKG_HAL_CALM32_MON_DEFINED + + .macro hal_mon_init + .endm + +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_ARCH_INC +# end of arch.inc diff --git a/packages/hal/calmrisc32/arch/current/include/basetype.h b/packages/hal/calmrisc32/arch/current/include/basetype.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/include/basetype.h @@ -0,0 +1,75 @@ +#ifndef CYGONCE_HAL_BASETYPE_H +#define CYGONCE_HAL_BASETYPE_H + +//============================================================================= +// +// basetype.h +// +// Standard types for this architecture. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, msalter +// Date: 1998-02-05 +// Purpose: Define architecture base types. +// Usage: Included by , do not use directly +// +//####DESCRIPTIONEND#### +// + +#include + +//----------------------------------------------------------------------------- +// Characterize the architecture + +#define CYG_BYTEORDER CYG_MSBFIRST // Big endian + + + +//----------------------------------------------------------------------------- +// CalmRISC32 does not usually use labels with undersores. + +#define CYG_LABEL_NAME(_name_) _name_ + +//----------------------------------------------------------------------------- +// Define the standard variable sizes + + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_BASETYPE_H +// End of basetype.h diff --git a/packages/hal/calmrisc32/arch/current/include/calm32-regs.h b/packages/hal/calmrisc32/arch/current/include/calm32-regs.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/include/calm32-regs.h @@ -0,0 +1,87 @@ +#ifndef CYGONCE_HAL_CALM32_REGS_H +#define CYGONCE_HAL_CALM32_REGS_H +//======================================================================== +// +// calm32-regs.h +// +// Register defines for CalmRISC 16 processors +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Red Hat, msalter +// Contributors: Red Hat, msalter +// Date: 2001-02-12 +// Purpose: +// Description: Register defines for CalmRISC 16 processors +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#include + +#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS + +// This value must agree with NUMREGS in calm32-stub.h. + +#define NUM_REGS 23 + +#define REG_SIZE 4 + +// Status register fields +#define SR_T 0x00000001 // TRUE flag +#define SR_V 0x00000008 // Overflow flag +#define SR_Z0 0x00000010 // R6 Zero flag +#define SR_Z1 0x00000020 // R7 Zero flag. +#define SR_DS 0x00000040 // Divisor sign +#define SR_QT 0x00000080 // Quotient +#define SR_BX 0x00001000 // Byte sign extension +#define SR_HX 0x00002000 // Halfword sign extension +#define SR_SYSX_MASK 0x000f0000 // system extension +#define SR_SYSX_SHIFT 16 +#define SR_IE 0x01000000 // IRQ enable +#define SR_FE 0x02000000 // FIQ enable +#define SR_TE 0x04000000 // Trace enable +#define SR_BS 0x10000000 // FIQ enable +#define SR_RS0 0x20000000 // Register bank select +#define SR_RS1 0x40000000 // Register bank select +#define SR_PM 0x80000000 // Privilege mode + +#endif // ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS + +#endif // ifndef CYGONCE_HAL_CALM32_REGS_H diff --git a/packages/hal/calmrisc32/arch/current/include/calm32-stub.h b/packages/hal/calmrisc32/arch/current/include/calm32-stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/include/calm32-stub.h @@ -0,0 +1,172 @@ +#ifndef CYGONCE_HAL_MIPS_STUB_H +#define CYGONCE_HAL_MIPS_STUB_H +//======================================================================== +// +// mips-stub.h +// +// CalmRISC32-specific definitions for generic stub +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Red Hat, msalter +// Contributors: Red Hat, msalter +// Date: 2001-02-12 +// Purpose: +// Description: CalmRISC32-specific definitions for generic stub +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TARGET_HAS_HARVARD_MEMORY 1 +typedef unsigned long long target_addr_t; +#define TARGET_ADDR_IS_PROGMEM(x) (((unsigned long long)(x)) >= 0x100000000ULL) +#define TARGET_ADDR_TO_PTR(x) ((char *) (((unsigned)(x)) & 0xffffffff)) + +#define NUMREGS 43 + +#define REGSIZE(X) 4 +typedef unsigned long target_register_t; + +enum regnames { + REG_B0R0, REG_B0R1, REG_B0R2, REG_B0R3, REG_B0R4, REG_B0R5, REG_B0R6, REG_B0R7, + REG_B0R8, REG_B0R9, REG_B0R10, REG_B0R11, REG_B0R12, REG_B0R13, REG_B0R14, REG_B0R15, + REG_B1R0, REG_B1R1, REG_B1R2, REG_B1R3, REG_B1R4, REG_B1R5, REG_B1R6, REG_B1R7, + REG_B1R8, REG_B1R9, REG_B1R10, REG_B1R11, REG_B1R12, REG_B1R13, REG_B1R14, REG_B1R15, + REG_PC, REG_VBR, REG_SR, + REG_SSR_FIQ, REG_SPC_FIQ, REG_SSR_IRQ, REG_SPC_IRQ, + REG_SSR_SWI, REG_SPC_SWI, REG_SSR_EXPT, REG_SPC_EXPT +}; + +typedef enum regnames regnames_t; + +#define PC REG_PC +#define SP __sp_regnum() +extern int __sp_regnum(void); + +#define HAL_STUB_ADD_T_REG(__ptr__,__reg__,__val__) \ + *__ptr__++ = __tohex (__reg__ >> 4); \ + *__ptr__++ = __tohex (__reg__); \ + *__ptr__++ = ':'; \ + __val__ = get_register (__reg__); \ + __ptr__ = __mem2hex((char *)&__val__, __ptr__, sizeof(__val__), 0); \ + *ptr++ = ';' + +#define HAL_STUB_ARCH_T_PACKET_EXTRAS(__ptr__) \ +{ \ + target_register_t __val__; \ + \ + HAL_STUB_ADD_T_REG(__ptr__,REG_SR,__val__); \ + if ((__val__ & CYGARC_SR_PM) == 0 || (__val__ & CYGARC_SR_BS) == 0){ \ + HAL_STUB_ADD_T_REG(__ptr__,REG_B0R13,__val__); \ + } else { \ + HAL_STUB_ADD_T_REG(__ptr__,REG_B1R13,__val__); \ + } \ +} + +/* Given a trap value TRAP, return the corresponding signal. */ +extern int __computeSignal (unsigned int trap_number); + +/* Return the SPARC trap number corresponding to the last-taken trap. */ +extern int __get_trap_number (void); + +/* Return the currently-saved value corresponding to register REG. */ +extern target_register_t get_register (regnames_t reg); + +/* Store VALUE in the register corresponding to WHICH. */ +extern void put_register (regnames_t which, target_register_t value); + +/* Set the currently-saved pc register value to PC. */ +#if !defined(SET_PC_PROTOTYPE_EXISTS) && !defined(set_pc) +#define SET_PC_PROTOTYPE_EXISTS +extern void set_pc (target_register_t pc); +#endif + +/* Set things up so that the next user resume will execute one instruction. + This may be done by setting breakpoints or setting a single step flag + in the saved user registers, for example. */ +#ifndef __single_step +void __single_step (void); +#endif + +/* Clear the single-step state. */ +void __clear_single_step (void); + +extern int __is_bsp_syscall(void); + +extern int hal_syscall_handler(void); + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ +#ifndef __is_breakpoint_function +extern int __is_breakpoint_function (void); +#endif + +/* Skip the current instruction. */ +extern void __skipinst (void); + +extern void __install_breakpoints (void); + +extern void __clear_breakpoints (void); + +extern void __install_breakpoint_list (void); + +extern void __clear_breakpoint_list (void); + +extern unsigned char __read_prog_uint8(void *addr); +extern unsigned short __read_prog_uint16(void *addr); +extern unsigned int __read_prog_uint32(void *addr); + +extern void __write_prog_uint8(void *addr, unsigned char val); +extern void __write_prog_uint16(void *addr, unsigned short val); +extern void __write_prog_uint32(void *addr, unsigned int val); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // ifndef CYGONCE_HAL_MIPS_STUB_H diff --git a/packages/hal/calmrisc32/arch/current/include/calm32.inc b/packages/hal/calmrisc32/arch/current/include/calm32.inc new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/include/calm32.inc @@ -0,0 +1,78 @@ +#ifndef CYGONCE_HAL_CALM32_INC +#define CYGONCE_HAL_CALM32_INC + +##============================================================================= +## +## calm32.inc +## +## CalmRISC32 assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: CalmRISC32 definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the MIPS CPU family. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + + +#------------------------------------------------------------------------------ + +#define SYM_NAME(x) x +.macro FUNC_START name + .type \name,@function + .globl \name +\name: +.endm + +.macro FUNC_END name +\name\(_end): +.endm + + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_CALM32_INC +# end of calm32.inc diff --git a/packages/hal/calmrisc32/arch/current/include/hal_arch.h b/packages/hal/calmrisc32/arch/current/include/hal_arch.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/include/hal_arch.h @@ -0,0 +1,364 @@ +#ifndef CYGONCE_HAL_HAL_ARCH_H +#define CYGONCE_HAL_HAL_ARCH_H + +//========================================================================== +// +// hal_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, dmoseley +// Date: 1999-02-17 +// Purpose: Define architecture abstractions +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#ifndef __ASSEMBLER__ +#include +#include + +#include + +//-------------------------------------------------------------------------- +// Processor saved states: +// The layout of this structure is also defined in "arch.inc", for assembly +// code. Do not change this without changing that (or vice versa). +// Notes: This structure is carefully laid out. It is a multiple of 8 +// bytes and the pc and badvr fields are positioned to ensure that +// they are on 8 byte boundaries. + + +typedef struct +{ + CYG_WORD32 vector; + CYG_WORD32 vbr; + CYG_WORD32 spc_irq; + CYG_WORD32 spc_fiq; + CYG_WORD32 spc_swi; + CYG_WORD32 spc_expt; + CYG_WORD32 ssr_irq; + CYG_WORD32 ssr_fiq; + CYG_WORD32 ssr_swi; + CYG_WORD32 ssr_expt; + CYG_WORD32 bank0[16]; + CYG_WORD32 bank1[16]; +} HAL_SavedRegisters; + +//-------------------------------------------------------------------------- +// Exception handling function. +// This function is defined by the kernel according to this prototype. It is +// invoked from the HAL to deal with any CPU exceptions that the HAL does +// not want to deal with itself. It usually invokes the kernel's exception +// delivery mechanism. + +externC void cyg_hal_deliver_exception( CYG_WORD code, CYG_ADDRWORD data ); + +//-------------------------------------------------------------------------- +// Bit manipulation macros + +externC cyg_uint32 hal_lsbit_index(cyg_uint32 mask); +externC cyg_uint32 hal_msbit_index(cyg_uint32 mask); + +#define HAL_LSBIT_INDEX(index, mask) index = hal_lsbit_index(mask); + +#define HAL_MSBIT_INDEX(index, mask) index = hal_msbit_index(mask); + +//-------------------------------------------------------------------------- +// Context Initialization + +// Optional FPU context initialization +#define HAL_THREAD_INIT_FPU_CONTEXT( _regs_, _id_ ) + +// Initialize the context of a thread. +// Arguments: +// _sparg_ name of variable containing current sp, will be written with new sp +// _thread_ thread object address, passed as argument to entry point +// _entry_ entry point address. +// _id_ bit pattern used in initializing registers, for debugging. +#define HAL_THREAD_INIT_CONTEXT( _sparg_, _thread_, _entry_, _id_ ) \ +{ \ +} + +//-------------------------------------------------------------------------- +// Context switch macros. +// The arguments are pointers to locations where the stack pointer +// of the current thread is to be stored, and from where the sp of the +// next thread is to be fetched. + +externC void hal_thread_switch_context( CYG_ADDRESS to, CYG_ADDRESS from ); +externC void hal_thread_load_context( CYG_ADDRESS to ) + __attribute__ ((noreturn)); + +#define HAL_THREAD_SWITCH_CONTEXT(_fspptr_,_tspptr_) \ + hal_thread_switch_context( (CYG_ADDRESS)_tspptr_, \ + (CYG_ADDRESS)_fspptr_); + +#define HAL_THREAD_LOAD_CONTEXT(_tspptr_) \ + hal_thread_load_context( (CYG_ADDRESS)_tspptr_ ); + +//-------------------------------------------------------------------------- +// Execution reorder barrier. +// When optimizing the compiler can reorder code. In multithreaded systems +// where the order of actions is vital, this can sometimes cause problems. +// This macro may be inserted into places where reordering should not happen. +// The "memory" keyword is potentially unnecessary, but it is harmless to +// keep it. + +#define HAL_REORDER_BARRIER() asm volatile ( "" : : : "memory" ) + +//-------------------------------------------------------------------------- +// Breakpoint support +// HAL_BREAKPOINT() is a code sequence that will cause a breakpoint to +// happen if executed. +// HAL_BREAKINST is the value of the breakpoint instruction and +// HAL_BREAKINST_SIZE is its size in bytes. +// HAL_BREAKINST_TYPE is the type. + +#define HAL_BREAKPOINT(_label_) \ +asm volatile (" .globl " #_label_ "\n" \ + #_label_":" \ + " .short 0x80e0 \n" \ + ); + +#define HAL_BREAKINST 0x80e0 + +#define HAL_BREAKINST_SIZE 2 + +#define HAL_BREAKINST_TYPE cyg_uint16 + +//-------------------------------------------------------------------------- +// Thread register state manipulation for GDB support. + +// Default to a 32 bit register size for GDB register dumps. +#ifndef CYG_HAL_GDB_REG +#define CYG_HAL_GDB_REG CYG_WORD32 +#endif + +// Translate a stack pointer as saved by the thread context macros above into +// a pointer to a HAL_SavedRegisters structure. +#define HAL_THREAD_GET_SAVED_REGISTERS( _sp_, _regs_ ) \ + (_regs_) = (HAL_SavedRegisters *)(_sp_) + +// Copy a set of registers from a HAL_SavedRegisters structure into a +// GDB ordered array. +#define HAL_GET_GDB_REGISTERS( _aregval_ , _regs_ ) \ +{ \ + CYG_HAL_GDB_REG *_regval_ = (CYG_HAL_GDB_REG *)(_aregval_); \ + int _i_; \ + \ + for( _i_ = 0; _i_ < 16; _i_++ ) \ + _regval_[_i_] = (_regs_)->bank0[_i_]; \ + for( _i_ = 0; _i_ < 16; _i_++ ) \ + _regval_[16+_i_] = (_regs_)->bank1[_i_]; \ + _regval_[REG_VBR] = (_regs_)->vbr; \ + _regval_[REG_SSR_FIQ] = (_regs_)->ssr_fiq; \ + _regval_[REG_SSR_IRQ] = (_regs_)->ssr_irq; \ + _regval_[REG_SSR_SWI] = (_regs_)->ssr_swi; \ + _regval_[REG_SSR_EXPT] = (_regs_)->ssr_expt; \ + _regval_[REG_SPC_FIQ] = (_regs_)->spc_fiq; \ + _regval_[REG_SPC_IRQ] = (_regs_)->spc_irq; \ + _regval_[REG_SPC_SWI] = (_regs_)->spc_swi; \ + _regval_[REG_SPC_EXPT] = (_regs_)->spc_expt; \ + switch ((_regs_)->vector) { \ + case CYGNUM_HAL_VECTOR_SWI: \ + _regval_[REG_SR] = (_regs_)->ssr_swi; \ + _regval_[REG_PC] = (_regs_)->spc_swi; break; \ + case CYGNUM_HAL_VECTOR_IRQ: \ + _regval_[REG_SR] = (_regs_)->ssr_irq; \ + _regval_[REG_PC] = (_regs_)->spc_irq; break; \ + case CYGNUM_HAL_VECTOR_FIQ: \ + _regval_[REG_SR] = (_regs_)->ssr_fiq; \ + _regval_[REG_PC] = (_regs_)->spc_fiq; break; \ + default: \ + _regval_[REG_SR] = (_regs_)->ssr_expt; \ + _regval_[REG_PC] = (_regs_)->spc_expt; break; \ + } \ + \ +} + +// Copy a GDB ordered array into a HAL_SavedRegisters structure. +#define HAL_SET_GDB_REGISTERS( _regs_ , _aregval_ ) \ +{ \ + CYG_HAL_GDB_REG *_regval_ = (CYG_HAL_GDB_REG *)(_aregval_); \ + int _i_; \ + \ + for( _i_ = 0; _i_ < 16; _i_++ ) \ + (_regs_)->bank0[_i_] = _regval_[_i_]; \ + for( _i_ = 0; _i_ < 16; _i_++ ) \ + (_regs_)->bank1[_i_] = _regval_[16+_i_]; \ + (_regs_)->vbr = _regval_[REG_VBR]; \ + (_regs_)->ssr_fiq = _regval_[REG_SSR_FIQ]; \ + (_regs_)->ssr_irq = _regval_[REG_SSR_IRQ]; \ + (_regs_)->ssr_swi = _regval_[REG_SSR_SWI]; \ + (_regs_)->ssr_expt = _regval_[REG_SSR_EXPT]; \ + (_regs_)->spc_fiq = _regval_[REG_SPC_FIQ]; \ + (_regs_)->spc_irq = _regval_[REG_SPC_IRQ]; \ + (_regs_)->spc_swi = _regval_[REG_SPC_SWI]; \ + (_regs_)->spc_expt = _regval_[REG_SPC_EXPT]; \ + switch (__get_trap_number()) { \ + case CYGNUM_HAL_VECTOR_SWI: \ + (_regs_)->ssr_swi = _regval_[REG_SR]; \ + (_regs_)->spc_swi = _regval_[REG_PC]; break; \ + case CYGNUM_HAL_VECTOR_IRQ: \ + (_regs_)->ssr_irq = _regval_[REG_SR]; \ + (_regs_)->spc_irq = _regval_[REG_PC]; break; \ + case CYGNUM_HAL_VECTOR_FIQ: \ + (_regs_)->ssr_fiq = _regval_[REG_SR]; \ + (_regs_)->spc_fiq = _regval_[REG_PC]; break; \ + default: \ + (_regs_)->ssr_expt = _regval_[REG_SR]; \ + (_regs_)->spc_expt = _regval_[REG_PC]; break; \ + } \ + \ +} + +#define CYGARC_HAL_GET_PC_REG(_regs_, _val_) \ +{ \ + switch ((_regs_)->vector) { \ + case CYGNUM_HAL_VECTOR_SWI: \ + (_val_) = (_regs_)->spc_swi; break; \ + case CYGNUM_HAL_VECTOR_IRQ: \ + (_val_) = (_regs_)->spc_irq; break; \ + case CYGNUM_HAL_VECTOR_FIQ: \ + (_val_) = (_regs_)->spc_fiq; break; \ + default: \ + (_val_) = (_regs_)->spc_expt; break; \ + } \ +} + +//-------------------------------------------------------------------------- +// HAL setjmp +// Note: These definitions are repeated in context.S. If changes are +// required remember to update both sets. + +#define CYGARC_JMP_BUF_R4 0 +#define CYGARC_JMP_BUF_R5 2 +#define CYGARC_JMP_BUF_R12 4 +#define CYGARC_JMP_BUF_R13 8 +#define CYGARC_JMP_BUF_R14 12 +#define CYGARC_JMP_BUF_R15 16 + +#define CYGARC_JMP_BUF_SIZE 20 + +typedef cyg_uint16 hal_jmp_buf[CYGARC_JMP_BUF_SIZE/sizeof(cyg_uint16)]; + +externC int hal_setjmp(hal_jmp_buf env); +externC void hal_longjmp(hal_jmp_buf env, int val); + +//------------------------------------------------------------------------- +// Idle thread code. +// This macro is called in the idle thread loop, and gives the HAL the +// chance to insert code. Typical idle thread behaviour might be to halt the +// processor. + +externC void hal_idle_thread_action(cyg_uint32 loop_count); + +#define HAL_IDLE_THREAD_ACTION(_count_) hal_idle_thread_action(_count_) + +//-------------------------------------------------------------------------- +// Minimal and sensible stack sizes: the intention is that applications +// will use these to provide a stack size in the first instance prior to +// proper analysis. Idle thread stack should be this big. + +// THESE ARE NOT INTENDED TO BE MICROMETRICALLY ACCURATE FIGURES. +// THEY ARE HOWEVER ENOUGH TO START PROGRAMMING. +// YOU MUST MAKE YOUR STACKS LARGER IF YOU HAVE LARGE "AUTO" VARIABLES! + +// This is not a config option because it should not be adjusted except +// under "enough rope" sort of disclaimers. + +// Typical case stack frame size: return link + 4 pushed registers + some locals. +#define CYGNUM_HAL_STACK_FRAME_SIZE (48) + +// Stack needed for a context switch: +#define CYGNUM_HAL_STACK_CONTEXT_SIZE ((32+10)*CYG_HAL_MIPS_REG_SIZE) + +// Interrupt + call to ISR, interrupt_end() and the DSR +#define CYGNUM_HAL_STACK_INTERRUPT_SIZE (4+2*CYGNUM_HAL_STACK_CONTEXT_SIZE) + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// An interrupt stack which is large enough for all possible interrupt +// conditions (and only used for that purpose) exists. "User" stacks +// can be much smaller + +#define CYGNUM_HAL_STACK_SIZE_MINIMUM (CYGNUM_HAL_STACK_CONTEXT_SIZE+ \ + CYGNUM_HAL_STACK_INTERRUPT_SIZE*2+ \ + CYGNUM_HAL_STACK_FRAME_SIZE*8) +#define CYGNUM_HAL_STACK_SIZE_TYPICAL (CYGNUM_HAL_STACK_SIZE_MINIMUM+1024) + +#else // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// No separate interrupt stack exists. Make sure all threads contain +// a stack sufficiently large. + +#define CYGNUM_HAL_STACK_SIZE_MINIMUM (4096) +#define CYGNUM_HAL_STACK_SIZE_TYPICAL (4096) + +#endif + +#endif /* __ASSEMBLER__ */ + + +//-------------------------------------------------------------------------- +// Macros for switching context between two eCos instances (jump from +// code in ROM to code in RAM or vice versa). +#define CYGARC_HAL_SAVE_GP() +#define CYGARC_HAL_RESTORE_GP() + +//-------------------------------------------------------------------------- +// Defines for status register bit access + +#define CYGARC_SR_PM (1<<31) +#define CYGARC_SR_RS1 (1<<30) +#define CYGARC_SR_RS0 (1<<29) +#define CYGARC_SR_BS (1<<28) +#define CYGARC_SR_TE (1<<26) +#define CYGARC_SR_FE (1<<25) +#define CYGARC_SR_IE (1<<24) + + + +//-------------------------------------------------------------------------- +#endif // CYGONCE_HAL_HAL_ARCH_H +// End of hal_arch.h diff --git a/packages/hal/calmrisc32/arch/current/include/hal_cache.h b/packages/hal/calmrisc32/arch/current/include/hal_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/include/hal_cache.h @@ -0,0 +1,265 @@ +#ifndef CYGONCE_HAL_CACHE_H +#define CYGONCE_HAL_CACHE_H + +//============================================================================= +// +// hal_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 1998-02-17 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include + + +//----------------------------------------------------------------------------- +// Cache dimensions. +// These really should be defined in var_cache.h. If they are not, then provide +// a set of numbers that are typical of many variants. + +#ifndef HAL_DCACHE_SIZE + +// Data cache +//#define HAL_DCACHE_SIZE 0 // Size of data cache in bytes +//#define HAL_DCACHE_LINE_SIZE 0 // Size of a data cache line +//#define HAL_DCACHE_WAYS 0 // Associativity of the cache + +// Instruction cache +//#define HAL_ICACHE_SIZE 0 // Size of cache in bytes +//#define HAL_ICACHE_LINE_SIZE 0 // Size of a cache line +//#define HAL_ICACHE_WAYS 0 // Associativity of the cache + +//#define HAL_DCACHE_SETS 0 +//#define HAL_ICACHE_SETS 0 + +#endif + +//----------------------------------------------------------------------------- +// Global control of data cache + +// Enable the data cache +// There is no default mechanism for enabling or disabling the caches. +#ifndef HAL_DCACHE_ENABLE_DEFINED +#define HAL_DCACHE_ENABLE() +#endif + +// Disable the data cache +#ifndef HAL_DCACHE_DISABLE_DEFINED +#define HAL_DCACHE_DISABLE() +#endif + +#ifndef HAL_DCACHE_IS_ENABLED_DEFINED +#define HAL_DCACHE_IS_ENABLED(_state_) (_state_) = 1; +#endif + +// Invalidate the entire cache +// We simply use HAL_DCACHE_SYNC() to do this. For writeback caches this +// is not quite what we want, but there is no index-invalidate operation +// available. +#ifndef HAL_DCACHE_INVALIDATE_ALL_DEFINED +#define HAL_DCACHE_INVALIDATE_ALL() HAL_DCACHE_SYNC() +#endif + +// Synchronize the contents of the cache with memory. +// This uses the index-writeback-invalidate operation. +#ifndef HAL_DCACHE_SYNC_DEFINED +#define HAL_DCACHE_SYNC() \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_size_) + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) + +//#define HAL_DCACHE_WRITETHRU_MODE 0 +//#define HAL_DCACHE_WRITEBACK_MODE 1 + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +// This uses the fetch-and-lock cache operation. +#ifndef HAL_DCACHE_LOCK_DEFINED +#define HAL_DCACHE_LOCK(_base_, _asize_) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Undo a previous lock operation. +// Do this by flushing the cache, which is defined to clear the lock bit. +#ifndef HAL_DCACHE_UNLOCK_DEFINED +#define HAL_DCACHE_UNLOCK(_base_, _size_) \ + HAL_DCACHE_FLUSH( _base_, _size_ ) +#endif + +// Unlock entire cache +#ifndef HAL_DCACHE_UNLOCK_ALL_DEFINED +#define HAL_DCACHE_UNLOCK_ALL() \ + HAL_DCACHE_INVALIDATE_ALL() +#endif + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +// This uses the hit-writeback-invalidate cache operation. +#ifndef HAL_DCACHE_FLUSH_DEFINED +#define HAL_DCACHE_FLUSH( _base_ , _asize_ ) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Invalidate cache lines in the given range without writing to memory. +// This uses the hit-invalidate cache operation. +#ifndef HAL_DCACHE_INVALIDATE_DEFINED +#define HAL_DCACHE_INVALIDATE( _base_ , _asize_ ) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Write dirty cache lines to memory for the given address range. +// This uses the hit-writeback cache operation. +#ifndef HAL_DCACHE_STORE_DEFINED +#define HAL_DCACHE_STORE( _base_ , _asize_ ) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_DCACHE_ZERO( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +// Global control of Instruction cache + +// Enable the instruction cache +// There is no default mechanism for enabling or disabling the caches. +#ifndef HAL_ICACHE_ENABLE_DEFINED +#define HAL_ICACHE_ENABLE() +#endif + +// Disable the instruction cache +#ifndef HAL_ICACHE_DISABLE_DEFINED +#define HAL_ICACHE_DISABLE() +#endif + +#ifndef HAL_ICACHE_IS_ENABLED_DEFINED +#define HAL_ICACHE_IS_ENABLED(_state_) (_state_) = 1; +#endif + +// Invalidate the entire cache +// This uses the index-invalidate cache operation. +#ifndef HAL_ICACHE_INVALIDATE_ALL_DEFINED +#define HAL_ICACHE_INVALIDATE_ALL() \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Synchronize the contents of the cache with memory. +// Simply force the cache to reload. +#ifndef HAL_ICACHE_SYNC_DEFINED +#define HAL_ICACHE_SYNC() HAL_ICACHE_INVALIDATE_ALL() +#endif + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_size_) + +// Load the contents of the given address range into the instruction cache +// and then lock the cache so that it stays there. +// This uses the fetch-and-lock cache operation. +#ifndef HAL_ICACHE_LOCK_DEFINED +#define HAL_ICACHE_LOCK(_base_, _asize_) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + +// Undo a previous lock operation. +// Do this by invalidating the cache, which is defined to clear the lock bit. +#ifndef HAL_ICACHE_UNLOCK_DEFINED +#define HAL_ICACHE_UNLOCK(_base_, _size_) \ + HAL_ICACHE_INVALIDATE( _base_, _size_ ) +#endif + +// Unlock entire cache +//#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +// This uses the hit-invalidate cache operation. +#ifndef HAL_ICACHE_INVALIDATE_DEFINED +#define HAL_ICACHE_INVALIDATE( _base_ , _asize_ ) \ + CYG_MACRO_START \ + CYG_MACRO_END +#endif + + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_CACHE_H +// End of hal_cache.h diff --git a/packages/hal/calmrisc32/arch/current/include/hal_intr.h b/packages/hal/calmrisc32/arch/current/include/hal_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/include/hal_intr.h @@ -0,0 +1,302 @@ +#ifndef CYGONCE_HAL_HAL_INTR_H +#define CYGONCE_HAL_HAL_INTR_H + +//========================================================================== +// +// hal_intr.h +// +// HAL Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jskov, +// gthomas, jlarmour, msalter +// Date: 1999-02-16 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include +#include + +#include + +//-------------------------------------------------------------------------- +// MIPS vectors. + +// These are the exception codes presented in the Cause register and +// correspond to VSRs. These values are the ones to use for HAL_VSR_GET/SET + + +#define CYGNUM_HAL_VECTOR_FIQ 0 // External Fast Interrupt +#define CYGNUM_HAL_VECTOR_IRQ 1 // External Interrupt +#define CYGNUM_HAL_VECTOR_COP 2 // Coprocessor Exception +#define CYGNUM_HAL_VECTOR_DABRT 3 // Data abort +#define CYGNUM_HAL_VECTOR_IABRT 4 // Instruction abort +#define CYGNUM_HAL_VECTOR_PRIV 5 // Privilege violation +#define CYGNUM_HAL_VECTOR_UNIMPL 6 // Unimplemented Insn +#define CYGNUM_HAL_VECTOR_TRACE 7 // Single-step +#define CYGNUM_HAL_VECTOR_SWI 8 // SWI + +#define CYGNUM_HAL_VSR_MIN 0 +#define CYGNUM_HAL_VSR_MAX 8 +#define CYGNUM_HAL_VSR_COUNT 9 + +// Min/Max exception numbers and how many there are +#define CYGNUM_HAL_EXCEPTION_MIN 0 +#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_VSR_MAX + +#define CYGNUM_HAL_EXCEPTION_COUNT \ + ( CYGNUM_HAL_EXCEPTION_MAX - CYGNUM_HAL_EXCEPTION_MIN + 1 ) + + +#ifndef CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED +#define CYGNUM_HAL_FAST_INTERRUPT 0 +#define CYGNUM_HAL_INTERRUPT 1 + +// Min/Max ISR numbers and how many there are +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX 1 +#define CYGNUM_HAL_ISR_COUNT 2 + +#define CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED +#endif + +//-------------------------------------------------------------------------- +// Static data used by HAL + +// ISR tables +externC volatile CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT]; +externC volatile CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_ISR_COUNT]; +externC volatile CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT]; + +// VSR table +externC volatile CYG_ADDRESS hal_vsr_table[CYGNUM_HAL_VSR_MAX+1]; + +//-------------------------------------------------------------------------- +// Default ISR +// The #define is used to test whether this routine exists, and to allow +// us to call it. + +externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +#define HAL_DEFAULT_ISR hal_default_isr + +//-------------------------------------------------------------------------- +// Interrupt state storage + +typedef cyg_uint32 CYG_INTERRUPT_STATE; + +//-------------------------------------------------------------------------- +// Interrupt control macros +// Beware of nops in this code. They fill delay slots and avoid CP0 hazards +// that might otherwise cause following code to run in the wrong state or +// cause a resource conflict. + +#define HAL_DISABLE_INTERRUPTS(_old_) +#define HAL_ENABLE_INTERRUPTS() +#define HAL_RESTORE_INTERRUPTS(_old_) +#define HAL_QUERY_INTERRUPTS( _state_ ) + +//-------------------------------------------------------------------------- +// Routine to execute DSRs using separate interrupt stack + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK +externC void hal_interrupt_stack_call_pending_DSRs(void); +#define HAL_INTERRUPT_STACK_CALL_PENDING_DSRS() \ + hal_interrupt_stack_call_pending_DSRs() + +// these are offered solely for stack usage testing +// if they are not defined, then there is no interrupt stack. +#define HAL_INTERRUPT_STACK_BASE cyg_interrupt_stack_base +#define HAL_INTERRUPT_STACK_TOP cyg_interrupt_stack +// use them to declare these extern however you want: +// extern char HAL_INTERRUPT_STACK_BASE[]; +// extern char HAL_INTERRUPT_STACK_TOP[]; +// is recommended +#endif + +//-------------------------------------------------------------------------- +// Vector translation. +// For chained interrupts we only have a single vector though which all +// are passed. For unchained interrupts we have a vector per interrupt. + +#ifndef HAL_TRANSLATE_VECTOR + +#if defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN) + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) (_index_) = 0 + +#else + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) (_index_) = (_vector_) + +#endif + +#endif + +//-------------------------------------------------------------------------- +// Interrupt and VSR attachment macros + +#define HAL_INTERRUPT_IN_USE( _vector_, _state_) \ + CYG_MACRO_START \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR ((_vector_), _index_); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)HAL_DEFAULT_ISR ) \ + (_state_) = 0; \ + else \ + (_state_) = 1; \ + CYG_MACRO_END + +#define HAL_INTERRUPT_ATTACH( _vector_, _isr_, _data_, _object_ ) \ +{ \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR( _vector_, _index_ ); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)HAL_DEFAULT_ISR ) \ + { \ + hal_interrupt_handlers[_index_] = (CYG_ADDRESS)_isr_; \ + hal_interrupt_data[_index_] = (CYG_ADDRWORD)_data_; \ + hal_interrupt_objects[_index_] = (CYG_ADDRESS)_object_; \ + } \ +} + +#define HAL_INTERRUPT_DETACH( _vector_, _isr_ ) \ +{ \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR( _vector_, _index_ ); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)_isr_ ) \ + { \ + hal_interrupt_handlers[_index_] = (CYG_ADDRESS)HAL_DEFAULT_ISR; \ + hal_interrupt_data[_index_] = 0; \ + hal_interrupt_objects[_index_] = 0; \ + } \ +} + +#define HAL_VSR_GET( _vector_, _pvsr_ ) \ + *(_pvsr_) = (void (*)())hal_vsr_table[_vector_]; + + +#define HAL_VSR_SET( _vector_, _vsr_, _poldvsr_ ) CYG_MACRO_START \ + if( (void*)_poldvsr_ != NULL) \ + *(CYG_ADDRESS *)_poldvsr_ = (CYG_ADDRESS)hal_vsr_table[_vector_]; \ + hal_vsr_table[_vector_] = (CYG_ADDRESS)_vsr_; \ +CYG_MACRO_END + +// This is an ugly name, but what it means is: grab the VSR back to eCos +// internal handling, or if you like, the default handler. But if +// cooperating with GDB and CygMon, the default behaviour is to pass most +// exceptions to CygMon. This macro undoes that so that eCos handles the +// exception. So use it with care. + +externC void __default_exception_vsr(void); +externC void __default_interrupt_vsr(void); +externC void __break_vsr_springboard(void); + +#define HAL_VSR_SET_TO_ECOS_HANDLER( _vector_, _poldvsr_ ) CYG_MACRO_START \ + HAL_VSR_SET( _vector_, _vector_ == CYGNUM_HAL_VECTOR_INTERRUPT \ + ? (CYG_ADDRESS)__default_interrupt_vsr \ + : _vector_ == CYGNUM_HAL_VECTOR_BREAKPOINT \ + ? (CYG_ADDRESS)__break_vsr_springboard \ + : (CYG_ADDRESS)__default_exception_vsr, \ + _poldvsr_ ); \ +CYG_MACRO_END + +//-------------------------------------------------------------------------- +// Interrupt controller access +// The default code here simply uses the fields present in the CP0 status +// and cause registers to implement this functionality. +// Beware of nops in this code. They fill delay slots and avoid CP0 hazards +// that might otherwise cause following code to run in the wrong state or +// cause a resource conflict. + +#ifndef CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED + +#define HAL_INTERRUPT_MASK( _vector_ ) + +#define HAL_INTERRUPT_UNMASK( _vector_ ) + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) + +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) + +#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) + +#define CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED + +#endif + +//-------------------------------------------------------------------------- +// Clock control. +// This code uses the count and compare registers that are present in many +// MIPS variants. +// Beware of nops in this code. They fill delay slots and avoid CP0 hazards +// that might otherwise cause following code to run in the wrong state or +// cause a resource conflict. + +#ifndef CYGHWR_HAL_CLOCK_CONTROL_DEFINED + +externC CYG_WORD32 cyg_hal_clock_period; +#define CYGHWR_HAL_CLOCK_PERIOD_DEFINED + +#define HAL_CLOCK_INITIALIZE( _period_ ) + +#define HAL_CLOCK_RESET( _vector_, _period_ ) + +#define HAL_CLOCK_READ( _pvalue_ ) + +#define CYGHWR_HAL_CLOCK_CONTROL_DEFINED + +#endif + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_HAL_INTR_H +// End of hal_intr.h diff --git a/packages/hal/calmrisc32/arch/current/include/hal_io.h b/packages/hal/calmrisc32/arch/current/include/hal_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/include/hal_io.h @@ -0,0 +1,158 @@ +#ifndef CYGONCE_HAL_HAL_IO_H +#define CYGONCE_HAL_HAL_IO_H + +//============================================================================= +// +// hal_io.h +// +// HAL device IO register support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 1998-02-17 +// Purpose: Define IO register support +// Description: The macros defined here provide the HAL APIs for handling +// device IO control registers. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +#include + +//----------------------------------------------------------------------------- +// IO Register address. +// This type is for recording the address of an IO register. + +typedef volatile CYG_ADDRWORD HAL_IO_REGISTER; + +//----------------------------------------------------------------------------- +// HAL IO macros. +#ifndef HAL_IO_MACROS_DEFINED + +//----------------------------------------------------------------------------- +// BYTE Register access. +// Individual and vectorized access to 8 bit registers. + +#define HAL_READ_UINT8( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_BYTE *)(_register_))) + +#define HAL_WRITE_UINT8( _register_, _value_ ) \ + (*((volatile CYG_BYTE *)(_register_)) = (_value_)) + +#define HAL_READ_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_BYTE *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + + +//----------------------------------------------------------------------------- +// 16 bit access. +// Individual and vectorized access to 16 bit registers. + +#define HAL_READ_UINT16( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_WORD16 *)(_register_))) + +#define HAL_WRITE_UINT16( _register_, _value_ ) \ + (*((volatile CYG_WORD16 *)(_register_)) = (_value_)) + +#define HAL_READ_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_WORD16 *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + +//----------------------------------------------------------------------------- +// 32 bit access. +// Individual and vectorized access to 32 bit registers. + +#define HAL_READ_UINT32( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_WORD32 *)(_register_))) + +#define HAL_WRITE_UINT32( _register_, _value_ ) \ + (*((volatile CYG_WORD32 *)(_register_)) = (_value_)) + +#define HAL_READ_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_WORD32 *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + +#define HAL_IO_MACROS_DEFINED + +#endif + + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_HAL_IO_H +// End of hal_io.h diff --git a/packages/hal/calmrisc32/arch/current/src/calm32-stub.c b/packages/hal/calmrisc32/arch/current/src/calm32-stub.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/src/calm32-stub.c @@ -0,0 +1,297 @@ +//======================================================================== +// +// calm32-stub.h +// +// Helper functions for stub, generic to all CalmRISC32 processors +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Red Hat, msalter +// Contributors: Red Hat, msalter +// Date: 2001-02-12 +// Purpose: +// Description: Helper functions for stub, generic to CalmRISC32 processors +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#include + +#include + +#ifdef CYGPKG_REDBOOT +#include +#endif + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS + +#include +#include + +typedef cyg_uint16 t_inst; + +/*---------------------------------------------------------------------- + * Asynchronous interrupt support + */ + +static struct +{ + t_inst *targetAddr; + t_inst savedInstr; +} asyncBuffer; + +/* Called to asynchronously interrupt a running program. + Must be passed address of instruction interrupted. + This is typically called in response to a debug port + receive interrupt. +*/ + +void +install_async_breakpoint(void *pc) +{ + asyncBuffer.targetAddr = pc; + asyncBuffer.savedInstr = *(t_inst *)pc; + *(t_inst *)pc = *(t_inst *)_breakinst; + __instruction_cache(CACHE_FLUSH); + __data_cache(CACHE_FLUSH); +} + +/*--------------------------------------------------------------------*/ +/* Given a trap value TRAP, return the corresponding signal. */ + +int __computeSignal (unsigned int trap_number) +{ + switch (trap_number) { + case CYGNUM_HAL_VECTOR_FIQ: + case CYGNUM_HAL_VECTOR_IRQ: + return SIGINT; + case CYGNUM_HAL_VECTOR_IABRT: + case CYGNUM_HAL_VECTOR_DABRT: + return SIGBUS; + } + return SIGTRAP; +} + +/* Return the trap number corresponding to the last-taken trap. */ + +int __get_trap_number (void) +{ + // The vector is not not part of the GDB register set so get it + // directly from the save context. + return _hal_registers->vector; +} + +#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) +int __is_bsp_syscall(void) +{ + return __get_trap_number() >= CYGNUM_HAL_VECTOR_SWI; +} +#endif + +/* Set the current pc register value based on current vector. */ + +void set_pc (target_register_t pc) +{ + put_register (REG_PC, pc); + switch (__get_trap_number()) { + case CYGNUM_HAL_VECTOR_SWI: + put_register (REG_SPC_SWI, pc); + break; + case CYGNUM_HAL_VECTOR_FIQ: + put_register (REG_SPC_FIQ, pc); + break; + case CYGNUM_HAL_VECTOR_IRQ: + put_register (REG_SPC_IRQ, pc); + break; + default: + put_register (REG_SPC_EXPT, pc); + break; + } +} + +/* Get the current pc register value based on current vector. */ + +target_register_t get_pc(void) +{ + switch (__get_trap_number()) { + case CYGNUM_HAL_VECTOR_SWI: + return get_register (REG_SPC_SWI); + case CYGNUM_HAL_VECTOR_FIQ: + return get_register (REG_SPC_FIQ); + case CYGNUM_HAL_VECTOR_IRQ: + return get_register (REG_SPC_IRQ); + default: + break; + } + return get_register (REG_SPC_EXPT); +} + +int __sp_regnum(void) +{ + target_register_t sr = get_register(REG_SR); + + if ((sr & CYGARC_SR_PM) == 0 || (sr & CYGARC_SR_BS) == 0) + return REG_B0R15; + return REG_B1R15; +} + +/*---------------------------------------------------------------------- + * Single-step support + */ + +/* Set things up so that the next user resume will execute one instruction. + This may be done by setting breakpoints or setting a single step flag + in the saved user registers, for example. */ + +void __single_step (void) +{ + put_register(REG_SR, get_register(REG_SR) | CYGARC_SR_TE); +} + + +/* Clear the single-step state. */ + +void __clear_single_step (void) +{ + put_register(REG_SR, get_register(REG_SR) & ~CYGARC_SR_TE); +} + + +void __install_breakpoints () +{ + /* Install the breakpoints in the breakpoint list */ + __install_breakpoint_list(); +} + +void __clear_breakpoints (void) +{ + __clear_breakpoint_list(); +} + + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ + +int +__is_breakpoint_function () +{ + return get_pc() == (target_register_t)(unsigned long)&_breakinst; +} + + +/* Skip the current instruction. Since this is only called by the + stub when the PC points to a breakpoint or trap instruction, + we can safely just skip 2. */ + +void __skipinst (void) +{ + set_pc(get_pc() + 2); +} + +int __is_prog_addr(unsigned long long addr) +{ + return addr >= 0x100000000ULL; +} + +char *__addr_to_ptr(unsigned long long addr) +{ + return (char *)((unsigned)(addr & 0xffffffff)); +} + +unsigned short __read_prog_uint16(void *addr) +{ + unsigned val; + asm("ldch %0, @%1" : "=r"(val) : "r"(addr) ); + return val; +} + +unsigned char __read_prog_uint8(void *addr) +{ + unsigned short s; + int is_odd = ((unsigned)addr & 1) == 1; + + s = __read_prog_uint16((void *)((unsigned)addr & ~1)); + if (is_odd) + return s & 0xff; + else + return (s >> 8) & 0xff; +} + +unsigned int __read_prog_uint32(void *addr) +{ + unsigned int u; + + u = __read_prog_uint16(addr) << 16; + u |= __read_prog_uint16((void *)((unsigned)addr + 2)); + + return u; +} + +void __write_prog_uint16(void *addr, unsigned short val) +{ + hal_plf_write_prog_halfword((unsigned)addr, val); +} + +void __write_prog_uint32(void *addr, unsigned int val) +{ + hal_plf_write_prog_halfword((unsigned)addr, (val >> 16) & 0xffff); + hal_plf_write_prog_halfword((unsigned)addr + 2, val & 0xffff); +} + +void __write_prog_uint8(void *addr, unsigned char val) +{ + unsigned short s; + int is_odd = ((unsigned)addr & 1) == 1; + + s = __read_prog_uint16((void *)((unsigned)addr & ~1)); + + if (is_odd) + s = (s & 0xff00) | val; + else + s = (s & 0xff) | (val << 8); + + hal_plf_write_prog_halfword((unsigned)addr & ~1, s); +} + + +#endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS diff --git a/packages/hal/calmrisc32/arch/current/src/context.S b/packages/hal/calmrisc32/arch/current/src/context.S new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/src/context.S @@ -0,0 +1,153 @@ +##=============================================================================## +## context.S +## +## CalmRISC32 context switch code +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: CalmRISC32 context switch code +## Description: This file contains implementations of the thread context +## switch routines. It also contains the longjmp() and setjmp() +## routines. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#------------------------------------------------------------------------------ +# hal_thread_switch_context +# Switch thread contexts +# A0 = address of sp of next thread to execute +# A1 = address of sp save location of current thread + + .global hal_thread_switch_context +hal_thread_switch_context: + // FIXME + # Now load the destination thread by dropping through + # to hal_thread_load_context + +#------------------------------------------------------------------------------ +# hal_thread_load_context +# Load thread context +# A0 = address of sp of next thread to execute +# Note that this function is also the second half of hal_thread_switch_context +# and is simply dropped into from it. + + .global hal_thread_load_context +hal_thread_load_context: + // FIXME + +#------------------------------------------------------------------------------ +# HAL longjmp, setjmp implementations +# hal_setjmp saves only callee save registers into given buffer +# Note: These definitions are repeated in hal_arch.h. If changes are required +# remember to update both sets. + +#define CYGARC_JMP_BUF_R0 0 +#define CYGARC_JMP_BUF_R1 1 +#define CYGARC_JMP_BUF_R2 2 +#define CYGARC_JMP_BUF_R3 3 +#define CYGARC_JMP_BUF_R4 4 +#define CYGARC_JMP_BUF_R5 5 +#define CYGARC_JMP_BUF_R6 6 +#define CYGARC_JMP_BUF_R7 7 +#define CYGARC_JMP_BUF_R12 8 +#define CYGARC_JMP_BUF_R13 9 +#define CYGARC_JMP_BUF_R14 10 +#define CYGARC_JMP_BUF_R15 11 + +#define CYGARC_JMP_BUF_SIZE 48 + +// FIXME: The follwing restricts us to using only 32 bit registers +// in jump buffers. If/when we move to a full 64 bit architecture, +// this will need to change, as will the instructions that we use to +// save and restore them. + +#define jmpbuf_regsize 4 + + .globl hal_setjmp +hal_setjmp: + ld r8, r0 + ldw @[r8+0], r0 + ldw @[r8+4], r1 + ldw @[r8+8], r2 + ldw @[r8+12], r3 + ldw @[r8+16], r4 + ldw @[r8+20], r5 + ldw @[r8+24], r6 + ldw @[r8+28], r7 + ldw @[r8+32], r12 + ldw @[r8+36], r13 + ldw @[r8+40], r14 + ldw @[r8+44], sp + + jmpd r14 + ldw r0, #0 + + .globl hal_longjmp +hal_longjmp: + ld r9, r0 + ld r8, r1 + ldw sp, @[r9+44] + ldw r14, @[r9+40] + ldw r13, @[r9+36] + ldw r12, @[r9+32] + ldw r7, @[r9+28] + ldw r6, @[r9+24] + ldw r5, @[r9+20] + ldw r4, @[r9+16] + ldw r3, @[r9+12] + ldw r2, @[r9+8] + ldw r1, @[r9+4] + # Value to return is in r8. If zero, return 1 + ld r0, r8 + cmp eq r0, #0 + brf 0f + ldw r0, #1 + 0: + jmpd r14 + nop + + +#------------------------------------------------------------------------------ +# end of context.S diff --git a/packages/hal/calmrisc32/arch/current/src/hal_misc.c b/packages/hal/calmrisc32/arch/current/src/hal_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/src/hal_misc.c @@ -0,0 +1,322 @@ +//========================================================================== +// +// hal_misc.c +// +// HAL miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour +// Date: 1999-01-21 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // Base types +#include // tracing macros +#include // assertion macros + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include // architectural definitions + +#include // Interrupt handling + +#include // Cache handling + +/*------------------------------------------------------------------------*/ +/* If required, define a variable to store the clock period. */ + +#ifdef CYGHWR_HAL_CLOCK_PERIOD_DEFINED + +CYG_WORD32 cyg_hal_clock_period; + +#endif + +/*------------------------------------------------------------------------*/ +/* First level C exception handler. */ + +externC void __handle_exception (void); + +externC HAL_SavedRegisters *_hal_registers; + +externC void* volatile __mem_fault_handler; + +externC cyg_uint32 cyg_hal_exception_handler(HAL_SavedRegisters *regs) +{ + int vec = regs->vector; + +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) + + // If we caught an exception inside the stubs, see if we were expecting it + // and if so jump to the saved address + if (__mem_fault_handler) { + switch (vec) { + case CYGNUM_HAL_VECTOR_SWI: + regs->spc_swi = (CYG_ADDRWORD)__mem_fault_handler; + break; + case CYGNUM_HAL_VECTOR_FIQ: + regs->spc_fiq = (CYG_ADDRWORD)__mem_fault_handler; + break; + case CYGNUM_HAL_VECTOR_IRQ: + regs->spc_irq = (CYG_ADDRWORD)__mem_fault_handler; + break; + default: + regs->spc_expt = (CYG_ADDRWORD)__mem_fault_handler; + break; + } + return 0; // Caught an exception inside stubs + } + + // Set the pointer to the registers of the current exception + // context. At entry the GDB stub will expand the + // HAL_SavedRegisters structure into a (bigger) register array. + _hal_registers = regs; + __handle_exception(); + +#elif defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && defined(CYGPKG_HAL_EXCEPTIONS) + + // We should decode the vector and pass a more appropriate + // value as the second argument. For now we simply pass a + // pointer to the saved registers. We should also divert + // breakpoint and other debug vectors into the debug stubs. + + cyg_hal_deliver_exception( vec, (CYG_ADDRWORD)regs ); + +#else + + CYG_FAIL("Exception!!!"); + +#endif + return 0; +} + +/*------------------------------------------------------------------------*/ +/* default ISR */ + +#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ +#if defined(CYGDBG_HAL_CALM32_DEBUG_GDB_CTRLC_SUPPORT) && \ + defined(CYGHWR_HAL_GDB_PORT_VECTOR) && \ + defined(HAL_CTRLC_ISR) + +#ifndef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if( vector == CYGHWR_HAL_GDB_PORT_VECTOR ) +#endif + { + cyg_uint32 result = HAL_CTRLC_ISR( vector, data ); + if( result != 0 ) return result; + } + +#if defined(CYGSEM_HAL_USE_ROM_MONITOR_CygMon) +#if defined(HAL_DIAG_IRQ_CHECK) + { + cyg_uint32 ret; + /* let ROM monitor handle unexpected interrupts */ + HAL_DIAG_IRQ_CHECK(vector, ret); + if (ret<=0) + return ret; + } +#endif // def HAL_DIAG_IRQ_CHECK +#endif // def CYGSEM_HAL_USE_ROM_MONITOR_CygMon +#endif + + CYG_TRACE1(true, "Interrupt: %d", vector); + CYG_FAIL("Spurious Interrupt!!!"); + return 0; +} + +#else // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + +externC cyg_uint32 hal_arch_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ +#if defined(CYGDBG_HAL_CALM32_DEBUG_GDB_CTRLC_SUPPORT) && \ + defined(CYGHWR_HAL_GDB_PORT_VECTOR) && \ + defined(HAL_CTRLC_ISR) + +#if defined(CYGSEM_HAL_USE_ROM_MONITOR_CygMon) +#if defined(HAL_DIAG_IRQ_CHECK) + { + cyg_uint32 ret; + /* let ROM monitor handle unexpected interrupts */ + HAL_DIAG_IRQ_CHECK(vector, ret); + if (ret<=0) + return ret; + } +#endif // def HAL_DIAG_IRQ_CHECK +#endif // def CYGSEM_HAL_USE_ROM_MONITOR_CygMon +#endif + + return 0; +} + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + +/*------------------------------------------------------------------------*/ +/* data copy and bss zero functions */ + +typedef void (CYG_SYM_ADDRESS)(void); + +// All these must use this type of address to stop them being given relocations +// relative to $gp (i.e. assuming they would be in .sdata) +extern CYG_SYM_ADDRESS __ram_data_start; +extern CYG_SYM_ADDRESS __ram_data_end; +extern CYG_SYM_ADDRESS __rom_data_start; + +#ifdef CYG_HAL_STARTUP_ROM +void hal_copy_data(void) +{ + short *p = (short *)&__ram_data_start; + short *q = (short *)&__rom_data_start; + short x; + + while( p != (short *)&__ram_data_end ) { + asm volatile( "ldch %0,@%1\n" : "=r"(x) : "r"(q) ); + *p++ = x; + q++; + } +} +#endif + +extern CYG_SYM_ADDRESS __bss_start; +extern CYG_SYM_ADDRESS __bss_end; + +void hal_zero_bss(void) +{ + short *p = (short *)&__bss_start; + + while( p != (short *)&__bss_end ) + *p++ = 0; +} + +/*------------------------------------------------------------------------*/ + +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG +cyg_bool cyg_hal_stop_constructors; +#endif + +typedef void (*pfunc) (void); +extern pfunc __CTOR_LIST__[]; +extern pfunc __CTOR_END__[]; + +void +cyg_hal_invoke_constructors(void) +{ +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG + static pfunc *p = &__CTOR_END__[-1]; + + cyg_hal_stop_constructors = 0; + for (; p >= __CTOR_LIST__; p--) { + (*p) (); + if (cyg_hal_stop_constructors) { + p--; + break; + } + } +#else + pfunc *p; + + for (p = &__CTOR_END__[-1]; p >= __CTOR_LIST__; p--) + (*p) (); +#endif + +} // cyg_hal_invoke_constructors() + +/*------------------------------------------------------------------------*/ +/* Determine the index of the ls bit of the supplied mask. */ + +cyg_uint32 hal_lsbit_index(cyg_uint32 mask) +{ + cyg_uint32 n = mask; + + static const signed char tab[64] = + { -1, 0, 1, 12, 2, 6, 0, 13, 3, 0, 7, 0, 0, 0, 0, 14, 10, + 4, 0, 0, 8, 0, 0, 25, 0, 0, 0, 0, 0, 21, 27 , 15, 31, 11, + 5, 0, 0, 0, 0, 0, 9, 0, 0, 24, 0, 0 , 20, 26, 30, 0, 0, 0, + 0, 23, 0, 19, 29, 0, 22, 18, 28, 17, 16, 0 + }; + + n &= ~(n-1UL); + n = (n<<16)-n; + n = (n<<6)+n; + n = (n<<4)+n; + + return tab[n>>26]; +} + +/*------------------------------------------------------------------------*/ +/* Determine the index of the ms bit of the supplied mask. */ + +cyg_uint32 hal_msbit_index(cyg_uint32 mask) +{ + cyg_uint32 x = mask; + cyg_uint32 w; + + /* Phase 1: make word with all ones from that one to the right */ + x |= x >> 16; + x |= x >> 8; + x |= x >> 4; + x |= x >> 2; + x |= x >> 1; + + /* Phase 2: calculate number of "1" bits in the word */ + w = (x & 0x55555555) + ((x >> 1) & 0x55555555); + w = (w & 0x33333333) + ((w >> 2) & 0x33333333); + w = w + (w >> 4); + w = (w & 0x000F000F) + ((w >> 8) & 0x000F000F); + return (cyg_uint32)((w + (w >> 16)) & 0xFF) - 1; + +} + +/*------------------------------------------------------------------------*/ +/* Idle thread action */ + +#include + +void hal_idle_thread_action( cyg_uint32 count ) +{ +} + +/*------------------------------------------------------------------------*/ +/* End of hal_misc.c */ diff --git a/packages/hal/calmrisc32/arch/current/src/hal_syscall.c b/packages/hal/calmrisc32/arch/current/src/hal_syscall.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/src/hal_syscall.c @@ -0,0 +1,126 @@ +//============================================================================= +// +// hal_syscall.c +// +// +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter +// Date: 2000-11-5 +// Purpose: +// Description: +// +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGPKG_REDBOOT +#include +#endif + +#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) + +#include // Our header +#include // HAL_BREAKINST +#include // HAL_xCACHE_x +#include // interrupt disable/restore + +#include // ROM calling interface +#include // Helper functions + +extern CYG_ADDRWORD __do_syscall(CYG_ADDRWORD func, // syscall function number + CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, // up to four args. + CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, + CYG_ADDRWORD *retval, // syscall return value + CYG_ADDRWORD *sig); // signal to return (or 0) + +#define SYS_exit 1 +#define SYS_interrupt 1000 + +int +hal_syscall_handler(void) +{ + CYG_ADDRWORD func, arg1, arg2, arg3, arg4; + CYG_ADDRWORD err, sig; + int retreg; + target_register_t sr = get_register(REG_SR); + + if ((sr & CYGARC_SR_PM) == 0 || (sr & CYGARC_SR_BS) == 0) { + // bank zero regs + func = get_register(REG_B0R0); + arg1 = get_register(REG_B0R1); + arg2 = get_register(REG_B0R2); + arg3 = get_register(REG_B0R3); + arg4 = 0; + retreg = REG_B0R0; + } else { + func = get_register(REG_B1R0); + arg1 = get_register(REG_B1R1); + arg2 = get_register(REG_B1R2); + arg3 = get_register(REG_B1R3); + retreg = REG_B1R0; + } + + set_pc(get_pc()+2); + + if (func == SYS_exit) { + // We want to stop in exit so that the user may poke around + // to see why his app exited. + return SIGTRAP; + } + + if (func == SYS_interrupt) { + // A console interrupt landed us here. + // Invoke the debug agent so as to cause a SIGINT. + return SIGINT; + } + + if (__do_syscall(func, arg1, arg2, arg3, arg4, &err, &sig)) { + put_register(retreg, err); + return (int)sig; + } + + return SIGTRAP; +} + +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS diff --git a/packages/hal/calmrisc32/arch/current/src/vectors.S b/packages/hal/calmrisc32/arch/current/src/vectors.S new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/arch/current/src/vectors.S @@ -0,0 +1,675 @@ +##============================================================================= +## +## vectors.S +## +## CalmRISC32 exception vectors +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: CalmRISC32 exception vectors +## Description: This file defines the code placed into the exception +## vectors. It also contains the first level default VSRs +## that save and restore state for both exceptions and +## interrupts. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include +#include + +#ifdef CYGPKG_KERNEL +# include +#else +# undef CYGFUN_HAL_COMMON_KERNEL_SUPPORT +# undef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK +#endif + +#include +#include + + .macro txreg reg + 99: + cld r0,fr29 + cmp eq r0,#0 + brfd 99b + nop + cld fr30,\reg + ld r0,#1 + cld fr29,r0 + .endm + + .extern cyg_instrument + +##----------------------------------------------------------------------------- +## Hardware supplied vectors + + .macro cpu_vector vsr_nr + setsr bs + clrsr rs0 + clrsr rs1 + nop + push r8 + brad __exc_trampoline + ld r8,#\vsr_nr + .endm + +##========================================================================== +## Hardware exception vectors. +## + .section ".vectors","ax" + .global reset_vector +reset_vector: + ldw r0,#_start + jmpd r0 + nop + + # 0x20 - FIQ + .p2align 5 + cpu_vector 0 + + # 0x40 - IRQ + .p2align 5 + cpu_vector 1 + + # 0x50 - COP + .p2align 4 + cpu_vector 2 + + # 0x60 - DABRT + .p2align 4 + cpu_vector 3 + + # 0x70 - IABRT + .p2align 4 + cpu_vector 4 + + # 0x80 - PRIV + .p2align 4 + cpu_vector 5 + + # 0xA0 - UNIMPL + .p2align 5 + cpu_vector 6 + + # 0xC0 - TRACE + .p2align 5 + cpu_vector 7 + + # 0x100 - SWI 0 + .p2align 6 + cpu_vector 8 + + # SWI 1 + .p2align 4 + cpu_vector 8 + + # SWI 2 + .p2align 4 + cpu_vector 8 + + # SWI 3 + .p2align 4 + cpu_vector 8 + + # SWI 4 + .p2align 4 + cpu_vector 8 + + # SWI 5 + .p2align 4 + cpu_vector 8 + + # SWI 6 + .p2align 4 + cpu_vector 8 + + # SWI 7 + .p2align 4 + cpu_vector 8 + + # SWI 8 + .p2align 4 + cpu_vector 8 + + # SWI 9 + .p2align 4 + cpu_vector 8 + + # SWI 10 + .p2align 4 + cpu_vector 8 + + # SWI 11 + .p2align 4 + cpu_vector 8 + + # SWI 12 + .p2align 4 + cpu_vector 8 + + # SWI 13 + .p2align 4 + cpu_vector 8 + + # SWI 14 + .p2align 4 + cpu_vector 8 + + # SWI 15 + .p2align 4 + cpu_vector 8 + +__exc_trampoline: + push r8 // vsr number + sl2 r8 // offset into vsr table + ldw r8,@[r8 + 0] + jmpd r8 + pop r8 + +##----------------------------------------------------------------------------- +## Startup code + + .text + +FUNC_START _start + # default vector table + ld r0,#0 + ld vbr,r0 + + # ensure privileged mode with all bank1 register view + setsr pm + setsr bs + clrsr rs0 + clrsr rs1 + + # Initialize hardware + hal_cpu_init + hal_diag_init + hal_memc_init + hal_cache_init + hal_timer_init + + # load initial stack pointer + ldw sp,#__startup_stack + + clrsr bs + nop + ldw sp,#__user_stack + setsr bs + nop + + hal_mon_init + +#ifdef CYG_HAL_STARTUP_ROM + # Copy data from ROM to RAM + + .extern hal_copy_data + ldw r0,#hal_copy_data + jsrd r0 + nop +#endif + + # Zero BSS + + .extern hal_zero_bss + ldw r0,#hal_zero_bss + jsrd r0 + nop + + # Call variant and platform HAL + # initialization routines. + + .extern hal_variant_init + ldw r0,#hal_variant_init + jsrd r0 + nop + + .extern hal_platform_init + ldw r0,#hal_platform_init + jsrd r0 + nop + + # Call constructors + .extern cyg_hal_invoke_constructors + ldw r0,#cyg_hal_invoke_constructors + jsrd r0 + nop + +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) + .extern initialize_stub + ldw r0,#initialize_stub + jsrd r0 + nop +#endif + +#if defined(CYGDBG_HAL_CALM32_DEBUG_GDB_CTRLC_SUPPORT) + .extern hal_ctrlc_isr_init + ldw r0,#hal_ctrlc_isr_init + jsrd r0 + nop +#endif + + # Call cyg_start + + .extern cyg_start +#if 0 + clrsr pm + nop + clrsr bs + nop +#endif + ld fp,sp + + ldw lr,#_start + ldw r0,#cyg_start + jmpd r0 + nop +FUNC_END _start + + + .macro switch_stack_and_save_regs tmpvar + // save vector number temporarily + push r9 + ldw r9,#\tmpvar + ldw @[r9 + 0],r8 + pop r9 + + // Make sure we use the gdb stack + ldw r8,#__GDB_stack + cmpu gt sp,r8 + brtd 0f + nop + ldw r8,#__GDB_stack_base + cmpu gt sp,r8 + brtd 1f + nop + 0: + // need to switch stack + ld r8,sp + add r8,#4 + ldw sp,#__GDB_stack + push r8 + push r14 + push r13 + push r12 + sub r8,#4 + brad 2f + ldw r8,@[r8+0] + 1: + // already using gdb stack + pop r8 + // save bank 1 regs + push q3 + 2: + // save rest of bank1 regs + push q2 + push q1 + push q0 + + // save bank 0 regs + setsr rs1 + nop + push q1 + push q0 + clrsr rs1 + setsr rs0 + nop + push q1 + push q0 + clrsr rs0 + nop + // save special regs + ld r0,ssr_expt + push r0 + ld r0,ssr_swi + push r0 + ld r0,ssr_fiq + push r0 + ld r0,ssr_irq + push r0 + ld r0,spc_expt + push r0 + ld r0,spc_swi + push r0 + ld r0,spc_fiq + push r0 + ld r0,spc_irq + push r0 + ld r0,vbr + push r0 + + ldw r8,#\tmpvar + ldw r8,@[r8+0] + push r8 + .endm + + .macro restore_regs + // discard vector + pop r0 + // restore special regs + pop r0 + ld vbr,r0 + pop r0 + ld spc_irq,r0 + pop r0 + ld spc_fiq,r0 + pop r0 + ld spc_swi,r0 + pop r0 + ld spc_expt,r0 + pop r0 + ld ssr_irq,r0 + pop r0 + ld ssr_fiq,r0 + pop r0 + ld ssr_swi,r0 + pop r0 + ld ssr_expt,r0 + // restore bank 0 regs + setsr rs1 + nop + pop q0 + pop q1 + clrsr rs1 + setsr rs0 + nop + pop q0 + pop q1 + clrsr rs0 + nop + // restore bank 1 regs + pop q0 + pop q1 + pop q2 + pop q3 + .endm + + +##----------------------------------------------------------------------------- +## Default exception VSR. +## Saves machine state and calls external handling code. +## On entry, the original R8 has been pushed on the stack and R8 now +## contains the vector number. + +FUNC_START __default_exception_vsr + + switch_stack_and_save_regs __expt_temp + + // call exception handler + ldw r8,#cyg_hal_exception_handler + jsrd r8 + ld r0,sp + + restore_regs + + ret_expt + nop + +FUNC_END __default_exception_vsr + +##----------------------------------------------------------------------------- +## Default swi VSR. +## Saves machine state and calls external handling code. +## On entry, the original R8 has been pushed on the stack and R8 now +## contains the vector number. + +FUNC_START __default_swi_vsr + + switch_stack_and_save_regs __swi_temp + + // call exception handler + ldw r8,#cyg_hal_exception_handler + jsrd r8 + ld r0,sp + + restore_regs + + ret_swi + nop + +FUNC_END __default_swi_vsr + +##------------------------------------------------------------------------------ +## Default interrupt VSR. +## Saves machine state and calls appropriate ISR. When done, calls +## interrupt_end() to finish up and possibly reschedule. + +FUNC_START __default_fiq_vsr + switch_stack_and_save_regs __fiq_temp + + ldw r8,#hal_interrupt_data + ldw r1,@[r8 + 0] + ldw r8,#hal_interrupt_handlers + ldw r8,@[r8 + 0] + + // call fiq handler + jsrd r8 + ld r0,#0 + + restore_regs + + ret_fiq + nop +FUNC_END __default_fiq_vsr + +FUNC_START __default_irq_vsr + switch_stack_and_save_regs __irq_temp + + ldw r8,#hal_interrupt_data + ldw r1,@[r8 + 4] + ldw r8,#hal_interrupt_handlers + ldw r8,@[r8 + 4] + + // call fiq handler + jsrd r8 + ld r0,#1 + + restore_regs + + ret_irq + nop +FUNC_END __default_irq_vsr + +##----------------------------------------------------------------------------- +## Execute pending DSRs on the interrupt stack with interrupts enabled. +## Note: this can only be called from code running on a thread stack + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + .extern cyg_interrupt_call_pending_DSRs + +FUNC_START hal_interrupt_stack_call_pending_DSRs +FUNC_END hal_interrupt_stack_call_pending_DSRs +#endif + +##----------------------------------------------------------------------------- +## Short circuit in case any code tries to use "__gccmain()" + +FUNC_START __gccmain + jmpd lr + nop +FUNC_END __gccmain + +##----------------------------------------------------------------------------- +## Interrupt Stack. +## Used during intialization and for executing ISRs. + + .section ".bss" + + .balign 16 + .global cyg_interrupt_stack_base +cyg_interrupt_stack_base: +__interrupt_stack_base: + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE + .byte 0 + .endr + .balign 16 + .global cyg_interrupt_stack +cyg_interrupt_stack: +__interrupt_stack: + + .long 0 + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + .balign 16 +__GDB_stack_base: + .rept 0x400 + .byte 0 + .endr +__GDB_stack: + .long 0 +#endif + .balign 16 +__startup_stack_base: +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + .rept 512 +#else + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE +#endif + .byte 0 + .endr + .balign 16 +__startup_stack: + .long 0 + + .balign 16 +__user_stack_base: +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + .rept 512 +#else + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE +#endif + .byte 0 + .endr + .balign 16 +__user_stack: + .long 0 + +__expt_temp: + .long 0 +__swi_temp: + .long 0 +__irq_temp: + .long 0 +__fiq_temp: + .long 0 + + +##----------------------------------------------------------------------------- +## VSR table. +## The main interrupt code indirects through here to find the VSR +## to execute for each architecture defined interrupt. +## This is only used for simulated targets, on real targets a fixed location VSR +## table is now allocated at 0x80000100. + +#ifndef CYG_HAL_CALM32_VSR_TABLE_DEFINED + +## .section ".vsr_table","a" + + .data + + .globl hal_vsr_table +hal_vsr_table: + .long __default_fiq_vsr // FIQ + .long __default_irq_vsr // IRQ + .long __default_exception_vsr // COP + .long __default_exception_vsr // DABRT + .long __default_exception_vsr // IABRT + .long __default_exception_vsr // PRIV + .long __default_exception_vsr // UNIMPL + .long __default_exception_vsr // TRACE + .long __default_swi_vsr // SWI +#endif + + .balign 16 +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + ## Vectors used to communicate between eCos and ROM environments + .globl hal_virtual_vector_table +hal_virtual_vector_table: + .rept 64 + .long 0 + .endr +#endif + +#------------------------------------------------------------------------------ +# Interrupt vector tables. +# These tables contain the isr, data and object pointers used to deliver +# interrupts to user code. +# hal_interrupt_level contains the interrupt level set by +# HAL_INTERRUPT_CONFIGURE(). +# This is a default set that provide support only for the single external +# interrupt. Platforms or boards are expected to define their own versions +# of these if they have their own interrupt mappings. + +#ifndef CYG_HAL_CALM32_ISR_TABLES_DEFINED + + .extern hal_default_isr + + .data + + .globl hal_interrupt_handlers +hal_interrupt_handlers: + .long hal_default_isr + .long hal_default_isr + + + .globl hal_interrupt_data +hal_interrupt_data: + .long 0 + .long 0 + + .globl hal_interrupt_objects +hal_interrupt_objects: + .long 0 + .long 0 +#endif + + .data + .globl __break_inst_in_data +__break_inst_in_data: + .short 0x80e0 + + +##----------------------------------------------------------------------------- +## end of vectors.S + + diff --git a/packages/hal/calmrisc32/ceb/current/ChangeLog b/packages/hal/calmrisc32/ceb/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/ChangeLog @@ -0,0 +1,42 @@ +2001-03-26 Mark Salter + + * src/plf_misc.c (hal_delay_us): Fix loop count for better accuracy. + + * src/platform.S: Remove unneeded ceb_program_new_stack. + + * cdl/hal_calm32_ceb.cdl: Remove HAL_ARCH_PROGRAM_NEW_STACK. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/calmrisc32/ceb/current/cdl/hal_calm32_ceb.cdl b/packages/hal/calmrisc32/ceb/current/cdl/hal_calm32_ceb.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/cdl/hal_calm32_ceb.cdl @@ -0,0 +1,270 @@ +# ==================================================================== +# +# hal_calm32_ceb.cdl +# +# CalmRISC32 Core Eval Board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): msalter +# Original data: bartv +# Contributors: +# Date: 2001-02-12 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_CALM32_CEB { + display "CalmRISC32 core evaluation board" + parent CYGPKG_HAL_CALM32 + include_dir cyg/hal + description " + The Core eval board HAL package should be used when targetting the + actual hardware." + + compile hal_diag.c platform.S plf_misc.c ser.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_GUARANTEED + + cdl_option CYGBLD_HAL_TARGET_H { + display "Variant header" + flavor data + no_define + calculated { "" } + define -file system.h CYGBLD_HAL_TARGET_H + description "Variant header." + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_system_header "" + puts $::cdl_system_header "/* Make sure we get the CORE type definitions for HAL_PLATFORM_CPU */" + puts $::cdl_system_header "#include CYGBLD_HAL_TARGET_H" + puts $::cdl_system_header "#define HAL_PLATFORM_BOARD \"Core Eval Board\"" + puts $::cdl_system_header "#define HAL_PLATFORM_EXTRA \"\"" + puts $::cdl_system_header "" + } + + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM"} + default_value {"ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + Currently only ROM startup type is supported." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 57600 + default_value 57600 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 57600 + default_value 57600 + description " + This option controls the baud rate used for the GDB connection." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + parent CYGBLD_GLOBAL_OPTIONS + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + + + cdl_option CYGNUM_HAL_BREAKPOINT_LIST_SIZE { + display "Number of breakpoints supported by the HAL." + flavor data + default_value 25 + description " + This option determines the number of breakpoints supported by the HAL." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The Atlas board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The Atlas board has only one serial port. This option + chooses which port will be used for diagnostic output." + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "calm32_ceb_ram" : \ + "calm32_ceb_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "Generic" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for three different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"CygMon\" provides support for the Cygnus ROM Monitor. + And finally, \"GDB_stubs\" provides support when GDB stubs are + included in the ROM monitor or boot ROM." + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 1 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + compile -library=libextras.a + + make -priority 325 { + /bin/redboot.srec : /bin/redboot.elf + $(OBJCOPY) --strip-all $< $(@:.srec=.img) + $(OBJCOPY) -O srec $< $@ + } + } + } + +} diff --git a/packages/hal/calmrisc32/ceb/current/include/hal_diag.h b/packages/hal/calmrisc32/ceb/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/include/hal_diag.h @@ -0,0 +1,95 @@ +#ifndef CYGONCE_HAL_DIAG_H +#define CYGONCE_HAL_DIAG_H + +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors: nickg, gthomas +// Date: 1998-09-11 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include + +#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +#else // everything by steam + +/*---------------------------------------------------------------------------*/ +/* functions implemented in hal_diag.c */ + +externC void hal_diag_init(void); +externC void hal_diag_write_char(char c); +externC void hal_diag_read_char(char *c); + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +/*---------------------------------------------------------------------------*/ +// LED + +externC void hal_diag_led(int n); + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_DIAG_H */ diff --git a/packages/hal/calmrisc32/ceb/current/include/pkgconf/mlt_calm32_ceb_rom.h b/packages/hal/calmrisc32/ceb/current/include/pkgconf/mlt_calm32_ceb_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/include/pkgconf/mlt_calm32_ceb_rom.h @@ -0,0 +1,20 @@ +// eCos memory layout - Fri Oct 20 06:10:29 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x00000000) +#define CYGMEM_REGION_ram_SIZE (0x80000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0x100000000) +#define CYGMEM_REGION_rom_SIZE (0x80000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x80000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/calmrisc32/ceb/current/include/pkgconf/mlt_calm32_ceb_rom.ldi b/packages/hal/calmrisc32/ceb/current/include/pkgconf/mlt_calm32_ceb_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/include/pkgconf/mlt_calm32_ceb_rom.ldi @@ -0,0 +1,40 @@ +// eCos memory layout - Fri Oct 20 06:10:29 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x000000, LENGTH = 0x80000 + rom : ORIGIN = 0x100000000, LENGTH = 0x80000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_vectors (rom, 0x100000000, LMA_EQ_VMA) + SECTION_ROMISC (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_RELOCS (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_init (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_data (ram, 0x00000000, FOLLOWING (.fini)) + SECTION_data1 (ram, ALIGN (0x40), FOLLOWING (.data)) + SECTION_rodata (ram, ALIGN (0x40), FOLLOWING (.data1)) + SECTION_rodata1 (ram, ALIGN (0x40), FOLLOWING (.rodata)) + SECTION_eh_frame (ram, ALIGN (0x40), FOLLOWING (.rodata1)) + SECTION_gcc_except_table (ram, ALIGN (0x40), FOLLOWING (.eh_frame)) + SECTION_ctors (ram, ALIGN (0x40), FOLLOWING (.gcc_except_table)) + SECTION_dtors (ram, ALIGN (0x40), FOLLOWING (.ctors)) + SECTION_devtab (ram, ALIGN (0x40), FOLLOWING (.dtors)) + SECTION_got (ram, ALIGN (0x40), FOLLOWING (.devtab)) + SECTION_dynamic (ram, ALIGN (0x40), FOLLOWING (.got)) + SECTION_sdata (ram, ALIGN (0x40), FOLLOWING (.dynamic)) + SECTION_lit8 (ram, ALIGN (0x40), FOLLOWING (.sdata)) + SECTION_lit4 (ram, ALIGN (0x40), FOLLOWING (.lit8)) + SECTION_sbss (ram, ALIGN (0x40), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x40), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/calmrisc32/ceb/current/include/platform.inc b/packages/hal/calmrisc32/ceb/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/include/platform.inc @@ -0,0 +1,96 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## CalmRISC32 core eval board assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: Core eval board definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the core eval board. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include +#include + +#define CYGPKG_HAL_RESET_VECTOR_FIRST_CODE + .macro hal_reset_vector_first_code + .endm + +#define CYGPKG_HAL_EARLY_INIT + .macro hal_early_init + .endm + +#------------------------------------------------------------------------------ +# Diagnostic macros + +#ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED + + .macro hal_diag_init + .endm + + .macro hal_diag_excpt_start + .endm + + .macro hal_diag_intr_start + .endm + + .macro hal_diag_restore + .endm + +#define CYGPKG_HAL_MIPS_DIAG_DEFINED + +#endif // ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/packages/hal/calmrisc32/ceb/current/include/plf_cache.h b/packages/hal/calmrisc32/ceb/current/include/plf_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/include/plf_cache.h @@ -0,0 +1,73 @@ +#ifndef CYGONCE_PLF_CACHE_H +#define CYGONCE_PLF_CACHE_H + +//============================================================================= +// +// plf_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 1998-02-17 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include + +//============================================================================= + +// Nothing here at present. + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_PLF_CACHE_H +// End of plf_cache.h + diff --git a/packages/hal/calmrisc32/ceb/current/include/plf_intr.h b/packages/hal/calmrisc32/ceb/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/include/plf_intr.h @@ -0,0 +1,123 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// Atlas Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jskov, +// gthomas, jlarmour, dmoseley +// Date: 2000-06-06 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the Atlas board. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include +#include + +//-------------------------------------------------------------------------- +// Interrupt vectors. + +#ifndef CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED + +// These are decoded via the IP bits of the cause +// register when an external interrupt is delivered. + +#define CYGNUM_HAL_INTERRUPT_IRQ 0 +#define CYGNUM_HAL_INTERRUPT_FIQ 1 + +// Min/Max ISR numbers and how many there are +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX 1 +#define CYGNUM_HAL_ISR_COUNT 2 + +#define CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED + +#endif + +//-------------------------------------------------------------------------- +// Interrupt controller access. + + + +//-------------------------------------------------------------------------- +// Control-C support. + +#if defined(CYGDBG_HAL_MIPS_DEBUG_GDB_CTRLC_SUPPORT) + +# define CYGHWR_HAL_GDB_PORT_VECTOR CYGNUM_HAL_INTERRUPT_SER + +externC cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +# define HAL_CTRLC_ISR hal_ctrlc_isr + +#endif + + +//---------------------------------------------------------------------------- +// Reset. +#ifndef CYGHWR_HAL_RESET_DEFINED +#define CYGHWR_HAL_RESET_DEFINED +#define HAL_PLATFORM_RESET() + +#define HAL_PLATFORM_RESET_ENTRY 0x00000000 + +#endif // CYGHWR_HAL_RESET_DEFINED + +//--------------------------------------------------------------------------- +// Delay +#define HAL_DELAY_US(x) hal_delay_us(x) + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/calmrisc32/ceb/current/include/plf_io.h b/packages/hal/calmrisc32/ceb/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/include/plf_io.h @@ -0,0 +1,123 @@ +#ifndef CYGONCE_PLF_IO_H +#define CYGONCE_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// Platform specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-02-12 +// Purpose: CalmRISC32 platform IO support +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +// coprocessor regs +#define HAL_COP_SR_RBR 0x1c +#define HAL_COP_SR_TBR 0x1d +#define HAL_COP_TBR 0x1e +#define HAL_COP_RBR 0x1f + +#ifndef __ASSEMBLER__ + +static inline void cyg_hal_plf_write_sr_rbr(int val) +{ + asm volatile ("cld fr28,%0\n" : : "r"(val)); +} + +static inline void cyg_hal_plf_write_sr_tbr(int val) +{ + asm volatile ("cld fr29,%0\n" : : "r"(val)); +} + +static inline void cyg_hal_plf_write_tbr(int val) +{ + asm volatile ("cld fr30,%0\n" : : "r"(val)); +} + +static inline void cyg_hal_plf_write_rbr(int val) +{ + asm volatile ("cld fr31,%0\n" : : "r"(val)); +} + +static inline int cyg_hal_plf_read_sr_rbr(void) +{ + int val; + + asm volatile ("cld %0,fr28\n" : "=r"(val) : ); + return val; +} + +static inline int cyg_hal_plf_read_sr_tbr(void) +{ + int val; + + asm volatile ("cld %0,fr29\n" : "=r"(val) : ); + return val; +} + +static inline int cyg_hal_plf_read_tbr(void) +{ + int val; + + asm volatile ("cld %0,fr30\n" : "=r"(val) : ); + return val; +} + +static inline int cyg_hal_plf_read_rbr(void) +{ + int val; + + asm volatile ("cld %0,fr31\n" : "=r"(val) : ); + return val; +} +#endif + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_PLF_IO_H diff --git a/packages/hal/calmrisc32/ceb/current/include/plf_stub.h b/packages/hal/calmrisc32/ceb/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/include/plf_stub.h @@ -0,0 +1,94 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter +// Date: 2001-02-12 +// Purpose: Platform HAL stub support for CalmRISC32 eval boards. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 +#define HAL_STUB_PLATFORM_INIT_BREAK_IRQ() CYG_EMPTY_STATEMENT + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +//----------------------------------------------------------------------------- +// Syscall support. +#ifdef CYGPKG_CYGMON +// Cygmon provides syscall handling for this board +#define SIGSYSCALL SIGSYS +extern int __get_syscall_num (void); +#endif + +extern void hal_plf_write_prog_halfword(unsigned addr, unsigned short val); + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/calmrisc32/ceb/current/misc/readme.txt b/packages/hal/calmrisc32/ceb/current/misc/readme.txt new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/misc/readme.txt @@ -0,0 +1,80 @@ +RedBoot for the Samsung CalmRISC32 core evaluation board +May 7th 2001 +README +======================================================================== + +This ReadMe contains instructions for running Redboot on the Samsung +calmRISC32 core evaluation board, and building RedBoot and ecosconfig. + +You will need the GNUPro calmrisc32-elf toolchain which should be +installed in /usr/cygnus. + +Overview +-------- +This implementation of RedBoot supports the calmRISC32 core evaluation board. +The core board has no communication channel and requires an MDSChip board to +provide a serial channel for host communication. The calmRISC32 is a harvard +architecture with separate 32-bit program and data addresses. The instruction +set provides no instruction for writing to program memory. The MDSChip board +firmware (called CalmBreaker) provides a pseudo register interface so that +code running on the core has access to a serial channel and a mechanism to +write to program memory. The serial channel is fixed at 57600-8-N-1 by the +firmware. The CalmBreaker firmware also provides a serial protocol which +allows a host to download a program and to start or stop the core board. + + +Downloading and running RedBoot +-------------------------------- +All storage on the core board is volatile, so RedBoot must be downloaded to +the board after every power cycle. Downloads require the use of a utility +program. The source file and build instructions for this utility are provided +in the RedBoot sources at: + + .../packages/hal/calmrisc32/ceb/current/support + +To download the RedBoot image, first press the reset button on the MDSChip +board. The green 'Run' LED on the core board should go off. Now, use the +utility to download the RedBoot image with: + + % calmbreaker -p /dev/term/b --reset --srec-code -f redboot.elf + +Note that the '-p /dev/term/b' specifies the serial port to use and will vary +from system to syetm. The download will take about two minutes. After it +finishes, start RedBoot with: + + % calmbreaker -p /dev/term/b --run + +The 'Run' LED on the core board should be on. Connecting to the MDSboard with +a terminal and typing enter should result in RedBoot reprinting the command +prompt. + +Rebuilding RedBoot +------------------ + +Assuming that the provided RedBoot source tree is located in the current +directory, the build process is: + + % export TOPDIR=`pwd` + % export ECOS_REPOSITORY=${TOPDIR}/packages + % mkdir ${TOPDIR}/build + % cd ${TOPDIR}/build + % ecosconfig new calm32_ceb redboot + % ecosconfig import ${ECOS_REPOSITORY}/hal/calmrisc32/current/misc/redboot_ROM.ecm + % ecosconfig tree + % make + + +Building ecosconfig +------------------- + +An ecosconfig binary is supplied in the bin directory, but you may wish +to build it from source. + +Detailed instructions for building the command-line tool ecosconfig +can be found in host/README. For example: + + mkdir $TEMP/redboot-build + cd $TEMP/redboot-build + $TOPDIR/host/configure --prefix=$TEMP/redboot-build --with-tcl=/usr + make + diff --git a/packages/hal/calmrisc32/ceb/current/misc/redboot_ROM.ecm b/packages/hal/calmrisc32/ceb/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/misc/redboot_ROM.ecm @@ -0,0 +1,65 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware ceb ; + template redboot ; + package -hardware CYGPKG_HAL_CALM32 current ; + package -hardware CYGPKG_HAL_CALM32_CORE current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_option CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; + + diff --git a/packages/hal/calmrisc32/ceb/current/src/hal_diag.c b/packages/hal/calmrisc32/ceb/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/src/hal_diag.c @@ -0,0 +1,183 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, dmoseley +// Date: 1998-03-02 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include // base types +#include // tracing macros +#include // assertion macros + +#include +#include + +#include + +#include + +//----------------------------------------------------------------------------- +// Select which diag channels to use + +//#define CYG_KERNEL_DIAG_LCD +#define CYG_KERNEL_DIAG_SERIAL + +/*---------------------------------------------------------------------------*/ + +void hal_diag_led(int x) +{ +} + +externC void diag_write_string (const char*); + +#ifdef CYG_KERNEL_DIAG_SERIAL +extern void cyg_hal_plf_comms_init(void); +extern void cyg_hal_plf_serial_putc(void*, cyg_uint8); +extern cyg_uint8 cyg_hal_plf_serial_getc(void*); +#endif + +void hal_diag_init(void) +{ +#if defined(CYGSEM_HAL_ROM_MONITOR) && !defined(CYG_KERNEL_DIAG_SERIAL) + // It's handy to have the LCD initialized at reset when using it + // for debugging output. + // The serial port likely doesn't work yet. Let's wait. + diag_write_string ("eCos ROM " __TIME__ "\n"); + diag_write_string (__DATE__ "\n"); +#endif + +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_comms_init(); +#endif +} + +#if defined(CYG_KERNEL_DIAG_LCD) +static void hal_diag_clear_lcd(void) +{ + volatile int i = 0x20000; + while (--i) ; + + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS0, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS1, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS2, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS3, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS4, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS5, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS6, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS7, ' '); +} +#endif /* defined(CYG_KERNEL_DIAG_LCD) */ + +void hal_diag_write_char(char c) +{ +#if defined(CYG_KERNEL_DIAG_LCD) + static volatile CYG_WORD* reg = HAL_DISPLAY_ASCIIPOS0; +#endif + + unsigned long __state; + + HAL_DISABLE_INTERRUPTS(__state); + + if(c == '\n') + { +#if defined(CYG_KERNEL_DIAG_LCD) + reg = HAL_DISPLAY_ASCIIPOS0; + hal_diag_clear_lcd(); +#endif +#if defined (CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_putc(NULL, '\r'); + cyg_hal_plf_serial_putc(NULL, '\n'); +#endif + } + else if (c == '\r') + { + // Ignore '\r' + } + else + { +#if defined(CYG_KERNEL_DIAG_LCD) + if (reg == HAL_DISPLAY_ASCIIPOS0) + hal_diag_clear_lcd(); + + HAL_WRITE_UINT32(reg, c); + + // Advance to next LED position. + if (reg == HAL_DISPLAY_ASCIIPOS0) + reg = HAL_DISPLAY_ASCIIPOS1; + else if (reg == HAL_DISPLAY_ASCIIPOS1) + reg = HAL_DISPLAY_ASCIIPOS2; + else if (reg == HAL_DISPLAY_ASCIIPOS2) + reg = HAL_DISPLAY_ASCIIPOS3; + else if (reg == HAL_DISPLAY_ASCIIPOS3) + reg = HAL_DISPLAY_ASCIIPOS4; + else if (reg == HAL_DISPLAY_ASCIIPOS4) + reg = HAL_DISPLAY_ASCIIPOS5; + else if (reg == HAL_DISPLAY_ASCIIPOS5) + reg = HAL_DISPLAY_ASCIIPOS6; + else if (reg == HAL_DISPLAY_ASCIIPOS6) + reg = HAL_DISPLAY_ASCIIPOS7; + else // reg == HAL_DISPLAY_ASCIIPOS7 or UNKNOWN + reg = HAL_DISPLAY_ASCIIPOS0; +#endif +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_putc(NULL, c); +#endif + } + + HAL_RESTORE_INTERRUPTS(__state); +} + +void hal_diag_read_char(char* c) +{ + *c = cyg_hal_plf_serial_getc(NULL); +} + +/*---------------------------------------------------------------------------*/ +/* End of hal_diag.c */ diff --git a/packages/hal/calmrisc32/ceb/current/src/platform.S b/packages/hal/calmrisc32/ceb/current/src/platform.S new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/src/platform.S @@ -0,0 +1,86 @@ +## +#============================================================================= +## platform.S +## +## CalmRISC32 CEB platform code +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: CalmRISC32 platform code +## Description: Platform specific code for CalmRISC32 core evb +## +## +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#ifdef CYGPKG_KERNEL +# include +#endif + +#include +#include +#include + +##----------------------------------------------------------------------------- + +##----------------------------------------------------------------------------- +# Platform Initialization. +# This code performs platform specific initialization. + +##----------------------------------------------------------------------------- +## MEMC initialization. +## + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) + +#endif /* defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) */ + + +##----------------------------------------------------------------------------- +# This code sets up a stack for applications running on redboot + +##----------------------------------------------------------------------------- +## end of platform.S diff --git a/packages/hal/calmrisc32/ceb/current/src/plf_misc.c b/packages/hal/calmrisc32/ceb/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/src/plf_misc.c @@ -0,0 +1,121 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour, dmoseley, msalter +// Date: 2000-06-06 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include + +#include // Base types +#include // tracing macros +#include // assertion macros + +#include // architectural definitions + +#include // Interrupt handling + +#include // Cache handling + +#include + +/*------------------------------------------------------------------------*/ + +#if defined(CYGPKG_CYGMON) +#include CYGHWR_MEMORY_LAYOUT_H +extern unsigned long cygmon_memsize; +#endif + +void hal_platform_init(void) +{ + // Set up eCos/ROM interfaces + hal_if_init(); +} + + +/*------------------------------------------------------------------------*/ +/* Delay for some number of useconds. */ +void +hal_delay_us(int us) +{ + us /= 20; // horrible code genration right now + while (us-- > 0) ; +} + +/*------------------------------------------------------------------------*/ +/* Reset support */ + +void hal_ceb_reset(void) +{ +} + +void hal_plf_write_prog_halfword(unsigned addr, unsigned short val) +{ + unsigned short pch = addr >> 16; + unsigned short pcl = addr & 0xffff; + + while(cyg_hal_plf_read_sr_tbr() & 1); // while TXD_FULL + cyg_hal_plf_write_tbr(pch); + cyg_hal_plf_write_sr_tbr(0x03); // addr_high short + + while(cyg_hal_plf_read_sr_tbr() & 1); // while TXD_FULL + cyg_hal_plf_write_tbr(pcl); + cyg_hal_plf_write_sr_tbr(0x05); // addr_low short + + while(cyg_hal_plf_read_sr_tbr() & 1); // while TXD_FULL + cyg_hal_plf_write_tbr(val); + cyg_hal_plf_write_sr_tbr(0x07); // program data value + + while(cyg_hal_plf_read_sr_tbr() & 1); // while TXD_FULL +} + + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/packages/hal/calmrisc32/ceb/current/src/ser.c b/packages/hal/calmrisc32/ceb/current/src/ser.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/src/ser.c @@ -0,0 +1,293 @@ +//============================================================================= +// +// ser.c +// +// Simple driver for the MDSChip serial port +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter +// Date: 2001-02-12 +// Description: Simple driver for the MDSChip serial port +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interface API +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // Helper functions +#include // CYG_ISR_HANDLED + +// We have no control over baud rate +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==57600 +#define CYG_DEV_SERIAL_BAUD_DIVISOR BAUD_57600 +#endif + +#ifndef CYG_DEV_SERIAL_BAUD_DIVISOR +#error Missing/incorrect serial baud rate defined - CDL error? +#endif + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +static const channel_data_t channels[1] = { + { (cyg_uint8*)0, 1000, 0} +}; + +//----------------------------------------------------------------------------- +// The minimal init, get and put functions. All by polling. + +void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + cyg_hal_plf_write_sr_rbr(0); + cyg_hal_plf_write_sr_tbr(0); + cyg_hal_plf_write_tbr(0); + cyg_hal_plf_write_rbr(0); +} + +void +cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 __ch) +{ + // wait for tx rdy + while (cyg_hal_plf_read_sr_tbr() != 0) ; + + // Now, write it + cyg_hal_plf_write_tbr(__ch); + + // and set TBR + cyg_hal_plf_write_sr_tbr(1); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + if (cyg_hal_plf_read_sr_rbr() == 0) + return false; + + *ch = cyg_hal_plf_read_rbr(); + + cyg_hal_plf_write_sr_rbr(0); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + return ch; +} + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); +} + + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan; + cyg_bool res; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + CYGACC_CALL_IF_DELAY_US(100); + } + + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan; + int ret = 0; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + HAL_INTERRUPT_SET_LEVEL(chan->isr_vector, 1); + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + break; + case __COMMCTL_SETBAUD: + { + cyg_uint32 baud_rate; + va_list ap; + + va_start(ap, __func); + baud_rate = va_arg(ap, cyg_uint32); + va_end(ap); + + switch (baud_rate) + { + case 57600: break; + default: return -1; + } + } + break; + + case __COMMCTL_GETBAUD: + break; + default: + break; + } + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + *__ctrlc = 0; + return 0; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(channels[0].isr_vector); + + // Init channels + cyg_hal_plf_serial_init_channel((void*)&channels[0]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +//----------------------------------------------------------------------------- +// end of ser16c550c.c + diff --git a/packages/hal/calmrisc32/ceb/current/support/README b/packages/hal/calmrisc32/ceb/current/support/README new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/support/README @@ -0,0 +1,23 @@ + +The support directory provides a tool for downloading code to the calmRISC +board. This simple application communicates over a serial line (57600-8-N-1) +with the MDSChip board which in turn controls the core eval board. + +Building the tool: + + % gcc -g -O2 calmbreaker.c -o calmbreaker + +Using the tool: + + calmbreaker [--reset] [--run] [-p serialdev] [--srec-code | --srec-data] + [-f filename] + + --reset ==> Reset the board. Stops the core. + --run ==> Start the core running at the reset vector + -p ==> Specify the serial device + --srec-code ==> Download s-records to program memory + --srec-date ==> Download s-records to data memory + -f ==> Specify s-record file. If -f is missing, use + stdin. + + diff --git a/packages/hal/calmrisc32/ceb/current/support/calmbreaker.c b/packages/hal/calmrisc32/ceb/current/support/calmbreaker.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/ceb/current/support/calmbreaker.c @@ -0,0 +1,541 @@ +/*============================================================================= +// +// calmbreaker.c +// +// Host to CalmBreaker communication utility. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-03-02 +// Purpose: +// Description: Host to CalmBreaker communication utility. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include +#include + +int ser_fd; // The com port +int is_risc16; + +void +tty_setup(int fd) +{ + struct termios t; + + memset(&t, 0, sizeof(struct termios)); + + t.c_oflag = 0; + t.c_lflag = 0; + + t.c_cflag &= ~(CSIZE | PARENB); + t.c_cflag |= CS8 | CREAD /*| CSTOPB*/; + t.c_cflag |= CLOCAL; // ignore modem status lines + + t.c_iflag = IGNBRK | IGNPAR /* | ISTRIP */ ; + + t.c_lflag &= ~ICANON; // non-canonical mode + t.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHOKE); + + t.c_cc[VMIN] = 0; + t.c_cc[VTIME] = 10; // 1 second timeout + + t.c_cflag &= ~CRTSCTS; + + /* set speed */ + cfsetispeed(&t, B57600); + cfsetospeed(&t, B57600); + + tcdrain(fd); + + if (tcsetattr(fd, TCSANOW, &t) < 0) + { + perror("tcssetattr"); + exit(1); + } +} + +static void +do_putc(unsigned char ch) +{ + // keep retrying until sent or an error is returned + while (write(ser_fd, &ch, 1) == 0); +} + +static int +do_getc(unsigned char *ucp) +{ + return read(ser_fd, ucp, 1); +} + +static int +wait_for_ack(void) +{ + unsigned char ch; + int i; + + // try for 5 seconds + for (i = 0; i < 5; i++) { + if (do_getc(&ch)) { + if (ch == '+') + return 1; + printf("Bad ack [0x%x]\n", ch); + } + } + printf("No ack\n"); + return 0; +} + +// Add prefix and checksum to packet and send to MDS board. +void +send_packet_noack(unsigned char *pkt, int len) +{ + unsigned char cksum = 0; + + do_putc(':'); + + while (len-- > 0) { + cksum += *pkt; + do_putc(*pkt++); + } + + do_putc(0x100 - cksum); +} + +// Add prefix and checksum to packet and send to MDS board. +void +send_packet(unsigned char *pkt, int len) +{ + send_packet_noack(pkt, len); + wait_for_ack(); +} + + + +// Send a packet of code or data (max 0xff bytes) +int +send_data_packet(int is_data, unsigned addr, unsigned char *buf, int buflen) +{ + unsigned char uc, cksum = 0; + int i; + + do_putc(':'); + + // code or data? + uc = is_data ? 0x52 : 0x51; + cksum += uc; + do_putc(uc); + + // code/data nwords? + uc = buflen >> 1; + cksum += uc; + do_putc(uc); + + // code/data address + uc = (unsigned char)(addr >> 24); + cksum += uc; + do_putc(uc); + uc = (unsigned char)(addr >> 16); + cksum += uc; + do_putc(uc); + uc = (unsigned char)(addr >> 8); + cksum += uc; + do_putc(uc); + uc = (unsigned char)addr; + cksum += uc; + do_putc(uc); + + while (buflen-- > 0) { + cksum += *buf; + do_putc(*buf++); + } + + do_putc(0x100 - cksum); + + return wait_for_ack(); +} + + +void +send_command(unsigned char uc) +{ + send_packet(&uc, 1); +} + +void +send_command_noack(unsigned char uc) +{ + send_packet_noack(&uc, 1); +} + +// Simple single-byte commands +void target_reset(void) { send_command(0x20); } +void target_singlestep(void) { send_command(0x22); } +void target_singlecycle(void) { send_command(0x23); } +void target_stop(void) { send_command(0x24); } +void target_run(void) { send_command_noack(0x25); } + +#define DOWNLOAD_CHUNK_SIZE 254 + +int +download_words(int is_data, unsigned addr, unsigned char *buf, int buflen) +{ + while (buflen >= DOWNLOAD_CHUNK_SIZE) { + if (!send_data_packet(is_data, addr, buf, DOWNLOAD_CHUNK_SIZE)) { + printf("Error downloading %d bytes of %s to 0x%x\n", + DOWNLOAD_CHUNK_SIZE, (is_data ? "data" : "code"), addr); + return 0; + } + addr += DOWNLOAD_CHUNK_SIZE; + buf += DOWNLOAD_CHUNK_SIZE; + buflen -= DOWNLOAD_CHUNK_SIZE; + } + if (buflen && !send_data_packet(is_data, addr, buf, buflen)) { + printf("Error downloading %d bytes of %s to 0x%x\n", + buflen, (is_data ? "data" : "code"), addr); + return 0; + } + return 1; +} + +static inline int +gethexnibble(FILE *fp) +{ + int ch; + + ch = getc(fp); + if (ch >= '0' && ch <= '9') + return (ch - '0'); + if (ch >= 'a' && ch <= 'f') + return (ch - 'a' + 10); + if (ch >= 'A' && ch <= 'F') + return (ch - 'A' + 10); + + if (ch == EOF) + fprintf(stderr, "Unexpected EOF\n"); + else + fprintf(stderr, "Bad hex char\n"); + + return -1; +} + + +static inline int +gethexbyte(FILE *fp) +{ + int nib; + unsigned char n; + + if ((nib = gethexnibble(fp)) < 0) + return -1; + n = nib << 4; + if ((nib = gethexnibble(fp)) < 0) + return -1; + n |= nib; + return n; +} + +static inline int +chk_cksum(FILE *fp, unsigned int cksum) +{ + int n; + + if ((n = gethexbyte(fp)) < 0) + return -1; + + cksum = ~cksum & 0xff; + + if (cksum != n) { + fprintf(stderr, "Bad cksum[%02x]\n", cksum); + return -1; + } + return 0; +} + +int +load_srec(FILE *fp, int is_data) +{ + int count, dcount, data, n, addr_bytes = 0, is_term, is_comment; + unsigned long address, cksum; + unsigned char data_buf[256]; + + is_comment = is_term = 0; + + do { + if ((n = getc(fp)) == EOF) + return 1; + } while (n != 'S'); + + switch (n = gethexnibble(fp)) { + case 0: + case 5: + is_comment = 1; + break; + + case 1: + case 2: + case 3: + addr_bytes = n + 1; + break; + + case 7: + case 8: + case 9: + is_term = 1; + addr_bytes = 11 - n; + break; + + default: + if (n < 0) + return -1; + fprintf(stderr, "Bad record type: %d\n", n); + return -1; + } + + if ((count = gethexbyte(fp)) < 0) + return -1; + + cksum = count; + + --count; // don't count chksum + + if (is_comment) { + while (count > 0) { + if ((n = gethexbyte(fp)) < 0) + return -1; + cksum += n; + --count; + } + if (chk_cksum(fp,cksum) < 0) + return -1; + return 0; + } + + address = 0; + while (count > 0 && addr_bytes) { + if ((n = gethexbyte(fp)) < 0) + return -1; + cksum += n; + address = (address << 8) | n; + --addr_bytes; + --count; + } + + if (is_risc16 && (address & 0x400000)) + address &= 0x3fffff; + + if (is_term) { + if (count || addr_bytes) { + fprintf(stderr, "Malformed record cnt[%d] abytes[%d]\n", + count, addr_bytes); + return -1; + } + if (chk_cksum(fp, cksum) == 0) { + fprintf(stderr, "Setting start address: 0x%08x\n", address); + return 1; + } + return -1; + } + + for (dcount = 0; dcount < count; dcount++) { + if ((data = gethexbyte(fp)) < 0) + return -1; + cksum += data; + data_buf[dcount] = data; + } + + if (chk_cksum(fp, cksum) < 0) + return -1; + + if (dcount & 1) + dcount++; + + if (!download_words(is_data, address, data_buf, dcount)) + return -1; + + return 0; +} + + +int +load_hex(FILE *fp, int is_data) +{ + int count, n, i; + unsigned long address; + unsigned char data_buf[256]; + + do { + if ((n = getc(fp)) == EOF) + return 1; + } while (n == '\r' || n == '\n'); + + if (n == '#') { + do { + if ((n = getc(fp)) == EOF) + return 1; + } while (n != '\r' && n != '\n'); + return 0; + } + + if (n != ':') { + fprintf(stderr, "Unrecognized HEX line start.\n"); + return -1; + } + + if ((count = gethexbyte(fp)) < 0) + return -1; + + address = 0; + for (i = 0; i < 4; i++) { + if ((n = gethexbyte(fp)) < 0) + return -1; + address = (address << 8) | n; + } + + // skip type byte + if ((n = gethexbyte(fp)) < 0) + return -1; + + for (i = 0; i < count; i++) { + if ((n = gethexbyte(fp)) < 0) + return -1; + data_buf[i] = n; + } + + // skip chksum byte + if ((n = gethexbyte(fp)) < 0) + return -1; + + if (count & 1) + ++count; + + if (!download_words(is_data, address, data_buf, count)) + return -1; + + return 0; +} + + +int +main(int argc, char *argv[]) +{ + int i; + int do_download = 0, is_data, is_hex; + int do_run = 0, do_reset = 0; + char *filename = NULL; + char *portname = "/dev/ttyS0"; + FILE *infile; + + if (argc == 1) { + fprintf(stderr, "Usage: mds_talk [--run] [--reset] [--srec-code | --srec-date | --hex-code | --hex-data] [-f filename] [-p serial_dev]\n"); + exit(1); + } + + is_risc16 = 0; + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--srec-code")) { + do_download = 1; + is_data = 0; + is_hex = 0; + } else if (!strcmp(argv[i], "--srec-data")) { + do_download = 1; + is_data = 1; + is_hex = 0; + } else if (!strcmp(argv[i], "--hex-code")) { + do_download = 1; + is_data = 0; + is_hex = 1; + } else if (!strcmp(argv[i], "--hex-data")) { + do_download = 1; + is_data = 1; + is_hex = 1; + } else if (!strcmp(argv[i], "--reset")) + do_reset = 1; + else if (!strcmp(argv[i], "--run")) + do_run = 1; + else if (!strcmp(argv[i], "-f")) { + if (++i >= argc) { + fprintf(stderr, "Missing filename\n"); + exit(1); + } + filename = argv[i]; + } else if (!strcmp(argv[i], "-p")) { + if (++i >= argc) { + fprintf(stderr, "Missing serial port name\n"); + exit(1); + } + portname = argv[i]; + } else if (!strcmp(argv[i], "--risc16")) { + is_risc16 = 1; + } else { + fprintf(stderr, "Unknown argument \"%s\"\n", argv[i]); + exit(1); + } + } + + if ((ser_fd = open(portname, O_RDWR | O_NOCTTY)) < 0) { + fprintf(stderr, "Can't open port %s\n", portname); + exit(1); + } + tty_setup(ser_fd); + + if (filename) { + if ((infile = fopen(filename, "r")) == NULL) { + fprintf(stderr, "Can't open file %s\n", filename); + exit(1); + } + } else + infile = stdin; + + if (do_reset) + target_reset(); + + if (do_download) { + if (is_hex) + while (!load_hex(infile, is_data)) ; + else + while (!load_srec(infile, is_data)) ; + } + + if (do_run) + target_run(); +} diff --git a/packages/hal/calmrisc32/core/current/ChangeLog b/packages/hal/calmrisc32/core/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/core/current/ChangeLog @@ -0,0 +1,38 @@ +2001-06-08 Jonathan Larmour + + * include/var_cache.h: Correctly indicate absence of cache. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/calmrisc32/core/current/cdl/hal_calm32_core.cdl b/packages/hal/calmrisc32/core/current/cdl/hal_calm32_core.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/core/current/cdl/hal_calm32_core.cdl @@ -0,0 +1,129 @@ +# ==================================================================== +# +# hal_calm32_core.cdl +# +# CalmRISC32 core variant architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): msalter +# Original data: bartv, nickg +# Contributors: +# Date: 2001-02-12 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_CALM32_CORE { + display "Core variant" + parent CYGPKG_HAL_CALM32 + hardware + include_dir cyg/hal + description " + The Calm32 core architecture HAL package provides generic support + for this processor architecture. It is also necessary to + select a specific target platform HAL package." + + implements CYGINT_HAL_CALM32_VARIANT + + define_proc { + puts $::cdl_header "#include " + } + + compile var_misc.c variant.S + + make { + /lib/target.ld: /src/calm32_core.ld + $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 target.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm target.tmp + } + + cdl_option CYGBLD_LINKER_SCRIPT { + display "Linker script" + flavor data + no_define + calculated { "src/calm32_core.ld" } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "calmrisc32-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-fno-builtin -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-g -nostdlib -Wl,--gc-sections -Wl,-static -Wl,-Map,redboot.map" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + } + +} diff --git a/packages/hal/calmrisc32/core/current/include/var_arch.h b/packages/hal/calmrisc32/core/current/include/var_arch.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/core/current/include/var_arch.h @@ -0,0 +1,65 @@ +#ifndef CYGONCE_HAL_VAR_ARCH_H +#define CYGONCE_HAL_VAR_ARCH_H + +//========================================================================== +// +// var_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Original work: nickg, dmoseley +// Date: 1999-02-17 +// Purpose: Define architecture abstractions +// Description: This file contains any extra or modified definitions for +// this variant of the architecture. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#ifndef __ASSEMBLER__ +#include +#include +#endif + +//-------------------------------------------------------------------------- +#endif // CYGONCE_HAL_VAR_ARCH_H +// End of var_arch.h diff --git a/packages/hal/calmrisc32/core/current/include/var_cache.h b/packages/hal/calmrisc32/core/current/include/var_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/core/current/include/var_cache.h @@ -0,0 +1,182 @@ +#ifndef CYGONCE_VAR_CACHE_H +#define CYGONCE_VAR_CACHE_H + +//============================================================================= +// +// var_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-02-12 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include +#include +#include + + +//----------------------------------------------------------------------------- +// Cache dimensions + +// Data cache +//#define HAL_DCACHE_SIZE 0 // Size of data cache in bytes +//#define HAL_DCACHE_LINE_SIZE 0 // Size of a data cache line +//#define HAL_DCACHE_WAYS 0 // Associativity of the cache + +// Instruction cache +//#define HAL_ICACHE_SIZE 0 // Size of cache in bytes +//#define HAL_ICACHE_LINE_SIZE 0 // Size of a cache line +//#define HAL_ICACHE_WAYS 0 // Associativity of the cache + +//#define HAL_DCACHE_SETS 0 +//#define HAL_ICACHE_SETS 0 + +//#define HAL_DCACHE_WRITETHRU_MODE 1 +//#define HAL_DCACHE_WRITEBACK_MODE 0 + +//----------------------------------------------------------------------------- +// Global control of data cache + +// Invalidate the entire cache +#define HAL_DCACHE_INVALIDATE_ALL_DEFINED +#define HAL_DCACHE_INVALIDATE_ALL() + +// Synchronize the contents of the cache with memory. +#define HAL_DCACHE_SYNC_DEFINED +#define HAL_DCACHE_SYNC() + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_asize_) + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +#define HAL_DCACHE_LOCK_DEFINED +#define HAL_DCACHE_LOCK(_base_, _asize_) + +// Undo a previous lock operation +#define HAL_DCACHE_UNLOCK_DEFINED +#define HAL_DCACHE_UNLOCK(_base_, _asize_) + +// Unlock entire cache +#define HAL_DCACHE_UNLOCK_ALL_DEFINED +#define HAL_DCACHE_UNLOCK_ALL() + + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _asize_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +#define HAL_DCACHE_FLUSH_DEFINED +#define HAL_DCACHE_FLUSH( _base_ , _asize_ ) + + +// Write dirty cache lines to memory for the given address range. +#define HAL_DCACHE_STORE_DEFINED +#define HAL_DCACHE_STORE( _base_ , _asize_ ) + +// Invalidate cache lines in the given range without writing to memory. +#define HAL_DCACHE_INVALIDATE_DEFINED +#define HAL_DCACHE_INVALIDATE( _base_ , _asize_ ) + + +//----------------------------------------------------------------------------- +// Global control of Instruction cache + +// Invalidate the entire cache +#define HAL_ICACHE_INVALIDATE_ALL_DEFINED +#define HAL_ICACHE_INVALIDATE_ALL() + +// Synchronize the contents of the cache with memory. +#define HAL_ICACHE_SYNC_DEFINED +#define HAL_ICACHE_SYNC() + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_asize_) + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +#define HAL_ICACHE_LOCK_DEFINED +#define HAL_ICACHE_LOCK(_base_, _asize_) + +// Undo a previous lock operation +#define HAL_ICACHE_UNLOCK_DEFINED +#define HAL_ICACHE_UNLOCK(_base_, _asize_) + +// Unlock entire cache +#define HAL_ICACHE_UNLOCK_ALL_DEFINED +#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +#define HAL_ICACHE_INVALIDATE_DEFINED +#define HAL_ICACHE_INVALIDATE( _base_ , _asize_ ) + +//----------------------------------------------------------------------------- +// For the flash driver. + +#define HAL_FLASH_CACHES_WANT_OPTIMAL + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_VAR_CACHE_H +// End of var_cache.h diff --git a/packages/hal/calmrisc32/core/current/include/var_intr.h b/packages/hal/calmrisc32/core/current/include/var_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/core/current/include/var_intr.h @@ -0,0 +1,71 @@ +#ifndef CYGONCE_HAL_VAR_INTR_H +#define CYGONCE_HAL_VAR_INTR_H + +//========================================================================== +// +// imp_intr.h +// +// CalmRISC32 Core Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: msalter +// Date: 2001-02-12 +// Purpose: MIPS32 Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for variants of the MIPS32 +// architecture. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include + +#include + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_VAR_INTR_H +// End of var_intr.h diff --git a/packages/hal/calmrisc32/core/current/include/variant.inc b/packages/hal/calmrisc32/core/current/include/variant.inc new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/core/current/include/variant.inc @@ -0,0 +1,129 @@ +#ifndef CYGONCE_HAL_VARIANT_INC +#define CYGONCE_HAL_VARIANT_INC +##============================================================================= +## +## variant.inc +## +## CalmRISC32 Core family assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: Calm32 Core family definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the CalmRISC32 family. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include + +#include + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include + +##----------------------------------------------------------------------------- +## Define CPU variant for architecture HAL. + +#define CYG_HAL_CALM32_CORE + +#------------------------------------------------------------------------------ +# Cache macros. + +#ifndef CYGPKG_HAL_CALM32_CACHE_DEFINED + + .macro hal_cache_init + .endm + +#define CYGPKG_HAL_CALM32_CACHE_DEFINED + +#endif + +#------------------------------------------------------------------------------ +# Monitor initialization. + +#ifndef CYGPKG_HAL_CALM32_MON_DEFINED + +#if defined(CYG_HAL_STARTUP_ROM) || \ + ( defined(CYG_HAL_STARTUP_RAM) && \ + !defined(CYGSEM_HAL_USE_ROM_MONITOR)) + # If we are starting up from ROM, or we are starting in + # RAM and NOT using a ROM monitor, initialize the VSR table. + + .macro hal_mon_init + .endm + +#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR) + + # Initialize the VSR table entries + # We only take control of the interrupt vector, + # the rest are left to the ROM for now... + + .macro hal_mon_init + .endm + +#else + + .macro hal_mon_init + .endm + +#endif + + +#define CYGPKG_HAL_CALM32_MON_DEFINED + +#endif + +#------------------------------------------------------------------------------ +# Decide whether the VSR table is defined externally, or is to be defined +# here. + +//#define CYG_HAL_CALM32_VSR_TABLE_DEFINED + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_VARIANT_INC +# end of variant.inc diff --git a/packages/hal/calmrisc32/core/current/src/calm32_core.ld b/packages/hal/calmrisc32/core/current/src/calm32_core.ld new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/core/current/src/calm32_core.ld @@ -0,0 +1,363 @@ +//=========================================================================== +// +// MLT linker script for CalmRISC32 Core +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + +#include + +OUTPUT_FORMAT("elf64-calmrisc32", "elf64-calmrisc32", + "elf64-calmrisc32") + +OUTPUT_ARCH(calmrisc32) + +STARTUP(vectors.o) +ENTRY(reset_vector) +#ifdef EXTRAS +INPUT(extras.o) +#endif +GROUP(libtarget.a libgcc.a) + +#define ALIGN_LMA 0x40 +#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1)) +#define LMA_EQ_VMA +#define FORCE_OUTPUT . = . + +#define SECTIONS_BEGIN + +#if defined(CYG_HAL_STARTUP_RAM) + +/* this version for RAM startup */ +#define SECTION_vectors(_region_, _vma_, _lma_) \ + .vectors _vma_ : _lma_ \ + { KEEP (*(.vectors)) } \ + > _region_ + +#elif defined(CYG_HAL_STARTUP_ROM) + +/* this version for ROM startup */ +#define SECTION_vectors(_region_, _vma_, _lma_) \ + .vectors _vma_ : _lma_ \ + { KEEP (*(.vectors)) } > _region_ + +#endif /* ROM startup version of ROM vectors */ + +#define SECTION_ROMISC(_region_, _vma_, _lma_) \ + .interp _vma_ : _lma_ { *(.interp) } > _region_ \ + .hash : FOLLOWING(.interp) { *(.hash) } > _region_ \ + .dynsym : FOLLOWING(.hash) { *(.dynsym) } > _region_ \ + .dynstr : FOLLOWING(.dynsym) { *(.dynstr) } > _region_ \ + .gnu.version : FOLLOWING(.dynstr) { *(.gnu.version) } > _region_ \ + .gnu.version_d : FOLLOWING(.gnu.version) { *(.gnu.version_d) } > _region_ \ + .gnu.version_r : FOLLOWING(.gnu.version_d) { *(.gnu.version_r) } > _region_ + +#define SECTION_RELOCS(_region_, _vma_, _lma_) \ + .rel.text : \ + { \ + *(.rel.text) \ + *(.rel.text.*) \ + *(.rel.gnu.linkonce.t*) \ + } > _region_ \ + .rela.text : \ + { \ + *(.rela.text) \ + *(.rela.text.*) \ + *(.rela.gnu.linkonce.t*) \ + } > _region_ \ + .rel.data : \ + { \ + *(.rel.data) \ + *(.rel.data.*) \ + *(.rel.gnu.linkonce.d*) \ + } > _region_ \ + .rela.data : \ + { \ + *(.rela.data) \ + *(.rela.data.*) \ + *(.rela.gnu.linkonce.d*) \ + } > _region_ \ + .rel.rodata : \ + { \ + *(.rel.rodata) \ + *(.rel.rodata.*) \ + *(.rel.gnu.linkonce.r*) \ + } > _region_ \ + .rela.rodata : \ + { \ + *(.rela.rodata) \ + *(.rela.rodata.*) \ + *(.rela.gnu.linkonce.r*) \ + } > _region_ \ + .rel.got : { *(.rel.got) } > _region_ \ + .rela.got : { *(.rela.got) } > _region_ \ + .rel.ctors : { *(.rel.ctors) } > _region_ \ + .rela.ctors : { *(.rela.ctors) } > _region_ \ + .rel.dtors : { *(.rel.dtors) } > _region_ \ + .rela.dtors : { *(.rela.dtors) } > _region_ \ + .rel.init : { *(.rel.init) } > _region_ \ + .rela.init : { *(.rela.init) } > _region_ \ + .rel.fini : { *(.rel.fini) } > _region_ \ + .rela.fini : { *(.rela.fini) } > _region_ \ + .rel.bss : { *(.rel.bss) } > _region_ \ + .rela.bss : { *(.rela.bss) } > _region_ \ + .rel.plt : { *(.rel.plt) } > _region_ \ + .rela.plt : { *(.rela.plt) } > _region_ \ + .rel.dyn : { *(.rel.dyn) } > _region_ + +#define SECTION_init(_region_, _vma_, _lma_) \ + .init _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; KEEP (*(.init)) \ + } > _region_ =0x9e90 + +#define SECTION_text(_region_, _vma_, _lma_) \ + .text _vma_ : _lma_ \ + { \ + _stext = .; _ftext = . ; \ + *(.text) \ + *(.text.*) \ + *(.stub) \ + *(.gnu.warning) \ + *(.gnu.linkonce.t*) \ + } > _region_ =0x9e90 \ + _etext = .; PROVIDE (etext = .); + +#define SECTION_fini(_region_, _vma_, _lma_) \ + .fini _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; KEEP (*(.fini)) \ + } > _region_ =0x9e90 + +#define SECTION_rodata(_region_, _vma_, _lma_) \ + .rodata _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) \ + } > _region_ + +#define SECTION_rodata1(_region_, _vma_, _lma_) \ + .rodata1 _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.rodata1) *(.rodata1.*) \ + } > _region_ + +#define SECTION_vsr_table(_region_, _vma_, _lma_) \ + .vsr_table _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.vsr_table) \ + } > _region_ + +#define SECTION_data(_region_, _vma_, _lma_) \ + .data _vma_ : _lma_ \ + { \ + __ram_data_start = ABSOLUTE (.); _fdata = . ; \ + *(.data) *(.data.*) *(.gnu.linkonce.d*) \ + . = ALIGN (8); \ + SORT(CONSTRUCTORS) \ + } > _region_ \ + __rom_data_start = LOADADDR(.data); + +#define SECTION_data1(_region_, _vma_, _lma_) \ + .data1 _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.data1) *(.data1.*) \ + } > _region_ + +#define SECTION_eh_frame(_region_, _vma_, _lma_) \ + .eh_frame _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.eh_frame) \ + } > _region_ + +#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ + .gcc_except_table _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.gcc_except_table) \ + } > _region_ + + + /* 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. */ + + /* We don't want to include the .ctors section 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 */ + +/* FIXME: We shouldn't need to define __CTOR_LIST__/__CTOR_END__ + and __DTOR_LIST__/__DTOR_END__ except by the PROVIDE lines. + However this doesn't work for old (99r1-era) toolchains, so + leave it for now. */ + +#define SECTION_ctors(_region_, _vma_, _lma_) \ + .ctors _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; \ + KEEP (*crtbegin.o(.ctors)) \ + __CTOR_LIST__ = .; \ + PROVIDE (__CTOR_LIST__ = .); \ + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) \ + KEEP (*(SORT(.ctors.*))) \ + KEEP (*(.ctors)) \ + __CTOR_END__ = .; \ + PROVIDE (__CTOR_END__ = .); \ + } > _region_ + +#define SECTION_dtors(_region_, _vma_, _lma_) \ + .dtors _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; \ + KEEP (*crtbegin.o(.dtors)) \ + __DTOR_LIST__ = .; \ + PROVIDE (__DTOR_LIST__ = .); \ + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) \ + KEEP (*(SORT(.dtors.*))) \ + KEEP (*(.dtors)) \ + __DTOR_END__ = .; \ + PROVIDE (__DTOR_END__ = .); \ + } > _region_ + +#define SECTION_devtab(_region_, _vma_, _lma_) \ + .devtab _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; \ + KEEP(*( SORT (.ecos.table.*))) ; \ + } > _region_ + +#define SECTION_got(_region_, _vma_, _lma_) \ + _gp = ALIGN(16) + 0x7ff0; \ + .got _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.got.plt) *(.got) \ + } > _region_ + +#define SECTION_dynamic(_region_, _vma_, _lma_) \ + .dynamic _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.dynamic) \ + } > _region_ + + /* 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. */ + +#define SECTION_sdata(_region_, _vma_, _lma_) \ + .sdata _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnulinkonce.s*) \ + } > _region_ + +#define SECTION_lit8(_region_, _vma_, _lma_) \ + .lit8 _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.lit8) \ + } > _region_ + +#define SECTION_lit4(_region_, _vma_, _lma_) \ + .lit4 : FOLLOWING(.lit8) \ + { \ + FORCE_OUTPUT; *(.lit4) \ + } > _region_ \ + __ram_data_end = .; _edata = . ; \ + PROVIDE (edata = .); + +#define SECTION_sbss(_region_, _vma_, _lma_) \ + __bss_start = .; _fbss = .; \ + .sbss _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.dynsbss) *(.sbss) *(.sbss.*) *(.gnu.linkonce.sb.*) *(.scommon) \ + } > _region_ + +#define SECTION_bss(_region_, _vma_, _lma_) \ + .bss _vma_ : _lma_ \ + { \ + *(.dynbss) *(.bss) *(.bss.*) *(.gnu.linkonce.b.*) *(COMMON) \ + } > _region_ \ + __bss_end = .; + +/* The /DISCARD/ section ensures that the output will not contain a + * .mdebug section as it confuses GDB. This is a workaround for CR 100804. + */ + +#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); \ + /* 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) } \ + .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) } \ + /* These must appear regardless of . */ \ + .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } \ + .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } \ + /DISCARD/ 0 : { *(.mdebug) } + +#include CYGHWR_MEMORY_LAYOUT_LDI + +_hal_vsr_table = 0x0; +_hal_virtual_vector_table = 0x100; diff --git a/packages/hal/calmrisc32/core/current/src/var_misc.c b/packages/hal/calmrisc32/core/current/src/var_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/core/current/src/var_misc.c @@ -0,0 +1,105 @@ +//========================================================================== +// +// var_misc.c +// +// HAL implementation miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour, dmoseley, msalter +// Date: 2000-07-14 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // Base types +#include // tracing macros +#include // assertion macros + +#include + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include +#include +#include +#include + +/*------------------------------------------------------------------------*/ +// Array which stores the configured priority levels for the configured +// interrupts. + +volatile CYG_BYTE hal_interrupt_level[CYGNUM_HAL_ISR_COUNT]; + +/*------------------------------------------------------------------------*/ + +void hal_variant_init(void) +{ +} + + +/*------------------------------------------------------------------------*/ +// Initialize the caches + +int hal_init_icache(unsigned long config1_val) +{ +} + +int hal_init_dcache(unsigned long config1_val) +{ +} + +void hal_c_cache_init(unsigned long config1_val) +{ +} + +void hal_icache_sync(void) +{ +} + +void hal_dcache_sync(void) +{ +} + +/*------------------------------------------------------------------------*/ +/* End of var_misc.c */ diff --git a/packages/hal/calmrisc32/core/current/src/variant.S b/packages/hal/calmrisc32/core/current/src/variant.S new file mode 100644 --- /dev/null +++ b/packages/hal/calmrisc32/core/current/src/variant.S @@ -0,0 +1,76 @@ +##============================================================================= +## +## variant.S +## +## CalmRISC32 Core variant code +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): msalter +## Contributors: msalter +## Date: 2001-02-12 +## Purpose: CalmRISC32 Core variant code +## Description: Variant specific code for CalmRISC32 architecture. +## +## +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS + +#ifdef CYGPKG_KERNEL +# include +#endif + +#include + +#include +#include + +##----------------------------------------------------------------------------- +# Variant Initialization. +# This code performs variant specific initialization. + +##----------------------------------------------------------------------------- +## end of variant.S + diff --git a/packages/hal/common/current/ChangeLog b/packages/hal/common/current/ChangeLog --- a/packages/hal/common/current/ChangeLog +++ b/packages/hal/common/current/ChangeLog @@ -1,3 +1,125 @@ +2002-05-13 Jesper Skov + + * cdl/hal.cdl: Removed + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED option and its + dependencies. + +2002-05-02 Nick Garnett + + * doc/hal.sgml: Added description of HAL_DELAY_US(). + + * doc/porting.sgml: Expanded section on architecture porting. + +2002-04-30 Jonathan Larmour + + * src/gdb-fileio.c (cyg_hal_gdbfileio_process_F_packet): Reset + retcode/errno/ctrlc status every F packet. + +2002-04-23 Jesper Skov + + * doc/porting.sgml: Fix some typos. + +2002-04-22 Jonathan Larmour + + * include/generic-stub.h: Prototype __getpacket(). + * src/generic-stub.c: Rename getpacket() -> __getpacket(), + remcomInBuffer -> __remcomInBuffer, and + remcomOutBuffer -> __remcomOutBuffer throughout file, and export + them (i.e. not file local). + (__process_packet): Handle $F packets file I/O protocol responses. + + * src/gdb-fileio.c: New file to implement file I/O operations over + the GDB remote protocol. + * src/gdb-fileio.h: New file. Header for above. + +2002-03-15 Nick Garnett + + * doc/porting.sgml: Platform HAL porting guide tidied up and + expanded somewhat. Some work also done on variant + guide. Architecture guided needs a lot more work. + + * doc/hal.sgml: Changed explicit section tags to recursive section + tags to make any future restructuring easier. + +2002-03-14 Nick Garnett + + * src/hal_stub.c: Add calls to HAL memory access check macros in + memory access functions. + + * include/hal_stub.h: Added default definitions for HAL memory access + check macros. + +2002-03-06 Nick Garnett + + * tests/cache.c: Changed tests so that zero sized caches and HALs + that define HAL_DCACHE_PURGE_ALL() don't cause this test to throw + a compilation error. + +2002-02-28 Jesper Skov + + * src/generic-stub.c (__handle_exception): Pay attention to return + value from hal_syscall_handler. + +2002-02-21 Mark Salter + + * src/hal_if.c (cyg_hal_diag_mangler_gdb_flush): Don't do anything + if buffer is empty. + +2002-02-20 Nick Garnett + + * doc/hal.sgml: Updated and tidied. Now includes porting guide + from a separate file. + + * doc/porting.sgml: Added this file to contain the porting guide + section of the HAL document. This is currently largely a + conversion of Jesper's porting guide from the website. + Unfortunately I have had no time to do much more than include it + wholesale, with only minor edits. There are some notes at the end + of the file describing what I would like to do. + +2002-02-18 Nick Garnett + + * doc/hal.sgml: Restructured most of this document and rewrote + large chunks of the basic HAL description stuff. Only the skeleton + of the porting guided is currently done. This checkin in mostly + for safety and to let others read the current state. + +2002-02-06 Mark Salter + + * src/hal_if.c (cyg_hal_diag_mangler_gdb_control): Add flush support. + (cyg_hal_diag_mangler_gdb_flush): New function to flush mangler output. + (cyg_hal_diag_mangler_gdb_putc): Use new function to flush output. + +2002-01-30 Hugo Tyson + + * include/hal_if.h (CYGNUM_FLASH_CFG_OP_CONFIG_INT): New defines for + getting Flash Config options out of RedBoot using VV call + CYGACC_CALL_IF_FLASH_CFG_OP(). These need to be kept uptodate + with (or must override) those in RedBoot's flash_config.h + Previously only used for getting an ESA. + +2002-01-25 Hugo Tyson + + * src/generic-stub.c (__process_packet): If detach or kill, call + sys_profile_reset() if BSP_SYSCALLS_GPROF are enabled, to clear + out any dangerous state there. Such as a callback function + pointer into application code. + +2002-01-23 Jonathan Larmour + + * include/drv_api.h: Add cyg_drv_interrupt_mask/unmask_intunsafe + * src/drv_api.c: Ditto. And modify + cyg_drv_interrupt_mask/unmask to be interrupt safe. + +2002-01-21 Mark Salter + + * include/hal_spd.h: New file. Definitions for SDRAM module SPD. + +2002-01-18 Jesper Skov + + * src/hal_stub.c (__build_t_packet): don't declare extend_val + twice. + 2001-12-12 Jesper Skov * include/hal_stub.h: Add goto to the used label. @@ -1953,27 +2075,36 @@ 1998-08-18 Nick Garnett +The eCos Hardware Abstraction Layer (HAL) + + + + +Introduction + +This is an initial specification of the eCos Hardware Abstraction Layer (HAL). The HAL abstracts +the underlying hardware of a processor architecture and/or the +platform to a level sufficient for the eCos kernel to be ported onto +that platform. + + + +Caveat + +This document is an informal description of the HAL capabilities and +is not intended to be full documentation, although it may be used as a +source for such. It also describes the HAL as it is currently +implemented for the architectures targeted in this release. It most +closely describes the HALs for the MIPS, I386 and PowerPC HALs. Other +architectures are similar but may not be organized precisely as +described here. + + + + + + + + + +Architecture, Variant and Platform + + +We have identified three levels at which the HAL must operate. + + + + + + The architecture + HAL abstracts the basic CPU architecture and includes + things like interrupt delivery, context switching, CPU startup + etc. + + + + + + The variant HAL + encapsulates features of the CPU variant such as caches, MMU and + FPU features. It also deals with any on-chip peripherals such as + memory and interrupt controllers. For architectural variations, + the actual implementation of the variation is often in the + architectural HAL, and the variant HAL simply provides the correct + configuration definitions. + + + + + + The platform HAL + abstracts the properties of the current platform and includes + things like platform startup, timer devices, I/O register access + and interrupt controllers. + + + + + + +The boundaries between these three HAL levels are necessarily blurred +since functionality shifts between levels on a target-by-target basis. +For example caches and MMU may be either an architecture feature or a +variant feature. Similarly, memory and interrupt controllers may be +on-chip and in the variant HAL, or off-chip and in the platform HAL. + + +Generally there is a separate package for each of the architecture, +variant and package HALs for a target. For some of the older targets, +or where it would be essentially empty, the variant HAL is omitted. + + + + + + + +General principles + + +The HAL has been implemented according to the following general +principles: + + + + The HAL is implemented in C and assembler, although the + eCos kernel is largely implemented in C++. + This is to permit the HAL the widest possible + applicability. + + +All interfaces to the HAL are implemented by + CPP macros. This allows them to be implemented as inline + C code, inline assembler or function calls to external C + or assembler code. This allows the most efficient + implementation to be selected without affecting the + interface. It also allows them to be redefined if the + platform or variant HAL needs to replace or enhance a definition + from the architecture HAL. + + +The HAL provides simple, portable mechanisms for dealing +with the hardware of a wide range of architectures and platforms. +It is always possible to bypass the HAL and program the hardware +directly, but this may lead to a loss of portability. + + + + + + + + +<!-- <index></index> --><!-- <xref> -->HAL Interfaces + + +This section describes the main HAL interfaces. + + + + +
+Base Definitions + + +These are definitions that characterize the properties of the base +architecture that are used to compile the portable parts of the +kernel. They are concerned with such things a portable type +definitions, endianness, and labeling. + + + +These definitions are supplied by the +cyg/hal/basetype.h header file which is supplied +by the architecture HAL. It is included automatically by +cyg/infra/cyg_type.h. + + + + +
+Byte order + + + CYG_BYTEORDER + + + This defines the byte order of the target and must be set to either + CYG_LSBFIRST or CYG_MSBFIRST. + + + + +
+ + + +
+Label Translation + + + + CYG_LABEL_NAME(name) + + + + This is a wrapper used in some C and C++ files which + use labels defined in assembly code or the linker script. + It need only be defined if the default implementation in + cyg/infra/cyg_type.h, which passes the name + argument unaltered, is inadequate. It should be paired with + CYG_LABEL_DEFN(). + + + + + CYG_LABEL_DEFN(name) + + + + This is a wrapper used in assembler sources and linker scripts + which define labels. It need only be defined if the default + implementation in + cyg/infra/cyg_type.h, which passes the name + argument unaltered, is inadequate. The most usual alternative + definition of this macro prepends an underscore to the label + name. + + + + +
+ + + + +
+Base types + + cyg_halint8 + cyg_halint16 + cyg_halint32 + cyg_halint64 + cyg_halcount8 + cyg_halcount16 + cyg_halcount32 + cyg_halcount64 + cyg_halbool + + +These macros define the C base types that should be used to define +variables of the given size. They only need to be defined if the +default types specified in cyg/infra/cyg_type.h +cannot be used. Note that these are only the base types, they will be +composed with signed and +unsigned to form full type specifications. + +
+ + + +
+Atomic types + + cyg_halatomic CYG_ATOMIC + + +These types are guaranteed to be read or written in a single +uninterruptible operation. It is architecture defined what size this +type is, but it will be at least a byte. + +
+ +
+ + + + +
+Architecture Characterization + + +These are definition that are related to the basic architecture of the +CPU. These include the CPU context save format, context switching, bit +twiddling, breakpoints, stack sizes and address translation. + + + +Most of these definition are found in +cyg/hal/hal_arch.h. This file is supplied by the +architecture HAL. If there are variant or platform specific +definitions then these will be found in +cyg/hal/var_arch.h or +cyg/hal/plf_arch.h. These files are include +automatically by this header, so need not be included explicitly. + + + + +
+Register Save Format + +typedef struct HAL_SavedRegisters +{ + /* architecture-dependent list of registers to be saved */ +} HAL_SavedRegisters; + + +This structure describes the layout of a saved machine state on the +stack. Such states are saved during thread context switches, +interrupts and exceptions. Different quantities of state may be saved +during each of these, but usually a thread context state is a subset +of the interrupt state which is itself a subset of an exception state. +For debugging purposes, the same structure is used for all three +purposes, but where these states are significantly different, this +structure may contain a union of the three states. + +
+ + + + +
+Thread Context Initialization + + +HAL_THREAD_INIT_CONTEXT( sp, arg, entry, id ) + + + +This macro initializes a thread's context so that +it may be switched to by HAL_THREAD_SWITCH_CONTEXT(). +The arguments are: + + + + sp + + + A location containing the current value of the thread's stack + pointer. This should be a variable or a structure field. The SP + value will be read out of here and an adjusted value written + back. + + + + + + arg + + + A value that is passed as the first argument to the entry + point function. + + + + + entry + + + The address of an entry point function. This will be called + according the C calling conventions, and the value of + arg will be passed as the first + argument. This function should have the following type signature + void entry(CYG_ADDRWORD arg). + + + + + id + + + A thread id value. This is only used for debugging purposes, + it is ORed into the initialization pattern for unused registers + and may be used to help identify the thread from its register dump. + The least significant 16 bits of this value should be zero to allow + space for a register identifier. + + + + +
+ + + +
+Thread Context Switching + + +HAL_THREAD_LOAD_CONTEXT( to ) +HAL_THREAD_SWITCH_CONTEXT( from, to ) + + +These macros implement the thread switch code. The arguments are: + + + + + from + + + A pointer to a location where the stack pointer of the current + thread will be stored. + + + + + to + + + A pointer to a location from where the stack pointer of the next + thread will be read. + + + + + + +For HAL_THREAD_LOAD_CONTEXT() the current CPU +state is discarded and the state of the destination thread is +loaded. This is only used once, to load the first thread when the +scheduler is started. + + + +For HAL_THREAD_SWITCH_CONTEXT() the state of the +current thread is saved onto its stack, using the current value of the +stack pointer, and the address of the saved state placed in +*from. The value in +*to is then read and the state of the new +thread is loaded from it. + + + +While these two operations may be implemented with inline assembler, +they are normally implemented as calls to assembly code functions in +the HAL. There are two advantages to doing it this way. First, the +return link of the call provides a convenient PC value to be used in +the saved context. Second, the calling conventions mean that the +compiler will have already saved the caller-saved registers before the +call, so the HAL need only save the callee-saved registers. + + + +The implementation of HAL_THREAD_SWITCH_CONTEXT() +saves the current CPU state on the stack, including the current +interrupt state (or at least the register that contains it). For +debugging purposes it is useful to save the entire register set, but +for performance only the ABI-defined callee-saved registers need be +saved. If it is implemented, the option +CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM controls +how many registers are saved. + + + +The implementation of HAL_THREAD_LOAD_CONTEXT() +loads a thread context, destroying the current context. With a little +care this can be implemented by sharing code with +HAL_THREAD_SWITCH_CONTEXT(). To load a thread +context simply requires the saved registers to be restored from the +stack and a jump or return made back to the saved PC. + + + +Note that interrupts are not disabled during this process, any +interrupts that occur will be delivered onto the stack to which the +current CPU stack pointer points. Hence the stack pointer +should never be invalid, or loaded with a value that might cause the +saved state to become corrupted by an interrupt. However, the current +interrupt state is saved and restored as part of the thread +context. If a thread disables interrupts and does something to cause a +context switch, interrupts may be re-enabled on switching to another +thread. Interrupts will be disabled again when the original thread +regains control. + + +
+ + + +
+Bit indexing + + +HAL_LSBIT_INDEX( index, mask ) +HAL_MSBIT_INDEX( index, mask ) + + + +These macros place in index the bit index of +the least significant bit in mask. Some +architectures have instruction level support for one or other of these +operations. If no architectural support is available, then these +macros may call C functions to do the job. + +
+ + + +
+Idle thread activity + + +HAL_IDLE_THREAD_ACTION( count ) + + + +It may be necessary under some circumstances for the HAL to execute +code in the kernel idle thread's loop. An example might be to execute +a processor halt instruction. This macro provides a portable way of +doing this. The argument is a copy of the idle thread's loop counter, +and may be used to trigger actions at longer intervals than every +loop. + +
+ + + +
+Reorder barrier + + +HAL_REORDER_BARRIER() + + + +When optimizing the compiler can reorder code. In some parts of +multi-threaded systems, where the order of actions is vital, this can +sometimes cause problems. This macro may be inserted into places where +reordering should not happen and prevents code being migrated across +it by the compiler optimizer. It should be placed between statements +that must be executed in the order written in the code. + +
+ + + +
+Breakpoint support + + +HAL_BREAKPOINT( label ) +HAL_BREAKINST +HAL_BREAKINST_SIZE + + + +These macros provide support for breakpoints. + + + +HAL_BREAKPOINT() executes a breakpoint +instruction. The label is defined at the breakpoint instruction so +that exception code can detect which breakpoint was executed. + + + +HAL_BREAKINST contains the breakpoint instruction +code as an integer value. HAL_BREAKINST_SIZE is +the size of that breakpoint instruction in bytes. Together these +may be used to place a breakpoint in any code. + +
+ + + +
+GDB support + + +HAL_THREAD_GET_SAVED_REGISTERS( sp, regs ) +HAL_GET_GDB_REGISTERS( regval, regs ) +HAL_SET_GDB_REGISTERS( regs, regval ) + + + +These macros provide support for interfacing GDB to the HAL. + + + +HAL_THREAD_GET_SAVED_REGISTERS() extracts a +pointer to a HAL_SavedRegisters structure +from a stack pointer value. The stack pointer passed in should be the +value saved by the thread context macros. The macro will assign a +pointer to the HAL_SavedRegisters structure +to the variable passed as the second argument. + + + +HAL_GET_GDB_REGISTERS() translates a register +state as saved by the HAL and into a register dump in the format +expected by GDB. It takes a pointer to a +HAL_SavedRegisters structure in the +regs argument and a pointer to the memory to +contain the GDB register dump in the regval +argument. + + + +HAL_SET_GDB_REGISTERS() translates a GDB format +register dump into a the format expected by the HAL. It takes a +pointer to the memory containing the GDB register dump in the +regval argument and a pointer to a +HAL_SavedRegisters structure +in the regs argument. + +
+ + + +
+Setjmp and longjmp support + + +CYGARC_JMP_BUF_SIZE +hal_jmp_buf[CYGARC_JMP_BUF_SIZE] +hal_setjmp( hal_jmp_buf env ) +hal_longjmp( hal_jmp_buf env, int val ) + + + +These functions provide support for the C +setjmp() and longjmp() +functions. Refer to the C library for further information. + + +
+ + + +
+Stack Sizes + +CYGNUM_HAL_STACK_SIZE_MINIMUM +CYGNUM_HAL_STACK_SIZE_TYPICAL + + + +The values of these macros define the minimum and typical sizes of +thread stacks. + + + +CYGNUM_HAL_STACK_SIZE_MINIMUM defines the minimum +size of a thread stack. This is enough for the thread to function +correctly within eCos and allows it to take interrupts and context +switches. There should also be enough space for a simple thread entry +function to execute and call basic kernel operations on objects like +mutexes and semaphores. However there will not be enough room for much +more than this. When creating stacks for their own threads, +applications should determine the stack usage needed for application +purposes and then add +CYGNUM_HAL_STACK_SIZE_MINIMUM. + + + +CYGNUM_HAL_STACK_SIZE_TYPICAL is a reasonable increment over +CYGNUM_HAL_STACK_SIZE_MINIMUM, usually about 1kB. This should be +adequate for most modest thread needs. Only threads that need to +define significant amounts of local data, or have very deep call trees +should need to use a larger stack size. + + +
+ + + + +
+Address Translation + + +CYGARC_CACHED_ADDRESS(addr) +CYGARC_UNCACHED_ADDRESS(addr) +CYGARC_PHYSICAL_ADDRESS(addr) + + + +These macros provide address translation between different views of +memory. In many architectures a given memory location may be visible +at different addresses in both cached and uncached forms. It is also +possible that the MMU or some other address translation unit in the +CPU presents memory to the program at a different virtual address to +its physical address on the bus. + + + +CYGARC_CACHED_ADDRESS() translates the given +address to its location in cached memory. This is typically where the +application will access the memory. + + + +CYGARC_UNCACHED_ADDRESS() translates the given +address to its location in uncached memory. This is typically where +device drivers will access the memory to avoid cache problems. It may +additionally be necessary for the cache to be flushed before the +contents of this location is fully valid. + + + +CYGARC_PHYSICAL_ADDRESS() translates the given +address to its location in the physical address space. This is +typically the address that needs to be passed to device hardware such +as a DMA engine, ethernet device or PCI bus bridge. The physical +address may not be directly accessible to the program, it may be +re-mapped by address translation. + + +
+ + + + +
+Global Pointer + + +CYGARC_HAL_SAVE_GP() +CYGARC_HAL_RESTORE_GP() + + + +These macros insert code to save and restore any global data pointer +that the ABI uses. These are necessary when switching context between +two eCos instances - for example between an eCos application and +RedBoot. + + +
+ +
+ + + + +
+Interrupt Handling + + +These interfaces contain definitions related to interrupt +handling. They include definitions of exception and interrupt numbers, +interrupt enabling and masking, and realtime clock operations. + + + +These definitions are normally found in +cyg/hal/hal_intr.h. This file is supplied by the +architecture HAL. Any variant or platform specific definitions will +be found in cyg/hal/var_intr.h, +cyg/hal/plf_intr.h or +cyg/hal/hal_platform_ints.h in the variant or platform +HAL, depending on the exact target. These files are include +automatically by this header, so need not be included explicitly. + + + + +
+Vector numbers + + +CYGNUM_HAL_VECTOR_XXXX +CYGNUM_HAL_VSR_MIN +CYGNUM_HAL_VSR_MAX +CYGNUM_HAL_VSR_COUNT + +CYGNUM_HAL_INTERRUPT_XXXX +CYGNUM_HAL_ISR_MIN +CYGNUM_HAL_ISR_MAX +CYGNUM_HAL_ISR_COUNT + +CYGNUM_HAL_EXCEPTION_XXXX +CYGNUM_HAL_EXCEPTION_MIN +CYGNUM_HAL_EXCEPTION_MAX +CYGNUM_HAL_EXCEPTION_COUNT + + + +All possible VSR, interrupt and exception vectors are specified here, +together with maximum and minimum values for range checking. While the +VSR and exception numbers will be defined in this file, the interrupt +numbers will normally be defined in the variant or platform HAL file +that is included by this header. + + + +There are two ranges of numbers, those for the vector service +routines and those for the interrupt service routines. The relationship +between these two ranges is undefined, and no equivalence should +be assumed if vectors from the two ranges coincide. + + + +The VSR vectors correspond to the set of exception vectors that can be +delivered by the CPU architecture, many of these will be internal +exception traps. The ISR vectors correspond to the set of external +interrupts that can be delivered and are usually determined by extra +decoding of the interrupt controller by the interrupt VSR. + + + +Where a CPU supports synchronous exceptions, the range of such +exceptions allowed are defined by CYGNUM_HAL_EXCEPTION_MIN and +CYGNUM_HAL_EXCEPTION_MAX. The +CYGNUM_HAL_EXCEPTION_XXXX definitions are +standard names used by target independent code to test for the +presence of particular exceptions in the architecture. The actual +exception numbers will normally correspond to the VSR exception +range. In future other exceptions generated by the system software +(such as stack overflow) may be added. + + + +CYGNUM_HAL_ISR_COUNT, CYGNUM_HAL_VSR_COUNT and +CYGNUM_HAL_EXCEPTION_COUNT define the number of +ISRs, VSRs and EXCEPTIONs respectively for the purposes of defining +arrays etc. There might be a translation from the supplied vector +numbers into array offsets. Hence +CYGNUM_HAL_XXX_COUNT may not simply be +CYGNUM_HAL_XXX_MAX - CYGNUM_HAL_XXX_MIN or CYGNUM_HAL_XXX_MAX+1. + + +
+ + + + +
+Interrupt state control + + +CYG_INTERRUPT_STATE +HAL_DISABLE_INTERRUPTS( old ) +HAL_RESTORE_INTERRUPTS( old ) +HAL_ENABLE_INTERRUPTS() +HAL_QUERY_INTERRUPTS( state ) + + + +These macros provide control over the state of the CPUs interrupt mask +mechanism. They should normally manipulate a CPU status register to +enable and disable interrupt delivery. They should not access an +interrupt controller. + + + + +CYG_INTERRUPT_STATE is a data type that should be +used to store the interrupt state returned by +HAL_DISABLE_INTERRUPTS() and +HAL_QUERY_INTERRUPTS() and passed to +HAL_RESTORE_INTERRUPTS(). + + + +HAL_DISABLE_INTERRUPTS() disables the delivery of +interrupts and stores the original state of the interrupt mask in the +variable passed in the old argument. + + + +HAL_RESTORE_INTERRUPTS() restores the state of +the interrupt mask to that recorded in old. + + + +HAL_ENABLE_INTERRUPTS() simply enables interrupts +regardless of the current state of the mask. + + + +HAL_QUERY_INTERRUPTS() stores the state of the +interrupt mask in the variable passed in the +state argument. The state stored here should also be +capable of being passed to +HAL_RESTORE_INTERRUPTS() at a later point. + + + +It is at the HAL implementer’s discretion exactly +which interrupts are masked by this mechanism. Where a CPU has more +than one interrupt type that may be masked separately (e.g. the +ARM's IRQ and FIQ) only those that can raise DSRs need +to be masked here. A separate architecture specific mechanism may +then be used to control the other interrupt types. + + +
+ + + +
+ISR and VSR management + + +HAL_INTERRUPT_IN_USE( vector, state ) +HAL_INTERRUPT_ATTACH( vector, isr, data, object ) +HAL_INTERRUPT_DETACH( vector, isr ) +HAL_VSR_SET( vector, vsr, poldvsr ) +HAL_VSR_GET( vector, pvsr ) +HAL_VSR_SET_TO_ECOS_HANDLER( vector, poldvsr ) + + + +These macros manage the attachment of interrupt and vector service +routines to interrupt and exception vectors respectively. + + + +HAL_INTERRUPT_IN_USE() tests the state of the +supplied interrupt vector and sets the value of the state parameter to +either 1 or 0 depending on whether there is already an ISR attached to +the vector. The HAL will only allow one ISR to be attached to each +vector, so it is a good idea to use this function before using +HAL_INTERRUPT_ATTACH(). + + + +HAL_INTERRUPT_ATTACH() attaches +the ISR, data pointer and object pointer to the given +vector. When an interrupt occurs on this +vector the ISR is called using the C calling convention and the vector +number and data pointer are passed to it as the first and second +arguments respectively. + + + +HAL_INTERRUPT_DETACH() detaches the ISR from the +vector. + + + +HAL_VSR_SET() replaces the VSR attached to the +vector with the replacement supplied in +vsr. The old VSR is returned in the location +pointed to by pvsr. + + + +HAL_VSR_GET() assigns +a copy of the VSR to the location pointed to by pvsr. + + + +HAL_VSR_SET_TO_ECOS_HANDLER() ensures that the +VSR for a specific exception is pointing at the eCos exception VSR and +not one for RedBoot or some other ROM monitor. The default when +running under RedBoot is for exceptions to be handled by RedBoot and +passed to GDB. This macro diverts the exception to eCos so that it may +be handled by application code. The arguments are the VSR vector to be +replaces, and a location in which to store the old VSR pointer, so +that it may be replaced at a later point. + + +
+ + + +
+Interrupt controller management + + +HAL_INTERRUPT_MASK( vector ) +HAL_INTERRUPT_UNMASK( vector ) +HAL_INTERRUPT_ACKNOWLEDGE( vector ) +HAL_INTERRUPT_CONFIGURE( vector, level, up ) +HAL_INTERRUPT_SET_LEVEL( vector, level ) + + + +These macros exert control over any prioritized interrupt +controller that is present. If no priority controller exists, then +these macros should be empty. + + + + + These macros may not be reentrant, so care should be taken to + prevent them being called while interrupts are enabled. This means + that they can be safely used in initialization code before + interrupts are enabled, and in ISRs. In DSRs, ASRs and thread code, + however, interrupts must be disabled before these macros are + called. Here is an example for use in a DSR where the interrupt + source is unmasked after data processing: + + + ... + HAL_DISABLE_INTERRUPTS(old); + HAL_INTERRUPT_UNMASK(CYGNUM_HAL_INTERRUPT_ETH); + HAL_RESTORE_INTERRUPTS(old); + ... + + + + +HAL_INTERRUPT_MASK() causes the interrupt +associated with the given vector to be blocked. + + + +HAL_INTERRUPT_UNMASK() causes the interrupt +associated with the given vector to be unblocked. + + + +HAL_INTERRUPT_ACKNOWLEDGE() acknowledges the +current interrupt from the given vector. This is usually executed from +the ISR for this vector when it is prepared to allow further +interrupts. Most interrupt controllers need some form of acknowledge +action before the next interrupt is allowed through. Executing this +macro may cause another interrupt to be delivered. Whether this +interrupts the current code depends on the state of the CPU interrupt +mask. + + + +HAL_INTERRUPT_CONFIGURE() provides +control over how an interrupt signal is detected. The arguments +are: + + + + vector + + The interrupt vector to be configured. + + + + + level + + + Set to true if the interrupt is detected by + level, and false if it is edge triggered. + + + + + + up + + + If the interrupt is set to level detect, then if this is + true it is detected by a high signal level, + and if false by a low signal level. If the + interrupt is set to edge triggered, then if this is + true it is triggered by a rising edge and if + false by a falling edge. + + + + + + +HAL_INTERRUPT_SET_LEVEL() provides control over +the hardware priority of the interrupt. The arguments are: + + + + + vector + + The interrupt whose level is to be set. + + + + + level + + + The priority level to which the interrupt is to set. In some + architectures the masking of an interrupt is achieved by + changing its priority level. Hence this function, + HAL_INTERRUPT_MASK() and + HAL_INTERRUPT_UNMASK() may interfere with + each other. + + + + + +
+ + + +
+Clock control + + +HAL_CLOCK_INITIALIZE( period ) +HAL_CLOCK_RESET( vector, period ) +HAL_CLOCK_READ( pvalue ) + + + +These macros provide control over a clock or timer device that may be +used by the kernel to provide time-out, delay and scheduling +services. The clock is assumed to be implemented by some form of +counter that is incremented or decremented by some external source and +which raises an interrupt when it reaches a predetermined value. + + + +HAL_CLOCK_INITIALIZE() initializes the timer +device to interrupt at the given period. The period is essentially the +value used to initialize the timer counter and must be calculated from +the timer frequency and the desired interrupt rate. The timer device +should generate an interrupt every period cycles. + + + +HAL_CLOCK_RESET() re-initializes the timer to +provoke the next interrupt. This macro is only really necessary when +the timer device needs to be reset in some way after each interrupt. + + + +HAL_CLOCK_READ() reads the current value of the +timer counter and puts the value in the location pointed to by +pvalue. The value stored will always be the +number of timer cycles since the last interrupt, and hence ranges +between zero and the initial period value. If this is a count-down +cyclic timer, some arithmetic may be necessary to generate this value. + + +
+ + + +
+Microsecond Delay + + +HAL_DELAY_US(us) + + + +This is an optional definition. If defined the macro implements a busy +loop delay for the given number of microseconds. This is usually +implemented by waiting for the required number of hardware timer ticks +to pass. + + + +This operation should normally be used when a very short delay is +needed when controlling hardware, programming FLASH devices and similar +situations where a wait/timeout loop would otherwise be used. Since it +may disable interrupts, and is implemented by busy waiting, it should +not be used in code that is sensitive to interrupt or context switch +latencies. + + +
+ +
+ + + + +
+ + + +This section contains definitions for supporting access +to device control registers in an architecture neutral +fashion. + + + +These definitions are normally found in the header file +cyg/hal/hal_io.h. This file itself contains +macros that are generic to the architecture. If there are variant or +platform specific IO access macros then these will be found in +cyg/hal/var_io.h and +cyg/hal/plf_io.h in the variant or platform HALs +respectively. These files are include automatically by this header, so +need not be included explicitly. + + + +This header (or more likely cyg/hal/plf_io.h) also +defines the PCI access macros. For more information on these see . + + + + +
+Register address + + +HAL_IO_REGISTER + + + +This type is used to store the address of an I/O register. It will +normally be a memory address, an integer port address or an offset +into an I/O space. More complex architectures may need to code an +address space plus offset pair into a single word, or may represent it +as a structure. + + + +Values of variables and constants of this type will usually be +supplied by configuration mechanisms or in target specific headers. + + +
+ + + +
+Register read + + +HAL_READ_XXX( register, value ) +HAL_READ_XXX_VECTOR( register, buffer, count, stride ) + + + +These macros support the reading of I/O registers in various +sizes. The XXX component of the name may be +UINT8, UINT16, +UINT32. + + + +HAL_READ_XXX() reads the appropriately sized +value from the register and stores it in the variable passed as the +second argument. + + + +HAL_READ_XXX_VECTOR() reads +count values of the appropriate size into +buffer. The stride +controls how the pointer advances through the register space. A stride +of zero will read the same register repeatedly, and a stride of one +will read adjacent registers of the given size. Greater strides will +step by larger amounts, to allow for sparsely mapped registers for +example. +
+ + + +
+Register write + + +HAL_WRITE_XXX( register, value ) +HAL_WRITE_XXX_VECTOR( register, buffer,count, stride ) + + + +These macros support the writing of I/O registers in various +sizes. The XXX component of the name may be +UINT8, UINT16, +UINT32. + + + +HAL_WRITE_XXX() writes +the appropriately sized value from the variable passed as the second argument +stored it in the register. +HAL_WRITE_XXX_VECTOR() writes +count values of the appropriate size from +buffer. The stride controls +how the pointer advances through the register space. A stride of +zero will write the same register repeatedly, and a stride of one +will write adjacent registers of the given size. Greater strides +will step by larger amounts, to allow for sparsely mapped registers +for example. +
+
+ + + + +
+Cache Control + +This section contains definitions for supporting control +of the caches on the CPU. + + + +These definitions are usually found in the header file +cyg/hal/hal_cache.h. This file may be defined in +the architecture, variant or platform HAL, depending on where the +caches are implemented for the target. Often there will be a generic +implementation of the cache control macros in the architecture HAL +with the ability to override or undefine them in the variant or +platform HAL. Even when the implementation of the cache macros is in +the architecture HAL, the cache dimensions will be defined in the +variant or platform HAL. As with other files, the variant or platform +specific definitions are usually found in +cyg/hal/var_cache.h and +cyg/hal/plf_cache.h respectively. These files +are include automatically by this header, so need not be included +explicitly. + + + +There are versions of the macros defined here for both the Data and +Instruction caches. these are distinguished by the use of either +DCACHE or ICACHE in the macro +names. Some architectures have a unified cache, where both data and +instruction share the same cache. In these cases the control macros +use UCACHE and the DCACHE and +ICACHE macros will just be calls to the +UCACHE version. In the following descriptions, +XCACHE is used to stand for any of these. Where +there are issues specific to a particular cache, this will be +explained in the text. + + + +There might be target specific restrictions on the use of some of the +macros which it is the user's responsibility to comply with. Such +restrictions are documented in the header file with the macro +definition. + + + +Note that destructive cache macros should be used with caution. +Preceding a cache invalidation with a cache synchronization is not +safe in itself since an interrupt may happen after the synchronization +but before the invalidation. This might cause the state of dirty data +lines created during the interrupt to be lost. + + + +Depending on the architecture's capabilities, it may be possible to +temporarily disable the cache while doing the synchronization and +invalidation which solves the problem (no new data would be cached +during an interrupt). Otherwise it is necessary to disable interrupts +while manipulating the cache which may take a long time. + + + +Some platform HALs now support a pair of cache state query +macros: HAL_ICACHE_IS_ENABLED( x ) and +HAL_DCACHE_IS_ENABLED( x ) which set the argument +to true if the instruction or data cache is enabled, +respectively. Like most cache control macros, these are optional, +because the capabilities of different targets and boards can vary +considerably. Code which uses them, if it is to be considered +portable, should test for their existence first by means of +#ifdef. Be sure to include +<cyg/hal/hal_cache.h> in order to do this +test and (maybe) use the macros. + + + + +
+Cache Dimensions + + +HAL_XCACHE_SIZE +HAL_XCACHE_LINE_SIZE +HAL_XCACHE_WAYS +HAL_XCACHE_SETS + + +These macros define the size and dimensions of the Instruction +and Data caches. + + + + + HAL_XCACHE_SIZE + + Defines the total size of the cache in bytes. + + + + + HAL_XCACHE_LINE_SIZE + + Defines the cache line size in bytes. + + + + + HAL_XCACHE_WAYS + + + Defines the number of ways in each set and defines its level + of associativity. This would be 1 for a direct mapped + cache, 2 for a 2-way cache, 4 for 4-way and so on. + + + + + + HAL_XCACHE_SETS + + + Defines the number of sets in the cache, and is calculated from + the previous values. + + + + + +
+ + + +
+Global Cache Control + + +HAL_XCACHE_ENABLE() +HAL_XCACHE_DISABLE() +HAL_XCACHE_INVALIDATE_ALL() +HAL_XCACHE_SYNC() +HAL_XCACHE_BURST_SIZE( size ) +HAL_DCACHE_WRITE_MODE( mode ) +HAL_XCACHE_LOCK( base, size ) +HAL_XCACHE_UNLOCK( base, size ) +HAL_XCACHE_UNLOCK_ALL() + + + +These macros affect the state of the entire cache, or a large part of +it. + + + + + HAL_XCACHE_ENABLE() and HAL_XCACHE_DISABLE() + + Enable and disable the cache. + + + + + HAL_XCACHE_INVALIDATE_ALL() + + + Causes the entire contents of the cache to be invalidated. + Depending on the hardware, this may require the cache to be disabled + during the invalidation process. If so, the implementation must + use HAL_XCACHE_IS_ENABLED() to save and + restore the previous state. + + + + If this macro is called after + HAL_XCACHE_SYNC() with the intention of clearing + the cache (invalidating the cache after writing dirty data back to + memory), you must prevent interrupts from happening between the two + calls: + + + ... + HAL_DISABLE_INTERRUPTS(old); + HAL_XCACHE_SYNC(); + HAL_XCACHE_INVALIDATE_ALL(); + HAL_RESTORE_INTERRUPTS(old); + ... + + + Since the operation may take a very long time, real-time + responsiveness could be affected, so only do this when it is + absolutely required and you know the delay will not interfere + with the operation of drivers or the application. + + + + + + + HAL_XCACHE_SYNC() + + + Causes the contents of the cache to be brought into synchronization + with the contents of memory. In some implementations this may be + equivalent to HAL_XCACHE_INVALIDATE_ALL(). + + + + + + HAL_XCACHE_BURST_SIZE() + + + Allows the size of cache to/from memory bursts to + be controlled. This macro will only be defined if this functionality + is available. + + + + + + HAL_DCACHE_WRITE_MODE() + + + Controls the way in which data cache lines are written back to + memory. There will be definitions for the possible + modes. Typical definitions are + HAL_DCACHE_WRITEBACK_MODE and + HAL_DCACHE_WRITETHRU_MODE. This macro will + only be defined if this functionality is available. + + + + + + HAL_XCACHE_LOCK() + + + Causes data to be locked into the cache. The base and size + arguments define the memory region that will be locked into the + cache. It is architecture dependent whether more than one locked + region is allowed at any one time, and whether this operation + causes the cache to cease acting as a cache for addresses + outside the region during the duration of the lock. This macro + will only be defined if this functionality is available. + + + + + + HAL_XCACHE_UNLOCK() + + + Cancels the locking of the memory region given. This should + normally correspond to a region supplied in a matching lock + call. This macro will only be defined if this functionality is + available. + + + + + + HAL_XCACHE_UNLOCK_ALL() + + + Cancels all existing locked memory regions. This may be required + as part of the cache initialization on some architectures. This + macro will only be defined if this functionality is available. + + + + + +
+ + + +
+Cache Line Control + + +HAL_DCACHE_ALLOCATE( base , size ) +HAL_DCACHE_FLUSH( base , size ) +HAL_XCACHE_INVALIDATE( base , size ) +HAL_DCACHE_STORE( base , size ) +HAL_DCACHE_READ_HINT( base , size ) +HAL_DCACHE_WRITE_HINT( base , size ) +HAL_DCACHE_ZERO( base , size ) + + + +All of these macros apply a cache operation to all cache lines that +match the memory address region defined by the base and size +arguments. These macros will only be defined if the described +functionality is available. Also, it is not guaranteed that the cache +function will only be applied to just the described regions, in some +architectures it may be applied to the whole cache. + + + + + HAL_DCACHE_ALLOCATE() + + + Allocates lines in the cache for the given region without + reading their contents from memory, hence the contents of the lines + is undefined. This is useful for preallocating lines which are to + be completely overwritten, for example in a block copy + operation. + + + + + + HAL_DCACHE_FLUSH() + + + Invalidates all cache lines in the region after writing any + dirty lines to memory. + + + + + + HAL_XCACHE_INVALIDATE() + + + Invalidates all cache lines in the region. Any dirty lines + are invalidated without being written to memory. + + + + + + HAL_DCACHE_STORE() + + + Writes all dirty lines in the region to memory, but does not + invalidate any lines. + + + + + + HAL_DCACHE_READ_HINT() + + + Hints to the cache that the region is going to be read from + in the near future. This may cause the region to be speculatively + read into the cache. + + + + + + HAL_DCACHE_WRITE_HINT() + + + Hints to the cache that the region is going to be written + to in the near future. This may have the identical behavior to + HAL_DCACHE_READ_HINT(). + + + + + + HAL_DCACHE_ZERO() + + + Allocates and zeroes lines in the cache for the given + region without reading memory. This is useful if a large area of + memory is to be cleared. + + + + + +
+
+ + + + +
+<!-- <xref> -->Linker Scripts + + +When an eCos application is linked it must be done under the control +of a linker script. This script defines the memory areas, addresses +and sized, into which the code and data are to be put, and allocates +the various sections generated by the compiler to these. + + + +The linker script actually used is in +lib/target.ld in the install directory. This is +actually manufactured out of two other files: a base linker script and +an .ldi file that was generated by the memory +layout tool. + + + +The base linker script is usually supplied either by the architecture +HAL or the variant HAL. It consists of a set of linker script +fragments, in the form of C preprocessor macros, that define the major +output sections to be generated by the link operation. The +.ldi file, which is #include'ed +by the base linker script, uses these macro definitions to assign the +output sections to the required memory areas and link addresses. + + + +The .ldi file is supplied by the platform HAL, and +contains knowledge of the memory layout of the target platform. These +files generally conform to a standard naming convention, each file +being of the form: + + +pkgconf/mlt_<architecture>_<variant>_<platform>_<startup>.ldi + + +where <architecture>, +<variant> and +<platform> are the respective HAL package +names and <startup> is the startup type which +is usually one of ROM, RAM or +ROMRAM. + + + +In addition to the .ldi file, there is also a +congruously name .h file. This may be used by the +application to access information defined in the +.ldi file. Specifically it contains the memory +layout defined there, together with any additional section names +defined by the user. Examples of the latter are heap areas or PCI bus +memory access windows. + + + +The .ldi is manufactured by the Memory +Layout Tool (MLT). The MLT saves the memory +configuration into a file named + + +include/pkgconf/mlt_<architecture>_<variant>_<platform>_<startup>.mlt + + +in the platform HAL. This file is used by the +MLT to manufacture both the +.ldi and .h files. Users should +beware that direct edits the either of these files may be overwritten +if the MLT is run and regenerates them from the +.mlt file. + + + +The names of the .ldi and .h +files are defined by macro definitions in +pkgconf/system.h. These are +CYGHWR_MEMORY_LAYOUT_LDI and +CYGHWR_MEMORY_LAYOUT_H respectively. While there +will be little need for the application to refer to the +.ldi file directly, it may include the +.h file as follows: + + + +#include CYGHWR_MEMORY_LAYOUT_H + + +
+ + + + +
+Diagnostic Support + + +The HAL provides support for low level diagnostic IO. This is +particularly useful during early development as an aid to bringing up +a new platform. Usually this diagnostic channel is a UART or some +other serial IO device, but it may equally be a a memory +buffer, a simulator supported output channel, a ROM emulator virtual +UART, and LCD panel, a memory mapped video buffer or any other output +device. + + + +HAL_DIAG_INIT() performs any initialization +required on the device being used to generate diagnostic output. This +may include, for a UART, setting baud rate, and stop, parity and +character bits. For other devices it may include initializing a +controller or establishing contact with a remote device. + + + +HAL_DIAG_WRITE_CHAR(c) writes +the character supplied to the diagnostic output device. + + + +HAL_DIAG_READ_CHAR(c) reads a character from the +diagnostic device into the supplied variable. This is not supported +for all diagnostic devices. + + + +These macros are defined in the header file +cyg/hal/hal_diag.h. This file is usually supplied +by the variant or platform HAL, depending on where the IO device being +used is located. For example for on-chip UARTs it would be in the +variant HAL, but for a board-level LCD panel it would be in the +platform HAL. + + +
+ + + + +
+SMP Support + + +eCos contains support for limited Symmetric Multi-Processing +(SMP). This is only available on selected architectures and platforms. + + +
+Target Hardware Limitations + + +To allow a reasonable implementation of SMP, and to reduce the +disruption to the existing source base, a number of assumptions have +been made about the features of the target hardware. + + + + + +Modest multiprocessing. The typical number of CPUs supported is two +to four, with an upper limit around eight. While there are no +inherent limits in the code, hardware and algorithmic limitations +will probably become significant beyond this point. + + + + + +SMP synchronization support. The hardware must supply a mechanism to +allow software on two CPUs to synchronize. This is normally provided +as part of the instruction set in the form of test-and-set, +compare-and-swap or load-link/store-conditional instructions. An +alternative approach is the provision of hardware semaphore +registers which can be used to serialize implementations of these +operations. Whatever hardware facilities are available, they are +used in eCos to implement spinlocks. + + + + + +Coherent caches. It is assumed that no extra effort will be required +to access shared memory from any processor. This means that either +there are no caches, they are shared by all processors, or are +maintained in a coherent state by the hardware. It would be too +disruptive to the eCos sources if every memory access had to be +bracketed by cache load/flush operations. Any hardware that requires +this is not supported. + + + + + +Uniform addressing. It is assumed that all memory that is +shared between CPUs is addressed at the same location from all +CPUs. Like non-coherent caches, dealing with CPU-specific address +translation is considered too disruptive to the eCos source +base. This does not, however, preclude systems with non-uniform +access costs for different CPUs. + + + + + +Uniform device addressing. As with access to memory, it is assumed +that all devices are equally accessible to all CPUs. Since device +access is often made from thread contexts, it is not possible to +restrict access to device control registers to certain CPUs, since +there is currently no support for binding or migrating threads to CPUs. + + + + + +Interrupt routing. The target hardware must have an interrupt +controller that can route interrupts to specific CPUs. It is +acceptable for all interrupts to be delivered to just one CPU, or +for some interrupts to be bound to specific CPUs, or for some +interrupts to be local to each CPU. At present dynamic routing, +where a different CPU may be chosen each time an interrupt is +delivered, is not supported. ECos cannot support hardware where all +interrupts are delivered to all CPUs simultaneously with the +expectation that software will resolve any conflicts. + + + + + +Inter-CPU interrupts. A mechanism to allow one CPU to interrupt +another is needed. This is necessary so that events on one CPU can +cause rescheduling on other CPUs. + + + + + +CPU Identifiers. Code running on a CPU must be able to determine +which CPU it is running on. The CPU Id is usually provided either in +a CPU status register, or in a register associated with the +inter-CPU interrupt delivery subsystem. ECos expects CPU Ids to be +small positive integers, although alternative representations, such +as bitmaps, can be converted relatively easily. Complex mechanisms +for getting the CPU Id cannot be supported. Getting the CPU Id must +be a cheap operation, since it is done often, and in performance +critical places such as interrupt handlers and the scheduler. + + + + +
+ +
+HAL Support + + +SMP support in any platform depends on the HAL supplying the +appropriate operations. All HAL SMP support is defined in the +cyg/hal/hal_smp.h header. Variant and platform +specific definitions will be in cyg/hal/var_smp.h +and cyg/hal/plf_smp.h respectively. These files +are include automatically by this header, so need not be included +explicitly. + + + +SMP support falls into a number of functional groups. + + +
+CPU Control + + +This group consists of descriptive and control macros for managing the +CPUs in an SMP system. + + + + +HAL_SMP_CPU_TYPE + + +A type that can contain a CPU id. A CPU id is +usually a small integer that is used to index +arrays of variables that are managed on an +per-CPU basis. + + + + + +HAL_SMP_CPU_MAX + + +The maximum number of CPUs that can be +supported. This is used to provide the size of +any arrays that have an element per CPU. + + + + + +HAL_SMP_CPU_COUNT() + + +Returns the number of CPUs currently +operational. This may differ from +HAL_SMP_CPU_MAX depending on the runtime +environment. + + + + + +HAL_SMP_CPU_THIS() + + +Returns the CPU id of the current CPU. + + + + + +HAL_SMP_CPU_NONE + + +A value that does not match any real CPU +id. This is uses where a CPU type variable +must be set to a null value. + + + + + +HAL_SMP_CPU_START( cpu ) + + +Starts the given CPU executing at a defined +HAL entry point. After performing any HAL +level initialization, the CPU calls up into +the kernel at cyg_kernel_cpu_startup(). + + + + + +HAL_SMP_CPU_RESCHEDULE_INTERRUPT( cpu, wait ) + + +Sends the CPU a reschedule interrupt, and if +wait is non-zero, waits for an +acknowledgment. The interrupted CPU should call +cyg_scheduler_set_need_reschedule() in its DSR to +cause the reschedule to occur. + + + + + +HAL_SMP_CPU_TIMESLICE_INTERRUPT( cpu, wait ) + + +Sends the CPU a timeslice interrupt, and if +wait is non-zero, waits for an +acknowledgment. The interrupted CPU should call +cyg_scheduler_timeslice_cpu() to cause the +timeslice event to be processed. + + + + +
+ + +
+Test-and-set Support + + +Test-and-set is the foundation of the SMP synchronization +mechanisms. + + + + +HAL_TAS_TYPE + + +The type for all test-and-set variables. The +test-and-set macros only support operations on +a single bit (usually the least significant +bit) of this location. This allows for maximum +flexibility in the implementation. + + + + + +HAL_TAS_SET( tas, oldb ) + + +Performs a test and set operation on the +location tas. oldb will contain true if +the location was already set, and false if +it was clear. + + + + + +HAL_TAS_CLEAR( tas, oldb ) + + +Performs a test and clear operation on the +location tas. oldb will contain true if +the location was already set, and false if +it was clear. + + + + +
+
+ +Spinlocks + + +Spinlocks provide inter-CPU locking. Normally they will be implemented +on top of the test-and-set mechanism above, but may also be +implemented by other means if, for example, the hardware has more +direct support for spinlocks. + + + + +HAL_SPINLOCK_TYPE + + +The type for all spinlock variables. + + + + + +HAL_SPINLOCK_INIT_CLEAR + + +A value that may be assigned to a spinlock +variable to initialize it to clear. + + + + + +HAL_SPINLOCK_INIT_SET + + +A value that may be assigned to a spinlock +variable to initialize it to set. + + + + + +HAL_SPINLOCK_SPIN( lock ) + + +The caller spins in a busy loop waiting for +the lock to become clear. It then sets it and +continues. This is all handled atomically, so +that there are no race conditions between CPUs. + + + + + +HAL_SPINLOCK_CLEAR( lock ) + + +The caller clears the lock. One of any waiting +spinners will then be able to proceed. + + + + + +HAL_SPINLOCK_TRY( lock, val ) + + +Attempts to set the lock. The value put in +val will be true if the lock was +claimed successfully, and false if it was +not. + + + + + +HAL_SPINLOCK_TEST( lock, val ) + + +Tests the current value of the lock. The value +put in val will be true if the lock is +claimed and false of it is clear. + + + + +
+
+ +Scheduler Lock + + +The scheduler lock is the main protection for all kernel data +structures. By default the kernel implements the scheduler lock itself +using a spinlock. However, if spinlocks cannot be supported by the +hardware, or there is a more efficient implementation available, the +HAL may provide macros to implement the scheduler lock. + + + + +HAL_SMP_SCHEDLOCK_DATA_TYPE + + +A data type, possibly a structure, that +contains any data items needed by the +scheduler lock implementation. A variable of +this type will be instantiated as a static +member of the Cyg_Scheduler_SchedLock class +and passed to all the following macros. + + + + + +HAL_SMP_SCHEDLOCK_INIT( lock, data ) + + +Initialize the scheduler lock. The lock +argument is the scheduler lock counter and the +data argument is a variable of +HAL_SMP_SCHEDLOCK_DATA_TYPE type. + + + + + +HAL_SMP_SCHEDLOCK_INC( lock, data ) + + +Increment the scheduler lock. The first +increment of the lock from zero to one for any +CPU may cause it to wait until the lock is +zeroed by another CPU. Subsequent increments +should be less expensive since this CPU +already holds the lock. + + + + + +HAL_SMP_SCHEDLOCK_ZERO( lock, data ) + + +Zero the scheduler lock. This operation will +also clear the lock so that other CPUs may +claim it. + + + + + +HAL_SMP_SCHEDLOCK_SET( lock, data, new ) + + +Set the lock to a different value, in +new. This is only called when the lock is +already known to be owned by the current CPU. It is never called to +zero the lock, or to increment it from zero. + + + + + +
+
+ +Interrupt Routing + + +The routing of interrupts to different CPUs is supported by two new +interfaces in hal_intr.h. + + + +Once an interrupt has been routed to a new CPU, the existing vector +masking and configuration operations should take account of the CPU +routing. For example, if the operation is not invoked on the +destination CPU itself, then the HAL may need to arrange to transfer +the operation to the destination CPU for correct application. + + + + +HAL_INTERRUPT_SET_CPU( vector, cpu ) + + +Route the interrupt for the given vector to +the given cpu. + + + + + +HAL_INTERRUPT_GET_CPU( vector, cpu ) + + +Set cpu to the id of the CPU to which this +vector is routed. + + + + + +
+ +
+ + +
+ + + +
+ + + + + +Exception Handling + + + + +Most of the HAL consists of simple macros or functions that are +called via the interfaces described in the previous section. These +just perform whatever operation is required by accessing the hardware +and then return. The exception to this is the handling of exceptions: +either synchronous hardware traps or asynchronous device +interrupts. Here control is passed first to the HAL, which then passed +it on to eCos or the application. After eCos has finished with it, +control is then passed back to the HAL for it to tidy up the CPU state +and resume processing from the point at which the exception occurred. + + + +The HAL exceptions handling code is usually found in the file +vectors.S in the architecture HAL. Since the +reset entry point is usually implemented as one of these it also deals +with system startup. + + + +The exact implementation of this code is under the control of the HAL +implementer. So long as it interacts correctly with the interfaces +defined previously it may take any form. However, all current +implementation follow the same pattern, and there should be a very +good reason to break with this. The rest of this section describes +these operate. + + + +Exception handling normally deals with the following broad areas of +functionality: + + + + + Startup and initialization. + + + + Hardware exception delivery. + + + + Default handling of synchronous exceptions. + + + + Default handling of asynchronous interrupts. + + + + + + +
+<!-- <index></index> --><!-- <xref> -->HAL Startup + + +Execution normally begins at the reset vector with +the machine in a minimal startup state. From here the HAL needs to get +the machine running, set up the execution environment for the +application, and finally invoke its entry point. + + + +The following is a list of the jobs that need to be done in +approximately the order in which they should be accomplished. Many +of these will not be needed in some configurations. + + + + + + Initialize the hardware. This may involve initializing several + subsystems in both the architecture, variant and platform + HALs. These include: + + + + + Initialize various CPU status registers. Most importantly, the CPU + interrupt mask should be set to disable interrupts. + + + + + + Initialize the MMU, if it is used. On many platforms it is + only possible to control the cacheability of address ranges + via the MMU. Also, it may be necessary to remap RAM and device + registers to locations other than their defaults. However, for + simplicity, the mapping should be kept as close to one-to-one + physical-to-virtual as possible. + + + + + + Set up the memory controller to access RAM, ROM and I/O devices + correctly. Until this is done it may not be possible to access + RAM. If this is a ROMRAM startup then the program code can + now be copied to its RAM address and control transferred to it. + + + + + + Set up any bus bridges and support chips. Often access to + device registers needs to go through various bus bridges and + other intermediary devices. In many systems these are combined + with the memory controller, so it makes sense to set these up + together. This is particularly important if early diagnostic + output needs to go through one of these devices. + + + + + + Set up diagnostic mechanisms. If the platform includes an LED or + LCD output device, it often makes sense to output progress + indications on this during startup. This helps with diagnosing + hardware and software errors. + + + + + + Initialize floating point and other extensions such as SIMD + and multimedia engines. It is usually necessary to enable + these and maybe initialize control and exception registers for + these extensions. + + + + + + + Initialize interrupt controller. At the very least, it should + be configured to mask all interrupts. It may also be necessary + to set up the mapping from the interrupt controller's vector + number space to the CPU's exception number space. Similar + mappings may need to be set up between primary and secondary + interrupt controllers. + + + + + + Disable and initialize the caches. The caches should not + normally be enabled at this point, but it may be necessary to + clear or initialize them so that they can be enabled + later. Some architectures require that the caches be + explicitly reinitialized after a power-on reset. + + + + + + + Initialize the timer, clock etc. While the timer used for RTC + interrupts will be initialized later, it may be necessary to + set up the clocks that drive it here. + + + + + + The exact order in which these initializations is done is + architecture or variant specific. It is also often not necessary + to do anything at all for some of these options. These fragments + of code should concentrate on getting the target up and running so + that C function calls can be made and code can be run. More + complex initializations that cannot be done in assembly code may + be postponed until calls to + hal_variant_init() or + hal_platform_init() are made. + + + + Not all of these initializations need to be done for all startup + types. In particular, RAM startups can reasonably assume that the + ROM monitor or loader has already done most of this work. + + + + + + + Set up the stack pointer, this allows subsequent initialization + code to make proper procedure calls. Usually the interrupt stack + is used for this purpose since it is available, large enough, and + will be reused for other purposes later. + + + + + + Initialize any global pointer register needed for access to + globally defined variables. This allows subsequent initialization + code to access global variables. + + + + + + If the system is starting from ROM, copy the ROM template of the + .data section out to its correct position in + RAM. (). + + + + + + Zero the .bss section. + + + + + + Create a suitable C call stack frame. This may involve making + stack space for call frames, and arguments, and initializing the + back pointers to halt a GDB backtrace operation. + + + + + + Call hal_variant_init() and + hal_platform_init(). These will perform any + additional initialization needed by the variant and platform. This + typically includes further initialization of the interrupt + controller, PCI bus bridges, basic IO devices and enabling the + caches. + + + + + + Call cyg_hal_invoke_constructors() to run any + static constructors. + + + + + + Call cyg_start(). If + cyg_start() returns, drop into an infinite + loop. + + + + +
+ + + + +
+Vectors and VSRs + + +The CPU delivers all exceptions, whether +synchronous faults or asynchronous interrupts, to a set of hardware +defined vectors. Depending on the architecture, these may be +implemented in a number of different ways. Examples of existing +mechanisms are: + + + + + PowerPC + + + Exceptions are vectored to locations 256 bytes apart starting at + either zero or 0xFFF00000. There are 16 such + vectors defined by the basic architecture and extra vectors may + be defined by specific variants. One of the base vectors is for + all external interrupts, and another is for the architecture + defined timer. + + + + + + MIPS + + + Most exceptions and all interrupts are vectored to a single + address at either 0x80000000 or + 0xBFC00180. Software is responsible for + reading the exception code from the CPU cause + register to discover its true source. Some TLB and debug + exceptions are delivered to different vector addresses, but + these are not used currently by eCos. One of the exception codes + in the cause register indicates an external + interrupt. Additional bits in the cause + register provide a first-level decode for the interrupt source, + one of which represents an architecture defined timer. + + + + + + IA32 + + + Exceptions are delivered via an Interrupt Descriptor Table (IDT) + which is essentially an indirection table indexed by exception + number. The IDT may be placed anywhere in memory. In PC hardware + the standard interrupt controller can be programmed to deliver + the external interrupts to a block of 16 vectors at any offset + in the IDT. There is no hardware supplied mechanism for + determining the vector taken, other than from the address jumped + to. + + + + + + ARM + + + All exceptions, including the FIQ and IRQ interrupts, are + vectored to locations four bytes apart starting at zero. There + is only room for one instruction here, which must immediately + jump out to handling code higher in memory. Interrupt sources + have to be decoded entirely from the interrupt controller. + + + + + + + +With such a wide variety of hardware approaches, it is not possible to +provide a generic mechanism for the substitution of exception vectors +directly. Therefore, eCos translates all of these mechanisms in to a +common approach that can be used by portable code on all platforms. + + + +The mechanism implemented is to attach to each hardware vector a short +piece of trampoline code that makes an indirect jump via a table to +the actual handler for the exception. This handler is called the +Vector Service Routine (VSR) and the table is called the VSR table. + + + +The trampoline code performs the absolute minimum processing necessary +to identify the exception source, and jump to the VSR. The VSR is then +responsible for saving the CPU state and taking the necessary actions +to handle the exception or interrupt. The entry conditions for the VSR +are as close to the raw hardware exception entry state as possible - +although on some platforms the trampoline will have had to move or +reorganize some registers to do its job. + + + +To make this more concrete, consider how the trampoline code operates +in each of the architectures described above: + + + + + + PowerPC + + + A separate trampoline is contained in each of the vector + locations. This code saves a few work registers away to the + special purposes registers available, loads the exception number + into a register and then uses that to index the VSR table and + jump to the VSR. The VSR is entered with some registers move to + the SPRs, and one of the data register containing the number of + the vector taken. + + + + + + MIPS + + + A single trampoline routine attached to the common vector reads + the exception code out of the cause register + and uses that value to index the VSR table and jump to the VSR. + The trampoline uses the two registers defined in the ABI for + kernel use to do this, one of these will contain the exception + vector number for the VSR. + + + + + + IA32 + + + There is a separate 3 or 4 instruction trampoline pointed to by + each active IDT table entry. The trampoline for exceptions that + also have an error code pop it from the stack and put it into a + memory location. Trampolines for non-error-code exceptions just + zero the memory location. Then all trampolines push an + interrupt/exception number onto the stack, and take an indirect + jump through a precalculated offset in the VSR table. This is + all done without saving any registers, using memory-only + operations. The VSR is entered with the vector number pushed + onto the stack on top of the standard hardware saved state. + + + + + + ARM + + + The trampoline consists solely of the single instruction at the + exception entry point. This is an indirect jump via a location + 32 bytes higher in memory. These locations, from + 0x20 up, form the VSR table. Since each VSR + is entered in a different CPU mode + (SVC,UNDEF,ABORT,IRQ or FIQ) there has to be a + different VSR for each exception that knows how to save the CPU + state correctly. + + + + + +
+ + + + +
+<!-- <index></index> -->Default Synchronous Exception Handling + + +Most synchronous exception VSR table entries will point to a default +exception VSR which is responsible for handling all exceptions in a +generic manner. The default VSR simply saves the CPU state, makes any +adjustments to the CPU state that is necessary, and calls +cyg_hal_exception_handler(). + + + +cyg_hal_exception_handler() needs to pass the +exception on to some handling code. There are two basic destinations: +enter GDB or pass the exception up to eCos. Exactly which +destination is taken depends on the configuration. When the GDB stubs are +included then the exception is passed to them, otherwise it is passed +to eCos. + + + +If an eCos application has been loaded by RedBoot then the VSR table +entries will all point into RedBoot's exception VSR, and will +therefore enter GDB if an exception occurs. If the eCos application +wants to handle an exception itself, it needs to replace the the VSR +table entry with one pointing to its own VSR. It can do this with the +HAL_VSR_SET_TO_ECOS_HANDLER() macro. + + +
+ + + + +
+<!-- <index></index> -->Default Interrupt Handling + + +Most asynchronous external interrupt vectors will point to a default +interrupt VSR which decodes the actual interrupt being delivered from +the interrupt controller and invokes the appropriate ISR. + + + +The default interrupt VSR has a number of responsibilities if it is +going to interact with the Kernel cleanly and allow interrupts to +cause thread preemption. + + + +To support this VSR an ISR vector table is needed. For each valid +vector three pointers need to be stored: the ISR, its data pointer and +an opaque (to the HAL) interrupt object pointer needed by the +kernel. It is implementation defined whether these are stored in a +single table of triples, or in three separate tables. + + + +The VSR follows the following approximate plan: + + + + + + Save the CPU state. In non-debug configurations, it may be + possible to get away with saving less than the entire machine + state. The option + CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + is supported in some targets to do this. + + + + + + Increment the kernel scheduler lock. This is a static member of + the Cyg_Scheduler class, however it has also been aliased to + cyg_scheduler_sched_lock so that it can be + accessed from assembly code. + + + + + + (Optional) Switch to an interrupt stack if not already running on + it. This allows nested interrupts to be delivered without needing + every thread to have a stack large enough to take the maximum + possible nesting. It is implementation defined how to detect + whether this is a nested interrupt but there are two basic + techniques. The first is to inspect the stack pointer and switch + only if it is not currently within the interrupt stack range; the + second is to maintain a counter of the interrupt nesting level and + switch only if it is zero. The option + CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + controls whether this happens. + + + + + + Decode the actual external interrupt being delivered from + the interrupt controller. This will yield the ISR vector + number. The code to do this usually needs to come from the + variant or platform HAL, so is usually present in the form of a + macro or procedure callout. + + + + + + (Optional) Re-enable interrupts to permit nesting. At this point + we can potentially allow higher priority interrupts to occur. It + depends on the interrupt architecture of the CPU and platform + whether more interrupts will occur at this point, or whether they + will only be delivered after the current interrupt has been + acknowledged (by a call to + HAL_INTERRUPT_ACKNOWLEDGE() in the ISR). + + + + + + Using the ISR vector number as an index, retrieve the + ISR pointer and its data pointer from the ISR vector table. + + + + + + Construct a C call stack frame. This may involve making stack + space for call frames, and arguments, and initializing the back + pointers to halt a GDB backtrace operation. + + + + + + Call the ISR, passing the vector number and data pointer. The + vector number and a pointer to the saved state should be preserved + across this call, preferably by storing them in registers that are + defined to be callee-saved by the calling conventions. + + + + + + If this is an un-nested interrupt and a separate interrupt + stack is being used, switch back to the interrupted thread's + own stack. + + + + + + Use the saved ISR vector number to get the interrupt object + pointer from the ISR vector table. + + + + + + Call interrupt_end() passing it the return + value from the ISR, the interrupt object pointer and a pointer to + the saved CPU state. This function is implemented by the Kernel + and is responsible for finishing off the interrupt + handling. Specifically, it may post a DSR depending on the ISR + return value, and will decrement the scheduler lock. If the lock + is zeroed by this operation then any posted DSRs may be called and + may in turn result in a thread context switch. + + + + + + The return from interrupt_end() may occur + some time after the call. Many other threads may have executed in + the meantime. So here all we may do is restore the machine state + and resume execution of the interrupted thread. Depending on the + architecture, it may be necessary to disable interrupts again for + part of this. + + + + + + +The detailed order of these steps may vary slightly depending on the +architecture, in particular where interrupts are enabled and disabled. + + +
+ + + +
+ + + + +&hal-common-current-doc-porting-sgml; + + + + + +<!-- <index></index> --><!-- <xref> -->Future developments + + +The HAL is not complete, and will evolve and increase over +time. Among the intended developments are: + + + +Common macros for interpreting the contents of a saved +machine context. These would allow portable code, such as debug +stubs, to extract such values as the program counter and stack pointer +from a state without having to interpret a HAL_SavedRegisters structure +directly. + + +Debugging support. Macros to set and clear hardware and +software breakpoints. Access to other areas of machine state may +also be supported. + + +Static initialization support. The current HAL provides a +dynamic interface to things like thread context initialization and ISR +attachment. We also need to be able to define the system entirely +statically so that it is ready to go on restart, without needing to +run code. This will require extra macros to define these +initializations. Such support may have a consequential effect on the +current HAL specification. + + +CPU state control. Many CPUs have both kernel and user +states. Although it is not intended to run any code in user state +for the foreseeable future, it is possible that this may happen +eventually. If this is the case, then some minor changes may be needed +to the current HAL API to accommodate this. These should mostly +be extensions, but minor changes in semantics may also be required. + + +Physical memory management. Many embedded systems have +multiple memory areas with varying properties such as base address, +size, speed, bus width, cacheability and persistence. An API is +needed to support the discovery of this information about the machine's +physical memory map. + + +Memory management control. Some embedded processors have +a memory management unit. In some cases this must be enabled to +allow the cache to be controlled, particularly if different regions +of memory must have different caching properties. For some purposes, +in some systems, it will be useful to manipulate the MMU settings +dynamically. + + +Power management. Macros to access and control any power +management mechanisms available on the CPU implementation. These +would provide a substrate for a more general power management system +that also involved device drivers and other hardware components. + + +Generic serial line macros. Most serial line devices operate +in the same way, the only real differences being exactly which bits +in which registers perform the standard functions. It should be +possible to develop a set of HAL macros that provide basic serial +line services such as baud rate setting, enabling interrupts, polling +for transmit or receive ready, transmitting and receiving data etc. +Given these it should be possible to create a generic serial line +device driver that will allow rapid bootstrapping on any new platform. +It may be possible to extend this mechanism to other device types. + + + + + + + diff --git a/packages/hal/common/current/doc/porting.sgml b/packages/hal/common/current/doc/porting.sgml new file mode 100644 --- /dev/null +++ b/packages/hal/common/current/doc/porting.sgml @@ -0,0 +1,4357 @@ + + +<!-- <index></index> --> Porting Guide + + + +
+Introduction + + +eCos has been designed to be fairly easy to port to new targets. A +target is a specific platform (board) using a given architecture (CPU +type). The porting is facilitated by the hierarchical layering of the +eCos sources - all architecture and platform specific code is +implemented in a HAL (hardware abstraction layer). + + + +By porting the eCos HAL to a new target the core functionality of eCos +(infra, kernel, uITRON, etc) will be able to run on the target. It may +be necessary to add further platform specific code such as serial +drivers, display drivers, ethernet drivers, etc. to get a fully +capable system. + + + +This document is intended as a help to the HAL porting process. Due to +the nature of a porting job, it is impossible to give a complete +description of what has to be done for each and every potential +target. This should not be considered a clear-cut recipe - you will +probably need to make some implementation decisions, tweak a few +things, and just plain have to rely on common sense. + + + +However, what is covered here should be a large part of the +process. If you get stuck, you are advised to read the + +ecos-discuss archive + +where you may find discussions which apply to the problem at +hand. You are also invited to ask questions on the + +ecos-discuss mailing list + +to help you resolve problems - but as is always the case +with community lists, do not consider it an oracle for any and all +questions. Use common sense - if you ask too many questions which +could have been answered by reading the +documentation, +FAQ or + +source code +, you are likely to be ignored. + + + +This document will be continually improved by Red Hat engineers as +time allows. Feedback and help with improving the document is sought, +so if you have any comments at all, please do not hesitate to post +them on + +ecos-discuss + +(please prefix the subject with [porting]). + + + +At the moment this document is mostly an outline. There are many +details to fill in before it becomes complete. Many places you'll just +find a list of keywords / concepts that should be described (please +post on ecos-discuss if there are areas you think are not covered). + + + +All pages or sections where the caption ends in [TBD] contain little +more than key words and/or random thoughts - there has been no work +done as such on the content. The word FIXME may appear in the text to +highlight places where information is missing. + + +
+ + + + +
+HAL Structure + + +In order to write an eCos HAL it's a good idea to have at least a +passing understanding of how the HAL interacts with the rest of the +system. + + + + +
+HAL Classes + + +The eCos HAL consists of four HAL sub-classes. This table gives a +brief description of each class and partly reiterates the description +in . The links +refer to the on-line CVS tree (specifically to the sub-HALs used by +the PowerPC MBX target). + + + + + + +HAL type +Description +Functionality Overview + + + + + +Common HAL (hal/common) + +Configuration options and functionality shared by all HALs. +Generic debugging functionality, driver API, eCos/ROM monitor + calling interface, and tests. + + + Architecture HAL (hal/<architecture>/arch) + Functionality specific to the given architecture. Also default + implementations of some functionality which can be overridden by + variant or platform HALs. + Architecture specific debugger functionality (handles single + stepping, exception-to-signal conversion, etc.), + exception/interrupt vector definitions and handlers, cache + definition and control macros, context switching code, assembler + functions for early system initialization, configuration options, + and possibly tests. + + + Variant HAL (hal/<architecture>/<variant>) + Some CPU architectures consist of a number variants, for example + MIPS CPUs come in both 32 and 64 bit versions, and some variants + have embedded features additional to the CPU core. + + Variant extensions to the architecture code (cache, + exception/interrupt), configuration options, possibly drivers for + variant on-core devices, and possibly tests. + + + Platform HAL (hal/<architecture>/<platform>) + Contains functionality and configuration options specific to the + platform. + + Early platform initialization code, platform memory layout + specification, configuration options (processor speed, compiler + options), diagnostic IO functions, debugger IO functions, + platform specific extensions to architecture or variant code + (off-core interrupt controller), and possibly tests. + + + Auxiliary HAL (hal/<architecture>/<module>) + Some variants share common modules on the core. Motorola's PowerPC + QUICC is an example of such a module. + + Module specific functionality (interrupt controller, simple + device drivers), possibly tests. + + + + + + +
+ + + + +
+File Descriptions + + +Listed below are the files found in various HALs, with a short +description of what each file contains. When looking in existing HALs +beware that they do not necessarily follow this naming scheme. +If you are writing a new HAL, please try to follow it as +closely as possible. Still, no two targets are the same, so sometimes +it makes sense to use additional files. + + + + +
+Common HAL + + + + + +File +Description + + + + + +include/dbg-thread-syscall.h + Defines the thread debugging syscall function. This is used by + the ROM monitor to access the thread debugging API in the RAM + application. . + + +include/dbg-threads-api.h + Defines the thread debugging API. . + + +include/drv_api.h + Defines the driver API. + + +include/generic-stub.h + Defines the generic stub features. + + +include/hal_if.h + Defines the ROM/RAM calling interface API. + + +include/hal_misc.h + Defines miscellaneous helper functions shared by all HALs. + + +include/hal_stub.h + Defines eCos mappings of GDB stub features. + + +src/dbg-threads-syscall.c + Thread debugging implementation. + + +src/drv_api.c + Driver API implementation. Depending on configuration this + provides either wrappers for the kernel API, or a minimal + implementation of these features. This allows drivers to be written + relying only on HAL features. + + +src/dummy.c + Empty dummy file ensuring creation of libtarget.a. + + +src/generic-stub.c + Generic GDB stub implementation. This provides the + communication protocol used to communicate with GDB over a serial + device or via the network. + + +src/hal_if.c + ROM/RAM calling interface implementation. Provides wrappers from + the calling interface API to the eCos features used for the + implementation. + + +src/hal_misc.c + Various helper functions shared by all platforms and + architectures. + + +src/hal_stub.c + Wrappers from eCos HAL features to the features required by the + generic GDB stub. + + +src/stubrom/stubrom.c + The file used to build eCos GDB stub images. Basically a + cyg_start function with a hard coded breakpoint. + + +src/thread-packets.c + More thread debugging related functions. + + +src/thread-pkts.h + Defines more thread debugging related function. + + + + + +
+ + + + +
+Architecture HAL + +Some architecture HALs may add extra files for architecture +specific serial drivers, or for handling interrupts and exceptions if it +makes sense. + +Note that many of the definitions in these files are only +conditionally defined - if the equivalent variant or platform headers +provide the definitions, those override the generic architecture +definitions. + + + + + +File +Description + + + + + +include/arch.inc + Various assembly macros used during system initialization. + + +include/basetype.h + Endian, label, alignment, and type size definitions. These + override common defaults in CYGPKG_INFRA. + + +include/hal_arch.h + Saved register frame format, various thread, register and stack + related macros. + + +include/hal_cache.h + Cache definitions and cache control macros. + + +include/hal_intr.h + Exception and interrupt definitions. Macros for configuring and + controlling interrupts. eCos real-time clock control macros. + + +include/hal_io.h + Macros for accessing IO devices. + + +include/<arch>_regs.h + Architecture register definitions. + + +include/<arch>_stub.h + Architecture stub definitions. In particular the register frame + layout used by GDB. This may differ from the one used by eCos. + + +include/<arch>.inc + Architecture convenience assembly macros. + + +src/<arch>.ld + Linker macros. + + +src/context.S + Functions handling context switching and setjmp/longjmp. + + +src/hal_misc.c + Exception and interrupt handlers in C. Various other utility + functions. + + +src/hal_mk_defs.c + Used to export definitions from C header files to assembler + header files. + + +src/hal_intr.c + Any necessary interrupt handling functions. + + +src/<arch>stub.c + Architecture stub code. Contains functions for translating eCos + exceptions to UNIX signals and functions for single-stepping. + + +src/vectors.S + Exception, interrupt and early initialization code. + + + + + + +
+ + + + +
+Variant HAL + +Some variant HALs may add extra files for variant specific serial +drivers, or for handling interrupts/exceptions if it makes sense. + +Note that these files may be mostly empty if the CPU variant can be +controlled by the generic architecture macros. The definitions present +are only conditionally defined - if the equivalent platform headers +provide the definitions, those override the variant definitions. + + + + + +File +Description + + + + + +include/var_arch.h + Saved register frame format, various thread, register and stack + related macros. + + +include/var_cache.h + Cache related macros. + + +include/var_intr.h + Interrupt related macros. + + +include/var_regs.h + Extra register definitions for the CPU variant. + + +include/variant.inc + Various assembly macros used during system initialization. + + +src/var_intr.c + Interrupt functions if necessary. + + +src/var_misc.c + hal_variant_init function and any necessary extra functions. + + +src/variant.S + Interrupt handler table definition. + + +src/<arch>_<variant>.ld + Linker macros. + + + + + +
+ + + + +
+Platform HAL + +Extras files may be added for platform specific serial +drivers. Extra files for handling interrupts and exceptions will be +present if it makes sense. + + + + + +File +Description + + + + + +include/hal_diag.h + Defines functions used for HAL diagnostics output. This would + normally be the ROM calling interface wrappers, but may also be the + low-level IO functions themselves, saving a little overhead. + + +include/platform.inc + + Platform initialization code. This includes memory controller, + vectors, and monitor initialization. Depending on the architecture, + other things may need defining here as well: interrupt decoding, + status register initialization value, etc. + + + +include/plf_cache.h + Platform specific cache handling. + + +include/plf_intr.h + Platform specific interrupt handling. + + +include/plf_io.h + PCI IO definitions and macros. May also be used to override + generic HAL IO macros if the platform endianness differs from that of + the CPU. + + +include/plf_stub.h + Defines stub initializer and board reset details. + + +src/hal_diag.c + May contain the low-level device drivers. But these may also + reside in plf_stub.c + + +src/platform.S + Memory controller setup macro, and if necessary interrupt + springboard code. + + +src/plf_misc.c + Platform initialization code. + + +src/plf_mk_defs.c + Used to export definitions from C header files to assembler + header files. + + +src/plf_stub.c + Platform specific stub initialization and possibly the low-level + device driver. + + + + + +The platform HAL also contains files specifying the platform's +memory layout. These files are located in +include/pkgconf. + +
+ + + + +
+Auxiliary HAL + +Auxiliary HALs contain whatever files are necessary to provide the +required functionality. There are no predefined set of files required +in an auxiliary HAL. + +
+ + + +
+ + + +
+ + + + +
+Virtual Vectors (eCos/ROM Monitor Calling Interface) + + +Some eCos platforms have supported full debugging capabilities via +CygMon since day one. Platforms of the architectures PowerPC, ARM, and +SH do not provide those features unless a GDB stub is included in the +application. + + + +This is going to change. All platforms will (eventually) support +all the debugging features by relying on a ROM/RAM calling interface +(also referred to as virtual vector table) provided by the ROM +monitor. This calling interface is based on the tables used by libbsp +and is thus backwards compatible with the existing CygMon supported +platforms. + + + + +
+Virtual Vectors + +What are virtual vectors, what do they do, and why are they +needed? + + + +"Virtual vectors" is the name of a table located at a static +location in the target address space. This table contains 64 vectors +that point to service functions or data. + + +The fact that the vectors are always placed at the same location in +the address space means that both ROM and RAM startup configurations +can access these and thus the services pointed to. + +The primary goal is to allow services to be provided by ROM +configurations (ROM monitors such as RedBoot in particular) with +clients in RAM configurations being able to use these +services. + +Without the table of pointers this would be impossible since the +ROM and RAM applications would be linked separately - in effect having +separate name spaces - preventing direct references from one to the +other. + +This decoupling of service from client is needed by RedBoot, +allowing among other things debugging of applications which do not +contain debugging client code (stubs). + + + +
+Initialization (or Mechanism vs. Policy) + +Virtual vectors are a mechanism for decoupling services +from clients in the address space. + +The mechanism allows services to be implemented by a ROM +monitor, a RAM application, to be switched out at run-time, to be +disabled by installing pointers to dummy functions, etc. + +The appropriate use of the mechanism is specified loosely by a +policy. The general policy dictates that the vectors are +initialized in whole by ROM monitors (built for ROM or RAM), or by +stand-alone applications. + +For configurations relying on a ROM monitor environment, the policy +is to allow initialization on a service by service basis. The default +is to initialize all services, except COMMS services since these are +presumed to already be carrying a communication session to the +debugger / console which was used for launching the application. This +means that the bulk of the code gets tested in normal builds, and not +just once in a blue moon when building new stubs or a ROM +configuration. + +The configuration options are written to comply with this policy by +default, but can be overridden by the user if desired. Defaults +are: + + +For application development: the ROM monitor provides +debugging and diagnostic IO services, the RAM application relies +on these by default. + + +For production systems: the application contains all the +necessary services. + + + + +
+ + + + +
+Pros and Cons of Virtual Vectors + + +There are pros and cons associated with the use of virtual +vectors. We do believe that the pros generally outweigh the cons by a +great margin, but there may be situations where the opposite is +true. + + + +The use of the services are implemented by way of macros, meaning +that it is possible to circumvent the virtual vectors if +desired. There is (as yet) no implementation for doing this, but it is +possible. + + +Here is a list of pros and cons: + + +Pro: Allows debugging without including stubs + + This is the primary reason for using virtual vectors. It + allows the ROM monitor to provide most of the debugging + infrastructure, requiring only the application to provide + hooks for asynchronous debugger interrupts and for accessing + kernel thread information. + +Pro: Allows debugging to be initiated from arbitrary + channel + + While this is only true where the application does not + actively override the debugging channel setup, it is a very + nice feature during development. In particular it makes it + possible to launch (and/or debug) applications via Ethernet + even though the application configuration does not contain + networking support. + +Pro: Image smaller due to services being provided by ROM + monitor + + All service functions except HAL IO are included in the + default configuration. But if these are all disabled the + image for download will be a little smaller. Probably + doesn't matter much for regular development, but it is a + worthwhile saving for the 20000 daily tests run in the Red + Hat eCos test farm. + +Con: The vectors add a layer of indirection, increasing application + size and reducing performance. + + The size increase is a fraction of what is required to + implement the services. So for RAM configurations there is + a net saving, while for ROM configurations there is a small + overhead. + + The performance loss means little for most of the + services (of which the most commonly used is diagnostic IO + which happens via polled routines + anyway). + + +Con: The layer of indirection is another point of + failure. + + The concern primarily being that of vectors being + trashed by rogue writes from bad code, causing a complete + loss of the service and possibly a crash. But this does + not differ much from a rogue write to anywhere else in the + address space which could cause the same amount of + mayhem. But it is arguably an additional point of failure + for the service in question. + +Con: All the indirection stuff makes it harder to bring a HAL + up + + This is a valid concern. However, seeing as most of the + code in question is shared between all HALs and should + remain unchanged over time, the risk of it being broken + when a new HAL is being worked on should be + minimal. + + When starting a new port, be sure to implement the HAL + IO drivers according to the scheme used in other drivers, + and there should be no problem. + + However, it is still possible to circumvent the vectors + if they are suspect of causing problems: simply change the + HAL_DIAG_INIT and HAL_DIAG_WRITE_CHAR macros to use the raw + IO functions. + + +
+ + + + +
+Available services + + +The hal_if.h file in the common HAL defines the +complete list of available services. A few worth mentioning in +particular: + + + COMMS services. All HAL IO happens via the communication + channels. + + uS delay. Fine granularity (busy wait) delay function. + + Reset. Allows a software initiated reset of the board. + + + +
+ + + +
+ + + + +
+The COMMS channels + +As all HAL IO happens via the COMMS channels these deserve to be +described in a little more detail. In particular the controls of where +diagnostic output is routed and how it is treated to allow for display +in debuggers. + + + +
+Console and Debugging Channels + +There are two COMMS channels - one for console IO and one for +debugging IO. They can be individually configured to use any of the +actual IO ports (serial or Ethernet) available on the platform. + +The console channel is used for any IO initiated by calling the +diag_*() functions. Note that these should only be used during +development for debugging, assertion and possibly tracing +messages. All proper IO should happen via proper devices. This means +it should be possible to remove the HAL device drivers from production +configurations where assertions are disabled. + +The debugging channel is used for communication between the +debugger and the stub which remotely controls the target for the +debugger (the stub runs on the target). This usually happens via some +protocol, encoding commands and replies in some suitable form. + +Having two separate channels allows, e.g., for simple logging +without conflicts with the debugger or interactive IO which some +debuggers do not allow. + +
+ + + + +
+Mangling + +As debuggers usually have a protocol using specialized commands +when communicating with the stub on the target, sending out text as +raw ASCII from the target on the same channel will either result in +protocol errors (with loss of control over the target) or the text may +just be ignored as junk by the debugger. + +To get around this, some debuggers have a special command for text +output. Mangling is the process of encoding diagnostic ASCII text +output in the form specified by the debugger protocol. + +When it is necessary to use mangling, i.e. when writing console +output to the same port used for debugging, a mangler function is +installed on the console channel which mangles the text and passes it +on to the debugger channel. + +
+ + + + +
+Controlling the Console Channel + +Console output configuration is either inherited from the ROM +monitor launching the application, or it is specified by the +application. This is controlled by the new option +CYGSEM_HAL_VIRTUAL_VECTOR_INHERIT_CONSOLE which +defaults to enabled when the configuration is set to use a ROM +monitor. + +If the user wants to specify the console configuration in the +application image, there are two new options that are used for +this. + +Defaults are to direct diagnostic output via a mangler to the +debugging channel (CYGDBG_HAL_DIAG_TO_DEBUG_CHAN +enabled). The mangler type is controlled by the option +CYGSEM_HAL_DIAG_MANGLER. At present there are only +two mangler types: + + +GDB + + This causes a mangler appropriate for debugging with GDB to be + installed on the console channel. + +None + + This causes a NULL mangler to be installed on the console + channel. It will redirect the IO to/from the debug channel + without mangling of the data. This option differs from setting + the console channel to the same IO port as the debugging + channel in that it will keep redirecting data to the debugging + channel even if that is changed to some other port. + + + +Finally, by disabling CYGDBG_HAL_DIAG_TO_DEBUG_CHAN, the diagnostic +output is directed in raw form to the specified console IO port. + +In summary this results in the following common configuration +scenarios for RAM startup configurations: + + + For regular debugging with diagnostic output appearing in the + debugger, mangling is enabled and stubs disabled. + + Diagnostic output appears via the debugging channel as + initiated by the ROM monitor, allowing for correct behavior + whether the application was launched via serial or Ethernet, from + the RedBoot command line or from a debugger. + + + For debugging with raw diagnostic output, mangling is + disabled. + + Debugging session continues as initiated by the ROM monitor, + whether the application was launched via serial or + Ethernet. Diagnostic output is directed at the IO port configured + in the application configuration. + + + Note: + There is one caveat to be aware of. If the + application uses proper devices (be it serial or Ethernet) on + the same ports as those used by the ROM monitor, the + connections initiated by the ROM monitor will be + terminated. + + + + + +And for ROM startup configurations: + + + Production configuration with raw output and no debugging + features (configured for RAM or ROM), mangling is disabled, no + stubs are included. + + Diagnostic output appears (in unmangled form) on the specified + IO port. + + + RedBoot configuration, includes debugging features and necessary + mangling. + + Diagnostic and debugging output port is auto-selected by the + first connection to any of the supported IO ports. Can change + from interactive mode to debugging mode when a debugger is + detected - when this happens a mangler will be installed as + required. + + + GDB stubs configuration (obsoleted by RedBoot configuration), + includes debugging features, mangling is hardwired to GDB + protocol. + + Diagnostic and debugging output is hardwired to configured IO + ports, mangling is hardwired. + + + +
+ + + + +
+Footnote: Design Reasoning for Control of Console Channel + +The current code for controlling the console channel is a +replacement for an older implementation which had some shortcomings +which addressed by the new implementation. + +This is what the old implementation did: on initialization it would +check if the CDL configured console channel differed from the active +debug channel - and if so, set the console channel, thereby disabling +mangling. + +The idea was that whatever channel was configured to be used for +console (i.e., diagnostic output) in the application was what should +be used. Also, it meant that if debug and console channels were +normally the same, a changed console channel would imply a request for +unmangled output. + +But this prevented at least two things: + + + It was impossible to inherit the existing connection by which + the application was launched (either by RedBoot commands via + telnet, or by via a debugger). + + This was mostly a problem on targets supporting Ethernet + access since the diagnostic output would not be returned via the + Ethernet connection, but on the configured serial port. + + The problem also occurred on any targets with multiple serial + ports where the ROM monitor was configured to use a different + port than the CDL defaults. + + + Proper control of when to mangle or just write out raw ASCII + text. + + Sometimes it's desirable to disable mangling, even if the + channel specified is the same as that used for debugging. This + usually happens if GDB is used to download the application, but + direct interaction with the application on the same channel is + desired (GDB protocol only allows output from the target, no + input). + + + +
+ + + +
+ + + + +
+The calling Interface API + +The calling interface API is defined by hal_if.h and hal_if.c in +hal/common. + +The API provides a set of services. Different platforms, or +different versions of the ROM monitor for a single platform, may +implement fewer or extra service. The table has room for growth, and +any entries which are not supported map to a NOP-service (when called +it returns 0 (false)). + + +A client of a service should either be selected by configuration, +or have suitable fall back alternatives in case the feature is not +implemented by the ROM monitor. + + + +Note: + +Checking for unimplemented service when this may be a data +field/pointer instead of a function: suggest reserving the last entry +in the table as the NOP-service pointer. Then clients can compare a +service entry with this pointer to determine whether it's initialized +or not. + + + +The header file cyg/hal/hal_if.h defines + the table layout and accessor macros (allowing primitive type + checking and alternative implementations should it become necessary). + + +The source file hal_if.c defines the table + initialization function. All HALs should call this during platform + initialization - the table will get initialized according to + configuration. Also defined here are wrapper functions which map + between the calling interface API and the API of the used eCos + functions. + + + + +
+Implemented Services + +This is a brief description of the services, some of which are +described in further detail below. + + +VERSION + Version of table. Serves as a way to check for how many + features are available in the table. This is the index of the + last service in the table. +KILL_VECTOR + [Presently unused by the stub code, but initialized] This + vector defines a function to execute when the system receives + a kill signal from the debugger. It is initialized with the + reset function (see below), but the application (or eCos) can + override it if necessary. +CONSOLE_PROCS + The communication procedure table used for console IO + (see . +DEBUG_PROCS + The communication procedure table used for debugger IO + (see ). +FLUSH_DCACHE + Flushes the data cache for the specified + region. Some implementations may flush the entire data cache. +FLUSH_ICACHE + Flushes (invalidates) the instruction cache + for the specified region. Some implementations may flush the + entire instruction cache. +SET_DEBUG_COMM + Change debugging communication channel. +SET_CONSOLE_COMM + Change console communication channel. +DBG_SYSCALL + Vector used to communication between debugger functions in + ROM and in RAM. RAM eCos configurations may install a function + pointer here which the ROM monitor uses to get thread + information from the kernel running in RAM. +RESET + Resets the board on call. If it is not possible to reset + the board from software, it will jump to the ROM entry point + which will perform a "software" reset of the board. +CONSOLE_INTERRUPT_FLAG + Set if a debugger interrupt request was detected while + processing console IO. Allows the actual breakpoint action to + be handled after return to RAM, ensuring proper backtraces + etc. +DELAY_US + Will delay the specified number of microseconds. The + precision is platform dependent to some extend - a small value + (<100us) is likely to cause bigger delays than requested. +FLASH_CFG_OP + For accessing configuration settings kept in flash memory. +INSTALL_BPT_FN + Installs a breakpoint at the specified address. This is + used by the asynchronous breakpoint support + (see ). + +
+ + + + +
+Compatibility + +When a platform is changed to support the calling interface, +applications will use it if so configured. That means that if an +application is run on a platform with an older ROM monitor, the +service is almost guaranteed to fail. + + +For this reason, applications should only use Console Comm for HAL +diagnostics output if explicitly configured to do so +(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG). + + +As for asynchronous GDB interrupts, the service will always be +used. This is likely to cause a crash under older ROM monitors, but +this crash may be caught by the debugger. The old workaround still +applies: if you need asynchronous breakpoints or thread debugging +under older ROM monitors, you may have to include the debugging +support when configuring eCos. + + +
+ + + + +
+Implementation details + +During the startup of a ROM monitor, the calling table will be +initialized. This also happens if eCos is configured not to rely on +a ROM monitor. + + + +Note: + There is reserved space (256 bytes) for the vector +table whether it gets used or not. This may be something that we want +to change if we ever have to shave off every last byte for a given +target. + + + +If thread debugging features are enabled, the function for accessing +the thread information gets registered in the table during startup of +a RAM startup configuration. + + +Further implementation details are described where the service itself +is described. + + + +
+ + + + +
+New Platform Ports + +The hal_platform_init() function must call +hal_if_init(). + + +The HAL serial driver must, when called via +cyg_hal_plf_comms_init() must initialize the +communication channels. + + +The reset() function defined in +hal_if.c will attempt to do a hardware reset, but +if this fails it will fall back to simply jumping to the reset +entry-point. On most platforms the startup initialization will go a +long way to reset the target to a sane state (there will be +exceptions, of course). For this reason, make sure to define +HAL_STUB_PLATFORM_RESET_ENTRY in plf_stub.h. + + +All debugging features must be in place in order for the debugging +services to be functional. See general platform porting notes. + + +
+ + + + +
+New architecture ports + +There are no specific requirements for a new architecture port in +order to support the calling interface, but the basic debugging +features must be in place. See general architecture porting notes. + +
+ + + +
+ + + + +
+IO channels + + +The calling interface provides procedure tables for all IO channels on +the platform. These are used for console (diagnostic) and debugger IO, +allowing a ROM monitor to provided all the needed IO routines. At +the same time, this makes it easy to switch console/debugger channels +at run-time (the old implementation had hardwired drivers for console +and debugger IO, preventing these to change at run-time). + + +The hal_if provides wrappers which interface these services to the +eCos infrastructure diagnostics routines. This is done in a way which +ensures proper string mangling of the diagnostics output when required +(e.g. O-packetization when using a GDB compatible ROM monitor). + + + + +
+Available Procedures + +This is a brief description of the procedures + + +CH_DATA +Pointer to the controller IO base (or a pointer to a per-device + structure if more data than the IO base is required). All the + procedures below are called with this data item as the first + argument. + +WRITE + Writes the buffer to the device. +READ + Fills a buffer from the device. +PUTC + Write a character to the device. +GETC + Read a character from the device. +CONTROL + Device feature control. Second argument specifies function: + + SETBAUD + Changes baud rate. + GETBAUD + Returns the current baud rate. + INSTALL_DBG_ISR + [Unused] + REMOVE_DBG_ISR + [Unused] + IRQ_DISABLE + Disable debugging receive interrupts on the device. + IRQ_ENABLE + Enable debugging receive interrupts on the device. + DBG_ISR_VECTOR + Returns the ISR vector used by the device for debugging + receive interrupts. + SET_TIMEOUT + Set GETC timeout in milliseconds. + FLUSH_OUTPUT + Forces driver to flush data in its buffers. Note + that this may not affect hardware buffers + (e.g. FIFOs). + + + +DBG_ISR + ISR used to handle receive interrupts from the + device (see ). +GETC_TIMEOUT + Read a character from the device with timeout. + + +
+ + + + +
Usage + +The standard eCos diagnostics IO functions use the channel +procedure table when CYGSEM_HAL_VIRTUAL_VECTOR_DIAG is enabled. That +means that when you use diag_printf (or the libc printf function) the +stream goes through the selected console procedure table. If you use +the virtual vector function SET_CONSOLE_COMM you can change the device +which the diagnostics output goes to at run-time. + +You can also use the table functions directly if desired +(regardless of the CYGSEM_HAL_VIRTUAL_VECTOR_DIAG setting - assuming +the ROM monitor provides the services). Here is a small example which +changes the console to use channel 2, fetches the comm procs pointer +and calls the write function from that table, then restores the +console to the original channel: + + +#define T "Hello World!\n" + +int +main(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + CYGACC_CALL_IF_SET_CONSOLE_COMM(2); + + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_WRITE(*comm, T, strlen(T)); + + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + + +Beware that if doing something like the above, you should only do +it to a channel which does not have GDB at the other end: GDB ignores +raw data, so you would not see the output. + +
+ + + + +
+Compatibility + +The use of this service is controlled by the option +CYGSEM_HAL_VIRTUAL_VECTOR_DIAG which is disabled per default on most +older platforms (thus preserving backwards compatibility with older +stubs). On newer ports, this option should always be set. + +
+ + + + +
Implementation Details + +There is an array of procedure tables (raw comm channels) for each +IO device of the platform which get initialized by the ROM monitor, or +optionally by a RAM startup configuration (allowing the RAM +configuration to take full control of the target). In addition to +this, there's a special table which is used to hold mangler +procedures. + +The vector table defines which of these channels are selected for +console and debugging IO respectively: console entry can be empty, +point to mangler channel, or point to a raw channel. The debugger +entry should always point to a raw channel. + +During normal console output (i.e., diagnostic output) the console +table will be used to handle IO if defined. If not defined, the debug +table will be used. + +This means that debuggers (such as GDB) which require text streams +to be mangled (O-packetized in the case of GDB), can rely on the ROM +monitor install mangling IO routines in the special mangler table and +select this for console output. The mangler will pass the mangled data +on to the selected debugging channel. + +If the eCos configuration specifies a different console channel +from that used by the debugger, the console entry will point to the +selected raw channel, thus overriding any mangler provided by the ROM +monitor. + +See hal_if_diag_* routines in hal_if.c for more details of the stream +path of diagnostic output. See cyg_hal_gdb_diag_*() routines in +hal_stub.c for the mangler used for GDB communication. + + + +
+ + + + +
+New Platform Ports + +Define CDL options CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS, +CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL, and +CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL. + + +If CYGSEM_HAL_VIRTUAL_VECTOR_DIAG is set, make sure the infra diag +code uses the hal_if diag functions: + + + #define HAL_DIAG_INIT() hal_if_diag_init() + #define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) + #define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + + +In addition to the above functions, the platform HAL must also +provide a function cyg_hal_plf_comms_init which initializes the +drivers and the channel procedure tables. + + +Most of the other functionality in the table is more or less +possible to copy unchanged from existing ports. Some care is necessary +though to ensure the proper handling of interrupt vectors and timeouts +for various devices handled by the same driver. See PowerPC/Cogent +platform HAL for an example implementation. + + +Note: + When vector table console code is not used, +the platform HAL must map the HAL_DIAG_INIT, HAL_DIAG_WRITE_CHAR and +HAL_DIAG_READ_CHAR macros directly to the low-level IO functions, +hardwired to use a compile-time configured channel. + + + +Note: + On old ports the hardwired HAL_DIAG_INIT, +HAL_DIAG_WRITE_CHAR and +HAL_DIAG_READ_CHAR implementations will also +contain code to O-packetize the output for GDB. This should +not be adopted for new ports! On new ports the +ROM monitor is guaranteed to provide the necessary mangling via the +vector table. The hardwired configuration should be reserved for ROM +startups where achieving minimal image size is crucial. + + + +
+ + + +
+ + + + +
+ + + + +
+HAL Coding Conventions + + + +To get changes and larger submissions included into the eCos source +repository, we ask that you adhere to a set of coding conventions. +The conventions are defined as an attempt to make a consistent +tree. Consistency makes it easier for people to read, understand and +maintain the code, which is important when many people work on the +same project. + + + +The below is only a brief, and probably incomplete, summary of the +rules. Please look through files in the area where you are making +changes to get a feel for any additional conventions. Also feel free +to ask on the list if you have specific questions. + + + +
+Implementation issues + + +There are a few implementation issues that should be kept in mind: + + + +HALs + HALs must be written in C and assembly only. C++ must not + be used. This is in part to keep the HALs simple since this is + usually the first part of eCos a newcomer will see, and in + part to maintain the existing de facto standard. + +IO access + Use HAL IO access macros for code that might be reused on + different platforms than the one you are writing it for. + +MMU + If it is necessary to use the MMU (e.g., to prevent + caching of IO areas), use a simple 1-1 mapping of memory if + possible. On most platforms where using the MMU is necessary, + it will be possible to achieve the 1-1 mapping using the MMU's + provision for mapping large continuous areas (hardwired TLBs or + BATs). This reduces the footprint (no MMU table) and avoids + execution overhead (no MMU-related exceptions). + +Assertions + The code should contain assertions to validate argument + values, state information and any assumptions the code may be + making. Assertions are not enabled in production builds, so + liberally sprinkling assertions throughout the code is + good. + +Testing + The ability to test your code is very important. In + general, do not add new code to the eCos runtime unless you + also add a new test to exercise that code. The test also + serves as an example of how to use the new code. + + + +
+ +
+Source code details + + +Line length + Keep line length below 78 columns whenever possible. + +Comments + Whenever possible, use // comments instead of /**/. + +Indentation + Use spaces instead of TABs. Indentation level is 4. Braces + start on the same line as the expression. See below for emacs + mode details. + + +;;================================================================= +;; eCos C/C++ mode Setup. +;; +;; bsd mode: indent = 4 +;; tail comments are at col 40. +;; uses spaces not tabs in C + +(defun ecos-c-mode () + "C mode with adjusted defaults for use with the eCos sources." + (interactive) + (c++-mode) + (c-set-style "bsd") + (setq comment-column 40) + (setq indent-tabs-mode nil) + (show-paren-mode 1) + (setq c-basic-offset 4) + + (set-variable 'add-log-full-name "Your Name") + (set-variable 'add-log-mailing-address "Your email address")) + +(defun ecos-asm-mode () + "ASM mode with adjusted defaults for use with the eCos sources." + (interactive) + (setq comment-column 40) + (setq indent-tabs-mode nil) + (asm-mode) + (setq c-basic-offset 4) + + (set-variable 'add-log-full-name "Your Name") + (set-variable 'add-log-mailing-address "Your email address")) + +(setq auto-mode-alist + (append '(("/local/ecc/.*\\.C$" . ecos-c-mode) + ("/local/ecc/.*\\.cc$" . ecos-c-mode) + ("/local/ecc/.*\\.cpp$" . ecos-c-mode) + ("/local/ecc/.*\\.inl$" . ecos-c-mode) + ("/local/ecc/.*\\.c$" . ecos-c-mode) + ("/local/ecc/.*\\.h$" . ecos-c-mode) + ("/local/ecc/.*\\.S$" . ecos-asm-mode) + ("/local/ecc/.*\\.inc$" . ecos-asm-mode) + ("/local/ecc/.*\\.cdl$" . tcl-mode) + ) auto-mode-alist)) + + + + +
+ +
+ +Nested Headers + +In order to allow platforms to define all necessary details, while +still maintaining the ability to share code between common platforms, +all HAL headers are included in a nested fashion. + +The architecture header (usually hal_XXX.h) includes the +variant equivalent of the header (var_XXX.h) which in turn +includes the platform equivalent of the header +(plf_XXX.h). + +All definitions that may need to be overridden by a platform are +then only conditionally defined, depending on whether a lower layer +has already made the definition: + + +hal_intr.h: #include <var_intr.h> + + #ifndef MACRO_DEFINED + # define MACRO ... + # define MACRO_DEFINED + #endif + + + +var_intr.h: #include <plf_intr.h> + + #ifndef MACRO_DEFINED + # define MACRO ... + # define MACRO_DEFINED + #endif + + +plf_intr.h: + + # define MACRO ... + # define MACRO_DEFINED + + +This means a platform can opt to rely on the variant or +architecture implementation of a feature, or implement it itself. + +
+ +
+ + + + +
+Platform HAL Porting + + +This is the type of port that takes the least effort. It basically +consists of describing the platform (board) for the HAL: memory +layout, early platform initialization, interrupt controllers, and a +simple serial device driver. + + + +Doing a platform port requires a preexisting architecture and +possibly a variant HAL port. + + + + +
+HAL Platform Porting Process + + + +
+Brief overview + +The easiest way to make a new platform HAL is simply to copy an +existing platform HAL of the same architecture/variant and change all +the files to match the new one. In case this is the first platform for +the architecture/variant, a platform HAL from another architecture +should be used as a template. + + + +The best way to start a platform port is to concentrate on getting +RedBoot to run. RedBoot is a simpler environment than full eCos, it +does not use interrupts or threads, but covers most of the +basic startup requirements. + + + +RedBoot normally runs out of FLASH or ROM and provides program loading +and debugging facilities. This allows further HAL development to +happen using RAM startup configurations, which is desirable for the +simple reason that downloading an image which you need to test is +often many times faster than either updating a flash part, or indeed, +erasing and reprogramming an EPROM. + + +There are two approaches to getting to this first goal: + + + + + +The board is equipped with a ROM monitor which allows "load and go" of +ELF, binary, S-record or some other image type which can be created +using objcopy. This allows you to develop +RedBoot by downloading and running the code (saving time). + + + +When the stub is running it is a good idea to examine the various +hardware registers to help you write the platform initialization code. + + + +Then you may have to fiddle a bit going through step two (getting it +to run from ROM startup). If at all possible, preserve the original +ROM monitor so you can revert to it if necessary. + + + + + +The board has no ROM monitor. You need to get the platform +initialization and stub working by repeatedly making changes, updating +flash or EPROM and testing the changes. If you are lucky, you have a +JTAG or similar CPU debugger to help you. If not, you will probably +learn to appreciate LEDs. This approach may also be needed during the +initial phase of moving RedBoot from RAM startup to ROM, since it is +very unlikely to work first time. + + + + +
+ + + + +
+Step-by-step + +Given that no two platforms are exactly the same, you may have to +deviate from the below. Also, you should expect a fair amount of +fiddling - things almost never go right the first time. See the hints +section below for some suggestions that might help debugging. + + +The description below is based on the HAL layout used in the MIPS, +PC and MN10300 HALs. Eventually all HALs should be converted to look like +these - but in a transition period there will be other HALs which look +substantially different. Please try to adhere to the following as much is +possible without causing yourself too much grief integrating with a +HAL which does not follow this layout. + + + + +
+Minimal requirements + + +These are the changes you must make before you attempt to build +RedBoot. You are advised to read all the sources though. + + + +Copy an existing platform HAL from the same or another + architecture. Rename the files as necessary to follow the + standard: CDL and MLT related files should contain the + <arch>_<variant>_<platform> triplet. + + +Adjust CDL options. Primarily option naming, real-time + clock/counter, and CYGHWR_MEMORY_LAYOUT variables, but also other + options may need editing. Look through the architecture/variant + CDL files to see if there are any requirements/features which + where not used on the platform you copied. If so, add appropriate + ones. See for more + details. + + +Add the necessary packages and target descriptions to the + top-level ecos.db file. See . Initially, the target entry + should only contain the HAL packages. Other hardware support + packages will be added later. + + +Adjust the MLT files in + include/pkgconf to match the memory layout on + the platform. For initial testing it should be enough to just hand + edit .h and .ldi files, but eventually you should generate all + files using the memory layout editor in the configuration + tool. See for + more details. + + + + + Edit the misc/redboot_<STARTUP>.ecm for + the startup type you have chosen to begin with. Rename any + platform specific options and remove any that do not apply. In the + cdl_configuration section, comment out any + extra packages that are added, particularly packages such as + CYGPKG_IO_FLASH and + CYGPKG_IO_ETH_DRIVERS. These are not needed for + initial porting and will be added back later. + + + +If the default IO macros are not correct, override them in + plf_io.h. This may be necessary if the platform uses a different + endianness from the default for the CPU. + + +Leave out/comment out code that enables caches and/or MMU if + possible. Execution speed will not be a concern until the port is + feature complete. + + +Implement a simple serial driver (polled mode only). Make sure the + initialization function properly hooks the procedures up in the + virtual vector IO channel tables. RedBoot will call the serial + driver via these tables. + + By copying an existing platform HAL most of this code will be + already done, and will only need the platform specific hardware + access code to be written. + + + +Adjust/implement necessary platform + initialization. This can be found in + platform.inc and + platform.S files (ARM: + hal_platform_setup.h and + <platform>_misc.c, PowerPC: + <platform>.S). This step can be + postponed if you are doing a RAM startup RedBoot first and the + existing ROM monitor handles board initialization. + + +Define HAL_STUB_PLATFORM_RESET + (optionally empty) and + HAL_STUB_PLATFORM_RESET_ENTRY so that RedBoot + can reset-on-detach - this is very handy, often removing the need + for physically resetting the board between downloads. + + + + +You should now be able to build RedBoot. For ROM startup: + + + +% ecosconfig new <target_name> redboot +% ecosconfig import $(ECOS_REPOSITORY)/hal/<architecture>/<platform>/<version>/misc/redboot_ROM.ecm +% ecosconfig tree +% make + + +You may have to make further changes than suggested above to get +the make command to succeed. But when it does, you should find a +RedBoot image in install/bin. To program this image into flash or +EPROM, you may need to convert to some other file type, and possibly +adjust the start address. When you have the correct +objcopy command to do this, add it to the +CYGBLD_BUILD_GDB_STUBS custom build rule in the +platform CDL file. + + +Having updated the flash/EPROM on the board, you should see output +on the serial port looking like this when powering on the board: + + + +RedBoot(tm) bootstrap and debug environment [ROMRAM] +Non-certified release, version UNKNOWN - built 15:42:24, Mar 14 2002 + +Platform: <PLATFORM> (<ARCHITECTURE> <VARIANT>) +Copyright (C) 2000, 2001, 2002, Red Hat, Inc. + +RAM: 0x00000000-0x01000000, 0x000293e8-0x00ed1000 available +FLASH: 0x24000000 - 0x26000000, 256 blocks of 0x00020000 bytes each. +RedBoot> + + +If you do not see this output, you need to go through all your +changes and figure out what's wrong. If there's a user programmable +LED or LCD on the board it may help you figure out how far RedBoot +gets before it hangs. Unfortunately there's no good way to describe +what to do in this situation - other than that you have to play with +the code and the board. + + +
+ + + +
+Adding features + +Now you should have a basic RedBoot running on the board. This +means you have a the correct board initialization and a working serial +driver. It's time to flesh out the remaining HAL features. + + + +Reset. As mentioned above it is desirable to get the board to +reset when GDB disconnects. When GDB disconnects it sends RedBoot +a kill-packet, and RedBoot first calls HAL_STUB_PLATFORM_RESET(), +attempting to perform a software-invoked reset. Most embedded +CPUs/boards have a watchdog which is capable of triggering a reset. +If your target does not have a watchdog, leave +HAL_STUB_PLATFORM_RESET() empty and rely on the fallback approach. + + +If HAL_STUB_PLATFORM_RESET() did not cause a reset, RedBoot will +jump to HAL_STUB_PLATFORM_RESET_ENTRY - this should be the address +where the CPU will start execution after a reset. Re-initializing the +board and drivers will usually be good enough to make a +hardware reset unnecessary. + + +After the reset caused by the kill-packet, the target will be ready +for GDB to connect again. During a days work, this will save you from +pressing the reset button many times. + + +Note that it is possible to disconnect from the board without +causing it to reset by using the GDB command "detach". + + + +Single-stepping is necessary for both instruction-level debugging +and for breakpoint support. Single-stepping support should already be +in place as part of the architecture/variant HAL, but you want to give +it a quick test since you will come to rely on it. + + + +Real-time clock interrupts drive the eCos scheduler clock. Many +embedded CPUs have an on-core timer (e.g. SH) or decrementer +(e.g. MIPS, PPC) that can be used, and in this case it will already be +supported by the architecture/variant HAL. You only have to calculate +and enter the proper CYGNUM_HAL_RTC_CONSTANTS +definitions in the platform CDL file. + + +On some targets it may be necessary to use a platform-specific +timer source for driving the real-time clock. In this case you also +have to enter the proper CDL definitions, but must also define +suitable versions of the HAL_CLOCK_XXXX macros. + + + +Interrupt decoding usually differs between platforms because the +number and type of devices on the board differ. In +plf_intr.h (ARM: +hal_platform_ints.h) you must either extend or +replace the default vector definitions provided by the architecture +or variant interrupt headers. You may also have to define +HAL_INTERRUPT_XXXX control macros. + + + +Caching may also differ from architecture/variant definitions. +This maybe just the cache sizes, but there can also be bigger +differences for example if the platform supports 2nd level caches. + + +When cache definitions are in place, enable the caches on +startup. First verify that the system is stable for RAM startups, then +build a new RedBoot and install it. This will test if caching, and in +particular the cache sync/flush operations, also work for ROM startup. + + + +Asynchronous breakpoints allow you to stop application execution +and enter the debugger. Asynchronous breakpoint details are described +in . + + + + +You should now have a completed platform HAL port. Verify its +stability and completeness by running all the eCos tests and fix any +problems that show up (you have a working RedBoot now, remember! That +means you can debug the code to see why it fails). + + +Given the many configuration options in eCos, there may be hidden +bugs or missing features that do not show up even if you run all the +tests successfully with a default configuration. A comprehensive test +of the entire system will take many configuration permutations and +many many thousands of tests executed. + + +
+ +
+ + + + +
+Hints + + + + + JTAG or similar CPU debugging hardware can greatly reduce the time + it takes to write a HAL port since you always have full visibility + of what the CPU is doing. + + + + + LEDs can be your friends if you don't have a JTAG + device. Especially in the start of the porting effort if you don't + already have a working ROM monitor on the target. Then you have to + get a basic RedBoot working while basically being blindfolded. The + LED can make it little easier, as you'll be able to do limited + tracking of program flow and behavior by switching the LED on and + off. If the board has multiple LEDs you can show a number (using + binary notation with the LEDs) and sprinkle code which sets + different numbers throughout the code. + + + + Debugging the interrupt processing is possible if you are + careful with the way you program the very early interrupt entry + handling. Write it so that as soon as possible in the interrupt + path, taking a trap (exception) does not harm execution. See the + SH vectors.S code for an example. Look for + cyg_hal_default_interrupt_vsr and the label + cyg_hal_default_interrupt_vsr_bp_safe, which + marks the point after which traps/single-stepping is safe. + + + Being able to display memory content, CPU registers, + interrupt controller details at the time of an interrupt can save + a lot of time. + + + + Using assertions is a good idea. They can sometimes reveal subtle + bugs or missing features long before you would otherwise have + found them, let alone notice them. + + + The default eCos configuration does not use assertions, so you + have to enable them by switching on the option CYGPKG_INFRA_DEBUG + in the infra package. + + + + The idle loop can be used to help debug the system. + + + Triggering clock from the idle loop is a neat trick for + examining system behavior either before interrupts are fully + working, or to speed up "the clock". + + + Use the idle loop to monitor and/or print out variables or + hardware registers. + + + +hal_mk_defs is used in some of the +HALs (ARM, SH) as a way to generate assembler symbol definitions from +C header files without imposing an assembler/C syntax separation in +the C header files. + + + + + + +
+ + + +
+ + + + +
+HAL Platform CDL + +The platform CDL both contains details necessary for the building +of eCos, and platform-specific configuration options. For this reason +the options differ between platforms, and the below is just a brief +description of the most common options. + + See Components Writers Guide +for more details on CDL. Also have a quick look around in +existing platform CDL files to get an idea of what is possible and how +various configuration issues can be represented with CDL. + + + +
+eCos Database + + +The eCos configuration system is made aware of a package by +adding a package description in ecos.db. As an +example we use the TX39/JMR3904 platform: + + + +package CYGPKG_HAL_MIPS_TX39_JMR3904 { + alias { "Toshiba JMR-TX3904 board" hal_tx39_jmr3904 tx39_jmr3904_hal } + directory hal/mips/jmr3904 + script hal_mips_tx39_jmr3904.cdl + hardware + description " + The JMR3904 HAL package should be used when targeting the + actual hardware. The same package can also be used when + running on the full simulator, since this provides an + accurate simulation of the hardware including I/O devices. + To use the simulator in this mode the command + `target sim --board=jmr3904' should be used from inside gdb." +} + + +This contains the title and description presented in the +Configuration Tool when the package is selected. It also specifies +where in the tree the package files can be found (directory) +and the name of the CDL file which contains the package details +(script). + + + +To be able to build and test a configuration for the new target, there +also needs to be a target entry in the +ecos.db file. + + + +target jmr3904 { + alias { "Toshiba JMR-TX3904 board" jmr tx39 } + packages { CYGPKG_HAL_MIPS + CYGPKG_HAL_MIPS_TX39 + CYGPKG_HAL_MIPS_TX39_JMR3904 + } + description " + The jmr3904 target provides the packages needed to run + eCos on a Toshiba JMR-TX3904 board. This target can also + be used when running in the full simulator, since the simulator provides an + accurate simulation of the hardware including I/O devices. + To use the simulator in this mode the command + `target sim --board=jmr3904' should be used from inside gdb." +} + + + + +The important part here is the packages section +which defines the various hardware specific packages that contribute +to support for this target. In this case the MIPS architecture +package, the TX39 variant package, and the JMR-TX3904 platform +packages are selected. Other packages, for serial drivers, ethernet +drivers and FLASH memory drivers may also appear here. + + +
+ + + + +
+CDL File Layout + + +All the platform options are contained in a CDL package named +CYGPKG_HAL_<architecture>_<variant>_<platform>. +They all share more or less the same cdl_package +details: + + + +cdl_package CYGPKG_HAL_MIPS_TX39_JMR3904 { + display "JMR3904 evaluation board" + parent CYGPKG_HAL_MIPS + requires CYGPKG_HAL_MIPS_TX39 + define_header hal_mips_tx39_jmr3904.h + include_dir cyg/hal + description " + The JMR3904 HAL package should be used when targeting the + actual hardware. The same package can also be used when + running on the full simulator, since this provides an + accurate simulation of the hardware including I/O devices. + To use the simulator in this mode the command + `target sim --board=jmr3904' should be used from inside gdb." + + compile platform.S plf_misc.c plf_stub.c + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_mips_tx39.h>" + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_mips_tx39_jmr3904.h>" + } + + ... +} + + +This specifies that the platform package should be parented under +the MIPS packages, requires the TX39 variant HAL and all configuration +settings should be saved in +cyg/hal/hal_mips_tx39_jmt3904.h. + + +The compile line specifies which files should be built +when this package is enabled, and the define_proc defines +some macros that are used to access the variant or architecture (the +_TARGET_ name is a bit of a misnomer) and platform +configuration options. + +
+ + + + +
+Startup Type + +eCos uses an option to select between a set of valid startup +configurations. These are normally RAM, ROM and possibly ROMRAM. This +setting is used to select which linker map to use (i.e., where to link +eCos and the application in the memory space), and how the startup +code should behave. + + +cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM"} + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targeting the JMR3904 board it is possible to build + the system for either RAM bootstrap, ROM bootstrap, or STUB + bootstrap. RAM bootstrap generally requires that the board + is equipped with ROMs containing a suitable ROM monitor or + equivalent software that allows GDB to download the eCos + application on to the board. The ROM bootstrap typically + requires that the eCos application be blown into EPROMs or + equivalent technology." +} + + +The no_define and define +pair is used to make the setting of this option appear in the file +system.h instead of the default specified in the +header. + +
+ + + + +
+Build options + + +A set of options under the components +CYGBLD_GLOBAL_OPTIONS and +CYGHWR_MEMORY_LAYOUT specify how eCos should be +built: what tools and compiler options should be used, and which +linker fragments should be used. + + + + +cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "mips-tx39-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-g -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } +} + +cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "mips_tx39_jmr3904_ram" : \ + "mips_tx39_jmr3904_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_mips_tx39_jmr3904_ram.ldi>" : \ + "<pkgconf/mlt_mips_tx39_jmr3904_rom.ldi>" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_mips_tx39_jmr3904_ram.h>" : \ + "<pkgconf/mlt_mips_tx39_jmr3904_rom.h>" } + } +} + + + +
+ + + + +
+Common Target Options + +All platforms also specify real-time clock details: + + +# Real-time clock/counter specifics +cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants." + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + # Isn't a nice way to handle freq requirement! + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + legal_values { 15360 20736 } + calculated { CYGHWR_HAL_MIPS_CPU_FREQ == 50 ? 15360 : \ + CYGHWR_HAL_MIPS_CPU_FREQ == 66 ? 20736 : 0 } + } +} + + + The NUMERATOR divided by the +DENOMINATOR gives the number of nanoseconds per +tick. The PERIOD is the divider to be programmed +into a hardware timer that is driven from an appropriate hardware +clock, such that the timer overflows once per tick (normally +generating a CPU interrupt to mark the end of a tick). The tick +default rate is typically 100Hz. + + +Platforms that make use of the virtual vector +ROM calling interface (see ) will also +specify details necessary to define configuration channels (these +options are from the SH/EDK7707 HAL) : + + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 +} + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The EDK/7708 board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." +} + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The EDK/7708 board has only one serial port. This option + chooses which port will be used for diagnostic output." +} + + +The platform usually also specify an option controlling the ability + to co-exist with a ROM monitor: + + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "CygMon" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "CygMon" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for three different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"CygMon\" provides support for the Cygnus ROM Monitor. + And finally, \"GDB_stubs\" provides support when GDB stubs are + included in the ROM monitor or boot ROM." +} + + +Or the ability to be configured as a ROM monitor: + + +cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." +} + + +The latter option is accompanied by a special build rule that +extends the generic ROM monitor build rule in the common HAL: + + +cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + <PREFIX>/bin/gdb_module.bin : <PREFIX>/bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } +} + + + +Most platforms support RedBoot, and some options are needed to +configure for RedBoot. + + + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + <PREFIX>/bin/redboot.bin : <PREFIX>/bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } + + + +The important part here is the make command in the +CYGBLD_BUILD_REDBOOT_BIN option which emits +makefile commands to translate the .elf file +generated by the link phase into both a binary file and an S-Record +file. If a different format is required by a PROM programmer or ROM +monitor, then different output formats would need to be generated here. + + +
+ + + +
+ + + + +
+Platform Memory Layout + +The platform memory layout is defined using the Memory +Configuration Window in the Configuration Tool. + + +If you do not have access to a Windows machine, you can +hand edit the .h and .ldi files to match the +properties of your platform. If you want to contribute your port back +to the eCos community, ask someone on the list to make proper memory +map files for you. + + +
+Layout Files + +The memory configuration details are saved in three files: + + + +.mlt + This is the Configuration Tool save-file. It is only used + by the Configuration Tool. + + +.ldi + This is the linker script fragment. It defines the memory + and location of sections by way of macros defined in the + architecture or variant linker script. + + +.h + This file describes some of the memory region details as C + macros, allowing eCos or the application adapt the memory + layout of a specific configuration. + + + +These three files are generated for each startup-type, since the +memory details usually differ. + +
+ +
+Reserved Regions + +Some areas of the memory space are reserved for specific +purposes, making room for exception vectors and various tables. RAM +startup configurations also need to reserve some space at the bottom +of the memory map for the ROM monitor. + +These reserved areas are named with the prefix "reserved_" which is +handled specially by the Configuration Tool: instead of referring to a +linker macro, the start of the area is labeled and a gap left in the +memory map. + +
+ + +
+ + + + +
+Platform Serial Device Support + + +The first step is to set up the CDL definitions. The configuration +options that need to be set are the following: + + + + + CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS + The number of channels, usually 0, 1 or 2. + + + + CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL + The channel to use for GDB. + + + + CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD + Initial baud rate for debug channel. + + + + CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL + The channel to use for the + console. + + + + CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD + The initial baud rate for the console + channel. + + + + CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + The default console channel. + + + + +The code in hal_diag.c need to be converted to +support the new serial device. +If this the same as a device already supported, copy that. + + + +The following functions and types need to be rewritten to support a new serial +device. + + + + + struct channel_data_t; + + + Structure containing base address, timeout and ISR vector number + for each serial device supported. Extra fields my be added if + necessary for the device. For example some devices have + write-only control registers, so keeping a shadow of the last + value written here can be useful. + + + + + + xxxx_ser_channels[]; + + + Array of channel_data_t, initialized with parameters of each + channel. The index into this array is the channel number used + in the CDL options above and is used by the virtual vector + mechanism to refer to each channel. + + + + + + void cyg_hal_plf_serial_init_channel(void + *__ch_data) + + + Initialize the serial device. The parameter is actually a pointer to a + channel_data_t and should be cast back to + this type before use. This function should use the CDL + definition for the baud rate for the channel it is initializing. + + + + + + void cyg_hal_plf_serial_putc(void * __ch_data, + char *c) + + + Send a character to the serial device. This function should + poll for the device being ready to send and then write the character. + Since this is intended to be a diagnostic/debug channel, it is + often also a good idea to poll for end of transmission + too. This ensures that as much data gets out of the system as + possible. + + + + + + bool cyg_hal_plf_serial_getc_nonblock(void* + __ch_data, cyg_uint8* ch) + + + This function tests the device and if a character is + available, places it in *ch and returns + TRUE. If no character is available, then + the function returns FALSE immediately. + + + + + + int cyg_hal_plf_serial_control(void *__ch_data, + __comm_control_cmd_t __func, + ...) + + + This is an IOCTL-like function for controlling various aspects + of the serial device. The only part in which you may need to + do some work initially is in the + __COMMCTL_IRQ_ENABLE and + __COMMCTL_IRQ_DISABLE cases to + enable/disable interrupts. + + + + + + int cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD + __data) + + + This interrupt handler, called from the spurious interrupt + vector, is specifically for dealing with + Ctrl-C interrupts from GDB. When called + this function should do the following: + + + Check for an incoming character. The code here is very + similar to that in + cyg_hal_plf_serial_getc_nonblock(). + + + + + Read the character and call + cyg_hal_is_break(). + + + + + If result is true, set *__ctrlc to + 1. + + + + + Return CYG_ISR_HANDLED. + + + + + + + + + void cyg_hal_plf_serial_init() + + + Initialize each of the serial channels. + First call cyg_hal_plf_serial_init_channel() for each channel. + Then call the CYGACC_COMM_IF_* macros for + each channel. This latter set of calls are identical for all + channels, so the best way to do this is to copy and edit an + existing example. + + + + + +
+ + + +
+ + + + +
+Variant HAL Porting + + +A variant port can be a fairly limited job, but can also +require quite a lot of work. A variant HAL describes how a specific +CPU variant differs from the generic CPU architecture. The variant HAL +can re-define cache, MMU, interrupt, and other features which override +the default implementation provided by the architecture HAL. + + + +Doing a variant port requires a preexisting architecture HAL port. It +is also likely that a platform port will have to be done at the same +time if it is to be tested. + + + + +
+HAL Variant Porting Process + +The easiest way to make a new variant HAL is simply to copy an +existing variant HAL and change all the files to match the new +variant. If this is the first variant for an architecture, it may be +hard to decide which parts should be put in the variant - knowledge of +other variants of the architecture is required. + +Looking at existing variant HALs (e.g., MIPS tx39, tx49) may be a +help - usually things such as caching, interrupt and exception +handling differ between variants. Initialization code, and code for +handling various core components (FPU, DSP, MMU, etc.) may also differ +or be missing altogether on some variants. Linker scripts may also require +specific variant versions. + + +Note +Some CPU variants may require specific compiler +support. That support must be in place before you can undertake the +eCos variant port. + + + + +
+ + + + +
+HAL Variant CDL + + +The CDL in a variant HAL tends to depend on the exact functionality +supported by the variant. If it implements some of the devices +described in the platform HAL, then the CDL for those will be here +rather than there (for example the real-time clock). + + + +There may also be CDL to select options in the architecture HAL to +configure it to a particular architectural variant. + + + +Each variant needs an entry in the ecos.db +file. This is the one for the SH3: + + + +package CYGPKG_HAL_SH_SH3 { + alias { "SH3 architecture" hal_sh_sh3 } + directory hal/sh/sh3 + script hal_sh_sh3.cdl + hardware + description " + The SH3 (SuperH 3) variant HAL package provides generic + support for SH3 variant CPUs." +} + + + +As you can see, it is very similar to the platform entry. + + + +The variant CDL file will contain a package entry named for the +architecture and variant, matching the package name in the +ecos.db file. Here is the initial part of the +MIPS VR4300 CDL file: + + + +cdl_package CYGPKG_HAL_MIPS_VR4300 { + display "VR4300 variant" + parent CYGPKG_HAL_MIPS + implements CYGINT_HAL_MIPS_VARIANT + hardware + include_dir cyg/hal + define_header hal_mips_vr4300.h + description " + The VR4300 variant HAL package provides generic support + for this processor architecture. It is also necessary to + select a specific target platform HAL package." + + + +This defines the package, placing it under the MIPS architecture +package in the hierarchy. The implements line +indicates that this is a MIPS variant. The architecture package uses +this to check that exactly one variant is configured in. + + + +The variant defines some options that cause the architecture HAL to +configure itself to support this variant. + + + + cdl_option CYGHWR_HAL_MIPS_64BIT { + display "Variant 64 bit architecture support" + calculated 1 + } + + cdl_option CYGHWR_HAL_MIPS_FPU { + display "Variant FPU support" + calculated 1 + } + + cdl_option CYGHWR_HAL_MIPS_FPU_64BIT { + display "Variant 64 bit FPU support" + calculated 1 + } + + + +These tell the architecture that this is a 64 bit MIPS architecture, +that it has a floating point unit, and that we are going to use it in +64 bit mode rather than 32 bit mode. + + + +The CDL file finishes off with some build options. + + + + define_proc { + puts $::cdl_header "#include <pkgconf/hal_mips.h>" + } + + compile var_misc.c + + make { + <PREFIX>/lib/target.ld: <PACKAGE>/src/mips_vr4300.ld + $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 target.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm target.tmp + } + + cdl_option CYGBLD_LINKER_SCRIPT { + display "Linker script" + flavor data + no_define + calculated { "src/mips_vr4300.ld" } + } + +} + + + +The define_proc causes the architecture +configuration file to be included into the configuration file for the +variant. The compile causes the single source file +for this variant, var_misc.c to be compiled. The +make command emits makefile rules to combine the +linker script with the .ldi file to generate +target.ld. Finally, in the MIPS HALs, the main +linker script is defined in the variant, rather than the architecture, +so CYGBLD_LINKER_SCRIPT is defined here. + + +
+ + + + +
+Cache Support + + +The main area where the variant is likely to be involved is in cache +support. Often the only thing that distinguishes one CPU variant from +another is the size of its caches. + + + +In architectures such as the MIPS and PowerPC where cache instructions +are part of the ISA, most of the actual cache operations are +implemented in the architecture HAL. In this case the variant HAL only +needs to define the cache dimensions. The following are the cache +dimensions defined in the MIPS VR4300 variant +var_cache.h. + + + +// Data cache +#define HAL_DCACHE_SIZE (8*1024) // Size of data cache in bytes +#define HAL_DCACHE_LINE_SIZE 16 // Size of a data cache line +#define HAL_DCACHE_WAYS 1 // Associativity of the cache + +// Instruction cache +#define HAL_ICACHE_SIZE (16*1024) // Size of cache in bytes +#define HAL_ICACHE_LINE_SIZE 32 // Size of a cache line +#define HAL_ICACHE_WAYS 1 // Associativity of the cache + +#define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS)) +#define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS)) + + + +Additional cache macros, or overrides for the defaults, may also +appear in here. While some architectures have instructions for +managing cache lines, overall enable/disable operations may be handled +via variant specific registers. If so then +var_cache.h should also define the +HAL_XCACHE_ENABLE() and +HAL_XCACHE_DISABLE() macros. + + + +If there are any generic features that the variant does not support +(cache locking is a typical example) then +var_cache.h may need to disable definitions of +certain operations. It is architecture dependent exactly how this is +done. + + + +
+ + + +
+ + + + +
+ +Architecture HAL Porting + + +A new architecture HAL is the most complex HAL to write, and it the +least easily described. Hence this section is presently nothing more +than a place holder for the future. + + + + +
+HAL Architecture Porting Process + +The easiest way to make a new architecture HAL is simply to copy an +existing architecture HAL of an, if possible, closely matching +architecture and change all the files to match the new +architecture. The MIPS architecture HAL should be used if possible, as +it has the appropriate layout and coding conventions. Other HALs +may deviate from that norm in various ways. + + +Note + eCos is written for GCC. It requires C and C++ +compiler support as well as a few compiler features introduced during +eCos development - so compilers older than eCos may not provide these +features. Note that there is no C++ support for any 8 or 16 bit +CPUs. Before you can undertake an eCos port, you need the required +compiler support. + + + + +The following gives a rough outline of the steps needed to create a +new architecture HAL. The exact order and set of steps needed will +vary greatly from architecture to architecture, so a lot of +flexibility is required. And of course, if the architecture HAL is to +be tested, it is necessary to do variant and platform ports for the +initial target simultaneously. + + + + + + +Make a new directory for the new architecture under the +hal directory in the source repository. Make an +arch directory under this and populate this with +the standard set of package directories. + + + + + +Copy the CDL file from an example HAL changing its name to match the +new HAL. Edit the file, changing option names as appropriate. Delete +any options that are specific to the original HAL, and and any new +options that are necessary for the new architecture. This is likely to +be a continuing process during the development of the HAL. See for more details. + + + + + +Copy the hal_arch.h file from an example +HAL. Within this file you need to change or define the following: + + + + + +Define the HAL_SavedRegisters structure. This +may need to reflect the save order of any group register save/restore +instructions, the interrupt and exception save and restore formats, +and the procedure calling conventions. It may also need to cater for +optional FPUs and other functional units. It can be quite difficult to +develop a layout that copes with all requirements. + + + + + +Define the bit manipulation routines, +HAL_LSBIT_INDEX() and +HAL_MSBIT_INDEX(). If the architecture contains +instructions to perform these, or related, operations, then these +should be defined as inline assembler fragments. Otherwise make them +calls to functions. + + + + + +Define HAL_THREAD_INIT_CONTEXT(). This initializes +a restorable CPU context onto a stack pointer so that a later call to +HAL_THREAD_LOAD_CONTEXT() or +HAL_THREAD_SWITCH_CONTEXT() will execute it +correctly. This macro needs to take account of the same optional +features of the architecture as the definition of +HAL_SavedRegisters. + + + + + +Define HAL_THREAD_LOAD_CONTEXT() and +HAL_THREAD_SWITCH_CONTEXT(). These should just be +calls to functions in context.S. + + + + + +Define HAL_REORDER_BARRIER(). This prevents code +being moved by the compiler and is necessary in some order-sensitive +code. This macro is actually defined identically in all architecture, +so it can just be copied. + + + + + +Define breakpoint support. The macro +HAL_BREAKPOINT(label) needs to be an inline assembly +fragment that invokes a breakpoint. The breakpoint instruction should +be labeled with the label +argument. HAL_BREAKINST and +HAL_BREAKINST_SIZE define the breakpoint +instruction for debugging purposes. + + + + + +Define GDB support. GDB views the registers of the target as a linear +array, with each register having a well defined offset. This array may +differ from the ordering defined in +HAL_SavedRegisters. The macros +HAL_GET_GDB_REGISTERS() and +HAL_SET_GDB_REGISTERS() translate between the GDB +array and the HAL_SavedRegisters structure. +The HAL_THREAD_GET_SAVED_REGISTERS() translates a +stack pointer saved by the context switch macros into a pointer to a +HAL_SavedRegisters structure. Usually this is +a one-to-one translation, but this macro allows it to differ if +necessary. + + + + + +Define long jump support. The type hal_jmp_buf and the +functions hal_setjmp() and +hal_longjmp() provide the underlying implementation +of the C library setjmp() and +longjmp(). + + + + + +Define idle thread action. Generally the macro +HAL_IDLE_THREAD_ACTION() is defined to call a +function in hal_misc.c. + + + + + +Define stack sizes. The macros +CYGNUM_HAL_STACK_SIZE_MINIMUM and +CYGNUM_HAL_STACK_SIZE_TYPICAL should be defined to +the minimum size for any thread stack and a reasonable default for +most threads respectively. It is usually best to construct these out +of component sizes for the CPU save state and procedure call stack +usage. These definitions should not use anything other than numerical +values since they can be used from assembly code in some HALs. + + + + + +Define memory access macros. These macros provide translation between +cached and uncached and physical memory spaces. They usually consist +of masking out bits of the supplied address and ORing in alternative +address bits. + + + + + +Define global pointer save/restore macros. These really only need +defining if the calling conventions of the architecture require a +global pointer (as does the MIPS architecture), they may be empty +otherwise. If it is necessary to define these, then take a look at the +MIPS implementation for an example. + + + + + + + + + +Copy hal_intr.h from an example HAL. Within this +file you should change or define the following: + + + + + + +Define the exception vectors. These should be detailed in the +architecture specification. Essentially for each exception entry point +defined by the architecture there should be an entry in the VSR +table. The offsets of these VSR table entries should be defined here +by CYGNUM_HAL_VECTOR_* definitions. The size of the +VSR table also needs to be defined here. + + + + + +Map any hardware exceptions to standard names. There is a group of +exception vector name of the form +CYGNUM_HAL_EXCEPTION_* that define a wide variety +of possible exceptions that many architectures raise. Generic code +detects whether the architecture can raise a given exception by +testing whether a given CYGNUM_HAL_EXCEPTION_* +definition is present. If it is present then its value is the vector +that raises that exception. This does not need to be a one-to-one +correspondence, and several CYGNUM_HAL_EXCEPTION_* +definitions may have the same value. + + + +Interrupt vectors are usually defined in the variant or platform +HALs. The interrupt number space may either be continuous with the VSR +number space, where they share a vector table (as in the i386) or may +be a separate space where a separate decode stage is used (as in MIPS +or PowerPC). + + + + + + +Declare any static data used by the HAL to handle interrupts and +exceptions. This is usually three vectors for interrupts: +hal_interrupt_handlers[], +hal_interrupt_data[] and +hal_interrupt_objects[], which are sized according +to the interrupt vector definitions. In addition a definition for the +VSR table, hal_vsr_table[] should be made. These +vectors are normally defined in either vectors.S +or hal_misc.c. + + + + + +Define interrupt enable/disable macros. These are normally inline +assembly fragments to execute the instructions, or manipulate the CPU +register, that contains the CPU interrupt enable bit. + + + + + +A feature that many HALs support is the ability to execute DSRs on the +interrupt stack. This is not an essential feature, and is better left +unimplemented in the initial porting effort. If this is required, then +the macro HAL_INTERRUPT_STACK_CALL_PENDING_DSRS() +should be defined to call a function in +vectors.S. + + + + + +Define the interrupt and VSR attachment macros. If the same arrays as +for other HALs have been used for VSR and interrupt vectors, then +these macro can be copied across unchanged. + + + + + + + + + +A number of other header files also need to be filled in: + + + + +basetype.h. This file defines the basic types +used by eCos, together with the endianness and some other +characteristics. This file only really needs to contain definitions +if the architecture differs significantly from the defaults defined +in cyg_type.h + + + + + +hal_io.h. This file contains macros for accessing +device IO registers. If the architecture uses memory mapped IO, then +these can be copied unchanged from an existing HAL such as MIPS. If +the architecture uses special IO instructions, then these macros must +be defined as inline assembler fragments. See the I386 HAL for an +example. PCI bus access macros are usually defined in the variant or +platform HALs. + + + + + +hal_cache.h. This file contains cache access +macros. If the architecture defines cache instructions, or control +registers, then the access macros should be defined here. Otherwise +they must be defined in the variant or platform HAL. Usually the cache +dimensions (total size, line size, ways etc.) are defined in the +variant HAL. + + + + + +arch.inc and +<architecture>.inc. These files are +assembler headers used by vectors.S and +context.S. +<architecture>.inc is a general purpose +header that should contain things like register aliases, ABI +definitions and macros useful to general assembly +code. If there are no such definitions, then this file need not be +provided. arch.inc contains macros for performing +various eCos related operations such as initializing the CPU, caches, +FPU etc. The definitions here may often be configured or overridden by +definitions in the variant or platform HALs. See the MIPS HAL for an +example of this. + + + + + + + + + +Write vectors.S. This is the most important file +in the HAL. It contains the CPU initialization code, exception and +interrupt handlers. While other HALs should be consulted for +structures and techniques, there is very little here that can be +copied over without major edits. + + + +The main pieces of code that need to be defined here are: + + + + + +Reset vector. This usually need to be positioned at the start of the +ROM or FLASH, so should be in a linker section of its own. It can then be +placed correctly by the linker script. Normally this code is little +more than a jump to the label _start. + + + + + +Exception vectors. These are the trampoline routines connected to the +hardware exception entry points that vector through the VSR table. In +many architectures these are adjacent to the reset vector, and should +occupy the same linker section. If the architecture allow the vectors +to be moved then it may be necessary for these trampolines to be +position independent so they can be relocated at runtime. + + + +The trampolines should do the minimum necessary to transfer control +from the hardware vector to the VSR pointed to by the matching table +entry. Exactly how this is done depends on the architecture. Usually +the trampoline needs to get some working registers by either saving +them to CPU special registers (e.g. PowerPC SPRs), using reserved +general registers (MIPS K0 and K1), using only memory based +operations (IA32), or just jumping directly (ARM). The VSR table index +to be used is either implicit in the entry point taken (PowerPC, IA32, +ARM), or must be determined from a CPU register (MIPS). + + + + + +Write kernel startup code. This is the location the reset vector jumps +to, and can be in the main text section of the executable, rather than +a special section. The code here should first initialize the CPU and other +hardware subsystems. The best approach is to use a set of macro +calls that are defined either in arch.inc or +overridden in the variant or platform HALs. Other jobs that this code +should do are: initialize stack pointer; copy the data section from +ROM to RAM if necessary; zero the BSS; call variant and platform +initializers; call cyg_hal_invoke_constructors(); +call initialize_stub() if necessary. Finally it +should call cyg_start(). See for details. + + + + + +Write the default exception VSR. This VSR is installed in the VSR +table for all synchronous exception vectors. See for details of +what this VSR does. + + + + + +Write the default interrupt VSR. This is installed in all VSR table +entries that correspond to external interrupts. See for details of +what this VSR does. + + + + + +Write +hal_interrupt_stack_call_pending_dsrs(). If this +function is defined in hal_arch.h then it should +appear here. The purpose of this function is to call DSRs on the +interrupt stack rather than the current thread's stack. This is not an +essential feature, and may be left until later. However it interacts +with the stack switching that goes on in the interrupt VSR, so it may +make sense to write these pieces of code at the same time to ensure +consistency. + + + +When this function is implemented it should do the following: + + + + + +Take a copy of the current SP and then switch to the interrupt stack. + + + + + +Save the old SP, together with the CPU status register (or whatever +register contains the interrupt enable status) and any other +registers that may be corrupted by a function call (such as any link +register) to locations in the interrupt stack. + + + + + +Enable interrupts. + + + + + +Call cyg_interrupt_call_pending_DSRs(). This is a +kernel functions that actually calls any pending DSRs. + + + + + +Retrieve saved registers from the interrupt stack and switch back to +the current thread stack. + + + + + +Merge the interrupt enable state recorded in the save CPU status +register with the current value of the status register to restore the +previous enable state. If the status register does not contain any +other persistent state then this can be a simple restore of the +register. However if the register contains other state bits that might +have been changed by a DSR, then care must be taken not to disturb +these. + + + + + + + + + + +Define any data items needed. Typically vectors.S +may contain definitions for the VSR table, the interrupt tables and the +interrupt stack. Sometimes these are only default definitions that may +be overridden by the variant or platform HALs. + + + + + + + + + +Write context.S. This file contains the context +switch code. See for details of +how these functions operate. This file may also contain the +implementation of hal_setjmp() and +hal_longjmp(). + + + + + +Write hal_misc.c. This file contains any C +data and functions needed by the HAL. These might include: + + + + + +hal_interrupt_*[]. In some HALs, if these arrays +are not defined in vectors.S then they must be +defined here. + + + + + +cyg_hal_exception_handler(). This function is +called from the exception VSR. It usually does extra decoding of the +exception and invokes any special handlers for things like FPU traps, +bus errors or memory exceptions. If there is nothing special to be +done for an exception, then it either calls into the GDB stubs, by +calling __handle_exception(), or +invokes the kernel by calling +cyg_hal_deliver_exception(). + + + + + +hal_arch_default_isr(). The +hal_interrupt_handlers[] array is usually +initialized with pointers to hal_default_isr(), +which is defined in the common HAL. This function handles things like +Ctrl-C processing, but if that is not relevant, then it will call +hal_arch_default_isr(). Normally this function +should just return zero. + + + + + +cyg_hal_invoke_constructors(). This calls the +constructors for all static objects before the program starts. eCos +relies on these being called in the correct order for it to function +correctly. The exact way in which constructors are handled may differ +between architectures, although most use a simple table of function +pointers between labels __CTOR_LIST__ and +__CTOR_END__ which must called in order from the +top down. Generally, this function can be copied directly from an +existing architecture HAL. + + + + + +Bit indexing functions. If the macros +HAL_LSBIT_INDEX() and +HAL_MSBIT_INDEX() are defined as function calls, +then the functions should appear here. The main reason for doing this +is that the architecture does not have support for bit indexing and +these functions must provide the functionality by conventional +means. While the trivial implementation is a simple for loop, it is +expensive and non-deterministic. Better, constant time, +implementations can be found in several HALs (MIPS for example). + + + + + +hal_delay_us(). If the macro +HAL_DELAY_US() is defined in hal_intr.h then it should be defined to +call this function. While most of the time this function is called +with very small values, occasionally (particularly in some ethernet +drivers) it is called with values of several seconds. Hence the +function should take care to avoid overflow in any calculations. + + + + + +hal_idle_thread_action(). This function is called +from the idle thread via the +HAL_IDLE_THREAD_ACTION() macro, if so +defined. While normally this function does nothing, during development +this is often a good place to report various important system +parameters on LCDs, LED or other displays. This function can also +monitor system state and report any anomalies. If the architecture +supports a halt instruction then this is a good +place to put an inline assembly fragment to execute it. It is also a +good place to handle any power saving activity. + + + + + + + + +Create the <architecture>.ld file. While +this file may need to be moved to the variant HAL in the future, it +should initially be defined here, and only moved if necessary. + + +This file defines a set of macros that are used by the platform +.ldi files to generate linker scripts. Most GCC +toolchains are very similar so the correct approach is to copy the +file from an existing architecture and edit it. The main things that +will need editing are the OUTPUT_FORMAT() directive +and maybe the creation or allocation of extra sections to various +macros. Running the target linker with just the +--verbose argument will cause it to output its +default linker script. This can be compared with the +.ld file and appropriate edits made. + + + + + +If GDB stubs are to be supported in RedBoot or eCos, then support must +be included for these. The most important of these are include/<architecture>-stub.h and +src/<architecture>-stub.c. In all existing +architecture HALs these files, and any support files they need, have +been derived from files supplied in libgloss, as +part of the GDB toolchain package. If this is a totally new +architecture, this may not have been done, and they must be created +from scratch. + + + +include/<architecture>-stub.h +contains definitions that are used by the GDB stubs to describe the +size, type, number and names of CPU registers. This information is +usually found in the GDB support files for the architecture. It also +contains prototypes for the functions exported by +src/<architecture>-stub.c; however, since +this is common to all architectures, it can be copied from some other +HAL. + + + +src/<architecture>-stub.c implements the +functions exported by the header. Most of this is fairly straight +forward: the implementation in existing HALs should show exactly what +needs to be done. The only complex part is the support for +single-stepping. This is used a lot by GDB, so it cannot be +avoided. If the architecture has support for a trace or single-step +trap then that can be used for this purpose. If it does not then this +must be simulated by planting a breakpoint in the next +instruction. This can be quite involved since it requires some +analysis of the current instruction plus the state of the CPU to +determine where execution is going to go next. + + + + + + + +
+ + + + +
+CDL Requirements + + +The CDL needed for any particular architecture HAL depends to a large +extent on the needs of that architecture. This includes issues such as +support for different variants, use of FPUs, MMUs and caches. The +exact split between the architecture, variant and platform HALs for +various features is also somewhat fluid. + + + +To give a rough idea about how the CDL for an architecture is +structured, we will take as an example the I386 CDL. + + + +This first section introduces the CDL package and placed it under the +main HAL package. Include files from this package will be put in the +include/cyg/hal directory, and definitions from +this file will be placed in +include/pkgconf/hal_i386.h. The +compile line specifies the files in the +src directory that are to be compiled as part of +this package. + + + +cdl_package CYGPKG_HAL_I386 { + display "i386 architecture" + parent CYGPKG_HAL + hardware + include_dir cyg/hal + define_header hal_i386.h + description " + The i386 architecture HAL package provides generic + support for this processor architecture. It is also + necessary to select a specific target platform HAL + package." + + compile hal_misc.c context.S i386_stub.c hal_syscall.c + + + +Next we need to generate some files using non-standard make rules. The +first is vectors.S, which is not put into the +library, but linked explicitly with all applications. The second is +the generation of the target.ld file from +i386.ld and the startup-selected +.ldi file. Both of these are essentially +boilerplate code that can be copied and edited. + + + + + make { + <PREFIX>/lib/vectors.o : <PACKAGE>/src/vectors.S + $(CC) -Wp,-MD,vectors.tmp $(INCLUDE_PATH) $(CFLAGS) -c -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 vectors.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm vectors.tmp + } + + make { + <PREFIX>/lib/target.ld: <PACKAGE>/src/i386.ld + $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 target.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm target.tmp + } + + + +The i386 is currently the only architecture that supports SMP. The +following CDL simply enabled the HAL SMP support if +required. Generally this will get enabled as a result of a +requires statement in the kernel. The +requires statement here turns off lazy FPU +switching in the FPU support code, since it is inconsistent with SMP +operation. + + + + + cdl_component CYGPKG_HAL_SMP_SUPPORT { + display "SMP support" + default_value 0 + requires { CYGHWR_HAL_I386_FPU_SWITCH_LAZY == 0 } + + cdl_option CYGPKG_HAL_SMP_CPU_MAX { + display "Max number of CPUs supported" + flavor data + default_value 2 + } + } + + + +The i386 HAL has optional FPU support, which is enabled by default. It +can be disabled to improve system performance. There are two FPU +support options: either to save and restore the FPU state on every +context switch, or to only switch the FPU state when necessary. + + + + + cdl_component CYGHWR_HAL_I386_FPU { + display "Enable I386 FPU support" + default_value 1 + description "This component enables support for the + I386 floating point unit." + + cdl_option CYGHWR_HAL_I386_FPU_SWITCH_LAZY { + display "Use lazy FPU state switching" + flavor bool + default_value 1 + + description " + This option enables lazy FPU state switching. + The default behaviour for eCos is to save and + restore FPU state on every thread switch, interrupt + and exception. While simple and deterministic, this + approach can be expensive if the FPU is not used by + all threads. The alternative, enabled by this option, + is to use hardware features that allow the FPU state + of a thread to be left in the FPU after it has been + descheduled, and to allow the state to be switched to + a new thread only if it actually uses the FPU. Where + only one or two threads use the FPU this can avoid a + lot of unnecessary state switching." + } + } + + + +The i386 HAL also has support for different classes of CPU. In +particular, Pentium class CPUs have extra functional units, and some +variants of GDB expect more registers to be reported. These options +enable these features. Generally these are enabled by +requires statements in variant or platform +packages, or in .ecm files. + + + + + cdl_component CYGHWR_HAL_I386_PENTIUM { + display "Enable Pentium class CPU features" + default_value 0 + description "This component enables support for various + features of Pentium class CPUs." + + cdl_option CYGHWR_HAL_I386_PENTIUM_SSE { + display "Save/Restore SSE registers on context switch" + flavor bool + default_value 0 + + description " + This option enables SSE state switching. The default + behaviour for eCos is to ignore the SSE registers. + Enabling this option adds SSE state information to + every thread context." + } + + cdl_option CYGHWR_HAL_I386_PENTIUM_GDB_REGS { + display "Support extra Pentium registers in GDB stub" + flavor bool + default_value 0 + + description " + This option enables support for extra Pentium registers + in the GDB stub. These are registers such as CR0-CR4, and + all MSRs. Not all GDBs support these registers, so the + default behaviour for eCos is to not include them in the + GDB stub support code." + } + } + + + +In the i386 HALs, the linker script is provided by the architecture +HAL. In other HALs, for example MIPS, it is provided in the variant +HAL. The following option provides the name of the linker script to +other elements in the configuration system. + + + + cdl_option CYGBLD_LINKER_SCRIPT { + display "Linker script" + flavor data + no_define + calculated { "src/i386.ld" } + } + + + +Finally, this interface indicates whether the platform supplied an +implementation of the +hal_i386_mem_real_region_top() function. If it +does then it will contain a line of the form: implements +CYGINT_HAL_I386_MEM_REAL_REGION_TOP. This allows packages +such as RedBoot to detect the presence of this function so that they +may call it. + + + + + cdl_interface CYGINT_HAL_I386_MEM_REAL_REGION_TOP { + display "Implementations of hal_i386_mem_real_region_top()" + } + +} + + +
+ + + + + +
+ + + +
+ + + + diff --git a/packages/hal/common/current/include/dbg-thread-syscall.h b/packages/hal/common/current/include/dbg-thread-syscall.h --- a/packages/hal/common/current/include/dbg-thread-syscall.h +++ b/packages/hal/common/current/include/dbg-thread-syscall.h @@ -5,29 +5,38 @@ // Supports thread-aware debugging // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/include/dbg-threads-api.h b/packages/hal/common/current/include/dbg-threads-api.h --- a/packages/hal/common/current/include/dbg-threads-api.h +++ b/packages/hal/common/current/include/dbg-threads-api.h @@ -5,29 +5,38 @@ // Supports thread-aware debugging // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/include/drv_api.h b/packages/hal/common/current/include/drv_api.h --- a/packages/hal/common/current/include/drv_api.h +++ b/packages/hal/common/current/include/drv_api.h @@ -8,29 +8,38 @@ // Native API for Kernel // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -64,60 +73,62 @@ #include -#define cyg_drv_isr_lock cyg_interrupt_disable -#define cyg_drv_isr_unlock cyg_interrupt_enable - -#define cyg_drv_dsr_lock cyg_scheduler_lock -#define cyg_drv_dsr_unlock cyg_scheduler_unlock - -#define cyg_drv_mutex_t cyg_mutex_t -#define cyg_drv_mutex_init cyg_mutex_init -#define cyg_drv_mutex_destroy cyg_mutex_destroy -#define cyg_drv_mutex_lock cyg_mutex_lock -#define cyg_drv_mutex_trylock cyg_mutex_trylock -#define cyg_drv_mutex_unlock cyg_mutex_unlock -#define cyg_drv_mutex_release cyg_mutex_release - -#define cyg_drv_cond_t cyg_cond_t -#define cyg_drv_cond_init cyg_cond_init -#define cyg_drv_cond_destroy cyg_cond_destroy -#define cyg_drv_cond_wait cyg_cond_wait -#define cyg_drv_cond_signal cyg_cond_signal -#define cyg_drv_cond_broadcast cyg_cond_broadcast - -#define cyg_drv_interrupt_create cyg_interrupt_create -#define cyg_drv_interrupt_delete cyg_interrupt_delete -#define cyg_drv_interrupt_attach cyg_interrupt_attach -#define cyg_drv_interrupt_detach cyg_interrupt_detach -#define cyg_drv_interrupt_mask cyg_interrupt_mask -#define cyg_drv_interrupt_unmask cyg_interrupt_unmask -#define cyg_drv_interrupt_acknowledge cyg_interrupt_acknowledge -#define cyg_drv_interrupt_configure cyg_interrupt_configure -#define cyg_drv_interrupt_level cyg_interrupt_level -#define cyg_drv_interrupt_set_cpu cyg_interrupt_set_cpu -#define cyg_drv_interrupt_get_cpu cyg_interrupt_get_cpu - -#define cyg_drv_spinlock_t cyg_spinlock_t -#define cyg_drv_spinlock_init cyg_spinlock_init -#define cyg_drv_spinlock_spin cyg_spinlock_spin -#define cyg_drv_spinlock_clear cyg_spinlock_clear -#define cyg_drv_spinlock_try cyg_spinlock_try -#define cyg_drv_spinlock_test cyg_spinlock_test -#define cyg_drv_spinlock_spin_intsave cyg_spinlock_spin_intsave -#define cyg_drv_spinlock_clear_intsave cyg_spinlock_clear_intsave +#define cyg_drv_isr_lock cyg_interrupt_disable +#define cyg_drv_isr_unlock cyg_interrupt_enable + +#define cyg_drv_dsr_lock cyg_scheduler_lock +#define cyg_drv_dsr_unlock cyg_scheduler_unlock + +#define cyg_drv_mutex_t cyg_mutex_t +#define cyg_drv_mutex_init cyg_mutex_init +#define cyg_drv_mutex_destroy cyg_mutex_destroy +#define cyg_drv_mutex_lock cyg_mutex_lock +#define cyg_drv_mutex_trylock cyg_mutex_trylock +#define cyg_drv_mutex_unlock cyg_mutex_unlock +#define cyg_drv_mutex_release cyg_mutex_release + +#define cyg_drv_cond_t cyg_cond_t +#define cyg_drv_cond_init cyg_cond_init +#define cyg_drv_cond_destroy cyg_cond_destroy +#define cyg_drv_cond_wait cyg_cond_wait +#define cyg_drv_cond_signal cyg_cond_signal +#define cyg_drv_cond_broadcast cyg_cond_broadcast + +#define cyg_drv_interrupt_create cyg_interrupt_create +#define cyg_drv_interrupt_delete cyg_interrupt_delete +#define cyg_drv_interrupt_attach cyg_interrupt_attach +#define cyg_drv_interrupt_detach cyg_interrupt_detach +#define cyg_drv_interrupt_mask cyg_interrupt_mask +#define cyg_drv_interrupt_unmask cyg_interrupt_unmask +#define cyg_drv_interrupt_mask_intunsafe cyg_interrupt_mask_intunsafe +#define cyg_drv_interrupt_unmask_intunsafe cyg_interrupt_unmask_intunsafe +#define cyg_drv_interrupt_acknowledge cyg_interrupt_acknowledge +#define cyg_drv_interrupt_configure cyg_interrupt_configure +#define cyg_drv_interrupt_level cyg_interrupt_level +#define cyg_drv_interrupt_set_cpu cyg_interrupt_set_cpu +#define cyg_drv_interrupt_get_cpu cyg_interrupt_get_cpu + +#define cyg_drv_spinlock_t cyg_spinlock_t +#define cyg_drv_spinlock_init cyg_spinlock_init +#define cyg_drv_spinlock_spin cyg_spinlock_spin +#define cyg_drv_spinlock_clear cyg_spinlock_clear +#define cyg_drv_spinlock_try cyg_spinlock_try +#define cyg_drv_spinlock_test cyg_spinlock_test +#define cyg_drv_spinlock_spin_intsave cyg_spinlock_spin_intsave +#define cyg_drv_spinlock_clear_intsave cyg_spinlock_clear_intsave #else /* CYGPKG_KERNEL */ /*------------------------------------------------------------------------*/ /* Non-kernel version of API */ - + typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */ typedef cyg_addrword_t cyg_handle_t; /* Object handle */ typedef cyg_uint32 cyg_priority_t; /* type for priorities */ typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */ typedef cyg_uint32 cyg_cpu_t; /* CPU id */ -typedef int cyg_bool_t; -typedef cyg_int32 cyg_code_t; /* type for various codes */ +typedef int cyg_bool_t; +typedef cyg_int32 cyg_code_t; /* type for various codes */ typedef cyg_uint32 cyg_ISR_t( cyg_vector_t vector, cyg_addrword_t data); typedef void cyg_DSR_t(cyg_vector_t vector, @@ -186,7 +197,9 @@ externC void cyg_drv_interrupt_attach( c externC void cyg_drv_interrupt_detach( cyg_handle_t interrupt ); externC void cyg_drv_interrupt_mask( cyg_vector_t vector ); +externC void cyg_drv_interrupt_mask_intunsafe( cyg_vector_t vector ); externC void cyg_drv_interrupt_unmask( cyg_vector_t vector ); +externC void cyg_drv_interrupt_unmask_intunsafe( cyg_vector_t vector ); externC void cyg_drv_interrupt_acknowledge( cyg_vector_t vector ); externC void cyg_drv_interrupt_configure( cyg_vector_t vector, diff --git a/packages/hal/common/current/include/generic-stub.h b/packages/hal/common/current/include/generic-stub.h --- a/packages/hal/common/current/include/generic-stub.h +++ b/packages/hal/common/current/include/generic-stub.h @@ -5,29 +5,38 @@ // Definitions for the generic GDB remote stub // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // @@ -295,6 +304,10 @@ extern char **__get_program_args (target as necessary. */ extern void __putpacket (char *packet); +/* Retrieve the next remote protocol packet from GDB, taking care of verifying + the checksum and sending an ACK when necessary. */ +extern void __getpacket (char *buffer); + /* Convert the hexadecimal string pointed to by *PTR into an integer, and store it in the value pointed to by INTVALUE. The number of characters read from *PTR will be returned; *PTR will point to the first diff --git a/packages/hal/common/current/include/hal_arbiter.h b/packages/hal/common/current/include/hal_arbiter.h --- a/packages/hal/common/current/include/hal_arbiter.h +++ b/packages/hal/common/current/include/hal_arbiter.h @@ -8,29 +8,38 @@ // Functionality used by ISR arbiters // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/include/hal_endian.h b/packages/hal/common/current/include/hal_endian.h --- a/packages/hal/common/current/include/hal_endian.h +++ b/packages/hal/common/current/include/hal_endian.h @@ -8,29 +8,38 @@ // Endian conversion macros // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/include/hal_if.h b/packages/hal/common/current/include/hal_if.h --- a/packages/hal/common/current/include/hal_if.h +++ b/packages/hal/common/current/include/hal_if.h @@ -8,29 +8,38 @@ // HAL header for ROM/RAM calling interface. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -593,6 +602,16 @@ static __inline__ _rt_ hal_virtual_vector_table[CYGNUM_CALL_IF_FLASH_CFG_OP]=(CYG_ADDRWORD)(_x_) #define CYGNUM_CALL_IF_FLASH_CFG_GET (0) +// These need to be kept uptodate with the (unadorned) masters +// in RedBoot's flash_config.h: +#define CYGNUM_FLASH_CFG_OP_CONFIG_EMPTY 0 +#define CYGNUM_FLASH_CFG_OP_CONFIG_BOOL 1 +#define CYGNUM_FLASH_CFG_OP_CONFIG_INT 2 +#define CYGNUM_FLASH_CFG_OP_CONFIG_STRING 3 +#define CYGNUM_FLASH_CFG_OP_CONFIG_SCRIPT 4 +#define CYGNUM_FLASH_CFG_OP_CONFIG_IP 5 +#define CYGNUM_FLASH_CFG_OP_CONFIG_ESA 6 + #endif // CYGACC_CALL_IF_DEFINED //-------------------------------------------------------------------------- diff --git a/packages/hal/common/current/include/hal_misc.h b/packages/hal/common/current/include/hal_misc.h --- a/packages/hal/common/current/include/hal_misc.h +++ b/packages/hal/common/current/include/hal_misc.h @@ -8,29 +8,38 @@ // HAL header for miscellaneous helper routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/include/hal_spd.h b/packages/hal/common/current/include/hal_spd.h new file mode 100644 --- /dev/null +++ b/packages/hal/common/current/include/hal_spd.h @@ -0,0 +1,78 @@ +#ifndef CYGONCE_HAL_HAL_SPD_H +#define CYGONCE_HAL_HAL_SPD_H + +//============================================================================= +// +// hal_spd.h +// +// HAL header for SDRAM Serial Presence Detect support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter +// Date: 2002-01-17 +// Purpose: Generic HAL SPD header. +// Usage: #include +// Description: This header provides byte numbers and bit definitions for +// serial EEPROM containing SDRAM module information. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +// Commonly used bytes +#define SPD_BANKCNT 5 // number of module banks +#define SPD_CONFIG 11 // DIMM configuration type (Parity or not, EEC) +#define SPD_REFRESH 12 // Referesh rate +#define SPD_SDRAM_WIDTH 13 // DRAM width +#define SPD_MOD_ATTRIB 21 // DRAM module attribute +#define SPD_BANKSZ 31 // module bank density +#define SPD_CHECKSUM 63 // checksum for bytes 0-62 + +// SPD_MOD_ATTRIB bits +#define SPD_ATTRIB_BUF_CTL 0x01 // Buffered Addr/Control inputs +#define SPD_ATTRIB_REG_CTL 0x02 // Registered Addr/Control inputs +#define SPD_ATTRIB_PLL 0x04 // On-card PLL +#define SPD_ATTRIB_BUF_DQ 0x08 // Buffered DQMB inputs +#define SPD_ATTRIB_REG_DQ 0x10 // Registered DQMB inputs +#define SPD_ATTRIB_DIFF 0x20 // Differential clock input +#define SPD_ATTRIB_RRA 0x40 // Redundant Row Address + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_HAL_SPD_H +// End of hal_spd.h diff --git a/packages/hal/common/current/include/hal_stub.h b/packages/hal/common/current/include/hal_stub.h --- a/packages/hal/common/current/include/hal_stub.h +++ b/packages/hal/common/current/include/hal_stub.h @@ -8,29 +8,38 @@ // HAL header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -150,6 +159,29 @@ externC void __stub_copy_registers(targe #define TARGET_HAS_OWN_MEM_FUNCS //---------------------------------------------------------------------------- +// Memory access checks. + +#ifndef CYG_HAL_STUB_PERMIT_DATA_READ +#define CYG_HAL_STUB_PERMIT_DATA_READ(_addr_, __count_) (1) +#endif + +#ifndef CYG_HAL_STUB_PERMIT_DATA_WRITE +#define CYG_HAL_STUB_PERMIT_DATA_WRITE(_addr_, __count_) (1) +#endif + +#ifdef TARGET_HAS_HARVARD_MEMORY + +#ifndef CYG_HAL_STUB_PERMIT_CODE_READ +#define CYG_HAL_STUB_PERMIT_CODE_READ(_addr_, __count_) (1) +#endif + +#ifndef CYG_HAL_STUB_PERMIT_CODE_WRITE +#define CYG_HAL_STUB_PERMIT_CODE_WRITE(_addr_, __count_) (1) +#endif + +#endif + +//---------------------------------------------------------------------------- // Target extras?! extern int __process_target_query(char * pkt, char * out, int maxOut); extern int __process_target_set(char * pkt, char * out, int maxout); diff --git a/packages/hal/common/current/include/hal_tables.h b/packages/hal/common/current/include/hal_tables.h --- a/packages/hal/common/current/include/hal_tables.h +++ b/packages/hal/common/current/include/hal_tables.h @@ -8,29 +8,38 @@ // Data table management // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/src/board.h b/packages/hal/common/current/src/board.h --- a/packages/hal/common/current/src/board.h +++ b/packages/hal/common/current/src/board.h @@ -8,29 +8,38 @@ // libstub board.h file for eCos HAL // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/src/bplist-dynamic.c b/packages/hal/common/current/src/bplist-dynamic.c --- a/packages/hal/common/current/src/bplist-dynamic.c +++ b/packages/hal/common/current/src/bplist-dynamic.c @@ -6,29 +6,38 @@ // Currently only statically allocated. (ie NO_MALLOC is assumed) // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/src/dbg-threads-syscall.c b/packages/hal/common/current/src/dbg-threads-syscall.c --- a/packages/hal/common/current/src/dbg-threads-syscall.c +++ b/packages/hal/common/current/src/dbg-threads-syscall.c @@ -5,29 +5,38 @@ // Pseudo system calls for multi-threaded debug support // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/src/drv_api.c b/packages/hal/common/current/src/drv_api.c --- a/packages/hal/common/current/src/drv_api.c +++ b/packages/hal/common/current/src/drv_api.c @@ -5,29 +5,38 @@ // Driver API for non-kernel configurations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -746,9 +755,31 @@ externC void cyg_drv_interrupt_detach( c //-------------------------------------------------------------------------- // Mask delivery of an interrupt at the interrupt controller. +// (Interrupt safe) externC void cyg_drv_interrupt_mask( cyg_vector_t vector ) { + CYG_INTERRUPT_STATE old_ints; + + CYG_REPORT_FUNCTION(); + CYG_REPORT_FUNCARG1("vector=%d", vector); + + CYG_ASSERT( vector >= CYGNUM_HAL_ISR_MIN, "Invalid vector"); + CYG_ASSERT( vector <= CYGNUM_HAL_ISR_MAX, "Invalid vector"); + + HAL_DISABLE_INTERRUPTS(old_ints); + HAL_INTERRUPT_MASK( vector ); + HAL_RESTORE_INTERRUPTS(old_ints); + + CYG_REPORT_RETURN(); +} + +//-------------------------------------------------------------------------- +// Mask delivery of an interrupt at the interrupt controller. +// (Not interrupt safe) + +externC void cyg_drv_interrupt_mask_intunsafe( cyg_vector_t vector ) +{ CYG_REPORT_FUNCTION(); CYG_REPORT_FUNCARG1("vector=%d", vector); @@ -762,10 +793,33 @@ externC void cyg_drv_interrupt_mask( cyg //-------------------------------------------------------------------------- // Unmask delivery of an interrupt at the interrupt controller. +// (Interrupt safe) externC void cyg_drv_interrupt_unmask( cyg_vector_t vector ) { + CYG_INTERRUPT_STATE old_ints; + CYG_REPORT_FUNCTION(); + CYG_REPORT_FUNCARG1("vector=%d", vector); + + CYG_ASSERT( vector >= CYGNUM_HAL_ISR_MIN, "Invalid vector"); + CYG_ASSERT( vector <= CYGNUM_HAL_ISR_MAX, "Invalid vector"); + + HAL_DISABLE_INTERRUPTS(old_ints); + HAL_INTERRUPT_UNMASK( vector ); + HAL_RESTORE_INTERRUPTS(old_ints); + + CYG_REPORT_RETURN(); +} + +//-------------------------------------------------------------------------- +// Unmask delivery of an interrupt at the interrupt controller. +// (Not interrupt safe) + +externC void cyg_drv_interrupt_unmask_intunsafe( cyg_vector_t vector ) +{ + CYG_REPORT_FUNCTION(); + CYG_REPORT_FUNCARG1("vector=%d", vector); CYG_ASSERT( vector >= CYGNUM_HAL_ISR_MIN, "Invalid vector"); CYG_ASSERT( vector <= CYGNUM_HAL_ISR_MAX, "Invalid vector"); diff --git a/packages/hal/common/current/src/dummy.c b/packages/hal/common/current/src/dummy.c --- a/packages/hal/common/current/src/dummy.c +++ b/packages/hal/common/current/src/dummy.c @@ -5,29 +5,38 @@ // Guarantee the existence of libextras.a // //========================================================================== -//###COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/src/gdb-fileio.c b/packages/hal/common/current/src/gdb-fileio.c new file mode 100644 --- /dev/null +++ b/packages/hal/common/current/src/gdb-fileio.c @@ -0,0 +1,729 @@ +/*========================================================================== +// +// gdb-fileio.c +// +// Implementation of File I/O using the GDB remote protocol +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: +// Date: 2002-04-09 +// Purpose: Implementation of File I/O using the GDB remote +// protocol +// Description: 'F' packet requests are of the form: +// F[,]... +// where name is the ASCII syscall name, and the +// parameters are generally included as hex ints, +// in ASCII. +// +//####DESCRIPTIONEND#### +//========================================================================*/ + +/* CONFIGURATION */ + +#include + +/* HEADERS */ + +#include // size_t +#include +#ifdef CYGPKG_ISOINFRA +# include +# include +#endif +#include "board.h" // sets correct definitions for generic stub header +#include +#include "gdb-fileio.h" + +/* TYPES */ + +// this is used by newlib's mode_t so we should match it +#ifdef __GNUC__ +#define _ST_INT32 __attribute__ ((__mode__ (__SI__))) +#else +#define _ST_INT32 +#endif + +typedef int newlib_int_t; +typedef unsigned int newlib_uint_t; +typedef long newlib_long_t; +typedef long newlib_time_t; +typedef unsigned int newlib_mode_t _ST_INT32; +typedef short newlib_dev_t; +typedef unsigned short newlib_uid_t; +typedef unsigned short newlib_gid_t; +typedef unsigned short newlib_ino_t; +typedef unsigned short newlib_nlink_t; +typedef long newlib_off_t; + +struct newlib_timeval { + newlib_time_t tv_sec; + newlib_long_t tv_usec; +}; + +struct newlib_stat +{ + newlib_dev_t st_dev; + newlib_ino_t st_ino; + newlib_mode_t st_mode; + newlib_nlink_t st_nlink; + newlib_uid_t st_uid; + newlib_gid_t st_gid; + newlib_dev_t st_rdev; + newlib_off_t st_size; + // We assume we've been compiled with the same flags as newlib here +#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) + newlib_time_t st_atime; + newlib_time_t st_mtime; + newlib_time_t st_ctime; +#else + newlib_time_t st_atime; + newlib_long_t st_spare1; + newlib_time_t st_mtime; + newlib_long_t st_spare2; + newlib_time_t st_ctime; + newlib_long_t st_spare3; + newlib_long_t st_blksize; + newlib_long_t st_blocks; + newlib_long_t st_spare4[2]; +#endif +}; + +/* EXTERNS */ + +__externC char __remcomInBuffer[]; // from generic-stub.c, for packet data +__externC char __remcomOutBuffer[]; // ditto + +/* STATICS/GLOBALS */ + +static int __fileio_retcode, __fileio_errno; +static cyg_bool __fileio_retcode_set, __fileio_errno_set, __fileio_ctrlc_set; + +/* MACROS */ + +// endian independent conversion functions from big endian protocol types +// to newlib types + +#define GDBFILEIO_FIO_TO_NEWLIB( _f, _n, _ftype ) \ +CYG_MACRO_START \ + char *_cf = (char *)(_f); \ + int _i; \ + char _sign = 0; \ + if (*_cf == '-') { \ + _sign = 1; \ + _cf++; \ + } \ + (_n) = 0; \ + for (_i=0; _i> 8*(sizeof(_ftype)-_i-1)) & 0xff; \ + } \ +CYG_MACRO_END + + +/* FUNCTIONS */ + +#ifndef CYGINT_ISO_STRING_STRFUNCS +static size_t strlen( const char *s ) +{ + size_t retval; + const char *start = s; + while (*s) + s++; + retval = s - start; + return retval; +} +#endif + +static int +chars_to_hex( char *charsin, char *hexout, int bytes ) +{ + int numChars = 0; + int allzero = true; + + while (bytes--) { + if (0 != *charsin) + allzero = false; + *hexout++ = __tohex( (*charsin / 16) & 15 ); + *hexout++ = __tohex( (*charsin++) & 15 ); + numChars += 2; + } + if (allzero) // doesn't matter if we actually set more than needed above + return (numChars > 2 ? 2 : numChars); + return numChars; +} + +static void +gdbfileio_fio_to_newlib_time_t( fio_time_t *f, newlib_time_t *n ) +{ + GDBFILEIO_FIO_TO_NEWLIB( f, *n, fio_time_t ); +} // gdbfileio_fio_to_newlib_time_t() + +static void +gdbfileio_newlib_to_fio_int_t( newlib_int_t *n, fio_int_t *f ) +{ + GDBFILEIO_NEWLIB_TO_FIO( f, *n, fio_int_t ); +} // gdbfileio_newlib_to_fio_int_t() + +static void +gdbfileio_newlib_to_fio_uint_t( newlib_uint_t *n, fio_uint_t *f ) +{ + GDBFILEIO_NEWLIB_TO_FIO( f, *n, fio_uint_t ); +} // gdbfileio_newlib_to_fio_uint_t() + +static void +gdbfileio_fio_to_newlib_long_t( fio_long_t *f, newlib_long_t *n ) +{ + GDBFILEIO_FIO_TO_NEWLIB( f, *n, fio_long_t ); +} // gdbfileio_fio_to_newlib_long_t() + +static void +gdbfileio_newlib_to_fio_long_t( newlib_long_t *n, fio_long_t *f ) +{ + GDBFILEIO_NEWLIB_TO_FIO( f, *n, fio_long_t ); +} // gdbfileio_newlib_to_fio_long_t() + +static void +gdbfileio_fio_to_newlib_mode_t( fio_mode_t *f, newlib_mode_t *n ) +{ + GDBFILEIO_FIO_TO_NEWLIB( f, *n, fio_mode_t ); +} // gdbfileio_fio_to_newlib_mode_t() + +static void +gdbfileio_newlib_to_fio_mode_t( newlib_mode_t *n, fio_mode_t *f ) +{ + GDBFILEIO_NEWLIB_TO_FIO( f, *n, fio_mode_t ); +} // gdbfileio_newlib_to_fio_mode_t() + +static void +gdbfileio_fio_to_newlib_dev_t( fio_uint_t *f, newlib_dev_t *n ) +{ + GDBFILEIO_FIO_TO_NEWLIB( f, *n, fio_uint_t ); +} // gdbfileio_fio_to_newlib_dev_t() + +static void +gdbfileio_fio_to_newlib_ino_t( fio_uint_t *f, newlib_ino_t *n ) +{ + GDBFILEIO_FIO_TO_NEWLIB( f, *n, fio_uint_t ); +} // gdbfileio_fio_to_newlib_ino_t() + +// these defines are good enough for now (to save code size) as they +// are the same functions in practice +#define gdbfileio_fio_to_newlib_nlink_t gdbfileio_fio_to_newlib_ino_t +#define gdbfileio_fio_to_newlib_uid_t gdbfileio_fio_to_newlib_ino_t +#define gdbfileio_fio_to_newlib_gid_t gdbfileio_fio_to_newlib_ino_t +#define gdbfileio_fio_to_newlib_off_t gdbfileio_fio_to_newlib_long_t + + +// this function is commonly used by most functions to handle everything +// once the packet has been constructed. It doesn't have to be used - it's +// just nice to keep this in one place for maintenance reasons. +static int +gdbfileio_common_sendpkt( char *buf, int *sig ) +{ + int status; + + __putpacket( buf ); + + do { + __getpacket( __remcomInBuffer ); + status = __process_packet( __remcomInBuffer ); + } while ( status == 0 ); + + if ( __fileio_ctrlc_set ) + *sig = SIGINT; + if ( !__fileio_retcode_set ) // deal with protocol failure + return -FILEIO_EINVAL; + if ( __fileio_retcode < 0 && __fileio_errno_set ) + return -__fileio_errno; + else + return __fileio_retcode; +} // gdbfileio_common_sendpkt() + +// deal with a received F packet. This is called from __process_packet in +// generic-stub.c +__externC void +cyg_hal_gdbfileio_process_F_packet( char *packet, + char *__remcomOutBuffer ) +{ + // Reply packet structure: + // F[,[,]][;] + + char *p = &packet[1]; + cyg_bool minus = false; + target_register_t temptrt; + + __fileio_retcode_set = __fileio_errno_set = __fileio_ctrlc_set = false; + + if (*p == '-') { + minus = true; + p++; + } + + __hexToInt( &p, &temptrt ); + __fileio_retcode = minus ? -(int)temptrt : (int)temptrt; + __fileio_retcode_set = true; + + if ( *p++ == ',' ) { + // get errno + __hexToInt( &p, &temptrt ); + __fileio_errno = (int)temptrt; + __fileio_errno_set = true; + if ( *p++ == ',' ) { + if ( *p == 'C' ) { + __fileio_ctrlc_set = true; + } + } + } + // ignore anything afterwards (e.g. call specific attachment) for now + +} // cyg_hal_gdbfileio_process_F_packet() + +__externC int +cyg_hal_gdbfileio_open( const char *name, int flags, int mode, int *sig ) +{ + size_t namelen; + unsigned int i=0; + fio_mode_t fmode; + fio_int_t fflags; + + // clear out unsupported flags/modes, as per the spec + flags &= FILEIO_O_SUPPORTED; + mode &= FILEIO_S_SUPPORTED; + + gdbfileio_newlib_to_fio_int_t( &flags, &fflags ); + gdbfileio_newlib_to_fio_mode_t( &mode, &fmode ); + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 'o'; + __remcomOutBuffer[i++] = 'p'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = 'n'; + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)name, + sizeof(name)*8 ); + // i now points after the parameter + __remcomOutBuffer[i++] = '/'; + namelen = strlen( name )+1; // includes '\0' + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)namelen, + sizeof(namelen)*8 ); + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&fflags, &__remcomOutBuffer[i], sizeof(fflags) ); + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&fmode, &__remcomOutBuffer[i], sizeof(fmode) ); + __remcomOutBuffer[i] = 0; + + return gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); +} // cyg_hal_gdbfileio_open() + +__externC int +cyg_hal_gdbfileio_close( int fd, int *sig ) +{ + unsigned int i=0; + fio_int_t ffd; + + gdbfileio_newlib_to_fio_int_t( &fd, &ffd ); + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 'c'; + __remcomOutBuffer[i++] = 'l'; + __remcomOutBuffer[i++] = 'o'; + __remcomOutBuffer[i++] = 's'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&ffd, &__remcomOutBuffer[i], sizeof(ffd) ); + // i now points after the parameter + __remcomOutBuffer[i] = 0; + + return gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); +} // cyg_hal_gdbfileio_close() + +__externC int +cyg_hal_gdbfileio_read( int fd, void *buf, size_t count, int *sig ) +{ + unsigned int i=0; + fio_int_t ffd; + fio_uint_t fcount; + unsigned int uicount = (unsigned int)count; + + gdbfileio_newlib_to_fio_int_t( &fd, &ffd ); + gdbfileio_newlib_to_fio_uint_t( &uicount, &fcount ); + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 'r'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = 'a'; + __remcomOutBuffer[i++] = 'd'; + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&ffd, &__remcomOutBuffer[i], sizeof(ffd) ); + // i now points after the parameter + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)buf, + sizeof(buf)*8 ); + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&fcount, &__remcomOutBuffer[i], sizeof(fcount) ); + __remcomOutBuffer[i] = 0; + + return gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); +} // cyg_hal_gdbfileio_read() + +__externC int +cyg_hal_gdbfileio_write( int fd, const void *buf, size_t count, int *sig ) +{ + unsigned int i=0; + fio_int_t ffd; + fio_uint_t fcount; + unsigned int uicount = (unsigned int)count; + + gdbfileio_newlib_to_fio_int_t( &fd, &ffd ); + gdbfileio_newlib_to_fio_uint_t( &uicount, &fcount ); + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 'w'; + __remcomOutBuffer[i++] = 'r'; + __remcomOutBuffer[i++] = 'i'; + __remcomOutBuffer[i++] = 't'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&ffd, &__remcomOutBuffer[i], sizeof(ffd) ); + // i now points after the parameter + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)buf, + sizeof(buf)*8 ); + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&fcount, &__remcomOutBuffer[i], sizeof(fcount) ); + __remcomOutBuffer[i] = 0; + + return gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); +} // cyg_hal_gdbfileio_write() + +__externC int +cyg_hal_gdbfileio_lseek( int fd, /* off_t */ long offset, int whence, int *sig ) +{ + unsigned int i=0; + fio_int_t ffd; + fio_long_t foffset; + fio_int_t fwhence; + + gdbfileio_newlib_to_fio_int_t( &fd, &ffd ); + gdbfileio_newlib_to_fio_long_t( &offset, &foffset ); + gdbfileio_newlib_to_fio_int_t( &whence, &fwhence ); + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 'l'; + __remcomOutBuffer[i++] = 's'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = 'k'; + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&ffd, &__remcomOutBuffer[i], sizeof(ffd) ); + // i now points after the parameter + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&foffset, &__remcomOutBuffer[i], + sizeof(foffset) ); + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&fwhence, &__remcomOutBuffer[i], + sizeof(fwhence) ); + __remcomOutBuffer[i] = 0; + + return gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); +} // cyg_hal_gdbfileio_lseek() + +__externC int +cyg_hal_gdbfileio_rename( const char *oldpath, const char *newpath, int *sig ) +{ + unsigned int i=0; + size_t namelen; + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 'r'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = 'n'; + __remcomOutBuffer[i++] = 'a'; + __remcomOutBuffer[i++] = 'm'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)oldpath, + sizeof(oldpath)*8 ); + // i now points after the parameter + __remcomOutBuffer[i++] = '/'; + namelen = strlen( oldpath )+1; // includes '\0' + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)namelen, + sizeof(namelen)*8 ); + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)newpath, + sizeof(newpath)*8 ); + // i now points after the parameter + __remcomOutBuffer[i++] = '/'; + namelen = strlen( newpath )+1; // includes '\0' + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)namelen, + sizeof(namelen)*8 ); + __remcomOutBuffer[i] = 0; + + return gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); +} // cyg_hal_gdbfileio_rename() + +__externC int +cyg_hal_gdbfileio_unlink( const char *pathname, int *sig ) +{ + unsigned int i=0; + size_t namelen; + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 'u'; + __remcomOutBuffer[i++] = 'n'; + __remcomOutBuffer[i++] = 'l'; + __remcomOutBuffer[i++] = 'i'; + __remcomOutBuffer[i++] = 'n'; + __remcomOutBuffer[i++] = 'k'; + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)pathname, + sizeof(pathname)*8 ); + // i now points after the parameter + __remcomOutBuffer[i++] = '/'; + namelen = strlen( pathname )+1; // includes '\0' + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)namelen, + sizeof(namelen)*8 ); + __remcomOutBuffer[i] = 0; + + return gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); +} // cyg_hal_gdbfileio_unlink() + +__externC int +cyg_hal_gdbfileio_isatty( int fd, int *sig ) +{ + unsigned int i=0; + fio_int_t ffd; + + gdbfileio_newlib_to_fio_int_t( &fd, &ffd ); + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 'i'; + __remcomOutBuffer[i++] = 's'; + __remcomOutBuffer[i++] = 'a'; + __remcomOutBuffer[i++] = 't'; + __remcomOutBuffer[i++] = 't'; + __remcomOutBuffer[i++] = 'y'; + __remcomOutBuffer[i++] = ','; + i += chars_to_hex( (char *)&ffd, &__remcomOutBuffer[i], sizeof(ffd) ); + // i now points after the parameter + __remcomOutBuffer[i] = 0; + + return gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); +} // cyg_hal_gdbfileio_isatty() + +__externC int +cyg_hal_gdbfileio_system( const char *command, int *sig ) +{ + unsigned int i=0; + size_t namelen; + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 's'; + __remcomOutBuffer[i++] = 'y'; + __remcomOutBuffer[i++] = 's'; + __remcomOutBuffer[i++] = 't'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = 'm'; + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)command, + sizeof(command)*8 ); + // i now points after the parameter + __remcomOutBuffer[i++] = '/'; + namelen = strlen( command )+1; // includes '\0' + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)namelen, + sizeof(namelen)*8 ); + __remcomOutBuffer[i] = 0; + + return gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); +} // cyg_hal_gdbfileio_system() + +__externC int +cyg_hal_gdbfileio_gettimeofday( void *tv, void *tz, int *sig ) +{ + unsigned int i=0; + struct newlib_timeval *ntv = (struct newlib_timeval *)tv; + struct fio_timeval ftv; + int rc; + + // protocol doesn't support non-null timezone. Just enforce it here. + if (NULL != tz) + return -FILEIO_EINVAL; + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 'g'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = 't'; + __remcomOutBuffer[i++] = 't'; + __remcomOutBuffer[i++] = 'i'; + __remcomOutBuffer[i++] = 'm'; + __remcomOutBuffer[i++] = 'e'; + __remcomOutBuffer[i++] = 'o'; + __remcomOutBuffer[i++] = 'f'; + __remcomOutBuffer[i++] = 'd'; + __remcomOutBuffer[i++] = 'a'; + __remcomOutBuffer[i++] = 'y'; + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)&ftv, + sizeof(&ftv)*8 ); + __remcomOutBuffer[i++] = ','; + __remcomOutBuffer[i++] = '0'; // tzptr + __remcomOutBuffer[i] = 0; + + rc = gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); + + // now ftv should have its contents filled + gdbfileio_fio_to_newlib_time_t( &ftv.tv_sec, &ntv->tv_sec ); + gdbfileio_fio_to_newlib_long_t( &ftv.tv_usec, &ntv->tv_usec ); + + return rc; +} // cyg_hal_gdbfileio_gettimeofday() + +__externC int +cyg_hal_gdbfileio_stat( const char *pathname, struct newlib_stat *buf, + int *sig ) +{ + unsigned int i=0; + int rc; + size_t namelen; + struct fio_stat fbuf; + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 's'; + __remcomOutBuffer[i++] = 't'; + __remcomOutBuffer[i++] = 'a'; + __remcomOutBuffer[i++] = 't'; + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)pathname, + sizeof(pathname)*8 ); + // i now points after the parameter + __remcomOutBuffer[i++] = '/'; + namelen = strlen( pathname )+1; // includes '\0' + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)namelen, + sizeof(namelen)*8 ); + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)&fbuf, + sizeof(&fbuf)*8 ); + __remcomOutBuffer[i] = 0; + + rc = gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); + + // now fbuf should have its contents filled + gdbfileio_fio_to_newlib_dev_t( &fbuf.st_dev, &buf->st_dev ); + gdbfileio_fio_to_newlib_ino_t( &fbuf.st_ino, &buf->st_ino ); + gdbfileio_fio_to_newlib_mode_t( &fbuf.st_mode, &buf->st_mode ); + gdbfileio_fio_to_newlib_nlink_t( &fbuf.st_nlink, &buf->st_nlink ); + gdbfileio_fio_to_newlib_uid_t( &fbuf.st_uid, &buf->st_uid ); + gdbfileio_fio_to_newlib_gid_t( &fbuf.st_gid, &buf->st_gid ); + gdbfileio_fio_to_newlib_dev_t( &fbuf.st_rdev, &buf->st_rdev ); + gdbfileio_fio_to_newlib_off_t( &fbuf.st_size, &buf->st_size ); + gdbfileio_fio_to_newlib_off_t( &fbuf.st_size, &buf->st_size ); + gdbfileio_fio_to_newlib_off_t( &fbuf.st_size, &buf->st_size ); + gdbfileio_fio_to_newlib_off_t( &fbuf.st_size, &buf->st_size ); +#if !defined(__svr4__) || defined(__PPC__) || defined(__sun__) + gdbfileio_fio_to_newlib_long_t( &fbuf.st_blksize, &buf->st_blksize ); + gdbfileio_fio_to_newlib_long_t( &fbuf.st_blocks, &buf->st_blocks ); +#endif + gdbfileio_fio_to_newlib_time_t( &fbuf.st_atime, &buf->st_atime ); + gdbfileio_fio_to_newlib_time_t( &fbuf.st_mtime, &buf->st_mtime ); + gdbfileio_fio_to_newlib_time_t( &fbuf.st_ctime, &buf->st_ctime ); + + return rc; +} // cyg_hal_gdbfileio_stat() + +__externC int +cyg_hal_gdbfileio_fstat( int fd, struct newlib_stat *buf, int *sig ) +{ + unsigned int i=0; + int rc; + struct fio_stat fbuf; + + __remcomOutBuffer[i++] = 'F'; + __remcomOutBuffer[i++] = 'f'; + __remcomOutBuffer[i++] = 's'; + __remcomOutBuffer[i++] = 't'; + __remcomOutBuffer[i++] = 'a'; + __remcomOutBuffer[i++] = 't'; + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)fd, + sizeof(fd)*8 ); + // i now points after the parameter + __remcomOutBuffer[i++] = ','; + i += __intToHex( &__remcomOutBuffer[i], (target_register_t)&fbuf, + sizeof(&fbuf)*8 ); + __remcomOutBuffer[i] = 0; + + rc = gdbfileio_common_sendpkt( __remcomOutBuffer, sig ); + + // now fbuf should have its contents filled + gdbfileio_fio_to_newlib_dev_t( &fbuf.st_dev, &buf->st_dev ); + gdbfileio_fio_to_newlib_ino_t( &fbuf.st_ino, &buf->st_ino ); + gdbfileio_fio_to_newlib_mode_t( &fbuf.st_mode, &buf->st_mode ); + gdbfileio_fio_to_newlib_nlink_t( &fbuf.st_nlink, &buf->st_nlink ); + gdbfileio_fio_to_newlib_uid_t( &fbuf.st_uid, &buf->st_uid ); + gdbfileio_fio_to_newlib_gid_t( &fbuf.st_gid, &buf->st_gid ); + gdbfileio_fio_to_newlib_dev_t( &fbuf.st_rdev, &buf->st_rdev ); + gdbfileio_fio_to_newlib_off_t( &fbuf.st_size, &buf->st_size ); + gdbfileio_fio_to_newlib_off_t( &fbuf.st_size, &buf->st_size ); + gdbfileio_fio_to_newlib_off_t( &fbuf.st_size, &buf->st_size ); + gdbfileio_fio_to_newlib_off_t( &fbuf.st_size, &buf->st_size ); +#if !defined(__svr4__) || defined(__PPC__) || defined(__sun__) + gdbfileio_fio_to_newlib_long_t( &fbuf.st_blksize, &buf->st_blksize ); + gdbfileio_fio_to_newlib_long_t( &fbuf.st_blocks, &buf->st_blocks ); +#endif + gdbfileio_fio_to_newlib_time_t( &fbuf.st_atime, &buf->st_atime ); + gdbfileio_fio_to_newlib_time_t( &fbuf.st_mtime, &buf->st_mtime ); + gdbfileio_fio_to_newlib_time_t( &fbuf.st_ctime, &buf->st_ctime ); + + return rc; +} // cyg_hal_gdbfileio_fstat() + +/* EOF gdb-fileio.c */ diff --git a/packages/hal/common/current/src/gdb-fileio.h b/packages/hal/common/current/src/gdb-fileio.h new file mode 100644 --- /dev/null +++ b/packages/hal/common/current/src/gdb-fileio.h @@ -0,0 +1,136 @@ +/* gdb-fileio.h. + Contains definitions used inside of the File I/O facility. + + Copyright 2002 Red Hat, Inc. + +*/ + +#ifndef _GDB_FILEIO_H_ +#define _GDB_FILEIO_H_ + +#include + +/* The following flags are defined to be independent of the host + as well as the target side implementation of these constants. + All constants are defined with a leading FILEIO_ in the name + to allow the usage of these constants together with the + corresponding implementation dependent constants in one module. */ + +/* open(2) flags */ +#define FILEIO_O_RDONLY 0x0 +#define FILEIO_O_WRONLY 0x1 +#define FILEIO_O_RDWR 0x2 +#define FILEIO_O_APPEND 0x8 +#define FILEIO_O_CREAT 0x200 +#define FILEIO_O_TRUNC 0x400 +#define FILEIO_O_EXCL 0x800 +#define FILEIO_O_SUPPORTED (FILEIO_O_RDONLY | FILEIO_O_WRONLY| \ + FILEIO_O_RDWR | FILEIO_O_APPEND| \ + FILEIO_O_CREAT | FILEIO_O_TRUNC| \ + FILEIO_O_EXCL) + +/* mode_t bits */ +#define FILEIO_S_IFREG 0100000 +#define FILEIO_S_IFDIR 040000 +#define FILEIO_S_IFCHR 020000 +#define FILEIO_S_IRUSR 0400 +#define FILEIO_S_IWUSR 0200 +#define FILEIO_S_IXUSR 0100 +#define FILEIO_S_IRWXU 0700 +#define FILEIO_S_IRGRP 040 +#define FILEIO_S_IWGRP 020 +#define FILEIO_S_IXGRP 010 +#define FILEIO_S_IRWXG 070 +#define FILEIO_S_IROTH 04 +#define FILEIO_S_IWOTH 02 +#define FILEIO_S_IXOTH 01 +#define FILEIO_S_IRWXO 07 +#define FILEIO_S_SUPPORTED (FILEIO_S_IFREG|FILEIO_S_IFDIR| \ + FILEIO_S_IRWXU|FILEIO_S_IRWXG| \ + FILEIO_S_IRWXO) + +/* lseek(2) flags */ +#define FILEIO_SEEK_SET 0 +#define FILEIO_SEEK_CUR 1 +#define FILEIO_SEEK_END 2 + +/* errno values */ +#define FILEIO_EPERM 1 +#define FILEIO_ENOENT 2 +#define FILEIO_EINTR 4 +#define FILEIO_EIO 5 +#define FILEIO_EBADF 9 +#define FILEIO_EACCES 13 +#define FILEIO_EFAULT 14 +#define FILEIO_EBUSY 16 +#define FILEIO_EEXIST 17 +#define FILEIO_ENODEV 19 +#define FILEIO_ENOTDIR 20 +#define FILEIO_EISDIR 21 +#define FILEIO_EINVAL 22 +#define FILEIO_ENFILE 23 +#define FILEIO_EMFILE 24 +#define FILEIO_EFBIG 27 +#define FILEIO_ENOSPC 28 +#define FILEIO_ESPIPE 29 +#define FILEIO_EROFS 30 +#define FILEIO_ENOSYS 88 +#define FILEIO_ENAMETOOLONG 91 +#define FILEIO_EUNKNOWN 9999 + +/* limits */ +#define FILEIO_INT_MIN -2147483648L +#define FILEIO_INT_MAX 2147483647L +#define FILEIO_UINT_MAX 4294967295UL +#define FILEIO_LONG_MIN -9223372036854775808LL +#define FILEIO_LONG_MAX 9223372036854775807LL +#define FILEIO_ULONG_MAX 18446744073709551615ULL + +/* Integral types as used in protocol. */ +#if 0 +typedef __int32_t fio_int_t; +typedef __uint32_t fio_uint_t, fio_mode_t, fio_time_t; +typedef __int64_t fio_long_t; +typedef __uint64_t fio_ulong_t; +#endif + +#define FIO_INT_LEN 4 +#define FIO_UINT_LEN 4 +#define FIO_MODE_LEN 4 +#define FIO_TIME_LEN 4 +#define FIO_LONG_LEN 8 +#define FIO_ULONG_LEN 8 + +typedef char fio_int_t[FIO_INT_LEN]; +typedef char fio_uint_t[FIO_UINT_LEN]; +typedef char fio_mode_t[FIO_MODE_LEN]; +typedef char fio_time_t[FIO_TIME_LEN]; +typedef char fio_long_t[FIO_LONG_LEN]; +typedef char fio_ulong_t[FIO_ULONG_LEN]; + +/* Struct stat as used in protocol. For complete independence + of host/target systems, it's defined as an array with offsets + to the members. */ + +struct fio_stat { + fio_uint_t st_dev; + fio_uint_t st_ino; + fio_mode_t st_mode; + fio_uint_t st_nlink; + fio_uint_t st_uid; + fio_uint_t st_gid; + fio_uint_t st_rdev; + fio_ulong_t st_size; + fio_ulong_t st_blksize; + fio_ulong_t st_blocks; + fio_time_t st_atime; + fio_time_t st_mtime; + fio_time_t st_ctime; +}; + +struct fio_timeval { + fio_time_t tv_sec; + fio_long_t tv_usec; +}; + +#endif /* _GDB_FILEIO_H_ */ diff --git a/packages/hal/common/current/src/generic-stub.c b/packages/hal/common/current/src/generic-stub.c --- a/packages/hal/common/current/src/generic-stub.c +++ b/packages/hal/common/current/src/generic-stub.c @@ -9,7 +9,6 @@ #else // Function declarations (prevents compiler warnings) int stubhex (unsigned char ch); -static void getpacket (char *buffer); static void unlock_thread_scheduler (void); static uint32 crc32 (target_addr_t mem, int len, uint32 crc); #endif @@ -220,8 +219,8 @@ stubhex (ch) return -1; } -static void -getpacket (buffer) +void +__getpacket (buffer) char *buffer; { struct gdb_packet packet; @@ -351,8 +350,8 @@ void while ((readDebugChar () & 0x7f) != '+'); } -static char remcomInBuffer[BUFMAX]; -static char remcomOutBuffer[BUFMAX]; +char __remcomInBuffer[BUFMAX]; +char __remcomOutBuffer[BUFMAX]; /* Indicate to caller of mem2hex or hex2mem that there has been an error. */ @@ -885,7 +884,7 @@ int processing_breakpoint_function = 0; void __handle_exception (void) { - int sigval; + int sigval = 0; #ifdef TARGET_HAS_NEXT_STEP if (! __next_step_done ()) @@ -905,14 +904,15 @@ void #if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) // Temporary support for gnupro bsp SWIs if (__is_bsp_syscall()) - { - if (hal_syscall_handler() == 0) - { + { + sigval = hal_syscall_handler(); + if (0 == sigval) + { if (__init_vec != NULL) - __init_vec (); + __init_vec (); return; - } - } + } + } #endif #ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT @@ -920,8 +920,12 @@ void if (cyg_hal_gdb_break) { cyg_hal_gdb_break = 0; sigval = SIGINT; - } else + } #endif + + // Only compute sigval if it wasn't already computed (in + // hal_syscall_handler or as a result of a GDB async break) + if (0 == sigval) sigval = __computeSignal (__get_trap_number ()); #else // __ECOS__ @@ -1149,16 +1153,16 @@ int int is_Z = 0; #endif - remcomOutBuffer[0] = 0; + __remcomOutBuffer[0] = 0; switch (packet[0]) { case '?': { int sigval = __computeSignal (__get_trap_number ()); - remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[(sigval >> 4) & 0xf]; - remcomOutBuffer[2] = hexchars[sigval & 0xf]; - remcomOutBuffer[3] = 0; + __remcomOutBuffer[0] = 'S'; + __remcomOutBuffer[1] = hexchars[(sigval >> 4) & 0xf]; + __remcomOutBuffer[2] = hexchars[sigval & 0xf]; + __remcomOutBuffer[3] = 0; break; } @@ -1170,14 +1174,14 @@ int download speed */ { int i; - i = __intToHex (remcomOutBuffer, BUFMAX, 32); - remcomOutBuffer[i] = 0; + i = __intToHex (__remcomOutBuffer, BUFMAX, 32); + __remcomOutBuffer[i] = 0; break; } #endif case 'd': /* toggle debug flag */ - strcpy(remcomOutBuffer, GDB_stubs_version); + strcpy(__remcomOutBuffer, GDB_stubs_version); break; #endif #endif // __ECOS__ @@ -1195,7 +1199,7 @@ int case 'p': /* return the value of a single CPU register */ case 'g': /* return the value of the CPU registers */ { - stub_format_registers(&packet[0], remcomOutBuffer); + stub_format_registers(&packet[0], __remcomOutBuffer); break; } @@ -1205,7 +1209,7 @@ int if (packet[1] == '\0') { __free_program_args (); - strcpy (remcomOutBuffer, "OK"); + strcpy (__remcomOutBuffer, "OK"); } else { @@ -1238,12 +1242,12 @@ int break; } if (*ptr == '\0') - strcpy (remcomOutBuffer, "OK"); + strcpy (__remcomOutBuffer, "OK"); else - strcpy (remcomOutBuffer, "E01"); + strcpy (__remcomOutBuffer, "E01"); } #else - strcpy (remcomOutBuffer, "E01"); + strcpy (__remcomOutBuffer, "E01"); #endif } break; @@ -1252,7 +1256,7 @@ int case 'G': /* set the value of the CPU registers - return OK */ { char *in_ptr = &packet[0]; - char *out_ptr = remcomOutBuffer; + char *out_ptr = __remcomOutBuffer; stub_update_registers(in_ptr, out_ptr); break; } @@ -1268,13 +1272,13 @@ int && *ptr++ == ',' && __hexToInt (&ptr, &length)) { - if (__mem2hex_safe (addr, remcomOutBuffer, length)) + if (__mem2hex_safe (addr, __remcomOutBuffer, length)) break; - strcpy (remcomOutBuffer, "E03"); + strcpy (__remcomOutBuffer, "E03"); } else - strcpy (remcomOutBuffer, "E01"); + strcpy (__remcomOutBuffer, "E01"); break; } @@ -1297,7 +1301,7 @@ int { /* GDB sometimes sends an impossible length */ if (length < 0 || length >= BUFMAX) - strcpy (remcomOutBuffer, "E01"); + strcpy (__remcomOutBuffer, "E01"); else if (is_binary) { @@ -1321,20 +1325,20 @@ int addr += i; } if (length <= 0) - strcpy (remcomOutBuffer, "OK"); + strcpy (__remcomOutBuffer, "OK"); else - strcpy (remcomOutBuffer, "E03"); + strcpy (__remcomOutBuffer, "E03"); } else { if (__hex2mem_safe (ptr, addr, length) != NULL) - strcpy (remcomOutBuffer, "OK"); + strcpy (__remcomOutBuffer, "OK"); else - strcpy (remcomOutBuffer, "E03"); + strcpy (__remcomOutBuffer, "E03"); } } else - strcpy (remcomOutBuffer, "E02"); + strcpy (__remcomOutBuffer, "E02"); break; } @@ -1425,12 +1429,18 @@ int } case 'D' : /* detach */ - __putpacket (remcomOutBuffer); + __putpacket (__remcomOutBuffer); /* fall through */ case 'k' : /* kill the program */ #ifdef __ECOS__ hal_flush_output(); #endif +#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF + { // Reset the timer to default and cancel any callback + extern void sys_profile_reset(void); + sys_profile_reset(); + } +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF __process_exit_vec (); return -1; @@ -1440,10 +1450,10 @@ int break; case 'H': - STUB_PKT_CHANGETHREAD (packet+1, remcomOutBuffer, 300) ; + STUB_PKT_CHANGETHREAD (packet+1, __remcomOutBuffer, 300) ; break ; case 'T' : - STUB_PKT_THREAD_ALIVE (packet+1, remcomOutBuffer, 300) ; + STUB_PKT_THREAD_ALIVE (packet+1, __remcomOutBuffer, 300) ; break ; case 'B': /* breakpoint */ @@ -1458,11 +1468,11 @@ int __remove_breakpoint (addr,0); else __set_breakpoint (addr,0); - strcpy (remcomOutBuffer, "OK"); + strcpy (__remcomOutBuffer, "OK"); } else { - strcpy (remcomOutBuffer, "E01"); + strcpy (__remcomOutBuffer, "E01"); } break; } @@ -1474,7 +1484,7 @@ int char *ptr = &packet[1]; if (!__hexToInt (&ptr, &baudrate)) { - strcpy (remcomOutBuffer, "B01"); + strcpy (__remcomOutBuffer, "B01"); break; } @@ -1502,7 +1512,7 @@ int /* When there is a comma, there must be a length */ if (!__hexToInt (&ptr, &length)) { - strcpy (remcomOutBuffer, "E02"); + strcpy (__remcomOutBuffer, "E02"); break; } } @@ -1520,18 +1530,18 @@ int else err = __remove_breakpoint(addr,length); if (!err) - strcpy (remcomOutBuffer, "OK"); + strcpy (__remcomOutBuffer, "OK"); else - strcpy (remcomOutBuffer, "E02"); + strcpy (__remcomOutBuffer, "E02"); break; case 1: /* hw breakpoint */ #ifdef HAL_STUB_HW_BREAKPOINT if (!HAL_STUB_HW_BREAKPOINT(is_Z, (void *)addr, length)) - strcpy (remcomOutBuffer, "OK"); + strcpy (__remcomOutBuffer, "OK"); else #endif - strcpy (remcomOutBuffer, "E02"); + strcpy (__remcomOutBuffer, "E02"); break; case 2: case 3: @@ -1539,10 +1549,10 @@ int /* hw watchpoint */ #ifdef HAL_STUB_HW_WATCHPOINT if (!HAL_STUB_HW_WATCHPOINT(is_Z, (void *)addr, length, ztype)) - strcpy (remcomOutBuffer, "OK"); + strcpy (__remcomOutBuffer, "OK"); else #endif - strcpy (remcomOutBuffer, "E02"); + strcpy (__remcomOutBuffer, "E02"); break; } } @@ -1550,21 +1560,29 @@ int break; } #endif // Z packet support +#ifdef CYGPKG_HAL_GDB_FILEIO // File I/O over the GDB remote protocol + case 'F': + { + extern void cyg_hal_gdbfileio_process_F_packet( char *, char *); + cyg_hal_gdbfileio_process_F_packet( packet, __remcomOutBuffer ); + return -1; + } +#endif default: - __process_target_packet (packet, remcomOutBuffer, 300); + __process_target_packet (packet, __remcomOutBuffer, 300); break; } /* reply to the request */ - __putpacket (remcomOutBuffer); + __putpacket (__remcomOutBuffer); return 0; } static void send_t_packet (int sigval) { - __build_t_packet (sigval, remcomOutBuffer); - __putpacket (remcomOutBuffer); + __build_t_packet (sigval, __remcomOutBuffer); + __putpacket (__remcomOutBuffer); } /* @@ -1581,8 +1599,8 @@ process_exception (int sigval) send_t_packet (sigval); do { - getpacket (remcomInBuffer); - status = __process_packet (remcomInBuffer); + __getpacket (__remcomInBuffer); + status = __process_packet (__remcomInBuffer); } while (status == 0); if (status < 0) @@ -1594,11 +1612,11 @@ process_exception (int sigval) void __send_exit_status (int status) { - remcomOutBuffer[0] = 'W'; - remcomOutBuffer[1] = hexchars[(status >> 4) & 0xf]; - remcomOutBuffer[2] = hexchars[status & 0xf]; - remcomOutBuffer[3] = 0; - __putpacket (remcomOutBuffer); + __remcomOutBuffer[0] = 'W'; + __remcomOutBuffer[1] = hexchars[(status >> 4) & 0xf]; + __remcomOutBuffer[2] = hexchars[status & 0xf]; + __remcomOutBuffer[3] = 0; + __putpacket (__remcomOutBuffer); } /* Read up to MAXLEN bytes from the remote GDB client, and store in DEST @@ -1622,14 +1640,14 @@ int buf[2] = block ? '0' : '1'; buf[3] = 0; __putpacket (buf); - getpacket (remcomInBuffer); - if (remcomInBuffer[0] != 'I') + __getpacket (__remcomInBuffer); + if (__remcomInBuffer[0] != 'I') return -1; - len = stubhex (remcomInBuffer[1]) * 16 + stubhex (remcomInBuffer[2]); + len = stubhex (__remcomInBuffer[1]) * 16 + stubhex (__remcomInBuffer[2]); for (i = 0; i < len; i++) { - d = stubhex (remcomInBuffer[3 + i * 2]) * 16; - d |= stubhex (remcomInBuffer[3 + i * 2 + 1]); + d = stubhex (__remcomInBuffer[3 + i * 2]) * 16; + d |= stubhex (__remcomInBuffer[3 + i * 2 + 1]); __write_mem_safe (&d, (void *)(dest + i), 1); } /* Write the trailing \0. */ @@ -1755,11 +1773,11 @@ ungetDebugChar (int c) void __kill_program (int sigval) { - remcomOutBuffer[0] = 'X'; - remcomOutBuffer[1] = hexchars[(sigval >> 4) & 15]; - remcomOutBuffer[2] = hexchars[sigval & 15]; - remcomOutBuffer[3] = 0; - __putpacket (remcomOutBuffer); + __remcomOutBuffer[0] = 'X'; + __remcomOutBuffer[1] = hexchars[(sigval >> 4) & 15]; + __remcomOutBuffer[2] = hexchars[sigval & 15]; + __remcomOutBuffer[3] = 0; + __putpacket (__remcomOutBuffer); } #define MAX_ARG_COUNT 20 @@ -1904,7 +1922,7 @@ crc32 (target_addr_t mem, int len, uint3 static void process_query (char *pkt) { - remcomOutBuffer[0] = '\0'; + __remcomOutBuffer[0] = '\0'; #ifdef __ECOS__ if ('C' == pkt[0] && 'R' == pkt[1] && @@ -1926,19 +1944,19 @@ process_query (char *pkt) our_crc = crc32 (startmem, length, 0xffffffff); if (__mem_fault) { - strcpy (remcomOutBuffer, "E01"); + strcpy (__remcomOutBuffer, "E01"); } else { - int numb = __intToHex (remcomOutBuffer + 1, our_crc, 32); - remcomOutBuffer[0] = 'C'; - remcomOutBuffer[numb + 1] = 0; + int numb = __intToHex (__remcomOutBuffer + 1, our_crc, 32); + __remcomOutBuffer[0] = 'C'; + __remcomOutBuffer[numb + 1] = 0; } } return; } #ifdef CYG_HAL_STUB_PROCESS_QUERY - else if (CYG_HAL_STUB_PROCESS_QUERY (pkt, remcomOutBuffer, sizeof(remcomOutBuffer))) + else if (CYG_HAL_STUB_PROCESS_QUERY (pkt, __remcomOutBuffer, sizeof(__remcomOutBuffer))) return; #endif else @@ -1950,16 +1968,16 @@ process_query (char *pkt) switch (ch) { case 'L' : /* threadlistquery */ - STUB_PKT_GETTHREADLIST (subpkt, remcomOutBuffer, 300); + STUB_PKT_GETTHREADLIST (subpkt, __remcomOutBuffer, 300); break ; case 'P' : /* Thread or process information request */ - STUB_PKT_GETTHREADINFO (subpkt, remcomOutBuffer, 300); + STUB_PKT_GETTHREADINFO (subpkt, __remcomOutBuffer, 300); break ; case 'C' : /* current thread query */ - STUB_PKT_CURRTHREAD(subpkt, remcomOutBuffer, sizeof(remcomOutBuffer)); + STUB_PKT_CURRTHREAD(subpkt, __remcomOutBuffer, sizeof(__remcomOutBuffer)); break; default: - __process_target_query (pkt, remcomOutBuffer, 300); + __process_target_query (pkt, __remcomOutBuffer, 300); break ; } } @@ -1973,7 +1991,7 @@ process_set (char *pkt) char ch ; #ifdef CYG_HAL_STUB_PROCESS_SET - if (CYG_HAL_STUB_PROCESS_SET (pkt, remcomOutBuffer, sizeof(remcomOutBuffer))) + if (CYG_HAL_STUB_PROCESS_SET (pkt, __remcomOutBuffer, sizeof(__remcomOutBuffer))) return; #endif @@ -1984,10 +2002,10 @@ process_set (char *pkt) /* reserve the packet id even if support is not present */ /* Dont strip the 'p' off the header, there are several variations of this packet */ - STUB_PKT_CHANGETHREAD (pkt, remcomOutBuffer, 300) ; + STUB_PKT_CHANGETHREAD (pkt, __remcomOutBuffer, 300) ; break ; default: - __process_target_set (pkt, remcomOutBuffer, 300); + __process_target_set (pkt, __remcomOutBuffer, 300); break ; } } diff --git a/packages/hal/common/current/src/hal_if.c b/packages/hal/common/current/src/hal_if.c --- a/packages/hal/common/current/src/hal_if.c +++ b/packages/hal/common/current/src/hal_if.c @@ -5,29 +5,38 @@ // ROM/RAM interfacing functions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -393,11 +402,91 @@ cyg_hal_diag_mangler_gdb_getc(void* __ch return __ch; } +static char __mangler_line[100]; +static int __mangler_pos = 0; + +static void +cyg_hal_diag_mangler_gdb_flush(void* __ch_data) +{ + CYG_INTERRUPT_STATE old; + hal_virtual_comm_table_t* __chan = CYGACC_CALL_IF_DEBUG_PROCS(); + + // Nothing to do if mangler buffer is empty. + if (__mangler_pos == 0) + return; + + // Disable interrupts. This prevents GDB trying to interrupt us + // while we are in the middle of sending a packet. The serial + // receive interrupt will be seen when we re-enable interrupts + // later. +#if defined(CYG_HAL_STARTUP_ROM) \ + || !defined(CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION) + HAL_DISABLE_INTERRUPTS(old); +#else + CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old); +#endif + +#if CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES != 0 + // Only wait 500ms for data to arrive - avoid "stuck" connections + CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_SET_TIMEOUT, CYGNUM_HAL_DEBUG_GDB_PROTOCOL_TIMEOUT); +#endif + + while(1) + { + static const char hex[] = "0123456789ABCDEF"; + cyg_uint8 csum = 0, c1; + int i; + + CYGACC_COMM_IF_PUTC(*__chan, '$'); + CYGACC_COMM_IF_PUTC(*__chan, 'O'); + csum += 'O'; + for( i = 0; i < __mangler_pos; i++ ) + { + char ch = __mangler_line[i]; + char h = hex[(ch>>4)&0xF]; + char l = hex[ch&0xF]; + CYGACC_COMM_IF_PUTC(*__chan, h); + CYGACC_COMM_IF_PUTC(*__chan, l); + csum += h; + csum += l; + } + CYGACC_COMM_IF_PUTC(*__chan, '#'); + CYGACC_COMM_IF_PUTC(*__chan, hex[(csum>>4)&0xF]); + CYGACC_COMM_IF_PUTC(*__chan, hex[csum&0xF]); + + nak: +#if CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES != 0 + if (CYGACC_COMM_IF_GETC_TIMEOUT(*__chan, &c1) == 0) { + c1 = '-'; + if (tries && (--tries == 0)) c1 = '+'; + } +#else + c1 = CYGACC_COMM_IF_GETC(*__chan); +#endif + + if( c1 == '+' ) break; + + if( cyg_hal_is_break( &c1 , 1 ) ) { + // Caller's responsibility to react on this. + CYGACC_CALL_IF_CONSOLE_INTERRUPT_FLAG_SET(1); + break; + } + if( c1 != '-' ) goto nak; + } + + __mangler_pos = 0; + // And re-enable interrupts +#if defined(CYG_HAL_STARTUP_ROM) \ + || !defined(CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION) + HAL_RESTORE_INTERRUPTS(old); +#else + CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old); +#endif +} + static void cyg_hal_diag_mangler_gdb_putc(void* __ch_data, cyg_uint8 c) { - static char line[100]; - static int pos = 0; #if CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES != 0 int tries = CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES; #endif @@ -407,81 +496,10 @@ cyg_hal_diag_mangler_gdb_putc(void* __ch CYGARC_HAL_SAVE_GP(); - line[pos++] = c; - - if( c == '\n' || pos == sizeof(line) ) - { - CYG_INTERRUPT_STATE old; - hal_virtual_comm_table_t* __chan = CYGACC_CALL_IF_DEBUG_PROCS(); - - // Disable interrupts. This prevents GDB trying to interrupt us - // while we are in the middle of sending a packet. The serial - // receive interrupt will be seen when we re-enable interrupts - // later. -#if defined(CYG_HAL_STARTUP_ROM) \ - || !defined(CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION) - HAL_DISABLE_INTERRUPTS(old); -#else - CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old); -#endif - -#if CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES != 0 - // Only wait 500ms for data to arrive - avoid "stuck" connections - CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_SET_TIMEOUT, CYGNUM_HAL_DEBUG_GDB_PROTOCOL_TIMEOUT); -#endif + __mangler_line[__mangler_pos++] = c; - while(1) - { - static const char hex[] = "0123456789ABCDEF"; - cyg_uint8 csum = 0, c1; - int i; - - CYGACC_COMM_IF_PUTC(*__chan, '$'); - CYGACC_COMM_IF_PUTC(*__chan, 'O'); - csum += 'O'; - for( i = 0; i < pos; i++ ) - { - char ch = line[i]; - char h = hex[(ch>>4)&0xF]; - char l = hex[ch&0xF]; - CYGACC_COMM_IF_PUTC(*__chan, h); - CYGACC_COMM_IF_PUTC(*__chan, l); - csum += h; - csum += l; - } - CYGACC_COMM_IF_PUTC(*__chan, '#'); - CYGACC_COMM_IF_PUTC(*__chan, hex[(csum>>4)&0xF]); - CYGACC_COMM_IF_PUTC(*__chan, hex[csum&0xF]); - - nak: -#if CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES != 0 - if (CYGACC_COMM_IF_GETC_TIMEOUT(*__chan, &c1) == 0) { - c1 = '-'; - if (tries && (--tries == 0)) c1 = '+'; - } -#else - c1 = CYGACC_COMM_IF_GETC(*__chan); -#endif - - if( c1 == '+' ) break; - - if( cyg_hal_is_break( &c1 , 1 ) ) { - // Caller's responsibility to react on this. - CYGACC_CALL_IF_CONSOLE_INTERRUPT_FLAG_SET(1); - break; - } - if( c1 != '-' ) goto nak; - } - - pos = 0; - // And re-enable interrupts -#if defined(CYG_HAL_STARTUP_ROM) \ - || !defined(CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION) - HAL_RESTORE_INTERRUPTS(old); -#else - CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old); -#endif - } + if( c == '\n' || __mangler_pos == sizeof(__mangler_line) ) + cyg_hal_diag_mangler_gdb_flush(__ch_data); CYGARC_HAL_RESTORE_GP(); } @@ -514,7 +532,12 @@ static int cyg_hal_diag_mangler_gdb_control(void *__ch_data, __comm_control_cmd_t __func, ...) { - // Do nothing (yet). + CYGARC_HAL_SAVE_GP(); + + if (__func == __COMMCTL_FLUSH_OUTPUT) + cyg_hal_diag_mangler_gdb_flush(__ch_data); + + CYGARC_HAL_RESTORE_GP(); return 0; } diff --git a/packages/hal/common/current/src/hal_misc.c b/packages/hal/common/current/src/hal_misc.c --- a/packages/hal/common/current/src/hal_misc.c +++ b/packages/hal/common/current/src/hal_misc.c @@ -5,29 +5,38 @@ // Common HAL miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/src/hal_stub.c b/packages/hal/common/current/src/hal_stub.c --- a/packages/hal/common/current/src/hal_stub.c +++ b/packages/hal/common/current/src/hal_stub.c @@ -5,29 +5,38 @@ // Helper functions for stub, specific to eCos HAL // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -647,7 +656,7 @@ void // GDB is expecting REGSIZE(SP) number of bytes. // We only have sizeof(addr) number. Let's fill // the appropriate number of bytes intelligently. - target_register_t extend_val = 0; + extend_val = 0; #ifdef CYGARC_SIGN_EXTEND_REGISTERS { unsigned long bits_in_addr = (sizeof(addr) << 3); // ie Size in bytes * 8 @@ -811,6 +820,9 @@ static void int __read_mem_safe (void *dst, void *src, int count) { + if( !CYG_HAL_STUB_PERMIT_DATA_READ( src, count ) ) + return 0; + memCount = count; __do_copy_mem((unsigned char*) src, (unsigned char*) dst); return count - memCount; // return number of bytes successfully read @@ -824,6 +836,9 @@ int int __write_mem_safe (void *src, void *dst, int count) { + if( !CYG_HAL_STUB_PERMIT_DATA_READ( dst, count ) ) + return 0; + memCount = count; __do_copy_mem((unsigned char*) src, (unsigned char*) dst); return count - memCount; // return number of bytes successfully written @@ -946,6 +961,9 @@ static void int __read_progmem_safe (void *dst, void *src, int count) { + if( !CYG_HAL_STUB_PERMIT_CODE_READ( src, count ) ) + return 0; + memCount = count; __do_copy_from_progmem((unsigned char*) src, (unsigned char*) dst); return count - memCount; // return number of bytes successfully read @@ -959,6 +977,9 @@ int int __write_progmem_safe (void *src, void *dst, int count) { + if( !CYG_HAL_STUB_PERMIT_CODE_WRITE( dst, count ) ) + return 0; + memCount = count; __do_copy_to_progmem((unsigned char*) src, (unsigned char*) dst); return count - memCount; // return number of bytes successfully written diff --git a/packages/hal/common/current/src/stubrom/stubrom.c b/packages/hal/common/current/src/stubrom/stubrom.c --- a/packages/hal/common/current/src/stubrom/stubrom.c +++ b/packages/hal/common/current/src/stubrom/stubrom.c @@ -5,29 +5,38 @@ // GDB Stub ROM main // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/src/thread-packets.c b/packages/hal/common/current/src/thread-packets.c --- a/packages/hal/common/current/src/thread-packets.c +++ b/packages/hal/common/current/src/thread-packets.c @@ -5,29 +5,38 @@ // Provides multi-threaded debug support // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/src/thread-pkts.h b/packages/hal/common/current/src/thread-pkts.h --- a/packages/hal/common/current/src/thread-pkts.h +++ b/packages/hal/common/current/src/thread-pkts.h @@ -5,29 +5,38 @@ // Optional packet processing for thread aware debugging. // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/tests/basic.c b/packages/hal/common/current/tests/basic.c --- a/packages/hal/common/current/tests/basic.c +++ b/packages/hal/common/current/tests/basic.c @@ -5,29 +5,38 @@ // HAL basic functions test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/tests/cache.c b/packages/hal/common/current/tests/cache.c --- a/packages/hal/common/current/tests/cache.c +++ b/packages/hal/common/current/tests/cache.c @@ -5,29 +5,38 @@ // HAL Cache timing test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -45,11 +54,13 @@ #include #include -#ifdef HAL_DCACHE_SIZE +#if defined(HAL_DCACHE_SIZE) && HAL_DCACHE_SIZE != 0 // ------------------------------------------------------------------------- // If the HAL does not supply this, we supply our own version +#ifndef HAL_DCACHE_PURGE_ALL + #ifdef HAL_DCACHE_SYNC # define HAL_DCACHE_PURGE_ALL() HAL_DCACHE_SYNC() @@ -69,7 +80,9 @@ CYG_MACRO_START } \ CYG_MACRO_END -#endif +#endif // HAL_DCACHE_SYNC + +#endif // HAL_DCACHE_PURGE_ALL // ------------------------------------------------------------------------- diff --git a/packages/hal/common/current/tests/context.c b/packages/hal/common/current/tests/context.c --- a/packages/hal/common/current/tests/context.c +++ b/packages/hal/common/current/tests/context.c @@ -5,29 +5,38 @@ // HAL Thread context handling test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/tests/cpp1.c b/packages/hal/common/current/tests/cpp1.c --- a/packages/hal/common/current/tests/cpp1.c +++ b/packages/hal/common/current/tests/cpp1.c @@ -5,29 +5,38 @@ // cpp arithmetic bug regression test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/tests/intr.c b/packages/hal/common/current/tests/intr.c --- a/packages/hal/common/current/tests/intr.c +++ b/packages/hal/common/current/tests/intr.c @@ -5,29 +5,38 @@ // HAL Interrupt API test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/common/current/tests/vaargs.c b/packages/hal/common/current/tests/vaargs.c --- a/packages/hal/common/current/tests/vaargs.c +++ b/packages/hal/common/current/tests/vaargs.c @@ -5,29 +5,38 @@ // HAL variable argument calls test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/frv/arch/current/ChangeLog b/packages/hal/frv/arch/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/ChangeLog @@ -0,0 +1,113 @@ +2002-04-15 Jonathan Larmour + + * src/hal_syscall.c (hal_syscall_handler): Add extra sig argument to + __do_syscall. + +2001-12-10 Richard Sandiford + + * src/vectors.S (save_state): Remove unnecessary DDR diddling when + handling breaks. Use BPCSR rather than BPCSR-4 as the break address. + (restore_state): Take two new arguments: the register that the + PC should be loaded into, and the argument to the rett instruction. + (_break): If handling a break instruction, return to the following + instruction using a normal "ret". Ignore other kinds of break if + they were triggered when traps were disabled; assume that an + interrupt or exception handler has triggered a stack watchpoint + accidentally. Correct GP calculation. Return using "rett #1" + rather than "rett #0". + +2001-11-28 Hugo Tyson + + * src/vectors.S (_vectors): if defined(CYGPKG_HAL_FRV_FRV400) && + defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS), add macro break_VSR + to create a VSR entry which leaps to _break; rearrange the + initialization of the VSR table so that the counts are correct; + use break_VSR in slot 255; define _break which calls break_handler() + much akin to exception handler(). + + Note that there is no need to define CYGSEM_HAL_FRV_HW_DEBUG for + the FRV_FRV400 target; while we do use Hardware Debug, we don't + use *that* sort of hardware debug, specifically we do not use + hardware single-step, because it breaks as soon as we exit debug + mode, ie whilst we are still within the stub. But vectors.S does + the same tidy-up of machine state, conditioned on FVR400 instead. + +2001-10-17 Gary Thomas + + * src/frv_stub.c: Slight cleanup - only need |VLIW|+1 possible + breakpoint locations. + +2001-10-16 Gary Thomas + + * src/vectors.S (_exception_return): Remove *bad* workaround code + now that single step VLIW works properly. + + * src/frv_stub.c (__clear_single_step): + (__single_step): Restructure to support VLIW sequences. + +2001-10-15 Gary Thomas + + * include/hal_arch.h: Remove [bogus] CYG_HAL_TABLE macros since + the common ones work fine on this architecture. + + * src/vectors.S: + * src/frv_stub.c: + * cdl/hal_frv.cdl: Add CDL to describe various [hardware] debug + options. + +2001-10-01 Gary Thomas + + * src/vectors.S: [FRV400] can't return from exception to a packed + instruction - this yields illegal instruction. + +2001-10-11 Gary Thomas + + * cdl/hal_frv.cdl: + * include/basetype.h: + * include/hal_arch.h: + * include/hal_intr.h: + * include/frv_stub.h: + * include/hal_io.h: + * include/hal_cache.h: + * src/frv_stub.c: + * src/hal_mk_defs.c: + * src/frv.ld: + * src/hal_misc.c: + * src/vectors.S: + * src/context.S: + * src/hal_syscall.c: New port for FRV architecture. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/frv/arch/current/cdl/hal_frv.cdl b/packages/hal/frv/arch/current/cdl/hal_frv.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/cdl/hal_frv.cdl @@ -0,0 +1,157 @@ +# ==================================================================== +# +# hal_frv.cdl +# +# FUJITSU architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): bartv +# Original data: gthomas +# Contributors: +# Date: 2001-09-07 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== +cdl_package CYGPKG_HAL_FRV { + display "FUJITSU architecture" + parent CYGPKG_HAL + hardware + include_dir cyg/hal + define_header hal_frv.h + description " + The FUJITSU architecture HAL package provides generic + support for this processor architecture. It is also + necessary to select a specific target platform HAL + package." + + compile hal_misc.c context.S frv_stub.c hal_syscall.c + + # special rule used to build any include files, etc, used by assembly code + make -priority 1 { + frv.inc : /src/hal_mk_defs.c + $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,frv.tmp -o hal_mk_defs.tmp -S $< + fgrep .equ hal_mk_defs.tmp | sed s/#// | sed s/\\.equ/#define/ > $@ + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 frv.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm frv.tmp hal_mk_defs.tmp + } + + make { + /lib/vectors.o : /src/vectors.S + $(CC) -Wp,-MD,vectors.tmp $(INCLUDE_PATH) $(CFLAGS) -c -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 vectors.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm vectors.tmp + } + + make { + /lib/target.ld: /src/frv.ld + $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 target.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm target.tmp + } + + cdl_interface CYGINT_HAL_FRV_ARCH_FR400 { + display "The CPU architecture supports the FR400 architecture" + } + + cdl_interface CYGINT_HAL_FRV_ARCH_FR500 { + display "The CPU architecture supports the FR500 architecture" + } + + cdl_option CYGHWR_HAL_FRV_CPU_FAMILY { + display "FUJITSU CPU family" + flavor data + legal_values { (CYGINT_HAL_FRV_ARCH_FR400 != 0) ? "FR400" : "" + (CYGINT_HAL_FRV_ARCH_FR500 != 0) ? "FR500" : "" + "" } + default_value { (CYGINT_HAL_FRV_ARCH_FR400 != 0) ? "FR400" : + (CYGINT_HAL_FRV_ARCH_FR500 != 0) ? "FR500" : + "unknown" } + no_define + description " + It is possible to optimize code for different + FUJITSU CPU families. This option selects which CPU to + optimize for on boards that support multiple CPU types." + } + + cdl_option CYGBLD_LINKER_SCRIPT { + display "Linker script" + flavor data + no_define + calculated { "src/frv.ld" } + } + + cdl_interface CYGINT_HAL_FRV_MEM_REAL_REGION_TOP { + display "Implementations of hal_frv_mem_real_region_top()" + } + + cdl_option CYGNUM_HAL_BREAKPOINT_LIST_SIZE { + display "Number of breakpoints supported by the HAL." + flavor data + default_value 32 + active_if CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + description " + This option determines the number of breakpoints supported by the HAL." + } + + cdl_option CYGSEM_HAL_FRV_USE_BREAK_INSTRUCTION { + display "Use 'break' for breakpoints." + flavor bool + default_value 1 + active_if { CYGINT_HAL_FRV_ARCH_FR500 != 0 } + requires CYGNUM_HAL_BREAKPOINT_LIST_SIZE + description " + Select this option to use the 'break' instruction for breakpoints. + This option can only be used if the GDB stubs use local breakpoints." + } + + cdl_option CYGSEM_HAL_FRV_HW_DEBUG { + display "Hardware debug features available" + flavor bool + default_value 1 + active_if { CYGINT_HAL_FRV_ARCH_FR500 != 0 } + description " + Select this option to enable the use of a hardware debug unit." + } +} diff --git a/packages/hal/frv/arch/current/include/basetype.h b/packages/hal/frv/arch/current/include/basetype.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/include/basetype.h @@ -0,0 +1,69 @@ +#ifndef CYGONCE_HAL_BASETYPE_H +#define CYGONCE_HAL_BASETYPE_H + +//============================================================================= +// +// basetype.h +// +// Standard types for this architecture. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors: nickg, gthomas +// Date: 1998-09-11 +// Purpose: Define architecture base types. +// Usage: Included by "cyg_type.h", do not use directly + +// +//####DESCRIPTIONEND#### +// + +//----------------------------------------------------------------------------- +// Characterize the architecture + +#define CYG_BYTEORDER CYG_MSBFIRST // Big endian + +//----------------------------------------------------------------------------- +// ARM does not usually use labels with underscores. + +#define CYG_LABEL_NAME(_name_) _name_ +#define CYG_LABEL_DEFN(_name_) _name_ + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_BASETYPE_H +// End of basetype.h diff --git a/packages/hal/frv/arch/current/include/frv_stub.h b/packages/hal/frv/arch/current/include/frv_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/include/frv_stub.h @@ -0,0 +1,154 @@ +#ifndef CYGONCE_HAL_FRV_STUB_H +#define CYGONCE_HAL_FRV_STUB_H +//======================================================================== +// +// frv_stub.h +// +// FUJITSU-specific definitions for generic stub +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Red Hat, gthomas +// Contributors: Red Hat, gthomas +// Date: 2001-09-14 +// Purpose: +// Description: FUJITSU-specific definitions for generic stub +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#ifdef __cplusplus +extern "C" { +#endif + +#define NUMREGS (147) + +#define REGSIZE( _x_ ) (4) + +#define NUMREGBYTES (NUMREGS*4) + +#ifndef TARGET_REGISTER_T_DEFINED +#define TARGET_REGISTER_T_DEFINED +typedef cyg_uint32 target_register_t; +#endif + +// This information needs to match what GDB wants +enum regnames { + R0, R1, R2, R3, R4, R5, R6, R7, + R8, R9, R10, R11, R12, R13, R14, R15, + R16, R17, R18, R19, R20, R21, R22, R23, + R24, R25, R26, R27, R28, R29, R30, R31, + R32, R33, R34, R35, R36, R37, R38, R39, + R40, R41, R42, R43, R44, R45, R46, R47, + R48, R49, R50, R51, R52, R53, R54, R55, + R56, R57, R58, R59, R60, R61, R62, R63, + FP0, FP1, FP2, FP3, FP4, FP5, FP6, FP7, + FP8, FP9, FP10, FP11, FP12, FP13, FP14, FP15, + FP16, FP17, FP18, FP19, FP20, FP21, FP22, FP23, + FP24, FP25, FP26, FP27, FP28, FP29, FP30, FP31, + FP32, FP33, FP34, FP35, FP36, FP37, FP38, FP39, + FP40, FP41, FP42, FP43, FP44, FP45, FP46, FP47, + FP48, FP49, FP50, FP51, FP52, FP53, FP54, FP55, + FP56, FP57, FP58, FP59, FP60, FP61, FP62, FP63, + PC, PSR, CCR, CCCR, + _X132, _X133, _X134, _X135, _X136, _X137, _X138, + _X139, _X140, _X141, _X142, _X143, _X144, + LR, LCR +}; +#define SP R1 + +typedef enum regnames regnames_t; + +/* Given a trap value TRAP, return the corresponding signal. */ +extern int __computeSignal (unsigned int trap_number); + +/* Return the SPARC trap number corresponding to the last-taken trap. */ +extern int __get_trap_number (void); + +/* Return the currently-saved value corresponding to register REG. */ +extern target_register_t get_register (regnames_t reg); + +/* Store VALUE in the register corresponding to WHICH. */ +extern void put_register (regnames_t which, target_register_t value); + +/* Set the currently-saved pc register value to PC. This also updates NPC + as needed. */ +extern void set_pc (target_register_t pc); + +/* Set things up so that the next user resume will execute one instruction. + This may be done by setting breakpoints or setting a single step flag + in the saved user registers, for example. */ +void __single_step (void); + +/* Clear the single-step state. */ +void __clear_single_step (void); + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ +extern int __is_breakpoint_function (void); + +/* Skip the current instruction. */ +extern void __skipinst (void); + +extern void __install_breakpoints (void); + +extern void __clear_breakpoints (void); + +extern int __is_bsp_syscall(void); + +//------------------------------------------------------------------------ +// Special definition of CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION + +#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT +// we can only do this at all if break support is enabled: + +#define CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION( _old_ ) \ +do { \ + HAL_DISABLE_INTERRUPTS(_old_); \ + cyg_hal_gdb_place_break((target_register_t)&&cyg_hal_gdb_break_place ); \ +} while ( 0 ) + +#endif // CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // ifndef CYGONCE_HAL_FRV_STUB_H diff --git a/packages/hal/frv/arch/current/include/hal_arch.h b/packages/hal/frv/arch/current/include/hal_arch.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/include/hal_arch.h @@ -0,0 +1,347 @@ +#ifndef CYGONCE_HAL_ARCH_H +#define CYGONCE_HAL_ARCH_H + +//========================================================================== +// +// hal_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors: nickg, gthomas +// Date: 2001-09-07 +// Purpose: Define architecture abstractions +// Usage: #include + +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include // To decide on stack usage +#include + +#if CYGINT_HAL_FRV_ARCH_FR400 != 0 +#define _NGPR 32 +#define _NFPR 32 +#endif +#if CYGINT_HAL_FRV_ARCH_FR500 != 0 +#define _NGPR 64 +#define _NFPR 64 +#endif + +#ifndef _NGPR +#error No architecture defined? +#endif + +//-------------------------------------------------------------------------- +// Common "special" register definitions + +// Processor status register +#define _PSR_PIVL_SHIFT 3 +#define _PSR_PIVL_MASK (0xF<<(_PSR_PIVL_SHIFT)) // Interrupt mask level +#define _PSR_S (1<<2) // Supervisor state +#define _PSR_PS (1<<1) // Previous supervisor state +#define _PSR_ET (1<<0) // Enable interrupts + +#define _PSR_INITIAL (_PSR_S|_PSR_PS|_PSR_ET) // Supervisor mode, exceptions + +// Hardware status register +#define _HSR0_ICE (1<<31) // Instruction cache enable +#define _HSR0_DCE (1<<30) // Data cache enable +#define _HSR0_IMMU (1<<26) // Instruction MMU enable +#define _HSR0_DMMU (1<<25) // Data MMU enable + +// Debug Control Register +#define _DCR_EBE (1 << 30) +#define _DCR_SE (1 << 29) +#define _DCR_DRBE0 (1 << 19) +#define _DCR_DWBE0 (1 << 18) +#define _DCR_DDBE0 (1 << 17) +#define _DCR_DRBE1 (1 << 16) +#define _DCR_DWBE1 (1 << 15) +#define _DCR_DDBE1 (1 << 14) +#define _DCR_DRBE2 (1 << 13) +#define _DCR_DWBE2 (1 << 12) +#define _DCR_DDBE2 (1 << 11) +#define _DCR_DRBE3 (1 << 10) +#define _DCR_DWBE3 (1 << 9) +#define _DCR_DDBE3 (1 << 8) +#define _DCR_IBE0 (1 << 7) +#define _DCR_IBCE0 (1 << 6) +#define _DCR_IBE1 (1 << 5) +#define _DCR_IBCE1 (1 << 4) +#define _DCR_IBE2 (1 << 3) +#define _DCR_IBCE2 (1 << 2) +#define _DCR_IBE3 (1 << 1) +#define _DCR_IBCE3 (1 << 0) + +// Initial contents for special registers + +#define _CCR_INITIAL 0 +#define _LCR_INITIAL 0 +#define _CCCR_INITIAL 0 + +//-------------------------------------------------------------------------- +// +// Saved thread state +// +typedef struct +{ + cyg_uint32 gpr[_NGPR]; // Saved general purpose registers + cyg_uint32 pc; // Current [next] instruction location + cyg_uint32 psr; // Processor status register + cyg_uint32 lr; // Link register + cyg_uint32 ccr; // Condition codes + cyg_uint32 cccr; + cyg_uint32 lcr; + cyg_int32 vector; // Reason for last exception +} HAL_SavedRegisters; + +//------------------------------------------------------------------------- +// Exception handling function. +// This function is defined by the kernel according to this prototype. It is +// invoked from the HAL to deal with any CPU exceptions that the HAL does +// not want to deal with itself. It usually invokes the kernel's exception +// delivery mechanism. + +externC void cyg_hal_deliver_exception( CYG_WORD code, CYG_ADDRWORD data ); + +//------------------------------------------------------------------------- +// Bit manipulation macros + +externC int hal_lsbindex(int); +externC int hal_msbindex(int); + +#define HAL_LSBIT_INDEX(index, mask) index = hal_lsbindex(mask) +#define HAL_MSBIT_INDEX(index, mask) index = hal_msbindex(mask) + +//------------------------------------------------------------------------- +// Context Initialization +// Initialize the context of a thread. +// Arguments: +// _sparg_ name of variable containing current sp, will be changed to new sp +// _thread_ thread object address, passed as argument to entry point +// _entry_ entry point address. +// _id_ bit pattern used in initializing registers, for debugging. + +#define _HAL_THREAD_INIT_CONTEXT( _sparg_, _thread_, _entry_, _id_ ) \ + CYG_MACRO_START \ + register CYG_WORD _sp_ = ((CYG_WORD)_sparg_) &~15; \ + register HAL_SavedRegisters *_regs_; \ + int _i_; \ + _regs_ = (HAL_SavedRegisters *)((_sp_) - sizeof(HAL_SavedRegisters)); \ + for( _i_ = 1; _i_ < _NGPR; _i_++) \ + (_regs_)->gpr[_i_] = (_id_)|_i_; \ + (_regs_)->gpr[8] = (CYG_WORD)(_thread_); /* R8 = arg1 = thread ptr */ \ + (_regs_)->gpr[1] = (CYG_WORD)(_sp_); /* SP = top of stack */ \ + (_regs_)->lr = (CYG_WORD)(_entry_); /* LR = entry point */ \ + (_regs_)->pc = (CYG_WORD)(_entry_); /* PC = [initial] entry point */ \ + (_regs_)->psr = _PSR_INITIAL; /* PSR = Interrupt enabled */ \ + (_regs_)->ccr = _CCR_INITIAL; \ + (_regs_)->lcr = _LCR_INITIAL; \ + (_regs_)->ccr = _CCCR_INITIAL; \ + _sparg_ = (CYG_ADDRESS)_regs_; \ + CYG_MACRO_END + +//-------------------------------------------------------------------------- +// Context switch macros. +// The arguments are pointers to locations where the stack pointer +// of the current thread is to be stored, and from where the sp of the +// next thread is to be fetched. + +externC void hal_thread_switch_context( CYG_ADDRESS to, CYG_ADDRESS from ); +externC void hal_thread_load_context( CYG_ADDRESS to ) + __attribute__ ((noreturn)); + +#define HAL_THREAD_SWITCH_CONTEXT(_fspptr_,_tspptr_) \ + hal_thread_switch_context((CYG_ADDRESS)_tspptr_, \ + (CYG_ADDRESS)_fspptr_); + +#define HAL_THREAD_LOAD_CONTEXT(_tspptr_) \ + hal_thread_load_context( (CYG_ADDRESS)_tspptr_ ); + +//-------------------------------------------------------------------------- +// Execution reorder barrier. +// When optimizing the compiler can reorder code. In multithreaded systems +// where the order of actions is vital, this can sometimes cause problems. +// This macro may be inserted into places where reordering should not happen. + +#define HAL_REORDER_BARRIER() asm volatile ( "" : : : "memory" ) + +//-------------------------------------------------------------------------- +// Breakpoint support +// HAL_BREAKPOINT() is a code sequence that will cause a breakpoint to happen +// if executed. +// HAL_BREAKINST is the value of the breakpoint instruction and +// HAL_BREAKINST_SIZE is its size in bytes. + +// The choices for breakpoints seem to be: +// break 0x801000C0 +// tira gr0,#1 0xC0700001 +#ifdef CYGSEM_HAL_FRV_USE_BREAK_INSTRUCTION +#define HAL_BREAKPOINT(_label_) \ +asm volatile (" .globl " #_label_ "\n" \ + #_label_":\tbreak\n" \ + ); + +#define HAL_BREAKINST 0x801000C0 +#else +#define HAL_BREAKPOINT(_label_) \ +asm volatile (" .globl " #_label_ "\n" \ + #_label_":\ttira\tgr0,#1\n" \ + ); + +#define HAL_BREAKINST 0xC0700001 +#endif +#define HAL_BREAKINST_SIZE 4 +#define HAL_BREAKINST_TYPE cyg_uint32 + +//-------------------------------------------------------------------------- +// Thread register state manipulation for GDB support. + +// GDB expects the registers in this structure: +// gr0..gr31, gr32..gr63 - 4 bytes each +// fpr0..fpr31, fpr32..fpr63 - 4 bytes each +// pc, psr, ccr, cccr - 4 bytes each +// 14 - 4 bytes each +// lr, lcr - 4 bytes each + +// Translate a stack pointer as saved by the thread context macros above into +// a pointer to a HAL_SavedRegisters structure. +#define HAL_THREAD_GET_SAVED_REGISTERS( _sp_, _regs_ ) \ + (_regs_) = (HAL_SavedRegisters *)(_sp_) + +// Copy a set of registers from a HAL_SavedRegisters structure into a +// GDB ordered array. +#define HAL_GET_GDB_REGISTERS( _aregval_, _regs_ ) \ + CYG_MACRO_START \ + CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ + int _i_; \ + \ + for( _i_ = 0; _i_ <= _NGPR; _i_++ ) \ + _regval_[_i_] = (_regs_)->gpr[_i_]; \ + _regval_[128] = (_regs_)->pc; \ + _regval_[129] = (_regs_)->psr; \ + _regval_[130] = (_regs_)->ccr; \ + _regval_[135] = (_regs_)->vector; \ + _regval_[145] = (_regs_)->lr; \ + _regval_[146] = (_regs_)->lcr; \ + CYG_MACRO_END + +// Copy a GDB ordered array into a HAL_SavedRegisters structure. +#define HAL_SET_GDB_REGISTERS( _regs_ , _aregval_ ) \ + CYG_MACRO_START \ + CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ + int _i_; \ + \ + for( _i_ = 0; _i_ <= _NGPR; _i_++ ) \ + (_regs_)->gpr[_i_] = _regval_[_i_]; \ + \ + (_regs_)->pc = _regval_[128]; \ + (_regs_)->psr = _regval_[129]; \ + (_regs_)->ccr = _regval_[130]; \ + (_regs_)->lr = _regval_[145]; \ + (_regs_)->lcr = _regval_[146]; \ + CYG_MACRO_END + +//-------------------------------------------------------------------------- +// HAL setjmp + +#define CYGARC_JMP_BUF_SIZE 0x110 + +typedef cyg_uint32 hal_jmp_buf[CYGARC_JMP_BUF_SIZE]; + +externC int hal_setjmp(hal_jmp_buf env); +externC void hal_longjmp(hal_jmp_buf env, int val); + +//-------------------------------------------------------------------------- +// Idle thread code. +// This macro is called in the idle thread loop, and gives the HAL the +// chance to insert code. Typical idle thread behaviour might be to halt the +// processor. + +externC void hal_idle_thread_action(cyg_uint32 loop_count); + +#define HAL_IDLE_THREAD_ACTION(_count_) hal_idle_thread_action(_count_) + +//--------------------------------------------------------------------------- + +// Minimal and sensible stack sizes: the intention is that applications +// will use these to provide a stack size in the first instance prior to +// proper analysis. Idle thread stack should be this big. + +// THESE ARE NOT INTENDED TO BE MICROMETRICALLY ACCURATE FIGURES. +// THEY ARE HOWEVER ENOUGH TO START PROGRAMMING. +// YOU MUST MAKE YOUR STACKS LARGER IF YOU HAVE LARGE "AUTO" VARIABLES! + +// This is not a config option because it should not be adjusted except +// under "enough rope" sort of disclaimers. + +// A minimal, optimized stack frame, rounded up - no autos +#define CYGNUM_HAL_STACK_FRAME_SIZE (4 * 150) + +// Stack needed for a context switch: this is implicit in the estimate for +// interrupts so not explicitly used below: +#define CYGNUM_HAL_STACK_CONTEXT_SIZE (4 * 150) + +// Interrupt + call to ISR, interrupt_end() and the DSR +#define CYGNUM_HAL_STACK_INTERRUPT_SIZE \ + ((4 * 150) + 2 * CYGNUM_HAL_STACK_FRAME_SIZE) + +// Space for the maximum number of nested interrupts, plus room to call functions +#define CYGNUM_HAL_MAX_INTERRUPT_NESTING 4 + +#define CYGNUM_HAL_STACK_SIZE_MINIMUM \ + (CYGNUM_HAL_MAX_INTERRUPT_NESTING * CYGNUM_HAL_STACK_INTERRUPT_SIZE + \ + 2 * CYGNUM_HAL_STACK_FRAME_SIZE) + +#define CYGNUM_HAL_STACK_SIZE_TYPICAL \ + (CYGNUM_HAL_STACK_SIZE_MINIMUM + \ + 16 * CYGNUM_HAL_STACK_FRAME_SIZE) + + +//-------------------------------------------------------------------------- +// Macros for switching context between two eCos instances (jump from +// code in ROM to code in RAM or vice versa). +#define CYGARC_HAL_SAVE_GP() +#define CYGARC_HAL_RESTORE_GP() + +#endif // CYGONCE_HAL_ARCH_H +// End of hal_arch.h diff --git a/packages/hal/frv/arch/current/include/hal_cache.h b/packages/hal/frv/arch/current/include/hal_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/include/hal_cache.h @@ -0,0 +1,298 @@ +#ifndef CYGONCE_HAL_CACHE_H +#define CYGONCE_HAL_CACHE_H + +//============================================================================= +// +// hal_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors:hmt +// Date: 2000-05-08 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include CYGBLD_HAL_PLF_DEFS_H +#include // Platform (model) details + +//----------------------------------------------------------------------------- +// Global control of Instruction cache + +// Enable the instruction cache +#define HAL_ICACHE_ENABLE() \ +CYG_MACRO_START \ + cyg_uint32 mask = _HSR0_ICE; \ + asm volatile ( \ + "movsg hsr0,gr4\n" \ + "\tor gr4,%0,gr4\n" \ + "\tmovgs gr4,hsr0\n" \ + : \ + : "r"(mask) \ + : "gr4" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Disable the instruction cache (and invalidate it, required semanitcs) +#define HAL_ICACHE_DISABLE() \ +CYG_MACRO_START \ + cyg_uint32 mask = ~_HSR0_ICE; \ + asm volatile ( \ + "movsg hsr0,gr4\n" \ + "\tand gr4,%0,gr4\n" \ + "\tmovgs gr4,hsr0\n" \ + : \ + : "r"(mask) \ + : "gr4" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Query the state of the instruction cache +#define HAL_ICACHE_IS_ENABLED(_state_) \ +CYG_MACRO_START \ + register cyg_uint32 reg; \ + asm volatile ("movsg hsr0,%0" \ + : "=r"(reg) \ + : \ + ); \ + (_state_) = (0 != (_HSR0_ICE & reg)); \ +CYG_MACRO_END + +// Invalidate the entire cache +#define HAL_ICACHE_INVALIDATE_ALL() \ +CYG_MACRO_START \ + asm volatile ("icei @(gr4,gr0),1" \ + : \ + : \ + ); \ +CYG_MACRO_END + +// Synchronize the contents of the cache with memory. +// (which includes flushing out pending writes) +#define HAL_ICACHE_SYNC() \ +CYG_MACRO_START \ + HAL_DCACHE_SYNC(); /* ensure data gets to RAM */ \ + HAL_ICACHE_INVALIDATE_ALL(); /* forget all we know */ \ +CYG_MACRO_END + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_size_) + +// Load the contents of the given address range into the instruction cache +// and then lock the cache so that it stays there. +//#define HAL_ICACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_ICACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +#define HAL_ICACHE_INVALIDATE( _base_ , _size_ ) \ +CYG_MACRO_START \ + cyg_uint32 _b = _base_; \ + cyg_uint32 _s = _size_; \ + while (_s > HAL_DCACHE_LINE_SIZE) { \ + asm volatile ("ici @(%0,gr0)" \ + : \ + : "r"(_b) \ + ); \ + _s -= HAL_DCACHE_LINE_SIZE; \ + _b += HAL_DCACHE_LINE_SIZE; \ + } \ +CYG_MACRO_END + +//----------------------------------------------------------------------------- +// Global control of data cache + +// Enable the data cache +#define HAL_DCACHE_ENABLE() \ +CYG_MACRO_START \ + cyg_uint32 mask = _HSR0_DCE; \ + asm volatile ( \ + "movsg hsr0,gr4\n" \ + "\tor gr4,%0,gr4\n" \ + "\tmovgs gr4,hsr0\n" \ + : \ + : "r"(mask) \ + : "gr4" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Disable the data cache (and invalidate it, required semanitcs) +#define HAL_DCACHE_DISABLE() \ +CYG_MACRO_START \ + cyg_uint32 mask = ~_HSR0_DCE; \ + asm volatile ( \ + "movsg hsr0,gr4\n" \ + "\tand gr4,%0,gr4\n" \ + "\tmovgs gr4,hsr0\n" \ + : \ + : "r"(mask) \ + : "gr4" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// Query the state of the data cache +#define HAL_DCACHE_IS_ENABLED(_state_) \ +CYG_MACRO_START \ + register cyg_uint32 reg; \ + asm volatile ("movsg hsr0,%0" \ + : "=r"(reg) \ + : \ + ); \ + (_state_) = (0 != (_HSR0_DCE & reg)); \ +CYG_MACRO_END + +// Flush (invalidate) the entire dcache +#define HAL_DCACHE_INVALIDATE_ALL() \ +CYG_MACRO_START \ + asm volatile ("dcei @(gr4,gr0),1" \ + : \ + : \ + ); \ +CYG_MACRO_END + +// Synchronize the contents of the cache with memory. +#define HAL_DCACHE_SYNC() \ +CYG_MACRO_START \ + asm volatile ("dcef @(gr4,gr0),1" \ + : \ + : \ + ); \ +CYG_MACRO_END + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_size_) + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) + +#define HAL_DCACHE_WRITETHRU_MODE 0 +#define HAL_DCACHE_WRITEBACK_MODE 1 + +// Get the current writeback mode - or only writeback mode if fixed +#define HAL_DCACHE_QUERY_WRITE_MODE( _mode_ ) CYG_MACRO_START \ + _mode_ = HAL_DCACHE_WRITETHRU_MODE; \ +CYG_MACRO_END + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +//#define HAL_DCACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_DCACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_DCACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +#define HAL_DCACHE_FLUSH( _base_ , _size_ ) \ +CYG_MACRO_START \ + HAL_DCACHE_STORE( _base_ , _size_ ); \ + HAL_DCACHE_INVALIDATE( _base_ , _size_ ); \ +CYG_MACRO_END + +// Invalidate cache lines in the given range without writing to memory. +#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) \ +CYG_MACRO_START \ + cyg_uint32 _b = _base_; \ + cyg_uint32 _s = _size_; \ + while (_s > HAL_DCACHE_LINE_SIZE) { \ + asm volatile ("dci @(%0,gr0)" \ + : \ + : "r"(_b) \ + ); \ + _s -= HAL_DCACHE_LINE_SIZE; \ + _b += HAL_DCACHE_LINE_SIZE; \ + } \ +CYG_MACRO_END + +// Write dirty cache lines to memory for the given address range. +#define HAL_DCACHE_STORE( _base_ , _size_ ) \ +CYG_MACRO_START \ + cyg_uint32 _b = _base_; \ + cyg_uint32 _s = _size_; \ + while (_s > HAL_DCACHE_LINE_SIZE) { \ + asm volatile ("dcf @(%0,gr0)" \ + : \ + : "r"(_b) \ + ); \ + _s -= HAL_DCACHE_LINE_SIZE; \ + _b += HAL_DCACHE_LINE_SIZE; \ + } \ +CYG_MACRO_END + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_DCACHE_ZERO( _base_ , _size_ ) + +//----------------------------------------------------------------------------- + +#endif // ifndef CYGONCE_HAL_CACHE_H +// End of hal_cache.h diff --git a/packages/hal/frv/arch/current/include/hal_intr.h b/packages/hal/frv/arch/current/include/hal_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/include/hal_intr.h @@ -0,0 +1,365 @@ +#ifndef CYGONCE_HAL_INTR_H +#define CYGONCE_HAL_INTR_H + +//========================================================================== +// +// hal_intr.h +// +// HAL Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors: nickg, gthomas, +// jlarmour +// Date: 1999-02-20 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock. +// +// Usage: #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include + +// This is to allow a variant to decide that there is no platform-specific +// interrupts file; and that in turn can be overridden by a platform that +// refines the variant's ideas. +#ifdef CYGBLD_HAL_PLF_INTS_H +# include CYGBLD_HAL_PLF_INTS_H // should include variant data as required +#else +# ifdef CYGBLD_HAL_VAR_INTS_H +# include CYGBLD_HAL_VAR_INTS_H +# else +# include // default less-complex platforms +# endif +#endif + +// Spurious interrupt (no interrupt source could be found) +#define CYGNUM_HAL_INTERRUPT_NONE -1 + +//-------------------------------------------------------------------------- +// FUJITSU exception vectors. + +// The Fujitsu FR-V architecture supports up to 256 interrupt/exceptions. +// Each vectors to a specific VSR which is 16 bytes (4 instructions) long. + +// These vectors correspond to VSRs. These values are the ones to use for +// HAL_VSR_GET/SET + +#define CYGNUM_HAL_VECTOR_RESET 0x00 +#define CYGNUM_HAL_VECTOR_INSTR_ACCESS_MMU_MISS 0x01 +#define CYGNUM_HAL_VECTOR_INSTR_ACCESS_ERROR 0x02 +#define CYGNUM_HAL_VECTOR_INSTR_ACCESS_EXCEPTION 0x03 +#define CYGNUM_HAL_VECTOR_PRIVELEDGED_INSTRUCTION 0x06 +#define CYGNUM_HAL_VECTOR_ILLEGAL_INSTRUCTION 0x07 +#define CYGNUM_HAL_VECTOR_REGISTER_EXCEPTION 0x08 +#define CYGNUM_HAL_VECTOR_FP_DISABLED 0x0A +#define CYGNUM_HAL_VECTOR_MP_DISABLED 0x0B +#define CYGNUM_HAL_VECTOR_FP_EXCEPTION 0x0D +#define CYGNUM_HAL_VECTOR_MP_EXCEPTION 0x0E +#define CYGNUM_HAL_VECTOR_MEMORY_ADDRESS_NOT_ALIGNED 0x10 +#define CYGNUM_HAL_VECTOR_DATA_ACCESS_ERROR 0x11 +#define CYGNUM_HAL_VECTOR_DATA_ACCESS_MMU_MISS 0x12 +#define CYGNUM_HAL_VECTOR_DATA_ACCESS_EXCEPTION 0x13 +#define CYGNUM_HAL_VECTOR_DATA_STORE_ERROR 0x14 +#define CYGNUM_HAL_VECTOR_DIVISION_EXCEPTION 0x17 +#define CYGNUM_HAL_VECTOR_COMMIT_EXCEPTION 0x19 +#define CYGNUM_HAL_VECTOR_COMPOUND_EXCEPTION 0x20 +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1 0x21 +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_2 0x22 +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_3 0x23 +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_4 0x24 +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_5 0x25 +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_6 0x26 +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_7 0x27 +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_8 0x28 +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_9 0x29 +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_10 0x2A +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_11 0x2B +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_12 0x2C +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_13 0x2D +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_14 0x2E +#define CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_15 0x2F +#define CYGNUM_HAL_VECTOR_SYSCALL 0x80 // tira gr0,#0 +#define CYGNUM_HAL_VECTOR_BREAKPOINT_TRAP 0x81 // tira gr0,#1 +#define CYGNUM_HAL_VECTOR_BREAKPOINT 0xFF // break + +#define CYGNUM_HAL_VSR_MIN 0 +#define CYGNUM_HAL_VSR_MAX 255 +#define CYGNUM_HAL_VSR_COUNT 256 +#define CYGNUM_HAL_ISR_COUNT 256 // 1-1 mapping + +// Exception vectors. These are the values used when passed out to an +// external exception handler using cyg_hal_deliver_exception() + +#define CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION \ + CYGNUM_HAL_VECTOR_ILLEGAL_INSTRUCTION +#define CYGNUM_HAL_EXCEPTION_INTERRUPT \ + CYGNUM_HAL_VECTOR_SOFTWARE_INTERRUPT + +#define CYGNUM_HAL_EXCEPTION_CODE_ACCESS CYGNUM_HAL_VECTOR_INSTR_ACCESS_ERROR +#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS CYGNUM_HAL_VECTOR_DATA_ACCESS_ERROR + +#define CYGNUM_HAL_EXCEPTION_MIN CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION +#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_EXCEPTION_DATA_ACCESS +#define CYGNUM_HAL_EXCEPTION_COUNT (CYGNUM_HAL_EXCEPTION_MAX - \ + CYGNUM_HAL_EXCEPTION_MIN + 1) + +#define CYGNUM_HAL_ISR_MIN CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1 +#define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_15 + +//-------------------------------------------------------------------------- +// Static data used by HAL + +// ISR tables +externC CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT]; +externC CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_ISR_COUNT]; +externC CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT]; + +// VSR table +externC CYG_ADDRESS hal_vsr_table[CYGNUM_HAL_VSR_COUNT]; + +// Platform setup memory size (0 if unknown by hardware) +externC CYG_ADDRWORD hal_dram_size; +// what, if anything, this means, is platform dependent: +externC CYG_ADDRWORD hal_dram_type; + +#if CYGINT_HAL_FRV_MEM_REAL_REGION_TOP + +externC cyg_uint8 *hal_frv_mem_real_region_top( cyg_uint8 *_regionend_ ); + +# define HAL_MEM_REAL_REGION_TOP( _regionend_ ) \ + hal_frv_mem_real_region_top( _regionend_ ) +#endif + +//-------------------------------------------------------------------------- +// Default ISR +// The #define is used to test whether this routine exists, and to allow +// code outside the HAL to call it. + +externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +#define HAL_DEFAULT_ISR hal_default_isr + +//-------------------------------------------------------------------------- +// Interrupt state storage + +typedef cyg_uint32 CYG_INTERRUPT_STATE; + +//-------------------------------------------------------------------------- +// Interrupt control macros + +externC cyg_uint32 hal_disable_interrupts(void); +externC void hal_enable_interrupts(void); +externC void hal_restore_interrupts(cyg_uint32); +externC cyg_uint32 hal_query_interrupts(void); + +// On this processor, interrupts are controlled by level. Since eCos +// only has the notion of "off" and "on", this will be emulated by +// NONE-level and ALL-level. +#define HAL_DISABLE_INTERRUPTS(_old_) \ +CYG_MACRO_START \ + register cyg_uint32 reg; \ + asm volatile ( \ + "movsg psr,%0\n" \ + "\tsetlos (0x0F<<3),gr5\n" \ + "\tor %0,gr5,gr5\n" \ + "\tmovgs gr5,psr\n" \ + : "=r" (reg) \ + : \ + : "gr5" /* Clobber list */ \ + ); \ + (_old_) = (reg); \ +CYG_MACRO_END + +#define HAL_ENABLE_INTERRUPTS() \ +CYG_MACRO_START \ + asm volatile ( \ + "movsg psr,gr4\n" \ + "\tsetlos (0x0F<<3),gr5\n" \ + "\tnot gr5,gr5\n" \ + "\tand gr4,gr5,gr5\n" \ + "\tmovgs gr5,psr\n" \ + : \ + : \ + : "gr4","gr5" /* Clobber list */ \ + ); \ +CYG_MACRO_END + +// This should work, but breaks compiler +#if 0 +#define HAL_RESTORE_INTERRUPTS(_old_) \ +CYG_MACRO_START \ + asm volatile ( \ + "movsg psr,gr4\n" \ + "\tsetlos 1,gr5\n" \ + "\tand %0,gr5,gr5\n" \ + "\tor gr5,gr4,gr4\n" \ + "\tmovgs gr4,psr\n" \ + : \ + : "g" (_old_) \ + : "gr4","gr5" /* Clobber list */ \ + ); \ +CYG_MACRO_END +#else +#define HAL_RESTORE_INTERRUPTS(_old_) \ + hal_restore_interrupts(_old_) +#endif + +#define HAL_QUERY_INTERRUPTS(_old_) \ + _old_ = hal_query_interrupts() + +//-------------------------------------------------------------------------- +// Routine to execute DSRs using separate interrupt stack + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK +externC void hal_interrupt_stack_call_pending_DSRs(void); +#define HAL_INTERRUPT_STACK_CALL_PENDING_DSRS() \ + hal_interrupt_stack_call_pending_DSRs() + +#if 0 // Interrupt stacks not implemented yet +// these are offered solely for stack usage testing +// if they are not defined, then there is no interrupt stack. +#define HAL_INTERRUPT_STACK_BASE cyg_interrupt_stack_base +#define HAL_INTERRUPT_STACK_TOP cyg_interrupt_stack +// use them to declare these extern however you want: +// extern char HAL_INTERRUPT_STACK_BASE[]; +// extern char HAL_INTERRUPT_STACK_TOP[]; +// is recommended +#endif // 0 +#endif + +//-------------------------------------------------------------------------- +// Vector translation. + +#ifndef HAL_TRANSLATE_VECTOR +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) \ + (_index_) = (_vector_) +#endif + +//-------------------------------------------------------------------------- +// Interrupt and VSR attachment macros + +#define HAL_INTERRUPT_IN_USE( _vector_, _state_) \ + CYG_MACRO_START \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR ((_vector_), _index_); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)hal_default_isr ) \ + (_state_) = 0; \ + else \ + (_state_) = 1; \ + CYG_MACRO_END + +#define HAL_INTERRUPT_ATTACH( _vector_, _isr_, _data_, _object_ ) \ + CYG_MACRO_START \ + if( hal_interrupt_handlers[_vector_] == (CYG_ADDRESS)hal_default_isr ) \ + { \ + hal_interrupt_handlers[_vector_] = (CYG_ADDRESS)_isr_; \ + hal_interrupt_data[_vector_] = (CYG_ADDRWORD) _data_; \ + hal_interrupt_objects[_vector_] = (CYG_ADDRESS)_object_; \ + } \ + CYG_MACRO_END + +#define HAL_INTERRUPT_DETACH( _vector_, _isr_ ) \ + CYG_MACRO_START \ + if( hal_interrupt_handlers[_vector_] == (CYG_ADDRESS)_isr_ ) \ + { \ + hal_interrupt_handlers[_vector_] = (CYG_ADDRESS)hal_default_isr; \ + hal_interrupt_data[_vector_] = 0; \ + hal_interrupt_objects[_vector_] = 0; \ + } \ + CYG_MACRO_END + +#define HAL_VSR_GET( _vector_, _pvsr_ ) \ + *(CYG_ADDRESS *)(_pvsr_) = hal_vsr_table[_vector_]; + + +#define HAL_VSR_SET( _vector_, _vsr_, _poldvsr_ ) \ + CYG_MACRO_START \ + if( _poldvsr_ != NULL ) \ + *(CYG_ADDRESS *)_poldvsr_ = hal_vsr_table[_vector_]; \ + hal_vsr_table[_vector_] = (CYG_ADDRESS)_vsr_; \ + CYG_MACRO_END + +//-------------------------------------------------------------------------- +// Interrupt controller access + +externC void hal_interrupt_mask(int); +externC void hal_interrupt_unmask(int); +externC void hal_interrupt_acknowledge(int); +externC void hal_interrupt_configure(int, int, int); +externC void hal_interrupt_set_level(int, int); + +#define HAL_INTERRUPT_MASK( _vector_ ) \ + hal_interrupt_mask( _vector_ ) +#define HAL_INTERRUPT_UNMASK( _vector_ ) \ + hal_interrupt_unmask( _vector_ ) +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \ + hal_interrupt_acknowledge( _vector_ ) +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) \ + hal_interrupt_configure( _vector_, _level_, _up_ ) +#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) \ + hal_interrupt_set_level( _vector_, _level_ ) + +//-------------------------------------------------------------------------- +// Clock control + +externC void hal_clock_initialize(cyg_uint32); +externC void hal_clock_read(cyg_uint32 *); +externC void hal_clock_reset(cyg_uint32, cyg_uint32); + +#define HAL_CLOCK_INITIALIZE( _period_ ) hal_clock_initialize( _period_ ) +#define HAL_CLOCK_RESET( _vec_, _period_ ) hal_clock_reset( _vec_, _period_ ) +#define HAL_CLOCK_READ( _pvalue_ ) hal_clock_read( _pvalue_ ) +#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY +# ifndef HAL_CLOCK_LATENCY +# define HAL_CLOCK_LATENCY( _pvalue_ ) HAL_CLOCK_READ( (cyg_uint32 *)_pvalue_ ) +# endif +#endif + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_INTR_H +// End of hal_intr.h diff --git a/packages/hal/frv/arch/current/include/hal_io.h b/packages/hal/frv/arch/current/include/hal_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/include/hal_io.h @@ -0,0 +1,184 @@ +#ifndef CYGONCE_HAL_IO_H +#define CYGONCE_HAL_IO_H + +//============================================================================= +// +// hal_io.h +// +// HAL device IO register support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors: nickg, gthomas +// Date: 1998-09-11 +// Purpose: Define IO register support +// Description: The macros defined here provide the HAL APIs for handling +// device IO control registers. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include + +//----------------------------------------------------------------------------- +// IO Register address. +// This type is for recording the address of an IO register. + +typedef volatile CYG_ADDRWORD HAL_IO_REGISTER; + + +//----------------------------------------------------------------------------- +// BYTE Register access. +// Individual and vectorized access to 8 bit registers. + +#define HAL_READ_UINT8( _register_, _value_ ) \ +CYG_MACRO_START \ + ((_value_) = *((volatile CYG_BYTE *)((CYG_ADDRWORD)(_register_)))); \ + HAL_IO_BARRIER(); \ +CYG_MACRO_END + +#define HAL_WRITE_UINT8( _register_, _value_ ) \ +CYG_MACRO_START \ + (*((volatile CYG_BYTE *)((CYG_ADDRWORD)(_register_))) = (_value_)); \ + HAL_IO_BARRIER(); \ +CYG_MACRO_END + +#define HAL_READ_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + volatile CYG_BYTE* _r_ = ((CYG_ADDRWORD)(_register_)); \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = _r_[_j_]; \ + CYG_MACRO_END + +#define HAL_WRITE_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + volatile CYG_BYTE* _r_ = ((CYG_ADDRWORD)(_register_)); \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + _r_[_j_] = (_buf_)[_i_]; \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- +// 16 bit access. +// Individual and vectorized access to 16 bit registers. + +#define HAL_READ_UINT16( _register_, _value_ ) \ +CYG_MACRO_START \ + ((_value_) = *((volatile CYG_WORD16 *)((CYG_ADDRWORD)(_register_)))); \ + HAL_IO_BARRIER(); \ +CYG_MACRO_END + +#define HAL_WRITE_UINT16( _register_, _value_ ) \ +CYG_MACRO_START \ + (*((volatile CYG_WORD16 *)((CYG_ADDRWORD)(_register_))) = (_value_)); \ + HAL_IO_BARRIER(); \ +CYG_MACRO_END + +#define HAL_READ_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + volatile CYG_WORD16* _r_ = ((CYG_ADDRWORD)(_register_)); \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = _r_[_j_]; \ + CYG_MACRO_END + +#define HAL_WRITE_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + volatile CYG_WORD16* _r_ = ((CYG_ADDRWORD)(_register_)); \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + _r_[_j_] = (_buf_)[_i_]; \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- +// 32 bit access. +// Individual and vectorized access to 32 bit registers. + +// Note: same macros for little- and big-endian systems. + +#define HAL_READ_UINT32( _register_, _value_ ) \ +CYG_MACRO_START \ + ((_value_) = *((volatile CYG_WORD32 *)(_register_))); \ + HAL_IO_BARRIER(); \ +CYG_MACRO_END + +#define HAL_WRITE_UINT32( _register_, _value_ ) \ +CYG_MACRO_START \ + (*((volatile CYG_WORD32 *)(_register_)) = (_value_)); \ + HAL_IO_BARRIER(); \ +CYG_MACRO_END + +#define HAL_READ_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_))[_j_]; \ + CYG_MACRO_END + +#define HAL_WRITE_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_WORD32 *)(_register_))[_j_] = (_buf_)[_i_]; \ + CYG_MACRO_END + +// Enforce a flow "barrier" to prevent optimizing compiler from reordering +// operations. +#define HAL_IO_BARRIER() \ + __asm__ volatile("membar" : : ); + + +//----------------------------------------------------------------------------- +// Include plf_io.h for platforms that define it. +#ifdef CYGBLD_HAL_PLATFORM_IO_H +#include CYGBLD_HAL_PLATFORM_IO_H +#endif + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_IO_H +// End of hal_io.h diff --git a/packages/hal/frv/arch/current/src/context.S b/packages/hal/frv/arch/current/src/context.S new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/src/context.S @@ -0,0 +1,369 @@ +// #=========================================================================== +// # +// # context.S +// # +// # FUJITSU context switch code +// # +// #=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +// #=========================================================================== +// ######DESCRIPTIONBEGIN#### +// # +// # Author(s): nickg, gthomas +// # Contributors: nickg, gthomas +// # Date: 1998-09-15 +// # Purpose: FUJITSU context switch code +// # Description: This file contains implementations of the thread context +// # switch routines. It also contains the longjmp() and setjmp() +// # routines. +// # +// #####DESCRIPTIONEND#### +// # +// #=========================================================================== + +#include + +#include "frv.inc" + + .text + +// ---------------------------------------------------------------------------- +// hal_thread_switch_context(new, old) +// Switch thread contexts +// new = address of context of next thread to execute +// old = address of context save location of current thread +// thread state is saved on the current stack + + .globl hal_thread_switch_context +hal_thread_switch_context: + subi sp,_TS_size,sp // Space for saved frame + sti gr2,@(sp,_TS_GPR2) // Save registers + sti gr3,@(sp,_TS_GPR3) + sti gr4,@(sp,_TS_GPR4) + sti gr5,@(sp,_TS_GPR5) + sti gr6,@(sp,_TS_GPR6) + sti gr7,@(sp,_TS_GPR7) + sti gr8,@(sp,_TS_GPR8) + sti gr9,@(sp,_TS_GPR9) + sti gr10,@(sp,_TS_GPR10) + sti gr11,@(sp,_TS_GPR11) + sti gr12,@(sp,_TS_GPR12) + sti gr13,@(sp,_TS_GPR13) + sti gr14,@(sp,_TS_GPR14) + sti gr15,@(sp,_TS_GPR15) + sti gr16,@(sp,_TS_GPR16) + sti gr17,@(sp,_TS_GPR17) + sti gr18,@(sp,_TS_GPR18) + sti gr19,@(sp,_TS_GPR19) + sti gr20,@(sp,_TS_GPR20) + sti gr21,@(sp,_TS_GPR21) + sti gr22,@(sp,_TS_GPR22) + sti gr23,@(sp,_TS_GPR23) + sti gr24,@(sp,_TS_GPR24) + sti gr25,@(sp,_TS_GPR25) + sti gr26,@(sp,_TS_GPR26) + sti gr27,@(sp,_TS_GPR27) + sti gr28,@(sp,_TS_GPR28) + sti gr29,@(sp,_TS_GPR29) + sti gr30,@(sp,_TS_GPR30) + sti gr31,@(sp,_TS_GPR31) +#if _NGPR != 32 + sti gr32,@(sp,_TS_GPR32) + sti gr33,@(sp,_TS_GPR33) + sti gr34,@(sp,_TS_GPR34) + sti gr35,@(sp,_TS_GPR35) + sti gr36,@(sp,_TS_GPR36) + sti gr37,@(sp,_TS_GPR37) + sti gr38,@(sp,_TS_GPR38) + sti gr39,@(sp,_TS_GPR39) + sti gr40,@(sp,_TS_GPR40) + sti gr41,@(sp,_TS_GPR41) + sti gr42,@(sp,_TS_GPR42) + sti gr43,@(sp,_TS_GPR43) + sti gr44,@(sp,_TS_GPR44) + sti gr45,@(sp,_TS_GPR45) + sti gr46,@(sp,_TS_GPR46) + sti gr47,@(sp,_TS_GPR47) + sti gr48,@(sp,_TS_GPR48) + sti gr49,@(sp,_TS_GPR49) + sti gr50,@(sp,_TS_GPR50) + sti gr51,@(sp,_TS_GPR51) + sti gr52,@(sp,_TS_GPR52) + sti gr53,@(sp,_TS_GPR53) + sti gr54,@(sp,_TS_GPR54) + sti gr55,@(sp,_TS_GPR55) + sti gr56,@(sp,_TS_GPR56) + sti gr57,@(sp,_TS_GPR57) + sti gr58,@(sp,_TS_GPR58) + sti gr59,@(sp,_TS_GPR59) + sti gr60,@(sp,_TS_GPR60) + sti gr61,@(sp,_TS_GPR61) + sti gr62,@(sp,_TS_GPR62) + sti gr63,@(sp,_TS_GPR63) +#endif + movsg psr,gr4 + sti gr4,@(sp,_TS_PSR) + movsg lr,gr4 + sti gr4,@(sp,_TS_PC) + movsg ccr,gr4 + sti gr4,@(sp,_TS_CCR) + movsg lcr,gr4 + sti gr4,@(sp,_TS_LCR) + movsg cccr,gr4 + sti gr4,@(sp,_TS_CCCR) + addi sp,_TS_size,gr4 + sti gr4,@(sp,_TS_SP) + sti sp,@(gr9,0) // Pointer to saved context + + # Now load the destination thread by dropping through + # to hal_thread_load_context + +// ---------------------------------------------------------------------------- +// hal_thread_load_context(new) +// Load thread context +// new = address of context of next thread to execute +// Note that this function is also the second half of +// hal_thread_switch_context and is simply dropped into from it. + + .globl hal_thread_load_context +hal_thread_load_context: + ldi @(gr8,0),sp // Saved context + ldi @(sp,_TS_PSR),gr8 + setlos #~_PSR_ET,gr9 // Turn off exceptions + and gr8,gr9,gr8 + setlos #_PSR_PS|_PSR_S,gr9 // Stay in supervisor mode + or gr8,gr9,gr8 + movgs gr8,psr + ldi @(sp,_TS_PC),gr8 + movgs gr8,pcsr + ldi @(sp,_TS_CCR),gr8 + movgs gr8,ccr + ldi @(sp,_TS_LCR),gr8 + movgs gr8,lcr + ldi @(sp,_TS_CCCR),gr8 + movgs gr8,cccr + ldi @(sp,_TS_GPR2),gr2 // Restore registers + ldi @(sp,_TS_GPR3),gr3 + ldi @(sp,_TS_GPR4),gr4 + ldi @(sp,_TS_GPR5),gr5 + ldi @(sp,_TS_GPR6),gr6 + ldi @(sp,_TS_GPR7),gr7 + ldi @(sp,_TS_GPR8),gr8 + ldi @(sp,_TS_GPR9),gr9 + ldi @(sp,_TS_GPR10),gr10 + ldi @(sp,_TS_GPR11),gr11 + ldi @(sp,_TS_GPR12),gr12 + ldi @(sp,_TS_GPR13),gr13 + ldi @(sp,_TS_GPR14),gr14 + ldi @(sp,_TS_GPR15),gr15 + ldi @(sp,_TS_GPR16),gr16 + ldi @(sp,_TS_GPR17),gr17 + ldi @(sp,_TS_GPR18),gr18 + ldi @(sp,_TS_GPR19),gr19 + ldi @(sp,_TS_GPR20),gr20 + ldi @(sp,_TS_GPR21),gr21 + ldi @(sp,_TS_GPR22),gr22 + ldi @(sp,_TS_GPR23),gr23 + ldi @(sp,_TS_GPR24),gr24 + ldi @(sp,_TS_GPR25),gr25 + ldi @(sp,_TS_GPR26),gr26 + ldi @(sp,_TS_GPR27),gr27 + ldi @(sp,_TS_GPR28),gr28 + ldi @(sp,_TS_GPR29),gr29 + ldi @(sp,_TS_GPR30),gr30 + ldi @(sp,_TS_GPR31),gr31 +#if _NGPR != 32 + ldi @(sp,_TS_GPR32),gr32 + ldi @(sp,_TS_GPR33),gr33 + ldi @(sp,_TS_GPR34),gr34 + ldi @(sp,_TS_GPR35),gr35 + ldi @(sp,_TS_GPR36),gr36 + ldi @(sp,_TS_GPR37),gr37 + ldi @(sp,_TS_GPR38),gr38 + ldi @(sp,_TS_GPR39),gr39 + ldi @(sp,_TS_GPR40),gr40 + ldi @(sp,_TS_GPR41),gr41 + ldi @(sp,_TS_GPR42),gr42 + ldi @(sp,_TS_GPR43),gr43 + ldi @(sp,_TS_GPR44),gr44 + ldi @(sp,_TS_GPR45),gr45 + ldi @(sp,_TS_GPR46),gr46 + ldi @(sp,_TS_GPR47),gr47 + ldi @(sp,_TS_GPR48),gr48 + ldi @(sp,_TS_GPR49),gr49 + ldi @(sp,_TS_GPR50),gr50 + ldi @(sp,_TS_GPR51),gr51 + ldi @(sp,_TS_GPR52),gr52 + ldi @(sp,_TS_GPR53),gr53 + ldi @(sp,_TS_GPR54),gr54 + ldi @(sp,_TS_GPR55),gr55 + ldi @(sp,_TS_GPR56),gr56 + ldi @(sp,_TS_GPR57),gr57 + ldi @(sp,_TS_GPR58),gr58 + ldi @(sp,_TS_GPR59),gr59 + ldi @(sp,_TS_GPR60),gr60 + ldi @(sp,_TS_GPR61),gr61 + ldi @(sp,_TS_GPR62),gr62 + ldi @(sp,_TS_GPR63),gr63 +#endif + ldi @(sp,_TS_SP),sp + rett #0 + +// ---------------------------------------------------------------------------- +// HAL longjmp, setjmp implementations - based on newlib +// Register jmpbuf offset +// R16-R31 0x0-0x03c +// R48-R63 0x40-0x7c +// FR16-FR31 0x80-0xbc +// FR48-FR63 0xc0-0xfc +// LR 0x100 +// SP 0x104 +// FP 0x108 +// +// R8 contains the pointer to jmpbuf + + .text + .global hal_setjmp + .type hal_setjmp,@function +hal_setjmp: + stdi gr16, @(gr8,0) + stdi gr18, @(gr8,8) + stdi gr20, @(gr8,16) + stdi gr22, @(gr8,24) + stdi gr24, @(gr8,32) + stdi gr26, @(gr8,40) + stdi gr28, @(gr8,48) + stdi gr30, @(gr8,56) +#if _NGPR != 32 + stdi gr48, @(gr8,64) + stdi gr50, @(gr8,72) + stdi gr52, @(gr8,80) + stdi gr54, @(gr8,88) + stdi gr56, @(gr8,96) + stdi gr58, @(gr8,104) + stdi gr60, @(gr8,112) + stdi gr62, @(gr8,120) +#endif + +#if _NFPR != 0 + stdfi fr16, @(gr8,128) + stdfi fr18, @(gr8,136) + stdfi fr20, @(gr8,144) + stdfi fr22, @(gr8,152) + stdfi fr24, @(gr8,160) + stdfi fr26, @(gr8,168) + stdfi fr28, @(gr8,176) + stdfi fr30, @(gr8,184) +#if _NFPR != 32 + stdfi fr48, @(gr8,192) + stdfi fr50, @(gr8,200) + stdfi fr52, @(gr8,208) + stdfi fr54, @(gr8,216) + stdfi fr56, @(gr8,224) + stdfi fr58, @(gr8,232) + stdfi fr60, @(gr8,240) + stdfi fr62, @(gr8,248) +#endif +#endif + + movsg lr, gr4 + sti gr4, @(gr8,256) + sti sp, @(gr8,260) + sti fp, @(gr8,264) + + mov gr0,gr8 + ret +.Lend1: + .size hal_setjmp,.Lend1-hal_setjmp + + .global hal_longjmp + .type hal_longjmp,@function +hallongjmp: + lddi @(gr8,0), gr16 + lddi @(gr8,8), gr18 + lddi @(gr8,16), gr20 + lddi @(gr8,24), gr22 + lddi @(gr8,32), gr24 + lddi @(gr8,40), gr26 + lddi @(gr8,48), gr28 + lddi @(gr8,56), gr30 +#if _NGPR != 32 + lddi @(gr8,64), gr48 + lddi @(gr8,72), gr50 + lddi @(gr8,80), gr52 + lddi @(gr8,88), gr54 + lddi @(gr8,96), gr56 + lddi @(gr8,104), gr58 + lddi @(gr8,112), gr60 + lddi @(gr8,120), gr62 +#endif + +#if _NFPR != 0 + lddfi @(gr8,128), fr16 + lddfi @(gr8,136), fr18 + lddfi @(gr8,144), fr20 + lddfi @(gr8,152), fr22 + lddfi @(gr8,160), fr24 + lddfi @(gr8,168), fr26 + lddfi @(gr8,176), fr28 + lddfi @(gr8,184), fr30 +#if _NFPR != 32 + lddfi @(gr8,192), fr48 + lddfi @(gr8,200), fr50 + lddfi @(gr8,208), fr52 + lddfi @(gr8,216), fr54 + lddfi @(gr8,224), fr56 + lddfi @(gr8,232), fr58 + lddfi @(gr8,240), fr60 + lddfi @(gr8,248), fr62 +#endif +#endif + + ldi @(gr8,256), gr4 + movgs gr4,lr + + ldi @(gr8,260), sp + ldi @(gr8,264), fp + +# Value to return is in r9. If zero, return 1 + cmp gr9, gr0, icc0 + setlos #1, gr8 + ckne icc0, cc4 + cmov gr9, gr8, cc4, 1 + ret +.Lend2: + .size hal_longjmp,.Lend2-hal_longjmp2 + +// ---------------------------------------------------------------------------- +// end of context.S diff --git a/packages/hal/frv/arch/current/src/frv.ld b/packages/hal/frv/arch/current/src/frv.ld new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/src/frv.ld @@ -0,0 +1,153 @@ +//============================================================================= +// +// MLT linker script for Fujitsu (FR-V) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= + +#include + +STARTUP(vectors.o) +ENTRY(_start) +#ifdef EXTRAS +INPUT(extras.o) +#endif +GROUP(libtarget.a libgcc.a) + +#define ALIGN_LMA 8 +#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1)) +#define LMA_EQ_VMA +#define FORCE_OUTPUT . = . + +#define SECTIONS_BEGIN \ + /* Debug information */ \ + .debug_aranges 0 : { *(.debug_aranges) } \ + .debug_pubnames 0 : { *(.debug_pubnames) } \ + .debug_info 0 : { *(.debug_info) } \ + .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) } + +#define SECTION_fixed_vectors(_region_, _vma_, _lma_) \ + .fixed_vectors _vma_ : _lma_ \ + { FORCE_OUTPUT; KEEP (*(.fixed_vectors)) } \ + > _region_ + +#define SECTION_rom_vectors(_region_, _vma_, _lma_) \ + .rom_vectors _vma_ : _lma_ \ + { FORCE_OUTPUT; KEEP (*(.rom_vectors)) } \ + > _region_ + +#define SECTION_text(_region_, _vma_, _lma_) \ + .text _vma_ : _lma_ \ + { _stext = ABSOLUTE(.); \ + PROVIDE (__stext = ABSOLUTE(.)); \ + *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) \ + *(.glue_7) *(.glue_7t) \ + } > _region_ \ + _etext = .; PROVIDE (__etext = .); + +#define SECTION_fini(_region_, _vma_, _lma_) \ + .fini _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fini) } \ + > _region_ + +#define SECTION_rodata(_region_, _vma_, _lma_) \ + .rodata _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata*) } \ + > _region_ + +#define SECTION_rodata1(_region_, _vma_, _lma_) \ + .rodata1 _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata1) } \ + > _region_ + +#define SECTION_fixup(_region_, _vma_, _lma_) \ + .fixup _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fixup) } \ + > _region_ + +#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ + .gcc_except_table _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.gcc_except_table) } \ + > _region_ + +#define SECTION_mmu_tables(_region_, _vma_, _lma_) \ + .mmu_tables _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.mmu_tables) } \ + > _region_ + +#define SECTION_sram(_region_, _vma_, _lma_) \ + .sram _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.sram*) } \ + > _region_ + +#define SECTION_data(_region_, _vma_, _lma_) \ + .data _vma_ : _lma_ \ + { __ram_data_start = ABSOLUTE (.); *(.data*) *(.data1) \ + . = ALIGN (8); \ + KEEP(*( SORT (.ecos.table.*))) ; \ + . = ALIGN (8); \ + __CTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.ctors*))) __CTOR_END__ = ABSOLUTE (.); \ + __DTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) __DTOR_END__ = ABSOLUTE (.); \ + *(.sdata*) \ + . = ALIGN (8); *(.2ram.*) \ + /* Global pointer stuff */ \ + . = ALIGN(8); _gp = . + 2048; __global = _gp; \ + _GOT_START_ = ABSOLUTE (.); *(.got) _GOT_END_ = ABSOLUTE (.); \ + _GOT_PLT_START_ = ABSOLUTE (.); *(.got_plt) _GOT_PLT_END_ = ABSOLUTE (.); \ + _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.); \ + _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.); \ + _DYNAMIC_ = ABSOLUTE (.); *(.dynamic) _DYNAMIC_ = ABSOLUTE (.); \ + } \ + > _region_ \ + __rom_data_start = LOADADDR (.data); \ + __ram_data_end = .; PROVIDE (__ram_data_end = .); _edata = .; PROVIDE (edata = .); \ + __rom_data_end = LOADADDR (.data) + SIZEOF(.data); + +#define SECTION_bss(_region_, _vma_, _lma_) \ + .bss _vma_ : _lma_ \ + { __bss_start = ABSOLUTE (.); \ + *(.scommon) *(.dynbss) *(.sbss) *(.sbss.*) *(.bss*) *(.bss.*) *(COMMON) \ + __bss_end = ABSOLUTE (.); } \ + > _region_ + +#define SECTIONS_END . = ALIGN(8); _end = .; PROVIDE (end = .); + +#include +#include CYGHWR_MEMORY_LAYOUT_LDI diff --git a/packages/hal/frv/arch/current/src/frv_stub.c b/packages/hal/frv/arch/current/src/frv_stub.c new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/src/frv_stub.c @@ -0,0 +1,382 @@ +//======================================================================== +// +// frv_stub.c +// +// Helper functions for stub, generic to all FUJITSU processors +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Red Hat, gthomas +// Contributors: Red Hat, gthomas, jskov, msalter +// Date: 2001-09-16 +// Purpose: +// Description: Helper functions for stub, generic to all FUJITSU processors +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#include + +#ifdef CYGPKG_REDBOOT +#include +#endif + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include +#include +#include +#include + +#ifndef FALSE +#define FALSE 0 +#define TRUE 1 +#endif + +#ifdef CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT +#include // dbg_currthread_id +#endif + +#if defined(CYGNUM_HAL_BREAKPOINT_LIST_SIZE) && (CYGNUM_HAL_BREAKPOINT_LIST_SIZE > 0) +cyg_uint32 __frv_breakinst = HAL_BREAKINST; +#endif + +// Sadly, this doesn't seem to work on the FRV400 either +//#define USE_HW_STEP + +#ifdef CYGSEM_HAL_FRV_HW_DEBUG +static inline unsigned __get_dcr(void) +{ + unsigned retval; + + asm volatile ( + "movsg dcr,%0\n" + : "=r" (retval) + : /* no inputs */ ); + + return retval; +} + +static inline void __set_dcr(unsigned val) +{ + asm volatile ( + "movgs %0,dcr\n" + : /* no outputs */ + : "r" (val) ); +} + +#endif + +/* Given a trap value TRAP, return the corresponding signal. */ + +int __computeSignal (unsigned int trap_number) +{ + // should also catch CYGNUM_HAL_VECTOR_UNDEF_INSTRUCTION here but we + // can't tell the different between a real one and a breakpoint :-( + switch (trap_number) { + // Interrupts + case CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1 ... CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_15: + return SIGINT; + case CYGNUM_HAL_VECTOR_INSTR_ACCESS_MMU_MISS: + case CYGNUM_HAL_VECTOR_INSTR_ACCESS_ERROR: + case CYGNUM_HAL_VECTOR_INSTR_ACCESS_EXCEPTION: + case CYGNUM_HAL_VECTOR_MEMORY_ADDRESS_NOT_ALIGNED: + case CYGNUM_HAL_VECTOR_DATA_ACCESS_ERROR: + case CYGNUM_HAL_VECTOR_DATA_ACCESS_MMU_MISS: + case CYGNUM_HAL_VECTOR_DATA_ACCESS_EXCEPTION: + case CYGNUM_HAL_VECTOR_DATA_STORE_ERROR: + return SIGBUS; + case CYGNUM_HAL_VECTOR_PRIVELEDGED_INSTRUCTION: + case CYGNUM_HAL_VECTOR_ILLEGAL_INSTRUCTION: + case CYGNUM_HAL_VECTOR_REGISTER_EXCEPTION: + case CYGNUM_HAL_VECTOR_FP_DISABLED: + case CYGNUM_HAL_VECTOR_MP_DISABLED: + case CYGNUM_HAL_VECTOR_FP_EXCEPTION: + case CYGNUM_HAL_VECTOR_MP_EXCEPTION: + case CYGNUM_HAL_VECTOR_DIVISION_EXCEPTION: + case CYGNUM_HAL_VECTOR_COMMIT_EXCEPTION: + case CYGNUM_HAL_VECTOR_COMPOUND_EXCEPTION: + return SIGILL; + default: + return SIGTRAP; + } +} + + +/* Return the trap number corresponding to the last-taken trap. */ +int __get_trap_number (void) +{ + // The vector is not not part of the GDB register set so get it + // directly from the save context. + return _hal_registers->vector; +} + + +#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) +int __is_bsp_syscall(void) +{ + // Might want to be more specific here + return (_hal_registers->vector == CYGNUM_HAL_VECTOR_SYSCALL); +} +#endif // defined(CYGSEM_REDBOOT_BSP_SYSCALLS) + +/* Set the currently-saved pc register value to PC. */ + +void set_pc (target_register_t pc) +{ + put_register (PC, pc); +} + + +/*---------------------------------------------------------------------- + * Single-step support + */ + +/* Set things up so that the next user resume will execute one instruction. + This may be done by setting breakpoints or setting a single step flag + in the saved user registers, for example. */ + +#ifndef CYGSEM_HAL_FRV_HW_DEBUG +#if CYGINT_HAL_FRV_ARCH_FR400 == 1 +#define VLIW_DEPTH 2 +#endif +#if CYGINT_HAL_FRV_ARCH_FR500 == 1 +#define VLIW_DEPTH 4 +#endif +/* + * Structure to hold opcodes hoisted when breakpoints are + * set for single-stepping or async interruption. + */ +struct _bp_save { + unsigned long *addr; + unsigned long opcode; +}; + +/* + * We single-step by setting breakpoints. + * + * This is where we save the original instructions. + */ +static struct _bp_save step_bp[VLIW_DEPTH+1]; + +//************************************************************** +//************ CAUTION!! *************************************** +//************************************************************** +// +// Attempt to analyze the current instruction. This code is not +// perfect in the case of VLIW sequences, although it's close. +// Consider these sequences: +// +// ldi.p @(gr5,0),gr4 +// jmpl @(gr4,gr0) +// and +// +// ldi.p @(gr5,0),gr4 +// add.p gr6,gr7,gr8 +// jmpl @(gr4,gr0) +// +// In these cases, the only way to effectively calculate the +// target address (of the jump) would be to simulate the actions +// of the pipelined instructions which come beforehand. +// +// Of course, this only affects single stepping through a VLIW +// sequence which contains such pipelined effects and a branch. +// Hopefully this is rare. +// +// Note: testing of the above sequence on the FR400 yielded an +// illegal instruction (invalid VLIW sequence), so this may not +// turn out to be a problem in practice, just theory. +// +//************************************************************** +//************************************************************** + +static int +_analyze_instr(unsigned long pc, unsigned long *targ, + unsigned long *next, int *is_vliw) +{ + unsigned long opcode; + int n, is_branch = 0; + + opcode = *(unsigned long *)pc; + switch ((opcode >> 18) & 0x7f) { + case 6: + case 7: + /* bcc, fbcc */ + is_branch = 1; + n = (int)(opcode << 16); + n >>= 16; + *targ = pc + n*4; + pc += 4; + break; + case 12: + /* jmpl */ + n = (int)(get_register((opcode>>12)&63)); + n += (int)(get_register(opcode&63)); + pc = n; + break; + case 13: + /* jmpil */ + n = (int)(get_register((opcode>>12)&63)); + n += (((int)(opcode << 20)) >> 20); + pc = n; + break; + case 15: + /* call */ + n = (opcode >> 25) << 18; + n |= (opcode & 0x3ffff); + n <<= 8; + n >>= 8; + pc += n*4; + break; + case 14: + /* ret */ + is_branch = 1; + *targ = get_register(LR); + pc += 4; + break; + default: + pc += 4; + break; + } + *next = pc; + *is_vliw = (opcode & 0x80000000) == 0; + return is_branch; +} +#endif + +void __single_step (void) +{ +#ifdef CYGSEM_HAL_FRV_HW_DEBUG + __set_dcr(__get_dcr() | _DCR_SE); + diag_printf("Setting single step - DCR: %x\n", __get_dcr()); +#else + unsigned long pc, targ, next_pc; + int i, is_branch = 0; + int is_vliw; + + for (i = 0; i < VLIW_DEPTH+1; i++) { + step_bp[i].addr = NULL; + } + + pc = get_register(PC); + i = 1; + while (i < (VLIW_DEPTH+1)) { + is_branch = _analyze_instr(pc, &targ, &next_pc, &is_vliw); + if (is_branch && next_pc != targ) { + step_bp[i].addr = (unsigned long *)targ; + step_bp[i].opcode = *(unsigned long *)targ; + *(unsigned long *)targ = HAL_BREAKINST; + HAL_DCACHE_STORE(targ, 4); + HAL_ICACHE_INVALIDATE(targ, 4); + } + if (is_vliw) { + pc += 4; + i++; + } else { + break; + } + } + step_bp[0].addr = (unsigned long *)next_pc; + step_bp[0].opcode = *(unsigned long *)next_pc; + *(unsigned long *)next_pc = HAL_BREAKINST; + HAL_DCACHE_STORE(next_pc, 4); + HAL_ICACHE_INVALIDATE(next_pc, 4); +#endif +} + +/* Clear the single-step state. */ + +void __clear_single_step (void) +{ +#ifdef CYGSEM_HAL_FRV_HW_DEBUG + __set_dcr(__get_dcr() & ~_DCR_SE); +#else + struct _bp_save *p; + int i; + + for (i = 0; i < VLIW_DEPTH+1; i++) { + p = &step_bp[i]; + if (p->addr) { + *(p->addr) = p->opcode; + HAL_DCACHE_STORE((cyg_uint32)p->addr, 4); + HAL_ICACHE_INVALIDATE((cyg_uint32)p->addr, 4); + p->addr = NULL; + } + } +#endif +} + +void __install_breakpoints (void) +{ +#if defined(CYGNUM_HAL_BREAKPOINT_LIST_SIZE) && (CYGNUM_HAL_BREAKPOINT_LIST_SIZE > 0) + /* Install the breakpoints in the breakpoint list */ + __install_breakpoint_list(); +#endif +} + +void __clear_breakpoints (void) +{ +#if defined(CYGNUM_HAL_BREAKPOINT_LIST_SIZE) && (CYGNUM_HAL_BREAKPOINT_LIST_SIZE > 0) + __clear_breakpoint_list(); +#endif +} + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ + +int +__is_breakpoint_function () +{ + return get_register (PC) == (target_register_t)&_breakinst; +} + + +/* Skip the current instruction. Since this is only called by the + stub when the PC points to a breakpoint or trap instruction, + we can safely just skip 4. */ + +void __skipinst (void) +{ + unsigned long pc = get_register(PC); + + pc += 4; + put_register(PC, pc); +} + +#endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS diff --git a/packages/hal/frv/arch/current/src/hal_misc.c b/packages/hal/frv/arch/current/src/hal_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/src/hal_misc.c @@ -0,0 +1,275 @@ +/*========================================================================== +// +// hal_misc.c +// +// HAL miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors: nickg, gthomas +// Date: 1999-02-20 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//=========================================================================*/ + +#include +#include +#ifdef CYGPKG_KERNEL +#include +#endif +#ifdef CYGPKG_CYGMON +#include +#endif + +#include +#include // tracing macros +#include // assertion macros +#include + +#include // HAL header +#include // HAL header +#include // HAL header + +/*------------------------------------------------------------------------*/ +/* First level C exception handler. */ + +externC void __handle_exception (void); + +externC HAL_SavedRegisters *_hal_registers; +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +// Historical - this datum is defined by the GDB stubs if present +externC +#endif + void* volatile __mem_fault_handler; + +#if 0 +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +/* Force exception handling into the GDB stubs. This is done by taking over + the exception vectors while executing in the stubs. This allows for the + debugged program to handle exceptions itself, except while the GDB + processing is underway. The only vector that can't be handled this way + is the illegal instruction vector which is used for breakpoint/single-step + and must be maintained by the stubs at all times. + Note: the interrupt vectors are _not_ preempted as the stubs probably can't + handle them properly. +*/ + +#define ARM_VECTORS 8 +extern unsigned long vectors[]; // exception vectors as defined by the stubs + +#if !defined(CYGPKG_CYGMON) +static unsigned long *hardware_vectors = (unsigned long *)0x20; +static unsigned long hold_vectors[ARM_VECTORS]; +static int exception_level; + +static void +__take_over_debug_traps(void) +{ + hold_vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH] = hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH]; + hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH] = vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH]; + hold_vectors[CYGNUM_HAL_VECTOR_ABORT_DATA] = hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_DATA]; + hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_DATA] = vectors[CYGNUM_HAL_VECTOR_ABORT_DATA]; +} + +static void +__restore_debug_traps(void) +{ + hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH] = hold_vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH]; + hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_DATA] = hold_vectors[CYGNUM_HAL_VECTOR_ABORT_DATA]; +} +#endif // !CYGPKG_CYGMON +#endif + +#endif // if 0 + +void +exception_handler(HAL_SavedRegisters *regs) +{ + // Special case handler for code which has chosen to take care + // of data exceptions (i.e. code which expects them to happen) + // This is common in discovery code, e.g. checking for a particular + // device which may generate an exception when probing if the + // device is not present + if (__mem_fault_handler && + regs->vector == CYGNUM_HAL_EXCEPTION_DATA_ACCESS) { + regs->pc = (unsigned long)__mem_fault_handler; + return; // Caught an exception inside stubs + } + +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) && !defined(CYGPKG_CYGMON) +//?? if (++exception_level == 1) __take_over_debug_traps(); + + _hal_registers = regs; + __handle_exception(); + +//?? if (--exception_level == 0) __restore_debug_traps(); + +#elif defined(CYGPKG_KERNEL_EXCEPTIONS) + + // We should decode the vector and pass a more appropriate + // value as the second argument. For now we simply pass a + // pointer to the saved registers. We should also divert + // breakpoint and other debug vectors into the debug stubs. + + cyg_hal_deliver_exception( regs->vector, (CYG_ADDRWORD)regs ); + +#else + + CYG_FAIL("Exception!!!"); + +#endif + + return; +} + +void hal_spurious_IRQ(HAL_SavedRegisters *regs) CYGBLD_ATTRIB_WEAK; +void +hal_spurious_IRQ(HAL_SavedRegisters *regs) +{ +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) + exception_handler(regs); +#else + CYG_FAIL("Spurious interrupt!!"); +#endif +} + +/*------------------------------------------------------------------------*/ +/* C++ support - run initial constructors */ + +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG +cyg_bool cyg_hal_stop_constructors; +#endif + +typedef void (*pfunc) (void); +extern pfunc __CTOR_LIST__[]; +extern pfunc __CTOR_END__[]; + +void +cyg_hal_invoke_constructors (void) +{ +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG + static pfunc *p = &__CTOR_END__[-1]; + + cyg_hal_stop_constructors = 0; + for (; p >= __CTOR_LIST__; p--) { + (*p) (); + if (cyg_hal_stop_constructors) { + p--; + break; + } + } +#else + pfunc *p; + + for (p = &__CTOR_END__[-1]; p >= __CTOR_LIST__; p--) { + (*p) (); + } +#endif +} + +/*------------------------------------------------------------------------*/ +/* Architecture default ISR */ + +externC cyg_uint32 +hal_arch_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + CYG_TRACE1(true, "Interrupt: %d", vector); + + CYG_FAIL("Spurious Interrupt!!!"); + return 0; +} + +/*------------------------------------------------------------------------*/ +/* Idle thread action */ + +void +hal_idle_thread_action( cyg_uint32 count ) +{ +} + +/*-------------------------------------------------------------------------*/ +/* Misc functions */ + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS__ +/* This function will generate a breakpoint exception. It is used at the + beginning of a program to sync up with a debugger and can be used + otherwise as a quick means to stop program execution and "break" into + the debugger. */ + +void +breakpoint(void) +{ + HAL_BREAKPOINT(_breakinst); +} + + +/* This function returns the opcode for a 'trap' instruction. */ + +unsigned long +__break_opcode (void) +{ + return HAL_BREAKINST; +} +#endif + +int +hal_lsbindex(int mask) +{ + int i; + for (i = 0; i < 32; i++) { + if (mask & (1<= 0; i--) { + if (mask & (1< + +#include // HAL header +#include // HAL header +#ifdef CYGPKG_KERNEL +# include +# include +#endif +#include + +/* + * This program is used to generate definitions needed by + * assembly language modules. + * + * This technique was first used in the OSF Mach kernel code: + * generate asm statements containing #defines, + * compile this file to assembler, and then extract the + * #defines from the assembly-language output. + */ + +#define DEFINE(sym, val) \ + asm volatile("\n.equ\t" #sym " %0" : : "i" (val)) + +int +main(void) +{ +#ifdef CYGPKG_KERNEL + DEFINE(RAISE_INTR, CYG_INSTRUMENT_CLASS_INTR|CYG_INSTRUMENT_EVENT_INTR_RAISE); +#endif +#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT) + DEFINE(CYGNUM_CALL_IF_TABLE_SIZE, CYGNUM_CALL_IF_TABLE_SIZE); +#endif + DEFINE(CYGNUM_HAL_INTERRUPT_NONE, CYGNUM_HAL_INTERRUPT_NONE); + DEFINE(CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE, CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE); + DEFINE(CYGNUM_HAL_ISR_COUNT, CYGNUM_HAL_ISR_COUNT); + DEFINE(CYGNUM_HAL_VECTOR_SYSCALL, CYGNUM_HAL_VECTOR_SYSCALL); + DEFINE(CYGNUM_HAL_VECTOR_BREAKPOINT, CYGNUM_HAL_VECTOR_BREAKPOINT); + DEFINE(CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1, CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1); + DEFINE(CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_15, CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_15); + + // Register state + DEFINE(_TS_GPR0, offsetof(HAL_SavedRegisters, gpr[0])); + DEFINE(_TS_GPR1, offsetof(HAL_SavedRegisters, gpr[1])); + DEFINE(_TS_SP, offsetof(HAL_SavedRegisters, gpr[1])); + DEFINE(_TS_GPR2, offsetof(HAL_SavedRegisters, gpr[2])); + DEFINE(_TS_GPR3, offsetof(HAL_SavedRegisters, gpr[3])); + DEFINE(_TS_GPR4, offsetof(HAL_SavedRegisters, gpr[4])); + DEFINE(_TS_GPR5, offsetof(HAL_SavedRegisters, gpr[5])); + DEFINE(_TS_GPR6, offsetof(HAL_SavedRegisters, gpr[6])); + DEFINE(_TS_GPR7, offsetof(HAL_SavedRegisters, gpr[7])); + DEFINE(_TS_GPR8, offsetof(HAL_SavedRegisters, gpr[8])); + DEFINE(_TS_GPR9, offsetof(HAL_SavedRegisters, gpr[9])); + DEFINE(_TS_GPR10, offsetof(HAL_SavedRegisters, gpr[10])); + DEFINE(_TS_GPR11, offsetof(HAL_SavedRegisters, gpr[11])); + DEFINE(_TS_GPR12, offsetof(HAL_SavedRegisters, gpr[12])); + DEFINE(_TS_GPR13, offsetof(HAL_SavedRegisters, gpr[13])); + DEFINE(_TS_GPR14, offsetof(HAL_SavedRegisters, gpr[14])); + DEFINE(_TS_GPR15, offsetof(HAL_SavedRegisters, gpr[15])); + DEFINE(_TS_GPR16, offsetof(HAL_SavedRegisters, gpr[16])); + DEFINE(_TS_GPR17, offsetof(HAL_SavedRegisters, gpr[17])); + DEFINE(_TS_GPR18, offsetof(HAL_SavedRegisters, gpr[18])); + DEFINE(_TS_GPR19, offsetof(HAL_SavedRegisters, gpr[19])); + DEFINE(_TS_GPR20, offsetof(HAL_SavedRegisters, gpr[20])); + DEFINE(_TS_GPR21, offsetof(HAL_SavedRegisters, gpr[21])); + DEFINE(_TS_GPR22, offsetof(HAL_SavedRegisters, gpr[22])); + DEFINE(_TS_GPR23, offsetof(HAL_SavedRegisters, gpr[23])); + DEFINE(_TS_GPR24, offsetof(HAL_SavedRegisters, gpr[24])); + DEFINE(_TS_GPR25, offsetof(HAL_SavedRegisters, gpr[25])); + DEFINE(_TS_GPR26, offsetof(HAL_SavedRegisters, gpr[26])); + DEFINE(_TS_GPR27, offsetof(HAL_SavedRegisters, gpr[27])); + DEFINE(_TS_GPR28, offsetof(HAL_SavedRegisters, gpr[28])); + DEFINE(_TS_GPR29, offsetof(HAL_SavedRegisters, gpr[29])); + DEFINE(_TS_GPR30, offsetof(HAL_SavedRegisters, gpr[30])); + DEFINE(_TS_GPR31, offsetof(HAL_SavedRegisters, gpr[31])); +#if _NGPR != 32 + DEFINE(_TS_GPR32, offsetof(HAL_SavedRegisters, gpr[32])); + DEFINE(_TS_GPR33, offsetof(HAL_SavedRegisters, gpr[33])); + DEFINE(_TS_GPR34, offsetof(HAL_SavedRegisters, gpr[34])); + DEFINE(_TS_GPR35, offsetof(HAL_SavedRegisters, gpr[35])); + DEFINE(_TS_GPR36, offsetof(HAL_SavedRegisters, gpr[36])); + DEFINE(_TS_GPR37, offsetof(HAL_SavedRegisters, gpr[37])); + DEFINE(_TS_GPR38, offsetof(HAL_SavedRegisters, gpr[38])); + DEFINE(_TS_GPR39, offsetof(HAL_SavedRegisters, gpr[39])); + DEFINE(_TS_GPR40, offsetof(HAL_SavedRegisters, gpr[40])); + DEFINE(_TS_GPR41, offsetof(HAL_SavedRegisters, gpr[41])); + DEFINE(_TS_GPR42, offsetof(HAL_SavedRegisters, gpr[42])); + DEFINE(_TS_GPR43, offsetof(HAL_SavedRegisters, gpr[43])); + DEFINE(_TS_GPR44, offsetof(HAL_SavedRegisters, gpr[44])); + DEFINE(_TS_GPR45, offsetof(HAL_SavedRegisters, gpr[45])); + DEFINE(_TS_GPR46, offsetof(HAL_SavedRegisters, gpr[46])); + DEFINE(_TS_GPR47, offsetof(HAL_SavedRegisters, gpr[47])); + DEFINE(_TS_GPR48, offsetof(HAL_SavedRegisters, gpr[48])); + DEFINE(_TS_GPR49, offsetof(HAL_SavedRegisters, gpr[49])); + DEFINE(_TS_GPR50, offsetof(HAL_SavedRegisters, gpr[50])); + DEFINE(_TS_GPR51, offsetof(HAL_SavedRegisters, gpr[51])); + DEFINE(_TS_GPR52, offsetof(HAL_SavedRegisters, gpr[52])); + DEFINE(_TS_GPR53, offsetof(HAL_SavedRegisters, gpr[53])); + DEFINE(_TS_GPR54, offsetof(HAL_SavedRegisters, gpr[54])); + DEFINE(_TS_GPR55, offsetof(HAL_SavedRegisters, gpr[55])); + DEFINE(_TS_GPR56, offsetof(HAL_SavedRegisters, gpr[56])); + DEFINE(_TS_GPR57, offsetof(HAL_SavedRegisters, gpr[57])); + DEFINE(_TS_GPR58, offsetof(HAL_SavedRegisters, gpr[58])); + DEFINE(_TS_GPR59, offsetof(HAL_SavedRegisters, gpr[59])); + DEFINE(_TS_GPR60, offsetof(HAL_SavedRegisters, gpr[60])); + DEFINE(_TS_GPR61, offsetof(HAL_SavedRegisters, gpr[61])); + DEFINE(_TS_GPR62, offsetof(HAL_SavedRegisters, gpr[62])); + DEFINE(_TS_GPR63, offsetof(HAL_SavedRegisters, gpr[63])); +#endif + DEFINE(_TS_PC, offsetof(HAL_SavedRegisters, pc)); + DEFINE(_TS_PSR, offsetof(HAL_SavedRegisters, psr)); + DEFINE(_TS_LR, offsetof(HAL_SavedRegisters, lr)); + DEFINE(_TS_CCR, offsetof(HAL_SavedRegisters, ccr)); + DEFINE(_TS_LCR, offsetof(HAL_SavedRegisters, lcr)); + DEFINE(_TS_CCCR, offsetof(HAL_SavedRegisters, cccr)); + DEFINE(_TS_LR, offsetof(HAL_SavedRegisters, lr)); + DEFINE(_TS_VECTOR, offsetof(HAL_SavedRegisters, vector)); +#define _roundup(n,s) ((((n)+(s-1))/s)*s) + DEFINE(_TS_size, _roundup(sizeof(HAL_SavedRegisters),8)); + + DEFINE(_NGPR, _NGPR); + DEFINE(_NFPR, _NFPR); + + DEFINE(_PSR_ET, _PSR_ET); + DEFINE(_PSR_S, _PSR_S); + DEFINE(_PSR_PS, _PSR_PS); + DEFINE(_PSR_PIVL_MASK, _PSR_PIVL_MASK); + DEFINE(_PSR_PIVL_SHIFT, _PSR_PIVL_SHIFT); + + DEFINE(_HSR0_ICE, _HSR0_ICE); + DEFINE(_HSR0_DCE, _HSR0_DCE); + DEFINE(_HSR0_IMMU, _HSR0_IMMU); + DEFINE(_HSR0_DMMU, _HSR0_DMMU); + + return 0; +} + + +/*------------------------------------------------------------------------*/ +// EOF hal_mk_defs.c diff --git a/packages/hal/frv/arch/current/src/hal_syscall.c b/packages/hal/frv/arch/current/src/hal_syscall.c new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/src/hal_syscall.c @@ -0,0 +1,113 @@ +//============================================================================= +// +// hal_syscall.c +// +// +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter, gthomas +// Date: 2000-11-5 +// Purpose: +// Description: +// +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGPKG_REDBOOT +#include +#endif + +#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) + +#include // Our header +#include // HAL_BREAKINST +#include // HAL_xCACHE_x +#include // interrupt disable/restore + +#include // ROM calling interface +#include // Helper functions + +extern int __do_syscall(int func, // syscall function number + long arg1, long arg2, // up to four args. + long arg3, long arg4, + int *retval, // syscall return value + int *sig); // signal to return (or 0) + +#define SYS_exit 1 +#define SYS_interrupt 1000 + +int +hal_syscall_handler(void) +{ + int func, arg1, arg2, arg3, arg4; + int err, res, sig; + + func = get_register(R7); + arg1 = get_register(R8); + arg2 = get_register(R9); + arg3 = get_register(R10); + arg4 = get_register(R11); + + if (func == SYS_exit) { + // We want to stop in exit so that the user may poke around + // to see why his app exited. + return SIGTRAP; + } + + if (func == SYS_interrupt) { + // A console interrupt landed us here. + // Invoke the debug agent so as to cause a SIGINT. + return SIGINT; + } + + if ((res = __do_syscall(func, arg1, arg2, arg3, arg4, &err, &sig)) != 0) { + // Skip over trap instruction + put_register(PC, get_register(PC)+4); + put_register(R8, err); + return sig; + } + + return SIGTRAP; +} +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS diff --git a/packages/hal/frv/arch/current/src/vectors.S b/packages/hal/frv/arch/current/src/vectors.S new file mode 100644 --- /dev/null +++ b/packages/hal/frv/arch/current/src/vectors.S @@ -0,0 +1,853 @@ +// #======================================================================== +// # +// # vectors.S +// # +// # Fujitsu exception vectors +// # +// #======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +// #======================================================================== +// ######DESCRIPTIONBEGIN#### +// # +// # Author(s): gthomas +// # Contributors: gthomas +// # Date: 2001-09-16 +// # Purpose: Fujitsu exception vectors +// # Description: This file defines the code placed into the exception +// # vectors. It also contains the first level default VSRs +// # that save and restore state for both exceptions and +// # interrupts. +// # +// #####DESCRIPTIONEND#### +// # +// #======================================================================== + +#include +#include CYGBLD_HAL_PLF_DEFS_H +#include "frv.inc" +#include + + .macro lda a r + sethi #gprelhi(\a),\r + setlo #gprello(\a),\r + add \r,gr16,\r + .endm + + .macro li v r + sethi #((\v)>>16),\r + setlo #((\v)&0xFFFF),\r + .endm + + .macro save_GDB_exception_regs base,orig + // 'orig' points to an area where some registers were already saved + // orig+0: GPR4 + // orig+4: GPR5 + // orig+8: GPR6 + // orig+12: GPR16 + // orig+16: LR + // orig+20: CCR + sti gr4,@(\base,_TS_VECTOR) + addi \orig,24,gr5 + sti gr5,@(\base,_TS_SP) + ldi @(\orig,0),gr5 + sti gr5,@(\base,_TS_GPR4) + ldi @(\orig,4),gr5 + sti gr5,@(\base,_TS_GPR5) + ldi @(\orig,8),gr5 + sti gr5,@(\base,_TS_GPR6) + ldi @(\orig,12),gr5 + sti gr5,@(\base,_TS_GPR16) + ldi @(\orig,16),gr5 + sti gr5,@(\base,_TS_LR) + ldi @(\orig,20),gr5 + sti gr5,@(\base,_TS_CCR) + .endm + + .macro save_exception_regs base + sti gr4,@(\base,_TS_VECTOR) + sti gr5,@(\base,_TS_GPR5) + addi sp,_TS_size,gr5 + sti gr5,@(\base,_TS_SP) + sti gr6,@(\base,_TS_GPR6) + sti gr16,@(\base,_TS_GPR16) + movsg lr,gr5 + sti gr5,@(\base,_TS_LR) + movsg ccr,gr5 + sti gr5,@(\base,_TS_CCR) + .endm + + // Save the machine state after an interrupt/exception + // Note: it might be possible to use stdi/lddi instructions here, + // but it would require that the stack pointer always be 64 bit + // (doubleword) aligned. + .macro save_state base + sti gr0,@(\base,_TS_GPR0) + sti gr2,@(\base,_TS_GPR2) + sti gr3,@(\base,_TS_GPR3) + sti gr7,@(\base,_TS_GPR7) + sti gr8,@(\base,_TS_GPR8) + sti gr9,@(\base,_TS_GPR9) + sti gr10,@(\base,_TS_GPR10) + sti gr11,@(\base,_TS_GPR11) + sti gr12,@(\base,_TS_GPR12) + sti gr13,@(\base,_TS_GPR13) + sti gr14,@(\base,_TS_GPR14) + sti gr15,@(\base,_TS_GPR15) + sti gr17,@(\base,_TS_GPR17) + sti gr18,@(\base,_TS_GPR18) + sti gr19,@(\base,_TS_GPR19) + sti gr20,@(\base,_TS_GPR20) + sti gr21,@(\base,_TS_GPR21) + sti gr22,@(\base,_TS_GPR22) + sti gr23,@(\base,_TS_GPR23) + sti gr24,@(\base,_TS_GPR24) + sti gr25,@(\base,_TS_GPR25) + sti gr26,@(\base,_TS_GPR26) + sti gr27,@(\base,_TS_GPR27) + sti gr28,@(\base,_TS_GPR28) + sti gr29,@(\base,_TS_GPR29) + sti gr30,@(\base,_TS_GPR30) + sti gr31,@(\base,_TS_GPR31) +#if _NGPR != 32 + sti gr32,@(\base,_TS_GPR32) + sti gr33,@(\base,_TS_GPR33) + sti gr34,@(\base,_TS_GPR34) + sti gr35,@(\base,_TS_GPR35) + sti gr36,@(\base,_TS_GPR36) + sti gr37,@(\base,_TS_GPR37) + sti gr38,@(\base,_TS_GPR38) + sti gr39,@(\base,_TS_GPR39) + sti gr40,@(\base,_TS_GPR40) + sti gr41,@(\base,_TS_GPR41) + sti gr42,@(\base,_TS_GPR42) + sti gr43,@(\base,_TS_GPR43) + sti gr44,@(\base,_TS_GPR44) + sti gr45,@(\base,_TS_GPR45) + sti gr46,@(\base,_TS_GPR46) + sti gr47,@(\base,_TS_GPR47) + sti gr48,@(\base,_TS_GPR48) + sti gr49,@(\base,_TS_GPR49) + sti gr50,@(\base,_TS_GPR50) + sti gr51,@(\base,_TS_GPR51) + sti gr52,@(\base,_TS_GPR52) + sti gr53,@(\base,_TS_GPR53) + sti gr54,@(\base,_TS_GPR54) + sti gr55,@(\base,_TS_GPR55) + sti gr56,@(\base,_TS_GPR56) + sti gr57,@(\base,_TS_GPR57) + sti gr58,@(\base,_TS_GPR58) + sti gr59,@(\base,_TS_GPR59) + sti gr60,@(\base,_TS_GPR60) + sti gr61,@(\base,_TS_GPR61) + sti gr62,@(\base,_TS_GPR62) + sti gr63,@(\base,_TS_GPR63) +#endif + movsg psr,gr5 + sti gr5,@(\base,_TS_PSR) + movsg lcr,gr5 + sti gr5,@(\base,_TS_LCR) + movsg cccr,gr5 + sti gr5,@(\base,_TS_CCCR) + movsg bpcsr,gr5 +#if defined( CYGSEM_HAL_FRV_HW_DEBUG ) || defined(CYGPKG_HAL_FRV_FRV400) + cmpi gr4,#CYGNUM_HAL_VECTOR_BREAKPOINT,icc0 + beq icc0,0,10f +#endif +5: movsg pcsr,gr5 + cmpi gr4,#CYGNUM_HAL_VECTOR_SYSCALL,icc0 + blt icc0,0,10f +6: subi gr5,#4,gr5 // traps show PC+4 +10: sti gr5,@(\base,_TS_PC) + .endm + + // Restore the machine state after an interrupt/exception + .macro restore_state base,pcreg,retv + ldi @(\base,_TS_PC),gr5 + movgs gr5,\pcreg + ldi @(\base,_TS_CCR),gr5 + movgs gr5,ccr + ldi @(\base,_TS_LR),gr5 + movgs gr5,lr + ldi @(\base,_TS_PSR),gr5 + movgs gr5,psr + ldi @(\base,_TS_LCR),gr5 + movgs gr5,lcr + ldi @(\base,_TS_CCCR),gr5 + movgs gr5,cccr + ldi @(\base,_TS_GPR2),gr2 + ldi @(\base,_TS_GPR3),gr3 + ldi @(\base,_TS_GPR4),gr4 + ldi @(\base,_TS_GPR5),gr5 + ldi @(\base,_TS_GPR6),gr6 + ldi @(\base,_TS_GPR7),gr7 + ldi @(\base,_TS_GPR8),gr8 + ldi @(\base,_TS_GPR9),gr9 + ldi @(\base,_TS_GPR10),gr10 + ldi @(\base,_TS_GPR11),gr11 + ldi @(\base,_TS_GPR12),gr12 + ldi @(\base,_TS_GPR13),gr13 + ldi @(\base,_TS_GPR14),gr14 + ldi @(\base,_TS_GPR15),gr15 + ldi @(\base,_TS_GPR16),gr16 + ldi @(\base,_TS_GPR17),gr17 + ldi @(\base,_TS_GPR18),gr18 + ldi @(\base,_TS_GPR19),gr19 + ldi @(\base,_TS_GPR20),gr20 + ldi @(\base,_TS_GPR21),gr21 + ldi @(\base,_TS_GPR22),gr22 + ldi @(\base,_TS_GPR23),gr23 + ldi @(\base,_TS_GPR24),gr24 + ldi @(\base,_TS_GPR25),gr25 + ldi @(\base,_TS_GPR26),gr26 + ldi @(\base,_TS_GPR27),gr27 + ldi @(\base,_TS_GPR28),gr28 + ldi @(\base,_TS_GPR29),gr29 + ldi @(\base,_TS_GPR30),gr30 + ldi @(\base,_TS_GPR31),gr31 +#if _NGPR != 32 + ldi @(\base,_TS_GPR32),gr32 + ldi @(\base,_TS_GPR33),gr33 + ldi @(\base,_TS_GPR34),gr34 + ldi @(\base,_TS_GPR35),gr35 + ldi @(\base,_TS_GPR36),gr36 + ldi @(\base,_TS_GPR37),gr37 + ldi @(\base,_TS_GPR38),gr38 + ldi @(\base,_TS_GPR39),gr39 + ldi @(\base,_TS_GPR40),gr40 + ldi @(\base,_TS_GPR41),gr41 + ldi @(\base,_TS_GPR42),gr42 + ldi @(\base,_TS_GPR43),gr43 + ldi @(\base,_TS_GPR44),gr44 + ldi @(\base,_TS_GPR45),gr45 + ldi @(\base,_TS_GPR46),gr46 + ldi @(\base,_TS_GPR47),gr47 + ldi @(\base,_TS_GPR48),gr48 + ldi @(\base,_TS_GPR49),gr49 + ldi @(\base,_TS_GPR50),gr50 + ldi @(\base,_TS_GPR51),gr51 + ldi @(\base,_TS_GPR52),gr52 + ldi @(\base,_TS_GPR53),gr53 + ldi @(\base,_TS_GPR54),gr54 + ldi @(\base,_TS_GPR55),gr55 + ldi @(\base,_TS_GPR56),gr56 + ldi @(\base,_TS_GPR57),gr57 + ldi @(\base,_TS_GPR58),gr58 + ldi @(\base,_TS_GPR59),gr59 + ldi @(\base,_TS_GPR60),gr60 + ldi @(\base,_TS_GPR61),gr61 + ldi @(\base,_TS_GPR62),gr62 + ldi @(\base,_TS_GPR63),gr63 +#endif + ldi @(\base,_TS_SP),gr1 // This has to be last - Stack pointer + rett #\retv + .endm + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) + + .macro exception_VSR +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + subi sp,24,sp + sti gr4,@(sp,0) +#else + subi sp,_TS_size,sp + sti gr4,@(sp,_TS_GPR4) +#endif + addi gr0,#((.-8)-_vectors)/16,gr4 + bra _exception + .endm + +#if defined(CYGPKG_HAL_FRV_FRV400) && defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) + .macro break_VSR +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + subi sp,24,sp + sti gr4,@(sp,0) +#else + subi sp,_TS_size,sp + sti gr4,@(sp,_TS_GPR4) +#endif + addi gr0,#((.-8)-_vectors)/16,gr4 + bra _break + .endm +#endif // CYGPKG_HAL_FRV_FRV400 && STUBS + + .macro interrupt_VSR + subi sp,_TS_size,sp + sti gr4,@(sp,_TS_GPR4) + addi gr0,#((.-8)-_vectors)/16,gr4 + bra _interrupt + .endm + + .section ".rom_vectors","ax" +_vectors: + call reset_vector + nop // I hate fencepost stuff like this.... + nop // (NEXT_INDEX_AFTER_THIS - 1) - (PREVIOUS_INDEX_FILLED) + nop // (LAST_INDEX_TO_FILL) - (PREVIOUS_INDEX_FILLED) + .rept (CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1-1)-0 + exception_VSR + .endr + .rept (CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_15) - (CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1-1) + interrupt_VSR + .endr + .rept (254) - CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_15 + exception_VSR + .endr +#if defined(CYGPKG_HAL_FRV_FRV400) && defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) + break_VSR // in index 255 +#else + exception_VSR // another one +#endif // CYGPKG_HAL_FRV_FRV400 && STUBS + +// +// Handle a break +// +// just like _exception, but it calls break_handler instead. +// +#if defined(CYGPKG_HAL_FRV_FRV400) && defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) + _break: + // Save current register state +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + sti gr5,@(sp,4) + + // First, check BRR to see whether we're processing a break + // instruction. The stub uses this instruction to enter debug mode. + movsg brr,gr5 + andicc gr5,#2,gr0,icc0 + beq icc0,#0,1f + + // It is a break instruction. Clear BRR to acknowledge it. + movgs gr0,brr + + // Set LR to the address of the instruction after the break. + // Since software breaks are post-execution ones, BPCSR already + // contains the right address. + movsg bpcsr,gr5 + movgs gr5,lr + + // Restore the other registers and return as if the break were a + // call. Don't worry, the user of the break instruction knows + // that LR will be clobbered! + ldi @(sp,0),gr4 + ldi @(sp,4),gr5 + addi sp,#24,sp + ret + +1: + // We didn't come here from a break instruction so assume a + // breakpoint or watchpoint has been triggered. Since the + // interrupt and exception handlers save their registers on the + // application stack, there's a chance that these handlers could + // trigger watchpoints accidentally. We should just ignore + // the watchpoint when that happens. + + // Use the previous value of SPR:ET to decide whether the break + // was triggered by stub or user code. The stub runs with traps + // disabled, while any user code that disables traps will not be + // debuggable. + movsg bpsr,gr5 + andicc gr5,#1,gr0,icc0 + bne icc0,#2,1f + + // Hmm, it looks like the GDB stub has triggered an old watchpoint. + // Acknowledge it by clearing brr and return as if nothing had + // happened. + movgs gr0,brr + ldi @(sp,0),gr4 + ldi @(sp,4),gr5 + addi sp,#24,sp + rett #1 +1: + sti gr6,@(sp,8) + sti gr16,@(sp,12) + movsg lr,gr5 + sti gr5,@(sp,16) + movsg ccr,gr5 + sti gr5,@(sp,20) + // Set the global offset register (gr16) + call .Lbrk +.Lbrk: movsg lr,gr16 + sethi #gprelhi(.Lbrk),gr5 + setlo #gprello(.Lbrk),gr5 + sub gr16,gr5,gr16 + mov sp,gr6 // Original stack pointer + lda __GDB_stack,gr5 // already on GDB stack? + cmp sp,gr5,icc0 + bhi icc0,0,10f // no - need to switch + lda __GDB_stack_base,gr5 + cmp sp,gr5,icc0 + bhi icc0,0,11f +10: lda __GDB_stack,sp // already on GDB stack? +11: + subi sp,_TS_size,sp // Space for scratch saves + save_GDB_exception_regs sp,gr6 + save_state sp +#else + save_exception_regs sp + save_state sp +#endif + LED 0x0FFF + add sp,gr0,gr8 + call break_handler + restore_state sp,bpcsr,1 +#endif // CYGPKG_HAL_FRV_FRV400 && STUBS + +// +// Handle an exception +// +_exception: + // Save current register state +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + sti gr5,@(sp,4) + sti gr6,@(sp,8) + sti gr16,@(sp,12) + movsg lr,gr5 + sti gr5,@(sp,16) + movsg ccr,gr5 + sti gr5,@(sp,20) + // Set the global offset register (gr16) + call .Lexp +.Lexp: movsg lr,gr16 + sethi #gprelhi(.Lexp),gr5 + setlo #gprello(.Lexp),gr5 + sub gr16,gr5,gr16 + mov sp,gr6 // Original stack pointer + lda __GDB_stack,gr5 // already on GDB stack? + cmp sp,gr5,icc0 + bhi icc0,0,10f // no - need to switch + lda __GDB_stack_base,gr5 + cmp sp,gr5,icc0 + bhi icc0,0,11f +10: lda __GDB_stack,sp // already on GDB stack? +11: + subi sp,_TS_size,sp // Space for scratch saves + save_GDB_exception_regs sp,gr6 + save_state sp +#else + save_exception_regs sp + save_state sp +#endif + LED 0x0FFF + add sp,gr0,gr8 + call exception_handler + bra _exception_return + +// +// Handle an interrupt +// Separated from exception handling to support eCos multi-level +// (ISR/DSR) interrupt structure. +// +_interrupt: + save_exception_regs sp + save_state sp + + mov gr4,gr30 // save vector # + + // Set the global offset register (gr16) + call .Lexp1 +.Lexp1: movsg lr,gr16 + sethi #gprelhi(.Lexp1),gr5 + setlo #gprello(.Lexp1),gr5 + sub gr16,gr5,gr16 + LED 0x0700 + + lda hal_vsr_table,gr8 + slli gr30,#2,gr4 // Vector in GR30 + ld @(gr8,gr4),gr8 // Handler (VSR) defined? + cmpi gr8,0,icc0 + beq icc0,0,10f // No - use default + LED 0x0702 + callil @(gr8,0) // Yes - call it + bra _exception_return + +// +// Default interrupt processing +// +10: +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) \ + || defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) + // If we are supporting Ctrl-C interrupts from GDB, we must squirrel + // away a pointer to the save interrupt state here so that we can + // plant a breakpoint at some later time. + + .extern hal_saved_interrupt_state + lda hal_saved_interrupt_state,gr5 + sti sp,@(gr5,0) +#endif + lda hal_interrupt_data,gr5 + lda hal_interrupt_handlers,gr6 + mov gr30,gr8 // Interrupt vector # + slli gr30,#2,gr4 + ld @(gr5,gr4),gr9 // data pointer + ld @(gr6,gr4),gr6 // function + callil @(gr6,0) + LED 0x0701 + // FIXME - no DSR processing + +// +// Return from an exception/interrupt +// +_exception_return: + LED 0x0000 + restore_state sp,pcsr,0 + + .global reset_vector +reset_vector: + + // Make sure the CPU is in the proper mode (system), interrupts disabled + movsg psr,gr4 + li ~(_PSR_ET|_PSR_PS|_PSR_PIVL_MASK),gr5 + and gr4,gr5,gr4 + li (_PSR_S|_PSR_ET|(0x0F<<_PSR_PIVL_SHIFT)),gr5 + or gr4,gr5,gr4 + movgs gr4,psr + + // Make sure caches, MMUs are disabled + movsg hsr0,gr4 + li ~(_HSR0_ICE|_HSR0_DCE|_HSR0_IMMU|_HSR0_DMMU),gr5 + and gr4,gr5,gr4 + movgs gr4,hsr0 + + // Initialize hardware platform - this macro only contains + // code which must be run before any "normal" accesses are + // allowed, such as enabling DRAM controllers, etc. + platform_init + +#if defined(CYG_HAL_STARTUP_ROMRAM) +// Relocate code from ROM to static RAM + call 10f // Actual address loaded at +5: .long _vectors + .long 20f + .long 5b-_vectors + .long __rom_data_end +10: movsg lr,gr4 + ldi @(gr4,0),gr6 + ldi @(gr4,4),gr10 + ldi @(gr4,8),gr7 + ldi @(gr4,12),gr8 + sub gr4,gr7,gr4 // GR4 - absolute base address + subi gr4,#4,gr4 + subi gr6,#4,gr6 + setlos #4,gr7 +15: ldu @(gr4,gr7),gr5 + stu gr5,@(gr6,gr7) + cmp gr6,gr8,icc0 + bne icc0,0,15b + jmpl @(gr10,gr0) +20: nop +#endif + + // Fall through to normal program startup + +#endif // CYG_HAL_STARTUP_ROM + + .text + + .global _start +_start: + // Set the global offset register (gr16) + call .Lcall + .Lcall: + movsg lr,gr4 + sethi #gprelhi(.Lcall),gr5 + setlo #gprello(.Lcall),gr5 + sub gr4,gr5,gr16 + + LED 0x0000 + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) + // Set up trap base register + lda _vectors,gr4 + movgs gr4,tbr + + LED 0x0001 + + // Relocate [copy] data from ROM to RAM + lda __rom_data_start,gr4 + lda __ram_data_start,gr5 + lda __ram_data_end,gr6 + cmp gr5,gr6,icc0 + beq icc0,0,2f + setlos #4,gr7 + sub gr4,gr7,gr4 + sub gr5,gr7,gr5 +1: ldu @(gr4,gr7),gr8 + stu gr8,@(gr5,gr7) + cmp gr5,gr6,icc0 + bne icc0,0,1b +2: +#endif + + // Set up stack, initial environment + lda __startup_stack,gr4 + mov gr4,sp + + // Enable caches early, based on configuration +#ifdef CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP + icei @(gr4,gr0),1 // purges current contents + movsg hsr0,gr4 + li _HSR0_ICE,gr5 // enable instruction cache + or gr4,gr5,gr4 + movgs gr4,hsr0 +#endif +#ifdef CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP + dcef @(gr4,gr0),1 // flush contents to memory + dcei @(gr4,gr0),1 // purges current contents + movsg hsr0,gr4 + li _HSR0_DCE,gr5 // enable data cache + or gr4,gr5,gr4 + movgs gr4,hsr0 +#endif + + LED 0x0002 + + // Clear BSS space + lda __bss_start,gr4 + lda __bss_end,gr5 +1: sti gr0,@(gr4,0) + addi gr4,#4,gr4 + cmp gr4,gr5,icc0 + bne icc0,0,1b + + // Initialize interrupt handlers, etc + li CYGNUM_HAL_ISR_COUNT,gr4 + lda hal_interrupt_handlers,gr5 + subi gr5,4,gr5 + lda hal_default_isr,gr6 + lda hal_vsr_table,gr8 + subi gr8,4,gr8 + // Note: this should be controlled by a CDL option + lda _handle_interrupt,gr9 + setlos #4,gr7 +10: stu gr6,@(gr5,gr7) + stu gr9,@(gr8,gr7) + subi gr4,1,gr4 + cmp gr4,gr0,icc0 + bne icc0,0,10b + + LED 0x0003 + + // Initialize hardware + call hal_hardware_init + + LED 0x0004 + + // Run any C++ initializations + call cyg_hal_invoke_constructors + + LED 0x0005 + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + call initialize_stub +#endif + + LED 0x0006 + + // Start eCos application + call cyg_start + +0: LED 0x0999 // Should never get here + bra 0b + +// +// Interrupt processing +// +_handle_interrupt: + mov sp,gr31 // Save pointer to state frame + movsg lr,gr29 + + // Set the global offset register (gr16) + call 10f +10: movsg lr,gr4 + sethi #gprelhi(10b),gr5 + setlo #gprello(10b),gr5 + sub gr4,gr5,gr16 + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + // Switch to interrupt stack +#endif + // The entire CPU state is now stashed on the stack, + // increment the scheduler lock and handle the interrupt + +#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT + .extern cyg_scheduler_sched_lock + lda cyg_scheduler_sched_lock,gr8 + ldi @(gr8,0),gr9 + addi gr9,1,gr9 + sti gr9,@(gr8,0) +#endif + +#if defined(CYGPKG_KERNEL_INSTRUMENT) && \ + defined(CYGDBG_KERNEL_INSTRUMENT_INTR) + setlos #RAISE_INTR,gr8 // arg0 = type = INTR,RAISE + ldi @(gr31,_TS_VECTOR),gr9 // arg1 = vector + mov gr0,gr10 // arg2 = 0 + call cyg_instrument // call instrument function +#endif + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) \ + || defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) + // If we are supporting Ctrl-C interrupts from GDB, we must squirrel + // away a pointer to the save interrupt state here so that we can + // plant a breakpoint at some later time. + + .extern hal_saved_interrupt_state + lda hal_saved_interrupt_state,gr5 + sti sp,@(gr5,0) +#endif + lda hal_interrupt_data,gr5 + lda hal_interrupt_handlers,gr7 + mov gr30,gr8 // Interrupt vector # + slli gr30,#2,gr4 + ld @(gr5,gr4),gr9 // data pointer + ld @(gr7,gr4),gr6 // function + callil @(gr6,0) + LED 0x0701 + +#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT + // The return value from the handler (in gr8) will indicate whether a + // DSR is to be posted. Pass this together with a pointer to the + // interrupt object we have just used to the interrupt tidy up routine. + + lda hal_interrupt_objects,gr5 + slli gr30,#2,gr4 + ld @(gr5,gr4),gr9 + mov gr31,gr10 // register frame + + call interrupt_end // post any bottom layer handler + // threads and call scheduler +#endif + movgs gr29,lr + ret + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK +// Execute pending DSRs the interrupt stack +// Note: this can only be called from code running on a thread stack + .globl hal_interrupt_stack_call_pending_DSRs +hal_interrupt_stack_call_pending_DSRs: + subi sp,32,sp // Save important registers + movsg lr,gr8 + sti gr8,@(sp,0) + // Turn on interrupts, switch to interrupt stack + call cyg_interrupt_call_pending_DSRs + // Turn off interrupts, switch back to thread stack + ldi @(sp,0),gr8 + movgs gr8,lr + addi sp,32,sp + ret +#endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// +// Restore interrupt state +// GR8 has state +// + .global hal_restore_interrupts +hal_restore_interrupts: + movsg psr,gr4 + setlos _PSR_PIVL_MASK,gr5 + and gr8,gr5,gr8 // Save level being restored + not gr5,gr5 + and gr4,gr5,gr4 // Clear out current level + or gr8,gr4,gr4 // Insert new level + movgs gr4,psr + ret + + .global hal_query_interrupts +hal_query_interrupts: + movsg psr,gr8 + setlos _PSR_PIVL_MASK,gr5 + and gr8,gr5,gr8 + ret + +// +// "Vectors" - fixed location data items +// This section contains any data which might be shared between +// an eCos application and any other environment, e.g. the debug +// ROM. +// + .section ".fixed_vectors" + +// Space for the virtual vectors + .balign 16 +// Vectors used to communicate between eCos and ROM environments + .globl hal_virtual_vector_table +hal_virtual_vector_table: + .rept CYGNUM_CALL_IF_TABLE_SIZE + .long 0 + .endr + + .globl hal_vsr_table +hal_vsr_table: + .rept CYGNUM_HAL_ISR_COUNT // exceptions & interrupts + .long 0 + .endr + + .section ".data" +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + .balign 16 +__GDB_stack_base: + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE // rather than 1k + .byte 0 + .endr +__GDB_stack: +#endif + .balign 16 +__startup_stack_base: +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + .rept 512 +#else + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE +#endif + .byte 0 + .endr + .balign 16 + .global __startup_stack +__startup_stack: + + .globl hal_interrupt_handlers +hal_interrupt_handlers: + .rept CYGNUM_HAL_ISR_COUNT + .long 0 + .endr + + .globl hal_interrupt_data +hal_interrupt_data: + .rept CYGNUM_HAL_ISR_COUNT + .long 0 + .endr + + .globl hal_interrupt_objects +hal_interrupt_objects: + .rept CYGNUM_HAL_ISR_COUNT + .long 0 + .endr diff --git a/packages/hal/frv/frv400/current/ChangeLog b/packages/hal/frv/frv400/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/ChangeLog @@ -0,0 +1,151 @@ +2002-05-07 Gary Thomas + + * cdl/hal_frv_frv400.cdl: + Make CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT more standard. + +2001-12-10 Richard Sandiford + + * src/frv400_misc.c (hal_interrupt_mask): Disable LAN interrupts + in the FPGA's register. + (hal_interrupt_unmask): Re-enable them. + +2001-12-10 Richard Sandiford + + * src/frv400_misc.c (hal_clock_reset): Shift high word of timer left. + (hal_clock_read): Likewise. + (hal_delay_us): Increase timeout. Correct off-by-one error when + time is a multiple of _MIN_DELAY us. + +2001-12-10 Richard Sandiford + + * include/plf_stub.h (HAL_FRV_ENTER_DEBUG_MODE): Remove NOPs. + Mark LR as clobbered due to changes in vectors.S:_break. + (HAL_FRV_EXIT_DEBUG_MODE): Remove NOPs. Don't modify PSR or BPSR. + * src/frv400_misc.c (get_bpsr, set_bpsr): New. + (break_handler): Rework. Set up BPSR to reflect the current + privelege level and trap state before exiting from debug mode. + Re-enter debugging mode and restore the old BPSR before returning. + (cyg_hal_plf_hw_breakpoint): Remove unnecessary DDR diddling. + (cyg_hal_plf_hw_watchpoint): Likewise. + +2001-11-28 Hugo Tyson + + * include/plf_stub.h (HAL_FRV_ENTER_DEBUG_MODE): New macro; simple + performs a "break" to enter debug mode (with cooperation from + RedBoot/stubs/traphandler). + (HAL_FRV_EXIT_DEBUG_MODE): New macro; jumps through hoops to + return to normal mode from debug mode. Can only be used from + debug mode, or the CPU halts. The hoops are on fire. + (HAL_STUB_HW_BREAKPOINT): + (HAL_STUB_HW_WATCHPOINT): + (HAL_STUB_IS_STOPPED_BY_HARDWARE): Defines APIs so that stubs can + set hardware debug support, and tell whether we stopped for a + hardware debug reason. + + * src/frv400_misc.c (break_handler): Special handler for break + instruction and all debug traps, to enable below. + (cyg_hal_plf_hw_breakpoint): + (cyg_hal_plf_hw_watchpoint): + (cyg_hal_plf_is_stopped_by_hardware): New routines to manipulate + hardware debug resources. + + * include/frv400.h (_BRR_SB): Some new symbols for debug regs. + +2001-10-23 Gary Thomas + + * src/frv400_misc.c: Try to avoid [re]init PCI bus. + + * include/frv400.h: Moved common register layouts to 'arch'. + +2001-10-20 Gary Thomas + + * src/frv400_misc.c (hal_delay_us): Handle small delays properly. + +2001-10-19 Julian Smart + + * Added CYPKG_MEMALLOC to redboot_ROMRAM.ecm so the release script + knows about it. + +2001-10-16 Gary Thomas + + * src/frv400_misc.c (_frv400_pci_translate_interrupt): + Handle interrupts from PCI slots. + + * include/plf_ints.h (HAL_PLATFORM_RESET): Remove unused variable. + +2001-10-15 Gary Thomas + + * include/platform.inc: Getting on-board SRAM to function. Of course, + the hardware doesn't match the documentation... + +2001-10-12 Gary Thomas + + * src/frv400_misc.c (hal_interrupt_acknowledge): Fix support for + onboard (LAN) interrupts. + + * include/plf_ints.h: Define PCI based interrupts. + + * src/frv400_misc.c (hal_hardware_init): + * include/frv400.h: Add support for onboard FPGA (local interrupts). + +2001-10-11 Gary Thomas + + * src/frv400_misc.c: Clean up PCI code. + + * misc/redboot_ROMRAM.ecm: Add BSP syscalls. + +2001-10-01 Gary Thomas + + * cdl/hal_frv_frv400.cdl: + * include/pkgconf/mlt_frv_frv400_ram.ldi: + * include/pkgconf/mlt_frv_frv400_rom.ldi: + * include/pkgconf/mlt_frv_frv400_ram.h: + * include/pkgconf/mlt_frv_frv400_rom.h: + * include/pkgconf/mlt_frv_frv400_romram.ldi: + * include/pkgconf/mlt_frv_frv400_romram.h: + * include/plf_ints.h: + * include/platform.inc: + * include/hal_diag.h: + * include/plf_stub.h: + * include/plf_cache.h: + * include/frv400.h: + * include/plf_io.h: + * src/hal_diag.c: + * src/frv400_misc.c: + * misc/redboot_ROMRAM.ecm: + * misc/redboot_RAM.ecm: New port for FRV400. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/frv/frv400/current/cdl/hal_frv_frv400.cdl b/packages/hal/frv/frv400/current/cdl/hal_frv_frv400.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/cdl/hal_frv_frv400.cdl @@ -0,0 +1,372 @@ +# ==================================================================== +# +# hal_frv_frv400.cdl +# +# FRV400 board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): bartv +# Original data: gthomas +# Contributors: +# Date: 2001-09-07 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_FRV_FRV400 { + display "FUJITSU MB93091 (FR-V 400) evaluation board" + parent CYGPKG_HAL_FRV + + define_header hal_frv_frv400.h + include_dir cyg/hal + hardware + description " + The frv400 HAL package provides the support needed to run + eCos on a FUJITSU MB93091 (FR-V 400) eval board." + + compile hal_diag.c frv400_misc.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_FRV_ARCH_FR400 + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLF_DEFS_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_IO_H " + puts $::cdl_header "#define HAL_PLATFORM_CPU \"Fujitsu FR400\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"MB93091-CB10 evaluation board\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + default_value {"RAM"} + legal_values {"RAM" "ROM" "ROMRAM" } + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the MB93091 (FR-V 400) eval board it is possible to build + the system for either RAM bootstrap or ROM bootstrap(s). Select + 'ram' when building programs to load into RAM using onboard + debug software such as Angel or eCos GDB stubs. Select 'rom' + when building a stand-alone application which will be put + into ROM. For the ROMRAM startup type, code will behave as + if in ROM, but will be copied to static RAM on the board before + execution." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 2 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The FRV400 board has two serial ports. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + The FRV400 board has two serial ports. This option + chooses which port will be used for diagnostic output." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGSEM_HAL_DIAG_USES_LEDS { + display "Use LED bank for feedback on serial port use" + flavor bool + default_value 1 + description " + Enable this option to display information in the motherboard + LED array about serial I/O. Indications will be made while + data is being sent and received over the diagnostic serial ports. + This can be useful when the board is talking with GDB, etc." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants" + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data +# Internal clock set up to run at 1MHz + calculated { (1000000/CYGNUM_HAL_RTC_DENOMINATOR) } + } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "frv-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mcpu=fr400 -fPIC -G0 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which are used to + compile all packages by default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-mcpu=fr400 -fPIC -G0 -Wl,--gc-sections -Wl,-static -g -nostdlib" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. This is a bit convoluted as it involves prepending + the image with a special header used by the FRV400 firmware + to keep track of multiple ROM images. This header includes + a checksum making it necessary to build twice." + + make -priority 320 { + /bin/gdb_module.bin : /src/gdb_module.c + @sh -c "mkdir -p src $(dir $@)" + # First build version with no checksum. + $(CC) -c $(INCLUDE_PATH) -Wp,-MD,deps.tmp -I$(dir $<) $(CFLAGS) -o src/gdb_module_ncs.o $< + $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o src/gdb_module_ncs.tmp src/gdb_module_ncs.o + $(OBJCOPY) --strip-debug --change-addresses=0xFBFF4000 src/gdb_module_ncs.tmp src/gdb_module_ncs.img + $(OBJCOPY) -O binary src/gdb_module_ncs.img src/gdb_module_ncs.bin + @rm src/gdb_module_ncs.tmp src/gdb_module_ncs.img + # Prepare dependency file + @echo $@ ": \\" > $(notdir $@).deps + @echo $(wildcard $(PREFIX)/lib/*) " \\" >> $(notdir $@).deps + @tail +2 deps.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm deps.tmp + # Then build version with checksum from previously built image. + $(CC) -c -DCHECKSUM=`$(dir $<)flash_cksum.tcl src/gdb_module_ncs.bin` $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -o src/gdb_module.o $< + $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o src/gdb_module.tmp src/gdb_module.o + $(OBJCOPY) --strip-debug --change-addresses=0xFBFF4000 src/gdb_module.tmp $(@:.bin=.img) + $(OBJCOPY) -O binary $(@:.bin=.img) src/gdb_module.bin + uuencode src/gdb_module.bin gdb_module.bin | tr '`' ' ' > $(@:.bin=.img.UU) + @rm src/gdb_module.tmp src/gdb_module_ncs.bin + @mv src/gdb_module.bin $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { (CYG_HAL_STARTUP == "RAM") ? "frv_frv400_ram" : \ + (CYG_HAL_STARTUP == "ROM") ? "frv_frv400_rom" : \ + (CYG_HAL_STARTUP == "ROMRAM") ? "frv_frv400_romram" : \ + "frv_frv400C_UNKNOWN" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { (CYG_HAL_STARTUP == "RAM") ? "" : \ + (CYG_HAL_STARTUP == "ROM") ? "" : \ + (CYG_HAL_STARTUP == "ROMRAM") ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { (CYG_HAL_STARTUP == "RAM") ? "" : \ + (CYG_HAL_STARTUP == "ROM") ? "" : \ + (CYG_HAL_STARTUP == "ROMRAM") ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" || CYG_HAL_STARTUP == "ROMRAM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"GDB_stubs\" provides support when GDB stubs are included in + the ROM monitor or boot ROM." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + +# compile -library=libextras.a redboot_cmds.c + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } + +} diff --git a/packages/hal/frv/frv400/current/include/frv400.h b/packages/hal/frv/frv400/current/include/frv400.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/frv400.h @@ -0,0 +1,306 @@ +//========================================================================== +// +// frv400.h +// +// HAL misc board support definitions for Fujitsu MB93091 (FR-V 400) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-09-07 +// Purpose: Platform register definitions +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#ifndef __HAL_FRV400_H__ +#define __HAL_FRV400_H__ 1 + +// Common + +// Processor status register +#define _PSR_PIVL_SHIFT 3 +#define _PSR_PIVL_MASK (0xF<<(_PSR_PIVL_SHIFT)) // Interrupt mask level +#define _PSR_S (1<<2) // Supervisor state +#define _PSR_PS (1<<1) // Previous supervisor state +#define _PSR_ET (1<<0) // Enable interrupts + +// Hardware status register +#define _HSR0_ICE (1<<31) // Instruction cache enable +#define _HSR0_DCE (1<<30) // Data cache enable +#define _HSR0_IMMU (1<<26) // Instruction MMU enable +#define _HSR0_DMMU (1<<25) // Data MMU enable + +// Debug Control Register +#define _DCR_EBE (1 << 30) // Exception break enable bit +#define _DCR_SE (1 << 29) // Single-step break enable bit +#define _DCR_IBM (1 << 28) // Instruction Break Mask (disable bit) +#define _DCR_DRBE0 (1 << 19) // READ dbar0 +#define _DCR_DWBE0 (1 << 18) // WRITE dbar0 +#define _DCR_DDBE0 (1 << 17) // Data-match for access to dbar0 +#define _DCR_DBASE0 (1 << 17) // offset +#define _DCR_DRBE1 (1 << 16) +#define _DCR_DWBE1 (1 << 15) +#define _DCR_DDBE1 (1 << 14) +#define _DCR_DBASE1 (1 << 14) +//#define _DCR_DRBE2 (1 << 13) // 2 and 3 not supported in real hardware +//#define _DCR_DWBE2 (1 << 12) +//#define _DCR_DDBE2 (1 << 11) +//#define _DCR_DRBE3 (1 << 10) +//#define _DCR_DWBE3 (1 << 9) +//#define _DCR_DDBE3 (1 << 8) +#define _DCR_IBE0 (1 << 7) +#define _DCR_IBCE0 (1 << 6) +#define _DCR_IBE1 (1 << 5) +#define _DCR_IBCE1 (1 << 4) +#define _DCR_IBE2 (1 << 3) +#define _DCR_IBCE2 (1 << 2) +#define _DCR_IBE3 (1 << 1) +#define _DCR_IBCE3 (1 << 0) + +// Break PSR Save Register +#define _BPSR_BS (1 << 12) +#define _BPSR_BET (1 << 0) + +// Break Request Register +#define _BRR_EB (1 << 30) +#define _BRR_CB (1 << 29) +#define _BRR_TB (1 << 28) +#define _BRR_DB0 (1 << 11) +#define _BRR_DB1 (1 << 10) +#define _BRR_IB0 (1 << 7) +#define _BRR_IB1 (1 << 6) +#define _BRR_IB2 (1 << 5) +#define _BRR_IB3 (1 << 4) +#define _BRR_CBB (1 << 3) +#define _BRR_BB (1 << 2) +#define _BRR_SB (1 << 1) +#define _BRR_ST (1 << 0) + + +// Platform specifics + +// SDRAM Controller +#define _FRV400_SDRAM_CP 0xFE000400 // Controller protect +#define _FRV400_SDRAM_CFG 0xFE000410 // Configuration +#define _FRV400_SDRAM_CTL 0xFE000418 // Control +#define _FRV400_SDRAM_MS 0xFE000420 // Mode select +#define _FRV400_SDRAM_STS 0xFE000428 // Status +#define _FRV400_SDRAM_RCN 0xFE000430 // Refresh control +#define _FRV400_SDRAM_ART 0xFE000438 // Auto-refresh timer +#define _FRV400_SDRAM_AN0 0xFE000500 // Address #0 +#define _FRV400_SDRAM_AN1 0xFE000508 // Address #1 +#define _FRV400_SDRAM_BR0 0xFE000E00 // Base register #0 +#define _FRV400_SDRAM_BR1 0xFE000E08 // Base register #1 +#define _FRV400_SDRAM_AM0 0xFE000F00 // Address mask #0 +#define _FRV400_SDRAM_AM1 0xFE000F08 // Address mask #1 + +// Local bus control +#define _FRV400_LBUS_CP 0xFE000000 // Controller protect +#define _FRV400_LBUS_EST 0xFE000020 // Error status +#define _FRV400_LBUS_EAD 0xFE000028 // Error address +#define _FRV400_LBUS_CR0 0xFE000100 // Configuration - space #0 +#define _FRV400_LBUS_CR1 0xFE000108 // Configuration - space #1 +#define _FRV400_LBUS_CR2 0xFE000110 // Configuration - space #2 +#define _FRV400_LBUS_CR3 0xFE000118 // Configuration - space #3 +#define _FRV400_LBUS_BR0 0xFE000C00 // Slave - base address #0 +#define _FRV400_LBUS_BR1 0xFE000C08 // Slave - base address #1 +#define _FRV400_LBUS_BR2 0xFE000C10 // Slave - base address #2 +#define _FRV400_LBUS_BR3 0xFE000C18 // Slave - base address #3 +#define _FRV400_LBUS_AM0 0xFE000D00 // Slave - address mask #0 +#define _FRV400_LBUS_AM1 0xFE000D08 // Slave - address mask #1 +#define _FRV400_LBUS_AM2 0xFE000D10 // Slave - address mask #2 +#define _FRV400_LBUS_AM3 0xFE000D18 // Slave - address mask #3 + +// PCI Bridge (on motherboard) +#define _FRV400_PCI_SLBUS_CONFIG 0x10000000 +#define _FRV400_PCI_ECS0_CONFIG 0x10000008 +#define _FRV400_PCI_ECS1_CONFIG 0x10000010 +#define _FRV400_PCI_ECS2_CONFIG 0x10000018 +#define _FRV400_PCI_ECS0_RANGE 0x10000020 +#define _FRV400_PCI_ECS0_ADDR 0x10000028 +#define _FRV400_PCI_ECS1_RANGE 0x10000030 +#define _FRV400_PCI_ECS1_ADDR 0x10000038 +#define _FRV400_PCI_ECS2_RANGE 0x10000040 +#define _FRV400_PCI_ECS2_ADDR 0x10000048 +#define _FRV400_PCI_PCIIO_RANGE 0x10000050 +#define _FRV400_PCI_PCIIO_ADDR 0x10000058 +#define _FRV400_PCI_PCIMEM_RANGE 0x10000060 +#define _FRV400_PCI_PCIMEM_ADDR 0x10000068 +#define _FRV400_PCI_PCIIO_PCI_ADDR 0x10000070 +#define _FRV400_PCI_PCIMEM_PCI_ADDR 0x10000078 +#define _FRV400_PCI_CONFIG_ADDR 0x10000080 +#define _FRV400_PCI_CONFIG_DATA 0x10000088 + +#define _FRV400_PCI_SL_TO_PCI_MBX0 0x10000500 +#define _FRV400_PCI_SL_TO_PCI_MBX1 0x10000508 +#define _FRV400_PCI_SL_TO_PCI_MBX2 0x10000510 +#define _FRV400_PCI_SL_TO_PCI_MBX3 0x10000518 +#define _FRV400_PCI_SL_TO_PCI_MBX4 0x10000520 +#define _FRV400_PCI_SL_TO_PCI_MBX5 0x10000528 +#define _FRV400_PCI_SL_TO_PCI_MBX6 0x10000530 +#define _FRV400_PCI_SL_TO_PCI_MBX7 0x10000538 +#define _FRV400_PCI_PCI_TO_SL_MBX0 0x10000540 +#define _FRV400_PCI_PCI_TO_SL_MBX1 0x10000548 +#define _FRV400_PCI_PCI_TO_SL_MBX2 0x10000550 +#define _FRV400_PCI_PCI_TO_SL_MBX3 0x10000558 +#define _FRV400_PCI_PCI_TO_SL_MBX4 0x10000560 +#define _FRV400_PCI_PCI_TO_SL_MBX5 0x10000568 +#define _FRV400_PCI_PCI_TO_SL_MBX6 0x10000570 +#define _FRV400_PCI_PCI_TO_SL_MBX7 0x10000578 +#define _FRV400_PCI_MBX_STATUS 0x10000580 +#define _FRV400_PCI_MBX_CONTROL 0x10000588 +#define _FRV400_PCI_SL_TO_PCI_DOORBELL 0x10000590 +#define _FRV400_PCI_PCI_TO_SL_DOORBELL 0x10000598 +#define _FRV400_PCI_SL_INT_STATUS 0x100005A0 +#define _FRV400_PCI_SL_INT_STATUS_MASTER_ABORT (1<<26) +#define _FRV400_PCI_PCI_INT_STATUS 0x100005A8 +#define _FRV400_PCI_SL_INT_ENABLE 0x100005B0 +#define _FRV400_PCI_PCI_INT_ENABLE 0x100005B8 + +#define _FRV400_PCI_CONFIG 0x10000800 +#define _FRV400_PCI_DEVICE_VENDOR 0x10000800 +#define _FRV400_PCI_STAT_CMD 0x10000808 +#define _FRV400_PCI_STAT_ERROR_MASK 0xF000 +#define _FRV400_PCI_CLASS_REV 0x10000810 +#define _FRV400_PCI_BIST 0x10000818 +#define _FRV400_PCI_PCI_IO_MAPPED 0x10000820 +#define _FRV400_PCI_PCI_MEM_MAP_LO 0x10000828 +#define _FRV400_PCI_PCI_ECS0_LO 0x10000838 +#define _FRV400_PCI_PCI_ECS1_LO 0x10000840 +#define _FRV400_PCI_PCI_ECS2_LO 0x10000848 +#define _FRV400_PCI_MAX_LAT 0x10000878 +#define _FRV400_PCI_TMO_RETRY 0x10000880 +#define _FRV400_PCI_SERR_ENABLE 0x10000888 +#define _FRV400_PCI_RESET 0x10000890 +#define _FRV400_PCI_RESET_SRST 0x00000001 // Assert soft reset +#define _FRV400_PCI_PCI_MEM_MAP_HI 0x10000898 +#define _FRV400_PCI_PCI_ECS0_HI 0x100008A8 +#define _FRV400_PCI_PCI_ECS1_HI 0x100008B0 +#define _FRV400_PCI_PCI_ECS2_HI 0x100008B8 + +// Motherboard resources +#define _FRV400_MB_SWGP 0x21200000 // General purpose switches +#define _FRV400_MB_LEDS 0x21200004 // LED array - 16 bits 0->on +#define _FRV400_MB_LCD 0x21200008 // LCD panel +#define _FRV400_MB_BOOT_MODE 0x21300004 // Boot mode register +#define _FRV400_MB_H_RESET 0x21300008 // Hardware reset +#define _FRV400_MB_CLKSW 0x2130000C // Clock settings +#define _FRV400_MB_PCI_ARBITER 0x21300014 // Enable PCI arbiter mode + +// Serial ports - 16550 compatible +#define _FRV400_UART0 0xFEFF9C00 +#define _FRV400_UART1 0xFEFF9C40 + +// Programmable timers +#define _FRV400_TCSR0 0xFEFF9400 // Timer 0 control/status +#define _FRV400_TCSR1 0xFEFF9408 // Timer 1 control/status +#define _FRV400_TCSR2 0xFEFF9410 // Timer 2 control/status +#define _FRV400_TCxSR_TOUT 0x80 // Status - TOUT signal +#define _FRV400_TCTR 0xFEFF9418 // Timer control +#define _FRV400_TCTR_SEL0 (0<<6) // Select timer 0 +#define _FRV400_TCTR_SEL1 (1<<6) // Select timer 1 +#define _FRV400_TCTR_SEL2 (2<<6) // Select timer 2 +#define _FRV400_TCTR_RB (3<<6) // Timer read back +#define _FRV400_TCTR_RB_NCOUNT (1<<5) // Count data suppress +#define _FRV400_TCTR_RB_NSTATUS (1<<4) // Status data suppress +#define _FRV400_TCTR_RB_CTR2 (1<<3) // Read data for counter #2 +#define _FRV400_TCTR_RB_CTR1 (1<<2) // Read data for counter #1 +#define _FRV400_TCTR_RB_CTR0 (1<<1) // Read data for counter #0 +#define _FRV400_TCTR_LATCH (0<<4) // Counter latch command +#define _FRV400_TCTR_R8LO (1<<4) // Read low 8 bits +#define _FRV400_TCTR_R8HI (2<<4) // Read high 8 bits +#define _FRV400_TCTR_RLOHI (3<<4) // Read/write 8 lo then 8 hi +#define _FRV400_TCTR_MODE0 (0<<1) // Mode 0 - terminal interrupt count +#define _FRV400_TCTR_MODE2 (2<<1) // Mode 2 - rate generator +#define _FRV400_TCTR_MODE4 (4<<1) // Mode 4 - software trigger strobe +#define _FRV400_TCTR_MODE5 (5<<1) // Mode 5 - hardware trigger strobe +#define _FRV400_TPRV 0xFEFF9420 // Timer prescale +#define _FRV400_TPRCKSL 0xFEFF9428 // Prescale clock +#define _FRV400_TCKSL0 0xFEFF9430 // Timer 0 clock select +#define _FRV400_TCKSL1 0xFEFF9438 // Timer 1 clock select +#define _FRV400_TCKSL2 0xFEFF9440 // Timer 2 clock select + +// Interrupt & clock control +#define _FRV400_CLK_CTRL 0xFEFF9A00 // Clock control +#define _FRV400_IRC_TM0 0xFEFF9800 // Trigger mode 0 register (unused) +#define _FRV400_IRC_TM1 0xFEFF9808 // Trigger mode 1 register +#define _FRV400_IRC_RS 0xFEFF9810 // Request sense +#define _FRV400_IRC_RC 0xFEFF9818 // Request clear +#define _FRV400_IRC_MASK 0xFEFF9820 // Mask +#define _FRV400_IRC_IRL 0xFEFF9828 // Interrupt level read (encoded) +#define _FRV400_IRC_IRR0 0xFEFF9840 // Interrupt routing #0 (unused) +#define _FRV400_IRC_IRR1 0xFEFF9848 // Interrupt routing #1 (unused) +#define _FRV400_IRC_IRR2 0xFEFF9850 // Interrupt routing #2 (unused) +#define _FRV400_IRC_IRR3 0xFEFF9858 // Interrupt routing #3 +#define _FRV400_IRC_IRR4 0xFEFF9860 // Interrupt routing #4 +#define _FRV400_IRC_IRR5 0xFEFF9868 // Interrupt routing #5 +#define _FRV400_IRC_IRR6 0xFEFF9870 // Interrupt routing #6 +#define _FRV400_IRC_IRR7 0xFEFF9878 // Interrupt routing #7 +#define _FRV400_IRC_ITM0 0xFEFF9880 // Internal trigger mode #0 +#define _FRV400_IRC_ITM1 0xFEFF9888 // Internal trigger mode #1 + +// Some GPIO magic +#define _FRV400_GPIO_SIR 0xFEFF0410 // Special input signals +#define _FRV400_GPIO_SOR 0xFEFF0418 // Special output signals + +// Reset register +#define _FRV400_HW_RESET 0xFEFF0500 // Hardware reset +#define _FRV400_HW_RESET_STAT_P (1<<10) // Last reset was power-on +#define _FRV400_HW_RESET_STAT_H (1<<9) // Last reset was hard reset +#define _FRV400_HW_RESET_STAT_S (1<<8) // Last reset was soft reset +#define _FRV400_HW_RESET_HR (1<<1) // Force hard reset +#define _FRV400_HW_RESET_SR (1<<0) // Force soft reset + +// On-board FPGA +#define _FRV400_FPGA_CONTROL 0xFFC00000 // Access control for FPGA resources +#define _FRV400_FPGA_CONTROL_IRQ (1<<2) // Set to enable IRQ registers +#define _FRV400_FPGA_CONTROL_CS4 (1<<1) // Set to enable CS4 control regs +#define _FRV400_FPGA_CONTROL_CS5 (1<<0) // Set to enable CS5 control regs +#define _FRV400_FPGA_IRQ_MASK 0xFFC00004 // Set bits to 0 to allow interrupt +#define _FRV400_FPGA_IRQ_LEVELS 0xFFC00008 // 0=>active low, 1=>active high +#define _FRV400_FPGA_IRQ_REQUEST 0xFFC0000C // read: 1=>asserted, write: 0=>clears +#define _FRV400_FPGA_IRQ_LAN (1<<12) // Onboard LAN controller +#define _FRV400_FPGA_IRQ_INTA (1<<6) // PCI bus INTA +#define _FRV400_FPGA_IRQ_INTB (1<<5) // PCI bus INTA +#define _FRV400_FPGA_IRQ_INTC (1<<4) // PCI bus INTA +#define _FRV400_FPGA_IRQ_INTD (1<<3) // PCI bus INTA + +#endif /* __HAL_FRV400_H__ */ diff --git a/packages/hal/frv/frv400/current/include/hal_diag.h b/packages/hal/frv/frv400/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/hal_diag.h @@ -0,0 +1,94 @@ +#ifndef CYGONCE_HAL_DIAG_H +#define CYGONCE_HAL_DIAG_H + +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors: nickg, gthomas +// Date: 1998-09-11 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include +#include + +/*---------------------------------------------------------------------------*/ + +#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +// Not the best place for this, but ... +extern void hal_delay_us(cyg_int32 usecs); + +#define HAL_DELAY_US(n) hal_delay_us(n); + +#else + +/*---------------------------------------------------------------------------*/ +/* functions implemented in hal_diag.c */ + +externC void hal_diag_init(void); +externC void hal_diag_write_char(char c); +externC void hal_diag_read_char(char *c); + +#define HAL_DIAG_INIT() hal_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +#endif + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_DIAG_H */ diff --git a/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_ram.h b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_ram.h @@ -0,0 +1,17 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x03E00000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x03E000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_ram.ldi b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_ram.ldi @@ -0,0 +1,29 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#include + +// Space for PCI window, RedBoot + +MEMORY +{ + ram : ORIGIN = 0x0000, LENGTH = 0x03E00000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram, 0x1000, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x20000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x1000); + SECTIONS_END +} diff --git a/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_rom.h b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_rom.h @@ -0,0 +1,17 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x03F00000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x03F00000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_rom.ldi b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_rom.ldi @@ -0,0 +1,28 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x0000, LENGTH = 0x03F00000 + rom : ORIGIN = 0xff000000, LENGTH = 0x00200000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0xFF000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x1000, LMA_EQ_VMA) + SECTION_data (ram, 0x2000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x1000); + SECTIONS_END +} diff --git a/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_romram.h b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_romram.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_romram.h @@ -0,0 +1,17 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x03E00000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x03E00000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_romram.ldi b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_romram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/pkgconf/mlt_frv_frv400_romram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Fri Oct 20 05:56:24 2000 + +// This is a generated file - do not edit + +#include + +// Leave room for PCI window at 0x03F00000 + +MEMORY +{ + ram : ORIGIN = 0x0000, LENGTH = 0x03E00000 + rom : ORIGIN = 0x03E00000, LENGTH = 0x00100000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x03E00000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram, 0x1000, LMA_EQ_VMA) + SECTION_data (ram, 0x2000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x1000); + SECTIONS_END +} diff --git a/packages/hal/frv/frv400/current/include/platform.inc b/packages/hal/frv/frv400/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/platform.inc @@ -0,0 +1,172 @@ +#ifndef _CYGONCE_PLATFORM_INC_H_ +#define _CYGONCE_PLATFORM_INC_H_ +// #======================================================================== +// # +// # platform.inc +// # +// # Fujitsu platform specific setups (assembler macros) +// # +// #======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +// #======================================================================== +// ######DESCRIPTIONBEGIN#### +// # +// # Author(s): gthomas +// # Contributors: gthomas +// # Date: 2001-09-16 +// # Purpose: Fujitsu (FRV400) platform specific setups +// # Description: This file defines various macros used by the generic +// # HAL startup code. +// # +// #####DESCRIPTIONEND#### +// # +// #======================================================================== + +// Display a value in the system LEDs + .macro LED n + sethi #(_FRV400_MB_LEDS>>16),gr15 + setlo #(_FRV400_MB_LEDS&0xFFFF),gr15 + setlos #\n,gr14 + not gr14,gr14 + sti gr14,@(gr15,0) + .endm + +// Platform initialization - only the necessary bits required to get the +// board started from a cold reset. + .macro platform_init + li 0x7FFF,gr4 // First, a good long spin +05: nop + subi gr4,1,gr4 + cmp gr4,gr0,icc0 + bne icc0,0,05b + call 10f // position independent way to get @_platform_tab +_platform_tab: +// +// SDRAM setups +// + .long _FRV400_SDRAM_BR0,0x00000000 // SDRAM 0x0XXXXXXX + .long _FRV400_SDRAM_AM0,0x0FF00000 + +// +// LOCAL bus setups +// + .long _FRV400_LBUS_CR0,0x03010D01 // ROM/FLASH 0xFF000000..0xFFFFFFFF + // 16 bits wide, 13 wait states, 1 idle + + .long _FRV400_LBUS_BR1,0x10000000 // PCI bridge 0x10000000..0x100FFFFF + .long _FRV400_LBUS_AM1,0x000FFFFF + .long _FRV400_LBUS_CR1,0x00000000 + + .long _FRV400_LBUS_BR2,0x20000000 // SRAM, FPGA, PCI 0x20000000..0x2FFFFFFF + .long _FRV400_LBUS_AM2,0x0FFFFFFF + .long _FRV400_LBUS_CR2,0x00000000 + + .long _FRV400_LBUS_BR3,0x00000000 // SDRAM? + .long _FRV400_LBUS_AM3,0xFFFFFFFF + .long _FRV400_LBUS_CR3,0x00000F07 + + .long _FRV400_GPIO_SIR,0x000c954f // Routing for Rx0, Rx1, CTS + .long _FRV400_GPIO_SOR,0x00036ab0 // Routing for Tx0, Tx1, RTS, TOUT0, TOUT1 + + .long _FRV400_SDRAM_CTL,0x05022000 // SDRAM mode/control + .long _FRV400_SDRAM_AN0,0x00010101 + .long _FRV400_SDRAM_ART,0x00000820 + .long _FRV400_SDRAM_RCN,0x00000000 + .long _FRV400_SDRAM_MS, 0x00020200 + .long _FRV400_SDRAM_CFG,0x80000000 + +//? .long _FRV400_CLK_CTRL,0x00000001 // External clock divisor (/2) + +// +// PCI controller/bridge +// + .long _FRV400_PCI_SLBUS_CONFIG, 0x000800E2 // This matches the docs +// .long _FRV400_PCI_SLBUS_CONFIG, 0x000000E0 // This matches the samples + .long _FRV400_PCI_ECS0_CONFIG, 0x00000000 + .long _FRV400_PCI_ECS1_CONFIG, 0x000003C1 + .long _FRV400_PCI_ECS2_CONFIG, 0x000001C1 + .long _FRV400_PCI_ECS0_RANGE, 0x00000000 + .long _FRV400_PCI_ECS0_ADDR, 0x00000000 + .long _FRV400_PCI_ECS1_RANGE, 0x00007FFE + .long _FRV400_PCI_ECS1_ADDR, 0x08108000 + .long _FRV400_PCI_ECS2_RANGE, 0x00007FFE + .long _FRV400_PCI_ECS2_ADDR, 0x08100000 + .long _FRV400_PCI_PCIIO_RANGE, 0x0001FFFE + .long _FRV400_PCI_PCIIO_ADDR, 0x00120000 + .long _FRV400_PCI_PCIMEM_RANGE, 0x0003FFFE + .long _FRV400_PCI_PCIMEM_ADDR, 0x00140000 + .long _FRV400_PCI_PCIIO_PCI_ADDR, 0x24000001 + .long _FRV400_PCI_PCIMEM_PCI_ADDR, 0x28000000 + .long _FRV400_MB_PCI_ARBITER, 0x00000001 + .long _FRV400_MB_PCI_ARBITER, 0x00000001 + + .long _FRV400_PCI_SLBUS_CONFIG, 0x800800E2 +// .long _FRV400_PCI_SLBUS_CONFIG, 0x800000E0 + .long 0 + .long _FRV400_SDRAM_STS + +10: movsg lr,gr4 // _platform_tab -> list of initializations +20: ldi @(gr4,0),gr5 // Register + ldi @(gr4,4),gr6 // Value + cmp gr5,gr0,icc0 // End of list? + beq icc0,0,30f + sti gr6,@(gr5,0) + addi gr4,2*4,gr4 + bra 20b // Next item +30: ldi @(gr6,0),gr5 // gr6 == _FRV400_SDRAM_STS + cmp gr5,gr0,icc0 + bne icc0,0,30b // Wait for SDRAM ready + +// +// Note: it is unclear from the documentation if this works at all. There is no +// description of how these registers are searched and what would happen if they +// overlap. If it turns out that they are not allowed to overlap, then this setup +// will have to be restructured. +// + li 0x03F0003D,gr4 // Set 0x03FXXXXX supervisor only, no cache - PCI window (1MB) + movgs gr4,DAMPR0 + li 0x000000C9,gr4 // Set 0x0XXXXXXX supervisor only, cache - SDRAM + movgs gr4,DAMPR1 + li 0x200000BD,gr4 // Set 0x2XXXXXXX supervisor only, no cache - Motherboard resources + movgs gr4,DAMPR6 + li 0x100000BD,gr4 // Set 0x1XXXXXXX supervisor only, no cache - PCI bridge + movgs gr4,DAMPR7 + movsg hsr0,gr4 + li (1<<25),gr5 // Enable data MMU + or gr4,gr5,gr4 + movgs gr4,hsr0 + + .endm + +#endif // _CYGONCE_PLATFORM_INC_H_ diff --git a/packages/hal/frv/frv400/current/include/plf_cache.h b/packages/hal/frv/frv400/current/include/plf_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/plf_cache.h @@ -0,0 +1,77 @@ +#ifndef CYGONCE_PLF_CACHE_H +#define CYGONCE_PLF_CACHE_H + +//============================================================================= +// +// plf_cache.h +// +// HAL cache control API - Platform specifics +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors:hmt +// Date: 2001-09-13 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//----------------------------------------------------------------------------- +// Cache dimensions + +#define HAL_ICACHE_SIZE (8*1024) +#define HAL_ICACHE_LINE_SIZE 32 +#define HAL_ICACHE_WAYS 2 +#define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS)) + +#define HAL_DCACHE_SIZE (8*1024) +#define HAL_DCACHE_LINE_SIZE 32 +#define HAL_DCACHE_WAYS 2 +#define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS)) + +// No memory mapping on this platform +#define hal_virt_to_phys_address(virt) (virt) + +#endif // CYGONCE_PLF_CACHE_H diff --git a/packages/hal/frv/frv400/current/include/plf_ints.h b/packages/hal/frv/frv400/current/include/plf_ints.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/plf_ints.h @@ -0,0 +1,108 @@ +#ifndef CYGONCE_PLF_INTS_H +#define CYGONCE_PLF_INTS_H +//========================================================================== +// +// plf_ints.h +// +// HAL extended support for platform specific interrupts +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-02-24 +// Purpose: Define Interrupt support +// Description: The interrupt details for the MB93091 (FRV400) are defined here. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Define here extended support for this particular platform + +// Interrupts are mapped onto "channels" by the interrupt controller +// The channel in turn is presented to the CPU as a "level" which can +// be masked. The eCos interrupt names below are for the default mapping +// of interrupt sources to channels. + +#define CYGNUM_HAL_INTERRUPT_TIMER0 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_14 +#define CYGNUM_HAL_INTERRUPT_TIMER1 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_13 +#define CYGNUM_HAL_INTERRUPT_TIMER2 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_12 +#define CYGNUM_HAL_INTERRUPT_DMA0 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_11 +#define CYGNUM_HAL_INTERRUPT_DMA1 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_10 +#define CYGNUM_HAL_INTERRUPT_DMA2 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_9 +#define CYGNUM_HAL_INTERRUPT_DMA3 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_8 +#define CYGNUM_HAL_INTERRUPT_UART0 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_2 +#define CYGNUM_HAL_INTERRUPT_UART1 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1 +#define CYGNUM_HAL_INTERRUPT_EXT0 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_7 +#define CYGNUM_HAL_INTERRUPT_EXT1 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_6 +#define CYGNUM_HAL_INTERRUPT_EXT2 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_5 +#define CYGNUM_HAL_INTERRUPT_EXT3 CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_4 + +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_TIMER1 +#define CYGNUM_HAL_INTERRUPT_SERIALA CYGNUM_HAL_INTERRUPT_UART0 +#define CYGNUM_HAL_INTERRUPT_SERIALB CYGNUM_HAL_INTERRUPT_UART1 +#define CYGNUM_HAL_INTERRUPT_LAN CYGNUM_HAL_INTERRUPT_EXT2 +#define CYGNUM_HAL_INTERRUPT_PCIINTA CYGNUM_HAL_INTERRUPT_EXT1 +#define CYGNUM_HAL_INTERRUPT_PCIINTB CYGNUM_HAL_INTERRUPT_EXT0 +#define CYGNUM_HAL_INTERRUPT_PCIINTC CYGNUM_HAL_INTERRUPT_EXT1 +#define CYGNUM_HAL_INTERRUPT_PCIINTD CYGNUM_HAL_INTERRUPT_EXT0 + + +//---------------------------------------------------------------------------- +// Reset. +#define HAL_PLATFORM_RESET() \ + CYG_MACRO_START \ + cyg_uint32 ctrl; \ + \ + /* By disabling interupts we will just hang in the loop below */ \ + /* if for some reason the software reset fails. */ \ + HAL_DISABLE_INTERRUPTS(ctrl); \ + \ + /* Software reset. */ \ + HAL_WRITE_UINT32(_FRV400_HW_RESET, _FRV400_HW_RESET_HR); \ + \ + for(;;); /* hang here forever if reset fails */ \ + CYG_MACRO_END + +#define HAL_PLATFORM_RESET_ENTRY 0xFF000000 + +#endif // CYGONCE_PLF_INTS_H diff --git a/packages/hal/frv/frv400/current/include/plf_io.h b/packages/hal/frv/frv400/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/plf_io.h @@ -0,0 +1,126 @@ +#ifndef CYGONCE_PLF_IO_H +#define CYGONCE_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// Platform specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, jskov +// Contributors: hmt, jskov, gthomas +// Date: 1999-08-09 +// Purpose: Fujitsu FR-V400 PCI IO support macros +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include CYGBLD_HAL_PLATFORM_H +#include CYGBLD_HAL_PLF_DEFS_H + +#include // IO macros +#include // Interrupt vectors + +// Restrict device [slot] space +#define CYG_PCI_MAX_BUS 1 // Only one BUS +#define CYG_PCI_MIN_DEV 16 // Slots start at 16 +#define CYG_PCI_MAX_DEV 21 // ... and end at 20 + +//----------------------------------------------------------------------------- +// Resources + +// Map PCI device resources starting from these addresses in PCI space. +#define HAL_PCI_ALLOC_BASE_MEMORY 0x28000000 +#define HAL_PCI_ALLOC_BASE_IO 0x24000000 + +// This is where the PCI spaces are mapped in the CPU's address space. +#define HAL_PCI_PHYSICAL_MEMORY_BASE 0 // 0x28000000 +#define HAL_PCI_PHYSICAL_IO_BASE 0 // 0x24000000 + +// These seem to be defined multiple ways? +#define CYGMEM_SECTION_pci_window 0x03F00000 +#define CYGMEM_SECTION_pci_window_SIZE 0x00100000 +#define CYGHWR_HAL_FRV_FRV400_PCI_MEM_MAP_BASE 0x03F00000 +#define CYGHWR_HAL_FRV_FRV400_PCI_MEM_MAP_SIZE 0x00100000 + +// Initialize the PCI environment +externC void _frv400_pci_init(void); +#define HAL_PCI_INIT() \ + _frv400_pci_init() + +// Translate the PCI interrupt requested by the device (INTA#, INTB#, +// INTC# or INTD#) to the associated CPU interrupt (i.e., HAL vector). +externC void _frv400_pci_translate_interrupt(int bus, int devfn, int *vec, int *valid); +#define HAL_PCI_TRANSLATE_INTERRUPT( __bus, __devfn, __vec, __valid) \ + _frv400_pci_translate_interrupt(__bus, __devfn, &__vec, &__valid) + +// Read a value from the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +externC cyg_uint8 _frv400_pci_cfg_read_uint8(int bus, int dev, int offset); +#define HAL_PCI_CFG_READ_UINT8( __bus, __devfn, __offset, __val ) \ + __val = _frv400_pci_cfg_read_uint8(__bus, __devfn, __offset) + +externC cyg_uint16 _frv400_pci_cfg_read_uint16(int bus, int dev, int offset); +#define HAL_PCI_CFG_READ_UINT16( __bus, __devfn, __offset, __val ) \ + __val = _frv400_pci_cfg_read_uint16(__bus, __devfn, __offset) + +externC cyg_uint32 _frv400_pci_cfg_read_uint32(int bus, int dev, int offset); +#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \ + __val = _frv400_pci_cfg_read_uint32(__bus, __devfn, __offset) + +// Write a value to the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +externC void _frv400_pci_cfg_write_uint8(int bus, int dev, int offset, cyg_uint8 val); +#define HAL_PCI_CFG_WRITE_UINT8( __bus, __devfn, __offset, __val ) \ + _frv400_pci_cfg_write_uint8(__bus, __devfn, __offset, __val) + +externC void _frv400_pci_cfg_write_uint16(int bus, int dev, int offset, cyg_uint16 val); +#define HAL_PCI_CFG_WRITE_UINT16( __bus, __devfn, __offset, __val ) \ + _frv400_pci_cfg_write_uint16(__bus, __devfn, __offset, __val) + +externC void _frv400_pci_cfg_write_uint32(int bus, int dev, int offset, cyg_uint32 val); +#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \ + _frv400_pci_cfg_write_uint32(__bus, __devfn, __offset, __val) + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_PLF_IO_H diff --git a/packages/hal/frv/frv400/current/include/plf_stub.h b/packages/hal/frv/frv400/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/include/plf_stub.h @@ -0,0 +1,111 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors:jskov +// Date: 2001-09-14 +// Purpose: Platform HAL stub support for Fujitsu FRV-400 +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include // CYG_UNUSED_PARAM + +//#include // IO macros +//#include // Interrupt macros +#include // architecture stub support + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +// --------------------------------------------------------------------------- +// Hardware breakpoint/watchpoint support +extern int cyg_hal_plf_hw_breakpoint(int setflag, void *addr, int len); +extern int cyg_hal_plf_hw_watchpoint(int setflag, void *addr, int len, int type); +extern int cyg_hal_plf_is_stopped_by_hardware(void **paddr); + +#define HAL_STUB_HW_BREAKPOINT(f,a,l) cyg_hal_plf_hw_breakpoint((f),(a),(l)) +#define HAL_STUB_HW_WATCHPOINT(f,a,l,t) cyg_hal_plf_hw_watchpoint((f),(a),(l),(t)) +#define HAL_STUB_IS_STOPPED_BY_HARDWARE(p) cyg_hal_plf_is_stopped_by_hardware(&(p)) + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +// ------------------------------------------------------------------------ +// Horrid stuff to enter and exit debug mode + +#define HAL_FRV_ENTER_DEBUG_MODE() asm volatile ("break" : : : "lr") + +#define HAL_FRV_EXIT_DEBUG_MODE() \ + asm volatile ( \ + "\t call 10f \n" \ + "10:\t movsg lr, gr6 \n" /* get local addr */ \ + "\t addi gr6, #16, gr6 \n" /* skip past rett */ \ + "\t movgs gr6, bpcsr \n" /* Break PC save reg */ \ + "\t rett #1 \n" \ + : \ + : \ + : "gr6","lr" /* clobber list */ \ + ) + + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/frv/frv400/current/misc/install_notes b/packages/hal/frv/frv400/current/misc/install_notes new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/misc/install_notes @@ -0,0 +1,162 @@ +3 October, 2001 + +Installing RedBoot on Fujitsu FRV400 system. + +Orient the motherboard like this: + ++-------------------------------------------------------------+ +| | +| |========================| |==========================| | +| |========================| |==========================| | +| CPU board | +| +-+-+ | +| |o|o| | +| |o|o| | +| |o|o| | +| |o|o| +-+ | +| |o|o| |o| Special power | +| |o|o| |o| cable to CPU board | +| |o|o| |o| | +| |o|o| |o| | +| +-+-+ +-+ | +| | +| ATX | +|Power | +| +------------------------------+ | +| | | | | +| +------------------------------+ | +| PCI slot | +| | +| +------------------------------+ | +| | | | | +| +------------------------------+ | +| PCI slot | +| | +| +------------------------------+ | +| | | | | +| +------------------------------+ | +| PCI slot | +| | +| +--------+ +--------+ +--------+ | +| |xxoooooX| |oooooooo| |xxoxxxxx| R1 | +| +--------+ +--------+ +--------+ R | +| SW1 CLK1 CLK2 R SS==] +| R SS ] +| R SS ] +| R SS==] +| R | +| | +| | +| | ++-------------------------------------------------------------+ + +For the switches, x is down (on this diagram), o is up and X +will be both. + +There is also a ribbon cable from the CPU board to the serial +connectors. Orient this cable so that the red stripe connects +to pin R1 and is at the bottom of the CPU board. Directions +are in the hardware installation guide, but this part wasn't +terribly clear to me. + +1. Bring up the existing Fujitsu board monitor. + + Attach a serial cable to the top serial port - 38400/8N1. + Make sure that SW1-1 (X above) is up. + Turn on power. You will also have to press the RED button. + +2. Download RedBoot into the FLASH. + + Using the attached programs (minicom has a terrible time + with ASCII downloads - use these instead), download the + frv.ROM image. Use these commands + + ************************************************************* + ** VDK LOADER for FR400 (BOOT ROM:IC8) ** + ** ** + ** Version 1.02 ** + ** ALL RIGHTS RESERVED, COPYRIGHT(C) FUJITSU LIMITED 2000 ** + ************************************************************* + + Would you like to check SDRAM and SRAM ? (Y/N) : n + + >r 3f00000 + Flash ROM : IC7. OK ? (Y/N) Y + Blank check + Blank error !! Erase ? (Y/N) Y + Erase.. + Work memory clear + Hex Data Offset Address=0x03F00000 + Recieve.... + + At this point, send the file frv.ROM using simple ASCII protocol. + Since minicom does this poorly, I use the attached 'dl_slow' script. + I set up minicom like this: +lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk +x Name Program Name U/D FullScr IO-Red. Multi x +x A zmodem /usr/bin/sz -vv -b Y U N Y Y x +x B ymodem /usr/bin/sb -vv Y U N Y Y x +x C xmodem /usr/bin/sx -vv -k Y U N Y N x +x D zmodem /usr/bin/rz -vv -b -E N D N Y Y x +x E ymodem /usr/bin/rb -vv N D N Y Y x +x F xmodem /usr/bin/rx -vv Y D N Y N x +x G kermit /usr/bin/kermit -i -l %l -s Y U Y N N x +x H kermit /usr/bin/kermit -i -l %l -r N D Y N N x +x I ascii /usr/bin/ascii-xfr -dsv Y U N Y N x +x J slow /home/gthomas/bin/dl_slow Y U N Y N x +x K - x +x L - x +x M Zmodem download string activates... D x +x N Use filename selection window...... No x +x O Prompt for download directory...... No x +x x +x Change which setting? (SPACE to delete) x +mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj + + You'll know if the file is being transferred correctly by the LEDs doing a + little address dance (i.e. they are showing the address being loaded). + + When the download completes, you may need to hit 'enter' a couple of times. + Then you should see: + Write Start... + Write OK! + Verify Start... + Verify OK! + Complete !! + + + > + + At this point, change SW1-1 to be down (x). Press reset (the bottom blue + button on the CPU). You should get: + + +FLASH configuration checksum error or invalid key + + RedBoot(tm) bootstrap and debug environment [ROMRAM] + Non-certified release, version UNKNOWN - built 13:39:14, Oct 2 2001 + + Platform: MB93091-CB10 evaluation board (Fujitsu FR400) + Copyright (C) 2000, 2001, Red Hat, Inc. + + RAM: 0x00000000-0x04000000, 0x00007000-0x03fed000 available + FLASH: 0xff000000 - 0xff200000, 32 blocks of 0x00010000 bytes each. + RedBoot> + + Be sure and run 'fis init'. + +Notes: + +* There are two FLASH devices on the motherboard. Using SW1-1, they swap + memory addresses. We use one (IC7) and the Fujitsu loader uses the other. + I see no reason (ATM) to replace the Fujitsu monitor other than to let + RedBoot be the primary. This way, reverting SW1-1, at least you can always + reprogram RedBoot. + + CAUTION!! Do not change SW1-1 until after you've programmed RedBoot. If + you do it beforehand, you'll overwrite the Fujitsu monitor. + + + + + + diff --git a/packages/hal/frv/frv400/current/misc/redboot_RAM.ecm b/packages/hal/frv/frv400/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/misc/redboot_RAM.ecm @@ -0,0 +1,87 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware frv400 ; + template redboot ; + package -hardware CYGPKG_HAL_FRV current ; + package -hardware CYGPKG_HAL_FRV_FRV400 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_FRV_FRV400 current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; + package -hardware CYGPKG_DEVS_FLASH_FRV_FRV400 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00040000 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/frv/frv400/current/misc/redboot_ROMRAM.ecm b/packages/hal/frv/frv400/current/misc/redboot_ROMRAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/misc/redboot_ROMRAM.ecm @@ -0,0 +1,104 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware frv400 ; + template redboot ; + package -hardware CYGPKG_HAL_FRV current ; + package -hardware CYGPKG_HAL_FRV_FRV400 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_FRV_FRV400 current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; + package -hardware CYGPKG_DEVS_FLASH_FRV_FRV400 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROMRAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00040000 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + +cdl_option CYGSEM_COMPRESS_ZLIB_NEEDS_MALLOC { + inferred_value 0 +}; + + diff --git a/packages/hal/frv/frv400/current/src/frv400_misc.c b/packages/hal/frv/frv400/current/src/frv400_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/src/frv400_misc.c @@ -0,0 +1,1082 @@ +//========================================================================== +// +// frv400_misc.c +// +// HAL misc board support code for Fujitsu MB93091 ( FR-V 400) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2001-09-07 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // base types +#include // tracing macros +#include // assertion macros +#include // diag_printf() and friends + +#include // IO macros +#include // Register state info +#include +#include // Interrupt names +#include +#include // Hardware definitions +#include // calling interface API + +#include +#include +#include + +static cyg_uint32 _period; + +void hal_clock_initialize(cyg_uint32 period) +{ + _period = period; + // Set timer #1 to run in terminal count mode for period + HAL_WRITE_UINT8(_FRV400_TCTR, _FRV400_TCTR_SEL1|_FRV400_TCTR_RLOHI|_FRV400_TCTR_MODE0); + HAL_WRITE_UINT8(_FRV400_TCSR1, period & 0xFF); + HAL_WRITE_UINT8(_FRV400_TCSR1, period >> 8); + // Configure interrupt + HAL_INTERRUPT_CONFIGURE(CYGNUM_HAL_INTERRUPT_TIMER1, 1, 1); // Interrupt when TOUT1 is high +} + +void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + cyg_int16 offset; + cyg_uint8 _val; + + // Latch & read counter from timer #1 + HAL_WRITE_UINT8(_FRV400_TCTR, _FRV400_TCTR_LATCH|_FRV400_TCTR_RLOHI|_FRV400_TCTR_SEL1); + HAL_READ_UINT8(_FRV400_TCSR1, _val); + offset = _val; + HAL_READ_UINT8(_FRV400_TCSR1, _val); + offset |= _val << 8; // This will be the number of clocks beyond 0 + period += offset; + // Reinitialize with adjusted count + // Set timer #1 to run in terminal count mode for period + HAL_WRITE_UINT8(_FRV400_TCTR, _FRV400_TCTR_SEL1|_FRV400_TCTR_RLOHI|_FRV400_TCTR_MODE0); + HAL_WRITE_UINT8(_FRV400_TCSR1, period & 0xFF); + HAL_WRITE_UINT8(_FRV400_TCSR1, period >> 8); +} + +// Read the current value of the clock, returning the number of hardware "ticks" +// that have occurred (i.e. how far away the current value is from the start) + +void hal_clock_read(cyg_uint32 *pvalue) +{ + cyg_int16 offset; + cyg_uint8 _val; + + // Latch & read counter from timer #1 + HAL_WRITE_UINT8(_FRV400_TCTR, _FRV400_TCTR_LATCH|_FRV400_TCTR_RLOHI|_FRV400_TCTR_SEL1); + HAL_READ_UINT8(_FRV400_TCSR1, _val); + offset = _val; + HAL_READ_UINT8(_FRV400_TCSR1, _val); + offset |= _val << 8; + + // 'offset' is the current timer value + *pvalue = _period - offset; +} + +// Delay for some number of useconds. +// Assumptions: +// Use timer #2 +// Min granularity is 10us +#define _MIN_DELAY 10 + +void hal_delay_us(int us) +{ + cyg_uint8 stat; + int timeout; + + while (us >= _MIN_DELAY) { + us -= _MIN_DELAY; + // Set timer #2 to run in terminal count mode for _MIN_DELAY us + HAL_WRITE_UINT8(_FRV400_TCTR, _FRV400_TCTR_SEL2|_FRV400_TCTR_RLOHI|_FRV400_TCTR_MODE0); + HAL_WRITE_UINT8(_FRV400_TCSR2, _MIN_DELAY & 0xFF); + HAL_WRITE_UINT8(_FRV400_TCSR2, _MIN_DELAY >> 8); + timeout = 100000; + // Wait for TOUT to indicate terminal count reached + do { + HAL_WRITE_UINT8(_FRV400_TCTR, _FRV400_TCTR_RB|_FRV400_TCTR_RB_NCOUNT|_FRV400_TCTR_RB_CTR2); + HAL_READ_UINT8(_FRV400_TCSR2, stat); + if (--timeout == 0) break; + } while ((stat & _FRV400_TCxSR_TOUT) == 0); + } +} + +// +// Early stage hardware initialization +// Some initialization has already been done before we get here. For now +// just set up the interrupt environment. + +long _system_clock; // Calculated clock frequency + +void hal_hardware_init(void) +{ + cyg_uint32 clk; + + // Set up interrupt controller + HAL_WRITE_UINT16(_FRV400_IRC_MASK, 0xFFFE); // All masked + HAL_WRITE_UINT16(_FRV400_IRC_RC, 0xFFFE); // All cleared + HAL_WRITE_UINT16(_FRV400_IRC_IRL, 0x10); // Clear IRL (interrupt request latch) + + // Onboard FPGA interrupts + HAL_WRITE_UINT16(_FRV400_FPGA_CONTROL, _FRV400_FPGA_CONTROL_IRQ); // Enable IRQ registers + HAL_WRITE_UINT16(_FRV400_FPGA_IRQ_MASK, // Set up for LAN, PCI INTx + 0x7FFE & + ~(_FRV400_FPGA_IRQ_LAN | + _FRV400_FPGA_IRQ_INTA | + _FRV400_FPGA_IRQ_INTB | + _FRV400_FPGA_IRQ_INTC | + _FRV400_FPGA_IRQ_INTD) + ); + HAL_WRITE_UINT16(_FRV400_FPGA_IRQ_LEVELS, // Set up for LAN, PCI INTx + 0x7FFE & + ~(_FRV400_FPGA_IRQ_LAN | + _FRV400_FPGA_IRQ_INTA | + _FRV400_FPGA_IRQ_INTB | + _FRV400_FPGA_IRQ_INTC | + _FRV400_FPGA_IRQ_INTD) + ); + HAL_INTERRUPT_CONFIGURE(CYGNUM_HAL_INTERRUPT_LAN, 1, 0); // Level, low + + // Set up system clock + HAL_READ_UINT32(_FRV400_MB_CLKSW, clk); + _system_clock = (((clk&0xFF) * 125 * 2) / 240) * 1000000; + + // Set scalers to achieve 1us resolution in timer + HAL_WRITE_UINT8(_FRV400_TPRV, _system_clock / (1000*1000)); + HAL_WRITE_UINT8(_FRV400_TCKSL0, 0x80); + HAL_WRITE_UINT8(_FRV400_TCKSL1, 0x80); + HAL_WRITE_UINT8(_FRV400_TCKSL2, 0x80); + + hal_if_init(); + + // Initialize real-time clock (for delays, etc, even if kernel doesn't use it) + hal_clock_initialize(CYGNUM_HAL_RTC_PERIOD); + + _frv400_pci_init(); +} + +// +// Interrupt control +// + +void hal_interrupt_mask(int vector) +{ + cyg_uint16 _mask; + + switch (vector) { + case CYGNUM_HAL_INTERRUPT_LAN: + HAL_READ_UINT16(_FRV400_FPGA_IRQ_MASK, _mask); + _mask |= _FRV400_FPGA_IRQ_LAN; + HAL_WRITE_UINT16(_FRV400_FPGA_IRQ_MASK, _mask); + break; + } + HAL_READ_UINT16(_FRV400_IRC_MASK, _mask); + _mask |= (1<<(vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)); + HAL_WRITE_UINT16(_FRV400_IRC_MASK, _mask); +} + +void hal_interrupt_unmask(int vector) +{ + cyg_uint16 _mask; + + switch (vector) { + case CYGNUM_HAL_INTERRUPT_LAN: + HAL_READ_UINT16(_FRV400_FPGA_IRQ_MASK, _mask); + _mask &= ~_FRV400_FPGA_IRQ_LAN; + HAL_WRITE_UINT16(_FRV400_FPGA_IRQ_MASK, _mask); + break; + } + HAL_READ_UINT16(_FRV400_IRC_MASK, _mask); + _mask &= ~(1<<(vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)); + HAL_WRITE_UINT16(_FRV400_IRC_MASK, _mask); +} + +void hal_interrupt_acknowledge(int vector) +{ + cyg_uint16 _mask; + + switch (vector) { + case CYGNUM_HAL_INTERRUPT_LAN: + HAL_WRITE_UINT16(_FRV400_FPGA_IRQ_REQUEST, // Clear LAN interrupt + 0x7FFE & ~_FRV400_FPGA_IRQ_LAN); + break; + } + _mask = (1<<(vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)); + HAL_WRITE_UINT16(_FRV400_IRC_RC, _mask); + HAL_WRITE_UINT16(_FRV400_IRC_IRL, 0x10); // Clears IRL latch +} + +// +// Configure an interrupt +// level - boolean (0=> edge, 1=>level) +// up - edge: (0=>falling edge, 1=>rising edge) +// level: (0=>low, 1=>high) +// +void hal_interrupt_configure(int vector, int level, int up) +{ + cyg_uint16 _irr, _tmr, _trig; + + if (level) { + if (up) { + _trig = 0; // level, high + } else { + _trig = 1; // level, low + } + } else { + if (up) { + _trig = 2; // edge, rising + } else { + _trig = 3; // edge, falling + } + } + switch (vector) { + case CYGNUM_HAL_INTERRUPT_TIMER0: + HAL_READ_UINT16(_FRV400_IRC_IRR5, _irr); + _irr = (_irr & 0xFFF0) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<0); + HAL_WRITE_UINT16(_FRV400_IRC_IRR5, _irr); + HAL_READ_UINT16(_FRV400_IRC_ITM0, _tmr); + _tmr = (_tmr & 0xFFFC) | (_trig<<0); + HAL_WRITE_UINT16(_FRV400_IRC_ITM0, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_TIMER1: + HAL_READ_UINT16(_FRV400_IRC_IRR5, _irr); + _irr = (_irr & 0xFF0F) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<4); + HAL_WRITE_UINT16(_FRV400_IRC_IRR5, _irr); + HAL_READ_UINT16(_FRV400_IRC_ITM0, _tmr); + _tmr = (_tmr & 0xFFF3) | (_trig<<2); + HAL_WRITE_UINT16(_FRV400_IRC_ITM0, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_TIMER2: + HAL_READ_UINT16(_FRV400_IRC_IRR5, _irr); + _irr = (_irr & 0xF0FF) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<8); + HAL_WRITE_UINT16(_FRV400_IRC_IRR5, _irr); + HAL_READ_UINT16(_FRV400_IRC_ITM0, _tmr); + _tmr = (_tmr & 0xFFCF) | (_trig<<4); + HAL_WRITE_UINT16(_FRV400_IRC_ITM0, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_DMA0: + HAL_READ_UINT16(_FRV400_IRC_IRR4, _irr); + _irr = (_irr & 0xFFF0) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<0); + HAL_WRITE_UINT16(_FRV400_IRC_IRR4, _irr); + HAL_READ_UINT16(_FRV400_IRC_ITM0, _tmr); + _tmr = (_tmr & 0xFCFF) | (_trig<<8); + HAL_WRITE_UINT16(_FRV400_IRC_ITM0, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_DMA1: + HAL_READ_UINT16(_FRV400_IRC_IRR4, _irr); + _irr = (_irr & 0xFF0F) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<4); + HAL_WRITE_UINT16(_FRV400_IRC_IRR4, _irr); + HAL_READ_UINT16(_FRV400_IRC_ITM0, _tmr); + _tmr = (_tmr & 0xF3FF) | (_trig<<10); + HAL_WRITE_UINT16(_FRV400_IRC_ITM0, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_DMA2: + HAL_READ_UINT16(_FRV400_IRC_IRR4, _irr); + _irr = (_irr & 0xF0FF) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<8); + HAL_WRITE_UINT16(_FRV400_IRC_IRR4, _irr); + HAL_READ_UINT16(_FRV400_IRC_ITM0, _tmr); + _tmr = (_tmr & 0xCFFF) | (_trig<<12); + HAL_WRITE_UINT16(_FRV400_IRC_ITM0, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_DMA3: + HAL_READ_UINT16(_FRV400_IRC_IRR4, _irr); + _irr = (_irr & 0x0FFF) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<12); + HAL_WRITE_UINT16(_FRV400_IRC_IRR4, _irr); + HAL_READ_UINT16(_FRV400_IRC_ITM0, _tmr); + _tmr = (_tmr & 0x3FFF) | (_trig<<14); + HAL_WRITE_UINT16(_FRV400_IRC_ITM0, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_UART0: + HAL_READ_UINT16(_FRV400_IRC_IRR6, _irr); + _irr = (_irr & 0xFFF0) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<0); + HAL_WRITE_UINT16(_FRV400_IRC_IRR6, _irr); + HAL_READ_UINT16(_FRV400_IRC_ITM1, _tmr); + _tmr = (_tmr & 0xFCFF) | (_trig<<8); + HAL_WRITE_UINT16(_FRV400_IRC_ITM1, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_UART1: + HAL_READ_UINT16(_FRV400_IRC_IRR6, _irr); + _irr = (_irr & 0xFF0F) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<4); + HAL_WRITE_UINT16(_FRV400_IRC_IRR6, _irr); + HAL_READ_UINT16(_FRV400_IRC_ITM1, _tmr); + _tmr = (_tmr & 0xF3FF) | (_trig<<10); + HAL_WRITE_UINT16(_FRV400_IRC_ITM1, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_EXT0: + HAL_READ_UINT16(_FRV400_IRC_IRR3, _irr); + _irr = (_irr & 0xFFF0) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<0); + HAL_WRITE_UINT16(_FRV400_IRC_IRR3, _irr); + HAL_READ_UINT16(_FRV400_IRC_TM1, _tmr); + _tmr = (_tmr & 0xFFFC) | (_trig<<0); + HAL_WRITE_UINT16(_FRV400_IRC_TM1, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_EXT1: + HAL_READ_UINT16(_FRV400_IRC_IRR3, _irr); + _irr = (_irr & 0xFF0F) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<4); + HAL_WRITE_UINT16(_FRV400_IRC_IRR3, _irr); + HAL_READ_UINT16(_FRV400_IRC_TM1, _tmr); + _tmr = (_tmr & 0xFFF3) | (_trig<<2); + HAL_WRITE_UINT16(_FRV400_IRC_TM1, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_EXT2: + HAL_READ_UINT16(_FRV400_IRC_IRR3, _irr); + _irr = (_irr & 0xF0FF) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<8); + HAL_WRITE_UINT16(_FRV400_IRC_IRR3, _irr); + HAL_READ_UINT16(_FRV400_IRC_TM1, _tmr); + _tmr = (_tmr & 0xFFCF) | (_trig<<4); + HAL_WRITE_UINT16(_FRV400_IRC_TM1, _tmr); + break; + case CYGNUM_HAL_INTERRUPT_EXT3: + HAL_READ_UINT16(_FRV400_IRC_IRR3, _irr); + _irr = (_irr & 0x0FFF) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<12); + HAL_WRITE_UINT16(_FRV400_IRC_IRR3, _irr); + HAL_READ_UINT16(_FRV400_IRC_TM1, _tmr); + _tmr = (_tmr & 0xFF3F) | (_trig<<6); + HAL_WRITE_UINT16(_FRV400_IRC_TM1, _tmr); + break; + default: + ; // Nothing to do + }; +} + +void hal_interrupt_set_level(int vector, int level) +{ +// UNIMPLEMENTED(__FUNCTION__); +} + +// PCI support + +externC void +_frv400_pci_init(void) +{ + static int _init = 0; + cyg_uint8 next_bus; + cyg_uint32 cmd_state; + + if (_init) return; + _init = 1; + + // Enable controller - most of the basic configuration + // was set up at boot time in "platform.inc" + + // Setup for bus mastering + HAL_PCI_CFG_READ_UINT32(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_COMMAND, cmd_state); + if ((cmd_state & CYG_PCI_CFG_COMMAND_MEMORY) == 0) { + HAL_PCI_CFG_WRITE_UINT32(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_COMMAND, + CYG_PCI_CFG_COMMAND_MEMORY | + CYG_PCI_CFG_COMMAND_MASTER | + CYG_PCI_CFG_COMMAND_PARITY | + CYG_PCI_CFG_COMMAND_SERR); + + // Setup latency timer field + HAL_PCI_CFG_WRITE_UINT8(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_LATENCY_TIMER, 32); + + // Configure PCI bus. + next_bus = 1; + cyg_pci_configure_bus(0, &next_bus); + } + +} + +externC void +_frv400_pci_translate_interrupt(int bus, int devfn, int *vec, int *valid) +{ + cyg_uint8 req; + cyg_uint8 dev = CYG_PCI_DEV_GET_DEV(devfn); + + if (dev == CYG_PCI_MIN_DEV) { + // On board LAN + *vec = CYGNUM_HAL_INTERRUPT_LAN; + *valid = true; + } else { + HAL_PCI_CFG_READ_UINT8(bus, devfn, CYG_PCI_CFG_INT_PIN, req); + if (0 != req) { + CYG_ADDRWORD __translation[4] = { + CYGNUM_HAL_INTERRUPT_PCIINTC, /* INTC# */ + CYGNUM_HAL_INTERRUPT_PCIINTB, /* INTB# */ + CYGNUM_HAL_INTERRUPT_PCIINTA, /* INTA# */ + CYGNUM_HAL_INTERRUPT_PCIINTD}; /* INTD# */ + + /* The PCI lines from the different slots are wired like this */ + /* on the PCI backplane: */ + /* pin6A pin7B pin7A pin8B */ + /* I/O Slot 1 INTA# INTB# INTC# INTD# */ + /* I/O Slot 2 INTD# INTA# INTB# INTC# */ + /* I/O Slot 3 INTC# INTD# INTA# INTB# */ + /* */ + /* (From PCI Development Backplane, 3.2.2 Interrupts) */ + /* */ + /* Devsel signals are wired to, resulting in device IDs: */ + /* I/O Slot 1 AD30 / dev 19 [(8+1)&3 = 1] */ + /* I/O Slot 2 AD29 / dev 18 [(7+1)&3 = 0] */ + /* I/O Slot 3 AD28 / dev 17 [(6+1)&3 = 3] */ + + *vec = __translation[((req+dev)&3)]; + *valid = true; + } else { + /* Device will not generate interrupt requests. */ + *valid = false; + } + diag_printf("Int - dev: %d, req: %d, vector: %d\n", dev, req, *vec); + } +} + +// PCI configuration space access +#define _EXT_ENABLE 0x80000000 // Could be 0x80000000 + +static __inline__ cyg_uint32 +_cfg_addr(int bus, int devfn, int offset) +{ + return _EXT_ENABLE | (bus << 22) | (devfn << 8) | (offset << 0); +} + +externC cyg_uint8 +_frv400_pci_cfg_read_uint8(int bus, int devfn, int offset) +{ + cyg_uint32 cfg_addr, addr, status; + cyg_uint8 cfg_val = (cyg_uint8)0xFF; + +#ifdef CYGPKG_IO_PCI_DEBUG + diag_printf("%s(bus=%x, devfn=%x, offset=%x) = ", __FUNCTION__, bus, devfn, offset); +#endif // CYGPKG_IO_PCI_DEBUG + if ((bus == 0) && (CYG_PCI_DEV_GET_DEV(devfn) == 0)) { + // PCI bridge + addr = _FRV400_PCI_CONFIG + ((offset << 1) ^ 0x03); + } else { + cfg_addr = _cfg_addr(bus, devfn, offset ^ 0x03); + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, cfg_addr); + addr = _FRV400_PCI_CONFIG_DATA + ((offset & 0x03) ^ 0x03); + } + HAL_READ_UINT8(addr, cfg_val); + HAL_READ_UINT16(_FRV400_PCI_STAT_CMD, status); + if (status & _FRV400_PCI_STAT_ERROR_MASK) { + // Cycle failed - clean up and get out + cfg_val = (cyg_uint8)0xFF; + HAL_WRITE_UINT16(_FRV400_PCI_STAT_CMD, status & _FRV400_PCI_STAT_ERROR_MASK); + } +#ifdef CYGPKG_IO_PCI_DEBUG + diag_printf("%x\n", cfg_val); +#endif // CYGPKG_IO_PCI_DEBUG + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, 0); + return cfg_val; +} + +externC cyg_uint16 +_frv400_pci_cfg_read_uint16(int bus, int devfn, int offset) +{ + cyg_uint32 cfg_addr, addr, status; + cyg_uint16 cfg_val = (cyg_uint16)0xFFFF; + +#ifdef CYGPKG_IO_PCI_DEBUG + diag_printf("%s(bus=%x, devfn=%x, offset=%x) = ", __FUNCTION__, bus, devfn, offset); +#endif // CYGPKG_IO_PCI_DEBUG + if ((bus == 0) && (CYG_PCI_DEV_GET_DEV(devfn) == 0)) { + // PCI bridge + addr = _FRV400_PCI_CONFIG + ((offset << 1) ^ 0x02); + } else { + cfg_addr = _cfg_addr(bus, devfn, offset ^ 0x02); + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, cfg_addr); + addr = _FRV400_PCI_CONFIG_DATA + ((offset & 0x03) ^ 0x02); + } + HAL_READ_UINT16(addr, cfg_val); + HAL_READ_UINT16(_FRV400_PCI_STAT_CMD, status); + if (status & _FRV400_PCI_STAT_ERROR_MASK) { + // Cycle failed - clean up and get out + cfg_val = (cyg_uint16)0xFFFF; + HAL_WRITE_UINT16(_FRV400_PCI_STAT_CMD, status & _FRV400_PCI_STAT_ERROR_MASK); + } +#ifdef CYGPKG_IO_PCI_DEBUG + diag_printf("%x\n", cfg_val); +#endif // CYGPKG_IO_PCI_DEBUG + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, 0); + return cfg_val; +} + +externC cyg_uint32 +_frv400_pci_cfg_read_uint32(int bus, int devfn, int offset) +{ + cyg_uint32 cfg_addr, addr, status; + cyg_uint32 cfg_val = (cyg_uint32)0xFFFFFFFF; + +#ifdef CYGPKG_IO_PCI_DEBUG + diag_printf("%s(bus=%x, devfn=%x, offset=%x) = ", __FUNCTION__, bus, devfn, offset); +#endif // CYGPKG_IO_PCI_DEBUG + if ((bus == 0) && (CYG_PCI_DEV_GET_DEV(devfn) == 0)) { + // PCI bridge + addr = _FRV400_PCI_CONFIG + (offset << 1); + } else { + cfg_addr = _cfg_addr(bus, devfn, offset); + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, cfg_addr); + addr = _FRV400_PCI_CONFIG_DATA; + } + HAL_READ_UINT32(addr, cfg_val); + HAL_READ_UINT16(_FRV400_PCI_STAT_CMD, status); + if (status & _FRV400_PCI_STAT_ERROR_MASK) { + // Cycle failed - clean up and get out + cfg_val = (cyg_uint32)0xFFFFFFFF; + HAL_WRITE_UINT16(_FRV400_PCI_STAT_CMD, status & _FRV400_PCI_STAT_ERROR_MASK); + } +#ifdef CYGPKG_IO_PCI_DEBUG + diag_printf("%x\n", cfg_val); +#endif // CYGPKG_IO_PCI_DEBUG + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, 0); + return cfg_val; +} + +externC void +_frv400_pci_cfg_write_uint8(int bus, int devfn, int offset, cyg_uint8 cfg_val) +{ + cyg_uint32 cfg_addr, addr, status; + +#ifdef CYGPKG_IO_PCI_DEBUG + diag_printf("%s(bus=%x, devfn=%x, offset=%x, val=%x)\n", __FUNCTION__, bus, devfn, offset, cfg_val); +#endif // CYGPKG_IO_PCI_DEBUG + if ((bus == 0) && (CYG_PCI_DEV_GET_DEV(devfn) == 0)) { + // PCI bridge + addr = _FRV400_PCI_CONFIG + ((offset << 1) ^ 0x03); + } else { + cfg_addr = _cfg_addr(bus, devfn, offset ^ 0x03); + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, cfg_addr); + addr = _FRV400_PCI_CONFIG_DATA + ((offset & 0x03) ^ 0x03); + } + HAL_WRITE_UINT8(addr, cfg_val); + HAL_READ_UINT16(_FRV400_PCI_STAT_CMD, status); + if (status & _FRV400_PCI_STAT_ERROR_MASK) { + // Cycle failed - clean up and get out + HAL_WRITE_UINT16(_FRV400_PCI_STAT_CMD, status & _FRV400_PCI_STAT_ERROR_MASK); + } + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, 0); +} + +externC void +_frv400_pci_cfg_write_uint16(int bus, int devfn, int offset, cyg_uint16 cfg_val) +{ + cyg_uint32 cfg_addr, addr, status; + +#ifdef CYGPKG_IO_PCI_DEBUG + diag_printf("%s(bus=%x, devfn=%x, offset=%x, val=%x)\n", __FUNCTION__, bus, devfn, offset, cfg_val); +#endif // CYGPKG_IO_PCI_DEBUG + if ((bus == 0) && (CYG_PCI_DEV_GET_DEV(devfn) == 0)) { + // PCI bridge + addr = _FRV400_PCI_CONFIG + ((offset << 1) ^ 0x02); + } else { + cfg_addr = _cfg_addr(bus, devfn, offset ^ 0x02); + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, cfg_addr); + addr = _FRV400_PCI_CONFIG_DATA + ((offset & 0x03) ^ 0x02); + } + HAL_WRITE_UINT16(addr, cfg_val); + HAL_READ_UINT16(_FRV400_PCI_STAT_CMD, status); + if (status & _FRV400_PCI_STAT_ERROR_MASK) { + // Cycle failed - clean up and get out + HAL_WRITE_UINT16(_FRV400_PCI_STAT_CMD, status & _FRV400_PCI_STAT_ERROR_MASK); + } + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, 0); +} + +externC void +_frv400_pci_cfg_write_uint32(int bus, int devfn, int offset, cyg_uint32 cfg_val) +{ + cyg_uint32 cfg_addr, addr, status; + +#ifdef CYGPKG_IO_PCI_DEBUG + diag_printf("%s(bus=%x, devfn=%x, offset=%x, val=%x)\n", __FUNCTION__, bus, devfn, offset, cfg_val); +#endif // CYGPKG_IO_PCI_DEBUG + if ((bus == 0) && (CYG_PCI_DEV_GET_DEV(devfn) == 0)) { + // PCI bridge + addr = _FRV400_PCI_CONFIG + (offset << 1); + } else { + cfg_addr = _cfg_addr(bus, devfn, offset); + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, cfg_addr); + addr = _FRV400_PCI_CONFIG_DATA; + } + HAL_WRITE_UINT32(addr, cfg_val); + HAL_READ_UINT16(_FRV400_PCI_STAT_CMD, status); + if (status & _FRV400_PCI_STAT_ERROR_MASK) { + // Cycle failed - clean up and get out + HAL_WRITE_UINT16(_FRV400_PCI_STAT_CMD, status & _FRV400_PCI_STAT_ERROR_MASK); + } + HAL_WRITE_UINT32(_FRV400_PCI_CONFIG_ADDR, 0); +} + +// ------------------------------------------------------------------------ +// +// Hardware breakpoint/watchpoint support +// ====================================== +// +// Now follows a load of extreme unpleasantness to deal with the totally +// broken debug model of this device. +// +// To modify the special hardware debug registers, it is necessary to put +// the CPU into "debug mode". This can only be done by executing a break +// instruction, or taking a special hardware break event as described by +// the special hardware debug registers. +// +// But once in debug mode, no break is taken, and break instructions are +// ignored, because we are in debug mode. +// +// So we must exit debug mode for normal running, which you can only do via +// a rett #1 instruction. Because rett is for returning from traps, it +// halts the CPU if you do it with traps enabled. So you have to mess +// about disabling traps before the rett. Also, because rett #1 is for +// returning from a *debug* trap, you can only issue it from debug mode - +// or it halts the CPU. +// +// To be able to set and unset hardware debug breakpoints and watchpoints, +// we must enter debug mode (via a "break" instruction). Fortunately, it +// is possible to return from a "break" remaining in debug mode, using a +// rett #0, so we can arrange that a break instruction just means "go to +// debug mode". +// +// So we can manipulate the special hardware debug registers by executing a +// "break", doing the work, then doing the magic sequence to rett #1. +// These are encapsulated in HAL_FRV_ENTER_DEBUG_MODE() and +// HAL_FRV_EXIT_DEBUG_MODE() from plf_stub.h +// +// So, we get into break_hander() for two reasons: +// 1) a break instruction. Detect this and do nothing; return skipping +// over the break instruction. CPU remains in debug mode. +// 2) a hardware debug trap. Continue just as for a normal exception; +// GDB and the stubs will handle it. But first, exit debug mode, or +// stuff happening in the stubs will go wrong. +// +// In order to be certain that we are in debug mode, for performing (2) +// safely, vectors.S installs a special debug trap handler on vector #255. +// That's the reason for break_handler() existing as a separate routine. +// +// Note that there is no need to define CYGSEM_HAL_FRV_HW_DEBUG for the +// FRV_FRV400 target; while we do use Hardware Debug, we don't use *that* +// sort of hardware debug, specifically we do not use hardware single-step, +// because it breaks as soon as we exit debug mode, ie. whilst we are still +// within the stub. So in fact defining CYGSEM_HAL_FRV_HW_DEBUG is bad; I +// guess it is mis-named. +// + +// ------------------------------------------------------------------------ +// First a load of ugly boilerplate for register access. + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // HAL_STUB_HW_STOP_NONE et al +#include // register names PC, PSR et al +#include // HAL_FRV_EXIT_DEBUG_MODE() + +// First a load of glue +static inline unsigned get_bpsr(void) { + unsigned retval; + asm volatile ( "movsg bpsr,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_bpsr(unsigned val) { + asm volatile ( "movgs %0,bpsr\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_dcr(void) { + unsigned retval; + asm volatile ( "movsg dcr,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dcr(unsigned val) { + asm volatile ( "movgs %0,dcr\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_brr(void) { + unsigned retval; + asm volatile ( "movsg brr,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_brr(unsigned val) { + asm volatile ( "movgs %0,brr\n" : /* no outputs */ : "r" (val) );} + +// Four Instruction Break Address Registers +static inline unsigned get_ibar0(void) { + unsigned retval; + asm volatile ( "movsg ibar0,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_ibar0(unsigned val) { + asm volatile ( "movgs %0,ibar0\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_ibar1(void) { + unsigned retval; + asm volatile ( "movsg ibar1,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_ibar1(unsigned val){ + asm volatile ( "movgs %0,ibar1\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_ibar2(void) { + unsigned retval; + asm volatile ( "movsg ibar2,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_ibar2(unsigned val) { + asm volatile ( "movgs %0,ibar2\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_ibar3(void) { + unsigned retval; + asm volatile ( "movsg ibar3,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_ibar3(unsigned val){ + asm volatile ( "movgs %0,ibar3\n" : /* no outputs */ : "r" (val) );} + +// Two Data Break Address Registers +static inline unsigned get_dbar0(void) { + unsigned retval; + asm volatile ( "movsg dbar0,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dbar0(unsigned val){ + asm volatile ( "movgs %0,dbar0\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_dbar1(void){ + unsigned retval; + asm volatile ( "movsg dbar1,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dbar1(unsigned val){ + asm volatile ( "movgs %0,dbar1\n" : /* no outputs */ : "r" (val) );} + +// Two times two Data Break Data Registers +static inline unsigned get_dbdr00(void){ + unsigned retval; + asm volatile ( "movsg dbdr00,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dbdr00(unsigned val){ + asm volatile ( "movgs %0,dbdr00\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_dbdr01(void){ + unsigned retval; + asm volatile ( "movsg dbdr01,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dbdr01(unsigned val){ + asm volatile ( "movgs %0,dbdr01\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_dbdr10(void){ + unsigned retval; + asm volatile ( "movsg dbdr10,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dbdr10(unsigned val){ + asm volatile ( "movgs %0,dbdr10\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_dbdr11(void){ + unsigned retval; + asm volatile ( "movsg dbdr11,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dbdr11(unsigned val){ + asm volatile ( "movgs %0,dbdr11\n" : /* no outputs */ : "r" (val) );} + +// Two times two Data Break Mask Registers +static inline unsigned get_dbmr00(void){ + unsigned retval; + asm volatile ( "movsg dbmr00,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dbmr00(unsigned val){ + asm volatile ( "movgs %0,dbmr00\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_dbmr01(void){ + unsigned retval; + asm volatile ( "movsg dbmr01,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dbmr01(unsigned val){ + asm volatile ( "movgs %0,dbmr01\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_dbmr10(void){ + unsigned retval; + asm volatile ( "movsg dbmr10,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dbmr10(unsigned val){ + asm volatile ( "movgs %0,dbmr10\n" : /* no outputs */ : "r" (val) );} + +static inline unsigned get_dbmr11(void){ + unsigned retval; + asm volatile ( "movsg dbmr11,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_dbmr11(unsigned val){ + asm volatile ( "movgs %0,dbmr11\n" : /* no outputs */ : "r" (val) );} + +// and here's the prototype. Which compiles, believe it or not. +static inline unsigned get_XXXX(void){ + unsigned retval; + asm volatile ( "movsg XXXX,%0\n" : "=r" (retval) : /* no inputs */ ); + return retval;} +static inline void set_XXXX(unsigned val){ + asm volatile ( "movgs %0,XXXX\n" : /* no outputs */ : "r" (val) );} + +// ------------------------------------------------------------------------ +// This is called in the same manner as exception_handler() in hal_misc.c +// Comments compare and contrast what we do here. + +static unsigned int saved_brr = 0; + +void +break_handler(HAL_SavedRegisters *regs) +{ + unsigned int i, old_bpsr; + + // See if it an actual "break" instruction. + i = get_brr(); + saved_brr |= i; // do not lose previous state + // Acknowledge the trap, clear the "factor" (== cause) + set_brr( 0 ); + + // Now leave debug mode so that it's safe to run the stub code. + + // Unfortunately, leaving debug mode isn't a self-contained + // operation. The only means of doing it is with a "rett #1" + // instruction, which will also restore the previous values of + // the ET and S status flags. We can massage the BPSR + // register so that the flags keep their current values, but + // we need to save the old one first. + i = old_bpsr = get_bpsr (); + i |= _BPSR_BS; // Stay in supervisor mode + i &= ~_BPSR_BET; // Keep traps disabled + set_bpsr (i); + HAL_FRV_EXIT_DEBUG_MODE(); + + // Only perturb this variable if stopping, not + // just for a break instruction. + _hal_registers = regs; + + // Continue with the standard mechanism: + __handle_exception(); + + // Go back into debug mode. + HAL_FRV_ENTER_DEBUG_MODE(); + // Restore the original BPSR register. + set_bpsr (old_bpsr); + return; +} + +// ------------------------------------------------------------------------ + +// Now the routines to manipulate said hardware break and watchpoints. + +int cyg_hal_plf_hw_breakpoint(int setflag, void *vaddr, int len) +{ + unsigned int addr = (unsigned)vaddr; + unsigned int dcr; + unsigned int retcode = 0; + + HAL_FRV_ENTER_DEBUG_MODE(); + dcr = get_dcr(); + + // GDB manual suggests that idempotency is required, so first remove + // any identical BP in residence. Implements remove arm anyway. + if ( 0 != (dcr & (_DCR_IBE0 | _DCR_IBCE0)) && + get_ibar0() == addr ) + dcr &=~(_DCR_IBE0 | _DCR_IBCE0); + else if ( 0 != (dcr & (_DCR_IBE1 | _DCR_IBCE1)) && + get_ibar1() == addr ) + dcr &=~(_DCR_IBE1 | _DCR_IBCE1); + else if ( 0 != (dcr & (_DCR_IBE2 | _DCR_IBCE2)) && + get_ibar2() == addr ) + dcr &=~(_DCR_IBE2 | _DCR_IBCE2); + else if ( 0 != (dcr & (_DCR_IBE3 | _DCR_IBCE3)) && + get_ibar3() == addr ) + dcr &=~(_DCR_IBE3 | _DCR_IBCE3); + else + retcode = -1; + + if (setflag) { + retcode = 0; // it is OK really + if ( 0 == (dcr & (_DCR_IBE0 | _DCR_IBCE0)) ) { + set_ibar0(addr); + dcr |= _DCR_IBE0; + } + else if ( 0 == (dcr & (_DCR_IBE1 | _DCR_IBCE1)) ) { + set_ibar1(addr); + dcr |= _DCR_IBE1; + } + else if ( 0 == (dcr & (_DCR_IBE2 | _DCR_IBCE2)) ) { + set_ibar2(addr); + dcr |= _DCR_IBE2; + } + else if ( 0 == (dcr & (_DCR_IBE3 | _DCR_IBCE3)) ) { + set_ibar3(addr); + dcr |= _DCR_IBE3; + } + else + retcode = -1; + } + + if ( 0 == retcode ) + set_dcr(dcr); + HAL_FRV_EXIT_DEBUG_MODE(); + return retcode; +} + +int cyg_hal_plf_hw_watchpoint(int setflag, void *vaddr, int len, int type) +{ + unsigned int addr = (unsigned)vaddr; + unsigned int mode; + unsigned int dcr; + unsigned int retcode = 0; + unsigned long long mask; + unsigned int mask0, mask1; + int i; + + // Check the length fits within one block. + if ( ((~7) & (addr + len - 1)) != ((~7) & addr) ) + return -1; + + // Assuming big-endian like the platform seems to be... + + // Get masks for the 8-byte span. 00 means enabled, ff means ignore a + // byte, which is why this looks funny at first glance. + mask = 0x00ffffffffffffffULL >> ((len - 1) << 3); + for (i = 0; i < (addr & 7); i++) { + mask >>= 8; + mask |= 0xff00000000000000ULL; + } + + mask0 = mask >> 32; + mask1 = mask & 0xffffffffULL; + + addr &=~7; // round to 8-byte block + + HAL_FRV_ENTER_DEBUG_MODE(); + dcr = get_dcr(); + + // GDB manual suggests that idempotency is required, so first remove + // any identical WP in residence. Implements remove arm anyway. + if ( 0 != (dcr & (7 * _DCR_DBASE0)) && + get_dbar0() == addr && + get_dbmr00() == mask0 && get_dbmr01() == mask1 ) + dcr &=~(7 * _DCR_DBASE0); + else if ( 0 != (dcr & (7 * _DCR_DBASE1)) && + get_dbar1() == addr&& + get_dbmr10() == mask0 && get_dbmr11() == mask1 ) + dcr &=~(7 * _DCR_DBASE1); + else + retcode = -1; + + if (setflag) { + retcode = 0; // it is OK really + if (type == 2) mode = 2; // break on write + else if (type == 3) mode = 4; // break on read + else if (type == 4) mode = 6; // break on any access + else { + mode = 0; // actually add no enable at all. + retcode = -1; + } + if ( 0 == (dcr & (7 * _DCR_DBASE0)) ) { + set_dbar0(addr); + // Data and Mask 0,1 to zero (mask no bits/bytes) + set_dbdr00(0); set_dbdr01(0); set_dbmr00(mask0); set_dbmr01(mask1); + mode *= _DCR_DBASE0; + dcr |= mode; + } + else if ( 0 == (dcr & (7 * _DCR_DBASE1)) ) { + set_dbar1(addr); + set_dbdr10(0); set_dbdr11(0); set_dbmr10(mask0); set_dbmr11(mask1); + mode *= _DCR_DBASE1; + dcr |= mode; + } + else + retcode = -1; + } + + if ( 0 == retcode ) + set_dcr(dcr); + HAL_FRV_EXIT_DEBUG_MODE(); + return retcode; +} + +// Return indication of whether or not we stopped because of a +// watchpoint or hardware breakpoint. If stopped by a watchpoint, +// also set '*data_addr_p' to the data address which triggered the +// watchpoint. +int cyg_hal_plf_is_stopped_by_hardware(void **data_addr_p) +{ + unsigned int brr; + int retcode = HAL_STUB_HW_STOP_NONE; + unsigned long long mask; + + // There was a debug event. Check the BRR for details + brr = saved_brr; + saved_brr = 0; + + if ( brr & (_BRR_IB0 | _BRR_IB1 | _BRR_IB2 | _BRR_IB3) ) { + // then it was an instruction break + retcode = HAL_STUB_HW_STOP_BREAK; + } + else if ( brr & (_BRR_DB0 | _BRR_DB1) ) { + unsigned int addr, kind; + kind = get_dcr(); + if ( brr & (_BRR_DB0) ) { + addr = get_dbar0(); + kind &= 7 * _DCR_DBASE0; + kind /= _DCR_DBASE0; + mask = (((unsigned long long)get_dbmr00())<<32) | (unsigned long long)get_dbmr01(); + } else { + addr = get_dbar1(); + kind &= 7 * _DCR_DBASE1; + kind /= _DCR_DBASE1; + mask = (((unsigned long long)get_dbmr10())<<32) | (unsigned long long)get_dbmr11(); + } + + if ( data_addr_p ) { + // Scan for a zero byte in the mask - this gives the true address. + // 0123456789abcdef + while ( 0 != (0xff00000000000000LLU & mask) ) { + mask <<= 8; + addr++; + } + *data_addr_p = (void *)addr; + } + + // Inverse of the mapping above in the "set" code. + if (kind == 2) retcode = HAL_STUB_HW_STOP_WATCH; + else if (kind == 6) retcode = HAL_STUB_HW_STOP_AWATCH; + else if (kind == 4) retcode = HAL_STUB_HW_STOP_RWATCH; + } + return retcode; +} + +// ------------------------------------------------------------------------ + +#endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +/*------------------------------------------------------------------------*/ +// EOF frv400_misc.c diff --git a/packages/hal/frv/frv400/current/src/hal_diag.c b/packages/hal/frv/frv400/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/frv/frv400/current/src/hal_diag.c @@ -0,0 +1,413 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors:nickg, gthomas +// Date: 1998-03-02 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include // board specific configury + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // basic machine info +#include // interrupt macros +#include // IO macros +#include +#include +#include // interface API +#include // Helper functions + +#include // Platform specific (registers, etc) + +extern long _system_clock; +#define _ROUND(n) ((((n)*100)+50)/100) +#define _BRG(r) _ROUND(_system_clock/((r)*16)) + +/*---------------------------------------------------------------------------*/ +/* From serial_16550.h */ +// Define the serial registers. +#define CYG_DEV_RBR 0x00 // receiver buffer register, read, dlab = 0 +#define CYG_DEV_THR 0x00 // transmitter holding register, write, dlab = 0 +#define CYG_DEV_DLL 0x00 // divisor latch (LS), read/write, dlab = 1 +#define CYG_DEV_IER 0x08 // interrupt enable register, read/write, dlab = 0 +#define CYG_DEV_DLM 0x08 // divisor latch (MS), read/write, dlab = 1 +#define CYG_DEV_IIR 0x10 // interrupt identification register, read, dlab = 0 +#define CYG_DEV_FCR 0x10 // fifo control register, write, dlab = 0 +#define CYG_DEV_LCR 0x18 // line control register, read/write +#define CYG_DEV_MCR 0x20 // modem control register, read/write +#define CYG_DEV_LSR 0x28 // line status register, read +#define CYG_DEV_MSR 0x30 // modem status register, read + +#define CYG_DEV_CLK 0x90 // Prescaler clock control register - Fujitsu special +#define CYG_DEV_PSC 0x98 // Prescaler value + +// Interrupt Enable Register +#define SIO_IER_RCV 0x01 +#define SIO_IER_XMT 0x02 +#define SIO_IER_LS 0x04 +#define SIO_IER_MS 0x08 + +// The line status register bits. +#define SIO_LSR_DR 0x01 // data ready +#define SIO_LSR_OE 0x02 // overrun error +#define SIO_LSR_PE 0x04 // parity error +#define SIO_LSR_FE 0x08 // framing error +#define SIO_LSR_BI 0x10 // break interrupt +#define SIO_LSR_THRE 0x20 // transmitter holding register empty +#define SIO_LSR_TEMT 0x40 // transmitter register empty +#define SIO_LSR_ERR 0x80 // any error condition + +// The modem status register bits. +#define SIO_MSR_DCTS 0x01 // delta clear to send +#define SIO_MSR_DDSR 0x02 // delta data set ready +#define SIO_MSR_TERI 0x04 // trailing edge ring indicator +#define SIO_MSR_DDCD 0x08 // delta data carrier detect +#define SIO_MSR_CTS 0x10 // clear to send +#define SIO_MSR_DSR 0x20 // data set ready +#define SIO_MSR_RI 0x40 // ring indicator +#define SIO_MSR_DCD 0x80 // data carrier detect + +// The line control register bits. +#define SIO_LCR_WLS0 0x01 // word length select bit 0 +#define SIO_LCR_WLS1 0x02 // word length select bit 1 +#define SIO_LCR_STB 0x04 // number of stop bits +#define SIO_LCR_PEN 0x08 // parity enable +#define SIO_LCR_EPS 0x10 // even parity select +#define SIO_LCR_SP 0x20 // stick parity +#define SIO_LCR_SB 0x40 // set break +#define SIO_LCR_DLAB 0x80 // divisor latch access bit + +// Modem Control Register +#define SIO_MCR_DTR 0x01 +#define SIO_MCR_RTS 0x02 +#define SIO_MCR_INT 0x08 // Enable interrupts + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +//----------------------------------------------------------------------------- + +static void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8* base = chan->base; + cyg_uint8 lcr; + int _brg = _BRG(CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD); + + // 8-1-no parity. + HAL_WRITE_UINT8(base+CYG_DEV_LCR, SIO_LCR_WLS0 | SIO_LCR_WLS1); + + // Set the baud rate + HAL_READ_UINT8(base+CYG_DEV_LCR, lcr); + lcr |= SIO_LCR_DLAB; + HAL_WRITE_UINT8(base+CYG_DEV_LCR, lcr); + HAL_WRITE_UINT8(base+CYG_DEV_DLL, _brg & 0xFF); + HAL_WRITE_UINT8(base+CYG_DEV_DLM, _brg >> 8); + lcr &= ~SIO_LCR_DLAB; + HAL_WRITE_UINT8(base+CYG_DEV_LCR, lcr); + + // Enable & clear FIFO + HAL_WRITE_UINT8(base+CYG_DEV_FCR, 0x07); + + // Configure interrupt + HAL_INTERRUPT_CONFIGURE(chan->isr_vector, 1, 1); // Interrupt when IRQ is high +} + +void +cyg_hal_plf_serial_putc(void *__ch_data, char c) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 lsr; + CYGARC_HAL_SAVE_GP(); + +#ifdef CYGSEM_HAL_DIAG_USES_LEDS + *(cyg_uint32 *)_FRV400_MB_LEDS = ~(0xC000 | c); +#endif // CYGSEM_HAL_DIAG_USES_LEDS + do { + HAL_READ_UINT8(base+CYG_DEV_LSR, lsr); + } while ((lsr & SIO_LSR_THRE) == 0); + + HAL_WRITE_UINT8(base+CYG_DEV_THR, c); + + CYGARC_HAL_RESTORE_GP(); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 lsr; + + HAL_READ_UINT8(base+CYG_DEV_LSR, lsr); + if ((lsr & SIO_LSR_DR) == 0) + return false; + + HAL_READ_UINT8(base+CYG_DEV_RBR, *ch); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + +#ifdef CYGSEM_HAL_DIAG_USES_LEDS + *(cyg_uint32 *)_FRV400_MB_LEDS = ~(0x1000); +#endif // CYGSEM_HAL_DIAG_USES_LEDS + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); +#ifdef CYGSEM_HAL_DIAG_USES_LEDS + *(cyg_uint32 *)_FRV400_MB_LEDS = ~(0x3000 | ch); +#endif // CYGSEM_HAL_DIAG_USES_LEDS + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +static channel_data_t pid_ser_channels[] = { + { (cyg_uint8*)_FRV400_UART0, 1000, CYGNUM_HAL_INTERRUPT_SERIALA }, +#if CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS > 1 + { (cyg_uint8*)_FRV400_UART1, 1000, CYGNUM_HAL_INTERRUPT_SERIALB }, +#endif +}; + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + HAL_WRITE_UINT8(chan->base+CYG_DEV_IER, SIO_IER_RCV); + HAL_WRITE_UINT8(chan->base+CYG_DEV_MCR, SIO_MCR_INT|SIO_MCR_DTR|SIO_MCR_RTS); + + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + HAL_WRITE_UINT8(chan->base+CYG_DEV_IER, 0); + + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + char c; + cyg_uint8 lsr; + CYGARC_HAL_SAVE_GP(); + + *__ctrlc = 0; + HAL_READ_UINT8(chan->base+CYG_DEV_LSR, lsr); + if ( (lsr & SIO_LSR_DR) != 0 ) { + + HAL_READ_UINT8(chan->base+CYG_DEV_RBR, c); + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + cyg_drv_interrupt_acknowledge(chan->isr_vector); + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Special case - turn on clocks for UARTS + HAL_WRITE_UINT32(_FRV400_UART0+CYG_DEV_CLK, 0x80<<24); + + // Disable interrupts. + HAL_INTERRUPT_MASK(pid_ser_channels[0].isr_vector); +#if CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS > 1 + HAL_INTERRUPT_MASK(pid_ser_channels[1].isr_vector); +#endif + + // Init channels + cyg_hal_plf_serial_init_channel(&pid_ser_channels[0]); +#if CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS > 1 + cyg_hal_plf_serial_init_channel(&pid_ser_channels[1]); +#endif + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &pid_ser_channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + +#if CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS > 1 + // Set channel 1 + CYGACC_CALL_IF_SET_CONSOLE_COMM(1); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &pid_ser_channels[1]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); +#endif + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +/*---------------------------------------------------------------------------*/ +/* End of hal_diag.c */ diff --git a/packages/hal/h8300/aki3068net/current/ChangeLog b/packages/hal/h8300/aki3068net/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/ChangeLog @@ -0,0 +1,45 @@ +2002-04-29 Jonathan Larmour + + * src/delay_us.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-24 Yoshinori Sato + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/h8300/aki3068net/current/cdl/hal_h8300_h8300h_aki3068net.cdl b/packages/hal/h8300/aki3068net/current/cdl/hal_h8300_h8300h_aki3068net.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/cdl/hal_h8300_h8300h_aki3068net.cdl @@ -0,0 +1,245 @@ +# ==================================================================== +# +# hal_h8300_h8300h_sim.cdl +# +# AKI3068NET board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: bartv +# Contributors: +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300_H8300H_AKI3068NET { + display "AKI3068NET" + parent CYGPKG_HAL_H8300 + requires CYGPKG_HAL_H8300_H8300H + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + define_header hal_h8300_h8300h_aki3068net.h + include_dir cyg/hal + description " + The aki HAL package provides the support needed to run + eCos on a Akizuki H8/3068 Network micom board." + + compile hal_diag.c plf_misc.c delay_us.S + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + + puts $::cdl_header "#define CYG_HAL_H8300" + puts $::cdl_header "#define CYGNUM_HAL_H8300_SCI_PORTS 1" + puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0xfffe20" + puts $::cdl_header "#define HAL_PLATFORM_CPU \"H8/300H\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"Akizuki H8/3068 Network micom\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"ROM" "RAM"} + default_value {"ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the AKI3068NET board it is possible to + build the system for either RAM bootstrap or ROM bootstrap. + RAM bootstrap generally requires that the board + is equipped with ROMs containing a suitable ROM monitor or + equivalent software that allows GDB to download the eCos + application and extend Memory on to the board. + The ROM bootstrap typically + requires that the eCos application be blown into EPROMs or + equivalent technology." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The AKI3068NET board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The CQ/7708 board has only one serial port. This option + chooses which port will be used for diagnostic output." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants." + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + cdl_option CYGNUM_HAL_H8300_RTC_PRESCALE { + display "Real-time clock base prescale" + flavor data + calculated 8192 + } + # Isn't a nice way to handle freq requirement! + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated 10 + } + } + + cdl_option CYGHWR_HAL_H8300_CPG_INPUT { + display "OSC/Clock Freqency" + flavor data + default_value 20000000 + } + + cdl_option CYGHWR_HAL_AKI3068NET_EXTRAM { + display "Extend DRAM Using" + flavor bool + default_value 1 + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "h8300-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -mh -mint32 -fsigned-char -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-g -nostdlib -Wl,--gc-sections -Wl,-static -mh" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "h8300_h8300h_aki3068net_ram" : \ + "h8300_h8300h_aki3068net_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + } + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } +} diff --git a/packages/hal/h8300/aki3068net/current/doc/README b/packages/hal/h8300/aki3068net/current/doc/README new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/doc/README @@ -0,0 +1,2 @@ +Please visit http://homepage2.nifty.com/ysato/eCos/index.en.html for up to date +information, particularly on which GNU tools to use and patches. diff --git a/packages/hal/h8300/aki3068net/current/include/hal_diag.h b/packages/hal/h8300/aki3068net/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/include/hal_diag.h @@ -0,0 +1,80 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-04-06 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include + +externC void hal_diag_init(void); +externC void hal_diag_write_char(cyg_uint8 c); +externC void hal_diag_read_char(cyg_uint8 *c); + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +//----------------------------------------------------------------------------- +// Simple LED control. +externC void hal_diag_led_on( void ); +externC void hal_diag_led_off( void ); + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_HAL_DIAG_H */ diff --git a/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.h b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.h @@ -0,0 +1,14 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include +#include + +#endif + +#define CYGMEM_REGION_ram (0x420000) +#define CYGMEM_REGION_ram_SIZE (0x1E0000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + diff --git a/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300h) + +MEMORY +{ + ram : ORIGIN = 0x400000, LENGTH = 0x20000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_text (ram, 0x400000, LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_int_fook_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4),LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4),LMA_EQ_VMA) + SECTIONS_END +} + +fook_table_address = 0xffbf20; diff --git a/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.mlt b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.mlt @@ -0,0 +1,12 @@ +version 0 +region ram 400000 10000 0 ! +section text 0 1 0 1 0 1 0 1 400000 400000 fini fini ! +section fini 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 int_fook_table int_fook_table ! +section int_fook_table 0 1 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 0 ! + diff --git a/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.h b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.h @@ -0,0 +1,18 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include +#include + +#endif + +#define CYGMEM_REGION_ram (0x400000) +#if !defined(CYGPKG_IO_ETH_DRIVERS) +#define CYGMEM_REGION_ram_SIZE (0x200000) +#else +#define CYGMEM_REGION_ram_SIZE (0x200000-0xC000) +#endif +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + diff --git a/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi @@ -0,0 +1,41 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300h) + +MEMORY +{ + rom : ORIGIN = 0x000000, LENGTH = 0x60000 +#if !defined(CYGPKG_IO_ETH_DRIVERS) + ram : ORIGIN = 0xffbf20, LENGTH = 0x4000-0x100 +#else + ram : ORIGIN = 0x5F4000, LENGTH = 0xC000 + iram : ORIGIN = 0xffbf20, LENGTH = 0x4000-0x100 +#endif +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) +#if !defined(CYGPKG_IO_ETH_DRIVERS) + SECTION_int_fook_table (ram, 0xffbf20,FOLLOWING (.gcc_except_table)) + SECTION_data (ram, ALIGN (0x4),FOLLOWING (.int_fook_table)) + SECTION_bss (ram, ALIGN (0x4),LMA_EQ_VMA) +#else + SECTION_data (ram, 0x5F4000,FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4),LMA_EQ_VMA) + SECTION_int_fook_table (iram, 0xffbf20,FOLLOWING (.data)) +#endif + SECTIONS_END +} diff --git a/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.mlt b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.mlt @@ -0,0 +1,12 @@ +version 0 +region ram ffbf20 ffff20 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 0 60000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/h8300/aki3068net/current/include/platform.inc b/packages/hal/h8300/aki3068net/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/include/platform.inc @@ -0,0 +1,127 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## AKI3068NET "board" assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): jlarmour +## Contributors: Yoshinori Sato +## Date: 1999-09-09 +## Purpose: AKI3068NET "board" definitions. +## Description: This file contains various definitions and macros that are +## required for writing assembly code for the AKI3068NET board +## Currently there are none +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include +#include + +##----------------------------------------------------------------------------- + +#define CYGPKG_HAL_H8300_MEMC_DEFINED + .macro hal_memc_init +#if defined(CYG_HAL_STARTUP_ROM) + mov.l #init_regs,er0 + mov.w #8,e1 +1: + mov.l @er0+,er2 + mov.w @er0+,r1 + mov.b r1l,@er2 + dec.w #1,e1 + bne 1b + bra 2f + +init_regs: + .long CYGARC_RTCOR + .word 5 ; 1.5[ms] reflesh cycle + .long CYGARC_RTMCSR + .word 0x30 ; clk x 2048 + .long CYGARC_DRCRB + .word 0x90 + .long CYGARC_DRCRA + .word 0x22 + .long CYGARC_P1DDR + .word 0xff + .long CYGARC_P2DDR + .word 0xff + .long CYGARC_P5DDR + .word 0x01 + .long CYGARC_P8DDR + .word 0x0c +init_regs_end: + +2: +#endif + .endm + +#define CYGPKG_HAL_H8300_DIAG_DEFINED + + .macro hal_diag_init + mov.b #0x83,r0l + mov.b r0l,@CYGARC_PADDR + mov.b #0,r0l + mov.b r0l,@CYGARC_PADR + .endm + + .macro hal_diag_excpt_start + .endm + + .macro hal_diag_intr_start + .endm + + .macro hal_diag_restore + .endm + + .macro hal_diag_data + .endm + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/packages/hal/h8300/aki3068net/current/include/plf_intr.h b/packages/hal/h8300/aki3068net/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/include/plf_intr.h @@ -0,0 +1,76 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// AKI3068NET board interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1999-09-09 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the simulator. This file +// is empty since none are required! +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +//-------------------------------------------------------------------------- + +externC void h8300h_reset (void); +externC void hal_delay_us(int usecs); + +#define HAL_PLATFORM_RESET(x) +#define HAL_PLATFORM_RESET_ENTRY &h8300h_reset + +#define HAL_DELAY_US(n) hal_delay_us((n) / 16) + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/h8300/aki3068net/current/include/plf_stub.h b/packages/hal/h8300/aki3068net/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/include/plf_stub.h @@ -0,0 +1,90 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-05-18 +// Purpose: Platform HAL stub support for H8/300H simulator +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM, externC + +#include // architecture stub support + +#include // hal_diag_led_on + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#ifdef CYGSEM_HAL_ROM_MONITOR +# define HAL_STUB_PLATFORM_INIT() hal_diag_led_on() +#else +# define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT +#endif + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/h8300/aki3068net/current/src/delay_us.S b/packages/hal/h8300/aki3068net/current/src/delay_us.S new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/src/delay_us.S @@ -0,0 +1,39 @@ +;;delay_us + +#include + +#include +#include +#include + +#define DELAY_COUNT (CYGHWR_HAL_H8300_PROCESSOR_SPEED/1000000)*16/8 + +// .file "delay_us.S" + .h8300h + .text + + .global CYG_LABEL_DEFN(hal_delay_us) +CYG_LABEL_DEFN(hal_delay_us): + mov.b #0,r1l + mov.b r1l,@CYGARC_8TCNT2:8 + mov.b r1l,@CYGARC_8TCSR2:8 + mov.b #DELAY_COUNT+1,r1l + mov.b r1l,@CYGARC_TCORA2:8 + mov.b #0x09,r1l + mov.b r1l,@CYGARC_8TCR2:8 + mov.b #0,r2h + sub.w e1,e1 +1: + mov.l er0,er0 + ble 3f +2: + btst #6,@CYGARC_8TCSR2:8 + beq 2b + bclr #6,@CYGARC_8TCSR2:8 + dec.l #1,er0 + bra 1b +3: + mov.b #0,r0l + mov.b r0l,@CYGARC_8TCR2 + rts + diff --git a/packages/hal/h8300/aki3068net/current/src/hal_diag.c b/packages/hal/h8300/aki3068net/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/src/hal_diag.c @@ -0,0 +1,187 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dsm +// Contributors: dsm +// Date: 1998-03-13 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include +#include +#include +#include +#include + +#define SCI_BASE ((cyg_uint8*)0xffffb8) + +static channel_data_t channel = { (cyg_uint8*)SCI_BASE, 0, 0}; + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_sci_init(0, 0, CYGNUM_HAL_INTERRUPT_RXI1, SCI_BASE); +} + +//============================================================================= +// Led control +//============================================================================= +#define LED CYGARC_PADR + +void +hal_diag_led_on( void ) +{ + HAL_WRITE_UINT8(LED, 0x01); +} + +void +hal_diag_led_off( void ) +{ + HAL_WRITE_UINT8(LED, 0); +} + +//============================================================================= +// Compatibility with older stubs +//============================================================================= + +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) +#include // hal_output_gdb_string +#endif + +void hal_diag_init(void) +{ + cyg_hal_plf_sci_init_channel(&channel); +} + +void +hal_diag_write_char( cyg_uint8 c ) +{ +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + static char line[100]; + static int pos = 0; + + // No need to send CRs + if( c == '\r' ) return; + + line[pos++] = c; + + if( c == '\n' || pos == sizeof(line) ) + { + CYG_INTERRUPT_STATE old; + + // Disable interrupts. This prevents GDB trying to interrupt us + // while we are in the middle of sending a packet. The serial + // receive interrupt will be seen when we re-enable interrupts + // later. + + CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old); + + while(1) + { + char c1; + static char hex[] = "0123456789ABCDEF"; + cyg_uint8 csum = 0; + int i; + + cyg_hal_plf_sci_putc(&channel, '$'); + cyg_hal_plf_sci_putc(&channel, 'O'); + csum += 'O'; + for( i = 0; i < pos; i++ ) + { + char ch = line[i]; + char h = hex[(ch>>4)&0xF]; + char l = hex[ch&0xF]; + cyg_hal_plf_sci_putc(&channel, h); + cyg_hal_plf_sci_putc(&channel, l); + csum += h; + csum += l; + } + cyg_hal_plf_sci_putc(&channel, '#'); + cyg_hal_plf_sci_putc(&channel, hex[(csum>>4)&0xF]); + cyg_hal_plf_sci_putc(&channel, hex[csum&0xF]); + + // Wait for the ACK character '+' from GDB here and handle + // receiving a ^C instead. + c1 = (char) cyg_hal_plf_sci_getc(&channel); + + if( c1 == '+' ) + break; // a good acknowledge + + // Check for user break. + if( cyg_hal_is_break( &c1, 1 ) ) + cyg_hal_user_break( NULL ); + + // otherwise, loop round again + } + + pos = 0; + + // And re-enable interrupts + CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old); + } +#else // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + cyg_hal_plf_sci_putc(&channel, c); +#endif +} + +void +hal_diag_read_char(cyg_uint8 *c) +{ + *c = (char) cyg_hal_plf_sci_getc(&channel); +} + +/*===========================================================================*/ +/* EOF hal_diag.c */ + diff --git a/packages/hal/h8300/aki3068net/current/src/plf_misc.c b/packages/hal/h8300/aki3068net/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/aki3068net/current/src/plf_misc.c @@ -0,0 +1,161 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour +// Date: 1999-09-09 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // Base types + +#include // architectural definitions +#include +#include +#include +#include + +/*------------------------------------------------------------------------*/ + +void hal_platform_init(void) +{ + hal_if_init(); +} + +void h8300h_reset(void) +{ + __asm__ ("ldc #0x80,ccr\n" + "jmp @@0\n\t"); +} + +/*------------------------------------------------------------------------*/ +/* Control C ISR support */ + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +struct Hal_SavedRegisters *hal_saved_interrupt_state; + +#endif + +/*------------------------------------------------------------------------*/ +/* clock support */ + +void hal_clock_initialize(cyg_uint32 period) +{ + CYG_BYTE prescale; +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8 + prescale = 0x01; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 64 + prescale = 0x02; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8192 + prescale = 0x03; +#else +#error illigal RTC prescale setting +#endif +#endif +#endif + HAL_WRITE_UINT8(CYGARC_TCORA3,period); + HAL_WRITE_UINT8(CYGARC_8TCNT3,0x00); + HAL_WRITE_UINT8(CYGARC_8TCR3,0x48 | prescale); + HAL_WRITE_UINT8(CYGARC_8TCSR3,0x00); +} + +void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + HAL_WRITE_UINT8(CYGARC_8TCR3,0x00); + HAL_WRITE_UINT8(CYGARC_8TCSR3,0x00); + hal_clock_initialize(period); +} + +void hal_clock_read(cyg_uint32 *pvalue) +{ + CYG_BYTE val; + HAL_READ_UINT8(CYGARC_8TCNT3,val); + *pvalue = val; +} + +//--------------------------------------------------------------------------- +// Low-level delay (in microseconds) + +#if 0 +void hal_delay_us(int usecs) +{ + volatile CYG_BYTE *tcr = (CYG_BYTE *)CYGARC_8TCR2; + volatile CYG_BYTE *tcnt = (CYG_BYTE *)CYGARC_8TCNT2; + short clocks_per_us = (CYGHWR_HAL_H8300_PROCESSOR_SPEED/1000000)/8*25; + //short clocks_per_us = (CYGHWR_HAL_H8300_PROCESSOR_SPEED/1000000)/20; + unsigned char val1,val2; + short diff; + + usecs /= 25; + + *tcnt = 0x00; + *tcr = 0x01; + + diff = 0; + while (usecs > 0) { + while (diff < clocks_per_us) { + val1 = *tcnt; + while ((val2 = *tcnt) == val1); + if (val2 < val1) + diff += val2 + 0x100 - val1; + else + diff += val2 - val1; + } + usecs -= diff / clocks_per_us; + diff -= clocks_per_us; + } + *tcr = 0x00; +} +#endif + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/packages/hal/h8300/arch/current/ChangeLog b/packages/hal/h8300/arch/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/ChangeLog @@ -0,0 +1,45 @@ +2002-04-29 Jonathan Larmour + + * src/vectors.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-24 Yoshinori Sato + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/h8300/arch/current/cdl/hal_h8300.cdl b/packages/hal/h8300/arch/current/cdl/hal_h8300.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/cdl/hal_h8300.cdl @@ -0,0 +1,89 @@ +# ==================================================================== +# +# hal_h8300.cdl +# +# H8/300 architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: bartv, nickg +# Contributors: dmoseley +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300 { + display "H8/300 architecture" + parent CYGPKG_HAL + hardware + include_dir cyg/hal + define_header hal_h8300.h + description " + The H8/300 architecture HAL package provides generic + support for this processor architecture. It is also + necessary to select a specific target platform HAL + package." + + cdl_interface CYGINT_HAL_H8300_VARIANT { + display "Number of variant implementations in this configuration" + requires 1 == CYGINT_HAL_H8300_VARIANT + } + + cdl_option CYGDBG_HAL_H8300_DEBUG_GDB_CTRLC_SUPPORT { + display "Architecture GDB CTRLC support" + calculated { CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT || CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT } + active_if { CYGINT_HAL_DEBUG_GDB_CTRLC_UNSUPPORTED == 0 } + description " + If either the CTRLC or BREAK support options in hal.h are set + then set our own option to turn on shared generic support for + control C handling." + } + + compile hal_misc.c hal_syscall.c context.S h8300_stub.c + + make { + /lib/vectors.o : /src/vectors.S + $(CC) -Wp,-MD,vectors.tmp $(INCLUDE_PATH) $(CFLAGS) -c -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 vectors.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm vectors.tmp + } +} diff --git a/packages/hal/h8300/arch/current/doc/README b/packages/hal/h8300/arch/current/doc/README new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/doc/README @@ -0,0 +1,2 @@ +Please visit http://homepage2.nifty.com/ysato/eCos/index.en.html for up to date +information, particularly on which GNU tools to use and patches. diff --git a/packages/hal/h8300/arch/current/include/arch.inc b/packages/hal/h8300/arch/current/include/arch.inc new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/include/arch.inc @@ -0,0 +1,195 @@ +#ifndef CYGONCE_HAL_ARCH_INC +#define CYGONCE_HAL_ARCH_INC +##============================================================================= +## +## arch.inc +## +## H8/300 assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): yoshinori sato +## Contributors: yoshinori sato +## Date: 2002-02-14 +## Purpose: Architecture definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the H8300 CPU family. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include + +##----------------------------------------------------------------------------- +## CPU specific macros. These provide a common assembler interface to +## operations that may have CPU specific implementations on different +## variants of the architecture. + +#ifndef CYGPKG_HAL_H8300_CPU_INIT_DEFINED + # Initialize CPU + .macro hal_cpu_init + # Set up the PSW + ldc #0xc0,ccr + .endm +#endif + + # Enable interrupts + .macro hal_cpu_int_enable + andc #0x3f,ccr + .endm + + # Disable interrupts + .macro hal_cpu_int_disable + orc #0xc0,ccr + .endm + + # Merge the interrupt enable state of the status register in + # \sr with the current sr. + .macro hal_cpu_int_merge sr wk=r0l + and.b #0xc0,\sr + stc ccr,\wk + bclr #7,\wk + or \sr,\wk + ldc \wk,ccr + .endm + + # Enable further exception processing, and disable + # interrupt processing. + .macro hal_cpu_except_enable + .endm + + # Return from exception. + .macro hal_cpu_eret pc,sr + .endm + +##----------------------------------------------------------------------------- +# Default interrupt decoding macros. + +#ifndef CYGPKG_HAL_H8300_INTC_DEFINED + +#ifndef CYGPKG_HAL_H8300_INTC_INIT_DEFINED + # initialize all interrupts to disabled + .macro hal_intc_init + .endm +#endif + + .macro hal_intc_decode vnum + .endm + +#endif + +#------------------------------------------------------------------------------ +# MMU macros. + +#ifndef CYGPKG_HAL_H8300_MMU_DEFINED + + .macro hal_mmu_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# MEMC macros. + +#ifndef CYGPKG_HAL_H8300_MEMC_DEFINED + + .macro hal_memc_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# Cache macros. + +#ifndef CYGPKG_HAL_H8300_CACHE_DEFINED + + .macro hal_cache_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# Diagnostics macros. + +#ifndef CYGPKG_HAL_H8300_DIAG_DEFINED + + .macro hal_diag_init + .endm + + .macro hal_diag_excpt_start + .endm + + .macro hal_diag_intr_start + .endm + + .macro hal_diag_restore + .endm + + .macro hal_diag_data + .endm +#endif + +#------------------------------------------------------------------------------ +# Timer initialization. + +#ifndef CYGPKG_HAL_H8300_TIMER_DEFINED + + .macro hal_timer_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# Monitor initialization. + +#ifndef CYGPKG_HAL_H8300_MON_DEFINED + + .macro hal_mon_init + .endm + +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_ARCH_INC +# end of arch.inc diff --git a/packages/hal/h8300/arch/current/include/basetype.h b/packages/hal/h8300/arch/current/include/basetype.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/include/basetype.h @@ -0,0 +1,65 @@ +#ifndef CYGONCE_HAL_BASETYPE_H +#define CYGONCE_HAL_BASETYPE_H + +//============================================================================= +// +// basetype.h +// +// Standard types for this architecture. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 1997-09-08 +// Purpose: Define architecture base types. +// Usage: Included by "cyg_type.h", do not use directly +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//----------------------------------------------------------------------------- +// Characterize the architecture + +#define CYG_BYTEORDER CYG_MSBFIRST // Big endian + +#define CYG_LABEL_DEFN(_name_) _##_name_ + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_BASETYPE_H +// End of basetype.h diff --git a/packages/hal/h8300/arch/current/include/h8300_stub.h b/packages/hal/h8300/arch/current/include/h8300_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/include/h8300_stub.h @@ -0,0 +1,112 @@ +#ifndef CYGONCE_HAL_H8300_STUB_H +#define CYGONCE_HAL_H8300_STUB_H +//======================================================================== +// +// h8300_stub.h +// +// H8/300-specific definitions for generic stub +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-13 +// Purpose: +// Description: H8/300-specific definitions for generic stub +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#ifdef __cplusplus +extern "C" { +#endif + +#define NUMREGS 32 + +#define REGSIZE( _x_ ) (4) + +typedef unsigned long target_register_t; + +enum regnames { + ER0,ER1,ER2,ER3,ER4,ER5,ER6, + SP, PC, CCR +}; + +typedef enum regnames regnames_t; + +/* Given a trap value TRAP, return the corresponding signal. */ +extern int __computeSignal (unsigned int trap_number); + +/* Return the SPARC trap number corresponding to the last-taken trap. */ +extern int __get_trap_number (void); + +/* Return the currently-saved value corresponding to register REG. */ +extern target_register_t get_register (regnames_t reg); + +/* Store VALUE in the register corresponding to WHICH. */ +extern void put_register (regnames_t which, target_register_t value); + +/* Set the currently-saved pc register value to PC. This also updates NPC + as needed. */ +extern void set_pc (target_register_t pc); + +/* Set things up so that the next user resume will execute one instruction. + This may be done by setting breakpoints or setting a single step flag + in the saved user registers, for example. */ +void __single_step (void); + +/* Clear the single-step state. */ +void __clear_single_step (void); + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ +extern int __is_breakpoint_function (void); + +/* Skip the current instruction. */ +extern void __skipinst (void); + +extern void __install_breakpoints (void); + +extern void __clear_breakpoints (void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // ifndef CYGONCE_HAL_H8300_STUB_H diff --git a/packages/hal/h8300/arch/current/include/hal_arch.h b/packages/hal/h8300/arch/current/include/hal_arch.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/include/hal_arch.h @@ -0,0 +1,295 @@ +#ifndef CYGONCE_HAL_HAL_ARCH_H +#define CYGONCE_HAL_HAL_ARCH_H +//========================================================================== +// +// hal_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 1999-02-18 +// Purpose: Define architecture abstractions +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +#include + +//-------------------------------------------------------------------------- +// Exception handling function. +// This function is defined by the kernel according to this prototype. It is +// invoked from the HAL to deal with any CPU exceptions that the HAL does +// not want to deal with itself. It usually invokes the kernel's exception +// delivery mechanism. + +externC void cyg_hal_deliver_exception( CYG_WORD code, CYG_ADDRWORD data ); + +//-------------------------------------------------------------------------- +// Bit manipulation routines + +externC cyg_uint32 hal_lsbit_index(cyg_uint32 mask); +externC cyg_uint32 hal_msbit_index(cyg_uint32 mask); + +#define HAL_LSBIT_INDEX(index, mask) index = hal_lsbit_index(mask); + +#define HAL_MSBIT_INDEX(index, mask) index = hal_msbit_index(mask); + +//-------------------------------------------------------------------------- +// Context Initialization +// Initialize the context of a thread. +// Arguments: +// _sp_ name of variable containing current sp, will be written with new sp +// _thread_ thread object address, passed as argument to entry point +// _entry_ entry point address. +// _id_ bit pattern used in initializing registers, for debugging. + +#ifndef HAL_THREAD_INIT_CONTEXT_EXTRA +#define HAL_THREAD_INIT_CONTEXT_EXTRA(_regs_, _id_) +#endif + +#define HAL_THREAD_INIT_CONTEXT( _sp_, _thread_, _entry_, _id_ ) \ +{ \ + register HAL_SavedRegisters *_regs_; \ + _regs_ = (HAL_SavedRegisters *)(((CYG_ADDRWORD)(_sp_)&~15) - \ + sizeof(HAL_SavedRegisters)*2); \ + HAL_THREAD_INIT_CONTEXT_EXTRA(_regs_, _id_); \ + _regs_->er0 = (CYG_WORD)(_thread_); \ + _regs_->er1 = (_id_)|0xddd1; \ + _regs_->er2 = (_id_)|0xddd2; \ + _regs_->er3 = (_id_)|0xddd3; \ + _regs_->er4 = (_id_)|0xddd4; \ + _regs_->er5 = (_id_)|0xddd5; \ + _regs_->er6 = (_id_)|0xddd6; \ + _regs_->ccr = 0x00; \ + _regs_->pc = (CYG_WORD)(_entry_); \ + _sp_ = (CYG_ADDRESS)_regs_; \ +} + +//-------------------------------------------------------------------------- +// Context switch macros. +// The arguments are pointers to locations where the stack pointer +// of the current thread is to be stored, and from where the sp of the +// next thread is to be fetched. + +externC void hal_thread_switch_context( CYG_ADDRESS to, CYG_ADDRESS from ); +externC void hal_thread_load_context( CYG_ADDRESS to ) + __attribute__ ((noreturn)); + +#define HAL_THREAD_SWITCH_CONTEXT(_fspptr_,_tspptr_) \ + hal_thread_switch_context((CYG_ADDRESS)_tspptr_, \ + (CYG_ADDRESS)_fspptr_); + +#define HAL_THREAD_LOAD_CONTEXT(_tspptr_) \ + hal_thread_load_context( (CYG_ADDRESS)_tspptr_ ); + +//-------------------------------------------------------------------------- +// Execution reorder barrier. +// When optimizing the compiler can reorder code. In multithreaded systems +// where the order of actions is vital, this can sometimes cause problems. +// This macro may be inserted into places where reordering should not happen. + +#define HAL_REORDER_BARRIER() asm volatile ( "" : : : "memory" ) + +//-------------------------------------------------------------------------- +// Breakpoint support +// HAL_BREAKPOINT() is a code sequence that will cause a breakpoint to +// happen if executed. +// HAL_BREAKINST is the value of the breakpoint instruction and +// HAL_BREAKINST_SIZE is its size in bytes. + +#define __HAL_BREAKPOINT(_label_) # _label_ +#define HAL_BREAKPOINT(_label_) \ +asm volatile (" .globl " __HAL_BREAKPOINT(_label_) "\n" \ + __HAL_BREAKPOINT(_label_) ":\n\t" \ + "trapa #3" \ + ); + +#define HAL_BREAKINST 0x5703 + +#define HAL_BREAKINST_SIZE 2 + +//-------------------------------------------------------------------------- +// Thread register state manipulation for GDB support. + +// Translate a stack pointer as saved by the thread context macros above into +// a pointer to a HAL_SavedRegisters structure. +#define HAL_THREAD_GET_SAVED_REGISTERS( _sp_, _regs_ ) \ + (_regs_) = (HAL_SavedRegisters *)(_sp_) + +#ifndef HAL_GET_GDB_EXTRA_REGISTERS +#define HAL_GET_GDB_EXTRA_REGISTERS( _regval_, _regs_ ) +#endif +#ifndef HAL_SET_GDB_EXTRA_REGISTERS +#define HAL_SET_GDB_EXTRA_REGISTERS( _regs_, _regval_ ) +#endif + + +// Copy a set of registers from a HAL_SavedRegisters structure into a +// GDB ordered array. +#define HAL_GET_GDB_REGISTERS( _aregval_ , _regs_ ) \ +{ \ + CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ + \ + _regval_[0] = (_regs_)->er0; \ + _regval_[1] = (_regs_)->er1; \ + _regval_[2] = (_regs_)->er2; \ + _regval_[3] = (_regs_)->er3; \ + _regval_[4] = (_regs_)->er4; \ + _regval_[5] = (_regs_)->er5; \ + _regval_[6] = (_regs_)->er6; \ + \ + _regval_[7] = (CYG_ADDRWORD)(_regs_) + \ + sizeof(HAL_SavedRegisters); \ + _regval_[8] = (_regs_)->pc; \ + _regval_[9] = (_regs_)->ccr; \ + \ + HAL_GET_GDB_EXTRA_REGISTERS( _regval_, _regs_ ); \ +} + +// Copy a GDB ordered array into a HAL_SavedRegisters structure. +#define HAL_SET_GDB_REGISTERS( _regs_ , _aregval_ ) \ +{ \ + CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ + \ + (_regs_)->er0 = _regval_[0]; \ + (_regs_)->er1 = _regval_[1]; \ + (_regs_)->er2 = _regval_[2]; \ + (_regs_)->er3 = _regval_[3]; \ + (_regs_)->er4 = _regval_[4]; \ + (_regs_)->er5 = _regval_[5]; \ + (_regs_)->er6 = _regval_[6]; \ + \ + (_regs_)->pc = _regval_[8]; \ + (_regs_)->ccr = _regval_[9]; \ + \ + /* We do not allow the SP or PSW to be set. Changing the SP will \ + * mess up the saved state. No PSW is saved on thread context \ + * switches, so there is nowhere to save it to. \ + */ \ + \ + HAL_SET_GDB_EXTRA_REGISTERS( _regs_, _regval_ ); \ +} + +//------------------------------------------------------------------------- +// HAL setjmp +// Note: These definitions are repeated in context.S. If changes are required +// remember to update both sets. + +#define CYGARC_JMP_BUF_SP 0 +#define CYGARC_JMP_BUF_ER3 1 +#define CYGARC_JMP_BUF_ER4 2 +#define CYGARC_JMP_BUF_ER5 3 +#define CYGARC_JMP_BUF_ER6 4 +#define CYGARC_JMP_BUF_PC 5 + +#define CYGARC_JMP_BUF_SIZE 6 + +typedef cyg_uint32 hal_jmp_buf[CYGARC_JMP_BUF_SIZE]; + +externC int hal_setjmp(hal_jmp_buf env); +externC void hal_longjmp(hal_jmp_buf env, int val); + +//------------------------------------------------------------------------- +// Idle thread code. +// This macro is called in the idle thread loop, and gives the HAL the +// chance to insert code. Typical idle thread behaviour might be to halt the +// processor. + +externC void hal_idle_thread_action(cyg_uint32 loop_count); + +#define HAL_IDLE_THREAD_ACTION(_count_) hal_idle_thread_action(_count_) + +//----------------------------------------------------------------------------- +// Minimal and sensible stack sizes: the intention is that applications +// will use these to provide a stack size in the first instance prior to +// proper analysis. Idle thread stack should be this big. + +// THESE ARE NOT INTENDED TO BE MICROMETRICALLY ACCURATE FIGURES. +// THEY ARE HOWEVER ENOUGH TO START PROGRAMMING. +// YOU MUST MAKE YOUR STACKS LARGER IF YOU HAVE LARGE "AUTO" VARIABLES! + +// We define quite large stack needs for SPARClite, for it requires 576 +// bytes (144 words) to process an interrupt and thread-switch, and +// momentarily, but needed in case of recursive interrupts, it needs 208 +// words - if a sequence of saves to push out other regsets is interrupted. + +// This is not a config option because it should not be adjusted except +// under "enough rope" sort of disclaimers. + +// Worst case stack frame size: return link + 4 args + 4 pushed registers. +#define CYGNUM_HAL_STACK_FRAME_SIZE (40) + +// Stack needed for a context switch: +#define CYGNUM_HAL_STACK_CONTEXT_SIZE (60) + +// Interrupt + call to ISR, interrupt_end() and the DSR +#define CYGNUM_HAL_STACK_INTERRUPT_SIZE (128) + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// An interrupt stack which is large enough for all possible interrupt +// conditions (and only used for that purpose) exists. "User" stacks +// can be much smaller + +#define CYGNUM_HAL_STACK_SIZE_MINIMUM (CYGNUM_HAL_STACK_CONTEXT_SIZE+ \ + CYGNUM_HAL_STACK_INTERRUPT_SIZE*2+ \ + CYGNUM_HAL_STACK_FRAME_SIZE*16) +#define CYGNUM_HAL_STACK_SIZE_TYPICAL (2048) + +#else // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// No separate interrupt stack exists. Make sure all threads contain +// a stack sufficiently large. + +#define CYGNUM_HAL_STACK_SIZE_MINIMUM (4096) +#define CYGNUM_HAL_STACK_SIZE_TYPICAL (4096) + +#endif + +#define CYGARC_HAL_SAVE_GP() +#define CYGARC_HAL_RESTORE_GP() +//-------------------------------------------------------------------------- +#endif // CYGONCE_HAL_HAL_ARCH_H +// EOF hal_arch.h diff --git a/packages/hal/h8300/arch/current/include/hal_cache.h b/packages/hal/h8300/arch/current/include/hal_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/include/hal_cache.h @@ -0,0 +1,188 @@ +#ifndef CYGONCE_HAL_CACHE_H +#define CYGONCE_HAL_CACHE_H + +//============================================================================= +// +// hal_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-13 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + + + +//----------------------------------------------------------------------------- +// Cache dimensions + +// Data cache +#define HAL_DCACHE_SIZE 0 // Size of data cache in bytes +#define HAL_DCACHE_LINE_SIZE 0 // Size of a data cache line +#define HAL_DCACHE_WAYS 0 // Associativity of the cache + +// Instruction cache +#define HAL_ICACHE_SIZE 0 // Size of cache in bytes +#define HAL_ICACHE_LINE_SIZE 0 // Size of a cache line +#define HAL_ICACHE_WAYS 0 // Associativity of the cache + +#define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS)) +#define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS)) + +//----------------------------------------------------------------------------- +// Global control of data cache + +// Enable the data cache +#define HAL_DCACHE_ENABLE() + +// Disable the data cache +#define HAL_DCACHE_DISABLE() + +// Invalidate the entire cache +#define HAL_DCACHE_INVALIDATE_ALL() + +// Synchronize the contents of the cache with memory. +#define HAL_DCACHE_SYNC() + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_size_) + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +//#define HAL_DCACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_DCACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_DCACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +//#define HAL_DCACHE_FLUSH( _base_ , _size_ ) + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) + +// Write dirty cache lines to memory for the given address range. +//#define HAL_DCACHE_STORE( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_DCACHE_ZERO( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +// Global control of Instruction cache + +// Enable the instruction cache +#define HAL_ICACHE_ENABLE() + +// Disable the instruction cache +#define HAL_ICACHE_DISABLE() + +// Invalidate the entire cache +#define HAL_ICACHE_INVALIDATE_ALL() + +// Synchronize the contents of the cache with memory. +#define HAL_ICACHE_SYNC() + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_size_) + +// Load the contents of the given address range into the instruction cache +// and then lock the cache so that it stays there. +//#define HAL_ICACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_ICACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_ICACHE_INVALIDATE( _base_ , _size_ ) + +#endif + + +//----------------------------------------------------------------------------- +// Check that a supported configuration has actually defined some macros. + +#ifndef HAL_DCACHE_ENABLE + +#error Unsupported H8300 configuration + +#endif + +//----------------------------------------------------------------------------- +// End of hal_cache.h diff --git a/packages/hal/h8300/arch/current/include/hal_intr.h b/packages/hal/h8300/arch/current/include/hal_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/include/hal_intr.h @@ -0,0 +1,249 @@ +#ifndef CYGONCE_HAL_HAL_INTR_H +#define CYGONCE_HAL_HAL_INTR_H +//========================================================================== +// +// hal_intr.h +// +// HAL Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-13 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include +#include + +#include + +//-------------------------------------------------------------------------- +// Static data used by HAL + +// ISR tables +externC volatile CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT]; +externC volatile CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_ISR_COUNT]; +externC volatile CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT]; + +// VSR table +externC volatile CYG_ADDRESS hal_vsr_table[CYGNUM_HAL_VSR_COUNT]; + +//-------------------------------------------------------------------------- +// Default ISR +// The #define is used to test whether this routine exists, and to allow +// us to call it. + +externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +#define HAL_DEFAULT_ISR hal_default_isr + +//-------------------------------------------------------------------------- +// Interrupt state storage + +typedef cyg_uint32 CYG_INTERRUPT_STATE; + +//-------------------------------------------------------------------------- + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// Routine to execute DSRs using separate interrupt stack +externC void hal_interrupt_stack_call_pending_DSRs(void); +#define HAL_INTERRUPT_STACK_CALL_PENDING_DSRS() \ + hal_interrupt_stack_call_pending_DSRs() + +// these are offered solely for stack usage testing +// if they are not defined, then there is no interrupt stack. +#define HAL_INTERRUPT_STACK_BASE cyg_interrupt_stack_base +#define HAL_INTERRUPT_STACK_TOP cyg_interrupt_stack +// use them to declare these extern however you want: +// extern char HAL_INTERRUPT_STACK_BASE[]; +// extern char HAL_INTERRUPT_STACK_TOP[]; +// is recommended + +#endif + +//-------------------------------------------------------------------------- +// Interrupt control macros + +#define HAL_DISABLE_INTERRUPTS(_old_) \ + asm volatile ( \ + "sub.l er0,er0\n\t" \ + "stc ccr,r0l\n\t" \ + "orc #0x80,ccr\n\t" \ + "and.b #0xc0,r0l\n\t" \ + "mov.l er0,%0" \ + : "=r"(_old_) \ + : \ + : "er0" \ + ); + +#define HAL_ENABLE_INTERRUPTS() \ + asm volatile ( \ + "andc #0x3f,ccr" \ + ); + +#define HAL_RESTORE_INTERRUPTS(_old_) \ + asm volatile ( \ + "mov.l %0,er0\n\t" \ + "and.b #0xc0,r0l\n\t" \ + "stc ccr,r0h\n\t" \ + "and.b #0x3f,r0h\n\t" \ + "or.b r0h,r0l\n\t" \ + "ldc r0l,ccr" \ + : \ + : "r"(_old_) \ + : "er0" \ + ); + +#define HAL_QUERY_INTERRUPTS(_old_) \ + asm volatile ( \ + "sub.l er0,er0\n\t" \ + "stc ccr,r0l\n\t" \ + "and.b #0xc0,r0l\n\t" \ + "mov.l er0,%0" \ + : "=r"(_old_) \ + ); + +#ifndef HAL_TRANSLATE_VECTOR + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) _index_ = (_vector_) + +#endif + +//-------------------------------------------------------------------------- +// Interrupt and VSR attachment macros + +#define HAL_INTERRUPT_IN_USE( _vector_, _state_) \ +CYG_MACRO_START \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR ((_vector_), _index_); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)HAL_DEFAULT_ISR ) \ + (_state_) = 0; \ + else \ + (_state_) = 1; \ +CYG_MACRO_END + +#define HAL_INTERRUPT_ATTACH( _vector_, _isr_, _data_, _object_ ) \ +CYG_MACRO_START \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR(_vector_,_index_); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)HAL_DEFAULT_ISR ) \ + { \ + hal_interrupt_handlers[_index_] = (CYG_ADDRESS)_isr_; \ + hal_interrupt_data[_index_] = (CYG_ADDRWORD)_data_; \ + hal_interrupt_objects[_index_] = (CYG_ADDRESS)_object_; \ + } \ +CYG_MACRO_END + +#define HAL_INTERRUPT_DETACH( _vector_, _isr_ ) \ +CYG_MACRO_START \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR(_vector_,_index_); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)_isr_ ) \ + { \ + hal_interrupt_handlers[_index_] = (CYG_ADDRESS)HAL_DEFAULT_ISR; \ + hal_interrupt_data[_index_] = 0; \ + hal_interrupt_objects[_index_] = 0; \ + } \ +CYG_MACRO_END + +#define HAL_VSR_GET( _vector_, _pvsr_ ) \ + *((CYG_ADDRESS *)_pvsr_) = hal_vsr_table[_vector_]; + + +#define HAL_VSR_SET( _vector_, _vsr_, _poldvsr_ ) \ + if( _poldvsr_ != NULL ) \ + *(CYG_ADDRESS *)_poldvsr_ = hal_vsr_table[_vector_]; \ + hal_vsr_table[_vector_] = (CYG_ADDRESS)_vsr_; + + +//-------------------------------------------------------------------------- +// Interrupt controller access +// Read interrupt control registers back after writing to them. This +// ensures that the written value is not sitting in the store buffers +// when interrupts are re-enabled. + +#define HAL_INTERRUPT_MASK( _vector_ ) \ + hal_interrupt_mask( _vector_ ) + +#define HAL_INTERRUPT_UNMASK( _vector_ ) \ + hal_interrupt_unmask( _vector_ ) + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \ + hal_interrupt_acknowledge( _vector_ ) + +#if !defined(HAL_INTERRUPT_CONFIGURE) + +#error HAL_INTERRUPT_CONFIGURE not defined by variant + +#endif + +#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) \ + hal_interrupt_set_level( _vector_, _level_ ) + + +externC void hal_interrupt_mask(int vector); +externC void hal_interrupt_unmask(int vector); +externC void hal_interrupt_acknowledge(int vector); +externC void hal_interrupt_set_level(int vector,int level); +//-------------------------------------------------------------------------- +// Clock control. +// This is almost all handled in the var_intr.h. + +#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY +#define HAL_CLOCK_LATENCY(_pvalue_) HAL_CLOCK_READ(_pvalue_) +#endif + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_HAL_INTR_H +// EOF hal_intr.h diff --git a/packages/hal/h8300/arch/current/include/hal_io.h b/packages/hal/h8300/arch/current/include/hal_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/include/hal_io.h @@ -0,0 +1,145 @@ +#ifndef CYGONCE_HAL_HAL_IO_H +#define CYGONCE_HAL_HAL_IO_H + +//============================================================================= +// +// hal_io.h +// +// HAL device IO register support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-13 +// Purpose: Define IO register support +// Description: The macros defined here provide the HAL APIs for handling +// device IO control registers. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +//----------------------------------------------------------------------------- +// IO Register address. +// This type is for recording the address of an IO register. + +typedef volatile CYG_ADDRWORD HAL_IO_REGISTER; + +//----------------------------------------------------------------------------- +// BYTE Register access. +// Individual and vectorized access to 8 bit registers. + +#define HAL_READ_UINT8( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_BYTE *)(_register_))) + +#define HAL_WRITE_UINT8( _register_, _value_ ) \ + (*((volatile CYG_BYTE *)(_register_)) = (_value_)) + +#define HAL_READ_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_BYTE *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + + +//----------------------------------------------------------------------------- +// 16 bit access. +// Individual and vectorized access to 16 bit registers. + +#define HAL_READ_UINT16( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_WORD16 *)(_register_))) + +#define HAL_WRITE_UINT16( _register_, _value_ ) \ + (*((volatile CYG_WORD16 *)(_register_)) = (_value_)) + +#define HAL_READ_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_WORD16 *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + +//----------------------------------------------------------------------------- +// 32 bit access. +// Individual and vectorized access to 32 bit registers. + +#define HAL_READ_UINT32( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_WORD32 *)(_register_))) + +#define HAL_WRITE_UINT32( _register_, _value_ ) \ + (*((volatile CYG_WORD32 *)(_register_)) = (_value_)) + +#define HAL_READ_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_WORD32 *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_HAL_IO_H +// End of hal_io.h diff --git a/packages/hal/h8300/arch/current/src/context.S b/packages/hal/h8300/arch/current/src/context.S new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/src/context.S @@ -0,0 +1,142 @@ +##============================================================================= +## +## context.S +## +## H8/300 context switch code +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): yoshinori sato +## Contributors: yoshinori sato +## Date: 2002-02-17 +## Purpose: H8/300 context switch code +## Description: This file contains implementations of the thread context +## switch routines. It also contains the longjmp() and setjmp() +## routines. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include +#include + + .h8300h + +#------------------------------------------------------------------------------ +# hal_thread_switch_context +# Switch thread contexts +# D0 = address of sp of next thread to execute +# D1 = address of sp save location of current thread + + .global CYG_LABEL_DEFN(hal_thread_switch_context) +CYG_LABEL_DEFN(hal_thread_switch_context): + hal_cpu_save_all + mov.l sp,@er1 + + # Now load the destination thread by dropping through + # to hal_thread_load_context + +#------------------------------------------------------------------------------ +# hal_thread_load_context +# Load thread context +# D0 = address of sp of next thread to execute +# Note that this function is also the second half of hal_thread_switch_context +# and is simply dropped into from it. + + .global CYG_LABEL_DEFN(hal_thread_load_context) +CYG_LABEL_DEFN(hal_thread_load_context): + + mov.l @er0,sp + hal_cpu_load_all + rts + +##----------------------------------------------------------------------------- +## HAL longjmp(), setjmp() implementations +## These implementations omit the usual movm [d2,d3,a2,a3],(sp) +## Which is the first instruction of all C compiled functions. +## Note: These definitions are repeated in hal_arch.h. If changes are required +## remember to update both sets. + +#define CYGARC_JMP_BUF_SP 0 +#define CYGARC_JMP_BUF_ER3 1 +#define CYGARC_JMP_BUF_ER4 2 +#define CYGARC_JMP_BUF_ER5 3 +#define CYGARC_JMP_BUF_ER6 4 +#define CYGARC_JMP_BUF_PC 5 + +#define CYGARC_JMP_BUF_SIZE 6 + + + # This just preserves the callee save registers + # namely a2,a3,d2,d3 + # setjmp cannot use movm to do this as we need to keep + # the sp underneath all live data at all times. + .globl CYG_LABEL_DEFN(hal_setjmp) +CYG_LABEL_DEFN(hal_setjmp): ; er0=env + mov.l er3,@(CYGARC_JMP_BUF_ER3*4,er0) + mov.l er4,@(CYGARC_JMP_BUF_ER4*4,er0) + mov.l er5,@(CYGARC_JMP_BUF_ER5*4,er0) + mov.l er6,@(CYGARC_JMP_BUF_ER6*4,er0) + mov.l @sp,er1 + mov.l er1,@(CYGARC_JMP_BUF_PC*4,er0) + mov sp,er1 + mov er1,@(CYGARC_JMP_BUF_SP*4,er0) + sub.l er0,er0 + rts + + # longjmp returns to caller of setjmp + # after restoring callee save registers + .globl CYG_LABEL_DEFN(hal_longjmp) +CYG_LABEL_DEFN(hal_longjmp): + mov.l @(CYGARC_JMP_BUF_ER3*4,er0),er3 + mov.l @(CYGARC_JMP_BUF_ER4*4,er0),er4 + mov.l @(CYGARC_JMP_BUF_ER5*4,er0),er5 + mov.l @(CYGARC_JMP_BUF_ER6*4,er0),er6 + mov.l @(CYGARC_JMP_BUF_PC*4,er0),er2 + mov.l @(CYGARC_JMP_BUF_SP*4,er0),sp + mov.l er2,@sp + mov.l er1,er0 + rts + + +#------------------------------------------------------------------------------ +# end of context.S + + diff --git a/packages/hal/h8300/arch/current/src/h8300_stub.c b/packages/hal/h8300/arch/current/src/h8300_stub.c new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/src/h8300_stub.c @@ -0,0 +1,286 @@ +//======================================================================== +// +// h8300_stub.c +// +// Helper functions for H8/300H stub +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Red Hat, jskov +// Contributors: Red Hat, jskov +// Date: 1998-11-06 +// Purpose: +// Description: Helper functions for H8/300H stub +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#include + +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include +#include +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT +#include // dbg_currthread_id +#endif + +/*---------------------------------------------------------------------- + * Asynchronous interrupt support + */ + +typedef unsigned short t_inst; + +static struct +{ + t_inst *targetAddr; + t_inst savedInstr; +} asyncBuffer; + +/* Called to asynchronously interrupt a running program. + Must be passed address of instruction interrupted. + This is typically called in response to a debug port + receive interrupt. +*/ + +void +install_async_breakpoint(void *pc) +{ + asyncBuffer.targetAddr = pc; + asyncBuffer.savedInstr = *(t_inst *)pc; + *(t_inst *)pc = (t_inst)HAL_BREAKINST; + __instruction_cache(CACHE_FLUSH); + __data_cache(CACHE_FLUSH); +} + +/*--------------------------------------------------------------------*/ +/* Given a trap value TRAP, return the corresponding signal. */ + +int __computeSignal (unsigned int trap_number) +{ + switch (trap_number) { + case 11: + return SIGTRAP; + default: + return SIGINT; + } +} + +/*--------------------------------------------------------------------*/ +/* Return the trap number corresponding to the last-taken trap. */ + +int __get_trap_number (void) +{ + extern int CYG_LABEL_NAME(_intvector); + // The vector is not not part of the GDB register set so get it + // directly from the save context. + return CYG_LABEL_NAME(_intvector); +} + +/*--------------------------------------------------------------------*/ +/* Set the currently-saved pc register value to PC. This also updates NPC + as needed. */ + +void set_pc (target_register_t pc) +{ + put_register (PC, pc); +} + + +/*---------------------------------------------------------------------- + * Single-step support. Lifted from CygMon. + */ + +#define NUM_SS_BPTS 2 +static target_register_t break_mem [NUM_SS_BPTS] = {0, 0}; +static unsigned char break_mem_data [NUM_SS_BPTS]; + +/* Set a single-step breakpoint at ADDR. Up to two such breakpoints + can be set; WHICH specifies which one to set (0 or 1). */ + +static void +set_single_bp (int which, unsigned char *addr) +{ + if (break_mem[which] == 0) { + break_mem[which] = (target_register_t) addr; + break_mem_data[which] = *(unsigned short *)addr; + *(unsigned short *)addr = HAL_BREAKINST; + } +} + +/* Clear any single-step breakpoint(s) that may have been set. */ + +void __clear_single_step (void) +{ + int x; + for (x = 0; x < NUM_SS_BPTS; x++) + { + unsigned char* addr = (unsigned char*) break_mem[x]; + if (addr) { + *addr = break_mem_data[x]; + break_mem[x] = 0; + } + } +} + +/* Set breakpoint(s) to simulate a single step from the current PC. */ + +const static unsigned char opcode_length0[]={ + 0x04,0x02,0x04,0x02,0x04,0x02,0x04,0x02, /* 0x58 */ + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, /* 0x60 */ + 0x02,0x02,0x11,0x11,0x02,0x02,0x04,0x04, /* 0x68 */ + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, /* 0x70 */ + 0x08,0x04,0x06,0x04,0x04,0x04,0x04,0x04 /* 0x78 */ +}; + +const static unsigned char opcode_length1[]={ + 0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00, + 0x02,0x00,0x00,0x00,0x04,0x04,0x00,0x04 +}; + +static int insn_length(unsigned char *pc) +{ + if (*pc != 0x01 && (*pc < 0x58 || *pc>=0x80)) + return 2; + else + switch (*pc) { + case 0x01: + switch (*(pc+1) & 0xf0) { + case 0x00: + if (*(pc+2)== 0x78) { + return 10; + } else if (*(pc+2)== 0x6b) { + return (*(pc+3) & 0x20)?8:6; + } else { + return (*(pc+2) & 0x02)?6:4; + } + case 0x40: + return (*(pc+2) & 0x02)?8:6; + default: + return opcode_length1[*(pc+1)>>4]; + } + case 0x6a: + case 0x6b: + return (*(pc+1) & 0x20)?6:4; + default: + return opcode_length0[*pc-0x58]; + } +} + +void __single_step (void) +{ + unsigned int pc = get_register (PC); + unsigned int next; + unsigned int opcode; + + opcode = *(unsigned short *)pc; + next = pc + insn_length((unsigned char *)pc); + if (opcode == 0x5470) { + /* rts */ + unsigned long *sp; + sp = (unsigned long *)get_register(SP); + next = *sp & 0x00ffffff; + } else if ((opcode & 0xfb00) != 0x5800) { + /* jmp / jsr */ + int regs; + const short reg_tbl[]={ER0,ER1,ER2,ER3,ER4,ER5,ER6,SP}; + switch(opcode & 0xfb00) { + case 0x5900: + regs = (opcode & 0x0070) >> 8; + next = get_register(reg_tbl[regs]); + break; + case 0x5a00: + next = *(unsigned long *)(pc+2) & 0x00ffffff; + break; + case 0x5b00: + next = *(unsigned long *)(opcode & 0xff); + break; + } + } else if (((opcode & 0xf000) == 0x4000) || ((opcode & 0xff00) == 0x5500)) { + /* b**:8 */ + unsigned long dsp; + dsp = (long)(opcode && 0xff)+pc+2; + set_single_bp(1,(unsigned char *)dsp); + } else if (((opcode & 0xff00) == 0x5800) || ((opcode & 0xff00) == 0x5c00)) { + /* b**:16 */ + unsigned long dsp; + dsp = *(unsigned short *)(pc+2)+pc+4; + set_single_bp(1,(unsigned char *)dsp); + } + set_single_bp(0,(unsigned char *)next); +} + +void __install_breakpoints (void) +{ + /* NOP since single-step HW exceptions are used instead of + breakpoints. */ +} + +void __clear_breakpoints (void) +{ + +} + + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ + +externC void CYG_LABEL_NAME(breakinst)(void); +int +__is_breakpoint_function () +{ + return get_register (PC) == (target_register_t)&CYG_LABEL_NAME(breakinst); +} + + +/* Skip the current instruction. */ + +void __skipinst (void) +{ + unsigned long pc = get_register (PC); + + pc+=insn_length((unsigned char *)pc); + put_register (PC, (target_register_t) pc); +} + +#endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS diff --git a/packages/hal/h8300/arch/current/src/hal_misc.c b/packages/hal/h8300/arch/current/src/hal_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/src/hal_misc.c @@ -0,0 +1,236 @@ +/*========================================================================== +// +// hal_misc.c +// +// HAL miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour +// Date: 1999-02-18 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include +#include + +#include + +#include + +#if 0 +void trace( CYG_ADDRWORD tag, CYG_ADDRWORD a1, CYG_ADDRWORD a2) +{ + CYG_ADDRWORD **pp = (CYG_ADDRWORD **)0x48100000; + CYG_ADDRWORD *ix = (CYG_ADDRWORD *)0x4810000C; + CYG_ADDRWORD *p = *pp; + *p++ = tag; + *ix = *ix + 1; + *p++ = *ix; + *p++ = a1; + *p++ = a2; + *pp = p; +} +#endif + +/*------------------------------------------------------------------------*/ + +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG +cyg_bool cyg_hal_stop_constructors; +#endif + +void +cyg_hal_invoke_constructors(void) +{ + typedef void (*pfunc) (void); + extern pfunc __CTOR_LIST__[]; + extern pfunc __CTOR_END__[]; + +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG + static pfunc *p = &__CTOR_END__[-1]; + + cyg_hal_stop_constructors = 0; + for (; p >= __CTOR_LIST__; p--) { + (*p) (); + if (cyg_hal_stop_constructors) { + p--; + break; + } + } +#else + pfunc *p; + + for (p = &__CTOR_END__[-1]; p >= __CTOR_LIST__; p--) + (*p) (); +#endif + +} // cyg_hal_invoke_constructors() + +/*------------------------------------------------------------------------*/ +// Default ISR +externC cyg_uint32 +hal_arch_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + return 0; +} + +//-------------------------------------------------------------------------- +/* Determine the index of the ls bit of the supplied mask. */ + +cyg_uint32 +hal_lsbit_index(cyg_uint32 mask) +{ + cyg_uint32 n = mask; + + static const signed char tab[64] = + { -1, 0, 1, 12, 2, 6, 0, 13, 3, 0, 7, 0, 0, 0, 0, 14, 10, + 4, 0, 0, 8, 0, 0, 25, 0, 0, 0, 0, 0, 21, 27 , 15, 31, 11, + 5, 0, 0, 0, 0, 0, 9, 0, 0, 24, 0, 0 , 20, 26, 30, 0, 0, 0, + 0, 23, 0, 19, 29, 0, 22, 18, 28, 17, 16, 0 + }; + + n &= ~(n-1UL); + n = (n<<16)-n; + n = (n<<6)+n; + n = (n<<4)+n; + + return tab[n>>26]; +} + +/*------------------------------------------------------------------------*/ +/* Determine the index of the ms bit of the supplied mask. */ + +cyg_uint32 +hal_msbit_index(cyg_uint32 mask) +{ + cyg_uint32 x = mask; + cyg_uint32 w; + + /* Phase 1: make word with all ones from that one to the right */ + x |= x >> 16; + x |= x >> 8; + x |= x >> 4; + x |= x >> 2; + x |= x >> 1; + + /* Phase 2: calculate number of "1" bits in the word */ + w = (x & 0x55555555) + ((x >> 1) & 0x55555555); + w = (w & 0x33333333) + ((w >> 2) & 0x33333333); + w = w + (w >> 4); + w = (w & 0x000F000F) + ((w >> 8) & 0x000F000F); + return (cyg_uint32)((w + (w >> 16)) & 0xFF); + +} + +/*------------------------------------------------------------------------*/ +/* First level C exception handler. */ + +externC void __handle_exception (void); + +externC HAL_SavedRegisters *_hal_registers; + +void +cyg_hal_exception_handler(HAL_SavedRegisters *regs,CYG_WORD vector) +{ + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + + // Set the pointer to the registers of the current exception + // context. At entry the GDB stub will expand the + // HAL_SavedRegisters structure into a (bigger) register array. + _hal_registers = regs; + + __handle_exception(); + +#endif +#if defined(CYGPKG_HAL_EXCEPTIONS) + + // We should decode the vector and pass a more appropriate + // value as the second argument. For now we simply pass a + // pointer to the saved registers. We should also divert + // breakpoint and other debug vectors into the debug stubs. + + cyg_hal_deliver_exception( vector, (CYG_ADDRWORD)regs ); + +#endif + + return; +} + +/*------------------------------------------------------------------------*/ +/* default ISR */ + +#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) && \ + defined(CYGHWR_HAL_GDB_PORT_VECTOR) && \ + defined(HAL_CTRLC_ISR) + +#ifndef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if( vector == CYGHWR_HAL_GDB_PORT_VECTOR ) +#endif + { + cyg_uint32 result = HAL_CTRLC_ISR( vector, data ); + if( result != 0 ) return result; + } + +#endif + + CYG_TRACE1(true, "Interrupt: %d", vector); + CYG_FAIL("Spurious Interrupt!!!"); + return 0; +} +#endif + +/*------------------------------------------------------------------------*/ +/* Idle thread activity. */ + +externC void hal_idle_thread_action(cyg_uint32 loop_count) +{ +} + +/*------------------------------------------------------------------------*/ +/* End of hal_misc.c */ diff --git a/packages/hal/h8300/arch/current/src/hal_syscall.c b/packages/hal/h8300/arch/current/src/hal_syscall.c new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/src/hal_syscall.c @@ -0,0 +1,111 @@ +//============================================================================= +// +// hal_syscall.c +// +// +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter +// Date: 2000-11-5 +// Purpose: +// Description: +// +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGPKG_REDBOOT +#include +#endif + +#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) + +#include // Our header +#include // HAL_BREAKINST +#include // HAL_xCACHE_x +#include // interrupt disable/restore + +#include // ROM calling interface +#include // Helper functions + +extern CYG_ADDRWORD __do_syscall(CYG_ADDRWORD func, // syscall function number + CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, // up to four args. + CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, + CYG_ADDRWORD *retval); // syscall return value + +#define SYS_exit 1 +#define SYS_interrupt 1000 + +int +hal_syscall_handler(void) +{ + CYG_ADDRWORD func, arg1, arg2, arg3, arg4; + CYG_ADDRWORD err; + + func = get_register(ER0); + arg1 = get_register(ER1); + arg2 = get_register(ER2); + arg3 = get_register(ER3); + arg4 = 0; + + if (func == SYS_exit) { + // We want to stop in exit so that the user may poke around + // to see why his app exited. + return SIGTRAP; + } + + if (func == SYS_interrupt) { + // A console interrupt landed us here. + // Invoke the debug agent so as to cause a SIGINT. + return SIGINT; + } + + if (__do_syscall(func, arg1, arg2, arg3, arg4, &err)) { + put_register(D0, err); + return 0; + } + + return SIGTRAP; +} + +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS diff --git a/packages/hal/h8300/arch/current/src/vectors.S b/packages/hal/h8300/arch/current/src/vectors.S new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/arch/current/src/vectors.S @@ -0,0 +1,724 @@ +##============================================================================= +## +## vectors.S +## +## H8/300 exception vectors +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): nickg +## Contributors: nickg, dmoseley, dhowells +## Date: 2002-02-14 +## Purpose: H8/300 exception vectors +## Description: This file defines the code placed into the exception +## vectors. It also contains the first level default VSRs +## that save and restore state for both exceptions and +## interrupts. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#ifdef CYGPKG_REDBOOT +#include +#endif + +#ifdef CYGPKG_KERNEL + +#include + +#endif + +#include +#include + + +##----------------------------------------------------------------------------- + +// .file "vectors.S" + .h8300h + +#ifdef CYGPKG_CYGMON +##----------------------------------------------------------------------------- +## Macros for Stack handling when running Cygmon + +.macro hal_cygmon_switch_app_stack + # + ; Switch to interrupt stack to handle exception + # + + ; First, save some scratch registers + mov.l er0,@er0_save + mov.l er1,@er1_save + + ; Copy the exception frame + mov.l #__cygmon_interrupt_stack,er0 + mov.l @sp,er1 + mov.l er1,@-er0 + + ; Save the pre-exception sp in the register image + mov.l sp,@-er0 + + ; Actually switch the stack + mov.l er0,sp + + ; Now, restore the scratch registers + mov.l @er0_save,er0 + mov.l @er1_save,er1 +.endm + +.macro hal_cygmon_restore_app_stack + // For cygmon we are switching stacks immediately on exception. + // We must wait until the very end before restoring the original stack. + + ; Save some scratch registers + mov.l er0,@er0_save + mov.l er1,@er1_save + + ; We need to restore the application stack pointer, but we also + ; need to restore the exception frame. + mov.l @sp+,er0 + mov.l @sp+,er1 + mov.l er1,@er0 + mov.l er0,sp // Restore the frame-adjusted SP + + ; Restore the scratch registers + mov.l @er0_save,er0 + mov.l @er1_save,er1 +.endm + +#endif // CYGPKG_CYGMON + +##----------------------------------------------------------------------------- + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYGPKG_HAL_H8300_H8300H_SIM) + .section .vectors,"a" + + .globl reset_vector + +reset_vector: + ; Reset vector + .long CYG_LABEL_DEFN(_start) + .space 6*4 + .long __interrupt7 + .long __interrupt8 + .long __interrupt9 + .long __interrupt10 + .long __interrupt11 + .long __interrupt12 + .long __interrupt13 + .long __interrupt14 + .long __interrupt15 + .long __interrupt16 + .long __interrupt17 + .long __interrupt18 + .long __interrupt19 + .long __interrupt20 + .long __interrupt21 + .long __interrupt22 + .long __interrupt23 + .long __interrupt24 + .long __interrupt25 + .long __interrupt26 + .long __interrupt27 + .long __interrupt28 + .long __interrupt29 + .long __interrupt30 + .long __interrupt31 + .long __interrupt32 + .long __interrupt33 + .long __interrupt34 + .long __interrupt35 + .long __interrupt36 + .long __interrupt37 + .long __interrupt38 + .long __interrupt39 + .long __interrupt40 + .long __interrupt41 + .long __interrupt42 + .long __interrupt43 + .long __interrupt44 + .long __interrupt45 + .long __interrupt46 + .long __interrupt47 + .long __interrupt48 + .long __interrupt49 + .long __interrupt50 + .long __interrupt51 + .long __interrupt52 + .long __interrupt53 + .long __interrupt54 + .long __interrupt55 + .long __interrupt56 + .long __interrupt57 + .long __interrupt58 + .long __interrupt59 + .long __interrupt60 + .long __interrupt61 + .long __interrupt62 + .long __interrupt63 + +#endif + +#define INTERRUPT_ENTRY(no) \ +__interrupt##no: \ + jsr @interrupt_entry + + .section .int_fook_table,"a" + .space 7*4 +__interrupt_table: +INTERRUPT_ENTRY(7) +INTERRUPT_ENTRY(8) +INTERRUPT_ENTRY(9) +INTERRUPT_ENTRY(10) +INTERRUPT_ENTRY(11) +INTERRUPT_ENTRY(12) +INTERRUPT_ENTRY(13) +INTERRUPT_ENTRY(14) +INTERRUPT_ENTRY(15) +INTERRUPT_ENTRY(16) +INTERRUPT_ENTRY(17) +INTERRUPT_ENTRY(18) +INTERRUPT_ENTRY(19) +INTERRUPT_ENTRY(20) +INTERRUPT_ENTRY(21) +INTERRUPT_ENTRY(22) +INTERRUPT_ENTRY(23) +INTERRUPT_ENTRY(24) +INTERRUPT_ENTRY(25) +INTERRUPT_ENTRY(26) +INTERRUPT_ENTRY(27) +INTERRUPT_ENTRY(28) +INTERRUPT_ENTRY(29) +INTERRUPT_ENTRY(30) +INTERRUPT_ENTRY(31) +INTERRUPT_ENTRY(32) +INTERRUPT_ENTRY(33) +INTERRUPT_ENTRY(34) +INTERRUPT_ENTRY(35) +INTERRUPT_ENTRY(36) +INTERRUPT_ENTRY(37) +INTERRUPT_ENTRY(38) +INTERRUPT_ENTRY(39) +INTERRUPT_ENTRY(40) +INTERRUPT_ENTRY(41) +INTERRUPT_ENTRY(42) +INTERRUPT_ENTRY(43) +INTERRUPT_ENTRY(44) +INTERRUPT_ENTRY(45) +INTERRUPT_ENTRY(46) +INTERRUPT_ENTRY(47) +INTERRUPT_ENTRY(48) +INTERRUPT_ENTRY(49) +INTERRUPT_ENTRY(50) +INTERRUPT_ENTRY(51) +INTERRUPT_ENTRY(52) +INTERRUPT_ENTRY(53) +INTERRUPT_ENTRY(54) +INTERRUPT_ENTRY(55) +INTERRUPT_ENTRY(56) +INTERRUPT_ENTRY(57) +INTERRUPT_ENTRY(58) +INTERRUPT_ENTRY(59) +INTERRUPT_ENTRY(60) +INTERRUPT_ENTRY(61) +INTERRUPT_ENTRY(62) +INTERRUPT_ENTRY(63) + +##----------------------------------------------------------------------------- +## Startup code + + .text + + .globl CYG_LABEL_DEFN(_start) +CYG_LABEL_DEFN(_start): + ; set up stack + + mov.l #__interrupt_stack,sp + ldc #0x80,ccr + + ; Initialize hardware + hal_cpu_init + hal_mmu_init + hal_memc_init + hal_diag_init + hal_intc_init + hal_cache_init + hal_timer_init + hal_mon_init + +#ifdef CYG_HAL_STARTUP_ROM + + ; Copy data from ROM to RAM + + mov.l #CYG_LABEL_DEFN(__rom_data_start),er5 + mov.l #CYG_LABEL_DEFN(__ram_data_start),er6 + mov.l #CYG_LABEL_DEFN(__ram_data_end),er4 + sub.l er6,er4 +1: + eepmov.w + dec.w #1,e4 + cmp.w #-1,e4 + bhi 1b + +#endif + + ; Setup Interrupt Vector (virtual) + mov.l #CYG_LABEL_DEFN(__rom_int_fook_start),er5 + mov.l #CYG_LABEL_DEFN(__int_fook_start),er6 + mov.l #CYG_LABEL_DEFN(__int_fook_end),er4 + sub.l er6,er4 +1: + eepmov.w + dec.w #1,e4 + cmp.w #-1,e4 + bhi 1b + + ; Clear BSS + mov.l #CYG_LABEL_DEFN(__bss_start),er5 + mov.l er5,er6 + adds #1,er6 + mov.l #CYG_LABEL_DEFN(__bss_end),er4 + sub.l #CYG_LABEL_DEFN(__bss_start),er4 + + mov.b #0,r0l + mov.b r0l,@er5 +1: + eepmov.w + dec.w #1,e4 + cmp.w #-1,e4 + bhi 1b + + ; Call variant and platform HAL + ; initialization routines. + + .extern CYG_LABEL_DEFN(hal_variant_init) + jsr @CYG_LABEL_DEFN(hal_variant_init) + + .extern CYG_LABEL_DEFN(hal_platform_init) + jsr @CYG_LABEL_DEFN(hal_platform_init) + + ; Call constructors + + .extern CYG_LABEL_DEFN(cyg_hal_invoke_constructors) + jsr @CYG_LABEL_DEFN(cyg_hal_invoke_constructors) + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + .extern CYG_LABEL_DEFN(initialize_stub) + jsr @CYG_LABEL_DEFN(initialize_stub) +#endif + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) \ + || defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) + .extern CYG_LABEL_DEFN(hal_ctrlc_isr_init) + jsr @CYG_LABEL_DEFN(hal_ctrlc_isr_init) +#endif + + + mov.b #0x9a,r0l + mov.b r0l,@0xfee027 + ; Call cyg_start + sub.l er0,er0 + + .extern CYG_LABEL_DEFN(cyg_start) + jsr @CYG_LABEL_DEFN(cyg_start) + +9: + bra 9b ; Loop if we return + +interrupt_entry: + mov.l er0,@-sp + mov.l @(4,sp),er0 + sub.l #__interrupt_table,er0 + shlr.l er0 + shlr.l er0 + add.w #7,r0 + mov.l er0,@CYG_LABEL_DEFN(_intvector) + mov.l @sp+,er0 + adds #4,sp +#ifdef CYGPKG_CYGMON + hal_cygmon_switch_app_stack +#endif + hal_cpu_save_all ; push all registers + mov.l @CYG_LABEL_DEFN(_intvector),er0 + shll.l er0 + shll.l er0 + mov.l @(CYG_LABEL_DEFN(hal_vsr_table),er0),er0 + jmp @er0 + +##----------------------------------------------------------------------------- +## The following macros are defined depending on whether the HAL is configured +## to support the kernel or not. + +#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT + + .extern CYG_LABEL_DEFN(cyg_scheduler_sched_lock) + + ; Increment the scheduler lock + + .macro increment_sched_lock reg=er0 + mov.l @CYG_LABEL_DEFN(cyg_scheduler_sched_lock),\reg + inc.l #1,\reg + mov.l \reg,@CYG_LABEL_DEFN(cyg_scheduler_sched_lock) + .endm + +#else + + .macro increment_sched_lock reg=er0 + .endm + +#endif + +##----------------------------------------------------------------------------- +## Default interrupt VSR + + .text + .globl CYG_LABEL_DEFN(__default_interrupt_vsr) +CYG_LABEL_DEFN(__default_interrupt_vsr): + + ; We come here with all the registers pushed + ; onto the stack. + + hal_diag_intr_start + + increment_sched_lock + +#if defined(CYGPKG_CYGMON) + // For Cygmon, we saved this back when we originally switched stacks. + mov.l @sp,er1 ; A2 = saved thread state +#elif defined(CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK) + ; Increment interrupt nesting counter + mov.l sp,er1 + mov.l #__interrupt_stack,er0 ; A0 = interrupt stack top + cmp.l #__interrupt_stack_base,sp ; compare with base of stack + blt 1f ; if lt switch to int stack + cmp.l er0,sp ; compare sp with stack top + ble 8f ; if le already on istack +1: + mov.l er0,sp ; switch to new SP +8: + mov.l er1,@-sp ; save old SP + mov.l @er1,er1 + +#else + mov @sp,er1 ; A2 = saved thread state +#endif + + ; Here D3 contains the table byte offset of the vector to + ; call. + +#if defined(CYGPKG_KERNEL_INSTRUMENT) && defined(CYGDBG_KERNEL_INSTRUMENT_INTR) + + ; Call cyg_instrument to record that this interrupt is being raised. + + .extern CYG_LABEL_DEFN(cyg_instrument) + mov.l er1,er3 + mov.l #0x0301,er0 ; type = INTR,RAISE + mov.l @CYG_LABEL_DEFN(_intvector),er2 ; arg2 = table offset + jsr CYG_LABEL_DEFN(cyg_instrument) ; call instrumentation + +#endif + +#ifdef CYGSEM_HAL_COMMON_INTERRUPTS_ALLOW_NESTING + + ; To allow nested interrupts, we set the IE bit. We do + ; not touch the IPL bits, so only higher priority interrupts + ; will be nested on top of us. Also, new interrupts will not + ; be delivered until the ISR calls + ; Cyg_Interrupt::acknowledge_interrupt(). At some future point + ; we may want to do the ack stuff here to allow immediate nesting. + + andc #0x7f,ccr + +#endif +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) || \ + defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) + + ; If we have Ctrl-C support enabled, save a pointer to the + ; saved CPU state here so we can plant a breakpoint there if + ; this is a ^C. + + .extern CYG_LABEL_DEFN(hal_saved_interrupt_state) + mov.l er3,@CYG_LABEL_DEFN(hal_saved_interrupt_state) + +#endif + mov.l @CYG_LABEL_DEFN(_intvector),er0 + shll.l er0 + shll.l er0 + mov.l @(CYG_LABEL_DEFN(hal_interrupt_handlers),er0),er2 + + mov.l @(CYG_LABEL_DEFN(hal_interrupt_data),er0),er1 + + shlr.l er0 + shlr.l er0 + + jsr @er2 + + ; on return d0 bit 1 will indicate whether a DSR is + ; to be posted. Pass this together with a pointer to + ; the interrupt object we have just used to the + ; interrupt tidy up routine. + + ; D3 is defined to be saved across procedure calls, and + ; should still contain the vector byte index. Similarly, + ; A2 should still point to the saved machine state. + +#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + ; If interrupt was caused by GDB, the ISR call above + ; is skipped by jumping here. +2: +#endif + +#if defined(CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK) && !defined(CYGPKG_CYGMON) + + ; If we are returning from the last nested interrupt, move back + ; to the thread stack. interrupt_end() must be called on the + ; thread stack since it potentially causes a context switch. + + mov.l @sp+,sp ; pop old sp + +#endif + +#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT + + ; We only need to call _interrupt_end() when there is a kernel + ; present to do any tidying up. + + ; Using the vector offset in D3, get the interrupt object pointer + ; into D1. + mov.l @CYG_LABEL_DEFN(_intvector),er1 + shll.l er1 + shll.l er1 + mov.l @(CYG_LABEL_DEFN(hal_interrupt_objects),er1),er1 + + ; Even when this is not the last nested interrupt, we must call + ; _interrupt_end() to post the DSR and decrement the scheduler + ; lock. + + mov.l er3,er2 ; arg3 = saved state. + + jsr @CYG_LABEL_DEFN(interrupt_end) ; call interrupt end fn +#endif + + +# show_interrupts + + hal_diag_restore + + hal_cpu_load_all +#ifdef CYGPKG_CYGMON + hal_cygmon_restore_app_stack +#endif + rte ; and return + + .section .bss + .global CYG_LABEL_DEFN(_intvector) +CYG_LABEL_DEFN(_intvector): + .long 0 + + .text +##----------------------------------------------------------------------------- +## Execute pending DSRs on the interrupt stack with interrupts enabled. +## Note: this can only be called from code running on a thread stack + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + .extern CYG_LABEL_DEFN(cyg_interrupt_call_pending_DSRs) + .global CYG_LABEL_DEFN(hal_interrupt_stack_call_pending_DSRs) + +CYG_LABEL_DEFN(hal_interrupt_stack_call_pending_DSRs): + mov.l er5,@-sp ; save some work regs + mov.l er6,@-sp + mov.l sp,er6 ; save current SP + mov.l #__interrupt_stack,sp ; interrupt stack pointer + stc ccr,r5l ; save PSW + hal_cpu_int_enable ; enable interrupts + + ; Call kernel code to invoke DSRs. + jsr @CYG_LABEL_DEFN(cyg_interrupt_call_pending_DSRs) + + ; On return the old SP in a2 and the old PSW in d2 will + ; have been preserved by the calling conventions. + + hal_cpu_int_merge r5l ; Restore previous PSW + mov.l er6,sp ; restore old SP + mov.l @sp+,er6 ; Retrieve old work regs + mov.l @sp+,er5 + rts ; and return + +#endif + +#ifdef CYGPKG_CYGMON + .section .bss +er0_save: + .long 0 +er1_save: + .long 0 +er2_save: + .long 0 +er3_save: + .long 0 +er4_save: + .long 0 +er5_save: + .long 0 +er6_save: + .long 0 +sp_save: + .long 0 +#endif + +##----------------------------------------------------------------------------- +## Default TRAP VSR + + .text + .globl CYG_LABEL_DEFN(__default_trap_vsr) +CYG_LABEL_DEFN(__default_trap_vsr): + +#ifdef CYG_HAL_DIAG_EXCPT_END + hal_diag_excpt_start +#endif + + mov.l sp,er0 + mov.l @CYG_LABEL_DEFN(_intvector),er1 + + jsr @CYG_LABEL_DEFN(cyg_hal_exception_handler) + +#ifdef CYG_HAL_DIAG_EXCPT_END + hal_diag_excpt_end +#endif + hal_cpu_load_all +#ifdef CYGPKG_CYGMON + hal_cygmon_restore_app_stack +#endif + rte + +##----------------------------------------------------------------------------- +## VSR table. The VSRs pointed to by this table are called from the stubs +## connected to the hardware. + +#ifndef CYG_HAL_H8300_VSR_TABLE_DEFINED + + .data + + .globl CYG_LABEL_DEFN(hal_vsr_table) +CYG_LABEL_DEFN(hal_vsr_table): + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + + .rept 64-12 + .long CYG_LABEL_DEFN(__default_interrupt_vsr) + .endr +#endif + +##----------------------------------------------------------------------------- +## Interrupt tables + + .data + + .extern CYG_LABEL_DEFN(hal_default_isr) + + .globl CYG_LABEL_DEFN(hal_interrupt_handlers) +CYG_LABEL_DEFN(hal_interrupt_handlers): + .rept CYG_ISR_TABLE_SIZE + .long CYG_LABEL_DEFN(hal_default_isr) + .endr + + .globl CYG_LABEL_DEFN(hal_interrupt_data) +CYG_LABEL_DEFN(hal_interrupt_data): + .rept CYG_ISR_TABLE_SIZE + .long 0 + .endr + + .globl CYG_LABEL_DEFN(hal_interrupt_objects) +CYG_LABEL_DEFN(hal_interrupt_objects): + .rept CYG_ISR_TABLE_SIZE + .long 0 + .endr + + +##----------------------------------------------------------------------------- +## Temporary interrupt stack + + .section .bss + + .balign 16 + .global _cyg_interrupt_stack_base +_cyg_interrupt_stack_base: +__interrupt_stack_base: + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE + .byte 0 + .endr + .balign 16 + .global _cyg_interrupt_stack +_cyg_interrupt_stack: +__interrupt_stack: + +#ifdef CYGPKG_CYGMON + .balign 16 + .global __cygmon_interrupt_stack_base +__cygmon_interrupt_stack_base: + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE + .byte 0 + .endr + .balign 16 + .global __cygmon_interrupt_stack +__cygmon_interrupt_stack: +#endif + + .long 0,0,0,0,0,0,0,0 + +##----------------------------------------------------------------------------- + + .data + hal_diag_data + + +##----------------------------------------------------------------------------- +## end of vectors.S + diff --git a/packages/hal/h8300/h8300h/current/ChangeLog b/packages/hal/h8300/h8300h/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/ChangeLog @@ -0,0 +1,38 @@ +2002-04-24 Yoshinori Sato + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/h8300/h8300h/current/cdl/hal_h8300_h8300h.cdl b/packages/hal/h8300/h8300h/current/cdl/hal_h8300_h8300h.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/cdl/hal_h8300_h8300h.cdl @@ -0,0 +1,119 @@ +# ==================================================================== +# +# hal_h8300_h8300h.cdl +# +# H8/300H variant architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: nickg +# Contributors: dmoseley +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300_H8300H { + display "H8/300H variant" + parent CYGPKG_HAL_H8300 + implements CYGINT_HAL_H8300_VARIANT + hardware + include_dir cyg/hal + define_header hal_h8300_h8300h.h + description " + The H8/300H variant HAL package provides generic + support for this processor architecture. It is also + necessary to select a specific target platform HAL + package." + + define_proc { + puts $::cdl_header "#include " + } + + compile var_misc.c h8_sci.c + + make { + /lib/target.ld: /src/h8300_h8300h.ld + $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 target.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm target.tmp + } + + cdl_option CYGBLD_LINKER_SCRIPT { + display "Linker script" + flavor data + no_define + calculated { "src/h8300_h8300h.ld" } + } + + cdl_component CYGHWR_HAL_H8300H_CLOCK_SETTINGS { + display "H8/300H on-chip generic clock controls" + description " + The various clocks used by the system are controlled by + these options, some of which are derived from platform + settings." + flavor none + no_define + + cdl_option CYGHWR_HAL_H8300_DIVIDER_RATE { + display "Divider Rate (1/n)" + flavor data + legal_values { 1 2 4 8 } + default_value 1 + description " + The system clock divide rate setting" + } + cdl_option CYGHWR_HAL_H8300_PROCESSOR_SPEED { + display "Processor clock speed (MHz)" + flavor data + calculated { CYGHWR_HAL_H8300_CPG_INPUT / CYGHWR_HAL_H8300_DIVIDER_RATE } + description " + The core (CPU) speed is computed from + the input clock speed and the divider setting." + } + } + cdl_option CYGNUM_HAL_H8300_H8300H_SCI_BAUD_RATE { + display "SCI serial port default baud rate" + flavor data + legal_values { 4800 9600 14400 19200 38400 57600 115200 } + default_value { 38400 } + } +} diff --git a/packages/hal/h8300/h8300h/current/doc/README b/packages/hal/h8300/h8300h/current/doc/README new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/doc/README @@ -0,0 +1,2 @@ +Please visit http://homepage2.nifty.com/ysato/eCos/index.en.html for up to date +information, particularly on which GNU tools to use and patches. diff --git a/packages/hal/h8300/h8300h/current/include/h8_sci.h b/packages/hal/h8300/h8300h/current/include/h8_sci.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/h8_sci.h @@ -0,0 +1,80 @@ +//============================================================================= +// +// h8_sci.h +// +// Simple driver for the H8/300H Serial Communication Interface (SCI) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-05-17 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +//-------------------------------------------------------------------------- +// Exported functions + +externC void cyg_hal_plf_sci_init_channel(void* __ch_data); +externC cyg_uint8 cyg_hal_plf_sci_getc(void* __ch_data); +externC void cyg_hal_plf_sci_putc(void* __ch_data, cyg_uint8 c); +externC void cyg_hal_plf_sci_init(int sci_index, int comm_index, + int rcv_vect, cyg_uint8* base); + +//-------------------------------------------------------------------------- +// SCI register offsets +#define _REG_SCSMR 0x0 // serial mode register +#define _REG_SCBRR 0x1 // bit rate register +#define _REG_SCSCR 0x2 // serial control register +#define _REG_SCTDR 0x3 // transmit data register +#define _REG_SCSSR 0x4 // serial status register +#define _REG_SCRDR 0x5 // receive data register + +//-------------------------------------------------------------------------- + +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +//-------------------------------------------------------------------------- +// end of h8_sci.h diff --git a/packages/hal/h8300/h8300h/current/include/mod_regs_adc.h b/packages/hal/h8300/h8300h/current/include/mod_regs_adc.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/mod_regs_adc.h @@ -0,0 +1,70 @@ +#ifndef CYGONCE_MOD_REGS_ADC_H +#define CYGONCE_MOD_REGS_ADC_H + +//========================================================================== +// +// mod_regs_adc.h +// +// A/D D/A Converter Register +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_DASTCR 0xFEE01A +#define CYGARC_DADR0 0xFEE09C +#define CYGARC_DADR1 0xFEE09D +#define CYGARC_DACR 0xFEE09E + +#define CYGARC_ADDRAH 0xFFFFE0 +#define CYGARC_ADDRAL 0xFFFFE1 +#define CYGARC_ADDRBH 0xFFFFE2 +#define CYGARC_ADDRBL 0xFFFFE3 +#define CYGARC_ADDRCH 0xFFFFE4 +#define CYGARC_ADDRCL 0xFFFFE5 +#define CYGARC_ADDRDH 0xFFFFE6 +#define CYGARC_ADDRDL 0xFFFFE7 +#define CYGARC_ADCSR 0xFFFFE8 +#define CYGARC_ADCR 0xFFFFE9 + +#endif diff --git a/packages/hal/h8300/h8300h/current/include/mod_regs_bsc.h b/packages/hal/h8300/h8300h/current/include/mod_regs_bsc.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/mod_regs_bsc.h @@ -0,0 +1,68 @@ +#ifndef CYGONCE_MOD_REGS_BSC_H +#define CYGONCE_MOD_REGS_BSC_H + +//========================================================================== +// +// mod_regs_bsc.h +// +// Bus Controler Register +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_BRCR 0xFEE013 +#define CYGARC_ADRCR 0xFEE01E +#define CYGARC_CSCR 0xFEE01F +#define CYGARC_ABWCR 0xFEE020 +#define CYGARC_ASTCR 0xFEE021 +#define CYGARC_WCRH 0xFEE022 +#define CYGARC_WCRL 0xFEE023 +#define CYGARC_BCR 0xFEE024 +#define CYGARC_DRCRA 0xFEE026 +#define CYGARC_DRCRB 0xFEE027 +#define CYGARC_RTMCSR 0xFEE028 +#define CYGARC_RTCNT 0xFEE029 +#define CYGARC_RTCOR 0xFEE02A + +#endif diff --git a/packages/hal/h8300/h8300h/current/include/mod_regs_dmac.h b/packages/hal/h8300/h8300h/current/include/mod_regs_dmac.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/mod_regs_dmac.h @@ -0,0 +1,87 @@ +#ifndef CYGONCE_MOD_REGS_DMAC_H +#define CYGONCE_MOD_REGS_DMAC_H + +//========================================================================== +// +// mod_regs_dmac.h +// +// DMA Controler Register +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_MAR0AR 0xFFFF20 +#define CYGARC_MAR0AE 0xFFFF21 +#define CYGARC_MAR0AH 0xFFFF22 +#define CYGARC_MAR0AL 0xFFFF23 +#define CYGARC_ETCR0AL 0xFFFF24 +#define CYGARC_ETCR0AH 0xFFFF25 +#define CYGARC_IOAR0A 0xFFFF26 +#define CYGARC_DTCR0A 0xFFFF27 +#define CYGARC_MAR0BR 0xFFFF28 +#define CYGARC_MAR0BE 0xFFFF29 +#define CYGARC_MAR0BH 0xFFFF2A +#define CYGARC_MAR0BL 0xFFFF2B +#define CYGARC_ETCR0BL 0xFFFF2C +#define CYGARC_ETCR0BH 0xFFFF2D +#define CYGARC_IOAR0B 0xFFFF2E +#define CYGARC_DTCR0B 0xFFFF2F +#define CYGARC_MAR1AR 0xFFFF30 +#define CYGARC_MAR1AE 0xFFFF31 +#define CYGARC_MAR1AH 0xFFFF32 +#define CYGARC_MAR1AL 0xFFFF33 +#define CYGARC_ETCR1AL 0xFFFF34 +#define CYGARC_ETCR1AH 0xFFFF35 +#define CYGARC_IOAR1A 0xFFFF36 +#define CYGARC_DTCR1A 0xFFFF37 +#define CYGARC_MAR1BR 0xFFFF38 +#define CYGARC_MAR1BE 0xFFFF39 +#define CYGARC_MAR1BH 0xFFFF3A +#define CYGARC_MAR1BL 0xFFFF3B +#define CYGARC_ETCR1BL 0xFFFF3C +#define CYGARC_ETCR1BH 0xFFFF3D +#define CYGARC_IOAR1B 0xFFFF3E +#define CYGARC_DTCR1B 0xFFFF3F + +#endif diff --git a/packages/hal/h8300/h8300h/current/include/mod_regs_intc.h b/packages/hal/h8300/h8300h/current/include/mod_regs_intc.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/mod_regs_intc.h @@ -0,0 +1,60 @@ +#ifndef CYGONCE_MOD_REGS_INTC_H +#define CYGONCE_MOD_REGS_INTC_H + +//========================================================================== +// +// mod_regs_intc.h +// +// Interrupt Controler Register +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_ISCR 0xFEE014 +#define CYGARC_IER 0xFEE015 +#define CYGARC_ISR 0xFEE016 +#define CYGARC_IPRA 0xFEE018 +#define CYGARC_IPRB 0xFEE019 + +#endif diff --git a/packages/hal/h8300/h8300h/current/include/mod_regs_pio.h b/packages/hal/h8300/h8300h/current/include/mod_regs_pio.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/mod_regs_pio.h @@ -0,0 +1,82 @@ +#ifndef CYGONCE_MOD_REGS_PIO_H +#define CYGONCE_MOD_REGS_PIO_H + +//========================================================================== +// +// mod_regs_pio.h +// +// I/O Port Controler Register +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_P1DDR 0xFEE000 +#define CYGARC_P2DDR 0xFEE001 +#define CYGARC_P3DDR 0xFEE002 +#define CYGARC_P4DDR 0xFEE003 +#define CYGARC_P5DDR 0xFEE004 +#define CYGARC_P6DDR 0xFEE005 +/*#define CYGARC_P7DDR 0xFEE006*/ +#define CYGARC_P8DDR 0xFEE007 +#define CYGARC_P9DDR 0xFEE008 +#define CYGARC_PADDR 0xFEE009 +#define CYGARC_PBDDR 0xFEE00A + +#define CYGARC_P1DR 0xFFFFD0 +#define CYGARC_P2DR 0xFFFFD1 +#define CYGARC_P3DR 0xFFFFD2 +#define CYGARC_P4DR 0xFFFFD3 +#define CYGARC_P5DR 0xFFFFD4 +#define CYGARC_P6DR 0xFFFFD5 +/*#define CYGARC_P7DR 0xFFFFD6*/ +#define CYGARC_P8DR 0xFFFFD7 +#define CYGARC_P9DR 0xFFFFD8 +#define CYGARC_PADR 0xFFFFD9 +#define CYGARC_PBDR 0xFFFFDA + +#define CYGARC_P2CR 0xFEE03C +#define CYGARC_P4CR 0xFEE03E +#define CYGARC_P5CR 0xFEE03F + +#endif diff --git a/packages/hal/h8300/h8300h/current/include/mod_regs_sci.h b/packages/hal/h8300/h8300h/current/include/mod_regs_sci.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/mod_regs_sci.h @@ -0,0 +1,144 @@ +#ifndef CYGONCE_MOD_REGS_SCI_H +#define CYGONCE_MOD_REGS_SCI_H + +//========================================================================== +// +// mod_regs_sci.h +// +// Serial Communication Interface Register +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_SMR0 0xFFFFB0 +#define CYGARC_BRR0 0xFFFFB1 +#define CYGARC_SCR0 0xFFFFB2 +#define CYGARC_TDR0 0xFFFFB3 +#define CYGARC_SSR0 0xFFFFB4 +#define CYGARC_RDR0 0xFFFFB5 +#define CYGARC_SCMR0 0xFFFFB6 +#define CYGARC_SMR1 0xFFFFB8 +#define CYGARC_BRR1 0xFFFFB9 +#define CYGARC_SCR1 0xFFFFBA +#define CYGARC_TDR1 0xFFFFBB +#define CYGARC_SSR1 0xFFFFBC +#define CYGARC_RDR1 0xFFFFBD +#define CYGARC_SCMR1 0xFFFFBE +#define CYGARC_SMR2 0xFFFFC0 +#define CYGARC_BRR2 0xFFFFC1 +#define CYGARC_SCR2 0xFFFFC2 +#define CYGARC_TDR2 0xFFFFC3 +#define CYGARC_SSR2 0xFFFFC4 +#define CYGARC_RDR2 0xFFFFC5 +#define CYGARC_SCMR2 0xFFFFC6 + +// Serial Mode Register +#define CYGARC_REG_SCSMR_CA 0x80 // communication mode +#define CYGARC_REG_SCSMR_CHR 0x40 // character length (7 if set) +#define CYGARC_REG_SCSMR_PE 0x20 // parity enable +#define CYGARC_REG_SCSMR_OE 0x10 // parity mode +#define CYGARC_REG_SCSMR_STOP 0x08 // stop bit length +#define CYGARC_REG_SCSMR_MP 0x04 // multiprocessor mode +#define CYGARC_REG_SCSMR_CKS1 0x02 // clock select 1 +#define CYGARC_REG_SCSMR_CKS0 0x01 // clock select 0 +#define CYGARC_REG_SCSMR_CKSx_MASK 0x03 // mask + +// Serial Control Register +#define CYGARC_REG_SCSCR_TIE 0x80 // transmit interrupt enable +#define CYGARC_REG_SCSCR_RIE 0x40 // receive interrupt enable +#define CYGARC_REG_SCSCR_TE 0x20 // transmit enable +#define CYGARC_REG_SCSCR_RE 0x10 // receive enable +#define CYGARC_REG_SCSCR_MPIE 0x08 // multiprocessor interrupt enable +#define CYGARC_REG_SCSCR_TEIE 0x04 // transmit-end interrupt enable +#define CYGARC_REG_SCSCR_CKE1 0x02 // clock enable 1 +#define CYGARC_REG_SCSCR_CKE0 0x01 // clock enable 0 + +// Serial Status Register +#define CYGARC_REG_SCSSR_TDRE 0x80 // transmit data register empty +#define CYGARC_REG_SCSSR_RDRF 0x40 // receive data register full +#define CYGARC_REG_SCSSR_ORER 0x20 // overrun error +#define CYGARC_REG_SCSSR_FER 0x10 // framing error +#define CYGARC_REG_SCSSR_PER 0x08 // parity error +#define CYGARC_REG_SCSSR_TEND 0x04 // transmit end +#define CYGARC_REG_SCSSR_MPB 0x02 // multiprocessor bit +#define CYGARC_REG_SCSSR_MPBT 0x01 // multiprocessor bit transfer + +// When clearing the status register, always write the value: +// CYGARC_REG_SCSSR_CLEARMASK & ~bit +// to prevent other bits than the one of interest to be cleared. +#define CYGARC_REG_SCSSR_CLEARMASK 0xf8 + +// Baud rate values calculation, depending on peripheral clock (Pf) +// n is CKS setting (0-3) +// N = (Pf/(64*2^(2n-1)*B))-1 +// With CYGARC_SCBRR_CKSx providing the values 1, 4, 16, 64 we get +// N = (Pf/(32*_CKS*B))-1 +// +// The CYGARC_SCBRR_OPTIMAL_CKS macro should compute the minimal CKS +// setting for the given baud rate and peripheral clock. +// +// The error of the CKS+count value can be computed by: +// E(%) = ((Pf/((N+1)*B*(64^(n-1)))-1)*100 +// +#define CYGARC_SCBRR_PRESCALE(_b_) \ +((((CYGHWR_HAL_H8300_PROCESSOR_SPEED/32/1/(_b_))-1)<256) ? 1 : \ + (((CYGHWR_HAL_H8300_PROCESSOR_SPEED/32/4/(_b_))-1)<256) ? 4 : \ + (((CYGHWR_HAL_H8300_PROCESSOR_SPEED/32/16/(_b_))-1)<256) ? 16 : 64) + +// Add half the divisor to reduce rounding errors to .5 +#define CYGARC_SCBRR_ROUNDING(_b_) \ + 16*CYGARC_SCBRR_PRESCALE(_b_)*(_b_) + +// These two macros provide the static values we need to stuff into the +// registers. +#define CYGARC_SCBRR_CKSx(_b_) \ + ((1 == CYGARC_SCBRR_PRESCALE(_b_)) ? 0 : \ + (4 == CYGARC_SCBRR_PRESCALE(_b_)) ? 1 : \ + (16 == CYGARC_SCBRR_PRESCALE(_b_)) ? 2 : 3) +#define CYGARC_SCBRR_N(_b_) \ + (((_b_) < 4800) ? 0 : \ + ((_b_) > 115200) ? 0 : \ + (((CYGHWR_HAL_H8300_PROCESSOR_SPEED+CYGARC_SCBRR_ROUNDING(_b_))/32/CYGARC_SCBRR_PRESCALE(_b_)/(_b_))-1)) + +#endif diff --git a/packages/hal/h8300/h8300h/current/include/mod_regs_sys.h b/packages/hal/h8300/h8300h/current/include/mod_regs_sys.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/mod_regs_sys.h @@ -0,0 +1,65 @@ +#ifndef CYGONCE_MOD_REGS_SYS_H +#define CYGONCE_MOD_REGS_SYS_H + +//========================================================================== +// +// mod_regs_sys.h +// +// System Controler Register +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_MDCR 0xFEE000 +#define CYGARC_SYSCR 0xFEE001 +#define CYGARC_DIVCR 0xFEE01B +#define CYGARC_MSTCRH 0xFEE01C +#define CYGARC_MSTCRL 0xFEE01D +#define CYGARC_FLMCR1 0xFEE030 +#define CYGARC_FLMCR2 0xFEE031 +#define CYGARC_EBR1 0xFEE032 +#define CYGARC_EBR2 0xFEE033 +#define CYGARC_RAMCR 0xFEE077 + +#endif diff --git a/packages/hal/h8300/h8300h/current/include/mod_regs_tmr.h b/packages/hal/h8300/h8300h/current/include/mod_regs_tmr.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/mod_regs_tmr.h @@ -0,0 +1,112 @@ +#ifndef CYGONCE_MOD_REGS_TMR_H +#define CYGONCE_MOD_REGS_TMR_H + +//========================================================================== +// +// mod_regs_tmr.h +// +// 16bit/8bit/WatchDog Timer Register +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_TSTR 0xFFFF60 +#define CYGARC_TSNC 0XFFFF61 +#define CYGARC_TMDR 0xFFFF62 +#define CYGARC_TOLR 0xFFFF63 +#define CYGARC_TISRA 0xFFFF64 +#define CYGARC_TISRB 0xFFFF65 +#define CYGARC_TISRC 0xFFFF66 +#define CYGARC_TCR0 0xFFFF68 +#define CYGARC_TIOR0 0xFFFF69 +#define CYGARC_TCNT0H 0xFFFF6A +#define CYGARC_TCNT0L 0xFFFF6B +#define CYGARC_GRA0H 0xFFFF6C +#define CYGARC_GRA0L 0xFFFF6D +#define CYGARC_GRB0H 0xFFFF6E +#define CYGARC_GRB0L 0xFFFF6F +#define CYGARC_TCR1 0xFFFF70 +#define CYGARC_TIOR1 0xFFFF71 +#define CYGARC_TCNT1H 0xFFFF72 +#define CYGARC_TCNT1L 0xFFFF73 +#define CYGARC_GRA1H 0xFFFF74 +#define CYGARC_GRA1L 0xFFFF75 +#define CYGARC_GRB1H 0xFFFF76 +#define CYGARC_GRB1L 0xFFFF77 +#define CYGARC_TCR3 0xFFFF78 +#define CYGARC_TIOR3 0xFFFF79 +#define CYGARC_TCNT3H 0xFFFF7A +#define CYGARC_TCNT3L 0xFFFF7B +#define CYGARC_GRA3H 0xFFFF7C +#define CYGARC_GRA3L 0xFFFF7D +#define CYGARC_GRB3H 0xFFFF7E +#define CYGARC_GRB3L 0xFFFF7F + +#define CYGARC_8TCR0 0xFFFF80 +#define CYGARC_8TCR1 0xFFFF81 +#define CYGARC_8TCSR0 0xFFFF82 +#define CYGARC_8TCSR1 0xFFFF83 +#define CYGARC_TCORA0 0xFFFF84 +#define CYGARC_TCORA1 0xFFFF85 +#define CYGARC_TCORB0 0xFFFF86 +#define CYGARC_TCORB1 0xFFFF87 +#define CYGARC_8TCNT0 0xFFFF88 +#define CYGARC_8TCNT1 0xFFFF89 + +#define CYGARC_8TCR2 0xFFFF90 +#define CYGARC_8TCR3 0xFFFF91 +#define CYGARC_8TCSR2 0xFFFF92 +#define CYGARC_8TCSR3 0xFFFF93 +#define CYGARC_TCORA2 0xFFFF94 +#define CYGARC_TCORA3 0xFFFF95 +#define CYGARC_TCORB2 0xFFFF96 +#define CYGARC_TCORB3 0xFFFF97 +#define CYGARC_8TCNT2 0xFFFF98 +#define CYGARC_8TCNT3 0xFFFF99 + +#define CYGARC_TCSR 0xFFFF8C +#define CYGARC_TCNT 0xFFFF8D +#define CYGARC_RSTCSR 0xFFFF8F + +#endif diff --git a/packages/hal/h8300/h8300h/current/include/mod_regs_tpc.h b/packages/hal/h8300/h8300h/current/include/mod_regs_tpc.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/mod_regs_tpc.h @@ -0,0 +1,63 @@ +#ifndef CYGONCE_MOD_REGS_TPC_H +#define CYGONCE_MOD_REGS_TPC_H + +//========================================================================== +// +// mod_regs_tpc.h +// +// Timming Perttern Controler Register +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_TPMR 0xFFFFA0 +#define CYGARC_TPCR 0xFFFFA1 +#define CYGARC_NDERB 0xFFFFA2 +#define CYGARC_NDERA 0xFFFFA3 +#define CYGARC_NDRB1 0xFFFFA4 +#define CYGARC_NDRA1 0xFFFFA5 +#define CYGARC_NDRB2 0xFFFFA6 +#define CYGARC_NDRA2 0xFFFFA7 + +#endif diff --git a/packages/hal/h8300/h8300h/current/include/var_arch.h b/packages/hal/h8300/h8300h/current/include/var_arch.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/var_arch.h @@ -0,0 +1,99 @@ +#ifndef CYGONCE_HAL_VAR_ARCH_H +#define CYGONCE_HAL_VAR_ARCH_H + +//========================================================================== +// +// var_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-14 +// Purpose: Define architecture abstractions +// Description: This file contains any extra or modified definitions for +// this variant of the architecture. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +//-------------------------------------------------------------------------- +// Processor saved states: + +typedef struct HAL_SavedRegisters +{ + // These are common to all saved states and are in the order + // stored and loaded by the movm instruction. + CYG_ADDRWORD er0; + CYG_ADDRWORD er1; + CYG_ADDRWORD er2; + CYG_ADDRWORD er3; + CYG_ADDRWORD er4; + CYG_ADDRWORD er5; + CYG_ADDRWORD er6; + + /* On interrupts the PC and PSW are pushed automatically by the */ + /* CPU and SP is pushed for debugging reasons. On a thread switch */ + /* the saved context is made to look the same. */ + + CYG_ADDRWORD sp; /* Saved copy of SP in some states */ + CYG_WORD32 ccr; + CYG_ADDRWORD pc; /* Program Counter */ + +} HAL_SavedRegisters; + +// Internal peripheral registers +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//-------------------------------------------------------------------------- +#endif // CYGONCE_HAL_VAR_ARCH_H +// End of var_arch.h diff --git a/packages/hal/h8300/h8300h/current/include/var_intr.h b/packages/hal/h8300/h8300h/current/include/var_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/var_intr.h @@ -0,0 +1,222 @@ +#ifndef CYGONCE_HAL_VAR_INTR_H +#define CYGONCE_HAL_VAR_INTR_H + +//========================================================================== +// +// var_intr.h +// +// H8/300H Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-14 +// Purpose: H8/300H Interrupt Support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for H8/300H variants of the H8/300 +// architecture. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include + +#include +#include + +//-------------------------------------------------------------------------- +// Interrupt vectors. + +// The level-specific hardware vectors +// These correspond to VSRs and are the values to use for HAL_VSR_GET/SET +#define CYGNUM_HAL_VECTOR_RESET 0 +#define CYGNUM_HAL_VECTOR_RSV1 1 +#define CYGNUM_HAL_VECTOR_RSV2 2 +#define CYGNUM_HAL_VECTOR_RSV3 3 +#define CYGNUM_HAL_VECTOR_RSV4 4 +#define CYGNUM_HAL_VECTOR_RSV5 5 +#define CYGNUM_HAL_VECTOR_RSV6 6 +#define CYGNUM_HAL_VECTOR_NMI 7 +#define CYGNUM_HAL_VECTOR_TRAP0 8 +#define CYGNUM_HAL_VECTOR_TRAP1 9 +#define CYGNUM_HAL_VECTOR_TRAP2 10 +#define CYGNUM_HAL_VECTOR_TRAP3 11 + +#define CYGNUM_HAL_VSR_MIN 0 +#define CYGNUM_HAL_VSR_MAX 11 +#define CYGNUM_HAL_VSR_COUNT 12 + +// Exception numbers. These are the values used when passed out to an +// external exception handler using cyg_hal_deliver_exception() + +#define CYGNUM_HAL_EXCEPTION_NMI CYGNUM_HAL_VECTOR_NMI + +#if 0 +#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS 0 +#endif + +#define CYGNUM_HAL_EXCEPTION_MIN CYGNUM_HAL_VSR_MIN +#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_VSR_MAX +#define CYGNUM_HAL_EXCEPTION_COUNT CYGNUM_HAL_VSR_COUNT + +// The decoded interrupts +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_0 12 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_1 13 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_2 14 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_3 15 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_4 16 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_5 17 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_6 18 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_7 19 + +#define CYGNUM_HAL_INTERRUPT_WDT 20 +#define CYGNUM_HAL_INTERRUPT_RFSHCMI 21 +#define CYGNUM_HAL_INTERRUPT_RSV22 22 +#define CYGNUM_HAL_INTERRUPT_ADI 23 + +#define CYGNUM_HAL_INTERRUPT_IMIA0 24 +#define CYGNUM_HAL_INTERRUPT_IMIB0 25 +#define CYGNUM_HAL_INTERRUPT_OVI0 26 +#define CYGNUM_HAL_INTERRUPT_RSV27 27 + +#define CYGNUM_HAL_INTERRUPT_IMIA1 28 +#define CYGNUM_HAL_INTERRUPT_IMIB1 29 +#define CYGNUM_HAL_INTERRUPT_OVI1 30 +#define CYGNUM_HAL_INTERRUPT_RSV31 31 + +#define CYGNUM_HAL_INTERRUPT_IMIA2 32 +#define CYGNUM_HAL_INTERRUPT_IMIB2 33 +#define CYGNUM_HAL_INTERRUPT_OVI2 34 +#define CYGNUM_HAL_INTERRUPT_RSV35 35 + +#define CYGNUM_HAL_INTERRUPT_CMIA0 36 +#define CYGNUM_HAL_INTERRUPT_CMIB0 37 +#define CYGNUM_HAL_INTERRUPT_CMIAB1 38 +#define CYGNUM_HAL_INTERRUPT_TOVI01 39 + +#define CYGNUM_HAL_INTERRUPT_CMIA2 40 +#define CYGNUM_HAL_INTERRUPT_CMIB2 41 +#define CYGNUM_HAL_INTERRUPT_CMIAB3 42 +#define CYGNUM_HAL_INTERRUPT_TOVI23 43 + +#define CYGNUM_HAL_INTERRUPT_DEND0A 44 +#define CYGNUM_HAL_INTERRUPT_DEND0B 45 +#define CYGNUM_HAL_INTERRUPT_DEND1A 46 +#define CYGNUM_HAL_INTERRUPT_DEND1B 47 + +#define CYGNUM_HAL_INTERRUPT_RSV48 48 +#define CYGNUM_HAL_INTERRUPT_RSV49 49 +#define CYGNUM_HAL_INTERRUPT_RSV50 50 +#define CYGNUM_HAL_INTERRUPT_RSV51 51 + +#define CYGNUM_HAL_INTERRUPT_ERI0 52 +#define CYGNUM_HAL_INTERRUPT_RXI0 53 +#define CYGNUM_HAL_INTERRUPT_TXI0 54 +#define CYGNUM_HAL_INTERRUPT_TEI0 55 + +#define CYGNUM_HAL_INTERRUPT_ERI1 56 +#define CYGNUM_HAL_INTERRUPT_RXI1 57 +#define CYGNUM_HAL_INTERRUPT_TXI1 58 +#define CYGNUM_HAL_INTERRUPT_TEI1 59 + +#define CYGNUM_HAL_INTERRUPT_ERI2 60 +#define CYGNUM_HAL_INTERRUPT_RXI2 61 +#define CYGNUM_HAL_INTERRUPT_TXI2 62 +#define CYGNUM_HAL_INTERRUPT_TEI2 63 + +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX 63 + +#define CYGNUM_HAL_ISR_COUNT (3+((CYGNUM_HAL_ISR_MAX+1)/4)) + +// The vector used by the Real time clock + +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_CMIAB3 + +//-------------------------------------------------------------------------- +// Interrupt vector translation. + +#if !defined(HAL_TRANSLATE_VECTOR) && !defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN) + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) \ + _index_ = (_vector_) + +#endif + +//-------------------------------------------------------------------------- +// H8/300H specific version of HAL_INTERRUPT_CONFIGURE + +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) \ + hal_interrupt_configure( _vector_, _level_, _up_ ) + +externC void hal_interrupt_configure(int vector,int level,int up); + +#define HAL_INTERRUPT_CONFIGURE_DEFINED + +//-------------------------------------------------------------------------- +// Clock control. + +externC void hal_clock_initialize(cyg_uint32 period); +externC void hal_clock_reset(cyg_uint32 vector,cyg_uint32 period); +externC void hal_clock_read(cyg_uint32 *pvalue); + +#define HAL_CLOCK_INITIALIZE( _period_ ) \ + hal_clock_initialize( _period_ ) + +#define HAL_CLOCK_RESET( _vector_, _period_ ) \ + hal_clock_reset( _vector_, _period_ ) + +#define HAL_CLOCK_READ( _pvalue_ ) \ + hal_clock_read( _pvalue_ ) + +// FIXME: above line should not use CYGNUM_KERNEL_COUNTERS_RTC_PERIOD since +// this means the HAL gets configured by kernel options even when the +// kernel is disabled! + + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_VAR_INTR_H +// End of var_intr.h diff --git a/packages/hal/h8300/h8300h/current/include/variant.inc b/packages/hal/h8300/h8300h/current/include/variant.inc new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/include/variant.inc @@ -0,0 +1,145 @@ +#ifndef CYGONCE_HAL_VARIANT_INC +#define CYGONCE_HAL_VARIANT_INC +##============================================================================= +## +## variant.inc +## +## H8/300H assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): nickg +## Contributors: nickg +## Date: 1999-04-06 +## Purpose: H8/300H definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the H8/300H CPU variant. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include + + +#------------------------------------------------------------------------------ +# Register definitions + +#define SYSCR 0xfee012 + +#------------------------------------------------------------------------------ +# CPU state save and restore macros + + .macro hal_cpu_save_all + stc ccr,@-sp + subs #2,sp + subs #4,sp + mov.l er6,@-sp # push all registers + mov.l er5,@-sp + mov.l er4,@-sp + mov.l er3,@-sp + mov.l er2,@-sp + mov.l er1,@-sp + mov.l er0,@-sp + .endm + + .macro hal_cpu_load_all + mov.l @sp+,er0 # pop regs + mov.l @sp+,er1 + mov.l @sp+,er2 + mov.l @sp+,er3 + mov.l @sp+,er4 + mov.l @sp+,er5 + mov.l @sp+,er6 + adds #4,sp + adds #2,sp + ldc @sp+,ccr + .endm + + +# Location of PC in saved register context (HAL_SavedRegisters) +#define SAVED_CONTEXT_PC_OFFSET 36 + +##----------------------------------------------------------------------------- +# Default interrupt decoding macros. + +#ifndef CYGPKG_HAL_H8300_INTC_DEFINED + +#define CYG_ISR_TABLE_SIZE 64 + + .macro hal_intc_init + mov.b @SYSCR,r0l + bclr #3,r0l + mov.b r0l,@SYSCR + .endm + +#define CYGPKG_HAL_H8300_INTC_DEFINED + +#endif + + + +#ifndef CYGPKG_HAL_H8300_MON_DEFINED + + .macro hal_mon_init + .endm + +#if !(defined(CYG_HAL_STARTUP_ROM) || \ + defined(CYGPKG_HAL_H8300_H8300H_SIM) || \ + !defined(CYGSEM_HAL_USE_ROM_MONITOR)) + +#define CYG_HAL_H8300_VSR_TABLE_DEFINED + +#endif + + + +#define CYGPKG_HAL_H8300_MON_DEFINED + +#endif + + + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_VARIANT_INC +# end of variant.inc diff --git a/packages/hal/h8300/h8300h/current/src/h8300_h8300h.ld b/packages/hal/h8300/h8300h/current/src/h8300_h8300h.ld new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/src/h8300_h8300h.ld @@ -0,0 +1,135 @@ +//=========================================================================== +// +// MLT linker script for H8/300H +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + +#include +#include +STARTUP(vectors.o) +ENTRY(CYG_LABEL_DEFN(_start)) +#ifdef EXTRAS +INPUT(extras.o) +#endif +GROUP(libtarget.a libgcc.a) + + + +#define ALIGN_LMA 4 +#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1)) +#define LMA_EQ_VMA +#define FORCE_OUTPUT . = . + +#define SECTIONS_BEGIN + +#define SECTION_rom_vectors(_region_, _vma_, _lma_) \ + .vectors _vma_ : _lma_ \ + { FORCE_OUTPUT; KEEP (*(.vectors)) } \ + > _region_ + +#define SECTION_text(_region_, _vma_, _lma_) \ + .text _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__stext) = ABSOLUTE(.); \ + *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) } \ + > _region_ \ + CYG_LABEL_DEFN(__etext) = .; PROVIDE (etext = .); + +#define SECTION_fini(_region_, _vma_, _lma_) \ + .fini _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fini) } \ + > _region_ + +#define SECTION_rodata(_region_, _vma_, _lma_) \ + .rodata _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata*) } \ + > _region_ + +#define SECTION_rodata1(_region_, _vma_, _lma_) \ + .rodata1 _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata1) } \ + > _region_ + +#define SECTION_fixup(_region_, _vma_, _lma_) \ + .fixup _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fixup) } \ + > _region_ + +#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ + .gcc_except_table _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.gcc_except_table) } \ + > _region_ + +#define SECTION_int_fook_table(_region_, _vma_, _lma_) \ + .int_fook_table _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__int_fook_start) = ABSOLUTE (.); \ + FORCE_OUTPUT; *(.int_fook_table) } \ + > _region_ \ + CYG_LABEL_DEFN(__rom_int_fook_start) = LOADADDR (.int_fook_table); \ + CYG_LABEL_DEFN(__int_fook_end) = .; + +#define SECTION_data(_region_, _vma_, _lma_) \ + .data _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__ram_data_start) = ABSOLUTE (.); *(.data*) *(.data1) \ + . = ALIGN(4); \ + KEEP(*( SORT (.ecos.table.*))) ; \ + . = ALIGN(4); \ + CYG_LABEL_DEFN(_GOT1_START_) = ABSOLUTE (.); *(.got1) CYG_LABEL_DEFN(_GOT1_END_) = ABSOLUTE (.); \ + CYG_LABEL_DEFN(_GOT2_START_) = ABSOLUTE (.); *(.got2) CYG_LABEL_DEFN(_GOT2_END_) = ABSOLUTE (.); \ + . = ALIGN (4); \ + CYG_LABEL_DEFN(__CTOR_LIST__) = ABSOLUTE (.); KEEP (*(SORT (.ctors*))) CYG_LABEL_DEFN(__CTOR_END__) = ABSOLUTE (.); \ + CYG_LABEL_DEFN(__DTOR_LIST__) = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) CYG_LABEL_DEFN(__DTOR_END__) = ABSOLUTE (.); \ + CYG_LABEL_DEFN(_GOT_START) = ABSOLUTE (.); CYG_LABEL_DEFN(_GLOBAL_OFFSET_TABLE_) = ABSOLUTE (.) + 32768; CYG_LABEL_DEFN(_SDA_BASE_) = ABSOLUTE (.); \ + *(.got.plt) *(.got) CYG_LABEL_DEFN(_GOT_END_) = ABSOLUTE (.); \ + *(.dynamic) *(.sdata*) *(.sbss*) } \ + > _region_ \ + CYG_LABEL_DEFN(__rom_data_start) = LOADADDR (.data); \ + CYG_LABEL_DEFN(__ram_data_end) = .; PROVIDE (CYG_LABEL_DEFN(__ram_data_end) = .); CYG_LABEL_DEFN(_edata) = .; PROVIDE (edata = .); + +#define SECTION_bss(_region_, _vma_, _lma_) \ + .bss _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__bss_start) = ABSOLUTE (.); \ + *(.scommon) *(.dynbss) *(.bss) *(COMMON) \ + CYG_LABEL_DEFN(__bss_end) = ABSOLUTE (.); } \ + > _region_ + +#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); + +#include CYGHWR_MEMORY_LAYOUT_LDI +#include CYGBLD_HAL_PLATFORM_H + +CYG_LABEL_DEFN(hal_virtual_vector_table) = CYGHWR_HAL_VECTOR_TABLE; + + diff --git a/packages/hal/h8300/h8300h/current/src/h8_sci.c b/packages/hal/h8300/h8300h/current/src/h8_sci.c new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/src/h8_sci.c @@ -0,0 +1,321 @@ +//============================================================================= +// +// h8_sci.c +// +// Simple driver for the H8/300H Serial Communication Interface (SCI) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors:ysato +// Date: 2002-03-21 +// Description: Simple driver for the H8/300H Serial Communication Interface +// Clients of this file can configure the behavior with: +// CYGNUM_SCI_PORTS: number of SCI ports +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGNUM_HAL_H8300_SCI_PORTS + +#include // IO macros +#include // CYG_ISR_HANDLED +#include // Helper functions +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // SAVE/RESTORE GP +#include // Calling-if API +#include // serial register definitions + +#include // our header + +//-------------------------------------------------------------------------- + +void +cyg_hal_plf_sci_init_channel(void* chan) +{ + cyg_uint8 tmp; + cyg_uint8* base = ((channel_data_t *)chan)->base; + + // Disable Tx/Rx interrupts, but enable Tx/Rx + HAL_WRITE_UINT8(base+_REG_SCSCR, + CYGARC_REG_SCSCR_TE|CYGARC_REG_SCSCR_RE); + + // 8-1-no parity. + HAL_WRITE_UINT8(base+_REG_SCSMR, 0); + + // Set speed to CYGNUM_HAL_H8300_H8300H_SCI_DEFAULT_BAUD_RATE + HAL_READ_UINT8(base+_REG_SCSMR, tmp); + tmp &= ~CYGARC_REG_SCSMR_CKSx_MASK; + tmp |= CYGARC_SCBRR_CKSx(CYGNUM_HAL_H8300_H8300H_SCI_BAUD_RATE); + HAL_WRITE_UINT8(base+_REG_SCSMR, tmp); + HAL_WRITE_UINT8(base+_REG_SCBRR, CYGARC_SCBRR_N(CYGNUM_HAL_H8300_H8300H_SCI_BAUD_RATE)); +} + +static cyg_bool +cyg_hal_plf_sci_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 sr; + + HAL_READ_UINT8(base+_REG_SCSSR, sr); + if (sr & CYGARC_REG_SCSSR_ORER) { + // Serial RX overrun. Clear error and let caller try again. + HAL_WRITE_UINT8(base+_REG_SCSSR, + CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_ORER); + return false; + } + + if ((sr & CYGARC_REG_SCSSR_RDRF) == 0) + return false; + + HAL_READ_UINT8(base+_REG_SCRDR, *ch); + + // Clear buffer full flag. + HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCSSR_RDRF); + + return true; +} + +cyg_uint8 +cyg_hal_plf_sci_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + while(!cyg_hal_plf_sci_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +void +cyg_hal_plf_sci_putc(void* __ch_data, cyg_uint8 c) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 sr; + CYGARC_HAL_SAVE_GP(); + + do { + HAL_READ_UINT8(base+_REG_SCSSR, sr); + } while ((sr & CYGARC_REG_SCSSR_TDRE) == 0); + + HAL_WRITE_UINT8(base+_REG_SCTDR, c); + + // Clear empty flag. + HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCSSR_TDRE); + + // Hang around until the character has been safely sent. + do { + HAL_READ_UINT8(base+_REG_SCSSR, sr); + } while ((sr & CYGARC_REG_SCSSR_TDRE) == 0); + + CYGARC_HAL_RESTORE_GP(); +} + + +static channel_data_t channels[CYGNUM_HAL_H8300_SCI_PORTS]; + +static void +cyg_hal_plf_sci_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_sci_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_sci_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_sci_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +cyg_bool +cyg_hal_plf_sci_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + channel_data_t* chan = (channel_data_t*)__ch_data; + int delay_count; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan->msec_timeout * 20; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_sci_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(50); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_sci_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8 scr; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + HAL_INTERRUPT_UNMASK(chan->isr_vector); + HAL_READ_UINT8(chan->base+_REG_SCSCR, scr); + scr |= CYGARC_REG_SCSCR_RIE; + HAL_WRITE_UINT8(chan->base+_REG_SCSCR, scr); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + HAL_INTERRUPT_UNMASK(chan->isr_vector); + HAL_READ_UINT8(chan->base+_REG_SCSCR, scr); + scr &= ~CYGARC_REG_SCSCR_RIE; + HAL_WRITE_UINT8(chan->base+_REG_SCSCR, scr); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_sci_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + cyg_uint8 c, sr; + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + int res = 0; + CYGARC_HAL_SAVE_GP(); + + *__ctrlc = 0; + HAL_READ_UINT8(base+_REG_SCSSR, sr); + if (sr & CYGARC_REG_SCSSR_ORER) { + // Serial RX overrun. Clear error and hope protocol recovers. + HAL_WRITE_UINT8(base+_REG_SCSSR, + CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_ORER); + res = CYG_ISR_HANDLED; + } else if (sr & CYGARC_REG_SCSSR_RDRF) { + // Received character + HAL_READ_UINT8(base+_REG_SCRDR, c); + + // Clear buffer full flag. + HAL_WRITE_UINT8(base+_REG_SCSSR, + CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_RDRF); + + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +void +cyg_hal_plf_sci_init(int sci_index, int comm_index, + int rcv_vect, cyg_uint8* base) +{ + channel_data_t* chan = &channels[sci_index]; + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Initialize channel table + chan->base = base; + chan->isr_vector = rcv_vect; + chan->msec_timeout = 1000; + + // Disable interrupts. + HAL_INTERRUPT_MASK(chan->isr_vector); + + // Init channel + + cyg_hal_plf_sci_init_channel(chan); + + // Setup procs in the vector table + + // Initialize channel procs + CYGACC_CALL_IF_SET_CONSOLE_COMM(comm_index); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, chan); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_sci_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_sci_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_sci_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_sci_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_sci_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_sci_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_sci_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +#endif // CYGNUM_HAL_H8300_H8300H_SCI_PORTS + +//----------------------------------------------------------------------------- +// end of sh_sci.c diff --git a/packages/hal/h8300/h8300h/current/src/var_misc.c b/packages/hal/h8300/h8300h/current/src/var_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/h8300h/current/src/var_misc.c @@ -0,0 +1,249 @@ +//========================================================================== +// +// var_misc.c +// +// HAL CPU variant miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour +// Date: 1999-01-21 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // Base types +#include // tracing macros +#include // assertion macros +#include +#include +#include + +/*------------------------------------------------------------------------*/ +/* Variant specific initialization routine. */ + +void hal_variant_init(void) +{ +} + +struct int_regs { + CYG_BYTE *ier; + CYG_BYTE *isr; + CYG_BYTE mask; + CYG_BYTE status; +}; + +#define REGS_DEF(ier,isr,mask,status) \ + {(CYG_BYTE *)ier,(CYG_BYTE *)isr,mask,status} + +struct int_regs interrupt_registers[]= { + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x01,0x01), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x02,0x02), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x04,0x04), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x08,0x08), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x10,0x10), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x20,0x20), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x40,0x40), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x80,0x80), + REGS_DEF(CYGARC_TCSR,CYGARC_TCSR,0x20,0x80), + REGS_DEF(CYGARC_RTMCSR,CYGARC_RTMCSR,0x40,0x80), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_ADCSR,CYGARC_ADCSR,0x40,0x80), + REGS_DEF(CYGARC_TISRA,CYGARC_TISRA,0x10,0x01), + REGS_DEF(CYGARC_TISRB,CYGARC_TISRB,0x10,0x01), + REGS_DEF(CYGARC_TISRC,CYGARC_TISRC,0x10,0x01), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_TISRA,CYGARC_TISRA,0x20,0x02), + REGS_DEF(CYGARC_TISRB,CYGARC_TISRB,0x20,0x02), + REGS_DEF(CYGARC_TISRC,CYGARC_TISRC,0x20,0x02), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_TISRA,CYGARC_TISRA,0x40,0x04), + REGS_DEF(CYGARC_TISRB,CYGARC_TISRB,0x40,0x04), + REGS_DEF(CYGARC_TISRC,CYGARC_TISRC,0x40,0x04), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_8TCR0,CYGARC_8TCSR0,0x40,0x40), + REGS_DEF(CYGARC_8TCR0,CYGARC_8TCSR0,0x80,0x80), + REGS_DEF(CYGARC_8TCR1,CYGARC_8TCSR1,0xC0,0xC0), + REGS_DEF(CYGARC_8TCR0,CYGARC_8TCSR0,0x20,0x20), + REGS_DEF(CYGARC_8TCR2,CYGARC_8TCSR2,0x40,0x40), + REGS_DEF(CYGARC_8TCR2,CYGARC_8TCSR2,0x80,0x80), + REGS_DEF(CYGARC_8TCR3,CYGARC_8TCSR3,0xC0,0xC0), + REGS_DEF(CYGARC_8TCR2,CYGARC_8TCSR2,0x20,0x20), + REGS_DEF(CYGARC_DTCR0A,CYGARC_DTCR0A,0x08,0x80), + REGS_DEF(CYGARC_DTCR0B,CYGARC_DTCR0B,0x08,0x80), + REGS_DEF(CYGARC_DTCR1A,CYGARC_DTCR1A,0x08,0x80), + REGS_DEF(CYGARC_DTCR1B,CYGARC_DTCR1B,0x08,0x80), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x40,0x30), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x40,0x40), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x80,0x80), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x04,0x04), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x40,0x30), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x40,0x40), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x80,0x80), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x04,0x04), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x40,0x30), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x40,0x40), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x80,0x80), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x04,0x04) +}; + +void +hal_interrupt_mask(int vector) +{ + CYG_BYTE ier; + struct int_regs *regs=&interrupt_registers[vector-12]; + if (vector == CYGNUM_HAL_INTERRUPT_WDT) { + HAL_READ_UINT8(CYGARC_TCSR,ier); + ier &= ~0x20; + HAL_WRITE_UINT16(CYGARC_TCSR,0xa500 | ier); + } else { + if ((vector > 12) && regs->ier) { + HAL_READ_UINT8(regs->ier,ier); + ier &= ~(regs->mask); + HAL_WRITE_UINT8(regs->ier,ier); + } else { + CYG_FAIL("Unknown interrupt vector"); + } + } +} + +void +hal_interrupt_unmask(int vector) +{ + CYG_BYTE ier; + struct int_regs *regs=&interrupt_registers[vector-12]; + if (vector == CYGNUM_HAL_INTERRUPT_WDT) { + HAL_READ_UINT8(CYGARC_TCSR,ier); + ier |= 0x20; + HAL_WRITE_UINT16(CYGARC_TCSR,0xa500 | ier); + } else { + if ((vector > 12) && regs->ier) { + HAL_READ_UINT8(regs->ier,ier); + ier |= regs->mask; + HAL_WRITE_UINT8(regs->ier,ier); + } else { + CYG_FAIL("Unknown interrupt vector"); + } + } +} + +void +hal_interrupt_acknowledge(int vector) +{ + CYG_BYTE isr; + struct int_regs *regs=&interrupt_registers[vector-12]; + if (vector >= CYGNUM_HAL_INTERRUPT_DEND0A && + vector <= CYGNUM_HAL_INTERRUPT_DEND1B) + return; + if (vector == CYGNUM_HAL_INTERRUPT_WDT) { + HAL_READ_UINT8(CYGARC_TCSR,isr); + isr &= ~0x80; + HAL_WRITE_UINT16(CYGARC_TCSR,0xa500 | isr); + } else { + if ((vector > 12) && regs->isr) { + HAL_READ_UINT8(regs->isr,isr); + isr &= ~(regs->status); + HAL_WRITE_UINT8(regs->isr,isr); + } else { + CYG_FAIL("Unknown interrupt vector"); + } + } +} + +const short priority_table[]={ + 7, 6, 5, 5, 4, 4,-1,-1, + 3, 3,-1, 3, 2, 2, 2, 2, + 1, 1, 1, 1, 0, 0, 0, 0, + 15,15,15,15,14,14,14,14, + 13,13,13,13,-1,-1,-1,-1, + 11,11,11,11,10,10,10,10, + 9,9,9,9 +}; + +void +hal_interrupt_set_level(int vector,int level) +{ + CYG_BYTE *ipr; + CYG_BYTE ipr_mask; + int priority = priority_table[vector-12]; + ipr = (CYG_BYTE *)CYGARC_IPRA + ((priority & 0xf8) >> 3); + if (priority>=0) { + ipr_mask = 1 << (priority & 0x07); + if (level == 0) { + *ipr &= ~ipr_mask; + } else { + *ipr |= ipr_mask; + } + } else { + CYG_FAIL("Unknown interrupt vector"); + } +} + +void +hal_interrupt_configure(int vector,int level,int up) +{ + cyg_uint8 iscr,mask; + if (vector >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0 && + vector <= CYGNUM_HAL_INTERRUPT_EXTERNAL_7) { + mask = 1 << (vector - CYGNUM_HAL_INTERRUPT_EXTERNAL_0); + HAL_READ_UINT8(CYGARC_ISCR,iscr); + if (level) { + iscr &= ~mask; + } + if (up) { + iscr |= mask; + } + CYG_ASSERT(!(up && level), "Cannot trigger on high level!"); + HAL_WRITE_UINT8(CYGARC_ISCR,iscr); + } else { + CYG_FAIL("Unhandled interrupt vector"); + } +} + +/*------------------------------------------------------------------------*/ +/* End of var_misc.c */ diff --git a/packages/hal/h8300/sim/current/ChangeLog b/packages/hal/h8300/sim/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/ChangeLog @@ -0,0 +1,45 @@ +2002-04-29 Jonathan Larmour + + * src/delay_us.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-24 Yoshinori Sato + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/h8300/sim/current/cdl/hal_h8300_h8300h_sim.cdl b/packages/hal/h8300/sim/current/cdl/hal_h8300_h8300h_sim.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/cdl/hal_h8300_h8300h_sim.cdl @@ -0,0 +1,205 @@ +# ==================================================================== +# +# hal_h8300_h8300h_sim.cdl +# +# H8/300H SIM HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: bartv +# Contributors: +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300_H8300H_SIM { + display "H8/300H simulator" + parent CYGPKG_HAL_H8300 + requires CYGPKG_HAL_H8300_H8300H + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + define_header hal_h8300_h8300h_sim.h + include_dir cyg/hal + description " + The minimal simulator HAL package is provided for use when + only a simple simulation of the processor architecture is + desired, as opposed to detailed simulation of any specific + board. In particular it is not possible to simulate any of + the I/O devices, so device drivers cannot be used." + + compile hal_diag.c plf_misc.c delay_us.S + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + + puts $::cdl_header "#define CYG_HAL_H8300" + puts $::cdl_header "#define CYGNUM_HAL_H8300_SCI_PORTS 1" + puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0xfff000" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM"} + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + Only supports RAM startup." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The CQ/7708 board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants." + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + cdl_option CYGNUM_HAL_H8300_RTC_PRESCALE { + display "Real-time clock base prescale" + flavor data + calculated 8192 + } + # Isn't a nice way to handle freq requirement! + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated 10 + } + } + + cdl_option CYGHWR_HAL_H8300_CPG_INPUT { + display "OSC/Clock Freqency" + flavor data + default_value 8000000 + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "h8300-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -mh -mint32 -fsigned-char -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-g -nostdlib -Wl,--gc-sections -Wl,-static -mh" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { "h8300_h8300h_sim_ram" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { "" } + } + } +} diff --git a/packages/hal/h8300/sim/current/doc/README b/packages/hal/h8300/sim/current/doc/README new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/doc/README @@ -0,0 +1,2 @@ +Please visit http://homepage2.nifty.com/ysato/eCos/index.en.html for up to date +information, particularly on which GNU tools to use and patches. diff --git a/packages/hal/h8300/sim/current/include/hal_diag.h b/packages/hal/h8300/sim/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/include/hal_diag.h @@ -0,0 +1,75 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-14 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include + +externC void hal_diag_init(void); +externC void hal_diag_write_char(cyg_uint8 c); +externC void hal_diag_read_char(cyg_uint8 *c); + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_HAL_DIAG_H */ diff --git a/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.h b/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.h @@ -0,0 +1,18 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include +#include + +#endif + +#define CYGMEM_REGION_ram (0x200000) +#define CYGMEM_REGION_ram_SIZE (0x200000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x300000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.ldi b/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300h) + +MEMORY +{ + ram : ORIGIN = 0x000000, LENGTH = 0x200000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x000000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_int_fook_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.mlt b/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.mlt @@ -0,0 +1,12 @@ +version 0 +region ram 200000 200000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 200000 200000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/h8300/sim/current/include/platform.inc b/packages/hal/h8300/sim/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/include/platform.inc @@ -0,0 +1,67 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## AM31 simulator "board" assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): jlarmour +## Contributors: jlarmour +## Date: 1999-09-09 +## Purpose: AM31 Simulator "board" definitions. +## Description: This file contains various definitions and macros that are +## required for writing assembly code for the am31 simulator. +## Currently there are none +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +##----------------------------------------------------------------------------- + +# Nothing required + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/packages/hal/h8300/sim/current/include/plf_intr.h b/packages/hal/h8300/sim/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/include/plf_intr.h @@ -0,0 +1,76 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// H8/300H sim interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1999-09-09 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the simulator. This file +// is empty since none are required! +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +//-------------------------------------------------------------------------- + +externC void h8300h_reset (void); +externC void hal_delay_us(int usecs); + +#define HAL_PLATFORM_RESET(x) +#define HAL_PLATFORM_RESET_ENTRY &h8300h_reset + +#define HAL_DELAY_US(n) hal_delay_us((n) /25) + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/h8300/sim/current/include/plf_stub.h b/packages/hal/h8300/sim/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/include/plf_stub.h @@ -0,0 +1,90 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-05-18 +// Purpose: Platform HAL stub support for H8/300H simulator +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM, externC + +#include // architecture stub support + +#include // hal_diag_led_on + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#ifdef CYGSEM_HAL_ROM_MONITOR +# define HAL_STUB_PLATFORM_INIT() hal_diag_led_on() +#else +# define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT +#endif + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/h8300/sim/current/src/delay_us.S b/packages/hal/h8300/sim/current/src/delay_us.S new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/src/delay_us.S @@ -0,0 +1,53 @@ +;;delay_us + +#include + +#include +#include +#include + +#define DELAY_COUNT (CYGHWR_HAL_H8300_PROCESSOR_SPEED/1000000)/8*25 + +// .file "delay_us.S" + .h8300h + .text + + .global CYG_LABEL_DEFN(hal_delay_us) +CYG_LABEL_DEFN(hal_delay_us): + mov.b #0,r1l + mov.b r1l,@CYGARC_8TCNT2:8 + mov.b #1,r1l + mov.b r1l,@CYGARC_8TCR2:8 + mov.b #0,r2h + sub.w e1,e1 +1: + mov.l er0,er0 + ble 6f +2: + cmp.w #DELAY_COUNT,e1 + bgt 5f + mov.b #0,r1h + mov.b @CYGARC_8TCNT2:8,r2l +3: + mov.b @CYGARC_8TCNT2:8,r1l + cmp.b r1l,r2l + beq 3b + bcs 4f + inc.b r1h +4: + sub.w r2,r1 + add.w r1,e1 + bra 2b +5: + mov.w e1,r1 + mov.b #DELAY_COUNT,r2l + divxs r2l,r1 + sub.l er2,er2 + mov.b r1l,r2l + sub.w r2,e1 + dec.l #1,er0 + bra 1b +6: + mov.b #0,r0l + mov.b r0l,@CYGARC_8TCR2 + rts diff --git a/packages/hal/h8300/sim/current/src/hal_diag.c b/packages/hal/h8300/sim/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/src/hal_diag.c @@ -0,0 +1,95 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dsm +// Contributors: dsm +// Date: 1998-03-13 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include +#include +#include + +#define SCI_BASE ((cyg_uint8*)0xffffb0) + +static channel_data_t channel = { (cyg_uint8*)SCI_BASE, 0, 0}; + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_sci_init(0, 0, CYGNUM_HAL_INTERRUPT_RXI0, SCI_BASE); +} + +void hal_diag_init(void) +{ + cyg_hal_plf_sci_init_channel(&channel); +} + +void +hal_diag_write_char( cyg_uint8 c ) +{ + cyg_hal_plf_sci_putc(&channel, c); +} + +void +hal_diag_read_char(cyg_uint8 *c) +{ + *c = (char) cyg_hal_plf_sci_getc(&channel); +} + +/*===========================================================================*/ +/* EOF hal_diag.c */ + diff --git a/packages/hal/h8300/sim/current/src/plf_misc.c b/packages/hal/h8300/sim/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/h8300/sim/current/src/plf_misc.c @@ -0,0 +1,125 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour +// Date: 1999-09-09 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // Base types + +#include // architectural definitions +#include +#include +#include +#include + +/*------------------------------------------------------------------------*/ + +void hal_platform_init(void) +{ + hal_if_init(); +} + +void h8300h_reset(void) +{ + __asm__ ("jmp @@0\n\t"); +} + +/*------------------------------------------------------------------------*/ +/* Control C ISR support */ + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +struct Hal_SavedRegisters *hal_saved_interrupt_state; + +#endif + +/*------------------------------------------------------------------------*/ +/* clock support */ + +void hal_clock_initialize(cyg_uint32 period) +{ + CYG_BYTE prescale; +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8 + prescale = 0x01; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 64 + prescale = 0x02; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8192 + prescale = 0x03; +#else +#error illigal RTC prescale setting +#endif +#endif +#endif + HAL_WRITE_UINT8(CYGARC_TCORA3,period); + HAL_WRITE_UINT8(CYGARC_8TCNT3,0x00); + HAL_WRITE_UINT8(CYGARC_8TCR3,0x48 | prescale); + HAL_WRITE_UINT8(CYGARC_8TCSR3,0x00); +} + +void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + HAL_WRITE_UINT8(CYGARC_8TCR3,0x00); + HAL_WRITE_UINT8(CYGARC_8TCSR3,0x00); + hal_clock_initialize(period); +} + +void hal_clock_read(cyg_uint32 *pvalue) +{ + CYG_BYTE val; + HAL_READ_UINT8(CYGARC_8TCNT3,val); + *pvalue = val; +} + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/packages/hal/i386/arch/current/ChangeLog b/packages/hal/i386/arch/current/ChangeLog --- a/packages/hal/i386/arch/current/ChangeLog +++ b/packages/hal/i386/arch/current/ChangeLog @@ -1,3 +1,20 @@ +2002-05-17 Nick Garnett + + * src/vectors.S: Rearranged interrupt stack definitions to make it + work correctly in SMP case. The #ifdefs were improperly nested. + +2002-04-29 Jonathan Larmour + + * src/vectors.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-15 Jonathan Larmour + + * src/hal_syscall.c (hal_syscall_handler): Add extra sig argument to + __do_syscall. + 2002-01-08 Nick Garnett * include/hal_arch.h: @@ -115,6 +132,23 @@ 2001-08-22 Nick Garnett * src/hal_misc.c: Fix "implicit decl of diag_printf" warning. @@ -761,27 +795,36 @@ Mon Nov 9 15:18:11 GMT 1998 Chris Pro Initial i386 linux port. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/i386/arch/current/cdl/hal_i386.cdl b/packages/hal/i386/arch/current/cdl/hal_i386.cdl --- a/packages/hal/i386/arch/current/cdl/hal_i386.cdl +++ b/packages/hal/i386/arch/current/cdl/hal_i386.cdl @@ -5,29 +5,38 @@ # i386 architectural HAL package configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # @@ -72,6 +81,17 @@ cdl_package CYGPKG_HAL_I386 { @rm target.tmp } + cdl_component CYGPKG_HAL_SMP_SUPPORT { + display "SMP support" + default_value 0 + requires { CYGHWR_HAL_I386_FPU_SWITCH_LAZY == 0 } + + cdl_option CYGPKG_HAL_SMP_CPU_MAX { + display "Max number of CPUs supported" + flavor data + default_value 2 + } + } cdl_component CYGHWR_HAL_I386_FPU { display "Enable I386 FPU support" diff --git a/packages/hal/i386/arch/current/include/arch.inc b/packages/hal/i386/arch/current/include/arch.inc --- a/packages/hal/i386/arch/current/include/arch.inc +++ b/packages/hal/i386/arch/current/include/arch.inc @@ -7,29 +7,38 @@ ## i386 assembler header file ## ##============================================================================= -######COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -######COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## @@ -79,6 +88,24 @@ #endif #------------------------------------------------------------------------------ +# SMP support + +#ifdef CYGPKG_HAL_SMP_SUPPORT + + .macro hal_smp_init +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) + movl $0,cyg_hal_smp_vsr_sync_flag +#endif + .endm + + // Put CPU number in register + .macro hal_smp_cpu reg + movl cyg_hal_smp_local_apic,\reg + movl 0x20(\reg),\reg + shrl $24,\reg + .endm + +#else .macro hal_smp_init .endm @@ -87,6 +114,7 @@ movl $0,\reg .endm +#endif #------------------------------------------------------------------------------ # Stack switching macros @@ -95,6 +123,31 @@ #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK +#ifdef CYGPKG_HAL_SMP_SUPPORT + + .macro hal_init_istack reg + hal_smp_cpu %ebx + movl $__interrupt_stack_vector,%ecx + movl $CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE,%eax + imull %ebx,%eax + addl $__interrupt_stack_first,%eax + movl %eax,0(%ecx,%ebx,4) + movl $CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE,\reg + addl %eax,\reg + .endm + + .macro hal_load_istack reg + hal_load_istack_base \reg + addl $CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE,\reg + .endm + + .macro hal_load_istack_base reg + hal_smp_cpu \reg + movl $__interrupt_stack_vector,%eax + movl 0(%eax,\reg,4),\reg + .endm + +#else // CYGPKG_HAL_SMP_SUPPORT .macro hal_init_istack reg,tr movl $__interrupt_stack,\reg // Load interrupt stack .endm @@ -107,6 +160,7 @@ movl $__interrupt_stack_base,\reg // Load interrupt stack base .endm +#endif // CYGPKG_HAL_SMP_SUPPORT .macro hal_to_intstack hal_load_istack_base %ebx // EBX = stack base diff --git a/packages/hal/i386/arch/current/include/basetype.h b/packages/hal/i386/arch/current/include/basetype.h --- a/packages/hal/i386/arch/current/include/basetype.h +++ b/packages/hal/i386/arch/current/include/basetype.h @@ -8,29 +8,38 @@ // Standard types for this architecture. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/arch/current/include/hal_arch.h b/packages/hal/i386/arch/current/include/hal_arch.h --- a/packages/hal/i386/arch/current/include/hal_arch.h +++ b/packages/hal/i386/arch/current/include/hal_arch.h @@ -8,29 +8,38 @@ // Architecture specific abstractions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/arch/current/include/hal_cache.h b/packages/hal/i386/arch/current/include/hal_cache.h --- a/packages/hal/i386/arch/current/include/hal_cache.h +++ b/packages/hal/i386/arch/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/arch/current/include/hal_intr.h b/packages/hal/i386/arch/current/include/hal_intr.h --- a/packages/hal/i386/arch/current/include/hal_intr.h +++ b/packages/hal/i386/arch/current/include/hal_intr.h @@ -8,29 +8,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/arch/current/include/hal_io.h b/packages/hal/i386/arch/current/include/hal_io.h --- a/packages/hal/i386/arch/current/include/hal_io.h +++ b/packages/hal/i386/arch/current/include/hal_io.h @@ -8,29 +8,38 @@ // HAL device IO register support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/arch/current/include/hal_smp.h b/packages/hal/i386/arch/current/include/hal_smp.h new file mode 100644 --- /dev/null +++ b/packages/hal/i386/arch/current/include/hal_smp.h @@ -0,0 +1,294 @@ +#ifndef CYGONCE_HAL_SMP_H +#define CYGONCE_HAL_SMP_H + +//============================================================================= +// +// hal_smp.h +// +// SMP support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 2001-08-03 +// Purpose: Define SMP support abstractions +// Usage: #include + +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGPKG_HAL_SMP_SUPPORT + +#include + +#include + +//============================================================================= + +/*------------------------------------------------------------------------*/ +// APIC definitions + +#define HAL_APIC_ID 0x0020 +#define HAL_APIC_VER 0x0030 +#define HAL_APIC_TPR 0x0080 +#define HAL_APIC_EOI 0x00b0 +#define HAL_APIC_LDR 0x00d0 +#define HAL_APIC_DFR 0x00e0 +#define HAL_APIC_SPIV 0x00f0 + +#define HAL_APIC_ISR 0x0100 +#define HAL_APIC_TMR 0x0180 +#define HAL_APIC_IRR 0x0200 + +#define HAL_APIC_ICR_LO 0x0300 +#define HAL_APIC_ICR_HI 0x0310 + +#define HAL_APIC_LVT_TIMER 0x0320 +#define HAL_APIC_LVT_PC 0x0340 +#define HAL_APIC_LVT_INT0 0x0350 +#define HAL_APIC_LVT_INT1 0x0360 +#define HAL_APIC_LVT_ERROR 0x0370 +#define HAL_APIC_LVT_MASK 0x00010000 + +/*------------------------------------------------------------------------*/ +// APIC access macros + +#define HAL_APIC_READ( __addr, __val ) \ +{ \ + HAL_READMEM_UINT32(cyg_hal_smp_local_apic+(__addr), __val ); \ +} + +#define HAL_APIC_WRITE( __addr, __val ) \ +{ \ + HAL_WRITEMEM_UINT32(cyg_hal_smp_local_apic+(__addr), __val ); \ +} + +/*------------------------------------------------------------------------*/ +// I/O APIC definitions + +#define HAL_IOAPIC_REGSEL 0x0000 +#define HAL_IOAPIC_REGWIN 0x0010 + +#define HAL_IOAPIC_REG_APICID 0x0000 +#define HAL_IOAPIC_REG_APICVER 0x0001 +#define HAL_IOAPIC_REG_APICARB 0x0002 +#define HAL_IOAPIC_REG_REDTBL 0x0010 +#define HAL_IOAPIC_REG_REDIR_LO(n) (HAL_IOAPIC_REG_REDTBL+((n)*2)) +#define HAL_IOAPIC_REG_REDIR_HI(n) (HAL_IOAPIC_REG_REDTBL+((n)*2)+1) + +/*------------------------------------------------------------------------*/ +// I/O APIC access macros + +#define HAL_IOAPIC_READ( __reg, __val ) \ +{ \ + HAL_WRITEMEM_UINT32( cyg_hal_smp_io_apic+HAL_IOAPIC_REGSEL, __reg ); \ + HAL_READMEM_UINT32( cyg_hal_smp_io_apic+HAL_IOAPIC_REGWIN, __val ); \ +} + +#define HAL_IOAPIC_WRITE( __reg, __val ) \ +{ \ + HAL_WRITEMEM_UINT32( cyg_hal_smp_io_apic+HAL_IOAPIC_REGSEL, __reg ); \ + HAL_WRITEMEM_UINT32( cyg_hal_smp_io_apic+HAL_IOAPIC_REGWIN, __val ); \ +} + +//----------------------------------------------------------------------------- +// SMP configuration determined from platform during initialization + +__externC CYG_ADDRESS cyg_hal_smp_local_apic; + +__externC CYG_ADDRESS cyg_hal_smp_io_apic; + +__externC CYG_WORD32 cyg_hal_smp_cpu_count; + +__externC CYG_BYTE cyg_hal_smp_cpu_flags[CYGPKG_HAL_SMP_CPU_MAX]; + +__externC CYG_BYTE cyg_hal_isa_bus_id; +__externC CYG_BYTE cyg_hal_isa_bus_irq[16]; + +__externC CYG_BYTE cyg_hal_pci_bus_id; +__externC CYG_BYTE cyg_hal_pci_bus_irq[4]; + +//----------------------------------------------------------------------------- +// CPU numbering macros + +#define HAL_SMP_CPU_TYPE cyg_uint32 + +#define HAL_SMP_CPU_MAX CYGPKG_HAL_SMP_CPU_MAX + +#define HAL_SMP_CPU_COUNT() cyg_hal_smp_cpu_count + +#define HAL_SMP_CPU_THIS() \ +({ \ + HAL_SMP_CPU_TYPE __id; \ + HAL_APIC_READ( HAL_APIC_ID, __id ); \ + (__id>>24)&0xF; \ +}) + +#define HAL_SMP_CPU_NONE (CYGPKG_HAL_SMP_CPU_MAX+1) + +//----------------------------------------------------------------------------- +// CPU startup + +__externC void cyg_hal_cpu_release(HAL_SMP_CPU_TYPE cpu); + +#define HAL_SMP_CPU_START( __cpu ) cyg_hal_cpu_release( __cpu ); + +#define HAL_SMP_CPU_RESCHEDULE_INTERRUPT( __cpu, __wait ) \ + cyg_hal_cpu_message( __cpu, HAL_SMP_MESSAGE_RESCHEDULE, 0, __wait); + +#define HAL_SMP_CPU_TIMESLICE_INTERRUPT( __cpu, __wait ) \ + cyg_hal_cpu_message( __cpu, HAL_SMP_MESSAGE_TIMESLICE, 0, __wait); + +//----------------------------------------------------------------------------- +// CPU message exchange + +__externC void cyg_hal_cpu_message( HAL_SMP_CPU_TYPE cpu, + CYG_WORD32 msg, + CYG_WORD32 arg, + CYG_WORD32 wait); + +#define HAL_SMP_MESSAGE_TYPE 0xF0000000 +#define HAL_SMP_MESSAGE_ARG (~HAL_SMP_MESSAGE_TYPE) + +#define HAL_SMP_MESSAGE_RESCHEDULE 0x10000000 +#define HAL_SMP_MESSAGE_MASK 0x20000000 +#define HAL_SMP_MESSAGE_UNMASK 0x30000000 +#define HAL_SMP_MESSAGE_REVECTOR 0x40000000 +#define HAL_SMP_MESSAGE_TIMESLICE 0x50000000 + +//----------------------------------------------------------------------------- +// Test-and-set support +// These macros provide test-and-set support for the least significant bit +// in a word. + +#define HAL_TAS_TYPE volatile CYG_WORD32 + +#define HAL_TAS_SET( _tas_, _oldb_ ) \ +CYG_MACRO_START \ +{ \ + register CYG_WORD32 __old; \ + __asm__ volatile ( \ + "lock btsl $0,%1\n" \ + "sbbl %0,%0\n" \ + : "=r" (__old), "=m" (_tas_) \ + : \ + : "memory" \ + ); \ + _oldb_ = ( __old & 1 ) != 0; \ +} \ +CYG_MACRO_END + +#define HAL_TAS_CLEAR( _tas_, _oldb_ ) \ +CYG_MACRO_START \ +{ \ + register CYG_WORD32 __old; \ + __asm__ volatile ( \ + "lock btrl $0,%1\n" \ + "sbbl %0,%0\n" \ + : "=r" (__old), "=m" (_tas_) \ + : \ + : "memory" \ + ); \ + _oldb_ = ( __old & 1 ) != 0; \ +} \ +CYG_MACRO_END + +//----------------------------------------------------------------------------- +// Spinlock support. +// Built on top of test-and-set code. + +#define HAL_SPINLOCK_TYPE volatile CYG_WORD32 + +#define HAL_SPINLOCK_INIT_CLEAR 0 + +#define HAL_SPINLOCK_INIT_SET 1 + +#define HAL_SPINLOCK_SPIN( _lock_ ) \ +CYG_MACRO_START \ +{ \ + cyg_bool _val_; \ + do \ + { \ + HAL_TAS_SET( _lock_, _val_ ); \ + } while( _val_ ); \ +} \ +CYG_MACRO_END + +#define HAL_SPINLOCK_CLEAR( _lock_ ) \ +CYG_MACRO_START \ +{ \ + cyg_bool _val_; \ + HAL_TAS_CLEAR( _lock_ , _val_ ); \ +} \ +CYG_MACRO_END + +#define HAL_SPINLOCK_TRY( _lock_, _val_ ) \ + HAL_TAS_SET( _lock_, _val_ ); \ + (_val_) = (((_val_) & 1) == 0) + +#define HAL_SPINLOCK_TEST( _lock_, _val_ ) \ + (_val_) = (((_lock_) & 1) != 0) + +//----------------------------------------------------------------------------- +// Diagnostic output serialization + +__externC HAL_SPINLOCK_TYPE cyg_hal_smp_diag_lock; + +#define CYG_HAL_DIAG_LOCK_DATA_DEFN \ + HAL_SPINLOCK_TYPE cyg_hal_smp_diag_lock = HAL_SPINLOCK_INIT_CLEAR + +#define CYG_HAL_DIAG_LOCK() HAL_SPINLOCK_SPIN( cyg_hal_smp_diag_lock ) + +#define CYG_HAL_DIAG_UNLOCK() HAL_SPINLOCK_CLEAR( cyg_hal_smp_diag_lock ) + +//----------------------------------------------------------------------------- +// Some extra definitions + +__externC HAL_SPINLOCK_TYPE cyg_hal_ioapic_lock; + +//----------------------------------------------------------------------------- + +#endif // CYGPKG_HAL_SMP_SUPPORT + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_SMP_H +// End of hal_smp.h diff --git a/packages/hal/i386/arch/current/include/i386.inc b/packages/hal/i386/arch/current/include/i386.inc --- a/packages/hal/i386/arch/current/include/i386.inc +++ b/packages/hal/i386/arch/current/include/i386.inc @@ -5,29 +5,38 @@ ## i386 assembler header file ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/i386/arch/current/include/i386_stub.h b/packages/hal/i386/arch/current/include/i386_stub.h --- a/packages/hal/i386/arch/current/include/i386_stub.h +++ b/packages/hal/i386/arch/current/include/i386_stub.h @@ -7,29 +7,38 @@ // i386/PC GDB stub support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/arch/current/src/context.S b/packages/hal/i386/arch/current/src/context.S --- a/packages/hal/i386/arch/current/src/context.S +++ b/packages/hal/i386/arch/current/src/context.S @@ -5,29 +5,38 @@ ## i386 context switch code ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/i386/arch/current/src/hal_misc.c b/packages/hal/i386/arch/current/src/hal_misc.c --- a/packages/hal/i386/arch/current/src/hal_misc.c +++ b/packages/hal/i386/arch/current/src/hal_misc.c @@ -5,29 +5,38 @@ // HAL miscellaneous functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/arch/current/src/hal_syscall.c b/packages/hal/i386/arch/current/src/hal_syscall.c --- a/packages/hal/i386/arch/current/src/hal_syscall.c +++ b/packages/hal/i386/arch/current/src/hal_syscall.c @@ -5,29 +5,38 @@ // // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -62,7 +71,8 @@ extern CYG_ADDRWORD __do_syscall(CYG_ADDRWORD func, // syscall function number CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, // up to four args. CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, - CYG_ADDRWORD *retval); // syscall return value + CYG_ADDRWORD *retval, // syscall return value + CYG_ADDRWORD *sig); // signal to return (or 0) // These are required by the ANSI C part of newlib (excluding system() of @@ -98,7 +108,7 @@ int hal_syscall_handler(void) { CYG_ADDRWORD func, arg1, arg2, arg3, arg4; - CYG_ADDRWORD err; + CYG_ADDRWORD err, sig; func = get_register(EAX); arg1 = get_register(EBX); @@ -141,9 +151,9 @@ hal_syscall_handler(void) return SIGTRAP; } - if (__do_syscall(func, arg1, arg2, arg3, arg4, &err)) { + if (__do_syscall(func, arg1, arg2, arg3, arg4, &err, &sig)) { put_register(EAX, err); - return 0; + return (int)sig; } return SIGTRAP; diff --git a/packages/hal/i386/arch/current/src/i386.ld b/packages/hal/i386/arch/current/src/i386.ld --- a/packages/hal/i386/arch/current/src/i386.ld +++ b/packages/hal/i386/arch/current/src/i386.ld @@ -5,29 +5,38 @@ // Linker script for i386 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -148,6 +157,11 @@ GROUP(libtarget.a libgcc.a) idtStart = 0x00001000; hal_vsr_table = 0x00001800; hal_virtual_vector_table = 0x00001c00; +cyg_hal_smp_cpu_sync = 0x00002800; +cyg_hal_smp_cpu_sync_flag = 0x00002900; +cyg_hal_smp_cpu_entry = 0x00002a00; +cyg_hal_smp_cpu_running = 0x00002b00; +cyg_hal_smp_vsr_sync_flag = 0x00002c00; diff --git a/packages/hal/i386/arch/current/src/vectors.S b/packages/hal/i386/arch/current/src/vectors.S --- a/packages/hal/i386/arch/current/src/vectors.S +++ b/packages/hal/i386/arch/current/src/vectors.S @@ -5,29 +5,38 @@ ## x86 exception vectors ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## @@ -57,7 +66,7 @@ #============================================================================== - .file "vectors.S" +// .file "vectors.S" #============================================================================== # Real startup code. We jump here from the various reset vectors to set up the @@ -77,6 +86,8 @@ hal_timer_init # Loading the stack pointer seems appropriate now. + # In SMP systems, this may not be the interrupt stack we + # actually need to use for this CPU. We fix that up later. movl $__interrupt_stack, %esp @@ -134,6 +145,22 @@ .extern cyg_hal_invoke_constructors call cyg_hal_invoke_constructors +#ifdef CYGPKG_HAL_SMP_SUPPORT + + # Now move SP to actual interrupt stack we will use for this + # processor. + hal_init_istack %esp + +#ifndef CYG_HAL_STARTUP_RAM + # Only start other CPUs when we are the original boot executable. + # RAM executables are loaded via RedBoot, so only FLOPPY and ROM + # startups count here. + + .extern cyg_hal_smp_cpu_start_all + call cyg_hal_smp_cpu_start_all +#endif + +#endif .extern cyg_start call cyg_start @@ -142,6 +169,147 @@ 1: hlt jmp 1b +##----------------------------------------------------------------------------- +## SMP entry point + +#if defined(CYGPKG_HAL_SMP_SUPPORT) + .extern cyg_hal_smp_startup + .global cyg_hal_smp_start +cyg_hal_smp_start: + + # Finalize CPU init? + # Interrupts? + +# hal_cpu_init +# hal_intc_init + + hal_init_istack %esp + + # Init flags register + pushl $0 + popfl + + hal_fpu_cpu_init + + call cyg_hal_smp_startup +1: + jmp 1b + +#ifdef CYG_HAL_STARTUP_RAM + .align 4, 0xFF +gdtStart: + /* Selector 0x00 == invalid. */ + .word 0x0000 + .word 0x0000 + .byte 0x00 + .byte 0x00 + .byte 0x00 + .byte 0x00 + + /* Selector 0x08 == code. */ + .word 0xFFFF + .word 0x0000 + .byte 0x00 + .byte 0x9B + .byte 0xCF + .byte 0x00 + + /* Selector 0x10 == data. */ + .word 0xFFFF + .word 0x0000 + .byte 0x00 + .byte 0x93 + .byte 0xCF + .byte 0x00 + + /* Selector 0x18 == shorter code: faults any code + * access 0xF0000000-0xFFFFFFFF. + */ + .word 0xFFFF + .word 0x0000 + .byte 0x00 + .byte 0x9B + .byte 0xC7 + .byte 0x00 + + /* Selector 0x20 == data; faults any access 0xF0000000-0xFFFFFFFF. */ + .word 0xFFFF + .word 0x0000 + .byte 0x00 + .byte 0x93 + .byte 0xC7 + .byte 0x00 + + .align 4, 0xFF +gdtEnd: +#endif // CYG_HAL_STARTUP_RAM + +##----------------------------------------------------------------------------- +## Slave processor startup code +## This code is copied into low RAM, at 0x2000 and is the destination of the +## startup interrupt that is sent to get the slaves running. + + .data + .code16 + + .global cyg_hal_slave_trampoline + .global cyg_hal_slave_trampoline_end +cyg_hal_slave_trampoline: +slave_base = . + cld /* always count up. */ + cli /* disable interrupts */ + + # Load up selector registers + # Set DS == CS + movw %cs,%ax + movw %ax,%ds + + # load GDTR + lgdt slave_gdt - slave_base + lidt slave_idt - slave_base + + /* Switch to protected mode. */ + movl %cr0,%eax + orb $1, %al + movl %eax,%cr0 + ljmp $8, $3f-slave_base+0x2000 + + hlt + + .align 4, 0xFF +slave_gdt: + .word gdtEnd - gdtStart +# .word 39 + .long gdtStart + + .align 4, 0xFF +slave_idt: + .extern idtStart + .word 0x07FF # space for 256 entries + .long idtStart + + .code32 + +3: + + # Load up selector registers + movw $0x10, %ax + movw %ax, %ds + movw %ax, %ss + movw %ax, %es + movw %ax, %fs + movw %ax, %gs + + # Go to real HAL entry point + movl $cyg_hal_smp_start,%eax + jmp *%eax + +cyg_hal_slave_trampoline_end: + + .text + +#endif // defined(CYGPKG_HAL_SMP_SUPPORT) + #============================================================================== # Default exception VSR @@ -198,6 +366,45 @@ 2: # adjust ESP by 16 for the state stored before the pusha add $16,i386reg_esp(%edi) +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) && defined(CYGPKG_HAL_SMP_SUPPORT) + + .extern cyg_hal_smp_cpu_sync + .extern cyg_hal_smp_cpu_sync_flag + .extern cyg_hal_smp_vsr_sync_flag + + # An SMP ROM monitor needs to suspend all other CPUs when + # taking an exception. + +1: + lock btsl $0,cyg_hal_smp_vsr_sync_flag # test serialization bit + jnc 9f # if it was zero we are first here + + # Some other CPU is already handling an exception. We need to spin until + # released. + + hal_smp_cpu %eax # get CPU index + movl $cyg_hal_smp_cpu_sync,%ebx + movl $cyg_hal_smp_cpu_sync_flag,%ecx + lock incl 0(%ecx,%eax,4) # inc cpu sync flag +2: + cmpl $0,0(%ebx,%eax,4) # test sync location + je 2b # loop while value is zero + + lock decl 0(%ecx,%eax,4) # dec cpu sync flag + + # Jump to return from this VSR. If the exception was genuine, + # we will re-execute the cause and come back here. If it was + # just a duplicate, or a halt NMI, we will continue as if + # nothing had happened. + + jmp __default_exception_vsr_return + +9: + # Stop all other CPUs + .extern cyg_hal_smp_halt_other_cpus + call cyg_hal_smp_halt_other_cpus + +#endif hal_fpu_push_exc_annex @@ -209,6 +416,16 @@ 2: hal_fpu_pop_exc_annex +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) && defined(CYGPKG_HAL_SMP_SUPPORT) + + .extern cyg_hal_smp_release_other_cpus + call cyg_hal_smp_release_other_cpus + + lock btrl $0,cyg_hal_smp_vsr_sync_flag # clear serialization bit + +__default_exception_vsr_return: + +#endif hal_fpu_pop_exc # restore FPU state @@ -649,6 +866,33 @@ hal_pc_irq_\idx: hal_pc_irq_handler 45 hal_pc_irq_handler 46 hal_pc_irq_handler 47 +#ifdef CYGPKG_HAL_SMP_SUPPORT + + # Extra interrupt vectors for IOAPIc routed PCI and + # other interrupt sources + hal_pc_irq_handler 48 + hal_pc_irq_handler 49 + hal_pc_irq_handler 50 + hal_pc_irq_handler 51 + hal_pc_irq_handler 52 + hal_pc_irq_handler 53 + hal_pc_irq_handler 54 + hal_pc_irq_handler 55 + hal_pc_irq_handler 56 + hal_pc_irq_handler 57 + hal_pc_irq_handler 58 + hal_pc_irq_handler 59 + hal_pc_irq_handler 60 + hal_pc_irq_handler 61 + hal_pc_irq_handler 62 + hal_pc_irq_handler 63 + + # Inter-CPU interrupts start at 64 + hal_pc_irq_handler 64 + hal_pc_irq_handler 65 + hal_pc_irq_handler 66 + hal_pc_irq_handler 67 +#endif # default vsr entries: pop the vector code from the stack and return. @@ -667,10 +911,11 @@ default_vsr_iret: # Initial and interrupt stack #ifndef CYG_HAL_I386_INTERRUPT_STACK_DEFINED - + .bss - +#ifndef CYGPKG_HAL_SMP_SUPPORT + .balign 16 .global cyg_interrupt_stack_base cyg_interrupt_stack_base: @@ -684,7 +929,30 @@ cyg_interrupt_stack: __interrupt_stack: .long 0,0,0,0,0,0,0,0 -#endif + +#else // CYGPKG_HAL_SMP_SUPPORT + +__interrupt_stack_vector: + .rept CYGPKG_HAL_SMP_CPU_MAX + .long 0 + .endr + + .balign 16 + .global cyg_interrupt_stack_base +cyg_interrupt_stack_base: +__interrupt_stack_base: +__interrupt_stack_first: + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE + .byte 0 + .endr + .global cyg_interrupt_stack +cyg_interrupt_stack: +__interrupt_stack: + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE*(CYGPKG_HAL_SMP_CPU_MAX-1) + .byte 0 + .endr + +#endif // CYGPKG_HAL_SMP_SUPPORT #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS .global __stub_stack_base @@ -697,9 +965,10 @@ cyg_interrupt_stack: __stub_stack: .long 0,0,0,0,0,0,0,0 -#endif +#endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS - + +#endif // CYG_HAL_I386_INTERRUPT_STACK_DEFINED #------------------------------------------------------------------------------ # end of vectors.S diff --git a/packages/hal/i386/generic/current/ChangeLog b/packages/hal/i386/generic/current/ChangeLog --- a/packages/hal/i386/generic/current/ChangeLog +++ b/packages/hal/i386/generic/current/ChangeLog @@ -12,29 +12,38 @@ 2001-03-08 Nick Garnett + + * cdl/hal_i386_pc.cdl: + Standardize CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT usage. + +2002-04-29 Jonathan Larmour + + * src/romboot.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-23 Jonathan Larmour + + * cdl/hal_i386_pc.cdl: Remove unused compile line. + 2001-12-07 Nick Garnett * include/plf_intr.h: Added definition of HAL_DELAY_US() so that this is used instead of the delay loop in delay_us(). This is necessary to handle fast Pentiums and Athlons. + * misc/redboot_FLOPPY_D850GB.ecm: Removed reference to SMP. + 2001-10-16 Mark Salter * misc/redboot_FLOPPY_D850GB.ecm: New file. RedBoot config for @@ -51,6 +69,7 @@ 2001-09-07 Jonathan Larmour @@ -62,6 +81,18 @@ 2001-08-22 Nick Garnett + + * src/pcmb_misc.c (hal_pcmb_init): Disable NMI at this point since + no real handlers are in place to handle it. This fixes a problem + with manual reset code for IDE drivers which can cause NMI. + +2002-04-26 Bart Veer + + * support/gfxmode.c: + A utility to find out what graphics modes are available on any + given PC. + + * include/pcmb.inc: + Change the graphics mode during RedBoot startup, when configured + to do so. + + * cdl/hal_i386_pcmb.cdl: + Add new configuration option for changing the graphics mode + during RedBoot startup. + 2001-12-06 Nick Garnett * include/pcmb_serial.h: @@ -64,6 +84,23 @@ 2001-08-22 Nick Garnett @@ -145,27 +182,36 @@ 2001-03-08 Nick Garnett #include +#include //-------------------------------------------------------------------------- // Interrupt vectors. @@ -101,6 +111,11 @@ #define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_TIMER +#ifdef CYGPKG_HAL_SMP_SUPPORT + +#define CYGNUM_HAL_SMP_CPU_INTERRUPT_VECTOR( _n_ ) (64+(_n_)) + +#endif //-------------------------------------------------------------------------- // Interrupt vector translation @@ -112,6 +127,7 @@ //-------------------------------------------------------------------------- // PIC interrupt acknowledge +#ifndef CYGPKG_HAL_SMP_SUPPORT #define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \ CYG_MACRO_START \ @@ -123,10 +139,19 @@ CYG_MACRO_START HAL_WRITE_UINT8( 0x20, 0x20 ); \ CYG_MACRO_END +#else + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \ +{ \ + HAL_APIC_WRITE( HAL_APIC_EOI, 0 ); \ +} + +#endif //-------------------------------------------------------------------------- // PIC per-interrupt source masking +#ifndef CYGPKG_HAL_SMP_SUPPORT #define HAL_INTERRUPT_MASK( _vector_ ) \ CYG_MACRO_START \ @@ -188,6 +213,34 @@ CYG_MACRO_START } \ CYG_MACRO_END +#else + +#define HAL_INTERRUPT_MASK( _vector_ ) \ +{ \ + cyg_uint32 __vec, __val; \ + HAL_TRANSLATE_VECTOR( _vector_, __vec ); \ + HAL_SPINLOCK_SPIN( cyg_hal_ioapic_lock ); \ + __vec = cyg_hal_isa_bus_irq[__vec]; \ + HAL_IOAPIC_READ( HAL_IOAPIC_REG_REDIR_LO(__vec), __val ); \ + __val |= 0x00010000; \ + HAL_IOAPIC_WRITE( HAL_IOAPIC_REG_REDIR_LO(__vec), __val ); \ + HAL_SPINLOCK_CLEAR( cyg_hal_ioapic_lock ); \ +} + +#define HAL_INTERRUPT_UNMASK( _vector_ ) \ +{ \ + cyg_uint32 __vec, __val; \ + HAL_TRANSLATE_VECTOR( _vector_, __vec ); \ + HAL_SPINLOCK_SPIN( cyg_hal_ioapic_lock ); \ + __vec = cyg_hal_isa_bus_irq[__vec]; \ + HAL_IOAPIC_READ( HAL_IOAPIC_REG_REDIR_LO(__vec), __val ); \ + __val &= ~0x00010000; \ + HAL_IOAPIC_WRITE( HAL_IOAPIC_REG_REDIR_LO(__vec), __val ); \ + HAL_SPINLOCK_CLEAR( cyg_hal_ioapic_lock ); \ +} + + +#endif //-------------------------------------------------------------------------- // PIC interrupt configuration @@ -197,6 +250,40 @@ CYG_MACRO_END #define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) +#ifdef CYGPKG_HAL_SMP_SUPPORT + +// Additional SMP interrupt configuration support. + +__externC void hal_interrupt_set_cpu( CYG_WORD32 vector, HAL_SMP_CPU_TYPE cpu ); +__externC void hal_interrupt_get_cpu( CYG_WORD32 vector, HAL_SMP_CPU_TYPE *cpu ); + +#define HAL_INTERRUPT_SET_CPU( _vector_, _cpu_ ) \ +{ \ + cyg_uint32 __vec, __val; \ + HAL_TRANSLATE_VECTOR( _vector_, __vec ); \ + HAL_SPINLOCK_SPIN( cyg_hal_ioapic_lock ); \ + __vec = cyg_hal_isa_bus_irq[__vec]; \ + HAL_IOAPIC_READ( HAL_IOAPIC_REG_REDIR_HI(__vec), __val ); \ + __val &= 0x00FFFFFF; \ + __val |= (_cpu_)<<24; \ + HAL_IOAPIC_WRITE( HAL_IOAPIC_REG_REDIR_HI(__vec), __val ); \ + HAL_SPINLOCK_CLEAR( cyg_hal_ioapic_lock ); \ +} + + +#define HAL_INTERRUPT_GET_CPU( _vector_, _cpu_ ) \ +{ \ + cyg_uint32 __vec, __val; \ + HAL_TRANSLATE_VECTOR( _vector_, __vec ); \ + HAL_SPINLOCK_SPIN( cyg_hal_ioapic_lock ); \ + __vec = cyg_hal_isa_bus_irq[__vec]; \ + HAL_IOAPIC_READ( HAL_IOAPIC_REG_REDIR_HI(__vec), __val ); \ + (_cpu_) = (__val>>24) & 0xFF; \ + HAL_SPINLOCK_CLEAR( cyg_hal_ioapic_lock ); \ +} + + +#endif //--------------------------------------------------------------------------- // Clock support. diff --git a/packages/hal/i386/pcmb/current/include/pcmb_io.h b/packages/hal/i386/pcmb/current/include/pcmb_io.h --- a/packages/hal/i386/pcmb/current/include/pcmb_io.h +++ b/packages/hal/i386/pcmb/current/include/pcmb_io.h @@ -8,29 +8,38 @@ // PC Motherboard specific IO support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/pcmb/current/include/pcmb_serial.h b/packages/hal/i386/pcmb/current/include/pcmb_serial.h --- a/packages/hal/i386/pcmb/current/include/pcmb_serial.h +++ b/packages/hal/i386/pcmb/current/include/pcmb_serial.h @@ -8,29 +8,38 @@ // i386/pc Motherboard serial device support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/pcmb/current/src/pcmb_misc.c b/packages/hal/i386/pcmb/current/src/pcmb_misc.c --- a/packages/hal/i386/pcmb/current/src/pcmb_misc.c +++ b/packages/hal/i386/pcmb/current/src/pcmb_misc.c @@ -5,29 +5,38 @@ // HAL implementation miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -52,6 +61,7 @@ #include #include +#include /*------------------------------------------------------------------------*/ // Array which stores the configured priority levels for the configured @@ -96,6 +106,10 @@ void hal_pcmb_init(void) cyg_hal_pcmb_memsize_extended = ((hi<<8)+lo)*1024; #endif + + // Disable NMI - this can be reenabled later, once a proper handler + // is registered and ready to handle events + HAL_WRITE_UINT8(0x70, 0x80); } /*------------------------------------------------------------------------*/ @@ -116,8 +130,12 @@ cyg_uint8 *hal_i386_mem_real_region_top( /*------------------------------------------------------------------------*/ // Clock initialization and access +#ifdef CYGPKG_HAL_SMP_SUPPORT +static HAL_SPINLOCK_TYPE pc_clock_lock; +#else #define HAL_SPINLOCK_SPIN( lock ) #define HAL_SPINLOCK_CLEAR( lock ) +#endif void hal_pc_clock_initialize(cyg_uint32 period) { @@ -162,8 +180,52 @@ void hal_pc_clock_read(cyg_uint32 * coun void hal_idle_thread_action(cyg_uint32 loop_count) { +#if 1 //ndef CYGPKG_HAL_SMP_SUPPORT asm("hlt") ; +#else + + CYG_WORD32 val; + CYG_WORD32 cpu = 0; +#ifdef CYGPKG_HAL_SMP_SUPPORT + cpu = HAL_SMP_CPU_THIS(); + + { + __externC HAL_SPINLOCK_TYPE cyg_hal_ioapic_lock; + + HAL_SPINLOCK_SPIN( cyg_hal_ioapic_lock ); + HAL_IOAPIC_READ( HAL_IOAPIC_REG_REDTBL+4, val ); + PC_WRITE_SCREEN_32( PC_SCREEN_LINE(15)+10, val ); + + HAL_IOAPIC_READ( HAL_IOAPIC_REG_REDTBL+5, val ); + PC_WRITE_SCREEN_32( PC_SCREEN_LINE(15), val ); + + HAL_SPINLOCK_CLEAR( cyg_hal_ioapic_lock ); + + } +#endif + + hal_pc_clock_read( &val); + PC_WRITE_SCREEN_32( PC_SCREEN_LINE(15)+20, val ); + + +#ifdef CYGPKG_HAL_SMP_SUPPORT + + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(16+cpu), cpu); + + HAL_APIC_READ( HAL_APIC_IRR, val ); + PC_WRITE_SCREEN_32( PC_SCREEN_LINE(16+cpu)+10, val ); + HAL_APIC_READ( HAL_APIC_IRR+1, val ); + PC_WRITE_SCREEN_32( PC_SCREEN_LINE(16+cpu)+20, val ); + HAL_APIC_READ( HAL_APIC_IRR+2, val ); + PC_WRITE_SCREEN_32( PC_SCREEN_LINE(16+cpu)+30, val ); +#endif + + HAL_QUERY_INTERRUPTS( val ); + PC_WRITE_SCREEN_32( PC_SCREEN_LINE(16+cpu)+50, val ); + PC_WRITE_SCREEN_32( PC_SCREEN_LINE(16+cpu)+60, loop_count ); + +#endif } /*------------------------------------------------------------------------*/ diff --git a/packages/hal/i386/pcmb/current/src/pcmb_screen.c b/packages/hal/i386/pcmb/current/src/pcmb_screen.c --- a/packages/hal/i386/pcmb/current/src/pcmb_screen.c +++ b/packages/hal/i386/pcmb/current/src/pcmb_screen.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/pcmb/current/src/pcmb_serial.c b/packages/hal/i386/pcmb/current/src/pcmb_serial.c --- a/packages/hal/i386/pcmb/current/src/pcmb_serial.c +++ b/packages/hal/i386/pcmb/current/src/pcmb_serial.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/i386/pcmb/current/src/pcmb_smp.c b/packages/hal/i386/pcmb/current/src/pcmb_smp.c new file mode 100644 --- /dev/null +++ b/packages/hal/i386/pcmb/current/src/pcmb_smp.c @@ -0,0 +1,1340 @@ +//========================================================================== +// +// pcmb_smp.c +// +// HAL SMP implementation +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg +// Date: 2001-08-03 +// Purpose: HAL SMP implementation +// Description: This file contains SMP support functions. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include +#include + +#ifdef CYGPKG_HAL_SMP_SUPPORT + +#ifdef CYGPKG_KERNEL +#include +#endif + +#include // Base types +#include // tracing macros +#include // assertion macros +#include + +#include +#include +#include + +// ------------------------------------------------------------------------ +// Debugging/diagnostic controls + +// Setting this to 1 causes the parsing of the MP structures and the +// initialization of the APIC and IOAPIC to be reported on the +// diagnostic channel. +#define SHOW_DIAGNOSTICS 0 + +// Setting this to 1 causes various things to be displayed on the PC +// screen during normal operation. These are mostly for my own use, +// and may be somewhat obscure to anyone else. +#define SCREEN_DIAGNOSTICS 0 + +#if SCREEN_DIAGNOSTICS==0 +#undef PC_WRITE_SCREEN +#undef PC_WRITE_SCREEN_8 +#undef PC_WRITE_SCREEN_16 +#undef PC_WRITE_SCREEN_32 +#define PC_WRITE_SCREEN( pos, ch ) +#define PC_WRITE_SCREEN_8( pos, val ) +#define PC_WRITE_SCREEN_16( pos, val ) +#define PC_WRITE_SCREEN_32( pos, val ) +#endif + +// ------------------------------------------------------------------------ + +static int streq( const char *s1, const char *s2 ) +{ + while( *s1 == *s2 && *s1 && *s2 ) s1++,s2++; + + return !(*s2-*s1); +} + +/*------------------------------------------------------------------------*/ +// MP FPS structure: + +#define MP_FPS_SIGNATURE 0 +#define MP_FPS_MPCT 4 +#define MP_FPS_LENGTH 8 +#define MP_FPS_REV 9 +#define MP_FPS_CSUM 10 +#define MP_FPS_FEATURE1 11 +#define MP_FPS_FEATURE2 12 +#define MP_FPS_FEATURE3 13 +#define MP_FPS_FEATURE4 14 +#define MP_FPS_FEATURE5 15 +#define MP_FPS_SIZE 16 + +#define MP_FPS_SIGNATURE_VALUE 0x5f504d5f + +/*------------------------------------------------------------------------*/ +// MP config table structure + +// Header structure: + +#define MPCT_HDR_SIGNATURE 0 +#define MPCT_HDR_LENGTH 4 +#define MPCT_HDR_REV 6 +#define MPCT_HDR_CHECKSUM 7 +#define MPCT_HDR_OEM_ID 8 +#define MPCT_HDR_PROD_ID 16 +#define MPCT_HDR_OEM_TAB 28 +#define MPCT_HDR_OEM_TAB_SIZE 32 +#define MPCT_HDR_ENTRY_COUNT 34 +#define MPCT_HDR_LOCAL_APIC 36 +#define MPCT_HDR_XTAB_LENGTH 40 +#define MPCT_HDR_XTAB_CHECKSUM 42 +#define MPCT_HDR_SIZE 44 + +#define MPCT_HDR_SIGNATURE_VAL 0x504d4350 + +#define MPCT_ENTRY_TYPE_PROCESSOR 0 +#define MPCT_ENTRY_TYPE_BUS 1 +#define MPCT_ENTRY_TYPE_IOAPIC 2 +#define MPCT_ENTRY_TYPE_INTERRUPT_IO 3 +#define MPCT_ENTRY_TYPE_INTERRUPT_LOCAL 4 + +#define MPCT_ENTRY_PROC_TYPE 0 +#define MPCT_ENTRY_PROC_APIC_ID 1 +#define MPCT_ENTRY_PROC_APIC_VER 2 +#define MPCT_ENTRY_PROC_CPU_FLAGS 3 +#define MPCT_ENTRY_PROC_CPU_SIGNATURE 4 +#define MPCT_ENTRY_PROC_FEATURE_FLAGS 8 +#define MPCT_ENTRY_PROC_RESERVED0 12 +#define MPCT_ENTRY_PROC_RESERVED1 16 +#define MPCT_ENTRY_PROC_SIZE 20 + +#define MPCT_ENTRY_BUS_TYPE 0 +#define MPCT_ENTRY_BUS_ID 1 +#define MPCT_ENTRY_BUS_TYPE_STRING 2 +#define MPCT_ENTRY_BUS_SIZE 8 + +#define MPCT_ENTRY_IOAPIC_TYPE 0 +#define MPCT_ENTRY_IOAPIC_ID 1 +#define MPCT_ENTRY_IOAPIC_VER 2 +#define MPCT_ENTRY_IOAPIC_FLAGS 3 +#define MPCT_ENTRY_IOAPIC_ADDRESS 4 +#define MPCT_ENTRY_IOAPIC_SIZE 8 + +#define MPCT_ENTRY_IOINT_TYPE 0 +#define MPCT_ENTRY_IOINT_INT_TYPE 1 +#define MPCT_ENTRY_IOINT_FLAGS 2 +#define MPCT_ENTRY_IOINT_SOURCE_BUS 4 +#define MPCT_ENTRY_IOINT_SOURCE_IRQ 5 +#define MPCT_ENTRY_IOINT_DEST_APIC 6 +#define MPCT_ENTRY_IOINT_DEST_INT 7 +#define MPCT_ENTRY_IOINT_SIZE 8 + +#define MPCT_ENTRY_LOCINT_TYPE 0 +#define MPCT_ENTRY_LOCINT_INT_TYPE 1 +#define MPCT_ENTRY_LOCINT_FLAGS 2 +#define MPCT_ENTRY_LOCINT_SOURCE_BUS 4 +#define MPCT_ENTRY_LOCINT_SOURCE_IRQ 5 +#define MPCT_ENTRY_LOCINT_DEST_APIC 6 +#define MPCT_ENTRY_LOCINT_DEST_INT 7 +#define MPCT_ENTRY_LOCINT_SIZE 8 + +/*------------------------------------------------------------------------*/ +// Exported SMP configuration + +CYG_ADDRESS cyg_hal_smp_local_apic; + +CYG_ADDRESS cyg_hal_smp_io_apic; + +CYG_WORD32 cyg_hal_smp_cpu_count = 0; + +CYG_BYTE cyg_hal_smp_cpu_flags[HAL_SMP_CPU_MAX]; + +CYG_BYTE cyg_hal_isa_bus_id = 0xff; +CYG_BYTE cyg_hal_isa_bus_irq[16]; + +CYG_BYTE cyg_hal_pci_bus_id = 0xff; +CYG_BYTE cyg_hal_pci_bus_irq[4]; + +HAL_SPINLOCK_TYPE cyg_hal_ioapic_lock; + +/*------------------------------------------------------------------------*/ + +// Statics + +static CYG_ADDRESS mp_fps; +static CYG_ADDRESS mpct; + + +/*------------------------------------------------------------------------*/ + +static CYG_WORD32 mp_checksum(CYG_BYTE *p, CYG_WORD32 len) +{ + CYG_WORD32 sum = 0; + + while (len--) sum += *p++; + + return sum & 0xFF; +} + +/*------------------------------------------------------------------------*/ + +static cyg_bool cyg_hal_scan_smp_config( CYG_ADDRESS base, CYG_ADDRWORD size ) +{ + +#if SHOW_DIAGNOSTICS + diag_printf("Scan for MP struct: %08x..%08x\n",base,base+size); +#endif + + while( size > 0 ) + { + CYG_WORD32 sig; + + HAL_READMEM_UINT32( base, sig ); + + if( sig == MP_FPS_SIGNATURE_VALUE ) + { + CYG_BYTE val8; + // We have a candidate for the floating structure + +#if SHOW_DIAGNOSTICS + diag_printf("MP_FPS candidate found at %08x\n",base); +#endif + + HAL_READMEM_UINT8( base+MP_FPS_LENGTH, val8 ); + + if( val8 != 1 ) + break; + + HAL_READMEM_UINT8( base+MP_FPS_REV, val8 ); + + if( val8 != 1 && val8 != 4 ) + break; + + if( mp_checksum( (CYG_BYTE *)base, MP_FPS_SIZE ) != 0 ) + break; + + mp_fps = base; + + HAL_READMEM_UINT32( base+MP_FPS_MPCT, mpct ); + +#if SHOW_DIAGNOSTICS + diag_printf("MPCT at %08x\n",mpct); +#endif + return 1; + } + + base += 16; + size -= 16; + } + + return 0; +} + +/*------------------------------------------------------------------------*/ + +static cyg_bool cyg_hal_find_smp_config( void ) +{ + // check bottom 1k + if( cyg_hal_scan_smp_config(0x00000, 0x00400 ) ) + return 1; + + // check top 1k of RAM + if( cyg_hal_scan_smp_config(0x9fc00, 0x00400 ) ) + return 1; + + // check BIOS ROM + if( cyg_hal_scan_smp_config(0xf0000, 0x10000 ) ) + return 1; +} + +/*------------------------------------------------------------------------*/ + +static cyg_bool cyg_hal_parse_smp_config( void ) +{ + CYG_WORD32 val32; + CYG_WORD16 val16; + CYG_BYTE val8; + int i; + +#if SHOW_DIAGNOSTICS + + { + + diag_printf("FPS address: %08x\n",mp_fps); + HAL_READMEM_UINT32( mp_fps+MP_FPS_SIGNATURE, val32); + diag_printf("FPS signature: %08x\n",val32); + HAL_READMEM_UINT32( mp_fps+MP_FPS_MPCT, val32); + diag_printf("FPS MPCT address: %08x\n",val32); + HAL_READMEM_UINT8( mp_fps+MP_FPS_LENGTH, val8); + diag_printf("FPS length: %02x\n",val8); + HAL_READMEM_UINT8( mp_fps+MP_FPS_REV, val8); + diag_printf("FPS spec rev: %02x\n",val8); + HAL_READMEM_UINT8( mp_fps+MP_FPS_CSUM, val8); + diag_printf("FPS checksum: %02x\n",val8); + + for( i = 0; i < 5; i++ ) + { + HAL_READMEM_UINT8( mp_fps+MP_FPS_FEATURE1, val8); + diag_printf("FPS feature byte %d: %02x\n",i,val8); + } + } + +#endif + + if( mpct ) + { + + HAL_READMEM_UINT32( mpct+MPCT_HDR_SIGNATURE, val32); + + if( val32 != MPCT_HDR_SIGNATURE_VAL ) + return 0; + + HAL_READMEM_UINT16( mpct+MPCT_HDR_LENGTH, val16); + if( mp_checksum( (CYG_BYTE *)mpct, val16 ) != 0 ) + return 0; + +#if SHOW_DIAGNOSTICS + { + char id[13]; + + diag_printf("MPCT address: %08x\n",mpct); + HAL_READMEM_UINT32( mpct+MPCT_HDR_SIGNATURE, val32); + diag_printf("MPCT signature: %08x\n",val32); + + HAL_READMEM_UINT16( mpct+MPCT_HDR_LENGTH, val16); + diag_printf("MPCT length: %04x\n",val16); + HAL_READMEM_UINT8( mpct+MPCT_HDR_REV, val8); + diag_printf("MPCT spec rev: %02x\n",val8); + HAL_READMEM_UINT8( mpct+MPCT_HDR_CHECKSUM, val8); + diag_printf("MPCT checksum: %02x\n",val8); + + for( i = 0; i < 8; i++ ) + { + HAL_READMEM_UINT8( mpct+MPCT_HDR_OEM_ID+i, val8); + id[i] = val8; + } + id[i] = 0; + diag_printf("MPCT OEM Id: %s\n",id); + + for( i = 0; i < 12; i++ ) + { + HAL_READMEM_UINT8( mpct+MPCT_HDR_PROD_ID+i, val8); + id[i] = val8; + } + id[i] = 0; + diag_printf("MPCT Product Id: %s\n",id); + + HAL_READMEM_UINT32( mpct+MPCT_HDR_OEM_TAB, val32); + diag_printf("MPCT OEM table: %08x\n",val32); + HAL_READMEM_UINT16( mpct+MPCT_HDR_OEM_TAB_SIZE, val16); + diag_printf("MPCT OEM table size: %04x\n",val16); + + HAL_READMEM_UINT16( mpct+MPCT_HDR_ENTRY_COUNT, val16); + diag_printf("MPCT entry count: %04x\n",val16); + + HAL_READMEM_UINT32( mpct+MPCT_HDR_LOCAL_APIC, val32); + diag_printf("MPCT local APIC: %08x\n",val32); + + HAL_READMEM_UINT16( mpct+MPCT_HDR_XTAB_LENGTH, val16); + diag_printf("MPCT extended table length: %04x\n",val16); + HAL_READMEM_UINT8( mpct+MPCT_HDR_XTAB_CHECKSUM, val8); + diag_printf("MPCT extended table checksum: %02x\n",val8); + } +#endif + + // Extract the data we need from the structure + + HAL_READMEM_UINT32( mpct+MPCT_HDR_LOCAL_APIC, cyg_hal_smp_local_apic); + + // now parse the base table, looking for processor and IOAPIC entries. + + { + CYG_WORD16 entries; + CYG_ADDRESS entry = mpct + MPCT_HDR_SIZE; + + HAL_READMEM_UINT16( mpct+MPCT_HDR_ENTRY_COUNT, entries); + +#if SHOW_DIAGNOSTICS + diag_printf("\nBase table:\n"); +#endif + + while( entries-- ) + { + CYG_BYTE type; + + HAL_READMEM_UINT8( entry, type ); + + switch( type ) + { + case MPCT_ENTRY_TYPE_PROCESSOR: +#if SHOW_DIAGNOSTICS + diag_printf(" Processor\n"); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_PROC_APIC_ID, val8 ); + diag_printf(" APIC ID: %02x\n",val8); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_PROC_APIC_VER, val8 ); + diag_printf(" APIC Version: %02x\n",val8); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_PROC_CPU_FLAGS, val8 ); + diag_printf(" CPU Flags: %02x\n",val8); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_PROC_CPU_SIGNATURE, val32 ); + diag_printf(" CPU Signature: %08x\n",val32); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_PROC_FEATURE_FLAGS, val32 ); + diag_printf(" Feature flags: %08x\n",val32); +#endif + { + CYG_BYTE cpuid; + + // Index CPUs by their APIC IDs + HAL_READMEM_UINT8( entry+MPCT_ENTRY_PROC_APIC_ID, cpuid ); + + // Get flags for this CPU. + HAL_READMEM_UINT8(entry+MPCT_ENTRY_PROC_CPU_FLAGS, cyg_hal_smp_cpu_flags[cpuid]); + + cyg_hal_smp_cpu_count++; // count another CPU + } + + entry += MPCT_ENTRY_PROC_SIZE; + break; + + case MPCT_ENTRY_TYPE_BUS: + { + CYG_BYTE id; + char bustype[7]; + HAL_READMEM_UINT8( entry+MPCT_ENTRY_BUS_ID, id ); +#if SHOW_DIAGNOSTICS + diag_printf(" Bus\n"); + diag_printf(" ID: %02x\n",id); +#endif + { + int i; + for( i = 0; i < 6; i++ ) + { + HAL_READMEM_UINT8( entry+MPCT_ENTRY_BUS_TYPE_STRING+i, val8 ); + bustype[i] = val8; + } + bustype[i] = 0; +#if SHOW_DIAGNOSTICS + diag_printf(" Type: %s\n",&bustype[0]); +#endif + } + + if( streq( bustype, "ISA " ) ) + { + cyg_hal_isa_bus_id = id; + for( i = 0; i < 16; i++ ) + cyg_hal_isa_bus_irq[i] = 100; + } + if( streq( bustype, "PCI " ) ) + { + cyg_hal_pci_bus_id = id; + } + } + + entry += MPCT_ENTRY_BUS_SIZE; + break; + + case MPCT_ENTRY_TYPE_IOAPIC: +#if SHOW_DIAGNOSTICS + diag_printf(" I/O APIC\n"); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOAPIC_ID, val8 ); + diag_printf(" ID: %02x\n",val8); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOAPIC_VER, val8 ); + diag_printf(" Version: %02x\n",val8); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOAPIC_FLAGS, val8 ); + diag_printf(" Flags: %02x\n",val8); + HAL_READMEM_UINT32( entry+MPCT_ENTRY_IOAPIC_ADDRESS, val32 ); + diag_printf(" Address: %08x\n",val32); +#endif + + HAL_READMEM_UINT32( entry+MPCT_ENTRY_IOAPIC_ADDRESS, cyg_hal_smp_io_apic ); + entry += MPCT_ENTRY_IOAPIC_SIZE; + break; + + case MPCT_ENTRY_TYPE_INTERRUPT_IO: + { + CYG_BYTE bus, irq, dst; + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOINT_SOURCE_BUS, bus ); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOINT_SOURCE_IRQ, irq ); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOINT_DEST_INT, dst ); +#if SHOW_DIAGNOSTICS + diag_printf(" I/O interrupt assignment\n"); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOINT_TYPE, val8 ); + diag_printf(" Type: %02x\n",val8); + HAL_READMEM_UINT16( entry+MPCT_ENTRY_IOINT_TYPE, val16 ); + diag_printf(" Flags: %04x\n",val16); + diag_printf(" Source bus: %02x\n",bus); + diag_printf(" Source IRQ: %02x\n",irq); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOINT_DEST_APIC, val8 ); + diag_printf(" Dest APIC: %02x\n",val8); + diag_printf(" Dest Interrupt: %02x\n",dst); +#endif + + if( bus == cyg_hal_isa_bus_id ) + cyg_hal_isa_bus_irq[irq] = dst; +// if( bus == cyg_hal_pci_bus_id ) +// cyg_hal_pci_bus_irq[irq] = dst; + + } + entry += MPCT_ENTRY_IOINT_SIZE; + break; + + case MPCT_ENTRY_TYPE_INTERRUPT_LOCAL: +#if SHOW_DIAGNOSTICS + diag_printf(" Local interrupt assignment\n"); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOINT_TYPE, val8 ); + diag_printf(" Type: %02x\n",val8); + HAL_READMEM_UINT16( entry+MPCT_ENTRY_IOINT_TYPE, val16 ); + diag_printf(" Flags: %04x\n",val16); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOINT_SOURCE_BUS, val8 ); + diag_printf(" Source bus: %02x\n",val8); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOINT_SOURCE_IRQ, val8 ); + diag_printf(" Source IRQ: %02x\n",val8); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOINT_DEST_APIC, val8 ); + diag_printf(" Dest APIC: %02x\n",val8); + HAL_READMEM_UINT8( entry+MPCT_ENTRY_IOINT_DEST_INT, val8 ); + diag_printf(" Dest Interrupt: %02x\n",val8); +#endif + entry += MPCT_ENTRY_LOCINT_SIZE; + break; + + default: +#if SHOW_DIAGNOSTICS + diag_printf(" MPCT Entry: unknown type %02x\n",type); +#endif + entry += 8; + break; + } + + } + + } + } + +#if SHOW_DIAGNOSTICS + + diag_printf("Exported configuration:\n"); + diag_printf(" Local APIC: %08x\n", cyg_hal_smp_local_apic ); + diag_printf(" I/O APIC: %08x\n", cyg_hal_smp_io_apic ); + diag_printf(" CPU count: %d\n", cyg_hal_smp_cpu_count ); + + for( i = 0; i < cyg_hal_smp_cpu_count; i++ ) + { + diag_printf(" CPU %d %sactive %s\n",i, + ((cyg_hal_smp_cpu_flags[i]&1)?"":"in"), + ((cyg_hal_smp_cpu_flags[i]&2)?"master":"slave") + ); + } + + diag_printf(" ISA IRQ map:\n"); + + for( i = 0; i < 16; i++ ) + { + diag_printf(" IRQ %2d -> IOAPIC INT %2d\n",i,cyg_hal_isa_bus_irq[i]); + } + +#endif + + return 1; +} + +/*------------------------------------------------------------------------*/ +// Init local APIC + +static cyg_bool cyg_hal_smp_init_apic(void) +{ + + cyg_uint32 maxlvt; + cyg_uint32 val; + HAL_SMP_CPU_TYPE cpu; + + HAL_APIC_READ(HAL_APIC_ID, val ); + cpu = val>>24; + +#if SHOW_DIAGNOSTICS + diag_printf("Local APIC: %08x\n",cyg_hal_smp_local_apic); + diag_printf(" ID: %08x\n",val); +#endif + // get max local vector table entry offset + HAL_APIC_READ(HAL_APIC_VER, maxlvt ); +#if SHOW_DIAGNOSTICS + diag_printf(" VERSION: %08x\n",maxlvt); +#endif + maxlvt >>= 16; + maxlvt &= 0xFF; + + +#if SHOW_DIAGNOSTICS + diag_printf("maxlvt = %d\n",maxlvt); +#endif + + // Start by ensuring that all interrupt sources are disabled. The + // following code ensures that this happens cleanly. + + // Local timer vector + HAL_APIC_READ( HAL_APIC_LVT_TIMER, val ); + val |= HAL_APIC_LVT_MASK ; + HAL_APIC_WRITE( HAL_APIC_LVT_TIMER, val ); + +#if SHOW_DIAGNOSTICS + diag_printf(" APIC_LVT_TIMER: %08x\n",val); +#endif + + // Local interrupt vectors + HAL_APIC_READ( HAL_APIC_LVT_INT0, val ); + val |= HAL_APIC_LVT_MASK ; + HAL_APIC_WRITE( HAL_APIC_LVT_INT0, val ); + +#if SHOW_DIAGNOSTICS + diag_printf(" APIC_LVT_INT0: %08x\n",val); +#endif + + HAL_APIC_READ( HAL_APIC_LVT_INT1, val ); + val |= HAL_APIC_LVT_MASK ; + HAL_APIC_WRITE( HAL_APIC_LVT_INT1, val ); + +#if SHOW_DIAGNOSTICS + diag_printf(" APIC_LVT_INT1: %08x\n",val); +#endif + + if (maxlvt >= 3 ) + { + HAL_APIC_READ( HAL_APIC_LVT_ERROR, val ); + val |= HAL_APIC_LVT_MASK ; + HAL_APIC_WRITE( HAL_APIC_LVT_ERROR, val ); +#if SHOW_DIAGNOSTICS + diag_printf(" APIC_LVT_ERROR: %08x\n",val); +#endif + } + if (maxlvt >= 4 ) + { + HAL_APIC_READ( HAL_APIC_LVT_PC, val ); + val |= HAL_APIC_LVT_MASK ; + HAL_APIC_WRITE( HAL_APIC_LVT_PC, val ); +#if SHOW_DIAGNOSTICS + diag_printf(" APIC_LVT_PC: %08x\n",val); +#endif + } + + // Now initialize the local vector table. + + HAL_APIC_WRITE( HAL_APIC_LVT_TIMER, HAL_APIC_LVT_MASK ); + HAL_APIC_WRITE( HAL_APIC_LVT_INT0, HAL_APIC_LVT_MASK ); + HAL_APIC_WRITE( HAL_APIC_LVT_INT1, HAL_APIC_LVT_MASK ); + if( maxlvt >= 3 ) + HAL_APIC_WRITE( HAL_APIC_LVT_ERROR, HAL_APIC_LVT_MASK ); + if( maxlvt >= 4 ) + HAL_APIC_WRITE( HAL_APIC_LVT_PC, HAL_APIC_LVT_MASK ); + + + // Set up DFR to flat delivery mode. + HAL_APIC_WRITE( HAL_APIC_DFR, 0xffffffff ); + + // Set up logical destination id. We set bit 1<>16)&0xFF; + + // Set up ISA interrupts + for( i = 0; i < 16; i++ ) + { + if( cyg_hal_isa_bus_irq[i] != 100 ) + { + CYG_WORD32 tehi = 0, telo = 0x00010000; + + tehi |= cpu_this<<24; + + telo |= CYGNUM_HAL_ISR_MIN+i; + + HAL_IOAPIC_WRITE( HAL_IOAPIC_REG_REDIR_LO(cyg_hal_isa_bus_irq[i]), telo ); + HAL_IOAPIC_WRITE( HAL_IOAPIC_REG_REDIR_HI(cyg_hal_isa_bus_irq[i]), tehi ); + } + } + + +#if SHOW_DIAGNOSTICS + diag_printf("I/O APIC: %08x\n",cyg_hal_smp_io_apic); + + HAL_IOAPIC_READ( HAL_IOAPIC_REG_APICID, val ); + diag_printf(" ID: %08x\n",val); + + HAL_IOAPIC_READ( HAL_IOAPIC_REG_APICVER, val ); + diag_printf(" VER: %08x\n",val); + + HAL_IOAPIC_READ( HAL_IOAPIC_REG_APICARB, val ); + diag_printf(" ARB: %08x\n",val); + + diag_printf(" Redirection Table:\n"); + for( i = 0; i < tabsize; i++ ) + { + CYG_WORD32 tehi, telo; + + HAL_IOAPIC_READ( HAL_IOAPIC_REG_REDIR_LO(i), telo ); + HAL_IOAPIC_READ( HAL_IOAPIC_REG_REDIR_HI(i), tehi ); + diag_printf(" %02d: %08x %08x\n",i,tehi,telo); + } +#endif + + HAL_SPINLOCK_CLEAR( cyg_hal_ioapic_lock ); + + return 1; +} + +/*------------------------------------------------------------------------*/ + +static volatile CYG_WORD32 init_deasserted; + +__externC volatile CYG_WORD32 cyg_hal_smp_cpu_sync_flag[HAL_SMP_CPU_MAX]; +__externC volatile CYG_WORD32 cyg_hal_smp_cpu_sync[HAL_SMP_CPU_MAX]; +__externC volatile void (*cyg_hal_smp_cpu_entry[HAL_SMP_CPU_MAX])(void); +__externC volatile CYG_WORD32 cyg_hal_smp_vsr_sync_flag; +__externC volatile CYG_WORD32 cyg_hal_smp_cpu_running[HAL_SMP_CPU_MAX]; + +/*------------------------------------------------------------------------*/ + +__externC void cyg_hal_smp_start(void); + +__externC CYG_BYTE cyg_hal_slave_trampoline[]; +__externC CYG_BYTE cyg_hal_slave_trampoline_end[]; + +#define HAL_SLAVE_START_ADDRESS 0x00002000 + +__externC void cyg_hal_cpu_start( HAL_SMP_CPU_TYPE cpu ) +{ +#if 1 + CYG_WORD32 icrlo, icrhi; + CYG_BYTE *p = &cyg_hal_slave_trampoline[0]; + CYG_BYTE *q = (CYG_BYTE *)HAL_SLAVE_START_ADDRESS; + CYG_BYTE old_cmos; + int i; + + // Copy the trampoline over... + do + { + *q++ = *p++; + } while( p != &cyg_hal_slave_trampoline_end[0]); + + // Init synchronization spinlock to locked to halt slave CPU in + // cyg_hal_smp_startup(). + + init_deasserted = 0; + + // We now have to execute the grungy and unpleasant AP startup + // sequence to get the cpu running. I'm sure that not all of this + // is strictly necessary, but it works and it is too much effort + // to work out the minimal subset. + + // Write warm-reset code into CMOS RAM and write the address of + // the trampoline entry point into location 40:67. + HAL_READ_CMOS( 0x0f, old_cmos ); + HAL_WRITE_CMOS( 0x0f, 0x0a ); + HAL_WRITEMEM_UINT16( 0x467, HAL_SLAVE_START_ADDRESS & 0xf ); + HAL_WRITEMEM_UINT16( 0x469, HAL_SLAVE_START_ADDRESS>>4 ); + + + // Send an INIT interrupt to the dest CPU + icrhi = cpu<<24; + icrlo = 0x0000C500; + + HAL_APIC_WRITE( HAL_APIC_ICR_HI, icrhi ); + HAL_APIC_WRITE( HAL_APIC_ICR_LO, icrlo ); + + hal_delay_us( 10 * 1000 ); // Wait 10ms + + // Wait for the ICR to become inactive + do { + HAL_APIC_READ( HAL_APIC_ICR_LO, icrlo ); + } while( (icrlo & 0x00001000) != 0 ); + + // Now de-assert INIT + + icrlo = 0x00008500; + + HAL_APIC_WRITE( HAL_APIC_ICR_HI, icrhi ); + HAL_APIC_WRITE( HAL_APIC_ICR_LO, icrlo ); + + init_deasserted = 1; + + // Now we send two STARTUP IPIs + + for( i = 0; i < 2; i++ ) + { + icrlo = 0x00000600 | (HAL_SLAVE_START_ADDRESS>>12); + + // Send the STARTUP IPI + HAL_APIC_WRITE( HAL_APIC_ICR_HI, icrhi ); + HAL_APIC_WRITE( HAL_APIC_ICR_LO, icrlo ); + + hal_delay_us( 300 ); + + // Wait for the ICR to become inactive + do { + HAL_APIC_READ( HAL_APIC_ICR_LO, icrlo ); + } while( (icrlo & 0x00001000) != 0 ); + + hal_delay_us( 300 ); + } + + HAL_WRITE_CMOS( 0x0f, old_cmos ); + +// PC_WRITE_SCREEN( PC_SCREEN_LINE(5)+0, '!' ); + + hal_delay_us( 300 ); + +// PC_WRITE_SCREEN( PC_SCREEN_LINE(5)+1, '!' ); + +#endif +} + +/*------------------------------------------------------------------------*/ + +__externC void cyg_hal_smp_start(void); +__externC void cyg_hal_smp_startup(void); + +__externC void cyg_hal_cpu_release( HAL_SMP_CPU_TYPE cpu ) +{ +// PC_WRITE_SCREEN( PC_SCREEN_LINE(13), '!' ); +// PC_WRITE_SCREEN_8( PC_SCREEN_LINE(13), cpu ); + + cyg_hal_smp_cpu_entry[cpu] = cyg_hal_smp_start; + + while( cyg_hal_smp_cpu_entry[cpu] != 0 ) + { +// PC_WRITE_SCREEN_32( PC_SCREEN_LINE(13)+4, cyg_hal_smp_cpu_entry[cpu] ); + hal_delay_us( 100 ); + continue; + } +} + +/*------------------------------------------------------------------------*/ + +__externC void cyg_hal_smp_startup(void) +{ + HAL_SMP_CPU_TYPE cpu; + +// PC_WRITE_SCREEN( PC_SCREEN_LINE(2)+0, '!' ); + +#ifndef CYG_HAL_STARTUP_RAM + // Wait for INIT interrupt to be deasserted + while( !init_deasserted ) + continue; +#endif + +// PC_WRITE_SCREEN( PC_SCREEN_LINE(2)+1, '!' ); + + cpu = HAL_SMP_CPU_THIS(); + +// PC_WRITE_SCREEN_8( PC_SCREEN_LINE(2)+6, cpu ); + +#ifndef CYG_HAL_STARTUP_RAM + // Wait 1s for the world to settle + hal_delay_us( 1000000 ); + +// PC_WRITE_SCREEN( PC_SCREEN_LINE(2)+2, '!' ); + + // Setup our APIC + cyg_hal_smp_init_apic(); +#endif + +// PC_WRITE_SCREEN( PC_SCREEN_LINE(2)+3, '!' ); + +#ifdef CYGPKG_KERNEL_SMP_SUPPORT + cyg_hal_smp_cpu_running[cpu] = 1; + cyg_kernel_smp_startup(); +#else + for(;;) + { + void (*entry)(void); + + while( (entry = cyg_hal_smp_cpu_entry[cpu]) == 0 ) + { +#if 0 //SCREEN_DIAGNOSTICS + static int n; + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(2)+10, n ); + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(2)+15, cyg_hal_smp_cpu_sync[cpu] ); + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(2)+30, cyg_hal_smp_cpu_sync_flag[0] ); + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(2)+35, cyg_hal_smp_cpu_sync_flag[1] ); + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(2)+40, cyg_hal_smp_vsr_sync_flag ); + n++; +#endif + hal_delay_us( 100 ); + } + +// PC_WRITE_SCREEN( PC_SCREEN_LINE(2)+4, '!' ); + + cyg_hal_smp_cpu_entry[cpu] = 0; + +// PC_WRITE_SCREEN_32( PC_SCREEN_LINE(2)+20, entry ); + + if( entry != NULL ) + { + cyg_hal_smp_cpu_running[cpu] = 1; + entry(); + } + } +#endif +} + +/*------------------------------------------------------------------------*/ + +__externC void cyg_hal_smp_init(void) +{ + if( !cyg_hal_find_smp_config() ) + return; + + if( !cyg_hal_parse_smp_config() ) + return; + + if( !cyg_hal_smp_init_apic() ) + return; + + if( !cyg_hal_smp_init_ioapic() ) + return; +} + +/*------------------------------------------------------------------------*/ + +__externC void cyg_hal_smp_cpu_start_all(void) +{ + HAL_SMP_CPU_TYPE cpu; + + for( cpu = 0; cpu < HAL_SMP_CPU_COUNT(); cpu++ ) + { + cyg_hal_smp_cpu_sync[cpu] = 0; + cyg_hal_smp_cpu_sync_flag[cpu] = 0; + cyg_hal_smp_cpu_running[cpu] = 0; + cyg_hal_smp_cpu_entry[cpu] = 0; + + if( cpu != HAL_SMP_CPU_THIS() ) + cyg_hal_cpu_start( cpu ); + else cyg_hal_smp_cpu_running[cpu] = 1; + } +} + +/*------------------------------------------------------------------------*/ +// SMP message buffers. +// SMP CPUs pass messages to eachother via a small circular buffer +// protected by a spinlock. Each message is a single 32 bit word with +// a type code in the top 4 bits and any argument in the remaining +// 28 bits. + +#define SMP_MSGBUF_SIZE 4 + +static struct smp_msg_t +{ + HAL_SPINLOCK_TYPE lock; // protecting spinlock + volatile CYG_WORD32 msgs[SMP_MSGBUF_SIZE]; // message buffer + volatile CYG_WORD32 head; // head of list + volatile CYG_WORD32 tail; // tail of list + volatile CYG_WORD32 reschedule; // reschedule request + volatile CYG_WORD32 timeslice; // timeslice request +} smp_msg[HAL_SMP_CPU_MAX]; + +/*------------------------------------------------------------------------*/ +// Pass a message to another CPU. + +#if SCREEN_DIAGNOSTICS +static int res_msgs[2], tms_msgs[2]; +#endif + +__externC void cyg_hal_cpu_message( HAL_SMP_CPU_TYPE cpu, + CYG_WORD32 msg, + CYG_WORD32 arg, + CYG_WORD32 wait) +{ +#if 1 + CYG_INTERRUPT_STATE istate; + struct smp_msg_t *m = &smp_msg[cpu]; + int i; + HAL_SMP_CPU_TYPE me = HAL_SMP_CPU_THIS(); + + HAL_DISABLE_INTERRUPTS( istate ); + + // Get access to the message buffer for the selected CPU + HAL_SPINLOCK_SPIN( m->lock ); + +#if 0 //SCREEN_DIAGNOSTICS + if( msg == HAL_SMP_MESSAGE_RESCHEDULE ) + res_msgs[me]++; + else if( msg == HAL_SMP_MESSAGE_TIMESLICE ) + tms_msgs[me]++; + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(18+me), me); + PC_WRITE_SCREEN_16( PC_SCREEN_LINE(18+me)+40, res_msgs[me]); + PC_WRITE_SCREEN_16( PC_SCREEN_LINE(18+me)+45, tms_msgs[me]); +#endif + + if( msg == HAL_SMP_MESSAGE_RESCHEDULE ) + m->reschedule = true; + else if( msg == HAL_SMP_MESSAGE_TIMESLICE ) + m->timeslice = true; + else + { + CYG_WORD32 next = (m->tail + 1) & (SMP_MSGBUF_SIZE-1); + + // If the buffer is full, wait for space to appear in it. + // This should only need to be done very rarely. + + while( next == m->head ) + { + HAL_SPINLOCK_CLEAR( m->lock ); + for( i = 0; i < 1000; i++ ); + HAL_SPINLOCK_SPIN( m->lock ); + } + + m->msgs[m->tail] = msg | arg; + + m->tail = next; + } + + // Now send an interrupt to the CPU. + +// PC_WRITE_SCREEN_16( PC_SCREEN_LINE(18+me)+50, cyg_hal_smp_cpu_running[cpu] ); + + if( cyg_hal_smp_cpu_running[cpu] ) + { + CYG_WORD32 icrlo, icrhi; + + // Set the ICR fields we want to write. Most fields are zero + // except the destination in the high word and the vector + // number in the low. + icrhi = cpu<<24; + icrlo = CYGNUM_HAL_SMP_CPU_INTERRUPT_VECTOR( cpu ); + + // Write the ICR register. The interrupt will be raised when + // the low word is written. + HAL_APIC_WRITE( HAL_APIC_ICR_HI, icrhi ); + HAL_APIC_WRITE( HAL_APIC_ICR_LO, icrlo ); + + // Wait for the ICR to become inactive + do { +#if 0 //SCREEN_DIAGNOSTICS + static int n; + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(18+me)+55, n ); + n++; +#endif + HAL_APIC_READ( HAL_APIC_ICR_LO, icrlo ); + } while( (icrlo & 0x00001000) != 0 ); + } + + HAL_SPINLOCK_CLEAR( m->lock ); + + // If we are expected to wait for the command to complete, then + // spin here until it does. We actually wait for the destination + // CPU to empty its input buffer. So we might wait for messages + // from other CPUs as well. But this is benign. + + while(wait) + { + for( i = 0; i < 1000; i++ ); + + HAL_SPINLOCK_SPIN( m->lock ); + + if( m->head == m->tail ) + wait = false; + + HAL_SPINLOCK_CLEAR( m->lock ); + + } + + HAL_RESTORE_INTERRUPTS( istate ); +#endif +} + +/*------------------------------------------------------------------------*/ + +#if SCREEN_DIAGNOSTICS +static int isrs[2]; +static int dsrs[2]; +#endif + +__externC CYG_WORD32 cyg_hal_cpu_message_isr( CYG_WORD32 vector, CYG_ADDRWORD data ) +{ + HAL_SMP_CPU_TYPE me = HAL_SMP_CPU_THIS(); + struct smp_msg_t *m = &smp_msg[me]; + CYG_WORD32 ret = 1; + CYG_INTERRUPT_STATE istate; + + HAL_DISABLE_INTERRUPTS( istate ); + + HAL_SPINLOCK_SPIN( m->lock ); + + // First, acknowledge the interrupt. + + HAL_INTERRUPT_ACKNOWLEDGE( vector ); + +#if SCREEN_DIAGNOSTICS + isrs[me]++; + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(18+me), me); + PC_WRITE_SCREEN_16( PC_SCREEN_LINE(18+me)+5, isrs[me]); +#endif + + if( m->reschedule || m->timeslice ) + ret |= 2; // Ask for the DSR to be called. + + // Now pick messages out of the buffer and handle them + + while( m->head != m->tail ) + { + CYG_WORD32 msg = m->msgs[m->head]; + + switch( msg & HAL_SMP_MESSAGE_TYPE ) + { + case HAL_SMP_MESSAGE_RESCHEDULE: + ret |= 2; // Ask for the DSR to be called. + break; + case HAL_SMP_MESSAGE_MASK: + // Mask the supplied vector +// cyg_hal_interrupt_set_mask( msg&HAL_SMP_MESSAGE_ARG, false ); + break; + case HAL_SMP_MESSAGE_UNMASK: + // Unmask the supplied vector +// cyg_hal_interrupt_set_mask( msg&HAL_SMP_MESSAGE_ARG, true ); + break; + case HAL_SMP_MESSAGE_REVECTOR: + // Deal with a change of CPU assignment for a vector. We + // only actually worry about what happens when the vector + // is changed to some other CPU. We just mask the + // interrupt locally. +// if( hal_interrupt_cpu[msg&HAL_SMP_MESSAGE_ARG] != me ) +// cyg_hal_interrupt_set_mask( msg&HAL_SMP_MESSAGE_ARG, false ); + break; + } + + // Update the head pointer after handling the message, so that + // the wait in cyg_hal_cpu_message() completes after the action + // requested. + + m->head = (m->head + 1) & (SMP_MSGBUF_SIZE-1); + } + + HAL_SPINLOCK_CLEAR( m->lock ); + + HAL_RESTORE_INTERRUPTS( istate ); + + return ret; +} + +/*------------------------------------------------------------------------*/ +// CPU message DSR. +// This is only executed if the message was +// HAL_SMP_MESSAGE_RESCHEDULE. It calls up into the kernel to effect a +// reschedule. + +__externC void cyg_scheduler_set_need_reschedule(void); +__externC void cyg_scheduler_timeslice_cpu(void); + +#if SCREEN_DIAGNOSTICS +__externC int cyg_scheduler_sched_lock; +static int rescheds[2]; +static int timeslices[2]; +#endif + +__externC CYG_WORD32 cyg_hal_cpu_message_dsr( CYG_WORD32 vector, CYG_ADDRWORD data ) +{ + HAL_SMP_CPU_TYPE me = HAL_SMP_CPU_THIS(); + struct smp_msg_t *m = &smp_msg[me]; + CYG_INTERRUPT_STATE istate; + CYG_WORD32 reschedule, timeslice; + + HAL_DISABLE_INTERRUPTS( istate ); + HAL_SPINLOCK_SPIN( m->lock ); + +#if SCREEN_DIAGNOSTICS + dsrs[me]++; + PC_WRITE_SCREEN_16( PC_SCREEN_LINE(18+me)+10, dsrs[me]); + PC_WRITE_SCREEN_16( PC_SCREEN_LINE(18+me)+15, cyg_scheduler_sched_lock); +#endif + + reschedule = m->reschedule; + timeslice = m->timeslice; + m->reschedule = m->timeslice = false; + + HAL_SPINLOCK_CLEAR( m->lock ); + HAL_RESTORE_INTERRUPTS( istate ); + + if( reschedule ) + { +#if SCREEN_DIAGNOSTICS + rescheds[me]++; + PC_WRITE_SCREEN_16( PC_SCREEN_LINE(18+me)+20, rescheds[me]); +#endif + cyg_scheduler_set_need_reschedule(); + } + if( timeslice ) + { +#if SCREEN_DIAGNOSTICS + timeslices[me]++; + PC_WRITE_SCREEN_16( PC_SCREEN_LINE(18+me)+25, timeslices[me]); +#endif + cyg_scheduler_timeslice_cpu(); + } + + return 0; + +} + +/*------------------------------------------------------------------------*/ + +#if SCREEN_DIAGNOSTICS +static int x = 0; +#endif + +__externC void cyg_hal_smp_halt_other_cpus(void) +{ + int i; + HAL_SMP_CPU_TYPE me = HAL_SMP_CPU_THIS(); + +// PC_WRITE_SCREEN_8( PC_SCREEN_LINE(6+me), me ); + + for( i = 0 ; i < HAL_SMP_CPU_COUNT(); i++ ) + { + if( i != me && cyg_hal_smp_cpu_running[i] ) + { + CYG_WORD32 icrhi, icrlo; + CYG_WORD32 oldsync; + +// PC_WRITE_SCREEN_8( PC_SCREEN_LINE(6+me)+40, i ); + + oldsync = cyg_hal_smp_cpu_sync_flag[i]; + cyg_hal_smp_cpu_sync[i] = 0; + + + icrhi = i<<24; + icrlo = CYGNUM_HAL_VECTOR_NMI; // not really used + icrlo |= 0x00000400; // Delivery = NMI + //icrlo |= 0x000C0000; // Dest = all excluding self + + // Write the ICR register. The interrupt will be raised when + // the low word is written. + HAL_APIC_WRITE( HAL_APIC_ICR_HI, icrhi ); + HAL_APIC_WRITE( HAL_APIC_ICR_LO, icrlo ); + + // Wait for the ICR to become inactive + do { +#if 0 //SCREEN_DIAGNOSTICS + static int n; + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(6+me)+45, n ); + n++; +#endif + HAL_APIC_READ( HAL_APIC_ICR_LO, icrlo ); + } while( (icrlo & 0x00001000) != 0 ); + + // Wait for CPU to halt + while( cyg_hal_smp_cpu_sync_flag[i] == oldsync ) + { +#if 0 //SCREEN_DIAGNOSTICS + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(6+me)+4, x ); x++; + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(6+me)+10+(i*8), cyg_hal_smp_cpu_sync_flag[i] ); + PC_WRITE_SCREEN_8( PC_SCREEN_LINE(6+me)+10+(i*8)+4, oldsync ); +#endif + hal_delay_us( 100 ); + } + + } + } + +} + +__externC void cyg_hal_smp_release_other_cpus(void) +{ + int i; + for( i = 0 ; i < HAL_SMP_CPU_COUNT(); i++ ) + { + if( i != HAL_SMP_CPU_THIS() && cyg_hal_smp_cpu_running[i] ) + { + CYG_WORD32 oldsync = cyg_hal_smp_cpu_sync_flag[i]; + cyg_hal_smp_cpu_sync[i] = 1; + while( cyg_hal_smp_cpu_sync_flag[i] == oldsync ) + continue; + cyg_hal_smp_cpu_sync[i] = 0; + } + } +} + +#endif // CYGPKG_HAL_SMP_SUPPORT + +/*------------------------------------------------------------------------*/ +/* End of pcmb_smp.c */ diff --git a/packages/hal/i386/pcmb/current/support/gfxmode.c b/packages/hal/i386/pcmb/current/support/gfxmode.c new file mode 100644 --- /dev/null +++ b/packages/hal/i386/pcmb/current/support/gfxmode.c @@ -0,0 +1,191 @@ +//========================================================================== +// +// gfxmode.c +// +// Display information about the available graphics modes. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): bartv +// Date: 2002-04-26 +// Purpose: Display information about the various graphics modes +// Description: +// +// RedBoot on a PC has an option to switch to a suitable graphics mode +// during bootstrap, by calling the video BIOS before switching from +// real to protected mode. This is controlled by the option +// CYGNUM_HAL_I386_PC_STARTUP_VIDEO_MODE in the RedBoot configuration. +// It is then possible to download an eCos application which uses +// the current graphics mode. +// +// However different graphics cards will use different numbers for +// the various resolutions, so the user must somehow find out which +// graphics mode corresponds to which resolution and depth. That +// can be achieved by creating another eCos configuration suitable +// for applications, and then building this utility with that +// configuration. RedBoot can then be reconfigured and rebuilt +// to use the right video mode. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include + +struct VBESVGAInfoBlock { + unsigned char signature[4]; /* VESA */ + unsigned short version; + char* oem_string_ptr; + unsigned char capabilities[4]; + unsigned short* video_mode_ptr; + unsigned short total_memory; + unsigned short oem_software_rev; + char* oem_vendor_name_ptr; + char* oem_product_name_ptr; + char* oem_product_rev_ptr; + /* Reserved data here */ +} __attribute__((packed)); + +struct VBEModeInfoBlock { + unsigned short mode_attributes; + unsigned char win_a_atributes; + unsigned char win_b_attributes; + unsigned short win_granularity; + unsigned short win_size; + unsigned short win_a_segment; + unsigned short win_b_segment; + unsigned int win_func_ptr; + unsigned short bytes_per_scanline; + unsigned short x_resolution; + unsigned short y_resolution; + unsigned char x_char_size; + unsigned char y_char_size; + unsigned char number_of_planes; + unsigned char bits_per_pixel; + unsigned char number_of_banks; + unsigned char memory_model; + unsigned char bank_size; + unsigned char number_of_image_pages; + unsigned char reserved; + unsigned char red_mask_size; + unsigned char red_field_position; + unsigned char green_mask_size; + unsigned char green_field_position; + unsigned char blue_mask_size; + unsigned char blue_field_position; + unsigned char reserved_mask_size; + unsigned char reserved_field_position; + unsigned char direct_color_mode_info; + unsigned int physical_base_ptr; + unsigned int offscreen_memory_offset; + unsigned short offscreen_memory_size; +} __attribute__((packed)); + +static char* +segoff_to_phys(char* addr) +{ + int x = (int) addr; + int segment = (x >> 12) & 0x0FFFF0; + int offset = x & 0x0FFFF; + return (char*) (segment | offset); +} + +int +main(int argc, char** argv) +{ + struct VBESVGAInfoBlock* info_block = (struct VBESVGAInfoBlock*) 0x000A0000; + struct VBEModeInfoBlock* current_mode = (struct VBEModeInfoBlock*) 0x000A0200; + int i; + + printf("VESA info: %c%c%c%c\n", info_block->signature[0], info_block->signature[1], + info_block->signature[2], info_block->signature[3]); + printf("version %04x\n", info_block->version); + if (NULL != info_block->oem_string_ptr) { + info_block->oem_string_ptr = segoff_to_phys(info_block->oem_string_ptr); + printf("OEM %s\n", info_block->oem_string_ptr); + } + printf("total memory %dK\n", 64 * info_block->total_memory); + printf("oem software rev %04x\n", info_block->oem_software_rev); + if (NULL != info_block->oem_vendor_name_ptr) { + info_block->oem_vendor_name_ptr = segoff_to_phys(info_block->oem_vendor_name_ptr); + printf("OEM vendor %s\n", info_block->oem_vendor_name_ptr); + } + if (NULL != info_block->oem_product_name_ptr) { + info_block->oem_product_name_ptr = segoff_to_phys(info_block->oem_product_name_ptr); + printf("OEM product name %s\n", info_block->oem_product_name_ptr); + } + if (NULL != info_block->oem_product_rev_ptr) { + info_block->oem_product_rev_ptr = segoff_to_phys(info_block->oem_product_rev_ptr); + printf("OEM product revision %s\n", info_block->oem_product_rev_ptr); + } + printf("Capabilities: %02x, %02x, %02x, %02x\n", + info_block->capabilities[0], info_block->capabilities[1], + info_block->capabilities[2], info_block->capabilities[3]); + info_block->video_mode_ptr = (unsigned short*) segoff_to_phys((char*) info_block->video_mode_ptr); + for (i = 0; 0x0FFFF != info_block->video_mode_ptr[i]; i++) { + int mode = info_block->video_mode_ptr[i]; + struct VBEModeInfoBlock* mode_data = (struct VBEModeInfoBlock*) (0x0A0400 + (0x100 * i)); + printf("Mode %04x: %4d*%4d @ %2dbpp, %4d bytes/line, fb %s 0x%08x\n", mode, + mode_data->x_resolution, mode_data->y_resolution, mode_data->bits_per_pixel, + mode_data->bytes_per_scanline, + (0 == (mode_data->mode_attributes & 0x0080)) ? "no " : "yes", + mode_data->physical_base_ptr); + if (8 < mode_data->bits_per_pixel) { + printf(" red %d bits << %d, green %d bits << %d, blue %d bits << %d, reserved %d bits << %d\n", + mode_data->red_mask_size, mode_data->red_field_position, + mode_data->green_mask_size, mode_data->green_field_position, + mode_data->blue_mask_size, mode_data->blue_field_position, + mode_data->reserved_mask_size, mode_data->reserved_field_position); + } + } + + printf("Current mode: %4d*%4d @ %2dbpp, %4d bytes/line, fb %s 0x%08x\n", + current_mode->x_resolution, current_mode->y_resolution, current_mode->bits_per_pixel, + current_mode->bytes_per_scanline, + (0 == (current_mode->mode_attributes & 0x0080)) ? "no" : "yes", + current_mode->physical_base_ptr); + if (8 < current_mode->bits_per_pixel) { + printf(" red %d bits << %d, green %d bits << %d, blue %d bits << %d, reserved %d bits << %d\n", + current_mode->red_mask_size, current_mode->red_field_position, + current_mode->green_mask_size, current_mode->green_field_position, + current_mode->blue_mask_size, current_mode->blue_field_position, + current_mode->reserved_mask_size, current_mode->reserved_field_position); + } + + exit(0); +} diff --git a/packages/hal/mips/arch/current/ChangeLog b/packages/hal/mips/arch/current/ChangeLog --- a/packages/hal/mips/arch/current/ChangeLog +++ b/packages/hal/mips/arch/current/ChangeLog @@ -1,3 +1,26 @@ +2002-05-17 Jesper Skov + + * include/hal_intr.h: Fix CYGNUM_HAL_EXCEPTION_MIN definition so + it reflects the FPU configuration. + +2002-04-30 Jesper Skov + + * include/hal_intr.h: Only define decoded FPU vectors if these are + actually used. This allows tests to check for capabilities and do + N/A when appropriate. + +2002-04-15 Jonathan Larmour + + * src/hal_syscall.c (hal_syscall_handler): Add extra sig argument to + __do_syscall. + +2002-03-21 Nick Garnett + + * include/hal_cache.h: Added macros to adjust the size argument to + some of the cache macros to a whole multiple of the cache line + size. Otherwise, for some values of the arguments, we can miss the + last line. + 2001-12-17 Jesper Skov * include/hal_arch.h (CYGARC_HAL_GET_RETURN_ADDRESS, @@ -1521,27 +1544,36 @@ 1998-07-23 Nick Garnett + + * include/platform.inc: Added hal_intc_translate that knows about + the special trampoline code. + + * include/plf_intr.h: Updated comment. + +2002-02-05 Jesper Skov + + * include/plf_intr.h: Always define the vectors, regardless of + chaining configuration. + +2002-01-31 Jesper Skov + + * src/platform.S (hal_isr_springboard_southbridge): Apply mask to + interrupt flags - I've seen requests set for masked + interrupts. Also don't check the slave controller unless the + cascade request is set. + +2001-12-06 Nick Garnett + + * images/redboot_RAM_5kc.elf + * images/redboot_RAM_5kc.srec + * images/redboot_ROM_5kc.elf + * images/redboot_ROM_5kc.fl + * images/redboot_ROM_5kc.srec + Added these images for 5kc target. + + * images/redboot_RAM.elf + * images/redboot_RAM.srec + * images/redboot_ROM.elf + * images/redboot_ROM.fl + * images/redboot_ROM.srec + Updated these images to match the 5kc ones. These images are for + Malta boards with the 4kc processor. These will actually run in a + 5kc, but will treat it as a 32bit CPU, and will not provide 64bit + state to GDB. + +2001-12-04 Nick Garnett + + * misc/redboot_ROM.ecm: Commented out CYGSEM_REDBOOT_DISK_ISO9660 + since its presence causes CDL and compilation errors. + +2001-11-06 Mark Salter + + * misc/redboot_ROM.ecm: Cleanup to support both mips32 and mips64. + * misc/redboot_RAM.ecm: Ditto. + +2001-10-31 Jonathan Larmour + + * cdl/hal_mips_malta.cdl: Indicate support of variable baud rates. + +2001-07-24 Mark Salter + + * src/plf_misc.c (cyg_hal_plf_ide_init): New function to enable IDE + controllers. + (cyg_hal_plf_pci_init): Move ISA bridge setup from cyg_hal_plf_pci_init + * include/plf_io.h: Add IDE i/f macros. + * cdl/hal_mips_malta.cdl: Now implements CYGINT_HAL_PLF_IF_IDE. + +2001-07-17 David Woodhouse + + * src/redboot_cmds.c: Remove. Superseded by generic MIPS exec. + * cdl/hal_mips_malta.cdl: Remove reference to $1 + +2001-07-13 Jesper Skov + + * include/plf_io.h (HAL_PCI_ALLOC_BASE_IO): Reserve 64kB for + southbridge instead of 8kB. + +2001-07-12 Jesper Skov + + * include/plf_io.h: Fix errors. + +2001-07-05 Jesper Skov + + * include/plf_io.h: Added PCI/CPU address translation macros. + +2001-06-27 Mark Salter + + * misc/redboot_RAM.ecm (CYGSEM_REDBOOT_BSP_SYSCALLS): Enable GNUPro + syscalls. + * misc/redboot_ROM.ecm (CYGSEM_REDBOOT_BSP_SYSCALLS): Ditto. + +2001-06-06 Jesper Skov + + * include/plf_io.h (HAL_PCI_TRANSLATE_INTERRUPT): Defined. + + * include/plf_intr.h: Made safe to include from assembly files. + * src/plf_mk_defs.c (main): Deleted interrupt vector definitions. + + * src/ser16c550c.c: Fix warning. + + * src/platform.S: Add .noreorder statements. + +2001-06-05 Jesper Skov + + * src/platform.S (hal_isr_springboard_southbridge): Use delay + slots, return 0 for spurious interrupts. + +2001-06-01 Jesper Skov + + * src/plf_mk_defs.c: Added CYGNUM_HAL_INTERRUPT_CASCADE. + + * src/plf_misc.c (hal_init_irq): Fix enabling of cascading + interrupts from secondary controller. + + * src/platform.S (hal_isr_springboard_southbridge): Fixed decoding + of secondary sources. Bail out on spurious interrups. + +2001-04-26 Mark Salter + + * include/plf_io.h (HAL_PCI_ALLOC_BASE_MEMORY): Fix typo. + + * cdl/hal_mips_malta.cdl (CYGNUM_HAL_RTC_PERIOD): Fix calculation to + be based on one half of the CPU clock frequency. + +2001-04-23 Mark Salter + + * include/plf_io.h: Adjust PCI memory and io base constants so that + CPU/PCI addresses match the GT64120 setup. Change PCI memory alloc + base to allow for memory used by south bridge. + +2001-04-11 Jesper Skov + + * src/plf_mk_defs.c: Added a few more defs. + + * src/platform.S: Added southbridge springboard for interrupt + decoding. + + * include/plf_io.h: Carve out a bit of memory at 0 in the PCI IO + space. Otherwise PCI devices get assigned space which the lana + southbridge is hardwired to. Also moved PCI register defs to this + file. + + * src/plf_misc.c: Added PCI interrupt routing setup. + +2001-04-10 Jesper Skov + + * src/ser16c550c.c (cyg_hal_plf_serial_init_channel): Allow + interrupts. + + * include/plf_io.h (HAL_PIIX4_ELCR2): Fix typo. + + * src/plf_misc.c (hal_init_irq): Added. + (hal_init_irq): Use byte access to SERIRQ. + + * include/plf_io.h: Replaced interrupt definitions. + + * include/plf_intr.h: Proper interrupt handling. + + * include/platform.inc: Removed hal_intc_decode. + + * misc/redboot_RAM.ecm: Added decompression support. + * misc/redboot_ROM.ecm: Same. + + * include/pkgconf/mlt_mips_malta_ram.mlt: Give RedBoot even more + space. + * include/pkgconf/mlt_mips_malta_ram.ldi: Same. + * include/pkgconf/mlt_mips_malta_ram.h: Same. + +2001-04-09 Jesper Skov + + * include/pkgconf/mlt_mips_malta_ram.h: Changed base address. + * include/pkgconf/mlt_mips_malta_ram.mlt: Same. + * include/pkgconf/mlt_mips_malta_ram.ldi: Same. + + * misc/redboot_ROM.ecm: Updated. + + * include/pkgconf/mlt_mips_malta_rom.h: Updated. + * include/pkgconf/mlt_mips_malta_rom.ldi: Same. + * include/pkgconf/mlt_mips_malta_rom.mlt: Same. + * include/pkgconf/mlt_mips_malta_ram.h: Updated. + * include/pkgconf/mlt_mips_malta_ram.ldi: Same. + * include/pkgconf/mlt_mips_malta_ram.mlt: Same. + + * src/plf_mk_defs.c: Added. + * cdl/hal_mips_malta.cdl: Build mk_defs file. + * src/platform.S: Get table size def from header. + +2001-04-03 Jesper Skov + + * misc/redboot_RAM.ecm: Added net packages. + + * include/pkgconf/mlt_mips_malta_ram.h: Hacked in some PCI memory. + * include/pkgconf/mlt_mips_malta_ram.ldi: Same. + +2001-04-02 Jesper Skov + + * src/ser16c550c.c: Removed debug channel definitions, added + second port. + + * include/plf_intr.h: Removed UART vector. + + * src/plf_misc.c: Moved SMSC superIO init code... + * src/smsc37m81x.c (cyg_hal_init_superIO): to here. + * cdl/hal_mips_malta.cdl: Compile new file. + +2001-03-23 Jesper Skov + + * src/plf_misc.c (hal_platform_init): Initialize PIIX4 and set up + COM1 for the SMSC SuperIO part. Now we have serial output. Wohoo! + + * include/plf_io.h: Added a few new definitions. + + * src/platform.S: Enable Galileo as PCI master. Make all PCI IO be + offset from zero to make PIIX4 happy. + + * include/plf_intr.h (CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE): Added. + + * misc/redboot_ROM.ecm: Updated. + + * src/platform.S: Use correct ISR count (hack). + + * include/platform.inc: Remove RAM SDRAM init hack. + + * src/platform.S: SDP: Fix sizing logic. + + * include/plf_io.h (HAL_SPD_GET_SDRAM_WIDTH): Changed to width of + DIMM instead of width of individual SDRAM devices. + +2001-03-22 Jesper Skov + + * src/platform.S: Remove some of the hacks. + + * include/plf_io.h (HAL_I2C_READ, HAL_I2C_WRITE): Get these right, + and the code works. Sheesh! + + * src/platform.S: Minor tweaks to make I2C code match that in + YAMON. Still doesn't work though. + + * include/platform.inc: Hacked to enable SDRAM init. + + * src/platform.S: Rewrote to use simpler macros. + + * src/plf_misc.c: Removed some CYGMON stuff. + + * include/plf_io.h: Added simpler definitions for I2C access. + + * src/plf_misc.c (hal_platform_init): Fix warning. + + * src/platform.S: Rewrote I2C code for FPGA controller. + + * include/pkgconf/mlt_mips_malta_rom.h: Updated. + * include/pkgconf/mlt_mips_malta_rom.mlt: Same. + * include/pkgconf/mlt_mips_malta_rom.ldi: Same. + + * include/plf_io.h: Added I2C definitions for FPGA I2C + controller. + + * cdl/hal_mips_malta.cdl: Added clock option. + +2001-03-21 Jesper Skov + + * misc/redboot_RAM.ecm: Updated. + + * src/plf_misc.c: Always init PCI. Wait for reset. + +2001-03-20 Jesper Skov + + * src/ser16c550c.c: Work with either the debug UART (untested) or + the SuperIO controllers. Clean up baud rate stuff. + + * src/plf_misc.c (cyg_hal_plf_pci_init): Disable init code for + now. + + * include/platform.inc: Removed ROMRAM startup stuff. + + * cdl/hal_mips_malta.cdl: Changed some default settings. + + * src/plf_misc.c: Removed test code and CYGMON init code. + + * misc/redboot_RAM.ecm: Updated with new options. + + * src/ser16c550c.c: Changes to use SuperIO in PCI space. + + * cdl/hal_mips_malta.cdl: Replace old baud rate options with + CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD. + * src/redboot_cmds.c (do_exec): Use + CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD. + + * Package cloned from Atlas package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/mips/malta/current/cdl/hal_mips_malta.cdl b/packages/hal/mips/malta/current/cdl/hal_mips_malta.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/cdl/hal_mips_malta.cdl @@ -0,0 +1,358 @@ +# ==================================================================== +# +# hal_mips_malta.cdl +# +# MIPS Malta board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): dmoseley +# Original data: bartv +# Contributors: dmoseley, jskov +# Date: 2000-06-06 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_MIPS_MALTA { + display "Malta evaluation board" + parent CYGPKG_HAL_MIPS + requires { ((((CYGHWR_HAL_MIPS_MIPS32_CORE == "4Kc") || \ + (CYGHWR_HAL_MIPS_MIPS32_CORE == "4Kp") || \ + (CYGHWR_HAL_MIPS_MIPS32_CORE == "4Km")) && CYGPKG_HAL_MIPS_MIPS32) || \ + (((CYGHWR_HAL_MIPS_MIPS64_CORE == "5K") || \ + (CYGHWR_HAL_MIPS_MIPS64_CORE == "20K")) && CYGPKG_HAL_MIPS_MIPS64)) \ + } + requires CYGPKG_IO_PCI + include_dir cyg/hal + description " + The Malta HAL package should be used when targetting the + actual hardware." + + compile hal_diag.c platform.S plf_misc.c ser16c550c.c smsc37m81x.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + implements CYGINT_HAL_PLF_IF_IDE + + cdl_option CYGBLD_HAL_TARGET_H { + display "Variant header" + flavor data + no_define + calculated { CYGPKG_HAL_MIPS_MIPS32 ? "" : \ + "" } + define -file system.h CYGBLD_HAL_TARGET_H + description "Variant header." + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_system_header "" + puts $::cdl_system_header "/* Make sure we get the CORE type definitions for HAL_PLATFORM_CPU */" + puts $::cdl_system_header "#include CYGBLD_HAL_TARGET_H" + puts $::cdl_system_header "#define HAL_PLATFORM_BOARD \"Malta\"" + puts $::cdl_system_header "#define HAL_PLATFORM_EXTRA \"\"" + puts $::cdl_system_header "" + puts $::cdl_system_header "#if defined(CYGHWR_HAL_MIPS_MIPS32_CORE_4Kc)" + puts $::cdl_system_header "# define HAL_PLATFORM_CPU \"MIPS32 4Kc\"" + puts $::cdl_system_header "#elif defined(CYGHWR_HAL_MIPS_MIPS32_CORE_4Kp)" + puts $::cdl_system_header "# define HAL_PLATFORM_CPU \"MIPS32 4Kp\"" + puts $::cdl_system_header "#elif defined(CYGHWR_HAL_MIPS_MIPS32_CORE_4Km)" + puts $::cdl_system_header "# define HAL_PLATFORM_CPU \"MIPS32 4Km\"" + puts $::cdl_system_header "#elif defined(CYGHWR_HAL_MIPS_MIPS64_CORE_5K)" + puts $::cdl_system_header "# define HAL_PLATFORM_CPU \"MIPS64 5K\"" + puts $::cdl_system_header "#elif defined(CYGHWR_HAL_MIPS_MIPS64_CORE_20K)" + puts $::cdl_system_header "# define HAL_PLATFORM_CPU \"MIPS64 20K\"" + puts $::cdl_system_header "#else" + puts $::cdl_system_header "# error Unknown Core" + puts $::cdl_system_header "#endif" + puts $::cdl_system_header "" + } + + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM"} + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + Currently only ROM startup type is supported." + } + + # The "-o file" is a workaround for CR100958 - without it the + # output file would end up in the source directory under CygWin. + # n.b. grep does not behave itself under win32 + make -priority 1 { + /include/cyg/hal/plf_defs.inc : /src/plf_mk_defs.c + $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $< + fgrep .equ plf_mk_defs.tmp | sed s/#// > $@ + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 plf_defs.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm plf_defs.tmp plf_mk_defs.tmp + } + + cdl_option CYGHWR_HAL_MIPS_MALTA_CPU_CLOCK { + display "CPU clock speed" + flavor data + calculated 80000000 + description " + This option specifies the CPU clock." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants." + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated { (CYGHWR_HAL_MIPS_MALTA_CPU_CLOCK / 2) / CYGNUM_HAL_RTC_DENOMINATOR } + description " + The count and compare registers of the Malta are used + to drive the eCos kernel RTC. The count register + increments at half the CPU clock speed." + } + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + parent CYGBLD_GLOBAL_OPTIONS + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + + + cdl_option CYGNUM_HAL_BREAKPOINT_LIST_SIZE { + display "Number of breakpoints supported by the HAL." + flavor data + default_value 25 + description " + This option determines the number of breakpoints supported by the HAL." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 2 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The Malta board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The Malta board has only one serial port. This option + chooses which port will be used for diagnostic output." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD { + display "Console/GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + define CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD + description " + This option controls the default baud rate used for the + Console/GDB connection." + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "mips_malta_ram" : \ + "mips_malta_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for three different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"GDB_stubs\" provides support when GDB stubs are + included in the ROM monitor or boot ROM." + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_component CYGPKG_CYGMON_HAL_OPTIONS { + display "CygMon HAL options" + flavor none + no_define + parent CYGPKG_CYGMON + active_if CYGPKG_CYGMON + description " + This option also lists the target's requirements for a valid CygMon + configuration." + + cdl_option CYGBLD_BUILD_CYGMON_BIN { + display "Build CygMon ROM binary image" + active_if CYGBLD_BUILD_CYGMON + default_value 1 + no_define + description "This option enables the conversion of the CygMon ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + /bin/cygmon.srec : /bin/cygmon.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $@ + } + } + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + compile -library=libextras.a + + make -priority 325 { + /bin/redboot.srec : /bin/redboot.elf + $(OBJCOPY) --strip-all $< $(@:.srec=.img) + $(OBJCOPY) -O srec $< $@ + } + } + } + +} diff --git a/packages/hal/mips/malta/current/include/hal_diag.h b/packages/hal/mips/malta/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/hal_diag.h @@ -0,0 +1,74 @@ +#ifndef CYGONCE_HAL_DIAG_H +#define CYGONCE_HAL_DIAG_H + +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas +// Contributors:nickg, gthomas +// Date: 2001-03-20 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +//----------------------------------------------------------------------------- +// LED + +externC void hal_diag_led(int n); + +//----------------------------------------------------------------------------- +// end of hal_diag.h +#endif // CYGONCE_HAL_DIAG_H diff --git a/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_ram.h b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_ram.h @@ -0,0 +1,22 @@ +// eCos memory layout - Mon Apr 09 14:17:14 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x80020000) +#define CYGMEM_REGION_ram_SIZE (0x1fe0000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x81f00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_ram.ldi b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_ram.ldi @@ -0,0 +1,40 @@ +// eCos memory layout - Mon Apr 09 14:17:14 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x80020000, LENGTH = 0x1fe0000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x80020000, LMA_EQ_VMA) + SECTION_ROMISC (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_RELOCS (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_init (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_data1 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_eh_frame (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_ctors (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_dtors (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_devtab (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_got (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_dynamic (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_sdata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_lit8 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_lit4 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_sbss (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x8), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x81f00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; + SECTIONS_END +} diff --git a/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_ram.mlt b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_ram.mlt @@ -0,0 +1,26 @@ +version 0 +region ram 80020000 1fe0000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 80020000 80020000 ROMISC ROMISC ! +section ROMISC 0 4 0 1 0 1 0 1 RELOCS RELOCS ! +section RELOCS 0 4 0 1 0 1 0 1 init init ! +section init 0 4 0 1 0 1 0 1 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata rodata ! +section rodata 0 8 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 8 0 1 0 1 0 1 data data ! +section data 0 8 0 1 0 1 0 1 data1 data1 ! +section data1 0 8 0 1 0 1 0 1 eh_frame eh_frame ! +section eh_frame 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 4 0 1 0 1 0 1 ctors ctors ! +section ctors 0 4 0 1 0 1 0 1 dtors dtors ! +section dtors 0 4 0 1 0 1 0 1 devtab devtab ! +section devtab 0 4 0 1 0 1 0 1 got got ! +section got 0 4 0 1 0 1 0 1 dynamic dynamic ! +section dynamic 0 4 0 1 0 1 0 1 sdata sdata ! +section sdata 0 4 0 1 0 1 0 1 lit8 lit8 ! +section lit8 0 8 0 1 0 1 0 1 lit4 lit4 ! +section lit4 0 8 0 1 0 1 0 1 sbss sbss ! +section sbss 0 8 0 1 0 1 0 1 bss bss ! +section bss 0 8 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 100000 1 0 0 1 0 1 0 81f00000 81f00000 ! diff --git a/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_rom.h b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_rom.h @@ -0,0 +1,25 @@ +// eCos memory layout - Mon Apr 09 14:21:03 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x80000400) +#define CYGMEM_REGION_ram_SIZE (0x1fffc00) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0x9fc00000) +#define CYGMEM_REGION_rom_SIZE (0x400000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x81f00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_rom.ldi b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_rom.ldi @@ -0,0 +1,41 @@ +// eCos memory layout - Mon Apr 09 14:21:03 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x80000400, LENGTH = 0x1fffc00 + rom : ORIGIN = 0x9fc00000, LENGTH = 0x400000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x9fc00000, LMA_EQ_VMA) + SECTION_ROMISC (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_RELOCS (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_init (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x40), LMA_EQ_VMA) + SECTION_data (ram, 0x80000400, FOLLOWING (.rodata1)) + SECTION_data1 (ram, ALIGN (0x40), FOLLOWING (.data)) + SECTION_eh_frame (ram, ALIGN (0x40), FOLLOWING (.data1)) + SECTION_gcc_except_table (ram, ALIGN (0x40), FOLLOWING (.eh_frame)) + SECTION_ctors (ram, ALIGN (0x40), FOLLOWING (.gcc_except_table)) + SECTION_dtors (ram, ALIGN (0x40), FOLLOWING (.ctors)) + SECTION_devtab (ram, ALIGN (0x40), FOLLOWING (.dtors)) + SECTION_got (ram, ALIGN (0x40), FOLLOWING (.devtab)) + SECTION_dynamic (ram, ALIGN (0x40), FOLLOWING (.got)) + SECTION_sdata (ram, ALIGN (0x40), FOLLOWING (.dynamic)) + SECTION_lit8 (ram, ALIGN (0x40), FOLLOWING (.sdata)) + SECTION_lit4 (ram, ALIGN (0x40), FOLLOWING (.lit8)) + SECTION_sbss (ram, ALIGN (0x40), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x40), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x81f00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; + SECTIONS_END +} diff --git a/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_rom.mlt b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/pkgconf/mlt_mips_malta_rom.mlt @@ -0,0 +1,27 @@ +version 0 +region ram 80000400 1fffc00 0 ! +region rom 9fc00000 400000 1 ! +section data 0 40 1 1 1 1 0 1 80000400 data1 data1 ! +section data1 0 40 1 1 0 1 0 1 eh_frame eh_frame ! +section eh_frame 0 40 1 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 40 1 1 0 1 0 1 ctors ctors ! +section ctors 0 40 1 1 0 1 0 1 dtors dtors ! +section dtors 0 40 1 1 0 1 0 1 devtab devtab ! +section devtab 0 40 1 1 0 1 0 1 got got ! +section got 0 40 1 1 0 1 0 1 dynamic dynamic ! +section dynamic 0 40 1 1 0 1 0 1 sdata sdata ! +section sdata 0 40 1 1 0 1 0 1 lit8 lit8 ! +section lit8 0 40 1 1 0 1 0 1 lit4 lit4 ! +section lit4 0 40 1 1 0 1 0 0 sbss ! +section sbss 0 40 0 1 0 1 0 1 bss bss ! +section bss 0 40 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 100000 1 0 0 1 0 1 0 81f00000 81f00000 ! +section rom_vectors 0 1 0 1 1 1 1 1 9fc00000 9fc00000 ROMISC ROMISC ! +section ROMISC 0 40 0 1 0 1 0 1 RELOCS RELOCS ! +section RELOCS 0 40 0 1 0 1 0 1 init init ! +section init 0 40 0 1 0 1 0 1 text text ! +section text 0 40 0 1 0 1 0 1 fini fini ! +section fini 0 40 0 1 0 1 0 1 rodata rodata ! +section rodata 0 40 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 40 0 1 0 0 0 1 data ! diff --git a/packages/hal/mips/malta/current/include/platform.inc b/packages/hal/mips/malta/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/platform.inc @@ -0,0 +1,240 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## Malta board assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): dmoseley +## Contributors:dmoseley, jskov +## Date: 2001-03-20 +## Purpose: Malta board definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the Malta board. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include +#include + +#------------------------------------------------------------------------------ +# Additional bits for status register. +# We set the IM[0] bit to accept all interrupts. + +#define INITIAL_SR_PLF 0x00000400 + +#------------------------------------------------------------------------------ + +#define CYGPKG_HAL_RESET_VECTOR_FIRST_CODE + .macro hal_reset_vector_first_code + # Branch forward past the board ID register. + b 1f + nop + nop + nop + nop + nop +1: + .endm + +#define CYGPKG_HAL_EARLY_INIT + .macro hal_early_init + # Do these initializations early (rather than in hal_memc_init) so + # we have access to the LEDs on the board for debugging purposes. + + # + # WARNING: THESE WRITES NEED TO HANDLE BYTE-SWAPPING PROPERLY WHEN DOING BIG-ENDIAN + # + + # + # Setup Galileo CPU Interface Register + # + # Set the WriteRate bit - ie Accept 'DDD' back-to-back transfers (see CoreLV "Users Manual") + # All other bits stay the same + # + li k0, CYGARC_UNCACHED_ADDRESS(HAL_GALILEO_REGISTER_BASE) + lw k1, HAL_GALILEO_CPU_INTERFACE_CONFIG_OFFSET(k0) + li k0, HAL_GALILEO_CPU_WRITERATE_MASK + or k1, k1, k0 + li k0, CYGARC_UNCACHED_ADDRESS(HAL_GALILEO_REGISTER_BASE) + sw k1, HAL_GALILEO_CPU_INTERFACE_CONFIG_OFFSET(k0) + + # + # Use BootCS chip-select for the entire device bus region + # + li k1, 0 + sw k1, HAL_GALILEO_CS3_HIGH_DECODE_OFFSET(k0) + li k1, 0xf0 + sw k1, HAL_GALILEO_CSBOOT_LOW_DECODE_OFFSET(k0) + li k1, 0xff + sw k1, HAL_GALILEO_CSBOOT_HIGH_DECODE_OFFSET(k0) + .endm + +#------------------------------------------------------------------------------ +# Interrupt decode macros + +# Only INTN[0] is connected on the Malta board. We need to access the +# interrupt controller to get the actual vector number. + +#ifndef CYGPKG_HAL_MIPS_INTC_INIT_DEFINED + + .macro hal_intc_init + mfc0 v0,status + nop + lui v1,0xFFFF + ori v1,v1,0x04FF + and v0,v0,v1 # Clear the IntMask bits except IM[0] + mtc0 v0,status + nop + nop + nop + .endm + +#define CYGPKG_HAL_MIPS_INTC_INIT_DEFINED + +#endif + +#ifndef CYGPKG_HAL_MIPS_INTC_TRANSLATE_DEFINED +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + # When chaining, go through trampoline for external + # interrupts (we need to query the intc for the source) + # but let other internal vectors go directly to the + # chaining ISR. + .macro hal_intc_translate inum,vnum + beqz \inum,1f + move \vnum,\inum + ori \vnum,zero,CYGNUM_HAL_INTERRUPT_CHAINING +1: + .endm +#else + .macro hal_intc_translate inum,vnum + move \vnum,\inum # Vector == interrupt number + .endm +#endif + +#define CYGPKG_HAL_MIPS_INTC_TRANSLATE_DEFINED +#endif + +// We also define our own interrupt tables in platform.S... +#define CYG_HAL_MIPS_ISR_TABLES_DEFINED + +#------------------------------------------------------------------------------ +# Diagnostic macros + +#ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED + + .macro hal_diag_init + .endm + + .macro hal_diag_excpt_start + .endm + + .macro hal_diag_intr_start + .endm + + .macro hal_diag_restore + .endm + +#define CYGPKG_HAL_MIPS_DIAG_DEFINED + +#endif // ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED + +#------------------------------------------------------------------------------ +# MEMC macros. +# + +#if defined(CYG_HAL_STARTUP_ROM) + +#------------------------------------------------------------------------------ +# Make sure the jump to _start in vectors.S is done uncached +# + +#define CYGARC_START_FUNC_UNCACHED + + .macro hal_memc_init + .extern hal_malta_init_sdram + + lar k0,hal_malta_init_sdram + CYGARC_ADDRESS_REG_UNCACHED(k0) + jalr k0 + nop + + beqz v0, 2f + nop + + # Error in sizing memory + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS0, 'M') + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS1, 'E') + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS2, 'M') + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS3, 'E') + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS4, 'R') + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS5, 'R') + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS6, 'O') + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS7, 'R') +1: b 1b + nop + +2: # No error in sizing memory + + # Store the memory size at the base of RAM for later + la k0, 0x80000000 + move k1, k0 + CYGARC_ADDRESS_REG_UNCACHED(k1) + sw v1, 0(k1) + nop + nop + nop + .endm + +#define CYGPKG_HAL_MIPS_MEMC_DEFINED + +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/packages/hal/mips/malta/current/include/plf_cache.h b/packages/hal/mips/malta/current/include/plf_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/plf_cache.h @@ -0,0 +1,73 @@ +#ifndef CYGONCE_PLF_CACHE_H +#define CYGONCE_PLF_CACHE_H + +//============================================================================= +// +// plf_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors:nickg +// Date: 2001-03-20 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include + +//============================================================================= + +// Nothing here at present. + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_PLF_CACHE_H +// End of plf_cache.h + diff --git a/packages/hal/mips/malta/current/include/plf_intr.h b/packages/hal/mips/malta/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/plf_intr.h @@ -0,0 +1,303 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// Malta Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jskov, +// gthomas, jlarmour, dmoseley +// Date: 2001-03-20 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the Malta board. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +// First an assembly safe part + +//-------------------------------------------------------------------------- +// Interrupt vectors. + +#ifndef CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED + +// These are decoded via the IP bits of the cause +// register when an external interrupt is delivered. + +#define CYGNUM_HAL_INTERRUPT_SOUTH_BRIDGE_INTR 0 +#define CYGNUM_HAL_INTERRUPT_SOUTH_BRIDGE_SMI 1 +#define CYGNUM_HAL_INTERRUPT_CBUS_UART 2 +#define CYGNUM_HAL_INTERRUPT_COREHI 3 +#define CYGNUM_HAL_INTERRUPT_CORELO 4 +#define CYGNUM_HAL_INTERRUPT_COMPARE 5 + +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE 6 + +#define CYGNUM_HAL_INTERRUPT_CTRL1_BASE 6 +#define CYGNUM_HAL_INTERRUPT_TIMER 6 +#define CYGNUM_HAL_INTERRUPT_KEYBOARD 7 +#define CYGNUM_HAL_INTERRUPT_CASCADE 8 // this is where int ctrl2 is cascaded +#define CYGNUM_HAL_INTERRUPT_TTY1 9 +#define CYGNUM_HAL_INTERRUPT_TTY0 10 +#define CYGNUM_HAL_INTERRUPT_11 11 +#define CYGNUM_HAL_INTERRUPT_FLOPPY 12 +#define CYGNUM_HAL_INTERRUPT_PARALLEL 13 + +#define CYGNUM_HAL_INTERRUPT_CTRL2_BASE 14 +#define CYGNUM_HAL_INTERRUPT_REAL_TIME_CLOCK 14 +#define CYGNUM_HAL_INTERRUPT_I2C 15 +#define CYGNUM_HAL_INTERRUPT_PCI_AB 16 +#define CYGNUM_HAL_INTERRUPT_PCI_CD 17 +#define CYGNUM_HAL_INTERRUPT_MOUSE 18 +#define CYGNUM_HAL_INTERRUPT_19 19 +#define CYGNUM_HAL_INTERRUPT_IDE_PRIMARY 20 +#define CYGNUM_HAL_INTERRUPT_IDE_SECONDARY 21 + +#if defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN) + +// This overlaps with CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE above but it +// doesn't matter. It's only used by the HAL to access the special +// chaining entry in the ISR tables. All other attempted access to +// the ISR table will be redirected to this entry (courtesy of +// HAL_TRANSLATE_VECTOR). The other vector definitions are still +// valid, but only for enable/disable/config etc. (i.e., in chaining +// mode they have associated entries in the ISR tables). +#define CYGNUM_HAL_INTERRUPT_CHAINING 6 + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) \ + (_index_) = CYGNUM_HAL_INTERRUPT_CHAINING + +// Min/Max ISR numbers +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_INTERRUPT_CHAINING + +#else + +// Min/Max ISR numbers +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_INTERRUPT_IDE_SECONDARY +#endif // CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + +#define CYGNUM_HAL_ISR_COUNT (CYGNUM_HAL_ISR_MAX - CYGNUM_HAL_ISR_MIN + 1) + +// The vector used by the Real time clock +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_COMPARE + +#define CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED + +#endif + + +//-------------------------------------------------------------------------- +#ifndef __ASSEMBLER__ + +#include +#include + +//-------------------------------------------------------------------------- +// Interrupt controller access. + +#ifndef CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED + +// Array which stores the configured priority levels for the configured +// interrupts. +externC volatile CYG_BYTE hal_interrupt_level[CYGNUM_HAL_ISR_COUNT]; + +#define HAL_INTERRUPT_MASK( _vector_ ) \ + CYG_MACRO_START \ + if( (_vector_) <= CYGNUM_HAL_INTERRUPT_COMPARE ) \ + { \ + asm volatile ( \ + "mfc0 $3,$12\n" \ + "la $2,0x00000400\n" \ + "sllv $2,$2,%0\n" \ + "nor $2,$2,$0\n" \ + "and $3,$3,$2\n" \ + "mtc0 $3,$12\n" \ + "nop; nop; nop\n" \ + : \ + : "r"(_vector_) \ + : "$2", "$3" \ + ); \ + } \ + else if ((_vector_) >= CYGNUM_HAL_INTERRUPT_CTRL2_BASE) \ + { \ + cyg_uint8 _mask_; \ + cyg_uint32 _shift_ = (_vector_)-CYGNUM_HAL_INTERRUPT_CTRL2_BASE; \ + HAL_READ_UINT8(HAL_PIIX4_SLAVE_OCW1, _mask_ ); \ + _mask_ |= (1<<_shift_); \ + HAL_WRITE_UINT8(HAL_PIIX4_SLAVE_OCW1, _mask_ ); \ + } \ + else /* CTRL1 */ \ + { \ + cyg_uint8 _mask_; \ + cyg_uint32 _shift_ = (_vector_)-CYGNUM_HAL_INTERRUPT_CTRL1_BASE; \ + HAL_READ_UINT8(HAL_PIIX4_MASTER_OCW1, _mask_ ); \ + _mask_ |= (1<<_shift_); \ + HAL_WRITE_UINT8(HAL_PIIX4_MASTER_OCW1, _mask_ ); \ + } \ + CYG_MACRO_END + +#define HAL_INTERRUPT_UNMASK( _vector_ ) \ + CYG_MACRO_START \ + if( (_vector_) <= CYGNUM_HAL_INTERRUPT_COMPARE ) \ + { \ + asm volatile ( \ + "mfc0 $3,$12\n" \ + "la $2,0x00000400\n" \ + "sllv $2,$2,%0\n" \ + "or $3,$3,$2\n" \ + "mtc0 $3,$12\n" \ + "nop; nop; nop\n" \ + : \ + : "r"(_vector_) \ + : "$2", "$3" \ + ); \ + } \ + else if ((_vector_) >= CYGNUM_HAL_INTERRUPT_CTRL2_BASE) \ + { \ + cyg_uint8 _mask_; \ + cyg_uint32 _shift_ = (_vector_)-CYGNUM_HAL_INTERRUPT_CTRL2_BASE; \ + HAL_READ_UINT8(HAL_PIIX4_SLAVE_OCW1, _mask_ ); \ + _mask_ &= ~(1<<_shift_); \ + HAL_WRITE_UINT8(HAL_PIIX4_SLAVE_OCW1, _mask_ ); \ + } \ + else /* CTRL1 */ \ + { \ + cyg_uint8 _mask_; \ + cyg_uint32 _shift_ = (_vector_)-CYGNUM_HAL_INTERRUPT_CTRL1_BASE; \ + HAL_READ_UINT8(HAL_PIIX4_MASTER_OCW1, _mask_ ); \ + _mask_ &= ~(1<<_shift_); \ + HAL_WRITE_UINT8(HAL_PIIX4_MASTER_OCW1, _mask_ ); \ + } \ + CYG_MACRO_END + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \ + CYG_MACRO_START \ + cyg_uint32 _srvector_ = _vector_; \ + if ((_vector_) >= CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE) { \ + _srvector_ = CYGNUM_HAL_INTERRUPT_SOUTH_BRIDGE_INTR; \ + } \ + asm volatile ( \ + "mfc0 $3,$13\n" \ + "la $2,0x00000400\n" \ + "sllv $2,$2,%0\n" \ + "nor $2,$2,$0\n" \ + "and $3,$3,$2\n" \ + "mtc0 $3,$13\n" \ + "nop; nop; nop\n" \ + : \ + : "r"(_srvector_) \ + : "$2", "$3" \ + ); \ + CYG_MACRO_END + +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) \ + CYG_MACRO_START \ + if ((_vector_) >= CYGNUM_HAL_INTERRUPT_CTRL2_BASE) \ + { \ + cyg_uint8 _mask_; \ + cyg_uint32 _shift_ = (_vector_)-CYGNUM_HAL_INTERRUPT_CTRL2_BASE; \ + HAL_READ_UINT8(HAL_PIIX4_ELCR2, _mask_ ); \ + _mask_ &= ~(1<<_shift_); \ + if (_level_) _mask_ |= (1<<_shift_); \ + _mask_ &= HAL_PIIX4_ELCR2_MASK; \ + HAL_WRITE_UINT8(HAL_PIIX4_ELCR2, _mask_ ); \ + } \ + else if ((_vector_) >= CYGNUM_HAL_INTERRUPT_CTRL1_BASE) \ + { \ + cyg_uint8 _mask_; \ + cyg_uint32 _shift_ = (_vector_)-CYGNUM_HAL_INTERRUPT_CTRL1_BASE; \ + HAL_READ_UINT8(HAL_PIIX4_ELCR1, _mask_ ); \ + _mask_ &= ~(1<<_shift_); \ + if (_level_) _mask_ |= (1<<_shift_); \ + _mask_ &= HAL_PIIX4_ELCR1_MASK; \ + HAL_WRITE_UINT8(HAL_PIIX4_ELCR1, _mask_ ); \ + } \ + CYG_MACRO_END + +#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) + +#define CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED + +#endif + + +//-------------------------------------------------------------------------- +// Control-C support. + +#if defined(CYGDBG_HAL_MIPS_DEBUG_GDB_CTRLC_SUPPORT) + +# define CYGHWR_HAL_GDB_PORT_VECTOR CYGNUM_HAL_INTERRUPT_SER + +externC cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +# define HAL_CTRLC_ISR hal_ctrlc_isr + +#endif + + +//---------------------------------------------------------------------------- +// Reset. +#ifndef CYGHWR_HAL_RESET_DEFINED +extern void hal_malta_reset( void ); +#define CYGHWR_HAL_RESET_DEFINED +#define HAL_PLATFORM_RESET() hal_malta_reset() + +#define HAL_PLATFORM_RESET_ENTRY 0xbfc00000 + +#endif // CYGHWR_HAL_RESET_DEFINED + +#endif // __ASSEMBLER__ + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/mips/malta/current/include/plf_io.h b/packages/hal/mips/malta/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/plf_io.h @@ -0,0 +1,644 @@ +#ifndef CYGONCE_PLF_IO_H +#define CYGONCE_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// Platform specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley +// Contributors: dmoseley, jskov +// Date: 2001-03-20 +// Purpose: Malta platform IO support +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include +#include + +#ifdef __ASSEMBLER__ +#define HAL_REG(x) x +#define HAL_REG8(x) x +#define HAL_REG16(x) x +#else +#define HAL_REG(x) (volatile CYG_WORD *)(x) +#define HAL_REG8(x) (volatile CYG_BYTE *)(x) +#define HAL_REG16(x) (volatile CYG_WORD16 *)(x) +#endif + +//----------------------------------------------------------------------------- + +/* Malta Memory Definitions */ +#define HAL_MALTA_RAM_BASE 0x00000000 +#define HAL_MALTA_PCI_MEM0_BASE 0x08000000 +#define HAL_MALTA_PCI_MEM0_SIZE 0x08000000 // 128 MB +#define HAL_MALTA_PCI_MEM1_BASE 0x10000000 +#define HAL_MALTA_PCI_MEM1_SIZE 0x08000000 // 128 MB + +#define HAL_MALTA_PCI_IO_BASE 0x18000000 +#define HAL_MALTA_PCI_IO_SIZE 0x03d00000 // 62 MB +#define HAL_MALTA_CONTROLLER_BASE 0x1BE00000 +#define HAL_MALTA_CONTROLLER_BASE_ISD_CONFIG (HAL_MALTA_CONTROLLER_BASE >> 21) +#define HAL_MALTA_FLASH_BASE 0x1E000000 +#define HAL_MALTA_FLASH_SIZE SZ_4M +#define HAL_MALTA_MAX_BANKSIZE SZ_128M + +#define HAL_MALTA_NULL_DEVNUM 0x0 +#define HAL_MALTA_MEMERROR 1 + +// PCI registers +#define _PIIX4_PCI_ID 10 +#define _PIIX4_BRIDGE 0 +#define _PIIX4_IDE 1 +#define _PIIX4_USB 2 +#define _PIIX4_POWER 3 + +#define CYG_PCI_CFG_PIIX4_PIRQR 0x60 +#define CYG_PCI_CFG_PIIX4_SERIRQC 0x64 +#define CYG_PCI_CFG_PIIX4_TOM 0x69 +#define CYG_PCI_CFG_PIIX4_GENCFG 0xb0 + +#define CYG_PCI_CFG_PIIX4_IDETIM 0x40 +#define CYG_PCI_CFG_PIIX4_IDETIM_IDE 0x8000 +#define CYG_PCI_CFG_PIIX4_IDETIM_SITRE 0x4000 +#define CYG_PCI_CFG_PIIX4_IDETIM_DTE1 0x0080 +#define CYG_PCI_CFG_PIIX4_IDETIM_PPE1 0x0040 +#define CYG_PCI_CFG_PIIX4_IDETIM_IE1 0x0020 +#define CYG_PCI_CFG_PIIX4_IDETIM_TIME1 0x0010 +#define CYG_PCI_CFG_PIIX4_IDETIM_DTE0 0x0008 +#define CYG_PCI_CFG_PIIX4_IDETIM_PPE0 0x0004 +#define CYG_PCI_CFG_PIIX4_IDETIM_IE0 0x0002 +#define CYG_PCI_CFG_PIIX4_IDETIM_TIME0 0x0001 + +#define CYG_PCI_CFG_PIIX4_SERIRQC_ENABLE 0x80 +#define CYG_PCI_CFG_PIIX4_SERIRQC_CONT 0x40 + +#define CYG_PCI_CFG_PIIX4_TOM_TOM_MASK 0xf0 +#define CYG_PCI_CFG_PIIX4_TOM_TOM_16M 0xf0 + +#define CYG_PCI_CFG_PIIX4_GENCFG_ISA 0x00000001 +#define CYG_PCI_CFG_PIIX4_GENCFG_SERIRQ 0x00010000 + + + +/* Malta Registers */ +#define HAL_MALTA_REGISTER_BASE 0xBF000000 + +#define HAL_MALTA_NMISTATUS_OFFSET 0x00000024 +#define HAL_MALTA_NMIACK_OFFSET 0x00000104 +#define HAL_MALTA_SOFTRES_OFFSET 0x00000500 +#define HAL_MALTA_BRKRES_OFFSET 0x00000508 +#define HAL_MALTA_REVISION_OFFSET 0x00C00010 + +#define HAL_MALTA_NMISTATUS HAL_REG(HAL_MALTA_REGISTER_BASE + HAL_MALTA_NMISTATUS_OFFSET) +#define HAL_MALTA_NMIACK HAL_REG(HAL_MALTA_REGISTER_BASE + HAL_MALTA_NMIACK_OFFSET) +#define HAL_MALTA_SOFTRES HAL_REG(HAL_MALTA_REGISTER_BASE + HAL_MALTA_SOFTRES_OFFSET) +#define HAL_MALTA_BRKRES HAL_REG(HAL_MALTA_REGISTER_BASE + HAL_MALTA_BRKRES_OFFSET) +#define HAL_MALTA_REVISION HAL_REG(HAL_MALTA_REGISTER_BASE + HAL_MALTA_REVISION_OFFSET) + +/* Malta NMI controller fields */ +#define HAL_MALTA_NMISTATUS_FLAG 0x00000001 +#define HAL_MALTA_NMIACK_FLAG 0x00000001 + +/* Malta softreset fields */ +#define HAL_MALTA_GORESET 0x42 + +/* Malta brkreset fields */ +#define HAL_MALTA_BRKRES_DEFAULT_VALUE 0xA + +// PIIX4 registers +#define HAL_PIIX4_REGISTER_BASE 0xb8000000 + +// PIIX4 interrupt controller stuff +#define HAL_PIIX4_MASTER_ICW1 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x0020) +#define HAL_PIIX4_MASTER_ICW2 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x0021) +#define HAL_PIIX4_MASTER_ICW3 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x0021) +#define HAL_PIIX4_MASTER_ICW4 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x0021) +#define HAL_PIIX4_MASTER_OCW3 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x0020) +#define HAL_PIIX4_MASTER_OCW1 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x0021) + +#define HAL_PIIX4_SLAVE_ICW1 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x00a0) +#define HAL_PIIX4_SLAVE_OCW3 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x00a0) +#define HAL_PIIX4_SLAVE_ICW2 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x00a1) +#define HAL_PIIX4_SLAVE_ICW3 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x00a1) +#define HAL_PIIX4_SLAVE_ICW4 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x00a1) +#define HAL_PIIX4_SLAVE_OCW1 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x00a1) + +#define HAL_PIIX4_MASTER_SLAVE_OFFSET 0x80 + +#define HAL_PIIX4_ELCR1 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x04d0) +#define HAL_PIIX4_ELCR2 HAL_REG(HAL_PIIX4_REGISTER_BASE + 0x04d1) + +#define HAL_PIIX4_ICW1_SEL 0x10 +#define HAL_PIIX4_ICW1_WR 0x01 +#define HAL_PIIX4_ICW3_CASCADE 0x04 +#define HAL_PIIX4_ICW3_SLAVE 0x02 +#define HAL_PIIX4_ICW4_UPMODE 0x01 + +#define HAL_PIIX4_OCW3_ESSM 0x40 +#define HAL_PIIX4_OCW3_SEL 0x08 +#define HAL_PIIX4_OCW3_REQ 0x02 +#define HAL_PIIX4_OCW3_IS 0x03 + +#define HAL_PIIX4_ELCR1_MASK 0xf8 +#define HAL_PIIX4_ELCR2_MASK 0xde + +// PIIX4 IDE interface +#define HAL_PIIX4_IDE_PRI_CMD (HAL_PIIX4_REGISTER_BASE + 0x01f0) +#define HAL_PIIX4_IDE_PRI_CTL (HAL_PIIX4_REGISTER_BASE + 0x03f4) +#define HAL_PIIX4_IDE_SEC_CMD (HAL_PIIX4_REGISTER_BASE + 0x0170) +#define HAL_PIIX4_IDE_SEC_CTL (HAL_PIIX4_REGISTER_BASE + 0x0374) + +/* Galileo Registers */ +#define HAL_GALILEO_REGISTER_BASE 0xB4000000 +#define HAL_GALILEO_PCI0_MEM0_BASE 0xB2000000 + +#define HAL_GALILEO_CPU_INTERFACE_CONFIG_OFFSET 0x0 +#define HAL_GALILEO_INT_SPACE_DECODE_OFFSET 0x68 +#define HAL_GALILEO_CS3_HIGH_DECODE_OFFSET 0x43c +#define HAL_GALILEO_CSBOOT_LOW_DECODE_OFFSET 0x440 +#define HAL_GALILEO_CSBOOT_HIGH_DECODE_OFFSET 0x444 + +/* Galileo CPU Interface config fields */ +#define HAL_GALILEO_BYTE_SWAP (BIT16 | BIT0) + +#define HAL_GALILEO_CACHEOPMAP_MASK 0x000001FF +#define HAL_GALILEO_CACHEPRES_MASK 0x00000200 +#define HAL_GALILEO_WRITEMODE_MASK 0x00000800 +#define HAL_GALILEO_ENDIAN_MASK 0x00001000 +#define HAL_GALILEO_R5KL2_MASK 0x00004000 +#define HAL_GALILEO_EXT_HIT_DELAY_MASK 0x00008000 +#define HAL_GALILEO_CPU_WRITERATE_MASK 0x00010000 +#define HAL_GALILEO_STOP_RETRY_MASK 0x00020000 +#define HAL_GALILEO_MULTI_GT_MASK 0x00040000 +#define HAL_GALILEO_SYSADCVALID_MASK 0x00080000 + +/* Galileo Memory Controller registers */ +#define HAL_GALILEO_SDRAM_DUPLICATE_BANK_ADDR BIT20 +#define HAL_GALILEO_SDRAM_BANK_INTERLEAVE_DIS BIT14 +#define HAL_GALILEO_CPU_DECODE_SHIFT 21 +#define HAL_GALILEO_DEV_DECODE_SHIFT 20 +#define HAL_GALILEO_SDRAM_SRAS_TO_SCAS_DELAY_3C BIT10 +#define HAL_GALILEO_SDRAM_WIDTH_64BIT BIT6 +#define HAL_GALILEO_SDRAM_SRAS_PRECHARGE_3C BIT3 +#define HAL_GALILEO_SDRAM_BANK0_CASLAT_2 BIT0 +#define HAL_GALILEO_SDRAM_BANK0_SZ_64M BIT11 +#define HAL_GALILEO_SDRAM_NUM_BANKS_4 BIT5 +#define HAL_GALILEO_SDRAM_BANK0_PARITY BIT8 +#define HAL_GALILEO_SDRAM_CFG_RAM_WIDTH BIT15 +#define HAL_GALILEO_PCI0_CONFIG_ADDR_ConfigEn BIT31 +#define HAL_GALILEO_PCI0_STATUS_COMMAND_REGNUM 0x04 +#define HAL_GALILEO_PCI0_BIST_REGNUM 0x0C +#define HAL_GALILEO_PCI0_SCS32_BASE_REGNUM 0x14 +#define HAL_GALILEO_PCI0_CONFIG_IOEn 0x1 +#define HAL_GALILEO_PCI0_CONFIG_MEMEn 0x2 +#define HAL_GALILEO_PCI0_CONFIG_MasEn 0x4 +#define HAL_GALILEO_PCI0_CONFIG_SErrEn 0x100 +#define HAL_GALILEO_PCI0_LAT_TIMER_VAL 0x800 +#define HAL_GALILEO_PCI0_TIMEOUT_RETRY_VALUE 0x00ffffff + +#define HAL_GALILEO_SDRAM_BANK0_OFFSET 0x44c +#define HAL_GALILEO_SDRAM_BANK2_OFFSET 0x454 +#define HAL_GALILEO_SDRAM_CONFIG_OFFSET 0x448 + +#define HAL_GALILEO_SCS10_LD_OFFSET 0x008 +#define HAL_GALILEO_SCS10_HD_OFFSET 0x010 +#define HAL_GALILEO_SCS32_LD_OFFSET 0x018 +#define HAL_GALILEO_SCS32_HD_OFFSET 0x020 +#define HAL_GALILEO_CS20_LD_OFFSET 0x028 +#define HAL_GALILEO_CS20_HD_OFFSET 0x030 +#define HAL_GALILEO_PCIIO_LD_OFFSET 0x048 +#define HAL_GALILEO_PCIIO_HD_OFFSET 0x050 +#define HAL_GALILEO_PCIMEM0_LD_OFFSET 0x058 +#define HAL_GALILEO_PCIMEM0_HD_OFFSET 0x060 +#define HAL_GALILEO_PCIMEM1_LD_OFFSET 0x080 +#define HAL_GALILEO_PCIMEM1_HD_OFFSET 0x088 +#define HAL_GALILEO_PCI1IO_LD_OFFSET 0x090 +#define HAL_GALILEO_PCI1IO_HD_OFFSET 0x098 +#define HAL_GALILEO_PCI1MEM0_LD_OFFSET 0x0a0 +#define HAL_GALILEO_PCI1MEM0_HD_OFFSET 0x0a8 +#define HAL_GALILEO_PCI1MEM1_LD_OFFSET 0x0b0 +#define HAL_GALILEO_PCI1MEM1_HD_OFFSET 0x0b8 +#define HAL_GALILEO_PCI_IO_REMAP 0x0f0 + +#define HAL_GALILEO_SCS0_LD_OFFSET 0x400 +#define HAL_GALILEO_SCS0_HD_OFFSET 0x404 +#define HAL_GALILEO_SCS1_LD_OFFSET 0x408 +#define HAL_GALILEO_SCS1_HD_OFFSET 0x40c +#define HAL_GALILEO_SCS2_LD_OFFSET 0x410 +#define HAL_GALILEO_SCS2_HD_OFFSET 0x414 +#define HAL_GALILEO_SCS3_LD_OFFSET 0x418 +#define HAL_GALILEO_SCS3_HD_OFFSET 0x41c +#define HAL_GALILEO_CS0_LD_OFFSET 0x420 +#define HAL_GALILEO_CS0_HD_OFFSET 0x424 +#define HAL_GALILEO_CS1_LD_OFFSET 0x428 +#define HAL_GALILEO_CS1_HD_OFFSET 0x42c +#define HAL_GALILEO_CS2_LD_OFFSET 0x430 +#define HAL_GALILEO_CS2_HD_OFFSET 0x434 + +// GALILEO PCI Internal +#define HAL_GALILEO_PCI_INTERNAL_COMMAND_OFFSET 0xC00 +#define HAL_GALILEO_PCI0_TIMEOUT_RETRY_OFFSET 0xc04 +#define HAL_GALILEO_PCI0_SCS10_SIZE_OFFSET 0xc08 +#define HAL_GALILEO_PCI0_SCS32_SIZE_OFFSET 0xc0c +#define HAL_GALILEO_PCI0_SCS20_SIZE_OFFSET 0xc10 +#define HAL_GALILEO_PCI0_CS3_SIZE_OFFSET 0xc14 +#define HAL_GALILEO_BAR_ENA_OFFSET 0xc3c +# define HAL_GALILEO_BAR_ENA_SWCS3 (1 << 0) +# define HAL_GALILEO_BAR_ENA_SWCS32 (1 << 1) +# define HAL_GALILEO_BAR_ENA_SWCS10 (1 << 2) +# define HAL_GALILEO_BAR_ENA_IO (1 << 3) +# define HAL_GALILEO_BAR_ENA_MEM (1 << 4) +# define HAL_GALILEO_BAR_ENA_CS3 (1 << 5) +# define HAL_GALILEO_BAR_ENA_CS20 (1 << 6) +# define HAL_GALILEO_BAR_ENA_SCS32 (1 << 7) +# define HAL_GALILEO_BAR_ENA_SCS10 (1 << 8) +#define HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET 0xcf8 +# define HAL_GALILEO_PCI0_CONFIG_ADDR_ENABLE (1 << 31) +#define HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET 0xcfc + +// GALILEO Interrupts +#define HAL_GALILEO_IRQ_CAUSE_OFFSET 0xc18 +# define HAL_GALILEO_IRQCAUSE_INTSUM (1 << 0) +# define HAL_GALILEO_IRQCAUSE_MEMOUT (1 << 1) +# define HAL_GALILEO_IRQCAUSE_DMAOUT (1 << 2) +# define HAL_GALILEO_IRQCAUSE_CPUOUT (1 << 3) +# define HAL_GALILEO_IRQCAUSE_DMA0 (1 << 4) +# define HAL_GALILEO_IRQCAUSE_DMA1 (1 << 5) +# define HAL_GALILEO_IRQCAUSE_DMA2 (1 << 6) +# define HAL_GALILEO_IRQCAUSE_DMA3 (1 << 7) +# define HAL_GALILEO_IRQCAUSE_T0 (1 << 8) +# define HAL_GALILEO_IRQCAUSE_T1 (1 << 9) +# define HAL_GALILEO_IRQCAUSE_T2 (1 << 10) +# define HAL_GALILEO_IRQCAUSE_T3 (1 << 11) +# define HAL_GALILEO_IRQCAUSE_MASRD (1 << 12) +# define HAL_GALILEO_IRQCAUSE_SLVWR (1 << 13) +# define HAL_GALILEO_IRQCAUSE_MASWR (1 << 14) +# define HAL_GALILEO_IRQCAUSE_SLVRD (1 << 15) +# define HAL_GALILEO_IRQCAUSE_AERR (1 << 16) +# define HAL_GALILEO_IRQCAUSE_MERR (1 << 17) +# define HAL_GALILEO_IRQCAUSE_MASABT (1 << 18) +# define HAL_GALILEO_IRQCAUSE_TARABT (1 << 19) +# define HAL_GALILEO_IRQCAUSE_RETRY (1 << 20) +# define HAL_GALILEO_IRQCAUSE_CPUSUM (1 << 30) +# define HAL_GALILEO_IRQCAUSE_PCISUM (1 << 31) +#define HAL_GALILEO_HIRQ_CAUSE_OFFSET 0xc98 +#define HAL_GALILEO_CPUIRQ_MASK_OFFSET 0xc1c +#define HAL_GALILEO_CPUHIRQ_MASK_OFFSET 0xc9c + + +#define HAL_I2CFPGA_BASE 0x1f000b00 +#define HAL_I2CFPGA_INP 0x00 +#define HAL_I2CFPGA_OE 0x08 +#define HAL_I2CFPGA_OUT 0x10 +#define HAL_I2CFPGA_SEL 0x18 + +#define HAL_I2CFPGA_SEL_FPGA 0x00000001 +#define HAL_I2CFPGA_SEL_SB 0x00000000 + +#define HAL_I2CFPGA_OE_SCL_OUT 0x00000002 +#define HAL_I2CFPGA_OE_SCL_TRI 0x00000000 +#define HAL_I2CFPGA_OE_SDA_OUT 0x00000001 +#define HAL_I2CFPGA_OE_SDA_TRI 0x00000000 + +#define HAL_I2CFPGA_OUT_SCL_HIGH 0x00000002 +#define HAL_I2CFPGA_OUT_SCL_LOW 0x00000000 +#define HAL_I2CFPGA_OUT_SDA_HIGH 0x00000001 +#define HAL_I2CFPGA_OUT_SDA_LOW 0x00000000 + + +#define HAL_I2CFPGA_IN_SDA_MASK 0x00000001 + +#define HAL_I2CFPGA_OUT_SDA_ACK 0x00000000 +#define HAL_I2CFPGA_OUT_SDA_NACK 0x00000001 +#define HAL_I2CFPGA_OUT_SDA_WAIT_ACK 0x00000001 + + +#define HAL_I2C_WRITE 0x00 +#define HAL_I2C_READ 0x01 + +#define HAL_I2C_SPD_ADDRESS 0xa0 + +#define HAL_I2C_COUT_DOUT (HAL_I2CFPGA_OE_SCL_OUT|HAL_I2CFPGA_OE_SDA_OUT) +#define HAL_I2C_COUT_DIN (HAL_I2CFPGA_OE_SCL_OUT|HAL_I2CFPGA_OE_SDA_TRI) +#define HAL_I2C_CIN_DIN (HAL_I2CFPGA_OE_SCL_TRI|HAL_I2CFPGA_OE_SDA_TRI) +#define HAL_I2C_CHIGH_DHIGH (HAL_I2CFPGA_OUT_SCL_HIGH|HAL_I2CFPGA_OUT_SDA_HIGH) +#define HAL_I2C_CHIGH_DLOW (HAL_I2CFPGA_OUT_SCL_HIGH|HAL_I2CFPGA_OUT_SDA_LOW) +#define HAL_I2C_CLOW_DLOW (HAL_I2CFPGA_OUT_SCL_LOW|HAL_I2CFPGA_OUT_SDA_LOW) +#define HAL_I2C_CLOW_DHIGH (HAL_I2CFPGA_OUT_SCL_LOW|HAL_I2CFPGA_OUT_SDA_HIGH) + + +#define HAL_SPD_GET_NUM_ROW_BITS 3 +#define HAL_SPD_GET_NUM_COL_BITS 4 +#define HAL_SPD_GET_NUM_MODULE_BANKS 5 +#define HAL_SPD_GET_SDRAM_WIDTH 6 +#define HAL_SPD_GET_CONFIG_TYPE 11 +#define HAL_SPD_GET_REFRESH_RATE 12 +#define HAL_SPD_GET_ERROR_CHECK_WIDTH 14 +#define HAL_SPD_GET_BURST_LENGTH 16 +#define HAL_SPD_GET_NUM_DEVICE_BANKS 17 +#define HAL_SPD_GET_CAS_LAT 18 +#define HAL_SPD_GET_ROW_DENSITY 31 +#define HAL_SPD_CONFIG_TYPE_PARITY BIT0 +#define HAL_SPD_CONFIG_TYPE_ECC BIT1 +#define HAL_SPD_REFRESH_RATE_125 5 +#define HAL_SPD_REFRESH_RATE_62_5 4 +#define HAL_SPD_REFRESH_RATE_31_3 3 +#define HAL_SPD_REFRESH_RATE_15_625 0 +#define HAL_SPD_REFRESH_RATE_7_8 2 +#define HAL_SPD_REFRESH_RATE_3_9 1 + +#define HAL_SPD_REFRESH_COUNTER_125 (125*2) +#define HAL_SPD_REFRESH_COUNTER_62_5 (62*2) +#define HAL_SPD_REFRESH_COUNTER_31_3 (31*2) +#define HAL_SPD_REFRESH_COUNTER_15_625 (15*2) +#define HAL_SPD_REFRESH_COUNTER_7_8 (7*2) +#define HAL_SPD_REFRESH_COUNTER_3_9 (3*2) + +/* Malta Display Registers */ +#define HAL_DISPLAY_BASE (HAL_MALTA_REGISTER_BASE + 0x400) + +#define HAL_DISPLAY_LEDGREEN_OFFSET 0x00 +#define HAL_DISPLAY_LEDBAR_OFFSET 0x08 +#define HAL_DISPLAY_ASCIIWORD_OFFSET 0x10 +#define HAL_DISPLAY_ASCIIPOS0_OFFSET 0x18 +#define HAL_DISPLAY_ASCIIPOS1_OFFSET 0x20 +#define HAL_DISPLAY_ASCIIPOS2_OFFSET 0x28 +#define HAL_DISPLAY_ASCIIPOS3_OFFSET 0x30 +#define HAL_DISPLAY_ASCIIPOS4_OFFSET 0x38 +#define HAL_DISPLAY_ASCIIPOS5_OFFSET 0x40 +#define HAL_DISPLAY_ASCIIPOS6_OFFSET 0x48 +#define HAL_DISPLAY_ASCIIPOS7_OFFSET 0x50 + +#define HAL_DISPLAY_LEDGREEN HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_LEDGREEN_OFFSET) +#define HAL_DISPLAY_LEDBAR HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_LEDBAR_OFFSET) +#define HAL_DISPLAY_ASCIIWORD HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIWORD_OFFSET) +#define HAL_DISPLAY_ASCIIPOS0 HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS0_OFFSET) +#define HAL_DISPLAY_ASCIIPOS1 HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS1_OFFSET) +#define HAL_DISPLAY_ASCIIPOS2 HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS2_OFFSET) +#define HAL_DISPLAY_ASCIIPOS3 HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS3_OFFSET) +#define HAL_DISPLAY_ASCIIPOS4 HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS4_OFFSET) +#define HAL_DISPLAY_ASCIIPOS5 HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS5_OFFSET) +#define HAL_DISPLAY_ASCIIPOS6 HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS6_OFFSET) +#define HAL_DISPLAY_ASCIIPOS7 HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS7_OFFSET) + +#ifdef __ASSEMBLER__ + +# define DEBUG_ASCII_DISPLAY(register, character) \ + li k0, CYGARC_UNCACHED_ADDRESS(register); \ + li k1, character; \ + sw k1, 0(k0); \ + nop; \ + nop; \ + nop + +# define DEBUG_LED_IMM(val) \ + li k0, HAL_DISPLAY_LEDBAR; \ + li k1, val; \ + sw k1, 0(k0) + +# define DEBUG_LED_REG(reg) \ + li k0, HAL_DISPLAY_LEDBAR; \ + sw reg, 0(k0) + +# define DEBUG_HEX_DISPLAY_IMM(val) \ + li k0, HAL_DISPLAY_ASCIIWORD; \ + li k1, val; \ + sw k1, 0(k0) + +# define DEBUG_HEX_DISPLAY_REG(reg) \ + li k0, HAL_DISPLAY_ASCIIWORD; \ + sw reg, 0(k0) + +# define DEBUG_DELAY() \ + li k0, 0x20000; \ +0: sub k0, k0, 1; \ + bnez k0, 0b; \ + nop + +#else + +# define DEBUG_ASCII_DISPLAY(register, character) \ + *(register) = character + +# define DEBUG_LED_IMM(val) \ + *HAL_DISPLAY_LEDBAR = val + +# define DEBUG_HEX_DISPLAY_IMM(val) \ + *HAL_DISPLAY_ASCIIWORD = val + +# define DEBUG_DELAY() \ + { \ + volatile int i = 0x20000; \ + while (--i) ; \ + } + +# define DEBUG_DISPLAY(str) \ + { \ + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS0, str[0]); \ + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS1, str[1]); \ + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS2, str[2]); \ + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS3, str[3]); \ + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS4, str[4]); \ + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS5, str[5]); \ + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS6, str[6]); \ + DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS7, str[7]); \ + } + + +#define HAL_GALILEO_PUTREG(x,y) \ + (*((volatile unsigned *)(CYGARC_UNCACHED_ADDRESS(HAL_MALTA_CONTROLLER_BASE) + (x))) = (y)) +#define HAL_GALILEO_GETREG(x) \ + (*((volatile unsigned *)(CYGARC_UNCACHED_ADDRESS(HAL_MALTA_CONTROLLER_BASE) + (x)))) + + +extern cyg_uint32 cyg_hal_plf_pci_cfg_read_dword (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset); +extern cyg_uint16 cyg_hal_plf_pci_cfg_read_word (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset); +extern cyg_uint8 cyg_hal_plf_pci_cfg_read_byte (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset); +extern void cyg_hal_plf_pci_cfg_write_dword (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint32 val); +extern void cyg_hal_plf_pci_cfg_write_word (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint16 val); +extern void cyg_hal_plf_pci_cfg_write_byte (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint8 val); + +// Initialize the PCI bus. +externC void cyg_hal_plf_pci_init(void); +#define HAL_PCI_INIT() cyg_hal_plf_pci_init() + +// leave gap at start of IO and mem for southbridge which is beyond standards +// and not only ignores writes to the BAR, but also does not advertise use of +// any IO/memory space. That is, southbridge is hardwired at 0x18000000 + +// Map PCI device resources starting from these addresses in PCI space. +#define HAL_PCI_ALLOC_BASE_MEMORY (HAL_MALTA_PCI_MEM0_BASE + 0x20000) +#define HAL_PCI_ALLOC_BASE_IO 0x10000 + +// This is where the PCI spaces are mapped in the CPU's address space. +// +#define HAL_PCI_PHYSICAL_MEMORY_BASE CYGARC_UNCACHED_ADDRESS(0) +#define HAL_PCI_PHYSICAL_IO_BASE CYGARC_UNCACHED_ADDRESS(HAL_MALTA_PCI_IO_BASE) + +// Read a value from the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +#define HAL_PCI_CFG_READ_UINT8( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_plf_pci_cfg_read_byte((__bus), (__devfn), (__offset)) + +#define HAL_PCI_CFG_READ_UINT16( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_plf_pci_cfg_read_word((__bus), (__devfn), (__offset)) + +#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_plf_pci_cfg_read_dword((__bus), (__devfn), (__offset)) + +// Write a value to the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +#define HAL_PCI_CFG_WRITE_UINT8( __bus, __devfn, __offset, __val ) \ + cyg_hal_plf_pci_cfg_write_byte((__bus), (__devfn), (__offset), (__val)) + +#define HAL_PCI_CFG_WRITE_UINT16( __bus, __devfn, __offset, __val ) \ + cyg_hal_plf_pci_cfg_write_word((__bus), (__devfn), (__offset), (__val)) + +#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \ + cyg_hal_plf_pci_cfg_write_dword((__bus), (__devfn), (__offset), (__val)) + + +// Translate the PCI interrupt requested by the device (INTA#, INTB#, +// INTC# or INTD#) to the associated CPU interrupt (i.e., HAL vector). +#define HAL_PCI_TRANSLATE_INTERRUPT( __bus, __devfn, __vec, __valid) \ + CYG_MACRO_START \ + cyg_uint8 __req; \ + HAL_PCI_CFG_READ_UINT8(__bus, __devfn, CYG_PCI_CFG_INT_PIN, __req); \ + if (0 != __req) { \ + /* Interrupt assignment as Galileo sees them. */ \ + /* (From Malta User's Manual, 6.1 PCI Bus) */ \ + CYG_ADDRWORD __translation[4] = { \ + CYGNUM_HAL_INTERRUPT_PCI_AB, /* INTB# */ \ + CYGNUM_HAL_INTERRUPT_PCI_CD, /* INTC# */ \ + CYGNUM_HAL_INTERRUPT_PCI_CD, /* INTD# */ \ + CYGNUM_HAL_INTERRUPT_PCI_AB}; /* INTA# */ \ + \ + /* The PCI lines from the different slots are wired like this */ \ + /* on the PCI backplane: */ \ + /* PCI_AB PCI_AB PCI_CD PCI_CD */ \ + /* AMD PCnet INTA# */ \ + /* I/O Slot 1 INTA# INTB# INTC# INTD# */ \ + /* I/O Slot 2 INTD# INTA# INTB# INTC# */ \ + /* I/O Slot 3 INTC# INTD# INTA# INTB# */ \ + /* I/O Slot 4 INTB# INTC# INTD# INTA# */ \ + /* */ \ + /* Devsel signals are wired to, resulting in device IDs: */ \ + /* AMD PCnet AD21 / dev 11 [(11+1)&3 = 0] */ \ + /* I/O Slot 1 AD28 / dev 18 [(18+1)&3 = 3] */ \ + /* I/O Slot 2 AD29 / dev 19 [(19+1)&3 = 0] */ \ + /* I/O Slot 3 AD30 / dev 20 [(20+1)&3 = 1] */ \ + /* I/O Slot 4 AD31 / dev 21 [(21+1)&3 = 2] */ \ + \ + __vec = __translation[((__req+CYG_PCI_DEV_GET_DEV(__devfn))&3)]; \ + __valid = true; \ + } else { \ + /* Device will not generate interrupt requests. */ \ + __valid = false; \ + } \ + CYG_MACRO_END + +// Galileo GT64120 on MIPS MALTA requires special processing. +// First, it will hang when accessing device 31 on the local bus. +// Second, we need to ignore the GT64120 so we can set it up +// outside the generic PCI library. +#define HAL_PCI_IGNORE_DEVICE(__bus, __dev, __fn) \ + ((__bus) == 0 && ((__dev) == 0 || (__dev) == 31)) + +// Bus address translation macros +#define HAL_PCI_CPU_TO_BUS(__cpu_addr, __bus_addr) \ + CYG_MACRO_START \ + (__bus_addr) = CYGARC_PHYSICAL_ADDRESS((cyg_uint32)__cpu_addr); \ + CYG_MACRO_END + +#define HAL_PCI_BUS_TO_CPU(__bus_addr, __cpu_addr) \ + CYG_MACRO_START \ + (__cpu_addr) = CYGARC_UNCACHED_ADDRESS(__bus_addr); \ + CYG_MACRO_END + + +// IDE interface macros +// +#define HAL_IDE_NUM_CONTROLLERS 2 + +// Initialize the IDE controller(s). +externC void cyg_hal_plf_ide_init(void); +#define HAL_IDE_INIT() cyg_hal_plf_ide_init() + +#define HAL_IDE_READ_UINT8( __ctlr, __regno, __val ) \ + __val = *HAL_REG8(((__ctlr) ? HAL_PIIX4_IDE_SEC_CMD : HAL_PIIX4_IDE_PRI_CMD) + (__regno)) +#define HAL_IDE_READ_UINT16( __ctlr, __regno, __val ) \ + __val = *HAL_REG16(((__ctlr) ? HAL_PIIX4_IDE_SEC_CMD : HAL_PIIX4_IDE_PRI_CMD) + (__regno)) +#define HAL_IDE_READ_ALTSTATUS( __ctlr, __val ) \ + __val = *HAL_REG16(((__ctlr) ? HAL_PIIX4_IDE_SEC_CTL : HAL_PIIX4_IDE_PRI_CTL) + 2) + +#define HAL_IDE_WRITE_UINT8( __ctlr, __regno, __val ) \ + *HAL_REG8( ((__ctlr) ? HAL_PIIX4_IDE_SEC_CMD : HAL_PIIX4_IDE_PRI_CMD) + (__regno)) = (__val) +#define HAL_IDE_WRITE_UINT16( __ctlr, __regno, __val ) \ + *HAL_REG16( ((__ctlr) ? HAL_PIIX4_IDE_SEC_CMD : HAL_PIIX4_IDE_PRI_CMD) + (__regno)) = (__val) +#define HAL_IDE_WRITE_CONTROL( __ctlr, __val ) \ + *HAL_REG8( ((__ctlr) ? HAL_PIIX4_IDE_SEC_CTL : HAL_PIIX4_IDE_PRI_CTL) + 2) = (__val) + +#endif + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_PLF_IO_H diff --git a/packages/hal/mips/malta/current/include/plf_stub.h b/packages/hal/mips/malta/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/include/plf_stub.h @@ -0,0 +1,84 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov, dmoseley +// Date: 2001-03-20 +// Purpose: Platform HAL stub support for MIPS Malta boards. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 +#define HAL_STUB_PLATFORM_INIT_BREAK_IRQ() CYG_EMPTY_STATEMENT + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/mips/malta/current/misc/redboot_RAM.ecm b/packages/hal/mips/malta/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/misc/redboot_RAM.ecm @@ -0,0 +1,106 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware malta ; + template redboot ; + package -hardware CYGPKG_HAL_MIPS current ; + package -hardware CYGPKG_HAL_MIPS_MIPS32 current ; + package -hardware CYGPKG_HAL_MIPS_MALTA current ; + package -hardware CYGPKG_DEVS_FLASH_INTEL_28FXXX current ; + package -hardware CYGPKG_DEVS_FLASH_MALTA current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_AMD_PCNET current ; + package -hardware CYGPKG_DEVS_ETH_MIPS_MIPS32_MALTA current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGHWR_HAL_MIPS_MIPS32_CORE { + user_value 4Kc +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + inferred_value 0x40000 +}; + +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_INTEL_28F160S5 { + inferred_value 1 +}; + + diff --git a/packages/hal/mips/malta/current/misc/redboot_RAM_5kc.ecm b/packages/hal/mips/malta/current/misc/redboot_RAM_5kc.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/misc/redboot_RAM_5kc.ecm @@ -0,0 +1,110 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware malta ; + template redboot ; + package -hardware CYGPKG_HAL_MIPS current ; + package -hardware CYGPKG_HAL_MIPS_MIPS64 current ; + package -hardware CYGPKG_HAL_MIPS_MALTA current ; + package -hardware CYGPKG_DEVS_FLASH_INTEL_28FXXX current ; + package -hardware CYGPKG_DEVS_FLASH_MALTA current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_AMD_PCNET current ; + package -hardware CYGPKG_DEVS_ETH_MIPS_MIPS32_MALTA current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_MEMALLOC current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGHWR_HAL_MIPS_MIPS64_CORE { + user_value 5K +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + inferred_value 0x40000 +}; + +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_INTEL_28F160S5 { + inferred_value 1 +}; + + diff --git a/packages/hal/mips/malta/current/misc/redboot_ROM.ecm b/packages/hal/mips/malta/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/misc/redboot_ROM.ecm @@ -0,0 +1,114 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware malta ; + template redboot ; + package -hardware CYGPKG_HAL_MIPS current ; + package -hardware CYGPKG_HAL_MIPS_MIPS32 current ; + package -hardware CYGPKG_HAL_MIPS_MALTA current ; + package -hardware CYGPKG_DEVS_FLASH_INTEL_28FXXX current ; + package -hardware CYGPKG_DEVS_FLASH_MALTA current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_AMD_PCNET current ; + package -hardware CYGPKG_DEVS_ETH_MIPS_MIPS32_MALTA current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_MEMALLOC current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_MIPS_MIPS32_CORE { + user_value 4Kc +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + inferred_value 0x40000 +}; + +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_INTEL_28F160S5 { + inferred_value 1 +}; + + diff --git a/packages/hal/mips/malta/current/misc/redboot_ROM_5kc.ecm b/packages/hal/mips/malta/current/misc/redboot_ROM_5kc.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/misc/redboot_ROM_5kc.ecm @@ -0,0 +1,114 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware malta ; + template redboot ; + package -hardware CYGPKG_HAL_MIPS current ; + package -hardware CYGPKG_HAL_MIPS_MIPS64 current ; + package -hardware CYGPKG_HAL_MIPS_MALTA current ; + package -hardware CYGPKG_DEVS_FLASH_INTEL_28FXXX current ; + package -hardware CYGPKG_DEVS_FLASH_MALTA current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_AMD_PCNET current ; + package -hardware CYGPKG_DEVS_ETH_MIPS_MIPS32_MALTA current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_MEMALLOC current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_MIPS_MIPS64_CORE { + user_value 5K +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + inferred_value 0x40000 +}; + +cdl_component CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_INTEL_28F160S5 { + inferred_value 1 +}; + + diff --git a/packages/hal/mips/malta/current/src/hal_diag.c b/packages/hal/mips/malta/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/src/hal_diag.c @@ -0,0 +1,187 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors:nickg, dmoseley +// Date: 2001-03-20 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include // base types +#include // tracing macros +#include // assertion macros + +#include +#include + +#include + +#include + +//----------------------------------------------------------------------------- +// Select which diag channels to use + +//#define CYG_KERNEL_DIAG_LCD +#define CYG_KERNEL_DIAG_SERIAL + +/*---------------------------------------------------------------------------*/ + +void hal_diag_led(int x) +{ + HAL_WRITE_UINT32(HAL_DISPLAY_LEDBAR, x); +#if !defined(CYG_KERNEL_DIAG_LCD) + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIWORD, x); +#endif +} + +externC void diag_write_string (const char*); + +#ifdef CYG_KERNEL_DIAG_SERIAL +extern void cyg_hal_plf_comms_init(void); +extern void cyg_hal_plf_serial_putc(void*, cyg_uint8); +extern cyg_uint8 cyg_hal_plf_serial_getc(void*); +#endif + +void hal_diag_init(void) +{ +#if defined(CYGSEM_HAL_ROM_MONITOR) && !defined(CYG_KERNEL_DIAG_SERIAL) + // It's handy to have the LCD initialized at reset when using it + // for debugging output. + // The serial port likely doesn't work yet. Let's wait. + diag_write_string ("eCos ROM " __TIME__ "\n"); + diag_write_string (__DATE__ "\n"); +#endif + +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_comms_init(); +#endif +} + +#if defined(CYG_KERNEL_DIAG_LCD) +static void hal_diag_clear_lcd(void) +{ + volatile int i = 0x20000; + while (--i) ; + + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS0, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS1, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS2, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS3, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS4, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS5, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS6, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS7, ' '); +} +#endif /* defined(CYG_KERNEL_DIAG_LCD) */ + +void hal_diag_write_char(char c) +{ +#if defined(CYG_KERNEL_DIAG_LCD) + static volatile CYG_WORD* reg = HAL_DISPLAY_ASCIIPOS0; +#endif + + unsigned long __state; + + HAL_DISABLE_INTERRUPTS(__state); + + if(c == '\n') + { +#if defined(CYG_KERNEL_DIAG_LCD) + reg = HAL_DISPLAY_ASCIIPOS0; + hal_diag_clear_lcd(); +#endif +#if defined (CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_putc(NULL, '\r'); + cyg_hal_plf_serial_putc(NULL, '\n'); +#endif + } + else if (c == '\r') + { + // Ignore '\r' + } + else + { +#if defined(CYG_KERNEL_DIAG_LCD) + if (reg == HAL_DISPLAY_ASCIIPOS0) + hal_diag_clear_lcd(); + + HAL_WRITE_UINT32(reg, c); + + // Advance to next LED position. + if (reg == HAL_DISPLAY_ASCIIPOS0) + reg = HAL_DISPLAY_ASCIIPOS1; + else if (reg == HAL_DISPLAY_ASCIIPOS1) + reg = HAL_DISPLAY_ASCIIPOS2; + else if (reg == HAL_DISPLAY_ASCIIPOS2) + reg = HAL_DISPLAY_ASCIIPOS3; + else if (reg == HAL_DISPLAY_ASCIIPOS3) + reg = HAL_DISPLAY_ASCIIPOS4; + else if (reg == HAL_DISPLAY_ASCIIPOS4) + reg = HAL_DISPLAY_ASCIIPOS5; + else if (reg == HAL_DISPLAY_ASCIIPOS5) + reg = HAL_DISPLAY_ASCIIPOS6; + else if (reg == HAL_DISPLAY_ASCIIPOS6) + reg = HAL_DISPLAY_ASCIIPOS7; + else // reg == HAL_DISPLAY_ASCIIPOS7 or UNKNOWN + reg = HAL_DISPLAY_ASCIIPOS0; +#endif +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_putc(NULL, c); +#endif + } + + HAL_RESTORE_INTERRUPTS(__state); +} + +void hal_diag_read_char(char* c) +{ + *c = cyg_hal_plf_serial_getc(NULL); +} + +/*---------------------------------------------------------------------------*/ +/* End of hal_diag.c */ diff --git a/packages/hal/mips/malta/current/src/platform.S b/packages/hal/mips/malta/current/src/platform.S new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/src/platform.S @@ -0,0 +1,792 @@ +## +#============================================================================= +## platform.S +## +## MIPS Malta platform code +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): dmoseley +## Contributors:dmoseley, jskov +## Date: 2001-03-20 +## Purpose: MIPS Malta platform code +## Description: Platform specific code for Malta board. +## +## +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#ifdef CYGPKG_KERNEL +# include +#endif + +#include +#include +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +##----------------------------------------------------------------------------- + +##----------------------------------------------------------------------------- +# Platform Initialization. +# This code performs platform specific initialization. + +##----------------------------------------------------------------------------- +## I2C accessors - these need to delay after accessing the controller. +// Need to delay between clocking the serial bits since the CPU is way too +// fast for the I2C interface. CPU runs at CYGHWR_HAL_MIPS_MALTA_CPU_CLOCK +// and the I2C no fasten than 1.7MHz. We want to delay the CPU for half +// an I2C cycle and two instructions are executed per loop, hence: + +#define PAUSE \ + li t0, (20*(CYGHWR_HAL_MIPS_MALTA_CPU_CLOCK/1700000/2/2)); \ +99: bne t0, zero, 99b; \ + addiu t0, -1 + + +#define I2C_OE(v) \ + li t0,v; \ + sw t0,HAL_I2CFPGA_OE(a1); \ + PAUSE + +#define I2C_OUT(v) \ + li t0,v; \ + sw t0,HAL_I2CFPGA_OUT(a1); \ + PAUSE + +#define I2C_IN(v) \ + lw v,HAL_I2CFPGA_INP(a1); \ + andi v,v,HAL_I2CFPGA_IN_SDA_MASK; \ + PAUSE + +#define I2C_ENABLE \ + I2C_OE(HAL_I2C_CIN_DIN); \ + I2C_OUT(HAL_I2C_CHIGH_DHIGH); \ + li t0,HAL_I2CFPGA_SEL_FPGA; \ + sw t0,HAL_I2CFPGA_SEL(a1); \ + PAUSE + +##----------------------------------------------------------------------------- +## MEMC initialization. +## + +#if defined(CYG_HAL_STARTUP_ROM) + + .text + .set noreorder + +.macro MASK_WRITE_PCI_REG regnum, devnum, mask + .set noreorder + # First, read the appropriate register + li t0, HAL_GALILEO_PCI0_CONFIG_ADDR_ConfigEn | \regnum | \devnum + sw t0, HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET(s7) + lw t1, HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET(s7) + + # Now, mask in the appropriate bits + li t2, \mask + or t1, t2 + + # Write the updated value + li t0, HAL_GALILEO_PCI0_CONFIG_ADDR_ConfigEn | \regnum | \devnum + sw t0, HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET(s7) + sw t1, HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET(s7) +.endm + +.macro WRITE_PCI_REG regnum, devnum, base + .set noreorder + li t0, HAL_GALILEO_PCI0_CONFIG_ADDR_ConfigEn | \regnum | \devnum + li t1, \base + sw t0, HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET(s7) + sw t1, HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET(s7) +.endm + +#define NO_MASK 0 +#define NO_ERROR_CHECK 0 +#define ERROR_CHECK 1 +.macro READ_SPD_VALUE func, mask, ret_reg, err_check + .set noreorder + jal read_spd_value + li a0, \func # delay slot +.if \err_check + beq v0, zero, error + nop +.endif + move \ret_reg, v0 +.if \mask + and \ret_reg, \mask +.endif +.endm + +##----------------------------------------------------------------------------- +## +## Initialize the RAM. +## +## To do that, we need to first initialize the Galileo PCI stuff to gain access +## to the SAA9730. +## From there, use the I2C bus of the SAA9730 to read the SPD SDRAM +## config data. We then setup the Galileo SDRAM configuration +## +## Returns +## v0 = Error Code +## v1 = SDRAM size +## +FUNC_START(hal_malta_init_sdram) + + .set noreorder + + # Save the return address + move s8, ra + + # Setup the base address registers + li s7, CYGARC_UNCACHED_ADDRESS(HAL_GALILEO_REGISTER_BASE) + # + # Change the Galileo Base address to HAL_MALTA_CONTROLLER_BASE + # + li t0, HAL_MALTA_CONTROLLER_BASE_ISD_CONFIG + sw t0, HAL_GALILEO_INT_SPACE_DECODE_OFFSET(s7) + li s7, CYGARC_UNCACHED_ADDRESS(HAL_MALTA_CONTROLLER_BASE) + + # Setup the Galileo controller Endian configuration + li t0, (HAL_GALILEO_BYTE_SWAP) + sw t0, HAL_GALILEO_PCI_INTERNAL_COMMAND_OFFSET(s7) + + # Setup the PCI_0 Timeout and retry configuration + li t0, HAL_GALILEO_PCI0_TIMEOUT_RETRY_VALUE + sw t0, HAL_GALILEO_PCI0_TIMEOUT_RETRY_OFFSET(s7) + + # Setup Galileo as PCI Master + MASK_WRITE_PCI_REG HAL_GALILEO_PCI0_STATUS_COMMAND_REGNUM, HAL_MALTA_NULL_DEVNUM, \ + (HAL_GALILEO_PCI0_CONFIG_MEMEn | HAL_GALILEO_PCI0_CONFIG_MasEn | HAL_GALILEO_PCI0_CONFIG_SErrEn) + + # Setup Galileo PCI latency timer + MASK_WRITE_PCI_REG HAL_GALILEO_PCI0_BIST_REGNUM, HAL_MALTA_NULL_DEVNUM, \ + HAL_GALILEO_PCI0_LAT_TIMER_VAL + + # Enable FPGA I2C + li a1, CYGARC_UNCACHED_ADDRESS(HAL_I2CFPGA_BASE) + I2C_ENABLE + + ##===================================================================================== + ## + ## Read the SPD device parameters and determine memory size + ## + + READ_SPD_VALUE HAL_SPD_GET_NUM_ROW_BITS, 0xf, s0, ERROR_CHECK + READ_SPD_VALUE HAL_SPD_GET_NUM_COL_BITS, 0xf, s1, ERROR_CHECK + + READ_SPD_VALUE HAL_SPD_GET_NUM_DEVICE_BANKS, NO_MASK, s2, ERROR_CHECK + + READ_SPD_VALUE HAL_SPD_GET_SDRAM_WIDTH, 0x7f, s3, ERROR_CHECK + READ_SPD_VALUE HAL_SPD_GET_NUM_MODULE_BANKS, NO_MASK, s4, ERROR_CHECK + READ_SPD_VALUE HAL_SPD_GET_ROW_DENSITY, NO_MASK, s5, ERROR_CHECK + + READ_SPD_VALUE HAL_SPD_GET_BURST_LENGTH, NO_MASK, s6, ERROR_CHECK + + # + # Determine Size in Mbit + # SIZE = SDRAM_WIDTH * NUM_DEVICE_BANKS * 2 ^ (NUM_ROW_BITS + NUM_COL_BITS) + # + addu t0, s0, s1 # t0 = (NUM_ROW_BITS + NUM_COL_BITS) + li t1, 1 # t1 = 2 ^ 0 + sll t1, t0 # t1 = 2 ^ (NUM_ROW_BITS + NUM_COL_BITS) + multu s2, t1 + mflo s6 # s6 = NUM_DEVICE_BANKS * 2 ^ (NUM_ROW_BITS + NUM_COL_BITS) + nop + nop + nop + multu s6, s3 + mflo s6 # s6 = SDRAM_WIDTH * NUM_DEVICE_BANKS * 2 ^ (NUM_ROW_BITS + NUM_COL_BITS) + nop + nop + nop + + # + # Determine size of Bank 0 + # SPD Density of Each Row on Module value is used. Bit 7 represents + # 512MB, bit 6 256MB, etc. Highest set bit is size of bank 0. + # If there are two banks and these have different sizes, an extra + # bit will be set. If the sizes are the same, only the one bit is set. + # Note, at the exit of this loop, the size-bit of bank 0 will have been + # shifted out, allowing an easy check for multiple sizes below + # + li s0, SZ_512M +0: + and t1, s5, BIT7 + bnez t1, 8f + sll s5, 1 + b 0b + srl s0, 1 +8: + + # + # Determine if Bank 1 exists + # + li t0, 1 + beq s4, t0, 8f + move s1, zero + # + # Determine if Bank 1 is different than Bank 0. If no additional bits + # set, size is the same. + # + and t1, s5, 0xFF + beq t1, zero, 8f + move s1, s0 + # + # Determine size of Bank 1. It will be at least one factor smaller + # than that of bank 0. + # + sll s1,1 +0: + and t1, s5, BIT7 + bnez t1, 8f + sll s5, 1 + b 0b + srl s1, 1 +8: + + # + # FIXME: We should probably do some validation on the various + # memory parameters here at some point. + # + + # + # Set the base SDRAM bank configuration value. + # All other fields are zero, and the proper value is masked + # in when they are known + # + li s5, HAL_GALILEO_SDRAM_SRAS_TO_SCAS_DELAY_3C | \ + HAL_GALILEO_SDRAM_WIDTH_64BIT | \ + HAL_GALILEO_SDRAM_SRAS_PRECHARGE_3C + + # + # Setup the CASLAT value. + # Support only CASLAT = 2 + # + READ_SPD_VALUE HAL_SPD_GET_CAS_LAT, NO_MASK, v0, NO_ERROR_CHECK + and t0, v0, 2 + beqz t0, error + nop + ori s5, HAL_GALILEO_SDRAM_BANK0_CASLAT_2 + + # + # Setup SDRAM device size + # + li t0, SZ_16M + beq s6, t0, 8f + nop + ori s5, HAL_GALILEO_SDRAM_BANK0_SZ_64M +8: + + # + # Setup burst length: Support only 8 + # + READ_SPD_VALUE HAL_SPD_GET_BURST_LENGTH, NO_MASK, v0, NO_ERROR_CHECK + and t0, v0, 8 + beqz t0, error + nop + + # + # Setup Parity. + # Only support Parity/Noparity. Don't support ECC. + # + READ_SPD_VALUE HAL_SPD_GET_CONFIG_TYPE, NO_MASK, v0, NO_ERROR_CHECK + li t0, HAL_SPD_CONFIG_TYPE_PARITY + beq t0, v0, 0f + nop + li t0, HAL_SPD_CONFIG_TYPE_ECC + beq t0, v0, error + nop + b 8f + li v1, 0 +0: + ori s5, HAL_GALILEO_SDRAM_BANK0_PARITY + li v1, 1 +8: + + # + # Setup number of device banks + # Only support 2 or 4 banks + # + li t0, 2 + beq s2, t0, 8f + nop + li t0, 4 + beq s2, t0, 0f + nop + b error + nop +0: + ori s5, HAL_GALILEO_SDRAM_NUM_BANKS_4 +8: + + # + # Now actually store the bank config register + # + sw s5, HAL_GALILEO_SDRAM_BANK0_OFFSET(s7) + sw s5, HAL_GALILEO_SDRAM_BANK2_OFFSET(s7) + + # + # Setup the SDRAM configuration register + # All other fields are zero, and the proper value is masked + # in when they are known + # + li s5, HAL_GALILEO_SDRAM_DUPLICATE_BANK_ADDR | HAL_GALILEO_SDRAM_BANK_INTERLEAVE_DIS + + # + # Setup the Refresh Rate + # + READ_SPD_VALUE HAL_SPD_GET_REFRESH_RATE, 0x7f, v0, NO_ERROR_CHECK + + li t0, HAL_SPD_REFRESH_RATE_125 + beq t0, v0, 8f + li t0, HAL_SPD_REFRESH_COUNTER_125 + + li t0, HAL_SPD_REFRESH_RATE_62_5 + beq t0, v0, 8f + li t0, HAL_SPD_REFRESH_COUNTER_62_5 + + li t0, HAL_SPD_REFRESH_RATE_31_3 + beq t0, v0, 8f + li t0, HAL_SPD_REFRESH_COUNTER_31_3 + + li t0, HAL_SPD_REFRESH_RATE_15_625 + beq t0, v0, 8f + li t0, HAL_SPD_REFRESH_COUNTER_15_625 + + li t0, HAL_SPD_REFRESH_RATE_7_8 + beq t0, v0, 8f + li t0, HAL_SPD_REFRESH_COUNTER_7_8 + + # Unknown: assume 3.9 microseconds + li t0, HAL_SPD_REFRESH_COUNTER_3_9 +8: + + or s5, t0 + +#if 0 // FIXME: Dunno what this is supposed to do, but it changes the RMW flag, + // not anything related to RAM width. + # + # Setup RAM_WIDTH + # + beqz v1, 8f + nop + READ_SPD_VALUE HAL_SPD_GET_ERROR_CHECK_WIDTH, 0x7f, v0, NO_ERROR_CHECK + beq v0, zero, 8f + nop + ori s5, HAL_GALILEO_SDRAM_CFG_RAM_WIDTH +8: +#endif + + # + # Store the SDRAM configuration register + # + sw s5, HAL_GALILEO_SDRAM_CONFIG_OFFSET(s7) + + # + # Setup SDRAM Bank 0 Address Decoding + # + li a0, CYGARC_PHYSICAL_ADDRESS(HAL_MALTA_RAM_BASE) # Physical bottom of Bank 0 + add a1, s0, a0 + subu a1, 1 # Physical top of Bank 0 + + srl t0, a0, HAL_GALILEO_CPU_DECODE_SHIFT # Setup SCS[1:0] + srl t1, a1, HAL_GALILEO_CPU_DECODE_SHIFT # First level decoding + sw t0, HAL_GALILEO_SCS10_LD_OFFSET(s7) # (ie Processor Decode Region) + sw t1, HAL_GALILEO_SCS10_HD_OFFSET(s7) # + + srl t0, a0, HAL_GALILEO_DEV_DECODE_SHIFT # Setup SCS0 + srl t1, a1, HAL_GALILEO_DEV_DECODE_SHIFT # Second level decoding + sw t0, HAL_GALILEO_SCS0_LD_OFFSET(s7) # (ie Device Sub-decode Region) + sw t1, HAL_GALILEO_SCS0_HD_OFFSET(s7) # + + # + # Setup SDRAM Bank 1 Address Decoding + # + add a0, s0, CYGARC_PHYSICAL_ADDRESS(HAL_MALTA_RAM_BASE) # Physical bottom of Bank 1 + add a1, a0, s1 + subu a1, 1 # Physical top of Bank 1 + + srl t0, a0, HAL_GALILEO_CPU_DECODE_SHIFT # Setup SCS[3:2] + srl t1, a1, HAL_GALILEO_CPU_DECODE_SHIFT # First level decoding + sw t0, HAL_GALILEO_SCS32_LD_OFFSET(s7) # (ie Processor Decode Region) + sw t1, HAL_GALILEO_SCS32_HD_OFFSET(s7) # + + srl t0, a0, HAL_GALILEO_DEV_DECODE_SHIFT # Setup SCS2 + srl t1, a1, HAL_GALILEO_DEV_DECODE_SHIFT # Second level decoding + sw t0, HAL_GALILEO_SCS2_LD_OFFSET(s7) # (ie Device Sub-decode Region) + sw t1, HAL_GALILEO_SCS2_HD_OFFSET(s7) # + + # + # Setup PCI windows + # + li a0, CYGARC_PHYSICAL_ADDRESS(HAL_MALTA_PCI_MEM0_BASE) + add a1, a0, HAL_MALTA_PCI_MEM0_SIZE + subu a1, 1 # Physical top of Mem Bank 0 + srl t0, a0, HAL_GALILEO_CPU_DECODE_SHIFT + srl t1, a1, HAL_GALILEO_CPU_DECODE_SHIFT + sw t0, HAL_GALILEO_PCIMEM0_LD_OFFSET(s7) + sw t1, HAL_GALILEO_PCIMEM0_HD_OFFSET(s7) + + + li a0, CYGARC_PHYSICAL_ADDRESS(HAL_MALTA_PCI_MEM1_BASE) + add a1, a0, HAL_MALTA_PCI_MEM1_SIZE + subu a1, 1 # Physical top of Mem Bank 1 + srl t0, a0, HAL_GALILEO_CPU_DECODE_SHIFT + srl t1, a1, HAL_GALILEO_CPU_DECODE_SHIFT + sw t0, HAL_GALILEO_PCIMEM1_LD_OFFSET(s7) + sw t1, HAL_GALILEO_PCIMEM1_HD_OFFSET(s7) + + li a0, CYGARC_PHYSICAL_ADDRESS(HAL_MALTA_PCI_IO_BASE) + add a1, a0, HAL_MALTA_PCI_IO_SIZE + subu a1, 1 # Physical top of IO Bank + srl t0, a0, HAL_GALILEO_CPU_DECODE_SHIFT + srl t1, a1, HAL_GALILEO_CPU_DECODE_SHIFT + sw t0, HAL_GALILEO_PCIIO_LD_OFFSET(s7) + sw t1, HAL_GALILEO_PCIIO_HD_OFFSET(s7) + + # Here's a nice gotcha. The Intel southbridge *must* see IO + # starting from 0. + sw zero,HAL_GALILEO_PCI_IO_REMAP(s7) + + # + # Setup FLASH Address Decoding + # + li a0, CYGARC_PHYSICAL_ADDRESS(HAL_MALTA_FLASH_BASE) # Physical bottom of Flash Bank + add a1, a0, HAL_MALTA_FLASH_SIZE + subu a1, 1 # Physical top of Flash Bank + + srl t0, a0, HAL_GALILEO_CPU_DECODE_SHIFT # Setup CS[2:0] + srl t1, a1, HAL_GALILEO_CPU_DECODE_SHIFT # First level decoding + sw t0, HAL_GALILEO_CS20_LD_OFFSET(s7) # (ie Processor Decode Region) + sw t1, HAL_GALILEO_CS20_HD_OFFSET(s7) # + + srl t0, a0, HAL_GALILEO_DEV_DECODE_SHIFT # Setup CS0 + srl t1, a1, HAL_GALILEO_DEV_DECODE_SHIFT # Second level decoding + sw t0, HAL_GALILEO_CS0_LD_OFFSET(s7) # (ie Device Sub-decode Region) + sw t1, HAL_GALILEO_CS0_HD_OFFSET(s7) # + + # + # Now disable all unused decodes + # (SCS1, SCS3, PCI1xx, CS1, CS2) + # + li t0, 0xffff + move t1, zero + sw t0, HAL_GALILEO_SCS1_LD_OFFSET(s7) + sw t1, HAL_GALILEO_SCS1_HD_OFFSET(s7) + sw t0, HAL_GALILEO_SCS3_LD_OFFSET(s7) + sw t1, HAL_GALILEO_SCS3_HD_OFFSET(s7) + sw t0, HAL_GALILEO_PCI1IO_LD_OFFSET(s7) + sw t1, HAL_GALILEO_PCI1IO_HD_OFFSET(s7) + sw t0, HAL_GALILEO_PCI1MEM0_LD_OFFSET(s7) + sw t1, HAL_GALILEO_PCI1MEM0_HD_OFFSET(s7) + sw t0, HAL_GALILEO_PCI1MEM1_LD_OFFSET(s7) + sw t1, HAL_GALILEO_PCI1MEM1_HD_OFFSET(s7) + sw t0, HAL_GALILEO_CS1_LD_OFFSET(s7) + sw t1, HAL_GALILEO_CS1_HD_OFFSET(s7) + sw t0, HAL_GALILEO_CS2_LD_OFFSET(s7) + sw t1, HAL_GALILEO_CS2_HD_OFFSET(s7) + +noerror: + move v0, zero + add v1, s0, s1 + move ra, s8 + jr ra + nop + +error: + li v0, HAL_MALTA_MEMERROR + move ra, s8 + jr ra + nop + +FUNC_END(hal_malta_init_sdram) + + .macro i2c_start + # Start: SDA low -> high with SLC high + I2C_OE(HAL_I2C_COUT_DOUT) + I2C_OUT(HAL_I2C_CHIGH_DHIGH) + I2C_OUT(HAL_I2C_CHIGH_DLOW) + I2C_OUT(HAL_I2C_CLOW_DLOW) + .endm + + .macro i2c_stop + # Stop: SDA high -> low with SLC high + I2C_OE(HAL_I2C_COUT_DOUT) + I2C_OUT(HAL_I2C_CLOW_DLOW) + I2C_OUT(HAL_I2C_CHIGH_DLOW) + I2C_OUT(HAL_I2C_CHIGH_DHIGH) + I2C_OUT(HAL_I2C_CLOW_DHIGH) + .endm + + .macro i2c_write + # Value to write in t1. + # Writes happen by clocking SCL low->high->low while SDA defines + # the bit to be sent (MSB first). + I2C_OE(HAL_I2C_COUT_DOUT) + li t2, 7 +1: srlv t3, t1, t2 + andi t3, 1 + beq t3, zero, 2f + nop + # Send 1 + I2C_OUT(HAL_I2C_CLOW_DHIGH) + I2C_OUT(HAL_I2C_CHIGH_DHIGH) + I2C_OUT(HAL_I2C_CLOW_DHIGH) + b 3f + nop + +2: # Send 0 + I2C_OUT(HAL_I2C_CLOW_DLOW) + I2C_OUT(HAL_I2C_CHIGH_DLOW) + I2C_OUT(HAL_I2C_CLOW_DLOW) + +3: bne t2, zero, 1b + addiu t2, -1 + + # Now tristate the SDA and pulse the clock. Receiver will + # ack the transfer by pulling SDA low. + # Read by pulsing clock. Leave result in t1 + I2C_OE(HAL_I2C_COUT_DIN) + I2C_OUT(HAL_I2C_CHIGH_DHIGH) + I2C_IN(t1) + I2C_OUT(HAL_I2C_CLOW_DHIGH) + .endm + + .macro i2c_read + # Value read is returned in t1 + # Reads happen by clocking SCL high->low while reading SDA + I2C_OE(HAL_I2C_COUT_DIN) + move t1,zero + li t2, 7 +1: I2C_OUT(HAL_I2C_CHIGH_DHIGH) + I2C_IN(t3) + sll t1,1 + or t1,t1,t3 + I2C_OUT(HAL_I2C_CLOW_DHIGH) + + bne t2, zero, 1b + addiu t2, -1 + + // Send ack by clocking with SDA low. + I2C_OUT(HAL_I2C_CLOW_DHIGH) + I2C_OE(HAL_I2C_COUT_DOUT) + I2C_OUT(HAL_I2C_CHIGH_DHIGH) + I2C_OUT(HAL_I2C_CLOW_DHIGH) + .endm + +## +## Read a value from the SDRAM SPD device. +## +## Parameters: a0 = subaddress +## Returns: v0 = SPD value read +## +FUNC_START(read_spd_value) + .set noreorder + # Setup a base address register + li a1, CYGARC_UNCACHED_ADDRESS(HAL_I2CFPGA_BASE) + + i2c_start + + # Write address of SDRAM sense controller + li t1,( HAL_I2C_SPD_ADDRESS | HAL_I2C_WRITE ) + i2c_write + li t0,HAL_I2CFPGA_OUT_SDA_NACK + beq t0,t1,i2c_error + move v0,zero + + # Write address of data wanted + move t1,a0 + i2c_write + li t0,HAL_I2CFPGA_OUT_SDA_NACK + beq t0,t1,i2c_error + move v0,zero + + i2c_start + + # Write address of SDRAM sense controller + li t1,( HAL_I2C_SPD_ADDRESS | HAL_I2C_READ ) + i2c_write + li t0,HAL_I2CFPGA_OUT_SDA_NACK + beq t0,t1,i2c_error + move v0,zero + + # Read data + i2c_read + move v0,t1 + + i2c_stop + +i2c_error: + jr ra + nop + +FUNC_END(read_spd_value) +#endif // defined(CYG_HAL_STARTUP_ROM) + +##----------------------------------------------------------------------------- +## ISR springboard. +## This routine decodes the interrupt from the southbridge and vectors to it. + + # On entry: + # a0 = MIPS status register interrupt number (1,2 or 3) + # a1 = ISR data value (= interrupt controller reg address) + # a2 = saved reg dump ptr + # s0 = saved reg dump ptr + # s1 = vector table offset + # s2 = interrupt number + # a3,v0,v1 etc available for use + + .text + +FUNC_START(hal_isr_springboard_southbridge) + .set noreorder + # Get req bits of controller 1 + lb v0,0(a1) + lb v1,1(a1) # apply mask + xori v1,v1,0xffff + and v0,v0,v1 + andi v1,v0,0xffff&~(1<<(CYGNUM_HAL_INTERRUPT_CASCADE-CYGNUM_HAL_INTERRUPT_CTRL1_BASE)) + bne v1,zero,1f + ori a2,zero,CYGNUM_HAL_INTERRUPT_CTRL1_BASE + # If cascade is set, check controller 2 + andi v0,v0,(1<<(CYGNUM_HAL_INTERRUPT_CASCADE-CYGNUM_HAL_INTERRUPT_CTRL1_BASE)) + beq v0,zero,2f + lb v0,HAL_PIIX4_MASTER_SLAVE_OFFSET(a1) + lb v1,HAL_PIIX4_MASTER_SLAVE_OFFSET+1(a1) # apply mask + xori v1,v1,0xffff + and v0,v0,v1 + bne v0,zero,1f + ori a2,zero,CYGNUM_HAL_INTERRUPT_CTRL2_BASE + # Spurious interrupt, return to VSR +2: jr ra + move v0,zero +1: + + # FIXME: May want to rewrite this to do ls bit on byte + # to save a few cycles. + # The following code implements an ls bit index algorithm similar + # to that in hal_lsbit_index() in hal_misc.c. + negu v1,v0 # v1 = -v0 + and v1,v1,v0 # v1 &= v0 [isolate ls bit] + sll v0,v1,16 # v0 = v1<<16 + subu v1,v0,v1 # v1 = v0 - v1 + sll a0,v1,6 # a0 = v1<<6 + addu v1,v1,a0 # v1 += a0 + sll a1,v1,4 # a1 = v1<<4 + addu v1,v1,a1 # v1 += a1 + la v0,hal_isr_springboard_table # v0 = table address + srl v1,v1,26 # v1 = v1>>26 + addu v1,v1,v0 # v1 = table entry address + lb a0,0(v1) # a0 = intc isr number + + add s2,a0,a2 # s2 = eCos isr number +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN +hal_isr_springboard_chaining: + # This serves as the __default_interrupt_isr entry-point in + # chaning mode, thus ensuring that all interrupts from + # vectors 0-5 eventually end up on the special CHAINING vector. + # (See the hal_interrupt_handlers table) + ori s1,zero,CYGNUM_HAL_INTERRUPT_CHAINING*4 # s1 = chaining isr ix +#else + sll s1,s2,2 # s1 = isr table index +#endif + + la v1,hal_interrupt_handlers + add v1,v1,s1 # v1 = isr handler address + lw v1,0(v1) # v1 = isr handler + + la a1,hal_interrupt_data + add a1,a1,s1 # a1 = address of data ptr + lw a1,0(a1) # a1 = data pointer + + move a0,s2 # pass interrupt number + + jr v1 # jump to handler, return is to + nop # default vsr already in ra + +FUNC_END(hal_isr_springboard_southbridge) + + +hal_isr_springboard_table: + .byte -1, 0, 1, 12, 2, 6, 0, 13 + .byte 3, 0, 7, 0, 0, 0, 0, 14 + .byte 10, 4, 0, 0, 8, 0, 0, 25 + .byte 0, 0, 0, 0, 0, 21, 27, 15 + .byte 31, 11, 5, 0, 0, 0, 0, 0 + .byte 9, 0, 0, 24, 0, 0, 20, 26 + .byte 30, 0, 0, 0, 0, 23, 0, 19 + .byte 29, 0, 22, 18, 28, 17, 16, 0 + +##----------------------------------------------------------------------------- +# Interrupt vector tables. +# These tables contain the isr, data and object pointers used to deliver +# interrupts to user code. + + .extern hal_default_isr + + .data + + .globl hal_interrupt_handlers +hal_interrupt_handlers: + .long hal_isr_springboard_southbridge + .rept CYGNUM_HAL_ISR_COUNT-1 + .long hal_default_isr + .endr + + .globl hal_interrupt_data +hal_interrupt_data: + .long HAL_PIIX4_MASTER_OCW3 + .rept CYGNUM_HAL_ISR_COUNT-1 + .long 0 + .endr + + .globl hal_interrupt_objects +hal_interrupt_objects: + .rept CYGNUM_HAL_ISR_COUNT + .long 0 + .endr + + +##----------------------------------------------------------------------------- +## end of platform.S diff --git a/packages/hal/mips/malta/current/src/plf_misc.c b/packages/hal/mips/malta/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/src/plf_misc.c @@ -0,0 +1,467 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour, dmoseley, jskov +// Date: 2001-03-20 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include + +#include // Base types +#include // tracing macros +#include // assertion macros + +#include // architectural definitions + +#include // Interrupt handling + +#include // Cache handling + +#include +#include +#include + +//-------------------------------------------------------------------------- + +externC void cyg_hal_init_superIO(void); +static void hal_init_irq(void); + +//-------------------------------------------------------------------------- + +void hal_platform_init(void) +{ + HAL_WRITE_UINT32(HAL_DISPLAY_LEDBAR, 0xff); +#if defined(CYGPKG_CYGMON) + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS0, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS1, 'C'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS2, 'Y'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS3, 'G'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS4, 'M'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS5, 'O'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS6, 'N'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS7, ' '); +#elif defined(CYGPKG_REDBOOT) + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS0, 'R'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS1, 'e'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS2, 'd'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS3, 'B'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS4, 'o'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS5, 'o'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS6, 't'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS7, ' '); +#else + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS0, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS1, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS2, 'e'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS3, 'C'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS4, 'O'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS5, 'S'); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS6, ' '); + HAL_WRITE_UINT32(HAL_DISPLAY_ASCIIPOS7, ' '); +#endif + + // Initialize PCI before VV since serial registers need to be in + // place before that time. + cyg_hal_plf_pci_init(); + + // Init interrupt controller on PIIX4 + hal_init_irq(); + + // Initialize super IO controller + cyg_hal_init_superIO(); + + // Set up eCos/ROM interfaces + hal_if_init(); + + HAL_ICACHE_INVALIDATE_ALL(); + HAL_ICACHE_ENABLE(); + HAL_DCACHE_INVALIDATE_ALL(); + HAL_DCACHE_ENABLE(); +} + + +/*------------------------------------------------------------------------*/ +/* Reset support */ + +void hal_malta_reset(void) +{ + *HAL_MALTA_SOFTRES = HAL_MALTA_GORESET; + for(;;); // wait for it +} + + +//-------------------------------------------------------------------------- +// IRQ init +static void +hal_init_irq(void) +{ + cyg_uint32 v; + + // Enable SERIRQ on PIIX4 + v = cyg_hal_plf_pci_cfg_read_dword(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,0), + CYG_PCI_CFG_PIIX4_GENCFG); + v |= CYG_PCI_CFG_PIIX4_GENCFG_SERIRQ; + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,0), + CYG_PCI_CFG_PIIX4_GENCFG, v); + + // Enable SERIRQ and set to continous mode. + v = cyg_hal_plf_pci_cfg_read_byte(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,0), + CYG_PCI_CFG_PIIX4_SERIRQC); + v |= CYG_PCI_CFG_PIIX4_SERIRQC_ENABLE | CYG_PCI_CFG_PIIX4_SERIRQC_CONT; + cyg_hal_plf_pci_cfg_write_byte(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,0), + CYG_PCI_CFG_PIIX4_SERIRQC, v); + + // Init master interrupt controller (4.2.2, pp 74-78) + HAL_WRITE_UINT8(HAL_PIIX4_MASTER_ICW1, HAL_PIIX4_ICW1_SEL | HAL_PIIX4_ICW1_WR); + HAL_WRITE_UINT8(HAL_PIIX4_MASTER_ICW2, CYGNUM_HAL_INTERRUPT_CTRL1_BASE - CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE); + HAL_WRITE_UINT8(HAL_PIIX4_MASTER_ICW3, HAL_PIIX4_ICW3_CASCADE); + HAL_WRITE_UINT8(HAL_PIIX4_MASTER_ICW4, HAL_PIIX4_ICW4_UPMODE); + HAL_WRITE_UINT8(HAL_PIIX4_MASTER_OCW3, HAL_PIIX4_OCW3_SEL | HAL_PIIX4_OCW3_ESSM | HAL_PIIX4_OCW3_REQ); + + // Init slave interrupt controller + HAL_WRITE_UINT8(HAL_PIIX4_SLAVE_ICW1, HAL_PIIX4_ICW1_SEL | HAL_PIIX4_ICW1_WR); + HAL_WRITE_UINT8(HAL_PIIX4_SLAVE_ICW2, CYGNUM_HAL_INTERRUPT_CTRL2_BASE - CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE); + HAL_WRITE_UINT8(HAL_PIIX4_SLAVE_ICW3, HAL_PIIX4_ICW3_SLAVE); + HAL_WRITE_UINT8(HAL_PIIX4_SLAVE_ICW4, HAL_PIIX4_ICW4_UPMODE); + + // Mask all sources + HAL_WRITE_UINT8(HAL_PIIX4_MASTER_OCW1, + 0xff & ~(1<<(CYGNUM_HAL_INTERRUPT_CASCADE-CYGNUM_HAL_INTERRUPT_CTRL1_BASE))); + HAL_WRITE_UINT8(HAL_PIIX4_SLAVE_OCW1, 0xff); + + // Set PCI interrupt routing and set those interrupts to level + // sense as per 4.1.10 page 59 in 82371AB doc. + v = ( (CYGNUM_HAL_INTERRUPT_PCI_AB-CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE) << 0 + |(CYGNUM_HAL_INTERRUPT_PCI_AB-CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE) << 8 + |(CYGNUM_HAL_INTERRUPT_PCI_CD-CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE) << 16 + |(CYGNUM_HAL_INTERRUPT_PCI_CD-CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE) << 24); + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,0), + CYG_PCI_CFG_PIIX4_PIRQR, v); + + HAL_READ_UINT8(HAL_PIIX4_ELCR2, v); + v |= (1 << (CYGNUM_HAL_INTERRUPT_PCI_AB-CYGNUM_HAL_INTERRUPT_CTRL2_BASE)) + |(1 << (CYGNUM_HAL_INTERRUPT_PCI_CD-CYGNUM_HAL_INTERRUPT_CTRL2_BASE)); + HAL_WRITE_UINT8(HAL_PIIX4_ELCR2, v); + + // Let south bridge interrupt + HAL_INTERRUPT_UNMASK(CYGNUM_HAL_INTERRUPT_SOUTH_BRIDGE_INTR); +} + +/*------------------------------------------------------------------------*/ +/* PCI support */ +#if defined(CYGPKG_IO_PCI) + +#define PCIMEM_START 0x08000000 // PCI memory address +#define PCIMEM_SIZE 0x10000000 // 256 MByte +#define PCIIO_START 0x18000000 // PCI io address +#define PCIIO_SIZE 0x03E00000 // 62 MByte + +static int __check_bar(cyg_uint32 addr, cyg_uint32 size) +{ + int n; + + for (n = 0; n <= 31; n++) + if (size == (1 << n)) { + /* Check that address is naturally aligned */ + if (addr != (addr & ~(size-1))) + return 0; + return size - 1; + } + return 0; +} + + +// One-time PCI initialization. + +void cyg_hal_plf_pci_init(void) +{ + cyg_uint32 bar_ena, start10, start32, end, size; + cyg_uint8 next_bus; + cyg_uint32 v; + + + static int initialized = 0; + if (initialized) return; + initialized = 1; + + // Setup for bus mastering + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_COMMAND, + CYG_PCI_CFG_COMMAND_IO | + CYG_PCI_CFG_COMMAND_MEMORY | + CYG_PCI_CFG_COMMAND_MASTER | + CYG_PCI_CFG_COMMAND_PARITY | + CYG_PCI_CFG_COMMAND_SERR); + + // Setup latency timer field + cyg_hal_plf_pci_cfg_write_byte(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_LATENCY_TIMER, 6); + + // Disable all BARs + bar_ena = 0x1ff; + + // Check for active SCS10 + start10 = HAL_GALILEO_GETREG(HAL_GALILEO_SCS10_LD_OFFSET) << 21; + end = ((HAL_GALILEO_GETREG(HAL_GALILEO_SCS10_HD_OFFSET) & 0x7f) + 1) << 21; + if (end > start10) { + if ((size = __check_bar(start10, end - start10)) != 0) { + // Enable BAR + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_SCS10_SIZE_OFFSET, size); + bar_ena &= ~HAL_GALILEO_BAR_ENA_SCS10; + } + } + + // Check for active SCS32 + start32 = HAL_GALILEO_GETREG(HAL_GALILEO_SCS32_LD_OFFSET) << 21; + end = ((HAL_GALILEO_GETREG(HAL_GALILEO_SCS32_HD_OFFSET) & 0x7f) + 1) << 21; + if (end > start32) { + if ((size = __check_bar(start32, end - start32)) != 0) { + // Enable BAR + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_SCS32_SIZE_OFFSET, size); + bar_ena &= ~HAL_GALILEO_BAR_ENA_SCS32; + } + } + + bar_ena &= ~HAL_GALILEO_BAR_ENA_SCS10; + HAL_GALILEO_PUTREG(HAL_GALILEO_BAR_ENA_OFFSET, bar_ena); + + + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_BAR_0, 0xffffffff); + + end = cyg_hal_plf_pci_cfg_read_dword(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_BAR_0); + + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_BAR_0, start10); + + + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_BAR_1, 0xffffffff); + + end = cyg_hal_plf_pci_cfg_read_dword(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_BAR_1); + + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_BAR_1, start32); + + + // enable ISA bridge on PIIX4 + v = cyg_hal_plf_pci_cfg_read_dword(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,_PIIX4_BRIDGE), + CYG_PCI_CFG_PIIX4_GENCFG); + v |= CYG_PCI_CFG_PIIX4_GENCFG_ISA; + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,_PIIX4_BRIDGE), + CYG_PCI_CFG_PIIX4_GENCFG, v); + + + v = cyg_hal_plf_pci_cfg_read_byte(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,_PIIX4_BRIDGE), + CYG_PCI_CFG_PIIX4_TOM); + v &= ~CYG_PCI_CFG_PIIX4_TOM_TOM_MASK; + v |= CYG_PCI_CFG_PIIX4_TOM_TOM_16M; + cyg_hal_plf_pci_cfg_write_byte(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,_PIIX4_BRIDGE), + CYG_PCI_CFG_PIIX4_TOM, v); + + + // Configure PCI bus. + next_bus = 1; + cyg_pci_configure_bus(0, &next_bus); +} + + +// Check for configuration error. +static int pci_config_errcheck(void) +{ + cyg_uint32 irq; + + // Check for master or target abort + irq = HAL_GALILEO_GETREG(HAL_GALILEO_IRQ_CAUSE_OFFSET); + + if (irq & (HAL_GALILEO_IRQCAUSE_MASABT | HAL_GALILEO_IRQCAUSE_TARABT)) { + // Error. Clear bits. + HAL_GALILEO_PUTREG(HAL_GALILEO_IRQ_CAUSE_OFFSET, + ~(HAL_GALILEO_IRQCAUSE_MASABT | HAL_GALILEO_IRQCAUSE_TARABT)); + return 1; + } + return 0; +} + +cyg_uint32 cyg_hal_plf_pci_cfg_read_dword (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset) +{ + cyg_uint32 config_data; + + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET, + HAL_GALILEO_PCI0_CONFIG_ADDR_ENABLE | + (bus << 16) | (devfn << 8) | offset); + + config_data = HAL_GALILEO_GETREG(HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET); + + if (pci_config_errcheck()) + return 0xffffffff; + return config_data; +} + +cyg_uint16 cyg_hal_plf_pci_cfg_read_word (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset) +{ + cyg_uint32 config_dword; + + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET, + HAL_GALILEO_PCI0_CONFIG_ADDR_ENABLE | + (bus << 16) | (devfn << 8) | (offset & ~3)); + + config_dword = HAL_GALILEO_GETREG(HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET); + + if (pci_config_errcheck()) + return 0xffff; + return (cyg_uint16)((config_dword >> ((offset & 3) * 8)) & 0xffff); +} + +cyg_uint8 cyg_hal_plf_pci_cfg_read_byte (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset) +{ + cyg_uint32 config_dword; + + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET, + HAL_GALILEO_PCI0_CONFIG_ADDR_ENABLE | + (bus << 16) | (devfn << 8) | (offset & ~3)); + + config_dword = HAL_GALILEO_GETREG(HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET); + + if (pci_config_errcheck()) + return 0xff; + return (cyg_uint8)((config_dword >> ((offset & 3) * 8)) & 0xff); +} + +void cyg_hal_plf_pci_cfg_write_dword (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint32 data) +{ + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET, + HAL_GALILEO_PCI0_CONFIG_ADDR_ENABLE | + (bus << 16) | (devfn << 8) | offset); + + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET, data); + + (void)pci_config_errcheck(); +} + +void cyg_hal_plf_pci_cfg_write_word (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint16 data) +{ + cyg_uint32 config_dword, shift; + + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET, + HAL_GALILEO_PCI0_CONFIG_ADDR_ENABLE | + (bus << 16) | (devfn << 8) | (offset & ~3)); + + config_dword = HAL_GALILEO_GETREG(HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET); + if (pci_config_errcheck()) + return; + + shift = (offset & 3) * 8; + config_dword &= ~(0xffff << shift); + config_dword |= (data << shift); + + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET, config_dword); + + (void)pci_config_errcheck(); +} + +void cyg_hal_plf_pci_cfg_write_byte (cyg_uint32 bus, + cyg_uint32 devfn, + cyg_uint32 offset, + cyg_uint8 data) +{ + cyg_uint32 config_dword, shift; + + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET, + HAL_GALILEO_PCI0_CONFIG_ADDR_ENABLE | + (bus << 16) | (devfn << 8) | (offset & ~3)); + + config_dword = HAL_GALILEO_GETREG(HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET); + if (pci_config_errcheck()) + return; + + shift = (offset & 3) * 8; + config_dword &= ~(0xff << shift); + config_dword |= (data << shift); + + HAL_GALILEO_PUTREG(HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET, config_dword); + + (void)pci_config_errcheck(); +} +#endif // defined(CYGPKG_IO_PCI) + + +/*------------------------------------------------------------------------*/ +/* IDE support */ + +void cyg_hal_plf_ide_init(void) +{ + cyg_uint32 v; + + // enable IDE + v = cyg_hal_plf_pci_cfg_read_dword(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,_PIIX4_IDE), + CYG_PCI_CFG_PIIX4_IDETIM); + v |= (CYG_PCI_CFG_PIIX4_IDETIM_IDE << 16) | CYG_PCI_CFG_PIIX4_IDETIM_IDE; + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(_PIIX4_PCI_ID,_PIIX4_IDE), + CYG_PCI_CFG_PIIX4_IDETIM, v); +} + + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/packages/hal/mips/malta/current/src/plf_mk_defs.c b/packages/hal/mips/malta/current/src/plf_mk_defs.c new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/src/plf_mk_defs.c @@ -0,0 +1,86 @@ +//========================================================================== +// +// plf_mk_defs.c +// +// HAL (platform) "make defs" program +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Date: 2001-04-09 +// Purpose: Platform dependent definition generator +// Description: This file contains code that can be compiled by the target +// compiler and used to generate machine specific definitions +// suitable for use in assembly code. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include // HAL header +#include // HAL header +#include // HAL header +#ifdef CYGPKG_KERNEL +# include +# include +#endif + +/* + * This program is used to generate definitions needed by + * assembly language modules. + * + * This technique was first used in the OSF Mach kernel code: + * generate asm statements containing #defines, + * compile this file to assembler, and then extract the + * #defines from the assembly-language output. + */ + +#define DEFINE(sym, val) \ + asm volatile("\n\t.equ\t" #sym ",%0" : : "i" (val)) + +int +main(void) +{ +// DEFINE(CYGNUM_HAL_ISR_COUNT, CYGNUM_HAL_ISR_COUNT); + return 0; +} + +//-------------------------------------------------------------------------- +// EOF plf_mk_defs.c diff --git a/packages/hal/mips/malta/current/src/ser16c550c.c b/packages/hal/mips/malta/current/src/ser16c550c.c new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/src/ser16c550c.c @@ -0,0 +1,571 @@ +//============================================================================= +// +// ser16c550c.c +// +// Simple driver for the 16c550c serial controllers on the Malta board +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley +// Contributors:dmoseley, jskov +// Date: 2001-03-20 +// Description: Simple driver for the 16c550c serial controller +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interface API +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // Helper functions +#include // CYG_ISR_HANDLED + +//----------------------------------------------------------------------------- +// Define the serial registers. The Malta board is equipped with a 16550C +// serial chip. +#define MALTA_SER_CLOCK 1843200 +#define MALTA_SER_16550_BASE_A 0xb80003f8 +#define MALTA_SER_16550_BASE_B 0xb80002f8 +#define SER_16550_RBR 0x00 // receiver buffer register, read, dlab = 0 +#define SER_16550_THR 0x00 // transmitter holding register, write, dlab = 0 +#define SER_16550_DLL 0x00 // divisor latch (LS), read/write, dlab = 1 +#define SER_16550_IER 0x01 // interrupt enable register, read/write, dlab = 0 +#define SER_16550_DLM 0x01 // divisor latch (MS), read/write, dlab = 1 +#define SER_16550_IIR 0x02 // interrupt identification reg, read, dlab = 0 +#define SER_16550_FCR 0x02 // fifo control register, write, dlab = 0 +#define SER_16550_AFR 0x02 // alternate function reg, read/write, dlab = 1 +#define SER_16550_LCR 0x03 // line control register, read/write +#define SER_16550_MCR 0x04 // modem control register, read/write +#define SER_16550_LSR 0x05 // line status register, read +#define SER_16550_MSR 0x06 // modem status register, read +#define SER_16550_SCR 0x07 // scratch pad register + +// The interrupt enable register bits. +#define SIO_IER_ERDAI 0x01 // enable received data available irq +#define SIO_IER_ETHREI 0x02 // enable THR empty interrupt +#define SIO_IER_ELSI 0x04 // enable receiver line status irq +#define SIO_IER_EMSI 0x08 // enable modem status interrupt + +// The interrupt identification register bits. +#define SIO_IIR_IP 0x01 // 0 if interrupt pending +#define SIO_IIR_ID_MASK 0x0e // mask for interrupt ID bits + +// The line status register bits. +#define SIO_LSR_DR 0x01 // data ready +#define SIO_LSR_OE 0x02 // overrun error +#define SIO_LSR_PE 0x04 // parity error +#define SIO_LSR_FE 0x08 // framing error +#define SIO_LSR_BI 0x10 // break interrupt +#define SIO_LSR_THRE 0x20 // transmitter holding register empty +#define SIO_LSR_TEMT 0x40 // transmitter register empty +#define SIO_LSR_ERR 0x80 // any error condition + +// The modem status register bits. +#define SIO_MSR_DCTS 0x01 // delta clear to send +#define SIO_MSR_DDSR 0x02 // delta data set ready +#define SIO_MSR_TERI 0x04 // trailing edge ring indicator +#define SIO_MSR_DDCD 0x08 // delta data carrier detect +#define SIO_MSR_CTS 0x10 // clear to send +#define SIO_MSR_DSR 0x20 // data set ready +#define SIO_MSR_RI 0x40 // ring indicator +#define SIO_MSR_DCD 0x80 // data carrier detect + +// The line control register bits. +#define SIO_LCR_WLS0 0x01 // word length select bit 0 +#define SIO_LCR_WLS1 0x02 // word length select bit 1 +#define SIO_LCR_STB 0x04 // number of stop bits +#define SIO_LCR_PEN 0x08 // parity enable +#define SIO_LCR_EPS 0x10 // even parity select +#define SIO_LCR_SP 0x20 // stick parity +#define SIO_LCR_SB 0x40 // set break +#define SIO_LCR_DLAB 0x80 // divisor latch access bit + +// The FIFO control register +#define SIO_FCR_FCR0 0x01 // enable xmit and rcvr fifos +#define SIO_FCR_FCR1 0x02 // clear RCVR FIFO +#define SIO_FCR_FCR2 0x04 // clear XMIT FIFO + +///////////////////////////////////////// +// Interrupt Enable Register +#define IER_RCV 0x01 +#define IER_XMT 0x02 +#define IER_LS 0x04 +#define IER_MS 0x08 + +// Line Control Register +#define LCR_WL5 0x00 // Word length +#define LCR_WL6 0x01 +#define LCR_WL7 0x02 +#define LCR_WL8 0x03 +#define LCR_SB1 0x00 // Number of stop bits +#define LCR_SB1_5 0x04 // 1.5 -> only valid with 5 bit words +#define LCR_SB2 0x04 +#define LCR_PN 0x00 // Parity mode - none +#define LCR_PE 0x0C // Parity mode - even +#define LCR_PO 0x08 // Parity mode - odd +#define LCR_PM 0x28 // Forced "mark" parity +#define LCR_PS 0x38 // Forced "space" parity +#define LCR_DL 0x80 // Enable baud rate latch + +// Line Status Register +#define LSR_RSR 0x01 +#define LSR_THE 0x20 + +// Modem Control Register +#define MCR_DTR 0x01 +#define MCR_RTS 0x02 +#define MCR_INT 0x08 // Enable interrupts +#define MCR_AFE 0x20 + +// Interrupt status register +#define ISR_None 0x01 +#define ISR_Rx_Line_Status 0x06 +#define ISR_Rx_Avail 0x04 +#define ISR_Rx_Char_Timeout 0x0C +#define ISR_Tx_Empty 0x02 +#define IRS_Modem_Status 0x00 + +// FIFO control register +#define FCR_ENABLE 0x01 +#define FCR_CLEAR_RCVR 0x02 +#define FCR_CLEAR_XMIT 0x04 + +#define CYG_DEV_SERIAL_BAUD_DIVISOR (MALTA_SER_CLOCK/16/CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD) + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +static const channel_data_t channels[2] = { + { (cyg_uint8*)MALTA_SER_16550_BASE_A, 1000, CYGNUM_HAL_INTERRUPT_TTY0}, + { (cyg_uint8*)MALTA_SER_16550_BASE_B, 1000, CYGNUM_HAL_INTERRUPT_TTY1} +}; + +//----------------------------------------------------------------------------- +// Set the baud rate + +static void +cyg_hal_plf_serial_set_baud(cyg_uint8* port, cyg_uint16 baud_divisor) +{ + cyg_uint8 _lcr; + + HAL_READ_UINT8(port+SER_16550_LCR, _lcr); + _lcr |= LCR_DL; + HAL_WRITE_UINT8(port+SER_16550_LCR, _lcr); + + HAL_WRITE_UINT8(port+SER_16550_DLM, baud_divisor >> 8); + HAL_WRITE_UINT8(port+SER_16550_DLL, baud_divisor & 0xff); + + _lcr &= ~LCR_DL; + HAL_WRITE_UINT8(port+SER_16550_LCR, _lcr); +} + +//----------------------------------------------------------------------------- +// The minimal init, get and put functions. All by polling. + +void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + cyg_uint8* port; + cyg_uint8 _lcr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + // Disable port interrupts while changing hardware + HAL_WRITE_UINT8(port+SER_16550_IER, 0); + + // Set databits, stopbits and parity. + _lcr = LCR_WL8 | LCR_SB1 | LCR_PN; + HAL_WRITE_UINT8(port+SER_16550_LCR, _lcr); + + // Set baud rate. + cyg_hal_plf_serial_set_baud(port, CYG_DEV_SERIAL_BAUD_DIVISOR); + + // Enable and clear FIFO + HAL_WRITE_UINT8(port+SER_16550_FCR, (FCR_ENABLE | FCR_CLEAR_RCVR | FCR_CLEAR_XMIT)); + + // enable RTS to keep host side happy. Also allow interrupts + HAL_WRITE_UINT8( port+SER_16550_MCR, MCR_DTR | MCR_RTS | MCR_INT); + + // Don't allow interrupts. + HAL_WRITE_UINT8(port+SER_16550_IER, 0); +} + +void +cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 __ch) +{ + cyg_uint8* port; + cyg_uint8 _lsr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + CYGARC_HAL_SAVE_GP(); + + do { + HAL_READ_UINT8(port+SER_16550_LSR, _lsr); + } while ((_lsr & SIO_LSR_THRE) == 0); + + // Now, the transmit buffer is empty + HAL_WRITE_UINT8(port+SER_16550_THR, __ch); + + // Hang around until the character has been safely sent. + do { + HAL_READ_UINT8(port+SER_16550_LSR, _lsr); + } while ((_lsr & SIO_LSR_THRE) == 0); + + CYGARC_HAL_RESTORE_GP(); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* port; + cyg_uint8 _lsr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + HAL_READ_UINT8(port+SER_16550_LSR, _lsr); + if ((_lsr & SIO_LSR_DR) == 0) + return false; + + HAL_READ_UINT8(port+SER_16550_RBR, *ch); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan; + cyg_uint8 ier; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + HAL_READ_UINT8(chan->base + SER_16550_IER, ier); + ier |= SIO_IER_ERDAI; + HAL_WRITE_UINT8(chan->base + SER_16550_IER, ier); + + HAL_INTERRUPT_SET_LEVEL(chan->isr_vector, 1); + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + HAL_READ_UINT8(chan->base + SER_16550_IER, ier); + ier &= ~SIO_IER_ERDAI; + HAL_WRITE_UINT8(chan->base + SER_16550_IER, ier); + + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + break; + case __COMMCTL_SETBAUD: + { + cyg_uint32 baud_rate; + cyg_uint16 baud_divisor; + cyg_uint8* port = chan->base; + va_list ap; + + va_start(ap, __func); + baud_rate = va_arg(ap, cyg_uint32); + va_end(ap); + + baud_divisor = (MALTA_SER_CLOCK / 16 / baud_rate); + + HAL_WRITE_UINT32(HAL_MALTA_BRKRES, 0); +#if 0 + // + // We may need to increase the timeout before causing a break reset. + // According to the Malta Users Manual (Document MD00005) The BRKRES + // register will need to be programmed with a value larger that 0xA (the default) + // if we are going to use a baud rate lower than 2400. + // + if (baud_rate <= 2400) + { + // For now, just disable the break reset entirely. + HAL_WRITE_UINT32(HAL_MALTA_BRKRES, 0); + } else { + // Put the break reset state back to the default + HAL_WRITE_UINT32(HAL_MALTA_BRKRES, HAL_MALTA_BRKRES_DEFAULT_VALUE); + } +#endif + // Disable port interrupts while changing hardware + HAL_READ_UINT8(port+SER_16550_IER, ier); + HAL_WRITE_UINT8(port+SER_16550_IER, 0); + + // Set baud rate. + cyg_hal_plf_serial_set_baud(port, baud_divisor); + + // Reenable interrupts if necessary + HAL_WRITE_UINT8(port+SER_16550_IER, ier); + } + break; + + case __COMMCTL_GETBAUD: + break; + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + cyg_uint8 _iir, c; + channel_data_t* chan; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + HAL_INTERRUPT_ACKNOWLEDGE(chan->isr_vector); + + HAL_READ_UINT8(chan->base + SER_16550_IIR, _iir); + _iir &= SIO_IIR_ID_MASK; + + *__ctrlc = 0; + if ((_iir == ISR_Rx_Avail) || (_iir == ISR_Rx_Char_Timeout)) { + + HAL_READ_UINT8(chan->base + SER_16550_RBR, c); + + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(channels[0].isr_vector); + HAL_INTERRUPT_MASK(channels[1].isr_vector); + + // Init channels + cyg_hal_plf_serial_init_channel((void*)&channels[0]); + cyg_hal_plf_serial_init_channel((void*)&channels[1]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Set channel 1 + CYGACC_CALL_IF_SET_CONSOLE_COMM(1); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[1]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +//----------------------------------------------------------------------------- +// end of ser16c550c.c + diff --git a/packages/hal/mips/malta/current/src/smsc37m81x.c b/packages/hal/mips/malta/current/src/smsc37m81x.c new file mode 100644 --- /dev/null +++ b/packages/hal/mips/malta/current/src/smsc37m81x.c @@ -0,0 +1,130 @@ +//============================================================================= +// +// smsc37m81x.c +// +// Init code for SMSC 37m81x super IO controller +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-04-02 +// Description: Init code for SMSC 37m81x super IO controller +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interrupt vectors + + +// From page 137+ in SMSC-37m81x.pdf +#define SMSC_CONFIG 0xb80003f0 +#define SMSC_CONFIG_DATA 0xb80003f1 + +#define SMSC_CONFIG_DEV 0x07 +#define SMSC_CONFIG_ACTIVATE 0x30 +#define SMSC_CONFIG_ENTER 0x55 +#define SMSC_CONFIG_BASE_HIGH 0x60 +#define SMSC_CONFIG_BASE_LOW 0x61 +#define SMSC_CONFIG_IRQ 0x70 +#define SMSC_CONFIG_EXIT 0xaa +#define SMSC_CONFIG_MODE 0xf0 + +#define SMSC_CONFIG_DEV_COM1 0x04 +#define SMSC_CONFIG_DEV_COM2 0x05 + +#define SMSC_CONFIG_MODE_HIGH 0x02 + +#define SMSC_CONFIG_ACTIVATE_ENABLE 0x01 + + +void +cyg_hal_init_superIO(void) +{ + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ENTER); + + // Configure and enable COM1 + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_DEV); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_DEV_COM1); + + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_HIGH); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, 0x03); + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_LOW); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, 0xf8); + + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_IRQ); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, + (CYGNUM_HAL_INTERRUPT_TTY0-CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE)); + + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_MODE); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_MODE_HIGH); + + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ACTIVATE); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_ACTIVATE_ENABLE); + + // Configure and enable COM2 + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_DEV); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_DEV_COM2); + + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_HIGH); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, 0x02); + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_LOW); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, 0xf8); + + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_IRQ); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, + (CYGNUM_HAL_INTERRUPT_TTY1-CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE)); + + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_MODE); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_MODE_HIGH); + + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ACTIVATE); + HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_ACTIVATE_ENABLE); + + HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_EXIT); + +} + +//----------------------------------------------------------------------------- +// end of smsc37m81x.c + diff --git a/packages/hal/mips/mips32/current/ChangeLog b/packages/hal/mips/mips32/current/ChangeLog --- a/packages/hal/mips/mips32/current/ChangeLog +++ b/packages/hal/mips/mips32/current/ChangeLog @@ -1,3 +1,8 @@ +2002-02-11 Jesper Skov + + * include/variant.inc: Initialize TRAP vector with break_vsr to + support div-by-zero breakpoints set by GCC. + 2001-12-04 Nick Garnett * include/var_arch.h: Added macros to read/write CP0 registers. @@ -68,27 +73,36 @@ 2000-07-14 Drew Moseley diff --git a/packages/hal/mips/mips32/current/src/var_misc.c b/packages/hal/mips/mips32/current/src/var_misc.c --- a/packages/hal/mips/mips32/current/src/var_misc.c +++ b/packages/hal/mips/mips32/current/src/var_misc.c @@ -5,29 +5,38 @@ // HAL implementation miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/mips32/current/src/variant.S b/packages/hal/mips/mips32/current/src/variant.S --- a/packages/hal/mips/mips32/current/src/variant.S +++ b/packages/hal/mips/mips32/current/src/variant.S @@ -5,29 +5,38 @@ ## MIPS 32 variant code ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mips/mips64/current/ChangeLog b/packages/hal/mips/mips64/current/ChangeLog --- a/packages/hal/mips/mips64/current/ChangeLog +++ b/packages/hal/mips/mips64/current/ChangeLog @@ -31,27 +31,36 @@ 2001-01-30 Nick Garnett diff --git a/packages/hal/mips/mips64/current/src/var_misc.c b/packages/hal/mips/mips64/current/src/var_misc.c --- a/packages/hal/mips/mips64/current/src/var_misc.c +++ b/packages/hal/mips/mips64/current/src/var_misc.c @@ -5,29 +5,38 @@ // HAL implementation miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/mips64/current/src/variant.S b/packages/hal/mips/mips64/current/src/variant.S --- a/packages/hal/mips/mips64/current/src/variant.S +++ b/packages/hal/mips/mips64/current/src/variant.S @@ -5,29 +5,38 @@ ## MIPS 64 variant code ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mips/ref4955/current/ChangeLog b/packages/hal/mips/ref4955/current/ChangeLog --- a/packages/hal/mips/ref4955/current/ChangeLog +++ b/packages/hal/mips/ref4955/current/ChangeLog @@ -1,3 +1,13 @@ +2002-05-13 Jesper Skov + + * cdl/hal_mips_tx49_ref4955.cdl: Removed implemntation of + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + +2002-04-24 Jesper Skov + + * cdl/hal_mips_tx49_ref4955.cdl: + CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES defined. + 2001-03-08 Jesper Skov * cdl/hal_mips_tx49_ref4955.cdl: Does not guarantee virtual vector @@ -310,27 +320,36 @@ 2000-05-10 Jesper Skov " puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " puts $::cdl_header "#define CYGHWR_HAL_MIPS_WARMSTART_COLDSTART" + + puts $::cdl_header "#define CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES 1000000" } cdl_component CYG_HAL_STARTUP { diff --git a/packages/hal/mips/ref4955/current/include/hal_diag.h b/packages/hal/mips/ref4955/current/include/hal_diag.h --- a/packages/hal/mips/ref4955/current/include/hal_diag.h +++ b/packages/hal/mips/ref4955/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/ref4955/current/include/platform.inc b/packages/hal/mips/ref4955/current/include/platform.inc --- a/packages/hal/mips/ref4955/current/include/platform.inc +++ b/packages/hal/mips/ref4955/current/include/platform.inc @@ -7,29 +7,38 @@ ## REF4955/TX4955 board assembler header file ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mips/ref4955/current/include/plf_cache.h b/packages/hal/mips/ref4955/current/include/plf_cache.h --- a/packages/hal/mips/ref4955/current/include/plf_cache.h +++ b/packages/hal/mips/ref4955/current/include/plf_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/ref4955/current/include/plf_intr.h b/packages/hal/mips/ref4955/current/include/plf_intr.h --- a/packages/hal/mips/ref4955/current/include/plf_intr.h +++ b/packages/hal/mips/ref4955/current/include/plf_intr.h @@ -8,29 +8,38 @@ // REF4955 Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/ref4955/current/include/plf_io.h b/packages/hal/mips/ref4955/current/include/plf_io.h --- a/packages/hal/mips/ref4955/current/include/plf_io.h +++ b/packages/hal/mips/ref4955/current/include/plf_io.h @@ -8,29 +8,38 @@ // HAL platform device IO register support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/ref4955/current/include/plf_stub.h b/packages/hal/mips/ref4955/current/include/plf_stub.h --- a/packages/hal/mips/ref4955/current/include/plf_stub.h +++ b/packages/hal/mips/ref4955/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/ref4955/current/src/hal_diag.c b/packages/hal/mips/ref4955/current/src/hal_diag.c --- a/packages/hal/mips/ref4955/current/src/hal_diag.c +++ b/packages/hal/mips/ref4955/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/ref4955/current/src/pc87338.c b/packages/hal/mips/ref4955/current/src/pc87338.c --- a/packages/hal/mips/ref4955/current/src/pc87338.c +++ b/packages/hal/mips/ref4955/current/src/pc87338.c @@ -7,29 +7,38 @@ // Simple driver for the serial controllers in the PC87338 SuperIO chip // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/ref4955/current/src/platform.S b/packages/hal/mips/ref4955/current/src/platform.S --- a/packages/hal/mips/ref4955/current/src/platform.S +++ b/packages/hal/mips/ref4955/current/src/platform.S @@ -5,29 +5,38 @@ ## MIPS REF4955-TX4955 platform code ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mips/ref4955/current/src/plf_misc.c b/packages/hal/mips/ref4955/current/src/plf_misc.c --- a/packages/hal/mips/ref4955/current/src/plf_misc.c +++ b/packages/hal/mips/ref4955/current/src/plf_misc.c @@ -5,29 +5,38 @@ // HAL platform miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/ref4955/current/src/plf_mk_defs.c b/packages/hal/mips/ref4955/current/src/plf_mk_defs.c --- a/packages/hal/mips/ref4955/current/src/plf_mk_defs.c +++ b/packages/hal/mips/ref4955/current/src/plf_mk_defs.c @@ -5,29 +5,38 @@ // HAL (platform) "make defs" program // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/ref4955/current/src/plf_stub.c b/packages/hal/mips/ref4955/current/src/plf_stub.c --- a/packages/hal/mips/ref4955/current/src/plf_stub.c +++ b/packages/hal/mips/ref4955/current/src/plf_stub.c @@ -5,29 +5,38 @@ // Platform specific code for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/rm7000/ocelot/current/ChangeLog b/packages/hal/mips/rm7000/ocelot/current/ChangeLog --- a/packages/hal/mips/rm7000/ocelot/current/ChangeLog +++ b/packages/hal/mips/rm7000/ocelot/current/ChangeLog @@ -199,27 +199,36 @@ 2000-11-30 Jesper Skov diff --git a/packages/hal/mips/rm7000/var/current/src/var_misc.c b/packages/hal/mips/rm7000/var/current/src/var_misc.c --- a/packages/hal/mips/rm7000/var/current/src/var_misc.c +++ b/packages/hal/mips/rm7000/var/current/src/var_misc.c @@ -5,29 +5,38 @@ // HAL implementation miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/rm7000/var/current/src/var_mk_defs.c b/packages/hal/mips/rm7000/var/current/src/var_mk_defs.c --- a/packages/hal/mips/rm7000/var/current/src/var_mk_defs.c +++ b/packages/hal/mips/rm7000/var/current/src/var_mk_defs.c @@ -5,29 +5,38 @@ // HAL (variant) "make defs" program // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/rm7000/var/current/src/variant.S b/packages/hal/mips/rm7000/var/current/src/variant.S --- a/packages/hal/mips/rm7000/var/current/src/variant.S +++ b/packages/hal/mips/rm7000/var/current/src/variant.S @@ -5,29 +5,38 @@ ## MIPS RM7000 variant code ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mips/sim/current/ChangeLog b/packages/hal/mips/sim/current/ChangeLog --- a/packages/hal/mips/sim/current/ChangeLog +++ b/packages/hal/mips/sim/current/ChangeLog @@ -232,27 +232,36 @@ 1998-07-23 Nick Garnett diff --git a/packages/hal/mips/tx39/current/src/var_misc.c b/packages/hal/mips/tx39/current/src/var_misc.c --- a/packages/hal/mips/tx39/current/src/var_misc.c +++ b/packages/hal/mips/tx39/current/src/var_misc.c @@ -5,29 +5,38 @@ // HAL implementation miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/tx39/current/src/variant.S b/packages/hal/mips/tx39/current/src/variant.S --- a/packages/hal/mips/tx39/current/src/variant.S +++ b/packages/hal/mips/tx39/current/src/variant.S @@ -5,29 +5,38 @@ ## MIPS JMR-TX3904 variant code ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mips/tx49/current/ChangeLog b/packages/hal/mips/tx49/current/ChangeLog --- a/packages/hal/mips/tx49/current/ChangeLog +++ b/packages/hal/mips/tx49/current/ChangeLog @@ -96,27 +96,36 @@ 2000-05-09 Jesper Skov diff --git a/packages/hal/mips/tx49/current/src/var_misc.c b/packages/hal/mips/tx49/current/src/var_misc.c --- a/packages/hal/mips/tx49/current/src/var_misc.c +++ b/packages/hal/mips/tx49/current/src/var_misc.c @@ -5,29 +5,38 @@ // HAL implementation miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/tx49/current/src/variant.S b/packages/hal/mips/tx49/current/src/variant.S --- a/packages/hal/mips/tx49/current/src/variant.S +++ b/packages/hal/mips/tx49/current/src/variant.S @@ -5,29 +5,38 @@ ## MIPS REF4955/TX4955 variant code ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mips/upd985xx/current/ChangeLog b/packages/hal/mips/upd985xx/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/ChangeLog @@ -0,0 +1,364 @@ +2002-04-02 Hugo Tyson +2002-04-02 Anssi Pulkkinen + + * src/var_misc.c (cyg_hal_interrupt_acknowledge): Remove the read + of the read-clear ISR register - it loses other pending interrupt + sources. Thanks to ASCOM for spotting this. It should have been + removed when the soft-copy and arbitration ISR were added, because + those changes mean the hardware register would already be cleared + down. + +2002-01-22 Hugo Tyson + + * cdl/hal_mips_upd985xx.cdl: CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + must not be enabled because the way the arbitration ISR is + attached does not work with chained interrupts. + +2001-10-30 Jonathan Larmour + + * cdl/hal_mips_upd985xx.cdl (CYGHWR_HAL_MIPS_UPD985XX_DIAG_BAUD): + This is the same as CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD + which RedBoot uses, so define it. + And also reimplement CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + as this is what makes it work. + +2001-10-30 Hugo Tyson + + * cdl/hal_mips_upd985xx.cdl: Platform does *not* implement VV baud + operations, in fact the implements + CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT prevents it building. + +2001-10-09 Hugo Tyson + + * cdl/hal_mips_upd985xx.cdl (..._MIPS_UPD985XX_HARDWARE_BUGS...): + New CDL options to control workarounds for System Controller bugs + S1 and S2. Shorthand for S1 requires the fixes elsewhere. That + for S2 selects alternate versions of the interrupt code. + + * include/var_intr.h (HAL_INTERRUPT_ACKNOWLEDGE,...): Alternative + versions which call the new routines in src/var_misc.c to deal + with System Controller interrupts. + + * src/var_misc.c (cyg_hal_interrupt_unmask,...): New routines to + manage the System Controller interrupts by software rather than + S_ISR/S_IMR. We never mask an interrupt once unmasked, but let + the interrupt happen, fielding it silently. When/if it becomes + unmasked, then we call the ISR &c. + +2001-08-17 Jonathan Larmour + + * cdl/hal_mips_upd985xx.cdl: Platform implements VV baud operations. + +2001-08-08 Hugo Tyson + + * include/variant.inc (hal_intc_decode): Do not decode the S_ISR + interrupts after all - they must be handled by arbitration. So + any S_ISR interrupt is reported as CYGNUM_HAL_INTERRUPT_SYSCTL - + Who are they? They are *all* number 6. + + * src/var_misc.c (_arbitration_isr): New routine to arbitrate + between - and call all of - the interrupt sources that hang off + the system controller S_ISR register, because the S_ISR register + is read-clear, and the interrupt sources are edge-triggered so + they do not re-assert themselves - so we must address multiple + sources per actual interrupt. + (hal_variant_init): Install _arbitration_isr() on the SYSCTL + interrupt at startup. + + * include/var_intr.h: Commented the change in interrupt usage - + the SYSCTL is occupied from time zero. + +2001-08-01 Hugo Tyson + + * src/hal_mips_upd985xx.ld (hal_interrupt_sr_mask_shadow_base): + This must be placed statically so it is shared with RedBoot. And + it must be an array so that we can address it from afar. + + * include/var_intr.h (HAL_DISABLE_INTERRUPTS): Implement this + macro and its fellows as well as the individual MASK/UNMASK + routines; these work together to keep the SR IM bits "true" to + what is intended by means of a shadow variable. Otherwise a race + condition in the vanilla HAL_DISABLE_INTERRUPTS() can discard an + interrupt mask change made by an ISR. + (hal_interrupt_sr_mask_shadow): declare this and define it to + entry zero of hal_interrupt_sr_mask_shadow_base[]. + + * src/var_misc.c (hal_interrupt_sr_mask_shadow): initialize this + new variable. + + * cdl/hal_mips_upd985xx.cdl (CYGPKG_HAL_MIPS_UPD985XX): set + CYGINT_HAL_MIPS_INTERRUPT_RETURN_KEEP_SR_IM because we use bits + within the SR for interrupt control. + +2001-07-25 Hugo Tyson + + * include/var_intr.h (CYGNUM_HAL_INTERRUPT_SOFT_ZERO) + (CYGNUM_HAL_INTERRUPT_SOFT_ONE): New interrupt numbers for + software interrupts 0 and 1. Also mask, unmask, and ack them + correctly; ack clears the R/W bit in the cause regsiter. + + * include/variant.inc (hal_intc_decode) : Decode Software + interrupts into numbers 0 and 1 - all else are moved up a bit. + +2001-07-20 Hugo Tyson + + * cdl/hal_mips_upd985xx.cdl: Demand that CYGPKG_LIBM includes + -fno-strict-aliasing in its CFLAGS_ADD to workaround a tools issue + with access to double via pointer-to-union casts. + +2001-07-18 Hugo Tyson + + * include/var_arch.h (UARTLCR_8N1): Add more divers definitions of + UART control bits for implementing all the controls in the serial + device that nobody ever uses. + +2001-07-17 Hugo Tyson + + * include/variant.inc: If RAM startup, don't blow away the + contents of cache - it might contain things that matter such as + debug connection state. + +2001-07-09 Hugo Tyson + + * include/var_arch.h (SDMDR_INIT): Change one of the numbers to + match what's in the hardware when set up by customer code. + + * include/variant.inc: Remove dependency on temporary development + config point CYGBLD_HAL_STARTUP_ROM_POST_OMIT_INITIALIZATION - the + initialization now works OK. So hal_memc_setup_table gets called. + + * src/variant.S (hal_memc_setup_table): ROM startup now works, so + this code now gets called. + +2001-07-06 Hugo Tyson + + * src/hal_diag.c (hal_uart_init): Ensure that we use the internal + baud clock because there is no external one. + + * include/var_arch.h (UARTCLOCK): Clock is now 50MHz for "new" + boards, not 18.xMHz any more. + +2001-07-03 Hugo Tyson + + * include/var_intr.h (HAL_INTERRUPT_[UN]MASK): Better manipulate + these with interrupts disabled for atomicity. + +2001-07-02 Bart Veer + + * src/var_misc.c (hal_variant_init): + Move the GPIO0 manipulating (flash programming voltagE) + to the platform-init. + +2001-06-27 Hugo Tyson + + This all fixes the serial interrupt problem of 2001-06-26. + + * src/var_misc.c (hal_variant_init): Initialize the system + controller's ISR/IMR registers to mask and ack all external + interrupts and then enable the underlying interrupt source that + controls them all. + Also provide hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT]; &c for + use by system in vectors.S, and initialize them. + + * src/hal_diag.c (cyg_hal_plf_serial_isr): Do not paranoically + acknowledge spurious interrupts. No need. + + * include/variant.inc: Add complete redefinitions of interrupt + decoding to handle extended interrupt sources from the system + controller's ISR/IMR registers. + + * include/var_intr.h: Add complete redefinitions of interrupt + management to handle extended interrupt sources from the system + controller's ISR/IMR registers. + + * include/var_arch.h (S_ISR_ADR): Add ISR and IMR register + addresses for use by assembly files. + + * include/plf_stub.h: Provide proto for cyg_hal_plf_comms_init() + to reduce warning. + +2001-06-26 Hugo Tyson + + * cdl/hal_mips_upd985xx.cdl: Remove src/var_stub.c - functionality + is duplicated in the common HAL. + + * include/plf_stub.h: Remove a load of unneccessary cruft which is + duplicated in the common HAL. + + * src/var_stub.c: Removed. + +2001-06-26 Hugo Tyson + + * src/var_misc.c (hal_variant_init): Unmask the UART interrupt in + the system controller - this is before the interrupt system in the + MIPS core which is used for dynamic control. + + Also removed a load of duplicate hal_ctrlc_isr/HAL_CTRLC_ISR stuff + that fought with the common HAL, + + Asynchronous CTRL-C still does not work. The interrupt asserts + forever. This is similar to System Controller known bug S2 + "Interrupt Mask Restriction" from the NEC docs. Hence this code + in this file: + // *******************FIXME + // This causes an interrupt loop from the UART as soon as you do IO. + // *S_IMR |= S_ISR_UARTIS; // unmask UART + // *******************NB we mask it here so that the status is in control + // ******************* of the application code whatever RedBoot does. + *S_IMR &=~S_ISR_UARTIS; + // *******************FIXME + + * src/hal_diag.c (cyg_hal_plf_serial_isr): This now contains all + it should need to. + (cyg_hal_plf_serial_control): Ditto, all cases now supported. + + CYGHWR_HAL_GDB_PORT_VECTOR use now unconditional, other tidyups. + Bugfix to interrupt ack in nonblocking read, it was after the + return. + + * cdl/hal_mips_upd985xx.cdl: We want to support ^Cm, so do not + implement CYGINT_HAL_DEBUG_GDB_CTRLC_UNSUPPORTED. + + * include/var_intr.h (HAL_READ_INTR_REGS): New macro, handy for + debugging MIPS. Also remove duplicate hal_ctrlc_isr/HAL_CTRLC_ISR + stuff that fought with the common HAL, just leaving + CYGHWR_HAL_GDB_PORT_VECTOR defined. + + * src/var_stub.c (hal_var_stub_init): Use symbols for entries in + vector tables and the like. + +2001-06-22 Hugo Tyson + + * include/variant.inc: Use the proper target-agnostic config + include CYGBLD_HAL_PLATFORM_H, and do not initialize the memory + controller if you're told not to by the platform configuration + CYGBLD_HAL_STARTUP_ROM_POST_OMIT_INITIALIZATION. + +2001-06-22 Hugo Tyson + + * src/var_misc.c (hal_variant_init): Enable write-access to the + flash area, and power-up the programming voltage via GPIO0, so + that flash drivers can work. Also enable the IBUS Arbiter so that + internal peripherals can work. + + * src/variant.S (hal_memc_setup): Remove hal_memc_setup for RAM + start; the work is done elsewhere. + + * include/variant.inc (hal_memc_init): Don't call hal_memc_setup + for RAM start. + +2001-06-07 Hugo Tyson + + * include/variant.inc (hal_memc_init): Always do the memc call + even in RAM start, to enable... + + * src/variant.S (hal_memc_setup): Enable write-access to the flash + area so that flash drivers can work. + +2001-06-06 Hugo Tyson + + * include/var_cache.h (HAL_DCACHE_ENABLE_DEFINED): Add enough NOPs + after diddling the cache-enability that it works. Also give + correct (apparantly!) figures for cache size despite the + documentation arguing with itself. + + * src/var_misc.c (hal_variant_init): Enable the caches during + startup. + + * include/var_arch.h: Add a very few definitions for use by + assembler code here, and tidy up a little so that it can be used + from .S files. Specifically this is to let us init the RAM and + ROM access controllers from assembly. + + * src/variant.S: + * include/variant.inc: Cut out some stuff we don't need that I had + blindly copied from another platform. Specifically we don't need + to set up the TLB *at all* because all its space are belong, um, + all memory, IO and devices are accessible through kseg1 and kseg0. + Added initial (untested) cut at setup of RAM/ROM controllers. + +2001-06-06 Hugo Tyson + + * cdl/hal_mips_upd985xx.cdl: Add implements statement for + CYGINT_HAL_DEBUG_GDB_STUBS_BREAK, moved from the platform HAL. + +2001-06-05 Hugo Tyson + + * include/variant.inc: It all works rather better now... fiddling + with vector setup and cache initialization. + +2001-06-05 Hugo Tyson + + * cdl/hal_mips_upd985xx.cdl: to make GDB stubs work, implements + CYGINT_HAL_MIPS_STUB_REPRESENT_32BIT_AS_64BIT. Commented out + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + + * include/hal_diag.h: Now it works, properly be dependent on + CYGSEM_HAL_VIRTUAL_VECTOR_DIAG. + + * include/plf_stub.h: Choose the right init routine dependent on + CYGSEM_HAL_VIRTUAL_VECTOR_DIAG. + + * src/hal_diag.c (hal_uart_init): Remove diagnostics and delays + from initialization. + + * src/var_stub.c (hal_var_stub_init): Remove bogus definition of + vsr_table and leave breakpoint VSR alone, the springboard will + handle it AOK. + +2001-06-04 Hugo Tyson + + * cdl/hal_mips_upd985xx.cdl + * include/hal_diag.h + * include/plf_stub.h + * include/var_arch.h + * include/var_cache.h + * include/var_intr.h + * include/variant.inc + * src/hal_diag.c + * src/hal_mips_upd985xx.ld + * src/var_misc.c + * src/var_stub.c + * src/variant.S + New files; initial checkin. + + RAM startup works; kernel tests run, loaded via SRecords, + including tm_basic, clockcnv, mutex3 and the exception tests. + Virtual vector calling works, but all apps do not work with a ROM + monitor, so they are all standalone. Diag printf et all all work. + Floating point emulation works. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/mips/upd985xx/current/cdl/hal_mips_upd985xx.cdl b/packages/hal/mips/upd985xx/current/cdl/hal_mips_upd985xx.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/cdl/hal_mips_upd985xx.cdl @@ -0,0 +1,228 @@ +# ==================================================================== +# +# hal_mips_upd985xx.cdl +# +# MIPS/UPD985XX variant architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): hmt, jskov +# Original data: nickg +# Contributors: +# Date: 2001-05-24 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_MIPS_UPD985XX { + display "UPD985XX variant" + parent CYGPKG_HAL_MIPS + implements CYGINT_HAL_MIPS_VARIANT + hardware + include_dir cyg/hal + define_header hal_mips_upd985xx.h + description " + The UPD985XX variant HAL package provides generic support + for this NEC system-on-chip processor architecture, uPD985xx. + It is also necessary to + select a specific target platform HAL package." + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + + implements CYGINT_HAL_MIPS_STUB_REPRESENT_32BIT_AS_64BIT + + implements CYGINT_HAL_MIPS_INTERRUPT_RETURN_KEEP_SR_IM + + # The way the arbitration ISR is attached does not work with chained interrupts + requires ! CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + There is only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + There is only one serial port. This option + chooses which port will be used for diagnostic output." + } + + cdl_option CYGHWR_HAL_MIPS_UPD985XX_DIAG_BAUD { + display "Diagnostic Serial Port Baud Rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + define CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD + description " + This option selects the baud rate used for the diagnostic port. + Note: this must match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGHWR_HAL_MIPS_UPD985XX_GDB_BAUD { + display "GDB Serial Port Baud Rate" + active_if { CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL != \ + CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL } + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + description " + This option controls the baud rate used for the GDB connection." + } + + cdl_component CYGPKG_HAL_MIPS_UPD985XX_HARDWARE_BUGS { + display "Workarounds for uPD98503 hardware bugs " + flavor bool + default_value 1 + description " + This component controls whether code workarounds for the + hardware bugs in the uPD98503 System Controller and IBUS are included. + Please refer to the manufacturer's + Behaviour Analysis Report to make your decision about which of + these options to enable or disable. + The default is to enable all workarounds for best reliability. + Please refer to the + USB and Ethernet devices for controls for subsystem specific + workarounds such as U3 and U4 in the USB; or E1,E2,E3 and E8 in + the ethernet." + + cdl_option CYGOPT_HAL_MIPS_UPD985XX_HARDWARE_BUGS_S1 { + display "S1 - CPU to IBUS write restriction" + active_if { CYGPKG_DEVS_USB_UPD985XX || CYGPKG_DEVS_ETH_MIPS_UPD985XX } + flavor bool + default_value 1 + # require either the workaround, or not the package ; + requires { CYGIMP_DEVS_USB_UPD985XX_IBUS_WRITE_LIMIT || !CYGPKG_DEVS_USB_UPD985XX } + requires { CYGOPT_DEVS_ETH_MIPS_UPD985XX_HARDWARE_BUGS_S1 || !CYGPKG_DEVS_ETH_MIPS_UPD985XX} + description " + This workaround is actually implemented in the Ethernet and USB + drivers; this option is a short cut to enable those options when + those packages are included in the build." + } + cdl_option CYGOPT_HAL_MIPS_UPD985XX_HARDWARE_BUGS_S2 { + display "S2 - Interrupt Mask restriction" + flavor bool + default_value 1 + description " + Problem 'S2' is that masking an interrupt source at the same + instant that the interrupt 'fires' can lock up the system. + This workaround enables code which never masks an interrupt + once it has been unmasked, and silently fields any interrupts + which occur when that interrupt is soft-masked. When the + interrupt is unmasked by the application, then passing on the + interrupt is once more permitted, and any stored-up interrupt + will have its ISR called, otherwise interrupts would be + lost; they would not pend until the interrupt is unmasked. + This tactic is only possible due to the edge-triggered nature + of the interrupt controller in this device." + } + } + + cdl_option CYGHWR_HAL_MIPS_64BIT { + display "Variant 64 bit architecture support" + calculated 0 + description " + While the vr4100 is a 64bit CPU core, only its 32bit mode is + currently supported in eCos." + } + + cdl_option CYGHWR_HAL_MIPS_FPU { + display "Variant FPU support" + calculated 0 + } + + cdl_option CYGHWR_HAL_MIPS_FPU_64BIT { + display "Variant 64 bit FPU support" + calculated 0 + } + + cdl_option CYGPKG_HAL_MIPS_LSBFIRST { + display "CPU Variant little-endian" + calculated 1 + } + + cdl_option CYGPKG_HAL_MIPS_MSBFIRST { + display "CPU Variant big-endian" + calculated { ! CYGPKG_HAL_MIPS_LSBFIRST } + } + + define_proc { + puts $::cdl_header "#include " + } + + compile variant.S var_misc.c hal_diag.c + + make { + /lib/target.ld: /src/hal_mips_upd985xx.ld + $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 target.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm target.tmp + } + + cdl_option CYGBLD_LINKER_SCRIPT { + display "Linker script" + flavor data + no_define + calculated { "src/hal_mips_upd985xx.ld" } + } + +} diff --git a/packages/hal/mips/upd985xx/current/include/hal_diag.h b/packages/hal/mips/upd985xx/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/include/hal_diag.h @@ -0,0 +1,89 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, nickg +// Contributors: nickg +// Date: 2001-05-25 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include + +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +#else // everything by steam + +/*---------------------------------------------------------------------------*/ +/* functions implemented in hal_diag.c */ + +externC void hal_diag_init(void); + +externC void hal_diag_write_char(char c); + +externC void hal_diag_read_char(char *c); + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() hal_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +#endif // ! CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_HAL_DIAG_H */ diff --git a/packages/hal/mips/upd985xx/current/include/plf_stub.h b/packages/hal/mips/upd985xx/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/include/plf_stub.h @@ -0,0 +1,80 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, jskov +// Contributors:jskov +// Date: 2001-05-25 +// Purpose: Platform HAL stub support for MIPS/uUPD985xx devices. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define serial stuff. +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 +#define HAL_STUB_PLATFORM_INIT_BREAK_IRQ() CYG_EMPTY_STATEMENT + +//---------------------------------------------------------------------------- +// Stub initializer. + +#define HAL_STUB_PLATFORM_INIT() /* nothing */ + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/mips/upd985xx/current/include/var_arch.h b/packages/hal/mips/upd985xx/current/include/var_arch.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/include/var_arch.h @@ -0,0 +1,374 @@ +#ifndef CYGONCE_HAL_VAR_ARCH_H +#define CYGONCE_HAL_VAR_ARCH_H +//========================================================================== +// +// var_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, nickg +// Contributors: nickg +// Date: 2001-05-24 +// Purpose: Define architecture abstractions +// Description: This file contains any extra or modified definitions for +// this variant of the architecture. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +// ------------------------------------------------------------------------- +// Although the VR4100 is really a 64 bit CPU, we have defined +// target_register_t elsewhere to be 32-bits because we only support +// 32-bit mode. Registers will still be sent to GDB as 64-bit, but that's +// not relevant for CYG_HAL_GDB_REG. + +#define CYG_HAL_GDB_REG CYG_WORD32 + +//-------------------------------------------------------------------------- +// Now defines for all the system controller registers +// +// These all exist at base 0x1000_0000 in physical memory. + +#define MIPS_KSEG0_BASE (0x80000000u) +#define MIPS_KSEG1_BASE (0xA0000000u) + +#define UPD985XX_SYSTEM_BASE (0x10000000u) + +#define MIPS_IO_BASE (MIPS_KSEG1_BASE + UPD985XX_SYSTEM_BASE) + +#define UPD985XX_SYSCTL_OFF (0x0000u) +#define UPD985XX_SYSUSB_OFF (0x1000u) +#define UPD985XX_SYSETH_OFF (0x2000u) + +#define UPD985XX_SYSCTL_REG( n ) ((volatile unsigned int *)\ + (MIPS_IO_BASE + UPD985XX_SYSCTL_OFF + (unsigned)(n))) +#define UPD985XX_SYSUSB_REG( n ) ((volatile unsigned int *)\ + (MIPS_IO_BASE + UPD985XX_SYSUSB_OFF + (unsigned)(n))) +#define UPD985XX_SYSETH_REG( n ) ((volatile unsigned int *)\ + (MIPS_IO_BASE + UPD985XX_SYSETH_OFF + (unsigned)(n))) + +// This for the few that we need in assembly +#define UPD985XX_SYSCTL_ADDR( n ) (0xb0000000 + (n)) + +// (the noise at the end of these lines is the default value) +#define S_GMR UPD985XX_SYSCTL_REG( 0x00) // General Mode Register 00000000H +#define S_GSR UPD985XX_SYSCTL_REG( 0x04) // General Status Register unknown +#define S_ISR UPD985XX_SYSCTL_REG( 0x08) // Interrupt Status Register 00000000H +#define S_IMR UPD985XX_SYSCTL_REG( 0x0C) // Interrupt Mask Register 00000000H +#define S_NSR UPD985XX_SYSCTL_REG( 0x10) // NMI Status Register 00000000H +#define S_NMR UPD985XX_SYSCTL_REG( 0x14) // NMI Mask Register 00000000H +#define S_VER UPD985XX_SYSCTL_REG( 0x18) // Version Register 00000301H +// N/A UPD985XX_SYSCTL_REG( 0x1C) reserved 00000000H +#define S_GIOER UPD985XX_SYSCTL_REG( 0x20) // GPIO Output Enable Register 00000000H +#define S_GOPR UPD985XX_SYSCTL_REG( 0x24) // GPIO Output (Write) Register 00000000H +#define S_GIPR UPD985XX_SYSCTL_REG( 0x28) // GPIO Input (Read) Register 00000000H +// N/A UPD985XX_SYSCTL_REG( 0x2C) // Reserved unknown +#define S_WRCR UPD985XX_SYSCTL_REG( 0x30) // Warm Reset Control Register 00000000H +#define S_WRSR UPD985XX_SYSCTL_REG( 0x34) // Warm Reset Status Register 00000000H +#define S_PWCR UPD985XX_SYSCTL_REG( 0x38) // Power Control Register 00000000H +#define S_PWSR UPD985XX_SYSCTL_REG( 0x3C) // Power Control Status Register 00000000H +// N/A UPD985XX_SYSCTL_REG( 0x40) Reserved unknown +#define ITCNTR UPD985XX_SYSCTL_REG( 0x4C) // IBUS Timeout Timer Control Register 00000000H +#define ITSETR UPD985XX_SYSCTL_REG( 0x50) // IBUS Timeout Timer Set Register 80000000H +// N/A UPD985XX_SYSCTL_REG( 0x54) Reserved unknown +// UPD985XX_SYSCTL_REG( 0x7F) +#define UARTRBR UPD985XX_SYSCTL_REG( 0x80) // UART, Receiver Buffer Register [DLAB=0,READ] unknown +#define UARTTHR UPD985XX_SYSCTL_REG( 0x80) // UART, Transmitter Holding Register [DLAB=0,WRITE] unknown +#define UARTDLL UPD985XX_SYSCTL_REG( 0x80) // UART, Divisor Latch LSB Register [DLAB=1] unknown +#define UARTIER UPD985XX_SYSCTL_REG( 0x84) // UART, Interrupt Enable Register [DLAB=0] unknown +#define UARTDLM UPD985XX_SYSCTL_REG( 0x84) // UART, Divisor Latch MSB Register [DLAB=1] unknown +#define UARTIIR UPD985XX_SYSCTL_REG( 0x88) // UART, Interrupt ID Register [READ] unknown +// The uPD985xx devices do not support UART FIFOs. +#define UARTFCR UPD985XX_SYSCTL_REG( 0x88) // UART, FIFO control Register [WRITE] +#define UARTLCR UPD985XX_SYSCTL_REG( 0x8C) // UART, Line control Register unknown +#define UARTMCR UPD985XX_SYSCTL_REG( 0x90) // UART, Modem Control Register unknown +#define UARTLSR UPD985XX_SYSCTL_REG( 0x94) // UART, Line status Register unknown +#define UARTMSR UPD985XX_SYSCTL_REG( 0x98) // UART, Modem Status Register unknown +#define UARTSCR UPD985XX_SYSCTL_REG( 0x9C) // UART, Scratch Register unknown +#define DSUCNTR UPD985XX_SYSCTL_REG( 0xA0) // DSU Control Register 00000000H +#define DSUSETR UPD985XX_SYSCTL_REG( 0xA4) // DSU Dead Time Set Register 80000000H +#define DSUCLRR UPD985XX_SYSCTL_REG( 0xA8) // DSU Clear Register 00000000H +#define DSUTIMR UPD985XX_SYSCTL_REG( 0xAC) // DSU Elapsed Time Register 00000000H +#define TMMR UPD985XX_SYSCTL_REG( 0xB0) // Timer Mode Register 00000000H +#define TM0CSR UPD985XX_SYSCTL_REG( 0xB4) // Timer CH0 Count Set Register 00000000H +#define TM1CSR UPD985XX_SYSCTL_REG( 0xB8) // Timer CH1 Count Set Register 00000000H +#define TM0CCR UPD985XX_SYSCTL_REG( 0xBC) // Timer CH0 Current Count Register FFFFFFFFH +#define TM1CCR UPD985XX_SYSCTL_REG( 0xC0) // Timer CH1 Current Count Register FFFFFFFFH +// N/A UPD985XX_SYSCTL_REG( 0xC4) Reserved unknown +// UPD985XX_SYSCTL_REG( 0xCF) +#define ECCR UPD985XX_SYSCTL_REG( 0xD0) // EEPROM Command Control Register 00000000H +#define ERDR UPD985XX_SYSCTL_REG( 0xD4) // EEPROM Read Data Register 80000000H +#define MACAR1 UPD985XX_SYSCTL_REG( 0xD8) // MAC Address Register 1 00000000H +#define MACAR2 UPD985XX_SYSCTL_REG( 0xDC) // MAC Address Register 2 00000000H +#define MACAR3 UPD985XX_SYSCTL_REG( 0xE0) // MAC Address Register 3 00000000H +// N/A UPD985XX_SYSCTL_REG( 0xE4) Reserved unknown +// UPD985XX_SYSCTL_REG( 0xFF) +#define RMMDR UPD985XX_SYSCTL_REG(0x100) // Boot ROM Mode Register 00000000H +#define RMATR UPD985XX_SYSCTL_REG(0x104) // Boot ROM Access Timing Register 00000000H +#define SDMDR UPD985XX_SYSCTL_REG(0x108) // SDRAM Mode Register 00000330H +#define SDTSR UPD985XX_SYSCTL_REG(0x10C) // SDRAM Type Selection Register 00000000H +#define SDPTR UPD985XX_SYSCTL_REG(0x110) // SDRAM Precharge Timing Register 00000142H +// N/A UPD985XX_SYSCTL_REG(0x114) ---- ---- Reserved unknown +// UPD985XX_SYSCTL_REG(0x11B) +#define SDRMR UPD985XX_SYSCTL_REG(0x11C) // SDRAM Refresh Mode Register 00000200H +#define SDRCR UPD985XX_SYSCTL_REG(0x120) // SDRAM Refresh Timer Count Register 00000200H +#define MBCR UPD985XX_SYSCTL_REG(0x124) // Memory Bus Control Register 00000000H +#define MESR UPD985XX_SYSCTL_REG(0x128) // Memory Error Status Register 00000000H +#define MEAR UPD985XX_SYSCTL_REG(0x12C) // Memory Error Address Register 00000000H + +// The few that we need from assembly +#define S_ISR_ADR UPD985XX_SYSCTL_ADDR( 0x08) // Interrupt Status Register 00000000H +#define S_IMR_ADR UPD985XX_SYSCTL_ADDR( 0x0C) // Interrupt Mask Register 00000000H + +#define RMMDR_ADR UPD985XX_SYSCTL_ADDR(0x100) // Boot ROM Mode Register 00000000H +#define RMATR_ADR UPD985XX_SYSCTL_ADDR(0x104) // Boot ROM Access Timing Register 00000000H +#define SDMDR_ADR UPD985XX_SYSCTL_ADDR(0x108) // SDRAM Mode Register 00000330H +#define SDTSR_ADR UPD985XX_SYSCTL_ADDR(0x10C) // SDRAM Type Selection Register 00000000H +#define SDPTR_ADR UPD985XX_SYSCTL_ADDR(0x110) // SDRAM Precharge Timing Register 00000142H + +#define SDRMR_ADR UPD985XX_SYSCTL_ADDR(0x11C) // SDRAM Refresh Mode Register 00000200H +#define SDRCR_ADR UPD985XX_SYSCTL_ADDR(0x120) // SDRAM Refresh Timer Count Register 00000200H +#define MBCR_ADR UPD985XX_SYSCTL_ADDR(0x124) // Memory Bus Control Register 00000000H +#define MESR_ADR UPD985XX_SYSCTL_ADDR(0x128) // Memory Error Status Register 00000000H +#define MEAR_ADR UPD985XX_SYSCTL_ADDR(0x12C) // Memory Error Address Register 00000000H + +// --------------------------------------------------------------------------- +// Contents of all these glorious registers: + +// --------- general --------- +// S_GMR General Mode Register 00000000H +#define S_GMR_CRST 1 // Cold Reset +#define S_GMR_IAEN 2 // IBUS Arbiter Enable +#define S_GMR_MPFD 4 // Memory-to-CPU Prefetch FIFO disable +#define S_GMR_UCSEL 8 // UART Source Clock Selection (0 = CPU, 1 = ext) +#define S_GMR_HSWP (1<<8) // HIF Block Data swap function disable +#define S_GMR_MSWP (1<<9) // MIF Block Data swap function disable + +// S_GSR General Status Register +#define S_GSR_ENDCEN 1 +#define S_GSR_CCLKSEL 2 + +// S_ISR Interrupt Status Register 00000000H +#define S_ISR_TM0IS (1<<0) // TIMER CH0 interrupt. +#define S_ISR_TM1IS (1<<1) // TIMER CH1 interrupt. +#define S_ISR_UARTIS (1<<2) // UART interrupt. +#define S_ISR_EXTIS (1<<3) // External Interrupt. +#define S_ISR_WUIS (1<<4) // Wakeup Interrupt. + +// S_IMR Interrupt Mask Register 00000000H +// see S_ISR; write a 1 to unmask, 0 to mask. + +// S_NSR NMI Status Register 00000000H +// S_NMR NMI Mask Register 00000000H + +// S_VER Version Register 00000301H + +// --------- GPIO --------- +// S_GIOER GPIO Output Enable Register 00000000H +// S_GOPR GPIO Output (Write) Register 00000000H +// S_GIPR GPIO Input (Read) Register 00000000H +// 16-bit regsiters that do the utterly obvious thing. + +// --------- reset --------- +// S_WRCR Warm Reset Control Register 00000000H +#define S_WRCR_USBWR (1<<0) // Warm Reset request for USB Controller +#define S_WRCR_MACWR (1<<1) // Warm Reset request for Ethernet Controller +#define S_WRCR_UARTWR (1<<4) // Warm Reset request for UART + +// S_WRSR Warm Reset Status Register 00000000H +// See S_WRCR; 1 <=> Ready, 0 <=> performing warm reset. + +// --------- power control of USB/ETH peripherals --------- +// S_PWCR Power Control Register 00000000H +// S_PWSR Power Control Status Register 00000000H + +// --------- bus timouts --------- +// ITCNTR IBUS Timeout Timer Control Register 00000000H +// ITSETR IBUS Timeout Timer Set Register 80000000H + +// --------- UART --------- +// UARTRBR UART, Receiver Buffer Register [DLAB=0,READ] +// UARTTHR UART, Transmitter Holding Register [DLAB=0,WRITE] +// UARTDLL UART, Divisor Latch LSB Register [DLAB=1] +// The external (18.432MHz) clock is not present. See S_GMR_UCSEL. +// See also UARTDLM below. So we use the internal 50MHz clock. + +//#define UARTCLOCK (18432000) +#define UARTCLOCK (50 * 1000 * 1000) +#define UARTDLL_VAL( _baud_ ) ((UARTCLOCK / 16) / (_baud_) ) + +// UARTIER UART, Interrupt Enable Register [DLAB=0] +#define UARTIER_ERBFI (1<<0) // UART Receive data Buffer Full Interrupt +#define UARTIER_ERBEI (1<<1) // UART Transmitter Buffer empty Interrupt +#define UARTIER_ERBLI (1<<2) // UART Line status Interrupts +#define UARTIER_ERBMI (1<<3) // UART Modem status Interrupts + +// UARTDLM UART, Divisor Latch MSB Register [DLAB=1] +#define UARTDLM_ANY_BAUD (0) +#define UARTDLM_VAL( _baud_ ) (UARTDLL_VAL( _baud_ ) >> 8) + +// UARTIIR UART, Interrupt ID Register [READ] +#define UARTIIR_INTPENDL (1<<0) // No Pending interrupts + +// mask to give one of: +#define UARTIIR_UIID_MASK (7<<1) // Indicates the priority level of pending interrupt. + +#define UARTIIR_RXERROR (3<<1) // Receiver Line Error +#define UARTIIR_RXD_AVAIL (2<<1) // Received data available +#define UARTIIR_CHAR_TO (6<<1) // Character timeout +#define UARTIIR_TX_EMPTY (1<<1) // Transmitter Register Empty +#define UARTIIR_MODEM (0<<1) // Modem Status: CTS_L, DSR_L or DCD_L + +// UARTFCR UART, FIFO control Register [WRITE] +// ...is not supported. But nontheless it appears necessary to write it. +#define UARTFCR_16550_MODE (6) // and clear the FIFOs. + +// UARTLCR UART, Line control Register +// Word length +#define UARTLCR_8 (0x03) +#define UARTLCR_7 (0x02) +// Stop bits +#define UARTLCR_STB1 (0x00) +#define UARTLCR_STB2 (0x04) +// Parity +#define UARTLCR_NOP (0x00) +#define UARTLCR_EP (0x18) +#define UARTLCR_OP (0x08) + +// Just predefine the pattern for 8-N-1... +#define UARTLCR_8N1 (0x03) + +// Divisor latch access bit; or this with one of the above. +#define UARTLCR_DLAB (0x80) + +// UARTMCR UART, Modem Control Register +#define UARTMCR_DTR (1<<0) // Data Terminal Ready. +#define UARTMCR_RTS (1<<1) // Request To Send. + +// UARTLSR UART, Line status Register +#define UARTLSR_DR (1<<0) // Receive-Data Ready. +#define UARTLSR_OE (1<<1) // Receive-Data Overrun Error. +#define UARTLSR_PE (1<<2) // Receive-Data Parity Error. +#define UARTLSR_FE (1<<3) // Receive-Data Framing Error. +#define UARTLSR_BI (1<<4) // Break Interrupt. +#define UARTLSR_THRE (1<<5) // Transmitter Holding Register Empty. +#define UARTLSR_TEMT (1<<6) // Transmitter Empty. +#define UARTLSR_RFERR (1<<7) // Receiver FIFO Error. + +// UARTMSR UART, Modem Status Register +#define UARTMSR_DCTS (1<<0) // Delta Clear To Send. +#define UARTMSR_DDSR (1<<1) // Delta Data Set Ready. +#define UARTMSR_TERI (1<<2) // Trailing Edge Ring Indicato +#define UARTMSR_DDCD (1<<3) // Delta Data Carrier Detect. +#define UARTMSR_CTS (1<<4) // Clear To Send. +#define UARTMSR_DSR (1<<5) // Data Set Ready. +#define UARTMSR_RI (1<<6) // Ring Indicator. +#define UARTMSR_DCD (1<<7) // Data Carrier Detect. + +// UARTSCR UART, Scratch Register unknown + + +// --------- watchdog aka dead man's switch --------- +// DSUCNTR DSU Control Register 00000000H +// DSUSETR DSU Dead Time Set Register 80000000H +// DSUCLRR DSU Clear Register 00000000H +// DSUTIMR DSU Elapsed Time Register 00000000H + +// --------- additional timers --------- +// TMMR Timer Mode Register 00000000H +// TM0CSR Timer CH0 Count Set Register 00000000H +// TM1CSR Timer CH1 Count Set Register 00000000H +// TM0CCR Timer CH0 Current Count Register FFFFFFFFH +// TM1CCR Timer CH1 Current Count Register FFFFFFFFH + +// --------- serial eeprom --------- +// ECCR EEPROM Command Control Register 00000000H +// ERDR EEPROM Read Data Register 80000000H +// MACAR1 MAC Address Register 1 00000000H +// MACAR2 MAC Address Register 2 00000000H +// MACAR3 MAC Address Register 3 00000000H + +// --------- memory control --------- +// RMMDR Boot ROM Mode Register 00000000H +// RMATR Boot ROM Access Timing Register 00000000H +#define RMMDR_FLASH_WRITE_ENABLE (0x100) + +#define RMMDR_28F640 (0) +#define RMMDR_28F320 (0) +#define RMMDR_29LV160_120 (3) // sic. from customer doc +#define RMMDR_29LV160_90 (3) // even though "3" is a reserved value +#define RMMDR_29LV160_70 (3) // maybe it means "1". + +#define RMATR_28F640 (5) +#define RMATR_28F320 (4) +#define RMATR_29LV160_120 (5) +#define RMATR_29LV160_90 (4) +#define RMATR_29LV160_70 (3) + +// SDMDR SDRAM Mode Register 00000330H +// SDTSR SDRAM Type Selection Register 00000000H +// SDPTR SDRAM Precharge Timing Register 00000142H +// SDRMR SDRAM Refresh Mode Register 00000200H +// SDRCR SDRAM Refresh Timer Count Register 00000200H + +#if 1 +// initial settings from customer doc. +#define SDMDR_INIT (0x230) // 230 from the hardware, 330 from doc +#define SDTSR_INIT (0x180 | 0x20 | 0x1) +#define SDPTR_INIT (0x111) +#define SDRMR_INIT (0x600) +#else +// optimized setting "don't be used before qualification" +#define SDMDR_INIT (0x120) +#define SDTSR_INIT (0x180 | 0x20 | 0x1) +#define SDPTR_INIT (0x100) +#define SDRMR_INIT (0x600) +#endif + +// These are used for decoding SEGV types. +// MBCR Memory Bus Control Register 00000000H +// MESR Memory Error Status Register 00000000H +// MEAR Memory Error Address Register 00000000H + +// -------------------------------------------------------------------------- +#endif // CYGONCE_HAL_VAR_ARCH_H +// End of var_arch.h diff --git a/packages/hal/mips/upd985xx/current/include/var_cache.h b/packages/hal/mips/upd985xx/current/include/var_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/include/var_cache.h @@ -0,0 +1,173 @@ +#ifndef CYGONCE_VAR_CACHE_H +#define CYGONCE_VAR_CACHE_H +//============================================================================= +// +// var_cache.h +// +// HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, nickg +// Contributors: nickg +// Date: 2001-05-24 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include + +//----------------------------------------------------------------------------- +// Cache sizes. + +// Data cache +#define HAL_DCACHE_SIZE (8*1024) // Size of data cache in bytes +#define HAL_DCACHE_LINE_SIZE 16 // Size of a data cache line +#define HAL_DCACHE_WAYS 1 // Associativity of the cache + +// Instruction cache +#define HAL_ICACHE_SIZE (16*1024) // Size of cache in bytes +#define HAL_ICACHE_LINE_SIZE 16 // Size of a cache line +#define HAL_ICACHE_WAYS 1 // Associativity of the cache + +#define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS)) +#define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS)) + +//----------------------------------------------------------------------------- +// The uPD985xx mostly uses the default MIPS cache controls defined in +// hal_cache.h Here we define the cache enable and disable macros. The only +// control we appear to have is the kseg0 cache state in config0. So all +// these macros at present manipulate this. + +#ifndef HAL_DCACHE_ENABLE_DEFINED +#define HAL_DCACHE_ENABLE() \ +CYG_MACRO_START \ + asm volatile ( "mfc0 $2,$16\n" \ + "nop; nop; nop\n" \ + "la $3,0xFFFFFFF8\n" \ + "and $2,$2,$3\n" \ + "ori $2,$2,3\n" \ + "mtc0 $2,$16\n" \ + "nop; nop; nop; nop;\n" \ + "nop; nop; nop; nop;\n" \ + "nop; nop; nop; nop;\n" \ + "nop; nop; nop; nop;\n" \ + : \ + : \ + : "$2", "$3" \ + ); \ +CYG_MACRO_END +#define HAL_DCACHE_ENABLE_DEFINED +#endif + +// Disable the data cache +#ifndef HAL_DCACHE_DISABLE_DEFINED +#define HAL_DCACHE_DISABLE() \ +CYG_MACRO_START \ + asm volatile ( "mfc0 $2,$16\n" \ + "nop; nop; nop\n" \ + "la $3,0xFFFFFFF8\n" \ + "and $2,$2,$3\n" \ + "ori $2,$2,2\n" \ + "mtc0 $2,$16\n" \ + "nop; nop; nop; nop;\n" \ + "nop; nop; nop; nop;\n" \ + "nop; nop; nop; nop;\n" \ + "nop; nop; nop; nop;\n" \ + : \ + : \ + : "$2", "$3" \ + ); \ +CYG_MACRO_END +#define HAL_DCACHE_DISABLE_DEFINED +#endif + +#ifndef HAL_DCACHE_IS_ENABLED_DEFINED +#define HAL_DCACHE_IS_ENABLED(_state_) \ +CYG_MACRO_START \ + CYG_WORD32 _cstate_; \ + asm volatile ( "mfc0 %0,$16\n" \ + "nop; nop; nop\n" \ + : "=r"(_cstate_) \ + ); \ + if( (_cstate_ & 7) == 2 ) _state_ = 0; \ + else _state_ = 1; \ +CYG_MACRO_END +#define HAL_DCACHE_IS_ENABLED_DEFINED +#endif + +#ifndef HAL_ICACHE_ENABLE_DEFINED +#define HAL_ICACHE_ENABLE() HAL_DCACHE_ENABLE() +#define HAL_ICACHE_ENABLE_DEFINED +#endif + +// Disable the instruction cache +#ifndef HAL_ICACHE_DISABLE_DEFINED +#define HAL_ICACHE_DISABLE() HAL_DCACHE_DISABLE() +#define HAL_ICACHE_DISABLE_DEFINED +#endif + +#ifndef HAL_ICACHE_IS_ENABLED_DEFINED +#define HAL_ICACHE_IS_ENABLED(_state_) HAL_DCACHE_IS_ENABLED(_state_) +#define HAL_ICACHE_IS_ENABLED_DEFINED +#endif + +//----------------------------------------------------------------------------- +// The VR4300 has no cache locking facility so we define the guard macros +// to disable the definitions in hal_arch.h. + +#define HAL_DCACHE_LOCK_DEFINED +#define HAL_DCACHE_UNLOCK_DEFINED +#define HAL_DCACHE_UNLOCK_ALL_DEFINED + +#define HAL_ICACHE_LOCK_DEFINED +#define HAL_ICACHE_UNLOCK_DEFINED + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_VAR_CACHE_H +// End of var_cache.h diff --git a/packages/hal/mips/upd985xx/current/include/var_intr.h b/packages/hal/mips/upd985xx/current/include/var_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/include/var_intr.h @@ -0,0 +1,380 @@ +#ifndef CYGONCE_HAL_VAR_INTR_H +#define CYGONCE_HAL_VAR_INTR_H +//========================================================================== +// +// var_intr.h +// +// VR4300 Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, nickg +// Contributors: nickg, jskov, +// gthomas, jlarmour +// Date: 2001-05-24 +// Purpose: uPD985xx Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for variants of the NEC uPD985xx +// architecture. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +//-------------------------------------------------------------------------- +// Interrupt controller stuff. + +#ifndef CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED +// Interrupts dealt with via the status and cause registers +// must be numbered in bit order: +#define CYGNUM_HAL_INTERRUPT_STATUS_CAUSE_LOW (0) +// The first two are the "software interrupts" - you just set a bit. +#define CYGNUM_HAL_INTERRUPT_SOFT_ZERO (0) +#define CYGNUM_HAL_INTERRUPT_SOFT_ONE (1) +#define CYGNUM_HAL_INTERRUPT_FREE_TWO (2) +#define CYGNUM_HAL_INTERRUPT_USB (3) +#define CYGNUM_HAL_INTERRUPT_ETHER (4) +#define CYGNUM_HAL_INTERRUPT_FREE_FIVE (5) +#define CYGNUM_HAL_INTERRUPT_SYSCTL (6) +#define CYGNUM_HAL_INTERRUPT_COMPARE (7) + +// Number 6 "SYSCTL" is all external sources in the system controller and +// will normally be decoded into one of 8-12 instead. If you use number 6 +// directly, then this will disable *all* system controller sources. +// Startup code will ensure number 6 is unmasked by default, and it will +// have an arbitration routine installed to call all of the subsequent +// interrupts from the S_ISR register. This has to be an external routine +// because the S_ISR register is read-clear, and the interrupt sources are +// edge-triggered so they do not re-assert themselves - so we must address +// multiple sources per actual interrupt, in a loop. + +#define CYGNUM_HAL_INTERRUPT_SYSCTL_LOW (8) +#define CYGNUM_HAL_INTERRUPT_SYSCTL_HI (12) + +#define CYGNUM_HAL_INTERRUPT_TM0 (8) // TIMER CH0 interrupt. +#define CYGNUM_HAL_INTERRUPT_TM1 (9) // TIMER CH1 interrupt. +#define CYGNUM_HAL_INTERRUPT_UART (10) // UART interrupt. +#define CYGNUM_HAL_INTERRUPT_EXT (11) // External Interrupt. +#define CYGNUM_HAL_INTERRUPT_WU (12) // Wakeup Interrupt. + +#define CYGHWR_HAL_GDB_PORT_VECTOR CYGNUM_HAL_INTERRUPT_UART + +// Min/Max ISR numbers and how many there are +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX 12 +#define CYGNUM_HAL_ISR_COUNT 13 + +// The vector used by the Real time clock. The default here is to use +// interrupt 5, which is connected to the counter/comparator registers +// in many MIPS variants. + +#ifndef CYGNUM_HAL_INTERRUPT_RTC +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_COMPARE +#endif + +#define CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED + +#endif // CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED + +#ifndef __ASSEMBLER__ + +// ------------------------------------------------------------------------ + +// This is placed in memory at a fixed location because we must share it +// with RedBoot, along with the VSR table and Virtual Vector table. +// It has to be an array to get the correct code generation to access it +// over all that distance. +externC volatile cyg_uint32 hal_interrupt_sr_mask_shadow_base[]; +#define hal_interrupt_sr_mask_shadow (hal_interrupt_sr_mask_shadow_base[0]) + +// We have to have local versions of these to preserve the mask bits in the +// SR correctly when an interrupt occurs within one of these code sequences +// which are doing a read-modify-write to the main interrupt bit of the SR. + +// Disable, it doesn't matter what the SR IM bits are - but it is possible +// for control to return with interrupts enabled if a context switch occurs +// away from the thread that disabled interrupts. Therefore we also make +// sure the contents of the SR match the shadow variable at the end. + +#define HAL_DISABLE_INTERRUPTS(_old_) \ +CYG_MACRO_START \ + register int _tmp; \ + asm volatile ( \ + "mfc0 $8,$12; nop;" \ + "move %0,$8;" \ + "and $8,$8,0xfffffffe;" \ + "mtc0 $8,$12;" \ + "nop; nop; nop;" \ + : "=r"(_tmp) \ + : \ + : "$8" \ + ); \ + /* interrupts disabled so can now inject the correct IM bits */ \ + (_old_) = _tmp & 1; \ + _tmp &= 0xffff00fe; \ + _tmp |= (hal_interrupt_sr_mask_shadow & 0xff00); \ + asm volatile ( \ + "mtc0 %0,$12;" \ + "nop; nop; nop;" \ + : \ + : "r"(_tmp) \ + ); \ +CYG_MACRO_END + +// Enable and restore, we must pick up hal_interrupt_sr_mask_shadow because +// it contains the truth. This is also for the convenience of the +// mask/unmask macros below. +#define HAL_ENABLE_INTERRUPTS() HAL_RESTORE_INTERRUPTS(1) + +#define HAL_RESTORE_INTERRUPTS(_old_) \ +CYG_MACRO_START \ + asm volatile ( \ + "mfc0 $8,$12; nop;" \ + "or $8,$8,%0;" /* inject IE bit */ \ + "and $8,$8,0xffff00ff;" /* clear IM bits */ \ + "or $8,$8,%1;" /* insert true IM */ \ + "mtc0 $8,$12;" \ + "nop; nop; nop;" \ + : \ + : "r"((_old_) & 1),"r"(hal_interrupt_sr_mask_shadow & 0xff00) \ + : "$8" \ + ); \ +CYG_MACRO_END + +#define HAL_QUERY_INTERRUPTS( _state_ ) \ +CYG_MACRO_START \ + asm volatile ( \ + "mfc0 %0,$12; nop;" \ + "and %0,%0,0x1;" \ + : "=r"(_state_) \ + ); \ +CYG_MACRO_END + +#define CYGHWR_HAL_INTERRUPT_ENABLE_DISABLE_RESTORE_DEFINED + +// ------------------------------------------------------------------------ + +// For the bits which are in the SR, we only need to diddle the shadow +// variable; restore interrupts will pick that up at the end of the macro. +// Neat, huh. + +#ifndef CYGOPT_HAL_MIPS_UPD985XX_HARDWARE_BUGS_S2 +// Vanilla versions here: trick versions with the workaround follow: + +#define HAL_INTERRUPT_MASK( _vector_ ) \ +CYG_MACRO_START \ +register int _intstate; \ +register int _shift; \ +HAL_DISABLE_INTERRUPTS( _intstate ); \ +if ( CYGNUM_HAL_INTERRUPT_SYSCTL_LOW > (_vector_) ) { \ + /* mask starts at bit 8 */ \ + _shift = 8 + (_vector_) - CYGNUM_HAL_INTERRUPT_STATUS_CAUSE_LOW; \ + hal_interrupt_sr_mask_shadow &=~(1 << _shift); \ +} \ +else { \ + _shift = (_vector_) - CYGNUM_HAL_INTERRUPT_SYSCTL_LOW; \ + *S_IMR &=~(1 << _shift); \ +} \ +HAL_RESTORE_INTERRUPTS( _intstate ); \ +CYG_MACRO_END + + +#define HAL_INTERRUPT_UNMASK( _vector_ ) \ +CYG_MACRO_START \ +register int _intstate; \ +register int _shift; \ +HAL_DISABLE_INTERRUPTS( _intstate ); \ +if ( CYGNUM_HAL_INTERRUPT_SYSCTL_LOW > (_vector_) ) { \ + /* mask starts at bit 8 */ \ + _shift = 8 + (_vector_) - CYGNUM_HAL_INTERRUPT_STATUS_CAUSE_LOW; \ + hal_interrupt_sr_mask_shadow |= (1 << _shift); \ +} \ +else { \ + _shift = (_vector_) - CYGNUM_HAL_INTERRUPT_SYSCTL_LOW; \ + *S_IMR |= (1 << _shift); \ +} \ +HAL_RESTORE_INTERRUPTS( _intstate ); \ +CYG_MACRO_END + + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \ +CYG_MACRO_START \ +register int _intstate; \ +HAL_DISABLE_INTERRUPTS( _intstate ); \ +/* Default clears the bit in the cause register. But VR4120 doc */ \ +/* says this is a NOP so we ignore low numbered sources except the */ \ +/* software interrupt bits. */ \ +if ( CYGNUM_HAL_INTERRUPT_SYSCTL_LOW <= (_vector_) || \ + CYGNUM_HAL_INTERRUPT_SYSCTL == (_vector_) ) { \ + register int i; \ + i = *S_ISR; /* This is read-clear! */ \ +} \ +else if ( CYGNUM_HAL_INTERRUPT_SOFT_ZERO == (_vector_) || \ + CYGNUM_HAL_INTERRUPT_SOFT_ONE == (_vector_) ) { \ + /* These two are acknowledged by writing the bit to zero in */ \ + /* the cause register. NB not the status register! */ \ + asm volatile ( \ + "mfc0 $3,$13\n" \ + "la $2,0x00000100\n" \ + "sllv $2,$2,%0\n" \ + "andi $2,$2,0x0300\n" \ + "nor $2,$2,$0\n" \ + "and $3,$3,$2\n" \ + "mtc0 $3,$13\n" \ + "nop; nop; nop\n" \ + : \ + : "r"((_vector_)-CYGNUM_HAL_INTERRUPT_STATUS_CAUSE_LOW) \ + : "$2", "$3" \ + ); \ +} \ +HAL_RESTORE_INTERRUPTS( _intstate ); \ +CYG_MACRO_END + +#else // DEFINED: CYGOPT_HAL_MIPS_UPD985XX_HARDWARE_BUGS_S2 + +#ifdef __cplusplus +extern "C" { +#endif +extern void cyg_hal_interrupt_unmask( int vec ); +extern void cyg_hal_interrupt_mask( int vec ); +extern void cyg_hal_interrupt_acknowledge( int vec ); +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#define HAL_INTERRUPT_MASK( _vector_ ) \ +CYG_MACRO_START \ +register int _intstate; \ +register int _shift; \ +HAL_DISABLE_INTERRUPTS( _intstate ); \ +if ( CYGNUM_HAL_INTERRUPT_SYSCTL_LOW > (_vector_) ) { \ + /* mask starts at bit 8 */ \ + _shift = 8 + (_vector_) - CYGNUM_HAL_INTERRUPT_STATUS_CAUSE_LOW; \ + hal_interrupt_sr_mask_shadow &=~(1 << _shift); \ +} \ +else { \ + cyg_hal_interrupt_mask( (_vector_) ); \ +} \ +HAL_RESTORE_INTERRUPTS( _intstate ); \ +CYG_MACRO_END + + +#define HAL_INTERRUPT_UNMASK( _vector_ ) \ +CYG_MACRO_START \ +register int _intstate; \ +register int _shift; \ +HAL_DISABLE_INTERRUPTS( _intstate ); \ +if ( CYGNUM_HAL_INTERRUPT_SYSCTL_LOW > (_vector_) ) { \ + /* mask starts at bit 8 */ \ + _shift = 8 + (_vector_) - CYGNUM_HAL_INTERRUPT_STATUS_CAUSE_LOW; \ + hal_interrupt_sr_mask_shadow |= (1 << _shift); \ +} \ +else { \ + cyg_hal_interrupt_unmask( (_vector_) ); \ +} \ +HAL_RESTORE_INTERRUPTS( _intstate ); \ +CYG_MACRO_END + + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \ +CYG_MACRO_START \ +register int _intstate; \ +HAL_DISABLE_INTERRUPTS( _intstate ); \ +/* Default clears the bit in the cause register. But VR4120 doc */ \ +/* says this is a NOP so we ignore low numbered sources except the */ \ +/* software interrupt bits. */ \ +if ( CYGNUM_HAL_INTERRUPT_SYSCTL_LOW <= (_vector_) || \ + CYGNUM_HAL_INTERRUPT_SYSCTL == (_vector_) ) { \ + cyg_hal_interrupt_acknowledge( (_vector_) ); \ +} \ +else if ( CYGNUM_HAL_INTERRUPT_SOFT_ZERO == (_vector_) || \ + CYGNUM_HAL_INTERRUPT_SOFT_ONE == (_vector_) ) { \ + /* These two are acknowledged by writing the bit to zero in */ \ + /* the cause register. NB not the status register! */ \ + asm volatile ( \ + "mfc0 $3,$13\n" \ + "la $2,0x00000100\n" \ + "sllv $2,$2,%0\n" \ + "andi $2,$2,0x0300\n" \ + "nor $2,$2,$0\n" \ + "and $3,$3,$2\n" \ + "mtc0 $3,$13\n" \ + "nop; nop; nop\n" \ + : \ + : "r"((_vector_)-CYGNUM_HAL_INTERRUPT_STATUS_CAUSE_LOW) \ + : "$2", "$3" \ + ); \ +} \ +HAL_RESTORE_INTERRUPTS( _intstate ); \ +CYG_MACRO_END + +#endif // CYGOPT_HAL_MIPS_UPD985XX_HARDWARE_BUGS_S2 + +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) + +#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) + +#define CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED + +//-------------------------------------------------------------------------- +// Useful for debugging... + +#define HAL_READ_INTR_REGS( _status, _cause ) \ +{ \ + asm volatile ( \ + "mfc0 %0,$12; nop;" \ + : "=r"(_status) \ + ); \ + asm volatile ( \ + "mfc0 %0,$13; nop;" \ + : "=r"(_cause) \ + ); \ +} + +//-------------------------------------------------------------------------- +#endif // ! __ASSEMBLER__ + +#endif // ifndef CYGONCE_HAL_VAR_INTR_H +// End of var_intr.h diff --git a/packages/hal/mips/upd985xx/current/include/variant.inc b/packages/hal/mips/upd985xx/current/include/variant.inc new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/include/variant.inc @@ -0,0 +1,549 @@ +#ifndef CYGONCE_HAL_VARIANT_INC +#define CYGONCE_HAL_VARIANT_INC +//#============================================================================= +//# +//# variant.inc +//# +//# UPD985XX assembler header file +//# +//#============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//#============================================================================= +//######DESCRIPTIONBEGIN#### +//# +//# Author(s): hmt, nickg +//# Contributors: nickg +//# Date: 2001-05-24 +//# Purpose: UPD985XX definitions. +//# Description: This file contains various definitions and macros that are +//# useful for writing assembly code for the UPD985XX CPU. +//# Usage: +//# #include +//# ... +//# +//# +//#####DESCRIPTIONEND#### +//# +//#============================================================================= + + .set mips3 + +#include + +#include + +#include + +#include CYGBLD_HAL_PLATFORM_H + +#include + +#include +#include + +// ------------------------------------------------------------------------ +// Basic LED and poke-uart level debugging stuff. + +#if 0 + .macro DELAY dd + la k0,\dd +98: addiu k0,k0,-1 + bnez k0,98b + nop + .endm + + .macro LED nn + la k1,0xb0000000 + la k0,0xfdff + sw k0,0x20(k1) + nop + nop + nop + la t0,\nn +99: + la k0,0x100 + sw k0,0x24(k1) + + DELAY 0x40000 + + la k0,0x000 + sw k0,0x24(k1) + + DELAY 0x30000 + + addi t0,t0,-1 + bnez t0,99b + nop + + DELAY 0xd0000 + + .endm + + .macro PRINT nn + la k1,0xb0000000 + DELAY 0x10000 + la k0, '.' + sw k0,0x80(k1) + DELAY 0x10000 + la k0, 0xf & ((\nn) >> 4) + addi k0,k0,'0' + sw k0,0x80(k1) + DELAY 0x10000 + la k0, 0xf & ((\nn)) + addi k0,k0,'0' + sw k0,0x80(k1) + DELAY 0x10000 + la k0, '.' + sw k0,0x80(k1) + .endm + + .macro DEBUG nn + #LED \nn + PRINT \nn + .endm + +#else + + .macro DEBUG nn + .endm + +#endif + +##----------------------------------------------------------------------------- +## configure the architecture HAL to define the right things. + +## ISR tables are larger than the defaults defined in vectors.S +## We define our own in var_misc.c +#define CYG_HAL_MIPS_ISR_TABLES_DEFINED + +## VSR table is at a fixed RAM address defined by the linker script +#define CYG_HAL_MIPS_VSR_TABLE_DEFINED + +//------------------------------------------------------------------------------ +// Set up initial value for config register. Sets endian mode and +// disables the cache on kseg0. + +#if defined(CYGPKG_HAL_MIPS_MSBFIRST) +# define INITIAL_CONFIG0 ***!!!Nope, it should be little-endian!!!*** +#elif defined(CYGPKG_HAL_MIPS_LSBFIRST) +# define INITIAL_CONFIG0 0x00000002 +#else +# error MIPS endianness not set by configuration +#endif + +//------------------------------------------------------------------------------ +// Initial SR value for use standalone and with GDB_stubs: +// CP0 usable +// Vectors to RAM +// All hw ints disabled + +#define INITIAL_SR 0x10000000 + +#------------------------------------------------------------------------------ +# Cache macros. + + +#ifndef CYGPKG_HAL_MIPS_CACHE_DEFINED + + .macro hal_cache_init + + mfc0 v0,config0 # disable Kseg0 caching in config0 register + nop + nop + la v1,0xfffffff8 + and v0,v0,v1 + ori v0,v0,2 + mtc0 v0,config0 + nop + nop + nop + + // If we invalidate the caches in RAM startup, this destroys + // network debugging == the network device. + // Don~t fully understand why, but this exclusion fixes it. + // Invalidating caches could destroy other RedBoot state so we + // shouldn~t do it anyway. +#ifndef CYG_HAL_STARTUP_RAM + + .set mips3 # Set ISA to MIPS 3 to allow cache insns + + // Now ensure the caches are invalidated. The caches are NOT cleared or + // invalidated on non-power-up resets and may come up in a random state + // on power-up. Hence they may contain stale or randomly bogus data. + // Here we use the index-store-tag cache operation to clear all the cache + // tags and states to zero. This will render them all invalid on the + // VR4300. + + # D-cache: + la t0,0x80000000 + addi t1,t0,0x2000 +1: + mtc0 zero,$28 + mtc0 zero,$29 + cache 0x09,0(t0) + addi t0,t0,0x10 + sub v0,t1,t0 + bgez v0,1b + nop + + # I-cache: + la a0,0x80000000 + addi a1,a0,0x4000 +1: + mtc0 zero,$28 + mtc0 zero,$29 + cache 0x08,0(a0) + addi a0,a0,0x20 + sub v0,a1,a0 + bgez v0,1b + nop + + .set mips0 # reset ISA to default + +#endif + + .endm + +#define CYGPKG_HAL_MIPS_CACHE_DEFINED + +#endif + +//----------------------------------------------------------------------------- +// Load Address and Relocate. This macro is used in code that may be +// linked to execute out of RAM but is actually executed from ROM. The +// code that initializes the memory controller and copies the ROM +// contents to RAM must work in this way, for example. This macro is used +// in place of an "la" macro instruction when loading code and data +// addresses. There are two versions of the macro here. The first +// assumes that we are executing in the ROM space at 0xbfc00000 and are +// linked to run in the RAM space at 0x80000000. It simply adds the +// difference between the two to the loaded address. The second is more +// code, but will execute correctly at either location since it +// calculates the difference at runtime. The second variant is enabled +// by default. + + +#ifdef CYG_HAL_STARTUP_ROMRAM + +#if 0 + .macro lar reg,addr + .set noat + la \reg,\addr + la $at,0x3fc00000 + addu \reg,\reg,$at + .set at + .endm +#else + .macro lar reg,addr + .set noat + move $at,ra # save ra + la \reg,\addr # get address into register + la ra,x\@ # get linked address of label + subiu \reg,\reg,ra # subtract it from value + bal x\@ # branch and link to label + nop # to get current actual address +x\@: + addiu \reg,\reg,ra # add actual address + move ra,$at # restore ra + .set at + .endm + +#endif + +#define CYGPKG_HAL_MIPS_LAR_DEFINED + +#endif + +//---------------------------------------------------------------------------- +// MMU macros. +// The MMU must be set up on this board before we can access any external devices, +// including the memory controller, so we have no RAM to work with yet. +// Since the setup code must work only in registers, we do not do a subroutine +// linkage here, instead the setup code knows to jump back here when finished. + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) + +// There is none. We can access all areas via kseg[01] so we are happy +// with no MMU setup. + +// NO #define CYGPKG_HAL_MIPS_MMU_DEFINED + +#endif + +//---------------------------------------------------------------------------- +// MEMC macros. +// + .macro hal_memc_init + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) + + .extern hal_memc_setup + lar k0,hal_memc_setup + jalr k0 + nop + +#endif + +#if defined(CYG_HAL_STARTUP_ROMRAM) + + # Having got the RAM working, we must now relocate the Entire + # ROM into it and then continue execution from RAM. + + la t0,0x80000000 # dest addr + la t1,0xbfc00000 # source addr + la t3,__ram_data_end # end dest addr +1: + lw v0,0(t1) # get word + addiu t1,t1,4 + sw v0,0(t0) # write word + addiu t0,t0,4 + bne t0,t3,1b + nop + + la v0,2f # RAM address to go to + jr v0 + nop +2: + # We are now executing out of RAM! + +#endif + + .endm + +#define CYGPKG_HAL_MIPS_MEMC_DEFINED + +#------------------------------------------------------------------------------ +# Interrupt controller initialization. + +#ifndef CYGPKG_HAL_MIPS_INTC_DEFINED + +#ifndef CYGPKG_HAL_MIPS_INTC_INIT_DEFINED + # initialize all interrupts to disabled + .macro hal_intc_init + mfc0 v0,status + nop + lui v1,0xFFFF + ori v1,v1,0x00FF + and v0,v0,v1 # clear the IntMask bits + mtc0 v0,status + nop + nop + nop + .endm +#endif + +#ifndef CYGPKG_HAL_MIPS_INTC_DECODE_DEFINED + .macro hal_intc_decode vnum + mfc0 v1,status # get status register (interrupt mask) + nop # delay slot + mfc0 v0,cause # get cause register + nop # delay slot + and v0,v0,v1 # apply interrupt mask + andi v1,v0,0x0300 # test for soft interrupt bits + beqz v1, 43f # neither of them + srl v1,v1,8 # shift interrupt bits down + addi v1,v1,-1 # now have 1,2,3 in v1 -> 0,1,2 + andi \vnum,v1,1 # -> 0,1,0 is the right answer + b 44f + nop +43: + srl v0,v0,10 # shift interrupt bits down + andi v0,v0,0x3f # isolate 6 interrupt bits + la v1,hal_intc_translation_table + add v0,v0,v1 # index into table + lb \vnum,0(v0) # pick up vector number + addi \vnum,\vnum,2 # offset soft intrs +44: nop + .endm +#endif + +#ifndef CYGPKG_HAL_MIPS_INTC_TRANSLATE_DEFINED +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + .macro hal_intc_translate inum,vnum + move \vnum,zero # Just vector zero is supported + .endm +#else + .macro hal_intc_translate inum,vnum + move \vnum,\inum # Vector == interrupt number + .endm +#endif +#endif + + .macro hal_intc_decode_data +hal_intc_translation_table: + .byte 0, 0, 1, 0 + .byte 2, 0, 1, 0 + .byte 3, 0, 1, 0 + .byte 2, 0, 1, 0 + .byte 4, 0, 1, 0 + .byte 2, 0, 1, 0 + .byte 3, 0, 1, 0 + .byte 2, 0, 1, 0 + .byte 5, 0, 1, 0 + .byte 2, 0, 1, 0 + .byte 3, 0, 1, 0 + .byte 2, 0, 1, 0 + .byte 4, 0, 1, 0 + .byte 2, 0, 1, 0 + .byte 3, 0, 1, 0 + .byte 2, 0, 1, 0 + .endm + +#define CYGPKG_HAL_MIPS_INTC_DEFINED + +#endif // CYGPKG_HAL_MIPS_INTC_DEFINED + + +#------------------------------------------------------------------------------ +# Monitor initialization. + + +# Macro for copying vectors to RAM if necessary. +#if !defined(CYGSEM_HAL_USE_ROM_MONITOR) + + .macro hal_vectors_init + + # If we don~t play nice with a ROM monitor, copy the required + # vectors into the proper location. + la t0,0x80000000 # dest addr + la t1,utlb_vector # source addr + la t3,utlb_vector_end # end dest addr +1: + lw v0,0(t1) # get word + addi t1,t1,4 + sw v0,0x0000(t0) # write word to utlb vec + sw v0,0x0080(t0) # and also to xtlb vector (64-bit) + addi t0,t0,4 # (no harm done) + bne t1,t3,1b + nop + + la t0,0x80000000 # dest addr page base + la t1,other_vector # source addr + la t3,other_vector_end # end dest addr +1: + lw v0,0(t1) # get word + addi t1,t1,4 + sw v0,0x0180(t0) # write word to other vector + addi t0,t0,4 + bne t1,t3,1b + nop + + // We are running uncached here anyhow, so no need to flush caches + + .endm + +#else + + .macro hal_vectors_init + .endm + +#endif + + +#ifndef CYGPKG_HAL_MIPS_MON_DEFINED + +#if defined(CYG_HAL_STARTUP_ROM) || \ + ( defined(CYG_HAL_STARTUP_RAM) && \ + !defined(CYGSEM_HAL_USE_ROM_MONITOR)) + + # If we are starting up from ROM, or we are starting in + # RAM and NOT using a ROM monitor, initialize the VSR table. + + .macro hal_mon_init + + hal_vectors_init + + # Set default exception VSR for all vectors + ori a0,zero,64 // not CYGNUM_HAL_VSR_COUNT at all + la a1,__default_exception_vsr + la a2,hal_vsr_table +1: sw a1,0(a2) + addi a2,a2,4 + addi a0,a0,-1 + bne a0,zero,1b + nop + + # Now set special VSRs + + # FIXME: Should use proper definitions + + la a0,hal_vsr_table + # Set interrupt VSR + la a1,__default_interrupt_vsr + sw a1,0*4(a0) // CYGNUM_HAL_VECTOR_INTERRUPT + # Add special handler on breakpoint vector to allow GDB and + # GCC to both use 'break' without conflicts. + la a1,__break_vsr_springboard + sw a1,9*4(a0) // CYGNUM_HAL_VECTOR_BREAKPOINT + + # Set exception handler on special vectors +// but these are already set up above: +// la a1,__default_exception_vsr +// sw a1,32*4(a0) # debug +// sw a1,33*4(a0) # utlb +// sw a1,34*4(a0) # nmi + .endm + +#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR) + + # Initialize the VSR table entries + # We only take control of the interrupt vector, + # the rest are left to the ROM for now... + + .macro hal_mon_init + hal_vectors_init + # Set interrupt VSR + la a0,hal_vsr_table + la a1,__default_interrupt_vsr + sw a1,0*4(a0) // CYGNUM_HAL_VECTOR_INTERRUPT + .endm + +#else + + .macro hal_mon_init + hal_vectors_init + .endm + +#endif + +#define CYGPKG_HAL_MIPS_MON_DEFINED +#endif + +#------------------------------------------------------------------------------ +# Diagnostic macros + + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_VARIANT_INC +# end of variant.inc diff --git a/packages/hal/mips/upd985xx/current/src/hal_diag.c b/packages/hal/mips/upd985xx/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/src/hal_diag.c @@ -0,0 +1,401 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, nickg +// Contributors: nickg +// Date: 2001-05-25 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include // base types +#include // tracing macros +#include // assertion macros + +#include // which includes var_arch => UART. +#include +#include +#include +#include +#include // interface API +#include // Helper functions + +/*---------------------------------------------------------------------------*/ +//#define CYG_KERNEL_DIAG_GDB + +#if defined(CYGSEM_HAL_USE_ROM_MONITOR_GDB_stubs) + +#define CYG_KERNEL_DIAG_GDB + +#endif + +/*---------------------------------------------------------------------------*/ +static inline +void hal_uart_setbaud( int baud ) +{ + // now set the baud rate + *UARTLCR |= UARTLCR_DLAB; + *UARTDLM = UARTDLM_VAL( baud ); + *UARTDLL = UARTDLL_VAL( baud ); + *UARTLCR &=~UARTLCR_DLAB; +} + +void hal_uart_init(void) +{ + // Ensure that we use the internal clock + *S_GMR &=~S_GMR_UCSEL; + + *UARTFCR = UARTFCR_16550_MODE; + *UARTLCR = UARTLCR_8N1; + *UARTIER = UARTIER_ERBFI; // rx interrupts enabled for CTRL-C + + hal_uart_setbaud( CYGHWR_HAL_MIPS_UPD985XX_DIAG_BAUD ); +} + +void hal_uart_write_char(char c) +{ + while ( 0 == (UARTLSR_THRE & *UARTLSR) ) + /* do nothing */ ; + + *UARTTHR = (unsigned int)c; + + // Ensure that this write does not provoke a spurious interrupt. + HAL_INTERRUPT_ACKNOWLEDGE( CYGHWR_HAL_GDB_PORT_VECTOR ); +} + +void hal_uart_read_char(char *c) +{ + while ( 0 == (UARTLSR_DR & *UARTLSR) ) + /* do nothing */ ; + + *c = (char)*UARTRBR; + + // Ensure that this read does not provoke a spurious interrupt. + HAL_INTERRUPT_ACKNOWLEDGE( CYGHWR_HAL_GDB_PORT_VECTOR ); +} + +int hal_uart_read_char_nonblock(char *c) +{ + if ( 0 == (UARTLSR_DR & *UARTLSR) ) + return 0; + + *c = (char)*UARTRBR; + + // Ensure that this read does not provoke a spurious interrupt. + HAL_INTERRUPT_ACKNOWLEDGE( CYGHWR_HAL_GDB_PORT_VECTOR ); + + return 1; +} + + +/*---------------------------------------------------------------------------*/ + +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +#include + +// This is lame, duplicating all these wrappers with slightly different details. +// All this should be in hal_if.c +static void +cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 c) +{ + CYGARC_HAL_SAVE_GP(); + hal_uart_write_char( (char)c ); + CYGARC_HAL_RESTORE_GP(); +} + +static cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 result; + CYGARC_HAL_SAVE_GP(); + hal_uart_read_char( (char *)&result ); + CYGARC_HAL_RESTORE_GP(); + return result; +} + +static int +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8 *pc) +{ + return hal_uart_read_char_nonblock( (char *)pc ); +} + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +static int chan__msec_timeout = 0; +static int chan__irq_state = 0; +static int chan__baud_rate = CYGHWR_HAL_MIPS_UPD985XX_DIAG_BAUD; + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan__msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 >= delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + int ret = -1; + va_list ap; + + CYGARC_HAL_SAVE_GP(); + va_start(ap, __func); + + switch (__func) { + case __COMMCTL_GETBAUD: + ret = chan__baud_rate; + break; + case __COMMCTL_SETBAUD: + ret = 0; + chan__baud_rate = va_arg(ap, cyg_int32); + hal_uart_setbaud( chan__baud_rate ); + break; + case __COMMCTL_IRQ_ENABLE: + ret = chan__irq_state; + chan__irq_state = 1; + HAL_INTERRUPT_UNMASK( CYGHWR_HAL_GDB_PORT_VECTOR ); + break; + case __COMMCTL_IRQ_DISABLE: + ret = chan__irq_state; + chan__irq_state = 0; + HAL_INTERRUPT_MASK( CYGHWR_HAL_GDB_PORT_VECTOR ); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = CYGHWR_HAL_GDB_PORT_VECTOR; + break; + case __COMMCTL_SET_TIMEOUT: + ret = chan__msec_timeout; + chan__msec_timeout = va_arg(ap, cyg_uint32); + break; + default: + break; + } + va_end(ap); + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int ret = 0; + char c; + + *__ctrlc = 0; + + if ( hal_uart_read_char_nonblock( &c ) ) { + if ( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + ret = CYG_ISR_HANDLED; + } + + return ret; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Init channels + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, comm); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + hal_uart_init(); + cyg_hal_plf_serial_init(); +} + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +// ------------------------------------------------------------------------ + +void hal_diag_init(void) +{ + hal_uart_init(); +} + +void hal_diag_read_char(char *c) +{ + hal_uart_read_char(c); +} + +extern cyg_bool cyg_hal_is_break(char *buf, int size); +extern void cyg_hal_user_break(CYG_ADDRWORD *regs); + +void hal_diag_write_char(char c) +{ +#ifdef CYG_KERNEL_DIAG_GDB + static char line[100]; + static int pos = 0; + + // No need to send CRs + if( c == '\r' ) return; + + line[pos++] = c; + + if( c == '\n' || pos == sizeof(line) ) + { + + // Disable interrupts. This prevents GDB trying to interrupt us + // while we are in the middle of sending a packet. The serial + // receive interrupt will be seen when we re-enable interrupts + // later. + CYG_INTERRUPT_STATE oldstate; + HAL_DISABLE_INTERRUPTS(oldstate); + + while(1) + { + static char hex[] = "0123456789ABCDEF"; + cyg_uint8 csum = 0; + int i; + char c1; + + hal_uart_write_char('$'); + hal_uart_write_char('O'); + csum += 'O'; + for( i = 0; i < pos; i++ ) + { + char ch = line[i]; + char h = hex[(ch>>4)&0xF]; + char l = hex[ch&0xF]; + hal_uart_write_char(h); + hal_uart_write_char(l); + csum += h; + csum += l; + } + hal_uart_write_char('#'); + hal_uart_write_char(hex[(csum>>4)&0xF]); + hal_uart_write_char(hex[csum&0xF]); + + hal_uart_read_char( &c1 ); + + if( c1 == '+' ) break; + + if( cyg_hal_is_break( &c1 , 1 ) ) + cyg_hal_user_break( NULL ); + + } + + pos = 0; + + // Disabling the interrupts for an extended period of time + // can provoke a spurious interrupt. + + // Ensure that this write does not provoke a spurious interrupt. + HAL_INTERRUPT_ACKNOWLEDGE( CYGHWR_HAL_GDB_PORT_VECTOR ); + + // And re-enable interrupts + HAL_RESTORE_INTERRUPTS( oldstate ); + + } +#else + hal_uart_write_char(c); +#endif +} + +/*---------------------------------------------------------------------------*/ +/* End of hal_diag.c */ diff --git a/packages/hal/mips/upd985xx/current/src/hal_mips_upd985xx.ld b/packages/hal/mips/upd985xx/current/src/hal_mips_upd985xx.ld new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/src/hal_mips_upd985xx.ld @@ -0,0 +1,203 @@ +//=========================================================================== +// +// MLT linker script for NEC MIPS uPD985xx +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + +#include + +STARTUP(vectors.o) +ENTRY(reset_vector) +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +#ifdef EXTRAS +INPUT(extras.o) +#endif +GROUP(libtarget.a libgcc.a) + +#define ALIGN_LMA 8 +#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1)) +#define LMA_EQ_VMA +#define FORCE_OUTPUT . = . + +#define SECTIONS_BEGIN + +#if defined(CYG_HAL_STARTUP_RAM) + +/* this version for RAM startup */ +#define SECTION_rom_vectors(_region_, _vma_, _lma_) \ + .rom_vectors _vma_ : _lma_ \ + { KEEP (*(.utlb_vector)) \ + . = ALIGN(0x80); KEEP(*(.other_vector)) \ + /* debug and reset vector not used in RAM version */ \ + KEEP (*(.reset_vector)) } \ + > _region_ + +#elif defined(CYG_HAL_STARTUP_ROM) + +/* this version for ROM startup */ +#define SECTION_rom_vectors(_region_, _vma_, _lma_) \ + .rom_vectors _vma_ : _lma_ \ + { KEEP (*(.reset_vector)) \ + . = ALIGN(0x100); KEEP (*(.utlb_vector)) \ + . = ALIGN(0x80); KEEP(*(.other_vector)) \ + } > _region_ + +#elif defined(CYG_HAL_STARTUP_ROMRAM) + +/* this version for ROMRAM startup. These are actually a */ +/* combination of the ROM and RAM vector locations since the code */ +/* starts off in ROM and transfers to RAM during startup. */ +#define SECTION_rom_vectors(_region_, _vma_, _lma_) \ + .rom_vectors _vma_ : _lma_ \ + { \ + KEEP (*(.reset_vector)) \ + . = ALIGN(0x100); \ + KEEP (*(.utlb_vector)) \ + . = ALIGN(0x80); \ + KEEP(*(.other_vector)) \ + . = ALIGN(0x800); \ + } > _region_ =0 + +#endif /* ROMRAM startup version of ROM vectors */ + +#define SECTION_text(_region_, _vma_, _lma_) \ + .text _vma_ : _lma_ \ + { _stext = ABSOLUTE(.); \ + *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) } \ + > _region_ \ + _etext = .; PROVIDE (etext = .); + +#define SECTION_fini(_region_, _vma_, _lma_) \ + .fini _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fini) } \ + > _region_ + +#define SECTION_ctors(_region_, _vma_, _lma_) \ + .ctors _vma_ : _lma_ \ + { \ + __CTOR_LIST__ = ABSOLUTE (.); \ + KEEP(*(.ctors)) \ + KEEP(*(SORT(.ctors.*))) \ + __CTOR_END__ = ABSOLUTE (.); \ + } > _region_ + +#define SECTION_dtors(_region_, _vma_, _lma_) \ + .dtors _vma_ : _lma_ \ + { \ + __DTOR_LIST__ = ABSOLUTE (.); \ + KEEP(*(SORT(.dtors.*))) \ + KEEP(*(.dtors)) \ + __DTOR_END__ = ABSOLUTE (.); \ + } > _region_ + +#define SECTION_rodata(_region_, _vma_, _lma_) \ + .rodata _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata*) } \ + > _region_ + +#define SECTION_vsr_table(_region_, _vma_, _lma_) \ + .vsr_table _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.vsr_table) } \ + > _region_ + +#define SECTION_rodata1(_region_, _vma_, _lma_) \ + .rodata1 _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata1) } \ + > _region_ + +#define SECTION_fixup(_region_, _vma_, _lma_) \ + .fixup _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fixup) } \ + > _region_ + +#define SECTION_rel__dyn(_region_, _vma_, _lma_) \ + .rel.dyn _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rel.dyn) } \ + > _region_ + +#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ + .gcc_except_table _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.gcc_except_table) } \ + > _region_ + +#define SECTION_data(_region_, _vma_, _lma_) \ + .data _vma_ : _lma_ \ + { __ram_data_start = ABSOLUTE (.); \ + *(.data*) *(.data1) \ + _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.); \ + _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.); \ + . = ALIGN (8); \ + KEEP(*( SORT (.ecos.table.*))) ; \ + . = ALIGN (8); \ + _GOT_START = ABSOLUTE (.); _gp = ABSOLUTE (.); __global = _gp; _GLOBAL_OFFSET_TABLE_ = ABSOLUTE (.); _SDA_BASE_ = ABSOLUTE (.); \ + *(.got.plt) *(.got) _GOT_END_ = ABSOLUTE (.); \ + *(.dynamic) *(.lit8) *(.lit4) *(.sdata*) *(.sbss*) *(.eh_frame) } \ + > _region_ \ + __rom_data_start = LOADADDR (.data); \ + __ram_data_end = .; PROVIDE (__ram_data_end = .); _edata = .; PROVIDE (edata = .); + +#define SECTION_bss(_region_, _vma_, _lma_) \ + .bss _vma_ : _lma_ \ + { __bss_start = ABSOLUTE (.); \ + *(.scommon) *(.dynbss) *(.bss) *(COMMON) \ + __bss_end = ABSOLUTE (.); } \ + > _region_ + +#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); \ + .debug 0 : { *(.debug) } \ + .line 0 : { *(.line) } \ + .debug_srcinfo 0 : { *(.debug_srcinfo) } \ + .debug_sfnames 0 : { *(.debug_sfnames) } \ + .debug_aranges 0 : { *(.debug_aranges) } \ + .debug_pubnames 0 : { *(.debug_pubnames) } \ + .debug_info 0 : { *(.debug_info) } \ + .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) } \ + .debug_weaknames 0 : { *(.debug_weaknames) } \ + .debug_funcnames 0 : { *(.debug_funcnames) } \ + .debug_typenames 0 : { *(.debug_typenames) } \ + .debug_varnames 0 : { *(.debug_varnames) } \ + /DISCARD/ : { *(.debug_vector) } + +#include CYGHWR_MEMORY_LAYOUT_LDI + +hal_vsr_table = 0x80000400; +hal_interrupt_sr_mask_shadow_base = 0x80000500; +hal_virtual_vector_table = 0x80000600; diff --git a/packages/hal/mips/upd985xx/current/src/var_misc.c b/packages/hal/mips/upd985xx/current/src/var_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/mips/upd985xx/current/src/var_misc.c @@ -0,0 +1,224 @@ +//========================================================================== +// +// var_misc.c +// +// HAL CPU variant miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, nickg +// Contributors: nickg, jlarmour +// Date: 2001-05-24 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // Base types +#include // tracing macros +#include // assertion macros + +#include // everything... +#include // HAL_ICACHE_ENABLE(); +#include // hal_if_init(); +#include // HAL_INTERRUPT_UNMASK() +#include // hal_call_isr() + +/*------------------------------------------------------------------------*/ +/* Variant specific initialization routine. */ + +volatile CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT]; +volatile CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_ISR_COUNT]; +volatile CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT]; + +// ------------------------------------------------------------------------ +// An ISR for decoding and calling the additional S_ISR external interrupt +// sources; this has to be an external routine because the S_ISR register +// is read-clear, and the interrupt sources are edge-triggered so they do +// not re-assert themselves - so we must address multiple sources per +// actual interrupt. + +static cyg_uint32 _arbitration_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +#ifndef CYGOPT_HAL_MIPS_UPD985XX_HARDWARE_BUGS_S2 +static cyg_uint32 _arbitration_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + cyg_uint32 s_isr; + int bit, vecnum; + cyg_uint32 isr_ret = 0; + // decode interrupt source and for each active source call the ISR + + s_isr = *S_ISR; // Read once only + s_isr &= *S_IMR; // Keep unmasked bits + + for ( bit = 1, vecnum = CYGNUM_HAL_INTERRUPT_SYSCTL_LOW; + vecnum <= CYGNUM_HAL_INTERRUPT_SYSCTL_HI; + bit <<= 1, vecnum++ ) + if ( bit & s_isr ) + isr_ret |= hal_call_isr( vecnum ); + + return isr_ret & ~CYG_ISR_CALL_DSR; // Since we have no DSR. +} +#endif // NOT defined CYGOPT_HAL_MIPS_UPD985XX_HARDWARE_BUGS_S2 + +// ------------------------------------------------------------------------ + +void hal_variant_init(void) +{ + int i; + for ( i = 0; i < CYGNUM_HAL_ISR_COUNT; i++ ) { + hal_interrupt_handlers [i] = (CYG_ADDRESS)&hal_default_isr; + hal_interrupt_data [i] = 0; + hal_interrupt_objects [i] = 0; + } + + // Interrupt mask shadow variable initialization + hal_interrupt_sr_mask_shadow = 0; + + // Enable the IBUS arbiter so that internal devices can work + // (Ie. USB and ether) + *S_GMR |= S_GMR_IAEN; + + // Enable writing to the flash device per se (ie. no SEGV) + *RMMDR |= RMMDR_FLASH_WRITE_ENABLE; + + // Mask off external interrupt sources and clear any pending. + *S_IMR = 0; + i = *S_ISR; + // Enable sysctl interrupt (in status reg) for those external sources. + // "True" enable is in the external control reg, handled generically + // by HAL_INTERRUPT_UNMASK for those vector numbers. + HAL_INTERRUPT_ATTACH( CYGNUM_HAL_INTERRUPT_SYSCTL, &_arbitration_isr, 0, 0); + HAL_INTERRUPT_UNMASK( CYGNUM_HAL_INTERRUPT_SYSCTL ); + +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + hal_if_init(); +#endif + + // The uPD985xx only has an enable that works on both caches. So we + // only need to enable one of them for both to work. + HAL_DCACHE_ENABLE(); + // HAL_ICACHE_ENABLE(); +} + +// ------------------------------------------------------------------------ +// +// Routines to handle soft-masking and calling pent-up interrupts. +// + +#ifdef CYGOPT_HAL_MIPS_UPD985XX_HARDWARE_BUGS_S2 + +// Assume all these are called with interrupts disabled globally + +// We deal in vector numbers throughout: these contain "true" vector +// number shifts, whereas we have to shift hardware regs before use. +static int once_mask = 0; // Those unmasked ever +static int soft_mask = 0; // Those unmasked right now +static int pent_mask = 0; // Those pending right now + +void cyg_hal_interrupt_mask( int vec ) +{ + CYG_ASSERT( CYGNUM_HAL_INTERRUPT_SYSCTL_LOW <= vec, "vec underflow" ); + CYG_ASSERT( CYGNUM_HAL_INTERRUPT_SYSCTL_HI >= vec, "vec overflow" ); + // We only manipulate the soft mask - NEVER the S_IMR. + soft_mask &=~ (1<= vec, "vec overflow" ); + // If this is the very first time of unmasking, unmask in the S_IMR &c + // also. + if ( 0 == ( (1<= vec, "vec overflow" ); + // (no harm done if this is CYGNUM_HAL_INTERRUPT_SYSCTL) + pent_mask &=~ (1< +#include + +#ifdef CYGPKG_KERNEL +# include +#endif + +#include + +#include + +##----------------------------------------------------------------------------- +## MMU setup. +## Some of this code is taken from the PMON sources, hence it does not fully +## conform to our normal coding conventions. + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) + +// There is none. We can access all areas via kseg[01] so we are happy +// with no MMU setup. + +#endif + +##----------------------------------------------------------------------------- +## MEMC initialization. +## This also initializes the PCI bus and ISA bus bridge, so at the end of this +## we should have full access to all the memory and devices we need. +## This code is table driven, which is somewhat more compact that coding it all. +## Table entries consist of an address and a value to store in that address. +## A zero address terminates the table. Two special address values modify the +## behaviour: +## DELAY_LOOP loops for the number of iterations in the value field. +## WRITE16 treats the next 2 words as an address and value to be written +## with a 16 bit write cycle. + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) + +#define DELAY_LOOP 1 +#define WRITE16 2 + + +FUNC_START(hal_memc_setup) + + lar t0,hal_memc_setup_table + la t1,0xbfc00000 + la t2,DELAY_LOOP + la t3,WRITE16 +1: + lw a0,0(t0) # next table entry + lw a1,4(t0) # value to write + addiu t0,8 # go to next entry + beq a0,t2,2f # Check for delay + nop + beq a0,t3,3f # Check for 16 bit write + nop + beqz a0,9f # zero terminates loop + nop + sw a1,0(a0) # write it + lw zero,0(t1) # uncached read to flush write buffer + b 1b + nop +2: + lw zero,0(t1) # uncached read to flush write buffer + bnez a1,2b # count down by value in a1 + addiu a1,-1 # decrement in delay slot + b 1b # go back to loop + nop +3: + lw a3,0(t0) # get next word + addiu t0,4 # skip it + sh a3,0(a1) # store halfword + lw zero,0(t1) # uncached read to flush write buffer + b 1b + nop +9: + jr ra + nop + +FUNC_END(hal_memc_setup) + +##----------------------------------------------------------------------------- +##----------------------------------------------------------------------------- +## The initialization table + +hal_memc_setup_table: + .long DELAY_LOOP, 0x00010000 # Wait for HW to settle + + .long RMMDR_ADR, RMMDR_28F640 + .long RMATR_ADR, RMATR_28F640 + + .long DELAY_LOOP, 0x00010000 # Wait for HW to settle + + .long SDMDR_ADR, SDMDR_INIT + .long SDTSR_ADR, SDTSR_INIT + .long SDPTR_ADR, SDPTR_INIT + .long SDRMR_ADR, SDRMR_INIT + + .long DELAY_LOOP, 0x00010000 # Wait for HW to settle + + .long 0, 0 + + +#endif + +##----------------------------------------------------------------------------- +## end of platform.S + diff --git a/packages/hal/mips/vr4300/current/ChangeLog b/packages/hal/mips/vr4300/current/ChangeLog --- a/packages/hal/mips/vr4300/current/ChangeLog +++ b/packages/hal/mips/vr4300/current/ChangeLog @@ -32,6 +32,8 @@ 2001-09-07 Nick Garnett @@ -264,27 +266,36 @@ 1999-04-21 Nick Garnett diff --git a/packages/hal/mips/vr4300/current/src/var_misc.c b/packages/hal/mips/vr4300/current/src/var_misc.c --- a/packages/hal/mips/vr4300/current/src/var_misc.c +++ b/packages/hal/mips/vr4300/current/src/var_misc.c @@ -5,29 +5,38 @@ // HAL CPU variant miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mips/vrc4373/current/ChangeLog b/packages/hal/mips/vrc4373/current/ChangeLog --- a/packages/hal/mips/vrc4373/current/ChangeLog +++ b/packages/hal/mips/vrc4373/current/ChangeLog @@ -510,27 +510,36 @@ 1999-04-21 Nick Garnett + + * images/ROMRAM/redboot.bin + * images/ROMRAM/redboot.elf + * images/ROMRAM/redboot.img + * images/ROMRAM/redboot.srec + Updated images. + +2001-10-24 Nick Garnett + + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.ldi: + Align BSS to 16 byte boundary. + + * images/ROMRAM/redboot.bin: + * images/ROMRAM/redboot.elf: + * images/ROMRAM/redboot.img: + * images/ROMRAM/redboot.srec: + Update images. Note that only the ROMRAM images are needed. + +2001-10-11 Hugo Tyson + + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.h: + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.h: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.h: + Correct these all to reflect the truth about SDRAM size (32Mb). + [and remove debug version from unused ROM-startup files] + +2001-10-05 Hugo Tyson + + * misc/redboot_ROM.ecm: (not used really AFAICS) + * misc/redboot_RAM.ecm: + * misc/redboot_ROMRAM.ecm: + Add the network driver to the template so that it leaps into life + in RedBoot. + +2001-10-01 Jonathan Larmour + + * cdl/hal_mips_vr4300_vrc4375.cdl: Define CPU as little-endian here. + +2001-09-17 Nick Garnett + + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.h: + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.h: + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.h: + Added PCI window. + + * misc/redboot_ROM.ecm: + * misc/redboot_RAM.ecm: + * misc/redboot_ROMRAM.ecm: + Added configury to support ethernet. + [Later] Disabled this temporarily. + +2001-09-10 Nick Garnett + + * misc/redboot_RAM.ecm: + * misc/redboot_ROM.ecm: + * misc/redboot_ROMRAM.ecm: + Added configury to support FLASH. + +2001-09-07 Nick Garnett + + * cdl/hal_mips_vr4300_vrc4375.cdl: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.h: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_ram.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.h: + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_rom.mlt: + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.h: + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.ldi: + * include/pkgconf/mlt_mips_vr4300_vrc4375_romram.mlt: + * misc/redboot_RAM.ecm: + * misc/redboot_ROM.ecm: + * misc/redboot_ROMRAM.ecm: + This package added to provide configury for the VRC4375 platform. + + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/mips/vrc4375/current/cdl/hal_mips_vr4300_vrc4375.cdl b/packages/hal/mips/vrc4375/current/cdl/hal_mips_vr4300_vrc4375.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/cdl/hal_mips_vr4300_vrc4375.cdl @@ -0,0 +1,321 @@ +# ==================================================================== +# +# hal_mips_vr4300_vrc4375.cdl +# +# VR4300/VRC4375 board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): nickg +# Original data: +# Contributors: +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_MIPS_VR4300_VRC4375 { + display "VRC4375 evaluation board" + parent CYGPKG_HAL_MIPS + requires CYGPKG_HAL_MIPS_VR4300 + requires CYGPKG_HAL_MIPS_VR4300_VRC437X + define_header hal_mips_vr4300_vrc4375.h + include_dir cyg/hal + description " + The VRC4375 HAL package should be used when targetting the + actual hardware." + + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "#include " + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM" "ROMRAM"} + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the VRC4375 board it is possible to build + the system for either RAM bootstrap or ROM bootstrap." + } + + cdl_option CYGPKG_HAL_MIPS_LSBFIRST { + display "CPU little-endian" + calculated { 1 } + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants." + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + # Isn't a nice way to handle freq requirement! + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated 665000 + } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "mips64vr4300-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mgp32 -EL -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-mgp32 -EL -g -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROMRAM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "mips_vr4300_vrc4375_ram" : \ + CYG_HAL_STARTUP == "ROM" ? "mips_vr4300_vrc4375_rom" : \ + "mips_vr4300_vrc4375_romram" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" "PMON" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for three different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"GDB_stubs\" provides support when GDB stubs are included in + the ROM monitor or boot ROM. + And finally, \"PMON\" allows the program to co-operate with + the PMON ROM monitor when fitted to the board." + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROMRAM" || CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option controls the baud rate used for the GDB connection." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 2 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The VRC4375 board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The VRC4375 board has only one serial port. This option + chooses which port will be used for diagnostic output." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + compile -library=libextras.a + + make -priority 325 { + /bin/redboot.srec : /bin/redboot.elf + $(OBJCOPY) --strip-all $< $(@:.srec=.img) + $(OBJCOPY) -O binary $< $(@:.srec=.bin) + $(OBJCOPY) -O srec $< $@ + } + } + } +} diff --git a/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_ram.h b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_ram.h @@ -0,0 +1,22 @@ +// eCos memory layout - Fri Oct 20 06:25:55 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x80100000) +#define CYGMEM_REGION_ram_SIZE (0x1e00000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x81f00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_ram.ldi b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_ram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Fri Oct 20 06:25:55 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x80100000, LENGTH = 0x1e00000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x80100000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_ctors (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_dtors (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rel__dyn (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x81f00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; + SECTIONS_END +} diff --git a/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_ram.mlt b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_ram.mlt @@ -0,0 +1,16 @@ +version 0 +region ram 80100000 1e00000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 80100000 80100000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 ctors ctors ! +section ctors 0 1 0 1 0 1 0 1 dtors dtors ! +section dtors 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 rel.dyn rel.dyn ! +section rel.dyn 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 8 0 1 0 1 0 1 bss bss ! +section bss 0 10 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 100000 1 0 0 1 0 1 0 81f00000 81f00000 ! diff --git a/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_rom.h b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_rom.h @@ -0,0 +1,25 @@ +// eCos memory layout - Fri Oct 20 07:10:03 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x80000800) +#define CYGMEM_REGION_ram_SIZE (0x1eff800) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_rom (0xbfc00000) +#define CYGMEM_REGION_rom_SIZE (0x80000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x81f00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_rom.ldi b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_rom.ldi @@ -0,0 +1,31 @@ +// eCos memory layout - Fri Oct 20 07:10:03 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x80000800, LENGTH = 0x1eff800 + rom : ORIGIN = 0xbfc00000, LENGTH = 0x80000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0xbfc00000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_ctors (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_dtors (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rel__dyn (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, 0x80000800, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x81f00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; + SECTIONS_END +} diff --git a/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_rom.mlt b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_rom.mlt @@ -0,0 +1,17 @@ +version 0 +region ram 80000800 1eff800 0 ! +region rom bfc00000 80000 1 ! +section data 0 1 1 1 1 1 0 0 80000800 bss ! +section bss 0 10 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 bfc00000 bfc00000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 ctors ctors ! +section ctors 0 1 0 1 0 1 0 1 dtors dtors ! +section dtors 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 rel.dyn rel.dyn ! +section rel.dyn 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 0 0 1 data ! +section pci_window 100000 1 0 0 1 0 1 0 81f00000 81f00000 ! diff --git a/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_romram.h b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_romram.h new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_romram.h @@ -0,0 +1,22 @@ +// eCos memory layout - Fri Oct 20 06:27:12 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x80000000) +#define CYGMEM_REGION_ram_SIZE (0x1f00000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x81f00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_romram.ldi b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_romram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_romram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Fri Oct 20 06:27:12 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x80000000, LENGTH = 0x1f00000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x80000000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_ctors (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_dtors (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rel__dyn (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x81f00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; + SECTIONS_END +} diff --git a/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_romram.mlt b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_romram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/include/pkgconf/mlt_mips_vr4300_vrc4375_romram.mlt @@ -0,0 +1,17 @@ +version 0 +region ram 80000000 1f00000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 80000000 80000000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 ctors ctors ! +section ctors 0 1 0 1 0 1 0 1 dtors dtors ! +section dtors 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 rel.dyn rel.dyn ! +section rel.dyn 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 8 0 1 0 1 0 1 bss bss ! +section bss 0 10 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 100000 1 0 0 1 0 1 0 81f00000 81f00000 ! + diff --git a/packages/hal/mips/vrc4375/current/misc/redboot_RAM.ecm b/packages/hal/mips/vrc4375/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/misc/redboot_RAM.ecm @@ -0,0 +1,65 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_option CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29F040B { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + +#cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { +# user_value 1 +#}; + +#cdl_option CYGBLD_REDBOOT_FLASH_BOOT_OFFSET { +# inferred_value 0x1C00000 +#}; diff --git a/packages/hal/mips/vrc4375/current/misc/redboot_ROM.ecm b/packages/hal/mips/vrc4375/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/misc/redboot_ROM.ecm @@ -0,0 +1,69 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_option CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29F040B { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + +#cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { +# user_value 1 +#}; + +#cdl_option CYGBLD_REDBOOT_FLASH_BOOT_OFFSET { +# inferred_value 0x1C00000 +#}; diff --git a/packages/hal/mips/vrc4375/current/misc/redboot_ROMRAM.ecm b/packages/hal/mips/vrc4375/current/misc/redboot_ROMRAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/mips/vrc4375/current/misc/redboot_ROMRAM.ecm @@ -0,0 +1,69 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROMRAM +}; + +cdl_option CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29F040B { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 1 +}; + +#cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { +# user_value 1 +#}; + +#cdl_option CYGBLD_REDBOOT_FLASH_BOOT_OFFSET { +# inferred_value 0x1C00000 +#}; diff --git a/packages/hal/mips/vrc437x/current/ChangeLog b/packages/hal/mips/vrc437x/current/ChangeLog --- a/packages/hal/mips/vrc437x/current/ChangeLog +++ b/packages/hal/mips/vrc437x/current/ChangeLog @@ -52,6 +52,8 @@ 2001-09-07 Nick Garnett diff --git a/packages/hal/mn10300/am31/current/src/var_misc.c b/packages/hal/mn10300/am31/current/src/var_misc.c --- a/packages/hal/mn10300/am31/current/src/var_misc.c +++ b/packages/hal/mn10300/am31/current/src/var_misc.c @@ -5,29 +5,38 @@ // HAL CPU variant miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/am33/current/ChangeLog b/packages/hal/mn10300/am33/current/ChangeLog --- a/packages/hal/mn10300/am33/current/ChangeLog +++ b/packages/hal/mn10300/am33/current/ChangeLog @@ -26,6 +26,10 @@ 2000-08-10 Drew Moseley @@ -127,6 +136,13 @@ GROUP(libtarget.a libgcc.a) _hal_virtual_vector_table = 0x50000200; #endif +#elif CYGHWR_HAL_MN10300_AM33_REVISION == 2 + +#ifndef CYG_HAL_PLATFORM_HAL_VSR_TABLE_DEFINED +_hal_vsr_table = 0x90000000; +_hal_virtual_vector_table = 0x90000100; +#endif + #else #error Unknown AM33 Revision diff --git a/packages/hal/mn10300/am33/current/src/var_misc.c b/packages/hal/mn10300/am33/current/src/var_misc.c --- a/packages/hal/mn10300/am33/current/src/var_misc.c +++ b/packages/hal/mn10300/am33/current/src/var_misc.c @@ -5,29 +5,38 @@ // HAL CPU variant miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -100,6 +109,9 @@ void cyg_hal_dcache_store(CYG_ADDRWORD b #include #include +#if CYGHWR_HAL_MN10300_AM33_REVISION == 2 +int fpu_regs_read = 0; +#endif int msp_read = 0; @@ -160,6 +172,48 @@ void am33_get_gdb_extra_registers(CYG_AD registers[25] = usp; } +#if CYGHWR_HAL_MN10300_AM33_REVISION == 2 + if ((regs->psw & HAL_ARCH_AM33_PSW_FE) == HAL_ARCH_AM33_PSW_FE) + { + // The FPU is enabled. Go ahead and read the registers + asm volatile (" fmov fpcr, %0 " : "=d" (registers[29]) : ); + asm volatile (" fmov fs0, %0 " : "=m" (registers[32]) : ); + asm volatile (" fmov fs1, %0 " : "=m" (registers[33]) : ); + asm volatile (" fmov fs2, %0 " : "=m" (registers[34]) : ); + asm volatile (" fmov fs3, %0 " : "=m" (registers[35]) : ); + asm volatile (" fmov fs4, %0 " : "=m" (registers[36]) : ); + asm volatile (" fmov fs5, %0 " : "=m" (registers[37]) : ); + asm volatile (" fmov fs6, %0 " : "=m" (registers[38]) : ); + asm volatile (" fmov fs7, %0 " : "=m" (registers[39]) : ); + asm volatile (" fmov fs8, %0 " : "=m" (registers[40]) : ); + asm volatile (" fmov fs9, %0 " : "=m" (registers[41]) : ); + asm volatile (" fmov fs10, %0 " : "=m" (registers[42]) : ); + asm volatile (" fmov fs11, %0 " : "=m" (registers[43]) : ); + asm volatile (" fmov fs12, %0 " : "=m" (registers[44]) : ); + asm volatile (" fmov fs13, %0 " : "=m" (registers[45]) : ); + asm volatile (" fmov fs14, %0 " : "=m" (registers[46]) : ); + asm volatile (" fmov fs15, %0 " : "=m" (registers[47]) : ); + asm volatile (" fmov fs16, %0 " : "=m" (registers[48]) : ); + asm volatile (" fmov fs17, %0 " : "=m" (registers[49]) : ); + asm volatile (" fmov fs18, %0 " : "=m" (registers[50]) : ); + asm volatile (" fmov fs19, %0 " : "=m" (registers[51]) : ); + asm volatile (" fmov fs20, %0 " : "=m" (registers[52]) : ); + asm volatile (" fmov fs21, %0 " : "=m" (registers[53]) : ); + asm volatile (" fmov fs22, %0 " : "=m" (registers[54]) : ); + asm volatile (" fmov fs23, %0 " : "=m" (registers[55]) : ); + asm volatile (" fmov fs24, %0 " : "=m" (registers[56]) : ); + asm volatile (" fmov fs25, %0 " : "=m" (registers[57]) : ); + asm volatile (" fmov fs26, %0 " : "=m" (registers[58]) : ); + asm volatile (" fmov fs27, %0 " : "=m" (registers[59]) : ); + asm volatile (" fmov fs28, %0 " : "=m" (registers[60]) : ); + asm volatile (" fmov fs29, %0 " : "=m" (registers[61]) : ); + asm volatile (" fmov fs30, %0 " : "=m" (registers[62]) : ); + asm volatile (" fmov fs31, %0 " : "=m" (registers[63]) : ); + fpu_regs_read = 1; + } else { + fpu_regs_read = 0; + } +#endif #ifdef CYGHWR_REGISTER_VALIDITY_CHECKING { @@ -235,6 +289,46 @@ void am33_set_gdb_extra_registers(CYG_AD } } +#if CYGHWR_HAL_MN10300_AM33_REVISION == 2 + if (fpu_regs_read) + { + // The FPU registers have been read and the FPU is enabled. + // Go ahead and write the registers + asm volatile (" fmov %0, fpcr " : : "d" (registers[29]) ); + asm volatile (" fmov %0, fs0 " : : "m" (registers[32]) ); + asm volatile (" fmov %0, fs1 " : : "m" (registers[33]) ); + asm volatile (" fmov %0, fs2 " : : "m" (registers[34]) ); + asm volatile (" fmov %0, fs3 " : : "m" (registers[35]) ); + asm volatile (" fmov %0, fs4 " : : "m" (registers[36]) ); + asm volatile (" fmov %0, fs5 " : : "m" (registers[37]) ); + asm volatile (" fmov %0, fs6 " : : "m" (registers[38]) ); + asm volatile (" fmov %0, fs7 " : : "m" (registers[39]) ); + asm volatile (" fmov %0, fs8 " : : "m" (registers[40]) ); + asm volatile (" fmov %0, fs9 " : : "m" (registers[41]) ); + asm volatile (" fmov %0, fs10 " : : "m" (registers[42]) ); + asm volatile (" fmov %0, fs11 " : : "m" (registers[43]) ); + asm volatile (" fmov %0, fs12 " : : "m" (registers[44]) ); + asm volatile (" fmov %0, fs13 " : : "m" (registers[45]) ); + asm volatile (" fmov %0, fs14 " : : "m" (registers[46]) ); + asm volatile (" fmov %0, fs15 " : : "m" (registers[47]) ); + asm volatile (" fmov %0, fs16 " : : "m" (registers[48]) ); + asm volatile (" fmov %0, fs17 " : : "m" (registers[49]) ); + asm volatile (" fmov %0, fs18 " : : "m" (registers[50]) ); + asm volatile (" fmov %0, fs19 " : : "m" (registers[51]) ); + asm volatile (" fmov %0, fs20 " : : "m" (registers[52]) ); + asm volatile (" fmov %0, fs21 " : : "m" (registers[53]) ); + asm volatile (" fmov %0, fs22 " : : "m" (registers[54]) ); + asm volatile (" fmov %0, fs23 " : : "m" (registers[55]) ); + asm volatile (" fmov %0, fs24 " : : "m" (registers[56]) ); + asm volatile (" fmov %0, fs25 " : : "m" (registers[57]) ); + asm volatile (" fmov %0, fs26 " : : "m" (registers[58]) ); + asm volatile (" fmov %0, fs27 " : : "m" (registers[59]) ); + asm volatile (" fmov %0, fs28 " : : "m" (registers[60]) ); + asm volatile (" fmov %0, fs29 " : : "m" (registers[61]) ); + asm volatile (" fmov %0, fs30 " : : "m" (registers[62]) ); + asm volatile (" fmov %0, fs31 " : : "m" (registers[63]) ); + } +#endif } #endif // CYGPKG_CYGMON diff --git a/packages/hal/mn10300/am33/current/src/variant.S b/packages/hal/mn10300/am33/current/src/variant.S --- a/packages/hal/mn10300/am33/current/src/variant.S +++ b/packages/hal/mn10300/am33/current/src/variant.S @@ -5,29 +5,38 @@ ## MN10300 AM33 variant code ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mn10300/arch/current/ChangeLog b/packages/hal/mn10300/arch/current/ChangeLog --- a/packages/hal/mn10300/arch/current/ChangeLog +++ b/packages/hal/mn10300/arch/current/ChangeLog @@ -1,3 +1,15 @@ +2002-04-29 Jonathan Larmour + + * src/vectors.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-15 Jonathan Larmour + + * src/hal_syscall.c (hal_syscall_handler): Add extra sig argument to + __do_syscall. + 2001-11-16 Nick Garnett * src/hal_misc.c (hal_msbit_index): Fixed this function so that it @@ -6,6 +18,8 @@ 2001-11-16 Nick Garnett * src/hal_syscall.c: mustn't increment the return address by 4. + * cdl/hal_mn10300.cdl: moved the RTC configuration previously + added to the ASB2305 platform. 2001-10-16 David Howells @@ -26,6 +40,7 @@ 2001-07-27 David Howells + + * cdl/hal_mn10300_am33_asb.cdl: Indicate support of variable baud rates. + +2001-03-08 Jesper Skov + + * cdl/hal_mn10300_am33_asb.cdl: Removed + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_GUARANTEED which is now the + default. + +2001-01-26 Jesper Skov + + * src/ser_asb.c: Removed CYGSEM_HAL_VIRTUAL_VECTOR_DIAG check. + * include/plf_stub.h: Reset macros moved + * include/plf_intr.h: to this file. + +2000-10-20 Jesper Skov + + * include/plf_io.h: Move volatile keyword before type. + +2000-10-20 Jonathan Larmour + + * include/pkgconf/mlt_mn10300_am33_asb_ram.h: + * include/pkgconf/mlt_mn10300_am33_asb_rom.h: + * include/pkgconf/mlt_mn10300_am33_asb_ram.ldi: + * include/pkgconf/mlt_mn10300_am33_asb_rom.ldi: + Regenerated with updated host tools + +2000-10-19 Jesper Skov + + * include/pkgconf/mlt_mn10300_am33_asb_ram.h: Added heap1 label. + * include/pkgconf/mlt_mn10300_am33_asb_ram.mlt: Same. + * include/pkgconf/mlt_mn10300_am33_asb_ram.ldi: Same. + * include/pkgconf/mlt_mn10300_am33_asb_rom.h: Same. + * include/pkgconf/mlt_mn10300_am33_asb_rom.mlt: Same. + * include/pkgconf/mlt_mn10300_am33_asb_rom.ldi: Same. + +2000-08-22 Jonathan Larmour + + * cdl/hal_mn10300_am33_asb.cdl: Explicitly require + CYGHWR_HAL_MN10300_AM33_REVISION == 2 + +2000-08-14 Drew Moseley + + * src/plf_misc.c: Always include CYGHWR_MEMORY_LAYOUT_H. + Only define __get_syscall_num() if CYGPKG_CYGMON is defined. + +2000-08-11 Drew Moseley + + * cdl/hal_mn10300_am33_asb.cdl: New file for the ASB2303 port. + * include/hal_diag.h: Ditto. + * include/platform.inc: Ditto. + * include/plf_intr.h: Ditto. + * include/plf_io.h: Ditto. + * include/plf_stub.h: Ditto. + * include/pkgconf/hal_mn10300_am33_asb.h: Ditto. + * src/ser_asb.c: Ditto. + * src/plf_stub.c: Ditto. + * src/plf_misc.c: Ditto. + * src/hal_diag.c: Ditto. + * src/PKGconf.mak: Ditto. + * include/pkgconf/mlt_mn10300_am33_asb_rom.mlt: Ditto. + * include/pkgconf/mlt_mn10300_am33_asb_rom.ldi: Ditto. + * include/pkgconf/mlt_mn10300_am33_asb_rom.h: Ditto. + * include/pkgconf/mlt_mn10300_am33_asb_ram.mlt: Ditto. + * include/pkgconf/mlt_mn10300_am33_asb_ram.ldi: Ditto. + * include/pkgconf/mlt_mn10300_am33_asb_ram.h: Ditto. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/mn10300/asb/current/cdl/hal_mn10300_am33_asb.cdl b/packages/hal/mn10300/asb/current/cdl/hal_mn10300_am33_asb.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/cdl/hal_mn10300_am33_asb.cdl @@ -0,0 +1,326 @@ +# ==================================================================== +# +# hal_mn10300_am33_asb.cdl +# +# AM33-2/ASB board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): dmoseley +# Original data: nick, bartv +# Contributors: +# Date: 2000-08-11 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_MN10300_AM33_ASB { + display "Panasonic ASB2303 Evaluation Board" + parent CYGPKG_HAL_MN10300 + requires CYGPKG_HAL_MN10300_AM33 + requires { CYGHWR_HAL_MN10300_AM33_REVISION == 2 } + define_header hal_mn10300_am33_asb.h + include_dir cyg/hal + description " + The ASB HAL package should be used when targetting the + actual hardware for the Panasonic ASB2303 Evaluation Board + with the MN103E010 microcontroller." + + compile hal_diag.c plf_stub.c plf_misc.c ser_asb.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_system_header "#define HAL_PLATFORM_BOARD \"Panasonic ASB2303\"" + puts $::cdl_system_header "#define HAL_PLATFORM_EXTRA \"\"" + puts $::cdl_system_header "#define HAL_PLATFORM_CPU \"MN103E010 AM33/2.0\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM"} + default_value {"ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + Currently only ROM startup type is supported." + } + + cdl_option CYGHWR_HAL_MN10300_AM33_ASB_DIAG_PORT { + display "Diagnostic Serial Port" + flavor data + legal_values 0 1 + default_value 0 + description " + The ASB2303 board has two serial ports. This option + chooses which of these ports will be used for diagnostic output. + At present only port 0 is supported." + } + + cdl_option CYGHWR_HAL_MN10300_AM33_ASB_DIAG_BAUD { + display "Diagnostic Serial Port Baud Rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + define CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGHWR_HAL_MN10300_AM33_ASB_GDB_PORT { + display "GDB Serial Port" + flavor data + legal_values 0 1 + default_value 0 + description " + The ASB2303 board has two separate serial ports. This option + chooses which of these ports will be used to connect to a host + running GDB. + At present only port 0 is supported." + } + + cdl_option CYGHWR_HAL_MN10300_AM33_ASB_GDB_BAUD { + display "GDB Serial Port Baud Rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + description " + This option controls the baud rate used for the GDB connection." + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "mn10300-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mam33-2 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -Wp,-Wno-paste -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-mam33-2 -g -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_option CYGNUM_HAL_BREAKPOINT_LIST_SIZE { + display "Number of breakpoints supported by the HAL." + flavor data + default_value 25 + description " + This option determines the number of breakpoints supported by the HAL." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The ASB2303 board has two serial ports. Currently, + only the first serial port is supported. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The ASB2303 board has two serial ports. Currently, + only the first serial port is supported. This option + chooses which port will be used for diagnostic output." + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "mn10300_am33_asb_ram" : \ + "mn10300_am33_asb_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "CygMon" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "CygMon" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for three different varieties of ROM monitor. + This support changes various eCos semantics such as the encoding + of diagnostic output, or the overriding of hardware interrupt + vectors. + Firstly there is \"Generic\" support which prevents the HAL + from overriding the hardware vectors that it does not use, to + instead allow an installed ROM monitor to handle them. This is + the most basic support which is likely to be common to most + implementations of ROM monitor. + \"CygMon\" provides support for the Cygnus ROM Monitor. + And finally, \"GDB_stubs\" provides support when GDB stubs are + included in the ROM monitor or boot ROM." + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 1 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_component CYGPKG_CYGMON_HAL_OPTIONS { + display "CygMon HAL options" + flavor none + no_define + parent CYGPKG_CYGMON + active_if CYGPKG_CYGMON + description " + This option also lists the target's requirements for a valid CygMon + configuration." + + cdl_option CYGBLD_BUILD_CYGMON_BIN { + display "Build CygMon ROM binary image" + active_if CYGBLD_BUILD_CYGMON + default_value 1 + no_define + description "This option enables the conversion of the CygMon ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + /bin/cygmon.bin : /bin/cygmon.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } +} diff --git a/packages/hal/mn10300/asb/current/include/hal_diag.h b/packages/hal/mn10300/asb/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/hal_diag.h @@ -0,0 +1,92 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +//============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov, nickg, dmoseley +// Date: 2000-08-11 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +#else // everything by steam + +//----------------------------------------------------------------------------- +// functions implemented in hal_diag.c + +externC void hal_diag_init(void); + +externC void hal_diag_write_char(char c); + +externC void hal_diag_read_char(char *c); + +//----------------------------------------------------------------------------- + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +//----------------------------------------------------------------------------- +// end of hal_diag.h +#endif // CYGONCE_HAL_HAL_DIAG_H diff --git a/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_ram.h b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_ram.h @@ -0,0 +1,17 @@ +// eCos memory layout - Fri Oct 20 08:28:43 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x90080000) +#define CYGMEM_REGION_ram_SIZE (0xf80000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x91000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_ram.ldi b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_ram.ldi @@ -0,0 +1,26 @@ +// eCos memory layout - Fri Oct 20 08:28:43 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x90080000, LENGTH = 0xf80000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x90080000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_ram.mlt b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_ram.mlt @@ -0,0 +1,12 @@ +version 0 +region ram 90080000 f80000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 90080000 90080000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_rom.h b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_rom.h @@ -0,0 +1,20 @@ +// eCos memory layout - Fri Oct 20 08:28:05 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_rom (0x80000000) +#define CYGMEM_REGION_rom_SIZE (0x400000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#define CYGMEM_REGION_ram (0x90000200) +#define CYGMEM_REGION_ram_SIZE (0x7fe00) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x90080000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_rom.ldi b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_rom.ldi @@ -0,0 +1,27 @@ +// eCos memory layout - Fri Oct 20 08:28:05 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + rom : ORIGIN = 0x80000000, LENGTH = 0x400000 + ram : ORIGIN = 0x90000200, LENGTH = 0x7fe00 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x80000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, 0x90000200, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_rom.mlt b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/pkgconf/mlt_mn10300_am33_asb_rom.mlt @@ -0,0 +1,13 @@ +version 0 +region rom 80000000 400000 1 ! +region ram 90000200 7fe00 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 80000000 80000000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 0 0 1 data ! +section data 0 1 1 1 1 1 0 0 90000200 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/mn10300/asb/current/include/platform.inc b/packages/hal/mn10300/asb/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/platform.inc @@ -0,0 +1,414 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## ASB2303 board assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): dmoseley +## Contributors:dmoseley +## Date: 2000-08-11 +## Purpose: ASB board definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the ASB board. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#------------------------------------------------------------------------------ +# Diagnostics macros. + +#include + + .macro hal_diag_data + .globl hal_diag_led_state +hal_diag_led_state: .long 0xffffffff +hal_diag_intr_count: .long 0 + .endm + +#define HAL_EARLY_INIT hal_led_init +.macro hal_led_init + # Setup Port 0 as all output + # Do this the very first thing so we have LED debugging available early + mov HAL_GPIO_MODE_ALL_OUTPUT,d0 + mov HAL_GPIO_0_MODE,a0 + mov d0,(a0) +.endm + + .macro hal_diag_init + hal_led_init + jmp 1f + +hal_diag_digits: + .byte 0x81 # 0 + .byte 0xf3 # 1 + .byte 0x49 # 2 + .byte 0x61 # 3 + .byte 0x33 # 4 + .byte 0x25 # 5 + .byte 0x05 # 6 + .byte 0xf1 # 7 + .byte 0x01 # 8 + .byte 0x21 # 9 + .byte 0x11 # A + .byte 0x07 # B + .byte 0x8d # C + .byte 0x43 # D + .byte 0x0d # E + .byte 0x1d # F + +hal_diag_hex_digits: + .ascii "0123456789ABCDEF" + +1: + hal_diag_led 0 + .endm + + .macro hal_diag_excpt_start + mov HAL_LED_ADDRESS,a0 + mov (a0),d0 + xor 0x01000000,d0 + mov d0,(a0) + .endm + + .macro hal_diag_intr_start + mov (hal_diag_intr_count),d1 + inc d1 + cmp 100,d1 + bne x\@ + clr d1 + mov HAL_LED_ADDRESS,a0 + mov (a0),d0 + xor 0x00010000,d0 + mov d0,(a0) +x\@: + mov d1,(hal_diag_intr_count) + .endm + + .macro hal_diag_restore + mov (hal_diag_intr_count),d0 + and 0x1000,d0 + beq x\@ + mov HAL_LED_ADDRESS,a0 + mov (a0),d0 + and 0xfffeffff,d0 + mov d0,(a0) +x\@: + .endm + + .macro hal_diag_led val + movm [d2,d3,a2],(sp) +0: mov hal_diag_digits,a2 + mov \val,d2 + and 0xf,d2 + add d2,a2 + movbu (a2),d3 + mov HAL_LED_ADDRESS,a2 + mov (a2),d2 + asl 8,d2 + or d3,d2 + mov d2,(a2) + movm (sp),[d2,d3,a2] + .endm + +#define CYGPKG_HAL_MN10300_DIAG_DEFINED + +#------------------------------------------------------------------------------ +# MEMC macros. + +#ifndef CYGPKG_HAL_MN10300_MEMC_DEFINED + +// These settings follow the recommended settings in the +// "MN103E010 Evaluation Board User's Guide" + +#define BCCR 0xC0002000 +#define BCCR_INIT 0x12040580 + +#define SBBASE0 0xD8C00100 +#define SBBASE0_INIT 0x8000FC01 +#define SBBASE1 0xD8C00110 +#define SBBASE1_INIT 0x8400FC01 +#define SBBASE2 0xD8C00120 +#define SBBASE2_INIT 0x8600FFF1 +#define SBBASE3 0xD8C00130 +#define SBBASE3_INIT 0x00000000 +#define SBBASE4 0xD8C00140 +#define SBBASE4_INIT 0x00000000 +#define SBBASE5 0xD8C00150 +#define SBBASE5_INIT 0x00000000 +#define SBBASE6 0xD8C00160 +#define SBBASE6_INIT 0x00000000 +#define SBBASE7 0xD8C00170 +#define SBBASE7_INIT 0x00000000 + +#define SBCTRL00 0xD8C00200 +#define SBCTRL00_INIT 0x21111000 +#define SBCTRL10 0xD8C00210 +#define SBCTRL10_INIT 0x21111000 +#define SBCTRL20 0xD8C00220 +#define SBCTRL20_INIT 0x21111000 +#define SBCTRL30 0xD8C00230 +#define SBCTRL30_INIT 0x00000000 +#define SBCTRL40 0xD8C00240 +#define SBCTRL40_INIT 0x00000000 +#define SBCTRL50 0xD8C00250 +#define SBCTRL50_INIT 0x00000000 +#define SBCTRL60 0xD8C00260 +#define SBCTRL60_INIT 0x00000000 +#define SBCTRL70 0xD8C00270 +#define SBCTRL70_INIT 0x00000000 + +#define SBCTRL01 0xD8C00204 +#define SBCTRL01_INIT 0x00100200 +#define SBCTRL11 0xD8C00214 +#define SBCTRL11_INIT 0x00100200 +#define SBCTRL21 0xD8C00224 +#define SBCTRL21_INIT 0x00100200 +#define SBCTRL31 0xD8C00234 +#define SBCTRL31_INIT 0x00000000 +#define SBCTRL41 0xD8C00244 +#define SBCTRL41_INIT 0x00000000 +#define SBCTRL51 0xD8C00254 +#define SBCTRL51_INIT 0x00000000 +#define SBCTRL61 0xD8C00264 +#define SBCTRL61_INIT 0x00000000 +#define SBCTRL71 0xD8C00274 +#define SBCTRL71_INIT 0x00000000 + +#define SBCTRL02 0xD8C00208 +#define SBCTRL02_INIT 0x00000004 +#define SBCTRL12 0xD8C00218 +#define SBCTRL12_INIT 0x00000004 +#define SBCTRL22 0xD8C00228 +#define SBCTRL22_INIT 0x00000004 +#define SBCTRL32 0xD8C00238 +#define SBCTRL32_INIT 0x00000000 +#define SBCTRL42 0xD8C00248 +#define SBCTRL42_INIT 0x00000000 +#define SBCTRL52 0xD8C00258 +#define SBCTRL52_INIT 0x00000000 +#define SBCTRL62 0xD8C00268 +#define SBCTRL62_INIT 0x00000000 +#define SBCTRL72 0xD8C00278 +#define SBCTRL72_INIT 0x00000000 + +#define SDBASE0 0xDA000008 +#define SDBASE0_INIT 0x9000FF81 +#define SDBASE1 0xDA00000C +#define SDBASE1_INIT 0x9080FF81 +#define SDRAMBUS 0xDA000000 +#define SDRAMBUS_INIT 0xA8990654 + + .macro hal_memc_init + mov BCCR,a0 + mov BCCR_INIT,d0 + mov d0,(a0) + + mov SBBASE0,a0 + mov SBBASE0_INIT,d0 + mov d0,(a0) + + mov SBBASE1,a0 + mov SBBASE1_INIT,d0 + mov d0,(a0) + + mov SBBASE2,a0 + mov SBBASE2_INIT,d0 + mov d0,(a0) + + mov SBBASE3,a0 + mov SBBASE3_INIT,d0 + mov d0,(a0) + + mov SBBASE4,a0 + mov SBBASE4_INIT,d0 + mov d0,(a0) + + mov SBBASE5,a0 + mov SBBASE5_INIT,d0 + mov d0,(a0) + + mov SBBASE6,a0 + mov SBBASE6_INIT,d0 + mov d0,(a0) + + mov SBBASE7,a0 + mov SBBASE7_INIT,d0 + mov d0,(a0) + + mov SBCTRL00,a0 + mov SBCTRL00_INIT,d0 + mov d0,(a0) + + mov SBCTRL10,a0 + mov SBCTRL10_INIT,d0 + mov d0,(a0) + + mov SBCTRL20,a0 + mov SBCTRL20_INIT,d0 + mov d0,(a0) + + mov SBCTRL30,a0 + mov SBCTRL30_INIT,d0 + mov d0,(a0) + + mov SBCTRL40,a0 + mov SBCTRL40_INIT,d0 + mov d0,(a0) + + mov SBCTRL50,a0 + mov SBCTRL50_INIT,d0 + mov d0,(a0) + + mov SBCTRL60,a0 + mov SBCTRL60_INIT,d0 + mov d0,(a0) + + mov SBCTRL70,a0 + mov SBCTRL70_INIT,d0 + mov d0,(a0) + + mov SBCTRL01,a0 + mov SBCTRL01_INIT,d0 + mov d0,(a0) + + mov SBCTRL11,a0 + mov SBCTRL11_INIT,d0 + mov d0,(a0) + + mov SBCTRL21,a0 + mov SBCTRL21_INIT,d0 + mov d0,(a0) + + mov SBCTRL31,a0 + mov SBCTRL31_INIT,d0 + mov d0,(a0) + + mov SBCTRL41,a0 + mov SBCTRL41_INIT,d0 + mov d0,(a0) + + mov SBCTRL51,a0 + mov SBCTRL51_INIT,d0 + mov d0,(a0) + + mov SBCTRL61,a0 + mov SBCTRL61_INIT,d0 + mov d0,(a0) + + mov SBCTRL71,a0 + mov SBCTRL71_INIT,d0 + mov d0,(a0) + + mov SBCTRL02,a0 + mov SBCTRL02_INIT,d0 + mov d0,(a0) + + mov SBCTRL12,a0 + mov SBCTRL12_INIT,d0 + mov d0,(a0) + + mov SBCTRL22,a0 + mov SBCTRL22_INIT,d0 + mov d0,(a0) + + mov SBCTRL32,a0 + mov SBCTRL32_INIT,d0 + mov d0,(a0) + + mov SBCTRL42,a0 + mov SBCTRL42_INIT,d0 + mov d0,(a0) + + mov SBCTRL52,a0 + mov SBCTRL52_INIT,d0 + mov d0,(a0) + + mov SBCTRL62,a0 + mov SBCTRL62_INIT,d0 + mov d0,(a0) + + mov SBCTRL72,a0 + mov SBCTRL72_INIT,d0 + mov d0,(a0) + + mov SDBASE0,a0 + mov SDBASE0_INIT,d0 + mov d0,(a0) + + mov SDBASE1,a0 + mov SDBASE1_INIT,d0 + mov d0,(a0) + + mov SDRAMBUS,a0 + mov SDRAMBUS_INIT,d0 + mov d0,(a0) + + # Jump forward so we start running from the 80000000 base address + mov 0f,a0 + jmp (a0) +0: + .endm + +#define CYGPKG_HAL_MN10300_MEMC_DEFINED + +#endif + + +//----------------------------------------------------------------------------- +// Syscall support. +#ifdef CYGPKG_CYGMON +// Cygmon provides syscall handling for this board +// These must be kept in sync with the rest of the tree. +#define SIGSYS 12 +#define SIGSYSCALL SIGSYS +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/packages/hal/mn10300/asb/current/include/plf_intr.h b/packages/hal/mn10300/asb/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/plf_intr.h @@ -0,0 +1,109 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// ASB Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jskov, +// gthomas, jlarmour, dmoseley +// Date: 2000-08-11 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the AM33-2 ASB2303 board. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include + +#if CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL==0 +#define CYGNUM_HAL_INTERRUPT_DEBUG_UART CYGNUM_HAL_INTERRUPT_SERIAL_1_RX +#elif CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL==1 +#define CYGNUM_HAL_INTERRUPT_DEBUG_UART CYGNUM_HAL_INTERRUPT_SERIAL_0_RX +#else +#error UNKNOWN DEBUG CHANNEL +#endif + +//-------------------------------------------------------------------------- +// Control-C support. + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +# define CYGHWR_HAL_GDB_PORT_VECTOR CYGNUM_HAL_INTERRUPT_SERIAL_1_RX + +externC cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +#define HAL_CTRLC_ISR hal_ctrlc_isr + +#endif + +//-------------------------------------------------------------------------- +// Function call support with a new stack. +// This will emulate thread creation using a new stack +// +#define HAL_ARCH_FUNCALL_NEW_STACK(func, base, size) hal_arch_funcall_new_stack(func, base, size) +extern void hal_arch_funcall_new_stack(void (*func)(void), void* stack_base, cyg_uint32 stack_size); + + +//---------------------------------------------------------------------------- +// Reset. +#ifndef CYGHWR_HAL_RESET_DEFINED +extern void hal_asb_reset( void ); +#define CYGHWR_HAL_RESET_DEFINED +#define HAL_PLATFORM_RESET() hal_asb_reset() + +#define HAL_PLATFORM_RESET_ENTRY 0x40000000 + +#endif // CYGHWR_HAL_RESET_DEFINED + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/mn10300/asb/current/include/plf_io.h b/packages/hal/mn10300/asb/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/plf_io.h @@ -0,0 +1,141 @@ +#ifndef CYGONCE_PLF_IO_H +#define CYGONCE_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// Platform specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley +// Contributors: dmoseley +// Date: 2000-08-11 +// Purpose: ASB2303 platform IO support +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef __ASSEMBLER__ +#define HAL_REG_8(x) x +#define HAL_REG_16(x) x +#define HAL_REG_32(x) x +#else +#define HAL_REG_8(x) (volatile cyg_uint8*)(x) +#define HAL_REG_16(x) (volatile cyg_uint16*)(x) +#define HAL_REG_32(x) (volatile cyg_uint32*)(x) +#endif + +//----------------------------------------------------------------------------- + +/* ASB GPIO Registers */ +#define HAL_GPIO_BASE 0xDB000000 + +#define HAL_GPIO_0_MODE_OFFSET 0x0000 +#define HAL_GPIO_0_IN_OFFSET 0x0004 +#define HAL_GPIO_0_OUT_OFFSET 0x0008 +#define HAL_GPIO_1_MODE_OFFSET 0x0100 +#define HAL_GPIO_1_IN_OFFSET 0x0104 +#define HAL_GPIO_1_OUT_OFFSET 0x0108 +#define HAL_GPIO_2_MODE_OFFSET 0x0200 +#define HAL_GPIO_2_IN_OFFSET 0x0204 +#define HAL_GPIO_2_OUT_OFFSET 0x0208 +#define HAL_GPIO_3_MODE_OFFSET 0x0300 +#define HAL_GPIO_3_IN_OFFSET 0x0304 +#define HAL_GPIO_3_OUT_OFFSET 0x0308 +#define HAL_GPIO_4_MODE_OFFSET 0x0400 +#define HAL_GPIO_4_IN_OFFSET 0x0404 +#define HAL_GPIO_4_OUT_OFFSET 0x0408 +#define HAL_GPIO_5_MODE_OFFSET 0x0500 +#define HAL_GPIO_5_IN_OFFSET 0x0504 +#define HAL_GPIO_5_OUT_OFFSET 0x0508 + +#define HAL_GPIO_0_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_0_MODE_OFFSET) +#define HAL_GPIO_0_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_0_IN_OFFSET) +#define HAL_GPIO_0_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_0_OUT_OFFSET) +#define HAL_GPIO_1_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_1_MODE_OFFSET) +#define HAL_GPIO_1_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_1_IN_OFFSET) +#define HAL_GPIO_1_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_1_OUT_OFFSET) +#define HAL_GPIO_2_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_2_MODE_OFFSET) +#define HAL_GPIO_2_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_2_IN_OFFSET) +#define HAL_GPIO_2_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_2_OUT_OFFSET) +#define HAL_GPIO_3_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_3_MODE_OFFSET) +#define HAL_GPIO_3_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_3_IN_OFFSET) +#define HAL_GPIO_3_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_3_OUT_OFFSET) +#define HAL_GPIO_4_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_4_MODE_OFFSET) +#define HAL_GPIO_4_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_4_IN_OFFSET) +#define HAL_GPIO_4_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_4_OUT_OFFSET) +#define HAL_GPIO_5_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_5_MODE_OFFSET) +#define HAL_GPIO_5_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_5_IN_OFFSET) +#define HAL_GPIO_5_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_5_OUT_OFFSET) + +//----------------------------------------------------------------------------- +#define HAL_LED_ADDRESS HAL_GPIO_0_OUT +#define HAL_GPIO_MODE_ALL_OUTPUT 0x5555 + + +#ifdef __ASSEMBLER__ + +# include +# define DEBUG_DISPLAY(hexdig) hal_diag_led hexdig +# define DEBUG_DELAY() \ + mov 0x20000, d0; \ +0: sub 1, d0; \ + bne 0b; \ + nop + +#else + +extern cyg_uint8 led_val(CYG_WORD hexdig); +# define DEBUG_DISPLAY(hexdig) HAL_WRITE_UINT8(HAL_LED_ADDRESS, led_val(hexdig)) +# define DEBUG_DELAY() \ + { \ + volatile int i = 0x80000; \ + while (--i) ; \ + } + +#endif + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_PLF_IO_H diff --git a/packages/hal/mn10300/asb/current/include/plf_stub.h b/packages/hal/mn10300/asb/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/include/plf_stub.h @@ -0,0 +1,103 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley +// Contributors:dmoseley +// Date: 2000-08-11 +// Purpose: Platform HAL stub support for AM33-20/ASB2303 boards. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() +#define HAL_STUB_PLATFORM_GET_CHAR() cyg_hal_plf_serial_getc(0) +#define HAL_STUB_PLATFORM_PUT_CHAR(c) cyg_hal_plf_serial_putc(0, (c)) +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) cyg_hal_plf_serial_setbaud(0, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE (&hal_asb_interruptible) +#define HAL_STUB_PLATFORM_INIT_BREAK_IRQ() CYG_EMPTY_STATEMENT + +//---------------------------------------------------------------------------- +// Stub initializer. + +externC void hal_asb_platform_init(void); + +#define HAL_STUB_PLATFORM_INIT() hal_asb_platform_init() +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +//----------------------------------------------------------------------------- +// Syscall support. +#ifdef CYGPKG_CYGMON +// Cygmon provides syscall handling for this board +#define SIGSYSCALL SIGSYS +extern int __get_syscall_num (void); +#endif + +//----------------------------------------------------------------------------- +// Register validity checking. +#ifdef CYGPKG_CYGMON +#define CYGHWR_REGISTER_VALIDITY_CHECKING +#endif + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/mn10300/asb/current/src/hal_diag.c b/packages/hal/mn10300/asb/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/src/hal_diag.c @@ -0,0 +1,215 @@ +//============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley (based on the original by jskov) +// Contributors:nickg, jskov, dmoseley +// Date: 2000-08-11 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#if !defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#warning HAL_DIAG has only been verified using CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +#include // base types +#include // tracing macros +#include // assertion macros + +#include +#include + +#warning GET HAL_DIAG STUFF WORKING + +/*---------------------------------------------------------------------------*/ +/* Select default diag channel to use */ + +//#define CYG_KERNEL_DIAG_SERIAL +//#define CYG_KERNEL_DIAG_BUFFER +//#define CYG_KERNEL_DIAG_GDB + +#if !defined(CYG_KERNEL_DIAG_SERIAL) && defined(CYGSEM_HAL_USE_ROM_MONITOR_GDB_stubs) +# define CYG_KERNEL_DIAG_SERIAL +# define CYG_KERNEL_DIAG_GDB +#else +# define CYG_KERNEL_DIAG_SERIAL +#endif + +/*---------------------------------------------------------------------------*/ + +externC void diag_write_string (const char*); + +#if defined(CYG_KERNEL_DIAG_SERIAL) +extern void cyg_hal_plf_comms_init(void); +extern void cyg_hal_plf_serial_putc(void*, cyg_uint8); +extern cyg_uint8 cyg_hal_plf_serial_getc(void*); +#endif + +#if defined(CYG_KERNEL_DIAG_BUFFER) +char hal_diag_buffer[10000]; +int hal_diag_buffer_pos; +#endif + +void hal_diag_init(void) +{ +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_comms_init(); +#endif + +#if defined(CYG_KERNEL_DIAG_BUFFER) + hal_diag_buffer_pos = 0; +#endif +} + +#ifdef CYG_KERNEL_DIAG_GDB +static void gdb_diag_write_char(char c) +{ + static char line[100]; + static int pos = 0; + + // No need to send CRs + if( c == '\r' ) return; + + line[pos++] = c; + + if( c == '\n' || pos == sizeof(line) ) + { + while (1) + { + static char hex[] = "0123456789ABCDEF"; + cyg_uint8 csum = 0; + int i; + + hal_diag_write_char_serial('$'); + hal_diag_write_char_serial('O'); + csum += 'O'; + for( i = 0; i < pos; i++ ) + { + char ch = line[i]; + char h = hex[(ch>>4)&0xF]; + char l = hex[ch&0xF]; + hal_diag_write_char_serial(h); + hal_diag_write_char_serial(l); + csum += h; + csum += l; + } + hal_diag_write_char_serial('#'); + hal_diag_write_char_serial(hex[(csum>>4)&0xF]); + hal_diag_write_char_serial(hex[csum&0xF]); + + { + char c1; + + hal_diag_read_char_serial( &c1 ); + + if( c1 == '+' ) break; + + + if( cyg_hal_is_break( &c1, 1 ) ) + cyg_hal_user_break( NULL ); + } + } + + pos = 0; + } +} +#endif // CYG_KERNEL_DIAG_GDB + +void hal_diag_write_char(char c) +{ + unsigned long __state; + + HAL_DISABLE_INTERRUPTS(__state); + + if(c == '\n') + { +#if defined (CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_putc(NULL, '\r'); + cyg_hal_plf_serial_putc(NULL, '\n'); +#endif +#if defined(CYG_KERNEL_DIAG_BUFFER) + hal_diag_buffer[hal_diag_buffer_pos++] = c; + if (hal_diag_buffer_pos >= sizeof(hal_diag_buffer) ) + hal_diag_buffer_pos = 0; +#endif +#if defined(CYG_KERNEL_DIAG_GDB) + gdb_diag_write_char(c); +#endif + } + else if (c == '\r') + { + // Ignore '\r' + } + else + { +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_putc(NULL, c); +#endif +#if defined(CYG_KERNEL_DIAG_BUFFER) + hal_diag_buffer[hal_diag_buffer_pos++] = c; + if (hal_diag_buffer_pos >= sizeof(hal_diag_buffer) ) + hal_diag_buffer_pos = 0; +#endif +#if defined(CYG_KERNEL_DIAG_GDB) + gdb_diag_write_char(c); +#endif + } + + HAL_RESTORE_INTERRUPTS(__state); +} + +void hal_diag_read_char(char *c) +{ +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_getc(c); +#endif +} + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +/*---------------------------------------------------------------------------*/ +/* End of hal_diag.c */ diff --git a/packages/hal/mn10300/asb/current/src/plf_misc.c b/packages/hal/mn10300/asb/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/src/plf_misc.c @@ -0,0 +1,253 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley (based on the original by nickg) +// Contributors: nickg, jlarmour, dmoseley +// Date: 2000-08-11 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // Base types +#include // tracing macros +#include // assertion macros + +#include // architectural definitions + +#include // Interrupt handling + +#include // Cache handling + +#include + +#include + +/*------------------------------------------------------------------------*/ +/* LED support */ +cyg_uint8 led_val(CYG_WORD hexdig) +{ + static cyg_uint8 map[] = { + 0x81, // 0 + 0xf3, // 1 + 0x49, // 2 + 0x61, // 3 + 0x33, // 4 + 0x25, // 5 + 0x05, // 6 + 0xf1, // 7 + 0x01, // 8 + 0x21, // 9 + 0x11, // A + 0x07, // B + 0x8d, // C + 0x43, // D + 0x0d, // E + 0x1d // F + }; + return map[(hexdig & 0xF)]; +} + +/*------------------------------------------------------------------------*/ + +#include CYGHWR_MEMORY_LAYOUT_H +#if defined(CYGPKG_CYGMON) +extern unsigned long cygmon_memsize; +#endif + +void hal_platform_init(void) +{ + HAL_WRITE_UINT8(HAL_LED_ADDRESS, led_val(8)); + +#if defined(CYG_HAL_STARTUP_ROM) + // Note that the hardware seems to come up with the + // caches containing random data. Hence they must be + // invalidated before being enabled. + // However, we only do this if we are in ROM. If we are + // in RAM, then we leave the caches in the state chosen + // by the ROM monitor. If we enable them when the monitor + // is not expecting it, we can end up breaking things if the + // monitor is not doing cache flushes. + + HAL_ICACHE_INVALIDATE_ALL(); + HAL_ICACHE_ENABLE(); + HAL_DCACHE_INVALIDATE_ALL(); + HAL_DCACHE_ENABLE(); +#endif + +#if defined(CYGPKG_CYGMON) + cygmon_memsize = 16 * 1024 * 1024 - 0x200; // 16 MB - 0x200 (for _hal_vsr_table and _hal_virtual_vector_table) +#endif + + // Set up eCos/ROM interfaces + hal_if_init(); + +#if defined(CYGPKG_KERNEL) && \ + defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && \ + defined(CYGSEM_HAL_USE_ROM_MONITOR_GDB_stubs) + { + extern CYG_ADDRESS hal_virtual_vector_table[32]; + extern void patch_dbg_syscalls(void * vector); + patch_dbg_syscalls( (void *)(&hal_virtual_vector_table[0]) ); + } +#endif +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + { + static void hal_ctrlc_isr_init(void); + hal_ctrlc_isr_init(); + } +#endif + + // Make sure the TBR points at the base of ROM + { + #define TBR 0xC0000024 + cyg_uint32 TBR_val; + HAL_READ_UINT32(TBR, TBR_val); + TBR_val = (TBR_val & 0x00FFFFFF) | (CYGMEM_REGION_rom & 0xFF000000); + HAL_WRITE_UINT32(TBR, TBR_val); + } + + // Make sure the MTBR points at the base of ROM + { + #define mTBR 0xC0000028 + cyg_uint32 mTBR_val; + HAL_READ_UINT32(mTBR, mTBR_val); + mTBR_val = (mTBR_val & 0x00FFFFFF) | (CYGMEM_REGION_rom & 0xFF000000); + HAL_WRITE_UINT32(mTBR, mTBR_val); + } +} + +/*------------------------------------------------------------------------*/ +/* Functions to support the detection and execution of a user provoked */ +/* program break. These are usually called from interrupt routines. */ + +/*------------------------------------------------------------------------*/ +/* Control C ISR support */ +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +#if CYGHWR_HAL_MN10300_AM33_STB_GDB_PORT == 0 + +// We use serial0 on AM33 +#define SERIAL_CR ((volatile cyg_uint16 *)0xd4002000) +#define SERIAL_ICR ((volatile cyg_uint8 *) 0xd4002004) +#define SERIAL_TXR ((volatile cyg_uint8 *) 0xd4002008) +#define SERIAL_RXR ((volatile cyg_uint8 *) 0xd4002009) +#define SERIAL_SR ((volatile cyg_uint16 *)0xd400200c) + +// Timer 1 provided baud rate divisor +#define TIMER_MD ((volatile cyg_uint8 *)0xd4003000) +#define TIMER_BR ((volatile cyg_uint8 *)0xd4003010) +#define TIMER_CR ((volatile cyg_uint8 *)0xd4003020) + +#define SIO_LSTAT_TRDY 0x20 +#define SIO_LSTAT_RRDY 0x10 + +#else + +#error Unsupported GDB port + +#endif + +struct Hal_SavedRegisters *hal_saved_interrupt_state; + +static void hal_ctrlc_isr_init(void) +{ +// cyg_uint16 cr; + +// HAL_READ_UINT16( SERIAL_CR, cr ); +// cr |= LCR_RXE; +// HAL_WRITE_UINT16( SERIAL_CR, cr ); + HAL_INTERRUPT_SET_LEVEL( CYGHWR_HAL_GDB_PORT_VECTOR, 4 ); + HAL_INTERRUPT_UNMASK( CYGHWR_HAL_GDB_PORT_VECTOR ); +} + +cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + char c; + cyg_uint16 sr; + + HAL_INTERRUPT_ACKNOWLEDGE( CYGHWR_HAL_GDB_PORT_VECTOR ); + + HAL_READ_UINT16( SERIAL_SR, sr ); + + if( sr & SIO_LSTAT_RRDY ) + { + HAL_READ_UINT8( SERIAL_RXR, c); + + if( cyg_hal_is_break( &c , 1 ) ) + cyg_hal_user_break( (CYG_ADDRWORD *)hal_saved_interrupt_state ); + + + } + return 1; +} + +#endif + +void hal_arch_funcall_new_stack(void (*func)(void), void* stack_base, cyg_uint32 stack_size) +{ + register cyg_uint32 stack_top = (cyg_uint32)stack_base + stack_size; + register cyg_uint32 old_stack; + asm volatile (" mov sp, %0" : "=r" (old_stack) : ); + asm volatile (" mov %0, sp" : : "r" (stack_top) ); + func(); + asm volatile (" mov %0, sp" : : "r" (old_stack) ); +} + +/*------------------------------------------------------------------------*/ +/* Syscall support */ +#ifdef CYGPKG_CYGMON +// Cygmon provides syscall handling for this board +#include +int __get_syscall_num (void) +{ + return SIGSYS; +} +#endif + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/packages/hal/mn10300/asb/current/src/plf_stub.c b/packages/hal/mn10300/asb/current/src/plf_stub.c new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/src/plf_stub.c @@ -0,0 +1,168 @@ +//============================================================================= +// +// plf_stub.c +// +// Platform specific code for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley (based on the old mn10300 hal_stub.c) +// Contributors:dmoseley +// Date: 2000-08-11 +// Purpose: Platform specific code for GDB stub support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include // HAL IO macros + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include + +#include // HAL interrupt macros + +//--------------------------------------------------------------------------- + +#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT +// This ISR is called from the interrupt handler. This should only +// happen when there is no serial driver, so the code shouldn't mess +// anything up. +int cyg_hal_gdb_isr(cyg_uint32 vector, target_register_t pc) +{ + if ( CYGNUM_HAL_INTERRUPT_SERIAL_0_RX == vector ) { + cyg_uint8 c; + + HAL_READ_UINT8 (SERIAL0_RXR, c); + HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX); + + if( 3 == c ) + { + // Ctrl-C: set a breakpoint at PC so GDB will display the + // correct program context when stopping rather than the + // interrupt handler. + cyg_hal_gdb_interrupt (pc); + + // Interrupt handled. Don't call ISR proper. At return + // from the VSR, execution will stop at the breakpoint + // just set. + return 0; + } + } + + // Not caused by GDB. Call ISR proper. + return 1; +} + +int hal_asb_interruptible(int state) +{ + if (state) { + HAL_WRITE_UINT8 (SERIAL0_ICR, 0); + HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX) + HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX) + } else { + HAL_INTERRUPT_MASK (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX) + } + return 0; +} + +void hal_asb_init_break_irq( void ) +{ + // Enable serial receive interrupts. + HAL_WRITE_UINT8 (SERIAL0_ICR, 0); + HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX) + HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX) + HAL_ENABLE_INTERRUPTS(); +} +#endif + +//----------------------------------------------------------------------------- + +void hal_asb_platform_init(void) +{ + extern CYG_ADDRESS hal_virtual_vector_table[64]; + extern void init_thread_syscall( void *); + extern void install_async_breakpoint(void *epc); +// void (*oldvsr)(void); + extern void _default_trap_vsr(void); + + // Ensure that the breakpoint VSR points to the default VSR. This will pass + // it on to the stubs. +// HAL_VSR_SET( CYGNUM_HAL_VECTOR_BREAKPOINT, _default_trap_vsr, &oldvsr ); + + // Install async breakpoint handler into vector table. + hal_virtual_vector_table[35] = (CYG_ADDRESS)install_async_breakpoint; + +#if !defined(CYGPKG_KERNEL) && defined(CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT) + // Only include this code if we do not have a kernel. Otherwise + // the kernel supplies the functionality for the app we are linked + // with. + + // Prepare for application installation of thread info function in + // vector table. + hal_virtual_vector_table[15] = 0; + init_thread_syscall( (void *)&hal_virtual_vector_table[15] ); + +#endif +} +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +/*------------------------------------------------------------------------*/ +/* Reset support */ + +#define RSTCTR 0xc0001004 +#define CHIPRST 0x01 +void hal_asb_reset(void) +{ + // Unfortunately this only resets the MN103E010 + // A full board reset is not done. ie If the boot block select switched, + // and a Cygmon reset called the switch change will not occur. AFAICT + // the only way to notice that change is to use the Reset switch on the + // board. + HAL_WRITE_UINT8(RSTCTR, 0x00); + HAL_WRITE_UINT8(RSTCTR, CHIPRST); + + // Just in case. + while (1) ; +} + + +//----------------------------------------------------------------------------- +// End of plf_stub.c diff --git a/packages/hal/mn10300/asb/current/src/ser_asb.c b/packages/hal/mn10300/asb/current/src/ser_asb.c new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb/current/src/ser_asb.c @@ -0,0 +1,596 @@ +//============================================================================= +// +// ser_asb.c +// +// Simple driver for the serial controllers on the AM33 ASB303 board +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley +// Contributors:dmoseley +// Date: 2000-08-11 +// Description: Simple driver for the 16c550c serial controller +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interface API +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // Helper functions +#include // CYG_ISR_HANDLED + +//----------------------------------------------------------------------------- +// Base Registers +#define ASB2303_SER0_BASE 0xD4002000 +#define ASB2303_SER1_BASE 0xD4002010 + +/*---------------------------------------------------------------------------*/ +// MN10300 Serial line + +#define _SERIAL_CR 0x00 +#define _SERIAL_ICR 0x04 +#define _SERIAL_TXR 0x08 +#define _SERIAL_RXR 0x09 +#define _SERIAL_SR 0x0c + +#define SERIAL0_CR ((volatile cyg_uint16 *)(ASB2303_SER0_BASE + _SERIAL_CR)) +#define SERIAL0_ICR ((volatile cyg_uint8 *) (ASB2303_SER0_BASE + _SERIAL_ICR)) +#define SERIAL0_TXR ((volatile cyg_uint8 *) (ASB2303_SER0_BASE + _SERIAL_TXR)) +#define SERIAL0_RXR ((volatile cyg_uint8 *) (ASB2303_SER0_BASE + _SERIAL_RXR)) +#define SERIAL0_SR ((volatile cyg_uint16 *)(ASB2303_SER0_BASE + _SERIAL_SR)) + +#define SERIAL1_CR ((volatile cyg_uint16 *)(ASB2303_SER1_BASE + _SERIAL_CR)) +#define SERIAL1_ICR ((volatile cyg_uint8 *) (ASB2303_SER1_BASE + _SERIAL_ICR)) +#define SERIAL1_TXR ((volatile cyg_uint8 *) (ASB2303_SER1_BASE + _SERIAL_TXR)) +#define SERIAL1_RXR ((volatile cyg_uint8 *) (ASB2303_SER1_BASE + _SERIAL_RXR)) +#define SERIAL1_SR ((volatile cyg_uint16 *)(ASB2303_SER1_BASE + _SERIAL_SR)) + +// Timer 0 provides a prescaler for lower baud rates +#define TIMER0_MD ((volatile cyg_uint8 *)0xd4003000) +#define TIMER0_BR ((volatile cyg_uint8 *)0xd4003010) + +// Timer 2 provides baud rate divisor +#define TIMER2_MD ((volatile cyg_uint8 *)0xd4003002) +#define TIMER2_BR ((volatile cyg_uint8 *)0xd4003012) + +// Timer 1 provides a prescaler for lower baud rates +#define TIMER1_MD ((volatile cyg_uint8 *)0xd4003001) +#define TIMER1_BR ((volatile cyg_uint8 *)0xd4003011) + +// Timer 3 provides baud rate divisor +#define TIMER3_MD ((volatile cyg_uint8 *)0xd4003003) +#define TIMER3_BR ((volatile cyg_uint8 *)0xd4003013) + +#define SIO_LSTAT_TRDY 0x20 +#define SIO_LSTAT_RRDY 0x10 + +#define SIO_INT_ENABLE 0x11 + +// These values are calculated based on the MN103E010 LSI Manual +#define PRESCALAR_BASE_1200 198 +#define PRESCALAR_BASE_2400 198 +#define PRESCALAR_BASE_4800 198 +#define PRESCALAR_BASE_9600 198 +#define PRESCALAR_BASE_96002 198 +#define PRESCALAR_BASE_14400 66 +#define PRESCALAR_BASE_19200 0 +#define PRESCALAR_BASE_38400 0 +#define PRESCALAR_BASE_56000 0 +#define PRESCALAR_BASE_57600 0 +#define PRESCALAR_BASE_115200 0 +#define PRESCALAR_BASE_230400 0 + +#define TIMER_BASE_1200 15 +#define TIMER_BASE_2400 7 +#define TIMER_BASE_4800 3 +#define TIMER_BASE_9600 1 +#define TIMER_BASE_96002 2 +#define TIMER_BASE_14400 3 +#define TIMER_BASE_19200 198 +#define TIMER_BASE_38400 99 +#define TIMER_BASE_56000 68 +#define TIMER_BASE_57600 66 +#define TIMER_BASE_115200 33 +#define TIMER_BASE_230400 16 + +#define TMR_ENABLE 0x80 +#define TMR_SRC_IOCLOCK 0x00 +#define TMR_SRC_TMR0_UNDERFLOW 0x04 + +#define PRESCALAR_MODE_1200 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define PRESCALAR_MODE_2400 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define PRESCALAR_MODE_4800 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define PRESCALAR_MODE_9600 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define PRESCALAR_MODE_96002 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define PRESCALAR_MODE_14400 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define PRESCALAR_MODE_19200 0 +#define PRESCALAR_MODE_38400 0 +#define PRESCALAR_MODE_56000 0 +#define PRESCALAR_MODE_57600 0 +#define PRESCALAR_MODE_115200 0 +#define PRESCALAR_MODE_230400 0 + +#define TIMER_MODE_1200 (TMR_ENABLE | TMR_SRC_TMR0_UNDERFLOW) +#define TIMER_MODE_2400 (TMR_ENABLE | TMR_SRC_TMR0_UNDERFLOW) +#define TIMER_MODE_4800 (TMR_ENABLE | TMR_SRC_TMR0_UNDERFLOW) +#define TIMER_MODE_9600 (TMR_ENABLE | TMR_SRC_TMR0_UNDERFLOW) +#define TIMER_MODE_96002 (TMR_ENABLE | TMR_SRC_TMR0_UNDERFLOW) +#define TIMER_MODE_14400 (TMR_ENABLE | TMR_SRC_TMR0_UNDERFLOW) +#define TIMER_MODE_19200 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define TIMER_MODE_38400 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define TIMER_MODE_56000 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define TIMER_MODE_57600 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define TIMER_MODE_115200 (TMR_ENABLE | TMR_SRC_IOCLOCK) +#define TIMER_MODE_230400 (TMR_ENABLE | TMR_SRC_IOCLOCK) + +#define BAUD_CASE(num) \ + case num: \ + prescalar_base_value = PRESCALAR_BASE_ ## num; \ + prescalar_mode_value = PRESCALAR_MODE_ ## num; \ + timer_base_value = TIMER_BASE_ ## num; \ + timer_mode_value = TIMER_MODE_ ## num; \ + break; + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +static const channel_data_t channels[2] = { + { (cyg_uint8*)ASB2303_SER1_BASE, 1000, CYGNUM_HAL_INTERRUPT_SERIAL_1_RX }, + { (cyg_uint8*)ASB2303_SER0_BASE, 1000, CYGNUM_HAL_INTERRUPT_SERIAL_0_RX }, +}; + +//----------------------------------------------------------------------------- +// Set the baud rate + +static int +cyg_hal_plf_serial_set_baud(cyg_uint8* port, cyg_uint32 baud_rate) +{ + volatile cyg_uint8 *prescalar_base_reg = 0, prescalar_base_value = 0; + volatile cyg_uint8 *prescalar_mode_reg = 0, prescalar_mode_value = 0; + volatile cyg_uint8 *timer_base_reg = 0, timer_base_value = 0; + volatile cyg_uint8 *timer_mode_reg = 0, timer_mode_value = 0; + + // Always use TMR0 as the prescalar + prescalar_base_reg = TIMER0_BR; + prescalar_mode_reg = TIMER0_MD; + + if (port == (cyg_uint8*)ASB2303_SER0_BASE) + { + // SER0 uses TMR2 + timer_base_reg = TIMER2_BR; + timer_mode_reg = TIMER2_MD; + } else if (port == (cyg_uint8*)ASB2303_SER1_BASE) { + // SER1 uses TMR3 + timer_base_reg = TIMER3_BR; + timer_mode_reg = TIMER3_MD; + } else { + // Unknown port. + return -1; + } + + switch (baud_rate) + { + BAUD_CASE(1200); + BAUD_CASE(2400); + BAUD_CASE(4800); + BAUD_CASE(9600); + BAUD_CASE(96002); + BAUD_CASE(14400); + BAUD_CASE(19200); + BAUD_CASE(38400); + BAUD_CASE(56000); + BAUD_CASE(57600); + BAUD_CASE(115200); + BAUD_CASE(230400); + + default: + // Unknown baud. Don't change anything + return -1; + } + + HAL_WRITE_UINT8(prescalar_base_reg, prescalar_base_value); + HAL_WRITE_UINT8(prescalar_mode_reg, prescalar_mode_value); + HAL_WRITE_UINT8(timer_base_reg, timer_base_value); + HAL_WRITE_UINT8(timer_mode_reg, timer_mode_value); + + return 0; +} + +//----------------------------------------------------------------------------- +// The minimal init, get and put functions. All by polling. + +void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + cyg_uint8* port; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + // No interrupts for now. + HAL_WRITE_UINT8(port + _SERIAL_ICR, 0x00); + + // Source from timer 2 or 3, 8bit chars, enable tx and rx + HAL_WRITE_UINT16(port + _SERIAL_CR, 0xc085); +} + +void +cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 __ch) +{ + cyg_uint8* port; + cyg_uint16 _status; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + do { + HAL_READ_UINT16(port + _SERIAL_SR, _status); + } while ((_status & SIO_LSTAT_TRDY) != 0); + + HAL_WRITE_UINT8(port + _SERIAL_TXR, __ch); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* port; + cyg_uint8 _status; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + HAL_READ_UINT8(port + _SERIAL_SR, _status); + if ((_status & SIO_LSTAT_RRDY) == 0) + return false; + + HAL_READ_UINT8(port + _SERIAL_RXR, *ch); + + // We must ack the interrupt caused by that read to avoid + // confusing the GDB stub ROM. + HAL_INTERRUPT_ACKNOWLEDGE( CYGNUM_HAL_INTERRUPT_SERIAL_0_RX ); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +#if 0 +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} +#endif + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan; + cyg_uint8 icr; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + HAL_READ_UINT8(chan->base + _SERIAL_ICR, icr); + icr |= SIO_INT_ENABLE; + HAL_WRITE_UINT8(chan->base + _SERIAL_ICR, icr); + + HAL_INTERRUPT_SET_LEVEL(chan->isr_vector, 1); + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + HAL_READ_UINT8(chan->base + _SERIAL_ICR, icr); + icr &= ~SIO_INT_ENABLE; + HAL_WRITE_UINT8(chan->base + _SERIAL_ICR, icr); + + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + break; + + case __COMMCTL_SETBAUD: + { + cyg_uint32 baud_rate; + cyg_uint8* port = chan->base; + va_list ap; + + va_start(ap, __func); + baud_rate = va_arg(ap, cyg_uint32); + va_end(ap); + + // Disable port interrupts while changing hardware + HAL_READ_UINT8(port + _SERIAL_ICR, icr); + HAL_WRITE_UINT8(port + _SERIAL_ICR, 0); + + // Set baud rate. + ret = cyg_hal_plf_serial_set_baud(port, baud_rate); + + // Reenable interrupts if necessary + HAL_WRITE_UINT8(port + _SERIAL_ICR, icr); + } + break; + + case __COMMCTL_GETBAUD: + break; + + default: + break; + } + + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + channel_data_t* chan; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + HAL_INTERRUPT_ACKNOWLEDGE(chan->isr_vector); + +#if 0 + HAL_READ_UINT8(chan->base + SER_16550_IIR, _iir); + _iir &= SIO_IIR_ID_MASK; + + *__ctrlc = 0; + if ((_iir == ISR_Rx_Avail) || (_iir == ISR_Rx_Char_Timeout)) { + + HAL_READ_UINT8(chan->base + SER_16550_RBR, c); + + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } +#endif + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(channels[0].isr_vector); + HAL_INTERRUPT_MASK(channels[1].isr_vector); + + // Init channels + cyg_hal_plf_serial_init_channel((void*)&channels[0]); + cyg_hal_plf_serial_set_baud(channels[0].base, CYGHWR_HAL_MN10300_AM33_ASB_DIAG_BAUD); + + cyg_hal_plf_serial_init_channel((void*)&channels[1]); + cyg_hal_plf_serial_set_baud(channels[1].base, CYGHWR_HAL_MN10300_AM33_ASB_GDB_BAUD); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); +#if 0 + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); +#endif + + // Set channel 1 + CYGACC_CALL_IF_SET_CONSOLE_COMM(1); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[1]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); +#if 0 + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); +#endif + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +void +cyg_hal_plf_serial_setbaud(void *__ch_data, cyg_uint32 baud_rate) +{ + cyg_uint8* port; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + cyg_hal_plf_serial_set_baud(port, baud_rate); +} + +/*---------------------------------------------------------------------------*/ +/* End of ser_asb.c */ diff --git a/packages/hal/mn10300/asb2305/current/ChangeLog b/packages/hal/mn10300/asb2305/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/ChangeLog @@ -0,0 +1,87 @@ +2001-10-18 David Howells + + * cdl/hal_mn10300_am33_asb2305.cdl: change incorrect "BootFlash" + to "BootPROM" where specified. + + * cdl/hal_mn10300_am33_asb2305.cdl: added support for booting + directly from the system flash. + * include/platform.inc: ditto. + * include/pkgconf/mlt_mn10300_am33_asb2305_flash.mlt: ditto. + * include/pkgconf/mlt_mn10300_am33_asb2305_flash.h: ditto. + * include/pkgconf/mlt_mn10300_am33_asb2305_flash.ldi: ditto. + * misc/redboot_FLASH.ecm: ditto. + +2001-10-16 David Howells + + * include/plf_io.h: made the CPU access PCI registers through the + uncached memmap reflection. + * cdl/hal_mn10300_am33_asb2305.cdl: moved the RTC configuration + previously added to MN10300 arch to the ASB2305 platform. + * include/platform.inc: display exception code on entry to NMI + handler and clear it on exit. + +2001-10-15 David Howells + + * misc/redboot_RAM.ecm: forced ethernet to switch down to 10Mbps + and switched syscall support on. + * misc/redboot_ROM.ecm: ditto. + + * include/platform.inc: improved LED driving upon exception. + * src/plf_misc.c: ditto. + + * include/pkgconf/mlt_mn10300_am33_asb2305_ram.mlt: PCI window moved. + * include/pkgconf/mlt_mn10300_am33_asb2305_ram.h: ditto. + * include/pkgconf/mlt_mn10300_am33_asb2305_ram.ldi: ditto. + * include/pkgconf/mlt_mn10300_am33_asb2305_rom.mlt: ditto. + * include/pkgconf/mlt_mn10300_am33_asb2305_rom.h: ditto. + * include/pkgconf/mlt_mn10300_am33_asb2305_rom.ldi: ditto. + +2001-08-22 Gary Thomas + + * src/redboot_cmds.c: + printf() is no longer a part of RedBoot. Thus all programs + must use diag_printf() and related functions instead. + +2001-08-08 David Howells + + * hal_mn10300_am33_asb2305.cdl: Generate binary RedBoot image + files as well as ELF ones. + +2001-07-27 David Howells + + * New platform inaugurated. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/mn10300/asb2305/current/cdl/hal_mn10300_am33_asb2305.cdl b/packages/hal/mn10300/asb2305/current/cdl/hal_mn10300_am33_asb2305.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/cdl/hal_mn10300_am33_asb2305.cdl @@ -0,0 +1,393 @@ +# ==================================================================== +# +# hal_mn10300_am33_asb2305.cdl +# +# AM33-2/ASB2305 board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): dhowells +# Original data: dmoseley. nick, bartv +# Contributors: +# Date: 2001-05-17 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_MN10300_AM33_ASB2305 { + display "Panasonic ASB2305 Evaluation Board" + parent CYGPKG_HAL_MN10300 + requires CYGPKG_HAL_MN10300_AM33 + requires { CYGHWR_HAL_MN10300_AM33_REVISION == 2 } + define_header hal_mn10300_am33_asb2305.h + include_dir cyg/hal + description " + The ASB2305 HAL package should be used when targetting the + actual hardware for the Panasonic ASB2305 Evaluation Board + with the MN103E010 microcontroller." + + compile hal_diag.c plf_stub.c plf_misc.c ser_asb.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + + requires CYGSEM_HAL_UNCACHED_FLASH_ACCESS == 1; + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_system_header "#define HAL_PLATFORM_BOARD \"Panasonic ASB2305\"" + puts $::cdl_system_header "#define HAL_PLATFORM_EXTRA \"\"" + puts $::cdl_system_header "#define HAL_PLATFORM_CPU \"MN103E010 AM33/2.0\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM"} + default_value {"ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + This determines whether the stored .data section will need copying + to RAM before it can be used." + } + + cdl_component CYG_HAL_ROM_SLOT { + display "ROM slot in which residing" + flavor data + legal_values {"BootPROM" "SysFlash"} + default_value {"BootPROM"} + no_define + define -file system.h CYG_HAL_ROM_SLOT + description " + This specifies which ROM slot the program resides in (and is booted + from." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants." + description " + The NUMERATOR divided by the DENOMINATOR gives the number of + nanoseconds per tick. The PERIOD is the divider to be programmed + into a hardware timer that is driven from an appropriate hardware + clock, such that the timer overflows once per tick (normally + generating a CPU interrupt to mark the end of a tick). The tick + rate is typically 100Hz. + The clock is generated with onboard 16-bit timers TM4 and TM5 + cascaded together to form a 32-bit timer." + flavor none + + cdl_option CYGHWR_HAL_MN10300_IOCLK_SPEED { + display "Processor I/O clock speed (Hz)" + flavor data + calculated (25 * 1000 * 1000) + description " + The processor I/O clock speed, from which onboard timers can + draw their sources." + } + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated (1000 * 1000 * 1000) + } + + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock divisor" + flavor data + calculated (CYGHWR_HAL_MN10300_IOCLK_SPEED * CYGNUM_HAL_RTC_NUMERATOR) / (1000000000 * CYGNUM_HAL_RTC_DENOMINATOR) + } + } + + cdl_option CYGHWR_HAL_MN10300_AM33_ASB_DIAG_PORT { + display "Diagnostic Serial Port" + flavor data + legal_values 0 1 + default_value 0 + description " + The ASB2305 board has two serial ports. This option + chooses which of these ports will be used for diagnostic output. + At present only port 0 is supported." + } + + cdl_option CYGHWR_HAL_MN10300_AM33_ASB_DIAG_BAUD { + display "Diagnostic Serial Port Baud Rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic port. + Note: this should match the value chosen for the GDB port if the + diagnostic and GDB port are the same." + } + + cdl_option CYGHWR_HAL_MN10300_AM33_ASB_GDB_PORT { + display "GDB Serial Port" + flavor data + legal_values 0 1 + default_value 0 + description " + The ASB2305 board has two separate serial ports. This option + chooses which of these ports will be used to connect to a host + running GDB. + At present only port 0 is supported." + } + + cdl_option CYGHWR_HAL_MN10300_AM33_ASB_GDB_BAUD { + display "GDB Serial Port Baud Rate" + flavor data + legal_values 9600 19200 38400 115200 + default_value 38400 + description " + This option controls the baud rate used for the GDB connection." + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "mn10300-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mam33-2 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -Wp,-Wno-paste -g -O2 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-mam33 -g -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_option CYGNUM_HAL_BREAKPOINT_LIST_SIZE { + display "Number of breakpoints supported by the HAL." + flavor data + default_value 25 + description " + This option determines the number of breakpoints supported by the HAL." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The ASB2305 board has two serial ports. Currently, + only the first serial port is supported. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The ASB2305 board has two serial ports. Currently, + only the first serial port is supported. This option + chooses which port will be used for diagnostic output." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baudrates" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + The ASB2305 debug serial port baud rate setting." + } + + cdl_option CYGSEM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_RTSCTS { + display "Diagnostic serial port RTS/CTS flow control" + flavor bool + default_value 0 + description " + The ASB2305 debug serial port RTS/CTS flow control setting." + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "mn10300_am33_asb2305_ram" : \ + CYG_HAL_ROM_SLOT == "BootPROM" ? "mn10300_am33_asb2305_rom" : \ + "mn10300_am33_asb2305_flash" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_ROM_SLOT == "BootPROM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_ROM_SLOT == "BootPROM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for boot ROMs or ROM monitors which contain + GDB stubs. This support changes various eCos semantics such as + the encoding of diagnostic output, and the overriding of hardware + interrupt vectors." + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 1 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + compile -library=libextras.a redboot_cmds.c + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) -O binary $< $@ + } + } + } +} diff --git a/packages/hal/mn10300/asb2305/current/include/hal_diag.h b/packages/hal/mn10300/asb2305/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/hal_diag.h @@ -0,0 +1,92 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +//============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov, nickg, dmoseley +// Date: 2000-08-11 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +#else // everything by steam + +//----------------------------------------------------------------------------- +// functions implemented in hal_diag.c + +externC void hal_diag_init(void); + +externC void hal_diag_write_char(char c); + +externC void hal_diag_read_char(char *c); + +//----------------------------------------------------------------------------- + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +//----------------------------------------------------------------------------- +// end of hal_diag.h +#endif // CYGONCE_HAL_HAL_DIAG_H diff --git a/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_flash.h b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_flash.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_flash.h @@ -0,0 +1,25 @@ +// eCos memory layout - Fri Oct 20 08:28:05 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_rom (0x84000000) +#define CYGMEM_REGION_rom_SIZE (0x1000000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#define CYGMEM_REGION_ram (0x90000000) +#define CYGMEM_REGION_ram_SIZE (0x04000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x94000000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x80000) diff --git a/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_flash.ldi b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_flash.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_flash.ldi @@ -0,0 +1,33 @@ +// eCos memory layout - Fri Oct 20 08:28:05 2000 -*- c -*- + +// This is a generated file - do not edit + +#include + +MEMORY +{ + rom : ORIGIN = 0x84000000, LENGTH = 0x01000000 + ram : ORIGIN = 0x90000000, LENGTH = 0x04000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x84000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, 0x90000000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x9C000000; . = CYG_LABEL_DEFN(__pci_window) + 0x80000; + SECTIONS_END +} + +#define CYG_HAL_PLATFORM_HAL_VSR_TABLE_DEFINED + +_hal_vsr_table = 0x8C000000; +_hal_virtual_vector_table = 0x8C000100; diff --git a/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_flash.mlt b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_flash.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_flash.mlt @@ -0,0 +1,14 @@ +version 0 +region rom 84000000 1000000 1 ! +region ram 90000000 4000000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 84000000 84000000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 0 0 1 data ! +section data 0 1 1 1 1 1 0 0 90000000 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 80000 1 0 0 1 0 1 0 9c000000 9c000000 ! diff --git a/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_ram.h b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_ram.h @@ -0,0 +1,22 @@ +// eCos memory layout - Fri Oct 20 08:28:43 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x90000000) +#define CYGMEM_REGION_ram_SIZE (0x04000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x94000000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x80000) diff --git a/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_ram.ldi b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_ram.ldi @@ -0,0 +1,32 @@ +// eCos memory layout - Fri Oct 20 08:28:43 2000 -*- c -*- + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x90000000, LENGTH = 0x04000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x90000000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x9C000000; . = CYG_LABEL_DEFN(__pci_window) + 0x80000; + SECTIONS_END +} + +#define CYG_HAL_PLATFORM_HAL_VSR_TABLE_DEFINED + +_hal_vsr_table = 0x8C000000; +_hal_virtual_vector_table = 0x8C000100; diff --git a/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_ram.mlt b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_ram.mlt @@ -0,0 +1,13 @@ +version 0 +region ram 90000000 4000000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 90000000 90000000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 80000 1 0 0 1 0 1 0 9c000000 9c000000 ! diff --git a/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_rom.h b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_rom.h @@ -0,0 +1,25 @@ +// eCos memory layout - Fri Oct 20 08:28:05 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_rom (0x80000000) +#define CYGMEM_REGION_rom_SIZE (0x400000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#define CYGMEM_REGION_ram (0x90000000) +#define CYGMEM_REGION_ram_SIZE (0x04000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x94000000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x80000) diff --git a/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_rom.ldi b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_rom.ldi @@ -0,0 +1,33 @@ +// eCos memory layout - Fri Oct 20 08:28:05 2000 -*- c -*- + +// This is a generated file - do not edit + +#include + +MEMORY +{ + rom : ORIGIN = 0x80000000, LENGTH = 0x00400000 + ram : ORIGIN = 0x90000000, LENGTH = 0x04000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x80000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, 0x90000000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x9C000000; . = CYG_LABEL_DEFN(__pci_window) + 0x80000; + SECTIONS_END +} + +#define CYG_HAL_PLATFORM_HAL_VSR_TABLE_DEFINED + +_hal_vsr_table = 0x8C000000; +_hal_virtual_vector_table = 0x8C000100; diff --git a/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_rom.mlt b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/pkgconf/mlt_mn10300_am33_asb2305_rom.mlt @@ -0,0 +1,14 @@ +version 0 +region rom 80000000 400000 1 ! +region ram 90000000 4000000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 80000000 80000000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 0 0 1 data ! +section data 0 1 1 1 1 1 0 0 90000000 bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 80000 1 0 0 1 0 1 0 9c000000 9c000000 ! diff --git a/packages/hal/mn10300/asb2305/current/include/platform.inc b/packages/hal/mn10300/asb2305/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/platform.inc @@ -0,0 +1,452 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## ASB2305 board assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): dhowells +## Contributors:dmoseley +## Date: 2001-05-17 +## Purpose: ASB2305 board definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the ASB2305 board. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#------------------------------------------------------------------------------ +# Diagnostics macros. + +#include + + .macro hal_diag_data +hal_diag_intr_count: .long 0 + .endm + +#define HAL_EARLY_INIT hal_early_init +.macro hal_early_init + # turn on the sofware status LED + movbu (0xDB000008),d0 + or 0x80,d0 + movbu d0,(0xDB000008) + movhu (0xDB000000),d0 + and 0x3FFF,d0 + or 0x4000,d0 + movhu d0,(0xDB000000) + + # enable system flash memory write + movbu (0xDB000008),d0 + and 0xdf,d0 + movbu d0,(0xDB000008) + movhu (0xDB000000),d0 + and 0xF3FF,d0 + or 0x0400,d0 + movhu d0,(0xDB000000) + +.endm + + .macro hal_diag_init + mov 0x5f17ff7f,d0 # 'rh -' + mov d0,(_hal_led_old_display) + mov d0,(HAL_LED_ADDRESS) + .endm + +#define CYGPKG_HAL_MN10300_DIAG_DEFINED + + .macro hal_handle_unknown_int + mov _hal_diag_digits,a2 + mov (0xC0000024),d0 // Get TBR + mov 0x6D00,d1 // 7-seg LED: =ABC + mov d0,d2 // 0xnnnnnAnn + lsr 8,d2 + and 0xf,d2 + movbu (a2,d2),d2 + or d2,d1 + asl 8,d1 + mov d0,d2 // 0xnnnnnnBn + lsr 4,d2 + and 0xf,d2 + movbu (a2,d2),d2 + or d2,d1 + asl 8,d1 + and 0xf,d0 // 0xnnnnnnnC + movbu (a2,d0),d2 + or d2,d1 + mov (_hal_led_old_display),d0 + and 0x00010000,d0 + or d1,d0 + mov d0,(_hal_led_old_display) + mov d0,(HAL_LED_ADDRESS) + .endm + +#define CYG_HAL_HANDLE_UNKNOWN_INT_DEFINED + + .macro hal_diag_excpt_start + hal_handle_unknown_int + .endm + + .macro hal_diag_excpt_end + mov 0x5f17ff01,d0 + mov d0,(_hal_led_old_display) + mov d0,(HAL_LED_ADDRESS) + .endm +#define CYG_HAL_DIAG_EXCPT_END + + .macro hal_diag_intr_start + mov (hal_diag_intr_count),d1 + inc d1 + cmp 100,d1 + bne x\@ + clr d1 + mov (_hal_led_old_display),d0 + xor 0x00010000,d0 + mov d0,(_hal_led_old_display) + mov d0,(HAL_LED_ADDRESS) +x\@: + mov d1,(hal_diag_intr_count) + .endm + + .macro hal_diag_restore + .endm + + .macro hal_diag_led val + movm [d2,d3,a2],(sp) +0: mov _hal_diag_digits,a2 + mov \val,d2 + and 0xf,d2 + add d2,a2 + movbu (a2),d3 + mov (_hal_led_old_display),d2 + asl 8,d2 + or d3,d2 + mov d2,(HAL_LED_ADDRESS) + mov d2,(_hal_led_old_display) + movm (sp),[d2,d3,a2] + .endm + + .macro hal_cpu_stop +// mov 0x10,d0 +// movhu d0,(0xC0000040) // enter STOP mode (register CPUM) + .endm +#define CYG_HAL_CPU_STOP_DEFINED + +#------------------------------------------------------------------------------ +# MEMC macros. + +#ifndef CYGPKG_HAL_MN10300_MEMC_DEFINED + +// These settings follow the recommended settings in the +// "MN103E010 Evaluation Board User's Guide" + +#define BCCR 0xC0002000 +#define BCCR_INIT 0x12040580 + +#define SBBASE0 0xD8C00100 +#define SBBASE0_INIT_SYSFL 0x8000FE01 +#define SBBASE0_INIT_BPROM 0x8400FE01 +#define SBBASE1 0xD8C00110 +#define SBBASE1_INIT_SYSFL 0x8400FE01 +#define SBBASE1_INIT_BPROM 0x8000FE01 +#define SBBASE2 0xD8C00120 +#define SBBASE2_INIT 0x8600FF81 +#define SBBASE3 0xD8C00130 +#define SBBASE3_INIT 0x8680FF81 +#define SBBASE4 0xD8C00140 +#define SBBASE4_INIT 0x9800F801 +#define SBBASE5 0xD8C00150 +#define SBBASE5_INIT 0x00000000 +#define SBBASE6 0xD8C00160 +#define SBBASE6_INIT 0x00000000 +#define SBBASE7 0xD8C00170 +#define SBBASE7_INIT 0x00000000 + +#define SBCTRL00 0xD8C00200 +#define SBCTRL00_INIT 0x21111000 +#define SBCTRL10 0xD8C00210 +#define SBCTRL10_INIT 0x21111000 +#define SBCTRL20 0xD8C00220 +#define SBCTRL20_INIT 0x21111000 +#define SBCTRL30 0xD8C00230 +#define SBCTRL30_INIT 0x21111000 +#define SBCTRL40 0xD8C00240 +#define SBCTRL40_INIT 0x00140000 +#define SBCTRL50 0xD8C00250 +#define SBCTRL50_INIT 0x22100000 +#define SBCTRL60 0xD8C00260 +#define SBCTRL60_INIT 0x22100000 +#define SBCTRL70 0xD8C00270 +#define SBCTRL70_INIT 0x22100000 + +#define SBCTRL01 0xD8C00204 +#define SBCTRL01_INIT 0x00100200 +#define SBCTRL11 0xD8C00214 +#define SBCTRL11_INIT 0x00100200 +#define SBCTRL21 0xD8C00224 +#define SBCTRL21_INIT 0x00100200 +#define SBCTRL31 0xD8C00234 +#define SBCTRL31_INIT 0x00100200 +#define SBCTRL41 0xD8C00244 +#define SBCTRL41_INIT 0x11011100 +#define SBCTRL51 0xD8C00254 +#define SBCTRL51_INIT 0x00001100 +#define SBCTRL61 0xD8C00264 +#define SBCTRL61_INIT 0x00001100 +#define SBCTRL71 0xD8C00274 +#define SBCTRL71_INIT 0x00001100 + +#define SBCTRL02 0xD8C00208 +#define SBCTRL02_INIT 0x00000004 +#define SBCTRL12 0xD8C00218 +#define SBCTRL12_INIT 0x04000004 +#define SBCTRL22 0xD8C00228 +#define SBCTRL22_INIT 0x00000004 +#define SBCTRL32 0xD8C00238 +#define SBCTRL32_INIT 0x00000004 +#define SBCTRL42 0xD8C00248 +#define SBCTRL42_INIT 0x01000001 +#define SBCTRL52 0xD8C00258 +#define SBCTRL52_INIT 0x0000000F +#define SBCTRL62 0xD8C00268 +#define SBCTRL62_INIT 0x0000000F +#define SBCTRL72 0xD8C00278 +#define SBCTRL72_INIT 0x0000000F + +#define SDBASE0 0xDA000008 +#define SDBASE0_INIT 0x9000FE01 +#define SDBASE1 0xDA00000C +#define SDBASE1_INIT 0x9200FE01 +#define SDRAMBUS 0xDA000000 +#define SDRAMBUS_INIT 0xA8990654 + + .macro hal_memc_init + mov BCCR,a0 + mov BCCR_INIT,d0 + mov d0,(a0) + + // reduce the span of the ROM banks first + mov (SBBASE0),d0 + btst 1,d0 + beq 0f + mov 0x8000FE01,d0 + mov d0,(SBBASE0) +0: + mov (SBBASE1),d0 + btst 1,d0 + beq 0f + mov 0x8000FE01,d0 + mov d0,(SBBASE1) +0: + + // memory bank 2 + mov SBBASE2_INIT,d0 + mov d0,(SBBASE2) + mov SBCTRL20_INIT,d0 + mov d0,(SBCTRL20) + mov SBCTRL21_INIT,d0 + mov d0,(SBCTRL21) + mov SBCTRL22_INIT,d0 + mov d0,(SBCTRL22) + + // memory bank 3 + mov SBBASE3_INIT,d0 + mov d0,(SBBASE3) + mov SBCTRL30_INIT,d0 + mov d0,(SBCTRL30) + mov SBCTRL31_INIT,d0 + mov d0,(SBCTRL31) + mov SBCTRL32_INIT,d0 + mov d0,(SBCTRL32) + + // memory bank 4 + mov SBBASE4_INIT,d0 + mov d0,(SBBASE4) + mov SBCTRL40_INIT,d0 + mov d0,(SBCTRL40) + mov SBCTRL41_INIT,d0 + mov d0,(SBCTRL41) + mov SBCTRL42_INIT,d0 + mov d0,(SBCTRL42) + + // memory bank 5 +#if SBBASE5_INIT != 0 + mov SBBASE5_INIT,d0 + mov d0,(SBBASE5) + mov SBCTRL50_INIT,d0 + mov d0,(SBCTRL50) + mov SBCTRL51_INIT,d0 + mov d0,(SBCTRL51) + mov SBCTRL52_INIT,d0 + mov d0,(SBCTRL52) +#endif + + // memory bank 6 +#if SBBASE6_INIT != 0 + mov SBBASE6_INIT,d0 + mov d0,(SBBASE6) + mov SBCTRL60_INIT,d0 + mov d0,(SBCTRL60) + mov SBCTRL61_INIT,d0 + mov d0,(SBCTRL61) + mov SBCTRL62_INIT,d0 + mov d0,(SBCTRL62) +#endif + + // memory bank 7 +#if SBBASE7_INIT != 0 + mov SBBASE7_INIT,d0 + mov d0,(SBBASE7) + mov SBCTRL70_INIT,d0 + mov d0,(SBCTRL70) + mov SBCTRL71_INIT,d0 + mov d0,(SBCTRL71) + mov SBCTRL72_INIT,d0 + mov d0,(SBCTRL72) +#endif + + # SDRAM + mov SDBASE0,a0 + mov SDBASE0_INIT,d0 + mov d0,(a0) + + mov SDBASE1,a0 + mov SDBASE1_INIT,d0 + mov d0,(a0) + + mov SDRAMBUS,a0 + mov SDRAMBUS_INIT,d0 + mov d0,(a0) + + // now the ROMs need putting into the right place + // - this is tricky because when we're booting from the system flash, + // it has had its base address pre-swapped by the CPU + // - we need to copy a small piece of code to the SRAM and execute it + // there + + // display on the LEDs + mov 0x7e7e7e7e,d0 # '-.-.-.-.' + mov d0,(HAL_LED_ADDRESS) + + // copy the ROM address adjustor to the SRAM + add -4,sp + call __hal_plf_base_ref,[],0 // note we can't address ourselves directly yet +__hal_plf_base_ref: + movm (sp),[a3] + mov a3,a0 + add __hal_plf_rom_swap_start-__hal_plf_base_ref,a0 + add __hal_plf_rom_swap_end-__hal_plf_base_ref,a3 + mov 0x8C000000,a1 +0: movbu (a0),d0 + movbu d0,(a1) + inc a0 + inc a1 + cmp a0,a3 + bcc 0b + mov 0x8C000000,a1 + jmp (a1) + + //////////////////////////////////////////////////////////////// +__hal_plf_rom_swap_start: + // put boot PROM at 0x80000000, and system flash at 0x84000000 + mov SBBASE0_INIT_BPROM,d0 + mov d0,(SBBASE0) + + mov SBBASE1_INIT_BPROM,d0 + mov d0,(SBBASE1) + + // memory bank 0 + mov SBCTRL00_INIT,d0 + mov d0,(SBCTRL00) + mov SBCTRL01_INIT,d0 + mov d0,(SBCTRL01) + mov SBCTRL02_INIT,d0 + mov d0,(SBCTRL02) + + // memory bank 1 + mov SBCTRL10_INIT,d0 + mov d0,(SBCTRL10) + mov SBCTRL11_INIT,d0 + mov d0,(SBCTRL11) + mov SBCTRL12_INIT,d0 + mov d0,(SBCTRL12) + + // jump forward so we start running from the 80000000/84000000 base address + mov __hal_plf_rom_swap_reentry,a0 + jmp (a0) +__hal_plf_rom_swap_end: + //////////////////////////////////////////////////////////////// + +__hal_plf_rom_swap_reentry: + // clear the on-CPU 16Kb SRAM + clr d0 + mov 16384/4-4,d1 + mov 0x8C000000,a0 +0: + mov d0,(a0,d1) + sub 4,d1 + bnc 0b + + .endm + +#define CYGPKG_HAL_MN10300_MEMC_DEFINED + +#endif + + +//----------------------------------------------------------------------------- +// Syscall support. +#if defined(CYGPKG_CYGMON) || defined(CYGSEM_REDBOOT_BSP_SYSCALLS) +// Cygmon provides syscall handling for this board +// These must be kept in sync with the rest of the tree. +#define SIGSYS 12 +#define SIGSYSCALL SIGSYS +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/packages/hal/mn10300/asb2305/current/include/plf_intr.h b/packages/hal/mn10300/asb2305/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/plf_intr.h @@ -0,0 +1,112 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// ASB2305 Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dhowells +// Contributors: nickg, jskov, +// gthomas, jlarmour, dmoseley +// Date: 2001-05-17 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the AM33-2 ASB2305 board. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include + +#if CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL==0 +#define CYGNUM_HAL_INTERRUPT_DEBUG_UART CYGNUM_HAL_INTERRUPT_SERIAL_1_RX +#elif CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL==1 +#define CYGNUM_HAL_INTERRUPT_DEBUG_UART CYGNUM_HAL_INTERRUPT_SERIAL_0_RX +#else +#error UNKNOWN DEBUG CHANNEL +#endif + +extern void cyg_plf_hal_delay_us(cyg_int32 usecs); +#define HAL_DELAY_US cyg_plf_hal_delay_us + +//-------------------------------------------------------------------------- +// Control-C support. + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +# define CYGHWR_HAL_GDB_PORT_VECTOR CYGNUM_HAL_INTERRUPT_SERIAL_1_RX + +externC cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +#define HAL_CTRLC_ISR hal_ctrlc_isr + +#endif + +//-------------------------------------------------------------------------- +// Function call support with a new stack. +// This will emulate thread creation using a new stack +// +#define HAL_ARCH_FUNCALL_NEW_STACK(func, base, size) hal_arch_funcall_new_stack(func, base, size) +extern void hal_arch_funcall_new_stack(void (*func)(void), void* stack_base, cyg_uint32 stack_size); + + +//---------------------------------------------------------------------------- +// Reset. +#ifndef CYGHWR_HAL_RESET_DEFINED +extern void cyg_hal_plf_reset( void ); +#define CYGHWR_HAL_RESET_DEFINED +#define HAL_PLATFORM_RESET() cyg_hal_plf_reset() + +#define HAL_PLATFORM_RESET_ENTRY 0x40000000 + +#endif // CYGHWR_HAL_RESET_DEFINED + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/mn10300/asb2305/current/include/plf_io.h b/packages/hal/mn10300/asb2305/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/plf_io.h @@ -0,0 +1,344 @@ +#ifndef CYGONCE_PLF_IO_H +#define CYGONCE_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// Platform specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dhowells +// Contributors: dmoseley +// Date: 2001-05-17 +// Purpose: ASB2305 platform IO support +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#ifndef __ASSEMBLER__ +#include +#endif + +#ifdef __ASSEMBLER__ +#define HAL_REG_8(x) x +#define HAL_REG_16(x) x +#define HAL_REG_32(x) x +#else +#define HAL_REG_8(x) (volatile cyg_uint8*)(x) +#define HAL_REG_16(x) (volatile cyg_uint16*)(x) +#define HAL_REG_32(x) (volatile cyg_uint32*)(x) +#endif + +# define CYGARC_UNCACHED_ADDRESS(x) ((x)|0x20000000) + +//----------------------------------------------------------------------------- + +/* ASB GPIO Registers */ +#define HAL_GPIO_BASE 0xDB000000 + +#define HAL_GPIO_0_MODE_OFFSET 0x0000 +#define HAL_GPIO_0_IN_OFFSET 0x0004 +#define HAL_GPIO_0_OUT_OFFSET 0x0008 +#define HAL_GPIO_1_MODE_OFFSET 0x0100 +#define HAL_GPIO_1_IN_OFFSET 0x0104 +#define HAL_GPIO_1_OUT_OFFSET 0x0108 +#define HAL_GPIO_2_MODE_OFFSET 0x0200 +#define HAL_GPIO_2_IN_OFFSET 0x0204 +#define HAL_GPIO_2_OUT_OFFSET 0x0208 +#define HAL_GPIO_3_MODE_OFFSET 0x0300 +#define HAL_GPIO_3_IN_OFFSET 0x0304 +#define HAL_GPIO_3_OUT_OFFSET 0x0308 +#define HAL_GPIO_4_MODE_OFFSET 0x0400 +#define HAL_GPIO_4_IN_OFFSET 0x0404 +#define HAL_GPIO_4_OUT_OFFSET 0x0408 +#define HAL_GPIO_5_MODE_OFFSET 0x0500 +#define HAL_GPIO_5_IN_OFFSET 0x0504 +#define HAL_GPIO_5_OUT_OFFSET 0x0508 + +#define HAL_GPIO_0_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_0_MODE_OFFSET) +#define HAL_GPIO_0_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_0_IN_OFFSET) +#define HAL_GPIO_0_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_0_OUT_OFFSET) +#define HAL_GPIO_1_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_1_MODE_OFFSET) +#define HAL_GPIO_1_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_1_IN_OFFSET) +#define HAL_GPIO_1_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_1_OUT_OFFSET) +#define HAL_GPIO_2_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_2_MODE_OFFSET) +#define HAL_GPIO_2_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_2_IN_OFFSET) +#define HAL_GPIO_2_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_2_OUT_OFFSET) +#define HAL_GPIO_3_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_3_MODE_OFFSET) +#define HAL_GPIO_3_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_3_IN_OFFSET) +#define HAL_GPIO_3_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_3_OUT_OFFSET) +#define HAL_GPIO_4_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_4_MODE_OFFSET) +#define HAL_GPIO_4_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_4_IN_OFFSET) +#define HAL_GPIO_4_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_4_OUT_OFFSET) +#define HAL_GPIO_5_MODE HAL_REG_16 (HAL_GPIO_BASE + HAL_GPIO_5_MODE_OFFSET) +#define HAL_GPIO_5_IN HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_5_IN_OFFSET) +#define HAL_GPIO_5_OUT HAL_REG_8 (HAL_GPIO_BASE + HAL_GPIO_5_OUT_OFFSET) + +//----------------------------------------------------------------------------- +#define HAL_LED_ADDRESS 0xA6F90000 +#define HAL_GPIO_MODE_ALL_OUTPUT 0x5555 + + +#ifdef __ASSEMBLER__ + +# include +# define DEBUG_DISPLAY(hexdig) hal_diag_led hexdig +# define DEBUG_DELAY() \ + mov 0x20000, d0; \ +0: sub 1, d0; \ + bne 0b; \ + nop + +#else + +extern cyg_uint8 cyg_hal_plf_led_val(CYG_WORD hexdig); +# define DEBUG_DISPLAY(hexdig) HAL_WRITE_UINT8(HAL_LED_ADDRESS, cyg_hal_plf_led_val(hexdig)) +# define DEBUG_DELAY() \ + { \ + volatile int i = 0x80000; \ + while (--i) ; \ + } + +#endif + +//----------------------------------------------------------------------------- +// PCI access stuff + +// Compute address necessary to access PCI config space for the given +// bus and device. +#define HAL_PCI_CONFIG_ADDRESS( __bus, __devfn, __offset ) \ + (0x80000000 | ((__bus) << 16) | ((__devfn) << 8) | ((__offset) & ~3)) + +// Read a value from the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +#define HAL_PCI_CFG_READ_UINT8( __bus, __devfn, __offset, __val ) \ +do { \ + if ((__bus)==0 && (__devfn)==0) { \ + HAL_READ_UINT8(0xBE040000+(__offset),(__val)); \ + } \ + else { \ + HAL_WRITE_UINT32(0xBFFFFFF8,HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset)); \ + HAL_READ_UINT8(0xBFFFFFFC + ((__offset)&3),(__val)); \ + } \ +} while(0) + +#define HAL_PCI_CFG_READ_UINT16( __bus, __devfn, __offset, __val ) \ +do { \ + if ((__bus)==0 && (__devfn)==0) { \ + HAL_READ_UINT16(0xBE040000+(__offset),(__val)); \ + } \ + else { \ + HAL_WRITE_UINT32(0xBFFFFFF8,HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset)); \ + HAL_READ_UINT16(0xBFFFFFFC + ((__offset)&2),(__val)); \ + } \ +} while(0) + +#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \ +do { \ + if ((__bus)==0 && (__devfn)==0) { \ + HAL_READ_UINT32(0xBE040000+(__offset),(__val)); \ + } \ + else { \ + HAL_WRITE_UINT32(0xBFFFFFF8,HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset)); \ + HAL_READ_UINT32(0xBFFFFFFC,(__val)); \ + } \ +} while(0) + +// Write a value to the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +#define HAL_PCI_CFG_WRITE_UINT8( __bus, __devfn, __offset, __val ) \ +do { \ + if ((__bus)==0 && (__devfn)==0) { \ + HAL_WRITE_UINT8(0xBE040000+(__offset),(__val)); \ + } \ + else { \ + HAL_WRITE_UINT32(0xBFFFFFF8,HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset)); \ + HAL_WRITE_UINT8(0xBFFFFFFC + ((__offset)&3),(__val)); \ + } \ +} while(0) + +#define HAL_PCI_CFG_WRITE_UINT16( __bus, __devfn, __offset, __val ) \ +do { \ + if ((__bus)==0 && (__devfn)==0) { \ + HAL_WRITE_UINT16(0xBE040000+(__offset),(__val)); \ + } \ + else { \ + HAL_WRITE_UINT32(0xBFFFFFF8,HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset)); \ + HAL_WRITE_UINT16(0xBFFFFFFC + ((__offset)&2),(__val)); \ + } \ +} while(0) + +#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \ +do { \ + if ((__bus)==0 && (__devfn)==0) { \ + HAL_WRITE_UINT32(0xBE040000+(__offset),(__val)); \ + } \ + else { \ + HAL_WRITE_UINT32(0xBFFFFFF8,HAL_PCI_CONFIG_ADDRESS(__bus, __devfn, __offset)); \ + HAL_WRITE_UINT32(0xBFFFFFFC,(__val)); \ + } \ +} while(0) + +// Initialize the PCI bus. +#define HAL_PCI_INIT() \ +do { \ + cyg_uint32 devfn; \ + cyg_uint16 word; \ + \ + /* we need to set up the bridge _now_ or we won't be able to access the */ \ + /* PCI config registers */ \ + HAL_PCI_CFG_READ_UINT32(0,0,CYG_PCI_CFG_COMMAND,word); \ + word |= CYG_PCI_CFG_COMMAND_SERR | CYG_PCI_CFG_COMMAND_PARITY; \ + word |= CYG_PCI_CFG_COMMAND_MEMORY | CYG_PCI_CFG_COMMAND_IO | CYG_PCI_CFG_COMMAND_MASTER; \ + HAL_PCI_CFG_WRITE_UINT32(0,0,CYG_PCI_CFG_COMMAND,word); \ + \ + HAL_PCI_CFG_WRITE_UINT16(0,0,CYG_PCI_CFG_STATUS, 0xF800); \ + HAL_PCI_CFG_WRITE_UINT8 (0,0,CYG_PCI_CFG_LATENCY_TIMER, 0x10); \ + HAL_PCI_CFG_WRITE_UINT32(0,0,CYG_PCI_CFG_BAR_0, 0x80000000); \ + HAL_PCI_CFG_WRITE_UINT8 (0,0,CYG_PCI_CFG_INT_LINE, 1); \ + HAL_PCI_CFG_WRITE_UINT32(0,0,0x48, 0x98000000); \ + HAL_PCI_CFG_WRITE_UINT8 (0,0,0x41, 0x00); \ + HAL_PCI_CFG_WRITE_UINT8 (0,0,0x42, 0x01); \ + HAL_PCI_CFG_WRITE_UINT8 (0,0,0x44, 0x01); \ + HAL_PCI_CFG_WRITE_UINT32(0,0,0x50, 0x00000001); \ + HAL_PCI_CFG_WRITE_UINT32(0,0,0x58, 0x00000002); \ + HAL_PCI_CFG_WRITE_UINT32(0,0,0x5C, 0x00000001); \ + \ + /* we also need to set up the PCI-PCI bridge (no BIOS, you see) */ \ + devfn = 3<<3 | 0; \ + \ + /* IO: 0x00010000-0x0001ffff */ \ + HAL_PCI_CFG_WRITE_UINT8 (0,devfn,CYG_PCI_CFG_IO_BASE, 0x01); \ + HAL_PCI_CFG_WRITE_UINT16(0,devfn,CYG_PCI_CFG_IO_BASE_UPPER16, 0x0001); \ + HAL_PCI_CFG_WRITE_UINT8 (0,devfn,CYG_PCI_CFG_IO_LIMIT, 0xF1); \ + HAL_PCI_CFG_WRITE_UINT16(0,devfn,CYG_PCI_CFG_IO_LIMIT_UPPER16, 0x0001); \ + \ + HAL_PCI_CFG_READ_UINT32(0,0,CYG_PCI_CFG_COMMAND,word); \ + word |= CYG_PCI_CFG_COMMAND_SERR | CYG_PCI_CFG_COMMAND_PARITY; \ + word |= CYG_PCI_CFG_COMMAND_MEMORY | CYG_PCI_CFG_COMMAND_IO | CYG_PCI_CFG_COMMAND_MASTER; \ + HAL_PCI_CFG_WRITE_UINT32(0,0,CYG_PCI_CFG_COMMAND,word); \ + HAL_PCI_CFG_WRITE_UINT16(0,devfn,CYG_PCI_CFG_MEM_BASE, 0x1000); \ + HAL_PCI_CFG_WRITE_UINT16(0,devfn,CYG_PCI_CFG_MEM_LIMIT, 0x1000); \ +} while(0) + + +//----------------------------------------------------------------------------- +// Resources + +// Map PCI device resources starting from these addresses in PCI space. +#define HAL_PCI_ALLOC_BASE_MEMORY 0x10000000 +#define HAL_PCI_ALLOC_BASE_IO 0x1000 + +// This is where the PCI spaces are mapped in the CPU's address space. +#define HAL_PCI_PHYSICAL_MEMORY_BASE 0x80000000 +#define HAL_PCI_PHYSICAL_IO_BASE 0xBE000000 + +// Translate the PCI interrupt requested by the device (INTA#, INTB#, +// INTC# or INTD#) to the associated CPU interrupt (i.e., HAL vector). +#define HAL_PCI_TRANSLATE_INTERRUPT( __bus, __devfn, __vec, __valid) \ + CYG_MACRO_START \ + cyg_uint8 __req; \ + HAL_PCI_CFG_READ_UINT8(__bus, __devfn, CYG_PCI_CFG_INT_PIN, __req); \ + if (0 != __req) { \ + /* Interrupt assignment as 21285 sees them. (From */ \ + /* EBSA285 Eval Board Reference Manual, 3.4 Interrupt Assignment) */ \ + CYG_ADDRWORD __translation[4] = { \ + CYGNUM_HAL_INTERRUPT_RESERVED_170, /* INTC# */ \ + CYGNUM_HAL_INTERRUPT_RESERVED_169, /* INTB# */ \ + CYGNUM_HAL_INTERRUPT_EXTERNAL_1, /* INTA# */ \ + CYGNUM_HAL_INTERRUPT_RESERVED_171}; /* INTD# */ \ + \ + /* The PCI lines from the different slots are wired like this */ \ + /* on the PCI backplane: */ \ + /* pin6A pin7B pin7A pin8B */ \ + /* System Slot INTA# INTB# INTC# INTD# */ \ + /* I/O Slot 1 INTB# INTC# INTD# INTA# */ \ + /* I/O Slot 2 INTC# INTD# INTA# INTB# */ \ + /* I/O Slot 3 INTD# INTA# INTB# INTC# */ \ + /* I/O Slot 4 INTA# INTB# INTC# INTD# */ \ + /* */ \ + /* (From PCI Development Backplane, 3.2.2 Interrupts) */ \ + /* */ \ + /* Devsel signals are wired to, resulting in device IDs: */ \ + /* I/O Slot 1 AD19 / dev 8 [(8+1)&3 = 1] */ \ + /* I/O Slot 2 AD18 / dev 7 [(7+1)&3 = 0] */ \ + /* I/O Slot 3 AD17 / dev 6 [(6+1)&3 = 3] */ \ + /* I/O Slot 4 AD16 / dev 5 [(5+1)&3 = 2] */ \ + /* */ \ + /* (From PCI Development Backplane, 3.2.1 General) */ \ + /* */ \ + /* The observant reader will notice that the array does not */ \ + /* match the table of how interrupts are wired. The array */ \ + /* does however match observed behavior of the hardware: */ \ + /* */ \ + /* Observed interrupts with an Intel ethernet card */ \ + /* put in the slots in turn and set to generate interrupts: */ \ + /* slot 1/intA# (dev 8): caused host INTB# */ \ + /* slot 2/intA# (dev 7): caused host INTC# */ \ + /* slot 3/intA# (dev 6): caused host INTD# */ \ + /* slot 4/intA# (dev 5): caused host INTA# */ \ + \ + __vec = __translation[((__req+CYG_PCI_DEV_GET_DEV(__devfn))&3)]; \ + __valid = true; \ + } else { \ + /* Device will not generate interrupt requests. */ \ + __valid = false; \ + } \ + CYG_MACRO_END + + +//----------------------------------------------------------------------------- +// Bus address translation macros +#define HAL_PCI_CPU_TO_BUS(__cpu_addr, __bus_addr) \ + CYG_MACRO_START \ + (__bus_addr) = (CYG_ADDRESS)((cyg_uint32)(__cpu_addr)&~0x20000000); \ + CYG_MACRO_END + +#define HAL_PCI_BUS_TO_CPU(__bus_addr, __cpu_addr) \ + CYG_MACRO_START \ + (__cpu_addr) = CYGARC_UNCACHED_ADDRESS(__bus_addr); \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_PLF_IO_H diff --git a/packages/hal/mn10300/asb2305/current/include/plf_stub.h b/packages/hal/mn10300/asb2305/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/include/plf_stub.h @@ -0,0 +1,103 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dhowells +// Contributors:dmoseley +// Date: 2001-05-17 +// Purpose: Platform HAL stub support for AM33-20/ASB2305 boards. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() +#define HAL_STUB_PLATFORM_GET_CHAR() cyg_hal_plf_serial_getc(0) +#define HAL_STUB_PLATFORM_PUT_CHAR(c) cyg_hal_plf_serial_putc(0, (c)) +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) cyg_hal_plf_serial_setbaud(0, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE (&hal_asb_interruptible) +#define HAL_STUB_PLATFORM_INIT_BREAK_IRQ() CYG_EMPTY_STATEMENT + +//---------------------------------------------------------------------------- +// Stub initializer. + +externC void hal_asb_platform_init(void); + +#define HAL_STUB_PLATFORM_INIT() hal_asb_platform_init() +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +//----------------------------------------------------------------------------- +// Syscall support. +#ifdef CYGPKG_CYGMON +// Cygmon provides syscall handling for this board +#define SIGSYSCALL SIGSYS +extern int __get_syscall_num (void); +#endif + +//----------------------------------------------------------------------------- +// Register validity checking. +#ifdef CYGPKG_CYGMON +#define CYGHWR_REGISTER_VALIDITY_CHECKING +#endif + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/mn10300/asb2305/current/misc/redboot_FLASH.ecm b/packages/hal/mn10300/asb2305/current/misc/redboot_FLASH.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/misc/redboot_FLASH.ecm @@ -0,0 +1,103 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware asb2305 ; + template redboot ; + package -hardware CYGPKG_HAL_MN10300 current ; + package -hardware CYGPKG_HAL_MN10300_AM33_ASB2305 current ; + package -hardware CYGPKG_HAL_MN10300_AM33 current ; + package -hardware CYGPKG_IO_SERIAL_MN10300 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_MN10300_MN10300 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + + package CYGPKG_IO_ETH_DRIVERS current ; + package -hardware CYGPKG_DEVS_ETH_MN10300_ASB2305 current ; + package -hardware CYGPKG_DEVS_ETH_AMD_PCNET current ; + + package CYGPKG_IO_FLASH current ; + package -hardware CYGPKG_DEVS_FLASH_MN10300_ASB2305 current ; + package CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYG_HAL_ROM_SLOT { + user_value "SysFlash" +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_MN10300_ASB2305_BANK { + user_value "BootPROM" +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29DL324D { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV800 { + user_value 1 +}; + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + user_value 115200 +}; + +cdl_option CYGSEM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_RTSCTS { + user_value 1 +}; + +cdl_option CYGSEM_DEVS_ETH_AMD_PCNET_FORCE_10MBPS { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; diff --git a/packages/hal/mn10300/asb2305/current/misc/redboot_RAM.ecm b/packages/hal/mn10300/asb2305/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/misc/redboot_RAM.ecm @@ -0,0 +1,107 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware asb2305 ; + template redboot ; + package -hardware CYGPKG_HAL_MN10300 current ; + package -hardware CYGPKG_HAL_MN10300_AM33_ASB2305 current ; + package -hardware CYGPKG_HAL_MN10300_AM33 current ; + package -hardware CYGPKG_IO_SERIAL_MN10300 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_MN10300_MN10300 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + + package CYGPKG_IO_ETH_DRIVERS current ; + package -hardware CYGPKG_DEVS_ETH_MN10300_ASB2305 current ; + package -hardware CYGPKG_DEVS_ETH_AMD_PCNET current ; + + package CYGPKG_IO_FLASH current ; + package -hardware CYGPKG_DEVS_FLASH_MN10300_ASB2305 current ; + package CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGOPT_REDBOOT_FIS { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_MN10300_ASB2305_BANK { + user_value "BootPROM" +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29DL324D { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV800 { + user_value 1 +}; + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + user_value 115200 +}; + +cdl_option CYGSEM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_RTSCTS { + user_value 1 +}; + +cdl_option CYGSEM_IO_FLASH_SOFT_WRITE_PROTECT { + user_value 0 +}; + +cdl_option CYGSEM_DEVS_ETH_AMD_PCNET_FORCE_10MBPS { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; diff --git a/packages/hal/mn10300/asb2305/current/misc/redboot_ROM.ecm b/packages/hal/mn10300/asb2305/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/misc/redboot_ROM.ecm @@ -0,0 +1,103 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware asb2305 ; + template redboot ; + package -hardware CYGPKG_HAL_MN10300 current ; + package -hardware CYGPKG_HAL_MN10300_AM33_ASB2305 current ; + package -hardware CYGPKG_HAL_MN10300_AM33 current ; + package -hardware CYGPKG_IO_SERIAL_MN10300 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_MN10300_MN10300 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + + package CYGPKG_IO_ETH_DRIVERS current ; + package -hardware CYGPKG_DEVS_ETH_MN10300_ASB2305 current ; + package -hardware CYGPKG_DEVS_ETH_AMD_PCNET current ; + + package CYGPKG_IO_FLASH current ; + package -hardware CYGPKG_DEVS_FLASH_MN10300_ASB2305 current ; + package CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; +}; + +cdl_option CYGBLD_BUILD_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + inferred_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + inferred_value 0 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_MN10300_ASB2305_BANK { + user_value "SysFlash" +}; + +cdl_option CYGSEM_IO_FLASH_SOFT_WRITE_PROTECT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29DL324D { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV800 { + user_value 1 +}; + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + user_value 115200 +}; + +cdl_option CYGSEM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_RTSCTS { + user_value 1 +}; + +cdl_option CYGSEM_DEVS_ETH_AMD_PCNET_FORCE_10MBPS { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { + user_value 1 +}; diff --git a/packages/hal/mn10300/asb2305/current/src/hal_diag.c b/packages/hal/mn10300/asb2305/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/src/hal_diag.c @@ -0,0 +1,215 @@ +//============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley (based on the original by jskov) +// Contributors:nickg, jskov, dmoseley +// Date: 2000-08-11 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#if !defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#warning HAL_DIAG has only been verified using CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +#include // base types +#include // tracing macros +#include // assertion macros + +#include +#include + +#warning GET HAL_DIAG STUFF WORKING + +/*---------------------------------------------------------------------------*/ +/* Select default diag channel to use */ + +//#define CYG_KERNEL_DIAG_SERIAL +//#define CYG_KERNEL_DIAG_BUFFER +//#define CYG_KERNEL_DIAG_GDB + +#if !defined(CYG_KERNEL_DIAG_SERIAL) && defined(CYGSEM_HAL_USE_ROM_MONITOR_GDB_stubs) +# define CYG_KERNEL_DIAG_SERIAL +# define CYG_KERNEL_DIAG_GDB +#else +# define CYG_KERNEL_DIAG_SERIAL +#endif + +/*---------------------------------------------------------------------------*/ + +externC void diag_write_string (const char*); + +#if defined(CYG_KERNEL_DIAG_SERIAL) +extern void cyg_hal_plf_comms_init(void); +extern void cyg_hal_plf_serial_putc(void*, cyg_uint8); +extern cyg_uint8 cyg_hal_plf_serial_getc(void*); +#endif + +#if defined(CYG_KERNEL_DIAG_BUFFER) +char hal_diag_buffer[10000]; +int hal_diag_buffer_pos; +#endif + +void hal_diag_init(void) +{ +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_comms_init(); +#endif + +#if defined(CYG_KERNEL_DIAG_BUFFER) + hal_diag_buffer_pos = 0; +#endif +} + +#ifdef CYG_KERNEL_DIAG_GDB +static void gdb_diag_write_char(char c) +{ + static char line[100]; + static int pos = 0; + + // No need to send CRs + if( c == '\r' ) return; + + line[pos++] = c; + + if( c == '\n' || pos == sizeof(line) ) + { + while (1) + { + static char hex[] = "0123456789ABCDEF"; + cyg_uint8 csum = 0; + int i; + + hal_diag_write_char_serial('$'); + hal_diag_write_char_serial('O'); + csum += 'O'; + for( i = 0; i < pos; i++ ) + { + char ch = line[i]; + char h = hex[(ch>>4)&0xF]; + char l = hex[ch&0xF]; + hal_diag_write_char_serial(h); + hal_diag_write_char_serial(l); + csum += h; + csum += l; + } + hal_diag_write_char_serial('#'); + hal_diag_write_char_serial(hex[(csum>>4)&0xF]); + hal_diag_write_char_serial(hex[csum&0xF]); + + { + char c1; + + hal_diag_read_char_serial( &c1 ); + + if( c1 == '+' ) break; + + + if( cyg_hal_is_break( &c1, 1 ) ) + cyg_hal_user_break( NULL ); + } + } + + pos = 0; + } +} +#endif // CYG_KERNEL_DIAG_GDB + +void hal_diag_write_char(char c) +{ + unsigned long __state; + + HAL_DISABLE_INTERRUPTS(__state); + + if(c == '\n') + { +#if defined (CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_putc(NULL, '\r'); + cyg_hal_plf_serial_putc(NULL, '\n'); +#endif +#if defined(CYG_KERNEL_DIAG_BUFFER) + hal_diag_buffer[hal_diag_buffer_pos++] = c; + if (hal_diag_buffer_pos >= sizeof(hal_diag_buffer) ) + hal_diag_buffer_pos = 0; +#endif +#if defined(CYG_KERNEL_DIAG_GDB) + gdb_diag_write_char(c); +#endif + } + else if (c == '\r') + { + // Ignore '\r' + } + else + { +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_putc(NULL, c); +#endif +#if defined(CYG_KERNEL_DIAG_BUFFER) + hal_diag_buffer[hal_diag_buffer_pos++] = c; + if (hal_diag_buffer_pos >= sizeof(hal_diag_buffer) ) + hal_diag_buffer_pos = 0; +#endif +#if defined(CYG_KERNEL_DIAG_GDB) + gdb_diag_write_char(c); +#endif + } + + HAL_RESTORE_INTERRUPTS(__state); +} + +void hal_diag_read_char(char *c) +{ +#if defined(CYG_KERNEL_DIAG_SERIAL) + cyg_hal_plf_serial_getc(c); +#endif +} + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +/*---------------------------------------------------------------------------*/ +/* End of hal_diag.c */ diff --git a/packages/hal/mn10300/asb2305/current/src/plf_misc.c b/packages/hal/mn10300/asb2305/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/src/plf_misc.c @@ -0,0 +1,298 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley (based on the original by nickg) +// Contributors: nickg, jlarmour, dmoseley +// Date: 2000-08-11 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include // Base types +#include // tracing macros +#include // assertion macros + +#include // architectural definitions + +#include // Interrupt handling + +#include // Cache handling + +#include + +#include + +const cyg_uint8 hal_diag_digits[] = { + 0x81, // 0 + 0xf3, // 1 + 0x49, // 2 + 0x61, // 3 + 0x33, // 4 + 0x25, // 5 + 0x05, // 6 + 0xf1, // 7 + 0x01, // 8 + 0x21, // 9 + 0x11, // A + 0x07, // B + 0x8d, // C + 0x43, // D + 0x0d, // E + 0x1d // F +}; + +const char hal_diag_hex_digits[] = "0123456789ABCDEF"; + +cyg_uint32 hal_led_old_display = 0x5f17ffff; /* "rh " */ + +/*------------------------------------------------------------------------*/ +/* LED support */ +cyg_uint8 cyg_hal_plf_led_val(CYG_WORD hexdig) +{ + return hal_diag_digits[(hexdig & 0xF)]; +} + +/*------------------------------------------------------------------------*/ + +#include CYGHWR_MEMORY_LAYOUT_H +#if defined(CYGPKG_CYGMON) +extern unsigned long cygmon_memsize; +#endif + +void hal_platform_init(void) +{ + *(cyg_uint8*)(&hal_led_old_display) = cyg_hal_plf_led_val(8); + HAL_WRITE_UINT32(HAL_LED_ADDRESS,hal_led_old_display); + +#if defined(CYG_HAL_STARTUP_ROM) + // Note that the hardware seems to come up with the + // caches containing random data. Hence they must be + // invalidated before being enabled. + // However, we only do this if we are in ROM. If we are + // in RAM, then we leave the caches in the state chosen + // by the ROM monitor. If we enable them when the monitor + // is not expecting it, we can end up breaking things if the + // monitor is not doing cache flushes. + + HAL_ICACHE_INVALIDATE_ALL(); + HAL_ICACHE_ENABLE(); + HAL_DCACHE_INVALIDATE_ALL(); + HAL_DCACHE_ENABLE(); +#endif + +#if defined(CYGPKG_CYGMON) + cygmon_memsize = 16 * 1024 * 1024 - 0x200; // 16 MB - 0x200 (for _hal_vsr_table and _hal_virtual_vector_table) +#endif + + // Set up eCos/ROM interfaces + hal_if_init(); + +#if defined(CYGPKG_KERNEL) && \ + defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && \ + defined(CYGSEM_HAL_USE_ROM_MONITOR_GDB_stubs) + { + extern CYG_ADDRESS hal_virtual_vector_table[32]; + extern void patch_dbg_syscalls(void * vector); + patch_dbg_syscalls( (void *)(&hal_virtual_vector_table[0]) ); + } +#endif +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + { + static void hal_ctrlc_isr_init(void); + hal_ctrlc_isr_init(); + } +#endif + + // Make sure the TBR points at the base of ROM +#if 0 + { + #define TBR 0xC0000024 + cyg_uint32 TBR_val; + HAL_READ_UINT32(TBR, TBR_val); + TBR_val = (TBR_val & 0x00FFFFFF) | 0x90000000; //(CYGMEM_REGION_rom & 0xFF000000); + HAL_WRITE_UINT32(TBR, TBR_val); + } +#endif + + // Make sure the MTBR points at the base of ROM +#if 0 + { + #define mTBR 0xC0000028 + cyg_uint32 mTBR_val; + HAL_READ_UINT32(mTBR, mTBR_val); + mTBR_val = (mTBR_val & 0x00FFFFFF) | (CYGMEM_REGION_rom & 0xFF000000); + HAL_WRITE_UINT32(mTBR, mTBR_val); + } +#endif +} + +/*------------------------------------------------------------------------*/ +/* microsecond resolution delay */ +void cyg_plf_hal_delay_us(cyg_int32 usecs) +{ + cyg_uint8 last, val; + +#define TM0MD 0xD4003000 +#define TM0BR 0xD4003010 +#define TM0BC 0xD4003020 + + HAL_WRITE_UINT8(TM0BR,25); // IOCLK is 25MHz + HAL_WRITE_UINT8(TM0MD,0x40); // stop and load + HAL_WRITE_UINT8(TM0MD,0x80); // set source to be IOCLK and go + + HAL_READ_UINT8(TM0BC,last); + for (; usecs>0;) { + HAL_READ_UINT8(TM0BC,val); + if (val==last) continue; + if (val>last) + usecs--; // count the underflows + last = val; + } + HAL_WRITE_UINT8(TM0MD,0x00); // stop +} + +/*------------------------------------------------------------------------*/ +/* Functions to support the detection and execution of a user provoked */ +/* program break. These are usually called from interrupt routines. */ + +/*------------------------------------------------------------------------*/ +/* Control C ISR support */ +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +#if CYGHWR_HAL_MN10300_AM33_STB_GDB_PORT == 0 + +// We use serial0 on AM33 +#define SERIAL_CR ((volatile cyg_uint16 *)0xd4002000) +#define SERIAL_ICR ((volatile cyg_uint8 *) 0xd4002004) +#define SERIAL_TXR ((volatile cyg_uint8 *) 0xd4002008) +#define SERIAL_RXR ((volatile cyg_uint8 *) 0xd4002009) +#define SERIAL_SR ((volatile cyg_uint16 *)0xd400200c) + +// Timer 1 provided baud rate divisor +#define TIMER_MD ((volatile cyg_uint8 *)0xd4003000) +#define TIMER_BR ((volatile cyg_uint8 *)0xd4003010) +#define TIMER_CR ((volatile cyg_uint8 *)0xd4003020) + +#define SIO_LSTAT_TRDY 0x20 +#define SIO_LSTAT_RRDY 0x10 + +#else + +#error Unsupported GDB port + +#endif + +struct Hal_SavedRegisters *hal_saved_interrupt_state; + +static void hal_ctrlc_isr_init(void) +{ +// cyg_uint16 cr; + +// HAL_READ_UINT16( SERIAL_CR, cr ); +// cr |= LCR_RXE; +// HAL_WRITE_UINT16( SERIAL_CR, cr ); + HAL_INTERRUPT_SET_LEVEL( CYGHWR_HAL_GDB_PORT_VECTOR, 4 ); + HAL_INTERRUPT_UNMASK( CYGHWR_HAL_GDB_PORT_VECTOR ); +} + +cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + char c; + cyg_uint16 sr; + + HAL_INTERRUPT_ACKNOWLEDGE( CYGHWR_HAL_GDB_PORT_VECTOR ); + + HAL_READ_UINT16( SERIAL_SR, sr ); + + if( sr & SIO_LSTAT_RRDY ) + { + HAL_READ_UINT8( SERIAL_RXR, c); + + if( cyg_hal_is_break( &c , 1 ) ) + cyg_hal_user_break( (CYG_ADDRWORD *)hal_saved_interrupt_state ); + + + } + return 1; +} + +#endif + +void hal_arch_funcall_new_stack(void (*func)(void), void* stack_base, cyg_uint32 stack_size) +{ + register cyg_uint32 stack_top = (cyg_uint32)stack_base + stack_size; + register cyg_uint32 old_stack; + asm volatile (" mov sp, %0" : "=r" (old_stack) : ); + asm volatile (" mov %0, sp" : : "r" (stack_top) ); + func(); + asm volatile (" mov %0, sp" : : "r" (old_stack) ); +} + +/*------------------------------------------------------------------------*/ +/* Syscall support */ +#ifdef CYGPKG_CYGMON +// Cygmon provides syscall handling for this board +#include +int __get_syscall_num (void) +{ + return SIGSYS; +} +#endif + +/*------------------------------------------------------------------------*/ +/* flash write-protect support */ +int plf_flash_query_soft_wp(void *addr, int len) +{ + if (((unsigned long)addr & 0xFC000000UL) == 0x84000000UL) + return !(*(cyg_uint8*)0xA6FA0000 & 0x02); // system flash + else + return 0; // boot prom +} + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/packages/hal/mn10300/asb2305/current/src/plf_stub.c b/packages/hal/mn10300/asb2305/current/src/plf_stub.c new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/src/plf_stub.c @@ -0,0 +1,202 @@ +//============================================================================= +// +// plf_stub.c +// +// Platform specific code for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dhowells +// Contributors:dmoseley +// Date: 2001-05-17 +// Purpose: Platform specific code for GDB stub support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include // HAL IO macros + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include +#include // HAL interrupt macros + +/*---------------------------------------------------------------------------*/ +// Define the serial registers. +#define CYG_DEV_RBR 0x00 // receiver buffer register, read, dlab = 0 +#define CYG_DEV_THR 0x00 // transmitter holding register, write, dlab = 0 +#define CYG_DEV_DLL 0x00 // divisor latch (LS), read/write, dlab = 1 +#define CYG_DEV_IER 0x04 // interrupt enable register, read/write, dlab = 0 +#define CYG_DEV_DLM 0x04 // divisor latch (MS), read/write, dlab = 1 +#define CYG_DEV_IIR 0x08 // interrupt identification register, read, dlab = 0 +#define CYG_DEV_FCR 0x08 // fifo control register, write, dlab = 0 +#define CYG_DEV_LCR 0x0C // line control register, read/write +#define CYG_DEV_MCR 0x10 // modem control register, read/write +#define CYG_DEV_LSR 0x14 // line status register, read +#define CYG_DEV_MSR 0x18 // modem status register, read + +// Interrupt Enable Register +#define SIO_IER_RCV 0x01 +#define SIO_IER_XMT 0x02 +#define SIO_IER_LS 0x04 +#define SIO_IER_MS 0x08 + +// The line status register bits. +#define SIO_LSR_DR 0x01 // data ready +#define SIO_LSR_OE 0x02 // overrun error +#define SIO_LSR_PE 0x04 // parity error +#define SIO_LSR_FE 0x08 // framing error +#define SIO_LSR_BI 0x10 // break interrupt +#define SIO_LSR_THRE 0x20 // transmitter holding register empty +#define SIO_LSR_TEMT 0x40 // transmitter register empty +#define SIO_LSR_ERR 0x80 // any error condition + +// The modem status register bits. +#define SIO_MSR_DCTS 0x01 // delta clear to send +#define SIO_MSR_DDSR 0x02 // delta data set ready +#define SIO_MSR_TERI 0x04 // trailing edge ring indicator +#define SIO_MSR_DDCD 0x08 // delta data carrier detect +#define SIO_MSR_CTS 0x10 // clear to send +#define SIO_MSR_DSR 0x20 // data set ready +#define SIO_MSR_RI 0x40 // ring indicator +#define SIO_MSR_DCD 0x80 // data carrier detect + +// The line control register bits. +#define SIO_LCR_WLS0 0x01 // word length select bit 0 +#define SIO_LCR_WLS1 0x02 // word length select bit 1 +#define SIO_LCR_STB 0x04 // number of stop bits +#define SIO_LCR_PEN 0x08 // parity enable +#define SIO_LCR_EPS 0x10 // even parity select +#define SIO_LCR_SP 0x20 // stick parity +#define SIO_LCR_SB 0x40 // set break +#define SIO_LCR_DLAB 0x80 // divisor latch access bit + +// Modem Control Register +#define SIO_MCR_DTR 0x01 +#define SIO_MCR_RTS 0x02 +#define SIO_MCR_INT 0x08 // Enable interrupts + +#define SERIAL0BASE 0x86FB0000 + +//--------------------------------------------------------------------------- + +#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT +// This ISR is called from the interrupt handler. This should only +// happen when there is no serial driver, so the code shouldn't mess +// anything up. +int cyg_hal_gdb_isr(cyg_uint32 vector, target_register_t pc) +{ + if ( CYGNUM_HAL_INTERRUPT_SERIAL_0_RX == vector ) { + cyg_uint8 c; + + HAL_READ_UINT8(SERIAL0BASE+CYG_DEV_RBR,c); + HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX); + + if( 3 == c ) + { + // Ctrl-C: set a breakpoint at PC so GDB will display the + // correct program context when stopping rather than the + // interrupt handler. + cyg_hal_gdb_interrupt (pc); + + // Interrupt handled. Don't call ISR proper. At return + // from the VSR, execution will stop at the breakpoint + // just set. + return 0; + } + } + + // Not caused by GDB. Call ISR proper. + return 1; +} +#endif + +//----------------------------------------------------------------------------- + +void hal_asb_platform_init(void) +{ + extern CYG_ADDRESS hal_virtual_vector_table[64]; + extern void init_thread_syscall( void *); + extern void install_async_breakpoint(void *epc); +// void (*oldvsr)(void); + extern void _default_trap_vsr(void); + + // Ensure that the breakpoint VSR points to the default VSR. This will pass + // it on to the stubs. +// HAL_VSR_SET( CYGNUM_HAL_VECTOR_BREAKPOINT, _default_trap_vsr, &oldvsr ); + + // Install async breakpoint handler into vector table. + hal_virtual_vector_table[35] = (CYG_ADDRESS)install_async_breakpoint; + +#if !defined(CYGPKG_KERNEL) && defined(CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT) + // Only include this code if we do not have a kernel. Otherwise + // the kernel supplies the functionality for the app we are linked + // with. + + // Prepare for application installation of thread info function in + // vector table. + hal_virtual_vector_table[15] = 0; + init_thread_syscall( (void *)&hal_virtual_vector_table[15] ); + +#endif +} +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +/*------------------------------------------------------------------------*/ +/* Reset support */ + +#define RSTCTR 0xc0001004 +#define CHIPRST 0x01 +void cyg_hal_plf_reset(void) +{ + // Unfortunately this only resets the MN103E010 + // A full board reset is not done. ie If the boot block select switched, + // and a Cygmon reset called the switch change will not occur. AFAICT + // the only way to notice that change is to use the Reset switch on the + // board. + HAL_WRITE_UINT8(RSTCTR, 0x00); + HAL_WRITE_UINT8(RSTCTR, CHIPRST); + + // Just in case. + while (1) ; +} + + +//----------------------------------------------------------------------------- +// End of plf_stub.c diff --git a/packages/hal/mn10300/asb2305/current/src/redboot_cmds.c b/packages/hal/mn10300/asb2305/current/src/redboot_cmds.c new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/src/redboot_cmds.c @@ -0,0 +1,132 @@ +//========================================================================== +// +// redboot_cmds.c +// +// ASB2305 [platform] specific RedBoot commands +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dhowells +// Contributors: gthomas, jskov +// Date: 2001-07-19 +// Purpose: +// Description: +// +// This code is part of RedBoot (tm). +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include +#include + +// Exported CLI function(s) + +// The exec command works like the go command in YAMON - that is, +// providing callee with argc, argv, and env. In addition to the +// information provided by the user, + +static void do_exec(int argc, char *argv[]); + +static char exec_usage[] = + "[-w timeout] [-c \"kernel command line\"] []"; + +RedBoot_cmd("exec", + "Execute an image - with MMU off", + exec_usage, + do_exec + ); + +typedef void (*code_fun)(void) __attribute__((noreturn)); + +static void +do_exec(int argc, char *argv[]) +{ + unsigned long oldints; + bool wait_time_set; + int wait_time, res; + bool cmd_line_set; + struct option_info opts[4]; + code_fun entry; + char line[8]; + char *cmd_line; + int num_options; + + entry = (code_fun)entry_address; // Default from last 'load' operation + init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, + (void **)&wait_time, (bool *)&wait_time_set, "wait timeout"); + init_opts(&opts[1], 'c', true, OPTION_ARG_TYPE_STR, + (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line"); + num_options = 2; + + if (!scan_opts(argc, argv, 1, opts, num_options, (void *)&entry, + OPTION_ARG_TYPE_NUM, "starting address")) + { + return; + } + if (cmd_line_set) { + memcpy((char*)0x8C001000,"cmdline:",8); + strncpy((char*)0x8C001008,cmd_line,256); + *(char*)(0x8C001008+256) = 0; + } + else { + *(char*)(0x8C001000+256) = 0; + } + + if (wait_time_set) { + diag_printf("About to start execution at %p - abort with ^C within %d seconds\n", + (void *)entry, wait_time); + res = _rb_gets(line, sizeof(line), wait_time*1000); + if (res == _GETS_CTRLC) { + return; + } + } + + HAL_DISABLE_INTERRUPTS(oldints); + HAL_DCACHE_SYNC(); + HAL_ICACHE_DISABLE(); + HAL_DCACHE_DISABLE(); + HAL_DCACHE_SYNC(); + HAL_ICACHE_INVALIDATE_ALL(); + HAL_DCACHE_INVALIDATE_ALL(); + (*entry)(); +} + +// EOF redboot_cmds.c diff --git a/packages/hal/mn10300/asb2305/current/src/ser_asb.c b/packages/hal/mn10300/asb2305/current/src/ser_asb.c new file mode 100644 --- /dev/null +++ b/packages/hal/mn10300/asb2305/current/src/ser_asb.c @@ -0,0 +1,498 @@ +//============================================================================= +// +// ser_asb.c +// +// Simple driver for the serial controllers on the AM33 ASB305 board +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dhowells +// Contributors:dmoseley, nickg, gthomas +// Date: 2001-05-18 +// Description: Simple driver for the ASB2305 debug serial port +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interface API +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // Helper functions +#include // CYG_ISR_HANDLED + +/*---------------------------------------------------------------------------*/ +/* From serial_16550.h */ +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==9600 +#define CYG_DEVICE_SERIAL_BAUD_MSB 0x00 +#define CYG_DEVICE_SERIAL_BAUD_LSB 0x78 +#endif +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==19200 +#define CYG_DEVICE_SERIAL_BAUD_MSB 0x00 +#define CYG_DEVICE_SERIAL_BAUD_LSB 0x3C +#endif +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==38400 +#define CYG_DEVICE_SERIAL_BAUD_MSB 0x00 +#define CYG_DEVICE_SERIAL_BAUD_LSB 0x1E +#endif +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==57600 +#define CYG_DEVICE_SERIAL_BAUD_MSB 0x00 +#define CYG_DEVICE_SERIAL_BAUD_LSB 0x14 +#endif +#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD==115200 +#define CYG_DEVICE_SERIAL_BAUD_MSB 0x00 +#define CYG_DEVICE_SERIAL_BAUD_LSB 0x0A +#endif + +#ifndef CYG_DEVICE_SERIAL_BAUD_MSB +#error Missing/incorrect serial baud rate defined - CDL error? +#endif + +/*---------------------------------------------------------------------------*/ +// Define the serial registers. +#define CYG_DEV_RBR 0x00 // receiver buffer register, read, dlab = 0 +#define CYG_DEV_THR 0x00 // transmitter holding register, write, dlab = 0 +#define CYG_DEV_DLL 0x00 // divisor latch (LS), read/write, dlab = 1 +#define CYG_DEV_IER 0x04 // interrupt enable register, read/write, dlab = 0 +#define CYG_DEV_DLM 0x04 // divisor latch (MS), read/write, dlab = 1 +#define CYG_DEV_IIR 0x08 // interrupt identification register, read, dlab = 0 +#define CYG_DEV_FCR 0x08 // fifo control register, write, dlab = 0 +#define CYG_DEV_LCR 0x0C // line control register, read/write +#define CYG_DEV_MCR 0x10 // modem control register, read/write +#define CYG_DEV_LSR 0x14 // line status register, read +#define CYG_DEV_MSR 0x18 // modem status register, read + +// Interrupt Enable Register +#define SIO_IER_RCV 0x01 +#define SIO_IER_XMT 0x02 +#define SIO_IER_LS 0x04 +#define SIO_IER_MS 0x08 + +// The line status register bits. +#define SIO_LSR_DR 0x01 // data ready +#define SIO_LSR_OE 0x02 // overrun error +#define SIO_LSR_PE 0x04 // parity error +#define SIO_LSR_FE 0x08 // framing error +#define SIO_LSR_BI 0x10 // break interrupt +#define SIO_LSR_THRE 0x20 // transmitter holding register empty +#define SIO_LSR_TEMT 0x40 // transmitter register empty +#define SIO_LSR_ERR 0x80 // any error condition + +// The modem status register bits. +#define SIO_MSR_DCTS 0x01 // delta clear to send +#define SIO_MSR_DDSR 0x02 // delta data set ready +#define SIO_MSR_TERI 0x04 // trailing edge ring indicator +#define SIO_MSR_DDCD 0x08 // delta data carrier detect +#define SIO_MSR_CTS 0x10 // clear to send +#define SIO_MSR_DSR 0x20 // data set ready +#define SIO_MSR_RI 0x40 // ring indicator +#define SIO_MSR_DCD 0x80 // data carrier detect + +// The line control register bits. +#define SIO_LCR_WLS0 0x01 // word length select bit 0 +#define SIO_LCR_WLS1 0x02 // word length select bit 1 +#define SIO_LCR_STB 0x04 // number of stop bits +#define SIO_LCR_PEN 0x08 // parity enable +#define SIO_LCR_EPS 0x10 // even parity select +#define SIO_LCR_SP 0x20 // stick parity +#define SIO_LCR_SB 0x40 // set break +#define SIO_LCR_DLAB 0x80 // divisor latch access bit + +// Modem Control Register +#define SIO_MCR_DTR 0x01 +#define SIO_MCR_RTS 0x02 +#define SIO_MCR_INT 0x08 // Enable interrupts + +#define LSR_WAIT_FOR(STATE) do { cyg_uint8 lsr; do { HAL_READ_UINT8(base+CYG_DEV_LSR, lsr); } while (!(lsr&SIO_LSR_##STATE)); } while(0) +#define LSR_QUERY(STATE) ({ cyg_uint8 lsr; HAL_READ_UINT8(base+CYG_DEV_LSR, lsr); (lsr&SIO_LSR_##STATE); }) + +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_RTSCTS +#define FLOWCTL_QUERY(LINE) ({ cyg_uint8 msr; HAL_READ_UINT8(base+CYG_DEV_MSR, msr); (msr&SIO_MSR_##LINE); }) +#define FLOWCTL_WAIT_FOR(LINE) do { cyg_uint8 msr; do { HAL_READ_UINT8(base+CYG_DEV_MSR, msr); } while (!(msr&SIO_MSR_##LINE)); } while(0) +#define FLOWCTL_CLEAR(LINE) do { cyg_uint8 mcr; HAL_READ_UINT8(base+CYG_DEV_MCR,mcr); mcr &= ~SIO_MCR_##LINE; HAL_WRITE_UINT8(base+CYG_DEV_MCR, mcr); } while (0); +#define FLOWCTL_SET(LINE) do { cyg_uint8 mcr; HAL_READ_UINT8(base+CYG_DEV_MCR,mcr); mcr |= SIO_MCR_##LINE; HAL_WRITE_UINT8(base+CYG_DEV_MCR, mcr); } while (0); + +#else +#define FLOWCTL_QUERY(LINE) 1 +#define FLOWCTL_WAIT_FOR(LINE) do { ; } while(0) +#define FLOWCTL_CLEAR(LINE) do { ; } while(0) +#define FLOWCTL_SET(LINE) do { ; } while(0) + +#endif + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +static channel_data_t asb2305_serial_channels[] = { + { (cyg_uint8*)0xA6FB0000, 1000, CYGNUM_HAL_INTERRUPT_SERIAL_0_RX } +}; + +//----------------------------------------------------------------------------- + +static void +cyg_hal_plf_serial_init_channel(const void* __ch_data) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 lcr; + + // 8-1-no parity. + HAL_WRITE_UINT8(base+CYG_DEV_LCR, SIO_LCR_WLS0 | SIO_LCR_WLS1); + + HAL_READ_UINT8(base+CYG_DEV_LCR, lcr); + lcr |= SIO_LCR_DLAB; + HAL_WRITE_UINT8(base+CYG_DEV_LCR, lcr); + HAL_WRITE_UINT8(base+CYG_DEV_DLL, CYG_DEVICE_SERIAL_BAUD_LSB); + HAL_WRITE_UINT8(base+CYG_DEV_DLM, CYG_DEVICE_SERIAL_BAUD_MSB); + lcr &= ~SIO_LCR_DLAB; + HAL_WRITE_UINT8(base+CYG_DEV_LCR, lcr); + HAL_WRITE_UINT8(base+CYG_DEV_FCR, 0x07); // Enable & clear FIFO + + FLOWCTL_CLEAR(DTR); + FLOWCTL_CLEAR(RTS); +} + +static void +cyg_hal_plf_serial_putc_aux(cyg_uint8* base, char c) +{ + LSR_WAIT_FOR(THRE); + + FLOWCTL_WAIT_FOR(CTS); + + HAL_WRITE_UINT8(base+CYG_DEV_THR, c); +} + +void +cyg_hal_plf_serial_putc(void *__ch_data, char c) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + CYGARC_HAL_SAVE_GP(); + + FLOWCTL_SET(DTR); + + cyg_hal_plf_serial_putc_aux(base,c); + + FLOWCTL_CLEAR(DTR); + + CYGARC_HAL_RESTORE_GP(); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + + if (!LSR_QUERY(DR)) + return false; + + HAL_READ_UINT8(base+CYG_DEV_RBR, *ch); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + /* see if there's some cached data in the FIFO */ + if (!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)) { + /* there isn't - open the flood gates */ + FLOWCTL_WAIT_FOR(DSR); + FLOWCTL_SET(RTS); + + while (!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + FLOWCTL_CLEAR(RTS); + } + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + CYGARC_HAL_SAVE_GP(); + + FLOWCTL_SET(DTR); + + while(__len-- > 0) + cyg_hal_plf_serial_putc_aux(__ch_data, *__buf++); + + FLOWCTL_CLEAR(DTR); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +#define TM0MD 0xD4003000 +#define TM0BR 0xD4003010 +#define TM0BC 0xD4003020 + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ +#if 1 + int delay_count; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8* base = chan->base; + cyg_uint8 last, val; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + /* see if there's any cached data in the FIFO */ + res = cyg_hal_plf_serial_getc_nonblock(__ch_data,ch); + if (!res) { + /* there isn't - open the flood gates */ + delay_count = chan->msec_timeout * 125; // want delay in 8uS steps + + HAL_WRITE_UINT8(TM0BR,200); // IOCLK is 25MHz, we want 125KHz + HAL_WRITE_UINT8(TM0MD,0x40); // stop and load + HAL_WRITE_UINT8(TM0MD,0x80); // set source to be IOCLK and go + HAL_READ_UINT8(TM0BC,last); + + while (delay_count>0 && !FLOWCTL_QUERY(DSR)) { + HAL_READ_UINT8(TM0BC,val); + if (val==last) continue; + if (val>last) + delay_count--; // count the underflows + last = val; + } + if (delay_count==0) + goto timeout; + + FLOWCTL_SET(RTS); + + while (delay_count>0 && !LSR_QUERY(DR)) { + HAL_READ_UINT8(TM0BC,val); + if (val==last) continue; + if (val>last) + delay_count--; // count the underflows + last = val; + } + + FLOWCTL_CLEAR(RTS); + + if (LSR_QUERY(DR)) { + HAL_READ_UINT8(base+CYG_DEV_RBR, *ch); + res = true; + } + + timeout: + HAL_WRITE_UINT8(TM0MD,0x00); // stop h/w timer + } + + CYGARC_HAL_RESTORE_GP(); + return res; + +#else + int delay_count; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8* base = chan->base; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + /* see if there's some cached data in the FIFO */ + res = cyg_hal_plf_serial_getc_nonblock(__ch_data,ch); + if (!res) { + /* there isn't - open the flood gates */ + delay_count = chan->msec_timeout * 1000; // want delay in uS steps + + for (; delay_count>0 && !FLOWCTL_QUERY(DSR); delay_count--) + CYGACC_CALL_IF_DELAY_US(1); + if (delay_count==0) + goto timeout; + + FLOWCTL_SET(RTS); + + for (; delay_count>0 && !LSR_QUERY(DR); delay_count--) + CYGACC_CALL_IF_DELAY_US(1); + + FLOWCTL_CLEAR(RTS); + + if (LSR_QUERY(DR)) { + HAL_READ_UINT8(base+CYG_DEV_RBR, *ch); + res = true; + } + + } + +timeout: + CYGARC_HAL_RESTORE_GP(); + return res; +#endif +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + HAL_WRITE_UINT8(chan->base+CYG_DEV_IER, SIO_IER_RCV); + HAL_WRITE_UINT8(chan->base+CYG_DEV_MCR, SIO_MCR_INT|SIO_MCR_DTR|SIO_MCR_RTS); + + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + HAL_WRITE_UINT8(chan->base+CYG_DEV_IER, 0); + + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + char c; + cyg_uint8 lsr; + CYGARC_HAL_SAVE_GP(); + + cyg_drv_interrupt_acknowledge(chan->isr_vector); + + *__ctrlc = 0; + HAL_READ_UINT8(chan->base+CYG_DEV_LSR, lsr); + if ( (lsr & SIO_LSR_DR) != 0 ) { + + HAL_READ_UINT8(chan->base+CYG_DEV_RBR, c); + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(asb2305_serial_channels[0].isr_vector); + + // Init channels + cyg_hal_plf_serial_init_channel(&asb2305_serial_channels[0]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &asb2305_serial_channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +/*---------------------------------------------------------------------------*/ +/* End of ser_asb.c */ diff --git a/packages/hal/mn10300/sim/current/ChangeLog b/packages/hal/mn10300/sim/current/ChangeLog --- a/packages/hal/mn10300/sim/current/ChangeLog +++ b/packages/hal/mn10300/sim/current/ChangeLog @@ -189,27 +189,36 @@ Mon Aug 17 22:21:34 1998 Jonathan Larmo Add GROUP(libgcc.a libtarget.a) to prevent need for explicit linking //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/mn10300/sim/current/cdl/hal_mn10300_am31_sim.cdl b/packages/hal/mn10300/sim/current/cdl/hal_mn10300_am31_sim.cdl --- a/packages/hal/mn10300/sim/current/cdl/hal_mn10300_am31_sim.cdl +++ b/packages/hal/mn10300/sim/current/cdl/hal_mn10300_am31_sim.cdl @@ -5,29 +5,38 @@ # MN10300/AM31 SIM HAL package configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/hal/mn10300/sim/current/include/hal_diag.h b/packages/hal/mn10300/sim/current/include/hal_diag.h --- a/packages/hal/mn10300/sim/current/include/hal_diag.h +++ b/packages/hal/mn10300/sim/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/sim/current/include/platform.inc b/packages/hal/mn10300/sim/current/include/platform.inc --- a/packages/hal/mn10300/sim/current/include/platform.inc +++ b/packages/hal/mn10300/sim/current/include/platform.inc @@ -7,29 +7,38 @@ ## AM31 simulator "board" assembler header file ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mn10300/sim/current/include/plf_intr.h b/packages/hal/mn10300/sim/current/include/plf_intr.h --- a/packages/hal/mn10300/sim/current/include/plf_intr.h +++ b/packages/hal/mn10300/sim/current/include/plf_intr.h @@ -8,29 +8,38 @@ // MN10300 sim interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/sim/current/src/hal_diag.c b/packages/hal/mn10300/sim/current/src/hal_diag.c --- a/packages/hal/mn10300/sim/current/src/hal_diag.c +++ b/packages/hal/mn10300/sim/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/sim/current/src/plf_misc.c b/packages/hal/mn10300/sim/current/src/plf_misc.c --- a/packages/hal/mn10300/sim/current/src/plf_misc.c +++ b/packages/hal/mn10300/sim/current/src/plf_misc.c @@ -5,29 +5,38 @@ // HAL platform miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stb/current/cdl/hal_mn10300_am33_stb.cdl b/packages/hal/mn10300/stb/current/cdl/hal_mn10300_am33_stb.cdl --- a/packages/hal/mn10300/stb/current/cdl/hal_mn10300_am33_stb.cdl +++ b/packages/hal/mn10300/stb/current/cdl/hal_mn10300_am33_stb.cdl @@ -5,29 +5,38 @@ # AM33/STB board HAL package configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/hal/mn10300/stb/current/include/hal_diag.h b/packages/hal/mn10300/stb/current/include/hal_diag.h --- a/packages/hal/mn10300/stb/current/include/hal_diag.h +++ b/packages/hal/mn10300/stb/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stb/current/include/platform.inc b/packages/hal/mn10300/stb/current/include/platform.inc --- a/packages/hal/mn10300/stb/current/include/platform.inc +++ b/packages/hal/mn10300/stb/current/include/platform.inc @@ -7,29 +7,38 @@ ## STB board assembler header file ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mn10300/stb/current/include/plf_intr.h b/packages/hal/mn10300/stb/current/include/plf_intr.h --- a/packages/hal/mn10300/stb/current/include/plf_intr.h +++ b/packages/hal/mn10300/stb/current/include/plf_intr.h @@ -8,29 +8,38 @@ // STB Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stb/current/include/plf_io.h b/packages/hal/mn10300/stb/current/include/plf_io.h --- a/packages/hal/mn10300/stb/current/include/plf_io.h +++ b/packages/hal/mn10300/stb/current/include/plf_io.h @@ -8,29 +8,38 @@ // Platform specific IO support // //============================================================================= -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stb/current/include/plf_stub.h b/packages/hal/mn10300/stb/current/include/plf_stub.h --- a/packages/hal/mn10300/stb/current/include/plf_stub.h +++ b/packages/hal/mn10300/stb/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stb/current/src/hal_diag.c b/packages/hal/mn10300/stb/current/src/hal_diag.c --- a/packages/hal/mn10300/stb/current/src/hal_diag.c +++ b/packages/hal/mn10300/stb/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stb/current/src/plf_misc.c b/packages/hal/mn10300/stb/current/src/plf_misc.c --- a/packages/hal/mn10300/stb/current/src/plf_misc.c +++ b/packages/hal/mn10300/stb/current/src/plf_misc.c @@ -5,29 +5,38 @@ // HAL platform miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stb/current/src/plf_stub.c b/packages/hal/mn10300/stb/current/src/plf_stub.c --- a/packages/hal/mn10300/stb/current/src/plf_stub.c +++ b/packages/hal/mn10300/stb/current/src/plf_stub.c @@ -5,29 +5,38 @@ // Platform specific code for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stb/current/src/ser_stb.c b/packages/hal/mn10300/stb/current/src/ser_stb.c --- a/packages/hal/mn10300/stb/current/src/ser_stb.c +++ b/packages/hal/mn10300/stb/current/src/ser_stb.c @@ -5,29 +5,38 @@ // Simple driver for the serial controllers on the AM33 STB board // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stdeval1/current/ChangeLog b/packages/hal/mn10300/stdeval1/current/ChangeLog --- a/packages/hal/mn10300/stdeval1/current/ChangeLog +++ b/packages/hal/mn10300/stdeval1/current/ChangeLog @@ -361,27 +361,36 @@ Mon Aug 17 22:20:05 1998 Jonathan Larmo Add GROUP(libgcc.a libtarget.a) to prevent need for explicit linking //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/mn10300/stdeval1/current/cdl/hal_mn10300_am31_stdeval1.cdl b/packages/hal/mn10300/stdeval1/current/cdl/hal_mn10300_am31_stdeval1.cdl --- a/packages/hal/mn10300/stdeval1/current/cdl/hal_mn10300_am31_stdeval1.cdl +++ b/packages/hal/mn10300/stdeval1/current/cdl/hal_mn10300_am31_stdeval1.cdl @@ -5,29 +5,38 @@ # AM31/stdeval1 board HAL package configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/hal/mn10300/stdeval1/current/include/hal_diag.h b/packages/hal/mn10300/stdeval1/current/include/hal_diag.h --- a/packages/hal/mn10300/stdeval1/current/include/hal_diag.h +++ b/packages/hal/mn10300/stdeval1/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stdeval1/current/include/platform.inc b/packages/hal/mn10300/stdeval1/current/include/platform.inc --- a/packages/hal/mn10300/stdeval1/current/include/platform.inc +++ b/packages/hal/mn10300/stdeval1/current/include/platform.inc @@ -7,29 +7,38 @@ ## Stdeval1 board assembler header file ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/mn10300/stdeval1/current/include/plf_intr.h b/packages/hal/mn10300/stdeval1/current/include/plf_intr.h --- a/packages/hal/mn10300/stdeval1/current/include/plf_intr.h +++ b/packages/hal/mn10300/stdeval1/current/include/plf_intr.h @@ -8,29 +8,38 @@ // Stdeval1 Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stdeval1/current/include/plf_io.h b/packages/hal/mn10300/stdeval1/current/include/plf_io.h --- a/packages/hal/mn10300/stdeval1/current/include/plf_io.h +++ b/packages/hal/mn10300/stdeval1/current/include/plf_io.h @@ -8,29 +8,38 @@ // Platform specific IO support // //============================================================================= -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stdeval1/current/include/plf_stub.h b/packages/hal/mn10300/stdeval1/current/include/plf_stub.h --- a/packages/hal/mn10300/stdeval1/current/include/plf_stub.h +++ b/packages/hal/mn10300/stdeval1/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stdeval1/current/src/hal_diag.c b/packages/hal/mn10300/stdeval1/current/src/hal_diag.c --- a/packages/hal/mn10300/stdeval1/current/src/hal_diag.c +++ b/packages/hal/mn10300/stdeval1/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stdeval1/current/src/plf_misc.c b/packages/hal/mn10300/stdeval1/current/src/plf_misc.c --- a/packages/hal/mn10300/stdeval1/current/src/plf_misc.c +++ b/packages/hal/mn10300/stdeval1/current/src/plf_misc.c @@ -5,29 +5,38 @@ // HAL platform miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/mn10300/stdeval1/current/src/plf_stub.c b/packages/hal/mn10300/stdeval1/current/src/plf_stub.c --- a/packages/hal/mn10300/stdeval1/current/src/plf_stub.c +++ b/packages/hal/mn10300/stdeval1/current/src/plf_stub.c @@ -5,29 +5,38 @@ // Platform specific code for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/arch/current/ChangeLog b/packages/hal/powerpc/arch/current/ChangeLog --- a/packages/hal/powerpc/arch/current/ChangeLog +++ b/packages/hal/powerpc/arch/current/ChangeLog @@ -1,3 +1,51 @@ +2002-04-29 Jonathan Larmour + + * src/vectors.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-25 Jonathan Larmour + + * src/ppc_stub.c (__computeSignal): Only handle ITLB/DTLB MISS if + defined by platform. + +2002-04-24 Bob Koninckx +2002-04-24 Jonathan Larmour + + * include/hal_arch.h (HAL_SavedRegisters): Add FP regs. + * include/arch.inc: Add FPU register names. + Implement hal_fpu_save and hal_fpu_load. + * src/context.S: save/restore FP regs. + * src/hal_mk_defs.c (main): Export CYGARC_JMPBUF_F* for FPU regs. + * src/ppc_stub.c (__computeSignal): SW_EMUL is support by 5xx. + ITLB and DTLB MISS only supported by 8xx. + * cdl/hal_powerpc.cdl (CYGHWR_HAL_POWERPC_VECTOR_BASE): Take + CYGHWR_HAL_POWERPC_FORCE_VECTOR_BASE_LOW into account. + +2002-04-11 Gary Thomas + + * src/hal_misc.c (hal_enable_caches): Chance cache handling & setup to + be controlled by common CDL (like other platforms/architectures). + + * src/hal_intr.c (hal_delay_us): Didn't work if there are less than + one decrementer tick per micro-second. Used a calculation that seems + to work no matter how the decrementer is configured. + +2002-04-08 Gary Thomas + + * src/vectors.S (_hal_hardware_init_done): Can't copy vectors until + DRAM is setup (like the comment said all along). + +2002-03-08 Gary Thomas + + * src/vectors.S (_hal_hardware_init_done): New label - used by + ROMRAM code to figure out relative addressing. + +2002-01-23 Gary Thomas + + * src/hal_mk_defs.c (main): Clean up compile warning. + 2001-11-16 Nick Garnett * include/hal_arch.h (HAL_MSBIT_INDEX): Fixed this macro so that @@ -1566,27 +1614,36 @@ Mon Aug 17 16:23:46 1998 Jesper Skov < (HAL_RESTORE_INTERRUPTS): Same. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/powerpc/arch/current/cdl/hal_powerpc.cdl b/packages/hal/powerpc/arch/current/cdl/hal_powerpc.cdl --- a/packages/hal/powerpc/arch/current/cdl/hal_powerpc.cdl +++ b/packages/hal/powerpc/arch/current/cdl/hal_powerpc.cdl @@ -5,29 +5,38 @@ # PowerPC architectural HAL package configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # @@ -130,9 +139,10 @@ cdl_package CYGPKG_HAL_POWERPC { 0xfff00000. The startup type and platform HAL controls which is used." flavor data - calculated { (CYGHWR_HAL_POWERPC_FORCE_VECTOR_BASE_HIGH || + calculated { (! CYGHWR_HAL_POWERPC_FORCE_VECTOR_BASE_LOW && + (CYGHWR_HAL_POWERPC_FORCE_VECTOR_BASE_HIGH || (CYG_HAL_STARTUP != "RAM" && - ! CYGSEM_HAL_POWERPC_COPY_VECTORS)) + ! CYGSEM_HAL_POWERPC_COPY_VECTORS))) ? 0xfff00000 : 0x00000000 } } @@ -143,7 +153,6 @@ cdl_package CYGPKG_HAL_POWERPC { Some platforms do not want the MMU enabled." } - cdl_option CYGDBG_HAL_POWERPC_FRAME_WALLS { display "Exception stack-frame walls" default_value 0 diff --git a/packages/hal/powerpc/arch/current/include/arch.inc b/packages/hal/powerpc/arch/current/include/arch.inc --- a/packages/hal/powerpc/arch/current/include/arch.inc +++ b/packages/hal/powerpc/arch/current/include/arch.inc @@ -5,29 +5,38 @@ ## PowerPC architecture assembler header file ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## @@ -88,6 +97,42 @@ .equ sp, r1 +#ifdef CYGHWR_HAL_POWERPC_FPU + .equ f0, 0 + .equ f1, 1 + .equ f2, 2 + .equ f3, 3 + .equ f4, 4 + .equ f5, 5 + .equ f6, 6 + .equ f7, 7 + .equ f8, 8 + .equ f9, 9 + .equ f10, 10 + .equ f11, 11 + .equ f12, 12 + .equ f13, 13 + .equ f14, 14 + .equ f15, 15 + .equ f16, 16 + .equ f17, 17 + .equ f18, 18 + .equ f19, 19 + .equ f20, 20 + .equ f21, 21 + .equ f22, 22 + .equ f23, 23 + .equ f24, 24 + .equ f25, 25 + .equ f26, 26 + .equ f27, 27 + .equ f28, 28 + .equ f29, 29 + .equ f30, 30 + .equ f31, 31 +#endif + + #------------------------------------------------------------------------------ # Some useful coding macros @@ -114,12 +159,33 @@ name: ##----------------------------------------------------------------------------- ## PowerPC FPU state handling -## Empty for now. +## The PowerPC ABI defines f14-f31 as callee saved. There is thus no need to +## save them when calling C functions + +#ifdef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT +# define MAX_SAVE_FREG 13 +#else +# define MAX_SAVE_FREG 31 +#endif .macro hal_fpu_save regs +#ifdef CYGHWR_HAL_POWERPC_FPU + .set _freg, 0 + .rept MAX_SAVE_FREG+1 + stfd _freg,(CYGARC_PPCREG_FREGS+_freg*8)(\regs) + .set _freg, _freg+1 + .endr +#endif .endm .macro hal_fpu_load regs +#ifdef CYGHWR_HAL_POWERPC_FPU + .set _freg, 0 + .rept MAX_SAVE_FREG+1 + stfd _freg,(CYGARC_PPCREG_FREGS+_freg*8)(\regs) + .set _freg, _freg+1 + .endr +#endif .endm ##----------------------------------------------------------------------------- diff --git a/packages/hal/powerpc/arch/current/include/basetype.h b/packages/hal/powerpc/arch/current/include/basetype.h --- a/packages/hal/powerpc/arch/current/include/basetype.h +++ b/packages/hal/powerpc/arch/current/include/basetype.h @@ -8,29 +8,38 @@ // Standard types for this architecture. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/arch/current/include/hal_arch.h b/packages/hal/powerpc/arch/current/include/hal_arch.h --- a/packages/hal/powerpc/arch/current/include/hal_arch.h +++ b/packages/hal/powerpc/arch/current/include/hal_arch.h @@ -8,29 +8,38 @@ // Architecture specific abstractions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -61,6 +70,9 @@ typedef struct // These are common to all saved states cyg_uint32 d[32]; // Data regs +#ifdef CYGHWR_HAL_POWERPC_FPU + double f[32]; // Floating point registers +#endif cyg_uint32 cr; // Condition Reg cyg_uint32 xer; // XER cyg_uint32 lr; // Link Reg @@ -254,6 +266,26 @@ typedef struct { cyg_uint32 r29; cyg_uint32 r30; cyg_uint32 r31; +#ifdef CYGHWR_HAL_POWERPC_FPU + double f14; + double f15; + double f16; + double f17; + double f18; + double f19; + double f20; + double f21; + double f22; + double f23; + double f24; + double f25; + double f26; + double f27; + double f28; + double f29; + double f30; + double f31; +#endif cyg_uint32 lr; cyg_uint32 cr; } hal_jmp_buf_t; diff --git a/packages/hal/powerpc/arch/current/include/hal_cache.h b/packages/hal/powerpc/arch/current/include/hal_cache.h --- a/packages/hal/powerpc/arch/current/include/hal_cache.h +++ b/packages/hal/powerpc/arch/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/arch/current/include/hal_intr.h b/packages/hal/powerpc/arch/current/include/hal_intr.h --- a/packages/hal/powerpc/arch/current/include/hal_intr.h +++ b/packages/hal/powerpc/arch/current/include/hal_intr.h @@ -8,29 +8,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/arch/current/include/hal_io.h b/packages/hal/powerpc/arch/current/include/hal_io.h --- a/packages/hal/powerpc/arch/current/include/hal_io.h +++ b/packages/hal/powerpc/arch/current/include/hal_io.h @@ -8,29 +8,38 @@ // HAL device IO register support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/arch/current/include/hal_mem.h b/packages/hal/powerpc/arch/current/include/hal_mem.h --- a/packages/hal/powerpc/arch/current/include/hal_mem.h +++ b/packages/hal/powerpc/arch/current/include/hal_mem.h @@ -8,29 +8,38 @@ // HAL memory control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/arch/current/include/ppc_regs.h b/packages/hal/powerpc/arch/current/include/ppc_regs.h --- a/packages/hal/powerpc/arch/current/include/ppc_regs.h +++ b/packages/hal/powerpc/arch/current/include/ppc_regs.h @@ -8,29 +8,38 @@ // PowerPC CPU definitions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/arch/current/include/ppc_stub.h b/packages/hal/powerpc/arch/current/include/ppc_stub.h --- a/packages/hal/powerpc/arch/current/include/ppc_stub.h +++ b/packages/hal/powerpc/arch/current/include/ppc_stub.h @@ -7,29 +7,38 @@ // PowerPC-specific definitions for generic stub // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/arch/current/misc/CPUMask8xx.c b/packages/hal/powerpc/arch/current/misc/CPUMask8xx.c --- a/packages/hal/powerpc/arch/current/misc/CPUMask8xx.c +++ b/packages/hal/powerpc/arch/current/misc/CPUMask8xx.c @@ -5,29 +5,38 @@ // Print PowerPC 8xx CPU Mask revision // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/arch/current/src/context.S b/packages/hal/powerpc/arch/current/src/context.S --- a/packages/hal/powerpc/arch/current/src/context.S +++ b/packages/hal/powerpc/arch/current/src/context.S @@ -5,29 +5,38 @@ ## PowerPC context switch code ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## @@ -81,6 +90,20 @@ .endm #endif + +#ifdef CYGHWR_HAL_POWERPC_FPU +#ifdef CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + +#define MIN_CONTEXT_SAVE_FREG 14 +#define MAX_CONTEXT_SAVE_FREG 31 + +#else + +#define MIN_CONTEXT_SAVE_FREG 0 +#define MAX_CONTEXT_SAVE_FREG 31 + +#endif +#endif #------------------------------------------------------------------------------ # hal_thread_switch_context @@ -100,6 +123,15 @@ FUNC_START(hal_thread_switch_context) .set _reg,_reg+1 .endr +#ifdef CYGHWR_HAL_POWERPC_FPU + # Save floating point MIN..MAX + .set _freg, MIN_CONTEXT_SAVE_FREG + .rept MAX_CONTEXT_SAVE_FREG+1-MIN_CONTEXT_SAVE_FREG + stfd _freg,(CYGARC_PPCREG_FREGS+_freg*8)(sp) + .set _freg, _freg+1 + .endr +#endif + stw r0,CYGARC_PPCREG_REGS+0*4(sp) # R0 stw r5,CYGARC_PPCREG_REGS+1*4(sp) # R5 = real SP, save in R1 slot stw r2,CYGARC_PPCREG_REGS+2*4(sp) # R2 = TOC @@ -156,6 +188,15 @@ FUNC_START(hal_thread_load_context) .set _reg,_reg+1 .endr +#ifdef CYGHWR_HAL_POWERPC_FPU + # Load floating registers MIN..MAX + .set _freg, MIN_CONTEXT_SAVE_FREG + .rept MAX_CONTEXT_SAVE_FREG+1-MIN_CONTEXT_SAVE_FREG + lfd _freg,(CYGARC_PPCREG_FREGS+_freg*8)(sp) + .set _freg,_freg+1 + .endr +#endif + lwz r3,CYGARC_PPCREG_MSR(sp) # merge interrupt state hal_cpu_int_merge r3 @@ -196,6 +237,26 @@ FUNC_START(hal_setjmp) stw r15,CYGARC_JMPBUF_R15(r3) stw r14,CYGARC_JMPBUF_R14(r3) stw r13,CYGARC_JMPBUF_R13(r3) +#ifdef CYGHWR_HAL_POWERPC_FPU + stfd f31,CYGARC_JMPBUF_F31(r3) + stfd f30,CYGARC_JMPBUF_F30(r3) + stfd f29,CYGARC_JMPBUF_F29(r3) + stfd f28,CYGARC_JMPBUF_F28(r3) + stfd f27,CYGARC_JMPBUF_F27(r3) + stfd f26,CYGARC_JMPBUF_F26(r3) + stfd f25,CYGARC_JMPBUF_F25(r3) + stfd f24,CYGARC_JMPBUF_F24(r3) + stfd f23,CYGARC_JMPBUF_F23(r3) + stfd f22,CYGARC_JMPBUF_F22(r3) + stfd f21,CYGARC_JMPBUF_F21(r3) + stfd f20,CYGARC_JMPBUF_F20(r3) + stfd f19,CYGARC_JMPBUF_F19(r3) + stfd f18,CYGARC_JMPBUF_F18(r3) + stfd f17,CYGARC_JMPBUF_F17(r3) + stfd f16,CYGARC_JMPBUF_F16(r3) + stfd f15,CYGARC_JMPBUF_F15(r3) + stfd f14,CYGARC_JMPBUF_F14(r3) +#endif stw r2, CYGARC_JMPBUF_R2(r3) # TOC, optimize out? stw sp, CYGARC_JMPBUF_SP(r3) li r3,0 # return 0 @@ -228,6 +289,26 @@ FUNC_START(hal_longjmp) lwz r15,CYGARC_JMPBUF_R15(r3) lwz r14,CYGARC_JMPBUF_R14(r3) lwz r13,CYGARC_JMPBUF_R13(r3) +#ifdef CYGHWR_HAL_POWERPC_FPU + lfd f31,CYGARC_JMPBUF_F31(r3) + lfd f30,CYGARC_JMPBUF_F30(r3) + lfd f29,CYGARC_JMPBUF_F29(r3) + lfd f28,CYGARC_JMPBUF_F28(r3) + lfd f27,CYGARC_JMPBUF_F27(r3) + lfd f26,CYGARC_JMPBUF_F26(r3) + lfd f25,CYGARC_JMPBUF_F25(r3) + lfd f24,CYGARC_JMPBUF_F24(r3) + lfd f23,CYGARC_JMPBUF_F23(r3) + lfd f22,CYGARC_JMPBUF_F22(r3) + lfd f21,CYGARC_JMPBUF_F21(r3) + lfd f20,CYGARC_JMPBUF_F20(r3) + lfd f19,CYGARC_JMPBUF_F19(r3) + lfd f18,CYGARC_JMPBUF_F18(r3) + lfd f17,CYGARC_JMPBUF_F17(r3) + lfd f16,CYGARC_JMPBUF_F16(r3) + lfd f15,CYGARC_JMPBUF_F15(r3) + lfd f14,CYGARC_JMPBUF_F14(r3) +#endif lwz r2, CYGARC_JMPBUF_R2(r3) lwz sp, CYGARC_JMPBUF_SP(r3) mr r3,r4 # return r4[arg1] diff --git a/packages/hal/powerpc/arch/current/src/hal_intr.c b/packages/hal/powerpc/arch/current/src/hal_intr.c --- a/packages/hal/powerpc/arch/current/src/hal_intr.c +++ b/packages/hal/powerpc/arch/current/src/hal_intr.c @@ -5,29 +5,38 @@ // PowerPC interrupt handlers // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -67,12 +76,7 @@ hal_delay_us(int us) // Note: the system constant CYGNUM_HAL_RTC_PERIOD corresponds to 10,000us // Scale the desired number of microseconds to be a number of decrementer ticks - // Note: this test says "if there is more than one decrementer tick / us" - if (CYGNUM_HAL_RTC_PERIOD > 10000) { - ticks = ((long long)us * (CYGNUM_HAL_RTC_PERIOD * 100)) / 1000000; - } else { - ticks = us / (CYGNUM_HAL_RTC_PERIOD * 100) / 1000000; - } + ticks = ((long long)us * (CYGNUM_HAL_RTC_PERIOD * 100)) / 1000000; asm volatile("mfdec %0;" : "=r"(old_dec) : ); while (ticks > 0) { do { diff --git a/packages/hal/powerpc/arch/current/src/hal_misc.c b/packages/hal/powerpc/arch/current/src/hal_misc.c --- a/packages/hal/powerpc/arch/current/src/hal_misc.c +++ b/packages/hal/powerpc/arch/current/src/hal_misc.c @@ -5,29 +5,38 @@ // HAL miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -288,19 +297,19 @@ hal_MMU_init (void) externC void hal_enable_caches(void) { -#ifdef CYGPRI_INIT_CACHES - // Initialize caches. - HAL_ICACHE_UNLOCK_ALL(); - HAL_DCACHE_UNLOCK_ALL(); - HAL_ICACHE_INVALIDATE_ALL(); +#ifndef CYG_HAL_STARTUP_RAM + // Invalidate caches HAL_DCACHE_INVALIDATE_ALL(); + HAL_ICACHE_INVALIDATE_ALL(); +#endif - // Enable caches. -#ifdef CYGPRI_ENABLE_CACHES +#ifdef CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP HAL_ICACHE_ENABLE(); +#endif + +#ifdef CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP HAL_DCACHE_ENABLE(); #endif -#endif } //--------------------------------------------------------------------------- diff --git a/packages/hal/powerpc/arch/current/src/hal_mk_defs.c b/packages/hal/powerpc/arch/current/src/hal_mk_defs.c --- a/packages/hal/powerpc/arch/current/src/hal_mk_defs.c +++ b/packages/hal/powerpc/arch/current/src/hal_mk_defs.c @@ -5,29 +5,38 @@ // HAL (architecture) "make defs" program // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -93,6 +102,26 @@ main(void) DEFINE(CYGARC_JMPBUF_R31, offsetof(hal_jmp_buf_t, r31)); DEFINE(CYGARC_JMPBUF_LR, offsetof(hal_jmp_buf_t, lr)); DEFINE(CYGARC_JMPBUF_CR, offsetof(hal_jmp_buf_t, cr)); +#ifdef CYGHWR_HAL_POWERPC_FPU + DEFINE(CYGARC_JMPBUF_F14, offsetof(hal_jmp_buf_t, f14)); + DEFINE(CYGARC_JMPBUF_F15, offsetof(hal_jmp_buf_t, f15)); + DEFINE(CYGARC_JMPBUF_F16, offsetof(hal_jmp_buf_t, f16)); + DEFINE(CYGARC_JMPBUF_F17, offsetof(hal_jmp_buf_t, f17)); + DEFINE(CYGARC_JMPBUF_F18, offsetof(hal_jmp_buf_t, f18)); + DEFINE(CYGARC_JMPBUF_F19, offsetof(hal_jmp_buf_t, f19)); + DEFINE(CYGARC_JMPBUF_F20, offsetof(hal_jmp_buf_t, f20)); + DEFINE(CYGARC_JMPBUF_F21, offsetof(hal_jmp_buf_t, f21)); + DEFINE(CYGARC_JMPBUF_F22, offsetof(hal_jmp_buf_t, f22)); + DEFINE(CYGARC_JMPBUF_F23, offsetof(hal_jmp_buf_t, f23)); + DEFINE(CYGARC_JMPBUF_F24, offsetof(hal_jmp_buf_t, f24)); + DEFINE(CYGARC_JMPBUF_F25, offsetof(hal_jmp_buf_t, f25)); + DEFINE(CYGARC_JMPBUF_F26, offsetof(hal_jmp_buf_t, f26)); + DEFINE(CYGARC_JMPBUF_F27, offsetof(hal_jmp_buf_t, f27)); + DEFINE(CYGARC_JMPBUF_F28, offsetof(hal_jmp_buf_t, f28)); + DEFINE(CYGARC_JMPBUF_F29, offsetof(hal_jmp_buf_t, f29)); + DEFINE(CYGARC_JMPBUF_F30, offsetof(hal_jmp_buf_t, f30)); + DEFINE(CYGARC_JMPBUF_F31, offsetof(hal_jmp_buf_t, f31)); +#endif // Exception/interrupt/context save buffer #ifdef CYGDBG_HAL_POWERPC_FRAME_WALLS @@ -100,6 +129,9 @@ main(void) DEFINE(CYGARC_PPCREG_WALL_TAIL, offsetof(HAL_SavedRegisters, wall_tail)); #endif DEFINE(CYGARC_PPCREG_REGS, offsetof(HAL_SavedRegisters, d[0])); +#ifdef CYGHWR_HAL_POWERPC_FPU + DEFINE(CYGARC_PPCREG_FREGS, offsetof(HAL_SavedRegisters, f[0])); +#endif DEFINE(CYGARC_PPCREG_CR, offsetof(HAL_SavedRegisters, cr)); DEFINE(CYGARC_PPCREG_XER, offsetof(HAL_SavedRegisters, xer)); DEFINE(CYGARC_PPCREG_LR, offsetof(HAL_SavedRegisters, lr)); @@ -133,6 +165,7 @@ main(void) #ifdef CYGMEM_REGION_ram DEFINE(CYGMEM_REGION_ram, CYGMEM_REGION_ram); #endif + return 0; } //-------------------------------------------------------------------------- diff --git a/packages/hal/powerpc/arch/current/src/powerpc.ld b/packages/hal/powerpc/arch/current/src/powerpc.ld --- a/packages/hal/powerpc/arch/current/src/powerpc.ld +++ b/packages/hal/powerpc/arch/current/src/powerpc.ld @@ -5,29 +5,38 @@ // Linker script for PowerPC // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/arch/current/src/ppc_stub.c b/packages/hal/powerpc/arch/current/src/ppc_stub.c --- a/packages/hal/powerpc/arch/current/src/ppc_stub.c +++ b/packages/hal/powerpc/arch/current/src/ppc_stub.c @@ -5,29 +5,38 @@ // Helper functions for stub, generic to all PowerPC processors // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // @@ -134,7 +143,7 @@ int __computeSignal (unsigned int trap_n /* System call */ return SIGSYS; -#if defined(CYGPKG_HAL_POWERPC_MPC8xx) +#if defined(CYGPKG_HAL_POWERPC_MPC8xx) || defined(CYGPKG_HAL_POWERPC_MPC5xx) case CYGNUM_HAL_VECTOR_SW_EMUL: /* A SW_EMUL is generated instead of PROGRAM for illegal instructions. */ @@ -147,11 +156,16 @@ int __computeSignal (unsigned int trap_n /* Developer port debugging exceptions. */ return SIGTRAP; +#if defined(CYGNUM_HAL_VECTOR_ITLB_MISS) case CYGNUM_HAL_VECTOR_ITLB_MISS: + /* Software reload of TLB required. */ + return SIGTRAP; +#endif +#if defined(CYGNUM_HAL_VECTOR_DTLB_MISS) case CYGNUM_HAL_VECTOR_DTLB_MISS: /* Software reload of TLB required. */ return SIGTRAP; - +#endif case CYGNUM_HAL_VECTOR_ITLB_ERROR: /* Invalid instruction access. */ return SIGBUS; diff --git a/packages/hal/powerpc/arch/current/src/vectors.S b/packages/hal/powerpc/arch/current/src/vectors.S --- a/packages/hal/powerpc/arch/current/src/vectors.S +++ b/packages/hal/powerpc/arch/current/src/vectors.S @@ -5,29 +5,38 @@ ## PowerPC exception vectors ## ##========================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##========================================================================== #######DESCRIPTIONBEGIN#### ## @@ -96,7 +105,7 @@ #=========================================================================== - .file "vectors.S" +// .file "vectors.S" .extern hal_interrupt_data .extern hal_interrupt_handlers @@ -268,16 +277,6 @@ rom_vectors_end: # shift under us while we try to set things up. hal_cpu_init -#if !defined(CYG_HAL_STARTUP_ROM) && defined(CYGSEM_HAL_POWERPC_COPY_VECTORS) - lwi r3,rom_vectors-4 - lwi r4,(CYGHWR_HAL_POWERPC_VECTOR_BASE - 4) - lwi r5,rom_vectors_end-4 -0: lwzu r0,4(r3) - stwu r0,4(r4) - cmplw r3,r5 - bne 0b -#endif - # Set up global offset table lwi r2,_GLOBAL_OFFSET_TABLE_ @@ -291,6 +290,18 @@ 0: lwzu r0,4(r3) # This may include memory controller initialization. It is not # safe to access RAM until after this point. bl hal_hardware_init # this is platform dependent + .globl _hal_hardware_init_done +_hal_hardware_init_done: + +#if !defined(CYG_HAL_STARTUP_ROM) && defined(CYGSEM_HAL_POWERPC_COPY_VECTORS) + lwi r3,rom_vectors-4 + lwi r4,(CYGHWR_HAL_POWERPC_VECTOR_BASE - 4) + lwi r5,rom_vectors_end-4 +0: lwzu r0,4(r3) + stwu r0,4(r4) + cmplw r3,r5 + bne 0b +#endif # set up stack lwi sp,__interrupt_stack diff --git a/packages/hal/powerpc/cme555/current/ChangeLog b/packages/hal/powerpc/cme555/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/ChangeLog @@ -0,0 +1,43 @@ +2002-05-13 Jesper Skov + + * cdl/hal_powerpc_cme555.cdl: Removed implemntation of + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + +2002-04-24 Bob Koninckx + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/powerpc/cme555/current/cdl/hal_powerpc_cme555.cdl b/packages/hal/powerpc/cme555/current/cdl/hal_powerpc_cme555.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/cdl/hal_powerpc_cme555.cdl @@ -0,0 +1,294 @@ +# ==================================================================== +# +# hal_powerpc_cme555.cdl +# +# PowerPC/cme555 board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Bob Koninckx +# Original data: bartv +# Contributors: +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_POWERPC_CME555 { + display "CME555 MPC555 evaluation board" + parent CYGPKG_HAL_POWERPC + requires CYGPKG_HAL_POWERPC_MPC5xx + define_header hal_powerpc_cme555.h + include_dir cyg/hal + description " + The CME555 HAL package provides the support needed to run + eCos on Axiom's CME555 MPC555 evaluation board." + + compile hal_diag.c plf_misc.c cme555.S plf_stub.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM"} + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the CME555 board it is possible to build + the system for either RAM bootstrap or ROM bootstrap. RAM + bootstrap requires that the MPC555 internal flash contains a + suitable ROM monitor or equivalent software that allows GDB + to download the eCos application on to the board. The ROM + bootstrap requires that the eCos application be blown into + the MPC555 internal flash array. Both types of startup require + the internal flash array to be enabled. Both startup types expect + the boards RAM to be present on CS0 and the external flash on + CS1. CS2 is not used by eCos and can e.g. be used for memory + mapped I/O by your application. Typical use of the board could be + to build GDB-stubs for ROM bootstrap, use AXIOM's monitor to + program it in internal flash, and then change the necessary + switches and jumpers to enable internal flash and get the memory + map right. Consult the CME555 manual to make sure you have all + jumper settings correct." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 2 + description " + The CME555 has two serial ports. Channel 0 is indicated as Comm1 + on the board, channel 1 has the indication Comm2." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to 1 + default_value 0 + description " + The CME555 has two serial ports. Channel 0 is indicated as Comm1 + on the board, channel 1 has the indication Comm2. This option + chooses which port will be used to connect to a host running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 1 + description " + The CME555 has two serial ports. Channel 0 is indicated as Comm1 + on the board, channel 1 has the indication Comm2. This option + chooses which port will be used for diagnostic output." + } + + cdl_option CYGHWR_HAL_POWERPC_BOARD_SPEED { + display "Development board clock speed (MHz)" + flavor data + calculated 40 + description " + The development boards is fitted with a 4MHz crystal. This frequency + is internally boosted to maximum 40MHz. The value is fixed to the + maximum since this board is not really suited for low power application + anyway." + } + + cdl_option CYGHWR_HAL_POWERPC_FORCE_VECTOR_BASE_LOW { + display "Force vector base at address 0x0000 0000" + flavor bool + calculated 1 + description " + The powerpc architecture allows the vectorbase to live at either + 0x0000 0000 or 0xfff0 0000. Since the CME-555 has no memory at the + high addresses, vectors may never be located at 0xfff0 0000 for this + board. They can be still be copied though if the internal flash is + disabled and relocated to somewhere else" + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Baud rate for serial ports" + flavor data + legal_values 300 600 1200 2400 4800 9600 14400 19200 28800 38400 57600 115200 + default_value 38400 + description " + This option determines the baud rate that will be used on both the console + cannel and the debug channel." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants." + description " + Period is busclock/16/100." + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated { (((CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000)/16)/100) } + } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "powerpc-eabi" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mcpu=505 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -mmultiple -fno-rtti -fno-exceptions -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-mcpu=505 -g -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "powerpc_cme555_ram" : \ + "powerpc_cme555_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } +} diff --git a/packages/hal/powerpc/cme555/current/include/hal_diag.h b/packages/hal/powerpc/cme555/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/include/hal_diag.h @@ -0,0 +1,92 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +//============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors:Bob Koninckx +// Date: 2001-12-16 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +#else // everything by steam + +//----------------------------------------------------------------------------- +// functions implemented in hal_diag.c + +externC void hal_diag_init(void); + +externC void hal_diag_write_char(char c); + +externC void hal_diag_read_char(char *c); + +//----------------------------------------------------------------------------- + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +//----------------------------------------------------------------------------- +// end of hal_diag.h +#endif // CYGONCE_HAL_HAL_DIAG_H diff --git a/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_ram.h b/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_ram.h @@ -0,0 +1,48 @@ +// eCos memory layout - Fri Oct 20 10:25:48 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include +#endif + +#define CYGMEM_REGION_rom (0x000000) +#define CYGMEM_REGION_rom_SIZE (0x06ffff) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_RO) + +#define CYGMEM_REGION_ram (0x400000) +#define CYGMEM_REGION_ram_SIZE (0x07ffff) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#define CYGMEM_REGION_iram (0x3f9800) +#define CYGMEM_REGION_iram_SIZE (0x006800) +#define CYGMEM_REGION_iram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#define CYGMEM_REGION_eflash (0x800000) +#define CYGMEM_REGION_eflash_SIZE (0x07ffff) +#define CYGMEM_REGION_eflash_ATTR (CYGMEM_REGION_ATTR_RO) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_vectors) []; +#endif +#define CYGMEM_SECTION_reserved_vectors (CYG_LABEL_NAME (__reserved_vectors)) +#define CYGMEM_SECTION_reserved_vectors_SIZE (0x2000) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_vsr_table) []; +#endif +#define CYGMEM_SECTION_reserved_vsr_table (CYG_LABEL_NAME (__reserved_vsr_table)) +#define CYGMEM_SECTION_reserved_vsr_table_SIZE (0x200) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_virtual_table) []; +#endif +#define CYGMEM_SECTION_reserved_virtual_table (CYG_LABEL_NAME (__reserved_virtual_table)) +#define CYGMEM_SECTION_reserved_virtual_table_SIZE (0x100) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x00480000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_ram.ldi b/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_ram.ldi @@ -0,0 +1,35 @@ + +#include + +MEMORY +{ + rom : ORIGIN = 0x00000000, LENGTH = 0x0006ffff /* internal flash */ + ram(WA) : ORIGIN = 0x00400000, LENGTH = 0x0007ffff /* external RAM */ + iram(WA) : ORIGIN = 0x003f9800, LENGTH = 0x00006800 /* internal RAM */ + eflash(RXIW) : ORIGIN = 0x00800000, LENGTH = 0x0007ffff /* external FLASH */ +} + +SECTIONS +{ + SECTIONS_BEGIN + CYG_LABEL_DEFN(__reserved_vectors) = 0x00000000; + + . = 0x3f9800; + CYG_LABEL_DEFN(__reserved_vsr_table) = ALIGN (0x10); + . = CYG_LABEL_DEFN(__reserved_vsr_table) + 0x200; + CYG_LABEL_DEFN(__reserved_virtual_table) = ALIGN (0x10); + . = 0x00400000; + + SECTION_vectors (ram, 0x00400000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_sbss (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_rom.h b/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_rom.h @@ -0,0 +1,48 @@ +// eCos memory layout - Fri Oct 20 10:25:48 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include +#endif + +#define CYGMEM_REGION_rom (0x000000) +#define CYGMEM_REGION_rom_SIZE (0x06ffff) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_RO) + +#define CYGMEM_REGION_ram (0x400000) +#define CYGMEM_REGION_ram_SIZE (0x07ffff) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#define CYGMEM_REGION_iram (0x3f9800) +#define CYGMEM_REGION_iram_SIZE (0x006800) +#define CYGMEM_REGION_iram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#define CYGMEM_REGION_eflash (0x800000) +#define CYGMEM_REGION_eflash_SIZE (0x07ffff) +#define CYGMEM_REGION_eflash_ATTR (CYGMEM_REGION_ATTR_RO) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_vectors) []; +#endif +#define CYGMEM_SECTION_reserved_vectors (CYG_LABEL_NAME (__reserved_vectors)) +#define CYGMEM_SECTION_reserved_vectors_SIZE (0x2000) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_vsr_table) []; +#endif +#define CYGMEM_SECTION_reserved_vsr_table (CYG_LABEL_NAME (__reserved_vsr_table)) +#define CYGMEM_SECTION_reserved_vsr_table_SIZE (0x200) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_virtual_table) []; +#endif +#define CYGMEM_SECTION_reserved_virtual_table (CYG_LABEL_NAME (__reserved_virtual_table)) +#define CYGMEM_SECTION_reserved_virtual_table_SIZE (0x100) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x00480000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_rom.ldi b/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/include/pkgconf/mlt_powerpc_cme555_rom.ldi @@ -0,0 +1,41 @@ + +#include + +MEMORY +{ + rom : ORIGIN = 0x00000000, LENGTH = 0x0006ffff /* internal flash */ + ram(WA) : ORIGIN = 0x00400000, LENGTH = 0x0007ffff /* external RAM */ + iram(WA) : ORIGIN = 0x003f9800, LENGTH = 0x00006800 /* internal RAM */ + eflash(RXIW) : ORIGIN = 0x00800000, LENGTH = 0x0007ffff /* external FLASH */ +} + +SECTIONS +{ + SECTIONS_BEGIN + + CYG_LABEL_DEFN(__reserved_vectors) = 0x00000000; + + SECTION_vectors (rom, 0x00000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + + . = 0x3f9800; + CYG_LABEL_DEFN(__reserved_vsr_table) = ALIGN (0x10); + . = CYG_LABEL_DEFN(__reserved_vsr_table) + 0x200; + CYG_LABEL_DEFN(__reserved_virtual_table) = ALIGN (0x10); + . = CYG_LABEL_DEFN(__reserved_virtual_table) + 0x100; + + SECTION_data (iram, ALIGN (0x10), FOLLOWING (.gcc_except_table)) + SECTION_sbss (iram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (iram, ALIGN (0x10), LMA_EQ_VMA) + + . = 0x400000; + + CYG_LABEL_DEFN(__heap1) = ALIGN(0x8); + + SECTIONS_END +} diff --git a/packages/hal/powerpc/cme555/current/include/plf_cache.h b/packages/hal/powerpc/cme555/current/include/plf_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/include/plf_cache.h @@ -0,0 +1,67 @@ +#ifndef CYGONCE_PLF_CACHE_H +#define CYGONCE_PLF_CACHE_H + +//============================================================================= +// +// plf_cache.h +// +// Platform HAL cache details +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors:Bob Koninckx +// Date: 2001-12-10 +// Purpose: Platform cache control API +// Description: The macros defined here provide the platform specific +// cache control operations / behavior. +// Usage: Is included via the architecture cache header: +// #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//--------------------------------------------------------------------------- +// Initial cache enabling +// MPC555 does not have any cache, disable caches completely +#undef CYGPRI_INIT_CACHES +#undef CYGPRI_ENABLE_CACHES + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_PLF_CACHE_H +// End of plf_cache.h diff --git a/packages/hal/powerpc/cme555/current/include/plf_intr.h b/packages/hal/powerpc/cme555/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/include/plf_intr.h @@ -0,0 +1,69 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// cme555 platform specific interrupt definitions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2001-12-15 +// Purpose: Define platform specific interrupt support +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +//---------------------------------------------------------------------------- +// Reset. +#define HAL_PLATFORM_RESET() CYG_EMPTY_STATEMENT + +#define HAL_PLATFORM_RESET_ENTRY 0x00000100 + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/powerpc/cme555/current/include/plf_stub.h b/packages/hal/powerpc/cme555/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/include/plf_stub.h @@ -0,0 +1,92 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors:Bob Koninckx +// Date: 2001-12-16 +// Purpose: Platform HAL stub support for PowerPC/cme555 boards. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include + +#ifdef CYGPKG_IO_SERIAL +#include +#endif + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM, externC + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +//---------------------------------------------------------------------------- +// Stub initializer. +extern void hal_plf_stub_init( void ); +#define HAL_STUB_PLATFORM_INIT() hal_plf_stub_init(); + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/powerpc/cme555/current/misc/redboot_RAM.ecm b/packages/hal/powerpc/cme555/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/misc/redboot_RAM.ecm @@ -0,0 +1,284 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware cme555 ; + template default ; + package -hardware CYGPKG_HAL_POWERPC current ; + package -hardware CYGPKG_HAL_POWERPC_MPC5xx current ; + package -hardware CYGPKG_HAL_POWERPC_CME555 current ; + package -hardware CYGPKG_DEVS_FLASH_MPC5XX current ; + package -hardware CYGPKG_DEVS_FLASH_MOTOROLA_CDRMONET current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package CYGPKG_REDBOOT current ; + package CYGPKG_LIBC current ; + package CYGPKG_LIBC_STRING current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_IO_FLASH current ; +}; + +cdl_option CYGBLD_GLOBAL_CFLAGS { + user_value "-mcpu=505 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -mmultiple -fno-rtti -fno-exceptions -finit-priority" +}; + +cdl_option CYGBLD_GLOBAL_LDFLAGS { + user_value "-mcpu=505 -g -nostdlib -Wl,--gc-sections -Wl,-static" +}; + +cdl_option CYGBLD_BUILD_COMMON_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGFUN_HAL_COMMON_KERNEL_SUPPORT { + user_value 0 +}; + +cdl_component CYGDBG_HAL_DIAG_TO_DEBUG_CHAN { + user_value 0 +}; + +cdl_option CYGSEM_HAL_DIAG_MANGLER { + user_value GDB +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 16384 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + user_value 0 +}; + +cdl_option CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP { + user_value 0 +}; + +cdl_option CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP { + user_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + user_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + user_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + user_value 0 +}; + +cdl_option CYGSEM_HAL_VIRTUAL_VECTOR_CLAIM_COMMS { + user_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + user_value 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 0 +}; + +cdl_option CYGSEM_HAL_POWERPC_COPY_VECTORS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_POWERPC_FRAME_WALLS { + user_value 0 +}; + +cdl_component CYGPKG_HAL_POWERPC_MPC555 { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_POWERPC_FPU { + user_value 1 +}; + +cdl_option CYGSEM_HAL_POWERPC_IEEE_FLOATING_POINT { + user_value 0 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_OCD_ENABLE { + user_value 0 +}; + +cdl_option CYGHWR_HAL_POWERPC_MPC5XX_IFLASH_ENABLE { + user_value 1 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_IFLASH_DUAL_MAP { + user_value 0 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_IMB3_ARBITER { + user_value 0 +}; + +cdl_option CYGBLD_BUILD_VERSION_TOOL { + user_value 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + user_value 1 +}; + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + user_value 38400 +}; + +cdl_option CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMCPY { + user_value 1 +}; + +cdl_option CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMSET { + user_value 1 +}; + +cdl_option CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS { + user_value 0 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_ZLIB { + user_value 0 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_THREADS { + user_value 0 +}; + +cdl_option CYGDAT_REDBOOT_CUSTOM_VERSION { + user_value 1 "CME555/MPC555 RAM-Startup" +}; + +cdl_option CYGNUM_REDBOOT_CMD_LINE_EDITING { + user_value 0 +}; + +cdl_option CYGSEM_REDBOOT_VARIABLE_BAUD_RATE { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00008000 +}; + +cdl_option CYGBLD_REDBOOT_FLASH_BOOT_OFFSET { + user_value 0x00000000 +}; + +cdl_option CYGNUM_REDBOOT_FLASH_RESERVED_BASE { + user_value 0x00000000 +}; + +cdl_option CYGOPT_REDBOOT_FIS { + user_value 0 +}; + +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 0 +}; + +cdl_option CYGIMP_LIBC_STRING_INLINES { + user_value 1 +}; + +cdl_option CYGIMP_LIBC_STRING_PREFER_SMALL_TO_FAST { + user_value 1 +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGBLD_ISO_CTYPE_HEADER { + user_value 0 0 +}; + +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_FLOAT_HEADER { + user_value 0 0 +}; + +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRERROR_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_MOTOROLA_CMF5 { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_MOTOROLA_CMF6 { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_MOTOROLA_CMF7 { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_MOTOROLA_CMF9 { + user_value 1 +}; + + diff --git a/packages/hal/powerpc/cme555/current/misc/redboot_ROM.ecm b/packages/hal/powerpc/cme555/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/misc/redboot_ROM.ecm @@ -0,0 +1,265 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware cme555 ; + template default ; + package -hardware CYGPKG_HAL_POWERPC current ; + package -hardware CYGPKG_HAL_POWERPC_MPC5xx current ; + package -hardware CYGPKG_HAL_POWERPC_CME555 current ; + package -hardware CYGPKG_DEVS_FLASH_CME555 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package CYGPKG_REDBOOT current ; + package CYGPKG_LIBC current ; + package CYGPKG_LIBC_STRING current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGBLD_GLOBAL_CFLAGS { + user_value "-mcpu=505 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -mmultiple -fno-rtti -fno-exceptions -finit-priority" +}; + +cdl_option CYGBLD_GLOBAL_LDFLAGS { + user_value "-mcpu=505 -g -nostdlib -Wl,--gc-sections -Wl,-static" +}; + +cdl_option CYGBLD_BUILD_COMMON_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGFUN_HAL_COMMON_KERNEL_SUPPORT { + user_value 0 +}; + +cdl_component CYGDBG_HAL_DIAG_TO_DEBUG_CHAN { + user_value 0 +}; + +cdl_option CYGSEM_HAL_DIAG_MANGLER { + user_value GDB +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + user_value 0 +}; + +cdl_option CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP { + user_value 0 +}; + +cdl_option CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP { + user_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + user_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + user_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGSEM_HAL_POWERPC_COPY_VECTORS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_POWERPC_FRAME_WALLS { + user_value 0 +}; + +cdl_component CYGPKG_HAL_POWERPC_MPC555 { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_POWERPC_FPU { + user_value 1 +}; + +cdl_option CYGSEM_HAL_POWERPC_IEEE_FLOATING_POINT { + user_value 0 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_OCD_ENABLE { + user_value 0 +}; + +cdl_option CYGHWR_HAL_POWERPC_MPC5XX_IFLASH_ENABLE { + user_value 1 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_IFLASH_DUAL_MAP { + user_value 0 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_IMB3_ARBITER { + user_value 0 +}; + +cdl_option CYGBLD_BUILD_VERSION_TOOL { + user_value 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + user_value 1 +}; + +cdl_option CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMCPY { + user_value 1 +}; + +cdl_option CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMSET { + user_value 1 +}; + +cdl_option CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS { + user_value 0 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_ZLIB { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_THREADS { + user_value 1 +}; + +cdl_option CYGDAT_REDBOOT_CUSTOM_VERSION { + user_value 1 "CME555/MPC555 ROM-Startup" +}; + +cdl_option CYGNUM_REDBOOT_CMD_LINE_EDITING { + user_value 0 +}; + +cdl_option CYGPKG_REDBOOT_ANY_CONSOLE { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00020000 +}; + +cdl_option CYGBLD_REDBOOT_FLASH_BOOT_OFFSET { + user_value 0x00000000 +}; + +cdl_option CYGNUM_REDBOOT_FLASH_RESERVED_BASE { + user_value 0x00000000 +}; + +cdl_option CYGIMP_LIBC_STRING_INLINES { + user_value 1 +}; + +cdl_option CYGIMP_LIBC_STRING_PREFER_SMALL_TO_FAST { + user_value 1 +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGBLD_ISO_CTYPE_HEADER { + user_value 0 0 +}; + +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_FLOAT_HEADER { + user_value 0 0 +}; + +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRERROR_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGNUM_FLASH_WORKSPACE_SIZE { + user_value 0x00000000 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV200 { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_ST_M29W200B { + user_value 1 +}; + +cdl_option CYGSEM_COMPRESS_ZLIB_NEEDS_MALLOC { + user_value 0 +}; + + diff --git a/packages/hal/powerpc/cme555/current/src/cme555.S b/packages/hal/powerpc/cme555/current/src/cme555.S new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/src/cme555.S @@ -0,0 +1,183 @@ +##============================================================================= +## +## cme555.S +## +## CME555 board hardware setup +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): Bob Koninckx +## Contributors:Bob Koninckx +## Date: 2001-12-15 +## Purpose: cme555 board hardware setup +## Description: This file contains any code needed to initialize the +## hardware on a cme555 mpc555 board. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include +#include + +#------------------------------------------------------------------------------ + + .globl hal_hardware_init +hal_hardware_init: + +#if defined(CYGPKG_HAL_POWERPC_CME555) && defined(CYGPKG_HAL_POWERPC_MPC5xx) + lwi r3, CYGARC_REG_IMM_BASE # Base address of control registers + + // Configure external interrupt pins as General purpose I/O. They do not + // have pull-up resistors on the CME555. Add to that that IRQ0 triggers + // a non-maskable reset of the board ... This one gave me nightmares ... + lwi r4, 0x00000800 + stw r4, (CYGARC_REG_IMM_SIUMCR-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0xff88 + stw r4, (CYGARC_REG_IMM_SYPCR-CYGARC_REG_IMM_BASE)(r3) + + // Memory map + // CS0 configuration + // Base address 0x400000, no burst support, 32 bit wide data port + // Valid addresses till 0x43FFFF, no wait states + lwi r4, 0x00400003 + stw r4, (CYGARC_REG_IMM_BR0-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0xfff80002 + stw r4, (CYGARC_REG_IMM_OR0-CYGARC_REG_IMM_BASE)(r3) + + // CS1 configuration + // Base address 0x800000, no burst support, 32 bit wide data port + // Valid adresses till 0x87FFFF, three wait states for access time 70ns + lwi r4, 0x00800003 + stw r4, (CYGARC_REG_IMM_BR1-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0xfff80032 + stw r4, (CYGARC_REG_IMM_OR1-CYGARC_REG_IMM_BASE)(r3) + + // CS2 configuration + // Base address 0xc00000, no burst support, 32 bit wide data port + // Valid adresses till 0xc7FFFF, maximum wait states + lwi r4, 0x00c00003 + stw r4, (CYGARC_REG_IMM_BR2-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0xfff800f2 + stw r4, (CYGARC_REG_IMM_OR2-CYGARC_REG_IMM_BASE)(r3) + + // CS3 configuration + // works for keypad/LCD + // maximum wait states + lwi r4, 0x01000403 + stw r4, (CYGARC_REG_IMM_BR3-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0xfffe0ff1 + stw r4, (CYGARC_REG_IMM_OR3-CYGARC_REG_IMM_BASE)(r3) + + // And some other configuration registers +#if defined(CYGSEM_HAL_POWERPC_MPC5XX_IFLASH_DUAL_MAP) + lwi r4, 1 +#else + lwi r4, 0 +#endif + stw r4, (CYGARC_REG_IMM_DMBR-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0 + stw r4, (CYGARC_REG_IMM_DMOR-CYGARC_REG_IMM_BASE)(r3) + + // Limb mode enable, TMBCLK = BUS/16, RTCCLK = Crystal / 16 + // generate 40 MHz bus clock + lwi r4, 0x3010000 + stw r4, (CYGARC_REG_IMM_SCCR-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0x900000 + stw r4, (CYGARC_REG_IMM_PLPRCR-CYGARC_REG_IMM_BASE)(r3) + + // Enable the time base and set the freeze flag + lwi r4, 0x03 + sth r4, (CYGARC_REG_IMM_TBSCR-CYGARC_REG_IMM_BASE)(r3) + + // Unlock the RTC register set + lwi r4, 0x55ccaa33 + stw r4, (CYGARC_REG_IMM_RTCSCK-CYGARC_REG_IMM_BASE)(r3) + // RTC is clocked by 4MHz crystal, set the freeze flag + lwi r4, 0x12 + sth r4, (CYGARC_REG_IMM_RTCSC-CYGARC_REG_IMM_BASE)(r3) + // Set the freeze flag for the Periodic interrupt timer + lwi r4, 0x02 + sth r4, (CYGARC_REG_IMM_PISCR-CYGARC_REG_IMM_BASE)(r3) + + lwi r4, 0x00 + lwi r5, (CYGARC_REG_IMM_DPTMCR-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + + lwi r4, 0xffa0 + lwi r5, (CYGARC_REG_IMM_RAMBAR-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + + lwi r4, 0x00 + lwi r5, (CYGARC_REG_IMM_PORTQS-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + + lwi r4, 0x00 + lwi r5, (CYGARC_REG_IMM_PQSPAR_DDRQST-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_MPIOSMDR-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_MPIOSMDDR-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_MIOS1TPCR-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_SRAMMCR_A-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + + lwi r4, 0x00000000 + lwi r5, (CYGARC_REG_IMM_SGPIODT1-CYGARC_REG_IMM_BASE) + stwx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_SGPIODT2-CYGARC_REG_IMM_BASE) + stwx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_SGPIOCR-CYGARC_REG_IMM_BASE) + stwx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_EMCR-CYGARC_REG_IMM_BASE) + stwx r4, r3, r5 + + // Enable 32 interrupt priorities on the IMB3 unit + lwi r4, 0x60000000 + lwi r5, (CYGARC_REG_IMM_UMCR-CYGARC_REG_IMM_BASE) + stwx r4, r3, r5 +#endif + + sync + blr + +#------------------------------------------------------------------------------ +# end of cme555.S diff --git a/packages/hal/powerpc/cme555/current/src/hal_diag.c b/packages/hal/powerpc/cme555/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/src/hal_diag.c @@ -0,0 +1,620 @@ +//============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2001-12-11 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include // our header. + +#include // base types, externC +#include // CYG_ISR_HANDLED +#include // Helper functions +#include // IO macros +#include // Interrupt macros + +#include // SAVE/RESTORE GP +#include // Calling-if API + + +static void cyg_hal_plf_serial_init(void); + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +//============================================================================= +// Serial driver +//============================================================================= + +//----------------------------------------------------------------------------- +// There are two serial ports. +#define CYG_DEV_SERIAL_BASE_A 0x305008 // SCI0 +#define CYG_DEV_SERIAL_BASE_B 0x305020 // SCI1 + +//----------------------------------------------------------------------------- +// Define CYG_DEVICE_SERIAL_RS232_SCIBR +// Default baudrate is 38400 +// These values are calculated for a 40Mhz clock frequency +// This should be enough, we did not provide clock frequency as a configuration +// option anyway +#define CYG_DEV_SERIAL_RS232_SCxBR_300 4167 +#define CYG_DEV_SERIAL_RS232_SCxBR_600 2083 +#define CYG_DEV_SERIAL_RS232_SCxBR_1200 1042 +#define CYG_DEV_SERIAL_RS232_SCxBR_2400 521 +#define CYG_DEV_SERIAL_RS232_SCxBR_4800 260 +#define CYG_DEV_SERIAL_RS232_SCxBR_9600 130 +#define CYG_DEV_SERIAL_RS232_SCxBR_14400 87 +#define CYG_DEV_SERIAL_RS232_SCxBR_19200 65 +#define CYG_DEV_SERIAL_RS232_SCxBR_28800 43 +#define CYG_DEV_SERIAL_RS232_SCxBR_38400 33 +#define CYG_DEV_SERIAL_RS232_SCxBR_57600 22 +#define CYG_DEV_SERIAL_RS232_SCxBR_115200 11 + +//----------------------------------------------------------------------------- +// Define the serial registers. +#define CYG_DEV_SERIAL_RS232_SCCR0 0x00 +#define CYG_DEV_SERIAL_RS232_SCCR1 0x01 +#define CYG_DEV_SERIAL_RS232_SCSR 0x02 +#define CYG_DEV_SERIAL_RS232_SCDR 0x03 + +#define SCCR0_OTHR 0x8000 // Select baud rate other than system clock +#define SCCR0_LINKBD 0x4000 // Link baud +#define SCCR0_SCxBR 0x1fff // SCI baud rate + +#define SCCR1_LOOPS 0x4000 // Loop mode +#define SCCR1_WOMS 0x2000 // Wired or for SCI pins +#define SCCR1_ILT 0x1000 // Idle line detect type +#define SCCR1_PT 0x0800 // Parity type (0 = Odd, 1 = Even) +#define SCCR1_PE 0x0400 // Parity enable +#define SCCR1_M 0x0200 // Mode select (0 = 10 bit frame, 1 = 11 bit frame) +#define SCCR1_WAKE 0x0100 // Wakeup by address mark +#define SCCR1_TIE 0x0080 // Transmit interrupt enable +#define SCCR1_TCIE 0x0040 // Transmit complete interrupt enable +#define SCCR1_RIE 0x0020 // Receiver interrupt enable +#define SCCR1_ILIE 0x0010 // Idle line interrupt enable +#define SCCR1_TE 0x0008 // Transmiter enable +#define SCCR1_RE 0x0004 // Receiver enable +#define SCCR1_RWU 0x0002 // Receiver wakeup +#define SCCR1_SBK 0x0001 // Send break + +#define SCSR_TDRE 0x0100 // Transmit data register empty +#define SCSR_TC 0x0080 // Transmit complete +#define SCSR_RDRF 0x0040 // Receive data register full +#define SCSR_RAF 0x0020 // Receive active flag +#define SCSR_IDLE 0x0010 // Idle line detected +#define SCSR_OR 0x0008 // Overrun error +#define SCSR_NF 0x0004 // Noise error flag +#define SCSR_FE 0x0002 // Framing error +#define SCSR_PF 0x0001 // Parity error + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint16* base; + cyg_int32 msec_timeout; + int siu_vector; + int imb3_vector; + unsigned int level; + int baud_rate; +} channel_data_t; + +//----------------------------------------------------------------------------- +static void +init_serial_channel(const channel_data_t* __ch_data) +{ + cyg_uint16 * base = __ch_data->base; + cyg_uint16 br; + + switch(__ch_data->baud_rate) + { + case 300: + br = CYG_DEV_SERIAL_RS232_SCxBR_300; + break; + case 600: + br = CYG_DEV_SERIAL_RS232_SCxBR_600; + break; + case 1200: + br = CYG_DEV_SERIAL_RS232_SCxBR_1200; + break; + case 2400: + br = CYG_DEV_SERIAL_RS232_SCxBR_2400; + break; + case 4800: + br = CYG_DEV_SERIAL_RS232_SCxBR_4800; + break; + case 9600: + br = CYG_DEV_SERIAL_RS232_SCxBR_9600; + break; + case 14400: + br = CYG_DEV_SERIAL_RS232_SCxBR_14400; + break; + case 19200: + br = CYG_DEV_SERIAL_RS232_SCxBR_19200; + break; + case 28800: + br = CYG_DEV_SERIAL_RS232_SCxBR_28800; + break; + case 38400: + br = CYG_DEV_SERIAL_RS232_SCxBR_38400; + break; + case 57600: + br = CYG_DEV_SERIAL_RS232_SCxBR_57600; + break; + case 115200: + br = CYG_DEV_SERIAL_RS232_SCxBR_115200; + break; + default: + // Use the default if something unknown is requested + br = CYG_DEV_SERIAL_RS232_SCxBR_38400; + break; + } + + // 8-1-No parity + HAL_WRITE_UINT16(base+CYG_DEV_SERIAL_RS232_SCCR1, (SCCR1_TE | SCCR1_RE)); + + // Set baud rate + HAL_WRITE_UINT16(base+CYG_DEV_SERIAL_RS232_SCCR0, br); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint16 status; + cyg_uint16 result; + cyg_uint16 * base = ((channel_data_t *)__ch_data)->base; + + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCSR, status); + if((status & SCSR_RDRF) == 0) + return false; + + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCDR, result); + *ch = (cyg_uint8)(result & 0x00ff); + + return true; +} + + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +void +cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 c) +{ + cyg_uint16 status; + cyg_uint16 * base = ((channel_data_t *)__ch_data)->base; + + CYGARC_HAL_SAVE_GP(); + + do { + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCSR, status); + } while((status & SCSR_TDRE) == 0); + + HAL_WRITE_UINT16(base+CYG_DEV_SERIAL_RS232_SCDR, (short)c); + + // Hang around until the character is safely sent + do { + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCSR, status); + } while((status & SCSR_TDRE) == 0); + + CYGARC_HAL_RESTORE_GP(); +} + +// Channel data +// Do NOT make them const, will cause problems when trying +// to change the timeout parameter ... (Is this a bug in other) +// PowerPC platform hals ?? You only see it when you really start from +// flash .... +static channel_data_t channels[2] = { + { (cyg_uint16*)CYG_DEV_SERIAL_BASE_A, + 1000, + CYGNUM_HAL_INTERRUPT_SIU_LVL0, + CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX, + 0, + CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD }, + { (cyg_uint16*)CYG_DEV_SERIAL_BASE_B, + 1000, + CYGNUM_HAL_INTERRUPT_SIU_LVL0, + CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX, + 0, + CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD } +}; + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_GETBAUD: + ret = chan->baud_rate; + break; + case __COMMCTL_SETBAUD: + { + va_list ap; + va_start(ap, __func); + + ret = chan->baud_rate; + chan->baud_rate = va_arg(ap, cyg_int32); + init_serial_channel(chan); + + va_end(ap); + } + break; + case __COMMCTL_IRQ_ENABLE: + HAL_INTERRUPT_SET_LEVEL(chan->imb3_vector, chan->level); + HAL_INTERRUPT_UNMASK(chan->imb3_vector); + HAL_INTERRUPT_UNMASK(chan->siu_vector); + irq_state = 1; + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + HAL_INTERRUPT_MASK(chan->imb3_vector); + HAL_INTERRUPT_MASK(chan->siu_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->siu_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + break; + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + + cyg_uint16 status; + cyg_uint16 control; + + cyg_uint16 * base = ((channel_data_t *)__ch_data)->base; + + CYGARC_HAL_SAVE_GP(); + + *__ctrlc = 0; + + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCSR, status); + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCCR1, control); + + if((status & SCSR_RDRF) && (control & SCCR1_RIE)) + { // Only if the interrupt was caused by the channel + cyg_uint8 c; + c = cyg_hal_plf_serial_getc(__ch_data); + + if(cyg_hal_is_break(&c, 1)) + *__ctrlc = 1; + + HAL_INTERRUPT_ACKNOWLEDGE(((channel_data_t *)__ch_data)->imb3_vector); + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(channels[0].imb3_vector); + HAL_INTERRUPT_MASK(channels[1].imb3_vector); + + // Init channels + init_serial_channel(&channels[0]); + init_serial_channel(&channels[1]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Set channel 1 + CYGACC_CALL_IF_SET_CONSOLE_COMM(1); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[1]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +//============================================================================= +// Compatibility with older stubs +//============================================================================= +#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) +#include // CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION +#endif + +//----------------------------------------------------------------------------- +// Assumption: all diagnostic output must be GDB packetized unless +// this is a configuration for a stand-alone ROM system. +#if defined(CYG_HAL_STARTUP_ROM) && !defined(CYGSEM_HAL_ROM_MONITOR) +# define HAL_DIAG_USES_HARDWARE +#endif + +#if (CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL == 0) +# define __BASE ((cyg_uint16*)CYG_DEV_SERIAL_BASE_A) +#elif (CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL == 1) +# define __BASE ((cyg_uint16*)CYG_DEV_SERIAL_BASE_B) +#else +# error "LCD driver not (yet) implemented for cme555" +#endif + +static channel_data_t channel = { __BASE, 0, 0 }; + +#ifdef HAL_DIAG_USES_HARDWARE + +void hal_diag_init(void) +{ + init_serial_channel(&channel); +} + +void hal_diag_write_char(char __c) +{ + cyg_hal_plf_serial_putc(&channel, __c); +} + +void hal_diag_read_char(char *c) +{ + *c = cyg_hal_plf_serial_getc(&channel); +} + +#else // ifdef HAL_DIAG_USES_HARDWARE + +// Initialize diag port +void +hal_diag_init(void) +{ + // Init devices + init_serial_channel(&channel); +} + +void +hal_diag_write_char_serial( char c ) +{ + unsigned long __state; + HAL_DISABLE_INTERRUPTS(__state); + cyg_hal_plf_serial_putc(&channel, c); + HAL_RESTORE_INTERRUPTS(__state); +} + +void +hal_diag_read_char(char *c) +{ + *c = cyg_hal_plf_serial_getc(&channel); +} + +void +hal_diag_write_char(char c) +{ + static char line[100]; + static int pos = 0; + + // No need to send CRs + if( c == '\r' ) return; + + line[pos++] = c; + + if( c == '\n' || pos == sizeof(line) ) + { + CYG_INTERRUPT_STATE old; + + // Disable interrupts. This prevents GDB trying to interrupt us + // while we are in the middle of sending a packet. The serial + // receive interrupt will be seen when we re-enable interrupts + // later. + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old); +#else + HAL_DISABLE_INTERRUPTS(old); +#endif + + while(1) + { + char c1; + static char hex[] = "0123456789ABCDEF"; + cyg_uint8 csum = 0; + int i; + + hal_diag_write_char_serial('$'); + hal_diag_write_char_serial('O'); + csum += 'O'; + for( i = 0; i < pos; i++ ) + { + char ch = line[i]; + char h = hex[(ch>>4)&0xF]; + char l = hex[ch&0xF]; + hal_diag_write_char_serial(h); + hal_diag_write_char_serial(l); + csum += h; + csum += l; + } + hal_diag_write_char_serial('#'); + hal_diag_write_char_serial(hex[(csum>>4)&0xF]); + hal_diag_write_char_serial(hex[csum&0xF]); + + // Wait for the ACK character '+' from GDB here and handle + // receiving a ^C instead. + hal_diag_read_char(&c1); + + if( c1 == '+' ) + break; // a good acknowledge + +#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + if( 3 == c1 ) { + // Ctrl-C: breakpoint. + cyg_hal_gdb_interrupt( + (target_register_t)__builtin_return_address(0)); + break; + } +#endif + // otherwise, loop round again + } + + pos = 0; + + // And re-enable interrupts +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old); +#else + HAL_RESTORE_INTERRUPTS(old); +#endif + + } +} + +#endif // ifdef HAL_DIAG_USES_HARDWARE + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +//----------------------------------------------------------------------------- +// End of hal_diag.c diff --git a/packages/hal/powerpc/cme555/current/src/plf_misc.c b/packages/hal/powerpc/cme555/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/src/plf_misc.c @@ -0,0 +1,79 @@ +//============================================================================= +// +// plf_misc.c +// +// Platform miscellaneous code/data. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors:Bob Koninckx +// Date: 2001-12-11 +// Purpose: Platform specific code and data +// Description: Tables for per-platform initialization +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include // HAL memory definitions +#include // hal_if_init + +#include // IO macros +#include // interrupt vectors +#include // Helper functions +#include // HANDLED +#include + +// The memory map is weakly defined, allowing the application to redefine +// it if necessary. Leave the table empty, the mpc555 has no cache ... +CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = { + CYGARC_MEMDESC_TABLE_END +}; + +void +hal_platform_init(void) +{ + hal_if_init(); + +#if defined CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + HAL_DIAG_INIT(); +#endif +} + +// EOF plf_misc.c diff --git a/packages/hal/powerpc/cme555/current/src/plf_stub.c b/packages/hal/powerpc/cme555/current/src/plf_stub.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/cme555/current/src/plf_stub.c @@ -0,0 +1,76 @@ +//============================================================================= +// +// plf_stub.c +// +// Platform specific code for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-02-12 +// Purpose: Platform specific code for GDB stub support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include +#include + +#define L1 "eCos ROM " __TIME__ "\r\n" +#define L2 __DATE__ "\r\n" + +void +hal_plf_stub_init(void) +{ +#if defined(CYGSEM_HAL_ROM_MONITOR) + // Put stub build date on the console + // This might change if someone provides + // driver for the LCD + hal_virtual_comm_table_t* comm; + + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_WRITE(*comm, L1, strlen(L1)); + CYGACC_COMM_IF_WRITE(*comm, L2, strlen(L2)); +#endif +} + +//----------------------------------------------------------------------------- +// End of plf_stub.c diff --git a/packages/hal/powerpc/cogent/current/ChangeLog b/packages/hal/powerpc/cogent/current/ChangeLog --- a/packages/hal/powerpc/cogent/current/ChangeLog +++ b/packages/hal/powerpc/cogent/current/ChangeLog @@ -1,3 +1,17 @@ +2002-05-13 Jesper Skov + + * cdl/hal_powerpc_cogent.cdl: Removed implemntation of + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + +2002-04-11 Gary Thomas + + * include/plf_cache.h: Cache control is in hal/common CDL. + +2002-01-25 Jesper Skov + + * src/cogent.S (hal_hardware_init): Set IMMR base. + * src/plf_misc.c: Change MMU mapping to follow IMMR base. + 2001-03-08 Jesper Skov * cdl/hal_powerpc_cogent.cdl: Does not guarantee virtual vector @@ -700,27 +714,36 @@ Mon Aug 17 22:13:41 1998 Jonathan Larmo Add GROUP(libgcc.a libtarget.a) to prevent need for explicit linking //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/powerpc/cogent/current/cdl/hal_powerpc_cogent.cdl b/packages/hal/powerpc/cogent/current/cdl/hal_powerpc_cogent.cdl --- a/packages/hal/powerpc/cogent/current/cdl/hal_powerpc_cogent.cdl +++ b/packages/hal/powerpc/cogent/current/cdl/hal_powerpc_cogent.cdl @@ -5,29 +5,38 @@ # PowerPC/Cogent board HAL package configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # @@ -55,7 +64,6 @@ cdl_package CYGPKG_HAL_POWERPC_COGENT { implements CYGINT_HAL_DEBUG_GDB_STUBS implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT - implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED define_proc { puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " diff --git a/packages/hal/powerpc/cogent/current/include/hal_diag.h b/packages/hal/powerpc/cogent/current/include/hal_diag.h --- a/packages/hal/powerpc/cogent/current/include/hal_diag.h +++ b/packages/hal/powerpc/cogent/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/cogent/current/include/plf_cache.h b/packages/hal/powerpc/cogent/current/include/plf_cache.h --- a/packages/hal/powerpc/cogent/current/include/plf_cache.h +++ b/packages/hal/powerpc/cogent/current/include/plf_cache.h @@ -8,29 +8,38 @@ // Platform HAL cache details // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -48,15 +57,13 @@ //============================================================================= //--------------------------------------------------------------------------- -// Initial cache enabling +// Initial cache enabling - controlled by common CDL. + // Cogent board doesn't support burst access to the ROM and on the // MPC8xx caches require burst. #ifdef CYG_HAL_STARTUP_ROM -# define CYGPRI_INIT_CACHES -# undef CYGPRI_ENABLE_CACHES -#else -# define CYGPRI_INIT_CACHES -# define CYGPRI_ENABLE_CACHES +#undef CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP +#undef CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP #endif //----------------------------------------------------------------------------- diff --git a/packages/hal/powerpc/cogent/current/include/plf_intr.h b/packages/hal/powerpc/cogent/current/include/plf_intr.h --- a/packages/hal/powerpc/cogent/current/include/plf_intr.h +++ b/packages/hal/powerpc/cogent/current/include/plf_intr.h @@ -8,29 +8,38 @@ // Cogent/CMA28x platform specific interrupt definitions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/cogent/current/include/plf_stub.h b/packages/hal/powerpc/cogent/current/include/plf_stub.h --- a/packages/hal/powerpc/cogent/current/include/plf_stub.h +++ b/packages/hal/powerpc/cogent/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/cogent/current/src/cogent.S b/packages/hal/powerpc/cogent/current/src/cogent.S --- a/packages/hal/powerpc/cogent/current/src/cogent.S +++ b/packages/hal/powerpc/cogent/current/src/cogent.S @@ -5,29 +5,38 @@ ## Cogent board hardware setup ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## @@ -57,7 +66,8 @@ hal_hardware_init: # Set up MPC8xx mapping registers for cogent lwi r3,CYGARC_REG_IMM_BASE # base address of control registers - + mtspr CYGARC_REG_IMMR,r3 + # Set timebase divisor to busclock/16, pitrtc divisor to 512. lwz r4,(CYGARC_REG_IMM_SCCR - CYGARC_REG_IMM_BASE)(r3) lwi r5,(CYGARC_REG_IMM_SCCR_RTDIV | CYGARC_REG_IMM_SCCR_RTSEL | CYGARC_REG_IMM_SCCR_TBS) diff --git a/packages/hal/powerpc/cogent/current/src/hal_diag.c b/packages/hal/powerpc/cogent/current/src/hal_diag.c --- a/packages/hal/powerpc/cogent/current/src/hal_diag.c +++ b/packages/hal/powerpc/cogent/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/cogent/current/src/plf_misc.c b/packages/hal/powerpc/cogent/current/src/plf_misc.c --- a/packages/hal/powerpc/cogent/current/src/plf_misc.c +++ b/packages/hal/powerpc/cogent/current/src/plf_misc.c @@ -5,29 +5,38 @@ // Platform miscellaneous code/data. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -55,7 +64,7 @@ CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = { // Mapping for the Cogent CMA101/102 boards. CYGARC_MEMDESC_NOCACHE( 0xfff00000, 0x00100000 ), // ROM region - CYGARC_MEMDESC_NOCACHE( 0xff000000, 0x00100000 ), // MCP registers + CYGARC_MEMDESC_NOCACHE( CYGARC_REG_IMM_BASE, 0x00100000 ), // MCP registers CYGARC_MEMDESC_NOCACHE( 0x0e000000, 0x01000000 ), // IO registers CYGARC_MEMDESC_CACHE( 0x00000000, 0x00800000 ), // Main memory diff --git a/packages/hal/powerpc/cogent/current/src/plf_stub.c b/packages/hal/powerpc/cogent/current/src/plf_stub.c --- a/packages/hal/powerpc/cogent/current/src/plf_stub.c +++ b/packages/hal/powerpc/cogent/current/src/plf_stub.c @@ -5,29 +5,38 @@ // Platform specific code for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/ec555/current/ChangeLog b/packages/hal/powerpc/ec555/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/ChangeLog @@ -0,0 +1,43 @@ +2002-05-13 Jesper Skov + + * cdl/hal_powerpc_ec555.cdl: Removed implemntation of + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + +2002-04-24 Bob Koninckx + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/powerpc/ec555/current/cdl/hal_powerpc_ec555.cdl b/packages/hal/powerpc/ec555/current/cdl/hal_powerpc_ec555.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/cdl/hal_powerpc_ec555.cdl @@ -0,0 +1,283 @@ +# ==================================================================== +# +# hal_powerpc_cme555.cdl +# +# PowerPC/cme555 board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Bob Koninckx +# Original data: bartv +# Contributors: +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_POWERPC_EC555 { + display "EC555 MPC555 development board" + parent CYGPKG_HAL_POWERPC + requires CYGPKG_HAL_POWERPC_MPC5xx + define_header hal_powerpc_ec555.h + include_dir cyg/hal + description " + The EC555 HAL package provides the support needed to run + eCos on an EC555 development board from Wuerz elektronik." + + compile hal_diag.c plf_misc.c ec555.S plf_stub.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM"} + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the ec555 board it is possible to build + the system for either RAM bootstrap or ROM bootstrap. RAM + bootstrap generally requires that the board + is equipped with ROMs containing a suitable ROM monitor or + equivalent software that allows GDB to download the eCos + application on to the board. The ROM bootstrap typically + requires that the eCos application be blown into EPROMs or + equivalent technology." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 2 + description " + Channel 0: Serial A, Channel 1: Serial B" + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to 1 + default_value 0 + description " + The ec555 board has two serial ports. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 1 + description " + The ec555 board has two serial ports. This option + chooses which port will be used for diagnostic output." + } + + cdl_option CYGHWR_HAL_POWERPC_BOARD_SPEED { + display "Development board clock speed (MHz)" + flavor data + default_value 40 + description " + The development boards is fitted with a 4MHz crystal. This frequency + is internally boosted to maximum 40MHz. The value is fixed to the + maximum." + } + + cdl_option CYGHWR_HAL_POWERPC_FORCE_VECTOR_BASE_LOW { + display "Force vector base at address 0x0000 0000" + flavor bool + calculated 1 + description " + The powerpc architecture allows the vectorbase to live at either + 0x0000 0000 or 0xfff0 0000. Since the CME-555 has no memory at the + high addresses, vectors may never be located at 0xfff0 0000 for this + board. They can be still be copied though if the internal flash is + disabled and relocated to somewhere else" + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Baud rate for serial ports" + flavor data + legal_values 300 600 1200 2400 4800 9600 14400 19200 28800 38400 57600 115200 + default_value 38400 + description " + This option determines the baud rate that will be used on both the console + cannel and the debug channel." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants." + description " + Period is busclock/16/100." + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated { (((CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000)/16)/100) } + } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "powerpc-eabi" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-mcpu=505 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -mmultiple -fno-rtti -fno-exceptions -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-mcpu=505 -g -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "powerpc_ec555_ram" : \ + "powerpc_ec555_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } +} diff --git a/packages/hal/powerpc/ec555/current/include/hal_diag.h b/packages/hal/powerpc/ec555/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/include/hal_diag.h @@ -0,0 +1,92 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +//============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors:Bob Koninckx +// Date: 2001-12-16 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +#else // everything by steam + +//----------------------------------------------------------------------------- +// functions implemented in hal_diag.c + +externC void hal_diag_init(void); + +externC void hal_diag_write_char(char c); + +externC void hal_diag_read_char(char *c); + +//----------------------------------------------------------------------------- + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +//----------------------------------------------------------------------------- +// end of hal_diag.h +#endif // CYGONCE_HAL_HAL_DIAG_H diff --git a/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_ram.h b/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_ram.h @@ -0,0 +1,48 @@ +// eCos memory layout - Fri Oct 20 10:25:48 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include +#endif + +#define CYGMEM_REGION_rom (0x000000) +#define CYGMEM_REGION_rom_SIZE (0x06ffff) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_RO) + +#define CYGMEM_REGION_ram (0x400000) +#define CYGMEM_REGION_ram_SIZE (0x0fffff) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#define CYGMEM_REGION_iram (0x3f9800) +#define CYGMEM_REGION_iram_SIZE (0x006800) +#define CYGMEM_REGION_iram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#define CYGMEM_REGION_eflash (0x800000) +#define CYGMEM_REGION_eflash_SIZE (0x1fffff) +#define CYGMEM_REGION_eflash_ATTR (CYGMEM_REGION_ATTR_RO) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_vectors) []; +#endif +#define CYGMEM_SECTION_reserved_vectors (CYG_LABEL_NAME (__reserved_vectors)) +#define CYGMEM_SECTION_reserved_vectors_SIZE (0x2000) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_vsr_table) []; +#endif +#define CYGMEM_SECTION_reserved_vsr_table (CYG_LABEL_NAME (__reserved_vsr_table)) +#define CYGMEM_SECTION_reserved_vsr_table_SIZE (0x200) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_virtual_table) []; +#endif +#define CYGMEM_SECTION_reserved_virtual_table (CYG_LABEL_NAME (__reserved_virtual_table)) +#define CYGMEM_SECTION_reserved_virtual_table_SIZE (0x100) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x00500000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_ram.ldi b/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_ram.ldi @@ -0,0 +1,35 @@ + +#include + +MEMORY +{ + rom : ORIGIN = 0x00000000, LENGTH = 0x0006ffff /* internal flash */ + ram(WA) : ORIGIN = 0x00400000, LENGTH = 0x000fffff /* external RAM */ + iram(WA) : ORIGIN = 0x003f9800, LENGTH = 0x00006800 /* internal RAM */ + eflash(RXIW) : ORIGIN = 0x00800000, LENGTH = 0x001fffff /* external FLASH */ +} + +SECTIONS +{ + SECTIONS_BEGIN + CYG_LABEL_DEFN(__reserved_vectors) = 0x00000000; + + . = 0x3f9800; + CYG_LABEL_DEFN(__reserved_vsr_table) = ALIGN (0x10); + . = CYG_LABEL_DEFN(__reserved_vsr_table) + 0x200; + CYG_LABEL_DEFN(__reserved_virtual_table) = ALIGN (0x10); + . = 0x00400000; + + SECTION_vectors (ram, 0x00400000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_sbss (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_rom.h b/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_rom.h @@ -0,0 +1,48 @@ +// eCos memory layout - Fri Oct 20 10:25:48 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include +#endif + +#define CYGMEM_REGION_rom (0x000000) +#define CYGMEM_REGION_rom_SIZE (0x06ffff) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_RO) + +#define CYGMEM_REGION_ram (0x400000) +#define CYGMEM_REGION_ram_SIZE (0x0fffff) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#define CYGMEM_REGION_iram (0x3f9800) +#define CYGMEM_REGION_iram_SIZE (0x006800) +#define CYGMEM_REGION_iram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#define CYGMEM_REGION_eflash (0x800000) +#define CYGMEM_REGION_eflash_SIZE (0x1fffff) +#define CYGMEM_REGION_eflash_ATTR (CYGMEM_REGION_ATTR_RO) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_vectors) []; +#endif +#define CYGMEM_SECTION_reserved_vectors (CYG_LABEL_NAME (__reserved_vectors)) +#define CYGMEM_SECTION_reserved_vectors_SIZE (0x2000) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_vsr_table) []; +#endif +#define CYGMEM_SECTION_reserved_vsr_table (CYG_LABEL_NAME (__reserved_vsr_table)) +#define CYGMEM_SECTION_reserved_vsr_table_SIZE (0x200) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_virtual_table) []; +#endif +#define CYGMEM_SECTION_reserved_virtual_table (CYG_LABEL_NAME (__reserved_virtual_table)) +#define CYGMEM_SECTION_reserved_virtual_table_SIZE (0x100) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x00500000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_rom.ldi b/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/include/pkgconf/mlt_powerpc_ec555_rom.ldi @@ -0,0 +1,41 @@ + +#include + +MEMORY +{ + rom : ORIGIN = 0x00000000, LENGTH = 0x0006ffff /* internal flash */ + ram(WA) : ORIGIN = 0x00400000, LENGTH = 0x000fffff /* external RAM */ + iram(WA) : ORIGIN = 0x003f9800, LENGTH = 0x00006800 /* internal RAM */ + eflash(RXIW) : ORIGIN = 0x00800000, LENGTH = 0x001fffff /* external FLASH */ +} + +SECTIONS +{ + SECTIONS_BEGIN + + CYG_LABEL_DEFN(__reserved_vectors) = 0x00000000; + + SECTION_vectors (rom, 0x00000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + + . = 0x3f9800; + CYG_LABEL_DEFN(__reserved_vsr_table) = ALIGN (0x10); + . = CYG_LABEL_DEFN(__reserved_vsr_table) + 0x200; + CYG_LABEL_DEFN(__reserved_virtual_table) = ALIGN (0x10); + . = CYG_LABEL_DEFN(__reserved_virtual_table) + 0x100; + + SECTION_data (iram, ALIGN (0x10), FOLLOWING (.gcc_except_table)) + SECTION_sbss (iram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (iram, ALIGN (0x10), LMA_EQ_VMA) + + . = 0x400000; + + CYG_LABEL_DEFN(__heap1) = ALIGN(0x8); + + SECTIONS_END +} diff --git a/packages/hal/powerpc/ec555/current/include/plf_cache.h b/packages/hal/powerpc/ec555/current/include/plf_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/include/plf_cache.h @@ -0,0 +1,67 @@ +#ifndef CYGONCE_PLF_CACHE_H +#define CYGONCE_PLF_CACHE_H + +//============================================================================= +// +// plf_cache.h +// +// Platform HAL cache details +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors:Bob Koninckx +// Date: 2001-12-10 +// Purpose: Platform cache control API +// Description: The macros defined here provide the platform specific +// cache control operations / behavior. +// Usage: Is included via the architecture cache header: +// #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//--------------------------------------------------------------------------- +// Initial cache enabling +// MPC555 does not have any cache, disable caches completely +#undef CYGPRI_INIT_CACHES +#undef CYGPRI_ENABLE_CACHES + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_PLF_CACHE_H +// End of plf_cache.h diff --git a/packages/hal/powerpc/ec555/current/include/plf_intr.h b/packages/hal/powerpc/ec555/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/include/plf_intr.h @@ -0,0 +1,69 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// ec555 platform specific interrupt definitions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2001-12-15 +// Purpose: Define platform specific interrupt support +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +//---------------------------------------------------------------------------- +// Reset. +#define HAL_PLATFORM_RESET() CYG_EMPTY_STATEMENT + +#define HAL_PLATFORM_RESET_ENTRY 0x00000100 + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/powerpc/ec555/current/include/plf_stub.h b/packages/hal/powerpc/ec555/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/include/plf_stub.h @@ -0,0 +1,92 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors:Bob Koninckx +// Date: 2002-01-01 +// Purpose: Platform HAL stub support for PowerPC/ec555 boards. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include + +#ifdef CYGPKG_IO_SERIAL +#include +#endif + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM, externC + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +//---------------------------------------------------------------------------- +// Stub initializer. +extern void hal_plf_stub_init( void ); +#define HAL_STUB_PLATFORM_INIT() hal_plf_stub_init(); + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/powerpc/ec555/current/misc/redboot_RAM.ecm b/packages/hal/powerpc/ec555/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/misc/redboot_RAM.ecm @@ -0,0 +1,288 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware ec555 ; + template default ; + package -hardware CYGPKG_HAL_POWERPC current ; + package -hardware CYGPKG_HAL_POWERPC_MPC5xx current ; + package -hardware CYGPKG_HAL_POWERPC_EC555 current ; + package -hardware CYGPKG_DEVS_FLASH_MPC5XX current ; + package -hardware CYGPKG_DEVS_FLASH_MOTOROLA_CDRMONET current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package CYGPKG_REDBOOT current ; + package CYGPKG_LIBC current ; + package CYGPKG_LIBC_STRING current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_IO_FLASH current ; +}; + +cdl_option CYGBLD_GLOBAL_CFLAGS { + user_value "-mcpu=505 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -mmultiple -fno-rtti -fno-exceptions -finit-priority" +}; + +cdl_option CYGBLD_GLOBAL_LDFLAGS { + user_value "-mcpu=505 -g -nostdlib -Wl,--gc-sections -Wl,-static" +}; + +cdl_option CYGBLD_BUILD_COMMON_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGFUN_HAL_COMMON_KERNEL_SUPPORT { + user_value 0 +}; + +cdl_component CYGDBG_HAL_DIAG_TO_DEBUG_CHAN { + user_value 0 +}; + +cdl_option CYGSEM_HAL_DIAG_MANGLER { + user_value GDB +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 16384 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + user_value 0 +}; + +cdl_option CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP { + user_value 0 +}; + +cdl_option CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP { + user_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + user_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + user_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { + user_value 0 +}; + +cdl_option CYGSEM_HAL_VIRTUAL_VECTOR_CLAIM_COMMS { + user_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + user_value 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 0 +}; + +cdl_option CYGSEM_HAL_POWERPC_COPY_VECTORS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_POWERPC_FRAME_WALLS { + user_value 0 +}; + +cdl_component CYGPKG_HAL_POWERPC_MPC555 { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_POWERPC_FPU { + user_value 1 +}; + +cdl_option CYGSEM_HAL_POWERPC_IEEE_FLOATING_POINT { + user_value 0 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_OCD_ENABLE { + user_value 0 +}; + +cdl_option CYGHWR_HAL_POWERPC_MPC5XX_IFLASH_ENABLE { + user_value 1 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_IFLASH_DUAL_MAP { + user_value 0 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_IMB3_ARBITER { + user_value 0 +}; + +cdl_option CYGBLD_BUILD_VERSION_TOOL { + user_value 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + user_value 1 +}; + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + user_value 38400 +}; + +cdl_option CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMCPY { + user_value 1 +}; + +cdl_option CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMSET { + user_value 1 +}; + +cdl_option CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS { + user_value 0 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_ZLIB { + user_value 0 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_THREADS { + user_value 0 +}; + +cdl_option CYGDAT_REDBOOT_CUSTOM_VERSION { + user_value 1 "CME555/MPC555 RAM-Startup" +}; + +cdl_option CYGNUM_REDBOOT_CMD_LINE_EDITING { + user_value 0 +}; + +cdl_option CYGSEM_REDBOOT_VARIABLE_BAUD_RATE { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00008000 +}; + +cdl_option CYGBLD_REDBOOT_FLASH_BOOT_OFFSET { + user_value 0x00000000 +}; + +cdl_option CYGNUM_REDBOOT_FLASH_RESERVED_BASE { + user_value 0x00000000 +}; + +cdl_option CYGOPT_REDBOOT_FIS { + user_value 0 +}; + +cdl_component CYGSEM_REDBOOT_FLASH_CONFIG { + user_value 0 +}; + +cdl_option CYGIMP_LIBC_STRING_INLINES { + user_value 1 +}; + +cdl_option CYGIMP_LIBC_STRING_PREFER_SMALL_TO_FAST { + user_value 1 +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGBLD_ISO_CTYPE_HEADER { + user_value 0 0 +}; + +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_FLOAT_HEADER { + user_value 0 0 +}; + +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRERROR_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGNUM_FLASH_WORKSPACE_SIZE { + user_value 0x0000000 +}; + +cdl_option CYGHWR_DEVS_FLASH_MOTOROLA_CMF5 { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_MOTOROLA_CMF6 { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_MOTOROLA_CMF7 { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_MOTOROLA_CMF9 { + user_value 1 +}; + + diff --git a/packages/hal/powerpc/ec555/current/misc/redboot_ROM.ecm b/packages/hal/powerpc/ec555/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/misc/redboot_ROM.ecm @@ -0,0 +1,269 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware ec555 ; + template default ; + package -hardware CYGPKG_HAL_POWERPC current ; + package -hardware CYGPKG_HAL_POWERPC_MPC5xx current ; + package -hardware CYGPKG_HAL_POWERPC_EC555 current ; + package -hardware CYGPKG_DEVS_FLASH_EC555 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package CYGPKG_REDBOOT current ; + package CYGPKG_LIBC current ; + package CYGPKG_LIBC_STRING current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGBLD_GLOBAL_CFLAGS { + user_value "-mcpu=505 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -mmultiple -fno-rtti -fno-exceptions -finit-priority" +}; + +cdl_option CYGBLD_GLOBAL_LDFLAGS { + user_value "-mcpu=505 -g -nostdlib -Wl,--gc-sections -Wl,-static" +}; + +cdl_option CYGBLD_BUILD_COMMON_GDB_STUBS { + user_value 0 +}; + +cdl_option CYGFUN_HAL_COMMON_KERNEL_SUPPORT { + user_value 0 +}; + +cdl_component CYGDBG_HAL_DIAG_TO_DEBUG_CHAN { + user_value 0 +}; + +cdl_option CYGSEM_HAL_DIAG_MANGLER { + user_value GDB +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + user_value 0 +}; + +cdl_option CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP { + user_value 0 +}; + +cdl_option CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP { + user_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + user_value 1 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { + user_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGSEM_HAL_POWERPC_COPY_VECTORS { + user_value 0 +}; + +cdl_option CYGDBG_HAL_POWERPC_FRAME_WALLS { + user_value 0 +}; + +cdl_component CYGPKG_HAL_POWERPC_MPC555 { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_POWERPC_FPU { + user_value 1 +}; + +cdl_option CYGSEM_HAL_POWERPC_IEEE_FLOATING_POINT { + user_value 0 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_OCD_ENABLE { + user_value 0 +}; + +cdl_option CYGHWR_HAL_POWERPC_MPC5XX_IFLASH_ENABLE { + user_value 1 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_IFLASH_DUAL_MAP { + user_value 0 +}; + +cdl_option CYGSEM_HAL_POWERPC_MPC5XX_IMB3_ARBITER { + user_value 0 +}; + +cdl_option CYGBLD_BUILD_VERSION_TOOL { + user_value 0 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + user_value 1 +}; + +cdl_option CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMCPY { + user_value 1 +}; + +cdl_option CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMSET { + user_value 1 +}; + +cdl_option CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS { + user_value 0 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_ZLIB { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_THREADS { + user_value 1 +}; + +cdl_option CYGDAT_REDBOOT_CUSTOM_VERSION { + user_value 1 "EC555/MPC555 ROM-Startup" +}; + +cdl_option CYGNUM_REDBOOT_CMD_LINE_EDITING { + user_value 0 +}; + +cdl_option CYGPKG_REDBOOT_ANY_CONSOLE { + user_value 1 +}; + +cdl_option CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00020000 +}; + +cdl_option CYGBLD_REDBOOT_FLASH_BOOT_OFFSET { + user_value 0x00000000 +}; + +cdl_option CYGNUM_REDBOOT_FLASH_RESERVED_BASE { + user_value 0x00000000 +}; + +cdl_option CYGIMP_LIBC_STRING_INLINES { + user_value 1 +}; + +cdl_option CYGIMP_LIBC_STRING_PREFER_SMALL_TO_FAST { + user_value 1 +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGBLD_ISO_CTYPE_HEADER { + user_value 0 0 +}; + +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_ERRNO_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_STRCONV_FLOAT_HEADER { + user_value 0 0 +}; + +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRERROR_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + user_value 1 +}; + +cdl_option CYGNUM_FLASH_WORKSPACE_SIZE { + user_value 0x00000000 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV200 { + user_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_ST_M29W200B { + user_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV800 { + user_value 1 +}; + +cdl_option CYGSEM_COMPRESS_ZLIB_NEEDS_MALLOC { + user_value 0 +}; + + diff --git a/packages/hal/powerpc/ec555/current/src/ec555.S b/packages/hal/powerpc/ec555/current/src/ec555.S new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/src/ec555.S @@ -0,0 +1,199 @@ +##============================================================================= +## +## ec555.S +## +## ec555 board hardware setup +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): Bob Koninckx +## Contributors:Bob Koninckx +## Date: 2002-01-01 +## Purpose: ec555 board hardware setup +## Description: This file contains any code needed to initialize the +## hardware on a ec555 mpc555 board. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include +#include + +#------------------------------------------------------------------------------ + + .globl hal_hardware_init +hal_hardware_init: +#if defined(CYGPKG_HAL_POWERPC_EC555) && defined(CYGPKG_HAL_POWERPC_MPC5xx) + lwi r3, CYGARC_REG_IMM_BASE # Base address of control registers + + // Burst enable + lwi r0, 0x00002000 + mtspr 560, r0 + + // Disable the Watchdog (for now) + lwi r4, 0xffffff88 + stw r4, (CYGARC_REG_IMM_SYPCR-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0x00000000 + stw r4, (CYGARC_REG_IMM_SIUMCR-CYGARC_REG_IMM_BASE)(r3) + + // Unlock locked registers + lwi r4, 0x55ccaa33 + stw r4, (CYGARC_REG_IMM_TBSCRK-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_TBREF0K-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_TBREF1K-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_TBK-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_RTCSCK-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_RTCK-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_RTSECK-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_RTCALK-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_PISCRK-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_PITCK-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_SCCRK-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_PLPRCRK-CYGARC_REG_IMM_BASE)(r3) + stw r4, (CYGARC_REG_IMM_RSRK-CYGARC_REG_IMM_BASE)(r3) + + // Boost the clock to 40MHz + lwi r4, 0x03000000 + stw r4, (CYGARC_REG_IMM_SCCR-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0x009150c0 + stw r4, (CYGARC_REG_IMM_PLPRCR-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0x0080 + sth r4, (CYGARC_REG_IMM_COLIR-CYGARC_REG_IMM_BASE)(r3) + + // Set up the memory map + // Do NOT write protect the flash memory, flash drivers won't work + // if we do + lwi r4, 0x00800003 + stw r4, (CYGARC_REG_IMM_BR0-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0xffc00530 + stw r4, (CYGARC_REG_IMM_OR0-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0x00400011 + stw r4, (CYGARC_REG_IMM_BR1-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0xfff00000 + stw r4, (CYGARC_REG_IMM_OR1-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0x00c00000 + stw r4, (CYGARC_REG_IMM_BR2-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0xffff8000 + stw r4, (CYGARC_REG_IMM_OR2-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0x00e00000 + stw r4, (CYGARC_REG_IMM_BR3-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0xffff8000 + stw r4, (CYGARC_REG_IMM_OR3-CYGARC_REG_IMM_BASE)(r3) + +#if defined(CYGSEM_HAL_POWERPC_MPC5XX_IFLASH_DUAL_MAP) + lwi r4, 1 +#else + lwi r4, 0 +#endif + stw r4, (CYGARC_REG_IMM_DMBR-CYGARC_REG_IMM_BASE)(r3) + lwi r4, 0 + stw r4, (CYGARC_REG_IMM_DMOR-CYGARC_REG_IMM_BASE)(r3) + + // Enable the time base and set the freeze flag + lwi r4, 0xc3 + sth r4, (CYGARC_REG_IMM_TBSCR-CYGARC_REG_IMM_BASE)(r3) + + // RTC is clocked by 4MHz crystal, set the freeze flag + lwi r4, 0xd2 + sth r4, (CYGARC_REG_IMM_RTCSC-CYGARC_REG_IMM_BASE)(r3) + + // Set the freeze flag for the Periodic interrupt timer + lwi r4, 0x82 + sth r4, (CYGARC_REG_IMM_PISCR-CYGARC_REG_IMM_BASE)(r3) + + // USIU rest. + lwi r4, 0x00000000 + lwi r5, (CYGARC_REG_IMM_SGPIODT1-CYGARC_REG_IMM_BASE) + stwx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_SGPIODT2-CYGARC_REG_IMM_BASE) + stwx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_SGPIOCR-CYGARC_REG_IMM_BASE) + stwx r4, r3, r5 + lwi r4, 0x00000ac6 + lwi r5, (CYGARC_REG_IMM_EMCR-CYGARC_REG_IMM_BASE) + stwx r4, r3, r5 + + // Dual ported TPU RAM + lwi r4, 0x0000 + lwi r5, (CYGARC_REG_IMM_DPTMCR-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + + lwi r4, 0xffa0 + lwi r5, (CYGARC_REG_IMM_RAMBAR-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + + lwi r4, 0x00 + lwi r5, (CYGARC_REG_IMM_PORTQS-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + + lwi r4, 0x00 + lwi r5, (CYGARC_REG_IMM_PQSPAR_DDRQST-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_MPIOSMDR-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_MPIOSMDDR-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + lwi r5, (CYGARC_REG_IMM_SRAMMCR_A-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + + // They are assigned OCD functionality on this board + // Change the following to anything else and BDM will not work anymore + // on the ec555. This is not true for all MPC555 based boards, eg. cme555 + // does not have this requirement + lwi r4, 0x3 + lwi r5, (CYGARC_REG_IMM_MIOS1TPCR-CYGARC_REG_IMM_BASE) + sthx r4, r3, r5 + + // Enable 32 interrupt priorities on the IMB3 unit + lwi r4, 0x60000000 + lwi r5, (CYGARC_REG_IMM_UMCR-CYGARC_REG_IMM_BASE) + stwx r4, r3, r5 + + // Finally, disable serialization + // Motorola claims that failing to do so results in a performance + // penalty of a facor three !! + lwi r0, 0x00000007 + mtspr 158, r0 +#endif + sync + blr + +#------------------------------------------------------------------------------ +# end of ec555.S diff --git a/packages/hal/powerpc/ec555/current/src/hal_diag.c b/packages/hal/powerpc/ec555/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/src/hal_diag.c @@ -0,0 +1,620 @@ +//============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2001-12-11 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include // our header. + +#include // base types, externC +#include // CYG_ISR_HANDLED +#include // Helper functions +#include // IO macros +#include // Interrupt macros + +#include // SAVE/RESTORE GP +#include // Calling-if API + + +static void cyg_hal_plf_serial_init(void); + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_serial_init(); +} + +//============================================================================= +// Serial driver +//============================================================================= + +//----------------------------------------------------------------------------- +// There are two serial ports. +#define CYG_DEV_SERIAL_BASE_A 0x305008 // SCI0 +#define CYG_DEV_SERIAL_BASE_B 0x305020 // SCI1 + +//----------------------------------------------------------------------------- +// Define CYG_DEVICE_SERIAL_RS232_SCIBR +// Default baudrate is 38400 +// These values are calculated for a 40Mhz clock frequency +// This should be enough, we did not provide clock frequency as a configuration +// option anyway +#define CYG_DEV_SERIAL_RS232_SCxBR_300 4167 +#define CYG_DEV_SERIAL_RS232_SCxBR_600 2083 +#define CYG_DEV_SERIAL_RS232_SCxBR_1200 1042 +#define CYG_DEV_SERIAL_RS232_SCxBR_2400 521 +#define CYG_DEV_SERIAL_RS232_SCxBR_4800 260 +#define CYG_DEV_SERIAL_RS232_SCxBR_9600 130 +#define CYG_DEV_SERIAL_RS232_SCxBR_14400 87 +#define CYG_DEV_SERIAL_RS232_SCxBR_19200 65 +#define CYG_DEV_SERIAL_RS232_SCxBR_28800 43 +#define CYG_DEV_SERIAL_RS232_SCxBR_38400 33 +#define CYG_DEV_SERIAL_RS232_SCxBR_57600 22 +#define CYG_DEV_SERIAL_RS232_SCxBR_115200 11 + +//----------------------------------------------------------------------------- +// Define the serial registers. +#define CYG_DEV_SERIAL_RS232_SCCR0 0x00 +#define CYG_DEV_SERIAL_RS232_SCCR1 0x01 +#define CYG_DEV_SERIAL_RS232_SCSR 0x02 +#define CYG_DEV_SERIAL_RS232_SCDR 0x03 + +#define SCCR0_OTHR 0x8000 // Select baud rate other than system clock +#define SCCR0_LINKBD 0x4000 // Link baud +#define SCCR0_SCxBR 0x1fff // SCI baud rate + +#define SCCR1_LOOPS 0x4000 // Loop mode +#define SCCR1_WOMS 0x2000 // Wired or for SCI pins +#define SCCR1_ILT 0x1000 // Idle line detect type +#define SCCR1_PT 0x0800 // Parity type (0 = Odd, 1 = Even) +#define SCCR1_PE 0x0400 // Parity enable +#define SCCR1_M 0x0200 // Mode select (0 = 10 bit frame, 1 = 11 bit frame) +#define SCCR1_WAKE 0x0100 // Wakeup by address mark +#define SCCR1_TIE 0x0080 // Transmit interrupt enable +#define SCCR1_TCIE 0x0040 // Transmit complete interrupt enable +#define SCCR1_RIE 0x0020 // Receiver interrupt enable +#define SCCR1_ILIE 0x0010 // Idle line interrupt enable +#define SCCR1_TE 0x0008 // Transmiter enable +#define SCCR1_RE 0x0004 // Receiver enable +#define SCCR1_RWU 0x0002 // Receiver wakeup +#define SCCR1_SBK 0x0001 // Send break + +#define SCSR_TDRE 0x0100 // Transmit data register empty +#define SCSR_TC 0x0080 // Transmit complete +#define SCSR_RDRF 0x0040 // Receive data register full +#define SCSR_RAF 0x0020 // Receive active flag +#define SCSR_IDLE 0x0010 // Idle line detected +#define SCSR_OR 0x0008 // Overrun error +#define SCSR_NF 0x0004 // Noise error flag +#define SCSR_FE 0x0002 // Framing error +#define SCSR_PF 0x0001 // Parity error + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint16* base; + cyg_int32 msec_timeout; + int siu_vector; + int imb3_vector; + unsigned int level; + int baud_rate; +} channel_data_t; + +//----------------------------------------------------------------------------- +static void +init_serial_channel(const channel_data_t* __ch_data) +{ + cyg_uint16 * base = __ch_data->base; + cyg_uint16 br; + + switch(__ch_data->baud_rate) + { + case 300: + br = CYG_DEV_SERIAL_RS232_SCxBR_300; + break; + case 600: + br = CYG_DEV_SERIAL_RS232_SCxBR_600; + break; + case 1200: + br = CYG_DEV_SERIAL_RS232_SCxBR_1200; + break; + case 2400: + br = CYG_DEV_SERIAL_RS232_SCxBR_2400; + break; + case 4800: + br = CYG_DEV_SERIAL_RS232_SCxBR_4800; + break; + case 9600: + br = CYG_DEV_SERIAL_RS232_SCxBR_9600; + break; + case 14400: + br = CYG_DEV_SERIAL_RS232_SCxBR_14400; + break; + case 19200: + br = CYG_DEV_SERIAL_RS232_SCxBR_19200; + break; + case 28800: + br = CYG_DEV_SERIAL_RS232_SCxBR_28800; + break; + case 38400: + br = CYG_DEV_SERIAL_RS232_SCxBR_38400; + break; + case 57600: + br = CYG_DEV_SERIAL_RS232_SCxBR_57600; + break; + case 115200: + br = CYG_DEV_SERIAL_RS232_SCxBR_115200; + break; + default: + // Use the default if something unknown is requested + br = CYG_DEV_SERIAL_RS232_SCxBR_38400; + break; + } + + // 8-1-No parity + HAL_WRITE_UINT16(base+CYG_DEV_SERIAL_RS232_SCCR1, (SCCR1_TE | SCCR1_RE)); + + // Set baud rate + HAL_WRITE_UINT16(base+CYG_DEV_SERIAL_RS232_SCCR0, br); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint16 status; + cyg_uint16 result; + cyg_uint16 * base = ((channel_data_t *)__ch_data)->base; + + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCSR, status); + if((status & SCSR_RDRF) == 0) + return false; + + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCDR, result); + *ch = (cyg_uint8)(result & 0x00ff); + + return true; +} + + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +void +cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 c) +{ + cyg_uint16 status; + cyg_uint16 * base = ((channel_data_t *)__ch_data)->base; + + CYGARC_HAL_SAVE_GP(); + + do { + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCSR, status); + } while((status & SCSR_TDRE) == 0); + + HAL_WRITE_UINT16(base+CYG_DEV_SERIAL_RS232_SCDR, (short)c); + + // Hang around until the character is safely sent + do { + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCSR, status); + } while((status & SCSR_TDRE) == 0); + + CYGARC_HAL_RESTORE_GP(); +} + +// Channel data +// Do NOT make them const, will cause problems when trying +// to change the timeout parameter ... (Is this a bug in other) +// PowerPC platform hals ?? You only see it when you really start from +// flash .... +static channel_data_t channels[2] = { + { (cyg_uint16*)CYG_DEV_SERIAL_BASE_A, + 1000, + CYGNUM_HAL_INTERRUPT_SIU_LVL0, + CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX, + 0, + CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD }, + { (cyg_uint16*)CYG_DEV_SERIAL_BASE_B, + 1000, + CYGNUM_HAL_INTERRUPT_SIU_LVL0, + CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX, + 0, + CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD } +}; + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_GETBAUD: + ret = chan->baud_rate; + break; + case __COMMCTL_SETBAUD: + { + va_list ap; + va_start(ap, __func); + + ret = chan->baud_rate; + chan->baud_rate = va_arg(ap, cyg_int32); + init_serial_channel(chan); + + va_end(ap); + } + break; + case __COMMCTL_IRQ_ENABLE: + HAL_INTERRUPT_SET_LEVEL(chan->imb3_vector, chan->level); + HAL_INTERRUPT_UNMASK(chan->imb3_vector); + HAL_INTERRUPT_UNMASK(chan->siu_vector); + irq_state = 1; + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + HAL_INTERRUPT_MASK(chan->imb3_vector); + HAL_INTERRUPT_MASK(chan->siu_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->siu_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + break; + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + + cyg_uint16 status; + cyg_uint16 control; + + cyg_uint16 * base = ((channel_data_t *)__ch_data)->base; + + CYGARC_HAL_SAVE_GP(); + + *__ctrlc = 0; + + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCSR, status); + HAL_READ_UINT16(base+CYG_DEV_SERIAL_RS232_SCCR1, control); + + if((status & SCSR_RDRF) && (control & SCCR1_RIE)) + { // Only if the interrupt was caused by the channel + cyg_uint8 c; + c = cyg_hal_plf_serial_getc(__ch_data); + + if(cyg_hal_is_break(&c, 1)) + *__ctrlc = 1; + + HAL_INTERRUPT_ACKNOWLEDGE(((channel_data_t *)__ch_data)->imb3_vector); + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(channels[0].imb3_vector); + HAL_INTERRUPT_MASK(channels[1].imb3_vector); + + // Init channels + init_serial_channel(&channels[0]); + init_serial_channel(&channels[1]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Set channel 1 + CYGACC_CALL_IF_SET_CONSOLE_COMM(1); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[1]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +//============================================================================= +// Compatibility with older stubs +//============================================================================= +#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) +#include // CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION +#endif + +//----------------------------------------------------------------------------- +// Assumption: all diagnostic output must be GDB packetized unless +// this is a configuration for a stand-alone ROM system. +#if defined(CYG_HAL_STARTUP_ROM) && !defined(CYGSEM_HAL_ROM_MONITOR) +# define HAL_DIAG_USES_HARDWARE +#endif + +#if (CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL == 0) +# define __BASE ((cyg_uint16*)CYG_DEV_SERIAL_BASE_A) +#elif (CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL == 1) +# define __BASE ((cyg_uint16*)CYG_DEV_SERIAL_BASE_B) +#else +# error "Invalid console channel selection" +#endif + +static channel_data_t channel = { __BASE, 0, 0 }; + +#ifdef HAL_DIAG_USES_HARDWARE + +void hal_diag_init(void) +{ + init_serial_channel(&channel); +} + +void hal_diag_write_char(char __c) +{ + cyg_hal_plf_serial_putc(&channel, __c); +} + +void hal_diag_read_char(char *c) +{ + *c = cyg_hal_plf_serial_getc(&channel); +} + +#else // ifdef HAL_DIAG_USES_HARDWARE + +// Initialize diag port +void +hal_diag_init(void) +{ + // Init devices + init_serial_channel(&channel); +} + +void +hal_diag_write_char_serial( char c ) +{ + unsigned long __state; + HAL_DISABLE_INTERRUPTS(__state); + cyg_hal_plf_serial_putc(&channel, c); + HAL_RESTORE_INTERRUPTS(__state); +} + +void +hal_diag_read_char(char *c) +{ + *c = cyg_hal_plf_serial_getc(&channel); +} + +void +hal_diag_write_char(char c) +{ + static char line[100]; + static int pos = 0; + + // No need to send CRs + if( c == '\r' ) return; + + line[pos++] = c; + + if( c == '\n' || pos == sizeof(line) ) + { + CYG_INTERRUPT_STATE old; + + // Disable interrupts. This prevents GDB trying to interrupt us + // while we are in the middle of sending a packet. The serial + // receive interrupt will be seen when we re-enable interrupts + // later. + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old); +#else + HAL_DISABLE_INTERRUPTS(old); +#endif + + while(1) + { + char c1; + static char hex[] = "0123456789ABCDEF"; + cyg_uint8 csum = 0; + int i; + + hal_diag_write_char_serial('$'); + hal_diag_write_char_serial('O'); + csum += 'O'; + for( i = 0; i < pos; i++ ) + { + char ch = line[i]; + char h = hex[(ch>>4)&0xF]; + char l = hex[ch&0xF]; + hal_diag_write_char_serial(h); + hal_diag_write_char_serial(l); + csum += h; + csum += l; + } + hal_diag_write_char_serial('#'); + hal_diag_write_char_serial(hex[(csum>>4)&0xF]); + hal_diag_write_char_serial(hex[csum&0xF]); + + // Wait for the ACK character '+' from GDB here and handle + // receiving a ^C instead. + hal_diag_read_char(&c1); + + if( c1 == '+' ) + break; // a good acknowledge + +#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + if( 3 == c1 ) { + // Ctrl-C: breakpoint. + cyg_hal_gdb_interrupt( + (target_register_t)__builtin_return_address(0)); + break; + } +#endif + // otherwise, loop round again + } + + pos = 0; + + // And re-enable interrupts +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old); +#else + HAL_RESTORE_INTERRUPTS(old); +#endif + + } +} + +#endif // ifdef HAL_DIAG_USES_HARDWARE + +#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + +//----------------------------------------------------------------------------- +// End of hal_diag.c diff --git a/packages/hal/powerpc/ec555/current/src/plf_misc.c b/packages/hal/powerpc/ec555/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/src/plf_misc.c @@ -0,0 +1,79 @@ +//============================================================================= +// +// plf_misc.c +// +// Platform miscellaneous code/data. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors:Bob Koninckx +// Date: 2001-12-11 +// Purpose: Platform specific code and data +// Description: Tables for per-platform initialization +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include // HAL memory definitions +#include // hal_if_init + +#include // IO macros +#include // interrupt vectors +#include // Helper functions +#include // HANDLED +#include + +// The memory map is weakly defined, allowing the application to redefine +// it if necessary. Leave the table empty, the mpc555 has no cache ... +CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = { + CYGARC_MEMDESC_TABLE_END +}; + +void +hal_platform_init(void) +{ + hal_if_init(); + +#if defined CYGSEM_HAL_VIRTUAL_VECTOR_DIAG + HAL_DIAG_INIT(); +#endif +} + +// EOF plf_misc.c diff --git a/packages/hal/powerpc/ec555/current/src/plf_stub.c b/packages/hal/powerpc/ec555/current/src/plf_stub.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/ec555/current/src/plf_stub.c @@ -0,0 +1,76 @@ +//============================================================================= +// +// plf_stub.c +// +// Platform specific code for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-02-12 +// Purpose: Platform specific code for GDB stub support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include +#include + +#define L1 "eCos ROM " __TIME__ "\r\n" +#define L2 __DATE__ "\r\n" + +void +hal_plf_stub_init(void) +{ +#if defined(CYGSEM_HAL_ROM_MONITOR) + // Put stub build date on the console + // This might change if someone provides + // driver for the LCD + hal_virtual_comm_table_t* comm; + + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_WRITE(*comm, L1, strlen(L1)); + CYGACC_COMM_IF_WRITE(*comm, L2, strlen(L2)); +#endif +} + +//----------------------------------------------------------------------------- +// End of plf_stub.c diff --git a/packages/hal/powerpc/fads/current/ChangeLog b/packages/hal/powerpc/fads/current/ChangeLog --- a/packages/hal/powerpc/fads/current/ChangeLog +++ b/packages/hal/powerpc/fads/current/ChangeLog @@ -1,3 +1,7 @@ +2002-04-11 Gary Thomas + + * include/plf_cache.h: Cache control is in hal/common CDL. + 2001-01-26 Jesper Skov * include/plf_stub.h: Moved reset macro to @@ -271,27 +275,36 @@ 1998-10-28 Kevin Hester + + * cdl/hal_powerpc_mbx.cdl: Removed implemntation of + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + +2002-04-11 Gary Thomas + + * include/plf_cache.h: Cache control is in hal/common CDL. + +2002-01-23 Gary Thomas + + * src/redboot_linux_exec.c (do_exec): Better match for EPPCbug + environment, necessary for Linux boot. + + * src/hal_aux.c: Move IMMR to match what Motorola EPPCbug uses. + +2002-01-16 Nick Garnett + + * cdl/hal_powerpc_mbx.cdl: Added CYGSEM_REDBOOT_HAL_LINUX_BOOT to + enable Linux booting support. + + * src/redboot_linux_exec.c: Added this file to contain Linux exec + command. + 2001-06-21 Jonathan Larmour * images/*: Remove. Don't bloat repository with things already on @@ -509,27 +533,36 @@ 1999-06-10 Hugo Tyson " puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " @@ -341,8 +347,16 @@ cdl_package CYGPKG_HAL_POWERPC_MBX { This option lists the target's requirements for a valid Redboot configuration." -# compile -library=libextras.a redboot_cmds.c - + cdl_option CYGSEM_REDBOOT_HAL_LINUX_BOOT { + display "Support booting Linux via RedBoot" + flavor bool + default_value 1 + description " + This option enables RedBoot to support booting of a Linux kernel." + + compile -library=libextras.a redboot_linux_exec.c + } + cdl_option CYGBLD_BUILD_REDBOOT_BIN { display "Build Redboot ROM binary image" active_if CYGBLD_BUILD_REDBOOT diff --git a/packages/hal/powerpc/mbx/current/include/hal_diag.h b/packages/hal/powerpc/mbx/current/include/hal_diag.h --- a/packages/hal/powerpc/mbx/current/include/hal_diag.h +++ b/packages/hal/powerpc/mbx/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/mbx/current/include/plf_cache.h b/packages/hal/powerpc/mbx/current/include/plf_cache.h --- a/packages/hal/powerpc/mbx/current/include/plf_cache.h +++ b/packages/hal/powerpc/mbx/current/include/plf_cache.h @@ -8,29 +8,38 @@ // Platform HAL cache details // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -48,11 +57,7 @@ //============================================================================= //--------------------------------------------------------------------------- -// Initial cache enabling -#ifdef CYGSEM_HAL_ROM_MONITOR -# define CYGPRI_INIT_CACHES -# define CYGPRI_ENABLE_CACHES -#endif +// Initial cache enabling - controlled by common CDL //----------------------------------------------------------------------------- #endif // ifndef CYGONCE_PLF_CACHE_H diff --git a/packages/hal/powerpc/mbx/current/include/plf_intr.h b/packages/hal/powerpc/mbx/current/include/plf_intr.h --- a/packages/hal/powerpc/mbx/current/include/plf_intr.h +++ b/packages/hal/powerpc/mbx/current/include/plf_intr.h @@ -8,29 +8,38 @@ // MBX platform specific interrupt definitions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/mbx/current/include/plf_stub.h b/packages/hal/powerpc/mbx/current/include/plf_stub.h --- a/packages/hal/powerpc/mbx/current/include/plf_stub.h +++ b/packages/hal/powerpc/mbx/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/mbx/current/misc/redboot_RAM.ecm b/packages/hal/powerpc/mbx/current/misc/redboot_RAM.ecm --- a/packages/hal/powerpc/mbx/current/misc/redboot_RAM.ecm +++ b/packages/hal/powerpc/mbx/current/misc/redboot_RAM.ecm @@ -22,11 +22,20 @@ cdl_configuration eCos { package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_IO_FLASH current ; package CYGPKG_IO_ETH_DRIVERS current ; package CYGPKG_COMPRESS_ZLIB current ; - package CYGPKG_MEMALLOC current ; - package CYGPKG_ISOINFRA current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 }; cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { @@ -45,4 +54,40 @@ cdl_component CYGBLD_BUILD_REDBOOT { user_value 1 }; +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00030000 +}; +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29F040B { + inferred_value 1 +}; + + diff --git a/packages/hal/powerpc/mbx/current/misc/redboot_ROM.ecm b/packages/hal/powerpc/mbx/current/misc/redboot_ROM.ecm --- a/packages/hal/powerpc/mbx/current/misc/redboot_ROM.ecm +++ b/packages/hal/powerpc/mbx/current/misc/redboot_ROM.ecm @@ -22,13 +22,22 @@ cdl_configuration eCos { package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; package CYGPKG_COMPRESS_ZLIB current ; - package CYGPKG_MEMALLOC current ; - package CYGPKG_ISOINFRA current ; package CYGPKG_IO_FLASH current ; package CYGPKG_IO_ETH_DRIVERS current ; }; +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { user_value 0 }; @@ -53,4 +62,40 @@ cdl_component CYGBLD_BUILD_REDBOOT { user_value 1 }; +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00030000 +}; +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29F040B { + inferred_value 1 +}; + + diff --git a/packages/hal/powerpc/mbx/current/src/Notes_GDB_stub b/packages/hal/powerpc/mbx/current/src/Notes_GDB_stub --- a/packages/hal/powerpc/mbx/current/src/Notes_GDB_stub +++ b/packages/hal/powerpc/mbx/current/src/Notes_GDB_stub @@ -1,27 +1,36 @@ =========================================================================== -####COPYRIGHTBEGIN#### - - ------------------------------------------- - The contents of this file are subject to the Red Hat eCos Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.redhat.com/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations under - the License. - - The Original Code is eCos - Embedded Configurable Operating System, - released September 30, 1998. - - The Initial Developer of the Original Code is Red Hat. - Portions created by Red Hat are - Copyright (C) 1998, 1999, 2000 Red Hat, Inc. - All Rights Reserved. - ------------------------------------------- - -####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### =========================================================================== 2000.02.03 diff --git a/packages/hal/powerpc/mbx/current/src/hal_aux.c b/packages/hal/powerpc/mbx/current/src/hal_aux.c --- a/packages/hal/powerpc/mbx/current/src/hal_aux.c +++ b/packages/hal/powerpc/mbx/current/src/hal_aux.c @@ -5,29 +5,38 @@ // HAL auxiliary objects and code; per platform // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -53,8 +62,7 @@ CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = { // Mapping for the Motorola MBX860 development board CYGARC_MEMDESC_CACHE( 0xfe000000, 0x00400000 ), // ROM region - CYGARC_MEMDESC_NOCACHE( 0xff000000, 0x00100000 ), // MCP registers - CYGARC_MEMDESC_NOCACHE( 0xfa100000, 0x00000004 ), // Control/Status+LEDs + CYGARC_MEMDESC_NOCACHE( 0xfa000000, 0x00400000 ), // Control/Status+LEDs CYGARC_MEMDESC_CACHE( 0x00000000, 0x00800000 ), // Main memory CYGARC_MEMDESC_TABLE_END diff --git a/packages/hal/powerpc/mbx/current/src/hal_diag.c b/packages/hal/powerpc/mbx/current/src/hal_diag.c --- a/packages/hal/powerpc/mbx/current/src/hal_diag.c +++ b/packages/hal/powerpc/mbx/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/mbx/current/src/mbx.S b/packages/hal/powerpc/mbx/current/src/mbx.S --- a/packages/hal/powerpc/mbx/current/src/mbx.S +++ b/packages/hal/powerpc/mbx/current/src/mbx.S @@ -5,29 +5,38 @@ ## MBX board hardware setup ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/powerpc/mbx/current/src/redboot_linux_exec.c b/packages/hal/powerpc/mbx/current/src/redboot_linux_exec.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mbx/current/src/redboot_linux_exec.c @@ -0,0 +1,311 @@ +//========================================================================== +// +// redboot_linux_boot.c +// +// RedBoot command to boot Linux +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//####OTHERCOPYRIGHTBEGIN#### +// +// The structure definitions below are taken from include/asm-ppc/mbx.h in +// the Linux kernel, Copyright (c) 1997 Dan Malek. Their presence +// here is for the express purpose of communication with the Linux kernel +// being booted and is considered 'fair use' by the original author and +// are included with his permission. +// +//####OTHERCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors: gthomas,msalter +// Date: 2002-01-14 +// Purpose: +// Description: +// +// This code is part of RedBoot (tm). +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include CYGBLD_HAL_TARGET_H +#include CYGBLD_HAL_PLATFORM_H + +#include +#include + +#ifdef CYGSEM_REDBOOT_HAL_LINUX_BOOT + +#include CYGHWR_MEMORY_LAYOUT_H + +//========================================================================= + +// Exported CLI function(s) +static void do_exec(int argc, char *argv[]); +RedBoot_cmd("exec", + "Execute an image - with MMU off", + "[-w timeout]\n" + " [-r [-s ]]\n" + " [-c \"kernel command line\"] []", + do_exec + ); + +//========================================================================= +// Imported from Linux kernel include/asm-ppc/mbx.h +// Copyright (c) 1997 Dan Malek (dmalek@jlc.net) +// Used with permission of author. + + +/* A Board Information structure that is given to a program when + * EPPC-Bug starts it up. + */ +typedef struct bd_info { + unsigned int bi_tag; /* Should be 0x42444944 "BDID" */ + unsigned int bi_size; /* Size of this structure */ + unsigned int bi_revision; /* revision of this structure */ + unsigned int bi_bdate; /* EPPCbug date, i.e. 0x11061997 */ + unsigned int bi_memstart; /* Memory start address */ + unsigned int bi_memsize; /* Memory (end) size in bytes */ + unsigned int bi_intfreq; /* Internal Freq, in Hz */ + unsigned int bi_busfreq; /* Bus Freq, in Hz */ + unsigned int bi_clun; /* Boot device controller */ + unsigned int bi_dlun; /* Boot device logical dev */ + + /* These fields are not part of the board information structure + * provided by the boot rom. They are filled in by embed_config.c + * so we have the information consistent with other platforms. + */ + unsigned char bi_enetaddr[6]; + unsigned int bi_baudrate; +} bd_t; + +/* Memory map for the MBX as configured by EPPC-Bug. We could reprogram + * The SIU and PCI bridge, and try to use larger MMU pages, but the + * performance gain is not measureable and it certainly complicates the + * generic MMU model. + * + * In a effort to minimize memory usage for embedded applications, any + * PCI driver or ISA driver must request or map the region required by + * the device. For convenience (and since we can map up to 4 Mbytes with + * a single page table page), the MMU initialization will map the + * NVRAM, Status/Control registers, CPM Dual Port RAM, and the PCI + * Bridge CSRs 1:1 into the kernel address space. + */ +#define PCI_ISA_IO_ADDR ((unsigned)0x80000000) +#define PCI_ISA_IO_SIZE ((unsigned int)(512 * 1024 * 1024)) +#define PCI_IDE_ADDR ((unsigned)0x81000000) +#define PCI_ISA_MEM_ADDR ((unsigned)0xc0000000) +#define PCI_ISA_MEM_SIZE ((unsigned int)(512 * 1024 * 1024)) +#define PCMCIA_MEM_ADDR ((unsigned int)0xe0000000) +#define PCMCIA_MEM_SIZE ((unsigned int)(64 * 1024 * 1024)) +#define PCMCIA_DMA_ADDR ((unsigned int)0xe4000000) +#define PCMCIA_DMA_SIZE ((unsigned int)(64 * 1024 * 1024)) +#define PCMCIA_ATTRB_ADDR ((unsigned int)0xe8000000) +#define PCMCIA_ATTRB_SIZE ((unsigned int)(64 * 1024 * 1024)) +#define PCMCIA_IO_ADDR ((unsigned int)0xec000000) +#define PCMCIA_IO_SIZE ((unsigned int)(64 * 1024 * 1024)) +#define NVRAM_ADDR ((unsigned int)0xfa000000) +#define NVRAM_SIZE ((unsigned int)(1 * 1024 * 1024)) +#define MBX_CSR_ADDR ((unsigned int)0xfa100000) +#define MBX_CSR_SIZE ((unsigned int)(1 * 1024 * 1024)) +#define IMAP_ADDR ((unsigned int)0xfa200000) +#define IMAP_SIZE ((unsigned int)(64 * 1024)) +#define PCI_CSR_ADDR ((unsigned int)0xfa210000) +#define PCI_CSR_SIZE ((unsigned int)(64 * 1024)) + +/* Map additional physical space into well known virtual addresses. Due + * to virtual address mapping, these physical addresses are not accessible + * in a 1:1 virtual to physical mapping. + */ +#define ISA_IO_VIRT_ADDR ((unsigned int)0xfa220000) +#define ISA_IO_VIRT_SIZE ((unsigned int)64 * 1024) + +/* Interrupt assignments. + * These are defined (and fixed) by the MBX hardware implementation. + */ +#define POWER_FAIL_INT SIU_IRQ0 /* Power fail */ +#define TEMP_HILO_INT SIU_IRQ1 /* Temperature sensor */ +#define QSPAN_INT SIU_IRQ2 /* PCI Bridge (DMA CTLR?) */ +#define ISA_BRIDGE_INT SIU_IRQ3 /* All those PC things */ +#define COMM_L_INT SIU_IRQ6 /* MBX Comm expansion connector pin */ +#define STOP_ABRT_INT SIU_IRQ7 /* Stop/Abort header pin */ + +/* The MBX uses the 8259. +*/ +#define NR_8259_INTS 16 + +// End of imported data/structures +//========================================================================= + +#define MBX_CSR_COM1 0x02 // COM1 enabled + +// +// Execute a Linux kernel - this is a RedBoot CLI command +// +static void +do_exec(int argc, char *argv[]) +{ + unsigned long entry; + bool wait_time_set; + int wait_time; + bool cmd_line_set, ramdisk_addr_set, ramdisk_size_set; + unsigned long ramdisk_addr, ramdisk_size; + char *cmd_line; + char *cline; + struct option_info opts[6]; + + bd_t *board_info; + + CYG_INTERRUPT_STATE oldints; + unsigned long sp = CYGMEM_REGION_ram+CYGMEM_REGION_ram_SIZE; + + init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, + (void **)&wait_time, (bool *)&wait_time_set, "wait timeout"); + init_opts(&opts[1], 'c', true, OPTION_ARG_TYPE_STR, + (void **)&cmd_line, (bool *)&cmd_line_set, "kernel command line"); + init_opts(&opts[2], 'r', true, OPTION_ARG_TYPE_NUM, + (void **)&ramdisk_addr, (bool *)&ramdisk_addr_set, "ramdisk_addr"); + init_opts(&opts[3], 's', true, OPTION_ARG_TYPE_NUM, + (void **)&ramdisk_size, (bool *)&ramdisk_size_set, "ramdisk_size"); + if (!scan_opts(argc, argv, 1, opts, 4, (void *)&entry, OPTION_ARG_TYPE_NUM, + "[physical] starting address")) + { + return; + } + + // Make a little space at the top of the stack, and align to + // 64-bit boundary. + sp = (sp-8) & ~7; + + // Set up parameter struct at top of stack + + sp = sp-sizeof(bd_t); + + board_info = (bd_t *)sp; + + board_info->bi_tag = 0x42444944; + board_info->bi_size = sizeof(board_info); + board_info->bi_revision = 1; + board_info->bi_bdate = 0x11061997; + board_info->bi_memstart = CYGMEM_REGION_ram; + board_info->bi_memsize = CYGMEM_REGION_ram_SIZE; + board_info->bi_intfreq = CYGHWR_HAL_POWERPC_BOARD_SPEED; + board_info->bi_busfreq = 66; // ???? + board_info->bi_clun = 0; // ???? + board_info->bi_dlun = 0; // ???? + + // Copy the commandline onto the stack, and set the SP to just below it. + + // If no cmd_line set in args, set it to empty string. + if( !cmd_line_set ) + cmd_line = ""; + + { + int len,i; + + // get length of string + for( len = 0; cmd_line[len] != '\0'; len++ ); + + // decrement sp by length of string and align to + // word boundary. + sp = (sp-(len+1)) & ~3; + + // assign this SP value to command line start + cline = (char *)sp; + + // copy command line over. + for( i = 0; i < len; i++ ) + cline[i] = cmd_line[i]; + cline[len] = '\0'; + + // adjust SP to 64 bit boundary, and leave a little space + // between it and the commandline for PowerPC calling + // conventions. + + sp = (sp-32)&~7; + + } + + // Disable interrupts + HAL_DISABLE_INTERRUPTS(oldints); + + // Put the caches to sleep. + HAL_DCACHE_SYNC(); + HAL_ICACHE_DISABLE(); + HAL_DCACHE_DISABLE(); + HAL_DCACHE_SYNC(); + HAL_ICACHE_INVALIDATE_ALL(); + HAL_DCACHE_INVALIDATE_ALL(); + +// diag_printf("entry %08x sp %08x bi %08x cl %08x\n", +// entry,sp,board_info,cline); +// breakpoint(); + + // Call into Linux + *(volatile unsigned char *)MBX_CSR_ADDR |= MBX_CSR_COM1; // Magic that says COM1 enabled + __asm__ volatile ( + // Linux seems to want the I/O mapped at 0xFA200000 + "lis 3,0xFA20\n" + "mtspr 638,3\n" + + // Start by disabling MMU - the mappings are + // 1-1 so this should not cause any problems + "mfmsr 3\n" + "li 4,0xFFFFFFCF\n" + "and 3,3,4\n" + "sync\n" + "mtmsr 3\n" + "sync\n" + + // Now set up parameters to jump into linux + + "mtlr %0\n" // set entry address in LR + "mr 1,%1\n" // set stack pointer + "mr 3,%2\n" // set board info in R3 + "mr 4,%3\n" // set command line in R4 + "blr \n" // jump into linux + : + : "r"(entry),"r"(sp),"r"(board_info),"r"(cline) + : "r3", "r4" + + ); +} + +#endif // CYGSEM_REDBOOT_HAL_LINUX_BOOT + +//========================================================================= +// EOF redboot_linux_exec.c diff --git a/packages/hal/powerpc/mbx/current/tests/mbxtime.cxx b/packages/hal/powerpc/mbx/current/tests/mbxtime.cxx --- a/packages/hal/powerpc/mbx/current/tests/mbxtime.cxx +++ b/packages/hal/powerpc/mbx/current/tests/mbxtime.cxx @@ -5,29 +5,38 @@ // PowerPC MBX HAL timing tests // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/mpc5xx/current/ChangeLog b/packages/hal/powerpc/mpc5xx/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/ChangeLog @@ -0,0 +1,39 @@ +2002-04-25 Bob Koninckx +2002-04-25 Jonathan Larmour + + * New package. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/powerpc/mpc5xx/current/cdl/hal_powerpc_mpc5xx.cdl b/packages/hal/powerpc/mpc5xx/current/cdl/hal_powerpc_mpc5xx.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/cdl/hal_powerpc_mpc5xx.cdl @@ -0,0 +1,365 @@ +# ==================================================================== +# +# hal_powerpc_mpc5xx.cdl +# +# PowerPC/MPC5xx variant architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Bob Koninckx +# Contributors: +# Date: 2001-08-12 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_POWERPC_MPC5xx { + display "PowerPC 5xx variant HAL" + parent CYGPKG_HAL_POWERPC + hardware + include_dir cyg/hal + define_header hal_powerpc_mpc5xx.h + description " + The PowerPC 5xx variant HAL package provides generic support + for this processor variant. It is also necessary to + select a specific target platform HAL package." + + cdl_interface CYGINT_HAL_USE_ROM_MONITOR_UNSUPPORTED { + display "ROM monitor configuration is unsupported" + no_define + } + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor bool + default_value { (CYG_HAL_STARTUP == "RAM" && + !CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS && + !CYGINT_HAL_USE_ROM_MONITOR_UNSUPPORTED && + !CYGSEM_HAL_POWERPC_COPY_VECTORS) ? 1 : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + requires ! CYGSEM_HAL_POWERPC_COPY_VECTORS + requires ! CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGINT_HAL_USE_ROM_MONITOR_UNSUPPORTED + description " + Allow coexistence with ROM monitor (GDB stubs) by + only initializing interrupt vectors on startup, thus leaving + exception handling to the ROM monitor." + } + + #cdl_option CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP { + # calculated 0 + #} + + #cdl_option CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP { + # calculated 0 + #} + + # FIXME: the option above should be adjusted to select between monitor + # variants + cdl_option CYGSEM_HAL_USE_ROM_MONITOR_GDB_stubs { + display "Bad CDL workaround" + calculated 1 + active_if CYGSEM_HAL_USE_ROM_MONITOR + } + + + # Note: This should be sub-variant specific to reduce memory use. + define_proc { + puts $cdl_header "#define CYGHWR_HAL_VSR_TABLE (CYGHWR_HAL_POWERPC_VECTOR_BASE + 0x3f9800)" + puts $cdl_header "#define CYGHWR_HAL_VIRTUAL_VECTOR_TABLE (CYGHWR_HAL_VSR_TABLE + 0x200)" + } + + cdl_component CYGPKG_HAL_POWERPC_MPC555 { + display "PowerPC 555 microcontroller" + implements CYGINT_HAL_POWERPC_VARIANT + description " + The PowerPC 555 microcontroller. This is an embedded part that in + addition to the PowerPC processor core has built in peripherals + such as memory controllers, DMA controllers, serial ports and + timers/counters." + + cdl_option CYGHWR_HAL_POWERPC_FPU { + display "Variant FPU support" + flavor bool + default_value 0 + description " + Enable or disable hardware support for floating point operations." + } + + cdl_option CYGSEM_HAL_POWERPC_IEEE_FLOATING_POINT { + display "Fully IEEE floating point compliant" + flavor bool + default_value 0 + active_if CYGHWR_HAL_POWERPC_FPU + requires CYGHWR_HAL_POWERPC_FPU + description " + Generate a floating point exception when the limits of the + floating point unit are reached. A software envelope can then + be used to generate the correct IEEE result for e.g. denormalized + numbers. If not enabled, the hardware will generate more than acceptable + values for these situation." + } + + cdl_option CYGSEM_HAL_POWERPC_MPC5XX_OCD_ENABLE { + display "Enable On Chip Debugging (OCD, BDM)" + flavor bool + default_value 0 + description " + This option forces the startup code to leave the OCD registers + unchanged. This allows for debugging with a BDM debugger." + } + + cdl_option CYGHWR_HAL_POWERPC_MPC5XX_IFLASH_ENABLE { + display "Enable internal flash" + flavor bool + default_value 0 + description " + Enable or disable the internal flash on the MPC5xx micro." + } + + cdl_option CYGSEM_HAL_POWERPC_MPC5XX_IFLASH_DUAL_MAP { + display "Dual mapping of the internal flash" + default_value 1 + active_if !CYGHWR_HAL_POWERPC_MPC5XX_IFLASH_ENABLE + requires !CYGHWR_HAL_POWERPC_MPC5XX_IFLASH_ENABLE + description " + This option allows to re-map the internal flash array to external RAM + memory." + } + + cdl_option CYGHWR_HAL_POWERPC_DISABLE_MMU { + display "Disable Memory Management Unit (MMU)" + calculated 1 + description " + The MPC5xx does not have an MMU, there is no use in enabling it." + } + + cdl_option CYGSEM_HAL_POWERPC_MPC5XX_IMB3_ARBITER { + display "IMB3 arbitration ISR" + flavor bool + default_value 1 + description " + The MPC5XX maps all IMB3 interrupt levels above 7 to SIU interrupt + level 7. If more than one IMB3 module is used at an interrupt level + higher than 7, interrupt arbiters must be chained on this level. This + option allows to chain multiple interrupt arbiters on SIU level 7. + This can be done using the functions hal_mpc5xx_install_imb3_arbiter + and hal_mpc5xx_remove_imb3_arbiter" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_TB { + display "Time base interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_PIT { + display "PIT interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_RTC { + display "RTC interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_PLL { + display "PLL interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_A_QUEUE1 { + display "QUADC A, QUEUE 1 interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_A_QUEUE2 { + display "QUADC A, QUEUE 2 interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_B_QUEUE1 { + display "QUADC B, QUEUE 1 interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_B_QUEUE2 { + display "QUADC B, QUEUE 2 interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI { + display "QSCI interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSPI { + display "QSPI interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A { + display "TOUCAN A interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B { + display "TOUCAN B interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A { + display "TPU A interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B { + display "TPU B interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A { + display "MIOS A interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + + cdl_option CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B { + display "MIOS B interrupt source priority" + flavor data + legal_values 0 to 31 + default_value 0 + description "Time base interrupt source priority. O-6 are mapped to SIU levels 0-6. + 7-31 are mapped to SIU level 7" + } + } + + define_proc { + puts $::cdl_header "#include " + } + + compile var_intr.c var_misc.c variant.S + + cdl_option CYGPKG_HAL_POWERPC_MPC5xx_TESTS { + display "PowerPC MPC5xx tests" + flavor data + no_define + calculated { "tests/intr0" } + + description " + This option specifies the set of tests for the PowerPC MPC5xx HAL." + } + + cdl_option CYGBLD_BUILD_VERSION_TOOL { + display "Build MPC5xx version dump tool" + default_value 0 + requires { CYG_HAL_STARTUP == "RAM" } + no_define + description "This option enables the building of a tool which will print the version identifiers of the CPU." + make -priority 320 { + /bin/mpc5xxrev : /src/mpc5xxrev.c + @sh -c "mkdir -p src $(dir $@)" + $(CC) -c $(INCLUDE_PATH) -Wp,-MD,deps.tmp -I$(dir $<) $(CFLAGS) -o src/mpc5xxrev.o $< + @echo $@ ": \\" > $(notdir $@).deps + @echo $(wildcard $(PREFIX)/lib/*) " \\" >> $(notdir $@).deps + @tail +2 deps.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm deps.tmp + $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ src/mpc5xxrev.o + } + } + +} diff --git a/packages/hal/powerpc/mpc5xx/current/include/var_cache.h b/packages/hal/powerpc/mpc5xx/current/include/var_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/include/var_cache.h @@ -0,0 +1,177 @@ +#ifndef CYGONCE_VAR_CACHE_H +#define CYGONCE_VAR_CACHE_H +//============================================================================= +// +// var_cache.h +// +// Variant HAL cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors:Bob Koninckx +// Date: 2001-12-11 +// Purpose: Variant cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations on the MPC8xx variant CPUs. +// Usage: Is included via the architecture cache header: +// #include +// ... +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include + +#include + + +//----------------------------------------------------------------------------- +// MPC5xx has no data or instruction cache. This is going to be a relatively +// simple file + +//----------------------------------------------------------------------------- +// Global control of data cache + +// Enable the data cache +#define HAL_DCACHE_ENABLE() \ + CYG_MACRO_START \ + CYG_MACRO_END + +// Disable the data cache +#define HAL_DCACHE_DISABLE() \ + CYG_MACRO_START \ + CYG_MACRO_END + +// Invalidate the entire cache +#define HAL_DCACHE_INVALIDATE_ALL() \ + CYG_MACRO_START \ + CYG_MACRO_END + +// Synchronize the contents of the cache with memory. +#define HAL_DCACHE_SYNC() \ + CYG_MACRO_START \ + CYG_MACRO_END + +// Query the state of the data cache +#define HAL_DCACHE_IS_ENABLED(_state_) \ + CYG_MACRO_START \ + _state_ = 0; \ + CYG_MACRO_END + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. + +//#define HAL_DCACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_DCACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_DCACHE_UNLOCK_ALL() + + +//----------------------------------------------------------------------------- +// Data cache line control + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +//#define HAL_DCACHE_FLUSH( _base_ , _size_ ) + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) + +// Write dirty cache lines to memory for the given address range. +//#define HAL_DCACHE_STORE( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_DCACHE_ZERO( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +// Global control of Instruction cache + +// Enable the instruction cache +#define HAL_ICACHE_ENABLE() \ + CYG_MACRO_START \ + CYG_MACRO_END + +// Disable the instruction cache +#define HAL_ICACHE_DISABLE() \ + CYG_MACRO_START \ + CYG_MACRO_END + +// Invalidate the entire cache +#define HAL_ICACHE_INVALIDATE_ALL() \ + CYG_MACRO_START \ + CYG_MACRO_END + +// Synchronize the contents of the cache with memory. +#define HAL_ICACHE_SYNC() \ + CYG_MACRO_START \ + CYG_MACRO_END + +// Query the state of the instruction cache +#define HAL_ICACHE_IS_ENABLED(_state_) \ + CYG_MACRO_START \ + _state_ = 0; \ + CYG_MACRO_END + +// Load the contents of the given address range into the instruction cache +// and then lock the cache so that it stays there. +//#define HAL_ICACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_ICACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_VAR_CACHE_H +// End of var_cache.h diff --git a/packages/hal/powerpc/mpc5xx/current/include/var_intr.h b/packages/hal/powerpc/mpc5xx/current/include/var_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/include/var_intr.h @@ -0,0 +1,2845 @@ +#ifndef CYGONCE_VAR_INTR_H +#define CYGONCE_VAR_INTR_H +//============================================================================= +// +// var_intr.h +// +// Variant HAL interrupt and clock support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors:Bob Koninckx +// Date: 2001-12-15 +// Purpose: Variant interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock on the MPC5xx variant CPUs. +// Usage: Is included via the architecture interrupt header: +// #include +// ... +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +#include // types + +#include // register definitions + +#include // io macros +#include // CYG_FAIL + +//----------------------------------------------------------------------------- +// Special IMB3 arbitration code +typedef struct t_hal_mpc5xx_arbitration_data { + cyg_uint32 priority; + CYG_ADDRWORD data; + cyg_uint32 (* arbiter)(CYG_ADDRWORD, CYG_ADDRWORD); + void * reserved; +} hal_mpc5xx_arbitration_data; + +externC void +hal_mpc5xx_install_arbitration_isr(hal_mpc5xx_arbitration_data *adata); + +externC void +hal_mpc5xx_remove_arbitration_isr(hal_mpc5xx_arbitration_data *adata); + +//----------------------------------------------------------------------------- +// Exception vectors. + +// Additional exceptions on the MPC5xx CPUs +#define CYGNUM_HAL_VECTOR_RESERVED_F 15 +#define CYGNUM_HAL_VECTOR_SW_EMUL 16 +#define CYGNUM_HAL_VECTOR_RESERVED_11 17 +#define CYGNUM_HAL_VECTOR_RESERVED_12 18 +#define CYGNUM_HAL_VECTOR_ITLB_ERROR 19 +#define CYGNUM_HAL_VECTOR_DTLB_ERROR 20 +#define CYGNUM_HAL_VECTOR_RESERVED_15 21 +#define CYGNUM_HAL_VECTOR_RESERVED_16 22 +#define CYGNUM_HAL_VECTOR_RESERVED_17 23 +#define CYGNUM_HAL_VECTOR_RESERVED_18 24 +#define CYGNUM_HAL_VECTOR_RESERVED_19 25 +#define CYGNUM_HAL_VECTOR_RESERVED_1A 26 +#define CYGNUM_HAL_VECTOR_RESERVED_1B 27 +#define CYGNUM_HAL_VECTOR_DATA_BP 28 +#define CYGNUM_HAL_VECTOR_INSTRUCTION_BP 29 +#define CYGNUM_HAL_VECTOR_PERIPHERAL_BP 30 +#define CYGNUM_HAL_VECTOR_NMI 31 + +#define CYGNUM_HAL_VSR_MAX CYGNUM_HAL_VECTOR_NMI + +// These are the values used when passed out to an +// external exception handler using cyg_hal_deliver_exception() +#define CYGNUM_HAL_EXCEPTION_RESERVED_0 CYGNUM_HAL_VECTOR_RESERVED_0 +#define CYGNUM_HAL_EXCEPTION_MACHINE_CHECK CYGNUM_HAL_VECTOR_MACHINE_CHECK +#define CYGNUM_HAL_EXCEPTION_RESERVED_3 CYGNUM_HAL_VECTOR_RESERVED_3 +#define CYGNUM_HAL_EXCEPTION_RESERVED_4 CYGNUM_HAL_VECTOR_RESERVED_4 +#define CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_ACCESS CYGNUM_HAL_VECTOR_ALIGNMENT +#define CYGNUM_HAL_EXCEPTION_FPU_NOT_AVAIL CYGNUM_HAL_VECTOR_FP_UNAVAILABLE +#define CYGNUM_HAL_EXCEPTION_RESERVED_A CYGNUM_HAL_VECTOR_RESERVED_A +#define CYGNUM_HAL_EXCEPTION_RESERVED_B CYGNUM_HAL_VECTOR_RESERVED_B +#define CYGNUM_HAL_EXCEPTION_SYSTEM_CALL CYGNUM_HAL_VECTOR_SYSTEM_CALL +#define CYGNUM_HAL_EXCEPTION_TRACE CYGNUM_HAL_VECTOR_TRACE +#define CYGNUM_HAL_EXCEPTION_FP_ASSIST CYGNUM_HAL_VECTOR_FP_ASSIST +#define CYGNUM_HAL_EXCEPTION_RESERVED_F CYGNUM_HAL_VECTOR_RESERVED_F +#define CYGNUM_HAL_EXCEPTION_SW_EMUL CYGNUM_HAL_VECTOR_SW_EMUL +#define CYGNUM_HAL_EXCEPTION_RESERVED_11 CYGNUM_HAL_VECTOR_RESERVED_11 +#define CYGNUM_HAL_EXCEPTION_RESERVED_12 CYGNUM_HAL_VECTOR_RESERVED_12 +#define CYGNUM_HAL_EXCEPTION_CODE_TLBERROR_ACCESS CYGNUM_HAL_VECTOR_ITLB_ERROR +#define CYGNUM_HAL_EXCEPTION_DATA_TLBERROR_ACCESS CYGNUM_HAL_VECTOR_DTLB_ERROR +#define CYGNUM_HAL_EXCEPTION_RESERVED_15 CYGNUM_HAL_VECTOR_RESERVED_15 +#define CYGNUM_HAL_EXCEPTION_RESERVED_16 CYGNUM_HAL_VECTOR_RESERVED_16 +#define CYGNUM_HAL_EXCEPTION_RESERVED_17 CYGNUM_HAL_VECTOR_RESERVED_17 +#define CYGNUM_HAL_EXCEPTION_RESERVED_18 CYGNUM_HAL_VECTOR_RESERVED_18 +#define CYGNUM_HAL_EXCEPTION_RESERVED_19 CYGNUM_HAL_VECTOR_RESERVED_19 +#define CYGNUM_HAL_EXCEPTION_RESERVED_1A CYGNUM_HAL_VECTOR_RESERVED_1A +#define CYGNUM_HAL_EXCEPTION_RESERVED_1B CYGNUM_HAL_VECTOR_RESERVED_1B +#define CYGNUM_HAL_EXCEPTION_DATA_BP CYGNUM_HAL_VECTOR_DATA_BP +#define CYGNUM_HAL_EXCEPTION_INSTRUCTION_BP CYGNUM_HAL_VECTOR_INSTRUCTION_BP +#define CYGNUM_HAL_EXCEPTION_PERIPHERAL_BP CYGNUM_HAL_VECTOR_PERIPHERAL_BP +#define CYGNUM_HAL_EXCEPTION_NMI CYGNUM_HAL_VECTOR_NMI + +// decoded exception vectors (decoded program exception) +#define CYGNUM_HAL_EXCEPTION_TRAP (-1) +#define CYGNUM_HAL_EXCEPTION_PRIVILEGED_INSTRUCTION (-2) +#define CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION (-3) +#define CYGNUM_HAL_EXCEPTION_FPU (-4) + +#define CYGNUM_HAL_EXCEPTION_MIN CYGNUM_HAL_EXCEPTION_RESERVED_0 +#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_EXCEPTION_NMI + +#define CYGHWR_HAL_EXCEPTION_VECTORS_DEFINED + +//----------------------------------------------------------------------------- +// Interrupts + +// The first level of external interrupts +#define CYGNUM_HAL_INTERRUPT_SIU_IRQ0 1 +#define CYGNUM_HAL_INTERRUPT_SIU_LVL0 2 +#define CYGNUM_HAL_INTERRUPT_SIU_IRQ1 3 +#define CYGNUM_HAL_INTERRUPT_SIU_LVL1 4 +#define CYGNUM_HAL_INTERRUPT_SIU_IRQ2 5 +#define CYGNUM_HAL_INTERRUPT_SIU_LVL2 6 +#define CYGNUM_HAL_INTERRUPT_SIU_IRQ3 7 +#define CYGNUM_HAL_INTERRUPT_SIU_LVL3 8 +#define CYGNUM_HAL_INTERRUPT_SIU_IRQ4 9 +#define CYGNUM_HAL_INTERRUPT_SIU_LVL4 10 +#define CYGNUM_HAL_INTERRUPT_SIU_IRQ5 11 +#define CYGNUM_HAL_INTERRUPT_SIU_LVL5 12 +#define CYGNUM_HAL_INTERRUPT_SIU_IRQ6 13 +#define CYGNUM_HAL_INTERRUPT_SIU_LVL6 14 +#define CYGNUM_HAL_INTERRUPT_SIU_IRQ7 15 +#define CYGNUM_HAL_INTERRUPT_SIU_LVL7 16 + +// Further decoded interrupts +#define CYGNUM_HAL_INTERRUPT_SIU_TB_A 17 // Time base reference A +#define CYGNUM_HAL_INTERRUPT_SIU_TB_B 18 // Time base reference B +#define CYGNUM_HAL_INTERRUPT_SIU_PIT 19 // Periodic interrupt timer +#define CYGNUM_HAL_INTERRUPT_SIU_RTC_SEC 20 // Real time clock once per second +#define CYGNUM_HAL_INTERRUPT_SIU_RTC_ALR 21 // Real time clock alarm +#define CYGNUM_HAL_INTERRUPT_SIU_COL 22 // Change of lock of the PLL + +// Even further decoded interrupts +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI1 23 // QUADCA queue 1 completion +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI1 24 // QUADCA queue 1 pause +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI2 25 // QUADCA queue 2 completion +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI2 26 // QUADCA queue 2 pause +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI1 27 // QUADCB queue 1 completion +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI1 28 // QUADCB queue 1 pause +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI2 29 // QUADCB queue 2 completion +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI2 30 // QUADCB queue 2 pause +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX 31 // SCI 0 transmit +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TXC 32 // SCI 0 transmit complete +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX 33 // SCI 0 receiver full +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI0_IDLE 34 // SCI 0 idle line detected +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX 35 // SCI 1 transmit +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXC 36 // SCI 1 transmit complete +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX 37 // SCI 1 receiver full +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_IDLE 38 // SCI 1 idle line detected +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQTHF 39 // SCI 1 RX Queue top half full +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQBHF 40 // SCI 1 RX Queue bottom half full +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQTHE 41 // SCI 1 TX Queue top half full +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQBHE 42 // SCI 1 TX Queue bottom half full +#define CYGNUM_HAL_INTERRUPT_IMB3_SPI_FI 43 // SPI finished +#define CYGNUM_HAL_INTERRUPT_IMB3_SPI_MODF 44 // SPI Mode fault +#define CYGNUM_HAL_INTERRUPT_IMB3_SPI_HALTA 45 // SPI Halt Acknowledge +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_BOFF 46 // TOUCANA buss off +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_ERR 47 // TOUCANA error +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_WU 48 // TOUCANA wake up +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B0 49 // TOUCANA buffer 0 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B1 50 // TOUCANA buffer 1 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B2 51 // TOUCANA buffer 2 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B3 52 // TOUCANA buffer 3 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B4 53 // TOUCANA buffer 4 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B5 54 // TOUCANA buffer 5 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B6 55 // TOUCANA buffer 6 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B7 56 // TOUCANA buffer 7 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B8 57 // TOUCANA buffer 8 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B9 58 // TOUCANA buffer 9 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B10 59 // TOUCANA buffer 10 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B11 60 // TOUCANA buffer 11 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B12 61 // TOUCANA buffer 12 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B13 62 // TOUCANA buffer 13 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B14 63 // TOUCANA buffer 14 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B15 64 // TOUCANA buffer 15 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_BOFF 65 // TOUCANB buss off +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_ERR 66 // TOUCANB error +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_WU 67 // TOUCANB wake up +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B0 68 // TOUCANB buffer 0 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B1 69 // TOUCANB buffer 1 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B2 70 // TOUCANB buffer 2 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B3 71 // TOUCANB buffer 3 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B4 72 // TOUCANB buffer 4 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B5 73 // TOUCANB buffer 5 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B6 74 // TOUCANB buffer 6 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B7 75 // TOUCANB buffer 7 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B8 76 // TOUCANB buffer 8 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B9 77 // TOUCANB buffer 9 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B10 78 // TOUCANB buffer 10 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B11 79 // TOUCANB buffer 11 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B12 80 // TOUCANB buffer 12 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B13 81 // TOUCANB buffer 13 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B14 82 // TOUCANB buffer 14 +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B15 83 // TOUCANB buffer 15 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH0 84 // TPU A channel 0 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH1 85 // TPU A channel 1 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH2 86 // TPU A channel 2 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH3 87 // TPU A channel 3 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH4 88 // TPU A channel 4 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH5 89 // TPU A channel 5 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH6 90 // TPU A channel 6 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH7 91 // TPU A channel 7 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH8 92 // TPU A channel 8 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH9 93 // TPU A channel 9 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH10 94 // TPU A channel 10 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH11 95 // TPU A channel 11 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH12 96 // TPU A channel 12 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH13 97 // TPU A channel 13 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH14 98 // TPU A channel 14 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH15 99 // TPU A channel 15 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH0 100 // TPU B channel 0 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH1 101 // TPU B channel 1 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH2 102 // TPU B channel 2 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH3 103 // TPU B channel 3 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH4 104 // TPU B channel 4 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH5 105 // TPU B channel 5 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH6 106 // TPU B channel 6 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH7 107 // TPU B channel 7 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH8 108 // TPU B channel 8 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH9 109 // TPU B channel 9 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH10 110 // TPU B channel 10 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH11 111 // TPU B channel 11 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH12 112 // TPU B channel 12 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH13 113 // TPU B channel 13 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH14 114 // TPU B channel 14 +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH15 115 // TPU B channel 15 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM0 116 // MIOS PWM0 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM1 117 // MIOS PWM1 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM2 118 // MIOS PWM2 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM3 119 // MIOS PWM3 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM6 120 // MIOS MCSM6 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM11 121 // MIOS MDASM11 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM12 122 // MIOS MDASM12 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM13 123 // MIOS MDASM13 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM14 124 // MIOS MDASM14 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM15 125 // MIOS MDASM15 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM16 126 // MIOS PWM16 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM17 127 // MIOS PWM17 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM18 128 // MIOS PWM18 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM19 129 // MIOS PWM19 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM22 130 // MIOS MCSM22 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM27 131 // MIOS MDASM27 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM28 132 // MIOS MDASM28 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM29 133 // MIOS MDASM29 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM30 134 // MIOS MDASM30 +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM31 135 // MIOS MDASM31 + +#define CYGNUM_HAL_ISR_MIN CYGNUM_HAL_INTERRUPT_DECREMENTER +#define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM31 + +//-------------------------------------------------------------------------- +// Interrupt controller access +static __inline__ void +cyg_hal_interrupt_mask ( cyg_uint32 vector ) +{ + switch (vector) { + case CYGNUM_HAL_INTERRUPT_SIU_IRQ0 ... CYGNUM_HAL_INTERRUPT_SIU_LVL7: + { + // SIU interrupt vectors + cyg_uint32 simask; + + HAL_READ_UINT32 (CYGARC_REG_IMM_SIMASK, simask); + simask &= ~(((cyg_uint32) CYGARC_REG_IMM_SIMASK_IRM0) + >> (vector - CYGNUM_HAL_INTERRUPT_SIU_IRQ0)); + HAL_WRITE_UINT32 (CYGARC_REG_IMM_SIMASK, simask); + break; + } + case CYGNUM_HAL_INTERRUPT_SIU_TB_A : + { + // TimeBase A interrupt + cyg_uint16 tbscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFAE); + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFA); // Prevent from clearing interrupt flags + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFB); // accidently. Just do what is asked. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + break; + } + case CYGNUM_HAL_INTERRUPT_SIU_TB_B : + { + // TimeBase B interrupt + cyg_uint16 tbscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFBE); + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFA); // Prevent from clearing interrupt flags + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFB); // accidently. Just do what is asked. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + break; + } + case CYGNUM_HAL_INTERRUPT_SIU_PIT: + { + // Periodic Interrupt + cyg_uint16 piscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + piscr &= ~(CYGARC_REG_IMM_PISCR_PIE); + piscr &= ~(CYGARC_REG_IMM_PISCR_PS); // Prevent from clearing interrupt flag. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + break; + } + case CYGNUM_HAL_INTERRUPT_SIU_RTC_SEC: + { + // Real Time Clock Second + cyg_uint16 rtcsc; + + HAL_READ_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_SIE); + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_SEC); // Prevent from clearing interrupt flags + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_ALR); // Accidently. Just do what is asked. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + break; + } + case CYGNUM_HAL_INTERRUPT_SIU_RTC_ALR: + { + // Real Time Clock Alarm + cyg_uint16 rtcsc; + + HAL_READ_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_ALE); + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_SEC); // Prevent from clearing interrupt flags + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_ALR); // accidently. Just do what is asked. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_COL: + { + // PLL change of lock + cyg_uint16 colir; + + HAL_READ_UINT16 (CYGARC_REG_IMM_COLIR, colir); + colir &= ~(CYGARC_REG_IMM_COLIR_COLIE); + colir &= ~(CYGARC_REG_IMM_COLIR_COLIS); // Prevent from clearing interrupt flag accidently. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_COLIR, colir); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI1: + { + cyg_uint16 quacr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR1_A, quacr1); + quacr1 &= ~(CYGARC_REG_IMM_QUACR1_CIE1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR1_A, quacr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI1: + { + cyg_uint16 quacr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR1_A, quacr1); + quacr1 &= ~(CYGARC_REG_IMM_QUACR1_PIE1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR1_A, quacr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI2: + { + cyg_uint16 quacr2; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR2_A, quacr2); + quacr2 &= ~(CYGARC_REG_IMM_QUACR2_CIE2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR2_A, quacr2); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI2: + { + cyg_uint16 quacr2; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR2_A, quacr2); + quacr2 &= ~(CYGARC_REG_IMM_QUACR2_PIE2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR2_A, quacr2); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI1: + { + cyg_uint16 quacr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR1_B, quacr1); + quacr1 &= ~(CYGARC_REG_IMM_QUACR1_CIE1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR1_B, quacr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI1: + { + cyg_uint16 quacr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR1_B, quacr1); + quacr1 &= ~(CYGARC_REG_IMM_QUACR1_PIE1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR1_B, quacr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI2: + { + cyg_uint16 quacr2; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR2_B, quacr2); + quacr2 &= ~(CYGARC_REG_IMM_QUACR2_CIE2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR2_B, quacr2); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI2: + { + cyg_uint16 quacr2; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR2_B, quacr2); + quacr2 &= ~(CYGARC_REG_IMM_QUACR2_PIE2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR2_B, quacr2); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + sccxr1 &= ~(CYGARC_REG_IMM_SCCxR1_TIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TXC: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + sccxr1 &= ~(CYGARC_REG_IMM_SCCxR1_TCIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + sccxr1 &= ~(CYGARC_REG_IMM_SCCxR1_RIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_IDLE: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + sccxr1 &= ~(CYGARC_REG_IMM_SCCxR1_ILIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + sccxr1 &= ~(CYGARC_REG_IMM_SCCxR1_TIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXC: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + sccxr1 &= ~(CYGARC_REG_IMM_SCCxR1_TCIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + sccxr1 &= ~(CYGARC_REG_IMM_SCCxR1_RIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_IDLE: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + sccxr1 &= ~(CYGARC_REG_IMM_SCCxR1_ILIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQTHF: + { + cyg_uint16 qsci1cr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + qsci1cr &= ~(CYGARC_REG_IMM_QSCI1CR_QTHFI); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQBHF: + { + cyg_uint16 qsci1cr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + qsci1cr &= ~(CYGARC_REG_IMM_QSCI1CR_QBHFI); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQTHE: + { + cyg_uint16 qsci1cr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + qsci1cr &= ~(CYGARC_REG_IMM_QSCI1CR_QTHEI); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQBHE: + { + cyg_uint16 qsci1cr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + qsci1cr &= ~(CYGARC_REG_IMM_QSCI1CR_QBHEI); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_FI: + { + cyg_uint16 spcr2; + + HAL_READ_UINT16(CYGARC_REG_IMM_SPCR2, spcr2); + spcr2 &= ~(CYGARC_REG_IMM_SPCR2_SPIFIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SPCR2, spcr2); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_MODF: + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_HALTA: + { + cyg_uint16 spcr3; + + HAL_READ_UINT16(CYGARC_REG_IMM_SPCR3, spcr3); + spcr3 &= ~(CYGARC_REG_IMM_SPCR3_HMIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SPCR3, spcr3); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_BOFF: + { + cyg_uint16 canctrl0; + + HAL_READ_UINT16(CYGARC_REG_IMM_CANCTRL0_A_CANCTRL1_A, canctrl0); + canctrl0 &= ~(CYGARC_REG_IMM_CANCTRL0_BOFFMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CANCTRL0_A_CANCTRL1_A, canctrl0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_ERR: + { + cyg_uint16 canctrl0; + + HAL_READ_UINT16(CYGARC_REG_IMM_CANCTRL0_A_CANCTRL1_A, canctrl0); + canctrl0 &= ~(CYGARC_REG_IMM_CANCTRL0_ERRMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CANCTRL0_A_CANCTRL1_A, canctrl0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_WU: + { + cyg_uint16 tcnmcr; + + HAL_READ_UINT16(CYGARC_REG_IMM_TCNMCR_A, tcnmcr); + tcnmcr &= ~(CYGARC_REG_IMM_TCNMCR_WAKEMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_TCNMCR_A, tcnmcr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B0: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B1: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B2: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B3: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B4: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B5: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B6: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B7: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B8: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B9: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B10: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B11: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B12: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B13: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B14: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B15: + { + cyg_uint16 imask; + + HAL_READ_UINT16(CYGARC_REG_IMM_IMASK_A, imask); + imask &= ~(((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_IMASK_A, imask); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_BOFF: + { + cyg_uint16 canctrl0; + + HAL_READ_UINT16(CYGARC_REG_IMM_CANCTRL0_B_CANCTRL1_B, canctrl0); + canctrl0 &= ~(CYGARC_REG_IMM_CANCTRL0_BOFFMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CANCTRL0_B_CANCTRL1_B, canctrl0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_ERR: + { + cyg_uint16 canctrl0; + + HAL_READ_UINT16(CYGARC_REG_IMM_CANCTRL0_B_CANCTRL1_B, canctrl0); + canctrl0 &= ~(CYGARC_REG_IMM_CANCTRL0_ERRMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CANCTRL0_B_CANCTRL1_B, canctrl0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_WU: + { + cyg_uint16 tcnmcr; + + HAL_READ_UINT16(CYGARC_REG_IMM_TCNMCR_B, tcnmcr); + tcnmcr &= ~(CYGARC_REG_IMM_TCNMCR_WAKEMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_TCNMCR_B, tcnmcr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B0: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B1: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B2: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B3: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B4: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B5: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B6: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B7: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B8: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B9: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B10: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B11: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B12: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B13: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B14: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B15: + { + cyg_uint16 imask; + + HAL_READ_UINT16(CYGARC_REG_IMM_IMASK_B, imask); + imask &= ~(((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_IMASK_B, imask); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH0: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH1: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH2: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH3: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH4: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH5: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH6: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH7: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH8: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH9: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH10: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH11: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH12: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH13: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH14: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH15: + { + cyg_uint16 cier; + + HAL_READ_UINT16(CYGARC_REG_IMM_CIER_A, cier); + cier &= ~(((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CIER_A, cier); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH0: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH1: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH2: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH3: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH4: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH5: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH6: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH7: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH8: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH9: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH10: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH11: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH12: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH13: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH14: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH15: + { + cyg_uint16 cier; + + HAL_READ_UINT16(CYGARC_REG_IMM_CIER_B, cier); + cier &= ~(((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CIER_B, cier); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM0: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 &= ~(CYGARC_REG_IMM_MIOS1ER0_EN0); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM1: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 &= ~(CYGARC_REG_IMM_MIOS1ER0_EN1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM2: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 &= ~(CYGARC_REG_IMM_MIOS1ER0_EN2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM3: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 &= ~(CYGARC_REG_IMM_MIOS1ER0_EN3); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM6: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 &= ~(CYGARC_REG_IMM_MIOS1ER0_EN6); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM11: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 &= ~(CYGARC_REG_IMM_MIOS1ER0_EN11); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM12: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 &= ~(CYGARC_REG_IMM_MIOS1ER0_EN12); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM13: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 &= ~(CYGARC_REG_IMM_MIOS1ER0_EN13); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM14: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 &= ~(CYGARC_REG_IMM_MIOS1ER0_EN14); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM15: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 &= ~(CYGARC_REG_IMM_MIOS1ER0_EN15); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM16: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 &= ~(CYGARC_REG_IMM_MIOS1ER1_EN16); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM17: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 &= ~(CYGARC_REG_IMM_MIOS1ER1_EN17); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM18: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 &= ~(CYGARC_REG_IMM_MIOS1ER1_EN18); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM19: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 &= ~(CYGARC_REG_IMM_MIOS1ER1_EN19); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM22: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 &= ~(CYGARC_REG_IMM_MIOS1ER1_EN22); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM27: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 &= ~(CYGARC_REG_IMM_MIOS1ER1_EN27); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM28: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 &= ~(CYGARC_REG_IMM_MIOS1ER1_EN28); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM29: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 &= ~(CYGARC_REG_IMM_MIOS1ER1_EN29); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM30: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 &= ~(CYGARC_REG_IMM_MIOS1ER1_EN30); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM31: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 &= ~(CYGARC_REG_IMM_MIOS1ER1_EN31); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + default: + CYG_FAIL("Unknown Interrupt!!!"); + break; + } +} + +static __inline__ void +cyg_hal_interrupt_unmask ( cyg_uint32 vector ) +{ + switch (vector) { + case CYGNUM_HAL_INTERRUPT_SIU_IRQ0 ... CYGNUM_HAL_INTERRUPT_SIU_LVL7: + { + // SIU interrupt vectors + cyg_uint32 simask; + + HAL_READ_UINT32 (CYGARC_REG_IMM_SIMASK, simask); + simask |= (((cyg_uint32) CYGARC_REG_IMM_SIMASK_IRM0) + >> (vector - CYGNUM_HAL_INTERRUPT_SIU_IRQ0)); + HAL_WRITE_UINT32 (CYGARC_REG_IMM_SIMASK, simask); + break; + } + case CYGNUM_HAL_INTERRUPT_SIU_TB_A : + { + // TimeBase A interrupt + cyg_uint16 tbscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + tbscr |= (CYGARC_REG_IMM_TBSCR_REFAE); + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFA); // Prevent from clearing interrupt flags + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFB); // accidently. Just do what is asked. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + break; + } + case CYGNUM_HAL_INTERRUPT_SIU_TB_B : + { + // TimeBase B interrupt + cyg_uint16 tbscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + tbscr |= (CYGARC_REG_IMM_TBSCR_REFBE); + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFA); // Prevent from clearing interrupt flags + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFB); // accidently. Just do what is asked. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + break; + } + case CYGNUM_HAL_INTERRUPT_SIU_PIT: + { + // Periodic Interrupt + cyg_uint16 piscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + piscr |= (CYGARC_REG_IMM_PISCR_PIE); + piscr &= ~(CYGARC_REG_IMM_PISCR_PS); // Prevent from clearing interrupt flag. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + break; + } + case CYGNUM_HAL_INTERRUPT_SIU_RTC_SEC: + { + // Real Time Clock Second + cyg_uint16 rtcsc; + + HAL_READ_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + rtcsc |= (CYGARC_REG_IMM_RTCSC_SIE); + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_SEC); // Prevent from clearing interrupt flags + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_ALR); // accidently. Just do what is asdked. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + break; + } + case CYGNUM_HAL_INTERRUPT_SIU_RTC_ALR: + { + // Real Time Clock Alarm + cyg_uint16 rtcsc; + + HAL_READ_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + rtcsc |= (CYGARC_REG_IMM_RTCSC_ALE); + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_SEC); // Prevent from clearing interrupt flags + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_ALR); // accidently. Just do what is asdked. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_COL: + { + // PLL change of lock + cyg_uint16 colir; + + HAL_READ_UINT16 (CYGARC_REG_IMM_COLIR, colir); + colir |= (CYGARC_REG_IMM_COLIR_COLIE); + colir &= ~(CYGARC_REG_IMM_COLIR_COLIS); // Prevent from clearing interrupt flag accidently. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_COLIR, colir); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI1: + { + cyg_uint16 quacr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR1_A, quacr1); + quacr1 |= (CYGARC_REG_IMM_QUACR1_CIE1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR1_A, quacr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI1: + { + cyg_uint16 quacr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR1_A, quacr1); + quacr1 |= (CYGARC_REG_IMM_QUACR1_PIE1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR1_A, quacr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI2: + { + cyg_uint16 quacr2; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR2_A, quacr2); + quacr2 |= (CYGARC_REG_IMM_QUACR2_CIE2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR2_A, quacr2); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI2: + { + cyg_uint16 quacr2; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR2_A, quacr2); + quacr2 |= (CYGARC_REG_IMM_QUACR2_PIE2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR2_A, quacr2); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI1: + { + cyg_uint16 quacr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR1_B, quacr1); + quacr1 |= (CYGARC_REG_IMM_QUACR1_CIE1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR1_B, quacr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI1: + { + cyg_uint16 quacr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR1_B, quacr1); + quacr1 |= (CYGARC_REG_IMM_QUACR1_PIE1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR1_B, quacr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI2: + { + cyg_uint16 quacr2; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR2_B, quacr2); + quacr2 |= (CYGARC_REG_IMM_QUACR2_CIE2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR2_B, quacr2); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI2: + { + cyg_uint16 quacr2; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUACR2_B, quacr2); + quacr2 |= (CYGARC_REG_IMM_QUACR2_PIE2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUACR2_B, quacr2); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + sccxr1 |= (CYGARC_REG_IMM_SCCxR1_TIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TXC: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + sccxr1 |= (CYGARC_REG_IMM_SCCxR1_TCIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + sccxr1 |= (CYGARC_REG_IMM_SCCxR1_RIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_IDLE: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + sccxr1 |= (CYGARC_REG_IMM_SCCxR1_ILIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC1R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + sccxr1 |= (CYGARC_REG_IMM_SCCxR1_TIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXC: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + sccxr1 |= (CYGARC_REG_IMM_SCCxR1_TCIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + sccxr1 |= (CYGARC_REG_IMM_SCCxR1_RIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_IDLE: + { + cyg_uint16 sccxr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + sccxr1 |= (CYGARC_REG_IMM_SCCxR1_ILIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SCC2R1, sccxr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQTHF: + { + cyg_uint16 qsci1cr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + qsci1cr |= (CYGARC_REG_IMM_QSCI1CR_QTHFI); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQBHF: + { + cyg_uint16 qsci1cr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + qsci1cr |= (CYGARC_REG_IMM_QSCI1CR_QBHFI); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQTHE: + { + cyg_uint16 qsci1cr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + qsci1cr |= (CYGARC_REG_IMM_QSCI1CR_QTHEI); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQBHE: + { + cyg_uint16 qsci1cr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + qsci1cr |= (CYGARC_REG_IMM_QSCI1CR_QBHEI); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1CR, qsci1cr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_FI: + { + cyg_uint16 spcr2; + + HAL_READ_UINT16(CYGARC_REG_IMM_SPCR2, spcr2); + spcr2 |= (CYGARC_REG_IMM_SPCR2_SPIFIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SPCR2, spcr2); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_MODF: + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_HALTA: + { + cyg_uint16 spcr3; + + HAL_READ_UINT16(CYGARC_REG_IMM_SPCR3, spcr3); + spcr3 |= (CYGARC_REG_IMM_SPCR3_HMIE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SPCR3, spcr3); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_BOFF: + { + cyg_uint16 canctrl0; + + HAL_READ_UINT16(CYGARC_REG_IMM_CANCTRL0_A_CANCTRL1_A, canctrl0); + canctrl0 |= (CYGARC_REG_IMM_CANCTRL0_BOFFMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CANCTRL0_A_CANCTRL1_A, canctrl0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_ERR: + { + cyg_uint16 canctrl0; + + HAL_READ_UINT16(CYGARC_REG_IMM_CANCTRL0_A_CANCTRL1_A, canctrl0); + canctrl0 |= (CYGARC_REG_IMM_CANCTRL0_ERRMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CANCTRL0_A_CANCTRL1_A, canctrl0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_WU: + { + cyg_uint16 tcnmcr; + + HAL_READ_UINT16(CYGARC_REG_IMM_TCNMCR_A, tcnmcr); + tcnmcr |= (CYGARC_REG_IMM_TCNMCR_WAKEMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_TCNMCR_A, tcnmcr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B0: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B1: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B2: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B3: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B4: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B5: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B6: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B7: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B8: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B9: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B10: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B11: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B12: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B13: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B14: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B15: + { + cyg_uint16 imask; + + HAL_READ_UINT16(CYGARC_REG_IMM_IMASK_A, imask); + imask |= (((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_IMASK_A, imask); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_BOFF: + { + cyg_uint16 canctrl0; + + HAL_READ_UINT16(CYGARC_REG_IMM_CANCTRL0_B_CANCTRL1_B, canctrl0); + canctrl0 |= (CYGARC_REG_IMM_CANCTRL0_BOFFMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CANCTRL0_B_CANCTRL1_B, canctrl0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_ERR: + { + cyg_uint16 canctrl0; + + HAL_READ_UINT16(CYGARC_REG_IMM_CANCTRL0_B_CANCTRL1_B, canctrl0); + canctrl0 |= (CYGARC_REG_IMM_CANCTRL0_ERRMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CANCTRL0_B_CANCTRL1_B, canctrl0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_WU: + { + cyg_uint16 tcnmcr; + + HAL_READ_UINT16(CYGARC_REG_IMM_TCNMCR_B, tcnmcr); + tcnmcr |= (CYGARC_REG_IMM_TCNMCR_WAKEMSK); + HAL_WRITE_UINT16(CYGARC_REG_IMM_TCNMCR_B, tcnmcr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B0: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B1: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B2: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B3: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B4: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B5: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B6: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B7: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B8: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B9: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B10: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B11: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B12: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B13: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B14: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B15: + { + cyg_uint16 imask; + + HAL_READ_UINT16(CYGARC_REG_IMM_IMASK_B, imask); + imask |= (((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_IMASK_B, imask); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH0: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH1: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH2: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH3: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH4: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH5: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH6: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH7: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH8: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH9: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH10: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH11: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH12: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH13: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH14: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH15: + { + cyg_uint16 cier; + + HAL_READ_UINT16(CYGARC_REG_IMM_CIER_A, cier); + cier |= (((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CIER_A, cier); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH0: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH1: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH2: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH3: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH4: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH5: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH6: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH7: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH8: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH9: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH10: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH11: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH12: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH13: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH14: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH15: + { + cyg_uint16 cier; + + HAL_READ_UINT16(CYGARC_REG_IMM_CIER_B, cier); + cier |= (((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CIER_B, cier); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM0: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 |= (CYGARC_REG_IMM_MIOS1ER0_EN0); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM1: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 |= (CYGARC_REG_IMM_MIOS1ER0_EN1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM2: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 |= (CYGARC_REG_IMM_MIOS1ER0_EN2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM3: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 |= (CYGARC_REG_IMM_MIOS1ER0_EN3); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM6: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 |= (CYGARC_REG_IMM_MIOS1ER0_EN6); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM11: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 |= (CYGARC_REG_IMM_MIOS1ER0_EN11); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM12: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 |= (CYGARC_REG_IMM_MIOS1ER0_EN12); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM13: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 |= (CYGARC_REG_IMM_MIOS1ER0_EN13); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM14: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 |= (CYGARC_REG_IMM_MIOS1ER0_EN14); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM15: + { + cyg_uint16 mios1er0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + mios1er0 |= (CYGARC_REG_IMM_MIOS1ER0_EN15); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER0, mios1er0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM16: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 |= (CYGARC_REG_IMM_MIOS1ER1_EN16); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM17: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 |= (CYGARC_REG_IMM_MIOS1ER1_EN17); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM18: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 |= (CYGARC_REG_IMM_MIOS1ER1_EN18); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM19: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 |= (CYGARC_REG_IMM_MIOS1ER1_EN19); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM22: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 |= (CYGARC_REG_IMM_MIOS1ER1_EN22); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM27: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 |= (CYGARC_REG_IMM_MIOS1ER1_EN27); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM28: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 |= (CYGARC_REG_IMM_MIOS1ER1_EN28); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM29: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 |= (CYGARC_REG_IMM_MIOS1ER1_EN29); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM30: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 |= (CYGARC_REG_IMM_MIOS1ER1_EN30); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM31: + { + cyg_uint16 mios1er1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + mios1er1 |= (CYGARC_REG_IMM_MIOS1ER1_EN31); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1ER1, mios1er1); + break; + } + + default: + CYG_FAIL("Unknown Interrupt!!!"); + break; + } +} + +static __inline__ void +cyg_hal_interrupt_acknowledge ( cyg_uint32 vector ) +{ + switch (vector) { + case CYGNUM_HAL_INTERRUPT_SIU_IRQ0 ... CYGNUM_HAL_INTERRUPT_SIU_LVL7: + { + // SIU interrupt vectors + cyg_uint32 sipend; + + // When IRQx is configured as an edge interrupt it needs to be + // cleared. Write to INTx and IRQ/level bits are ignore so + // it's safe to do always. + HAL_READ_UINT32 (CYGARC_REG_IMM_SIPEND, sipend); + sipend |= (((cyg_uint32) CYGARC_REG_IMM_SIPEND_IRQ0) + >> (vector - CYGNUM_HAL_INTERRUPT_SIU_IRQ0)); + HAL_WRITE_UINT32 (CYGARC_REG_IMM_SIPEND, sipend); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_TB_A: + { + // TimeBase A interrupt + cyg_uint16 tbscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + tbscr |= CYGARC_REG_IMM_TBSCR_REFA; + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFB); // Only acknowledge the requested one + HAL_WRITE_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_TB_B: + { + // TimeBase B interrupt + cyg_uint16 tbscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + tbscr |= CYGARC_REG_IMM_TBSCR_REFB; + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFA); // Only acknowledge the requested one. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_PIT: + { + // Periodic Interrupt + cyg_uint16 piscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + piscr |= CYGARC_REG_IMM_PISCR_PS; + HAL_WRITE_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_RTC_SEC: + { + // Real Time Clock Second + cyg_uint16 rtcsc; + + HAL_READ_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + rtcsc |= CYGARC_REG_IMM_RTCSC_SEC; + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_ALR); // Only acknowledge the requested one + HAL_WRITE_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_RTC_ALR: + { + // Real Time Clock Alarm + cyg_uint16 rtcsc; + + HAL_READ_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + rtcsc |= CYGARC_REG_IMM_RTCSC_ALR; + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_SEC); // Only acknowledge the requested one + HAL_WRITE_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_COL: + { + cyg_uint16 colir; + + HAL_READ_UINT16(CYGARC_REG_IMM_COLIR, colir); + colir |= CYGARC_REG_IMM_COLIR_COLIS; + HAL_WRITE_UINT16(CYGARC_REG_IMM_COLIR, colir); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI1: + { + cyg_uint16 quasr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUASR0_A, quasr0); + quasr0 &= ~(CYGARC_REG_IMM_QUASR0_CF1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUASR0_A, quasr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI1: + { + cyg_uint16 quasr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUASR0_A, quasr0); + quasr0 &= ~(CYGARC_REG_IMM_QUASR0_PF1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUASR0_A, quasr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI2: + { + cyg_uint16 quasr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUASR0_A, quasr0); + quasr0 &= ~(CYGARC_REG_IMM_QUASR0_CF2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUASR0_A, quasr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI2: + { + cyg_uint16 quasr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUASR0_A, quasr0); + quasr0 &= ~(CYGARC_REG_IMM_QUASR0_PF2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUASR0_A, quasr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI1: + { + cyg_uint16 quasr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUASR0_B, quasr0); + quasr0 &= ~(CYGARC_REG_IMM_QUASR0_CF1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUASR0_B, quasr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI1: + { + cyg_uint16 quasr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUASR0_B, quasr0); + quasr0 &= ~(CYGARC_REG_IMM_QUASR0_PF1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUASR0_B, quasr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI2: + { + cyg_uint16 quasr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUASR0_B, quasr0); + quasr0 &= ~(CYGARC_REG_IMM_QUASR0_CF2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUASR0_B, quasr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI2: + { + cyg_uint16 quasr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUASR0_B, quasr0); + quasr0 &= ~(CYGARC_REG_IMM_QUASR0_PF2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUASR0_B, quasr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TXC: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX: + // Nothing needs to be done here + break; + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_IDLE: + { + cyg_uint16 scxsr; + + HAL_READ_UINT16(CYGARC_REG_IMM_SC1SR, scxsr); + scxsr &= ~(CYGARC_REG_IMM_SCxSR_IDLE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SC1SR, scxsr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXC: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX: + // nothing needs to be done here + break; + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_IDLE: + { + cyg_uint16 scxsr; + + HAL_READ_UINT16(CYGARC_REG_IMM_SC2SR, scxsr); + scxsr &= ~(CYGARC_REG_IMM_SCxSR_IDLE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SC2SR, scxsr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQTHF: + { + cyg_uint16 qsci1sr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1SR, qsci1sr); + qsci1sr &= ~(CYGARC_REG_IMM_QSCI1SR_QTHF); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1SR, qsci1sr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQBHF: + { + cyg_uint16 qsci1sr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1SR, qsci1sr); + qsci1sr &= ~(CYGARC_REG_IMM_QSCI1SR_QBHF); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1SR, qsci1sr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQTHE: + { + cyg_uint16 qsci1sr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1SR, qsci1sr); + qsci1sr &= ~(CYGARC_REG_IMM_QSCI1SR_QTHE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1SR, qsci1sr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQBHE: + { + cyg_uint16 qsci1sr; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSCI1SR, qsci1sr); + qsci1sr &= ~(CYGARC_REG_IMM_QSCI1SR_QBHE); + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSCI1SR, qsci1sr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_FI: + { + cyg_uint16 spsr; + + HAL_READ_UINT16(CYGARC_REG_IMM_SPSR, spsr); + spsr &= ~(CYGARC_REG_IMM_SPSR_SPIF); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SPSR, spsr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_MODF: + { + cyg_uint16 spsr; + + HAL_READ_UINT16(CYGARC_REG_IMM_SPSR, spsr); + spsr &= ~(CYGARC_REG_IMM_SPSR_MODF); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SPSR, spsr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_HALTA: + { + cyg_uint16 spsr; + + HAL_READ_UINT16(CYGARC_REG_IMM_SPSR, spsr); + spsr &= ~(CYGARC_REG_IMM_SPSR_HALTA); + HAL_WRITE_UINT16(CYGARC_REG_IMM_SPSR, spsr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_BOFF: + { + cyg_uint16 estat; + + HAL_READ_UINT16(CYGARC_REG_IMM_ESTAT_A, estat); // Read the flag as a one + estat &= ~(CYGARC_REG_IMM_ESTAT_BOFFINT); + HAL_WRITE_UINT16(CYGARC_REG_IMM_ESTAT_A, estat); // And write it as a zero + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_ERR: + { + cyg_uint16 estat; + + HAL_READ_UINT16(CYGARC_REG_IMM_ESTAT_A, estat); // Read the flag as a one + estat &= ~(CYGARC_REG_IMM_ESTAT_ERRINT); + HAL_WRITE_UINT16(CYGARC_REG_IMM_ESTAT_A, estat); // And write it as a zero + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_WU: + { + cyg_uint16 estat; + + HAL_READ_UINT16(CYGARC_REG_IMM_ESTAT_A, estat); // Read tthe flag as a one + estat &= ~(CYGARC_REG_IMM_ESTAT_WAKEINT); + HAL_WRITE_UINT16(CYGARC_REG_IMM_ESTAT_A, estat); // And write it as a zero + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B0: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B1: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B2: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B3: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B4: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B5: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B6: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B7: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B8: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B9: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B10: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B11: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B12: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B13: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B14: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B15: + { + cyg_uint16 iflag; + + HAL_READ_UINT16(CYGARC_REG_IMM_IFLAG_A, iflag); // Read the flag as a one + iflag &= ~(((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_IFLAG_A, iflag); // And write it as a zero + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_BOFF: + { + cyg_uint16 estat; + + HAL_READ_UINT16(CYGARC_REG_IMM_ESTAT_B, estat); // Read the flag as a one + estat &= ~(CYGARC_REG_IMM_ESTAT_BOFFINT); + HAL_WRITE_UINT16(CYGARC_REG_IMM_ESTAT_B, estat); // And write it as a zero + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_ERR: + { + cyg_uint16 estat; + + HAL_READ_UINT16(CYGARC_REG_IMM_ESTAT_B, estat); // Read the flag as a one + estat &= ~(CYGARC_REG_IMM_ESTAT_ERRINT); + HAL_WRITE_UINT16(CYGARC_REG_IMM_ESTAT_B, estat); // And write it as a zero + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_WU: + { + cyg_uint16 estat; + + HAL_READ_UINT16(CYGARC_REG_IMM_ESTAT_B, estat); // Read the flag as a one + estat &= ~(CYGARC_REG_IMM_ESTAT_WAKEINT); + HAL_WRITE_UINT16(CYGARC_REG_IMM_ESTAT_B, estat); // And write it as a zero + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B0: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B1: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B2: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B3: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B4: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B5: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B6: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B7: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B8: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B9: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B10: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B11: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B12: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B13: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B14: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B15: + { + cyg_uint16 iflag; + + HAL_READ_UINT16(CYGARC_REG_IMM_IFLAG_B, iflag); // Read the flag as a one + iflag &= ~(((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_IFLAG_B, iflag); // And write it as a zero + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH0: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH1: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH2: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH3: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH4: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH5: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH6: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH7: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH8: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH9: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH10: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH11: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH12: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH13: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH14: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH15: + { + cyg_uint16 cisr; + + HAL_READ_UINT16(CYGARC_REG_IMM_CISR_A, cisr); + cisr &= ~(((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CISR_A, cisr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH0: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH1: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH2: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH3: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH4: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH5: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH6: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH7: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH8: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH9: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH10: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH11: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH12: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH13: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH14: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH15: + { + cyg_uint16 cisr; + + HAL_READ_UINT16(CYGARC_REG_IMM_CISR_B, cisr); + cisr &= ~(((cyg_uint16)0x0001) << (vector - CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH0)); + HAL_WRITE_UINT16(CYGARC_REG_IMM_CISR_B, cisr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM0: + { + cyg_uint16 mios1sr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + mios1sr0 &= ~(CYGARC_REG_IMM_MIOS1SR0_FL0); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM1: + { + cyg_uint16 mios1sr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + mios1sr0 &= ~(CYGARC_REG_IMM_MIOS1SR0_FL1); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM2: + { + cyg_uint16 mios1sr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + mios1sr0 &= ~(CYGARC_REG_IMM_MIOS1SR0_FL2); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM3: + { + cyg_uint16 mios1sr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + mios1sr0 &= ~(CYGARC_REG_IMM_MIOS1SR0_FL3); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM6: + { + cyg_uint16 mios1sr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + mios1sr0 &= ~(CYGARC_REG_IMM_MIOS1SR0_FL6); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM11: + { + cyg_uint16 mios1sr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + mios1sr0 &= ~(CYGARC_REG_IMM_MIOS1SR0_FL11); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM12: + { + cyg_uint16 mios1sr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + mios1sr0 &= ~(CYGARC_REG_IMM_MIOS1SR0_FL12); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM13: + { + cyg_uint16 mios1sr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + mios1sr0 &= ~(CYGARC_REG_IMM_MIOS1SR0_FL13); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM14: + { + cyg_uint16 mios1sr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + mios1sr0 &= ~(CYGARC_REG_IMM_MIOS1SR0_FL14); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM15: + { + cyg_uint16 mios1sr0; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + mios1sr0 &= ~(CYGARC_REG_IMM_MIOS1SR0_FL15); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR0, mios1sr0); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM16: + { + cyg_uint16 mios1sr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + mios1sr1 &= ~(CYGARC_REG_IMM_MIOS1SR1_FL16); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM17: + { + cyg_uint16 mios1sr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + mios1sr1 &= ~(CYGARC_REG_IMM_MIOS1SR1_FL17); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM18: + { + cyg_uint16 mios1sr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + mios1sr1 &= ~(CYGARC_REG_IMM_MIOS1SR1_FL18); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM19: + { + cyg_uint16 mios1sr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + mios1sr1 &= ~(CYGARC_REG_IMM_MIOS1SR1_FL19); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM22: + { + cyg_uint16 mios1sr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + mios1sr1 &= ~(CYGARC_REG_IMM_MIOS1SR1_FL22); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM27: + { + cyg_uint16 mios1sr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + mios1sr1 &= ~(CYGARC_REG_IMM_MIOS1SR1_FL27); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM28: + { + cyg_uint16 mios1sr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + mios1sr1 &= ~(CYGARC_REG_IMM_MIOS1SR1_FL28); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM29: + { + cyg_uint16 mios1sr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + mios1sr1 &= ~(CYGARC_REG_IMM_MIOS1SR1_FL29); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM30: + { + cyg_uint16 mios1sr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + mios1sr1 &= ~(CYGARC_REG_IMM_MIOS1SR1_FL30); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM31: + { + cyg_uint16 mios1sr1; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + mios1sr1 &= ~(CYGARC_REG_IMM_MIOS1SR1_FL31); + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1SR1, mios1sr1); + break; + } + + + default: + CYG_FAIL("Unknown Interrupt!!!"); + break; + } +} + +static __inline__ void +cyg_hal_interrupt_configure ( cyg_uint32 vector, + cyg_bool level, + cyg_bool up ) +{ + switch (vector) { + // Only external interrupts can be fully configured in the true meaning of the word + case CYGNUM_HAL_INTERRUPT_SIU_IRQ0: + case CYGNUM_HAL_INTERRUPT_SIU_IRQ1: + case CYGNUM_HAL_INTERRUPT_SIU_IRQ2: + case CYGNUM_HAL_INTERRUPT_SIU_IRQ3: + case CYGNUM_HAL_INTERRUPT_SIU_IRQ4: + case CYGNUM_HAL_INTERRUPT_SIU_IRQ5: + case CYGNUM_HAL_INTERRUPT_SIU_IRQ6: + case CYGNUM_HAL_INTERRUPT_SIU_IRQ7: + { + // External interrupts + cyg_uint32 siel, bit; + + CYG_ASSERT( level || !up, "Only falling edge is supported"); + + bit = (((cyg_uint32) CYGARC_REG_IMM_SIEL_ED0) + >> (vector - CYGNUM_HAL_INTERRUPT_SIU_IRQ0)); + + HAL_READ_UINT32 (CYGARC_REG_IMM_SIEL, siel); + siel &= ~bit; + if (!level) { + // Set edge detect bit. + siel |= bit; + } + HAL_WRITE_UINT32 (CYGARC_REG_IMM_SIEL, siel); + break; + } + + // Attempts to configure all other interrupt sources should fail + default: + CYG_FAIL("Unknown Interrupt!!!"); + break; + } +} + +static __inline__ void +cyg_hal_interrupt_set_level ( cyg_uint32 vector, cyg_uint32 level ) +{ + if(vector < CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI1) + { + // Note: highest priority has the lowest numerical value. + CYG_ASSERT( level >= CYGARC_SIU_PRIORITY_HIGH, "Invalid priority"); + CYG_ASSERT( level <= CYGARC_SIU_PRIORITY_LOW, "Invalid priority"); + } + else + { + CYG_ASSERT( level >= CYGARC_IMB3_PRIORITY_HIGH, "Invalid priority"); + CYG_ASSERT( level <= CYGARC_IMB3_PRIORITY_LOW, "Invalid priority"); + } + + switch (vector) { + case CYGNUM_HAL_INTERRUPT_SIU_IRQ0 ... CYGNUM_HAL_INTERRUPT_SIU_LVL7: + // These cannot be configured. + break; + + case CYGNUM_HAL_INTERRUPT_SIU_TB_A: + case CYGNUM_HAL_INTERRUPT_SIU_TB_B: + { + // TimeBase A+B interrupt + cyg_uint16 tbscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + tbscr &= ~(CYGARC_REG_IMM_TBSCR_IRQMASK); + tbscr |= CYGARC_REG_IMM_TBSCR_IRQ0 >> level; + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFA); // Prevent fom clearing interrupt flags + tbscr &= ~(CYGARC_REG_IMM_TBSCR_REFB); // accidently. Just do what is asked. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_PIT: + { + // Periodic Interrupt + cyg_uint16 piscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + piscr &= ~(CYGARC_REG_IMM_PISCR_IRQMASK); + piscr |= CYGARC_REG_IMM_PISCR_IRQ0 >> level; + piscr &= ~(CYGARC_REG_IMM_PISCR_PS); // Prevent from clearing interrupt flag. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_RTC_SEC: + case CYGNUM_HAL_INTERRUPT_SIU_RTC_ALR: + { + // Real Time Clock Second & Real Time Clock Alarm + cyg_uint16 rtcsc; + + HAL_READ_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_IRQMASK); + rtcsc |= CYGARC_REG_IMM_RTCSC_IRQ0 >> level; + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_SEC); // Prevent from clearing interrupt flags + rtcsc &= ~(CYGARC_REG_IMM_RTCSC_ALR); // accidently. Just do wahat is asked. + HAL_WRITE_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + break; + } + + case CYGNUM_HAL_INTERRUPT_SIU_COL: + { + cyg_uint16 colir; + + HAL_READ_UINT16(CYGARC_REG_IMM_COLIR, colir); + colir &= ~(CYGARC_REG_IMM_COLIR_COLIRQ); // mask out the level + colir |= CYGARC_REG_IMM_COLIR_IRQ0 >> level; // and set the new level + colir &= ~(CYGARC_REG_IMM_COLIR_COLIS); // Prevent from clearing interrupt flag accidently. + HAL_WRITE_UINT16(CYGARC_REG_IMM_COLIR, colir); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI1: + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI1: + { + cyg_uint16 quadc64int; + cyg_uint16 the_level = level << CYGARC_REG_IMM_QUADC64INT_IRL1_SHIFT; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUADC64INT_A, quadc64int); + quadc64int &= ~(CYGARC_REG_IMM_QUADC64INT_IRL1); + quadc64int |= the_level; + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUADC64INT_A, quadc64int); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI2: + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI2: + { + cyg_uint16 quadc64int; + cyg_uint16 the_level = level << CYGARC_REG_IMM_QUADC64INT_IRL2_SHIFT; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUADC64INT_A, quadc64int); + quadc64int &= ~(CYGARC_REG_IMM_QUADC64INT_IRL2); + quadc64int |= the_level; + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUADC64INT_A, quadc64int); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI1: + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI1: + { + cyg_uint16 quadc64int; + cyg_uint16 the_level = level << CYGARC_REG_IMM_QUADC64INT_IRL1_SHIFT; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUADC64INT_B, quadc64int); + quadc64int &= ~(CYGARC_REG_IMM_QUADC64INT_IRL1); + quadc64int |= the_level; + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUADC64INT_B, quadc64int); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI2: + case CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI2: + { + cyg_uint16 quadc64int; + cyg_uint16 the_level = level << CYGARC_REG_IMM_QUADC64INT_IRL2_SHIFT; + + HAL_READ_UINT16(CYGARC_REG_IMM_QUADC64INT_B, quadc64int); + quadc64int &= ~(CYGARC_REG_IMM_QUADC64INT_IRL2); + quadc64int |= the_level; + HAL_WRITE_UINT16(CYGARC_REG_IMM_QUADC64INT_B, quadc64int); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TXC: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI0_IDLE: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXC: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_IDLE: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQTHF: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQBHF: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQTHE: + case CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQBHE: + { + cyg_uint16 qdsci_il; + cyg_uint16 the_level = level << CYGARC_REG_IMM_QDSCI_IL_ILDSCI_SHIFT; + + HAL_READ_UINT16(CYGARC_REG_IMM_QDSCI_IL, qdsci_il); + qdsci_il &= ~(CYGARC_REG_IMM_QDSCI_IL_ILDSCI); + qdsci_il |= the_level; + HAL_WRITE_UINT16(CYGARC_REG_IMM_QDSCI_IL, qdsci_il); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_FI: + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_MODF: + case CYGNUM_HAL_INTERRUPT_IMB3_SPI_HALTA: + { + cyg_uint16 qspi_il; + cyg_uint16 the_level = level << CYGARC_REG_IMM_QSPI_IL_ILQSPI_SHIFT; + + HAL_READ_UINT16(CYGARC_REG_IMM_QSPI_IL, qspi_il); + qspi_il &= ~(CYGARC_REG_IMM_QSPI_IL_ILQSPI); + qspi_il |= the_level; + HAL_WRITE_UINT16(CYGARC_REG_IMM_QSPI_IL, qspi_il); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_BOFF: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_ERR: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_WU: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B0: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B1: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B2: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B3: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B4: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B5: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B6: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B7: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B8: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B9: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B10: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B11: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B12: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B13: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B14: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B15: + { + cyg_uint16 irl = (level % 8) << CYGARC_REG_IMM_CANICR_IRL_SHIFT; + cyg_uint16 ilsb = (level / 8) << CYGARC_REG_IMM_CANICR_ILBS_SHIFT; + cyg_uint16 canicr; + + HAL_READ_UINT16(CYGARC_REG_IMM_CANICR_A, canicr); + canicr &= ~(CYGARC_REG_IMM_CANICR_IRL); + canicr &= ~(CYGARC_REG_IMM_CANICR_ILBS); + canicr |= irl; + canicr |= ilsb; + HAL_WRITE_UINT16(CYGARC_REG_IMM_CANICR_A, canicr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_BOFF: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_ERR: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_WU: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B0: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B1: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B2: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B3: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B4: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B5: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B6: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B7: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B8: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B9: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B10: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B11: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B12: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B13: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B14: + case CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B15: + { + cyg_uint16 irl = (level % 8) << CYGARC_REG_IMM_CANICR_IRL_SHIFT; + cyg_uint16 ilsb = (level / 8) << CYGARC_REG_IMM_CANICR_ILBS_SHIFT; + cyg_uint16 canicr; + + HAL_READ_UINT16(CYGARC_REG_IMM_CANICR_B, canicr); + canicr &= ~(CYGARC_REG_IMM_CANICR_IRL); + canicr &= ~(CYGARC_REG_IMM_CANICR_ILBS); + canicr |= irl; + canicr |= ilsb; + HAL_WRITE_UINT16(CYGARC_REG_IMM_CANICR_B, canicr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH0: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH1: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH2: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH3: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH4: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH5: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH6: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH7: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH8: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH9: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH10: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH11: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH12: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH13: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH14: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH15: + { + cyg_uint16 cirl = (level % 8) << CYGARC_REG_IMM_TICR_CIRL_SHIFT; + cyg_uint16 ilsb = (level / 8) << CYGARC_REG_IMM_TICR_ILBS_SHIFT; + cyg_uint16 ticr; + + HAL_READ_UINT16(CYGARC_REG_IMM_TICR_A, ticr); + ticr &= ~(CYGARC_REG_IMM_TICR_CIRL); + ticr &= ~(CYGARC_REG_IMM_TICR_ILBS); + ticr |= cirl; + ticr |= ilsb; + HAL_WRITE_UINT16(CYGARC_REG_IMM_TICR_A, ticr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH0: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH1: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH2: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH3: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH4: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH5: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH6: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH7: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH8: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH9: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH10: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH11: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH12: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH13: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH14: + case CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH15: + { + cyg_uint16 cirl = (level % 8) << CYGARC_REG_IMM_TICR_CIRL_SHIFT; + cyg_uint16 ilsb = (level / 8) << CYGARC_REG_IMM_TICR_ILBS_SHIFT; + cyg_uint16 ticr; + + HAL_READ_UINT16(CYGARC_REG_IMM_TICR_B, ticr); + ticr &= ~(CYGARC_REG_IMM_TICR_CIRL); + ticr &= ~(CYGARC_REG_IMM_TICR_ILBS); + ticr |= cirl; + ticr |= ilsb; + HAL_WRITE_UINT16(CYGARC_REG_IMM_TICR_B, ticr); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM0: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM1: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM2: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM3: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM6: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM11: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM12: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM13: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM14: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM15: + { + cyg_uint16 lvl = (level % 8) << CYGARC_REG_IMM_MIOS1LVL_LVL_SHIFT; + cyg_uint16 tm = (level / 8) << CYGARC_REG_IMM_MIOS1LVL_TM_SHIFT; + cyg_uint16 mios1lvl; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1LVL0, mios1lvl); + mios1lvl &= ~(CYGARC_REG_IMM_MIOS1LVL_LVL); + mios1lvl &= ~(CYGARC_REG_IMM_MIOS1LVL_TM); + mios1lvl |= lvl; + mios1lvl |= tm; + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1LVL0, mios1lvl); + break; + } + + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM16: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM17: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM18: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM19: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM22: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM27: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM28: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM29: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM30: + case CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM31: + { + cyg_uint16 lvl = (level % 8) << CYGARC_REG_IMM_MIOS1LVL_LVL_SHIFT; + cyg_uint16 tm = (level / 8) << CYGARC_REG_IMM_MIOS1LVL_TM_SHIFT; + cyg_uint16 mios1lvl; + + HAL_READ_UINT16(CYGARC_REG_IMM_MIOS1LVL1, mios1lvl); + mios1lvl &= ~(CYGARC_REG_IMM_MIOS1LVL_LVL); + mios1lvl &= ~(CYGARC_REG_IMM_MIOS1LVL_TM); + mios1lvl |= lvl; + mios1lvl |= tm; + HAL_WRITE_UINT16(CYGARC_REG_IMM_MIOS1LVL1, mios1lvl); + break; + } + + default: + CYG_FAIL("Unknown Interrupt!!!"); + break; + } +} + +// The decrementer interrupt cannnot be masked, configured or acknowledged. + +#define HAL_INTERRUPT_MASK( _vector_ ) \ + CYG_MACRO_START \ + if (CYGNUM_HAL_INTERRUPT_DECREMENTER != (_vector_)) \ + cyg_hal_interrupt_mask ( (_vector_) ); \ + CYG_MACRO_END + +#define HAL_INTERRUPT_UNMASK( _vector_ ) \ + CYG_MACRO_START \ + if (CYGNUM_HAL_INTERRUPT_DECREMENTER != (_vector_)) \ + cyg_hal_interrupt_unmask ( (_vector_) ); \ + CYG_MACRO_END + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \ + CYG_MACRO_START \ + if (CYGNUM_HAL_INTERRUPT_DECREMENTER != (_vector_)) \ + cyg_hal_interrupt_acknowledge ( (_vector_) ); \ + CYG_MACRO_END + +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) \ + CYG_MACRO_START \ + if (CYGNUM_HAL_INTERRUPT_DECREMENTER != (_vector_)) \ + cyg_hal_interrupt_configure ( (_vector_), (_level_), (_up_) ); \ + CYG_MACRO_END + +#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) \ + CYG_MACRO_START \ + if (CYGNUM_HAL_INTERRUPT_DECREMENTER != (_vector_)) \ + cyg_hal_interrupt_set_level ( (_vector_) , (_level_) ); \ + CYG_MACRO_END + +#define CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED + +//-------------------------------------------------------------------------- +// Interrupt arbiters +externC cyg_uint32 hal_arbitration_isr_tb (CYG_ADDRWORD vector, + CYG_ADDRWORD data); +externC cyg_uint32 hal_arbitration_isr_pit (CYG_ADDRWORD vector, + CYG_ADDRWORD data); +externC cyg_uint32 hal_arbitration_isr_rtc (CYG_ADDRWORD vector, + CYG_ADDRWORD data); + +//----------------------------------------------------------------------------- +// Symbols used by assembly code +#define CYGARC_VARIANT_DEFS \ + DEFINE(CYGNUM_HAL_VECTOR_NMI, CYGNUM_HAL_VECTOR_NMI); + +//----------------------------------------------------------------------------- +// Interrupt source priorities +// Maybe this is not the best way to do this. Fact remains that these priorities +// are not hard wired by the board layout, but are all software configurable. Not +// so easy to combine flexibility with generality +#define CYGNUM_HAL_INTERRUPT_SIU_TB_A_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TB +#define CYGNUM_HAL_INTERRUPT_SIU_TB_B_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TB +#define CYGNUM_HAL_INTERRUPT_SIU_PIT_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_PIT +#define CYGNUM_HAL_INTERRUPT_SIU_RTC_SEC_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_RTC +#define CYGNUM_HAL_INTERRUPT_SIU_RTC_ALR_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_RTC +#define CYGNUM_HAL_INTERRUPT_SIU_COL_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_PLL +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI1_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_A_QUEUE1 +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI1_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_A_QUEUE1 +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_CI2_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_A_QUEUE2 +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCA_PI2_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_A_QUEUE2 +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI1_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_B_QUEUE1 +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI1_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_B_QUEUE1 +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_CI2_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_B_QUEUE2 +#define CYGNUM_HAL_INTERRUPT_IMB3_QUADCB_PI2_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QUADC_B_QUEUE2 +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TX_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI0_TXC_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI0_IDLE_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TX_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXC_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RX_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_IDLE_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQTHF_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_RXQBHF_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQTHE_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SCI1_TXQBHE_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI +#define CYGNUM_HAL_INTERRUPT_IMB3_SPI_FI_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSPI +#define CYGNUM_HAL_INTERRUPT_IMB3_SPI_MODF_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSPI +#define CYGNUM_HAL_INTERRUPT_IMB3_SPI_HALTA_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSPI +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_BOFF_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_ERR_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_WU_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B0_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B1_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B2_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B3_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B4_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B5_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B6_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B7_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B8_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B9_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B10_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B11_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B12_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B13_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B14_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANA_B15_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_BOFF_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_ERR_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_WU_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B0_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B1_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B2_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B3_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B4_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B5_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B6_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B7_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B8_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B9_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B10_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B11_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B12_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B13_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B14_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TOUCANB_B15_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TOUCAN_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH0_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH1_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH2_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH3_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH4_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH5_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH6_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH7_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH8_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH9_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH10_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH11_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH12_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH13_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH14_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUA_CH15_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_A +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH0_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH1_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH2_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH3_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH4_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH5_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH6_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH7_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH8_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH9_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH10_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH11_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH12_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH13_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH14_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_TPUB_CH15_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_TPU_B +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM0_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM1_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM2_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM3_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM6_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM11_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM12_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM13_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM14_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM15_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_A +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM16_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM17_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM18_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MPWM19_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MMCSM22_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM27_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM28_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM29_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM30_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B +#define CYGNUM_HAL_INTERRUPT_IMB3_MIOS_MDASM31_PRIORITY CYGNUM_HAL_ISR_SOURCE_PRIORITY_MIOS_B + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_VAR_INTR_H +// End of var_intr.h diff --git a/packages/hal/powerpc/mpc5xx/current/include/var_regs.h b/packages/hal/powerpc/mpc5xx/current/include/var_regs.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/include/var_regs.h @@ -0,0 +1,958 @@ +#ifndef CYGONCE_HAL_VAR_REGS_H +#define CYGONCE_HAL_VAR_REGS_H + +//========================================================================== +// +// var_regs.h +// +// PowerPC 5xx variant CPU definitions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2001-09-12 +// Purpose: Provide MPC5xx register definitions +// Description: Provide MPC5xx register definitions +// The short difinitions (sans CYGARC_REG_) are exported only +// if CYGARC_HAL_COMMON_EXPORT_CPU_MACROS is defined. +// Usage: Included via the acrhitecture register header: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +//-------------------------------------------------------------------------- +// Special purpose registers +// +#define CYGARC_REG_XER 1 +#define CYGARC_REG_LR 8 +#define CYGARC_REG_CTR 9 +#define CYGARC_REG_EIE 80 +#define CYGARC_REG_EID 81 +#define CYGARC_REG_NRI 82 +#define CYGARC_REG_CMPA 144 +#define CYGARC_REG_CMPB 145 +#define CYGARC_REG_CMPC 146 +#define CYGARC_REG_CMPD 147 +#define CYGARC_REG_ECR 148 +#define CYGARC_REG_DER 149 +#define CYGARC_REG_COUNTA 150 +#define CYGARC_REG_COUNTB 151 +#define CYGARC_REG_CMPE 152 +#define CYGARC_REG_CMPF 153 +#define CYGARC_REG_CMPG 154 +#define CYGARC_REG_CMPH 155 +#define CYGARC_REG_LCTRL1 156 +#define CYGARC_REG_LCTRL2 157 +#define CYGARC_REG_ICTRL 158 +#define CYGARC_REG_BAR 159 +#define CYGARC_REG_MI_GRA 528 +#define CYGARC_REG_L2U_GRA 536 +#define CYGARC_REG_BBCMCR 560 +#define CYGARC_REG_L2U_MCR 568 +#define CYGARC_REG_DPDR 630 +#define CYGARC_REG_IMMR 638 +#define CYGARC_REG_MI_RBA0 784 +#define CYGARC_REG_MI_RBA1 785 +#define CYGARC_REG_MI_RBA2 786 +#define CYGARC_REG_MI_RBA3 787 +#define CYGARC_REG_L2U_RBA0 792 +#define CYGARC_REG_L2U_RBA1 793 +#define CYGARC_REG_L2U_RBA2 794 +#define CYGARC_REG_L2U_RBA3 795 +#define CYGARC_REG_MI_RA0 816 +#define CYGARC_REG_MI_RA1 817 +#define CYGARC_REG_MI_RA2 818 +#define CYGARC_REG_MI_RA3 819 +#define CYGARC_REG_L2U_RA0 824 +#define CYGARC_REG_L2U_RA1 825 +#define CYGARC_REG_L2U_RA2 826 +#define CYGARC_REG_L2U_RA3 827 +#define CYGARC_REG_FPECR 1022 + +#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +//# define XER CYGARC_REG_XER // Leave these out, they conflict with GDB stubs +//# define LR CYGARC_REG_LR // are not used anyway +# define CTR CYGARC_REG_CTR +# define EIE CYGARC_REG_EIE +# define EID CYGARC_REG_EID +# define NRI CYGARC_REG_NRI +# define CMPA CYGARC_REG_CMPA +# define CMPB CYGARC_REG_CMPB +# define CMPC CYGARC_REG_CMPC +# define CMPD CYGARC_REG_CMPD +# define ECR CYGARC_REG_ECR +# define DER CYGARC_REG_DER +# define COUNTA CYGARC_REG_COUNTA +# define COUNTB CYGARC_REG_COUNTB +# define CMPE CYGARC_REG_CMPE +# define CMPF CYGARC_REG_CMPF +# define CMPG CYGARC_REG_CMPG +# define CMPH CYGARC_REG_CMPH +# define LCTRL1 CYGARC_REG_LCTRL1 +# define LCTRL2 CYGARC_REG_LCTRL2 +# define ICTRL CYGARC_REG_ICTRL +# define BAR CYGARC_REG_BAR +# define MI_GRA CYGARC_REG_MI_GRA +# define L2U_GRA CYGARC_REG_L2U_GRA +# define BBCMCR CYGARC_REG_BBCMCR +# define L2U_MCR CYGARC_REG_L2U_MCR +# define DPDR CYGARC_REG_DPDR +# define IMMR CYGARC_REG_IMMR +# define MI_RBA0 CYGARC_REG_MI_RBA0 +# define MI_RBA1 CYGARC_REG_MI_RBA1 +# define MI_RBA2 CYGARC_REG_MI_RBA2 +# define MI_RBA3 CYGARC_REG_MI_RBA3 +# define L2U_RBA0 CYGARC_REG_L2U_RBA0 +# define L2U_RBA1 CYGARC_REG_L2U_RBA1 +# define L2U_RBA2 CYGARC_REG_L2U_RBA2 +# define L2U_RBA3 CYGARC_REG_L2U_RBA3 +# define MI_RA0 CYGARC_REG_MI_RA0 +# define MI_RA1 CYGARC_REG_MI_RA1 +# define MI_RA2 CYGARC_REG_MI_RA2 +# define MI_RA3 CYGARC_REG_MI_RA3 +# define L2U_RA0 CYGARC_REG_L2U_RA0 +# define L2U_RA1 CYGARC_REG_L2U_RA1 +# define L2U_RA2 CYGARC_REG_L2U_RA2 +# define L2U_RA3 CYGARC_REG_L2U_RA3 +# define FPECR CYGARC_REG_FPECR +#endif //#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS + +//----------------------------------------------------------------------------- +// Development Support. +#define CYGARC_REG_DER 149 + +#define CYGARC_REG_ICTRL 158 // instruction support control reg +#define CYGARC_REG_ICTRL_SERSHOW 0x00000000 // serialized, show cycles +#define CYGARC_REG_ICTRL_NOSERSHOW 0x00000007 //non-serialized&no show cycles + +#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#define DER CYGARC_REG_DER + +#define ICTRL CYGARC_REG_ICTRL +#define ICTRL_SERSHOW CYGARC_REG_ICTRL_SERSHOW +#define ICTRL_NOSERSHOW CYGARC_REG_ICTRL_NOSERSHOW +#endif // ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS + +//----------------------------------------------------------------------------- +// Bit definitions +//----------------------------------------------------------------------------- +// The internal memory map register (IMMR) +#define CYGARC_REG_IMM_IMMR_PARTNUM 0xff000000 // part number mask (ro) +#define CYGARC_REG_IMM_IMMR_MASKNUM 0x00ff0000 // mask number mask (ro) +#define CYGARC_REG_IMM_IMMR_ISB 0x0000000e // internal space base +#define CYGARC_REG_IMM_IMMR_CLES 0x00000100 // core little endian swap +#define CYGARC_REG_IMM_IMMR_FLEN 0x00000800 // flash enable + +//----------------------------------------------------------------------------- +// System protection control (SYPCR) +#define CYGARC_REG_IMM_SYPR_SWTC_MASK 0xffff0000 +#define CYGARC_REG_IMM_SYPR_BMT_MASK 0x0000ff00 +#define CYGARC_REG_IMM_SYPR_BME 0x00000080 +#define CYGARC_REG_IMM_SYPR_SWF 0x00000008 +#define CYGARC_REG_IMM_SYPR_SWE 0x00000004 +#define CYGARC_REG_IMM_SYPR_SWRI 0x00000002 +#define CYGARC_REG_IMM_SYPR_SWP 0x00000001 + +//----------------------------------------------------------------------------- +// Interrupt pend register (SIPEND) +#define CYGARC_REG_IMM_SIPEND_IRQ0 0x80000000 // External interrupt priority 0 +#define CYGARC_REG_IMM_SIPEND_LVL0 0x40000000 // Internal interrupt level 0 +#define CYGARC_REG_IMM_SIPEND_IRQ1 0x20000000 // External interrupt priority 1 +#define CYGARC_REG_IMM_SIPEND_LVL1 0x10000000 // Internal interrupt level 1 +#define CYGARC_REG_IMM_SIPEND_IRQ2 0x08000000 // External interrupt priority 2 +#define CYGARC_REG_IMM_SIPEND_LVL2 0x04000000 // Internal interrupt level 2 +#define CYGARC_REG_IMM_SIPEND_IRQ3 0x02000000 // External interrupt priority 3 +#define CYGARC_REG_IMM_SIPEND_LVL3 0x01000000 // Internal interrupt level 3 +#define CYGARC_REG_IMM_SIPEND_IRQ4 0x00800000 // External interrupt prioeity 4 +#define CYGARC_REG_IMM_SIPEND_LVL4 0x00400000 // Internal interrupt level 4 +#define CYGARC_REG_IMM_SIPEND_IRQ5 0x00200000 // External interrupt priority 5 +#define CYGARC_REG_IMM_SIPEND_LVL5 0x00100000 // Internal interrupt level 5 +#define CYGARC_REG_IMM_SIPEND_IRQ6 0x00080000 // External interrupt priority 6 +#define CYGARC_REG_IMM_SIPEND_LVL6 0x00040000 // Internal interrupt level 6 +#define CYGARC_REG_IMM_SIPEND_IRQ7 0x00020000 // External interrupt priority 7 +#define CYGARC_REG_IMM_SIPEND_LVL7 0x00010000 // Internal interrupt level 7 + +//----------------------------------------------------------------------------- +// Interrupt mask register (SIMASK) +#define CYGARC_REG_IMM_SIMASK_IRM0 0x80000000 // External interrupt priority 0 +#define CYGARC_REG_IMM_SIMASK_LVM0 0x40000000 // Internal interrupt level 0 +#define CYGARC_REG_IMM_SIMASK_IRM1 0x20000000 // External interrupt priority 1 +#define CYGARC_REG_IMM_SIMASK_LVM1 0x10000000 // Internal interrupt level 1 +#define CYGARC_REG_IMM_SIMASK_IRM2 0x08000000 // External interrupt priority 2 +#define CYGARC_REG_IMM_SIMASK_LVM2 0x04000000 // Internal interrupt level 2 +#define CYGARC_REG_IMM_SIMASK_IRM3 0x02000000 // External interrupt priority 3 +#define CYGARC_REG_IMM_SIMASK_LVM3 0x01000000 // Internal interrupt level 3 +#define CYGARC_REG_IMM_SIMASK_IRM4 0x00800000 // External interrupt priority 4 +#define CYGARC_REG_IMM_SIMASK_LVM4 0x00400000 // Internal interrupt level 4 +#define CYGARC_REG_IMM_SIMASK_IRM5 0x00200000 // External interrupt priority 5 +#define CYGARC_REG_IMM_SIMASK_LVM5 0x00100000 // Internal interrupt level 5 +#define CYGARC_REG_IMM_SIMASK_IRM6 0x00080000 // External interrupt priority 6 +#define CYGARC_REG_IMM_SIMASK_LVM6 0x00040000 // Internal interrupt level 6 +#define CYGARC_REG_IMM_SIMASK_IRM7 0x00020000 // External interrupt priority 7 +#define CYGARC_REG_IMM_SIMASK_LVM7 0x00010000 // Internal interrupt level 7 + +//----------------------------------------------------------------------------- +// Interrupt edge level register (CIEL) +#define CYGARC_REG_IMM_SIEL_ED0 0x80000000 // Falling edge external interrupt priority 0 +#define CYGARC_REG_IMM_SIEL_WM0 0x40000000 // Wake-up mask external interrupt priority 0 +#define CYGARC_REG_IMM_SIEL_ED1 0x20000000 // Falling edge external interrupt priority 1 +#define CYGARC_REG_IMM_SIEL_WM1 0x10000000 // Wake-up mask external interrupt priority 1 +#define CYGARC_REG_IMM_SIEL_ED2 0x08000000 // Falling edge external interrupt priority 2 +#define CYGARC_REG_IMM_SIEL_WM2 0x04000000 // Wake-up mask external interrupt priority 2 +#define CYGARC_REG_IMM_SIEL_ED3 0x02000000 // Falling edge external interrupt priority 3 +#define CYGARC_REG_IMM_SIEL_WM3 0x01000000 // Wake-up mask external interrupt priority 3 +#define CYGARC_REG_IMM_SIEL_ED4 0x00800000 // Falling edge external interrupt prioriry 4 +#define CYGARC_REG_IMM_SIEL_WM4 0x00400000 // Wake-up mask external interrupt priority 4 +#define CYGARC_REG_IMM_SIEL_ED5 0x00200000 // Falling edge external interrupt priority 5 +#define CYGARC_REG_IMM_SIEL_WM5 0x00100000 // Wake-up mask external interrupt priority 5 +#define CYGARC_REG_IMM_SIEL_ED6 0x00080000 // Falling edge external interrupt priority 6 +#define CYGARC_REG_IMM_SIEL_WM6 0x00040000 // Wake-up mask external interrupt priority 6 +#define CYGARC_REG_IMM_SIEL_ED7 0x00020000 // Falling edge external interrupt priority 7 +#define CYGARC_REG_IMM_SIEL_WM7 0x00010000 // Wake-up mask external interrupt priority 7 + +//----------------------------------------------------------------------------- +// Memory controller +#define CYGARC_REG_IMM_BR_BA_MASK 0xffff8000 // base address +#define CYGARC_REG_IMM_BR_AT_MASK 0x00007000 // address type +#define CYGARC_REG_IMM_BR_PS_8 0x00000400 // port size 8 bits +#define CYGARC_REG_IMM_BR_PS_16 0x00000800 // port size 16 bits +#define CYGARC_REG_IMM_BR_PS_32 0x00000000 // port size 32 bits +#define CYGARC_REG_IMM_BR_WP 0x00000100 // write protect +#define CYGARC_REG_IMM_BR_WEBS 0x00000020 // write enable byte select +#define CYGARC_REG_IMM_BR_TBDIP 0x00000010 // toggle burst data in progress +#define CYGARC_REG_IMM_BR_LBDIP 0x00000008 // late burst data in progress +#define CYGARC_REG_IMM_BR_SETA 0x00000004 // externam transfer acknowledge +#define CYGARC_REG_IMM_BR_BI 0x00000002 // burst inhibit +#define CYGARC_REG_IMM_BR_V 0x00000001 // valid bit + +#define CYGARC_REG_IMM_OR_AM 0xffff8000 // address mask +#define CYGARC_REG_IMM_OR_ATM 0x00007000 // address type mask +#define CYGARC_REG_IMM_OR_CSNT 0x00000800 // GPCM : chip select negatoion time +#define CYGARC_REG_IMM_OR_ACS_0 0x00000000 // GPCM : CS output immediately +#define CYGARC_REG_IMM_OR_ACS_4 0x00000400 // GPCM : CS output 1/4 clock cycle later +#define CYGARC_REG_IMM_OR_ACS_2 0x00000600 // GPCM : CS output 1/2 clock cycle later +#define CYGARC_REG_IMM_OR_SCY_MASK 0x000000f0 // cycle length in clocks +#define CYGARC_REG_IMM_OR_BSCY 0x0000000E // burst cycle length in clocks +#define CYGARC_REG_IMM_OR_TRLX 0x00000001 // timing relaxed +#define CYGARC_REG_IMM_OR_EHTR 0x00000100 // extended hold time on read +#define CYGARC_REG_IMM_OR_SCY_SHIFT 4 + +//----------------------------------------------------------------------------- +// Time base status and control (TBSCR) +#define CYGARC_REG_IMM_TBSCR_REFA 0x0080 // reference interrupt status A +#define CYGARC_REG_IMM_TBSCR_REFB 0x0040 // reference interrupt status B +#define CYGARC_REG_IMM_TBSCR_REFAE 0x0008 // reference interrupt enable A +#define CYGARC_REG_IMM_TBSCR_REFBE 0x0004 // reference interrupt enable B +#define CYGARC_REG_IMM_TBSCR_TBF 0x0002 // timebase freeze +#define CYGARC_REG_IMM_TBSCR_TBE 0x0001 // timebase enable +#define CYGARC_REG_IMM_TBSCR_IRQ0 0x8000 // highest interrupt level +#define CYGARC_REG_IMM_TBSCR_IRQMASK 0xff00 // irq priority mask + +//----------------------------------------------------------------------------- +// Real time clock +#define CYGARC_REG_IMM_RTCSC_SEC 0x0080 // once per second interrupt +#define CYGARC_REG_IMM_RTCSC_ALR 0x0040 // alarm interrupt +#define CYGARC_REG_IMM_RTCSC_4M 0x0010 // source select +#define CYGARC_REG_IMM_RTCSC_SIE 0x0008 // second interrupt enable +#define CYGARC_REG_IMM_RTCSC_ALE 0x0004 // alarm interrupt enable +#define CYGARC_REG_IMM_RTCSC_RTF 0x0002 // real time clock freeze +#define CYGARC_REG_IMM_RTCSC_RTE 0x0001 // real time clock enable +#define CYGARC_REG_IMM_RTCSC_IRQ0 0x8000 // highest interrupt priority +#define CYGARC_REG_IMM_RTCSC_IRQMASK 0xff00 // irq priority mask + +//----------------------------------------------------------------------------- +// Periodic interrupt status an control +#define CYGARC_REG_IMM_PISCR_PS 0x0080 // periodic interrupt status +#define CYGARC_REG_IMM_PISCR_PIE 0x0004 // periodic interrupt enable +#define CYGARC_REG_IMM_PISCR_PITF 0x0002 // periodic interrupt timer freeze +#define CYGARC_REG_IMM_PISCR_PTE 0x0001 // periodic timer enable +#define CYGARC_REG_IMM_PISCR_IRQ0 0x8000 // highest intetrupt priority +#define CYGARC_REG_IMM_PISCR_IRQMASK 0xff00 // irq priority mask + +//----------------------------------------------------------------------------- +// Queued analog to digital convertor +#define CYGARC_REG_IMM_QUACR1_CIE1 0x8000 +#define CYGARC_REG_IMM_QUACR1_PIE1 0x4000 +#define CYGARC_REG_IMM_QUACR1_SSE1 0x2000 +#define CYGARC_REG_IMM_QUACR1_MO1 0x1f00 +#define CYGARC_REG_IMM_QUACR2_CIE2 0x8000 +#define CYGARC_REG_IMM_QUACR2_PIE2 0x4000 +#define CYGARC_REG_IMM_QUACR2_SSE2 0x2000 +#define CYGARC_REG_IMM_QUACR2_MO2 0x1f00 +#define CYGARC_REG_IMM_QUACR2_RESUME 0x0080 +#define CYGARC_REG_IMM_QUACR2_BQ2 0x007f +#define CYGARC_REG_IMM_QUASR0_CF1 0x8000 +#define CYGARC_REG_IMM_QUASR0_PF1 0x4000 +#define CYGARC_REG_IMM_QUASR0_CF2 0x2000 +#define CYGARC_REG_IMM_QUASR0_PF2 0x1000 +#define CYGARC_REG_IMM_QUASR0_TOR1 0x0800 +#define CYGARC_REG_IMM_QUASR0_TOR2 0x0400 +#define CYGARC_REG_IMM_QUASR0_QS 0x03c0 +#define CYGARC_REG_IMM_QUASR0_CWP 0x003f +#define CYGARC_REG_IMM_QUADC64INT_IRL1 0xf800 +#define CYGARC_REG_IMM_QUADC64INT_IRL2 0x07c0 +#define CYGARC_REG_IMM_QUADC64INT_IRL1_SHIFT 11 +#define CYGARC_REG_IMM_QUADC64INT_IRL2_SHIFT 6 + +//----------------------------------------------------------------------------- +// PLL Change of lock +#define CYGARC_REG_IMM_COLIR_IRQ0 0x8000 // the highest interrupt priority +#define CYGARC_REG_IMM_COLIR_COLIRQ 0xff00 // interrupt priority mask +#define CYGARC_REG_IMM_COLIR_COLIS 0x0080 // change of lock detected +#define CYGARC_REG_IMM_COLIR_COLIE 0x0040 // change of lock interrupt enable + +//----------------------------------------------------------------------------- +// SCI SPI registers +#define CYGARC_REG_IMM_SCCxR1_LOOPS 0x4000 +#define CYGARC_REG_IMM_SCCxR1_WOMS 0x2000 +#define CYGARC_REG_IMM_SCCxR1_ILT 0x1000 +#define CYGARC_REG_IMM_SCCxR1_PT 0x0800 +#define CYGARC_REG_IMM_SCCxR1_PE 0x0400 +#define CYGARC_REG_IMM_SCCxR1_M 0x0200 +#define CYGARC_REG_IMM_SCCxR1_WAKE 0x0100 +#define CYGARC_REG_IMM_SCCxR1_TIE 0x0080 +#define CYGARC_REG_IMM_SCCxR1_TCIE 0x0040 +#define CYGARC_REG_IMM_SCCxR1_RIE 0x0020 +#define CYGARC_REG_IMM_SCCxR1_ILIE 0x0010 +#define CYGARC_REG_IMM_SCCxR1_TE 0x0008 +#define CYGARC_REG_IMM_SCCxR1_RE 0x0004 +#define CYGARC_REG_IMM_SCCxR1_RWU 0x0002 +#define CYGARC_REG_IMM_SCCxR1_SBK 0x0001 +#define CYGARC_REG_IMM_QSCI1CR_QTPNT 0xf000 +#define CYGARC_REG_IMM_QSCI1CR_QTHFI 0x0800 +#define CYGARC_REG_IMM_QSCI1CR_QBHFI 0x0400 +#define CYGARC_REG_IMM_QSCI1CR_QTHEI 0x0200 +#define CYGARC_REG_IMM_QSCI1CR_QBHEI 0x0100 +#define CYGARC_REG_IMM_QSCI1CR_QTE 0x0040 +#define CYGARC_REG_IMM_QSCI1CR_QRE 0x0020 +#define CYGARC_REG_IMM_QSCI1CR_QTWE 0x0010 +#define CYGARC_REG_IMM_QSCI1CR_QTSZ 0x000f +#define CYGARC_REG_IMM_SPCR1_SPE 0x8000 +#define CYGARC_REG_IMM_SPCR1_DSCLK 0x7f00 +#define CYGARC_REG_IMM_SPCR1_DTL 0x00ff +#define CYGARC_REG_IMM_SPCR2_SPIFIE 0x8000 +#define CYGARC_REG_IMM_SPCR2_WREN 0x4000 +#define CYGARC_REG_IMM_SPCR2_WRT0 0x2000 +#define CYGARC_REG_IMM_SPCR2_ENDQP 0x1f00 +#define CYGARC_REG_IMM_SPCR2_NEWQP 0x001f +#define CYGARC_REG_IMM_SPCR3_LOOPQ 0x0400 +#define CYGARC_REG_IMM_SPCR3_HMIE 0x0200 +#define CYGARC_REG_IMM_SPCR3_HALT 0x0100 +#define CYGARC_REG_IMM_SPCR3_SPSR 0x00ff +#define CYGARC_REG_IMM_SCxSR_TDRE 0x0100 +#define CYGARC_REG_IMM_SCxSR_TC 0x0080 +#define CYGARC_REG_IMM_SCxSR_RDRF 0x0040 +#define CYGARC_REG_IMM_SCxSR_RAF 0x0020 +#define CYGARC_REG_IMM_SCxSR_IDLE 0x0010 +#define CYGARC_REG_IMM_SCxSR_OR 0x0008 +#define CYGARC_REG_IMM_SCxSR_NF 0x0004 +#define CYGARC_REG_IMM_SCxSR_FE 0x0002 +#define CYGARC_REG_IMM_SCxSR_PF 0x0001 +#define CYGARC_REG_IMM_QSCI1SR_QOR 0x1000 +#define CYGARC_REG_IMM_QSCI1SR_QTHF 0x0800 +#define CYGARC_REG_IMM_QSCI1SR_QBHF 0x0400 +#define CYGARC_REG_IMM_QSCI1SR_QTHE 0x0200 +#define CYGARC_REG_IMM_QSCI1SR_QBHE 0x0100 +#define CYGARC_REG_IMM_QSCI1SR_QRPNT 0x00f0 +#define CYGARC_REG_IMM_QSCI1SR_QRPEND 0x000f +#define CYGARC_REG_IMM_SPSR_SPCR3 0xff00 +#define CYGARC_REG_IMM_SPSR_SPIF 0x0080 +#define CYGARC_REG_IMM_SPSR_MODF 0x0040 +#define CYGARC_REG_IMM_SPSR_HALTA 0x0020 +#define CYGARC_REG_IMM_SPSR_CPTQ 0x001f +#define CYGARC_REG_IMM_QDSCI_IL_ILDSCI 0x1f00 +#define CYGARC_REG_IMM_QDSCI_IL_ILDSCI_SHIFT 8 +#define CYGARC_REG_IMM_QSPI_IL_ILQSPI 0x001f +#define CYGARC_REG_IMM_QSPI_IL_ILQSPI_SHIFT 0 + +//----------------------------------------------------------------------------- +// TPU register settings +#define CYGARC_REG_IMM_TICR_CIRL 0x0700 +#define CYGARC_REG_IMM_TICR_CIRL_SHIFT 8 +#define CYGARC_REG_IMM_TICR_ILBS 0x00c0 +#define CYGARC_REG_IMM_TICR_ILBS_SHIFT 6 + +//----------------------------------------------------------------------------- +// TOUCAN registers +#define CYGARC_REG_IMM_CANCTRL0_BOFFMSK 0x8000 +#define CYGARC_REG_IMM_CANCTRL0_ERRMSK 0x4000 +#define CYGARC_REG_IMM_CANCTRL0_RXMOD 0x0c00 +#define CYGARC_REG_IMM_CANCTRL0_TXMOD 0x0300 +#define CYGARC_REG_IMM_CANCTRL0_CANCTLL1 0x00ff +#define CYGARC_REG_IMM_TCNMCR_STOP 0x8000 +#define CYGARC_REG_IMM_TCNMCR_FRZ 0x4000 +#define CYGARC_REG_IMM_TCNMCR_HALT 0x1000 +#define CYGARC_REG_IMM_TCNMCR_NOTRDY 0x0800 +#define CYGARC_REG_IMM_TCNMCR_WAKEMSK 0x0400 +#define CYGARC_REG_IMM_TCNMCR_SOFTRST 0x0200 +#define CYGARC_REG_IMM_TCNMCR_FRZACK 0x0100 +#define CYGARC_REG_IMM_TCNMCR_SUPV 0x0080 +#define CYGARC_REG_IMM_TCNMCR_SELFWAKE 0x0040 +#define CYGARC_REG_IMM_TCNMCR_APS 0x0020 +#define CYGARC_REG_IMM_TCNMCR_STOPACK 0x0010 +#define CYGARC_REG_IMM_ESTAT_BOFFINT 0x0004 +#define CYGARC_REG_IMM_ESTAT_ERRINT 0x0002 +#define CYGARC_REG_IMM_ESTAT_WAKEINT 0x0001 +#define CYGARC_REG_IMM_CANICR_IRL 0x0700 +#define CYGARC_REG_IMM_CANICR_IRL_SHIFT 8 +#define CYGARC_REG_IMM_CANICR_ILBS 0x00c0 +#define CYGARC_REG_IMM_CANICR_ILBS_SHIFT 6 + +//----------------------------------------------------------------------------- +// MIOS registers +#define CYGARC_REG_IMM_MIOS1ER0_EN15 0x8000 +#define CYGARC_REG_IMM_MIOS1ER0_EN14 0x4000 +#define CYGARC_REG_IMM_MIOS1ER0_EN13 0x2000 +#define CYGARC_REG_IMM_MIOS1ER0_EN12 0x1000 +#define CYGARC_REG_IMM_MIOS1ER0_EN11 0x0800 +#define CYGARC_REG_IMM_MIOS1ER0_EN6 0x0040 +#define CYGARC_REG_IMM_MIOS1ER0_EN3 0x0008 +#define CYGARC_REG_IMM_MIOS1ER0_EN2 0x0004 +#define CYGARC_REG_IMM_MIOS1ER0_EN1 0x0002 +#define CYGARC_REG_IMM_MIOS1ER0_EN0 0x0001 +#define CYGARC_REG_IMM_MIOS1ER1_EN31 0x8000 +#define CYGARC_REG_IMM_MIOS1ER1_EN30 0x4000 +#define CYGARC_REG_IMM_MIOS1ER1_EN29 0x2000 +#define CYGARC_REG_IMM_MIOS1ER1_EN28 0x1000 +#define CYGARC_REG_IMM_MIOS1ER1_EN27 0x0800 +#define CYGARC_REG_IMM_MIOS1ER1_EN22 0x0040 +#define CYGARC_REG_IMM_MIOS1ER1_EN19 0x0008 +#define CYGARC_REG_IMM_MIOS1ER1_EN18 0x0004 +#define CYGARC_REG_IMM_MIOS1ER1_EN17 0x0002 +#define CYGARC_REG_IMM_MIOS1ER1_EN16 0x0001 +#define CYGARC_REG_IMM_MIOS1SR0_FL15 0x8000 +#define CYGARC_REG_IMM_MIOS1SR0_FL14 0x4000 +#define CYGARC_REG_IMM_MIOS1SR0_FL13 0x2000 +#define CYGARC_REG_IMM_MIOS1SR0_FL12 0x1000 +#define CYGARC_REG_IMM_MIOS1SR0_FL11 0x0800 +#define CYGARC_REG_IMM_MIOS1SR0_FL6 0x0040 +#define CYGARC_REG_IMM_MIOS1SR0_FL3 0x0008 +#define CYGARC_REG_IMM_MIOS1SR0_FL2 0x0004 +#define CYGARC_REG_IMM_MIOS1SR0_FL1 0x0002 +#define CYGARC_REG_IMM_MIOS1SR0_FL0 0x0001 +#define CYGARC_REG_IMM_MIOS1SR1_FL31 0x8000 +#define CYGARC_REG_IMM_MIOS1SR1_FL30 0x4000 +#define CYGARC_REG_IMM_MIOS1SR1_FL29 0x2000 +#define CYGARC_REG_IMM_MIOS1SR1_FL28 0x1000 +#define CYGARC_REG_IMM_MIOS1SR1_FL27 0x0800 +#define CYGARC_REG_IMM_MIOS1SR1_FL22 0x0040 +#define CYGARC_REG_IMM_MIOS1SR1_FL19 0x0008 +#define CYGARC_REG_IMM_MIOS1SR1_FL18 0x0004 +#define CYGARC_REG_IMM_MIOS1SR1_FL17 0x0002 +#define CYGARC_REG_IMM_MIOS1SR1_FL16 0x0001 +#define CYGARC_REG_IMM_MIOS1LVL_LVL 0x0700 +#define CYGARC_REG_IMM_MIOS1LVL_LVL_SHIFT 8 +#define CYGARC_REG_IMM_MIOS1LVL_TM 0x00c0 +#define CYGARC_REG_IMM_MIOS1LVL_TM_SHIFT 6 + +//----------------------------------------------------------------------------- +// Periodic interrupt timer count +#define CYGARC_REG_IMM_PITC_COUNT_SHIFT 16 // count is stored in bits 0-15 + +//----------------------------------------------------------------------------- +// System clock control +#define CYGARC_REG_IMM_SCCR_TBS 0x02000000 // Time base source +#define CYGARC_REG_IMM_SCCR_RTDIV 0x01000000 // rtc clock divide +#define CYGARC_REG_IMM_SCCR_RTSEL 0x00100000 // rtc clock select + +//------------------------------------- +// TouCAN (CAN 2.0B Controller) +#define CYGARC_REG_IMM_CANICR_IRL 0x0700 +#define CYGARC_REG_IMM_CANICR_IRL_SHIFT 8 +#define CYGARC_REG_IMM_CANICR_ILBS 0x00c0 +#define CYGARC_REG_IMM_CANICR_ILBS_SHIFT 6 + +#define CYGARC_REG_IMM_TCNMCR_STOP 0x8000 +#define CYGARC_REG_IMM_TCNMCR_FRZ 0x4000 +#define CYGARC_REG_IMM_TCNMCR_HALT 0x1000 +#define CYGARC_REG_IMM_TCNMCR_NOTRDY 0x0800 +#define CYGARC_REG_IMM_TCNMCR_WAKEMSK 0x0400 +#define CYGARC_REG_IMM_TCNMCR_SOFTRST 0x0200 +#define CYGARC_REG_IMM_TCNMCR_FRZACK 0x0100 +#define CYGARC_REG_IMM_TCNMCR_SUPV 0x0080 +#define CYGRAC_REG_IMM_TCNMCR_SELFWAKE 0x0040 +#define CYGARC_REG_IMM_TCNMCR_APS 0x0020 +#define CYGARC_REG_IMM_TCNMCR_STOPACK 0x0010 + +#define CYGARC_REG_IMM_CANCTRL0_CANCTRL1_BOFFMSK 0x8000 +#define CYGARC_REG_IMM_CANCTRL0_CANCTRL1_ERRMSK 0x4000 +#define CYGARC_REG_IMM_CANCTRL0_CANCTRL1_RXMOD 0x0c00 +#define CYGARC_REG_IMM_CANCTRL0_CANCTRL1_TXMOD 0x0300 +#define CYGARC_REG_IMM_CANCTRL0_CANCTRL1_RXMOD_SHIFT 10 +#define CYGARC_REG_IMM_CANCTRL0_CANCTRL1_TXMOD_SHIFT 8 + +#define CYGARC_REG_IMM_ESTAT_BITERR 0xc000 +#define CYGARC_REG_IMM_ESTAT_ACKERR 0x2000 +#define CYGARC_REG_IMM_ESTAT_CRCERR 0x1000 +#define CYGARC_REG_IMM_ESTAT_FORMERR 0x0800 +#define CYGARC_REG_IMM_ESTAT_STUFFERR 0x0400 +#define CYGARC_REG_IMM_ESTAT_TXWARN 0x0200 +#define CYGARC_REG_IMM_ESTAT_RXWARN 0x0100 +#define CYGARC_REG_IMM_ESTAT_IDLE 0x0080 +#define CYGARC_REG_IMM_ESTAT_TX_RX 0x0040 +#define CYGARC_REG_IMM_ESTAT_FCS 0x0030 +#define CYGARC_REG_IMM_ESTAT_BOFFINT 0x0004 +#define CYGARC_REG_IMM_ESTAT_ERRINT 0x0002 +#define CYGARC_REG_IMM_ESTAT_WAKEINT 0x0001 +#define CYGARC_REG_IMM_ESTAT_BITERR_SHIFT 14 +#define CYGARC_REG_IMM_ESTAT_FCS_SHIFT 4 + +//----------------------------------------------------------------------------- +// All registers in the internal memory map +#define CYGARC_REG_IMM_BASE 0x002fc000 + + // General register definitions +#define CYGARC_REG_IMM_SIUMCR (CYGARC_REG_IMM_BASE+0x0000) +#define CYGARC_REG_IMM_SYPCR (CYGARC_REG_IMM_BASE+0x0004) +#define CYGARC_REG_IMM_SWSR (CYGARC_REG_IMM_BASE+0x000e) +#define CYGARC_REG_IMM_SIPEND (CYGARC_REG_IMM_BASE+0x0010) +#define CYGARC_REG_IMM_SIMASK (CYGARC_REG_IMM_BASE+0x0014) +#define CYGARC_REG_IMM_SIEL (CYGARC_REG_IMM_BASE+0x0018) +#define CYGARC_REG_IMM_SIVEC (CYGARC_REG_IMM_BASE+0x001c) +#define CYGARC_REG_IMM_TESR (CYGARC_REG_IMM_BASE+0x0020) +#define CYGARC_REG_IMM_SGPIODT1 (CYGARC_REG_IMM_BASE+0x0024) +#define CYGARC_REG_IMM_SGPIODT2 (CYGARC_REG_IMM_BASE+0x0028) +#define CYGARC_REG_IMM_SGPIOCR (CYGARC_REG_IMM_BASE+0x002c) +#define CYGARC_REG_IMM_EMCR (CYGARC_REG_IMM_BASE+0x0030) +#define CYGARC_REG_IMM_PDMCR (CYGARC_REG_IMM_BASE+0x003c) + + // Memory controller registers +#define CYGARC_REG_IMM_BR0 (CYGARC_REG_IMM_BASE+0x0100) +#define CYGARC_REG_IMM_OR0 (CYGARC_REG_IMM_BASE+0x0104) +#define CYGARC_REG_IMM_BR1 (CYGARC_REG_IMM_BASE+0x0108) +#define CYGARC_REG_IMM_OR1 (CYGARC_REG_IMM_BASE+0x010c) +#define CYGARC_REG_IMM_BR2 (CYGARC_REG_IMM_BASE+0x0110) +#define CYGARC_REG_IMM_OR2 (CYGARC_REG_IMM_BASE+0x0114) +#define CYGARC_REG_IMM_BR3 (CYGARC_REG_IMM_BASE+0x0118) +#define CYGARC_REG_IMM_OR3 (CYGARC_REG_IMM_BASE+0x011c) +#define CYGARC_REG_IMM_DMBR (CYGARC_REG_IMM_BASE+0x0140) +#define CYGARC_REG_IMM_DMOR (CYGARC_REG_IMM_BASE+0x0144) +#define CYGARC_REG_IMM_MSTAT (CYGARC_REG_IMM_BASE+0x0178) + + // System integration timers +#define CYGARC_REG_IMM_TBSCR (CYGARC_REG_IMM_BASE+0x0200) +#define CYGARC_REG_IMM_TBREF0 (CYGARC_REG_IMM_BASE+0x0204) +#define CYGARC_REG_IMM_TBREF1 (CYGARC_REG_IMM_BASE+0x0208) +#define CYGARC_REG_IMM_RTCSC (CYGARC_REG_IMM_BASE+0x0220) +#define CYGARC_REG_IMM_RTC (CYGARC_REG_IMM_BASE+0x0224) +#define CYGARC_REG_IMM_RTSEC (CYGARC_REG_IMM_BASE+0x0228) +#define CYGARC_REG_IMM_RTCAL (CYGARC_REG_IMM_BASE+0x022c) +#define CYGARC_REG_IMM_PISCR (CYGARC_REG_IMM_BASE+0x0240) +#define CYGARC_REG_IMM_PITC (CYGARC_REG_IMM_BASE+0x0244) +#define CYGARC_REG_IMM_PITR (CYGARC_REG_IMM_BASE+0x0248) + + // Clocks and resets +#define CYGARC_REG_IMM_SCCR (CYGARC_REG_IMM_BASE+0x0280) +#define CYGARC_REG_IMM_PLPRCR (CYGARC_REG_IMM_BASE+0x0284) +#define CYGARC_REG_IMM_RSR (CYGARC_REG_IMM_BASE+0x0288) +#define CYGARC_REG_IMM_COLIR (CYGARC_REG_IMM_BASE+0x028c) +#define CYGARC_REG_IMM_VSRMCR (CYGARC_REG_IMM_BASE+0x0290) + + // System IntegrationTimer Keys +#define CYGARC_REG_IMM_TBSCRK (CYGARC_REG_IMM_BASE+0x0300) +#define CYGARC_REG_IMM_TBREF0K (CYGARC_REG_IMM_BASE+0x0304) +#define CYGARC_REG_IMM_TBREF1K (CYGARC_REG_IMM_BASE+0x0308) +#define CYGARC_REG_IMM_TBK (CYGARC_REG_IMM_BASE+0x030c) +#define CYGARC_REG_IMM_RTCSCK (CYGARC_REG_IMM_BASE+0x0320) +#define CYGARC_REG_IMM_RTCK (CYGARC_REG_IMM_BASE+0x0324) +#define CYGARC_REG_IMM_RTSECK (CYGARC_REG_IMM_BASE+0x0328) +#define CYGARC_REG_IMM_RTCALK (CYGARC_REG_IMM_BASE+0x032c) +#define CYGARC_REG_IMM_PISCRK (CYGARC_REG_IMM_BASE+0x0340) +#define CYGARC_REG_IMM_PITCK (CYGARC_REG_IMM_BASE+0x0344) + + // Clocks and reset keys +#define CYGARC_REG_IMM_SCCRK (CYGARC_REG_IMM_BASE+0x0380) +#define CYGARC_REG_IMM_PLPRCRK (CYGARC_REG_IMM_BASE+0x0384) +#define CYGARC_REG_IMM_RSRK (CYGARC_REG_IMM_BASE+0x0388) + + //------------------------------------- + // CMF (CDR Mone T FLASH EEPROM) + //------------------------------------- + // CMF_A +#define CYGARC_REG_IMM_CMFMCR_A (CYGARC_REG_IMM_BASE+0x0800) +#define CYGARC_REG_IMM_CMFTST_A (CYGARC_REG_IMM_BASE+0x0804) +#define CYGARC_REG_IMM_CMFCTL_A (CYGARC_REG_IMM_BASE+0x0808) + + // CMF_B +#define CYGARC_REG_IMM_CMFMCR_B (CYGARC_REG_IMM_BASE+0x0840) +#define CYGARC_REG_IMM_CMFTST_B (CYGARC_REG_IMM_BASE+0x0844) +#define CYGARC_REG_IMM_CMFCTL_B (CYGARC_REG_IMM_BASE+0x0848) + + //------------------------------------- + // DPTRAM (Dual-Port TPU RAM) + //------------------------------------- +#define CYGARC_REG_IMM_DPTMCR (CYGARC_REG_IMM_BASE+0x4000) +#define CYGARC_REG_IMM_RAMTST (CYGARC_REG_IMM_BASE+0x4002) +#define CYGARC_REG_IMM_RAMBAR (CYGARC_REG_IMM_BASE+0x4004) +#define CYGARC_REG_IMM_MISRH (CYGARC_REG_IMM_BASE+0x4006) +#define CYGARC_REG_IMM_MISRL (CYGARC_REG_IMM_BASE+0x4008) +#define CYGARC_REG_IMM_MISCNT (CYGARC_REG_IMM_BASE+0x400a) + + //------------------------------------- + // TPU3 (Time processing unit) + //------------------------------------- + // TPU-A +#define CYGARC_REG_IMM_TPUMCR_A (CYGARC_REG_IMM_BASE+0x8000) +#define CYGARC_REG_IMM_TCR_A (CYGARC_REG_IMM_BASE+0x8002) +#define CYGARC_REG_IMM_DSCR_A (CYGARC_REG_IMM_BASE+0x8004) +#define CYGARC_REG_IMM_DSSR_A (CYGARC_REG_IMM_BASE+0x8006) +#define CYGARC_REG_IMM_TICR_A (CYGARC_REG_IMM_BASE+0x8008) +#define CYGARC_REG_IMM_CIER_A (CYGARC_REG_IMM_BASE+0x800a) +#define CYGARC_REG_IMM_CFSR0_A (CYGARC_REG_IMM_BASE+0x800c) +#define CYGARC_REG_IMM_CFSR1_A (CYGARC_REG_IMM_BASE+0x800e) +#define CYGARC_REG_IMM_CFSR2_A (CYGARC_REG_IMM_BASE+0x8010) +#define CYGARC_REG_IMM_CFSR3_A (CYGARC_REG_IMM_BASE+0x8012) +#define CYGARC_REG_IMM_HSQR0_A (CYGARC_REG_IMM_BASE+0x8014) +#define CYGARC_REG_IMM_HSQR1_A (CYGARC_REG_IMM_BASE+0x8016) +#define CYGARC_REG_IMM_HSRR0_A (CYGARC_REG_IMM_BASE+0x8018) +#define CYGARC_REG_IMM_HSRR1_A (CYGARC_REG_IMM_BASE+0x801a) +#define CYGARC_REG_IMM_CPR0_A (CYGARC_REG_IMM_BASE+0x801c) +#define CYGARC_REG_IMM_CPR1_A (CYGARC_REG_IMM_BASE+0x801e) +#define CYGARC_REG_IMM_CISR_A (CYGARC_REG_IMM_BASE+0x8020) +#define CYGARC_REG_IMM_LR_A (CYGARC_REG_IMM_BASE+0x8022) +#define CYGARC_REG_IMM_SGLR_A (CYGARC_REG_IMM_BASE+0x8024) +#define CYGARC_REG_IMM_DCNR_A (CYGARC_REG_IMM_BASE+0x8026) +#define CYGARC_REG_IMM_TPUMCR2_A (CYGARC_REG_IMM_BASE+0x8028) +#define CYGARC_REG_IMM_TPUMCR3_A (CYGARC_REG_IMM_BASE+0x802a) +#define CYGARC_REG_IMM_ISDR_A (CYGARC_REG_IMM_BASE+0x802c) +#define CYGARC_REG_IMM_ISCR_A (CYGARC_REG_IMM_BASE+0x802e) + + // TPU-B +#define CYGARC_REG_IMM_TPUMCR_B (CYGARC_REG_IMM_BASE+0x8400) +#define CYGARC_REG_IMM_TCR_B (CYGARC_REG_IMM_BASE+0x8402) +#define CYGARC_REG_IMM_DSCR_B (CYGARC_REG_IMM_BASE+0x8404) +#define CYGARC_REG_IMM_DSSR_B (CYGARC_REG_IMM_BASE+0x8406) +#define CYGARC_REG_IMM_TICR_B (CYGARC_REG_IMM_BASE+0x8408) +#define CYGARC_REG_IMM_CIER_B (CYGARC_REG_IMM_BASE+0x840a) +#define CYGARC_REG_IMM_CFSR0_B (CYGARC_REG_IMM_BASE+0x840c) +#define CYGARC_REG_IMM_CFSR1_B (CYGARC_REG_IMM_BASE+0x840e) +#define CYGARC_REG_IMM_CFSR2_B (CYGARC_REG_IMM_BASE+0x8410) +#define CYGARC_REG_IMM_CFSR3_B (CYGARC_REG_IMM_BASE+0x8412) +#define CYGARC_REG_IMM_HSQR0_B (CYGARC_REG_IMM_BASE+0x8414) +#define CYGARC_REG_IMM_HSQR1_B (CYGARC_REG_IMM_BASE+0x8416) +#define CYGARC_REG_IMM_HSRR0_B (CYGARC_REG_IMM_BASE+0x8418) +#define CYGARC_REG_IMM_HSRR1_B (CYGARC_REG_IMM_BASE+0x841a) +#define CYGARC_REG_IMM_CPR0_B (CYGARC_REG_IMM_BASE+0x841c) +#define CYGARC_REG_IMM_CPR1_B (CYGARC_REG_IMM_BASE+0x841e) +#define CYGARC_REG_IMM_CISR_B (CYGARC_REG_IMM_BASE+0x8420) +#define CYGARC_REG_IMM_LR_B (CYGARC_REG_IMM_BASE+0x8422) +#define CYGARC_REG_IMM_SGLR_B (CYGARC_REG_IMM_BASE+0x8424) +#define CYGARC_REG_IMM_DCNR_B (CYGARC_REG_IMM_BASE+0x8426) +#define CYGARC_REG_IMM_TPUMCR2_B (CYGARC_REG_IMM_BASE+0x8428) +#define CYGARC_REG_IMM_TPUMCR3_B (CYGARC_REG_IMM_BASE+0x842a) +#define CYGARC_REG_IMM_ISDR_B (CYGARC_REG_IMM_BASE+0x842c) +#define CYGARC_REG_IMM_ISCR_B (CYGARC_REG_IMM_BASE+0x842e) + + + //------------------------------------- + // QADC64 (Queued Analog-to-digital Converter) + //------------------------------------- + // QUADC-A +#define CYGARC_REG_IMM_QUADC64MCR_A (CYGARC_REG_IMM_BASE+0x8800) +#define CYGARC_REG_IMM_QUADC64TEST_A (CYGARC_REG_IMM_BASE+0x8802) +#define CYGARC_REG_IMM_QUADC64INT_A (CYGARC_REG_IMM_BASE+0x8804) +#define CYGARC_REG_IMM_PORTQA_A_PORTQB_A (CYGARC_REG_IMM_BASE+0x8806) +#define CYGARC_REG_IMM_DDRQA_A_DDRQB_A (CYGARC_REG_IMM_BASE+0x8808) +#define CYGARC_REG_IMM_QUACR0_A (CYGARC_REG_IMM_BASE+0x880a) +#define CYGARC_REG_IMM_QUACR1_A (CYGARC_REG_IMM_BASE+0x880c) +#define CYGARC_REG_IMM_QUACR2_A (CYGARC_REG_IMM_BASE+0x880e) +#define CYGARC_REG_IMM_QUASR0_A (CYGARC_REG_IMM_BASE+0x8810) +#define CYGARC_REG_IMM_QUASR1_A (CYGARC_REG_IMM_BASE+0x8812) +#define CYGARC_REG_IMM_CCW_A (CYGARC_REG_IMM_BASE+0x8a00) +#define CYGARC_REG_IMM_RJURR_A (CYGARC_REG_IMM_BASE+0x8a80) +#define CYGARC_REG_IMM_LJSRR_A (CYGARC_REG_IMM_BASE+0x8b00) +#define CYGARC_REG_IMM_LJURR_A (CYGARC_REG_IMM_BASE+0x8b80) + + // QUADC-B +#define CYGARC_REG_IMM_QUADC64MCR_B (CYGARC_REG_IMM_BASE+0x8c00) +#define CYGARC_REG_IMM_QUADC64TEST_B (CYGARC_REG_IMM_BASE+0x8c02) +#define CYGARC_REG_IMM_QUADC64INT_B (CYGARC_REG_IMM_BASE+0x8c04) +#define CYGARC_REG_IMM_PORTQA_B_PORTQB_B (CYGARC_REG_IMM_BASE+0x8c06) +#define CYGARC_REG_IMM_DDRQA_B_DDRQB_B (CYGARC_REG_IMM_BASE+0x8c08) +#define CYGARC_REG_IMM_QUACR0_B (CYGARC_REG_IMM_BASE+0x8c0a) +#define CYGARC_REG_IMM_QUACR1_B (CYGARC_REG_IMM_BASE+0x8c0c) +#define CYGARC_REG_IMM_QUACR2_B (CYGARC_REG_IMM_BASE+0x8c0e) +#define CYGARC_REG_IMM_QUASR0_B (CYGARC_REG_IMM_BASE+0x8c10) +#define CYGARC_REG_IMM_QUASR1_B (CYGARC_REG_IMM_BASE+0x8c12) +#define CYGARC_REG_IMM_CCW_B (CYGARC_REG_IMM_BASE+0x8e00) +#define CYGARC_REG_IMM_RJURR_B (CYGARC_REG_IMM_BASE+0x8e80) +#define CYGARC_REG_IMM_LJSRR_B (CYGARC_REG_IMM_BASE+0x8f00) +#define CYGARC_REG_IMM_LJURR_B (CYGARC_REG_IMM_BASE+0x8f80) + + //------------------------------------- + // QSMCM (Queued Serial Multi-Channel Module) + //------------------------------------- +#define CYGARC_REG_IMM_QSMCMMCR (CYGARC_REG_IMM_BASE+0x9000) +#define CYGARC_REG_IMM_QTEST (CYGARC_REG_IMM_BASE+0x9002) +#define CYGARC_REG_IMM_QDSCI_IL (CYGARC_REG_IMM_BASE+0x9004) +#define CYGARC_REG_IMM_QSPI_IL (CYGARC_REG_IMM_BASE+0x9006) +#define CYGARC_REG_IMM_SCC1R0 (CYGARC_REG_IMM_BASE+0x9008) +#define CYGARC_REG_IMM_SCC1R1 (CYGARC_REG_IMM_BASE+0x900a) +#define CYGARC_REG_IMM_SC1SR (CYGARC_REG_IMM_BASE+0x900c) +#define CYGARC_REG_IMM_SC1DR (CYGARC_REG_IMM_BASE+0x900e) +#define CYGARC_REG_IMM_PORTQS (CYGARC_REG_IMM_BASE+0x9014) +#define CYGARC_REG_IMM_PQSPAR_DDRQST (CYGARC_REG_IMM_BASE+0x9016) +#define CYGARC_REG_IMM_SPCR0 (CYGARC_REG_IMM_BASE+0x9018) +#define CYGARC_REG_IMM_SPCR1 (CYGARC_REG_IMM_BASE+0x901a) +#define CYGARC_REG_IMM_SPCR2 (CYGARC_REG_IMM_BASE+0x901c) +#define CYGARC_REG_IMM_SPCR3 (CYGARC_REG_IMM_BASE+0x901e) +#define CYGARC_REG_IMM_SPSR (CYGARC_REG_IMM_BASE+0x901f) +#define CYGARC_REG_IMM_SCC2R0 (CYGARC_REG_IMM_BASE+0x9020) +#define CYGARC_REG_IMM_SCC2R1 (CYGARC_REG_IMM_BASE+0x9022) +#define CYGARC_REG_IMM_SC2SR (CYGARC_REG_IMM_BASE+0x9024) +#define CYGARC_REG_IMM_SC2DR (CYGARC_REG_IMM_BASE+0x9026) +#define CYGARC_REG_IMM_QSCI1CR (CYGARC_REG_IMM_BASE+0x9028) +#define CYGARC_REG_IMM_QSCI1SR (CYGARC_REG_IMM_BASE+0x902a) +#define CYGARC_REG_IMM_SCTQ (CYGARC_REG_IMM_BASE+0x902c) +#define CYGARC_REG_IMM_SCRQ (CYGARC_REG_IMM_BASE+0x904c) +#define CYGARC_REG_IMM_RECRAM (CYGARC_REG_IMM_BASE+0x9140) +#define CYGARC_REG_IMM_TRAN_RAM (CYGARC_REG_IMM_BASE+0x9180) +#define CYGARC_REG_IMM_COMD_RAM (CYGARC_REG_IMM_BASE+0x91c0) + + //------------------------------------- + // MIOS1 (Modular Input/Output Subsystem) + //------------------------------------- + // MPIOS Pulse width modulation submodule 0 +#define CYGARC_REG_IMM_MPWMSMPERR_0 (CYGARC_REG_IMM_BASE+0xa000) +#define CYGARC_REG_IMM_MPWMSMPULR_0 (CYGARC_REG_IMM_BASE+0xa002) +#define CYGARC_REG_IMM_MPWMSMCNTR_0 (CYGARC_REG_IMM_BASE+0xa004) +#define CYGARC_REG_IMM_MPWMSMSCR_0 (CYGARC_REG_IMM_BASE+0xa006) + + // MPIOS Pulse width modulation submodule 1 +#define CYGARC_REG_IMM_MPWMSMPERR_1 (CYGARC_REG_IMM_BASE+0xa008) +#define CYGARC_REG_IMM_MPWMSMPULR_1 (CYGARC_REG_IMM_BASE+0xa00a) +#define CYGARC_REG_IMM_MPWMSMCNTR_1 (CYGARC_REG_IMM_BASE+0xa00c) +#define CYGARC_REG_IMM_MPWMSMSCR_1 (CYGARC_REG_IMM_BASE+0xa00e) + + // MPIOS Pulse width modulation submodule 2 +#define CYGARC_REG_IMM_MPWMSMPERR_2 (CYGARC_REG_IMM_BASE+0xa010) +#define CYGARC_REG_IMM_MPWMSMPULR_2 (CYGARC_REG_IMM_BASE+0xa012) +#define CYGARC_REG_IMM_MPWMSMCNTR_2 (CYGARC_REG_IMM_BASE+0xa014) +#define CYGARC_REG_IMM_MPWMSMSCR_2 (CYGARC_REG_IMM_BASE+0xa016) + + // MPIOS Pulse width modulation submodule 3 +#define CYGARC_REG_IMM_MPWMSMPERR_3 (CYGARC_REG_IMM_BASE+0xa018) +#define CYGARC_REG_IMM_MPWMSMPULR_3 (CYGARC_REG_IMM_BASE+0xa01a) +#define CYGARC_REG_IMM_MPWMSMCNTR_3 (CYGARC_REG_IMM_BASE+0xa01c) +#define CYGARC_REG_IMM_MPWMSMSCR_3 (CYGARC_REG_IMM_BASE+0xa01e) + + // MIOS Modulus counter submodule 6 +#define CYGARC_REG_IMM_MMCSMCNT_6 (CYGARC_REG_IMM_BASE+0xa030) +#define CYGARC_REG_IMM_MMCSMML_6 (CYGARC_REG_IMM_BASE+0xa032) +#define CYGARC_REG_IMM_MMCSMSCRD_6 (CYGARC_REG_IMM_BASE+0xa034) +#define CYGARC_REG_IMM_MMCSMSCR_6 (CYGARC_REG_IMM_BASE+0xa036) + + // MIOS Double Action submodule 11 +#define CYGARC_REG_IMM_MDASMAR_11 (CYGARC_REG_IMM_BASE+0xa058) +#define CYGARC_REG_IMM_MDASMBR_11 (CYGARC_REG_IMM_BASE+0xa05a) +#define CYGARC_REG_IMM_MDASMSCRD_11 (CYGARC_REG_IMM_BASE+0xa05c) +#define CYGARC_REG_IMM_MDASMSCR_11 (CYGARC_REG_IMM_BASE+0xa05e) + + // MIOS Double Action submodule 12 +#define CYGARC_REG_IMM_MDASMAR_12 (CYGARC_REG_IMM_BASE+0xa060) +#define CYGARC_REG_IMM_MDASMBR_12 (CYGARC_REG_IMM_BASE+0xa062) +#define CYGARC_REG_IMM_MDASMSCRD_12 (CYGARC_REG_IMM_BASE+0xa064) +#define CYGARC_REG_IMM_MDASMSCR_12 (CYGARC_REG_IMM_BASE+0xa066) + + // MIOS Double Action submodule 13 +#define CYGARC_REG_IMM_MDASMAR_13 (CYGARC_REG_IMM_BASE+0xa068) +#define CYGARC_REG_IMM_MDASMBR_13 (CYGARC_REG_IMM_BASE+0xa06a) +#define CYGARC_REG_IMM_MDASMSCRD_13 (CYGARC_REG_IMM_BASE+0xa06c) +#define CYGARC_REG_IMM_MDASMSCR_13 (CYGARC_REG_IMM_BASE+0xa06e) + + // MIOS Double Action submodule 14 +#define CYGARC_REG_IMM_MDASMAR_14 (CYGARC_REG_IMM_BASE+0xa070) +#define CYGARC_REG_IMM_MDASMBR_14 (CYGARC_REG_IMM_BASE+0xa072) +#define CYGARC_REG_IMM_MDASMSCRD_14 (CYGARC_REG_IMM_BASE+0xa074) +#define CYGARC_REG_IMM_MDASMSCR_14 (CYGARC_REG_IMM_BASE+0xa076) + + // MIOS Double Action submodule 15 +#define CYGARC_REG_IMM_MDASMAR_15 (CYGARC_REG_IMM_BASE+0xa078) +#define CYGARC_REG_IMM_MDASMBR_15 (CYGARC_REG_IMM_BASE+0xa07a) +#define CYGARC_REG_IMM_MDASMSCRD_15 (CYGARC_REG_IMM_BASE+0xa07c) +#define CYGARC_REG_IMM_MDASMSCR_15 (CYGARC_REG_IMM_BASE+0xa07e) + + // MPIOS Pulse width modulation submodule 16 +#define CYGARC_REG_IMM_MPWMSMPERR_16 (CYGARC_REG_IMM_BASE+0xa080) +#define CYGARC_REG_IMM_MPWMSMPULR_16 (CYGARC_REG_IMM_BASE+0xa082) +#define CYGARC_REG_IMM_MPWMSMCNTR_16 (CYGARC_REG_IMM_BASE+0xa084) +#define CYGARC_REG_IMM_MPWMSMSCR_16 (CYGARC_REG_IMM_BASE+0xa086) + + // MPIOS Pulse width modulation submodule 17 +#define CYGARC_REG_IMM_MPWMSMPERR_17 (CYGARC_REG_IMM_BASE+0xa088) +#define CYGARC_REG_IMM_MPWMSMPULR_17 (CYGARC_REG_IMM_BASE+0xa08a) +#define CYGARC_REG_IMM_MPWMSMCNTR_17 (CYGARC_REG_IMM_BASE+0xa08c) +#define CYGARC_REG_IMM_MPWMSMSCR_17 (CYGARC_REG_IMM_BASE+0xa08e) + + // MPIOS Pulse width modulation submodule 18 +#define CYGARC_REG_IMM_MPWMSMPERR_18 (CYGARC_REG_IMM_BASE+0xa090) +#define CYGARC_REG_IMM_MPWMSMPULR_18 (CYGARC_REG_IMM_BASE+0xa092) +#define CYGARC_REG_IMM_MPWMSMCNTR_18 (CYGARC_REG_IMM_BASE+0xa094) +#define CYGARC_REG_IMM_MPWMSMSCR_18 (CYGARC_REG_IMM_BASE+0xa096) + + // MPIOS Pulse width modulation submodule 19 +#define CYGARC_REG_IMM_MPWMSMPERR_19 (CYGARC_REG_IMM_BASE+0xa098) +#define CYGARC_REG_IMM_MPWMSMPULR_19 (CYGARC_REG_IMM_BASE+0xa09a) +#define CYGARC_REG_IMM_MPWMSMCNTR_19 (CYGARC_REG_IMM_BASE+0xa09c) +#define CYGARC_REG_IMM_MPWMSMSCR_19 (CYGARC_REG_IMM_BASE+0xa09e) + + // MIOS Modulus counter submodule 22 +#define CYGARC_REG_IMM_MMCSMCNT_22 (CYGARC_REG_IMM_BASE+0xa0b0) +#define CYGARC_REG_IMM_MMCSMML_22 (CYGARC_REG_IMM_BASE+0xa0b2) +#define CYGARC_REG_IMM_MMCSMSCRD_22 (CYGARC_REG_IMM_BASE+0xa0b4) +#define CYGARC_REG_IMM_MMCSMSCR_22 (CYGARC_REG_IMM_BASE+0xa0b6) + + // MIOS Double action submodule 27 +#define CYGARC_REG_IMM_MDASMAR_27 (CYGARC_REG_IMM_BASE+0xa0d8) +#define CYGARC_REG_IMM_MDASMBR_27 (CYGARC_REG_IMM_BASE+0xa0da) +#define CYGARC_REG_IMM_MDASMSCRD_27 (CYGARC_REG_IMM_BASE+0xa0dc) +#define CYGARC_REG_IMM_MDASMSCR_27 (CYGARC_REG_IMM_BASE+0xa0de) + + // MIOS Double action submodule 28 +#define CYGARC_REG_IMM_MDASMAR_28 (CYGARC_REG_IMM_BASE+0xa0e0) +#define CYGARC_REG_IMM_MDASMBR_28 (CYGARC_REG_IMM_BASE+0xa0e2) +#define CYGARC_REG_IMM_MDASMSCRD_28 (CYGARC_REG_IMM_BASE+0xa0e4) +#define CYGARC_REG_IMM_MDASMSCR_28 (CYGARC_REG_IMM_BASE+0xa0e6) + + // MIOS Double action submodule 29 +#define CYGARC_REG_IMM_MDASMAR_29 (CYGARC_REG_IMM_BASE+0xa0e8) +#define CYGARC_REG_IMM_MDASMBR_29 (CYGARC_REG_IMM_BASE+0xa0ea) +#define CYGARC_REG_IMM_MDASMSCRD_29 (CYGARC_REG_IMM_BASE+0xa0ec) +#define CYGARC_REG_IMM_MDASMSCR_29 (CYGARC_REG_IMM_BASE+0xa0ee) + + // MIOS Double action submodule 30 +#define CYGARC_REG_IMM_MDASMAR_30 (CYGARC_REG_IMM_BASE+0xa0f0) +#define CYGARC_REG_IMM_MDASMBR_30 (CYGARC_REG_IMM_BASE+0xa0f2) +#define CYGARC_REG_IMM_MDASMSCRD_30 (CYGARC_REG_IMM_BASE+0xa0f4) +#define CYGARC_REG_IMM_MDASMSCR_30 (CYGARC_REG_IMM_BASE+0xa0f6) + + // MIOS Double action submodule 31 +#define CYGARC_REG_IMM_MDASMAR_31 (CYGARC_REG_IMM_BASE+0x0af8) +#define CYGARC_REG_IMM_MDASMBR_31 (CYGARC_REG_IMM_BASE+0xa0fa) +#define CYGARC_REG_IMM_MDASMSCRD_31 (CYGARC_REG_IMM_BASE+0xa0fc) +#define CYGARC_REG_IMM_MDASMSCR_31 (CYGARC_REG_IMM_BASE+0xa0fe) + + // MIOS Paralell port I/O submodule +#define CYGARC_REG_IMM_MPIOSMDR (CYGARC_REG_IMM_BASE+0xa100) +#define CYGARC_REG_IMM_MPIOSMDDR (CYGARC_REG_IMM_BASE+0xa102) + + // MIOS Bus interface Submodule +#define CYGARC_REG_IMM_MIOS1TPCR (CYGARC_REG_IMM_BASE+0xa800) +#define CYGARC_REG_IMM_MIOS1VNR (CYGARC_REG_IMM_BASE+0xa802) +#define CYGARC_REG_IMM_MIOS1MCR (CYGARC_REG_IMM_BASE+0xa806) + + // MIOS Counter / Prescaler submodule +#define CYGARC_REG_IMM_MCPSMSCR (CYGARC_REG_IMM_BASE+0xa816) + + // MIOS Interrupt request submodule 0 +#define CYGARC_REG_IMM_MIOS1SR0 (CYGARC_REG_IMM_BASE+0xac00) +#define CYGARC_REG_IMM_MIOS1ER0 (CYGARC_REG_IMM_BASE+0xac04) +#define CYGARC_REG_IMM_MIOS1RPR0 (CYGARC_REG_IMM_BASE+0xac06) +#define CYGARC_REG_IMM_MIOS1LVL0 (CYGARC_REG_IMM_BASE+0xac30) + + // Mios Interrupt request submodule 1 +#define CYGARC_REG_IMM_MIOS1SR1 (CYGARC_REG_IMM_BASE+0xac40) +#define CYGARC_REG_IMM_MIOS1ER1 (CYGARC_REG_IMM_BASE+0xac44) +#define CYGARC_REG_IMM_MIOS1RPR1 (CYGARC_REG_IMM_BASE+0xac46) +#define CYGARC_REG_IMM_MIOS1LVL1 (CYGARC_REG_IMM_BASE+0xac70) + + //------------------------------------- + // TouCAN (CAN 2.0B Controller) + //------------------------------------- + // TouCAN_A +#define CYGARC_REG_IMM_TCNMCR_A (CYGARC_REG_IMM_BASE+0xb080) +#define CYGARC_REG_IMM_TTR_A (CYGARC_REG_IMM_BASE+0xb082) +#define CYGARC_REG_IMM_CANICR_A (CYGARC_REG_IMM_BASE+0xb084) +#define CYGARC_REG_IMM_CANCTRL0_A_CANCTRL1_A (CYGARC_REG_IMM_BASE+0xb086) +#define CYGARC_REG_IMM_PRESDIV_A_CTRL2_A (CYGARC_REG_IMM_BASE+0xb088) +#define CYGARC_REG_IMM_TIMER_A (CYGARC_REG_IMM_BASE+0xb08a) +#define CYGARC_REG_IMM_RXGMASKHI_A (CYGARC_REG_IMM_BASE+0xb090) +#define CYGARC_REG_IMM_RXGMASKLO_A (CYGARC_REG_IMM_BASE+0xb092) +#define CYGARC_REG_IMM_RX14MASKHI_A (CYGARC_REG_IMM_BASE+0xb094) +#define CYGARC_REG_IMM_RX14MASKLO_A (CYGARC_REG_IMM_BASE+0xb096) +#define CYGARC_REG_IMM_RX15MASKHI_A (CYGARC_REG_IMM_BASE+0xb098) +#define CYGARC_REG_IMM_RX15MASKLO_A (CYGARC_REG_IMM_BASE+0xb09a) +#define CYGARC_REG_IMM_ESTAT_A (CYGARC_REG_IMM_BASE+0xb0a0) +#define CYGARC_REG_IMM_IMASK_A (CYGARC_REG_IMM_BASE+0xb0a2) +#define CYGARC_REG_IMM_IFLAG_A (CYGARC_REG_IMM_BASE+0xb0a4) +#define CYGARC_REG_IMM_RXECTR_A_TXECTR_A (CYGARC_REG_IMM_BASE+0xb0a6) + + // TouCAN_B +#define CYGARC_REG_IMM_TCNMCR_B (CYGARC_REG_IMM_BASE+0xb480) +#define CYGARC_REG_IMM_TTR_B (CYGARC_REG_IMM_BASE+0xb482) +#define CYGARC_REG_IMM_CANICR_B (CYGARC_REG_IMM_BASE+0xb484) +#define CYGARC_REG_IMM_CANCTRL0_B_CANCTRL1_B (CYGARC_REG_IMM_BASE+0xb486) +#define CYGARC_REG_IMM_PRESDIV_B_CTRL2_B (CYGARC_REG_IMM_BASE+0xb488) +#define CYGARC_REG_IMM_TIMER_B (CYGARC_REG_IMM_BASE+0xb48a) +#define CYGARC_REG_IMM_RXGMASKHI_B (CYGARC_REG_IMM_BASE+0xb490) +#define CYGARC_REG_IMM_RXGMASKLO_B (CYGARC_REG_IMM_BASE+0xb492) +#define CYGARC_REG_IMM_RX14MASKHI_B (CYGARC_REG_IMM_BASE+0xb494) +#define CYGARC_REG_IMM_RX14MASKLO_B (CYGARC_REG_IMM_BASE+0xb496) +#define CYGARC_REG_IMM_RX15MASKHI_B (CYGARC_REG_IMM_BASE+0xb498) +#define CYGARC_REG_IMM_RX15MASKLO_B (CYGARC_REG_IMM_BASE+0xb49a) +#define CYGARC_REG_IMM_ESTAT_B (CYGARC_REG_IMM_BASE+0xb4a0) +#define CYGARC_REG_IMM_IMASK_B (CYGARC_REG_IMM_BASE+0xb4a2) +#define CYGARC_REG_IMM_IFLAG_B (CYGARC_REG_IMM_BASE+0xb4a4) +#define CYGARC_REG_IMM_RXECTR_A_TXECTR_B (CYGARC_REG_IMM_BASE+0xb4a6) + + //------------------------------------- + // UIMB (U-Bus to IMB3 Bus Interface) + //------------------------------------- +#define CYGARC_REG_IMM_UMCR (CYGARC_REG_IMM_BASE+0xbf80) +#define CYGARC_REG_IMM_UTSTCREG (CYGARC_REG_IMM_BASE+0xbf90) +#define CYGARC_REG_IMM_UIPEND (CYGARC_REG_IMM_BASE+0xbfa0) + + //------------------------------------- + // SRAM (Static RAM Access memory) + //------------------------------------- +#define CYGARC_REG_IMM_SRAMMCR_A (CYGARC_REG_IMM_BASE+0x84000) +#define CYGARC_REG_IMM_SRAMTST_A (CYGARC_REG_IMM_BASE+0x84004) +#define CYGARC_REG_IMM_SRAMMCR_B (CYGARC_REG_IMM_BASE+0x84008) +#define CYGARC_REG_IMM_SRAMTST_B (CYGARC_REG_IMM_BASE+0x8400c) + +#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +// definitions without CYGARC_REG_ can come here. If there is a need for it .... +#endif + +//----------------------------------------------------------------------------- +#endif // ifdef CYGONCE_HAL_VAR_REGS_H +// End of var_regs.h diff --git a/packages/hal/powerpc/mpc5xx/current/include/variant.inc b/packages/hal/powerpc/mpc5xx/current/include/variant.inc new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/include/variant.inc @@ -0,0 +1,273 @@ +#ifndef CYGONCE_HAL_VARIANT_INC +#define CYGONCE_HAL_VARIANT_INC +##============================================================================= +## +## variant.inc +## +## MPC5xx family assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): Bob Koninckx +## Contributors:Bob Koninckx +## Date: 2001-12-15 +## Purpose: MPC5xx family definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the MPC5xx CPU family. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +##------------------------------------------------------------------------------ +## Handle denormalized numbers etc in hardware, or use a software envelope to +## generate 100% IEEE correct results +#define FULL_IEEE_FLOATING_POINT_SUPPORT 29 + +#include + +#include + +##----------------------------------------------------------------------------- +## MPC5xx defined vectors + + .macro hal_extra_vectors + # MPC5xx vectors + exception_vector software_emu + exception_vector reserved_01100 + exception_vector reserved_01200 + exception_vector instruction_tlb_error + exception_vector data_tlb_error + exception_vector reserved_01500 + exception_vector reserved_01600 + exception_vector reserved_01700 + exception_vector reserved_01800 + exception_vector reserved_01900 + exception_vector reserved_01A00 + exception_vector reserved_01B00 + exception_vector data_breakpoint + exception_vector instruction_breakpoint + exception_vector peripheral_breakpoint + exception_vector NMI_port + .endm + +##----------------------------------------------------------------------------- +## MPC5xx CPU initialization +## +## Initialize CPU to a post-reset state, ensuring the ground doesn''t +## shift under us while we try to set things up. + + .macro hal_cpu_init + + # Set up MSR + lwi r3,CYG_MSR + sync + mtmsr r3 + sync + +#ifndef CYGSEM_HAL_USE_ROM_MONITOR +#ifndef CYGSEM_HAL_POWERPC_MPC5XX_OCD_ENABLE +#ifdef CYGSEM_HAL_ROM_MONITOR + ## Do not touch the DER register if OCD support is wanted. + ## DER will be set with the OCD debugger in this case. + ## Leave it untouched if co-existence with a ROM monitor + ## is wanted as well. + ## If we want to make a ROM monitor, we have to specify events + ## that assert the FREEZE signal + ## Single steps are implemented using hardware interrupts, + ## breakpoints use program exceptions + lwi r3, 0x2082000f + +#else + ## Disable special MPC5xx "development support" for non + ## debug loads. + lwi r3, 0x00000000 +#endif + mtder r3 +#endif +#endif + +#ifdef CYGSEM_HAL_POWERPC_IEEE_FLOATING_POINT + mtfsb0 FULL_IEEE_FLOATING_POINT_SUPPORT +#else + mtfsb1 FULL_IEEE_FLOATING_POINT_SUPPORT +#endif + + # Set up IMMR + lwi r3, 0x00000000 +#ifdef CYGHWR_HAL_POWERPC_MPC5XX_IFLASH_ENABLE + lwi r4, CYGARC_REG_IMM_IMMR_FLEN +#else + lwi r4, 0x00000000 +#endif + ## We load the internal memory space to address zero + ## Board specific initialization can then relocate this + ## afterwards + or r3, r3, r4 + mtspr CYGARC_REG_IMMR, r3 + + ## Disable bursts. Again, board initialization can enable this + ## afterwards. + li r0, 0 + mtspr 560, r0 + + .endm + +##----------------------------------------------------------------------------- +## MPC5xx exception state handling + .macro hal_variant_save regs + .endm + + .macro hal_variant_load regs + .endm + +##----------------------------------------------------------------------------- +## MPC5xx monitor initialization + +#ifndef CYGPKG_HAL_PPC_MON_DEFINED + +#if defined(CYG_HAL_STARTUP_ROM) || \ + ( defined(CYG_HAL_STARTUP_RAM) && \ + !defined(CYGSEM_HAL_USE_ROM_MONITOR)) + + .macro hal_mon_init +#ifdef CYGSEM_HAL_POWERPC_COPY_VECTORS + # If we are starting up from ROM and want vectors in RAM + # or we are starting in RAM and NOT using a ROM monitor, + # copy exception handler code to 0. + lwi r3,rom_vectors # r3 = rom start + lwi r4,0 # r4 = ram start + lwi r5,rom_vectors_end # r5 = rom end + cmplw r3,r5 # skip if no vectors + beq 2f + + subi r3,r3,4 + subi r4,r4,4 + subi r5,r5,4 +1: + lwzu r0,4(r3) # get word from ROM + stwu r0,4(r4) # store in RAM + cmplw r3,r5 # compare + blt 1b # loop if not yet done +2: +#endif + + # Next initialize the VSR table. This happens whether the + # vectors were copied to RAM or not. + + # First fill with exception handlers + lwi r3,cyg_hal_default_exception_vsr + lwi r4,hal_vsr_table + subi r4,r4,4 + li r5,CYGNUM_HAL_VSR_COUNT +1: stwu r3,4(r4) + subi r5,r5,1 + cmpwi r5,0 + bne 1b + + # Then fill in the special vectors + lwi r3,cyg_hal_default_interrupt_vsr + lwi r4,hal_vsr_table + stw r3,CYGNUM_HAL_VECTOR_INTERRUPT*4(r4) + stw r3,CYGNUM_HAL_VECTOR_DECREMENTER*4(r4) + .endm + +#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR) + + # Initialize the VSR table entries + # We only take control of the interrupt vectors, + # the rest are left to the ROM for now... + + .macro hal_mon_init + lwi r3,cyg_hal_default_interrupt_vsr + lwi r4,hal_vsr_table + stw r3,CYGNUM_HAL_VECTOR_INTERRUPT*4(r4) + stw r3,CYGNUM_HAL_VECTOR_DECREMENTER*4(r4) + .endm + + +#else + + .macro hal_mon_init + + .endm + +#endif + + +#define CYGPKG_HAL_PPC_MON_DEFINED + +#endif // CYGPKG_HAL_PPC_MON_DEFINED + + + + +##----------------------------------------------------------------------------- +## Indicate that the ISR tables are defined in variant.S +#define CYG_HAL_PPC_ISR_TABLES_DEFINED + +##----------------------------------------------------------------------------- +## MPC5xx interrupt handling. + +#ifndef CYGPKG_HAL_POWERPC_INTC_DEFINED + +## First level decoding of MPC5xx SIU interrupt controller. + + # decode the interrupt + .macro hal_intc_decode dreg,state + lwz \dreg,CYGARC_PPCREG_VECTOR(\state) # retrieve vector number, + rlwinm. \dreg,\dreg,22,31,31 # isolate bit 21 + beq 0f # done if decrementer (vec 0) + lwi \dreg,CYGARC_REG_IMM_SIVEC # if external, get SIU + lbz \dreg,0(\dreg) # vector. + srwi \dreg,\dreg,2 + addi \dreg,\dreg,1 # Skip decrementer vector +0: stw \dreg,CYGARC_PPCREG_VECTOR(\state) # update vector in state frame. + slwi \dreg,\dreg,2 # convert to byte offset. + .endm + + +#define CYGPKG_HAL_POWERPC_INTC_DEFINED +#endif // CYGPKG_HAL_POWERPC_INTC_DEFINED + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_VARIANT_INC +# end of variant.inc diff --git a/packages/hal/powerpc/mpc5xx/current/src/mpc5xxrev.c b/packages/hal/powerpc/mpc5xx/current/src/mpc5xxrev.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/src/mpc5xxrev.c @@ -0,0 +1,74 @@ +//========================================================================== +// +// mpc5xxrev.c +// +// MPC5xx Revision Identification +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2001-12-11 +// Description: Print MPC5xx revision numbers +//####DESCRIPTIONEND#### + +#include +#include +#include +#include +#include + +int +main( void ) +{ + cyg_uint32 pvr, part_mask; + + CYG_TEST_INIT(); + + asm volatile ("mfspr %0, 287;": "=r" (pvr)); + diag_printf("Processor PVR: 0x%08x\n", pvr); + + asm volatile ("mfspr %0, 638;": "=r" (part_mask)); + part_mask = (part_mask >> 16); + diag_printf("Processor IMMR[00:15]: 0x%04x\n", (part_mask & 0xffff)); + + diag_printf("\nSee http://www.motorola.com/SPS/RISC/netcomm/ for erratas.\n"); + diag_printf("Look for MPC5xx Versions and Masks in the Publications Library\n"); + + CYG_TEST_PASS_FINISH("mpc5xx revision dump"); +} +// EOF mpc5xxrev.c diff --git a/packages/hal/powerpc/mpc5xx/current/src/var_intr.c b/packages/hal/powerpc/mpc5xx/current/src/var_intr.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/src/var_intr.c @@ -0,0 +1,285 @@ +//========================================================================== +// +// var_intr.c +// +// PowerPC variant interrupt handlers +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2001-12-16 +// Purpose: PowerPC variant interrupt handlers +// Description: This file contains code to handle interrupt related issues +// on the PowerPC variant. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include +#include + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Since the interrupt sources do not have fixed vectors on the 5XX +// SIU, some arbitration is required. + +// More than one interrupt source can be programmed to use the same +// vector, so all sources on the same vector have to be queried to +// find the one raising the interrupt. This functionality has not been +// implemented, but the arbiter functions for each of the SIU +// interrupt sources can be called in sequence without change. + + + +// Timebase interrupt can be caused by match on either reference A +// or B. +// Note: If only one interrupt source is assigned per vector, and only +// reference interrupt A or B is used, this ISR is not +// necessary. Attach the timerbase reference A or B ISR directly to +// the LVLx vector instead. +externC cyg_uint32 +hal_arbitration_isr_tb (CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + cyg_uint32 isr_ret; + cyg_uint16 tbscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + if (tbscr & CYGARC_REG_IMM_TBSCR_REFA) { + isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SIU_TB_A); +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if (isr_ret & CYG_ISR_HANDLED) +#endif + return isr_ret; + } + + if (tbscr & CYGARC_REG_IMM_TBSCR_REFB) { + isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SIU_TB_B); +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if (isr_ret & CYG_ISR_HANDLED) +#endif + return isr_ret; + } + + return 0; +} + +// Periodic interrupt. +// Note: If only one interrupt source is assigned per vector, this ISR +// is not necessary. Attach the periodic interrupt ISR directly to the +// LVLx vector instead. +externC cyg_uint32 +hal_arbitration_isr_pit (CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + cyg_uint32 isr_ret; + cyg_uint16 piscr; + + HAL_READ_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + if (piscr & CYGARC_REG_IMM_PISCR_PS) { + isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SIU_PIT); +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if (isr_ret & CYG_ISR_HANDLED) +#endif + return isr_ret; + } + + return 0; +} + +// Real time clock interrupts can be caused by the alarm or +// once-per-second. +// Note: If only one interrupt source is assigned per vector, and only +// the alarm or once-per-second interrupt is used, this ISR is not +// necessary. Attach the alarm or once-per-second ISR directly to the +// LVLx vector instead. +externC cyg_uint32 +hal_arbitration_isr_rtc (CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + cyg_uint32 isr_ret; + cyg_uint16 rtcsc; + + HAL_READ_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc); + if (rtcsc & CYGARC_REG_IMM_RTCSC_SEC) { + isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SIU_RTC_SEC); +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if (isr_ret & CYG_ISR_HANDLED) +#endif + return isr_ret; + } + + if (rtcsc & CYGARC_REG_IMM_RTCSC_ALR) { + isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SIU_RTC_ALR); +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if (isr_ret & CYG_ISR_HANDLED) +#endif + return isr_ret; + } + + return 0; +} + +// ------------------------------------------------------------------------- +// IMB3 interrupt decoding +// +// All interrupt priorities higher than 7 are mapped to SIU level 7. As much +// as 15 interrupting devices can be behind this. If more than one IMB3 +// device is to be used with priorites in the range 7-31, a special kind of +// arbitration isr needs to be set up on SIU level 7. As this is not allways +// necessary, it is provided as a configuration option. +#ifdef CYGSEM_HAL_POWERPC_MPC5XX_IMB3_ARBITER +static hal_mpc5xx_arbitration_data * imb3_data_head = 0; + +static cyg_uint32 +hal_arbitration_imb3(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + hal_mpc5xx_arbitration_data * p = + *(hal_mpc5xx_arbitration_data **)data; + + // Try them all, highest priorities come first. An ISR should return + // CYG_ISR_HANDLED or CYG_ISR_CALL_DSR. An arbitration ISR will + // strip the CYG_DSR_HANDLED from the ISR result, or returns 0 if + // no ISR could be called. This means that CYG_ISR_HANDLED implies + // that an ISR was called, 0 means that nothing was called. + // Notice that our approach tries to be efficient. We return as soon + // as the first interrupting source is found. This prevents from scanning + // the complete table for every interrupt. If more than one module + // requested at the same time, we will re-enter this procedure immediately + // anyway. + while(p) + { + if((p->arbiter(CYGNUM_HAL_INTERRUPT_SIU_LVL7, p->data))&CYG_ISR_HANDLED) + break; + else + p = (hal_mpc5xx_arbitration_data *)(p->reserved); + } + + return 0; +} + +static hal_mpc5xx_arbitration_data * +mpc5xx_insert(hal_mpc5xx_arbitration_data * list, + hal_mpc5xx_arbitration_data * data) +{ + hal_mpc5xx_arbitration_data tmp; + hal_mpc5xx_arbitration_data * ptmp = &tmp; + tmp.reserved = list; + + while(ptmp->reserved) + { + if(((hal_mpc5xx_arbitration_data *)(ptmp->reserved))->priority > data->priority) + break; + ptmp = (hal_mpc5xx_arbitration_data *)(ptmp->reserved); + } + + data->reserved = ptmp->reserved; + ptmp->reserved = data; + + return (hal_mpc5xx_arbitration_data *)(tmp.reserved); +} + +static hal_mpc5xx_arbitration_data * +mpc5xx_remove(hal_mpc5xx_arbitration_data * list, + hal_mpc5xx_arbitration_data * data) +{ + hal_mpc5xx_arbitration_data tmp; + hal_mpc5xx_arbitration_data * ptmp = &tmp; + tmp.reserved = list; + + while(ptmp->reserved) + { + if(ptmp->reserved == data) + break; + + ptmp = (hal_mpc5xx_arbitration_data *)(ptmp->reserved); + } + + if(ptmp->reserved) + ptmp->reserved = ((hal_mpc5xx_arbitration_data *)(ptmp->reserved))->reserved; + + return (hal_mpc5xx_arbitration_data *)(tmp.reserved); +} +#endif + +externC void +hal_mpc5xx_install_arbitration_isr(hal_mpc5xx_arbitration_data * adata) +{ + CYG_ADDRWORD vector = 2*(1 + adata->priority); + if(vector < CYGNUM_HAL_INTERRUPT_SIU_LVL7) + { + HAL_INTERRUPT_ATTACH(vector, adata->arbiter, adata->data, 0); + HAL_INTERRUPT_UNMASK(vector); + } + else + { +#ifdef CYGSEM_HAL_POWERPC_MPC5XX_IMB3_ARBITER + // Prevent anything from coming through while manipulating + // the list + HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_LVL7); + imb3_data_head = mpc5xx_insert(imb3_data_head, adata); + HAL_INTERRUPT_UNMASK(CYGNUM_HAL_INTERRUPT_SIU_LVL7); +#else + HAL_INTERRUPT_ATTACH(CYGNUM_HAL_INTERRUPT_SIU_LVL7, adata->arbiter, adata->data, 0); + HAL_INTERRUPT_UNMASK(CYGNUM_HAL_INTERRUPT_SIU_LVL7); +#endif + } +} + +externC void +hal_mpc5xx_remove_arbitration_isr(hal_mpc5xx_arbitration_data * adata) +{ +#ifdef CYGSEM_HAL_POWERPC_MPC5XX_IMB3_ARBITER + // Prevent anything from coming through while manipulating the list + HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_LVL7); + imb3_data_head = mpc5xx_remove(imb3_data_head, adata); + HAL_INTERRUPT_UNMASK(CYGNUM_HAL_INTERRUPT_SIU_LVL7); +#endif +} + +// ------------------------------------------------------------------------- +// Variant specific interrupt setup +externC void +hal_variant_IRQ_init(void) +{ +#ifdef CYGSEM_HAL_POWERPC_MPC5XX_IMB3_ARBITER + HAL_INTERRUPT_ATTACH(CYGNUM_HAL_INTERRUPT_SIU_LVL7, hal_arbitration_imb3, &imb3_data_head, 0); + HAL_INTERRUPT_UNMASK(CYGNUM_HAL_INTERRUPT_SIU_LVL7); +#endif +} + +// ------------------------------------------------------------------------- +// EOF var_intr.c diff --git a/packages/hal/powerpc/mpc5xx/current/src/var_misc.c b/packages/hal/powerpc/mpc5xx/current/src/var_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/src/var_misc.c @@ -0,0 +1,105 @@ +//========================================================================== +// +// var_misc.c +// +// HAL implementation miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Bob Koninckx +// Contributors: Bob Koninckx +// Date: 2001-12-10 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include +#include // types +#include // diag_printf + +#include // some of the functions defined here + +//-------------------------------------------------------------------------- +void +hal_variant_init(void) +{ + // Disable serialization + { + cyg_uint32 ictrl; + CYGARC_MFSPR (ICTRL, ictrl); + ictrl |= ICTRL_NOSERSHOW; + CYGARC_MTSPR (ICTRL, ictrl); + } +} + +//-------------------------------------------------------------------------- +// Variant specific idle thread action. +bool +hal_variant_idle_thread_action( cyg_uint32 count ) +{ + // Let architecture idle thread action run + return true; +} + +//--------------------------------------------------------------------------- +// Use MMU resources to map memory regions. +// Takes and returns an int used to ID the MMU resource to use. This ID +// is increased as resources are used and should be used for subsequent +// invocations. +// +// The MPC5xx CPUs do not have cache. Leave these functions empty +int +cyg_hal_map_memory (int id,CYG_ADDRESS virt, CYG_ADDRESS phys, + cyg_int32 size, cyg_uint8 flags) +{ + return 0; +} + +void +cyg_hal_clear_MMU (void) +{ +} + +//-------------------------------------------------------------------------- +// End of var_misc.c diff --git a/packages/hal/powerpc/mpc5xx/current/src/variant.S b/packages/hal/powerpc/mpc5xx/current/src/variant.S new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/src/variant.S @@ -0,0 +1,85 @@ +##============================================================================= +## +## variant.S +## +## POWERPC MPC8xx variant code +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): jskov +## Contributors:jskov +## Date: 2000-02-04 +## Purpose: PowerPC MPC8xx variant code +## Description: Variant specific code for PowerPC MPC8xx CPUs. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#--------------------------------------------------------------------------- +# Interrupt vector tables. +# These tables contain the isr, data and object pointers used to deliver +# interrupts to user code. + + .data + + .extern hal_default_decrementer_isr + .extern hal_default_isr + + .globl hal_interrupt_handlers +hal_interrupt_handlers: + .long hal_default_decrementer_isr + .rept CYGNUM_HAL_ISR_COUNT-1 + .long hal_default_isr + .endr + + .globl hal_interrupt_data +hal_interrupt_data: + .rept CYGNUM_HAL_ISR_COUNT + .long 0 + .endr + + .globl hal_interrupt_objects +hal_interrupt_objects: + .rept CYGNUM_HAL_ISR_COUNT + .long 0 + .endr + +##----------------------------------------------------------------------------- +## end of variant.S diff --git a/packages/hal/powerpc/mpc5xx/current/tests/intr0.c b/packages/hal/powerpc/mpc5xx/current/tests/intr0.c new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/mpc5xx/current/tests/intr0.c @@ -0,0 +1,307 @@ +//================================================================= +// +// intr0.c +// +// Interrupt test 0 +// +//================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 1998-12-01 +// Description: Simple test of MPC860 interrupt handling when the +// kernel has not been configured. Uses timer interrupts. +// Options: +//####DESCRIPTIONEND#### + +//#define DEBUG_PRINTFS +#ifdef DEBUG_PRINTFS +extern diag_printf( char *format, ... ); +#endif + +#include + +#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS +#include + +#include + +#include + +#ifdef CYGSEM_HAL_POWERPC_MPC860_CPM_ENABLE + +#undef CHECK(b) +#define CHECK(b) CYG_TEST_CHECK(b,#b) + +// Can't rely on Cyg_Interrupt class being defined. +#define Cyg_InterruptHANDLED 1 + +// This is the period between interrupts, measured in decrementer ticks. +// Period must be longer than the time required for setting up all the +// interrupt handlers. +#define PIT_PERIOD 5000 + +#ifdef CYGPKG_HAL_POWERPC_MBX +#define TB_PERIOD (PIT_PERIOD*384) // PTA period is 15.36 uS +#else +#define TB_PERIOD (PIT_PERIOD*32) // assuming 512/16 divisors +#endif + +#define ID_RTC_SEC 12345 +#define ID_RTC_ALR 23451 +#define ID_PIT 34512 +#define ID_TBA 45123 +#define ID_TBB 51234 + +volatile cyg_uint32 count = 0; + +// Time/PERIOD 0 1 2 3 4 5 6 7 8 9 10 +// Interrupt PIT TBA PIT PIT TBB PIT PIT +// pit_count 0 0 0 1 1 2 2 3 3 4 4 +// count 0 0 1 3 4 4 5 40 41 42 + +static cyg_uint32 count_verify_table[] = {1, 4, 5, 41, 42}; +static int pit_count = 0; + +// These are useful for debugging: +static cyg_uint32 count_actual_table[] = { -1, -1, -1, -1, -1}; +static cyg_uint32 tbr_actual_table[] = { -1, -1, -1, -1, -1}; + +// Periodic timer ISR. Should be executing 5 times. +static cyg_uint32 isr_pit(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + cyg_uint32 verify_value; + + CYG_UNUSED_PARAM(CYG_ADDRWORD, data); + + CYG_ASSERT (CYGNUM_HAL_INTERRUPT_SIU_PIT == vector, "Wrong vector!"); + CYG_ASSERT (ID_PIT == data, "Wrong data!"); + + HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SIU_PIT); + + count++; + + count_actual_table[pit_count] = count; + { + cyg_uint32 tbl; + CYGARC_MFTB (TBL_R, tbl); + tbr_actual_table[pit_count] = tbl; + } + + verify_value = count_verify_table[pit_count++]; + +#ifdef DEBUG_PRINTFS + diag_printf( "ISR_PIT executed %d of 5\n", pit_count ); +#endif + + CYG_ASSERT (count == verify_value, "Count wrong!"); + + // End of test when count is 42. Mask interrupts and print PASS text. + if (42 <= count || 5 == pit_count) { + HAL_INTERRUPT_MASK (CYGNUM_HAL_INTERRUPT_SIU_PIT); + HAL_INTERRUPT_MASK (CYGNUM_HAL_INTERRUPT_SIU_TB_A); + HAL_INTERRUPT_MASK (CYGNUM_HAL_INTERRUPT_SIU_TB_B); + +#ifdef DEBUG_PRINTFS + diag_printf( "INFO: Actual counts: %d %d %d %d %d\n", + count_actual_table[0], + count_actual_table[1], + count_actual_table[2], + count_actual_table[3], + count_actual_table[4] ); + diag_printf( "INFO: Actuals tbrs: %d %d %d %d %d\n", + tbr_actual_table[0], + tbr_actual_table[1], + tbr_actual_table[2], + tbr_actual_table[3], + tbr_actual_table[4] ); +#endif + if (42 == count && 5 == pit_count) + CYG_TEST_PASS_FINISH("Intr 0 OK"); + else + CYG_TEST_FAIL_FINISH("Intr 0 Failed."); + } + + return Cyg_InterruptHANDLED; +} + +// TimeBase A ISR. Should be executing once. +static cyg_uint32 isr_tba(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + CYG_UNUSED_PARAM(CYG_ADDRWORD, data); + + CYG_ASSERT (CYGNUM_HAL_INTERRUPT_SIU_TB_A == vector, "Wrong vector!"); + CYG_ASSERT (ID_TBA == data, "Wrong data!"); + + HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SIU_TB_A); + + count = count * 3; + +#ifdef DEBUG_PRINTFS + diag_printf( "ISR_TBA executed\n" ); +#endif + + return Cyg_InterruptHANDLED; +} + +// TimeBase B ISR. Should be executing once. +static cyg_uint32 isr_tbb(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + CYG_UNUSED_PARAM(CYG_ADDRWORD, data); + + CYG_ASSERT (CYGNUM_HAL_INTERRUPT_SIU_TB_B == vector, "Wrong vector!"); + CYG_ASSERT (ID_TBB == data, "Wrong data!"); + + HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SIU_TB_B); + + count = count * 8; + +#ifdef DEBUG_PRINTFS + diag_printf( "ISR_TBB executed\n" ); +#endif + + return Cyg_InterruptHANDLED; +} + +void intr0_main( void ) +{ + CYG_TEST_INIT(); + +#if 0 + // The A.3 revision of the CPU I'm using at the moment generates a + // machine check exception when writing to IMM_RTCSC. Smells a + // bit like the "SIU4. Spurious External Bus Transaction Following + // PLPRCR Write." CPU errata. Have to find out for sure. Run real + // time clock interrupts on level 0 + { + // Still to do. + } +#endif + + // Run periodic timer interrupt on level 1 + { + cyg_uint16 piscr; + + // Attach pit arbiter. + HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_LVL1, + &hal_arbitration_isr_pit, ID_PIT, 0); + HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_LVL1); + + // Attach pit isr. + HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_PIT, &isr_pit, + ID_PIT, 0); + HAL_INTERRUPT_SET_LEVEL (CYGNUM_HAL_INTERRUPT_SIU_PIT, 1); + HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_PIT); + + + // Set period. + HAL_WRITE_UINT32 (CYGARC_REG_IMM_PITC, + (2*PIT_PERIOD) << CYGARC_REG_IMM_PITC_COUNT_SHIFT); + +#ifdef DEBUG_PRINTFS + diag_printf( "PIT set to %d\n", 2*PIT_PERIOD ); +#endif + // Enable. + HAL_READ_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + piscr |= CYGARC_REG_IMM_PISCR_PTE; + HAL_WRITE_UINT16 (CYGARC_REG_IMM_PISCR, piscr); + } + + // Run timebase interrupts on level 2 + { + cyg_uint16 tbscr; + cyg_uint32 tbl; + + // Attach tb arbiter. + HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_LVL2, + &hal_arbitration_isr_tb, ID_TBA, 0); + HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_LVL2); + + // Attach tb isrs. + HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_TB_A, &isr_tba, + ID_TBA, 0); + HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_TB_B, &isr_tbb, + ID_TBB, 0); + HAL_INTERRUPT_SET_LEVEL (CYGNUM_HAL_INTERRUPT_SIU_TB_A, 2); + HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_TB_A); + HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_TB_B); + + // Set reference A & B registers. + CYGARC_MFTB (TBL_R, tbl); + tbl += TB_PERIOD*3; + HAL_WRITE_UINT32 (CYGARC_REG_IMM_TBREF0, tbl); + tbl += TB_PERIOD*4; + HAL_WRITE_UINT32 (CYGARC_REG_IMM_TBREF1, tbl); + +#ifdef DEBUG_PRINTFS + diag_printf( "TB initial %d, !1 %d !2 %d\n", + tbl - 7*TB_PERIOD, + tbl - 4*TB_PERIOD, + tbl - 0*TB_PERIOD ); +#endif + // Enable. + HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + tbscr |= (CYGARC_REG_IMM_TBSCR_REFA | CYGARC_REG_IMM_TBSCR_REFB | + CYGARC_REG_IMM_TBSCR_TBE); + HAL_WRITE_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + tbscr |= CYGARC_REG_IMM_TBSCR_REFAE | CYGARC_REG_IMM_TBSCR_REFBE; + HAL_WRITE_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); + } + + HAL_ENABLE_INTERRUPTS(); + + for (;;); +} + +externC void +cyg_start( void ) +{ + intr0_main(); +} + +#else // ifdef CYGSEM_HAL_POWERPC_MPC860_CPM_ENABLE + +externC void +cyg_start( void ) +{ + CYG_TEST_INIT(); + CYG_TEST_PASS_FINISH("N/A: CYGSEM_HAL_POWERPC_MPC860_CPM_ENABLE disabled"); +} + +#endif // ifdef CYGSEM_HAL_POWERPC_MPC860_CPM_ENABLE + +// EOF intr0.c diff --git a/packages/hal/powerpc/mpc8xx/current/ChangeLog b/packages/hal/powerpc/mpc8xx/current/ChangeLog --- a/packages/hal/powerpc/mpc8xx/current/ChangeLog +++ b/packages/hal/powerpc/mpc8xx/current/ChangeLog @@ -1,3 +1,35 @@ +2002-05-03 Gary Thomas + + * tests/intr0.c: Fiddle to make this test run on all current MPC8xx + boards (the MBX is especially cranky). The problem lies with the + fact that the timers used to run the test are very platform specific. + +2002-04-24 Jesper Skov + + * cdl/hal_powerpc_mpc8xx.cdl: CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES + defined. + +2002-04-22 Gary Thomas + + * tests/intr0.c: Only applicable if chained interrupts are *not* + turned on. Also, change setup to be a little more intuitive. + +2002-04-11 Gary Thomas + + * tests/intr0.c: Adjust counts on non-MBX platforms. Note that + this test is highly subjective to how the hardware is setup and + that the test itself can't wholy determine the correct values + to use at runtime. The chosen ones work for known platforms. + +2002-04-08 Gary Thomas + + * include/variant.inc: Need vectors for both ROM and ROMRAM mode. + +2002-01-23 Gary Thomas + + * include/var_regs.h (CYGARC_REG_IMM_BASE): Move to match + what EPPCbug uses (for Linux booting). + 2001-08-22 Gary Thomas * src/mpc8xxrev.c: Don't use printf(), but rather diag_printf(). @@ -150,27 +182,36 @@ 2000-02-07 Jesper Skov #endif #include @@ -53,9 +62,10 @@ extern diag_printf( char *format, ... ); #include +#ifndef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN #ifdef CYGSEM_HAL_POWERPC_MPC860_CPM_ENABLE -#undef CHECK(b) +#undef CHECK #define CHECK(b) CYG_TEST_CHECK(b,#b) // Can't rely on Cyg_Interrupt class being defined. @@ -69,9 +79,21 @@ extern diag_printf( char *format, ... ); #ifdef CYGPKG_HAL_POWERPC_MBX #define TB_PERIOD (PIT_PERIOD*384) // PTA period is 15.36 uS #else -#define TB_PERIOD (PIT_PERIOD*32) // assuming 512/16 divisors +// This value is based on the relationship between the PIT clock +// and the TB clock. This is set in the SCCR register and the +// default value seems to be that the TB runs 128 times faster +// than the PIT. Of course, this doesn't match the documentation :-( +// Also, the basis for this is hardware strappable (set at reset time) +// so the value chosen below is a guess which works on the 860 platforms +// we have seen, other than the Motorola MBX860. +#define TB_PERIOD (PIT_PERIOD*128) // assuming 512/4 divisors #endif +#define PIT_IRQ_LEVEL 4 +#define PIT_IRQ CYGNUM_HAL_INTERRUPT_SIU_LVL4 +#define TB_IRQ_LEVEL 5 +#define TB_IRQ CYGNUM_HAL_INTERRUPT_SIU_LVL5 + #define ID_RTC_SEC 12345 #define ID_RTC_ALR 23451 #define ID_PIT 34512 @@ -141,7 +163,20 @@ static cyg_uint32 isr_pit(CYG_ADDRWORD v tbr_actual_table[3], tbr_actual_table[4] ); #endif + if (5 == pit_count) { +#ifndef CYGPKG_HAL_POWERPC_MBX + if (42 != count) { +#else + if ((42 != count) && (49 != count)) { +#endif + CYG_TEST_INFO("TB/PIT ratio does not match"); + } + } +#ifndef CYGPKG_HAL_POWERPC_MBX if (42 == count && 5 == pit_count) +#else + if (((42 == count) || (49 == count)) && (5 == pit_count)) +#endif CYG_TEST_PASS_FINISH("Intr 0 OK"); else CYG_TEST_FAIL_FINISH("Intr 0 Failed."); @@ -163,7 +198,7 @@ static cyg_uint32 isr_tba(CYG_ADDRWORD v count = count * 3; #ifdef DEBUG_PRINTFS - diag_printf( "ISR_TBA executed\n" ); + diag_printf( "ISR_TBA executed, count now %d\n", count ); #endif return Cyg_InterruptHANDLED; @@ -182,7 +217,7 @@ static cyg_uint32 isr_tbb(CYG_ADDRWORD v count = count * 8; #ifdef DEBUG_PRINTFS - diag_printf( "ISR_TBB executed\n" ); + diag_printf( "ISR_TBB executed, count now %d\n", count ); #endif return Cyg_InterruptHANDLED; @@ -190,8 +225,19 @@ static cyg_uint32 isr_tbb(CYG_ADDRWORD v void intr0_main( void ) { +#ifndef CYGPKG_HAL_POWERPC_MBX + unsigned long sccr = *(volatile unsigned long *)CYGARC_REG_IMM_SCCR; +#endif + int tb_period = TB_PERIOD; CYG_TEST_INIT(); +#ifndef CYGPKG_HAL_POWERPC_MBX +#ifdef DEBUG_PRINTFS + diag_printf("sccr = %x\n", sccr); +#endif + if (sccr & 0x01000000) tb_period /= 4; +#endif + #if 0 // The A.3 revision of the CPU I'm using at the moment generates a // machine check exception when writing to IMM_RTCSC. Smells a @@ -208,14 +254,14 @@ void intr0_main( void ) cyg_uint16 piscr; // Attach pit arbiter. - HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_LVL1, + HAL_INTERRUPT_ATTACH (PIT_IRQ, &hal_arbitration_isr_pit, ID_PIT, 0); - HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_LVL1); + HAL_INTERRUPT_UNMASK (PIT_IRQ); // Attach pit isr. HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_PIT, &isr_pit, ID_PIT, 0); - HAL_INTERRUPT_SET_LEVEL (CYGNUM_HAL_INTERRUPT_SIU_PIT, 1); + HAL_INTERRUPT_SET_LEVEL (CYGNUM_HAL_INTERRUPT_SIU_PIT, PIT_IRQ_LEVEL); HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_PIT); @@ -238,31 +284,31 @@ void intr0_main( void ) cyg_uint32 tbl; // Attach tb arbiter. - HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_LVL2, + HAL_INTERRUPT_ATTACH (TB_IRQ, &hal_arbitration_isr_tb, ID_TBA, 0); - HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_LVL2); + HAL_INTERRUPT_UNMASK (TB_IRQ); // Attach tb isrs. HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_TB_A, &isr_tba, ID_TBA, 0); HAL_INTERRUPT_ATTACH (CYGNUM_HAL_INTERRUPT_SIU_TB_B, &isr_tbb, ID_TBB, 0); - HAL_INTERRUPT_SET_LEVEL (CYGNUM_HAL_INTERRUPT_SIU_TB_A, 2); + HAL_INTERRUPT_SET_LEVEL (CYGNUM_HAL_INTERRUPT_SIU_TB_A, TB_IRQ_LEVEL); HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_TB_A); HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_TB_B); // Set reference A & B registers. CYGARC_MFTB (TBL_R, tbl); - tbl += TB_PERIOD*3; + tbl += tb_period*3; HAL_WRITE_UINT32 (CYGARC_REG_IMM_TBREF0, tbl); - tbl += TB_PERIOD*4; + tbl += tb_period*4; HAL_WRITE_UINT32 (CYGARC_REG_IMM_TBREF1, tbl); #ifdef DEBUG_PRINTFS diag_printf( "TB initial %d, !1 %d !2 %d\n", - tbl - 7*TB_PERIOD, - tbl - 4*TB_PERIOD, - tbl - 0*TB_PERIOD ); + tbl - 7*tb_period, + tbl - 4*tb_period, + tbl - 0*tb_period ); #endif // Enable. HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr); @@ -294,5 +340,14 @@ cyg_start( void ) } #endif // ifdef CYGSEM_HAL_POWERPC_MPC860_CPM_ENABLE +#else + +externC void +cyg_start( void ) +{ + CYG_TEST_INIT(); + CYG_TEST_PASS_FINISH("N/A: CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN enabled"); +} +#endif // ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN // EOF intr0.c diff --git a/packages/hal/powerpc/ppc40x/current/ChangeLog b/packages/hal/powerpc/ppc40x/current/ChangeLog --- a/packages/hal/powerpc/ppc40x/current/ChangeLog +++ b/packages/hal/powerpc/ppc40x/current/ChangeLog @@ -1,3 +1,7 @@ +2002-05-13 Gary Thomas + + * cdl/hal_powerpc_ppc40x.cdl: This processor family has no FPU. + 2001-01-26 Jesper Skov * include/var_intr.h: Include plf_intr.h @@ -53,27 +57,36 @@ 2000-11-04 Gary Thomas + + * include/plf_cache.h: Cache control is in hal/common CDL. + 2000-10-20 Jonathan Larmour * include/pkgconf/mlt_powerpc_sim_ram.h: @@ -265,27 +269,36 @@ Mon Aug 17 22:18:15 1998 Jonathan Larmo Add GROUP(libgcc.a libtarget.a) to prevent need for explicit linking //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/powerpc/sim/current/cdl/hal_powerpc_sim.cdl b/packages/hal/powerpc/sim/current/cdl/hal_powerpc_sim.cdl --- a/packages/hal/powerpc/sim/current/cdl/hal_powerpc_sim.cdl +++ b/packages/hal/powerpc/sim/current/cdl/hal_powerpc_sim.cdl @@ -5,29 +5,38 @@ # PSIM HAL package configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/hal/powerpc/sim/current/include/hal_diag.h b/packages/hal/powerpc/sim/current/include/hal_diag.h --- a/packages/hal/powerpc/sim/current/include/hal_diag.h +++ b/packages/hal/powerpc/sim/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/sim/current/include/plf_cache.h b/packages/hal/powerpc/sim/current/include/plf_cache.h --- a/packages/hal/powerpc/sim/current/include/plf_cache.h +++ b/packages/hal/powerpc/sim/current/include/plf_cache.h @@ -8,29 +8,38 @@ // Platform HAL cache details // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -48,11 +57,11 @@ //============================================================================= //--------------------------------------------------------------------------- -// Initial cache enabling +// Initial cache enabling - controlled by common CDL. // Do not enable caches for the simulator, it just slows it down. -#undef CYGPRI_INIT_CACHES -#undef CYGPRI_ENABLE_CACHES +#undef CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP +#undef CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP //----------------------------------------------------------------------------- #endif // ifndef CYGONCE_PLF_CACHE_H diff --git a/packages/hal/powerpc/sim/current/src/hal_aux.c b/packages/hal/powerpc/sim/current/src/hal_aux.c --- a/packages/hal/powerpc/sim/current/src/hal_aux.c +++ b/packages/hal/powerpc/sim/current/src/hal_aux.c @@ -5,29 +5,38 @@ // HAL auxiliary objects and code; per platform // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/sim/current/src/sim.S b/packages/hal/powerpc/sim/current/src/sim.S --- a/packages/hal/powerpc/sim/current/src/sim.S +++ b/packages/hal/powerpc/sim/current/src/sim.S @@ -5,29 +5,38 @@ ## Simulator hardware setup ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/powerpc/viper/current/ChangeLog b/packages/hal/powerpc/viper/current/ChangeLog --- a/packages/hal/powerpc/viper/current/ChangeLog +++ b/packages/hal/powerpc/viper/current/ChangeLog @@ -1,3 +1,45 @@ +2002-04-30 Nick Garnett + + * src/viper.S: Changed boot ROM wait states from 4 to 7. + +2002-04-16 Gary Thomas + + * misc/redboot_ROMRAM.ecm: + RedBoot now requires 0x30000 in this configuration. + +2002-04-11 Gary Thomas + + * include/plf_cache.h: Use common CDL for cache control. + +2002-04-10 Gary Thomas + + * src/hal_aux.c (hal_platform_init): Avoid resetting ethernet PHY chip. + + * include/plf_cache.h: [Re]enable caches. + + * cdl/hal_powerpc_viper.cdl: Fix RTC calculations. + +2002-04-08 Gary Thomas + + * src/viper.S: Lots of changes to get ROMRAM mode working from + initial FLASH boot. + +2002-03-08 Gary Thomas + + * src/viper.S: + * misc/redboot_ROMRAM.ecm: + * include/pkgconf/mlt_powerpc_viper_romram.mlt: + * include/pkgconf/mlt_powerpc_viper_romram.ldi: + * include/pkgconf/mlt_powerpc_viper_romram.h: + * include/pkgconf/mlt_powerpc_viper_ram.mlt: + * include/pkgconf/mlt_powerpc_viper_ram.ldi: + * include/pkgconf/mlt_powerpc_viper_ram.h: + * cdl/hal_powerpc_viper.cdl: Add support for ROMRAM mode. + +2002-01-28 Gary Thomas + + * src/hal_aux.c: Change mappings since IMMR has moved. + 2001-06-21 Jonathan Larmour * images/*: Remove. Don't bloat repository with things already on @@ -55,27 +97,36 @@ 2001-01-31 Jesper Skov " : \ + CYG_HAL_STARTUP == "ROMRAM" ? "" : \ "" } } @@ -292,6 +303,7 @@ cdl_package CYGPKG_HAL_POWERPC_VIPER { no_define define -file system.h CYGHWR_MEMORY_LAYOUT_H calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROMRAM" ? "" : \ "" } } } @@ -301,7 +313,7 @@ cdl_package CYGPKG_HAL_POWERPC_VIPER { flavor bool default_value 0 parent CYGPKG_HAL_ROM_MONITOR - requires { CYG_HAL_STARTUP == "ROM" } + requires { CYG_HAL_STARTUP == "ROM" || CYG_HAL_STARTUP == "ROMRAM" } description " Enable this option if this program is to be used as a ROM monitor, i.e. applications will be loaded into RAM on the board, and this diff --git a/packages/hal/powerpc/viper/current/include/hal_diag.h b/packages/hal/powerpc/viper/current/include/hal_diag.h --- a/packages/hal/powerpc/viper/current/include/hal_diag.h +++ b/packages/hal/powerpc/viper/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.h b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.h --- a/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.h +++ b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.h @@ -29,7 +29,7 @@ extern char CYG_LABEL_NAME (__reserved_v extern char CYG_LABEL_NAME (__reserved_for_rom) []; #endif #define CYGMEM_SECTION_reserved_for_rom (CYG_LABEL_NAME (__reserved_for_rom)) -#define CYGMEM_SECTION_reserved_for_rom_SIZE (0x1cd00) +#define CYGMEM_SECTION_reserved_for_rom_SIZE (0x3cd00) #ifndef __ASSEMBLER__ extern char CYG_LABEL_NAME (__heap1) []; #endif diff --git a/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.ldi b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.ldi --- a/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.ldi +++ b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.ldi @@ -15,7 +15,7 @@ SECTIONS CYG_LABEL_DEFN(__reserved_vectors) = 0; . = CYG_LABEL_DEFN(__reserved_vectors) + 0x3000; CYG_LABEL_DEFN(__reserved_vsr_table) = ALIGN (0x10); . = CYG_LABEL_DEFN(__reserved_vsr_table) + 0x200; CYG_LABEL_DEFN(__reserved_virtual_table) = ALIGN (0x10); . = CYG_LABEL_DEFN(__reserved_virtual_table) + 0x100; - CYG_LABEL_DEFN(__reserved_for_rom) = ALIGN (0x10); . = CYG_LABEL_DEFN(__reserved_for_rom) + 0x1cd00; + CYG_LABEL_DEFN(__reserved_for_rom) = ALIGN (0x10); . = CYG_LABEL_DEFN(__reserved_for_rom) + 0x3cd00; SECTION_vectors (ram, ALIGN (0x10), LMA_EQ_VMA) SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) diff --git a/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.mlt b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.mlt --- a/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.mlt +++ b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_ram.mlt @@ -3,7 +3,7 @@ region ram 0 800000 0 ! section reserved_vectors 3000 1 0 0 1 1 1 1 0 0 reserved_vsr_table reserved_vsr_table ! section reserved_vsr_table 200 10 0 0 0 1 0 1 reserved_virtual_table reserved_virtual_table ! section reserved_virtual_table 100 10 0 0 0 1 0 1 reserved_for_rom reserved_for_rom ! -section reserved_for_rom 1cd00 10 0 0 0 1 0 1 vectors vectors ! +section reserved_for_rom 3cd00 10 0 0 0 1 0 1 vectors vectors ! section vectors 0 10 0 1 0 1 0 1 text text ! section text 0 4 0 1 0 1 0 1 fini fini ! section fini 0 4 0 1 0 1 0 1 rodata1 rodata1 ! diff --git a/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_romram.h b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_romram.h new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_romram.h @@ -0,0 +1,32 @@ +// eCos memory layout - Fri Oct 20 10:35:23 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0) +#define CYGMEM_REGION_ram_SIZE (0x0800000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_vectors) []; +#endif +#define CYGMEM_SECTION_reserved_vectors (CYG_LABEL_NAME (__reserved_vectors)) +#define CYGMEM_SECTION_reserved_vectors_SIZE (0x3000) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_vsr_table) []; +#endif +#define CYGMEM_SECTION_reserved_vsr_table (CYG_LABEL_NAME (__reserved_vsr_table)) +#define CYGMEM_SECTION_reserved_vsr_table_SIZE (0x200) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved_virtual_table) []; +#endif +#define CYGMEM_SECTION_reserved_virtual_table (CYG_LABEL_NAME (__reserved_virtual_table)) +#define CYGMEM_SECTION_reserved_virtual_table_SIZE (0x100) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x800000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_romram.ldi b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_romram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_romram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Fri Oct 20 10:35:23 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0, LENGTH = 0x0800000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_vectors (ram, 0x000000, LMA_EQ_VMA) + CYG_LABEL_DEFN(__reserved_vectors) = 0; . = CYG_LABEL_DEFN(__reserved_vectors) + 0x3000; + CYG_LABEL_DEFN(__reserved_vsr_table) = ALIGN (0x10); . = CYG_LABEL_DEFN(__reserved_vsr_table) + 0x200; + CYG_LABEL_DEFN(__reserved_virtual_table) = ALIGN (0x10); . = CYG_LABEL_DEFN(__reserved_virtual_table) + 0x100; + SECTION_text (ram, 0x3400, LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_sbss (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_romram.mlt b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_romram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/viper/current/include/pkgconf/mlt_powerpc_viper_romram.mlt @@ -0,0 +1,17 @@ +version 0 +region ram 0 800000 0 ! +section reserved_vectors 3000 1 0 0 1 1 1 1 0 0 reserved_vsr_table reserved_vsr_table ! +section reserved_vsr_table 200 10 0 0 0 1 0 1 reserved_virtual_table reserved_virtual_table ! +section reserved_virtual_table 100 10 0 0 0 1 0 1 reserved_for_rom reserved_for_rom ! +section reserved_for_rom 1cd00 10 0 0 0 1 0 1 vectors vectors ! +section vectors 0 10 0 1 0 1 0 1 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 8 0 1 0 1 0 1 rodata rodata ! +section rodata 0 8 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 8 0 1 0 1 0 1 sbss sbss ! +section sbss 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 10 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/powerpc/viper/current/include/plf_cache.h b/packages/hal/powerpc/viper/current/include/plf_cache.h --- a/packages/hal/powerpc/viper/current/include/plf_cache.h +++ b/packages/hal/powerpc/viper/current/include/plf_cache.h @@ -8,29 +8,38 @@ // Platform HAL cache details // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -48,11 +57,7 @@ //============================================================================= //--------------------------------------------------------------------------- -// Initial cache enabling -#ifdef CYGSEM_HAL_ROM_MONITOR -# define CYGPRI_INIT_CACHES -# define CYGPRI_ENABLE_CACHES -#endif +// Initial cache enabling - controlled by common CDL //----------------------------------------------------------------------------- // FIXME: This definition forces the IO flash driver to use a diff --git a/packages/hal/powerpc/viper/current/include/plf_intr.h b/packages/hal/powerpc/viper/current/include/plf_intr.h --- a/packages/hal/powerpc/viper/current/include/plf_intr.h +++ b/packages/hal/powerpc/viper/current/include/plf_intr.h @@ -8,29 +8,38 @@ // MBX platform specific interrupt definitions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/viper/current/include/plf_stub.h b/packages/hal/powerpc/viper/current/include/plf_stub.h --- a/packages/hal/powerpc/viper/current/include/plf_stub.h +++ b/packages/hal/powerpc/viper/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/viper/current/misc/redboot_RAM.ecm b/packages/hal/powerpc/viper/current/misc/redboot_RAM.ecm deleted file mode 100644 --- a/packages/hal/powerpc/viper/current/misc/redboot_RAM.ecm +++ /dev/null @@ -1,47 +0,0 @@ -cdl_savefile_version 1; -cdl_savefile_command cdl_savefile_version {}; -cdl_savefile_command cdl_savefile_command {}; -cdl_savefile_command cdl_configuration { description hardware template package }; -cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; -cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; -cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; -cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; - -cdl_configuration eCos { - description "" ; - hardware viper ; - template redboot ; - package -hardware CYGPKG_HAL_POWERPC current ; - package -hardware CYGPKG_HAL_POWERPC_MPC8xx current ; - package -hardware CYGPKG_HAL_POWERPC_VIPER current ; - package -hardware CYGPKG_HAL_QUICC current ; - package -hardware CYGPKG_IO_SERIAL_POWERPC_QUICC_SMC current ; - package -hardware CYGPKG_DEVS_ETH_POWERPC_FEC current ; - package -hardware CYGPKG_DEVS_FLASH_VIPER current ; - package -template CYGPKG_HAL current ; - package -template CYGPKG_INFRA current ; - package -template CYGPKG_REDBOOT current ; - package CYGPKG_IO_FLASH current ; - package CYGPKG_IO_ETH_DRIVERS current ; - package CYGPKG_COMPRESS_ZLIB current ; - package CYGPKG_MEMALLOC current ; - package CYGPKG_ISOINFRA current ; -}; - -cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { - user_value 0 -}; - -cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { - inferred_value 0 -}; - -cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { - inferred_value 1 -}; - -cdl_component CYGBLD_BUILD_REDBOOT { - user_value 1 -}; - - diff --git a/packages/hal/powerpc/viper/current/misc/redboot_ROM.ecm b/packages/hal/powerpc/viper/current/misc/redboot_ROM.ecm deleted file mode 100644 --- a/packages/hal/powerpc/viper/current/misc/redboot_ROM.ecm +++ /dev/null @@ -1,67 +0,0 @@ -cdl_savefile_version 1; -cdl_savefile_command cdl_savefile_version {}; -cdl_savefile_command cdl_savefile_command {}; -cdl_savefile_command cdl_configuration { description hardware template package }; -cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; -cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; -cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; -cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; - -cdl_configuration eCos { - description "" ; - hardware viper ; - template redboot ; - package -hardware CYGPKG_HAL_POWERPC current ; - package -hardware CYGPKG_HAL_POWERPC_MPC8xx current ; - package -hardware CYGPKG_HAL_POWERPC_VIPER current ; - package -hardware CYGPKG_HAL_QUICC current ; - package -hardware CYGPKG_IO_SERIAL_POWERPC_QUICC_SMC current ; - package -hardware CYGPKG_DEVS_ETH_POWERPC_FEC current ; - package -hardware CYGPKG_DEVS_FLASH_VIPER current ; - package -template CYGPKG_HAL current ; - package -template CYGPKG_INFRA current ; - package -template CYGPKG_REDBOOT current ; - package CYGPKG_IO_FLASH current ; - package CYGPKG_IO_ETH_DRIVERS current ; - package CYGPKG_COMPRESS_ZLIB current ; - package CYGPKG_MEMALLOC current ; - package CYGPKG_ISOINFRA current ; -}; - -cdl_option CYGBLD_BUILD_GDB_STUBS { - user_value 0 -}; - -cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { - user_value 0 -}; - -cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { - inferred_value 0 -}; - -cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { - inferred_value 1 -}; - -cdl_option CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT { - inferred_value 1 -}; - -cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT { - inferred_value 0 -}; - -cdl_option CYGSEM_HAL_ROM_MONITOR { - inferred_value 1 -}; - -cdl_component CYG_HAL_STARTUP { - user_value ROM -}; - -cdl_component CYGBLD_BUILD_REDBOOT { - user_value 1 -}; - - diff --git a/packages/hal/powerpc/viper/current/misc/redboot_ROMRAM.ecm b/packages/hal/powerpc/viper/current/misc/redboot_ROMRAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/powerpc/viper/current/misc/redboot_ROMRAM.ecm @@ -0,0 +1,101 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware viper ; + template redboot ; + package -hardware CYGPKG_HAL_POWERPC current ; + package -hardware CYGPKG_HAL_POWERPC_MPC8xx current ; + package -hardware CYGPKG_HAL_POWERPC_VIPER current ; + package -hardware CYGPKG_HAL_QUICC current ; + package -hardware CYGPKG_IO_SERIAL_POWERPC_QUICC_SMC current ; + package -hardware CYGPKG_DEVS_ETH_POWERPC_FEC current ; + package -hardware CYGPKG_DEVS_FLASH_VIPER current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_MEMALLOC current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROMRAM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { + user_value 0x00030000 +}; + +cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP { + user_value 0 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff --git a/packages/hal/powerpc/viper/current/src/hal_aux.c b/packages/hal/powerpc/viper/current/src/hal_aux.c --- a/packages/hal/powerpc/viper/current/src/hal_aux.c +++ b/packages/hal/powerpc/viper/current/src/hal_aux.c @@ -5,29 +5,38 @@ // HAL auxiliary objects and code; per platform // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -53,10 +62,10 @@ // The memory map is weakly defined, allowing the application to redefine // it if necessary. The regions defined below are the minimum requirements. CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = { - // Mapping for the Motorola MBX860 development board + // Mapping for the Viper 855/860 development boards CYGARC_MEMDESC_CACHE( 0xfe000000, 0x00400000 ), // ROM region CYGARC_MEMDESC_NOCACHE( 0xff000000, 0x00100000 ), // MCP registers - CYGARC_MEMDESC_NOCACHE( 0xfa100000, 0x00000004 ), // Control/Status+LEDs + CYGARC_MEMDESC_NOCACHE( 0xfa000000, 0x00400000 ), // Control/Status+LEDs CYGARC_MEMDESC_CACHE( CYGMEM_REGION_ram, CYGMEM_REGION_ram_SIZE ), // Main memory CYGARC_MEMDESC_TABLE_END @@ -71,7 +80,6 @@ hal_platform_init(void) eppc->pip_pbpar &= ~0x00004000; // PB17 AS GPIO eppc->pip_pbdir |= 0x00004000; - eppc->pip_pbdat &= ~0x00004000; // Low resets PHY chip hal_if_init(); } diff --git a/packages/hal/powerpc/viper/current/src/hal_diag.c b/packages/hal/powerpc/viper/current/src/hal_diag.c --- a/packages/hal/powerpc/viper/current/src/hal_diag.c +++ b/packages/hal/powerpc/viper/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/powerpc/viper/current/src/viper.S b/packages/hal/powerpc/viper/current/src/viper.S --- a/packages/hal/powerpc/viper/current/src/viper.S +++ b/packages/hal/powerpc/viper/current/src/viper.S @@ -5,29 +5,38 @@ ## VIPER board hardware setup ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## @@ -58,7 +67,9 @@ //#define CYGPRI_RAM_START_PROGRAMS_UPMS -#if defined(CYG_HAL_STARTUP_ROM) || defined(CYGPRI_RAM_START_PROGRAMS_UPMS) +#if defined(CYG_HAL_STARTUP_ROM) \ + || defined(CYG_HAL_STARTUP_ROMRAM) \ + || defined(CYGPRI_RAM_START_PROGRAMS_UPMS) # define CYGPRI_DO_PROGRAM_UPMS #endif @@ -79,11 +90,11 @@ #------------------------------------------------------------------------------ -// LED macro uses r3, r5: r4 left alone +// LED macro uses r23, r25: r4 left alone #define LED( x ) \ - lwi r5,0xFA100018; \ - lwi r3,(x); \ - stb r3,0(r5) + lwi r25,0xFA100018; \ + lwi r23,(x); \ + stb r23,0(r25) #------------------------------------------------------------------------------ @@ -94,7 +105,7 @@ FUNC_START( hal_hardware_init ) lwi r4,CYGARC_REG_IMM_BASE # base address of control registers mtspr CYGARC_REG_IMMR,r4 - + LED( 0 ) # turn all LEDs off #define CACHE_UNLOCKALL 0x0a00 @@ -145,11 +156,22 @@ FUNC_START( hal_hardware_init ) sync LED( 0x01 ) + /* * SIU Initialization. */ lwi r3,0x00610400 stw r3,SIUMCR(r4) + +#ifdef CYG_HAL_STARTUP_ROMRAM +// Need to set the PC into the FLASH (ROM) before the address map changes + lwi r3,10f + lwi r5,0xFE000000 + or r3,r3,r5 + mtctr r3 + bctr +10: +#endif /* * Enable bus monitor. Disable Watchdog timer. @@ -244,22 +266,22 @@ FUNC_START( hal_hardware_init ) /* BOOT ROM */ lwi r3,0xFE000401 # 8-bit, GPCM - lwi r5,0xFFF00744 # 4 wait states (~100ns timing) + lwi r5,0xFFF00774 # 7 wait states stw r3,BR0(r4) stw r5,OR0(r4) + /* Misc I/O, 16 bit port */ + lwi r3,0xFA100801 + lwi r5,0xFFFF8730 + stw r3,BR2(r4) + stw r5,OR2(r4) + /* ONBOARD DRAM */ lwi r3,0x00000081 # 32-bit, UPMA lwi r5,0xFF800E00 stw r3,BR1(r4) stw r5,OR1(r4) - /* Misc I/O, 8 bit port */ - lwi r3,0xFA100801 - lwi r5,0xFFFF8730 - stw r3,BR2(r4) - stw r5,OR2(r4) - /* DRAM DIMM BANK1 */ lwi r3,0x00000080 # 32-bit, UPMA, INVALID lwi r5,0xFFFF87FC @@ -334,11 +356,17 @@ FUNC_START( hal_hardware_init ) // Field FIOPD (bit 26) = 0 // Field Reserved (bits 27-31) = 0 */ - /* MF (0:11) = 0x4c4 = 1220 = (40MHz/32.768KHz) */ + /* MF (0:11) = 0x00C = 12 = (47MHz/3.6864MHz)-1 */ lwi r3,0x00C04000 stw r3,PLPRCR(r4) -//#if defined(CYG_HAL_STARTUP_ROM) + LED(0xE0) + lwi r3,0x10000 + mtctr r3 +10: nop + bdnz 10b + LED(0xE1) + /* SDRAM Initialization Sequence, UPMA, CS1 */ li r3,0 stw r3,MAR(r4) @@ -354,10 +382,7 @@ FUNC_START( hal_hardware_init ) lwi r3,0x80002116; /* run MRS pattern from loc 22 (0x16) */ stw r3,MCR(r4) -//#endif // defined(CYG_HAL_STARTUP_ROM) - LED( 0x04 ) - # mask interrupt sources in the SIU lis r2,0 lwi r3,CYGARC_REG_IMM_SIMASK @@ -373,7 +398,7 @@ FUNC_START( hal_hardware_init ) lwi r3,CYGARC_REG_IMM_TBSCR sth r2,0(r3) - LED( 8 ) # turn red led off + LED( 8 ) #ifdef CYG_HAL_STARTUP_ROM # move return address to where the ROM is @@ -384,6 +409,28 @@ FUNC_START( hal_hardware_init ) mtlr r3 #endif +#ifdef CYG_HAL_STARTUP_ROMRAM + // Copy image from ROM to RAM + LED(0x10) + mflr r3 + lwi r4,0xFE000000 + lwi r5,0x01FFFFFF // ROM/FLASH base + and r3,r3,r5 // segment relative + lwi r6,_hal_hardware_init_done + mtlr r6 + sub r6,r3,r6 // Absolute address + add r6,r6,r4 // FLASH address + lwi r7,0 // where to copy to + lwi r8,__ram_data_end +10: lwz r5,0(r6) + stw r5,0(r7) + addi r6,r6,4 + addi r7,r7,4 + cmplw r7,r8 + bne 10b + LED(0x20) +#endif + blr FUNC_END( hal_hardware_init ) @@ -422,8 +469,20 @@ FUNC_END( hal_hardware_init ) FUNC_START(hal_viper_set_led) lwi r4,0xFA100018 stb r3,0(r4) + lwi r5,_hold_led + stw r3,0(r5) blr FUNC_END(hal_viper_set_led) + .data +_hold_led: + .long 0 + .text + +FUNC_START(hal_viper_get_led) + lwi r5,_hold_led + lwz r3,0(r5) + blr +FUNC_END(hal_viper_get_led) FUNC_START(hal_viper_flash_led) lwi r4,0xFA100018 diff --git a/packages/hal/powerpc/viper/current/tests/vipertime.cxx b/packages/hal/powerpc/viper/current/tests/vipertime.cxx --- a/packages/hal/powerpc/viper/current/tests/vipertime.cxx +++ b/packages/hal/powerpc/viper/current/tests/vipertime.cxx @@ -5,29 +5,38 @@ // PowerPC VIPER HAL timing tests // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/arch/current/ChangeLog b/packages/hal/sh/arch/current/ChangeLog --- a/packages/hal/sh/arch/current/ChangeLog +++ b/packages/hal/sh/arch/current/ChangeLog @@ -1,3 +1,197 @@ +2002-04-30 Jesper Skov + + * include/hal_var_sp.inc: Allow variant to provide custom + interrupt vector layout. This means the size of + hal_interrupt_handlers/objects/data can be reduced if the vector + layout is sparse. Something similar could be done for + _HW_EXEC_ENTRY_TABLE, saving exception_vector_int entries in the + $vectors_code block. However, this code usually resides in flash + so there's not much point given todays flash block sizes. + + * cdl/hal_sh.cdl: Added CYGHWR_HAL_SH_FPU and + CYGHWR_HAL_SH_NO_FPU, allowing an arch level control of FPU + related tests. + Skipping test handled in a different way now, so the implements + statement has been deleted again. + +2002-04-29 Jesper Skov + + * include/hal_var_bank.inc: Define hal_exception_entry_extras and + hal_interrupt_entry_extras. + * include/hal_var_sp.inc: Define hal_exception_entry_extras and + hal_interrupt_entry_extras. Disable interrupts on exception + entry. + * src/vectors.S: Call hal_exception_entry_extras and + hal_interrupt_entry_extras. + +2002-04-29 Jonathan Larmour + + * src/vectors.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-15 Jonathan Larmour + + * src/hal_syscall.c (hal_syscall_handler): Add extra sig argument to + __do_syscall. + +2002-04-22 Jesper Skov + + * include/hal_var_sp.inc: 7044 needs different vector layout than + 76xx since its vectors are hardwired. + +2002-04-18 Jesper Skov + + * include/hal_var_sp.inc: Do no translation of entry address if + cache module defines CYGARC_SH_MOD_CAC_NO_WINDOWS. + + * include/hal_intr_vecs.h: Move all vectors after IRQ7 to variant + header. Define _IRQ and _LVL for all of the first 7 + interrupts. Define CYGNUM_HAL_INTERRUPT_LVL_MAX + +2002-03-06 Jesper Skov + + * include/hal_var_sp.inc: Fix asm comments. + +2002-02-28 Jesper Skov + + * src/hal_syscall.c (hal_syscall_handler): Added. + * src/sh_stub.c (__is_bsp_syscall): Added. + * cdl/hal_sh.cdl: Build hal_syscall.c + +2002-02-27 Jesper Skov + + * src/sh_stub.c (__computeSignal): Changed to use DATA_ACCESS + names as well. + * include/hal_intr_vecs.h (_CYGNUM_HAL_VECTOR_FIRST_MEM_FAULT, + _CYGNUM_HAL_VECTOR_LAST_MEM_FAULT): Same. + +2002-02-26 Jesper Skov + + * include/hal_intr_vecs.h: Use DATA_ACCESS vector names instead of + ADDRESS_ERROR names. + +2002-02-15 Jesper Skov + + * src/sh_stub.c (__single_step): Use normal breakpoint instruction + (trapa #32) for single-stepping. + On the SH2 the use of trapa#255 causes a different (and unhandled) + exception, in the range reserved for application + exceptions/interrupts. + +2002-02-14 Jesper Skov + + * include/hal_var_bank.h: Switch mach/macl entries. + * include/hal_var_sp.h: Same. + + * include/hal_var_sp.inc: Reserve (additional) trampoline for NMI + to make eCos interrupt numbers match. Make traps use trap numbers + 32-64. + (hal_cpu_save_regs): Remember to adjust SP for R0 save location. + (hal_cpu_restore_regs_return): Rewritten to fix errors and allow + SP to be changed from GDB. + +2002-02-13 Jesper Skov + + * src/context.S (hal_thread_load_context): Load up stack pointer + before enabling interrupts. + + * include/hal_var_sp.inc: Fetch the VSR pointer and jump to it + instead of into the VSR table. + (hal_cpu_restore_regs_return): adjust sp to point to exception + state before returning. + +2002-02-08 Jesper Skov + + * src/vectors.S: tweak ROMRAM relocation code. + +2002-02-07 Jesper Skov + + * include/hal_var_sp.inc: Moved _reset code to below vectors. + +2002-01-17 Jesper Skov + + * include/hal_var_bank.inc: Include SH3 register references. Make + better use of some delay slots. + + * src/vectors.S: Don't save exception/interrupt state on stack + with debug markers. Load up event value in R4 before calling + hal_intc_decode so it can be a nop if desired. Removed some SH3 + register references. + + * include/hal_var_sp.inc: Include SH2 offsets, export + _HW_EXC_ENTRY_TABLE, fix some typos. + + * include/hal_intr_vecs.h: IRL vectors renamed. Added IRQ + vectors. + +2002-01-16 Jesper Skov + + * include/hal_var_bank.h: Fix typo. + + * src/sh_stub.c (__computeSignal): Only handle defined vectors. + + * include/hal_intr_vecs.h: Decode NMI as interrupt 0, moved all + other vectors. Provide MEM_FAULT vector range. + * include/hal_var_sp.inc: Changes for NMI-as-interrupt-0. + * include/hal_var_sp.h: Renamed vector to event to share code. + + * include/hal_intr_excevt.h: Added MEM_FAULT vector ranges and + CYGHWR_SH_RTC_TIMER_IS_TMU. + * src/hal_misc.c (hal_delay_us): Only build if + CYGHWR_SH_RTC_TIMER_IS_TMU. Use MEM_FAULT vector range. + + * include/hal_intr.h: Deleted clock controls. + + * cdl/hal_sh.cdl: Use CYGNUM_HAL_RTC_PRESCALE instread of + module-specific prescale variable. + + * include/hal_intr_excevt.h (_CYGNUM_HAL_VECTOR_FIRST_MEM_FAULT, + _CYGNUM_HAL_VECTOR_LAST_MEM_FAULT): Define. + * include/hal_intr_vecs.h: Same. + * src/hal_misc.c (cyg_hal_exception_handler): Use new _MEM_FAULT + vector range. + + + * include/hal_intr_vecs.h: Removed RTC code. + + * include/hal_arch.h: Changed breakpoint instruction to match that + used in GDB 5.1. + It also makes better sense on the SH2. + + * include/hal_intr_excevt.h: Interrupt/exception vectors and clock + handling code moved here... + * include/hal_intr.h: From here. + * include/hal_intr_vecs.h: Interrupt/exception vector layout + + clock handling for SH1/SH2 variants. + + * include/hal_var_sp.inc: Added some comments, fixed number of + pre-VSR vectors, renamed HW_VSR_TABLE to HW_EXC_ENTRY_TABLE to + avoid confusion (it has nothing to do with eCos VSRs). Finally, + made the pre-VSR stuff only compile when really required (since + it's 4KiB). + +2002-01-14 Jesper Skov + + * include/hal_arch.h: Moved HAL_SavedRegisters structure to + bank variant headers. Same with HAL_THREAD_INIT_CONTEXT, + HAL_THREAD_GET_SAVED_REGISTERS, HAL_GET_GDB_REGISTERS, + HAL_SET_GDB_REGISTERS, CYGARC_BUS_ADDRESS, CYGARC_CACHED_ADDRESS, + and CYGARC_UNCACHED_ADDRESS. + * src/vectors.S: Moved exception/interrupt entry code to bank + variant include file. + * include/hal_var_sp.inc: Added. Contains (new) vectors.S stuff + for SH2. + * include/hal_var_sp.h: Added. Contains (new) hal_arch.h stuff for + SH2 variant. + * include/hal_var_bank.inc: Added. Contains old vectors.S stuff + for SH3/SH4 variants. + * include/hal_var_bank.h: Added. Contains old hal_arch.h stuff for + SH3/SH4 variants. + + * src/hal_mk_defs.c: Added conversion for entry stack. + 2001-11-16 Nick Garnett * src/hal_misc.c (hal_msbit_index): Fixed this function so that it @@ -54,6 +248,18 @@ 2001-06-27 Jesper Skov + + * src/redboot_linux_exec.c: Only base address, entry and cmdline + options are always used. Other commands only affect image if + set. This allows combined kernel&initrd images to be loaded in one + file where the initrd address & size is already recorded at the + start of the image. + + From YAEGASHI Takeshi with a few changes: + * cdl/hal_sh.cdl: Added RedBoot exec command options. + * src/redboot_linux_exec.c: Added. + 2001-05-29 Jesper Skov * include/hal_io.h: Include var_io.h @@ -858,27 +1064,36 @@ 1999-04-22 Jesper Skov #include - -//----------------------------------------------------------------------------- -// Processor saved states: -// The layout of this structure is also defined in "sh.inc", for assembly -// code. Do not change this without changing that (or vice versa). - -typedef struct -{ - // These are common to all saved states - cyg_uint32 r[16]; // Data regs - cyg_uint32 mach; // Multiply and accumulate - high - cyg_uint32 macl; // Multiply and accumulate - low - cyg_uint32 pr; // Procedure Reg - cyg_uint32 sr; // Status Reg - cyg_uint32 pc; // Program Counter - - // This marks the limit of state saved during a context switch and - // is used to calculate necessary stack allocation for context switches. - // It would probably be better to have a union instead... - cyg_uint32 context_size[0]; - - // These are only saved on interrupts - cyg_uint32 vbr; // Vector Base Register - cyg_uint32 gbr; // Global Base Register - - // These are only saved on interrupts - cyg_uint32 event; // EXPEVT or INTEVT -} HAL_SavedRegisters; +#include CYGBLD_HAL_VAR_EXCEPTION_MODEL_H //----------------------------------------------------------------------------- // Exception handling function. @@ -95,30 +77,6 @@ externC cyg_uint32 hal_msbit_index(cyg_u #define HAL_MSBIT_INDEX(index, mask) index = hal_msbit_index(mask); -//----------------------------------------------------------------------------- -// Context Initialization -// Initialize the context of a thread. -// Arguments: -// _sparg_ name of variable containing current sp, will be written with new sp -// _thread_ thread object address, passed as argument to entry point -// _entry_ entry point address. -// _id_ bit pattern used in initializing registers, for debugging. - -#define HAL_THREAD_INIT_CONTEXT( _sparg_, _thread_, _entry_, _id_ ) \ - CYG_MACRO_START \ - register HAL_SavedRegisters *_regs_; \ - int _i_; \ - _regs_ = (HAL_SavedRegisters *)((_sparg_) - sizeof(HAL_SavedRegisters)); \ - for( _i_ = 0; _i_ < 16; _i_++ ) (_regs_)->r[_i_] = (_id_)|_i_; \ - (_regs_)->r[15] = (CYG_WORD)(_regs_); /* SP = top of stack */ \ - (_regs_)->r[04] = (CYG_WORD)(_thread_); /* R4 = arg1 = thread ptr */ \ - (_regs_)->mach = 0; /* MACH = 0 */ \ - (_regs_)->macl = 0; /* MACL = 0 */ \ - (_regs_)->pr = (CYG_WORD)(_entry_); /* PR = entry point */ \ - (_regs_)->sr = 0; /* SR = enable interrupts */ \ - (_regs_)->pc = (CYG_WORD)(_entry_); /* set PC for thread dbg */ \ - _sparg_ = (CYG_ADDRESS)_regs_; \ - CYG_MACRO_END //----------------------------------------------------------------------------- // Context switch macros. @@ -156,61 +114,14 @@ externC void hal_thread_load_context( CY CYG_MACRO_START \ HAL_ENABLE_INTERRUPTS(); \ asm volatile (" .globl " #_label_ ";" #_label_ ": " \ - " trapa #0xc3;nop;nop;nop"); \ + " trapa #0x20;nop;nop;nop"); \ CYG_MACRO_END -#define HAL_BREAKINST 0xc3c3 +#define HAL_BREAKINST 0xc320 #define HAL_BREAKINST_SIZE 2 //----------------------------------------------------------------------------- -// Thread register state manipulation for GDB support. - -// Translate a stack pointer as saved by the thread context macros above into -// a pointer to a HAL_SavedRegisters structure. -#define HAL_THREAD_GET_SAVED_REGISTERS( _sp_, _regs_ ) \ - (_regs_) = (HAL_SavedRegisters *)(_sp_) - -// Copy a set of registers from a HAL_SavedRegisters structure into a -// GDB ordered array. -#define HAL_GET_GDB_REGISTERS( _aregval_, _regs_ ) \ - CYG_MACRO_START \ - CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ - int _i_; \ - \ - for( _i_ = 0; _i_ < 16; _i_++ ) \ - _regval_[_i_] = (_regs_)->r[_i_]; \ - \ - _regval_[16] = (_regs_)->pc; \ - _regval_[17] = (_regs_)->pr; \ - _regval_[18] = (_regs_)->gbr; \ - _regval_[19] = (_regs_)->vbr; \ - _regval_[20] = (_regs_)->mach; \ - _regval_[21] = (_regs_)->macl; \ - _regval_[22] = (_regs_)->sr; \ - \ - /* 23-51 not used atm. */ \ - CYG_MACRO_END - -// Copy a GDB ordered array into a HAL_SavedRegisters structure. -#define HAL_SET_GDB_REGISTERS( _regs_ , _aregval_ ) \ - CYG_MACRO_START \ - CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ - int _i_; \ - \ - for( _i_ = 0; _i_ < 16; _i_++ ) \ - (_regs_)->r[_i_] = _regval_[_i_]; \ - \ - (_regs_)->pc = _regval_[16]; \ - (_regs_)->pr = _regval_[17]; \ - (_regs_)->gbr = _regval_[18]; \ - (_regs_)->vbr = _regval_[19]; \ - (_regs_)->mach = _regval_[20]; \ - (_regs_)->macl = _regval_[21]; \ - (_regs_)->sr = _regval_[22]; \ - CYG_MACRO_END - -//----------------------------------------------------------------------------- // HAL setjmp typedef struct { @@ -300,13 +211,6 @@ externC void hal_idle_thread_action(cyg_ #define CYGARC_HAL_SAVE_GP() #define CYGARC_HAL_RESTORE_GP() - -//-------------------------------------------------------------------------- -// CPU address space translation macros -#define CYGARC_BUS_ADDRESS(x) ((CYG_ADDRWORD)(x) & 0x1fffffff) -#define CYGARC_CACHED_ADDRESS(x) (CYGARC_BUS_ADDRESS(x)|0x80000000) -#define CYGARC_UNCACHED_ADDRESS(x) (CYGARC_BUS_ADDRESS(x)|0xa0000000) - //----------------------------------------------------------------------------- #endif // CYGONCE_HAL_ARCH_H // End of hal_arch.h diff --git a/packages/hal/sh/arch/current/include/hal_cache.h b/packages/hal/sh/arch/current/include/hal_cache.h --- a/packages/hal/sh/arch/current/include/hal_cache.h +++ b/packages/hal/sh/arch/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/arch/current/include/hal_intr.h b/packages/hal/sh/arch/current/include/hal_intr.h --- a/packages/hal/sh/arch/current/include/hal_intr.h +++ b/packages/hal/sh/arch/current/include/hal_intr.h @@ -8,29 +8,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -57,122 +66,7 @@ // More include statements below. First part of this file must be // usable for both assembly and C files, so only use defines here. -//-------------------------------------------------------------------------- -// SH exception vectors. These correspond to VSRs and are the values -// to use for HAL_VSR_GET/SET -// -// Note that exceptions are decoded - there is a VSR slot for each exception -// source, while interrupts are handled via the same VSR. - -#define CYGNUM_HAL_VECTOR_POWERON 0 // power-on -#define CYGNUM_HAL_VECTOR_RESET 1 // reset -#define CYGNUM_HAL_VECTOR_TLBMISS_ACCESS 2 // TLB-miss/invalid load -#define CYGNUM_HAL_VECTOR_TLBMISS_WRITE 3 // TLB-miss/invalid store -#define CYGNUM_HAL_VECTOR_INITIAL_WRITE 4 // initial page write -#define CYGNUM_HAL_VECTOR_TLBERROR_ACCESS 5 // TLB prot violation l -#define CYGNUM_HAL_VECTOR_TLBERROR_WRITE 6 // TLB prot violation s -#define CYGNUM_HAL_VECTOR_DATA_ACCESS 7 // address error (load) -#define CYGNUM_HAL_VECTOR_DATA_WRITE 8 // address error (store) -// RESERVED 9-10 -#define CYGNUM_HAL_VECTOR_TRAP 11 // unconditional trap -#define CYGNUM_HAL_VECTOR_ILLEGAL_INSTRUCTION 12 // reserved instruction -#define CYGNUM_HAL_VECTOR_ILLEGAL_SLOT_INSTRUCTION 13 - // illegal instruction in delay slot -#define CYGNUM_HAL_VECTOR_NMI 14 // NMI -#define CYGNUM_HAL_VECTOR_INSTRUCTION_BP 15 // user breakpoint - -#define CYGNUM_HAL_VECTOR_INTERRUPT 16 // all interrupts - -#ifndef CYG_VECTOR_IS_INTERRUPT -# define CYG_VECTOR_IS_INTERRUPT(v) (CYGNUM_HAL_VECTOR_INSTRUCTION_BP < (v)) -#endif - -#define CYGNUM_HAL_VSR_MIN CYGNUM_HAL_VECTOR_POWERON -#ifndef CYGNUM_HAL_VSR_MAX -# define CYGNUM_HAL_VSR_MAX CYGNUM_HAL_VECTOR_INTERRUPT -#endif -#define CYGNUM_HAL_VSR_COUNT ( CYGNUM_HAL_VSR_MAX + 1 ) - -#ifndef CYGNUM_HAL_VSR_EXCEPTION_COUNT -# define CYGNUM_HAL_VSR_EXCEPTION_COUNT (CYGNUM_HAL_VECTOR_INSTRUCTION_BP-CYGNUM_HAL_VECTOR_POWERON+1) -#endif - -// The decoded interrupts. -#define CYGNUM_HAL_INTERRUPT_NMI 0 -#define CYGNUM_HAL_INTERRUPT_RESERVED_1E0 1 -#define CYGNUM_HAL_INTERRUPT_LVL0 2 -#define CYGNUM_HAL_INTERRUPT_LVL1 3 -#define CYGNUM_HAL_INTERRUPT_LVL2 4 -#define CYGNUM_HAL_INTERRUPT_LVL3 5 -#define CYGNUM_HAL_INTERRUPT_LVL4 6 -#define CYGNUM_HAL_INTERRUPT_LVL5 7 -#define CYGNUM_HAL_INTERRUPT_LVL6 8 -#define CYGNUM_HAL_INTERRUPT_LVL7 9 -#define CYGNUM_HAL_INTERRUPT_LVL8 10 -#define CYGNUM_HAL_INTERRUPT_LVL9 11 -#define CYGNUM_HAL_INTERRUPT_LVL10 12 -#define CYGNUM_HAL_INTERRUPT_LVL11 13 -#define CYGNUM_HAL_INTERRUPT_LVL12 14 -#define CYGNUM_HAL_INTERRUPT_LVL13 15 -#define CYGNUM_HAL_INTERRUPT_LVL14 16 -#define CYGNUM_HAL_INTERRUPT_RESERVED_3E0 17 -#define CYGNUM_HAL_INTERRUPT_TMU0_TUNI0 18 -#define CYGNUM_HAL_INTERRUPT_TMU1_TUNI1 19 -#define CYGNUM_HAL_INTERRUPT_TMU2_TUNI2 20 -#define CYGNUM_HAL_INTERRUPT_TMU2_TICPI2 21 -#define CYGNUM_HAL_INTERRUPT_RTC_ATI 22 -#define CYGNUM_HAL_INTERRUPT_RTC_PRI 23 -#define CYGNUM_HAL_INTERRUPT_RTC_CUI 24 -#define CYGNUM_HAL_INTERRUPT_SCI_ERI 25 -#define CYGNUM_HAL_INTERRUPT_SCI_RXI 26 -#define CYGNUM_HAL_INTERRUPT_SCI_TXI 27 -#define CYGNUM_HAL_INTERRUPT_SCI_TEI 28 -#define CYGNUM_HAL_INTERRUPT_WDT_ITI 29 -#define CYGNUM_HAL_INTERRUPT_REF_RCMI 30 -#define CYGNUM_HAL_INTERRUPT_REF_ROVI 31 - -#ifndef CYGNUM_HAL_ISR_MAX -# define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_INTERRUPT_REF_ROVI -#endif - -#define CYGNUM_HAL_ISR_MIN CYGNUM_HAL_INTERRUPT_NMI -#define CYGNUM_HAL_ISR_COUNT ( CYGNUM_HAL_ISR_MAX - CYGNUM_HAL_ISR_MIN + 1 ) - -// The vector used by the Real time clock -#ifndef CYGNUM_HAL_INTERRUPT_RTC -# define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_TMU0_TUNI0 -#endif - -//-------------------------------------------------------------------------- -// Exception vectors. These are the values used when passed out to an -// external exception handler using cyg_hal_deliver_exception() - -// The exception indexes are EXPEVT/0x20. Variants may define additional -// exception vectors. - -#define CYGNUM_HAL_EXCEPTION_POWERON 0 // power-on -#define CYGNUM_HAL_EXCEPTION_RESET 1 // reset -#define CYGNUM_HAL_EXCEPTION_TLBMISS_ACCESS 2 // TLB-miss/invalid load -#define CYGNUM_HAL_EXCEPTION_TLBMISS_WRITE 3 // TLB-miss/invalid store -#define CYGNUM_HAL_EXCEPTION_INITIAL_WRITE 4 // initial page write -#define CYGNUM_HAL_EXCEPTION_TLBERROR_ACCESS 5 // TLB prot violation l -#define CYGNUM_HAL_EXCEPTION_TLBERROR_WRITE 6 // TLB prot violation s -#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS 7 // address error (load) -#define CYGNUM_HAL_EXCEPTION_DATA_WRITE 8 // address error (store) -#define CYGNUM_HAL_EXCEPTION_TRAP 11 // unconditional trap -#define CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION 12 // reserved instruction -#define CYGNUM_HAL_EXCEPTION_ILLEGAL_SLOT_INSTRUCTION 13 - // illegal instruction in delay slot -#define CYGNUM_HAL_EXCEPTION_INSTRUCTION_BP 15 // user breakpoint - -#define CYGNUM_HAL_EXCEPTION_MIN CYGNUM_HAL_EXCEPTION_POWERON - -#ifndef CYGNUM_HAL_EXCEPTION_MAX -# define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_EXCEPTION_INSTRUCTION_BP -#endif - -#define CYGNUM_HAL_EXCEPTION_COUNT \ - ( CYGNUM_HAL_EXCEPTION_MAX - CYGNUM_HAL_EXCEPTION_MIN + 1 ) +#include CYGBLD_HAL_VAR_INTR_MODEL_H #ifndef __ASSEMBLER__ @@ -390,66 +284,6 @@ externC void hal_interrupt_configure(int #define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) \ hal_interrupt_configure(_vector_, _level_, _up_); -//-------------------------------------------------------------------------- -// Clock control, using TMU counter 0. - -#define HAL_CLOCK_INITIALIZE( _period_ ) \ - CYG_MACRO_START \ - register cyg_uint8 _tstr_; \ - \ - /* Disable timer while programming it. */ \ - HAL_READ_UINT8(CYGARC_REG_TSTR, _tstr_); \ - _tstr_ &= ~CYGARC_REG_TSTR_STR0; \ - HAL_WRITE_UINT8(CYGARC_REG_TSTR, _tstr_); \ - \ - /* Set counter registers. */ \ - HAL_WRITE_UINT32(CYGARC_REG_TCOR0, (_period_)); \ - HAL_WRITE_UINT32(CYGARC_REG_TCNT0, (_period_)); \ - \ - /* Set interrupt on underflow and decrement frequency */ \ - HAL_WRITE_UINT16(CYGARC_REG_TCR0, CYGARC_REG_TCR_UNIE | \ - ((4==CYGHWR_HAL_SH_TMU_PRESCALE_0) ? \ - CYGARC_REG_TCR_TPSC_4 : \ - (16==CYGHWR_HAL_SH_TMU_PRESCALE_0) ? \ - CYGARC_REG_TCR_TPSC_16: \ - (64==CYGHWR_HAL_SH_TMU_PRESCALE_0) ? \ - CYGARC_REG_TCR_TPSC_64:CYGARC_REG_TCR_TPSC_256)); \ - \ - \ - /* Enable timer. */ \ - _tstr_ |= CYGARC_REG_TSTR_STR0; \ - HAL_WRITE_UINT8(CYGARC_REG_TSTR, _tstr_); \ - \ - CYG_MACRO_END - -#define HAL_CLOCK_RESET( _vector_, _period_ ) \ - CYG_MACRO_START \ - register cyg_uint16 _tcr_; \ - \ - /* Clear underflow flag. */ \ - HAL_READ_UINT16(CYGARC_REG_TCR0, _tcr_); \ - _tcr_ &= ~CYGARC_REG_TCR_UNF; \ - HAL_WRITE_UINT16(CYGARC_REG_TCR0, _tcr_); \ - HAL_READ_UINT16(CYGARC_REG_TCR0, _tcr_); \ - \ - CYG_MACRO_END - -#define HAL_CLOCK_READ( _pvalue_ ) \ - CYG_MACRO_START \ - register cyg_uint32 _result_; \ - \ - HAL_READ_UINT32(CYGARC_REG_TCNT0, _result_); \ - \ - *(_pvalue_) = CYGNUM_KERNEL_COUNTERS_RTC_PERIOD-_result_; \ - CYG_MACRO_END - -#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY -#define HAL_CLOCK_LATENCY( _pvalue_ ) HAL_CLOCK_READ(_pvalue_) -#endif - -extern void hal_delay_us(int); -#define HAL_DELAY_US(n) hal_delay_us(n) - #endif // __ASSEMBLER__ //-------------------------------------------------------------------------- diff --git a/packages/hal/sh/arch/current/include/hal_intr_excevt.h b/packages/hal/sh/arch/current/include/hal_intr_excevt.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/arch/current/include/hal_intr_excevt.h @@ -0,0 +1,255 @@ +#ifndef CYGONCE_HAL_INTR_EXCEVT_H +#define CYGONCE_HAL_INTR_EXCEVT_H + +//========================================================================== +// +// hal_intr_excevt.h +// +// HAL Interrupt and clock support for variants with EXCEVT style +// exception/interrupt mapping (SH3, SH4) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov, +// Date: 1999-04-24 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock. +// +// Usage: Is included from +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +//-------------------------------------------------------------------------- +// SH exception vectors. These correspond to VSRs and are the values +// to use for HAL_VSR_GET/SET +// +// Note that exceptions are decoded - there is a VSR slot for each exception +// source, while interrupts are handled via the same VSR. + +#define CYGNUM_HAL_VECTOR_POWERON 0 // power-on +#define CYGNUM_HAL_VECTOR_RESET 1 // reset +#define CYGNUM_HAL_VECTOR_TLBMISS_ACCESS 2 // TLB-miss/invalid load +#define CYGNUM_HAL_VECTOR_TLBMISS_WRITE 3 // TLB-miss/invalid store +#define CYGNUM_HAL_VECTOR_INITIAL_WRITE 4 // initial page write +#define CYGNUM_HAL_VECTOR_TLBERROR_ACCESS 5 // TLB prot violation l +#define CYGNUM_HAL_VECTOR_TLBERROR_WRITE 6 // TLB prot violation s +#define CYGNUM_HAL_VECTOR_DATA_ACCESS 7 // address error (load) +#define CYGNUM_HAL_VECTOR_DATA_WRITE 8 // address error (store) +// RESERVED 9-10 +#define CYGNUM_HAL_VECTOR_TRAP 11 // unconditional trap +#define CYGNUM_HAL_VECTOR_ILLEGAL_INSTRUCTION 12 // reserved instruction +#define CYGNUM_HAL_VECTOR_ILLEGAL_SLOT_INSTRUCTION 13 + // illegal instruction in delay slot +#define CYGNUM_HAL_VECTOR_NMI 14 // NMI +#define CYGNUM_HAL_VECTOR_INSTRUCTION_BP 15 // user breakpoint + +#define CYGNUM_HAL_VECTOR_INTERRUPT 16 // all interrupts + +#ifndef CYG_VECTOR_IS_INTERRUPT +# define CYG_VECTOR_IS_INTERRUPT(v) (CYGNUM_HAL_VECTOR_INSTRUCTION_BP < (v)) +#endif + +#define CYGNUM_HAL_VSR_MIN CYGNUM_HAL_VECTOR_POWERON +#ifndef CYGNUM_HAL_VSR_MAX +# define CYGNUM_HAL_VSR_MAX CYGNUM_HAL_VECTOR_INTERRUPT +#endif +#define CYGNUM_HAL_VSR_COUNT ( CYGNUM_HAL_VSR_MAX + 1 ) + +#ifndef CYGNUM_HAL_VSR_EXCEPTION_COUNT +# define CYGNUM_HAL_VSR_EXCEPTION_COUNT (CYGNUM_HAL_VECTOR_INSTRUCTION_BP-CYGNUM_HAL_VECTOR_POWERON+1) +#endif + +// For the stub exception handling +#define _CYGNUM_HAL_VECTOR_FIRST_MEM_FAULT CYGNUM_HAL_EXCEPTION_TLBMISS_ACCESS +#define _CYGNUM_HAL_VECTOR_LAST_MEM_FAULT CYGNUM_HAL_EXCEPTION_DATA_WRITE + +// The decoded interrupts. +#define CYGNUM_HAL_INTERRUPT_NMI 0 +#define CYGNUM_HAL_INTERRUPT_RESERVED_1E0 1 +#define CYGNUM_HAL_INTERRUPT_LVL0 2 +#define CYGNUM_HAL_INTERRUPT_LVL1 3 +#define CYGNUM_HAL_INTERRUPT_LVL2 4 +#define CYGNUM_HAL_INTERRUPT_LVL3 5 +#define CYGNUM_HAL_INTERRUPT_LVL4 6 +#define CYGNUM_HAL_INTERRUPT_LVL5 7 +#define CYGNUM_HAL_INTERRUPT_LVL6 8 +#define CYGNUM_HAL_INTERRUPT_LVL7 9 +#define CYGNUM_HAL_INTERRUPT_LVL8 10 +#define CYGNUM_HAL_INTERRUPT_LVL9 11 +#define CYGNUM_HAL_INTERRUPT_LVL10 12 +#define CYGNUM_HAL_INTERRUPT_LVL11 13 +#define CYGNUM_HAL_INTERRUPT_LVL12 14 +#define CYGNUM_HAL_INTERRUPT_LVL13 15 +#define CYGNUM_HAL_INTERRUPT_LVL14 16 +#define CYGNUM_HAL_INTERRUPT_RESERVED_3E0 17 +#define CYGNUM_HAL_INTERRUPT_TMU0_TUNI0 18 +#define CYGNUM_HAL_INTERRUPT_TMU1_TUNI1 19 +#define CYGNUM_HAL_INTERRUPT_TMU2_TUNI2 20 +#define CYGNUM_HAL_INTERRUPT_TMU2_TICPI2 21 +#define CYGNUM_HAL_INTERRUPT_RTC_ATI 22 +#define CYGNUM_HAL_INTERRUPT_RTC_PRI 23 +#define CYGNUM_HAL_INTERRUPT_RTC_CUI 24 +#define CYGNUM_HAL_INTERRUPT_SCI_ERI 25 +#define CYGNUM_HAL_INTERRUPT_SCI_RXI 26 +#define CYGNUM_HAL_INTERRUPT_SCI_TXI 27 +#define CYGNUM_HAL_INTERRUPT_SCI_TEI 28 +#define CYGNUM_HAL_INTERRUPT_WDT_ITI 29 +#define CYGNUM_HAL_INTERRUPT_REF_RCMI 30 +#define CYGNUM_HAL_INTERRUPT_REF_ROVI 31 + +#ifndef CYGNUM_HAL_ISR_MAX +# define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_INTERRUPT_REF_ROVI +#endif + +#define CYGNUM_HAL_ISR_MIN CYGNUM_HAL_INTERRUPT_NMI +#define CYGNUM_HAL_ISR_COUNT ( CYGNUM_HAL_ISR_MAX - CYGNUM_HAL_ISR_MIN + 1 ) + +// The vector used by the Real time clock +#ifndef CYGNUM_HAL_INTERRUPT_RTC +# define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_TMU0_TUNI0 +#endif + +//-------------------------------------------------------------------------- +// Exception vectors. These are the values used when passed out to an +// external exception handler using cyg_hal_deliver_exception() + +// The exception indexes are EXPEVT/0x20. Variants may define additional +// exception vectors. + +#define CYGNUM_HAL_EXCEPTION_POWERON 0 // power-on +#define CYGNUM_HAL_EXCEPTION_RESET 1 // reset +#define CYGNUM_HAL_EXCEPTION_TLBMISS_ACCESS 2 // TLB-miss/invalid load +#define CYGNUM_HAL_EXCEPTION_TLBMISS_WRITE 3 // TLB-miss/invalid store +#define CYGNUM_HAL_EXCEPTION_INITIAL_WRITE 4 // initial page write +#define CYGNUM_HAL_EXCEPTION_TLBERROR_ACCESS 5 // TLB prot violation l +#define CYGNUM_HAL_EXCEPTION_TLBERROR_WRITE 6 // TLB prot violation s +#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS 7 // address error (load) +#define CYGNUM_HAL_EXCEPTION_DATA_WRITE 8 // address error (store) +#define CYGNUM_HAL_EXCEPTION_TRAP 11 // unconditional trap +#define CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION 12 // reserved instruction +#define CYGNUM_HAL_EXCEPTION_ILLEGAL_SLOT_INSTRUCTION 13 + // illegal instruction in delay slot +#define CYGNUM_HAL_EXCEPTION_INSTRUCTION_BP 15 // user breakpoint + +#define CYGNUM_HAL_EXCEPTION_MIN CYGNUM_HAL_EXCEPTION_POWERON + +#ifndef CYGNUM_HAL_EXCEPTION_MAX +# define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_EXCEPTION_INSTRUCTION_BP +#endif + +#define CYGNUM_HAL_EXCEPTION_COUNT \ + ( CYGNUM_HAL_EXCEPTION_MAX - CYGNUM_HAL_EXCEPTION_MIN + 1 ) + +#ifndef __ASSEMBLER__ + +#include + +#include // register definitions +#include // io macros +#include // CYG_FAIL + +//-------------------------------------------------------------------------- +// Clock control, using TMU counter 0. + +#define CYGHWR_SH_RTC_TIMER_IS_TMU + +#define HAL_CLOCK_INITIALIZE( _period_ ) \ + CYG_MACRO_START \ + register cyg_uint8 _tstr_; \ + \ + /* Disable timer while programming it. */ \ + HAL_READ_UINT8(CYGARC_REG_TSTR, _tstr_); \ + _tstr_ &= ~CYGARC_REG_TSTR_STR0; \ + HAL_WRITE_UINT8(CYGARC_REG_TSTR, _tstr_); \ + \ + /* Set counter registers. */ \ + HAL_WRITE_UINT32(CYGARC_REG_TCOR0, (_period_)); \ + HAL_WRITE_UINT32(CYGARC_REG_TCNT0, (_period_)); \ + \ + /* Set interrupt on underflow and decrement frequency */ \ + HAL_WRITE_UINT16(CYGARC_REG_TCR0, CYGARC_REG_TCR_UNIE | \ + ((4==CYGHWR_HAL_SH_TMU_PRESCALE_0) ? \ + CYGARC_REG_TCR_TPSC_4 : \ + (16==CYGHWR_HAL_SH_TMU_PRESCALE_0) ? \ + CYGARC_REG_TCR_TPSC_16: \ + (64==CYGHWR_HAL_SH_TMU_PRESCALE_0) ? \ + CYGARC_REG_TCR_TPSC_64:CYGARC_REG_TCR_TPSC_256)); \ + \ + \ + /* Enable timer. */ \ + _tstr_ |= CYGARC_REG_TSTR_STR0; \ + HAL_WRITE_UINT8(CYGARC_REG_TSTR, _tstr_); \ + \ + CYG_MACRO_END + +#define HAL_CLOCK_RESET( _vector_, _period_ ) \ + CYG_MACRO_START \ + register cyg_uint16 _tcr_; \ + \ + /* Clear underflow flag. */ \ + HAL_READ_UINT16(CYGARC_REG_TCR0, _tcr_); \ + _tcr_ &= ~CYGARC_REG_TCR_UNF; \ + HAL_WRITE_UINT16(CYGARC_REG_TCR0, _tcr_); \ + HAL_READ_UINT16(CYGARC_REG_TCR0, _tcr_); \ + \ + CYG_MACRO_END + +#define HAL_CLOCK_READ( _pvalue_ ) \ + CYG_MACRO_START \ + register cyg_uint32 _result_; \ + \ + HAL_READ_UINT32(CYGARC_REG_TCNT0, _result_); \ + \ + *(_pvalue_) = CYGNUM_KERNEL_COUNTERS_RTC_PERIOD-_result_; \ + CYG_MACRO_END + +#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY +#define HAL_CLOCK_LATENCY( _pvalue_ ) HAL_CLOCK_READ(_pvalue_) +#endif + +extern void hal_delay_us(int); +#define HAL_DELAY_US(n) hal_delay_us(n) + +#endif // __ASSEMBLER__ + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_INTR_EXCEVT_H +// End of hal_intr_excevt.h diff --git a/packages/hal/sh/arch/current/include/hal_intr_vecs.h b/packages/hal/sh/arch/current/include/hal_intr_vecs.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/arch/current/include/hal_intr_vecs.h @@ -0,0 +1,180 @@ +#ifndef CYGONCE_HAL_INTR_VECS_H +#define CYGONCE_HAL_INTR_VECS_H + +//========================================================================== +// +// hal_intr_vecs.h +// +// HAL Interrupt support for variants with vectored style +// exception/interrupt mapping (SH1/SH2) +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2002-01-15 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts. +// +// Usage: Is included from +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +//-------------------------------------------------------------------------- +// SH exception vectors. These correspond to VSRs and are the values +// to use for HAL_VSR_GET/SET +// +// Note that exceptions are decoded - there is a VSR slot for each exception +// source, while interrupts are handled via the same VSR. +// +// The SH2 vectors are set up to provide exception/interrupt behavior +// much like that found in the SH3/SH4 CPUs. See hal_var_sp.inc for +// implementation details. +// +// While there are 256 vectors, we only reserve space for 64 VSRs. +// With TRAPs and Interrupts wired to VSRs 32+33, there's still plenty +// of free VSRs for use by the application. + +#define CYGNUM_HAL_VECTOR_POWERON 0 // power-on +// RESERVED 1 +#define CYGNUM_HAL_VECTOR_RESET 2 // reset +// RESERVED 3 +#define CYGNUM_HAL_VECTOR_ILLEGAL_INSTRUCTION 4 // reserved instruction +// RESERVED 5 +#define CYGNUM_HAL_VECTOR_ILLEGAL_SLOT_INSTRUCTION 6 + // illegal instruction in delay slot +// RESERVED 7-8 +#define CYGNUM_HAL_VECTOR_CPU_ADDRESS_ERROR 9 // CPU address error +#define CYGNUM_HAL_VECTOR_DMA_ADDRESS_ERROR 10 // DMA address error +//#define CYGNUM_HAL_VECTOR_NMI 11 // This gets mapped as irq 0 +#define CYGNUM_HAL_VECTOR_USER_BREAK 12 // user breakpoint +#define CYGNUM_HAL_VECTOR_H_UDI 13 // H-UDI +// RESERVED 14-31 +#define CYGNUM_HAL_VECTOR_TRAP 32 // user breakpoint +#define CYGNUM_HAL_VECTOR_INTERRUPT 33 // all interrupts + +#ifndef CYG_VECTOR_IS_INTERRUPT +# define CYG_VECTOR_IS_INTERRUPT(v) (CYGNUM_HAL_VECTOR_INTERRUPT == (v)) +#endif + +#define CYGNUM_HAL_VSR_MIN CYGNUM_HAL_VECTOR_POWERON +#ifndef CYGNUM_HAL_VSR_MAX +# define CYGNUM_HAL_VSR_MAX 63 +#endif +#define CYGNUM_HAL_VSR_COUNT ( CYGNUM_HAL_VSR_MAX + 1 ) + +#ifndef CYGNUM_HAL_VSR_EXCEPTION_COUNT +# define CYGNUM_HAL_VSR_EXCEPTION_COUNT (CYGNUM_HAL_VECTOR_TRAP-CYGNUM_HAL_VECTOR_POWERON+1) +#endif + +// The decoded interrupts. +#define CYGNUM_HAL_INTERRUPT_NMI 0 +// These are equivalent to HW_EXC vectors 64 and up +#define CYGNUM_HAL_INTERRUPT_HW_EXC_BASE 64 +#define CYGNUM_HAL_INTERRUPT_LVL0 1 // note that LVLx and IRQx share vectors! +#define CYGNUM_HAL_INTERRUPT_IRQ_IRQ0 1 +#define CYGNUM_HAL_INTERRUPT_LVL1 2 +#define CYGNUM_HAL_INTERRUPT_IRQ_IRQ1 2 +#define CYGNUM_HAL_INTERRUPT_LVL2 3 +#define CYGNUM_HAL_INTERRUPT_IRQ_IRQ2 3 +#define CYGNUM_HAL_INTERRUPT_LVL3 4 +#define CYGNUM_HAL_INTERRUPT_IRQ_IRQ3 4 +#define CYGNUM_HAL_INTERRUPT_LVL4 5 +#define CYGNUM_HAL_INTERRUPT_IRQ_IRQ4 5 +#define CYGNUM_HAL_INTERRUPT_LVL5 6 +#define CYGNUM_HAL_INTERRUPT_IRQ_IRQ5 6 +#define CYGNUM_HAL_INTERRUPT_LVL6 7 +#define CYGNUM_HAL_INTERRUPT_IRQ_IRQ6 7 +#define CYGNUM_HAL_INTERRUPT_LVL7 8 +#define CYGNUM_HAL_INTERRUPT_IRQ_IRQ7 8 + +#ifndef CYGNUM_HAL_INTERRUPT_LVL_MAX +# define CYGNUM_HAL_INTERRUPT_LVL_MAX CYGNUM_HAL_INTERRUPT_LVL7 +#endif + +#ifndef CYGNUM_HAL_ISR_MAX +# define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_INTERRUPT_IRQ_IRQ7 +#endif + +#define CYGNUM_HAL_ISR_MIN CYGNUM_HAL_INTERRUPT_NMI +#define CYGNUM_HAL_ISR_COUNT ( CYGNUM_HAL_ISR_MAX - CYGNUM_HAL_ISR_MIN + 1 ) + +//-------------------------------------------------------------------------- +// Exception vectors. These are the values used when passed out to an +// external exception handler using cyg_hal_deliver_exception() + +// The exception indexes are given by the HW_EXC vectors. Variants may define additional +// exception vectors. + +#define CYGNUM_HAL_EXCEPTION_POWERON 0 // power-on +#define CYGNUM_HAL_EXCEPTION_RESET 2 // reset +#define CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION 4 // illegal instruction +#define CYGNUM_HAL_EXCEPTION_ILLEGAL_SLOT_INSTRUCTION 6 // illegal instruction in the slot +#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS 9 // CPU address error +#define CYGNUM_HAL_EXCEPTION_DMA_DATA_ACCESS 10 // DMA address error +#define CYGNUM_HAL_EXCEPTION_USER_BREAK 12 // user break +#define CYGNUM_HAL_EXCEPTION_H_UDI 13 // H-UDI +#define CYGNUM_HAL_EXCEPTION_TRAP 32 // unconditional trap + +#define CYGNUM_HAL_EXCEPTION_MIN CYGNUM_HAL_EXCEPTION_POWERON + +#ifndef CYGNUM_HAL_EXCEPTION_MAX +# define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_EXCEPTION_TRAP +#endif + +#define CYGNUM_HAL_EXCEPTION_COUNT \ + ( CYGNUM_HAL_EXCEPTION_MAX - CYGNUM_HAL_EXCEPTION_MIN + 1 ) + +// For the stub exception handling +#define _CYGNUM_HAL_VECTOR_FIRST_MEM_FAULT CYGNUM_HAL_EXCEPTION_DATA_ACCESS +#define _CYGNUM_HAL_VECTOR_LAST_MEM_FAULT CYGNUM_HAL_EXCEPTION_DMA_DATA_ACCESS + +#ifndef __ASSEMBLER__ + +#include + +extern void hal_delay_us(int); +#define HAL_DELAY_US(n) hal_delay_us(n) + +#endif // __ASSEMBLER__ + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_INTR_VECS_H +// End of hal_intr_vecs.h diff --git a/packages/hal/sh/arch/current/include/hal_io.h b/packages/hal/sh/arch/current/include/hal_io.h --- a/packages/hal/sh/arch/current/include/hal_io.h +++ b/packages/hal/sh/arch/current/include/hal_io.h @@ -8,29 +8,38 @@ // HAL device IO register support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/arch/current/include/hal_var_bank.h b/packages/hal/sh/arch/current/include/hal_var_bank.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/arch/current/include/hal_var_bank.h @@ -0,0 +1,160 @@ +#ifndef CYGONCE_HAL_VAR_BANK_H +#define CYGONCE_HAL_VAR_BANK_H +//============================================================================= +// +// hal_var_bank.h +// +// Architecture abstractions for variants with banked registers +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-11 +// Purpose: Architecture abstractions for variants with banked registers +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//----------------------------------------------------------------------------- +// Processor saved states: + +typedef struct +{ + // These are common to all saved states + cyg_uint32 r[16]; // Data regs + cyg_uint32 macl; // Multiply and accumulate - low + cyg_uint32 mach; // Multiply and accumulate - high + cyg_uint32 pr; // Procedure Reg + cyg_uint32 sr; // Status Reg + cyg_uint32 pc; // Program Counter + + // This marks the limit of state saved during a context switch and + // is used to calculate necessary stack allocation for context switches. + // It would probably be better to have a union instead... + cyg_uint32 context_size[0]; + + // These are only saved on interrupts + cyg_uint32 vbr; // Vector Base Register + cyg_uint32 gbr; // Global Base Register + + // These are only saved on interrupts + cyg_uint32 event; // EXCEVT or INTEVT +} HAL_SavedRegisters; + +//----------------------------------------------------------------------------- +// Context Initialization +// Initialize the context of a thread. +// Arguments: +// _sparg_ name of variable containing current sp, will be written with new sp +// _thread_ thread object address, passed as argument to entry point +// _entry_ entry point address. +// _id_ bit pattern used in initializing registers, for debugging. + +#define HAL_THREAD_INIT_CONTEXT( _sparg_, _thread_, _entry_, _id_ ) \ + CYG_MACRO_START \ + register HAL_SavedRegisters *_regs_; \ + int _i_; \ + _regs_ = (HAL_SavedRegisters *)((_sparg_) - sizeof(HAL_SavedRegisters)); \ + for( _i_ = 0; _i_ < 16; _i_++ ) (_regs_)->r[_i_] = (_id_)|_i_; \ + (_regs_)->r[15] = (CYG_WORD)(_regs_); /* SP = top of stack */ \ + (_regs_)->r[04] = (CYG_WORD)(_thread_); /* R4 = arg1 = thread ptr */ \ + (_regs_)->mach = 0; /* MACH = 0 */ \ + (_regs_)->macl = 0; /* MACL = 0 */ \ + (_regs_)->pr = (CYG_WORD)(_entry_); /* PR = entry point */ \ + (_regs_)->sr = 0; /* SR = enable interrupts */ \ + (_regs_)->pc = (CYG_WORD)(_entry_); /* set PC for thread dbg */ \ + _sparg_ = (CYG_ADDRESS)_regs_; \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- +// Thread register state manipulation for GDB support. + +// Translate a stack pointer as saved by the thread context macros above into +// a pointer to a HAL_SavedRegisters structure. +#define HAL_THREAD_GET_SAVED_REGISTERS( _sp_, _regs_ ) \ + (_regs_) = (HAL_SavedRegisters *)(_sp_) + +// Copy a set of registers from a HAL_SavedRegisters structure into a +// GDB ordered array. +#define HAL_GET_GDB_REGISTERS( _aregval_, _regs_ ) \ + CYG_MACRO_START \ + CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ + int _i_; \ + \ + for( _i_ = 0; _i_ < 16; _i_++ ) \ + _regval_[_i_] = (_regs_)->r[_i_]; \ + \ + _regval_[16] = (_regs_)->pc; \ + _regval_[17] = (_regs_)->pr; \ + _regval_[18] = (_regs_)->gbr; \ + _regval_[19] = (_regs_)->vbr; \ + _regval_[20] = (_regs_)->mach; \ + _regval_[21] = (_regs_)->macl; \ + _regval_[22] = (_regs_)->sr; \ + \ + /* 23-51 not used atm. */ \ + CYG_MACRO_END + +// Copy a GDB ordered array into a HAL_SavedRegisters structure. +#define HAL_SET_GDB_REGISTERS( _regs_ , _aregval_ ) \ + CYG_MACRO_START \ + CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ + int _i_; \ + \ + for( _i_ = 0; _i_ < 16; _i_++ ) \ + (_regs_)->r[_i_] = _regval_[_i_]; \ + \ + (_regs_)->pc = _regval_[16]; \ + (_regs_)->pr = _regval_[17]; \ + (_regs_)->gbr = _regval_[18]; \ + (_regs_)->vbr = _regval_[19]; \ + (_regs_)->mach = _regval_[20]; \ + (_regs_)->macl = _regval_[21]; \ + (_regs_)->sr = _regval_[22]; \ + CYG_MACRO_END + +//-------------------------------------------------------------------------- +// CPU address space translation macros +#define CYGARC_BUS_ADDRESS(x) ((CYG_ADDRWORD)(x) & 0x1fffffff) +#define CYGARC_CACHED_ADDRESS(x) (CYGARC_BUS_ADDRESS(x)|0x80000000) +#define CYGARC_UNCACHED_ADDRESS(x) (CYGARC_BUS_ADDRESS(x)|0xa0000000) + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_VAR_BANK_H +// End of hal_var_bank.h diff --git a/packages/hal/sh/arch/current/include/hal_var_bank.inc b/packages/hal/sh/arch/current/include/hal_var_bank.inc new file mode 100644 --- /dev/null +++ b/packages/hal/sh/arch/current/include/hal_var_bank.inc @@ -0,0 +1,325 @@ +##========================================================================== +## +## hal_var_bank.inc +## +## SH support code for variants using register banks +## +##========================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##========================================================================== +#######DESCRIPTIONBEGIN#### +## +## Author(s): jskov +## Contributors: jskov +## Date: 2002-01-11 +## Purpose: SH support code for variants using register banks +## +######DESCRIPTIONEND#### +## +##========================================================================== + +#--------------------------------------------------------------------------- +# The models with banked registers jump directly to code without storing +# anything on the stack. Instead, the CPU switches to use banked registers +# leaving initial saving of state to the VSRs. + +# reset 0xa0000000 +# other exceptions VBR+0x100 +# tlb miss VBR+0x400 +# interrupts VBR+0x600 + + +#=========================================================================== +# Reset code must be PC relative so it can be executed out of the shadow +# area during startup. Not until after hal_hardware_init can the system +# be expected to provide the proper address space (at that time we +# jump to the VMA base of the code). + + .org 0x000 +FUNC_START(_reset) + mov.l $_reset_platform,r0 + jmp @r0 + nop + +# Note: this is the unmapped, shadow address of the start of code +# Sadly, it is too far to just branch to. + .align 2 +$_reset_platform: +#ifdef CYG_HAL_STARTUP_RAM + .long CYG_LABEL_DEFN(_reset_platform) +#elif defined(CYG_HAL_STARTUP_ROMRAM) + // Uncached "shadow" address but adjusted for VMA/LMA differences + .long __reset_platform+0x20000000-CYGMEM_REGION_ram+CYGMEM_REGION_rom +#else + // Uncached "shadow" address + .long CYG_LABEL_DEFN(_reset_platform)+0x20000000 +#endif + +#--------------------------------------------------------------------------- +# Exception entry + + .org 0x100 +__exception: + +#if defined(CYGPKG_KERNEL_INSTRUMENT) && defined(CYGDBG_KERNEL_INSTRUMENT_INTR) + mov #1,r7 +#endif + + mov.l $nCYGARC_REG_EXCEVT2,r1 + mov.l @r1,r1 + shlr2 r1 + shlr r1 ! divide cause by 0x08 + mov.l $hal_vsr_table2,r0 + mov.l @(r0,r1),r1 + jmp @r1 + nop + + .align 2 + SYM_PTR_REFn(hal_vsr_table,2) + +#--------------------------------------------------------------------------- +# TLB miss entry + + .org 0x400 +__tlb_miss: +#if defined(CYGPKG_KERNEL_INSTRUMENT) && defined(CYGDBG_KERNEL_INSTRUMENT_INTR) + mov #2,r7 +#endif + + mov.l $nCYGARC_REG_EXCEVT2,r1 + mov.l @r1,r1 + shlr2 r1 + shlr r1 ! divide cause by 0x08 + mov.l $hal_vsr_table3,r0 + mov.l @(r0,r1),r1 + jmp @r1 + nop + + .align 2 + SYM_PTR_REFn(hal_vsr_table,3) +$nCYGARC_REG_EXCEVT2: + .long CYGARC_REG_EXCEVT + +#--------------------------------------------------------------------------- +# Interrupt entry + + .org 0x600 +__interrupt: + +#ifdef CYGHWR_HAL_SH_IRQ_HANDLE_SPURIOUS_INTERRUPTS + # A spurious interrupt with INTEVT=0 may be caused by + # clearing of BL. Those interrupts need to be ignored. + mov.l 1f,r0 + mov.l @r0,r0 + cmp/eq #0,r0 + bf 2f + rte + nop + .align 2 +1: .long CYGARC_REG_INTEVT +2: +#endif + + +#if defined(CYGPKG_KERNEL_INSTRUMENT) && defined(CYGDBG_KERNEL_INSTRUMENT_INTR) + mov #3,r7 +#endif + + mov.l $hal_vsr_table_int,r1 + mov.l @r1,r1 + jmp @r1 + nop + + .align 2 +$hal_vsr_table_int: + .long CYG_LABEL_DEFN(hal_vsr_table)+CYGNUM_HAL_VECTOR_INTERRUPT*4 + + +##============================================================================ +## Macros for saving/restoring register state on an exception. + +#--------------------------------------------------------------------------- +## Save registers on exception: +## At entry: +## r15 is location to be stored to +## r0 is the available scratch register + +## At exit: +## r7 is the vector # +## all other registers (except sp) are available + + .macro hal_cpu_save_regs + + # We come here with all register containing their + # pre-exception values except: + # r0_b-r7_b = saved r0-r7 + # r7 = vector # + # spc = saved pc + # ssr = saved sr + + # Save away some registers + mov r15,r1 ! entry sp +#ifdef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + add #-12,r15 ! Space for cause, gbr, and vbr +#else + add #-4,r15 ! Space for cause + + stc gbr,r0 ! GBR + mov.l r0,@-r15 + stc vbr,r0 ! VBR + mov.l r0,@-r15 +#endif + + stc spc,r0 + mov.l r0,@-r15 ! PC + stc ssr,r0 + mov.l r0,@-r15 ! SR + + sts.l pr,@-r15 ! PR + sts.l mach,@-r15 ! mach + sts.l macl,@-r15 ! macl + + mov.l r1,@-r15 ! entry sp + mov.l r14,@-r15 ! r14-r0 + mov.l r13,@-r15 + mov.l r12,@-r15 + mov.l r11,@-r15 + mov.l r10,@-r15 + mov.l r9,@-r15 + mov.l r8,@-r15 + stc.l r7_bank,@-r15 + stc.l r6_bank,@-r15 + stc.l r5_bank,@-r15 + stc.l r4_bank,@-r15 + stc.l r3_bank,@-r15 + stc.l r2_bank,@-r15 + stc.l r1_bank,@-r15 + stc.l r0_bank,@-r15 + + # After setting the SR it will be possible to use breakpoints. + mov.l 1f,r1 + ldc r1,sr + bra 2f + nop + .align 2 +1: .long CYG_SR + # ------------------------------------------------------------ + # Register bank has changed now. +2: + .endm + + # No additional magic needed. hal_cpu_save_regs does it all. + .macro hal_exception_entry_extras + .endm + .macro hal_interrupt_entry_extras + .endm + +#--------------------------------------------------------------------------- +## Restore registers after exception: +## At entry: +## r15 is location to be loaded from +## all other registers (except sp) are available + +## At exit: +## Returns to interrupted code + + .macro hal_cpu_restore_regs_return + # Disable interrupts and switch register bank during the restore + # operation + mov.l 1f,r1 + ldc r1,sr + # ------------------------------------------------------------ + # Register bank has changed now. + + # + # Single step debugging becomes impossible after this point! + # + mov r15,r0 + ldc.l @r0+,r0_bank + ldc.l @r0+,r1_bank + ldc.l @r0+,r2_bank + ldc.l @r0+,r3_bank + ldc.l @r0+,r4_bank + ldc.l @r0+,r5_bank + ldc.l @r0+,r6_bank + ldc.l @r0+,r7_bank + mov.l @r0+,r8 + mov.l @r0+,r9 + mov.l @r0+,r10 + mov.l @r0+,r11 + mov.l @r0+,r12 + mov.l @r0+,r13 + mov.l @r0+,r14 + mov.l @r0+,r15 ! return SP + + lds.l @r0+,macl ! macl + lds.l @r0+,mach ! mach + lds.l @r0+,pr ! PR + + mov.l @r0+,r2 + ldc r2,ssr ! return SR + mov.l @r0+,r2 + ldc r2,spc ! return PC + +#ifndef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + mov.l @r0+,r2 + ldc r2,vbr ! return VBR + mov.l @r0+,r2 + ldc r2,gbr ! return GBR +#endif + + rte + nop + .align 2 +1: .long CYG_SR_BANK1 + + .endm + +#--------------------------------------------------------------------------- +# Translate cause of exception to a vector number + .macro hal_exception_translate + mov.l 1f,r0 + mov.l @r0,r4 + mov #-5,r0 ! divide cause by 0x20 + shld r0,r4 + mov #CYGARC_SHREG_EVENT,r0 + bra 2f + mov.l r4,@(r0,r15) ! store decoded vector number back + .align 2 +1: .long CYGARC_REG_EXCEVT +2: + .endm + +#--------------------------------------------------------------------------- +# end of hal_var_bank.inc diff --git a/packages/hal/sh/arch/current/include/hal_var_sp.h b/packages/hal/sh/arch/current/include/hal_var_sp.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/arch/current/include/hal_var_sp.h @@ -0,0 +1,165 @@ +#ifndef CYGONCE_HAL_VAR_BANK_H +#define CYGONCE_HAL_VAR_BANK_H +//============================================================================= +// +// hal_var_bank.h +// +// Architecture abstractions for variants without banked registers +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-11 +// Purpose: Architecture abstractions for variants without banked registers +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//----------------------------------------------------------------------------- +// Processor saved states: + +typedef struct +{ + // These are common to all saved states + cyg_uint32 r[16]; // Data regs + cyg_uint32 macl; // Multiply and accumulate - low + cyg_uint32 mach; // Multiply and accumulate - high + cyg_uint32 pr; // Procedure Reg +#if 0 // FIXME: how are these accessed? + cyg_uint32 mod; // Modulo register + cyg_uint32 rs; // Repeat start + cyg_uint32 re; // Repeat end +#endif + cyg_uint32 sr; // Status Reg + cyg_uint32 pc; // Program Counter + + // This marks the limit of state saved during a context switch and + // is used to calculate necessary stack allocation for context switches. + // It would probably be better to have a union instead... + cyg_uint32 context_size[0]; + + // These are only saved on interrupts + cyg_uint32 vbr; // Vector Base Register + cyg_uint32 gbr; // Global Base Register + + // These are only saved on interrupts + cyg_uint32 event; // vector number +} HAL_SavedRegisters; + +//----------------------------------------------------------------------------- +// Context Initialization +// Initialize the context of a thread. +// Arguments: +// _sparg_ name of variable containing current sp, will be written with new sp +// _thread_ thread object address, passed as argument to entry point +// _entry_ entry point address. +// _id_ bit pattern used in initializing registers, for debugging. + +#define HAL_THREAD_INIT_CONTEXT( _sparg_, _thread_, _entry_, _id_ ) \ + CYG_MACRO_START \ + register HAL_SavedRegisters *_regs_; \ + int _i_; \ + _regs_ = (HAL_SavedRegisters *)((_sparg_) - sizeof(HAL_SavedRegisters)); \ + for( _i_ = 0; _i_ < 16; _i_++ ) (_regs_)->r[_i_] = (_id_)|_i_; \ + (_regs_)->r[15] = (CYG_WORD)(_regs_); /* SP = top of stack */ \ + (_regs_)->r[04] = (CYG_WORD)(_thread_); /* R4 = arg1 = thread ptr */ \ + (_regs_)->mach = 0; /* MACH = 0 */ \ + (_regs_)->macl = 0; /* MACL = 0 */ \ + (_regs_)->pr = (CYG_WORD)(_entry_); /* PR = entry point */ \ + (_regs_)->sr = 0; /* SR = enable interrupts */ \ + (_regs_)->pc = (CYG_WORD)(_entry_); /* set PC for thread dbg */ \ + _sparg_ = (CYG_ADDRESS)_regs_; \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- +// Thread register state manipulation for GDB support. + +// Translate a stack pointer as saved by the thread context macros above into +// a pointer to a HAL_SavedRegisters structure. +#define HAL_THREAD_GET_SAVED_REGISTERS( _sp_, _regs_ ) \ + (_regs_) = (HAL_SavedRegisters *)(_sp_) + +// Copy a set of registers from a HAL_SavedRegisters structure into a +// GDB ordered array. +#define HAL_GET_GDB_REGISTERS( _aregval_, _regs_ ) \ + CYG_MACRO_START \ + CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ + int _i_; \ + \ + for( _i_ = 0; _i_ < 16; _i_++ ) \ + _regval_[_i_] = (_regs_)->r[_i_]; \ + \ + _regval_[16] = (_regs_)->pc; \ + _regval_[17] = (_regs_)->pr; \ + _regval_[18] = (_regs_)->gbr; \ + _regval_[19] = (_regs_)->vbr; \ + _regval_[20] = (_regs_)->mach; \ + _regval_[21] = (_regs_)->macl; \ + _regval_[22] = (_regs_)->sr; \ + \ + /* 23-51 not used atm. */ \ + CYG_MACRO_END + +// Copy a GDB ordered array into a HAL_SavedRegisters structure. +#define HAL_SET_GDB_REGISTERS( _regs_ , _aregval_ ) \ + CYG_MACRO_START \ + CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ + int _i_; \ + \ + for( _i_ = 0; _i_ < 16; _i_++ ) \ + (_regs_)->r[_i_] = _regval_[_i_]; \ + \ + (_regs_)->pc = _regval_[16]; \ + (_regs_)->pr = _regval_[17]; \ + (_regs_)->gbr = _regval_[18]; \ + (_regs_)->vbr = _regval_[19]; \ + (_regs_)->mach = _regval_[20]; \ + (_regs_)->macl = _regval_[21]; \ + (_regs_)->sr = _regval_[22]; \ + CYG_MACRO_END + +//-------------------------------------------------------------------------- +// CPU address space translation macros +#define CYGARC_BUS_ADDRESS(x) ((CYG_ADDRWORD)(x) & 0x1fffffff) +#define CYGARC_CACHED_ADDRESS(x) (CYGARC_BUS_ADDRESS(x)|0x00000000) +#define CYGARC_UNCACHED_ADDRESS(x) (CYGARC_BUS_ADDRESS(x)|0x20000000) + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_VAR_BANK_H +// End of hal_var_bank.h diff --git a/packages/hal/sh/arch/current/include/hal_var_sp.inc b/packages/hal/sh/arch/current/include/hal_var_sp.inc new file mode 100644 --- /dev/null +++ b/packages/hal/sh/arch/current/include/hal_var_sp.inc @@ -0,0 +1,379 @@ +##========================================================================== +## +## hal_var_sp.inc +## +## SH support code for variants using stack at exception entry +## +##========================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##========================================================================== +#######DESCRIPTIONBEGIN#### +## +## Author(s): jskov +## Contributors: jskov +## Date: 2002-01-11 +## Purpose: SH support code for variants using stack at exception entry +## +######DESCRIPTIONEND#### +## +##========================================================================== + +#include +#include + +## This is the address of the reset entry + +#if defined(CYG_HAL_STARTUP_RAM) || defined(CYGARC_SH_MOD_CAC_NO_WINDOWS) + // No translation if RAM startup, or if the variant does not + // have cached/non-cached windows in the address space. +# define _RESET_ENTRY CYG_LABEL_DEFN(_reset_platform) +#elif defined(CYG_HAL_STARTUP_ROMRAM) + // Uncached "shadow" address but adjusted for VMA/LMA differences +# define _RESET_ENTRY __reset_platform+0x20000000-CYGMEM_REGION_ram+CYGMEM_REGION_rom +#else + // Uncached "shadow" address +# define _RESET_ENTRY CYG_LABEL_DEFN(_reset_platform)+0x20000000 +#endif + +#if !defined(CYG_HAL_STARTUP_RAM) || !defined(CYGSEM_HAL_USE_ROM_MONITOR) + +## This is the table of HW_EXC_ENTRY pointers fetched from by the CPU +## on an exception. They point to pre-VSR handlers (below) which prep +## R0 with the vector number (which, AFAICT, there''s no other way +## to find) before calling the VSR. +## Note that this takes up a massive 4KiB so it should only be included +## when really needed (that is, when not relying on RedBoot to provide +## it). + + .align 2 +FUNC_START(_HW_EXC_ENTRY_TABLE) +# Power-on reset entry address and stack + .long _RESET_ENTRY + .long 0 +# Manual reset entry address and stack + .long _RESET_ENTRY + .long 0 +# All the other vectors + .set vecno, 0 + .rept (256-4) + .long $vectors_code+(vecno)*16 + .set vecno, vecno+1 + .endr + +## The piece of code pointed to by the HW_EXC table. Each vector +## has such a piece of code, which saves R0 on the stack, fetches +## the VSR pointer and loads the vector number into R0. +## +## Note the three variants: +## exception_vector: maps the HW_EXC vector to the same eCos HAL_VECTOR +## exception_vector_trap: maps the HW_EXC vector to the eCos HAL_VECTOR_TRAP +## exception_vector_int: maps the HW_EXC vector to the eCos HAL_VECTOR_INTERRUPT +## +## With these we translate the SH2 vector style exceptions to something more +## like the SH3/SH4 style: +## +## HW vectors eCos vectors +## 00-31 0-31 Various exceptions +## 32-63 32 TRAP +## 64-255 33 Interrupt +## 34-63 Free for application +## +## This allows the VSR table to be reduced to 1/4 of the size, and eases +## code sharing with the SH3/SH4 variants without any real loss of power. +## + .macro exception_vector vec + mov.l r0,@-r15 + mov.l 1f,r0 + mov.l @r0,r0 + jmp @r0 + mov #\vec,r0 + .align 2 +1: .long CYG_LABEL_DEFN(hal_vsr_table)+4*\vec + .endm + + .macro exception_vector_trap vec + mov.l r0,@-r15 + mov.l 1f,r0 + mov.l @r0,r0 + jmp @r0 + mov #\vec,r0 + .align 2 +1: .long CYG_LABEL_DEFN(hal_vsr_table)+4*CYGNUM_HAL_VECTOR_TRAP + .endm + + # The comment argument is not used for anything. It's just there + # to provide callers a slot for comments (which is not otherwise + # possible when doing multiple invocations on the same line). + .macro exception_vector_int vec,comment + mov.l r0,@-r15 + mov.l 1f,r0 + mov.l @r0,r0 + jmp @r0 + mov #\vec,r0 + .align 2 +1: .long CYG_LABEL_DEFN(hal_vsr_table)+4*CYGNUM_HAL_VECTOR_INTERRUPT + .endm + +# And their entry points +$vectors_code: + exception_vector 4 // general illegal instr + exception_vector 5 // reserved + exception_vector 6 // slot illegal instr + exception_vector 7 // reserved + exception_vector 8 // reserved + exception_vector 9 // CPU address error + exception_vector 10 // DMA address error + exception_vector_int CYGNUM_HAL_INTERRUPT_NMI // NMI + exception_vector 12 // User Break + exception_vector 13 // H-UDI + .set vecno, 14 + .rept (32-14) + exception_vector vecno // reserved + .set vecno, vecno+1 + .endr + .set vecno, 32 + .rept (64-32) + exception_vector_trap vecno // Trap + .set vecno, vecno+1 + .endr + +#ifdef CYGHWR_HAL_SH_SH2_CUSTOM_INTERRUPT_LAYOUT + # Some variants may have a very sparsely populated + # vector table (7044 is an example) which results + # in many unused entries in various interrupt tables. + # To reduce bloat, these may define a custom + # layout of these interrupt decoders - the code + # is to be found in var_intr.h since it's very + # tightly coupled with the interrupt vectors. + CYGHWR_HAL_SH_SH2_CUSTOM_INTERRUPT_LAYOUT +#else + # Note that there''s an entry for vector 0 (NMI) here again + # to avoid having to make hal_interrupt_set_vectors() + # adjust for this off-by-one discrepancy. + .set vecno, CYGNUM_HAL_INTERRUPT_NMI + .rept (256-64) + exception_vector_int vecno // interrupts + .set vecno, vecno+1 + .endr +#endif // CYGHWR_HAL_SH_SH2_CUSTOM_INTERRUPT_LAYOUT + +#endif // !defined(CYG_HAL_STARTUP_RAM) || !defined(CYGSEM_HAL_USE_ROM_MONITOR) + +## For RAM startups, provide a convenient jump to the application start +## at the very start of the image. +FUNC_START(_reset) + mov.l 1f,r0 + jmp @r0 + nop + .align 2 +1: .long _RESET_ENTRY + + +##----------------------------------------------------------------------------- +## Macros for saving/restoring register state on an exception. These +## are generic for all variants, so be careful to not make assumptions. + +## r15 is location stored to/loaded from +## r0 is the available scratch register + +## At exit: +## r7 is the vector # +## all other registers (except sp) are available + +## Furthermore, stack content at this point is + #-- original SP address + # pre-exception SR + # pre-exception PC + # pre-exception r0 + #-- present SP address + + .macro hal_cpu_save_regs + mov.l r0,@-sp ! vector number +#ifdef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + add #-8,sp ! Space for gbr, and vbr +#else + stc gbr,r0 ! GBR + mov.l r0,@-sp + stc vbr,r0 ! VBR + mov.l r0,@-sp +#endif + + add #-8,sp ! Space for entry PC and SR + +#if 0 // FIXME + stc.l re,@-sp ! RE + stc.l rs,@-sp ! RS + stc.l mod,@-sp ! MOD +#endif + sts.l pr,@-sp ! PR + sts.l mach,@-sp ! mach + sts.l macl,@-sp ! macl + + add #-4,sp ! Space for entry sp + mov.l r14,@-sp ! r14-r0 + mov.l r13,@-sp + mov.l r12,@-sp + mov.l r11,@-sp + mov.l r10,@-sp + mov.l r9,@-sp + mov.l r8,@-sp + mov.l r7,@-sp + mov.l r6,@-sp + mov.l r5,@-sp + mov.l r4,@-sp + mov.l r3,@-sp + mov.l r2,@-sp + mov.l r1,@-sp + add #-4,sp ! space for r0 + + ! Compute location of pre-exception r0 and move + ! data from above structure into the structure + mov sp,r1 + add #CYGARC_SH_EXCEPTION_SIZE,r1 + mov.l @r1+,r0 ! pre-exception R0 + mov.l r0,@(CYGARC_SHREG_REGS,sp) + mov.l @r1+,r2 ! pre-exception PC + mov #CYGARC_SHREG_PC,r0 + mov.l r2,@(r0,sp) + mov.l @r1+,r2 ! pre-exception SR + mov #CYGARC_SHREG_SR,r0 + mov.l r2,@(r0,sp) + mov #CYGARC_SHREG_SP,r0 + mov.l r1,@(r0,sp) ! pre-exception SP + ! Load up the vector number + mov #CYGARC_SHREG_EVENT,r0 + mov.l @(r0,sp),r7 + .endm + + .macro hal_exception_entry_extras + # Disable interrupts before anything else + mov.l 1f,r0 + ldc r0,sr + bra 2f + nop + .align 2 +1: .long CYG_SR +2: + .endm + + # No additional magic needed. hal_cpu_save_regs does it all. + .macro hal_interrupt_entry_extras + .endm + +#--------------------------------------------------------------------------- +## Restore registers after exception: +## At entry: +## r15 is location to be loaded from +## all other registers (except sp) are available + +## At exit: +## Returns to interrupted code + + .macro hal_cpu_restore_regs_return + ! Disable interrupts during the restore operation + mov.l 1f,r1 + ldc r1,sr + + ! Move R0/PC/SR values from register structure onto the stack where + ! they''ll be popped from on return. Note that this is the SP as + ! set in the register frame! (otherwise GDB would be unable to change + ! SP). + mov.l @(CYGARC_SHREG_SP,sp),r0 + mov r0,r1 + add #-12,r1 + mov.l @(CYGARC_SHREG_REGS,sp),r0 + mov.l r0,@r1 ! pre-exception R0 + mov #CYGARC_SHREG_PC,r0 + mov.l @(r0,sp),r2 + mov.l r2,@(4,r1) ! pre-exception PC + mov #CYGARC_SHREG_SR,r0 + mov.l @(r0,sp),r2 + mov.l r2,@(8,r1) ! pre-exception SR + + ! Load up registers + add #4,sp ! skip r0 + mov.l @sp+,r1 + mov.l @sp+,r2 + mov.l @sp+,r3 + mov.l @sp+,r4 + mov.l @sp+,r5 + mov.l @sp+,r6 + mov.l @sp+,r7 + mov.l @sp+,r8 + mov.l @sp+,r9 + mov.l @sp+,r10 + mov.l @sp+,r11 + mov.l @sp+,r12 + mov.l @sp+,r13 + mov.l @sp+,r14 + add #4,sp ! skip SP + + lds.l @sp+,macl ! macl + lds.l @sp+,mach ! mach + lds.l @sp+,pr ! PR + +#if 0 // FIXME - also change SP adjustment below! + ldc.l @sp+,re ! RE + ldc.l @sp+,rs ! RS + ldc.l @sp+,mod ! MOD +#endif + add #8,sp ! skip sr and pc + +#ifndef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + mov.l @sp+,r0 + ldc r0,vbr ! return VBR + mov.l @sp+,r0 + ldc r0,gbr ! return GBR +#else + add #8,sp ! skip VBR+GBR +#endif + + add #-8*4,sp ! get to new SP + mov.l @sp,sp + add #-12,sp ! get to exception state + saved r0 + + mov.l @sp+,r0 ! pre-exception r0 + rte + nop + .align 2 +1: .long CYG_SR + .endm + +#--------------------------------------------------------------------------- +# Translate cause of exception to a vector number + .macro hal_exception_translate + .endm + +#--------------------------------------------------------------------------- +# end of hal_var_sp.inc diff --git a/packages/hal/sh/arch/current/include/sh_regs.h b/packages/hal/sh/arch/current/include/sh_regs.h --- a/packages/hal/sh/arch/current/include/sh_regs.h +++ b/packages/hal/sh/arch/current/include/sh_regs.h @@ -7,29 +7,38 @@ // SH CPU definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/arch/current/include/sh_stub.h b/packages/hal/sh/arch/current/include/sh_stub.h --- a/packages/hal/sh/arch/current/include/sh_stub.h +++ b/packages/hal/sh/arch/current/include/sh_stub.h @@ -8,29 +8,38 @@ // SH stub defines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/arch/current/src/context.S b/packages/hal/sh/arch/current/src/context.S --- a/packages/hal/sh/arch/current/src/context.S +++ b/packages/hal/sh/arch/current/src/context.S @@ -5,29 +5,38 @@ ## SH context switch code ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## @@ -119,7 +128,7 @@ FUNC_START(hal_thread_switch_context) # R4 = address of sp of next thread to execute # Note that this function is also the second half of hal_thread_switch_context # and is simply dropped into from it. - + FUNC_START(hal_thread_load_context) mov.l @r4,r0 @@ -146,13 +155,14 @@ FUNC_START(hal_thread_load_context) lds.l @r0+,macl ! macl lds.l @r0+,pr ! pr + mov r3,r15 ! update stack pointer + mov.l @r0+,r2 ! SR hal_cpu_int_merge r2,r0,r1 ! restore interrupt state - mov r3,r15 ! update stack pointer rts ! and return nop - + #------------------------------------------------------------------------------ # HAL longjmp, setjmp implementations # hal_setjmp saves only to callee save registers r8-r13, r14(fp), r15(sp) diff --git a/packages/hal/sh/arch/current/src/hal_misc.c b/packages/hal/sh/arch/current/src/hal_misc.c --- a/packages/hal/sh/arch/current/src/hal_misc.c +++ b/packages/hal/sh/arch/current/src/hal_misc.c @@ -5,29 +5,38 @@ // HAL miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -103,8 +112,8 @@ cyg_hal_exception_handler(HAL_SavedRegis { #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS if (__mem_fault_handler && - ((regs->event >= CYGNUM_HAL_EXCEPTION_TLBMISS_ACCESS) && - (regs->event <= CYGNUM_HAL_EXCEPTION_DATA_WRITE))) { + ((regs->event >= _CYGNUM_HAL_VECTOR_FIRST_MEM_FAULT) && + (regs->event <= _CYGNUM_HAL_VECTOR_LAST_MEM_FAULT))) { regs->pc = (unsigned long)__mem_fault_handler; return; // Caught an exception inside stubs } @@ -194,6 +203,7 @@ hal_idle_thread_action( cyg_uint32 count { } +#ifdef CYGHWR_SH_RTC_TIMER_IS_TMU //--------------------------------------------------------------------------- // Low-level delay (in microseconds) @@ -222,6 +232,7 @@ hal_delay_us(int usecs) } *tstr = _tstr; // Restore timer to previous state } +#endif //--------------------------------------------------------------------------- // End of hal_misc.c diff --git a/packages/hal/sh/arch/current/src/hal_mk_defs.c b/packages/hal/sh/arch/current/src/hal_mk_defs.c --- a/packages/hal/sh/arch/current/src/hal_mk_defs.c +++ b/packages/hal/sh/arch/current/src/hal_mk_defs.c @@ -5,29 +5,38 @@ // HAL (architecture) "make defs" program // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -84,6 +93,7 @@ main(void) DEFINE(CYGARC_SHREG_REGS, offsetof(HAL_SavedRegisters, r[0])); DEFINE(CYGARC_SHREG_MACH, offsetof(HAL_SavedRegisters, mach)); DEFINE(CYGARC_SHREG_MACL, offsetof(HAL_SavedRegisters, macl)); + DEFINE(CYGARC_SHREG_SP, offsetof(HAL_SavedRegisters, r[15])); DEFINE(CYGARC_SHREG_PR, offsetof(HAL_SavedRegisters, pr)); DEFINE(CYGARC_SHREG_SR, offsetof(HAL_SavedRegisters, sr)); DEFINE(CYGARC_SHREG_PC, offsetof(HAL_SavedRegisters, pc)); diff --git a/packages/hal/sh/arch/current/src/hal_syscall.c b/packages/hal/sh/arch/current/src/hal_syscall.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/arch/current/src/hal_syscall.c @@ -0,0 +1,158 @@ +//============================================================================= +// +// hal_syscall.c +// +// +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter, jskov +// Date: 2002-02-28 +// Purpose: +// Description: +// +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include // Our header +#include // HAL_BREAKINST +#include // HAL_xCACHE_x +#include // interrupt disable/restore + +#include // ROM calling interface +#include // Helper functions + +#include + +extern int __do_syscall(int func, // syscall function number + long arg1, long arg2, // up to four args. + long arg3, long arg4, + int *retval, // syscall return value + int *sig); // signal to return (or 0) + +#define _shnewlib_SYS_exit 1 +#define _shnewlib_SYS_fork 2 + +#define _shnewlib_SYS_read 3 +#define _shnewlib_SYS_write 4 +#define _shnewlib_SYS_open 5 +#define _shnewlib_SYS_close 6 +#define _shnewlib_SYS_wait4 7 +#define _shnewlib_SYS_creat 8 +#define _shnewlib_SYS_link 9 +#define _shnewlib_SYS_unlink 10 +#define _shnewlib_SYS_execv 11 +#define _shnewlib_SYS_chdir 12 +#define _shnewlib_SYS_mknod 14 +#define _shnewlib_SYS_chmod 15 +#define _shnewlib_SYS_chown 16 +#define _shnewlib_SYS_lseek 19 +#define _shnewlib_SYS_getpid 20 +#define _shnewlib_SYS_isatty 21 +#define _shnewlib_SYS_fstat 22 +#define _shnewlib_SYS_time 23 + +#define _shnewlib_SYS_ARG 24 +#define _shnewlib_SYS_stat 38 + +#define _shnewlib_SYS_pipe 42 +#define _shnewlib_SYS_execve 59 + +#define _shnewlib_SYS_utime 201 /* not really a system call */ +#define _shnewlib_SYS_wait 202 /* nor is this */ + +int +hal_syscall_handler(void) +{ + int func, arg1, arg2, arg3, arg4; + int err, sig; + + func = get_register(R4); + arg1 = get_register(R5); + arg2 = get_register(R6); + arg3 = get_register(R7); + arg4 = *(unsigned int *)(get_register(SP)); + + switch (func) { + case _shnewlib_SYS_read: + func = SYS_read; + break; + case _shnewlib_SYS_write: + func = SYS_write; + break; + case _shnewlib_SYS_open: + func = SYS_open; + break; + case _shnewlib_SYS_close: + func = SYS_close; + break; + case _shnewlib_SYS_lseek: + func = SYS_lseek; + break; + case _shnewlib_SYS_utime: + func = SYS_utime; + default: + return SIGTRAP; + } + + if (func == SYS_exit) { + // We want to stop in exit so that the user may poke around + // to see why his app exited. + return SIGTRAP; + } + + if (func == SYS_interrupt) { + // A console interrupt landed us here. + // Invoke the debug agent so as to cause a SIGINT. + return SIGINT; + } + + if (__do_syscall(func, arg1, arg2, arg3, arg4, &err, &sig)) { + // R0 is normally result register, but newlib's trap + // code looks in R1 for the return value + put_register(R1, err); + return sig; + } + + return SIGTRAP; +} diff --git a/packages/hal/sh/arch/current/src/redboot_linux_exec.c b/packages/hal/sh/arch/current/src/redboot_linux_exec.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/arch/current/src/redboot_linux_exec.c @@ -0,0 +1,163 @@ +//========================================================================== +// +// redboot_linux_exec.c +// +// RedBoot exec command for Linux booting +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): t@keshi.org +// Contributors: t@keshi.org, jskov +// Date: 2001-06-19 +// Purpose: RedBoot exec command for Linux booting +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +#include + +#include +#include +#include + +#define xstr(s) str(s) +#define str(s...) #s + +struct parmblock { + cyg_uint32 mount_rdonly; + cyg_uint32 ramdisk_flags; + cyg_uint32 orig_root_dev; + cyg_uint32 loader_type; + cyg_uint32 initrd_start; + cyg_uint32 initrd_size; +}; + +static void do_exec(int argc, char *argv[]); +RedBoot_cmd("exec", + "Execute an image", + "[-b ] [-m ]\n" + " [-f ] [-r ] [-l ]\n" + " [-i ] [-j ] [-c \"kernel command line\"]\n" + " []", + do_exec + ); + +static void +do_exec(int argc, char *argv[]) +{ + cyg_uint32 entry = CYGDAT_REDBOOT_SH_LINUX_BOOT_ENTRY; + cyg_uint32 base_addr = CYGDAT_REDBOOT_SH_LINUX_BOOT_BASE_ADDR; + cyg_uint32 mount_rdonly = CYGDAT_REDBOOT_SH_LINUX_BOOT_MOUNT_RDONLY; + cyg_uint32 ramdisk_flags = CYGDAT_REDBOOT_SH_LINUX_BOOT_RAMDISK_FLAGS; + cyg_uint32 orig_root_dev = CYGDAT_REDBOOT_SH_LINUX_BOOT_ORIG_ROOT_DEV; + cyg_uint32 loader_type = CYGDAT_REDBOOT_SH_LINUX_BOOT_LOADER_TYPE; + cyg_uint32 initrd_start = CYGDAT_REDBOOT_SH_LINUX_BOOT_INITRD_START; + cyg_uint32 initrd_size = CYGDAT_REDBOOT_SH_LINUX_BOOT_INITRD_SIZE; + char *cmd_line = xstr(CYGDAT_REDBOOT_SH_LINUX_BOOT_COMMAND_LINE); + + bool base_addr_set, mount_rdonly_set, ramdisk_flags_set; + bool orig_root_dev_set, loader_type_set; + bool initrd_start_set, initrd_size_set, cmd_line_set; + + struct option_info opts[8]; + struct parmblock *pb; + char *pcmd; + int oldints; + + init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, + (void **)&base_addr, &base_addr_set, "base address"); + init_opts(&opts[1], 'm', true, OPTION_ARG_TYPE_NUM, + (void **)&mount_rdonly, &mount_rdonly_set, "mount_rdonly"); + init_opts(&opts[2], 'f', true, OPTION_ARG_TYPE_NUM, + (void **)&ramdisk_flags, &ramdisk_flags_set, "ramdisk_flags"); + init_opts(&opts[3], 'r', true, OPTION_ARG_TYPE_NUM, + (void **)&orig_root_dev, &orig_root_dev_set, "orig_root_dev"); + init_opts(&opts[4], 'l', true, OPTION_ARG_TYPE_NUM, + (void **)&loader_type, &loader_type_set, "loader_type"); + init_opts(&opts[5], 'i', true, OPTION_ARG_TYPE_NUM, + (void **)&initrd_start, &initrd_start_set, "initrd_start"); + init_opts(&opts[6], 'j', true, OPTION_ARG_TYPE_NUM, + (void **)&initrd_size, &initrd_size_set, "initrd_size"); + init_opts(&opts[7], 'c', true, OPTION_ARG_TYPE_STR, + (void **)&cmd_line, &cmd_line_set, "kernel command line"); + + if (!scan_opts(argc, argv, 1, opts, 8, (void *)&entry, + OPTION_ARG_TYPE_NUM, "entry address")) + return; + + diag_printf("Now booting linux kernel:\n"); + diag_printf(" Base address 0x%08x Entry 0x%08x\n", base_addr, entry); + diag_printf(" Cmdline : %s\n", cmd_line); + + HAL_DISABLE_INTERRUPTS(oldints); + HAL_DCACHE_SYNC(); + HAL_ICACHE_DISABLE(); + HAL_DCACHE_DISABLE(); + HAL_DCACHE_SYNC(); + HAL_ICACHE_INVALIDATE_ALL(); + HAL_DCACHE_INVALIDATE_ALL(); + + pb = (struct parmblock *)base_addr; + if (mount_rdonly_set) { + pb->mount_rdonly = mount_rdonly; + diag_printf(" MOUNT_RDONLY : 0x%08x\n", mount_rdonly); + } + if (ramdisk_flags_set) { + pb->ramdisk_flags = ramdisk_flags; + diag_printf(" RAMDISK_FLAGS : 0x%08x\n", ramdisk_flags); + } + if (orig_root_dev_set) { + pb->orig_root_dev = orig_root_dev; + diag_printf(" ORIG_ROOT_DEV : 0x%08x\n", orig_root_dev); + } + if (loader_type_set) { + pb->loader_type = loader_type; + diag_printf(" LOADER_TYPE : 0x%08x\n", loader_type); + } + if (initrd_start_set) { + pb->initrd_start = initrd_start; + pb->initrd_size = initrd_size; + diag_printf(" INITRD_START : 0x%08x\n", initrd_start); + diag_printf(" INITRD_SIZE : 0x%08x\n", initrd_size); + } + + pcmd = (char *)(base_addr + 0x100); + while ((*pcmd++ = *cmd_line++)); + + asm ("jmp @%0\n\tnop" : : "r" (entry)); +} diff --git a/packages/hal/sh/arch/current/src/sh.ld b/packages/hal/sh/arch/current/src/sh.ld --- a/packages/hal/sh/arch/current/src/sh.ld +++ b/packages/hal/sh/arch/current/src/sh.ld @@ -5,29 +5,38 @@ // Linker script for SH // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/arch/current/src/sh_stub.c b/packages/hal/sh/arch/current/src/sh_stub.c --- a/packages/hal/sh/arch/current/src/sh_stub.c +++ b/packages/hal/sh/arch/current/src/sh_stub.c @@ -5,29 +5,38 @@ // GDB Stub code for SH // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -44,6 +53,10 @@ #include +#ifdef CYGPKG_REDBOOT +#include +#endif + #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS #include @@ -63,7 +76,9 @@ int { switch( trap_number ) { case CYGNUM_HAL_EXCEPTION_TRAP: +#ifdef CYGNUM_HAL_EXCEPTION_INSTRUCTION_BP case CYGNUM_HAL_EXCEPTION_INSTRUCTION_BP: +#endif return SIGTRAP; case CYGNUM_HAL_EXCEPTION_POWERON: @@ -73,6 +88,7 @@ int // chance to find out what happened (as opposed to SIGTERM). return SIGINT; +#ifdef CYGNUM_HAL_EXCEPTION_TLBMISS_ACCESS case CYGNUM_HAL_EXCEPTION_TLBMISS_ACCESS: case CYGNUM_HAL_EXCEPTION_TLBMISS_WRITE: case CYGNUM_HAL_EXCEPTION_INITIAL_WRITE: @@ -83,6 +99,11 @@ int case CYGNUM_HAL_EXCEPTION_DATA_ACCESS: case CYGNUM_HAL_EXCEPTION_DATA_WRITE: return SIGBUS; +#else + case CYGNUM_HAL_EXCEPTION_DATA_ACCESS: + case CYGNUM_HAL_EXCEPTION_DMA_DATA_ACCESS: + return SIGSEGV; +#endif case CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION: case CYGNUM_HAL_EXCEPTION_ILLEGAL_SLOT_INSTRUCTION: @@ -103,6 +124,16 @@ int return _hal_registers->event; } +#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) +int __is_bsp_syscall(void) +{ + if (_hal_registers->event == 34) + return 1; + else + return 0; +} +#endif + /* Set the currently-saved pc register value to PC. This also updates NPC as needed. */ @@ -206,7 +237,7 @@ void __clear_single_step (void) #define TRAPA_INSTR 0xc300 #define BxxF_INSTR 0x0003 -#define SSTEP_INSTR 0xc3ff +#define SSTEP_INSTR 0xc320 #define T_BIT_MASK 0x0001 diff --git a/packages/hal/sh/arch/current/src/vectors.S b/packages/hal/sh/arch/current/src/vectors.S --- a/packages/hal/sh/arch/current/src/vectors.S +++ b/packages/hal/sh/arch/current/src/vectors.S @@ -5,29 +5,38 @@ ## SH exception vectors ## ##========================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##========================================================================== #######DESCRIPTIONBEGIN#### ## @@ -39,8 +48,7 @@ ## vectors. It also contains the first level default VSRs ## that save and restore state for both exceptions and ## interrupts. -## Notes: The SH architecture files are still more SH3 specific than -## architecture neutral, hence the sub-variant configury. +## ######DESCRIPTIONEND#### ## ##========================================================================== @@ -60,68 +68,22 @@ #=========================================================================== - .file "vectors.S" +// .file "vectors.S" -#undef __DEBUG +#define n__DEBUG #=========================================================================== # Start by defining the exceptions vectors. - .section ".vectors","ax" - -# reset 0xa0000000 -# other exceptions VBR+0x100 -# tlb miss VBR+0x400 -# interrupts VBR+0x600 - - -#=========================================================================== -# Reset code must be PC relative so it can be executed out of the shadow -# area during startup. Not until after hal_hardware_init can the system -# be expected to provide the proper address space (at that time we -# jump to the VMA base of the code). - - .org 0x000 -FUNC_START(_reset) - mov.l $_reset_platform,r0 - jmp @r0 - nop -# Note: this is the unmapped, shadow address of the start of code -# Sadly, it is too far to just branch to. - .align 2 -$_reset_platform: -#ifdef CYG_HAL_STARTUP_RAM - .long CYG_LABEL_DEFN(_reset_platform) -#elif defined(CYG_HAL_STARTUP_ROMRAM) - // Uncached "shadow" address but adjusted for VMA/LMA differences - .long __reset_platform+0x20000000-CYGMEM_REGION_ram+CYGMEM_REGION_rom -#else - // Uncached "shadow" address - .long CYG_LABEL_DEFN(_reset_platform)+0x20000000 -#endif - -#--------------------------------------------------------------------------- -# Exception entry - - .org 0x100 -__exception: + .section ".vectors","ax" +# Include exception entry code since it exists in two variants, +# depending on the CPU model. This file also defines macros used +# for exception return. -#if defined(CYGPKG_KERNEL_INSTRUMENT) && defined(CYGDBG_KERNEL_INSTRUMENT_INTR) - mov #1,r7 -#endif +FUNC_START(_vector_code_vma) - mov.l $nCYGARC_REG_EXCEVT,r1 - mov.l @r1,r1 - shlr2 r1 - shlr r1 ! divide cause by 0x08 - mov.l $hal_vsr_table2,r0 - mov.l @(r0,r1),r1 - jmp @r1 - nop - - .align 2 - SYM_PTR_REFn(hal_vsr_table,2) - +#include CYGBLD_HAL_VAR_EXCEPTION_MODEL_INC + #--------------------------------------------------------------------------- # This code handles the common part of all exception handlers. # It saves the machine state onto the stack and then calls @@ -130,79 +92,24 @@ FUNC_START(_reset) # here the saved state is restored and execution is continued. FUNC_START(cyg_hal_default_exception_vsr) - - # We come here with all register containing their - # pre-exception values except: - # r0_b-r7_b = saved r0-r7 - # r7 = vector # - # spc = saved pc - # ssr = saved sr - - # Save away some registers - mov r15,r1 ! entry sp - + hal_cpu_save_regs + hal_exception_entry_extras #ifdef __DEBUG - mov.l $exc_state_marker,r0 - mov.l r0,@-r15 - mov.l $nCYGARC_REG_EXCEVT,r0 - mov.l @r0,r0 - mov.l r0,@-r15 -#endif - -#ifdef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT - add #-12,r15 ! Space for cause, gbr, and vbr -#else - add #-4,r15 ! Space for cause - - stc gbr,r0 ! GBR - mov.l r0,@-r15 - stc vbr,r0 ! VBR + mov.l 1f,r0 mov.l r0,@-r15 -#endif - - stc spc,r0 - mov.l r0,@-r15 ! PC - stc ssr,r0 - mov.l r0,@-r15 ! SR - - sts.l pr,@-r15 ! PR - sts.l mach,@-r15 ! mach - sts.l macl,@-r15 ! macl - - mov.l r1,@-r15 ! entry sp - mov.l r14,@-r15 ! r14-r0 - mov.l r13,@-r15 - mov.l r12,@-r15 - mov.l r11,@-r15 - mov.l r10,@-r15 - mov.l r9,@-r15 - mov.l r8,@-r15 - stc.l r7_bank,@-r15 - stc.l r6_bank,@-r15 - stc.l r5_bank,@-r15 - stc.l r4_bank,@-r15 - stc.l r3_bank,@-r15 - stc.l r2_bank,@-r15 - stc.l r1_bank,@-r15 - stc.l r0_bank,@-r15 - - # After setting the SR it will be possible to use breakpoints. - mov.l $nCYG_SR1,r1 - ldc r1,sr - # ------------------------------------------------------------ - # Register bank has changed now. - -#ifdef __DEBUG + bra 2f + nop + .align 2 +1: .long 0x77777770 +2: # It is safe to use breakpoints below this point. .globl _cyg_hal_default_exception_vsr_bp_safe _cyg_hal_default_exception_vsr_bp_safe: #endif - mov.l $nCYGARC_REG_EXCEVT,r0 - mov.l @r0,r4 - mov #-5,r0 ! divide cause by 0x20 - shld r0,r4 - mov #CYGARC_SHREG_EVENT,r0 - mov.l r4,@(r0,r15) ! store decoded vector number back + + # Make sure the saved registers structure contain + # the decoded exception number + hal_exception_translate # The entire CPU state is now stashed on the stack, # call into C to do something with it. @@ -219,139 +126,29 @@ FUNC_START(cyg_hal_default_exception_vsr .align 2 $restore_state: .long restore_state -$nCYG_SR1: - .long CYG_SR - -#ifdef __DEBUG -$exc_state_marker: - .long 0x77777770 -#endif - SYM_PTR_REF(cyg_hal_exception_handler) #--------------------------------------------------------------------------- -# TLB miss entry - - .org 0x400 -__tlb_miss: -#if defined(CYGPKG_KERNEL_INSTRUMENT) && defined(CYGDBG_KERNEL_INSTRUMENT_INTR) - mov #2,r7 -#endif - - mov.l $nCYGARC_REG_EXCEVT,r1 - mov.l @r1,r1 - shlr2 r1 - shlr r1 ! divide cause by 0x08 - mov.l $hal_vsr_table3,r0 - mov.l @(r0,r1),r1 - jmp @r1 - nop - - .align 2 - SYM_PTR_REFn(hal_vsr_table,3) -$nCYGARC_REG_EXCEVT: - .long CYGARC_REG_EXCEVT - -#--------------------------------------------------------------------------- -# Interrupt entry - - .org 0x600 -__interrupt: - -#ifdef CYGHWR_HAL_SH_IRQ_HANDLE_SPURIOUS_INTERRUPTS - # A spurious interrupt with INTEVT=0 may be caused by - # clearing of BL. Those interrupts need to be ignored. - mov.l $nCYGARC_REG_INTEVT,r0 - mov.l @r0,r0 - cmp/eq #0,r0 - bf 1f - rte - nop -1: -#endif - - -#if defined(CYGPKG_KERNEL_INSTRUMENT) && defined(CYGDBG_KERNEL_INSTRUMENT_INTR) - mov #3,r7 -#endif - - mov.l $hal_vsr_table_int,r1 - mov.l @r1,r1 - jmp @r1 - nop - - .align 2 -$hal_vsr_table_int: - .long CYG_LABEL_DEFN(hal_vsr_table)+CYGNUM_HAL_VECTOR_INTERRUPT*4 - -#--------------------------------------------------------------------------- # Common interrupt handling code. FUNC_START(cyg_hal_default_interrupt_vsr) - - # We come here with all register containing their - # pre-exception values except: - # r0_b-r7_b = saved r0-r7 - # r7 = vector # - # spc = saved pc - # ssr = saved sr - - # Save away some registers - mov r15,r1 ! entry sp - -#ifdef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT - add #-12,r15 ! Space for cause, gbr, and vbr -#else - add #-4,r15 ! Space for cause - - stc gbr,r0 ! GBR - mov.l r0,@-r15 - stc vbr,r0 ! VBR + hal_cpu_save_regs + hal_interrupt_entry_extras + +#ifdef __DEBUG + mov.l 1f,r0 mov.l r0,@-r15 -#endif - - stc spc,r0 - mov.l r0,@-r15 ! PC - stc ssr,r0 - mov.l r0,@-r15 ! SR - - sts.l pr,@-r15 ! PR - sts.l mach,@-r15 ! mach - sts.l macl,@-r15 ! macl - - mov.l r1,@-r15 ! entry sp - mov.l r14,@-r15 ! r14-r0 - mov.l r13,@-r15 - mov.l r12,@-r15 - mov.l r11,@-r15 - mov.l r10,@-r15 - mov.l r9,@-r15 - mov.l r8,@-r15 - stc.l r7_bank,@-r15 - stc.l r6_bank,@-r15 - stc.l r5_bank,@-r15 - stc.l r4_bank,@-r15 - stc.l r3_bank,@-r15 - stc.l r2_bank,@-r15 - stc.l r1_bank,@-r15 - stc.l r0_bank,@-r15 - - # After setting the SR it will be possible to use breakpoints. - mov.l $nCYG_SR2,r1 - ldc r1,sr - # ------------------------------------------------------------ - # Register bank has changed now. - -#ifdef __DEBUG + bra 2f + nop + .align 2 +1: .long 0x77777771 +2: # It is safe to use breakpoints below this point. .globl _cyg_hal_default_interrupt_vsr_bp_safe _cyg_hal_default_interrupt_vsr_bp_safe: #endif # The entire CPU state is now stashed on the stack, - # call into C to do something with it. - - # The entire CPU state is now stashed on the stack, # increment the scheduler lock and call the ISR # for this vector. @@ -395,9 +192,9 @@ 1: #endif # Decode the interrupt vector, and find ISR index - hal_intc_decode r0,r4 - mov #CYGARC_SHREG_EVENT,r0 + mov.l @(r0,r8),r4 ! load existing vector number + hal_intc_decode r1,r4 mov.l r4,@(r0,r8) ! store decoded vector number back ! to saved state. hal_intc_translate r4,r9 @@ -491,55 +288,12 @@ 1: restore_state: # All done, restore CPU state and continue - - # Disable interrupts and switch register bank during the restore - # operation - mov.l $nCYG_SR_BANK1,r1 - ldc r1,sr - # ------------------------------------------------------------ - # Register bank has changed now. - - # - # Single step debugging becomes impossible after this point! - # - - mov r15,r0 - ldc.l @r0+,r0_bank - ldc.l @r0+,r1_bank - ldc.l @r0+,r2_bank - ldc.l @r0+,r3_bank - ldc.l @r0+,r4_bank - ldc.l @r0+,r5_bank - ldc.l @r0+,r6_bank - ldc.l @r0+,r7_bank - mov.l @r0+,r8 - mov.l @r0+,r9 - mov.l @r0+,r10 - mov.l @r0+,r11 - mov.l @r0+,r12 - mov.l @r0+,r13 - mov.l @r0+,r14 - mov.l @r0+,r15 ! return SP - - lds.l @r0+,macl ! macl - lds.l @r0+,mach ! mach - lds.l @r0+,pr ! PR - - mov.l @r0+,r2 - ldc r2,ssr ! return SR - mov.l @r0+,r2 - ldc r2,spc ! return PC - -#ifndef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT - mov.l @r0+,r2 - ldc r2,vbr ! return VBR - mov.l @r0+,r2 - ldc r2,gbr ! return GBR +#ifdef __DEBUG + # skip past debug marker + add #4,sp #endif - rte - nop - + hal_cpu_restore_regs_return #ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK @@ -578,10 +332,6 @@ FUNC_START(hal_interrupt_stack_call_pend #endif // CYGFUN_HAL_COMMON_KERNEL_SUPPORT .align 2 -#ifdef __DEBUG -$int_state_marker: - .long 0x77777771 -#endif #if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) \ || defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) @@ -592,16 +342,6 @@ FUNC_START(hal_interrupt_stack_call_pend SYM_PTR_REF(cyg_interrupt_stack_base) SYM_PTR_REF(cyg_interrupt_stack) #endif -$nCYG_SR2: - .long CYG_SR -$nCYG_SR_BANK1: - .long CYG_SR_BANK1 -$nCYGARC_REG_INTEVT: - .long CYGARC_REG_INTEVT -#ifdef CYGARC_REG_INTEVT2 -$nCYGARC_REG_INTEVT2: - .long CYGARC_REG_INTEVT2 -#endif SYM_PTR_REF(hal_interrupt_handlers) SYM_PTR_REF(hal_interrupt_data) SYM_PTR_REF(hal_interrupt_objects) @@ -685,7 +425,7 @@ 2: # Copy everything to the proper VMA base and jump to it. mov.l $_vector_code_lma,r0 - mov.l $_reset,r1 + mov.l $_vector_code_vma,r1 mov.l $end,r2 1: mov.l @r0+,r3 ! get word from ROM mov.l r3,@r1 ! store in RAM @@ -698,7 +438,7 @@ 1: mov.l @r0+,r3 .align 2 SYM_PTR_REF(_vector_code_lma) - SYM_PTR_REF(_reset) + SYM_PTR_REF(_vector_code_vma) SYM_PTR_REF(end) SYM_PTR_REF(complete_setup) @@ -715,6 +455,7 @@ 1: mov.l @r0+,r3 # After this point we can use absolute addressing modes and access all the # memory in the system. + .align 2 FUNC_START(complete_setup) # Set up monitor related stuff (vectors primarily) diff --git a/packages/hal/sh/arch/current/tests/intr0.c b/packages/hal/sh/arch/current/tests/intr0.c --- a/packages/hal/sh/arch/current/tests/intr0.c +++ b/packages/hal/sh/arch/current/tests/intr0.c @@ -5,29 +5,38 @@ // Interrupt controls test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 20001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/cq7708/current/ChangeLog b/packages/hal/sh/cq7708/current/ChangeLog --- a/packages/hal/sh/cq7708/current/ChangeLog +++ b/packages/hal/sh/cq7708/current/ChangeLog @@ -1,3 +1,8 @@ +2002-05-13 Jesper Skov + + * cdl/hal_sh_sh7708_cq7708.cdl: Removed implemntation of + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + 2001-09-11 Jonathan Larmour * cdl/hal_sh_sh7708_cq7708.cdl: Default to big-endian. @@ -114,27 +119,36 @@ 2000-03-30 Haruki Kashiwaya + + * misc/redboot_RAM.ecm: Added. + * misc/redboot_ROM.ecm: Include flash support. + 2001-11-19 Jesper Skov * cdl/hal_sh_sh7750_cq7750.cdl: Added CYGHWR_HAL_SH_OOC_DIVIDER_1 @@ -77,27 +82,36 @@ 2000-04-18 Ryozaburo Suzuki +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_TC58FVB800 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/cq7750/current/misc/redboot_ROM.ecm b/packages/hal/sh/cq7750/current/misc/redboot_ROM.ecm --- a/packages/hal/sh/cq7750/current/misc/redboot_ROM.ecm +++ b/packages/hal/sh/cq7750/current/misc/redboot_ROM.ecm @@ -14,14 +14,24 @@ cdl_configuration eCos { package -hardware CYGPKG_HAL_SH current ; package -hardware CYGPKG_HAL_SH_SH4 current ; package -hardware CYGPKG_HAL_SH_SH7750_CQ7750 current ; + package -hardware CYGPKG_DEVS_FLASH_CQ7750 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; package -hardware CYGPKG_IO_SERIAL_SH_SCIF current ; package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_IO_FLASH current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 }; cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { - user_value 6144 + user_value 4096 }; cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { @@ -48,6 +58,10 @@ cdl_component CYGPKG_HAL_SH_7750 { inferred_value 1 }; +cdl_option CYGHWR_HAL_SH_CACHE_ENABLE { + inferred_value 0 +}; + cdl_component CYG_HAL_STARTUP { user_value ROM }; @@ -56,4 +70,36 @@ cdl_component CYGBLD_BUILD_REDBOOT { user_value 1 }; +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_TC58FVB800 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/cq7750/current/src/hal_diag.c b/packages/hal/sh/cq7750/current/src/hal_diag.c --- a/packages/hal/sh/cq7750/current/src/hal_diag.c +++ b/packages/hal/sh/cq7750/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/cq7750/current/src/plf_misc.c b/packages/hal/sh/cq7750/current/src/plf_misc.c --- a/packages/hal/sh/cq7750/current/src/plf_misc.c +++ b/packages/hal/sh/cq7750/current/src/plf_misc.c @@ -5,29 +5,38 @@ // HAL platform miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/dreamcast/current/ChangeLog b/packages/hal/sh/dreamcast/current/ChangeLog --- a/packages/hal/sh/dreamcast/current/ChangeLog +++ b/packages/hal/sh/dreamcast/current/ChangeLog @@ -12,27 +12,36 @@ 2001-07-30 Jesper Skov + + * cdl/hal_sh_edk7708.cdl: Removed implemntation of + CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED. + 2001-09-13 Jesper Skov * include/pkgconf/mlt_sh_edk7708_romram.mlt: Moved RAM to @@ -390,27 +395,36 @@ 1999-04-22 Jesper Skov " diff --git a/packages/hal/sh/edk7708/current/include/hal_diag.h b/packages/hal/sh/edk7708/current/include/hal_diag.h --- a/packages/hal/sh/edk7708/current/include/hal_diag.h +++ b/packages/hal/sh/edk7708/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/edk7708/current/include/platform.inc b/packages/hal/sh/edk7708/current/include/platform.inc --- a/packages/hal/sh/edk7708/current/include/platform.inc +++ b/packages/hal/sh/edk7708/current/include/platform.inc @@ -7,29 +7,38 @@ ## SH/EDK7708 board assembler header file ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.0 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://sourceware.cygnus.com/ecos -# -# Software distributed under the License is distributed on an -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/sh/edk7708/current/include/plf_cache.h b/packages/hal/sh/edk7708/current/include/plf_cache.h --- a/packages/hal/sh/edk7708/current/include/plf_cache.h +++ b/packages/hal/sh/edk7708/current/include/plf_cache.h @@ -8,29 +8,38 @@ // Platform specific cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/edk7708/current/include/plf_intr.h b/packages/hal/sh/edk7708/current/include/plf_intr.h --- a/packages/hal/sh/edk7708/current/include/plf_intr.h +++ b/packages/hal/sh/edk7708/current/include/plf_intr.h @@ -8,29 +8,38 @@ // Platform specific Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/edk7708/current/include/plf_io.h b/packages/hal/sh/edk7708/current/include/plf_io.h --- a/packages/hal/sh/edk7708/current/include/plf_io.h +++ b/packages/hal/sh/edk7708/current/include/plf_io.h @@ -8,29 +8,38 @@ // Platform specific IO support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/edk7708/current/include/plf_stub.h b/packages/hal/sh/edk7708/current/include/plf_stub.h --- a/packages/hal/sh/edk7708/current/include/plf_stub.h +++ b/packages/hal/sh/edk7708/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/edk7708/current/src/edk.S b/packages/hal/sh/edk7708/current/src/edk.S --- a/packages/hal/sh/edk7708/current/src/edk.S +++ b/packages/hal/sh/edk7708/current/src/edk.S @@ -5,29 +5,38 @@ ## EDK board hardware setup ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/sh/edk7708/current/src/hal_diag.c b/packages/hal/sh/edk7708/current/src/hal_diag.c --- a/packages/hal/sh/edk7708/current/src/hal_diag.c +++ b/packages/hal/sh/edk7708/current/src/hal_diag.c @@ -5,29 +5,38 @@ // HAL diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/edk7708/current/src/plf_misc.c b/packages/hal/sh/edk7708/current/src/plf_misc.c --- a/packages/hal/sh/edk7708/current/src/plf_misc.c +++ b/packages/hal/sh/edk7708/current/src/plf_misc.c @@ -5,29 +5,38 @@ // HAL platform miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/hs7729pci/current/ChangeLog b/packages/hal/sh/hs7729pci/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/ChangeLog @@ -0,0 +1,224 @@ +2002-05-08 Jesper Skov + + * src/hal_diag.c: Serial register renaming. + +2001-10-31 Jonathan Larmour + + * cdl/hal_sh_sh7729_hs7729pci.cdl: Indicate support of variable baud + rates. + +2001-10-11 Jesper Skov + + * src/hal_diag.c: Fixed warning. + +2001-09-25 Jesper Skov + + * include/plf_intr.h: Removed dummy + CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF definition. + +2001-09-21 Jesper Skov + + * include/plf_intr.h (CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF): + Ignore level vectors. + +2001-07-26 Jesper Skov + + * src/plf_misc.c (hal_platform_init): Use driver API to attach PCI + arbiter. + +2001-07-23 Jesper Skov + + * cdl/hal_sh_sh7729_hs7729pci.cdl: Increase PLL1 to 4 for faster + CPU clock. + +2001-07-06 Jesper Skov + + * src/plf_misc.c (hal_platform_init): Always install PCI arbiter. + + * src/smsc37c93x.c: Enable RTC. + +2001-07-05 Jesper Skov + + * cdl/hal_sh_sh7729_hs7729pci.cdl: Set linux exec parameters. + + * include/platform.inc: Fix SD0001 SDRAM setup. + + * src/smsc37c93x.c (cyg_hal_init_superIO): Fixed interrupt setting + - 32 bit reads swap the two 16 bits words, so my first reading of + the default setup was wrong. + +2001-07-02 Jesper Skov + + * src/plf_misc.c: CYGARC_PHYSICAL_ADDRESS renamed to + CYGARC_BUS_ADDRESS. + * include/plf_io.h: Same. + +2001-06-29 Jesper Skov + + * include/plf_intr.h (CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF): Fix + typo. + + * src/plf_misc.c: Include new arbiter header. + +2001-06-28 Jesper Skov + + * src/plf_misc.c: Set up ISR arbiter for the PCI vector. + + * include/plf_io.h: Added HAL_PCI_TRANSLATE_INTERRUPT. + + * include/plf_intr.h: Added decoded PCI vectors. Added interrupt + configury extensions. + +2001-06-27 Jesper Skov + + * include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.mlt: Reserve 128k + for redBoot. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.h: Same. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.ldi: Same. + + * misc/redboot_RAM.ecm: Added ether driver. Added compression. + * misc/redboot_ROM.ecm: Same. + + * include/platform.inc: Replace settings with proper values from + Hitachi boot loader. + + * src/plf_misc.c (cyg_hal_plf_pci_init): Set PCI IO/MEM + offsets. Set BAR1 to SDRAM start. + + * include/plf_io.h: Set proper PCI memory base. Fix CPU/BUS + translation macros. + +2001-06-26 Jesper Skov + + * misc/redboot_RAM.ecm: Increase stack size to 6kB. + * misc/redboot_ROM.ecm: Same. + + * include/plf_io.h: Define PCI IO accessor macros (keep commented + out though since IO mapped access is working now). + * src/plf_misc.c: PCI IO accessor functions fixed (and commented + out). Instead of fiddling PCI endian control, set PCI timeout + values like the Linux kernel, and PCI IO mapped access works. + +2001-06-25 Jesper Skov + + * src/plf_misc.c: Call PCI init in RedBoot configs. Added PCI IO + accessor functions. + + * include/plf_io.h: Define PCI IO accessor macros and CPU/BUS + translation macros. + + * src/plf_misc.c (cyg_hal_plf_pci_cfg_write_byte): + + * src/ser16c550c.c: Use magic 16bit access. + * src/smsc37c93x.c: Same. + + * src/hal_diag.c (cyg_hal_plf_comms_init): Init SuperIO. + +2001-06-18 Jesper Skov + + * src/plf_misc.c (cyg_hal_plf_pci_init): Fiddle PCI setup. + +2001-06-17 Jesper Skov + + * src/smsc37c93x.c (cyg_hal_init_superIO): Power up COM ports. Use + correct offsets. Set interrupt vectors. + + * src/ser16c550c.c: Correct clock and vectors. + + * cdl/hal_sh_sh7729_hs7729pci.cdl: Force LVL irq mode. + + * include/plf_intr.h: Added external interrupts. + +2001-05-31 Jesper Skov + + * include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.h: Added PCI window. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.mlt: Same. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.ldi: Same. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.h: Same. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.mlt: Same. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.ldi: Same. + +2001-05-30 Jesper Skov + + * src/plf_misc.c (hal_platform_init): Init SuperIO controller. + + * src/hal_diag.c (cyg_hal_plf_comms_init): Init superIO UARTs (disabled). + + * src/ser16c550c.c: Added. + * src/smsc37c93x.c: Added. + * cdl/hal_sh_sh7729_hs7729pci.cdl: Build new files. + + * src/plf_misc.c: Added delays to make PCI config IO work. + + * include/plf_io.h (HAL_PCI_ALLOC_BASE_MEMORY): Changed - not sure + if correct. + (HAL_PCI_IGNORE_DEVICE): Don't probe anything but PCI bus 0. + +2001-05-29 Jesper Skov + + * src/plf_misc.c: Added PCI functions. + + * include/plf_io.h: Added. Contains PCI details. + + * include/platform.inc (BSC_settings_table): Changed to use init + values as documented by Hitachi. + + * misc/split_words.c: Quick hack to allow splitting of images for + EPROM programming. + + * misc/redboot_RAM.ecm: Added. + * misc/redboot_ROM.ecm: Added. + + * include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.h: Made SDRAM area + default for memory. Added SRAM1 and SRAM2 areas. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.ldi: Same. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.mlt: Same. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.h: Same. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.ldi: Same. + * include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.mlt: Same. + + * cdl/hal_sh_sh7729_hs7729pci.cdl: Use SDRAM. + +2001-05-28 Jesper Skov + + * include/platform.inc (hal_hardware_init): Don't mess with BSC + stuff in RAM startup. + +2001-05-25 Jesper Skov + + * New platform HAL. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/sh/hs7729pci/current/cdl/hal_sh_sh7729_hs7729pci.cdl b/packages/hal/sh/hs7729pci/current/cdl/hal_sh_sh7729_hs7729pci.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/cdl/hal_sh_sh7729_hs7729pci.cdl @@ -0,0 +1,374 @@ +# ==================================================================== +# +# hal_sh_sh7729_hs7729pci.cdl +# +# Hitachi HS7729PCI board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: jskov +# Contributors: +# Date: 2001-05-25 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_SH_SH7729_HS7729PCI { + display "Hitachi/SH7729 HS7729PCI board" + parent CYGPKG_HAL_SH + requires CYGPKG_HAL_SH_7729 + requires ! CYGHWR_HAL_SH_BIGENDIAN + requires CYGHWR_HAL_SH_IRQ_USE_IRQLVL + requires { !CYGPKG_REDBOOT || CYGDAT_REDBOOT_SH_LINUX_BOOT_ENTRY == 0x8c211000 } + requires { !CYGPKG_REDBOOT || CYGDAT_REDBOOT_SH_LINUX_BOOT_BASE_ADDR == 0x8c210000 } + define_header hal_sh_sh7729_hs7729pci.h + include_dir cyg/hal + description " + The HS7729PCI HAL package provides the support needed to run + eCos on a Hitachi/SH HS7729PCI board." + + compile hal_diag.c plf_misc.c ser16c550c.c smsc37c93x.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + + puts $::cdl_header "#define CYGNUM_HAL_SH_SH3_SCIF_PORTS 1" + puts $::cdl_header "#define CYGHWR_HAL_VSR_TABLE 0x8c000000" + puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0x8c000100" + + puts $::cdl_header "#define HAL_PLATFORM_CPU \"SH 7729\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"HS7729PCI\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM" "ROMRAM" } + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the HS7729PCI board it is possible to build + the system for either RAM bootstrap or ROM bootstrap. + RAM bootstrap generally requires that the board + is equipped with ROMs containing a suitable ROM monitor or + equivalent software that allows GDB to download the eCos + application on to the board. The ROM bootstrap typically + requires that the eCos application be blown into EPROMs or + equivalent technology. ROMRAM bootstrap is similar to ROM + bootstrap, but everything is copied to RAM before execution + starts thus improving performance, but at the cost of an + increased RAM footprint." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 3 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The HS7729PCI board has one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + The HS7729PCI board has two serial ports. This option + chooses which port will be used for diagnostic output." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD { + display "Console/GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + define CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD + description " + This option controls the default baud rate used for the + Console/GDB connection." + } + + cdl_component CYGHWR_HAL_SH_PLF_CLOCK_SETTINGS { + display "SH on-chip platform clock controls" + description " + The various clocks used by the system are derived from + these options." + flavor none + no_define + + cdl_option CYGHWR_HAL_SH_OOC_XTAL { + display "SH clock crystal" + flavor data + legal_values 8000000 to 50000000 + default_value 33000000 + no_define + description " + This option specifies the frequency of the crystal all + other clocks are derived from." + } + + cdl_option CYGHWR_HAL_SH_OOC_PLL_1 { + display "SH clock PLL circuit 1" + flavor data + default_value 4 + legal_values { 0 1 2 3 4 6 8 } + description " + This selects the multiplication factor provided by + PLL1. If PLL1 is disabled via CAP1, this option should + be set to zero." + } + + cdl_option CYGHWR_HAL_SH_OOC_PLL_2 { + display "SH clock PLL circuit 2" + flavor data + default_value 1 + legal_values { 0 1 4 } + no_define + description " + This selects the multiplication factor provided by + PLL2. If PLL2 is disabled via CAP2, this option should + be set to zero." + } + + cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_1 { + display "SH clock divider 1" + flavor data + default_value 1 + legal_values { 1 2 3 4 6 } + description " + This divider option affects the CPU core clock." + } + + cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_2 { + display "SH clock divider 2" + flavor data + default_value 4 + legal_values { 1 2 3 4 6 } + description " + This divider option affects the peripheral clock." + } + + cdl_option CYGHWR_HAL_SH_OOC_CLOCK_MODE { + display "SH clock mode" + flavor data + default_value 0 + legal_values { 0 1 2 3 4 7 } + description " + This option must mirror the clock mode hardwired on + the MD0-MD2 pins of the CPU in order to correctly + initialize the FRQCR register." + } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + no_define + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "sh-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { CYGHWR_HAL_SH_BIGENDIAN ? "-mb -m3 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -ggdb -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : "-ml -m3 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -ggdb -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { CYGHWR_HAL_SH_BIGENDIAN ? "-mb -m3 -ggdb -nostdlib -Wl,--gc-sections -Wl,-static" : "-ml -m3 -ggdb -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "sh_sh7729_hs7729pci_ram" : \ + CYG_HAL_STARTUP == "ROM" ? "sh_sh7729_hs7729pci_rom" : \ + "sh_sh7729_hs7729pci_romram" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + requires { CYG_HAL_STARTUP == "RAM" } + parent CYGPKG_HAL_ROM_MONITOR + description " + Support can be enabled for boot ROMs or ROM monitors which contain + GDB stubs. This support changes various eCos semantics such as + the encoding of diagnostic output, and the overriding of hardware + interrupt vectors." + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } +} diff --git a/packages/hal/sh/hs7729pci/current/include/hal_diag.h b/packages/hal/sh/hs7729pci/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/hal_diag.h @@ -0,0 +1,69 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +//============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-05-25 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +//----------------------------------------------------------------------------- +// end of hal_diag.h +#endif // CYGONCE_HAL_HAL_DIAG_H diff --git a/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.h b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.h @@ -0,0 +1,38 @@ +// eCos memory layout - Thu May 31 15:00:18 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_sram1 (0x82000000) +#define CYGMEM_REGION_sram1_SIZE (0x100000) +#define CYGMEM_REGION_sram1_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_sram2 (0x89000000) +#define CYGMEM_REGION_sram2_SIZE (0x100000) +#define CYGMEM_REGION_sram2_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_ram (0x8c020000) +#define CYGMEM_REGION_ram_SIZE (0x3fe0000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap2) []; +#endif +#define CYGMEM_SECTION_heap2 (CYG_LABEL_NAME (__heap2)) +#define CYGMEM_SECTION_heap2_SIZE (0x82100000 - (size_t) CYG_LABEL_NAME (__heap2)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap3) []; +#endif +#define CYGMEM_SECTION_heap3 (CYG_LABEL_NAME (__heap3)) +#define CYGMEM_SECTION_heap3_SIZE (0x89100000 - (size_t) CYG_LABEL_NAME (__heap3)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x8ff00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.ldi b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.ldi @@ -0,0 +1,31 @@ +// eCos memory layout - Thu May 31 15:00:18 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + sram1 : ORIGIN = 0x82000000, LENGTH = 0x100000 + sram2 : ORIGIN = 0x89000000, LENGTH = 0x100000 + ram : ORIGIN = 0x8c020000, LENGTH = 0x3fe0000 +} + +SECTIONS +{ + SECTIONS_BEGIN + CYG_LABEL_DEFN(__heap2) = 0x82000000; + CYG_LABEL_DEFN(__heap3) = 0x89000000; + SECTION_vectors (ram, 0x8c020000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x8ff00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; + SECTIONS_END +} diff --git a/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.mlt b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_ram.mlt @@ -0,0 +1,17 @@ +version 0 +region sram1 82000000 100000 0 ! +region sram2 89000000 100000 0 ! +region ram 8c020000 3fe0000 0 ! +section heap2 0 1 0 0 1 0 1 0 82000000 82000000 ! +section heap3 0 1 0 0 1 0 1 0 89000000 89000000 ! +section vectors 0 1 0 1 1 1 1 1 8c020000 8c020000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 8 0 1 0 1 0 1 rodata rodata ! +section rodata 0 8 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 8 0 1 0 1 0 1 bss bss ! +section bss 0 10 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 100000 1 0 0 1 0 1 0 8ff00000 8ff00000 ! diff --git a/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.h b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.h @@ -0,0 +1,46 @@ +// eCos memory layout - Thu May 31 15:02:44 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_rom (0x80000000) +#define CYGMEM_REGION_rom_SIZE (0x200000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#define CYGMEM_REGION_sram1 (0x82000000) +#define CYGMEM_REGION_sram1_SIZE (0x100000) +#define CYGMEM_REGION_sram1_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_sram2 (0x89000000) +#define CYGMEM_REGION_sram2_SIZE (0x100000) +#define CYGMEM_REGION_sram2_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_ram (0x8c000000) +#define CYGMEM_REGION_ram_SIZE (0x4000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap2) []; +#endif +#define CYGMEM_SECTION_heap2 (CYG_LABEL_NAME (__heap2)) +#define CYGMEM_SECTION_heap2_SIZE (0x82100000 - (size_t) CYG_LABEL_NAME (__heap2)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap3) []; +#endif +#define CYGMEM_SECTION_heap3 (CYG_LABEL_NAME (__heap3)) +#define CYGMEM_SECTION_heap3_SIZE (0x89100000 - (size_t) CYG_LABEL_NAME (__heap3)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved) []; +#endif +#define CYGMEM_SECTION_reserved (CYG_LABEL_NAME (__reserved)) +#define CYGMEM_SECTION_reserved_SIZE (0x200) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x8ff00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.ldi b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.ldi @@ -0,0 +1,33 @@ +// eCos memory layout - Thu May 31 15:02:44 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + rom : ORIGIN = 0x80000000, LENGTH = 0x200000 + sram1 : ORIGIN = 0x82000000, LENGTH = 0x100000 + sram2 : ORIGIN = 0x89000000, LENGTH = 0x100000 + ram : ORIGIN = 0x8c000000, LENGTH = 0x4000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_vectors (rom, 0x80000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap2) = 0x82000000; + CYG_LABEL_DEFN(__heap3) = 0x89000000; + CYG_LABEL_DEFN(__reserved) = 0x8c000000; . = CYG_LABEL_DEFN(__reserved) + 0x200; + SECTION_data (ram, ALIGN (0x1), FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x8ff00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; + SECTIONS_END +} diff --git a/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.mlt b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/pkgconf/mlt_sh_sh7729_hs7729pci_rom.mlt @@ -0,0 +1,19 @@ +version 0 +region rom 80000000 200000 1 !Flash Bank 0 +region sram1 82000000 100000 0 ! +region sram2 89000000 100000 0 ! +region ram 8c000000 4000000 0 ! +section vectors 0 1 0 1 1 1 1 1 80000000 80000000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 8 0 1 0 1 0 1 rodata rodata ! +section rodata 0 8 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 0 0 1 data ! +section heap2 0 1 0 0 1 0 1 0 82000000 82000000 ! +section heap3 0 1 0 0 1 0 1 0 89000000 89000000 ! +section reserved 200 1 0 0 1 1 1 0 8c000000 8c000000 data ! +section data 0 1 1 1 0 1 0 0 bss ! +section bss 0 10 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 100000 1 0 0 1 0 1 0 8ff00000 8ff00000 ! diff --git a/packages/hal/sh/hs7729pci/current/include/platform.inc b/packages/hal/sh/hs7729pci/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/platform.inc @@ -0,0 +1,215 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## Hitachi HS7729PCI board assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): jskov +## Contributors:jskov, gthomas +## Date: 2001-05-25 +## Purpose: Hitachi HS7729PCI platform startup +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the Hitachi HS7729PCI +## board. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include +#include + +#------------------------------------------------------------------------------ +# Hardware initialization. + + .macro hal_hardware_init + // Set up the Bus State Controller + mova BSC_settings_table,r0 + mov r0,r3 +1: mov.w @r3+,r0 // Address (or zero) + cmp/eq #0,r0 + bt 2f + mov.w @r3+,r1 // data + bra 1b + mov.w r1,@r0 // delay slot + + .align 2 +BSC_settings_table: + .word CYGARC_REG_WTCSR, 0xA502 + .word CYGARC_REG_WTCNT, 0x5A00 + .word CYGARC_REG_FRQCR, CYGARC_REG_FRQCR_INIT + # Settings from Hitachi docs + .word CYGARC_REG_BCR1, 0x0008 + .word CYGARC_REG_BCR2, 0x2be0 + .word CYGARC_REG_BCR3, 0x0000 + .word CYGARC_REG_WCR1, 0x0c30 + .word CYGARC_REG_WCR2, 0x6cdf + .word CYGARC_REG_MCR, 0x0014 + # Settings from bootrom delivered with board + .word CYGARC_REG_DCR, 0x0000 + .word CYGARC_REG_PCR, 0x0000 + .word CYGARC_REG_RTCOR, 0xa580 + .word CYGARC_REG_RFCR, 0xa400 + .word CYGARC_REG_RTCNT, 0xa500 + .word CYGARC_REG_RTCSR, 0xa508 + .word 0 + +2: + mov.l $SDMR,r1 // Turns on SDRAM controller + mov.l $SDMR_val,r2 + mov.b r2,@r1 + + mov.l $SDRAM,r1 + mov.l $SDRAM_val,r2 + mov.l r2,@r1 + + mova Post_settings_table,r0 + mov r0,r3 +1: mov.l @r3+,r0 // Address (or zero) + cmp/eq #0,r0 + bt 4f + mov.l @r3+,r1 // data + bra 1b + mov.w r1,@r0 // delay slot + + .align 4 +$SDMR: .long 0xffffe880 +$SDMR_val: + .long 0 +$SDRAM: + .long CYGARC_REG_SD0001_SDRAM +$SDRAM_val: + .long CYGARC_REG_SD0001_SDRAM_INIT + +Post_settings_table: + # PFC settings from bootrom + .long CYGARC_REG_PACR,0x0000 + .long CYGARC_REG_PBCR,0x0000 + .long CYGARC_REG_PCCR,0x5555 + .long CYGARC_REG_PDCR,0x0055 + .long CYGARC_REG_PECR,0xaa8a + .long CYGARC_REG_PFCR,0xaaaa + .long CYGARC_REG_PGCR,0xaaaa + .long CYGARC_REG_PHCR,0x6a00 + .long CYGARC_REG_PJCR,0x0000 + .long CYGARC_REG_PKCR,0x0000 + .long CYGARC_REG_PLCR,0xaaaa + .long CYGARC_REG_SCPCR,0x0000 + .long 0 +4: + .endm + +#------------------------------------------------------------------------------ +# Monitor initialization. + +#ifndef CYGPKG_HAL_SH_MON_DEFINED + +#if !defined(CYG_HAL_STARTUP_RAM) || \ + ( defined(CYG_HAL_STARTUP_RAM) && \ + !defined(CYGSEM_HAL_USE_ROM_MONITOR)) + + # If we are not starting up from RAM, or we are starting in + # RAM and NOT using a ROM monitor, initialize the VSR table. + + .macro hal_mon_init + mov.l $hal_vsr_table,r3 + # Write exception vectors + mov.l $cyg_hal_default_exception_vsr,r4 + mov #CYGNUM_HAL_VSR_EXCEPTION_COUNT,r5 +1: mov.l r4,@r3 + add #4,r3 + dt r5 + bf 1b + # Write interrupt vector + mov.l $cyg_hal_default_interrupt_vsr,r4 + mov.l $hal_vsr_table,r3 + add #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3 + mov.l r4,@r3 + bra 2f + nop + .align 2 + + SYM_PTR_REF(cyg_hal_default_exception_vsr) + SYM_PTR_REF(cyg_hal_default_interrupt_vsr) + SYM_PTR_REF(hal_vsr_table) +2: + .endm + +#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR) + + # Initialize the VSR table entries + # We only take control of the interrupt vector, + # the rest are left to the ROM for now... + + .macro hal_mon_init + # Write interrupt vector + mov.l $hal_vsr_table,r3 + mov.l $cyg_hal_default_interrupt_vsr,r4 + add #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3 + mov.l r4,@r3 + bra 2f + nop + .align 2 + + SYM_PTR_REF(cyg_hal_default_interrupt_vsr) + SYM_PTR_REF(hal_vsr_table) +2: + .endm + +#else + + .macro hal_mon_init + .endm + +#endif + + +#define CYGPKG_HAL_SH_MON_DEFINED + +#endif // CYGPKG_HAL_SH_MON_DEFINED + +#endif // CYGONCE_HAL_PLATFORM_INC diff --git a/packages/hal/sh/hs7729pci/current/include/plf_cache.h b/packages/hal/sh/hs7729pci/current/include/plf_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/plf_cache.h @@ -0,0 +1,66 @@ +#ifndef CYGONCE_PLF_CACHE_H +#define CYGONCE_PLF_CACHE_H + +//============================================================================= +// +// plf_cache.h +// +// Platform specific cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-05-25 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +// Nothing here + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_PLF_CACHE_H +// End of plf_cache.h + diff --git a/packages/hal/sh/hs7729pci/current/include/plf_intr.h b/packages/hal/sh/hs7729pci/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/plf_intr.h @@ -0,0 +1,129 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// Platform specific Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-05-25 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the HS7729PCI board. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +//---------------------------------------------------------------------------- +// External interrupts +#define CYGNUM_HAL_INTERRUPT_EXTERNALS_BASE CYGNUM_HAL_INTERRUPT_LVL0 +#define CYGNUM_HAL_INTERRUPT_PCI CYGNUM_HAL_INTERRUPT_LVL0 +#define CYGNUM_HAL_INTERRUPT_UIO_IRQ4 CYGNUM_HAL_INTERRUPT_LVL1 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ1 CYGNUM_HAL_INTERRUPT_LVL2 +#define CYGNUM_HAL_INTERRUPT_UIO_IRQ12 CYGNUM_HAL_INTERRUPT_LVL3 +#define CYGNUM_HAL_INTERRUPT_PCMCIA_IRQ0 CYGNUM_HAL_INTERRUPT_LVL4 +#define CYGNUM_HAL_INTERRUPT_UIO_IRQ5 CYGNUM_HAL_INTERRUPT_LVL5 +#define CYGNUM_HAL_INTERRUPT_USB1 CYGNUM_HAL_INTERRUPT_LVL6 +#define CYGNUM_HAL_INTERRUPT_UIO_IRQ8 CYGNUM_HAL_INTERRUPT_LVL7 +#define CYGNUM_HAL_INTERRUPT_UIO_IRQ1 CYGNUM_HAL_INTERRUPT_LVL8 +#define CYGNUM_HAL_INTERRUPT_RESERVED1 CYGNUM_HAL_INTERRUPT_LVL9 +#define CYGNUM_HAL_INTERRUPT_PCMCIA_IRQ2 CYGNUM_HAL_INTERRUPT_LVL10 +#define CYGNUM_HAL_INTERRUPT_USB2 CYGNUM_HAL_INTERRUPT_LVL11 +#define CYGNUM_HAL_INTERRUPT_RESERVED2 CYGNUM_HAL_INTERRUPT_LVL12 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ5 CYGNUM_HAL_INTERRUPT_LVL13 +#define CYGNUM_HAL_INTERRUPT_UIO_IRQ3 CYGNUM_HAL_INTERRUPT_LVL14 + +// Decoded interrupts - these follow the INTC v3 vectors defined in +// var_intr.h +#define CYGNUM_HAL_INTERRUPT_PCIA 66 +#define CYGNUM_HAL_INTERRUPT_PCIB 67 +#define CYGNUM_HAL_INTERRUPT_PCIC 68 +#define CYGNUM_HAL_INTERRUPT_PCID 69 + +#define CYGNUM_HAL_ISR_PLF_MAX CYGNUM_HAL_INTERRUPT_PCID + +//---------------------------------------------------------------------------- +// Interrupt configuration extention macros +#define CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF(vec, level) \ + case CYGNUM_HAL_INTERRUPT_NMI: \ + /* fall through */ \ + case CYGNUM_HAL_INTERRUPT_LVL0 ... CYGNUM_HAL_INTERRUPT_LVL14: \ + /* Cannot change levels */ \ + break; \ + case CYGNUM_HAL_INTERRUPT_PCIA ... CYGNUM_HAL_INTERRUPT_PCID: \ + { \ + cyg_uint32 msk; \ + HAL_READ_UINT32(CYGARC_REG_SD0001_INT_ENABLE, msk); \ + msk &= ~(CYGARC_REG_SD0001_INT_INTA << ((vec) - CYGNUM_HAL_INTERRUPT_PCIA)); \ + msk |= CYGARC_REG_SD0001_INT_EN; \ + if ((level)) \ + msk |= CYGARC_REG_SD0001_INT_INTA << ((vec) - CYGNUM_HAL_INTERRUPT_PCIA); \ + HAL_WRITE_UINT32(CYGARC_REG_SD0001_INT_ENABLE, msk); \ + break; \ + } + +#define CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF(vec) \ + CYG_MACRO_START \ + if (vec >= CYGNUM_HAL_INTERRUPT_PCIA && vec <= CYGNUM_HAL_INTERRUPT_PCID) { \ + cyg_uint32 sts = CYGARC_REG_SD0001_INT_INTA << (vec - CYGNUM_HAL_INTERRUPT_PCIA); \ + HAL_WRITE_UINT32(CYGARC_REG_SD0001_INT_STS1, sts); \ + } \ + CYG_MACRO_END + +//---------------------------------------------------------------------------- +// Reset. +// Block interrupts and cause an exception. This forces a reset. +#define HAL_PLATFORM_RESET() \ + asm volatile ("ldc %0,sr;trapa #0x00;" : : "r" (CYGARC_REG_SR_BL)) + +#define HAL_PLATFORM_RESET_ENTRY 0x80000000 + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/sh/hs7729pci/current/include/plf_io.h b/packages/hal/sh/hs7729pci/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/plf_io.h @@ -0,0 +1,169 @@ +#ifndef CYGONCE_PLF_IO_H +#define CYGONCE_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// Platform specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-05-29 +// Purpose: HS7729PCI SD0001 PCI IO support macros +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include // IO macros +#include // SD0001 registers +#include // interrupt + +extern cyg_uint32 cyg_hal_plf_pci_cfg_read_dword (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset); +extern cyg_uint16 cyg_hal_plf_pci_cfg_read_word (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset); +extern cyg_uint8 cyg_hal_plf_pci_cfg_read_byte (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset); +extern void cyg_hal_plf_pci_cfg_write_dword (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint32 val); +extern void cyg_hal_plf_pci_cfg_write_word (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint16 val); +extern void cyg_hal_plf_pci_cfg_write_byte (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint8 val); + + +// Initialize the PCI bus. +externC void cyg_hal_plf_pci_init(void); +#define HAL_PCI_INIT() cyg_hal_plf_pci_init() + +// Map PCI device resources starting from these addresses in PCI space. +#define HAL_PCI_ALLOC_BASE_IO 0x00000000 +#define HAL_PCI_ALLOC_BASE_MEMORY 0x00000000 + +// This is where the PCI spaces are mapped in the CPU's address space. +#define HAL_PCI_PHYSICAL_IO_BASE 0xb0800000 +#define HAL_PCI_PHYSICAL_MEMORY_BASE 0xb1000000 + +// Read a value from the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +#define HAL_PCI_CFG_READ_UINT8( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_plf_pci_cfg_read_byte((__bus), (__devfn), (__offset)) + +#define HAL_PCI_CFG_READ_UINT16( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_plf_pci_cfg_read_word((__bus), (__devfn), (__offset)) + +#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_plf_pci_cfg_read_dword((__bus), (__devfn), (__offset)) + +// Write a value to the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +#define HAL_PCI_CFG_WRITE_UINT8( __bus, __devfn, __offset, __val ) \ + cyg_hal_plf_pci_cfg_write_byte((__bus), (__devfn), (__offset), (__val)) + +#define HAL_PCI_CFG_WRITE_UINT16( __bus, __devfn, __offset, __val ) \ + cyg_hal_plf_pci_cfg_write_word((__bus), (__devfn), (__offset), (__val)) + +#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \ + cyg_hal_plf_pci_cfg_write_dword((__bus), (__devfn), (__offset), (__val)) + +// Read/write data to PCI IO space +#if 0 + +extern void cyg_hal_plf_pci_io_write_byte (cyg_uint32 addr, cyg_uint8 data); +extern void cyg_hal_plf_pci_io_write_word (cyg_uint32 addr, cyg_uint16 data); +extern void cyg_hal_plf_pci_io_write_dword (cyg_uint32 addr, cyg_uint32 data); +extern cyg_uint8 cyg_hal_plf_pci_io_read_byte (cyg_uint32 addr); +extern cyg_uint16 cyg_hal_plf_pci_io_read_word (cyg_uint32 addr); +extern cyg_uint32 cyg_hal_plf_pci_io_read_dword (cyg_uint32 addr); + +#define HAL_PCI_IO_READ_UINT8(addr, datum) datum = cyg_hal_plf_pci_io_read_byte((cyg_uint32)addr) +#define HAL_PCI_IO_READ_UINT16(addr, datum) datum = cyg_hal_plf_pci_io_read_word((cyg_uint32)addr) +#define HAL_PCI_IO_READ_UINT32(addr, datum) datum = cyg_hal_plf_pci_io_read_dword((cyg_uint32)addr) +#define HAL_PCI_IO_WRITE_UINT8(addr, datum) cyg_hal_plf_pci_io_write_byte((cyg_uint32)addr, datum) +#define HAL_PCI_IO_WRITE_UINT16(addr, datum) cyg_hal_plf_pci_io_write_word((cyg_uint32)addr, datum) +#define HAL_PCI_IO_WRITE_UINT32(addr, datum) cyg_hal_plf_pci_io_write_dword((cyg_uint32)addr, datum) +#endif + +// Translate the PCI interrupt requested by the device (INTA#, INTB#, +// INTC# or INTD#) to the associated CPU interrupt (i.e., HAL vector). +#define HAL_PCI_TRANSLATE_INTERRUPT( __bus, __devfn, __vec, __valid) \ + CYG_MACRO_START \ + cyg_uint8 __req; \ + HAL_PCI_CFG_READ_UINT8(__bus, __devfn, CYG_PCI_CFG_INT_PIN, __req); \ + if (0 != __req) { \ + CYG_ADDRWORD __translation[4] = { \ + CYGNUM_HAL_INTERRUPT_PCIC, \ + CYGNUM_HAL_INTERRUPT_PCIB, \ + CYGNUM_HAL_INTERRUPT_PCIA, \ + CYGNUM_HAL_INTERRUPT_PCID}; \ + \ + __vec = __translation[((__req+CYG_PCI_DEV_GET_DEV(__devfn))&3)]; \ + __valid = true; \ + } else { \ + /* Device will not generate interrupt requests. */ \ + __valid = false; \ + } \ + CYG_MACRO_END + + +// Can only do local bus (I think, my Japanese isn't good enough to be sure :) +// Ignore all but the first function on the SD0001 +#define HAL_PCI_IGNORE_DEVICE(__bus, __dev, __fn) \ + ((0 != __bus) \ + || ((0 == __dev) && (0 != __fn))) + +// Bus address translation macros +#define HAL_PCI_CPU_TO_BUS(__cpu_addr, __bus_addr) \ + CYG_MACRO_START \ + (__bus_addr) = CYGARC_BUS_ADDRESS(__cpu_addr); \ + CYG_MACRO_END + +#define HAL_PCI_BUS_TO_CPU(__bus_addr, __cpu_addr) \ + CYG_MACRO_START \ + (__cpu_addr) = CYGARC_UNCACHED_ADDRESS(__bus_addr); \ + CYG_MACRO_END + + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_PLF_IO_H diff --git a/packages/hal/sh/hs7729pci/current/include/plf_stub.h b/packages/hal/sh/hs7729pci/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/include/plf_stub.h @@ -0,0 +1,88 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-05-25 +// Purpose: Platform HAL stub support for Hitachi HS7729PCI board. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#ifdef CYGPKG_IO_SERIAL +#include +#endif + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM, externC + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/sh/hs7729pci/current/misc/redboot_RAM.ecm b/packages/hal/sh/hs7729pci/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/misc/redboot_RAM.ecm @@ -0,0 +1,72 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware hs7729pci ; + template redboot ; + package -hardware CYGPKG_HAL_SH current ; + package -hardware CYGPKG_HAL_SH_SH3 current ; + package -hardware CYGPKG_HAL_SH_SH7729_HS7729PCI current ; + package -hardware CYGPKG_DEVS_FLASH_SH_HS7729PCI current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_SH_HS7729PCI current ; + package -hardware CYGPKG_DEVS_ETH_VIA_RHINE current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGHWR_HAL_SH_BIGENDIAN { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_SH_7729 { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + inferred_value 1 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/hs7729pci/current/misc/redboot_ROM.ecm b/packages/hal/sh/hs7729pci/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/misc/redboot_ROM.ecm @@ -0,0 +1,80 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware hs7729pci ; + template redboot ; + package -hardware CYGPKG_HAL_SH current ; + package -hardware CYGPKG_HAL_SH_SH3 current ; + package -hardware CYGPKG_HAL_SH_SH7729_HS7729PCI current ; + package -hardware CYGPKG_DEVS_FLASH_SH_HS7729PCI current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_ETH_SH_HS7729PCI current ; + package -hardware CYGPKG_DEVS_ETH_VIA_RHINE current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 4096 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGHWR_HAL_SH_BIGENDIAN { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_SH_7729 { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + inferred_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/hs7729pci/current/misc/split_words.c b/packages/hal/sh/hs7729pci/current/misc/split_words.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/misc/split_words.c @@ -0,0 +1,95 @@ +//============================================================================= +// +// split_words.c +// +// Quick hack to handle splitting of binary images into .lo and .hi files +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-05-29 +// Purpose: Split binary ROM image into .hi and .lo parts for EPROMs +// Description: Usage: +// split_words install/bin/redboot.bin +// +// Will output file out.lo and out.hi which should be programmed +// to the EPROMs. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + + + +#include +#include +#include +#include +#include + +int +main(int argc, char** argv) +{ + int fi, f1, f2; + ssize_t s1, s2; + fi = open(argv[1], O_RDONLY); + f1 = open("out.lo", O_WRONLY|O_CREAT|O_TRUNC, 0666); + f2 = open("out.hi", O_WRONLY|O_CREAT|O_TRUNC, 0666); + + if (-1 == f1 || -1 == f2) { + fprintf(stderr, "failed to open output files\n"); + return -1; + } + + if (-1 == fi) { + fprintf(stderr, "failed to open input file\n"); + return -1; + } + + do { + unsigned char b[4]; + s1 = read(fi, b, 4); + + if (s1 == 4) { + write(f1, b, 2); + write(f2, b+2, 2); + } + } while (s1); + + return 0; +} diff --git a/packages/hal/sh/hs7729pci/current/src/hal_diag.c b/packages/hal/sh/hs7729pci/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/src/hal_diag.c @@ -0,0 +1,84 @@ +//============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-05-25 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include // our header. + +#include // Calling interface +#include // Interrupt macros +#include // driver API + +//----------------------------------------------------------------------------- + +externC void cyg_hal_plf_serial_init(void); + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + // SuperIO claims channels 0-1 for COM1/COM2 connectors on + // the back of the chassis. + cyg_hal_plf_serial_init(); + // Debug connector on mainboard is SCIF2. + cyg_hal_plf_scif_init(0, 2, CYGNUM_HAL_INTERRUPT_SCIF_RXI2, + (cyg_uint8*)CYGARC_REG_SCIF_SCSMR2); +} + +//----------------------------------------------------------------------------- +// End of hal_diag.c diff --git a/packages/hal/sh/hs7729pci/current/src/plf_misc.c b/packages/hal/sh/hs7729pci/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/src/plf_misc.c @@ -0,0 +1,446 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-05-25 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include // interfacing API +#include +#include // interrupt handling + +//-------------------------------------------------------------------------- +externC void cyg_hal_init_superIO(void); +static cyg_uint32 cyg_hal_plf_pci_arbiter(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +static cyg_interrupt intr; +static cyg_handle_t intr_handle; + +void +hal_platform_init(void) +{ + // Init superIO before calling if_init (which will use UARTs) + cyg_hal_init_superIO(); + + hal_if_init(); + +#if defined(CYGPKG_REDBOOT) && defined(CYGPKG_IO_PCI) + cyg_hal_plf_pci_init(); +#endif + + // Set up interrupt arbiter + cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_PCI, 1, + 0, cyg_hal_plf_pci_arbiter, NULL, + &intr_handle, &intr); + cyg_drv_interrupt_attach(intr_handle); + cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_PCI); +} + +#if defined(CYGPKG_IO_PCI) +//-------------------------------------------------------------------------- +// PCI stuff + +// For some reason the PCI config cycles only succeed with some +// delays at suitable places. +#define _DELAY() do { int i; for (i = 0; i < 100; i++) ; } while(0) + +#include +#include +#include +#include // hal_call_isr + +void +cyg_hal_plf_pci_init(void) +{ + cyg_uint8 next_bus; + + static int initialized = 0; + if (initialized) return; + initialized = 1; + + // Set PCI bases + HAL_WRITE_UINT32(CYGARC_REG_PCI_IO_MEMOFFSET, CYGARC_BUS_ADDRESS(HAL_PCI_ALLOC_BASE_IO)); + HAL_WRITE_UINT32(CYGARC_REG_PCI_MEM_MEMOFFSET, CYGARC_BUS_ADDRESS(HAL_PCI_ALLOC_BASE_MEMORY)); + + // Reset PCI - this does not have the desired effect; devices remain enabled. + HAL_WRITE_UINT32(CYGARC_REG_SD0001_RESET, CYGARC_REG_SD0001_RESET_PCIRST); + CYGACC_CALL_IF_DELAY_US(100); + + // Bring PCI out of reset + HAL_WRITE_UINT32(CYGARC_REG_SD0001_RESET, 0); + CYGACC_CALL_IF_DELAY_US(10000); + + // Set PCI access timeouts/retries to max + HAL_WRITE_UINT32(CYGARC_REG_SD0001_PCI_CTL, (CYGARC_REG_SD0001_PCI_CTL_MAX_DEADLOCK_CNT + |CYGARC_REG_SD0001_PCI_CTL_MAX_RETRY_CNT)); + CYGACC_CALL_IF_DELAY_US(10000); + + // Enable controller + // Setup for bus mastering + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_COMMAND, + CYG_PCI_CFG_COMMAND_MEMORY | + CYG_PCI_CFG_COMMAND_MASTER | + CYG_PCI_CFG_COMMAND_PARITY | + CYG_PCI_CFG_COMMAND_SERR); + + // Setup latency timer field + cyg_hal_plf_pci_cfg_write_byte(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_LATENCY_TIMER, 32); + + // Set memory base + cyg_hal_plf_pci_cfg_write_dword(0, CYG_PCI_DEV_MAKE_DEVFN(0,0), + CYG_PCI_CFG_BAR_1, 0x0c000008); + + // Configure PCI bus. + next_bus = 1; + cyg_pci_configure_bus(0, &next_bus); +} + +//-------------------------------------------------------------------------- +// Config space accessor functions +cyg_uint32 +cyg_hal_plf_pci_cfg_read_dword (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset) +{ + cyg_uint32 config_data; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, + CYGARC_REG_PCI_CFG_ADDR_ENABLE | + (bus << CYGARC_REG_PCI_CFG_ADDR_BUSNO_shift) | + (devfn << CYGARC_REG_PCI_CFG_ADDR_FUNC_shift) | + (offset)); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, CYGARC_REG_PCI_CFG_CMD_RCFG); + _DELAY(); + HAL_READ_UINT32(CYGARC_REG_PCI_CFG_DATA, config_data); + + return config_data; +} + +cyg_uint16 +cyg_hal_plf_pci_cfg_read_word (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset) +{ + cyg_uint32 config_dword; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, + CYGARC_REG_PCI_CFG_ADDR_ENABLE | + (bus << CYGARC_REG_PCI_CFG_ADDR_BUSNO_shift) | + (devfn << CYGARC_REG_PCI_CFG_ADDR_FUNC_shift) | + (offset & ~3)); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, CYGARC_REG_PCI_CFG_CMD_RCFG); + _DELAY(); + HAL_READ_UINT32(CYGARC_REG_PCI_CFG_DATA, config_dword); + + return (cyg_uint16)((config_dword >> ((offset & 3) * 8)) & 0xffff); +} + +cyg_uint8 +cyg_hal_plf_pci_cfg_read_byte (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset) +{ + cyg_uint32 config_dword; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, + CYGARC_REG_PCI_CFG_ADDR_ENABLE | + (bus << CYGARC_REG_PCI_CFG_ADDR_BUSNO_shift) | + (devfn << CYGARC_REG_PCI_CFG_ADDR_FUNC_shift) | + (offset & ~3)); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, CYGARC_REG_PCI_CFG_CMD_RCFG); + _DELAY(); + HAL_READ_UINT32(CYGARC_REG_PCI_CFG_DATA, config_dword); + + return (cyg_uint8)((config_dword >> ((offset & 3) * 8)) & 0xff); +} + +void +cyg_hal_plf_pci_cfg_write_dword (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint32 data) +{ + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, + CYGARC_REG_PCI_CFG_ADDR_ENABLE | + (bus << CYGARC_REG_PCI_CFG_ADDR_BUSNO_shift) | + (devfn << CYGARC_REG_PCI_CFG_ADDR_FUNC_shift) | + (offset)); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_DATA, data); + _DELAY(); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, CYGARC_REG_PCI_CFG_CMD_WCFG); + _DELAY(); +} + +void +cyg_hal_plf_pci_cfg_write_word (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint16 data) +{ + cyg_uint32 config_dword, shift; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, + CYGARC_REG_PCI_CFG_ADDR_ENABLE | + (bus << CYGARC_REG_PCI_CFG_ADDR_BUSNO_shift) | + (devfn << CYGARC_REG_PCI_CFG_ADDR_FUNC_shift) | + (offset & ~3)); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, CYGARC_REG_PCI_CFG_CMD_RCFG); + _DELAY(); + HAL_READ_UINT32(CYGARC_REG_PCI_CFG_DATA, config_dword); + + shift = (offset & 3) * 8; + config_dword &= ~(0xffff << shift); + config_dword |= (data << shift); + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, + CYGARC_REG_PCI_CFG_ADDR_ENABLE | + (bus << CYGARC_REG_PCI_CFG_ADDR_BUSNO_shift) | + (devfn << CYGARC_REG_PCI_CFG_ADDR_FUNC_shift) | + (offset & ~3)); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_DATA, config_dword); + _DELAY(); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, CYGARC_REG_PCI_CFG_CMD_WCFG); + _DELAY(); +} + +void +cyg_hal_plf_pci_cfg_write_byte (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint8 data) +{ + cyg_uint32 config_dword, shift; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, + CYGARC_REG_PCI_CFG_ADDR_ENABLE | + (bus << CYGARC_REG_PCI_CFG_ADDR_BUSNO_shift) | + (devfn << CYGARC_REG_PCI_CFG_ADDR_FUNC_shift) | + (offset & ~3)); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, CYGARC_REG_PCI_CFG_CMD_RCFG); + _DELAY(); + HAL_READ_UINT32(CYGARC_REG_PCI_CFG_DATA, config_dword); + + shift = (offset & 3) * 8; + config_dword &= ~(0xff << shift); + config_dword |= (data << shift); + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, + CYGARC_REG_PCI_CFG_ADDR_ENABLE | + (bus << CYGARC_REG_PCI_CFG_ADDR_BUSNO_shift) | + (devfn << CYGARC_REG_PCI_CFG_ADDR_FUNC_shift) | + (offset & ~3)); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_DATA, config_dword); + _DELAY(); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, CYGARC_REG_PCI_CFG_CMD_WCFG); + _DELAY(); +} + +//-------------------------------------------------------------------------- +// IO space accessor functions + +#if 0 // Don't need these after all. But keep them around just in case... + +static void +pci_io_delay(void) +{ + int i = 100; + cyg_uint32 flg; + do { + HAL_READ_UINT32(CYGARC_REG_PCI_CFG_FLG, flg); + } while (i-- && (flg & CYGARC_REG_PCI_CFG_FLG_ACTIVE)); + + // FIXME: what happens on timeout? Do we need to fill in 0xfffffff + // in read data, by any chance? +} + +static void +pci_io_status(void) +{ + // FIXME: check status... +} + + +void +cyg_hal_plf_pci_io_write_byte (cyg_uint32 addr, cyg_uint8 data) +{ + cyg_uint32 io_addr = addr - HAL_PCI_PHYSICAL_IO_BASE; + int shift = io_addr & 3; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_DATA, ((cyg_uint32)data << (8*shift))); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, io_addr & ~3); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, (CYGARC_REG_PCI_CFG_CMD_BE0 << shift) + | CYGARC_REG_PCI_CFG_CMD_CMDEN + | CYGARC_REG_PCI_CFG_CMD_IO_WRITE + | CYGARC_REG_PCI_CFG_CMD_WT); + pci_io_delay(); +} + +void +cyg_hal_plf_pci_io_write_word (cyg_uint32 addr, cyg_uint16 data) +{ + cyg_uint32 io_addr = addr - HAL_PCI_PHYSICAL_IO_BASE; + int shift = io_addr & 2; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_DATA, ((cyg_uint32)data << (8*shift))); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, io_addr & ~3); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, ((CYGARC_REG_PCI_CFG_CMD_BE1|CYGARC_REG_PCI_CFG_CMD_BE0) << shift) + | CYGARC_REG_PCI_CFG_CMD_CMDEN + | CYGARC_REG_PCI_CFG_CMD_IO_WRITE + | CYGARC_REG_PCI_CFG_CMD_WT); + pci_io_delay(); +} + +void +cyg_hal_plf_pci_io_write_dword (cyg_uint32 addr, cyg_uint32 data) +{ + cyg_uint32 io_addr = addr - HAL_PCI_PHYSICAL_IO_BASE; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_DATA, data); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, io_addr & ~3); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, + (CYGARC_REG_PCI_CFG_CMD_BE3|CYGARC_REG_PCI_CFG_CMD_BE2 + | CYGARC_REG_PCI_CFG_CMD_BE1|CYGARC_REG_PCI_CFG_CMD_BE0) + | CYGARC_REG_PCI_CFG_CMD_CMDEN + | CYGARC_REG_PCI_CFG_CMD_IO_WRITE + | CYGARC_REG_PCI_CFG_CMD_WT); + pci_io_delay(); +} + +cyg_uint8 +cyg_hal_plf_pci_io_read_byte (cyg_uint32 addr) +{ + cyg_uint32 io_addr = addr - HAL_PCI_PHYSICAL_IO_BASE; + cyg_uint32 data; + int shift = io_addr & 3; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, io_addr & ~3); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, (CYGARC_REG_PCI_CFG_CMD_BE0 << shift) + | CYGARC_REG_PCI_CFG_CMD_CMDEN + | CYGARC_REG_PCI_CFG_CMD_IO_READ + | CYGARC_REG_PCI_CFG_CMD_RD); + pci_io_delay(); + HAL_READ_UINT32(CYGARC_REG_PCI_CFG_DATA, data); + return (cyg_uint8)(0xff & (data >> (8*shift))); +} + +cyg_uint16 +cyg_hal_plf_pci_io_read_word (cyg_uint32 addr) +{ + cyg_uint32 io_addr = addr - HAL_PCI_PHYSICAL_IO_BASE; + cyg_uint32 data; + int shift = io_addr & 2; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, io_addr & ~3); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, ((CYGARC_REG_PCI_CFG_CMD_BE1|CYGARC_REG_PCI_CFG_CMD_BE0) << shift) + | CYGARC_REG_PCI_CFG_CMD_CMDEN + | CYGARC_REG_PCI_CFG_CMD_IO_READ + | CYGARC_REG_PCI_CFG_CMD_RD); + pci_io_delay(); + HAL_READ_UINT32(CYGARC_REG_PCI_CFG_DATA, data); + return (cyg_uint16)(0xffff & (data >> (shift*8))); +} + +cyg_uint32 +cyg_hal_plf_pci_io_read_dword (cyg_uint32 addr) +{ + cyg_uint32 io_addr = addr - HAL_PCI_PHYSICAL_IO_BASE; + cyg_uint32 data; + + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_ADDR, io_addr & ~3); + HAL_WRITE_UINT32(CYGARC_REG_PCI_CFG_CMD, + (CYGARC_REG_PCI_CFG_CMD_BE3|CYGARC_REG_PCI_CFG_CMD_BE2 + | CYGARC_REG_PCI_CFG_CMD_BE1|CYGARC_REG_PCI_CFG_CMD_BE0) + | CYGARC_REG_PCI_CFG_CMD_CMDEN + | CYGARC_REG_PCI_CFG_CMD_IO_READ + | CYGARC_REG_PCI_CFG_CMD_RD); + pci_io_delay(); + HAL_READ_UINT32(CYGARC_REG_PCI_CFG_DATA, data); + return data; +} +#endif + +//-------------------------------------------------------------------------- +// PCI interrupt decoding +static cyg_uint32 +cyg_hal_plf_pci_arbiter(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + cyg_uint32 isr_ret, int_sts; + + HAL_READ_UINT32(CYGARC_REG_SD0001_INT_STS1, int_sts); + if (int_sts & CYGARC_REG_SD0001_INT_INTA) { + isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_PCIA); +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if (isr_ret & CYG_ISR_HANDLED) +#endif + return isr_ret; + } + if (int_sts & CYGARC_REG_SD0001_INT_INTB) { + isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_PCIB); +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if (isr_ret & CYG_ISR_HANDLED) +#endif + return isr_ret; + } + if (int_sts & CYGARC_REG_SD0001_INT_INTC) { + isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_PCIC); +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if (isr_ret & CYG_ISR_HANDLED) +#endif + return isr_ret; + } + if (int_sts & CYGARC_REG_SD0001_INT_INTD) { + isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_PCID); +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if (isr_ret & CYG_ISR_HANDLED) +#endif + return isr_ret; + } + + return 0; +} + + +#endif // CYGPKG_IO_PCI +//-------------------------------------------------------------------------- +// eof plf_misc.c diff --git a/packages/hal/sh/hs7729pci/current/src/ser16c550c.c b/packages/hal/sh/hs7729pci/current/src/ser16c550c.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/src/ser16c550c.c @@ -0,0 +1,554 @@ +//============================================================================= +// +// ser16c550c.c +// +// Simple driver for the 16c550c serial controllers on the HS7729PCI board +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley +// Contributors:dmoseley, jskov +// Date: 2001-03-20 +// Description: Simple driver for the 16c550c serial controller +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interface API +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // Helper functions +#include // CYG_ISR_HANDLED + +//----------------------------------------------------------------------------- +// Define the serial registers. The Malta board is equipped with a 16550C +// serial chip. +#define HS7729PCI_SER_CLOCK 1846200 +#define HS7729PCI_SER_16550_BASE_A 0xa80007f0 +#define HS7729PCI_SER_16550_BASE_B 0xa80005f0 +#define SER_16550_RBR 0x00 // receiver buffer register, read, dlab = 0 +#define SER_16550_THR 0x00 // transmitter holding register, write, dlab = 0 +#define SER_16550_DLL 0x00 // divisor latch (LS), read/write, dlab = 1 +#define SER_16550_IER 0x02 // interrupt enable register, read/write, dlab = 0 +#define SER_16550_DLM 0x02 // divisor latch (MS), read/write, dlab = 1 +#define SER_16550_IIR 0x04 // interrupt identification reg, read, dlab = 0 +#define SER_16550_FCR 0x04 // fifo control register, write, dlab = 0 +#define SER_16550_AFR 0x04 // alternate function reg, read/write, dlab = 1 +#define SER_16550_LCR 0x06 // line control register, read/write +#define SER_16550_MCR 0x08 // modem control register, read/write +#define SER_16550_LSR 0x0a // line status register, read +#define SER_16550_MSR 0x0c // modem status register, read +#define SER_16550_SCR 0x0e // scratch pad register + +// The interrupt enable register bits. +#define SIO_IER_ERDAI 0x01 // enable received data available irq +#define SIO_IER_ETHREI 0x02 // enable THR empty interrupt +#define SIO_IER_ELSI 0x04 // enable receiver line status irq +#define SIO_IER_EMSI 0x08 // enable modem status interrupt + +// The interrupt identification register bits. +#define SIO_IIR_IP 0x01 // 0 if interrupt pending +#define SIO_IIR_ID_MASK 0x0e // mask for interrupt ID bits + +// The line status register bits. +#define SIO_LSR_DR 0x01 // data ready +#define SIO_LSR_OE 0x02 // overrun error +#define SIO_LSR_PE 0x04 // parity error +#define SIO_LSR_FE 0x08 // framing error +#define SIO_LSR_BI 0x10 // break interrupt +#define SIO_LSR_THRE 0x20 // transmitter holding register empty +#define SIO_LSR_TEMT 0x40 // transmitter register empty +#define SIO_LSR_ERR 0x80 // any error condition + +// The modem status register bits. +#define SIO_MSR_DCTS 0x01 // delta clear to send +#define SIO_MSR_DDSR 0x02 // delta data set ready +#define SIO_MSR_TERI 0x04 // trailing edge ring indicator +#define SIO_MSR_DDCD 0x08 // delta data carrier detect +#define SIO_MSR_CTS 0x10 // clear to send +#define SIO_MSR_DSR 0x20 // data set ready +#define SIO_MSR_RI 0x40 // ring indicator +#define SIO_MSR_DCD 0x80 // data carrier detect + +// The line control register bits. +#define SIO_LCR_WLS0 0x01 // word length select bit 0 +#define SIO_LCR_WLS1 0x02 // word length select bit 1 +#define SIO_LCR_STB 0x04 // number of stop bits +#define SIO_LCR_PEN 0x08 // parity enable +#define SIO_LCR_EPS 0x10 // even parity select +#define SIO_LCR_SP 0x20 // stick parity +#define SIO_LCR_SB 0x40 // set break +#define SIO_LCR_DLAB 0x80 // divisor latch access bit + +// The FIFO control register +#define SIO_FCR_FCR0 0x01 // enable xmit and rcvr fifos +#define SIO_FCR_FCR1 0x02 // clear RCVR FIFO +#define SIO_FCR_FCR2 0x04 // clear XMIT FIFO + +///////////////////////////////////////// +// Interrupt Enable Register +#define IER_RCV 0x01 +#define IER_XMT 0x02 +#define IER_LS 0x04 +#define IER_MS 0x08 + +// Line Control Register +#define LCR_WL5 0x00 // Word length +#define LCR_WL6 0x01 +#define LCR_WL7 0x02 +#define LCR_WL8 0x03 +#define LCR_SB1 0x00 // Number of stop bits +#define LCR_SB1_5 0x04 // 1.5 -> only valid with 5 bit words +#define LCR_SB2 0x04 +#define LCR_PN 0x00 // Parity mode - none +#define LCR_PE 0x0C // Parity mode - even +#define LCR_PO 0x08 // Parity mode - odd +#define LCR_PM 0x28 // Forced "mark" parity +#define LCR_PS 0x38 // Forced "space" parity +#define LCR_DL 0x80 // Enable baud rate latch + +// Line Status Register +#define LSR_RSR 0x01 +#define LSR_THE 0x20 + +// Modem Control Register +#define MCR_DTR 0x01 +#define MCR_RTS 0x02 +#define MCR_INT 0x08 // Enable interrupts +#define MCR_AFE 0x20 + +// Interrupt status register +#define ISR_None 0x01 +#define ISR_Rx_Line_Status 0x06 +#define ISR_Rx_Avail 0x04 +#define ISR_Rx_Char_Timeout 0x0C +#define ISR_Tx_Empty 0x02 +#define IRS_Modem_Status 0x00 + +// FIFO control register +#define FCR_ENABLE 0x01 +#define FCR_CLEAR_RCVR 0x02 +#define FCR_CLEAR_XMIT 0x04 + +#define CYG_DEV_SERIAL_BAUD_DIVISOR (HS7729PCI_SER_CLOCK/16/CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD) + +//----------------------------------------------------------------------------- + +#define UART_READ_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + cyg_uint16 t; \ + HAL_READ_UINT16((_a_), t); \ + (_d_) = (t >> 8) & 0xff; \ + CYG_MACRO_END + +#define UART_WRITE_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT16((_a_), (_d_)<<8); \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +static const channel_data_t channels[2] = { + { (cyg_uint8*)HS7729PCI_SER_16550_BASE_A, 1000, CYGNUM_HAL_INTERRUPT_UIO_IRQ3 }, + { (cyg_uint8*)HS7729PCI_SER_16550_BASE_B, 1000, CYGNUM_HAL_INTERRUPT_UIO_IRQ4 } +}; + +//----------------------------------------------------------------------------- +// Set the baud rate + +static void +cyg_hal_plf_serial_set_baud(cyg_uint8* port, cyg_uint16 baud_divisor) +{ + cyg_uint8 _lcr; + + UART_READ_UINT8(port+SER_16550_LCR, _lcr); + _lcr |= LCR_DL; + UART_WRITE_UINT8(port+SER_16550_LCR, _lcr); + + UART_WRITE_UINT8(port+SER_16550_DLM, baud_divisor >> 8); + UART_WRITE_UINT8(port+SER_16550_DLL, baud_divisor & 0xff); + + _lcr &= ~LCR_DL; + UART_WRITE_UINT8(port+SER_16550_LCR, _lcr); +} + +//----------------------------------------------------------------------------- +// The minimal init, get and put functions. All by polling. + +void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + cyg_uint8* port; + cyg_uint8 _lcr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + // Disable port interrupts while changing hardware + UART_WRITE_UINT8(port+SER_16550_IER, 0); + + // Set databits, stopbits and parity. + _lcr = LCR_WL8 | LCR_SB1 | LCR_PN; + UART_WRITE_UINT8(port+SER_16550_LCR, _lcr); + + // Set baud rate. + cyg_hal_plf_serial_set_baud(port, CYG_DEV_SERIAL_BAUD_DIVISOR); + + // Enable and clear FIFO + UART_WRITE_UINT8(port+SER_16550_FCR, (FCR_ENABLE | FCR_CLEAR_RCVR | FCR_CLEAR_XMIT)); + + // enable RTS to keep host side happy. Also allow interrupts + UART_WRITE_UINT8( port+SER_16550_MCR, MCR_DTR | MCR_RTS | MCR_INT); + + // Don't allow interrupts. + UART_WRITE_UINT8(port+SER_16550_IER, 0); +} + +void +cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 __ch) +{ + cyg_uint8* port; + cyg_uint8 _lsr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + CYGARC_HAL_SAVE_GP(); + + do { + UART_READ_UINT8(port+SER_16550_LSR, _lsr); + } while ((_lsr & SIO_LSR_THRE) == 0); + + // Now, the transmit buffer is empty + UART_WRITE_UINT8(port+SER_16550_THR, __ch); + + // Hang around until the character has been safely sent. + do { + UART_READ_UINT8(port+SER_16550_LSR, _lsr); + } while ((_lsr & SIO_LSR_THRE) == 0); + + CYGARC_HAL_RESTORE_GP(); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* port; + cyg_uint8 _lsr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + UART_READ_UINT8(port+SER_16550_LSR, _lsr); + if ((_lsr & SIO_LSR_DR) == 0) + return false; + + UART_READ_UINT8(port+SER_16550_RBR, *ch); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan; + cyg_uint8 ier; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + UART_READ_UINT8(chan->base + SER_16550_IER, ier); + ier |= SIO_IER_ERDAI; + UART_WRITE_UINT8(chan->base + SER_16550_IER, ier); + + HAL_INTERRUPT_SET_LEVEL(chan->isr_vector, 1); + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + UART_READ_UINT8(chan->base + SER_16550_IER, ier); + ier &= ~SIO_IER_ERDAI; + UART_WRITE_UINT8(chan->base + SER_16550_IER, ier); + + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + break; + case __COMMCTL_SETBAUD: + { + cyg_uint32 baud_rate; + cyg_uint16 baud_divisor; + cyg_uint8* port = chan->base; + va_list ap; + + va_start(ap, __func); + baud_rate = va_arg(ap, cyg_uint32); + va_end(ap); + + baud_divisor = (HS7729PCI_SER_CLOCK / 16 / baud_rate); + + // Disable port interrupts while changing hardware + UART_READ_UINT8(port+SER_16550_IER, ier); + UART_WRITE_UINT8(port+SER_16550_IER, 0); + + // Set baud rate. + cyg_hal_plf_serial_set_baud(port, baud_divisor); + + // Reenable interrupts if necessary + UART_WRITE_UINT8(port+SER_16550_IER, ier); + } + break; + + case __COMMCTL_GETBAUD: + break; + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + cyg_uint8 _iir, c; + channel_data_t* chan; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + HAL_INTERRUPT_ACKNOWLEDGE(chan->isr_vector); + + UART_READ_UINT8(chan->base + SER_16550_IIR, _iir); + _iir &= SIO_IIR_ID_MASK; + + *__ctrlc = 0; + if ((_iir == ISR_Rx_Avail) || (_iir == ISR_Rx_Char_Timeout)) { + + UART_READ_UINT8(chan->base + SER_16550_RBR, c); + + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(channels[0].isr_vector); + HAL_INTERRUPT_MASK(channels[1].isr_vector); + + // Init channels + cyg_hal_plf_serial_init_channel((void*)&channels[0]); + cyg_hal_plf_serial_init_channel((void*)&channels[1]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Set channel 1 + CYGACC_CALL_IF_SET_CONSOLE_COMM(1); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[1]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +//----------------------------------------------------------------------------- +// end of ser16c550c.c diff --git a/packages/hal/sh/hs7729pci/current/src/smsc37c93x.c b/packages/hal/sh/hs7729pci/current/src/smsc37c93x.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/hs7729pci/current/src/smsc37c93x.c @@ -0,0 +1,158 @@ +//============================================================================= +// +// smsc37c93x.c +// +// Init code for SMSC 37C93x super IO controller +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-05-30 +// Description: Init code for SMSC 37C93x super IO controller +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interrupt vectors + + +//----------------------------------------------------------------------------- + +#define SMSC_READ_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + cyg_uint16 t; \ + HAL_READ_UINT16((_a_), t); \ + (_d_) = (t >> 8) & 0xff; \ + CYG_MACRO_END + +#define SMSC_WRITE_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT16((_a_), (_d_)<<8); \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- + +// From page 137+ in SMSC-37C93x.pdf +#define SMSC_CONFIG 0xa80007e0 +#define SMSC_CONFIG_DATA 0xa80007e2 + +#define SMSC_CONFIG_DEV 0x07 +#define SMSC_CONFIG_POWER 0x22 +#define SMSC_CONFIG_ACTIVATE 0x30 +#define SMSC_CONFIG_ENTER 0x55 +#define SMSC_CONFIG_BASE_HIGH 0x60 +#define SMSC_CONFIG_BASE_LOW 0x61 +#define SMSC_CONFIG_IRQ 0x70 +#define SMSC_CONFIG_EXIT 0xaa +#define SMSC_CONFIG_MODE 0xf0 + +#define SMSC_CONFIG_DEV_COM1 0x04 +#define SMSC_CONFIG_DEV_COM2 0x05 +#define SMSC_CONFIG_DEV_RTC 0x06 + +#define SMSC_CONFIG_MODE_HIGH 0x02 + +#define SMSC_CONFIG_ACTIVATE_ENABLE 0x01 + +#define SMSC_CONFIG_POWER_COM1 0x10 +#define SMSC_CONFIG_POWER_COM2 0x20 + + +void +cyg_hal_init_superIO(void) +{ + // Note: two writes unlike the 37m81x! + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ENTER); + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ENTER); + + // Power ON COM1 and COM2 + SMSC_WRITE_UINT8(SMSC_CONFIG_POWER, SMSC_CONFIG_POWER_COM1|SMSC_CONFIG_POWER_COM2); + + // Configure and enable COM1 + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_DEV); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_DEV_COM1); + + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_HIGH); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, 0x03); + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_LOW); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, 0xf8); + + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_IRQ); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, 3); // UIO_IRQ3 + + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_MODE); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_MODE_HIGH); + + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ACTIVATE); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_ACTIVATE_ENABLE); + + // Configure and enable COM2 + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_DEV); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_DEV_COM2); + + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_HIGH); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, 0x02); + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_LOW); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, 0xf8); + + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_IRQ); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, 4); // UIO_IRQ4 + + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_MODE); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_MODE_HIGH); + + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ACTIVATE); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_ACTIVATE_ENABLE); + + // Configure and enable RTC + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_DEV); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_DEV_RTC); + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ACTIVATE); + SMSC_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_ACTIVATE_ENABLE); + + SMSC_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_EXIT); +} + +//----------------------------------------------------------------------------- +// end of smsc37c93x.c diff --git a/packages/hal/sh/se7751/current/ChangeLog b/packages/hal/sh/se7751/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/ChangeLog @@ -0,0 +1,139 @@ +2002-05-08 Jesper Skov + + * src/hal_diag.c: Serial register renaming. + +2001-10-31 Jonathan Larmour + + * cdl/hal_sh_sh7751_se7751.cdl: Indicate support of variable baud rates. + +2001-09-25 Jesper Skov + + * include/plf_intr.h: Removed dummy + CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF and + CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF definitions. + +2001-07-24 Jesper Skov + + * src/plf_misc.c: Clear interrupt controller registers on startup. + + * include/plf_io.h (HAL_PCI_TRANSLATE_INTERRUPT): Rotate interrupts. + + * include/plf_intr.h (CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF): + Added handling for IRL vectors. Name IRL vectors. + + * src/ser16c550c.c: Changed interrupt vector (still unclear if + it's the right one). + +2001-07-17 Jesper Skov + + * cdl/hal_sh_sh7751_se7751.cdl: Create .eprom.srec version for + broken Hitachi loader. + + * misc/redboot_ROM.ecm: Enable caching. + * misc/redboot_RAM.ecm: Same. + + * src/plf_misc.c (hal_platform_init): Initialize + interrupt controller. + * include/plf_io.h (HAL_PCI_TRANSLATE_INTERRUPT): Use PCIA-D + interrupts. + * include/plf_intr.h: Put in a few guessed interrupts. Probably + not right. + +2001-07-16 Jesper Skov + + * src/plf_misc.c: Remove unused variables. + + * src/m1543c.c (cyg_hal_init_superIO): Try to init PCI->ISA + bridge. Not that it makes any sense - I don't see any device 2 in + the config space, but that's what the Hitachi monitor is + fiddling. Doesn't make a change though. + +2001-07-13 Jesper Skov + + * src/hal_diag.c (cyg_hal_plf_comms_init): Leave out superIO init + until it's working. + + * src/ser16c550c.c: Adjust offsets. + + * src/m1543c.c (cyg_hal_init_superIO): More setup code. + + * misc/redboot_RAM.ecm: Added eth driver. + +2001-07-11 Jesper Skov + + * include/plf_io.h (HAL_PCI_ALLOC_BASE_IO): Moved to 0x2000. + Scan all busses. + + * include/platform.inc: Fix warning. + +2001-07-10 Jesper Skov + + * include/pkgconf/mlt_sh_sh7751_se7751_ram.ldi: Hack in a PCI window. + * include/pkgconf/mlt_sh_sh7751_se7751_ram.mlt: Hack in a PCI window. + * include/pkgconf/mlt_sh_sh7751_se7751_ram.h: Hack in a PCI window. + + * include/plf_io.h (HAL_PCI_PHYSICAL_IO_BASE): zeroed since all IO + happens via functions. + + * cdl/hal_sh_sh7751_se7751.cdl: Want LE configurations. + + * include/plf_io.h: Leave PCI IO space for super IO controller. + + * cdl/hal_sh_sh7751_se7751.cdl: Compile m1543c file. + * src/m1543c.c: added. + + * src/ser16c550c.c: Changed addresses and setup code (still not + working). + + * src/plf_misc.c (hal_platform_init): Init super IO + controller. Init PCI. + + * src/hal_diag.c (cyg_hal_plf_comms_init): Also set up COM2. + + * src/plf_misc.c: Call PCI init during startup. + + * include/plf_io.h: Added PCI definitions. + +2001-07-09 Jesper Skov + + * cdl/hal_sh_sh7751_se7751.cdl: Removed superIO file, set default + mode. + +2001-07-09 Jesper Skov + + * New platform HAL. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/sh/se7751/current/cdl/hal_sh_sh7751_se7751.cdl b/packages/hal/sh/se7751/current/cdl/hal_sh_sh7751_se7751.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/cdl/hal_sh_sh7751_se7751.cdl @@ -0,0 +1,396 @@ +# ==================================================================== +# +# hal_sh_sh7751_se7751.cdl +# +# Hitachi SE7751 board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: jskov +# Contributors: +# Date: 2001-07-09 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_SH_SH7751_SE7751 { + display "Hitachi/SH7751 SE7751 board" + parent CYGPKG_HAL_SH + requires CYGPKG_HAL_SH_7751 + requires ! CYGHWR_HAL_SH_BIGENDIAN + requires CYGHWR_HAL_SH_IRQ_USE_IRQLVL + define_header hal_sh_sh7751_se7751.h + include_dir cyg/hal + description " + The SE7751 HAL package provides the support needed to run + eCos on a Hitachi/SH SE7751 board." + + compile hal_diag.c plf_misc.c ser16c550c.c m1543c.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + + puts $::cdl_header "#define CYGNUM_HAL_SH_SH4_SCIF_PORTS 1" + puts $::cdl_header "#define CYGHWR_HAL_VSR_TABLE 0x8c000000" + puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0x8c000100" + + puts $::cdl_header "#define HAL_PLATFORM_CPU \"SH 7751\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"SE7751\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM" "ROMRAM" } + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the SE7751 board it is possible to build + the system for either RAM bootstrap or ROM bootstrap. + RAM bootstrap generally requires that the board + is equipped with ROMs containing a suitable ROM monitor or + equivalent software that allows GDB to download the eCos + application on to the board. The ROM bootstrap typically + requires that the eCos application be blown into EPROMs or + equivalent technology. ROMRAM bootstrap is similar to ROM + bootstrap, but everything is copied to RAM before execution + starts thus improving performance, but at the cost of an + increased RAM footprint." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 2 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The SE7751 board has one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + The SE7751 board has two serial ports. This option + chooses which port will be used for diagnostic output." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD { + display "Console/GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + define CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD + description " + This option controls the default baud rate used for the + Console/GDB connection." + } + + cdl_component CYGHWR_HAL_SH_PLF_CLOCK_SETTINGS { + display "SH on-chip platform clock controls" + description " + The various clocks used by the system are derived from + these options." + flavor none + no_define + + cdl_option CYGHWR_HAL_SH_OOC_XTAL { + display "SH clock crystal" + flavor data + legal_values 8000000 to 50000000 + default_value 27000000 + no_define + description " + This option specifies the frequency of the crystal all + other clocks are derived from." + } + + cdl_option CYGHWR_HAL_SH_OOC_CKIO { + display "SH clock CKIO output enable" + default_value 1 + description " + This selects whether CKIO output is enabled." + } + + cdl_option CYGHWR_HAL_SH_OOC_PLL_1 { + display "SH clock PLL circuit 1" + flavor data + default_value 6 + legal_values { 0 6 } + description " + This selects the multiplication factor provided by + PLL1." + } + + cdl_option CYGHWR_HAL_SH_OOC_PLL_2 { + display "SH clock PLL circuit 2" + flavor data + default_value 1 + legal_values { 0 1 } + description " + This selects the multiplication factor provided by + PLL2. If PLL2 is disabled this option should + be set to zero." + } + + cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_1 { + display "SH clock divider 1" + flavor data + default_value 1 + legal_values { 1 2 } + description " + This divider option affects all clocks." + } + + cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_IFC { + display "SH CPU clock divider" + flavor data + default_value 1 + legal_values { 1 2 3 4 6 8 } + description " + This divider option affects the CPU clock." + } + + cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_BFC { + display "SH bus clock divider" + flavor data + default_value 3 + legal_values { 1 2 3 4 6 8 } + description " + This divider option affects the bus clock." + } + + cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_PFC { + display "SH peripheral clock divider" + flavor data + default_value 6 + legal_values { 1 2 3 4 6 8 } + description " + This divider option affects the peripheral clock." + } + + cdl_option CYGHWR_HAL_SH_OOC_CLOCK_MODE { + display "SH clock mode" + flavor data + default_value 3 + legal_values { 0 1 2 3 4 5 } + description " + This option must mirror the clock mode hardwired on + the MD0-MD2 pins of the CPU in order to correctly + initialize the FRQCR register." + } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + no_define + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "sh-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { CYGHWR_HAL_SH_BIGENDIAN ? "-mb -m3 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -ggdb -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : "-ml -m3 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -ggdb -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { CYGHWR_HAL_SH_BIGENDIAN ? "-mb -m3 -ggdb -nostdlib -Wl,--gc-sections -Wl,-static" : "-ml -m3 -ggdb -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "sh_sh7751_se7751_ram" : \ + CYG_HAL_STARTUP == "ROM" ? "sh_sh7751_se7751_rom" : \ + "sh_sh7751_se7751_romram" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + requires { CYG_HAL_STARTUP == "RAM" } + parent CYGPKG_HAL_ROM_MONITOR + description " + Support can be enabled for boot ROMs or ROM monitors which contain + GDB stubs. This support changes various eCos semantics such as + the encoding of diagnostic output, and the overriding of hardware + interrupt vectors." + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) --change-address 0x21000000 -O srec $< $(@:.bin=.eprom.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } +} diff --git a/packages/hal/sh/se7751/current/include/hal_diag.h b/packages/hal/sh/se7751/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/hal_diag.h @@ -0,0 +1,69 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +//============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-12 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +//----------------------------------------------------------------------------- +// end of hal_diag.h +#endif // CYGONCE_HAL_HAL_DIAG_H diff --git a/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_ram.h b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_ram.h @@ -0,0 +1,22 @@ +// eCos memory layout - Mon Jul 16 12:39:37 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x8c020000) +#define CYGMEM_REGION_ram_SIZE (0x3fe0000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x8ff00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_ram.ldi b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_ram.ldi @@ -0,0 +1,27 @@ +// eCos memory layout - Mon Jul 16 12:39:37 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x8c020000, LENGTH = 0x3fe0000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_vectors (ram, 0x8c020000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x8ff00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; + SECTIONS_END +} diff --git a/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_ram.mlt b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_ram.mlt @@ -0,0 +1,13 @@ +version 0 +region ram 8c020000 3fe0000 0 ! +section vectors 0 1 0 1 1 1 1 1 8c020000 8c020000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 8 0 1 0 1 0 1 rodata rodata ! +section rodata 0 8 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 8 0 1 0 1 0 1 bss bss ! +section bss 0 10 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 100000 1 0 0 1 0 1 0 8ff00000 8ff00000 ! diff --git a/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_rom.h b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_rom.h @@ -0,0 +1,36 @@ +// eCos memory layout - Mon Jul 16 12:45:16 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_rom (0x80000000) +#define CYGMEM_REGION_rom_SIZE (0x400000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#define CYGMEM_REGION_sram1 (0x82000000) +#define CYGMEM_REGION_sram1_SIZE (0x100000) +#define CYGMEM_REGION_sram1_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_sram2 (0x89000000) +#define CYGMEM_REGION_sram2_SIZE (0x100000) +#define CYGMEM_REGION_sram2_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_ram (0x8c000000) +#define CYGMEM_REGION_ram_SIZE (0x4000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved) []; +#endif +#define CYGMEM_SECTION_reserved (CYG_LABEL_NAME (__reserved)) +#define CYGMEM_SECTION_reserved_SIZE (0x200) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x8ff00000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif +#define CYGMEM_SECTION_pci_window (CYG_LABEL_NAME (__pci_window)) +#define CYGMEM_SECTION_pci_window_SIZE (0x100000) diff --git a/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_rom.ldi b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_rom.ldi @@ -0,0 +1,31 @@ +// eCos memory layout - Mon Jul 16 12:45:16 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + rom : ORIGIN = 0x80000000, LENGTH = 0x400000 + sram1 : ORIGIN = 0x82000000, LENGTH = 0x100000 + sram2 : ORIGIN = 0x89000000, LENGTH = 0x100000 + ram : ORIGIN = 0x8c000000, LENGTH = 0x4000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_vectors (rom, 0x80000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + CYG_LABEL_DEFN(__reserved) = 0x8c000000; . = CYG_LABEL_DEFN(__reserved) + 0x200; + SECTION_data (ram, ALIGN (0x1), FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + CYG_LABEL_DEFN(__pci_window) = 0x8ff00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000; + SECTIONS_END +} diff --git a/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_rom.mlt b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/pkgconf/mlt_sh_sh7751_se7751_rom.mlt @@ -0,0 +1,17 @@ +version 0 +region rom 80000000 400000 1 !Flash Bank 0 +region sram1 82000000 100000 0 ! +region sram2 89000000 100000 0 ! +region ram 8c000000 4000000 0 ! +section vectors 0 1 0 1 1 1 1 1 80000000 80000000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 8 0 1 0 1 0 1 rodata rodata ! +section rodata 0 8 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 0 0 1 data ! +section reserved 200 1 0 0 1 1 1 0 8c000000 8c000000 data ! +section data 0 1 1 1 0 1 0 0 bss ! +section bss 0 10 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! +section pci_window 100000 1 0 0 1 0 1 0 8ff00000 8ff00000 ! diff --git a/packages/hal/sh/se7751/current/include/platform.inc b/packages/hal/sh/se7751/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/platform.inc @@ -0,0 +1,212 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## Hitachi SE7751 board assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): jskov +## Contributors:jskov +## Date: 2001-07-09 +## Purpose: Hitachi SE7751 platform startup +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the Hitachi SE7751 +## board. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include +#include + +#------------------------------------------------------------------------------ +# Hardware initialization. + +#define END 0 +#define INT8 1 +#define INT16 2 +#define INT32 3 +#define DELAY 4 + + .macro hal_hardware_init + mova init_table,r0 + mov r0,r3 +1: mov.l @r3+,r0 // Data type + cmp/eq #END,r0 // End of table + bf 0f + bra 9f + nop +0: cmp/eq #INT8,r0 + bf 2f + // 8 bit data + mov.l @r3+,r0 // addr + mov.l @r3+,r1 // data + bra 1b + mov.b r1,@r0 +2: cmp/eq #INT16,r0 + bf 3f + // 16 bit data + mov.l @r3+,r0 // addr + mov.l @r3+,r1 // data + bra 1b + mov.w r1,@r0 +3: cmp/eq #INT32,r0 + bf 4f + // 32 bit data + mov.l @r3+,r0 // addr + mov.l @r3+,r1 // data + bra 1b + mov.l r1,@r0 +4: cmp/eq #DELAY,r0 + bf 6f + // delay + mov.l @r3+,r0 // count +5: cmp/eq #0,r0 + bt 1b + bra 5b + add #-1,r0 +6: bra 1b + nop + + .align 2 +init_table: + .long INT16, CYGARC_REG_WTCSR, 0xA502 + .long INT16, CYGARC_REG_WTCNT, 0x5A00 + .long INT16, CYGARC_REG_FRQCR, CYGARC_REG_FRQCR_INIT + .long INT32, CYGARC_REG_BCR1, 0x00080008 + .long INT16, CYGARC_REG_BCR2, 0x2ffc + .long INT32, CYGARC_REG_WCR1, 0x02770771 + .long INT32, CYGARC_REG_WCR2, 0x7ffe4fe7 + .long INT32, CYGARC_REG_WCR3, 0x01777771 + .long INT16, CYGARC_REG_PCR, 0x0000 + .long INT16, CYGARC_REG_RTCNT, 0xa500 + .long INT16, CYGARC_REG_RTCOR, 0xa506 + .long INT16, CYGARC_REG_RFCR, 0xa400 + .long INT32, CYGARC_REG_MCR, 0x100901b4 + .long INT8, 0xff940088, 0x00 // CS3 area SDRAM mode register + .long INT16, CYGARC_REG_RTCSR, 0xa508 + .long DELAY, 100 + .long INT32, CYGARC_REG_MCR, 0x500901b4 + .long INT8, 0xff940088, 0x00 // CS3 area SDRAM mode register + .long INT16, CYGARC_REG_RTCSR, 0xa518 + .long INT32, CYGARC_REG_PCTRA, 0x00000000 + .long INT32, CYGARC_REG_PCTRB, 0x00000000 + .long INT16, CYGARC_REG_GPIOIC, 0x0000 + .long END +9: + .endm + +#------------------------------------------------------------------------------ +# Monitor initialization. + +#ifndef CYGPKG_HAL_SH_MON_DEFINED + +#if !defined(CYG_HAL_STARTUP_RAM) || \ + ( defined(CYG_HAL_STARTUP_RAM) && \ + !defined(CYGSEM_HAL_USE_ROM_MONITOR)) + + # If we are not starting up from RAM, or we are starting in + # RAM and NOT using a ROM monitor, initialize the VSR table. + + .macro hal_mon_init + mov.l $hal_vsr_table,r3 + # Write exception vectors + mov.l $cyg_hal_default_exception_vsr,r4 + mov #CYGNUM_HAL_VSR_EXCEPTION_COUNT,r5 +1: mov.l r4,@r3 + add #4,r3 + dt r5 + bf 1b + # Write interrupt vector + mov.l $cyg_hal_default_interrupt_vsr,r4 + mov.l $hal_vsr_table,r3 + add #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3 + mov.l r4,@r3 + bra 2f + nop + .align 2 + + SYM_PTR_REF(cyg_hal_default_exception_vsr) + SYM_PTR_REF(cyg_hal_default_interrupt_vsr) + SYM_PTR_REF(hal_vsr_table) +2: + .endm + +#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR) + + # Initialize the VSR table entries + # We only take control of the interrupt vector, + # the rest are left to the ROM for now... + + .macro hal_mon_init + # Write interrupt vector + mov.l $hal_vsr_table,r3 + mov.l $cyg_hal_default_interrupt_vsr,r4 + add #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3 + mov.l r4,@r3 + bra 2f + nop + .align 2 + + SYM_PTR_REF(cyg_hal_default_interrupt_vsr) + SYM_PTR_REF(hal_vsr_table) +2: + .endm + +#else + + .macro hal_mon_init + .endm + +#endif + + +#define CYGPKG_HAL_SH_MON_DEFINED + +#endif // CYGPKG_HAL_SH_MON_DEFINED + +#endif // CYGONCE_HAL_PLATFORM_INC diff --git a/packages/hal/sh/se7751/current/include/plf_cache.h b/packages/hal/sh/se7751/current/include/plf_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/plf_cache.h @@ -0,0 +1,66 @@ +#ifndef CYGONCE_PLF_CACHE_H +#define CYGONCE_PLF_CACHE_H + +//============================================================================= +// +// plf_cache.h +// +// Platform specific cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-12 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +// Nothing here + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_PLF_CACHE_H +// End of plf_cache.h + diff --git a/packages/hal/sh/se7751/current/include/plf_intr.h b/packages/hal/sh/se7751/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/plf_intr.h @@ -0,0 +1,147 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// Platform specific Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-06-12 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the SE77x9 board. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +//---------------------------------------------------------------------------- +// External interrupts. +#define CYGNUM_HAL_INTERRUPT_EXTERNALS_BASE CYGNUM_HAL_INTERRUPT_LVL0 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ8 CYGNUM_HAL_INTERRUPT_LVL0 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ7 CYGNUM_HAL_INTERRUPT_LVL1 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ6 CYGNUM_HAL_INTERRUPT_LVL2 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ5 CYGNUM_HAL_INTERRUPT_LVL3 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ4 CYGNUM_HAL_INTERRUPT_LVL4 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ3 CYGNUM_HAL_INTERRUPT_LVL5 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ2 CYGNUM_HAL_INTERRUPT_LVL6 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ1 CYGNUM_HAL_INTERRUPT_LVL7 +#define CYGNUM_HAL_INTERRUPT_PC_SIRQ4 CYGNUM_HAL_INTERRUPT_LVL8 +#define CYGNUM_HAL_INTERRUPT_PC_SIRQ3 CYGNUM_HAL_INTERRUPT_LVL9 +#define CYGNUM_HAL_INTERRUPT_PC_SIRQ2 CYGNUM_HAL_INTERRUPT_LVL10 +#define CYGNUM_HAL_INTERRUPT_PC_SIRQ1 CYGNUM_HAL_INTERRUPT_LVL11 +#define CYGNUM_HAL_INTERRUPT_PCIA CYGNUM_HAL_INTERRUPT_LVL12 +#define CYGNUM_HAL_INTERRUPT_PCIB CYGNUM_HAL_INTERRUPT_LVL13 +#define CYGNUM_HAL_INTERRUPT_PCIC CYGNUM_HAL_INTERRUPT_LVL14 +#define CYGNUM_HAL_INTERRUPT_PCID CYGNUM_HAL_INTERRUPT_LVL14 // !?! + + +//---------------------------------------------------------------------------- +// Interrupt controller +#define CYGARC_REG_INTC_A 0xbb000000 +#define CYGARC_REG_INTC_B 0xbb000002 +#define CYGARC_REG_INTC_C 0xbb000004 +#define CYGARC_REG_INTC_D 0xbb000006 +#define CYGARC_REG_INTC_E 0xbb000008 + + +//---------------------------------------------------------------------------- +// Interrupt configuration extention macros +#define CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF(vec, level) \ + case CYGNUM_HAL_INTERRUPT_SLOT_IRQ8 ... CYGNUM_HAL_INTERRUPT_SLOT_IRQ5: \ + { \ + cyg_uint16 msk; \ + int shift = 4*(3 - (vec - CYGNUM_HAL_INTERRUPT_SLOT_IRQ8)); \ + HAL_READ_UINT16(CYGARC_REG_INTC_A, msk); \ + msk &= ~(0x000f << shift); \ + if (level) msk |= (CYGNUM_HAL_INTERRUPT_LVL14 - vec + 1) << shift; \ + HAL_WRITE_UINT16(CYGARC_REG_INTC_A, msk); \ + break; \ + } \ + case CYGNUM_HAL_INTERRUPT_SLOT_IRQ4 ... CYGNUM_HAL_INTERRUPT_SLOT_IRQ1: \ + { \ + cyg_uint16 msk; \ + int shift = 4*(3 - (vec - CYGNUM_HAL_INTERRUPT_SLOT_IRQ4)); \ + HAL_READ_UINT16(CYGARC_REG_INTC_B, msk); \ + msk &= ~(0x000f << shift); \ + if (level) msk |= (CYGNUM_HAL_INTERRUPT_LVL14 - vec + 1) << shift; \ + HAL_WRITE_UINT16(CYGARC_REG_INTC_B, msk); \ + break; \ + } \ + case CYGNUM_HAL_INTERRUPT_PC_SIRQ4 ... CYGNUM_HAL_INTERRUPT_PC_SIRQ1: \ + { \ + cyg_uint16 msk; \ + int shift = 4*(3 - (vec - CYGNUM_HAL_INTERRUPT_PC_SIRQ4)); \ + HAL_READ_UINT16(CYGARC_REG_INTC_C, msk); \ + msk &= ~(0x000f << shift); \ + if (level) msk |= (CYGNUM_HAL_INTERRUPT_LVL14 - vec + 1) << shift; \ + HAL_WRITE_UINT16(CYGARC_REG_INTC_C, msk); \ + break; \ + } \ + case CYGNUM_HAL_INTERRUPT_PCIA ... CYGNUM_HAL_INTERRUPT_PCIC: \ + { \ + cyg_uint16 msk; \ + int shift = 4*(3 - (vec - CYGNUM_HAL_INTERRUPT_PCIA)); \ + HAL_READ_UINT16(CYGARC_REG_INTC_D, msk); \ + msk &= ~(0x000f << shift); \ + if (level) msk |= (CYGNUM_HAL_INTERRUPT_LVL14 - vec + 1) << shift; \ + HAL_WRITE_UINT16(CYGARC_REG_INTC_D, msk); \ + break; \ + } + +//---------------------------------------------------------------------------- +// Reset. +// Block interrupts and cause an exception. This forces a reset. +#define HAL_PLATFORM_RESET() \ + asm volatile ("ldc %0,sr;trapa #0x00;" : : "r" (CYGARC_REG_SR_BL)) + +#define HAL_PLATFORM_RESET_ENTRY 0x80000000 + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/sh/se7751/current/include/plf_io.h b/packages/hal/sh/se7751/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/plf_io.h @@ -0,0 +1,174 @@ +#ifndef CYGONCE_PLF_IO_H +#define CYGONCE_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// Platform specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-07-10 +// Purpose: SE7751 IO support macros +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +//----------------------------------------------------------------------------- +// PCI host setup details - map full 64MB in MEM1 +#define CYGARC_REG_PCIC_BAR0_PLF_INIT 0xab000001 +#define CYGARC_REG_PCIC_BAR1_PLF_INIT 0x0c000000 +#define CYGARC_REG_PCIC_BAR2_PLF_INIT 0xd0000000 +#define CYGARC_REG_PCIC_LSR0_PLF_INIT 0x03f00000 +#define CYGARC_REG_PCIC_LSR1_PLF_INIT 0x00000000 +#define CYGARC_REG_PCIC_LAR0_PLF_INIT 0x0c000000 +#define CYGARC_REG_PCIC_LAR1_PLF_INIT 0x00000000 + + +extern cyg_uint32 cyg_hal_sh_pcic_pci_cfg_read_dword (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset); +extern cyg_uint16 cyg_hal_sh_pcic_pci_cfg_read_word (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset); +extern cyg_uint8 cyg_hal_sh_pcic_pci_cfg_read_byte (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset); +extern void cyg_hal_sh_pcic_pci_cfg_write_dword (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint32 val); +extern void cyg_hal_sh_pcic_pci_cfg_write_word (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint16 val); +extern void cyg_hal_sh_pcic_pci_cfg_write_byte (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint8 val); + +// Initialize the PCI bus. +externC void cyg_hal_sh_pcic_pci_init(void); +#define HAL_PCI_INIT() cyg_hal_sh_pcic_pci_init() + +// Map PCI device resources starting from these addresses in PCI space. +// leave gap at start of IO and mem for super IO controller +#define HAL_PCI_ALLOC_BASE_IO 0x00002000 +#define HAL_PCI_ALLOC_BASE_MEMORY 0x00000000 + +// This is where the PCI spaces are mapped in the CPU's address space. +#define HAL_PCI_PHYSICAL_IO_BASE 0 // no direct IO +#define HAL_PCI_PHYSICAL_MEMORY_BASE CYGARC_REG_PCIC_MEM_BASE + +// Read a value from the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +#define HAL_PCI_CFG_READ_UINT8( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_sh_pcic_pci_cfg_read_byte((__bus), (__devfn), (__offset)) + +#define HAL_PCI_CFG_READ_UINT16( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_sh_pcic_pci_cfg_read_word((__bus), (__devfn), (__offset)) + +#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \ + __val = cyg_hal_sh_pcic_pci_cfg_read_dword((__bus), (__devfn), (__offset)) + +// Write a value to the PCI configuration space of the appropriate +// size at an address composed from the bus, devfn and offset. +#define HAL_PCI_CFG_WRITE_UINT8( __bus, __devfn, __offset, __val ) \ + cyg_hal_sh_pcic_pci_cfg_write_byte((__bus), (__devfn), (__offset), (__val)) + +#define HAL_PCI_CFG_WRITE_UINT16( __bus, __devfn, __offset, __val ) \ + cyg_hal_sh_pcic_pci_cfg_write_word((__bus), (__devfn), (__offset), (__val)) + +#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \ + cyg_hal_sh_pcic_pci_cfg_write_dword((__bus), (__devfn), (__offset), (__val)) + +// Read/write data to PCI IO space +extern void cyg_hal_sh_pcic_pci_io_write_byte (cyg_uint32 addr, cyg_uint8 data); +extern void cyg_hal_sh_pcic_pci_io_write_word (cyg_uint32 addr, cyg_uint16 data); +extern void cyg_hal_sh_pcic_pci_io_write_dword (cyg_uint32 addr, cyg_uint32 data); +extern cyg_uint8 cyg_hal_sh_pcic_pci_io_read_byte (cyg_uint32 addr); +extern cyg_uint16 cyg_hal_sh_pcic_pci_io_read_word (cyg_uint32 addr); +extern cyg_uint32 cyg_hal_sh_pcic_pci_io_read_dword (cyg_uint32 addr); + +#define HAL_PCI_IO_READ_UINT8(addr, datum) datum = cyg_hal_sh_pcic_pci_io_read_byte((cyg_uint32)addr) +#define HAL_PCI_IO_READ_UINT16(addr, datum) datum = cyg_hal_sh_pcic_pci_io_read_word((cyg_uint32)addr) +#define HAL_PCI_IO_READ_UINT32(addr, datum) datum = cyg_hal_sh_pcic_pci_io_read_dword((cyg_uint32)addr) +#define HAL_PCI_IO_WRITE_UINT8(addr, datum) cyg_hal_sh_pcic_pci_io_write_byte((cyg_uint32)addr, datum) +#define HAL_PCI_IO_WRITE_UINT16(addr, datum) cyg_hal_sh_pcic_pci_io_write_word((cyg_uint32)addr, datum) +#define HAL_PCI_IO_WRITE_UINT32(addr, datum) cyg_hal_sh_pcic_pci_io_write_dword((cyg_uint32)addr, datum) + +// Translate the PCI interrupt requested by the device (INTA#, INTB#, +// INTC# or INTD#) to the associated CPU interrupt (i.e., HAL vector). +// FIXME: These are incomplete. Not clear from the docs where the +// interrupts are routed - the below makes the onboard PCnet controller +// work. +#define HAL_PCI_TRANSLATE_INTERRUPT( __bus, __devfn, __vec, __valid) \ + CYG_MACRO_START \ + cyg_uint8 __req; \ + HAL_PCI_CFG_READ_UINT8(__bus, __devfn, CYG_PCI_CFG_INT_PIN, __req); \ + if (0 != __req) { \ + CYG_ADDRWORD __translation[4] = { \ + CYGNUM_HAL_INTERRUPT_PCID, \ + CYGNUM_HAL_INTERRUPT_PCIA, \ + CYGNUM_HAL_INTERRUPT_PCIB, \ + CYGNUM_HAL_INTERRUPT_PCIC}; \ + \ + __vec = __translation[((__req+CYG_PCI_DEV_GET_DEV(__devfn))&3)]; \ + __valid = true; \ + } else { \ + /* Device will not generate interrupt requests. */ \ + __valid = false; \ + } \ + CYG_MACRO_END + + +#define HAL_PCI_IGNORE_DEVICE(__bus, __dev, __fn) (0) + +// Bus address translation macros +#define HAL_PCI_CPU_TO_BUS(__cpu_addr, __bus_addr) \ + CYG_MACRO_START \ + (__bus_addr) = CYGARC_BUS_ADDRESS(__cpu_addr); \ + CYG_MACRO_END + +#define HAL_PCI_BUS_TO_CPU(__bus_addr, __cpu_addr) \ + CYG_MACRO_START \ + (__cpu_addr) = CYGARC_UNCACHED_ADDRESS(__bus_addr); \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_SH_PLF_IO_H diff --git a/packages/hal/sh/se7751/current/include/plf_stub.h b/packages/hal/sh/se7751/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/include/plf_stub.h @@ -0,0 +1,88 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-12 +// Purpose: Platform HAL stub support for Hitachi SE77x9 board. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#ifdef CYGPKG_IO_SERIAL +#include +#endif + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM, externC + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/sh/se7751/current/misc/redboot_RAM.ecm b/packages/hal/sh/se7751/current/misc/redboot_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/misc/redboot_RAM.ecm @@ -0,0 +1,72 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware se7751 ; + template redboot ; + package -hardware CYGPKG_HAL_SH current ; + package -hardware CYGPKG_HAL_SH_SH4 current ; + package -hardware CYGPKG_HAL_SH_SH7751_SE7751 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_FLASH_SH_SE7751 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_SH_SE7751 current ; + package -hardware CYGPKG_DEVS_ETH_AMD_PCNET current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGHWR_HAL_SH_BIGENDIAN { + inferred_value 0 +}; + +cdl_component CYGPKG_HAL_SH_7751 { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + inferred_value 1 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/se7751/current/misc/redboot_ROM.ecm b/packages/hal/sh/se7751/current/misc/redboot_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/misc/redboot_ROM.ecm @@ -0,0 +1,82 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware se7751 ; + template redboot ; + package -hardware CYGPKG_HAL_SH current ; + package -hardware CYGPKG_HAL_SH_SH4 current ; + package -hardware CYGPKG_HAL_SH_SH7751_SE7751 current ; + package -hardware CYGPKG_IO_PCI current ; + package -hardware CYGPKG_DEVS_FLASH_SH_SE7751 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_IO_SERIAL_SH_SCIF current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_SH_SH3 current ; + package -hardware CYGPKG_DEVS_ETH_SH_SE7751 current ; + package -hardware CYGPKG_DEVS_ETH_AMD_PCNET current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_SH_BIGENDIAN { + inferred_value 0 +}; + +cdl_component CYGPKG_HAL_SH_7751 { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + inferred_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/se7751/current/src/hal_diag.c b/packages/hal/sh/se7751/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/src/hal_diag.c @@ -0,0 +1,80 @@ +//============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-07-09 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include // our header. + +#include // Calling interface +#include // Interrupt macros +#include // driver API + +//----------------------------------------------------------------------------- + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + // COM1 is SCIF2. + cyg_hal_plf_scif_init(0, 0, CYGNUM_HAL_INTERRUPT_SCIF_RXI, + (cyg_uint8*)CYGARC_REG_SCIF_SCSMR2); + // SuperIO claims channel 1 for the COM2 connector +// cyg_hal_plf_serial_init(); +} + +//----------------------------------------------------------------------------- +// End of hal_diag.c diff --git a/packages/hal/sh/se7751/current/src/m1543c.c b/packages/hal/sh/se7751/current/src/m1543c.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/src/m1543c.c @@ -0,0 +1,136 @@ +//============================================================================= +// +// m1543c.c +// +// Init code for M1543C super IO controller +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-07-10 +// Description: Init code for M1543C super IO controller +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interrupt vectors +#include // PCI macro + + +//----------------------------------------------------------------------------- + +#define SIO_READ_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + HAL_PCI_IO_READ_UINT8((_a_), (_d_)); \ + CYG_MACRO_END + +#define SIO_WRITE_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + HAL_PCI_IO_WRITE_UINT8((_a_), (_d_)); \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- + +#define SIO_CONFIG 0x000003f0 +#define SIO_CONFIG_DATA 0x000003f1 + +#define SIO_CONFIG_DEV 0x07 +#define SIO_CONFIG_POWER 0x22 +#define SIO_CONFIG_ACTIVATE 0x30 +#define SIO_CONFIG_ENTER1 0x51 +#define SIO_CONFIG_ENTER2 0x23 +#define SIO_CONFIG_BASE_HIGH 0x60 +#define SIO_CONFIG_BASE_LOW 0x61 +#define SIO_CONFIG_IRQ 0x70 +#define SIO_CONFIG_EXIT 0xbb +#define SIO_CONFIG_MODE 0xf0 + +#define SIO_CONFIG_DEV_COM1 0x04 +#define SIO_CONFIG_DEV_COM2 0x05 +#define SIO_CONFIG_DEV_RTC 0x06 + +#define SIO_CONFIG_MODE_HIGH 0x02 + +#define SIO_CONFIG_ACTIVATE_ENABLE 0x01 + +#define SIO_CONFIG_POWER_COM1 0x10 +#define SIO_CONFIG_POWER_COM2 0x20 + + +void +cyg_hal_init_superIO(void) +{ +#if 0 + // Enable PCI to ISA bridge (magic from Hitachi monitor). + cyg_pci_write_config_uint32(CYG_PCI_DEV_MAKE_ID(0, 2<<3), 0x40, 0x8020c77f); + cyg_pci_write_config_uint32(CYG_PCI_DEV_MAKE_ID(0, 2<<3), 0x44, 0x00001b9d); + cyg_pci_write_config_uint32(CYG_PCI_DEV_MAKE_ID(0, 2<<3), 0x48, 0x00009315); + cyg_pci_write_config_uint32(CYG_PCI_DEV_MAKE_ID(0, 2<<3), 0x4c, 0x0000000f); +#endif + + // Enter SuperIO config mode + SIO_WRITE_UINT8(SIO_CONFIG, SIO_CONFIG_ENTER1); + SIO_WRITE_UINT8(SIO_CONFIG, SIO_CONFIG_ENTER2); + + // Configure and enable COM1 + SIO_WRITE_UINT8(SIO_CONFIG, SIO_CONFIG_DEV); + SIO_WRITE_UINT8(SIO_CONFIG_DATA, SIO_CONFIG_DEV_COM1); + + SIO_WRITE_UINT8(SIO_CONFIG, SIO_CONFIG_BASE_HIGH); + SIO_WRITE_UINT8(SIO_CONFIG_DATA, 0x03); + SIO_WRITE_UINT8(SIO_CONFIG, SIO_CONFIG_BASE_LOW); + SIO_WRITE_UINT8(SIO_CONFIG_DATA, 0xf8); + + // Select IRQ 4 (see chap 8. Interrupt Controller) + SIO_WRITE_UINT8(SIO_CONFIG, SIO_CONFIG_IRQ); + SIO_WRITE_UINT8(SIO_CONFIG_DATA, 4); + + SIO_WRITE_UINT8(SIO_CONFIG, SIO_CONFIG_ACTIVATE); + SIO_WRITE_UINT8(SIO_CONFIG_DATA, SIO_CONFIG_ACTIVATE_ENABLE); + + SIO_WRITE_UINT8(SIO_CONFIG, SIO_CONFIG_EXIT); +} + +//----------------------------------------------------------------------------- +// end of smsc37c93x.c diff --git a/packages/hal/sh/se7751/current/src/plf_misc.c b/packages/hal/sh/se7751/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/src/plf_misc.c @@ -0,0 +1,82 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-06-12 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include // interfacing API +#include +#include + +//-------------------------------------------------------------------------- +externC void cyg_hal_init_superIO(void); +externC void cyg_hal_sh_pcic_pci_init(void); + +void +hal_platform_init(void) +{ + // Clear interrupt controller masks. + HAL_WRITE_UINT16(CYGARC_REG_INTC_A, 0x0000); + HAL_WRITE_UINT16(CYGARC_REG_INTC_B, 0x0000); + HAL_WRITE_UINT16(CYGARC_REG_INTC_C, 0x0000); + HAL_WRITE_UINT16(CYGARC_REG_INTC_D, 0x0000); + HAL_WRITE_UINT16(CYGARC_REG_INTC_E, 0x0000); + + cyg_hal_sh_pcic_pci_init(); + + cyg_hal_init_superIO(); + + hal_if_init(); +} + +//-------------------------------------------------------------------------- +// eof plf_misc.c diff --git a/packages/hal/sh/se7751/current/src/ser16c550c.c b/packages/hal/sh/se7751/current/src/ser16c550c.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se7751/current/src/ser16c550c.c @@ -0,0 +1,539 @@ +//============================================================================= +// +// ser16c550c.c +// +// Simple driver for the 16c550c serial controllers on the HS7729PCI board +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley +// Contributors:dmoseley, jskov +// Date: 2001-03-20 +// Description: Simple driver for the 16c550c serial controller +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interface API +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // Helper functions +#include // CYG_ISR_HANDLED + +//----------------------------------------------------------------------------- +// Define the serial registers. The Malta board is equipped with a 16550C +// serial chip. +#define SE77X9_SER_CLOCK 1846200 +#define SE77X9_SER_16550_BASE_A 0x3f8 +#define SER_16550_RBR 0x00 // receiver buffer register, read, dlab = 0 +#define SER_16550_THR 0x00 // transmitter holding register, write, dlab = 0 +#define SER_16550_DLL 0x00 // divisor latch (LS), read/write, dlab = 1 +#define SER_16550_IER 0x01 // interrupt enable register, read/write, dlab = 0 +#define SER_16550_DLM 0x01 // divisor latch (MS), read/write, dlab = 1 +#define SER_16550_IIR 0x02 // interrupt identification reg, read, dlab = 0 +#define SER_16550_FCR 0x02 // fifo control register, write, dlab = 0 +#define SER_16550_AFR 0x02 // alternate function reg, read/write, dlab = 1 +#define SER_16550_LCR 0x03 // line control register, read/write +#define SER_16550_MCR 0x04 // modem control register, read/write +#define SER_16550_LSR 0x05 // line status register, read +#define SER_16550_MSR 0x06 // modem status register, read +#define SER_16550_SCR 0x07 // scratch pad register + +// The interrupt enable register bits. +#define SIO_IER_ERDAI 0x01 // enable received data available irq +#define SIO_IER_ETHREI 0x02 // enable THR empty interrupt +#define SIO_IER_ELSI 0x04 // enable receiver line status irq +#define SIO_IER_EMSI 0x08 // enable modem status interrupt + +// The interrupt identification register bits. +#define SIO_IIR_IP 0x01 // 0 if interrupt pending +#define SIO_IIR_ID_MASK 0x0e // mask for interrupt ID bits + +// The line status register bits. +#define SIO_LSR_DR 0x01 // data ready +#define SIO_LSR_OE 0x02 // overrun error +#define SIO_LSR_PE 0x04 // parity error +#define SIO_LSR_FE 0x08 // framing error +#define SIO_LSR_BI 0x10 // break interrupt +#define SIO_LSR_THRE 0x20 // transmitter holding register empty +#define SIO_LSR_TEMT 0x40 // transmitter register empty +#define SIO_LSR_ERR 0x80 // any error condition + +// The modem status register bits. +#define SIO_MSR_DCTS 0x01 // delta clear to send +#define SIO_MSR_DDSR 0x02 // delta data set ready +#define SIO_MSR_TERI 0x04 // trailing edge ring indicator +#define SIO_MSR_DDCD 0x08 // delta data carrier detect +#define SIO_MSR_CTS 0x10 // clear to send +#define SIO_MSR_DSR 0x20 // data set ready +#define SIO_MSR_RI 0x40 // ring indicator +#define SIO_MSR_DCD 0x80 // data carrier detect + +// The line control register bits. +#define SIO_LCR_WLS0 0x01 // word length select bit 0 +#define SIO_LCR_WLS1 0x02 // word length select bit 1 +#define SIO_LCR_STB 0x04 // number of stop bits +#define SIO_LCR_PEN 0x08 // parity enable +#define SIO_LCR_EPS 0x10 // even parity select +#define SIO_LCR_SP 0x20 // stick parity +#define SIO_LCR_SB 0x40 // set break +#define SIO_LCR_DLAB 0x80 // divisor latch access bit + +// The FIFO control register +#define SIO_FCR_FCR0 0x01 // enable xmit and rcvr fifos +#define SIO_FCR_FCR1 0x02 // clear RCVR FIFO +#define SIO_FCR_FCR2 0x04 // clear XMIT FIFO + +///////////////////////////////////////// +// Interrupt Enable Register +#define IER_RCV 0x01 +#define IER_XMT 0x02 +#define IER_LS 0x04 +#define IER_MS 0x08 + +// Line Control Register +#define LCR_WL5 0x00 // Word length +#define LCR_WL6 0x01 +#define LCR_WL7 0x02 +#define LCR_WL8 0x03 +#define LCR_SB1 0x00 // Number of stop bits +#define LCR_SB1_5 0x04 // 1.5 -> only valid with 5 bit words +#define LCR_SB2 0x04 +#define LCR_PN 0x00 // Parity mode - none +#define LCR_PE 0x0C // Parity mode - even +#define LCR_PO 0x08 // Parity mode - odd +#define LCR_PM 0x28 // Forced "mark" parity +#define LCR_PS 0x38 // Forced "space" parity +#define LCR_DL 0x80 // Enable baud rate latch + +// Line Status Register +#define LSR_RSR 0x01 +#define LSR_THE 0x20 + +// Modem Control Register +#define MCR_DTR 0x01 +#define MCR_RTS 0x02 +#define MCR_INT 0x08 // Enable interrupts +#define MCR_AFE 0x20 + +// Interrupt status register +#define ISR_None 0x01 +#define ISR_Rx_Line_Status 0x06 +#define ISR_Rx_Avail 0x04 +#define ISR_Rx_Char_Timeout 0x0C +#define ISR_Tx_Empty 0x02 +#define IRS_Modem_Status 0x00 + +// FIFO control register +#define FCR_ENABLE 0x01 +#define FCR_CLEAR_RCVR 0x02 +#define FCR_CLEAR_XMIT 0x04 + +#define CYG_DEV_SERIAL_BAUD_DIVISOR (SE77X9_SER_CLOCK/16/CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD) + +//----------------------------------------------------------------------------- + +#define UART_READ_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + cyg_uint16 t; \ + HAL_READ_UINT16((_a_), t); \ + (_d_) = (t >> 8) & 0xff; \ + CYG_MACRO_END + +#define UART_WRITE_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT16((_a_), (_d_)<<8); \ + CYG_MACRO_END + + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +static const channel_data_t channels[1] = { + { (cyg_uint8*)SE77X9_SER_16550_BASE_A, 1000, CYGNUM_HAL_INTERRUPT_PC_SIRQ4 }, +}; + +//----------------------------------------------------------------------------- +// Set the baud rate + +static void +cyg_hal_plf_serial_set_baud(cyg_uint8* port, cyg_uint16 baud_divisor) +{ + cyg_uint8 _lcr; + + UART_READ_UINT8(port+SER_16550_LCR, _lcr); + _lcr |= LCR_DL; + UART_WRITE_UINT8(port+SER_16550_LCR, _lcr); + + UART_WRITE_UINT8(port+SER_16550_DLM, baud_divisor >> 8); + UART_WRITE_UINT8(port+SER_16550_DLL, baud_divisor & 0xff); + + _lcr &= ~LCR_DL; + UART_WRITE_UINT8(port+SER_16550_LCR, _lcr); +} + +//----------------------------------------------------------------------------- +// The minimal init, get and put functions. All by polling. + +void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + cyg_uint8* port; + cyg_uint8 _lcr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + // Disable port interrupts while changing hardware + UART_WRITE_UINT8(port+SER_16550_IER, 0); + + // Set databits, stopbits and parity. + _lcr = LCR_WL8 | LCR_SB1 | LCR_PN; + UART_WRITE_UINT8(port+SER_16550_LCR, _lcr); + + // Set baud rate. + cyg_hal_plf_serial_set_baud(port, CYG_DEV_SERIAL_BAUD_DIVISOR); + + // Enable and clear FIFO + UART_WRITE_UINT8(port+SER_16550_FCR, (FCR_ENABLE | FCR_CLEAR_RCVR | FCR_CLEAR_XMIT)); + + // enable RTS to keep host side happy. Also allow interrupts + UART_WRITE_UINT8( port+SER_16550_MCR, MCR_DTR | MCR_RTS | MCR_INT); + + // Don't allow interrupts. + UART_WRITE_UINT8(port+SER_16550_IER, 0); +} + +void +cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 __ch) +{ + cyg_uint8* port; + cyg_uint8 _lsr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + CYGARC_HAL_SAVE_GP(); + + do { + UART_READ_UINT8(port+SER_16550_LSR, _lsr); + } while ((_lsr & SIO_LSR_THRE) == 0); + + // Now, the transmit buffer is empty + UART_WRITE_UINT8(port+SER_16550_THR, __ch); + + // Hang around until the character has been safely sent. + do { + UART_READ_UINT8(port+SER_16550_LSR, _lsr); + } while ((_lsr & SIO_LSR_THRE) == 0); + + CYGARC_HAL_RESTORE_GP(); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* port; + cyg_uint8 _lsr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + UART_READ_UINT8(port+SER_16550_LSR, _lsr); + if ((_lsr & SIO_LSR_DR) == 0) + return false; + + UART_READ_UINT8(port+SER_16550_RBR, *ch); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan; + cyg_uint8 ier; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + UART_READ_UINT8(chan->base + SER_16550_IER, ier); + ier |= SIO_IER_ERDAI; + UART_WRITE_UINT8(chan->base + SER_16550_IER, ier); + + HAL_INTERRUPT_SET_LEVEL(chan->isr_vector, 1); + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + UART_READ_UINT8(chan->base + SER_16550_IER, ier); + ier &= ~SIO_IER_ERDAI; + UART_WRITE_UINT8(chan->base + SER_16550_IER, ier); + + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + break; + case __COMMCTL_SETBAUD: + { + cyg_uint32 baud_rate; + cyg_uint16 baud_divisor; + cyg_uint8* port = chan->base; + va_list ap; + + va_start(ap, __func); + baud_rate = va_arg(ap, cyg_uint32); + va_end(ap); + + baud_divisor = (SE77X9_SER_CLOCK / 16 / baud_rate); + + // Disable port interrupts while changing hardware + UART_READ_UINT8(port+SER_16550_IER, ier); + UART_WRITE_UINT8(port+SER_16550_IER, 0); + + // Set baud rate. + cyg_hal_plf_serial_set_baud(port, baud_divisor); + + // Reenable interrupts if necessary + UART_WRITE_UINT8(port+SER_16550_IER, ier); + } + break; + + case __COMMCTL_GETBAUD: + break; + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + cyg_uint8 _iir, c; + channel_data_t* chan; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + HAL_INTERRUPT_ACKNOWLEDGE(chan->isr_vector); + + UART_READ_UINT8(chan->base + SER_16550_IIR, _iir); + _iir &= SIO_IIR_ID_MASK; + + *__ctrlc = 0; + if ((_iir == ISR_Rx_Avail) || (_iir == ISR_Rx_Char_Timeout)) { + + UART_READ_UINT8(chan->base + SER_16550_RBR, c); + + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(channels[0].isr_vector); + + // Init channels + cyg_hal_plf_serial_init_channel((void*)&channels[0]); + + // Setup procs in the vector table + + // Set channel 1 + CYGACC_CALL_IF_SET_CONSOLE_COMM(1); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +//----------------------------------------------------------------------------- +// end of ser16c550c.c diff --git a/packages/hal/sh/se77x9/current/ChangeLog b/packages/hal/sh/se77x9/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/ChangeLog @@ -0,0 +1,161 @@ +2002-05-08 Jesper Skov + + * src/hal_diag.c: Serial register renaming. + +2001-10-31 Jonathan Larmour + + * cdl/hal_sh_sh77x9_se77x9.cdl: Indicate support of variable baud rates. + +2001-10-18 Jesper Skov + + * src/plf_misc.c (hal_platform_init): Fix option spelling. + + * cdl/hal_sh_sh77x9_se77x9.cdl: Fix SuperIO CDL option mistake. + +2001-10-16 Jesper Skov + + * cdl/hal_sh_sh77x9_se77x9.cdl: Removed DP83902A hack. + +2001-10-15 Jesper Skov + + * cdl/hal_sh_sh77x9_se77x9.cdl: Additional requirements to work + around problem of inferred values. + Added DP83902A hack. + + * src/ser16c550c.c: Get serial controller details from CDL. + + * src/plf_misc.c (hal_platform_init): Only call SuperIO init + function if required. + + * include/platform.inc (BSC_settings_table): Initialize for DRAM + or SDRAM - but crudely so. Proper configury will be needed + eventually, when it's clear how much the SE77X9 boards actually + differ. + + * cdl/hal_sh_sh77x9_se77x9.cdl: Added SE7709RP01 platform + support. Added XTAL default option. Added options for serial + controller. Added crude option for DRAM/SDRAM. Added option for + SuperIO. + +2001-09-25 Jesper Skov + + * include/plf_intr.h: Removed dummy + CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF and + CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF definitions. + +2001-09-13 Jesper Skov + + * cdl/hal_sh_sh77x9_se77x9.cdl: Add CPU option. + +2001-09-12 Jesper Skov + + * include/plf_intr.h: Added interrupt controller support. + +2001-07-27 Jesper Skov + + * cdl/hal_sh_sh77x9_se77x9.cdl: Generate .eprom.srec of RedBoot + image. + +2001-06-28 Jesper Skov + + * include/pkgconf/mlt_sh_sh77x9_se77x9_ram.ldi: Leave 128k for + RedBoot. + * include/pkgconf/mlt_sh_sh77x9_se77x9_ram.mlt: Same. + * include/pkgconf/mlt_sh_sh77x9_se77x9_ram.h: Same. + + * misc/redboot_RAM.ecm: Added compression. + * misc/redboot_ROM.ecm: Same. + + * cdl/hal_sh_sh77x9_se77x9.cdl: Don't make relocated .srec file. + +2001-06-26 Jesper Skov + + * misc/redboot_RAM.ecm: Reduced stacksize to 6kB. + * misc/redboot_ROM.ecm: Same. + +2001-06-25 Jesper Skov + + * misc/redboot_RAM.ecm: Updated stack size. + * misc/redboot_ROM.ecm: Same. + +2001-06-22 Jesper Skov + + * include/platform.inc (SDMR): Fiddled. + +2001-06-19 Jesper Skov + + * cdl/hal_sh_sh77x9_se77x9.cdl: Our board has a 7709S CPU. + + * misc/redboot_ROM.ecm: Don't include CPU variant details. + * misc/redboot_RAM.ecm: Same. + +2001-06-17 Jesper Skov + + * include/plf_intr.h: Renamed serial interrupts. + + * src/smsc37c93x.c (cyg_hal_init_superIO): Power on COM1. Use + correct interrupt. + + * src/ser16c550c.c: Got it enabled. Correct offset and clock. + + * src/hal_diag.c (cyg_hal_plf_comms_init): SuperIO working. + +2001-06-16 Jesper Skov + + * include/plf_intr.h: Define external interrupts. + + * misc/redboot_ROM.ecm: Added eth driver. + * misc/redboot_RAM.ecm: Same. + + * cdl/hal_sh_sh77x9_se77x9.cdl: Force IRL interrupt mode. Separate + srec output rules for Hitachi Mon (which needs reloc) and for + normal RedBoot use. + +2001-06-12 Jesper Skov + + * src/smsc37c93x.c: Use 16bit writes. + + * src/ser16c550c.c: Update to access by 16bit units. Can't get it + to work though. + + * cdl/hal_sh_sh77x9_se77x9.cdl: Only two serial channels. + * src/hal_diag.c: Same. + +2001-06-12 Jesper Skov + + * New platform HAL. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/sh/se77x9/current/cdl/hal_sh_sh77x9_se77x9.cdl b/packages/hal/sh/se77x9/current/cdl/hal_sh_sh77x9_se77x9.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/cdl/hal_sh_sh77x9_se77x9.cdl @@ -0,0 +1,456 @@ +# ==================================================================== +# +# hal_sh_sh77x9_se77x9.cdl +# +# Hitachi SE77X9 board HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: jskov +# Contributors: +# Date: 2001-05-25 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_SH_SH77X9_SE77X9 { + display "Hitachi/SH77X9 SE77X9 board" + parent CYGPKG_HAL_SH + requires ! CYGHWR_HAL_SH_BIGENDIAN + requires CYGHWR_HAL_SH_IRQ_USE_IRQLVL + define_header hal_sh_sh77x9_se77x9.h + include_dir cyg/hal + description " + The SE77X9 HAL package provides the support needed to run + eCos on a Hitachi/SH SE77X9 board." + + compile hal_diag.c plf_misc.c ser16c550c.c + + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_VIRTUAL_VECTOR_COMM_BAUD_SUPPORT + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + + puts $::cdl_header "#define CYGNUM_HAL_SH_SH3_SCIF_PORTS 1" + puts $::cdl_header "#define CYGHWR_HAL_VSR_TABLE 0x8c000000" + puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0x8c000100" + + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"SE77X9\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_option CYGPRI_HAL_SH_SH77X9_VARIANT { + display "Board variant" + flavor data + legal_values {"SE7709RP01" "SE7709SE01" "SE7729SE01"} + default_value {"SE7709SE01"} + no_define + description " + Select the particular board variant used." + } + + cdl_option CYGPRI_HAL_SH_SH77X9_SUPERIO { + display "Board variant has SuperIO controller" + default_value 0 + compile smsc37c93x.c + description " + Set if the board has a SuperIO controller." + } + + + cdl_option CYGPRI_HAL_SH_SH77X9_VARIANT_7709R { + display "SE7709RP01 board" + active_if { CYGPRI_HAL_SH_SH77X9_VARIANT == "SE7709RP01" } + calculated 1 + + requires CYGPKG_HAL_SH_7709R + requires !CYGPKG_HAL_SH_7709S + requires !CYGPKG_HAL_SH_7729 + requires !CYGPRI_HAL_SH_SH77X9_SUPERIO + requires { CYGNUM_HAL_SH_OOC_XTAL_DEFAULT == 20000000 } + define_proc { + puts $::cdl_header "#define HAL_PLATFORM_CPU \"SH 7709R\"" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_16550_CLOCK 14745000" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_16550_BASE 0xb0800000" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_LEDS_BASE 0xb1800000" + } + + description "Settings for the 7709R variant of the board." + } + + cdl_option CYGPRI_HAL_SH_SH77X9_VARIANT_7709S { + display "SE7709SE01 board" + active_if { CYGPRI_HAL_SH_SH77X9_VARIANT == "SE7709SE01" } + calculated 1 + requires CYGPRI_HAL_SH_SH77X9_SUPERIO + requires !CYGPKG_HAL_SH_7709R + requires CYGPKG_HAL_SH_7709S + requires !CYGPKG_HAL_SH_7729 + define_proc { + puts $::cdl_header "#define HAL_PLATFORM_CPU \"SH 7709S\"" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_16550_CLOCK 1846200" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_16550_BASE 0xb04007f0" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_LEDS_BASE 0xb0c00000" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP" + } + + description "Settings for the 7709S variant of the board." + } + + cdl_option CYGPRI_HAL_SH_SH77X9_VARIANT_7729 { + display "SE7729SE01 board" + active_if { CYGPRI_HAL_SH_SH77X9_VARIANT == "SE7729SE01" } + calculated 1 + requires CYGPRI_HAL_SH_SH77X9_SUPERIO + requires !CYGPKG_HAL_SH_7709R + requires !CYGPKG_HAL_SH_7709S + requires CYGPKG_HAL_SH_7729 + define_proc { + puts $::cdl_header "#define HAL_PLATFORM_CPU \"SH 7729\"" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_16550_CLOCK 1846200" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_16550_BASE 0xb04007f0" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_LEDS_BASE 0xb0c00000" + puts $::cdl_header "#define CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP" + } + + description "Settings for the 7729 variant of the board." + } + + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM" "ROM" "ROMRAM" } + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the SE77X9 board it is possible to build + the system for either RAM bootstrap or ROM bootstrap. + RAM bootstrap generally requires that the board + is equipped with ROMs containing a suitable ROM monitor or + equivalent software that allows GDB to download the eCos + application on to the board. The ROM bootstrap typically + requires that the eCos application be blown into EPROMs or + equivalent technology. ROMRAM bootstrap is similar to ROM + bootstrap, but everything is copied to RAM before execution + starts thus improving performance, but at the cost of an + increased RAM footprint." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 2 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The SE77X9 board has one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + The SE77X9 board has two serial ports. This option + chooses which port will be used for diagnostic output." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD { + display "Console/GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + define CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD + description " + This option controls the default baud rate used for the + Console/GDB connection." + } + + cdl_component CYGHWR_HAL_SH_PLF_CLOCK_SETTINGS { + display "SH on-chip platform clock controls" + description " + The various clocks used by the system are derived from + these options." + flavor none + no_define + + cdl_option CYGNUM_HAL_SH_OOC_XTAL_DEFAULT { + display "SH clock crystal default value" + flavor data + default_value 33333300 + no_define + } + + cdl_option CYGHWR_HAL_SH_OOC_XTAL { + display "SH clock crystal" + flavor data + legal_values 8000000 to 50000000 + default_value { CYGNUM_HAL_SH_OOC_XTAL_DEFAULT } + no_define + description " + This option specifies the frequency of the crystal all + other clocks are derived from." + } + + cdl_option CYGHWR_HAL_SH_OOC_PLL_1 { + display "SH clock PLL circuit 1" + flavor data + default_value 4 + legal_values { 0 1 2 3 4 6 8 } + description " + This selects the multiplication factor provided by + PLL1. If PLL1 is disabled via CAP1, this option should + be set to zero." + } + + cdl_option CYGHWR_HAL_SH_OOC_PLL_2 { + display "SH clock PLL circuit 2" + flavor data + default_value 1 + legal_values { 0 1 4 } + no_define + description " + This selects the multiplication factor provided by + PLL2. If PLL2 is disabled via CAP2, this option should + be set to zero." + } + + cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_1 { + display "SH clock divider 1" + flavor data + default_value 1 + legal_values { 1 2 3 4 6 } + description " + This divider option affects the CPU core clock." + } + + cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_2 { + display "SH clock divider 2" + flavor data + default_value 4 + legal_values { 1 2 3 4 6 } + description " + This divider option affects the peripheral clock." + } + + cdl_option CYGHWR_HAL_SH_OOC_CLOCK_MODE { + display "SH clock mode" + flavor data + default_value 0 + legal_values { 0 1 2 3 4 7 } + description " + This option must mirror the clock mode hardwired on + the MD0-MD2 pins of the CPU in order to correctly + initialize the FRQCR register." + } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + no_define + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "sh-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { CYGHWR_HAL_SH_BIGENDIAN ? "-mb -m3 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -ggdb -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" : "-ml -m3 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -ggdb -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { CYGHWR_HAL_SH_BIGENDIAN ? "-mb -m3 -ggdb -nostdlib -Wl,--gc-sections -Wl,-static" : "-ml -m3 -ggdb -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires { CYG_HAL_STARTUP == "ROM" } + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires ! CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires ! CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "sh_sh77x9_se77x9_ram" : \ + CYG_HAL_STARTUP == "ROM" ? "sh_sh77x9_se77x9_rom" : \ + "sh_sh77x9_se77x9_romram" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ + CYG_HAL_STARTUP == "ROM" ? "" : \ + "" } + } + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + requires { CYG_HAL_STARTUP == "RAM" } + parent CYGPKG_HAL_ROM_MONITOR + description " + Support can be enabled for boot ROMs or ROM monitors which contain + GDB stubs. This support changes various eCos semantics such as + the encoding of diagnostic output, and the overriding of hardware + interrupt vectors." + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) --change-address 0x21000000 -O srec $< $(@:.bin=.eprom.srec) + $(OBJCOPY) -O binary $< $@ + } + } + } +} diff --git a/packages/hal/sh/se77x9/current/include/hal_diag.h b/packages/hal/sh/se77x9/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/hal_diag.h @@ -0,0 +1,69 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +//============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-12 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +#include + +#define HAL_DIAG_INIT() hal_if_diag_init() +#define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_) +#define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_) + +//----------------------------------------------------------------------------- +// end of hal_diag.h +#endif // CYGONCE_HAL_HAL_DIAG_H diff --git a/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_ram.h b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_ram.h @@ -0,0 +1,20 @@ +// eCos memory layout - Thu May 31 15:00:18 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x8c020000) +#define CYGMEM_REGION_ram_SIZE (0x1fe0000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x8e000000 - (size_t) CYG_LABEL_NAME (__heap1)) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__pci_window) []; +#endif diff --git a/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_ram.ldi b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_ram.ldi @@ -0,0 +1,26 @@ +// eCos memory layout - Thu May 31 15:00:18 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x8c020000, LENGTH = 0x1fe0000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_vectors (ram, 0x8c020000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_ram.mlt b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_ram.mlt @@ -0,0 +1,13 @@ +version 0 +region ram 8c020000 1fe0000 0 ! +section vectors 0 1 0 1 1 1 1 1 8c020000 8c020000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 8 0 1 0 1 0 1 rodata rodata ! +section rodata 0 8 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 8 0 1 0 1 0 1 bss bss ! +section bss 0 10 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! + diff --git a/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_rom.h b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_rom.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_rom.h @@ -0,0 +1,25 @@ +// eCos memory layout - Thu May 31 15:02:44 2001 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_rom (0x80000000) +#define CYGMEM_REGION_rom_SIZE (0x200000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#define CYGMEM_REGION_ram (0x8c000000) +#define CYGMEM_REGION_ram_SIZE (0x2000000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__reserved) []; +#endif +#define CYGMEM_SECTION_reserved (CYG_LABEL_NAME (__reserved)) +#define CYGMEM_SECTION_reserved_SIZE (0x200) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x8e000000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_rom.ldi b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_rom.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_rom.ldi @@ -0,0 +1,28 @@ +// eCos memory layout - Thu May 31 15:02:44 2001 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + rom : ORIGIN = 0x80000000, LENGTH = 0x400000 + ram : ORIGIN = 0x8c000000, LENGTH = 0x2000000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_vectors (rom, 0x80000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + CYG_LABEL_DEFN(__reserved) = 0x8c000000; . = CYG_LABEL_DEFN(__reserved) + 0x200; + SECTION_data (ram, ALIGN (0x1), FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_rom.mlt b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_rom.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/pkgconf/mlt_sh_sh77x9_se77x9_rom.mlt @@ -0,0 +1,14 @@ +version 0 +region rom 80000000 400000 1 !Flash Bank 0 +region ram 8c000000 2000000 0 ! +section vectors 0 1 0 1 1 1 1 1 80000000 80000000 text text ! +section text 0 4 0 1 0 1 0 1 fini fini ! +section fini 0 4 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 8 0 1 0 1 0 1 rodata rodata ! +section rodata 0 8 0 1 0 1 0 1 fixup fixup ! +section fixup 0 4 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 0 0 1 data ! +section reserved 200 1 0 0 1 1 1 0 8c000000 8c000000 data ! +section data 0 1 1 1 0 1 0 0 bss ! +section bss 0 10 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/sh/se77x9/current/include/platform.inc b/packages/hal/sh/se77x9/current/include/platform.inc new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/platform.inc @@ -0,0 +1,212 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## Hitachi SE77x9 board assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): jskov +## Contributors:jskov, gthomas +## Date: 2001-06-12 +## Purpose: Hitachi SE77x9 platform startup +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the Hitachi SE77x9 +## board. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include + +#include +#include + +#------------------------------------------------------------------------------ +# Hardware initialization. + + .macro hal_hardware_init +#ifndef CYG_HAL_STARTUP_RAM + // Set up the Bus State Controller + mova BSC_settings_table,r0 + mov r0,r3 +1: mov.w @r3+,r0 // Address (or zero) + cmp/eq #0,r0 + bt 2f + mov.w @r3+,r1 // data + bra 1b + mov.w r1,@r0 // delay slot + + .align 2 +BSC_settings_table: + .word CYGARC_REG_WTCSR, 0xA502 + .word CYGARC_REG_WTCNT, 0x5A00 + .word CYGARC_REG_FRQCR, CYGARC_REG_FRQCR_INIT + # Settings from Hitachi docs for SE7709A +#ifdef CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP + .word CYGARC_REG_BCR1, 0x0008 +#else + .word CYGARC_REG_BCR1, 0x0810 +#endif + .word CYGARC_REG_BCR2, 0x2ef0 + .word CYGARC_REG_BCR3, 0x0000 + .word CYGARC_REG_WCR1, 0x0c30 +#ifdef CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP + .word CYGARC_REG_WCR2, 0x7ddb + .word CYGARC_REG_MCR, 0x002c +#else + .word CYGARC_REG_WCR2, 0x5d5a + .word CYGARC_REG_MCR, 0x0055 +#endif + .word CYGARC_REG_DCR, 0x0000 + .word CYGARC_REG_PCR, 0x0000 +#ifdef CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP + .word CYGARC_REG_RTCOR, 0xa580 +#else + .word CYGARC_REG_RTCOR, 0xa54e +#endif + .word CYGARC_REG_RFCR, 0xa400 + .word CYGARC_REG_RTCNT, 0xa500 + .word CYGARC_REG_RTCSR, 0xa508 + .word 0 + +2: +#ifdef CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP + mov.l $SDMR,r1 // Turns on SDRAM controller + mov.l $SDMR_val,r2 + mov.b r2,@r1 +#endif + mova Post_settings_table,r0 + mov r0,r3 +1: mov.l @r3+,r0 // Address (or zero) + cmp/eq #0,r0 + bt 4f + mov.l @r3+,r1 // data + bra 1b + mov.w r1,@r0 // delay slot + + .align 4 +#ifdef CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP +$SDMR: .long 0xffffe088 +$SDMR_val: + .long 0 +#endif + +Post_settings_table: + .long CYGNUM_HAL_SH_SE77X9_LEDS_BASE,0x5555 // leds + .long 0 +4: +#endif // CYG_HAL_STARTUP_RAM + .endm + +#------------------------------------------------------------------------------ +# Monitor initialization. + +#ifndef CYGPKG_HAL_SH_MON_DEFINED + +#if !defined(CYG_HAL_STARTUP_RAM) || \ + ( defined(CYG_HAL_STARTUP_RAM) && \ + !defined(CYGSEM_HAL_USE_ROM_MONITOR)) + + # If we are not starting up from RAM, or we are starting in + # RAM and NOT using a ROM monitor, initialize the VSR table. + + .macro hal_mon_init + mov.l $hal_vsr_table,r3 + # Write exception vectors + mov.l $cyg_hal_default_exception_vsr,r4 + mov #CYGNUM_HAL_VSR_EXCEPTION_COUNT,r5 +1: mov.l r4,@r3 + add #4,r3 + dt r5 + bf 1b + # Write interrupt vector + mov.l $cyg_hal_default_interrupt_vsr,r4 + mov.l $hal_vsr_table,r3 + add #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3 + mov.l r4,@r3 + bra 2f + nop + .align 2 + + SYM_PTR_REF(cyg_hal_default_exception_vsr) + SYM_PTR_REF(cyg_hal_default_interrupt_vsr) + SYM_PTR_REF(hal_vsr_table) +2: + .endm + +#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR) + + # Initialize the VSR table entries + # We only take control of the interrupt vector, + # the rest are left to the ROM for now... + + .macro hal_mon_init + # Write interrupt vector + mov.l $hal_vsr_table,r3 + mov.l $cyg_hal_default_interrupt_vsr,r4 + add #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3 + mov.l r4,@r3 + bra 2f + nop + .align 2 + + SYM_PTR_REF(cyg_hal_default_interrupt_vsr) + SYM_PTR_REF(hal_vsr_table) +2: + .endm + +#else + + .macro hal_mon_init + .endm + +#endif + + +#define CYGPKG_HAL_SH_MON_DEFINED + +#endif // CYGPKG_HAL_SH_MON_DEFINED + +#endif // CYGONCE_HAL_PLATFORM_INC diff --git a/packages/hal/sh/se77x9/current/include/plf_cache.h b/packages/hal/sh/se77x9/current/include/plf_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/plf_cache.h @@ -0,0 +1,66 @@ +#ifndef CYGONCE_PLF_CACHE_H +#define CYGONCE_PLF_CACHE_H + +//============================================================================= +// +// plf_cache.h +// +// Platform specific cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-12 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +// Nothing here + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_PLF_CACHE_H +// End of plf_cache.h + diff --git a/packages/hal/sh/se77x9/current/include/plf_intr.h b/packages/hal/sh/se77x9/current/include/plf_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/plf_intr.h @@ -0,0 +1,169 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// Platform specific Interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-06-12 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the SE77x9 board. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +//---------------------------------------------------------------------------- +// External interrupts +#define CYGNUM_HAL_INTERRUPT_EXTERNALS_BASE CYGNUM_HAL_INTERRUPT_LVL0 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ8 CYGNUM_HAL_INTERRUPT_LVL0 +#define CYGNUM_HAL_INTERRUPT_KEYBOARD CYGNUM_HAL_INTERRUPT_LVL1 +#define CYGNUM_HAL_INTERRUPT_PCMCIA2 CYGNUM_HAL_INTERRUPT_LVL2 +#define CYGNUM_HAL_INTERRUPT_COM2 CYGNUM_HAL_INTERRUPT_LVL3 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ6 CYGNUM_HAL_INTERRUPT_LVL4 +#define CYGNUM_HAL_INTERRUPT_MOUSE CYGNUM_HAL_INTERRUPT_LVL5 +#define CYGNUM_HAL_INTERRUPT_PCMCIA1 CYGNUM_HAL_INTERRUPT_LVL6 +#define CYGNUM_HAL_INTERRUPT_COM1 CYGNUM_HAL_INTERRUPT_LVL7 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ4 CYGNUM_HAL_INTERRUPT_LVL8 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ3 CYGNUM_HAL_INTERRUPT_LVL9 +#define CYGNUM_HAL_INTERRUPT_PARALLEL CYGNUM_HAL_INTERRUPT_LVL10 +#define CYGNUM_HAL_INTERRUPT_SLOT_IRQ2 CYGNUM_HAL_INTERRUPT_LVL11 +#define CYGNUM_HAL_INTERRUPT_LAN CYGNUM_HAL_INTERRUPT_LVL12 +#define CYGNUM_HAL_INTERRUPT_IDE CYGNUM_HAL_INTERRUPT_LVL13 +#define CYGNUM_HAL_INTERRUPT_PCMCIA0 CYGNUM_HAL_INTERRUPT_LVL14 + +//---------------------------------------------------------------------------- +// Interrupt controller +#define CYGARC_REG_INTC_A 0xb1400000 +#define CYGARC_REG_INTC_B 0xb1400002 +#define CYGARC_REG_INTC_C 0xb1400004 +#define CYGARC_REG_INTC_D 0xb1400006 +#define CYGARC_REG_INTC_E 0xb1400008 +#define CYGARC_REG_INTC_F 0xb140000a +#define CYGARC_REG_INTC_G 0xb140000c + +//---------------------------------------------------------------------------- +// Interrupt configuration extention macros +// +// It appears that masks do not appear linear in the INTC like on the SE7751. +// The below magic values determined from the INTC's startup values. +// A B C D E F G +// 0xb1400000: 0x02a0 0x0005 0x008c 0xe030 0x0d91 0xf0b0 0x7640 0x0000 + +static inline void +_mask_vec(int level, cyg_uint32 reg, int shift, int lvl) +{ + cyg_uint16 msk; + shift *= 4; + HAL_READ_UINT16(reg, msk); + msk &= ~(0x000f << shift); + if (level) msk |= lvl << shift; + HAL_WRITE_UINT16(reg, msk); +} + +#define CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF(vec, level) \ + case CYGNUM_HAL_INTERRUPT_SLOT_IRQ8: \ + _mask_vec(level, CYGARC_REG_INTC_F, 3, 0xf); \ + break; \ + case CYGNUM_HAL_INTERRUPT_KEYBOARD: \ + _mask_vec(level, CYGARC_REG_INTC_D, 3, 0xe); \ + break; \ + case CYGNUM_HAL_INTERRUPT_PCMCIA2: \ + _mask_vec(level, CYGARC_REG_INTC_E, 2, 0xd); \ + break; \ + case CYGNUM_HAL_INTERRUPT_COM2: \ + _mask_vec(level, CYGARC_REG_INTC_C, 0, 0xc); \ + break; \ + case CYGNUM_HAL_INTERRUPT_SLOT_IRQ6: \ + _mask_vec(level, CYGARC_REG_INTC_F, 1, 0xb); \ + break; \ + case CYGNUM_HAL_INTERRUPT_MOUSE: \ + _mask_vec(level, CYGARC_REG_INTC_A, 1, 0xa); \ + break; \ + case CYGNUM_HAL_INTERRUPT_PCMCIA1: \ + _mask_vec(level, CYGARC_REG_INTC_E, 1, 0x9); \ + break; \ + case CYGNUM_HAL_INTERRUPT_COM1: \ + _mask_vec(level, CYGARC_REG_INTC_C, 1, 0x8); \ + break; \ + case CYGNUM_HAL_INTERRUPT_SLOT_IRQ4: \ + _mask_vec(level, CYGARC_REG_INTC_G, 3, 0x7); \ + break; \ + case CYGNUM_HAL_INTERRUPT_SLOT_IRQ3: \ + _mask_vec(level, CYGARC_REG_INTC_G, 2, 0x6); \ + break; \ + case CYGNUM_HAL_INTERRUPT_PARALLEL: \ + _mask_vec(level, CYGARC_REG_INTC_B, 0, 0x5); \ + break; \ + case CYGNUM_HAL_INTERRUPT_SLOT_IRQ2: \ + _mask_vec(level, CYGARC_REG_INTC_G, 1, 0x4); \ + break; \ + case CYGNUM_HAL_INTERRUPT_LAN: \ + _mask_vec(level, CYGARC_REG_INTC_D, 1, 0x3); \ + break; \ + case CYGNUM_HAL_INTERRUPT_IDE: \ + _mask_vec(level, CYGARC_REG_INTC_A, 2, 0x2); \ + break; \ + case CYGNUM_HAL_INTERRUPT_PCMCIA0: \ + _mask_vec(level, CYGARC_REG_INTC_E, 0, 0x1); \ + break; + +//---------------------------------------------------------------------------- +// Reset. +// Block interrupts and cause an exception. This forces a reset. +#define HAL_PLATFORM_RESET() \ + asm volatile ("ldc %0,sr;trapa #0x00;" : : "r" (CYGARC_REG_SR_BL)) + +#define HAL_PLATFORM_RESET_ENTRY 0x80000000 + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/packages/hal/sh/se77x9/current/include/plf_io.h b/packages/hal/sh/se77x9/current/include/plf_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/plf_io.h @@ -0,0 +1,59 @@ +#ifndef CYGONCE_PLF_IO_H +#define CYGONCE_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// Platform specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-06-12 +// Purpose: SE77x9 IO support macros +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_PLF_IO_H diff --git a/packages/hal/sh/se77x9/current/include/plf_stub.h b/packages/hal/sh/se77x9/current/include/plf_stub.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/include/plf_stub.h @@ -0,0 +1,88 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-12 +// Purpose: Platform HAL stub support for Hitachi SE77x9 board. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#ifdef CYGPKG_IO_SERIAL +#include +#endif + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include // CYG_UNUSED_PARAM, externC + +#include // architecture stub support + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/packages/hal/sh/se77x9/current/misc/redboot_7709_RAM.ecm b/packages/hal/sh/se77x9/current/misc/redboot_7709_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/misc/redboot_7709_RAM.ecm @@ -0,0 +1,74 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware se77x9 ; + template redboot ; + package -hardware CYGPKG_HAL_SH current ; + package -hardware CYGPKG_HAL_SH_SH3 current ; + package -hardware CYGPKG_HAL_SH_SH77X9_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_SH_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; + package -hardware CYGPKG_DEVS_ETH_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SCIF current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGHWR_HAL_SH_BIGENDIAN { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_SH_7709S { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + inferred_value 1 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/se77x9/current/misc/redboot_7709_ROM.ecm b/packages/hal/sh/se77x9/current/misc/redboot_7709_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/misc/redboot_7709_ROM.ecm @@ -0,0 +1,78 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware se77x9 ; + template redboot ; + package -hardware CYGPKG_HAL_SH current ; + package -hardware CYGPKG_HAL_SH_SH3 current ; + package -hardware CYGPKG_HAL_SH_SH77X9_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_SH_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; + package -hardware CYGPKG_DEVS_ETH_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SCIF current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package CYGPKG_ISOINFRA current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGHWR_HAL_SH_BIGENDIAN { + inferred_value 0 +}; + +cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + inferred_value 1 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/se77x9/current/misc/redboot_7729_RAM.ecm b/packages/hal/sh/se77x9/current/misc/redboot_7729_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/misc/redboot_7729_RAM.ecm @@ -0,0 +1,100 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware se77x9 ; + template redboot ; + package -hardware CYGPKG_HAL_SH current ; + package -hardware CYGPKG_HAL_SH_SH3 current ; + package -hardware CYGPKG_HAL_SH_SH77X9_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_SH_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; + package -hardware CYGPKG_DEVS_ETH_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SCIF current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_SH_SH3 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGHWR_HAL_SH_BIGENDIAN { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_SH_7709S { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_SH_7729 { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + inferred_value 1 +}; + +cdl_option CYGPRI_HAL_SH_SH77X9_VARIANT { + user_value SE7729SE01 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/se77x9/current/misc/redboot_7729_ROM.ecm b/packages/hal/sh/se77x9/current/misc/redboot_7729_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/misc/redboot_7729_ROM.ecm @@ -0,0 +1,108 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware se77x9 ; + template redboot ; + package -hardware CYGPKG_HAL_SH current ; + package -hardware CYGPKG_HAL_SH_SH3 current ; + package -hardware CYGPKG_HAL_SH_SH77X9_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_SH_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; + package -hardware CYGPKG_DEVS_ETH_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SCIF current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_SH_SH3 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_SH_BIGENDIAN { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_SH_7709S { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_SH_7729 { + inferred_value 1 +}; + +cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + inferred_value 1 +}; + +cdl_option CYGPRI_HAL_SH_SH77X9_VARIANT { + user_value SE7729SE01 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/se77x9/current/misc/redboot_SE7709RP01_RAM.ecm b/packages/hal/sh/se77x9/current/misc/redboot_SE7709RP01_RAM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/misc/redboot_SE7709RP01_RAM.ecm @@ -0,0 +1,117 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware se77x9 ; + template redboot ; + package -hardware CYGPKG_HAL_SH current ; + package -hardware CYGPKG_HAL_SH_SH3 current ; + package -hardware CYGPKG_HAL_SH_SH77X9_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_SH_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; + package -hardware CYGPKG_DEVS_ETH_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SCIF current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_SH_SH3 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGHWR_HAL_SH_BIGENDIAN { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_SH_7709R { + inferred_value 1 +}; + +cdl_option CYGPKG_HAL_SH_7709S { + inferred_value 0 +}; + +cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + inferred_value 1 +}; + +cdl_option CYGPRI_HAL_SH_SH77X9_VARIANT { + user_value SE7709RP01 +}; + +cdl_component CYG_HAL_STARTUP { + user_value RAM +}; + +cdl_option CYGNUM_HAL_SH_OOC_XTAL_DEFAULT { + inferred_value 20000000 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/se77x9/current/misc/redboot_SE7709RP01_ROM.ecm b/packages/hal/sh/se77x9/current/misc/redboot_SE7709RP01_ROM.ecm new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/misc/redboot_SE7709RP01_ROM.ecm @@ -0,0 +1,121 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware se77x9 ; + template redboot ; + package -hardware CYGPKG_HAL_SH current ; + package -hardware CYGPKG_HAL_SH_SH3 current ; + package -hardware CYGPKG_HAL_SH_SH77X9_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_SH_SE77X9 current ; + package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; + package -hardware CYGPKG_DEVS_ETH_NS_DP83902A current ; + package -hardware CYGPKG_DEVS_ETH_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SE77X9 current ; + package -hardware CYGPKG_IO_SERIAL_SH_SCIF current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_SH_SH3 current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_NS_DNS current ; + package CYGPKG_MEMALLOC current ; + package CYGPKG_COMPRESS_ZLIB current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + user_value 1 +}; + +cdl_option CYGHWR_HAL_SH_BIGENDIAN { + inferred_value 0 +}; + +cdl_option CYGPKG_HAL_SH_7709R { + inferred_value 1 +}; + +cdl_option CYGPKG_HAL_SH_7709S { + inferred_value 0 +}; + +cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + inferred_value 1 +}; + +cdl_option CYGPRI_HAL_SH_SH77X9_VARIANT { + user_value SE7709RP01 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_option CYGNUM_HAL_SH_OOC_XTAL_DEFAULT { + inferred_value 20000000 +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 { + inferred_value 1 +}; + + diff --git a/packages/hal/sh/se77x9/current/src/hal_diag.c b/packages/hal/sh/se77x9/current/src/hal_diag.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/src/hal_diag.c @@ -0,0 +1,83 @@ +//============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-06-12 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include // our header. + +#include // Calling interface +#include // Interrupt macros +#include // driver API + +//----------------------------------------------------------------------------- + +externC void cyg_hal_plf_serial_init(void); + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + // SuperIO claims channel 0 for the COM1 connector + cyg_hal_plf_serial_init(); + // Debug connector on mainboard is SCIF2. + cyg_hal_plf_scif_init(0, 1, CYGNUM_HAL_INTERRUPT_SCIF_RXI2, + (cyg_uint8*)CYGARC_REG_SCIF_SCSMR2); +} + +//----------------------------------------------------------------------------- +// End of hal_diag.c diff --git a/packages/hal/sh/se77x9/current/src/plf_misc.c b/packages/hal/sh/se77x9/current/src/plf_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/src/plf_misc.c @@ -0,0 +1,74 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-06-12 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include // interfacing API +#include + +//-------------------------------------------------------------------------- +externC void cyg_hal_init_superIO(void); + +void +hal_platform_init(void) +{ +#ifdef CYGPRI_HAL_SH_SH77X9_SUPERIO + // Init superIO before calling if_init (which will use UARTs) + cyg_hal_init_superIO(); +#endif + + hal_if_init(); +} + +//-------------------------------------------------------------------------- +// eof plf_misc.c diff --git a/packages/hal/sh/se77x9/current/src/ser16c550c.c b/packages/hal/sh/se77x9/current/src/ser16c550c.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/src/ser16c550c.c @@ -0,0 +1,541 @@ +//============================================================================= +// +// ser16c550c.c +// +// Simple driver for the 16c550c serial controllers on the HS7729PCI board +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dmoseley +// Contributors:dmoseley, jskov +// Date: 2001-03-20 +// Description: Simple driver for the 16c550c serial controller +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interface API +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // Helper functions +#include // CYG_ISR_HANDLED + +//----------------------------------------------------------------------------- +// Define the serial registers. The SE77x9 board are equipped with a 16550C +// serial chips and different addresses and clocked at different rates. +// Details are in CDL. +// The registers are accessed as 16 bit, but only the upper 8 bits contain data. +#define SE77X9_SER_CLOCK CYGNUM_HAL_SH_SE77X9_16550_CLOCK +#define SE77X9_SER_16550_BASE_A CYGNUM_HAL_SH_SE77X9_16550_BASE +#define SER_16550_RBR 0x00 // receiver buffer register, read, dlab = 0 +#define SER_16550_THR 0x00 // transmitter holding register, write, dlab = 0 +#define SER_16550_DLL 0x00 // divisor latch (LS), read/write, dlab = 1 +#define SER_16550_IER 0x02 // interrupt enable register, read/write, dlab = 0 +#define SER_16550_DLM 0x02 // divisor latch (MS), read/write, dlab = 1 +#define SER_16550_IIR 0x04 // interrupt identification reg, read, dlab = 0 +#define SER_16550_FCR 0x04 // fifo control register, write, dlab = 0 +#define SER_16550_AFR 0x04 // alternate function reg, read/write, dlab = 1 +#define SER_16550_LCR 0x06 // line control register, read/write +#define SER_16550_MCR 0x08 // modem control register, read/write +#define SER_16550_LSR 0x0a // line status register, read +#define SER_16550_MSR 0x0c // modem status register, read +#define SER_16550_SCR 0x0e // scratch pad register + +// The interrupt enable register bits. +#define SIO_IER_ERDAI 0x01 // enable received data available irq +#define SIO_IER_ETHREI 0x02 // enable THR empty interrupt +#define SIO_IER_ELSI 0x04 // enable receiver line status irq +#define SIO_IER_EMSI 0x08 // enable modem status interrupt + +// The interrupt identification register bits. +#define SIO_IIR_IP 0x01 // 0 if interrupt pending +#define SIO_IIR_ID_MASK 0x0e // mask for interrupt ID bits + +// The line status register bits. +#define SIO_LSR_DR 0x01 // data ready +#define SIO_LSR_OE 0x02 // overrun error +#define SIO_LSR_PE 0x04 // parity error +#define SIO_LSR_FE 0x08 // framing error +#define SIO_LSR_BI 0x10 // break interrupt +#define SIO_LSR_THRE 0x20 // transmitter holding register empty +#define SIO_LSR_TEMT 0x40 // transmitter register empty +#define SIO_LSR_ERR 0x80 // any error condition + +// The modem status register bits. +#define SIO_MSR_DCTS 0x01 // delta clear to send +#define SIO_MSR_DDSR 0x02 // delta data set ready +#define SIO_MSR_TERI 0x04 // trailing edge ring indicator +#define SIO_MSR_DDCD 0x08 // delta data carrier detect +#define SIO_MSR_CTS 0x10 // clear to send +#define SIO_MSR_DSR 0x20 // data set ready +#define SIO_MSR_RI 0x40 // ring indicator +#define SIO_MSR_DCD 0x80 // data carrier detect + +// The line control register bits. +#define SIO_LCR_WLS0 0x01 // word length select bit 0 +#define SIO_LCR_WLS1 0x02 // word length select bit 1 +#define SIO_LCR_STB 0x04 // number of stop bits +#define SIO_LCR_PEN 0x08 // parity enable +#define SIO_LCR_EPS 0x10 // even parity select +#define SIO_LCR_SP 0x20 // stick parity +#define SIO_LCR_SB 0x40 // set break +#define SIO_LCR_DLAB 0x80 // divisor latch access bit + +// The FIFO control register +#define SIO_FCR_FCR0 0x01 // enable xmit and rcvr fifos +#define SIO_FCR_FCR1 0x02 // clear RCVR FIFO +#define SIO_FCR_FCR2 0x04 // clear XMIT FIFO + +///////////////////////////////////////// +// Interrupt Enable Register +#define IER_RCV 0x01 +#define IER_XMT 0x02 +#define IER_LS 0x04 +#define IER_MS 0x08 + +// Line Control Register +#define LCR_WL5 0x00 // Word length +#define LCR_WL6 0x01 +#define LCR_WL7 0x02 +#define LCR_WL8 0x03 +#define LCR_SB1 0x00 // Number of stop bits +#define LCR_SB1_5 0x04 // 1.5 -> only valid with 5 bit words +#define LCR_SB2 0x04 +#define LCR_PN 0x00 // Parity mode - none +#define LCR_PE 0x0C // Parity mode - even +#define LCR_PO 0x08 // Parity mode - odd +#define LCR_PM 0x28 // Forced "mark" parity +#define LCR_PS 0x38 // Forced "space" parity +#define LCR_DL 0x80 // Enable baud rate latch + +// Line Status Register +#define LSR_RSR 0x01 +#define LSR_THE 0x20 + +// Modem Control Register +#define MCR_DTR 0x01 +#define MCR_RTS 0x02 +#define MCR_INT 0x08 // Enable interrupts +#define MCR_AFE 0x20 + +// Interrupt status register +#define ISR_None 0x01 +#define ISR_Rx_Line_Status 0x06 +#define ISR_Rx_Avail 0x04 +#define ISR_Rx_Char_Timeout 0x0C +#define ISR_Tx_Empty 0x02 +#define IRS_Modem_Status 0x00 + +// FIFO control register +#define FCR_ENABLE 0x01 +#define FCR_CLEAR_RCVR 0x02 +#define FCR_CLEAR_XMIT 0x04 + +#define CYG_DEV_SERIAL_BAUD_DIVISOR (SE77X9_SER_CLOCK/16/CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD) + +//----------------------------------------------------------------------------- + +#define UART_READ_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + cyg_uint16 t; \ + HAL_READ_UINT16((_a_), t); \ + (_d_) = (t >> 8) & 0xff; \ + CYG_MACRO_END + +#define UART_WRITE_UINT8(_a_, _d_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT16((_a_), (_d_)<<8); \ + CYG_MACRO_END + + +//----------------------------------------------------------------------------- +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +static const channel_data_t channels[1] = { + { (cyg_uint8*)SE77X9_SER_16550_BASE_A, 1000, CYGNUM_HAL_INTERRUPT_COM1 }, +}; + +//----------------------------------------------------------------------------- +// Set the baud rate + +static void +cyg_hal_plf_serial_set_baud(cyg_uint8* port, cyg_uint16 baud_divisor) +{ + cyg_uint8 _lcr; + + UART_READ_UINT8(port+SER_16550_LCR, _lcr); + _lcr |= LCR_DL; + UART_WRITE_UINT8(port+SER_16550_LCR, _lcr); + + UART_WRITE_UINT8(port+SER_16550_DLM, baud_divisor >> 8); + UART_WRITE_UINT8(port+SER_16550_DLL, baud_divisor & 0xff); + + _lcr &= ~LCR_DL; + UART_WRITE_UINT8(port+SER_16550_LCR, _lcr); +} + +//----------------------------------------------------------------------------- +// The minimal init, get and put functions. All by polling. + +void +cyg_hal_plf_serial_init_channel(void* __ch_data) +{ + cyg_uint8* port; + cyg_uint8 _lcr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + // Disable port interrupts while changing hardware + UART_WRITE_UINT8(port+SER_16550_IER, 0); + + // Set databits, stopbits and parity. + _lcr = LCR_WL8 | LCR_SB1 | LCR_PN; + UART_WRITE_UINT8(port+SER_16550_LCR, _lcr); + + // Set baud rate. + cyg_hal_plf_serial_set_baud(port, CYG_DEV_SERIAL_BAUD_DIVISOR); + + // Enable and clear FIFO + UART_WRITE_UINT8(port+SER_16550_FCR, (FCR_ENABLE | FCR_CLEAR_RCVR | FCR_CLEAR_XMIT)); + + // enable RTS to keep host side happy. Also allow interrupts + UART_WRITE_UINT8( port+SER_16550_MCR, MCR_DTR | MCR_RTS | MCR_INT); + + // Don't allow interrupts. + UART_WRITE_UINT8(port+SER_16550_IER, 0); +} + +void +cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 __ch) +{ + cyg_uint8* port; + cyg_uint8 _lsr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + CYGARC_HAL_SAVE_GP(); + + do { + UART_READ_UINT8(port+SER_16550_LSR, _lsr); + } while ((_lsr & SIO_LSR_THRE) == 0); + + // Now, the transmit buffer is empty + UART_WRITE_UINT8(port+SER_16550_THR, __ch); + + // Hang around until the character has been safely sent. + do { + UART_READ_UINT8(port+SER_16550_LSR, _lsr); + } while ((_lsr & SIO_LSR_THRE) == 0); + + CYGARC_HAL_RESTORE_GP(); +} + +static cyg_bool +cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* port; + cyg_uint8 _lsr; + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + port = ((channel_data_t*)__ch_data)->base; + + UART_READ_UINT8(port+SER_16550_LSR, _lsr); + if ((_lsr & SIO_LSR_DR) == 0) + return false; + + UART_READ_UINT8(port+SER_16550_RBR, *ch); + + return true; +} + +cyg_uint8 +cyg_hal_plf_serial_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +static void +cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(__len-- > 0) + cyg_hal_plf_serial_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_serial_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + + +cyg_bool +cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + int delay_count; + channel_data_t* chan; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan; + cyg_uint8 ier; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + + UART_READ_UINT8(chan->base + SER_16550_IER, ier); + ier |= SIO_IER_ERDAI; + UART_WRITE_UINT8(chan->base + SER_16550_IER, ier); + + HAL_INTERRUPT_SET_LEVEL(chan->isr_vector, 1); + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + + UART_READ_UINT8(chan->base + SER_16550_IER, ier); + ier &= ~SIO_IER_ERDAI; + UART_WRITE_UINT8(chan->base + SER_16550_IER, ier); + + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + break; + case __COMMCTL_SETBAUD: + { + cyg_uint32 baud_rate; + cyg_uint16 baud_divisor; + cyg_uint8* port = chan->base; + va_list ap; + + va_start(ap, __func); + baud_rate = va_arg(ap, cyg_uint32); + va_end(ap); + + baud_divisor = (SE77X9_SER_CLOCK / 16 / baud_rate); + + // Disable port interrupts while changing hardware + UART_READ_UINT8(port+SER_16550_IER, ier); + UART_WRITE_UINT8(port+SER_16550_IER, 0); + + // Set baud rate. + cyg_hal_plf_serial_set_baud(port, baud_divisor); + + // Reenable interrupts if necessary + UART_WRITE_UINT8(port+SER_16550_IER, ier); + } + break; + + case __COMMCTL_GETBAUD: + break; + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + int res = 0; + cyg_uint8 _iir, c; + channel_data_t* chan; + CYGARC_HAL_SAVE_GP(); + + // Some of the diagnostic print code calls through here with no idea what the ch_data is. + // Go ahead and assume it is channels[0]. + if (__ch_data == 0) + __ch_data = (void*)&channels[0]; + + chan = (channel_data_t*)__ch_data; + + HAL_INTERRUPT_ACKNOWLEDGE(chan->isr_vector); + + UART_READ_UINT8(chan->base + SER_16550_IIR, _iir); + _iir &= SIO_IIR_ID_MASK; + + *__ctrlc = 0; + if ((_iir == ISR_Rx_Avail) || (_iir == ISR_Rx_Char_Timeout)) { + + UART_READ_UINT8(chan->base + SER_16550_RBR, c); + + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +void +cyg_hal_plf_serial_init(void) +{ + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Disable interrupts. + HAL_INTERRUPT_MASK(channels[0].isr_vector); + + // Init channels + cyg_hal_plf_serial_init_channel((void*)&channels[0]); + + // Setup procs in the vector table + + // Set channel 0 + CYGACC_CALL_IF_SET_CONSOLE_COMM(0); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +//----------------------------------------------------------------------------- +// end of ser16c550c.c diff --git a/packages/hal/sh/se77x9/current/src/smsc37c93x.c b/packages/hal/sh/se77x9/current/src/smsc37c93x.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/se77x9/current/src/smsc37c93x.c @@ -0,0 +1,118 @@ +//============================================================================= +// +// smsc37c93x.c +// +// Init code for SMSC 37C93x super IO controller +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-05-30 +// Description: Init code for SMSC 37C93x super IO controller +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include CYGBLD_HAL_PLATFORM_H + +#include // SAVE/RESTORE GP macros +#include // IO macros +#include // interrupt vectors + + +// From page 137+ in SMSC-37C93x.pdf +#define SMSC_CONFIG 0xb04007e0 +#define SMSC_CONFIG_DATA 0xb04007e2 + +#define SMSC_CONFIG_DEV 0x0700 +#define SMSC_CONFIG_POWER 0x2200 +#define SMSC_CONFIG_ACTIVATE 0x3000 +#define SMSC_CONFIG_ENTER 0x5500 +#define SMSC_CONFIG_BASE_HIGH 0x6000 +#define SMSC_CONFIG_BASE_LOW 0x6100 +#define SMSC_CONFIG_IRQ 0x7000 +#define SMSC_CONFIG_EXIT 0xaa00 +#define SMSC_CONFIG_MODE 0xf000 + +#define SMSC_CONFIG_DEV_COM1 0x0400 +#define SMSC_CONFIG_DEV_COM2 0x0500 + +#define SMSC_CONFIG_MODE_HIGH 0x0200 + +#define SMSC_CONFIG_ACTIVATE_ENABLE 0x0100 + +#define SMSC_CONFIG_POWER_COM1 0x1000 +#define SMSC_CONFIG_POWER_COM2 0x2000 + +void +cyg_hal_init_superIO(void) +{ + // Note: two writes unlike the 37m81x! + HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_ENTER); + HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_ENTER); + + // Power ON COM1 + HAL_WRITE_UINT16(SMSC_CONFIG_POWER, SMSC_CONFIG_POWER_COM1); + + // Configure and enable COM1 + HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_DEV); + HAL_WRITE_UINT16(SMSC_CONFIG_DATA, SMSC_CONFIG_DEV_COM1); + + HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_BASE_HIGH); + HAL_WRITE_UINT16(SMSC_CONFIG_DATA, 0x0300); + HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_BASE_LOW); + HAL_WRITE_UINT16(SMSC_CONFIG_DATA, 0xf800); + + // Select IRQ 4 (see chap 8. Interrupt Controller) + HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_IRQ); + HAL_WRITE_UINT16(SMSC_CONFIG_DATA, 4<<8); + + HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_MODE); + HAL_WRITE_UINT16(SMSC_CONFIG_DATA, SMSC_CONFIG_MODE_HIGH); + + HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_ACTIVATE); + HAL_WRITE_UINT16(SMSC_CONFIG_DATA, SMSC_CONFIG_ACTIVATE_ENABLE); + + // Exit setup mode + HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_EXIT); +} + +//----------------------------------------------------------------------------- +// end of smsc37c93x.c diff --git a/packages/hal/sh/sh2/current/ChangeLog b/packages/hal/sh/sh2/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/ChangeLog @@ -0,0 +1,370 @@ +2002-05-08 Jesper Skov + + * src/sh2_sci.c: Register renaming. + * src/sh2_scif.c: Register renaming. + + * include/sh2_scif.h (_REG_SCSSR): Define. + + * include/mod_regs_ser.h: Register renaming. SCI registers now + contain _SCI_, SCIF registers contain _SCIF_. + +2002-04-30 Jesper Skov + + * include/var_intr.h: Renumber the 7044 vectors to get rid of the + gaps. CYGHWR_HAL_SH_SH2_CUSTOM_INTERRUPT_LAYOUT now takes care of + the translation from HW interrupt vectors to the eCos vector + numbers. + +2002-04-24 Jesper Skov + + * include/mod_regs_adc.h: Added. + + * include/var_regs.h: Include adc header. + + * include/mod_7044.h (CYGARC_SH_MOD_ADC): Added. + +2002-04-22 Jesper Skov + + * include/mod_regs_wdt.h (CYGARC_REG_RSTCSR_W_RSTx_MAGIC, + CYGARC_REG_RSTCSR_W_WOVF_MAGIC): set 5 lsb. + * include/mod_regs_wdt_2.h (CYGARC_REG_RSTCSR_W_RSTx_MAGIC, + CYGARC_REG_RSTCSR_W_WOVF_MAGIC): set 5 lsb. + Also define CYGARC_REG_WTCNT_W. + + * include/var_intr.h (HAL_PLATFORM_RESET): Fixed. Set WTIT flag. + + * src/var_misc.c (hal_interrupt_mask, hal_interrupt_unmask): Add + range for INTC=2 and error for undefined to catch such a bobo + easier next time. + + * include/var_intr.h: Fix access size typos. + + * include/sh2_sci.h: Fix offsets. + + * include/mod_regs_pfc_2.h (CYGARC_REG_PEDR): Added. + +2002-04-18 Jesper Skov + + * include/var_regs.h: Include BSC header according to type. + * include/mod_regs_pfc_2.h (CYGARC_REG_PADRH, CYGARC_REG_PADRL): Added. + * include/mod_regs_bsc_2.h: Added. + * include/mod_7044.h: BSC Type 2. + * include/mod_7615.h: BSC Type 1. + + * include/variant.inc: Only disable UBC if type defined. Fix INTC + type 1/2 mixup. + * include/var_regs.h: Include watchdog header according to type. + * include/mod_regs_wdt_2.h: Added. + * include/mod_7615.h: WDT type 1. + * include/mod_7044.h: WDT type 2. + + * src/var_misc.c (cyg_var_enable_caches): Only set mode if the + feature is present. + * include/variant.inc: CYGARC_REG_CCR is 16bit in type 2 CAC + module. + * src/variant.S: Support for type 2 cache. + * include/var_regs.h: Include cache header according to type. + * include/mod_7615.h (CYGARC_SH_MOD_CAC): Type 1. + * include/var_cache.h: Support for type 2. + * include/mod_regs_cac_2.h: Added. + * include/mod_7044.h (CYGARC_SH_MOD_CAC): Type 2. + Also define cache array addresses. + + * src/var_misc.c (hal_interrupt_update_level): 7044 support. + + * include/var_intr.h: Fall-back + CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF is variant specific. + +2002-04-17 Jesper Skov + + * src/var_mk_defs.c: Adjustment for 7044. + * src/variant.S: Same. + + * src/var_misc.c: Most of the functions update to handle INTC type + 2. Some still to do. Added hal_delay_us for CMT. + + * include/variant.inc: Clear CMT on init, and clear INTC type 2 + registers. + + * include/var_regs.h: Allow different headers for INT and + PFC. Also include CMT header. + + * include/var_intr.h: Some adjustments for 7044, and vectors for + it. Also define CMT style RTC support. + + * include/sh2_sci.h: Removed error. + * src/sh2_sci.c: Same. + + * include/mod_regs_intc_2.h: Added. + * include/mod_regs_pfc_2.h: Added. + * include/mod_regs_cmt.h: Added. + + * include/mod_regs_cpg.h: Handle type 2. + + * include/mod_7044.h: Enable more modules. No cache windows in + memory map. + + * cdl/hal_sh_sh2.cdl: Added 7044 clock options. + Added 7044 variant option. + + * include/mod_regs_ser.h: Fixed SCI definitions. + + * include/mod_7044.h: Added. + +2002-03-07 Jesper Skov + + * include/mod_regs_eth.h (CYGARC_REG_CNDCR): Added more + definitions. + +2002-03-06 Jesper Skov + + * src/sh2_scif.c: Added cyg_hal_plf_scif_sync_rxtx that allows + switching mode at runtime. Changed code to respect setting. + * include/sh2_scif.h: Same. + + * cdl/hal_sh_sh2.cdl: Added CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX to + control RX/TX enabling. In async mode (when set), only one of TX + or RX will be set at the same time. + +2002-03-01 Jesper Skov + + * cdl/hal_sh_sh2.cdl: Added + CYGHWR_HAL_SH_SH2_SCIF_IRDA_TXRX_COMPENSATION option to control + IrDA TX/RX kludge. + * src/sh2_scif.c: Use above option. Don't force 9600 baud in IrDA + mode. + +2002-02-22 Jesper Skov + + * src/sh2_scif.c (cyg_hal_plf_scif_putc): In IrDA mode, eat the + spurious received character after TX has completed. + +2002-02-21 Jesper Skov + + * src/sh2_scif.c: Force 9600 baud for IrDA mode + initialization. Disable transmitter when not used in IrDA + mode. Check transmitter state instead of FIFO count for + determining when to cease transmission. + +2002-02-20 Jesper Skov + + * include/mod_regs_eth.h: More definitions. + +2002-02-19 Jesper Skov + + * include/var_regs.h: Include ethernet definitions. + + * include/mod_7615.h: Has ethernet module. + + * include/mod_regs_eth.h: Added more definitions. + + * include/mod_regs_wdt.h: Added some more definitions. + + * include/var_intr.h (HAL_PLATFORM_RESET): Defined (doesn't work + though). + + * include/mod_7615.h: Disable UBC for now since software emulation + works just fine. + +2002-02-12 Jesper Skov + + * include/var_intr.h: Added HAL_CLOCK_VAR_INITIALIZE which does + partial FRT initialization so it can be used from + hal_delay_us. Updated other timer macros. + (HAL_CLOCK_READ): Fix typo. + + * include/mod_regs_frt.h: Renamed 16bit access registers. + + * src/var_misc.c (hal_delay_us): Fixed. + Call HAL_CLOCK_VAR_INITIALIZE from hal_variant_init. + + * include/mod_regs_bsc.h: Changed register locations and made + flags be 32bit constants. + +2002-02-07 Jesper Skov + + * src/var_misc.c (hal_delay_us): Fixed typo. Increasy dummy loop + since the typo didn't fix the problem. + + * include/mod_regs_pcm.h: Added. + + * include/var_regs.h: Include PCM. + + * include/mod_7615.h: Added DMA and PCM defs. + +2002-02-06 Jesper Skov + + * include/mod_regs_frt.h: Fix comment. + +2002-02-05 Jesper Skov + + * src/sh2_scif.c: Set SC2SSR in initialization. Clear errors in + getc function. + + * include/mod_regs_cpg.h (CYGARC_REG_FMR_INIT): Define as value + provided by platform. + + * cdl/hal_sh_sh2.cdl: Variant is big-endian only. + +2002-01-30 Jesper Skov + + * include/mod_regs_eth.h: Added. + + * include/mod_regs_pfc.h: Updated for SH7615. + +2002-01-22 Jesper Skov + + * cdl/hal_sh_sh2.cdl: Set as type1 clock module. + + * src/sh2_scif.c: Added IrDA mode support. + * include/sh2_scif.h: Same. + + * include/mod_regs_dma.h: Updated for SH7615. + + * include/mod_regs_ser.h: Fixed a typo. + +2002-01-18 Jesper Skov + + * src/sh2_sci.c: Added #error about not being updated. + * src/sh2_sci.h: Updated for SH2 naming. + * src/sh2_scif.h: Updated for SH2 naming, and registers. + * src/sh2_scif.c: Updated for changed register names. + * include/mod_regs_ser.h: Updated SCIF register names/values. + + * src/var_misc.c (hal_delay_us): Added. + + * include/variant.inc: Fixed some bade conditional code. + + * include/var_intr.h (HAL_CLOCK_INITIALIZE): Fix typos. Guard + against too large period. + + * include/mod_regs_ubc.h: Updated to match SH7615 (type 2). + + * include/mod_7615.h (CYGARC_SH_MOD_UBC): Is type 2. + +2002-01-17 Jesper Skov + + * include/mod_regs_ubc.h: Partially updated. + + * include/mod_regs_wdt.h: Added. + * include/var_regs.h: Include WDT header. + + * src/var_misc.c (hal_interrupt_set_vectors): Updated vector + names. + + * src/variant.S (cyg_hal_ILVL_table): Changed for SH2. + + * src/var_mk_defs.c: Added more interrupt defs. + + * include/var_intr.h (CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF): + Ignore LVLs 0-3 since they overlap with IRQs + 0-3. hal_interrupt_update_level contains code to handle according + to configuration. + + * include/mod_regs_intc.h: Added def. + + * src/var_misc.c: Interrupt configury updated for 7615. + + * include/var_intr.h: Add module identifier to vector names. Set + RTC vector. + +2002-01-16 Jesper Skov + + * src/var_mk_defs.c: Removed some defs. + + * src/var_misc.c: Cache init fixed and compiler warnings + typos + fixed. + + * src/sh2_scif.c: Renamed for SH2. + * src/sh2_sci.c: Same. + + * include/var_regs.h: TMU header inclusion removed. + + * include/var_intr.h: Shift vectors down one (to make room for NMI + as vector 0). + + * include/mod_regs_ser.h: Protect SCI defs by CYGARC_SH_MOD_SCI. + + * include/mod_regs_cpg.h: No magic here - CDL provides a hardwired + constant to use. + + * include/mod_regs_bsc.h: Updated to match SH7615. + + * include/mod_7615.h (CYGARC_SH_MOD_BCN): Is type 2. + + * cdl/hal_sh_sh2.cdl: Added CYGHWR_HAL_SH_RTC_PRESCALE. + + * include/mod_regs_frt.h: Added. + + * include/var_intr.h: Added support for eCos RTC driven by FRT module. + + * include/mod_7615.h (CYGARC_SH_MOD_FRT): Added. + * include/var_regs.h: Include FRT header. Removed RTC header inclusion. + + * src/var_misc.c (hal_interrupt_set_vectors): Set VCRx registers + to map the module interrupt sources to specific HWR_EXC vectors. + + * include/var_intr.h: Added SH7615 vectors. + + * cdl/hal_sh_sh2.cdl: Select INTR model header. + + * include/mod_regs_intc.h: Added stuff for 7615 INTC. + + * include/mod_7615.h: Does update the IP on exception. All modules + are type 1. + +2002-01-14 Jesper Skov + + * cdl/hal_sh_sh2.cdl: Added exception model header definitions. + + * include/variant.inc: Fixed assembler warning. Change CYG_SR. + +2002-01-11 Jesper Skov + + * cdl/hal_sh_sh2.cdl: Changed the clock setup some. + +2002-01-09 Jesper Skov + + * cdl/hal_sh_sh2.cdl: Changed to match SH2 caching details. + * src/var_misc.c: Same. + * include/var_cache.h: Same. + * src/variant.S: Same. + + * include/mod_7615.h: Added some 7615 details. + + Cloned from SH3 HAL. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/hal/sh/sh2/current/cdl/hal_sh_sh2.cdl b/packages/hal/sh/sh2/current/cdl/hal_sh_sh2.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/cdl/hal_sh_sh2.cdl @@ -0,0 +1,349 @@ +# ==================================================================== +# +# hal_sh_sh2.cdl +# +# SH2 variant HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: jskov +# Contributors: +# Date: 2002-01-09 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_SH_SH2 { + display "SH2 variant" + parent CYGPKG_HAL_SH + hardware + include_dir cyg/hal + define_header hal_sh_sh2.h + description " + The SH2 (SuperH 2) variant HAL package provides generic + support for SH2 variant CPUs." + + requires CYGHWR_HAL_SH_BIGENDIAN + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_VARIANT_H " + puts $::cdl_header "#define CYGBLD_HAL_VAR_EXCEPTION_MODEL_H " + puts $::cdl_header "#define CYGBLD_HAL_VAR_EXCEPTION_MODEL_INC " + puts $::cdl_header "#define CYGBLD_HAL_VAR_INTR_MODEL_H " + } + + compile sh2_sci.c sh2_scif.c var_misc.c variant.S + + # The "-o file" is a workaround for CR100958 - without it the + # output file would end up in the source directory under CygWin. + # n.b. grep does not behave itself under win32 + make -priority 1 { + /include/cyg/hal/sh2_offsets.inc : /src/var_mk_defs.c + $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,sh2_offsets.tmp -o var_mk_defs.tmp -S $< + fgrep .equ var_mk_defs.tmp | sed s/#// > $@ + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 sh2_offsets.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm sh2_offsets.tmp var_mk_defs.tmp + } + + # CPU variant supported + cdl_option CYGPKG_HAL_SH_7044 { + display "SH 7044 microprocessor" + parent CYGPKG_HAL_SH_CPU + implements CYGINT_HAL_SH_VARIANT + implements CYGINT_HAL_SH_CPG_T2 + default_value 0 + no_define + define -file=system.h CYGPKG_HAL_SH_7044 + description " + The SH2 7044 microprocessor. This is an embedded part that in + addition to the SH2 processor core has built in peripherals + such as memory controllers, serial ports, and timers/counters. + It also has some amount of flash memory." + define_proc { + puts $cdl_system_header "#define CYGBLD_HAL_CPU_MODULES_H " + } + } + + cdl_option CYGPKG_HAL_SH_7615 { + display "SH 7615 microprocessor" + parent CYGPKG_HAL_SH_CPU + implements CYGINT_HAL_SH_VARIANT + implements CYGINT_HAL_SH_CPG_T1 + default_value 0 + no_define + define -file=system.h CYGPKG_HAL_SH_7615 + description " + The SH2 7615 microprocessor. This is an embedded part that in + addition to the SH2 processor core has built in peripherals + such as memory controllers, serial ports, timers/counters, and + ethernet controller." + define_proc { + puts $cdl_system_header "#define CYGBLD_HAL_CPU_MODULES_H " + } + } + + cdl_component CYGHWR_HAL_SH_CLOCK_SETTINGS { + display "SH on-chip generic clock controls" + description " + The various clocks used by the system are controlled by + these options, some of which are derived from platform + settings." + flavor none + no_define + + cdl_interface CYGINT_HAL_SH_CPG_T1 { + display "Clock pulse generator type 1" + } + + cdl_interface CYGINT_HAL_SH_CPG_T2 { + display "Clock pulse generator type 2" + } + + + cdl_option CYGHWR_HAL_SH_FRT_PRESCALE { + display "FRT prescaling" + description " + The free running timer used for + the real-time clock is prescaled by this factor." + flavor data + active_if CYGINT_HAL_SH_CPG_T1 + legal_values { 8 32 128 } + default_value 8 + } + + cdl_option CYGHWR_HAL_SH_CMT_PRESCALE { + display "CMT prescaling" + description " + The Compare Match Timer used for + the real-time clock is prescaled by this factor." + flavor data + active_if CYGINT_HAL_SH_CPG_T2 + legal_values { 8 32 128 512 } + default_value 8 + } + + cdl_option CYGHWR_HAL_SH_RTC_PRESCALE { + display "eCos RTC prescaling" + flavor data + calculated { CYGHWR_HAL_SH_FRT_PRESCALE ? CYGHWR_HAL_SH_FRT_PRESCALE : + CYGHWR_HAL_SH_CMT_PRESCALE ? CYGHWR_HAL_SH_CMT_PRESCALE : + 0 + } + } + + cdl_option CYGHWR_HAL_SH_CLOCK_CKIO { + display "CKIO clock" + no_define + flavor data + # CKIO is either XTAL (input = PLL2 disabled) or PLL2 output + calculated { CYGINT_HAL_SH_CPG_T1 ? ( + (CYGHWR_HAL_SH_OOC_CLOCK_MODE >= 4 && CYGHWR_HAL_SH_OOC_CLOCK_MODE <= 6) + ? (CYGHWR_HAL_SH_OOC_XTAL) + : CYGHWR_HAL_SH_PLL2_OUTPUT + ) + : CYGINT_HAL_SH_CPG_T2 ? ( + CYGHWR_HAL_SH_OOC_XTAL + ) + : 0 } + } + + cdl_option CYGHWR_HAL_SH_PLL1_OUTPUT { + display "The clock output from PLL1" + no_define + flavor data + calculated { CYGHWR_HAL_SH_CLOCK_CKIO * CYGHWR_HAL_SH_OOC_PLL_1 } + } + + cdl_option CYGHWR_HAL_SH_PLL2_OUTPUT { + display "The clock output from PLL2" + no_define + flavor data + calculated { CYGINT_HAL_SH_CPG_T1 ? ( + (CYGHWR_HAL_SH_OOC_XTAL * CYGHWR_HAL_SH_OOC_PLL_2) + ) + : CYGINT_HAL_SH_CPG_T2 ? ( + (CYGHWR_HAL_SH_OOC_XTAL * CYGHWR_HAL_SH_OOC_PLL) + ) + : 0 } + } + + cdl_option CYGHWR_HAL_SH_PROCESSOR_SPEED { + display "Processor clock speed (MHz)" + flavor data + calculated { CYGHWR_HAL_SH_PLL2_OUTPUT / CYGHWR_HAL_SH_OOC_DIVM } + description " + The core (CPU, cache and MMU) speed is computed from + the input clock speed and the divider DIVM setting." + } + + cdl_option CYGHWR_HAL_SH_BOARD_SPEED { + display "Platform bus clock speed (MHz)" + flavor data + calculated { CYGHWR_HAL_SH_CLOCK_CKIO } + description " + The platform bus speed is CKIO." + } + + cdl_option CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED { + display "Processor on-chip peripheral clock speed (MHz)" + flavor data + calculated { CYGHWR_HAL_SH_PLL2_OUTPUT / CYGHWR_HAL_SH_OOC_DIVP } + description " + The peripheral speed is computed from the input clock + speed and the divider DIVP setting." + } + } + + cdl_option CYGNUM_HAL_SH_SH2_SCI_BAUD_RATE { + display "SCI serial port default baud rate" + flavor data + legal_values { 4800 9600 14400 19200 38400 57600 115200 } + default_value { CYGNUM_HAL_SH_SH2_SCI_BAUD_RATE_DEFAULT ? \ + CYGNUM_HAL_SH_SH2_SCI_BAUD_RATE_DEFAULT : 38400 } + description " + This controls the default baud rate used for communicating + with GDB / displaying diagnostic output." + } + + cdl_option CYGNUM_HAL_SH_SH2_SCIF_BAUD_RATE { + display "SCIF serial ports default baud rate" + flavor data + legal_values { 4800 9600 14400 19200 38400 57600 115200 } + default_value { CYGNUM_HAL_SH_SH2_SCIF_BAUD_RATE_DEFAULT ? \ + CYGNUM_HAL_SH_SH2_SCIF_BAUD_RATE_DEFAULT : 38400 } + description " + This controls the default baud rate used for communicating + with GDB / displaying diagnostic output." + } + + cdl_option CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX { + display "SCIF should support async RX/TX" + default_value 0 + description " + Some transceiver modes require the transmitter and + receiver to never be enabled at the same time. Enabling + this option lets clients enable async mode." + } + + + cdl_option CYGHWR_HAL_SH_SH2_SCIF_IRDA_TXRX_COMPENSATION { + display "SCIF IrDA TX/RX switch compensation" + default_value 1 + description " + When switching from TX mode to RX mode, the controller causes + a spurious 0xff character to be received at speeds up to + 57600 baud. At higher baud rates, more spurious characters + may be received. Enabling this option tries to remove the + spurious characters, but since there are no errors reported + from the controller, it is impossible to do so with any kind + of precision. + Having this option enabled makes RedBoot usable. There is a + matching option in the eCos serial driver controlling a + similar kludge, allowing some eCos serial tests to run. + It is an incomplete kludge however, and for any real use of + the IrDA mode for data transmission, the option should be + disabled, and a protocol capable of handling the spurious + receive characters must be used on top of the driver. + Note that the problem is exaggerated when the baud rate is + changed." + } + + cdl_component CYGPKG_HAL_SH_INTERRUPT { + display "Interrupt controls" + flavor none + no_define + description " + Initial interrupt settings can be specified using these option." + + cdl_option CYGHWR_HAL_SH_IRQ_HANDLE_SPURIOUS_INTERRUPTS { + display "Handle spurious interrupts" + default_value 0 + description " + The SH2 may generate spurious interrupts with INTEVT = 0 + when changing the BL bit of the status register. Enabling + this option will cause such interrupts to be identified + very early in the interrupt handler and be ignored. Given + that the SH HAL uses the I-mask to control interrupts, + these spurious interrupts should not occur, and so there + should be no reason to include the special handling code." + } + + cdl_option CYGHWR_HAL_SH_IRQ_USE_IRQLVL { + display "Use IRQ0-3 pins as IRL input" + default_value 0 + description " + It is possible for the IRQ0-3 pins to be used as IRL + inputs by enabling this option." + } + + cdl_option CYGHWR_HAL_SH_IRQ_ENABLE_IRLS_INTERRUPTS { + display "Enable IRLS interrupt pins" + default_value 0 + active_if CYGHWR_HAL_SH_IRQ_USE_IRQLVL + description " + IRLS interrupt pins must be specifically + activated. When they are, they will cause the same + type of interrupt as those caused by the IRL pins. If + IRL and IRLS pins signal an interrupt at the same + time, the highest level interrupt will be generated. + Only available on some cores, and probably share pins + with other interrupt sources (PINT) which cannot be + used in this configuration." + } + } + + # Cache settings + cdl_option CYGHWR_HAL_SH_CACHE_MODE { + display "Select cache mode set at startup" + parent CYGPKG_HAL_SH_CACHE + default_value { "WRITE_BACK" } + legal_values { "WRITE_BACK" "WRITE_THROUGH" } + flavor data + description " + Controls what cache mode the cache should be put in at + startup. Write-back mode improves + performance by letting dirty data to be kept in the + cache for a period of time, allowing mutiple writes to + the same cache line to be written back to memory in + one memory transaction. In Write-through mode, each + individual write will cause a memory transaction." + } +} diff --git a/packages/hal/sh/sh2/current/include/mod_7044.h b/packages/hal/sh/sh2/current/include/mod_7044.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_7044.h @@ -0,0 +1,95 @@ +#ifndef CYGONCE_HAL_MOD_7044_H +#define CYGONCE_HAL_MOD_7044_H + +//============================================================================= +// +// mod_7044.h +// +// List modules available on CPU +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-04-16 +// Purpose: Define modules (and versions) available on this CPU. +// Usage: Included from +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//----------------------------------------------------------------------------- +// Modules provided by the CPU + +#define CYGARC_SH_MOD_BSC 2 +#define CYGARC_SH_MOD_BCN 2 +#define CYGARC_SH_MOD_CAC 2 +#define CYGARC_SH_MOD_CPG 2 +#define CYGARC_SH_MOD_INTC 2 +#define CYGARC_SH_MOD_PFC 2 +#define CYGARC_SH_MOD_SCI 1 +#define CYGARC_SH_MOD_WDT 2 +#define CYGARC_SH_MOD_CMT 1 +#define CYGARC_SH_MOD_ADC 1 +//#define CYGARC_SH_MOD_DMAC 1 +//#define CYGARC_SH_MOD_PCM 1 + +//----------------------------------------------------------------------------- +// Extra details for Cache Module (CAC) + +// Cache dimenions - one unified cache +#define CYGARC_SH_MOD_CAC_SIZE 1024 // Size of cache in bytes +#define CYGARC_SH_MOD_CAC_LINE_SIZE 4 // Size of a cache line +#define CYGARC_SH_MOD_CAC_WAYS 1 // Associativity of the cache + +#define CYGARC_SH_MOD_CAC_NO_WINDOWS // This variant does not have + // "windows" in the address space + // accessing the same memory in + // cached and non-cached mode. + +#define CYGARC_SH_MOD_CAC_CACHE_ADDRESS_ARRAY_BASE 0xfffff000 +#define CYGARC_SH_MOD_CAC_CACHE_ADDRESS_ARRAY_TOP 0xfffff400 +#define CYGARC_SH_MOD_CAC_CACHE_DATA_ARRAY_BASE 0xfffff400 +#define CYGARC_SH_MOD_CAC_CACHE_DATA_ARRAY_TOP 0xfffff800 + +//----------------------------------------------------------------------------- +// Extra details for interrupt handling +#undef CYGARC_SH_SOFTWARE_IP_UPDATE + +#endif // CYGONCE_HAL_MOD_7044_H diff --git a/packages/hal/sh/sh2/current/include/mod_7615.h b/packages/hal/sh/sh2/current/include/mod_7615.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_7615.h @@ -0,0 +1,87 @@ +#ifndef CYGONCE_HAL_MOD_76xx_H +#define CYGONCE_HAL_MOD_76xx_H + +//============================================================================= +// +// mod_7615.h +// +// List modules available on CPU +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-09 +// Purpose: Define modules (and versions) available on this CPU. +// Usage: Included from +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//----------------------------------------------------------------------------- +// Modules provided by the CPU + +#define CYGARC_SH_MOD_BSC 1 +#define CYGARC_SH_MOD_CAC 1 +#define CYGARC_SH_MOD_BCN 2 +#define CYGARC_SH_MOD_CPG 1 +#define CYGARC_SH_MOD_INTC 1 +#define CYGARC_SH_MOD_WDT 1 +#define CYGARC_SH_MOD_IRDA 1 +#define CYGARC_SH_MOD_PFC 1 +#define CYGARC_SH_MOD_SCIF 1 +//#define CYGARC_SH_MOD_UBC 2 +#define CYGARC_SH_MOD_FRT 1 +#define CYGARC_SH_MOD_DMAC 1 +#define CYGARC_SH_MOD_PCM 1 +#define CYGARC_SH_MOD_ETH 1 + +//----------------------------------------------------------------------------- +// Extra details for Cache Module (CAC) + +// Cache dimenions - one unified cache +#define CYGARC_SH_MOD_CAC_SIZE 4096 // Size of cache in bytes +#define CYGARC_SH_MOD_CAC_LINE_SIZE 16 // Size of a cache line +#define CYGARC_SH_MOD_CAC_WAYS 4 // Associativity of the cache + +//----------------------------------------------------------------------------- +// Extra details for interrupt handling +#undef CYGARC_SH_SOFTWARE_IP_UPDATE + +#endif // CYGONCE_HAL_MOD_76xx_H diff --git a/packages/hal/sh/sh2/current/include/mod_regs_adc.h b/packages/hal/sh/sh2/current/include/mod_regs_adc.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_adc.h @@ -0,0 +1,76 @@ +//============================================================================= +// +// mod_regs_adc.h +// +// ADC (A/D Converter) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-04-23 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// Register definitions +#define CYGARC_REG_ADDRA0 0xffff8400 +#define CYGARC_REG_ADDRB0 0xffff8402 +#define CYGARC_REG_ADDRC0 0xffff8404 +#define CYGARC_REG_ADDRD0 0xffff8406 + +#define CYGARC_REG_ADDRA1 0xffff8408 +#define CYGARC_REG_ADDRB1 0xffff840a +#define CYGARC_REG_ADDRC1 0xffff840c +#define CYGARC_REG_ADDRD1 0xffff840e + +#define CYGARC_REG_ADCSR0 0xffff8410 +#define CYGARC_REG_ADCR0 0xffff8412 +#define CYGARC_REG_ADCSR1 0xffff8411 +#define CYGARC_REG_ADCR1 0xffff8413 + +#define CYGARC_REG_ADCSR_ADF 0x80 +#define CYGARC_REG_ADCSR_ADIE 0x40 +#define CYGARC_REG_ADCSR_ADST 0x20 +#define CYGARC_REG_ADCSR_SCAN 0x10 +#define CYGARC_REG_ADCSR_CKS 0x08 +#define CYGARC_REG_ADCSR_CH1 0x02 +#define CYGARC_REG_ADCSR_CH0 0x01 + +#define CYGARC_REG_ADCR_TRGE 0x80 diff --git a/packages/hal/sh/sh2/current/include/mod_regs_bsc.h b/packages/hal/sh/sh2/current/include/mod_regs_bsc.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_bsc.h @@ -0,0 +1,175 @@ +//============================================================================= +// +// mod_regs_bsc.h +// +// BSC (bus state controller) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-16 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// Register definitions +#define CYGARC_REG_BCR1 0xffffffe0 +#define CYGARC_REG_BCR2 0xffffffe4 +#define CYGARC_REG_WCR1 0xffffffe8 +#define CYGARC_REG_WCR2 0xffffffc0 +#define CYGARC_REG_WCR3 0xffffffc4 +#define CYGARC_REG_MCR 0xffffffec +#define CYGARC_REG_RTCSR 0xfffffff0 +#define CYGARC_REG_RTCNT 0xfffffff4 +#define CYGARC_REG_RTCOR 0xfffffff8 + +#define CYGARC_REG_BSC_WRITE_MAGIC 0xa55a0000 + +#define CYGARC_REG_BCR1_A3LW1 0x00004000 +#define CYGARC_REG_BCR1_A3LW0 0x00002000 +#define CYGARC_REG_BCR1_A2ENDIAN 0x00001000 // 0 = big, 1 = little +#define CYGARC_REG_BCR1_BSTROM 0x00000800 +#define CYGARC_REG_BCR1_AHLW1 0x00000200 +#define CYGARC_REG_BCR1_AHLW0 0x00000100 +#define CYGARC_REG_BCR1_A1LW1 0x00000080 +#define CYGARC_REG_BCR1_A1LW0 0x00000040 +#define CYGARC_REG_BCR1_A0LW1 0x00000020 +#define CYGARC_REG_BCR1_A0LW0 0x00000010 +#define CYGARC_REG_BCR1_A4ENDIAN 0x00000008 // 0 = big, 1 = little +#define CYGARC_REG_BCR1_DRAM2 0x00000004 +#define CYGARC_REG_BCR1_DRAM1 0x00000002 +#define CYGARC_REG_BCR1_DRAM0 0x00000001 + +// Bus widths for areas +#define CYGARC_REG_BCR2_A4_8 0x00000100 +#define CYGARC_REG_BCR2_A4_16 0x00000200 +#define CYGARC_REG_BCR2_A4_32 0x00000300 +#define CYGARC_REG_BCR2_A3_8 0x00000040 +#define CYGARC_REG_BCR2_A3_16 0x00000080 +#define CYGARC_REG_BCR2_A3_32 0x000000c0 +#define CYGARC_REG_BCR2_A2_8 0x00000010 +#define CYGARC_REG_BCR2_A2_16 0x00000020 +#define CYGARC_REG_BCR2_A2_32 0x00000030 +#define CYGARC_REG_BCR2_A1_8 0x00000004 +#define CYGARC_REG_BCR2_A1_16 0x00000008 +#define CYGARC_REG_BCR2_A1_32 0x0000000c + +// Intercycle wait states +#define CYGARC_REG_WCR1_A3WI_MASK 0x0000c000 // Intercycle Idle Specification +#define CYGARC_REG_WCR1_A3WI_SHIFT 14 +#define CYGARC_REG_WCR1_A2WI_MASK 0x00003000 +#define CYGARC_REG_WCR1_A2WI_SHIFT 12 +#define CYGARC_REG_WCR1_A1WI_MASK 0x00000c00 +#define CYGARC_REG_WCR1_A1WI_SHIFT 10 +#define CYGARC_REG_WCR1_A0WI_MASK 0x00000300 +#define CYGARC_REG_WCR1_A0WI_SHIFT 8 +#define CYGARC_REG_WCR1_A3W_MASK 0x000000c0 // waits +#define CYGARC_REG_WCR1_A3W_SHIFT 6 +#define CYGARC_REG_WCR1_A2W_MASK 0x00000030 +#define CYGARC_REG_WCR1_A2W_SHIFT 4 +#define CYGARC_REG_WCR1_A1W_MASK 0x0000000c +#define CYGARC_REG_WCR1_A1W_SHIFT 2 +#define CYGARC_REG_WCR1_A0W_MASK 0x00000003 +#define CYGARC_REG_WCR1_A0W_SHIFT 0 + +#define CYGARC_REG_WCR1_WI_0 0 +#define CYGARC_REG_WCR1_WI_1 1 +#define CYGARC_REG_WCR1_WI_2 2 +#define CYGARC_REG_WCR1_WI_4 3 + +#define CYGARC_REG_WCR1_W_0 0 +#define CYGARC_REG_WCR1_W_1 1 +#define CYGARC_REG_WCR1_W_2 2 +#define CYGARC_REG_WCR1_W_LONG 3 + + +// Wait states +#define CYGARC_REG_WCR2_A4WD_MASK 0x0000c000 // External waits for A4 +#define CYGARC_REG_WCR2_A4WD_SHIFT 14 +#define CYGARC_REG_WCR2_A4WM 0x00001000 // external wait mask +#define CYGARC_REG_WCR2_A3WM 0x00000800 // external wait mask +#define CYGARC_REG_WCR2_A2WM 0x00000400 // external wait mask +#define CYGARC_REG_WCR2_A1WM 0x00000200 // external wait mask +#define CYGARC_REG_WCR2_A0WM 0x00000100 // external wait mask +#define CYGARC_REG_WCR2_A4WI_MASK 0x0000000c // Intercycle Wait states +#define CYGARC_REG_WCR2_A4WI_SHIFT 2 +#define CYGARC_REG_WCR2_A4W_MASK 0x00000003 // Wait states +#define CYGARC_REG_WCR2_A4W_SHIFT 0 + +#define CYGARC_REG_WCR2_A4WD_0WS 0 +#define CYGARC_REG_WCR2_A4WD_1WS 1 +#define CYGARC_REG_WCR2_A4WD_4WS 2 + + +//-------------------------------------------------------------------------- +// Additional type definitions +#if (CYGARC_SH_MOD_BCN > 1) +#define CYGARC_REG_BCR3 0xfffffffc +#endif + + + +//----------------------------------------------------------------------------- +// Calculate constants needed to drive the proper SDRAM refresh rate. Argument +// is delay between required refresh events in microseconds (us). Should be +// available off the SDRAM spec sheet. +// These should be a part of a fully CDLicized memory controller setup. +#define CYGARC_RTCSR_PRESCALE(_r_) \ +(((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(4*1000000))<256) ? 4 : \ + ((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(16*1000000))<256) ? 16 : \ + ((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(64*1000000))<256) ? 64 : \ + ((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(256*1000000))<256) ? 256 : \ + ((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(1024*1000000))<256) ? 1024 : \ + ((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(2048*1000000))<256) ? 2048 : 4096) + +// These two macros provide the static values we need to stuff into the +// registers. +#define CYGARC_RTCSR_CKSx(_r_) \ + (( 4 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x08 : \ + ( 16 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x10 : \ + ( 64 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x18 : \ + ( 256 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x20 : \ + (1024 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x28 : \ + (2048 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x30 : 0x38 ) + +#define CYGARC_RTCSR_N(_r_) \ + (CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(CYGARC_RTCSR_PRESCALE(_r_)*1000000)) + + diff --git a/packages/hal/sh/sh2/current/include/mod_regs_bsc_2.h b/packages/hal/sh/sh2/current/include/mod_regs_bsc_2.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_bsc_2.h @@ -0,0 +1,61 @@ +//============================================================================= +// +// mod_regs_bsc_2.h +// +// BSC (bus state controller) Module (type 2)register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-04-18 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// Register definitions +#define CYGARC_REG_BCR1 0xffff8620 +#define CYGARC_REG_BCR2 0xffff8622 +#define CYGARC_REG_WCR1 0xffff8624 +#define CYGARC_REG_WCR2 0xffff8626 +#define CYGARC_REG_DCR 0xffff862a +#define CYGARC_REG_RTCSR 0xffff862c +#define CYGARC_REG_RTCNT 0xffff862e +#define CYGARC_REG_RTCOR 0xffff8630 + diff --git a/packages/hal/sh/sh2/current/include/mod_regs_cac.h b/packages/hal/sh/sh2/current/include/mod_regs_cac.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_cac.h @@ -0,0 +1,78 @@ +//============================================================================= +// +// mod_regs_cac.h +// +// CAC (cache) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-09 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +// Besides the below, cache sizes are defined in the CPU variant module +// headers (mod_76xx.h). + +//-------------------------------------------------------------------------- +// Cache registers +#define CYGARC_REG_CCR 0xfffffe92 + +#define CYGARC_REG_CCR_W3 0xc0 // way affected +#define CYGARC_REG_CCR_W2 0x80 +#define CYGARC_REG_CCR_W1 0x40 +#define CYGARC_REG_CCR_W0 0x00 +#define CYGARC_REG_CCR_WB 0x20 // write-back +#define CYGARC_REG_CCR_CP 0x10 // cache purge +#define CYGARC_REG_CCR_TW 0x08 // two-way mode +#define CYGARC_REG_CCR_OD 0x04 // operand replacement disable +#define CYGARC_REG_CCR_ID 0x02 // instruction replacement disable +#define CYGARC_REG_CCR_CE 0x01 // cache enable + + +//-------------------------------------------------------------------------- +// Address array access +// Address part (base/top/step specified in mod file) +#define CYGARC_REG_CACHE_ADDRESS_ADDRESS 0x00000008 // compare address + +// Data part +#define CYGARC_REG_CACHE_ADDRESS_TAG_Mask 0x1ffffc00 +#define CYGARC_REG_CACHE_ADDRESS_U 0x00000002 // updated (contains dirty data) +#define CYGARC_REG_CACHE_ADDRESS_V 0x00000001 // valid diff --git a/packages/hal/sh/sh2/current/include/mod_regs_cac_2.h b/packages/hal/sh/sh2/current/include/mod_regs_cac_2.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_cac_2.h @@ -0,0 +1,64 @@ +//============================================================================= +// +// mod_regs_cac_2.h +// +// CAC (cache) Module (type 2) register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-04-18 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +// Besides the below, cache sizes are defined in the CPU variant module +// headers (mod_704x.h). + +//-------------------------------------------------------------------------- +// Cache registers +#define CYGARC_REG_CCR 0xffff8740 + +#define CYGARC_REG_CCR_CE_DRAM 0x10 // DRAM cache enabled +#define CYGARC_REG_CCR_CE_CS3 0x08 // CS3 cache enabled +#define CYGARC_REG_CCR_CE_CS2 0x04 // CS2 cache enabled +#define CYGARC_REG_CCR_CE_CS1 0x02 // CS1 cache enabled +#define CYGARC_REG_CCR_CE_CS0 0x01 // CS0 cache enabled + +#define CYGARC_REG_CCR_CE (CYGARC_REG_CCR_CE_DRAM|CYGARC_REG_CCR_CE_CS3|CYGARC_REG_CCR_CE_CS2|CYGARC_REG_CCR_CE_CS1|CYGARC_REG_CCR_CE_CS0) diff --git a/packages/hal/sh/sh2/current/include/mod_regs_cmt.h b/packages/hal/sh/sh2/current/include/mod_regs_cmt.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_cmt.h @@ -0,0 +1,71 @@ +//============================================================================= +// +// mod_regs_cmt.h +// +// CMT (Compare Match Timer) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-04-17 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// Compare Match Timer + +#define CYGARC_REG_CMSTR 0xffff83d0 +#define CYGARC_REG_CMCSR0 0xffff83d2 +#define CYGARC_REG_CMCNT0 0xffff83d4 +#define CYGARC_REG_CMCOR0 0xffff83d6 +#define CYGARC_REG_CMCSR1 0xffff83d8 +#define CYGARC_REG_CMCNT1 0xffff83da +#define CYGARC_REG_CMCOR1 0xffff83dc + + +#define CYGARC_REG_CMSTR_STR1 0x0002 // start compare time 1 +#define CYGARC_REG_CMSTR_STR0 0x0001 // start compare time 0 + +#define CYGARC_REG_CMCSR_CMF 0x0080 // compare match flag +#define CYGARC_REG_CMCSR_CMIE 0x0040 // compare match interrupt enable +#define CYGARC_REG_CMCSR_CLK_8 0x0000 // system clock / 8 +#define CYGARC_REG_CMCSR_CLK_32 0x0001 // system clock / 32 +#define CYGARC_REG_CMCSR_CLK_128 0x0002 // system clock / 128 +#define CYGARC_REG_CMCSR_CLK_512 0x0003 // system clock / 512 diff --git a/packages/hal/sh/sh2/current/include/mod_regs_cpg.h b/packages/hal/sh/sh2/current/include/mod_regs_cpg.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_cpg.h @@ -0,0 +1,83 @@ +//============================================================================= +// +// mod_regs_cpg.h +// +// CPG (clock pulse generator) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-16 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// Oscillator control registers +#define CYGARC_REG_FMR 0xfffffe90 + +#define CYGARC_REG_FMR_PLL2ST 0x80 +#define CYGARC_REG_FMR_PLL1ST 0x40 +#define CYGARC_REG_FMR_CKIOST 0x20 +#define CYGARC_REG_FMR_FR3 0x08 +#define CYGARC_REG_FMR_FR2 0x04 +#define CYGARC_REG_FMR_FR1 0x02 +#define CYGARC_REG_FMR_FR0 0x01 + +// Translate various CDL clock configurations to register equivalents +// for the various CPG versions +#if (CYGARC_SH_MOD_CPG == 1) // ---------------------------- V1 + +// For now, platform CDL must provide it +#ifndef CYGHWR_HAL_SH_SH2_FMR_INIT +# error "No FMR_INIT value provided" +#endif + +#define CYGARC_REG_FMR_INIT CYGHWR_HAL_SH_SH2_FMR_INIT + +#elif (CYGARC_SH_MOD_CPG == 2) + +#else + +# error "Unsupported CPG version" + +#endif + +// Init value +//#define CYGARC_REG_FMR_INIT () diff --git a/packages/hal/sh/sh2/current/include/mod_regs_dma.h b/packages/hal/sh/sh2/current/include/mod_regs_dma.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_dma.h @@ -0,0 +1,115 @@ +//============================================================================= +// +// mod_regs_dma.h +// +// DMA (direct memory access) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-21 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// DMA Controller registers + +#define CYGARC_REG_SAR0 0xffffff80 +#define CYGARC_REG_DAR0 0xffffff84 +#define CYGARC_REG_DMATCR0 0xffffff88 +#define CYGARC_REG_CHCR0 0xffffff8c +#define CYGARC_REG_DRCR0 0xfffffe71 +#define CYGARC_REG_SAR1 0xffffff90 +#define CYGARC_REG_DAR1 0xffffff94 +#define CYGARC_REG_DMATCR1 0xffffff98 +#define CYGARC_REG_CHCR1 0xffffff9c +#define CYGARC_REG_DRCR1 0xfffffe72 + +#define CYGARC_REG_DMAOR 0xffffffb0 + +// Offsets from base register +#define CYGARC_REG_SAR 0x00 +#define CYGARC_REG_DAR 0x04 +#define CYGARC_REG_DMATCR 0x08 +#define CYGARC_REG_CHCR 0x0c + + +// DMA Channel Control Register. If there's a digit suffix to CHCR the flag +// is only valid in the listed channels. +#define CYGARC_REG_CHCR_DM1 0x00008000 // destination address mode +#define CYGARC_REG_CHCR_DM0 0x00004000 +#define CYGARC_REG_CHCR_SM1 0x00002000 // source address mode +#define CYGARC_REG_CHCR_SM0 0x00001000 +#define CYGARC_REG_CHCR_TS1 0x00000800 // transmit size +#define CYGARC_REG_CHCR_TS0 0x00000400 +#define CYGARC_REG_CHCR_AR 0x00000200 // auto-request mode +#define CYGARC_REG_CHCR_AM 0x00000100 // ack/tx mode +#define CYGARC_REG_CHCR_AL 0x00000080 // ack level +#define CYGARC_REG_CHCR_DS 0x00000040 // DREQ select: level(0)/edge(1) +#define CYGARC_REG_CHCR_DL 0x00000020 // DREQ select: low(0)/high(1) +#define CYGARC_REG_CHCR_TB 0x00000010 // transfer bus mode cycle-steal(0)/bus(1) +#define CYGARC_REG_CHCR_TA 0x00000008 // transfer address mode dual(0)/single(1) +#define CYGARC_REG_CHCR_IE 0x00000004 // interrupt enable +#define CYGARC_REG_CHCR_TE 0x00000002 // transfer end +#define CYGARC_REG_CHCR_DE 0x00000001 // DMAC enable + +// Resource select options +#define CYGARC_REG_CHCR_RS_EXT 0x00000000 +#define CYGARC_REG_CHCR_RS_SCIF1_RXI 0x00000005 +#define CYGARC_REG_CHCR_RS_SCIF1_TXI 0x00000006 +#define CYGARC_REG_CHCR_RS_SCIF2_RXI 0x00000009 +#define CYGARC_REG_CHCR_RS_SCIF2_TXI 0x0000000a +#define CYGARC_REG_CHCR_RS_TPU_TGI0A 0x0000000c +#define CYGARC_REG_CHCR_RS_TPU_TGI0B 0x0000000d +#define CYGARC_REG_CHCR_RS_TPU_TGI0C 0x0000000e +#define CYGARC_REG_CHCR_RS_TPU_TGI0D 0x0000000f +#define CYGARC_REG_CHCR_RS_SIO0_RDIF 0x00000011 +#define CYGARC_REG_CHCR_RS_SIO0_TDEI 0x00000012 +#define CYGARC_REG_CHCR_RS_SIO1_RDIF 0x00000015 +#define CYGARC_REG_CHCR_RS_SIO1_TDEI 0x00000016 +#define CYGARC_REG_CHCR_RS_SIO2_RDIF 0x00000019 +#define CYGARC_REG_CHCR_RS_SIO2_TDEI 0x0000001a + + +// DMA Operation Register +#define CYGARC_REG_DMAOR_PR 0x00000008 +#define CYGARC_REG_DMAOR_AE 0x00000004 // address error flag +#define CYGARC_REG_DMAOR_NMIF 0x00000002 // NMI flag +#define CYGARC_REG_DMAOR_DME 0x00000001 // DMA master enable diff --git a/packages/hal/sh/sh2/current/include/mod_regs_eth.h b/packages/hal/sh/sh2/current/include/mod_regs_eth.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_eth.h @@ -0,0 +1,158 @@ +//============================================================================= +// +// mod_regs_eth.h +// +// EtherC (ethernet controller) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-30 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#define CYGARC_REG_EDMR 0xfffffd00 +#define CYGARC_REG_EDTRR 0xfffffd04 +#define CYGARC_REG_EDRRR 0xfffffd08 +#define CYGARC_REG_TDLAR 0xfffffd0c +#define CYGARC_REG_RDLAR 0xfffffd10 +#define CYGARC_REG_EESR 0xfffffd14 +#define CYGARC_REG_EESIPR 0xfffffd18 +#define CYGARC_REG_TRSCER 0xfffffd1c +#define CYGARC_REG_RMFCR 0xfffffd20 +#define CYGARC_REG_TFTR 0xfffffd24 +#define CYGARC_REG_FDR 0xfffffd28 +#define CYGARC_REG_RCR 0xfffffd2c +#define CYGARC_REG_EDOCR 0xfffffd30 +#define CYGARC_REG_RBWAR 0xfffffd40 +#define CYGARC_REG_RDFAR 0xfffffd44 +#define CYGARC_REG_TBRAR 0xfffffd4c +#define CYGARC_REG_TDFAR 0xfffffd50 + +#define CYGARC_REG_ECMR 0xfffffd60 +#define CYGARC_REG_ECSR 0xfffffd64 +#define CYGARC_REG_ECSIPR 0xfffffd68 +#define CYGARC_REG_PIR 0xfffffd6c +#define CYGARC_REG_MAHR 0xfffffd70 +#define CYGARC_REG_MALR 0xfffffd74 +#define CYGARC_REG_RFLR 0xfffffd78 +#define CYGARC_REG_PSR 0xfffffd7c +#define CYGARC_REG_TROCR 0xfffffd80 +#define CYGARC_REG_CDCR 0xfffffd84 +#define CYGARC_REG_LCCR 0xfffffd88 +#define CYGARC_REG_CNDCR 0xfffffd8c +#define CYGARC_REG_IFLCR 0xfffffd90 +#define CYGARC_REG_CECFR 0xfffffd94 +#define CYGARC_REG_FRECR 0xfffffd98 +#define CYGARC_REG_TSFRCR 0xfffffd9c +#define CYGARC_REG_TLFRCR 0xfffffda0 +#define CYGARC_REG_RFCR 0xfffffda4 +#define CYGARC_REG_MAFCR 0xfffffda8 + + +#define CYGARC_REG_PIR_MDI 0x00000008 +#define CYGARC_REG_PIR_MDO 0x00000004 +#define CYGARC_REG_PIR_MMD_WRITE 0x00000002 +#define CYGARC_REG_PIR_MMD_READ 0x00000000 +#define CYGARC_REG_PIR_MDC 0x00000001 + +#define CYGARC_REG_RCR_RNC 0x00000001 + +#define CYGARC_REG_EESR_RFCOF 0x01000000 +#define CYGARC_REG_EESR_ECI 0x00400000 +#define CYGARC_REG_EESR_TC 0x00200000 +#define CYGARC_REG_EESR_TDE 0x00100000 +#define CYGARC_REG_EESR_TFUF 0x00080000 +#define CYGARC_REG_EESR_FR 0x00040000 +#define CYGARC_REG_EESR_RDE 0x00020000 +#define CYGARC_REG_EESR_RFOF 0x00010000 +#define CYGARC_REG_EESR_ITF 0x00001000 +#define CYGARC_REG_EESR_CND 0x00000800 +#define CYGARC_REG_EESR_DLC 0x00000400 +#define CYGARC_REG_EESR_CD 0x00000200 +#define CYGARC_REG_EESR_TRO 0x00000100 +#define CYGARC_REG_EESR_RMAF 0x00000080 +#define CYGARC_REG_EESR_RRF 0x00000010 +#define CYGARC_REG_EESR_RTLF 0x00000008 +#define CYGARC_REG_EESR_RTSF 0x00000004 +#define CYGARC_REG_EESR_PRE 0x00000002 +#define CYGARC_REG_EESR_CERF 0x00000001 + +#define CYGARC_REG_EESIPR_RFCOFIP 0x01000000 +#define CYGARC_REG_EESIPR_ECIIP 0x00400000 +#define CYGARC_REG_EESIPR_TCIP 0x00200000 +#define CYGARC_REG_EESIPR_TDEIP 0x00100000 +#define CYGARC_REG_EESIPR_TFUFIP 0x00080000 +#define CYGARC_REG_EESIPR_FRIP 0x00040000 +#define CYGARC_REG_EESIPR_RDEIP 0x00020000 +#define CYGARC_REG_EESIPR_RFOFIP 0x00010000 +#define CYGARC_REG_EESIPR_ITFIP 0x00001000 +#define CYGARC_REG_EESIPR_CNDIP 0x00000800 +#define CYGARC_REG_EESIPR_DLCIP 0x00000400 +#define CYGARC_REG_EESIPR_CDIP 0x00000200 +#define CYGARC_REG_EESIPR_TROIP 0x00000100 +#define CYGARC_REG_EESIPR_RMAFIP 0x00000080 +#define CYGARC_REG_EESIPR_RRFIP 0x00000010 +#define CYGARC_REG_EESIPR_RTLFIP 0x00000008 +#define CYGARC_REG_EESIPR_RTSFIP 0x00000004 +#define CYGARC_REG_EESIPR_PREIP 0x00000002 +#define CYGARC_REG_EESIPR_CERFIP 0x00000001 + + +#define CYGARC_REG_ECMR_PRCEF 0x00001000 +#define CYGARC_REG_ECMR_MPDE 0x00000200 +#define CYGARC_REG_ECMR_RE 0x00000040 +#define CYGARC_REG_ECMR_TE 0x00000020 +#define CYGARC_REG_ECMR_ILB 0x00000008 +#define CYGARC_REG_ECMR_ELB 0x00000004 +#define CYGARC_REG_ECMR_DM 0x00000002 +#define CYGARC_REG_ECMR_PRM 0x00000001 + + +#define CYGARC_REG_EDMR_DL64 0x00000020 +#define CYGARC_REG_EDMR_DL32 0x00000010 +#define CYGARC_REG_EDMR_DL16 0x00000000 +#define CYGARC_REG_EDMR_SWR 0x00000001 + +#define CYGARC_REG_PSR_LMON 0x00000001 + +#define CYGARC_REG_EDTRR_TR 0x00000001 + +#define CYGARC_REG_EDRRR_RR 0x00000001 diff --git a/packages/hal/sh/sh2/current/include/mod_regs_frt.h b/packages/hal/sh/sh2/current/include/mod_regs_frt.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_frt.h @@ -0,0 +1,82 @@ +//============================================================================= +// +// mod_regs_frt.h +// +// FRT (Free-Running Timer) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-16 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// Free Running Timer + +#define CYGARC_REG_TIER 0xfffffe10 +#define CYGARC_REG_FTCSR 0xfffffe11 +#define CYGARC_REG_FRC 0xfffffe12 +#define CYGARC_REG_OCR 0xfffffe14 +#define CYGARC_REG_TCR 0xfffffe16 +#define CYGARC_REG_TOCR 0xfffffe17 +#define CYGARC_REG_FICR 0xfffffe18 + + +#define CYGARC_REG_TIER_ICIE 0x80 // input capture irq enable +#define CYGARC_REG_TIER_OCIAE 0x08 // output compare A irq enable +#define CYGARC_REG_TIER_OCIBE 0x04 // output compare B irq enable +#define CYGARC_REG_TIER_OVIE 0x02 // overflow irq enable + +#define CYGARC_REG_FTCSR_ICF 0x80 // input capture flag +#define CYGARC_REG_FTCSR_OCFA 0x08 // output compare flag A +#define CYGARC_REG_FTCSR_OCFB 0x04 // output compare flag B +#define CYGARC_REG_FTCSR_OVF 0x02 // timer overflow flag +#define CYGARC_REG_FTCSR_CCLRA 0x01 // counter clear A + +#define CYGARC_REG_TCR_IEDG 0x80 // capture on falling (0) or rising (1) +#define CYGARC_REG_TCR_CLK_8 0x00 // clk/8 +#define CYGARC_REG_TCR_CLK_32 0x01 // clk/32 +#define CYGARC_REG_TCR_CLK_128 0x02 // clk/128 +#define CYGARC_REG_TCR_CLK_EXT 0x03 // external clock + +#define CYGARC_REG_TOCR_OCRS 0x08 // Select OCRA (0) or OCRB (1) on _OCR +#define CYGARC_REG_TOCR_OLVLA 0x02 // enable output on match A +#define CYGARC_REG_TOCR_OLVLB 0x01 // enable output on match B diff --git a/packages/hal/sh/sh2/current/include/mod_regs_intc.h b/packages/hal/sh/sh2/current/include/mod_regs_intc.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_intc.h @@ -0,0 +1,161 @@ +//============================================================================= +// +// mod_regs_intc.h +// +// INTC (interrupt controller) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-15 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +// NOTE: This'll need restructuring as other variants are added. Type 1 should +// be fewest common registers. + +//-------------------------------------------------------------------------- +// Interrupt registers, module type 1 +#define CYGARC_REG_ICR 0xfffffee0 +#define CYGARC_REG_IRQCSR 0xfffffee8 +#define CYGARC_REG_IPRA 0xfffffee2 +#define CYGARC_REG_IPRB 0xfffffe60 +#define CYGARC_REG_IPRC 0xfffffee6 +#define CYGARC_REG_IPRD 0xfffffe40 +#define CYGARC_REG_IPRE 0xfffffec0 + +#define CYGARC_REG_VCRA 0xfffffe62 +#define CYGARC_REG_VCRB 0xfffffe64 +#define CYGARC_REG_VCRC 0xfffffe66 +#define CYGARC_REG_VCRD 0xfffffe68 +#define CYGARC_REG_VCRE 0xfffffe42 +#define CYGARC_REG_VCRF 0xfffffe44 +#define CYGARC_REG_VCRG 0xfffffe46 +#define CYGARC_REG_VCRH 0xfffffe48 +#define CYGARC_REG_VCRI 0xfffffe4a +#define CYGARC_REG_VCRJ 0xfffffe4c +#define CYGARC_REG_VCRK 0xfffffe4e +#define CYGARC_REG_VCRL 0xfffffe50 +#define CYGARC_REG_VCRM 0xfffffe52 +#define CYGARC_REG_VCRN 0xfffffe54 +#define CYGARC_REG_VCRO 0xfffffe56 +#define CYGARC_REG_VCRP 0xfffffec2 +#define CYGARC_REG_VCRQ 0xfffffec4 +#define CYGARC_REG_VCRR 0xfffffec6 +#define CYGARC_REG_VCRS 0xfffffec8 +#define CYGARC_REG_VCRT 0xfffffeca +#define CYGARC_REG_VCRU 0xfffffecc +#define CYGARC_REG_VCRWDT 0xfffffee4 +#define CYGARC_REG_VCRDMA0 0xffffffa0 // 32 bit +#define CYGARC_REG_VCRDMA1 0xffffffa8 // 32 bit + +#define CYGARC_REG_ICR_NMIL 0x8000 +#define CYGARC_REG_ICR_NMIE 0x0100 +#define CYGARC_REG_ICR_EXIMD 0x0002 +#define CYGARC_REG_ICR_VECMD 0x0001 + +#define CYGARC_REG_IPRA_DMAC_MASK 0x0f00 +#define CYGARC_REG_IPRA_DMAC_PRI1 0x0100 +#define CYGARC_REG_IPRA_WDT_MASK 0x00f0 +#define CYGARC_REG_IPRA_WDT_PRI1 0x0010 + +#define CYGARC_REG_IPRB_EDMAC_MASK 0xf000 +#define CYGARC_REG_IPRB_EDMAC_PRI1 0x1000 +#define CYGARC_REG_IPRB_FRT_MASK 0x0f00 +#define CYGARC_REG_IPRB_FRT_PRI1 0x0100 + +#define CYGARC_REG_IPRC_IRQ3_MASK 0xf000 +#define CYGARC_REG_IPRC_IRQ3_PRI1 0x1000 +#define CYGARC_REG_IPRC_IRQ2_MASK 0x0f00 +#define CYGARC_REG_IPRC_IRQ2_PRI1 0x0100 +#define CYGARC_REG_IPRC_IRQ1_MASK 0x00f0 +#define CYGARC_REG_IPRC_IRQ1_PRI1 0x0010 +#define CYGARC_REG_IPRC_IRQ0_MASK 0x000f +#define CYGARC_REG_IPRC_IRQ0_PRI1 0x0001 + +#define CYGARC_REG_IPRD_TPU0_MASK 0xf000 +#define CYGARC_REG_IPRD_TPU0_PRI1 0x1000 +#define CYGARC_REG_IPRD_TPU1_MASK 0x0f00 +#define CYGARC_REG_IPRD_TPU1_PRI1 0x0100 +#define CYGARC_REG_IPRD_TPU2_MASK 0x00f0 +#define CYGARC_REG_IPRD_TPU2_PRI1 0x0010 +#define CYGARC_REG_IPRD_SCIF1_MASK 0x000f +#define CYGARC_REG_IPRD_SCIF1_PRI1 0x0001 + +#define CYGARC_REG_IPRE_SCIF2_MASK 0xf000 +#define CYGARC_REG_IPRE_SCIF2_PRI1 0x1000 +#define CYGARC_REG_IPRE_SIO0_MASK 0x0f00 +#define CYGARC_REG_IPRE_SIO0_PRI1 0x0100 +#define CYGARC_REG_IPRE_SIO1_MASK 0x00f0 +#define CYGARC_REG_IPRE_SIO1_PRI1 0x0010 +#define CYGARC_REG_IPRE_SIO2_MASK 0x000f +#define CYGARC_REG_IPRE_SIO2_PRI1 0x0001 + +// The (initial) IRQ mode is controlled by configuration. +#ifdef CYGHWR_HAL_SH_IRQ_USE_IRQLVL +# define CYGARC_REG_ICR_INIT (CYGARC_REG_ICR_EXIMD) +#else +# define CYGARC_REG_ICR_INIT 0x0000 +#endif + +#define CYGARC_REG_IRQCSR_IRQ_LOWLEVEL 0 +#define CYGARC_REG_IRQCSR_IRQ_RISING 1 +#define CYGARC_REG_IRQCSR_IRQ_FALLING 2 +#define CYGARC_REG_IRQCSR_IRQ_BOTHEDGES 3 +#define CYGARC_REG_IRQCSR_IRQ_mask 3 + +#define CYGARC_REG_IRQCSR_IRQ3_mask 0xc000 +#define CYGARC_REG_IRQCSR_IRQ3_shift 14 +#define CYGARC_REG_IRQCSR_IRQ2_mask 0x3000 +#define CYGARC_REG_IRQCSR_IRQ2_shift 12 +#define CYGARC_REG_IRQCSR_IRQ1_mask 0x0c00 +#define CYGARC_REG_IRQCSR_IRQ1_shift 10 +#define CYGARC_REG_IRQCSR_IRQ0_mask 0x0300 +#define CYGARC_REG_IRQCSR_IRQ0_shift 8 + +#define CYGARC_REG_IRQCSR_IRL3PS 0x0080 +#define CYGARC_REG_IRQCSR_IRL2PS 0x0040 +#define CYGARC_REG_IRQCSR_IRL1PS 0x0020 +#define CYGARC_REG_IRQCSR_IRL0PS 0x0010 + +#define CYGARC_REG_IRQCSR_IRQ3F 0x0008 +#define CYGARC_REG_IRQCSR_IRQ2F 0x0004 +#define CYGARC_REG_IRQCSR_IRQ1F 0x0002 +#define CYGARC_REG_IRQCSR_IRQ0F 0x0001 diff --git a/packages/hal/sh/sh2/current/include/mod_regs_intc_2.h b/packages/hal/sh/sh2/current/include/mod_regs_intc_2.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_intc_2.h @@ -0,0 +1,157 @@ +//============================================================================= +// +// mod_regs_intc_2.h +// +// INTC (interrupt controller) Module (type 2) register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-15 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +// NOTE: This'll need restructuring as other variants are added. Type 1 should +// be fewest common registers. + +//-------------------------------------------------------------------------- +// Interrupt registers, module type 1 +#define CYGARC_REG_IPRA 0xffff8348 +#define CYGARC_REG_IPRB 0xffff834a +#define CYGARC_REG_IPRC 0xffff834c +#define CYGARC_REG_IPRD 0xffff834e +#define CYGARC_REG_IPRE 0xffff8350 +#define CYGARC_REG_IPRF 0xffff8352 +#define CYGARC_REG_IPRG 0xffff8354 +#define CYGARC_REG_IPRH 0xffff8356 +#define CYGARC_REG_ICR 0xffff8358 +#define CYGARC_REG_ISR 0xffff835a + + +#define CYGARC_REG_ICR_NMIL 0x8000 +#define CYGARC_REG_ICR_NMIE 0x0100 +#define CYGARC_REG_ICR_IRQ0S 0x0080 +#define CYGARC_REG_ICR_IRQ1S 0x0040 +#define CYGARC_REG_ICR_IRQ2S 0x0020 +#define CYGARC_REG_ICR_IRQ3S 0x0010 +#define CYGARC_REG_ICR_IRQ4S 0x0008 +#define CYGARC_REG_ICR_IRQ5S 0x0004 +#define CYGARC_REG_ICR_IRQ6S 0x0002 +#define CYGARC_REG_ICR_IRQ7S 0x0001 + +#define CYGARC_REG_IPRA_IRQ0_MASK 0xf000 +#define CYGARC_REG_IPRA_IRQ0_PRI1 0x1000 +#define CYGARC_REG_IPRA_IRQ1_MASK 0x0f00 +#define CYGARC_REG_IPRA_IRQ1_PRI1 0x0100 +#define CYGARC_REG_IPRA_IRQ2_MASK 0x00f0 +#define CYGARC_REG_IPRA_IRQ2_PRI1 0x0010 +#define CYGARC_REG_IPRA_IRQ3_MASK 0x000f +#define CYGARC_REG_IPRA_IRQ3_PRI1 0x0001 + +#define CYGARC_REG_IPRB_IRQ4_MASK 0xf000 +#define CYGARC_REG_IPRB_IRQ4_PRI1 0x1000 +#define CYGARC_REG_IPRB_IRQ5_MASK 0x0f00 +#define CYGARC_REG_IPRB_IRQ5_PRI1 0x0100 +#define CYGARC_REG_IPRB_IRQ6_MASK 0x00f0 +#define CYGARC_REG_IPRB_IRQ6_PRI1 0x0010 +#define CYGARC_REG_IPRB_IRQ7_MASK 0x000f +#define CYGARC_REG_IPRB_IRQ7_PRI1 0x0001 + +#define CYGARC_REG_IPRC_DMAC0_MASK 0xf000 +#define CYGARC_REG_IPRC_DMAC0_PRI1 0x1000 +#define CYGARC_REG_IPRC_DMAC1_MASK 0x0f00 +#define CYGARC_REG_IPRC_DMAC1_PRI1 0x0100 +#define CYGARC_REG_IPRC_DMAC2_MASK 0x00f0 +#define CYGARC_REG_IPRC_DMAC2_PRI1 0x0010 +#define CYGARC_REG_IPRC_DMAC3_MASK 0x000f +#define CYGARC_REG_IPRC_DMAC3_PRI1 0x0001 + +#define CYGARC_REG_IPRD_MTU0A_MASK 0xf000 +#define CYGARC_REG_IPRD_MTU0A_PRI1 0x1000 +#define CYGARC_REG_IPRD_MTU0B_MASK 0x0f00 +#define CYGARC_REG_IPRD_MTU0B_PRI1 0x0100 +#define CYGARC_REG_IPRD_MTU1A_MASK 0x00f0 +#define CYGARC_REG_IPRD_MTU1A_PRI1 0x0010 +#define CYGARC_REG_IPRD_MTU1B_MASK 0x000f +#define CYGARC_REG_IPRD_MTU1B_PRI1 0x0001 + +#define CYGARC_REG_IPRE_MTU2A_MASK 0xf000 +#define CYGARC_REG_IPRE_MTU2A_PRI1 0x1000 +#define CYGARC_REG_IPRE_MTU2B_MASK 0x0f00 +#define CYGARC_REG_IPRE_MTU2B_PRI1 0x0100 +#define CYGARC_REG_IPRE_MTU3A_MASK 0x00f0 +#define CYGARC_REG_IPRE_MTU3A_PRI1 0x0010 +#define CYGARC_REG_IPRE_MTU3B_MASK 0x000f +#define CYGARC_REG_IPRE_MTU3B_PRI1 0x0001 + +#define CYGARC_REG_IPRF_MTU4A_MASK 0xf000 +#define CYGARC_REG_IPRF_MTU4A_PRI1 0x1000 +#define CYGARC_REG_IPRF_MTU4B_MASK 0x0f00 +#define CYGARC_REG_IPRF_MTU4B_PRI1 0x0100 +#define CYGARC_REG_IPRF_SCI0_MASK 0x00f0 +#define CYGARC_REG_IPRF_SCI0_PRI1 0x0010 +#define CYGARC_REG_IPRF_SCI1_MASK 0x000f +#define CYGARC_REG_IPRF_SCI1_PRI1 0x0001 + +#define CYGARC_REG_IPRG_AD_MASK 0xf000 +#define CYGARC_REG_IPRG_AD_PRI1 0x1000 +#define CYGARC_REG_IPRG_DTC_MASK 0x0f00 +#define CYGARC_REG_IPRG_DTC_PRI1 0x0100 +#define CYGARC_REG_IPRG_CMT0_MASK 0x00f0 +#define CYGARC_REG_IPRG_CMT0_PRI1 0x0010 +#define CYGARC_REG_IPRG_CMT1_MASK 0x000f +#define CYGARC_REG_IPRG_CMT1_PRI1 0x0001 + +#define CYGARC_REG_IPRH_WDT_MASK 0xf000 +#define CYGARC_REG_IPRH_WDT_PRI1 0x1000 +#define CYGARC_REG_IPRH_IO_MASK 0x0f00 +#define CYGARC_REG_IPRH_IO_PRI1 0x0100 + +// The (initial) IRQ mode +#define CYGARC_REG_ICR_INIT 0x0000 + +#define CYGARC_REG_ISR_IRQ0F 0x0080 +#define CYGARC_REG_ISR_IRQ1F 0x0040 +#define CYGARC_REG_ISR_IRQ2F 0x0020 +#define CYGARC_REG_ISR_IRQ3F 0x0010 +#define CYGARC_REG_ISR_IRQ4F 0x0008 +#define CYGARC_REG_ISR_IRQ5F 0x0004 +#define CYGARC_REG_ISR_IRQ6F 0x0002 +#define CYGARC_REG_ISR_IRQ7F 0x0001 diff --git a/packages/hal/sh/sh2/current/include/mod_regs_mmu.h b/packages/hal/sh/sh2/current/include/mod_regs_mmu.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_mmu.h @@ -0,0 +1,59 @@ +//============================================================================= +// +// mod_regs_mmu.h +// +// MMU Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2000-10-30 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// MMU control registers +#define CYGARC_REG_MMUCR 0xffffffe0 + +#define CYGARC_REG_MMUCR_SV 0x00000100 +#define CYGARC_REG_MMUCR_RC_MASK 0x000000c0 +#define CYGARC_REG_MMUCR_TF 0x00000004 +#define CYGARC_REG_MMUCR_IX 0x00000002 +#define CYGARC_REG_MMUCR_AT 0x00000001 diff --git a/packages/hal/sh/sh2/current/include/mod_regs_pcm.h b/packages/hal/sh/sh2/current/include/mod_regs_pcm.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_pcm.h @@ -0,0 +1,53 @@ +//============================================================================= +// +// mod_regs_pcm.h +// +// Power Control Module (PCM) register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-02-07 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +#define CYGARC_REG_SBYCR1 0xfffffe91 // 8 bit +#define CYGARC_REG_SBYCR2 0xfffffe93 // 8 bit diff --git a/packages/hal/sh/sh2/current/include/mod_regs_pfc.h b/packages/hal/sh/sh2/current/include/mod_regs_pfc.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_pfc.h @@ -0,0 +1,192 @@ +//============================================================================= +// +// mod_regs_pfc.h +// +// PFC (pin function controller) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-30 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#define CYGARC_REG_PACR 0xfffffc80 // port A control +#define CYGARC_REG_PAIOR 0xfffffc82 // port A IO +#define CYGARC_REG_PBCR 0xfffffc88 // port A control +#define CYGARC_REG_PBIOR 0xfffffc8a // port A IO +#define CYGARC_REG_PBCR2 0xfffffc8e // port A control 2 + +#define CYGARC_REG_PADR 0xfffffc84 // port A data +#define CYGARC_REG_PBDR 0xfffffc8c // port B data + + +// Port A +#define CYGARC_REG_PACR_PA13MD 0x2000 +#define CYGARC_REG_PACR_PA12MD 0x1000 +#define CYGARC_REG_PACR_PA11MD 0x0800 +#define CYGARC_REG_PACR_PA10MD 0x0400 +#define CYGARC_REG_PACR_PA9MD 0x0200 +#define CYGARC_REG_PACR_PA8MD 0x0100 +#define CYGARC_REG_PACR_PA7MD 0x0080 +#define CYGARC_REG_PACR_PA6MD 0x0040 +#define CYGARC_REG_PACR_PA5MD 0x0020 +#define CYGARC_REG_PACR_PA4MD 0x0010 +#define CYGARC_REG_PACR_PA3MD 0x0008 +#define CYGARC_REG_PACR_PA2MD 0x0004 +#define CYGARC_REG_PACR_PA1MD 0x0002 +#define CYGARC_REG_PACR_PA0MD 0x0001 + +#define CYGARC_REG_PAIOR_PA13IOR 0x2000 +#define CYGARC_REG_PAIOR_PA12IOR 0x1000 +#define CYGARC_REG_PAIOR_PA11IOR 0x0800 +#define CYGARC_REG_PAIOR_PA10IOR 0x0400 +#define CYGARC_REG_PAIOR_PA9IOR 0x0200 +#define CYGARC_REG_PAIOR_PA8IOR 0x0100 +#define CYGARC_REG_PAIOR_PA7IOR 0x0080 +#define CYGARC_REG_PAIOR_PA6IOR 0x0040 +#define CYGARC_REG_PAIOR_PA5IOR 0x0020 +#define CYGARC_REG_PAIOR_PA4IOR 0x0010 +//#define CYGARC_REG_PAIOR_PA3IOR 0x0008 +#define CYGARC_REG_PAIOR_PA2IOR 0x0004 +#define CYGARC_REG_PAIOR_PA1IOR 0x0002 +#define CYGARC_REG_PAIOR_PA0IOR 0x0001 + +#define CYGARC_REG_PBCR_PB15MD_mask 0xc000 +#define CYGARC_REG_PBCR_PB15MD_shift 14 +#define CYGARC_REG_PBCR_PB14MD_mask 0x3000 +#define CYGARC_REG_PBCR_PB14MD_shift 12 +#define CYGARC_REG_PBCR_PB13MD_mask 0x0c00 +#define CYGARC_REG_PBCR_PB13MD_shift 10 +#define CYGARC_REG_PBCR_PB12MD_mask 0x0300 +#define CYGARC_REG_PBCR_PB12MD_shift 8 +#define CYGARC_REG_PBCR_PB11MD_mask 0x00c0 +#define CYGARC_REG_PBCR_PB11MD_shift 6 +#define CYGARC_REG_PBCR_PB10MD_mask 0x0030 +#define CYGARC_REG_PBCR_PB10MD_shift 4 +#define CYGARC_REG_PBCR_PB9MD_mask 0x000c +#define CYGARC_REG_PBCR_PB9MD_shift 2 +#define CYGARC_REG_PBCR_PB8MD_mask 0x0003 +#define CYGARC_REG_PBCR_PB8MD_shift 0 + +#define CYGARC_REG_PBCR2_PB7MD_mask 0xc000 +#define CYGARC_REG_PBCR2_PB7MD_shift 14 +#define CYGARC_REG_PBCR2_PB6MD_mask 0x3000 +#define CYGARC_REG_PBCR2_PB6MD_shift 12 +#define CYGARC_REG_PBCR2_PB5MD_mask 0x0c00 +#define CYGARC_REG_PBCR2_PB5MD_shift 10 +#define CYGARC_REG_PBCR2_PB4MD_mask 0x0300 +#define CYGARC_REG_PBCR2_PB4MD_shift 8 +#define CYGARC_REG_PBCR2_PB3MD_mask 0x00c0 +#define CYGARC_REG_PBCR2_PB3MD_shift 6 +#define CYGARC_REG_PBCR2_PB2MD_mask 0x0030 +#define CYGARC_REG_PBCR2_PB2MD_shift 4 +#define CYGARC_REG_PBCR2_PB1MD_mask 0x000c +#define CYGARC_REG_PBCR2_PB1MD_shift 2 +#define CYGARC_REG_PBCR2_PB0MD_mask 0x0003 +#define CYGARC_REG_PBCR2_PB0MD_shift 0 + +#define CYGARC_REG_PBIOR_PB15IOR_OUT 0x8000 +#define CYGARC_REG_PBIOR_PB14IOR_OUT 0x4000 +#define CYGARC_REG_PBIOR_PB13IOR_OUT 0x2000 +#define CYGARC_REG_PBIOR_PB12IOR_OUT 0x1000 +#define CYGARC_REG_PBIOR_PB11IOR_OUT 0x0800 +#define CYGARC_REG_PBIOR_PB10IOR_OUT 0x0400 +#define CYGARC_REG_PBIOR_PB9IOR_OUT 0x0200 +#define CYGARC_REG_PBIOR_PB8IOR_OUT 0x0100 +#define CYGARC_REG_PBIOR_PB7IOR_OUT 0x0080 +#define CYGARC_REG_PBIOR_PB6IOR_OUT 0x0040 +#define CYGARC_REG_PBIOR_PB5IOR_OUT 0x0020 +#define CYGARC_REG_PBIOR_PB4IOR_OUT 0x0010 +#define CYGARC_REG_PBIOR_PB3IOR_OUT 0x0008 +#define CYGARC_REG_PBIOR_PB2IOR_OUT 0x0004 +#define CYGARC_REG_PBIOR_PB1IOR_OUT 0x0002 +#define CYGARC_REG_PBIOR_PB0IOR_OUT 0x0001 + +#define CYGARC_REG_PBIOR_PB15IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB14IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB13IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB12IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB11IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB10IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB9IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB8IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB7IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB6IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB5IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB4IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB3IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB2IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB1IOR_IN 0x0000 +#define CYGARC_REG_PBIOR_PB0IOR_IN 0x0000 + +//#define CYGARC_REG_PADR_PA15DR 0x8000 +//#define CYGARC_REG_PADR_PA14DR 0x4000 +#define CYGARC_REG_PADR_PA13DR 0x2000 +#define CYGARC_REG_PADR_PA12DR 0x1000 +#define CYGARC_REG_PADR_PA11DR 0x0800 +#define CYGARC_REG_PADR_PA10DR 0x0400 +#define CYGARC_REG_PADR_PA9DR 0x0200 +#define CYGARC_REG_PADR_PA8DR 0x0100 +#define CYGARC_REG_PADR_PA7DR 0x0080 +#define CYGARC_REG_PADR_PA6DR 0x0040 +#define CYGARC_REG_PADR_PA5DR 0x0020 +#define CYGARC_REG_PADR_PA4DR 0x0010 +//#define CYGARC_REG_PADR_PA3DR 0x0008 +#define CYGARC_REG_PADR_PA2DR 0x0004 +#define CYGARC_REG_PADR_PA1DR 0x0002 +#define CYGARC_REG_PADR_PA0DR 0x0001 + +#define CYGARC_REG_PBDR_PB15DR 0x8000 +#define CYGARC_REG_PBDR_PB14DR 0x4000 +#define CYGARC_REG_PBDR_PB13DR 0x2000 +#define CYGARC_REG_PBDR_PB12DR 0x1000 +#define CYGARC_REG_PBDR_PB11DR 0x0800 +#define CYGARC_REG_PBDR_PB10DR 0x0400 +#define CYGARC_REG_PBDR_PB9DR 0x0200 +#define CYGARC_REG_PBDR_PB8DR 0x0100 +#define CYGARC_REG_PBDR_PB7DR 0x0080 +#define CYGARC_REG_PBDR_PB6DR 0x0040 +#define CYGARC_REG_PBDR_PB5DR 0x0020 +#define CYGARC_REG_PBDR_PB4DR 0x0010 +#define CYGARC_REG_PBDR_PB3DR 0x0008 +#define CYGARC_REG_PBDR_PB2DR 0x0004 +#define CYGARC_REG_PBDR_PB1DR 0x0002 +#define CYGARC_REG_PBDR_PB0DR 0x0001 diff --git a/packages/hal/sh/sh2/current/include/mod_regs_pfc_2.h b/packages/hal/sh/sh2/current/include/mod_regs_pfc_2.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_pfc_2.h @@ -0,0 +1,81 @@ +//============================================================================= +// +// mod_regs_pfc_2.h +// +// PFC (pin function controller) Module (type 2) register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-04-17 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#define CYGARC_REG_PAIORH 0xffff8384 +#define CYGARC_REG_PAIORL 0xffff8386 +#define CYGARC_REG_PACRH 0xffff8388 +#define CYGARC_REG_PACRL1 0xffff838c +#define CYGARC_REG_PACRL2 0xffff838e + +#define CYGARC_REG_PBIOR 0xffff8394 +#define CYGARC_REG_PBCR1 0xffff8398 +#define CYGARC_REG_PBCR2 0xffff839a + +#define CYGARC_REG_PCIOR 0xffff8396 +#define CYGARC_REG_PCCR 0xffff839c + +#define CYGARC_REG_PDIORH 0xffff83a4 +#define CYGARC_REG_PDIORL 0xffff83a6 +#define CYGARC_REG_PDCRH1 0xffff83a8 +#define CYGARC_REG_PDCRH2 0xffff83aa +#define CYGARC_REG_PDCRL 0xffff83ac + +#define CYGARC_REG_PEIOR 0xffff83b4 +#define CYGARC_REG_PECR1 0xffff83b8 +#define CYGARC_REG_PECR2 0xffff83ba + +#define CYGARC_REG_IFCR 0xffff83c8 + + +#define CYGARC_REG_PADRH 0xffff8380 +#define CYGARC_REG_PADRL 0xffff8382 + +#define CYGARC_REG_PEDR 0xffff83b0 + diff --git a/packages/hal/sh/sh2/current/include/mod_regs_ser.h b/packages/hal/sh/sh2/current/include/mod_regs_ser.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_ser.h @@ -0,0 +1,252 @@ +//============================================================================= +// +// mod_regs_ser.h +// +// SCI, SCIF, and IRDA (serial) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2000-10-30 +// Note: All three serial module definitions kept in the same file +// since they share some of the information. +//####DESCRIPTIONEND#### +// +//============================================================================= + +#ifdef CYGARC_SH_MOD_SCI +//++++++ Module SCI ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +//-------------------------------------------------------------------------- +// Serial registers. All 8 bit registers. +#define CYGARC_REG_SCI_SCSMR0 0xffff81a0 // serial mode register +#define CYGARC_REG_SCI_SCBRR0 0xffff81a1 // bit rate register +#define CYGARC_REG_SCI_SCSCR0 0xffff81a2 // serial control register +#define CYGARC_REG_SCI_SCTDR0 0xffff81a3 // transmit data register +#define CYGARC_REG_SCI_SCSSR0 0xffff81a4 // serial status register +#define CYGARC_REG_SCI_SCRDR0 0xffff81a5 // receive data register + +#define CYGARC_REG_SCI_SCSMR1 0xffff81b0 // serial mode register + +// Serial Mode Register +#define CYGARC_REG_SCI_SCSMR_CA 0x80 // communication mode +#define CYGARC_REG_SCI_SCSMR_CHR 0x40 // character length (7 if set) +#define CYGARC_REG_SCI_SCSMR_PE 0x20 // parity enable +#define CYGARC_REG_SCI_SCSMR_OE 0x10 // parity mode +#define CYGARC_REG_SCI_SCSMR_STOP 0x08 // stop bit length +#define CYGARC_REG_SCI_SCSMR_MP 0x04 // multiprocessor mode +#define CYGARC_REG_SCI_SCSMR_CKS1 0x02 // clock select 1 +#define CYGARC_REG_SCI_SCSMR_CKS0 0x01 // clock select 0 +#define CYGARC_REG_SCI_SCSMR_CKSx_MASK 0x03 // mask + +// Serial Control Register +#define CYGARC_REG_SCI_SCSCR_TIE 0x80 // transmit interrupt enable +#define CYGARC_REG_SCI_SCSCR_RIE 0x40 // receive interrupt enable +#define CYGARC_REG_SCI_SCSCR_TE 0x20 // transmit enable +#define CYGARC_REG_SCI_SCSCR_RE 0x10 // receive enable +#define CYGARC_REG_SCI_SCSCR_MPIE 0x08 // multiprocessor interrupt enable +#define CYGARC_REG_SCI_SCSCR_TEIE 0x04 // transmit-end interrupt enable +#define CYGARC_REG_SCI_SCSCR_CKE1 0x02 // clock enable 1 +#define CYGARC_REG_SCI_SCSCR_CKE0 0x01 // clock enable 0 + +// Serial Status Register +#define CYGARC_REG_SCI_SCSSR_TDRE 0x80 // transmit data register empty +#define CYGARC_REG_SCI_SCSSR_RDRF 0x40 // receive data register full +#define CYGARC_REG_SCI_SCSSR_ORER 0x20 // overrun error +#define CYGARC_REG_SCI_SCSSR_FER 0x10 // framing error +#define CYGARC_REG_SCI_SCSSR_PER 0x08 // parity error +#define CYGARC_REG_SCI_SCSSR_TEND 0x04 // transmit end +#define CYGARC_REG_SCI_SCSSR_MPB 0x02 // multiprocessor bit +#define CYGARC_REG_SCI_SCSSR_MPBT 0x01 // multiprocessor bit transfer + +// When clearing the status register, always write the value: +// CYGARC_REG_SCSSR_CLEARMASK & ~bit +// to prevent other bits than the one of interest to be cleared. +#define CYGARC_REG_SCI_SCSSR_CLEARMASK 0xf8 + + +#if (CYGARC_SH_MOD_SCI >= 2) +# define CYGARC_REG_SCI_SCSPTR 0xfffffe7c // serial port register +#endif + +#endif // CYGARC_SH_MOD_SCI + +// Baud rate values calculation, depending on peripheral clock (Pf) +// n is CKS setting (0-3) +// N = (Pf/(64*2^(2n-1)*B))-1 +// With CYGARC_SCBRR_CKSx providing the values 1, 4, 16, 64 we get +// N = (Pf/(32*_CKS*B))-1 +// +// The CYGARC_SCBRR_OPTIMAL_CKS macro should compute the minimal CKS +// setting for the given baud rate and peripheral clock. +// +// The error of the CKS+count value can be computed by: +// E(%) = ((Pf/((N+1)*B*(64^(n-1)))-1)*100 +// +#define CYGARC_SCBRR_PRESCALE(_b_) \ +((((CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED/32/1/(_b_))-1)<256) ? 1 : \ + (((CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED/32/4/(_b_))-1)<256) ? 4 : \ + (((CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED/32/16/(_b_))-1)<256) ? 16 : 64) + +// Add half the divisor to reduce rounding errors to .5 +#define CYGARC_SCBRR_ROUNDING(_b_) \ + 16*CYGARC_SCBRR_PRESCALE(_b_)*(_b_) + +// These two macros provide the static values we need to stuff into the +// registers. +#define CYGARC_SCBRR_CKSx(_b_) \ + ((1 == CYGARC_SCBRR_PRESCALE(_b_)) ? 0 : \ + (4 == CYGARC_SCBRR_PRESCALE(_b_)) ? 1 : \ + (16 == CYGARC_SCBRR_PRESCALE(_b_)) ? 2 : 3) +#define CYGARC_SCBRR_N(_b_) \ + (((_b_) < 4800) ? 0 : \ + ((_b_) > 115200) ? 0 : \ + (((CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED+CYGARC_SCBRR_ROUNDING(_b_))/32/CYGARC_SCBRR_PRESCALE(_b_)/(_b_))-1)) + + +//++++++ Module SCIF +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +#ifdef CYGARC_SH_MOD_SCIF + +//-------------------------------------------------------------------------- +// Serial w FIFO registers (and IRDA) + +#define CYGARC_REG_SCIF_SCSMR1 0xfffffcc0 // 8 +#define CYGARC_REG_SCIF_SCBRR1 0xfffffcc2 // 8 +#define CYGARC_REG_SCIF_SCSCR1 0xfffffcc4 // 8 +#define CYGARC_REG_SCIF_SCFTDR1 0xfffffcc6 // 8 +#define CYGARC_REG_SCIF_SC1SSR1 0xfffffcc8 // 16 +#define CYGARC_REG_SCIF_SC2SSR1 0xfffffcca // 8 +#define CYGARC_REG_SCIF_SCFRDR1 0xfffffccc // 8 +#define CYGARC_REG_SCIF_SCFCR1 0xfffffcce // 8 +#define CYGARC_REG_SCIF_SCFDR1 0xfffffcd0 // 16 +#define CYGARC_REG_SCIF_SCFER1 0xfffffcd2 // 16 +#define CYGARC_REG_SCIF_SCIFMR1 0xfffffcd4 // 8 + +#define CYGARC_REG_SCIF_SCSMR2 0xfffffce0 // 8 +#define CYGARC_REG_SCIF_SCBRR2 0xfffffce2 // 8 +#define CYGARC_REG_SCIF_SCSCR2 0xfffffce4 // 8 +#define CYGARC_REG_SCIF_SCFTDR2 0xfffffce6 // 8 +#define CYGARC_REG_SCIF_SC1SSR2 0xfffffce8 // 16 +#define CYGARC_REG_SCIF_SC2SSR2 0xfffffcea // 8 +#define CYGARC_REG_SCIF_SCFRDR2 0xfffffcec // 8 +#define CYGARC_REG_SCIF_SCFCR2 0xfffffcee // 8 +#define CYGARC_REG_SCIF_SCFDR2 0xfffffcf0 // 16 +#define CYGARC_REG_SCIF_SCFER2 0xfffffcf2 // 16 +#define CYGARC_REG_SCIF_SCIFMR2 0xfffffcf4 // 8 + +// Serial Mode Register +#define CYGARC_REG_SCIF_SCSMR_CA 0x80 // async(0)/sync(1) +#define CYGARC_REG_SCIF_SCSMR_CHR 0x40 // character length (7 if set) +#define CYGARC_REG_SCIF_SCSMR_PE 0x20 // parity enable +#define CYGARC_REG_SCIF_SCSMR_OE 0x10 // parity mode (odd if set) +#define CYGARC_REG_SCIF_SCSMR_STOP 0x08 // stop bit length +#define CYGARC_REG_SCIF_SCSMR_MP 0x04 // MP mode +#define CYGARC_REG_SCIF_SCSMR_CKS1 0x02 // clock select 1 +#define CYGARC_REG_SCIF_SCSMR_CKS0 0x01 // clock select 0 +#define CYGARC_REG_SCIF_SCSMR_CKSx_MASK 0x03 // mask + +// Serial Control Register +#define CYGARC_REG_SCIF_SCSCR_TIE 0x80 // transmit interrupt enable +#define CYGARC_REG_SCIF_SCSCR_RIE 0x40 // receive interrupt enable +#define CYGARC_REG_SCIF_SCSCR_TE 0x20 // transmit enable +#define CYGARC_REG_SCIF_SCSCR_RE 0x10 // receive enable +#define CYGARC_REG_SCIF_SCSCR_MPIE 0x08 // MP interrupt enable +#define CYGARC_REG_SCIF_SCSCR_CKE1 0x02 // clock enable 1 +#define CYGARC_REG_SCIF_SCSCR_CKE0 0x01 // clock enable 0 + +// Serial Status Register 1 +#define CYGARC_REG_SCIF_SCSSR_PER_MASK 0xf000 // number of parity errors +#define CYGARC_REG_SCIF_SCSSR_PER_shift 12 +#define CYGARC_REG_SCIF_SCSSR_FER_MASK 0x0f00 // number of framing errors +#define CYGARC_REG_SCIF_SCSSR_FER_shift 8 +#define CYGARC_REG_SCIF_SCSSR_ER 0x0080 // receive error +#define CYGARC_REG_SCIF_SCSSR_TEND 0x0040 // transmit end +#define CYGARC_REG_SCIF_SCSSR_TDFE 0x0020 // transmit fifo data empty +#define CYGARC_REG_SCIF_SCSSR_BRK 0x0010 // break detection +#define CYGARC_REG_SCIF_SCSSR_FER 0x0008 // framing error +#define CYGARC_REG_SCIF_SCSSR_PER 0x0004 // parity error +#define CYGARC_REG_SCIF_SCSSR_RDF 0x0002 // receive fifo data full +#define CYGARC_REG_SCIF_SCSSR_DR 0x0001 // receive data ready + +// When clearing the status register, always write the value: +// CYGARC_REG_SCSSR_CLEARMASK & ~bit +// to prevent other bits than the one of interest to be cleared. +#define CYGARC_REG_SCIF_SCSSR_CLEARMASK 0x00f3 + +// Serial Status Register 2 +#define CYGARC_REG_SCIF_SC2SSR_TLM 0x80 // Transmit LSB(0)/MSB(1) +#define CYGARC_REG_SCIF_SC2SSR_RLM 0x40 // Receive LSB(0)/MSB(1) +#define CYGARC_REG_SCIF_SC2SSR_BITRATE_4 0x00 // Bitrate +#define CYGARC_REG_SCIF_SC2SSR_BITRATE_8 0x10 +#define CYGARC_REG_SCIF_SC2SSR_BITRATE_16 0x20 +#define CYGARC_REG_SCIF_SC2SSR_MPB 0x08 // MP data received +#define CYGARC_REG_SCIF_SC2SSR_MPBT 0x04 // MP data transmited +#define CYGARC_REG_SCIF_SC2SSR_EI 0x02 // Ignore RX errors +#define CYGARC_REG_SCIF_SC2SSR_ORER 0x01 // overrun error + +// Serial FIFO Control Register +#define CYGARC_REG_SCIF_SCFCR_RTRG_MASK 0xc0 // receive fifo data trigger +#define CYGARC_REG_SCIF_SCFCR_RTRG_1 0x00 // trigger on 1 char +#define CYGARC_REG_SCIF_SCFCR_RTRG_4 0x40 // trigger on 4 chars +#define CYGARC_REG_SCIF_SCFCR_RTRG_8 0x80 // trigger on 8 chars +#define CYGARC_REG_SCIF_SCFCR_RTRG_14 0xc0 // trigger on 14 chars + +#define CYGARC_REG_SCIF_SCFCR_TTRG_MASK 0x30 // transmit fifo data trigger +#define CYGARC_REG_SCIF_SCFCR_TTRG_8 0x00 // trigger on 8 chars +#define CYGARC_REG_SCIF_SCFCR_TTRG_4 0x10 // trigger on 4 chars +#define CYGARC_REG_SCIF_SCFCR_TTRG_2 0x20 // trigger on 2 chars +#define CYGARC_REG_SCIF_SCFCR_TTRG_1 0x30 // trigger on 1 char + +#define CYGARC_REG_SCIF_SCFCR_MCE 0x08 // modem control enable +#define CYGARC_REG_SCIF_SCFCR_TFRST 0x04 // transmit fifo reset +#define CYGARC_REG_SCIF_SCFCR_RFRST 0x02 // receive fifo reset +#define CYGARC_REG_SCIF_SCFCR_LOOP 0x01 // loop back test + + +// Serial FIFO Data Count Set Register +#define CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK 0x001f // number of chars in r fifo +#define CYGARC_REG_SCIF_SCFDR_RCOUNT_shift 0 +#define CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK 0x1f00 // number of chars in t fifo +#define CYGARC_REG_SCIF_SCFDR_TCOUNT_shift 8 + +// Serial IrDA Mode Register +#define CYGARC_REG_SCIF_SCIMR_IRMOD 0x80 +#define CYGARC_REG_SCIF_SCIMR_PSEL 0x40 +#define CYGARC_REG_SCIF_SCIMR_RIVS 0x20 + + +#endif // CYGARC_SH_MOD_SCIF diff --git a/packages/hal/sh/sh2/current/include/mod_regs_tmu.h b/packages/hal/sh/sh2/current/include/mod_regs_tmu.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_tmu.h @@ -0,0 +1,88 @@ +//============================================================================= +// +// mod_regs_tmu.h +// +// TMU (timer unit) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2000-10-30 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// TMU registers +#define CYGARC_REG_TOCR 0xfffffe90 // 8 bit +#define CYGARC_REG_TSTR 0xfffffe92 // 8 bit +#define CYGARC_REG_TCOR0 0xfffffe94 // 32 bit +#define CYGARC_REG_TCNT0 0xfffffe98 // 32 bit +#define CYGARC_REG_TCR0 0xfffffe9c // 16 bit +#define CYGARC_REG_TCOR1 0xfffffea0 // 32 bit +#define CYGARC_REG_TCNT1 0xfffffea4 // 32 bit +#define CYGARC_REG_TCR1 0xfffffea8 // 16 bit +#define CYGARC_REG_TCOR2 0xfffffeac // 32 bit +#define CYGARC_REG_TCNT2 0xfffffeb0 // 32 bit +#define CYGARC_REG_TCR2 0xfffffeb4 // 16 bit +#define CYGARC_REG_TCPR2 0xfffffeb8 // 32 bit + +// TSTR +#define CYGARC_REG_TSTR_STR0 0x0001 +#define CYGARC_REG_TSTR_STR1 0x0002 +#define CYGARC_REG_TSTR_STR2 0x0004 + +// TCR0/1/2 +#define CYGARC_REG_TCR_TPSC0 0x0001 +#define CYGARC_REG_TCR_TPSC1 0x0002 +#define CYGARC_REG_TCR_TPSC2 0x0004 +#define CYGARC_REG_TCR_CKEG0 0x0008 +#define CYGARC_REG_TCR_CKEG1 0x0010 +#define CYGARC_REG_TCR_UNIE 0x0020 +#define CYGARC_REG_TCR_UNF 0x0100 + +#define CYGARC_REG_TCR_TPSC_4 (0) +#define CYGARC_REG_TCR_TPSC_16 (CYGARC_REG_TCR_TPSC0) +#define CYGARC_REG_TCR_TPSC_64 (CYGARC_REG_TCR_TPSC1) +#define CYGARC_REG_TCR_TPSC_256 (CYGARC_REG_TCR_TPSC0|CYGARC_REG_TCR_TPSC1) + +// TCR2 additional bits +#define CYGARC_REG_TCR_ICPE0 0x0040 +#define CYGARC_REG_TCR_ICPE1 0x0080 +#define CYGARC_REG_TCR_ICPF 0x0200 diff --git a/packages/hal/sh/sh2/current/include/mod_regs_ubc.h b/packages/hal/sh/sh2/current/include/mod_regs_ubc.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_ubc.h @@ -0,0 +1,128 @@ +//============================================================================= +// +// mod_regs_ubc.h +// +// UBC (user break controller) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2000-10-30 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// User Break Control + +#define CYGARC_REG_BARA 0xffffff00 // 32 bit +#define CYGARC_REG_BAMRA 0xffffff04 // 8 bit (v1) / 32 bit +#define CYGARC_REG_BBRA 0xffffff08 // 16 bit + +#define CYGARC_REG_BARB 0xffffff20 // 32 bit +#define CYGARC_REG_BAMRB 0xffffff24 // 8 bit (v1) / 32 bit +#define CYGARC_REG_BBRB 0xffffff28 // 16 bit + +#define CYGARC_REG_BARC 0xffffff40 // 32 bit +#define CYGARC_REG_BAMRC 0xffffff44 // 8 bit (v1) / 32 bit +#define CYGARC_REG_BBRC 0xffffff48 // 16 bit + +#define CYGARC_REG_BARD 0xffffff60 // 32 bit +#define CYGARC_REG_BAMRD 0xffffff64 // 8 bit (v1) / 32 bit +#define CYGARC_REG_BBRD 0xffffff68 // 16 bit + + +#define CYGARC_REG_BRCR 0xffffff30 // 32 bit + +#ifdef CYGARC_SH_MOD_UBC + +#if (CYGARC_SH_MOD_UBC == 1) +#else +# define CYGARC_REG_BRCR_CMFCA 0x80000000 +# define CYGARC_REG_BRCR_CMFPA 0x40000000 +# define CYGARC_REG_BRCR_PCTE 0x08000000 // PC trace enable +# define CYGARC_REG_BRCR_PCBA 0x04000000 // post execute +# define CYGARC_REG_BRCR_CMFCB 0x00800000 +# define CYGARC_REG_BRCR_CMFPB 0x00400000 +# define CYGARC_REG_BRCR_SEQ1 0x00100000 // A and B channel in sequence +# define CYGARC_REG_BRCR_SEQ0 0x00080000 // A and B channel in sequence +# define CYGARC_REG_BRCR_PCBB 0x00040000 + +# define CYGARC_REG_BRCR_CMFCC 0x00008000 +# define CYGARC_REG_BRCR_CMFPC 0x00004000 +# define CYGARC_REG_BRCR_ETBEC 0x00002000 +# define CYGARC_REG_BRCR_DBEC 0x00000800 +# define CYGARC_REG_BRCR_PCBC 0x00000400 +# define CYGARC_REG_BRCR_CMFCD 0x00000080 +# define CYGARC_REG_BRCR_CMFPD 0x00000040 +# define CYGARC_REG_BRCR_ETBED 0x00000020 +# define CYGARC_REG_BRCR_DBED 0x00000008 +# define CYGARC_REG_BRCR_PCBD 0x00000004 + +# define CYGARC_REG_BRCR_ONE_STEP (CYGARC_REG_BRCR_PCBA) +#endif + + +#if (CYGARC_SH_MOD_UBC == 1) +#else +// mask is fully configurable in other versions of the UBC +#endif + +#define CYGARC_REG_BBRA_DFETCH 0x0020 // Break on DFETCH +#define CYGARC_REG_BBRA_IFETCH 0x0010 // Break on IFETCH +#define CYGARC_REG_BBRA_WRITE 0x0008 // Break on WRITE +#define CYGARC_REG_BBRA_READ 0x0004 // Break on READ +#define CYGARC_REG_BBRA_SIZE_LONG 0x0003 // Break on long access +#define CYGARC_REG_BBRA_SIZE_WORD 0x0002 // Break on word access +#define CYGARC_REG_BBRA_SIZE_BYTE 0x0001 // Break on byte access +#define CYGARC_REG_BBRA_SIZE_ANY 0x0000 // Break on any size + + +//---------------------------------------------------------------------------- +// Other types +#if (CYGARC_SH_MOD_UBC == 2) +#define CYGARC_REG_BETR 0xffffff9c // 16 bit +#define CYGARC_REG_BRSR 0xffffffac // 32 bit +#define CYGARC_REG_BRDR 0xffffffbc // 32 bit + +#define CYGARC_REG_BBRA_DMA 0x0080 // Break on DMAC cycle +#define CYGARC_REG_BBRA_CPU 0x0040 // Break on CPU cycle +#endif + +#endif // CYGARC_SH_MOD_UBC diff --git a/packages/hal/sh/sh2/current/include/mod_regs_wdt.h b/packages/hal/sh/sh2/current/include/mod_regs_wdt.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_wdt.h @@ -0,0 +1,72 @@ +//============================================================================= +// +// mod_regs_wdt.h +// +// WDT (Watch Dog Timer) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-17 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +#define CYGARC_REG_WTCSR_W 0xfffffe80 // 16 bit +#define CYGARC_REG_WTCSR_R 0xfffffe80 // 8 bit +#define CYGARC_REG_WTCNT_W 0xfffffe80 // 16 bit +#define CYGARC_REG_WTCNT_R 0xfffffe81 // 8 bit +#define CYGARC_REG_RSTCSR_W 0xfffffe82 // 16 bit +#define CYGARC_REG_RSTCSR_R 0xfffffe83 // 8 bit + +#define CYGARC_REG_WTCSR_W_MAGIC 0xa518 +#define CYGARC_REG_WTCNT_W_MAGIC 0x5a00 +#define CYGARC_REG_RSTCSR_W_WOVF_MAGIC 0xa51f +#define CYGARC_REG_RSTCSR_W_RSTx_MAGIC 0x5a1f + +#define CYGARC_REG_WTCSR_INIT (CYGARC_REG_WTCSR_W_MAGIC|0x00) + +#define CYGARC_REG_WTCSR_OVF 0x0080 +#define CYGARC_REG_WTCSR_WTIT 0x0040 +#define CYGARC_REG_WTCSR_TME 0x0020 + + +#define CYGARC_REG_RSTCSR_RSTE 0x0040 +#define CYGARC_REG_RSTCSR_RSTS 0x0020 diff --git a/packages/hal/sh/sh2/current/include/mod_regs_wdt_2.h b/packages/hal/sh/sh2/current/include/mod_regs_wdt_2.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/mod_regs_wdt_2.h @@ -0,0 +1,73 @@ +//============================================================================= +// +// mod_regs_wdt_2.h +// +// WDT (Watch Dog Timer) Module (type 2) register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-04-18 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +#define CYGARC_REG_WTCSR_W 0xffff8610 // 16 bit +#define CYGARC_REG_WTCSR_R 0xffff8610 // 8 bit +#define CYGARC_REG_WTCNT_W 0xffff8610 // 16 bit +#define CYGARC_REG_WTCNT_R 0xffff8611 // 8 bit +#define CYGARC_REG_RSTCSR_W 0xffff8612 // 16 bit +#define CYGARC_REG_RSTCSR_R 0xffff8613 // 8 bit + +#define CYGARC_REG_WTCSR_W_MAGIC 0xa518 +#define CYGARC_REG_WTCNT_W_MAGIC 0x5a00 +#define CYGARC_REG_RSTCSR_W_WOVF_MAGIC 0xa51f +#define CYGARC_REG_RSTCSR_W_RSTx_MAGIC 0x5a1f + +#define CYGARC_REG_WTCSR_OVF 0x0080 +#define CYGARC_REG_WTCSR_WTIT 0x0040 +#define CYGARC_REG_WTCSR_TME 0x0020 +#define CYGARC_REG_WTCSR_CLK_8192 0x0007 + +#define CYGARC_REG_WTCSR_INIT (CYGARC_REG_WTCSR_W_MAGIC|0x00) + +#define CYGARC_REG_RSTCSR_WOVF 0x0080 +#define CYGARC_REG_RSTCSR_RSTE 0x0040 +#define CYGARC_REG_RSTCSR_RSTS 0x0020 diff --git a/packages/hal/sh/sh2/current/include/sh2_sci.h b/packages/hal/sh/sh2/current/include/sh2_sci.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/sh2_sci.h @@ -0,0 +1,90 @@ +//============================================================================= +// +// sh2_sci.h +// +// Simple driver for the SH Serial Communication Interface (SCI) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-05-17 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGNUM_HAL_SH_SH2_SCI_PORTS + +//-------------------------------------------------------------------------- +// Exported functions + +externC cyg_uint8 cyg_hal_plf_sci_getc(void* __ch_data); +externC void cyg_hal_plf_sci_putc(void* __ch_data, cyg_uint8 c); +externC void cyg_hal_plf_sci_init(int sci_index, int comm_index, + int rcv_vect, cyg_uint8* base); + + +#ifdef CYGPRI_HAL_SH_SH2_SCI_PRIVATE +//-------------------------------------------------------------------------- +// SCI register offsets +#if (CYGARC_SH_MOD_SCI >= 2) +# error "Not fixed" +# define _REG_SCSPTR -0x4 // serial port register +#endif +#define _REG_SCSMR 0x0 // serial mode register +#define _REG_SCBRR 0x1 // bit rate register +#define _REG_SCSCR 0x2 // serial control register +#define _REG_SCTDR 0x3 // transmit data register +#define _REG_SCSSR 0x4 // serial status register +#define _REG_SCRDR 0x5 // receive data register + +//-------------------------------------------------------------------------- + +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +#endif // CYGPRI_HAL_SH_SH2_SCI_PRIVATE + +#endif // CYGNUM_HAL_SH_SH2_SCI_PORTS +//----------------------------------------------------------------------------- +// end of sh2_sci.h diff --git a/packages/hal/sh/sh2/current/include/sh2_scif.h b/packages/hal/sh/sh2/current/include/sh2_scif.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/sh2_scif.h @@ -0,0 +1,106 @@ +//============================================================================= +// +// sh2_scif.h +// +// Simple driver for the SH2 Serial Communication Interface with FIFO +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2000-03-30 +// Description: Simple driver for the SH Serial Communication Interface +// Clients of this file can configure the behavior with: +// CYGNUM_SCIF_PORTS: number of SCI ports +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGNUM_HAL_SH_SH2_SCIF_PORTS + +//-------------------------------------------------------------------------- +// Exported functions + +externC cyg_uint8 cyg_hal_plf_scif_getc(void* __ch_data); +externC void cyg_hal_plf_scif_putc(void* __ch_data, cyg_uint8 c); +void cyg_hal_plf_scif_init(int scif_index, int comm_index, + int rcv_vect, cyg_uint8* base, bool irda_mode); + + +#ifdef CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX +externC void cyg_hal_plf_scif_sync_rxtx(int scif_index, bool async_rxtx_mode); +#endif + +#ifdef CYGPRI_HAL_SH_SH2_SCIF_PRIVATE + +//-------------------------------------------------------------------------- +// SCIF register offsets +#define _REG_SCSMR 0x00 +#define _REG_SCBRR 0x02 +#define _REG_SCSCR 0x04 +#define _REG_SCFTDR 0x06 +#define _REG_SC1SSR 0x08 +#define _REG_SCSSR _REG_SC1SSR +#define _REG_SC2SSR 0x0a +#define _REG_SCFRDR 0x0c +#define _REG_SCFCR 0x0e +#define _REG_SCFDR 0x10 +#define _REG_SCFER 0x12 +#define _REG_SCIMR 0x14 + +//-------------------------------------------------------------------------- + +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; + bool irda_mode; +#ifdef CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX + bool async_rxtx_mode; +#endif +} channel_data_t; + +//-------------------------------------------------------------------------- + +#endif // CYGPRI_HAL_SH_SH2_SCIF_PRIVATE + +#endif // CYGNUM_HAL_SH_SH2_SCIF_PORTS +//----------------------------------------------------------------------------- +// end of sh2_scif.h diff --git a/packages/hal/sh/sh2/current/include/var_cache.h b/packages/hal/sh/sh2/current/include/var_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/var_cache.h @@ -0,0 +1,319 @@ +#ifndef CYGONCE_VAR_CACHE_H +#define CYGONCE_VAR_CACHE_H + +//============================================================================= +// +// var_cache.h +// +// HAL variant cache control API +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2002-01-09 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include +#include // HAL_READ/WRITE macros + +#include // Platform cache definitions + +#include CYGBLD_HAL_CPU_MODULES_H // cache module specs + +#include // CYGARC_REG_ definitions + +//----------------------------------------------------------------------------- +// Cache dimensions - one unified cache + +#define HAL_CACHE_UNIFIED + +#define HAL_UCACHE_SIZE CYGARC_SH_MOD_CAC_SIZE +#define HAL_UCACHE_LINE_SIZE CYGARC_SH_MOD_CAC_LINE_SIZE +#define HAL_UCACHE_WAYS CYGARC_SH_MOD_CAC_WAYS + +#define HAL_UCACHE_SETS (HAL_UCACHE_SIZE/(HAL_UCACHE_LINE_SIZE*HAL_UCACHE_WAYS)) + +//----------------------------------------------------------------------------- +// Global control of cache + +// This is all handled in assembly (see variant.S) due to a requirement about +// not fiddling the cache from cachable memory. + +externC void cyg_hal_cache_enable(void); +externC void cyg_hal_cache_disable(void); +externC void cyg_hal_cache_invalidate_all(void); +externC void cyg_hal_cache_sync(void); +externC void cyg_hal_cache_write_mode(int mode); + +// Enable the cache +#define HAL_UCACHE_ENABLE() cyg_hal_cache_enable() + +// Disable the cache +#define HAL_UCACHE_DISABLE() cyg_hal_cache_disable() + +#if (CYGARC_SH_MOD_CAC == 1) +// Invalidate the entire cache +#define HAL_UCACHE_INVALIDATE_ALL() cyg_hal_cache_invalidate_all() + +// Synchronize the contents of the cache with memory. +#define HAL_UCACHE_SYNC() cyg_hal_cache_sync() + +// Query the state of the cache (does not affect the caching) +#define HAL_UCACHE_IS_ENABLED(_state_) \ + CYG_MACRO_START \ + cyg_uint8 _tmp; \ + HAL_READ_UINT8(CYGARC_REG_CCR, _tmp); \ + (_state_) = (_tmp & CYGARC_REG_CCR_CE) ? 1 : 0; \ + CYG_MACRO_END + +// Set the cache refill burst size +//#define HAL_UCACHE_BURST_SIZE(_size_) + +// Set the cache write mode +#define HAL_UCACHE_WRITE_MODE( _mode_ ) \ + CYG_MACRO_START \ + cyg_uint32 _m_; \ + if (HAL_UCACHE_WRITETHRU_MODE == _mode_) \ + _m_ = 0 ; \ + else \ + _m_ = CYGARC_REG_CCR_WB; \ + cyg_hal_cache_write_mode(_m_); \ + CYG_MACRO_END + +#define HAL_UCACHE_WRITETHRU_MODE 0 +#define HAL_UCACHE_WRITEBACK_MODE 1 + +#elif (CYGARC_SH_MOD_CAC == 2) + +// Invalidate the entire cache +#define HAL_UCACHE_INVALIDATE_ALL() \ + CYG_MACRO_START \ + bool was_enabled; \ + HAL_UCACHE_IS_ENABLED(was_enabled); \ + cyg_hal_cache_disable(); \ + cyg_hal_cache_invalidate_all(); \ + if (was_enabled) cyg_hal_cache_enable(); \ + CYG_MACRO_END + +// Synchronize the contents of the cache with memory. +#define HAL_UCACHE_SYNC() HAL_UCACHE_INVALIDATE_ALL() + +// Query the state of the cache (does not affect the caching) +#define HAL_UCACHE_IS_ENABLED(_state_) \ + CYG_MACRO_START \ + cyg_uint16 _tmp; \ + HAL_READ_UINT16(CYGARC_REG_CCR, _tmp); \ + (_state_) = (_tmp & CYGARC_REG_CCR_CE) ? 1 : 0; \ + CYG_MACRO_END + +#else +# error "No cache operators for INTC type" +#endif + +// Load the contents of the given address range into the cache +// and then lock the cache so that it stays there. +//#define HAL_UCACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_UCACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_UCACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_UCACHE_ALLOCATE( _base_ , _size_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +//#define HAL_UCACHE_FLUSH( _base_ , _size_ ) + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_UCACHE_INVALIDATE( _base_ , _size_ ) + +// Write dirty cache lines to memory for the given address range. +//#define HAL_UCACHE_STORE( _base_ , _size_ ) + + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_UCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_UCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_UCACHE_ZERO( _base_ , _size_ ) + + +//----------------------------------------------------------------------------- +// Data and instruction cache macros map onto the both-cache macros + +//----------------------------------------------------------------------------- +// Global control of data cache + +#define HAL_DCACHE_SIZE HAL_UCACHE_SIZE +#define HAL_DCACHE_LINE_SIZE HAL_UCACHE_LINE_SIZE +#define HAL_DCACHE_WAYS HAL_UCACHE_WAYS +#define HAL_DCACHE_SETS HAL_UCACHE_SETS + +// Enable the data cache +#define HAL_DCACHE_ENABLE() HAL_UCACHE_ENABLE() + +// Disable the data cache +#define HAL_DCACHE_DISABLE() HAL_UCACHE_DISABLE() + +// Invalidate the entire cache +#define HAL_DCACHE_INVALIDATE_ALL() HAL_UCACHE_INVALIDATE_ALL() + +// Synchronize the contents of the cache with memory. +#define HAL_DCACHE_SYNC() HAL_UCACHE_SYNC() + +// Query the state of the data cache +#define HAL_DCACHE_IS_ENABLED(_state_) HAL_UCACHE_IS_ENABLED(_state_) + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_size_) + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) + +//#define HAL_DCACHE_WRITETHRU_MODE 0 +//#define HAL_DCACHE_WRITEBACK_MODE 1 + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +//#define HAL_DCACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_DCACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_DCACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +#define HAL_DCACHE_FLUSH( _base_ , _size_ ) HAL_UCACHE_FLUSH( _base_, _size_ ) + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) + +// Write dirty cache lines to memory for the given address range. +//#define HAL_DCACHE_STORE( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_DCACHE_ZERO( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +// Global control of Instruction cache + +#define HAL_ICACHE_SIZE HAL_UCACHE_SIZE +#define HAL_ICACHE_LINE_SIZE HAL_UCACHE_LINE_SIZE +#define HAL_ICACHE_WAYS HAL_UCACHE_WAYS +#define HAL_ICACHE_SETS HAL_UCACHE_SETS + +// Enable the instruction cache +#define HAL_ICACHE_ENABLE() HAL_UCACHE_ENABLE() + +// Disable the instruction cache +#define HAL_ICACHE_DISABLE() HAL_UCACHE_DISABLE() + +// Invalidate the entire cache +#define HAL_ICACHE_INVALIDATE_ALL() HAL_UCACHE_INVALIDATE_ALL() + + +// Synchronize the contents of the cache with memory. +#define HAL_ICACHE_SYNC() HAL_UCACHE_SYNC() + +// Query the state of the instruction cache +#define HAL_ICACHE_IS_ENABLED(_state_) HAL_UCACHE_IS_ENABLED(_state_) + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_size_) + +// Load the contents of the given address range into the instruction cache +// and then lock the cache so that it stays there. + +//#define HAL_ICACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_ICACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_ICACHE_INVALIDATE( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_VAR_CACHE_H +// End of var_cache.h diff --git a/packages/hal/sh/sh2/current/include/var_intr.h b/packages/hal/sh/sh2/current/include/var_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/var_intr.h @@ -0,0 +1,533 @@ +#ifndef CYGONCE_VAR_INTR_H +#define CYGONCE_VAR_INTR_H + +//========================================================================== +// +// var_intr.h +// +// HAL variant interrupt and clock support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov, +// Date: 1999-04-24 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include CYGBLD_HAL_CPU_MODULES_H // INTC module selection + +//-------------------------------------------------------------------------- +// Optional platform overrides and fallbacks +#include + +#ifndef CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF +# define CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF(vec) +#endif + +#ifndef CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF +# define CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF(vec, level, up) +#endif + +//---------------------------------------------------------------------------- +// Additional vectors provided by INTC V1 + +#if (CYGARC_SH_MOD_INTC == 1) + +#ifndef CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF +# define CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF(vec, level) \ + case CYGNUM_HAL_INTERRUPT_NMI: \ + /* fall through */ \ + case CYGNUM_HAL_INTERRUPT_LVL4 ... CYGNUM_HAL_INTERRUPT_LVL_MAX: \ + /* Cannot change levels */ \ + break; +#endif + +#define CYGNUM_HAL_INTERRUPT_LVL8 9 +#define CYGNUM_HAL_INTERRUPT_LVL9 10 +#define CYGNUM_HAL_INTERRUPT_LVL10 11 +#define CYGNUM_HAL_INTERRUPT_LVL11 12 +#define CYGNUM_HAL_INTERRUPT_LVL12 13 +#define CYGNUM_HAL_INTERRUPT_LVL13 14 +#define CYGNUM_HAL_INTERRUPT_LVL14 15 +#define CYGNUM_HAL_INTERRUPT_DMAC0_TE 16 +#define CYGNUM_HAL_INTERRUPT_DMAC1_TE 17 +#define CYGNUM_HAL_INTERRUPT_WDT_ITI 18 +#define CYGNUM_HAL_INTERRUPT_REF_CMI 19 +#define CYGNUM_HAL_INTERRUPT_EDMAC_EINT 20 +#define CYGNUM_HAL_INTERRUPT_FRT_ICI 21 +#define CYGNUM_HAL_INTERRUPT_FRT_OCI 22 +#define CYGNUM_HAL_INTERRUPT_FRT_OVI 23 +#define CYGNUM_HAL_INTERRUPT_TPU0_TGI0A 24 +#define CYGNUM_HAL_INTERRUPT_TPU0_TGI0B 25 +#define CYGNUM_HAL_INTERRUPT_TPU0_TGI0C 26 +#define CYGNUM_HAL_INTERRUPT_TPU0_TGI0D 27 +#define CYGNUM_HAL_INTERRUPT_TPU0_TGI0V 28 +#define CYGNUM_HAL_INTERRUPT_TPU1_TGI1A 29 +#define CYGNUM_HAL_INTERRUPT_TPU1_TGI1B 30 +#define CYGNUM_HAL_INTERRUPT_TPU1_TGI1V 31 +#define CYGNUM_HAL_INTERRUPT_TPU1_TGI1U 32 +#define CYGNUM_HAL_INTERRUPT_TPU2_TGI2A 33 +#define CYGNUM_HAL_INTERRUPT_TPU2_TGI2B 34 +#define CYGNUM_HAL_INTERRUPT_TPU2_TGI2V 35 +#define CYGNUM_HAL_INTERRUPT_TPU2_TGI2U 36 +#define CYGNUM_HAL_INTERRUPT_SCIF1_ERI1 37 +#define CYGNUM_HAL_INTERRUPT_SCIF1_RXI1 38 +#define CYGNUM_HAL_INTERRUPT_SCIF1_BRI1 39 +#define CYGNUM_HAL_INTERRUPT_SCIF1_TXI1 40 +#define CYGNUM_HAL_INTERRUPT_SCIF2_ERI2 41 +#define CYGNUM_HAL_INTERRUPT_SCIF2_RXI2 42 +#define CYGNUM_HAL_INTERRUPT_SCIF2_BRI2 43 +#define CYGNUM_HAL_INTERRUPT_SCIF2_TXI2 44 +#define CYGNUM_HAL_INTERRUPT_SIO0_RERI0 45 +#define CYGNUM_HAL_INTERRUPT_SIO0_TERI0 46 +#define CYGNUM_HAL_INTERRUPT_SIO0_RDFI0 47 +#define CYGNUM_HAL_INTERRUPT_SIO0_TDEI0 48 +#define CYGNUM_HAL_INTERRUPT_SIO1_RERI1 49 +#define CYGNUM_HAL_INTERRUPT_SIO1_TERI1 50 +#define CYGNUM_HAL_INTERRUPT_SIO1_RDFI1 51 +#define CYGNUM_HAL_INTERRUPT_SIO1_TDEI1 52 +#define CYGNUM_HAL_INTERRUPT_SIO2_RERI2 53 +#define CYGNUM_HAL_INTERRUPT_SIO2_TERI2 54 +#define CYGNUM_HAL_INTERRUPT_SIO2_RDFI2 55 +#define CYGNUM_HAL_INTERRUPT_SIO2_TDEI2 56 + +#define CYGNUM_HAL_INTERRUPT_LVL_MAX CYGNUM_HAL_INTERRUPT_LVL14 + +#undef CYGNUM_HAL_ISR_MAX +#ifdef CYGNUM_HAL_ISR_PLF_MAX +# define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_ISR_PLF_MAX +#else +# define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_INTERRUPT_SIO2_TDEI2 +#endif + +// The vector used by the Real time clock +#ifndef CYGNUM_HAL_INTERRUPT_RTC +# define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_FRT_OCI +#endif + +#elif (CYGARC_SH_MOD_INTC == 2) + +#ifndef CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF +# define CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF(vec, level) \ + case CYGNUM_HAL_INTERRUPT_NMI: \ + /* Cannot change levels */ \ + break; +#endif + +#define CYGNUM_HAL_INTERRUPT_DMAC0_DEI0 9 +#define CYGNUM_HAL_INTERRUPT_DMAC1_DEI1 10 +#define CYGNUM_HAL_INTERRUPT_DMAC2_DEI2 11 +#define CYGNUM_HAL_INTERRUPT_DMAC3_DEI3 12 +#define CYGNUM_HAL_INTERRUPT_MTU0_TGI0A 13 +#define CYGNUM_HAL_INTERRUPT_MTU0_TGI0B 14 +#define CYGNUM_HAL_INTERRUPT_MTU0_TGI0C 15 +#define CYGNUM_HAL_INTERRUPT_MTU0_TGI0D 16 +#define CYGNUM_HAL_INTERRUPT_MTU0_TGI0V 17 +#define CYGNUM_HAL_INTERRUPT_MTU1_TGI1A 18 +#define CYGNUM_HAL_INTERRUPT_MTU1_TGI1B 19 +#define CYGNUM_HAL_INTERRUPT_MTU1_TGI1V 20 +#define CYGNUM_HAL_INTERRUPT_MTU1_TGI1U 21 +#define CYGNUM_HAL_INTERRUPT_MTU2_TGI2A 22 +#define CYGNUM_HAL_INTERRUPT_MTU2_TGI2B 23 +#define CYGNUM_HAL_INTERRUPT_MTU2_TGI2V 24 +#define CYGNUM_HAL_INTERRUPT_MTU2_TGI2U 25 +#define CYGNUM_HAL_INTERRUPT_MTU3_TGI3A 26 +#define CYGNUM_HAL_INTERRUPT_MTU3_TGI3B 27 +#define CYGNUM_HAL_INTERRUPT_MTU3_TGI3C 28 +#define CYGNUM_HAL_INTERRUPT_MTU3_TGI3D 29 +#define CYGNUM_HAL_INTERRUPT_MTU3_TGI3V 30 +#define CYGNUM_HAL_INTERRUPT_MTU4_TGI4A 31 +#define CYGNUM_HAL_INTERRUPT_MTU4_TGI4B 32 +#define CYGNUM_HAL_INTERRUPT_MTU4_TGI4C 33 +#define CYGNUM_HAL_INTERRUPT_MTU4_TGI4D 34 +#define CYGNUM_HAL_INTERRUPT_MTU4_TGI4V 35 +#define CYGNUM_HAL_INTERRUPT_SCI0_ERI0 36 +#define CYGNUM_HAL_INTERRUPT_SCI0_RXI0 37 +#define CYGNUM_HAL_INTERRUPT_SCI0_TXI0 38 +#define CYGNUM_HAL_INTERRUPT_SCI0_TEI0 39 +#define CYGNUM_HAL_INTERRUPT_SCI1_ERI1 40 +#define CYGNUM_HAL_INTERRUPT_SCI1_RXI1 41 +#define CYGNUM_HAL_INTERRUPT_SCI1_TXI1 42 +#define CYGNUM_HAL_INTERRUPT_SCI1_TEI1 43 +#define CYGNUM_HAL_INTERRUPT_AD_ADI0 44 +#define CYGNUM_HAL_INTERRUPT_AD_ADI1 45 +#define CYGNUM_HAL_INTERRUPT_DTC_SWDTCE 46 +#define CYGNUM_HAL_INTERRUPT_CMT0_CMI0 47 +#define CYGNUM_HAL_INTERRUPT_CMT1_CMI1 48 +#define CYGNUM_HAL_INTERRUPT_WDT_ITI 49 +#define CYGNUM_HAL_INTERRUPT_BSC_CMI 50 +#define CYGNUM_HAL_INTERRUPT_IO_OEI 51 +#define CYGNUM_HAL_INTERRUPT_VAR_RESERVED 52 // just to catch bad assignments + +#undef CYGNUM_HAL_ISR_MAX +#ifdef CYGNUM_HAL_ISR_PLF_MAX +# define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_ISR_PLF_MAX +#else +# define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_INTERRUPT_VAR_RESERVED +#endif + +// eCos vector this entry decodes to , actual HW interrupt vector +#define CYGHWR_HAL_SH_SH2_CUSTOM_INTERRUPT_LAYOUT \ + exception_vector_int CYGNUM_HAL_INTERRUPT_LVL0 , 1 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_LVL1 , 2 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_LVL2 , 3 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_LVL3 , 4 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_LVL4 , 5 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_LVL5 , 6 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_LVL6 , 7 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_LVL7 , 8 ; \ + \ + exception_vector_int CYGNUM_HAL_INTERRUPT_DMAC0_DEI0 , 9 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 10 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 11 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 12 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_DMAC1_DEI1 , 13 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 14 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 15 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 16 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_DMAC2_DEI2 , 17 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 18 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 19 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 20 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_DMAC3_DEI3 , 21 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 22 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 23 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 24 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU0_TGI0A , 25 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU0_TGI0B , 26 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU0_TGI0C , 27 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU0_TGI0D , 28 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU0_TGI0V , 29 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 30 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 31 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 32 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU1_TGI1A , 33 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU1_TGI1B , 34 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 35 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 36 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU1_TGI1V , 37 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU1_TGI1U , 38 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 39 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 40 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU2_TGI2A , 41 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU2_TGI2B , 42 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 43 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 44 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU2_TGI2V , 45 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU2_TGI2U , 46 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 47 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 48 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU3_TGI3A , 49 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU3_TGI3B , 50 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU3_TGI3C , 51 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU3_TGI3D , 52 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU3_TGI3V , 53 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 54 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 55 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 56 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU4_TGI4A , 57 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU4_TGI4B , 58 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU4_TGI4C , 59 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU4_TGI4D , 60 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_MTU4_TGI4V , 61 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 62 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 63 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 64 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_SCI0_ERI0 , 65 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_SCI0_RXI0 , 66 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_SCI0_TXI0 , 67 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_SCI0_TEI0 , 68 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_SCI1_ERI1 , 69 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_SCI1_RXI1 , 70 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_SCI1_TXI1 , 71 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_SCI1_TEI1 , 72 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_AD_ADI0 , 73 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_AD_ADI1 , 74 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 75 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 76 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_DTC_SWDTCE , 77 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 78 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 79 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 80 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_CMT0_CMI0 , 81 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 82 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 83 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 84 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_CMT1_CMI1 , 85 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 86 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 87 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 88 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_WDT_ITI , 89 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_BSC_CMI , 90 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 91 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_VAR_RESERVED , 92 ; \ + exception_vector_int CYGNUM_HAL_INTERRUPT_BSC_CMI , 93 ; \ + .set vecno, CYGNUM_HAL_INTERRUPT_VAR_RESERVED ; \ + .rept (256-CYGNUM_HAL_INTERRUPT_VAR_RESERVED) ; \ + exception_vector_int vecno ; \ + .set vecno, vecno+1 ; \ + .endr + +// The vector used by the Real time clock +#ifndef CYGNUM_HAL_INTERRUPT_RTC +# define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_CMT0_CMI0 +#endif + +#else + +# error "No vectors defined for this INTC type" + +#endif + +//---------------------------------------------------------------------------- +// Platform may provide extensions to the interrupt configuration functions +// via these macros. The first macro is put inside the functions's +// switch statements, the last two called as functions. +#ifndef CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF +# define CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF(vec, level) +# define CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF(vec) +# define CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF(vec) +#endif + +#ifndef __ASSEMBLER__ +//-------------------------------------------------------------------------- +// Clock control, using Free-running Timer to match on compare register A + +#include // register definitions +#include // io macros +#include // CYG_FAIL + +#if defined(CYGARC_SH_MOD_FRT) +#define HAL_CLOCK_VAR_INITIALIZE( _period_ ) \ + CYG_MACRO_START \ + register cyg_uint8 _tier_; \ + \ + /* Disable interrupts while programming the timer */ \ + HAL_READ_UINT8(CYGARC_REG_TIER, _tier_); \ + HAL_WRITE_UINT8(CYGARC_REG_TIER, 0); \ + \ + /* Clear counter register */ \ + HAL_WRITE_UINT8(CYGARC_REG_FRC, 0); \ + /* Set compare A register */ \ + HAL_WRITE_UINT8(CYGARC_REG_TOCR, CYGARC_REG_TOCR_OLVLA); \ + HAL_WRITE_UINT16(CYGARC_REG_OCR, _period_); \ + \ + /* Enable match A counter clear */ \ + HAL_WRITE_UINT8(CYGARC_REG_FTCSR, CYGARC_REG_FTCSR_CCLRA); \ + /* Set interrupt prescaling */ \ + HAL_WRITE_UINT8(CYGARC_REG_TCR, \ + ((8==CYGHWR_HAL_SH_FRT_PRESCALE) ? \ + CYGARC_REG_TCR_CLK_8 : \ + (32==CYGHWR_HAL_SH_FRT_PRESCALE) ? \ + CYGARC_REG_TCR_CLK_32: \ + (128==CYGHWR_HAL_SH_FRT_PRESCALE) ? \ + CYGARC_REG_TCR_CLK_128:CYGARC_REG_TCR_CLK_EXT)); \ + \ + \ + CYG_MACRO_END + +// HAL_CLOCK_VAR_INITIALIZE is called from hal_variant_init since the +// FRT is also used by the hal_delay_us code. +#define HAL_CLOCK_INITIALIZE( _period_ ) \ + CYG_MACRO_START \ + register cyg_uint8 _tier_; \ + \ + CYG_ASSERT((cyg_uint16)(_period_) < (cyg_uint16)0xfffe, \ + "period too large for 16bit FRT"); \ + \ + /* Disable interrupts while programming the timer */ \ + HAL_READ_UINT8(CYGARC_REG_TIER, _tier_); \ + HAL_WRITE_UINT8(CYGARC_REG_TIER, 0); \ + \ + /* Set compare A register */ \ + HAL_WRITE_UINT8(CYGARC_REG_TOCR, CYGARC_REG_TOCR_OLVLA); \ + HAL_WRITE_UINT16(CYGARC_REG_OCR, _period_); \ + \ + /* Enable interrupt */ \ + _tier_ |= CYGARC_REG_TIER_OCIAE; \ + HAL_WRITE_UINT8(CYGARC_REG_TIER, _tier_); \ + \ + CYG_MACRO_END + +#define HAL_CLOCK_RESET( _vector_, _period_ ) \ + CYG_MACRO_START \ + register cyg_uint8 _ftcsr_; \ + \ + /* Clear match flag */ \ + HAL_READ_UINT8(CYGARC_REG_FTCSR, _ftcsr_); \ + _ftcsr_ &= ~CYGARC_REG_FTCSR_OCFA; \ + HAL_WRITE_UINT8(CYGARC_REG_FTCSR, _ftcsr_); \ + \ + CYG_MACRO_END + +#define HAL_CLOCK_READ( _pvalue_ ) \ + CYG_MACRO_START \ + register cyg_uint16 _frc_; \ + \ + HAL_READ_UINT16(CYGARC_REG_FRC, _frc_); \ + \ + *(_pvalue_) = _frc_; \ + CYG_MACRO_END + +#elif defined(CYGARC_SH_MOD_CMT) + +/* Compare Match Timer 0 is used for the eCos kernel RTC */ +#define HAL_CLOCK_VAR_INITIALIZE( _period_ ) \ + CYG_MACRO_START \ + register cyg_uint16 _tmp_; \ + \ + /* Disable timer while programming it */ \ + HAL_READ_UINT16(CYGARC_REG_CMSTR, _tmp_); \ + HAL_WRITE_UINT16(CYGARC_REG_CMSTR, _tmp_ & ~CYGARC_REG_CMSTR_STR0); \ + \ + /* Clear counter register */ \ + HAL_WRITE_UINT16(CYGARC_REG_CMCNT0, 0); \ + /* Set compare 0 register */ \ + HAL_WRITE_UINT16(CYGARC_REG_CMCOR0, _period_); \ + \ + /* Set prescaling and disable interrupts */ \ + HAL_WRITE_UINT16(CYGARC_REG_CMCSR0, \ + ((8==CYGHWR_HAL_SH_CMT_PRESCALE) ? \ + CYGARC_REG_CMCSR_CLK_8 : \ + (32==CYGHWR_HAL_SH_CMT_PRESCALE) ? \ + CYGARC_REG_CMCSR_CLK_32: \ + (128==CYGHWR_HAL_SH_CMT_PRESCALE) ? \ + CYGARC_REG_CMCSR_CLK_128:CYGARC_REG_CMCSR_CLK_512)); \ + \ + /* Start timer */ \ + HAL_WRITE_UINT16(CYGARC_REG_CMSTR, _tmp_ | CYGARC_REG_CMSTR_STR0); \ + \ + CYG_MACRO_END + +// HAL_CLOCK_VAR_INITIALIZE is called from hal_variant_init since the +// CMT0 is also used by the hal_delay_us code. +#define HAL_CLOCK_INITIALIZE( _period_ ) \ + CYG_MACRO_START \ + register cyg_uint16 _tmp_; \ + \ + CYG_ASSERT((cyg_uint16)(_period_) < (cyg_uint16)0xfffe, \ + "period too large for 16bit CMT"); \ + \ + /* Disable timer while programming it */ \ + HAL_READ_UINT16(CYGARC_REG_CMSTR, _tmp_); \ + HAL_WRITE_UINT16(CYGARC_REG_CMSTR, _tmp_ & ~CYGARC_REG_CMSTR_STR0); \ + \ + /* Clear counter register */ \ + HAL_WRITE_UINT16(CYGARC_REG_CMCNT0, 0); \ + /* Set compare 0 register */ \ + HAL_WRITE_UINT16(CYGARC_REG_CMCOR0, _period_); \ + \ + /* Set prescaling and enable interrupts */ \ + HAL_WRITE_UINT16(CYGARC_REG_CMCSR0, CYGARC_REG_CMCSR_CMIE | \ + ((8==CYGHWR_HAL_SH_CMT_PRESCALE) ? \ + CYGARC_REG_CMCSR_CLK_8 : \ + (32==CYGHWR_HAL_SH_CMT_PRESCALE) ? \ + CYGARC_REG_CMCSR_CLK_32: \ + (128==CYGHWR_HAL_SH_CMT_PRESCALE) ? \ + CYGARC_REG_CMCSR_CLK_128:CYGARC_REG_CMCSR_CLK_512)); \ + \ + /* Start timer */ \ + HAL_WRITE_UINT16(CYGARC_REG_CMSTR, _tmp_ | CYGARC_REG_CMSTR_STR0); \ + \ + CYG_MACRO_END + +#define HAL_CLOCK_RESET( _vector_, _period_ ) \ + CYG_MACRO_START \ + register cyg_uint16 _tmp_; \ + \ + /* Clear match flag */ \ + HAL_READ_UINT16(CYGARC_REG_CMCSR0, _tmp_); \ + _tmp_ &= ~CYGARC_REG_CMCSR_CMF; \ + HAL_WRITE_UINT16(CYGARC_REG_CMCSR0, _tmp_); \ + \ + CYG_MACRO_END + +#define HAL_CLOCK_READ( _pvalue_ ) \ + CYG_MACRO_START \ + register cyg_uint16 _tmp_; \ + \ + HAL_READ_UINT16(CYGARC_REG_CMCNT0, _tmp_); \ + \ + *(_pvalue_) = _tmp_; \ + CYG_MACRO_END + + + +#else +# error "No RTC handling defined" +#endif + + + +#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY +#define HAL_CLOCK_LATENCY( _pvalue_ ) HAL_CLOCK_READ(_pvalue_) +#endif + + +//---------------------------------------------------------------------------- +// Reset. +#ifndef HAL_PLATFORM_RESET +#define HAL_PLATFORM_RESET() \ + CYG_MACRO_START \ + HAL_WRITE_UINT16(CYGARC_REG_RSTCSR_W, CYGARC_REG_RSTCSR_W_RSTx_MAGIC|CYGARC_REG_RSTCSR_RSTE); \ + HAL_WRITE_UINT16(CYGARC_REG_WTCNT_W, CYGARC_REG_WTCNT_W_MAGIC|0xfe); \ + HAL_WRITE_UINT16(CYGARC_REG_WTCSR_W, CYGARC_REG_WTCSR_W_MAGIC|CYGARC_REG_WTCSR_TME|CYGARC_REG_WTCSR_WTIT); \ + /* wait for it */ \ + for(;;) ; \ + CYG_MACRO_END +#else +#define HAL_PLATFORM_RESET() +#endif + +#endif // __ASSEMBLER__ + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_VAR_INTR_H +// End of var_intr.h diff --git a/packages/hal/sh/sh2/current/include/var_io.h b/packages/hal/sh/sh2/current/include/var_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/var_io.h @@ -0,0 +1,61 @@ +#ifndef CYGONCE_VAR_IO_H +#define CYGONCE_VAR_IO_H + +//============================================================================= +// +// var_io.h +// +// Variant specific IO support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-05-29 +// Purpose: IO support macros +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +//----------------------------------------------------------------------------- +// end of var_io.h +#endif // CYGONCE_VAR_IO_H diff --git a/packages/hal/sh/sh2/current/include/var_regs.h b/packages/hal/sh/sh2/current/include/var_regs.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/var_regs.h @@ -0,0 +1,153 @@ +#ifndef CYGONCE_VAR_SH_REGS_H +#define CYGONCE_VAR_SH_REGS_H +//============================================================================= +// +// sh_regs.h +// +// SH CPU definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-04-24 +// Purpose: Define CPU memory mapped registers etc. +// Usage: #include +// Notes: +// This file describes registers for on-core modules found in all +// the SH3 CPUs supported by the HAL. For each CPU is defined a +// module specification file (mod_.h) which lists +// modules (and their version if applicable) included in that +// particular CPU model. Note that the versioning is ad hoc; +// it doesn't reflect Hitachi internal versioning in any way. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +// Find out which modules are supported by the chosen CPU +#include +#include CYGBLD_HAL_CPU_MODULES_H + +//========================================================================== +// CPU Definitions +//========================================================================== + +//-------------------------------------------------------------------------- +// Status register +#define CYGARC_REG_SR_MD 0x40000000 +#define CYGARC_REG_SR_RB 0x20000000 +#define CYGARC_REG_SR_BL 0x10000000 +#define CYGARC_REG_SR_M 0x00000200 +#define CYGARC_REG_SR_Q 0x00000100 +#define CYGARC_REG_SR_IMASK 0x000000f0 +#define CYGARC_REG_SR_I3 0x00000080 +#define CYGARC_REG_SR_I2 0x00000040 +#define CYGARC_REG_SR_I1 0x00000020 +#define CYGARC_REG_SR_I0 0x00000010 +#define CYGARC_REG_SR_S 0x00000002 +#define CYGARC_REG_SR_T 0x00000001 + + +//========================================================================== +// Module Definitions +//========================================================================== + +#include +#include +#include +#include + +#if (CYGARC_SH_MOD_BSC == 1) +# include +#elif (CYGARC_SH_MOD_BSC == 2) +# include +#else +# error "Unknown BSC header type" +#endif +#if (CYGARC_SH_MOD_WDT == 1) +# include +#elif (CYGARC_SH_MOD_WDT == 2) +# include +#else +# error "Unknown WDT header type" +#endif +#if (CYGARC_SH_MOD_CAC == 1) +# include +#elif (CYGARC_SH_MOD_CAC == 2) +# include +#else +# error "Unknown CAC header type" +#endif +#if (CYGARC_SH_MOD_INTC == 1) +# include +#elif (CYGARC_SH_MOD_INTC == 2) +# include +#else +# error "Unknown INTC header type" +#endif +#ifdef CYGARC_SH_MOD_DMAC +#include +#endif +#ifdef CYGARC_SH_MOD_PFC +# if (CYGARC_SH_MOD_PFC == 1) +# include +# elif (CYGARC_SH_MOD_PFC == 2) +# include +# else +# error "Unknown PFC header type" +# endif +#endif +#ifdef CYGARC_SH_MOD_FRT +#include +#endif +#ifdef CYGARC_SH_MOD_PCM +#include +#endif +#ifdef CYGARC_SH_MOD_ETH +#include +#endif +#ifdef CYGARC_SH_MOD_CMT +#include +#endif +#ifdef CYGARC_SH_MOD_ADC +#include +#endif + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_VAR_SH_REGS_H +// End of var_regs.h diff --git a/packages/hal/sh/sh2/current/include/variant.inc b/packages/hal/sh/sh2/current/include/variant.inc new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/include/variant.inc @@ -0,0 +1,238 @@ +#ifndef CYGONCE_HAL_VARIANT_INC +#define CYGONCE_HAL_VARIANT_INC +##============================================================================= +## +## variant.inc +## +## SH2 variant assembler header file +## +##============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): jskov +## Contributors:jskov +## Date: 2002-01-17 +## Purpose: SH2 variant definitions and init code +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the SH2 CPU family. +## Usage: +## #include +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include +#include + +#=========================================================================== +## SR initialization value +## zero all bits except: +## I0-3 = Mask out all interrupts but NMI. + +#define CYG_SR (CYGARC_REG_SR_IMASK) + +##----------------------------------------------------------------------------- +## Hardware init macros +#ifndef CYGPKG_HAL_SH_POST_RESET_INIT + .macro hal_post_reset_init + # Initialize CPU + mov.l $nCYG_SR,r1 ! Put CPU in a well-known state + ldc r1,sr + mov #0,r0 + mov.l $CYGARC_REG_CCR,r1 ! Disable cache +#if (CYGARC_SH_MOD_CAC == 1) + mov.b r0,@r1 +#elif (CYGARC_SH_MOD_CAC == 2) + mov.w r0,@r1 +#else +# error "No CAC clear code" +#endif +#ifdef CYGARC_SH_MOD_UBC +#if (CYGARC_SH_MOD_UBC == 2) + mov.l $CYGARC_REG_BBRA,r1 ! Disable UBC Channel A + mov.w r0,@r1 + mov.l $CYGARC_REG_BBRB,r1 ! Disable UBC Channel B + mov.w r0,@r1 + mov.l $CYGARC_REG_BBRC,r1 ! Disable UBC Channel C + mov.w r0,@r1 + mov.l $CYGARC_REG_BBRD,r1 ! Disable UBC Channel D + mov.w r0,@r1 +#endif +#endif +#ifdef CYGARC_SH_MOD_FRT + mov.l $CYGARC_REG_TIER,r1 ! Disable FRT interrupts + mov.b r0,@r1 +#endif +#ifdef CYGARC_SH_MOD_CMT + mov.l $CYGARC_REG_CMSTR,r1 ! Disable CMT timers + mov.w r0,@r1 +#endif + mov.l $CYGARC_REG_IPRA,r1 ! Disable interrupt request sources + mov.w r0,@r1 + mov.l $CYGARC_REG_IPRB,r1 + mov.w r0,@r1 +#if (CYGARC_SH_MOD_INTC == 1) + mov.l $CYGARC_REG_IPRC,r1 + mov.w r0,@r1 + mov.l $CYGARC_REG_IPRD,r1 + mov.w r0,@r1 + mov.l $CYGARC_REG_IPRE,r1 + mov.w r0,@r1 + mov.w $nCYG_ICR_INIT,r0 + mov.l $CYGARC_REG_ICR,r1 ! Set interrupt controller mode + mov.w r0,@r1 +#elif (CYGARC_SH_MOD_INTC == 2) + mov.l $CYGARC_REG_IPRC,r1 + mov.w r0,@r1 + mov.l $CYGARC_REG_IPRD,r1 + mov.w r0,@r1 + mov.l $CYGARC_REG_IPRE,r1 + mov.w r0,@r1 + mov.l $CYGARC_REG_IPRF,r1 + mov.w r0,@r1 + mov.l $CYGARC_REG_IPRG,r1 + mov.w r0,@r1 + mov.l $CYGARC_REG_IPRH,r1 + mov.w r0,@r1 + mov.l $CYGARC_REG_ICR,r1 ! level triggered + mov.w r0,@r1 + mov.l $CYGARC_REG_ISR,r1 ! Clear any flags + mov.w r0,@r1 +#else +# error "No INTC clear code" +#endif + mov.w $nCYG_WTCSR_INIT,r0 ! Disable watchdog + mov.l $CYGARC_REG_WTCSR_W,r1 + mov.w r0,@r1 + + # Initialize VBR if necessary +#if !defined(CYG_HAL_STARTUP_RAM) || !defined(CYGSEM_HAL_USE_ROM_MONITOR) + mov.l $_HW_EXC_ENTRY_TABLE,r1 ! Set VBR + ldc r1,vbr +#endif + bra 1f + nop + +$nCYG_WTCSR_INIT: + .word CYGARC_REG_WTCSR_INIT ! clear all CSR bits + + .align 2 +$nCYG_SR: + .long CYG_SR +$CYGARC_REG_CCR: + .long CYGARC_REG_CCR +$CYGARC_REG_BBRA: + .long CYGARC_REG_BBRA +$CYGARC_REG_BBRB: + .long CYGARC_REG_BBRB +$CYGARC_REG_BBRC: + .long CYGARC_REG_BBRC +$CYGARC_REG_BBRD: + .long CYGARC_REG_BBRD +#ifdef CYGARC_SH_MOD_FRT +$CYGARC_REG_TIER: + .long CYGARC_REG_TIER +#endif +#ifdef CYGARC_SH_MOD_CMT +$CYGARC_REG_CMSTR: + .long CYGARC_REG_CMSTR +#endif +$CYGARC_REG_WTCSR_W: + .long CYGARC_REG_WTCSR_W +#if !defined(CYG_HAL_STARTUP_RAM) || !defined(CYGSEM_HAL_USE_ROM_MONITOR) + SYM_PTR_REF(_HW_EXC_ENTRY_TABLE) +#endif +$CYGARC_REG_IPRA: + .long CYGARC_REG_IPRA +$CYGARC_REG_IPRB: + .long CYGARC_REG_IPRB +#if (CYGARC_SH_MOD_INTC == 1) +$CYGARC_REG_IPRC: + .long CYGARC_REG_IPRC +$CYGARC_REG_IPRD: + .long CYGARC_REG_IPRD +$CYGARC_REG_IPRE: + .long CYGARC_REG_IPRE +$CYGARC_REG_ICR: + .long CYGARC_REG_ICR +$nCYG_ICR_INIT: + .word CYGARC_REG_ICR_INIT +#elif (CYGARC_SH_MOD_INTC == 2) +$CYGARC_REG_IPRC: + .long CYGARC_REG_IPRC +$CYGARC_REG_IPRD: + .long CYGARC_REG_IPRD +$CYGARC_REG_IPRE: + .long CYGARC_REG_IPRE +$CYGARC_REG_IPRF: + .long CYGARC_REG_IPRF +$CYGARC_REG_IPRG: + .long CYGARC_REG_IPRG +$CYGARC_REG_IPRH: + .long CYGARC_REG_IPRH +$CYGARC_REG_ICR: + .long CYGARC_REG_ICR +$CYGARC_REG_ISR: + .long CYGARC_REG_ISR +#endif + +1: + .endm +#define CYGPKG_HAL_SH_POST_RESET_INIT +#endif + +##----------------------------------------------------------------------------- +## Interrupt decode macros + .macro hal_intc_decode tmp,inum + .endm + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + .macro hal_intc_translate inum,vnum + mov #0,\vnum ! Just vector zero is supported + .endm +#else + .macro hal_intc_translate inum,vnum + mov \inum,\vnum ! Vector == interrupt number + shll2 \vnum ! get from vector number to ISR index + .endm +#endif + +#------------------------------------------------------------------------------ +#endif // CYGONCE_HAL_VARIANT_INC +# end of variant.inc diff --git a/packages/hal/sh/sh2/current/src/sh2_sci.c b/packages/hal/sh/sh2/current/src/sh2_sci.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/src/sh2_sci.c @@ -0,0 +1,322 @@ +//============================================================================= +// +// sh2_sci.c +// +// Simple driver for the SH Serial Communication Interface (SCI) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-05-17 +// Description: Simple driver for the SH Serial Communication Interface +// Clients of this file can configure the behavior with: +// CYGNUM_SCI_PORTS: number of SCI ports +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGNUM_HAL_SH_SH2_SCI_PORTS + +#include // IO macros +#include // CYG_ISR_HANDLED +#include // Helper functions +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // SAVE/RESTORE GP +#include // Calling-if API +#include // serial register definitions + +#define CYGPRI_HAL_SH_SH2_SCI_PRIVATE +#include // our header + +//-------------------------------------------------------------------------- + +void +cyg_hal_plf_sci_init_channel(const channel_data_t* chan) +{ + cyg_uint8 tmp; + cyg_uint8* base = chan->base; + + // Disable Tx/Rx interrupts, but enable Tx/Rx + HAL_WRITE_UINT8(base+_REG_SCSCR, + CYGARC_REG_SCI_SCSCR_TE|CYGARC_REG_SCI_SCSCR_RE); + + // 8-1-no parity. + HAL_WRITE_UINT8(base+_REG_SCSMR, 0); + + // Set speed to CYGNUM_HAL_SH_SH2_SCI_DEFAULT_BAUD_RATE + HAL_READ_UINT8(base+_REG_SCSMR, tmp); + tmp &= ~CYGARC_REG_SCI_SCSMR_CKSx_MASK; + tmp |= CYGARC_SCBRR_CKSx(CYGNUM_HAL_SH_SH2_SCI_BAUD_RATE); + HAL_WRITE_UINT8(base+_REG_SCSMR, tmp); + HAL_WRITE_UINT8(base+_REG_SCBRR, CYGARC_SCBRR_N(CYGNUM_HAL_SH_SH2_SCI_BAUD_RATE)); +} + +static cyg_bool +cyg_hal_plf_sci_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 sr; + + HAL_READ_UINT8(base+_REG_SCSSR, sr); + if (sr & CYGARC_REG_SCI_SCSSR_ORER) { + // Serial RX overrun. Clear error and let caller try again. + HAL_WRITE_UINT8(base+_REG_SCSSR, + CYGARC_REG_SCI_SCSSR_CLEARMASK & ~CYGARC_REG_SCI_SCSSR_ORER); + return false; + } + + if ((sr & CYGARC_REG_SCI_SCSSR_RDRF) == 0) + return false; + + HAL_READ_UINT8(base+_REG_SCRDR, *ch); + + // Clear buffer full flag. + HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCI_SCSSR_RDRF); + + return true; +} + +cyg_uint8 +cyg_hal_plf_sci_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + while(!cyg_hal_plf_sci_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +void +cyg_hal_plf_sci_putc(void* __ch_data, cyg_uint8 c) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 sr; + CYGARC_HAL_SAVE_GP(); + + do { + HAL_READ_UINT8(base+_REG_SCSSR, sr); + } while ((sr & CYGARC_REG_SCI_SCSSR_TDRE) == 0); + + HAL_WRITE_UINT8(base+_REG_SCTDR, c); + + // Clear empty flag. + HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCI_SCSSR_TDRE); + + // Hang around until the character has been safely sent. + do { + HAL_READ_UINT8(base+_REG_SCSSR, sr); + } while ((sr & CYGARC_REG_SCI_SCSSR_TDRE) == 0); + + CYGARC_HAL_RESTORE_GP(); +} + + +static channel_data_t channels[CYGNUM_HAL_SH_SH2_SCI_PORTS]; + +static void +cyg_hal_plf_sci_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_sci_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_sci_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_sci_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +cyg_bool +cyg_hal_plf_sci_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + channel_data_t* chan = (channel_data_t*)__ch_data; + int delay_count; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_sci_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_sci_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8 scr; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + HAL_INTERRUPT_UNMASK(chan->isr_vector); + HAL_READ_UINT8(chan->base+_REG_SCSCR, scr); + scr |= CYGARC_REG_SCI_SCSCR_RIE; + HAL_WRITE_UINT8(chan->base+_REG_SCSCR, scr); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + HAL_INTERRUPT_UNMASK(chan->isr_vector); + HAL_READ_UINT8(chan->base+_REG_SCSCR, scr); + scr &= ~CYGARC_REG_SCI_SCSCR_RIE; + HAL_WRITE_UINT8(chan->base+_REG_SCSCR, scr); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_sci_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + cyg_uint8 c, sr; + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + int res = 0; + CYGARC_HAL_SAVE_GP(); + + *__ctrlc = 0; + HAL_READ_UINT8(base+_REG_SCSSR, sr); + if (sr & CYGARC_REG_SCI_SCSSR_ORER) { + // Serial RX overrun. Clear error and hope protocol recovers. + HAL_WRITE_UINT8(base+_REG_SCSSR, + CYGARC_REG_SCI_SCSSR_CLEARMASK & ~CYGARC_REG_SCI_SCSSR_ORER); + res = CYG_ISR_HANDLED; + } else if (sr & CYGARC_REG_SCI_SCSSR_RDRF) { + // Received character + HAL_READ_UINT8(base+_REG_SCRDR, c); + + // Clear buffer full flag. + HAL_WRITE_UINT8(base+_REG_SCSSR, + CYGARC_REG_SCI_SCSSR_CLEARMASK & ~CYGARC_REG_SCI_SCSSR_RDRF); + + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +void +cyg_hal_plf_sci_init(int sci_index, int comm_index, + int rcv_vect, cyg_uint8* base) +{ + channel_data_t* chan = &channels[sci_index]; + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Initialize channel table + chan->base = base; + chan->isr_vector = rcv_vect; + chan->msec_timeout = 1000; + + // Disable interrupts. + HAL_INTERRUPT_MASK(chan->isr_vector); + + // Init channel + + cyg_hal_plf_sci_init_channel(chan); + + // Setup procs in the vector table + + // Initialize channel procs + CYGACC_CALL_IF_SET_CONSOLE_COMM(comm_index); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, chan); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_sci_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_sci_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_sci_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_sci_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_sci_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_sci_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_sci_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +#endif // CYGNUM_HAL_SH_SH2_SCI_PORTS + +//----------------------------------------------------------------------------- +// end of sh_sci.c diff --git a/packages/hal/sh/sh2/current/src/sh2_scif.c b/packages/hal/sh/sh2/current/src/sh2_scif.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/src/sh2_scif.c @@ -0,0 +1,428 @@ +//============================================================================= +// +// sh2_scif.c +// +// Simple driver for the SH2 Serial Communication Interface with FIFO +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-01-16 +// Description: Simple driver for the SH Serial Communication Interface +// The driver can be used for either the SCIF or the IRDA +// modules (the latter can act as the former). +// Clients of this file can configure the behavior with: +// CYGNUM_SCIF_PORTS: number of SCI ports +// +// Note: It should be possible to configure a channel to IRDA mode. +// Worry about that when some board needs it. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#ifdef CYGNUM_HAL_SH_SH2_SCIF_PORTS + +#include // IO macros +#include // CYG_ISR_HANDLED +#include // Helper functions +#include // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include // SAVE/RESTORE GP +#include // Calling-if API +#include // serial register definitions +#include // target_register_t + +#define CYGPRI_HAL_SH_SH2_SCIF_PRIVATE +#include // our header + +//-------------------------------------------------------------------------- + +void +cyg_hal_plf_scif_init_channel(const channel_data_t* chan) +{ + cyg_uint8* base = chan->base; + cyg_uint8 tmp; + cyg_uint16 sr; + int baud_rate = CYGNUM_HAL_SH_SH2_SCIF_BAUD_RATE; + + // Disable everything. + HAL_WRITE_UINT8(base+_REG_SCSCR, 0); + + // Reset FIFO. + HAL_WRITE_UINT8(base+_REG_SCFCR, + CYGARC_REG_SCIF_SCFCR_TFRST|CYGARC_REG_SCIF_SCFCR_RFRST); + HAL_WRITE_UINT16(base+_REG_SCFER, 0); + + // 8-1-no parity. This is also fine for IrDA mode + HAL_WRITE_UINT8(base+_REG_SCSMR, 0); + if (chan->irda_mode) + HAL_WRITE_UINT8(base+_REG_SCIMR, CYGARC_REG_SCIF_SCIMR_IRMOD); + else { + HAL_WRITE_UINT8(base+_REG_SCIMR, 0); + } + + // Set speed to CYGNUM_HAL_SH_SH2_SCIF_DEFAULT_BAUD_RATE + HAL_READ_UINT8(base+_REG_SCSMR, tmp); + tmp &= ~CYGARC_REG_SCIF_SCSMR_CKSx_MASK; + tmp |= CYGARC_SCBRR_CKSx(baud_rate); + HAL_WRITE_UINT8(base+_REG_SCSMR, tmp); + HAL_WRITE_UINT8(base+_REG_SCBRR, CYGARC_SCBRR_N(baud_rate)); + + // Let things settle: Here we should should wait the equivalent of + // one bit interval, + // i.e. 1/CYGNUM_HAL_SH_SH2_SCIF_DEFAULT_BAUD_RATE second, but + // until we have something like the Linux delay loop, it's hard to + // do reliably. So just move on and hope for the best (this is + // unlikely to cause problems since the CPU has just come out of + // reset anyway). + + // Clear status register (read back first). + HAL_READ_UINT16(base+_REG_SCSSR, sr); + HAL_WRITE_UINT16(base+_REG_SCSSR, 0); + + HAL_WRITE_UINT8(base+_REG_SC2SSR, CYGARC_REG_SCIF_SC2SSR_BITRATE_16|CYGARC_REG_SCIF_SC2SSR_EI); + + // Bring FIFO out of reset and set to trigger on every char in + // FIFO (or C-c input would not be processed). + HAL_WRITE_UINT8(base+_REG_SCFCR, + CYGARC_REG_SCIF_SCFCR_RTRG_1|CYGARC_REG_SCIF_SCFCR_TTRG_1); + + // Leave Tx/Rx interrupts disabled, but enable Rx/Tx (only Rx for IrDA) + if (chan->irda_mode) + HAL_WRITE_UINT8(base+_REG_SCSCR, CYGARC_REG_SCIF_SCSCR_RE); +#ifdef CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX + else if (chan->async_rxtx_mode) + HAL_WRITE_UINT8(base+_REG_SCSCR, CYGARC_REG_SCIF_SCSCR_RE); +#endif + else + HAL_WRITE_UINT8(base+_REG_SCSCR, CYGARC_REG_SCIF_SCSCR_TE|CYGARC_REG_SCIF_SCSCR_RE); +} + +//static +cyg_bool +cyg_hal_plf_scif_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint16 fdr, sr; + cyg_bool res = false; + + HAL_READ_UINT16(base+_REG_SCSSR, sr); + if (sr & CYGARC_REG_SCIF_SCSSR_ER) { + cyg_uint8 ssr2; + HAL_WRITE_UINT16(base+_REG_SCFER, 0); + HAL_READ_UINT8(base+_REG_SC2SSR, ssr2); + ssr2 &= ~CYGARC_REG_SCIF_SC2SSR_ORER; + HAL_WRITE_UINT8(base+_REG_SC2SSR, ssr2); + HAL_WRITE_UINT16(base+_REG_SCSSR, + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~(CYGARC_REG_SCIF_SCSSR_BRK | CYGARC_REG_SCIF_SCSSR_FER | CYGARC_REG_SCIF_SCSSR_PER)); + } + + + HAL_READ_UINT16(base+_REG_SCFDR, fdr); + if (0 != (fdr & CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK)) { + + HAL_READ_UINT8(base+_REG_SCFRDR, *ch); + + // Clear DR/RDF flags + HAL_READ_UINT16(base+_REG_SCSSR, sr); + HAL_WRITE_UINT16(base+_REG_SCSSR, + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~(CYGARC_REG_SCIF_SCSSR_RDF | CYGARC_REG_SCIF_SCSSR_DR)); + + res = true; + } + + return res; +} + +cyg_uint8 +cyg_hal_plf_scif_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + while(!cyg_hal_plf_scif_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +void +cyg_hal_plf_scif_putc(void* __ch_data, cyg_uint8 c) +{ + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8* base = chan->base; + cyg_uint16 fdr, sr; + cyg_uint8 scscr = 0; + CYGARC_HAL_SAVE_GP(); + + HAL_READ_UINT8(base+_REG_SCSCR, scscr); + if (chan->irda_mode) { + HAL_WRITE_UINT8(base+_REG_SCSCR, scscr|CYGARC_REG_SCIF_SCSCR_TE); + } +#ifdef CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX + if (chan->async_rxtx_mode) { + HAL_WRITE_UINT8(base+_REG_SCSCR, (scscr|CYGARC_REG_SCIF_SCSCR_TE)&~CYGARC_REG_SCIF_SCSCR_RE); + } +#endif + + do { + HAL_READ_UINT16(base+_REG_SCFDR, fdr); + } while (((fdr & CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK) >> CYGARC_REG_SCIF_SCFDR_TCOUNT_shift) == 16); + + HAL_WRITE_UINT8(base+_REG_SCFTDR, c); + + // Clear FIFO-empty/transmit end flags (read back SR first) + HAL_READ_UINT16(base+_REG_SCSSR, sr); + HAL_WRITE_UINT16(base+_REG_SCSSR, CYGARC_REG_SCIF_SCSSR_CLEARMASK + & ~(CYGARC_REG_SCIF_SCSSR_TDFE | CYGARC_REG_SCIF_SCSSR_TEND )); + + // Hang around until all characters have been safely sent. + do { + HAL_READ_UINT16(base+_REG_SCSSR, sr); + } while ((sr & CYGARC_REG_SCIF_SCSSR_TEND) == 0); + + + if (chan->irda_mode) { +#ifdef CYGHWR_HAL_SH_SH2_SCIF_IRDA_TXRX_COMPENSATION + // In IrDA mode there will be generated spurious RX events when + // the TX unit is switched on. Eat that character. + cyg_uint8 _junk; + HAL_READ_UINT8(base+_REG_SCFRDR, _junk); + + // Clear buffer full flag (read back first) + HAL_READ_UINT16(base+_REG_SCSSR, sr); + HAL_WRITE_UINT16(base+_REG_SCSSR, + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~(CYGARC_REG_SCIF_SCSSR_RDF|CYGARC_REG_SCIF_SCSSR_DR)); +#endif // CYGHWR_HAL_SH_SH2_SCIF_IRDA_TXRX_COMPENSATION + // Disable transmitter again + HAL_WRITE_UINT8(base+_REG_SCSCR, scscr); + } +#ifdef CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX + if (chan->async_rxtx_mode) { + // Disable transmitter, enable receiver + HAL_WRITE_UINT8(base+_REG_SCSCR, scscr); + } +#endif // CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX + + CYGARC_HAL_RESTORE_GP(); +} + + +static channel_data_t channels[CYGNUM_HAL_SH_SH2_SCIF_PORTS]; + +static void +cyg_hal_plf_scif_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_scif_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_scif_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_scif_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +cyg_bool +cyg_hal_plf_scif_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + channel_data_t* chan = (channel_data_t*)__ch_data; + int delay_count; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan->msec_timeout * 10; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_scif_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(100); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_scif_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8 scr; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + HAL_INTERRUPT_UNMASK(chan->isr_vector); + HAL_READ_UINT8(chan->base+_REG_SCSCR, scr); + scr |= CYGARC_REG_SCIF_SCSCR_RIE; + HAL_WRITE_UINT8(chan->base+_REG_SCSCR, scr); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + HAL_INTERRUPT_UNMASK(chan->isr_vector); + HAL_READ_UINT8(chan->base+_REG_SCSCR, scr); + scr &= ~CYGARC_REG_SCIF_SCSCR_RIE; + HAL_WRITE_UINT8(chan->base+_REG_SCSCR, scr); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_scif_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + cyg_uint8 c; + cyg_uint16 fdr, sr; + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + int res = 0; + CYGARC_HAL_SAVE_GP(); + + *__ctrlc = 0; + HAL_READ_UINT16(base+_REG_SCFDR, fdr); + if ((fdr & CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK) != 0) { + HAL_READ_UINT8(base+_REG_SCFRDR, c); + + // Clear buffer full flag (read back first). + HAL_READ_UINT16(base+_REG_SCSSR, sr); + HAL_WRITE_UINT16(base+_REG_SCSSR, + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~CYGARC_REG_SCIF_SCSSR_RDF); + + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +void +cyg_hal_plf_scif_init(int scif_index, int comm_index, + int rcv_vect, cyg_uint8* base, bool irda_mode) +{ + channel_data_t* chan = &channels[scif_index]; + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Initialize channel table + chan->base = base; + chan->isr_vector = rcv_vect; + chan->msec_timeout = 1000; + chan->irda_mode = irda_mode; +#ifdef CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX + chan->async_rxtx_mode = false; +#endif + + // Disable interrupts. + HAL_INTERRUPT_MASK(chan->isr_vector); + + // Init channel + cyg_hal_plf_scif_init_channel(chan); + + // Setup procs in the vector table + + // Initialize channel procs + CYGACC_CALL_IF_SET_CONSOLE_COMM(comm_index); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, chan); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_scif_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_scif_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_scif_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_scif_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_scif_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_scif_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_scif_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +#ifdef CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX +void +cyg_hal_plf_scif_sync_rxtx(int scif_index, bool async_rxtx_mode) +{ + channel_data_t* chan = &channels[scif_index]; + chan->async_rxtx_mode = async_rxtx_mode; + if (async_rxtx_mode) + HAL_WRITE_UINT8(chan->base+_REG_SCSCR, CYGARC_REG_SCIF_SCSCR_RE); + else + HAL_WRITE_UINT8(chan->base+_REG_SCSCR, CYGARC_REG_SCIF_SCSCR_RE|CYGARC_REG_SCIF_SCSCR_TE); +} +#endif // CYGHWR_HAL_SH_SH2_SCIF_ASYNC_RXTX + +#endif // CYGNUM_HAL_SH_SH2_SCIF_PORTS + +//----------------------------------------------------------------------------- +// end of sh2_scif.c diff --git a/packages/hal/sh/sh2/current/src/var_misc.c b/packages/hal/sh/sh2/current/src/var_misc.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/src/var_misc.c @@ -0,0 +1,801 @@ +//========================================================================== +// +// var_misc.c +// +// HAL miscellaneous functions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov, jlarmour, nickg +// Date: 2002-01-09 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +#include + +#include +#include // tracing macros +#include // assertion macros +#include // diag_printf + +#include // HAL header +#include // HAL cache +#include // HAL interrupts/exceptions + +//--------------------------------------------------------------------------- +// Initial cache enabling + +#ifdef CYGHWR_HAL_SH_CACHE_MODE_WRITE_BACK +# define CACHE_MODE HAL_UCACHE_WRITEBACK_MODE +#else +# define CACHE_MODE HAL_UCACHE_WRITETHRU_MODE +#endif + +externC void +cyg_var_enable_caches(void) +{ + // If relying on a ROM monitor do not invalidate the caches as the + // ROM monitor may have (non-synced) state in the caches. +#if !defined(CYGSEM_HAL_USE_ROM_MONITOR) + // Initialize cache. + HAL_UCACHE_INVALIDATE_ALL(); + +#ifdef HAL_UCACHE_WRITE_MODE + // Set cache modes + HAL_UCACHE_WRITE_MODE(CACHE_MODE); +#endif +#endif +#ifdef CYGHWR_HAL_SH_CACHE_ENABLE + // Enable cache. + HAL_UCACHE_ENABLE(); +#endif +} + +//--------------------------------------------------------------------------- +// Interrupt function support + +static void +hal_interrupt_set_vectors(void) +{ +#if (CYGARC_SH_MOD_INTC == 1) + // variant specific + HAL_WRITE_UINT16(CYGARC_REG_VCRDMA0, + CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_DMAC0_TE); + HAL_WRITE_UINT16(CYGARC_REG_VCRDMA1, + CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_DMAC1_TE); + HAL_WRITE_UINT16(CYGARC_REG_VCRWDT, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_WDT_ITI)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_REF_CMI)); + + HAL_WRITE_UINT16(CYGARC_REG_VCRA, + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_EDMAC_EINT)<<8); + + HAL_WRITE_UINT16(CYGARC_REG_VCRC, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_FRT_ICI)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_FRT_OCI)); + HAL_WRITE_UINT16(CYGARC_REG_VCRD, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_FRT_OVI)<<8)); + HAL_WRITE_UINT16(CYGARC_REG_VCRE, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU0_TGI0A)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU0_TGI0B)); + HAL_WRITE_UINT16(CYGARC_REG_VCRF, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU0_TGI0C)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU0_TGI0D)); + HAL_WRITE_UINT16(CYGARC_REG_VCRG, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU0_TGI0V)<<8)); + HAL_WRITE_UINT16(CYGARC_REG_VCRH, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU1_TGI1A)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU1_TGI1B)); + HAL_WRITE_UINT16(CYGARC_REG_VCRI, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU1_TGI1V)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU1_TGI1U)); + HAL_WRITE_UINT16(CYGARC_REG_VCRJ, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU2_TGI2A)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU2_TGI2B)); + HAL_WRITE_UINT16(CYGARC_REG_VCRK, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU2_TGI2V)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_TPU2_TGI2U)); + HAL_WRITE_UINT16(CYGARC_REG_VCRL, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SCIF1_ERI1)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SCIF1_RXI1)); + HAL_WRITE_UINT16(CYGARC_REG_VCRM, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SCIF1_BRI1)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SCIF1_TXI1)); + HAL_WRITE_UINT16(CYGARC_REG_VCRN, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SCIF2_ERI2)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SCIF2_RXI2)); + HAL_WRITE_UINT16(CYGARC_REG_VCRO, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SCIF2_BRI2)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SCIF2_TXI2)); + HAL_WRITE_UINT16(CYGARC_REG_VCRP, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO0_RERI0)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO0_TERI0)); + HAL_WRITE_UINT16(CYGARC_REG_VCRQ, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO0_RDFI0)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO0_TDEI0)); + HAL_WRITE_UINT16(CYGARC_REG_VCRR, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO1_RERI1)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO1_TERI1)); + HAL_WRITE_UINT16(CYGARC_REG_VCRS, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO1_RDFI1)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO1_TDEI1)); + HAL_WRITE_UINT16(CYGARC_REG_VCRT, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO2_RERI2)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO2_TERI2)); + HAL_WRITE_UINT16(CYGARC_REG_VCRU, + ((CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO2_RDFI2)<<8) | + (CYGNUM_HAL_INTERRUPT_HW_EXC_BASE+CYGNUM_HAL_INTERRUPT_SIO2_TDEI2)); + +#elif (CYGARC_SH_MOD_INTC == 2) + /* Hardwired vectors */ +#else +# error "No priority handling for INTC variant" +#endif +} + +externC cyg_uint8 cyg_hal_ILVL_table[]; +externC cyg_uint8 cyg_hal_IMASK_table[]; + +static void +hal_interrupt_update_level(int vector) +{ + cyg_uint16 iprX; + int level; + + level = cyg_hal_IMASK_table[vector] ? cyg_hal_ILVL_table[vector] : 0; + + switch( (vector) ) { +#if (CYGARC_SH_MOD_INTC == 1) + /* IPRA */ + case CYGNUM_HAL_INTERRUPT_DMAC0_TE: + case CYGNUM_HAL_INTERRUPT_DMAC1_TE: + HAL_READ_UINT16(CYGARC_REG_IPRA, iprX); + iprX &= ~CYGARC_REG_IPRA_DMAC_MASK; + iprX |= (level)*CYGARC_REG_IPRA_DMAC_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRA, iprX); + break; + case CYGNUM_HAL_INTERRUPT_WDT_ITI: + HAL_READ_UINT16(CYGARC_REG_IPRA, iprX); + iprX &= ~CYGARC_REG_IPRA_WDT_MASK; + iprX |= (level)*CYGARC_REG_IPRA_WDT_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRA, iprX); + break; + + /* This vector can not be configured */ + case CYGNUM_HAL_INTERRUPT_REF_CMI: + break; + + /* IPRB */ + case CYGNUM_HAL_INTERRUPT_EDMAC_EINT: + HAL_READ_UINT16(CYGARC_REG_IPRB, iprX); + iprX &= ~CYGARC_REG_IPRB_EDMAC_MASK; + iprX |= (level)*CYGARC_REG_IPRB_EDMAC_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRB, iprX); + break; + case CYGNUM_HAL_INTERRUPT_FRT_ICI: + case CYGNUM_HAL_INTERRUPT_FRT_OCI: + case CYGNUM_HAL_INTERRUPT_FRT_OVI: + HAL_READ_UINT16(CYGARC_REG_IPRB, iprX); + iprX &= ~CYGARC_REG_IPRB_FRT_MASK; + iprX |= (level)*CYGARC_REG_IPRB_FRT_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRB, iprX); + break; + +#ifndef CYGHWR_HAL_SH_IRQ_USE_IRQLVL + /* IPRC */ + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ0: + HAL_READ_UINT16(CYGARC_REG_IPRC, iprX); + iprX &= ~CYGARC_REG_IPRC_IRQ0_MASK; + iprX |= (level)*CYGARC_REG_IPRC_IRQ0_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRC, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ1: + HAL_READ_UINT16(CYGARC_REG_IPRC, iprX); + iprX &= ~CYGARC_REG_IPRC_IRQ1_MASK; + iprX |= (level)*CYGARC_REG_IPRC_IRQ1_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRC, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ2: + HAL_READ_UINT16(CYGARC_REG_IPRC, iprX); + iprX &= ~CYGARC_REG_IPRC_IRQ2_MASK; + iprX |= (level)*CYGARC_REG_IPRC_IRQ2_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRC, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ3: + HAL_READ_UINT16(CYGARC_REG_IPRC, iprX); + iprX &= ~CYGARC_REG_IPRC_IRQ3_MASK; + iprX |= (level)*CYGARC_REG_IPRC_IRQ3_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRC, iprX); + break; +#else + case CYGNUM_HAL_INTERRUPT_LVL0 ... CYGNUM_HAL_INTERRUPT_LVL3: + /* Cannot change levels */ + break; +#endif + /* IPRD */ + case CYGNUM_HAL_INTERRUPT_TPU0_TGI0A: + case CYGNUM_HAL_INTERRUPT_TPU0_TGI0B: + case CYGNUM_HAL_INTERRUPT_TPU0_TGI0C: + case CYGNUM_HAL_INTERRUPT_TPU0_TGI0D: + case CYGNUM_HAL_INTERRUPT_TPU0_TGI0V: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_TPU0_MASK; + iprX |= (level)*CYGARC_REG_IPRD_TPU0_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + case CYGNUM_HAL_INTERRUPT_TPU1_TGI1A: + case CYGNUM_HAL_INTERRUPT_TPU1_TGI1B: + case CYGNUM_HAL_INTERRUPT_TPU1_TGI1V: + case CYGNUM_HAL_INTERRUPT_TPU1_TGI1U: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_TPU1_MASK; + iprX |= (level)*CYGARC_REG_IPRD_TPU1_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + case CYGNUM_HAL_INTERRUPT_TPU2_TGI2A: + case CYGNUM_HAL_INTERRUPT_TPU2_TGI2B: + case CYGNUM_HAL_INTERRUPT_TPU2_TGI2V: + case CYGNUM_HAL_INTERRUPT_TPU2_TGI2U: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_TPU2_MASK; + iprX |= (level)*CYGARC_REG_IPRD_TPU2_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + case CYGNUM_HAL_INTERRUPT_SCIF1_ERI1: + case CYGNUM_HAL_INTERRUPT_SCIF1_RXI1: + case CYGNUM_HAL_INTERRUPT_SCIF1_BRI1: + case CYGNUM_HAL_INTERRUPT_SCIF1_TXI1: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_SCIF1_MASK; + iprX |= (level)*CYGARC_REG_IPRD_SCIF1_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + + /* IPRE */ + case CYGNUM_HAL_INTERRUPT_SCIF2_ERI2: + case CYGNUM_HAL_INTERRUPT_SCIF2_RXI2: + case CYGNUM_HAL_INTERRUPT_SCIF2_BRI2: + case CYGNUM_HAL_INTERRUPT_SCIF2_TXI2: + HAL_READ_UINT16(CYGARC_REG_IPRE, iprX); + iprX &= ~CYGARC_REG_IPRE_SCIF2_MASK; + iprX |= (level)*CYGARC_REG_IPRE_SCIF2_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRE, iprX); + break; + case CYGNUM_HAL_INTERRUPT_SIO0_RERI0: + case CYGNUM_HAL_INTERRUPT_SIO0_TERI0: + case CYGNUM_HAL_INTERRUPT_SIO0_RDFI0: + case CYGNUM_HAL_INTERRUPT_SIO0_TDEI0: + HAL_READ_UINT16(CYGARC_REG_IPRE, iprX); + iprX &= ~CYGARC_REG_IPRE_SIO0_MASK; + iprX |= (level)*CYGARC_REG_IPRE_SIO0_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRE, iprX); + break; + case CYGNUM_HAL_INTERRUPT_SIO1_RERI1: + case CYGNUM_HAL_INTERRUPT_SIO1_TERI1: + case CYGNUM_HAL_INTERRUPT_SIO1_RDFI1: + case CYGNUM_HAL_INTERRUPT_SIO1_TDEI1: + HAL_READ_UINT16(CYGARC_REG_IPRE, iprX); + iprX &= ~CYGARC_REG_IPRE_SIO1_MASK; + iprX |= (level)*CYGARC_REG_IPRE_SIO1_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRE, iprX); + break; + case CYGNUM_HAL_INTERRUPT_SIO2_RERI2: + case CYGNUM_HAL_INTERRUPT_SIO2_TERI2: + case CYGNUM_HAL_INTERRUPT_SIO2_RDFI2: + case CYGNUM_HAL_INTERRUPT_SIO2_TDEI2: + HAL_READ_UINT16(CYGARC_REG_IPRE, iprX); + iprX &= ~CYGARC_REG_IPRE_SIO2_MASK; + iprX |= (level)*CYGARC_REG_IPRE_SIO2_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRE, iprX); + break; +#elif (CYGARC_SH_MOD_INTC == 2) + + /* IPRA */ + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ0: + HAL_READ_UINT16(CYGARC_REG_IPRA, iprX); + iprX &= ~CYGARC_REG_IPRA_IRQ0_MASK; + iprX |= (level)*CYGARC_REG_IPRA_IRQ0_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRA, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ1: + HAL_READ_UINT16(CYGARC_REG_IPRA, iprX); + iprX &= ~CYGARC_REG_IPRA_IRQ1_MASK; + iprX |= (level)*CYGARC_REG_IPRA_IRQ1_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRA, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ2: + HAL_READ_UINT16(CYGARC_REG_IPRA, iprX); + iprX &= ~CYGARC_REG_IPRA_IRQ2_MASK; + iprX |= (level)*CYGARC_REG_IPRA_IRQ2_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRA, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ3: + HAL_READ_UINT16(CYGARC_REG_IPRA, iprX); + iprX &= ~CYGARC_REG_IPRA_IRQ3_MASK; + iprX |= (level)*CYGARC_REG_IPRA_IRQ3_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRA, iprX); + break; + + /* IPRB */ + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ4: + HAL_READ_UINT16(CYGARC_REG_IPRB, iprX); + iprX &= ~CYGARC_REG_IPRB_IRQ4_MASK; + iprX |= (level)*CYGARC_REG_IPRB_IRQ4_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRB, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ5: + HAL_READ_UINT16(CYGARC_REG_IPRB, iprX); + iprX &= ~CYGARC_REG_IPRB_IRQ5_MASK; + iprX |= (level)*CYGARC_REG_IPRB_IRQ5_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRB, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ6: + HAL_READ_UINT16(CYGARC_REG_IPRB, iprX); + iprX &= ~CYGARC_REG_IPRB_IRQ6_MASK; + iprX |= (level)*CYGARC_REG_IPRB_IRQ6_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRB, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ7: + HAL_READ_UINT16(CYGARC_REG_IPRB, iprX); + iprX &= ~CYGARC_REG_IPRB_IRQ7_MASK; + iprX |= (level)*CYGARC_REG_IPRB_IRQ7_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRB, iprX); + break; + + /* IPRB */ + case CYGNUM_HAL_INTERRUPT_DMAC0_DEI0: + HAL_READ_UINT16(CYGARC_REG_IPRC, iprX); + iprX &= ~CYGARC_REG_IPRC_DMAC0_MASK; + iprX |= (level)*CYGARC_REG_IPRC_DMAC0_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRC, iprX); + break; + case CYGNUM_HAL_INTERRUPT_DMAC1_DEI1: + HAL_READ_UINT16(CYGARC_REG_IPRC, iprX); + iprX &= ~CYGARC_REG_IPRC_DMAC1_MASK; + iprX |= (level)*CYGARC_REG_IPRC_DMAC1_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRC, iprX); + break; + case CYGNUM_HAL_INTERRUPT_DMAC2_DEI2: + HAL_READ_UINT16(CYGARC_REG_IPRC, iprX); + iprX &= ~CYGARC_REG_IPRC_DMAC2_MASK; + iprX |= (level)*CYGARC_REG_IPRC_DMAC2_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRC, iprX); + break; + case CYGNUM_HAL_INTERRUPT_DMAC3_DEI3: + HAL_READ_UINT16(CYGARC_REG_IPRC, iprX); + iprX &= ~CYGARC_REG_IPRC_DMAC3_MASK; + iprX |= (level)*CYGARC_REG_IPRC_DMAC3_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRC, iprX); + break; + + /* IPRD */ + case CYGNUM_HAL_INTERRUPT_MTU0_TGI0A: + case CYGNUM_HAL_INTERRUPT_MTU0_TGI0B: + case CYGNUM_HAL_INTERRUPT_MTU0_TGI0C: + case CYGNUM_HAL_INTERRUPT_MTU0_TGI0D: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_MTU0A_MASK; + iprX |= (level)*CYGARC_REG_IPRD_MTU0A_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + case CYGNUM_HAL_INTERRUPT_MTU0_TGI0V: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_MTU0B_MASK; + iprX |= (level)*CYGARC_REG_IPRD_MTU0B_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + case CYGNUM_HAL_INTERRUPT_MTU1_TGI1A: + case CYGNUM_HAL_INTERRUPT_MTU1_TGI1B: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_MTU1A_MASK; + iprX |= (level)*CYGARC_REG_IPRD_MTU1A_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + case CYGNUM_HAL_INTERRUPT_MTU1_TGI1V: + case CYGNUM_HAL_INTERRUPT_MTU1_TGI1U: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_MTU1B_MASK; + iprX |= (level)*CYGARC_REG_IPRD_MTU1B_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + + /* IPRE */ + case CYGNUM_HAL_INTERRUPT_MTU2_TGI2A: + case CYGNUM_HAL_INTERRUPT_MTU2_TGI2B: + HAL_READ_UINT16(CYGARC_REG_IPRE, iprX); + iprX &= ~CYGARC_REG_IPRE_MTU2A_MASK; + iprX |= (level)*CYGARC_REG_IPRE_MTU2A_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRE, iprX); + break; + case CYGNUM_HAL_INTERRUPT_MTU2_TGI2V: + case CYGNUM_HAL_INTERRUPT_MTU2_TGI2U: + HAL_READ_UINT16(CYGARC_REG_IPRE, iprX); + iprX &= ~CYGARC_REG_IPRE_MTU2B_MASK; + iprX |= (level)*CYGARC_REG_IPRE_MTU2B_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRE, iprX); + break; + case CYGNUM_HAL_INTERRUPT_MTU3_TGI3A: + case CYGNUM_HAL_INTERRUPT_MTU3_TGI3B: + case CYGNUM_HAL_INTERRUPT_MTU3_TGI3C: + case CYGNUM_HAL_INTERRUPT_MTU3_TGI3D: + HAL_READ_UINT16(CYGARC_REG_IPRE, iprX); + iprX &= ~CYGARC_REG_IPRE_MTU3A_MASK; + iprX |= (level)*CYGARC_REG_IPRE_MTU3A_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRE, iprX); + break; + case CYGNUM_HAL_INTERRUPT_MTU3_TGI3V: + HAL_READ_UINT16(CYGARC_REG_IPRE, iprX); + iprX &= ~CYGARC_REG_IPRE_MTU3B_MASK; + iprX |= (level)*CYGARC_REG_IPRE_MTU3B_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRE, iprX); + break; + + /* IPRF */ + case CYGNUM_HAL_INTERRUPT_MTU4_TGI4A: + case CYGNUM_HAL_INTERRUPT_MTU4_TGI4B: + case CYGNUM_HAL_INTERRUPT_MTU4_TGI4C: + case CYGNUM_HAL_INTERRUPT_MTU4_TGI4D: + HAL_READ_UINT16(CYGARC_REG_IPRF, iprX); + iprX &= ~CYGARC_REG_IPRF_MTU4A_MASK; + iprX |= (level)*CYGARC_REG_IPRF_MTU4A_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRF, iprX); + break; + case CYGNUM_HAL_INTERRUPT_MTU4_TGI4V: + HAL_READ_UINT16(CYGARC_REG_IPRF, iprX); + iprX &= ~CYGARC_REG_IPRF_MTU4B_MASK; + iprX |= (level)*CYGARC_REG_IPRF_MTU4B_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRF, iprX); + break; + case CYGNUM_HAL_INTERRUPT_SCI0_ERI0: + case CYGNUM_HAL_INTERRUPT_SCI0_RXI0: + case CYGNUM_HAL_INTERRUPT_SCI0_TXI0: + case CYGNUM_HAL_INTERRUPT_SCI0_TEI0: + HAL_READ_UINT16(CYGARC_REG_IPRF, iprX); + iprX &= ~CYGARC_REG_IPRF_SCI0_MASK; + iprX |= (level)*CYGARC_REG_IPRF_SCI0_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRF, iprX); + break; + case CYGNUM_HAL_INTERRUPT_SCI1_ERI1: + case CYGNUM_HAL_INTERRUPT_SCI1_RXI1: + case CYGNUM_HAL_INTERRUPT_SCI1_TXI1: + case CYGNUM_HAL_INTERRUPT_SCI1_TEI1: + HAL_READ_UINT16(CYGARC_REG_IPRF, iprX); + iprX &= ~CYGARC_REG_IPRF_SCI1_MASK; + iprX |= (level)*CYGARC_REG_IPRF_SCI1_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRF, iprX); + break; + + /* IPRG */ + case CYGNUM_HAL_INTERRUPT_AD_ADI0: + case CYGNUM_HAL_INTERRUPT_AD_ADI1: + HAL_READ_UINT16(CYGARC_REG_IPRG, iprX); + iprX &= ~CYGARC_REG_IPRG_AD_MASK; + iprX |= (level)*CYGARC_REG_IPRG_AD_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRG, iprX); + break; + case CYGNUM_HAL_INTERRUPT_DTC_SWDTCE: + HAL_READ_UINT16(CYGARC_REG_IPRG, iprX); + iprX &= ~CYGARC_REG_IPRG_DTC_MASK; + iprX |= (level)*CYGARC_REG_IPRG_DTC_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRG, iprX); + break; + case CYGNUM_HAL_INTERRUPT_CMT0_CMI0: + HAL_READ_UINT16(CYGARC_REG_IPRG, iprX); + iprX &= ~CYGARC_REG_IPRG_CMT0_MASK; + iprX |= (level)*CYGARC_REG_IPRG_CMT0_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRG, iprX); + break; + case CYGNUM_HAL_INTERRUPT_CMT1_CMI1: + HAL_READ_UINT16(CYGARC_REG_IPRG, iprX); + iprX &= ~CYGARC_REG_IPRG_CMT1_MASK; + iprX |= (level)*CYGARC_REG_IPRG_CMT1_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRG, iprX); + break; + + /* IPRH */ + case CYGNUM_HAL_INTERRUPT_WDT_ITI: + case CYGNUM_HAL_INTERRUPT_BSC_CMI: + HAL_READ_UINT16(CYGARC_REG_IPRH, iprX); + iprX &= ~CYGARC_REG_IPRH_WDT_MASK; + iprX |= (level)*CYGARC_REG_IPRH_WDT_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRH, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IO_OEI: + HAL_READ_UINT16(CYGARC_REG_IPRH, iprX); + iprX &= ~CYGARC_REG_IPRH_IO_MASK; + iprX |= (level)*CYGARC_REG_IPRH_IO_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRH, iprX); + break; + + +#else +# error "No hal_interrupt_update_level handling for INTC type" +#endif + + // Platform extensions + CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF(vector, level) + + default: + CYG_FAIL("Unknown interrupt vector"); + break; + } +} + +void +hal_interrupt_set_level(int vector, int level) +{ + CYG_ASSERT((0 <= (level) && 15 >= (level)), "Illegal level"); + CYG_ASSERT((CYGNUM_HAL_ISR_MIN <= (vector) + && CYGNUM_HAL_ISR_MAX >= (vector)), "Illegal vector"); + + cyg_hal_ILVL_table[vector] = level; + + hal_interrupt_update_level(vector); +} + +void +hal_interrupt_mask(int vector) +{ + switch( (vector) ) { + case CYGNUM_HAL_INTERRUPT_NMI: + /* fall through */ + case CYGNUM_HAL_INTERRUPT_LVL0 ... CYGNUM_HAL_INTERRUPT_LVL_MAX: + /* Normally can only be masked by fiddling Imask in SR, + but some platforms use external interrupt controller, + so allow regular handling. */ + /* fall through */ +#if (CYGARC_SH_MOD_INTC == 1) + case CYGNUM_HAL_INTERRUPT_DMAC0_TE ... CYGNUM_HAL_ISR_MAX: +#elif (CYGARC_SH_MOD_INTC == 2) + case CYGNUM_HAL_INTERRUPT_DMAC0_DEI0 ... CYGNUM_HAL_ISR_MAX: +#else +# error "Cannot unmask for INTC" +#endif + cyg_hal_IMASK_table[vector] = 0; + hal_interrupt_update_level(vector); + break; + default: + CYG_FAIL("Unknown interrupt vector"); + break; + } +} + +void +hal_interrupt_unmask(int vector) +{ + switch( (vector) ) { + case CYGNUM_HAL_INTERRUPT_NMI: + /* fall through */ + case CYGNUM_HAL_INTERRUPT_LVL0 ... CYGNUM_HAL_INTERRUPT_LVL_MAX: + /* Normally can only be masked by fiddling Imask in SR, + but some platforms use external interrupt controller, + so allow regular handling. */ + /* fall through */ +#if (CYGARC_SH_MOD_INTC == 1) + case CYGNUM_HAL_INTERRUPT_DMAC0_TE ... CYGNUM_HAL_ISR_MAX: +#elif (CYGARC_SH_MOD_INTC == 2) + case CYGNUM_HAL_INTERRUPT_DMAC0_DEI0 ... CYGNUM_HAL_ISR_MAX: +#else +# error "Cannot unmask for INTC" +#endif + cyg_hal_IMASK_table[vector] = 1; + hal_interrupt_update_level(vector); + break; + default: + CYG_FAIL("Unknown interrupt vector"); + break; + } +} + +void +hal_interrupt_acknowledge(int vector) +{ +#if (CYGARC_SH_MOD_INTC == 1) + if ( (vector) >= CYGNUM_HAL_INTERRUPT_IRQ_IRQ0 + && (vector) <= CYGNUM_HAL_INTERRUPT_IRQ_IRQ3) { + + cyg_uint8 irqcsr; + + HAL_READ_UINT8(CYGARC_REG_IRQCSR, irqcsr); + switch ( vector ) { +#ifndef CYGHWR_HAL_SH_IRQ_USE_IRQLVL + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ0: + irqcsr &= ~CYGARC_REG_IRQCSR_IRQ0F; + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ1: + irqcsr &= ~CYGARC_REG_IRQCSR_IRQ1F; + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ2: + irqcsr &= ~CYGARC_REG_IRQCSR_IRQ2F; + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ3: + irqcsr &= ~CYGARC_REG_IRQCSR_IRQ3F; + break; +#endif + default: + CYG_FAIL("Unhandled interrupt vector"); + } + HAL_WRITE_UINT8(CYGARC_REG_IRQCSR, irqcsr); + } +#elif (CYGARC_SH_MOD_INTC == 2) + if ( (vector) >= CYGNUM_HAL_INTERRUPT_IRQ_IRQ0 + && (vector) <= CYGNUM_HAL_INTERRUPT_IRQ_IRQ7) { + cyg_uint16 isr; + cyg_uint16 mask = ~(1<<(7-(vector - CYGNUM_HAL_INTERRUPT_IRQ_IRQ0))); + + HAL_READ_UINT16(CYGARC_REG_ISR, isr); + isr &= mask; + HAL_WRITE_UINT16(CYGARC_REG_ISR, isr); + } +#else +# error "No hal_interrupt_acknowledge code for this INTC" +#endif + + CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF(vector); +} + +void +hal_interrupt_configure(int vector, int level, int up) +{ +#ifndef CYGHWR_HAL_SH_IRQ_USE_IRQLVL +#if (CYGARC_SH_MOD_INTC == 1) + if ( (vector) >= CYGNUM_HAL_INTERRUPT_IRQ_IRQ0 + && (vector) <= CYGNUM_HAL_INTERRUPT_IRQ_IRQ3) { + + cyg_uint8 irqcsr, ss, mask; + ss = 0; + mask = CYGARC_REG_IRQCSR_IRQ_mask; + if (level) { + ss = CYGARC_REG_IRQCSR_IRQ_LOWLEVEL; + CYG_ASSERT(!(up), "Cannot trigger on high level!"); + } else { + if (up) + ss = CYGARC_REG_IRQCSR_IRQ_RISING; + else + ss = CYGARC_REG_IRQCSR_IRQ_FALLING; + } + + switch( (vector) ) { + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ3: + ss <<= CYGARC_REG_IRQCSR_IRQ3_shift; + mask <<= CYGARC_REG_IRQCSR_IRQ3_shift; + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ2: + ss <<= CYGARC_REG_IRQCSR_IRQ2_shift; + mask <<= CYGARC_REG_IRQCSR_IRQ2_shift; + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ1: + ss <<= CYGARC_REG_IRQCSR_IRQ1_shift; + mask <<= CYGARC_REG_IRQCSR_IRQ1_shift; + break; + case CYGNUM_HAL_INTERRUPT_IRQ_IRQ0: + ss <<= CYGARC_REG_IRQCSR_IRQ0_shift; + mask <<= CYGARC_REG_IRQCSR_IRQ0_shift; + break; + default: + CYG_FAIL("Unhandled interrupt vector"); + } + + HAL_READ_UINT8(CYGARC_REG_IRQCSR, irqcsr); + irqcsr &= ~mask; + irqcsr |= ss; + HAL_WRITE_UINT8(CYGARC_REG_IRQCSR, irqcsr); + } +#endif +#endif + + CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF(vector, level, up); +} + +//--------------------------------------------------------------------------- +void +hal_variant_init(void) +{ + HAL_CLOCK_VAR_INITIALIZE(CYGNUM_HAL_RTC_PERIOD); + + hal_interrupt_set_vectors(); +} + +//--------------------------------------------------------------------------- +// Low-level delay (in microseconds) + +#ifdef CYGARC_SH_MOD_FRT +void +hal_delay_us(int usecs) +{ + cyg_uint16 val1, val2; + cyg_int32 diff, clocks, wrap; + + /* Read compare A register */ + HAL_WRITE_UINT8(CYGARC_REG_TOCR, CYGARC_REG_TOCR_OLVLA); + HAL_READ_UINT16(CYGARC_REG_OCR, val1); + wrap = (cyg_int32)val1; + + clocks = CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED/CYGHWR_HAL_SH_RTC_PRESCALE/1000*usecs/1000; + + HAL_READ_UINT16(CYGARC_REG_FRC, val1); + while (clocks > 0) { + HAL_READ_UINT16(CYGARC_REG_FRC, val2); + + diff = (cyg_int32)val1 - (cyg_int32)val2; + if (diff > 0) + clocks += (diff-wrap); + else + clocks += diff; + + val1 = val2; + } +} +#elif defined(CYGARC_SH_MOD_CMT) +void +hal_delay_us(int usecs) +{ + cyg_uint16 val1, val2; + cyg_int32 diff, clocks, wrap; + + /* Read compare 0 register */ + HAL_READ_UINT16(CYGARC_REG_CMCOR0, val1); + wrap = (cyg_int32)val1; + + clocks = CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED/CYGHWR_HAL_SH_RTC_PRESCALE/1000*usecs/1000; + + HAL_READ_UINT16(CYGARC_REG_CMCNT0, val1); + while (clocks > 0) { + HAL_READ_UINT16(CYGARC_REG_CMCNT0, val2); + + diff = (cyg_int32)val1 - (cyg_int32)val2; + if (diff > 0) + clocks += (diff-wrap); + else + clocks += diff; + + val1 = val2; + } +} +#else +# error "No hal_delay_us implementation" +#endif + + +//--------------------------------------------------------------------------- +// End of hal_misc.c diff --git a/packages/hal/sh/sh2/current/src/var_mk_defs.c b/packages/hal/sh/sh2/current/src/var_mk_defs.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/src/var_mk_defs.c @@ -0,0 +1,101 @@ +//========================================================================== +// +// var_mk_defs.c +// +// HAL (variant) "make defs" program +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, jskov +// Date: 2002-01-16 +// Purpose: SH architecture dependent definition generator +// Description: This file contains code that can be compiled by the target +// compiler and used to generate machine specific definitions +// suitable for use in assembly code. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include + +#include // HAL header +#include // HAL header +#include // HAL header +#ifdef CYGPKG_KERNEL +# include +# include +#endif + +/* + * This program is used to generate definitions needed by + * assembly language modules. + * + * This technique was first used in the OSF Mach kernel code: + * generate asm statements containing #defines, + * compile this file to assembler, and then extract the + * #defines from the assembly-language output. + */ + +#define DEFINE(sym, val) \ + asm volatile("\n\t.equ\t" #sym ",%0" : : "i" (val)) + +int +main(void) +{ + // Caching details + DEFINE(HAL_UCACHE_SIZE, HAL_UCACHE_SIZE); + DEFINE(HAL_UCACHE_WAYS, HAL_UCACHE_WAYS); + DEFINE(HAL_UCACHE_LINE_SIZE, HAL_UCACHE_LINE_SIZE); + + // Interrupt details + DEFINE(CYGNUM_HAL_ISR_MAX, CYGNUM_HAL_ISR_MAX); + DEFINE(CYGNUM_HAL_INTERRUPT_LVL0, CYGNUM_HAL_INTERRUPT_LVL0); + DEFINE(CYGNUM_HAL_INTERRUPT_LVL_MAX, CYGNUM_HAL_INTERRUPT_LVL_MAX); +#ifdef CYGNUM_HAL_INTERRUPT_LVL14 + DEFINE(CYGNUM_HAL_INTERRUPT_LVL14, CYGNUM_HAL_INTERRUPT_LVL14); +#endif + DEFINE(CYGNUM_HAL_INTERRUPT_NMI, CYGNUM_HAL_INTERRUPT_NMI); + DEFINE(CYGNUM_HAL_VECTOR_TRAP, CYGNUM_HAL_VECTOR_TRAP); + DEFINE(CYGNUM_HAL_VECTOR_INTERRUPT, CYGNUM_HAL_VECTOR_INTERRUPT); + + return 0; +} + +//-------------------------------------------------------------------------- +// EOF var_mk_defs.c diff --git a/packages/hal/sh/sh2/current/src/variant.S b/packages/hal/sh/sh2/current/src/variant.S new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh2/current/src/variant.S @@ -0,0 +1,252 @@ +##========================================================================== +## +## variant.S +## +## SH2 variant assembly code +## +##========================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +##========================================================================== +#######DESCRIPTIONBEGIN#### +## +## Author(s): jskov +## Contributors: jskov +## Date: 2002-01-09 +## Purpose: SH2 misc assembly code +######DESCRIPTIONEND#### +## +##========================================================================== + +#include +#include + +#include +#include + +#include + +#--------------------------------------------------------------------------- +# Cache operations +# These need to be written in assembly to ensure they do not rely on data +# in cachable space (i.e., code must use registers exclusively, not the stack). + +#if (CYGARC_SH_MOD_CAC == 1) +# This macro must be used at the top of each cache function. It ensures +# that the code gets executed from a shadow region where caching is disabled +# (0x20000000). + .macro GOTO_NONCACHED_SHADOW + mova 10f,r0 + mov.l $MASK,r1 + and r1,r0 + mov.l $BASE,r1 + or r1,r0 + jmp @r0 + nop + .align 2 +10: + .endm + +FUNC_START(cyg_hal_cache_enable) + GOTO_NONCACHED_SHADOW + mov.l $CYGARC_REG_CCR,r1 + mov.b @r1,r0 + mov #CYGARC_REG_CCR_CE,r2 + or r2,r0 + mov.b r0,@r1 + nop + rts + nop + +FUNC_START(cyg_hal_cache_disable) + GOTO_NONCACHED_SHADOW + mov.l $CYGARC_REG_CCR,r1 + mov.b @r1,r0 + mov #CYGARC_REG_CCR_CE,r2 + not r2,r2 + and r2,r0 + mov.b r0,@r1 + nop + rts + nop + +# FIXME: Doc sez we need to disable cache before purging - but only to avoid +# messing with the instruction fetches. Since they happen via the non-cached +# reflection, try to make do without disable/contidional-enable. +FUNC_START(cyg_hal_cache_invalidate_all) + GOTO_NONCACHED_SHADOW + mov.l $CYGARC_REG_CCR,r1 + mov.b @r1,r0 + mov #CYGARC_REG_CCR_CP,r2 + or r2,r0 + mov.b r0,@r1 + nop ! Nothing in the docs suggest we need + nop ! nops here, but without them, the + nop ! CPU crashes. + rts + nop + +# Sync the cache by forcing read-misses twice for each line +# (doing it only once could leave dirty data if it happened +# to coincided with the "flush" area used) +FUNC_START(cyg_hal_cache_sync) + GOTO_NONCACHED_SHADOW + mov.l $CYGARC_REG_CACHE_ADDRESS_BASE,r1 + mov.l $CYGARC_REG_CACHE_ADDRESS_TOP,r2 + mov.l $CYGARC_REG_CACHE_ADDRESS_STEP,r3 +1: cmp/hi r1,r2 + bf 2f + mov.l @r1,r0 + bra 1b + add r3,r1 ! delay slot! +2: nop + rts + nop + +FUNC_START(cyg_hal_cache_write_mode) + GOTO_NONCACHED_SHADOW + # Mode argument in r4. + # Read current state and mask out the caching mode bit + mov.l $CYGARC_REG_CCR,r1 + mov.b @r1,r3 + mov #CYGARC_REG_CCR_WB,r2 + and r2,r4 + not r2,r2 + and r2,r3 + # Or in the new setting and restore to CCR + or r4,r3 + mov.b r3,@r1 + nop + rts + nop + + .align 2 +$CYGARC_REG_CACHE_ADDRESS_BASE: + .long 0 +$CYGARC_REG_CACHE_ADDRESS_TOP: + .long (HAL_UCACHE_SIZE*2) +$CYGARC_REG_CACHE_ADDRESS_STEP: + .long HAL_UCACHE_LINE_SIZE +$CYGARC_REG_CCR: + .long CYGARC_REG_CCR + +$MASK: + .long 0x1fffffff ! mask off top 3 bits +$BASE: + .long 0x20000000 ! base of non-cachable memory + +#elif (CYGARC_SH_MOD_CAC == 2) + +FUNC_START(cyg_hal_cache_enable) + mov.l $CYGARC_REG_CCR,r1 + mov.w @r1,r0 + mov #CYGARC_REG_CCR_CE,r2 + or r2,r0 + mov.w r0,@r1 + nop + rts + nop + +FUNC_START(cyg_hal_cache_disable) + mov.l $CYGARC_REG_CCR,r1 + mov.w @r1,r0 + mov #CYGARC_REG_CCR_CE,r2 + not r2,r2 + and r2,r0 + mov.w r0,@r1 + nop + rts + nop + +FUNC_START(cyg_hal_cache_invalidate_all) + mov.l $CYGARC_SH_MOD_CAC_CACHE_ADDRESS_ARRAY_BASE,r1 + mov.l $CYGARC_SH_MOD_CAC_CACHE_ADDRESS_ARRAY_TOP,r2 + mov #0,r0 +1: cmp/eq r1,r2 + bt 2f + mov.l r0,@r1 + bra 1b + add #4,r1 +2: nop + rts + nop + + .align 2 +$CYGARC_SH_MOD_CAC_CACHE_ADDRESS_ARRAY_BASE: + .long CYGARC_SH_MOD_CAC_CACHE_ADDRESS_ARRAY_BASE +$CYGARC_SH_MOD_CAC_CACHE_ADDRESS_ARRAY_TOP: + .long CYGARC_SH_MOD_CAC_CACHE_ADDRESS_ARRAY_TOP +$CYGARC_REG_CCR: + .long CYGARC_REG_CCR +#else +# error "No cache operators for INTC type" +#endif + .data + +SYM_DEF(cyg_hal_ILVL_table) + # The first entries in the table have static priorities. + + .byte 0xf // NMI + .byte 0xf // LVL0 + .byte 0xe // LVL1 + .byte 0xd // LVL2 + .byte 0xc // LVL3 + .byte 0xb // LVL4 + .byte 0xa // LVL5 + .byte 0x9 // LVL6 + .byte 0x8 // LVL7 +#ifdef CYGNUM_HAL_INTERRUPT_LVL14 + .byte 0x7 // LVL8 + .byte 0x6 // LVL9 + .byte 0x5 // LVL10 + .byte 0x4 // LVL11 + .byte 0x3 // LVL12 + .byte 0x2 // LVL13 + .byte 0x1 // LVL14 +#endif + + # The rest of the table consists of programmable levels, maintained + # by the HAL_INTERRUPT_SET_LEVEL macro. + # These default to the highest level so that a spurious + # interrupt cause the IPL to be suddenly lowered to allow all + # interrupts. This should give a better chance at tracking down + # the problem. + .rept (CYGNUM_HAL_ISR_MAX- CYGNUM_HAL_INTERRUPT_LVL_MAX) + .byte 0xf + .endr + + # All interrupts are masked initally. Set to 1 to enable. +SYM_DEF(cyg_hal_IMASK_table) + .rept (CYGNUM_HAL_ISR_MAX) + .byte 0x0 + .endr diff --git a/packages/hal/sh/sh3/current/ChangeLog b/packages/hal/sh/sh3/current/ChangeLog --- a/packages/hal/sh/sh3/current/ChangeLog +++ b/packages/hal/sh/sh3/current/ChangeLog @@ -1,3 +1,27 @@ +2002-05-08 Jesper Skov + + * src/sh3_sci.c: Register renaming. + * src/sh3_scif.c: Register renaming. + + * include/mod_regs_ser.h: Register renaming. SCI registers now + contain _SCI_, SCIF registers contain _SCIF_. Merge SCIF and IrDA + definitions (stripping SCIF identifier suffix). + +2002-01-17 Jesper Skov + + * include/variant.inc (hal_intc_decode): include needed ptrs. + +2002-01-16 Jesper Skov + + * cdl/hal_sh_sh3.cdl: Added interrupt model header definition. + Added RTC_PRESCALE option. + +2002-01-14 Jesper Skov + + * cdl/hal_sh_sh3.cdl: Added exception model header definitions. + + * include/variant.inc: Fixed assembler warning. + 2001-10-15 Jesper Skov * include/mod_7709r.h: Added. I don't know if the module content @@ -55,9 +79,18 @@ 2001-07-18 Jesper Skov + * include/sd0001.h: Even more definitions. * include/var_intr.h: Allow platforms to extend vector table. * src/var_misc.c: Same. +2001-06-26 Jesper Skov + + * include/sd0001.h: Added more definitions. + +2001-06-25 Jesper Skov + + * include/sd0001.h: Definitions for IO access. + 2001-06-19 Jesper Skov * include/mod_regs_ubc.h: Allow MOD_UBC to be unset. @@ -71,6 +104,10 @@ 2001-05-29 Jesper Skov + + * include/mod_7729.h: Also include SD0001 header. + 2001-02-28 Jesper Skov * src/variant.S (cyg_hal_cache_enable): Write ORed value, not just @@ -147,27 +184,36 @@ 2000-08-15 Haruki Kashiwaya " + puts $::cdl_header "#define CYGBLD_HAL_VAR_EXCEPTION_MODEL_H " + puts $::cdl_header "#define CYGBLD_HAL_VAR_EXCEPTION_MODEL_INC " + puts $::cdl_header "#define CYGBLD_HAL_VAR_INTR_MODEL_H " } compile sh3_sci.c sh3_scif.c var_misc.c variant.S @@ -218,6 +230,11 @@ cdl_package CYGPKG_HAL_SH_SH3 { default_value 4 } + cdl_option CYGHWR_HAL_SH_RTC_PRESCALE { + display "eCos RTC prescaling" + flavor data + calculated CYGHWR_HAL_SH_TMU_PRESCALE_0 + } cdl_option CYGHWR_HAL_SH_CLOCK_CKIO { display "CKIO clock" diff --git a/packages/hal/sh/sh3/current/include/mod_7707a.h b/packages/hal/sh/sh3/current/include/mod_7707a.h --- a/packages/hal/sh/sh3/current/include/mod_7707a.h +++ b/packages/hal/sh/sh3/current/include/mod_7707a.h @@ -8,29 +8,38 @@ // List modules available on CPU // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_7708.h b/packages/hal/sh/sh3/current/include/mod_7708.h --- a/packages/hal/sh/sh3/current/include/mod_7708.h +++ b/packages/hal/sh/sh3/current/include/mod_7708.h @@ -8,29 +8,38 @@ // List modules available on CPU // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_7709a.h b/packages/hal/sh/sh3/current/include/mod_7709a.h --- a/packages/hal/sh/sh3/current/include/mod_7709a.h +++ b/packages/hal/sh/sh3/current/include/mod_7709a.h @@ -8,29 +8,38 @@ // List modules available on CPU // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_7709r.h b/packages/hal/sh/sh3/current/include/mod_7709r.h --- a/packages/hal/sh/sh3/current/include/mod_7709r.h +++ b/packages/hal/sh/sh3/current/include/mod_7709r.h @@ -8,29 +8,38 @@ // List modules available on CPU // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_7709s.h b/packages/hal/sh/sh3/current/include/mod_7709s.h --- a/packages/hal/sh/sh3/current/include/mod_7709s.h +++ b/packages/hal/sh/sh3/current/include/mod_7709s.h @@ -8,29 +8,38 @@ // List modules available on CPU // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_7729.h b/packages/hal/sh/sh3/current/include/mod_7729.h --- a/packages/hal/sh/sh3/current/include/mod_7729.h +++ b/packages/hal/sh/sh3/current/include/mod_7729.h @@ -8,29 +8,38 @@ // List modules available on CPU // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -58,6 +67,9 @@ #define CYGARC_SH_MOD_UBC 2 +#define CYGARC_SH_SD0001 // Support chip +#include + //----------------------------------------------------------------------------- // Extra details for Cache Module (CAC) diff --git a/packages/hal/sh/sh3/current/include/mod_regs_bsc.h b/packages/hal/sh/sh3/current/include/mod_regs_bsc.h --- a/packages/hal/sh/sh3/current/include/mod_regs_bsc.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_bsc.h @@ -5,29 +5,38 @@ // BSC (bus state controller) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_regs_cac.h b/packages/hal/sh/sh3/current/include/mod_regs_cac.h --- a/packages/hal/sh/sh3/current/include/mod_regs_cac.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_cac.h @@ -5,29 +5,38 @@ // CAC (cache) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_regs_cpg.h b/packages/hal/sh/sh3/current/include/mod_regs_cpg.h --- a/packages/hal/sh/sh3/current/include/mod_regs_cpg.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_cpg.h @@ -5,29 +5,38 @@ // CPG (clock pulse generator) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_regs_dma.h b/packages/hal/sh/sh3/current/include/mod_regs_dma.h --- a/packages/hal/sh/sh3/current/include/mod_regs_dma.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_dma.h @@ -5,29 +5,38 @@ // DMA (direct memory access) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_regs_intc.h b/packages/hal/sh/sh3/current/include/mod_regs_intc.h --- a/packages/hal/sh/sh3/current/include/mod_regs_intc.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_intc.h @@ -5,29 +5,38 @@ // INTC (interrupt controller) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_regs_mmu.h b/packages/hal/sh/sh3/current/include/mod_regs_mmu.h --- a/packages/hal/sh/sh3/current/include/mod_regs_mmu.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_mmu.h @@ -5,29 +5,38 @@ // MMU Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_regs_pfc.h b/packages/hal/sh/sh3/current/include/mod_regs_pfc.h --- a/packages/hal/sh/sh3/current/include/mod_regs_pfc.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_pfc.h @@ -5,29 +5,38 @@ // PFC (pin function controller) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_regs_rtc.h b/packages/hal/sh/sh3/current/include/mod_regs_rtc.h --- a/packages/hal/sh/sh3/current/include/mod_regs_rtc.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_rtc.h @@ -5,29 +5,38 @@ // RTC (real time clock) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_regs_ser.h b/packages/hal/sh/sh3/current/include/mod_regs_ser.h --- a/packages/hal/sh/sh3/current/include/mod_regs_ser.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_ser.h @@ -5,29 +5,38 @@ // SCI, SCIF, and IRDA (serial) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -44,52 +53,52 @@ //-------------------------------------------------------------------------- // Serial registers. All 8 bit registers. -#define CYGARC_REG_SCSMR 0xfffffe80 // serial mode register -#define CYGARC_REG_SCBRR 0xfffffe82 // bit rate register -#define CYGARC_REG_SCSCR 0xfffffe84 // serial control register -#define CYGARC_REG_SCTDR 0xfffffe86 // transmit data register -#define CYGARC_REG_SCSSR 0xfffffe88 // serial status register -#define CYGARC_REG_SCRDR 0xfffffe8a // receive data register +#define CYGARC_REG_SCI_SCSMR 0xfffffe80 // serial mode register +#define CYGARC_REG_SCI_SCBRR 0xfffffe82 // bit rate register +#define CYGARC_REG_SCI_SCSCR 0xfffffe84 // serial control register +#define CYGARC_REG_SCI_SCTDR 0xfffffe86 // transmit data register +#define CYGARC_REG_SCI_SCSSR 0xfffffe88 // serial status register +#define CYGARC_REG_SCI_SCRDR 0xfffffe8a // receive data register // Serial Mode Register -#define CYGARC_REG_SCSMR_CA 0x80 // communication mode -#define CYGARC_REG_SCSMR_CHR 0x40 // character length (7 if set) -#define CYGARC_REG_SCSMR_PE 0x20 // parity enable -#define CYGARC_REG_SCSMR_OE 0x10 // parity mode -#define CYGARC_REG_SCSMR_STOP 0x08 // stop bit length -#define CYGARC_REG_SCSMR_MP 0x04 // multiprocessor mode -#define CYGARC_REG_SCSMR_CKS1 0x02 // clock select 1 -#define CYGARC_REG_SCSMR_CKS0 0x01 // clock select 0 -#define CYGARC_REG_SCSMR_CKSx_MASK 0x03 // mask +#define CYGARC_REG_SCI_SCSMR_CA 0x80 // communication mode +#define CYGARC_REG_SCI_SCSMR_CHR 0x40 // character length (7 if set) +#define CYGARC_REG_SCI_SCSMR_PE 0x20 // parity enable +#define CYGARC_REG_SCI_SCSMR_OE 0x10 // parity mode +#define CYGARC_REG_SCI_SCSMR_STOP 0x08 // stop bit length +#define CYGARC_REG_SCI_SCSMR_MP 0x04 // multiprocessor mode +#define CYGARC_REG_SCI_SCSMR_CKS1 0x02 // clock select 1 +#define CYGARC_REG_SCI_SCSMR_CKS0 0x01 // clock select 0 +#define CYGARC_REG_SCI_SCSMR_CKSx_MASK 0x03 // mask // Serial Control Register -#define CYGARC_REG_SCSCR_TIE 0x80 // transmit interrupt enable -#define CYGARC_REG_SCSCR_RIE 0x40 // receive interrupt enable -#define CYGARC_REG_SCSCR_TE 0x20 // transmit enable -#define CYGARC_REG_SCSCR_RE 0x10 // receive enable -#define CYGARC_REG_SCSCR_MPIE 0x08 // multiprocessor interrupt enable -#define CYGARC_REG_SCSCR_TEIE 0x04 // transmit-end interrupt enable -#define CYGARC_REG_SCSCR_CKE1 0x02 // clock enable 1 -#define CYGARC_REG_SCSCR_CKE0 0x01 // clock enable 0 +#define CYGARC_REG_SCI_SCSCR_TIE 0x80 // transmit interrupt enable +#define CYGARC_REG_SCI_SCSCR_RIE 0x40 // receive interrupt enable +#define CYGARC_REG_SCI_SCSCR_TE 0x20 // transmit enable +#define CYGARC_REG_SCI_SCSCR_RE 0x10 // receive enable +#define CYGARC_REG_SCI_SCSCR_MPIE 0x08 // multiprocessor interrupt enable +#define CYGARC_REG_SCI_SCSCR_TEIE 0x04 // transmit-end interrupt enable +#define CYGARC_REG_SCI_SCSCR_CKE1 0x02 // clock enable 1 +#define CYGARC_REG_SCI_SCSCR_CKE0 0x01 // clock enable 0 // Serial Status Register -#define CYGARC_REG_SCSSR_TDRE 0x80 // transmit data register empty -#define CYGARC_REG_SCSSR_RDRF 0x40 // receive data register full -#define CYGARC_REG_SCSSR_ORER 0x20 // overrun error -#define CYGARC_REG_SCSSR_FER 0x10 // framing error -#define CYGARC_REG_SCSSR_PER 0x08 // parity error -#define CYGARC_REG_SCSSR_TEND 0x04 // transmit end -#define CYGARC_REG_SCSSR_MPB 0x02 // multiprocessor bit -#define CYGARC_REG_SCSSR_MPBT 0x01 // multiprocessor bit transfer +#define CYGARC_REG_SCI_SCSSR_TDRE 0x80 // transmit data register empty +#define CYGARC_REG_SCI_SCSSR_RDRF 0x40 // receive data register full +#define CYGARC_REG_SCI_SCSSR_ORER 0x20 // overrun error +#define CYGARC_REG_SCI_SCSSR_FER 0x10 // framing error +#define CYGARC_REG_SCI_SCSSR_PER 0x08 // parity error +#define CYGARC_REG_SCI_SCSSR_TEND 0x04 // transmit end +#define CYGARC_REG_SCI_SCSSR_MPB 0x02 // multiprocessor bit +#define CYGARC_REG_SCI_SCSSR_MPBT 0x01 // multiprocessor bit transfer // When clearing the status register, always write the value: // CYGARC_REG_SCSSR_CLEARMASK & ~bit // to prevent other bits than the one of interest to be cleared. -#define CYGARC_REG_SCSSR_CLEARMASK 0xf8 +#define CYGARC_REG_SCI_SCSSR_CLEARMASK 0xf8 #if (CYGARC_SH_MOD_SCI >= 2) -# define CYGARC_REG_SCSPTR 0xfffffe7c // serial port register +# define CYGARC_REG_SCI_SCSPTR 0xfffffe7c // serial port register #endif @@ -126,157 +135,96 @@ (((CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED+CYGARC_SCBRR_ROUNDING(_b_))/32/CYGARC_SCBRR_PRESCALE(_b_)/(_b_))-1)) -//++++++ Module IRDA +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -#ifdef CYGARC_SH_MOD_IRDA - -//-------------------------------------------------------------------------- -// IrDA (infrared data association). Can also act as regular serial w FIFO - -#define CYGARC_REG_SCSMR1 0xa4000140 -#define CYGARC_REG_SCBRR1 0xa4000142 -#define CYGARC_REG_SCSCR1 0xa4000144 -#define CYGARC_REG_SCFTDR1 0xa4000146 -#define CYGARC_REG_SCSSR1 0xa4000148 -#define CYGARC_REG_SCFRDR1 0xa400014a -#define CYGARC_REG_SCFCR1 0xa400014c -#define CYGARC_REG_SCFDR1 0xa400014e - -// Serial Mode Register -#define CYGARC_REG_SCSMR1_IRMOD 0x80 // IrDA Mode -#define CYGARC_REG_SCSMR1_ICK_MASK 0x78 // IR pulse width -#define CYGARC_REG_SCSMR1_PSEL 0x04 // IR pulse selector(?) -#define CYGARC_REG_SCSMR1_CKS1 0x02 // clock select 1 -#define CYGARC_REG_SCSMR1_CKS0 0x01 // clock select 0 -#define CYGARC_REG_SCSMR1_CKSx_MASK 0x03 // mask - -// Serial Control Register -#define CYGARC_REG_SCSCR1_TIE 0x80 // transmit interrupt enable -#define CYGARC_REG_SCSCR1_RIE 0x40 // receive interrupt enable -#define CYGARC_REG_SCSCR1_TE 0x20 // transmit enable -#define CYGARC_REG_SCSCR1_RE 0x10 // receive enable -#define CYGARC_REG_SCSCR1_CKE1 0x02 // clock enable 1 -#define CYGARC_REG_SCSCR1_CKE0 0x01 // clock enable 0 - -// Serial Status Register -#define CYGARC_REG_SCSSR1_PER_MASK 0xf000 // number of parity errors -#define CYGARC_REG_SCSSR1_PER_shift 12 -#define CYGARC_REG_SCSSR1_FER_MASK 0x0f00 // number of framing errors -#define CYGARC_REG_SCSSR1_FER_shift 8 -#define CYGARC_REG_SCSSR1_ER 0x0080 // receive error -#define CYGARC_REG_SCSSR1_TEND 0x0040 // transmit end -#define CYGARC_REG_SCSSR1_TDFE 0x0020 // transmit fifo data empty -#define CYGARC_REG_SCSSR1_BRK 0x0010 // break detection -#define CYGARC_REG_SCSSR1_FER 0x0008 // framing error -#define CYGARC_REG_SCSSR1_PER 0x0004 // parity error -#define CYGARC_REG_SCSSR1_RDF 0x0002 // receive fifo data full -#define CYGARC_REG_SCSSR1_DR 0x0001 // receive data ready - -// When clearing the status register, always write the value: -// CYGARC_REG_SCSSR2_CLEARMASK & ~bit -// to prevent other bits than the one of interest to be cleared. -#define CYGARC_REG_SCSSR1_CLEARMASK 0x00f3 - -// Serial FIFO Control Register -#define CYGARC_REG_SCFCR1_RTRG_MASK 0xc0 // receive fifo data trigger -#define CYGARC_REG_SCFCR1_RTRG_1 0x00 // trigger on 1 char -#define CYGARC_REG_SCFCR1_RTRG_4 0x40 // trigger on 4 chars -#define CYGARC_REG_SCFCR1_RTRG_8 0x80 // trigger on 8 chars -#define CYGARC_REG_SCFCR1_RTRG_14 0xc0 // trigger on 14 chars - -#define CYGARC_REG_SCFCR1_TTRG_MASK 0x30 // transmit fifo data trigger -#define CYGARC_REG_SCFCR1_TTRG_8 0x00 // trigger on 8 chars -#define CYGARC_REG_SCFCR1_TTRG_4 0x10 // trigger on 4 chars -#define CYGARC_REG_SCFCR1_TTRG_2 0x20 // trigger on 2 chars -#define CYGARC_REG_SCFCR1_TTRG_1 0x30 // trigger on 1 char - -#define CYGARC_REG_SCFCR1_MCE 0x08 // modem control enable -#define CYGARC_REG_SCFCR1_TFRST 0x04 // transmit fifo reset -#define CYGARC_REG_SCFCR1_RFRST 0x02 // receive fifo reset -#define CYGARC_REG_SCFCR1_LOOP 0x01 // loop back test - - -// Serial FIFO Data Count Set Register -#define CYGARC_REG_SCFDR1_RCOUNT_MASK 0x001f // number of chars in r fifo -#define CYGARC_REG_SCFDR1_RCOUNT_shift 0 -#define CYGARC_REG_SCFDR1_TCOUNT_MASK 0x1f00 // number of chars in t fifo -#define CYGARC_REG_SCFDR1_TCOUNT_shift 8 - -#endif // CYGARC_SH_MOD_IRDA - //++++++ Module SCIF +++++++++++++++++++++++++++++++++++++++++++++++++++++++ #ifdef CYGARC_SH_MOD_SCIF //-------------------------------------------------------------------------- -// Serial w FIFO registers +// Serial w FIFO registers (and IRDA) + +// SCIF1 +#define CYGARC_REG_SCIF_SCSMR1 0xa4000140 // Serial mode +#define CYGARC_REG_SCIF_SCBRR1 0xa4000142 // Bit rate +#define CYGARC_REG_SCIF_SCSCR1 0xa4000144 // Serial control +#define CYGARC_REG_SCIF_SCFTDR1 0xa4000146 // Transmit FIFO data +#define CYGARC_REG_SCIF_SCSSR1 0xa4000148 // Serial status +#define CYGARC_REG_SCIF_SCFRDR1 0xa400014a // Receive data FIFO +#define CYGARC_REG_SCIF_SCFCR1 0xa400014c // FIFO control register +#define CYGARC_REG_SCIF_SCFDR1 0xa400014e // FIFO data count set -#define CYGARC_REG_SCSMR2 0xa4000150 // Serial mode -#define CYGARC_REG_SCBRR2 0xa4000152 // Bit rate -#define CYGARC_REG_SCSCR2 0xa4000154 // Serial control -#define CYGARC_REG_SCFTDR2 0xa4000156 // Transmit FIFO data -#define CYGARC_REG_SCSSR2 0xa4000158 // Serial status -#define CYGARC_REG_SCFRDR2 0xa400015a // Receive data FIFO -#define CYGARC_REG_SCFCR2 0xa400015c // FIFO control register -#define CYGARC_REG_SCFDR2 0xa400015e // FIFO data count set +// SCIF2 +#define CYGARC_REG_SCIF_SCSMR2 0xa4000150 // Serial mode +#define CYGARC_REG_SCIF_SCBRR2 0xa4000152 // Bit rate +#define CYGARC_REG_SCIF_SCSCR2 0xa4000154 // Serial control +#define CYGARC_REG_SCIF_SCFTDR2 0xa4000156 // Transmit FIFO data +#define CYGARC_REG_SCIF_SCSSR2 0xa4000158 // Serial status +#define CYGARC_REG_SCIF_SCFRDR2 0xa400015a // Receive data FIFO +#define CYGARC_REG_SCIF_SCFCR2 0xa400015c // FIFO control register +#define CYGARC_REG_SCIF_SCFDR2 0xa400015e // FIFO data count set + -// Serial Mode Register -#define CYGARC_REG_SCSMR2_CHR 0x40 // character length (7 if set) -#define CYGARC_REG_SCSMR2_PE 0x20 // parity enable -#define CYGARC_REG_SCSMR2_OE 0x10 // parity mode -#define CYGARC_REG_SCSMR2_STOP 0x08 // stop bit length -#define CYGARC_REG_SCSMR2_CKS1 0x02 // clock select 1 -#define CYGARC_REG_SCSMR2_CKS0 0x01 // clock select 0 -#define CYGARC_REG_SCSMR2_CKSx_MASK 0x03 // mask +// Serial Mode Register - normal mode +#define CYGARC_REG_SCIF_SCSMR_CHR 0x40 // character length (7 if set) +#define CYGARC_REG_SCIF_SCSMR_PE 0x20 // parity enable +#define CYGARC_REG_SCIF_SCSMR_OE 0x10 // parity mode +#define CYGARC_REG_SCIF_SCSMR_STOP 0x08 // stop bit length +#define CYGARC_REG_SCIF_SCSMR_CKS1 0x02 // clock select 1 +#define CYGARC_REG_SCIF_SCSMR_CKS0 0x01 // clock select 0 +#define CYGARC_REG_SCIF_SCSMR_CKSx_MASK 0x03 // mask + +// Serial Mode Register - IrDA mode alternative definitions +#define CYGARC_REG_SCIF_SCSMR_IRMOD 0x80 // IrDA Mode +#define CYGARC_REG_SCIF_SCSMR_ICK_MASK 0x78 // IR pulse width +#define CYGARC_REG_SCIF_SCSMR_PSEL 0x04 // IR pulse selector(?) // Serial Control Register -#define CYGARC_REG_SCSCR2_TIE 0x80 // transmit interrupt enable -#define CYGARC_REG_SCSCR2_RIE 0x40 // receive interrupt enable -#define CYGARC_REG_SCSCR2_TE 0x20 // transmit enable -#define CYGARC_REG_SCSCR2_RE 0x10 // receive enable -#define CYGARC_REG_SCSCR2_CKE1 0x02 // clock enable 1 -#define CYGARC_REG_SCSCR2_CKE0 0x01 // clock enable 0 +#define CYGARC_REG_SCIF_SCSCR_TIE 0x80 // transmit interrupt enable +#define CYGARC_REG_SCIF_SCSCR_RIE 0x40 // receive interrupt enable +#define CYGARC_REG_SCIF_SCSCR_TE 0x20 // transmit enable +#define CYGARC_REG_SCIF_SCSCR_RE 0x10 // receive enable +#define CYGARC_REG_SCIF_SCSCR_CKE1 0x02 // clock enable 1 +#define CYGARC_REG_SCIF_SCSCR_CKE0 0x01 // clock enable 0 // Serial Status Register -#define CYGARC_REG_SCSSR2_PER_MASK 0xf000 // number of parity errors -#define CYGARC_REG_SCSSR2_PER_shift 12 -#define CYGARC_REG_SCSSR2_FER_MASK 0x0f00 // number of framing errors -#define CYGARC_REG_SCSSR2_FER_shift 8 -#define CYGARC_REG_SCSSR2_ER 0x0080 // receive error -#define CYGARC_REG_SCSSR2_TEND 0x0040 // transmit end -#define CYGARC_REG_SCSSR2_TDFE 0x0020 // transmit fifo data empty -#define CYGARC_REG_SCSSR2_BRK 0x0010 // break detection -#define CYGARC_REG_SCSSR2_FER 0x0008 // framing error -#define CYGARC_REG_SCSSR2_PER 0x0004 // parity error -#define CYGARC_REG_SCSSR2_RDF 0x0002 // receive fifo data full -#define CYGARC_REG_SCSSR2_DR 0x0001 // receive data ready +#define CYGARC_REG_SCIF_SCSSR_PER_MASK 0xf000 // number of parity errors +#define CYGARC_REG_SCIF_SCSSR_PER_shift 12 +#define CYGARC_REG_SCIF_SCSSR_FER_MASK 0x0f00 // number of framing errors +#define CYGARC_REG_SCIF_SCSSR_FER_shift 8 +#define CYGARC_REG_SCIF_SCSSR_ER 0x0080 // receive error +#define CYGARC_REG_SCIF_SCSSR_TEND 0x0040 // transmit end +#define CYGARC_REG_SCIF_SCSSR_TDFE 0x0020 // transmit fifo data empty +#define CYGARC_REG_SCIF_SCSSR_BRK 0x0010 // break detection +#define CYGARC_REG_SCIF_SCSSR_FER 0x0008 // framing error +#define CYGARC_REG_SCIF_SCSSR_PER 0x0004 // parity error +#define CYGARC_REG_SCIF_SCSSR_RDF 0x0002 // receive fifo data full +#define CYGARC_REG_SCIF_SCSSR_DR 0x0001 // receive data ready // When clearing the status register, always write the value: -// CYGARC_REG_SCSSR2_CLEARMASK & ~bit +// CYGARC_REG_SCSSR_CLEARMASK & ~bit // to prevent other bits than the one of interest to be cleared. -#define CYGARC_REG_SCSSR2_CLEARMASK 0x00f3 +#define CYGARC_REG_SCIF_SCSSR_CLEARMASK 0x00f3 // Serial FIFO Control Register -#define CYGARC_REG_SCFCR2_RTRG_MASK 0xc0 // receive fifo data trigger -#define CYGARC_REG_SCFCR2_RTRG_1 0x00 // trigger on 1 char -#define CYGARC_REG_SCFCR2_RTRG_4 0x40 // trigger on 4 chars -#define CYGARC_REG_SCFCR2_RTRG_8 0x80 // trigger on 8 chars -#define CYGARC_REG_SCFCR2_RTRG_14 0xc0 // trigger on 14 chars +#define CYGARC_REG_SCIF_SCFCR_RTRG_MASK 0xc0 // receive fifo data trigger +#define CYGARC_REG_SCIF_SCFCR_RTRG_1 0x00 // trigger on 1 char +#define CYGARC_REG_SCIF_SCFCR_RTRG_4 0x40 // trigger on 4 chars +#define CYGARC_REG_SCIF_SCFCR_RTRG_8 0x80 // trigger on 8 chars +#define CYGARC_REG_SCIF_SCFCR_RTRG_14 0xc0 // trigger on 14 chars -#define CYGARC_REG_SCFCR2_TTRG_MASK 0x30 // transmit fifo data trigger -#define CYGARC_REG_SCFCR2_TTRG_8 0x00 // trigger on 8 chars -#define CYGARC_REG_SCFCR2_TTRG_4 0x10 // trigger on 4 chars -#define CYGARC_REG_SCFCR2_TTRG_2 0x20 // trigger on 2 chars -#define CYGARC_REG_SCFCR2_TTRG_1 0x30 // trigger on 1 char +#define CYGARC_REG_SCIF_SCFCR_TTRG_MASK 0x30 // transmit fifo data trigger +#define CYGARC_REG_SCIF_SCFCR_TTRG_8 0x00 // trigger on 8 chars +#define CYGARC_REG_SCIF_SCFCR_TTRG_4 0x10 // trigger on 4 chars +#define CYGARC_REG_SCIF_SCFCR_TTRG_2 0x20 // trigger on 2 chars +#define CYGARC_REG_SCIF_SCFCR_TTRG_1 0x30 // trigger on 1 char -#define CYGARC_REG_SCFCR2_MCE 0x08 // modem control enable -#define CYGARC_REG_SCFCR2_TFRST 0x04 // transmit fifo reset -#define CYGARC_REG_SCFCR2_RFRST 0x02 // receive fifo reset -#define CYGARC_REG_SCFCR2_LOOP 0x01 // loop back test - +#define CYGARC_REG_SCIF_SCFCR_MCE 0x08 // modem control enable +#define CYGARC_REG_SCIF_SCFCR_TFRST 0x04 // transmit fifo reset +#define CYGARC_REG_SCIF_SCFCR_RFRST 0x02 // receive fifo reset +#define CYGARC_REG_SCIF_SCFCR_LOOP 0x01 // loop back test // Serial FIFO Data Count Set Register -#define CYGARC_REG_SCFDR2_RCOUNT_MASK 0x001f // number of chars in r fifo -#define CYGARC_REG_SCFDR2_RCOUNT_shift 0 -#define CYGARC_REG_SCFDR2_TCOUNT_MASK 0x1f00 // number of chars in t fifo -#define CYGARC_REG_SCFDR2_TCOUNT_shift 8 +#define CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK 0x001f // number of chars in r fifo +#define CYGARC_REG_SCIF_SCFDR_RCOUNT_shift 0 +#define CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK 0x1f00 // number of chars in t fifo +#define CYGARC_REG_SCIF_SCFDR_TCOUNT_shift 8 -#endif // CYGARC_SH_MOD_SCIF +#endif /* CYGARC_SH_MOD_SCIF */ diff --git a/packages/hal/sh/sh3/current/include/mod_regs_tmu.h b/packages/hal/sh/sh3/current/include/mod_regs_tmu.h --- a/packages/hal/sh/sh3/current/include/mod_regs_tmu.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_tmu.h @@ -5,29 +5,38 @@ // TMU (timer unit) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/mod_regs_ubc.h b/packages/hal/sh/sh3/current/include/mod_regs_ubc.h --- a/packages/hal/sh/sh3/current/include/mod_regs_ubc.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_ubc.h @@ -5,29 +5,38 @@ // UBC (user break controller) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/sd0001.h b/packages/hal/sh/sh3/current/include/sd0001.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh3/current/include/sd0001.h @@ -0,0 +1,133 @@ +#ifndef CYGONCE_HAL_SD0001_H +#define CYGONCE_HAL_SD0001_H + +//============================================================================= +// +// sd0001.h +// +// SD0001 support chip - used with SH/7729 +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-05-25 +// Purpose: Support chip +// Usage: Included from +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= +#ifndef _SD0001_BASE +# define _SD0001_BASE 0xb0000000 +#endif + +//----------------------------------------------------------------------------- +// System configuration +#define CYGARC_REG_SD0001_RESET (_SD0001_BASE + 0x08) +#define CYGARC_REG_SD0001_SDRAM (_SD0001_BASE + 0x10) +#define CYGARC_REG_SD0001_INT_STS1 (_SD0001_BASE + 0x20) +#define CYGARC_REG_SD0001_INT_ENABLE (_SD0001_BASE + 0x24) +#define CYGARC_REG_SD0001_INT_STS2 (_SD0001_BASE + 0x28) +#define CYGARC_REG_SD0001_PCI_CTL (_SD0001_BASE + 0x50) + +#define CYGARC_REG_PCI_IO_MEMOFFSET (_SD0001_BASE + 0x58) +#define CYGARC_REG_PCI_MEM_MEMOFFSET (_SD0001_BASE + 0x5c) + + +#define CYGARC_REG_PCI_CFG_ADDR (_SD0001_BASE + 0x60) +#define CYGARC_REG_PCI_CFG_DATA (_SD0001_BASE + 0x64) +#define CYGARC_REG_PCI_CFG_CMD (_SD0001_BASE + 0x68) +#define CYGARC_REG_PCI_CFG_FLG (_SD0001_BASE + 0x6c) + +#define CYGARC_REG_PCI_CFG_ADDR_ENABLE 0x80000000 +#define CYGARC_REG_PCI_CFG_ADDR_BUSNO_shift 16 +#define CYGARC_REG_PCI_CFG_ADDR_FUNC_shift 8 + +#define CYGARC_REG_PCI_CFG_CMD_BE3 0x00080000 +#define CYGARC_REG_PCI_CFG_CMD_BE2 0x00040000 +#define CYGARC_REG_PCI_CFG_CMD_BE1 0x00020000 +#define CYGARC_REG_PCI_CFG_CMD_BE0 0x00010000 + +#define CYGARC_REG_PCI_CFG_CMD_CMDEN 0x00008000 + +#define CYGARC_REG_PCI_CFG_CMD_IO_WRITE 0x00000300 +#define CYGARC_REG_PCI_CFG_CMD_IO_READ 0x00000200 + +#define CYGARC_REG_PCI_CFG_CMD_WT 0x00000008 +#define CYGARC_REG_PCI_CFG_CMD_RD 0x00000004 +#define CYGARC_REG_PCI_CFG_CMD_CFWT 0x00000002 +#define CYGARC_REG_PCI_CFG_CMD_CFRD 0x00000001 + + +#define CYGARC_REG_PCI_CFG_CMD_WCFG (CYGARC_REG_PCI_CFG_CMD_BE3|CYGARC_REG_PCI_CFG_CMD_BE2|CYGARC_REG_PCI_CFG_CMD_BE1|CYGARC_REG_PCI_CFG_CMD_BE0|CYGARC_REG_PCI_CFG_CMD_CFWT) +#define CYGARC_REG_PCI_CFG_CMD_RCFG (CYGARC_REG_PCI_CFG_CMD_BE3|CYGARC_REG_PCI_CFG_CMD_BE2|CYGARC_REG_PCI_CFG_CMD_BE1|CYGARC_REG_PCI_CFG_CMD_BE0|CYGARC_REG_PCI_CFG_CMD_CFRD) + + + +#define CYGARC_REG_SD0001_PCI_CTL_ENDIAN2 0x40000000 +#define CYGARC_REG_SD0001_PCI_CTL_MAX_DEADLOCK_CNT 0x0000ff00 +#define CYGARC_REG_SD0001_PCI_CTL_MAX_RETRY_CNT 0x000000f0 + + +#define CYGARC_REG_PCI_CFG_FLG_ACTIVE 0x00000001 + + +#define CYGARC_REG_SD0001_RESET_SWRST 0x80000000 +#define CYGARC_REG_SD0001_RESET_PCIRST 0x40000000 + + +#define CYGARC_REG_SD0001_SDRAM_SDKIND_128M 0x80000000 +#define CYGARC_REG_SD0001_SDRAM_SDSIZE_8 0x10000000 +#define CYGARC_REG_SD0001_SDRAM_REF_MUMBLE 0x00008000 +#define CYGARC_REG_SD0001_SDRAM_LMODE_CAS2 0x00000010 + +#define CYGARC_REG_SD0001_SDRAM_INIT (CYGARC_REG_SD0001_SDRAM_SDKIND_128M\ + |CYGARC_REG_SD0001_SDRAM_SDSIZE_8\ + |CYGARC_REG_SD0001_SDRAM_REF_MUMBLE\ + |CYGARC_REG_SD0001_SDRAM_LMODE_CAS2) + + +#define CYGARC_REG_SD0001_INT_EN 0x80000000 +#define CYGARC_REG_SD0001_INT_INTD 0x00000008 +#define CYGARC_REG_SD0001_INT_INTC 0x00000004 +#define CYGARC_REG_SD0001_INT_INTB 0x00000002 +#define CYGARC_REG_SD0001_INT_INTA 0x00000001 + + +#endif // CYGONCE_HAL_SD0001_H diff --git a/packages/hal/sh/sh3/current/include/sh3_sci.h b/packages/hal/sh/sh3/current/include/sh3_sci.h --- a/packages/hal/sh/sh3/current/include/sh3_sci.h +++ b/packages/hal/sh/sh3/current/include/sh3_sci.h @@ -5,29 +5,38 @@ // Simple driver for the SH Serial Communication Interface (SCI) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/sh3_scif.h b/packages/hal/sh/sh3/current/include/sh3_scif.h --- a/packages/hal/sh/sh3/current/include/sh3_scif.h +++ b/packages/hal/sh/sh3/current/include/sh3_scif.h @@ -5,29 +5,38 @@ // Simple driver for the SH3 Serial Communication Interface with FIFO // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/var_cache.h b/packages/hal/sh/sh3/current/include/var_cache.h --- a/packages/hal/sh/sh3/current/include/var_cache.h +++ b/packages/hal/sh/sh3/current/include/var_cache.h @@ -8,29 +8,38 @@ // HAL variant cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/var_intr.h b/packages/hal/sh/sh3/current/include/var_intr.h --- a/packages/hal/sh/sh3/current/include/var_intr.h +++ b/packages/hal/sh/sh3/current/include/var_intr.h @@ -8,29 +8,38 @@ // HAL variant interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/var_io.h b/packages/hal/sh/sh3/current/include/var_io.h --- a/packages/hal/sh/sh3/current/include/var_io.h +++ b/packages/hal/sh/sh3/current/include/var_io.h @@ -8,29 +8,38 @@ // Variant specific IO support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/var_regs.h b/packages/hal/sh/sh3/current/include/var_regs.h --- a/packages/hal/sh/sh3/current/include/var_regs.h +++ b/packages/hal/sh/sh3/current/include/var_regs.h @@ -7,29 +7,38 @@ // SH CPU definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/include/variant.inc b/packages/hal/sh/sh3/current/include/variant.inc --- a/packages/hal/sh/sh3/current/include/variant.inc +++ b/packages/hal/sh/sh3/current/include/variant.inc @@ -7,29 +7,38 @@ ## SH3 variant assembler header file ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## @@ -52,17 +61,17 @@ #include #=========================================================================== -# SR initialization value -# zero all bits except: -# MD = Processor operation mode field (privileged mode) -# I0-3 = Mask out all interrupts but NMI. -# -# When saving or restoring the state of an exception or interrupt, the bit -# CYGARC_REG_SR_RB is also set, switching the register bank. When this bit -# is set, interrupts must be disabled. -# -# Note: We could also use the BL bit to prevent interrupts, but that would -# also prevent the use of breakpoints. +## SR initialization value +## zero all bits except: +## MD = Processor operation mode field (privileged mode) +## I0-3 = Mask out all interrupts but NMI. +## +## When saving or restoring the state of an exception or interrupt, the bit +## CYGARC_REG_SR_RB is also set, switching the register bank. When this bit +## is set, interrupts must be disabled. +## +## Note: We could also use the BL bit to prevent interrupts, but that would +## also prevent the use of breakpoints. #define CYG_SR (CYGARC_REG_SR_MD|CYGARC_REG_SR_IMASK) #define CYG_SR_BANK1 (CYGARC_REG_SR_MD|CYGARC_REG_SR_IMASK|CYGARC_REG_SR_RB) @@ -159,16 +168,20 @@ 1: ##----------------------------------------------------------------------------- ## Interrupt decode macros .macro hal_intc_decode tmp,inum -#if (CYGARC_SH_MOD_INTC >= 2) - mov.l $nCYGARC_REG_INTEVT2,\tmp -#else - mov #CYGARC_REG_INTEVT,\tmp -#endif + mov.l 1f,\tmp mov.l @\tmp,\inum mov #-5,\tmp ! divide cause by 0x20 shld \tmp,\inum - add #-14,\inum ! adjust so NMI becomes 0 - + bra 2f + add #-14,\inum ! adjust so NMI becomes 0 + .align 2 +1: +#if (CYGARC_SH_MOD_INTC >= 2) + .long CYGARC_REG_INTEVT2 +#else + .long CYGARC_REG_INTEVT +#endif +2: .endm #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN diff --git a/packages/hal/sh/sh3/current/src/sh3_sci.c b/packages/hal/sh/sh3/current/src/sh3_sci.c --- a/packages/hal/sh/sh3/current/src/sh3_sci.c +++ b/packages/hal/sh/sh3/current/src/sh3_sci.c @@ -5,29 +5,38 @@ // Simple driver for the SH Serial Communication Interface (SCI) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -67,14 +76,14 @@ cyg_hal_plf_sci_init_channel(const chann // Disable Tx/Rx interrupts, but enable Tx/Rx HAL_WRITE_UINT8(base+_REG_SCSCR, - CYGARC_REG_SCSCR_TE|CYGARC_REG_SCSCR_RE); + CYGARC_REG_SCI_SCSCR_TE|CYGARC_REG_SCI_SCSCR_RE); // 8-1-no parity. HAL_WRITE_UINT8(base+_REG_SCSMR, 0); // Set speed to CYGNUM_HAL_SH_SH3_SCI_DEFAULT_BAUD_RATE HAL_READ_UINT8(base+_REG_SCSMR, tmp); - tmp &= ~CYGARC_REG_SCSMR_CKSx_MASK; + tmp &= ~CYGARC_REG_SCI_SCSMR_CKSx_MASK; tmp |= CYGARC_SCBRR_CKSx(CYGNUM_HAL_SH_SH3_SCI_BAUD_RATE); HAL_WRITE_UINT8(base+_REG_SCSMR, tmp); HAL_WRITE_UINT8(base+_REG_SCBRR, CYGARC_SCBRR_N(CYGNUM_HAL_SH_SH3_SCI_BAUD_RATE)); @@ -87,20 +96,20 @@ cyg_hal_plf_sci_getc_nonblock(void* __ch cyg_uint8 sr; HAL_READ_UINT8(base+_REG_SCSSR, sr); - if (sr & CYGARC_REG_SCSSR_ORER) { + if (sr & CYGARC_REG_SCI_SCSSR_ORER) { // Serial RX overrun. Clear error and let caller try again. HAL_WRITE_UINT8(base+_REG_SCSSR, - CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_ORER); + CYGARC_REG_SCI_SCSSR_CLEARMASK & ~CYGARC_REG_SCI_SCSSR_ORER); return false; } - if ((sr & CYGARC_REG_SCSSR_RDRF) == 0) + if ((sr & CYGARC_REG_SCI_SCSSR_RDRF) == 0) return false; HAL_READ_UINT8(base+_REG_SCRDR, *ch); // Clear buffer full flag. - HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCSSR_RDRF); + HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCI_SCSSR_RDRF); return true; } @@ -126,17 +135,17 @@ cyg_hal_plf_sci_putc(void* __ch_data, cy do { HAL_READ_UINT8(base+_REG_SCSSR, sr); - } while ((sr & CYGARC_REG_SCSSR_TDRE) == 0); + } while ((sr & CYGARC_REG_SCI_SCSSR_TDRE) == 0); HAL_WRITE_UINT8(base+_REG_SCTDR, c); // Clear empty flag. - HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCSSR_TDRE); + HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCI_SCSSR_TDRE); // Hang around until the character has been safely sent. do { HAL_READ_UINT8(base+_REG_SCSSR, sr); - } while ((sr & CYGARC_REG_SCSSR_TDRE) == 0); + } while ((sr & CYGARC_REG_SCI_SCSSR_TDRE) == 0); CYGARC_HAL_RESTORE_GP(); } @@ -203,7 +212,7 @@ cyg_hal_plf_sci_control(void *__ch_data, irq_state = 1; HAL_INTERRUPT_UNMASK(chan->isr_vector); HAL_READ_UINT8(chan->base+_REG_SCSCR, scr); - scr |= CYGARC_REG_SCSCR_RIE; + scr |= CYGARC_REG_SCI_SCSCR_RIE; HAL_WRITE_UINT8(chan->base+_REG_SCSCR, scr); break; case __COMMCTL_IRQ_DISABLE: @@ -211,7 +220,7 @@ cyg_hal_plf_sci_control(void *__ch_data, irq_state = 0; HAL_INTERRUPT_UNMASK(chan->isr_vector); HAL_READ_UINT8(chan->base+_REG_SCSCR, scr); - scr &= ~CYGARC_REG_SCSCR_RIE; + scr &= ~CYGARC_REG_SCI_SCSCR_RIE; HAL_WRITE_UINT8(chan->base+_REG_SCSCR, scr); break; case __COMMCTL_DBG_ISR_VECTOR: @@ -246,18 +255,18 @@ cyg_hal_plf_sci_isr(void *__ch_data, int *__ctrlc = 0; HAL_READ_UINT8(base+_REG_SCSSR, sr); - if (sr & CYGARC_REG_SCSSR_ORER) { + if (sr & CYGARC_REG_SCI_SCSSR_ORER) { // Serial RX overrun. Clear error and hope protocol recovers. HAL_WRITE_UINT8(base+_REG_SCSSR, - CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_ORER); + CYGARC_REG_SCI_SCSSR_CLEARMASK & ~CYGARC_REG_SCI_SCSSR_ORER); res = CYG_ISR_HANDLED; - } else if (sr & CYGARC_REG_SCSSR_RDRF) { + } else if (sr & CYGARC_REG_SCI_SCSSR_RDRF) { // Received character HAL_READ_UINT8(base+_REG_SCRDR, c); // Clear buffer full flag. HAL_WRITE_UINT8(base+_REG_SCSSR, - CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_RDRF); + CYGARC_REG_SCI_SCSSR_CLEARMASK & ~CYGARC_REG_SCI_SCSSR_RDRF); if( cyg_hal_is_break( &c , 1 ) ) *__ctrlc = 1; diff --git a/packages/hal/sh/sh3/current/src/sh3_scif.c b/packages/hal/sh/sh3/current/src/sh3_scif.c --- a/packages/hal/sh/sh3/current/src/sh3_scif.c +++ b/packages/hal/sh/sh3/current/src/sh3_scif.c @@ -5,29 +5,38 @@ // Simple driver for the SH3 Serial Communication Interface with FIFO // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -77,14 +86,14 @@ cyg_hal_plf_scif_init_channel(const chan // Reset FIFO. HAL_WRITE_UINT8(base+_REG_SCFCR, - CYGARC_REG_SCFCR2_TFRST|CYGARC_REG_SCFCR2_RFRST); + CYGARC_REG_SCIF_SCFCR_TFRST|CYGARC_REG_SCIF_SCFCR_RFRST); // 8-1-no parity. HAL_WRITE_UINT8(base+_REG_SCSMR, 0); // Set speed to CYGNUM_HAL_SH_SH3_SCIF_DEFAULT_BAUD_RATE HAL_READ_UINT8(base+_REG_SCSMR, tmp); - tmp &= ~CYGARC_REG_SCSMR2_CKSx_MASK; + tmp &= ~CYGARC_REG_SCIF_SCSMR_CKSx_MASK; tmp |= CYGARC_SCBRR_CKSx(CYGNUM_HAL_SH_SH3_SCIF_BAUD_RATE); HAL_WRITE_UINT8(base+_REG_SCSMR, tmp); HAL_WRITE_UINT8(base+_REG_SCBRR, CYGARC_SCBRR_N(CYGNUM_HAL_SH_SH3_SCIF_BAUD_RATE)); @@ -104,11 +113,11 @@ cyg_hal_plf_scif_init_channel(const chan // Bring FIFO out of reset and set to trigger on every char in // FIFO (or C-c input would not be processed). HAL_WRITE_UINT8(base+_REG_SCFCR, - CYGARC_REG_SCFCR2_RTRG_1|CYGARC_REG_SCFCR2_TTRG_1); + CYGARC_REG_SCIF_SCFCR_RTRG_1|CYGARC_REG_SCIF_SCFCR_TTRG_1); // Leave Tx/Rx interrupts disabled, but enable Tx/Rx HAL_WRITE_UINT8(base+_REG_SCSCR, - CYGARC_REG_SCSCR2_TE|CYGARC_REG_SCSCR2_RE); + CYGARC_REG_SCIF_SCSCR_TE|CYGARC_REG_SCIF_SCSCR_RE); } //static @@ -119,7 +128,7 @@ cyg_hal_plf_scif_getc_nonblock(void* __c cyg_uint16 fdr, sr; HAL_READ_UINT16(base+_REG_SCFDR, fdr); - if (0 == (fdr & CYGARC_REG_SCFDR2_RCOUNT_MASK)) + if (0 == (fdr & CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK)) return false; HAL_READ_UINT8(base+_REG_SCFRDR, *ch); @@ -127,7 +136,7 @@ cyg_hal_plf_scif_getc_nonblock(void* __c // Clear DR/RDF flags HAL_READ_UINT16(base+_REG_SCSSR, sr); HAL_WRITE_UINT16(base+_REG_SCSSR, - CYGARC_REG_SCSSR2_CLEARMASK & ~(CYGARC_REG_SCSSR2_RDF | CYGARC_REG_SCSSR2_DR)); + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~(CYGARC_REG_SCIF_SCSSR_RDF | CYGARC_REG_SCIF_SCSSR_DR)); return true; } @@ -153,19 +162,19 @@ cyg_hal_plf_scif_putc(void* __ch_data, c do { HAL_READ_UINT16(base+_REG_SCFDR, fdr); - } while (((fdr & CYGARC_REG_SCFDR2_TCOUNT_MASK) >> CYGARC_REG_SCFDR2_TCOUNT_shift) == 16); + } while (((fdr & CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK) >> CYGARC_REG_SCIF_SCFDR_TCOUNT_shift) == 16); HAL_WRITE_UINT8(base+_REG_SCFTDR, c); // Clear FIFO-empty/transmit end flags (read back SR first) HAL_READ_UINT16(base+_REG_SCSSR, sr); - HAL_WRITE_UINT16(base+_REG_SCSSR, CYGARC_REG_SCSSR2_CLEARMASK - & ~(CYGARC_REG_SCSSR2_TDFE | CYGARC_REG_SCSSR2_TEND )); + HAL_WRITE_UINT16(base+_REG_SCSSR, CYGARC_REG_SCIF_SCSSR_CLEARMASK + & ~(CYGARC_REG_SCIF_SCSSR_TDFE | CYGARC_REG_SCIF_SCSSR_TEND )); // Hang around until the character has been safely sent. do { HAL_READ_UINT16(base+_REG_SCFDR, fdr); - } while ((fdr & CYGARC_REG_SCFDR2_TCOUNT_MASK) != 0); + } while ((fdr & CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK) != 0); CYGARC_HAL_RESTORE_GP(); } @@ -232,7 +241,7 @@ cyg_hal_plf_scif_control(void *__ch_data irq_state = 1; HAL_INTERRUPT_UNMASK(chan->isr_vector); HAL_READ_UINT8(chan->base+_REG_SCSCR, scr); - scr |= CYGARC_REG_SCSCR2_RIE; + scr |= CYGARC_REG_SCIF_SCSCR_RIE; HAL_WRITE_UINT8(chan->base+_REG_SCSCR, scr); break; case __COMMCTL_IRQ_DISABLE: @@ -240,7 +249,7 @@ cyg_hal_plf_scif_control(void *__ch_data irq_state = 0; HAL_INTERRUPT_UNMASK(chan->isr_vector); HAL_READ_UINT8(chan->base+_REG_SCSCR, scr); - scr &= ~CYGARC_REG_SCSCR2_RIE; + scr &= ~CYGARC_REG_SCIF_SCSCR_RIE; HAL_WRITE_UINT8(chan->base+_REG_SCSCR, scr); break; case __COMMCTL_DBG_ISR_VECTOR: @@ -276,13 +285,13 @@ cyg_hal_plf_scif_isr(void *__ch_data, in *__ctrlc = 0; HAL_READ_UINT16(base+_REG_SCFDR, fdr); - if ((fdr & CYGARC_REG_SCFDR2_RCOUNT_MASK) != 0) { + if ((fdr & CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK) != 0) { HAL_READ_UINT8(base+_REG_SCFRDR, c); // Clear buffer full flag (read back first). HAL_READ_UINT16(base+_REG_SCSSR, sr); HAL_WRITE_UINT16(base+_REG_SCSSR, - CYGARC_REG_SCSSR2_CLEARMASK & ~CYGARC_REG_SCSSR2_RDF); + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~CYGARC_REG_SCIF_SCSSR_RDF); if( cyg_hal_is_break( &c , 1 ) ) *__ctrlc = 1; diff --git a/packages/hal/sh/sh3/current/src/var_misc.c b/packages/hal/sh/sh3/current/src/var_misc.c --- a/packages/hal/sh/sh3/current/src/var_misc.c +++ b/packages/hal/sh/sh3/current/src/var_misc.c @@ -5,29 +5,38 @@ // HAL miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/src/var_mk_defs.c b/packages/hal/sh/sh3/current/src/var_mk_defs.c --- a/packages/hal/sh/sh3/current/src/var_mk_defs.c +++ b/packages/hal/sh/sh3/current/src/var_mk_defs.c @@ -5,29 +5,38 @@ // HAL (variant) "make defs" program // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh3/current/src/variant.S b/packages/hal/sh/sh3/current/src/variant.S --- a/packages/hal/sh/sh3/current/src/variant.S +++ b/packages/hal/sh/sh3/current/src/variant.S @@ -5,29 +5,38 @@ ## SH3 variant assembly code ## ##========================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##========================================================================== #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/sh/sh4/current/ChangeLog b/packages/hal/sh/sh4/current/ChangeLog --- a/packages/hal/sh/sh4/current/ChangeLog +++ b/packages/hal/sh/sh4/current/ChangeLog @@ -1,3 +1,26 @@ +2002-05-08 Jesper Skov + + * src/sh4_scif.c: Register renaming. + + * include/mod_regs_ser.h: Register renaming. SCI registers now + contain _SCI_, SCIF registers contain _SCIF_. Merge SCIF and IrDA + definitions (stripping SCIF identifier suffix). + +2002-01-17 Jesper Skov + + * include/variant.inc: Include needed ptrs. + +2002-01-16 Jesper Skov + + * cdl/hal_sh_sh4.cdl: Added interrupt model header definition. + Added RTC_PRESCALE option. + +2002-01-14 Jesper Skov + + * cdl/hal_sh_sh4.cdl: Added exception model header definitions. + + * include/variant.inc: Fixed assembler warning. + 2001-11-07 Jesper Skov * src/var_mk_defs.c (main): Fix warning. @@ -66,6 +89,14 @@ 2001-07-17 Jesper Skov + + * include/variant.inc: Fix ICR init, add IPRD init. + * include/var_intr.h: Added IRL vectors. + * include/mod_regs_intc.c: Added IPRD definitions. + * src/var_misc.c (hal_interrupt_update_level): Handle IRPD + vectors. + 2001-07-16 Jesper Skov * src/var_misc.c (hal_interrupt_update_level): Fix typo. @@ -91,6 +122,14 @@ 2001-07-10 Jesper Skov * include/mod_regs_ubc.h: Ignore ASID when stepping. @@ -104,6 +143,8 @@ 2001-07-09 Jesper Skov @@ -183,27 +224,36 @@ 2000-04-18 Ryozaburo Suzuki " + puts $::cdl_header "#define CYGBLD_HAL_VAR_EXCEPTION_MODEL_H " + puts $::cdl_header "#define CYGBLD_HAL_VAR_EXCEPTION_MODEL_INC " + puts $::cdl_header "#define CYGBLD_HAL_VAR_INTR_MODEL_H " } # The "-o file" is a workaround for CR100958 - without it the @@ -92,6 +104,25 @@ cdl_package CYGPKG_HAL_SH_SH4 { } } + cdl_component CYGPKG_HAL_SH_7751 { + display "SH 7751 microprocessor" + parent CYGPKG_HAL_SH_CPU + implements CYGINT_HAL_SH_VARIANT + implements CYGINT_HAL_SH_CPG_T1 + default_value 0 + no_define + define -file=system.h CYGPKG_HAL_SH_7751 + compile pcic.c + description " + The SH4 7751 microprocessor. This is an embedded part that in + addition to the SH4 processor core has built in peripherals + such as memory controllers, DMA controllers, serial ports and + timers/counters." + define_proc { + puts $cdl_system_header "#define CYGBLD_HAL_CPU_MODULES_H " + } + } + cdl_component CYGHWR_HAL_SH_CLOCK_SETTINGS { display "SH on-chip generic clock controls" description " @@ -115,6 +146,12 @@ cdl_package CYGPKG_HAL_SH_SH4 { default_value 4 } + cdl_option CYGHWR_HAL_SH_RTC_PRESCALE { + display "eCos RTC prescaling" + flavor data + calculated CYGHWR_HAL_SH_TMU_PRESCALE_0 + } + cdl_option CYGHWR_HAL_SH_CLOCK_CKIO { display "CKIO clock" no_define diff --git a/packages/hal/sh/sh4/current/include/mod_7750.h b/packages/hal/sh/sh4/current/include/mod_7750.h --- a/packages/hal/sh/sh4/current/include/mod_7750.h +++ b/packages/hal/sh/sh4/current/include/mod_7750.h @@ -8,29 +8,38 @@ // List modules available on CPU // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/mod_7751.h b/packages/hal/sh/sh4/current/include/mod_7751.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh4/current/include/mod_7751.h @@ -0,0 +1,106 @@ +#ifndef CYGONCE_HAL_MOD_77xx_H +#define CYGONCE_HAL_MOD_77xx_H + +//============================================================================= +// +// mod_7751.h +// +// List modules available on CPU +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Date: 2001-07-09 +// Purpose: Define modules (and versions) available on this CPU. +// Usage: Included from +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//----------------------------------------------------------------------------- +// Modules provided by the CPU + +#define CYGARC_SH_MOD_CPG 1 +#define CYGARC_SH_MOD_SCIF 1 +#define CYGARC_SH_MOD_UBC 1 +#define CYGARC_SH_MOD_PCIC 1 +#define CYGARC_SH_MOD_INTC 2 + +//----------------------------------------------------------------------------- +// Extra details for Cache Module (CAC) + +//============================================================================= +// Icache +// Cache dimenions +#define CYGARC_SH_MOD_CAC_I_SIZE 8192 // Size of cache in bytes +#define CYGARC_SH_MOD_CAC_I_LINE_SIZE 32 // Size of a cache line +#define CYGARC_SH_MOD_CAC_I_WAYS 1 // Associativity of the cache + +// Cache addressing information +// entry: bits 12 - 5 +#define CYGARC_SH_MOD_ICAC_ADDRESS_BASE 0xf0000000 +#define CYGARC_SH_MOD_ICAC_ADDRESS_TOP 0xf0002000 +#define CYGARC_SH_MOD_ICAC_ADDRESS_STEP 0x00000020 +// V : bit 0 +// Writing zero to V forces an invalidate of the line +#define CYGARC_SH_MOD_ICAC_ADDRESS_FLUSH 0x00000000 + + +//============================================================================= +// Dcache +// Cache dimenions +#define CYGARC_SH_MOD_CAC_D_SIZE 16384 // Size of cache in bytes +#define CYGARC_SH_MOD_CAC_D_LINE_SIZE 32 // Size of a cache line +#define CYGARC_SH_MOD_CAC_D_WAYS 1 // Associativity of the cache + +// Cache addressing information +// entry: bits 13 - 5 +#define CYGARC_SH_MOD_DCAC_ADDRESS_BASE 0xf4000000 +#define CYGARC_SH_MOD_DCAC_ADDRESS_TOP 0xf4004000 +#define CYGARC_SH_MOD_DCAC_ADDRESS_STEP 0x00000020 +// U : bit 1 +// V : bit 0 +// Writing zero to both forces a flush of the line if it is dirty. +#define CYGARC_SH_MOD_DCAC_ADDRESS_FLUSH 0x00000000 + +//----------------------------------------------------------------------------- +// Extra details for interrupt handling +#define CYGARC_SH_SOFTWARE_IP_UPDATE + +#endif // CYGONCE_HAL_MOD_77xx_H diff --git a/packages/hal/sh/sh4/current/include/mod_regs_bsc.h b/packages/hal/sh/sh4/current/include/mod_regs_bsc.h --- a/packages/hal/sh/sh4/current/include/mod_regs_bsc.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_bsc.h @@ -5,29 +5,38 @@ // BSC (bus state controller) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/mod_regs_cac.h b/packages/hal/sh/sh4/current/include/mod_regs_cac.h --- a/packages/hal/sh/sh4/current/include/mod_regs_cac.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_cac.h @@ -5,29 +5,38 @@ // CAC (cache) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/mod_regs_cpg.h b/packages/hal/sh/sh4/current/include/mod_regs_cpg.h --- a/packages/hal/sh/sh4/current/include/mod_regs_cpg.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_cpg.h @@ -5,29 +5,38 @@ // CPG (clock pulse generator) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/mod_regs_dma.h b/packages/hal/sh/sh4/current/include/mod_regs_dma.h --- a/packages/hal/sh/sh4/current/include/mod_regs_dma.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_dma.h @@ -5,29 +5,38 @@ // DMA (direct memory access) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/mod_regs_intc.h b/packages/hal/sh/sh4/current/include/mod_regs_intc.h --- a/packages/hal/sh/sh4/current/include/mod_regs_intc.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_intc.h @@ -5,29 +5,38 @@ // INTC (interrupt controller) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -81,6 +90,34 @@ #define CYGARC_REG_IPRC_HUDI_MASK 0x000F #define CYGARC_REG_IPRC_HUDI_PRI1 0x0001 +#if (CYGARC_SH_MOD_INTC == 2) +#define CYGARC_REG_IPRD 0xffd00010 +#define CYGARC_REG_INTPRI00 0xfe080000 +#define CYGARC_REG_INTREQ00 0xfe080020 +#define CYGARC_REG_INTMSK00 0xfe080040 +#define CYGARC_REG_INTMSKCLR00 0xfe080060 + +#ifndef CYGHWR_HAL_SH_IRQ_USE_IRQLVL +#define CYGARC_REG_IPRD_IRL0_MASK 0xf000 +#define CYGARC_REG_IPRD_IRL0_PRI1 0x1000 +#define CYGARC_REG_IPRD_IRL1_MASK 0x0f00 +#define CYGARC_REG_IPRD_IRL1_PRI1 0x0100 +#define CYGARC_REG_IPRD_IRL2_MASK 0x00f0 +#define CYGARC_REG_IPRD_IRL2_PRI1 0x0010 +#define CYGARC_REG_IPRD_IRL3_MASK 0x000f +#define CYGARC_REG_IPRD_IRL3_PRI1 0x0001 +#endif + +#define CYGARC_REG_INTPRI00_PCISERR_MASK 0x0000000f +#define CYGARC_REG_INTPRI00_PCISERR_PRI1 0x00000001 +#define CYGARC_REG_INTPRI00_PCIERR_MASK 0x000000f0 +#define CYGARC_REG_INTPRI00_PCIERR_PRI1 0x00000010 +#define CYGARC_REG_INTPRI00_TUNI3_MASK 0x00000f00 +#define CYGARC_REG_INTPRI00_TUNI3_PRI1 0x00000100 +#define CYGARC_REG_INTPRI00_TUNI4_MASK 0x0000f000 +#define CYGARC_REG_INTPRI00_TUNI4_PRI1 0x00001000 + +#endif // The (initial) IRQ mode is controlled by configuration. #ifdef CYGHWR_HAL_SH_IRQ_USE_IRQLVL diff --git a/packages/hal/sh/sh4/current/include/mod_regs_mmu.h b/packages/hal/sh/sh4/current/include/mod_regs_mmu.h --- a/packages/hal/sh/sh4/current/include/mod_regs_mmu.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_mmu.h @@ -5,29 +5,38 @@ // MMU Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/mod_regs_pcic.h b/packages/hal/sh/sh4/current/include/mod_regs_pcic.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh4/current/include/mod_regs_pcic.h @@ -0,0 +1,150 @@ +//============================================================================= +// +// mod_regs_pcic.h +// +// PCIC (PCI controller) Module register definitions +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-07-10 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//-------------------------------------------------------------------------- +// PCI control registers +#define CYGARC_REG_PCIC_BASE 0xfe200000 +#define CYGARC_REG_PCIC_IO_BASE 0xfe240000 +#define CYGARC_REG_PCIC_IO_BASE_MASK 0x0003ffff +#define CYGARC_REG_PCIC_MEM_BASE 0xfd000000 + + + +#define CYGARC_REG_PCIC_CFG (CYGARC_REG_PCIC_BASE) + +#define CYGARC_REG_PCIC_CR (CYGARC_REG_PCIC_BASE + 0x100) +#define CYGARC_REG_PCIC_LSR0 (CYGARC_REG_PCIC_BASE + 0x104) +#define CYGARC_REG_PCIC_LSR1 (CYGARC_REG_PCIC_BASE + 0x108) +#define CYGARC_REG_PCIC_LAR0 (CYGARC_REG_PCIC_BASE + 0x10c) +#define CYGARC_REG_PCIC_LAR1 (CYGARC_REG_PCIC_BASE + 0x110) +#define CYGARC_REG_PCIC_INT (CYGARC_REG_PCIC_BASE + 0x114) +#define CYGARC_REG_PCIC_INTM (CYGARC_REG_PCIC_BASE + 0x118) +#define CYGARC_REG_PCIC_ALR (CYGARC_REG_PCIC_BASE + 0x11c) +#define CYGARC_REG_PCIC_CLR (CYGARC_REG_PCIC_BASE + 0x120) +#define CYGARC_REG_PCIC_AINT (CYGARC_REG_PCIC_BASE + 0x130) +#define CYGARC_REG_PCIC_AINTM (CYGARC_REG_PCIC_BASE + 0x134) +#define CYGARC_REG_PCIC_BMLR (CYGARC_REG_PCIC_BASE + 0x138) +#define CYGARC_REG_PCIC_DMABT (CYGARC_REG_PCIC_BASE + 0x140) +#define CYGARC_REG_PCIC_DPA0 (CYGARC_REG_PCIC_BASE + 0x180) +#define CYGARC_REG_PCIC_DLA0 (CYGARC_REG_PCIC_BASE + 0x184) +#define CYGARC_REG_PCIC_DTC0 (CYGARC_REG_PCIC_BASE + 0x188) +#define CYGARC_REG_PCIC_DCR0 (CYGARC_REG_PCIC_BASE + 0x18c) +#define CYGARC_REG_PCIC_DPA1 (CYGARC_REG_PCIC_BASE + 0x190) +#define CYGARC_REG_PCIC_DLA1 (CYGARC_REG_PCIC_BASE + 0x194) +#define CYGARC_REG_PCIC_DTC1 (CYGARC_REG_PCIC_BASE + 0x198) +#define CYGARC_REG_PCIC_DCR1 (CYGARC_REG_PCIC_BASE + 0x19c) +#define CYGARC_REG_PCIC_DPA2 (CYGARC_REG_PCIC_BASE + 0x1a0) +#define CYGARC_REG_PCIC_DLA2 (CYGARC_REG_PCIC_BASE + 0x1a4) +#define CYGARC_REG_PCIC_DTC2 (CYGARC_REG_PCIC_BASE + 0x1a8) +#define CYGARC_REG_PCIC_DCR2 (CYGARC_REG_PCIC_BASE + 0x1ac) +#define CYGARC_REG_PCIC_DPA3 (CYGARC_REG_PCIC_BASE + 0x1b0) +#define CYGARC_REG_PCIC_DLA3 (CYGARC_REG_PCIC_BASE + 0x1b4) +#define CYGARC_REG_PCIC_DTC3 (CYGARC_REG_PCIC_BASE + 0x1b8) +#define CYGARC_REG_PCIC_DCR3 (CYGARC_REG_PCIC_BASE + 0x1bc) +#define CYGARC_REG_PCIC_PAR (CYGARC_REG_PCIC_BASE + 0x1c0) +#define CYGARC_REG_PCIC_MBR (CYGARC_REG_PCIC_BASE + 0x1c4) +#define CYGARC_REG_PCIC_IOBR (CYGARC_REG_PCIC_BASE + 0x1c8) +#define CYGARC_REG_PCIC_PINT (CYGARC_REG_PCIC_BASE + 0x1cc) +#define CYGARC_REG_PCIC_PINTM (CYGARC_REG_PCIC_BASE + 0x1d0) +#define CYGARC_REG_PCIC_CLKR (CYGARC_REG_PCIC_BASE + 0x1d4) +#define CYGARC_REG_PCIC_BCR1 (CYGARC_REG_PCIC_BASE + 0x1e0) +#define CYGARC_REG_PCIC_BCR2 (CYGARC_REG_PCIC_BASE + 0x1e4) +#define CYGARC_REG_PCIC_WCR1 (CYGARC_REG_PCIC_BASE + 0x1e8) +#define CYGARC_REG_PCIC_WCR2 (CYGARC_REG_PCIC_BASE + 0x1ec) +#define CYGARC_REG_PCIC_WCR3 (CYGARC_REG_PCIC_BASE + 0x1f0) +#define CYGARC_REG_PCIC_MCR (CYGARC_REG_PCIC_BASE + 0x1f4) +#define CYGARC_REG_PCIC_PCTR (CYGARC_REG_PCIC_BASE + 0x200) +#define CYGARC_REG_PCIC_PDTR (CYGARC_REG_PCIC_BASE + 0x204) +#define CYGARC_REG_PCIC_PDR (CYGARC_REG_PCIC_BASE + 0x220) + + +#define CYGARC_REG_PCIC_CR_MAGIC 0xa5000000 +#define CYGARC_REG_PCIC_CR_TRDSGL 0x00000200 +#define CYGARC_REG_PCIC_CR_BYTESWAP 0x00000100 +#define CYGARC_REG_PCIC_CR_PCIPUP 0x00000080 +#define CYGARC_REG_PCIC_CR_BMABT 0x00000040 +#define CYGARC_REG_PCIC_CR_MD10 0x00000020 +#define CYGARC_REG_PCIC_CR_MD9 0x00000010 +#define CYGARC_REG_PCIC_CR_SERR 0x00000008 +#define CYGARC_REG_PCIC_CR_INTA 0x00000004 +#define CYGARC_REG_PCIC_CR_PCIRST 0x00000002 +#define CYGARC_REG_PCIC_CR_CFINIT 0x00000001 +#define CYGARC_REG_PCIC_CR_INIT 0xa5000001 + +#define CYGARC_REG_PCIC_IOBR_MASK 0xfffc0000 + +#define CYGARC_REG_PCIC_PAR_ENABLE 0x80000000 +#define CYGARC_REG_PCIC_PAR_BUSNO_shift 16 +#define CYGARC_REG_PCIC_PAR_FUNC_shift 8 + + +#define CYGARC_REG_PCIC_INTM_M_LOCKON 0x00008000 +#define CYGARC_REG_PCIC_INTM_T_TGT_ABORT 0x00004000 +#define CYGARC_REG_PCIC_INTM_TGT_RETRY 0x00000200 +#define CYGARC_REG_PCIC_INTM_MST_DIS 0x00000100 +#define CYGARC_REG_PCIC_INTM_ADRPERR 0x00000080 +#define CYGARC_REG_PCIC_INTM_SERR_DET 0x00000040 +#define CYGARC_REG_PCIC_INTM_T_DPERR_WT 0x00000020 +#define CYGARC_REG_PCIC_INTM_T_PERR_DET 0x00000010 +#define CYGARC_REG_PCIC_INTM_M_TGT_ABORT 0x00000008 +#define CYGARC_REG_PCIC_INTM_M_MST_ABORT 0x00000004 +#define CYGARC_REG_PCIC_INTM_M_DPERR_WT 0x00000002 +#define CYGARC_REG_PCIC_INTM_M_DPERR_RD 0x00000001 +#define CYGARC_REG_PCIC_INTM_INIT 0x0000c3ff + +#define CYGARC_REG_PCIC_AINTM_MST_BRKN 0x00002000 +#define CYGARC_REG_PCIC_AINTM_TGT_BUSTO 0x00001000 +#define CYGARC_REG_PCIC_AINTM_MST_BUSTO 0x00000800 +#define CYGARC_REG_PCIC_AINTM_TGT_ABORT 0x00000008 +#define CYGARC_REG_PCIC_AINTM_MST_ABORT 0x00000004 +#define CYGARC_REG_PCIC_AINTM_DPERR_WT 0x00000002 +#define CYGARC_REG_PCIC_AINTM_DPERR_RD 0x00000001 +#define CYGARC_REG_PCIC_AINTM_INIT 0x0000380f + diff --git a/packages/hal/sh/sh4/current/include/mod_regs_pfc.h b/packages/hal/sh/sh4/current/include/mod_regs_pfc.h --- a/packages/hal/sh/sh4/current/include/mod_regs_pfc.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_pfc.h @@ -5,29 +5,38 @@ // PFC (pin function controller) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/mod_regs_rtc.h b/packages/hal/sh/sh4/current/include/mod_regs_rtc.h --- a/packages/hal/sh/sh4/current/include/mod_regs_rtc.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_rtc.h @@ -5,29 +5,38 @@ // RTC (real time clock) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/mod_regs_ser.h b/packages/hal/sh/sh4/current/include/mod_regs_ser.h --- a/packages/hal/sh/sh4/current/include/mod_regs_ser.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_ser.h @@ -5,29 +5,38 @@ // SCI, SCIF, and IRDA (serial) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -122,160 +131,98 @@ ((_b_) > 115200) ? 0 : \ (((CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED+CYGARC_SCBRR_ROUNDING(_b_))/32/CYGARC_SCBRR_PRESCALE(_b_)/(_b_))-1)) - -//++++++ Module IRDA +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -#ifdef CYGARC_SH_MOD_IRDA - -//-------------------------------------------------------------------------- -// IrDA (infrared data association). Can also act as regular serial w FIFO - -#define CYGARC_REG_SCSMR1 0xFFE00000 // serial mode register -#define CYGARC_REG_SCBRR1 0xFFE00004 // bit rate register -#define CYGARC_REG_SCSCR1 0xFFE00008 // serial control register -#define CYGARC_REG_SCTDR1 0xFFE0000C // transmit data register -#define CYGARC_REG_SCSSR1 0xFFE00010 // serial status register -#define CYGARC_REG_SCRDR1 0xFFE00014 // receive data register -#define CYGARC_REG_SCRCMR1 0xFFE00018 -#define CYGARC_REG_SCSPTR1 0xFFE0001C // serial port register - -// Serial Mode Register -#define CYGARC_REG_SCSMR1_IRMOD 0x80 // IrDA Mode -#define CYGARC_REG_SCSMR1_ICK_MASK 0x78 // IR pulse width -#define CYGARC_REG_SCSMR1_PSEL 0x04 // IR pulse selector(?) -#define CYGARC_REG_SCSMR1_CKS1 0x02 // clock select 1 -#define CYGARC_REG_SCSMR1_CKS0 0x01 // clock select 0 -#define CYGARC_REG_SCSMR1_CKSx_MASK 0x03 // mask - -// Serial Control Register -#define CYGARC_REG_SCSCR1_TIE 0x80 // transmit interrupt enable -#define CYGARC_REG_SCSCR1_RIE 0x40 // receive interrupt enable -#define CYGARC_REG_SCSCR1_TE 0x20 // transmit enable -#define CYGARC_REG_SCSCR1_RE 0x10 // receive enable -#define CYGARC_REG_SCSCR1_CKE1 0x02 // clock enable 1 -#define CYGARC_REG_SCSCR1_CKE0 0x01 // clock enable 0 - -// Serial Status Register -#define CYGARC_REG_SCSSR1_PER_MASK 0xf000 // number of parity errors -#define CYGARC_REG_SCSSR1_PER_shift 12 -#define CYGARC_REG_SCSSR1_FER_MASK 0x0f00 // number of framing errors -#define CYGARC_REG_SCSSR1_FER_shift 8 -#define CYGARC_REG_SCSSR1_ER 0x0080 // receive error -#define CYGARC_REG_SCSSR1_TEND 0x0040 // transmit end -#define CYGARC_REG_SCSSR1_TDFE 0x0020 // transmit fifo data empty -#define CYGARC_REG_SCSSR1_BRK 0x0010 // break detection -#define CYGARC_REG_SCSSR1_FER 0x0008 // framing error -#define CYGARC_REG_SCSSR1_PER 0x0004 // parity error -#define CYGARC_REG_SCSSR1_RDF 0x0002 // receive fifo data full -#define CYGARC_REG_SCSSR1_DR 0x0001 // receive data ready - -// When clearing the status register, always write the value: -// CYGARC_REG_SCSSR2_CLEARMASK & ~bit -// to prevent other bits than the one of interest to be cleared. -#define CYGARC_REG_SCSSR1_CLEARMASK 0x00f3 - -// Serial FIFO Control Register -#define CYGARC_REG_SCFCR1_RTRG_MASK 0xc0 // receive fifo data trigger -#define CYGARC_REG_SCFCR1_RTRG_1 0x00 // trigger on 1 char -#define CYGARC_REG_SCFCR1_RTRG_4 0x40 // trigger on 4 chars -#define CYGARC_REG_SCFCR1_RTRG_8 0x80 // trigger on 8 chars -#define CYGARC_REG_SCFCR1_RTRG_14 0xc0 // trigger on 14 chars - -#define CYGARC_REG_SCFCR1_TTRG_MASK 0x30 // transmit fifo data trigger -#define CYGARC_REG_SCFCR1_TTRG_8 0x00 // trigger on 8 chars -#define CYGARC_REG_SCFCR1_TTRG_4 0x10 // trigger on 4 chars -#define CYGARC_REG_SCFCR1_TTRG_2 0x20 // trigger on 2 chars -#define CYGARC_REG_SCFCR1_TTRG_1 0x30 // trigger on 1 char - -#define CYGARC_REG_SCFCR1_MCE 0x08 // modem control enable -#define CYGARC_REG_SCFCR1_TFRST 0x04 // transmit fifo reset -#define CYGARC_REG_SCFCR1_RFRST 0x02 // receive fifo reset -#define CYGARC_REG_SCFCR1_LOOP 0x01 // loop back test - - -// Serial FIFO Data Count Set Register -#define CYGARC_REG_SCFDR1_RCOUNT_MASK 0x001f // number of chars in r fifo -#define CYGARC_REG_SCFDR1_RCOUNT_shift 0 -#define CYGARC_REG_SCFDR1_TCOUNT_MASK 0x1f00 // number of chars in t fifo -#define CYGARC_REG_SCFDR1_TCOUNT_shift 8 - -#endif // CYGARC_SH_MOD_IRDA - //++++++ Module SCIF +++++++++++++++++++++++++++++++++++++++++++++++++++++++ #ifdef CYGARC_SH_MOD_SCIF //-------------------------------------------------------------------------- // Serial w FIFO registers -#define CYGARC_REG_SCSMR2 0xffe80000 // Serial mode -#define CYGARC_REG_SCBRR2 0xffe80004 // Bit rate -#define CYGARC_REG_SCSCR2 0xffe80008 // Serial control -#define CYGARC_REG_SCFTDR2 0xffe8000c // Transmit FIFO data -#define CYGARC_REG_SCFSR2 0xffe80010 // Serial status -#define CYGARC_REG_SCFRDR2 0xffe80014 // Receive data FIFO -#define CYGARC_REG_SCFCR2 0xffe80018 // FIFO control register -#define CYGARC_REG_SCFDR2 0xffe8001c // FIFO data count set -#define CYGARC_REG_SCSPTR2 0xffe80020 // serial port register -#define CYGARC_REG_SCLSR2 0xffe80024 // line status register +// SCIF1 +#define CYGARC_REG_SCIF_SCSMR1 0xFFE00000 // serial mode register +#define CYGARC_REG_SCIF_SCBRR1 0xFFE00004 // bit rate register +#define CYGARC_REG_SCIF_SCSCR1 0xFFE00008 // serial control register +#define CYGARC_REG_SCIF_SCTDR1 0xFFE0000C // transmit data register +#define CYGARC_REG_SCIF_SCSSR1 0xFFE00010 // serial status register +#define CYGARC_REG_SCIF_SCRDR1 0xFFE00014 // receive data register +#define CYGARC_REG_SCIF_SCRCMR1 0xFFE00018 +#define CYGARC_REG_SCIF_SCSPTR1 0xFFE0001C // serial port register -// Serial Mode Register -#define CYGARC_REG_SCSMR2_CHR 0x40 // character length (7 if set) -#define CYGARC_REG_SCSMR2_PE 0x20 // parity enable -#define CYGARC_REG_SCSMR2_OE 0x10 // parity mode -#define CYGARC_REG_SCSMR2_STOP 0x08 // stop bit length -#define CYGARC_REG_SCSMR2_CKS1 0x02 // clock select 1 -#define CYGARC_REG_SCSMR2_CKS0 0x01 // clock select 0 -#define CYGARC_REG_SCSMR2_CKSx_MASK 0x03 // mask +// SCIF2 +#define CYGARC_REG_SCIF_SCSMR2 0xffe80000 // Serial mode +#define CYGARC_REG_SCIF_SCBRR2 0xffe80004 // Bit rate +#define CYGARC_REG_SCIF_SCSCR2 0xffe80008 // Serial control +#define CYGARC_REG_SCIF_SCFTDR2 0xffe8000c // Transmit FIFO data +#define CYGARC_REG_SCIF_SCFSR2 0xffe80010 // Serial status +#define CYGARC_REG_SCIF_SCFRDR2 0xffe80014 // Receive data FIFO +#define CYGARC_REG_SCIF_SCFCR2 0xffe80018 // FIFO control register +#define CYGARC_REG_SCIF_SCFDR2 0xffe8001c // FIFO data count set +#define CYGARC_REG_SCIF_SCSPTR2 0xffe80020 // serial port register +#define CYGARC_REG_SCIF_SCLSR2 0xffe80024 // line status register + +// Serial Mode Register - normal mode +#define CYGARC_REG_SCIF_SCSMR_CHR 0x40 // character length (7 if set) +#define CYGARC_REG_SCIF_SCSMR_PE 0x20 // parity enable +#define CYGARC_REG_SCIF_SCSMR_OE 0x10 // parity mode +#define CYGARC_REG_SCIF_SCSMR_STOP 0x08 // stop bit length +#define CYGARC_REG_SCIF_SCSMR_CKS1 0x02 // clock select 1 +#define CYGARC_REG_SCIF_SCSMR_CKS0 0x01 // clock select 0 +#define CYGARC_REG_SCIF_SCSMR_CKSx_MASK 0x03 // mask + +// Serial Mode Register - IrDA mode alternative definitions +#define CYGARC_REG_SCIF_SCSMR_IRMOD 0x80 // IrDA Mode +#define CYGARC_REG_SCIF_SCSMR_ICK_MASK 0x78 // IR pulse width +#define CYGARC_REG_SCIF_SCSMR_PSEL 0x04 // IR pulse selector(?) + // Serial Control Register -#define CYGARC_REG_SCSCR2_TIE 0x80 // transmit interrupt enable -#define CYGARC_REG_SCSCR2_RIE 0x40 // receive interrupt enable -#define CYGARC_REG_SCSCR2_TE 0x20 // transmit enable -#define CYGARC_REG_SCSCR2_RE 0x10 // receive enable -#define CYGARC_REG_SCSCR2_CKE1 0x02 // clock enable 1 -#define CYGARC_REG_SCSCR2_CKE0 0x01 // clock enable 0 +#define CYGARC_REG_SCIF_SCSCR_TIE 0x80 // transmit interrupt enable +#define CYGARC_REG_SCIF_SCSCR_RIE 0x40 // receive interrupt enable +#define CYGARC_REG_SCIF_SCSCR_TE 0x20 // transmit enable +#define CYGARC_REG_SCIF_SCSCR_RE 0x10 // receive enable +#define CYGARC_REG_SCIF_SCSCR_CKE1 0x02 // clock enable 1 +#define CYGARC_REG_SCIF_SCSCR_CKE0 0x01 // clock enable 0 // Serial Status Register -#define CYGARC_REG_SCSSR2_PER_MASK 0xf000 // number of parity errors -#define CYGARC_REG_SCSSR2_PER_shift 12 -#define CYGARC_REG_SCSSR2_FER_MASK 0x0f00 // number of framing errors -#define CYGARC_REG_SCSSR2_FER_shift 8 -#define CYGARC_REG_SCSSR2_ER 0x0080 // receive error -#define CYGARC_REG_SCSSR2_TEND 0x0040 // transmit end -#define CYGARC_REG_SCSSR2_TDFE 0x0020 // transmit fifo data empty -#define CYGARC_REG_SCSSR2_BRK 0x0010 // break detection -#define CYGARC_REG_SCSSR2_FER 0x0008 // framing error -#define CYGARC_REG_SCSSR2_PER 0x0004 // parity error -#define CYGARC_REG_SCSSR2_RDF 0x0002 // receive fifo data full -#define CYGARC_REG_SCSSR2_DR 0x0001 // receive data ready +#define CYGARC_REG_SCIF_SCSSR_PER_MASK 0xf000 // number of parity errors +#define CYGARC_REG_SCIF_SCSSR_PER_shift 12 +#define CYGARC_REG_SCIF_SCSSR_FER_MASK 0x0f00 // number of framing errors +#define CYGARC_REG_SCIF_SCSSR_FER_shift 8 +#define CYGARC_REG_SCIF_SCSSR_ER 0x0080 // receive error +#define CYGARC_REG_SCIF_SCSSR_TEND 0x0040 // transmit end +#define CYGARC_REG_SCIF_SCSSR_TDFE 0x0020 // transmit fifo data empty +#define CYGARC_REG_SCIF_SCSSR_BRK 0x0010 // break detection +#define CYGARC_REG_SCIF_SCSSR_FER 0x0008 // framing error +#define CYGARC_REG_SCIF_SCSSR_PER 0x0004 // parity error +#define CYGARC_REG_SCIF_SCSSR_RDF 0x0002 // receive fifo data full +#define CYGARC_REG_SCIF_SCSSR_DR 0x0001 // receive data ready // When clearing the status register, always write the value: // CYGARC_REG_SCSSR2_CLEARMASK & ~bit // to prevent other bits than the one of interest to be cleared. -#define CYGARC_REG_SCSSR2_CLEARMASK 0x00f3 +#define CYGARC_REG_SCIF_SCSSR_CLEARMASK 0x00f3 // Serial FIFO Control Register -#define CYGARC_REG_SCFCR2_RTRG_MASK 0xc0 // receive fifo data trigger -#define CYGARC_REG_SCFCR2_RTRG_1 0x00 // trigger on 1 char -#define CYGARC_REG_SCFCR2_RTRG_4 0x40 // trigger on 4 chars -#define CYGARC_REG_SCFCR2_RTRG_8 0x80 // trigger on 8 chars -#define CYGARC_REG_SCFCR2_RTRG_14 0xc0 // trigger on 14 chars +#define CYGARC_REG_SCIF_SCFCR_RTRG_MASK 0xc0 // receive fifo data trigger +#define CYGARC_REG_SCIF_SCFCR_RTRG_1 0x00 // trigger on 1 char +#define CYGARC_REG_SCIF_SCFCR_RTRG_4 0x40 // trigger on 4 chars +#define CYGARC_REG_SCIF_SCFCR_RTRG_8 0x80 // trigger on 8 chars +#define CYGARC_REG_SCIF_SCFCR_RTRG_14 0xc0 // trigger on 14 chars -#define CYGARC_REG_SCFCR2_TTRG_MASK 0x30 // transmit fifo data trigger -#define CYGARC_REG_SCFCR2_TTRG_8 0x00 // trigger on 8 chars -#define CYGARC_REG_SCFCR2_TTRG_4 0x10 // trigger on 4 chars -#define CYGARC_REG_SCFCR2_TTRG_2 0x20 // trigger on 2 chars -#define CYGARC_REG_SCFCR2_TTRG_1 0x30 // trigger on 1 char +#define CYGARC_REG_SCIF_SCFCR_TTRG_MASK 0x30 // transmit fifo data trigger +#define CYGARC_REG_SCIF_SCFCR_TTRG_8 0x00 // trigger on 8 chars +#define CYGARC_REG_SCIF_SCFCR_TTRG_4 0x10 // trigger on 4 chars +#define CYGARC_REG_SCIF_SCFCR_TTRG_2 0x20 // trigger on 2 chars +#define CYGARC_REG_SCIF_SCFCR_TTRG_1 0x30 // trigger on 1 char -#define CYGARC_REG_SCFCR2_MCE 0x08 // modem control enable -#define CYGARC_REG_SCFCR2_TFRST 0x04 // transmit fifo reset -#define CYGARC_REG_SCFCR2_RFRST 0x02 // receive fifo reset -#define CYGARC_REG_SCFCR2_LOOP 0x01 // loop back test - +#define CYGARC_REG_SCIF_SCFCR_MCE 0x08 // modem control enable +#define CYGARC_REG_SCIF_SCFCR_TFRST 0x04 // transmit fifo reset +#define CYGARC_REG_SCIF_SCFCR_RFRST 0x02 // receive fifo reset +#define CYGARC_REG_SCIF_SCFCR_LOOP 0x01 // loop back test // Serial FIFO Data Count Set Register -#define CYGARC_REG_SCFDR2_RCOUNT_MASK 0x001f // number of chars in r fifo -#define CYGARC_REG_SCFDR2_RCOUNT_shift 0 -#define CYGARC_REG_SCFDR2_TCOUNT_MASK 0x1f00 // number of chars in t fifo -#define CYGARC_REG_SCFDR2_TCOUNT_shift 8 +#define CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK 0x001f // number of chars in r fifo +#define CYGARC_REG_SCIF_SCFDR_RCOUNT_shift 0 +#define CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK 0x1f00 // number of chars in t fifo +#define CYGARC_REG_SCIF_SCFDR_TCOUNT_shift 8 #endif // CYGARC_SH_MOD_SCIF diff --git a/packages/hal/sh/sh4/current/include/mod_regs_tmu.h b/packages/hal/sh/sh4/current/include/mod_regs_tmu.h --- a/packages/hal/sh/sh4/current/include/mod_regs_tmu.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_tmu.h @@ -5,29 +5,38 @@ // TMU (timer unit) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/mod_regs_ubc.h b/packages/hal/sh/sh4/current/include/mod_regs_ubc.h --- a/packages/hal/sh/sh4/current/include/mod_regs_ubc.h +++ b/packages/hal/sh/sh4/current/include/mod_regs_ubc.h @@ -5,29 +5,38 @@ // UBC (user break controller) Module register definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/sh4_scif.h b/packages/hal/sh/sh4/current/include/sh4_scif.h --- a/packages/hal/sh/sh4/current/include/sh4_scif.h +++ b/packages/hal/sh/sh4/current/include/sh4_scif.h @@ -5,29 +5,38 @@ // Simple driver for the sh4 Serial Communication Interface with FIFO // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/var_cache.h b/packages/hal/sh/sh4/current/include/var_cache.h --- a/packages/hal/sh/sh4/current/include/var_cache.h +++ b/packages/hal/sh/sh4/current/include/var_cache.h @@ -7,29 +7,38 @@ // Variant HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/var_intr.h b/packages/hal/sh/sh4/current/include/var_intr.h --- a/packages/hal/sh/sh4/current/include/var_intr.h +++ b/packages/hal/sh/sh4/current/include/var_intr.h @@ -8,29 +8,38 @@ // SH4 Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -111,6 +120,31 @@ #define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_INTERRUPT_SCIF_TXI +#if (CYGARC_SH_MOD_INTC == 2) + +#ifndef CYGHWR_HAL_SH_IRQ_USE_IRQLVL +# define CYGNUM_HAL_INTERRUPT_IRL0 CYGNUM_HAL_INTERRUPT_LVL0 +# define CYGNUM_HAL_INTERRUPT_IRL1 CYGNUM_HAL_INTERRUPT_LVL1 +# define CYGNUM_HAL_INTERRUPT_IRL2 CYGNUM_HAL_INTERRUPT_LVL2 +# define CYGNUM_HAL_INTERRUPT_IRL3 CYGNUM_HAL_INTERRUPT_LVL3 +#endif + +#define CYGNUM_HAL_INTERRUPT_PCISERR 66 +#define CYGNUM_HAL_INTERRUPT_PCIDMA3 67 +#define CYGNUM_HAL_INTERRUPT_PCIDMA2 68 +#define CYGNUM_HAL_INTERRUPT_PCIDMA1 69 +#define CYGNUM_HAL_INTERRUPT_PCIDMA0 70 +#define CYGNUM_HAL_INTERRUPT_PCIPWON 71 +#define CYGNUM_HAL_INTERRUPT_PCIPWDWN 72 +#define CYGNUM_HAL_INTERRUPT_PCIERR 73 + +#define CYGNUM_HAL_INTERRUPT_TUNI3 74 +#define CYGNUM_HAL_INTERRUPT_TUNI4 78 + +#undef CYGNUM_HAL_ISR_MAX +#define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_INTERRUPT_TUNI4 +#endif // (CYGARC_SH_MOD_INTC == 2) + // Exception vectors. These are the values used when passed out to an // external exception handler using cyg_hal_deliver_exception() diff --git a/packages/hal/sh/sh4/current/include/var_io.h b/packages/hal/sh/sh4/current/include/var_io.h --- a/packages/hal/sh/sh4/current/include/var_io.h +++ b/packages/hal/sh/sh4/current/include/var_io.h @@ -8,29 +8,38 @@ // Variant specific IO support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/include/var_regs.h b/packages/hal/sh/sh4/current/include/var_regs.h --- a/packages/hal/sh/sh4/current/include/var_regs.h +++ b/packages/hal/sh/sh4/current/include/var_regs.h @@ -7,29 +7,38 @@ // SH4 CPU definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -88,4 +97,8 @@ #include #include +#ifdef CYGARC_SH_MOD_PCIC +#include +#endif + #endif // CYGONCE_HAL_VAR_REGS_H diff --git a/packages/hal/sh/sh4/current/include/variant.inc b/packages/hal/sh/sh4/current/include/variant.inc --- a/packages/hal/sh/sh4/current/include/variant.inc +++ b/packages/hal/sh/sh4/current/include/variant.inc @@ -7,29 +7,38 @@ ## SH4 variant assembler header file ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## @@ -52,17 +61,17 @@ #include #=========================================================================== -# SR initialization value -# zero all bits except: -# MD = Processor operation mode field (privileged mode) -# I0-3 = Mask out all interrupts but NMI. -# -# When saving or restoring the state of an exception or interrupt, the bit -# CYGARC_REG_SR_RB is also set, switching the register bank. When this bit -# is set, interrupts must be disabled. -# -# Note: We could also use the BL bit to prevent interrupts, but that would -# also prevent the use of breakpoints. +## SR initialization value +## zero all bits except: +## MD = Processor operation mode field (privileged mode) +## I0-3 = Mask out all interrupts but NMI. +## +## When saving or restoring the state of an exception or interrupt, the bit +## CYGARC_REG_SR_RB is also set, switching the register bank. When this bit +## is set, interrupts must be disabled. +## +## Note: We could also use the BL bit to prevent interrupts, but that would +## also prevent the use of breakpoints. #define CYG_SR (CYGARC_REG_SR_MD|CYGARC_REG_SR_IMASK) #define CYG_SR_BANK1 (CYGARC_REG_SR_MD|CYGARC_REG_SR_IMASK|CYGARC_REG_SR_RB) @@ -93,6 +102,10 @@ mov.w r0,@r1 mov.l $CYGARC_REG_IPRC,r1 mov.w r0,@r1 +#if (CYGARC_SH_MOD_INTC == 2) + mov.l $CYGARC_REG_IPRD,r1 + mov.w r0,@r1 +#endif mov.w $nCYG_WTCSR,r0 ! Clear watchdog mov.l $nCYGARC_REG_WTCSR,r1 mov.w r0,@r1 @@ -134,6 +147,10 @@ .long CYGARC_REG_IPRB $CYGARC_REG_IPRC: .long CYGARC_REG_IPRC +#if (CYGARC_SH_MOD_INTC == 2) +$CYGARC_REG_IPRD: + .long CYGARC_REG_IPRD +#endif $nCYGARC_REG_WTCSR: .long CYGARC_REG_WTCSR $CYGARC_REG_ICR: @@ -150,12 +167,16 @@ 1: ##----------------------------------------------------------------------------- ## Interrupt decode macros - .macro hal_intc_decode tmp,inum - mov.l $nCYGARC_REG_INTEVT,\tmp + .macro hal_intc_decode tmp,inum + mov.l 1f,\tmp mov.l @\tmp,\inum mov #-5,\tmp ! divide cause by 0x20 shld \tmp,\inum - add #-14,\inum ! adjust so NMI becomes 0 + bra 2f + add #-14,\inum ! adjust so NMI becomes 0 + .align 2 +1: .long CYGARC_REG_INTEVT +2: .endm #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN diff --git a/packages/hal/sh/sh4/current/src/pcic.c b/packages/hal/sh/sh4/current/src/pcic.c new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh4/current/src/pcic.c @@ -0,0 +1,282 @@ +//========================================================================== +// +// pcic.c +// +// HAL PCI controller support +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2001-07-10 +// Purpose: Support for SH PCIC module +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +#include + +#include // diag_printf +#include // PCI definitions +#include // HAL header +#include // HAL interrupts/exceptions +#include // IO macros +#include +#include +#include + +void +cyg_hal_sh_pcic_pci_init(void) +{ + cyg_uint8 next_bus; + cyg_uint32 tmp; + + static int initialized = 0; + if (initialized) return; + initialized = 1; + + // PCI bus/wait state configs must match those used in the BSC. + HAL_READ_UINT32(CYGARC_REG_BCR1, tmp); + tmp |= 0x40000000; + HAL_WRITE_UINT32(CYGARC_REG_PCIC_BCR1, tmp); + HAL_READ_UINT16(CYGARC_REG_BCR2, tmp); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_BCR2, tmp); + HAL_READ_UINT32(CYGARC_REG_WCR1, tmp); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_WCR1, tmp); + HAL_READ_UINT32(CYGARC_REG_WCR2, tmp); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_WCR2, tmp); + HAL_READ_UINT32(CYGARC_REG_WCR3, tmp); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_WCR3, tmp); + HAL_READ_UINT32(CYGARC_REG_MCR, tmp); + tmp &= ~(CYGARC_REG_MCR_MRSET | CYGARC_REG_MCR_RFSH); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_MCR, tmp); + + // Unmask all PCI related interrupts + HAL_WRITE_UINT32(CYGARC_REG_PCIC_INTM, CYGARC_REG_PCIC_INTM_INIT); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_AINTM, CYGARC_REG_PCIC_AINTM_INIT); + + // Set host PCI config using platform specified parameters. + HAL_WRITE_UINT32(CYGARC_REG_PCIC_CFG+CYG_PCI_CFG_COMMAND, 0xfb9000c7); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_CFG+CYG_PCI_CFG_CLASS_REV, 0x00000000); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_CFG+CYG_PCI_CFG_CACHE_LINE_SIZE, 64<<8); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_CFG+CYG_PCI_CFG_BAR_0, CYGARC_REG_PCIC_BAR0_PLF_INIT); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_CFG+CYG_PCI_CFG_BAR_1, CYGARC_REG_PCIC_BAR1_PLF_INIT); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_CFG+CYG_PCI_CFG_BAR_2, CYGARC_REG_PCIC_BAR2_PLF_INIT); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_CFG+CYG_PCI_CFG_SUB_VENDOR, 0x35051054); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_LSR0, CYGARC_REG_PCIC_LSR0_PLF_INIT); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_LSR1, CYGARC_REG_PCIC_LSR1_PLF_INIT); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_LAR0, CYGARC_REG_PCIC_LAR0_PLF_INIT); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_LAR1, CYGARC_REG_PCIC_LAR1_PLF_INIT); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_CR, CYGARC_REG_PCIC_CR_INIT); + + // Configure PCI bus. + next_bus = 1; + cyg_pci_configure_bus(0, &next_bus); +} + +//-------------------------------------------------------------------------- +// Config space accessor functions +cyg_uint32 +cyg_hal_sh_pcic_pci_cfg_read_dword (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset) +{ + cyg_uint32 config_data; + + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PAR, + CYGARC_REG_PCIC_PAR_ENABLE | + (bus << CYGARC_REG_PCIC_PAR_BUSNO_shift) | + (devfn << CYGARC_REG_PCIC_PAR_FUNC_shift) | + (offset)); + HAL_READ_UINT32(CYGARC_REG_PCIC_PDR, config_data); + + return config_data; +} + +cyg_uint16 +cyg_hal_sh_pcic_pci_cfg_read_word (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset) +{ + cyg_uint32 config_dword; + + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PAR, + CYGARC_REG_PCIC_PAR_ENABLE | + (bus << CYGARC_REG_PCIC_PAR_BUSNO_shift) | + (devfn << CYGARC_REG_PCIC_PAR_FUNC_shift) | + (offset & ~3)); + HAL_READ_UINT32(CYGARC_REG_PCIC_PDR, config_dword); + + return (cyg_uint16)((config_dword >> ((offset & 3) * 8)) & 0xffff); +} + +cyg_uint8 +cyg_hal_sh_pcic_pci_cfg_read_byte (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset) +{ + cyg_uint32 config_dword; + + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PAR, + CYGARC_REG_PCIC_PAR_ENABLE | + (bus << CYGARC_REG_PCIC_PAR_BUSNO_shift) | + (devfn << CYGARC_REG_PCIC_PAR_FUNC_shift) | + (offset & ~3)); + HAL_READ_UINT32(CYGARC_REG_PCIC_PDR, config_dword); + + return (cyg_uint8)((config_dword >> ((offset & 3) * 8)) & 0xff); +} + +void +cyg_hal_sh_pcic_pci_cfg_write_dword (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint32 data) +{ + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PAR, + CYGARC_REG_PCIC_PAR_ENABLE | + (bus << CYGARC_REG_PCIC_PAR_BUSNO_shift) | + (devfn << CYGARC_REG_PCIC_PAR_FUNC_shift) | + (offset)); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PDR, data); +} + +void +cyg_hal_sh_pcic_pci_cfg_write_word (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint16 data) +{ + cyg_uint32 config_dword, shift; + + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PAR, + CYGARC_REG_PCIC_PAR_ENABLE | + (bus << CYGARC_REG_PCIC_PAR_BUSNO_shift) | + (devfn << CYGARC_REG_PCIC_PAR_FUNC_shift) | + (offset & ~3)); + HAL_READ_UINT32(CYGARC_REG_PCIC_PDR, config_dword); + + shift = (offset & 3) * 8; + config_dword &= ~(0xffff << shift); + config_dword |= (data << shift); + + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PAR, + CYGARC_REG_PCIC_PAR_ENABLE | + (bus << CYGARC_REG_PCIC_PAR_BUSNO_shift) | + (devfn << CYGARC_REG_PCIC_PAR_FUNC_shift) | + (offset & ~3)); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PDR, config_dword); +} + +void +cyg_hal_sh_pcic_pci_cfg_write_byte (cyg_uint32 bus, cyg_uint32 devfn, + cyg_uint32 offset, cyg_uint8 data) +{ + cyg_uint32 config_dword, shift; + + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PAR, + CYGARC_REG_PCIC_PAR_ENABLE | + (bus << CYGARC_REG_PCIC_PAR_BUSNO_shift) | + (devfn << CYGARC_REG_PCIC_PAR_FUNC_shift) | + (offset & ~3)); + HAL_READ_UINT32(CYGARC_REG_PCIC_PDR, config_dword); + + shift = (offset & 3) * 8; + config_dword &= ~(0xff << shift); + config_dword |= (data << shift); + + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PAR, + CYGARC_REG_PCIC_PAR_ENABLE | + (bus << CYGARC_REG_PCIC_PAR_BUSNO_shift) | + (devfn << CYGARC_REG_PCIC_PAR_FUNC_shift) | + (offset & ~3)); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_PDR, config_dword); +} + +//-------------------------------------------------------------------------- +// IO space accessor functions + +void +cyg_hal_sh_pcic_pci_io_write_byte (cyg_uint32 addr, cyg_uint8 data) +{ + HAL_WRITE_UINT32(CYGARC_REG_PCIC_IOBR, addr & CYGARC_REG_PCIC_IOBR_MASK); + HAL_WRITE_UINT8(CYGARC_REG_PCIC_IO_BASE + (addr & CYGARC_REG_PCIC_IO_BASE_MASK), + data); +} + +void +cyg_hal_sh_pcic_pci_io_write_word (cyg_uint32 addr, cyg_uint16 data) +{ + HAL_WRITE_UINT32(CYGARC_REG_PCIC_IOBR, addr & CYGARC_REG_PCIC_IOBR_MASK); + HAL_WRITE_UINT16(CYGARC_REG_PCIC_IO_BASE + (addr & CYGARC_REG_PCIC_IO_BASE_MASK), + data); +} + +void +cyg_hal_sh_pcic_pci_io_write_dword (cyg_uint32 addr, cyg_uint32 data) +{ + HAL_WRITE_UINT32(CYGARC_REG_PCIC_IOBR, addr & CYGARC_REG_PCIC_IOBR_MASK); + HAL_WRITE_UINT32(CYGARC_REG_PCIC_IO_BASE + (addr & CYGARC_REG_PCIC_IO_BASE_MASK), + data); +} + +cyg_uint8 +cyg_hal_sh_pcic_pci_io_read_byte (cyg_uint32 addr) +{ + cyg_uint8 data; + + HAL_WRITE_UINT32(CYGARC_REG_PCIC_IOBR, addr & CYGARC_REG_PCIC_IOBR_MASK); + HAL_READ_UINT8(CYGARC_REG_PCIC_IO_BASE + (addr & CYGARC_REG_PCIC_IO_BASE_MASK), + data); + return data; +} + +cyg_uint16 +cyg_hal_sh_pcic_pci_io_read_word (cyg_uint32 addr) +{ + cyg_uint16 data; + + HAL_WRITE_UINT32(CYGARC_REG_PCIC_IOBR, addr & CYGARC_REG_PCIC_IOBR_MASK); + HAL_READ_UINT16(CYGARC_REG_PCIC_IO_BASE + (addr & CYGARC_REG_PCIC_IO_BASE_MASK), + data); + return data; +} + +cyg_uint32 +cyg_hal_sh_pcic_pci_io_read_dword (cyg_uint32 addr) +{ + cyg_uint32 data; + + HAL_WRITE_UINT32(CYGARC_REG_PCIC_IOBR, addr & CYGARC_REG_PCIC_IOBR_MASK); + HAL_READ_UINT32(CYGARC_REG_PCIC_IO_BASE + (addr & CYGARC_REG_PCIC_IO_BASE_MASK), + data); + return data; +} diff --git a/packages/hal/sh/sh4/current/src/sh4_scif.c b/packages/hal/sh/sh4/current/src/sh4_scif.c --- a/packages/hal/sh/sh4/current/src/sh4_scif.c +++ b/packages/hal/sh/sh4/current/src/sh4_scif.c @@ -5,29 +5,38 @@ // Simple driver for the SH4 Serial Communication Interface with FIFO // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -73,14 +82,14 @@ cyg_hal_plf_scif_init_channel(const chan // Reset FIFO. HAL_WRITE_UINT16(base+_REG_SCFCR, - CYGARC_REG_SCFCR2_TFRST|CYGARC_REG_SCFCR2_RFRST); + CYGARC_REG_SCIF_SCFCR_TFRST|CYGARC_REG_SCIF_SCFCR_RFRST); // 8-1-no parity. HAL_WRITE_UINT16(base+_REG_SCSMR, 0); // Set desired baudrate HAL_READ_UINT16(base+_REG_SCSMR, tmp); - tmp &= ~CYGARC_REG_SCSMR2_CKSx_MASK; + tmp &= ~CYGARC_REG_SCIF_SCSMR_CKSx_MASK; tmp |= CYGARC_SCBRR_CKSx(CYGNUM_HAL_SH_SH4_SCIF_BAUD_RATE); HAL_WRITE_UINT16(base+_REG_SCSMR, tmp); HAL_WRITE_UINT8(base+_REG_SCBRR, @@ -99,11 +108,11 @@ cyg_hal_plf_scif_init_channel(const chan // Bring FIFO out of reset and set to trigger on every char in // FIFO (or C-c input would not be processed). HAL_WRITE_UINT16(base+_REG_SCFCR, - CYGARC_REG_SCFCR2_RTRG_1|CYGARC_REG_SCFCR2_TTRG_1); + CYGARC_REG_SCIF_SCFCR_RTRG_1|CYGARC_REG_SCIF_SCFCR_TTRG_1); // Leave Tx/Rx interrupts disabled, but enable Tx/Rx HAL_WRITE_UINT16(base+_REG_SCSCR, - CYGARC_REG_SCSCR2_TE|CYGARC_REG_SCSCR2_RE); + CYGARC_REG_SCIF_SCSCR_TE|CYGARC_REG_SCIF_SCSCR_RE); } static cyg_bool @@ -113,7 +122,7 @@ cyg_hal_plf_scif_getc_nonblock(void* __c cyg_uint16 fdr, sr; HAL_READ_UINT16(base+_REG_SCFDR, fdr); - if ((fdr & CYGARC_REG_SCFDR2_RCOUNT_MASK) == 0) + if ((fdr & CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK) == 0) return false; HAL_READ_UINT8(base+_REG_SCFRDR, *ch); @@ -121,7 +130,7 @@ cyg_hal_plf_scif_getc_nonblock(void* __c // Clear FIFO full flag (read before clearing) HAL_READ_UINT16(base+_REG_SCFSR, sr); HAL_WRITE_UINT16(base+_REG_SCFSR, - CYGARC_REG_SCSSR2_CLEARMASK & ~CYGARC_REG_SCSSR2_RDF); + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~CYGARC_REG_SCIF_SCSSR_RDF); return true; } @@ -147,19 +156,19 @@ cyg_hal_plf_scif_putc(void* __ch_data, c do { HAL_READ_UINT16(base+_REG_SCFDR, fdr); - } while (((fdr & CYGARC_REG_SCFDR2_TCOUNT_MASK) >> CYGARC_REG_SCFDR2_TCOUNT_shift) == 16); + } while (((fdr & CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK) >> CYGARC_REG_SCIF_SCFDR_TCOUNT_shift) == 16); HAL_WRITE_UINT8(base+_REG_SCFTDR, c); // Clear FIFO-empty/transmit end flags (read back SR first) HAL_READ_UINT16(base+_REG_SCFSR, sr); - HAL_WRITE_UINT16(base+_REG_SCFSR, CYGARC_REG_SCSSR2_CLEARMASK - & ~(CYGARC_REG_SCSSR2_TDFE | CYGARC_REG_SCSSR2_TEND )); + HAL_WRITE_UINT16(base+_REG_SCFSR, CYGARC_REG_SCIF_SCSSR_CLEARMASK + & ~(CYGARC_REG_SCIF_SCSSR_TDFE | CYGARC_REG_SCIF_SCSSR_TEND )); // Hang around until the character has been safely sent. do { HAL_READ_UINT16(base+_REG_SCFDR, fdr); - } while ((fdr & CYGARC_REG_SCFDR2_TCOUNT_MASK) != 0); + } while ((fdr & CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK) != 0); CYGARC_HAL_RESTORE_GP(); } @@ -226,7 +235,7 @@ cyg_hal_plf_scif_control(void *__ch_data irq_state = 1; HAL_INTERRUPT_UNMASK(chan->isr_vector); HAL_READ_UINT16(chan->base+_REG_SCSCR, scr); - scr |= CYGARC_REG_SCSCR2_RIE; + scr |= CYGARC_REG_SCIF_SCSCR_RIE; HAL_WRITE_UINT16(chan->base+_REG_SCSCR, scr); break; case __COMMCTL_IRQ_DISABLE: @@ -234,7 +243,7 @@ cyg_hal_plf_scif_control(void *__ch_data irq_state = 0; HAL_INTERRUPT_UNMASK(chan->isr_vector); HAL_READ_UINT16(chan->base+_REG_SCSCR, scr); - scr &= ~CYGARC_REG_SCSCR2_RIE; + scr &= ~CYGARC_REG_SCIF_SCSCR_RIE; HAL_WRITE_UINT16(chan->base+_REG_SCSCR, scr); break; case __COMMCTL_DBG_ISR_VECTOR: @@ -270,13 +279,13 @@ cyg_hal_plf_scif_isr(void *__ch_data, in *__ctrlc = 0; HAL_READ_UINT16(base+_REG_SCFDR, fdr); - if ((fdr & CYGARC_REG_SCFDR2_RCOUNT_MASK) != 0) { + if ((fdr & CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK) != 0) { HAL_READ_UINT8(base+_REG_SCFRDR, c); // Clear buffer full flag (read back first). HAL_READ_UINT16(base+_REG_SCFSR, sr); HAL_WRITE_UINT16(base+_REG_SCFSR, - CYGARC_REG_SCSSR2_CLEARMASK & ~CYGARC_REG_SCSSR2_RDF); + CYGARC_REG_SCIF_SCSSR_CLEARMASK & ~CYGARC_REG_SCIF_SCSSR_RDF); if( cyg_hal_is_break( &c , 1 ) ) *__ctrlc = 1; diff --git a/packages/hal/sh/sh4/current/src/var_misc.c b/packages/hal/sh/sh4/current/src/var_misc.c --- a/packages/hal/sh/sh4/current/src/var_misc.c +++ b/packages/hal/sh/sh4/current/src/var_misc.c @@ -5,29 +5,38 @@ // HAL miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -193,6 +202,70 @@ hal_interrupt_update_level(int vector) iprX |= (level)*CYGARC_REG_IPRC_SCIF_PRI1; HAL_WRITE_UINT16(CYGARC_REG_IPRC, iprX); break; +#if (CYGARC_SH_MOD_INTC == 2) +#ifndef CYGHWR_HAL_SH_IRQ_USE_IRQLVL + case CYGNUM_HAL_INTERRUPT_IRL0: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_IRL0_MASK; + iprX |= (level)*CYGARC_REG_IPRD_IRL0_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRL1: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_IRL1_MASK; + iprX |= (level)*CYGARC_REG_IPRD_IRL1_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRL2: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_IRL2_MASK; + iprX |= (level)*CYGARC_REG_IPRD_IRL2_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; + case CYGNUM_HAL_INTERRUPT_IRL3: + HAL_READ_UINT16(CYGARC_REG_IPRD, iprX); + iprX &= ~CYGARC_REG_IPRD_IRL3_MASK; + iprX |= (level)*CYGARC_REG_IPRD_IRL3_PRI1; + HAL_WRITE_UINT16(CYGARC_REG_IPRD, iprX); + break; +#endif + case CYGNUM_HAL_INTERRUPT_PCISERR: + { + cyg_uint32 intpri; + HAL_READ_UINT32(CYGARC_REG_INTPRI00, intpri); + intpri &= ~CYGARC_REG_INTPRI00_PCISERR_MASK; + intpri |= (level)*CYGARC_REG_INTPRI00_PCISERR_PRI1; + HAL_WRITE_UINT32(CYGARC_REG_INTPRI00, intpri); + break; + } + case CYGNUM_HAL_INTERRUPT_PCIDMA3 ... CYGNUM_HAL_INTERRUPT_PCIERR: + { + cyg_uint32 intpri; + HAL_READ_UINT32(CYGARC_REG_INTPRI00, intpri); + intpri &= ~CYGARC_REG_INTPRI00_PCIERR_MASK; + intpri |= (level)*CYGARC_REG_INTPRI00_PCIERR_PRI1; + HAL_WRITE_UINT32(CYGARC_REG_INTPRI00, intpri); + break; + } + case CYGNUM_HAL_INTERRUPT_TUNI3: + { + cyg_uint32 intpri; + HAL_READ_UINT32(CYGARC_REG_INTPRI00, intpri); + intpri &= ~CYGARC_REG_INTPRI00_TUNI3_MASK; + intpri |= (level)*CYGARC_REG_INTPRI00_TUNI3_PRI1; + HAL_WRITE_UINT32(CYGARC_REG_INTPRI00, intpri); + break; + } + case CYGNUM_HAL_INTERRUPT_TUNI4: + { + cyg_uint32 intpri; + HAL_READ_UINT32(CYGARC_REG_INTPRI00, intpri); + intpri &= ~CYGARC_REG_INTPRI00_TUNI4_MASK; + intpri |= (level)*CYGARC_REG_INTPRI00_TUNI4_PRI1; + HAL_WRITE_UINT32(CYGARC_REG_INTPRI00, intpri); + break; + } +#endif // CYGARC_SH_MOD_INTC case CYGNUM_HAL_INTERRUPT_RESERVED_1E0: case CYGNUM_HAL_INTERRUPT_RESERVED_3E0: case CYGNUM_HAL_INTERRUPT_RESERVED_5C0: @@ -225,6 +298,13 @@ hal_interrupt_set_level(int vector, int void hal_interrupt_mask(int vector) { +#ifdef CYGPKG_HAL_SH_7751 + if (vector >= CYGNUM_HAL_INTERRUPT_PCISERR && vector <= CYGNUM_HAL_INTERRUPT_TUNI4) { + HAL_WRITE_UINT32(CYGARC_REG_INTMSK00, 1 << (vector - CYGNUM_HAL_INTERRUPT_PCISERR)); + return; + } +#endif + switch( vector ) { case CYGNUM_HAL_INTERRUPT_NMI: break; @@ -250,6 +330,13 @@ hal_interrupt_mask(int vector) void hal_interrupt_unmask(int vector) { +#ifdef CYGPKG_HAL_SH_7751 + if (vector >= CYGNUM_HAL_INTERRUPT_PCISERR && vector <= CYGNUM_HAL_INTERRUPT_TUNI4) { + HAL_WRITE_UINT32(CYGARC_REG_INTMSKCLR00, 1 << (vector - CYGNUM_HAL_INTERRUPT_PCISERR)); + return; + } +#endif + switch( (vector) ) { case CYGNUM_HAL_INTERRUPT_NMI: break; diff --git a/packages/hal/sh/sh4/current/src/var_mk_defs.c b/packages/hal/sh/sh4/current/src/var_mk_defs.c --- a/packages/hal/sh/sh4/current/src/var_mk_defs.c +++ b/packages/hal/sh/sh4/current/src/var_mk_defs.c @@ -5,29 +5,38 @@ // HAL (variant) "make defs" program // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/sh/sh4/current/src/variant.S b/packages/hal/sh/sh4/current/src/variant.S --- a/packages/hal/sh/sh4/current/src/variant.S +++ b/packages/hal/sh/sh4/current/src/variant.S @@ -5,29 +5,38 @@ ## SH4 variant assembly code ## ##========================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##========================================================================== #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/sparc/arch/current/ChangeLog b/packages/hal/sparc/arch/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/ChangeLog @@ -0,0 +1,694 @@ +2002-04-29 Jonathan Larmour + + * src/vectors.S: + * src/vec_xvsr.S: + * src/vec_ivsr.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-03-18 Hugo Tyson + + * src/vectors.S: Add CYGPKG_HAL_SPARC_ERC32 to list of ifdefs. + +2000-10-16 Jonathan Larmour + + * include/hal_arch.h (CYGARC_JMP_BUF_SIZE): Define hal_jmp_buf in + terms of this. + +2000-08-07 Jonathan Larmour + + * src/sparclite.ld: Remove extra underscore from below. It was + correct before. + +2000-06-21 Nick Garnett + + * include/basetype.h: + Removed definition of CYG_LABEL_NAME(). Now dealt with by default + definition in cyg_type.h. + + * src/sparclite.ld: + Added extra underscore to _stext and _etext. + Switched over to new table creation mechanism. + +2000-06-08 Jesper Skov + + * include/hal_arch.h (CYGARC_HAL_SAVE_GP, CYGARC_HAL_RESTORE_GP): + Added. + +2000-02-16 Jesper Skov + + * src/vectors.S: + * src/hal_boot.c: + CYG_HAL_SPARCLITE_ > CYGPKG_HAL_SPARCELITE_ + +2000-02-16 Jesper Skov + + * cdl/hal_sparclite.cdl: removed fix me + +2000-01-28 Gary Thomas + + * src/sparclite.ld: Add support for network package. + +2000-01-19 Hugo Tyson + + * cdl/*.cdl: Add descriptions to a number of options &c which were + lacking same, also tidied up other typos as noticed en passant. + +1999-12-02 John Dallaway + + * cdl/hal_sparclite.cdl: + + Use the token in custom rules. + +1999-12-01 John Dallaway + + * cdl/hal_sparclite.cdl: + + Use the token in custom rules. + +1999-11-04 John Dallaway + + * cdl/hal_sparclite.cdl: + + Output custom rule dependency information to .deps files in + the current directory. + + Dispense with the need to create a 'src' sub-directory. + +1999-11-03 John Dallaway + + * cdl/hal_sparclite.cdl: Define build options. + +1999-11-01 Jesper Skov + + * cdl/hal_sparclite.cdl: Addded. + +1999-10-15 Hugo Tyson + + * src/vectors.S (not_window_overflow): Actually the dispatcher + into exception VSRs. Bugfix: wrong number was placed in %l3 for + call to xvsr, so for *some* types of trap, including user traps + other than those handled directly in-HAL, a vector way off the end + of the array would be used. Apparently those other types of trap + never happen, but just in case... + +1999-10-13 Hugo Tyson + + * src/vectors.S: Optionally implement Multiple (rather than + Single) Vector Trapping. The config options to control this are + in the platform HAL because some SPARCs do not support SVT, where + it is optional the platform says so. This demands a variable + sized region be reserved for trampoline code or the vectors in + RAM, which is done via section .ram_vectors, defined herein. + + * src/sparclite.ld: Define SECTION_ram_vectors(...) to deal with + the new .ram_vectors section. This is to provide a variable sized + area at the start of RAM to hold either trampoline code when SVT + is selected, or a fill 4k + handlers of vectors when MVT is + selected. Previously this was bodged by pretending RAM starts at + 0x4000200 in ROM startup builds. + (comment from the example .ldi files...) + The ram_vectors section is to allow some free space to copy + vectors into from the ROM. This is required to be variable size + to accomodate SVT or MVT; 80 bytes vs 4kB. Copying is not + necessary with MVT, but it is optional because it may offer + performance gains. Copying is required for SVT because the + (aligned) start of ROM contains initialization instructions. RAM + copy is used rather than leave a big gap in the ROM to get an + aligned address for the trampoline code. For RAM startup, + ram_vectors will usually be of size zero, unless MVT and copying + are enabled for memory estimation reasons. + +1999-09-29 Hugo Tyson + + [src/vectors.S: needed no change!] + + * include/vectors.h: Potentially accept a register window count + from the platform HAL, or according to platform selection. Make + more of the dependent macros computed. + + * src/vec_ivsr.S (hal_default_interrupt_vsr): Handle other register + window sizes correctly; particularly when handling underflow trap + by hand. + + * src/vec_xvsr.S (hal_default_exception_vsr): Handle other register + window sizes correctly; particularly when handling underflow trap + by hand. + + * src/context.S (hal_thread_load_context): Handle other register + window sizes correctly. + + * src/icontext.c (cyg_hal_sparc_get_gdb_regs): Handle other register + window sizes correctly; set up initial context differently. + +1999-06-07 Hugo Tyson + + * include/hal_arch.h (hal_jmp_buf): force this to be 64-bit + aligned so that std ops in hal_setjmp(), hal_longjmp() work. + +1999-06-03 Hugo Tyson + + * src/hal_boot.c: Add a dummy __gccmain() to prevent ctors being + called twice. This seems to be a recent compiler change: + [from gcc/ChangeLog] + Sat May 22 18:18:43 1999 Jason Merrill + * sparc/liteelf.h: Handle ctors like MIPS crosses. + * sparc/lite.h (STARTFILE_SPEC, LIB_SPEC): Define to "". + * configure.in: Don't use libgloss.h on sparclite-elf. + Use collect2 on sparclite-aout. + +1999-05-20 Hugo Tyson + + * include/hal_intr.h (HAL_INTERRUPT_STACK_CALL_PENDING_DSRS): + Define this if CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK; + ie. we are running a separate interrupt stack. Also define + symbols for it so that we can monitor its usage easily. + + * src/vec_ivsr.S (hal_interrupt_stack_call_pending_DSRs): Add this + function to run DSRs on the interrupt stack (if using it). Switch + over to executing on the interrupt stack when needed. + + * src/vectors.S (cyg_interrupt_stack_base): Define the interrupt + stack either if we need it as an interrupt stack or if we need it + as a bootup stack (simulator); if it's there, use it as a bootup + stack anyway. + + * src/context.S (hal_thread_load_context): Install the PSR that + was saved in its entirety, including the interrupt and trap enable + state. This is needed for running a separate interrupt stack, but + harmless when not so doing. + + * src/icontext.c (hal_thread_init_context): Install an initial PSR + which includes ET, S and PS (Enable traps, Supermode, prevSuper) + and a PIL (processor interrupt level) of 15 (maximum) + so that a context switch which preserves interrupt mode will work. + +1999-05-13 Hugo Tyson + + * include/hal_arch.h (HAL_THREAD_INIT_CONTEXT): Align stack + (rather conservatively) before use. + +1999-04-28 Bart Veer + + * src/PKGconf.mak: + Remove the -n argument to tail, it does not appear to be required + on any supported host and causes problems with some + implementations of tail. + +1999-04-15 Jonathan Larmour + + * src/sparclite.ld: Define __bss_end at the end of the BSS + * src/hal_boot.c (hal_zero_bss): Stop at __bss_end rather than _end + when clearing BSS + + These fix PR 19750 + +1999-04-14 Jonathan Larmour + + * src/PKGconf.mak (EXTRAS): Don't generate extras.o here any more + But do define EXTRAS every time for the linker script. + +1999-04-09 Hugo Tyson + + * include/hal_intr.h (HAL_RESTORE_INTERRUPTS et al): Put in 3 nops + after any writes to the psr; TBH I don't think they're strictly + necessary when not altering the window state, but for complete + safety and adherence to the book of words.... + +1999-04-08 John Dallaway + + * src/*.ld: Revised SECTION_* macro arguments to + avoid padded output sections (PR 19787) + +1999-04-07 Hugo Tyson + + * include/hal_io.h: If not the simulator, get hal_hwio.h too - + which describes board-and-CPUvariant-specific IO needs. + +1999-04-07 Hugo Tyson + + * include/hal_intr.h (HAL_VSR_SET_TO_ECOS_HANDLER): Define this + macro for use in tests that are interested in exception diddling. + Redefine CYGNUM_HAL_ISR_MIN to describe the number of interrupt + sources; while there are XSRs too, this definition is better for + the error checking in kernel interrupt stuff. Changed the symbols + used for defining tables sizes to match, since there are still 27 + VSRs and ISRs/XSRs and their data. + + * src/hal_intr.c: Use the correct symbol for the size of the + isr/vsr/their-data tables. + +1999-03-26 Hugo Tyson + + * tests/sparc_ex.c (cyg_[user_]start): + If there is no kernel, cyg_user_start() is never called, main gets + in and steals the CPU. So we hang. So if there is no kernel, + define cyg_start() instead to wrest control. + +1999-03-22 Hugo Tyson + + * include/hal_arch.h (CYGNUM_HAL_STACK_SIZE_TYPICAL): + And this time make the edit correctly ;-/ + +1999-03-22 Hugo Tyson + + * include/hal_arch.h: + Use CYGNUM_HAL_STACK_SIZE_TYPICAL for the stack size instead of + CYGNUM_HAL_MINIMUM_STACK_SIZE. + +1999-03-17 Hugo Tyson + + * src/vectors.S (rom_vectors_end, rom_vectors): Add two new + symbols for copying trampoline code into RAM in ROM startup. This + keeps ROM startup as similar as possible to RAM, for simplicity; + no re-ordering of vectors.S's contents. + + * src/hal_boot.c (hal_copy_data): Copy in long sized units rather + than long longs, better to cope with ROM data alignment. + Also add some LED output (if SLEB hardware) for startup to help + with debugging ROM start. + +1999-03-17 John Dallaway + + * src/PKGconf.mak: Remove dependence on echo '-e' switch. + +1999-03-16 Hugo Tyson + + * src/vectors.S (genuine_reset): Add a little extra debug to SLEB + LEDs, and use the genuine top-of-memory stack when running on + hardware; only define cyg_bootup_stack in the simulator case. + + * src/sparclite.ld: Define rom_data_start, regardless of start + type, no harm is done. + +1999-03-12 Gary Thomas + + * include/pkgconf/hal_sparclite.h: + * include/hal_arch.h: Moved definition of 'CYGNUM_HAL_MINIMUM_STACK_SIZE' + +1999-03-11 Hugo Tyson + + * src/icontext.c (cyg_hal_sparc_[gs]et_gdb_regs): + Two new routines to communicate our nice, optimized stack save + states to a reg list for GDB. My maximal register saves are not + really suitable for passing to GDB in any case, they're for humans + to debug the interrupt code more than anything else, and my + minimal save sets naturally contain pointers and ways of finding + the rest of the reg set, but it depends on whether it's an + interrupt save or a synchronous one, and given the SPARClite's + stack layout, it's a bit hairy. + + * src/vec_ivsr.S (hal_default_interrupt_vsr): + Do save %g0 even in a minimal context, so that the code for + communicating register state with GDB can tell it's a minimum + context. Costs one store cycle per interrupt. + + * include/hal_arch.h (HAL_[GS]ET_GDB_REGISTERS): + Define and call routines cyg_hal_sparc_[gs]et_gdb_regs for + communicating register state of a thread to GDB. + + * src/vectors.S (real_vector): Reinstate the anullment of the + instructions that were blamed for register corruption earlier; + they are correct and safe. + +1999-03-10 Jesper Skov + + * include/hal_intr.h (HAL_INTERRUPT_IN_USE): Added. + +1999-03-09 Gary Thomas + + * src/hal_boot.c: Added missing include file. + +1999-03-05 Gary Thomas + + * src/sparclite.ld: + * src/PKGconf.mak: Clean up I/O package changes. + +1999-03-04 Jonathan Larmour + + * src/sparclite.ld: + Unconditionalize use of libextras.a and add to GROUP() + +1999-03-04 Gary Thomas + + * src/PKGconf.mak: + * src/sparclite.ld: New I/O package support. + + * src/vectors.S: Fix register corruption problem - stems from + use of annulled instructions in window overflow/underflow code. + +1999-02-25 Hugo Tyson + + These log entries from 1999-02-22 to 1999-02-24 were executed in + a branch; this change is a merge of that branch into the trunk. + + (1999-02-24 Hugo Tyson ) + + * tests/sparc_ex.c (sparc_ex_main): + For all traps except the USER_TRAP, install the default VSR + hal_default_exception_vsr(); this is so that this test catches + exception ie. is able to work, even when we are playing nice with + CygMon and GDB. The USER_TRAP is left so that breakpoints work, + for the test infrastructure. + + (1999-02-22 Hugo Tyson ) + + * src/vectors.S (real_vector): Remove old testing code. Add delay + NOPs after writes to %wim and %psr for safety. Leave installing + the trap vector to platform-specific code, along with RAM control + and cache initialization. + + * src/vec_ivsr.S (hal_default_interrupt_vsr): Add delay NOPs after + writing the %wim before doing a restore; that was a bug that was. + + * src/vec_xvsr.S (hal_default_exception_vsr): same change. + + * src/hal_intr.c: Remove platform-specific clock period variable; it + happens that both platforms sim and sleb have one, but it's not a + requirement of the target architecture. + + * src/hal_boot.c (cyg_hal_start): Move diddling the sim-specific + watchdog into platform-specific startup code viz. new routines + hal_board_{pre/post}start(). + + * src/context.S: a couple of extra NOPs to ensure that %wim and + %psr changes work on real hardware. + + (1999-02-22 Hugo Tyson ) + + * include/hal_arch.h (HAL_SET_GDB_REGISTERS): + Remove warning about unused var 'cos of the incompleteness of + these macros; gdb interworking is not yet supported. + +1999-02-25 Nick Garnett + + * include/vectors.h: + Changed label used to access scheduler lock to one that is not + mangled by C++. This is intended to make support for interrupt + handling in non-kernel configurations easier. + +1999-02-20 Jonathan Larmour + + * include/hal_arch.h: + Rename deliver_exception() -> cyg_hal_deliver_exception() + QA improvements + + * include/hal_intr.h: + Reorganise vector/interrupt/exception names according to purpose + Rename exception_handler() -> cyg_hal_exception_handler() + QA improvements + + * src/hal_intr.c: + Rename exception_handler() -> cyg_hal_exception_handler() + Rename deliver_exception() -> cyg_hal_deliver_exception() + Rename CYG_ISR_COUNT -> CYGNUM_HAL_ISR_COUNT + QA improvements + + * src/vec_ivsr.S: + * src/vec_xvsr.S: + Rename CYG_ISR_COUNT -> CYGNUM_HAL_ISR_COUNT + QA improvements + + * tests/sparc_ex.c: + Rename CYG_EXCEPTION_* -> CYGNUM_HAL_EXCEPTION_* + Rename CYG_VECTOR_UNALIGNED -> CYGNUM_HAL_VECTOR_UNALIGNED + +1999-02-12 Hugo Tyson + + * src/context.S (hal_thread_load_context, hal_setjmp): + Disable interrupts (but not traps) while doing the flush of all my + callers and their callers' callers register sets to the stack. + There is evidence that the inconsistency in the stack during this + is a bad thing, though I have to admit that I don't see exactly + how it goes wrong. Partly, it's impossible to debug, so if the + problem I saw (a SEGV in instrumentation of interrupt_end()) is + reproduced with this change, I'll have more to go on. This is a + conservative change in that sense. + + * include/hal_arch.h (HAL_FLUSH_REGISTERS_TO_STACK): + Disable interrupts but not traps while doing this. Ditto. + +1999-02-12 Hugo Tyson + + * include/pkgconf/hal_sparclite.h (CYGNUM_HAL_MINIMUM_STACK_SIZE): + Define a minimal sensible stack size for apps to use. Note that + this file is included by hal_arch.h and so is available to all HAL + users, and in fact almost everyone by default. + +1999-02-12 Hugo Tyson + + * src/hal_intr.c (exception_handler): + Include so that the CYG_FAIL() in some + configurations actually compiles (actually: links). + combo{22,18,10,6} were thus afflicted. + +1999-02-11 Hugo Tyson + + * tests/sparc_ex.c (do_test): Make the test run for much less time + when CYG_USE_TRACING and in any case bleat periodically about how + successful it is to prevent testing system timeouts. Also move + the test routines (those which provoke the exception) to the end + so that (ever helpful) -O3 cannot inline them and then "optimize" + the result and thus spoil the whole damned test too. + +1999-02-08 John Dallaway + + * include/pkgconf/hal_sparclite.h: Correct capitalization of + 'SPARClite'. + +1999-02-08 John Dallaway + + * src/sparclite.ld: New MLT-compatible linker script + * src/PKGconf.mak: Add build rules for sparclite.ld + +1999-02-04 Hugo Tyson + + * src/vec_ivsr.S (hal_default_interrupt_vsr): Preserve global + registers over interrupts, and implement support for + CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT ie. save a + minimal register set rather than a maximal. Create a saved + register set whose address is passed to the interrupt handler + (though it may well be mostly empty). + [also tidied up trailing tabs and long blank lines] + + * src/vec_xvsr.S (hal_default_exception_vsr): Preserve all + registers over interrupts; create a saved register set whose + address is passed to the exception handler so it can modify it. + [also tidied up trailing tabs and long blank lines] + + * src/context.S( hal_setjmp, hal_longjmp): + (hal_thread_switch_context,hal_thread_load_context): Implement + CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM support; ie. save a minimal + register set rather than a maximal. + + * include/hal_arch.h (HAL_FLUSH_REGISTERS_TO_STACK): New macro + useful for writing exception handlers, for example. + (HAL_GET_GDB_REGISTERS, HAL_SET_GDB_REGISTERS): provided initial + dummy versions of these. + + * tests/sparc_ex.c: A test of the exception mechanism: + deliberately cause unaligned accesses of various sizes and check + we get exactly one trap and correctly step over it by modifying + the saved register set whose address the exception ISR is handed. + This test should be regarded as documentation for the exception + handler API/ABI. + + * tests/PKGconf.mak (TESTS): Build sparc_ex. + +1999-02-01 Hugo Tyson + + * src/vectors.S (genuine_reset): + Include to set up RAM controllers, cache and + the like - this is rather platform dependant. + +1999-02-01 Hugo Tyson + + * include/hal_intr.h (HAL_TRANSLATE_VECTOR): + Include a definition of this important macro. Not. + It's used when interrupt chaining is selected, BUT we the HAL make + no distinction, it's up to the kernel to look after things. So + this macro is an assignment. + +1999-01-28 Hugo Tyson + + * include/hal_intr.h: + Get interrupt controller definitions from a board-specific file: + #include + Get clock control definitions from a board-specific file: + #include + Delete the original definitions from this central file. + + * include/hal_cache.h: REMOVED to the simulator tree in the first + instance; more generally to various board-specific files. + + +1999-01-26 Hugo Tyson + + * include/hal_cache.h (HAL_DCACHE_ENABLE) (and its friends): + Define initial empty placeholder versions of these so that cache + tests build. Well it's a start. + +1999-01-21 Jonathan Larmour + + * src/hal_boot.c (cyg_hal_invoke_constructors): + Add code to deal with CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG + Tidy up and update description header + Shorten needlessly long lines + Remove all traces of non-CYG_KERNEL_USE_INIT_PRIORITY code + +1999-01-21 Hugo Tyson + + * src/vectors.S (genuine_reset): Set the RAM size to 4MB in the + erc32 simulator. + + * include/hal_io.h: New file; macros to access IO space, really a + place holder at present. + + * include/hal_intr.h: Do not define WATCHDOG() macro. + + * src/hal_intr.c (hal_default_isr): Do not mess with the watchdog + in the the default interrupt handler. + + * src/hal_boot.c (hal_zero_bss): use an efficient 8-byte zero. + (hal_copy_data): use an efficient 8-byte copy. + (cyg_hal_start): turn off the ERC32 watchdog timer before we start + anything very time consuming. + + NB: the 8-byte copy changes require alignment in the linker + script: see the Changelog in hal/sparclite/sim/... for details. + +1999-01-19 Hugo Tyson + + Modified files in arch: + * include/hal_arch.h + * include/hal_intr.h + * src/PKGconf.mak + * src/context.S + * src/hal_intr.c + * src/vec_ivsr.S + * src/vec_xvsr.S + * src/vectors.S + + New files in arch: + * src/hal_boot.c (bss initialization, constructors &c) + * include/hal_cache.h (empty but required header) + + Modified files in sim: + * include/hal_diag.h + + Lots more progress; essentially, everything now works. + + Simulator's treatment of stdio is poor though, it doesn't work + under pkgtest. This has been slowing me up. + +1999-01-14 Hugo Tyson + + * ecc/ecc/hal/sparclite/...: + + Initial checkin of SPARClite HAL; it doesn't work yet, except the + most trivial of tests - timer and interrupt manipulation stuff is + entirely absent. + + Here's some documentation of the initial checkin tree; this will + change, as platform dependent stuff moves correctly into the sim + or directories. + + arch/current/include: + basetype.h nothing much here. + vectors.h definitions of symbols shared between the + various vector code assembler files, can be + included in both C and assembler. + hal_intr.h various macros for clock and interrupt + control plus the eCos vector numbering scheme; we + map thus: + what SPARC trap type eCos vector numbers + ----------------------------------------------- + (not used) --- 0 + interrupts (17-31) 1-15 + user traps (128-255) 16 + exceptions (1-9,36==4) 17-25 + others (10,?) 26 + ----------------------------------------------- + Trap types 5 and 6 which would be eCos vectors 21 + and 22 are handled in the trampoline code in + file src/vectors.S + hal_arch.h definition of a thread context, plus + macros for thread switching and the like. Some + ancillary bit twiddling macros and cache barriers + too. + + arch/current/include/pkgconf: + hal_sparclite.h pkgconf config/header file. + + arch/current/src: + vectors.S boot-up stuff, trampoline code that hangs + on the interrupt/trap vector, handlers for window + under/overflow. Saves some state in registers + then jumps to the interrupt or exception VSR + respectively. + Also instantiates the VSR table. + vec_ivsr.S the default interrupt VSR; it establishes + a C calling environment (ie. anticipates a window + overflow) then locks the scheduler, calls the ISR + with appropriate arguments, and then interrupt_end() + before undoing that environment, anticipating + window underflow and returning to the interrupted + instruction. + vec_xvsr.S the default exception AKA trap VSR; does + the same as the interrupt one but without the + scheduler lock or interrupt end. + hal_intr.c instantiates the ISR table used by the + code above. + context.S context switch code, saves and loads up a + whole register state, coroutine or longjump-like. + icontext.c initializes a context to "jump" to in + context.S at the birth of a new thread. + + sim/current/include: + hal_diag.h macros to deal with debugging output via a + fake serial device of some kind; initially empty, + but definitely board/sim dependent. + + sim/current/include/pkgconf: + hal_sparclite_sim.h pkgconf config/header file. + + sim/current/src: + sim.ld linker script bits for "sim" target. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + +//EOF ChangeLog diff --git a/packages/hal/sparc/arch/current/cdl/hal_sparc.cdl b/packages/hal/sparc/arch/current/cdl/hal_sparc.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/cdl/hal_sparc.cdl @@ -0,0 +1,131 @@ +# ==================================================================== +# +# hal_sparc.cdl +# +# SPARC architectural HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: hmt +# Contributors: +# Date: 1999-11-01, 2002-03-08 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_SPARC { + display "SPARC architecture" + parent CYGPKG_HAL + hardware + include_dir cyg/hal + define_header hal_sparc.h + description " + The SPARC architecture HAL package provides generic support + for this processor architecture. It is also necessary to select + a specific target platform HAL package." + + compile vectors.S vec_ivsr.S vec_xvsr.S context.S icontext.c + compile hal_intr.c hal_boot.c + + make { + /lib/vectors.o : /src/vectors.S + $(CC) -Wp,-MD,vectors.tmp $(INCLUDE_PATH) $(CFLAGS) -c -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 vectors.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm vectors.tmp + } + + make { + /lib/target.ld: /src/sparc.ld + $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail +2 target.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm target.tmp + } + + cdl_component CYGPKG_HAL_SPARC_OPTIONS { + display "SPARC build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_HAL_SPARC_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the SPARC HAL. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_HAL_SPARC_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the SPARC HAL. These flags are removed from + the set of global flags if present." + } + + cdl_option CYGPKG_HAL_SPARC_TESTS { + display "SPARC tests" + flavor data + no_define + calculated { "tests/sparc_ex" } + description " + This option specifies the set of tests for the SPARC HAL." + } + } + + cdl_option CYGBLD_LINKER_SCRIPT { + display "Linker script" + flavor data + no_define + calculated { "src/sparc.ld" } + } +} diff --git a/packages/hal/sparc/arch/current/include/basetype.h b/packages/hal/sparc/arch/current/include/basetype.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/include/basetype.h @@ -0,0 +1,74 @@ +#ifndef CYGONCE_HAL_BASETYPE_H +#define CYGONCE_HAL_BASETYPE_H + +//============================================================================= +// +// basetype.h +// +// Standard types for this architecture. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas, hmt +// Contributors: nickg, gthomas, hmt +// Date: 1998-12-10 +// Purpose: Define architecture base types. +// Usage: Included by "cyg_type.h", do not use directly + +// +//####DESCRIPTIONEND#### +// + +//----------------------------------------------------------------------------- +// Characterize the architecture + +#define CYG_BYTEORDER CYG_MSBFIRST // Big endian + +//----------------------------------------------------------------------------- +// SPARC does not usually use labels with underscores. + +//#define CYG_LABEL_NAME(_name_) _name_ + +//----------------------------------------------------------------------------- +// Define the standard variable sizes + +// The SPARC architecture uses the default definitions of the base +// types, so we do not need to define any here. + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_BASETYPE_H +// End of basetype.h diff --git a/packages/hal/sparc/arch/current/include/hal_arch.h b/packages/hal/sparc/arch/current/include/hal_arch.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/include/hal_arch.h @@ -0,0 +1,371 @@ +#ifndef CYGONCE_HAL_ARCH_H +#define CYGONCE_HAL_ARCH_H + +//========================================================================== +// +// hal_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas, hmt +// Contributors: nickg, gthomas, hmt +// Date: 1999-02-20 +// Purpose: Define architecture abstractions +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +#include + +#include // HAL_DISABLE_INTERRUPTS + +//-------------------------------------------------------------------------- +// Processor saved states: +// +// All these structures must be doubleword (64 bit) aligned. +// The code that creates them on the stack will ensure this is so. + +#define HAL_THREAD_CONTEXT_GLOBAL_BASE 0 +#define HAL_THREAD_CONTEXT_OUT_BASE 8 +#define HAL_THREAD_CONTEXT_LOCAL_BASE 16 +#define HAL_THREAD_CONTEXT_IN_BASE 24 + +typedef struct +{ + // this is the save structure found at *(stack_ptr) always, note that + // i[6] is the frame pointer is the previous stack pointer, and + // o[6] is the stack pointer is the next frame pointer, + // so they form a linked list back up the call stack. + cyg_uint32 l[8]; /* Locals r16-r23 */ + cyg_uint32 i[8]; /* Ins r24-r31 */ +} HAL_SavedWindow; + +typedef struct +{ + // Window save at stack pointer + HAL_SavedWindow li; +//16 + // This is the rest of the save state: + // NOTE: g[0] is used for the CWP, for %g0 == 0. Also note that the + // assembler routines must load/store it in the right order. + cyg_uint32 g[8] ; /* Globals r0- r7 */ + cyg_uint32 o[8] ; /* Outs r8-r15 */ +//32 words in size + +// There is no need to save any other state; for example, condition codes, +// the PC and NextPC, and Y, are preserved in local registers in the trap +// handling window and so preserved in the caller stack frame as viewed +// from an ISR. Note that the VSR is jumped to with those locals being set +// up (and Y in situ), and it must preserve them itself before calling any +// subsequent handlers (ISRs). + +} HAL_SavedRegisters; + + +typedef struct +{ + // Window save at stack pointer + HAL_SavedWindow li; + cyg_uint32 composite_return_ptr; /* structure returns */ + cyg_uint32 spill_args[6]; /* for callee to store */ + cyg_uint32 spare; /* keep this 64-bits */ +} HAL_FrameStructure; + + +//-------------------------------------------------------------------------- +// Exception handling function. +// This function is defined by the kernel according to this prototype. It is +// invoked from the HAL to deal with any CPU exceptions that the HAL does +// not want to deal with itself. It usually invokes the kernel's exception +// delivery mechanism. + +externC void cyg_hal_deliver_exception( CYG_WORD code, CYG_ADDRWORD data ); + +//-------------------------------------------------------------------------- +// Bit manipulation macros +#ifndef CYGPKG_HAL_SPARC_SCAN +/* Most sparc's does not have 'scan' instruction */ +externC cyg_uint32 hal_lsbit_index(cyg_uint32 mask); +externC cyg_uint32 hal_msbit_index(cyg_uint32 mask); +#define HAL_LSBIT_INDEX(index, mask) index = hal_lsbit_index(mask); +#define HAL_MSBIT_INDEX(index, mask) index = hal_msbit_index(mask); +#else +#define HAL_LSBIT_INDEX(index, mask) \ + CYG_MACRO_START \ + asm volatile ( \ + "scan %1, 0, %%l7;" \ + "mov 31, %0;" \ + "sub %0, %%l7, %0" \ + : "=r"(index) \ + : "r"(mask & ~(mask-1)) \ + : "l7" \ + ); \ +CYG_MACRO_END + +#define HAL_MSBIT_INDEX(index, mask) \ + CYG_MACRO_START \ + asm volatile ( \ + "scan %1, 0, %%l7;" \ + "mov 31, %0;" \ + "sub %0, %%l7, %0" \ + : "=r"(index) \ + : "r"(mask) \ + : "l7" \ + ); \ +CYG_MACRO_END +#endif + +//-------------------------------------------------------------------------- +// Context Initialization +// Initialize the context of a thread. +// Arguments: +// _sparg_ name of variable containing current sp, will be written with new sp +// _thread_ thread object address, passed as argument to entry point +// _entry_ entry point address. +// _id_ bit pattern used in initializing registers, for debugging. + +externC CYG_ADDRESS +hal_thread_init_context( CYG_WORD sparg, + CYG_WORD thread, + CYG_WORD entry, + CYG_WORD id ); + +#define HAL_THREAD_INIT_CONTEXT( _sparg_, _thread_, _entry_, _id_ ) \ +CYG_MACRO_START \ + _sparg_ = hal_thread_init_context( (CYG_WORD)(_sparg_), \ + (CYG_WORD)(_thread_), \ + (CYG_WORD)(_entry_), \ + (CYG_WORD)(_id_) ); \ +CYG_MACRO_END + +//--------------------------------------------------------------------------- +// Context switch macros. +// The arguments are pointers to locations where the stack pointer +// of the current thread is to be stored, and from where the sp of the +// next thread is to be fetched. + +externC void hal_thread_switch_context( CYG_ADDRESS to, CYG_ADDRESS from ); +externC void hal_thread_load_context( CYG_ADDRESS to ) + __attribute__ ((noreturn)); + +#define HAL_THREAD_SWITCH_CONTEXT(_fspptr_,_tspptr_) \ + hal_thread_switch_context((CYG_ADDRESS)_tspptr_, \ + (CYG_ADDRESS)_fspptr_); + +#define HAL_THREAD_LOAD_CONTEXT(_tspptr_) \ + hal_thread_load_context( (CYG_ADDRESS)_tspptr_ ); + + +//--------------------------------------------------------------------------- +// Execution reorder barrier. +// When optimizing the compiler can reorder code. In multithreaded systems +// where the order of actions is vital, this can sometimes cause problems. +// This macro may be inserted into places where reordering should not happen. + +#define HAL_REORDER_BARRIER() asm volatile ( "" : : : "memory" ) + +//--------------------------------------------------------------------------- +// Breakpoint support +// HAL_BREAKPOINT() is a code sequence that will cause a breakpoint to happen +// if executed. +// HAL_BREAKINST is the value of the breakpoint instruction and +// HAL_BREAKINST_SIZE is its size in bytes. + +#define HAL_BREAKPOINT(_label_) \ +asm volatile (" .globl " #_label_ ";" \ + #_label_":" \ + "ta 1" \ + ); + +#define HAL_BREAKINST {0x91,0xd0,0x20,0x01} +#define HAL_BREAKINST_SIZE 4 + +//--------------------------------------------------------------------------- +// Thread register state manipulation for GDB support. + +// Translate a stack pointer as saved by the thread context macros above into +// a pointer to a HAL_SavedRegisters structure. +#define HAL_THREAD_GET_SAVED_REGISTERS( _sp_, _regs_ ) \ + (_regs_) = (HAL_SavedRegisters *)(_sp_) + +// Routines in icontext.c used here because they're quite large for +// the SPARC (note param order): +externC void +cyg_hal_sparc_get_gdb_regs( void *gdb_regset, + HAL_SavedRegisters *eCos_regset ); + +externC void +cyg_hal_sparc_set_gdb_regs( HAL_SavedRegisters *eCos_regset, + void *gdb_regset ); + + +// Copy a set of registers from a HAL_SavedRegisters structure into a GDB +// ordered array. +#define HAL_GET_GDB_REGISTERS( _aregval_, _regs_ ) \ + CYG_MACRO_START \ + cyg_hal_sparc_get_gdb_regs( (_aregval_), (_regs_) ); \ +CYG_MACRO_END + +// Copy a GDB ordered array into a HAL_SavedRegisters structure. +#define HAL_SET_GDB_REGISTERS( _regs_ , _aregval_ ) \ + CYG_MACRO_START \ + cyg_hal_sparc_set_gdb_regs( (_regs_), (_aregval_) ); \ +CYG_MACRO_END + +//--------------------------------------------------------------------------- +// HAL setjmp + +#define CYGARC_JMP_BUF_SIZE 32 // (words) + +// this too must be doubleword aligned (64 bit) + +typedef cyg_uint64 hal_jmp_buf[ CYGARC_JMP_BUF_SIZE / 2 ]; + +externC int hal_setjmp(hal_jmp_buf env); +externC void hal_longjmp(hal_jmp_buf env, int val); + +//--------------------------------------------------------------------------- +// Flush Register Windows +// +// This is implemented as trap 3 in some SPARC systems. +// This macro is only for use from normal, foreground code. +// (including exception handlers and the like) + +#define HAL_FLUSH_REGISTERS_TO_STACK() \ + CYG_MACRO_START \ + cyg_uint32 _saveintr_; \ + HAL_DISABLE_INTERRUPTS( _saveintr_ ); /* leave traps on */ \ + asm volatile ( \ + /* force out all our callers register sets onto the stack */ \ + /* if necessary: the system will handily take care of this for */ \ + /* us as follows: */ \ + "save %%sp, -16 * 4, %%sp;" /* need all these to preserve */ \ + "save %%sp, -16 * 4, %%sp;" /* the linked list property... */ \ + "save %%sp, -16 * 4, %%sp;" \ + "save %%sp, -16 * 4, %%sp;" \ + "save %%sp, -16 * 4, %%sp;" \ + "save %%sp, -16 * 4, %%sp;" \ + "restore;" \ + "restore;" \ + "restore;" \ + "restore;" \ + "restore;" \ + "restore" \ + /* six of these is correct; a seventh would force out the */ \ + /* current set that we are using right now. Note that minimal */ \ + /* space is allowed on stack for locals and ins in case this */ \ + /* sequence itself gets interrupted and recurses too deep. */ \ + : \ + : \ + : "memory" \ + ); \ + HAL_RESTORE_INTERRUPTS( _saveintr_ ); \ +CYG_MACRO_END + +//--------------------------------------------------------------------------- +// Idle thread code. +// This macro is called in the idle thread loop, and gives the HAL the +// chance to insert code. Typical idle thread behaviour might be to halt the +// processor. + +externC void hal_idle_thread_action(cyg_uint32 loop_count); + +#ifndef HAL_IDLE_THREAD_ACTION +#define HAL_IDLE_THREAD_ACTION(_count_) \ + /* Cyg_Clock::real_time_clock->tick() */ +#endif + +//--------------------------------------------------------------------------- + +// Minimal and sensible stack sizes: the intention is that applications +// will use these to provide a stack size in the first instance prior to +// proper analysis. Idle thread stack should be this big. + +// THESE ARE NOT INTENDED TO BE MICROMETRICALLY ACCURATE FIGURES. +// THEY ARE HOWEVER ENOUGH TO START PROGRAMMING. +// YOU MUST MAKE YOUR STACKS LARGER IF YOU HAVE LARGE "AUTO" VARIABLES! + +// We define quite large stack needs for SPARC, for it requires 576 +// bytes (144 words) to process an interrupt and thread-switch, and +// momentarily, but needed in case of recursive interrupts, it needs 208 +// words - if a sequence of saves to push out other regsets is interrupted. + +// This is not a config option because it should not be adjusted except +// under "enough rope" sort of disclaimers. + +// A minimal, optimized stack frame is 24 words, but even -O2 code seems to +// place a few locals in the locals area: round this up to provide a +// sensible overestimate: +#define CYGNUM_HAL_STACK_FRAME_SIZE (4 * 32) + +// Stack needed for a context switch: this is implicit in the estimate for +// interrupts so not explicitly used below: +#define CYGNUM_HAL_STACK_CONTEXT_SIZE (4 * 32) + +// Interrupt + call to ISR, interrupt_end() and the DSR +#define CYGNUM_HAL_STACK_INTERRUPT_SIZE \ + ((208 * 4) + 2 * CYGNUM_HAL_STACK_FRAME_SIZE) + +// And we have lots of registers so no particular amount is added in for +// typical local variable usage. + +// Typically we have 4 nestable interrupt sources, clock, serialin, +// serialout, (and NMI button, but you want it to not destroy context): + +#define CYGNUM_HAL_STACK_SIZE_MINIMUM \ + (4 * CYGNUM_HAL_STACK_INTERRUPT_SIZE + 2 * CYGNUM_HAL_STACK_FRAME_SIZE) + +#define CYGNUM_HAL_STACK_SIZE_TYPICAL \ + (CYGNUM_HAL_STACK_SIZE_MINIMUM + 8 * CYGNUM_HAL_STACK_FRAME_SIZE) + +//-------------------------------------------------------------------------- +// Macros for switching context between two eCos instances (jump from +// code in ROM to code in RAM or vice versa). +#define CYGARC_HAL_SAVE_GP() +#define CYGARC_HAL_RESTORE_GP() + +//----------------------------------------------------------------------------- + +#endif // CYGONCE_HAL_ARCH_H +// End of hal_arch.h diff --git a/packages/hal/sparc/arch/current/include/hal_intr.h b/packages/hal/sparc/arch/current/include/hal_intr.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/include/hal_intr.h @@ -0,0 +1,407 @@ +#ifndef CYGONCE_HAL_INTR_H +#define CYGONCE_HAL_INTR_H + +//=========================================================================== +// +// hal_intr.h +// +// HAL Interrupt and clock support +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas, hmt +// Contributors: nickg, gthomas, hmt, +// jlarmour +// Date: 1999-02-20, 2002-03-08 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +#include +#include + +#include + +//--------------------------------------------------------------------------- +// SPARC exception vectors. +// +// A note on nomenclature: +// +// SPARC has traps: interrupts are traps, and so are exceptions. +// There are 255 of them in the hardware: this HAL's trampoline code decodes +// them into the 27 listed below as CYGNUM_HAL_VECTOR_xxx. +// They are handled uniformly in the trampoline code in the sense that +// each vector has a VSR which is called in the same way. +// Interrupts (vectors 1-15) have one VSR by default, exceptions (vectors +// 16-26) another. +// The interrupt VSR sets up a C stack and calls the corresponding ISR with +// the required arguments; this ABI is mandated by the kernel. +// The exception VSR sets up a C stack and calls the corresponding XSR +// (just an entry in the ISR[sic] table) with similar arguments, such that +// it (by default) can call the kernel's cyg_hal_deliver_exception(). +// +// So: +// CYGNUM_HAL_VSR_MAX/MIN/COUNT describe the number of VSR entries *and* +// the number of ISR (and associated data) entries (including those which +// are XSRs, just a special case of ISRs). +// CYGNUM_HAL_ISR_MAX/MIN/COUNT describe the number of interrupt sources +// and is used for bounds checking in kernel interrupt objects. +// CYGNUM_HAL_EXCEPTION_MAX/MIN/COUNT describe vector numbers which have +// by default the exception VSR and default XSR installed. + + +// These correspond to VSRs and the values are the ones to use for +// HAL_VSR_GET/SET + +#define CYGNUM_HAL_VECTOR_RESERVED_0 0 +#define CYGNUM_HAL_VECTOR_INTERRUPT_1 1 // NB: least important +#define CYGNUM_HAL_VECTOR_INTERRUPT_2 2 // (lowest priority) +#define CYGNUM_HAL_VECTOR_INTERRUPT_3 3 +#define CYGNUM_HAL_VECTOR_INTERRUPT_4 4 +#define CYGNUM_HAL_VECTOR_INTERRUPT_5 5 +#define CYGNUM_HAL_VECTOR_INTERRUPT_6 6 +#define CYGNUM_HAL_VECTOR_INTERRUPT_7 7 +#define CYGNUM_HAL_VECTOR_INTERRUPT_8 8 +#define CYGNUM_HAL_VECTOR_INTERRUPT_9 9 +#define CYGNUM_HAL_VECTOR_INTERRUPT_10 10 +#define CYGNUM_HAL_VECTOR_INTERRUPT_11 11 +#define CYGNUM_HAL_VECTOR_INTERRUPT_12 12 +#define CYGNUM_HAL_VECTOR_INTERRUPT_13 13 +#define CYGNUM_HAL_VECTOR_INTERRUPT_14 14 // (highest priority) +#define CYGNUM_HAL_VECTOR_INTERRUPT_15 15 // NB: most important (NMI) + +#define CYG_VECTOR_IS_INTERRUPT(v) (15 >= (v)) + +#define CYGNUM_HAL_VECTOR_USER_TRAP 16 // Ticc instructions +#define CYGNUM_HAL_VECTOR_FETCH_ABORT 17 // trap type 1 +#define CYGNUM_HAL_VECTOR_ILLEGAL_OP 18 // trap type 2 +#define CYGNUM_HAL_VECTOR_PRIV_OP 19 // tt 3: privileged op +#define CYGNUM_HAL_VECTOR_NOFPCP 20 // tt 4,36: FP or coproc +#define CYGNUM_HAL_VECTOR_RESERVED_1 21 // (not used) +#define CYGNUM_HAL_VECTOR_RESERVED_2 22 // (not used) +#define CYGNUM_HAL_VECTOR_UNALIGNED 23 // tt 7: unaligned memory access +#define CYGNUM_HAL_VECTOR_TT_EIGHT 24 // tt 8: not defined +#define CYGNUM_HAL_VECTOR_DATA_ABORT 25 // tt 9: read/write failed + +#define CYGNUM_HAL_VECTOR_OTHERS 26 // any others + +#define CYGNUM_HAL_VSR_MIN 0 +#define CYGNUM_HAL_VSR_MAX 26 +#define CYGNUM_HAL_VSR_COUNT 27 + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// Interrupt vectors. These are the values used with HAL_INTERRUPT_ATTACH() +// et al + +#define CYGNUM_HAL_INTERRUPT_RESERVED_0 CYGNUM_HAL_VECTOR_RESERVED_0 +#define CYGNUM_HAL_INTERRUPT_1 CYGNUM_HAL_VECTOR_INTERRUPT_1 +#define CYGNUM_HAL_INTERRUPT_2 CYGNUM_HAL_VECTOR_INTERRUPT_2 +#define CYGNUM_HAL_INTERRUPT_3 CYGNUM_HAL_VECTOR_INTERRUPT_3 +#define CYGNUM_HAL_INTERRUPT_4 CYGNUM_HAL_VECTOR_INTERRUPT_4 +#define CYGNUM_HAL_INTERRUPT_5 CYGNUM_HAL_VECTOR_INTERRUPT_5 +#define CYGNUM_HAL_INTERRUPT_6 CYGNUM_HAL_VECTOR_INTERRUPT_6 +#define CYGNUM_HAL_INTERRUPT_7 CYGNUM_HAL_VECTOR_INTERRUPT_7 +#define CYGNUM_HAL_INTERRUPT_8 CYGNUM_HAL_VECTOR_INTERRUPT_8 +#define CYGNUM_HAL_INTERRUPT_9 CYGNUM_HAL_VECTOR_INTERRUPT_9 +#define CYGNUM_HAL_INTERRUPT_10 CYGNUM_HAL_VECTOR_INTERRUPT_10 +#define CYGNUM_HAL_INTERRUPT_11 CYGNUM_HAL_VECTOR_INTERRUPT_11 +#define CYGNUM_HAL_INTERRUPT_12 CYGNUM_HAL_VECTOR_INTERRUPT_12 +#define CYGNUM_HAL_INTERRUPT_13 CYGNUM_HAL_VECTOR_INTERRUPT_13 +#define CYGNUM_HAL_INTERRUPT_14 CYGNUM_HAL_VECTOR_INTERRUPT_14 +#define CYGNUM_HAL_INTERRUPT_15 CYGNUM_HAL_VECTOR_INTERRUPT_15 + +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX 15 +#define CYGNUM_HAL_ISR_COUNT 16 + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// Exception vectors. These are the values used when passed out to an +// external exception handler using cyg_hal_deliver_exception() +// They can also be used with HAL_INTERRUPT_ATTACH() et al to install +// different XSRs. + +#define CYGNUM_HAL_EXCEPTION_TRAP CYGNUM_HAL_VECTOR_USER_TRAP +#define CYGNUM_HAL_EXCEPTION_CODE_ACCESS CYGNUM_HAL_VECTOR_FETCH_ABORT +#define CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION \ + CYGNUM_HAL_VECTOR_ILLEGAL_OP +#define CYGNUM_HAL_EXCEPTION_PRIVILEGED_INSTRUCTION \ + CYGNUM_HAL_VECTOR_PRIV_OP +#define CYGNUM_HAL_EXCEPTION_FPU_NOT_AVAIL CYGNUM_HAL_VECTOR_NOFPCP +#define CYGNUM_HAL_EXCEPTION_RESERVED1 CYGNUM_HAL_VECTOR_RESERVED1 +#define CYGNUM_HAL_EXCEPTION_RESERVED2 CYGNUM_HAL_VECTOR_RESERVED2 +#define CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_ACCESS \ + CYGNUM_HAL_VECTOR_UNALIGNED +#define CYGNUM_HAL_EXCEPTION_TT_EIGHT CYGNUM_HAL_VECTOR_TT_EIGHT +#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS CYGNUM_HAL_VECTOR_DATA_ABORT +#define CYGNUM_HAL_EXCEPTION_OTHERS CYGNUM_HAL_VECTOR_OTHERS + + +#define CYGNUM_HAL_EXCEPTION_MIN 16 +#define CYGNUM_HAL_EXCEPTION_MAX (16 + 10) +#define CYGNUM_HAL_EXCEPTION_COUNT (1 + CYGNUM_HAL_EXCEPTION_MAX - \ + CYGNUM_HAL_EXCEPTION_MIN) + +//--------------------------------------------------------------------------- +// (Null) Translation from a wider space of interrupt sources: + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) _index_ = (_vector_) + +//--------------------------------------------------------------------------- +// Routine to execute DSRs using separate interrupt stack + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +externC void hal_interrupt_stack_call_pending_DSRs(void); +#define HAL_INTERRUPT_STACK_CALL_PENDING_DSRS() \ + hal_interrupt_stack_call_pending_DSRs() + +// these are offered solely for stack usage testing +// if they are not defined, then there is no interrupt stack. +#define HAL_INTERRUPT_STACK_BASE cyg_interrupt_stack_base +#define HAL_INTERRUPT_STACK_TOP cyg_interrupt_stack +// use them to declare these extern however you want: +// extern char HAL_INTERRUPT_STACK_BASE[]; +// extern char HAL_INTERRUPT_STACK_TOP[]; +// is recommended +#endif + +//--------------------------------------------------------------------------- +// Static data used by HAL + +// VSR table +externC volatile CYG_ADDRESS hal_vsr_table[CYGNUM_HAL_VSR_COUNT]; + +// ISR + XSR tables - so VSR count. +externC volatile CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_VSR_COUNT]; +externC volatile CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_VSR_COUNT]; +externC volatile CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_VSR_COUNT]; +// (interrupt_objects only used in the interrupt case _but_ the interrupt +// attach &co macros write it, so keep it full-sized) + +//--------------------------------------------------------------------------- +// Default ISRs for exception/interrupt handing. + +// note that these have the same ABI apart from the extra SP parameter +// for exceptions. + +externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); +// return code from ISR is passed to interrupt_end() in the kernel. + +externC void cyg_hal_exception_handler(CYG_ADDRWORD vector, + CYG_ADDRWORD data, + CYG_ADDRWORD stackpointer); + +//--------------------------------------------------------------------------- +// Default VSRs for exception/interrupt handing. + +// note that these do not have a C ABI as such; they are *vector* service +// routines and are written in assembler. + +externC void hal_default_exception_vsr( void ); +externC void hal_default_interrupt_vsr( void ); + +//--------------------------------------------------------------------------- +// Interrupt state storage + +typedef cyg_uint32 CYG_INTERRUPT_STATE; + +//--------------------------------------------------------------------------- +// Interrupt control macros + +// THIS ONE IS NOT A STANDARD HAL ENTRY (HAL_DISABLE_TRAPS) +// (so should be unused externally) +#define HAL_DISABLE_TRAPS(_old_) \ + asm volatile ( \ + "rd %%psr, %0;" \ + "andn %0, 0x20, %%l7;" \ + "wr %%l7, %%psr;" \ + "nop; nop; nop" \ + : "=r"(_old_) \ + : \ + : "l7" \ + ); + +// THIS ONE IS NOT A STANDARD HAL ENTRY (HAL_QUERY_TRAPS) +// (so should be unused externally) +#define HAL_QUERY_TRAPS(_old_) \ + asm volatile ( \ + "rd %%psr, %%l7;" \ + "and %%l7, 0x020, %0" \ + : "=r"(_old_) \ + : \ + : "l7" \ + ); + +#define HAL_DISABLE_INTERRUPTS(_old_) \ + asm volatile ( \ + "rd %%psr, %0;" \ + "or %0, 0xf00, %%l7;" \ + "wr %%l7, %%psr;" \ + "nop; nop; nop" \ + : "=r"(_old_) \ + : \ + : "l7" \ + ); + +#define HAL_ENABLE_INTERRUPTS() \ + asm volatile ( \ + "rd %%psr, %%l7;" \ + "andn %%l7, 0xf00, %%l7;" \ + "or %%l7, 0x020, %%l7;" \ + "wr %%l7, %%psr;" \ + "nop; nop; nop" \ + : \ + : \ + : "l7" \ + ); + +#define HAL_RESTORE_INTERRUPTS(_old_) \ + asm volatile ( \ + "rd %%psr, %%l7;" \ + "andn %%l7, 0xf20, %%l7;" \ + "and %0 , 0xf20, %%l6;" \ + "wr %%l6, %%l7, %%psr;" \ + "nop; nop; nop" \ + : \ + : "r"(_old_) \ + : "l6","l7" \ + ); + +#define HAL_QUERY_INTERRUPTS(_old_) \ + asm volatile ( \ + "rd %%psr, %%l7;" \ + "and %%l7, 0xf00, %%l7;" \ + "xor %%l7, 0xf00, %0" \ + : "=r"(_old_) \ + : \ + : "l7" \ + ); + + +//--------------------------------------------------------------------------- +// Interrupt and VSR attachment macros + +#define HAL_INTERRUPT_IN_USE( _vector_, _state_) \ + CYG_MACRO_START \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR ((_vector_), _index_); \ + \ + if( (CYG_ADDRESS)hal_default_isr == hal_interrupt_handlers[_vector_] || \ + (CYG_ADDRESS)cyg_hal_exception_handler == \ + hal_interrupt_handlers[_vector_] ) { \ + (_state_) = 0; \ + } else { \ + (_state_) = 1; \ + } \ + CYG_MACRO_END + +#define HAL_INTERRUPT_ATTACH( _vector_, _isr_, _data_, _object_ ) \ + CYG_MACRO_START \ + if( (CYG_ADDRESS)hal_default_isr == hal_interrupt_handlers[_vector_] ||\ + (CYG_ADDRESS)cyg_hal_exception_handler == \ + hal_interrupt_handlers[_vector_] ) \ + { \ + hal_interrupt_handlers[_vector_] = (CYG_ADDRESS)_isr_; \ + hal_interrupt_data[_vector_] = (CYG_ADDRWORD) _data_; \ + hal_interrupt_objects[_vector_] = (CYG_ADDRESS)_object_; \ + } \ +CYG_MACRO_END + +#define HAL_INTERRUPT_DETACH( _vector_, _isr_ ) CYG_MACRO_START \ + if( hal_interrupt_handlers[_vector_] == (CYG_ADDRESS)_isr_ ) \ + { \ + hal_interrupt_handlers[_vector_] = \ + (CYG_VECTOR_IS_INTERRUPT( _vector_ ) \ + ? (CYG_ADDRESS)hal_default_isr \ + : (CYG_ADDRESS)cyg_hal_exception_handler); \ + hal_interrupt_data[_vector_] = 0; \ + hal_interrupt_objects[_vector_] = 0; \ + } \ +CYG_MACRO_END + +#define HAL_VSR_GET( _vector_, _pvsr_ ) \ + *(CYG_ADDRESS *)(_pvsr_) = hal_vsr_table[_vector_]; + + +#define HAL_VSR_SET( _vector_, _vsr_, _poldvsr_ ) CYG_MACRO_START \ + if( _poldvsr_ != NULL ) \ + *(CYG_ADDRESS *)_poldvsr_ = hal_vsr_table[_vector_]; \ + hal_vsr_table[_vector_] = (CYG_ADDRESS)_vsr_; \ +CYG_MACRO_END + +// This is an ugly name, but what it means is: grab the VSR back to eCos +// internal handling, or if you like, the default handler. But if +// cooperating with GDB and CygMon, the default behaviour is to pass most +// exceptions to CygMon. This macro undoes that so that eCos handles the +// exception. So use it with care. + +#define HAL_VSR_SET_TO_ECOS_HANDLER( _vector_, _poldvsr_ ) CYG_MACRO_START \ + if( _poldvsr_ != NULL ) \ + *(CYG_ADDRESS *)_poldvsr_ = hal_vsr_table[_vector_]; \ + hal_vsr_table[_vector_] = ( CYG_VECTOR_IS_INTERRUPT( _vector_ ) \ + ? (CYG_ADDRESS)hal_default_interrupt_vsr \ + : (CYG_ADDRESS)hal_default_exception_vsr ); \ +CYG_MACRO_END + + + +//--------------------------------------------------------------------------- + +// Which PIC (if any) is available is dependent on the board. +// This sets up that stuff: + +#include + +// Ditto the clock(s) +// This defines all the clock macros the kernel requires: + +#include + +//--------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_INTR_H +// End of hal_intr.h diff --git a/packages/hal/sparc/arch/current/include/hal_io.h b/packages/hal/sparc/arch/current/include/hal_io.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/include/hal_io.h @@ -0,0 +1,183 @@ +#ifndef CYGONCE_HAL_IO_H +#define CYGONCE_HAL_IO_H + +//============================================================================= +// +// hal_io.h +// +// HAL device IO register support. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, hmt +// Contributors: nickg, hmt +// Date: 1998-02-17 +// Purpose: Define IO register support +// Description: The macros defined here provide the HAL APIs for handling +// device IO control registers. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +#include + +//----------------------------------------------------------------------------- +// Enforce in-order IO for all HAL reads/writes using this macro. +#define HAL_IO_BARRIER() \ + asm volatile ( "" : : : "memory" ) + +//----------------------------------------------------------------------------- +// IO Register address. +// This type is for recording the address of an IO register. + +typedef volatile CYG_ADDRWORD HAL_IO_REGISTER; + +//----------------------------------------------------------------------------- +// BYTE Register access. +// Individual and vectorized access to 8 bit registers. + +#define HAL_READ_UINT8( _register_, _value_ ) \ + CYG_MACRO_START \ + ((_value_) = *((volatile CYG_BYTE *)(_register_))); \ + HAL_IO_BARRIER (); \ + CYG_MACRO_END + +#define HAL_WRITE_UINT8( _register_, _value_ ) \ + CYG_MACRO_START \ + (*((volatile CYG_BYTE *)(_register_)) = (_value_)); \ + HAL_IO_BARRIER (); \ + CYG_MACRO_END + +#define HAL_READ_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \ + (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_))[_j_]; \ + HAL_IO_BARRIER (); \ + } \ + CYG_MACRO_END + +#define HAL_WRITE_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \ + ((volatile CYG_BYTE *)(_register_))[_j_] = (_buf_)[_i_]; \ + HAL_IO_BARRIER (); \ + } \ + CYG_MACRO_END + + +//----------------------------------------------------------------------------- +// 16 bit access. +// Individual and vectorized access to 16 bit registers. + +#define HAL_READ_UINT16( _register_, _value_ ) \ + CYG_MACRO_START \ + ((_value_) = *((volatile CYG_WORD16 *)(_register_))); \ + HAL_IO_BARRIER (); \ + CYG_MACRO_END + +#define HAL_WRITE_UINT16( _register_, _value_ ) \ + CYG_MACRO_START \ + (*((volatile CYG_WORD16 *)(_register_)) = (_value_)); \ + HAL_IO_BARRIER (); \ + CYG_MACRO_END + +#define HAL_READ_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \ + (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_))[_j_]; \ + HAL_IO_BARRIER (); \ + } \ + CYG_MACRO_END + +#define HAL_WRITE_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \ + ((volatile CYG_WORD16 *)(_register_))[_j_] = (_buf_)[_i_]; \ + HAL_IO_BARRIER (); \ + } \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- +// 32 bit access. +// Individual and vectorized access to 32 bit registers. + +#define HAL_READ_UINT32( _register_, _value_ ) \ + CYG_MACRO_START \ + ((_value_) = *((volatile CYG_WORD32 *)(_register_))); \ + HAL_IO_BARRIER (); \ + CYG_MACRO_END + +#define HAL_WRITE_UINT32( _register_, _value_ ) \ + CYG_MACRO_START \ + (*((volatile CYG_WORD32 *)(_register_)) = (_value_)); \ + HAL_IO_BARRIER (); \ + CYG_MACRO_END + +#define HAL_READ_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \ + (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_))[_j_]; \ + HAL_IO_BARRIER (); \ + } \ + CYG_MACRO_END + +#define HAL_WRITE_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ + CYG_MACRO_START \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) { \ + ((volatile CYG_WORD32 *)(_register_))[_j_] = (_buf_)[_i_]; \ + HAL_IO_BARRIER (); \ + } \ + CYG_MACRO_END + +//----------------------------------------------------------------------------- + +#endif // ifndef CYGONCE_HAL_IO_H +// End of hal_io.h diff --git a/packages/hal/sparc/arch/current/include/vectors.h b/packages/hal/sparc/arch/current/include/vectors.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/include/vectors.h @@ -0,0 +1,118 @@ +#ifndef CYGONCE_HAL_VECTORS_H +#define CYGONCE_HAL_VECTORS_H + +//============================================================================= +// +// vectors.h +// +// SPARC Architecture specific vector numbers &c +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors:hmt +// Date: 1998-12-10 +// Purpose: Define architecture abstractions and some shared info; +// this file is included by assembler files as well as C/C++. +// Usage: #include + +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#define __WINSIZE 8 + +#if __WINSIZE <= 8 +# define __WINBITS 7 +#else +# error __WINSIZE window size probably not supported +#endif + +// These should be generic to all SPARCs: + +#define __WINBITS_MAXIMAL 0x1f + +#define __WIN_INIT (__WINSIZE - 1) +#define __WIM_INIT (1 << __WIN_INIT) + +// ------------------------------------------------------------------------ + +#define TRAP_WUNDER 6 // Window Underflow trap number +#define TRAP_WOVER 5 // Window Overflow trap number + +#define TRAP_INTR_MIN 17 // smallest interrupt trap number +#define TRAP_INTR_MAX 31 // largest interrupt trap number + +#define TT_MASK 0xff0 // trap type mask from tbr +#define TT_SHL 4 // shift to get a tbr value + +// Alternatively, detect an interrupt by testing tbr for being in the range +// 16-31 by masking &c: +#define TT_IS_INTR_MASK 0xf00 +#define TT_IS_INTR_VALUE 0x100 + +#if TT_IS_INTR_VALUE != ((TRAP_INTR_MIN << TT_SHL) & TT_IS_INTR_MASK) +#error "Bad *_INTR_* symbol definition (1)" +#endif + +#if TT_IS_INTR_VALUE != ((TRAP_INTR_MAX << TT_SHL) & TT_IS_INTR_MASK) +#error "Bad *_INTR_* symbol definition (2)" +#endif + +#if TT_IS_INTR_VALUE != (((TRAP_INTR_MIN+1) << TT_SHL) & TT_IS_INTR_MASK) +#error "Bad *_INTR_* symbol definition (3)" +#endif + +#if TT_IS_INTR_VALUE != (((TRAP_INTR_MAX-1) << TT_SHL) & TT_IS_INTR_MASK) +#error "Bad *_INTR_* symbol definition (4)" +#endif + + + +//#define SCHED_LOCK_MANGLED_NAME _18Cyg_Scheduler_Base.sched_lock +#define SCHED_LOCK_MANGLED_NAME cyg_scheduler_sched_lock + + + +#define SAVE_REGS_SIZE (4 * 32) // 32 words of 4 bytes each + + + + +#endif // CYGONCE_HAL_VECTORS_H +// EOF vectors.h diff --git a/packages/hal/sparc/arch/current/src/context.S b/packages/hal/sparc/arch/current/src/context.S new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/src/context.S @@ -0,0 +1,401 @@ +/*============================================================================= +// +// context.S +// +// SPARC context switch code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas, hmt +// Contributors: nickg, gthomas, hmt +// Date: 1998-12-15 +// Purpose: SPARC context switch code +// Description: This file contains implementations of the thread context +// switch routines. It also contains the longjmp() and setjmp() +// routines. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include + +#define DELAYS_AFTER_WRPSR_SAME_WINDOW +#define DELAYS_AFTER_WRWIM + + .text + +! ------------------------------------------------------------------------------ +! hal_thread_switch_context +! Switch thread contexts +! %o0 = address of sp of next thread to execute +! %o1 = address of sp save location of current thread + + .global hal_thread_switch_context +hal_thread_switch_context: + + ! First take the stack down to make room for the saved register + ! state, including a window save area at the base. Leave the + ! current window save area undisturbed. It is unused within the + ! save but will become current again when we continue in this + ! context. This lets us do this whole piece of work without + ! diabling interrupts for too long, since, for example, we can + ! lower the stack atomically with one instruction: + sub %sp, SAVE_REGS_SIZE, %sp + st %sp, [ %o1 ] ! return SP for this thread + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + +#ifdef CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + st %o7, [%sp + 31 * 4] ! save only the return address + ! and no need to preserve %o0 even though it is restored +#else // save a maximal context + st %g1, [%sp + 17 * 4] ! save G & O registers + std %g2, [%sp + 18 * 4] + std %g4, [%sp + 20 * 4] + std %g6, [%sp + 22 * 4] + + std %o0, [%sp + 24 * 4] + std %o2, [%sp + 26 * 4] + std %o4, [%sp + 28 * 4] + std %o6, [%sp + 30 * 4] +#endif // !CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + ! and save the CWP in %g0 save place + rd %psr, %g7 + st %g7, [%sp + 16 * 4] + + ! Now load the destination thread by dropping through + ! to hal_thread_load_context + +! ------------------------------------------------------------------------------ +! hal_thread_load_context +! Load thread context +! %o0 = address of sp of next thread to execute +! Note that this function is also the second half of hal_thread_switch_context +! and is simply dropped into from it. + + .global hal_thread_load_context +hal_thread_load_context: + + ! Here, we are a leaf routine but with slightly odd properties. + ! The stack is still the callers at this point but the register + ! set is up for grabs. So we can use globals: + + ld [ %o0 ], %g7 ! Get the next saved SP + + ! DISABLE INTERRUPTS *ONLY* NOT TRAPS + rd %psr, %g6 + or %g6, 0xfe0, %g5 ! PIL up to 15 leave traps enabled + wr %g5, %psr + + ! force out all our callers register sets onto the stack + ! if necessary: the system will handily take care of this for + ! us as follows: + save %sp, -16 * 4, %sp ! need all these to preserve + save %sp, -16 * 4, %sp ! the linked list property... + save %sp, -16 * 4, %sp + save %sp, -16 * 4, %sp +#if 6 < __WINSIZE + save %sp, -16 * 4, %sp +#if 7 < __WINSIZE + save %sp, -16 * 4, %sp +#endif +#endif + ! Fewer saves if fewer register windows. For 8 register windows, + ! six of these is correct; a seventh would force out the current + ! set that was already saved manually above. Note that minimal + ! space is allowed on stack for locals and ins in case this + ! sequence itself gets interrupted and recurses too deep. + + ! now select the new window with traps disabled... + + ! get the new PSR and CWP that we will ultimately restore + ! from the %g0 save place... + ld [%g7 + 16 * 4], %g6 ! %g7 holds the new stack pointer + andn %g6, 0x20, %g5 ! clear ET into %g5 + and %g6, __WINBITS, %g4 ! CWP bits only in %g4 + + ! calculate a new WIM... + add %g4, 1, %g3 ! required invalid window number +#if 8 == __WINSIZE + and %g3, __WINBITS, %g3 ! modulo 8 +#else // expect 5 or 6 or 7 windows + cmp %g3, __WINSIZE + bge,a 567f ! taken: do delay slot, handle overflow + mov 0, %g3 ! only if .ge. above +567: +#endif + mov 1, %g2 + sll %g2, %g3, %g2 ! converted to a mask for the WIM + + ! DISABLE INTERRUPTS (TRAPS) + wr %g5, %psr ! set CWP to new window, disable traps + wr %g2, %wim ! and WIM to new value + nop + nop + nop + + ! Must do this atomically so that the registers match the stack. + ! After locals and ins are loaded, we are conformant to the PCS + ! so can re-enable interrupts. + mov %g7, %sp ! target sp in situ (%sp = %o6) + + ldd [%sp + 0 * 4], %l0 ! restore L & I registers + ldd [%sp + 2 * 4], %l2 + ldd [%sp + 4 * 4], %l4 + ldd [%sp + 6 * 4], %l6 + + ldd [%sp + 8 * 4], %i0 + ldd [%sp + 10 * 4], %i2 + ldd [%sp + 12 * 4], %i4 + ldd [%sp + 14 * 4], %i6 + + ! RESTORE INTERRUPTS to saved state + wr %g6, %psr ! set new CWP and old ET and PIL + nop + nop + nop + + ! now load the rest of the context; we can be interrupted here + ! (if the saved context was a voluntary yield or threadstart) + ! but that is OK, other state will be preserved in that case... + +#ifdef CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + ld [%sp + 24 * 4], %o0 ! must load the initial argument +#else // restore a maximal context + ld [%sp + 17 * 4], %g1 + ldd [%sp + 18 * 4], %g2 + ldd [%sp + 20 * 4], %g4 + ldd [%sp + 22 * 4], %g6 + + ldd [%sp + 24 * 4], %o0 + ldd [%sp + 26 * 4], %o2 + ldd [%sp + 28 * 4], %o4 +#endif // !CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + ! %o6 = %sp, already set up + ld [%sp + 31 * 4], %o7 ! "return" address + + retl + add %sp, SAVE_REGS_SIZE, %sp ! and set the stack back + ! to its entrant value + +! ------------------------------------------------------------------------------ +! HAL longjmp, setjmp implementations + +!FUNC_START(hal_setjmp) + .global hal_setjmp +hal_setjmp: + ! Treat this as a leaf routine, may as well. + ! %o0 is the address of the buffer. + + std %l0, [%o0 + 0 * 4] ! save L & I registers + std %l2, [%o0 + 2 * 4] + std %l4, [%o0 + 4 * 4] + std %l6, [%o0 + 6 * 4] + + std %i0, [%o0 + 8 * 4] + std %i2, [%o0 + 10 * 4] + std %i4, [%o0 + 12 * 4] + std %i6, [%o0 + 14 * 4] + +#ifdef CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + std %o6, [%o0 + 30 * 4] ! just save %sp and return address +#else // save a maximal context + st %g1, [%o0 + 17 * 4] ! save G & O registers + std %g2, [%o0 + 18 * 4] + std %g4, [%o0 + 20 * 4] + std %g6, [%o0 + 22 * 4] + + std %o0, [%o0 + 24 * 4] + std %o2, [%o0 + 26 * 4] + std %o4, [%o0 + 28 * 4] + std %o6, [%o0 + 30 * 4] +#endif // !CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + + ! and save the CWP in %g0 save place + rd %psr, %g7 + st %g7, [%o0 + 16 * 4] + + ! DISABLE INTERRUPTS *ONLY* NOT TRAPS + or %g7, 0xfe0, %g6 ! PIL up to 15 leave traps enabled + wr %g6, %psr + + ! force out all our callers register sets onto the stack + ! if necessary: the system will handily take care of this for + ! us as follows: + save %sp, -16 * 4, %sp ! need all these to preserve + save %sp, -16 * 4, %sp ! the linked list property... + save %sp, -16 * 4, %sp + save %sp, -16 * 4, %sp +#if 6 < __WINSIZE + save %sp, -16 * 4, %sp +#if 7 < __WINSIZE + save %sp, -16 * 4, %sp +#endif +#endif + ! Fewer saves if fewer register windows. For 8 register windows, + ! six of these is correct; a seventh would force out the current + ! set that was already saved manually above. Note that minimal + ! space is allowed on stack for locals and ins in case this + ! sequence itself gets interrupted and recurses too deep. + + ! (after all, we are about to call deeper not shallower, otherwise + ! using setjmp is inappropriate) + + ! ENABLE INTERRUPTS + wr %g7, %psr ! set CWP back to as-was + nop + nop + nop + +#ifndef CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + ldd [%o0 + 22 * 4], %g6 ! preserve %g7 and %g6 +#endif + + retl ! ret and return zero to indicate + mov 0, %o0 ! not longjumped-to + +! hal_longjmp loads state from arg0 and returns arg1 +!FUNC_START(hal_longjmp) + .global hal_longjmp +hal_longjmp: + ! This is kind of a leaf routine, it returns elsewhere + ! %o0 is the address of the buffer. + ! %o1 is the value to return in %o0 (since we are a leaf) + + mov %o0, %g7 ! keep the pointer handy + mov %o1, %g1 ! and the return value + ! now select the new window with traps disabled... + rd %psr, %g6 + ! preserve ET, clear CWP + andn %g6, __WINBITS_MAXIMAL, %g6 + andn %g6, 0x20, %g5 ! clear ET also into %g5 + + ! get new CWP from %g0 save place... + ld [%g7 + 16 * 4], %g4 ! %g7 holds the new stack pointer + and %g4, __WINBITS, %g4 ! preserve CWP bits + + ! calculate a new WIM... + add %g4, 1, %g3 ! required invalid window number +#if 8 == __WINSIZE + and %g3, __WINBITS, %g3 ! modulo 8 +#else // expect 5 or 6 or 7 windows + cmp %g3, __WINSIZE + bge,a 567f ! taken: do delay slot, handle overflow + mov 0, %g3 ! only if .ge. above +567: +#endif + mov 1, %g2 + sll %g2, %g3, %g2 ! converted to a mask for the WIM + + ! DISABLE INTERRUPTS + wr %g5, %g4, %psr ! set CWP to new window, disable traps + wr %g2, %wim ! and WIM to new value + nop + nop + nop + + ! Must do this atomically so that the registers match the stack. + ! After locals and ins are loaded, we are conformant to the PCS + ! so can re-enable interrupts. + + ldd [%g7 + 0 * 4], %l0 ! restore L & I registers + ldd [%g7 + 2 * 4], %l2 + ldd [%g7 + 4 * 4], %l4 + ldd [%g7 + 6 * 4], %l6 + + ldd [%g7 + 8 * 4], %i0 + ldd [%g7 + 10 * 4], %i2 + ldd [%g7 + 12 * 4], %i4 + ldd [%g7 + 14 * 4], %i6 + + ld [%g7 + 30 * 4], %sp ! %o6 = %sp, set up now so as to conform + ! to PCS and so be interruptible + ! ENABLE INTERRUPTS + wr %g6, %g4, %psr ! set new CWP and old ET + nop + nop + nop + + ! now load the rest of the context; we can be interrupted here, but + ! that is OK, other state will be preserved in that case... +#ifdef CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + ! we are not preserving globals... + ! %o6 = %sp, already set up + ld [%g7 + 31 * 4], %o7 ! "return" address + retl ! %g1 still holds the return value + mov %g1, %o0 + +#else // load a maximal context + mov %g7, %o0 ! original pointer was in %o0 anyway + + ldd [%o0 + 18 * 4], %g2 + ldd [%o0 + 20 * 4], %g4 + ldd [%o0 + 22 * 4], %g6 + + ld [%o0 + 25 * 4], %o1 ! %o0 = original pointer + ldd [%o0 + 26 * 4], %o2 + ldd [%o0 + 28 * 4], %o4 + ! %o6 = %sp, already set up + ld [%o0 + 31 * 4], %o7 ! "return" address + + ! %g1 still holds the return value; want to get this into %o0 + ! and restore %g1 from the saved state; %o0 is the state pointer: + ! g1 = R, o0 = P + xor %o0, %g1, %g1 ! g1 = R^P, o0 = P + xor %o0, %g1, %o0 ! g1 = R^P, o0 = R + xor %o0, %g1, %g1 ! g1 = P, o0 = R all done + + retl + ld [%g1 + 17 * 4], %g1 ! and finally restore %g1 +#endif // !CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + +! ------------------------------------------------------------------------------ +! end of context.S + + + diff --git a/packages/hal/sparc/arch/current/src/hal_boot.c b/packages/hal/sparc/arch/current/src/hal_boot.c new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/src/hal_boot.c @@ -0,0 +1,174 @@ +//========================================================================== +// +// hal_boot.c +// +// SPARC Architecture specific interrupt dispatch tables +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1998-12-10 +// Purpose: Interrupt handler tables for SPARC. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +/*------------------------------------------------------------------------*/ +/* calling this is our raison d'etre: */ +extern void cyg_start( void ); + +/*------------------------------------------------------------------------*/ +/* data copy and bss zero functions */ + +typedef void (CYG_ROM_ADDRESS)(void); + +#ifdef CYG_HAL_STARTUP_ROM +void hal_copy_data(void) +{ + extern char __ram_data_start; + extern char __ram_data_end; + extern CYG_ROM_ADDRESS __rom_data_start; + long *p = (long *)&__ram_data_start; + long *q = (long *)&__rom_data_start; + + while( p <= (long *)&__ram_data_end ) + *p++ = *q++; +} +#endif + +void hal_zero_bss(void) +{ + extern CYG_ROM_ADDRESS __bss_start; + extern CYG_ROM_ADDRESS __bss_end; + + register long long zero = 0; + register long long *end = (long long *)&__bss_end; + register long long *p = (long long *)&__bss_start; + + while( p <= end ) + *p++ = zero; +} + +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG +cyg_bool cyg_hal_stop_constructors; +#endif + +void +cyg_hal_invoke_constructors (void) +{ + typedef void (*pfunc) (void); + extern pfunc __CTOR_LIST__[]; + extern pfunc __CTOR_END__[]; + +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG + static pfunc *p = &__CTOR_END__[-1]; + + cyg_hal_stop_constructors = 0; + for (; p >= __CTOR_LIST__; p--) { + (*p) (); + if (cyg_hal_stop_constructors) { + p--; + break; + } + } +#else + pfunc *p; + + for (p = &__CTOR_END__[-1]; p >= __CTOR_LIST__; p--) + (*p) (); +#endif +} + +// Override any __gccmain the compiler might generate. We don't want +// constructors to be called twice. +void __gccmain(void) {} + +/*------------------------------------------------------------------------*/ +/* CYG_HAL_START - pre-main-entrypoint */ + +#ifdef CYGPKG_HAL_SPARCLITE_SLEB +#define SLEB_LED (*(volatile char *)(0x02000003)) +#define LED( _x_ ) SLEB_LED = (char)(0xff & ~(_x_)) +#else +#define LED( _x_ ) CYG_EMPTY_STATEMENT +#endif + +extern void hal_board_prestart( void ); +extern void hal_board_poststart( void ); + +// This is called with traps enabled, but interrupts masked out: +// Be sure to enable them in hal_board_poststart() at the latest. + +void cyg_hal_start( void ) +{ + /* Board specific prestart that's best done in C */ + hal_board_prestart(); + + LED( 0xd0 ); + +#ifdef CYG_HAL_STARTUP_ROM + /* Copy data from ROM to RAM */ + hal_copy_data(); +#endif + + LED( 0xd4 ); + + /* Zero BSS */ + hal_zero_bss(); + + LED( 0xd8 ); + + /* Call constructors */ + cyg_hal_invoke_constructors(); + + LED( 0xdc ); + + /* Board specific late startup that's best done in C */ + hal_board_poststart(); + + LED( 0xf8 ); + + /* Call cyg_start */ + cyg_start(); /* does not return */ +} + +// EOF hal_boot.c diff --git a/packages/hal/sparc/arch/current/src/hal_intr.c b/packages/hal/sparc/arch/current/src/hal_intr.c new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/src/hal_intr.c @@ -0,0 +1,162 @@ +//========================================================================== +// +// hal_intr.c +// +// SPARC Architecture specific interrupt dispatch tables +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1999-02-20 +// Purpose: Interrupt handler tables for SPARC. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +#include +#include + +#include // for CYG_FAIL() below + +// ------------------------------------------------------------------------ +// First level C default interrupt handler. + +//static int count = 0; + +cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + return 0; // 0x1def0000 + vector + (count += 0x0100); +} + +// ------------------------------------------------------------------------ +// First level C exception handler. + +externC void __handle_exception (void); + +externC HAL_SavedRegisters *_hal_registers; + +void cyg_hal_exception_handler(CYG_ADDRWORD vector, CYG_ADDRWORD data, + CYG_ADDRWORD stackpointer ) +{ +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + // Set the pointer to the registers of the current exception + // context. At entry the GDB stub will expand the + // HAL_SavedRegisters structure into a (bigger) register array. + _hal_registers = (HAL_SavedRegisters *)stackpointer; + + __handle_exception(); + +#elif defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && \ + defined(CYGPKG_HAL_EXCEPTIONS) + // We should decode the vector and pass a more appropriate + // value as the second argument. For now we simply pass a + // pointer to the saved registers. We should also divert + // breakpoint and other debug vectors into the debug stubs. + + cyg_hal_deliver_exception( vector, stackpointer ); + +#else + CYG_FAIL("Exception!!!"); +#endif + return; +} + +// ISR tables +volatile +CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_VSR_COUNT] = { + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, + (CYG_ADDRESS)hal_default_isr, /* 16 of these */ + + (CYG_ADDRESS)cyg_hal_exception_handler, + (CYG_ADDRESS)cyg_hal_exception_handler, + (CYG_ADDRESS)cyg_hal_exception_handler, + (CYG_ADDRESS)cyg_hal_exception_handler, + (CYG_ADDRESS)cyg_hal_exception_handler, + + (CYG_ADDRESS)cyg_hal_exception_handler, + (CYG_ADDRESS)cyg_hal_exception_handler, + (CYG_ADDRESS)cyg_hal_exception_handler, + (CYG_ADDRESS)cyg_hal_exception_handler, + (CYG_ADDRESS)cyg_hal_exception_handler, + + (CYG_ADDRESS)cyg_hal_exception_handler, /* 11 of these */ +}; + +volatile +CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_VSR_COUNT] = { + 0x11da1a00, 0x11da1a01, 0x11da1a02, 0x11da1a03, + 0x11da1a04, 0x11da1a05, 0x11da1a06, 0x11da1a07, + 0x11da1a08, 0x11da1a09, 0x11da1a0a, 0x11da1a0b, + 0x11da1a0c, 0x11da1a0d, 0x11da1a0e, 0x11da1a0f, + 0xeeda1a00, 0xeeda1a01, 0xeeda1a02, 0xeeda1a03, 0xeeda1a04, + 0xeeda1a05, 0xeeda1a06, 0xeeda1a07, 0xeeda1a08, 0xeeda1a09, + 0xeeda1a0A +}; + +volatile +CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_VSR_COUNT] = { + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, +}; + +// EOF hal_intr.c diff --git a/packages/hal/sparc/arch/current/src/icontext.c b/packages/hal/sparc/arch/current/src/icontext.c new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/src/icontext.c @@ -0,0 +1,498 @@ +/*============================================================================= +// +// icontext.c +// +// SPARC HAL context init function +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1998-12-14 +// Purpose: HAL context initialization function +// Description: Initialize a HAL context for SPARC; this is in C and out +// of line because there is too much of it for a simple macro. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include // HAL header + +#include + +#include // SAVE_REGS_SIZE, __WINSIZE, ... + +/*---------------------------------------------------------------------------*/ + +/* We lay out the stack in the manner that the PCS demands: + * frame pointer -----> [top of stack] + * Argument spill area (6 words) + * Return Arg pointer + * Initial saved register window (i[8], l[8]) + * for use by program when it starts + * [rest of] saved register object (various) + * stack pointer -----> saved register window (i[8], l[8]) + * to allow us to be interrupted. + * + * ie. frame pointer -> + * struct HAL_FrameStructure + * stack pointer -> struct HAL_SavedRegisters + * + * and when the context "resumes" sp is incremented by 40 * 4, the size of + * a _struct HAL_SavedRegisters_ which points it at the extant but unused + * _struct HAL_FrameStructure_ as the PCS requires. The frame pointer is + * left pointing off the top of stack. + * + * + * Thus the stack is the same if created from an already executing context: + * + * frame pointer -----> + * [temporaries and locals] + * [more arguments] + * Argument spill area (6 words) + * Return Arg pointer + * [sp at entry]------> Previous saved register window (i[8], l[8]) + * for use by program when it starts + * [rest of] saved register object (various) + * stack pointer -----> saved register window (i[8], l[8]) + * to allow us to be interrupted. + */ + +CYG_ADDRESS +hal_thread_init_context( CYG_WORD sparg, + CYG_WORD thread, + CYG_WORD entry, + CYG_WORD id ) +{ + register CYG_WORD fp = sparg; + register CYG_WORD sp = 0; + register HAL_SavedRegisters *regs; + register HAL_FrameStructure *frame; + int i; + + if ( 0 == (id & 0xffff0000) ) + id <<= 16; + + fp &= ~15; // round down to double alignment + + frame = (HAL_FrameStructure *)( + fp - sizeof( HAL_FrameStructure ) ); + + regs = (HAL_SavedRegisters *)( + ((CYG_WORD)frame) - sizeof(HAL_SavedRegisters) ); + + sp = (CYG_WORD)regs; + + for ( i = 0; i < 6; i++ ) { + frame->spill_args[i] = id | 0xa0 | i; + } + frame->composite_return_ptr = 0; + + for ( i = 0; i < 8; i++ ) { + frame->li.i[i] = id | ( 56 + i ); + frame->li.l[i] = id | ( 48 + i ); + regs ->li.i[i] = id | ( 24 + i ); + regs ->li.l[i] = id | ( 16 + i ); + regs ->o[i] = id | ( 8 + i ); + regs ->g[i] = id | ( i ); + } + + // first terminate the linked list on the stack in the initial + // (already saved) register window: + frame->li.i[6] = regs->li.i[6] = (cyg_uint32)fp; // frame pointer + frame->li.i[7] = regs->li.i[7] = (cyg_uint32)0; // no ret addr here + + // and set up other saved regs as if called from just before + // the entry point: + regs->o[7] = (entry - 8); + regs->o[6] = sp; + + // this is the argument that the entry point is called with + regs->o[0] = thread; + + // this is the initial CWP and interrupt state; CWP is quite arbitrary + // really, the WIM is set up accordingly in hal_thread_load_context(). + + regs->g[0] = 0x0e0 + __WIN_INIT; // PIL zero, ET, S, PS and CWP set. + + return (CYG_ADDRESS)sp; +} + +// --------------------------------------------------------------------------- + +//#define THREAD_DEBUG_SERIAL_VERBOSE + +#ifdef THREAD_DEBUG_SERIAL_VERBOSE // NOT INCLUDED + +// This is unpleasant to try to debug, because these routines are called +// WHEN THE PROGRAM IS NOT RUNNING from the CygMon's GDB stubs - so you +// can't use any normal output: these little routines use the serial +// line directly, so are best used when debugging via Ethernet, so you +// just have a separate output stream to read. Nasty... + +#include + +#undef HAL_DIAG_WRITE_CHAR +#define HAL_DIAG_WRITE_CHAR(_c_) CYG_MACRO_START \ + SLEB_LED = (_c_); \ + HAL_DIAG_WRITE_CHAR_DIRECT( _c_ ); \ +CYG_MACRO_END + +static void swritec( char c ) +{ + HAL_DIAG_WRITE_CHAR( c ); +} + +static void swrites( char *s ) +{ + char c; + while ( 0 != (c = *s++) ) + HAL_DIAG_WRITE_CHAR( c ); +} + +static void swritex( cyg_uint32 x ) +{ + int i; + swrites( "0x" ); + for ( i = 28; i >= 0; i-= 4 ) { + char c = "0123456789abcdef"[ 0xf & (x >> i) ]; + HAL_DIAG_WRITE_CHAR( c ); + } +} + +#define newline() swrites( "\n\r" ) + +static void x8( char *s, unsigned long *xp ) +{ + int i; + for ( i = 0; i < 8; i++ ) { + swrites( s ); + swritec( '0' + i ); + swrites( " = " ); + swritex( xp[i] ); + if ( 3 == (i & 3) ) + newline(); + else + swrites( " " ); + } +} + +#endif // THREAD_DEBUG_SERIAL_VERBOSE ... NOT INCLUDED + +// --------------------------------------------------------------------------- +// Routines in icontext.c used here because they're quite large for +// the SPARC (note param order); these are used in talking to GDB. + +enum regnames {G0 = 0, G1, G2, G3, G4, G5, G6, G7, + O0, O1, O2, O3, O4, O5, SP, O7, + L0, L1, L2, L3, L4, L5, L6, L7, + I0, I1, I2, I3, I4, I5, FP, I7, + + F0, F1, F2, F3, F4, F5, F6, F7, + F8, F9, F10, F11, F12, F13, F14, F15, + F16, F17, F18, F19, F20, F21, F22, F23, + F24, F25, F26, F27, F28, F29, F30, F31, + Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR}; + +typedef unsigned long target_register_t; + +void +cyg_hal_sparc_get_gdb_regs( void *gdb_regset, + HAL_SavedRegisters *eCos_regset ) +{ + target_register_t *gdb = (target_register_t *)gdb_regset; + int reg; + cyg_uint32 scratch = 0; + cyg_uint32 *sptrap; + HAL_SavedWindow *trapli, *ctxli; + + if ( 0 == eCos_regset->g[0] || + 0xc0 == (0xe0 & eCos_regset->g[0]) ) { + // Then it's an interrupt stack saved state: + // (either minimal, or a saved PSR with traps disabled) + // The saved register set is pretty minimal, so we have to grub + // around in the stack to find out some truth... + sptrap = (cyg_uint32 *)eCos_regset; // point to the IL save area for + sptrap -= 24; // the trap handler, for PC, NPC + trapli = (HAL_SavedWindow *)sptrap; // Get at those regs + + ctxli = (HAL_SavedWindow *)(trapli->i[6]); // (the frame pointer) + // and get at the interruptee's regs + + // Pick up interruptee's registers from all over the stack: + for ( reg = 0; reg < 8 ; reg++ ) { + gdb[ G0 + reg ] = eCos_regset->g[reg]; + gdb[ O0 + reg ] = trapli->i[reg]; + gdb[ L0 + reg ] = ctxli->l[reg]; + gdb[ I0 + reg ] = ctxli->i[reg]; + } + + // Clear out G0 which is always 0 (but abused in eCos_regset) + // and the FP regs which we do not have: + gdb[ G0 ] = 0; + for ( reg = F0; reg <= F31; reg++ ) + gdb[ reg ] = 0; + + // In the save context _of the trap handler_ registers are as follows: + // %l0 = psr (with this CWP/window-level in it) + // %l1 = pc + // %l2 = npc + // %l3 = vector number (1-15 for interrupts) + // %l4 = Y register preserved + gdb[ Y ] = trapli->l[4]; + + scratch = trapli->l[0]; // the PSR in the trap handler +#if 8 == __WINSIZE + scratch++; // back to interupted thread's window + scratch &=~ 0x38; // clear ET and any __WINSIZE overflow + gdb[ PSR ] = scratch; + gdb[ WIM ] = 1 << ((__WINBITS & (1 + scratch))); +#else // 6 or 7 windows only + reg = (int)(scratch & __WINBITS); + scratch &=~ (__WINBITS_MAXIMAL | 0x20); // clear ET and CWP + if ( __WINSIZE <= ++reg ) reg = 0; // back to intr'd window + gdb[ PSR ] = scratch | reg; + if ( __WINSIZE <= ++reg ) reg = 0; // good index for WIM + gdb[ WIM ] = 1 << reg; +#endif // __WINSIZE + + // Read _a_ TBR value and ignore the current trap details: + asm volatile ( "rd %%tbr, %0" : "=r"(scratch) : ); + gdb[ TBR ] = (scratch &~ 0xfff); + + gdb[ PC ] = trapli->l[1]; + gdb[ NPC ] = trapli->l[2]; + + gdb[ FPSR ] = 0; + gdb[ CPSR ] = 0; + +#ifdef THREAD_DEBUG_SERIAL_VERBOSE + newline(); + swrites( "-----------------------------------------------------" ); newline(); + swrites( "-------------- INTERRUPT STACK GET ------------------" ); newline(); + swrites( "eCos regset at " ); swritex( eCos_regset ); newline(); + swrites( " trapli " ); swritex( trapli ); newline(); + swrites( " ctxli " ); swritex( ctxli ); newline(); + x8( "global ", &(gdb[G0]) ); + x8( " in ", &(gdb[I0]) ); + x8( " local ", &(gdb[L0]) ); + x8( " out ", &(gdb[O0]) ); + swrites( "gdb PC = " ); swritex( gdb[ PC ] ); newline(); + swrites( "gdb NPC = " ); swritex( gdb[ NPC ] ); newline(); + swrites( "gdb PSR = " ); swritex( gdb[ PSR ] ); newline(); +#endif + + } + else { + // It's a synchronous context switch that led to this object. + // Pick up interruptee's registers from the saved context: + for ( reg = 0; reg < 8 ; reg++ ) { +#ifdef CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + gdb[ G0 + reg ] = 0; + gdb[ O0 + reg ] = 0; +#else + gdb[ G0 + reg ] = eCos_regset->g[reg]; + gdb[ O0 + reg ] = eCos_regset->o[reg]; +#endif + gdb[ L0 + reg ] = eCos_regset->li.l[reg]; + gdb[ I0 + reg ] = eCos_regset->li.i[reg]; + } + +#ifdef CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM + // Set up the stack pointer by arithmetic and the return address + gdb[ SP ] = ((cyg_uint32)(eCos_regset)); + gdb[ O7 ] = eCos_regset->o[ 7 ]; +#else + // Clear out G0 which is always 0 (but abused in eCos_regset) + gdb[ G0 ] = 0; +#endif + // and clear the FP regs which we do not have: + for ( reg = F0; reg <= F31; reg++ ) + gdb[ reg ] = 0; + + gdb[ Y ] = 0; // it's not preserved. + + scratch = eCos_regset->g[ 0 ]; // the PSR in the saved context + gdb[ PSR ] = scratch; // return it verbatim. +#if 8 == __WINSIZE + gdb[ WIM ] = 1 << ((__WINBITS & (1 + scratch))); +#else // 6 or 7 windows only + reg = (int)(scratch & __WINBITS); + if ( __WINSIZE <= ++reg ) reg = 0; // good index for WIM + gdb[ WIM ] = 1 << reg; +#endif // __WINSIZE + + // Read _a_ TBR value and ignore the current trap details: + asm volatile ( "rd %%tbr, %0" : "=r"(scratch) : ); + gdb[ TBR ] = (scratch &~ 0xfff); + + gdb[ PC ] = eCos_regset->o[ 7 ]; // the return address + gdb[ NPC ] = 4 + gdb[ PC ]; + + gdb[ FPSR ] = 0; + gdb[ CPSR ] = 0; + +#ifdef THREAD_DEBUG_SERIAL_VERBOSE + newline(); + swrites( "-----------------------------------------------------" ); newline(); + swrites( "-------------- SYNCHRONOUS SWITCH GET----------------" ); newline(); + swrites( "eCos regset at " ); swritex( eCos_regset ); newline(); + x8( "global ", &(gdb[G0]) ); + x8( " in ", &(gdb[I0]) ); + x8( " local ", &(gdb[L0]) ); + x8( " out ", &(gdb[O0]) ); + swrites( "gdb PC = " ); swritex( gdb[ PC ] ); newline(); + swrites( "gdb NPC = " ); swritex( gdb[ NPC ] ); newline(); + swrites( "gdb PSR = " ); swritex( gdb[ PSR ] ); newline(); +#endif + } + +} + +// --------------------------------------------------------------------------- + +void +cyg_hal_sparc_set_gdb_regs( HAL_SavedRegisters *eCos_regset, + void *gdb_regset ) +{ + target_register_t *gdb = (target_register_t *)gdb_regset; + int reg; + cyg_uint32 scratch = 0; + cyg_uint32 *sptrap; + HAL_SavedWindow *trapli, *ctxli; + + // Guess where the eCos register set really is: + if ( 0 == eCos_regset->g[0] || + 0xc0 == (0xe0 & eCos_regset->g[0]) ) { + // Then it's an interrupt stack saved state: + // (either minimal, or a saved PSR with traps disabled) + // The saved register set is pretty minimal, so we have to grub + // around in the stack to find out some truth... + sptrap = (cyg_uint32 *)eCos_regset; // point to the IL save area for + sptrap -= 24; // the trap handler, for PC, NPC + trapli = (HAL_SavedWindow *)sptrap; // Get at those regs + + ctxli = (HAL_SavedWindow *)(trapli->i[6]); // (the frame pointer) + // and get at the interruptee's regs + + scratch = eCos_regset->g[0]; + + // Put back interruptee's registers all over the stack: + for ( reg = 0; reg < 8 ; reg++ ) { + eCos_regset->g[reg] = gdb[ G0 + reg ] ; + trapli->i[reg] = gdb[ O0 + reg ] ; + ctxli->l[reg] = gdb[ L0 + reg ] ; + ctxli->i[reg] = gdb[ I0 + reg ] ; + } + + // Put back the eCos G0 which is always 0 (but abused in eCos_regset) + eCos_regset->g[0] = scratch; + + // In the save context _of the trap handler_ registers are as follows: + // %l0 = psr (with this CWP/window-level in it) + // %l1 = pc + // %l2 = npc + // %l3 = vector number (1-15 for interrupts) + // %l4 = Y register preserved + trapli->l[4] = gdb[ Y ]; + + // I am *not* interfering with the saved PSR, nor the TBR nor WIM. + + // put back return PC and NPC + trapli->l[1] = gdb[ PC ] ; + trapli->l[2] = gdb[ NPC ]; + +#ifdef THREAD_DEBUG_SERIAL_VERBOSE + newline(); + swrites( "-----------------------------------------------------" ); newline(); + swrites( "-------------- INTERRUPT STACK SET ------------------" ); newline(); + swrites( "eCos regset at " ); swritex( eCos_regset ); newline(); + swrites( " trapli " ); swritex( trapli ); newline(); + swrites( " ctxli " ); swritex( ctxli ); newline(); + x8( "global ", &(gdb[G0]) ); + x8( " in ", &(gdb[I0]) ); + x8( " local ", &(gdb[L0]) ); + x8( " out ", &(gdb[O0]) ); + swrites( "gdb PC = " ); swritex( gdb[ PC ] ); newline(); + swrites( "gdb NPC = " ); swritex( gdb[ NPC ] ); newline(); + swrites( "gdb PSR = " ); swritex( gdb[ PSR ] ); newline(); +#endif + + } + else { + // It's a synchronous context switch that led to this object. + // Pick up interruptee's registers from the saved context: + + scratch = eCos_regset->g[0]; + + for ( reg = 0; reg < 8 ; reg++ ) { + eCos_regset->g[reg] = gdb[ G0 + reg ]; + eCos_regset->o[reg] = gdb[ O0 + reg ]; + eCos_regset->li.l[reg] = gdb[ L0 + reg ]; + eCos_regset->li.i[reg] = gdb[ I0 + reg ]; + } + + // Put back the eCos G0 which is always 0 (but abused in eCos_regset) + eCos_regset->g[0] = scratch; + + // I am *not* interfering with the saved PSR, nor the TBR nor WIM. + + // The PC is in o7, altering it via GDB's PC is not on. + // Setting the NPC in a voluntary context is meaningless. + +#ifdef THREAD_DEBUG_SERIAL_VERBOSE + newline(); + swrites( "-----------------------------------------------------" ); newline(); + swrites( "-------------- SYNCHRONOUS SWITCH SET ---------------" ); newline(); + swrites( "eCos regset at " ); swritex( eCos_regset ); newline(); + x8( "global ", &(gdb[G0]) ); + x8( " in ", &(gdb[I0]) ); + x8( " local ", &(gdb[L0]) ); + x8( " out ", &(gdb[O0]) ); + swrites( "gdb PC = " ); swritex( gdb[ PC ] ); newline(); + swrites( "gdb NPC = " ); swritex( gdb[ NPC ] ); newline(); + swrites( "gdb PSR = " ); swritex( gdb[ PSR ] ); newline(); +#endif + } + +} + +/*---------------------------------------------------------------------------*/ +// EOF icontext.c diff --git a/packages/hal/sparc/arch/current/src/sparc.ld b/packages/hal/sparc/arch/current/src/sparc.ld new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/src/sparc.ld @@ -0,0 +1,148 @@ +//=========================================================================== +// +// MLT linker script for SPARC +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + +STARTUP(vectors.o) +ENTRY(reset_vector) +#ifdef EXTRAS +INPUT(extras.o) +#endif +GROUP(libtarget.a libgcc.a) + +#define ALIGN_LMA 8 +#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1)) +#define LMA_EQ_VMA +#define FORCE_OUTPUT . = . + +#define SECTIONS_BEGIN + +#define SECTION_rom_vectors(_region_, _vma_, _lma_) \ + .rom_vectors _vma_ : _lma_ \ + { FORCE_OUTPUT; KEEP (*(.vectors)) } \ + > _region_ + +#define SECTION_text(_region_, _vma_, _lma_) \ + .text _vma_ : _lma_ \ + { _stext = ABSOLUTE(.); \ + *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) } \ + > _region_ \ + _etext = .; PROVIDE (etext = .); + +#define SECTION_fini(_region_, _vma_, _lma_) \ + .fini _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fini) } \ + > _region_ + +#define SECTION_rodata(_region_, _vma_, _lma_) \ + .rodata _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata*) } \ + > _region_ + +#define SECTION_rodata1(_region_, _vma_, _lma_) \ + .rodata1 _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata1) } \ + > _region_ + +#define SECTION_fixup(_region_, _vma_, _lma_) \ + .fixup _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fixup) } \ + > _region_ + +#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ + .gcc_except_table _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.gcc_except_table) } \ + > _region_ + +#define SECTION_ram_vectors(_region_, _vma_, _lma_) \ + .ram_vectors _vma_ : _lma_ \ + { __ram_vectors_start = ABSOLUTE(.); \ + KEEP (*(.ram_vectors)) \ + __ram_vectors_end = ABSOLUTE(.); } \ + > _region_ + +#define SECTION_data(_region_, _vma_, _lma_) \ + .data _vma_ : _lma_ \ + { __ram_data_start = ABSOLUTE (.); \ + *(.data*) *(.data1) \ + _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.); \ + _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.); \ + . = ALIGN (4); \ + KEEP(*( SORT (.ecos.table.*))) ; \ + __CTOR_LIST__ = ABSOLUTE (.); \ + KEEP(*(SORT(.ctors*))) \ + __CTOR_END__ = ABSOLUTE (.); \ + __DTOR_LIST__ = ABSOLUTE (.); \ + KEEP(*(SORT(.dtors*))) \ + __DTOR_END__ = ABSOLUTE (.); \ + _GOT_START = ABSOLUTE (.); _GLOBAL_OFFSET_TABLE_ = ABSOLUTE (.) + 32768; \ + _SDA_BASE_ = ABSOLUTE (.); \ + *(.got.plt) *(.got) _GOT_END_ = ABSOLUTE (.); \ + *(.dynamic) *(.sdata*) *(.sbss*) *(.eh_frame) } \ + > _region_ \ + __rom_data_start = LOADADDR (.data); \ + . = ALIGN (8); \ + __ram_data_end = .; PROVIDE (__ram_data_end = .); _edata = .; PROVIDE (edata = .); + +#define SECTION_bss(_region_, _vma_, _lma_) \ + .bss _vma_ : _lma_ \ + { __bss_start = ABSOLUTE (.); \ + *(.scommon) *(.dynbss) *(.bss) *(COMMON) \ + __bss_end = ABSOLUTE (.); } \ + > _region_ + +#define SECTIONS_END . = ALIGN(8); _end = .; PROVIDE (end = .); \ + .debug 0 : { *(.debug) } \ + .line 0 : { *(.line) } \ + .debug_srcinfo 0 : { *(.debug_srcinfo) } \ + .debug_sfnames 0 : { *(.debug_sfnames) } \ + .debug_aranges 0 : { *(.debug_aranges) } \ + .debug_pubnames 0 : { *(.debug_pubnames) } \ + .debug_info 0 : { *(.debug_info) } \ + .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) } \ + .debug_weaknames 0 : { *(.debug_weaknames) } \ + .debug_funcnames 0 : { *(.debug_funcnames) } \ + .debug_typenames 0 : { *(.debug_typenames) } \ + .debug_varnames 0 : { *(.debug_varnames) } + +#include +#include CYGHWR_MEMORY_LAYOUT_LDI diff --git a/packages/hal/sparc/arch/current/src/vec_ivsr.S b/packages/hal/sparc/arch/current/src/vec_ivsr.S new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/src/vec_ivsr.S @@ -0,0 +1,443 @@ +/*=========================================================================== +// +// vec_ivsr.S +// +// SPARC vectors: interrupt vector service routine +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1999-02-20 +// Purpose: SPARC vector code +// Description: see vectors.S; this is the default vector service routine +// for interrupts. +// +//####DESCRIPTIONEND#### +// +//=========================================================================*/ + +!---------------------------------------------------------------------------- + +// .file "vec_ivsr.S" + +!---------------------------------------------------------------------------- + +#include +#include + +#ifdef CYGPKG_KERNEL +# include +#else +# undef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK +# undef CYGFUN_HAL_COMMON_KERNEL_SUPPORT +#endif + +!------------------------------------------------------------------------ + +#include + +#define DELAYS_AFTER_WRPSR_SAME_WINDOW +#define DELAYS_AFTER_WRWIM + +! Macro to mark the stack as we descend, for debugging, because it is likely +! that actually running the ISR won~t touch the stack, but the memory needs +! to be there. Normally blank. +//#define MARKSTACKUSED st %sp, [ %sp ] +#define MARKSTACKUSED + +!------------------------------------------------------------------------ + + .text + +!--------------------------------------------------------------------------- +! default interrupt VSR, which calls the appropriate ISR after scheduler +! lock and interrupt masking, then interrupt_end(). interrupt_end() must be +! called with interrupts enabled, on the original thread stack (no separate +! interrupt stack) or with interrupts masked, on the original stack (when +! separate interrupt stack is supported). + + .global hal_default_interrupt_vsr +hal_default_interrupt_vsr: + ! here,locals have been set up as follows: + ! %l0 = psr (with this CWP/window-level in it) + ! %l1 = pc + ! %l2 = npc + ! %l3 = vector number (1-15 for interrupts) + ! and we are in our own register window, though it is likely that + ! the next one will need to be saved before we can use it: + ! ie. this one is the invalid register window. + + ! must establish a safe stack before re-enabling interrupts + traps + and %l0, __WINBITS, %l7 ! CWP extracted + ! no inc/dec here, so no need for special measures for not-8-windows + mov 1, %l6 + sll %l6, %l7, %l6 ! 1 << CWP + rd %wim, %l5 + cmp %l5, %l6 ! are they the same? + bne 1f ! No, so the stack is OK as is. + + ! now do by hand an overflow trap, effectively + mov %g1, %l7 ! (DELAY SLOT) + srl %l5, 1, %l5 + sll %l6, __WINSIZE-1, %l6 + or %l6, %l5, %g1 ! new WIM in %g1 so we can get it + ! within the save: + save ! Slip into next window + mov %g1, %wim ! Install the new wim + ! (invalidates current window!) +#ifdef DELAYS_AFTER_WRWIM + nop + nop + nop +#endif + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + restore ! Go back to trap window. + mov %l7, %g1 ! Restore %g1 + +1: ! now save away the regs we must preserve + sub %fp, 32 * 4, %sp +#ifdef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + std %g0, [%sp + 16 * 4] ! save G registers + std %g2, [%sp + 18 * 4] ! (set %g0 place to 0 to flag special context) + std %g4, [%sp + 20 * 4] + std %g6, [%sp + 22 * 4] +#else // not CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + st %g1, [%sp + 17 * 4] ! save G registers + std %g2, [%sp + 18 * 4] + std %g4, [%sp + 20 * 4] + std %g6, [%sp + 22 * 4] + + ! no point whatsoever in saving O registers + + ! and save the CWP in %g0 save place + st %l0, [%sp + 16 * 4] +#endif // ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + + sub %sp, 24 * 4, %sp ! fresh frame including + ! arg spill area for callees + MARKSTACKUSED ! kilroy was here + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + ! we will switch to the interrupt stack unless already running on it + + .extern cyg_interrupt_stack + .extern cyg_interrupt_stack_base + set cyg_interrupt_stack, %g1 + set cyg_interrupt_stack_base, %g2 + + cmp %sp, %g2 ! below base? + blu 1f ! if so, switch. + cmp %sp, %g1 ! below top? (DELAY SLOT) + blu 2f ! if so, DON~T switch. + nop ! (DELAY SLOT) +1: ! switch to the interrupt stack + st %sp, [ %g1 ] ! there is spare above stack + sub %g1, 24 * 4, %sp ! fresh frame including + ! arg spill area for callees + MARKSTACKUSED ! kilroy was here +2: + ! continue as before, already in the interrupt stack. +#endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT + ! Lock the scheduler + .extern SCHED_LOCK_MANGLED_NAME + sethi %hi(SCHED_LOCK_MANGLED_NAME), %l7 + ld [ %l7 + %lo(SCHED_LOCK_MANGLED_NAME) ], %l6 + add %l6, 1, %l6 + st %l6, [ %l7 + %lo(SCHED_LOCK_MANGLED_NAME) ] +#endif + + ! HELP_GDB_WITH_BACKTRACE + mov %i7, %l5 ! preserve it in l5 + mov %l1, %i7 ! bogus return link here + + ! and we must preserve the Y register (multiply/divide auxiliary) + ! over these calls; we will keep it in %l4 which is otherwise unused. + rd %y, %l4 + + ! Now we can reenable traps and mask off only lower prio interrupts: + andn %l0, 0xf00, %l7 ! clear PIL field + or %l7, 0x0e0, %l7 ! and ET (+S,PS) + sll %l3, 8, %l6 ! trap number (1-15) into PIL bitfield + wr %l7, %l6, %psr ! and enable! +#ifdef DELAYS_AFTER_WRPSR_SAME_WINDOW + nop + nop + nop +#endif + ! now call the ISR and so on with the appropriate args: + ! ie. + ! isr_retcode = (*(hal_interrupt_handlers[ vector ])) + ! ( vector, hal_interrupt_data[ vector ] ); + + ! from hal_arch.h + !// ISR tables + !CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT]; + !CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_ISR_COUNT]; + !CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT]; + + mov %l3, %o0 + sll %l3, 2, %l3 ! %l3 to a word offset + sethi %hi(hal_interrupt_data), %l7 + or %l7, %lo(hal_interrupt_data), %l7 + ld [ %l7 + %l3 ], %o1 + + sethi %hi(hal_interrupt_handlers), %l7 + or %l7, %lo(hal_interrupt_handlers), %l7 + ld [ %l7 + %l3 ], %l6 + call %l6 + nop + +#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT + ! We only need to call _interrupt_end() when there is a kernel + ! present to do any tidying up. + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + ! now we switch back to the user stack (if we~re at the top + ! of the interrupt stack). + + or %l0, 0xfe0, %l7 + wr %l7, %psr ! Interrupts all masked, ET +#ifdef DELAYS_AFTER_WRPSR_SAME_WINDOW + nop + nop + nop +#endif + + .extern cyg_interrupt_stack + set cyg_interrupt_stack - (24 * 4), %g1 + + cmp %sp, %g1 ! is SP less? + blu 1f ! if so, do not change back + nop + ! switch to the thread stack + ld [ %g1 + (24 * 4) ], %sp ! there is spare above stack +1: + +#else // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + ! First restore the processor interrupt level to that interrupted + ! (otherwise a task-switch runs at the current PIL) on the assumption + ! that the ISR dealt with the interrupt source per se, so it is safe + ! to unmask it, effectively: + or %l0, 0x0e0, %l7 ! original PSR and ET (+S,PS) + wr %l7, %psr ! and enable! +#ifdef DELAYS_AFTER_WRPSR_SAME_WINDOW + nop + nop + nop +#endif +#endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + + ! then call interrupt_end( isr_retcode, &intr_object, ®save ) + ! to unlock the scheduler and do any rescheduling that~s needed. + ! argument 0 (isr_retcode) is already in place in %o0 + sethi %hi(hal_interrupt_objects), %l7 + or %l7, %lo(hal_interrupt_objects), %l7 + ld [ %l7 + %l3 ], %o1 + add %sp, 24 * 4, %o2 ! saved regset (maybe tiny) + + .extern interrupt_end + call interrupt_end + nop +#endif + + ! restore the Y register having done our callouts to C + wr %l4, %y + + ! We can reinstall the original CWP here; even if interrupt_end() + ! performed a reschedule (ie. yield/resume pair) we will be in the + ! same window. The window is preserved by reschedule precisely + ! because it is impossible atomically to disable traps here without + ! involving a CWP living in a register for a time when other + ! interrupts may occur. + + ! disable traps (using the saved psr is fastest way) + wr %l0, %psr ! restores flags, disables traps, and old PIL +#ifdef DELAYS_AFTER_WRPSR_SAME_WINDOW + nop + nop + nop +#endif + + ! HELP_GDB_WITH_BACKTRACE + mov %l5, %i7 ! restore (unused) return link + + ! and restore other saved regs + ! (see CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT) + add %sp, 24 * 4, %sp ! undo fresh frame + + ld [%sp + 17 * 4], %g1 ! restore G registers + ldd [%sp + 18 * 4], %g2 + ldd [%sp + 20 * 4], %g4 + ldd [%sp + 22 * 4], %g6 + + ! and do NOT restore any other registers L, I or O + + ! Now test for window underflow here and fix up if needs be. + ! + ! Why? interrupt_end() might have yielded us, when only + ! its own frame was restored; its own return to us caused a + ! window underflow trap, as would our return to interruptee + ! unless we deal with it now. + + add %l0, 1, %l7 ! interruptee~s CWP plus noise + and %l7, __WINBITS, %l7 ! CWP only +#if 8 == __WINSIZE + ! it is in range already +#else // expect 5 or 6 or 7 windows + cmp %l7, __WINSIZE + bge,a 567f ! taken: do delay slot, handle overflow + mov 0, %l7 ! only if .ge. above +567: +#endif + mov 1, %l6 + sll %l6, %l7, %l6 ! 1 << CWP + rd %wim, %l5 + cmp %l5, %l6 ! are they the same? + bne 2f ! No, so the stack is OK as is. + + ! now do by hand an underflow trap, effectively + sll %l5, 1, %l5 ! Rotate wim left + srl %l6, __WINSIZE-1, %l6 + wr %l5, %l6, %wim +#ifdef DELAYS_AFTER_WRWIM + nop ! are these delays needed? + nop ! (following restore uses wim) + nop +#endif + restore ! Interruptee~s window + ldd [%sp + 0 * 4], %l0 ! restore L & I registers + ldd [%sp + 2 * 4], %l2 + ldd [%sp + 4 * 4], %l4 + ldd [%sp + 6 * 4], %l6 + + ldd [%sp + 8 * 4], %i0 + ldd [%sp + 10 * 4], %i2 + ldd [%sp + 12 * 4], %i4 + ldd [%sp + 14 * 4], %i6 + save ! Back to trap window + +2: ! restore the condition codes, PSR and PIL and return from trap. + wr %l0, %psr ! restores flags, disables traps, and old PIL +#ifdef DELAYS_AFTER_WRPSR_SAME_WINDOW + nop + nop + nop +#endif + jmpl %l1, %g0 + rett %l2 + +!---------------------------------------------------------------------------- + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +! This routine can only be called from a thread stack, maybe +! with interrupts (but not traps) disabled. +! It switches to the interrupt stack then calls back to the +! kernel to execute DSRs. + + .global hal_interrupt_stack_call_pending_DSRs +hal_interrupt_stack_call_pending_DSRs: + save %sp, -24 * 4, %sp + + MARKSTACKUSED ! kilroy was here + + ! be atomic + rd %psr, %l0 + andn %l0, 0x20, %l1 ! clear ET to disable traps + wr %l1, %psr ! into the PSR + nop + nop + nop + + mov %sp, %l7 ! save calling stack location + + ! now switch stack to the interrupt stack, plus some headroom + ! for saving a register set if we are interrupted + .extern cyg_interrupt_stack + set cyg_interrupt_stack - 4 * 24, %sp + + MARKSTACKUSED ! kilroy was here + + ! and enable interrupts unconditionally to call the DSRs + or %l0, 0x0e0, %l2 ! set ET, S, PS + andn %l2, 0xf00, %l2 ! PIL to zero + wr %l2, %psr ! into the PSR + nop + nop + nop + + .extern cyg_interrupt_call_pending_DSRs + call cyg_interrupt_call_pending_DSRs + nop + + mov %l7, %sp ! restore calling stack + + wr %l0, %psr ! restore interrupt status + nop + nop + nop + + ret + restore +#endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +!---------------------------------------------------------------------------- + +! end of vec_ivsr.S diff --git a/packages/hal/sparc/arch/current/src/vec_xvsr.S b/packages/hal/sparc/arch/current/src/vec_xvsr.S new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/src/vec_xvsr.S @@ -0,0 +1,297 @@ +/*=========================================================================== +// +// vec_xvsr.S +// +// SPARC vectors: exception vector service routine +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1999-02-20 +// Purpose: SPARC vector code +// Description: see vectors.S; this is the default vector service routine +// for exceptions. +// +//####DESCRIPTIONEND#### +// +//=========================================================================*/ + +!----------------------------------------------------------------------------- + +// .file "vec_xvsr.S" + +!---------------------------------------------------------------------------- + +#include +#include + +#ifdef CYGPKG_KERNEL +# include +#endif + +!------------------------------------------------------------------------ + +#include + +#define DELAYS_AFTER_WRPSR_SAME_WINDOW +#define DELAYS_AFTER_WRWIM + +!------------------------------------------------------------------------ + + .text + +!--------------------------------------------------------------------------- +! default exception handler VSR, which calls the appropriate ISR after +! interrupt masking - much the same as the interrupt VSR but does not lock +! scheduler or call interrupt_end(). + + .global hal_default_exception_vsr +hal_default_exception_vsr: + ! here,locals have been set up as follows: + ! %l0 = psr (with this CWP/window-level in it) + ! %l1 = pc + ! %l2 = npc + ! %l3 = vector number (16-25 for traps) + ! and we are in our own register window, though it is likely that + ! the next one will need to be saved before we can use it: + ! ie. this one is the invalid register window. + + ! must establish a safe stack before re-enabling interrupts + traps + and %l0, __WINBITS, %l7 ! CWP extracted + ! no inc/dec here, so no need for special measures for not-8-windows + mov 1, %l6 + sll %l6, %l7, %l6 ! 1 << CWP + rd %wim, %l5 + cmp %l5, %l6 ! are they the same? + bne 1f ! No, so the stack is OK as is. + + ! now do by hand an overflow trap, effectively + mov %g1, %l7 ! (DELAY SLOT) + srl %l5, 1, %l5 + sll %l6, __WINSIZE-1, %l6 + or %l6, %l5, %g1 ! new WIM in %g1 so we can get it + ! within the save: + save ! Slip into next window + mov %g1, %wim ! Install the new wim + ! (invalidates current window!) +#ifdef DELAYS_AFTER_WRWIM + nop + nop + nop +#endif + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + restore ! Go back to trap window. + mov %l7, %g1 ! Restore %g1 + +1: ! now save away the regs we must preserve + sub %fp, 32 * 4, %sp + ! save a maximal context regardless: see also + ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + st %g1, [%sp + 17 * 4] ! save G registers + std %g2, [%sp + 18 * 4] + std %g4, [%sp + 20 * 4] + std %g6, [%sp + 22 * 4] + + ! no point whatsoever in saving O registers + + ! and save the CWP in %g0 save place + st %l0, [%sp + 16 * 4] + + sub %sp, 24 * 4, %sp ! fresh frame including + ! arg spill area for callees + + ! do not lock the scheduler + + ! HELP_GDB_WITH_BACKTRACE + mov %i7, %l5 ! preserve it JIC + mov %l1, %i7 ! bogus return link here + + ! and we must preserve the Y register (multiply/divide auxiliary) + ! over these calls; we will keep it in %l4 which is otherwise unused. + rd %y, %l4 + + ! Now we can reenable traps (preserving interrupt level) + or %l0, 0x0e0, %l7 ! set ET (+S,PS), preserve PIL + wr %l7, %psr ! and enable! +#ifdef DELAYS_AFTER_WRPSR_SAME_WINDOW + nop + nop + nop +#endif + ! now call the XSR and so on with the appropriate args: + ! ie. + ! isr_retcode = (*(hal_interrupt_handlers[ vector ])) + ! ( vector, hal_interrupt_data[ vector ], stackp ); + + ! from hal_arch.h + !// ISR tables + !CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT]; + !CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_ISR_COUNT]; + !CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT]; + + mov %l3, %o0 + sll %l3, 2, %l3 ! %l3 to a word offset + sethi %hi(hal_interrupt_data), %l7 + or %l7, %lo(hal_interrupt_data), %l7 + ld [ %l7 + %l3 ], %o1 ! data + add %sp, 24 * 4, %o2 ! stackpointer of saved regset + + sethi %hi(hal_interrupt_handlers), %l7 + or %l7, %lo(hal_interrupt_handlers), %l7 + ld [ %l7 + %l3 ], %l6 + call %l6 + nop + + ! do not call _interrupt_end() + + ! restore the Y register having done our callouts to C + wr %l4, %y + + ! We can reinstall the original CWP here; even if interrupt_end() + ! performed a reschedule (ie. yield/resume pair) we will be in the + ! same window. The window is preserved by reschedule precisely + ! because it is impossible atomically to disable traps here without + ! involving a CWP living in a register for a time when other + ! interrupts may occur. + + ! disable traps (using the saved psr is fastest way) + wr %l0, %psr ! restores flags, disables traps, same PIL. +#ifdef DELAYS_AFTER_WRPSR_SAME_WINDOW + nop + nop + nop +#endif + ! HELP_GDB_WITH_BACKTRACE + mov %l5, %i7 ! restore (unused) return link + + ! and restore other saved regs + add %sp, 24 * 4, %sp ! undo fresh frame + ! restore a maximal context regardless: see also + ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT + ldd [%sp + 0 * 4], %l0 ! restore L & I registers + ldd [%sp + 2 * 4], %l2 ! to support the handler + ldd [%sp + 4 * 4], %l4 ! having messed with them. + ldd [%sp + 6 * 4], %l6 + + ldd [%sp + 8 * 4], %i0 + ldd [%sp + 10 * 4], %i2 + ldd [%sp + 12 * 4], %i4 + ldd [%sp + 14 * 4], %i6 + + ld [%sp + 17 * 4], %g1 ! and G registers + ldd [%sp + 18 * 4], %g2 + ldd [%sp + 20 * 4], %g4 + ldd [%sp + 22 * 4], %g6 + ! no point whatsoever in loading back O registers. + + ! Now test for window underflow here and fix up if needs be. + ! + ! Why? interrupt_end() might have yielded us, when only + ! its own frame was restored; its own return to us caused a + ! window underflow trap, as would our return to interruptee + ! unless we deal with it now. + + add %l0, 1, %l7 ! interruptee~s CWP plus noise + and %l7, __WINBITS, %l7 ! CWP only +#if 8 == __WINSIZE + ! it is in range already +#else // expect 5 or 6 or 7 windows + cmp %l7, __WINSIZE + bge,a 567f ! taken: do delay slot, handle overflow + mov 0, %l7 ! only if .ge. above +567: +#endif + mov 1, %l6 + sll %l6, %l7, %l6 ! 1 << CWP + rd %wim, %l5 + cmp %l5, %l6 ! are they the same? + bne 2f ! No, so the stack is OK as is. + + ! now do by hand an underflow trap, effectively + sll %l5, 1, %l5 ! Rotate wim left + srl %l6, __WINSIZE-1, %l6 + wr %l5, %l6, %wim +#ifdef DELAYS_AFTER_WRWIM + nop ! are these delays needed? + nop ! (following restore uses wim) + nop +#endif + restore ! Interruptee~s window + ldd [%sp + 0 * 4], %l0 ! restore L & I registers + ldd [%sp + 2 * 4], %l2 + ldd [%sp + 4 * 4], %l4 + ldd [%sp + 6 * 4], %l6 + + ldd [%sp + 8 * 4], %i0 + ldd [%sp + 10 * 4], %i2 + ldd [%sp + 12 * 4], %i4 + ldd [%sp + 14 * 4], %i6 + save ! Back to trap window + +2: ! restore the condition codes, PSR and PIL and return from trap. + wr %l0, %psr ! restores flags, disables traps, and old PIL +#ifdef DELAYS_AFTER_WRPSR_SAME_WINDOW + nop + nop + nop +#endif + jmpl %l1, %g0 + rett %l2 + + +! end of vec_xvsr.S diff --git a/packages/hal/sparc/arch/current/src/vectors.S b/packages/hal/sparc/arch/current/src/vectors.S new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/src/vectors.S @@ -0,0 +1,553 @@ +/*============================================================================= +// +// vectors.S +// +// SPARC vectors and bootup code +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors:hmt +// Date: 1998-12-15 +// Purpose: SPARC vector code +// Description: This file contains the code which hangs off SPARC vectors +// including reset; it handles register under/overflow as well +// as bootup, anything else is deferred to the default interrupt +// or exception vsrs respectively. See vec_[ix]vsr.S ... +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +!----------------------------------------------------------------------------- + +// .file "vectors.S" + +!----------------------------------------------------------------------------- + +#include +#include + +#include +#include CYGBLD_HAL_PLATFORM_H // Platform config file + +#ifdef CYGPKG_KERNEL +# include +#else +# undef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK +# undef CYGFUN_HAL_COMMON_KERNEL_SUPPORT +#endif + +#if defined( CYGPKG_HAL_SPARCLITE_SIM ) || \ + defined( CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK ) || \ + defined( CYGPKG_HAL_SPARC_LEON ) || \ + defined( CYGPKG_HAL_SPARC_ERC32 ) +#define BOOTUPSTACK_IS_INTERRUPTSTACK +#endif + +//#define CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING + +#ifndef CYGHWR_HAL_SPARC_HAS_ASR17 +#ifndef CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING +#error Single Vector Trapping (SVT) demands ASR17 +#endif +#endif + +#ifdef CYG_HAL_STARTUP_ROM +# ifndef CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING + +! ROM startup and Single Vector Trapping demands a copy to RAM. +! Otherwise it may be configured in, but it is not required. + +# ifndef CYGIMP_HAL_SPARC_COPY_VECTORS_TO_RAM +# define CYGIMP_HAL_SPARC_COPY_VECTORS_TO_RAM +# endif + +# endif +#endif + +!------------------------------------------------------------------------ + +#include + +#define DELAYS_AFTER_WRPSR_SAME_WINDOW +#define DELAYS_AFTER_WRWIM + +!------------------------------------------------------------------------ + +#ifdef CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING + + .macro VECTOR_EXCEPTION + .p2align 4 + rd %tbr, %l3 + rd %psr, %l0 + ba __entry_exception + and %l3, TT_MASK, %l4 + .endm + + .macro VECTOR_INTERRUPT level + .p2align 4 + rd %psr, %l0 + mov \level << 2, %l5 + ba __entry_interrupt + mov \level << 4, %l4 + .endm + + .macro VECTOR_CODE_WIM name + .p2align 4 + ba __entry_\name + rd %wim, %l0 + .endm + +#endif // CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING + +!------------------------------------------------------------------------ +! The start of the code; this is the entry point: + + .section ".vectors","ax" + + .global rom_vectors +rom_vectors: + .global reset_vector +reset_vector: + ! this code goes to the real reset handler, it will be + ! overwritten by the start of vectoring handler... + b genuine_reset + nop + ! usually drop through to: +#ifdef CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING + ba __entry_exception ! reset becomes an exception + and %l3, TT_MASK, %l4 ! once we are running + + VECTOR_EXCEPTION ! 1 + VECTOR_EXCEPTION ! 2 + VECTOR_EXCEPTION ! 3 + VECTOR_EXCEPTION ! 4 + + VECTOR_CODE_WIM wover ! 5 window overflow + VECTOR_CODE_WIM wunder ! 6 window underflow + VECTOR_EXCEPTION ! 7 + VECTOR_EXCEPTION ! 8 + VECTOR_EXCEPTION ! 9 + + VECTOR_EXCEPTION ! 10 + VECTOR_EXCEPTION ! 11 + VECTOR_EXCEPTION ! 12 + VECTOR_EXCEPTION ! 13 + VECTOR_EXCEPTION ! 14 + + VECTOR_EXCEPTION ! 15 + VECTOR_EXCEPTION ! 16 + VECTOR_INTERRUPT 1 ! 17 interrupt_level_1 + VECTOR_INTERRUPT 2 ! 18 interrupt_level_2 + VECTOR_INTERRUPT 3 ! 19 interrupt_level_3 + + VECTOR_INTERRUPT 4 ! 20 interrupt_level_4 + VECTOR_INTERRUPT 5 ! 21 interrupt_level_5 + VECTOR_INTERRUPT 6 ! 22 interrupt_level_6 + VECTOR_INTERRUPT 7 ! 23 interrupt_level_7 + VECTOR_INTERRUPT 8 ! 24 interrupt_level_8 + + VECTOR_INTERRUPT 9 ! 25 interrupt_level_9 + VECTOR_INTERRUPT 10 ! 26 interrupt_level_10 + VECTOR_INTERRUPT 11 ! 27 interrupt_level_11 + VECTOR_INTERRUPT 12 ! 28 interrupt_level_12 + VECTOR_INTERRUPT 13 ! 29 interrupt_level_13 + + VECTOR_INTERRUPT 14 ! 30 interrupt_level_14 + VECTOR_INTERRUPT 15 ! 31 interrupt_level_15 + VECTOR_EXCEPTION ! 32 + VECTOR_EXCEPTION ! 33 + VECTOR_EXCEPTION ! 34 + + VECTOR_EXCEPTION ! 35 + VECTOR_EXCEPTION ! 36 + VECTOR_EXCEPTION ! 37 + VECTOR_EXCEPTION ! 38 + VECTOR_EXCEPTION ! 39 + + .rept 216 ! 40-255 is 216 of them + VECTOR_EXCEPTION ! whichever + .endr +#endif // CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING + +#ifndef CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING +real_vector: + ! here,locals have been set up as follows: + ! %l0 = psr + ! %l1 = pc + ! %l2 = npc + ! %l3 = tbr + and %l3, TT_IS_INTR_MASK, %l4 + cmp %l4, TT_IS_INTR_VALUE + bne not_an_interrupt ! delay slot does not matter + ! here be the pre-vector interrupt handler +interrupt: + and %l3, 0x0f0, %l4 ! get an interrupt number out + srl %l4, 2, %l5 ! to a word address offset +#endif // !CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING +__entry_interrupt: + sethi %hi(hal_vsr_table), %l6 + or %l6, %lo(hal_vsr_table), %l6 + ld [ %l6 + %l5 ], %l6 ! get vector in %l6 + jmp %l6 ! and go there + srl %l4, 4, %l3 ! vector number into %l3: so that + ! interrupts and exceptions/traps + ! have the same API to VSRs + +#ifndef CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING +not_an_interrupt: + and %l3, TT_MASK, %l4 + cmp %l4, (TRAP_WUNDER << TT_SHL) + + bne,a not_window_underflow + cmp %l4, (TRAP_WOVER << TT_SHL) ! (if taken) + + ! here be the window underflow handler: +window_underflow: + ! CWP is trap handler + ! CWP + 1 is trapped RESTORE instruction + ! CWP + 2 is invalid context which must be restored + ! CWP + 3 is next invalid context + + wr %l0, %psr ! restore the condition flags + ! (CWP is unchanged) + ! the following instructions delay enough; no need for NOPs + rd %wim, %l0 ! get the wim +#endif // !CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING +__entry_wunder: + sll %l0, 1, %l3 ! Rotate wim left + srl %l0, __WINSIZE-1, %l0 + wr %l0, %l3, %wim ! Install the new wim + +#ifdef DELAYS_AFTER_WRWIM + nop ! are these delays needed? + nop ! (following restore uses wim) + nop +#endif + restore ! Users window + restore ! Her callers window (now valid) + + ldd [%sp + 0 * 4], %l0 ! restore L & I registers + ldd [%sp + 2 * 4], %l2 + ldd [%sp + 4 * 4], %l4 + ldd [%sp + 6 * 4], %l6 + + ldd [%sp + 8 * 4], %i0 + ldd [%sp + 10 * 4], %i2 + ldd [%sp + 12 * 4], %i4 + ldd [%sp + 14 * 4], %i6 + + save ! Back to trap window + save + + jmp %l1 + rett %l2 + +#ifndef CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING +not_window_underflow: + bne,a not_window_overflow + srl %l4, 4, %l4 ! (if taken) + + ! here be the window overflow handler: +window_overflow: + ! CWP + 1 is caller whose SAVE bounced + ! CWP is trap handler = invalid window + ! CWP - 1 is next invalid window which needs to be saved + + wr %l0, %psr ! restore the condition flags + ! (CWP is unchanged) + ! the following instructions delay enough; no need for NOPs + rd %wim, %l0 +#endif // !CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING +__entry_wover: + mov %g1, %l3 ! Save g1, we use it to hold the wim + srl %l0, 1, %g1 ! Rotate wim right + sll %l0, __WINSIZE-1, %l0 + or %l0, %g1, %g1 + + save ! Slip into next window + mov %g1, %wim ! Install the new wim + ! (invalidates current window!) + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + restore ! Go back to trap window. + mov %l3, %g1 ! Restore %g1 + + jmpl %l1, %g0 + rett %l2 + +#ifdef CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING + // ADDITIONAL code to provide an entry point: +__entry_exception: + srl %l4, 4, %l4 +#endif // CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING +not_window_overflow: + ! from here on in, %l4 is the trap number in clear + cmp %l4, 128 + bge 1f + mov 0, %l5 ! offset 0 for user traps + + cmp %l4, 36 ! coprocessor special case + beq 1f + mov 4, %l5 ! ...treated as FP, code 4 + + cmp %l4, 10 + bge 1f + mov 10, %l5 ! offset 10 for "others" + + ! if we are here, the trap number is 1-9 inclusive + ! so put it in %l5 and drop through... + mov %l4, %l5 +1: + or %l5, 16, %l5 ! offset into table is 16... for traps. + sll %l5, 2, %l5 ! to a word address offset + sethi %hi(hal_vsr_table), %l6 + or %l6, %lo(hal_vsr_table), %l6 + ld [ %l6 + %l5 ], %l6 ! get vector in %l6 + jmp %l6 ! and go there + srl %l5, 2, %l3 ! vector number into %l3: so that + ! interrupts and exceptions/traps + ! have the same API to VSRs + ! NB that~s eCos vector number not TRAP number above. + + ! and that is the end of the pre-vector trap handler + + .global rom_vectors_end +rom_vectors_end: + + ! these instructions are copied into the reset vector + ! after startup to _not_ branch to the genuine_reset code below +real_vector_instructions: + rd %tbr, %l3 + rd %psr, %l0 + + + + ! genuine reset code called from time zero: +genuine_reset: ! set psr, mask interrupts & traps + wr %g0, 0xfc0 + __WIN_INIT, %psr + nop ! mode = prevMode = S, CWP=7 + nop + nop + wr %g0, 0, %wim ! No invalid windows (yet) + nop + nop + nop + + sethi %hi(reset_vector), %g1 + andn %g1, 0xfff, %g1 ! should not be needed + wr %g1, %tbr ! Traps are at reset_vector + nop + nop + nop +#ifdef CYGHWR_HAL_SPARC_HAS_ASR17 +#ifdef CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING + wr %g0, 0, %asr17 ! Multiple vector trapping +#else + wr %g0, 1, %asr17 ! Single vector trapping +#endif // !CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING +#endif // CYGHWR_HAL_SPARC_HAS_ASR17 + nop + nop + nop + +// INCLUDE PLATFORM BOOT + +// This should set up RAM and caches, and calm down any external interrupt +// sources. Also copy two instructions from real_vector_instructions +// into reset_vector, then invalidate the instruction cache. + +#include + +// halboot.si returns with %sp all set, in sleb versions. +// (though we override if there is an interrupt stack) + + led 0x80 + + ! now set up a stack and initial frame linkage + ! so as to be able to make C function calls: + ! current window is 7, the highest, so we store a + ! saved frame thingy that refers to itself in the stack, + ! then another which is valid and drop into main from there. + +#ifdef BOOTUPSTACK_IS_INTERRUPTSTACK + sethi %hi(cyg_interrupt_stack), %i6 + or %i6, %lo(cyg_interrupt_stack), %i6 +#endif + andn %i6, 7, %i6 ! round fp down to double alignment + mov 0, %i7 ! null return address + sethi %hi(0xb51ac000), %i0 ! "BStac" pattern + or %i0, 24, %i0 + or %i0, 1, %i1 + or %i0, 2, %i2 + or %i0, 3, %i3 + or %i0, 4, %i4 + or %i0, 5, %i5 + + sethi %hi(0xb51ac000), %l0 ! "BStac" pattern + or %l0, 16, %l0 + or %l0, 1, %l1 + or %l0, 2, %l2 + or %l0, 3, %l3 + or %l0, 4, %l4 + or %l0, 5, %l5 + or %l0, 6, %l6 + or %l0, 7, %l7 + + sub %fp, 16 * 4, %sp ! Stack pointer + + led 0x90 + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] ! into new stack frame + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + led 0x91 + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + led 0x92 + + sethi %hi(0xb0010000), %o0 ! "Boot" pattern + or %o0, 8, %o0 + or %o0, 1, %o1 + or %o0, 2, %o2 + or %o0, 3, %o3 + or %o0, 4, %o4 + or %o0, 5, %o5 + + led 0x98 + + wr %g0, __WIM_INIT, %wim ! Window 7 (current) is invalid + nop + nop + nop + + led 0x99 + + sethi %hi(0xb0010000), %g1 ! "Boot" pattern + or %g1, 2, %g2 + or %g1, 3, %g3 + or %g1, 4, %g4 + or %g1, 5, %g5 + or %g1, 6, %g6 + or %g1, 7, %g7 + or %g1, 1, %g1 + + led 0xa0 + + wr %g0, 0xfe0 + __WIN_INIT, %psr + nop ! Enable traps: + nop ! set psr, _do_ mask interrupts + nop ! mode = prevMode = S, CWP=7 + + led 0xb0 + + ! now we can start calling out and running C code! + .extern cyg_hal_start + call cyg_hal_start ! puts return address in %o7 + or %g1, 1, %g1 + +loop_forever: + ta 1 + b loop_forever ! if it returns + nop + + +!--------------------------------------------------------------------------- +! hal_vsr_table... + + .section ".data" + .balign 4 + .global hal_vsr_table +hal_vsr_table: + .rept 16 + .word hal_default_interrupt_vsr + .endr + .rept 11 + .word hal_default_exception_vsr + .endr + +!--------------------------------------------------------------------------- +! Bootup stack (only needed explicitly in sim) + +#ifdef BOOTUPSTACK_IS_INTERRUPTSTACK + .section ".bss" + +#ifndef CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE +#define CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE 4096 +#endif + .balign 16 + .global cyg_interrupt_stack_base +cyg_interrupt_stack_base: + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE + .byte 0 + .endr + .balign 16 + .global cyg_interrupt_stack +cyg_interrupt_stack: + .long 0,0,0,0,0,0,0,0 ! here be secret state stored +#endif + +!------------------------------------------------------------------------ +! Define a section that reserves space at the start of RAM for the +! vectors to be copied into, for ROM start only. + + .section ".ram_vectors","awx",@nobits +#ifdef CYGIMP_HAL_SPARC_COPY_VECTORS_TO_RAM + ! need a space at base of RAM for copied vector/trampoline code + .align 0x1000 + .space 8 ! for fencepost errors + .space (rom_vectors_end - rom_vectors) +#endif // CYGIMP_HAL_SPARC_COPY_VECTORS_TO_RAM + +!------------------------------------------------------------------------ +! end of vectors.S diff --git a/packages/hal/sparc/arch/current/tests/sparc_ex.c b/packages/hal/sparc/arch/current/tests/sparc_ex.c new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/arch/current/tests/sparc_ex.c @@ -0,0 +1,437 @@ +/*================================================================= +// +// sparc_ex.c +// +// SPARC HAL exception and register manipulation test +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): dsm +// Contributors: dsm, nickg +// Date: 1998-06-18 +//####DESCRIPTIONEND#### +*/ + +#include + +#include + +#include + +#include + +#include +#include + +#include + +#ifdef CYGDBG_USE_TRACING +#define OUTER_REPEATS 1 +#define SIM_REPEATS 10 +#define HW_REPEATS 1000 +#else +#define OUTER_REPEATS 10 +#define SIM_REPEATS 100 +#define HW_REPEATS 10000 +#endif // using tracing to slow everything down + +// ------------------------------------------------------------------------- +// These routines are used to cause an alignment trap; the compiler is too +// darned clever by half, if you try to inline this stuff as macros it uses +// different instruction sequences and register pairs. This makes for a +// less thorough test, but there's no option other than writing a LOT of +// assembler code. + +// Further, with -O3, the compiler inlines these anyway and so makes +// non-trapping code. So they are now at the end, to prevent this. + +extern cyg_uint64 get_ll( cyg_uint64 *p ); + +extern cyg_uint64 get_llplus( cyg_uint64 *p ); + +extern cyg_uint32 get_i( cyg_uint32 *p ); + +extern cyg_uint32 get_iplus( cyg_uint32 *p ); + +extern cyg_uint16 get_s( cyg_uint16 *p ); + +extern cyg_uint16 get_splus( cyg_uint16 *p ); + +// ------------------------------------------------------------------------- +// Some memory to read in more-or-less aligned manners. + +#define L1 (0x123456789abcdef0l) +#define L2 (0xfedcba9876543210l) +static cyg_uint64 a[ 2 ] = { + L1, + L2 +}; + +#define M32 (0x00000000ffffffffl) +#define M16 (0x000000000000ffffl) +#define M8 (0x00000000000000ffl) + +volatile cyg_uint32 trap = 0; +volatile cyg_uint32 same = 0; +volatile cyg_uint32 tcount = 0; + +// ------------------------------------------------------------------------- +// This macro invokes a routine then checks that a suitable trap occurred. +// It expects the instruction simply to be skipped, rather than the trap +// _handled_ or the unaligned access to be _emulated_ in any way. This +// test is just a proof that we could write such a handler. + +#define TRAPPROC( _var_, _type_, _align_, _proc_ ) \ +CYG_MACRO_START \ + otrap = trap; \ + otcount = tcount; \ + _var_ = _proc_( (_type_ *)(cp + (_align_)) ); \ + CYG_TEST_CHECK( trap != otrap || same > 0, \ + "No trap [" #_type_ ":" #_align_ "," #_proc_ "]" ); \ + CYG_TEST_CHECK( same < 20, \ + "Undetected trap loop[" #_type_ ":" #_align_ "," #_proc_ "]" ); \ + CYG_TEST_CHECK( tcount > otcount, \ + "No trap counted [" #_type_ ":" #_align_ "," #_proc_ "]" ); \ + CYG_TEST_CHECK( (tcount - 1) <= otcount, \ + "Tcount overinc [" #_type_ ":" #_align_ "," #_proc_ "]" ); \ +CYG_MACRO_END + +// and this one expects no trap to occur: +#define SAFEPROC( _var_, _type_, _align_, _proc_ ) \ +CYG_MACRO_START \ + trap = 0; \ + otcount = tcount; \ + _var_ = _proc_( (_type_ *)(cp + (_align_)) ); \ + CYG_TEST_CHECK( 0 == trap, \ + "Trap [" #_type_ ":" #_align_ "," #_proc_ "]" ); \ + CYG_TEST_CHECK( tcount == otcount, \ + "Trap counted [" #_type_ ":" #_align_ "," #_proc_ "]" ); \ +CYG_MACRO_END + +static void do_test( void ) +{ + cyg_uint32 *ip = (cyg_uint32 *)a; + cyg_uint16 *sp = (cyg_uint16 *)a; + cyg_uint8 *cp = (cyg_uint8 *)a; + + cyg_uint64 l; + cyg_uint32 i; + cyg_uint16 s; + cyg_uint8 c; + + cyg_int32 z, repeats; + + cyg_uint32 otrap; + cyg_uint32 otcount; + + otrap = trap = 0; + otcount = tcount; + + // First test interestingly aligned accesses that are legal. + + l = a[0]; CYG_TEST_CHECK( L1 == l, "a[0] read bad" ); + l = a[1]; CYG_TEST_CHECK( L2 == l, "a[1] read bad" ); + + i = ip[0]; CYG_TEST_CHECK( ((L1 >> 32) & M32) == i, "ip[0]" ); + i = ip[1]; CYG_TEST_CHECK( ((L1 ) & M32) == i, "ip[1]" ); + i = ip[2]; CYG_TEST_CHECK( ((L2 >> 32) & M32) == i, "ip[2]" ); + i = ip[3]; CYG_TEST_CHECK( ((L2 ) & M32) == i, "ip[3]" ); + + s = sp[0]; CYG_TEST_CHECK( ((L1 >> 48) & M16) == s, "sp[0]" ); + s = sp[1]; CYG_TEST_CHECK( ((L1 >> 32) & M16) == s, "sp[1]" ); + s = sp[2]; CYG_TEST_CHECK( ((L1 >> 16) & M16) == s, "sp[2]" ); + s = sp[3]; CYG_TEST_CHECK( ((L1 ) & M16) == s, "sp[3]" ); + s = sp[4]; CYG_TEST_CHECK( ((L2 >> 48) & M16) == s, "sp[4]" ); + s = sp[5]; CYG_TEST_CHECK( ((L2 >> 32) & M16) == s, "sp[5]" ); + s = sp[6]; CYG_TEST_CHECK( ((L2 >> 16) & M16) == s, "sp[6]" ); + s = sp[7]; CYG_TEST_CHECK( ((L2 ) & M16) == s, "sp[7]" ); + + c = cp[0]; CYG_TEST_CHECK( ((L1 >> 56) & M8) == c, "cp[0]" ); + c = cp[1]; CYG_TEST_CHECK( ((L1 >> 48) & M8) == c, "cp[1]" ); + c = cp[2]; CYG_TEST_CHECK( ((L1 >> 40) & M8) == c, "cp[2]" ); + c = cp[3]; CYG_TEST_CHECK( ((L1 >> 32) & M8) == c, "cp[3]" ); + c = cp[4]; CYG_TEST_CHECK( ((L1 >> 24) & M8) == c, "cp[4]" ); + c = cp[5]; CYG_TEST_CHECK( ((L1 >> 16) & M8) == c, "cp[5]" ); + c = cp[6]; CYG_TEST_CHECK( ((L1 >> 8) & M8) == c, "cp[6]" ); + c = cp[7]; CYG_TEST_CHECK( ((L1 ) & M8) == c, "cp[7]" ); + c = cp[8]; CYG_TEST_CHECK( ((L2 >> 56) & M8) == c, "cp[8]" ); + c = cp[9]; CYG_TEST_CHECK( ((L2 >> 48) & M8) == c, "cp[9]" ); + c = cp[10]; CYG_TEST_CHECK( ((L2 >> 40) & M8) == c, "cp[10]" ); + c = cp[11]; CYG_TEST_CHECK( ((L2 >> 32) & M8) == c, "cp[11]" ); + c = cp[12]; CYG_TEST_CHECK( ((L2 >> 24) & M8) == c, "cp[12]" ); + c = cp[13]; CYG_TEST_CHECK( ((L2 >> 16) & M8) == c, "cp[13]" ); + c = cp[14]; CYG_TEST_CHECK( ((L2 >> 8) & M8) == c, "cp[14]" ); + c = cp[15]; CYG_TEST_CHECK( ((L2 ) & M8) == c, "cp[15]" ); + + CYG_TEST_CHECK( 0 == trap, "Traps occurred (legal accesses)" ); + CYG_TEST_CHECK( tcount == otcount, "Traps counted (legal accesses)" ); + + CYG_TEST_PASS( "Aligned accesses OK" ); + + for ( z = OUTER_REPEATS; z > 0; z-- ) { + + for ( repeats = (cyg_test_is_simulator ? SIM_REPEATS : HW_REPEATS) ; + repeats > 0 ; repeats-- ) { + + TRAPPROC( l, cyg_uint64, 4, get_llplus ); + TRAPPROC( l, cyg_uint64, 5, get_llplus ); + TRAPPROC( l, cyg_uint64, 6, get_llplus ); + TRAPPROC( l, cyg_uint64, 7, get_llplus ); + + TRAPPROC( l, cyg_uint64, 4, get_ll ); + TRAPPROC( l, cyg_uint64, 1, get_ll ); + TRAPPROC( l, cyg_uint64, 2, get_ll ); + TRAPPROC( l, cyg_uint64, 3, get_ll ); + + TRAPPROC( i, cyg_uint32, 1, get_iplus ); + TRAPPROC( i, cyg_uint32, 2, get_iplus ); + TRAPPROC( i, cyg_uint32, 3, get_iplus ); + + TRAPPROC( i, cyg_uint32, 5, get_i ); + TRAPPROC( i, cyg_uint32, 6, get_i ); + TRAPPROC( i, cyg_uint32, 7, get_i ); + + TRAPPROC( s, cyg_uint16, 1, get_splus ); + TRAPPROC( s, cyg_uint16, 3, get_splus ); + + TRAPPROC( s, cyg_uint16, 5, get_s ); + TRAPPROC( s, cyg_uint16, 7, get_s ); + } + + CYG_TEST_PASS( "Unaligned accesses OK" ); + + // Now test some legal and illegal accesses intermingled. + + for ( repeats = (cyg_test_is_simulator ? SIM_REPEATS : HW_REPEATS) ; + repeats > 0 ; repeats-- ) { + + SAFEPROC( l, cyg_uint64, 0, get_llplus ); + TRAPPROC( l, cyg_uint64, 5, get_llplus ); + TRAPPROC( l, cyg_uint64, 6, get_llplus ); + SAFEPROC( l, cyg_uint64, 8, get_llplus ); + + TRAPPROC( i, cyg_uint32, 1, get_iplus ); + SAFEPROC( i, cyg_uint32, 4, get_iplus ); + TRAPPROC( i, cyg_uint32, 2, get_iplus ); + SAFEPROC( i, cyg_uint32, 8, get_iplus ); + SAFEPROC( i, cyg_uint32, 12, get_iplus ); + SAFEPROC( i, cyg_uint32, 16, get_iplus ); + TRAPPROC( i, cyg_uint32, 3, get_iplus ); + + TRAPPROC( s, cyg_uint16, 5, get_s ); + SAFEPROC( s, cyg_uint16, 6, get_s ); + TRAPPROC( s, cyg_uint16, 7, get_s ); + SAFEPROC( s, cyg_uint16, 8, get_s ); + + TRAPPROC( i, cyg_uint32, 5, get_i ); + SAFEPROC( i, cyg_uint32, 4, get_i ); + TRAPPROC( i, cyg_uint32, 6, get_i ); + TRAPPROC( i, cyg_uint32, 7, get_i ); + SAFEPROC( i, cyg_uint32, 0, get_i ); + + TRAPPROC( l, cyg_uint64, 4, get_ll ); + SAFEPROC( l, cyg_uint64, 0, get_ll ); + TRAPPROC( l, cyg_uint64, 1, get_ll ); + SAFEPROC( l, cyg_uint64, 8, get_ll ); + + TRAPPROC( s, cyg_uint16, 1, get_splus ); + SAFEPROC( s, cyg_uint16, 2, get_splus ); + TRAPPROC( s, cyg_uint16, 3, get_splus ); + SAFEPROC( s, cyg_uint16, 4, get_splus ); + } + + CYG_TEST_PASS( "Mixture of accesses OK" ); + } +} + +// ------------------------------------------------------------------------- + +externC void +skip_exception_handler(CYG_ADDRWORD vector, CYG_ADDRWORD data, + CYG_ADDRWORD stackpointer); + +externC void +fail_exception_handler(CYG_ADDRWORD vector, CYG_ADDRWORD data, + CYG_ADDRWORD stackpointer); + +// ------------------------------------------------------------------------- + +void sparc_ex_main( void ) +{ + int i; + + CYG_TEST_INIT(); + + for ( i = CYGNUM_HAL_EXCEPTION_MIN; i <= CYGNUM_HAL_EXCEPTION_MAX; i++ ){ + int j; + HAL_TRANSLATE_VECTOR( i, j ); + HAL_INTERRUPT_ATTACH( j, &fail_exception_handler, j, 0 ); + // we must also ensure that eCos handles the exception; + // do not drop into CygMon or equivalent. + // Leave USER_TRAP undisturbed so that breakpoints work. + if ( CYGNUM_HAL_VECTOR_USER_TRAP != i ) { + extern void hal_default_exception_vsr( void ); + HAL_VSR_SET( i, (CYG_ADDRESS)hal_default_exception_vsr, NULL ); + } + } + + HAL_TRANSLATE_VECTOR( CYGNUM_HAL_VECTOR_UNALIGNED, i ); + HAL_INTERRUPT_DETACH( i, &fail_exception_handler ); + HAL_INTERRUPT_ATTACH( i, &skip_exception_handler, i, 0 ); + + CYG_TEST_INFO( "Vectors attached OK; calling do_test" ); + + do_test(); + + CYG_TEST_EXIT( "Done" ); +} + +// ------------------------------------------------------------------------- +externC void +skip_exception_handler(CYG_ADDRWORD vector, CYG_ADDRWORD data, + CYG_ADDRWORD stackpointer) +{ + HAL_SavedRegisters *save; + HAL_FrameStructure *frame; + + HAL_FLUSH_REGISTERS_TO_STACK(); + + save = (HAL_SavedRegisters *) stackpointer; + frame = (HAL_FrameStructure *) (save + 1); // immediately after + + // now, this is the invokation environment when this saved regset + // was created (copied from hal_xvsr.S): + // ! here,locals have been set up as follows: + // ! %l0 = psr (with this CWP/window-level in it) + // ! %l1 = pc + // ! %l2 = npc + // ! %l3 = vector number (16-25 for traps) + // ! and we are in our own register window, though it is likely that + // ! the next one will need to be saved before we can use it: + // ! ie. this one is the invalid register window. + // and the intention is that we can mess therewith: + + // Check we're not in a trap loop + if ( trap == save->li.l[1] ) { + same++; + if ( 10 < same ) + CYG_TEST_FAIL_EXIT( "Repeated trap" ); + } + else // restart the count + same = 0; + + // and record it + trap = save->li.l[1]; + tcount++; + + // now step on so that we return to the instruction after: + save->li.l[1] = save->li.l[2]; // PC := NPC + save->li.l[2] += 4; // NPC += 4 + + // that's all. +} + +externC void +fail_exception_handler(CYG_ADDRWORD vector, CYG_ADDRWORD data, + CYG_ADDRWORD stackpointer) +{ + HAL_FLUSH_REGISTERS_TO_STACK(); + CYG_TEST_FAIL_EXIT( "Other exception handler called" ); +} + +// ------------------------------------------------------------------------- + +externC void +#ifdef CYGPKG_KERNEL +cyg_user_start( void ) +#else +cyg_start( void ) +#endif +{ + sparc_ex_main(); +} + +// ------------------------------------------------------------------------- + +cyg_uint64 get_ll( cyg_uint64 *p ) +{ + return *p; +} + +cyg_uint64 get_llplus( cyg_uint64 *p ) +{ + cyg_uint64 ll = 0l, v; + ll = (cyg_uint32)p; + ll++; + v = *p; + v^= ll; + return v; +} + +cyg_uint32 get_i( cyg_uint32 *p ) +{ + return *p; +} + +cyg_uint32 get_iplus( cyg_uint32 *p ) +{ + cyg_uint32 i = 0, v; + i = (cyg_uint32)p; + i++; + v = *p; + v^= i; + return v; +} + +cyg_uint16 get_s( cyg_uint16 *p ) +{ + return *p; +} + +cyg_uint16 get_splus( cyg_uint16 *p ) +{ + cyg_uint16 s = 0, v; + s = (cyg_uint16)(0xffff & (cyg_uint32)p); + s++; + v = *p; + v^= s; + return v; +} + +// ------------------------------------------------------------------------- + +/* EOF sparc_ex.c */ diff --git a/packages/hal/sparc/erc32/current/ChangeLog b/packages/hal/sparc/erc32/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/ChangeLog @@ -0,0 +1,272 @@ +2000-10-20 Jonathan Larmour + + * include/pkgconf/mlt_sparclite_sim_ram.mlt: + Add heap1 section + + * include/pkgconf/mlt_sparclite_sim_ram.h: + * include/pkgconf/mlt_sparclite_sim_ram.ldi: + Regenerated + +2000-02-10 Jesper Skov + + * cdl/hal_sparclite_sim.cdl: Added. + +1999-11-25 Gary Thomas + + * include/pkgconf/mlt_sparclite_sim_ram.h: New file. + +1999-10-13 Hugo Tyson + + * include/pkgconf/hal_sparclite_sim.h: Add define of + CYGHWR_HAL_SPARCLITE_HAS_ASR17 for arch HAL to DTRT with SVT + (anticipating cores with no SVT at all, so no %asr17) + +1999-04-08 John Dallaway + + * include/pkgconf/*.ldi: Revised SECTION_* macro arguments to + avoid padded output sections (PR 19787) + +1999-04-07 Hugo Tyson + + * src/hal_priv.c: Remove bogus FIX ME; it wasn't true. + +1999-03-16 Hugo Tyson + + * include/halboot.si: Add a dummy LED macro for debug in the + vectors.S; correct a scary line length. + +1999-03-04 Gary Thomas + + * include/pkgconf/hal_sparclite_sim.h: Take out DEVICES dependencies. + +1999-03-04 John Dallaway + + * include/pkgconf/*.ldi: give all LDI files unique names so + that they can co-exist in an eCos build tree (PR 19184) + * include/pkgconf/*.mlt: give all MLT files unique names so + that they can co-exist in an eCos build tree (PR 19184) + +1999-02-25 Hugo Tyson + + These log entries from 1999-02-22 to 1999-02-24 were executed in + a branch; this change is a merge of that branch into the trunk. + + (1999-02-23 John Dallaway ) + + * include/pkgconf/hal_sparclite_sim.h: New rules + CYGPKG_HAL_SPARCLITE_SIM precludes CYGPKG_DEVICES_GDB + CYGPKG_HAL_SPARCLITE_SIM precludes CYGPKG_DEVICES_SERIAL_RS232_COMMON + + (1999-02-22 Hugo Tyson ) + + * src/hal_priv.c (hal_board_prestart, hal_board_poststart): + Shut down the erc32 watchdog in and enable interrupts in these two + new routines. + + * include/halboot.si: + Remove N/A code that I was just storing here, and install the real + vector instructions in this fragment; there be cache-wangling to + do in hardware cases either side of the vector installation. + +1999-02-20 Jonathan Larmour + + * include/hal_xpic.h: + Rename CYG_VECTOR_* -> CYGNUM_HAL_INTERRUPT_* + + * src/hal_priv.c: + Add a FIX ME + +1999-02-08 John Dallaway + + * src/sim.ld: Remove platform-specific linker script for + MLT compliance. + + * src/PKGconf.mak: Remove build rules for sim.ld. + + * include/pkgconf/ram.*: Add MLT save file and and linker + script fragment for RAM startup. + +1999-02-01 Hugo Tyson + + * include/halboot.si: + New file: performs platform-oriented setup of RAM and cache + controllers, and quietens any interrupt sources. + + * include/pkgconf/hal_sparclite_sim.h: + Correct comments/CDL description of sim invocation. + +1999-01-28 Hugo Tyson + + * include/hal_cache.h: NEW FILE to this directory; moved here from + the sparclite/arch tree; cache control is very much board-specific + + * include/hal_clock.h: NEW FILE to this directory; it was a part + of hal_intr.h, but is now here because the clock is target determined. + + * include/hal_xpic.h: NEW FILE to this directory; it was a part of + hal_intr.h, but is now here because the detail of interrupot + control is target determined. + + * src/hal_priv.c: NEW FILE to this directory; it was a part + of hal_intr.h, but is now here because the clock is target + determined, and it's the clock that needs a local variable. + + * src/PKGconf.mak (COMPILE): compile it. + + +1999-01-26 Hugo Tyson + + * src/sim.ld: + Add copyright notice. (Though these files will later be generated + by a tool and so not copyright, these default setups are.) + +1999-01-22 Hugo Tyson + + * src/sim.ld: + Remove some bogus comments. + +1999-01-21 Jonathan Larmour + + * src/sim.ld: + Remove all traces of non-CYG_KERNEL_USE_INIT_PRIORITY code + +1999-01-21 Hugo Tyson + + * src/sim.ld: + Align bss and rom/ram_data starts and ends by 8 bytes to permit + fast copy routines. + +1999-01-19 Hugo Tyson + + Modified files in arch: + * include/hal_arch.h + * include/hal_intr.h + * src/PKGconf.mak + * src/context.S + * src/hal_intr.c + * src/vec_ivsr.S + * src/vec_xvsr.S + * src/vectors.S + + New files in arch: + * src/hal_boot.c (bss initialization, constructors &c) + * include/hal_cache.h (empty but required header) + + Modified files in sim: + * include/hal_diag.h + + Lots more progress; essentially, everything now works. + + Simulator's treatment of stdio is poor though, it doesn't work + under pkgtest. This has been slowing me up. + +1999-01-14 Hugo Tyson + + * ecc/ecc/hal/sparclite/...: + + Initial checkin of SPARClite HAL; it doesn't work yet, except the + most trivial of tests - timer and interrupt manipulation stuff is + entirely absent. + + Here's some documentation of the initial checkin tree; this will + change, as platform dependent stuff moves correctly into the sim + or directories. + + arch/current/include: + basetype.h nothing much here. + vectors.h definitions of symbols shared between the + various vector code assembler files, can be + included in both C and assembler. + hal_intr.h various macros for clock and interrupt + control plus the eCos vector numbering scheme; we + map thus: + what SPARC trap type eCos vector numbers + ----------------------------------------------- + (not used) --- 0 + interrupts (17-31) 1-15 + user traps (128-255) 16 + exceptions (1-9,36==4) 17-25 + others (10,?) 26 + ----------------------------------------------- + Trap types 5 and 6 which would be eCos vectors 21 + and 22 are handled in the trampoline code in + file src/vectors.S + hal_arch.h definition of a thread context, plus + macros for thread switching and the like. Some + ancillary bit twiddling macros and cache barriers + too. + + arch/current/include/pkgconf: + hal_sparclite.h pkgconf config/header file. + + arch/current/src: + vectors.S boot-up stuff, trampoline code that hangs + on the interrupt/trap vector, handlers for window + under/overflow. Saves some state in registers + then jumps to the interrupt or exception VSR + respectively. + Also instantiates the VSR table. + vec_ivsr.S the default interrupt VSR; it establishes + a C calling environment (ie. anticipates a window + overflow) then locks the scheduler, calls the ISR + with appropriate arguments, and then interrupt_end() + before undoing that environment, anticipating + window underflow and returning to the interrupted + instruction. + vec_xvsr.S the default exception AKA trap VSR; does + the same as the interrupt one but without the + scheduler lock or interrupt end. + hal_intr.c instantiates the ISR table used by the + code above. + context.S context switch code, saves and loads up a + whole register state, coroutine or longjump-like. + icontext.c initializes a context to "jump" to in + context.S at the birth of a new thread. + + sim/current/include: + hal_diag.h macros to deal with debugging output via a + fake serial device of some kind; initially empty, + but definitely board/sim dependent. + + sim/current/include/pkgconf: + hal_sparclite_sim.h pkgconf config/header file. + + sim/current/src: + sim.ld linker script bits for "sim" target. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + +//EOF ChangeLog diff --git a/packages/hal/sparc/erc32/current/cdl/hal_sparc_erc32.cdl b/packages/hal/sparc/erc32/current/cdl/hal_sparc_erc32.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/cdl/hal_sparc_erc32.cdl @@ -0,0 +1,201 @@ +# ==================================================================== +# +# hal_sparc_erc32.cdl +# +# SPARC ERC32 target HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: hmt +# Contributors: +# Date: 2000-02-10 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_SPARC_ERC32 { + display "ERC32 processor" + parent CYGPKG_HAL_SPARC + define_header hal_sparc_erc32.h + include_dir cyg/hal + description " + The ERC32 HAL package is provided for both simulator (TSIM) + and real hardware use" + + compile hal_priv.c + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "#define CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING /* true for ERC32 */" + puts $::cdl_header "#define HAL_IDLE_THREAD_ACTION hal_idle_thread_action /* true for ERC32 */" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM"} + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the ERC32 processor only the RAM startup type + is usable." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants." + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated 9999 + } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + parent CYGPKG_NONE + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "sparc-rtems" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-msoft-float -g -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + } + + cdl_component CYGPKG_HAL_SPARC_ERC32_OPTIONS { + display "ERC32 processor build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_HAL_SPARC_ERC32_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-msoft-float" } + description " + This option modifies the set of compiler flags for + building the ERC32 processor HAL. These flags are + used in addition to the set of global flags." + } + + cdl_option CYGPKG_HAL_SPARC_ERC32_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the ERC32 processor HAL. These flags are + removed from the set of global flags if present." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { "sparc_erc32_ram" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { "" } + } + } +} diff --git a/packages/hal/sparc/erc32/current/include/hal_cache.h b/packages/hal/sparc/erc32/current/include/hal_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/include/hal_cache.h @@ -0,0 +1,182 @@ +#ifndef CYGONCE_HAL_CACHE_H +#define CYGONCE_HAL_CACHE_H + +//============================================================================= +// +// hal_cache.h +// +// HAL Cache control support (such as it is in the simulator) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas, hmt +// Contributors: nickg, gthomas, hmt +// Date: 1999-01-28 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// the caches. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include + +//----------------------------------------------------------------------------- +// SPARC cache macros + +//----------------------------------------------------------------------------- +// Cache dimensions + +// Data cache +#define HAL_DCACHE_SIZE 0x800 // Size of data cache in bytes +#define HAL_DCACHE_LINE_SIZE 4 // Size of a data cache line +#define HAL_DCACHE_WAYS 4 // Associativity of the cache + +// Instruction cache +#define HAL_ICACHE_SIZE 0x800 // Size of cache in bytes +#define HAL_ICACHE_LINE_SIZE 4 // Size of a cache line +#define HAL_ICACHE_WAYS 4 // Associativity of the cache + +#define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS)) +#define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS)) + +//----------------------------------------------------------------------------- +// Global control of data cache + +// Enable the data cache +#define HAL_DCACHE_ENABLE() +// Disable the data cache +#define HAL_DCACHE_DISABLE() +// Invalidate the entire cache +#define HAL_DCACHE_INVALIDATE_ALL() +// Synchronize the contents of the cache with memory. +#define HAL_DCACHE_SYNC() + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_size_) + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) + +//#define HAL_DCACHE_WRITETHRU_MODE 0 +//#define HAL_DCACHE_WRITEBACK_MODE 1 + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +//#define HAL_DCACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_DCACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_DCACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +//#define HAL_DCACHE_FLUSH( _base_ , _size_ ) + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) + +// Write dirty cache lines to memory for the given address range. +//#define HAL_DCACHE_STORE( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_DCACHE_ZERO( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +// Global control of Instruction cache - use Data cache controls since they +// are not separatable. + +// Enable the instruction cache +#define HAL_ICACHE_ENABLE() HAL_DCACHE_ENABLE() + +// Disable the instruction cache +#define HAL_ICACHE_DISABLE() HAL_DCACHE_DISABLE() + +// Invalidate the entire cache +#define HAL_ICACHE_INVALIDATE_ALL() HAL_DCACHE_SYNC(); HAL_DCACHE_INVALIDATE_ALL() + +// Synchronize the contents of the cache with memory. +#define HAL_ICACHE_SYNC() + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_size_) + +// Load the contents of the given address range into the instruction cache +// and then lock the cache so that it stays there. +//#define HAL_ICACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_ICACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_ICACHE_INVALIDATE( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_CACHE_H +// End of hal_cache.h diff --git a/packages/hal/sparc/erc32/current/include/hal_clock.h b/packages/hal/sparc/erc32/current/include/hal_clock.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/include/hal_clock.h @@ -0,0 +1,131 @@ +#ifndef CYGONCE_HAL_CLOCK_H +#define CYGONCE_HAL_CLOCK_H + +//============================================================================= +// +// hal_clock.h +// +// HAL clock support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas, hmt +// Contributors: nickg, gthomas, hmt +// Date: 1999-01-28 +// Purpose: Define clock support +// Description: The macros defined here provide the HAL APIs for handling +// the clock. +// +// Usage: +// #include // which includes this file +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +//----------------------------------------------------------------------------- +// Clock control + +// in erc32 simulator: +// 4 = UART A +// 5 = UART B +// 7 = UART error +// 12 = GPT (general purpose timer) +// 13 = RTC (realtime clock) +// 15 = watchdog + +// in erc32 simulator: + +// The vector used by the Real time clock is defined in hal_xpic.h + +// We could place conditional code here to choose one clock or the other +// depending on the selected interrupt vector... but pro tem: (pun intended) + +/* These must be accessed word-wide to work! */ + +#define SPARC_MEC_RTC (0x01f80080) + +#define SPARC_MEC_RTC_COUNTER (SPARC_MEC_RTC + 0) +#define SPARC_MEC_RTC_SCALER (SPARC_MEC_RTC + 4) + +#define SPARC_MEC_GPT_COUNTER (SPARC_MEC_RTC + 8) +#define SPARC_MEC_GPT_SCALER (SPARC_MEC_RTC + 0x0c) + +/* MEC timer control register bits */ +#define SPARC_MEC_TCR_GACR 1 /* Continuous Running */ +#define SPARC_MEC_TCR_GACL 2 /* Counter Load */ +#define SPARC_MEC_TCR_GASE 4 /* System Enable */ +#define SPARC_MEC_TCR_GASL 8 /* not used */ +#define SPARC_MEC_TCR_TCRCR 0x100 /* Continuous Running */ +#define SPARC_MEC_TCR_TCRCL 0x200 /* Counter Load */ +#define SPARC_MEC_TCR_TCRSE 0x400 /* System Enable */ +#define SPARC_MEC_TCR_TCRSL 0x800 /* not used */ + +#define SPARC_MEC_RTC_CONTROL (SPARC_MEC_RTC + 0x18) + +externC cyg_int32 cyg_hal_sparc_clock_period; + +#define HAL_CLOCK_INITIALIZE( _period_ ) CYG_MACRO_START \ + cyg_hal_sparc_clock_period = (_period_); \ + HAL_WRITE_UINT32( SPARC_MEC_RTC_COUNTER, (_period_) ); \ + HAL_WRITE_UINT32( SPARC_MEC_RTC_CONTROL, \ + (SPARC_MEC_TCR_TCRCR | \ + SPARC_MEC_TCR_TCRCL | \ + SPARC_MEC_TCR_TCRSE) ); \ +CYG_MACRO_END + +#define HAL_CLOCK_RESET( _vector_, _period_ ) /* nowt, it is freerunning */ + +#define HAL_CLOCK_READ( _pvalue_ ) CYG_MACRO_START \ + cyg_uint32 _read_; \ + HAL_READ_UINT32( SPARC_MEC_RTC_COUNTER, _read_ ); \ + *((cyg_uint32 *)(_pvalue_)) = \ + (cyg_hal_sparc_clock_period - _read_ ); \ +CYG_MACRO_END + + +#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY +#define HAL_CLOCK_LATENCY( _pvalue_ ) HAL_CLOCK_READ( _pvalue_ ) +#endif + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_CLOCK_H +// End of hal_clock.h diff --git a/packages/hal/sparc/erc32/current/include/hal_diag.h b/packages/hal/sparc/erc32/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/include/hal_diag.h @@ -0,0 +1,136 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1999-01-11 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include + +/*---------------------------------------------------------------------------*/ + +#define CYG_DIAG_USE_ERC32 + +/*---------------------------------------------------------------------------*/ + +#ifdef CYG_DIAG_USE_ERC32 + +/*---------------------------------------------------------------------------*/ +/* Register addresses */ + +#define SPARC_MEC_UART (0x01f800e0) + +/* These must be accessed word-wide to work! */ +#define SPARC_MEC_UART_IO( x ) ((cyg_uint32)(x)) + +#define SPARC_MEC_UART_A_RX ((volatile cyg_uint32 *)(SPARC_MEC_UART + 0)) +#define SPARC_MEC_UART_A_TX ((volatile cyg_uint32 *)(SPARC_MEC_UART + 0)) +#define SPARC_MEC_UART_B_RX ((volatile cyg_uint32 *)(SPARC_MEC_UART + 4)) +#define SPARC_MEC_UART_B_TX ((volatile cyg_uint32 *)(SPARC_MEC_UART + 4)) +#define SPARC_MEC_UART_STATUS ((volatile cyg_uint32 *)(SPARC_MEC_UART + 8)) +#define SPARC_MEC_UART_TXAMASK (0x00006) +#define SPARC_MEC_UART_TXBMASK (0x60000) +#define SPARC_MEC_UART_RXAMASK (0x00001) +#define SPARC_MEC_UART_RXBMASK (0x10000) + + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() + +#define HAL_DIAG_WRITE_CHAR(_c_) \ +{ \ + if( 1 || _c_ != '\r' ) \ + { \ + while( (SPARC_MEC_UART_TXAMASK & *SPARC_MEC_UART_STATUS) == 0 ) \ + continue; \ + *SPARC_MEC_UART_A_TX = SPARC_MEC_UART_IO(_c_); \ + } \ +} + +#define HAL_DIAG_READ_CHAR(_c_) \ +{ \ + while( (SPARC_MEC_UART_RXAMASK & *SPARC_MEC_UART_STATUS) == 0 ) \ + continue; \ + _c_ = (char)*SPARC_MEC_UART_A_TX; \ +} + +#define XHAL_DIAG_WRITE_CHAR(_c_) \ +{ \ + if( _c_ != '\r' ) \ + { \ + *SPARC_MEC_UART_A_TX = SPARC_MEC_UART_IO(_c_); \ + } \ +} + +#define XHAL_DIAG_READ_CHAR(_c_) \ +{ \ + _c_ = (char)*SPARC_MEC_UART_A_TX; \ +} + +#else +/*---------------------------------------------------------------------------*/ +/* There is no diagnostic output on SPARC simulator */ + +#define HAL_DIAG_INIT() + +#define HAL_DIAG_WRITE_CHAR(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) (_c_) = 0 + +#endif + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_HAL_DIAG_H */ diff --git a/packages/hal/sparc/erc32/current/include/hal_xpic.h b/packages/hal/sparc/erc32/current/include/hal_xpic.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/include/hal_xpic.h @@ -0,0 +1,120 @@ +#ifndef CYGONCE_HAL_XPIC_H +#define CYGONCE_HAL_XPIC_H + +//============================================================================= +// +// hal_xpic.h +// +// HAL eXternal Programmable Interrupt Controller support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas, hmt +// Contributors: nickg, gthomas, hmt +// Date: 1999-01-28 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// an external interrupt controller, and which interrupt is +// used for what. +// +// Usage: +// #include // which includes this file +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +//----------------------------------------------------------------------------- +// Interrupt controller access + +// in erc32 simulator: +// 4 = UART A +// 5 = UART B +// 7 = UART error +// 12 = GPT (general purpose timer) +// 13 = RTC (realtime clock) +// 15 = watchdog + +// The vector used by the Real time clock +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_13 + + +/* These must be accessed word-wide to work! */ +#define SPARC_MEC_INTCON (0x01f80000) + +#define SPARC_MEC_INTCON_PENDING (SPARC_MEC_INTCON + 0x48) +#define SPARC_MEC_INTCON_MASK (SPARC_MEC_INTCON + 0x4c) +#define SPARC_MEC_INTCON_CLEAR (SPARC_MEC_INTCON + 0x50) +#define SPARC_MEC_INTCON_FORCE (SPARC_MEC_INTCON + 0x54) + + +#define HAL_INTERRUPT_MASK( _vector_ ) CYG_MACRO_START \ + cyg_uint32 _traps_, _mask_; \ + HAL_DISABLE_TRAPS( _traps_ ); \ + HAL_READ_UINT32( SPARC_MEC_INTCON_MASK, _mask_ ); \ + _mask_ |= ( 1 << (_vector_) ); \ + HAL_WRITE_UINT32(SPARC_MEC_INTCON_MASK, _mask_ ); \ + HAL_RESTORE_INTERRUPTS( _traps_ ); \ +CYG_MACRO_END + +#define HAL_INTERRUPT_UNMASK( _vector_ ) CYG_MACRO_START \ + cyg_uint32 _traps_, _mask_; \ + HAL_DISABLE_TRAPS( _traps_ ); \ + HAL_READ_UINT32( SPARC_MEC_INTCON_MASK, _mask_ ); \ + _mask_ &=~ ( 1 << (_vector_) ); \ + HAL_WRITE_UINT32( SPARC_MEC_INTCON_MASK, _mask_ ); \ + HAL_RESTORE_INTERRUPTS( _traps_ ); \ +CYG_MACRO_END + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) CYG_MACRO_START \ + cyg_uint32 _traps_; \ + HAL_DISABLE_TRAPS( _traps_ ); \ + HAL_WRITE_UINT32( SPARC_MEC_INTCON_CLEAR, ( 1 << (_vector_) ) ); \ + HAL_RESTORE_INTERRUPTS( _traps_ ); \ +CYG_MACRO_END + +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) /* nothing */ + +#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) /* nothing */ + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_XPIC_H +// End of hal_xpic.h diff --git a/packages/hal/sparc/erc32/current/include/halboot.si b/packages/hal/sparc/erc32/current/include/halboot.si new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/include/halboot.si @@ -0,0 +1,133 @@ +#ifndef CYGONCE_HAL_HALBOOT_SI /* -*-asm-*- */ +#define CYGONCE_HAL_HALBOOT_SI +// ==================================================================== +// +// /halboot.si +// +// HAL bootup platform-oriented code (assembler) +// +// ==================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +// ==================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1999-02-01 +// Purpose: Bootup code, platform oriented. +// Description: +// +//####DESCRIPTIONEND#### +// +// ==================================================================== + +// External Platform Initial Setup +// +// This should set up RAM and caches, and calm down any external +// interrupt sources. +// +// It is just plain included in vectors.S +// +// RAM has not yet been touched at all; in fact all you have is a +// register window selected. + + + ! Empty macro for debugging vectors.S + .macro led val + .endm + + + set 0x01f80000, %l0 ! MEC register base address + ld [%l0], %l1 ! Check if MEC has been initialised + set 0xfe080000, %l2 ! by checking baud rate register + andcc %l2, %l1, %g0 + bne 2f ! skip + nop + + ! Set memory according to simulator config + + st %g0, [%l0 + 0x64] ! Disable watchdog for now + ld [%l0], %g1 + or %g1, 1, %g1 + st %g1, [%l0] ! Enable power down + st %g0, [%l0 + 0x18] ! No waitstates + ld [%l0 + 0xF8], %g1 ! load simulator rom size + clr %l2 + srl %g1, 17, %g1 ! calculate appropriate MEC rom size +1: + srl %g1, 1, %g1 + tst %g1 + bne,a 1b + inc %l2 + sll %l2, 8, %l2 + ld [%l0 + 0xF4], %g2 ! load simulator ram size + srl %g2, 18, %g1 ! calculate appropriate MEC ram size +1: + srl %g1, 1, %g1 + tst %g1 + bne,a 1b + inc %l2 + sll %l2, 10, %l2 + st %l2, [%l0 + 0x10] ! program MEC memory config register + set 0x2000000, %l2 + add %g2, %l2, %fp + sub %fp, 96*4, %sp + +! st %g0, [%sp] ! probe for FPU +! ld [%sp], %fsr + + set 13, %l1 + st %l1, [%l0 + 0x84] ! RTC scaler = 13 + +2: + set reset_vector, %g1 + set 0x0d00, %l1 + st %l1, [%g1 + 0x7c0] ! Store TCR mirror + st %l1, [%l0 + 0x98] ! Start RTC + mov %g3, %o7 + + +4: + ! then copy the branch instructions into the vector + rd %tbr, %g1 + andn %g1, 0xfff, %g1 ! clear non-address bits + sethi %hi(real_vector_instructions), %l0 + or %l0, %lo(real_vector_instructions), %l0 + ld [ %l0 ], %l1 + st %l1, [ %g1 ] ! into the vector + ld [ %l0 + 4 ], %l1 + st %l1, [ %g1 + 4 ] ! into the vector + +#endif /* CYGONCE_HAL_HALBOOT_SI */ +/* EOF halboot.si */ diff --git a/packages/hal/sparc/erc32/current/include/pkgconf/mlt_sparc_erc32_ram.h b/packages/hal/sparc/erc32/current/include/pkgconf/mlt_sparc_erc32_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/include/pkgconf/mlt_sparc_erc32_ram.h @@ -0,0 +1,17 @@ +// eCos memory layout - Fri Oct 20 08:18:20 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x2000000) +#define CYGMEM_REGION_ram_SIZE (0x80000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x2080000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/sparc/erc32/current/include/pkgconf/mlt_sparc_erc32_ram.ldi b/packages/hal/sparc/erc32/current/include/pkgconf/mlt_sparc_erc32_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/include/pkgconf/mlt_sparc_erc32_ram.ldi @@ -0,0 +1,26 @@ +// eCos memory layout - Fri Oct 20 08:18:20 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x2000000, LENGTH = 0x80000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x2000000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x8), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/sparc/erc32/current/include/pkgconf/mlt_sparc_erc32_ram.mlt b/packages/hal/sparc/erc32/current/include/pkgconf/mlt_sparc_erc32_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/include/pkgconf/mlt_sparc_erc32_ram.mlt @@ -0,0 +1,12 @@ +version 0 +region ram 2000000 80000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 2000000 2000000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 1 0 1 0 1 0 1 bss bss ! +section bss 0 8 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/sparc/erc32/current/src/hal_priv.c b/packages/hal/sparc/erc32/current/src/hal_priv.c new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/erc32/current/src/hal_priv.c @@ -0,0 +1,103 @@ +//=========================================================================== +// +// hal_priv.c +// +// SPARC ERC32 Architecture sim-specific private variables +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1999-02-20 +// Purpose: private vars for SPARC ERC32. +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + + +#include +#include + +// ------------------------------------------------------------------------ +// Clock static to keep period recorded. +cyg_int32 cyg_hal_sparc_clock_period = 0; + +// ------------------------------------------------------------------------ +// Board specific startups. + +extern void hal_board_prestart( void ); +extern void hal_board_poststart( void ); + +void hal_board_prestart( void ) +{ +} + +void hal_board_poststart( void ) +{ + HAL_ENABLE_INTERRUPTS(); + // OK to do this post constructors, and good for testing. +} + +cyg_uint32 +hal_lsbit_index(cyg_uint32 mask) +{ + int i; + for (i = 0; i < 32; i++) { + if (mask & (1<= 0; i--) { + if (mask & (1< + + * cdl/hal_sparc_leon.cdl: Add -msoft-cloat to CYGBLD_GLOBAL_CFLAGS + (as well as LDFLAGS) - this gives perfect test coverage in minimal + build with the sim. NB pro tem the tools are called + sparc-rtems-gcc et al, but sparc-elf-gcc et al should be OK. + +2000-10-20 Jonathan Larmour + + * include/pkgconf/mlt_sparclite_sim_ram.mlt: + Add heap1 section + + * include/pkgconf/mlt_sparclite_sim_ram.h: + * include/pkgconf/mlt_sparclite_sim_ram.ldi: + Regenerated + +2000-02-10 Jesper Skov + + * cdl/hal_sparclite_sim.cdl: Added. + +1999-11-25 Gary Thomas + + * include/pkgconf/mlt_sparclite_sim_ram.h: New file. + +1999-10-13 Hugo Tyson + + * include/pkgconf/hal_sparclite_sim.h: Add define of + CYGHWR_HAL_SPARCLITE_HAS_ASR17 for arch HAL to DTRT with SVT + (anticipating cores with no SVT at all, so no %asr17) + +1999-04-08 John Dallaway + + * include/pkgconf/*.ldi: Revised SECTION_* macro arguments to + avoid padded output sections (PR 19787) + +1999-04-07 Hugo Tyson + + * src/hal_priv.c: Remove bogus FIX ME; it wasn't true. + +1999-03-16 Hugo Tyson + + * include/halboot.si: Add a dummy LED macro for debug in the + vectors.S; correct a scary line length. + +1999-03-04 Gary Thomas + + * include/pkgconf/hal_sparclite_sim.h: Take out DEVICES dependencies. + +1999-03-04 John Dallaway + + * include/pkgconf/*.ldi: give all LDI files unique names so + that they can co-exist in an eCos build tree (PR 19184) + * include/pkgconf/*.mlt: give all MLT files unique names so + that they can co-exist in an eCos build tree (PR 19184) + +1999-02-25 Hugo Tyson + + These log entries from 1999-02-22 to 1999-02-24 were executed in + a branch; this change is a merge of that branch into the trunk. + + (1999-02-23 John Dallaway ) + + * include/pkgconf/hal_sparclite_sim.h: New rules + CYGPKG_HAL_SPARCLITE_SIM precludes CYGPKG_DEVICES_GDB + CYGPKG_HAL_SPARCLITE_SIM precludes CYGPKG_DEVICES_SERIAL_RS232_COMMON + + (1999-02-22 Hugo Tyson ) + + * src/hal_priv.c (hal_board_prestart, hal_board_poststart): + Shut down the erc32 watchdog in and enable interrupts in these two + new routines. + + * include/halboot.si: + Remove N/A code that I was just storing here, and install the real + vector instructions in this fragment; there be cache-wangling to + do in hardware cases either side of the vector installation. + +1999-02-20 Jonathan Larmour + + * include/hal_xpic.h: + Rename CYG_VECTOR_* -> CYGNUM_HAL_INTERRUPT_* + + * src/hal_priv.c: + Add a FIX ME + +1999-02-08 John Dallaway + + * src/sim.ld: Remove platform-specific linker script for + MLT compliance. + + * src/PKGconf.mak: Remove build rules for sim.ld. + + * include/pkgconf/ram.*: Add MLT save file and and linker + script fragment for RAM startup. + +1999-02-01 Hugo Tyson + + * include/halboot.si: + New file: performs platform-oriented setup of RAM and cache + controllers, and quietens any interrupt sources. + + * include/pkgconf/hal_sparclite_sim.h: + Correct comments/CDL description of sim invocation. + +1999-01-28 Hugo Tyson + + * include/hal_cache.h: NEW FILE to this directory; moved here from + the sparclite/arch tree; cache control is very much board-specific + + * include/hal_clock.h: NEW FILE to this directory; it was a part + of hal_intr.h, but is now here because the clock is target determined. + + * include/hal_xpic.h: NEW FILE to this directory; it was a part of + hal_intr.h, but is now here because the detail of interrupot + control is target determined. + + * src/hal_priv.c: NEW FILE to this directory; it was a part + of hal_intr.h, but is now here because the clock is target + determined, and it's the clock that needs a local variable. + + * src/PKGconf.mak (COMPILE): compile it. + + +1999-01-26 Hugo Tyson + + * src/sim.ld: + Add copyright notice. (Though these files will later be generated + by a tool and so not copyright, these default setups are.) + +1999-01-22 Hugo Tyson + + * src/sim.ld: + Remove some bogus comments. + +1999-01-21 Jonathan Larmour + + * src/sim.ld: + Remove all traces of non-CYG_KERNEL_USE_INIT_PRIORITY code + +1999-01-21 Hugo Tyson + + * src/sim.ld: + Align bss and rom/ram_data starts and ends by 8 bytes to permit + fast copy routines. + +1999-01-19 Hugo Tyson + + Modified files in arch: + * include/hal_arch.h + * include/hal_intr.h + * src/PKGconf.mak + * src/context.S + * src/hal_intr.c + * src/vec_ivsr.S + * src/vec_xvsr.S + * src/vectors.S + + New files in arch: + * src/hal_boot.c (bss initialization, constructors &c) + * include/hal_cache.h (empty but required header) + + Modified files in sim: + * include/hal_diag.h + + Lots more progress; essentially, everything now works. + + Simulator's treatment of stdio is poor though, it doesn't work + under pkgtest. This has been slowing me up. + +1999-01-14 Hugo Tyson + + * ecc/ecc/hal/sparclite/...: + + Initial checkin of SPARClite HAL; it doesn't work yet, except the + most trivial of tests - timer and interrupt manipulation stuff is + entirely absent. + + Here's some documentation of the initial checkin tree; this will + change, as platform dependent stuff moves correctly into the sim + or directories. + + arch/current/include: + basetype.h nothing much here. + vectors.h definitions of symbols shared between the + various vector code assembler files, can be + included in both C and assembler. + hal_intr.h various macros for clock and interrupt + control plus the eCos vector numbering scheme; we + map thus: + what SPARC trap type eCos vector numbers + ----------------------------------------------- + (not used) --- 0 + interrupts (17-31) 1-15 + user traps (128-255) 16 + exceptions (1-9,36==4) 17-25 + others (10,?) 26 + ----------------------------------------------- + Trap types 5 and 6 which would be eCos vectors 21 + and 22 are handled in the trampoline code in + file src/vectors.S + hal_arch.h definition of a thread context, plus + macros for thread switching and the like. Some + ancillary bit twiddling macros and cache barriers + too. + + arch/current/include/pkgconf: + hal_sparclite.h pkgconf config/header file. + + arch/current/src: + vectors.S boot-up stuff, trampoline code that hangs + on the interrupt/trap vector, handlers for window + under/overflow. Saves some state in registers + then jumps to the interrupt or exception VSR + respectively. + Also instantiates the VSR table. + vec_ivsr.S the default interrupt VSR; it establishes + a C calling environment (ie. anticipates a window + overflow) then locks the scheduler, calls the ISR + with appropriate arguments, and then interrupt_end() + before undoing that environment, anticipating + window underflow and returning to the interrupted + instruction. + vec_xvsr.S the default exception AKA trap VSR; does + the same as the interrupt one but without the + scheduler lock or interrupt end. + hal_intr.c instantiates the ISR table used by the + code above. + context.S context switch code, saves and loads up a + whole register state, coroutine or longjump-like. + icontext.c initializes a context to "jump" to in + context.S at the birth of a new thread. + + sim/current/include: + hal_diag.h macros to deal with debugging output via a + fake serial device of some kind; initially empty, + but definitely board/sim dependent. + + sim/current/include/pkgconf: + hal_sparclite_sim.h pkgconf config/header file. + + sim/current/src: + sim.ld linker script bits for "sim" target. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + +//EOF ChangeLog diff --git a/packages/hal/sparc/leon/current/cdl/hal_sparc_leon.cdl b/packages/hal/sparc/leon/current/cdl/hal_sparc_leon.cdl new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/cdl/hal_sparc_leon.cdl @@ -0,0 +1,201 @@ +# ==================================================================== +# +# hal_sparc_leon.cdl +# +# SPARC LEON target HAL package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: hmt +# Contributors: +# Date: 2000-02-10 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_SPARC_LEON { + display "LEON processor" + parent CYGPKG_HAL_SPARC + define_header hal_sparc_leon.h + include_dir cyg/hal + description " + The LEON HAL package is provided for both simulator (TSIM) + and real hardware use" + + compile hal_priv.c + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "#define CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING /* true for LEON */" + puts $::cdl_header "#define HAL_IDLE_THREAD_ACTION hal_idle_thread_action /* true for LEON */" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"RAM"} + default_value {"RAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the LEON processor only the RAM startup type + is usable." + } + + # Real-time clock/counter specifics + cdl_component CYGNUM_HAL_RTC_CONSTANTS { + display "Real-time clock constants." + flavor none + + cdl_option CYGNUM_HAL_RTC_NUMERATOR { + display "Real-time clock numerator" + flavor data + calculated 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + calculated 100 + } + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated 9999 + } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + parent CYGPKG_NONE + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "sparc-rtems" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { "-msoft-float -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by + default. Individual packages may define + options which override these global flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { "-msoft-float -g -nostdlib -Wl,--gc-sections -Wl,-static" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + } + + cdl_component CYGPKG_HAL_SPARC_LEON_OPTIONS { + display "LEON processor build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_HAL_SPARC_LEON_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-msoft-float" } + description " + This option modifies the set of compiler flags for + building the LEON processor HAL. These flags are + used in addition to the set of global flags." + } + + cdl_option CYGPKG_HAL_SPARC_LEON_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the LEON processor HAL. These flags are + removed from the set of global flags if present." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { "sparc_leon_ram" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { "" } + } + } +} diff --git a/packages/hal/sparc/leon/current/include/hal_cache.h b/packages/hal/sparc/leon/current/include/hal_cache.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/include/hal_cache.h @@ -0,0 +1,182 @@ +#ifndef CYGONCE_HAL_CACHE_H +#define CYGONCE_HAL_CACHE_H + +//============================================================================= +// +// hal_cache.h +// +// HAL Cache control support (such as it is in the simulator) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas, hmt +// Contributors: nickg, gthomas, hmt +// Date: 1999-01-28 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// the caches. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#include + +//----------------------------------------------------------------------------- +// LEON cache macros + +//----------------------------------------------------------------------------- +// Cache dimensions + +// Data cache +#define HAL_DCACHE_SIZE 0x4000 // Size of data cache in bytes +#define HAL_DCACHE_LINE_SIZE 16 // Size of a data cache line +#define HAL_DCACHE_WAYS 1 // Associativity of the cache + +// Instruction cache +#define HAL_ICACHE_SIZE 0x4000 // Size of cache in bytes +#define HAL_ICACHE_LINE_SIZE 16 // Size of a cache line +#define HAL_ICACHE_WAYS 1 // Associativity of the cache + +#define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS)) +#define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS)) + +//----------------------------------------------------------------------------- +// Global control of data cache + +// Enable the data cache +#define HAL_DCACHE_ENABLE() //*((int *)0x80000014) |= (int)0x0000000c +// Disable the data cache +#define HAL_DCACHE_DISABLE() //*((int *)0x80000014) &= ~(int)0x0000000c +// Invalidate the entire cache +#define HAL_DCACHE_INVALIDATE_ALL() //*((int *)0x80000014) |= (int)0x00400000 +// Synchronize the contents of the cache with memory. +#define HAL_DCACHE_SYNC() + +// Set the data cache refill burst size +//#define HAL_DCACHE_BURST_SIZE(_size_) + +// Set the data cache write mode +//#define HAL_DCACHE_WRITE_MODE( _mode_ ) + +//#define HAL_DCACHE_WRITETHRU_MODE 0 +//#define HAL_DCACHE_WRITEBACK_MODE 1 + +// Load the contents of the given address range into the data cache +// and then lock the cache so that it stays there. +//#define HAL_DCACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_DCACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_DCACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Data cache line control + +// Allocate cache lines for the given address range without reading its +// contents from memory. +//#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) + +// Write dirty cache lines to memory and invalidate the cache entries +// for the given address range. +//#define HAL_DCACHE_FLUSH( _base_ , _size_ ) + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) + +// Write dirty cache lines to memory for the given address range. +//#define HAL_DCACHE_STORE( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of reading +// from it later. +//#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) + +// Preread the given range into the cache with the intention of writing +// to it later. +//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) + +// Allocate and zero the cache lines associated with the given range. +//#define HAL_DCACHE_ZERO( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +// Global control of Instruction cache - use Data cache controls since they +// are not separatable. + +// Enable the instruction cache +#define HAL_ICACHE_ENABLE() HAL_DCACHE_ENABLE() + +// Disable the instruction cache +#define HAL_ICACHE_DISABLE() HAL_DCACHE_DISABLE() + +// Invalidate the entire cache +#define HAL_ICACHE_INVALIDATE_ALL() HAL_DCACHE_SYNC(); HAL_DCACHE_INVALIDATE_ALL() + +// Synchronize the contents of the cache with memory. +#define HAL_ICACHE_SYNC() + +// Set the instruction cache refill burst size +//#define HAL_ICACHE_BURST_SIZE(_size_) + +// Load the contents of the given address range into the instruction cache +// and then lock the cache so that it stays there. +//#define HAL_ICACHE_LOCK(_base_, _size_) + +// Undo a previous lock operation +//#define HAL_ICACHE_UNLOCK(_base_, _size_) + +// Unlock entire cache +//#define HAL_ICACHE_UNLOCK_ALL() + +//----------------------------------------------------------------------------- +// Instruction cache line control + +// Invalidate cache lines in the given range without writing to memory. +//#define HAL_ICACHE_INVALIDATE( _base_ , _size_ ) + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_CACHE_H +// End of hal_cache.h diff --git a/packages/hal/sparc/leon/current/include/hal_clock.h b/packages/hal/sparc/leon/current/include/hal_clock.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/include/hal_clock.h @@ -0,0 +1,128 @@ +#ifndef CYGONCE_HAL_CLOCK_H +#define CYGONCE_HAL_CLOCK_H + +//============================================================================= +// +// hal_clock.h +// +// HAL clock support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas, hmt +// Contributors: nickg, gthomas, hmt +// Date: 1999-01-28 +// Purpose: Define clock support +// Description: The macros defined here provide the HAL APIs for handling +// the clock. +// +// Usage: +// #include // which includes this file +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +//----------------------------------------------------------------------------- +// Clock control + +// in erc32 simulator: +// 4 = UART A +// 5 = UART B +// 7 = UART error +// 12 = GPT (general purpose timer) +// 13 = TI1 (realtime clock) +// 15 = watchdog + +// in erc32 simulator: + +// The vector used by the Real time clock is defined in hal_xpic.h + +// We could place conditional code here to choose one clock or the other +// depending on the selected interrupt vector... but pro tem: (pun intended) + +#define SPARC_LEON_TIMER_SCALE (24) + +/* These must be accessed word-wide to work! */ + +#define SPARC_LEON_REG (0x80000000) + +#define SPARC_LEON_TI1_COUNTER (SPARC_LEON_REG + 0x40) +#define SPARC_LEON_TI1_CRELOAD (SPARC_LEON_REG + 0x44) +#define SPARC_LEON_SCALER (SPARC_LEON_REG + 0x60) +#define SPARC_LEON_SRELOAD (SPARC_LEON_REG + 0x64) + +/* LEON timer control register bits */ +#define SPARC_LEON_TI1_EN 1 /* System Enable */ +#define SPARC_LEON_TI1_RL 2 /* Continuous Running */ +#define SPARC_LEON_TI1_LD 4 /* Counter Load */ + +#define SPARC_LEON_TI1_CONTROL (SPARC_LEON_REG + 0x48) + +externC cyg_int32 cyg_hal_sparc_clock_period; + +#define HAL_CLOCK_INITIALIZE( _period_ ) CYG_MACRO_START \ + cyg_hal_sparc_clock_period = (_period_); \ + HAL_WRITE_UINT32( SPARC_LEON_TI1_CRELOAD, (_period_) ); \ + HAL_WRITE_UINT32( SPARC_LEON_TI1_COUNTER, (_period_) ); \ + HAL_WRITE_UINT32( SPARC_LEON_TI1_CONTROL, \ + (SPARC_LEON_TI1_EN | \ + SPARC_LEON_TI1_RL | \ + SPARC_LEON_TI1_LD) ); \ +CYG_MACRO_END + +#define HAL_CLOCK_RESET( _vector_, _period_ ) /* nowt, it is freerunning */ + +#define HAL_CLOCK_READ( _pvalue_ ) CYG_MACRO_START \ + cyg_uint32 _read_; \ + HAL_READ_UINT32( SPARC_LEON_TI1_COUNTER, _read_ ); \ + *((cyg_uint32 *)(_pvalue_)) = \ + (cyg_hal_sparc_clock_period - _read_ ); \ +CYG_MACRO_END + + +#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY +#define HAL_CLOCK_LATENCY( _pvalue_ ) HAL_CLOCK_READ( _pvalue_ ) +#endif + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_CLOCK_H +// End of hal_clock.h diff --git a/packages/hal/sparc/leon/current/include/hal_diag.h b/packages/hal/sparc/leon/current/include/hal_diag.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/include/hal_diag.h @@ -0,0 +1,132 @@ +#ifndef CYGONCE_HAL_HAL_DIAG_H +#define CYGONCE_HAL_HAL_DIAG_H + +/*============================================================================= +// +// hal_diag.h +// +// HAL Support for Kernel Diagnostic Routines +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1999-01-11 +// Purpose: HAL Support for Kernel Diagnostic Routines +// Description: Diagnostic routines for use during kernel development. +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include + +#include + +/*---------------------------------------------------------------------------*/ + +#define CYG_DIAG_USE_LEON + +/*---------------------------------------------------------------------------*/ + +#ifdef CYG_DIAG_USE_LEON + +/*---------------------------------------------------------------------------*/ +/* Register addresses */ + +#define SPARC_LEON_REG (0x80000000) + +/* These must be accessed word-wide to work! */ +#define SPARC_LEON_UART_IO( x ) ((cyg_uint32)(x)) + +#define SPARC_LEON_UART_A_RX ((volatile cyg_uint32 *)(SPARC_LEON_REG + 0x70)) +#define SPARC_LEON_UART_A_TX ((volatile cyg_uint32 *)(SPARC_LEON_REG + 0x70)) +#define SPARC_LEON_UART_STATUS ((volatile cyg_uint32 *)(SPARC_LEON_REG + 0x74)) +#define SPARC_LEON_UART_RXAMASK (0x00001) +#define SPARC_LEON_UART_TXAMASK (0x00006) + + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() + +#define HAL_DIAG_WRITE_CHAR(_c_) \ +{ \ + if( 1 || _c_ != '\r' ) \ + { \ + while( (SPARC_LEON_UART_TXAMASK & *SPARC_LEON_UART_STATUS) == 0 ) \ + continue; \ + *SPARC_LEON_UART_A_TX = SPARC_LEON_UART_IO(_c_); \ + } \ +} + +#define HAL_DIAG_READ_CHAR(_c_) \ +{ \ + while( (SPARC_LEON_UART_RXAMASK & *SPARC_LEON_UART_STATUS) == 0 ) \ + continue; \ + _c_ = (char)*SPARC_LEON_UART_A_TX; \ +} + +#define XHAL_DIAG_WRITE_CHAR(_c_) \ +{ \ + if( _c_ != '\r' ) \ + { \ + *SPARC_LEON_UART_A_TX = SPARC_LEON_UART_IO(_c_); \ + } \ +} + +#define XHAL_DIAG_READ_CHAR(_c_) \ +{ \ + _c_ = (char)*SPARC_LEON_UART_A_TX; \ +} + +#else +/*---------------------------------------------------------------------------*/ +/* There is no diagnostic output on LEON processor */ + +#define HAL_DIAG_INIT() + +#define HAL_DIAG_WRITE_CHAR(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) (_c_) = 0 + +#endif + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_HAL_DIAG_H */ diff --git a/packages/hal/sparc/leon/current/include/hal_xpic.h b/packages/hal/sparc/leon/current/include/hal_xpic.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/include/hal_xpic.h @@ -0,0 +1,122 @@ +#ifndef CYGONCE_HAL_XPIC_H +#define CYGONCE_HAL_XPIC_H + +//============================================================================= +// +// hal_xpic.h +// +// HAL eXternal Programmable Interrupt Controller support +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg, gthomas, hmt +// Contributors: nickg, gthomas, hmt +// Date: 1999-01-28 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// an external interrupt controller, and which interrupt is +// used for what. +// +// Usage: +// #include // which includes this file +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +//----------------------------------------------------------------------------- +// Interrupt controller access + +// in leon simulator: +// 2 = UART B +// 3 = UART A +// 1 = AHB error +// 9 = TI2 (general purpose timer) +// 8 = TI1 (realtime clock) + +// The vector used by the Real time clock +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_8 + + +/* These must be accessed word-wide to work! */ +#define SPARC_LEON_REG (0x80000000) + +#define SPARC_LEON_INTCON_PENDING (SPARC_LEON_REG + 0x94) +#define SPARC_LEON_INTCON_MASK (SPARC_LEON_REG + 0x90) +#define SPARC_LEON_INTCON_CLEAR (SPARC_LEON_REG + 0x9C) +#define SPARC_LEON_INTCON_FORCE (SPARC_LEON_REG + 0x98) + + +#define HAL_INTERRUPT_MASK( _vector_ ) CYG_MACRO_START \ + cyg_uint32 _traps_, _mask_; \ + HAL_DISABLE_TRAPS( _traps_ ); \ + HAL_READ_UINT32( SPARC_LEON_INTCON_MASK, _mask_ ); \ + _mask_ &= ~( 1 << (_vector_) ); \ + HAL_WRITE_UINT32(SPARC_LEON_INTCON_MASK, _mask_ ); \ + HAL_RESTORE_INTERRUPTS( _traps_ ); \ +CYG_MACRO_END + +#define HAL_INTERRUPT_UNMASK( _vector_ ) CYG_MACRO_START \ + cyg_uint32 _traps_, _mask_; \ + HAL_DISABLE_TRAPS( _traps_ ); \ + HAL_READ_UINT32( SPARC_LEON_INTCON_MASK, _mask_ ); \ + _mask_ |= ( 1 << (_vector_) ); \ + HAL_WRITE_UINT32( SPARC_LEON_INTCON_MASK, _mask_ ); \ + HAL_RESTORE_INTERRUPTS( _traps_ ); \ +CYG_MACRO_END + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) +/* Interrupts are automatically acknowledged by hardware, not needed ... +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) CYG_MACRO_START \ + cyg_uint32 _traps_; \ + HAL_DISABLE_TRAPS( _traps_ ); \ + HAL_WRITE_UINT32( SPARC_LEON_INTCON_CLEAR, ( 1 << (_vector_) ) ); \ + HAL_RESTORE_INTERRUPTS( _traps_ ); \ +CYG_MACRO_END +*/ + +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) /* nothing */ + +#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) /* nothing */ + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_XPIC_H +// End of hal_xpic.h diff --git a/packages/hal/sparc/leon/current/include/halboot.si b/packages/hal/sparc/leon/current/include/halboot.si new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/include/halboot.si @@ -0,0 +1,151 @@ +#ifndef CYGONCE_HAL_HALBOOT_SI /* -*-asm-*- */ +#define CYGONCE_HAL_HALBOOT_SI +// ==================================================================== +// +// /halboot.si +// +// HAL bootup platform-oriented code (assembler) +// +// ==================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +// ==================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1999-02-01 +// Purpose: Bootup code, platform oriented. +// Description: +// +//####DESCRIPTIONEND#### +// +// ==================================================================== + +// External Platform Initial Setup +// +// This should set up RAM and caches, and calm down any external +// interrupt sources. +// +// It is just plain included in vectors.S +// +// RAM has not yet been touched at all; in fact all you have is a +// register window selected. + + + ! Empty macro for debugging vectors.S + .macro led val + .endm + + ! Set memory according to simulator config + + set 0x80000000, %l0 ! LEON register base address + + ld [%l0 + 0x14], %l1 ! chech if we have been initialized + andcc %l1, 0x1, %g0 + bne 4f + nop + + flush ! if we are here, we are running on + set 0x1000f, %l1 ! the simulator.... + + st %l1, [%l0 + 0x14] ! enable caches + + st %g0, [%l0 + 0x1c] ! clear LEON registers + st %g0, [%l0 + 0x20] ! + st %g0, [%l0 + 0x90] ! + st %g0, [%l0 + 0x94] ! + st %g0, [%l0 + 0x98] ! + st %g0, [%l0 + 0x9C] ! + st %g0, [%l0 + 0xA0] ! + st %g0, [%l0 + 0xA4] ! + st %g0, [%l0 + 0xA4] ! + st %g0, [%l0 + 0x78] ! + st %g0, [%l0 + 0x88] ! + + ld [%l0 + 0xF8], %g1 ! load simulator rom size + clr %l2 + subcc %g1, 0, %g0 + be 3f + srl %g1, 13, %g1 ! calculate appropriate rom size +1: + srl %g1, 1, %g1 + tst %g1 + bne,a 1b + inc %l2 + sll %l2, 14, %l2 + st %l2, [%l0 + 0x00] ! set prom size in memcfg1 + + set 0, %l2 + ld [%l0 + 0xF4], %g2 ! load simulator ram size + srl %g2, 13, %g1 ! calculate appropriate ram size +1: + srl %g1, 1, %g1 + tst %g1 + bne,a 1b + inc %l2 + sll %l2, 9, %l2 + or %l2, 0x20, %l2 + st %l2, [%l0 + 0x04] ! set ram size in memcfg2 + set 0x40000000, %l2 + add %g2, %l2, %fp + sub %fp, 96*4, %sp +3: + st %g0, [%sp] !probe for FPU +! ld [%sp], %fsr + set 49, %l1 + st %l1, [%l0 + 0x64] ! scaler = 49 + st %l1, [%l0 + 0x60] ! scaler = 49 + +2: + + set -1, %l1 + st %l1, [%l0 + 0x44] ! timer 1 = 0xffffff + set 7, %l1 + st %l1, [%l0 + 0x48] ! start timer 1 + st %l1, [%l0 + 0x78] ! enable UARTS + st %l1, [%l0 + 0x88] + +4: + ! then copy the branch instructions into the vector + rd %tbr, %g1 + andn %g1, 0xfff, %g1 ! clear non-address bits + sethi %hi(real_vector_instructions), %l0 + or %l0, %lo(real_vector_instructions), %l0 + ld [ %l0 ], %l1 + st %l1, [ %g1 ] ! into the vector + ld [ %l0 + 4 ], %l1 + st %l1, [ %g1 + 4 ] ! into the vector + +#endif /* CYGONCE_HAL_HALBOOT_SI */ +/* EOF halboot.si */ diff --git a/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.h b/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.h new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.h @@ -0,0 +1,19 @@ +// eCos memory layout - Fri Oct 20 08:18:20 2000 + +// This is a generated file - do not edit + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x40000000) +#define CYGMEM_REGION_ram_SIZE (0x80000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0x40080000 - (size_t) CYG_LABEL_NAME (__heap1)) + +#define CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING diff --git a/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.ldi b/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.ldi new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.ldi @@ -0,0 +1,26 @@ +// eCos memory layout - Fri Oct 20 08:18:20 2000 + +// This is a generated file - do not edit + +#include + +MEMORY +{ + ram : ORIGIN = 0x40000000, LENGTH = 0x80000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x40000000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x8), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.mlt b/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.mlt new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.mlt @@ -0,0 +1,12 @@ +version 0 +region ram 40000000 80000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 40000000 40000000 text text ! +section text 0 1 0 1 0 1 0 1 fini fini ! +section fini 0 1 0 1 0 1 0 1 rodata rodata ! +section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 ! +section rodata1 0 1 0 1 0 1 0 1 fixup fixup ! +section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table ! +section gcc_except_table 0 1 0 1 0 1 0 1 data data ! +section data 0 1 0 1 0 1 0 1 bss bss ! +section bss 0 8 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/packages/hal/sparc/leon/current/src/hal_priv.c b/packages/hal/sparc/leon/current/src/hal_priv.c new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/src/hal_priv.c @@ -0,0 +1,102 @@ +//=========================================================================== +// +// hal_priv.c +// +// SPARC Architecture LEON-specific private variables +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: hmt +// Date: 1999-02-20 +// Purpose: private vars for LEON processor. +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + + +#include +#include + +// ------------------------------------------------------------------------ +// Clock static to keep period recorded. +cyg_int32 cyg_hal_sparc_clock_period = 0; + +// ------------------------------------------------------------------------ +// Board specific startups. + +extern void hal_board_prestart( void ); +extern void hal_board_poststart( void ); + +void hal_board_prestart( void ) +{ +} + +void hal_board_poststart( void ) +{ + HAL_ENABLE_INTERRUPTS(); + // OK to do this post constructors, and good for testing. +} + +cyg_uint32 +hal_lsbit_index(cyg_uint32 mask) +{ + int i; + for (i = 0; i < 32; i++) { + if (mask & (1<= 0; i--) { + if (mask & (1< for information about the TSIM +simulator and Leon project per se. + +The simulator TSIM can be run "as one" with GDB by using the +script do-gdb-sim in this directory. The script can be used in +automated testing systems to run as if it were embedded within +GDB. It contains: + +---------------------------------------------------------------- +#! /bin/csh +tsim-leon -nfp -gdb >& /dev/stdout & +sparc-rtems-gdb -nw -nx $*:q +---------------------------------------------------------------- + +which simply runs tsim in background, directing its output to the +common stdout. + +The command to connect to the simulator target will be + + (gdb) target remote localhost:1234 + +This fully described in the TSIM documentation from + (home) + (flyer) + (doc) + + + diff --git a/packages/hal/sparc/leon/current/support/do-gdb-sim b/packages/hal/sparc/leon/current/support/do-gdb-sim new file mode 100644 --- /dev/null +++ b/packages/hal/sparc/leon/current/support/do-gdb-sim @@ -0,0 +1,3 @@ +#! /bin/csh +tsim-leon -nfp -gdb >& /dev/stdout & +sparc-rtems-gdb -nw -nx $*:q diff --git a/packages/hal/sparclite/arch/current/ChangeLog b/packages/hal/sparclite/arch/current/ChangeLog --- a/packages/hal/sparclite/arch/current/ChangeLog +++ b/packages/hal/sparclite/arch/current/ChangeLog @@ -1,3 +1,12 @@ +2002-04-29 Jonathan Larmour + + * src/vectors.S: + * src/vec_xvsr.S: + * src/vec_ivsr.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + 2000-10-16 Jonathan Larmour * include/hal_arch.h (CYGARC_JMP_BUF_SIZE): Define hal_jmp_buf in @@ -644,29 +653,38 @@ 1999-01-14 Hugo Tyson + + * src/hal_cygm.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + 2000-10-20 Jonathan Larmour * tests/slebtime.cxx: Ensure default priority constructors @@ -459,29 +466,38 @@ 1999-02-22 Hugo Tyson + + * src/synth.ld: Add RELOCS "section" and eh_frame section, plus + correct use of .gnu.linkonce sections. + +2002-02-28 Bart Veer + + * doc/synth.sgml, doc/makefile, doc/*.html: + Documentation for the synthetic target HAL. + +2002-01-25 Bart Veer + + * src/synth_intr.c (hal_interrupt_mask/unmask): + Add preconditions that interrupts are disabled on entry, rather + than disabling and reenabling the interrupts, since the + specification requires the former. + 2002-01-08 Jonathan Larmour 2001-11-01 Andrew Lunn @@ -338,27 +355,36 @@ Mon Nov 9 15:18:11 GMT 1998 Chris Pro Initial i386 linux port. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/synth/arch/current/cdl/hal_synth.cdl b/packages/hal/synth/arch/current/cdl/hal_synth.cdl --- a/packages/hal/synth/arch/current/cdl/hal_synth.cdl +++ b/packages/hal/synth/arch/current/cdl/hal_synth.cdl @@ -5,29 +5,38 @@ # Synthetic target architectural configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# +#####ECOSGPLCOPYRIGHTBEGIN#### # ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. # -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. # -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license # ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/hal/synth/arch/current/doc/hal-synth-arch.html b/packages/hal/synth/arch/current/doc/hal-synth-arch.html new file mode 100644 --- /dev/null +++ b/packages/hal/synth/arch/current/doc/hal-synth-arch.html @@ -0,0 +1,148 @@ + + + + + + + + + + + +eCos Synthetic Target +

I. eCos Synthetic Target

Table of Contents
Overview — The eCos synthetic target
System Calls — Access Linux system facilities
Porting — The eCos synthetic target

  Next
  Overview
\ No newline at end of file diff --git a/packages/hal/synth/arch/current/doc/makefile b/packages/hal/synth/arch/current/doc/makefile new file mode 100644 --- /dev/null +++ b/packages/hal/synth/arch/current/doc/makefile @@ -0,0 +1,55 @@ +#============================================================================= +# +# makefile +# +# For building the synthetic target documentation. +# +#============================================================================= +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +#============================================================================= +#####DESCRIPTIONBEGIN#### +# +# Author(s): bartv +# Date: 2001-01-11 +#####DESCRIPTIONEND#### +#============================================================================= + +TOPLEVEL := ../../../../.. +MAIN_SGML := synth.sgml +MAIN_HTML := hal-synth-arch.html +MAIN_PDF := hal-synth-arch.pdf +OTHER_SGML := +PICTURES := + +include $(TOPLEVEL)/pkgconf/rules.doc diff --git a/packages/hal/synth/arch/current/doc/synth-porting.html b/packages/hal/synth/arch/current/doc/synth-porting.html new file mode 100644 --- /dev/null +++ b/packages/hal/synth/arch/current/doc/synth-porting.html @@ -0,0 +1,399 @@ + + + + + + + + + + + +Porting +
eCos Synthetic Target
Prev 

Porting

Name

Porting -- The eCos synthetic target

Description

The initial development effort of the eCos synthetic target happened +on x86 Linux machines. Porting to other platforms involves addressing +a number of different issues. Some ports should be fairly +straightforward, for example a port to Linux on a processor other than +an x86. Porting to Unix or Unix-like operating systems other than +Linux may be possible, but would involve more effort. Porting to a +completely different operating system such as Windows would be very +difficult. The text below completes the eCos Porting Guide. +

Other Linux Platforms

Porting the synthetic target to a Linux platform that uses a processor +other than x86 should be straightforward. The simplest approach is to +copy the existing i386linux +directory tree in the hal/synth +hierarchy, then rename and edit the ten or so files in this package. +Most of the changes should be pretty obvious, for example on a 64-bit +processor some new data types will be needed in the +basetype.h header file. It will also be necessary +to update the toplevel ecos.db database with an +entry for the new HAL package, and a new target entry will be needed +as well. +

Obviously a different processor will have different register sets +and calling conventions, so the code for saving and restoring thread +contexts and for implementing setjmp and +longjmp will need to be updated. The exact way of +performing Linux system calls will also vary: on i386linux this +usually involves pushing some registers on the stack and then +executing an int 0x080 trap instruction, but +on a different processor the arguments might be passed in registers +instead and certainly a different trap instruction will be used. The +startup code is also written in assembler, but needs to do little more +than jump to the main linux_entry function +provided by the architectural synthetic target HAL package. +

The header file hal_io.h provided by the +architectural HAL package provides various structure definitions, +function prototypes, and macros related to system calls. These are +correct for i386linux, but there may be problems on other processors. +For example a structure field that is currently defined as a 32-bit +number may in fact may be a 64-bit number instead. +

The synthetic target's memory map is defined in two files in the +include/pkgconf subdirectory. +For x86 the default memory map involves eight megabytes of read-only +memory for the code at location 0x1000000 and another eight megabytes +for data at 0x2000000. These address ranges may be reserved for other +purposes on the new architecture, so may need changing. There may be +some additional areas of memory allocated by the system for other +purposes, for example the startup stack and any environment variables, +but usually eCos applications can and should ignore those. +

Other HAL functionality such as interrupt handling, diagnostics, and +the system clock are provided by the architectural HAL package and +should work on different processors with few if any changes. +

When porting to other processors, a number of sources of information +are likely to prove useful. Obviously the Linux kernel sources and +header files constitute the ultimate authority on how things work at +the system call level. The GNU C library sources may also prove very +useful: for a normal Linux application it is the C library that +provides the startup code and the system call interface. +

Other Unix Platforms

Porting to a Unix or Unix-like operating system other than Linux would +be somewhat more involved. The first requirement involves toolchains: +the GNU compilers, gcc and g++, must definitely be used; use of other +GNU tools such as the linker may be needed as well, because eCos +depends on functionality such as prioritizing C++ static constructors, +and other linkers may not implement this or may implement it in a +different and incompatible way. A closely related requirement is the +use of ELF format for binary executables: if the operating system +still uses an older format such as COFF then there are likely to be +problems because they do not provide the flexibility required by eCos. +

In the architectural HAL there should be very little code that is +specific to Linux. Instead the code should work on any operating +system that provides a reasonable implementation of the POSIX +standard. There may be some problems with program startup, but those +could be handled at the architectural level. Some changes may also be +required to the exception handling code. However one file which will +present a problem is hal_io.h, which contains +various structure definitions and macros used with the system call +interface. It is likely that many of these definitions will need +changing, and it may well be appropriate to implement variant HAL +packages for the different operating systems where this information +can be separated out. Another possible problem is that the generic +code assumes that system calls such as +cyg_hal_sys_write are available. On an operating +system other than Linux it is possible that some of these are not +simple system calls, and instead wrapper functions will need to be +implemented at the variant HAL level. +

The remaining porting task is to implement one or more platform HAL +packages, one per processor type that is supported. This should +involve much the same work as a port to another processor running Linux. +

When using other Unix operating systems the kernel source code may not +be available, which would make any porting effort more challenging. +However there is still a good chance that the GNU C library will have +been ported already, so its source code may contain much useful +information. +

Caution

Users should be aware that future enhancements to the synthetic target +code, especially in areas related to I/O, may be much more closely +tied to Linux. For example access to ethernet facilities might be +implemented using the PF_PACKET socket address +family, or the virtual tunnelling interface. Porting such code to +other Unix operating systems may prove rather more difficult. +

Windows Platforms

Porting the current synthetic target code to some version of Windows +or to another non-Unix platform is likely to prove very difficult. The +first hurdle that needs to be crossed is the file format for binary +executables: current Windows implementations do not use ELF, instead +they use their own format PE which is a variant of the rather old and +limited COFF format. It may well prove easier to first write an ELF +loader for Windows executables, rather than try to get eCos to work +within the constraints of PE. Of course that introduces new problems, +for example existing source-level debuggers will still expect +executables to be in PE format. +

Under Linux a synthetic target application is not linked with the +system's C library or any other standard system library. That would +cause confusion, for example both eCos and the system's C library +might try to define the printf function, and +introduce complications such as working with shared libraries. For +much the same reasons, a synthetic target application under Windows +should not be linked with any Windows DLL's. If an ELF loader has been +specially written then this may not be much of a problem. +

The next big problem is the system call interface. Under Windows +system calls are generally made via DLL's, and it is not clear that +the underlying trap mechanism is well-documented or consistent between +different releases of Windows. +

The current code depends on the operating system providing an +implementation of POSIX signal handling. This is used for I/O +purposes, for example SIGALRM is used for the +system clock, and for exceptions. It is not known what equivalent +functionality is available under Windows. +

Given the above problems a port of the synthetic target to Windows may +or may not be technically feasible, but it would certainly require a +very large amount of effort. +


PrevHome 
System Calls  
\ No newline at end of file diff --git a/packages/hal/synth/arch/current/doc/synth-syscalls.html b/packages/hal/synth/arch/current/doc/synth-syscalls.html new file mode 100644 --- /dev/null +++ b/packages/hal/synth/arch/current/doc/synth-syscalls.html @@ -0,0 +1,335 @@ + + + + + + + + + + + +System Calls +
eCos Synthetic Target
PrevNext

System Calls

Name

cyg_hal_sys_xyz -- Access Linux system facilities

Synopsis

#include <cyg/hal/hal_io.h
+      

int cyg_hal_sys_xyz(...);

Description

On a real embedded target eCos interacts with the hardware by peeking +and poking various registers, manipulating special regions of memory, +and so on. The synthetic target does not access hardware directly. +Instead I/O and other operations are emulated by making appropriate +Linux system calls. The HAL package exports a number of functions +which allow other packages, or even application code, to make these +same system calls. However this facility must be used with care: any +code which calls, for example, cyg_hal_sys_write +will only ever run on the synthetic target; that functionality is +obviously not provided on any real hardware because there is no +underlying Linux kernel to implement it. +

The synthetic target only provides a subset of the available system +calls, specifically those calls which have proved useful to implement +I/O emulation. This subset can be extended fairly easily if necessary. +All of the available calls, plus associated data structures and +macros, are defined in the header file cyg/hal/hal_io.h. There is a simple +convention: given a Linux system call such as +open, the synthetic target will prefix +cyg_hal_sys and provide a function with that name. +The second argument to the open system call is +a set of flags such as O_RDONLY, and the header +file will define a matching constant +CYG_HAL_SYS_O_RDONLY. There are also data +structures such as cyg_hal_sys_sigset_t, +matching the Linux data structure sigset_t. +

In most cases the functions provided by the synthetic target behave as +per the documentation for the Linux system calls, and section 2 of the +Linux man pages can be consulted for more information. There is one +important difference: typically the documentation will say that a +function returns -1 to indicate an error, with the +actual error code held in errno; the actual +underlying system call and hence the +cyg_hal_sys_xyz provided by eCos instead returns +a negative number to indicate an error, with the absolute value of +that number corresponding to the error code; usually it is the C +library which handles this and manipulates errno, but of course +synthetic target applications are not linked with that Linux library. +

However, there are some exceptions. The Linux kernel has evolved over +the years, and some of the original system call interfaces are no +longer appropriate. For example the original +select system call has been superseded by +_newselect, and that is what the +select function in the C library actually uses. +The old call is still available to preserve binary compatibility but, +like the C library, eCos makes use of the new one because it provides +the appropriate functionality. In an attempt to reduce confusion the +eCos function is called cyg_hal_sys__newselect, +in other words it matches the official system call naming scheme. The +authoritive source of information on such matters is the Linux kernel +sources themselves, and especially its header files. +

eCos packages and applications should never +#include Linux header files directly. For example, +doing a #include </usr/include/fcntl.h> +to access additional macros or structure definitions, or alternatively +manipulating the header file search path, will lead to problems +because the Linux header files are likely to duplicate and clash with +definitions in the eCos headers. Instead the appropriate functionality +should be extracted from the Linux headers and moved into either +cyg/hal/hal_io.h or into +application code, with suitable renaming to avoid clashes with eCos +names. Users should be aware that large-scale copying may involve +licensing complications. +

Adding more system calls is usually straightforward and involves +adding one or more lines to the platform-specific file in the +appropriate platform HAL, for example +syscall-i386-linux-1.0.S. However it is necessary +to do some research first about the exact interface implemented by the +system call, because of issues such as old system calls that have been +superseded. The required information can usually be found fairly +easily by searching through the Linux kernel sources and possibly the +GNU C library sources. +


PrevHomeNext
Overview Porting
\ No newline at end of file diff --git a/packages/hal/synth/arch/current/doc/synth.html b/packages/hal/synth/arch/current/doc/synth.html new file mode 100644 --- /dev/null +++ b/packages/hal/synth/arch/current/doc/synth.html @@ -0,0 +1,441 @@ + + + + + + + + + + + +Overview +
eCos Synthetic Target
PrevNext

Overview

Name

Overview -- The eCos synthetic target

Description

Usually eCos runs on either a custom piece of hardware, specially +designed to meet the needs of a specific application, or on a +development board of some sort that is available before the final +hardware. Such boards have a number of things in common: +

  1. Obviously there has to be at least one processor to do the work. +Usually this will be a 32-bit processor, but it can be smaller or +larger. Processor speed will vary widely, depending on the expected +needs of the application. However usually the exact processor being +used does not matter very much for most of the development process: +the use of languages such as C or C++ means that the compiler will +handle those details. +

  2. There needs to be memory for code and for data. A typical system will +have two different types of memory. There will be some non-volatile +memory such as flash, EPROM or masked ROM. There will also be some +volatile memory such as DRAM or SRAM. Often the code for the final +application will reside in the non-volatile memory and all of the RAM +will be available for data. However updating non-volatile memory +requires a non-trivial amount of effort, so for much of the +development process it is more convenient to burn suitable firmware, +for example RedBoot, into the non-volatile memory and then use that to +load the application being debugged into RAM, alongside the +application data and a small area reserved for use by the firmware. +

  3. The platform must provide certain mimimal I/O facilities. Most eCos +configurations require a clock signal of some sort. There must also be +some way of outputting diagnostics to the user, often but not always +via a serial port. Unless special debug hardware is being used, source +level debugging will require bidirectional communication between a +host machine and the target hardware, usually via a serial port or an +ethernet device. +

  4. All the above is not actually very useful yet because there is no way +for the embedded device to interact with the rest of the world, except +by generating diagnostics. Therefore an embedded device will have +additional I/O hardware. This may be fairly standard hardware such as +an ethernet or USB interface, or special hardware designed +specifically for the intended application, or quite often some +combination. Standard hardware such as ethernet or USB may be +supported by eCos device drivers and protocol stacks, whereas the +special hardware will be driven directly by application code. +

Much of the above can be emulated on a typical PC running Linux. +Instead of running the embedded application being developed on a +target board of some sort, it can be run as a Linux process. The +processor will be the PC's own processor, for example an x86, and the +memory will be the process' address space. Some I/O facilities can be +emulated through system calls. For example clock hardware can be +emulated by setting up a SIGALRM signal, which will +cause the process to be interrupted at regular intervals. This +emulation of real hardware will not be particularly accurate, for +example the number of cpu cycles available to the eCos application +between clock ticks will vary widely depending on what else is running +on the PC, but for much development work it will be good enough. +

A key requirement for synthetic target code is that the embedded +application must not be linked with any of the standard Linux +libraries such as the GNU C library: that would lead to a confusing +situation where both eCos and the Linux libraries attempted to provide +functions such as printf. Instead the synthetic +target support must be implemented directly on top of the Linux +kernels' system call interface. For example, the kernel provides a +system call for write operations. The actual function +write is implemented in the system's C library, +but all it does is move its arguments on to the stack or into certain +registers and then execute a special trap instruction such as +int 0x80. When this instruction is executed +control transfers into the kernel, which will validate the arguments +and perform the appropriate operation. Now, a synthetic target +application cannot be linked with the system's C library. Instead it +contains a function cyg_hal_sys_write which, like +the C library's write function, pushes its +arguments on to the stack and executes the trap instruction. The Linux +kernel cannot tell the difference, so it will perform the I/O +operation requested by the synthetic target. With appropriate +knowledge of what system calls are available, this makes it possible +to emulate the required I/O facilities. For example diagnostic output +can be achieved by a cyg_hal_sys_write system +call using file descriptor 1, which corresponds to stdout. +

In many ways developing for the synthetic target is no different from +developing for real embedded targets. eCos must be configured +appropriately: selecting a suitable target such as +i386linux will cause the configuration system +to load the appropriate packages for this hardware; this includes an +architectural HAL package and a platform-specific package; the +architectural package contains generic code applicable to all Linux +platforms, whereas the platform package is for specific Linux +implementations such as the x86 version and contains any +processor-specific code. Selecting this target will also bring in some +device driver packages. Other aspects of the configuration such as +which API's are supported are determined by the template, by adding +and removing packages, and by fine-grained configuration. +

In other ways developing for the synthetic target can be much easier +than developing for a real embedded target. For example there is no +need to worry about building and installing suitable firmware on the +target hardware, and then downloading and debugging the actual +application over a serial line or a similar connection. Instead an +eCos application built for the synthetic target is mostly +indistinguishable from an ordinary Linux program. It can be run simply +by typing the name of the executable file at a shell prompt. +Alternatively you can debug the application using whichever version of +gdb is provided by your Linux distribution. There is no need to build +or install special toolchains. Essentially using the synthetic target +means that the various problems associated with real embedded hardware +can be bypassed for much of the development process. +

The eCos synthetic target provides emulation, not simulation. It is +possible to run eCos in suitable architectural simulators but that +involves a rather different approach to software development. For +example, when running eCos on the psim PowerPC simulator you need +appropriate cross-compilation tools that allow you to build PowerPC +executables. These are then loaded into the simulator which interprets +every instruction and attempts to simulate what would happen if the +application were running on real hardware. This involves a lot of +processing overhead, but depending on the functionality provided by +the simulator it can give very accurate results. When developing for +the synthetic target the executable is compiled for the PC's own +processor and will be executed at full speed, with no need for a +simulator or special tools. This will be much faster and somewhat +simpler than using an architectural simulator, but no attempt is made +to accurately match the behaviour of a real embedded target. +

Note: Support for emulating standard hardware such as ethernet is not yet +available in the current release of the eCos synthetic target code, +but is planned for future versions. Emulating application-specific +custom hardware is rather more difficult since there is no way of +knowing just what strange hardware a particular application might +need, but the I/O mechanisms planned should allow for +application-specific extensions. +

Toolchain

When developing eCos applications for a normal embedded target it is +necessary to use a suitable cross-compiler and related tools such as +the linker. Developing for the synthetic target is easier because you +can just use the standard GNU tools (gcc, g++, ld, …) which +were provided with your Linux distribution, or which you used to build +your own Linux setup. Any reasonably recent version of the tools, for +example gcc 2.96(Red Hat) as shipped with Red Hat Linux 7, should be +sufficient. +

There is one important limitation when using these tools: current gdb +will not support debugging of eCos threads on the synthetic target. As +far as gdb is concerned a synthetic target application is also +indistinguishable from a normal Linux application, so it assumes that +any threads will be created by calls to the Linux +pthread_create function provided by the C +library. Obviously this is not the case since the application is never +linked with that library. Therefore gdb never notices the eCos thread +mechanisms and assumes the application is single-threaded. Fixing this +is possible but would involve non-trivial changes to gdb. +

Theoretically it is possible to develop synthetic target applications +on, for example, a PC running Windows and then run the resulting +executables on another machine that runs Linux. This is rarely useful: +if a Linux machine is available then usually that machine will also be +used for building ecos and the application. However, if for some +reason it is necessary or desirable to build on another machine then +this requires a suitable cross-compiler and related tools. If the +application will be running on a typical PC with an x86 processor then +a suitable configure triplet would be +i686-pc-linux-gnu. The installation +instructions for the various GNU tools should be consulted for further +information. +

Hardware Preparation

Preparing a real embedded target for eCos development can be tricky. +Often the first step is to install suitable firmware, usually RedBoot. +This means creating and building a special configuration for eCos with +the RedBoot template, then somehow updating the target's flash chips +with the resulting RedBoot image. Typically it will also be necessary +to get a working serial connection, and possibly set up ethernet as +well. Although usually none of the individual steps are particularly +complicated, there are plenty of ways in which things can go wrong and +it can be hard to figure out what is actually happening. Of course +some board manufacturers make life easier for their developers by +shipping hardware with RedBoot preinstalled, but even then it is still +necessary to set up communication between host and target. +

None of this is applicable to the synthetic target. Instead you can +just build a normal eCos configuration, link your application with the +resulting libraries, and you end up with an executable that you can +run directly on your Linux machine or via gdb. A useful side effect of +this is that application development can start before any real +embedded hardware is actually available. +

Typically the memory map for a synthetic target application will be +set up such that there is a read-only ROM region containing all the +code and constant data, and a read-write RAM region for the data. The +default locations and sizes of these regions depend on the specific +platform being used for development. Note that the application always +executes out of ROM: on a real embedded target much of the development +would involve running RedBoot firmware there, with application code +and data loaded into RAM; usually this would change for the final +system; the firmware would be removed; and the application itself +would execute from ROM and perform the appropriate hardware +initialization. Therefore the synthetic target actually emulates the +behaviour of the final system, not the development environment. +


PrevHomeNext
eCos Synthetic Target System Calls
\ No newline at end of file diff --git a/packages/hal/synth/arch/current/doc/synth.sgml b/packages/hal/synth/arch/current/doc/synth.sgml new file mode 100644 --- /dev/null +++ b/packages/hal/synth/arch/current/doc/synth.sgml @@ -0,0 +1,601 @@ + + + + + + + + + + + +####ECOSGPLCOPYRIGHTBEGIN#### + ------------------------------------------- + This file is part of eCos, the Embedded Configurable Operating System. + Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + + eCos is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 or (at your option) any later version. + + eCos is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with eCos; if not, write to the Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + + As a special exception, if other files instantiate templates or use macros + or inline functions from this file, or you compile this file and link it + with other works to produce a work based on this file, this file does not + by itself cause the resulting work to be covered by the GNU General Public + License. However the source code for this file must still be made available + in accordance with section (3) of the GNU General Public License. + + This exception does not invalidate any other reasons why a work based on + this file might be covered by the GNU General Public License. + + Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. + at http://sources.redhat.com/ecos/ecos-license + ------------------------------------------- +####ECOSGPLCOPYRIGHTEND#### + + + + + + + + + + + + + +eCos Synthetic Target + + + + + + Overview + + + Overview + The eCos synthetic target + + + Description + +Usually eCos runs on either a custom piece of hardware, specially +designed to meet the needs of a specific application, or on a +development board of some sort that is available before the final +hardware. Such boards have a number of things in common: + + + +Obviously there has to be at least one processor to do the work. +Usually this will be a 32-bit processor, but it can be smaller or +larger. Processor speed will vary widely, depending on the expected +needs of the application. However usually the exact processor being +used does not matter very much for most of the development process: +the use of languages such as C or C++ means that the compiler will +handle those details. + + +There needs to be memory for code and for data. A typical system will +have two different types of memory. There will be some non-volatile +memory such as flash, EPROM or masked ROM. There will also be some +volatile memory such as DRAM or SRAM. Often the code for the final +application will reside in the non-volatile memory and all of the RAM +will be available for data. However updating non-volatile memory +requires a non-trivial amount of effort, so for much of the +development process it is more convenient to burn suitable firmware, +for example RedBoot, into the non-volatile memory and then use that to +load the application being debugged into RAM, alongside the +application data and a small area reserved for use by the firmware. + + +The platform must provide certain mimimal I/O facilities. Most eCos +configurations require a clock signal of some sort. There must also be +some way of outputting diagnostics to the user, often but not always +via a serial port. Unless special debug hardware is being used, source +level debugging will require bidirectional communication between a +host machine and the target hardware, usually via a serial port or an +ethernet device. + + +All the above is not actually very useful yet because there is no way +for the embedded device to interact with the rest of the world, except +by generating diagnostics. Therefore an embedded device will have +additional I/O hardware. This may be fairly standard hardware such as +an ethernet or USB interface, or special hardware designed +specifically for the intended application, or quite often some +combination. Standard hardware such as ethernet or USB may be +supported by eCos device drivers and protocol stacks, whereas the +special hardware will be driven directly by application code. + + + +Much of the above can be emulated on a typical PC running Linux. +Instead of running the embedded application being developed on a +target board of some sort, it can be run as a Linux process. The +processor will be the PC's own processor, for example an x86, and the +memory will be the process' address space. Some I/O facilities can be +emulated through system calls. For example clock hardware can be +emulated by setting up a SIGALRM signal, which will +cause the process to be interrupted at regular intervals. This +emulation of real hardware will not be particularly accurate, for +example the number of cpu cycles available to the eCos application +between clock ticks will vary widely depending on what else is running +on the PC, but for much development work it will be good enough. + + +A key requirement for synthetic target code is that the embedded +application must not be linked with any of the standard Linux +libraries such as the GNU C library: that would lead to a confusing +situation where both eCos and the Linux libraries attempted to provide +functions such as printf. Instead the synthetic +target support must be implemented directly on top of the Linux +kernels' system call interface. For example, the kernel provides a +system call for write operations. The actual function +write is implemented in the system's C library, +but all it does is move its arguments on to the stack or into certain +registers and then execute a special trap instruction such as +int 0x80. When this instruction is executed +control transfers into the kernel, which will validate the arguments +and perform the appropriate operation. Now, a synthetic target +application cannot be linked with the system's C library. Instead it +contains a function cyg_hal_sys_write which, like +the C library's write function, pushes its +arguments on to the stack and executes the trap instruction. The Linux +kernel cannot tell the difference, so it will perform the I/O +operation requested by the synthetic target. With appropriate +knowledge of what system calls are available, this makes it possible +to emulate the required I/O facilities. For example diagnostic output +can be achieved by a cyg_hal_sys_write system +call using file descriptor 1, which corresponds to stdout. + + +In many ways developing for the synthetic target is no different from +developing for real embedded targets. eCos must be configured +appropriately: selecting a suitable target such as +i386linux will cause the configuration system +to load the appropriate packages for this hardware; this includes an +architectural HAL package and a platform-specific package; the +architectural package contains generic code applicable to all Linux +platforms, whereas the platform package is for specific Linux +implementations such as the x86 version and contains any +processor-specific code. Selecting this target will also bring in some +device driver packages. Other aspects of the configuration such as +which API's are supported are determined by the template, by adding +and removing packages, and by fine-grained configuration. + + +In other ways developing for the synthetic target can be much easier +than developing for a real embedded target. For example there is no +need to worry about building and installing suitable firmware on the +target hardware, and then downloading and debugging the actual +application over a serial line or a similar connection. Instead an +eCos application built for the synthetic target is mostly +indistinguishable from an ordinary Linux program. It can be run simply +by typing the name of the executable file at a shell prompt. +Alternatively you can debug the application using whichever version of +gdb is provided by your Linux distribution. There is no need to build +or install special toolchains. Essentially using the synthetic target +means that the various problems associated with real embedded hardware +can be bypassed for much of the development process. + + +The eCos synthetic target provides emulation, not simulation. It is +possible to run eCos in suitable architectural simulators but that +involves a rather different approach to software development. For +example, when running eCos on the psim PowerPC simulator you need +appropriate cross-compilation tools that allow you to build PowerPC +executables. These are then loaded into the simulator which interprets +every instruction and attempts to simulate what would happen if the +application were running on real hardware. This involves a lot of +processing overhead, but depending on the functionality provided by +the simulator it can give very accurate results. When developing for +the synthetic target the executable is compiled for the PC's own +processor and will be executed at full speed, with no need for a +simulator or special tools. This will be much faster and somewhat +simpler than using an architectural simulator, but no attempt is made +to accurately match the behaviour of a real embedded target. + + +Support for emulating standard hardware such as ethernet is not yet +available in the current release of the eCos synthetic target code, +but is planned for future versions. Emulating application-specific +custom hardware is rather more difficult since there is no way of +knowing just what strange hardware a particular application might +need, but the I/O mechanisms planned should allow for +application-specific extensions. + + + + Toolchain + +When developing eCos applications for a normal embedded target it is +necessary to use a suitable cross-compiler and related tools such as +the linker. Developing for the synthetic target is easier because you +can just use the standard GNU tools (gcc, g++, ld, …) which +were provided with your Linux distribution, or which you used to build +your own Linux setup. Any reasonably recent version of the tools, for +example gcc 2.96(Red Hat) as shipped with Red Hat Linux 7, should be +sufficient. + + +There is one important limitation when using these tools: current gdb +will not support debugging of eCos threads on the synthetic target. As +far as gdb is concerned a synthetic target application is also +indistinguishable from a normal Linux application, so it assumes that +any threads will be created by calls to the Linux +pthread_create function provided by the C +library. Obviously this is not the case since the application is never +linked with that library. Therefore gdb never notices the eCos thread +mechanisms and assumes the application is single-threaded. Fixing this +is possible but would involve non-trivial changes to gdb. + + +Theoretically it is possible to develop synthetic target applications +on, for example, a PC running Windows and then run the resulting +executables on another machine that runs Linux. This is rarely useful: +if a Linux machine is available then usually that machine will also be +used for building ecos and the application. However, if for some +reason it is necessary or desirable to build on another machine then +this requires a suitable cross-compiler and related tools. If the +application will be running on a typical PC with an x86 processor then +a suitable configure triplet would be +i686-pc-linux-gnu. The installation +instructions for the various GNU tools should be consulted for further +information. + + + + Hardware Preparation + +Preparing a real embedded target for eCos development can be tricky. +Often the first step is to install suitable firmware, usually RedBoot. +This means creating and building a special configuration for eCos with +the RedBoot template, then somehow updating the target's flash chips +with the resulting RedBoot image. Typically it will also be necessary +to get a working serial connection, and possibly set up ethernet as +well. Although usually none of the individual steps are particularly +complicated, there are plenty of ways in which things can go wrong and +it can be hard to figure out what is actually happening. Of course +some board manufacturers make life easier for their developers by +shipping hardware with RedBoot preinstalled, but even then it is still +necessary to set up communication between host and target. + + +None of this is applicable to the synthetic target. Instead you can +just build a normal eCos configuration, link your application with the +resulting libraries, and you end up with an executable that you can +run directly on your Linux machine or via gdb. A useful side effect of +this is that application development can start before any real +embedded hardware is actually available. + + +Typically the memory map for a synthetic target application will be +set up such that there is a read-only ROM region containing all the +code and constant data, and a read-write RAM region for the data. The +default locations and sizes of these regions depend on the specific +platform being used for development. Note that the application always +executes out of ROM: on a real embedded target much of the development +would involve running RedBoot firmware there, with application code +and data loaded into RAM; usually this would change for the final +system; the firmware would be removed; and the application itself +would execute from ROM and perform the appropriate hardware +initialization. Therefore the synthetic target actually emulates the +behaviour of the final system, not the development environment. + + + + + + + + + + + System Calls + + + + cyg_hal_sys_xyz + Access Linux system facilities + + + + + +#include <cyg/hal/hal_io.h + + + int cyg_hal_sys_xyz + + + + + + Description + +On a real embedded target eCos interacts with the hardware by peeking +and poking various registers, manipulating special regions of memory, +and so on. The synthetic target does not access hardware directly. +Instead I/O and other operations are emulated by making appropriate +Linux system calls. The HAL package exports a number of functions +which allow other packages, or even application code, to make these +same system calls. However this facility must be used with care: any +code which calls, for example, cyg_hal_sys_write +will only ever run on the synthetic target; that functionality is +obviously not provided on any real hardware because there is no +underlying Linux kernel to implement it. + + +The synthetic target only provides a subset of the available system +calls, specifically those calls which have proved useful to implement +I/O emulation. This subset can be extended fairly easily if necessary. +All of the available calls, plus associated data structures and +macros, are defined in the header file cyg/hal/hal_io.h. There is a simple +convention: given a Linux system call such as +open, the synthetic target will prefix +cyg_hal_sys and provide a function with that name. +The second argument to the open system call is +a set of flags such as O_RDONLY, and the header +file will define a matching constant +CYG_HAL_SYS_O_RDONLY. There are also data +structures such as cyg_hal_sys_sigset_t, +matching the Linux data structure sigset_t. + + +In most cases the functions provided by the synthetic target behave as +per the documentation for the Linux system calls, and section 2 of the +Linux man pages can be consulted for more information. There is one +important difference: typically the documentation will say that a +function returns -1 to indicate an error, with the +actual error code held in errno; the actual +underlying system call and hence the +cyg_hal_sys_xyz provided by eCos instead returns +a negative number to indicate an error, with the absolute value of +that number corresponding to the error code; usually it is the C +library which handles this and manipulates errno, but of course +synthetic target applications are not linked with that Linux library. + + +However, there are some exceptions. The Linux kernel has evolved over +the years, and some of the original system call interfaces are no +longer appropriate. For example the original +select system call has been superseded by +_newselect, and that is what the +select function in the C library actually uses. +The old call is still available to preserve binary compatibility but, +like the C library, eCos makes use of the new one because it provides +the appropriate functionality. In an attempt to reduce confusion the +eCos function is called cyg_hal_sys__newselect, +in other words it matches the official system call naming scheme. The +authoritive source of information on such matters is the Linux kernel +sources themselves, and especially its header files. + + +eCos packages and applications should never +#include Linux header files directly. For example, +doing a #include </usr/include/fcntl.h> +to access additional macros or structure definitions, or alternatively +manipulating the header file search path, will lead to problems +because the Linux header files are likely to duplicate and clash with +definitions in the eCos headers. Instead the appropriate functionality +should be extracted from the Linux headers and moved into either +cyg/hal/hal_io.h or into +application code, with suitable renaming to avoid clashes with eCos +names. Users should be aware that large-scale copying may involve +licensing complications. + + +Adding more system calls is usually straightforward and involves +adding one or more lines to the platform-specific file in the +appropriate platform HAL, for example +syscall-i386-linux-1.0.S. However it is necessary +to do some research first about the exact interface implemented by the +system call, because of issues such as old system calls that have been +superseded. The required information can usually be found fairly +easily by searching through the Linux kernel sources and possibly the +GNU C library sources. + + + + + + + + + + Porting + + + Porting + The eCos synthetic target + + + Description + +The initial development effort of the eCos synthetic target happened +on x86 Linux machines. Porting to other platforms involves addressing +a number of different issues. Some ports should be fairly +straightforward, for example a port to Linux on a processor other than +an x86. Porting to Unix or Unix-like operating systems other than +Linux may be possible, but would involve more effort. Porting to a +completely different operating system such as Windows would be very +difficult. The text below completes the eCos Porting Guide. + + + + Other Linux Platforms + +Porting the synthetic target to a Linux platform that uses a processor +other than x86 should be straightforward. The simplest approach is to +copy the existing i386linux +directory tree in the hal/synth +hierarchy, then rename and edit the ten or so files in this package. +Most of the changes should be pretty obvious, for example on a 64-bit +processor some new data types will be needed in the +basetype.h header file. It will also be necessary +to update the toplevel ecos.db database with an +entry for the new HAL package, and a new target entry will be needed +as well. + + +Obviously a different processor will have different register sets +and calling conventions, so the code for saving and restoring thread +contexts and for implementing setjmp and +longjmp will need to be updated. The exact way of +performing Linux system calls will also vary: on i386linux this +usually involves pushing some registers on the stack and then +executing an int 0x080 trap instruction, but +on a different processor the arguments might be passed in registers +instead and certainly a different trap instruction will be used. The +startup code is also written in assembler, but needs to do little more +than jump to the main linux_entry function +provided by the architectural synthetic target HAL package. + + +The header file hal_io.h provided by the +architectural HAL package provides various structure definitions, +function prototypes, and macros related to system calls. These are +correct for i386linux, but there may be problems on other processors. +For example a structure field that is currently defined as a 32-bit +number may in fact may be a 64-bit number instead. + + +The synthetic target's memory map is defined in two files in the +include/pkgconf subdirectory. +For x86 the default memory map involves eight megabytes of read-only +memory for the code at location 0x1000000 and another eight megabytes +for data at 0x2000000. These address ranges may be reserved for other +purposes on the new architecture, so may need changing. There may be +some additional areas of memory allocated by the system for other +purposes, for example the startup stack and any environment variables, +but usually eCos applications can and should ignore those. + + +Other HAL functionality such as interrupt handling, diagnostics, and +the system clock are provided by the architectural HAL package and +should work on different processors with few if any changes. + + +When porting to other processors, a number of sources of information +are likely to prove useful. Obviously the Linux kernel sources and +header files constitute the ultimate authority on how things work at +the system call level. The GNU C library sources may also prove very +useful: for a normal Linux application it is the C library that +provides the startup code and the system call interface. + + + + Other Unix Platforms + +Porting to a Unix or Unix-like operating system other than Linux would +be somewhat more involved. The first requirement involves toolchains: +the GNU compilers, gcc and g++, must definitely be used; use of other +GNU tools such as the linker may be needed as well, because eCos +depends on functionality such as prioritizing C++ static constructors, +and other linkers may not implement this or may implement it in a +different and incompatible way. A closely related requirement is the +use of ELF format for binary executables: if the operating system +still uses an older format such as COFF then there are likely to be +problems because they do not provide the flexibility required by eCos. + + +In the architectural HAL there should be very little code that is +specific to Linux. Instead the code should work on any operating +system that provides a reasonable implementation of the POSIX +standard. There may be some problems with program startup, but those +could be handled at the architectural level. Some changes may also be +required to the exception handling code. However one file which will +present a problem is hal_io.h, which contains +various structure definitions and macros used with the system call +interface. It is likely that many of these definitions will need +changing, and it may well be appropriate to implement variant HAL +packages for the different operating systems where this information +can be separated out. Another possible problem is that the generic +code assumes that system calls such as +cyg_hal_sys_write are available. On an operating +system other than Linux it is possible that some of these are not +simple system calls, and instead wrapper functions will need to be +implemented at the variant HAL level. + + +The remaining porting task is to implement one or more platform HAL +packages, one per processor type that is supported. This should +involve much the same work as a port to another processor running Linux. + + +When using other Unix operating systems the kernel source code may not +be available, which would make any porting effort more challenging. +However there is still a good chance that the GNU C library will have +been ported already, so its source code may contain much useful +information. + + +Users should be aware that future enhancements to the synthetic target +code, especially in areas related to I/O, may be much more closely +tied to Linux. For example access to ethernet facilities might be +implemented using the PF_PACKET socket address +family, or the virtual tunnelling interface. Porting such code to +other Unix operating systems may prove rather more difficult. + + + + Windows Platforms + +Porting the current synthetic target code to some version of Windows +or to another non-Unix platform is likely to prove very difficult. The +first hurdle that needs to be crossed is the file format for binary +executables: current Windows implementations do not use ELF, instead +they use their own format PE which is a variant of the rather old and +limited COFF format. It may well prove easier to first write an ELF +loader for Windows executables, rather than try to get eCos to work +within the constraints of PE. Of course that introduces new problems, +for example existing source-level debuggers will still expect +executables to be in PE format. + + +Under Linux a synthetic target application is not linked with the +system's C library or any other standard system library. That would +cause confusion, for example both eCos and the system's C library +might try to define the printf function, and +introduce complications such as working with shared libraries. For +much the same reasons, a synthetic target application under Windows +should not be linked with any Windows DLL's. If an ELF loader has been +specially written then this may not be much of a problem. + + +The next big problem is the system call interface. Under Windows +system calls are generally made via DLL's, and it is not clear that +the underlying trap mechanism is well-documented or consistent between +different releases of Windows. + + +The current code depends on the operating system providing an +implementation of POSIX signal handling. This is used for I/O +purposes, for example SIGALRM is used for the +system clock, and for exceptions. It is not known what equivalent +functionality is available under Windows. + + +Given the above problems a port of the synthetic target to Windows may +or may not be technically feasible, but it would certainly require a +very large amount of effort. + + + + + + + + diff --git a/packages/hal/synth/arch/current/include/hal_arch.h b/packages/hal/synth/arch/current/include/hal_arch.h --- a/packages/hal/synth/arch/current/include/hal_arch.h +++ b/packages/hal/synth/arch/current/include/hal_arch.h @@ -8,29 +8,38 @@ // Architecture specific abstractions for synthetic target. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/synth/arch/current/include/hal_cache.h b/packages/hal/synth/arch/current/include/hal_cache.h --- a/packages/hal/synth/arch/current/include/hal_cache.h +++ b/packages/hal/synth/arch/current/include/hal_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/synth/arch/current/include/hal_diag.h b/packages/hal/synth/arch/current/include/hal_diag.h --- a/packages/hal/synth/arch/current/include/hal_diag.h +++ b/packages/hal/synth/arch/current/include/hal_diag.h @@ -8,29 +8,38 @@ // Synthetic target HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/synth/arch/current/include/hal_intr.h b/packages/hal/synth/arch/current/include/hal_intr.h --- a/packages/hal/synth/arch/current/include/hal_intr.h +++ b/packages/hal/synth/arch/current/include/hal_intr.h @@ -8,29 +8,38 @@ // HAL Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/synth/arch/current/include/hal_io.h b/packages/hal/synth/arch/current/include/hal_io.h --- a/packages/hal/synth/arch/current/include/hal_io.h +++ b/packages/hal/synth/arch/current/include/hal_io.h @@ -8,29 +8,38 @@ // HAL device IO register support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/synth/arch/current/src/synth.ld b/packages/hal/synth/arch/current/src/synth.ld --- a/packages/hal/synth/arch/current/src/synth.ld +++ b/packages/hal/synth/arch/current/src/synth.ld @@ -5,29 +5,38 @@ // Linker script for the synthetic target // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -62,7 +71,7 @@ GROUP(libtarget.a libgcc.a) #define SECTION_text(_region_, _vma_, _lma_) \ .text _vma_ : _lma_ \ { _stext = .; \ - *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) } \ + *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) } \ > _region_ \ _etext = .; PROVIDE (etext = .); @@ -78,7 +87,7 @@ GROUP(libtarget.a libgcc.a) #define SECTION_rodata(_region_, _vma_, _lma_) \ .rodata _vma_ : _lma_ \ - { FORCE_OUTPUT; *(.rodata*) } \ + { FORCE_OUTPUT; *(.rodata*) *(.gnu.linkonce.r.*) } \ > _region_ #define SECTION_fixup(_region_, _vma_, _lma_) \ @@ -92,6 +101,68 @@ GROUP(libtarget.a libgcc.a) _EXCEPT_END_ = ABSOLUTE(.);} \ > _region_ +#define SECTION_eh_frame(_region_, _vma_, _lma_) \ + .eh_frame _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; __EH_FRAME_BEGIN__ = .; \ + KEEP(*(.eh_frame)) \ + __FRAME_END__ = .; \ + . = . + 8; \ + } > _region_ = 0 + +#define SECTION_RELOCS(_region_, _vma_, _lma_) \ + .rel.text : \ + { \ + *(.rel.text) \ + *(.rel.text.*) \ + *(.rel.gnu.linkonce.t*) \ + } > _region_ \ + .rela.text : \ + { \ + *(.rela.text) \ + *(.rela.text.*) \ + *(.rela.gnu.linkonce.t*) \ + } > _region_ \ + .rel.data : \ + { \ + *(.rel.data) \ + *(.rel.data.*) \ + *(.rel.gnu.linkonce.d*) \ + } > _region_ \ + .rela.data : \ + { \ + *(.rela.data) \ + *(.rela.data.*) \ + *(.rela.gnu.linkonce.d*) \ + } > _region_ \ + .rel.rodata : \ + { \ + *(.rel.rodata) \ + *(.rel.rodata.*) \ + *(.rel.gnu.linkonce.r*) \ + } > _region_ \ + .rela.rodata : \ + { \ + *(.rela.rodata) \ + *(.rela.rodata.*) \ + *(.rela.gnu.linkonce.r*) \ + } > _region_ \ + .rel.got : { *(.rel.got) } > _region_ \ + .rela.got : { *(.rela.got) } > _region_ \ + .rel.ctors : { *(.rel.ctors) } > _region_ \ + .rela.ctors : { *(.rela.ctors) } > _region_ \ + .rel.dtors : { *(.rel.dtors) } > _region_ \ + .rela.dtors : { *(.rela.dtors) } > _region_ \ + .rel.init : { *(.rel.init) } > _region_ \ + .rela.init : { *(.rela.init) } > _region_ \ + .rel.fini : { *(.rel.fini) } > _region_ \ + .rela.fini : { *(.rela.fini) } > _region_ \ + .rel.bss : { *(.rel.bss) } > _region_ \ + .rela.bss : { *(.rela.bss) } > _region_ \ + .rel.plt : { *(.rel.plt) } > _region_ \ + .rela.plt : { *(.rela.plt) } > _region_ \ + .rel.dyn : { *(.rel.dyn) } > _region_ + // Note: The __ in the name is an encoding of the . #define SECTION_rel__got(_region_, _vma_, _lma_) \ .rel.got _vma_ : _lma_ \ @@ -100,7 +171,7 @@ GROUP(libtarget.a libgcc.a) #define SECTION_data(_region_, _vma_, _lma_) \ .data _vma_ : _lma_ \ - { __ram_data_start = ABSOLUTE(.); *(.data*) \ + { __ram_data_start = ABSOLUTE(.); *(.data*) *(.gnu.linkonce.d.*) \ _GOT1_START_ = ABSOLUTE(.); *(.got1) _GOT1_END_ = ABSOLUTE(.); \ /* Put .ctors and .dtors next to the .got2 section, so that */ \ /* the pointers get relocated with -mrelocatable. */ \ @@ -113,11 +184,11 @@ GROUP(libtarget.a libgcc.a) _GOT2_START_ = ABSOLUTE(.); *(.got2) _GOT2_END_ = ABSOLUTE(.); \ _GOT_START_ = ABSOLUTE(.); _GLOBAL_OFFSET_TABLE_ = ABSOLUTE(. + 32768); \ _SDA_BASE_ = ABSOLUTE(.); *(.got.plt) *(.got) \ - _GOT_END_ = ABSOLUTE(.); *(.dynamic) *(.eh_frame) \ + _GOT_END_ = ABSOLUTE(.); *(.dynamic) \ /* 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. */ \ - _SDATA_START_ = ABSOLUTE(.); *(.sdata*) } \ + _SDATA_START_ = ABSOLUTE(.); *(.sdata*) *(.gnu.linkonce.s.*) } \ > _region_ \ __rom_data_start = LOADADDR(.data); \ __ram_data_end = .; PROVIDE(__ram_data_end = .); \ @@ -126,13 +197,14 @@ GROUP(libtarget.a libgcc.a) #define SECTION_sbss(_region_, _vma_, _lma_) \ .sbss _vma_ : _lma_ \ { __bss_start = ABSOLUTE (.); \ - _SBSS_START_ = ABSOLUTE(.); *(.sbss*) _SBSS_END_ = ABSOLUTE(.); \ + _SBSS_START_ = ABSOLUTE(.); *(.sbss*) *(.gnu.linkonce.sb.*) \ + _SBSS_END_ = ABSOLUTE(.); \ *(.scommon*) } \ > _region_ #define SECTION_bss(_region_, _vma_, _lma_) \ .bss _vma_ : _lma_ \ - { FORCE_OUTPUT; *(.dynbss*) *(.bss*) *(COMMON) } \ + { FORCE_OUTPUT; *(.dynbss*) *(.bss*) *(COMMON) *(.gnu.linkonce.b.*) } \ > _region_ \ __bss_end = .; diff --git a/packages/hal/synth/arch/current/src/synth_diag.c b/packages/hal/synth/arch/current/src/synth_diag.c --- a/packages/hal/synth/arch/current/src/synth_diag.c +++ b/packages/hal/synth/arch/current/src/synth_diag.c @@ -5,29 +5,38 @@ // Synthetic target diagnostic output code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/synth/arch/current/src/synth_entry.c b/packages/hal/synth/arch/current/src/synth_entry.c --- a/packages/hal/synth/arch/current/src/synth_entry.c +++ b/packages/hal/synth/arch/current/src/synth_entry.c @@ -5,29 +5,38 @@ // Entry code for Linux synthetic target. // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/synth/arch/current/src/synth_intr.c b/packages/hal/synth/arch/current/src/synth_intr.c --- a/packages/hal/synth/arch/current/src/synth_intr.c +++ b/packages/hal/synth/arch/current/src/synth_intr.c @@ -5,29 +5,38 @@ // Interrupt and clock code for the Linux synthetic target. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -337,32 +346,17 @@ hal_vsr_set(cyg_vector_t vec, void (*new void hal_interrupt_mask(cyg_vector_t which) { - cyg_bool_t old; - + CYG_PRECONDITION( !hal_interrupts_enabled, "Interrupts should be disabled on entry to hal_interrupt_mask"); CYG_ASSERT((CYGNUM_HAL_ISR_MIN <= which) && (which <= CYGNUM_HAL_ISR_MAX), "A valid ISR vector must be supplied"); - // Masking an interrupt just means updating the interrupt mask - // "register". The update is not atomic, so interrupts have to be - // disabled. At present there are no rules about masking - // interrupts that are already masked. - HAL_DISABLE_INTERRUPTS(old); synth_masked_isrs |= (0x01 << which); - HAL_RESTORE_INTERRUPTS(old); } void hal_interrupt_unmask(cyg_vector_t which) { - cyg_bool_t old; + CYG_PRECONDITION( !hal_interrupts_enabled, "Interrupts should be disabled on entry to hal_interrupt_unmask"); CYG_ASSERT((CYGNUM_HAL_ISR_MIN <= which) && (which <= CYGNUM_HAL_ISR_MAX), "A valid ISR vector must be supplied"); - CYG_ASSERT( !hal_interrupts_enabled || (synth_isr_handlers[which].isr != &synth_default_isr), "An ISR should be installed before the interrupt is enabled"); - - // Unmasking an interrupt also involves updating the interrupt - // mask "register". HAL_RESTORE_INTERRUPTS() will involve a call - // to hal_enable_interrupts() and that checks for any pending - // ISRs. - HAL_DISABLE_INTERRUPTS(old); synth_masked_isrs &= ~(0x01 << which); - HAL_RESTORE_INTERRUPTS(old); } void diff --git a/packages/hal/synth/i386linux/current/ChangeLog b/packages/hal/synth/i386linux/current/ChangeLog --- a/packages/hal/synth/i386linux/current/ChangeLog +++ b/packages/hal/synth/i386linux/current/ChangeLog @@ -1,3 +1,15 @@ +2002-04-29 Jonathan Larmour + + * src/vectors.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-10 Jonathan Larmour + + * include/pkgconf/mlt_synth_i386_rom.ldi: Define eh_frame and + RELOCS sections. + 2001-11-1 Andrew Lunn * src/syscall-i386-linux-1.0.S: Added mmap system call @@ -337,27 +349,36 @@ Mon Nov 9 15:18:11 GMT 1998 Chris Pro Initial i386 linux port. //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/hal/synth/i386linux/current/cdl/hal_synth_i386.cdl b/packages/hal/synth/i386linux/current/cdl/hal_synth_i386.cdl --- a/packages/hal/synth/i386linux/current/cdl/hal_synth_i386.cdl +++ b/packages/hal/synth/i386linux/current/cdl/hal_synth_i386.cdl @@ -5,29 +5,38 @@ # i386-specific synthetic target configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# +#####ECOSGPLCOPYRIGHTBEGIN#### # ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. # -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. # -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/hal/synth/i386linux/current/include/arch.inc b/packages/hal/synth/i386linux/current/include/arch.inc --- a/packages/hal/synth/i386linux/current/include/arch.inc +++ b/packages/hal/synth/i386linux/current/include/arch.inc @@ -5,29 +5,38 @@ ## i386 assembler header file for the synthetic target ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/synth/i386linux/current/include/basetype.h b/packages/hal/synth/i386linux/current/include/basetype.h --- a/packages/hal/synth/i386linux/current/include/basetype.h +++ b/packages/hal/synth/i386linux/current/include/basetype.h @@ -8,29 +8,38 @@ // Standard types for x86 synthetic target. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.ldi b/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.ldi --- a/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.ldi +++ b/packages/hal/synth/i386linux/current/include/pkgconf/mlt_synth_i386_rom.ldi @@ -19,6 +19,8 @@ SECTIONS SECTION_rodata1 (rom, ALIGN (0x8), LMA_EQ_VMA) SECTION_rodata (rom, ALIGN (0x8), LMA_EQ_VMA) SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_RELOCS (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_eh_frame (rom, ALIGN (0x4), LMA_EQ_VMA) SECTION_rel__got (rom, ALIGN (0x1), LMA_EQ_VMA) SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) SECTION_data (ram, 0x2000000, LMA_EQ_VMA) diff --git a/packages/hal/synth/i386linux/current/include/var_arch.h b/packages/hal/synth/i386linux/current/include/var_arch.h --- a/packages/hal/synth/i386linux/current/include/var_arch.h +++ b/packages/hal/synth/i386linux/current/include/var_arch.h @@ -8,29 +8,38 @@ // Per-processor information such as processor save states. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/synth/i386linux/current/src/context.S b/packages/hal/synth/i386linux/current/src/context.S --- a/packages/hal/synth/i386linux/current/src/context.S +++ b/packages/hal/synth/i386linux/current/src/context.S @@ -5,29 +5,38 @@ ## x86 thread context manipulation. ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# +#####ECOSGPLCOPYRIGHTBEGIN#### # ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. # -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. # -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license # ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## diff --git a/packages/hal/synth/i386linux/current/src/syscall-i386-linux-1.0.S b/packages/hal/synth/i386linux/current/src/syscall-i386-linux-1.0.S --- a/packages/hal/synth/i386linux/current/src/syscall-i386-linux-1.0.S +++ b/packages/hal/synth/i386linux/current/src/syscall-i386-linux-1.0.S @@ -5,29 +5,38 @@ // Linux system call interface functions for i386. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/synth/i386linux/current/src/vectors.S b/packages/hal/synth/i386linux/current/src/vectors.S --- a/packages/hal/synth/i386linux/current/src/vectors.S +++ b/packages/hal/synth/i386linux/current/src/vectors.S @@ -5,29 +5,38 @@ ## x86 exception vectors ## ##============================================================================= -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### ##============================================================================= #######DESCRIPTIONBEGIN#### ## @@ -48,7 +57,7 @@ #============================================================================== - .file "vectors.S" +// .file "vectors.S" .extern _linux_entry .text diff --git a/packages/hal/v85x/arch/current/ChangeLog b/packages/hal/v85x/arch/current/ChangeLog --- a/packages/hal/v85x/arch/current/ChangeLog +++ b/packages/hal/v85x/arch/current/ChangeLog @@ -218,27 +218,36 @@ 2000-03-21 Gary Thomas + + * cdl/hal_v85x_ceb_v850.cdl: CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES + defined. + 2001-10-25 Jonathan Larmour * cdl/hal_v85x_ceb_v850.cdl (CYGBLD_GLOBAL_CFLAGS): Always use @@ -230,27 +235,36 @@ 2000-03-21 Gary Thomas " puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + + puts $::cdl_header "#define CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES 20000" } cdl_option CYG_HAL_STARTUP { diff --git a/packages/hal/v85x/ceb_v850/current/include/hal_diag.h b/packages/hal/v85x/ceb_v850/current/include/hal_diag.h --- a/packages/hal/v85x/ceb_v850/current/include/hal_diag.h +++ b/packages/hal/v85x/ceb_v850/current/include/hal_diag.h @@ -8,29 +8,38 @@ // HAL Support for Kernel Diagnostic Routines // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/v85x/ceb_v850/current/include/hal_platform_setup.h b/packages/hal/v85x/ceb_v850/current/include/hal_platform_setup.h --- a/packages/hal/v85x/ceb_v850/current/include/hal_platform_setup.h +++ b/packages/hal/v85x/ceb_v850/current/include/hal_platform_setup.h @@ -8,29 +8,38 @@ // Platform specific support for HAL (assembly code) // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/v85x/ceb_v850/current/include/plf_cache.h b/packages/hal/v85x/ceb_v850/current/include/plf_cache.h --- a/packages/hal/v85x/ceb_v850/current/include/plf_cache.h +++ b/packages/hal/v85x/ceb_v850/current/include/plf_cache.h @@ -8,29 +8,38 @@ // HAL cache control API // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/v85x/ceb_v850/current/include/plf_intr.h b/packages/hal/v85x/ceb_v850/current/include/plf_intr.h --- a/packages/hal/v85x/ceb_v850/current/include/plf_intr.h +++ b/packages/hal/v85x/ceb_v850/current/include/plf_intr.h @@ -8,29 +8,38 @@ // NEC/V85x Interrupt and clock support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/v85x/ceb_v850/current/include/plf_io.h b/packages/hal/v85x/ceb_v850/current/include/plf_io.h --- a/packages/hal/v85x/ceb_v850/current/include/plf_io.h +++ b/packages/hal/v85x/ceb_v850/current/include/plf_io.h @@ -8,29 +8,38 @@ // Platform specific IO support // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/v85x/ceb_v850/current/include/plf_sections.h b/packages/hal/v85x/ceb_v850/current/include/plf_sections.h --- a/packages/hal/v85x/ceb_v850/current/include/plf_sections.h +++ b/packages/hal/v85x/ceb_v850/current/include/plf_sections.h @@ -5,29 +5,38 @@ // V85x layout definitions - hardwired sections // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/v85x/ceb_v850/current/include/plf_stub.h b/packages/hal/v85x/ceb_v850/current/include/plf_stub.h --- a/packages/hal/v85x/ceb_v850/current/include/plf_stub.h +++ b/packages/hal/v85x/ceb_v850/current/include/plf_stub.h @@ -8,29 +8,38 @@ // Platform header for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/v85x/ceb_v850/current/src/plf_misc.c b/packages/hal/v85x/ceb_v850/current/src/plf_misc.c --- a/packages/hal/v85x/ceb_v850/current/src/plf_misc.c +++ b/packages/hal/v85x/ceb_v850/current/src/plf_misc.c @@ -5,29 +5,38 @@ // HAL platform miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/v85x/ceb_v850/current/src/plf_stub.c b/packages/hal/v85x/ceb_v850/current/src/plf_stub.c --- a/packages/hal/v85x/ceb_v850/current/src/plf_stub.c +++ b/packages/hal/v85x/ceb_v850/current/src/plf_stub.c @@ -5,29 +5,38 @@ // Platform specific code for GDB stub support. // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/v85x/ceb_v850/current/src/v850flash.S b/packages/hal/v85x/ceb_v850/current/src/v850flash.S --- a/packages/hal/v85x/ceb_v850/current/src/v850flash.S +++ b/packages/hal/v85x/ceb_v850/current/src/v850flash.S @@ -5,29 +5,38 @@ // CEB v850 flash boot code // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/hal/v85x/v850/current/ChangeLog b/packages/hal/v85x/v850/current/ChangeLog --- a/packages/hal/v85x/v850/current/ChangeLog +++ b/packages/hal/v85x/v850/current/ChangeLog @@ -124,27 +124,36 @@ 2000-03-20 Gary Thomas diff --git a/packages/hal/v85x/v850/current/tests/nmitest.c b/packages/hal/v85x/v850/current/tests/nmitest.c --- a/packages/hal/v85x/v850/current/tests/nmitest.c +++ b/packages/hal/v85x/v850/current/tests/nmitest.c @@ -5,29 +5,38 @@ // V850 NMI test program // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/infra/current/ChangeLog b/packages/infra/current/ChangeLog --- a/packages/infra/current/ChangeLog +++ b/packages/infra/current/ChangeLog @@ -1,3 +1,61 @@ +2002-04-17 Gary Thomas + + * src/diag.cxx (diag_dump_buf_with_offset): Fix pad for short lines. + +2002-04-16 Gary Thomas + + * src/diag.cxx: Return proper length result for sprintf() functions. + +2002-04-09 Jonathan Larmour + + * include/cyg_type.h: Allow HALs to override certain attrib macros. + +2002-02-19 Gary Thomas + + * src/diag.cxx (diag_snprintf): + * include/diag.h: Change function signature on diag_snprintf() + to match snprintf() found in stdio. + +2002-02-13 Jonathan Larmour + + * include/cyg_trac.h: Make message type of trace functions be + const char * to help avoid warnings with callers. + * src/null.cxx: Reflect that in actual functions. + * src/fancy.cxx: Ditto. + * src/simple.cxx: Ditto. + * src/buffer.cxx: Ditto. + +2002-01-31 Hugo Tyson + + * src/tcdiag.cxx (cyg_assert_msg): Enable this function + universally; given the extra usefulness it now has (see below) + it's worth always having around by default in asserted builds. + It can be disabled with CYGDBG_INFRA_DEBUG_ASSERT_MESSAGE = 0. + +2002-01-30 Hugo Tyson + + * src/tcdiag.cxx (cyg_assert_msg): Collect from RedBoot flash + config, whether or not to dump to a specific console. + +2002-01-28 Gary Thomas + + * src/diag.cxx (diag_snprintf): + * include/diag.h: New function diag_snprintf(). + +2002-01-23 Jonathan Larmour + + * include/cyg_type.h: Define CYG_INIT_IO_FS used by filesystems + so that they init *after* the devices they depend on. + +2002-01-21 Jonathan Larmour + + * src/tcdiag.cxx (cyg_test_exit): Work around problem with recent + SH tools that isn't likely to get fixed soon. + +2002-01-17 Jeroen Dobbelaere + + * src/diag.cxx (diag_check_string): enlarge valid string length to 2048 + 2001-12-06 Jesper Skov * src/diag.cxx: Added functions to do memory dump in 16 and 32 bit @@ -768,29 +826,38 @@ 1998-08-20 Nick Garnett message; + const char *psz_msg = rec->message; HAL_DISABLE_INTERRUPTS(old_ints); @@ -415,7 +424,7 @@ cyg_tracenomsg( const char *psz_func, co externC void cyg_tracemsg( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg ) + const char *psz_msg ) { cyg_uint32 old_ints; @@ -442,7 +451,7 @@ cyg_tracemsg( cyg_uint32 what, externC void cyg_tracemsg2( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ) { cyg_uint32 old_ints; @@ -472,7 +481,7 @@ cyg_tracemsg2( cyg_uint32 what, externC void cyg_tracemsg4( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 ) { @@ -505,7 +514,7 @@ cyg_tracemsg4( cyg_uint32 what, externC void cyg_tracemsg6( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 ) @@ -541,7 +550,7 @@ cyg_tracemsg6( cyg_uint32 what, externC void cyg_tracemsg8( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, CYG_ADDRWORD arg5, diff --git a/packages/infra/current/src/delete.cxx b/packages/infra/current/src/delete.cxx --- a/packages/infra/current/src/delete.cxx +++ b/packages/infra/current/src/delete.cxx @@ -5,29 +5,38 @@ // Default delete implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/infra/current/src/diag.cxx b/packages/infra/current/src/diag.cxx --- a/packages/infra/current/src/diag.cxx +++ b/packages/infra/current/src/diag.cxx @@ -5,29 +5,38 @@ // Infrastructure diagnostic output code // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // @@ -227,7 +236,7 @@ static cyg_bool diag_check_string( const /* Check for a reasonable length string. */ - if( s-str > 256 ) result = false; + if( s-str > 2048 ) result = false; /* We only really support CR, NL, and backspace at present. If * we want to use tabs or other special chars, this test will @@ -495,14 +504,21 @@ static int return (res); } +struct _sputc_info { + char *ptr; + int max, len; +}; + static void _sputc(char c, void **param) { - char *_sprintf_ptr = (char *)*param; + struct _sputc_info *info = (struct _sputc_info *)param; - *_sprintf_ptr++ = c; - *_sprintf_ptr = '\0'; - *param = _sprintf_ptr; + if (info->len < info->max) { + *(info->ptr)++ = c; + *(info->ptr) = '\0'; + info->len++; + } } int @@ -510,24 +526,44 @@ diag_sprintf(char *buf, const char *fmt, { int ret; va_list ap; - char *_sprintf_ptr; + struct _sputc_info info; va_start(ap, fmt); - _sprintf_ptr = buf; - ret = _vprintf(_sputc, (void **)&_sprintf_ptr, fmt, ap); + info.ptr = buf; + info.max = 1024; // Unlimited + info.len = 0; + ret = _vprintf(_sputc, (void **)&info, fmt, ap); va_end(ap); - return (ret); + return (info.len); +} + +int +diag_snprintf(char *buf, size_t len, const char *fmt, ...) +{ + int ret; + va_list ap; + struct _sputc_info info; + + va_start(ap, fmt); + info.ptr = buf; + info.len = 0; + info.max = len; + ret = _vprintf(_sputc, (void **)&info, fmt, ap); + va_end(ap); + return (info.len); } int diag_vsprintf(char *buf, const char *fmt, va_list ap) { int ret; - char *_sprintf_ptr; + struct _sputc_info info; - _sprintf_ptr = buf; - ret = _vprintf(_sputc, (void **)&_sprintf_ptr, fmt, ap); - return (ret); + info.ptr = buf; + info.max = 1024; // Unlimited + info.len = 0; + ret = _vprintf(_sputc, (void **)&info, fmt, ap); + return (info.len); } int @@ -570,7 +606,7 @@ diag_dump_buf_with_offset(cyg_uint8 if (i < (int)s) { diag_printf("%02X ", p[i] & 0xFF); } else { - diag_printf(" "); + diag_printf(" "); } if (i == 7) diag_printf(" "); } diff --git a/packages/infra/current/src/dummyxxmain.cxx b/packages/infra/current/src/dummyxxmain.cxx --- a/packages/infra/current/src/dummyxxmain.cxx +++ b/packages/infra/current/src/dummyxxmain.cxx @@ -5,29 +5,38 @@ // Dummy __main() function required for certain targets // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/infra/current/src/eprintf.c b/packages/infra/current/src/eprintf.c --- a/packages/infra/current/src/eprintf.c +++ b/packages/infra/current/src/eprintf.c @@ -5,29 +5,38 @@ // __eprintf() used by libgcc // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/infra/current/src/fancy.cxx b/packages/infra/current/src/fancy.cxx --- a/packages/infra/current/src/fancy.cxx +++ b/packages/infra/current/src/fancy.cxx @@ -5,29 +5,38 @@ // Fancy formatting trace and assert functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -266,7 +275,7 @@ cyg_tracenomsg( const char *psz_func, co externC void cyg_tracemsg( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg ) + const char *psz_msg ) { cyg_uint32 old_ints; @@ -295,7 +304,7 @@ cyg_tracemsg( cyg_uint32 what, externC void cyg_tracemsg2( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ) { cyg_uint32 old_ints; @@ -331,7 +340,7 @@ cyg_tracemsg2( cyg_uint32 what, externC void cyg_tracemsg4( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 ) { @@ -373,7 +382,7 @@ cyg_tracemsg4( cyg_uint32 what, externC void cyg_tracemsg6( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 ) @@ -420,7 +429,7 @@ cyg_tracemsg6( cyg_uint32 what, externC void cyg_tracemsg8( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, CYG_ADDRWORD arg5, diff --git a/packages/infra/current/src/memcpy.c b/packages/infra/current/src/memcpy.c --- a/packages/infra/current/src/memcpy.c +++ b/packages/infra/current/src/memcpy.c @@ -5,29 +5,38 @@ // ANSI standard memcpy() routine // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/infra/current/src/memset.c b/packages/infra/current/src/memset.c --- a/packages/infra/current/src/memset.c +++ b/packages/infra/current/src/memset.c @@ -5,29 +5,38 @@ // ANSI standard memset() routine // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/infra/current/src/null.cxx b/packages/infra/current/src/null.cxx --- a/packages/infra/current/src/null.cxx +++ b/packages/infra/current/src/null.cxx @@ -5,29 +5,38 @@ // Null trace and assert functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -83,26 +92,26 @@ cyg_tracenomsg( const char *psz_func, co externC void cyg_tracemsg( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg ) + const char *psz_msg ) {} externC void cyg_tracemsg2( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ) {} externC void cyg_tracemsg4( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 ) {} externC void cyg_tracemsg6( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 ) @@ -110,7 +119,7 @@ cyg_tracemsg6( cyg_uint32 what, externC void cyg_tracemsg8( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, CYG_ADDRWORD arg5, diff --git a/packages/infra/current/src/pkgstart.cxx b/packages/infra/current/src/pkgstart.cxx --- a/packages/infra/current/src/pkgstart.cxx +++ b/packages/infra/current/src/pkgstart.cxx @@ -5,29 +5,38 @@ // General startup code for the target machine // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/infra/current/src/prestart.cxx b/packages/infra/current/src/prestart.cxx --- a/packages/infra/current/src/prestart.cxx +++ b/packages/infra/current/src/prestart.cxx @@ -5,29 +5,38 @@ // General startup code for the target machine // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/infra/current/src/simple.cxx b/packages/infra/current/src/simple.cxx --- a/packages/infra/current/src/simple.cxx +++ b/packages/infra/current/src/simple.cxx @@ -5,29 +5,38 @@ // Simple, non formatting trace and assert functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -177,7 +186,7 @@ cyg_tracenomsg( const char *psz_func, co externC void cyg_tracemsg( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg ) + const char *psz_msg ) { cyg_uint32 old_ints; @@ -204,7 +213,7 @@ cyg_tracemsg( cyg_uint32 what, externC void cyg_tracemsg2( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ) { cyg_uint32 old_ints; @@ -238,7 +247,7 @@ cyg_tracemsg2( cyg_uint32 what, externC void cyg_tracemsg4( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 ) { @@ -278,7 +287,7 @@ cyg_tracemsg4( cyg_uint32 what, externC void cyg_tracemsg6( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 ) @@ -323,7 +332,7 @@ cyg_tracemsg6( cyg_uint32 what, externC void cyg_tracemsg8( cyg_uint32 what, const char *psz_func, const char *psz_file, cyg_uint32 linenum, - char *psz_msg, + const char *psz_msg, CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, CYG_ADDRWORD arg5, diff --git a/packages/infra/current/src/startup.cxx b/packages/infra/current/src/startup.cxx --- a/packages/infra/current/src/startup.cxx +++ b/packages/infra/current/src/startup.cxx @@ -5,29 +5,38 @@ // General startup code for the target machine // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/infra/current/src/tcdiag.cxx b/packages/infra/current/src/tcdiag.cxx --- a/packages/infra/current/src/tcdiag.cxx +++ b/packages/infra/current/src/tcdiag.cxx @@ -5,29 +5,38 @@ // Infrastructure diag test harness. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -57,6 +66,124 @@ int cyg_test_is_simulator = 1; / int cyg_test_is_simulator = 0; // infrastructure changes as necessary #endif +//---------------------------------------------------------------------------- +// Functions ensuring we get pretty printed assertion messages in the +// farm - regardless of configuration and GDB capabilities. + +#ifdef CYGPKG_KERNEL +# include +# include // thread id to print +# include // ancillaries for above +#endif + +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +#include +#endif + +static inline const char *trim_file(const char *file) +{ + if ( NULL == file ) + file = ""; + + const char *f = file; + + while( *f ) f++; + + while( *f != '/' && f != file ) f--; + + return f==file?f:(f+1); +} + +static inline const char *trim_func(const char *func) +{ + static char fbuf[100]; + int i; + + if ( NULL == func ) + func = ""; + + for( i = 0; func[i] && func[i] != '(' ; i++ ) + fbuf[i] = func[i]; + + fbuf[i++] = '('; + fbuf[i++] = ')'; + fbuf[i ] = 0; + + return &fbuf[0]; +} + +static inline +void write_lnum( cyg_uint32 lnum) +{ + diag_write_char('['); + diag_write_dec(lnum); + diag_write_char(']'); +} + +static inline +void write_thread_id() +{ +#ifdef CYGPKG_KERNEL + Cyg_Thread *t = Cyg_Thread::self(); + cyg_uint16 tid = 0xFFFF; + + if( t != NULL ) tid = t->get_unique_id(); + + diag_write_char('<'); + diag_write_hex(tid); + diag_write_char('>'); +#endif +} + +// Called from the CYG_ASSERT_DOCALL macro +externC void +cyg_assert_msg( const char *psz_func, const char *psz_file, + cyg_uint32 linenum, const char *psz_msg ) __THROW +{ + cyg_uint32 old_ints; + + HAL_DISABLE_INTERRUPTS(old_ints); + DIAG_DEVICE_START_SYNC(); + +#ifdef CYG_HAL_DIAG_LOCK + CYG_HAL_DIAG_LOCK(); +#endif + +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + { + int cur_console; + int i; + cur_console = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + if ( CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "info_console_force", &i, + CYGNUM_FLASH_CFG_OP_CONFIG_BOOL ) ) + if ( i ) + if ( CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "info_console_number", &i, + CYGNUM_FLASH_CFG_OP_CONFIG_INT ) ) + // Then i is the console to force it to: + CYGACC_CALL_IF_SET_CONSOLE_COMM( i ); +#endif + diag_write_string("ASSERT FAIL: "); + write_thread_id(); + diag_write_string(trim_file(psz_file)); + write_lnum(linenum); + diag_write_string(trim_func(psz_func)); + diag_write_char(' '); + diag_write_string(psz_msg); + diag_write_char('\n'); + +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur_console); + } +#endif +#ifdef CYG_HAL_DIAG_UNLOCK + CYG_HAL_DIAG_UNLOCK(); +#endif + + DIAG_DEVICE_END_SYNC(); + HAL_RESTORE_INTERRUPTS(old_ints); +} externC void cyg_test_init(void) @@ -121,6 +248,11 @@ cyg_test_output(Cyg_test_code status, co externC void cyg_test_exit(void) { +// workaround SH dwarf2 gen problem +#if defined(CYGPKG_HAL_SH) && (__GNUC__ >= 3) + static volatile int i; + i++; +#endif #ifdef CYGHWR_TEST_PROGRAM_EXIT CYGHWR_TEST_PROGRAM_EXIT(); #endif diff --git a/packages/infra/current/src/userstart.cxx b/packages/infra/current/src/userstart.cxx --- a/packages/infra/current/src/userstart.cxx +++ b/packages/infra/current/src/userstart.cxx @@ -5,29 +5,38 @@ // General startup code for the target machine // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/common/current/ChangeLog b/packages/io/common/current/ChangeLog --- a/packages/io/common/current/ChangeLog +++ b/packages/io/common/current/ChangeLog @@ -1,3 +1,12 @@ +2002-03-12 Nick Garnett + + * doc/io.sgml: Generally sorted out, reformetted, folded. SMP + considerations added to various parts of the document. + +2002-01-23 Jonathan Larmour + + * include/config_keys.h: Add config keys for flash block drivers. + 2001-09-27 Jonathan Larmour * src/io_diag.c: Delete. No longer used. @@ -185,27 +194,36 @@ 1999-02-25 Gary Thomas +I/O Package (Device Drivers) + + + + +Introduction + + +The I/O package is designed as a general purpose framework for +supporting device drivers. This includes all classes of +drivers from simple serial to networking stacks and beyond. + + + +Components of the I/O package, such as device drivers, are +configured into the system just like all other components. +Additionally, end users may add their own drivers to this set. + + + +While the set of drivers (and the devices they represent) may be +considered static, they must be accessed via an opaque +“handle”. Each device in the system has a unique name and +the cyg_io_lookup() function is used to map that +name onto the handle for the device. This “hiding” of the +device implementation allows for generic, named devices, as well as +more flexibility. Also, the cyg_io_lookup() +function provides drivers the opportunity to initialize the device +when usage actually starts. + + + +All devices have a name. The standard provided devices use names such +as “/dev/console” and +“/dev/serial0”, where the +“/dev/” prefix indicates that this is +the name of a device. + + +The entire I/O package API, as well as the standard +set of provided drivers, is written in C. + +Basic functions are provided to send data to and receive data +from a device. The details of how this is done is left to the device [class] itself. +For example, writing data to a block device like a disk drive may +have different semantics than writing to a serial port. + +Additional functions are provided to manipulate the state +of the driver and/or the actual device. These functions +are, by design, quite specific to the actual driver. + +This driver model supports layering; in other words, a device +may actually be created “on top of” another device. +For example, the “tty” (terminal-like) devices are +built on top of simple serial devices. The upper layer then has +the flexibility to add features and functions not found at the lower +layers. In this case the “tty” device provides +for line buffering and editing not available from the simple serial +drivers. + + +Some drivers will support visibility of the layers they depend +upon. The “tty” driver allows information about +the actual serial device to be manipulated by passing get/set +config calls that use a serial driver “key” down +to the serial driver itself. + + + + + + + +<!-- <index></index> -->User API + + +All functions, except cyg_io_lookup() +require an I/O “handle”. + + + +All functions return a value of the type Cyg_ErrNo. If an +error condition is detected, this value will be negative and the +absolute value indicates the actual error, as specified in +cyg/error/codes.h. The only other legal return +value will be ENOERR. All other function arguments +are pointers (references). This allows the drivers to pass information +efficiently, both into and out of the driver. The most striking +example of this is the “length” value passed to the read +and write functions. This parameter contains the desired length of +data on input to the function and the actual transferred length on +return. + + + +// Lookup a device and return its handle + Cyg_ErrNo cyg_io_lookup( + const char *name, + cyg_io_handle_t *handle ) + + + +This function maps a device name onto an appropriate handle. If the +named device is not in the system, then the error +-ENOENT is returned. If the device is found, then +the handle for the device is returned by way of the handle pointer +*handle. + + + +// Write data to a device +Cyg_ErrNo cyg_io_write( + cyg_io_handle_t handle, + const void *buf, + cyg_uint32 *len ) + + + +This function sends data to a device. The size of data to send is +contained in *len and the actual size sent will +be returned in the same place. + + + +// Read data from a device +Cyg_ErrNo cyg_io_read( + cyg_io_handle_t handle, + void *buf, + cyg_uint32 *len ) + + + +This function receives data from a device. The desired size of data to +receive is contained in *len and the actual +size obtained will be returned in the same place. + + + +// Get the configuration of a device +Cyg_ErrNo cyg_io_get_config( + cyg_io_handle_t handle, + cyg_uint32 key, + void *buf, + cyg_uint32 *len ) + + + +This function is used to obtain run-time configuration about a +device. The type of information retrieved is specified by the +key. The data will be returned in the given +buffer. The value of *len should contain the +amount of data requested, which must be at least as large as the size +appropriate to the selected key. The actual size of data retrieved is +placed in *len. The appropriate key values +differ for each driver and are all listed in the file +<cyg/io/config_keys.h>. + + + +// Change the configuration of a device +Cyg_ErrNo cyg_io_set_config( + cyg_io_handle_t handle, + cyg_uint32 key, + const void *buf, + cyg_uint32 *len ) + + + +This function is used to manipulate or change the run-time +configuration of a device. The type of information is specified by the +key. The data will be obtained from the given +buffer. The value of *len should contain the +amount of data provided, which must match the size appropriate to the +selected key. The appropriate key values differ for each driver and +are all listed in the file +<cyg/io/config_keys.h>. + + + + + + + + +Serial driver details + + +Two different classes of serial drivers are provided as a standard +part of the eCos system. These are described as “raw +serial” (serial) and “tty-like” (tty). + + + + +
+Raw Serial Driver + + +Use the include file <cyg/io/serialio.h> for +this driver. + + + +The raw serial driver is capable of sending +and receiving blocks of raw data to a serial device. Controls are +provided to configure the actual hardware, but there is no manipulation +of the data by this driver. + + + +There may be many instances of this driver in a given system, +one for each serial channel. Each channel corresponds to a physical +device and there will typically be a device module created for this +purpose. The device modules themselves are configurable, allowing +specification of the actual hardware details, as well as such details +as whether the channel should be buffered by the serial driver, +etc. + + + + +
+Runtime Configuration + + +Runtime configuration is achieved by exchanging data structures with +the driver via the cyg_io_set_config() and +cyg_io_get_config() functions. + + + +typedef struct { + cyg_serial_baud_rate_t baud; + cyg_serial_stop_bits_t stop; + cyg_serial_parity_t parity; + cyg_serial_word_length_t word_length; + cyg_uint32 flags; +} cyg_serial_info_t; + + + +The field word_length contains the number of data bits per word +(character). This must be one of the values: + + + + CYGNUM_SERIAL_WORD_LENGTH_5 + CYGNUM_SERIAL_WORD_LENGTH_6 + CYGNUM_SERIAL_WORD_LENGTH_7 + CYGNUM_SERIAL_WORD_LENGTH_8 + + + +The field baud contains a baud rate selection. This must be +one of the values: + + + + CYGNUM_SERIAL_BAUD_50 + CYGNUM_SERIAL_BAUD_75 + CYGNUM_SERIAL_BAUD_110 + CYGNUM_SERIAL_BAUD_134_5 + CYGNUM_SERIAL_BAUD_150 + CYGNUM_SERIAL_BAUD_200 + CYGNUM_SERIAL_BAUD_300 + CYGNUM_SERIAL_BAUD_600 + CYGNUM_SERIAL_BAUD_1200 + CYGNUM_SERIAL_BAUD_1800 + CYGNUM_SERIAL_BAUD_2400 + CYGNUM_SERIAL_BAUD_3600 + CYGNUM_SERIAL_BAUD_4800 + CYGNUM_SERIAL_BAUD_7200 + CYGNUM_SERIAL_BAUD_9600 + CYGNUM_SERIAL_BAUD_14400 + CYGNUM_SERIAL_BAUD_19200 + CYGNUM_SERIAL_BAUD_38400 + CYGNUM_SERIAL_BAUD_57600 + CYGNUM_SERIAL_BAUD_115200 + CYGNUM_SERIAL_BAUD_234000 + + +The field stop contains the number of stop bits. This must be +one of the values: + + + CYGNUM_SERIAL_STOP_1 + CYGNUM_SERIAL_STOP_1_5 + CYGNUM_SERIAL_STOP_2 + + + +Note + +On most hardware, a selection of 1.5 stop bits is only valid +if the word (character) length is 5. + + + +The field parity contains the parity mode. This must be one of +the values: + + + CYGNUM_SERIAL_PARITY_NONE + CYGNUM_SERIAL_PARITY_EVEN + CYGNUM_SERIAL_PARITY_ODD + CYGNUM_SERIAL_PARITY_MARK + CYGNUM_SERIAL_PARITY_SPACE + + +The field flags is a bitmask which controls the behavior of the +serial device driver. It should be built from the values +CYG_SERIAL_FLAGS_xxx defined below: + + + +#define CYG_SERIAL_FLAGS_RTSCTS 0x0001 + + +If this bit is set then the port is placed in “hardware +handshake” mode. In this mode, the CTS and RTS pins control +when data is allowed to be sent/received at the port. This +bit is ignored if the hardware does not support this level of +handshake. + + + +typedef struct { + cyg_int32 rx_bufsize; + cyg_int32 rx_count; + cyg_int32 tx_bufsize; + cyg_int32 tx_count; +} cyg_serial_buf_info_t; + + +The field rx_bufsize contains +the total size of the incoming data buffer. This is set to zero on +devices that do not support buffering (i.e. polled devices). + +The field rx_count contains the +number of bytes currently occupied in the incoming data buffer. +This is set to zero on devices that do not support buffering (i.e. polled +devices). + +The field tx_bufsize contains the +total size of the transmit data buffer. This is set to zero on devices +that do not support buffering (i.e. polled devices). + +The field tx_count contains the +number of bytes currently occupied in the transmit data buffer. This +is set to zero on devices that do not support buffering (i.e. polled +devices). + +
+ + + + +
+<!-- <index></index> -->API Details + + + +
+cyg_io_write + + +cyg_io_write(handle, buf, len) + + + +Send the data from buf to the device. The +driver maintains a buffer to hold the data. The size of the +intermediate buffer is configurable within the interface module. The +data is not modified at all while it is being buffered. On return, +*len contains the amount of characters actually +consumed . + + +It is possible to configure the write call to be blocking +(default) or non-blocking. Non-blocking mode requires both the configuration +option CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING +to be enabled, and the specific device to be set to non-blocking +mode for writes (see cyg_io_set_config()). + + + +In blocking mode, the call will not return until there is space in the +buffer and the entire contents of buf have been +consumed. + + + +In non-blocking mode, as much as possible gets consumed from +buf. If everything was consumed, the call +returns ENOERR. If only part of the +buf contents was consumed, +-EAGAIN is returned and the caller must try +again. On return, *len contains the number of characters actually +consumed . + + +The call can also return -EINTR if interrupted +via the cyg_io_get_config()/ABORT key. + + +
+ + + + +
+cyg_io_read + + +cyg_io_read(handle, buf, len) + + + +Receive data into the buffer, buf, from the +device. No manipulation of the data is performed before being +transferred. An interrupt driven interface module will support data +arriving when no read is pending by buffering the data in the serial +driver. Again, this buffering is completely configurable. On return, +*len contains the number of characters actually +received. + + +It is possible to configure the read call to be blocking (default) +or non-blocking. Non-blocking mode requires both the configuration +option CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING +to be enabled, and the specific device to be set to non-blocking +mode for reads (see cyg_io_set_config()). + + + +In blocking mode, the call will not return until the requested +amount of data has been read. + + +In non-blocking mode, data waiting in the device buffer is copied to +buf, and the call returns immediately. If there +was enough data in the buffer to fulfill the request, +ENOERR is returned. If only part of the request +could be fulfilled, -EAGAIN is returned and the +caller must try again. On return, *len contains +the number of characters actually received. + + +The call can also return -EINTR if interrupted via +the cyg_io_get_config()/ABORT +key. + + +
+ + + + +
+cyg_io_get_config + + +cyg_io_get_config(handle, key, buf, len) + + +This function returns current [runtime] information +about the device and/or driver. + + + + CYG_IO_GET_CONFIG_SERIAL_INFO + + + + Buf type: + + cyg_serial_info_t + + + + Function: + + + This function retrieves the current state of the driver + and hardware. This information contains fields for + hardware baud rate, number of stop bits, and parity + mode. It also includes a set of flags that control the + port, such as hardware flow control. + + + + + + + + + CYG_IO_GET_CONFIG_SERIAL_BUFFER_INFO + + + + Buf type: + + cyg_serial_buf_info_t + + + + Function: + + + This function retrieves the current state of the + software buffers in the serial drivers. For both + receive and transmit buffers it returns the total + buffer size and the current number of bytes occupied in + the buffer. It does not take into account any buffering + such as FIFOs or holding registers that the serial + device itself may have. + + + + + + + + + CYG_IO_GET_CONFIG_SERIAL_OUTPUT_DRAIN + + + + Buf type: + + void * + + + + Function: + + + This function waits for any buffered output to + complete. This function only completes when there is no + more data remaining to be sent to the device. + + + + + + + + + CYG_IO_GET_CONFIG_SERIAL_OUTPUT_FLUSH + + + + Buf type: + + void * + + + + Function: + + + This function discards any buffered output for the + device. + + + + + + + + + CYG_IO_GET_CONFIG_SERIAL_INPUT_DRAIN + + + + Buf type: + + void * + + + + Function: + + This function discards any buffered input for the + device. + + + + + + + + CYG_IO_GET_CONFIG_SERIAL_ABORT + + + + Buf type: + + void* + + + + Function: + + This function will cause any pending read or write calls on + this device to return with -EABORT. + + + + + + + + CYG_IO_GET_CONFIG_SERIAL_READ_BLOCKING + + + + Buf type: + + cyg_uint32 (values 0 or 1) + + + + Function: + + This function will read back the blocking-mode + setting for read calls on this device. This call is only + available if the configuration option + CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING is + enabled. + + + + + + + + CYG_IO_GET_CONFIG_SERIAL_WRITE_BLOCKING + + + + Buf type: + + cyg_uint32 (values 0 or 1) + + + + Function: + + + This function will read back the blocking-mode + setting for write calls on this device. This call is only + available if the configuration option + CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING is enabled. + + + + + + + +
+ + + + +
+cyg_io_set_config + + +cyg_io_set_config(handle, key, buf,len) + + +This function is used to update or change runtime configuration +of a port. + + + + CYG_IO_SET_CONFIG_SERIAL_INFO + + + + Buf type: + + cyg_serial_info_t + + + + Function: + + This function updates the information for the driver + and hardware. The information contains fields for + hardware baud rate, number of stop bits, and parity + mode. It also includes a set of flags that control the + port, such as hardware flow control. + + + + + + + + + CYG_IO_SET_CONFIG_SERIAL_READ_BLOCKING + + + + Buf type: + + cyg_uint32 (values 0 or 1) + + + + Function: + + This function will set the blocking-mode for read + calls on this device. This call is only available if the + configuration option CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING + is enabled. + + + + + + + + + CYG_IO_SET_CONFIG_SERIAL_WRITE_BLOCKING + + + + Buf type: + + cyg_uint32 (values 0 or 1) + + + + Function: + + This function will set the blocking-mode for write + calls on this device. This call is only available if the + configuration option CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING + is enabled. + + + + + + + + +
+ + + +
+ + + +
+ + + + +
+ TTY driver + + +Use the include file <cyg/io/ttyio.h> for +this driver. + + + +This driver is built on top of the simple +serial driver and is typically used for a device that interfaces with +humans such as a terminal. It provides some minimal formatting of data +on output and allows for line-oriented editing on input. + + + + +
+Runtime configuration + + +Runtime configuration is achieved by exchanging data structures with +the driver via the cyg_io_set_config() and +cyg_io_get_config() functions. + + + + +typedef struct { + cyg_uint32 tty_out_flags; + cyg_uint32 tty_in_flags; +} cyg_tty_info_t; + + +The field tty_out_flags +is used to control what happens to data as it is send to the serial +port. It contains a bitmap comprised of the bits as defined by the +CYG_TTY_OUT_FLAGS_xxx values below. + + +#define CYG_TTY_OUT_FLAGS_CRLF 0x0001 // Map '\n' => '\n\r' on output + + +If this bit is set in tty_out_flags, +any occurrence of the character "\n" will +be replaced by the sequence "\n\r" before +being sent to the device. + +The field tty_in_flags +is used to control how data is handled as it comes from the serial +port. It contains a bitmap comprised of the bits as defined by the +CYG_TTY_IN_FLAGS_xxx values below. + + +#define CYG_TTY_IN_FLAGS_CR 0x0001 // Map '\r' => '\n' on input + + +If this bit is set in tty_in_flags, the +character "\r" (“return” or “enter” on +most keyboards) will be mapped to "\n". + + +#define CYG_TTY_IN_FLAGS_CRLF 0x0002 // Map '\n\r' => '\n' on input + + + +If this bit is set in tty_in_flags, the +character sequence "\n\r" (often sent by DOS/Windows +based terminals) will be mapped to "\n". + + +#define CYG_TTY_IN_FLAGS_BINARY 0x0004 // No input processing + + +If this bit is set in tty_in_flags, the +input will not be manipulated in any way before being placed in +the user’s buffer. + + +#define CYG_TTY_IN_FLAGS_ECHO 0x0008 // Echo characters as processed + + + +If this bit is set in tty_in_flags, characters +will be echoed back to the serial port as they are processed. + +
+ + + + +
+<!-- <index></index> -->API details + + +cyg_io_read(handle, buf, len) + + +This function is used to read data from the device. In the +default case, data is read until an end-of-line character ("\n" +or "\r") is read. Additionally, the characters are echoed +back to the [terminal] device. Minimal editing +of the input is also supported. + + +When connecting to a remote target via GDB it is not possible +to provide console input while GDB is connected. The GDB remote +protocol does not support input. Users must disconnect from GDB +if this functionality is required. + + + +cyg_io_write(handle, buf, len) + + +This function is used to send data to the device. In the default +case, the end-of-line character "\n" is replaced by the +sequence "\n\r". + + +cyg_io_get_config(handle, key, buf, len) + + +This function is used to get information about the channel’s +configuration at runtime. + + + + CYG_IO_GET_CONFIG_TTY_INFO + + + + Buf type: + + cyg_tty_info_t + + + + Function: + + This function retrieves the current state of the + driver. + + + + + + + + +Serial driver keys (see above) may also be specified +in which case the call is passed directly to the serial +driver. + + +cyg_io_set_config(handle, key, buf, len) + + +This function is used to modify the channel’s configuration +at runtime. + + + + + CYG_IO_SET_CONFIG_TTY_INFO + + + + Buf type: + + cyg_tty_info_t + + + + Function: + + This function changes the current state of the + driver. + + + + + + + +Serial driver +keys (see above) may also be specified in which case the +call is passed directly to the serial driver. + +
+ + + +
+ + + + + + + +
+ + + + + +How to Write a Driver + + + + +A device driver is nothing more than a +named entity that supports the basic I/O functions - read, write, get +config, and set config. Typically a device driver also uses and +manages interrupts from the device. While the interface is generic and +device driver independent, the actual driver implementation is +completely up to the device driver designer. + +That said, the reason for using a device driver is to provide +access to a device from application code in as general purpose a +fashion as reasonable. Most driver writers are also concerned with +making this access as simple as possible while being as efficient +as possible. + +Most device drivers are concerned with the movement of information, +for example data bytes along a serial interface, or packets in a +network. In order to make the most efficient use of system resources, +interrupts are used. This will allow other application processing +to take place while the data transfers are under way, with interrupts +used to indicate when various events have occurred. For example, +a serial port typically generates an interrupt after a character +has been sent “down the wire” and the interface +is ready for another. It makes sense to allow further application +processing while the data is being sent since this can take quite +a long time. The interrupt can be used to allow the driver to send +a character as soon as the current one is complete, without any +active participation by the application code. + +The main building blocks for device drivers are found in the +include file: <cyg/io/devtab.h> + +All device drivers in eCos are described +by a device table entry, using the cyg_devtab_entry_t type. +The entry should be created using the DEVTAB_ENTRY() macro, +like this: + + +DEVTAB_ENTRY(l, name, dep_name, handlers, init, lookup, priv) + + + +Arguments + + l + The "C" label for this device table entry. + + + name + The "C" string name for the device. + + + dep_name + For a layered device, the "C" string name of the + device this device is built upon. + + + handlers + A pointer to the I/O function "handlers" (see below). + + + init + A function called when eCos is initialized. This + function can query the device, setup hardware, etc. + + + lookup + A function called when cyg_io_lookup() is called + for this device. + + + priv + A placeholder for any device specific data + required by the driver. + + + +The interface to the driver is through the handlers field. This is a pointer to +a set of functions which implement the various cyg_io_XXX() +routines. This table is defined by the macro: + + + +DEVIO_TABLE(l, write, read, get_config, set_config) + + + +Arguments + + l + The "C" label for this table of handlers. + + + write + The function called as a result of + cyg_io_write(). + + + read + The function called as a result of + cyg_io_read(). + + + get_config + The function called as a result of + cyg_io_get_config(). + + + set_config + The function called as a result of + cyg_io_set_config(). + + + + +When eCos is initialized (sometimes called +“boot” time), the init() function is called +for all devices in the system. The init() function is +allowed to return an error in which case the device will be placed +“off line” and all I/O requests to that device will be +considered in error. + + + +The lookup() function is called whenever +the cyg_io_lookup() function +is called with this device name. The lookup function may cause the device +to come “on line” which would then allow I/O +operations to proceed. Future versions of the I/O system +will allow for other states, including power saving modes, +etc. + + + + + +
+How to Write a Serial Hardware Interface Driver + + +The standard serial driver supplied with +eCos is structured as a hardware independent +portion and a hardware dependent interface module. To add support for +a new serial port, the user should be able to use the existing +hardware independent portion and just add their own interface driver which handles the details of the +actual device. The user should have no need to change the hardware +independent portion. + +The interfaces used by the serial driver and serial implementation +modules are contained in the file <cyg/io/serial.h> + + + +In the sections below we use the notation <<xx>> to +mean a module specific value, referred to as “xx” below. + + + + +
+DevTab Entry + +The interface module contains the devtab entry (or entries +if a single module supports more than one interface). This entry +should have the form: + + +DEVTAB_ENTRY(<<module_name>>, + <<device_name>>, + 0, + &serial_devio, + <<module_init>>, + <<module_lookup>>, + &<<serial_channel>> + ); + + + +Arguments + + module_name + The "C" label for this devtab entry + + + device_name + The "C" string for the + device. E.g. /dev/serial0. + + + serial_devio + The table of I/O functions. This set is defined in + the hardware independent serial driver and should be used. + + + + module_init + The module initialization function. + + + module_lookup + The device lookup function. This function + typically sets up the device for actual use, turning on + interrupts, configuring the port, etc. + + + serial_channel + This table (defined below) contains the interface + between the interface module and the serial driver proper. + + + +
+ + + + +
+Serial Channel Structure + +Each serial device must have a “serial channel”. +This is a set of data which describes all operations on the device. +It also contains buffers, etc., if the device is to be buffered. +The serial channel is created by the macro: + + +SERIAL_CHANNEL_USING_INTERRUPTS(l, funs, dev_priv, baud,stop, parity, word_length, + flags, out_buf, out_buflen, in_buf, in_buflen) + + + + Arguments + + l + The "C" label for this structure. + + + funs + The set of interface functions (see below). + + + dev_priv + A placeholder for any device specific data for + this channel. + + + baud + The initial baud rate value + (cyg_serial_baud_t). + + + stop + The initial stop bits value + (cyg_serial_stop_bits_t). + + + parity + The initial parity mode value + (cyg_serial_parity_t). + + + word_length + The initial word length value + (cyg_serial_word_length_t). + + + flags + The initial driver flags value. + + + out_buf + Pointer to the output + buffer. NULL if none required. + + + out_buflen + The length of the output buffer. + + + in_buf + pointer to the input + buffer. NULL if none required. + + + in_buflen + The length of the input buffer. + + + + +If either buffer length is zero, no buffering will take place +in that direction and only polled mode functions will be used. + + + +The interface from the hardware independent driver into the +hardware interface module is contained in the funs table. +This is defined by the macro: + + +
+ + + + +
+Serial Functions Structure + + +SERIAL_FUNS(l, putc, getc, set_config, start_xmit, stop_xmit) + + + + + Arguments + + l + The "C" label for this structure. + + + putc + + bool (*putc)(serial_channel *priv, unsigned char + c) + + This function sends one character to the interface. It should + return true if the character is actually consumed. It should + return false if there is no space in the interface + + + + + getc + + unsigned char (*getc)(serial_channel *priv) + + This function fetches one character from the interface. It will + be only called in a non-interrupt driven mode, thus it should + wait for a character by polling the device until ready. + + + + + set_config + + bool (*set_config)(serial_channel + *priv,cyg_serial_info_t *config) + + This function is used to configure the port. It should return + true if the hardware is updated to match the desired + configuration. It should return false if the port cannot + support some parameter specified by the given + configuration. E.g. selecting 1.5 stop bits and 8 data bits is + invalid for most serial devices and should not be allowed. + + + + + start_xmit + void (*start_xmit)(serial_channel *priv) + + In interrupt mode, turn on the transmitter and allow for + transmit interrupts. + + + + + stop_xmit + + void (*stop_xmit)(serial_channel *priv) + In interrupt mode, turn off the transmitter. + + + + +
+ + + + +
+Callbacks + + +The device interface module can execute functions in the +hardware independent driver via chan->callbacks. +These functions are available: + + + +void (*serial_init)( serial_channel *chan ) + + +This function is used to initialize the serial channel. It +is only required if the channel is being used in interrupt +mode. + + +void (*xmt_char)( serial_channel *chan ) + + + +This function would be called from an interrupt handler after a +transmit interrupt indicating that additional characters may be +sent. The upper driver will call the putc +function as appropriate to send more data to the device. + + +void (*rcv_char)( serial_channel *chan, unsigned char c ) + + + + +This function is used to tell the driver that a character has arrived +at the interface. This function is typically called from the interrupt +handler. + + +Furthermore, if the device has a FIFO it should require the hardware +independent driver to provide block transfer functionality (driver CDL +should include "implements +CYGINT_IO_SERIAL_BLOCK_TRANSFER"). In that case, the following +functions are available as well: + + +bool (*data_xmt_req)(serial_channel *chan, + int space, + int* chars_avail, + unsigned char** chars) +void (*data_xmt_done)(serial_channel *chan) + + + +Instead of calling xmt_char() to get a single +character for transmission at a time, the driver should call +data_xmt_req() in a loop, requesting character +blocks for transfer. Call with a space argument of how much space +there is available in the FIFO. + +If the call returns true, the driver can read +chars_avail characters from +chars and copy them into the FIFO. + +If the call returns false, there are +no more buffered characters and the driver should continue without +filling up the FIFO. + +When all data has been unloaded, the +driver must call data_xmt_done(). + + + +bool (*data_rcv_req)(serial_channel *chan, + int avail, + int* space_avail, + unsigned char** space) +void (*data_rcv_done)(serial_channel *chan) + + +Instead of calling rcv_char() with a single +character at a time, the driver should call +data_rcv_req() in a loop, requesting space to +unload the FIFO to. avail is the number of +characters the driver wishes to unload. + + +If the call returns true, the driver can copy +space_avail characters to +space. + + +If the call returns false, the input buffer is +full. It is up to the driver to decide what to do in that case +(callback functions for registering overflow are being planned for +later versions of the serial driver). + + +When all data has been unloaded, the driver must call +data_rcv_done(). + +
+ + + +
+ + + + +
+Serial testing with ser_filter + + + +
+Rationale + + +Since some targets only have one serial connection, a serial testing harness +needs to be able to share the connection with GDB +(however, the test and GDB can also run on separate +lines). + + + +The serial filter (ser_filter) +sits between the serial port and GDB and monitors +the exchange of data between GDB and the target. +Normally, no changes are made to the data. + + + +When a test request packet is sent from the test on the target, it is +intercepted by the filter. + + + +The filter and target then enter a loop, exchanging protocol data between +them which GDB never sees. + + + +In the event of a timeout, or a crash on the target, the filter falls +back into its pass-through mode. If this happens due to a crash it should be +possible to start regular debugging with GDB. The +filter will stay in the pass-though mode until GDB +disconnects. + +
+ + + + +
+The Protocol + +The protocol commands are prefixed with an "@" +character which the serial filter is looking for. The protocol +commands include: + + + + + PING + + Allows the test on the target to probe for the filter. The + filter responds with OK, while + GDB would just ignore the + command. This allows the tests to do nothing if they require the + filter and it is not present. + + + + CONFIG + + Requests a change of serial line configuration. Arguments + to the command specify baud rate, data bits, stop bits, and + parity. [This command is not fully implemented yet - there is no + attempt made to recover if the new configuration turns out to + cause loss of data.] + + + + BINARY + + Requests data to be sent from the filter to the + target. The data is checksummed, allowing errors in the transfer + to be detected. Sub-options of this command control how the + data transfer is made: + + + NO_ECHO + + (serial driver receive test) Just send data from the + filter to the target. The test verifies the checksum and + PASS/FAIL depending on the result. + + + + EOP_ECHO + + (serial driver half-duplex receive and send test) As + NO_ECHO but the test echoes back the + data to the filter. The filter does a checksum on the + received data and sends the result to the target. The test + PASS/FAIL depending on the result of both checksum + verifications. + + + + DUPLEX_ECHO + + (serial driver duplex receive and send test) Smaller + packets of data are sent back and forth in a pattern that + ensures that the serial driver will be both sending and + receiving at the same time. Again, checksums are computed + and verified resulting in PASS/FAIL. + + + + + + + + TEXT + + This is a test of the text translations in the TTY layer. + Requests a transfer of text data from the target to the filter + and possibly back again. The filter treats this as a binary + transfer, while the target ma be doing translations on the + data. The target provides the filter with checksums for what it + should expect to see. This test is not implemented yet. + + + + + +The above commands may be extended, and new commands added, as +required to test (new) parts of the serial drivers in +eCos. + + +
+ + + + +
+The Serial Tests + + +The serial tests are built as any other eCos test. After running the +make tests command, the tests can be found in +install/tests/io_serial/ + + + + serial1 + A simple API test. + + + serial2 + + A simple serial send test. It writes out two strings, one + raw and one encoded as a GDB + O-packet + + + + serial3 [ requires the serial filter ] + + This tests the half-duplex send and receive capabilities + of the serial driver. + + + + serial4 [ requires the serial filter ] + + This test attempts to use a few different serial + configurations, testing the driver's configuration/setup + functionality. + + + + serial5 [ requires the serial filter ] + + This tests the duplex send and receive capabilities of the + serial driver. + + + + +All tests should complete in less than 30 seconds. + +
+ + + + +
+Serial Filter Usage + +Running the ser_filter program with no (or wrong) arguments results in +the following output: + + + +Usage: ser_filter [-t -S] TcpIPport SerialPort BaudRate +or: ser_filter -n [-t -S] SerialPort BaudRate +-t: Enable tracing. +-S: Output data read from serial line. +-c: Output data on console instead of via GDB. +-n: No GDB. + + +The normal way to use it with GDB is to start the filter: + + +$ ser_filter -t 9000 com1 38400 + + + +In this case, the filter will be listening on port 9000 and connect to the +target via the serial port COM1 at 38400 baud. On a UNIX +host, replace "COM1" with a device such as +"/dev/ttyS0". + + + +The option enables tracing which will cause the +filter to describe its actions on the console. + + +Now start GDB with one of the tests as an +argument: + + + +$ mips-tx39-elf-gdb -nw install/tests/io_serial/serial3 + + +Then connect to the filter: + + +(gdb) target remote localhost:9000 + + + +This should result in a connection in exactly the same way as if you +had connected directly to the target on the serial line. + + + +(gdb) c + + + +Which should result in output similar to the below: + + + +Continuing. +INFO: <BINARY:16:1!> +PASS: <Binary test completed> +INFO: <BINARY:128:1!> +PASS: <Binary test completed> +INFO: <BINARY:256:1!> +PASS: <Binary test completed> +INFO: <BINARY:1024:1!> +PASS: <Binary test completed> +INFO: <BINARY:512:0!> +PASS: <Binary test completed> +... +PASS: <Binary test completed> +INFO: <BINARY:16384:0!> +PASS: <Binary test completed> +PASS: <serial13 test OK> +EXIT: <done> + + + +If any of the individual tests fail the testing will terminate with a +FAIL. + + + +With tracing enabled, you would also see the filter's status output: + + + +The PING command sent from the target to determine the +presence of the filter: + + + +[400 11:35:16] Dispatching command PING +[400 11:35:16] Responding with status OK + + +Each of the binary commands result in output similar to: + + +[400 11:35:16] Dispatching command BINARY +[400 11:35:16] Binary data (Size:16, Flags:1). +[400 11:35:16] Sending CRC: '170231!', len: 7. +[400 11:35:16] Reading 16 bytes from target. +[400 11:35:16] Done. in_crc 170231, out_crc 170231. +[400 11:35:16] Responding with status OK +[400 11:35:16] Received DONE from target. + + + +This tracing output is normally sent as O-packets to GDB + which will display the tracing text. By using the + option, the tracing text can be redirected to the +console from which ser_filter was started. + + +
+ + + + +
+A Note on Failures + + +A serial connection (especially when driven at a high baud rate) can garble the +transmitted data because of noise from the environment. It is not the job of +the serial driver to ensure data integrity - that is the job of protocols +layering on top of the serial driver. + +In the current implementation the serial tests and the serial filter are +not resilient to such data errors. This means that the test may crash or hang +(possibly without reporting a FAIL). It also +means that you should be aware of random errors - a FAIL + is not necessarily caused by a bug in the serial driver. + + +Ideally, the serial testing infrastructure should be able to distinguish +random errors from consistent errors - the former are most likely due to noise +in the transfer medium, while the latter are more likely to be caused by faulty +drivers. The current implementation of the infrastructure does not have this +capability. + +
+ + + + +
+Debugging + +If a test fails, the serial filter's output may provide some hints about +what the problem is. If the option is used when starting +the filter, data received from the target is printed out: + + + +[400 11:35:16] 0000 50 41 53 53 3a 3c 42 69 'PASS:<Bi' +[400 11:35:16] 0008 6e 61 72 79 20 74 65 73 'nary.tes' +[400 11:35:16] 0010 74 20 63 6f 6d 70 6c 65 't.comple' +[400 11:35:16] 0018 74 65 64 3e 0d 0a 49 4e 'ted>..IN' +[400 11:35:16] 0020 46 4f 3a 3c 42 49 4e 41 'FO:<BINA' +[400 11:35:16] 0028 52 59 3a 31 32 38 3a 31 'RY:128:1' +[400 11:35:16] 0030 21 3e 0d 0a 40 42 49 4e '!..@BIN' +[400 11:35:16] 0038 41 52 59 3a 31 32 38 3a 'ARY:128:' +[400 11:35:16] 0040 31 21 .. .. .. .. .. .. '1!' + + +In the case of an error during a testing command the data received by the +filter will be printed out, as will the data that was expected. This allows +the two data sets to be compared which may give some idea of what the problem +is. + +
+ + + +
+ + + +
+ + + + + +Device Driver Interface to the Kernel + + +This chapter describes the API that device drivers may use +to interact with the kernel and HAL. It is primarily concerned with +the control and management of interrupts and the synchronization of +ISRs, DSRs and threads. + + + +The same API will be present in configurations where the kernel +is not present. In this case the functions will be supplied by code +acting directly on the HAL. + + + + + +
+Interrupt Model + + +eCos presents a three level interrupt model to +device drivers. This consists of Interrupt Service Routines (ISRs) that are invoked +in response to a hardware interrupt; Deferred +Service Routines (DSRs) that are invoked in response to a request by +an ISR; and threads that are the clients of the driver. + + +Hardware interrupts are delivered with minimal intervention to an +ISR. The HAL decodes the hardware source of the interrupt and calls +the ISR of the attached interrupt object. This ISR may manipulate the +hardware but is only allowed to make a restricted set of calls on the +driver API. When it returns, an ISR may request that its DSR should be +scheduled to run. + + + +A DSR will be run when it is safe to do so without interfering with +the scheduler. Most of the time the DSR will run immediately after the +ISR, but if the current thread is in the scheduler, it will be delayed +until the thread is finished. A DSR is allowed to make a larger set of +driver API calls, including, in particular, being able to call +cyg_drv_cond_signal() to wake up waiting +threads. + + + +Finally, threads are able to make all API calls and in particular are +allowed to wait on mutexes and condition variables. + + + +For a device driver to receive interrupts it must first define ISR and +DSR routines as shown below, and then call +cyg_drv_interrupt_create(). Using the handle +returned, the driver must then call +cyg_drv_interrupt_attach() to actually attach the +interrupt to the hardware vector. + + + +
+ + + + +
+<!-- <index></index> -->Synchronization + +There are three levels of synchronization supported: + + + + + Synchronization with ISRs. This normally means disabling + interrupts to prevent the ISR running during a critical + section. In an SMP environment, this will also require the use of + a spinlock to synchronize with ISRs, DSRs or threads running on + other CPUs. This is implemented by the + cyg_drv_isr_lock() and + cyg_drv_isr_unlock() functions. This + mechanism should be used sparingly and for short periods only. + For finer grained synchronization, individual spinlocks are also + supplied. + + + + + + Synchronization with DSRs. This will be implemented in the kernel + by taking the scheduler lock to prevent DSRs running during + critical sections. In non-kernel configurations it will be + implemented by non-kernel code. This is implemented by the + cyg_drv_dsr_lock() and + cyg_drv_dsr_unlock() functions. As with ISR + synchronization, this mechanism should be used sparingly. Only + DSRs and threads may use this synchronization mechanism, ISRs are + not allowed to do this. + + + + + Synchronization with threads. This is implemented with mutexes + and condition variables. Only threads may lock the mutexes and + wait on the condition variables, although DSRs may signal + condition variables. + + + + + +Any data that is accessed from more than one level must be protected +against concurrent access. Data that is accessed by ISRs must be +protected with the ISR lock, or a spinlock at all times, +even in ISRs. Data that is shared between DSRs +and threads should be protected with the DSR lock. Data that is only +accessed by threads must be protected with mutexes. + + +
+ + + + +
+<!-- <index></index> -->SMP Support + + +Some eCos targets contain support for Symmetric Multi-Processing (SMP) +configurations, where more than one CPU may be present. This option +has a number of ramifications for the way in which device drivers must +be written if they are to be SMP-compatible. + + + +Since it is possible for the ISR, DSR and thread components of a +device driver to execute on different CPUs, it is important that +SMP-compatible device drivers use the driver API routines correctly. + + + +Synchronization between threads and DSRs continues to require that the +thread-side code use cyg_drv_dsr_lock() and +cyg_drv_dsr_unlock() to protect access to shared +data. While it is not strictly necessary for DSR code to claim the DSR +lock, since DSRs are run with it claimed already, it is good practice +to do so. + + + +Synchronization between ISRs and DSRs or threads requires that access +to sensitive data be protected, in all places, by calls to +cyg_drv_isr_lock() and +cyg_drv_isr_unlock(). Disabling or masking +interrupts is not adequate, since the thread or DSR may be running on +a different CPU and interrupt enable/disable only work on the current +CPU. + + + +The ISR lock, for SMP systems, not only disables local interrupts, but +also acquires a spinlock to protect against concurrent access from +other CPUs. This is necessary because ISRs are not run with the +scheduler lock claimed. Hence they can run in parallel with the other +components of the device driver. + + + +The ISR lock provided by the driver API is just a shared spinlock that +is available for use by all drivers. If a driver needs to implement a +finer grain of locking, it can use private spinlocks, accessed via the +cyg_drv_spinlock_*() functions. + + +
+ + + + +
+Device Driver Models + + +There are several ways in which device drivers +may be built. The exact model chosen will depend on the properties of +the device and the behavior desired. There are three basic models that +may be adopted. + + + +The first model is to do all device processing in the ISR. When it is +invoked the ISR programs the device hardware directly and accesses +data to be transferred directly in memory. The ISR should also call +cyg_drv_interrupt_acknowledge(). When it is +finished it may optionally request that its DSR be invoked. The DSR +does nothing but call cyg_drv_cond_signal() to +cause a thread to be woken up. Thread level code must call +cyg_drv_isr_lock(), or +cyg_drv_interrupt_mask() to prevent ISRs running +while it manipulates shared memory. + + + +The second model is to defer device processing to the DSR. The ISR +simply prevents further delivery of interrupts by either programming +the device, or by calling +cyg_drv_interrupt_mask(). It must then call +cyg_drv_interrupt_acknowledge() to allow other +interrupts to be delivered and then request that its DSR be +called. When the DSR runs it does the majority of the device handling, +optionally signals a condition variable to wake a thread, and finishes +by calling cyg_drv_interrupt_unmask() to re-allow +device interrupts. Thread level code uses +cyg_drv_dsr_lock() to prevent DSRs running while +it manipulates shared memory. The eCos serial device drivers use this +approach. + + + +The third model is to defer device processing even further to a +thread. The ISR behaves exactly as in the previous model and simply +blocks and acknowledges the interrupt before request that the DSR +run. The DSR itself only calls +cyg_drv_cond_signal() to wake the thread. When +the thread awakens it performs all device processing, and has full +access to all kernel facilities while it does so. It should finish by +calling cyg_drv_interrupt_unmask() to re-allow +device interrupts. The eCos ethernet device drivers are written to +this model. + + + +The first model is good for devices that need immediate processing and +interact infrequently with thread level. The second model trades a +little latency in dealing with the device for a less intrusive +synchronization mechanism. The last model allows device processing to +be scheduled with other threads and permits more complex device +handling. + + +
+ + + + +
+Synchronization Levels + + +Since it would be dangerous for an ISR or DSR to make a call +that might reschedule the current thread (by trying to lock a mutex +for example) all functions in this API have an associated synchronization +level. These levels are: + + + + + Thread + + + This function may only be called from within threads. This is + usually the client code that makes calls into the device driver. + In a non-kernel configuration, this will be code running at the + default non-interrupt level. + + + + + + DSR + + + This function may be called by either DSR or thread code. + + + + + + ISR + + + This function may be called from ISR, DSR or thread code. + + + + + + +The following table shows, for each API function, the levels +at which is may be called: + + + + Callable from: +Function ISR DSR Thread +------------------------------------------------------------------------- + +cyg_drv_isr_lock X X X +cyg_drv_isr_unlock X X X +cyg_drv_spinlock_init X +cyg_drv_spinlock_destroy X +cyg_drv_spinlock_spin X X X +cyg_drv_spinlock_clear X X X +cyg_drv_spinlock_try X X X +cyg_drv_spinlock_test X X X +cyg_drv_spinlock_spin_intsave X X X +cyg_drv_spinlock_clear_intsave X X X +cyg_drv_dsr_lock X X +cyg_drv_dsr_unlock X X +cyg_drv_mutex_init X +cyg_drv_mutex_destroy X +cyg_drv_mutex_lock X +cyg_drv_mutex_trylock X +cyg_drv_mutex_unlock X +cyg_drv_mutex_release X +cyg_drv_cond_init X +cyg_drv_cond_destroy X +cyg_drv_cond_wait X +cyg_drv_cond_signal X X +cyg_drv_cond_broadcast X X +cyg_drv_interrupt_create X +cyg_drv_interrupt_delete X +cyg_drv_interrupt_attach X X X +cyg_drv_interrupt_detach X X X +cyg_drv_interrupt_mask X X X +cyg_drv_interrupt_unmask X X X +cyg_drv_interrupt_acknowledge X X X +cyg_drv_interrupt_configure X X X +cyg_drv_interrupt_level X X X +cyg_drv_interrupt_set_cpu X X X +cyg_drv_interrupt_get_cpu X X X + + +
+ + + + +
+The API + + +This section details the Driver Kernel +Interface. Note that most of these functions are identical to Kernel C +API calls, and will in most configurations be wrappers for them. In +non-kernel configurations they will be supported directly by the HAL, +or by code to emulate the required behavior. + + +This API is defined in the header file +<cyg/hal/drv_api.h>. + + + + +
+<!-- <index></index> -->cyg_drv_isr_lock + + + + Function: + + void cyg_drv_isr_lock() + + + + Arguments: + + None + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + + Disables delivery of interrupts, preventing all ISRs running. This + function maintains a counter of the number of times it is + called. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_isr_unlock + + + + Function: + + void cyg_drv_isr_unlock() + + + + Arguments: + + None + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + Re-enables delivery of interrupts, allowing ISRs to + run. This function decrements the counter maintained by + cyg_drv_isr_lock(), and only re-allows + interrupts when it goes to zero. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_spinlock_init + + + + Function: + + +void cyg_drv_spinlock_init(cyg_spinlock_t *lock, cyg_bool_t locked ) + + + + + Arguments: + + lock - pointer to spinlock to initialize + locked - initial state of lock + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + + Initialize a spinlock. The locked + argument indicates how the spinlock should be initialized: + TRUE for locked or FALSE + for unlocked state. + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_spinlock_destroy + + + + Function: + + void cyg_drv_spinlock_destroy(cyg_spinlock_t *lock ) + + + + Arguments: + + lock - pointer to spinlock destroy + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + + Destroy a spinlock that is no longer of use. There should be no + CPUs attempting to claim the lock at the time this function is + called, otherwise the behavior is undefined. + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_spinlock_spin + + + + Function: + + void cyg_drv_spinlock_spin(cyg_spinlock_t *lock ) + + + + Arguments: + + lock - pointer to spinlock to claim + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + + Claim a spinlock, waiting in a busy loop until it is + available. Wherever this is called from, this operation + effectively pauses the CPU until it succeeds. This operations + should therefore be used sparingly, and in situations where + deadlocks/livelocks cannot occur. Also see + cyg_drv_spinlock_spin_intsave(). + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_spinlock_clear + + + + Function: + + void cyg_drv_spinlock_clear(cyg_spinlock_t *lock ) + + + + Arguments: + + lock - pointer to spinlock to clear + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + + Clear a spinlock. This clears the spinlock and allows another + CPU to claim it. If there is more than one CPU waiting in + cyg_drv_spinlock_spin() then just one of + them will be allowed to proceed. + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_spinlock_try + + + + Function: + + cyg_bool_t cyg_drv_spinlock_try(cyg_spinlock_t *lock ) + + + + Arguments: + + lock - pointer to spinlock to try + + + + Result: + + TRUE if the spinlock was claimed, + FALSE otherwise. + + + + Level: + + ISR + + + + Description: + + + Try to claim the spinlock without waiting. If the spinlock could + be claimed immediately then TRUE is + returned. If the spinlock is already claimed then the result is + FALSE. + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_spinlock_test + + + + Function: + + cyg_bool_t cyg_drv_spinlock_test(cyg_spinlock_t *lock ) + + + + Arguments: + + lock - pointer to spinlock to test + + + + Result: + + TRUE if the spinlock is available, + FALSE otherwise. + + + + Level: + + ISR + + + + Description: + + + Inspect the state of the spinlock. If the spinlock is not locked + then the result is TRUE. If it is locked then + the result will be FALSE. + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_spinlock_spin_intsave + + + + Function: + + +void cyg_drv_spinlock_spin_intsave(cyg_spinlock_t *lock, + cyg_addrword_t *istate ) + + + + + Arguments: + + lock - pointer to spinlock to claim + istate - pointer to interrupt state save location + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + + This function behaves exactly like + cyg_drv_spinlock_spin() except that it also + disables interrupts before attempting to claim the lock. The + current interrupt enable state is saved in + *istate. Interrupts remain disabled once + the spinlock had been claimed and must be restored by calling + cyg_drv_spinlock_clear_intsave(). + + + In general, device drivers should use this function to claim and + release spinlocks rather than the + non-_intsave() variants, to ensure proper + exclusion with code running on both other CPUs and this CPU. + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_spinlock_clear_intsave + + + + Function: + + +void cyg_drv_spinlock_clear_intsave( cyg_spinlock_t *lock, + cyg_addrword_t istate ) + + + + + Arguments: + + lock - pointer to spinlock to clear + istate - interrupt state to restore + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + + This function behaves exactly like + cyg_drv_spinlock_clear() except that it + also restores an interrupt state saved by + cyg_drv_spinlock_spin_intsave(). The + istate argument must have been + initialized by a previous call to + cyg_drv_spinlock_spin_intsave(). + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_dsr_lock + + + + Function: + + void cyg_drv_dsr_lock() + + + + Arguments: + + None + + + + Result: + + None + + + + Level: + + DSR + + + + Description: + + Disables scheduling of DSRs. This function maintains a + counter of the number of times it has been called. + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_dsr_unlock + + + + Function: + + void cyg_drv_dsr_unlock() + + + + Arguments: + + None + + + + Result: + + + None + + + + Level: + + DSR + + + + Description: + + Re-enables scheduling of DSRs. This function decrements + the counter incremented by + cyg_drv_dsr_lock(). DSRs are only allowed + to be delivered when the counter goes to zero. + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_mutex_init + + + + Function: + + void cyg_drv_mutex_init(cyg_drv_mutex *mutex) + + + + Arguments: + + mutex - pointer to mutex to initialize + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + Initialize the mutex pointed to by the + mutex argument. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_mutex_destroy + + + + Function: + + void cyg_drv_mutex_destroy( cyg_drv_mutex *mutex ) + + + + Arguments: + + mutex - pointer to mutex to destroy + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + Destroy the mutex pointed to by the + mutex argument. The mutex should be unlocked + and there should be no threads waiting to lock it when this call + in made. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_mutex_lock + + + + Function: + + cyg_bool cyg_drv_mutex_lock( cyg_drv_mutex *mutex ) + + + + Arguments: + + mutex - pointer to mutex to lock + + + + Result: + + TRUE it the thread has claimed the + lock, FALSE otherwise. + + + + Level: + + Thread + + + + Description: + + Attempt to lock the mutex pointed to by the + mutex argument. If the mutex is already + locked by another thread then this thread will wait until that + thread is finished. If the result from this function is + FALSE then the thread was broken out of its + wait by some other thread. In this case the mutex will not have + been locked. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_mutex_trylock + + + + Function: + + cyg_bool cyg_drv_mutex_trylock( cyg_drv_mutex *mutex ) + + + + Arguments: + + mutex - pointer to mutex to lock + + + + Result: + + TRUE if the mutex has been locked, + FALSE otherwise. + + + + Level: + + Thread + + + + Description: + + Attempt to lock the mutex pointed to by the + mutex argument without waiting. If the + mutex is already locked by some other thread then this function + returns FALSE. If the function can lock the + mutex without waiting, then TRUE is + returned. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_mutex_unlock + + + + Function: + + void cyg_drv_mutex_unlock( cyg_drv_mutex *mutex ) + + + + Arguments: + + mutex - pointer to mutex to unlock + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + Unlock the mutex pointed to by the + mutex argument. If there are any threads + waiting to claim the lock, one of them is woken up to try and + claim it. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_mutex_release + + + + Function: + + void cyg_drv_mutex_release( cyg_drv_mutex *mutex ) + + + + Arguments: + + mutex - pointer to mutex to release + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + Release all threads waiting on the mutex pointed to by the + mutex argument. These threads will return + from cyg_drv_mutex_lock() with a + FALSE result and will not have claimed the + mutex. This function has no effect on any thread that may have + the mutex claimed. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_cond_init + + + + Function: + + void cyg_drv_cond_init( cyg_drv_cond *cond, cyg_drv_mutex *mutex ) + + + + + Arguments: + + cond - condition variable to initialize + mutex - mutex to associate with this condition variable + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + Initialize the condition variable pointed to by the + cond argument. The + mutex argument must point to a mutex with + which this condition variable is associated. A thread may only + wait on this condition variable when it has already locked the + associated mutex. Waiting will cause the mutex to be unlocked, + and when the thread is reawakened, it will automatically claim + the mutex before continuing. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_cond_destroy + + + + Function: + + void cyg_drv_cond_destroy( cyg_drv_cond *cond ) + + + + Arguments: + + cond - condition variable to destroy + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + Destroy the condition variable pointed to by the + cond argument. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_cond_wait + + + + Function: + + void cyg_drv_cond_wait( cyg_drv_cond *cond ) + + + + Arguments: + + cond - condition variable to wait on + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + Wait for a signal on the condition variable pointed to by + the cond argument. The thread must have + locked the associated mutex, supplied in + cyg_drv_cond_init(), before waiting on this + condition variable. While the thread waits, the mutex will be + unlocked, and will be re-locked before this function returns. It + is possible for threads waiting on a condition variable to + occasionally wake up spuriously. For this reason it is necessary + to use this function in a loop that re-tests the condition each + time it returns. Note that this function performs an implicit + scheduler unlock/relock sequence, so that it may be used within + an explicit + cyg_drv_dsr_lock()...cyg_drv_dsr_unlock() + structure. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_cond_signal + + + + Function: + + void cyg_drv_cond_signal( cyg_drv_cond *cond ) + + + + Arguments: + + cond - condition variable to signal + + + + Result: + + None + + + + Level: + + DSR + + + + Description: + + Signal the condition variable pointed to by the cond + argument. If there are any threads waiting on this variable at + least one of them will be awakened. Note that in some + configurations there may not be any difference between this + function and cyg_drv_cond_broadcast(). + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_cond_broadcast + + + + Function: + + void cyg_drv_cond_broadcast( cyg_drv_cond *cond ) + + + + Arguments: + + cond - condition variable to broadcast to + + + + Result: + + None + + + + Level: + + DSR + + + + Description: + + Signal the condition variable pointed to by the + cond argument. If there are any threads + waiting on this variable they will all be awakened. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_create + + + + Function: + + +void cyg_drv_interrupt_create( cyg_vector_t vector, + cyg_priority_t priority, + cyg_addrword_t data, + cyg_ISR_t *isr, + cyg_DSR_t *dsr, + cyg_handle_t *handle, + cyg_interrupt *intr + ) + + + + + Arguments: + + vector - vector to attach to + priority - queuing priority + data - data pointer + isr - interrupt service routine + dsr - deferred service routine + handle - returned handle + intr - put interrupt object here + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + Create an interrupt object and returns a handle to it. The + object contains information about which interrupt vector to use + and the ISR and DSR that will be called after the interrupt + object is attached to the vector. The interrupt object will be + allocated in the memory passed in the + intr parameter. The interrupt object is + not immediately attached; it must be attached with the + cyg_interrupt_attach() call. + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_delete + + + + Function: + + void cyg_drv_interrupt_delete( cyg_handle_t interrupt ) + + + + Arguments: + + interrupt - interrupt to delete + + + + Result: + + None + + + + Level: + + Thread + + + + Description: + + Detach the interrupt from the vector and free the memory + passed in the intr argument to + cyg_drv_interrupt_create() for + reuse. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_attach + + + + Function: + + void cyg_drv_interrupt_attach( cyg_handle_t interrupt ) + + + + Arguments: + + interrupt - interrupt to attach + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + Attach the interrupt to the vector so that interrupts will + be delivered to the ISR when the interrupt occurs. + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_detach + + + + Function: + + void cyg_drv_interrupt_detach( cyg_handle_t interrupt ) + + + + Arguments: + + interrupt - interrupt to detach + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + Detach the interrupt from the vector so that interrupts + will no longer be delivered to the ISR. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_mask + + + + Function: + + void cyg_drv_interrupt_mask(cyg_vector_t vector ) + + + + Arguments: + + vector - vector to mask + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + Program the interrupt controller to stop delivery of + interrupts on the given vector. On architectures which implement + interrupt priority levels this may also disable all lower + priority interrupts. + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_mask_intunsafe + + + + Function: + + void cyg_drv_interrupt_mask_intunsafe(cyg_vector_t vector ) + + + + Arguments: + + vector - vector to mask + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + Program the interrupt controller to stop delivery of + interrupts on the given vector. On architectures which implement + interrupt priority levels this may also disable all lower + priority interrupts. This version differs from + cyg_drv_interrupt_mask() in not being + interrupt safe. So in situations where, for example, interrupts + are already known to be disabled, this may be called to avoid + the extra overhead. + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_unmask + + + + Function: + + void cyg_drv_interrupt_unmask(cyg_vector_t vector ) + + + + Arguments: + + vector - vector to unmask + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + Program the interrupt controller to re-allow delivery of + interrupts on the given vector. + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_unmask_intunsafe + + + + Function: + + void cyg_drv_interrupt_unmask_intunsafe(cyg_vector_t vector ) + + + + Arguments: + + vector - vector to unmask + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + Program the interrupt controller to re-allow delivery of + interrupts on the given vector. This + version differs from + cyg_drv_interrupt_unmask() in not being + interrupt safe. + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_acknowledge + + + + Function: + + void cyg_drv_interrupt_acknowledge( cyg_vector_t vector ) + + + + Arguments: + + vector - vector to acknowledge + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + Perform any processing required at the interrupt + controller and in the CPU to cancel the current interrupt + request on the vector. An ISR may also + need to program the hardware of the device to prevent an + immediate re-triggering of the interrupt. + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_configure + + + + Function: + + +void cyg_drv_interrupt_configure( cyg_vector_t vector, + cyg_bool_t level, + cyg_bool_t up + ) + + + + + Arguments: + + vector - vector to configure + level - level or edge triggered + up - rising/falling edge, high/low level + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + Program the interrupt controller with the characteristics + of the interrupt source. The level + argument chooses between level- or edge-triggered + interrupts. The up argument chooses + between high and low level for level triggered interrupts or + rising and falling edges for edge triggered interrupts. This + function only works with interrupt controllers that can control + these parameters. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_level + + + + Function: + + +void cyg_drv_interrupt_level( cyg_vector_t vector, + cyg_priority_t level + ) + + + + + Arguments: + + vector - vector to configure + level - level to set + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + Program the interrupt controller to deliver the given + interrupt at the supplied priority level. This function only + works with interrupt controllers that can control this + parameter. + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_set_cpu + + + + Function: + + +void cyg_drv_interrupt_set_cpu( cyg_vector_t vector, + cyg_cpu_t cpu + ) + + + + + Arguments: + + vector - interrupt vector to route + cpu - destination CPU + + + + Result: + + None + + + + Level: + + ISR + + + + Description: + + + This function causes all interrupts on the given vector to be + routed to the specified CPU. Subsequently, all such interrupts + will be handled by that CPU. This only works if the underlying + hardware is capable of performing this kind of routing. This + function does nothing on a single CPU system. + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_drv_interrupt_get_cpu + + + + Function: + + +cyg_cpu_t cyg_drv_interrupt_set_cpu( cyg_vector_t vector ) + + + + + Arguments: + + vector - interrupt vector to query + + + + Result: + + The CPU to which this vector is routed + + + + Level: + + ISR + + + + Description: + + + In multi-processor systems this function returns the id of the + CPU to which interrupts on the given vector are current being + delivered. In single CPU systems this function returns zero. + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_ISR_t + + + + Type: + + +typedef cyg_uint32 cyg_ISR_t( cyg_vector_t vector, + cyg_addrword_t data + ) + + + + + Fields: + + vector - vector being delivered + data - data value supplied by client + + + + Result: + + Bit mask indicating whether interrupt was handled and + whether the DSR should be called. + + + + Description: + + Interrupt Service Routine definition. A pointer to a + function with this prototype is passed to + cyg_interrupt_create() when an interrupt + object is created. When an interrupt is delivered the function + will be called with the vector number and the data value that + was passed to cyg_interrupt_create(). + + The return value is a bit mask containing one or both of the + following bits: + + + CYG_ISR_HANDLED + + indicates that the interrupt was handled by this + ISR. It is a configuration option whether this will + prevent further ISR being run. + + + + CYG_ISR_CALL_DSR + + causes the DSR that was passed to + cyg_interrupt_create() to be + scheduled to be called. + + + + + + + +
+ + + + +
+<!-- <index></index> -->cyg_DSR_t + + + + Type: + + +typedef void cyg_DSR_t( cyg_vector_t vector, + cyg_ucount32 count, + cyg_addrword_t data + ) + + + + + Fields: + + vector - vector being delivered + count - number of times DSR has been scheduled + data - data value supplied by client + + + + Result: + + None + + + + Description: + + Deferred Service Routine prototype. A pointer to a + function with this prototype is passed to + cyg_interrupt_create() when an interrupt + object is created. When the ISR requests the scheduling of its + DSR, this function will be called at some later point. In + addition to the vector and + data arguments, which will be the same as + those passed to the ISR, this routine is also passed a + count of the number of times the ISR has + requested that this DSR be scheduled. This counter is zeroed + each time the DSR actually runs, so it indicates how many + interrupts have occurred since it last ran. + + + + +
+ + + +
+ + + +
+ + + + + diff --git a/packages/io/common/current/include/config_keys.h b/packages/io/common/current/include/config_keys.h --- a/packages/io/common/current/include/config_keys.h +++ b/packages/io/common/current/include/config_keys.h @@ -7,29 +7,38 @@ // Device I/O "Keys" for get/put config functions // // ==================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // ==================================================================== //#####DESCRIPTIONBEGIN#### // @@ -99,6 +108,17 @@ #define CYG_IO_GET_CONFIG_TERMIOS 0x0400 #define CYG_IO_SET_CONFIG_TERMIOS 0x0401 +// ======== 0x600 FLASH ===================================================== +// Get/Set configuration 'key' values for FLASH drivers + +#define CYG_IO_GET_CONFIG_FLASH_ERASE 0x600 +#define CYG_IO_GET_CONFIG_FLASH_QUERY 0x601 +#define CYG_IO_GET_CONFIG_FLASH_LOCK 0x602 +#define CYG_IO_GET_CONFIG_FLASH_UNLOCK 0x603 +#define CYG_IO_GET_CONFIG_FLASH_VERIFY 0x604 +#define CYG_IO_GET_CONFIG_FLASH_DEVSIZE 0x605 +#define CYG_IO_GET_CONFIG_FLASH_BLOCKSIZE 0x606 + // ======== 0x1000 Generic =================================================== // Get/Set configuration 'key' values that can apply to more than one // class of device. diff --git a/packages/io/common/current/include/devtab.h b/packages/io/common/current/include/devtab.h --- a/packages/io/common/current/include/devtab.h +++ b/packages/io/common/current/include/devtab.h @@ -7,29 +7,38 @@ // Device I/O Table // // ==================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // ==================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/common/current/include/file.h b/packages/io/common/current/include/file.h --- a/packages/io/common/current/include/file.h +++ b/packages/io/common/current/include/file.h @@ -5,29 +5,38 @@ // Defines for high level file I/O // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/common/current/include/io.h b/packages/io/common/current/include/io.h --- a/packages/io/common/current/include/io.h +++ b/packages/io/common/current/include/io.h @@ -7,29 +7,38 @@ // Device I/O // // ==================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // ==================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/common/current/include/io_diag.h b/packages/io/common/current/include/io_diag.h --- a/packages/io/common/current/include/io_diag.h +++ b/packages/io/common/current/include/io_diag.h @@ -7,29 +7,38 @@ // Redirect diag output to the configured console device // //============================================================================ -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================ //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/common/current/src/io_file.c b/packages/io/common/current/src/io_file.c --- a/packages/io/common/current/src/io_file.c +++ b/packages/io/common/current/src/io_file.c @@ -5,29 +5,38 @@ // High-level file I/O support. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/common/current/src/ioinit.cxx b/packages/io/common/current/src/ioinit.cxx --- a/packages/io/common/current/src/ioinit.cxx +++ b/packages/io/common/current/src/ioinit.cxx @@ -5,29 +5,38 @@ // I/O Subsystem + Device Table support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/common/current/src/iosys.c b/packages/io/common/current/src/iosys.c --- a/packages/io/common/current/src/iosys.c +++ b/packages/io/common/current/src/iosys.c @@ -5,29 +5,38 @@ // I/O Subsystem + Device Table support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/eth/current/ChangeLog b/packages/io/eth/current/ChangeLog --- a/packages/io/eth/current/ChangeLog +++ b/packages/io/eth/current/ChangeLog @@ -1,3 +1,69 @@ +2002-05-13 Jesper Skov + + * cdl/eth_drivers.cdl: Moved the package's header files to + cyg/io/eth to clean up the include root directory. + +2002-04-30 Jonathan Larmour + + * src/lwip/eth_drv.c: Update from Jani Monoses. + + * cdl/eth_drivers.cdl: Move CYGINT_ISO_STRING_STRFUNCS requirement + into CYGPKG_IO_ETH_DRIVERS_NET where it belongs. + Move CYGINT_ISO_STRING_MEMFUNCS requirement into + CYGPKG_IO_ETH_DRIVERS_STAND_ALONE where it belongs. + +2002-04-10 Gary Thomas + + * src/net/eth_drv.c: Only pass mutlicast addresses down to drivers. + +2002-04-05 Jani Monoses + + * src/lwip/eth_drv.c: New file. Add eth driver support for lwip. + * src/lwip/lw.diff: New file. diff against lwip sources. + * src/lwip/README: New file. + * cdl/eth_drivers.cdl: Add lwip driver support. + +2002-03-09 Gary Thomas + + * src/net/eth_drv.c: Select 'multicast_all' if too many addresses + are required. Also, ignore any non-multicast addresses. + +2002-02-22 Hugo Tyson + + * doc/ethdrv.sgml: New file. SGML-ized the existing driver-doc + file and brought the information up to date with deliver functions + and all that. + +2002-02-18 Gary Thomas + + * cdl/eth_drivers.cdl: + Add new interface CYGINT_IO_ETH_MULTICAST which is used to + insure that drivers support multicast addresses if IPv6 is used. + +2002-02-15 Gary Thomas + + * src/net/eth_drv.c: + * include/eth_drv.h: Add framework for multicast address support. + +2002-01-30 Hugo Tyson + + * cdl/eth_drivers.cdl (CYGPKG_IO_ETH_DRIVERS_WARN_FORCE_CONSOLE): + CDL options removed; control is now from RedBoot. + + * src/net/eth_drv.c (START_CONSOLE): Changed to use RedBoot + fconfig items for deciding what console to use for special debug + messages such as "out of MBUFs" and the like. + + * src/stand_alone/eth_drv.c (LOCK_APPLICATION_SCHEDULER): New + macro to do what it says, before passing packets to the app. + Used in two places: when passing a received packet, and when + passing a tx completion status back. + +2002-01-28 Gary Thomas + + * src/net/eth_drv.c (eth_drv_init): Changes for supporting new + FreeBSD based stack (minor API changes internal to that stack). + 2001-12-12 Hugo Tyson * src/net/eth_drv.c (START_CONSOLE,END_CONSOLE): New macros akin @@ -461,29 +527,38 @@ 2000-02-08 John Dallaway #include #include - #include - #include + #include + #include ETH_DRV_SC(DRV_sc, 0, // No driver specific data needed diff --git a/packages/io/eth/current/doc/ethdrv.sgml b/packages/io/eth/current/doc/ethdrv.sgml new file mode 100644 --- /dev/null +++ b/packages/io/eth/current/doc/ethdrv.sgml @@ -0,0 +1,738 @@ + +Ethernet Device Drivers + +Generic Ethernet Device Driver + +Generic Ethernet API + +This file provides a simple description of how to write a low-level, +hardware dependent ethernet driver. + + +There is a high-level driver (which is only code — with no state of +its own) that is part of the stack. There will be one or more low-level +drivers tied to the actual network hardware. Each of these drivers +contains one or more driver instances. The intent is that the +low-level drivers know nothing of the details of the stack that will be +using them. Thus, the same driver can be used by the +eCos +supported +TCP/IP +stack, +RedBoot, +or any other, with no changes. + + +A driver instance is contained within a +struct eth_drv_sc: + +struct eth_hwr_funs { + // Initialize hardware (including startup) + void (*start)(struct eth_drv_sc *sc, + unsigned char *enaddr, + int flags); + // Shut down hardware + void (*stop)(struct eth_drv_sc *sc); + // Device control (ioctl pass-thru) + int (*control)(struct eth_drv_sc *sc, + unsigned long key, + void *data, + int data_length); + // Query - can a packet be sent? + int (*can_send)(struct eth_drv_sc *sc); + // Send a packet of data + void (*send)(struct eth_drv_sc *sc, + struct eth_drv_sg *sg_list, + int sg_len, + int total_len, + unsigned long key); + // Receive [unload] a packet of data + void (*recv)(struct eth_drv_sc *sc, + struct eth_drv_sg *sg_list, + int sg_len); + // Deliver data to/from device from/to stack memory space + // (moves lots of memcpy()s out of DSRs into thread) + void (*deliver)(struct eth_drv_sc *sc); + // Poll for interrupts/device service + void (*poll)(struct eth_drv_sc *sc); + // Get interrupt information from hardware driver + int (*int_vector)(struct eth_drv_sc *sc); + // Logical driver interface + struct eth_drv_funs *eth_drv, *eth_drv_old; +}; + +struct eth_drv_sc { + struct eth_hwr_funs *funs; + void *driver_private; + const char *dev_name; + int state; + struct arpcom sc_arpcom; /* ethernet common */ +}; + + +If you have two instances of the same hardware, you only need one +struct eth_hwr_funs shared between them. + +There is another structure which is used to communicate with the rest of +the stack: + +struct eth_drv_funs { + // Logical driver - initialization + void (*init)(struct eth_drv_sc *sc, + unsigned char *enaddr); + // Logical driver - incoming packet notifier + void (*recv)(struct eth_drv_sc *sc, + int total_len); + // Logical driver - outgoing packet notifier + void (*tx_done)(struct eth_drv_sc *sc, + CYG_ADDRESS key, + int status); +}; + +Your driver does not create an instance of this +structure. It is provided for driver code to use in the +eth_drv member of the function record. +Its usage is described below in + +One more function completes the API with which your driver communicates +with the rest of the stack: + +extern void eth_drv_dsr(cyg_vector_t vector, + cyg_ucount32 count, + cyg_addrword_t data); + + +This function is designed so that it can be registered as the DSR for your +interrupt handler. It will awaken the +“Network Delivery Thread” +to call your deliver routine. See . + +You create an instance of struct eth_drv_sc +using the +ETH_DRV_SC() +macro which +sets up the structure, including the prototypes for the functions, etc. +By doing things this way, if the internal design of the ethernet drivers +changes (e.g. we need to add a new low-level implementation function), +existing drivers will no longer compile until updated. This is much +better than to have all of the definitions in the low-level drivers +themselves and have them be (quietly) broken if the interfaces change. + +The “magic” +which gets the drivers started (and indeed, linked) is +similar to what is used for the I/O subsystem. +This is done using the +NETDEVTAB_ENTRY() +macro, which defines an initialization function +and the basic data structures for the low-level driver. + + + typedef struct cyg_netdevtab_entry { + const char *name; + bool (*init)(struct cyg_netdevtab_entry *tab); + void *device_instance; + unsigned long status; + } cyg_netdevtab_entry_t; + +The device_instance +entry here would point to the struct eth_drv_sc +entry previously defined. This allows the network driver +setup to work with any class of driver, not just ethernet drivers. In +the future, there will surely be serial PPP +drivers, etc. These will +use the NETDEVTAB_ENTRY() +setup to create the basic driver, but they will +most likely be built on top of other high-level device driver layers. + +To instantiate itself, and connect it to the system, +a hardware driver will have a template +(boilerplate) which looks something like this: + +#include <cyg/infra/cyg_type.h> +#include <cyg/hal/hal_arch.h> +#include <cyg/infra/diag.h> +#include <cyg/hal/drv_api.h> +#include <cyg/io/eth/netdev.h> +#include <cyg/io/eth/eth_drv.h> + +ETH_DRV_SC(DRV_sc, + 0, // No driver specific data needed + "eth0", // Name for this interface + HRDWR_start, + HRDWR_stop, + HRDWR_control, + HRDWR_can_send + HRDWR_send, + HRDWR_recv, + HRDWR_deliver, + HRDWR_poll, + HRDWR_int_vector +); + +NETDEVTAB_ENTRY(DRV_netdev, + "DRV", + DRV_HRDWR_init, + &DRV_sc); + + +This, along with the referenced functions, completely define the driver. + +If one needed the same low-level driver to handle +multiple similar hardware interfaces, you would need multiple invocations +of the +ETH_DRV_SC()/NETDEVTAB_ENTRY() +macros. You would add a pointer +to some instance specific data, e.g. containing base addresses, interrupt +numbers, etc, where the + + 0, // No driver specific data + +is currently. + + + +Review of the functions + +Now a brief review of the functions. This discussion will use generic +names for the functions — your driver should use hardware-specific +names to maintain uniqueness against any other drivers. + + +Init function + + +static bool DRV_HDWR_init(struct cyg_netdevtab_entry *tab) + +This function is called as part of system initialization. Its primary +function is to decide if the hardware (as indicated via +tab->device_instance) +is working and if the interface needs to be made +available in the system. If this is the case, this function needs to +finish with a call to the ethernet driver function: + + struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance; + ....initialization code.... + // Initialize upper level driver + (sc->funs->eth_drv->init)( sc, unsigned char *enaddr ); + +where enaddr +is a pointer to the ethernet station address for this unit, to inform +the stack of this device's readiness and availability. + +The ethernet station address +(ESA) +is supposed to be a +world-unique, 48 bit address for this particular ethernet interface. +Typically it is provided by the board/hardware manufacturer in ROM. + + +In many packages it is possible for the +ESA +to be set from RedBoot, +(perhaps from 'fconfig' data), hard-coded from +CDL, or from an EPROM. +A driver should choose a run-time specified +ESA +(e.g. from RedBoot) +preferentially, otherwise (in order) it should use a CDL specified +ESA +if one has been set, otherwise an EPROM set +ESA, or otherwise +fail. See the cl/cs8900a +ethernet driver for an example. + + + +Start function + + +static void +HRDWR_start(struct eth_drv_sc *sc, unsigned char *enaddr, int flags) + +This function is called, perhaps much later than system initialization +time, when the system (an application) is ready for the interface to +become active. The purpose of this function is to set up the hardware +interface to start accepting packets from the network and be able to +send packets out. The receiver hardware should not be enabled prior to +this call. +This function will be called whenever the +up/down state of the logical interface changes, e.g. when the IP address +changes, or when promiscuous mode is selected by means of an +ioctl() call in the application. +This may occur more than once, so this function needs to +be prepared for that case. + +In future, the flags +field (currently unused) may be used to tell the +function how to start up, e.g. whether interrupts will be used, +alternate means of selecting promiscuous mode etc. + + + +Stop function + + +static void HRDWR_stop(struct eth_drv_sc *sc) + +This function is the inverse of “start.” +It should shut down the hardware, disable the receiver, and keep it from +interacting with the physical network. + + + +Control function + + +static int +HRDWR_control( + struct eth_drv_sc *sc, unsigned long key, + void *data, int len) + +This function is used to perform low-level “control” +operations on the +interface. These operations would typically be initiated via +ioctl() calls in the BSD +stack, and would be anything that might require the hardware setup to +change (i.e. cannot be performed totally by the +platform-independent layers). + +The key parameter selects the operation, and the +data and len params point describe, +as required, some data for the operation in question. + +Available Operations: +ETH_DRV_SET_MAC_ADDRESS + +This operation sets the ethernet station address (ESA or MAC) for the +device. Normally this address is kept in non-volatile memory and is +unique in the world. This function must at least set the interface to +use the new address. It may also update the NVM as appropriate. + + + + +ETH_DRV_GET_IF_STATS_UD +ETH_DRV_GET_IF_STATS + +These acquire a set of statistical counters from the interface, and write +the information into the memory pointed to by data. +The “UD” variant explicitly instructs the driver to acquire +up-to-date values. This is a separate option because doing so may take +some time, depending on the hardware. + +The definition of the data structure is in +cyg/io/eth/eth_drv_stats.h. + +This call is typically made by SNMP, see . + + + +ETH_DRV_SET_MC_LIST + +This entry instructs the device to set up multicast packet filtering +to receive only packets addressed to the multicast ESAs in the list pointed +to by data. + +The format of the data is a 32-bit count of the ESAs in the list, followed +by packed bytes which are the ESAs themselves, thus: + +#define ETH_DRV_MAX_MC 8 +struct eth_drv_mc_list { + int len; + unsigned char addrs[ETH_DRV_MAX_MC][ETHER_ADDR_LEN]; +}; + + + + +ETH_DRV_SET_MC_ALL + +This entry instructs the device to receive all multicast packets, and +delete any explicit filtering which had been set up. + + + + + +This function should return zero if the specified operation was +completed successfully. It should return non-zero if the operation +could not be performed, for any reason. + + + +Can-send function + + +static int HRDWR_can_send(struct eth_drv_sc *sc) + +This function is called to determine if it is possible to start the +transmission of a packet on the interface. Some interfaces will allow +multiple packets to be "queued" and this function allows for the highest +possible utilization of that mode. + +Return the number of packets which could be accepted at this time, zero +implies that the interface is saturated/busy. + + + +Send function + + +struct eth_drv_sg { + CYG_ADDRESS buf; + CYG_ADDRWORD len; +}; + +static void +HRDWR_send( + struct eth_drv_sc *sc, + struct eth_drv_sg *sg_list, int sg_len, + int total_len, unsigned long key) + +This function is used to send a packet of data to the network. It is +the responsibility of this function to somehow hand the data over to the +hardware interface. This will most likely require copying, but just the +address/length values could be used by smart hardware. + +All data in/out of the driver is specified via a +“scatter-gather” +list. This is just an array of address/length pairs which describe +sections of data to move (in the order given by the array), as in the +struct eth_drv_sg defined above and pointed to by +sg_list. + +Once the data has been successfully sent by the interface (or if an +error occurs), the driver should call +(sc->funs->eth_drv->tx_done)() +(see ) +using the specified key. +Only then will the upper layers release the resources +for that packet and start another transmission. + +In future, this function may be extended so that the data need not be +copied by having the function return a “disposition” code +(done, send pending, etc). At this point, you should move the data to some +“safe” location before returning. + + + +Deliver function + + +static void +HRDWR_deliver(struct eth_drv_sc *sc) + +This function is called from the “Network Delivery Thread” in +order to let the device driver do the time-consuming work associated with +receiving a packet — usually copying the entire packet from the +hardware or a special memory location into the network stack's memory. + +After handling any outstanding incoming packets or pending transmission +status, it can unmask the device's interrupts, and free any relevant +resources so it can process further packets. + +It will be called when the interrupt handler for the network device +has called + + eth_drv_dsr( vector, count, (cyg_addrword_t)sc ); + +to alert the system that “something requires attention.” +This eth_drv_dsr() call must occur from within the +interrupt handler's DSR (not the ISR) or actually be +the DSR, whenever it is determined that +the device needs attention from the foreground. The third parameter +(data in the prototype of +eth_drv_dsr() must +be a valid struct eth_drv_sc pointer sc. + +The reason for this slightly convoluted train of events is to keep the DSR +(and ISR) execution time as short as possible, so that other activities of +higher priority than network servicing are not denied the CPU by network +traffic. + +To deliver a newly-received packet into the network stack, the deliver +routine must call + +(sc->funs->eth_drv->recv)(sc, len); + +which will in turn call the receive function, which we talk about next. +See also below. + + + +Receive function + + +static void +HRDWR_recv( + struct eth_drv_sc *sc, + struct eth_drv_sg *sg_list, int sg_len) + +This function is a call back, only invoked after the +upper-level function + +(sc->funs->eth_drv->recv)(struct eth_drv_sc *sc, int total_len) + +has been called itself from your deliver function when it knows that a +packet of data is available on the +interface. The (sc->funs->eth_drv->recv)() +function then arranges network buffers +and structures for the data and then calls +HRDWR_recv() to actually +move the data from the interface. + +A scatter-gather list (struct eth_drv_sg) is used once more, +just like in the send case. + + + +Poll function + + +static void +HRDWR_poll(struct eth_drv_sc *sc) + +This function is used when in a non-interrupt driven system, e.g. when +interrupts are completely disabled. This allows the driver time to check +whether anything needs doing either for transmission, or to check if +anything has been received, or if any other processing needs doing. + +It is perfectly correct and acceptable for the poll function to look like +this: + +static void +HRDWR_poll(struct eth_drv_sc *sc) +{ + my_interrupt_ISR(sc); + HRDWR_deliver(struct eth_drv_sc *sc); +} + +provided that both the ISR and the deliver functions are idempotent and +harmless if called when there is no attention needed by the hardware. Some +devices might not need a call to the ISR here if the deliver function +contains all the “intelligence.” + + + +Interrupt-vector function + + +static int +HRDWR_int_vector(struct eth_drv_sc *sc) + +This function returns the interrupt vector number used for receive +interrupts. +This is so that the common GDB stubs can detect when to check +for incoming “CTRL-C” packets (used to asynchronously +halt the application) when debugging over ethernet. +The GDB stubs need to know which interrupt the ethernet device uses +so that they can mask or unmask that interrupt as required. + + + + +Upper Layer Functions + +Upper layer functions are called by drivers to deliver received packets +or transmission completion status back up into the network stack. + +These functions are defined by the hardware independent upper layers of +the networking driver support. They are present to hide the interfaces +to the actual networking stack so that the hardware drivers may +be used by different network stack implementations without change. + +These functions require a pointer to a struct eth_drv_sc +which describes the interface at a logical level. It is assumed that the +low level hardware driver will keep track of this pointer so +it may be passed “up” as appropriate. + + +Callback Init function + + +void (sc->funs->eth_drv->init)( + struct eth_drv_sc *sc, unsigned char *enaddr) + +This function establishes the device at initialization time. +It should be called once per device instance only, from the +initialization function, if all is well +(see ). +The hardware should be totally initialized +(not “started”) +when this function is called. + + + +Callback Tx-Done function + + +void (sc->funs->eth_drv->tx_done)( + struct eth_drv_sc *sc, + unsigned long key, int status) + +This function is called when a packet completes transmission on the +interface. The key +value must be one of the keys provided to +HRDWR_send() +above. The value status should be non-zero +(details currently undefined) to indicate that an error occurred during the +transmission, and zero if all was well. + +It should be called from the deliver function +(see ) +or poll function +(see ). + + + +Callback Receive function + + +void (sc->funs->eth_drv->recv)(struct eth_drv_sc *sc, int len) + +This function is called to indicate that a packet of length +len has +arrived at the interface. +The callback +HRDWR_recv() function +described above will be used to actually unload the data from the +interface into buffers used by the device independent layers. + +It should be called from the deliver function +(see ) +or poll function +(see ). + + + + +Calling graph for Transmission and Reception + +It may be worth clarifying further the flow of control in the transmit and +receive cases, where the hardware driver does use interrupts and so DSRs to +tell the “foreground” when something asynchronous has occurred. + + +Transmission + + +Some foreground task such as the application, SNMP “daemon”, +DHCP management thread or whatever, calls into network stack to send a +packet, or the stack decides to send a packet in response to incoming +traffic such as a “ping” or ARP request. + + +The driver calls the +HRDWR_can_send() +function in the hardware driver. + + +HRDWR_can_send() +returns the number of available "slots" in which it +can store a pending transmit packet. +If it cannot send at this time, the packet is queued outside the +hardware driver for later; in this case, the hardware is already busy +transmitting, so expect an interrupt as described below for completion +of the packet currently outgoing. + + +If it can send right now, HRDWR_send() is called. +HRDWR_send() copies the +data into special hardware buffers, or instructs the hardware to +“send that.” It also remembers the key that is associated with +this tx request. + + +These calls return … time passes … + + +Asynchronously, the hardware makes an interrupt to say +“transmit is done.” +The ISR quietens the interrupt source in the hardware and +requests that the associated DSR be run. + + +The DSR calls (or is) the +eth_drv_dsr() function in the generic driver. + + +eth_drv_dsr() in the generic driver awakens the +“Network Delivery Thread” which calls the deliver function +HRDWR_deliver() in the driver. + + +The deliver function realizes that a transmit request has completed, +and calls the callback tx-done function +(sc->funs->eth_drv->tx_done)() +with the same key that it remembered for this tx. + + +The callback tx-done function +uses the key to find the resources associated with +this transmit request; thus the stack knows that the transmit has +completed and its resources can be freed. + + +The callback tx-done function +also enquires whether HRDWR_can_send() now says +“yes, we can send” +and if so, dequeues a further transmit request +which may have been queued as described above. If so, then +HRDWR_send() copies the data into the hardware buffers, or +instructs the hardware to "send that" and remembers the new key, as above. +These calls then all return to the “Network Delivery Thread” +which then sleeps, awaiting the next asynchronous event. + + +All done … + + + + +Receive + + +Asynchronously, the hardware makes an interrupt to say +“there is ready data in a receive buffer.” +The ISR quietens the interrupt source in the hardware and +requests that the associated DSR be run. + + +The DSR calls (or is) the +eth_drv_dsr() function in the generic driver. + + +eth_drv_dsr() in the generic driver awakens the +“Network Delivery Thread” which calls the deliver function +HRDWR_deliver() in the driver. + + +The deliver function realizes that there is data ready and calls +the callback receive function +(sc->funs->eth_drv->recv)() +to tell it how many bytes to prepare for. + + +The callback receive function allocates memory within the stack +(eg. MBUFs in BSD/Unix style stacks) and prepares +a set of scatter-gather buffers that can +accommodate the packet. + + +It then calls back into the hardware driver routine +HRDWR_recv(). +HRDWR_recv() must copy the data from the +hardware's buffers into the scatter-gather buffers provided, and return. + + +The network stack now has the data in-hand, and does with it what it will. +This might include recursive calls to transmit a response packet. +When this all is done, these calls return, and the +“Network Delivery Thread” +sleeps once more, awaiting the next asynchronous event. + + + + + + diff --git a/packages/io/eth/current/include/eth_drv.h b/packages/io/eth/current/include/eth_drv.h --- a/packages/io/eth/current/include/eth_drv.h +++ b/packages/io/eth/current/include/eth_drv.h @@ -1,33 +1,42 @@ //========================================================================== // -// include/eth_drv.h +// include/cyg/io/eth/eth_drv.h // // High level networking driver interfaces // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -184,7 +193,7 @@ extern struct eth_drv_funs eth_drv_funs; #ifdef CYGPKG_IO_PCMCIA #ifdef CYGPKG_NET -#include +#include cyg_netdevtab_entry_t *eth_drv_netdev(char *name); #endif #endif // CYGPKG_IO_PCMCIA @@ -195,13 +204,21 @@ cyg_netdevtab_entry_t *eth_drv_netdev(ch #ifdef CYGPKG_NET #define ETH_DRV_GET_IF_STATS_UD 0x0101 #define ETH_DRV_GET_IF_STATS 0x0102 -#include // The struct * for these ops. +#include // The struct * for these ops. #endif #ifndef ETHER_ADDR_LEN #define ETHER_ADDR_LEN 6 #endif +#define ETH_DRV_SET_MC_LIST 0x0110 // Set multicast list +#define ETH_DRV_SET_MC_ALL 0x0111 // Set multicast all mode +#define ETH_DRV_MAX_MC 8 +struct eth_drv_mc_list { + int len; + unsigned char addrs[ETH_DRV_MAX_MC][ETHER_ADDR_LEN]; +}; + #ifndef CYGPKG_NET extern void eth_drv_buffers_init(void); extern int eth_drv_read(char *eth_hdr, char *buf, int len); diff --git a/packages/io/eth/current/include/eth_drv_stats.h b/packages/io/eth/current/include/eth_drv_stats.h --- a/packages/io/eth/current/include/eth_drv_stats.h +++ b/packages/io/eth/current/include/eth_drv_stats.h @@ -2,34 +2,43 @@ #define CYGONCE_IO_ETH_ETH_DRV_STATS_H //========================================================================== // -// include/eth_drv_stats.h +// include/cyg/io/eth/eth_drv_stats.h // // High level networking driver interfaces - statistics gathering // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -110,4 +119,4 @@ struct ether_drv_stats { #endif // CYGPKG_NET #endif // CYGONCE_IO_ETH_ETH_DRV_STATS_H -// EOF include/eth_drv_stats.h +// EOF include/cyg/io/eth/eth_drv_stats.h diff --git a/packages/io/eth/current/include/netdev.h b/packages/io/eth/current/include/netdev.h --- a/packages/io/eth/current/include/netdev.h +++ b/packages/io/eth/current/include/netdev.h @@ -7,29 +7,38 @@ // Network device description // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/eth/current/src/lwip/README b/packages/io/eth/current/src/lwip/README new file mode 100644 --- /dev/null +++ b/packages/io/eth/current/src/lwip/README @@ -0,0 +1,10 @@ +An EPK of lwip is available from http://humans.iv.ro/jani which has the most +up-to-date package (at least until it all gets integrated). + +It has just been tested on another ARM similar to the EB40 with CS89000 +and it works there too (that board has 128K of RAM). + +Alternatively, lw.diff is the diff against the lwip-0.5.3 tree. It contains +eCos support + an eCos project sample based on unixsim. Look at +lwip-0.5.3/proj/ecos to see how to use it. Modify the Makefile to suit +your needs and to reflect your eCos project dir. diff --git a/packages/io/eth/current/src/lwip/eth_drv.c b/packages/io/eth/current/src/lwip/eth_drv.c new file mode 100644 --- /dev/null +++ b/packages/io/eth/current/src/lwip/eth_drv.c @@ -0,0 +1,226 @@ +//========================================================================== +// +// src/lwip/eth_drv.c +// +// Hardware independent ethernet driver for lwIP +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Jani Monoses +// Contributors: +// Date: 2002-04-05 +// Purpose: Hardware independent ethernet driver +// Description: Based on the standalone driver for RedBoot. +// +// TODO: +// support more than 1 lowlevel device +// play nice with RedBoot too +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +// Define table boundaries +CYG_HAL_TABLE_BEGIN( __NETDEVTAB__, netdev ); +CYG_HAL_TABLE_END( __NETDEVTAB_END__, netdev ); + +// Interfaces exported to drivers + +static void eth_drv_init(struct eth_drv_sc *sc, unsigned char *enaddr); +static void eth_drv_recv(struct eth_drv_sc *sc, int total_len); +static void eth_drv_tx_done(struct eth_drv_sc *sc, CYG_ADDRWORD key, int status); + +struct eth_drv_funs eth_drv_funs = {eth_drv_init, eth_drv_recv, eth_drv_tx_done}; + +struct eth_drv_sc *__local_enet_sc; + +//this is where lwIP keeps hw address +unsigned char *lwip_hw_addr; + +cyg_sem_t delivery; + +//lwIP callback to pass received data to +typedef void (*lwip_input_t)(char *,int); +static lwip_input_t lwip_input; +void input_thread(void * arg) +{ + struct eth_drv_sc * sc; + //sc = (struct eth_drv_sc *)arg; + sc = __local_enet_sc; + for(;;) { + cyg_semaphore_wait(&delivery); + (sc->funs->deliver)(sc); + } + +} + +void +eth_drv_dsr(cyg_vector_t vector, + cyg_ucount32 count, + cyg_addrword_t data) +{ + // struct eth_drv_sc *sc = (struct eth_drv_sc *)data; + // sc->state |= ETH_DRV_NEEDS_DELIVERY; + cyg_semaphore_post(&delivery); +} + + + +//Called from lwIP init code to init the hw devices +//and pass the lwip input callback address +void init_hw_drivers(unsigned char *hw_addr,lwip_input_t input) +{ + cyg_netdevtab_entry_t *t; + + lwip_hw_addr = hw_addr; + lwip_input = input; + +// Initialize all network devices + for (t = &__NETDEVTAB__[0]; t != &__NETDEVTAB_END__; t++) { + if (t->init(t)) { + t->status = CYG_NETDEVTAB_STATUS_AVAIL; + } else { + // What to do if device init fails? + t->status = 0; // Device not [currently] available + } + } +} + +// +// This function is called during system initialization to register a +// network interface with the system. +// +static void +eth_drv_init(struct eth_drv_sc *sc, unsigned char *enaddr) +{ + // enaddr == 0 -> hardware init was incomplete (no ESA) + if (enaddr != 0) { + // Set up hardware address + memcpy(&sc->sc_arpcom.esa, enaddr, ETHER_ADDR_LEN); + memcpy(lwip_hw_addr, enaddr, ETHER_ADDR_LEN); + __local_enet_sc = sc; + // Perform any hardware initialization + (sc->funs->start)(sc, (unsigned char *)&sc->sc_arpcom.esa, 0); + } + cyg_semaphore_init(&delivery,0); +} + +// +// Send a packet of data to the hardware +// +cyg_sem_t packet_sent; + +void +eth_drv_write(char *eth_hdr, char *buf, int len) +{ + struct eth_drv_sg sg_list[MAX_ETH_DRV_SG]; + struct eth_drv_sc *sc = __local_enet_sc; + int sg_len = 1; + + while (!(sc->funs->can_send)(sc)) { + cyg_thread_delay(1); + } + + sg_list[0].buf = (CYG_ADDRESS)buf; + sg_list[0].len = len; +// cyg_semaphore_init(&packet_sent,0); + (sc->funs->send)(sc, sg_list, sg_len, len, (CYG_ADDRWORD)&packet_sent); + +// cyg_semaphore_wait(&packet_sent); +} + +// +// This function is called from the hardware driver when an output operation +// has completed - i.e. the packet has been sent. +// +static void +eth_drv_tx_done(struct eth_drv_sc *sc, CYG_ADDRWORD key, int status) +{ +#if 0 + CYGARC_HAL_SAVE_GP(); + if (key == (CYG_ADDRWORD)&packet_sent) { +// cyg_semaphore_post((cyg_sem_t *)&packet_sent); + } + CYGARC_HAL_RESTORE_GP(); +#endif +} + + +#define MAX_ETH_MSG 1540 +// +// This function is called from a hardware driver to indicate that an input +// packet has arrived. The routine will set up appropriate network resources +// to hold the data and call back into the driver to retrieve the data. +// +static void +eth_drv_recv(struct eth_drv_sc *sc, int total_len) +{ + struct eth_drv_sg sg_list[MAX_ETH_DRV_SG]; + int sg_len = 0; + unsigned char buf[MAX_ETH_MSG]; + CYGARC_HAL_SAVE_GP(); + + if ((total_len > MAX_ETH_MSG) || (total_len < 0)) { + total_len = MAX_ETH_MSG; + } + + sg_list[0].buf = (CYG_ADDRESS)buf; + sg_list[0].len = total_len; + sg_len = 1; + + (sc->funs->recv)(sc, sg_list, sg_len); + (lwip_input)((char*)sg_list[0].buf,total_len); + CYGARC_HAL_RESTORE_GP(); +} + + +// EOF src/lwip/eth_drv.c diff --git a/packages/io/eth/current/src/lwip/lw.diff b/packages/io/eth/current/src/lwip/lw.diff new file mode 100644 --- /dev/null +++ b/packages/io/eth/current/src/lwip/lw.diff @@ -0,0 +1,1466 @@ +diff -Nur lwip-0.5.3/proj/ecos/Makefile lwip.ecos/proj/ecos/Makefile +--- lwip-0.5.3/proj/ecos/Makefile Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/proj/ecos/Makefile Tue Apr 2 18:17:49 2002 +@@ -0,0 +1,76 @@ ++CCDEP=arm-elf-gcc ++CC=arm-elf-gcc ++AR=arm-elf-ar ++#CFLAGS=-g -Wall -DIPv4 -DLWIP_DEBUG ++#CFLAGS=-Wall -DIPv4 ++CFLAGS=-g -Wall -DIPv4 ++LDFLAGS=-nostdlib -L$(ECOSLIB) -Ttarget.ld -Wl,-static -Wl,--gc-sections -finit-priority ++LWIPARCH=ecos ++ARFLAGS=rs ++LWIPDIR=../../src ++ ++ECOSDIR=/home/jani/ecos/build/lwip/edb/install ++ECOSINC=$(ECOSDIR)/include ++ECOSLIB=$(ECOSDIR)/lib ++ ++CFLAGS:=$(CFLAGS) \ ++ -I$(LWIPDIR)/include -I$(LWIPDIR)/arch/$(LWIPARCH)/include -I$(LWIPDIR)/include/ipv4 \ ++ -Iapps -I$(ECOSINC) -I. ++ ++# COREFILES, CORE4FILES: The minimum set of files needed for lwIP. ++COREFILES=$(LWIPDIR)/core/mem.c $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c \ ++ $(LWIPDIR)/core/pbuf.c $(LWIPDIR)/core/stats.c $(LWIPDIR)/core/sys.c \ ++ $(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_input.c \ ++ $(LWIPDIR)/core/tcp_output.c $(LWIPDIR)/core/udp.c ++CORE4FILES=$(LWIPDIR)/core/ipv4/icmp.c $(LWIPDIR)/core/ipv4/ip.c \ ++ $(LWIPDIR)/core/inet.c $(LWIPDIR)/core/ipv4/ip_addr.c ++ ++ ++# APIFILES: The files which implement the sequential and socket APIs. ++APIFILES=$(LWIPDIR)/api/api_lib.c $(LWIPDIR)/api/api_msg.c $(LWIPDIR)/api/tcpip.c \ ++ $(LWIPDIR)/api/err.c $(LWIPDIR)/api/sockets.c ++ ++# NETIFFILES: Files implementing various generic network interface functions.' ++NETIFFILES= $(LWIPDIR)/netif/arp.c ++ ++# ARCHFILES: Architecture specific files. ++ARCHFILES=$(wildcard $(LWIPDIR)/arch/$(LWIPARCH)/*.c $(LWIPDIR)/arch/$(LWIPARCH)/netif/*.c) ++ ++ ++# APPFILES: Applications. ++APPFILES=apps/tcpecho.c apps/httpd.c apps/fs.c apps/udpecho.c apps/shell.c ++ ++# LWIPFILES: All the above. ++LWIPFILES=$(COREFILES) $(CORE4FILES) $(APIFILES) $(NETIFFILES) $(ARCHFILES) ++#LWIPFILESW=$(wildcard $(LWIPFILES)) ++#LWIPOBJS=$(notdir $(LWIPFILESW:.c=.o)) ++LWIPOBJS=$(notdir $(LWIPFILES:.c=.o)) ++ ++LWIPLIB=liblwip4.a ++APPLIB=liblwipapps.a ++APPOBJS=$(notdir $(APPFILES:.c=.o)) ++ ++%.o: ++ $(CC) $(CFLAGS) -c $(<:.o=.c) ++ ++all ipv4 compile: simhost ++.PHONY: all ++ ++clean: ++ rm -f *.o $(LWIPLIB) $(APPLIB) simhost *.s .depend* *.core core ++ ++depend dep: .depend ++ ++include .depend ++ ++$(APPLIB): $(APPOBJS) ++ $(AR) $(ARFLAGS) $(APPLIB) $? ++ ++$(LWIPLIB): $(LWIPOBJS) ++ $(AR) $(ARFLAGS) $(LWIPLIB) $? ++ ++.depend: simhost.c $(LWIPFILES) $(APPFILES) ++ $(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend ++ ++simhost: .depend $(LWIPLIB) $(APPLIB) simhost.o $(APPFILES) $(ECOSLIB)/libtarget.a ++ $(CC) $(CFLAGS) $(LDFLAGS) -o simhost simhost.o $(APPLIB) $(LWIPLIB) +diff -Nur lwip-0.5.3/proj/ecos/README lwip.ecos/proj/ecos/README +--- lwip-0.5.3/proj/ecos/README Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/proj/ecos/README Tue Apr 2 19:12:52 2002 +@@ -0,0 +1,21 @@ ++Building the test prog with ecos+lwip ++ ++I suppose you have a working ecos build with your target.... ++ ++There: ++ ++#ecosconfig add net_drivers ++and select lwip and unselect standalone driver and debugging ++(after patching io/eth's cdl script with ioeth.diff first to see lwIP as an option) ++and build the ecos libs as usual ++ ++ ++Here: ++ ++copy the files in unixsim/apps over here.Don't overwrite makefsdata or else the ++httpd data won't be aligned and won't work on platforms which require >1 alignment (ARM) ++ ++modify ECOSDIR in the Makefile to point to your ecos project dir ++#make ++and you should have an ecos exec with lwIP linked to it. ++ +diff -Nur lwip-0.5.3/proj/ecos/apps/makefsdata lwip.ecos/proj/ecos/apps/makefsdata +--- lwip-0.5.3/proj/ecos/apps/makefsdata Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/proj/ecos/apps/makefsdata Tue Apr 2 16:05:10 2002 +@@ -0,0 +1,70 @@ ++#!/usr/bin/perl ++ ++open(OUTPUT, "> fsdata.c"); ++ ++chdir("fs"); ++open(FILES, "find . -type f -o -name CVS -a -prune -type f |"); ++ ++while($file = ) { ++ ++ chop($file); ++ ++ open(HEADER, "> /tmp/header") || die $!; ++ print(HEADER "HTTP/1.0 200 OK\r\n"); ++ if($file =~ /\.html$/) { ++ print(HEADER "Content-Type: text/html\r\n"); ++ } elsif($file =~ /\.gif$/) { ++ print(HEADER "Content-Type: image/gif\r\n"); ++ } elsif($file =~ /\.png$/) { ++ print(HEADER "Content-Type: image/png\r\n"); ++ } elsif($file =~ /\.jpg$/) { ++ print(HEADER "Content-Type: image/jpeg\r\n"); ++ } else { ++ print(HEADER "Content-Type: text/plain\r\n"); ++ } ++ print(HEADER "\r\n"); ++ close(HEADER); ++ ++ system("cat /tmp/header $file > /tmp/file"); ++ ++ open(FILE, "/tmp/file"); ++ unlink("/tmp/file"); ++ unlink("/tmp/header"); ++ ++ $file =~ s/\.//; ++ $fvar = $file; ++ $fvar =~ s-/-_-g; ++ $fvar =~ s-\.-_-g; ++ print(OUTPUT "static const char data".$fvar."[] __attribute__ ((aligned)) = {\n"); ++ $i = 0; ++ while(read(FILE, $data, 1)) { ++ if($i == 0) { ++ print(OUTPUT "\t"); ++ } ++ printf(OUTPUT "%#02x, ", unpack("C", $data)); ++ $i++; ++ if($i == 10) { ++ print(OUTPUT "\n"); ++ $i = 0; ++ } ++ } ++ print(OUTPUT "};\n\n"); ++ close(FILE); ++ push(@fvars, $fvar); ++ push(@files, $file); ++} ++ ++for($i = 0; $i < @fvars; $i++) { ++ $file = $files[$i]; ++ $fvar = $fvars[$i]; ++ ++ if($i == 0) { ++ $prevfile = "NULL"; ++ } else { ++ $prevfile = "file" . $fvars[$i - 1]; ++ } ++ print(OUTPUT "static const struct fsdata_file file".$fvar."[] = {{$prevfile, \"$file\", "); ++ print(OUTPUT "data$fvar, sizeof(data$fvar)}};\n\n"); ++} ++ ++print(OUTPUT "#define FS_ROOT file$fvars[$i - 1]\n\n"); +diff -Nur lwip-0.5.3/proj/ecos/lwipopts.h lwip.ecos/proj/ecos/lwipopts.h +--- lwip-0.5.3/proj/ecos/lwipopts.h Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/proj/ecos/lwipopts.h Fri Mar 29 15:05:06 2002 +@@ -0,0 +1,174 @@ ++/* ++ * Copyright (c) 2001, Swedish Institute of Computer Science. ++ * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 is part of the lwIP TCP/IP stack. ++ * ++ * Author: Adam Dunkels ++ * ++ * $Id: lw.diff,v 1.1 2002/05/20 22:24:22 jlarmour Exp $ ++ */ ++#ifndef __LWIPOPTS_H__ ++#define __LWIPOPTS_H__ ++ ++/* ---------- Memory options ---------- */ ++/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which ++ lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 ++ byte alignment -> define MEM_ALIGNMENT to 2. */ ++#define MEM_ALIGNMENT 4 ++ ++/* MEM_SIZE: the size of the heap memory. If the application will send ++a lot of data that needs to be copied, this should be set high. */ ++#define MEM_SIZE 1000 ++ ++/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application ++ sends a lot of data out of ROM (or other static memory), this ++ should be set high. */ ++#define MEMP_NUM_PBUF 8 ++/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One ++ per active UDP "connection". */ ++#define MEMP_NUM_UDP_PCB 4 ++/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP ++ connections. */ ++#define MEMP_NUM_TCP_PCB 5 ++/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP ++ connections. */ ++#define MEMP_NUM_TCP_PCB_LISTEN 8 ++/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP ++ segments. */ ++#define MEMP_NUM_TCP_SEG 8 ++/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active ++ timeouts. */ ++#define MEMP_NUM_SYS_TIMEOUT 3 ++ ++ ++/* The following four are used only with the sequential API and can be ++ set to 0 if the application only will use the raw API. */ ++/* MEMP_NUM_NETBUF: the number of struct netbufs. */ ++#define MEMP_NUM_NETBUF 2 ++/* MEMP_NUM_NETCONN: the number of struct netconns. */ ++#define MEMP_NUM_NETCONN 4 ++/* MEMP_NUM_APIMSG: the number of struct api_msg, used for ++ communication between the TCP/IP stack and the sequential ++ programs. */ ++#define MEMP_NUM_API_MSG 8 ++/* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used ++ for sequential API communication and incoming packets. Used in ++ src/api/tcpip.c. */ ++#define MEMP_NUM_TCPIP_MSG 8 ++ ++/* These two control is reclaimer functions should be compiled ++ in. Should always be turned on (1). */ ++#define MEM_RECLAIM 1 ++#define MEMP_RECLAIM 1 ++ ++/* ---------- Pbuf options ---------- */ ++/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ ++#define PBUF_POOL_SIZE 6 ++ ++/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ ++#define PBUF_POOL_BUFSIZE 128 ++ ++/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a ++ link level header. */ ++#define PBUF_LINK_HLEN 16 ++ ++/* ---------- TCP options ---------- */ ++#define LWIP_TCP 1 ++#define TCP_TTL 255 ++ ++/* Controls if TCP should queue segments that arrive out of ++ order. Define to 0 if your device is low on memory. */ ++#define TCP_QUEUE_OOSEQ 1 ++ ++/* TCP Maximum segment size. */ ++#define TCP_MSS 128 ++ ++/* TCP sender buffer space (bytes). */ ++#define TCP_SND_BUF 256 ++ ++/* TCP sender buffer space (pbufs). This must be at least = 2 * ++ TCP_SND_BUF/TCP_MSS for things to work. */ ++#define TCP_SND_QUEUELEN 4 * TCP_SND_BUF/TCP_MSS ++ ++/* TCP receive window. */ ++#define TCP_WND 1024 ++ ++/* Maximum number of retransmissions of data segments. */ ++#define TCP_MAXRTX 12 ++ ++/* Maximum number of retransmissions of SYN segments. */ ++#define TCP_SYNMAXRTX 4 ++ ++/* ---------- ARP options ---------- */ ++#define ARP_TABLE_SIZE 10 ++ ++/* ---------- IP options ---------- */ ++/* Define IP_FORWARD to 1 if you wish to have the ability to forward ++ IP packets across network interfaces. If you are going to run lwIP ++ on a device with only one network interface, define this to 0. */ ++#define IP_FORWARD 1 ++ ++/* If defined to 1, IP options are allowed (but not parsed). If ++ defined to 0, all packets with IP options are dropped. */ ++#define IP_OPTIONS 1 ++ ++/* ---------- ICMP options ---------- */ ++#define ICMP_TTL 255 ++ ++ ++/* ---------- DHCP options ---------- */ ++/* Define LWIP_DHCP to 1 if you want DHCP configuration of ++ interfaces. DHCP is not implemented in lwIP 0.5.1, however, so ++ turning this on does currently not work. */ ++#define LWIP_DHCP 0 ++ ++/* 1 if you want to do an ARP check on the offered address ++ (recommended). */ ++#define DHCP_DOES_ARP_CHECK 1 ++ ++/* ---------- UDP options ---------- */ ++#define LWIP_UDP 1 ++#define UDP_TTL 255 ++ ++ ++/* ---------- Statistics options ---------- */ ++#define STATS ++ ++#ifdef STATS ++#define LINK_STATS ++#define IP_STATS ++#define ICMP_STATS ++#define UDP_STATS ++#define TCP_STATS ++#define MEM_STATS ++#define MEMP_STATS ++#define PBUF_STATS ++#define SYS_STATS ++#endif /* STATS */ ++ ++#endif /* __LWIPOPTS_H__ */ +diff -Nur lwip-0.5.3/proj/ecos/simhost.c lwip.ecos/proj/ecos/simhost.c +--- lwip-0.5.3/proj/ecos/simhost.c Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/proj/ecos/simhost.c Fri Mar 29 14:45:33 2002 +@@ -0,0 +1,141 @@ ++/* ++ * Copyright (c) 2001, Swedish Institute of Computer Science. ++ * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 is part of the lwIP TCP/IP stack. ++ * ++ * Author: Adam Dunkels ++ * ++ * $Id: lw.diff,v 1.1 2002/05/20 22:24:22 jlarmour Exp $ ++ */ ++ ++#include "lwip/debug.h" ++ ++#include ++ ++#include "lwip/opt.h" ++ ++#include "lwip/mem.h" ++#include "lwip/memp.h" ++#include "lwip/sys.h" ++ ++#include "lwip/stats.h" ++ ++#include "netif/ecosif.h" ++//#include "netif/loopif.h" ++ ++#include "lwip/tcpip.h" ++ ++#include "lwip/ip_addr.h" ++ ++#include "arch/perf.h" ++ ++#include "httpd.h" ++#include "tcpecho.h" ++#include "udpecho.h" ++#include "shell.h" ++ ++/*-----------------------------------------------------------------------------------*/ ++static void ++tcp_timeout(void *data) ++{ ++#if TCP_DEBUG ++ tcp_debug_print_pcbs(); ++#endif /* TCP_DEBUG */ ++ sys_timeout(5000, tcp_timeout, NULL); ++} ++/*-----------------------------------------------------------------------------------*/ ++static void ++tcpip_init_done(void *arg) ++{ ++ sys_sem_t *sem; ++ sem = arg; ++ sys_sem_signal(*sem); ++} ++/*-----------------------------------------------------------------------------------*/ ++static void ++main_thread(void *arg) ++{ ++ struct ip_addr ipaddr, netmask, gw; ++ sys_sem_t sem; ++ netif_init(); ++ ++ sem = sys_sem_new(0); ++ tcpip_init(tcpip_init_done, &sem); ++ sys_sem_wait(sem); ++ sys_sem_free(sem); ++ printf("TCP/IP initialized.\n"); ++ ++ IP4_ADDR(&gw, 192,168,1,1); ++ IP4_ADDR(&ipaddr, 192,168,1,99); ++ IP4_ADDR(&netmask, 255,255,255,0); ++ ++ netif_set_default(netif_add(&ipaddr, &netmask, &gw, ecosif_init, tcpip_input)); ++ IP4_ADDR(&gw, 127,0,0,1); ++ IP4_ADDR(&ipaddr, 127,0,0,1); ++ IP4_ADDR(&netmask, 255,0,0,0); ++ ++// netif_add(&ipaddr, &netmask, &gw, loopif_init, tcpip_input); ++// udpecho_init(); ++// shell_init(); ++// tcpecho_init(); ++ httpd_init(); ++ printf("Applications started.\n"); ++ /* Block for ever. */ ++ sem = sys_sem_new(0); ++ sys_sem_wait(sem); ++} ++/*-----------------------------------------------------------------------------------*/ ++int ++main(int argc, char **argv) ++{ ++#ifdef STATS ++ stats_init(); ++#endif /* STATS */ ++ sys_init(); ++ mem_init(); ++ memp_init(); ++ pbuf_init(); ++ ++ ++ ++ printf("System initialized.\n"); ++ ++ sys_thread_new((void *)(main_thread), (void*)"simhost"); ++ while(1) ++ {cyg_thread_delay(1000);} ++ return 0; ++} ++/*-----------------------------------------------------------------------------------*/ ++ ++ ++ ++ ++ ++ ++ ++ +diff -Nur lwip-0.5.3/src/arch/ecos/README lwip.ecos/src/arch/ecos/README +--- lwip-0.5.3/src/arch/ecos/README Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/README Tue Apr 2 19:17:23 2002 +@@ -0,0 +1,47 @@ ++eCos port of lwIP ++====================== ++ ++Introduction ++------------- ++This is a beta version of the lwIP port to eCos.It was tested on a Cirrus Logic ++EDB72111 board with ARM and it responds to ping and runs the unixsim apps(http,tcpecho,shell,etc) ++The motivation behind it is that the current TCP stack in eCos is too large both ++as code size and as memory footprint for a board with 128K FLASH + 128K RAM. ++BTW this port is just working it still need optimization. ++ ++Description ++------------ ++ ++The port consists of 3 main parts ++ ++I) the eCos specific sys_arch implemetation ++- src/arch/ecos/sys_arch.c ++- sys/arch/ecos/include/.... ++This maps lwIP semaphores, mailboxes and threads to their eCos counterparts ++along with the required header files defining endianness and primitive data types ++ ++II) the interface to the hw network drivers ++- io/eth/lwip/eth_drv.c in the eCos repository ++This part consists of a hardware independent net driver which glues eCos ++low-level ethernet drivers to the lwIP stack (modeled after the two such drivers ++existing in eCos : the standalone for RedBoot and the other one for the BSD stack) ++This driver implements the 3 callbacks needed by hw specific drivers. ++It currently uses the polling model like the standalone driver and not interrupts. ++This makes the whole thing less intrusive ++ ++III) the eCos specific lwIP netif ++- src/arch/ecos/netif/ecosif.c ++This file implements the lwIP netif model with init/input/output functions.This ++calls into and is called from eth_drv.c described above ++ ++Usage ++------- ++ ++The way to build an eCos app with lwIP is to just link the lwIP libs to your app and then ++the whole thing to libtarget.a from eCos as usual.So this way lwIP is more like part of you app ++than part of eCos.For an example of Makefile see the one in proj/ecos heavily based on ++unixim/ecos from the lwip distribution. ++ ++The organisation should change.Ideally there would be an eCos package ++to simply add to your project and configure just like any other package. ++ +diff -Nur lwip-0.5.3/src/arch/ecos/include/arch/cc.h lwip.ecos/src/arch/ecos/include/arch/cc.h +--- lwip-0.5.3/src/arch/ecos/include/arch/cc.h Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/include/arch/cc.h Thu Mar 14 23:23:00 2002 +@@ -0,0 +1,51 @@ ++/* ++ * Copyright (c) 2001, Swedish Institute of Computer Science. ++ * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 is part of the lwIP TCP/IP stack. ++ * ++ * Author: Adam Dunkels ++ * ++ * $Id: lw.diff,v 1.1 2002/05/20 22:24:22 jlarmour Exp $ ++ */ ++#ifndef __ARCH_CC_H__ ++#define __ARCH_CC_H__ ++ ++typedef unsigned char u8_t; ++typedef signed char s8_t; ++typedef unsigned short u16_t; ++typedef signed short s16_t; ++typedef unsigned long u32_t; ++typedef signed long s32_t; ++ ++ ++#define PACK_STRUCT_FIELD(x) x __attribute__((packed)) ++#define PACK_STRUCT_STRUCT __attribute__((packed)) ++#define PACK_STRUCT_BEGIN ++#define PACK_STRUCT_END ++ ++#endif /* __ARCH_CC_H__ */ +diff -Nur lwip-0.5.3/src/arch/ecos/include/arch/cpu.h lwip.ecos/src/arch/ecos/include/arch/cpu.h +--- lwip-0.5.3/src/arch/ecos/include/arch/cpu.h Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/include/arch/cpu.h Fri Mar 15 22:08:00 2002 +@@ -0,0 +1,44 @@ ++/* ++ * Copyright (c) 2001, Swedish Institute of Computer Science. ++ * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 is part of the lwIP TCP/IP stack. ++ * ++ * Author: Adam Dunkels ++ * ++ * $Id: lw.diff,v 1.1 2002/05/20 22:24:22 jlarmour Exp $ ++ */ ++#ifndef __ARCH_CPU_H__ ++#define __ARCH_CPU_H__ ++ ++#if (CYG_BYTEORDER == CYG_LSBFIRST) ++#define BYTE_ORDER LITTLE_ENDIAN ++#else ++#define BYTE_ORDER BIG_ENDIAN ++#endif ++ ++#endif /* __ARCH_CPU_H__ */ +diff -Nur lwip-0.5.3/src/arch/ecos/include/arch/init.h lwip.ecos/src/arch/ecos/include/arch/init.h +--- lwip-0.5.3/src/arch/ecos/include/arch/init.h Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/include/arch/init.h Wed Dec 12 00:00:00 2001 +@@ -0,0 +1,44 @@ ++/* ++ * Copyright (c) 2001, Swedish Institute of Computer Science. ++ * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 is part of the lwIP TCP/IP stack. ++ * ++ * Author: Adam Dunkels ++ * ++ * $Id: lw.diff,v 1.1 2002/05/20 22:24:22 jlarmour Exp $ ++ */ ++#ifndef __ARCH_INIT_H__ ++#define __ARCH_INIT_H__ ++ ++#define TCPIP_INIT_DONE(arg) sys_sem_signal(*(sys_sem_t *)arg) ++ ++#endif /* __ARCH_INIT_H__ */ ++ ++ ++ ++ +diff -Nur lwip-0.5.3/src/arch/ecos/include/arch/lib.h lwip.ecos/src/arch/ecos/include/arch/lib.h +--- lwip-0.5.3/src/arch/ecos/include/arch/lib.h Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/include/arch/lib.h Thu Mar 14 23:27:00 2002 +@@ -0,0 +1,38 @@ ++/* ++ * Copyright (c) 2001, Swedish Institute of Computer Science. ++ * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 is part of the lwIP TCP/IP stack. ++ * ++ * Author: Adam Dunkels ++ * ++ * $Id: lw.diff,v 1.1 2002/05/20 22:24:22 jlarmour Exp $ ++ */ ++#ifndef __ARCH_LIB_H__ ++#define __ARCH_LIB_H__ ++ ++#endif /* __ARCH_LIB_H__ */ +diff -Nur lwip-0.5.3/src/arch/ecos/include/arch/perf.h lwip.ecos/src/arch/ecos/include/arch/perf.h +--- lwip-0.5.3/src/arch/ecos/include/arch/perf.h Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/include/arch/perf.h Wed Dec 12 00:00:00 2001 +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 2001, Swedish Institute of Computer Science. ++ * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 is part of the lwIP TCP/IP stack. ++ * ++ * Author: Adam Dunkels ++ * ++ * $Id: lw.diff,v 1.1 2002/05/20 22:24:22 jlarmour Exp $ ++ */ ++#ifndef __PERF_H__ ++#define __PERF_H__ ++ ++#define PERF_START /* null definition */ ++#define PERF_STOP(x) /* null definition */ ++ ++#endif /* __PERF_H__ */ +diff -Nur lwip-0.5.3/src/arch/ecos/include/arch/sys_arch.h lwip.ecos/src/arch/ecos/include/arch/sys_arch.h +--- lwip-0.5.3/src/arch/ecos/include/arch/sys_arch.h Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/include/arch/sys_arch.h Thu Mar 14 23:53:00 2002 +@@ -0,0 +1,13 @@ ++#ifndef __SYS_ECOS_H__ ++#define __SYS_ECOS_H__ ++ ++#include ++ ++#define SYS_MBOX_NULL (sys_mbox_t)NULL ++#define SYS_SEM_NULL (sys_sem_t)NULL ++ ++typedef cyg_sem_t * sys_sem_t; ++typedef cyg_handle_t sys_mbox_t; ++typedef cyg_thread * sys_thread_t; ++#endif /* __SYS_ECOS_H__ */ ++ +diff -Nur lwip-0.5.3/src/arch/ecos/include/netif/ecosif.h lwip.ecos/src/arch/ecos/include/netif/ecosif.h +--- lwip-0.5.3/src/arch/ecos/include/netif/ecosif.h Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/include/netif/ecosif.h Tue Mar 19 23:38:00 2002 +@@ -0,0 +1,42 @@ ++/* ++ * Copyright (c) 2001, Swedish Institute of Computer Science. ++ * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 is part of the lwIP TCP/IP stack. ++ * ++ * Author: Adam Dunkels ++ * ++ * $Id: lw.diff,v 1.1 2002/05/20 22:24:22 jlarmour Exp $ ++ */ ++#ifndef __ECOSIF_H__ ++#define __ECOSIF_H__ ++ ++#include "lwip/netif.h" ++ ++void ecosif_init(struct netif *netif); ++ ++#endif /* __ECOSIF_H__ */ +diff -Nur lwip-0.5.3/src/arch/ecos/lib_arch.c lwip.ecos/src/arch/ecos/lib_arch.c +--- lwip-0.5.3/src/arch/ecos/lib_arch.c Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/lib_arch.c Wed Dec 12 00:00:00 2001 +@@ -0,0 +1,92 @@ ++/* ++ * Copyright (c) 2001, Swedish Institute of Computer Science. ++ * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 is part of the lwIP TCP/IP stack. ++ * ++ * Author: Adam Dunkels ++ * ++ * $Id: lw.diff,v 1.1 2002/05/20 22:24:22 jlarmour Exp $ ++ */ ++ ++/* These are generic implementations of various library functions used ++ * throughout the lwIP code. When porting, those should be optimized ++ * for the particular processor architecture, preferably coded in ++ * assembler. ++ */ ++ ++#include "lwip/arch.h" ++ ++u16_t ++htons(u16_t n) ++{ ++ return ((n & 0xff) << 8) | ((n & 0xff00) >> 8); ++} ++/*-----------------------------------------------------------------------------------*/ ++u16_t ++ntohs(u16_t n) ++{ ++ return htons(n); ++} ++/*-----------------------------------------------------------------------------------*/ ++u32_t ++htonl(u32_t n) ++{ ++ return ((n & 0xff) << 24) | ++ ((n & 0xff00) << 8) | ++ ((n & 0xff0000) >> 8) | ++ ((n & 0xff000000) >> 24); ++} ++/*-----------------------------------------------------------------------------------*/ ++u32_t ++ntohl(u32_t n) ++{ ++ return htonl(n); ++} ++/*-----------------------------------------------------------------------------------*/ ++void ++bcopy(const void *src, void *dst, unsigned int size) ++{ ++ char *csrc, *cdst; ++ unsigned int i; ++ ++ csrc = (char *)src; ++ cdst = dst; ++ ++ for(i = 0; i < size; ++i) { ++ cdst[i] = csrc[i]; ++ } ++} ++/*-----------------------------------------------------------------------------------*/ ++void ++bzero(void *s, int n) ++{ ++ for(--n ;n >= 0; --n) { ++ ((char *)s)[n] = 0; ++ } ++} ++/*-----------------------------------------------------------------------------------*/ +diff -Nur lwip-0.5.3/src/arch/ecos/netif/ecosif.c lwip.ecos/src/arch/ecos/netif/ecosif.c +--- lwip-0.5.3/src/arch/ecos/netif/ecosif.c Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/netif/ecosif.c Tue Apr 2 16:13:46 2002 +@@ -0,0 +1,327 @@ ++/* ++ * Copyright (c) 2001, Swedish Institute of Computer Science. ++ * 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 Institute 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 INSTITUTE 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 INSTITUTE 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 is part of the lwIP TCP/IP stack. ++ * ++ * Author: Adam Dunkels ++ * ++ * $Id: lw.diff,v 1.1 2002/05/20 22:24:22 jlarmour Exp $ ++ */ ++ ++#include "lwip/debug.h" ++ ++#include "lwip/opt.h" ++#include "lwip/def.h" ++#include "lwip/ip.h" ++#include "lwip/mem.h" ++#include "lwip/pbuf.h" ++#include "lwip/sys.h" ++ ++#include "netif/arp.h" ++ ++ ++#define IFNAME0 'c' ++#define IFNAME1 'y' ++ ++static const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}}; ++ ++struct ecosif { ++ struct eth_addr *ethaddr; ++ /* Add whatever per-interface state that is needed here. */ ++}; ++ ++static struct netif *this_netif; ++ ++/* Forward declarations. */ ++static void ecosif_input(struct netif *netif, char*buf, int len); ++static err_t ecosif_output(struct netif *netif, struct pbuf *p, ++ struct ip_addr *ipaddr); ++ ++/* Entry points in the eCos hw independent driver */ ++extern void eth_drv_write(char *, char *, int); ++extern void init_hw_drivers(unsigned char *hw_addr,void (*pig)(char *,int)); ++ ++/* ++ * This is called from eCos when data is read from the driver ++ */ ++void lwip_input(char *buf, int len) ++{ ++ ecosif_input((struct netif*)this_netif,buf,len); ++} ++ ++ ++extern void input_thread(void *arg); ++ ++static void ++low_level_init(struct netif *netif) ++{ ++ struct ecosif *ecosif; ++ ++ ecosif = netif->state; ++ ++ /* Init eCos low level driver which sets MAC address */ ++ init_hw_drivers((unsigned char *)ecosif->ethaddr->addr,lwip_input); ++ printf("MAC address : %X:%X:%X:%X:%X:%X\n", ++ (unsigned char)(ecosif->ethaddr->addr[0]), ++ (unsigned char)(ecosif->ethaddr->addr[1]), ++ (unsigned char)(ecosif->ethaddr->addr[2]), ++ (unsigned char)(ecosif->ethaddr->addr[3]), ++ (unsigned char)(ecosif->ethaddr->addr[4]), ++ (unsigned char)(ecosif->ethaddr->addr[5])); ++ sys_thread_new(input_thread,(void*)"poll_thread"); ++} ++/* ++ * low_level_output(): ++ * ++ * Should do the actual transmission of the packet. The packet is ++ * contained in the pbuf that is passed to the function. This pbuf ++ * might be chained.We pass the data down to the eCos hw independent ++ * ethernet driver ++ */ ++ ++static err_t ++low_level_output(struct ecosif *ecosif, struct pbuf *p) ++{ ++ struct pbuf *q; ++ char buf[1500]; ++ char *bufptr; ++ ++ /* initiate transfer(); */ ++ bufptr = &buf[0]; ++ ++ for(q = p; q != NULL; q = q->next) { ++ /* Send the data from the pbuf to the interface, one pbuf at a ++ time. The size of the data in each pbuf is kept in the ->len ++ variable. */ ++ /* send data from(q->payload, q->len); */ ++ bcopy(q->payload, bufptr, q->len); ++ bufptr += q->len; ++ } ++ ++ /* signal that packet should be sent(); */ ++ eth_drv_write(NULL, buf, p->tot_len); ++ return ERR_OK; ++} ++/*-----------------------------------------------------------------------------------*/ ++/* ++ * ecosif_output(): ++ * ++ * This function is called by the TCP/IP stack when an IP packet ++ * should be sent. It calls the function called low_level_output() to ++ * do the actuall transmission of the packet. ++ * ++ */ ++/*-----------------------------------------------------------------------------------*/ ++static err_t ++ecosif_output(struct netif *netif, struct pbuf *p, ++ struct ip_addr *ipaddr) ++{ ++ struct ecosif *ecosif; ++ struct pbuf *q; ++ struct eth_hdr *ethhdr; ++ struct eth_addr *dest, mcastaddr; ++ struct ip_addr *queryaddr; ++ err_t err; ++ u8_t i; ++ ++ ecosif = netif->state; ++ ++ /* Make room for Ethernet header. */ ++ if(pbuf_header(p, sizeof(struct eth_hdr)) != 0) { ++ /* The pbuf_header() call shouldn't fail, but we allocate an extra ++ pbuf just in case. */ ++ q = pbuf_alloc(PBUF_LINK, sizeof(struct eth_hdr), PBUF_RAM); ++ if(q == NULL) { ++ return ERR_MEM; ++ } ++ pbuf_chain(q, p); ++ p = q; ++ } ++ ++ /* Construct Ethernet header. Start with looking up deciding which ++ MAC address to use as a destination address. Broadcasts and ++ multicasts are special, all other addresses are looked up in the ++ ARP table. */ ++ queryaddr = ipaddr; ++ if(ip_addr_isany(ipaddr) || ++ ip_addr_isbroadcast(ipaddr, &(netif->netmask))) { ++ dest = (struct eth_addr *)ðbroadcast; ++ } else if(ip_addr_ismulticast(ipaddr)) { ++ /* Hash IP multicast address to MAC address. */ ++ mcastaddr.addr[0] = 0x01; ++ mcastaddr.addr[1] = 0x0; ++ mcastaddr.addr[2] = 0x5e; ++ mcastaddr.addr[3] = ip4_addr2(ipaddr) & 0x7f; ++ mcastaddr.addr[4] = ip4_addr3(ipaddr); ++ mcastaddr.addr[5] = ip4_addr4(ipaddr); ++ dest = &mcastaddr; ++ } else { ++ if(ip_addr_maskcmp(ipaddr, &(netif->ip_addr), &(netif->netmask))) { ++ /* Use destination IP address if the destination is on the same ++ subnet as we are. */ ++ queryaddr = ipaddr; ++ } else { ++ /* Otherwise we use the default router as the address to send ++ the Ethernet frame to. */ ++ queryaddr = &(netif->gw); ++ } ++ dest = arp_lookup(queryaddr); ++ } ++ ++ ++ /* If the arp_lookup() didn't find an address, we send out an ARP ++ query for the IP address. */ ++ if(dest == NULL) { ++ q = arp_query(netif, ecosif->ethaddr, queryaddr); ++ if(q != NULL) { ++ printf("Sending ARP after query\n"); ++ err = low_level_output(ecosif, q); ++ pbuf_free(q); ++ return err; ++ } ++ return ERR_MEM; ++ } ++ ethhdr = p->payload; ++ ++ for(i = 0; i < 6; i++) { ++ ethhdr->dest.addr[i] = dest->addr[i]; ++ ethhdr->src.addr[i] = ecosif->ethaddr->addr[i]; ++ } ++ ++ ethhdr->type = htons(ETHTYPE_IP); ++ ++ return low_level_output(ecosif, p); ++ ++} ++ ++ ++ ++/* ++ * ecosif_input(): ++ * This function is called when the eCos hw independent driver ++ * has some data to pass up to lwIP.It does it through lwip_input. ++ */ ++ ++static void ++ecosif_input(struct netif *netif, char * bufptr, int len) ++{ ++ struct ecosif *ecosif; ++ struct eth_hdr *ethhdr; ++ struct pbuf *p, *q; ++ ++ ecosif = netif->state; ++ /* We allocate a pbuf chain of pbufs from the pool. */ ++ p = pbuf_alloc(PBUF_LINK, len, PBUF_POOL); ++ ++ if(p != NULL) { ++ /* We iterate over the pbuf chain until we have read the entire ++ packet into the pbuf. */ ++ for(q = p; q != NULL; q = q->next) { ++ /* Read enough bytes to fill this pbuf in the chain. The ++ avaliable data in the pbuf is given by the q->len ++ variable. */ ++ /* read data into(q->payload, q->len); */ ++ bcopy(bufptr, q->payload, q->len); ++ bufptr += q->len; ++ } ++ /* acknowledge that packet has been read(); */ ++ } else { ++ /* drop packet(); */ ++ } ++ ++ if(p == NULL) { ++ DEBUGF(ECOSIF_DEBUG, ("ecosif_input: low_level_input returned NULL\n")); ++ return; ++ } ++ ethhdr = p->payload; ++ ++ switch(htons(ethhdr->type)) { ++ case ETHTYPE_IP: ++ DEBUGF(ECOSIF_DEBUG, ("ecosif_input: IP packet\n")); ++ arp_ip_input(netif, p); ++ pbuf_header(p, -14); ++#if LWIP_DEBUG ++ if(ip_lookup(p->payload, netif)) { ++#endif ++ netif->input(p, netif); ++#if LWIP_DEBUG ++ } else { ++ printf("ecosif_input: lookup failed!\n"); ++ } ++#endif ++ break; ++ case ETHTYPE_ARP: ++ DEBUGF(ECOSIF_DEBUG, ("ecosif_input: ARP packet\n")); ++ p = arp_arp_input(netif, ecosif->ethaddr, p); ++ if(p != NULL) { ++ DEBUGF(ECOSIF_DEBUG, ("ecosif_input: Sending ARP reply\n")); ++ low_level_output(ecosif, p); ++ pbuf_free(p); ++ } ++ break; ++ default: ++ pbuf_free(p); ++ break; ++ } ++} ++/*-----------------------------------------------------------------------------------*/ ++static void ++arp_timer(void *arg) ++{ ++ arp_tmr(); ++ sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler)arp_timer, NULL); ++} ++/*-----------------------------------------------------------------------------------*/ ++/* ++ * ecosif_init(): ++ * ++ * Should be called at the beginning of the program to set up the ++ * network interface. It calls the function low_level_init() to do the ++ * actual setup of the hardware. ++ * ++ */ ++/*-----------------------------------------------------------------------------------*/ ++void ++ecosif_init(struct netif *netif) ++{ ++ struct ecosif *ecosif; ++ ++ this_netif = netif; ++ ecosif = mem_malloc(sizeof(struct ecosif)); ++ netif->state = ecosif; ++ netif->name[0] = IFNAME0; ++ netif->name[1] = IFNAME1; ++ netif->output = ecosif_output; ++ ++ ecosif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); ++ low_level_init(netif); ++ arp_init(); ++ ++ sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler)arp_timer, NULL); ++} ++/*-----------------------------------------------------------------------------------*/ +diff -Nur lwip-0.5.3/src/arch/ecos/sys_arch.c lwip.ecos/src/arch/ecos/sys_arch.c +--- lwip-0.5.3/src/arch/ecos/sys_arch.c Thu Jan 1 02:00:00 1970 ++++ lwip.ecos/src/arch/ecos/sys_arch.c Tue Apr 2 19:05:58 2002 +@@ -0,0 +1,181 @@ ++/* ++ * This file implements the eCos specific sys_arch functions used by lwIP ++ */ ++ ++#include ++ ++#include "lwip/sys.h" ++#include "lwip/def.h" ++#include "lwip/debug.h" ++ ++//FIXME use CYG_HWR_whatever for RTC ++ ++/* lwIp timeouts are milliseconds, eCos time unit is clock tick */ ++//1s = 1000ms = 100ticks (eCos default is 100 tick per second for most(all?) platforms) ++#define tick_to_msec(tick) ((u16_t)(tick*10+1)) ++#define msec_to_tick(msec) ((cyg_tick_count_t)(msec+9)/10) ++ ++/* We use a common var mempool for allocating semaphores, mboxes and threads... */ ++#define VARMEMPOOLSIZE 0x4000 /* tunable */ ++static char memvar[VARMEMPOOLSIZE]; ++static cyg_mempool_var var_mempool; ++static cyg_handle_t var_mempool_h; ++ ++/* ...and a fix mempool for allocating thread stacks */ ++ ++#define LWIP_THREAD_STACK_SIZE 0x2000 /* tunable */ ++#define MAX_THREADS 4 /* tunable */ ++ ++static char memfix[LWIP_THREAD_STACK_SIZE * MAX_THREADS]; ++static cyg_mempool_fix fix_mempool; ++static cyg_handle_t fix_mempool_h; ++ ++/* List of threads: associate eCos thread info with lwIP timeout info */ ++struct lwip_thread { ++ struct lwip_thread * next; ++ struct sys_timeouts to; ++ cyg_handle_t th; ++ cyg_thread t; ++} *threads; ++ ++/*FIXME: the timeout struct used for non-lwIP threads -eCos ++ * there might be threads which are not created through ++ * sys_thread_new but access lwIP stuff (i.e. net interrupt) ++ * This must go away. ++ * */ ++struct sys_timeouts global_timeout; ++ ++/* Set up memory pools and threads*/ ++void sys_init(void) ++{ ++ cyg_mempool_var_create(memvar, sizeof(memvar), &var_mempool_h, &var_mempool); ++ ++ cyg_mempool_fix_create(memfix, sizeof(memfix), ++ LWIP_THREAD_STACK_SIZE, &fix_mempool_h, &fix_mempool); ++ threads = NULL; ++ global_timeout.next = NULL; ++} ++ ++/* Message boxes */ ++ ++sys_mbox_t sys_mbox_new(void) ++{ ++ cyg_mbox * mbox; ++ cyg_handle_t m; ++ mbox = (cyg_mbox *)cyg_mempool_var_alloc(var_mempool_h, sizeof(cyg_mbox)); ++ cyg_mbox_create(&m, mbox); ++ return m; ++} ++ ++void sys_mbox_free(sys_mbox_t mbox) ++{ ++ cyg_mbox_delete(mbox); ++} ++ ++//FIXME returns false maybe retry? ++void sys_mbox_post(sys_mbox_t mbox, void *data) ++{ ++#if 0 ++ if (cyg_mbox_put(mbox, data)==false) ++ printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaa\n"); ++#endif ++ cyg_mbox_put(mbox,data); ++} ++ ++u16_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **data, u16_t timeout) ++{ ++ void *d; ++ cyg_tick_count_t end_time, start_time,lool; ++ static int pig = 0; ++ if (timeout) { ++ start_time = cyg_current_time(); ++ lool = start_time + msec_to_tick(timeout); ++ d = cyg_mbox_timed_get(mbox, lool); ++ end_time = cyg_current_time(); ++ ++ if (d == NULL) ++ return 0; ++ } else { ++ d = cyg_mbox_get(mbox); ++ } ++ *data = d; ++ return tick_to_msec(end_time - start_time); ++} ++ ++/* Semaphores */ ++ ++sys_sem_t sys_sem_new(u8_t count) ++{ ++ sys_sem_t sem; ++ ++ sem = (cyg_sem_t *)cyg_mempool_var_alloc(var_mempool_h, sizeof(cyg_sem_t)); ++ cyg_semaphore_init(sem, count); ++ return sem; ++} ++ ++u16_t sys_arch_sem_wait(sys_sem_t sem, u16_t timeout) ++{ ++ cyg_bool_t r; ++ cyg_tick_count_t end_time, start_time; ++ ++ if (timeout) { ++ start_time = cyg_current_time(); ++ r = cyg_semaphore_timed_wait(sem, start_time + msec_to_tick(timeout)); ++ end_time = cyg_current_time(); ++ ++ if (r == false) ++ return 0; ++ } else { ++ cyg_semaphore_wait(sem); ++ } ++ ++ return tick_to_msec(end_time - start_time); ++} ++ ++void sys_sem_signal(sys_sem_t sem) ++{ ++ cyg_semaphore_post(sem); ++} ++ ++void sys_sem_free(sys_sem_t sem) ++{ ++ cyg_semaphore_destroy(sem); ++} ++ ++/* Thread creation */ ++ ++void sys_thread_new(void (*function) (void *arg), void *arg) ++{ ++ struct lwip_thread * nt; ++ void * stack; ++ ++ nt = (struct lwip_thread *)cyg_mempool_var_alloc(var_mempool_h, sizeof(struct lwip_thread)); ++ ++ nt->next = threads; ++ nt->to.next = NULL; ++ ++ threads = nt; ++ ++ stack = cyg_mempool_fix_alloc(fix_mempool_h); ++ ++ cyg_thread_create(12, (cyg_thread_entry_t *)function, (cyg_addrword_t)arg, ++ (char *)arg , stack, LWIP_THREAD_STACK_SIZE, &(nt->th), &(nt->t) ); ++ ++ cyg_thread_resume(nt->th); ++} ++ ++/* Find current thread's timeout info */ ++ ++struct sys_timeouts *sys_arch_timeouts(void) ++{ ++ cyg_handle_t ct; ++ struct lwip_thread *t; ++ ++ ct = cyg_thread_self(); ++ for(t = threads; t; t = t->next) ++ if (t->th == ct) ++ return &(t->to); ++ ++ printf("tmobad@@@@@\n"); ++ return &global_timeout; ++} diff --git a/packages/io/eth/current/src/net/eth_drv.c b/packages/io/eth/current/src/net/eth_drv.c --- a/packages/io/eth/current/src/net/eth_drv.c +++ b/packages/io/eth/current/src/net/eth_drv.c @@ -1,33 +1,42 @@ //========================================================================== // -// ecos/eth_drv.c +// src/net/eth_drv.c // // Hardware independent ethernet driver // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -75,8 +84,8 @@ #include // module configury; SIMULATED_FAILURES #include // CYGPKG_NET_FAST_THREAD_TICKLE_DEVS? -#include -#include +#include +#include #ifndef min #define min( _x_, _y_ ) ((_x_) < (_y_) ? (_x_) : (_y_)) @@ -265,19 +274,34 @@ simulate_fail_corrupt_sglist( struct eth #endif // CYGPKG_IO_ETH_DRIVERS_SIMULATED_FAILURES // ------------------------------------------------------------------------ -#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT) && defined(CYGPKG_IO_ETH_DRIVERS_WARN_FORCE_CONSOLE) +#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT #include // Use with care! Local variable defined! -#define START_CONSOLE() { \ - int _cur_console; \ - _cur_console = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); \ - CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGPKG_IO_ETH_DRIVERS_WARN_FORCE_CONSOLE_NUMBER) +#define START_CONSOLE() \ +{ /* NEW BLOCK */ \ + int _cur_console = \ + CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); \ + { \ + int i; \ + if ( CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, \ + "info_console_force", &i, \ + CYGNUM_FLASH_CFG_OP_CONFIG_BOOL ) ) { \ + if ( i ) { \ + if ( CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, \ + "info_console_number", &i, \ + CYGNUM_FLASH_CFG_OP_CONFIG_INT ) ) { \ + /* Then i is the console to force it to: */ \ + CYGACC_CALL_IF_SET_CONSOLE_COMM( i ); \ + } \ + } \ + } \ + } #define END_CONSOLE() \ - CYGACC_CALL_IF_SET_CONSOLE_COMM(_cur_console); \ -} + CYGACC_CALL_IF_SET_CONSOLE_COMM(_cur_console); \ +} /* END BLOCK */ #else #define START_CONSOLE() @@ -285,8 +309,14 @@ simulate_fail_corrupt_sglist( struct eth #endif // ------------------------------------------------------------------------ +#ifdef CYGPKG_NET_FREEBSD_STACK +extern char *_ioctl_name(u_long cmd); +typedef void void_fun(void *); +#endif + static int eth_drv_ioctl(struct ifnet *, u_long, caddr_t); static void eth_drv_send(struct ifnet *); +static void eth_drv_start(struct eth_drv_sc *sc); #ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG int cyg_io_eth_net_debug = CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY; @@ -308,23 +338,49 @@ static void eth_drv_init(struct eth_drv_sc *sc, unsigned char *enaddr) { struct ifnet *ifp = &sc->sc_arpcom.ac_if; +#ifdef CYGPKG_NET_FREEBSD_STACK + int unit; + char *np, *xp; +#endif // Set up hardware address if (NULL != enaddr) bcopy(enaddr, &sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); // Initialize ifnet structure - bcopy((void *)sc->dev_name, ifp->if_xname, IFNAMSIZ); ifp->if_softc = sc; ifp->if_start = eth_drv_send; ifp->if_ioctl = eth_drv_ioctl; - ifp->if_flags = - IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; +#ifdef IFF_NOTRAILERS + ifp->if_flags |= IFF_NOTRAILERS; +#endif +#ifdef CYGPKG_NET_FREEBSD_STACK + ifp->if_name = xp = ifp->if_xname; + np = (char *)sc->dev_name; + unit = 0; + while (*np && !((*np >= '0') && (*np <= '9'))) *xp++ = *np++; + if (*np) { + *xp = '\0'; + while (*np) { + unit = (unit * 10) + (*np++ - '0'); + } + ifp->if_unit = unit; + } + ifp->if_init = (void_fun *)eth_drv_start; + ifp->if_output = ether_output; +#else + bcopy((void *)sc->dev_name, ifp->if_xname, IFNAMSIZ); +#endif sc->state = 0; // Attach the interface +#ifdef CYGPKG_NET_FREEBSD_STACK + ether_ifattach(ifp, 0); +#else if_attach(ifp); ether_ifattach(ifp); +#endif #ifdef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG // Set up interfaces so debug environment can share this device @@ -370,13 +426,26 @@ static int eth_drv_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct eth_drv_sc *sc = ifp->if_softc; +#ifndef CYGPKG_NET_FREEBSD_STACK struct ifaddr *ifa = (struct ifaddr *) data; +#endif struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; +// DEBUG +#ifdef CYGPKG_NET_FREEBSD_STACK + log(LOG_IOCTL, "%s: cmd: %s, data:\n", __FUNCTION__, _ioctl_name(cmd)); + log_dump(LOG_IOCTL, data, 32); +#endif +// DEBUG + s = splnet(); +#ifdef CYGPKG_NET_FREEBSD_STACK + if ((error = ether_ioctl(ifp, cmd, data)) > 0) { +#else if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { +#endif splx(s); return error; } @@ -384,6 +453,7 @@ eth_drv_ioctl(struct ifnet *ifp, u_long switch (cmd) { case SIOCSIFADDR: +#ifndef CYGPKG_NET_FREEBSD_STACK // Now in if_ethersubr.c ifp->if_flags |= IFF_UP; switch (ifa->ifa_addr->sa_family) { @@ -397,6 +467,7 @@ eth_drv_ioctl(struct ifnet *ifp, u_long eth_drv_start(sc); break; } +#endif // CYGPKG_NET_FREEBSD_STACK break; case SIOCGIFHWADDR: @@ -456,24 +527,48 @@ eth_drv_ioctl(struct ifnet *ifp, u_long } break; -#if 0 +#ifdef CYGPKG_NET_FREEBSD_STACK case SIOCADDMULTI: case SIOCDELMULTI: - /* Update our multicast list. */ - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); + { + struct ifmultiaddr *ifma; + struct eth_drv_mc_list mc_list; + int mode = (ifp->if_flags & IFF_ALLMULTI) ? ETH_DRV_SET_MC_ALL : + ETH_DRV_SET_MC_LIST; - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - eth_drv_stop(sc); /* XXX for ds_setmcaf? */ - eth_drv_start(sc); - error = 0; +#ifdef DEBUG + log(LOG_ADDR, "%s Multi\n",(cmd == SIOCADDMULTI) ? "Add" : "Del"); +#endif + mc_list.len = 0; + LIST_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) { + continue; + } +#ifdef DEBUG + log_dump(LOG_ADDR, LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 6); +#endif + if ((LLADDR((struct sockaddr_dl *)ifma->ifma_addr)[0] & 0x01) == 0) { +#ifdef DEBUG + log(LOG_ADDR, "** Not a multicast address - ignored\n"); +#endif + continue; + } + if (mc_list.len < ETH_DRV_MAX_MC) { + bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), + mc_list.addrs[mc_list.len], ETHER_ADDR_LEN); + mc_list.len++; + } else { + mode = ETH_DRV_SET_MC_ALL; + } + } + // Note: drivers may behave like IFF_ALLMULTI if the list is + // more than their hardware can handle, e.g. some can only handle 1. + if ((sc->funs->control)(sc, mode, &mc_list, sizeof(mc_list))) { + diag_printf("Driver can't set multi-cast mode\n"); + error = EINVAL; } break; + } #endif default: @@ -677,7 +772,7 @@ eth_drv_recv(struct eth_drv_sc *sc, int struct ifnet *ifp = &sc->sc_arpcom.ac_if; struct ether_header _eh, *eh=&_eh; struct mbuf *top, **mp, *m; - int i, mlen; + int mlen; unsigned char *data; struct eth_drv_sg sg_list[MAX_ETH_DRV_SG]; int sg_len; @@ -695,15 +790,6 @@ eth_drv_recv(struct eth_drv_sc *sc, int // Our arithmetic below would go wrong return; -#ifdef CYGPKG_IO_ETH_DRIVERS_SIMULATED_FAILURES - if ( simulate_fail( sc, SIMULATE_FAIL_RECV ) ) { - // there is nothing we need to do; simply do not - // unload the packet - ifp->if_ierrors++; - return; - } -#endif - CYGARC_HAL_SAVE_GP(); // This is down here to make matching restore neat /* Pull packet off interface. */ @@ -789,6 +875,17 @@ eth_drv_recv(struct eth_drv_sc *sc, int (sc->funs->recv)(sc, sg_list, sg_len); #ifdef CYGPKG_IO_ETH_DRIVERS_SIMULATED_FAILURES + if ( simulate_fail( sc, SIMULATE_FAIL_RECV ) ) { + // toss the packet - note that some hardware gets + // fussy if the packet isn't "unloaded", thus we + // have to wait until now to throw it away + if (top) { + m_free(top); + } + ifp->if_ierrors++; + return; + } + if ( simulate_fail( sc, SIMULATE_FAIL_CORRUPT ) ) { // Corrupt the data simulate_fail_corrupt_sglist( sg_list, sg_len ); @@ -797,6 +894,7 @@ eth_drv_recv(struct eth_drv_sc *sc, int #ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG if (cyg_io_eth_net_debug) { + int i; START_CONSOLE(); for (i = 0; i < sg_len; i++) { if (sg_list[i].buf) { @@ -920,4 +1018,4 @@ eth_drv_netdev(char *name) } #endif // CYGPKG_IO_PCMCIA -// EOF eth_drv.c +// EOF src/net/eth_drv.c diff --git a/packages/io/eth/current/src/stand_alone/eth_drv.c b/packages/io/eth/current/src/stand_alone/eth_drv.c --- a/packages/io/eth/current/src/stand_alone/eth_drv.c +++ b/packages/io/eth/current/src/stand_alone/eth_drv.c @@ -1,33 +1,42 @@ //========================================================================== // -// eth_drv.c +// src/stand_alone/eth_drv.c // // Stand-alone hardware independent networking support for RedBoot // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -51,8 +60,8 @@ #include #include #include -#include -#include +#include +#include #include // High-level ethernet driver @@ -90,7 +99,41 @@ struct eth_drv_sc *__local_enet_sc; // tres degolas :-( // extern char __local_ip_addr[4]; -#endif +#endif // PASS_PACKETS + +#ifdef CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT +// +// Another horrible hack: In order to do the above passing on of +// application packets safely - and passing on completion events for +// pending transmissions (which is not conditional) - we must lock the +// application scheduler before calling into it. There are several reasons +// for this: a) We are likely running on a RedBoot special debug stack and +// so the application's stack checking fires; b) we could even get +// descheduled if the arrival of a packet causes a higher priority thread +// to awaken! + +#include + +// Use with care! Local variable defined! +# define LOCK_APPLICATION_SCHEDULER() \ +{ /* NEW BLOCK */ \ + threadref currthread; \ + int threadok; \ + threadok = dbg_currthread( &currthread ); \ + if ( threadok ) { \ + threadok = dbg_scheduler( &currthread, 1, 1 ); /* lock */ \ + } + +# define UNLOCK_APPLICATION_SCHEDULER() \ + if ( threadok ) { \ + dbg_scheduler( &currthread, 0, 1 ); /* unlock */ \ + } \ +} /* END BLOCK */ + +#else +# define LOCK_APPLICATION_SCHEDULER() CYG_EMPTY_STATEMENT +# define UNLOCK_APPLICATION_SCHEDULER() CYG_EMPTY_STATEMENT +#endif // GDB_THREAD_SUPPORT // // Buffer 'get' support. The problem is that this function only gets @@ -314,11 +357,13 @@ eth_drv_tx_done(struct eth_drv_sc *sc, C end_console(old_console); } #endif + LOCK_APPLICATION_SCHEDULER(); if (sc->funs->eth_drv_old) { (sc->funs->eth_drv_old->tx_done)(sc, key, status); } else { (sc->funs->eth_drv->tx_done)(sc, key, status); } + UNLOCK_APPLICATION_SCHEDULER(); } CYGARC_HAL_RESTORE_GP(); } @@ -470,7 +515,9 @@ eth_drv_recv(struct eth_drv_sc *sc, int eth_drv_copy_recv_buf = buf; // This calls into the 'other' driver, giving it a chance to // do something with this data (since it wasn't for us) + LOCK_APPLICATION_SCHEDULER(); (sc->funs->eth_drv_old->recv)(sc, total_len); + UNLOCK_APPLICATION_SCHEDULER(); sc->funs->recv = hold_recv; } } diff --git a/packages/io/fileio/current/ChangeLog b/packages/io/fileio/current/ChangeLog --- a/packages/io/fileio/current/ChangeLog +++ b/packages/io/fileio/current/ChangeLog @@ -1,3 +1,69 @@ +2002-04-11 Nick Garnett + + * doc/fileio.sgml: Added a section on writing a new + filesystem. This probably still needs more work, but it's better + than nothing. + +2002-04-05 Nick Garnett + + * src/devfs.cxx: Changed test for EAGAIN in dev_fo_read() and + dev_fo_write() to negate value first. + +2002-03-07 Nick Garnett + + * doc/fileio.sgml: Added this file to contain documentation on + this package. + +2002-02-04 Gary Thomas + + * tests/socket.c (main): + * tests/select.c (main): sin_len field must be set. + +2002-01-29 Jonathan Larmour + + * cdl/fileio.cdl: Actually, don't bother to build testfs.c at all. + +2002-01-29 Jesper Skov + + * cdl/fileio.cdl: Added CYGPKG_FILEIO_BUILD_TESTS option and made + building of testfs dependant on it. + +2002-01-25 Jonathan Larmour + + * include/inode.h: New API defining a common generic inode type. + * src/inocache.cxx: Implement the inode cache functions. + * cdl/fileio.cdl: (Configurably) build it. + +2002-01-23 David Woodhouse +2002-01-23 Jonathan Larmour + + * cdl/fileio.cdl: Remove select compilation and support to new + CYGFUN_IO_FILEIO_SELECT option conditional on the kernel + Ditto for DEVS and CYGPKG_IO_FILEIO_DEVFS_SUPPORT. + Make CYGPKG_IO_FILEIO_SOCKET_SUPPORT also conditional on kernel. + * src/fio.h: Define FILEIO_MUTEX_LOCK() and FILEIO_MUTEX_UNLOCK() + so that code doesn't need to care whether the kernel is included or + not. + * src/fd.cxx: Conditionalize mutex usage throughout on CYGPKG_KERNEL, + and FILEIO_MUTEX_LOCK()/UNLOCK(). + * src/file.cxx: Ditto. + * src/misc.cxx: Ditto. + (cyg_timestamp): Only use Cyg_Clock implementation if CYGPKG_KERNEL. + +2002-01-23 Jonathan Larmour + + * src/misc.cxx: Initialize fileio_initializer at prio CYG_INIT_IO_FS + so it happens after the devices it depends on. + * src/file.cxx (getcwd_lock): Ditto. + * src/select.cxx (select_mutex): ditto. + (selwait): ditto. + * src/fd.cxx (fdlock): ditto + (file_lock): ditto. + * src/dir.cxx (readdir): Use FILEIO_RETURN_VALUE on exit. + (readdir_r): Ditto. + * src/devfs.cxx (dev_stat): Don't use handle for st_dev - it will + probably be truncated. + 2002-01-04 Wade Jensen 2002-01-04 Jonathan Larmour diff --git a/packages/io/fileio/current/cdl/fileio.cdl b/packages/io/fileio/current/cdl/fileio.cdl --- a/packages/io/fileio/current/cdl/fileio.cdl +++ b/packages/io/fileio/current/cdl/fileio.cdl @@ -5,29 +5,38 @@ # FILEIO layer configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # @@ -45,7 +54,6 @@ cdl_package CYGPKG_IO_FILEIO { layer that implements IEEE 1003.1 file IO." include_dir cyg/fileio - requires CYGPKG_KERNEL requires CYGPKG_ISOINFRA requires CYGPKG_ERROR requires CYGINT_ISO_ERRNO @@ -55,17 +63,38 @@ cdl_package CYGPKG_IO_FILEIO { implements CYGINT_ISO_FCNTL implements CYGINT_ISO_OPEN implements CYGINT_ISO_DIRENT - implements CYGINT_ISO_SELECT requires { CYGBLD_ISO_DIRENT_HEADER == "" } requires { CYGBLD_ISO_OPEN_MAX_HEADER == "" } - compile fd.cxx file.cxx io.cxx select.cxx dir.cxx - compile -library=libextras.a devfs.cxx misc.cxx + compile fd.cxx file.cxx io.cxx dir.cxx + compile -library=libextras.a misc.cxx + + cdl_option CYGFUN_IO_FILEIO_SELECT { + display "Enable support for select()" + active_if CYGPKG_KERNEL + implements CYGINT_ISO_SELECT + default_value 1 + description " + This option enables support for select()." + + compile select.cxx + } + + cdl_option CYGPKG_IO_FILEIO_DEVFS_SUPPORT { + display "Enable devfs support" + active_if CYGPKG_IO + default_value { CYGPKG_REDBOOT ? 0 : 1 } + description " + This option enables support for the devfs file system." + + compile -library=libextras.a devfs.cxx + } cdl_option CYGPKG_IO_FILEIO_SOCKET_SUPPORT { display "Enable socket support" active_if CYGPKG_NET + active_if CYGPKG_KERNEL default_value 1 description " This option enables support for the socket interface. It is @@ -146,6 +175,28 @@ cdl_package CYGPKG_IO_FILEIO { FS_INFO_GETCWD key. " } + cdl_component CYGPKG_IO_FILEIO_INODE { + display "Generic inode support" + flavor bool + description "This option enables generic inode support useful to + some filesystems. Not all filesystems require this + so it is not enabled by default." + default_value 0 + requires CYGINT_ISO_MALLOC + compile inocache.cxx + + cdl_option CYGNUM_IO_FILEIO_MAX_INODE_CACHE_DEAD { + display "Maximum space for unused cached inodes" + flavor data + default_value 10 + description "The inode cache allows a maximum limit to be set + for the number of unused inodes still in the + cache before they are freed. It may be set to 0 + to indicate no dead inode caching should be + provided." + } + } + # ---------------------------------------------------------------- # Tests @@ -153,7 +204,7 @@ cdl_package CYGPKG_IO_FILEIO { display "Fileio tests" flavor data no_define - calculated { "tests/testfs.c tests/fileio1.c tests/socket.c tests/select.c tests/stdio.c" } + calculated { "tests/fileio1.c tests/socket.c tests/select.c tests/stdio.c" } description " This option specifies the set of tests for the FileIO package." } diff --git a/packages/io/fileio/current/doc/fileio.sgml b/packages/io/fileio/current/doc/fileio.sgml new file mode 100644 --- /dev/null +++ b/packages/io/fileio/current/doc/fileio.sgml @@ -0,0 +1,1165 @@ + +File System Support Infrastructure + + + + +Introduction + + +This document describes the filesystem infrastructure provided in +eCos. This is implemented by the FILEIO package and provides POSIX +compliant file and IO operations together with the BSD socket +API. These APIs are described in the relevant standards and original +documentation and will not be described here. See for details of which parts of the +POSIX standard are supported. + + + +This document is concerned with the interfaces presented to client +filesystems and network protocol stacks. + + + +The FILEIO infrastructure consist mainly of a set of tables containing +pointers to the primary interface functions of a file system. This +approach avoids problems of namespace pollution (for example several +filesystems can have a function called read(), so long as they are +static). The system is also structured to eliminate the need for +dynamic memory allocation. + + + +New filesystems can be written directly to the interfaces described +here. Existing filesystems can be ported very easily by the +introduction of a thin veneer porting layer that translates FILEIO +calls into native filesystem calls. + + + +The term filesystem should be read fairly loosely in this +document. Object accessed through these interfaces could equally be +network protocol sockets, device drivers, fifos, message queues or any +other object that can present a file-like interface. + + + + + + + + +File System Table + + +The filesystem table is an array of entries that describe each +filesystem implementation that is part of the system image. Each +resident filesystem should export an entry to this table using the +FSTAB_ENTRY() macro. + + + +Note + +At present we do not support dynamic addition or removal of table +entries. However, an API similar to mount() would +allow new entries to be added to the table. + + + + +The table entries are described by the following structure: + + + +struct cyg_fstab_entry +{ + const char *name; // filesystem name + CYG_ADDRWORD data; // private data value + cyg_uint32 syncmode; // synchronization mode + + int (*mount) ( cyg_fstab_entry *fste, cyg_mtab_entry *mte ); + int (*umount) ( cyg_mtab_entry *mte ); + int (*open) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int mode, cyg_file *fte ); + int (*unlink) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); + int (*mkdir) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); + int (*rmdir) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); + int (*rename) ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, + cyg_dir dir2, const char *name2 ); + int (*link) ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, + cyg_dir dir2, const char *name2, int type ); + int (*opendir) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + cyg_file *fte ); + int (*chdir) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + cyg_dir *dir_out ); + int (*stat) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + struct stat *buf); + int (*getinfo) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int key, char *buf, int len ); + int (*setinfo) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int key, char *buf, int len ); +}; + + + +The name field points to a string that +identifies this filesystem implementation. Typical values might be +"romfs", "msdos", "ext2" etc. + + + +The data field contains any private data +that the filesystem needs, perhaps the root of its data structures. + + + +The syncmode field contains a description of +the locking protocol to be used when accessing this filesystem. It +will be described in more detail in . + + + +The remaining fields are pointers to functions that implement +filesystem operations that apply to files and directories as whole +objects. The operation implemented by each function should be obvious +from the names, with a few exceptions: + + + +The opendir() function pointer opens a directory +for reading. See for details. + + + +The getinfo() and +setinfo() function pointers provide support for +various minor control and information functions such as +pathconf() and access(). + + + +With the exception of the mount() and +umount() functions, all of these functions +take three standard arguments, a pointer to a mount table entry (see +later) a directory pointer (also see later) and a file name relative +to the directory. These should be used by the filesystem to locate the +object of interest. + + + + + + + + +Mount Table + + +The mount table records the filesystems that are actually active. +These can be seen as being analogous to mount points in Unix systems. + + + +There are two sources of mount table entries. Filesystems (or other +components) may export static entries to the table using the +MTAB_ENTRY() macro. Alternatively, new entries may +be installed at run time using the mount() +function. Both types of entry may be unmounted with the +umount() function. + + + +A mount table entry has the following structure: + + + +struct cyg_mtab_entry +{ + const char *name; // name of mount point + const char *fsname; // name of implementing filesystem + const char *devname; // name of hardware device + CYG_ADDRWORD data; // private data value + cyg_bool valid; // Valid entry? + cyg_fstab_entry *fs; // pointer to fstab entry + cyg_dir root; // root directory pointer +}; + + + +The name field identifies the mount +point. This is used to direct rooted filenames (filenames that +begin with "/") to the correct filesystem. When a file +name that begins with "/" is submitted, it is matched +against the name fields of all valid mount +table entries. The entry that yields the longest match terminating +before a "/", or end of string, wins and the appropriate +function from the filesystem table entry is then passed the remainder +of the file name together with a pointer to the table entry and the +value of the root field as the directory +pointer. + + + +For example, consider a mount table that contains the following +entries: + + + + { "/", "msdos", "/dev/hd0", ... } + { "/fd", "msdos", "/dev/fd0", ... } + { "/rom", "romfs", "", ... } + { "/tmp", "ramfs", "", ... } + { "/dev", "devfs", "", ... } + + + +An attempt to open "/tmp/foo" would be directed to the RAM +filesystem while an open of "/bar/bundy" would be directed +to the hard disc MSDOS filesystem. Opening "/dev/tty0" would +be directed to the device management filesystem for lookup in the +device table. + + + +Unrooted file names (those that do not begin with a '/') are passed +straight to the filesystem that contains the current directory. The +current directory is represented by a pair consisting of a mount table +entry and a directory pointer. + + + +The fsname field points to a string that +should match the name field of the +implementing filesystem. During initialization the mount table is +scanned and the fsname entries looked up in +the filesystem table. For each match, the filesystem's _mount_ +function is called and if successful the mount table entry is marked +as valid and the fs pointer installed. + + + +The devname field contains the name of the +device that this filesystem is to use. This may match an entry in the +device table (see later) or may be a string that is specific to the +filesystem if it has its own internal device drivers. + + + +The data field is a private data value. This +may be installed either statically when the table entry is defined, or +may be installed during the mount() operation. + + + +The valid field indicates whether this mount +point has actually been mounted successfully. Entries with a false +valid field are ignored when searching for a +name match. + + + +The fs field is installed after a successful +mount() operation to point to the implementing +filesystem. + + + +The root field contains a directory pointer +value that the filesystem can interpret as the root of its directory +tree. This is passed as the dir argument of +filesystem functions that operate on rooted filenames. This field must +be initialized by the filesystem's mount() +function. + + + + + + + + +File Table + + +Once a file has been opened it is represented by an open file +object. These are allocated from an array of available file +objects. User code accesses these open file objects via a second array +of pointers which is indexed by small integer offsets. This gives the +usual Unix file descriptor functionality, complete with the various +duplication mechanisms. + + + +A file table entry has the following structure: + + + +struct CYG_FILE_TAG +{ + cyg_uint32 f_flag; /* file state */ + cyg_uint16 f_ucount; /* use count */ + cyg_uint16 f_type; /* descriptor type */ + cyg_uint32 f_syncmode; /* synchronization protocol */ + struct CYG_FILEOPS_TAG *f_ops; /* file operations */ + off_t f_offset; /* current offset */ + CYG_ADDRWORD f_data; /* file or socket */ + CYG_ADDRWORD f_xops; /* extra type specific ops */ + cyg_mtab_entry *f_mte; /* mount table entry */ +}; + + + +The f_flag field contains some FILEIO +control bits and some bits propagated from the +flags argument of the +open() call (defined by +CYG_FILE_MODE_MASK). + + + +The f_ucount field contains a use count that +controls when a file will be closed. Each duplicate in the file +descriptor array counts for one reference here. It is also +incremented around each I/O operation to ensure that the file cannot +be closed while it has current I/O operations. + + + +The f_type field indicates the type of the +underlying file object. Some of the possible values here are +CYG_FILE_TYPE_FILE, +CYG_FILE_TYPE_SOCKET or CYG_FILE_TYPE_DEVICE. + + + +The f_syncmode field is copied from the +syncmode field of the implementing +filesystem. Its use is described in . + + + +The f_offset field records the current file +position. It is the responsibility of the file operation functions to +keep this field up to date. + + + +The f_data field contains private data +placed here by the underlying filesystem. Normally this will be a +pointer to, or handle on, the filesystem object that implements this +file. + + + +The f_xops field contains a pointer to any +extra type specific operation functions. For example, the socket I/O +system installs a pointer to a table of functions that implement the +standard socket operations. + + + +The f_mte field contains a pointer to the +parent mount table entry for this file. It is used mainly to implement +the synchronization protocol. This may contain a pointer to some other +data structure in file objects not derived from a filesystem. + + + +The f_ops field contains a pointer to a +table of file I/O operations. This has the following structure: + + + +struct CYG_FILEOPS_TAG +{ + int (*fo_read) (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); + int (*fo_write) (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); + int (*fo_lseek) (struct CYG_FILE_TAG *fp, off_t *pos, int whence ); + int (*fo_ioctl) (struct CYG_FILE_TAG *fp, CYG_ADDRWORD com, + CYG_ADDRWORD data); + int (*fo_select) (struct CYG_FILE_TAG *fp, int which, CYG_ADDRWORD info); + int (*fo_fsync) (struct CYG_FILE_TAG *fp, int mode ); + int (*fo_close) (struct CYG_FILE_TAG *fp); + int (*fo_fstat) (struct CYG_FILE_TAG *fp, struct stat *buf ); + int (*fo_getinfo) (struct CYG_FILE_TAG *fp, int key, char *buf, int len ); + int (*fo_setinfo) (struct CYG_FILE_TAG *fp, int key, char *buf, int len ); +}; + + + +It should be obvious from the names of most of these functions what +their responsibilities are. The fo_getinfo() +and fo_setinfo() function pointers, like their +counterparts in the filesystem structure, implement minor control and +info functions such as fpathconf(). + + + +The second argument to the fo_read() and +fo_write() function pointers is a pointer to a +UIO structure: + + + +struct CYG_UIO_TAG +{ + struct CYG_IOVEC_TAG *uio_iov; /* pointer to array of iovecs */ + int uio_iovcnt; /* number of iovecs in array */ + off_t uio_offset; /* offset into file this uio corresponds to */ + ssize_t uio_resid; /* residual i/o count */ + enum cyg_uio_seg uio_segflg; /* see above */ + enum cyg_uio_rw uio_rw; /* see above */ +}; + +struct CYG_IOVEC_TAG +{ + void *iov_base; /* Base address. */ + ssize_t iov_len; /* Length. */ +}; + + + +This structure encapsulates the parameters of any data transfer +operation. It provides support for scatter/gather operations and +records the progress of any data transfer. It is also compatible with +the I/O operations of any BSD-derived network stacks and filesystems. + + + +When a file is opened (or a file object created by some other means, +such as socket() or accept()) it is the +responsibility of the filesystem open operation to initialize all the +fields of the object except the f_ucount, +f_syncmode and +f_mte fields. Since the +f_flag field will already contain bits belonging to the FILEIO +infrastructure, any changes to it must be made with the appropriate +logical operations. + + + + + + + + +Directories + + +Filesystem operations all take a directory pointer as one of their +arguments. A directory pointer is an opaque handle managed by the +filesystem. It should encapsulate a reference to a specific directory +within the filesystem. For example, it may be a pointer to the data +structure that represents that directory (such as an inode), or a +pointer to a pathname for the directory. + + + +The chdir() filesystem function pointer has two +modes of use. When passed a pointer in the +dir_out argument, it should locate the named +directory and place a directory pointer there. If the +dir_out argument is NULL then the +dir argument is a previously generated +directory pointer that can now be disposed of. When the infrastructure +is implementing the chdir() function it makes two +calls to filesystem chdir() functions. The first +is to get a directory pointer for the new current directory. If this +succeeds the second is to dispose of the old current directory +pointer. + + + +The opendir() function is used to open a +directory for reading. This results in an open file object that can be +read to return a sequence of struct dirent +objects. The only operations that are allowed on this file are +read, lseek and +close. Each read operation on this file should +return a single struct dirent object. When +the end of the directory is reached, zero should be returned. The only +seek operation allowed is a rewind to the start of the directory, by +supplying an offset of zero and a whence +specifier of SEEK_SET. + + + +Most of these considerations are invisible to clients of a filesystem +since they will access directories via the POSIX +opendir(), readdir() and +closedir() functions. + + + +Support for the getcwd() function is provided by +three mechanisms. The first is to use the +FS_INFO_GETCWD getinfo key on the filesystem to use +any internal support that it has for this. If that fails it falls back +on one of the two other mechanisms. If +CYGPKG_IO_FILEIO_TRACK_CWD is set then the current +directory is tracked textually in chdir() and the result of that is +reported in getcwd(). Otherwise an attempt is made to traverse the +directory tree to its root using ".." entries. + + + +This last option is complicated and expensive, and relies on the +filesystem supporting "." and ".." entries. This is not always the +case, particularly if the filesystem has been ported from a +non-UNIX-compatible source. Tracking the pathname textually will +usually work, but might not produce optimum results when symbolic +links are being used. + + + + + + + + +Synchronization + + +The FILEIO infrastructure provides a synchronization mechanism for +controlling concurrent access to filesystems. This allows existing +filesystems to be ported to eCos, even if they do not have their own +synchronization mechanisms. It also allows new filesystems to be +implemented easily without having to consider the synchronization +issues. + + + +The infrastructure maintains a mutex for each entry in each of +the main tables: filesystem table, mount table and file table. For +each class of operation each of these mutexes may be locked before the +corresponding filesystem operation is invoked. + + + +The synchronization protocol required by a filesystem is described +by the syncmode field of the filesystem +table entry. This is a combination of the following flags: + + + + +CYG_SYNCMODE_FILE_FILESYSTEM + + +Lock the filesystem table entry mutex +during all filesystem level operations. + + + + + +CYG_SYNCMODE_FILE_MOUNTPOINT + + +Lock the mount table entry mutex +during all filesystem level operations. + + + + + +CYG_SYNCMODE_IO_FILE + + +Lock the file table entry mutex during all +I/O operations. + + + + + +CYG_SYNCMODE_IO_FILESYSTEM + + +Lock the filesystem table entry mutex during all I/O operations. + + + + + +CYG_SYNCMODE_IO_MOUNTPOINT + +Lock the mount table entry mutex during all I/O operations. + + + + + +CYG_SYNCMODE_SOCK_FILE + + +Lock the file table entry mutex during all socket operations. + + + + + +CYG_SYNCMODE_SOCK_NETSTACK + + +Lock the network stack table entry mutex during all socket operations. + + + + + +CYG_SYNCMODE_NONE + + +Perform no locking at all during any operations. + + + + + + + +The value of the syncmode field in the +filesystem table entry will be copied by the infrastructure to the +open file object after a successful open() operation. + + + + + + + + +Initialization and Mounting + + +As mentioned previously, mount table entries can be sourced from two +places. Static entries may be defined by using the +MTAB_ENTRY() macro. Such entries will be +automatically mounted on system startup. For each entry in the mount +table that has a non-null name field the +filesystem table is searched for a match with the +fsname field. If a match is found the +filesystem's mount entry is called and if +successful the mount table entry marked valid and the +fs field initialized. The +mount() function is responsible for initializing +the root field. + + + + +The size of the mount table is defined by the configuration value +CYGNUM_FILEIO_MTAB_MAX. Any entries that have not +been statically defined are available for use by dynamic mounts. + + + +A filesystem may be mounted dynamically by calling mount(). This +function has the following prototype: + + + +int mount( const char *devname, + const char *dir, + const char *fsname); + + + +The devname argument identifies a device that +will be used by this filesystem and will be assigned to the +devname field of the mount table entry. + + + +The dir argument is the mount point name, it +will be assigned to the name field of the +mount table entry. + + + +The fsname argument is the name of the +implementing filesystem, it will be assigned to the +fsname entry of the mount table entry. + + + +The process of mounting a filesystem dynamically is as follows. First +a search is made of the mount table for an entry with a NULL +name field to be used for the new mount +point. The filesystem table is then searched for an entry whose name +matches fsname. If this is successful then +the mount table entry is initialized and the filesystem's +mount() operation called. If this is successful, +the mount table entry is marked valid and the +fs field initialized. + + + +Unmounting a filesystem is done by the umount() +function. This can unmount filesystems whether they were mounted +statically or dynamically. + + + +The umount() function has the following prototype: + + + +int umount( const char *name ); + + + +The mount table is searched for a match between the +name argument and the entry +name field. When a match is found the +filesystem's umount() operation is called and if +successful, the mount table entry is invalidated by setting its +valid field false and the +name field to NULL. + + + + + + + + + + +Sockets + + +If a network stack is present, then the FILEIO infrastructure also +provides access to the standard BSD socket calls. + + + +The netstack table contains entries which describe the network +protocol stacks that are in the system image. Each resident stack +should export an entry to this table using the +NSTAB_ENTRY() macro. + + + +Each table entry has the following structure: + + + +struct cyg_nstab_entry +{ + cyg_bool valid; // true if stack initialized + cyg_uint32 syncmode; // synchronization protocol + char *name; // stack name + char *devname; // hardware device name + CYG_ADDRWORD data; // private data value + + int (*init)( cyg_nstab_entry *nste ); + int (*socket)( cyg_nstab_entry *nste, int domain, int type, + int protocol, cyg_file *file ); +}; + + + +This table is analogous to a combination of the filesystem and mount +tables. + + + +The valid field is set +true if the stack's init() +function returned successfully and the +syncmode field contains the +CYG_SYNCMODE_SOCK_* bits described above. + + + + + +The name field contains the name of the +protocol stack. + + + + + +The devname field names the device that the stack is using. This may +reference a device under "/dev", or may be a name that is only +meaningful to the stack itself. + + + + + +The init() function pointer is called during +system initialization to start the protocol stack running. If it +returns non-zero the valid field is set +false and the stack will be ignored subsequently. + + + +The socket() function is called to attempt to create a socket in the +stack. When the socket() API function is called the netstack table is +scanned and for each valid entry the socket() +function pointer is called. If +this returns non-zero then the scan continues to the next valid stack, +or terminates with an error if the end of the table is reached. + + + +The result of a successful socket call is an initialized file object +with the f_xops field pointing to the +following structure: + + + +struct cyg_sock_ops +{ + int (*bind) ( cyg_file *fp, const sockaddr *sa, socklen_t len ); + int (*connect) ( cyg_file *fp, const sockaddr *sa, socklen_t len ); + int (*accept) ( cyg_file *fp, cyg_file *new_fp, + struct sockaddr *name, socklen_t *anamelen ); + int (*listen) ( cyg_file *fp, int len ); + int (*getname) ( cyg_file *fp, sockaddr *sa, socklen_t *len, int peer ); + int (*shutdown) ( cyg_file *fp, int flags ); + int (*getsockopt)( cyg_file *fp, int level, int optname, + void *optval, socklen_t *optlen); + int (*setsockopt)( cyg_file *fp, int level, int optname, + const void *optval, socklen_t optlen); + int (*sendmsg) ( cyg_file *fp, const struct msghdr *m, + int flags, ssize_t *retsize ); + int (*recvmsg) ( cyg_file *fp, struct msghdr *m, + socklen_t *namelen, ssize_t *retsize ); +}; + + + +It should be obvious from the names of these functions which API calls +they provide support for. The getname() function +pointer provides support for both getsockname() +and getpeername() while the +sendmsg() and recvmsg() +function pointers provide support for send(), +sendto(), sendmsg(), +recv(), recvfrom() and +recvmsg() as appropriate. + + + + + + + + +Select + + +The infrastructure provides support for implementing a select +mechanism. This is modeled on the mechanism in the BSD kernel, but has +been modified to make it implementation independent. + + + +The main part of the mechanism is the select() +API call. This processes its arguments and calls the +fo_select() function pointer on all file objects +referenced by the file descriptor sets passed to it. If the same +descriptor appears in more than one descriptor set, the +fo_select() function will be called separately +for each appearance. + + + +The which argument of the +fo_select() function will either be +CYG_FREAD to test for read conditions, +CYG_FWRITE to test for write conditions or zero to +test for exceptions. For each of these options the function should +test whether the condition is satisfied and if so return true. If it +is not satisfied then it should call +cyg_selrecord() with the +info argument that was passed to the function +and a pointer to a cyg_selinfo structure. + + + +The cyg_selinfo structure is used to record information about current +select operations. Any object that needs to support select must +contain an instance of this structure. Separate cyg_selinfo +structures should be kept for each of the options that the object can +select on - read, write or exception. + + + +If none of the file objects report that the select condition is +satisfied, then the select() API function puts +the calling thread to sleep waiting either for a condition to become +satisfied, or for the optional timeout to expire. + + + +A selectable object must have some asynchronous activity that may +cause a select condition to become true - either via interrupts or the +activities of other threads. Whenever a selectable condition is +satisfied, the object should call cyg_selwakeup() with a pointer to +the appropriate cyg_selinfo structure. If the thread is still waiting, +this will cause it to wake up and repeat its poll of the file +descriptors. This time around, the object that caused the wakeup +should indicate that the select condition is satisfied, and the +select() API call will return. + + + +Note that select() does not exhibit real time +behaviour: the iterative poll of the descriptors, and the wakeup +mechanism mitigate against this. If real time response to device or +socket I/O is required then separate threads should be devoted to each +device of interest and should use blocking calls to wait for a +condition to become ready. + + + + + + + + +Devices + + +Devices are accessed by means of a pseudo-filesystem, "devfs", that is +mounted on "/dev". Open operations are translated into calls to +cyg_io_lookup() and if successful result in a file object whose +f_ops functions translate filesystem API functions into calls into +the device API. + + + + + + + + +Writing a New Filesystem + + +To create a new filesystem it is necessary to define the fstab entry +and the file IO operations. The easiest way to do this is to copy an +existing filesystem: either the test filesystem in the FILEIO package, +or the RAM or ROM filesystem packages. + + + +To make this clearer, the following is a brief tour of the FILEIO +relevant parts of the RAM filesystem. + + + +First, it is necessary to provide forward definitions of the functions +that constitute the filesystem interface: + + + +//========================================================================== +// Forward definitions + +// Filesystem operations +static int ramfs_mount ( cyg_fstab_entry *fste, cyg_mtab_entry *mte ); +static int ramfs_umount ( cyg_mtab_entry *mte ); +static int ramfs_open ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int mode, cyg_file *fte ); +static int ramfs_unlink ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); +static int ramfs_mkdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); +static int ramfs_rmdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); +static int ramfs_rename ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, + cyg_dir dir2, const char *name2 ); +static int ramfs_link ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, + cyg_dir dir2, const char *name2, int type ); +static int ramfs_opendir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + cyg_file *fte ); +static int ramfs_chdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + cyg_dir *dir_out ); +static int ramfs_stat ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + struct stat *buf); +static int ramfs_getinfo ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int key, void *buf, int len ); +static int ramfs_setinfo ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, + int key, void *buf, int len ); + +// File operations +static int ramfs_fo_read (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); +static int ramfs_fo_write (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); +static int ramfs_fo_lseek (struct CYG_FILE_TAG *fp, off_t *pos, int whence ); +static int ramfs_fo_ioctl (struct CYG_FILE_TAG *fp, CYG_ADDRWORD com, + CYG_ADDRWORD data); +static int ramfs_fo_fsync (struct CYG_FILE_TAG *fp, int mode ); +static int ramfs_fo_close (struct CYG_FILE_TAG *fp); +static int ramfs_fo_fstat (struct CYG_FILE_TAG *fp, struct stat *buf ); +static int ramfs_fo_getinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ); +static int ramfs_fo_setinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ); + +// Directory operations +static int ramfs_fo_dirread (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); +static int ramfs_fo_dirlseek (struct CYG_FILE_TAG *fp, off_t *pos, int whence ); + + + +We define all of the fstab entries and all of the file IO +operations. We also define alternatives for the +fo_read and +fo_lseek file IO operations. + + + +We can now define the filesystem table entry. There is a macro, +FSTAB_ENTRY to do this: + + + + +//========================================================================== +// Filesystem table entries + +// ------------------------------------------------------------------------- +// Fstab entry. +// This defines the entry in the filesystem table. +// For simplicity we use _FILESYSTEM synchronization for all accesses since +// we should never block in any filesystem operations. + +FSTAB_ENTRY( ramfs_fste, "ramfs", 0, + CYG_SYNCMODE_FILE_FILESYSTEM|CYG_SYNCMODE_IO_FILESYSTEM, + ramfs_mount, + ramfs_umount, + ramfs_open, + ramfs_unlink, + ramfs_mkdir, + ramfs_rmdir, + ramfs_rename, + ramfs_link, + ramfs_opendir, + ramfs_chdir, + ramfs_stat, + ramfs_getinfo, + ramfs_setinfo); + + + +The first argument to this macro gives the fstab entry a name, the +remainder are initializers for the field of the structure. + + + +We must also define the file operations table that is installed in all +open file table entries: + + + +// ------------------------------------------------------------------------- +// File operations. +// This set of file operations are used for normal open files. + +static cyg_fileops ramfs_fileops = +{ + ramfs_fo_read, + ramfs_fo_write, + ramfs_fo_lseek, + ramfs_fo_ioctl, + cyg_fileio_seltrue, + ramfs_fo_fsync, + ramfs_fo_close, + ramfs_fo_fstat, + ramfs_fo_getinfo, + ramfs_fo_setinfo +}; + + + +These all point to functions supplied by the filesystem except the +fo_select field which is filled with a +pointer to cyg_fileio_seltrue(). This is provided +by the FILEIO package and is a select function that always returns +true to all operations. + + + +Finally, we need to define a set of file operations for use when +reading directories. This table only defines the +fo_read and +fo_lseek operations. The rest are filled +with stub functions supplied by the FILEIO package that just return an +error code. + + + +// ------------------------------------------------------------------------- +// Directory file operations. +// This set of operations are used for open directories. Most entries +// point to error-returning stub functions. Only the read, lseek and +// close entries are functional. + +static cyg_fileops ramfs_dirops = +{ + ramfs_fo_dirread, + (cyg_fileop_write *)cyg_fileio_enosys, + ramfs_fo_dirlseek, + (cyg_fileop_ioctl *)cyg_fileio_enosys, + cyg_fileio_seltrue, + (cyg_fileop_fsync *)cyg_fileio_enosys, + ramfs_fo_close, + (cyg_fileop_fstat *)cyg_fileio_enosys, + (cyg_fileop_getinfo *)cyg_fileio_enosys, + (cyg_fileop_setinfo *)cyg_fileio_enosys +}; + + + +If the filesystem wants to have an instance automatically mounted on +system startup, it must also define a mount table entry. This is done +with the MTAB_ENTRY macro. This is an example from +the test filesystem of how this is used: + + + +MTAB_ENTRY( testfs_mte1, + "/", + "testfs", + "", + 0); + + + +The first argument provides a name for the table entry. The following +arguments provide initialization for the +name, fsname, +devname and data +fields respectively. + + + +These definitions are adequate to let the new filesystem interact +with the FILEIO package. The new filesystem now needs to be fleshed +out with implementations of the functions defined above. Obviously, +the exact form this takes will depend on what the filesystem is +intended to do. Take a look at the RAM and ROM filesystems for +examples of how this has been done. + + + + + + + \ No newline at end of file diff --git a/packages/io/fileio/current/include/dirent.h b/packages/io/fileio/current/include/dirent.h --- a/packages/io/fileio/current/include/dirent.h +++ b/packages/io/fileio/current/include/dirent.h @@ -7,29 +7,38 @@ // POSIX directory functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/fileio/current/include/fileio.h b/packages/io/fileio/current/include/fileio.h --- a/packages/io/fileio/current/include/fileio.h +++ b/packages/io/fileio/current/include/fileio.h @@ -7,29 +7,38 @@ // Fileio header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/fileio/current/include/inode.h b/packages/io/fileio/current/include/inode.h new file mode 100644 --- /dev/null +++ b/packages/io/fileio/current/include/inode.h @@ -0,0 +1,142 @@ +#ifndef CYGONCE_IO_FILEIO_INODE_H +#define CYGONCE_IO_FILEIO_INODE_H +//============================================================================= +// +// inode.h +// +// Header describing eCos inodes +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: +// Date: 2002-01-18 +// Purpose: Describe inodes +// Description: This header contains the definitions that may be useful to a +// filesystem implementation with the concept of inodes. +// There should remain no *requirement* for a FS to use inodes. +// Instead these are just useful functions and definitions. +// +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include // time_t +#include +#include +#include + +// some members are named for compatibility for Linux inodes +typedef struct CYG_INODE_TAG { + cyg_uint32 i_ino; // inode number + mode_t i_mode; // mode + nlink_t i_nlink; // number of (hard) links + uid_t i_uid; // UID + gid_t i_gid; // GID + cyg_io_handle_t i_device; // underlying device + off_t i_size; // file size + time_t i_atime; // file access time + time_t i_mtime; // file modification time + time_t i_ctime; // file metadata change time + struct CYG_INODE_TAG *i_parent; // parent inode + + // these duplicate the contents of a cyg_file, but that's okay + cyg_mtab_entry* i_mte; // mount table entry + struct CYG_FILEOPS_TAG *i_fop; // file operations + + // inode cache related members + cyg_atomic i_count; // number of references to this inode + struct CYG_INODE_TAG *i_cache_prev; // previous in icache + struct CYG_INODE_TAG *i_cache_next; // next in icache + + // This allows us to use a GCC extension to extend the size as appropriate + // for individual FS's requirements. + // Obviously anything here cannot be shared between FSs. + CYG_ADDRWORD i_private[]; +} cyg_inode; + +// There should be one cyg_inodecache per FS instance (to preserve inode number +// uniqueness) +typedef void (*cyg_inodecache_freecallback_t)( cyg_inode *); +typedef struct { + cyg_inode *head; +#if CYGNUM_IO_FILEIO_MAX_INODE_CACHE_DEAD > 0 + cyg_inode *freeable; + cyg_atomic freeablelistlen; +#endif + cyg_inodecache_freecallback_t freecallback; + size_t privatespace; + // should be some locking eventually +} cyg_inodecache; + +static __inline__ int +cyg_inodecache_init( cyg_inodecache *ic, size_t extraprivatespace, + cyg_inodecache_freecallback_t freecb ) +{ + ic->head = NULL; +#if CYGNUM_IO_FILEIO_MAX_INODE_CACHE_DEAD > 0 + ic->freeable = NULL; + ic->freeablelistlen = 0; +#endif + ic->privatespace = extraprivatespace; + ic->freecallback = freecb; + return 0; +} + +// Create an inode, with extra private space. Returns NULL on error. +__externC cyg_inode * +cyg_inode_create( cyg_inodecache *ic ); + +__externC cyg_inode * +cyg_inode_get( cyg_inodecache *ic, cyg_uint32 ino ); + +__externC void +cyg_inode_put( cyg_inodecache *ic, cyg_inode *ino ); + +__externC void +cyg_inodecache_destroy( cyg_inodecache *ic ); + +#endif // CYGONCE_IO_FILEIO_INODE_H + +// EOF inode.h diff --git a/packages/io/fileio/current/include/limits.h b/packages/io/fileio/current/include/limits.h --- a/packages/io/fileio/current/include/limits.h +++ b/packages/io/fileio/current/include/limits.h @@ -7,29 +7,38 @@ // Fileio limits header // //============================================================================ -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================ //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/fileio/current/include/sockio.h b/packages/io/fileio/current/include/sockio.h --- a/packages/io/fileio/current/include/sockio.h +++ b/packages/io/fileio/current/include/sockio.h @@ -7,29 +7,38 @@ // Socket IO header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/fileio/current/src/devfs.cxx b/packages/io/fileio/current/src/devfs.cxx --- a/packages/io/fileio/current/src/devfs.cxx +++ b/packages/io/fileio/current/src/devfs.cxx @@ -5,29 +5,38 @@ // Fileio device filesystem // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -287,7 +296,7 @@ static int dev_stat ( cyg_mtab_entry buf->st_mode = __stat_mode_CHR; buf->st_ino = (ino_t)handle; // map dev handle to inode - buf->st_dev = (dev_t)handle; // same with dev id + buf->st_dev = 0; // (dev_t)handle; // same with dev id buf->st_nlink = 0; buf->st_uid = 0; buf->st_gid = 0; @@ -343,7 +352,7 @@ static int dev_fo_read (struct CYG_ iov->iov_base, &len); - if( EAGAIN == err ) // must be in non-blocking mode + if( -EAGAIN == err ) // must be in non-blocking mode { uio->uio_resid -= len; return ENOERR; @@ -380,7 +389,7 @@ static int dev_fo_write (struct CYG_ iov->iov_base, &len); - if( EAGAIN == err ) // must be in non-blocking mode + if( -EAGAIN == err ) // must be in non-blocking mode { uio->uio_resid -= len; return ENOERR; diff --git a/packages/io/fileio/current/src/dir.cxx b/packages/io/fileio/current/src/dir.cxx --- a/packages/io/fileio/current/src/dir.cxx +++ b/packages/io/fileio/current/src/dir.cxx @@ -5,29 +5,38 @@ // Fileio directory support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -160,7 +169,7 @@ extern struct dirent *readdir( DIR *dirp FILEIO_RETURN_VALUE( NULL ); } - return result; + FILEIO_RETURN_VALUE( result ); } //========================================================================== @@ -177,7 +186,9 @@ extern int readdir_r( DIR *dirp, struct res = read( fd, (void *)entry, sizeof(struct dirent)); if( res < 0 ) - return errno; + { + FILEIO_RETURN_VALUE( errno ); + } if( res > 0 ) *result = entry; diff --git a/packages/io/fileio/current/src/fd.cxx b/packages/io/fileio/current/src/fd.cxx --- a/packages/io/fileio/current/src/fd.cxx +++ b/packages/io/fileio/current/src/fd.cxx @@ -5,29 +5,38 @@ // Fileio file descriptor implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -54,21 +63,21 @@ #include "fio.h" // Private header -#include // mutex definitions - //----------------------------------------------------------------------------- // File data structures +#ifdef CYGPKG_KERNEL // Mutex for controlling access to file desriptor arrays -Cyg_Mutex fdlock CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO); +Cyg_Mutex fdlock CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS); + +// Array of per-file mutexes +static Cyg_Mutex file_lock[CYGNUM_FILEIO_NFILE] \ + CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS); +#endif // ifdef CYGPKG_KERNEL // Array of open file objects static cyg_file file[CYGNUM_FILEIO_NFILE]; -// Array of per-file mutexes -static Cyg_Mutex file_lock[CYGNUM_FILEIO_NFILE] \ - CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO); - // Descriptor array static cyg_file *desc[CYGNUM_FILEIO_NFD]; @@ -80,7 +89,7 @@ static cyg_file *desc[CYGNUM_FILEIO_NFD] __externC void cyg_fd_init() { int i; - + for( i = 0; i < CYGNUM_FILEIO_NFILE; i++ ) file[i].f_flag = 0; @@ -99,7 +108,7 @@ static cyg_file *desc[CYGNUM_FILEIO_NFD] int i; cyg_file *fp = NULL; - fdlock.lock(); + FILEIO_MUTEX_LOCK(fdlock); for( i = 0; i < CYGNUM_FILEIO_NFILE; i++ ) { @@ -112,7 +121,7 @@ static cyg_file *desc[CYGNUM_FILEIO_NFD] } } - fdlock.unlock(); + FILEIO_MUTEX_UNLOCK(fdlock); return fp; } @@ -124,11 +133,11 @@ static cyg_file *desc[CYGNUM_FILEIO_NFD] __externC void cyg_file_free(cyg_file * fp) { - fdlock.lock(); + FILEIO_MUTEX_LOCK(fdlock); fp->f_flag = 0; - fdlock.unlock(); + FILEIO_MUTEX_UNLOCK(fdlock); } //========================================================================== @@ -191,19 +200,19 @@ static int fd_close( int fd ) { int fd; - fdlock.lock(); + FILEIO_MUTEX_LOCK(fdlock); for( fd = low; fd < CYGNUM_FILEIO_NFD; fd++ ) { if( desc[fd] == NULL ) { desc[fd] = FD_ALLOCATED; - fdlock.unlock(); + FILEIO_MUTEX_UNLOCK(fdlock); return fd; } } - fdlock.unlock(); + FILEIO_MUTEX_UNLOCK(fdlock); return -1; } @@ -215,14 +224,14 @@ static int fd_close( int fd ) __externC void cyg_fd_assign(int fd, cyg_file *fp) { - fdlock.lock(); + FILEIO_MUTEX_LOCK(fdlock); fd_close( fd ); fp->f_ucount++; desc[fd] = fp; - fdlock.unlock(); + FILEIO_MUTEX_UNLOCK(fdlock); } //-------------------------------------------------------------------------- @@ -233,13 +242,13 @@ static int fd_close( int fd ) { int error; - fdlock.lock(); + FILEIO_MUTEX_LOCK(fdlock); error = fd_close( fd ); desc[fd] = NULL; - fdlock.unlock(); + FILEIO_MUTEX_UNLOCK(fdlock); return error; } @@ -255,7 +264,7 @@ static int fd_close( int fd ) __externC cyg_file *cyg_fp_get( int fd ) { - fdlock.lock(); + FILEIO_MUTEX_LOCK(fdlock); cyg_file *fp = desc[fd]; @@ -267,7 +276,7 @@ static int fd_close( int fd ) } else fp = NULL; - fdlock.unlock(); + FILEIO_MUTEX_UNLOCK(fdlock); return fp; } @@ -278,11 +287,11 @@ static int fd_close( int fd ) __externC void cyg_fp_free( cyg_file *fp ) { - fdlock.lock(); + FILEIO_MUTEX_LOCK(fdlock); fp_ucount_dec( fp ); - fdlock.unlock(); + FILEIO_MUTEX_UNLOCK(fdlock); } //========================================================================== @@ -295,7 +304,7 @@ void cyg_file_lock( cyg_file *fp , cyg_u if( syncmode & CYG_SYNCMODE_IO_FILE ) { fp->f_flag |= CYG_FLOCKED; - file_lock[fp-&file[0]].lock(); + FILEIO_MUTEX_LOCK(file_lock[fp-&file[0]]); } } @@ -306,7 +315,7 @@ void cyg_file_unlock( cyg_file *fp, cyg_ if( syncmode & CYG_SYNCMODE_IO_FILE ) { fp->f_flag &= ~CYG_FLOCKED; - file_lock[fp-&file[0]].unlock(); + FILEIO_MUTEX_UNLOCK(file_lock[fp-&file[0]]); } } diff --git a/packages/io/fileio/current/src/file.cxx b/packages/io/fileio/current/src/file.cxx --- a/packages/io/fileio/current/src/file.cxx +++ b/packages/io/fileio/current/src/file.cxx @@ -5,29 +5,38 @@ // Fileio file operations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -45,11 +54,9 @@ //========================================================================== #include -#include #include #include -#include // base kernel types #include // tracing macros #include // assertion macros @@ -59,8 +66,6 @@ #include "fio.h" // Private header -#include // mutex definitions - //========================================================================== // Implement filesystem locking protocol. @@ -161,7 +166,9 @@ static void update_cwd( cyg_mtab_entry * #else -static Cyg_Mutex getcwd_lock CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO); +#ifdef CYGPKG_KERNEL +static Cyg_Mutex getcwd_lock CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS); +#endif #endif @@ -610,7 +617,7 @@ extern int access(const char *path, int int ddbufpos; // Claim lock to serialize use of ddbuf. - getcwd_lock.lock(); + FILEIO_MUTEX_LOCK(getcwd_lock); // Initialize ddbuf with ".". ddbuf[0] = '.'; @@ -716,7 +723,7 @@ extern int access(const char *path, int } // We have finished using ddbuf now. - getcwd_lock.unlock(); + FILEIO_MUTEX_UNLOCK(getcwd_lock); if( err < 0 ) FILEIO_RETURN_VALUE(NULL); diff --git a/packages/io/fileio/current/src/fio.h b/packages/io/fileio/current/src/fio.h --- a/packages/io/fileio/current/src/fio.h +++ b/packages/io/fileio/current/src/fio.h @@ -7,29 +7,38 @@ // Fileio private header // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -50,7 +59,6 @@ //============================================================================= #include -#include #include #include @@ -66,8 +74,18 @@ #include +#ifdef CYGPKG_KERNEL +#include #include // mutex definitions +#define FILEIO_MUTEX_LOCK(_m_) ((_m_).lock()) +#define FILEIO_MUTEX_UNLOCK(_m_) ((_m_).unlock()) + +#else +#define FILEIO_MUTEX_LOCK(_m_) +#define FILEIO_MUTEX_UNLOCK(_m_) +#endif + //============================================================================= // POSIX API support diff --git a/packages/io/fileio/current/src/inocache.cxx b/packages/io/fileio/current/src/inocache.cxx new file mode 100644 --- /dev/null +++ b/packages/io/fileio/current/src/inocache.cxx @@ -0,0 +1,216 @@ +//============================================================================= +// +// inocache.cxx +// +// Implementation of inode cache +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: +// Date: 2002-01-18 +// Purpose: +// Description: +// Usage: +// #include +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include +#include +#include + +#ifdef CYGPKG_KERNEL +# include +# include +# if 0 +# define LOCK_ICACHE(_ic_) \ + CYG_MACRO_START \ + (_ic_)->icmutex.lock(); \ + CYG_MACRO_END + +# define UNLOCK_ICACHE(_ic_) \ + CYG_MACRO_START \ + (_ic_)->icmutex.unlock(); \ + CYG_MACRO_END +# define LOCK_INO(_ic_,_ino_) \ + CYG_MACRO_START \ + (_ic_)->icmutex.lock(); \ + CYG_MACRO_END +# define UNLOCK_INO(_ic_,_ino_) \ + CYG_MACRO_START \ + (_ic_)->icmutex.unlock(); \ + CYG_MACRO_END +# endif +#endif + +# define LOCK_ICACHE(_ic_) CYG_EMPTY_STATEMENT +# define UNLOCK_ICACHE(_ic_) CYG_EMPTY_STATEMENT +# define LOCK_INO(_ic_,_ino_) CYG_EMPTY_STATEMENT +# define UNLOCK_INO(_ic_,_ino_) CYG_EMPTY_STATEMENT + +// Tried to make this implementation use tables, but the requirement to +// allow for extra space makes this difficult + +__externC void +cyg_inodecache_destroy( cyg_inodecache *ic ) +{ + cyg_inode *tmp; + for ( tmp=ic->head; tmp != NULL; tmp=tmp->i_cache_next ) + free(tmp); +#if CYGNUM_IO_FILEIO_MAX_INODE_CACHE_DEAD > 0 + for ( tmp=ic->freeable; tmp != NULL; tmp=tmp->i_cache_next ) + free(tmp); +#endif +} // cyg_inodecache_destroy() + +static __inline__ void +insert_in_list( cyg_inode **i, cyg_inode *ino ) +{ + cyg_inode *here = *i; + if ( here == NULL ) { + ino->i_cache_prev = ino->i_cache_next = ino; + } else { + ino->i_cache_prev = here->i_cache_prev; + ino->i_cache_next = here; + here->i_cache_prev = ino; + ino->i_cache_prev->i_cache_next = ino; + } + // put at start, as this is more likely to come off sooner than later + *i = ino; +} + +// Create an inode. Returns a negative error code on error. +__externC cyg_inode * +cyg_inode_create( cyg_inodecache *ic ) +{ + cyg_inode *ni; + + ni = (cyg_inode *)malloc( sizeof(cyg_inode)+ic->privatespace ); + if ( !ni ) + return ni; + ni->i_count = 1; + + LOCK_ICACHE(ic); + insert_in_list( &ic->head, ni ); + UNLOCK_ICACHE(ic); + + return ni; +} // cyg_inode_create() + +__externC cyg_inode * +cyg_inode_get( cyg_inodecache *ic, cyg_uint32 ino ) +{ + cyg_inode *head = ic->head; + // first try the (live) cache + if (head) { + cyg_inode *tmp=head; + while (1) { + if ( tmp->i_ino == ino ) { + tmp->i_count++; + return tmp; + } + tmp = tmp->i_cache_next; + if ( tmp == head ) + break; + } + } +#if CYGNUM_IO_FILEIO_MAX_INODE_CACHE_DEAD > 0 + // now try the cache of dead inodes + head = ic->freeable; + if (head) { + cyg_inode *tmp=head; + while (1) { + if ( tmp->i_ino == ino ) { + tmp->i_count++; + LOCK_ICACHE(ic); + ic->freeablelistlen--; + if ( ic->freeablelistlen ) { + tmp->i_cache_prev->i_cache_next = tmp->i_cache_next; + tmp->i_cache_next->i_cache_prev = tmp->i_cache_prev; + } else + ic->freeable = NULL; + insert_in_list( &ic->head, tmp ); + UNLOCK_ICACHE(ic); + return tmp; + } + tmp = tmp->i_cache_next; + if ( tmp == head ) + break; + } + } +#endif + // not found so make it + return cyg_inode_create( ic ); + +} // cyg_inode_get() + +__externC void +cyg_inode_put( cyg_inodecache *ic, cyg_inode *ino ) +{ + if ( --ino->i_count == 0 ) + { + LOCK_ICACHE(ic); + if ( ino->i_cache_next == ino ) { + ic->head = NULL; + } else { + ino->i_cache_prev->i_cache_next = ino->i_cache_next; + ino->i_cache_next->i_cache_prev = ino->i_cache_prev; + } +#if CYGNUM_IO_FILEIO_MAX_INODE_CACHE_DEAD > 0 + ic->freeablelistlen++; + insert_in_list( &ic->freeable, ino ); + if ( ic->freeablelistlen > CYGNUM_IO_FILEIO_MAX_INODE_CACHE_DEAD ) { + cyg_inode *prev = ino->i_cache_prev; + prev->i_cache_prev->i_cache_next = ino; + ino->i_cache_prev = prev->i_cache_prev; + ic->freecallback(prev); + free(prev); + } +#else + ic->freecallback(ino); + free(ino); +#endif + } +} // cyg_inode_put() + +// EOF inode.h diff --git a/packages/io/fileio/current/src/io.cxx b/packages/io/fileio/current/src/io.cxx --- a/packages/io/fileio/current/src/io.cxx +++ b/packages/io/fileio/current/src/io.cxx @@ -5,29 +5,38 @@ // Fileio IO operations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/fileio/current/src/misc.cxx b/packages/io/fileio/current/src/misc.cxx --- a/packages/io/fileio/current/src/misc.cxx +++ b/packages/io/fileio/current/src/misc.cxx @@ -5,29 +5,38 @@ // Fileio miscellaneous functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -45,14 +54,12 @@ #include #include -#include #include #ifdef CYGPKG_LIBC_TIME #include #endif -#include // base kernel types #include // tracing macros #include // assertion macros #include // strcmp() @@ -62,7 +69,11 @@ # include // Wallclock class #endif +#ifdef CYGPKG_KERNEL +#include +#include // base kernel types #include // Clock inlines +#endif #include "fio.h" // Private header @@ -88,8 +99,10 @@ CYG_HAL_TABLE_BEGIN( fstab, fstab ); __externC cyg_fstab_entry fstab_end; CYG_HAL_TABLE_END( fstab_end, fstab ); +#ifdef CYGPKG_KERNEL // Array of mutexes for locking the fstab entries -Cyg_Mutex fstab_lock[CYGNUM_FILEIO_FSTAB_MAX]; +Cyg_Mutex fstab_lock[CYGNUM_FILEIO_FSTAB_MAX] CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS); +#endif // ------------------------------------------------------------------------- // Mount table. @@ -105,8 +118,10 @@ cyg_mtab_entry mtab_extra[CYGNUM_FILEIO_ __externC cyg_mtab_entry mtab_end; CYG_HAL_TABLE_END( mtab_end, mtab ); +#ifdef CYGPKG_KERNEL // Array of mutexes for locking the mtab entries -Cyg_Mutex mtab_lock[CYGNUM_FILEIO_MTAB_MAX]; +Cyg_Mutex mtab_lock[CYGNUM_FILEIO_MTAB_MAX] CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS); +#endif //========================================================================== // Current directory @@ -123,7 +138,7 @@ public: Cyg_Fileio_Init_Class(); }; -static Cyg_Fileio_Init_Class fileio_initializer CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO); +static Cyg_Fileio_Init_Class fileio_initializer CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS); Cyg_Fileio_Init_Class::Cyg_Fileio_Init_Class() { @@ -366,12 +381,12 @@ void cyg_fs_lock( cyg_mtab_entry *mte, c if( syncmode & CYG_SYNCMODE_FILE_FILESYSTEM ) { CYG_ASSERT(mte->fs-&fstab[0] < CYGNUM_FILEIO_FSTAB_MAX, "Bad file system"); - fstab_lock[mte->fs-&fstab[0]].lock(); + FILEIO_MUTEX_LOCK( fstab_lock[mte->fs-&fstab[0]] ); } if( syncmode & CYG_SYNCMODE_FILE_MOUNTPOINT ) { CYG_ASSERT(mte-&mtab[0] < CYGNUM_FILEIO_MTAB_MAX, "Bad mount point"); - mtab_lock[mte-&mtab[0]].lock(); + FILEIO_MUTEX_LOCK( mtab_lock[mte-&mtab[0]] ); } } @@ -381,12 +396,12 @@ void cyg_fs_unlock( cyg_mtab_entry *mte, if( syncmode & CYG_SYNCMODE_FILE_FILESYSTEM ) { CYG_ASSERT(mte->fs-&fstab[0] < CYGNUM_FILEIO_FSTAB_MAX, "Bad file system"); - fstab_lock[mte->fs-&fstab[0]].unlock(); + FILEIO_MUTEX_UNLOCK( fstab_lock[mte->fs-&fstab[0]] ); } if( syncmode & CYG_SYNCMODE_FILE_MOUNTPOINT ) { CYG_ASSERT(mte-&mtab[0] < CYGNUM_FILEIO_MTAB_MAX, "Bad mount point"); - mtab_lock[mte-&mtab[0]].unlock(); + FILEIO_MUTEX_UNLOCK( mtab_lock[mte-&mtab[0]] ); } } @@ -415,7 +430,7 @@ void cyg_fs_unlock( cyg_mtab_entry *mte, return (time_t) tp.tv_sec; -#else +#elif defined(CYGPKG_KERNEL) // If all else fails, get the current realtime clock value and // convert it to seconds ourself. @@ -433,7 +448,9 @@ void cyg_fs_unlock( cyg_mtab_entry *mte, ticks = Cyg_Clock::real_time_clock->current_value(); return (time_t) Cyg_Clock::convert( ticks, &sec_converter ); - +#else + /* No clock support at all. */ + return (time_t) 0; #endif } diff --git a/packages/io/fileio/current/src/select.cxx b/packages/io/fileio/current/src/select.cxx --- a/packages/io/fileio/current/src/select.cxx +++ b/packages/io/fileio/current/src/select.cxx @@ -5,29 +5,38 @@ // Fileio select() support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -80,14 +89,14 @@ // Mutex for serializing select processing. This essntially controls // access to the contents of the selinfo structures embedded in the // client system data structures. -static Cyg_Mutex select_mutex CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO); +static Cyg_Mutex select_mutex CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS); // Condition variable where any thread that is waiting for a select to // fire is suspended. Note that select is not intended to be a real time // operation. Whenever any selectable event occurs, all selecting threads // will be resumed. They must then rescan their selectees and resuspend if // necessary. -static Cyg_Condition_Variable selwait( select_mutex ) CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO); +static Cyg_Condition_Variable selwait( select_mutex ) CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS); static volatile cyg_uint32 selwake_count = 0; diff --git a/packages/io/fileio/current/src/socket.cxx b/packages/io/fileio/current/src/socket.cxx --- a/packages/io/fileio/current/src/socket.cxx +++ b/packages/io/fileio/current/src/socket.cxx @@ -5,29 +5,38 @@ // Fileio socket operations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/fileio/current/tests/fileio1.c b/packages/io/fileio/current/tests/fileio1.c --- a/packages/io/fileio/current/tests/fileio1.c +++ b/packages/io/fileio/current/tests/fileio1.c @@ -5,29 +5,38 @@ // Test fileio system // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/fileio/current/tests/select.c b/packages/io/fileio/current/tests/select.c --- a/packages/io/fileio/current/tests/select.c +++ b/packages/io/fileio/current/tests/select.c @@ -5,29 +5,38 @@ // Test select implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -555,6 +564,7 @@ int main( int argc, char **argv ) #ifdef TEST_NET sa.sin_family = AF_INET; + sa.sin_len = sizeof(sa); inet_aton("127.0.0.1", &sa.sin_addr); sa.sin_port = htons(1234); init_all_network_interfaces(); diff --git a/packages/io/fileio/current/tests/socket.c b/packages/io/fileio/current/tests/socket.c --- a/packages/io/fileio/current/tests/socket.c +++ b/packages/io/fileio/current/tests/socket.c @@ -5,29 +5,38 @@ // Test socket API // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -264,6 +273,7 @@ int main( int argc, char **argv ) struct sched_param schedparam; sa.sin_family = AF_INET; + sa.sin_len = sizeof(sa); inet_aton("127.0.0.1", &sa.sin_addr); sa.sin_port = htons(1234); diff --git a/packages/io/fileio/current/tests/stdio.c b/packages/io/fileio/current/tests/stdio.c --- a/packages/io/fileio/current/tests/stdio.c +++ b/packages/io/fileio/current/tests/stdio.c @@ -5,29 +5,38 @@ // Test stdio integration of fileio system // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/fileio/current/tests/testfs.c b/packages/io/fileio/current/tests/testfs.c --- a/packages/io/fileio/current/tests/testfs.c +++ b/packages/io/fileio/current/tests/testfs.c @@ -5,29 +5,38 @@ // Test file system // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/flash/current/ChangeLog b/packages/io/flash/current/ChangeLog --- a/packages/io/flash/current/ChangeLog +++ b/packages/io/flash/current/ChangeLog @@ -1,3 +1,37 @@ +2002-01-31 Jonathan Larmour + + * src/flashiodev.c: Fix bounds checking and offsetting. + + * cdl/io_flash.cdl (CYGNUM_IO_FLASH_BLOCK_LENGTH_1): Default to + 0x100000 for convenience. + +2002-01-30 Jonathan Larmour + + * cdl/io_flash.cdl: Allow specification of an offset and length + of the region of flash. + * src/flashiodev.c: Use it. + +2002-01-24 Jesper Skov + + * include/flash.h: Add a comment about the obvious: the flash + caching macros should be called with interrupts disabled. + +2002-01-23 Jonathan Larmour + + * cdl/io_flash.cdl: Add CYGPKG_IO_FLASH_BLOCK_DEVICE and + CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1 to allow exporting flash + as block devices accessible from file systems. + * src/fileiodev.c: New file implementing this. + * include/flash.h: Add typedefs for the various structures used + to configure the block devices. + +2002-01-18 Paul Fine + + * src/flash.c : Modified flash_verify_addr, flash_erase, + flash_lock and flash_unlock to to work properly when the location + of the flash in the memory map is at the very top of the address + space. We check and handle values that may overflow. + 2001-10-28 Gary Thomas * src/flash.c (flash_erase): Don't call hardware layer if block @@ -191,27 +225,36 @@ 2000-07-29 Gary Thomas = (CYG_ADDRESS)flash_info.start) && - ((CYG_ADDRESS)target < (CYG_ADDRESS)flash_info.end)) { + ((CYG_ADDRESS)target <= ( ((CYG_ADDRESS)flash_info.end) - 1) )) { return FLASH_ERR_OK; } else { return FLASH_ERR_INVALID; @@ -196,6 +205,11 @@ flash_erase(void *addr, int len, void ** block = (unsigned short *)((CYG_ADDRESS)addr & flash_info.block_mask); end_addr = (unsigned short *)((CYG_ADDRESS)addr+len); + /* Check to see if end_addr overflowed */ + if( (end_addr < block) && (len > 0) ){ + end_addr = (unsigned short *) ((CYG_ADDRESS) flash_info.end - 1); + } + (*flash_info.pf)("... Erase from %p-%p: ", (void*)block, (void*)end_addr); HAL_FLASH_CACHES_OFF(d_cache, i_cache); @@ -205,6 +219,7 @@ flash_erase(void *addr, int len, void ** int i; unsigned char *dp; bool erased = true; + unsigned short *tmp_block; dp = (unsigned char *)block; for (i = 0; i < flash_info.block_size; i++) { @@ -221,7 +236,16 @@ flash_erase(void *addr, int len, void ** *err_addr = (void *)block; break; } - block += flash_info.block_size / sizeof(*block); + + // Check to see if block will overflow + tmp_block = block + flash_info.block_size / sizeof(*block); + if(tmp_block < block){ + // If block address overflows, set block value to end on this loop + block = end_addr; + } + else{ + block = tmp_block; + } (*flash_info.pf)("."); } FLASH_Disable(block, end_addr); @@ -347,18 +371,33 @@ flash_lock(void *addr, int len, void **e block = (unsigned short *)((CYG_ADDRESS)addr & flash_info.block_mask); end_addr = (unsigned short *)((CYG_ADDRESS)addr+len); + /* Check to see if end_addr overflowed */ + if( (end_addr < block) && (len > 0) ){ + end_addr = (unsigned short *) ((CYG_ADDRESS) flash_info.end - 1); + } + (*flash_info.pf)("... Lock from %p-%p: ", block, end_addr); HAL_FLASH_CACHES_OFF(d_cache, i_cache); FLASH_Enable(block, end_addr); while (block < end_addr) { + unsigned short *tmp_block; stat = (*_flash_lock_block)(block); stat = flash_hwr_map_error(stat); if (stat) { *err_addr = (void *)block; break; } - block += flash_info.block_size / sizeof(*block); + + // Check to see if block will overflow + tmp_block = block + flash_info.block_size / sizeof(*block); + if(tmp_block < block){ + // If block address overflows, set block value to end on this loop + block = end_addr; + } + else{ + block = tmp_block; + } (*flash_info.pf)("."); } FLASH_Disable(block, end_addr); @@ -404,18 +443,32 @@ flash_unlock(void *addr, int len, void * block = (unsigned short *)((CYG_ADDRESS)addr & flash_info.block_mask); end_addr = (unsigned short *)((CYG_ADDRESS)addr+len); + /* Check to see if end_addr overflowed */ + if( (end_addr < block) && (len > 0) ){ + end_addr = (unsigned short *) ((CYG_ADDRESS) flash_info.end - 1); + } + (*flash_info.pf)("... Unlock from %p-%p: ", block, end_addr); HAL_FLASH_CACHES_OFF(d_cache, i_cache); FLASH_Enable(block, end_addr); while (block < end_addr) { + unsigned short *tmp_block; stat = (*_flash_unlock_block)(block, flash_info.block_size, flash_info.blocks); stat = flash_hwr_map_error(stat); if (stat) { *err_addr = (void *)block; break; } - block += flash_info.block_size / sizeof(*block); + + tmp_block = block + flash_info.block_size / sizeof(*block); + if(tmp_block < block){ + // If block address overflows, set block value to end on this loop + block = end_addr; + } + else{ + block = tmp_block; + } (*flash_info.pf)("."); } FLASH_Disable(block, end_addr); diff --git a/packages/io/flash/current/src/flashiodev.c b/packages/io/flash/current/src/flashiodev.c new file mode 100644 --- /dev/null +++ b/packages/io/flash/current/src/flashiodev.c @@ -0,0 +1,245 @@ +//========================================================================== +// +// flashiodev.c +// +// Flash device interface to I/O subsystem +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: +// Date: 2002-01-16 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define _FLASH_PRIVATE_ +#include + +#include +#include +#include +#include +#include +#include // memcpy + +#define MIN(x,y) ((x)<(y) ? (x) : (y)) + +// 1 per devtab entry, so only 1 for now +static char flashiodev_workspaces[1][FLASH_MIN_WORKSPACE]; + +static int dummy_printf( const char *fmt, ... ) {return 0;} + +static bool +flashiodev_init( struct cyg_devtab_entry *tab ) +{ + char *ws = (char *)tab->priv; + int stat = flash_init( ws, FLASH_MIN_WORKSPACE, &dummy_printf ); + + if ( stat == 0 ) + return true; + else + return false; +} // flashiodev_init() + +#if 0 +static Cyg_ErrNo +flashiodev_lookup( struct cyg_devtab_entry **tab, + struct cyg_devtab_entry *sub_tab, + const char *name) +{ +} // flashiodev_lookup() +#endif + +static Cyg_ErrNo +flashiodev_bread( cyg_io_handle_t handle, void *buf, cyg_uint32 *len, + cyg_uint32 pos) +{ + char *startpos = (char *)flash_info.start + pos + + CYGNUM_IO_FLASH_BLOCK_OFFSET_1; + +#ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time + char *endpos = startpos + *len - 1; + char *flashend = MIN( (char *)flash_info.end, + ((char *)flash_info.start + CYGNUM_IO_FLASH_BLOCK_OFFSET_1 + + CYGNUM_IO_FLASH_BLOCK_LENGTH_1)); + if ( startpos < (char *)flash_info.start+CYGNUM_IO_FLASH_BLOCK_OFFSET_1 ) + return -EINVAL; + if ( endpos > flashend ) + return -EINVAL; +#endif + memcpy( buf, startpos, *len ); + + return ENOERR; +} // flashiodev_bread() + +static Cyg_ErrNo +flashiodev_bwrite( cyg_io_handle_t handle, const void *buf, cyg_uint32 *len, + cyg_uint32 pos ) +{ + Cyg_ErrNo err = ENOERR; + void *erraddr; + + char *startpos = (char *)flash_info.start + pos + CYGNUM_IO_FLASH_BLOCK_OFFSET_1; + +#ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time + char *endpos = startpos + *len - 1; + char *flashend = MIN( (char *)flash_info.end, + ((char *)flash_info.start + CYGNUM_IO_FLASH_BLOCK_OFFSET_1 + + CYGNUM_IO_FLASH_BLOCK_LENGTH_1)); + if ( startpos < (char *)flash_info.start + CYGNUM_IO_FLASH_BLOCK_OFFSET_1 ) + return -EINVAL; + if ( endpos > flashend ) + return -EINVAL; +#endif + err = flash_program( startpos, + (void *)buf, *len, &erraddr ); + + if ( err ) + err = -EIO; // just something sane + return err; +} // flashiodev_bwrite() + +static Cyg_ErrNo +flashiodev_get_config( cyg_io_handle_t handle, + cyg_uint32 key, + void* buf, + cyg_uint32* len) +{ + switch (key) { + case CYG_IO_GET_CONFIG_FLASH_ERASE: + { + if ( *len != sizeof( cyg_io_flash_getconfig_erase_t ) ) + return -EINVAL; + { + cyg_io_flash_getconfig_erase_t *e = + (cyg_io_flash_getconfig_erase_t *)buf; + char *startpos = (char *)flash_info.start + e->offset + CYGNUM_IO_FLASH_BLOCK_OFFSET_1; + +#ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time + char *endpos = startpos + e->len - 1; + char *flashend = MIN( (char *)flash_info.end, + ((char *)flash_info.start + CYGNUM_IO_FLASH_BLOCK_OFFSET_1 + + CYGNUM_IO_FLASH_BLOCK_LENGTH_1)); + if ( startpos < (char *)flash_info.start + CYGNUM_IO_FLASH_BLOCK_OFFSET_1 ) + return -EINVAL; + if ( endpos > flashend ) + return -EINVAL; +#endif + e->flasherr = flash_erase( startpos, e->len, e->err_address ); + } + return ENOERR; + } + case CYG_IO_GET_CONFIG_FLASH_DEVSIZE: + { + if ( *len != sizeof( cyg_io_flash_getconfig_devsize_t ) ) + return -EINVAL; + { + cyg_io_flash_getconfig_devsize_t *d = + (cyg_io_flash_getconfig_devsize_t *)buf; + + //d->dev_size = flash_info.blocks * flash_info.block_size; + d->dev_size = CYGNUM_IO_FLASH_BLOCK_LENGTH_1; + } + return ENOERR; + } + + case CYG_IO_GET_CONFIG_FLASH_BLOCKSIZE: + { + cyg_io_flash_getconfig_blocksize_t *b = + (cyg_io_flash_getconfig_blocksize_t *)buf; + char *startpos = (char *)flash_info.start + CYGNUM_IO_FLASH_BLOCK_OFFSET_1 + b->offset; +#ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time + char *flashend = MIN( (char *)flash_info.end, + ((char *)flash_info.start + CYGNUM_IO_FLASH_BLOCK_OFFSET_1 + + CYGNUM_IO_FLASH_BLOCK_LENGTH_1)); + if ( startpos < (char *)flash_info.start + CYGNUM_IO_FLASH_BLOCK_OFFSET_1 ) + return -EINVAL; + if ( startpos > flashend ) + return -EINVAL; +#endif + if ( *len != sizeof( cyg_io_flash_getconfig_blocksize_t ) ) + return -EINVAL; + + // offset unused for now + b->block_size = flash_info.block_size; + return ENOERR; + } + + default: + return -EINVAL; + } +} // flashiodev_get_config() + +#if 0 +static Cyg_ErrNo +flashiodev_set_config( cyg_io_handle_t handle, + cyg_uint32 key, + const void* buf, + cyg_uint32* len) +{ + switch (key) { + default: + return -EINVAL; + } +} // flashiodev_set_config() +#endif + +// get_config/set_config should be added later to provide the other flash +// operations possible, like erase etc. + +BLOCK_DEVIO_TABLE( cyg_io_flashdev1_ops, + &flashiodev_bwrite, + &flashiodev_bread, + 0, // no select + &flashiodev_get_config, + 0 // &flashiodev_set_config + ); + + +BLOCK_DEVTAB_ENTRY( cyg_io_flashdev1, + CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1, + 0, + &cyg_io_flashdev1_ops, + &flashiodev_init, + 0, // No lookup required + &flashiodev_workspaces[0] ); + +// EOF flashiodev.c diff --git a/packages/io/pci/current/ChangeLog b/packages/io/pci/current/ChangeLog --- a/packages/io/pci/current/ChangeLog +++ b/packages/io/pci/current/ChangeLog @@ -1,3 +1,26 @@ +2002-05-14 Jesper Skov + + * tests/pci1.c: Fix warning. + +2002-02-13 Hugo Tyson + + * doc/pci.sgml: Tidy up some typos and PROGRAMLISTING width + issues. + +2002-02-11 Mark Salter + + * doc/pci.sgml: Brought docs up to date with current code. + +2002-01-31 Mark Salter + + * src/pci.c (cyg_pci_init): Set default memory and io bases here + as the HAL_PCI_ALLOC_BASE_* macros may not be static values. + +2002-01-21 Mark Salter + + * src/pci.c (cyg_pci_get_device_info): Fix setting of upper 32 bits + for 64-bit BAR. + 2001-09-28 Gary Thomas * src/pci.c (cyg_pci_find_next): @@ -255,27 +278,36 @@ 1999-08-12 Jesper Skov +PCI Library + +The eCos PCI Library +The PCI library is an optional part of eCos, and is only + applicable to some platforms. + +PCI Library +The eCos PCI library provides the following functionality: + +Scan the PCI bus for specific devices or devices of a certain +class. +Read and change generic PCI information. +Read and change device-specific PCI information. +Allocate PCI memory and IO space to devices. +Translate a device's PCI interrupts to equivalent HAL +vectors. + +Example code fragments are from the pci1 test (see io/pci/<release>/tests/pci1.c). +All of the functions described below are declared in the header +file <cyg/io/pci.h> which all +clients of the PCI library should include. + +PCI Overview +The PCI bus supports several address spaces: memory, IO, and configuration. All PCI +devices must support mandatory configuration space registers. Some devices may also present +IO mapped and/or memory mapped resources. Before devices on the bus can be used, they must +be configured. Basically, configuration will assign PCI IO and/or memory address ranges to +each device and then enable that device. All PCI devices have a unique address in +configuration space. This address is comprised of a bus number, a device number, and a +function number. Special devices called bridges are used to connect two PCI busses together. +The PCI standard supports up to 255 busses with each bus having up to 32 devices and each +device having up to 8 functions. + +The environment in which a platform operates will dictate if and how eCos should +configure devices on the PCI bus. If the platform acts as a host on a single PCI bus, +then devices may be configured individually from the relevant device driver. If the +platform is not the primary host, such as a PCI card plugged into a PC, configuration +of PCI devices may be left to the PC BIOS. If PCI-PCI bridges are involved, configuration +of all devices is best done all at once early in the boot process. This is because all +devices on the secondary side of a bridge must be evaluated for their IO and memory space +requirements before the bridge can be configured. + + + +Initializing the bus +The PCI bus needs to be initialized before it can be used. +This only needs to be done once - some HALs may do it as part of +the platform initialization procedure, other HALs may leave it to +the application or device drivers to do it. The following function +will do the initialization only once, so it's safe to call from +multiple drivers: +void cyg_pci_init( void ); + + +Scanning for devices +After the bus has been initialized, it is possible to scan +it for devices. This is done using the function: +cyg_bool cyg_pci_find_next( cyg_pci_device_id cur_devid, + cyg_pci_device_id *next_devid ); + +It will scan the bus for devices starting at cur_devid +. If a device is found, its devid is stored in +next_devid and the function returns true. + +The pci1 test's outer loop looks like: + + cyg_pci_init(); + if (cyg_pci_find_next(CYG_PCI_NULL_DEVID, &devid)) { + do { + <use devid> + } while (cyg_pci_find_next(devid, &devid)); + } +What happens is that the bus gets initialized and a scan is +started. CYG_PCI_NULL_DEVID causes +cyg_pci_find_next() to restart its scan. If the bus does not +contain any devices, the first call to cyg_pci_find_next() +will return false. +If the call returns true, a loop is entered where +the found devid is used. After devid processing has completed, the next device +on the bus is searched for; cyg_pci_find_next() +continues its scan from the current devid. The loop terminates when +no more devices are found on the bus. +This is the generic way of scanning the bus, enumerating all +the devices on the bus. But if the application is looking for a +device of a given device class (e.g., a SCSI controller), or a specific +vendor device, these functions simplify the task a bit: + +cyg_bool cyg_pci_find_class( cyg_uint32 dev_class, + cyg_pci_device_id *devid ); +cyg_bool cyg_pci_find_device( cyg_uint16 vendor, cyg_uint16 device, + cyg_pci_device_id *devid ); +They work just like cyg_pci_find_next(), +but only return true when the dev_class or vendor/device +qualifiers match those of a device on the bus. The devid serves +as both an input and an output operand: the scan starts at the given +device, and if a device is found devid is updated with the value +for the found device. +The <cyg/io/pci_cfg.h> header +file (included by pci.h) contains definitions for PCI +class, vendor and device codes which can be used as arguments to the find +functions. +The list of vendor and device codes is not complete: add new codes +as necessary. If possible also register the codes at the PCI Code +List (http://www.yourvote.com/pci) + which is where the eCos definitions are generated from. + + +Generic config information +When a valid device ID (devid) is found using one of the above +functions, the associated device can be queried and controlled using +the functions: + +void cyg_pci_get_device_info ( cyg_pci_device_id devid, + cyg_pci_device *dev_info ); +void cyg_pci_set_device_info ( cyg_pci_device_id devid, + cyg_pci_device *dev_info ); +The cyg_pci_device structure (defined in +pci.h) primarily holds information as described by the PCI + specification [1]. +The pci1 test prints out some of this information: + // Get device info + cyg_pci_get_device_info(devid, &dev_info); + diag_printf("\n Command 0x%04x, Status 0x%04x\n", + dev_info.command, dev_info.status); +The command register can also be written to, controlling (among +other things) whether the device responds to IO and memory access +from the bus. + + +Specific config information +The above functions only allow access to generic PCI config +registers. A device can have extra config registers not specified +by the PCI specification. These can be accessed with these functions: + +void cyg_pci_read_config_uint8( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint8 *val); +void cyg_pci_read_config_uint16( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint16 *val); +void cyg_pci_read_config_uint32( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint32 *val); +void cyg_pci_write_config_uint8( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint8 val); +void cyg_pci_write_config_uint16( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint16 val); +void cyg_pci_write_config_uint32( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint32 val); + +The write functions should only be used for device-specific +config registers since using them on generic registers may invalidate +the contents of a previously fetched cyg_pci_device +structure. + + +Allocating memory +A PCI device ignores all IO and memory access from the PCI +bus until it has been activated. Activation cannot happen until +after device configuration. Configuration means telling the device +where it should map its IO and memory resources. This is done with +one of the following functions:: +cyg_bool cyg_pci_configure_device( cyg_pci_device *dev_info ); +cyg_bool cyg_pci_configure_bus( cyg_uint8 bus, cyg_uint8 *next_bus ); + +The cyg_pci_configure_device handles all IO +and memory regions that need configuration on non-bridge devices. On +platforms with multiple busses connected by bridges, the +cyg_pci_configure_bus function should be used. It will recursively +configure all devices on the given bus and all +subordinate busses. cyg_pci_configure_bus will +use cyg_pci_configure_device to configure +individual non-bridge devices. + + Each region is represented in the PCI device's config space by BARs +(Base Address Registers) and is handled individually according to type +using these functions: +cyg_bool cyg_pci_allocate_memory( cyg_pci_device *dev_info, + cyg_uint32 bar, + CYG_PCI_ADDRESS64 *base ); +cyg_bool cyg_pci_allocate_io( cyg_pci_device *dev_info, + cyg_uint32 bar, + CYG_PCI_ADDRESS32 *base ); +The memory bases (in two distinct address spaces) are increased +as memory regions are allocated to devices. Allocation will fail +(the function returns false) if the base exceeds the limits of the +address space (IO is 1MB, memory is 2^32 or 2^64 bytes). +These functions can also be called directly by the application/driver +if necessary, but this should not be necessary. +The bases are initialized with default values provided by +the HAL. It is possible for an application to override these using +the following functions: +void cyg_pci_set_memory_base( CYG_PCI_ADDRESS64 base ); +void cyg_pci_set_io_base( CYG_PCI_ADDRESS32 base ); +When a device has been configured, the cyg_pci_device +structure will contain the physical address in the CPU's +address space where the device's memory regions can be +accessed. +This information is provided in base_map[] - +there is a 32 bit word for each of the device's BARs. For +32 bit PCI memory regions, each 32 bit word will be an actual pointer +that can be used immediately by the driver: the memory space will normally +be linearly addressable by the CPU. +However, for 64 bit PCI memory regions, some (or all) of the +region may be outside of the CPUs address space. In this case the +driver will need to know how to access the region in segments. This +functionality may be adopted by the eCos HAL if deemed useful in +the future. The 2GB available on many systems should suffice though. + + +Interrupts +A device may generate interrupts. The HAL vector associated +with a given device on the bus is platform specific. This function +allows a driver to find the actual interrupt vector for a given +device: +cyg_bool cyg_pci_translate_interrupt( cyg_pci_device *dev_info, + CYG_ADDRWORD *vec ); +If the function returns false, no interrupts will be generated +by the device. If it returns true, the CYG_ADDRWORD pointed +to by vec is updated with the HAL interrupt vector the device will +be using. This is how the function is used in the pci1 +test: + if (cyg_pci_translate_interrupt(&dev_info, &irq)) + diag_printf(" Wired to HAL vector %d\n", irq); + else + diag_printf(" Does not generate interrupts.\n"); +The application/drive should attach an interrupt +handler to a device's interrupt before activating the device. + + +Activating a device +When the device has been allocated memory space it can be +activated. This is not done by the library since a driver may have +to initialize more state on the device before it can be safely activated. +Activating the device is done by enabling flags in its command +word. As an example, see the pci1 test which can be +configured to enable the devices it finds. This allows these to be accessed from +GDB (if a breakpoint is set on cyg_test_exit): +#ifdef ENABLE_PCI_DEVICES + { + cyg_uint16 cmd; + + // Don't use cyg_pci_set_device_info since it clears + // some of the fields we want to print out below. + cyg_pci_read_config_uint16(dev_info.devid, + CYG_PCI_CFG_COMMAND, &cmd); + cmd |= CYG_PCI_CFG_COMMAND_IO|CYG_PCI_CFG_COMMAND_MEMORY; + cyg_pci_write_config_uint16(dev_info.devid, + CYG_PCI_CFG_COMMAND, cmd); + } + diag_printf(" **** Device IO and MEM access enabled\n"); +#endif +NoteThe best way to activate a device is actually +through cyg_pci_set_device_info(), +but in this particular case the cyg_pci_device +structure contents from before the activation is required for printout +further down in the code. + + +Links +See these links for more information about PCI: + + +http://www.pcisig.com/ - information on the PCI specifications + + +http://www.yourvote.com/pci/ + - list of vendor and device IDs + + +http://www.picmg.org/ + - PCI Industrial Computer Manufacturers Group + + + + + +PCI Library reference +This document defines the PCI Support Library for eCos. +The PCI support library provides a set of routines for accessing +the PCI bus configuration space in a portable manner. This is provided +by two APIs. The high level API is used by device drivers, or other +code, to access the PCI configuration space portably. The low level +API is used by the PCI library itself to access the hardware in +a platform-specific manner, and may also be used by device drivers +to access the PCI configuration space directly. +Underlying the low-level API is HAL support for the basic +configuration space operations. These should not generally be used +by any code other than the PCI library, and are present in the HAL +to allow low level initialization of the PCI bus and devices to +take place if necessary. + +PCI Library API +The PCI library provides the following routines and types +for accessing the PCI configuration space. +The API for the PCI library is found in the header file +<cyg/io/pci.h>. + + +Definitions +The header file contains definitions for the common configuration +structure offsets and specimen values for device, vendor and class +code. + + +Types and data structures +The following types are defined: +typedef CYG_WORD32 cyg_pci_device_id; +This is comprised of the bus number, device number and functional +unit numbers packed into a single word. The macro CYG_PCI_DEV_MAKE_ID() +, in conjunction with the CYG_PCI_DEV_MAKE_DEVFN() +macro, may be used to construct a device id from the bus, device and functional +unit numbers. Similarly the macros CYG_PCI_DEV_GET_BUS(), +CYG_PCI_DEV_GET_DEVFN(), +CYG_PCI_DEV_GET_DEV(), and +CYG_PCI_DEV_GET_FN() may be used to extract the +constituent parts of a device id. It should not be necessary to use these +macros under normal circumstances. The following code fragment demonstrates +how these macros may be used: + + // Create a packed representation of device 1, function 0 + cyg_uint8 devfn = CYG_PCI_DEV_MAKE_DEVFN(1,0); + + // Create a packed devid for that device on bus 2 + cyg_pci_device_id devid = CYG_PCI_DEV_MAKE_ID(2, devfn); + + diag_printf("bus %d, dev %d, func %d\n", + CYG_PCI_DEV_GET_BUS(devid), + CYG_PCI_DEV_GET_DEV(CYG_PCI_DEV_GET_DEVFN(devid)), + CYG_PCI_DEV_GET_FN(CYG_PCI_DEV_GET_DEVFN(devid)); + +typedef struct cyg_pci_device; +This structure is used to contain data read from a PCI device's +configuration header by cyg_pci_get_device_info(). +It is also used to record the resource allocations made to the device. +typedef CYG_WORD64 CYG_PCI_ADDRESS64; +typedef CYG_WORD32 CYG_PCI_ADDRESS32; +Pointers in the PCI address space are 32 bit (IO space) or +32/64 bit (memory space). In most platform and device configurations +all of PCI memory will be linearly addressable using only 32 bit +pointers as read from base_map[]. +The 64 bit type is used to allow handling 64 bit devices in +the future, should it be necessary, without changing the library's +API. + + +Functions +void cyg_pci_init(void); +Initialize the PCI library and establish contact with the +hardware. This function is idempotent and can be called either by +all drivers in the system, or just from an application initialization +function. +cyg_bool cyg_pci_find_device( cyg_uint16 vendor, + cyg_uint16 device, + cyg_pci_device_id *devid ); +Searches the PCI bus configuration space for a device with +the given vendor and device +ids. The search starts at the device pointed to by devid, +or at the first slot if it contains CYG_PCI_NULL_DEVID. +*devid will be updated with the ID of the next device +found. Returns true if one is found and false + if not. +cyg_bool cyg_pci_find_class( cyg_uint32 dev_class, + cyg_pci_device_id *devid ); +Searches the PCI bus configuration space for a device with +the given dev_class class code. The search starts at the +device pointed to by devid, or at the first slot if it +contains CYG_PCI_NULL_DEVID. +*devid will be updated with the ID of the next +device found. Returns true if one is found and +false if not. +cyg_bool cyg_pci_find_next( cyg_pci_device_id cur_devid, + cyg_pci_device_id *next_devid ); +Searches the PCI configuration space for the next valid device +after cur_devid. If cur_devid +is given the value CYG_PCI_NULL_DEVID, then the search starts +at the first slot. It is permitted for next_devid to +point to cur_devid. Returns true +if another device is found and false if not. + +cyg_bool cyg_pci_find_matching( cyg_pci_match_func *matchp, + void * match_callback_data, + cyg_pci_device_id *devid ); + +Searches the PCI bus configuration space for a device whose properties +match those required by the caller supplied cyg_pci_match_func. +The search starts at the device pointed to by devid, or +at the first slot if it contains CYG_PCI_NULL_DEVID. The +devid will be updated with the ID of the next device found. +This function returns true if a matching device is found +and false if not. + +The match_func has a type declared as: + +typedef cyg_bool (cyg_pci_match_func)( cyg_uint16 vendor, + cyg_uint16 device, + cyg_uint32 class, + void * user_data); + +The vendor, device, and +class are from the device configuration space. The +user_data is the callback data passed to +cyg_pci_find_matching. + +void cyg_pci_get_device_info ( cyg_pci_device_id devid, + cyg_pci_device *dev_info ); +This function gets the PCI configuration information for the +device indicated in devid. The common fields of the +cyg_pci_device structure, and the appropriate fields +of the relevant header union member are filled in from the device's +configuration space. +If the device has not been enabled, then this function will also fetch +the size and type information from the base address registers and +place it in the base_size[] array. +void cyg_pci_set_device_info ( cyg_pci_device_id devid, + cyg_pci_device *dev_info ); +This function sets the PCI configuration information for the +device indicated in devid. Only the configuration space +registers that are writable are actually written. Once all the fields have +been written, the device info will be read back into *dev_info +, so that it reflects the true state of the hardware. + +void cyg_pci_read_config_uint8( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint8 *val ); +void cyg_pci_read_config_uint16( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint16 *val ); +void cyg_pci_read_config_uint32( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint32 *val ); + +These functions read registers of the appropriate size from +the configuration space of the given device. They should mainly +be used to access registers that are device specific. General PCI +registers are best accessed through cyg_pci_get_device_info() +. + +void cyg_pci_write_config_uint8( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint8 val ); +void cyg_pci_write_config_uint16( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint16 val ); +void cyg_pci_write_config_uint32( cyg_pci_device_id devid, + cyg_uint8 offset, cyg_uint32 val ); + +These functions write registers of the appropriate size to +the configuration space of the given device. They should mainly +be used to access registers that are device specific. General PCI +registers are best accessed through cyg_pci_get_device_info() +. Writing the general registers this way may render the contents of +a cyg_pci_device structure invalid. + + +Resource allocation +These routines allocate memory and I/O space to PCI devices. +cyg_bool cyg_pci_configure_device( cyg_pci_device *dev_info ) +Allocate memory and IO space to all base address registers +using the current memory and IO base addresses in the library. The +allocated base addresses, translated into directly usable values, +will be put into the matching base_map[] entries +in *dev_info. If *dev_info does +not contain valid base_size[] entries, then the result is +false. This function will also call +cyg_pci_translate_interrupt() to put the interrupt vector into the +HAL vector entry. +cyg_bool cyg_pci_configure_bus( cyg_uint8 bus, cyg_uint8 *next_bus ) + +Allocate memory and IO space to all base address registers on all devices +on the given bus and all subordinate busses. If a PCI-PCI bridge is found on +bus, this function will call itself recursively in order +to configure the bus on the other side of the bridge. Because of the nature of +bridge devices, all devices on the secondary side of a bridge must be allocated +memory and IO space before the memory and IO windows on the bridge device can be +properly configured. The next_bus argument points to the +bus number to assign to the next subordinate bus found. The number will be +incremented as new busses are discovered. If successful, true +is returned. Otherwise, false is returned. + + +cyg_bool cyg_pci_translate_interrupt( cyg_pci_device *dev_info, + CYG_ADDRWORD *vec ); + +Translate the device's PCI interrupt (INTA#-INTD#) +to the associated HAL vector. This may also depend on which slot +the device occupies. If the device may generate interrupts, the +translated vector number will be stored in vec and the +result is true. Otherwise the result is false +. + +cyg_bool cyg_pci_allocate_memory( cyg_pci_device *dev_info, + cyg_uint32 bar, + CYG_PCI_ADDRESS64 *base ); +cyg_bool cyg_pci_allocate_io( cyg_pci_device *dev_info, + cyg_uint32 bar, + CYG_PCI_ADDRESS32 *base ); + +These routines allocate memory or I/O space to the base address +register indicated by bar. The base address in +*base will be correctly aligned and the address of the +next free location will be written back into it if the allocation succeeds. If +the base address register is of the wrong type for this allocation, or +dev_info does not contain valid base_size[] + entries, the result is false. These functions +allow a device driver to set up its own mappings if it wants. Most devices +should probably use cyg_pci_configure_device(). +void cyg_pci_set_memory_base( CYG_PCI_ADDRESS64 base ); +void cyg_pci_set_io_base( CYG_PCI_ADDRESS32 base ); +These routines set the base addresses for memory and I/O mappings +to be used by the memory allocation routines. Normally these base +addresses will be set to default values based on the platform. These +routines allow these to be changed by application code if necessary. + + +PCI Library Hardware API +This API is used by the PCI library to access the PCI bus +configuration space. Although it should not normally be necessary, +this API may also be used by device driver or application code to +perform PCI bus operations not supported by the PCI library. +void cyg_pcihw_init(void); +Initialize the PCI hardware so that the configuration space +may be accessed. + +void cyg_pcihw_read_config_uint8( cyg_uint8 bus, + cyg_uint8 devfn, cyg_uint8 offset, cyg_uint8 *val); +void cyg_pcihw_read_config_uint16( cyg_uint8 bus, + cyg_uint8 devfn, cyg_uint8 offset, cyg_uint16 *val); +void cyg_pcihw_read_config_uint32( cyg_uint8 bus, + cyg_uint8 devfn, cyg_uint8 offset, cyg_uint32 *val); + +These functions read a register of the appropriate size from +the PCI configuration space at an address composed from the bus +, devfn and offset +arguments. + +void cyg_pcihw_write_config_uint8( cyg_uint8 bus, + cyg_uint8 devfn, cyg_uint8 offset, cyg_uint8 val); +void cyg_pcihw_write_config_uint16( cyg_uint8 bus, + cyg_uint8 devfn, cyg_uint8 offset, cyg_uint16 val); +void cyg_pcihw_write_config_uint32( cyg_uint8 bus, + cyg_uint8 devfn, cyg_uint8 offset, cyg_uint32 val); + +These functions write a register of the appropriate size to +the PCI configuration space at an address composed from the +bus, devfn and +offset arguments. + +cyg_bool cyg_pcihw_translate_interrupt( cyg_uint8 bus, + cyg_uint8 devfn, + CYG_ADDRWORD *vec); + +This function interrogates the device and determines which +HAL interrupt vector it is connected to. + + +HAL PCI support +HAL support consists of a set of C macros that provide the +implementation of the low level PCI API. +HAL_PCI_INIT() +Initialize the PCI bus. +HAL_PCI_READ_UINT8( bus, devfn, offset, val ) +HAL_PCI_READ_UINT16( bus, devfn, offset, val ) +HAL_PCI_READ_UINT32( bus, devfn, offset, val ) +Read a value from the PCI configuration space of the appropriate +size at an address composed from the bus, +devfn and offset. +HAL_PCI_WRITE_UINT8( bus, devfn, offset, val ) +HAL_PCI_WRITE_UINT16( bus, devfn, offset, val ) +HAL_PCI_WRITE_UINT32( bus, devfn, offset, val ) +Write a value to the PCI configuration space of the appropriate +size at an address composed from the bus, +devfn and offset. +HAL_PCI_TRANSLATE_INTERRUPT( bus, devfn, *vec, valid ) +Translate the device's interrupt line into a HAL +interrupt vector. +HAL_PCI_ALLOC_BASE_MEMORY +HAL_PCI_ALLOC_BASE_IO +These macros define the default base addresses used to initialize +the memory and I/O allocation pointers. +HAL_PCI_PHYSICAL_MEMORY_BASE +HAL_PCI_PHYSICAL_IO_BASE +PCI memory and IO range do not always correspond directly +to physical memory or IO addresses. Frequently the PCI address spaces +are windowed into the processor's address range at some +offset. These macros define offsets to be added to the PCI base +addresses to translate PCI bus addresses into physical memory addresses +that can be used to access the allocated memory or IO space. + +The chunk of PCI memory space directly addressable though +the window by the CPU may be smaller than the amount of PCI memory +actually provided. In that case drivers will have to access PCI +memory space in segments. Doing this will be platform specific and +is currently beyond the scope of the HAL. + +HAL_PCI_IGNORE_DEVICE( bus, dev, fn )This macro, if defined, may be used to limit the devices which are +found by the bus scanning functions. This is sometimes necessary for +devices which need special handling. If this macro evaluates to true +, the given device will not be found by cyg_pci_find_next + or other bus scanning functions. + + + + + diff --git a/packages/io/pci/current/include/pci.h b/packages/io/pci/current/include/pci.h --- a/packages/io/pci/current/include/pci.h +++ b/packages/io/pci/current/include/pci.h @@ -7,29 +7,38 @@ // PCI library // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/pci/current/include/pci_cfg.h b/packages/io/pci/current/include/pci_cfg.h --- a/packages/io/pci/current/include/pci_cfg.h +++ b/packages/io/pci/current/include/pci_cfg.h @@ -7,29 +7,38 @@ // PCI configuration definitions // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/pci/current/include/pci_hw.h b/packages/io/pci/current/include/pci_hw.h --- a/packages/io/pci/current/include/pci_hw.h +++ b/packages/io/pci/current/include/pci_hw.h @@ -7,29 +7,38 @@ // PCI hardware library // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/pci/current/src/pci.c b/packages/io/pci/current/src/pci.c --- a/packages/io/pci/current/src/pci.c +++ b/packages/io/pci/current/src/pci.c @@ -5,29 +5,38 @@ // PCI library // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // @@ -62,6 +71,10 @@ void cyg_pci_init( void ) { if (!cyg_pci_lib_initialized) { + + cyg_pci_set_memory_base(HAL_PCI_ALLOC_BASE_MEMORY); + cyg_pci_set_io_base(HAL_PCI_ALLOC_BASE_IO); + // Initialize the PCI bus, preparing it for general access. cyg_pcihw_init(); @@ -173,7 +186,7 @@ cyg_pci_get_device_info ( cyg_pci_device dev_info->base_map[i] = tmp_addr; if ((bar & CYG_PRI_CFG_BAR_MEM_TYPE_MASK) == CYG_PRI_CFG_BAR_MEM_TYPE_64) - dev_info->base_map[i++] = tmp_addr >> 32; + dev_info->base_map[++i] = tmp_addr >> 32; } } } @@ -577,8 +590,8 @@ cyg_pci_find_matching( cyg_pci_match_fun //------------------------------------------------------------------------ // Resource Allocation -static CYG_PCI_ADDRESS64 cyg_pci_memory_base = HAL_PCI_ALLOC_BASE_MEMORY; -static CYG_PCI_ADDRESS32 cyg_pci_io_base = HAL_PCI_ALLOC_BASE_IO; +static CYG_PCI_ADDRESS64 cyg_pci_memory_base; +static CYG_PCI_ADDRESS32 cyg_pci_io_base; void cyg_pci_set_memory_base(CYG_PCI_ADDRESS64 base) diff --git a/packages/io/pci/current/src/pci_hw.c b/packages/io/pci/current/src/pci_hw.c --- a/packages/io/pci/current/src/pci_hw.c +++ b/packages/io/pci/current/src/pci_hw.c @@ -5,29 +5,38 @@ // PCI hardware library // //============================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //============================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/pci/current/tests/pci1.c b/packages/io/pci/current/tests/pci1.c --- a/packages/io/pci/current/tests/pci1.c +++ b/packages/io/pci/current/tests/pci1.c @@ -5,29 +5,38 @@ // Test PCI library API // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -48,12 +57,13 @@ #include // assertion macros // Package requirements -#if defined(CYGPKG_IO_PCI) && defined(CYGPKG_KERNEL) +#if defined(CYGPKG_IO_PCI) && defined(CYGPKG_KERNEL) && defined(CYGPKG_ISOINFRA) #include #include #include #include +#include // Package option requirements #if defined(CYGFUN_KERNEL_API_C) && defined(CYG_PCI_PRESENT) @@ -429,7 +439,7 @@ cyg_start(void) #endif #else // CYGPKG_IO_PCI && CYGPKG_KERNEL -#define N_A_MSG "Needs IO/PCI and Kernel" +#define N_A_MSG "Needs IO/PCI, ISOINFRA, and Kernel" #endif #ifdef N_A_MSG diff --git a/packages/io/pci/current/tests/pci2.c b/packages/io/pci/current/tests/pci2.c --- a/packages/io/pci/current/tests/pci2.c +++ b/packages/io/pci/current/tests/pci2.c @@ -5,29 +5,38 @@ // Test PCI library's resource allocation. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/pcmcia/current/ChangeLog b/packages/io/pcmcia/current/ChangeLog --- a/packages/io/pcmcia/current/ChangeLog +++ b/packages/io/pcmcia/current/ChangeLog @@ -1,3 +1,7 @@ +2002-04-12 Gary Thomas + + * include/pcmcia.h: Add prototype(s) to remove warnings. + 2000-09-17 Gary Thomas * include/pcmcia.h: @@ -28,27 +32,36 @@ 2000-07-11 Gary Thomas + + * tests/serial3.c (serial_test): Use 19200 baud rate when board + cannot handle 38400. + * tests/serial5.c (serial_test): Same. + +2002-02-19 Jesper Skov + + * cdl/io_serial.cdl: Removed termiostty.c build rule. + + * cdl/termios.cdl: Make termiostty.c building depending on actual + requirements for its content. + +2002-02-15 Jesper Skov + + * tests/flow1.c: Also try DSR/DTR flow control (presently + unsupported by Linux though). + * tests/flow2.c: Same. + +2002-01-11 Jonathan Larmour + + * src/common/termiostty.c (termios_read): Don't return after VMIN, + this was a stupid thing to do and decreases performance a lot. + 2001-08-15 Gary Thomas * tests/ser_test_protocol.inl: Change NONE in 'cyg_verbosity_level_t' @@ -1379,27 +1403,36 @@ 1999-03-03 Gary Thomas 0 } + compile -library=libextras.a common/termiostty.c +} + + cdl_component CYGPKG_IO_SERIAL_TERMIOS_TERMIOS0 { display "Termios TTY channel #0" flavor bool default_value 0 + implements CYGINT_IO_SERIAL_TERMIOS_TERMIOS_TTY description " This option causes '/dev/termios0' to be included in the standard drivers." @@ -60,6 +82,7 @@ cdl_component CYGPKG_IO_SERIAL_TERMIOS_T display "Termios TTY channel #1" flavor bool default_value 0 + implements CYGINT_IO_SERIAL_TERMIOS_TERMIOS_TTY description " This option causes '/dev/termios1' to be included in the standard drivers." @@ -78,6 +101,7 @@ cdl_component CYGPKG_IO_SERIAL_TERMIOS_T display "Termios TTY channel #2" flavor bool default_value 0 + implements CYGINT_IO_SERIAL_TERMIOS_TERMIOS_TTY description " This option causes '/dev/termios2' to be included in the standard drivers." diff --git a/packages/io/serial/current/cdl/tty.cdl b/packages/io/serial/current/cdl/tty.cdl --- a/packages/io/serial/current/cdl/tty.cdl +++ b/packages/io/serial/current/cdl/tty.cdl @@ -5,29 +5,38 @@ # eCos serial TTY configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/io/serial/current/include/serial.h b/packages/io/serial/current/include/serial.h --- a/packages/io/serial/current/include/serial.h +++ b/packages/io/serial/current/include/serial.h @@ -7,29 +7,38 @@ // Device I/O // // ==================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // ==================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/include/serialio.h b/packages/io/serial/current/include/serialio.h --- a/packages/io/serial/current/include/serialio.h +++ b/packages/io/serial/current/include/serialio.h @@ -7,29 +7,38 @@ // Device I/O // // ==================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // ==================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/include/ttyio.h b/packages/io/serial/current/include/ttyio.h --- a/packages/io/serial/current/include/ttyio.h +++ b/packages/io/serial/current/include/ttyio.h @@ -7,29 +7,38 @@ // Device I/O // // ==================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // ==================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/misc/console.c b/packages/io/serial/current/misc/console.c --- a/packages/io/serial/current/misc/console.c +++ b/packages/io/serial/current/misc/console.c @@ -5,29 +5,38 @@ // Initial device I/O tests // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/misc/serial.c b/packages/io/serial/current/misc/serial.c --- a/packages/io/serial/current/misc/serial.c +++ b/packages/io/serial/current/misc/serial.c @@ -5,29 +5,38 @@ // Initial device I/O tests // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/misc/timeout.inl b/packages/io/serial/current/misc/timeout.inl --- a/packages/io/serial/current/misc/timeout.inl +++ b/packages/io/serial/current/misc/timeout.inl @@ -7,29 +7,38 @@ // Simple timeout support for serial I/O testing. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/src/common/haldiag.c b/packages/io/serial/current/src/common/haldiag.c --- a/packages/io/serial/current/src/common/haldiag.c +++ b/packages/io/serial/current/src/common/haldiag.c @@ -5,29 +5,38 @@ // Serial I/O interface module using HAL I/O routines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/src/common/serial.c b/packages/io/serial/current/src/common/serial.c --- a/packages/io/serial/current/src/common/serial.c +++ b/packages/io/serial/current/src/common/serial.c @@ -5,29 +5,38 @@ // High level serial driver // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/src/common/termios.c b/packages/io/serial/current/src/common/termios.c --- a/packages/io/serial/current/src/common/termios.c +++ b/packages/io/serial/current/src/common/termios.c @@ -5,29 +5,38 @@ // POSIX termios API implementation // // ==================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // ==================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/src/common/termiostty.c b/packages/io/serial/current/src/common/termiostty.c --- a/packages/io/serial/current/src/common/termiostty.c +++ b/packages/io/serial/current/src/common/termiostty.c @@ -5,29 +5,38 @@ // POSIX Termios compatible TTY I/O driver // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -749,8 +758,9 @@ termios_read(cyg_io_handle_t handle, voi returnnow = true; // FIXME: true even for INLCR? } // else if } else { // non-canonical mode + /* This is completely wrong: if ( size+1 >= t->c_cc[ VMIN ] ) - returnnow = true; + returnnow = true;*/ } // else #ifdef CYGSEM_IO_SERIAL_TERMIOS_USE_SIGNALS diff --git a/packages/io/serial/current/src/common/tty.c b/packages/io/serial/current/src/common/tty.c --- a/packages/io/serial/current/src/common/tty.c +++ b/packages/io/serial/current/src/common/tty.c @@ -5,29 +5,38 @@ // TTY (terminal-like interface) I/O driver // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/tests/flow1.c b/packages/io/serial/current/tests/flow1.c --- a/packages/io/serial/current/tests/flow1.c +++ b/packages/io/serial/current/tests/flow1.c @@ -5,29 +5,38 @@ // Test data half-duplex receive and send with flow control. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -166,6 +175,13 @@ serial_test( void ) new_cfg.flags |= CYGNUM_SERIAL_FLOW_RTSCTS_RX|CYGNUM_SERIAL_FLOW_RTSCTS_TX; if (ENOERR == change_config(ser_handle, &new_cfg)) run_tests( ser_handle ); + + CYG_TEST_INFO("Setting DSR/DTR hardware flow control"); + + new_cfg = *cfg; + new_cfg.flags |= CYGNUM_SERIAL_FLOW_DSRDTR_RX|CYGNUM_SERIAL_FLOW_DSRDTR_TX; + if (ENOERR == change_config(ser_handle, &new_cfg)) + run_tests( ser_handle ); #endif CYG_TEST_PASS_FINISH("flow1 test OK"); diff --git a/packages/io/serial/current/tests/flow2.c b/packages/io/serial/current/tests/flow2.c --- a/packages/io/serial/current/tests/flow2.c +++ b/packages/io/serial/current/tests/flow2.c @@ -5,29 +5,38 @@ // Test duplex receive and send with flow control. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -133,12 +142,19 @@ serial_test( void ) // hardware flow control #ifdef CYGOPT_IO_SERIAL_FLOW_CONTROL_HW - CYG_TEST_INFO("Setting hardware flow control"); + CYG_TEST_INFO("Setting RTS/CTS hardware flow control"); new_cfg = *cfg; new_cfg.flags |= CYGNUM_SERIAL_FLOW_RTSCTS_RX|CYGNUM_SERIAL_FLOW_RTSCTS_TX; if (ENOERR == change_config(ser_handle, &new_cfg)) run_tests( ser_handle ); + + CYG_TEST_INFO("Setting DSR/DTR hardware flow control"); + + new_cfg = *cfg; + new_cfg.flags |= CYGNUM_SERIAL_FLOW_DSRDTR_RX|CYGNUM_SERIAL_FLOW_DSRDTR_TX; + if (ENOERR == change_config(ser_handle, &new_cfg)) + run_tests( ser_handle ); #endif CYG_TEST_PASS_FINISH("flow2 test OK"); diff --git a/packages/io/serial/current/tests/ser_test_protocol.inl b/packages/io/serial/current/tests/ser_test_protocol.inl --- a/packages/io/serial/current/tests/ser_test_protocol.inl +++ b/packages/io/serial/current/tests/ser_test_protocol.inl @@ -5,29 +5,38 @@ // Serial device driver testing protocol // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/tests/serial1.c b/packages/io/serial/current/tests/serial1.c --- a/packages/io/serial/current/tests/serial1.c +++ b/packages/io/serial/current/tests/serial1.c @@ -5,29 +5,38 @@ // Test serial driver API // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/tests/serial2.c b/packages/io/serial/current/tests/serial2.c --- a/packages/io/serial/current/tests/serial2.c +++ b/packages/io/serial/current/tests/serial2.c @@ -5,29 +5,38 @@ // Test simple string output. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/tests/serial3.c b/packages/io/serial/current/tests/serial3.c --- a/packages/io/serial/current/tests/serial3.c +++ b/packages/io/serial/current/tests/serial3.c @@ -5,29 +5,38 @@ // Test data half-duplex receive and send. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -73,16 +82,18 @@ serial_test( void ) // We need the filter for this test. test_ping(ser_handle); -#if defined(CYGPKG_HAL_ARM_AEB) +#if (CYGINT_IO_SERIAL_TEST_SKIP_38400 > 0) { - // The AEB board is too slow to run the driver in interrupt mode - // at the default 38400 baud when doing this test. - cyg_ser_cfg_t arm_aeb_cfg = { - CYGNUM_SERIAL_BAUD_14400, CYGNUM_SERIAL_WORD_LENGTH_8, + // The board is too slow to run the driver in interrupt mode + // at the default 38400 baud when doing this test, so run it + // at a slower rate. + cyg_ser_cfg_t slow_cfg = { + CYGNUM_SERIAL_BAUD_19200, CYGNUM_SERIAL_WORD_LENGTH_8, CYGNUM_SERIAL_STOP_1, CYGNUM_SERIAL_PARITY_NONE, CYGNUM_SERIAL_FLOW_NONE }; - change_config(ser_handle, &arm_aeb_cfg); + CYG_TEST_INFO("Reducing baud rate to 19200"); + change_config(ser_handle, &slow_cfg); } #endif diff --git a/packages/io/serial/current/tests/serial4.c b/packages/io/serial/current/tests/serial4.c --- a/packages/io/serial/current/tests/serial4.c +++ b/packages/io/serial/current/tests/serial4.c @@ -5,29 +5,38 @@ // Test serial configuration changing // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/tests/serial5.c b/packages/io/serial/current/tests/serial5.c --- a/packages/io/serial/current/tests/serial5.c +++ b/packages/io/serial/current/tests/serial5.c @@ -5,29 +5,38 @@ // Test data duplex receive and send. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -73,19 +82,18 @@ serial_test( void ) test_ping(ser_handle); -#if defined(CYGPKG_HAL_MN10300) \ - || defined(CYGPKG_HAL_ARM_AEB) \ - || defined(__thumb__) \ - || 0 +#if (CYGINT_IO_SERIAL_TEST_SKIP_38400 > 0) { - // Some boards are too slow to run the driver in interrupt mode - // at the default 38400 baud when doing this test. - cyg_ser_cfg_t cfg = { - CYGNUM_SERIAL_BAUD_9600, CYGNUM_SERIAL_WORD_LENGTH_8, + // The board is too slow to run the driver in interrupt mode + // at the default 38400 baud when doing this test, so run it + // at a slower rate. + cyg_ser_cfg_t slow_cfg = { + CYGNUM_SERIAL_BAUD_19200, CYGNUM_SERIAL_WORD_LENGTH_8, CYGNUM_SERIAL_STOP_1, CYGNUM_SERIAL_PARITY_NONE, CYGNUM_SERIAL_FLOW_NONE }; - change_config(ser_handle, &cfg); + CYG_TEST_INFO("Reducing baud rate to 19200"); + change_config(ser_handle, &slow_cfg); } #endif diff --git a/packages/io/serial/current/tests/serial_echo.c b/packages/io/serial/current/tests/serial_echo.c --- a/packages/io/serial/current/tests/serial_echo.c +++ b/packages/io/serial/current/tests/serial_echo.c @@ -5,29 +5,38 @@ // Simple interactive echo test. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/tests/timeout.inl b/packages/io/serial/current/tests/timeout.inl --- a/packages/io/serial/current/tests/timeout.inl +++ b/packages/io/serial/current/tests/timeout.inl @@ -7,29 +7,38 @@ // Simple timeout support for serial I/O testing. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/tests/tty1.c b/packages/io/serial/current/tests/tty1.c --- a/packages/io/serial/current/tests/tty1.c +++ b/packages/io/serial/current/tests/tty1.c @@ -5,29 +5,38 @@ // Test TTY driver API // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/serial/current/tests/tty2.c b/packages/io/serial/current/tests/tty2.c --- a/packages/io/serial/current/tests/tty2.c +++ b/packages/io/serial/current/tests/tty2.c @@ -5,29 +5,38 @@ // Test simple string output. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/usb/common/current/ChangeLog b/packages/io/usb/common/current/ChangeLog --- a/packages/io/usb/common/current/ChangeLog +++ b/packages/io/usb/common/current/ChangeLog @@ -12,27 +12,36 @@ 2000-11-21 Bart Veer - - - - - - - - - - - - - - - - - +####ECOSGPLCOPYRIGHTBEGIN#### + ------------------------------------------- + This file is part of eCos, the Embedded Configurable Operating System. + Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + + eCos is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 or (at your option) any later version. + + eCos is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with eCos; if not, write to the Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + + As a special exception, if other files instantiate templates or use macros + or inline functions from this file, or you compile this file and link it + with other works to produce a work based on this file, this file does not + by itself cause the resulting work to be covered by the GNU General Public + License. However the source code for this file must still be made available + in accordance with section (3) of the GNU General Public License. + + This exception does not invalidate any other reasons why a work based on + this file might be covered by the GNU General Public License. + + Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. + at http://sources.redhat.com/ecos/ecos-license + ------------------------------------------- +####ECOSGPLCOPYRIGHTEND#### @@ -814,4 +829,4 @@ driver has been activated. - \ No newline at end of file + diff --git a/packages/io/usb/eth/slave/current/host/ecos_usbeth.c b/packages/io/usb/eth/slave/current/host/ecos_usbeth.c --- a/packages/io/usb/eth/slave/current/host/ecos_usbeth.c +++ b/packages/io/usb/eth/slave/current/host/ecos_usbeth.c @@ -5,30 +5,38 @@ // Linux device driver for eCos-based USB ethernet peripherals. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ---------------------------------------------------------------------------- -// Copyright (C) 2000, 2001 Red Hat, Inc. +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. // -// This file is part of the eCos USB support. +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// 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., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// ---------------------------------------------------------------------------- -// -//####COPYRIGHTEND#### +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/usb/eth/slave/current/include/usbs_eth.h b/packages/io/usb/eth/slave/current/include/usbs_eth.h --- a/packages/io/usb/eth/slave/current/include/usbs_eth.h +++ b/packages/io/usb/eth/slave/current/include/usbs_eth.h @@ -7,29 +7,38 @@ // Description of the USB slave-side ethernet support // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -176,7 +185,7 @@ extern "C" { // Network driver definition, to support cloning of usbs_eth_netdev0 #ifdef CYGPKG_USBS_ETHDRV -# include +# include #endif // Cache details, to allow alignment to cache line boundaries etc. diff --git a/packages/io/usb/eth/slave/current/src/usbseth.c b/packages/io/usb/eth/slave/current/src/usbseth.c --- a/packages/io/usb/eth/slave/current/src/usbseth.c +++ b/packages/io/usb/eth/slave/current/src/usbseth.c @@ -5,29 +5,38 @@ // Support for USB-ethernet devices, slave-side. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -53,8 +62,8 @@ #include #ifdef CYGPKG_USBS_ETHDRV -#include -#include +#include +#include #endif // ---------------------------------------------------------------------------- diff --git a/packages/io/usb/eth/slave/current/src/usbsethdrv.c b/packages/io/usb/eth/slave/current/src/usbsethdrv.c --- a/packages/io/usb/eth/slave/current/src/usbsethdrv.c +++ b/packages/io/usb/eth/slave/current/src/usbsethdrv.c @@ -5,29 +5,38 @@ // Network device driver for USB-ethernet devices. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -44,9 +53,9 @@ #include #define __ECOS 1 -#include -#include -#include +#include +#include +#include #include #include diff --git a/packages/io/usb/slave/current/ChangeLog b/packages/io/usb/slave/current/ChangeLog --- a/packages/io/usb/slave/current/ChangeLog +++ b/packages/io/usb/slave/current/ChangeLog @@ -1,3 +1,21 @@ +2002-01-23 Bart Veer + + * host/Makefile.am, host/Makefile.in, host/acinclude.m4, + host/aclocal.m4, host/configure, host/configure.in, + host/usbhost.c, host/usbhost.tcl, host/verbose.tcl + Host-side support for USB testing + + * tests/usbtarget.c, tests/common.c, tests/protocol.h: + New files containing the target-side testing support and + support files. + + * cdl/usbs.cdl: + Add a configuration option to build the target-side testing + support. + + * doc/usbs.sgml, doc/*.html: + Document the testing support. Regenerate html. + 2001-09-14 Bart Veer * doc/usbs.sgml, doc/*.html: @@ -72,27 +90,36 @@ 2000-11-21 Bart Veer host endpoints" } + + cdl_option CYGBLD_IO_USB_SLAVE_USBTEST { + display "Build the main USB test program" + doc usbs-testing.html + description " + The USB slave-side software is supplied with host-side + and target-side software that allows a variety of testing + to be performed. The slave-side software is not built + by default since it can only operate in specific environments + and in conjunction with the host-side software. Enabling + this option causes the slave-side software to be added + to the list of test cases for the current configuration." + default_value 0 + implements CYGINT_IO_USB_SLAVE_CLIENTS + requires { is_substr(CYGPKG_IO_USB_SLAVE_TESTS, " tests/usbtarget") } + + requires CYGFUN_KERNEL_API_C CYGFUN_KERNEL_THREADS_TIMER !CYGINT_KNEREL_SCHEDULER_UNIQUE_PRIORITIES + requires CYGPKG_LIBC_STDIO CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS + } + + cdl_option CYGPKG_IO_USB_SLAVE_TESTS { + display "Kernel tests" + flavor data + no_define + default_value { "" } + description "This option specifies the set of tests to be + built for the USB slave package" + } } diff --git a/packages/io/usb/slave/current/doc/io-usb-slave.html b/packages/io/usb/slave/current/doc/io-usb-slave.html --- a/packages/io/usb/slave/current/doc/io-usb-slave.html +++ b/packages/io/usb/slave/current/doc/io-usb-slave.html @@ -1,4 +1,4 @@ - + @@ -126,6 +126,11 @@ HREF="usbs-data.html" HREF="usbs-writing.html" >Writing a USB Device Driver — USB Device Driver Porting Guide
Testing — Testing of USB Device Drivers
+ diff --git a/packages/io/usb/slave/current/doc/usbs-data.html b/packages/io/usb/slave/current/doc/usbs-data.html --- a/packages/io/usb/slave/current/doc/usbs-data.html +++ b/packages/io/usb/slave/current/doc/usbs-data.html @@ -1,4 +1,4 @@ - + diff --git a/packages/io/usb/slave/current/doc/usbs-devtab.html b/packages/io/usb/slave/current/doc/usbs-devtab.html --- a/packages/io/usb/slave/current/doc/usbs-devtab.html +++ b/packages/io/usb/slave/current/doc/usbs-devtab.html @@ -1,4 +1,4 @@ - + diff --git a/packages/io/usb/slave/current/doc/usbs-enum.html b/packages/io/usb/slave/current/doc/usbs-enum.html --- a/packages/io/usb/slave/current/doc/usbs-enum.html +++ b/packages/io/usb/slave/current/doc/usbs-enum.html @@ -1,4 +1,4 @@ - + diff --git a/packages/io/usb/slave/current/doc/usbs-halt.html b/packages/io/usb/slave/current/doc/usbs-halt.html --- a/packages/io/usb/slave/current/doc/usbs-halt.html +++ b/packages/io/usb/slave/current/doc/usbs-halt.html @@ -1,4 +1,4 @@ - + diff --git a/packages/io/usb/slave/current/doc/usbs-intro.html b/packages/io/usb/slave/current/doc/usbs-intro.html --- a/packages/io/usb/slave/current/doc/usbs-intro.html +++ b/packages/io/usb/slave/current/doc/usbs-intro.html @@ -1,4 +1,4 @@ - + diff --git a/packages/io/usb/slave/current/doc/usbs-start-rx.html b/packages/io/usb/slave/current/doc/usbs-start-rx.html --- a/packages/io/usb/slave/current/doc/usbs-start-rx.html +++ b/packages/io/usb/slave/current/doc/usbs-start-rx.html @@ -1,4 +1,4 @@ - + diff --git a/packages/io/usb/slave/current/doc/usbs-start-tx.html b/packages/io/usb/slave/current/doc/usbs-start-tx.html --- a/packages/io/usb/slave/current/doc/usbs-start-tx.html +++ b/packages/io/usb/slave/current/doc/usbs-start-tx.html @@ -1,4 +1,4 @@ - + diff --git a/packages/io/usb/slave/current/doc/usbs-start.html b/packages/io/usb/slave/current/doc/usbs-start.html --- a/packages/io/usb/slave/current/doc/usbs-start.html +++ b/packages/io/usb/slave/current/doc/usbs-start.html @@ -1,4 +1,4 @@ - + diff --git a/packages/io/usb/slave/current/doc/usbs-testing.html b/packages/io/usb/slave/current/doc/usbs-testing.html new file mode 100644 --- /dev/null +++ b/packages/io/usb/slave/current/doc/usbs-testing.html @@ -0,0 +1,2267 @@ + + + + + + + + + + + +Testing +
eCos USB Slave Support
Prev 

Testing

Name

Testing -- Testing of USB Device Drivers

Introduction

The support for USB testing provided by the eCos USB common slave +package is somewhat different in nature from the kind of testing used +in many other packages. One obvious problem is that USB tests cannot +be run on just a bare target platform: instead the target platform +must be connected to a suitable USB host machine, and that host +machine must be running appropriate software for the test code to +interact with. This is very different from say a kernel test which +typically will have no external dependencies. Another important +difference between USB testing and say a C library +strcmp test is sensitivity to timing and to +hardware boundary conditions: although a simple test case that just +performs a small number of USB transfers is better than no testing at +all, it should also be possible to run tests for hours or days on end, +under a variety of loads. In order to provide the required +functionality the basic architecture of the USB testing support is as +follows:

  1. There is a single target-side program + usbtarget. By default when this is run + on a target platform it will appear to do nothing. In fact it is + waiting to be contacted by another program + usbhost which will tell it what test or + tests to run. usbtarget provides + mechanisms for running a wide range of tests. +

  2. usbtarget is a generic program, but USB + testing depends to some extent on the functionality provided by the + hardware. For example there is no point in testing bulk transmits + to endpoint 12 if the target hardware does not support an endpoint + 12. Therefore each USB device driver should supply information about + what the hardware is actually capable of, in the form of an array of + usbs_testing_endpoint data structures. +

  3. There is a single host-side program + usbhost, which acts as a counterpart to + usbtarget. Again + usbhost has no built-in knowledge of + the test or tests that are supposed to run, it only provides + mechanisms for running a wide range of tests. On start-up + usbhost will search the USB bus for + hardware running the target-side program, specifically a USB device + that identifies itself as the product "Red Hat eCos + USB test". +

  4. usbhost contains a Tcl interpreter, and + will execute any Tcl scripts specified on the command line + together with appropriate arguments. The Tcl interpreter has been + extended with various commands such as + usbtest::bulktest, so the script can perform + the desired test or tests. +

  5. Adding a new test simply involves writing a short Tcl script that + invokes the appropriate USB-specific commands. Running multiple + tests involves passing appropriate arguments to + usbhost, or alternatively writing a + single script that just invokes other scripts. +

The current implementation of usbhost +depends heavily on functionality provided by the Linux kernel and in +particular the usbdevfs support. It uses +/proc/bus/usb/devices to find out what devices +are attached to the bus, and will then access the device by opening +/proc/bus/usb/xxx/yyy and performing +ioctl operations. This allows USB testing to take +place without having to write a new host-side device driver, but +getting the code working on host machines not running Linux would +obviously be problematical.

Building and Running the Target-side Code

The target-side component of the USB testing software consists of a +single program usbtarget which contains +support for a range of different tests, under the control of host-side +software. This program is not built by default alongside other eCos +test cases since it will only operate in certain environments, +specifically when the target board's connector is plugged into a Linux +host, and when the appropriate host-side software has been installed +on that host. Instead the user must enable a configuration option +CYGBLD_IO_USB_SLAVE_USBTEST to add the program to +the list of tests for the current configuration.

Starting the usbtarget program does not +require anything unusual, so it can be run in a normal +gdb session just like any eCos application. +After initialization the program will wait for activity from the host. +Depending on the hardware, the Linux host will detect that a new USB +peripheral is present on the bus either when the +usbtarget initialization is complete or +when the cable between target and host is connected. The host will +perform the normal USB enumeration sequence and discover that the +peripheral does not match any known vendor or product id and that +there is no device driver for "Red Hat eCos USB +test", so it will ignore the peripheral. When the +usbhost program is run on the host it will +connect to the target-side software, and testing can now commence.

Building and Running the Host-side Code

Note: In theory the host-side software should be built when the package is +installed in the component repository, and removed when a package +is uninstalled. The current eCos administration tool does not provide +this functionality.

The host-side software should be built via the usual sequence of +"configure/make/make install". It can only be built on a +Linux host and the configure script contains an +explicit test for this. Because the eCos component repository should +generally be treated as a read-only resource the configure script will +also prevent you from trying to build inside the source tree. Instead +a separate build tree is required. Hence a typical sequence for +building the host-side software would be as follows:

$ mkdir usbhost_build
+$ cd usbhost_build
+$ <repo>packages/io/usb/slave/current/host/configure   <args> 
+$ make
+<output from make>
+$ su 
+$ make install
+<output from make install>
+$
The location of the eCos component repository should be substituted +for <repo>.
If the package has been obtained via CVS or anonymous CVS then the +package version will be current, as per the +example. If instead the package has been obtained as part of a full +eCos release or as a separate .epk file then the +appropriate package version should be used instead of +current.
The configure script takes the usual arguments such +as --prefix= to specify where the executables +and support files should be installed. The only other parameter that +some users may wish to specify is the location of a suitable Tcl +installation. By default usbhost will use +the existing Tcl installation in /usr, +as provided by your Linux distribution. An alternative Tcl +installation can be specified using the parameter +--with-tcl=, or alternatively using some +combination of --with-tcl-include, +--with-tcl-lib and +--with-tcl-version.
One of the host-side executables that gets built, +usbchmod, needs to be installed with suid +root privileges. Although the Linux kernel makes it possible for +applications to perform low-level USB operations such as transmitting +bulk packets, by default access to this functionality is restricted to +programs with superuser privileges. It is undesirable to run a complex +program such as usbhost with such +privileges, especially since the program contains a general-purpose +Tcl interpreter. Therefore when usbhost +starts up and discovers that it does not have sufficient access to the +appropriate entries in /proc/bus/usb, +it spawns an instance of usbchmod to modify +the permissions on these entries. usbchmod +will only do this for a USB device "Red Hat eCos USB +test", so installing this program suid root should not +introduce any security problems.

During make install the following actions will take +place:

  1. usbhost will be installed in /usr/local/bin, +or some other bin directory if +the default location is changed at configure-time using a +--prefix= or similar option. It will be +installed as the executable +usbhost_<version>, for example +usbhost_current, thus allowing several +releases of the USB slave package to co-exist. For convenience a +symbolic link from usbhost to this executable +will be created, so users can just run usbhost to +access the most recently-installed version.

  2. usbchmod will be installed in +/usr/local/libexec/ecos/io_usb_slave_<version>. +This program should only be run by usbhost, +not invoked directly, so it is not placed in the bin +directory. Again the presence of the package version in the directory +name allows multiple releases of the package to co-exist.

  3. A Tcl script usbhost.tcl will get installed in +the same directory as usbchmod. This Tcl +script is loaded automatically by the +usbhost executable.

  4. A number of additional Tcl scripts, for example +list.tcl will get installed alongside +usbhost.tcl. These correspond to various test +cases provided as standard. If a given test case is specified on the +command line and cannot be found relative to the current directory +then usbhost will search the install +directory for these test cases.

    Note: Strictly speaking installing the usbhost.tcl and +other Tcl scripts below the libexec +directory deviates from standard practice: they are +architecture-independent data files so should be installed below +the share subdirectory. In +practice the files are sufficiently small that there is no point in +sharing them, and keeping them below libexec +simplifies the host-side software somewhat.

The usbhost should be run only when there is a +suitable target attached to the USB bus and running the +usbtarget program. It will search +/proc/bus/usb/devices for an entry corresponding +to this program, invoke usbchmod if +necessary to change the access rights, and then interact with +usbtarget over the USB bus. +usbhost should be invoked as follows:

$ usbhost [-v|--version] [-h|--help] [-V|--verbose] <test> [<test parameters>]

  1. The -v or --version +option will display version information for +usbhost including the version of the USB +slave package that was used to build the executable.

  2. The -h or --help option +will display usage information.

  3. The -V or --verbose +option can be used to obtain more information at run-time, for example +some output for every USB transfer. This option can be repeated +multiple times to increase the amount of output.

  4. The first argument that does not begin with a hyphen specifies a test +that should be run, in the form of a Tcl script. For example an +argument of list.tcl will cause +usbhost to look for a script with that +name, adding a .tcl suffix if necessarary, and +run that script. usbhost will look in the +current directory first, then in the install tree for standard test +scripts provided by the USB slave package.

  5. Some test scripts may want their own parameters, for example a +duration in seconds. These can be passed on the command line after +the name of the test, for example +usbhost mytest 60.

Writing a Test

Each test is defined by a Tcl script, running inside an interpreter +provided by usbhost. In addition to the +normal Tcl functionality this interpreter provides a number of +variables and functions related to USB testing. For example there is a +variable bulk_in_endpoints that lists all the +endpoints on the target that can perform bulk IN operations, and a +related array bulk_in which contains information +such as the minimum and maximum packets sizes. There is a function +bulktest which can be used to perform bulk tests +on a particular endpoint. A simple test script aimed at specific +hardware could ignore the information variables since it would know +exactly what USB hardware is available on the target, whereas a +general-purpose script would use the information to adapt to the +hardware capabilities.

To avoid namespace pollution all USB-related Tcl variables and +functions live in the usbtest:: namespace. +Therefore accessing requires either explicitly including the +namespace any references, for example +$usbtest::bulk_in_endpoints, or by using Tcl's +namespace import facility.

A very simple test script might look like this:

usbtest::bulktest 1 out 4000
+usbtest::bulktest 2 in  4000
+if { [usbtest::start 60] } {
+    puts "Test successful"
+} else
+    puts "Test failed"
+    foreach result $usbtest::results {
+        puts $result
+    }
+}

This would perform a test run involving 4000 bulk transfers from the +host to the target's endpoint 1, and concurrently 4000 bulk transfers +from endpoint 2. Default settings for packet sizes, contents, and +delays would be used. The actual test would not start running until +usbtest is invoked, and it is expected that the +test would complete within 60 seconds. If any failures occur then they +are reported.

Available Hardware

Each target-side USB device driver provides information about the +actual capabilities of the hardware, for example which endpoints are +available. Strictly speaking it provides information about what is +actually supported by the device driver, which may be a subset of what +the hardware is capable of. For example, the hardware may support +isochronous transfers on a particular endpoint but if there is no +software support for this in the driver then this endpoint will not be +listed. When usbhost first contacts the +usbtarget program running on the target +platform, it obtains this information and makes it available to test +scripts via Tcl variables:

bulk_in_endpoints

This is a simple list of the endpoints which can support bulk IN + transfers. For example if the target-side hardware supports + these transfers on endpoints 3 and 5 then the value would be + "3 5" Typical test scripts would + iterate over the list using something like: +

  if { 0 != [llength $usbtest::bulk_in_endpoints] } {
+      puts"Bulk IN endpoints: $usbtest::bulk_in_endpoints"
+      foreach endpoint $usbtest:bulk_in_endpoints {
+          …
+      }
+  }
+  
bulk_in()

This array holds additional information about each bulk IN endpoint. + The array is indexed by two fields, the endpoint number and one of + min_size, max_size, + max_in_padding and devtab: +

min_size

This field specifies a lower bound on the size of bulk transfers, + and will typically will have a value of 1. +

Note: The typical minimum transfer size of a single byte is not strictly + speaking correct, since under some circumstances it can make sense + to have a transfer size of zero bytes. However current target-side + device drivers interpret a request to transfer zero bytes as a way + for higher-level code to determine whether or not an endpoint is + stalled, so it is not actually possible to perform zero-byte + transfers. This issue will be addressed at some future point. +

max_size

This field specifies an upper bound on the size of bulk transfers. + Some target-side drivers may be limited to transfers of say + 0x0FFFF bytes because of hardware limitations. In practice the + transfer size is likely to be limited primarily to limit memory + consumption of the test code on the target hardware, and to ensure + that tests complete reasonably quickly. At the time of writing + transfers are limited to 4K. +

max_in_padding

On some hardware it may be necessary for the target-side device + driver to send more data than is actually intended. For example + the SA11x0 USB hardware cannot perform bulk transfers that are + an exact multiple of 64 bytes, instead it must pad such + transfers with an extra byte and the host must be ready to + accept and discard this byte. The + max_in_padding field indicates the amount of + padding that is required. The low-level code inside + usbhost will use this field + automatically, and there is no need for test scripts to adjust + packet sizes for padding. The field is provided for + informational purposes only. +

devtab

This is a string indicating whether or not the + target-side USB device driver supports access to this endpoint + via entries in the device table, in other words through + conventional calls like open and + write. Some device drivers may only + support low-level USB access because typically that is what gets + used by USB class-specific packages such as USB-ethernet. + An empty string indicates that no devtab entry is available, + otherwise it will be something like + "/dev/usbs2w". +

Typical test scripts would access this data using something like: +

  foreach endpoint $usbtest:bulk_in_endpoints {
+      puts "Endpoint $endpoint: "
+      puts "    minimum transfer size $usbtest::bulk_in($endpoint,min_size)"
+      puts "    maximum transfer size $usbtest::bulk_in($endpoint,max_size)"
+      if { 0 == $usbtest::bulk_in($endpoint,max_in_padding) } {
+          puts "    no IN padding required"
+      } else {
+          puts "    $usbtest::bulk_in($endpoint,max_in_padding) bytes of IN padding required"
+      }
+      if { "" == $usbtest::bulk_in($endpoint,devtab) } {
+          puts "    no devtab entry provided"
+      } else {
+          puts "    corresponding devtab entry is $usbtest::bulk_in($endpoint,devtab)"
+      }
+  }
+  
bulk_out_endpoint

This is a simple list of the endpoints which can support bulk OUT + transfers. It is analogous to + bulk_in_endpoints. +

bulk_out()

This array holds additional information about each bulk OUT + endpoint. It can be accessed in the same way as + bulk_in(), except that there is no + max_in_padding field because that field only + makes sense for IN transfers. +

control()

This array holds information about the control endpoint. It contains + two fields, min_size and + max_size. Note that there is no variable + control_endpoints because a USB target always + supports a single control endpoint 0. Similarly + the control array does not use an endpoint number + as the first index because that would be redundant. +

isochronous_in_endpoints and + isochronous_in()

These variables provide the same information as + bulk_in_endpoints and bulk_in, + but for endpoints that support isochronous IN transfers. +

isochronous_out_endpoints and + isochronous_out()

These variables provide the same information as + bulk_out_endpoints and bulk_out, + but for endpoints that support isochronous OUT transfers. +

interrupt_in_endpoints and + interrupt_in()

These variables provide the same information as + bulk_in_endpoints and bulk_in, + but for endpoints that support interrupt IN transfers. +

interrupt_out_endpoints and + interrupt_out()

These variables provide the same information as + bulk_out_endpoints and bulk_out, + but for endpoints that support interrupt OUT transfers. +

Testing Bulk Transfers

The main function for initiating a bulk test is +usbtest::bulktest. This takes three compulsory +arguments, and can be given a number of additional arguments to +control the exact behaviour. The compulsory arguments are:

endpoint

This specifies the endpoint to use. It should correspond to + one of the entries in + usbtest::bulk_in_endpoints or + usbtest::bulk_out_endpoints, depending on the + transfer direction. +

direction

This should be either in or out. +

number of transfers

This specifies the number of transfers that should take place. The + testing software does not currently support the concept of performing + transfers for a given period of time because synchronising this on + both the host and a wide range of targets is difficult. However it + is relatively easy to work out the approximate time a number of bulk + transfers should take place, based on a typical bandwidth of + 1MB/second and assuming say a 1ms overhead per transfer. + Alternatively a test script could perform a small initial run to + determine what performance can actually be expected from a given + target, and then use this information to run a much longer test. +

Additional arguments can be used to control the exact transfer. For +example a txdelay+ argument can be used to +slowly increase the delay between transfers. All such arguments involve +a value which can be passed either as part of the argument itself, +for example txdelay+=5, or as a subsequent +argument, txdelay+ 5. The possible arguments fall +into a number of categories: data, I/O mechanism, transmit size, +receive size, transmit delay, and receive delay.

Data

An obvious parameter to control is the actual data that gets sent. +This can be controlled by the argument data +which can take one of five values: none, +bytefill, intfill, +byteseq and wordseq. The default +value is none.

none

The transmit code will not attempt to fill the buffer in any way, + and the receive code will not check it. The actual data that gets + transferred will be whatever happened to be in the buffer before + the transfer started. +

bytefill

The entire buffer will be filled with a single byte, as per + memset. +

intfill

The buffer will be treated as an array of 32-bit integers, and will + be filled with the same integer repeated the appropriate number of + times. If the buffer size is not a multiple of four bytes then + the last few bytes will be set to 0. +

byteseq

The buffer will be filled with a sequence of bytes, generated by + a linear congruential generator. If the first byte in the buffer is + filled with the value x, the next byte will be + (m*x)+i. For example a sequence of slowly + incrementing bytes can be achieved by setting both the multiplier + and the increment to 1. Alternatively a pseudo-random number + sequence can be achieved using values 1103515245 and 12345, as + per the standard C library rand function. + For convenience these two constants are available as Tcl + variables usbtest::MULTIPLIER and + usbtest::INCREMENT. +

wordseq

This acts like byteseq, except that the buffer is + treated as an array of 32-bit integers rather than as an array of + bytes. If the buffer is not a multiple of four bytes then the last + few bytes will be filled with zeroes. +

The above requires three additional parameters +data1, data* and +data+. data1 specifies +the value to be used for byte or word fills, or the first number when +calculating a sequence. The default value is 0. +data* and data+ specify +the multiplier and increment for a sequence, and have default values +of 1 and 0 respectively. For +example, to perform a bulk transfer of a pseudo-random sequence of +integers starting with 42 the following code could be used:

bulktest 2 IN 1000 data=wordseq data1=42 \
+    data* $usbtest::MULTIPLIER data+ $usbtest::INCREMENT

The above parameters define what data gets transferred for the first +transfer, but a test can involve multiple transfers. The data format +will be the same for all transfers, but it is possible to adjust the +current value, the multiplier, and the increment between each +transfer. This is achieved with parameters data1*, +data1+, data**, +data*+, data+*, and +data++, with default values of 1 for each +multiplier and 0 for each increment. For example, if the multiplier +for the first transfer is set to 2 using +data*, and arguments +data** 2 and data*+ -1 are also +supplied, then the multiplier for subsequent transfers will be +3, 5, 9, +….

Note: Currently it is not possible for a test script to send specific data, +for example a specific sequence of bytes captured by a protocol analyser +that caused a problem. If the transfer was from host to target then +the target would have to know the exact sequence of bytes to expect, +which means transferring data over the USB bus when that data is known +to have caused problems in the past. Similarly for target to host +transfers the target would have to know what bytes to send. A possible +future extension of the USB testing support would allow for bounce +operations, where a given message is first sent to the target and then +sent back to the host, with only the host checking that the data was +returned correctly.

I/O Mechanism

On the target side USB transfers can happen using either low-level +USB calls such as usbs_start_rx_buffer, or by +higher-level calls which go through the device table. By default the +target-side code will use the low-level calls. If it is desired to +test the higher-level calls instead, for example because those are +what the application uses, then that can be achieved with an +argument mechanism=devtab.

Transmit Size

The next set of arguments can be used to control the size of the +transmitted buffer: txsize1, +txsize>=, txsize<= +txsize*, txsize/, +and txsize+.

txsize1 determines the size of the first +transfer, and has a default value of 32 bytes. The size of the next +transfer is calculated by first multiplying by the +txsize* value, then dividing by the +txsize/ value, and finally adding the +txsize+ value. The defaults for these are +1, 1, and 0 +respectively, which means that the transfer size will remain +unchanged. If for example the transfer size should increase by +approximately 50 per cent each time then suitable values might be +txsize* 3, txsize/ 2, +and txsize+ 1.

The txsize>= and +txsize<= arguments can be used to impose +lower and upper bounds on the transfer. By default the +min_size and max_size values +appropriate for the endpoint will be used. If at any time the +current size falls outside the bounds then it will be normalized.

Receive Size

The receive size, in other words the number of bytes that either host +or target will expect to receive as opposed to the number of bytes +that actually get sent, can be adjusted using a similar set of +arguments: rxsize1, +rxsize>=, +rxsize<=, +rxsize*, rxsize/ and +rxsize+. The current receive size will be +adjusted between transfers just like the transmit size. However when +communicating over USB it is not a good idea to attempt to receive +less data than will actually be sent: typically neither the hardware +nor the software will be able to do anything useful with the excess, +so there will be problems. Therefore if at any time the calculated +receive size is less than the transmit size, the actual receive will +be for the exact number of bytes that will get transmitted. However +this will not affect the calculations for the next receive size.

The default values for rxsize1, +rxsize*, rxsize/ and +rxsize+ are 0, +1, 1 and 0 +respectively. This means that the calculated receive size will always +be less than the transmit size, so the receive operation will be for +the exact number of bytes transmitted. For some USB protocols this +would not accurately reflect the traffic that will happen. For example +with USB-ethernet transfer sizes will vary between 16 and 1516 bytes, +so the receiver will always expect up to 1516 bytes. This can be +achieved using rxsize1 1516, leaving the +other parameters at their default values.

For target hardware which involves non-zero +max_in_padding, on the host side the padding will +be added automatically to the receive size if necessary.

Transmit and Receive Delays

Typically during the testing there will be some minor delays between +transfers on both host and target. Some of these delays will be caused +by timeslicing, for example another process running on the host, or a +concurrent test thread running inside the target. Other delays will be +caused by the USB bus itself, for example activity from another device +on the bus. However it is desirable that test cases be allowed to +inject additional and somewhat more controlled delays into the system, +for example to make sure that the target behaves correctly even if the +target is not yet ready to receive data from the host.

The transmit delay is controlled by six parameters: +txdelay1, txdelay*, +txdelay/, txdelay+, +txdelay>= and +txdelay<=. The default values for these are +0, 1, 1, +0, 0 and +1000000000 respectively, so that by default +transmits will happen as quickly as possible. Delays are measured in +nanoseconds, so a value of 1000000 would correspond +to a delay of 0.001 seconds or one millisecond. By default delays have +an upper bound of one second. Between transfers the transmit delay is +updated in much the same was as the transfer sizes.

The receive delay is controlled by a similar set of six parameters: +rxdelay1, rxdelay*, +rxdelay/, rxdelay+, +rxdelay>= and +rxdelay<=. The default values for these are +the same as for transmit delays.

The transmit delay is used on the side which sends data over the USB +bus, so for a bulk IN transfer it is the target that sends data and +hence sleeps for the specified transmit delay, while the host receives +data sleeps for the receive delay. For an OUT transfer the positions +are reversed.

It should be noted that although the delays are measured in +nanoseconds, the actual delays will be much less precise and are +likely to be of the order of milliseconds. The exact details will +depend on the kernel clock speed.

Other Types of Transfer

Support for testing other types of USB traffic such as isochronous +transfers is not yet implemented.

Starting a Test and Collecting Results

A USB test script should prepare one or more transfers using +appropriate functions such as usbtest::bulktest. +Once all the individual tests have been prepared they can be started +by a call to usbtest::start. This takes a single +argument, a maximum duration measured in seconds. If all transfers +have not been completed in the specified time then any remaining +transfers will be aborted.

usbtest::start will return 1 +if all the tests have succeeded, or 0 if any of +them have failed. More detailed reports will be stored in the +Tcl variable usbtests::results, which will be a +list of string messages.

Existing Test Scripts

A number of test scripts are provided as standard. These are located +in the host subdirectory of the +common USB slave package, and will be installed as part of the process +of building the host-side software. When a script is specified on the +command line usbhost will first search for +it in the current directory, then in the install tree. Standard +test scripts include the following:

list.tcl

This script simply displays information about the capabilities + of the target platform, as provided by the target-side USB + device driver. It can help with tracking down problems, but its + primary purpose is to let users check that everything is working + correctly: if running usbhost list.tcl + outputs sensible information then the user knows that the + target side is running correctly and that communication between + host and target is possible. +

verbose.tcl

The target-side code can provide information about what + is happening while tests are prepared and run. This facility + should not normally be used since the extra I/O involved will + significantly affect the behaviour of the system, but in some + circumstances it may prove useful. Since an eCos application + cannot easily be given command-line arguments the target-side + verbosity level cannot be controlled using + -V or --verbose + options. Instead it can be controlled from inside + gdb by changing the integer + variable verbose. Alternatively it can + be manipulated by running the test script + verbose.tcl. This script takes a single + argument, the desired verbosity level, which should be a small + integer. For example, to disable target-side run-time logging + the command usbhost verbose 0 can + be used. +

Possible Problems

If all transfers succeed within the specified time then both host and +target remain in synch and further tests can be run without problem. +However, if at any time a failure occurs then things get more +complicated. For example, if the current test involves a series of +bulk OUT transfers and the target detects that for one of these +transfers it received less data than was expected then the test has +failed, and the target will stop accepting data on this endpoint. +However the host-side software may not have detected anything wrong +and is now blocked trying to send the next lot of data.

The test code goes to considerable effort to recover from problems +such as these. On the host-side separate threads are used for +concurrent transfers, and on the target-side appropriate asynchronous +I/O mechanisms are used. In addition there is a control thread on the +host that checks the state of all the main host-side threads, and the +state of the target using private control messages. If it discovers +that one side has stopped sending or receiving data because of an +error and the other side is blocked as a result, it will set certain +flags and then cause one additional transfer to take place. That +additional transfer will have the effect of unblocking the other side, +which then discovers that an error has occurred by checking the +appropriate flags. In this way both host and target should end up back +in synch, and it is possible to move on to the next set of tests.

However, the above assumes that the testing has not triggered any +serious hardware conditions. If instead the target-side hardware has +been left in some strange state so that, for example, it will no +longer raise an interrupt for traffic on a particular endpoint then +recovery is not currently possible, and the testing software will just +hang.

A possible future enhancement to the testing software would allow the +host-side to raise a USB reset signal whenever a failure occurs, in +the hope that this would clear any remaining problems within the +target-side USB hardware.


PrevHome 
Writing a USB Device Driver  
\ No newline at end of file diff --git a/packages/io/usb/slave/current/doc/usbs-writing.html b/packages/io/usb/slave/current/doc/usbs-writing.html --- a/packages/io/usb/slave/current/doc/usbs-writing.html +++ b/packages/io/usb/slave/current/doc/usbs-writing.html @@ -1,4 +1,4 @@ - + @@ -23,7 +23,10 @@ TITLE="eCos USB Slave Support" HREF="io-usb-slave.html"> Next
functions involve calling the device driver's data transfer function with a buffer size of 0 bytes.

Note: Giving a buffer size of 0 bytes a special meaning is problematical +because it prevents transfers of that size. Such transfers are allowed +by the USB protocol, consisting of just headers and acknowledgements +and an empty data phase, although rarely useful. A future modification +of the device driver specification will address this issue, although +care has to be taken that the functionality remains accessible through +devtab entries as well as via low-level accesses.

Devtab Entries

Interrupt Handling

Support for USB Testing

Optionally a USB device driver can provide support for the +USB test software. This requires +defining a number of additional data structures, allowing the +generic test code to work out just what the hardware is capable of and +hence what testing can be performed.

The key data structure is +usbs_testing_endpoint, defined in cyg/io/usb/usbs.h. In addition some +commonly required constants are provided by the common USB package in +cyg/io/usb/usb.h. One +usbs_testing_endpoint structure should be +defined for each supported endpoint. The following fields need to be +filled in:

endpoint_type

This specifies the type of endpoint and should be one of + USB_ENDPOINT_DESCRIPTOR_ATTR_CONTROL, + BULK, ISOCHRONOUS or + INTERRUPT. +

endpoint_number

This identifies the number that should be used by the host + to address this endpoint. For a control endpoint it should + be 0. For other types of endpoints it should be between + 1 and 15. +

endpoint_direction

For control endpoints this field is irrelevant. For other + types of endpoint it should be either + USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN or + USB_ENDPOINT_DESCRIPTOR_ENDPOINT_OUT. If a given + endpoint number can be used for traffic in both directions then + there should be two entries in the array, one for each direction. +

endpoint

This should be a pointer to the appropriate + usbs_control_endpoint, + usbs_rx_endpoint or + usbs_tx_endpoint structure, allowing the + generic testing code to perform low-level I/O. +

devtab_entry

If the endpoint also has an entry in the system's device table then + this field should give the corresponding string, for example + "/dev/usbs1r". This allows the + generic testing code to access the device via higher-level + calls like open and read. +

min_size

This indicates the smallest transfer size that the hardware can + support on this endpoint. Typically this will be one. +

Note: Strictly speaking a minimum size of one is not quite right since it + is valid for a USB transfer to involve zero bytes, in other words a + transfer that involves just headers and acknowledgements and an + empty data phase, and that should be tested as well. However current + device drivers interpret a transfer size of 0 as special, so that + would have to be resolved first. +

max_size

Similarly, this specifies the largest transfer size. For control + endpoints the USB protocol uses only two bytes to hold the transfer + length, so there is an upper bound of 65535 bytes. In practice + it is very unlikely that any control transfers would ever need to + be this large, and in fact such transfers would take a long time + and probably violate timing constraints. For other types of endpoint + any of the protocol, the hardware, or the device driver may impose + size limits. For example a given device driver might be unable to + cope with transfers larger than 65535 bytes. If it should be + possible to transfer arbitrary amounts of data then a value of + -1 indicates no upper limit, and transfer + sizes will be limited by available memory and by the capabilities + of the host machine. +

max_in_padding

This field is needed on some hardware where it is impossible to + send packets of a certain size. For example the hardware may be + incapable of sending an empty bulk packet to terminate a transfer + that is an exact multiple of the 64-byte bulk packet size. + Instead the driver has to do some padding and send an extra byte, + and the host has to be prepared to receive this extra byte. Such a + driver should specify a value of 1 for the + padding field. For most drivers this field should be set to + 0. +

A better solution would be for the device driver to supply a + fragment of Tcl code that would adjust the receive buffer size + only when necessary, rather than for every transfer. Forcing + receive padding on all transfers when only certain transfers + will actually be padded reduces the accuracy of certain tests. +

alignment

On some hardware data transfers may need to be aligned to certain + boundaries, for example a word boundary or a cacheline boundary. + Although in theory device drivers could hide such alignment + restrictions from higher-level code by having their own buffers and + performing appropriate copying, that would be expensive in terms of + both memory and cpu cycles. Instead the generic testing code will + align any buffers passed to the device driver to the specified + boundary. For example, if the driver requires that buffers be + aligned to a word boundary then it should specify an alignment + value of 4. +

The device driver should provide an array of these structures +usbs_testing_endpoints[]. The USB testing code +examines this array and uses the information to perform appropriate +tests. Because different USB devices support different numbers of +endpoints the number of entries in the array is not known in advance, +so instead the testing code looks for a special terminator +USBS_TESTING_ENDPOINTS_TERMINATOR. An example +array, showing just the control endpoint and the terminator, might +look like this:

usbs_testing_endpoint usbs_testing_endpoints[] = {
+    {
+        endpoint_type       : USB_ENDPOINT_DESCRIPTOR_ATTR_CONTROL, 
+        endpoint_number     : 0,
+        endpoint_direction  : USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN,
+        endpoint            : (void*) &ep0.common,
+        devtab_entry        : (const char*) 0,
+        min_size            : 1,
+        max_size            : 0x0FFFF,
+        max_in_padding      : 0,
+        alignment           : 0
+    },
+    …,
+    USBS_TESTING_ENDPOINTS_TERMINATOR
+};

Note: The use of a single array usbs_testing_endpoints +limits USB testing to platforms with a single USB device: if there +were multiple devices, each defining their own instance of this array, +then there would a collision at link time. In practice this should not +be a major problem since typical USB peripherals only interact with a +single host machine via a single slave port. In addition, even if a +peripheral did have multiple slave ports the current USB testing code +would not support this since it would not know which port to use.

- - - - - - - - - - - - - - - - - +####ECOSGPLCOPYRIGHTBEGIN#### + ------------------------------------------- + This file is part of eCos, the Embedded Configurable Operating System. + Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + + eCos is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 or (at your option) any later version. + + eCos is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with eCos; if not, write to the Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + + As a special exception, if other files instantiate templates or use macros + or inline functions from this file, or you compile this file and link it + with other works to produce a work based on this file, this file does not + by itself cause the resulting work to be covered by the GNU General Public + License. However the source code for this file must still be made available + in accordance with section (3) of the GNU General Public License. + + This exception does not invalidate any other reasons why a work based on + this file might be covered by the GNU General Public License. + + Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. + at http://sources.redhat.com/ecos/ecos-license + ------------------------------------------- +####ECOSGPLCOPYRIGHTEND#### @@ -2265,6 +2280,15 @@ the <usbs_start_rx_endpoint_wa calling the device driver's data transfer function with a buffer size of 0 bytes. + +Giving a buffer size of 0 bytes a special meaning is problematical +because it prevents transfers of that size. Such transfers are allowed +by the USB protocol, consisting of just headers and acknowledgements +and an empty data phase, although rarely useful. A future modification +of the device driver specification will address this issue, although +care has to be taken that the functionality remains accessible through +devtab entries as well as via low-level accesses. + Devtab Entries @@ -2349,10 +2373,1184 @@ function sensibly at DSR level. Much the completion functions associated with data transfers. These should also be invoked at DSR or thread level. + + +Support for USB Testing + +Optionally a USB device driver can provide support for the +USB test software. This requires +defining a number of additional data structures, allowing the +generic test code to work out just what the hardware is capable of and +hence what testing can be performed. + + +The key data structure is +usbs_testing_endpoint, defined in cyg/io/usb/usbs.h. In addition some +commonly required constants are provided by the common USB package in +cyg/io/usb/usb.h. One +usbs_testing_endpoint structure should be +defined for each supported endpoint. The following fields need to be +filled in: + + + + endpoint_type + + This specifies the type of endpoint and should be one of + USB_ENDPOINT_DESCRIPTOR_ATTR_CONTROL, + BULK, ISOCHRONOUS or + INTERRUPT. + + + + endpoint_number + + This identifies the number that should be used by the host + to address this endpoint. For a control endpoint it should + be 0. For other types of endpoints it should be between + 1 and 15. + + + + endpoint_direction + + For control endpoints this field is irrelevant. For other + types of endpoint it should be either + USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN or + USB_ENDPOINT_DESCRIPTOR_ENDPOINT_OUT. If a given + endpoint number can be used for traffic in both directions then + there should be two entries in the array, one for each direction. + + + + endpoint + + This should be a pointer to the appropriate + usbs_control_endpoint, + usbs_rx_endpoint or + usbs_tx_endpoint structure, allowing the + generic testing code to perform low-level I/O. + + + + devtab_entry + + If the endpoint also has an entry in the system's device table then + this field should give the corresponding string, for example + "/dev/usbs1r". This allows the + generic testing code to access the device via higher-level + calls like open and read. + + + + min_size + + This indicates the smallest transfer size that the hardware can + support on this endpoint. Typically this will be one. + + + Strictly speaking a minimum size of one is not quite right since it + is valid for a USB transfer to involve zero bytes, in other words a + transfer that involves just headers and acknowledgements and an + empty data phase, and that should be tested as well. However current + device drivers interpret a transfer size of 0 as special, so that + would have to be resolved first. + + + + + max_size + + Similarly, this specifies the largest transfer size. For control + endpoints the USB protocol uses only two bytes to hold the transfer + length, so there is an upper bound of 65535 bytes. In practice + it is very unlikely that any control transfers would ever need to + be this large, and in fact such transfers would take a long time + and probably violate timing constraints. For other types of endpoint + any of the protocol, the hardware, or the device driver may impose + size limits. For example a given device driver might be unable to + cope with transfers larger than 65535 bytes. If it should be + possible to transfer arbitrary amounts of data then a value of + -1 indicates no upper limit, and transfer + sizes will be limited by available memory and by the capabilities + of the host machine. + + + + max_in_padding + + This field is needed on some hardware where it is impossible to + send packets of a certain size. For example the hardware may be + incapable of sending an empty bulk packet to terminate a transfer + that is an exact multiple of the 64-byte bulk packet size. + Instead the driver has to do some padding and send an extra byte, + and the host has to be prepared to receive this extra byte. Such a + driver should specify a value of 1 for the + padding field. For most drivers this field should be set to + 0. + + + A better solution would be for the device driver to supply a + fragment of Tcl code that would adjust the receive buffer size + only when necessary, rather than for every transfer. Forcing + receive padding on all transfers when only certain transfers + will actually be padded reduces the accuracy of certain tests. + + + + alignment + + On some hardware data transfers may need to be aligned to certain + boundaries, for example a word boundary or a cacheline boundary. + Although in theory device drivers could hide such alignment + restrictions from higher-level code by having their own buffers and + performing appropriate copying, that would be expensive in terms of + both memory and cpu cycles. Instead the generic testing code will + align any buffers passed to the device driver to the specified + boundary. For example, if the driver requires that buffers be + aligned to a word boundary then it should specify an alignment + value of 4. + + + + + +The device driver should provide an array of these structures +usbs_testing_endpoints[]. The USB testing code +examines this array and uses the information to perform appropriate +tests. Because different USB devices support different numbers of +endpoints the number of entries in the array is not known in advance, +so instead the testing code looks for a special terminator +USBS_TESTING_ENDPOINTS_TERMINATOR. An example +array, showing just the control endpoint and the terminator, might +look like this: + + +usbs_testing_endpoint usbs_testing_endpoints[] = { + { + endpoint_type : USB_ENDPOINT_DESCRIPTOR_ATTR_CONTROL, + endpoint_number : 0, + endpoint_direction : USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN, + endpoint : (void*) &ep0.common, + devtab_entry : (const char*) 0, + min_size : 1, + max_size : 0x0FFFF, + max_in_padding : 0, + alignment : 0 + }, + …, + USBS_TESTING_ENDPOINTS_TERMINATOR +}; + + + + +The use of a single array usbs_testing_endpoints +limits USB testing to platforms with a single USB device: if there +were multiple devices, each defining their own instance of this array, +then there would a collision at link time. In practice this should not +be a major problem since typical USB peripherals only interact with a +single host machine via a single slave port. In addition, even if a +peripheral did have multiple slave ports the current USB testing code +would not support this since it would not know which port to use. + + + + + + + + + + + + +Testing + + +Testing +Testing of USB Device Drivers + + +Introduction + +The support for USB testing provided by the eCos USB common slave +package is somewhat different in nature from the kind of testing used +in many other packages. One obvious problem is that USB tests cannot +be run on just a bare target platform: instead the target platform +must be connected to a suitable USB host machine, and that host +machine must be running appropriate software for the test code to +interact with. This is very different from say a kernel test which +typically will have no external dependencies. Another important +difference between USB testing and say a C library +strcmp test is sensitivity to timing and to +hardware boundary conditions: although a simple test case that just +performs a small number of USB transfers is better than no testing at +all, it should also be possible to run tests for hours or days on end, +under a variety of loads. In order to provide the required +functionality the basic architecture of the USB testing support is as +follows: + + + + There is a single target-side program + usbtarget. By default when this is run + on a target platform it will appear to do nothing. In fact it is + waiting to be contacted by another program + usbhost which will tell it what test or + tests to run. usbtarget provides + mechanisms for running a wide range of tests. + + + usbtarget is a generic program, but USB + testing depends to some extent on the functionality provided by the + hardware. For example there is no point in testing bulk transmits + to endpoint 12 if the target hardware does not support an endpoint + 12. Therefore each USB device driver should supply information about + what the hardware is actually capable of, in the form of an array of + usbs_testing_endpoint data structures. + + + There is a single host-side program + usbhost, which acts as a counterpart to + usbtarget. Again + usbhost has no built-in knowledge of + the test or tests that are supposed to run, it only provides + mechanisms for running a wide range of tests. On start-up + usbhost will search the USB bus for + hardware running the target-side program, specifically a USB device + that identifies itself as the product "Red Hat eCos + USB test". + + + usbhost contains a Tcl interpreter, and + will execute any Tcl scripts specified on the command line + together with appropriate arguments. The Tcl interpreter has been + extended with various commands such as + usbtest::bulktest, so the script can perform + the desired test or tests. + + + Adding a new test simply involves writing a short Tcl script that + invokes the appropriate USB-specific commands. Running multiple + tests involves passing appropriate arguments to + usbhost, or alternatively writing a + single script that just invokes other scripts. + + + +The current implementation of usbhost +depends heavily on functionality provided by the Linux kernel and in +particular the usbdevfs support. It uses +/proc/bus/usb/devices to find out what devices +are attached to the bus, and will then access the device by opening +/proc/bus/usb/xxx/yyy and performing +ioctl operations. This allows USB testing to take +place without having to write a new host-side device driver, but +getting the code working on host machines not running Linux would +obviously be problematical. + + + +Building and Running the Target-side Code + +The target-side component of the USB testing software consists of a +single program usbtarget which contains +support for a range of different tests, under the control of host-side +software. This program is not built by default alongside other eCos +test cases since it will only operate in certain environments, +specifically when the target board's connector is plugged into a Linux +host, and when the appropriate host-side software has been installed +on that host. Instead the user must enable a configuration option +CYGBLD_IO_USB_SLAVE_USBTEST to add the program to +the list of tests for the current configuration. + + +Starting the usbtarget program does not +require anything unusual, so it can be run in a normal +gdb session just like any eCos application. +After initialization the program will wait for activity from the host. +Depending on the hardware, the Linux host will detect that a new USB +peripheral is present on the bus either when the +usbtarget initialization is complete or +when the cable between target and host is connected. The host will +perform the normal USB enumeration sequence and discover that the +peripheral does not match any known vendor or product id and that +there is no device driver for "Red Hat eCos USB +test", so it will ignore the peripheral. When the +usbhost program is run on the host it will +connect to the target-side software, and testing can now commence. + + + +Building and Running the Host-side Code + +In theory the host-side software should be built when the package is +installed in the component repository, and removed when a package +is uninstalled. The current eCos administration tool does not provide +this functionality. + + +The host-side software should be built via the usual sequence of +"configure/make/make install". It can only be built on a +Linux host and the configure script contains an +explicit test for this. Because the eCos component repository should +generally be treated as a read-only resource the configure script will +also prevent you from trying to build inside the source tree. Instead +a separate build tree is required. Hence a typical sequence for +building the host-side software would be as follows: + + +$ mkdir usbhost_build +$ cd usbhost_build +$ <repo>packages/io/usb/slave/current/host/configure <args> +$ make +<output from make> +$ su +$ make install +<output from make install> +$ + + + + +The location of the eCos component repository should be substituted +for <repo>. + + + + +If the package has been obtained via CVS or anonymous CVS then the +package version will be current, as per the +example. If instead the package has been obtained as part of a full +eCos release or as a separate .epk file then the +appropriate package version should be used instead of +current. + + + + +The configure script takes the usual arguments such +as --prefix= to specify where the executables +and support files should be installed. The only other parameter that +some users may wish to specify is the location of a suitable Tcl +installation. By default usbhost will use +the existing Tcl installation in /usr, +as provided by your Linux distribution. An alternative Tcl +installation can be specified using the parameter +--with-tcl=, or alternatively using some +combination of --with-tcl-include, +--with-tcl-lib and +--with-tcl-version. + + + + +One of the host-side executables that gets built, +usbchmod, needs to be installed with suid +root privileges. Although the Linux kernel makes it possible for +applications to perform low-level USB operations such as transmitting +bulk packets, by default access to this functionality is restricted to +programs with superuser privileges. It is undesirable to run a complex +program such as usbhost with such +privileges, especially since the program contains a general-purpose +Tcl interpreter. Therefore when usbhost +starts up and discovers that it does not have sufficient access to the +appropriate entries in /proc/bus/usb, +it spawns an instance of usbchmod to modify +the permissions on these entries. usbchmod +will only do this for a USB device "Red Hat eCos USB +test", so installing this program suid root should not +introduce any security problems. + + + + + +During make install the following actions will take +place: + + + + +usbhost will be installed in /usr/local/bin, +or some other bin directory if +the default location is changed at configure-time using a +--prefix= or similar option. It will be +installed as the executable +usbhost_<version>, for example +usbhost_current, thus allowing several +releases of the USB slave package to co-exist. For convenience a +symbolic link from usbhost to this executable +will be created, so users can just run usbhost to +access the most recently-installed version. + + + + +usbchmod will be installed in +/usr/local/libexec/ecos/io_usb_slave_<version>. +This program should only be run by usbhost, +not invoked directly, so it is not placed in the bin +directory. Again the presence of the package version in the directory +name allows multiple releases of the package to co-exist. + + + + +A Tcl script usbhost.tcl will get installed in +the same directory as usbchmod. This Tcl +script is loaded automatically by the +usbhost executable. + + + + +A number of additional Tcl scripts, for example +list.tcl will get installed alongside +usbhost.tcl. These correspond to various test +cases provided as standard. If a given test case is specified on the +command line and cannot be found relative to the current directory +then usbhost will search the install +directory for these test cases. + + +Strictly speaking installing the usbhost.tcl and +other Tcl scripts below the libexec +directory deviates from standard practice: they are +architecture-independent data files so should be installed below +the share subdirectory. In +practice the files are sufficiently small that there is no point in +sharing them, and keeping them below libexec +simplifies the host-side software somewhat. + + + + + +The usbhost should be run only when there is a +suitable target attached to the USB bus and running the +usbtarget program. It will search +/proc/bus/usb/devices for an entry corresponding +to this program, invoke usbchmod if +necessary to change the access rights, and then interact with +usbtarget over the USB bus. +usbhost should be invoked as follows: + + +$ usbhost [-v|--version] [-h|--help] [-V|--verbose] <test> [<test parameters>] + + + + +The -v or --version +option will display version information for +usbhost including the version of the USB +slave package that was used to build the executable. + + + + +The -h or --help option +will display usage information. + + + + +The -V or --verbose +option can be used to obtain more information at run-time, for example +some output for every USB transfer. This option can be repeated +multiple times to increase the amount of output. + + + + +The first argument that does not begin with a hyphen specifies a test +that should be run, in the form of a Tcl script. For example an +argument of list.tcl will cause +usbhost to look for a script with that +name, adding a .tcl suffix if necessarary, and +run that script. usbhost will look in the +current directory first, then in the install tree for standard test +scripts provided by the USB slave package. + + + + +Some test scripts may want their own parameters, for example a +duration in seconds. These can be passed on the command line after +the name of the test, for example +usbhost mytest 60. + + + + + +Writing a Test + +Each test is defined by a Tcl script, running inside an interpreter +provided by usbhost. In addition to the +normal Tcl functionality this interpreter provides a number of +variables and functions related to USB testing. For example there is a +variable bulk_in_endpoints that lists all the +endpoints on the target that can perform bulk IN operations, and a +related array bulk_in which contains information +such as the minimum and maximum packets sizes. There is a function +bulktest which can be used to perform bulk tests +on a particular endpoint. A simple test script aimed at specific +hardware could ignore the information variables since it would know +exactly what USB hardware is available on the target, whereas a +general-purpose script would use the information to adapt to the +hardware capabilities. + + +To avoid namespace pollution all USB-related Tcl variables and +functions live in the usbtest:: namespace. +Therefore accessing requires either explicitly including the +namespace any references, for example +$usbtest::bulk_in_endpoints, or by using Tcl's +namespace import facility. + + +A very simple test script might look like this: + + +usbtest::bulktest 1 out 4000 +usbtest::bulktest 2 in 4000 +if { [usbtest::start 60] } { + puts "Test successful" +} else + puts "Test failed" + foreach result $usbtest::results { + puts $result + } +} + + +This would perform a test run involving 4000 bulk transfers from the +host to the target's endpoint 1, and concurrently 4000 bulk transfers +from endpoint 2. Default settings for packet sizes, contents, and +delays would be used. The actual test would not start running until +usbtest is invoked, and it is expected that the +test would complete within 60 seconds. If any failures occur then they +are reported. + + + +Available Hardware + +Each target-side USB device driver provides information about the +actual capabilities of the hardware, for example which endpoints are +available. Strictly speaking it provides information about what is +actually supported by the device driver, which may be a subset of what +the hardware is capable of. For example, the hardware may support +isochronous transfers on a particular endpoint but if there is no +software support for this in the driver then this endpoint will not be +listed. When usbhost first contacts the +usbtarget program running on the target +platform, it obtains this information and makes it available to test +scripts via Tcl variables: + + + + bulk_in_endpoints + + This is a simple list of the endpoints which can support bulk IN + transfers. For example if the target-side hardware supports + these transfers on endpoints 3 and 5 then the value would be + "3 5" Typical test scripts would + iterate over the list using something like: + + + if { 0 != [llength $usbtest::bulk_in_endpoints] } { + puts"Bulk IN endpoints: $usbtest::bulk_in_endpoints" + foreach endpoint $usbtest:bulk_in_endpoints { + … + } + } + + + + + bulk_in() + + This array holds additional information about each bulk IN endpoint. + The array is indexed by two fields, the endpoint number and one of + min_size, max_size, + max_in_padding and devtab: + + + + min_size + + This field specifies a lower bound on the size of bulk transfers, + and will typically will have a value of 1. + + + The typical minimum transfer size of a single byte is not strictly + speaking correct, since under some circumstances it can make sense + to have a transfer size of zero bytes. However current target-side + device drivers interpret a request to transfer zero bytes as a way + for higher-level code to determine whether or not an endpoint is + stalled, so it is not actually possible to perform zero-byte + transfers. This issue will be addressed at some future point. + + + + + max_size + + This field specifies an upper bound on the size of bulk transfers. + Some target-side drivers may be limited to transfers of say + 0x0FFFF bytes because of hardware limitations. In practice the + transfer size is likely to be limited primarily to limit memory + consumption of the test code on the target hardware, and to ensure + that tests complete reasonably quickly. At the time of writing + transfers are limited to 4K. + + + + max_in_padding + + On some hardware it may be necessary for the target-side device + driver to send more data than is actually intended. For example + the SA11x0 USB hardware cannot perform bulk transfers that are + an exact multiple of 64 bytes, instead it must pad such + transfers with an extra byte and the host must be ready to + accept and discard this byte. The + max_in_padding field indicates the amount of + padding that is required. The low-level code inside + usbhost will use this field + automatically, and there is no need for test scripts to adjust + packet sizes for padding. The field is provided for + informational purposes only. + + + + devtab + + This is a string indicating whether or not the + target-side USB device driver supports access to this endpoint + via entries in the device table, in other words through + conventional calls like open and + write. Some device drivers may only + support low-level USB access because typically that is what gets + used by USB class-specific packages such as USB-ethernet. + An empty string indicates that no devtab entry is available, + otherwise it will be something like + "/dev/usbs2w". + + + + + Typical test scripts would access this data using something like: + + + foreach endpoint $usbtest:bulk_in_endpoints { + puts "Endpoint $endpoint: " + puts " minimum transfer size $usbtest::bulk_in($endpoint,min_size)" + puts " maximum transfer size $usbtest::bulk_in($endpoint,max_size)" + if { 0 == $usbtest::bulk_in($endpoint,max_in_padding) } { + puts " no IN padding required" + } else { + puts " $usbtest::bulk_in($endpoint,max_in_padding) bytes of IN padding required" + } + if { "" == $usbtest::bulk_in($endpoint,devtab) } { + puts " no devtab entry provided" + } else { + puts " corresponding devtab entry is $usbtest::bulk_in($endpoint,devtab)" + } + } + + + + + bulk_out_endpoint + + This is a simple list of the endpoints which can support bulk OUT + transfers. It is analogous to + bulk_in_endpoints. + + + + bulk_out() + + This array holds additional information about each bulk OUT + endpoint. It can be accessed in the same way as + bulk_in(), except that there is no + max_in_padding field because that field only + makes sense for IN transfers. + + + + control() + + This array holds information about the control endpoint. It contains + two fields, min_size and + max_size. Note that there is no variable + control_endpoints because a USB target always + supports a single control endpoint 0. Similarly + the control array does not use an endpoint number + as the first index because that would be redundant. + + + + isochronous_in_endpoints and + isochronous_in() + + These variables provide the same information as + bulk_in_endpoints and bulk_in, + but for endpoints that support isochronous IN transfers. + + + + isochronous_out_endpoints and + isochronous_out() + + These variables provide the same information as + bulk_out_endpoints and bulk_out, + but for endpoints that support isochronous OUT transfers. + + + + interrupt_in_endpoints and + interrupt_in() + + These variables provide the same information as + bulk_in_endpoints and bulk_in, + but for endpoints that support interrupt IN transfers. + + + + interrupt_out_endpoints and + interrupt_out() + + These variables provide the same information as + bulk_out_endpoints and bulk_out, + but for endpoints that support interrupt OUT transfers. + + + + + + +Testing Bulk Transfers + +The main function for initiating a bulk test is +usbtest::bulktest. This takes three compulsory +arguments, and can be given a number of additional arguments to +control the exact behaviour. The compulsory arguments are: + + + + endpoint + + This specifies the endpoint to use. It should correspond to + one of the entries in + usbtest::bulk_in_endpoints or + usbtest::bulk_out_endpoints, depending on the + transfer direction. + + + + direction + + This should be either in or out. + + + + number of transfers + + This specifies the number of transfers that should take place. The + testing software does not currently support the concept of performing + transfers for a given period of time because synchronising this on + both the host and a wide range of targets is difficult. However it + is relatively easy to work out the approximate time a number of bulk + transfers should take place, based on a typical bandwidth of + 1MB/second and assuming say a 1ms overhead per transfer. + Alternatively a test script could perform a small initial run to + determine what performance can actually be expected from a given + target, and then use this information to run a much longer test. + + + + +Additional arguments can be used to control the exact transfer. For +example a txdelay+ argument can be used to +slowly increase the delay between transfers. All such arguments involve +a value which can be passed either as part of the argument itself, +for example txdelay+=5, or as a subsequent +argument, txdelay+ 5. The possible arguments fall +into a number of categories: data, I/O mechanism, transmit size, +receive size, transmit delay, and receive delay. + + +Data + +An obvious parameter to control is the actual data that gets sent. +This can be controlled by the argument data +which can take one of five values: none, +bytefill, intfill, +byteseq and wordseq. The default +value is none. + + + + none + + The transmit code will not attempt to fill the buffer in any way, + and the receive code will not check it. The actual data that gets + transferred will be whatever happened to be in the buffer before + the transfer started. + + + + bytefill + + The entire buffer will be filled with a single byte, as per + memset. + + + + intfill + + The buffer will be treated as an array of 32-bit integers, and will + be filled with the same integer repeated the appropriate number of + times. If the buffer size is not a multiple of four bytes then + the last few bytes will be set to 0. + + + + byteseq + + The buffer will be filled with a sequence of bytes, generated by + a linear congruential generator. If the first byte in the buffer is + filled with the value x, the next byte will be + (m*x)+i. For example a sequence of slowly + incrementing bytes can be achieved by setting both the multiplier + and the increment to 1. Alternatively a pseudo-random number + sequence can be achieved using values 1103515245 and 12345, as + per the standard C library rand function. + For convenience these two constants are available as Tcl + variables usbtest::MULTIPLIER and + usbtest::INCREMENT. + + + + wordseq + + This acts like byteseq, except that the buffer is + treated as an array of 32-bit integers rather than as an array of + bytes. If the buffer is not a multiple of four bytes then the last + few bytes will be filled with zeroes. + + + + +The above requires three additional parameters +data1, data* and +data+. data1 specifies +the value to be used for byte or word fills, or the first number when +calculating a sequence. The default value is 0. +data* and data+ specify +the multiplier and increment for a sequence, and have default values +of 1 and 0 respectively. For +example, to perform a bulk transfer of a pseudo-random sequence of +integers starting with 42 the following code could be used: + + +bulktest 2 IN 1000 data=wordseq data1=42 \ + data* $usbtest::MULTIPLIER data+ $usbtest::INCREMENT + + +The above parameters define what data gets transferred for the first +transfer, but a test can involve multiple transfers. The data format +will be the same for all transfers, but it is possible to adjust the +current value, the multiplier, and the increment between each +transfer. This is achieved with parameters data1*, +data1+, data**, +data*+, data+*, and +data++, with default values of 1 for each +multiplier and 0 for each increment. For example, if the multiplier +for the first transfer is set to 2 using +data*, and arguments +data** 2 and data*+ -1 are also +supplied, then the multiplier for subsequent transfers will be +3, 5, 9, +…. + + + +Currently it is not possible for a test script to send specific data, +for example a specific sequence of bytes captured by a protocol analyser +that caused a problem. If the transfer was from host to target then +the target would have to know the exact sequence of bytes to expect, +which means transferring data over the USB bus when that data is known +to have caused problems in the past. Similarly for target to host +transfers the target would have to know what bytes to send. A possible +future extension of the USB testing support would allow for bounce +operations, where a given message is first sent to the target and then +sent back to the host, with only the host checking that the data was +returned correctly. + + + +I/O Mechanism + +On the target side USB transfers can happen using either low-level +USB calls such as usbs_start_rx_buffer, or by +higher-level calls which go through the device table. By default the +target-side code will use the low-level calls. If it is desired to +test the higher-level calls instead, for example because those are +what the application uses, then that can be achieved with an +argument mechanism=devtab. + + + +Transmit Size + +The next set of arguments can be used to control the size of the +transmitted buffer: txsize1, +txsize>=, txsize<= +txsize*, txsize/, +and txsize+. + + +txsize1 determines the size of the first +transfer, and has a default value of 32 bytes. The size of the next +transfer is calculated by first multiplying by the +txsize* value, then dividing by the +txsize/ value, and finally adding the +txsize+ value. The defaults for these are +1, 1, and 0 +respectively, which means that the transfer size will remain +unchanged. If for example the transfer size should increase by +approximately 50 per cent each time then suitable values might be +txsize* 3, txsize/ 2, +and txsize+ 1. + + +The txsize>= and +txsize<= arguments can be used to impose +lower and upper bounds on the transfer. By default the +min_size and max_size values +appropriate for the endpoint will be used. If at any time the +current size falls outside the bounds then it will be normalized. + + + +Receive Size + +The receive size, in other words the number of bytes that either host +or target will expect to receive as opposed to the number of bytes +that actually get sent, can be adjusted using a similar set of +arguments: rxsize1, +rxsize>=, +rxsize<=, +rxsize*, rxsize/ and +rxsize+. The current receive size will be +adjusted between transfers just like the transmit size. However when +communicating over USB it is not a good idea to attempt to receive +less data than will actually be sent: typically neither the hardware +nor the software will be able to do anything useful with the excess, +so there will be problems. Therefore if at any time the calculated +receive size is less than the transmit size, the actual receive will +be for the exact number of bytes that will get transmitted. However +this will not affect the calculations for the next receive size. + + +The default values for rxsize1, +rxsize*, rxsize/ and +rxsize+ are 0, +1, 1 and 0 +respectively. This means that the calculated receive size will always +be less than the transmit size, so the receive operation will be for +the exact number of bytes transmitted. For some USB protocols this +would not accurately reflect the traffic that will happen. For example +with USB-ethernet transfer sizes will vary between 16 and 1516 bytes, +so the receiver will always expect up to 1516 bytes. This can be +achieved using rxsize1 1516, leaving the +other parameters at their default values. + + +For target hardware which involves non-zero +max_in_padding, on the host side the padding will +be added automatically to the receive size if necessary. + + + +Transmit and Receive Delays + +Typically during the testing there will be some minor delays between +transfers on both host and target. Some of these delays will be caused +by timeslicing, for example another process running on the host, or a +concurrent test thread running inside the target. Other delays will be +caused by the USB bus itself, for example activity from another device +on the bus. However it is desirable that test cases be allowed to +inject additional and somewhat more controlled delays into the system, +for example to make sure that the target behaves correctly even if the +target is not yet ready to receive data from the host. + + +The transmit delay is controlled by six parameters: +txdelay1, txdelay*, +txdelay/, txdelay+, +txdelay>= and +txdelay<=. The default values for these are +0, 1, 1, +0, 0 and +1000000000 respectively, so that by default +transmits will happen as quickly as possible. Delays are measured in +nanoseconds, so a value of 1000000 would correspond +to a delay of 0.001 seconds or one millisecond. By default delays have +an upper bound of one second. Between transfers the transmit delay is +updated in much the same was as the transfer sizes. + + +The receive delay is controlled by a similar set of six parameters: +rxdelay1, rxdelay*, +rxdelay/, rxdelay+, +rxdelay>= and +rxdelay<=. The default values for these are +the same as for transmit delays. + + +The transmit delay is used on the side which sends data over the USB +bus, so for a bulk IN transfer it is the target that sends data and +hence sleeps for the specified transmit delay, while the host receives +data sleeps for the receive delay. For an OUT transfer the positions +are reversed. + + +It should be noted that although the delays are measured in +nanoseconds, the actual delays will be much less precise and are +likely to be of the order of milliseconds. The exact details will +depend on the kernel clock speed. + + + + + +Other Types of Transfer + +Support for testing other types of USB traffic such as isochronous +transfers is not yet implemented. + + + +Starting a Test and Collecting Results + +A USB test script should prepare one or more transfers using +appropriate functions such as usbtest::bulktest. +Once all the individual tests have been prepared they can be started +by a call to usbtest::start. This takes a single +argument, a maximum duration measured in seconds. If all transfers +have not been completed in the specified time then any remaining +transfers will be aborted. + + +usbtest::start will return 1 +if all the tests have succeeded, or 0 if any of +them have failed. More detailed reports will be stored in the +Tcl variable usbtests::results, which will be a +list of string messages. + + + +Existing Test Scripts + +A number of test scripts are provided as standard. These are located +in the host subdirectory of the +common USB slave package, and will be installed as part of the process +of building the host-side software. When a script is specified on the +command line usbhost will first search for +it in the current directory, then in the install tree. Standard +test scripts include the following: + + + list.tcl + + This script simply displays information about the capabilities + of the target platform, as provided by the target-side USB + device driver. It can help with tracking down problems, but its + primary purpose is to let users check that everything is working + correctly: if running usbhost list.tcl + outputs sensible information then the user knows that the + target side is running correctly and that communication between + host and target is possible. + + + verbose.tcl + + The target-side code can provide information about what + is happening while tests are prepared and run. This facility + should not normally be used since the extra I/O involved will + significantly affect the behaviour of the system, but in some + circumstances it may prove useful. Since an eCos application + cannot easily be given command-line arguments the target-side + verbosity level cannot be controlled using + -V or --verbose + options. Instead it can be controlled from inside + gdb by changing the integer + variable verbose. Alternatively it can + be manipulated by running the test script + verbose.tcl. This script takes a single + argument, the desired verbosity level, which should be a small + integer. For example, to disable target-side run-time logging + the command usbhost verbose 0 can + be used. + + + + + +Possible Problems + +If all transfers succeed within the specified time then both host and +target remain in synch and further tests can be run without problem. +However, if at any time a failure occurs then things get more +complicated. For example, if the current test involves a series of +bulk OUT transfers and the target detects that for one of these +transfers it received less data than was expected then the test has +failed, and the target will stop accepting data on this endpoint. +However the host-side software may not have detected anything wrong +and is now blocked trying to send the next lot of data. + + +The test code goes to considerable effort to recover from problems +such as these. On the host-side separate threads are used for +concurrent transfers, and on the target-side appropriate asynchronous +I/O mechanisms are used. In addition there is a control thread on the +host that checks the state of all the main host-side threads, and the +state of the target using private control messages. If it discovers +that one side has stopped sending or receiving data because of an +error and the other side is blocked as a result, it will set certain +flags and then cause one additional transfer to take place. That +additional transfer will have the effect of unblocking the other side, +which then discovers that an error has occurred by checking the +appropriate flags. In this way both host and target should end up back +in synch, and it is possible to move on to the next set of tests. + + +However, the above assumes that the testing has not triggered any +serious hardware conditions. If instead the target-side hardware has +been left in some strange state so that, for example, it will no +longer raise an interrupt for traffic on a particular endpoint then +recovery is not currently possible, and the testing software will just +hang. + + +A possible future enhancement to the testing software would allow the +host-side to raise a USB reset signal whenever a failure occurs, in +the hope that this would clear any remaining problems within the +target-side USB hardware. + + - \ No newline at end of file + diff --git a/packages/io/usb/slave/current/include/usbs.h b/packages/io/usb/slave/current/include/usbs.h --- a/packages/io/usb/slave/current/include/usbs.h +++ b/packages/io/usb/slave/current/include/usbs.h @@ -7,29 +7,38 @@ // The generic USB slave-side support // //========================================================================== -//####COPYRIGHTBEGIN#### -// +//####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. // -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. // -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license // ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/usb/slave/current/src/usbs.c b/packages/io/usb/slave/current/src/usbs.c --- a/packages/io/usb/slave/current/src/usbs.c +++ b/packages/io/usb/slave/current/src/usbs.c @@ -5,29 +5,38 @@ // Generic USB slave-side support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/wallclock/current/ChangeLog b/packages/io/wallclock/current/ChangeLog --- a/packages/io/wallclock/current/ChangeLog +++ b/packages/io/wallclock/current/ChangeLog @@ -269,28 +269,37 @@ Wed Jul 22 21:04:15 1998 Jonathan Larmo Remove unnecessary include of and remove an unused variable (result) from get_current_time() -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### diff --git a/packages/io/wallclock/current/cdl/wallclock.cdl b/packages/io/wallclock/current/cdl/wallclock.cdl --- a/packages/io/wallclock/current/cdl/wallclock.cdl +++ b/packages/io/wallclock/current/cdl/wallclock.cdl @@ -5,29 +5,38 @@ # eCos wallclock configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/io/wallclock/current/include/wallclock.hxx b/packages/io/wallclock/current/include/wallclock.hxx --- a/packages/io/wallclock/current/include/wallclock.hxx +++ b/packages/io/wallclock/current/include/wallclock.hxx @@ -8,29 +8,38 @@ // Wallclock interface declaration // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/wallclock/current/include/wallclock/wallclock.inl b/packages/io/wallclock/current/include/wallclock/wallclock.inl --- a/packages/io/wallclock/current/include/wallclock/wallclock.inl +++ b/packages/io/wallclock/current/include/wallclock/wallclock.inl @@ -8,29 +8,38 @@ // Wallclock internal helper functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/wallclock/current/src/emulate.cxx b/packages/io/wallclock/current/src/emulate.cxx --- a/packages/io/wallclock/current/src/emulate.cxx +++ b/packages/io/wallclock/current/src/emulate.cxx @@ -5,29 +5,38 @@ // Wallclock emulation implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/wallclock/current/src/wallclock.cxx b/packages/io/wallclock/current/src/wallclock.cxx --- a/packages/io/wallclock/current/src/wallclock.cxx +++ b/packages/io/wallclock/current/src/wallclock.cxx @@ -5,29 +5,38 @@ // Wallclock base // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/wallclock/current/tests/wallclock.cxx b/packages/io/wallclock/current/tests/wallclock.cxx --- a/packages/io/wallclock/current/tests/wallclock.cxx +++ b/packages/io/wallclock/current/tests/wallclock.cxx @@ -5,29 +5,38 @@ // WallClock test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/wallclock/current/tests/wallclock2.cxx b/packages/io/wallclock/current/tests/wallclock2.cxx --- a/packages/io/wallclock/current/tests/wallclock2.cxx +++ b/packages/io/wallclock/current/tests/wallclock2.cxx @@ -5,29 +5,38 @@ // WallClock battery backed up test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/io/watchdog/current/ChangeLog b/packages/io/watchdog/current/ChangeLog --- a/packages/io/watchdog/current/ChangeLog +++ b/packages/io/watchdog/current/ChangeLog @@ -259,26 +259,35 @@ 1998-07-29 Nick Garnett + + * include/stdlib.h: use NORET attributes from cyg_type.h. + +2002-03-20 Jonathan Larmour + + * include/float.h: Don't have multiple inclusion protection. It is + unnecessary and can confuse things if the headers are subject to two + -I paths. + * include/stdarg.h: Ditto. + * include/float.h: Don't cover include_next with inclusion protection + for a similar reason. + * include/stddef.h: Use C comment. + +2002-01-17 Jonathan Larmour + + * include/unistd.h: ftruncate() should use an off_t argument. + +2002-01-15 Jonathan Larmour + + * include/sys/types.h: off_t should be signed. + 2001-12-05 Jonathan Larmour * include/netdb.h (gethostbyname): anonymous arguments aren't allowed @@ -303,27 +325,36 @@ 2000-05-02 Jonathan Larmour -#endif /* CYGONCE_ISO_FLOAT_H multiple inclusion protection */ - /* EOF float.h */ diff --git a/packages/isoinfra/current/include/limits.h b/packages/isoinfra/current/include/limits.h --- a/packages/isoinfra/current/include/limits.h +++ b/packages/isoinfra/current/include/limits.h @@ -7,29 +7,38 @@ // ISO standard limits // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // @@ -200,6 +209,9 @@ # endif #endif +#endif /* CYGONCE_ISO_LIMITS_H multiple inclusion protection */ + /* Yes it must be ended here! */ + /* When using a crosscompiler targeting linux, the next limits.h file in the include sequence may be the glibc header - which breaks our world. So skip it by defining _LIBC_LIMITS_H_ */ @@ -207,6 +219,4 @@ #include_next -#endif /* CYGONCE_ISO_LIMITS_H multiple inclusion protection */ - /* EOF limits.h */ diff --git a/packages/isoinfra/current/include/locale.h b/packages/isoinfra/current/include/locale.h --- a/packages/isoinfra/current/include/locale.h +++ b/packages/isoinfra/current/include/locale.h @@ -7,29 +7,38 @@ // ISO locale functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/mqueue.h b/packages/isoinfra/current/include/mqueue.h --- a/packages/isoinfra/current/include/mqueue.h +++ b/packages/isoinfra/current/include/mqueue.h @@ -7,29 +7,38 @@ // POSIX message queue functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/netdb.h b/packages/isoinfra/current/include/netdb.h --- a/packages/isoinfra/current/include/netdb.h +++ b/packages/isoinfra/current/include/netdb.h @@ -7,29 +7,38 @@ // Network database functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/pthread.h b/packages/isoinfra/current/include/pthread.h --- a/packages/isoinfra/current/include/pthread.h +++ b/packages/isoinfra/current/include/pthread.h @@ -7,29 +7,38 @@ // POSIX pthread functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/sched.h b/packages/isoinfra/current/include/sched.h --- a/packages/isoinfra/current/include/sched.h +++ b/packages/isoinfra/current/include/sched.h @@ -7,29 +7,38 @@ // POSIX scheduler functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/semaphore.h b/packages/isoinfra/current/include/semaphore.h --- a/packages/isoinfra/current/include/semaphore.h +++ b/packages/isoinfra/current/include/semaphore.h @@ -7,29 +7,38 @@ // POSIX semaphore functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/setjmp.h b/packages/isoinfra/current/include/setjmp.h --- a/packages/isoinfra/current/include/setjmp.h +++ b/packages/isoinfra/current/include/setjmp.h @@ -7,29 +7,38 @@ // ISO non-local jump functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/signal.h b/packages/isoinfra/current/include/signal.h --- a/packages/isoinfra/current/include/signal.h +++ b/packages/isoinfra/current/include/signal.h @@ -7,29 +7,38 @@ // ISO signal functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/stdarg.h b/packages/isoinfra/current/include/stdarg.h --- a/packages/isoinfra/current/include/stdarg.h +++ b/packages/isoinfra/current/include/stdarg.h @@ -1,5 +1,4 @@ -#ifndef CYGONCE_ISO_STDARG_H -#define CYGONCE_ISO_STDARG_H +/* Do not define CYGONCE_ISO_STDARG_H. It is not appropriate for this file */ /*======================================================================== // // stdarg.h @@ -7,29 +6,38 @@ // ISO standard variable argument functionality // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // @@ -56,6 +64,4 @@ #include_next -#endif /* CYGONCE_ISO_STDARG_H multiple inclusion protection */ - /* EOF stdarg.h */ diff --git a/packages/isoinfra/current/include/stddef.h b/packages/isoinfra/current/include/stddef.h --- a/packages/isoinfra/current/include/stddef.h +++ b/packages/isoinfra/current/include/stddef.h @@ -1,4 +1,4 @@ -// Do not define CYGONCE_ISO_STDDEF_H. It is not appropriate for this file +/* Do not define CYGONCE_ISO_STDDEF_H. It is not appropriate for this file */ /*======================================================================== // // stddef.h @@ -6,29 +6,38 @@ // ISO standard defines // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/stdio.h b/packages/isoinfra/current/include/stdio.h --- a/packages/isoinfra/current/include/stdio.h +++ b/packages/isoinfra/current/include/stdio.h @@ -7,29 +7,38 @@ // ISO standard I/O functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/stdlib.h b/packages/isoinfra/current/include/stdlib.h --- a/packages/isoinfra/current/include/stdlib.h +++ b/packages/isoinfra/current/include/stdlib.h @@ -7,29 +7,38 @@ // ISO standard library functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // @@ -249,19 +258,19 @@ extern "C" { typedef void (*__atexit_fn_t)( void ); extern void -abort( void ) __attribute__((__noreturn__)); +abort( void ) CYGBLD_ATTRIB_NORET; extern int atexit( __atexit_fn_t /* func_to_register */ ); extern void -exit( int /* status */ ) __attribute__((__noreturn__)); +exit( int /* status */ ) CYGBLD_ATTRIB_NORET; /* POSIX 1003.1 section 3.2.2 "Terminate a process" */ //@@@ FIXME unistd.h extern void -_exit( int /* status */ ) __attribute__((__noreturn__)); +_exit( int /* status */ ) CYGBLD_ATTRIB_NORET; #ifdef __cplusplus } /* extern "C" */ diff --git a/packages/isoinfra/current/include/string.h b/packages/isoinfra/current/include/string.h --- a/packages/isoinfra/current/include/string.h +++ b/packages/isoinfra/current/include/string.h @@ -7,29 +7,38 @@ // ISO string functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/sys/select.h b/packages/isoinfra/current/include/sys/select.h --- a/packages/isoinfra/current/include/sys/select.h +++ b/packages/isoinfra/current/include/sys/select.h @@ -7,29 +7,38 @@ // POSIX definitions for select() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/sys/stat.h b/packages/isoinfra/current/include/sys/stat.h --- a/packages/isoinfra/current/include/sys/stat.h +++ b/packages/isoinfra/current/include/sys/stat.h @@ -7,29 +7,38 @@ // POSIX file characteristics // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/sys/types.h b/packages/isoinfra/current/include/sys/types.h --- a/packages/isoinfra/current/include/sys/types.h +++ b/packages/isoinfra/current/include/sys/types.h @@ -7,29 +7,38 @@ // POSIX types // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // @@ -72,7 +81,7 @@ typedef short dev_t; typedef unsigned int ino_t; typedef unsigned int mode_t; typedef unsigned short nlink_t; -typedef unsigned long off_t; +typedef long off_t; #endif #ifdef CYGBLD_ISO_SCHEDTYPES_HEADER diff --git a/packages/isoinfra/current/include/sys/utsname.h b/packages/isoinfra/current/include/sys/utsname.h --- a/packages/isoinfra/current/include/sys/utsname.h +++ b/packages/isoinfra/current/include/sys/utsname.h @@ -7,29 +7,38 @@ // POSIX utsname header // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/termios.h b/packages/isoinfra/current/include/termios.h --- a/packages/isoinfra/current/include/termios.h +++ b/packages/isoinfra/current/include/termios.h @@ -7,29 +7,38 @@ // POSIX termios // // ==================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### // ==================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/time.h b/packages/isoinfra/current/include/time.h --- a/packages/isoinfra/current/include/time.h +++ b/packages/isoinfra/current/include/time.h @@ -7,29 +7,38 @@ // ISO time functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/isoinfra/current/include/unistd.h b/packages/isoinfra/current/include/unistd.h --- a/packages/isoinfra/current/include/unistd.h +++ b/packages/isoinfra/current/include/unistd.h @@ -7,29 +7,38 @@ // POSIX UNIX standard definitions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // @@ -226,7 +235,7 @@ extern ssize_t read(int fd, void *buf, extern ssize_t write(int fd, const void *buf, size_t nbyte); extern off_t lseek(int fd, off_t offset, int whence); extern int fsync( int fd ); -extern int ftruncate(int fd, unsigned long length); +extern int ftruncate(int fd, off_t length); extern int chdir(const char *path); extern char *getcwd(char *buf, size_t size); diff --git a/packages/kernel/current/ChangeLog b/packages/kernel/current/ChangeLog --- a/packages/kernel/current/ChangeLog +++ b/packages/kernel/current/ChangeLog @@ -1,3 +1,86 @@ +2002-05-09 Jonathan Larmour + + * include/kapidata.h (CYG_HARDWARETHREAD_MEMBERS): entry_point + should be a pointer to function not an addrword (which may be + different). + (cyg_reason_t): Define cyg_reason_t as an enum not an int. + (struct cyg_mutex_t): Define mutex protocol as an enum not a cyg_uint32. + Define locked member as a cyg_atomic, not a cyg_bool. + +2002-05-09 Nick Garnett + + * tests/timeslice.c: Modified test thread to accumulate run time + by reading HAL clock, and to detect and record changes of CPU. The + previous version of this code reported varying results - probably + as a consequence of cache effects. + + * include/instrmnt.h: Fixed left-over debug edit to MLQ + instrumentation enable code. + +2002-04-29 Jesper Skov + + * include/kapi.h: Added cyg_alarm_get_times and + cyg_counter_multi_tick. + * src/common/kapi.cxx: Same. Er, fix oversight. + * doc/kernel.sgml: Doc update. + +2002-04-24 Yoshinori Sato + + * src/sync/flag.cxx: Don't set default args in func definitions. + +2002-04-24 Jesper Skov + + * tests/dhrystone.c: Moved platform max number of passes to CDL in + HALs. + +2002-04-23 Jesper Skov + + * tests/dhrystone.c: Allow platform to define max number of passes + via CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES. + +2002-04-09 Jonathan Larmour + + * include/kapi.h: Use NORET attributes from cyg_type.h. + * include/sched.hxx (class Cyg_Scheduler): Ditto. + +2002-04-08 Nick Garnett + + * src/sync/mutex.cxx: Added IF_PROTOCOL_ACTIVE macro to condition + use of the mutex counter. This means that a mutex that is not + configured to participate in a priority inversion protocol does not + count for operation of that protocol. + +2002-03-04 Lars Viklund + + * include/kapidata.h (CYG_SCHEDTHREAD_ASR_MEMBER): + asr_inhibit is cyg_ucount32 - must match + +2002-02-13 Hugo Tyson + + * doc/kernel.sgml: NEW FILE: Correct reference to uITRON doc. + +2002-01-28 Jesper Skov + + * tests/kexcept1.c: Fix warning. + +2002-01-24 Jesper Skov + + * tests/kcache1.c (time0DI): Disable interrupts around the + sync+invalidate process. + * tests/kcache2.c: Same. + +2002-01-23 Jonathan Larmour + + * src/intr/intr.cxx (mask_interrupt): Disable interrupts. + (unmask_interrupt): Ditto. + (mask_interrupt_intunsafe): New function to avoid disabled interrupts. + (unmask_interrupt_intunsafe): Ditto. + * include/intr.hxx (class Cyg_Interrupt): Declare above new funcs. + * src/common/kapi.cxx (cyg_interrupt_unmask_intunsafe): Above + replicated to KAPI. + (cyg_interrupt_mask_intunsafe): Ditto. + * include/kapi.h: Ditto. + 2002-01-07 Nick Garnett * tests/except1.cxx: @@ -4060,27 +4143,36 @@ Wed Mar 11 13:18:17 GMT 1998 Chris Prov options. This is generated at configure and modified by non_arch.sh //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/kernel/current/cdl/counters.cdl b/packages/kernel/current/cdl/counters.cdl --- a/packages/kernel/current/cdl/counters.cdl +++ b/packages/kernel/current/cdl/counters.cdl @@ -5,29 +5,38 @@ # configuration data related to the kernel counters and clocks # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/kernel/current/cdl/instrument.cdl b/packages/kernel/current/cdl/instrument.cdl --- a/packages/kernel/current/cdl/instrument.cdl +++ b/packages/kernel/current/cdl/instrument.cdl @@ -5,29 +5,38 @@ # configuration data related to the kernel instrumentation # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/kernel/current/cdl/interrupts.cdl b/packages/kernel/current/cdl/interrupts.cdl --- a/packages/kernel/current/cdl/interrupts.cdl +++ b/packages/kernel/current/cdl/interrupts.cdl @@ -5,29 +5,38 @@ # configuration data related to kernel interrupt handling # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/kernel/current/cdl/kernel.cdl b/packages/kernel/current/cdl/kernel.cdl --- a/packages/kernel/current/cdl/kernel.cdl +++ b/packages/kernel/current/cdl/kernel.cdl @@ -5,29 +5,38 @@ # eCos kernel configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/kernel/current/cdl/scheduler.cdl b/packages/kernel/current/cdl/scheduler.cdl --- a/packages/kernel/current/cdl/scheduler.cdl +++ b/packages/kernel/current/cdl/scheduler.cdl @@ -5,29 +5,38 @@ # configuration data related to the kernel schedulers # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/kernel/current/cdl/synch.cdl b/packages/kernel/current/cdl/synch.cdl --- a/packages/kernel/current/cdl/synch.cdl +++ b/packages/kernel/current/cdl/synch.cdl @@ -5,29 +5,38 @@ # configuration data related to the kernel synchronization primitives # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/kernel/current/cdl/thread.cdl b/packages/kernel/current/cdl/thread.cdl --- a/packages/kernel/current/cdl/thread.cdl +++ b/packages/kernel/current/cdl/thread.cdl @@ -5,29 +5,38 @@ # configuration data related to the kernel threads # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/kernel/current/doc/SMP.txt b/packages/kernel/current/doc/SMP.txt new file mode 100644 --- /dev/null +++ b/packages/kernel/current/doc/SMP.txt @@ -0,0 +1,544 @@ + +eCos SMP Support +================ + +eCos contains support for limited Symmetric Multi-Processing +(SMP). This is only available on selected architectures and platforms. + +This first part of this document describes the platform-independent +parts of the SMP support. Annexes at the end of this document describe +any details that are specific to a particular platform. + +Target Hardware Limitations +--------------------------- + +To allow a reasonable implementation of SMP, and to reduce the +disruption to the existing source base, a number of assumptions have +been made about the features of the target hardware. + +- Modest multiprocessing. The typical number of CPUs supported is two + to four, with an upper limit around eight. While there are no + inherent limits in the code, hardware and algorithmic limitations + will probably become significant beyond this point. + +- SMP synchronization support. The hardware must supply a mechanism to + allow software on two CPUs to synchronize. This is normally provided + as part of the instruction set in the form of test-and-set, + compare-and-swap or load-link/store-conditional instructions. An + alternative approach is the provision of hardware semaphore + registers which can be used to serialize implementations of these + operations. Whatever hardware facilities are available, they are + used in eCos to implement spinlocks. + +- Coherent caches. It is assumed that no extra effort will be required + to access shared memory from any processor. This means that either + there are no caches, they are shared by all processors, or are + maintained in a coherent state by the hardware. It would be too + disruptive to the eCos sources if every memory access had to be + bracketed by cache load/flush operations. Any hardware that requires + this is not supported. + +- Uniform addressing. It is assumed that all memory that is + shared between CPUs is addressed at the same location from all + CPUs. Like non-coherent caches, dealing with CPU-specific address + translation is considered too disruptive to the eCos source + base. This does not, however, preclude systems with non-uniform + access costs for different CPUs. + +- Uniform device addressing. As with access to memory, it is assumed + that all devices are equally accessible to all CPUs. Since device + access is often made from thread contexts, it is not possible to + restrict access to device control registers to certain CPUs, since + there is currently no support for binding or migrating threads to CPUs. + +- Interrupt routing. The target hardware must have an interrupt + controller that can route interrupts to specific CPUs. It is + acceptable for all interrupts to be delivered to just one CPU, or + for some interrupts to be bound to specific CPUs, or for some + interrupts to be local to each CPU. At present dynamic routing, + where a different CPU may be chosen each time an interrupt is + delivered, is not supported. ECos cannot support hardware where all + interrupts are delivered to all CPUs simultaneously with the + expectation that software will resolve any conflicts. + +- Inter-CPU interrupts. A mechanism to allow one CPU to interrupt + another is needed. This is necessary so that events on one CPU can + cause rescheduling on other CPUs. + +- CPU Identifiers. Code running on a CPU must be able to determine + which CPU it is running on. The CPU Id is usually provided either in + a CPU status register, or in a register associated with the + inter-CPU interrupt delivery subsystem. Ecos expects CPU Ids to be + small positive integers, although alternative representations, such + as bitmaps, can be converted relatively easily. Complex mechanisms + for getting the CPU Id cannot be supported. Getting the CPU Id must + be a cheap operation, since it is done often, and in performance + critical places such as interrupt handlers and the scheduler. + +Kernel Support +-------------- + +This section describes how SMP is handled in the kernel, and where +system behaviour differs from a single CPU system. + +System Startup +~~~~~~~~~~~~~~ + +System startup takes place on only one CPU, called the primary +CPU. All other CPUs, the secondary CPUs, are either placed in +suspended state at reset, or are captured by the HAL and put into +a spin as they start up. + +The primary CPU is responsible for copying the DATA segment and +zeroing the BSS (if required), calling HAL variant and platform +initialization routines and invoking constructors. It then calls +cyg_start() to enter the application. The application may then create +extra threads and other objects. + +It is only when the application calls Cyg_Scheduler::start() that the +secondary CPUs are initialized. This routine scans the list of +available secondary CPUs and calls HAL_SMP_CPU_START() to start each one. +Finally it calls Cyg_Scheduler::start_cpu(). + +Each secondary CPU starts in the HAL, where it completes any per-CPU +initialization before calling into the kernel at +cyg_kernel_cpu_startup(). Here it claims the scheduler lock and calls +Cyg_Scheduler::start_cpu(). + +Cyg_Scheduler::start_cpu() is common to both the primary and secondary +CPUs. The first thing this code does is to install an interrupt object +for this CPU's inter-CPU interrupt. From this point on the code is the +same as for the single CPU case: an initial thread is chosen and +entered. + +From this point on the CPUs are all equal, eCos makes no further +distinction between the primary and secondary CPUs. However, the +hardware may still distinguish them as far as interrupt delivery is +concerned. + + +Scheduling +~~~~~~~~~~ + +To function correctly an operating system kernel must protect its +vital data structures, such as the run queues, from concurrent +access. In a single CPU system the only concurrent activities to worry +about are asynchronous interrupts. The kernel can easily guard its +data structures against these by disabling interrupts. However, in a +multi-CPU system, this is inadequate since it does not block access by +other CPUs. + +The eCos kernel protects its vital data structures using the scheduler +lock. In single CPU systems this is a simple counter that is +atomically incremented to acquire the lock and decremented to release +it. If the lock is decremented to zero then the scheduler may be +invoked to choose a different thread to run. Because interrupts may +continue to be serviced while the scheduler lock is claimed, ISRs are +not allowed to access kernel data structures, or call kernel routines +that can. Instead all such operations are deferred to an associated +DSR routine that is run during the lock release operation, when the +data structures are in a consistent state. + +By choosing a kernel locking mechanism that does not rely on interrupt +manipulation to protect data structures, it is easier to convert eCos +to SMP than would otherwise be the case. The principal change needed to +make eCos SMP-safe is to convert the scheduler lock into a nestable +spin lock. This is done by adding a spinlock and a CPU id to the +original counter. + +The algorithm for acquiring the scheduler lock is very simple. If the +scheduler lock's CPU id matches the current CPU then it can increment +the counter and continue. If it does not match, the CPU must spin on +the spinlock, after which it may increment the counter and store its +own identity in the CPU id. + +To release the lock, the counter is decremented. If it goes to zero +the CPU id value must be set to NONE and the spinlock cleared. + +To protect these sequences against interrupts, they must be performed +with interrupts disabled. However, since these are very short code +sequences, they will not have an adverse effect on the interrupt +latency. + +Beyond converting the scheduler lock, further preparing the kernel for +SMP is a relatively minor matter. The main changes are to convert +various scalar housekeeping variables into arrays indexed by CPU +id. These include the current thread pointer, the need_reschedule +flag and the timeslice counter. + +At present only the Multi-Level Queue (MLQ) scheduler is capable of +supporting SMP configurations. The main change made to this scheduler +is to cope with having several threads in execution at the same +time. Running threads are marked with the CPU they are executing on. +When scheduling a thread, the scheduler skips past any running threads +until it finds a thread that is pending. While not a constant-time +algorithm, as in the single CPU case, this is still deterministic, +since the worst case time is bounded by the number of CPUs in the +system. + +A second change to the scheduler is in the code used to decide when +the scheduler should be called to choose a new thread. The scheduler +attempts to keep the *n* CPUs running the *n* highest priority +threads. Since an event or interrupt on one CPU may require a +reschedule on another CPU, there must be a mechanism for deciding +this. The algorithm currently implemented is very simple. Given a +thread that has just been awakened (or had its priority changed), the +scheduler scans the CPUs, starting with the one it is currently +running on, for a current thread that is of lower priority than the +new one. If one is found then a reschedule interrupt is sent to that +CPU and the scan continues, but now using the current thread of the +rescheduled CPU as the candidate thread. In this way the new thread +gets to run as quickly as possible, hopefully on the current CPU, and +the remaining CPUs will pick up the remaining highest priority +threads as a consequence of processing the reschedule interrupt. + +The final change to the scheduler is in the handling of +timeslicing. Only one CPU receives timer interrupts, although all CPUs +must handle timeslicing. To make this work, the CPU that receives the +timer interrupt decrements the timeslice counter for all CPUs, not +just its own. If the counter for a CPU reaches zero, then it sends a +timeslice interrupt to that CPU. On receiving the interrupt the +destination CPU enters the scheduler and looks for another thread at +the same priority to run. This is somewhat more efficient than +distributing clock ticks to all CPUs, since the interrupt is only +needed when a timeslice occurs. + +Device Drivers +~~~~~~~~~~~~~~ + +The main area where the SMP nature of a system will be most apparent +is in device drivers. It is quite possible for the ISR, DSR and thread +components of a device driver to execute on different CPUs. For this +reason it is much more important that SMP-capable device drivers use +the driver API routines correctly. + +Synchronization between threads and DSRs continues to require that the +thread-side code use cyg_drv_dsr_lock() and cyg_drv_dsr_unlock() to +protect access to shared data. Synchronization between ISRs and DSRs +or threads requires that access to sensitive data be protected, in all +places, by calls to cyg_drv_isr_lock() and cyg_drv_isr_unlock(). + +The ISR lock, for SMP systems, not only disables local interrupts, but +also acquires a spinlock to protect against concurrent access from +other CPUs. This is necessary because ISRs are not run with the +scheduler lock claimed. Hence they can run in parallel with other +components of the device driver. + +The ISR lock provided by the driver API is just a shared spinlock that +is available for use by all drivers. If a driver needs to implement a +finer grain of locking, it can use private spinlocks, accessed via the +cyg_drv_spinlock_*() functions (see API later). + + +API Extensions +-------------- + +In general, the SMP support is invisible to application code. All +synchronization and communication operations function exactly as +before. The main area where code needs to be SMP aware is in the +handling of interrupt routing, and in the synchronization of ISRs, +DSRs and threads. + +The following sections contain brief descriptions of the API +extensions added for SMP support. More details will be found in the +Kernel C API and Device Driver API documentation. + +Interrupt Routing +~~~~~~~~~~~~~~~~~ + +Two new functions have been added to the Kernel API and the device +driver API to do interrupt routing. These are: + +void cyg_interrupt_set_cpu( cyg_vector_t vector, cyg_cpu_t cpu ); +void cyg_drv_interrupt_set_cpu( cyg_vector_t vector, cyg_cpu_t cpu ); + +cyg_cpu_t cyg_interrupt_get_cpu( cyg_vector_t vector ); +cyg_cpu_t cyg_drv_interrupt_get_cpu( cyg_vector_t vector ); + +the *_set_cpu() functions cause the given interrupt to be handled by +the nominated CPU. + +The *_get_cpu() functions return the CPU to which the vector is +routed. + +Although not currently supported, special values for the cpu argument +may be used to indicate that the interrupt is being routed dynamically +or is CPU-local. + +Once a vector has been routed to a new CPU, all other interrupt +masking and configuration operations are relative to that CPU, where +relevant. + +Synchronization +~~~~~~~~~~~~~~~ + +All existing synchronization mechanisms work as before in an SMP +system. Additional synchronization mechanisms have been added to +provide explicit synchronization for SMP. + +A set of functions have been added to the Kernel and device driver +APIs to provide spinlocks: + +void cyg_spinlock_init( cyg_spinlock_t *lock, cyg_bool_t locked ); +void cyg_drv_spinlock_init( cyg_spinlock_t *lock, cyg_bool_t locked ); + +void cyg_spinlock_destroy( cyg_spinlock_t *lock ); +void cyg_drv_spinlock_destroy( cyg_spinlock_t *lock ); + +void cyg_spinlock_spin( cyg_spinlock_t *lock ); +void cyg_drv_spinlock_spin( cyg_spinlock_t *lock ); + +void cyg_spinlock_clear( cyg_spinlock_t *lock ); +void cyg_drv_spinlock_clear( cyg_spinlock_t *lock ); + +cyg_bool_t cyg_spinlock_try( cyg_spinlock_t *lock ); +cyg_bool_t cyg_drv_spinlock_try( cyg_spinlock_t *lock ); + +cyg_bool_t cyg_spinlock_test( cyg_spinlock_t *lock ); +cyg_bool_t cyg_drv_spinlock_test( cyg_spinlock_t *lock ); + +void cyg_spinlock_spin_intsave( cyg_spinlock_t *lock, + cyg_addrword_t *istate ); +void cyg_drv_spinlock_spin_intsave( cyg_spinlock_t *lock, + cyg_addrword_t *istate ); + +void cyg_spinlock_clear_intsave( cyg_spinlock_t *lock, + cyg_addrword_t istate ); +void cyg_drv_spinlock_clear_intsave( cyg_spinlock_t *lock, + cyg_addrword_t istate ); + +The *_init() functions initialize the lock, to either locked or clear, +and the *_destroy() functions destroy the lock. Init() should be called +before the lock is used and destroy() should be called when it is +finished with. + +The *_spin() functions will cause the calling CPU to spin until it can +claim the lock and the *_clear() functions clear the lock so that the +next CPU can claim it. The *_try() functions attempts to claim the lock +but returns false if it cannot. The *_test() functions simply return +the state of the lock. + +None of these functions will necessarily block interrupts while they +spin. If the spinlock is only to be used between threads on different +CPUs, or in circumstances where it is known that the relevant +interrupts are disabled, then these functions will suffice. However, +if the spinlock is also to be used from an ISR, which may be called at +any point, a straightforward spinlock may result in deadlock. Hence +the *_intsave() variants are supplied to disable interrupts while the +lock is held. + +The *_spin_intsave() function disables interrupts, saving the current +state in *istate, and then claims the lock. The *_clear_intsave() +function clears the spinlock and restores the interrupt enable state +from *istate. + + +HAL Support +----------- + +SMP support in any platform depends on the HAL supplying the +appropriate operations. All HAL SMP support is defined in the +hal_smp.h header (and if necessary var_smp.h and plf_smp.h). + +SMP support falls into a number of functional groups. + +CPU Control +~~~~~~~~~~~ + +This group consists of descriptive and control macros for managing the +CPUs in an SMP system. + +HAL_SMP_CPU_TYPE A type that can contain a CPU id. A CPU id is + usually a small integer that is used to index + arrays of variables that are managed on an + per-CPU basis. + +HAL_SMP_CPU_MAX The maximum number of CPUs that can be + supported. This is used to provide the size of + any arrays that have an element per CPU. + +HAL_SMP_CPU_COUNT() Returns the number of CPUs currently + operational. This may differ from + HAL_SMP_CPU_MAX depending on the runtime + environment. + +HAL_SMP_CPU_THIS() Returns the CPU id of the current CPU. + +HAL_SMP_CPU_NONE A value that does not match any real CPU + id. This is uses where a CPU type variable + must be set to a nul value. + +HAL_SMP_CPU_START( cpu ) + Starts the given CPU executing at a defined + HAL entry point. After performing any HAL + level initialization, the CPU calls up into + the kernel at cyg_kernel_cpu_startup(). + +HAL_SMP_CPU_RESCHEDULE_INTERRUPT( cpu, wait ) + Sends the CPU a reschedule interrupt, and if + _wait_ is non-zero, waits for an + acknowledgment. The interrupted CPU should + call cyg_scheduler_set_need_reschedule() in + its DSR to cause the reschedule to occur. + +HAL_SMP_CPU_TIMESLICE_INTERRUPT( cpu, wait ) + Sends the CPU a timeslice interrupt, and if + _wait_ is non-zero, waits for an + acknowledgment. The interrupted CPU should + call cyg_scheduler_timeslice_cpu() to cause + the timeslice event to be processed. + +Test-and-set Support +~~~~~~~~~~~~~~~~~~~~ + +Test-and-set is the foundation of the SMP synchronization +mechanisms. + +HAL_TAS_TYPE The type for all test-and-set variables. The + test-and-set macros only support operations on + a single bit (usually the least significant + bit) of this location. This allows for maximum + flexibility in the implementation. + +HAL_TAS_SET( tas, oldb ) + Performs a test and set operation on the + location _tas_. _oldb_ will contain *true* if + the location was already set, and *false* if + it was clear. + +HAL_TAS_CLEAR( tas, oldb ) + Performs a test and clear operation on the + location _tas_. _oldb_ will contain *true* if + the location was already set, and *false* if + it was clear. + +Spinlocks +~~~~~~~~~ + +Spinlocks provide inter-CPU locking. Normally they will be implemented +on top of the test-and-set mechanism above, but may also be +implemented by other means if, for example, the hardware has more +direct support for spinlocks. + +HAL_SPINLOCK_TYPE The type for all spinlock variables. + +HAL_SPINLOCK_INIT_CLEAR A value that may be assigned to a spinlock + variable to initialize it to clear. + +HAL_SPINLOCK_INIT_SET A value that may be assigned to a spinlock + variable to initialize it to set. + +HAL_SPINLOCK_SPIN( lock ) + The caller spins in a busy loop waiting for + the lock to become clear. It then sets it and + continues. This is all handled atomically, so + that there are no race conditions between CPUs. + +HAL_SPINLOCK_CLEAR( lock ) + The caller clears the lock. One of any waiting + spinners will then be able to proceed. + +HAL_SPINLOCK_TRY( lock, val ) + Attempts to set the lock. The value put in + _val_ will be *true* if the lock was + claimed successfully, and *false* if it was + not. + +HAL_SPINLOCK_TEST( lock, val ) + Tests the current value of the lock. The value + put in _val_ will be *true* if the lock is + claimed and *false* of it is clear. + +Scheduler Lock +~~~~~~~~~~~~~~ + +The scheduler lock is the main protection for all kernel data +structures. By default the kernel implements the scheduler lock itself +using a spinlock. However, if spinlocks cannot be supported by the +hardware, or there is a more efficient implementation available, the +HAL may provide macros to implement the scheduler lock. + +HAL_SMP_SCHEDLOCK_DATA_TYPE + A data type, possibly a structure, that + contains any data items needed by the + scheduler lock implementation. A variable of + this type will be instantiated as a static + member of the Cyg_Scheduler_SchedLock class + and passed to all the following macros. + +HAL_SMP_SCHEDLOCK_INIT( lock, data ) + Initialize the scheduler lock. The _lock_ + argument is the scheduler lock counter and the + _data_ argument is a variable of + HAL_SMP_SCHEDLOCK_DATA_TYPE type. + +HAL_SMP_SCHEDLOCK_INC( lock, data ) + Increment the scheduler lock. The first + increment of the lock from zero to one for any + CPU may cause it to wait until the lock is + zeroed by another CPU. Subsequent increments + should be less expensive since this CPU + already holds the lock. + +HAL_SMP_SCHEDLOCK_ZERO( lock, data ) + Zero the scheduler lock. This operation will + also clear the lock so that other CPUs may + claim it. + +HAL_SMP_SCHEDLOCK_SET( lock, data, new ) + + Set the lock to a different value, in + _new_. This is only called when the lock is + already known to be owned by the current + CPU. It is never called to zero the lock, or + to increment it from zero. + + +Interrupt Routing +~~~~~~~~~~~~~~~~~ + +The routing of interrupts to different CPUs is supported by two new +interfaces in hal_intr.h. + +Once an interrupt has been routed to a new CPU, the existing vector +masking and configuration operations should take account of the CPU +routing. For example, if the operation is not invoked on the +destination CPU itself, then the HAL may need to arrange to transfer +the operation to the destination CPU for correct application. + +HAL_INTERRUPT_SET_CPU( vector, cpu ) + Route the interrupt for the given _vector_ to + the given _cpu_. + +HAL_INTERRUPT_GET_CPU( vector, cpu ) + Set _cpu_ to the id of the CPU to which this + vector is routed. + + + + + +Annex 1 - Pentium SMP Support +============================= + +ECos supports SMP working on Pentium class IA32 CPUs with integrated +SMP support. It uses the per-CPU APIC's and the IOAPIC to provide CPU +control and identification, and to distribute interrupts. Only PCI +interrupts that map into the ISA interrupt space are currently +supported. The code relies on the MP Configuration Table supplied by +the BIOS to discover the number of CPUs, IOAPIC location and interrupt +assignments - hardware based MP configuration discovery is +not currently supported. + +Inter-CPU interrupts are mapped into interrupt vectors from 64 +up. Each CPU has its own vector at 64+CPUID. + +Interrupt delivery is initially configured to deliver all interrupts +to the initial CPU. HAL_INTERRUPT_SET_CPU() currently only supports +the ability to deliver interrupts to specific CPUs, dynamic CPU +selection is not currently supported. + +eCos has only been tested in a dual processor configuration. While the +code has been written to handle an arbitrary number of CPUs, this has +not been tested. + diff --git a/packages/kernel/current/doc/kernel.sgml b/packages/kernel/current/doc/kernel.sgml new file mode 100644 --- /dev/null +++ b/packages/kernel/current/doc/kernel.sgml @@ -0,0 +1,3716 @@ + + The eCos kernel + +eCos kernel overview +This is an overview of the internal workings of the + eCos + kernel. + +<!-- <xref> -->The scheduler +At the core of the kernel is the scheduler. +This defines the way in which threads are run, and provides the mechanisms +by which they may synchronize. It also controls the means by which interrupts +affect thread execution. No single scheduler can cover all possible system +configurations. For different purposes we will need to cover several scheduling +polices. In this release two schedulers are provided (described +in more detail in ): + + +a bitmap scheduler + + +a multi-level queue scheduler + + + +At present the system will only support a single scheduler +at any one time. Future systems may allow multiple schedulers to +co-exist, but this will be hidden behind the scheduler API in the +current release. +To make scheduling safe we need a mechanism to protect the +scheduler data structures from concurrent access. The traditional +approach to this is to disable interrupts during the critical regions. +Unfortunately this increases the maximum interrupt dispatch latency, +which is to be avoided in any real-time system. +The mechanisms chosen for eCos is to +maintain a counter, Scheduler::sched_lock +that, if non-zero, prevents any rescheduling. The current thread +can claim the lock by calling Scheduler::lock(). +This increments the counter and prevents any further scheduling. +The function Scheduler::unlock() +decrements the counter and if it returns to zero, allows scheduling +to continue. +For this to work in the presence of interrupts, it is necessary +for the Interrupt Service Routines (ISR) to defer +any scheduler-oriented operations until the lock is about to go +zero. We do this by splitting the work of an ISR into two parts, +with the second part, the Deferred Service Routine +(DSR), being queued until the scheduler decides it is safe to run. +This is covered in more detail in and + . +On a uni-processor, + Scheduler::lock() is a simple increment + of Scheduler::sched_lock. It does + not need to be a read-modify-write cycle since the lock is + strictly nested. The mere fact that the current thread is + running implies that the lock has not been claimed by + another thread, so it is always claimable. +Scheduler::unlock() is generic to + all scheduler implementations. + + +Thread <!-- <index></index> --> +synchronization +To allow threads to cooperate and compete for resources, + it is necessary to provide mechanisms for synchronization + and communication. The classic synchronization mechanisms + are mutexes/condition variables and semaphores. These + are provided in the eCos kernel, + together with other synchronization/communication + mechanisms that are common in real-time systems, such as + event flags and message queues. +One of the problems that must be dealt with in any real-time +systems is priority inversion. This is where a high +priority thread is (wrongly) prevented from continuing by one at +lower priority. The normal example is of a high priority thread +waiting at a mutex already held by a low priority thread. If the +low priority thread is preempted by a medium priority thread then +priority inversion has occurred since the high priority thread is +prevented from continuing by an unrelated thread of lower priority. +This problem got much attention recently when the Mars Pathfinder +mission had to reset the computers on the ground exploration robot +repeatedly because a priority inversion problem would cause it to +hang. +There are several solutions to this problem. The simplest +is to employ a priority ceiling protocol where all +threads that acquire the mutex have their priority boosted to some +predetermined value. This has a number of disadvantages: it requires +the maximum priority of the threads using the mutex to be known +in advance; if the ceiling priority is too high it acts as a global +lock disabling all scheduling and it is pessimistic, taking action +to prevent the problem even when it does not arise. +A better solution is to use priority inheritance +protocol. Here, the priority of the thread that owns the mutex is boosted +to equal that of the highest priority thread that is waiting for +it. This technique does not require prior knowledge of the priorities +of the threads that are going to use the mutex, and the priority +of the owning thread is only boosted when a higher priority thread +is waiting. This reduces the effect on the scheduling of other threads, +and is more optimistic than the priority ceiling protocol. A disadvantage +of this mechanism is that the cost of each synchronization call +is increased since the inheritance protocol must be obeyed each +time. +A third approach to priority inversion is to recognize that +relative thread priorities have been poorly chosen and thus the +system in which it occurs is faulty. In this case the kernel needs +the ability to detect when priority inversion has taken place, and +to raise an exception when it occurs to aid debugging. Then this +code is removed from the shipping version. +The current eCos release provides a relatively +simple implementation of mutex priority inheritance. +This implementation will only work in the multi-level queue scheduler, +and it does not handle the rare case of nested mutexes completely correctly. +However it is both fast and deterministic. Mutex priority inheritance +can be disabled if the application does not require it. This will +reduce both code size and data space. +Future releases will provide alternative implementations of +mutex priority inheritance, and application developers will be able +to choose the implementation appropriate to their application. + + +Exceptions +An exception is a synchronous event caused by the execution +of a thread. These include both the machine exceptions raised by +hardware (such as divide-by-zero, memory fault and illegal instruction) +and machine exceptions raised by software (such as deadline overrun). +The standard C++ exception mechanism is too expensive +to use for this, and in any case has the wrong semantics for the exception +handling in an RTOS. +The simplest, and most flexible, mechanism for exception +handling is to call a function. This function needs context in which +to work, so access to some working data is required. The function +may also need to be handed some data about the exception raised: +at least the exception number and some optional parameters. +The exception handler receives a data argument which is a +value that was registered with the handler and points to context +information. It also receives an exception_number which +identifies the exception taken, and an error code which contains +any additional information (such as a memory fault address) needed +to handle the exception. Returning from the function will allow +the thread to continue. +Exception handlers may be either global or per-thread, or +both, depending on configuration options. If exceptions are per-thread, +it is necessary to have an exception handler attached to each thread. + + +<!-- <xref> -->Interrupts +Interrupts are asynchronous events caused by external devices. +They may occur at any time and are not associated in any way with +the thread that is currently running. +The handling of interrupts is one of the more +complex areas in RTOS design, largely because it is the least well +defined. The ways in which interrupt vectors are named, how interrupts +are delivered to the software and how interrupts are masked are +all highly architecture- (and in some cases board-) specific. The +approach taken in eCos is to provide a generalized mechanism +with sufficient hooks for system-specific code to be inserted where +needed. +Let us start by considering the issue of interrupt vectors. +Hardware support differs greatly here: from the Intel Architecture +and the 680X0 having support for vectoring individual interrupts +to their own vectors, to most RISC architectures that only have +a single vector. In the first case it is possible to attach an ISR directly +to the vector and know that it need only concern itself with the +device in question. In the second case it is necessary to determine +which device is actually interrupting and then vector to the correct +ISR. Where there is an external interrupt controller, it will be +possible to query that and provide what is essentially a software +implementation of hardware vectoring. Otherwise the actual hardware devices +must be tested, by calling the ISRs in turn and letting them make +the determination. Since it is possible for two devices to interrupt +simultaneously, it is necessary to call all ISRs each time an interrupt +occurs. +Interrupt masking has a similar variety of support. Most processors +have a simple interrupt mask bit in a status register. The 680X0 +has seven levels of masking. Any board with a interrupt controller +can be programmed to provide similar multi-level masking. It is +necessary to keep the interrupt masking mechanism simple and efficient, +and use only architectural support. The cost of manipulating an +on-board interrupt controller may be too high. However, individual +device drivers may want access to their individual mask bits in +the interrupt controller, so support for this must be provided. +Most of the infrastructure necessary for a (somewhat) portable +treatment of interrupts is implemented in the eCos Hardware +Abstraction Layer (HAL), which is documented in . + + +Counters, clocks, alarms and timers +If the hardware provides a periodic clock or timer, it will +be used to drive timing-related features of the system. Many CPU +architectures now have built in timer registers that can provide +a periodic interrupt. This should be used to drive these features +where possible. Otherwise an external timer/clock chip +must be used. +We draw a distinction between Counters, Clocks, Alarms and +Timers. A Counter maintains a monotonically increasing +counter that is driven by some source of ticks. A Clock +is a counter driven by a regular source of ticks (i.e. it counts +time). Clocks have a resolution associated with them. +A default system Clock is driven by the periodic interrupt described +above, and tracks real-time. Other interrupt sources may drive other +Counters that may or may not track real-time at different resolutions. +Some Counters may be driven by aperiodic events and thus have no relation +to real-time at all. +An Alarm is attached to a Counter and provides +a mechanism for generating single-shot or periodic events based +on the counter's value. A Timer is simply +an Alarm that is attached to a Clock. +The system (including the kernel) represents time in units +of ticks. These are clock-specific time units +and are usually the period of the timer interrupt, or a multiple +thereof. Conversion of ticks into conventional time and date units +should occur only when required via library functions. Equivalence +between Clock time and real-time can be made with an RTC +(real-time clock), NTP (network time protocol) or +user input. +The representation of the current tick count needs to be 64 +bit. This requires either compiler support for 64 bit integers, +or assembly code. Even at the extreme of a 1 ns tick (ticks will +typically be >1ms), this gives a 584 year rollover period. +The Clock API and configuration options that affect clock, +counter and alarm behavior are described in detail in . + + + +A tour of the kernel sources +This description takes the form of a tour around the + sources explaining their structure and describing the + functionality of each component. +The kernel is divided into two basic parts, the largely machine +independent parts in packages/kernel/&versiondir;, +and the architecture- and platform-specific parts that comprise +the Hardware Abstraction Layer (HAL) in packages/hal. +These will be described separately. Also note that the HAL is described +in great detail in its own chapter (). + +<!-- <index></index> -->Kernel headers +Kernel header files (in packages/kernel/&versiondir;/include) +provide external interfaces and configuration control for the various +kernel objects. In general there is an include file for each major +kernel class. Those header files having to do with configuration +live in the pkgconf subdirectory. +The base name of a header file and the source file that implements +it are usually the same. So, for example, the member functions defined +in sched.hxx are implemented in sched.cxx. +For a number of classes there are also header files that define +inline functions, for example sched.inl. +There are some kernel objects that are implemented using C++ templates +to allow code re-use in future; it is not intended that these template +classes be used generally by applications. The appropriate concrete +kernel classes should be used instead. +Now we examine the files one by one for reference: + + +include/bitmap.hxx + +Bitmap scheduler definition. See source file + sched/bitmap.cxx + + + +include/clock.hxx +include/clock.inl + + +Counter, clock and alarm functions. See source + file + common/clock.cxx + + + +include/diag.h + + + +Diagnostic routines. See source file + trace/diag.c + + + +include/errors.h + + + +Kernel error codes. See source file + common/except.cxx + + + +include/except.hxx + + + +Exception handling. + + + +include/flag.hxx + + + +Flag synchronization objects. See source file + sync/flag.cxx + + + +include/instrmnt.h + + + +Instrumentation. See source file + instrmnt/meminst.cxx + + + +include/intr.hxx + + + +Interrupts. See source file + intr/intr.cxx + + + +include/kapi.h +include/kapidata.h + + +Native 'C' API to the kernel. See source +file + common/kapi.cxx + + + +include/ktypes.h + + + +Kernel types. + + + +include/llistt.hxx + + + +A simple doubly linked-list template class used elsewhere +in the kernel. + + + +include/lottery.hxx + + + +Lottery scheduler implementation. (Not used). See source file + sched/lottery.cxx + + + +include/mbox.hxx +include/mboxt.hxx +include/mboxt2.hxx +include/mboxt.inl +include/mboxt2.inl + + + +Message boxes. See source file sync/mbox.cxx; mboxt.hxx and mboxt2.hxx and mboxt.inl and mboxt2.inl implement +the underlying template function. + +The files with a 2 suffix are used by default and + provide precise µITRON semantics. + + + + +include/memfixed.hxx +include/mempoolt.hxx +include/mempolt2.hxx +include/mempoolt.inl +include/mempolt2.inl +include/mfiximpl.hxx +include/mfiximpl.inl + + + +Fixed-block allocation memory pools. See source file mem/memfixed.cxx; +mempoolt[2] and mfiximpl are a thread-safety template +function and underlying memory manager respectively. + +The files with a 2 suffix are used by default and provide + precise µITRON semantics. + + + + +include/memvar.hxx +include/mempoolt.hxx +include/mempolt2.hxx +include/mempoolt.inl +include/mempolt2.inl +include/mvarimpl.hxx +include/mvarimpl.inl + + +Variable-block allocation memory pools. See source file mem/memvar.cxx; +mempoolt[2] and mvar are a thread-safety template +function and underlying memory manager respectively. + +The files with a 2 suffix are used by default and provide + precise µITRON semantics. + + + + +include/mlqueue.hxx + + + +Multi-level queue scheduler. See source file + sched/mlqueue.cxx + + + +include/mutex.hxx + + + +Mutexes. See source file + sync/mutex.cxx + + + +include/sched.hxx +include/sched.inl + + +General scheduler functions. See source file + sched/sched.cxx + + + +include/sema.hxx +include/sema2.hxx + + +Semaphores. See source files sync/cnt_sem.cxx and sync/bin_sem.cxx for + counting or binary semaphores respectively. + +The file with a 2 suffix is used by default + and provides precise µITRON + semantics. + + + + +include/thread.hxx +include/thread.inl + + +Threads, regardless of scheduler. See + common/thread.cxx + + + + + +<!-- <index></index> --> Kernel source files +The kernel source directory (packages/kernel/&versiondir;/src) +is divided into a number of sub-directories each containing the +source files for a particular kernel subsystem. These sources divide +into two classes: those that are generic to all configurations, +and those that are specific to a particular configuration. + +<!-- <index></index> --><!-- <xref> -->Sched subdirectory + + +sched/sched.cxx + + + +This contains the implementation of the base + scheduler classes. The most important function here + is + Cyg_Scheduler::unlock_inner() + which runs DSRs and performs any rescheduling and + thread switching. + + + +sched/bitmap.cxx + + + +This contains the bitmap scheduler implementation. It represents +each runnable thread with a bit in a bitmap. Each thread must have +a unique priority and there is a strict upper limit on the number +of threads allowed. + + + +sched/mlqueue.cxx + + + +This contains the multi-level queue scheduler implementation. +It implements a number of thread priorities and is capable of timeslicing +between threads at the same priority. This scheduler can also support +priority inheritance. + + + +sched/lottery.cxx + + + +This contains a lottery scheduler implementation. This implements +a CPU share scheduler based on threads holding a number of lottery +tickets. At the start of each time quantum, a random number is generated +and the thread holding the matching ticket is scheduled. Compensation +tickets and ticket donation allow fair sharing for I/O +bound threads and an equivalent mechanism to priority + inheritance. + +This scheduler is experimental, and is meant to + test the behavior of other parts of the kernel with a + non-orthodox scheduler. It is not meant to be used for + real applications. It is currently under development and + is incomplete and unusable. + + + + + + +<!-- <index></index> --> Common subdirectory + + +common/thread.cxx + + + +This implements the basic thread classes. The + functions in this file implement the basic thread + controls to sleep and wake threads, change + priorities and delay and time-out. Also defined here + is the idle thread that runs when there is nothing + else to do. + + + +common/clock.cxx + + + +This implements the counter, clock and alarm functions. Also +defined here is the system real-time clock that is used to drive +timeslicing, delays and time-outs. + + + +common/kapi.cxx + + + +This implements a C API to the basic kernel + functions. + + + +common/memcpy.c +common/memset.c + + +Standard ANSI memcpy and memset operations; these are here +because the compiler may invoke them for structure operations regardless +of the presence of a C library. + + + + + +<!-- <index></index> --> Interrupt subdirectory + + +intr/intr.cxx + + + +This implements the Interrupt class. Most of this code is +concerned with posting and calling DSRs. The remainder of the interrupt +handling code is machine specific and is in hal_intr.cxx in +the HAL directory. + + + + + +<!-- <index></index> -->Synchronization subdirectory + + +sync/mutex.cxx + + + +This contains the implementation of mutexes and condition +variables. Mutexes can optionally be configured to use a priority +inheritance mechanism supplied by the scheduler. + + + +sync/cnt_sem.cxx + + + +This contains the implementation of counting + semaphores. + + + +sync/cnt_sem2.cxx + + + +This contains the alternate implementation of counting semaphores +which implements precise µITRON + semantics. + + + +sync/bin_sem.cxx + + + +This contains the implementation of binary + semaphores. + + + +sync/mbox.cxx + + + +This contains wrapper functions for a message box of (void *) +values. The implementation is the template defined in include/mboxt.hxx which include/mboxt.inl implements +in turn. Message boxes exist in the kernel specifically to support µITRON +compatibility. + + + +sync/flag.cxx + + + +This contains the implementation of flag objects. Flag objects +exist in the kernel specifically to support µITRON +compatibility. + + + + + +<!-- <index></index> -->Memory management subdirectory + + +mem/memfixed.cxx + + + +This contains the wrapper functions for a fixed-block allocation +memory manager. The actual implementation is in two parts: include/mfiximpl.hxx implements +the fixed-block memory management algorithms, and template include/mempoolt.hxx implements +thread safety and waiting for memory management classes. These are combined +in memfixed.cxx. Memory pools exist +in the kernel specifically to support µITRON +compatibility. + + + +mem/memvar.cxx + + + +This contains the wrapper functions for a variable-block allocation +memory manager. The actual implementation is in two parts: include/mvarimpl.hxx implements +the variable-block memory management algorithms, and template include/mempoolt.hxx implements +thread safety and waiting for memory management classes. These are combined +in memvar.cxx. Memory pools exist +in the kernel specifically to support µITRON +compatibility. + + + + + +<!-- <index></index> -->Instrumentation subdirectory + + +instrmnt/meminst.cxx + + + +This contains an implementation of the instrumentation mechanism +that stores instrumentation records in a circular buffer in memory. +The size of this buffer is configurable. The instrumentation flags +mechanism allows the generation of instrumentation records to be +controlled on a per-record basis. The header file cyg/kernel/instrmnt.h contains +macros to generate instrumentation records in various places, and +may be configured to only generate instrumentation records where +required. + + + +instrmnt/nullinst.cxx + + + +This contains an implementation of the instrumentation mechanism +that does nothing. By substituting its object file nullinst.o for meminst.o in +a build, the instrumentation mechanism may be disabled without + recompiling. + + + + + +<!-- <index></index> -->Trace subdirectory + + +trace/simple.cxx + + + +This contains an implementation of the trace and assert mechanisms +that output textual messages via a set of externally defined functions. +These are currently supplied by the code in trace/diag.c but +may be supplied by a device driver in the future. + + + +trace/fancy.cxx + + + +This contains a (fancier) implementation of the trace and +assert mechanisms that output textual messages via a set of externally +defined functions. These are currently supplied by the code in trace/diag.c but +may be supplied by a device driver in the future. +This more elaborate view was introduced mainly to validate +the trace and assertion macros during development. + + + +trace/null.cxx + + + +This contains an implementation of the trace and assert mechanisms +that do nothing. By substituting its object file null.o for simple.o in +a build, the trace mechanisms may be disabled without + recompiling. + + + +trace/diag.c + + + +This contains a number of diagnostic routines that use the +HAL supplied diagnostic output mechanism to format and print strings +and numbers. There is currently no formatted output. + + + +trace/tcdiag.c + + + +This contains an implementation of the testing internal API +which uses the kernel's diagnostic routines to perform +output. + + + + + +<!-- <index></index> -->Sload subdirectory +This contains the sources of a simple S-Record loader that +may be used in a ROM for various microprocessor development boards +to download code via a serial port. + + +<!-- <index></index> -->HAL source files +The HAL is divided into architecture- and platform-specific +files. For each architecture supported, there is an arch directory, +containing files generic to that architecture, and a platform directory, +containing files specific to each platform supported. +Amongst the architectures supported are: the PowerPC, the +Tx39 and the MN10300. To find the code corresponding to each architecture, +substitute “powerpc”, “mips” and “mn10300”, +respectively, for “ARCH” in the following file +descriptions. Similarly substitute the appropriate platform name +representing your development board for “PLATFORM”. + + +<!-- <index></index> -->Architecture files + + +ARCH/arch/&versiondir;/include/basetype.h + + +This file is used to define the base architecture configuration +such as endianness and word size. + + + +ARCH/arch/&versiondir;/include/hal_arch.h + + +This file contains macros that implement various architecture-specific +functions. The most important macros here are the thread context +initialization and switch macros that are used to implement + multithreading. + + + +ARCH/arch/&versiondir;/include/hal_intr.h + + + +This file contains the HAL support for interrupt management +and clock support. + + + +ARCH/arch/&versiondir;/include/hal_io.h + + + +This file contains the HAL support for accessing hardware +registers. It provides a portable API that allows more generic device +drivers to be written. + + + +ARCH/arch/&versiondir;/include/hal_cache.h + + + +This file contains macros to control any caches that may be +present. + + + +ARCH/arch/&versiondir;/include/ARCH_stub.h + + + +This file contains architectural information for a GDB stub, +such as the register layout in a GDB packet. + + + +ARCH/arch/&versiondir;/src/vectors.S + + + +This is an assembly code file that contains the code to handle +interrupt and exception vectors. Since system reset can also be +considered an exception, this is handled here also. Interrupts are +currently handled by placing a stub routine in the hardware vector +which calls a Vector Service Routine via an indirection table. There +is a API to allow user-defined VSRs to be installed. The default +VSR reads the interrupt controller registers and decodes the interrupt +source into an offset into a further table of interrupt service +routines. It also handles interrupt cleanup, which may result in +the execution of deferred service routines (DSRs) and the preemption of +the current thread. + + + +ARCH/arch/&versiondir;/src/context.S + + + +If present, this is an assembly code file that contains the +code to support thread contexts. The routines to switch between +various contexts, as well as initialize a thread context may be +present in this file. + + + +ARCH/arch/&versiondir;/src/hal_misc.c + + + +This file contains the implementation of various miscellaneous +HAL routines that are needed by the kernel or C++ + runtime. + + + +ARCH/arch/&versiondir;/src/ARCH_stub.c + + + +This file contains the architectural part of a GDB stub. This +deals with CPU-specific details of the stub, such as the setting +of breakpoints and translating exception data into signals that +GDB understands. + + + +ARCH/arch/&versiondir;/src/ARCH.ld + + + +This file is the linker script. During preprocessing it includes +linker script fragments that define the memory + layout. + + + + + +<!-- <index></index> -->Platform files + + +ARCH/PLATFORM/&versiondir;/include/hal_diag.h + + + +This file contains the definitions of macros that support +the HAL diagnostic output mechanism. + + + +ARCH/PLATFORM/&versiondir;/include/plf_stub.h + + + +This file contains a set of macros that allow the common GDB +stub code to access the platform-specific minimal serial driver +functions. + + + +ARCH/PLATFORM/&versiondir;/src/hal_diag.c + + + +This file contain the implementation of the HAL diagnostic +output mechanism. + + + +ARCH/PLATFORM/&versiondir;/src/plf_stub.c + + + +This file contains a minimal serial driver for the target +platform that is used by the GDB stub. + + + +ARCH/PLATFORM/&versiondir;/src/PLATFORM.S + + + +This is an assembler file that contains any platform-specific +code. It often contains platform initialization code called from +vectors.S. + + + + + + + +Requirements for programs +eCos programs do not have +to satisfy any unusual requirements, but there are always some differences +between a program written for a real-time operating system as opposed +to one written for a time sharing, virtual memory system like UNIX +or Windows NT. +This chapter contains checklist of things to remember when +writing eCos programs. + +<!-- <index></index> -->cyg_user_start() +The entry point for eCos user programs +is usually cyg_user_start() instead +of main(), although main() can be +used if the ISO C library package is selected. Complete detail on +the start-up sequence is given in . + + +Necessary headers +Any program which uses eCos system calls +must have the following line at the top of the file: +#include <cyg/kernel/kapi.h> +and the programmer must make sure that cyg/kernel/kapi.h is +available in the compiler include path. This can be done by setting +the C_INCLUDE_PATH environment +variable or by including the -I flag on the compiler +command line. + + +Necessary link instructions +The eCos configuration and building process +(described in Getting Started with eCos and eCos User's +Guide) builds a single library, libtarget.a, +which contains the selected eCos components. +The libtarget.a library does not contain +any user libraries: If you put some of your source in libraries, +you will have to explicitly include those libraries in the linking instruction. +You also need to link to the GNU C Compiler runtime +support library (libgcc.a). +You should not link to the standard C++ library. +This can be achieved with the -nostdlib option. +You should only link to libtarget.a and libgcc.a using +the linker script target.ld provided +with eCos. The command line for linking should +look like + +gcc [options] [object files] -Ttarget.ld -nostdlib + + + +<!-- <xref> -->Interrupt and exception handlers +In eCos a distinction is made between + exceptions and + interrupts. + + +exceptions + + +are the result of some action by the currently executing code. +Examples of exceptions are divide by zero, illegal instruction, +bad memory access, etc. + + + +interrupts + + +are the result of a signal source which is conceptually asynchronous +with the currently executing code. Examples of interrupts sources +are the real-time clock, external and on chip peripherals and so +forth. + + + +This distinction is made in the eCos hardware +abstraction layer (HAL) to provide a cleaner and more portable mechanism +for installing interrupt handlers and exception handlers. Individual hardware +platforms can have different ways of naming and handling interrupts, which +is why this abstraction layer was chosen. +Interrupts and exceptions are both associated with vectors, +which are labeled by vector numbers ( and ). +There are distinct spaces for exception and interrupt vectors. +These are called “exception vector numbers” and “interrupt +vector numbers”. System calls which install exception handlers +use the exception vector number, and the system calls which install +interrupt handlers use the interrupt vector number to specify which interrupt +or exception should be handled by the handler. +The details of the vector layout depend on the microprocessor +and interrupt controller, and are documented in the relevant API +sections. +Interrupt handlers are actually a pair of +functions, one of which (the interrupt service routine, +or ISR) is executed immediately and runs with that interrupt disabled. +Since interrupts are disabled for the duration of the ISR, the ISR +should be very brief and should not use any system services. +After the ISR exits, but before the kernel scheduler is invoked +again, a delayed service routine (DSR) will +be invoked. It executes with scheduling disabled, but with interrupts +enabled, so that further invocations of the same DSR can be queued. +The DSR can use some producer-side system calls, but it should be carefully +crafted to avoid using any call that might put its thread to sleep. +One of the few examples of safe calls is cyg_semaphore_post(); +the non-blocking versions of some system calls are also safe. A +call that is unsafe is cyg_mutex_lock(), +since it will block if the mutex is already locked by another thread. +Finally, eCos has a formalism for installing low +level handlers which bypass the kernel mechanisms described +above. A program can install a vector service routine (VSR) +which will be invoked instead of the kernel's usual exception +or interrupt handling. The VSR will typically be written in assembly language. +VSRs are associated with vector numbers in the exception space, +just like exception handlers (although there are some variations — architectures +in which there are no exceptions in the eCos sense). +The main difference between VSRs and exception handlers is that +VSRs bypass the kernel's usual mechanisms. + + +<!-- <index></index> -->Memory allocation +Most eCos system calls expect you to +pass the address of pre-allocated memory for the objects created +in that system call. This is frequently the preferred way of doing things +for embedded applications, where programmers want to allocate all +memory statically and have fine control over that resource. +In contrast, some eCos system calls also +allow a NULL pointer to be passed. In such a case the kernel will allocate +the memory or select default size. This feature is not supported +in the current release, and a warning flag is placed in the documentation +for those routines (like + cyg_thread_create()). +eCos provides dynamic memory allocation, +based on memory pools, a useful and flexible +approach to memory management inspired by the µITRON +compatibility layer. These are described in . +If you configure your system to use the Standard C Library +you can also use the standard malloc() library +call. + + +Assertions and bad parameter handling +This section describes how the eCos kernel +and basic packages behave when system calls are invoked with bad parameters. +In eCos, the basic kernel assertion behavior +is configuration-dependent. +By default, assertions are turned off in the +kernel. If the kernel is configured to turn them on, the +kernel will make basic assertions, such as checking for invalid +parameters when system calls are invoked. If an assertion fails, +the kernel will print a message to the diagnostic output channel +and stop executing. +If the kernel is configured with assertions disabled (usually +when the application has been thoroughly debugged), it will not +do any checking. +The configuration sections referenced above also describe +the use of preconditions, postconditions and loop invariants. These +are no different from ordinary assertions, but they are used in +specialized circumstances, and the programmer would wish to select +their presence individually. + + + +<!-- <xref> -->System start-up +We describe here the steps performed by + eCos upon start-up, mentioning how a + programmer can introduce custom start-up routines. + +System start-up — the HAL +The HAL (Hardware Abstraction Layer, see ) +is the eCos package which contains all start-up +code. Its start-up procedure is outlined in detail in , but the main steps +can be summarized here: + + + The HAL initializes the hardware, coordinates with + the ROM monitor, and performs diagnostics. + + +The HAL invokes all static and global + C++ constructors. + + +The HAL jumps to + cyg_start(), + which has the following prototype: +void cyg_start( void ) + + + + +System start-up — cyg_start() +cyg_start() + is the core +of the start-up mechanism. The default definition +is in infra/current/src/startup.cxx +It calls, in turn, +cyg_prestart() +cyg_package_start() +cyg_user_start() +and then starts the eCos scheduler if +the system has been configured to have a kernel and scheduler. +You can override the default cyg_start() routine +by providing your own function by the same name with the following prototype: +void cyg_start( void ) + +Overriding cyg_start() + should rarely, if ever, be done. The functions + cyg_prestart() and + cyg_user_start() + described just below allow enough flexibility for + installing user initialization code safely for almost all + applications. + + + If you are supplying your own definition of this function + from a C++ file, make sure it has + “C” linkage. + + + + +System startup — cyg_prestart() +The default cyg_prestart() function does + not do anything; it is meant to be overwritten if the + programmer needs to do any initialization + before other system level + initialization. +You can override the default + cyg_prestart() routine by + providing your own function by the same name with the + following prototype: +void cyg_prestart( void ) + + If you are supplying your own definition of this function + from a C++ file, make sure it has + “C” linkage. + + + +System startup — cyg_package_start() +The + cyg_package_start() + allows individual packages to do their initialization before + the main user program is invoked. +Two of the packages shipped with this release of eCos have +code in the default cyg_package_start(); +the µITRON and the ISO standard C +library compatibility packages ( and + ). +The infrastructure package has configuration options CYGSEM_START_UITRON_COMPATIBILITY +and CYGSEM_START_ISO_C_COMPATIBILITY +which control specialized initialization. +You can override the default cyg_package_start() routine +by providing your own function by the same name with the following prototype: +void cyg_package_start( void ) +but you should be careful to initialize the default packages +(if you are using them). An example user-supplied function might +look like: + void cyg_package_start(void) + { + #ifdef CYGSEM_START_UITRON_COMPATABILITY + cyg_uitron_start(); /* keep the µITRON initialization */ + #endif + my_package_start(); /* make sure I initialize my package */ + } + +If you are supplying your own definition of this function +from a C++ file, make sure it has “C” linkage. + + + +System startup — cyg_user_start() +This is the normal entry point for your code. Although a + default empty version is provided by + eCos, this is a good place to set up + your threads (). +If you are not including the ISO standard C library + package then there will not be a + main() function, so it becomes + mandatory to provide this function (). +To set up your own cyg_user_start() +function, create a function by that name with the following prototype: +void cyg_user_start( void ) +When you return control from + cyg_user_start(), + cyg_start() will +then invoke the scheduler, and any threads you created and resumed +in cyg_user_start() will +be executed. The preferred approach is to allow the scheduler to +be started automatically, rather than to start it explicitly in cyg_user_start(). + +Remember that +cyg_user_start() + is invoked before the scheduler (and frequently the scheduler is +invoked as the last step in +cyg_user_start()), so it should not use any + kernel services that require the scheduler. + + + If you are supplying your own definition of this function + from a C++ file, make sure it has + “C” linkage. + + + + +Native kernel C language API +The eCos kernel, like many other + real-time kernels, is a library to which the programmer links + an application. System calls resemble library API calls, and + there is no trap mechanism to switch from user to system mode. + +We present here the eCos kernel +API and the APIs for other kernels provided as compatibility layers +on top of eCos. +Since this API sits on top of a configurable system, the semantics +are only weakly defined. The exact semantics and even the API itself +depend on the configuration. For example if returned error codes +were supported this would change the prototype of the functions. +The semantics given in this chapter describe the default configuration. +As mentioned above, all source files which use the kernel +C API should have the following #include statement: +#include <cyg/kernel/kapi.h> +at the head of the file. + +Types used in programming eCos +We now describe the types defined for use with eCos. +These are available to programs that include kapi.h. + +Most of these types are meant to be opaque — in +other words, programmers do not need to know (and probably should +not know) how they are defined. But the types that are numeric are +marked, since it can be useful to use comparison operators. +The definitions for these types can be found in the installed +tree, in the file include/cyg/kernel/kapi.h. +The eCos kernel uses the following naming +convention for types: + + +Types that can be treated as completely opaque usually +have _t suffix. + + +Types for which it is necessary to know the implementation +do not have a _t suffix. + + + +<!-- <index></index> -->cyg_addrword_t +A type which is large enough to store the larger of an address +and a machine word. This is used for convenience when a function +is passed data which could be either a pointer to a block of data +or a single word. + + +<!-- <index></index> -->cyg_handle_t +A handle is a variable used to refer +to eCos system objects (such as a thread or +an alarm). Most eCos system calls that create +system objects will return a handle that is used to access that +object from then on. + + +<!-- <index></index> -->cyg_priority_t +A numeric type used to represent the priority of a thread, +or the priority of an interrupt level. A lower number means a higher +(i.e. more important) priority thread. + + +<!-- <index></index> -->cyg_code_t +A numeric type used for various error or status codes, such +as exception numbers. + + +<!-- <index></index> -->cyg_vector_t +A numeric type used to identify an interrupt vector. Its value +is called the interrupt vector id. This type +is used for both ISR vector ids and VSR vector ids. + + +<!-- <index></index> -->cyg_tick_count_t +A numeric type used to count counter ticks. The resolution +and other details regarding tick quantities depend on the configuration, +but this is a 64 bit type, and no matter what configuration is chosen +it should still last for centuries before it overflows. + + +<!-- <index></index> -->cyg_bool_t +A boolean type whose values can be false (0) or true (1). + + +<!-- <index></index> -->cyg_thread_entry_t +A function type for functions that are entry points for threads. +It is used in the thread creation call cyg_thread_create(). +To help write thread entry point functions, here is how cyg_thread_entry_t +is defined: +typedef void cyg_thread_entry_t(void *); +Examples of thread functions can be found in the programming +tutorial in Getting Started with eCos. + + +<!-- <index></index> -->cyg_exception_handler_t +A function type used for installing exception handlers. It +is defined as: +typedef void cyg_exception_handler_t( + cyg_addrword_t data, + cyg_code_t exception_number, + cyg_addrword_t info +); + + +<!-- <index></index> -->cyg_thread, <!-- <index></index> --> +cyg_interrupt, <!-- <index></index> --> +cyg_counter, <!-- <index></index> --> +cyg_clock, <!-- <index></index> --> +cyg_alarm, <!-- <index></index> --> +cyg_mbox, <!-- <index></index> --> +cyg_mempool_var, and <!-- <index></index> --> +cyg_mempool_fix +These types are of the appropriate size to contain the memory +used by the respective kernel objects. These types are only used +in the corresponding create call where the programmer allocates +the memory for the object and passes the address to the kernel. +After creation the provided handle is used to reference the object. + + +<!-- <index></index> -->cyg_mempool_info +Contains information about a memory pool. +typedef struct { + cyg_int32 totalmem; + cyg_int32 freemem; + void *base; + cyg_int32 size; + cyg_int32 blocksize; + cyg_int32 maxfree; // The largest free block +} cyg_mempool_info; + + +<!-- <index></index> -->cyg_sem_t, <!-- <index></index> --> +cyg_mutex_t, and <!-- <index></index> --> +cyg_cond_t +These types are of the appropriate size to contain the memory +used by their respective kernel objects. These objects are always +referred to by a pointer to an object of this type. + + +<!-- <index></index> -->cyg_VSR_t, <!-- <index></index> --> +cyg_ISR_t, and <!-- <index></index> --> +cyg_DSR_t +These are function types used when vector, interrupt and delayed +service routines are installed. +typedef void cyg_VSR_t(); +typedef cyg_uint32 cyg_ISR_t(cyg_vector_t vector, + cyg_addrword_t data); +typedef void cyg_DSR_t(cyg_uint32 vector, + cyg_ucount32 count, + cyg_addrword_t data); + + +<!-- <index></index> --><!-- <xref> -->cyg_resolution_t +Stores the resolution of a clock. The resolution is defined +to be (dividend/divisor) nanoseconds per tick. + + typedef struct { cyg_uint32 dividend; cyg_uint32 divisor; } + cyg_resolution_t; + + +<!-- <index></index> -->cyg_alarm_t +The function type used for alarm handlers. + +typedef void cyg_alarm_t(cyg_handle_t alarm, + cyg_addrword_t data); + + + +<!-- <index></index> --><!-- <xref> -->Thread operations +void cyg_scheduler_start( void ) +Starts the scheduler with the threads that have been created. +It never returns. The scheduler has been chosen at configuration +time. eCos currently ships with three schedulers: +a bitmap scheduler, a multi-level scheduler (selected by default), +and an experimental “lottery” scheduler which +is currently incomplete and unusable. +The configuration tool can be used to select between schedulers. +The configuration options are +CYGSEM_SCHED_BITMAP, CYGSEM_SCHED_MLQUEUE + and CYGSEM_SCHED_LOTTERY. + + Interrupts are not enabled until the scheduler has been + started with + cyg_scheduler_start(). + +void cyg_scheduler_lock( void ) +Locks the scheduler so that a context switch cannot occur. +This can be used to protect data shared between a thread and a DSR, +or between multiple threads, by surrounding the critical region +with cyg_scheduler_lock() and cyg_scheduler_unlock(). +void cyg_scheduler_unlock( void ) +Unlocks the scheduler so that context switching can + occur again. + +void cyg_thread_create( + cyg_addrword_t sched_info, + cyg_thread_entry_t *entry, + cyg_addrword_t entry_data, + char *name, + void *stack_base, + cyg_ucount32 stack_size, + cyg_handle_t *handle, + cyg_thread *thread ) +Creates a thread in a suspended state. The thread will not +run until it has been resumed with cyg_thread_resume() and +the scheduler has been started with cyg_scheduler_start(). +Here is a description of the parameters of + cyg_thread_create(): + + +sched_info + + +Information to be passed to the scheduler. For almost all +schedulers this is a simple priority value, and you can simply pass +a non-negative integer when you create the thread. Even when this +holds, some schedulers may have restrictions on how priorities can +be used. For example, the bitmap scheduler can onlyhave one thread at +each priority, so if an already-occupied priority slot is quoted, +the next free slot of lower priority is chosen. + + + +entry + + +A user-supplied function: it is a routine that begins execution +of the new thread. This function takes a single argument of type +cyg_addrword_t, which is usually a pointer to +a block of data, which allows cyg_scheduler_start() to +pass data to this particular thread. +Here is a typedef for the entry function: +typedef void cyg_thread_entry_t(cyg_addrword_t); + + + +entry_data + + +A data value passed to the entry function. This may be either +a machine word datum or the address of a block of + data. + + + +name + + +A C string with the name of this thread. + + + +stack_base + + +The address of the stack base. If this value is NULL then + cyg_thread_create() will choose a stack + base. + +Passing a stack base of NULL is not supported in + this release. You must pass a real address for the + stack base. + + + + +stack_size + + +The size of the stack for this thread. If this is 0, the default +stack size will be used for this thread. + +Passing a stack size of 0 is not supported in this release. + You must pass a real stack size. + + + + +handle + + +cyg_thread_create() returns +the thread handle in this location. + + + +thread + + +The thread housekeeping information is placed in the memory +pointed to by this parameter. If this pointer is NULL then the memory +will be allocated. + + + + +Passing a NULL value for the thread data structure + address is not supported in this release. You must pass a + valid address. + +void cyg_thread_exit( void ) +Exits the current thread. At present this simply puts the +thread into suspended state. +void cyg_thread_suspend ( cyg_handle_t thread ) +Suspends the thread. A thread may be suspended multiple times, +in which case it will need to be resumed the same number of times +before it will run. A thread can suspend itself; the effect will +be that the call does not return until some other thread has resumed +it. Obviously this can only be done once! +It is OK for a thread to suspend other threads with the scheduler +locked; it will continue to run until the scheduler is unlocked. + However, a thread suspending itself with the scheduler locked is +in danger of causing problems within the system because a suspended +thread has been removed from its run-queue, even if it continues +to execute! The problematic situation cannot be detected because +it is OK for a DSR (ie. alarm function for example) to suspend +a thread - possibly the current thread if that is what happened +to be running, and DSRs run with the scheduler locked. +If you see an assert referring to something like "Queue map +bit not set for pri" it is likely that this means a thread has suspended +itself with the scheduler locked. The simplest workaround is: never +let a thread suspend itself; look for that behaviour in your code. + +void cyg_thread_resume ( cyg_handle_t thread ) + +Resumes thread. If a thread has been suspended multiple times +it will need to be resumed the same number of times before it will +run. Threads are created in a suspended state and must be resumed +before they will run. +void cyg_thread_yield ( void ) +Yields control to the next runnable thread of equal + priority. If no such thread exists, then this function has + no effect. +void cyg_thread_kill ( cyg_handle_t thread ) +Kills thread. +cyg_bool_t cyg_thread_delete( cyg_handle_t thread) +Kills thread and deletes it from the +scheduler. If necessary, it will kill thread + first using cyg_thread_kill( thread ). +If thread does not terminate in response to +the kill message, this function returns false, indicating failure. +This function differs from cyg_thread_kill() (or +calling cyg_thread_exit() +for the current thread) by deregistering the thread from the +scheduler. As a result, the thread handle, thread stack and space +passed for the thread housekeeping information can then be reused. +This is not the case if just cyg_thread_kill() or cyg_thread_exit() is +invoked for the thread. + +cyg_thread_delete() + only deregisters the thread from the scheduler, it does not free +up any resources that had been allocated by the thread such as dynamic +memory, nor does it unlock any synchronization objects owned by +the thread. This is the responsibility of the programmer. Additionally, +unlike +cyg_thread_kill(), the +cyg_thread_delete() + function cannot be self-referencing. + + +// Delete another thread. This must be done in a loop, waiting +// for the call to return true. If it returns false, go to sleep +// for a while, so that the killed thread gets a chance to run +// and complete its business. +while (!cyg_thread_delete(<thread_handle>) { + cyg_thread_delay(1); + + cyg_handle_t cyg_thread_self( void ) +Returns the handle of the current thread. +void cyg_thread_release ( cyg_handle_t thread ) +Break the thread out of any wait it is currently in. + Exactly how the thread returns from the wait operation, and + how, if at all, the break is indicated, depends on the + synchronization object it was waiting on. +cyg_ucount32 cyg_thread_new_data_index ( void ) +Allocates a new per-thread data index from those still + available. If no more indexes are available, and assertions + are enabled, an assertion will be raised. +void cyg_thread_free_data_index ( cyg_ucount32 index ) +Return the per-thread data index to the pool. +CYG_ADDRWORD cyg_thread_get_data( cyg_ucount32 index ) +Retrieve the per-thread data at the given index for the current +thread. +CYG_ADDRWORD *cyg_thread_get_data_ptr( cyg_ucount32 index ) +Return a pointer to the per-thread data at the given index +for the current thread. This should be used with some care since +in some future implementation the per-thread data may be managed +by a dynamic mechanism that might invalidate this pointer at any +time. This pointer should only be considered valid until the next call +to the per-thread data functions. +void cyg_thread_set_data( cyg_ucount32 index, CYG_ADDRWORD data ) +Store the data in the per-thread data for the current thread +at the given index. + + +<!-- <index></index> -->Priority manipulation +void cyg_thread_set_priority( cyg_handle_t thread, cyg_priority_t priority ) +Sets the priority of the given thread to the given value. +The smaller the value, the higher the priority of the thread. +Allowed priorities range between 1 and 64. The values of these +parameters are configuration-dependent because they depend on which +scheduler has been selected, and what value has been configured +for the CYGNUM_KERNEL_SCHED_PRIORITIES +configuration parameter (). +There is always an idle thread, owned by the kernel, running +at CYG_THREAD_MIN_PRIORITY. Because of +this, ordinary threads should never be run at the lowest priority. +cyg_priority_t cyg_thread_get_priority( cyg_handle_t thread ) +Returns the priority of the given thread. +void cyg_thread_delay( cyg_tick_count_t delay ) +Puts the current thread to sleep for delay ticks. In a default +configuration there are approximately 100 ticks a second. The actual +length of the ticks is given by the resolution of the real-time +clock. for more +information on counter resolution. + + +<!-- <index></index> --><!-- <xref> -->Exception handling +Exception handlers can be installed to deal with various system-level +exceptions, such as alignment errors, resets, timers and so forth. +Exception handling is a configurable feature of eCos and +is enabled by default. +The range of values for the exception_number parameter +in the functions below is hardware-dependent, as are the individual +exceptions. See hal/ARCH/arch/&versiondir;/include/hal_intr for +the exception vector definitions specific to a given architecture. +The exception handler is a function of the following type: +typedef void cyg_exception_handler_t( + cyg_addrword_t data, + cyg_code_t exception_number, + cyg_addrword_t info +); +cyg_exception_handler_t is the +type used for functions which are called as a result of an exception. +It is used in the function cyg_exception_set_handler(). +void cyg_exception_set_handler( + cyg_code_t exception_number, + cyg_exception_handler_t *new_handler, + cyg_addrword_t new_data, cyg_exception_handler_t **old_handler, + void **old_data +) +Replace current exception handler. This may apply to either +the thread, or to a global exception handler, according to how exception +handling was configured (global or per-thread). The exception may +be ignored, or used to specify a particular handler. +void cyg_exception_call_handler ( + cyg_handle_t thread, + cyg_code_t exception_number, + cyg_addrword_t exception_info +) +Invoke exception handler for the given exception number. The +exception handler will be invoked with exception_info as +its third argument. + + +<!-- <index></index> --><!-- <xref> -->Interrupt handling +Interrupt handling is by nature machine-specific. The eCos kernel +aims to provide efficiency and flexibility in this area, while maintaining +a very low interrupt latency. To allow the programmer direct access +to hardware, the semantics and the interface can vary from one architecture +to another. +The interrupt vectors for a given architecture are defined +in hal/ARCH/arch/&versiondir;/include/hal_intr.h where +also special semantics and caveats of the interrupt capabilities +would be described. +typedef void cyg_VSR_t(); +typedef cyg_uint32 cyg_ISR_t(cyg_vector_t vector, + cyg_addrword_t data); +typedef void cyg_DSR_t(cyg_vector_t vector, + cyg_ucount32 count, + cyg_addrword_t data); + +enum cyg_ISR_results +{ + CYG_ISR_HANDLED = 1, /* Interrupt was handled */ + CYG_ISR_CALL_DSR = 2 /* Schedule DSR */ +}; +void cyg_interrupt_create( + cyg_vector_t vector, + cyg_priority_t priority, + cyg_addrword_t data, + cyg_ISR_t *isr, + cyg_DSR_t *dsr, + cyg_handle_t *handle, + cyg_interrupt *intr +) +Creates an interrupt object and returns a handle to it. The +object contains information about which interrupt vector to use +and the ISR and DSR that will be called after the interrupt object +is attached. The interrupt object will be allocated in the memory +passed in the intr parameter. The interrupt object is not immediately attached; +it must be attached with the cyg_interrupt_attach() call. +void cyg_interrupt_delete( + cyg_handle_t interrupt +) +Detaches the interrupt from the vector and frees the corresponding +memory. +void cyg_interrupt_attach( + cyg_handle_t interrupt +) +Attaches interrupt. +void cyg_interrupt_detach( + cyg_handle_t interrupt +) +Detaches interrupt. +void cyg_interrupt_get_vsr( + cyg_vector_t vector, + cyg_VSR_t **vsr +) +Returns a pointer to the VSR currently installed on vector +. +void cyg_interrupt_set_vsr( + cyg_vector_t vector, + cyg_VSR_t *vsr +) +Sets the current VSR on vector. A VSR directly attaches to +the hardware interrupt vector and needs to be written in assembler. +void cyg_interrupt_disable( void ) +Disables all interrupts. +void cyg_interrupt_enable( void ) +Enables all interrupts. +void cyg_interrupt_mask( + cyg_vector_t vector +) +Programs the interrupt controller to stop delivery of interrupts +on vector. On some architectures this will also disable all lower +priority interrupts while on others they remain enabled. +void cyg_interrupt_mask_intunsafe( + cyg_vector_t vector +) +Programs the interrupt controller to stop delivery of interrupts +on vector. On some architectures this will also disable all lower +priority interrupts while on others they remain enabled. +This version differs from cyg_drv_interrupt_unmask in not being interrupt +safe. +void cyg_interrupt_unmask( + cyg_vector_t vector +) +Programs the interrupt controller to allow delivery of interrupts +on the given interrupt vector. +void cyg_interrupt_unmask_intunsafe( + cyg_vector_t vector +) +Programs the interrupt controller to allow delivery of interrupts +on the given interrupt vector. +This version differs from cyg_drv_interrupt_unmask in not being interrupt +safe. +void cyg_interrupt_acknowledge( + cyg_vector_t vector +) +Should be used from inside an ISR to acknowledge receipt of +the interrupt. The interrupt must be acknowledged. If an interrupt +is not acknowledged, the interrupt may trigger immediately after +the ISR returns, causing the ISR to be called again in a loop. +void cyg_interrupt_configure( + cyg_vector_t vector, + cyg_bool_t level, + cyg_bool_t up ) +On some interrupt controllers the way an interrupt is detected +may be configured. The level parameter chooses between level- or +edge-triggered interrupts. The up parameter chooses between high +and low level for level triggered interrupts or rising and falling +edges for edge triggered interrupts. + + +<!-- <xref> -->Counters, clocks and alarms + +<!-- <index></index> -->Counters +The counter objects provided by the kernel provide an abstraction +of the clock facility that is generally provided. Application code +can associate alarms with counters, where an alarm is identified +by the number of ticks until it triggers, the action to be taken +on triggering, and whether or not the alarm should be repeated. +There are two different implementations of the counter objects. +The first stores all alarms in a single linked list. The alternative +implementation uses a table of linked lists, with the size of the +table being a separate configurable option. A single list is more +efficient in terms of memory usage and is generally adequate when +the application only makes use of a small number of alarms. For +more complicated operations it is better to have a table of lists +since this reduces the amount of computation whenever the timer +goes off. Assuming a table size of 8 (the default value) on average +the timer code will only need to check 1/8 of the pending +alarms instead of all of them. +The configuration options which select the counter implementation +are CYGIMP_KERNEL_COUNTERS_MULTI_LIST +(“Option: Implement counters using a table of lists”) +and CYGIMP_KERNEL_COUNTERS_SINGLE_LIST +(“Option: Implement counters using a single list”). +The following functions can be used to create and manipulate +counters: +void cyg_counter_create( + cyg_handle_t *counter, + cyg_counter *the_counter +) +Creates a new counter and places it in the space pointed to +by counter. A counter stores a value that is incremented by cyg_counter_tick(). +Alarms may be attached to counters, and the alarms will trigger +when the counter reaches a specified value. +void cyg_counter_delete( + cyg_handle_t counter +) +Deletes the given counter and frees the corresponding memory. +cyg_tick_count_t cyg_counter_current_value( + cyg_handle_t counter +) +Returns the current value of the given counter. +void cyg_counter_set_value( + cyg_handle_t counter, + cyg_tick_count_t new_value +) +Sets the counter's value to new_value. +void cyg_counter_tick( + cyg_handle_t counter +) +Advances the counter by one tick. +void cyg_counter_multi_tick( + cyg_handle_t counter + cyg_tick_count_t ticks +) +Advances the counter by multiple ticks. + + +Clocks +Clocks are counters which are associated with a stream + of ticks that represent time periods. Clocks have a + resolution associated with them, whereas counters do not. + +The most frequently used clock is the real-time +clock which serves two special purposes. First, it is +necessary to support clock and alarm related functions such as cyg_thread_delay(). +Second, it is needed to implement timeslicing in the mlqueue and +lottery schedulers. If the application does not require either of +these facilities, then it is possible to disable the real-time clock +support completely. It is also possible to disable just timeslicing +with the configuration option CYGSEM_KERNEL_SCHED_TIMESLICE, +or just the clock and alarm functions, using the option CYGFUN_KERNEL_THREADS_TIMER.. +The real-time clock is available if the configuration option CYGVAR_KERNEL_COUNTERS_CLOCK + is defined. +Clock resolution is stored in variables of type cyg_resolution_t +(). +void cyg_clock_create( + cyg_resolution_t resolution, + cyg_handle_t *handle, + cyg_clock *clock ) +Creates a clock object with the given resolution and places +it in the space pointed to by clock. A clock is a counter driven +by a regular source of ticks. For example the system real-time clock +is driven by a clock interrupt. +void cyg_clock_delete( cyg_handle_t clock ) +Deletes a clock object and frees the associated memory. +void cyg_clock_to_counter( +cyg_handle_t clock, + cyg_handle_t *counter +) +Converts a clock handle to a counter handle. The counter functions +can then be used with the counter handle. +void cyg_clock_set_resolution( + cyg_handle_t clock, + cyg_resolution_t resolution +) +Changes the resolution of a given clock object. +cyg_resolution_t cyg_clock_get_resolution( + cyg_handle_t clock ) +Returns the resolution of clock. +cyg_handle cyg_real_time_clock( void ) +Returns a handle to the system-supplied real-time clock. +cyg_tick_count_t cyg_current_time( void ) +Returns the real-time clock's counter. This is equivalent +to executing the code: + cyg_clock_to_counter(cyg_real_time_clock(), &h), + cyg_counter_current_value(h); + + +<!-- <index></index> -->Alarms +typedef void cyg_alarm_t(cyg_handle_t alarm, cyg_addrword_t data); +cyg_alarm_t is the type used for functions +which are used to handle alarm events. It is used in the function cyg_alarm_create(). +void cyg_alarm_create( + cyg_handle_t counter, + cyg_alarm_t *alarm_fn, + cyg_addrword_t data, + cyg_handle_t *handle, + cyg_alarm *alarm ) +Creates an alarm object. The alarm is attached to the counter + and is created in the memory pointed to by alarm +. When the alarm triggers, the handler function +alarmfn is called and is passed data +as a parameter. The alarm handler executes in the context of the +function that incremented the counter and thus triggered the alarm. + +If the alarm is associated with the real-time + clock, the alarm handler alarmfn + will be invoked by the + delayed service routine (DSR) that services the + real-time clock. This means that real-time clock alarm + handlers (which are possibly the most frequently used) + must follow the rules of behavior for DSRs. These rules + are outlined in . + +void cyg_alarm_delete( + cyg_handle_t alarm ) +Disables the alarm, detaches from the counter, invalidates +handles, and frees memory if it was dynamically allocated by cyg_alarm_create(). +void cyg_alarm_initialize( + cyg_handle_t alarm, + cyg_tick_count_t trigger, + cyg_tick_count_t interval +) +Initialize an alarm. This sets it to trigger at the tick with +value trigger. When an alarm triggers, this event is +dealt with by calling the alarmfn parameter which was +passed when the alarm was created using cyg_alarm_create(). +If interval is non-zero, then after the alarm has +triggered it will set itself to trigger again after interval + ticks. Otherwise, if interval is zero, the +alarm will be disabled automatically once it has triggered. +void cyg_alarm_get_times( + cyg_handle_t alarm, + cyg_tick_count_t *trigger, + cyg_tick_count_t *interval +) +Returns the trigger and interval parameters of the alarm. +void cyg_alarm_enable( + cyg_handle_t alarm ) +Enables an alarm that has been disabled by calling cyg_alarm_disable(). +void cyg_alarm_disable( + cyg_handle_t alarm ) +Disables an alarm. After an alarm is disabled it will not +be triggered unless it is subsequently re-enabled by calling cyg_alarm_enable() or +is reinitialized by calling cyg_alarm_initialize(). +Note, though, that if a periodic alarm that has been disabled +is re-enabled without reinitializing it will be in phase with the original sequence +of alarms. If it is reinitialized, the new +sequence of alarms will be in phase with the moment in which cyg_alarm_initialize() was +called. + + + +Synchronization + +Semaphores +The semaphores defined by the type cyg_sem_t +are counting semaphores. These objects are not referred to by handles, +but rather by the pointer to the variable in which the semaphore +is created. +void cyg_semaphore_init( + cyg_sem_t *sem, + cyg_ucount32 val ) +Initializes a semaphore. The initial semaphore count is set +to val. +void cyg_semaphore_destroy( + cyg_sem_t *sem +) +Destroys a semaphore. This must not be done while there are +any threads waiting on it. +void cyg_semaphore_wait( + cyg_sem_t *sem +) +If the semaphore count is zero, the current thread will wait +on the semaphore. If the count is non-zero, it will be decremented +and the thread will continue running. +cyg_bool_t cyg_semaphore_trywait( + cyg_sem_t *sem +) +A non-blocking version of cyg_semaphore_wait(). +This attempts to decrement the semaphore count. If the count is +positive, then the semaphore is decremented and true +is returned. If the count is zero then the semaphore remains unchanged, and +false is returned, but the current thread continues to +run. +cyg_bool_t cyg_semaphore_timed_wait( + cyg_sem_t *sem, + cyg_tick_count_t abstime +) +A time-out version of cyg_semaphore_wait(). +This attempts to decrement the semaphore count. If the count is +positive, then the semaphore is decremented and true is returned. +If the count is zero, it will wait for the semaphore to increment. +If however the abstime time-out is reached first, it will return +false without changing state, and the current thread will continue +to run. +The cyg_tick_count_t parameter +is an absolute time. If a relative time is required, you should +use cyg_current_time with +an offset. For example, to time out 200 ticks from the present you +would use: +cyg_semaphore_timed_wait(&sem, cyg_current_time() + 200); +cyg_semaphore_timed_wait() is +only available if the configuration option CYGFUN_KERNEL_THREADS_TIMER + is set. +void cyg_semaphore_post( + cyg_sem_t *sem +) +If there are threads waiting on this semaphore this will wake +exactly one of them. Otherwise it simply increments the semaphore +count. +void cyg_semaphore_peek( + cyg_sem_t *sem, + cyg_count32 *val ) +Returns the current semaphore count in the variable pointed +to by val. + + +<!-- <xref> -->Mutexes +Mutexes (mutual exclusion locks) are used in +a similar way to semaphores. A mutex only has two states, locked +and unlocked. Mutexes are used to protect accesses to shared data +or resources. When a thread locks a mutex it becomes the owner. +Only the mutex's owner may unlock it. While a mutex remains +locked, the owner should not lock it again, as the behavior is undefined +and probably dangerous. +If non-owners try to lock the mutex, they will be suspended +until the mutex is available again, at which point they will own +the mutex. +void cyg_mutex_init( + cyg_mutex_t *mutex +) +Initializes a mutex. It is initialized in the unlocked state. +void cyg_mutex_destroy( + cyg_mutex_t *mutex +) +Destroys a mutex. A mutex should not be destroyed in the locked +state, as the behavior is undefined. +cyg_bool_t cyg_mutex_lock( + cyg_mutex_t *mutex +) +Changes the nutex from the unlocked state to the locked state. +When this happens the mutex becomes owned by the current thread. +If the mutex is locked, the current thread will wait until the mutex +becomes unlocked before performing this operation. The result of +this function will be TRUE if the mutex has been locked, or FALSE +if it has not. A FALSE result can result if the thread has been +released from its wait by a call to cyg_thread_release() or cyg_mutex_release(). +void cyg_mutex_unlock( + cyg_mutex_t *mutex +) +Changes the mutex from the locked state to the unlocked state. +This function may only be called by the thread which locked the +mutex, and should not be called on an unlocked mutex. +void cyg_mutex_release( + cyg_mutex_t *mutex +) +Release all threads waiting on the mutex pointed to by the +mutex argument. These threads will return from cyg_mutex_lock() +with a FALSE result and will not have claimed the mutex. This function +has no effect on any thread that may have the mutex claimed. +void cyg_mutex_set_protocol( + cyg_mutex_t *mutex, + enum cyg_mutex_protocol protocol) +As described in the Thread Synchronization section, eCos's +mutex can use a number of schemes when dealing with priority inversion. +This function is used to set the protocol for the mutex. protocol + may take one of 3 values: CYG_MUTEX_NONE, CYG_MUTEX_INHERIT, +CYG_MUTEX_CEILING. The first indicates no inversion +protocol will be used. The second uses the SIMPLE inversion protocol, +and the last uses the ceiling protocol. +void cyg_mutex_set_ceiling( + cyg_mutex_t *mutex, + cyg_priority_t priority) +When using the ceiling inversion protocol, this function allows +the ceiling thread priority of an obtained mutex to be set. +cyg_priority_t cyg_thread_get_current_priority( + cyg_handle_t thread) +Returns the current thread priority. If the thread is running +at a higher priority than normal due to priority inversion, this +functions returns the inverted priority, whereas +cyg_thread_get_priority() returns +the normal priority. + + +<!-- <xref> -->Condition Variables +Condition variables are a synchronization mechanism +which (used with a mutex) grants several threads mutually exclusive +access to shared data and to broadcast availability of that data +to all the other threads. +A typical example of the use of condition variables is when +one thread (the producer) is producing data and several other (consumer) +threads are waiting for that data to be ready. The consumers will +wait by invoking cyg_cond_wait(). +The producer will lock access to the data with a mutex, and when +it has generated enough data for the other processes to consume, +it will invoke cyg_cond_broadcast() to +wake up the consumers. The Getting Started with eCos book +has example programs which use condition variables to implement +a simple message passing system between threads. +void cyg_cond_init( + cyg_cond_t *cond, + cyg_mutex_t *mutex +) +Initializes the condition variable. A condition variable is +attached to a specific mutex. +void cyg_cond_destroy( + cyg_cond_t *cond +) +Destroys the condition variable cond. This must not be done +on a condition variable which is in use. After it has been destroyed, +it may be subsequently reinitialized. +void cyg_cond_wait( + cyg_cond_t *cond +) +Causes the current thread to wait on the condition variable, +while simultaneously unlocking the corresponding mutex. cyg_cond_wait() may +be called by a thread which has the corresponding mutex locked. +The thread can only be awakened by a call to cyg_cond_signal() or cyg_cond_broadcast() on +the same condition variable. When the thread is awakened, the mutex +will be reclaimed before this function proceeds. Since it may have +to wait for this, cyg_cond_wait() should +only be used in a loop since the condition may become false in the meantime. +This is shown in the following example: +extern cyg_mutex_t mutex; +extern cyg_cond_t cond; + +cyg_mutex_lock( &mutex ); +... + +while( condition_not_true ) +{ + cyg_cond_wait( &cond ); +} + +... + +cyg_mutex_unlock( &mutex ); + + + cyg_bool_t cyg_cond_timed_wait( + cyg_cond_t *cond, + cyg_tick_count_t abstime +) +A time-out version of cyg_cond_wait() which +waits for a signal or broadcast. If a signal or broadcast is received +it returns true, but if one is not received by +abstime, it returns false. +The cyg_tick_count_t parameter +is an absolute time. If a relative time is required, you should +use cyg_current_time with +an offset. For example, to time out 200 ticks from the present you +would use: +cyg_cond_timed_wait(&sem, cyg_current_time() + 200); +cyg_cond_timed_wait() is +only available if the configuration option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT + is set. +void cyg_cond_signal( + cyg_cond_t *cond +) +Wakes up at least one thread which is waiting on the condition +variable. When a thread is awakened it will become the owner of +the mutex. cyg_cond_signal() may +be called by the thread which currently owns the mutex to which +the condition variable is attached. +void cyg_cond_broadcast( + cyg_cond_t *cond +) +Wakes all the threads waiting on the +condition variable. Each time a thread is awakened it will become +the current owner of the mutex. + + + +<!-- <xref> -->Memory pools +There are two sorts of memory pools. A variable +size memory pool is for allocating blocks of any size. A fixed size +memory pool, has the block size specified when the pool is created +and only provides blocks of that size. +Blocking, non-blocking and “blocking with time-out” versions +of these calls are provided. +void cyg_mempool_var_create( + void *base, + cyg_int32 size, + cyg_handle_t *handle, + cyg_mempool_var *var +) +Creates a variable size memory pool. The parameters are: + + +base + + +base of memory to use for pool + + + +size + + +size of memory pool in bytes + + + +handle + + +returned handle of memory pool + + + +var + + +space to put pool structure in + + + +void cyg_mempool_var_delete( + cyg_handle_t varpool +) +Deletes the variable size memory pool varpool. + +void *cyg_mempool_var_alloc( + cyg_handle_t varpool, + cyg_int32 size ) +Allocates a block of length size. This will +block until the memory becomes available. +void *cyg_mempool_var_timed_alloc( + cyg_handle_t varpool, + cyg_int32 size, + cyg_tick_count_t abstime +) +Allocates a block of length size. If the requested +amount of memory is not available, it will wait until abstime + before giving up and returning NULL. +void *cyg_mempool_var_try_alloc( + cyg_handle_t varpool, + cyg_int32 size ) +Allocates a block of length size. +NULL is returned if not enough is available. +void cyg_mempool_var_free( + cyg_handle_t varpool, + void *p ) +Frees memory back into variable size pool varpool. + +cyg_bool_t cyg_mempool_var_waiting( + cyg_handle_t varpool +) +Returns true if any threads are waiting for memory in +varpool. +typedef struct { + cyg_int32 totalmem; + cyg_int32 freemem; + void *base; + cyg_int32 size; + cyg_int32 blocksize; + cyg_int32 maxfree; // The largest free block +} cyg_mempool_info; + + void cyg_mempool_var_get_info( + cyg_handle_t varpool, + cyg_mempool_info *info +) +Puts information about a variable memory pool into the structure +provided. +void cyg_mempool_fix_create( + void *base, + cyg_int32 size, + cyg_int32 blocksize, + cyg_handle_t *handle, + cyg_mempool_fix *fix +) +Create a fixed size memory pool. This function takes the following +parameters: + + +base + + +base of memory to use for pool + + + +size + + +size of total space requested + + + +blocksize + + +size of individual elements + + + +handle + + +returned handle of memory pool + + + +fix + + +space to put pool structure in + + + +void cyg_mempool_fix_delete( + cyg_handle_t fixpool +) +Deletes the given fixed size memory pool. +void *cyg_mempool_fix_alloc( + cyg_handle_t fixpool +) +Allocates a block. If the memory is not available immediately, +this blocks until the memory becomes available. +void *cyg_mempool_fix_timed_alloc( + cyg_handle_t fixpool, + cyg_tick_count_t abstime +) +Allocates a block. If the memory is not already available, +it will try until abstime before giving up and +returning a NULL. +void *cyg_mempool_fix_try_alloc( + cyg_handle_t fixpool +) +Allocates a block. NULL is returned if no memory is available. +void cyg_mempool_fix_free( + cyg_handle_t fixpool, + void *p ) +Frees memory back into fixed size pool. +cyg_bool_t cyg_mempool_fix_waiting( + cyg_handle_t fixpool +) +Returns true if there are any threads waiting for memory in +the given memory pool. +void cyg_mempool_fix_get_info( + cyg_handle_t fixpool, + cyg_mempool_info *info +) +Puts information about a variable memory pool into the structure +provided. +The fixed size memory pool simply returns blocks of memory +of exactly the blocksize requested. If the pool is being used to +allocate memory for a type that has alignment constraints (such +as 4-byte alignment), then it is up to the user to align the memory +appropriately for the type in question. Alternatively, choose a blocksize +that is an exact multiple of the required alignment. +The memory available from the memory pools will not be the +same size as the memory supplied to it. Some of the memory is used +for internal data structures of the allocator. cyg_mempool_fix_get_info() and cyg_mempool_var_get_info() may +be used to determine the available memory. + + +<!-- <index></index> -->Message boxes +Message boxes are a primitive mechanism for exchanging messages +between threads, inspired by the µITRON +specification. A message box can be created with cyg_mbox_create() before +the scheduler is started, and two threads in a typical producer/consumer relationship +can access it. One thread, the producer, will use cyg_mbox_put() to +make data available to the consumer thread which uses cyg_mbox_get() to +access the data. +The size of the internal message queue is configured by the +“Message box queue size” ( CYGNUM_KERNEL_SYNCH_MBOX_QUEUE_SIZE ) +configuration option. The default value is 10. +Blocking, non-blocking and “blocking with time-out” versions +of these calls are provided. +void cyg_mbox_create( + cyg_handle_t *handle, + cyg_mbox *mbox ) +Creates a message box using the space provided in the mbox +parameter, and returns a handle for future access to that message +box. +void cyg_mbox_delete( + cyg_handle_t mbox ) +Deletes the given message box. +void *cyg_mbox_get( + cyg_handle_t mbox ) +Waits for a message to be available, then retrieves it and +returns the address of the data. +void *cyg_mbox_timed_get( + cyg_handle_t mbox, + cyg_tick_count_t timeout +) +Waits for a message to be available, but times out if timeout +time passes. This version of the function is only available if the +configuration option CYGFUN_KERNEL_THREADS_TIMER +is turned on. +void *cyg_mbox_tryget( + cyg_handle_t mbox ) +Checks to see if a message is ready. If no message is available +it returns immediately with a return value of NULL. +If a message is available it retrieves it and returns the address of the data. + +void *cyg_mbox_peek_item( + cyg_handle_t mbox ) +Checks to see if a message is ready, and if one is available +returns the address of the data without removing +the message from the queue. If no message is available it returns +NULL. +cyg_bool_t cyg_mbox_put( + cyg_handle_t mbox, + void *item ) +Places a message in the given message box. If the queue is +full it will block until the message can be sent. It returns true +if the message was successfully sent, and false +if the message was not sent and its sleep was awakened by the kernel before +the message could be sent. +The cyg_mbox_put() function +is only available if the CYGMTH_MBOXT_PUT_CAN_WAIT configuration +has been selected. +cyg_bool_t cyg_mbox_timed_put( + cyg_handle_t mbox, + void *item, + cyg_tick_count_t abstime +) +A time-out version of cyg_mbox_put(). +This will try to place the message in the given message box. If +the queue is full, it will wait until abstime before +giving up and returning false. +The cyg_mbox_timed_put() function +is only available if the both the CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT +and CYGFUN_KERNEL_THREADS_TIMER configuration +have been selected. +cyg_bool_t cyg_mbox_tryput( + cyg_handle_t mbox, + void *item ) +Tries to place a message in the given message box. It returns +true if the message was successfully sent, and +false if the message +could not be sent immediately, usually because the queue was full. +cyg_count32 cyg_mbox_peek( + cyg_handle_t mbox ) +Takes a peek at the queue and returns the number of messages +waiting in it. +cyg_bool_t cyg_mbox_waiting_to_get( + cyg_handle_t mbox ) +Queries the kernel to see if other processes are waiting to +receive a message in the given message box. Returns true +if other processes are waiting, false otherwise. +cyg_bool_t cyg_mbox_waiting_to_put( + cyg_handle_t mbox ) +Queries the kernel to see if other processes +are waiting to send a message in the given message box. Returns +true if other processes are waiting, false + otherwise. + + +Flags +Flags are a synchronization mechanism which +allow a thread to wait for a single condition or a combination of +conditions. The conditions are represented by bits in a 32 bit word. Flags +are inspired by the µITRON specification. +Flags are of type cyg_flag_t, which are +32 bit words, and routines are provided to set or mask some bits +in the flag value. +A “consumer side” thread can wait for a “producer +side” thread to set the entire collection of bits, or any +subset of them. +When a thread sets some bits in a flag, all threads whose +requirements are now satisfied are woken up; thus flags have broadcast +semantics. A variation on the wait call can specify that the flag +value be cleared when the wait call is satisfied, in which case +the setting of bits would not be a broadcast. +Blocking, non-blocking, and “blocking with time-out” versions +of the wait calls are provided. +void cyg_flag_init( + cyg_flag_t *flag +) +Initializes a flag variable. +void cyg_flag_destroy( + cyg_flag_t *flag +) +Destroys a flag variable. +void cyg_flag_setbits( + cyg_flag_t *flag, + cyg_flag_value_t value +) +Sets the bits in flag which are set in +value. +A side effect of cyg_flag_setbits() is +that the kernel wakes up any waiting threads whose requirements +are now satisfied. + + +flag + + +A pointer to the flag whose bits are being set. The new setting +of flag will be +*flag -> (*flag | value). + + + +value + + +A word whose 1 bits will also be set in + *flag. + + + +void cyg_flag_maskbits( +cyg_flag_t *flag, +cyg_flag_value_t value +) + +Clear the bits in the given flag which are zero +in the value. This cannot result in new threads being +eligible for awakening. + + +flag + + +A pointer to the flag whose bits are being cleared. The new +setting of flag will be +*flag -> (*flag & value). + + + +value + + +A word whose 0 bits will also be cleared in + *flag. + + + +We now describe the cyg_flag_wait(), +which frequently uses the following macros: + #define CYG_FLAG_WAITMODE_AND ((cyg_flag_mode_t)0) + #define CYG_FLAG_WAITMODE_OR ((cyg_flag_mode_t)2) + #define CYG_FLAG_WAITMODE_CLR ((cyg_flag_mode_t)1) + + + cyg_flag_value_t cyg_flag_wait( + cyg_flag_t *flag, + cyg_flag_value_t pattern, + cyg_flag_mode_t mode +) +Wait for all the bits which are one in pattern to +be set in the flag value (if mode +is CYG_FLAG_WAITMODE_AND) +or for any of the bits which are one in pattern to be +set in the flag value (if mode is +CYG_FLAG_WAITMODE_OR). +When cyg_flag_wait() returns, +meaning that the condition is met, the flag value which succeeded +is returned from the call; in other circumstances (such as a bad +value for mode or pattern), zero +is returned to indicate the error. +If the mode is one of those above plus CYG_FLAG_WAITMODE_CLR +, the whole of the flag value is cleared to zero when the condition +is met. +cyg_flag_wait() takes +the following parameters: + + +flag + + +The value of the flag (set by the thread that called cyg_flag_setbits() or cyg_flag_maskbits()) +is placed in here. + + + +pattern + + +The set of bits which, if set, will cause the calling thread +to be woken up. + + + +mode + + +A parameter which modifies the conditions for wake-up. It +can take the following values: + + + +CYG_FLAG_WAITMODE_AND + + +Only wake up if all the bits in mask +are set in the flag. + + + +CYG_FLAG_WAITMODE_OR + + +Wake up if any of the bits in mask + are set in the flag. + + + +CYG_FLAG_WAITMODE_AND + + CYG_FLAG_WAITMODE_CLR +CYG_FLAG_WAITMODE_OR + CYG_FLAG_WAITMODE_CLR + + + Like CYG_FLAG_WAITMODE_AND and +CYG_FLAG_WAITMODE_OR, but the entire +flag is cleared to zero when the condition is met, whereas normally +the value of the flag is unchanged. + + + +Waiting threads are queued depending on the semantics of the +underlying scheduler. In release &version;, this means that, if +the multi-level queue scheduler is selected, queueing is in FIFO +ordering, while the bitmap scheduler supports thread priority ordered +queueing. When some flag value bits become signalled by a call to cyg_flag_setbits(), +the queue is scanned in order, and each waiting thread in turn is +awoken or re-queued depending on its request. When a thread is awoken, +if it made the wait call with CYG_FLAG_WAITMODE_CLR, +the flag value is cleared to zero, and the scan of queued threads +is terminated. +cyg_flag_value_t cyg_flag_timed_wait( + cyg_flag_t *flag, + cyg_flag_value_t pattern, + cyg_flag_mode_t mode, + cyg_tick_count_t abstime +) +A time-out version of cyg_flag_wait(). +This waits for the condition required by pattern +and mode to be met, or until the abstime + time-out is reached, whichever is first. +If the time-out is reached first, zero is returned. This call is +only available if the configuration option CYGFUN_KERNEL_THREADS_TIMER + is enabled. +cyg_flag_value_t cyg_flag_poll( + cyg_flag_t *flag, + cyg_flag_value_t pattern, + cyg_flag_mode_t mode +) +A non-blocking version of cyg_flag_wait(). +If the condition required by pattern and +mode is met, the flag value +is returned, otherwise zero is returned. The flag value may be cleared +in the event of success by specifying CYG_FLAG_WAITMODE_CLR +in the mode, as usual. +cyg_flag_value_t cyg_flag_peek( + cyg_flag_t *flag +) +Returns the current flag value. +cyg_bool_t cyg_flag_waiting( + cyg_flag_t *flag +) +Returns true if there are threads waiting on this flag. + + + +eCos <!-- <index></index> -->Interrupt Model +This chapter describes the eCos + interrupt model in detail. +Interrupt handling is an important part of most real-time + systems. Timely handling of interrupt sources is important. + This can be severely impacted by certain activities that must + be considered atomic (i.e. uninterruptible). Typically these + activities are executed with interrupts disabled. In order to + keep such activities to a minimum and allow for the smallest + possible interrupt latencies, eCos uses a + split interrupt handling scheme. In this scheme, interrupt + handling is separated into two parts. The first part is known + as the Interrupt Service Routine or + ISR. The second part is the Deferred + Service Routine or DSR. This separation explicitly allows for + the DSRs to be run with interrupts enabled, thus allowing + other potentially higher priority interrupts to occur and be + processed while processing a lower priority interrupt. +In order for this model to work, the ISR should run + quickly. If the service requirements for the interrupt are + small, the interrupt can be completely handled by the ISR and + no DSR is required. However, if servicing the interrupt is + more complex, a DSR should be used. The DSR will be run at + some later time, at the point when thread scheduling is + allowed. Postponing the execution of DSRs until this time + allows for simple synchronization methods to be used by the + kernel. +Further, this controlled calling — when thread scheduling +is allowed — means that DSRs can interact with the kernel, +for example by signalling that an asynchronous operation has completed. +In order to allow DSRs to run with interrupts enabled, the +ISR for a particular interrupt source (or the hardware) must arrange +that that interrupt will not recur until the DSR has completed. +In some cases, this is how the hardware works. Once an interrupt +is delivered another interrupt will not occur until re-enabled. +In the general case, however, it is up to the ISR to enforce this +behavior. Typically the ISR will "mask" the interrupt source, thus +preventing its recurrence. The DSR will then unmask the interrupt +when it has been serviced thus allowing new occurrences of the interrupt +to be delivered when they happen. +Alternatively, if an ISR is doing very little per interrupt, +for example transferring one byte from memory to an IO device, it +may only be necessary to interact with the rest of the system when +a "transfer" is complete. In such a case an ISR could execute many +times and only when it reaches the end of a buffer does it need +to request execution of its DSR. +If the interrupt source is "bursty", it may be OK for several +interrupts and calls to the ISR to occur before a requested DSR +has been executed; the kernel maintains counts for posted DSRs, +and in such a case the DSR will eventually be called with a parameter +that tells it how many ISRs requested that the DSR be called. Care +is needed to get the interrupt code right for such a situation, +for one call to the DSR is required to do the work of several. +As mentioned above, the DSR will execute at some later time. +Depending on the state of the system, it may be executed at a much +later time. There are periods during certain kernel operations where +thread scheduling is disabled, and hence DSRs are not allowed to +operate. These periods have been purposefully made as limited as +possible in the eCos kernel, but they still +exist. In addition, user threads have the ability to suspend scheduling +as well, thus affecting the possible DSR execution latency. If a +DSR cannot be executed sufficiently quickly, the interrupt source +may actually overrun. This would be considered a system failure. +One of the problems system designers face is how much stack +space to allow each thread in the system. eCos does +not dictate the size of thread stacks, it is left to the user when +the thread is created. The size of the stack depends on the thread +requirements as well as some fixed overhead required by the system. +In this case, the overhead is enough stack space to hold a complete +thread state (the actual amount depends on the CPU architecture). +Guidelines for the minimum stack requirements are provided by the HAL +using the symbol CYGNUM_HAL_STACK_SIZE_MINIMUM. +A potential problem with this scheme is with nested interrupts. +Since interrupts are reenabled during the DSR portion of servicing +an interrupt, there is the possibility of a new interrupt (hopefully +from a separate source) arriving while this processing takes place. +When this new interrupt is serviced some state information about +the interrupted processing will be saved on the stack. The amount +of this information again depends on the CPU architecture and in +some cases it is substantial. This implies that any given stack +would need enough space to potentially hold "N" interrupt frames. +In a realtime system with many threads this is an untenable situation. +To solve this problem, eCos allows for a separate +interrupt stack to be used while processing interrupts. This stack +needs to be large enough to support "N" nested interrupts, but each +individual thread stack only needs the overhead of a single interrupt +state. This is because the thread state is kept on the thread's +own stack, including information about any interrupt that caused +the thread to be scheduled. This is a much better situation in the +end, however, since only the interrupt stack need be large enough +to handle the potential interrupt servicing needs. +eCos allows for the use of the interrupt +stack to be totally configurable. The user can elect to not use +a separate interrupt stack. This requires making all thread stacks large +enough but does reduce the overhead of switching stacks while processing interrupts. +On the other hand, if memory is tight, then choosing a separate +interrupt stack would be warranted at the cost of a few machine +cycles during the processing of each interrupt. +Not all target HALs support this feature from day one anyway; +however common configuration features such as this may still be +presented in the config tool, and present in include files, even +if the actual target selected does not support the feature at this +time. +The following problem with the interrupt system has been observed. +On the mn10300 simulator, interrupts were occurring immediately +after they were re-enabled in the DSR. This should really be considered +a case of interrupt overrun since there is no possibility of useful [or +any] processing between the time an interrupt has been +serviced and an subsequent interrupt occurs, hence the system is totally +saturated. The problem came about because the stack was overflowing. +It was a user [thread] stack that overflowed because +DSR processing was taking place on the thread stack. Analysis of +this problem led to a rework of how interrupts are processed, in +particular the use of a separate interrupt stack during interrupt +processing (both ISR and DSR parts). The overflow can still happen, +but now it is restricted to only the interrupt stack. The system +designer can make accommodations for this by making a suitably large +interrupt stack if it is known that the "overrun" is finite, e.g. +in the case of a serial device, this could be the depth of some +FIFO. In any case, overrun should be avoided, but having only a +single stack that needs to suffer multiple interrupt frames allows +for this failure to be detected simply. +Of course, it is only worthwhile having a separate interrupt +stack if you are using an eCos configuration +that has a scheduler and multiple threads. If there is no kernel, +then the C library arranges to call main(), +or your application may be entered from cyg_user_start(), +on the startup stack. It runs on the only stack there is in the +system. Depending on the design of the particular HAL for your target +platform, it is natural to re-use the startup stack as the interrupt +stack as soon as the scheduler is running. Since this is only sensible +if there is a kernel, HALs typically only implement the separate interrupt +stack if the kernel is present. + + +<!-- <index></index> -->Real-time Characterization +When building a real-time system, care must be taken to + ensure that the system will be able to perform properly within + the constraints of that system. One of these constraints may + be how fast certain operations can be performed. Another might + be how deterministic the overall behavior of the system is. + Lastly the memory footprint (size) and unit cost may be + important. +One of the major problems encountered while evaluating a + system will be how to compare it with possible alternatives. + Most manufacturers of real-time systems publish performance + numbers, ostensibly so that users can compare the different + offerings. However, what these numbers mean and how they were + gathered is often not clear. The values are typically measured + on a particular piece of hardware, so in order to truly + compare, one must obtain measurements for exactly the same set + of hardware that were gathered in a similar fashion. +Two major items need to be present in any given set of + measurements. First, the raw values for the various + operations; these are typically quite easy to measure and will + be available for most systems. Second, the determinacy of the + numbers; in other words how much the value might change + depending on other factors within the system. This value is + affected by a number of factors: how long interrupts might be + masked, whether or not the function can be interrupted, even + very hardware-specific effects such as cache locality and + pipeline usage. It is very difficult to measure the + determinacy of any given operation, but that determinacy is + fundamentally important to proper overall characterization of + a system. +In the discussion and numbers that follow, three key measurements +are provided. The first measurement is an estimate of the interrupt +latency: this is the length of time from when a hardware interrupt +occurs until its Interrupt Service Routine (ISR) +is called. The second measurement is an estimate of overall interrupt +overhead: this is the length of time average interrupt processing takes, +as measured by the real-time clock interrupt (other interrupt sources +will certainly take a different amount of time, but this data cannot +be easily gathered). The third measurement consists of the timings +for the various kernel primitives. + +Methodology +Key operations in the kernel were measured by using a + simple test program which exercises the various kernel + primitive operations. A hardware timer, normally the one + used to drive the real-time clock, was used for these + measurements. In most cases this timer can be read with + quite high resolution, typically in the range of a few + microseconds. For each measurement, the operation was + repeated a number of times. Time stamps were obtained + directly before and after the operation was performed. The + data gathered for the entire set of operations was then + analyzed, generating average (mean), maximum and minimum + values. The sample variance (a measure of how close most + samples are to the mean) was also calculated. The cost of + obtaining the real-time clock timer values was also + measured, and was subtracted from all other times. +Most kernel functions can be measured separately. +In each case, a reasonable number of iterations are performed. Where +the test case involves a kernel object, for example creating a task, +each iteration is performed on a different object. There is also +a set of tests which measures the interactions between multiple +tasks and certain kernel primitives. Most functions are tested in +such a way as to determine the variations introduced by varying +numbers of objects in the system. For example, the mailbox tests +measure the cost of a 'peek' operation when the +mailbox is empty, has a single item, and has multiple items present. +In this way, any effects of the state of the object or how many +items it contains can be determined. +There are a few things to consider about these measurements. +Firstly, they are quite micro in scale and only measure the operation +in question. These measurements do not adequately describe how the +timings would be perturbed in a real system with multiple interrupting +sources. Secondly, the possible aberration incurred by the real-time +clock (system heartbeat tick) is explicitly avoided. Virtually all +kernel functions have been designed to be interruptible. Thus the times +presented are typical, but best case, since any particular function +may be interrupted by the clock tick processing. This number is +explicitly calculated so that the value may be included in any deadline +calculations required by the end user. Lastly, the reported measurements +were obtained from a system built with all options at their default +values. Kernel instrumentation and asserts are also disabled for +these measurements. Any number of configuration options can change +the measured results, sometimes quite dramatically. For example, +mutexes are using priority inheritance in these measurements. The +numbers will change if the system is built with priority inheritance +on mutex variables turned off. +The final value that is measured is an estimate of interrupt +latency. This particular value is not explicitly calculated in the +test program used, but rather by instrumenting the kernel itself. +The raw number of timer ticks that elapse between the time the timer +generates an interrupt and the start of the timer ISR is kept in +the kernel. These values are printed by the test program after all +other operations have been tested. Thus this should be a reasonable +estimate of the interrupt latency over time. + + +Using these Measurements +These measurements can be used in a number of ways. The + most typical use will be to compare different real-time + kernel offerings on similar hardware, another will be to + estimate the cost of implementing a task using eCos + (applications can be examined to see what effect the kernel + operations will have on the total execution time). Another + use would be to observe how the tuning of the kernel affects + overall operation. + + +Influences on Performance +A number of factors can affect real-time performance in + a system. One of the most common factors, yet most difficult + to characterize, is the effect of device drivers and + interrupts on system timings. Different device drivers will + have differing requirements as to how long interrupts are + suppressed, for example. The eCos system has been designed + with this in mind, by separating the management of + interrupts (ISR handlers) and the processing required by the + interrupt (DSR—Deferred + Service Routine— handlers). However, since there is so + much variability here, and indeed most device drivers will + come from the end users themselves, these effects cannot be + reliably measured. Attempts have been made to measure the + overhead of the single interrupt that eCos relies on, the + real-time clock timer. This should give you a reasonable + idea of the cost of executing interrupt handling for + devices. + + +Measured Items +This section describes the various tests and the numbers presented. All tests use the C + kernel API (available by way of + cyg/kernel/kapi.h). There is a + single main thread in the system that performs the various + tests. Additional threads may be created as part of the + testing, but these are short lived and are destroyed between + tests unless otherwise noted. The terminology “lower + priority” means a priority that is less important, not + necessarily lower in numerical value. A higher priority + thread will run in preference to a lower priority thread + even though the priority value of the higher priority thread + may be numerically less than that of the lower priority + thread. + +Thread Primitives + + +Create thread + +This test measures the + cyg_thread_create() + call. Each call creates a totally new thread. The + set of threads created by this test will be reused + in the subsequent thread primitive tests. + + + +Yield thread + +This test measures the + cyg_thread_yield() + call. For this test, there are no other runnable + threads, thus the test should just measure the + overhead of trying to give up the CPU. + + + +Suspend [suspended] thread + +This test measures the + cyg_thread_suspend() + call. A thread may be suspended multiple times; each + thread is already suspended from its initial + creation, and is suspended again. + + + +Resume thread + +This test measures the + cyg_thread_resume() + call. All of the threads have a suspend count of 2, + thus this call does not make them runnable. This + test just measures the overhead of resuming a + thread. + + + +Set priority + + This test measures the + cyg_thread_set_priority() + call. Each thread, currently suspended, has its + priority set to a new value. + + + +Get priority + +This test measures the + cyg_thread_get_priority() + call. + + + +Kill [suspended] thread + +This test measures the + cyg_thread_kill() + call. Each thread in the set is killed. All threads + are known to be suspended before being killed. + + + + +Yield [no other] thread + +This test measures the + cyg_thread_yield() + call again. This is to demonstrate that the + cyg_thread_yield() + call has a fixed overhead, regardless of whether + there are other threads in the system. + + + +Resume [suspended low priority] thread + +This test measures the + cyg_thread_resume() + call again. In this case, the thread being resumed + is lower priority than the main thread, thus it will + simply become ready to run but not be granted the + CPU. This test measures the cost of making a thread + ready to run. + + + +Resume [runnable low priority] thread + +This test measures the + cyg_thread_resume() + call again. In this case, the thread being resumed + is lower priority than the main thread and has + already been made runnable, so in fact the resume + call has no effect. + + + +Suspend [runnable] thread + +This test measures the + cyg_thread_suspend() + call again. In this case, each thread has already + been made runnable (by previous tests). + + + +Yield [only low priority] thread + +This test measures the + cyg_thread_yield() + call. In this case, there are many other runnable + threads, but they are all lower priority than the + main thread, thus no thread switches will take + place. + + + +Suspend [runnable->not runnable] thread + +This test measures the + cyg_thread_suspend() + call again. The thread being suspended will become + non-runnable by this action. + + + +Kill [runnable] thread + +This test measures the + cyg_thread_kill() + call again. In this case, the thread being killed + is currently runnable, but lower priority than the + main thread. + + + +Resume [high priority] thread + +This test measures the + cyg_thread_resume() + call. The thread being resumed is higher priority + than the main thread, thus a thread switch will take + place on each call. In fact there will be two thread + switches; one to the new higher priority thread and + a second back to the test thread. The test thread + exits immediately. + + + +Thread switch + +This test attempts to measure the cost of + switching from one thread to another. Two equal + priority threads are started and they will each + yield to the other for a number of iterations. A + time stamp is gathered in one thread before the + cyg_thread_yield() + call and after the call in the other thread. + + + + + +Scheduler Primitives + + +Scheduler lock + +This test measures the + cyg_scheduler_lock() + call. + + + +Scheduler unlock [0 threads] + +This test measures the + cyg_scheduler_unlock() + call. There are no other threads in the system and + the unlock happens immediately after a lock so there + will be no pending DSR’s to run. + + + +Scheduler unlock [1 suspended thread] + +This test measures the cyg_scheduler_unlock() call. +There is one other thread in the system which is currently suspended. + + + +Scheduler unlock [many suspended threads] + +This test measures the cyg_scheduler_unlock() call. +There are many other threads in the system which are currently suspended. The +purpose of this test is to determine the cost of having additional +threads in the system when the scheduler is activated by way of + cyg_scheduler_unlock(). + + + +Scheduler unlock [many low priority threads] + +This test measures the cyg_scheduler_unlock() call. +There are many other threads in the system which are runnable but +are lower priority than the main thread. The purpose of this test +is to determine the cost of having additional threads in the system +when the scheduler is activated by way of cyg_scheduler_unlock(). + + + + + +Mutex Primitives + + +Init mutex + +This test measures the cyg_mutex_init() call. +A number of separate mutex variables are created. The purpose of +this test is to measure the cost of creating a new mutex and introducing +it to the system. + + + +Lock [unlocked] mutex + +This test measures the cyg_mutex_lock() call. +The purpose of this test is to measure the cost of locking a mutex +which is currently unlocked. There are no other threads executing +in the system while this test runs. + + + +Unlock [locked] mutex + +This test measures the cyg_mutex_unlock() call. +The purpose of this test is to measure the cost of unlocking a mutex +which is currently locked. There are no other threads executing +in the system while this test runs. + + + +Trylock [unlocked] mutex + +This test measures the cyg_mutex_trylock() call. +The purpose of this test is to measure the cost of locking a mutex +which is currently unlocked. There are no other threads executing +in the system while this test runs. + + + +Trylock [locked] mutex + +This test measures the cyg_mutex_trylock() call. +The purpose of this test is to measure the cost of locking a mutex +which is currently locked. There are no other threads executing +in the system while this test runs. + + + +Destroy mutex + +This test measures the cyg_mutex_destroy() call. +The purpose of this test is to measure the cost of deleting a mutex +from the system. There are no other threads executing in the system +while this test runs. + + + +Unlock/Lock mutex + +This test attempts to measure the cost of unlocking a mutex +for which there is another higher priority thread waiting. When +the mutex is unlocked, the higher priority waiting thread will immediately +take the lock. The time from when the unlock is issued until after +the lock succeeds in the second thread is measured, thus giving +the round-trip or circuit time for this type of synchronizer. + + + + + +Mailbox Primitives + + +Create mbox + +This test measures the cyg_mbox_create() call. +A number of separate mailboxes is created. The purpose of this test +is to measure the cost of creating a new mailbox and introducing +it to the system. + + + +Peek [empty] mbox + +This test measures the cyg_mbox_peek() call. +An attempt is made to peek the value in each mailbox, which is currently empty. +The purpose of this test is to measure the cost of checking a mailbox +for a value without blocking. + + + +Put [first] mbox + +This test measures the cyg_mbox_put() call. +One item is added to a currently empty mailbox. The purpose of this +test is to measure the cost of adding an item to a mailbox. There +are no other threads currently waiting for mailbox items to + arrive. + + + +Peek [1 msg] mbox + +This test measures the cyg_mbox_peek() call. +An attempt is made to peek the value in each mailbox, which contains +a single item. The purpose of this test is to measure the cost of +checking a mailbox which has data to deliver. + + + +Put [second] mbox + +This test measures the cyg_mbox_put() call. +A second item is added to a mailbox. The purpose of this test is +to measure the cost of adding an additional item to a mailbox. There +are no other threads currently waiting for mailbox items to + arrive. + + + +Peek [2 msgs] mbox + +This test measures the cyg_mbox_peek() call. +An attempt is made to peek the value in each mailbox, which contains +two items. The purpose of this test is to measure the cost of checking +a mailbox which has data to deliver. + + + +Get [first] mbox + +This test measures the cyg_mbox_get() call. +The first item is removed from a mailbox that currently contains +two items. The purpose of this test is to measure the cost of obtaining +an item from a mailbox without blocking. + + + +Get [second] mbox + +This test measures the cyg_mbox_get() call. +The last item is removed from a mailbox that currently contains +one item. The purpose of this test is to measure the cost of obtaining +an item from a mailbox without blocking. + + + +Tryput [first] mbox + +This test measures the cyg_mbox_tryput() call. +A single item is added to a currently empty mailbox. The purpose +of this test is to measure the cost of adding an item to a + mailbox. + + + +Peek item [non-empty] mbox + +This test measures the cyg_mbox_peek_item() call. +A single item is fetched from a mailbox that contains a single item. +The purpose of this test is to measure the cost of obtaining an +item without disturbing the mailbox. + + + +Tryget [non-empty] mbox + +This test measures the cyg_mbox_tryget() call. +A single item is removed from a mailbox that contains exactly one +item. The purpose of this test is to measure the cost of obtaining +one item from a non-empty mailbox. + + + +Peek item [empty] mbox + +This test measures the cyg_mbox_peek_item() call. +An attempt is made to fetch an item from a mailbox that is empty. +The purpose of this test is to measure the cost of trying to obtain +an item when the mailbox is empty. + + + +Tryget [empty] mbox + +This test measures the cyg_mbox_tryget() call. +An attempt is made to fetch an item from a mailbox that is empty. +The purpose of this test is to measure the cost of trying to obtain +an item when the mailbox is empty. + + + +Waiting to get mbox + +This test measures the cyg_mbox_waiting_to_get() call. +The purpose of this test is to measure the cost of determining how +many threads are waiting to obtain a message from this + mailbox. + + + +Waiting to put mbox + +This test measures the cyg_mbox_waiting_to_put() call. +The purpose of this test is to measure the cost of determining how +many threads are waiting to put a message into this mailbox. + + + +Delete mbox + +This test measures the cyg_mbox_delete() call. +The purpose of this test is to measure the cost of destroying a +mailbox and removing it from the system. + + + +Put/Get mbox + +In this round-trip test, one thread is sending data to a mailbox +that is being consumed by another thread. The time from when the +data is put into the mailbox until it has been delivered to the +waiting thread is measured. Note that this time will contain a thread +switch. + + + + + +Semaphore Primitives + + +Init semaphore + +This test measures the cyg_semaphore_init() call. +A number of separate semaphore objects are created and introduced +to the system. The purpose of this test is to measure the cost of +creating a new semaphore. + + + +Post [0] semaphore + +This test measures the cyg_semaphore_post() call. +Each semaphore currently has a value of 0 and there are no other +threads in the system. The purpose of this test is to measure the +overhead cost of posting to a semaphore. This cost will differ if +there is a thread waiting for the semaphore. + + + +Wait [1] semaphore + +This test measures the cyg_semaphore_wait() call. +The semaphore has a current value of 1 so the call is non-blocking. +The purpose of the test is to measure the overhead of “taking” a +semaphore. + + + +Trywait [0] semaphore + +This test measures the cyg_semaphore_trywait() call. +The semaphore has a value of 0 when the call is made. The purpose +of this test is to measure the cost of seeing if a semaphore can +be “taken” without blocking. In this case, the +answer would be no. + + + +Trywait [1] semaphore + +This test measures the cyg_semaphore_trywait() call. +The semaphore has a value of 1 when the call is made. The purpose +of this test is to measure the cost of seeing if a semaphore can +be “taken” without blocking. In this case, the +answer would be yes. + + + +Peek semaphore + +This test measures the cyg_semaphore_peek() call. +The purpose of this test is to measure the cost of obtaining the +current semaphore count value. + + + +Destroy semaphore + +This test measures the cyg_semaphore_destroy() call. +The purpose of this test is to measure the cost of deleting a semaphore +from the system. + + + +Post/Wait semaphore + +In this round-trip test, two threads are passing control back +and forth by using a semaphore. The time from when one thread calls cyg_semaphore_post() until +the other thread completes its cyg_semaphore_wait() is +measured. Note that each iteration of this test will involve a thread +switch. + + + + + +Counters + + +Create counter + +This test measures the cyg_counter_create() call. +A number of separate counters are created. The purpose of this test +is to measure the cost of creating a new counter and introducing +it to the system. + + + +Get counter value + +This test measures the cyg_counter_current_value() call. +The current value of each counter is obtained. + + + +Set counter value + +This test measures the cyg_counter_set_value() call. +Each counter is set to a new value. + + + +Tick counter + +This test measures the cyg_counter_tick() call. +Each counter is “ticked” once. + + + +Delete counter + +This test measures the cyg_counter_delete() call. +Each counter is deleted from the system. The purpose of this test +is to measure the cost of deleting a counter object. + + + + + +Alarms + + +Create alarm + +This test measures the cyg_alarm_create() call. +A number of separate alarms are created, all attached to the same +counter object. The purpose of this test is to measure the cost +of creating a new counter and introducing it to the system. + + + +Initialize alarm + +This test measures the cyg_alarm_initialize() call. +Each alarm is initialized to a small value. + + + +Disable alarm + +This test measures the cyg_alarm_disable() call. +Each alarm is explicitly disabled. + + + +Enable alarm + +This test measures the cyg_alarm_enable() call. +Each alarm is explicitly enabled. + + + +Delete alarm + +This test measures the cyg_alarm_delete() call. +Each alarm is destroyed. The purpose of this test is to measure +the cost of deleting an alarm and removing it from the system. + + + +Tick counter [1 alarm] + +This test measures the cyg_counter_tick() call. +A counter is created that has a single alarm attached to it. The +purpose of this test is to measure the cost of “ticking” a +counter when it has a single attached alarm. In this test, the alarm +is not activated (fired). + + + +Tick counter [many alarms] + +This test measures the cyg_counter_tick() call. +A counter is created that has multiple alarms attached to it. The +purpose of this test is to measure the cost of “ticking” a +counter when it has many attached alarms. In this test, the alarms +are not activated (fired). + + + +Tick & fire counter [1 alarm] + +This test measures the cyg_counter_tick() call. +A counter is created that has a single alarm attached to it. The +purpose of this test is to measure the cost of “ticking” a +counter when it has a single attached alarm. In this test, the alarm +is activated (fired). Thus the measured time will include the overhead +of calling the alarm callback function. + + + +Tick & fire counter [many alarms] + +This test measures the cyg_counter_tick() call. +A counter is created that has multiple alarms attached to it. The +purpose of this test is to measure the cost of “ticking” a +counter when it has many attached alarms. In this test, the alarms +are activated (fired). Thus the measured time will include the overhead +of calling the alarm callback function. + + + +Alarm latency [0 threads] + +This test attempts to measure the latency in calling an alarm +callback function. The time from the clock interrupt until the alarm +function is called is measured. In this test, there are no threads +that can be run, other than the system idle thread, when the clock +interrupt occurs (all threads are suspended). + + + +Alarm latency [2 threads] + +This test attempts to measure the latency in calling an alarm +callback function. The time from the clock interrupt until the alarm +function is called is measured. In this test, there are exactly +two threads which are running when the clock interrupt occurs. They +are simply passing back and forth by way of the cyg_thread_yield() call. +The purpose of this test is to measure the variations in the latency +when there are executing threads. + + + +Alarm latency [many threads] + +This test attempts to measure the + latency in calling an alarm callback function. The + time from the clock interrupt until the alarm + function is called is measured. In this test, there + are a number of threads which are running when the + clock interrupt occurs. They are simply passing back + and forth by way of the + cyg_thread_yield() + call. The purpose of this test is to measure the + variations in the latency when there are many + executing threads. + + + + + + +Sample Numbers +For sample results, see Appendix 1 of Getting + Started with eCos + + + diff --git a/packages/kernel/current/include/bitmap.hxx b/packages/kernel/current/include/bitmap.hxx --- a/packages/kernel/current/include/bitmap.hxx +++ b/packages/kernel/current/include/bitmap.hxx @@ -8,29 +8,38 @@ // Bitmap scheduler class declaration(s) // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/clock.hxx b/packages/kernel/current/include/clock.hxx --- a/packages/kernel/current/include/clock.hxx +++ b/packages/kernel/current/include/clock.hxx @@ -8,29 +8,38 @@ // Clock and Alarm class declaration(s) // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/clock.inl b/packages/kernel/current/include/clock.inl --- a/packages/kernel/current/include/clock.inl +++ b/packages/kernel/current/include/clock.inl @@ -8,29 +8,38 @@ // Clock and Alarm class inlines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/diag.h b/packages/kernel/current/include/diag.h --- a/packages/kernel/current/include/diag.h +++ b/packages/kernel/current/include/diag.h @@ -8,29 +8,38 @@ // Diagnostic Routines for Kernel Development // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/errors.h b/packages/kernel/current/include/errors.h --- a/packages/kernel/current/include/errors.h +++ b/packages/kernel/current/include/errors.h @@ -8,29 +8,38 @@ // Error values from kernel // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/except.hxx b/packages/kernel/current/include/except.hxx --- a/packages/kernel/current/include/except.hxx +++ b/packages/kernel/current/include/except.hxx @@ -8,29 +8,38 @@ // Exception handling declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/flag.hxx b/packages/kernel/current/include/flag.hxx --- a/packages/kernel/current/include/flag.hxx +++ b/packages/kernel/current/include/flag.hxx @@ -8,29 +8,38 @@ // Flag object class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/instrmnt.h b/packages/kernel/current/include/instrmnt.h --- a/packages/kernel/current/include/instrmnt.h +++ b/packages/kernel/current/include/instrmnt.h @@ -8,29 +8,38 @@ // Kernel Instrumentation mechanism // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -421,7 +430,7 @@ externC char * cyg_instrument_msg(CYG_WO // ------------------------------------------------------------------------- // MLQ instrumentation -#if 1 //def CYGDBG_KERNEL_INSTRUMENT_MLQ +#ifdef CYGDBG_KERNEL_INSTRUMENT_MLQ #define CYG_INSTRUMENT_MLQ(_event_,_arg1_,_arg2_) \ CYG_INSTRUMENT(CYGINST_EVENT(MLQ,_event_),_arg1_,_arg2_) diff --git a/packages/kernel/current/include/intr.hxx b/packages/kernel/current/include/intr.hxx --- a/packages/kernel/current/include/intr.hxx +++ b/packages/kernel/current/include/intr.hxx @@ -8,29 +8,38 @@ // Interrupt class declaration(s) // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -309,9 +318,13 @@ public: // Mask a specific interrupt in a PIC static void mask_interrupt(cyg_vector vector); + // The same but not interrupt safe + static void mask_interrupt_intunsafe(cyg_vector vector); // Clear PIC mask static void unmask_interrupt(cyg_vector vector); + // The same but not interrupt safe + static void unmask_interrupt_intunsafe(cyg_vector vector); // Acknowledge interrupt at PIC static void acknowledge_interrupt(cyg_vector vector); diff --git a/packages/kernel/current/include/kapi.h b/packages/kernel/current/include/kapi.h --- a/packages/kernel/current/include/kapi.h +++ b/packages/kernel/current/include/kapi.h @@ -8,29 +8,38 @@ // Native API for Kernel // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -118,7 +127,7 @@ typedef struct cyg_spinlock_t cyg_spinlo /* Scheduler operations */ /* Starts scheduler with created threads. Never returns. */ -void cyg_scheduler_start(void) __attribute__ ((noreturn)); +void cyg_scheduler_start(void) CYGBLD_ATTRIB_NORET; /* Lock and unlock the scheduler. When the scheduler is */ /* locked thread preemption is disabled. */ @@ -290,8 +299,10 @@ void cyg_interrupt_enable(void); /* Interrupt controller access */ void cyg_interrupt_mask(cyg_vector_t vector); +void cyg_interrupt_mask_intunsafe(cyg_vector_t vector); void cyg_interrupt_unmask(cyg_vector_t vector); +void cyg_interrupt_unmask_intunsafe(cyg_vector_t vector); void cyg_interrupt_acknowledge(cyg_vector_t vector); @@ -332,6 +343,9 @@ void cyg_counter_set_value( /* Advance counter by one tick */ void cyg_counter_tick(cyg_handle_t counter); +/* Advance counter by multiple ticks */ +void cyg_counter_multi_tick(cyg_handle_t counter, cyg_tick_count_t ticks); + #define CYG_RESOLUTION_T_MEMBERS \ cyg_uint32 dividend; \ @@ -394,6 +408,12 @@ void cyg_alarm_initialize( cyg_tick_count_t interval /* Relative retrigger interval */ ); +void cyg_alarm_get_times( + cyg_handle_t alarm, + cyg_tick_count_t *trigger, /* Next trigger time */ + cyg_tick_count_t *interval /* Current interval */ +); + void cyg_alarm_enable( cyg_handle_t alarm ); void cyg_alarm_disable( cyg_handle_t alarm ); diff --git a/packages/kernel/current/include/kapidata.h b/packages/kernel/current/include/kapidata.h --- a/packages/kernel/current/include/kapidata.h +++ b/packages/kernel/current/include/kapidata.h @@ -8,29 +8,38 @@ // Native API data structures // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -222,12 +231,14 @@ typedef struct # define CYG_HARDWARETHREAD_SAVED_CONTEXT_MEMBER #endif +typedef void cyg_thread_entry(CYG_ADDRWORD data); + #define CYG_HARDWARETHREAD_MEMBERS \ CYG_ADDRESS stack_base; /* pointer to base of stack area */ \ cyg_uint32 stack_size; /* size of stack area in bytes */ \ CYG_HARDWARETHREAD_STACK_LIMIT_MEMBER \ CYG_ADDRESS stack_ptr; /* pointer to saved state on stack */ \ - CYG_ADDRWORD entry_point; /* main entry point (code pointer!) */ \ + cyg_thread_entry *entry_point; /* main entry point (code pointer!) */ \ CYG_ADDRWORD entry_data; /* entry point argument */ \ CYG_HARDWARETHREAD_SAVED_CONTEXT_MEMBER @@ -288,11 +299,11 @@ typedef struct #endif #ifdef CYGSEM_KERNEL_SCHED_ASR_SUPPORT -# define CYG_SCHEDTHREAD_ASR_MEMBER \ - volatile cyg_bool asr_inhibit; /* If true, blocks calls to ASRs */ \ - volatile cyg_bool asr_pending; /* If true, this thread's ASR */ \ - /* should be called. */ \ - CYG_SCHEDTHREAD_ASR_NONGLOBAL_MEMBER \ +# define CYG_SCHEDTHREAD_ASR_MEMBER \ + volatile cyg_ucount32 asr_inhibit; /* If true, blocks calls to ASRs */ \ + volatile cyg_bool asr_pending; /* If true, this thread's ASR */ \ + /* should be called. */ \ + CYG_SCHEDTHREAD_ASR_NONGLOBAL_MEMBER \ CYG_SCHEDTHREAD_ASR_DATA_NONGLOBAL_MEMBER #else # define CYG_SCHEDTHREAD_ASR_MEMBER @@ -339,7 +350,17 @@ typedef struct } cyg_threadtimer; -typedef int cyg_reason_t; /* cyg_reason is originally an enum */ +typedef enum +{ + CYG_REASON_NONE, + CYG_REASON_WAIT, + CYG_REASON_DELAY, + CYG_REASON_TIMEOUT, + CYG_REASON_BREAK, + CYG_REASON_DESTRUCT, + CYG_REASON_EXIT, + CYG_REASON_DONE +} cyg_reason_t; #if defined(CYGPKG_KERNEL_EXCEPTIONS) && !defined(CYGSEM_KERNEL_EXCEPTIONS_GLOBAL) # define CYG_THREAD_EXCEPTION_CONTROL_MEMBER \ @@ -450,14 +471,21 @@ struct cyg_flag_t /*---------------------------------------------------------------------------*/ +typedef enum +{ + CYG_MUTEX_PROTOCOL_NONE, + CYG_MUTEX_PROTOCOL_INHERIT, + CYG_MUTEX_PROTOCOL_CEILING +} cyg_mutex_protocol_t; + struct cyg_mutex_t { - cyg_bool locked; /* true if locked */ + cyg_atomic locked; /* true if locked */ cyg_thread *owner; /* Current locking thread */ cyg_threadqueue queue; /* Queue of waiting threads */ #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC - cyg_uint32 protocol; /* this mutex's protocol */ + cyg_mutex_protocol_t protocol; /* this mutex's protocol */ #endif #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING cyg_priority_t ceiling; /* mutex priority ceiling */ diff --git a/packages/kernel/current/include/kernel.hxx b/packages/kernel/current/include/kernel.hxx --- a/packages/kernel/current/include/kernel.hxx +++ b/packages/kernel/current/include/kernel.hxx @@ -8,29 +8,38 @@ // Kernel mega-include file // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/ktypes.h b/packages/kernel/current/include/ktypes.h --- a/packages/kernel/current/include/ktypes.h +++ b/packages/kernel/current/include/ktypes.h @@ -8,29 +8,38 @@ // Standard types used in the kernel and its interfaces // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/llistt.hxx b/packages/kernel/current/include/llistt.hxx --- a/packages/kernel/current/include/llistt.hxx +++ b/packages/kernel/current/include/llistt.hxx @@ -8,29 +8,38 @@ // Llistt linked list template class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/lottery.hxx b/packages/kernel/current/include/lottery.hxx --- a/packages/kernel/current/include/lottery.hxx +++ b/packages/kernel/current/include/lottery.hxx @@ -8,29 +8,38 @@ // Lottery scheduler class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/mbox.hxx b/packages/kernel/current/include/mbox.hxx --- a/packages/kernel/current/include/mbox.hxx +++ b/packages/kernel/current/include/mbox.hxx @@ -8,29 +8,38 @@ // Plain (void *) Mbox (Message Box/Mailbox) class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/mboxt.hxx b/packages/kernel/current/include/mboxt.hxx --- a/packages/kernel/current/include/mboxt.hxx +++ b/packages/kernel/current/include/mboxt.hxx @@ -8,29 +8,38 @@ // Mboxt (Message Box/Mailbox) class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/mboxt.inl b/packages/kernel/current/include/mboxt.inl --- a/packages/kernel/current/include/mboxt.inl +++ b/packages/kernel/current/include/mboxt.inl @@ -7,29 +7,38 @@ // Mboxt mbox template class implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/mboxt2.hxx b/packages/kernel/current/include/mboxt2.hxx --- a/packages/kernel/current/include/mboxt2.hxx +++ b/packages/kernel/current/include/mboxt2.hxx @@ -8,29 +8,38 @@ // Mboxt2 (Message Box/Mailbox) class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/mboxt2.inl b/packages/kernel/current/include/mboxt2.inl --- a/packages/kernel/current/include/mboxt2.inl +++ b/packages/kernel/current/include/mboxt2.inl @@ -7,29 +7,38 @@ // Mboxt2 mbox template class implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/mlqueue.hxx b/packages/kernel/current/include/mlqueue.hxx --- a/packages/kernel/current/include/mlqueue.hxx +++ b/packages/kernel/current/include/mlqueue.hxx @@ -8,29 +8,38 @@ // Multi-Level Queue scheduler class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/mqueue.hxx b/packages/kernel/current/include/mqueue.hxx --- a/packages/kernel/current/include/mqueue.hxx +++ b/packages/kernel/current/include/mqueue.hxx @@ -7,29 +7,38 @@ // Message queues // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/mqueue.inl b/packages/kernel/current/include/mqueue.inl --- a/packages/kernel/current/include/mqueue.inl +++ b/packages/kernel/current/include/mqueue.inl @@ -7,29 +7,38 @@ // Message queues implementation // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/mutex.hxx b/packages/kernel/current/include/mutex.hxx --- a/packages/kernel/current/include/mutex.hxx +++ b/packages/kernel/current/include/mutex.hxx @@ -8,29 +8,38 @@ // Mutex class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/sched.hxx b/packages/kernel/current/include/sched.hxx --- a/packages/kernel/current/include/sched.hxx +++ b/packages/kernel/current/include/sched.hxx @@ -8,29 +8,38 @@ // Scheduler class declaration(s) // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -169,10 +178,10 @@ public: static void unlock_simple(); // Start execution of the scheduler - static void start() __attribute__ ((noreturn)); + static void start() CYGBLD_ATTRIB_NORET; // Start execution of the scheduler on the current CPU - static void start_cpu() __attribute__ ((noreturn)); + static void start_cpu() CYGBLD_ATTRIB_NORET; // The only scheduler instance should be this one... static Cyg_Scheduler scheduler CYGBLD_ANNOTATE_VARIABLE_SCHED; diff --git a/packages/kernel/current/include/sched.inl b/packages/kernel/current/include/sched.inl --- a/packages/kernel/current/include/sched.inl +++ b/packages/kernel/current/include/sched.inl @@ -8,29 +8,38 @@ // Scheduler class inlines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/sema.hxx b/packages/kernel/current/include/sema.hxx --- a/packages/kernel/current/include/sema.hxx +++ b/packages/kernel/current/include/sema.hxx @@ -8,29 +8,38 @@ // Semaphore class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/sema2.hxx b/packages/kernel/current/include/sema2.hxx --- a/packages/kernel/current/include/sema2.hxx +++ b/packages/kernel/current/include/sema2.hxx @@ -8,29 +8,38 @@ // Semaphore class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/smp.hxx b/packages/kernel/current/include/smp.hxx --- a/packages/kernel/current/include/smp.hxx +++ b/packages/kernel/current/include/smp.hxx @@ -8,29 +8,38 @@ // SMP kernel support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/test/stackmon.h b/packages/kernel/current/include/test/stackmon.h --- a/packages/kernel/current/include/test/stackmon.h +++ b/packages/kernel/current/include/test/stackmon.h @@ -8,29 +8,38 @@ // Auxiliary test header file // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/thread.hxx b/packages/kernel/current/include/thread.hxx --- a/packages/kernel/current/include/thread.hxx +++ b/packages/kernel/current/include/thread.hxx @@ -8,29 +8,38 @@ // Thread class declarations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/thread.inl b/packages/kernel/current/include/thread.inl --- a/packages/kernel/current/include/thread.inl +++ b/packages/kernel/current/include/thread.inl @@ -8,29 +8,38 @@ // Thread class inlines // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/include/timer.hxx b/packages/kernel/current/include/timer.hxx --- a/packages/kernel/current/include/timer.hxx +++ b/packages/kernel/current/include/timer.hxx @@ -8,29 +8,38 @@ // Timer handler class declaration(s) // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/common/clock.cxx b/packages/kernel/current/src/common/clock.cxx --- a/packages/kernel/current/src/common/clock.cxx +++ b/packages/kernel/current/src/common/clock.cxx @@ -5,29 +5,38 @@ // Clock class implementations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/common/except.cxx b/packages/kernel/current/src/common/except.cxx --- a/packages/kernel/current/src/common/except.cxx +++ b/packages/kernel/current/src/common/except.cxx @@ -5,29 +5,38 @@ // Exception handling implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/common/kapi.cxx b/packages/kernel/current/src/common/kapi.cxx --- a/packages/kernel/current/src/common/kapi.cxx +++ b/packages/kernel/current/src/common/kapi.cxx @@ -5,29 +5,38 @@ // C API Implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -452,11 +461,20 @@ externC void cyg_interrupt_mask(cyg_vect Cyg_Interrupt::mask_interrupt( (cyg_vector)vector); } +externC void cyg_interrupt_mask_intunsafe(cyg_vector_t vector) +{ + Cyg_Interrupt::mask_interrupt_intunsafe( (cyg_vector)vector); +} + externC void cyg_interrupt_unmask(cyg_vector_t vector) { Cyg_Interrupt::unmask_interrupt( (cyg_vector)vector); } +externC void cyg_interrupt_unmask_intunsafe(cyg_vector_t vector) +{ + Cyg_Interrupt::unmask_interrupt_intunsafe( (cyg_vector)vector); +} externC void cyg_interrupt_acknowledge(cyg_vector_t vector) { @@ -538,6 +556,12 @@ externC void cyg_counter_tick(cyg_handle ((Cyg_Counter *)counter)->tick(); } +/* Advance counter by multiple ticks */ +externC void cyg_counter_multi_tick(cyg_handle_t counter, cyg_tick_count_t ticks) +{ + ((Cyg_Counter *)counter)->tick(ticks); +} + /* Create a clock object */ externC void cyg_clock_create( cyg_resolution_t resolution, /* Initial resolution */ @@ -651,6 +675,17 @@ externC void cyg_alarm_initialize( (cyg_tick_count)interval); } +externC void cyg_alarm_get_times( + cyg_handle_t alarm, + cyg_tick_count_t *trigger, /* Next trigger time */ + cyg_tick_count_t *interval /* Current interval */ +) +{ + ((Cyg_Alarm *)alarm)->get_times( + (cyg_tick_count*)trigger, + (cyg_tick_count*)interval); +} + externC void cyg_alarm_enable( cyg_handle_t alarm ) { ((Cyg_Alarm *)alarm)->enable(); diff --git a/packages/kernel/current/src/common/thread.cxx b/packages/kernel/current/src/common/thread.cxx --- a/packages/kernel/current/src/common/thread.cxx +++ b/packages/kernel/current/src/common/thread.cxx @@ -5,29 +5,38 @@ // Thread class implementations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/common/timer.cxx b/packages/kernel/current/src/common/timer.cxx --- a/packages/kernel/current/src/common/timer.cxx +++ b/packages/kernel/current/src/common/timer.cxx @@ -5,29 +5,38 @@ // Timer class implementations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/debug/dbg-thread-demux.c b/packages/kernel/current/src/debug/dbg-thread-demux.c --- a/packages/kernel/current/src/debug/dbg-thread-demux.c +++ b/packages/kernel/current/src/debug/dbg-thread-demux.c @@ -5,29 +5,38 @@ // GDB Stub ROM system calls // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/debug/dbg_gdb.cxx b/packages/kernel/current/src/debug/dbg_gdb.cxx --- a/packages/kernel/current/src/debug/dbg_gdb.cxx +++ b/packages/kernel/current/src/debug/dbg_gdb.cxx @@ -5,29 +5,38 @@ // GDB Debugging Interface // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/instrmnt/meminst.cxx b/packages/kernel/current/src/instrmnt/meminst.cxx --- a/packages/kernel/current/src/instrmnt/meminst.cxx +++ b/packages/kernel/current/src/instrmnt/meminst.cxx @@ -5,29 +5,38 @@ // Memory buffer instrumentation functions // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/intr/intr.cxx b/packages/kernel/current/src/intr/intr.cxx --- a/packages/kernel/current/src/intr/intr.cxx +++ b/packages/kernel/current/src/intr/intr.cxx @@ -5,29 +5,38 @@ // Interrupt class implementations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -612,6 +621,30 @@ Cyg_Interrupt::mask_interrupt(cyg_vector CYG_INSTRUMENT_INTR(MASK, vector, 0); + CYG_INTERRUPT_STATE old_ints; + + HAL_DISABLE_INTERRUPTS(old_ints); + HAL_INTERRUPT_MASK( vector ); + HAL_RESTORE_INTERRUPTS(old_ints); + + CYG_REPORT_RETURN(); +} + +// ------------------------------------------------------------------------- +// Mask a specific interrupt in a PIC (but not interrupt safe) + +void +Cyg_Interrupt::mask_interrupt_intunsafe(cyg_vector vector) +{ + CYG_REPORT_FUNCTION(); + CYG_REPORT_FUNCARG1("vector=%d", vector); + + + CYG_ASSERT( vector >= CYGNUM_HAL_ISR_MIN, "Invalid vector"); + CYG_ASSERT( vector <= CYGNUM_HAL_ISR_MAX, "Invalid vector"); + + CYG_INSTRUMENT_INTR(MASK, vector, 0); + HAL_INTERRUPT_MASK( vector ); CYG_REPORT_RETURN(); @@ -630,6 +663,29 @@ Cyg_Interrupt::unmask_interrupt(cyg_vect CYG_INSTRUMENT_INTR(UNMASK, vector, 0); + CYG_INTERRUPT_STATE old_ints; + + HAL_DISABLE_INTERRUPTS(old_ints); + HAL_INTERRUPT_UNMASK( vector ); + HAL_RESTORE_INTERRUPTS(old_ints); + + CYG_REPORT_RETURN(); +} + + +// ------------------------------------------------------------------------- +// Clear PIC mask (but not interrupt safe) + +void +Cyg_Interrupt::unmask_interrupt_intunsafe(cyg_vector vector) +{ + CYG_REPORT_FUNCTION(); + + CYG_ASSERT( vector >= CYGNUM_HAL_ISR_MIN, "Invalid vector"); + CYG_ASSERT( vector <= CYGNUM_HAL_ISR_MAX, "Invalid vector"); + + CYG_INSTRUMENT_INTR(UNMASK, vector, 0); + HAL_INTERRUPT_UNMASK( vector ); CYG_REPORT_RETURN(); diff --git a/packages/kernel/current/src/sched/bitmap.cxx b/packages/kernel/current/src/sched/bitmap.cxx --- a/packages/kernel/current/src/sched/bitmap.cxx +++ b/packages/kernel/current/src/sched/bitmap.cxx @@ -5,29 +5,38 @@ // Bitmap scheduler class implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/sched/lottery.cxx b/packages/kernel/current/src/sched/lottery.cxx --- a/packages/kernel/current/src/sched/lottery.cxx +++ b/packages/kernel/current/src/sched/lottery.cxx @@ -5,29 +5,38 @@ // Lottery scheduler class implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/sched/mlqueue.cxx b/packages/kernel/current/src/sched/mlqueue.cxx --- a/packages/kernel/current/src/sched/mlqueue.cxx +++ b/packages/kernel/current/src/sched/mlqueue.cxx @@ -5,29 +5,38 @@ // Multi-level queue scheduler class implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/sched/sched.cxx b/packages/kernel/current/src/sched/sched.cxx --- a/packages/kernel/current/src/sched/sched.cxx +++ b/packages/kernel/current/src/sched/sched.cxx @@ -5,29 +5,38 @@ // Scheduler class implementations // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/sync/bin_sem.cxx b/packages/kernel/current/src/sync/bin_sem.cxx --- a/packages/kernel/current/src/sync/bin_sem.cxx +++ b/packages/kernel/current/src/sync/bin_sem.cxx @@ -5,29 +5,38 @@ // Binary semaphore implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/sync/cnt_sem.cxx b/packages/kernel/current/src/sync/cnt_sem.cxx --- a/packages/kernel/current/src/sync/cnt_sem.cxx +++ b/packages/kernel/current/src/sync/cnt_sem.cxx @@ -5,29 +5,38 @@ // Counting semaphore implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/sync/cnt_sem2.cxx b/packages/kernel/current/src/sync/cnt_sem2.cxx --- a/packages/kernel/current/src/sync/cnt_sem2.cxx +++ b/packages/kernel/current/src/sync/cnt_sem2.cxx @@ -5,29 +5,38 @@ // Counting semaphore implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/sync/flag.cxx b/packages/kernel/current/src/sync/flag.cxx --- a/packages/kernel/current/src/sync/flag.cxx +++ b/packages/kernel/current/src/sync/flag.cxx @@ -5,29 +5,38 @@ // Flag class implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -58,7 +67,7 @@ // ------------------------------------------------------------------------- // Constructor -Cyg_Flag::Cyg_Flag( Cyg_FlagValue init = 0 ) +Cyg_Flag::Cyg_Flag( Cyg_FlagValue init ) { CYG_REPORT_FUNCTION(); value = init; @@ -121,7 +130,7 @@ Cyg_Flag::check_this(cyg_assert_class_ze // argument. This cannot make a wait condition become true, so there's not // much to it. void -Cyg_Flag::maskbits( Cyg_FlagValue arg = 0 ) +Cyg_Flag::maskbits( Cyg_FlagValue arg ) { CYG_REPORT_FUNCTION(); @@ -145,7 +154,7 @@ Cyg_Flag::maskbits( Cyg_FlagValue arg = // by the time they get to run. void -Cyg_Flag::setbits( Cyg_FlagValue arg = ~0 ) +Cyg_Flag::setbits( Cyg_FlagValue arg ) { CYG_REPORT_FUNCTION(); CYG_ASSERTCLASS( this, "Bad this pointer"); diff --git a/packages/kernel/current/src/sync/mbox.cxx b/packages/kernel/current/src/sync/mbox.cxx --- a/packages/kernel/current/src/sync/mbox.cxx +++ b/packages/kernel/current/src/sync/mbox.cxx @@ -5,29 +5,38 @@ // Mbox mbox template class implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/sync/mqueue.cxx b/packages/kernel/current/src/sync/mqueue.cxx --- a/packages/kernel/current/src/sync/mqueue.cxx +++ b/packages/kernel/current/src/sync/mqueue.cxx @@ -5,29 +5,38 @@ // Mqueue message queue non-inline implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/src/sync/mutex.cxx b/packages/kernel/current/src/sync/mutex.cxx --- a/packages/kernel/current/src/sync/mutex.cxx +++ b/packages/kernel/current/src/sync/mutex.cxx @@ -5,29 +5,38 @@ // Mutex and condition variable implementation // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -65,11 +74,13 @@ #define IF_PROTOCOL_INHERIT if( protocol == INHERIT ) #define IF_PROTOCOL_CEILING if( protocol == CEILING ) +#define IF_PROTOCOL_ACTIVE if( protocol != NONE ) #else #define IF_PROTOCOL_INHERIT #define IF_PROTOCOL_CEILING +#define IF_PROTOCOL_ACTIVE #endif @@ -221,7 +232,8 @@ Cyg_Mutex::lock(void) #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL - self->count_mutex(); + IF_PROTOCOL_ACTIVE + self->count_mutex(); #endif @@ -284,7 +296,8 @@ Cyg_Mutex::lock(void) { #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL - self->uncount_mutex(); + IF_PROTOCOL_ACTIVE + self->uncount_mutex(); #endif #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_INHERIT @@ -337,7 +350,8 @@ Cyg_Mutex::trylock(void) #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL - self->count_mutex(); + IF_PROTOCOL_ACTIVE + self->count_mutex(); #endif #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING @@ -405,7 +419,8 @@ Cyg_Mutex::unlock(void) #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL - owner->uncount_mutex(); + IF_PROTOCOL_ACTIVE + owner->uncount_mutex(); #endif #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_INHERIT diff --git a/packages/kernel/current/tests/bin_sem0.cxx b/packages/kernel/current/tests/bin_sem0.cxx --- a/packages/kernel/current/tests/bin_sem0.cxx +++ b/packages/kernel/current/tests/bin_sem0.cxx @@ -5,29 +5,38 @@ // Binary semaphore test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/bin_sem1.cxx b/packages/kernel/current/tests/bin_sem1.cxx --- a/packages/kernel/current/tests/bin_sem1.cxx +++ b/packages/kernel/current/tests/bin_sem1.cxx @@ -5,29 +5,38 @@ // Binary semaphore test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/bin_sem2.cxx b/packages/kernel/current/tests/bin_sem2.cxx --- a/packages/kernel/current/tests/bin_sem2.cxx +++ b/packages/kernel/current/tests/bin_sem2.cxx @@ -5,29 +5,38 @@ // Binary semaphore test 2 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/clock0.cxx b/packages/kernel/current/tests/clock0.cxx --- a/packages/kernel/current/tests/clock0.cxx +++ b/packages/kernel/current/tests/clock0.cxx @@ -5,29 +5,38 @@ // Clock test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/clock1.cxx b/packages/kernel/current/tests/clock1.cxx --- a/packages/kernel/current/tests/clock1.cxx +++ b/packages/kernel/current/tests/clock1.cxx @@ -5,29 +5,38 @@ // Clock test 1 - Real Time Clock // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/clockcnv.cxx b/packages/kernel/current/tests/clockcnv.cxx --- a/packages/kernel/current/tests/clockcnv.cxx +++ b/packages/kernel/current/tests/clockcnv.cxx @@ -5,29 +5,38 @@ // Clock Converter test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/clocktruth.cxx b/packages/kernel/current/tests/clocktruth.cxx --- a/packages/kernel/current/tests/clocktruth.cxx +++ b/packages/kernel/current/tests/clocktruth.cxx @@ -5,29 +5,38 @@ // Clock Converter test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/cnt_sem0.cxx b/packages/kernel/current/tests/cnt_sem0.cxx --- a/packages/kernel/current/tests/cnt_sem0.cxx +++ b/packages/kernel/current/tests/cnt_sem0.cxx @@ -5,29 +5,38 @@ // Counting semaphore test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/cnt_sem1.cxx b/packages/kernel/current/tests/cnt_sem1.cxx --- a/packages/kernel/current/tests/cnt_sem1.cxx +++ b/packages/kernel/current/tests/cnt_sem1.cxx @@ -5,29 +5,38 @@ // Counting semaphore test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/dhrystone.c b/packages/kernel/current/tests/dhrystone.c --- a/packages/kernel/current/tests/dhrystone.c +++ b/packages/kernel/current/tests/dhrystone.c @@ -70,22 +70,10 @@ dtime(void) } // Number of loops to run. -#if defined(CYGPKG_HAL_ARM_AEB) || defined(CYGPKG_HAL_ARM_PID) -#define PASSES 100000 -#elif defined(CYGPKG_HAL_ARM_EBSA285) -#define PASSES 1000000 -#elif defined(CYGPKG_HAL_ARM_SA11X0) -#define PASSES 1000000 -#elif defined(CYGPKG_HAL_ARM_CMA230) -#define PASSES 100000 -#elif defined(CYGPKG_HAL_V85X_V850_CEB) -#define PASSES 20000 -#elif defined(CYGPKG_HAL_MIPS_TX49_REF4955) -#define PASSES 1000000 -#elif defined(CYGPKG_HAL_POWERPC_MPC8xx) -#define PASSES 250000 +#if defined(CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES) +# define PASSES CYGPRI_KERNEL_TESTS_DHRYSTONE_PASSES #else -#define PASSES 400000 +# define PASSES 400000 #endif // Used in the code below to mark changes to the code. diff --git a/packages/kernel/current/tests/except1.cxx b/packages/kernel/current/tests/except1.cxx --- a/packages/kernel/current/tests/except1.cxx +++ b/packages/kernel/current/tests/except1.cxx @@ -5,29 +5,38 @@ // Exception test 1 // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/flag0.cxx b/packages/kernel/current/tests/flag0.cxx --- a/packages/kernel/current/tests/flag0.cxx +++ b/packages/kernel/current/tests/flag0.cxx @@ -5,29 +5,38 @@ // Flag test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/flag1.cxx b/packages/kernel/current/tests/flag1.cxx --- a/packages/kernel/current/tests/flag1.cxx +++ b/packages/kernel/current/tests/flag1.cxx @@ -5,29 +5,38 @@ // Flag test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/intr0.cxx b/packages/kernel/current/tests/intr0.cxx --- a/packages/kernel/current/tests/intr0.cxx +++ b/packages/kernel/current/tests/intr0.cxx @@ -5,29 +5,38 @@ // Interrupt test 0 // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kcache1.c b/packages/kernel/current/tests/kcache1.c --- a/packages/kernel/current/tests/kcache1.c +++ b/packages/kernel/current/tests/kcache1.c @@ -5,29 +5,38 @@ // Cache timing test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -172,6 +181,8 @@ void time1II(void) #endif // ------------------------------------------------------------------------- // With a DCache invalidate in the middle: +// This is guaranteed to produce bogus timing results since interrupts +// have to be disabled to prevent accidental loss of state. #ifdef HAL_DCACHE_INVALIDATE_ALL static void time0DI(register cyg_uint32 stride) { @@ -180,9 +191,11 @@ static void time0DI(register cyg_uint32 cyg_tick_count_t count1; cyg_ucount32 t; register char c; + register CYG_INTERRUPT_STATE oldints; count0 = cyg_current_time(); + HAL_DISABLE_INTERRUPTS(oldints); HAL_DCACHE_SYNC(); k = 0; @@ -195,6 +208,7 @@ static void time0DI(register cyg_uint32 c=m[stride*j]; } } + HAL_RESTORE_INTERRUPTS(oldints); count1 = cyg_current_time(); t = count1 - count0; @@ -244,7 +258,7 @@ static void entry0( cyg_addrword_t data HAL_UCACHE_INVALIDATE_ALL(); HAL_UCACHE_ENABLE(); HAL_RESTORE_INTERRUPTS(oldints); - CYG_TEST_INFO("Cache on: invalidate Cache (expect bogus times)"); + CYG_TEST_INFO("Cache on: invalidate Cache (expect bogus timing)"); time1DI(); #endif diff --git a/packages/kernel/current/tests/kcache2.c b/packages/kernel/current/tests/kcache2.c --- a/packages/kernel/current/tests/kcache2.c +++ b/packages/kernel/current/tests/kcache2.c @@ -5,29 +5,38 @@ // Cache feature/timing tests // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -256,20 +265,15 @@ static void test_dstore(void) HAL_DCACHE_SYNC(); HAL_DCACHE_INVALIDATE_ALL(); HAL_DCACHE_ENABLE(); - HAL_RESTORE_INTERRUPTS(oldints); aligned_p = (volatile cyg_uint8*) (((unsigned long) &m[HAL_DCACHE_LINE_SIZE*2]) & ~(HAL_DCACHE_LINE_SIZE-1)); - HAL_DISABLE_INTERRUPTS(oldints); - aligned_p[0] = 42 + aligned_p[1]; // Load causes cache to be used! HAL_DCACHE_STORE(aligned_p, HAL_DCACHE_LINE_SIZE); - HAL_RESTORE_INTERRUPTS(oldints); - CYG_TEST_CHECK(42 == aligned_p[0], "memory didn't contain flushed data"); @@ -277,6 +281,8 @@ static void test_dstore(void) CYG_TEST_CHECK(42 == aligned_p[0], "memory didn't contain flushed data after invalidate all"); + + HAL_RESTORE_INTERRUPTS(oldints); } #endif @@ -303,21 +309,16 @@ static void test_dsync(void) HAL_DCACHE_SYNC(); HAL_DCACHE_INVALIDATE_ALL(); HAL_DCACHE_ENABLE(); - HAL_RESTORE_INTERRUPTS(oldints); aligned_p = (volatile cyg_uint8*) (((unsigned long) &m[HAL_DCACHE_LINE_SIZE*2]) & ~(HAL_DCACHE_LINE_SIZE-1)); - HAL_DISABLE_INTERRUPTS(oldints); - aligned_p[0] = 42 + aligned_p[1]; // Load causes cache to be used! aligned_p[HAL_DCACHE_LINE_SIZE] = 43 + aligned_p[HAL_DCACHE_LINE_SIZE + 1]; HAL_DCACHE_SYNC(); - HAL_RESTORE_INTERRUPTS(oldints); - CYG_TEST_CHECK(42 == aligned_p[0], "memory didn't contain flushed data"); CYG_TEST_CHECK(43 == aligned_p[HAL_DCACHE_LINE_SIZE], @@ -330,6 +331,8 @@ static void test_dsync(void) CYG_TEST_CHECK(43 == aligned_p[HAL_DCACHE_LINE_SIZE], "memory didn't contain flushed data next block after invalidate"); + HAL_RESTORE_INTERRUPTS(oldints); + HAL_ICACHE_INVALIDATE_ALL(); HAL_DCACHE_DISABLE(); @@ -469,14 +472,11 @@ static void test_dinvalidate_all(void) HAL_DCACHE_SYNC(); HAL_DCACHE_INVALIDATE_ALL(); HAL_DCACHE_ENABLE(); - HAL_RESTORE_INTERRUPTS(oldints); aligned_p = (volatile cyg_uint8*) (((unsigned long) &m[HAL_DCACHE_LINE_SIZE*2]) & ~(HAL_DCACHE_LINE_SIZE-1)); - HAL_DISABLE_INTERRUPTS(oldints); - aligned_p[0] = 43 + aligned_p[1]; // Load causes cache to be used! aligned_p[HAL_DCACHE_LINE_SIZE-1] = 43; diff --git a/packages/kernel/current/tests/kclock0.c b/packages/kernel/current/tests/kclock0.c --- a/packages/kernel/current/tests/kclock0.c +++ b/packages/kernel/current/tests/kclock0.c @@ -5,29 +5,38 @@ // Kernel C API Clock test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kclock1.c b/packages/kernel/current/tests/kclock1.c --- a/packages/kernel/current/tests/kclock1.c +++ b/packages/kernel/current/tests/kclock1.c @@ -5,29 +5,38 @@ // Kernel C API Clock test 1 - Real Time Clock // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kexcept1.c b/packages/kernel/current/tests/kexcept1.c --- a/packages/kernel/current/tests/kexcept1.c +++ b/packages/kernel/current/tests/kexcept1.c @@ -5,29 +5,38 @@ // Kernel C API Exception test 1 // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // @@ -65,8 +74,9 @@ static cyg_thread thread_obj[NTHREADS]; static char stack[NTHREADS][STACKSIZE]; + +#ifdef EXCEPTION_DATA_ACCESS static cyg_exception_handler_t handler0; -static int d0; static void handler0(cyg_addrword_t data, cyg_code_t number, cyg_addrword_t info) { @@ -80,6 +90,9 @@ static void handler0(cyg_addrword_t data CYG_TEST_PASS_FINISH("Except 1 OK"); } +#endif + +static int d0; static void handler1(cyg_addrword_t data, cyg_code_t number, cyg_addrword_t info) { diff --git a/packages/kernel/current/tests/kflag0.c b/packages/kernel/current/tests/kflag0.c --- a/packages/kernel/current/tests/kflag0.c +++ b/packages/kernel/current/tests/kflag0.c @@ -5,29 +5,38 @@ // Kernel C API Flag test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kflag1.c b/packages/kernel/current/tests/kflag1.c --- a/packages/kernel/current/tests/kflag1.c +++ b/packages/kernel/current/tests/kflag1.c @@ -5,29 +5,38 @@ // Kernel C API Flag test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kill.cxx b/packages/kernel/current/tests/kill.cxx --- a/packages/kernel/current/tests/kill.cxx +++ b/packages/kernel/current/tests/kill.cxx @@ -5,29 +5,38 @@ // Thread kill test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kintr0.c b/packages/kernel/current/tests/kintr0.c --- a/packages/kernel/current/tests/kintr0.c +++ b/packages/kernel/current/tests/kintr0.c @@ -5,29 +5,38 @@ // Kernel C API Intr test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/klock.c b/packages/kernel/current/tests/klock.c --- a/packages/kernel/current/tests/klock.c +++ b/packages/kernel/current/tests/klock.c @@ -5,29 +5,38 @@ // Kernel lock test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kmbox1.c b/packages/kernel/current/tests/kmbox1.c --- a/packages/kernel/current/tests/kmbox1.c +++ b/packages/kernel/current/tests/kmbox1.c @@ -5,29 +5,38 @@ // Kernel Mbox test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kmutex0.c b/packages/kernel/current/tests/kmutex0.c --- a/packages/kernel/current/tests/kmutex0.c +++ b/packages/kernel/current/tests/kmutex0.c @@ -5,29 +5,38 @@ // Kernel C API Mutex and condition variable test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kmutex1.c b/packages/kernel/current/tests/kmutex1.c --- a/packages/kernel/current/tests/kmutex1.c +++ b/packages/kernel/current/tests/kmutex1.c @@ -5,29 +5,38 @@ // Kernel C API Mutex test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kmutex3.c b/packages/kernel/current/tests/kmutex3.c --- a/packages/kernel/current/tests/kmutex3.c +++ b/packages/kernel/current/tests/kmutex3.c @@ -5,29 +5,38 @@ // Mutex test 3 - priority inheritance // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kmutex4.c b/packages/kernel/current/tests/kmutex4.c --- a/packages/kernel/current/tests/kmutex4.c +++ b/packages/kernel/current/tests/kmutex4.c @@ -5,29 +5,38 @@ // Mutex test 4 - dynamic priority inheritance protocol // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kphilo.c b/packages/kernel/current/tests/kphilo.c --- a/packages/kernel/current/tests/kphilo.c +++ b/packages/kernel/current/tests/kphilo.c @@ -5,29 +5,38 @@ // A test of the dining philosophers problem // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/ksched1.c b/packages/kernel/current/tests/ksched1.c --- a/packages/kernel/current/tests/ksched1.c +++ b/packages/kernel/current/tests/ksched1.c @@ -5,29 +5,38 @@ // Kernel C API Sched test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/ksem0.c b/packages/kernel/current/tests/ksem0.c --- a/packages/kernel/current/tests/ksem0.c +++ b/packages/kernel/current/tests/ksem0.c @@ -5,29 +5,38 @@ // Kernel C API Semaphore test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/ksem1.c b/packages/kernel/current/tests/ksem1.c --- a/packages/kernel/current/tests/ksem1.c +++ b/packages/kernel/current/tests/ksem1.c @@ -5,29 +5,38 @@ // C API semaphore test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kthread0.c b/packages/kernel/current/tests/kthread0.c --- a/packages/kernel/current/tests/kthread0.c +++ b/packages/kernel/current/tests/kthread0.c @@ -5,29 +5,38 @@ // Kernel C API Thread test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/kthread1.c b/packages/kernel/current/tests/kthread1.c --- a/packages/kernel/current/tests/kthread1.c +++ b/packages/kernel/current/tests/kthread1.c @@ -5,29 +5,38 @@ // Kernel C API Thread test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/mbox1.cxx b/packages/kernel/current/tests/mbox1.cxx --- a/packages/kernel/current/tests/mbox1.cxx +++ b/packages/kernel/current/tests/mbox1.cxx @@ -5,29 +5,38 @@ // Mbox test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/mqueue1.cxx b/packages/kernel/current/tests/mqueue1.cxx --- a/packages/kernel/current/tests/mqueue1.cxx +++ b/packages/kernel/current/tests/mqueue1.cxx @@ -5,29 +5,38 @@ // Message queues tests // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/mutex0.cxx b/packages/kernel/current/tests/mutex0.cxx --- a/packages/kernel/current/tests/mutex0.cxx +++ b/packages/kernel/current/tests/mutex0.cxx @@ -5,29 +5,38 @@ // Mutex and condition variable test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/mutex1.cxx b/packages/kernel/current/tests/mutex1.cxx --- a/packages/kernel/current/tests/mutex1.cxx +++ b/packages/kernel/current/tests/mutex1.cxx @@ -5,29 +5,38 @@ // Mutex test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/mutex2.cxx b/packages/kernel/current/tests/mutex2.cxx --- a/packages/kernel/current/tests/mutex2.cxx +++ b/packages/kernel/current/tests/mutex2.cxx @@ -5,29 +5,38 @@ // Mutex test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/mutex3.cxx b/packages/kernel/current/tests/mutex3.cxx --- a/packages/kernel/current/tests/mutex3.cxx +++ b/packages/kernel/current/tests/mutex3.cxx @@ -5,29 +5,38 @@ // Mutex test 3 - priority inheritance // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/philo.cxx b/packages/kernel/current/tests/philo.cxx --- a/packages/kernel/current/tests/philo.cxx +++ b/packages/kernel/current/tests/philo.cxx @@ -5,29 +5,38 @@ // A test of the dining philosophers problem // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/release.cxx b/packages/kernel/current/tests/release.cxx --- a/packages/kernel/current/tests/release.cxx +++ b/packages/kernel/current/tests/release.cxx @@ -5,29 +5,38 @@ // Thread release test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/sched1.cxx b/packages/kernel/current/tests/sched1.cxx --- a/packages/kernel/current/tests/sched1.cxx +++ b/packages/kernel/current/tests/sched1.cxx @@ -5,29 +5,38 @@ // Sched test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/smp.cxx b/packages/kernel/current/tests/smp.cxx --- a/packages/kernel/current/tests/smp.cxx +++ b/packages/kernel/current/tests/smp.cxx @@ -5,29 +5,38 @@ // SMP tests // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/stress_threads.c b/packages/kernel/current/tests/stress_threads.c --- a/packages/kernel/current/tests/stress_threads.c +++ b/packages/kernel/current/tests/stress_threads.c @@ -5,29 +5,38 @@ // Basic thread stress test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/sync2.cxx b/packages/kernel/current/tests/sync2.cxx --- a/packages/kernel/current/tests/sync2.cxx +++ b/packages/kernel/current/tests/sync2.cxx @@ -5,29 +5,38 @@ // Sync test 2 -- test of different locking mechanisms // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/sync3.cxx b/packages/kernel/current/tests/sync3.cxx --- a/packages/kernel/current/tests/sync3.cxx +++ b/packages/kernel/current/tests/sync3.cxx @@ -5,29 +5,38 @@ // Sync test 3 -- tests priorities and priority inheritance // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/tcdiag.cxx b/packages/kernel/current/tests/tcdiag.cxx --- a/packages/kernel/current/tests/tcdiag.cxx +++ b/packages/kernel/current/tests/tcdiag.cxx @@ -5,29 +5,38 @@ // Kernel diag test harness. // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/testaux.h b/packages/kernel/current/tests/testaux.h --- a/packages/kernel/current/tests/testaux.h +++ b/packages/kernel/current/tests/testaux.h @@ -8,29 +8,38 @@ // Auxiliary test header file // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/testaux.hxx b/packages/kernel/current/tests/testaux.hxx --- a/packages/kernel/current/tests/testaux.hxx +++ b/packages/kernel/current/tests/testaux.hxx @@ -8,29 +8,38 @@ // Auxiliary test header file // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/thread0.cxx b/packages/kernel/current/tests/thread0.cxx --- a/packages/kernel/current/tests/thread0.cxx +++ b/packages/kernel/current/tests/thread0.cxx @@ -5,29 +5,38 @@ // Thread test 0 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/thread1.cxx b/packages/kernel/current/tests/thread1.cxx --- a/packages/kernel/current/tests/thread1.cxx +++ b/packages/kernel/current/tests/thread1.cxx @@ -5,29 +5,38 @@ // Thread test 1 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/thread2.cxx b/packages/kernel/current/tests/thread2.cxx --- a/packages/kernel/current/tests/thread2.cxx +++ b/packages/kernel/current/tests/thread2.cxx @@ -5,29 +5,38 @@ // Thread test 2 // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/thread_gdb.c b/packages/kernel/current/tests/thread_gdb.c --- a/packages/kernel/current/tests/thread_gdb.c +++ b/packages/kernel/current/tests/thread_gdb.c @@ -5,29 +5,38 @@ // A test for thread support in GDB // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/timeslice.c b/packages/kernel/current/tests/timeslice.c --- a/packages/kernel/current/tests/timeslice.c +++ b/packages/kernel/current/tests/timeslice.c @@ -5,29 +5,38 @@ // Timeslice test // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/kernel/current/tests/tm_basic.cxx b/packages/kernel/current/tests/tm_basic.cxx --- a/packages/kernel/current/tests/tm_basic.cxx +++ b/packages/kernel/current/tests/tm_basic.cxx @@ -5,29 +5,38 @@ // Basic timing test / scaffolding // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/common/current/ChangeLog b/packages/language/c/libc/common/current/ChangeLog --- a/packages/language/c/libc/common/current/ChangeLog +++ b/packages/language/c/libc/common/current/ChangeLog @@ -7,27 +7,36 @@ 2000-05-02 Jonathan Larmour +The ISO Standard C and Math Libraries + +<!-- <xref> -->C and math library overview + +eCos provides compatibility with the + ISO 9899:1990 specification for the standard C library, which + is essentially the same as the better-known ANSI C3.159-1989 + specification (C-89). +There are three aspects of this compatibility supplied by eCos. +First there is a C library which +implements the functions defined by the ISO standard, except for the +mathematical functions. This is provided by the eCos C library +packages. +Then eCos provides a math +library, which implements the mathematical functions from the ISO +C library. This distinction between C and math libraries is frequently +drawn — most standard C library implementations provide +separate linkable files for the two, and the math library contains +all the functions from the math.h header +file. +There is a third element to the ISO C library, which is the +environment in which applications run when they use the standard +C library. This environment is set up by the C library startup procedure +() +and it provides (among other things) a main() entry +point function, an exit() function that +does the cleanup required by the standard (including handlers registered +using the atexit() function), and an environment +that can be read with getenv(). +The description in this manual focuses on the eCos-specific +aspects of the C library (mostly related to eCos's +configurability) as well as mentioning the omissions from the standard +in this release. We do not attempt to define the semantics of each +function, since that information can be found in the ISO, ANSI, +POSIX and IEEE standards, and the many good books that have been +written about the standard C library, that cover usage of these +functions in a more general and useful way. + +Included non-ISO functions +The following functions from the POSIX specification +are included for convenience: + extern char **environ variable +(for setting up the environment for use with getenv()) + _exit() + strtok_r() + rand_r() + asctime_r() + ctime_r() + localtime_r() + gmtime_r() +eCos provides the following additional +implementation-specific functions within the standard C library +to adjust the date and time settings: +void cyg_libc_time_setdst( + cyg_libc_time_dst state +); +This function sets the state of Daylight Savings Time. The +values for state are: +CYG_LIBC_TIME_DSTNA unknown +CYG_LIBC_TIME_DSTOFF off +CYG_LIBC_TIME_DSTON on + +void cyg_libc_time_setzoneoffsets( + time_t stdoffset, time_t dstoffset +); +This function sets the offsets from UTC used when Daylight +Savings Time is enabled or disabled. The offsets are in time_t’s, +which are seconds in the current inplementation. +Cyg_libc_time_dst cyg_libc_time_getzoneoffsets( + time_t *stdoffset, time_t *dstoffset +); +This function retrieves the current setting for Daylight Savings +Time along with the offsets used for both STD and DST. The offsets +are both in time_t’s, which are seconds in the +current implementation. +cyg_bool cyg_libc_time_settime( + time_t utctime +); +This function sets the current time for the system The time +is specified as a time_t in UTC. +It returns non-zero on error. + + +Math library compatibility modes +This math library is capable of being operated in several +different compatibility modes. These options deal solely with how +errors are handled. +There are 4 compatibility modes: ANSI/POSIX 1003.1; +IEEE-754; X/Open Portability Guide issue 3 (XPG3); and +System V Interface Definition Edition 3. +In IEEE mode, the matherr() function +(see below) is never called, no warning messages are printed on +the stderr output stream, and errno is never set. +In ANSI/POSIX mode, errno is set correctly, +but matherr() is never called and no warning messages +are printed on the stderr output stream. +In X/Open mode, errno is set correctly, +matherr() is called, but no warning messages are printed +on the stderr output stream. +In SVID mode, functions which overflow return +a value HUGE (defined in math.h), which is the maximum +single precision floating point value (as opposed to +HUGE_VAL which is meant to stand for infinity). errno is +set correctly and matherr() is called. If +matherr() returns 0, warning messages are printed on +the stderr output stream for some errors. +The mode can be compiled-in as IEEE-only, or any one of the +above methods settable at run-time. + +This math library assumes that the hardware (or software floating +point emulation) supports IEEE-754 style arithmetic, 32-bit 2's +complement integer arithmetic, doubles are in 64-bit IEEE-754 format. + + +<!-- <index></index> --> matherr() +As mentioned above, in X/Open or SVID modes, the user + can supply a function matherr() of + the form: +int matherr( struct exception *e ) + +where struct exception is defined as: +struct exception { + int type; + char *name; + double arg1, arg2, retval; +}; +type is the exception type and is one of: + + +DOMAIN + + +argument domain exception + + + +SING + + +argument singularity + + + +OVERFLOW + + +overflow range exception + + + +UNDERFLOW + + +underflow range exception + + + +TLOSS + + +total loss of significance + + + +PLOSS + + +partial loss of significance + + + +name is a string containing the name of the +function +arg1 and arg2 are the +arguments passed to the function +retval is the default value that will be returned +by the function, and can be changed by matherr() + +matherr must have “C” linkage, not “C++” linkage. + +If matherr returns zero, or the user doesn't supply +their own matherr, then the following usually happens +in SVID mode: + +Behavior of math exception handling + + + + Type + Behavior + + + +DOMAIN0.0 returned, +errno=EDOM, and a message printed on stderr + +SINGHUGE of appropriate +sign is returned, errno=EDOM, and a message is printed +on stderr + +OVERFLOWHUGE of +appropriate sign is returned, and errno=ERANGE + +UNDERFLOW0.0 is +returned and errno=ERANGE + +TLOSS0.0 is returned, +errno=ERANGE, and a message is printed on stderr + +PLOSSThe current +implementation doesn't return this type + + +
+ +X/Open mode is similar except that the message is +not printed on stderr and HUGE_VAL is used in place of +HUGE +
+ +Thread-safety and re-entrancy +With the appropriate configuration options set below, the +math library is fully thread-safe if: + + +Depending on the compatibility mode, the + setting of the errno variable from the C library is + thread-safe + + +Depending on the compatibility mode, sending error messages +to the stderr output stream using the C library +fputs() + function is thread-safe + + +Depending on the compatibility mode, the user-supplied +matherr() + function and anything it depends on are thread-safe + + +In addition, with the exception of the gamma*() and lgamma*() functions, +the math library is reentrant (and thus safe to use from interrupt handlers) +if the Math library is always in IEEE mode. + +
+ +Some implementation details +Here are some details about the implementation +which might be interesting, although they do not affect the ISO-defined +semantics of the library. + + +It is possible to configure +eCos + to have the standard C library without the kernel. You might want +to do this to use less memory. But if you disable the kernel, you +will be unable to use memory allocation, thread-safety and certain +stdio functions such as input. Other C library functionality is +unaffected. + + +The opaque type returned by +clock() + is called clock_t, and is implemented as a 64 bit integer. +The value returned by +clock() + is only correct if the kernel is configured with real-time clock +support, as determined by the CYGVAR_KERNEL_COUNTERS_CLOCK +configuration option in +kernel.h +. + + +The FILE type is not implemented as a structure, but rather +as a CYG_ADDRESS. + + +The GNU C compiler will place its own built-in implementations +instead of some C library functions. This can be turned off with +the -fno-builtin option. The functions affected +by this are +abs() +, +cos() +, +fabs() +, +labs() +, +memcmp() +, +memcpy() +, +sin() +, +sqrt() +, +strcmp() +, +strcpy() +, and +strlen() +. + + +For faster execution speed you should avoid this option +and let the compiler use its built-ins. This can be turned off by +invoking +GCC + with the -fno-builtin option. + + +memcpy() + and +memset() + are located in the infrastructure package, not in the C library +package. This is because the compiler calls these functions, and +the kernel needs to resolve them even if the C library is not configured. + + +Error codes such as EDOM and ERANGE, as well as +strerror() +, are implemented in the error package. The +error package is separate from the rest of the C and math libraries +so that the rest of +eCos + can use these error handling facilities even if the C library is +not configured. + + +When +free() + is invoked, heap memory will normally be coalesced. If the CYGSEM_KERNEL_MEMORY_COALESCE +configuration parameter is not set, memory will not be coalesced, +which might cause programs to fail. + + +Signals, as implemented by +<signal.h>, are guaranteed to work +correctly if raised using the +raise() + function from a normal working program context. Using signals from +within an ISR or DSR context is not expected to work. Also, it is +not guaranteed that if CYGSEM_LIBC_SIGNALS_HWEXCEPTIONS +is set, that handling a signal using +signal() + will necessarily catch that form of exception. For example, it +may be expected that a divide-by-zero error would be caught by handling +SIGFPE. However it depends on the underlying HAL implementation to implement +the required hardware exception. And indeed the hardware itself +may not be capable of detecting these exceptions so it may not be +possible for the HAL implementer to do this in any case. Despite +this lack of guarantees in this respect, the signals implementation +is still ISO C compliant since ISO C does not offer any such guarantees +either. + + +The +getenv() + function is implemented (unless the CYGPKG_LIBC_ENVIRONMENT configuration +option is turned off), but there is no shell or +putenv() + function to set the environment dynamically. The environment is +set in a global variable environ, declared as: +extern char **environ; // Standard environment definition +The environment can be statically initialized at startup time +using the CYGDAT_LIBC_DEFAULT_ENVIRONMENT +option. If so, remember that the final entry of the array initializer +must be NULL. + + +Here is a minimal eCos program which +demonstrates the use of environments (see also the test case in language/c/libc/current/tests/stdlib/getenv.c): +#include <stdio.h> +#include <stdlib.h> // Main header for stdlib functions + +extern char **environ; // Standard environment definition + +int +main( int argc, char *argv[] ) +{ + char *str; + char *env[] = { "PATH=/usr/local/bin:/usr/bin", + "HOME=/home/fred", + "TEST=1234=5678", + "home=hatstand", + NULL }; + + printf("Display the current PATH environment variable\n"); + + environ = (char **)&env; + + str = getenv("PATH"); + + if (str==NULL) { + printf("The current PATH is unset\n"); + } else { + printf("The current PATH is \"%s\"\n", str); + } + return 0; +} + + +<!-- <index></index> -->Thread safety +The ISO C library has configuration options that control thread +safety, i.e. working behavior if multiple threads call the same +function at the same time. +The following functionality has to be configured correctly, +or used carefully in a multi-threaded environment: + + +mblen() + + +mbtowc() + + +wctomb() + + + +printf() + (and all standard I/O functions except for +sprintf() + and +sscanf() + + +strtok() + + +rand() + and +srand() + + +signal() + and +raise() + + +asctime() +, +ctime() +, +gmtime() +, and +localtime() + + +the +errno + variable + + +the +environ + variable + + +date and time settings + + +In some cases, to make eCos development +easier, functions are provided (as specified by POSIX 1003.1) that define +re-entrant alternatives, i.e. rand_r(), strtok_r(), asctime_r(), ctime_r(), gmtime_r(), +and localtime_r(). In other cases, +configuration options are provided that control either locking of functions +or their shared data, such as with standard I/O streams, +or by using per-thread data, such as with the errno variable. +In some other cases, like the setting of date and time, no +re-entrant or thread-safe alternative or configuration is provided +as it is simply not a worthwhile addition (date and time should +rarely need to be set.) + + +<!-- <index></index> --><!-- <xref> -->C library startup +The C library includes a function declared as: +void cyg_iso_c_start( void ) +This function is used to start an environment in which an +ISO C style program can run in the most compatible way. +What this function does is to create a thread which will invoke main() — normally +considered a program's entry point. In particular, it can +supply arguments to main() using the CYGDAT_LIBC_ARGUMENTS +configuration option, and when returning from main(), +or calling exit(), pending stdio file output +is flushed and any functions registered with atexit() are +invoked. This is all compliant with the ISO C standard in this respect. +This thread starts execution when the eCos scheduler +is started. If the eCos kernel package is not +available (and hence there is no scheduler), then cyg_iso_c_start() will +invoke the main() function directly, i.e. +it will not return until the main() function +returns. +The main() function should be defined +as the following, and if defined in a C++ file, +should have “C” linkage: +extern int main( + int argc, + char *argv[] ) +The thread that is started by cyg_iso_c_start() can +be manipulated directly, if you wish. For example you can suspend +it. The kernel C API needs a handle to do this, which is available +by including the following in your source code. +extern cyg_handle_t cyg_libc_main_thread; +Then for example, you can suspend the thread with the line: +cyg_thread_suspend( cyg_libc_main_thread ); +If you call cyg_iso_c_start() and +do not provide your own main() function, +the system will provide a main() for you +which will simply return immediately. +In the default configuration, cyg_iso_c_start() is +invoked automatically by the cyg_package_start() function +in the infrastructure configuration. This means that in the simplest +case, your program can indeed consist of simply: +int main( int argc, char *argv[] ) +{ + printf("Hello eCos\n"); +} +If you override cyg_package_start() or cyg_start(), +or disable the infrastructure configuration option CYGSEM_START_ISO_C_COMPATIBILITY +then you must ensure that you call cyg_iso_c_start() yourself +if you want to be able to have your program start at the entry point +of main() automatically. + +
+ diff --git a/packages/language/c/libc/i18n/current/ChangeLog b/packages/language/c/libc/i18n/current/ChangeLog --- a/packages/language/c/libc/i18n/current/ChangeLog +++ b/packages/language/c/libc/i18n/current/ChangeLog @@ -58,27 +58,36 @@ 2000-05-02 Jonathan Larmour + + * include/setjmp.h: Use NORET attributes from cyg_type.h. + 2000-05-16 Nick Garnett * src/longjmp.cxx: Was still including pkgconf/libc.h rather that @@ -12,27 +16,36 @@ 2000-05-02 Jonathan Larmour + + * cdl/signals.cdl: Added + CYGPKG_LIBC_SIGNALS_TESTS_SIGNAL2_TEST3_SKIP. + Removed again. + + * tests/signal2.c: Instead check for + CYGNUM_HAL_EXCEPTION_FPU_DIV_BY_ZERO to decide if test3 is + appropriate. + 2001-05-02 Nick Garnett [x86 branch] @@ -42,27 +52,36 @@ 2000-05-02 Jonathan Larmour + + * src/_exit.cxx (_exit): Assert on non-zero error. + 2001-10-09 Jonathan Larmour * src/invokemain.cxx (cyg_libc_invoke_main): CYGINT_ISO_PTHREAD_IMPL @@ -63,27 +67,36 @@ 2000-05-02 Jonathan Larmour + + * include/streambuf.inl (Cyg_StdioStreamBuffer constructor): + Don't set default args in func definition. + (set_buffer): Ditto. + +2002-04-05 Jonathan Larmour + + * src/input/fgetc.cxx (fgetc): Silence conversion warning. + +2002-04-04 Jonathan Larmour + + * src/common/fopen.cxx (fopen_inner): Allocate memory using malloc and + placement new, not default new. + + * src/input/fgetc.cxx (fgetc): Don't set error on true EOF. + +2002-04-04 Jurica Baricevic + + * src/common/fclose.cxx (fclose): Use delete if we can. + +2002-02-06 Jonathan Larmour + + * src/input/fread.cxx (fread): when looping read into ptrc, not ptr! + +2002-01-25 Jonathan Larmour + + * include/stream.inl (set_position): Fix the seek backwards case again. + Doh! + +2002-01-24 Jonathan Larmour + + * include/stream.inl (set_position): Fix the posdiff == 0 case. + +2002-01-24 Jesper Skov + + * include/stream.inl (set_position): Check that posdiff is >0 + before taking the code path that assumes so. + +2002-01-17 Jonathan Larmour + + * include/stream.inl (set_position): Use an off_t for bytesavail to + prevent warnings. + 2001-12-05 Jonathan Larmour * src/common/fflush.cxx (cyg_libc_stdio_flush_all_but): Fix starvation @@ -258,27 +302,36 @@ 2000-05-02 Jonathan Larmour posdiff ) { + if ( posdiff >= 0 && bytesavail > posdiff ) { // can just "seek" within the existing buffer #ifdef CYGFUN_LIBC_STDIO_ungetc - if (flags.unread_char_buf_in_use) { + if (posdiff>0 && flags.unread_char_buf_in_use) { flags.unread_char_buf_in_use = false; posdiff--; } diff --git a/packages/language/c/libc/stdio/current/include/streambuf.hxx b/packages/language/c/libc/stdio/current/include/streambuf.hxx --- a/packages/language/c/libc/stdio/current/include/streambuf.hxx +++ b/packages/language/c/libc/stdio/current/include/streambuf.hxx @@ -7,29 +7,38 @@ // Internal C library stdio stream buffer interface definitions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/include/streambuf.inl b/packages/language/c/libc/stdio/current/include/streambuf.inl --- a/packages/language/c/libc/stdio/current/include/streambuf.inl +++ b/packages/language/c/libc/stdio/current/include/streambuf.inl @@ -7,29 +7,38 @@ // Internal C library stdio stream buffer inline functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -66,8 +75,8 @@ // FUNCTIONS inline -Cyg_StdioStreamBuffer::Cyg_StdioStreamBuffer( cyg_ucount32 size=BUFSIZ, - cyg_uint8 *new_buffer=NULL ) : +Cyg_StdioStreamBuffer::Cyg_StdioStreamBuffer( cyg_ucount32 size, + cyg_uint8 *new_buffer ) : #if defined(CYGSEM_LIBC_STDIO_SETVBUF_MALLOC) call_free(false), buffer_bottom( NULL ), diff --git a/packages/language/c/libc/stdio/current/src/common/fclose.cxx b/packages/language/c/libc/stdio/current/src/common/fclose.cxx --- a/packages/language/c/libc/stdio/current/src/common/fclose.cxx +++ b/packages/language/c/libc/stdio/current/src/common/fclose.cxx @@ -5,29 +5,38 @@ // Implementation of C library file close function as per ANSI 7.9.5.1 // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -45,7 +54,7 @@ // CONFIGURATION #include // Configuration header - +#include // We can't have fclose() without fopen() #if defined(CYGPKG_LIBC_STDIO_OPEN) @@ -96,12 +105,15 @@ fclose( FILE *stream ) return EOF; } - // FIXME: should use delete? +#ifdef CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS // Explicitly call destructor - this flushes the output too real_stream->~Cyg_StdioStream(); // and free it free(real_stream); +#else + delete real_stream; +#endif // CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS // and mark the stream available for use Cyg_libc_stdio_files::set_file_stream(i, NULL); diff --git a/packages/language/c/libc/stdio/current/src/common/feof.cxx b/packages/language/c/libc/stdio/current/src/common/feof.cxx --- a/packages/language/c/libc/stdio/current/src/common/feof.cxx +++ b/packages/language/c/libc/stdio/current/src/common/feof.cxx @@ -5,29 +5,38 @@ // Implementations of ISO C feof(), ferror(), clearerr() functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/fflush.cxx b/packages/language/c/libc/stdio/current/src/common/fflush.cxx --- a/packages/language/c/libc/stdio/current/src/common/fflush.cxx +++ b/packages/language/c/libc/stdio/current/src/common/fflush.cxx @@ -5,29 +5,38 @@ // Implementation of C library file flush function as per ANSI 7.9.5.2 // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/fopen.cxx b/packages/language/c/libc/stdio/current/src/common/fopen.cxx --- a/packages/language/c/libc/stdio/current/src/common/fopen.cxx +++ b/packages/language/c/libc/stdio/current/src/common/fopen.cxx @@ -5,29 +5,38 @@ // Implementation of C library file open function as per ANSI 7.9.5.3 // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -65,6 +74,13 @@ // FUNCTIONS +// placement new +inline void *operator new(size_t size, void *ptr) +{ + CYG_CHECK_DATA_PTR( ptr, "Bad pointer" ); + return ptr; +} + // process the mode string. Return true on error static cyg_bool process_mode( const char *mode, Cyg_StdioStream::OpenMode *rw, @@ -150,16 +166,16 @@ static FILE *fopen_inner( cyg_stdio_hand bufmode = _IONBF, bufsize = 0; // Allocate it some memory and construct it. - curr_stream = new Cyg_StdioStream( dev, open_mode, append, binary, - bufmode, bufsize ); - + curr_stream = (Cyg_StdioStream *)malloc(sizeof(*curr_stream)); if (curr_stream == NULL) { cyg_stdio_close( dev ); errno = ENOMEM; return NULL; } // if - + curr_stream = new ((void *)curr_stream) Cyg_StdioStream( dev, open_mode, + append, binary, + bufmode, bufsize ); // it puts any error in its own error flag if (( err=curr_stream->get_error() )) { diff --git a/packages/language/c/libc/stdio/current/src/common/freopen.cxx b/packages/language/c/libc/stdio/current/src/common/freopen.cxx --- a/packages/language/c/libc/stdio/current/src/common/freopen.cxx +++ b/packages/language/c/libc/stdio/current/src/common/freopen.cxx @@ -5,29 +5,38 @@ // Implementation of C library freopen() function // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/fseek.cxx b/packages/language/c/libc/stdio/current/src/common/fseek.cxx --- a/packages/language/c/libc/stdio/current/src/common/fseek.cxx +++ b/packages/language/c/libc/stdio/current/src/common/fseek.cxx @@ -5,29 +5,38 @@ // Implementation of C library file positioning functions as per ANSI 7.9.9 // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/setvbuf.cxx b/packages/language/c/libc/stdio/current/src/common/setvbuf.cxx --- a/packages/language/c/libc/stdio/current/src/common/setvbuf.cxx +++ b/packages/language/c/libc/stdio/current/src/common/setvbuf.cxx @@ -5,29 +5,38 @@ // Implementation of C library buffering setup as per ANSI 7.9.5.6 // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/snprintf.cxx b/packages/language/c/libc/stdio/current/src/common/snprintf.cxx --- a/packages/language/c/libc/stdio/current/src/common/snprintf.cxx +++ b/packages/language/c/libc/stdio/current/src/common/snprintf.cxx @@ -5,29 +5,38 @@ // ANSI Stdio snprintf() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/sprintf.cxx b/packages/language/c/libc/stdio/current/src/common/sprintf.cxx --- a/packages/language/c/libc/stdio/current/src/common/sprintf.cxx +++ b/packages/language/c/libc/stdio/current/src/common/sprintf.cxx @@ -5,29 +5,38 @@ // ANSI Stdio sprintf() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/sscanf.cxx b/packages/language/c/libc/stdio/current/src/common/sscanf.cxx --- a/packages/language/c/libc/stdio/current/src/common/sscanf.cxx +++ b/packages/language/c/libc/stdio/current/src/common/sscanf.cxx @@ -5,29 +5,38 @@ // ANSI Stdio sscanf() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/stderr.cxx b/packages/language/c/libc/stdio/current/src/common/stderr.cxx --- a/packages/language/c/libc/stdio/current/src/common/stderr.cxx +++ b/packages/language/c/libc/stdio/current/src/common/stderr.cxx @@ -5,29 +5,38 @@ // Initialization of stderr stream for ISO C library // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/stdin.cxx b/packages/language/c/libc/stdio/current/src/common/stdin.cxx --- a/packages/language/c/libc/stdio/current/src/common/stdin.cxx +++ b/packages/language/c/libc/stdio/current/src/common/stdin.cxx @@ -5,29 +5,38 @@ // Initialization of stdin stream for ISO C library // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/stdiofiles.cxx b/packages/language/c/libc/stdio/current/src/common/stdiofiles.cxx --- a/packages/language/c/libc/stdio/current/src/common/stdiofiles.cxx +++ b/packages/language/c/libc/stdio/current/src/common/stdiofiles.cxx @@ -5,29 +5,38 @@ // ISO C library stdio central file data // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/stdioinlines.cxx b/packages/language/c/libc/stdio/current/src/common/stdioinlines.cxx --- a/packages/language/c/libc/stdio/current/src/common/stdioinlines.cxx +++ b/packages/language/c/libc/stdio/current/src/common/stdioinlines.cxx @@ -5,29 +5,38 @@ // ANSI standard I/O routines - real alternatives for inlined functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/stdiosupp.cxx b/packages/language/c/libc/stdio/current/src/common/stdiosupp.cxx --- a/packages/language/c/libc/stdio/current/src/common/stdiosupp.cxx +++ b/packages/language/c/libc/stdio/current/src/common/stdiosupp.cxx @@ -5,29 +5,38 @@ // Helper C library functions for standard I/O // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/stdout.cxx b/packages/language/c/libc/stdio/current/src/common/stdout.cxx --- a/packages/language/c/libc/stdio/current/src/common/stdout.cxx +++ b/packages/language/c/libc/stdio/current/src/common/stdout.cxx @@ -5,29 +5,38 @@ // Initialization of stdout stream for ISO C library // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/stream.cxx b/packages/language/c/libc/stdio/current/src/common/stream.cxx --- a/packages/language/c/libc/stdio/current/src/common/stream.cxx +++ b/packages/language/c/libc/stdio/current/src/common/stream.cxx @@ -5,29 +5,38 @@ // Implementations of internal C library stdio stream functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/streambuf.cxx b/packages/language/c/libc/stdio/current/src/common/streambuf.cxx --- a/packages/language/c/libc/stdio/current/src/common/streambuf.cxx +++ b/packages/language/c/libc/stdio/current/src/common/streambuf.cxx @@ -5,29 +5,38 @@ // C library stdio stream buffer functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -61,8 +70,8 @@ // FUNCTIONS Cyg_ErrNo -Cyg_StdioStreamBuffer::set_buffer( cyg_ucount32 size=BUFSIZ, - cyg_uint8 *new_buffer=NULL ) +Cyg_StdioStreamBuffer::set_buffer( cyg_ucount32 size, + cyg_uint8 *new_buffer ) { #ifdef CYGSEM_LIBC_STDIO_DYNAMIC_SETVBUF diff --git a/packages/language/c/libc/stdio/current/src/common/ungetc.cxx b/packages/language/c/libc/stdio/current/src/common/ungetc.cxx --- a/packages/language/c/libc/stdio/current/src/common/ungetc.cxx +++ b/packages/language/c/libc/stdio/current/src/common/ungetc.cxx @@ -5,29 +5,38 @@ // ANSI Stdio ungetc() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx b/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx --- a/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx +++ b/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx @@ -5,29 +5,38 @@ // ANSI Stdio vsnprintf() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/common/vsscanf.cxx b/packages/language/c/libc/stdio/current/src/common/vsscanf.cxx --- a/packages/language/c/libc/stdio/current/src/common/vsscanf.cxx +++ b/packages/language/c/libc/stdio/current/src/common/vsscanf.cxx @@ -5,29 +5,38 @@ // ANSI Stdio vsscanf() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/input/fgetc.cxx b/packages/language/c/libc/stdio/current/src/input/fgetc.cxx --- a/packages/language/c/libc/stdio/current/src/input/fgetc.cxx +++ b/packages/language/c/libc/stdio/current/src/input/fgetc.cxx @@ -5,29 +5,38 @@ // ISO C standard I/O get character functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -85,8 +94,10 @@ fgetc( FILE *stream ) if (err) { - real_stream->set_error( err ); - errno = err; + if ( EAGAIN != err ) { + real_stream->set_error( err ); + errno = err; + } CYG_REPORT_RETVAL(EOF); return EOF; } // if diff --git a/packages/language/c/libc/stdio/current/src/input/fgets.cxx b/packages/language/c/libc/stdio/current/src/input/fgets.cxx --- a/packages/language/c/libc/stdio/current/src/input/fgets.cxx +++ b/packages/language/c/libc/stdio/current/src/input/fgets.cxx @@ -5,29 +5,38 @@ // ISO C standard I/O fgets() function // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/input/fread.cxx b/packages/language/c/libc/stdio/current/src/input/fread.cxx --- a/packages/language/c/libc/stdio/current/src/input/fread.cxx +++ b/packages/language/c/libc/stdio/current/src/input/fread.cxx @@ -5,29 +5,38 @@ // ANSI Stdio fread() function // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // @@ -91,7 +100,7 @@ fread( void *ptr, size_t object_size, si while (!err && bytes_to_read) { // if no err, but not finished - get next err = real_stream->refill_read_buffer(); if ( !err ) { - err = real_stream->read( (cyg_uint8 *)ptr, bytes_to_read, + err = real_stream->read( (cyg_uint8 *)ptrc, bytes_to_read, &bytes_read ); bytes_to_read -= bytes_read; total_read += bytes_read; diff --git a/packages/language/c/libc/stdio/current/src/input/fscanf.cxx b/packages/language/c/libc/stdio/current/src/input/fscanf.cxx --- a/packages/language/c/libc/stdio/current/src/input/fscanf.cxx +++ b/packages/language/c/libc/stdio/current/src/input/fscanf.cxx @@ -5,29 +5,38 @@ // ANSI Stdio fscanf() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/input/gets.cxx b/packages/language/c/libc/stdio/current/src/input/gets.cxx --- a/packages/language/c/libc/stdio/current/src/input/gets.cxx +++ b/packages/language/c/libc/stdio/current/src/input/gets.cxx @@ -5,29 +5,38 @@ // ISO C standard I/O gets() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/input/scanf.cxx b/packages/language/c/libc/stdio/current/src/input/scanf.cxx --- a/packages/language/c/libc/stdio/current/src/input/scanf.cxx +++ b/packages/language/c/libc/stdio/current/src/input/scanf.cxx @@ -5,29 +5,38 @@ // ANSI Stdio scanf() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/input/vfscanf.cxx b/packages/language/c/libc/stdio/current/src/input/vfscanf.cxx --- a/packages/language/c/libc/stdio/current/src/input/vfscanf.cxx +++ b/packages/language/c/libc/stdio/current/src/input/vfscanf.cxx @@ -5,29 +5,38 @@ // I/O routines for vfscanf() for use with ANSI C library // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/output/fnprintf.cxx b/packages/language/c/libc/stdio/current/src/output/fnprintf.cxx --- a/packages/language/c/libc/stdio/current/src/output/fnprintf.cxx +++ b/packages/language/c/libc/stdio/current/src/output/fnprintf.cxx @@ -5,29 +5,38 @@ // ANSI Stdio fnprintf() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/output/fprintf.cxx b/packages/language/c/libc/stdio/current/src/output/fprintf.cxx --- a/packages/language/c/libc/stdio/current/src/output/fprintf.cxx +++ b/packages/language/c/libc/stdio/current/src/output/fprintf.cxx @@ -5,29 +5,38 @@ // ANSI Stdio fprintf() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/output/fputc.cxx b/packages/language/c/libc/stdio/current/src/output/fputc.cxx --- a/packages/language/c/libc/stdio/current/src/output/fputc.cxx +++ b/packages/language/c/libc/stdio/current/src/output/fputc.cxx @@ -5,29 +5,38 @@ // ISO Standard I/O character output functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/output/fputs.cxx b/packages/language/c/libc/stdio/current/src/output/fputs.cxx --- a/packages/language/c/libc/stdio/current/src/output/fputs.cxx +++ b/packages/language/c/libc/stdio/current/src/output/fputs.cxx @@ -5,29 +5,38 @@ // ANSI Stdio fputs() function // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/output/fwrite.cxx b/packages/language/c/libc/stdio/current/src/output/fwrite.cxx --- a/packages/language/c/libc/stdio/current/src/output/fwrite.cxx +++ b/packages/language/c/libc/stdio/current/src/output/fwrite.cxx @@ -5,29 +5,38 @@ // ANSI Stdio fwrite() function // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/output/printf.cxx b/packages/language/c/libc/stdio/current/src/output/printf.cxx --- a/packages/language/c/libc/stdio/current/src/output/printf.cxx +++ b/packages/language/c/libc/stdio/current/src/output/printf.cxx @@ -5,29 +5,38 @@ // ANSI Stdio printf() function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx b/packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx --- a/packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx +++ b/packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx @@ -5,29 +5,38 @@ // I/O routines for vfnprintf() for use with ANSI C library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/tests/sprintf1.c b/packages/language/c/libc/stdio/current/tests/sprintf1.c --- a/packages/language/c/libc/stdio/current/tests/sprintf1.c +++ b/packages/language/c/libc/stdio/current/tests/sprintf1.c @@ -5,29 +5,38 @@ // Testcase for C library sprintf() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/tests/sprintf2.c b/packages/language/c/libc/stdio/current/tests/sprintf2.c --- a/packages/language/c/libc/stdio/current/tests/sprintf2.c +++ b/packages/language/c/libc/stdio/current/tests/sprintf2.c @@ -5,29 +5,38 @@ // Testcase for C library sprintf() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/tests/sscanf.c b/packages/language/c/libc/stdio/current/tests/sscanf.c --- a/packages/language/c/libc/stdio/current/tests/sscanf.c +++ b/packages/language/c/libc/stdio/current/tests/sscanf.c @@ -5,29 +5,38 @@ // Testcase for C library sscanf() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdio/current/tests/stdiooutput.c b/packages/language/c/libc/stdio/current/tests/stdiooutput.c --- a/packages/language/c/libc/stdio/current/tests/stdiooutput.c +++ b/packages/language/c/libc/stdio/current/tests/stdiooutput.c @@ -5,29 +5,38 @@ // Testcase for miscellaneous C library output functions // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/stdlib/current/ChangeLog b/packages/language/c/libc/stdlib/current/ChangeLog --- a/packages/language/c/libc/stdlib/current/ChangeLog +++ b/packages/language/c/libc/stdlib/current/ChangeLog @@ -45,27 +45,36 @@ 2000-05-02 Jonathan Larmour // Header for this file #include // Useful string function support and // prototypes - // EXPORTED SYMBOLS externC int diff --git a/packages/language/c/libc/string/current/src/strcpy.cxx b/packages/language/c/libc/string/current/src/strcpy.cxx --- a/packages/language/c/libc/string/current/src/strcpy.cxx +++ b/packages/language/c/libc/string/current/src/strcpy.cxx @@ -5,29 +5,38 @@ // ANSI standard strcpy() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strcspn.cxx b/packages/language/c/libc/string/current/src/strcspn.cxx --- a/packages/language/c/libc/string/current/src/strcspn.cxx +++ b/packages/language/c/libc/string/current/src/strcspn.cxx @@ -5,29 +5,38 @@ // ANSI standard strcspn() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strlen.cxx b/packages/language/c/libc/string/current/src/strlen.cxx --- a/packages/language/c/libc/string/current/src/strlen.cxx +++ b/packages/language/c/libc/string/current/src/strlen.cxx @@ -5,29 +5,38 @@ // ANSI standard strlen() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strncat.cxx b/packages/language/c/libc/string/current/src/strncat.cxx --- a/packages/language/c/libc/string/current/src/strncat.cxx +++ b/packages/language/c/libc/string/current/src/strncat.cxx @@ -5,29 +5,38 @@ // ANSI standard strncat() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strncmp.cxx b/packages/language/c/libc/string/current/src/strncmp.cxx --- a/packages/language/c/libc/string/current/src/strncmp.cxx +++ b/packages/language/c/libc/string/current/src/strncmp.cxx @@ -5,29 +5,38 @@ // ANSI standard strncmp() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strncpy.cxx b/packages/language/c/libc/string/current/src/strncpy.cxx --- a/packages/language/c/libc/string/current/src/strncpy.cxx +++ b/packages/language/c/libc/string/current/src/strncpy.cxx @@ -5,29 +5,38 @@ // ISO C standard strncpy() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strpbrk.cxx b/packages/language/c/libc/string/current/src/strpbrk.cxx --- a/packages/language/c/libc/string/current/src/strpbrk.cxx +++ b/packages/language/c/libc/string/current/src/strpbrk.cxx @@ -5,29 +5,38 @@ // ANSI standard strpbrk() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strrchr.cxx b/packages/language/c/libc/string/current/src/strrchr.cxx --- a/packages/language/c/libc/string/current/src/strrchr.cxx +++ b/packages/language/c/libc/string/current/src/strrchr.cxx @@ -5,29 +5,38 @@ // ANSI standard strrchr() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strspn.cxx b/packages/language/c/libc/string/current/src/strspn.cxx --- a/packages/language/c/libc/string/current/src/strspn.cxx +++ b/packages/language/c/libc/string/current/src/strspn.cxx @@ -5,29 +5,38 @@ // ANSI standard strspn() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strstr.cxx b/packages/language/c/libc/string/current/src/strstr.cxx --- a/packages/language/c/libc/string/current/src/strstr.cxx +++ b/packages/language/c/libc/string/current/src/strstr.cxx @@ -5,29 +5,38 @@ // ANSI standard strstr() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strsuppt.cxx b/packages/language/c/libc/string/current/src/strsuppt.cxx --- a/packages/language/c/libc/string/current/src/strsuppt.cxx +++ b/packages/language/c/libc/string/current/src/strsuppt.cxx @@ -5,29 +5,38 @@ // Support for the ANSI standard string functions // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strtok.cxx b/packages/language/c/libc/string/current/src/strtok.cxx --- a/packages/language/c/libc/string/current/src/strtok.cxx +++ b/packages/language/c/libc/string/current/src/strtok.cxx @@ -5,29 +5,38 @@ // ISO standard strtok() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/src/strxfrm.cxx b/packages/language/c/libc/string/current/src/strxfrm.cxx --- a/packages/language/c/libc/string/current/src/strxfrm.cxx +++ b/packages/language/c/libc/string/current/src/strxfrm.cxx @@ -5,29 +5,38 @@ // ANSI standard strxfrm() routine // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/memchr.c b/packages/language/c/libc/string/current/tests/memchr.c --- a/packages/language/c/libc/string/current/tests/memchr.c +++ b/packages/language/c/libc/string/current/tests/memchr.c @@ -5,29 +5,38 @@ // Testcase for C library memchr() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/memcmp1.c b/packages/language/c/libc/string/current/tests/memcmp1.c --- a/packages/language/c/libc/string/current/tests/memcmp1.c +++ b/packages/language/c/libc/string/current/tests/memcmp1.c @@ -5,29 +5,38 @@ // Testcase for C library memcmp() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/memcmp2.c b/packages/language/c/libc/string/current/tests/memcmp2.c --- a/packages/language/c/libc/string/current/tests/memcmp2.c +++ b/packages/language/c/libc/string/current/tests/memcmp2.c @@ -5,29 +5,38 @@ // Testcase for C library memcmp() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/memcpy1.c b/packages/language/c/libc/string/current/tests/memcpy1.c --- a/packages/language/c/libc/string/current/tests/memcpy1.c +++ b/packages/language/c/libc/string/current/tests/memcpy1.c @@ -5,29 +5,38 @@ // Testcase for C library memcpy() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/memcpy2.c b/packages/language/c/libc/string/current/tests/memcpy2.c --- a/packages/language/c/libc/string/current/tests/memcpy2.c +++ b/packages/language/c/libc/string/current/tests/memcpy2.c @@ -5,29 +5,38 @@ // Testcase for C library memcpy() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/memmove1.c b/packages/language/c/libc/string/current/tests/memmove1.c --- a/packages/language/c/libc/string/current/tests/memmove1.c +++ b/packages/language/c/libc/string/current/tests/memmove1.c @@ -5,29 +5,38 @@ // Testcase for C library memmove() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/memmove2.c b/packages/language/c/libc/string/current/tests/memmove2.c --- a/packages/language/c/libc/string/current/tests/memmove2.c +++ b/packages/language/c/libc/string/current/tests/memmove2.c @@ -5,29 +5,38 @@ // Testcase for C library memmove() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/memset.c b/packages/language/c/libc/string/current/tests/memset.c --- a/packages/language/c/libc/string/current/tests/memset.c +++ b/packages/language/c/libc/string/current/tests/memset.c @@ -5,29 +5,38 @@ // Testcase for C library memset() function // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strcat1.c b/packages/language/c/libc/string/current/tests/strcat1.c --- a/packages/language/c/libc/string/current/tests/strcat1.c +++ b/packages/language/c/libc/string/current/tests/strcat1.c @@ -5,29 +5,38 @@ // Testcase for C library strcat() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strcat2.c b/packages/language/c/libc/string/current/tests/strcat2.c --- a/packages/language/c/libc/string/current/tests/strcat2.c +++ b/packages/language/c/libc/string/current/tests/strcat2.c @@ -5,29 +5,38 @@ // Testcase for C library strcat() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strchr.c b/packages/language/c/libc/string/current/tests/strchr.c --- a/packages/language/c/libc/string/current/tests/strchr.c +++ b/packages/language/c/libc/string/current/tests/strchr.c @@ -5,29 +5,38 @@ // Testcase for C library strchr() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strcmp1.c b/packages/language/c/libc/string/current/tests/strcmp1.c --- a/packages/language/c/libc/string/current/tests/strcmp1.c +++ b/packages/language/c/libc/string/current/tests/strcmp1.c @@ -5,29 +5,38 @@ // Testcase for C library strcmp() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strcmp2.c b/packages/language/c/libc/string/current/tests/strcmp2.c --- a/packages/language/c/libc/string/current/tests/strcmp2.c +++ b/packages/language/c/libc/string/current/tests/strcmp2.c @@ -5,29 +5,38 @@ // Testcase for C library strcmp() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strcoll1.c b/packages/language/c/libc/string/current/tests/strcoll1.c --- a/packages/language/c/libc/string/current/tests/strcoll1.c +++ b/packages/language/c/libc/string/current/tests/strcoll1.c @@ -5,29 +5,38 @@ // Testcase for C library strcoll() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strcoll2.c b/packages/language/c/libc/string/current/tests/strcoll2.c --- a/packages/language/c/libc/string/current/tests/strcoll2.c +++ b/packages/language/c/libc/string/current/tests/strcoll2.c @@ -5,29 +5,38 @@ // Testcase for C library strcoll() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strcpy1.c b/packages/language/c/libc/string/current/tests/strcpy1.c --- a/packages/language/c/libc/string/current/tests/strcpy1.c +++ b/packages/language/c/libc/string/current/tests/strcpy1.c @@ -5,29 +5,38 @@ // Testcase for C library strcpy() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strcpy2.c b/packages/language/c/libc/string/current/tests/strcpy2.c --- a/packages/language/c/libc/string/current/tests/strcpy2.c +++ b/packages/language/c/libc/string/current/tests/strcpy2.c @@ -5,29 +5,38 @@ // Testcase for C library strcpy() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strcspn.c b/packages/language/c/libc/string/current/tests/strcspn.c --- a/packages/language/c/libc/string/current/tests/strcspn.c +++ b/packages/language/c/libc/string/current/tests/strcspn.c @@ -5,29 +5,38 @@ // Testcase for C library strcspn() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strlen.c b/packages/language/c/libc/string/current/tests/strlen.c --- a/packages/language/c/libc/string/current/tests/strlen.c +++ b/packages/language/c/libc/string/current/tests/strlen.c @@ -5,29 +5,38 @@ // Testcase for C library strlen() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strncat1.c b/packages/language/c/libc/string/current/tests/strncat1.c --- a/packages/language/c/libc/string/current/tests/strncat1.c +++ b/packages/language/c/libc/string/current/tests/strncat1.c @@ -5,29 +5,38 @@ // Testcase for C library strncat() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strncat2.c b/packages/language/c/libc/string/current/tests/strncat2.c --- a/packages/language/c/libc/string/current/tests/strncat2.c +++ b/packages/language/c/libc/string/current/tests/strncat2.c @@ -5,29 +5,38 @@ // Testcase for C library strncat() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strncpy1.c b/packages/language/c/libc/string/current/tests/strncpy1.c --- a/packages/language/c/libc/string/current/tests/strncpy1.c +++ b/packages/language/c/libc/string/current/tests/strncpy1.c @@ -5,29 +5,38 @@ // Testcase for C library strncpy() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strncpy2.c b/packages/language/c/libc/string/current/tests/strncpy2.c --- a/packages/language/c/libc/string/current/tests/strncpy2.c +++ b/packages/language/c/libc/string/current/tests/strncpy2.c @@ -5,29 +5,38 @@ // Testcase for C library strncpy() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strpbrk.c b/packages/language/c/libc/string/current/tests/strpbrk.c --- a/packages/language/c/libc/string/current/tests/strpbrk.c +++ b/packages/language/c/libc/string/current/tests/strpbrk.c @@ -5,29 +5,38 @@ // Testcase for C library strpbrk() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strrchr.c b/packages/language/c/libc/string/current/tests/strrchr.c --- a/packages/language/c/libc/string/current/tests/strrchr.c +++ b/packages/language/c/libc/string/current/tests/strrchr.c @@ -5,29 +5,38 @@ // Testcase for C library strrchr() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strspn.c b/packages/language/c/libc/string/current/tests/strspn.c --- a/packages/language/c/libc/string/current/tests/strspn.c +++ b/packages/language/c/libc/string/current/tests/strspn.c @@ -5,29 +5,38 @@ // Testcase for C library strspn() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strstr.c b/packages/language/c/libc/string/current/tests/strstr.c --- a/packages/language/c/libc/string/current/tests/strstr.c +++ b/packages/language/c/libc/string/current/tests/strstr.c @@ -5,29 +5,38 @@ // Testcase for C library strstr() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strtok.c b/packages/language/c/libc/string/current/tests/strtok.c --- a/packages/language/c/libc/string/current/tests/strtok.c +++ b/packages/language/c/libc/string/current/tests/strtok.c @@ -5,29 +5,38 @@ // Testcase for C library strtok() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strxfrm1.c b/packages/language/c/libc/string/current/tests/strxfrm1.c --- a/packages/language/c/libc/string/current/tests/strxfrm1.c +++ b/packages/language/c/libc/string/current/tests/strxfrm1.c @@ -5,29 +5,38 @@ // Testcase for C library strxfrm() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/string/current/tests/strxfrm2.c b/packages/language/c/libc/string/current/tests/strxfrm2.c --- a/packages/language/c/libc/string/current/tests/strxfrm2.c +++ b/packages/language/c/libc/string/current/tests/strxfrm2.c @@ -5,29 +5,38 @@ // Testcase for C library strxfrm() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/ChangeLog b/packages/language/c/libc/time/current/ChangeLog --- a/packages/language/c/libc/time/current/ChangeLog +++ b/packages/language/c/libc/time/current/ChangeLog @@ -1,3 +1,9 @@ +2002-05-14 Jesper Skov + + * cdl/time.cdl: Added -Wno-format to the compiler flags. This is + to avoid warnings about Y2K problems with the format specifiers + used in the strftime test. + 2002-01-09 Nick Garnett * tests/clock.c (cyg_start): Added CYG_TEST_INIT() to @@ -89,27 +95,36 @@ 2000-05-02 Jonathan Larmour // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/include/timeutil.h b/packages/language/c/libc/time/current/include/timeutil.h --- a/packages/language/c/libc/time/current/include/timeutil.h +++ b/packages/language/c/libc/time/current/include/timeutil.h @@ -7,29 +7,38 @@ // ISO C date and time implementation support functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/asctime.cxx b/packages/language/c/libc/time/current/src/asctime.cxx --- a/packages/language/c/libc/time/current/src/asctime.cxx +++ b/packages/language/c/libc/time/current/src/asctime.cxx @@ -5,29 +5,38 @@ // ISO C date and time implementation for asctime() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/asctime_r.cxx b/packages/language/c/libc/time/current/src/asctime_r.cxx --- a/packages/language/c/libc/time/current/src/asctime_r.cxx +++ b/packages/language/c/libc/time/current/src/asctime_r.cxx @@ -5,29 +5,38 @@ // POSIX 1003.1 date and time implementation for asctime_r() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/clock.cxx b/packages/language/c/libc/time/current/src/clock.cxx --- a/packages/language/c/libc/time/current/src/clock.cxx +++ b/packages/language/c/libc/time/current/src/clock.cxx @@ -5,29 +5,38 @@ // ISO C date and time implementation for clock() // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/ctime.cxx b/packages/language/c/libc/time/current/src/ctime.cxx --- a/packages/language/c/libc/time/current/src/ctime.cxx +++ b/packages/language/c/libc/time/current/src/ctime.cxx @@ -5,29 +5,38 @@ // ISO C date and time implementation for ctime() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/ctime_r.cxx b/packages/language/c/libc/time/current/src/ctime_r.cxx --- a/packages/language/c/libc/time/current/src/ctime_r.cxx +++ b/packages/language/c/libc/time/current/src/ctime_r.cxx @@ -5,29 +5,38 @@ // POSIX 1003.1 date and time implementation for ctime_r() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/difftime.cxx b/packages/language/c/libc/time/current/src/difftime.cxx --- a/packages/language/c/libc/time/current/src/difftime.cxx +++ b/packages/language/c/libc/time/current/src/difftime.cxx @@ -5,29 +5,38 @@ // ISO C date and time implementation for difftime() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/gmtime.cxx b/packages/language/c/libc/time/current/src/gmtime.cxx --- a/packages/language/c/libc/time/current/src/gmtime.cxx +++ b/packages/language/c/libc/time/current/src/gmtime.cxx @@ -5,29 +5,38 @@ // ISO C date and time implementation for gmtime() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/gmtime_r.cxx b/packages/language/c/libc/time/current/src/gmtime_r.cxx --- a/packages/language/c/libc/time/current/src/gmtime_r.cxx +++ b/packages/language/c/libc/time/current/src/gmtime_r.cxx @@ -5,29 +5,38 @@ // POSIX 1003.1 date and time implementation for gmtime_r() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/localtime.cxx b/packages/language/c/libc/time/current/src/localtime.cxx --- a/packages/language/c/libc/time/current/src/localtime.cxx +++ b/packages/language/c/libc/time/current/src/localtime.cxx @@ -5,29 +5,38 @@ // ISO C date and time implementation for localtime() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/localtime_r.cxx b/packages/language/c/libc/time/current/src/localtime_r.cxx --- a/packages/language/c/libc/time/current/src/localtime_r.cxx +++ b/packages/language/c/libc/time/current/src/localtime_r.cxx @@ -5,29 +5,38 @@ // POSIX 1003.1 date and time implementation for localtime_r() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/mktime.cxx b/packages/language/c/libc/time/current/src/mktime.cxx --- a/packages/language/c/libc/time/current/src/mktime.cxx +++ b/packages/language/c/libc/time/current/src/mktime.cxx @@ -5,29 +5,38 @@ // ISO C date and time implementation for mktime() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/settime.cxx b/packages/language/c/libc/time/current/src/settime.cxx --- a/packages/language/c/libc/time/current/src/settime.cxx +++ b/packages/language/c/libc/time/current/src/settime.cxx @@ -5,29 +5,38 @@ // Date and time support function to set time // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/strftime.cxx b/packages/language/c/libc/time/current/src/strftime.cxx --- a/packages/language/c/libc/time/current/src/strftime.cxx +++ b/packages/language/c/libc/time/current/src/strftime.cxx @@ -5,29 +5,38 @@ // ISO C date and time implementation for strftime() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/time.cxx b/packages/language/c/libc/time/current/src/time.cxx --- a/packages/language/c/libc/time/current/src/time.cxx +++ b/packages/language/c/libc/time/current/src/time.cxx @@ -5,29 +5,38 @@ // ISO C date and time implementation for time() // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/src/timeutil.cxx b/packages/language/c/libc/time/current/src/timeutil.cxx --- a/packages/language/c/libc/time/current/src/timeutil.cxx +++ b/packages/language/c/libc/time/current/src/timeutil.cxx @@ -5,29 +5,38 @@ // ISO C date and time implementation support functions // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/tests/asctime.c b/packages/language/c/libc/time/current/tests/asctime.c --- a/packages/language/c/libc/time/current/tests/asctime.c +++ b/packages/language/c/libc/time/current/tests/asctime.c @@ -5,29 +5,38 @@ // Testcase for C library asctime() function // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/tests/clock.c b/packages/language/c/libc/time/current/tests/clock.c --- a/packages/language/c/libc/time/current/tests/clock.c +++ b/packages/language/c/libc/time/current/tests/clock.c @@ -5,29 +5,38 @@ // Testcase for C library clock() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/tests/ctime.c b/packages/language/c/libc/time/current/tests/ctime.c --- a/packages/language/c/libc/time/current/tests/ctime.c +++ b/packages/language/c/libc/time/current/tests/ctime.c @@ -5,29 +5,38 @@ // Testcase for C library ctime() function // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/tests/gmtime.c b/packages/language/c/libc/time/current/tests/gmtime.c --- a/packages/language/c/libc/time/current/tests/gmtime.c +++ b/packages/language/c/libc/time/current/tests/gmtime.c @@ -5,29 +5,38 @@ // Testcase for C library gmtime() function // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/tests/localtime.c b/packages/language/c/libc/time/current/tests/localtime.c --- a/packages/language/c/libc/time/current/tests/localtime.c +++ b/packages/language/c/libc/time/current/tests/localtime.c @@ -5,29 +5,38 @@ // Testcase for C library localtime() function // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/tests/mktime.c b/packages/language/c/libc/time/current/tests/mktime.c --- a/packages/language/c/libc/time/current/tests/mktime.c +++ b/packages/language/c/libc/time/current/tests/mktime.c @@ -5,29 +5,38 @@ // Testcase for C library mktime() function // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/tests/strftime.c b/packages/language/c/libc/time/current/tests/strftime.c --- a/packages/language/c/libc/time/current/tests/strftime.c +++ b/packages/language/c/libc/time/current/tests/strftime.c @@ -5,29 +5,38 @@ // Testcase for C library strftime() function // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libc/time/current/tests/time.c b/packages/language/c/libc/time/current/tests/time.c --- a/packages/language/c/libc/time/current/tests/time.c +++ b/packages/language/c/libc/time/current/tests/time.c @@ -5,29 +5,38 @@ // Testcase for C library time() // //================================================================= -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //================================================================= //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/ChangeLog b/packages/language/c/libm/current/ChangeLog --- a/packages/language/c/libm/current/ChangeLog +++ b/packages/language/c/libm/current/ChangeLog @@ -789,27 +789,36 @@ Fri Jun 5 07:07:03 1998 Jonathan Larmo //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== diff --git a/packages/language/c/libm/current/cdl/compat.cdl b/packages/language/c/libm/current/cdl/compat.cdl --- a/packages/language/c/libm/current/cdl/compat.cdl +++ b/packages/language/c/libm/current/cdl/compat.cdl @@ -5,29 +5,38 @@ # Maths library compatibility related configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # diff --git a/packages/language/c/libm/current/cdl/libm.cdl b/packages/language/c/libm/current/cdl/libm.cdl --- a/packages/language/c/libm/current/cdl/libm.cdl +++ b/packages/language/c/libm/current/cdl/libm.cdl @@ -5,29 +5,38 @@ # Maths library configuration data # # ==================================================================== -#####COPYRIGHTBEGIN#### -# -# ------------------------------------------- -# The contents of this file are subject to the Red Hat eCos Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.redhat.com/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -# License for the specific language governing rights and limitations under -# the License. -# -# The Original Code is eCos - Embedded Configurable Operating System, -# released September 30, 1998. -# -# The Initial Developer of the Original Code is Red Hat. -# Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -# All Rights Reserved. -# ------------------------------------------- -# -#####COPYRIGHTEND#### +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### # ==================================================================== ######DESCRIPTIONBEGIN#### # @@ -114,6 +123,22 @@ cdl_package CYGPKG_LIBM { implies that it also becomes thread-safe." } + cdl_option CYGSEM_LIBM_THREAD_SAFE_GAMMA_FUNCTIONS { + display "gamma() and lgamma()" + requires CYGVAR_KERNEL_THREADS_DATA + default_value 0 + description " + This option makes the gamma() and lgamma() + functions be thread-safe. Note that these + functions are identical - they take the log of + the absolute value of their argument. The sign + of the argument is stored in a variable called + signgam. Enabling this option makes signgam + a per-thread variable. Note there are also + gamma_r() and lgamma_r() alternatives that + allow signgam to be passed in by reference as + an argument." + } } # TRACING OPTIONS @@ -141,9 +166,33 @@ cdl_package CYGPKG_LIBM { configured to be thread-safe." } + cdl_option CYGNUM_LIBM_SIGNGAM_TRACE_LEVEL { + display "signgam variable access" + requires CYGSEM_LIBM_THREAD_SAFE_GAMMA_FUNCTIONS + flavor data + legal_values 0 to 1 + default_value 0 + description " + Trace level for debugging all accesses to the + signgam variable in thread-safe mode." + } } - + # OTHER CONFIGURATION SETTINGS + cdl_option X_TLOSS { + display "Bessel function limit of significance" + flavor data + default_value 1.41484755040568800000e+16; # pi*(2**52) + legal_values 1 to 1e308; # FIXME + description " + For the Bessel functions (j0(), j1(), jn(), + y0(), y1(), yn()) this option defines the + maximum absolute value of the ordinate + before we assume total loss of significance. + This number must be a floating-point number (e.g. + contains a decimal point), and should be + large." + } define_proc { puts $::cdl_header "/***** proc output start *****/" diff --git a/packages/language/c/libm/current/include/math.h b/packages/language/c/libm/current/include/math.h --- a/packages/language/c/libm/current/include/math.h +++ b/packages/language/c/libm/current/include/math.h @@ -7,29 +7,38 @@ // Standard mathematical functions conforming to ANSI and other standards // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -149,6 +158,21 @@ cyg_libm_set_compat_mode( Cyg_libm_compa #endif // ifdef CYGSEM_LIBM_THREAD_SAFE_COMPAT_MODE +#ifdef CYGSEM_LIBM_THREAD_SAFE_GAMMA_FUNCTIONS + +// FIXME: these need to be documented and signgam mentioned as non-ISO +// This returns the address of the signgam variable used by the gamma*() and +// lgamma*() functions +externC int * +cyg_libm_get_signgam_p( void ); + +#define signgam (*cyg_libm_get_signgam_p()) + +#else + +externC int signgam; + +#endif // ifdef CYGSEM_LIBM_THREAD_SAFE_GAMMA_FUNCTIONS //=========================================================================== // Standard ANSI functions. Angles are always in radians @@ -242,6 +266,77 @@ externC int matherr( struct exception * ); // User-overridable error handling - see #endif // for a discussion +// FIXME: from here needs to be documented and mentioned as non-ISO +// Arc Hyperbolic trigonometric functions + +externC double +acosh( double ); // Arc hyperbolic cos i.e. inverse cosh + +externC double +asinh( double ); // Arc hyperbolic sin i.e. inverse sinh + +externC double +atanh( double ); // Arc hyperbolic tan i.e. inverse tanh + +// Error functions + +externC double // Error function, such that +erf( double ); // erf(x) = 2/sqrt(pi) * integral from + // 0 to x of e**(-t**2) dt + +externC double // Complementary error function - simply +erfc( double ); // 1.0 - erf(x) + +// Gamma functions + +externC double // Logarithm of the absolute value of the +lgamma( double ); // gamma function of the argument. The + // integer signgam is used to store the + // sign of the gamma function of the arg + +externC double +lgamma_r( double, int * ); // Re-entrant version of the above, where + // the user passes the location of signgam + // as the second argument + +externC double // Identical to lgamma()! +gamma( double ); // The reasons for this are historical, + // and may be changed in future standards + // + // To get the real gamma function, you should + // use: l=lgamma(x); g=signgam*exp(l); + // + // Do not just do signgam*exp(lgamma(x)) + // as lgamma() modifies signgam + +externC double +gamma_r( double, int * ); // Identical to lgamma_r(). See above. + + +// Bessel functions + +externC double // Zero-th order Bessel function of the +j0( double ); // first kind at the ordinate of the argument + +externC double // First-order Bessel function of the +j1( double ); // first kind at the ordinate of the argument + +externC double // Bessel function of the first kind of the +jn( int, double ); // order of the first argument at the + // ordinate of the second argument + +externC double // Zero-th order Bessel function of the +y0( double ); // second kind at the ordinate of the + // argument + +externC double // First-order Bessel function of the +y1( double ); // second kind at the ordinate of the + // argument + +externC double // Bessel function of the second kind of the +yn( int, double ); // order of the first argument at the + // ordinate of the second argument + // scalb*() externC double // scalbn(x,n) returns x*(2**n) @@ -260,6 +355,11 @@ scalb( double, int ); // as // And the rest +externC double +cbrt( double ); // Cube Root + +externC double // hypotenuse function, defined such that: +hypot( double, double ); // hypot(x,y)==sqrt(x**2 + y**2) externC int // whether the argument is NaN isnan( double ); @@ -267,6 +367,27 @@ isnan( double ); externC int finite( double ); // whether the argument is finite +externC double // logb returns the binary exponent of its +logb( double ); // argument as an integral value + // This is not recommended - use ilogb + // instead + +externC int // As for logb, but has the more correct +ilogb( double ); // return value type of int + + +externC double // nextafter(x,y) returns the next +nextafter( double, double ); // representable floating point number + // adjacent to x in the direction of y + // i.e. the next greater FP if y>x, the next + // less FP if y // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_acosh.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* + * wrapper acosh(x) + */ + +#include "mathincl/fdlibm.h" + + double acosh(double x) /* wrapper acosh */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_acosh(x); +#else + double z; + z = __ieee754_acosh(x); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || isnan(x)) return z; + if(x<1.0) { + return __kernel_standard(x,x,29); /* acosh(x<1) */ + } else + return z; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_acosh.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_asin.c b/packages/language/c/libm/current/src/double/ieee754-api/w_asin.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_asin.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_asin.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_atan2.c b/packages/language/c/libm/current/src/double/ieee754-api/w_atan2.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_atan2.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_atan2.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_atanh.c b/packages/language/c/libm/current/src/double/ieee754-api/w_atanh.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_atanh.c @@ -0,0 +1,103 @@ +//=========================================================================== +// +// w_atanh.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_atanh.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ +/* + * wrapper atanh(x) + */ + +#include "mathincl/fdlibm.h" + + + double atanh(double x) /* wrapper atanh */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_atanh(x); +#else + double z,y; + z = __ieee754_atanh(x); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || isnan(x)) return z; + y = fabs(x); + if(y>=1.0) { + if(y>1.0) + return __kernel_standard(x,x,30); /* atanh(|x|>1) */ + else + return __kernel_standard(x,x,31); /* atanh(|x|==1) */ + } else + return z; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_atanh.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_cosh.c b/packages/language/c/libm/current/src/double/ieee754-api/w_cosh.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_cosh.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_cosh.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_exp.c b/packages/language/c/libm/current/src/double/ieee754-api/w_exp.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_exp.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_exp.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_fmod.c b/packages/language/c/libm/current/src/double/ieee754-api/w_fmod.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_fmod.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_fmod.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_gamma.c b/packages/language/c/libm/current/src/double/ieee754-api/w_gamma.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_gamma.c @@ -0,0 +1,108 @@ +//=========================================================================== +// +// w_gamma.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_gamma.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* double gamma(double x) + * Return the logarithm of the Gamma function of x. + * + * Method: call gamma_r + */ + +#include +#include "mathincl/fdlibm.h" + + +double +gamma(double x) +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_gamma_r(x,&signgam); +#else + double y; + y = __ieee754_gamma_r(x,&signgam); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE) return y; + if(!finite(y)&&finite(x)) { + if(floor(x)==x&&x<=0.0) + return __kernel_standard(x,x,41); /* gamma pole */ + else + return __kernel_standard(x,x,40); /* gamma overflow */ + } else + return y; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_gamma.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_gamma_r.c b/packages/language/c/libm/current/src/double/ieee754-api/w_gamma_r.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_gamma_r.c @@ -0,0 +1,103 @@ +//=========================================================================== +// +// w_gamma_r.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_gamma_r.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper double gamma_r(double x, int *signgamp) + */ + +#include "mathincl/fdlibm.h" + + + double gamma_r(double x, int *signgamp) /* wrapper lgamma_r */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_gamma_r(x,signgamp); +#else + double y; + y = __ieee754_gamma_r(x,signgamp); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE) return y; + if(!finite(y)&&finite(x)) { + if(floor(x)==x&&x<=0.0) + return __kernel_standard(x,x,41); /* gamma pole */ + else + return __kernel_standard(x,x,40); /* gamma overflow */ + } else + return y; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_gamma_r.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_hypot.c b/packages/language/c/libm/current/src/double/ieee754-api/w_hypot.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_hypot.c @@ -0,0 +1,100 @@ +//=========================================================================== +// +// w_hypot.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_hypot.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper hypot(x,y) + */ + +#include "mathincl/fdlibm.h" + + + double hypot(double x, double y)/* wrapper hypot */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_hypot(x,y); +#else + double z; + z = __ieee754_hypot(x,y); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE) return z; + if((!finite(z))&&finite(x)&&finite(y)) + return __kernel_standard(x,y,4); /* hypot overflow */ + else + return z; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_hypot.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_j0.c b/packages/language/c/libm/current/src/double/ieee754-api/w_j0.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_j0.c @@ -0,0 +1,121 @@ +//=========================================================================== +// +// w_j0.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_j0.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper j0(double x), y0(double x) + */ + +#include "mathincl/fdlibm.h" + + double j0(double x) /* wrapper j0 */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_j0(x); +#else + double z = __ieee754_j0(x); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || isnan(x)) return z; + if(fabs(x)>X_TLOSS) { + return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */ + } else + return z; +#endif +} + + double y0(double x) /* wrapper y0 */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_y0(x); +#else + double z; + z = __ieee754_y0(x); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || isnan(x) ) return z; + if(x <= 0.0){ + if(x==0.0) + /* d= -one/(x-x); */ + return __kernel_standard(x,x,8); + else + /* d = zero/(x-x); */ + return __kernel_standard(x,x,9); + } + if(x>X_TLOSS) { + return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */ + } else + return z; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_j0.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_j1.c b/packages/language/c/libm/current/src/double/ieee754-api/w_j1.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_j1.c @@ -0,0 +1,122 @@ +//=========================================================================== +// +// w_j1.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_j1.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper of j1,y1 + */ + +#include "mathincl/fdlibm.h" + + double j1(double x) /* wrapper j1 */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_j1(x); +#else + double z; + z = __ieee754_j1(x); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || isnan(x) ) return z; + if(fabs(x)>X_TLOSS) { + return __kernel_standard(x,x,36); /* j1(|x|>X_TLOSS) */ + } else + return z; +#endif +} + + double y1(double x) /* wrapper y1 */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_y1(x); +#else + double z; + z = __ieee754_y1(x); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || isnan(x) ) return z; + if(x <= 0.0){ + if(x==0.0) + /* d= -one/(x-x); */ + return __kernel_standard(x,x,10); + else + /* d = zero/(x-x); */ + return __kernel_standard(x,x,11); + } + if(x>X_TLOSS) { + return __kernel_standard(x,x,37); /* y1(x>X_TLOSS) */ + } else + return z; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_j1.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_jn.c b/packages/language/c/libm/current/src/double/ieee754-api/w_jn.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_jn.c @@ -0,0 +1,144 @@ +//=========================================================================== +// +// w_jn.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_jn.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper jn(int n, double x), yn(int n, double x) + * floating point Bessel's function of the 1st and 2nd kind + * of order n + * + * Special cases: + * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; + * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. + * Note 2. About jn(n,x), yn(n,x) + * For n=0, j0(x) is called, + * for n=1, j1(x) is called, + * for nx, a continued fraction approximation to + * j(n,x)/j(n-1,x) is evaluated and then backward + * recursion is used starting from a supposed value + * for j(n,x). The resulting value of j(0,x) is + * compared with the actual value to correct the + * supposed value of j(n,x). + * + * yn(n,x) is similar in all respects, except + * that forward recursion is used for all + * values of n>1. + * + */ + +#include "mathincl/fdlibm.h" + + double jn(int n, double x) /* wrapper jn */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_jn(n,x); +#else + double z; + z = __ieee754_jn(n,x); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || isnan(x) ) return z; + if(fabs(x)>X_TLOSS) { + return __kernel_standard((double)n,x,38); /* jn(|x|>X_TLOSS,n) */ + } else + return z; +#endif +} + + double yn(int n, double x) /* wrapper yn */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_yn(n,x); +#else + double z; + z = __ieee754_yn(n,x); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || isnan(x) ) return z; + if(x <= 0.0){ + if(x==0.0) + /* d= -one/(x-x); */ + return __kernel_standard((double)n,x,12); + else + /* d = zero/(x-x); */ + return __kernel_standard((double)n,x,13); + } + if(x>X_TLOSS) { + return __kernel_standard((double)n,x,39); /* yn(x>X_TLOSS,n) */ + } else + return z; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_jn.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_lgamma.c b/packages/language/c/libm/current/src/double/ieee754-api/w_lgamma.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_lgamma.c @@ -0,0 +1,108 @@ +//=========================================================================== +// +// w_lgamma.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_lgamma.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* double lgamma(double x) + * Return the logarithm of the Gamma function of x. + * + * Method: call __ieee754_lgamma_r + */ + +#include +#include "mathincl/fdlibm.h" + + +double +lgamma(double x) +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_lgamma_r(x,&signgam); +#else + double y; + y = __ieee754_lgamma_r(x,&signgam); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE) return y; + if(!finite(y)&&finite(x)) { + if(floor(x)==x&&x<=0.0) + return __kernel_standard(x,x,15); /* lgamma pole */ + else + return __kernel_standard(x,x,14); /* lgamma overflow */ + } else + return y; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_lgamma.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_lgamma_r.c b/packages/language/c/libm/current/src/double/ieee754-api/w_lgamma_r.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_lgamma_r.c @@ -0,0 +1,103 @@ +//=========================================================================== +// +// w_lgamma_r.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_lgamma_r.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper double lgamma_r(double x, int *signgamp) + */ + +#include "mathincl/fdlibm.h" + + + double lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_lgamma_r(x,signgamp); +#else + double y; + y = __ieee754_lgamma_r(x,signgamp); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE) return y; + if(!finite(y)&&finite(x)) { + if(floor(x)==x&&x<=0.0) + return __kernel_standard(x,x,15); /* lgamma pole */ + else + return __kernel_standard(x,x,14); /* lgamma overflow */ + } else + return y; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_lgamma_r.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_log.c b/packages/language/c/libm/current/src/double/ieee754-api/w_log.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_log.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_log.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_log10.c b/packages/language/c/libm/current/src/double/ieee754-api/w_log10.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_log10.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_log10.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_pow.c b/packages/language/c/libm/current/src/double/ieee754-api/w_pow.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_pow.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_pow.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_remainder.c b/packages/language/c/libm/current/src/double/ieee754-api/w_remainder.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_remainder.c @@ -0,0 +1,99 @@ +//=========================================================================== +// +// w_remainder.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)w_remainder.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper remainder(x,p) + */ + +#include "mathincl/fdlibm.h" + + double remainder(double x, double y) /* wrapper remainder */ +{ +#ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY + return __ieee754_remainder(x,y); +#else + double z; + z = __ieee754_remainder(x,y); + if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || isnan(y)) return z; + if(y==0.0) + return __kernel_standard(x,y,28); /* remainder(x,0) */ + else + return z; +#endif +} + +#endif // ifdef CYGPKG_LIBM + +// EOF w_remainder.c diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_scalb.c b/packages/language/c/libm/current/src/double/ieee754-api/w_scalb.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_scalb.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_scalb.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_sinh.c b/packages/language/c/libm/current/src/double/ieee754-api/w_sinh.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_sinh.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_sinh.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-api/w_sqrt.c b/packages/language/c/libm/current/src/double/ieee754-api/w_sqrt.c --- a/packages/language/c/libm/current/src/double/ieee754-api/w_sqrt.c +++ b/packages/language/c/libm/current/src/double/ieee754-api/w_sqrt.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_acos.c b/packages/language/c/libm/current/src/double/ieee754-core/e_acos.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_acos.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_acos.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_acosh.c b/packages/language/c/libm/current/src/double/ieee754-core/e_acosh.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_acosh.c @@ -0,0 +1,122 @@ +//=========================================================================== +// +// e_acosh.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_acosh.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* __ieee754_acosh(x) + * Method : + * Based on + * acosh(x) = log [ x + sqrt(x*x-1) ] + * we have + * acosh(x) := log(x)+ln2, if x is large; else + * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else + * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. + * + * Special cases: + * acosh(x) is NaN with signal if x<1. + * acosh(NaN) is NaN without signal. + */ + +#include "mathincl/fdlibm.h" + +static const double +one = 1.0, +ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ + + double __ieee754_acosh(double x) +{ + double t; + int hx; + hx = CYG_LIBM_HI(x); + if(hx<0x3ff00000) { /* x < 1 */ + return (x-x)/(x-x); + } else if(hx >=0x41b00000) { /* x > 2**28 */ + if(hx >=0x7ff00000) { /* x is inf of NaN */ + return x+x; + } else + return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */ + } else if(((hx-0x3ff00000)|CYG_LIBM_LO(x))==0) { + return 0.0; /* acosh(1) = 0 */ + } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ + t=x*x; + return __ieee754_log(2.0*x-one/(x+sqrt(t-one))); + } else { /* 1 // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_atanh.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* __ieee754_atanh(x) + * Method : + * 1.Reduced x to positive by atanh(-x) = -atanh(x) + * 2.For x>=0.5 + * 1 2x x + * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) + * 2 1 - x 1 - x + * + * For x<0.5 + * atanh(x) = 0.5*log1p(2x+2x*x/(1-x)) + * + * Special cases: + * atanh(x) is NaN if |x| > 1 with signal; + * atanh(NaN) is that NaN with no signal; + * atanh(+-1) is +-INF with signal. + * + */ + +#include "mathincl/fdlibm.h" + +static const double one = 1.0, huge = 1e300; + +static double zero = 0.0; + + double __ieee754_atanh(double x) +{ + double t; + int hx,ix; + unsigned lx; + hx = CYG_LIBM_HI(x); /* high word */ + lx = CYG_LIBM_LO(x); /* low word */ + ix = hx&0x7fffffff; + if ((ix|((lx|(-lx))>>31))>0x3ff00000) /* |x|>1 */ + return (x-x)/(x-x); + if(ix==0x3ff00000) + return x/zero; + if(ix<0x3e300000&&(huge+x)>zero) return x; /* x<2**-28 */ + CYG_LIBM_HI(x) = ix; /* x <- |x| */ + if(ix<0x3fe00000) { /* x < 0.5 */ + t = x+x; + t = 0.5*log1p(t+t*x/(one-x)); + } else + t = 0.5*log1p((x+x)/(one-x)); + if(hx>=0) return t; else return -t; +} + +#endif // ifdef CYGPKG_LIBM + +// EOF e_atanh.c diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_cosh.c b/packages/language/c/libm/current/src/double/ieee754-core/e_cosh.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_cosh.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_cosh.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_exp.c b/packages/language/c/libm/current/src/double/ieee754-core/e_exp.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_exp.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_exp.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_fmod.c b/packages/language/c/libm/current/src/double/ieee754-core/e_fmod.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_fmod.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_fmod.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_gamma.c b/packages/language/c/libm/current/src/double/ieee754-core/e_gamma.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_gamma.c @@ -0,0 +1,94 @@ +//=========================================================================== +// +// e_gamma.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_gamma.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* __ieee754_gamma(x) + * Return the logarithm of the Gamma function of x. + * + * Method: call __ieee754_gamma_r + */ + +#include +#include "mathincl/fdlibm.h" + +double +__ieee754_gamma(double x) +{ + return __ieee754_gamma_r(x,&signgam); +} + +#endif // ifdef CYGPKG_LIBM + +// EOF e_gamma.c diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_gamma_r.c b/packages/language/c/libm/current/src/double/ieee754-core/e_gamma_r.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_gamma_r.c @@ -0,0 +1,93 @@ +//=========================================================================== +// +// e_gamma_r.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_gamma_r.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* __ieee754_gamma_r(x, signgamp) + * Reentrant version of the logarithm of the Gamma function + * with user provide pointer for the sign of Gamma(x). + * + * Method: See __ieee754_lgamma_r + */ + +#include "mathincl/fdlibm.h" + + double __ieee754_gamma_r(double x, int *signgamp) +{ + return __ieee754_lgamma_r(x,signgamp); +} + +#endif // ifdef CYGPKG_LIBM + +// EOF e_gamma_r.c diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_hypot.c b/packages/language/c/libm/current/src/double/ieee754-core/e_hypot.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_hypot.c @@ -0,0 +1,176 @@ +//=========================================================================== +// +// e_hypot.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_hypot.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_hypot(x,y) + * + * Method : + * If (assume round-to-nearest) z=x*x+y*y + * has error less than sqrt(2)/2 ulp, than + * sqrt(z) has error less than 1 ulp (exercise). + * + * So, compute sqrt(x*x+y*y) with some care as + * follows to get the error below 1 ulp: + * + * Assume x>y>0; + * (if possible, set rounding to round-to-nearest) + * 1. if x > 2y use + * x1*x1+(y*y+(x2*(x+x1))) for x*x+y*y + * where x1 = x with lower 32 bits cleared, x2 = x-x1; else + * 2. if x <= 2y use + * t1*y1+((x-y)*(x-y)+(t1*y2+t2*y)) + * where t1 = 2x with lower 32 bits cleared, t2 = 2x-t1, + * y1= y with lower 32 bits chopped, y2 = y-y1. + * + * NOTE: scaling may be necessary if some argument is too + * large or too tiny + * + * Special cases: + * hypot(x,y) is INF if x or y is +INF or -INF; else + * hypot(x,y) is NAN if x or y is NAN. + * + * Accuracy: + * hypot(x,y) returns sqrt(x^2+y^2) with error less + * than 1 ulps (units in the last place) + */ + +#include "mathincl/fdlibm.h" + + double __ieee754_hypot(double x, double y) +{ + double a=x,b=y,t1,t2,y1,y2,w; + int j,k,ha,hb; + + ha = CYG_LIBM_HI(x)&0x7fffffff; /* high word of x */ + hb = CYG_LIBM_HI(y)&0x7fffffff; /* high word of y */ + if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} + CYG_LIBM_HI(a) = ha; /* a <- |a| */ + CYG_LIBM_HI(b) = hb; /* b <- |b| */ + if((ha-hb)>0x3c00000) {return a+b;} /* x/y > 2**60 */ + k=0; + if(ha > 0x5f300000) { /* a>2**500 */ + if(ha >= 0x7ff00000) { /* Inf or NaN */ + w = a+b; /* for sNaN */ + if(((ha&0xfffff)|CYG_LIBM_LO(a))==0) w = a; + if(((hb^0x7ff00000)|CYG_LIBM_LO(b))==0) w = b; + return w; + } + /* scale a and b by 2**-600 */ + ha -= 0x25800000; hb -= 0x25800000; k += 600; + CYG_LIBM_HI(a) = ha; + CYG_LIBM_HI(b) = hb; + } + if(hb < 0x20b00000) { /* b < 2**-500 */ + if(hb <= 0x000fffff) { /* subnormal b or 0 */ + if((hb|(CYG_LIBM_LO(b)))==0) return a; + t1=0; + CYG_LIBM_HI(t1) = 0x7fd00000; /* t1=2^1022 */ + b *= t1; + a *= t1; + k -= 1022; + } else { /* scale a and b by 2^600 */ + ha += 0x25800000; /* a *= 2^600 */ + hb += 0x25800000; /* b *= 2^600 */ + k -= 600; + CYG_LIBM_HI(a) = ha; + CYG_LIBM_HI(b) = hb; + } + } + /* medium size a and b */ + w = a-b; + if (w>b) { + t1 = 0; + CYG_LIBM_HI(t1) = ha; + t2 = a-t1; + w = sqrt(t1*t1-(b*(-b)-t2*(a+t1))); + } else { + a = a+a; + y1 = 0; + CYG_LIBM_HI(y1) = hb; + y2 = b - y1; + t1 = 0; + CYG_LIBM_HI(t1) = ha+0x00100000; + t2 = a - t1; + w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); + } + if(k!=0) { + t1 = 1.0; + CYG_LIBM_HI(t1) += (k<<20); + return t1*w; + } else return w; +} + +#endif // ifdef CYGPKG_LIBM + +// EOF e_hypot.c diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_j0.c b/packages/language/c/libm/current/src/double/ieee754-core/e_j0.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_j0.c @@ -0,0 +1,440 @@ +//=========================================================================== +// +// e_j0.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_j0.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_j0(x), __ieee754_y0(x) + * Bessel function of the first and second kinds of order zero. + * Method -- j0(x): + * 1. For tiny x, we use j0(x) = 1 - x^2/4 + x^4/64 - ... + * 2. Reduce x to |x| since j0(x)=j0(-x), and + * for x in (0,2) + * j0(x) = 1-z/4+ z^2*R0/S0, where z = x*x; + * (precision: |j0-1+z/4-z^2R0/S0 |<2**-63.67 ) + * for x in (2,inf) + * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0)) + * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0) + * as follow: + * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4) + * = 1/sqrt(2) * (cos(x) + sin(x)) + * sin(x0) = sin(x)cos(pi/4)-cos(x)sin(pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * (To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one.) + * + * 3 Special cases + * j0(nan)= nan + * j0(0) = 1 + * j0(inf) = 0 + * + * Method -- y0(x): + * 1. For x<2. + * Since + * y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...) + * therefore y0(x)-2/pi*j0(x)*ln(x) is an even function. + * We use the following function to approximate y0, + * y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2 + * where + * U(z) = u00 + u01*z + ... + u06*z^6 + * V(z) = 1 + v01*z + ... + v04*z^4 + * with absolute approximation error bounded by 2**-72. + * Note: For tiny x, U/V = u0 and j0(x)~1, hence + * y0(tiny) = u0 + (2/pi)*ln(tiny), (choose tiny<2**-27) + * 2. For x>=2. + * y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0)) + * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0) + * by the method mentioned above. + * 3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0. + */ + +#include "mathincl/fdlibm.h" + +static double pzero(double), qzero(double); + +static const double +huge = 1e300, +one = 1.0, +invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ +tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ + /* R0/S0 on [0, 2.00] */ +R02 = 1.56249999999999947958e-02, /* 0x3F8FFFFF, 0xFFFFFFFD */ +R03 = -1.89979294238854721751e-04, /* 0xBF28E6A5, 0xB61AC6E9 */ +R04 = 1.82954049532700665670e-06, /* 0x3EBEB1D1, 0x0C503919 */ +R05 = -4.61832688532103189199e-09, /* 0xBE33D5E7, 0x73D63FCE */ +S01 = 1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */ +S02 = 1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xDD57DBF4 */ +S03 = 5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */ +S04 = 1.16614003333790000205e-09; /* 0x3E1408BC, 0xF4745D8F */ + +static double zero = 0.0; + + double __ieee754_j0(double x) +{ + double z, s,c,ss,cc,r,u,v; + int hx,ix; + + hx = CYG_LIBM_HI(x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) return one/(x*x); + x = fabs(x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + s = sin(x); + c = cos(x); + ss = s-c; + cc = s+c; + if(ix<0x7fe00000) { /* make sure x+x not overflow */ + z = -cos(x+x); + if ((s*c)0x48000000) z = (invsqrtpi*cc)/sqrt(x); + else { + u = pzero(x); v = qzero(x); + z = invsqrtpi*(u*cc-v*ss)/sqrt(x); + } + return z; + } + if(ix<0x3f200000) { /* |x| < 2**-13 */ + if(huge+x>one) { /* raise inexact if x != 0 */ + if(ix<0x3e400000) return one; /* |x|<2**-27 */ + else return one - 0.25*x*x; + } + } + z = x*x; + r = z*(R02+z*(R03+z*(R04+z*R05))); + s = one+z*(S01+z*(S02+z*(S03+z*S04))); + if(ix < 0x3FF00000) { /* |x| < 1.00 */ + return one + z*(-0.25+(r/s)); + } else { + u = 0.5*x; + return((one+u)*(one-u)+z*(r/s)); + } +} + +static const double +u00 = -7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */ +u01 = 1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */ +u02 = -1.38185671945596898896e-02, /* 0xBF8C4CE8, 0xB16CFA97 */ +u03 = 3.47453432093683650238e-04, /* 0x3F36C54D, 0x20B29B6B */ +u04 = -3.81407053724364161125e-06, /* 0xBECFFEA7, 0x73D25CAD */ +u05 = 1.95590137035022920206e-08, /* 0x3E550057, 0x3B4EABD4 */ +u06 = -3.98205194132103398453e-11, /* 0xBDC5E43D, 0x693FB3C8 */ +v01 = 1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */ +v02 = 7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */ +v03 = 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */ +v04 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */ + + double __ieee754_y0(double x) +{ + double z, s,c,ss,cc,u,v; + int hx,ix,lx; + + hx = CYG_LIBM_HI(x); + ix = 0x7fffffff&hx; + lx = CYG_LIBM_LO(x); + /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ + if(ix>=0x7ff00000) return one/(x+x*x); + if((ix|lx)==0) return -one/zero; + if(hx<0) return zero/zero; + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0)) + * where x0 = x-pi/4 + * Better formula: + * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4) + * = 1/sqrt(2) * (sin(x) + cos(x)) + * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one. + */ + s = sin(x); + c = cos(x); + ss = s-c; + cc = s+c; + /* + * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x) + * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x) + */ + if(ix<0x7fe00000) { /* make sure x+x not overflow */ + z = -cos(x+x); + if ((s*c)0x48000000) z = (invsqrtpi*ss)/sqrt(x); + else { + u = pzero(x); v = qzero(x); + z = invsqrtpi*(u*ss+v*cc)/sqrt(x); + } + return z; + } + if(ix<=0x3e400000) { /* x < 2**-27 */ + return(u00 + tpi*__ieee754_log(x)); + } + z = x*x; + u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06))))); + v = one+z*(v01+z*(v02+z*(v03+z*v04))); + return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x))); +} + +/* The asymptotic expansions of pzero is + * 1 - 9/128 s^2 + 11025/98304 s^4 - ..., where s = 1/x. + * For x >= 2, We approximate pzero by + * pzero(x) = 1 + (R/S) + * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10 + * S = 1 + pS0*s^2 + ... + pS4*s^10 + * and + * | pzero(x)-1-R/S | <= 2 ** ( -60.26) + */ +static const double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ + 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ + -7.03124999999900357484e-02, /* 0xBFB1FFFF, 0xFFFFFD32 */ + -8.08167041275349795626e+00, /* 0xC02029D0, 0xB44FA779 */ + -2.57063105679704847262e+02, /* 0xC0701102, 0x7B19E863 */ + -2.48521641009428822144e+03, /* 0xC0A36A6E, 0xCD4DCAFC */ + -5.25304380490729545272e+03, /* 0xC0B4850B, 0x36CC643D */ +}; +static const double pS8[5] = { + 1.16534364619668181717e+02, /* 0x405D2233, 0x07A96751 */ + 3.83374475364121826715e+03, /* 0x40ADF37D, 0x50596938 */ + 4.05978572648472545552e+04, /* 0x40E3D2BB, 0x6EB6B05F */ + 1.16752972564375915681e+05, /* 0x40FC810F, 0x8F9FA9BD */ + 4.76277284146730962675e+04, /* 0x40E74177, 0x4F2C49DC */ +}; + +static const double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ + -1.14125464691894502584e-11, /* 0xBDA918B1, 0x47E495CC */ + -7.03124940873599280078e-02, /* 0xBFB1FFFF, 0xE69AFBC6 */ + -4.15961064470587782438e+00, /* 0xC010A370, 0xF90C6BBF */ + -6.76747652265167261021e+01, /* 0xC050EB2F, 0x5A7D1783 */ + -3.31231299649172967747e+02, /* 0xC074B3B3, 0x6742CC63 */ + -3.46433388365604912451e+02, /* 0xC075A6EF, 0x28A38BD7 */ +}; +static const double pS5[5] = { + 6.07539382692300335975e+01, /* 0x404E6081, 0x0C98C5DE */ + 1.05125230595704579173e+03, /* 0x40906D02, 0x5C7E2864 */ + 5.97897094333855784498e+03, /* 0x40B75AF8, 0x8FBE1D60 */ + 9.62544514357774460223e+03, /* 0x40C2CCB8, 0xFA76FA38 */ + 2.40605815922939109441e+03, /* 0x40A2CC1D, 0xC70BE864 */ +}; + +static const double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ + -2.54704601771951915620e-09, /* 0xBE25E103, 0x6FE1AA86 */ + -7.03119616381481654654e-02, /* 0xBFB1FFF6, 0xF7C0E24B */ + -2.40903221549529611423e+00, /* 0xC00345B2, 0xAEA48074 */ + -2.19659774734883086467e+01, /* 0xC035F74A, 0x4CB94E14 */ + -5.80791704701737572236e+01, /* 0xC04D0A22, 0x420A1A45 */ + -3.14479470594888503854e+01, /* 0xC03F72AC, 0xA892D80F */ +}; +static const double pS3[5] = { + 3.58560338055209726349e+01, /* 0x4041ED92, 0x84077DD3 */ + 3.61513983050303863820e+02, /* 0x40769839, 0x464A7C0E */ + 1.19360783792111533330e+03, /* 0x4092A66E, 0x6D1061D6 */ + 1.12799679856907414432e+03, /* 0x40919FFC, 0xB8C39B7E */ + 1.73580930813335754692e+02, /* 0x4065B296, 0xFC379081 */ +}; + +static const double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ + -8.87534333032526411254e-08, /* 0xBE77D316, 0xE927026D */ + -7.03030995483624743247e-02, /* 0xBFB1FF62, 0x495E1E42 */ + -1.45073846780952986357e+00, /* 0xBFF73639, 0x8A24A843 */ + -7.63569613823527770791e+00, /* 0xC01E8AF3, 0xEDAFA7F3 */ + -1.11931668860356747786e+01, /* 0xC02662E6, 0xC5246303 */ + -3.23364579351335335033e+00, /* 0xC009DE81, 0xAF8FE70F */ +}; +static const double pS2[5] = { + 2.22202997532088808441e+01, /* 0x40363865, 0x908B5959 */ + 1.36206794218215208048e+02, /* 0x4061069E, 0x0EE8878F */ + 2.70470278658083486789e+02, /* 0x4070E786, 0x42EA079B */ + 1.53875394208320329881e+02, /* 0x40633C03, 0x3AB6FAFF */ + 1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */ +}; + + static double pzero(double x) +{ + const double *p,*q; + double z,r,s; + int ix; + ix = 0x7fffffff&CYG_LIBM_HI(x); + if(ix>=0x40200000) {p = pR8; q= pS8;} + else if(ix>=0x40122E8B){p = pR5; q= pS5;} + else if(ix>=0x4006DB6D){p = pR3; q= pS3;} + else {p = pR2; q= pS2;} /*if (ix>=0x40000000) */ + z = one/(x*x); + r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); + s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); + return one+ r/s; +} + + +/* For x >= 8, the asymptotic expansions of qzero is + * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. + * We approximate pzero by + * qzero(x) = s*(-1.25 + (R/S)) + * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10 + * S = 1 + qS0*s^2 + ... + qS5*s^12 + * and + * | qzero(x)/s +1.25-R/S | <= 2 ** ( -61.22) + */ +static const double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ + 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ + 7.32421874999935051953e-02, /* 0x3FB2BFFF, 0xFFFFFE2C */ + 1.17682064682252693899e+01, /* 0x40278952, 0x5BB334D6 */ + 5.57673380256401856059e+02, /* 0x40816D63, 0x15301825 */ + 8.85919720756468632317e+03, /* 0x40C14D99, 0x3E18F46D */ + 3.70146267776887834771e+04, /* 0x40E212D4, 0x0E901566 */ +}; +static const double qS8[6] = { + 1.63776026895689824414e+02, /* 0x406478D5, 0x365B39BC */ + 8.09834494656449805916e+03, /* 0x40BFA258, 0x4E6B0563 */ + 1.42538291419120476348e+05, /* 0x41016652, 0x54D38C3F */ + 8.03309257119514397345e+05, /* 0x412883DA, 0x83A52B43 */ + 8.40501579819060512818e+05, /* 0x4129A66B, 0x28DE0B3D */ + -3.43899293537866615225e+05, /* 0xC114FD6D, 0x2C9530C5 */ +}; + +static const double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ + 1.84085963594515531381e-11, /* 0x3DB43D8F, 0x29CC8CD9 */ + 7.32421766612684765896e-02, /* 0x3FB2BFFF, 0xD172B04C */ + 5.83563508962056953777e+00, /* 0x401757B0, 0xB9953DD3 */ + 1.35111577286449829671e+02, /* 0x4060E392, 0x0A8788E9 */ + 1.02724376596164097464e+03, /* 0x40900CF9, 0x9DC8C481 */ + 1.98997785864605384631e+03, /* 0x409F17E9, 0x53C6E3A6 */ +}; +static const double qS5[6] = { + 8.27766102236537761883e+01, /* 0x4054B1B3, 0xFB5E1543 */ + 2.07781416421392987104e+03, /* 0x40A03BA0, 0xDA21C0CE */ + 1.88472887785718085070e+04, /* 0x40D267D2, 0x7B591E6D */ + 5.67511122894947329769e+04, /* 0x40EBB5E3, 0x97E02372 */ + 3.59767538425114471465e+04, /* 0x40E19118, 0x1F7A54A0 */ + -5.35434275601944773371e+03, /* 0xC0B4EA57, 0xBEDBC609 */ +}; + +static const double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ + 4.37741014089738620906e-09, /* 0x3E32CD03, 0x6ADECB82 */ + 7.32411180042911447163e-02, /* 0x3FB2BFEE, 0x0E8D0842 */ + 3.34423137516170720929e+00, /* 0x400AC0FC, 0x61149CF5 */ + 4.26218440745412650017e+01, /* 0x40454F98, 0x962DAEDD */ + 1.70808091340565596283e+02, /* 0x406559DB, 0xE25EFD1F */ + 1.66733948696651168575e+02, /* 0x4064D77C, 0x81FA21E0 */ +}; +static const double qS3[6] = { + 4.87588729724587182091e+01, /* 0x40486122, 0xBFE343A6 */ + 7.09689221056606015736e+02, /* 0x40862D83, 0x86544EB3 */ + 3.70414822620111362994e+03, /* 0x40ACF04B, 0xE44DFC63 */ + 6.46042516752568917582e+03, /* 0x40B93C6C, 0xD7C76A28 */ + 2.51633368920368957333e+03, /* 0x40A3A8AA, 0xD94FB1C0 */ + -1.49247451836156386662e+02, /* 0xC062A7EB, 0x201CF40F */ +}; + +static const double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ + 1.50444444886983272379e-07, /* 0x3E84313B, 0x54F76BDB */ + 7.32234265963079278272e-02, /* 0x3FB2BEC5, 0x3E883E34 */ + 1.99819174093815998816e+00, /* 0x3FFFF897, 0xE727779C */ + 1.44956029347885735348e+01, /* 0x402CFDBF, 0xAAF96FE5 */ + 3.16662317504781540833e+01, /* 0x403FAA8E, 0x29FBDC4A */ + 1.62527075710929267416e+01, /* 0x403040B1, 0x71814BB4 */ +}; +static const double qS2[6] = { + 3.03655848355219184498e+01, /* 0x403E5D96, 0xF7C07AED */ + 2.69348118608049844624e+02, /* 0x4070D591, 0xE4D14B40 */ + 8.44783757595320139444e+02, /* 0x408A6645, 0x22B3BF22 */ + 8.82935845112488550512e+02, /* 0x408B977C, 0x9C5CC214 */ + 2.12666388511798828631e+02, /* 0x406A9553, 0x0E001365 */ + -5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */ +}; + + static double qzero(double x) +{ + const double *p,*q; + double s,r,z; + int ix; + ix = 0x7fffffff&CYG_LIBM_HI(x); + if(ix>=0x40200000) {p = qR8; q= qS8;} + else if(ix>=0x40122E8B){p = qR5; q= qS5;} + else if(ix>=0x4006DB6D){p = qR3; q= qS3;} + else {p = qR2; q= qS2;} /* if(ix>=0x40000000) */ + z = one/(x*x); + r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); + s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); + return (-.125 + r/s)/x; +} + +#endif // ifdef CYGPKG_LIBM + +// EOF e_j0.c diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_j1.c b/packages/language/c/libm/current/src/double/ieee754-core/e_j1.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_j1.c @@ -0,0 +1,435 @@ +//=========================================================================== +// +// e_j1.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_j1.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_j1(x), __ieee754_y1(x) + * Bessel function of the first and second kinds of order zero. + * Method -- j1(x): + * 1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ... + * 2. Reduce x to |x| since j1(x)=-j1(-x), and + * for x in (0,2) + * j1(x) = x/2 + x*z*R0/S0, where z = x*x; + * (precision: |j1/x - 1/2 - R0/S0 |<2**-61.51 ) + * for x in (2,inf) + * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1)) + * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) + * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) + * as follow: + * cos(x1) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * sin(x1) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) + * = -1/sqrt(2) * (sin(x) + cos(x)) + * (To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one.) + * + * 3 Special cases + * j1(nan)= nan + * j1(0) = 0 + * j1(inf) = 0 + * + * Method -- y1(x): + * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN + * 2. For x<2. + * Since + * y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...) + * therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function. + * We use the following function to approximate y1, + * y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2 + * where for x in [0,2] (abs err less than 2**-65.89) + * U(z) = U0[0] + U0[1]*z + ... + U0[4]*z^4 + * V(z) = 1 + v0[0]*z + ... + v0[4]*z^5 + * Note: For tiny x, 1/x dominate y1 and hence + * y1(tiny) = -2/pi/tiny, (choose tiny<2**-54) + * 3. For x>=2. + * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) + * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) + * by method mentioned above. + */ + +#include "mathincl/fdlibm.h" + +static double pone(double), qone(double); + +static const double +huge = 1e300, +one = 1.0, +invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ +tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ + /* R0/S0 on [0,2] */ +r00 = -6.25000000000000000000e-02, /* 0xBFB00000, 0x00000000 */ +r01 = 1.40705666955189706048e-03, /* 0x3F570D9F, 0x98472C61 */ +r02 = -1.59955631084035597520e-05, /* 0xBEF0C5C6, 0xBA169668 */ +r03 = 4.96727999609584448412e-08, /* 0x3E6AAAFA, 0x46CA0BD9 */ +s01 = 1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */ +s02 = 1.85946785588630915560e-04, /* 0x3F285F56, 0xB9CDF664 */ +s03 = 1.17718464042623683263e-06, /* 0x3EB3BFF8, 0x333F8498 */ +s04 = 5.04636257076217042715e-09, /* 0x3E35AC88, 0xC97DFF2C */ +s05 = 1.23542274426137913908e-11; /* 0x3DAB2ACF, 0xCFB97ED8 */ + +static double zero = 0.0; + + double __ieee754_j1(double x) +{ + double z, s,c,ss,cc,r,u,v,y; + int hx,ix; + + hx = CYG_LIBM_HI(x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) return one/x; + y = fabs(x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + s = sin(y); + c = cos(y); + ss = -s-c; + cc = s-c; + if(ix<0x7fe00000) { /* make sure y+y not overflow */ + z = cos(y+y); + if ((s*c)>zero) cc = z/ss; + else ss = z/cc; + } + /* + * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x) + * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x) + */ + if(ix>0x48000000) z = (invsqrtpi*cc)/sqrt(y); + else { + u = pone(y); v = qone(y); + z = invsqrtpi*(u*cc-v*ss)/sqrt(y); + } + if(hx<0) return -z; + else return z; + } + if(ix<0x3e400000) { /* |x|<2**-27 */ + if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */ + } + z = x*x; + r = z*(r00+z*(r01+z*(r02+z*r03))); + s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05)))); + r *= x; + return(x*0.5+r/s); +} + +static const double U0[5] = { + -1.96057090646238940668e-01, /* 0xBFC91866, 0x143CBC8A */ + 5.04438716639811282616e-02, /* 0x3FA9D3C7, 0x76292CD1 */ + -1.91256895875763547298e-03, /* 0xBF5F55E5, 0x4844F50F */ + 2.35252600561610495928e-05, /* 0x3EF8AB03, 0x8FA6B88E */ + -9.19099158039878874504e-08, /* 0xBE78AC00, 0x569105B8 */ +}; +static const double V0[5] = { + 1.99167318236649903973e-02, /* 0x3F94650D, 0x3F4DA9F0 */ + 2.02552581025135171496e-04, /* 0x3F2A8C89, 0x6C257764 */ + 1.35608801097516229404e-06, /* 0x3EB6C05A, 0x894E8CA6 */ + 6.22741452364621501295e-09, /* 0x3E3ABF1D, 0x5BA69A86 */ + 1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */ +}; + + double __ieee754_y1(double x) +{ + double z, s,c,ss,cc,u,v; + int hx,ix,lx; + + hx = CYG_LIBM_HI(x); + ix = 0x7fffffff&hx; + lx = CYG_LIBM_LO(x); + /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ + if(ix>=0x7ff00000) return one/(x+x*x); + if((ix|lx)==0) return -one/zero; + if(hx<0) return zero/zero; + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + s = sin(x); + c = cos(x); + ss = -s-c; + cc = s-c; + if(ix<0x7fe00000) { /* make sure x+x not overflow */ + z = cos(x+x); + if ((s*c)>zero) cc = z/ss; + else ss = z/cc; + } + /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0)) + * where x0 = x-3pi/4 + * Better formula: + * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) + * = -1/sqrt(2) * (cos(x) + sin(x)) + * To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one. + */ + if(ix>0x48000000) z = (invsqrtpi*ss)/sqrt(x); + else { + u = pone(x); v = qone(x); + z = invsqrtpi*(u*ss+v*cc)/sqrt(x); + } + return z; + } + if(ix<=0x3c900000) { /* x < 2**-54 */ + return(-tpi/x); + } + z = x*x; + u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); + v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); + return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x)); +} + +/* For x >= 8, the asymptotic expansions of pone is + * 1 + 15/128 s^2 - 4725/2^15 s^4 - ..., where s = 1/x. + * We approximate pone by + * pone(x) = 1 + (R/S) + * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10 + * S = 1 + ps0*s^2 + ... + ps4*s^10 + * and + * | pone(x)-1-R/S | <= 2 ** ( -60.06) + */ + +static const double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ + 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ + 1.17187499999988647970e-01, /* 0x3FBDFFFF, 0xFFFFFCCE */ + 1.32394806593073575129e+01, /* 0x402A7A9D, 0x357F7FCE */ + 4.12051854307378562225e+02, /* 0x4079C0D4, 0x652EA590 */ + 3.87474538913960532227e+03, /* 0x40AE457D, 0xA3A532CC */ + 7.91447954031891731574e+03, /* 0x40BEEA7A, 0xC32782DD */ +}; +static const double ps8[5] = { + 1.14207370375678408436e+02, /* 0x405C8D45, 0x8E656CAC */ + 3.65093083420853463394e+03, /* 0x40AC85DC, 0x964D274F */ + 3.69562060269033463555e+04, /* 0x40E20B86, 0x97C5BB7F */ + 9.76027935934950801311e+04, /* 0x40F7D42C, 0xB28F17BB */ + 3.08042720627888811578e+04, /* 0x40DE1511, 0x697A0B2D */ +}; + +static const double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ + 1.31990519556243522749e-11, /* 0x3DAD0667, 0xDAE1CA7D */ + 1.17187493190614097638e-01, /* 0x3FBDFFFF, 0xE2C10043 */ + 6.80275127868432871736e+00, /* 0x401B3604, 0x6E6315E3 */ + 1.08308182990189109773e+02, /* 0x405B13B9, 0x452602ED */ + 5.17636139533199752805e+02, /* 0x40802D16, 0xD052D649 */ + 5.28715201363337541807e+02, /* 0x408085B8, 0xBB7E0CB7 */ +}; +static const double ps5[5] = { + 5.92805987221131331921e+01, /* 0x404DA3EA, 0xA8AF633D */ + 9.91401418733614377743e+02, /* 0x408EFB36, 0x1B066701 */ + 5.35326695291487976647e+03, /* 0x40B4E944, 0x5706B6FB */ + 7.84469031749551231769e+03, /* 0x40BEA4B0, 0xB8A5BB15 */ + 1.50404688810361062679e+03, /* 0x40978030, 0x036F5E51 */ +}; + +static const double pr3[6] = { + 3.02503916137373618024e-09, /* 0x3E29FC21, 0xA7AD9EDD */ + 1.17186865567253592491e-01, /* 0x3FBDFFF5, 0x5B21D17B */ + 3.93297750033315640650e+00, /* 0x400F76BC, 0xE85EAD8A */ + 3.51194035591636932736e+01, /* 0x40418F48, 0x9DA6D129 */ + 9.10550110750781271918e+01, /* 0x4056C385, 0x4D2C1837 */ + 4.85590685197364919645e+01, /* 0x4048478F, 0x8EA83EE5 */ +}; +static const double ps3[5] = { + 3.47913095001251519989e+01, /* 0x40416549, 0xA134069C */ + 3.36762458747825746741e+02, /* 0x40750C33, 0x07F1A75F */ + 1.04687139975775130551e+03, /* 0x40905B7C, 0x5037D523 */ + 8.90811346398256432622e+02, /* 0x408BD67D, 0xA32E31E9 */ + 1.03787932439639277504e+02, /* 0x4059F26D, 0x7C2EED53 */ +}; + +static const double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ + 1.07710830106873743082e-07, /* 0x3E7CE9D4, 0xF65544F4 */ + 1.17176219462683348094e-01, /* 0x3FBDFF42, 0xBE760D83 */ + 2.36851496667608785174e+00, /* 0x4002F2B7, 0xF98FAEC0 */ + 1.22426109148261232917e+01, /* 0x40287C37, 0x7F71A964 */ + 1.76939711271687727390e+01, /* 0x4031B1A8, 0x177F8EE2 */ + 5.07352312588818499250e+00, /* 0x40144B49, 0xA574C1FE */ +}; +static const double ps2[5] = { + 2.14364859363821409488e+01, /* 0x40356FBD, 0x8AD5ECDC */ + 1.25290227168402751090e+02, /* 0x405F5293, 0x14F92CD5 */ + 2.32276469057162813669e+02, /* 0x406D08D8, 0xD5A2DBD9 */ + 1.17679373287147100768e+02, /* 0x405D6B7A, 0xDA1884A9 */ + 8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */ +}; + + static double pone(double x) +{ + const double *p,*q; + double z,r,s; + int ix; + ix = 0x7fffffff&CYG_LIBM_HI(x); + if(ix>=0x40200000) {p = pr8; q= ps8;} + else if(ix>=0x40122E8B){p = pr5; q= ps5;} + else if(ix>=0x4006DB6D){p = pr3; q= ps3;} + else {p = pr2; q= ps2;} /* if(ix>=0x40000000) */ + z = one/(x*x); + r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); + s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); + return one+ r/s; +} + + +/* For x >= 8, the asymptotic expansions of qone is + * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. + * We approximate pone by + * qone(x) = s*(0.375 + (R/S)) + * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10 + * S = 1 + qs1*s^2 + ... + qs6*s^12 + * and + * | qone(x)/s -0.375-R/S | <= 2 ** ( -61.13) + */ + +static const double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ + 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ + -1.02539062499992714161e-01, /* 0xBFBA3FFF, 0xFFFFFDF3 */ + -1.62717534544589987888e+01, /* 0xC0304591, 0xA26779F7 */ + -7.59601722513950107896e+02, /* 0xC087BCD0, 0x53E4B576 */ + -1.18498066702429587167e+04, /* 0xC0C724E7, 0x40F87415 */ + -4.84385124285750353010e+04, /* 0xC0E7A6D0, 0x65D09C6A */ +}; +static const double qs8[6] = { + 1.61395369700722909556e+02, /* 0x40642CA6, 0xDE5BCDE5 */ + 7.82538599923348465381e+03, /* 0x40BE9162, 0xD0D88419 */ + 1.33875336287249578163e+05, /* 0x4100579A, 0xB0B75E98 */ + 7.19657723683240939863e+05, /* 0x4125F653, 0x72869C19 */ + 6.66601232617776375264e+05, /* 0x412457D2, 0x7719AD5C */ + -2.94490264303834643215e+05, /* 0xC111F969, 0x0EA5AA18 */ +}; + +static const double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ + -2.08979931141764104297e-11, /* 0xBDB6FA43, 0x1AA1A098 */ + -1.02539050241375426231e-01, /* 0xBFBA3FFF, 0xCB597FEF */ + -8.05644828123936029840e+00, /* 0xC0201CE6, 0xCA03AD4B */ + -1.83669607474888380239e+02, /* 0xC066F56D, 0x6CA7B9B0 */ + -1.37319376065508163265e+03, /* 0xC09574C6, 0x6931734F */ + -2.61244440453215656817e+03, /* 0xC0A468E3, 0x88FDA79D */ +}; +static const double qs5[6] = { + 8.12765501384335777857e+01, /* 0x405451B2, 0xFF5A11B2 */ + 1.99179873460485964642e+03, /* 0x409F1F31, 0xE77BF839 */ + 1.74684851924908907677e+04, /* 0x40D10F1F, 0x0D64CE29 */ + 4.98514270910352279316e+04, /* 0x40E8576D, 0xAABAD197 */ + 2.79480751638918118260e+04, /* 0x40DB4B04, 0xCF7C364B */ + -4.71918354795128470869e+03, /* 0xC0B26F2E, 0xFCFFA004 */ +}; + +static const double qr3[6] = { + -5.07831226461766561369e-09, /* 0xBE35CFA9, 0xD38FC84F */ + -1.02537829820837089745e-01, /* 0xBFBA3FEB, 0x51AEED54 */ + -4.61011581139473403113e+00, /* 0xC01270C2, 0x3302D9FF */ + -5.78472216562783643212e+01, /* 0xC04CEC71, 0xC25D16DA */ + -2.28244540737631695038e+02, /* 0xC06C87D3, 0x4718D55F */ + -2.19210128478909325622e+02, /* 0xC06B66B9, 0x5F5C1BF6 */ +}; +static const double qs3[6] = { + 4.76651550323729509273e+01, /* 0x4047D523, 0xCCD367E4 */ + 6.73865112676699709482e+02, /* 0x40850EEB, 0xC031EE3E */ + 3.38015286679526343505e+03, /* 0x40AA684E, 0x448E7C9A */ + 5.54772909720722782367e+03, /* 0x40B5ABBA, 0xA61D54A6 */ + 1.90311919338810798763e+03, /* 0x409DBC7A, 0x0DD4DF4B */ + -1.35201191444307340817e+02, /* 0xC060E670, 0x290A311F */ +}; + +static const double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ + -1.78381727510958865572e-07, /* 0xBE87F126, 0x44C626D2 */ + -1.02517042607985553460e-01, /* 0xBFBA3E8E, 0x9148B010 */ + -2.75220568278187460720e+00, /* 0xC0060484, 0x69BB4EDA */ + -1.96636162643703720221e+01, /* 0xC033A9E2, 0xC168907F */ + -4.23253133372830490089e+01, /* 0xC04529A3, 0xDE104AAA */ + -2.13719211703704061733e+01, /* 0xC0355F36, 0x39CF6E52 */ +}; +static const double qs2[6] = { + 2.95333629060523854548e+01, /* 0x403D888A, 0x78AE64FF */ + 2.52981549982190529136e+02, /* 0x406F9F68, 0xDB821CBA */ + 7.57502834868645436472e+02, /* 0x4087AC05, 0xCE49A0F7 */ + 7.39393205320467245656e+02, /* 0x40871B25, 0x48D4C029 */ + 1.55949003336666123687e+02, /* 0x40637E5E, 0x3C3ED8D4 */ + -4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */ +}; + + static double qone(double x) +{ + const double *p,*q; + double s,r,z; + int ix; + ix = 0x7fffffff&CYG_LIBM_HI(x); + if(ix>=0x40200000) {p = qr8; q= qs8;} + else if(ix>=0x40122E8B){p = qr5; q= qs5;} + else if(ix>=0x4006DB6D){p = qr3; q= qs3;} + else {p = qr2; q= qs2;} /* if(ix>=0x40000000) */ + z = one/(x*x); + r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); + s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); + return (.375 + r/s)/x; +} + +#endif // ifdef CYGPKG_LIBM + +// EOF e_j1.c diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_jn.c b/packages/language/c/libm/current/src/double/ieee754-core/e_jn.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_jn.c @@ -0,0 +1,328 @@ +//=========================================================================== +// +// e_jn.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_jn.c 1.4 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * __ieee754_jn(n, x), __ieee754_yn(n, x) + * floating point Bessel's function of the 1st and 2nd kind + * of order n + * + * Special cases: + * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; + * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. + * Note 2. About jn(n,x), yn(n,x) + * For n=0, j0(x) is called, + * for n=1, j1(x) is called, + * for nx, a continued fraction approximation to + * j(n,x)/j(n-1,x) is evaluated and then backward + * recursion is used starting from a supposed value + * for j(n,x). The resulting value of j(0,x) is + * compared with the actual value to correct the + * supposed value of j(n,x). + * + * yn(n,x) is similar in all respects, except + * that forward recursion is used for all + * values of n>1. + * + */ + +#include "mathincl/fdlibm.h" + +static const double +invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ +two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ +one = 1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */ + +static double zero = 0.00000000000000000000e+00; + + double __ieee754_jn(int n, double x) +{ + int i,hx,ix,lx, sgn; + double a, b, temp, di; + double z, w; + + /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x) + * Thus, J(-n,x) = J(n,-x) + */ + hx = CYG_LIBM_HI(x); + ix = 0x7fffffff&hx; + lx = CYG_LIBM_LO(x); + /* if J(n,NaN) is NaN */ + if((ix|((unsigned)(lx|-lx))>>31)>0x7ff00000) return x+x; + if(n<0){ + n = -n; + x = -x; + hx ^= 0x80000000; + } + if(n==0) return(__ieee754_j0(x)); + if(n==1) return(__ieee754_j1(x)); + sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */ + x = fabs(x); + if((ix|lx)==0||ix>=0x7ff00000) /* if x is 0 or inf */ + b = zero; + else if((double)n<=x) { + /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ + if(ix>=0x52D00000) { /* x > 2**302 */ + /* (x >> n**2) + * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Let s=sin(x), c=cos(x), + * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then + * + * n sin(xn)*sqt2 cos(xn)*sqt2 + * ---------------------------------- + * 0 s-c c+s + * 1 -s-c -c+s + * 2 -s+c -c-s + * 3 s+c c-s + */ + switch(n&3) { + case 0: temp = cos(x)+sin(x); break; + case 1: temp = -cos(x)+sin(x); break; + case 2: temp = -cos(x)-sin(x); break; + case 3: temp = cos(x)-sin(x); break; + default: temp = 0.0; break; /* not used - purely to + * placate compiler */ + } + b = invsqrtpi*temp/sqrt(x); + } else { + a = __ieee754_j0(x); + b = __ieee754_j1(x); + for(i=1;i33) /* underflow */ + b = zero; + else { + temp = x*0.5; b = temp; + for (a=one,i=2;i<=n;i++) { + a *= (double)i; /* a = n! */ + b *= temp; /* b = (x/2)^n */ + } + b = b/a; + } + } else { + /* use backward recurrence */ + /* x x^2 x^2 + * J(n,x)/J(n-1,x) = ---- ------ ------ ..... + * 2n - 2(n+1) - 2(n+2) + * + * 1 1 1 + * (for large x) = ---- ------ ------ ..... + * 2n 2(n+1) 2(n+2) + * -- - ------ - ------ - + * x x x + * + * Let w = 2n/x and h=2/x, then the above quotient + * is equal to the continued fraction: + * 1 + * = ----------------------- + * 1 + * w - ----------------- + * 1 + * w+h - --------- + * w+2h - ... + * + * To determine how many terms needed, let + * Q(0) = w, Q(1) = w(w+h) - 1, + * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), + * When Q(k) > 1e4 good for single + * When Q(k) > 1e9 good for double + * When Q(k) > 1e17 good for quadruple + */ + /* determine k */ + double t,v; + double q0,q1,h,tmp; int k,m; + w = (n+n)/(double)x; h = 2.0/(double)x; + q0 = w; z = w+h; q1 = w*z - 1.0; k=1; + while(q1<1.0e9) { + k += 1; z += h; + tmp = z*q1 - q0; + q0 = q1; + q1 = tmp; + } + m = n+n; + for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t); + a = t; + b = one; + /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n) + * Hence, if n*(log(2n/x)) > ... + * single 8.8722839355e+01 + * double 7.09782712893383973096e+02 + * long double 1.1356523406294143949491931077970765006170e+04 + * then recurrent value may overflow and the result is + * likely underflow to zero + */ + tmp = n; + v = two/x; + tmp = tmp*__ieee754_log(fabs(v*tmp)); + if(tmp<7.09782712893383973096e+02) { + for(i=n-1,di=(double)(i+i);i>0;i--){ + temp = b; + b *= di; + b = b/x - a; + a = temp; + di -= two; + } + } else { + for(i=n-1,di=(double)(i+i);i>0;i--){ + temp = b; + b *= di; + b = b/x - a; + a = temp; + di -= two; + /* scale b to avoid spurious overflow */ + if(b>1e100) { + a /= b; + t /= b; + b = one; + } + } + } + b = (t*__ieee754_j0(x)/b); + } + } + if(sgn==1) return -b; else return b; +} + + double __ieee754_yn(int n, double x) +{ + int i,hx,ix,lx; + int sign; + double a, b, temp; + + hx = CYG_LIBM_HI(x); + ix = 0x7fffffff&hx; + lx = CYG_LIBM_LO(x); + /* if Y(n,NaN) is NaN */ + if((ix|((unsigned)(lx|-lx))>>31)>0x7ff00000) return x+x; + if((ix|lx)==0) return -one/zero; + if(hx<0) return zero/zero; + sign = 1; + if(n<0){ + n = -n; + sign = 1 - ((n&1)<<1); + } + if(n==0) return(__ieee754_y0(x)); + if(n==1) return(sign*__ieee754_y1(x)); + if(ix==0x7ff00000) return zero; + if(ix>=0x52D00000) { /* x > 2**302 */ + /* (x >> n**2) + * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Let s=sin(x), c=cos(x), + * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then + * + * n sin(xn)*sqt2 cos(xn)*sqt2 + * ---------------------------------- + * 0 s-c c+s + * 1 -s-c -c+s + * 2 -s+c -c-s + * 3 s+c c-s + */ + switch(n&3) { + case 0: temp = sin(x)-cos(x); break; + case 1: temp = -sin(x)-cos(x); break; + case 2: temp = -sin(x)+cos(x); break; + case 3: temp = sin(x)+cos(x); break; + default: temp = 0.0; break; /* not used - purely to + * placate compiler */ + } + b = invsqrtpi*temp/sqrt(x); + } else { + a = __ieee754_y0(x); + b = __ieee754_y1(x); + /* quit if b is -inf */ + for(i=1;i0) return b; else return -b; +} + +#endif // ifdef CYGPKG_LIBM + +// EOF e_jn.c diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_lgamma.c b/packages/language/c/libm/current/src/double/ieee754-core/e_lgamma.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_lgamma.c @@ -0,0 +1,94 @@ +//=========================================================================== +// +// e_lgamma.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_lgamma.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* __ieee754_lgamma(x) + * Return the logarithm of the Gamma function of x. + * + * Method: call __ieee754_lgamma_r + */ + +#include +#include "mathincl/fdlibm.h" + +double +__ieee754_lgamma(double x) +{ + return __ieee754_lgamma_r(x,&signgam); +} + +#endif // ifdef CYGPKG_LIBM + +// EOF e_lgamma.c diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_lgamma_r.c b/packages/language/c/libm/current/src/double/ieee754-core/e_lgamma_r.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_lgamma_r.c @@ -0,0 +1,357 @@ +//=========================================================================== +// +// e_lgamma_r.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_lgamma_r.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* __ieee754_lgamma_r(x, signgamp) + * Reentrant version of the logarithm of the Gamma function + * with user provide pointer for the sign of Gamma(x). + * + * Method: + * 1. Argument Reduction for 0 < x <= 8 + * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may + * reduce x to a number in [1.5,2.5] by + * lgamma(1+s) = log(s) + lgamma(s) + * for example, + * lgamma(7.3) = log(6.3) + lgamma(6.3) + * = log(6.3*5.3) + lgamma(5.3) + * = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3) + * 2. Polynomial approximation of lgamma around its + * minimun ymin=1.461632144968362245 to maintain monotonicity. + * On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use + * Let z = x-ymin; + * lgamma(x) = -1.214862905358496078218 + z^2*poly(z) + * where + * poly(z) is a 14 degree polynomial. + * 2. Rational approximation in the primary interval [2,3] + * We use the following approximation: + * s = x-2.0; + * lgamma(x) = 0.5*s + s*P(s)/Q(s) + * with accuracy + * |P/Q - (lgamma(x)-0.5s)| < 2**-61.71 + * Our algorithms are based on the following observation + * + * zeta(2)-1 2 zeta(3)-1 3 + * lgamma(2+s) = s*(1-Euler) + --------- * s - --------- * s + ... + * 2 3 + * + * where Euler = 0.5771... is the Euler constant, which is very + * close to 0.5. + * + * 3. For x>=8, we have + * lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+.... + * (better formula: + * lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...) + * Let z = 1/x, then we approximation + * f(z) = lgamma(x) - (x-0.5)(log(x)-1) + * by + * 3 5 11 + * w = w0 + w1*z + w2*z + w3*z + ... + w6*z + * where + * |w - f(z)| < 2**-58.74 + * + * 4. For negative x, since (G is gamma function) + * -x*G(-x)*G(x) = pi/sin(pi*x), + * we have + * G(x) = pi/(sin(pi*x)*(-x)*G(-x)) + * since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0 + * Hence, for x<0, signgam = sign(sin(pi*x)) and + * lgamma(x) = log(|Gamma(x)|) + * = log(pi/(|x*sin(pi*x)|)) - lgamma(-x); + * Note: one should avoid compute pi*(-x) directly in the + * computation of sin(pi*(-x)). + * + * 5. Special Cases + * lgamma(2+s) ~ s*(1-Euler) for tiny s + * lgamma(1)=lgamma(2)=0 + * lgamma(x) ~ -log(x) for tiny x + * lgamma(0) = lgamma(inf) = inf + * lgamma(-integer) = +-inf + * + */ + +#include "mathincl/fdlibm.h" + +static const double +two52= 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ +half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ +a0 = 7.72156649015328655494e-02, /* 0x3FB3C467, 0xE37DB0C8 */ +a1 = 3.22467033424113591611e-01, /* 0x3FD4A34C, 0xC4A60FAD */ +a2 = 6.73523010531292681824e-02, /* 0x3FB13E00, 0x1A5562A7 */ +a3 = 2.05808084325167332806e-02, /* 0x3F951322, 0xAC92547B */ +a4 = 7.38555086081402883957e-03, /* 0x3F7E404F, 0xB68FEFE8 */ +a5 = 2.89051383673415629091e-03, /* 0x3F67ADD8, 0xCCB7926B */ +a6 = 1.19270763183362067845e-03, /* 0x3F538A94, 0x116F3F5D */ +a7 = 5.10069792153511336608e-04, /* 0x3F40B6C6, 0x89B99C00 */ +a8 = 2.20862790713908385557e-04, /* 0x3F2CF2EC, 0xED10E54D */ +a9 = 1.08011567247583939954e-04, /* 0x3F1C5088, 0x987DFB07 */ +a10 = 2.52144565451257326939e-05, /* 0x3EFA7074, 0x428CFA52 */ +a11 = 4.48640949618915160150e-05, /* 0x3F07858E, 0x90A45837 */ +tc = 1.46163214496836224576e+00, /* 0x3FF762D8, 0x6356BE3F */ +tf = -1.21486290535849611461e-01, /* 0xBFBF19B9, 0xBCC38A42 */ +/* tt = -(tail of tf) */ +tt = -3.63867699703950536541e-18, /* 0xBC50C7CA, 0xA48A971F */ +t0 = 4.83836122723810047042e-01, /* 0x3FDEF72B, 0xC8EE38A2 */ +t1 = -1.47587722994593911752e-01, /* 0xBFC2E427, 0x8DC6C509 */ +t2 = 6.46249402391333854778e-02, /* 0x3FB08B42, 0x94D5419B */ +t3 = -3.27885410759859649565e-02, /* 0xBFA0C9A8, 0xDF35B713 */ +t4 = 1.79706750811820387126e-02, /* 0x3F9266E7, 0x970AF9EC */ +t5 = -1.03142241298341437450e-02, /* 0xBF851F9F, 0xBA91EC6A */ +t6 = 6.10053870246291332635e-03, /* 0x3F78FCE0, 0xE370E344 */ +t7 = -3.68452016781138256760e-03, /* 0xBF6E2EFF, 0xB3E914D7 */ +t8 = 2.25964780900612472250e-03, /* 0x3F6282D3, 0x2E15C915 */ +t9 = -1.40346469989232843813e-03, /* 0xBF56FE8E, 0xBF2D1AF1 */ +t10 = 8.81081882437654011382e-04, /* 0x3F4CDF0C, 0xEF61A8E9 */ +t11 = -5.38595305356740546715e-04, /* 0xBF41A610, 0x9C73E0EC */ +t12 = 3.15632070903625950361e-04, /* 0x3F34AF6D, 0x6C0EBBF7 */ +t13 = -3.12754168375120860518e-04, /* 0xBF347F24, 0xECC38C38 */ +t14 = 3.35529192635519073543e-04, /* 0x3F35FD3E, 0xE8C2D3F4 */ +u0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ +u1 = 6.32827064025093366517e-01, /* 0x3FE4401E, 0x8B005DFF */ +u2 = 1.45492250137234768737e+00, /* 0x3FF7475C, 0xD119BD6F */ +u3 = 9.77717527963372745603e-01, /* 0x3FEF4976, 0x44EA8450 */ +u4 = 2.28963728064692451092e-01, /* 0x3FCD4EAE, 0xF6010924 */ +u5 = 1.33810918536787660377e-02, /* 0x3F8B678B, 0xBF2BAB09 */ +v1 = 2.45597793713041134822e+00, /* 0x4003A5D7, 0xC2BD619C */ +v2 = 2.12848976379893395361e+00, /* 0x40010725, 0xA42B18F5 */ +v3 = 7.69285150456672783825e-01, /* 0x3FE89DFB, 0xE45050AF */ +v4 = 1.04222645593369134254e-01, /* 0x3FBAAE55, 0xD6537C88 */ +v5 = 3.21709242282423911810e-03, /* 0x3F6A5ABB, 0x57D0CF61 */ +s0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ +s1 = 2.14982415960608852501e-01, /* 0x3FCB848B, 0x36E20878 */ +s2 = 3.25778796408930981787e-01, /* 0x3FD4D98F, 0x4F139F59 */ +s3 = 1.46350472652464452805e-01, /* 0x3FC2BB9C, 0xBEE5F2F7 */ +s4 = 2.66422703033638609560e-02, /* 0x3F9B481C, 0x7E939961 */ +s5 = 1.84028451407337715652e-03, /* 0x3F5E26B6, 0x7368F239 */ +s6 = 3.19475326584100867617e-05, /* 0x3F00BFEC, 0xDD17E945 */ +r1 = 1.39200533467621045958e+00, /* 0x3FF645A7, 0x62C4AB74 */ +r2 = 7.21935547567138069525e-01, /* 0x3FE71A18, 0x93D3DCDC */ +r3 = 1.71933865632803078993e-01, /* 0x3FC601ED, 0xCCFBDF27 */ +r4 = 1.86459191715652901344e-02, /* 0x3F9317EA, 0x742ED475 */ +r5 = 7.77942496381893596434e-04, /* 0x3F497DDA, 0xCA41A95B */ +r6 = 7.32668430744625636189e-06, /* 0x3EDEBAF7, 0xA5B38140 */ +w0 = 4.18938533204672725052e-01, /* 0x3FDACFE3, 0x90C97D69 */ +w1 = 8.33333333333329678849e-02, /* 0x3FB55555, 0x5555553B */ +w2 = -2.77777777728775536470e-03, /* 0xBF66C16C, 0x16B02E5C */ +w3 = 7.93650558643019558500e-04, /* 0x3F4A019F, 0x98CF38B6 */ +w4 = -5.95187557450339963135e-04, /* 0xBF4380CB, 0x8C0FE741 */ +w5 = 8.36339918996282139126e-04, /* 0x3F4B67BA, 0x4CDAD5D1 */ +w6 = -1.63092934096575273989e-03; /* 0xBF5AB89D, 0x0B9E43E4 */ + +static double zero= 0.00000000000000000000e+00; + + static double sin_pi(double x) +{ + double y,z; + int n,ix; + + ix = 0x7fffffff&CYG_LIBM_HI(x); + + if(ix<0x3fd00000) return __kernel_sin(pi*x,zero,0); + y = -x; /* x is assume negative */ + + /* + * argument reduction, make sure inexact flag not raised if input + * is an integer + */ + z = floor(y); + if(z!=y) { /* inexact anyway */ + y *= 0.5; + y = 2.0*(y - floor(y)); /* y = |x| mod 2.0 */ + n = (int) (y*4.0); + } else { + if(ix>=0x43400000) { + y = zero; n = 0; /* y must be even */ + } else { + if(ix<0x43300000) z = y+two52; /* exact */ + n = CYG_LIBM_LO(z)&1; /* lower word of z */ + y = n; + n<<= 2; + } + } + switch (n) { + case 0: y = __kernel_sin(pi*y,zero,0); break; + case 1: + case 2: y = __kernel_cos(pi*(0.5-y),zero); break; + case 3: + case 4: y = __kernel_sin(pi*(one-y),zero,0); break; + case 5: + case 6: y = -__kernel_cos(pi*(y-1.5),zero); break; + default: y = __kernel_sin(pi*(y-2.0),zero,0); break; + } + return -y; +} + + + double __ieee754_lgamma_r(double x, int *signgamp) +{ + double t,y,z,nadj,p,p1,p2,p3,q,r,w; + int i,hx,lx,ix; + + nadj = 0.0; /* to placate compiler */ + hx = CYG_LIBM_HI(x); + lx = CYG_LIBM_LO(x); + + /* purge off +-inf, NaN, +-0, and negative arguments */ + *signgamp = 1; + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) return x*x; + if((ix|lx)==0) return one/zero; + if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */ + if(hx<0) { + *signgamp = -1; + return -__ieee754_log(-x); + } else return -__ieee754_log(x); + } + if(hx<0) { + if(ix>=0x43300000) /* |x|>=2**52, must be -integer */ + return one/zero; + t = sin_pi(x); + if(t==zero) return one/zero; /* -integer */ + nadj = __ieee754_log(pi/fabs(t*x)); + if(t=0x3FE76944) {y = one-x; i= 0;} + else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;} + else {y = x; i=2;} + } else { + r = zero; + if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */ + else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */ + else {y=x-one;i=2;} + } + switch(i) { + case 0: + z = y*y; + p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); + p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); + p = y*p1+p2; + r += (p-0.5*y); break; + case 1: + z = y*y; + w = z*y; + p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ + p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); + p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); + p = z*p1-(tt-w*(p2+y*p3)); + r += (tf + p); break; + case 2: + p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); + p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); + r += (-0.5*y + p1/p2); + } + } + else if(ix<0x40200000) { /* x < 8.0 */ + i = (int)x; + t = zero; + y = x-(double)i; + p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); + q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); + r = half*y+p/q; + z = one; /* lgamma(1+s) = log(s) + lgamma(s) */ + switch(i) { + case 7: z *= (y+6.0); /* FALLTHRU */ + case 6: z *= (y+5.0); /* FALLTHRU */ + case 5: z *= (y+4.0); /* FALLTHRU */ + case 4: z *= (y+3.0); /* FALLTHRU */ + case 3: z *= (y+2.0); /* FALLTHRU */ + r += __ieee754_log(z); break; + } + /* 8.0 <= x < 2**58 */ + } else if (ix < 0x43900000) { + t = __ieee754_log(x); + z = one/x; + y = z*z; + w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); + r = (x-half)*(t-one)+w; + } else + /* 2**58 <= x <= inf */ + r = x*(__ieee754_log(x)-one); + if(hx<0) r = nadj - r; + return r; +} + +#endif // ifdef CYGPKG_LIBM + +// EOF e_lgamma_r.c diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_log.c b/packages/language/c/libm/current/src/double/ieee754-core/e_log.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_log.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_log.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_log10.c b/packages/language/c/libm/current/src/double/ieee754-core/e_log10.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_log10.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_log10.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_pow.c b/packages/language/c/libm/current/src/double/ieee754-core/e_pow.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_pow.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_pow.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_rem_pio2.c b/packages/language/c/libm/current/src/double/ieee754-core/e_rem_pio2.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_rem_pio2.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_rem_pio2.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_remainder.c b/packages/language/c/libm/current/src/double/ieee754-core/e_remainder.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_remainder.c @@ -0,0 +1,134 @@ +//=========================================================================== +// +// e_remainder.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)e_remainder.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_remainder(x,p) + * Return : + * returns x REM p = x - [x/p]*p as if in infinite + * precise arithmetic, where [x/p] is the (infinite bit) + * integer nearest x/p (in half way case choose the even one). + * Method : + * Based on fmod() return x-[x/p]chopped*p exactlp. + */ + +#include "mathincl/fdlibm.h" + +static const double zero = 0.0; + + + double __ieee754_remainder(double x, double p) +{ + int hx,hp; + unsigned sx,lx,lp; + double p_half; + + hx = CYG_LIBM_HI(x); /* high word of x */ + lx = CYG_LIBM_LO(x); /* low word of x */ + hp = CYG_LIBM_HI(p); /* high word of p */ + lp = CYG_LIBM_LO(p); /* low word of p */ + sx = hx&0x80000000; + hp &= 0x7fffffff; + hx &= 0x7fffffff; + + /* purge off exception values */ + if((hp|lp)==0) return (x*p)/(x*p); /* p = 0 */ + if((hx>=0x7ff00000)|| /* x not finite */ + ((hp>=0x7ff00000)&& /* p is NaN */ + (((hp-0x7ff00000)|lp)!=0))) + return (x*p)/(x*p); + + + if (hp<=0x7fdfffff) x = __ieee754_fmod(x,p+p); /* now x < 2p */ + if (((hx-hp)|(lx-lp))==0) return zero*x; + x = fabs(x); + p = fabs(p); + if (hp<0x00200000) { + if(x+x>p) { + x-=p; + if(x+x>=p) x -= p; + } + } else { + p_half = 0.5*p; + if(x>p_half) { + x-=p; + if(x>=p_half) x -= p; + } + } + CYG_LIBM_HI(x) ^= sx; + return x; +} + +#endif // ifdef CYGPKG_LIBM + +// EOF e_remainder.c diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_scalb.c b/packages/language/c/libm/current/src/double/ieee754-core/e_scalb.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_scalb.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_scalb.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_sinh.c b/packages/language/c/libm/current/src/double/ieee754-core/e_sinh.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_sinh.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_sinh.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/ieee754-core/e_sqrt.c b/packages/language/c/libm/current/src/double/ieee754-core/e_sqrt.c --- a/packages/language/c/libm/current/src/double/ieee754-core/e_sqrt.c +++ b/packages/language/c/libm/current/src/double/ieee754-core/e_sqrt.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/internal/k_cos.c b/packages/language/c/libm/current/src/double/internal/k_cos.c --- a/packages/language/c/libm/current/src/double/internal/k_cos.c +++ b/packages/language/c/libm/current/src/double/internal/k_cos.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/internal/k_rem_pio2.c b/packages/language/c/libm/current/src/double/internal/k_rem_pio2.c --- a/packages/language/c/libm/current/src/double/internal/k_rem_pio2.c +++ b/packages/language/c/libm/current/src/double/internal/k_rem_pio2.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/internal/k_sin.c b/packages/language/c/libm/current/src/double/internal/k_sin.c --- a/packages/language/c/libm/current/src/double/internal/k_sin.c +++ b/packages/language/c/libm/current/src/double/internal/k_sin.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/internal/k_tan.c b/packages/language/c/libm/current/src/double/internal/k_tan.c --- a/packages/language/c/libm/current/src/double/internal/k_tan.c +++ b/packages/language/c/libm/current/src/double/internal/k_tan.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_asinh.c b/packages/language/c/libm/current/src/double/portable-api/s_asinh.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/portable-api/s_asinh.c @@ -0,0 +1,118 @@ +//=========================================================================== +// +// s_asinh.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)s_asinh.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* asinh(x) + * Method : + * Based on + * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] + * we have + * asinh(x) := x if 1+x*x=1, + * := sign(x)*(log(x)+ln2)) for large |x|, else + * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else + * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) + */ + +#include "mathincl/fdlibm.h" + +static const double +one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ +huge= 1.00000000000000000000e+300; + + double asinh(double x) +{ + double t,w; + int hx,ix; + hx = CYG_LIBM_HI(x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */ + if(ix< 0x3e300000) { /* |x|<2**-28 */ + if(huge+x>one) return x; /* return x inexact except 0 */ + } + if(ix>0x41b00000) { /* |x| > 2**28 */ + w = __ieee754_log(fabs(x))+ln2; + } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ + t = fabs(x); + w = __ieee754_log(2.0*t+one/(sqrt(x*x+one)+t)); + } else { /* 2.0 > |x| > 2**-28 */ + t = x*x; + w =log1p(fabs(x)+t/(one+sqrt(one+t))); + } + if(hx>0) return w; else return -w; +} + +#endif // ifdef CYGPKG_LIBM + +// EOF s_asinh.c diff --git a/packages/language/c/libm/current/src/double/portable-api/s_atan.c b/packages/language/c/libm/current/src/double/portable-api/s_atan.c --- a/packages/language/c/libm/current/src/double/portable-api/s_atan.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_atan.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_cbrt.c b/packages/language/c/libm/current/src/double/portable-api/s_cbrt.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/portable-api/s_cbrt.c @@ -0,0 +1,140 @@ +//=========================================================================== +// +// s_cbrt.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)s_cbrt.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +#include "mathincl/fdlibm.h" + +/* cbrt(x) + * Return cube root of x + */ +static const unsigned + B1 = 715094163, /* B1 = (682-0.03306235651)*2**20 */ + B2 = 696219795; /* B2 = (664-0.03306235651)*2**20 */ + +static const double +C = 5.42857142857142815906e-01, /* 19/35 = 0x3FE15F15, 0xF15F15F1 */ +D = -7.05306122448979611050e-01, /* -864/1225 = 0xBFE691DE, 0x2532C834 */ +E = 1.41428571428571436819e+00, /* 99/70 = 0x3FF6A0EA, 0x0EA0EA0F */ +F = 1.60714285714285720630e+00, /* 45/28 = 0x3FF9B6DB, 0x6DB6DB6E */ +G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ + + double cbrt(double x) +{ + int hx; + double r,s,t=0.0,w; + unsigned sign; + + + hx = CYG_LIBM_HI(x); /* high word of x */ + sign=hx&0x80000000; /* sign= sign(x) */ + hx ^=sign; + if(hx>=0x7ff00000) return(x+x); /* cbrt(NaN,INF) is itself */ + if((hx|CYG_LIBM_LO(x))==0) + return(x); /* cbrt(0) is itself */ + + CYG_LIBM_HI(x) = hx; /* x <- |x| */ + /* rough cbrt to 5 bits */ + if(hx<0x00100000) /* subnormal number */ + {CYG_LIBM_HI(t)=0x43500000; /* set t= 2**54 */ + t*=x; CYG_LIBM_HI(t)=CYG_LIBM_HI(t)/3+B2; + } + else + CYG_LIBM_HI(t)=hx/3+B1; + + + /* new cbrt to 23 bits, may be implemented in single precision */ + r=t*t/x; + s=C+r*t; + t*=G+F/(s+E+D/s); + + /* chopped to 20 bits and make it larger than cbrt(x) */ + CYG_LIBM_LO(t)=0; CYG_LIBM_HI(t)+=0x00000001; + + + /* one step newton iteration to 53 bits with error less than 0.667 ulps */ + s=t*t; /* t*t is exact */ + r=x/s; + w=t+t; + r=(r-t)/(w+r); /* r-s is exact */ + t=t+t*r; + + /* retore the sign bit */ + CYG_LIBM_HI(t) |= sign; + return(t); +} + +#endif // ifdef CYGPKG_LIBM + +// EOF s_cbrt.c diff --git a/packages/language/c/libm/current/src/double/portable-api/s_ceil.c b/packages/language/c/libm/current/src/double/portable-api/s_ceil.c --- a/packages/language/c/libm/current/src/double/portable-api/s_ceil.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_ceil.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_copysign.c b/packages/language/c/libm/current/src/double/portable-api/s_copysign.c --- a/packages/language/c/libm/current/src/double/portable-api/s_copysign.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_copysign.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_cos.c b/packages/language/c/libm/current/src/double/portable-api/s_cos.c --- a/packages/language/c/libm/current/src/double/portable-api/s_cos.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_cos.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_erf.c b/packages/language/c/libm/current/src/double/portable-api/s_erf.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/portable-api/s_erf.c @@ -0,0 +1,362 @@ +//=========================================================================== +// +// s_erf.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)s_erf.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* double erf(double x) + * double erfc(double x) + * x + * 2 |\ + * erf(x) = --------- | exp(-t*t)dt + * sqrt(pi) \| + * 0 + * + * erfc(x) = 1-erf(x) + * Note that + * erf(-x) = -erf(x) + * erfc(-x) = 2 - erfc(x) + * + * Method: + * 1. For |x| in [0, 0.84375] + * erf(x) = x + x*R(x^2) + * erfc(x) = 1 - erf(x) if x in [-.84375,0.25] + * = 0.5 + ((0.5-x)-x*R) if x in [0.25,0.84375] + * where R = P/Q where P is an odd poly of degree 8 and + * Q is an odd poly of degree 10. + * -57.90 + * | R - (erf(x)-x)/x | <= 2 + * + * + * Remark. The formula is derived by noting + * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) + * and that + * 2/sqrt(pi) = 1.128379167095512573896158903121545171688 + * is close to one. The interval is chosen because the fix + * point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is + * near 0.6174), and by some experiment, 0.84375 is chosen to + * guarantee the error is less than one ulp for erf. + * + * 2. For |x| in [0.84375,1.25], let s = |x| - 1, and + * c = 0.84506291151 rounded to single (24 bits) + * erf(x) = sign(x) * (c + P1(s)/Q1(s)) + * erfc(x) = (1-c) - P1(s)/Q1(s) if x > 0 + * 1+(c+P1(s)/Q1(s)) if x < 0 + * |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06 + * Remark: here we use the taylor series expansion at x=1. + * erf(1+s) = erf(1) + s*Poly(s) + * = 0.845.. + P1(s)/Q1(s) + * That is, we use rational approximation to approximate + * erf(1+s) - (c = (single)0.84506291151) + * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] + * where + * P1(s) = degree 6 poly in s + * Q1(s) = degree 6 poly in s + * + * 3. For x in [1.25,1/0.35(~2.857143)], + * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) + * erf(x) = 1 - erfc(x) + * where + * R1(z) = degree 7 poly in z, (z=1/x^2) + * S1(z) = degree 8 poly in z + * + * 4. For x in [1/0.35,28] + * erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0 + * = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6 x >= 28 + * erf(x) = sign(x) *(1 - tiny) (raise inexact) + * erfc(x) = tiny*tiny (raise underflow) if x > 0 + * = 2 - tiny if x<0 + * + * 7. Special case: + * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, + * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, + * erfc/erf(NaN) is NaN + */ + + +#include "mathincl/fdlibm.h" + +static const double +tiny = 1e-300, +half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ + /* c = (float)0.84506291151 */ +erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */ +/* + * Coefficients for approximation to erf on [0,0.84375] + */ +efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */ +efx8= 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */ +pp0 = 1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */ +pp1 = -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */ +pp2 = -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */ +pp3 = -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */ +pp4 = -2.37630166566501626084e-05, /* 0xBEF8EAD6, 0x120016AC */ +qq1 = 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */ +qq2 = 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */ +qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ +qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ +qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */ +/* + * Coefficients for approximation to erf in [0.84375,1.25] + */ +pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ +pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ +pa2 = -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */ +pa3 = 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */ +pa4 = -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */ +pa5 = 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */ +pa6 = -2.16637559486879084300e-03, /* 0xBF61BF38, 0x0A96073F */ +qa1 = 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */ +qa2 = 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */ +qa3 = 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */ +qa4 = 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */ +qa5 = 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */ +qa6 = 1.19844998467991074170e-02, /* 0x3F888B54, 0x5735151D */ +/* + * Coefficients for approximation to erfc in [1.25,1/0.35] + */ +ra0 = -9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */ +ra1 = -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */ +ra2 = -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */ +ra3 = -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */ +ra4 = -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */ +ra5 = -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */ +ra6 = -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */ +ra7 = -9.81432934416914548592e+00, /* 0xC023A0EF, 0xC69AC25C */ +sa1 = 1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */ +sa2 = 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */ +sa3 = 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */ +sa4 = 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */ +sa5 = 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */ +sa6 = 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */ +sa7 = 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */ +sa8 = -6.04244152148580987438e-02, /* 0xBFAEEFF2, 0xEE749A62 */ +/* + * Coefficients for approximation to erfc in [1/.35,28] + */ +rb0 = -9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */ +rb1 = -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */ +rb2 = -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */ +rb3 = -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */ +rb4 = -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */ +rb5 = -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */ +rb6 = -4.83519191608651397019e+02, /* 0xC07E384E, 0x9BDC383F */ +sb1 = 3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */ +sb2 = 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */ +sb3 = 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */ +sb4 = 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */ +sb5 = 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */ +sb6 = 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */ +sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ + + double erf(double x) +{ + int hx,ix,i; + double R,S,P,Q,s,y,z,r; + hx = CYG_LIBM_HI(x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) { /* erf(nan)=nan */ + i = ((unsigned)hx>>31)<<1; + return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */ + } + + if(ix < 0x3feb0000) { /* |x|<0.84375 */ + if(ix < 0x3e300000) { /* |x|<2**-28 */ + if (ix < 0x00800000) + return 0.125*(8.0*x+efx8*x); /*avoid underflow */ + return x + efx*x; + } + z = x*x; + r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); + s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); + y = r/s; + return x + x*y; + } + if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ + s = fabs(x)-one; + P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); + if(hx>=0) return erx + P/Q; else return -erx - P/Q; + } + if (ix >= 0x40180000) { /* inf>|x|>=6 */ + if(hx>=0) return one-tiny; else return tiny-one; + } + x = fabs(x); + s = one/(x*x); + if(ix< 0x4006DB6E) { /* |x| < 1/0.35 */ + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( + ra5+s*(ra6+s*ra7)))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( + sa5+s*(sa6+s*(sa7+s*sa8))))))); + } else { /* |x| >= 1/0.35 */ + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( + rb5+s*rb6))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( + sb5+s*(sb6+s*sb7)))))); + } + z = x; + CYG_LIBM_LO(z) = 0; + r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); + if(hx>=0) return one-r/x; else return r/x-one; +} + + double erfc(double x) +{ + int hx,ix; + double R,S,P,Q,s,y,z,r; + hx = CYG_LIBM_HI(x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) { /* erfc(nan)=nan */ + /* erfc(+-inf)=0,2 */ + return (double)(((unsigned)hx>>31)<<1)+one/x; + } + + if(ix < 0x3feb0000) { /* |x|<0.84375 */ + if(ix < 0x3c700000) /* |x|<2**-56 */ + return one-x; + z = x*x; + r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); + s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); + y = r/s; + if(hx < 0x3fd00000) { /* x<1/4 */ + return one-(x+x*y); + } else { + r = x*y; + r += (x-half); + return half - r ; + } + } + if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ + s = fabs(x)-one; + P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); + if(hx>=0) { + z = one-erx; return z - P/Q; + } else { + z = erx+P/Q; return one+z; + } + } + if (ix < 0x403c0000) { /* |x|<28 */ + x = fabs(x); + s = one/(x*x); + if(ix< 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/ + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( + ra5+s*(ra6+s*ra7)))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( + sa5+s*(sa6+s*(sa7+s*sa8))))))); + } else { /* |x| >= 1/.35 ~ 2.857143 */ + if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */ + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( + rb5+s*rb6))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( + sb5+s*(sb6+s*sb7)))))); + } + z = x; + CYG_LIBM_LO(z) = 0; + r = __ieee754_exp(-z*z-0.5625)* + __ieee754_exp((z-x)*(z+x)+R/S); + if(hx>0) return r/x; else return two-r/x; + } else { + if(hx>0) return tiny*tiny; else return two-tiny; + } +} + +#endif // ifdef CYGPKG_LIBM + +// EOF s_erf.c diff --git a/packages/language/c/libm/current/src/double/portable-api/s_expm1.c b/packages/language/c/libm/current/src/double/portable-api/s_expm1.c --- a/packages/language/c/libm/current/src/double/portable-api/s_expm1.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_expm1.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_fabs.c b/packages/language/c/libm/current/src/double/portable-api/s_fabs.c --- a/packages/language/c/libm/current/src/double/portable-api/s_fabs.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_fabs.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_finite.c b/packages/language/c/libm/current/src/double/portable-api/s_finite.c --- a/packages/language/c/libm/current/src/double/portable-api/s_finite.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_finite.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_floor.c b/packages/language/c/libm/current/src/double/portable-api/s_floor.c --- a/packages/language/c/libm/current/src/double/portable-api/s_floor.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_floor.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_frexp.c b/packages/language/c/libm/current/src/double/portable-api/s_frexp.c --- a/packages/language/c/libm/current/src/double/portable-api/s_frexp.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_frexp.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_ilogb.c b/packages/language/c/libm/current/src/double/portable-api/s_ilogb.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/portable-api/s_ilogb.c @@ -0,0 +1,107 @@ +//=========================================================================== +// +// s_ilogb.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)s_ilogb.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* ilogb(double x) + * return the binary exponent of non-zero x + * ilogb(0) = 0x80000001 + * ilogb(inf/NaN) = 0x7fffffff (no signal is raised) + */ + +#include "mathincl/fdlibm.h" + + int ilogb(double x) +{ + int hx,lx,ix; + + hx = (CYG_LIBM_HI(x))&0x7fffffff; /* high word of x */ + if(hx<0x00100000) { + lx = CYG_LIBM_LO(x); + if((hx|lx)==0) + return 0x80000001; /* ilogb(0) = 0x80000001 */ + else /* subnormal x */ + if(hx==0) { + for (ix = -1043; lx>0; lx<<=1) ix -=1; + } else { + for (ix = -1022,hx<<=11; hx>0; hx<<=1) ix -=1; + } + return ix; + } + else if (hx<0x7ff00000) return (hx>>20)-1023; + else return 0x7fffffff; +} + +#endif // ifdef CYGPKG_LIBM + +// EOF s_ilogb.c diff --git a/packages/language/c/libm/current/src/double/portable-api/s_isnan.c b/packages/language/c/libm/current/src/double/portable-api/s_isnan.c --- a/packages/language/c/libm/current/src/double/portable-api/s_isnan.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_isnan.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_ldexp.c b/packages/language/c/libm/current/src/double/portable-api/s_ldexp.c --- a/packages/language/c/libm/current/src/double/portable-api/s_ldexp.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_ldexp.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_log1p.c b/packages/language/c/libm/current/src/double/portable-api/s_log1p.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/portable-api/s_log1p.c @@ -0,0 +1,227 @@ +//=========================================================================== +// +// s_log1p.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)s_log1p.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* double log1p(double x) + * + * Method : + * 1. Argument Reduction: find k and f such that + * 1+x = 2^k * (1+f), + * where sqrt(2)/2 < 1+f < sqrt(2) . + * + * Note. If k=0, then f=x is exact. However, if k!=0, then f + * may not be representable exactly. In that case, a correction + * term is need. Let u=1+x rounded. Let c = (1+x)-u, then + * log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u), + * and add back the correction term c/u. + * (Note: when x > 2**53, one can simply return log(x)) + * + * 2. Approximation of log1p(f). + * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) + * = 2s + 2/3 s**3 + 2/5 s**5 + ....., + * = 2s + s*R + * We use a special Reme algorithm on [0,0.1716] to generate + * a polynomial of degree 14 to approximate R The maximum error + * of this polynomial approximation is bounded by 2**-58.45. In + * other words, + * 2 4 6 8 10 12 14 + * R(z) ~ Lp1*s +Lp2*s +Lp3*s +Lp4*s +Lp5*s +Lp6*s +Lp7*s + * (the values of Lp1 to Lp7 are listed in the program) + * and + * | 2 14 | -58.45 + * | Lp1*s +...+Lp7*s - R(z) | <= 2 + * | | + * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. + * In order to guarantee error in log below 1ulp, we compute log + * by + * log1p(f) = f - (hfsq - s*(hfsq+R)). + * + * 3. Finally, log1p(x) = k*ln2 + log1p(f). + * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) + * Here ln2 is split into two floating point number: + * ln2_hi + ln2_lo, + * where n*ln2_hi is always exact for |n| < 2000. + * + * Special cases: + * log1p(x) is NaN with signal if x < -1 (including -INF) ; + * log1p(+INF) is +INF; log1p(-1) is -INF with signal; + * log1p(NaN) is that NaN with no signal. + * + * Accuracy: + * according to an error analysis, the error is always less than + * 1 ulp (unit in the last place). + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + * + * Note: Assuming log() return accurate answer, the following + * algorithm can be used to compute log1p(x) to within a few ULP: + * + * u = 1+x; + * if(u==1.0) return x ; else + * return log(u)*(x/(u-1.0)); + * + * See HP-15C Advanced Functions Handbook, p.193. + */ + +#include "mathincl/fdlibm.h" + +static const double +ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ +ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ +two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ +Lp1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ +Lp2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ +Lp3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ +Lp4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ +Lp5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ +Lp6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ +Lp7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ + +static double zero = 0.0; + + double log1p(double x) +{ + double hfsq,f,c,s,z,R,u; + int k,hx,hu,ax; + + c=f=hu=0.0; /* to placate compiler */ + hx = CYG_LIBM_HI(x); /* high word of x */ + ax = hx&0x7fffffff; + + k = 1; + if (hx < 0x3FDA827A) { /* x < 0.41422 */ + if(ax>=0x3ff00000) { /* x <= -1.0 */ + if(x==-1.0) return -two54/zero; /* log1p(-1)=+inf */ + else return (x-x)/(x-x); /* log1p(x<-1)=NaN */ + } + if(ax<0x3e200000) { /* |x| < 2**-29 */ + if(two54+x>zero /* raise inexact */ + &&ax<0x3c900000) /* |x| < 2**-54 */ + return x; + else + return x - x*x*0.5; + } + if(hx>0||hx<=((int)0xbfd2bec3)) { + k=0;f=x;hu=1;} /* -0.2929= 0x7ff00000) return x+x; + if(k!=0) { + if(hx<0x43400000) { + u = 1.0+x; + hu = CYG_LIBM_HI(u); /* high word of u */ + k = (hu>>20)-1023; + c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ + c /= u; + } else { + u = x; + hu = CYG_LIBM_HI(u); /* high word of u */ + k = (hu>>20)-1023; + c = 0; + } + hu &= 0x000fffff; + if(hu<0x6a09e) { + CYG_LIBM_HI(u) = hu|0x3ff00000; /* normalize u */ + } else { + k += 1; + CYG_LIBM_HI(u) = hu|0x3fe00000; /* normalize u/2 */ + hu = (0x00100000-hu)>>2; + } + f = u-1.0; + } + hfsq=0.5*f*f; + if(hu==0) { /* |f| < 2**-20 */ + if(f==zero) { + if(k==0) return zero; + else { + c += k*ln2_lo; return k*ln2_hi+c; + } + } + R = hfsq*(1.0-0.66666666666666666*f); + if(k==0) return f-R; + else return k*ln2_hi-((R-(k*ln2_lo+c))-f); + } + s = f/(2.0+f); + z = s*s; + R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); + if(k==0) return f-(hfsq-s*(hfsq+R)); + else return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); +} + +#endif // ifdef CYGPKG_LIBM + +// EOF s_log1p.c diff --git a/packages/language/c/libm/current/src/double/portable-api/s_logb.c b/packages/language/c/libm/current/src/double/portable-api/s_logb.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/portable-api/s_logb.c @@ -0,0 +1,99 @@ +//=========================================================================== +// +// s_logb.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)s_logb.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * double logb(x) + * IEEE 754 logb. Included to pass IEEE test suite. Not recommend. + * Use ilogb instead. + */ + +#include "mathincl/fdlibm.h" + + double logb(double x) +{ + int lx,ix; + ix = (CYG_LIBM_HI(x))&0x7fffffff; /* high |x| */ + lx = CYG_LIBM_LO(x); /* low x */ + if((ix|lx)==0) return -1.0/fabs(x); + if(ix>=0x7ff00000) return x*x; + if((ix>>=20)==0) /* IEEE 754 logb */ + return -1022.0; + else + return (double) (ix-1023); +} + +#endif // ifdef CYGPKG_LIBM + +// EOF s_logb.c diff --git a/packages/language/c/libm/current/src/double/portable-api/s_modf.c b/packages/language/c/libm/current/src/double/portable-api/s_modf.c --- a/packages/language/c/libm/current/src/double/portable-api/s_modf.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_modf.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_nextafter.c b/packages/language/c/libm/current/src/double/portable-api/s_nextafter.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/portable-api/s_nextafter.c @@ -0,0 +1,139 @@ +//=========================================================================== +// +// s_nextafter.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)s_nextafter.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* IEEE functions + * nextafter(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * Special cases: + */ + +#include "mathincl/fdlibm.h" + + double nextafter(double x, double y) +{ + int hx,hy,ix,iy; + unsigned lx,ly; + + hx = CYG_LIBM_HI(x); /* high word of x */ + lx = CYG_LIBM_LO(x); /* low word of x */ + hy = CYG_LIBM_HI(y); /* high word of y */ + ly = CYG_LIBM_LO(y); /* low word of y */ + ix = hx&0x7fffffff; /* |x| */ + iy = hy&0x7fffffff; /* |y| */ + + if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ + ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */ + return x+y; + if(x==y) return x; /* x=y, return x */ + if((ix|lx)==0) { /* x == 0 */ + CYG_LIBM_HI(x) = hy&0x80000000; /* return +-minsubnormal */ + CYG_LIBM_LO(x) = 1; + y = x*x; + if(y==x) return y; else return x; /* raise underflow flag */ + } + if(hx>=0) { /* x > 0 */ + if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ + if(lx==0) hx -= 1; + lx -= 1; + } else { /* x < y, x += ulp */ + lx += 1; + if(lx==0) hx += 1; + } + } else { /* x < 0 */ + if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */ + if(lx==0) hx -= 1; + lx -= 1; + } else { /* x > y, x += ulp */ + lx += 1; + if(lx==0) hx += 1; + } + } + hy = hx&0x7ff00000; + if(hy>=0x7ff00000) return x+x; /* overflow */ + if(hy<0x00100000) { /* underflow */ + y = x*x; + if(y!=x) { /* raise underflow flag */ + CYG_LIBM_HI(y) = hx; CYG_LIBM_LO(y) = lx; + return y; + } + } + CYG_LIBM_HI(x) = hx; CYG_LIBM_LO(x) = lx; + return x; +} + +#endif // ifdef CYGPKG_LIBM + +// EOF s_nextafter.c diff --git a/packages/language/c/libm/current/src/double/portable-api/s_rint.c b/packages/language/c/libm/current/src/double/portable-api/s_rint.c --- a/packages/language/c/libm/current/src/double/portable-api/s_rint.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_rint.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_scalbn.c b/packages/language/c/libm/current/src/double/portable-api/s_scalbn.c --- a/packages/language/c/libm/current/src/double/portable-api/s_scalbn.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_scalbn.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_significand.c b/packages/language/c/libm/current/src/double/portable-api/s_significand.c new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/double/portable-api/s_significand.c @@ -0,0 +1,91 @@ +//=========================================================================== +// +// s_significand.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// Derived from code with the following copyright + + +/* @(#)s_significand.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * significand(x) computes just + * scalb(x, (double) -ilogb(x)), + * for exercising the fraction-part(F) IEEE 754-1985 test vector. + */ + +#include "mathincl/fdlibm.h" + + double significand(double x) +{ + return __ieee754_scalb(x,(double) -ilogb(x)); +} + +#endif // ifdef CYGPKG_LIBM + +// EOF s_significand.c diff --git a/packages/language/c/libm/current/src/double/portable-api/s_sin.c b/packages/language/c/libm/current/src/double/portable-api/s_sin.c --- a/packages/language/c/libm/current/src/double/portable-api/s_sin.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_sin.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_tan.c b/packages/language/c/libm/current/src/double/portable-api/s_tan.c --- a/packages/language/c/libm/current/src/double/portable-api/s_tan.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_tan.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/double/portable-api/s_tanh.c b/packages/language/c/libm/current/src/double/portable-api/s_tanh.c --- a/packages/language/c/libm/current/src/double/portable-api/s_tanh.c +++ b/packages/language/c/libm/current/src/double/portable-api/s_tanh.c @@ -5,29 +5,38 @@ // Part of the standard mathematical function library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/mathincl/fdlibm.h b/packages/language/c/libm/current/src/mathincl/fdlibm.h --- a/packages/language/c/libm/current/src/mathincl/fdlibm.h +++ b/packages/language/c/libm/current/src/mathincl/fdlibm.h @@ -7,29 +7,38 @@ // Internal definitions for math library implementation based on fdlibm // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // @@ -184,10 +193,14 @@ externC double externC double __ieee754_acos( double ); +externC double +__ieee754_acosh( double ); externC double __ieee754_log( double ); +externC double +__ieee754_atanh( double ); externC double __ieee754_asin( double ); @@ -207,6 +220,17 @@ externC double externC double __ieee754_pow( double, double ); +externC double +__ieee754_lgamma_r( double, int * ); + +externC double +__ieee754_gamma_r( double, int * ); + +externC double +__ieee754_lgamma( double ); + +externC double +__ieee754_gamma( double ); externC double __ieee754_log10( double ); @@ -214,6 +238,29 @@ externC double externC double __ieee754_sinh( double ); +externC double +__ieee754_hypot( double, double ); + +externC double +__ieee754_j0( double ); + +externC double +__ieee754_j1( double ); + +externC double +__ieee754_y0( double ); + +externC double +__ieee754_y1( double ); + +externC double +__ieee754_jn( int, double ); + +externC double +__ieee754_yn( int, double ); + +externC double +__ieee754_remainder( double, double ); externC int __ieee754_rem_pio2( double, double * ); diff --git a/packages/language/c/libm/current/src/misc/compatmode.cxx b/packages/language/c/libm/current/src/misc/compatmode.cxx --- a/packages/language/c/libm/current/src/misc/compatmode.cxx +++ b/packages/language/c/libm/current/src/misc/compatmode.cxx @@ -5,29 +5,38 @@ // Compatibility mode setting for Math library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/misc/infconst.c b/packages/language/c/libm/current/src/misc/infconst.c --- a/packages/language/c/libm/current/src/misc/infconst.c +++ b/packages/language/c/libm/current/src/misc/infconst.c @@ -5,29 +5,38 @@ // Infinity constant // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/misc/matherr.c b/packages/language/c/libm/current/src/misc/matherr.c --- a/packages/language/c/libm/current/src/misc/matherr.c +++ b/packages/language/c/libm/current/src/misc/matherr.c @@ -5,29 +5,38 @@ // Default matherr() error handler // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/src/misc/signgam.cxx b/packages/language/c/libm/current/src/misc/signgam.cxx new file mode 100644 --- /dev/null +++ b/packages/language/c/libm/current/src/misc/signgam.cxx @@ -0,0 +1,147 @@ +//=========================================================================== +// +// signgam.cxx +// +// Support sign of the gamma*() functions in Math library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: Contains the accessor functions to get and set the stored sign +// of the gamma*() functions in the math library +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// CONFIGURATION + +#include // Configuration header + +// Include the Math library? +#ifdef CYGPKG_LIBM + +// INCLUDES + +#include // Common type definitions and support +#include // Tracing macros + +#include // Main header for math library + +#ifdef CYGSEM_LIBM_THREAD_SAFE_GAMMA_FUNCTIONS +# include // Kernel configuration +# include // Kernel thread header +# include // and its associated inlines +# include // We need mutexes too +#endif + + +// GLOBAL VARIABLES + +#ifndef CYGSEM_LIBM_THREAD_SAFE_GAMMA_FUNCTIONS + +int signgam = 0; + +#else // ifndef CYGSEM_LIBM_THREAD_SAFE_GAMMA_FUNCTIONS + +static Cyg_Mutex cyg_libm_signgam_thread_data_index_mutex; +static cyg_count32 cyg_libm_signgam_thread_data_index = CYGNUM_KERNEL_THREADS_DATA_MAX; + +# if defined(CYGDBG_USE_TRACING) && \ + defined(CYGNUM_LIBM_SIGNGAM_TRACE_LEVEL) +static int libm_signgam_trace = CYGNUM_LIBM_SIGNGAM_TRACE_LEVEL; +# define TL1 (0 < libm_signgam_trace ) +# else +# define TL1 (0) +# endif + +#endif // ifndef CYGSEM_LIBM_THREAD_SAFE_GAMMA_FUNCTIONS + +// FUNCTIONS + +#ifdef CYGSEM_LIBM_THREAD_SAFE_GAMMA_FUNCTIONS + +int * +cyg_libm_get_signgam_p( void ) +{ + Cyg_Thread *self = Cyg_Thread::self(); + CYG_ADDRWORD *current_val_p; + + CYG_REPORT_FUNCNAMETYPE( "Cyg_libm_get_signgam_p", "&signgam is %08x" ); + + // First check if this is the first thread to get here, and if so, + // initialise the thread data index + + if (cyg_libm_signgam_thread_data_index == CYGNUM_KERNEL_THREADS_DATA_MAX) + { + CYG_TRACE0( TL1, "Index unset, locking mutex to allocate" ); + + // Lock mutex and then check again - less overhead for normal + // execution path + cyg_libm_signgam_thread_data_index_mutex.lock(); + + if (cyg_libm_signgam_thread_data_index == CYGNUM_KERNEL_THREADS_DATA_MAX) + { + CYG_TRACE0( TL1, "Allocating index" ); + cyg_libm_signgam_thread_data_index = self->new_data_index(); + + } // if + + cyg_libm_signgam_thread_data_index_mutex.unlock(); + + } // if + + CYG_TRACE0( TL1, "Index set, now fetching per-thread data" ); + + // If we're here, then the index is set up + + current_val_p = self->get_data_ptr( cyg_libm_signgam_thread_data_index ); + + CYG_REPORT_RETVAL( current_val_p ); + return (int *) current_val_p; +} // cyg_libm_get_signgam_p() + +#endif // ifdef CYGSEM_LIBM_THREAD_SAFE_GAMMA_FUNCTIONS + + +#endif // ifdef CYGPKG_LIBM + +// EOF signgam.cxx diff --git a/packages/language/c/libm/current/src/misc/standard.c b/packages/language/c/libm/current/src/misc/standard.c --- a/packages/language/c/libm/current/src/misc/standard.c +++ b/packages/language/c/libm/current/src/misc/standard.c @@ -5,29 +5,38 @@ // Support sign of the gamma*() functions in Math library // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/acos.c b/packages/language/c/libm/current/tests/vectors/acos.c --- a/packages/language/c/libm/current/tests/vectors/acos.c +++ b/packages/language/c/libm/current/tests/vectors/acos.c @@ -5,29 +5,38 @@ // Test of acos() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/acos.h b/packages/language/c/libm/current/tests/vectors/acos.h --- a/packages/language/c/libm/current/tests/vectors/acos.h +++ b/packages/language/c/libm/current/tests/vectors/acos.h @@ -7,29 +7,38 @@ // Test vectors for testing of acos() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/asin.c b/packages/language/c/libm/current/tests/vectors/asin.c --- a/packages/language/c/libm/current/tests/vectors/asin.c +++ b/packages/language/c/libm/current/tests/vectors/asin.c @@ -5,29 +5,38 @@ // Test of asin() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/asin.h b/packages/language/c/libm/current/tests/vectors/asin.h --- a/packages/language/c/libm/current/tests/vectors/asin.h +++ b/packages/language/c/libm/current/tests/vectors/asin.h @@ -7,29 +7,38 @@ // Test vectors for testing of asin() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/atan.c b/packages/language/c/libm/current/tests/vectors/atan.c --- a/packages/language/c/libm/current/tests/vectors/atan.c +++ b/packages/language/c/libm/current/tests/vectors/atan.c @@ -5,29 +5,38 @@ // Test of atan() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/atan.h b/packages/language/c/libm/current/tests/vectors/atan.h --- a/packages/language/c/libm/current/tests/vectors/atan.h +++ b/packages/language/c/libm/current/tests/vectors/atan.h @@ -7,29 +7,38 @@ // Test vectors for testing of atan() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/atan2.c b/packages/language/c/libm/current/tests/vectors/atan2.c --- a/packages/language/c/libm/current/tests/vectors/atan2.c +++ b/packages/language/c/libm/current/tests/vectors/atan2.c @@ -5,29 +5,38 @@ // Test of atan2() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/atan2.h b/packages/language/c/libm/current/tests/vectors/atan2.h --- a/packages/language/c/libm/current/tests/vectors/atan2.h +++ b/packages/language/c/libm/current/tests/vectors/atan2.h @@ -7,29 +7,38 @@ // Test vectors for testing of atan2() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/ceil.c b/packages/language/c/libm/current/tests/vectors/ceil.c --- a/packages/language/c/libm/current/tests/vectors/ceil.c +++ b/packages/language/c/libm/current/tests/vectors/ceil.c @@ -5,29 +5,38 @@ // Test of ceil() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/ceil.h b/packages/language/c/libm/current/tests/vectors/ceil.h --- a/packages/language/c/libm/current/tests/vectors/ceil.h +++ b/packages/language/c/libm/current/tests/vectors/ceil.h @@ -7,29 +7,38 @@ // Test vectors for testing of ceil() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/cos.c b/packages/language/c/libm/current/tests/vectors/cos.c --- a/packages/language/c/libm/current/tests/vectors/cos.c +++ b/packages/language/c/libm/current/tests/vectors/cos.c @@ -5,29 +5,38 @@ // Test of cos() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/cos.h b/packages/language/c/libm/current/tests/vectors/cos.h --- a/packages/language/c/libm/current/tests/vectors/cos.h +++ b/packages/language/c/libm/current/tests/vectors/cos.h @@ -7,29 +7,38 @@ // Test vectors for testing of cos() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/cosh.c b/packages/language/c/libm/current/tests/vectors/cosh.c --- a/packages/language/c/libm/current/tests/vectors/cosh.c +++ b/packages/language/c/libm/current/tests/vectors/cosh.c @@ -5,29 +5,38 @@ // Test of cosh() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/cosh.h b/packages/language/c/libm/current/tests/vectors/cosh.h --- a/packages/language/c/libm/current/tests/vectors/cosh.h +++ b/packages/language/c/libm/current/tests/vectors/cosh.h @@ -7,29 +7,38 @@ // Test vectors for testing of cosh() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/exp.c b/packages/language/c/libm/current/tests/vectors/exp.c --- a/packages/language/c/libm/current/tests/vectors/exp.c +++ b/packages/language/c/libm/current/tests/vectors/exp.c @@ -5,29 +5,38 @@ // Test of exp() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/exp.h b/packages/language/c/libm/current/tests/vectors/exp.h --- a/packages/language/c/libm/current/tests/vectors/exp.h +++ b/packages/language/c/libm/current/tests/vectors/exp.h @@ -7,29 +7,38 @@ // Test vectors for testing of exp() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/fabs.c b/packages/language/c/libm/current/tests/vectors/fabs.c --- a/packages/language/c/libm/current/tests/vectors/fabs.c +++ b/packages/language/c/libm/current/tests/vectors/fabs.c @@ -5,29 +5,38 @@ // Test of fabs() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/fabs.h b/packages/language/c/libm/current/tests/vectors/fabs.h --- a/packages/language/c/libm/current/tests/vectors/fabs.h +++ b/packages/language/c/libm/current/tests/vectors/fabs.h @@ -7,29 +7,38 @@ // Test vectors for testing of fabs() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/floor.c b/packages/language/c/libm/current/tests/vectors/floor.c --- a/packages/language/c/libm/current/tests/vectors/floor.c +++ b/packages/language/c/libm/current/tests/vectors/floor.c @@ -5,29 +5,38 @@ // Test of floor() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/floor.h b/packages/language/c/libm/current/tests/vectors/floor.h --- a/packages/language/c/libm/current/tests/vectors/floor.h +++ b/packages/language/c/libm/current/tests/vectors/floor.h @@ -7,29 +7,38 @@ // Test vectors for testing of floor() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/fmod.c b/packages/language/c/libm/current/tests/vectors/fmod.c --- a/packages/language/c/libm/current/tests/vectors/fmod.c +++ b/packages/language/c/libm/current/tests/vectors/fmod.c @@ -5,29 +5,38 @@ // Test of fmod() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/fmod.h b/packages/language/c/libm/current/tests/vectors/fmod.h --- a/packages/language/c/libm/current/tests/vectors/fmod.h +++ b/packages/language/c/libm/current/tests/vectors/fmod.h @@ -7,29 +7,38 @@ // Test vectors for testing of fmod() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/frexp.c b/packages/language/c/libm/current/tests/vectors/frexp.c --- a/packages/language/c/libm/current/tests/vectors/frexp.c +++ b/packages/language/c/libm/current/tests/vectors/frexp.c @@ -5,29 +5,38 @@ // Test of frexp() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/frexp.h b/packages/language/c/libm/current/tests/vectors/frexp.h --- a/packages/language/c/libm/current/tests/vectors/frexp.h +++ b/packages/language/c/libm/current/tests/vectors/frexp.h @@ -7,29 +7,38 @@ // Test vectors for testing of frexp() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/ldexp.c b/packages/language/c/libm/current/tests/vectors/ldexp.c --- a/packages/language/c/libm/current/tests/vectors/ldexp.c +++ b/packages/language/c/libm/current/tests/vectors/ldexp.c @@ -5,29 +5,38 @@ // Test of ldexp() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/ldexp.h b/packages/language/c/libm/current/tests/vectors/ldexp.h --- a/packages/language/c/libm/current/tests/vectors/ldexp.h +++ b/packages/language/c/libm/current/tests/vectors/ldexp.h @@ -7,29 +7,38 @@ // Test vectors for testing of ldexp() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/log.c b/packages/language/c/libm/current/tests/vectors/log.c --- a/packages/language/c/libm/current/tests/vectors/log.c +++ b/packages/language/c/libm/current/tests/vectors/log.c @@ -5,29 +5,38 @@ // Test of log() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/log.h b/packages/language/c/libm/current/tests/vectors/log.h --- a/packages/language/c/libm/current/tests/vectors/log.h +++ b/packages/language/c/libm/current/tests/vectors/log.h @@ -7,29 +7,38 @@ // Test vectors for testing of log() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/log10.c b/packages/language/c/libm/current/tests/vectors/log10.c --- a/packages/language/c/libm/current/tests/vectors/log10.c +++ b/packages/language/c/libm/current/tests/vectors/log10.c @@ -5,29 +5,38 @@ // Test of log10() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/log10.h b/packages/language/c/libm/current/tests/vectors/log10.h --- a/packages/language/c/libm/current/tests/vectors/log10.h +++ b/packages/language/c/libm/current/tests/vectors/log10.h @@ -7,29 +7,38 @@ // Test vectors for testing of log10() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/modf.c b/packages/language/c/libm/current/tests/vectors/modf.c --- a/packages/language/c/libm/current/tests/vectors/modf.c +++ b/packages/language/c/libm/current/tests/vectors/modf.c @@ -5,29 +5,38 @@ // Test of modf() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/modf.h b/packages/language/c/libm/current/tests/vectors/modf.h --- a/packages/language/c/libm/current/tests/vectors/modf.h +++ b/packages/language/c/libm/current/tests/vectors/modf.h @@ -7,29 +7,38 @@ // Test vectors for testing of modf() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/pow.c b/packages/language/c/libm/current/tests/vectors/pow.c --- a/packages/language/c/libm/current/tests/vectors/pow.c +++ b/packages/language/c/libm/current/tests/vectors/pow.c @@ -5,29 +5,38 @@ // Test of pow() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/pow.h b/packages/language/c/libm/current/tests/vectors/pow.h --- a/packages/language/c/libm/current/tests/vectors/pow.h +++ b/packages/language/c/libm/current/tests/vectors/pow.h @@ -7,29 +7,38 @@ // Test vectors for testing of pow() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/sin.c b/packages/language/c/libm/current/tests/vectors/sin.c --- a/packages/language/c/libm/current/tests/vectors/sin.c +++ b/packages/language/c/libm/current/tests/vectors/sin.c @@ -5,29 +5,38 @@ // Test of sin() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/sin.h b/packages/language/c/libm/current/tests/vectors/sin.h --- a/packages/language/c/libm/current/tests/vectors/sin.h +++ b/packages/language/c/libm/current/tests/vectors/sin.h @@ -7,29 +7,38 @@ // Test vectors for testing of sin() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/sinh.c b/packages/language/c/libm/current/tests/vectors/sinh.c --- a/packages/language/c/libm/current/tests/vectors/sinh.c +++ b/packages/language/c/libm/current/tests/vectors/sinh.c @@ -5,29 +5,38 @@ // Test of sinh() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/sinh.h b/packages/language/c/libm/current/tests/vectors/sinh.h --- a/packages/language/c/libm/current/tests/vectors/sinh.h +++ b/packages/language/c/libm/current/tests/vectors/sinh.h @@ -7,29 +7,38 @@ // Test vectors for testing of sinh() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/sqrt.c b/packages/language/c/libm/current/tests/vectors/sqrt.c --- a/packages/language/c/libm/current/tests/vectors/sqrt.c +++ b/packages/language/c/libm/current/tests/vectors/sqrt.c @@ -5,29 +5,38 @@ // Test of sqrt() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/sqrt.h b/packages/language/c/libm/current/tests/vectors/sqrt.h --- a/packages/language/c/libm/current/tests/vectors/sqrt.h +++ b/packages/language/c/libm/current/tests/vectors/sqrt.h @@ -7,29 +7,38 @@ // Test vectors for testing of sqrt() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/tan.c b/packages/language/c/libm/current/tests/vectors/tan.c --- a/packages/language/c/libm/current/tests/vectors/tan.c +++ b/packages/language/c/libm/current/tests/vectors/tan.c @@ -5,29 +5,38 @@ // Test of tan() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/tan.h b/packages/language/c/libm/current/tests/vectors/tan.h --- a/packages/language/c/libm/current/tests/vectors/tan.h +++ b/packages/language/c/libm/current/tests/vectors/tan.h @@ -7,29 +7,38 @@ // Test vectors for testing of tan() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/tanh.c b/packages/language/c/libm/current/tests/vectors/tanh.c --- a/packages/language/c/libm/current/tests/vectors/tanh.c +++ b/packages/language/c/libm/current/tests/vectors/tanh.c @@ -5,29 +5,38 @@ // Test of tanh() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/tanh.h b/packages/language/c/libm/current/tests/vectors/tanh.h --- a/packages/language/c/libm/current/tests/vectors/tanh.h +++ b/packages/language/c/libm/current/tests/vectors/tanh.h @@ -7,29 +7,38 @@ // Test vectors for testing of tanh() math library function // //=========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/language/c/libm/current/tests/vectors/vector_support.h b/packages/language/c/libm/current/tests/vectors/vector_support.h --- a/packages/language/c/libm/current/tests/vectors/vector_support.h +++ b/packages/language/c/libm/current/tests/vectors/vector_support.h @@ -7,29 +7,38 @@ // Support for testing of the math library using test vectors // //======================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //======================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/net/bsd_tcpip/current/ChangeLog b/packages/net/bsd_tcpip/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/ChangeLog @@ -0,0 +1,112 @@ +2002-05-14 Jesper Skov + + * include/netinet6/in6.h: Fixed warnings. + +2002-04-22 Gary Thomas + + * src/sys/netinet6/nd6.c: Make debug (on) default. + + * include/netinet/tcp_debug.h: Fully conditionalize debug facility. + +2002-04-17 Gary Thomas + + * include/sys/socket.h: Remove definitions only used by sysctl + since their presence could be misleading. + + * src/ecos/support.c (STACK_SIZE): Remove [debug/testing] bloat. + +2002-03-30 Gary Thomas + + * include/machine/types.h: [Placeholder] needed for some compilers. + +2002-03-28 Gary Thomas + + * src/sys/netinet/ip_icmp.c: + * include/sys/param.h: + * include/netinet/icmp_var.h: Export status structure for SNMP. + + * cdl/freebsd_net.cdl: Augment log facilities to what SNMP uses. + +2002-03-27 Gary Thomas + + * include/sys/param.h (log): Remove warning. + +2002-03-25 Gary Thomas + + * src/ecos/support.c (zinit): Add more record keeping (and debug + prints) for zones. + + * src/ecos/timeout.c (do_timeout): Don't reset ACTIVE when running + a timeout (since it confuses the TCP timer code). + +2002-03-23 Gary Thomas + + * src/sys/netinet/in_cksum.c (in_addword): Changed to use uint32 since + uint64 was wasteful (and failed on some architectures!) + +2002-03-20 Gary Thomas + + * include/sys/socket.h: Force struct sockaddr to be at least as + big as IPv4 or IPv6 sockets. Possibly this could be a little + cleaner, but at least now it's safe for programs to use sockaddr + variables in either environment. + +2002-03-11 Hugo Tyson + + [Case 107110] + + * src/sys/netinet/in.c (in_control): SIOCSIFADDR switch entry + moved to before the scan for this same address being in the list + already, along with Add and Delete (SIOCAIFADDR,SIOCDIFADDR) arms. + It falls through into the same alloc-if-needed code anyway. + Thus repeatedly setting the same address does not leak store. + + * src/sys/net/route.c (route_reinit): Rewrite to delete all routes + individually rather than en-masse (leaking store). + (rt_reinit_rtdelete): New function; callback for individual + deletion. + (rtioctl): Do not pass in a "route **" to return a pointer to the + route removed or added; this results in an extra reference, by the + returned pointer, and so a storeleak. + (rtrequest): RTM_DELETE arm: do not free a gateway route if the + gateway pointer is the same as the route itself - it gets freed + *again* at the end of the routine if you do. Just dec the refcnt. + +2002-03-08 Gary Thomas + + * src/sys/net/if_loop.c (loioctl): Force IFF_LOOPBACK setting. + + * src/sys/kern/uipc_mbuf.c: Remove some warnings [from munging]. + + * src/ecos/support.c (cyg_net_init): Identify init messages. + + * include/sys/param.h (nstab,nstab_end): These are not defined + within the network package and thus should not be munged. + + * include/net/if.h: Add "IFF_LOOPBACK" to set of flags which + cannot be changed outside the kernel. Note: this is a change + from the "normal" BSD code. It was done to keep old code + working, but it may break some new code. + +2002-03-07 Gary Thomas + + * src/sys/kern/uipc_mbuf.c: Work over for the namespace changes. + + * include/sys/param.h: Complete namespace munging; privatize + all kernel symbols via "cyg_" prefix. + +2002-02-05 Hugo Tyson + + * cdl/freebsd_net.cdl: Position this package below CYGPKG_NET + ie. the common networking package. Only affects the view in the + GUI CT, no big deal. + +#####ECOSPDCOPYRIGHTBEGIN#### +# +# Copyright (C) 2000, 2001, 2002 Red Hat, Inc. +# All Rights Reserved. +# +# Permission is granted to use, copy, modify and redistribute this +# file. +# +#####ECOSPDCOPYRIGHTEND#### diff --git a/packages/net/bsd_tcpip/current/cdl/freebsd_net.cdl b/packages/net/bsd_tcpip/current/cdl/freebsd_net.cdl new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/cdl/freebsd_net.cdl @@ -0,0 +1,395 @@ +# ==================================================================== +# +# freebsd_net.cdl +# +# Networking configuration data +# +# ==================================================================== +#####ECOSPDCOPYRIGHTBEGIN#### +# +# Copyright (C) 2000, 2001, 2002 Red Hat, Inc. +# All Rights Reserved. +# +# Permission is granted to use, copy, modify and redistribute this +# file. +# +#####ECOSPDCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Original data: gthomas +# Contributors: +# Date: 1999-11-29 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_NET_FREEBSD_STACK { + display "FreeBSD networking stack" + parent CYGPKG_NET + doc doc/index.html + include_dir . + requires CYGPKG_IO + requires CYGPKG_ISOINFRA + requires CYGINT_ISO_C_TIME_TYPES + requires CYGINT_ISO_STRERROR + requires CYGINT_ISO_ERRNO + requires CYGINT_ISO_ERRNO_CODES + requires CYGINT_ISO_MALLOC + requires CYGINT_ISO_STRING_BSD_FUNCS + requires CYGPKG_IO_FILEIO + description "Basic networking support, including TCP/IP." + + implements CYGPKG_NET_STACK + implements CYGPKG_NET_STACK_INET + implements CYGPKG_NET_STACK_INET6 + # Note: separating the stack implementation from the common support leads + # to some rather incestious config file relationships. + define_proc { + puts $::cdl_system_header "/***** Networking stack proc output start *****/" + puts $::cdl_header "#include " + puts $::cdl_system_header "#define CYGDAT_NET_STACK_CFG " + puts $::cdl_system_header "/***** Networking stack proc output end *****/" + } + + + # Export our types to + implements CYGINT_ISO_BSDTYPES + requires { CYGBLD_ISO_BSDTYPES_HEADER == "" } + + # These files are unique to eCos + compile ecos/support.c \ + ecos/synch.c \ + ecos/timeout.c \ + ecos/init.cxx + compile -library=libextras.a sys/kern/sockio.c + + # These files were derived from FreeBSD and carry their copyright + compile sys/net/if.c \ + sys/net/rtsock.c \ + sys/net/raw_cb.c \ + sys/net/raw_usrreq.c \ + sys/net/route.c \ + sys/net/radix.c \ + sys/net/if_ethersubr.c \ + sys/net/if_loop.c \ + sys/netinet/igmp.c \ + sys/netinet/raw_ip.c \ + sys/netinet/in.c \ + sys/netinet/in_cksum.c \ + sys/netinet/in_pcb.c \ + sys/netinet/in_proto.c \ + sys/netinet/in_rmx.c \ + sys/netinet/ip_encap.c \ + sys/netinet/ip_id.c \ + sys/netinet/ip_icmp.c \ + sys/netinet/ip_flow.c \ + sys/netinet/ip_input.c \ + sys/netinet/ip_output.c \ + sys/netinet/ip_mroute.c \ + sys/netinet/if_ether.c \ + sys/netinet/udp_usrreq.c \ + sys/netinet/tcp_input.c \ + sys/netinet/tcp_output.c \ + sys/netinet/tcp_debug.c \ + sys/netinet/tcp_usrreq.c \ + sys/netinet/tcp_timer.c \ + sys/netinet/tcp_subr.c \ + sys/kern/md5c.c \ + sys/kern/uipc_domain.c \ + sys/kern/uipc_socket.c \ + sys/kern/uipc_socket2.c \ + sys/kern/uipc_mbuf.c \ + sys/kern/uipc_mbuf2.c \ + sys/kern/uipc_accf.c \ + sys/kern/kern_subr.c + + cdl_component CYGPKG_NET_FREEBSD_INET { + display "INET support" + active_if CYGPKG_NET_INET + flavor bool + no_define + default_value 1 + description " + This option enables support for INET (IPv4) network processing." + + cdl_option CYGPKG_NET_FREEBSD_INET6 { + display "IPv6 support" + active_if CYGPKG_NET_INET6 + flavor bool + default_value 1 + description " + This option enables support for new IPv6." + # These files were derived from FreeBSD and carry their copyright + compile \ + sys/netinet6/dest6.c \ + sys/netinet6/frag6.c \ + sys/netinet6/icmp6.c \ + sys/netinet6/in6.c \ + sys/netinet6/in6_cksum.c \ + sys/netinet6/in6_ifattach.c \ + sys/netinet6/in6_pcb.c \ + sys/netinet6/in6_proto.c \ + sys/netinet6/in6_rmx.c \ + sys/netinet6/in6_src.c \ + sys/netinet6/ip6_forward.c \ + sys/netinet6/ip6_input.c \ + sys/netinet6/ip6_mroute.c \ + sys/netinet6/ip6_output.c \ + sys/netinet6/mld6.c \ + sys/netinet6/nd6.c \ + sys/netinet6/nd6_nbr.c \ + sys/netinet6/nd6_rtr.c \ + sys/netinet6/raw_ip6.c \ + sys/netinet6/route6.c \ + sys/netinet6/scope6.c \ + sys/netinet6/udp6_output.c \ + sys/netinet6/udp6_usrreq.c \ + +## Only if firewall enabled +## sys/netinet6/ip6_fw.c \ +## + + } + } + + cdl_option CYGPKG_NET_NBPF { + display "Number of BPF filters" + flavor data + default_value 0 + description " + This option controls the number of active BPF filters." + define NBPFILTER + } + + cdl_component CYGPKG_NET_BRIDGE { + display "Built-in ethernet bridge code" + default_value 0 + implements CYGINT_NET_BRIDGE_HANDLER + no_define + description " + This option controls whether to include the built-in code for + the Ethernet bridge." + compile sys/net/if_bridge.c + + cdl_option CYGNUM_NET_BRIDGES { + display "Number of Ethernet bridges" + flavor data + default_value 1 + legal_values 1 to 999999 + } + } + + cdl_interface CYGINT_NET_BRIDGE_HANDLER { + display "Support for ethernet bridges in the IP stack" + define NBRIDGE + description " + This interface controls whether calls to bridge code are made + from the IP stack; these are needed if the built-in bridge code + is used, but they can also be enabled in order to call different + bridge code from an external component." + } + + cdl_option CYGPKG_NET_NGIF { + display "Number of GIF things" + flavor data + default_value 0 + description " + This option controls the number of active GIF things." + define NGIF + } + + cdl_option CYGPKG_NET_NLOOP { + display "Number of loopback interfaces" + flavor data + default_value 1 + description " + This option controls the number of loopback, i.e. local, interfaces. + There is seldom need for this value to be anything other than one." + define NLOOP + } + + cdl_option CYGPKG_NET_FREEBSD_LOGGING { + display "Error and warning log control" + flavor booldata + default_value 0xC08F + description " + This option controls the type and amount of information + printed by the networking code. Different logging + facilities may be enabled by bitwise or-ing: + LOG_ERR 0x0001 - error conditions + LOG_WARNING 0x0002 - interesting, but not errors + LOG_NOTICE 0x0004 - things to look out for + LOG_INFO 0x0008 - generic comments + LOG_DEBUG 0x0010 - for finding obscure problems + LOG_MDEBUG 0x0020 - additional information about memory allocations + LOG_IOCTL 0x0040 - information about ioctl calls + LOG_INIT 0x0080 - information as system initializes + LOG_ADDR 0x0100 - information about IPv6 addresses + LOG_FAIL 0x0200 - why packets (IPv6) are ignored, etc. + LOG_EMERG 0x4000 - emergency conditions + LOG_CRIT 0x8000 - critical error + " + } + + cdl_option CYGPKG_NET_MEM_USAGE { + display "Memory designated for networking buffers." + flavor data + default_value 256*1024 + description " + This option controls the amount of memory pre-allocated + for buffers used by the networking code." + } + + cdl_option CYGPKG_NET_MAXSOCKETS { + display "Max number of open sockets." + flavor data + default_value CYGNUM_FILEIO_NFILE + description " + This option controls the amount of memory pre-allocated + for socket buffers used by the networking code." + } + + cdl_option CYGPKG_NET_NUM_WAKEUP_EVENTS { + display "Number of supported pending network events" + flavor data + default_value 8 + description " + This option controls the number of pending network events + used by the networking code." + } + + cdl_option CYGPKG_NET_THREAD_PRIORITY { + display "Priority level for backgound network processing." + flavor data + default_value 7 + description " + This option allows the thread priority level used by the + networking stack to be adjusted by the user. It should be set + high enough that sufficient CPU resources are available to + process network data, but may be adjusted so that application + threads can have precedence over network processing." + } + + cdl_option CYGPKG_NET_FAST_THREAD_PRIORITY { + display "Priority level for fast network processing." + flavor data + default_value CYGPKG_NET_THREAD_PRIORITY - 1 + description " + This option sets the thread priority level used by the fast + network thread. The fast network thread runs often but briefly, to + service network device interrupts and network timeout events. This + thread should have higher priority than the background network + thread. It is reasonable to set this thread's priority higher than + application threads for best network throughput, or to set it lower + than application threads for best latency for those application + threads themselves, potentially at a cost to network throughput." + } + + cdl_component CYGPKG_NET_FAST_THREAD_TICKLE_DEVS { + display "Fast network processing thread 'tickles' drivers" + default_value 1 + description " + If this is enabled, the fast network thread will tickle the + device(s) periodically, to unblock them when the hardware has + become wedged due to a lost interrupt or other hardware + race-condition type problem. + This is not necessary if a networked app is running which sends + packets itself often - or + uses TCP, or any similar protocol which exchanges keep-alive + packets periodically and often enough. + Trying to send a packet passes control into the driver; this is + sufficient to detect and unblock jammed hardware." + + cdl_option CYGNUM_NET_FAST_THREAD_TICKLE_DEVS_DELAY { + display "Delay in kernel clocks of tickle loop" + flavor data + default_value 50 + description " + The default is 50, which will usually mean a delay between + tests for 'stuck' devices of 500mS, that is half a second. + The overhead only applies if no network activity occurred, + so it may be acceptable to make this value very small, + where high CPU load does not matter during network idle + periods, or very large if your application tries often to + send packets itself." + } + } + + cdl_component CYGPKG_NET_FREEBSD_STACK_OPTIONS { + display "Networking support build options" + flavor none + no_define + + cdl_option CYGPKG_NET_FREEBSD_STACK_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL" } + description " + This option modifies the set of compiler flags for + building the networking package. + These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_NET_FREEBSD_STACK_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the networking package. These flags are removed from + the set of global flags if present." + } + } + + cdl_component CYGPKG_NET_FREEBSD_STACK_BUILD_TESTS { + display "Build networking tests (demo programs)" + flavor bool + no_define + default_value 0 + description " + This option enables the building of additional network tests + which at this time are just demos; otherwise only loopback + interface tests will be built." + + cdl_option CYGPKG_NET_FREEBSD_STACK_TESTS { + display "Networking tests" + flavor data + no_define + calculated { CYGPKG_NET_BUILD_TESTS ? \ + "tests/mbuf_test \ + tests/socket_test \ + tests/ftp_test \ + tests/server_test \ + tests/nc_test_slave \ + tests/tftp_client_test \ + tests/tftp_server_test \ + tests/tcp_echo \ + tests/set_mac_address \ + tests/bridge \ + tests/flood \ + tests/ping_test \ + tests/dhcp_test \ + tests/ping_lo_test \ + tests/tcp_lo_test \ + tests/udp_lo_test \ + tests/multi_lo_select \ + tests/tcp_lo_select" + : + "tests/ping_lo_test \ + tests/tcp_lo_test \ + tests/udp_lo_test \ + tests/multi_lo_select \ + tests/tcp_lo_select" + } + description " + This option specifies the set of tests + for the networking package." + } + } +} diff --git a/packages/net/bsd_tcpip/current/doc/BSD_FILE_LIST b/packages/net/bsd_tcpip/current/doc/BSD_FILE_LIST new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/doc/BSD_FILE_LIST @@ -0,0 +1,137 @@ +sys/domain.h include/sys/domain.h +sys/errno.h include/sys/errno.h +sys/ioccom.h include/sys/ioccom.h +sys/ioctl.h include/sys/ioctl.h +sys/malloc.h include/sys/malloc.h +sys/mbuf.h include/sys/mbuf.h +sys/md5.h include/sys/md5.h +sys/protosw.h include/sys/protosw.h +sys/param.h include/sys/param.h +sys/queue.h include/sys/queue.h +sys/socket.h include/sys/socket.h +sys/socketvar.h include/sys/socketvar.h +sys/sockio.h include/sys/sockio.h +sys/time.h include/sys/time.h +kern/uipc_mbuf2.c src/sys/kern/uipc_mbuf2.c +kern/kern_subr.c src/sys/kern/kern_subr.c +kern/md5c.c src/sys/kern/md5c.c +kern/uipc_accf.c src/sys/kern/uipc_accf.c +kern/uipc_domain.c src/sys/kern/uipc_domain.c +kern/uipc_mbuf.c src/sys/kern/uipc_mbuf.c +kern/uipc_socket.c src/sys/kern/uipc_socket.c +kern/uipc_socket2.c src/sys/kern/uipc_socket2.c +net/pfkeyv2.h include/net/pfkeyv2.h +net/if_ethersubr.c src/sys/net/if_ethersubr.c +net/ethernet.h include/net/ethernet.h +net/if.c src/sys/net/if.c +net/if.h include/net/if.h +net/if_arp.h include/net/if_arp.h +net/if_dl.h include/net/if_dl.h +net/if_loop.c src/sys/net/if_loop.c +net/if_llc.h include/net/if_llc.h +net/if_types.h include/net/if_types.h +net/if_var.h include/net/if_var.h +net/iso88025.h include/net/iso88025.h +net/intrq.h include/net/intrq.h +net/netisr.h include/net/netisr.h +net/radix.c src/sys/net/radix.c +net/radix.h include/net/radix.h +net/raw_cb.c src/sys/net/raw_cb.c +net/raw_cb.h include/net/raw_cb.h +net/raw_usrreq.c src/sys/net/raw_usrreq.c +net/route.c src/sys/net/route.c +net/route.h include/net/route.h +net/rtsock.c src/sys/net/rtsock.c +netatalk/endian.h include/sys/endian.h +netatm/queue.h include/sys/queue.h +netinet/ip_encap.c src/sys/netinet/ip_encap.c +netinet/ip_encap.h include/netinet/ip_encap.h +netinet/icmp_var.h include/netinet/icmp_var.h +netinet/if_ether.c src/sys/netinet/if_ether.c +netinet/if_ether.h include/netinet/if_ether.h +netinet/igmp.c src/sys/netinet/igmp.c +netinet/igmp.h include/netinet/igmp.h +netinet/igmp_var.h include/netinet/igmp_var.h +netinet/in.c src/sys/netinet/in.c +netinet/in.h include/netinet/in.h +netinet/in_cksum.c src/sys/netinet/in_cksum.c +netinet/ip.h include/netinet/ip.h +netinet/in_pcb.c src/sys/netinet/in_pcb.c +netinet/in_pcb.h include/netinet/in_pcb.h +netinet/in_proto.c src/sys/netinet/in_proto.c +netinet/in_rmx.c src/sys/netinet/in_rmx.c +netinet/in_systm.h include/netinet/in_systm.h +netinet/in_var.h include/netinet/in_var.h +netinet/ip_flow.c src/sys/netinet/ip_flow.c +netinet/ip_flow.h include/netinet/ip_flow.h +netinet/ip_fw.h include/netinet/ip_fw.h +netinet/ip_icmp.c src/sys/netinet/ip_icmp.c +netinet/ip_icmp.h include/netinet/ip_icmp.h +netinet/ip_id.c src/sys/netinet/ip_id.c +netinet/ip_input.c src/sys/netinet/ip_input.c +netinet/ip_mroute.c src/sys/netinet/ip_mroute.c +netinet/ip_mroute.h include/netinet/ip_mroute.h +netinet/ip_output.c src/sys/netinet/ip_output.c +netinet/ip_var.h include/netinet/ip_var.h +netinet/raw_ip.c src/sys/netinet/raw_ip.c +netinet/tcp.h include/netinet/tcp.h +netinet/tcp_debug.c src/sys/netinet/tcp_debug.c +netinet/tcp_debug.h include/netinet/tcp_debug.h +netinet/tcp_fsm.h include/netinet/tcp_fsm.h +netinet/tcp_input.c src/sys/netinet/tcp_input.c +netinet/tcp_output.c src/sys/netinet/tcp_output.c +netinet/tcp_seq.h include/netinet/tcp_seq.h +netinet/tcp_subr.c src/sys/netinet/tcp_subr.c +netinet/tcp_timer.c src/sys/netinet/tcp_timer.c +netinet/tcp_timer.h include/netinet/tcp_timer.h +netinet/tcp_usrreq.c src/sys/netinet/tcp_usrreq.c +netinet/tcp_var.h include/netinet/tcp_var.h +netinet/tcpip.h include/netinet/tcpip.h +netinet/udp.h include/netinet/udp.h +netinet/udp_usrreq.c src/sys/netinet/udp_usrreq.c +netinet/udp_var.h include/netinet/udp_var.h +netinet6/in6.h include/netinet6/in6.h +netinet6/in6_var.h include/netinet6/in6_var.h +netinet6/ipsec.h include/netinet6/ipsec.h +netkey/key_var.h include/netkey/key_var.h +netkey/keydb.h include/netkey/keydb.h +netinet/icmp6.h include/netinet/icmp6.h +netinet/ip6.h include/netinet/ip6.h +netinet6/in6_ifattach.h include/netinet6/in6_ifattach.h +netinet6/in6_pcb.h include/netinet6/in6_pcb.h +netinet6/ip6_fw.h include/netinet6/ip6_fw.h +netinet6/ip6_mroute.h include/netinet6/ip6_mroute.h +netinet6/ip6_var.h include/netinet6/ip6_var.h +netinet6/ip6protosw.h include/netinet6/ip6protosw.h +netinet6/mld6_var.h include/netinet6/mld6_var.h +netinet6/nd6.h include/netinet6/nd6.h +netinet6/pim6.h include/netinet6/pim6.h +netinet6/pim6_var.h include/netinet6/pim6_var.h +netinet6/raw_ip6.h include/netinet6/raw_ip6.h +netinet6/scope6_var.h include/netinet6/scope6_var.h +netinet6/tcp6_var.h include/netinet6/tcp6_var.h +netinet6/udp6_var.h include/netinet6/udp6_var.h +netinet6/dest6.c src/sys/netinet6/dest6.c +netinet6/frag6.c src/sys/netinet6/frag6.c +netinet6/icmp6.c src/sys/netinet6/icmp6.c +netinet6/in6.c src/sys/netinet6/in6.c +netinet6/in6_cksum.c src/sys/netinet6/in6_cksum.c +netinet6/in6_ifattach.c src/sys/netinet6/in6_ifattach.c +netinet6/in6_pcb.c src/sys/netinet6/in6_pcb.c +netinet6/in6_proto.c src/sys/netinet6/in6_proto.c +netinet6/in6_rmx.c src/sys/netinet6/in6_rmx.c +netinet6/in6_src.c src/sys/netinet6/in6_src.c +netinet6/ip6_forward.c src/sys/netinet6/ip6_forward.c +netinet6/ip6_fw.c src/sys/netinet6/ip6_fw.c +netinet6/ip6_input.c src/sys/netinet6/ip6_input.c +netinet6/ip6_mroute.c src/sys/netinet6/ip6_mroute.c +netinet6/ip6_output.c src/sys/netinet6/ip6_output.c +netinet6/mld6.c src/sys/netinet6/mld6.c +netinet6/nd6.c src/sys/netinet6/nd6.c +netinet6/nd6_nbr.c src/sys/netinet6/nd6_nbr.c +netinet6/nd6_rtr.c src/sys/netinet6/nd6_rtr.c +netinet6/raw_ip6.c src/sys/netinet6/raw_ip6.c +netinet6/route6.c src/sys/netinet6/route6.c +netinet6/scope6.c src/sys/netinet6/scope6.c +netinet6/udp6_output.c src/sys/netinet6/udp6_output.c +netinet6/udp6_usrreq.c src/sys/netinet6/udp6_usrreq.c diff --git a/packages/net/bsd_tcpip/current/doc/README b/packages/net/bsd_tcpip/current/doc/README new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/doc/README @@ -0,0 +1,22 @@ +Jan 28, 2002 + +These files were originally obtained from KAME, via + kame-20020107-netbsd152-snap.tgz +(i.e. a KAME snapshot of FreeBSD 4.4, taken on Jan 7, 2002) + +The original files (and updates) were imported into the eCos +tree via this process: + cd /tmp + gzip -d /tmp/FILES +# xargs -t -n2 /tmp/ECOS_FILES) + +for i in $FILES; do + (echo -n "/";basename $i) >/tmp/FILE + if fgrep -q -f /tmp/FILE /tmp/ECOS_FILES >/tmp/FOUND; then + echo -n "$i " + fgrep -f /tmp/FILE /tmp/ECOS_FILES + fi +done diff --git a/packages/net/bsd_tcpip/current/doc/freebsd.sgml b/packages/net/bsd_tcpip/current/doc/freebsd.sgml new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/doc/freebsd.sgml @@ -0,0 +1,135 @@ + +FreeBSD TCP/IP Stack port for eCos + + TCP/IP Networking for eCos + now provides a complete + TCP/IP networking stack, +based on a recent snapshot of the FreeBSD code, released by the +KAME project. +The networking support is + fully featured and well tested within the eCos environment. + + + + +Networking Stack Features +Since this networking package is based on BSD code, it is +very complete and robust. The eCos implementation includes support +for the following protocols: + +IPv4 +UDP +TCP +ICMP +raw packet interface +Multi-cast addressing +IPv6 (including UDP, ICP, ICMP) + +These additional features are also present in the package, + but are not supported: + +Berkeley Packet Filter +Uni-cast support +Multi-cast routing + + + +Freebsd TCP/IP stack port +This document describes how to get started with the Freebsd +TCP/IP network stack. + +Targets +A number of ethernet devices may be supported. The default configuration +supports two instances of the interface by default, +and you will need to write your own driver instantiation code, +and supplemental startup and initialization code, +if you should add additional ones. +The target for your board will normally be supplied with an +ethernet driver, in which case including the network stack and +generic ethernet driver package to your build will automatically +enable usage of the ethernet device driver. +If your target is not supplied with an ethernet +driver, you will need to use loopback (see +). + + +<!--<conditionaltext>-->Building the Network Stack +Using the Build->Packages dialog, +add the packages “Networking”, +“Freebsd TCP/IP Stack” +and “Common Ethernet Support” +to your configuration. Their package names +are CYGPKG_NET, CYGPKG_NET_FREEBSD_STACK and CYGPKG_NET_ETH_DRIVERS +respectively. +A short-cut way to do this is by +using the “new_net” template +if it is available for your platform. +The platform-specific ethernet device driver for your platform +will be added as part of the target selection (in the +Build->Templates “Hardware” item), +along with the +PCI I/O subsystem (if relevent) and the appropriate serial device driver. + +For example, the PowerPC MBX target selection adds the package +PKG_NET_QUICC_ETH_DRIVERS, +and the Cirrus Logic EDB7xxx target selection adds the package +CYGPKG_NET_EDB7XXX_ETH_DRIVERS. +After this, eCos and its tests can be built exactly as usual. + +By default, most of the network tests are not built. This +is because some of them require manual intervention, i.e. they are +to be run “by hand”, and are not suitable for +automated testing. To build the full set of network tests, set +the configuration option CYGPKG_NET_BUILD_TESTS “Build +networking tests (demo programs)” within “Networking +support build options”. + + + + +APIs + +Standard networking +The APIs for the standard networking calls such as +socket(), recv() and so on, are +in header files relative to the top-level +include directory, within the standard subdirectories as conventionally +found in /usr/include. For example: + + install/include/arpa/tftp.h + install/include/netinet/tcpip.h + install/include/sys/socket.h + install/include/sys/socketvar.h + install/include/sys/sockio.h + + + + +Enhanced Select() +The network stack supports an extension to the standard select +semantics which allows all threads that are waiting to be restarted +even if the select conditions are not satisfied. +The standard select() API: +int +select(int nfd, + fd_set *in, fd_set *out, fd_set *ex, + struct timeval *tv); +does not support the restart. +The additional API: +int +cyg_select_with_abort(int nfd, + fd_set *in, fd_set *out, fd_set *ex, + struct timeval *tv) + +behaves exactly as select() with the additional feature that +a call to + +void cyg_select_abort(void) + +will cause all threads waiting in any +cyg_select_with_abort() call +to cease waiting and continue execution. + + + + diff --git a/packages/net/bsd_tcpip/current/include/machine/types.h b/packages/net/bsd_tcpip/current/include/machine/types.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/machine/types.h @@ -0,0 +1,32 @@ +//========================================================================== +// +// include/machine/types.h +// +// Architecture/platform specifics +// +//========================================================================== +//####ECOSPDCOPYRIGHTBEGIN#### +// +// Copyright (C) 2002 Red Hat, Inc. +// All Rights Reserved. +// +// Permission is granted to use, copy, modify and redistribute this +// file. +// +//####ECOSPDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2002-03-27 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Just a placeholder + diff --git a/packages/net/bsd_tcpip/current/include/net/ethernet.h b/packages/net/bsd_tcpip/current/include/net/ethernet.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/ethernet.h @@ -0,0 +1,140 @@ +//========================================================================== +// +// include/net/ethernet.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Fundamental constants relating to ethernet. + * + * $FreeBSD: src/sys/net/ethernet.h,v 1.12.2.5 2000/07/19 21:43:52 archie Exp $ + * + */ + +#ifndef _NET_ETHERNET_H_ +#define _NET_ETHERNET_H_ + +/* + * The number of bytes in an ethernet (MAC) address. + */ +#define ETHER_ADDR_LEN 6 + +/* + * The number of bytes in the type field. + */ +#define ETHER_TYPE_LEN 2 + +/* + * The number of bytes in the trailing CRC field. + */ +#define ETHER_CRC_LEN 4 + +/* + * The length of the combined header. + */ +#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) + +/* + * The minimum packet length. + */ +#define ETHER_MIN_LEN 64 + +/* + * The maximum packet length. + */ +#define ETHER_MAX_LEN 1518 + +/* + * A macro to validate a length with + */ +#define ETHER_IS_VALID_LEN(foo) \ + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) + +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + u_char ether_dhost[ETHER_ADDR_LEN]; + u_char ether_shost[ETHER_ADDR_LEN]; + u_short ether_type; +} __attribute__ ((aligned(1), packed)); + +/* + * Structure of a 48-bit Ethernet address. + */ +struct ether_addr { + u_char octet[ETHER_ADDR_LEN]; +} __attribute__ ((aligned(1), packed)); + +#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ +#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */ +#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */ +#define ETHERTYPE_IPV6 0x86dd /* IPv6 */ +#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */ +/* XXX - add more useful types here */ + +/* + * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have + * (type-ETHERTYPE_TRAIL)*512 bytes of data followed + * by an ETHER type (as given above) and then the (variable-length) header. + */ +#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ +#define ETHERTYPE_NTRAILER 16 + +#define ETHERMTU (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) +#define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) + +#ifdef _KERNEL + +/* + * For device drivers to specify whether they support BPF or not + */ +#define ETHER_BPF_UNSUPPORTED 0 +#define ETHER_BPF_SUPPORTED 1 + +struct ifnet; +struct mbuf; + +extern void (*ng_ether_input_p)(struct ifnet *ifp, + struct mbuf **mp, struct ether_header *eh); +extern void (*ng_ether_input_orphan_p)(struct ifnet *ifp, + struct mbuf *m, struct ether_header *eh); +extern int (*ng_ether_output_p)(struct ifnet *ifp, struct mbuf **mp); +extern void (*ng_ether_attach_p)(struct ifnet *ifp); +extern void (*ng_ether_detach_p)(struct ifnet *ifp); + +#else /* _KERNEL */ + +#include + +/* + * Ethernet address conversion/parsing routines. + */ +__BEGIN_DECLS +struct ether_addr *ether_aton __P((const char *)); +int ether_hostton __P((const char *, struct ether_addr *)); +int ether_line __P((const char *, struct ether_addr *, char *)); +char *ether_ntoa __P((const struct ether_addr *)); +int ether_ntohost __P((char *, const struct ether_addr *)); +__END_DECLS + +#endif /* !_KERNEL */ + +#endif /* !_NET_ETHERNET_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/net/if.h b/packages/net/bsd_tcpip/current/include/net/if.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/if.h @@ -0,0 +1,328 @@ +//========================================================================== +// +// include/net/if.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1989, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if.h,v 1.58.2.2 2001/07/24 19:10:18 brooks Exp $ + */ + +#ifndef _NET_IF_H_ +#define _NET_IF_H_ + +#include + +/* + * does not depend on on most other systems. This + * helps userland compatability. (struct timeval ifi_lastchange) + */ +#ifndef _KERNEL +#include +#endif + +struct ifnet; + +/* + * Length of interface external name, including terminating '\0'. + * Note: this is the same size as a generic device's external name. + */ +#define IFNAMSIZ 16 +#define IF_NAMESIZE IFNAMSIZ + +/* + * Structure describing a `cloning' interface. + */ +struct if_clone { + LIST_ENTRY(if_clone) ifc_list; /* on list of cloners */ + const char *ifc_name; /* name of device, e.g. `gif' */ + size_t ifc_namelen; /* length of name */ + + int (*ifc_create)(struct if_clone *, int *); + void (*ifc_destroy)(struct ifnet *); +}; + +#define IF_CLONE_INITIALIZER(name, create, destroy) \ + { { 0 }, name, sizeof(name) - 1, create, destroy } + +/* + * Structure used to query names of interface cloners. + */ + +struct if_clonereq { + int ifcr_total; /* total cloners (out) */ + int ifcr_count; /* room for this many in user buffer */ + char *ifcr_buffer; /* buffer for cloner names */ +}; + +/* + * Structure describing information about an interface + * which may be of interest to management entities. + */ +struct if_data { + /* generic interface information */ + u_char ifi_type; /* ethernet, tokenring, etc */ + u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ + u_char ifi_addrlen; /* media address length */ + u_char ifi_hdrlen; /* media header length */ + u_char ifi_recvquota; /* polling quota for receive intrs */ + u_char ifi_xmitquota; /* polling quota for xmit intrs */ + u_long ifi_mtu; /* maximum transmission unit */ + u_long ifi_metric; /* routing metric (external only) */ + u_long ifi_baudrate; /* linespeed */ + /* volatile statistics */ + u_long ifi_ipackets; /* packets received on interface */ + u_long ifi_ierrors; /* input errors on interface */ + u_long ifi_opackets; /* packets sent on interface */ + u_long ifi_oerrors; /* output errors on interface */ + u_long ifi_collisions; /* collisions on csma interfaces */ + u_long ifi_ibytes; /* total number of octets received */ + u_long ifi_obytes; /* total number of octets sent */ + u_long ifi_imcasts; /* packets received via multicast */ + u_long ifi_omcasts; /* packets sent via multicast */ + u_long ifi_iqdrops; /* dropped on input, this interface */ + u_long ifi_noproto; /* destined for unsupported protocol */ + u_long ifi_hwassist; /* HW offload capabilities */ + u_long ifi_unused; /* XXX was ifi_xmittiming */ + struct timeval ifi_lastchange; /* time of last administrative change */ +}; + +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* is a loopback net */ +#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ +#define IFF_SMART 0x20 /* interface manages own routes */ +#define IFF_RUNNING 0x40 /* resources allocated */ +#define IFF_NOARP 0x80 /* no address resolution protocol */ +#define IFF_PROMISC 0x100 /* receive all packets */ +#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ +#define IFF_OACTIVE 0x400 /* transmission in progress */ +#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ +#define IFF_LINK0 0x1000 /* per link layer defined bit */ +#define IFF_LINK1 0x2000 /* per link layer defined bit */ +#define IFF_LINK2 0x4000 /* per link layer defined bit */ +#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ +#define IFF_MULTICAST 0x8000 /* supports multicast */ + +/* flags set internally only: */ +#define IFF_CANTCHANGE \ + (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ + IFF_LOOPBACK|IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART) + +#define IFQ_MAXLEN 50 +#define IFNET_SLOWHZ 1 /* granularity is 1 second */ + +/* + * Message format for use in obtaining information about interfaces + * from getkerninfo and the routing socket + */ +struct if_msghdr { + u_short ifm_msglen; /* to skip over non-understood messages */ + u_char ifm_version; /* future binary compatability */ + u_char ifm_type; /* message type */ + int ifm_addrs; /* like rtm_addrs */ + int ifm_flags; /* value of if_flags */ + u_short ifm_index; /* index for associated ifp */ + struct if_data ifm_data;/* statistics and other data about if */ +}; + +/* + * Message format for use in obtaining information about interface addresses + * from getkerninfo and the routing socket + */ +struct ifa_msghdr { + u_short ifam_msglen; /* to skip over non-understood messages */ + u_char ifam_version; /* future binary compatability */ + u_char ifam_type; /* message type */ + int ifam_addrs; /* like rtm_addrs */ + int ifam_flags; /* value of ifa_flags */ + u_short ifam_index; /* index for associated ifp */ + int ifam_metric; /* value of ifa_metric */ +}; + +/* + * Message format for use in obtaining information about multicast addresses + * from the routing socket + */ +struct ifma_msghdr { + u_short ifmam_msglen; /* to skip over non-understood messages */ + u_char ifmam_version; /* future binary compatability */ + u_char ifmam_type; /* message type */ + int ifmam_addrs; /* like rtm_addrs */ + int ifmam_flags; /* value of ifa_flags */ + u_short ifmam_index; /* index for associated ifp */ +}; + +/* + * Interface request structure used for socket + * ioctl's. All interface ioctl's must have parameter + * definitions which begin with ifr_name. The + * remainder may be interface specific. + */ +struct ifreq { +#define IFHWADDRLEN 6 + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_hwaddr; + short ifru_flags[2]; + int ifru_metric; + int ifru_mtu; + int ifru_phys; + int ifru_media; + caddr_t ifru_data; + } ifr_ifru; +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_flags ifr_ifru.ifru_flags[0] /* flags */ +#define ifr_prevflags ifr_ifru.ifru_flags[1] /* flags */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_phys ifr_ifru.ifru_phys /* physical wire */ +#define ifr_media ifr_ifru.ifru_media /* physical media */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +}; + +#define _SIZEOF_ADDR_IFREQ(ifr) \ + ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \ + (sizeof(struct ifreq) - sizeof(struct sockaddr) + \ + (ifr).ifr_addr.sa_len) : sizeof(struct ifreq)) + +struct ifaliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr ifra_addr; + struct sockaddr ifra_broadaddr; + struct sockaddr ifra_mask; +}; + +struct ifmediareq { + char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + int ifm_current; /* current media options */ + int ifm_mask; /* don't care mask */ + int ifm_status; /* media status */ + int ifm_active; /* active options */ + int ifm_count; /* # entries in ifm_ulist array */ + int *ifm_ulist; /* media words */ +}; + +/* + * Structure used to retrieve aux status data from interfaces. + * Kernel suppliers to this interface should respect the formatting + * needed by ifconfig(8): each line starts with a TAB and ends with + * a newline. The canonical example to copy and paste is in if_tun.c. + */ + +#define IFSTATMAX 800 /* 10 lines of text */ +struct ifstat { + char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + char ascii[IFSTATMAX + 1]; +}; + +/* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ +struct ifconf { + int ifc_len; /* size of associated buffer */ + union { + caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ +}; + + +/* + * Structure for SIOC[AGD]LIFADDR + */ +struct if_laddrreq { + char iflr_name[IFNAMSIZ]; + u_int flags; +#define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */ + u_int prefixlen; /* in/out */ + struct sockaddr_storage addr; /* in/out */ + struct sockaddr_storage dstaddr; /* out */ +}; + +#ifdef _KERNEL +#ifdef MALLOC_DECLARE +MALLOC_DECLARE(M_IFADDR); +MALLOC_DECLARE(M_IFMADDR); +#endif +#endif + +#ifndef _KERNEL +struct if_nameindex { + u_int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "le0", ... */ +}; + +__BEGIN_DECLS +u_int if_nametoindex __P((const char *)); +char *if_indextoname __P((u_int, char *)); +struct if_nameindex *if_nameindex __P((void)); +void if_freenameindex __P((struct if_nameindex *)); +__END_DECLS +#endif + +#ifdef _KERNEL +/* XXX - this should go away soon. */ +#include +#endif + +#endif /* !_NET_IF_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/net/if_arp.h b/packages/net/bsd_tcpip/current/include/net/if_arp.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/if_arp.h @@ -0,0 +1,132 @@ +//========================================================================== +// +// include/net/if_arp.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)if_arp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_arp.h,v 1.14.2.1 2000/07/11 20:46:55 archie Exp $ + */ + +#ifndef _NET_IF_ARP_H_ +#define _NET_IF_ARP_H_ + +/* + * Address Resolution Protocol. + * + * See RFC 826 for protocol description. ARP packets are variable + * in size; the arphdr structure defines the fixed-length portion. + * Protocol type values are the same as those for 10 Mb/s Ethernet. + * It is followed by the variable-sized fields ar_sha, arp_spa, + * arp_tha and arp_tpa in that order, according to the lengths + * specified. Field names used correspond to RFC 826. + */ +struct arphdr { + u_short ar_hrd; /* format of hardware address */ +#define ARPHRD_ETHER 1 /* ethernet hardware format */ +#define ARPHRD_IEEE802 6 /* token-ring hardware format */ +#define ARPHRD_FRELAY 15 /* frame relay hardware format */ + u_short ar_pro; /* format of protocol address */ + u_char ar_hln; /* length of hardware address */ + u_char ar_pln; /* length of protocol address */ + u_short ar_op; /* one of: */ +#define ARPOP_REQUEST 1 /* request to resolve address */ +#define ARPOP_REPLY 2 /* response to previous request */ +#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ +#define ARPOP_REVREPLY 4 /* response giving protocol address */ +#define ARPOP_INVREQUEST 8 /* request to identify peer */ +#define ARPOP_INVREPLY 9 /* response identifying peer */ +/* + * The remaining fields are variable in size, + * according to the sizes above. + */ +#ifdef COMMENT_ONLY + u_char ar_sha[]; /* sender hardware address */ + u_char ar_spa[]; /* sender protocol address */ + u_char ar_tha[]; /* target hardware address */ + u_char ar_tpa[]; /* target protocol address */ +#endif +}; + +/* + * ARP ioctl request + */ +struct arpreq { + struct sockaddr arp_pa; /* protocol address */ + struct sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ +}; +/* arp_flags and at_flags field values */ +#define ATF_INUSE 0x01 /* entry in use */ +#define ATF_COM 0x02 /* completed entry (enaddr valid) */ +#define ATF_PERM 0x04 /* permanent entry */ +#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ +#define ATF_USETRAILERS 0x10 /* has requested trailers */ + +#ifdef _KERNEL +/* + * Structure shared between the ethernet driver modules and + * the address resolution code. For example, each ec_softc or il_softc + * begins with this structure. + */ +struct arpcom { + /* + * The ifnet struct _must_ be at the head of this structure. + */ + struct ifnet ac_if; /* network-visible interface */ + u_char ac_enaddr[6]; /* ethernet hardware address */ + int ac_multicnt; /* length of ac_multiaddrs list */ + void *ac_netgraph; /* ng_ether(4) netgraph node info */ +}; + +extern u_char etherbroadcastaddr[6]; +#endif + +#endif /* !_NET_IF_ARP_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/net/if_dl.h b/packages/net/bsd_tcpip/current/include/net/if_dl.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/if_dl.h @@ -0,0 +1,107 @@ +//========================================================================== +// +// include/net/if_dl.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)if_dl.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_dl.h,v 1.10 2000/03/01 02:46:25 archie Exp $ + */ + +#ifndef _NET_IF_DL_H_ +#define _NET_IF_DL_H_ + +/* + * A Link-Level Sockaddr may specify the interface in one of two + * ways: either by means of a system-provided index number (computed + * anew and possibly differently on every reboot), or by a human-readable + * string such as "il0" (for managerial convenience). + * + * Census taking actions, such as something akin to SIOCGCONF would return + * both the index and the human name. + * + * High volume transactions (such as giving a link-level ``from'' address + * in a recvfrom or recvmsg call) may be likely only to provide the indexed + * form, (which requires fewer copy operations and less space). + * + * The form and interpretation of the link-level address is purely a matter + * of convention between the device driver and its consumers; however, it is + * expected that all drivers for an interface of a given if_type will agree. + */ + +/* + * Structure of a Link-Level sockaddr: + */ +struct sockaddr_dl { + u_char sdl_len; /* Total length of sockaddr */ + u_char sdl_family; /* AF_LINK */ + u_short sdl_index; /* if != 0, system given index for interface */ + u_char sdl_type; /* interface type */ + u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */ + u_char sdl_alen; /* link level address length */ + u_char sdl_slen; /* link layer selector length */ + char sdl_data[12]; /* minimum work area, can be larger; + contains both if name and ll address */ + u_short sdl_rcf; /* source routing control */ + u_short sdl_route[16]; /* source routing information */ +}; + +#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen)) + +#ifndef _KERNEL + +__BEGIN_DECLS +void link_addr __P((const char *, struct sockaddr_dl *)); +char *link_ntoa __P((const struct sockaddr_dl *)); +__END_DECLS + +#endif /* !_KERNEL */ + +#endif diff --git a/packages/net/bsd_tcpip/current/include/net/if_llc.h b/packages/net/bsd_tcpip/current/include/net/if_llc.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/if_llc.h @@ -0,0 +1,166 @@ +//========================================================================== +// +// include/net/if_llc.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)if_llc.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_llc.h,v 1.7 1999/08/28 00:48:18 peter Exp $ + */ + +#ifndef _NET_IF_LLC_H_ +#define _NET_IF_LLC_H_ + +/* + * IEEE 802.2 Link Level Control headers, for use in conjunction with + * 802.{3,4,5} media access control methods. + * + * Headers here do not use bit fields due to shortcomings in many + * compilers. + */ + +struct llc { + u_char llc_dsap; + u_char llc_ssap; + union { + struct { + u_char control; + u_char format_id; + u_char class; + u_char window_x2; + } type_u; + struct { + u_char num_snd_x2; + u_char num_rcv_x2; + } type_i; + struct { + u_char control; + u_char num_rcv_x2; + } type_s; + struct { + u_char control; + struct frmrinfo { + u_char rej_pdu_0; + u_char rej_pdu_1; + u_char frmr_control; + u_char frmr_control_ext; + u_char frmr_cause; + } frmrinfo; + } type_frmr; + struct { + u_char control; + u_char org_code[3]; + u_short ether_type; + } type_snap; + struct { + u_char control; + u_char control_ext; + } type_raw; + } llc_un; +}; +#define llc_control llc_un.type_u.control +#define llc_control_ext llc_un.type_raw.control_ext +#define llc_fid llc_un.type_u.format_id +#define llc_class llc_un.type_u.class +#define llc_window llc_un.type_u.window_x2 +#define llc_frmrinfo llc_un.type_frmr.frmrinfo +#define llc_frmr_pdu0 llc_un.type_frmr.frmrinfo.rej_pdu0 +#define llc_frmr_pdu1 llc_un.type_frmr.frmrinfo.rej_pdu1 +#define llc_frmr_control llc_un.type_frmr.frmrinfo.frmr_control +#define llc_frmr_control_ext llc_un.type_frmr.frmrinfo.frmr_control_ext +#define llc_frmr_cause llc_un.type_frmr.frmrinfo.frmr_control_ext + +/* + * Don't use sizeof(struct llc_un) for LLC header sizes + */ +#define LLC_ISFRAMELEN 4 +#define LLC_UFRAMELEN 3 +#define LLC_FRMRLEN 7 + +/* + * Unnumbered LLC format commands + */ +#define LLC_UI 0x3 +#define LLC_UI_P 0x13 +#define LLC_DISC 0x43 +#define LLC_DISC_P 0x53 +#define LLC_UA 0x63 +#define LLC_UA_P 0x73 +#define LLC_TEST 0xe3 +#define LLC_TEST_P 0xf3 +#define LLC_FRMR 0x87 +#define LLC_FRMR_P 0x97 +#define LLC_DM 0x0f +#define LLC_DM_P 0x1f +#define LLC_XID 0xaf +#define LLC_XID_P 0xbf +#define LLC_SABME 0x6f +#define LLC_SABME_P 0x7f + +/* + * Supervisory LLC commands + */ +#define LLC_RR 0x01 +#define LLC_RNR 0x05 +#define LLC_REJ 0x09 + +/* + * Info format - dummy only + */ +#define LLC_INFO 0x00 + +/* + * ISO PDTR 10178 contains among others + */ +#define LLC_X25_LSAP 0x7e +#define LLC_SNAP_LSAP 0xaa +#define LLC_ISO_LSAP 0xfe + +#endif diff --git a/packages/net/bsd_tcpip/current/include/net/if_types.h b/packages/net/bsd_tcpip/current/include/net/if_types.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/if_types.h @@ -0,0 +1,138 @@ +//========================================================================== +// +// include/net/if_types.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1989, 1993, 1994 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)if_types.h 8.2 (Berkeley) 4/20/94 + * $FreeBSD: src/sys/net/if_types.h,v 1.8.2.3 2001/07/03 11:01:41 ume Exp $ + */ + +#ifndef _NET_IF_TYPES_H_ +#define _NET_IF_TYPES_H_ + +/* + * Interface types for benefit of parsing media address headers. + * This list is derived from the SNMP list of ifTypes, currently + * documented in RFC1573, now maintained as: + * + * ftp.isi.edu/in-notes/iana/assignments/smi-numbers + */ + +#define IFT_OTHER 0x1 /* none of the following */ +#define IFT_1822 0x2 /* old-style arpanet imp */ +#define IFT_HDH1822 0x3 /* HDH arpanet imp */ +#define IFT_X25DDN 0x4 /* x25 to imp */ +#define IFT_X25 0x5 /* PDN X25 interface (RFC877) */ +#define IFT_ETHER 0x6 /* Ethernet CSMACD */ +#define IFT_ISO88023 0x7 /* CMSA CD */ +#define IFT_ISO88024 0x8 /* Token Bus */ +#define IFT_ISO88025 0x9 /* Token Ring */ +#define IFT_ISO88026 0xa /* MAN */ +#define IFT_STARLAN 0xb +#define IFT_P10 0xc /* Proteon 10MBit ring */ +#define IFT_P80 0xd /* Proteon 80MBit ring */ +#define IFT_HY 0xe /* Hyperchannel */ +#define IFT_FDDI 0xf +#define IFT_LAPB 0x10 +#define IFT_SDLC 0x11 +#define IFT_T1 0x12 +#define IFT_CEPT 0x13 /* E1 - european T1 */ +#define IFT_ISDNBASIC 0x14 +#define IFT_ISDNPRIMARY 0x15 +#define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */ +#define IFT_PPP 0x17 /* RFC 1331 */ +#define IFT_LOOP 0x18 /* loopback */ +#define IFT_EON 0x19 /* ISO over IP */ +#define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */ +#define IFT_NSIP 0x1b /* XNS over IP */ +#define IFT_SLIP 0x1c /* IP over generic TTY */ +#define IFT_ULTRA 0x1d /* Ultra Technologies */ +#define IFT_DS3 0x1e /* Generic T3 */ +#define IFT_SIP 0x1f /* SMDS */ +#define IFT_FRELAY 0x20 /* Frame Relay DTE only */ +#define IFT_RS232 0x21 +#define IFT_PARA 0x22 /* parallel-port */ +#define IFT_ARCNET 0x23 +#define IFT_ARCNETPLUS 0x24 +#define IFT_ATM 0x25 /* ATM cells */ +#define IFT_MIOX25 0x26 +#define IFT_SONET 0x27 /* SONET or SDH */ +#define IFT_X25PLE 0x28 +#define IFT_ISO88022LLC 0x29 +#define IFT_LOCALTALK 0x2a +#define IFT_SMDSDXI 0x2b +#define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */ +#define IFT_V35 0x2d +#define IFT_HSSI 0x2e +#define IFT_HIPPI 0x2f +#define IFT_MODEM 0x30 /* Generic Modem */ +#define IFT_AAL5 0x31 /* AAL5 over ATM */ +#define IFT_SONETPATH 0x32 +#define IFT_SONETVT 0x33 +#define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */ +#define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */ +#define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */ +#define IFT_GIF 0x37 /*0xf0*/ +#define IFT_FAITH 0x38 /*0xf2*/ +#define IFT_STF 0x39 /*0xf3*/ +#define IFT_L2VLAN 0x87 /* Layer 2 Virtual LAN using 802.1Q */ + +#define IFT_IEEE1394 0x90 /* IEEE1394 High Performance SerialBus*/ + +/* not based on IANA assignments */ +/* #define IFT_GIF 0xf0 */ +#define IFT_PVC 0xf1 +/* #define IFT_FAITH 0xf2 */ +/* #define IFT_STF 0xf3 */ +#define IFT_DUMMY 0xf4 +#define IFT_HIF 0xf5 + +#endif diff --git a/packages/net/bsd_tcpip/current/include/net/if_var.h b/packages/net/bsd_tcpip/current/include/net/if_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/if_var.h @@ -0,0 +1,460 @@ +//========================================================================== +// +// include/net/if_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1989, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * From: @(#)if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.7 2001/07/24 19:10:18 brooks Exp $ + */ + +#ifndef _NET_IF_VAR_H_ +#define _NET_IF_VAR_H_ + +/* + * Structures defining a network interface, providing a packet + * transport mechanism (ala level 0 of the PUP protocols). + * + * Each interface accepts output datagrams of a specified maximum + * length, and provides higher level routines with input datagrams + * received from its medium. + * + * Output occurs when the routine if_output is called, with three parameters: + * (*ifp->if_output)(ifp, m, dst, rt) + * Here m is the mbuf chain to be sent and dst is the destination address. + * The output routine encapsulates the supplied datagram if necessary, + * and then transmits it on its medium. + * + * On input, each interface unwraps the data received by it, and either + * places it on the input queue of a internetwork datagram routine + * and posts the associated software interrupt, or passes the datagram to a raw + * packet input routine. + * + * Routines exist for locating interfaces by their addresses + * or for locating a interface on a certain network, as well as more general + * routing and gateway routines maintaining information used to locate + * interfaces. These routines live in the files if.c and route.c + */ + +#ifdef __STDC__ +/* + * Forward structure declarations for function prototypes [sic]. + */ +struct mbuf; +struct proc; +struct rtentry; +struct socket; +struct ether_header; +#endif + +#include /* get TAILQ macros */ + +TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ +TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ +TAILQ_HEAD(ifprefixhead, ifprefix); +LIST_HEAD(ifmultihead, ifmultiaddr); + +/* + * Structure defining a queue for a network interface. + */ +struct ifqueue { + struct mbuf *ifq_head; + struct mbuf *ifq_tail; + int ifq_len; + int ifq_maxlen; + int ifq_drops; +}; + +/* + * Structure defining a network interface. + * + * (Would like to call this struct ``if'', but C isn't PL/1.) + */ +struct ifnet { + void *if_softc; /* pointer to driver state */ + char *if_name; /* name, e.g. ``en'' or ``lo'' */ + TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ + struct ifaddrhead if_addrhead; /* linked list of addresses per if */ + char if_xname[IFNAMSIZ]; /* external name (name + unit) */ + int if_pcount; /* number of promiscuous listeners */ + struct bpf_if *if_bpf; /* packet filter structure */ + u_short if_index; /* numeric abbreviation for this if */ + short if_unit; /* sub-unit for lower level driver */ + short if_timer; /* time 'til if_watchdog called */ + short if_flags; /* up/down, broadcast, etc. */ + int if_ipending; /* interrupts pending */ + void *if_linkmib; /* link-type-specific MIB data */ + size_t if_linkmiblen; /* length of above data */ + struct if_data if_data; + struct ifmultihead if_multiaddrs; /* multicast addresses configured */ + int if_amcount; /* number of all-multicast requests */ +/* procedure handles */ + int (*if_output) /* output routine (enqueue) */ + __P((struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *)); + void (*if_start) /* initiate output routine */ + __P((struct ifnet *)); + int (*if_done) /* output complete routine */ + __P((struct ifnet *)); /* (XXX not used; fake prototype) */ + int (*if_ioctl) /* ioctl routine */ + __P((struct ifnet *, u_long, caddr_t)); + void (*if_watchdog) /* timer routine */ + __P((struct ifnet *)); + int (*if_poll_recv) /* polled receive routine */ + __P((struct ifnet *, int *)); + int (*if_poll_xmit) /* polled transmit routine */ + __P((struct ifnet *, int *)); + void (*if_poll_intren) /* polled interrupt reenable routine */ + __P((struct ifnet *)); + void (*if_poll_slowinput) /* input routine for slow devices */ + __P((struct ifnet *, struct mbuf *)); + void (*if_init) /* Init routine */ + __P((void *)); + int (*if_resolvemulti) /* validate/resolve multicast */ + __P((struct ifnet *, struct sockaddr **, struct sockaddr *)); + struct ifqueue if_snd; /* output queue */ + struct ifqueue *if_poll_slowq; /* input queue for slow devices */ + struct ifprefixhead if_prefixhead; /* list of prefixes per if */ +}; +typedef void if_init_f_t __P((void *)); + +#define if_mtu if_data.ifi_mtu +#define if_type if_data.ifi_type +#define if_physical if_data.ifi_physical +#define if_addrlen if_data.ifi_addrlen +#define if_hdrlen if_data.ifi_hdrlen +#define if_metric if_data.ifi_metric +#define if_baudrate if_data.ifi_baudrate +#define if_hwassist if_data.ifi_hwassist +#define if_ipackets if_data.ifi_ipackets +#define if_ierrors if_data.ifi_ierrors +#define if_opackets if_data.ifi_opackets +#define if_oerrors if_data.ifi_oerrors +#define if_collisions if_data.ifi_collisions +#define if_ibytes if_data.ifi_ibytes +#define if_obytes if_data.ifi_obytes +#define if_imcasts if_data.ifi_imcasts +#define if_omcasts if_data.ifi_omcasts +#define if_iqdrops if_data.ifi_iqdrops +#define if_noproto if_data.ifi_noproto +#define if_lastchange if_data.ifi_lastchange +#define if_recvquota if_data.ifi_recvquota +#define if_xmitquota if_data.ifi_xmitquota +#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0) + +/* for compatibility with other BSDs */ +#define if_addrlist if_addrhead +#define if_list if_link + +static __inline__ char * +if_name(struct ifnet *ifp) +{ + return ifp->if_xname; +} + +/* + * Bit values in if_ipending + */ +#define IFI_RECV 1 /* I want to receive */ +#define IFI_XMIT 2 /* I want to transmit */ + +/* + * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) + * are queues of messages stored on ifqueue structures + * (defined above). Entries are added to and deleted from these structures + * by these macros, which should be called with ipl raised to splimp(). + */ +#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) +#define IF_DROP(ifq) ((ifq)->ifq_drops++) +#define IF_ENQUEUE(ifq, m) { \ + (m)->m_nextpkt = 0; \ + if ((ifq)->ifq_tail == 0) \ + (ifq)->ifq_head = m; \ + else \ + (ifq)->ifq_tail->m_nextpkt = m; \ + (ifq)->ifq_tail = m; \ + (ifq)->ifq_len++; \ +} +#define IF_PREPEND(ifq, m) { \ + (m)->m_nextpkt = (ifq)->ifq_head; \ + if ((ifq)->ifq_tail == 0) \ + (ifq)->ifq_tail = (m); \ + (ifq)->ifq_head = (m); \ + (ifq)->ifq_len++; \ +} +#define IF_DEQUEUE(ifq, m) { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \ + (ifq)->ifq_tail = 0; \ + (m)->m_nextpkt = 0; \ + (ifq)->ifq_len--; \ + } \ +} +#define IF_POLL(ifq, m) ((m) = (ifq)->ifq_head) +#define IF_PURGE(ifq) \ +while (1) { \ + struct mbuf *m0; \ + IF_DEQUEUE((ifq), m0); \ + if (m0 == NULL) \ + break; \ + else \ + m_freem(m0); \ +} +#define IF_IS_EMPTY(ifq) ((ifq)->ifq_len == 0) + +#ifdef _KERNEL +#define IF_ENQ_DROP(ifq, m) if_enq_drop(ifq, m) + +#if defined(__GNUC__) && defined(MT_HEADER) +static __inline int +if_queue_drop(struct ifqueue *ifq, struct mbuf *m) +{ + IF_DROP(ifq); + return 0; +} + +static __inline int +if_enq_drop(struct ifqueue *ifq, struct mbuf *m) +{ + if (IF_QFULL(ifq) && + !if_queue_drop(ifq, m)) + return 0; + IF_ENQUEUE(ifq, m); + return 1; +} +#else + +#ifdef MT_HEADER +int if_enq_drop __P((struct ifqueue *, struct mbuf *)); +#endif + +#endif + +/* + * 72 was chosen below because it is the size of a TCP/IP + * header (40) + the minimum mss (32). + */ +#define IF_MINMTU 72 +#define IF_MAXMTU 65535 + +#endif /* _KERNEL */ + +#ifdef _KERNEL +#define IFQ_ENQUEUE(ifq, m, err) \ +do { \ + if (IF_QFULL((ifq))) { \ + m_freem((m)); \ + (err) = ENOBUFS; \ + } else { \ + IF_ENQUEUE((ifq), (m)); \ + (err) = 0; \ + } \ + if ((err)) \ + (ifq)->ifq_drops++; \ +} while (0) + +#define IFQ_DEQUEUE(ifq, m) IF_DEQUEUE((ifq), (m)) + +#define IFQ_POLL(ifq, m) IF_POLL((ifq), (m)) + +#define IFQ_PURGE(ifq) \ +while (1) { \ + struct mbuf *m0; \ + IF_DEQUEUE((ifq), m0); \ + if (m0 == NULL) \ + break; \ + else \ + m_freem(m0); \ +} + +#define IFQ_SET_READY(ifq) ((void)0) +#define IFQ_CLASSIFY(ifq, m, af, pa) ((void)0) + +#define IFQ_IS_EMPTY(ifq) ((ifq)->ifq_len == 0) +#define IFQ_INC_LEN(ifq) ((ifq)->ifq_len++) +#define IFQ_DEC_LEN(ifq) (--(ifq)->ifq_len) +#define IFQ_INC_DROPS(ifq) ((ifq)->ifq_drops++) +#define IFQ_SET_MAXLEN(ifq, len) ((ifq)->ifq_maxlen = (len)) + +#endif /* _KERNEL */ + +/* + * The ifaddr structure contains information about one address + * of an interface. They are maintained by the different address families, + * are allocated and attached when an address is set, and are linked + * together so all addresses for an interface can be located. + */ +struct ifaddr { + struct sockaddr *ifa_addr; /* address of interface */ + struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ + struct sockaddr *ifa_netmask; /* used to determine subnet */ + struct if_data if_data; /* not all members are meaningful */ + struct ifnet *ifa_ifp; /* back-pointer to interface */ + TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ + void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ + __P((int, struct rtentry *, struct sockaddr *)); + u_short ifa_flags; /* mostly rt_flags for cloning */ + u_int ifa_refcnt; /* references to this structure */ + int ifa_metric; /* cost of going out this interface */ +#ifdef notdef + struct rtentry *ifa_rt; /* XXXX for ROUTETOIF ????? */ +#endif + int (*ifa_claim_addr) /* check if an addr goes to this if */ + __P((struct ifaddr *, struct sockaddr *)); + +}; +#define IFA_ROUTE RTF_UP /* route installed */ +#define IFAREF(ifa) do { ++(ifa)->ifa_refcnt; } while (0) + +/* for compatibility with other BSDs */ +#define ifa_list ifa_link + +/* + * The prefix structure contains information about one prefix + * of an interface. They are maintained by the different address families, + * are allocated and attached when an prefix or an address is set, + * and are linked together so all prefixes for an interface can be located. + */ +struct ifprefix { + struct sockaddr *ifpr_prefix; /* prefix of interface */ + struct ifnet *ifpr_ifp; /* back-pointer to interface */ + TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */ + u_char ifpr_plen; /* prefix length in bits */ + u_char ifpr_type; /* protocol dependent prefix type */ +}; + +/* + * Multicast address structure. This is analogous to the ifaddr + * structure except that it keeps track of multicast addresses. + * Also, the reference count here is a count of requests for this + * address, not a count of pointers to this structure. + */ +struct ifmultiaddr { + LIST_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ + struct sockaddr *ifma_addr; /* address this membership is for */ + struct sockaddr *ifma_lladdr; /* link-layer translation, if any */ + struct ifnet *ifma_ifp; /* back-pointer to interface */ + u_int ifma_refcount; /* reference count */ + void *ifma_protospec; /* protocol-specific state, if any */ +}; + +#ifdef _KERNEL +#define IFAFREE(ifa) \ + do { \ + if ((ifa)->ifa_refcnt <= 0) \ + ifafree(ifa); \ + else \ + (ifa)->ifa_refcnt--; \ + } while (0) + +extern struct ifnethead ifnet; +extern struct ifnet **ifindex2ifnet; +extern int ifqmaxlen; +extern struct ifnet loif[]; +extern int if_index; +extern struct ifaddr **ifnet_addrs; + +void ether_ifattach __P((struct ifnet *, int)); +void ether_ifdetach __P((struct ifnet *, int)); +void ether_input __P((struct ifnet *, struct ether_header *, struct mbuf *)); +void ether_demux __P((struct ifnet *, struct ether_header *, struct mbuf *)); +int ether_output __P((struct ifnet *, + struct mbuf *, struct sockaddr *, struct rtentry *)); +int ether_output_frame __P((struct ifnet *, struct mbuf *)); +int ether_ioctl __P((struct ifnet *, int, caddr_t)); + +int if_addmulti __P((struct ifnet *, struct sockaddr *, + struct ifmultiaddr **)); +int if_allmulti __P((struct ifnet *, int)); +void if_attach __P((struct ifnet *)); +int if_delmulti __P((struct ifnet *, struct sockaddr *)); +void if_detach __P((struct ifnet *)); +void if_down __P((struct ifnet *)); +void if_route __P((struct ifnet *, int flag, int fam)); +int if_setlladdr __P((struct ifnet *, const u_char *, int)); +void if_unroute __P((struct ifnet *, int flag, int fam)); +void if_up __P((struct ifnet *)); +/*void ifinit __P((void));*/ /* declared in systm.h for main() */ +int ifioctl __P((struct socket *, u_long, caddr_t, struct proc *)); +int ifpromisc __P((struct ifnet *, int)); +struct ifnet *ifunit __P((const char *)); +struct ifnet *if_withname __P((struct sockaddr *)); + +int if_poll_recv_slow __P((struct ifnet *ifp, int *quotap)); +void if_poll_xmit_slow __P((struct ifnet *ifp, int *quotap)); +void if_poll_throttle __P((void)); +void if_poll_unthrottle __P((void *)); +void if_poll_init __P((void)); +void if_poll __P((void)); + +struct ifaddr *ifa_ifwithaddr __P((struct sockaddr *)); +struct ifaddr *ifa_ifwithdstaddr __P((struct sockaddr *)); +struct ifaddr *ifa_ifwithnet __P((struct sockaddr *)); +struct ifaddr *ifa_ifwithroute __P((int, struct sockaddr *, + struct sockaddr *)); +struct ifaddr *ifaof_ifpforaddr __P((struct sockaddr *, struct ifnet *)); +void ifafree __P((struct ifaddr *)); + +struct ifmultiaddr *ifmaof_ifpforaddr __P((struct sockaddr *, + struct ifnet *)); +int if_simloop __P((struct ifnet *ifp, struct mbuf *m, int af, int hlen)); + +void if_clone_attach __P((struct if_clone *)); +void if_clone_detach __P((struct if_clone *)); + +int if_clone_create __P((char *, int)); +int if_clone_destroy __P((const char *)); + +#endif /* _KERNEL */ + + +#endif /* !_NET_IF_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/net/intrq.h b/packages/net/bsd_tcpip/current/include/net/intrq.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/intrq.h @@ -0,0 +1,57 @@ +//========================================================================== +// +// include/net/intrq.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/*- + * Copyright (c) 2000 Brian Somers + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD: src/sys/net/intrq.h,v 1.2 2000/01/27 23:37:39 brian Exp $ + */ + +#ifndef _NET_INTRQ_H_ +#define _NET_INTRQ_H_ + +#ifdef _KERNEL +extern int family_enqueue __P((sa_family_t, struct mbuf *)); +#endif + +#endif /* _NET_INTRQ_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/net/iso88025.h b/packages/net/bsd_tcpip/current/include/net/iso88025.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/iso88025.h @@ -0,0 +1,143 @@ +//========================================================================== +// +// include/net/iso88025.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1998, Larry Lile + * All rights reserved. + * + * For latest sources and information on this driver, please + * go to http://anarchy.stdio.com. + * + * Questions, comments or suggestions should be directed to + * Larry Lile . + * + * 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 unmodified, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD: src/sys/net/iso88025.h,v 1.3.2.1 2000/10/14 20:01:06 lile Exp $ + * + * Information gathered from tokenring@freebsd, /sys/net/ethernet.h and + * the Mach token ring driver. + */ + +/* + * Fundamental constants relating to iso 802.5 + */ + +#ifndef _NET_ISO88025_H_ +#define _NET_ISO88025_H_ + +/* + * General ISO 802.5 definitions + */ +#define ISO88025_ADDR_LEN 6 +#define ISO88025_HDR_LEN (ISO88025_CF_LEN + (ISO88025_ADDR_LEN * 2)) +#define ISO88025_CF_LEN 2 +#define RCF_LEN 2 +#define RIF_MAX_RD 14 +#define RIF_MAX_LEN 16 + +#define TR_AC 0x10 +#define TR_LLC_FRAME 0x40 + +#define TR_4MBPS 4000000 +#define TR_16MBPS 16000000 +#define TR_100MBPS 100000000 + +/* + * Source routing + */ +#define TR_RII 0x80 +#define TR_RCF_BCST_MASK 0xe000 +#define TR_RCF_LEN_MASK 0x1f00 +#define TR_RCF_DIR 0x0080 +#define TR_RCF_LF_MASK 0x0070 + +#define TR_RCF_RIFLEN(x) ((ntohs(x) & TR_RCF_LEN_MASK) >> 8) + +/* + * Minimum and maximum packet payload lengths. + */ +#define ISO88025_MIN_LEN 0 +#define ISO88025_MAX_LEN 17960 + +/* + * A macro to validate a length with + */ +#define ISO88025_IS_VALID_LEN(foo) \ + ((foo) >= ISO88025_MIN_LEN && (foo) <= ISO88025_MAX_LEN) + +/* + * ISO 802.5 physical header + */ +struct iso88025_header { + u_char ac; /* access control field */ + u_char fc; /* frame control field */ + u_char iso88025_dhost[ISO88025_ADDR_LEN]; /* destination address */ + u_char iso88025_shost[ISO88025_ADDR_LEN]; /* source address */ + u_short rcf; /* route control field */ + u_short rd[RIF_MAX_RD]; /* routing designators */ +}; + +struct iso88025_sockaddr_data { + u_char ether_dhost[ISO88025_ADDR_LEN]; + u_char ether_shost[ISO88025_ADDR_LEN]; + u_char ac; + u_char fc; +}; + +/* + * Structure of a 48-bit iso 802.5 address. + * ( We could also add the 16 bit addresses as a union) + */ +struct iso88025_addr { + u_char octet[ISO88025_ADDR_LEN]; +}; + +#define ISO88025_MAX_MTU 18000 +#define ISO88025_DEFAULT_MTU 1500 +#define senderr(e) { error = (e); goto bad;} + +void iso88025_ifattach __P((struct ifnet *)); +int iso88025_ioctl __P((struct ifnet *, int , caddr_t )); +int iso88025_output __P((struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *)); +void iso88025_input __P((struct ifnet *, struct iso88025_header *, struct mbuf *)); + +#endif diff --git a/packages/net/bsd_tcpip/current/include/net/netisr.h b/packages/net/bsd_tcpip/current/include/net/netisr.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/netisr.h @@ -0,0 +1,105 @@ +//========================================================================== +// +// include/net/netisr.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1980, 1986, 1989, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)netisr.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/netisr.h,v 1.21.2.2 2001/03/06 00:55:07 obrien Exp $ + */ + +#ifndef _NET_NETISR_H_ +#define _NET_NETISR_H_ + +/* + * The networking code runs off software interrupts. + * + * You can switch into the network by doing splnet() and return by splx(). + * The software interrupt level for the network is higher than the software + * level for the clock (so you can enter the network in routines called + * at timeout time). + */ + +/* + * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status + * word which is used to de-multiplex a single software + * interrupt used for scheduling the network code to calls + * on the lowest level routine of each protocol. + */ +#define NETISR_SOFTNET 1 // Just used to force an interrupt +#define NETISR_IP 2 /* same as AF_INET */ +#define NETISR_NS 6 /* same as AF_NS */ +#define NETISR_ATALK 16 /* same as AF_APPLETALK */ +#define NETISR_ARP 18 /* same as AF_LINK */ +#define NETISR_IPX 23 /* same as AF_IPX */ +#define NETISR_USB 25 /* USB soft interrupt */ +#define NETISR_PPP 27 /* PPP soft interrupt */ +#define NETISR_IPV6 28 /* same as AF_INET6 */ +#define NETISR_NATM 29 /* same as AF_NATM */ +#define NETISR_NETGRAPH 31 /* same as AF_NETGRAPH */ + +#define NETISR_MIN 2 // Smallest legal 'level' +#define NETISR_MAX 31 // Largest legal 'level' + +#ifndef LOCORE +#ifdef _KERNEL +#include +extern cyg_flag_t netint_flags; +#define schednetisr(anisr) cyg_flag_setbits(&netint_flags, 1<<(anisr)); + +typedef void netisr_t __P((void)); + +int register_netisr __P((int, netisr_t *)); +int unregister_netisr __P((int)); + +#endif +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/net/pfkeyv2.h b/packages/net/bsd_tcpip/current/include/net/pfkeyv2.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/pfkeyv2.h @@ -0,0 +1,413 @@ +//========================================================================== +// +// include/net/pfkeyv2.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: pfkeyv2.h,v 1.27 2001/07/31 06:41:24 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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 has been derived rfc 2367, + * And added some flags of SADB_KEY_FLAGS_ as SADB_X_EXT_. + * sakane@ydc.co.jp + */ + +#ifndef _NET_PFKEYV2_H_ +#define _NET_PFKEYV2_H_ + +/* +This file defines structures and symbols for the PF_KEY Version 2 +key management interface. It was written at the U.S. Naval Research +Laboratory. This file is in the public domain. The authors ask that +you leave this credit intact on any copies of this file. +*/ +#ifndef __PFKEY_V2_H +#define __PFKEY_V2_H 1 + +#define PF_KEY_V2 2 +#define PFKEYV2_REVISION 199806L + +#define SADB_RESERVED 0 +#define SADB_GETSPI 1 +#define SADB_UPDATE 2 +#define SADB_ADD 3 +#define SADB_DELETE 4 +#define SADB_GET 5 +#define SADB_ACQUIRE 6 +#define SADB_REGISTER 7 +#define SADB_EXPIRE 8 +#define SADB_FLUSH 9 +#define SADB_DUMP 10 +#define SADB_X_PROMISC 11 +#define SADB_X_PCHANGE 12 + +#define SADB_X_SPDUPDATE 13 +#define SADB_X_SPDADD 14 +#define SADB_X_SPDDELETE 15 /* by policy index */ +#define SADB_X_SPDGET 16 +#define SADB_X_SPDACQUIRE 17 +#define SADB_X_SPDDUMP 18 +#define SADB_X_SPDFLUSH 19 +#define SADB_X_SPDSETIDX 20 +#define SADB_X_SPDEXPIRE 21 +#define SADB_X_SPDDELETE2 22 /* by policy id */ +#define SADB_MAX 22 + +struct sadb_msg { + u_int8_t sadb_msg_version; + u_int8_t sadb_msg_type; + u_int8_t sadb_msg_errno; + u_int8_t sadb_msg_satype; + u_int16_t sadb_msg_len; + u_int16_t sadb_msg_reserved; + u_int32_t sadb_msg_seq; + u_int32_t sadb_msg_pid; +}; + +struct sadb_ext { + u_int16_t sadb_ext_len; + u_int16_t sadb_ext_type; +}; + +struct sadb_sa { + u_int16_t sadb_sa_len; + u_int16_t sadb_sa_exttype; + u_int32_t sadb_sa_spi; + u_int8_t sadb_sa_replay; + u_int8_t sadb_sa_state; + u_int8_t sadb_sa_auth; + u_int8_t sadb_sa_encrypt; + u_int32_t sadb_sa_flags; +}; + +struct sadb_lifetime { + u_int16_t sadb_lifetime_len; + u_int16_t sadb_lifetime_exttype; + u_int32_t sadb_lifetime_allocations; + u_int64_t sadb_lifetime_bytes; + u_int64_t sadb_lifetime_addtime; + u_int64_t sadb_lifetime_usetime; +}; + +struct sadb_address { + u_int16_t sadb_address_len; + u_int16_t sadb_address_exttype; + u_int8_t sadb_address_proto; + u_int8_t sadb_address_prefixlen; + u_int16_t sadb_address_reserved; +}; + +struct sadb_key { + u_int16_t sadb_key_len; + u_int16_t sadb_key_exttype; + u_int16_t sadb_key_bits; + u_int16_t sadb_key_reserved; +}; + +struct sadb_ident { + u_int16_t sadb_ident_len; + u_int16_t sadb_ident_exttype; + u_int16_t sadb_ident_type; + u_int16_t sadb_ident_reserved; + u_int64_t sadb_ident_id; +}; + +struct sadb_sens { + u_int16_t sadb_sens_len; + u_int16_t sadb_sens_exttype; + u_int32_t sadb_sens_dpd; + u_int8_t sadb_sens_sens_level; + u_int8_t sadb_sens_sens_len; + u_int8_t sadb_sens_integ_level; + u_int8_t sadb_sens_integ_len; + u_int32_t sadb_sens_reserved; +}; + +struct sadb_prop { + u_int16_t sadb_prop_len; + u_int16_t sadb_prop_exttype; + u_int8_t sadb_prop_replay; + u_int8_t sadb_prop_reserved[3]; +}; + +struct sadb_comb { + u_int8_t sadb_comb_auth; + u_int8_t sadb_comb_encrypt; + u_int16_t sadb_comb_flags; + u_int16_t sadb_comb_auth_minbits; + u_int16_t sadb_comb_auth_maxbits; + u_int16_t sadb_comb_encrypt_minbits; + u_int16_t sadb_comb_encrypt_maxbits; + u_int32_t sadb_comb_reserved; + u_int32_t sadb_comb_soft_allocations; + u_int32_t sadb_comb_hard_allocations; + u_int64_t sadb_comb_soft_bytes; + u_int64_t sadb_comb_hard_bytes; + u_int64_t sadb_comb_soft_addtime; + u_int64_t sadb_comb_hard_addtime; + u_int64_t sadb_comb_soft_usetime; + u_int64_t sadb_comb_hard_usetime; +}; + +struct sadb_supported { + u_int16_t sadb_supported_len; + u_int16_t sadb_supported_exttype; + u_int32_t sadb_supported_reserved; +}; + +struct sadb_alg { + u_int8_t sadb_alg_id; + u_int8_t sadb_alg_ivlen; + u_int16_t sadb_alg_minbits; + u_int16_t sadb_alg_maxbits; + u_int16_t sadb_alg_reserved; +}; + +struct sadb_spirange { + u_int16_t sadb_spirange_len; + u_int16_t sadb_spirange_exttype; + u_int32_t sadb_spirange_min; + u_int32_t sadb_spirange_max; + u_int32_t sadb_spirange_reserved; +}; + +struct sadb_x_kmprivate { + u_int16_t sadb_x_kmprivate_len; + u_int16_t sadb_x_kmprivate_exttype; + u_int32_t sadb_x_kmprivate_reserved; +}; + +/* + * XXX Additional SA Extension. + * mode: tunnel or transport + * reqid: to make SA unique nevertheless the address pair of SA are same. + * Mainly it's for VPN. + */ +struct sadb_x_sa2 { + u_int16_t sadb_x_sa2_len; + u_int16_t sadb_x_sa2_exttype; + u_int8_t sadb_x_sa2_mode; + u_int8_t sadb_x_sa2_reserved1; + u_int16_t sadb_x_sa2_reserved2; + u_int32_t sadb_x_sa2_sequence; + u_int32_t sadb_x_sa2_reqid; +}; + +/* XXX Policy Extension */ +/* sizeof(struct sadb_x_policy) == 16 */ +struct sadb_x_policy { + u_int16_t sadb_x_policy_len; + u_int16_t sadb_x_policy_exttype; + u_int16_t sadb_x_policy_type; /* See policy type of ipsec.h */ + u_int8_t sadb_x_policy_dir; /* direction, see ipsec.h */ + u_int8_t sadb_x_policy_reserved; + u_int32_t sadb_x_policy_id; + u_int32_t sadb_x_policy_reserved2; +}; +/* + * When policy_type == IPSEC, it is followed by some of + * the ipsec policy request. + * [total length of ipsec policy requests] + * = (sadb_x_policy_len * sizeof(uint64_t) - sizeof(struct sadb_x_policy)) + */ + +/* XXX IPsec Policy Request Extension */ +/* + * This structure is aligned 8 bytes. + */ +struct sadb_x_ipsecrequest { + u_int16_t sadb_x_ipsecrequest_len; /* structure length aligned to 8 bytes. + * This value is true length of bytes. + * Not in units of 64 bits. */ + u_int16_t sadb_x_ipsecrequest_proto; /* See ipsec.h */ + u_int8_t sadb_x_ipsecrequest_mode; /* See IPSEC_MODE_XX in ipsec.h. */ + u_int8_t sadb_x_ipsecrequest_level; /* See IPSEC_LEVEL_XX in ipsec.h */ + u_int16_t sadb_x_ipsecrequest_reqid; /* See ipsec.h */ + + /* + * followed by source IP address of SA, and immediately followed by + * destination IP address of SA. These encoded into two of sockaddr + * structure without any padding. Must set each sa_len exactly. + * Each of length of the sockaddr structure are not aligned to 64bits, + * but sum of x_request and addresses is aligned to 64bits. + */ +}; + +#define SADB_EXT_RESERVED 0 +#define SADB_EXT_SA 1 +#define SADB_EXT_LIFETIME_CURRENT 2 +#define SADB_EXT_LIFETIME_HARD 3 +#define SADB_EXT_LIFETIME_SOFT 4 +#define SADB_EXT_ADDRESS_SRC 5 +#define SADB_EXT_ADDRESS_DST 6 +#define SADB_EXT_ADDRESS_PROXY 7 +#define SADB_EXT_KEY_AUTH 8 +#define SADB_EXT_KEY_ENCRYPT 9 +#define SADB_EXT_IDENTITY_SRC 10 +#define SADB_EXT_IDENTITY_DST 11 +#define SADB_EXT_SENSITIVITY 12 +#define SADB_EXT_PROPOSAL 13 +#define SADB_EXT_SUPPORTED_AUTH 14 +#define SADB_EXT_SUPPORTED_ENCRYPT 15 +#define SADB_EXT_SPIRANGE 16 +#define SADB_X_EXT_KMPRIVATE 17 +#define SADB_X_EXT_POLICY 18 +#define SADB_X_EXT_SA2 19 +#define SADB_EXT_MAX 19 + +#define SADB_SATYPE_UNSPEC 0 +#define SADB_SATYPE_AH 2 +#define SADB_SATYPE_ESP 3 +#define SADB_SATYPE_RSVP 5 +#define SADB_SATYPE_OSPFV2 6 +#define SADB_SATYPE_RIPV2 7 +#define SADB_SATYPE_MIP 8 +#define SADB_X_SATYPE_IPCOMP 9 +/*#define SADB_X_SATYPE_POLICY 10 obsolete, do not reuse */ +#define SADB_SATYPE_MAX 11 + +#define SADB_SASTATE_LARVAL 0 +#define SADB_SASTATE_MATURE 1 +#define SADB_SASTATE_DYING 2 +#define SADB_SASTATE_DEAD 3 +#define SADB_SASTATE_MAX 3 + +#define SADB_SAFLAGS_PFS 1 + +/* RFC2367 numbers - meets RFC2407 */ +#define SADB_AALG_NONE 0 +#define SADB_AALG_MD5HMAC 2 +#define SADB_AALG_SHA1HMAC 3 +#define SADB_AALG_MAX 251 +/* private allocations - based on RFC2407/IANA assignment */ +#define SADB_X_AALG_SHA2_256 5 +#define SADB_X_AALG_SHA2_384 6 +#define SADB_X_AALG_SHA2_512 7 +/* private allocations should use 249-255 (RFC2407) */ +#define SADB_X_AALG_MD5 249 /* Keyed MD5 */ +#define SADB_X_AALG_SHA 250 /* Keyed SHA */ +#define SADB_X_AALG_NULL 251 /* null authentication */ + +/* RFC2367 numbers - meets RFC2407 */ +#define SADB_EALG_NONE 0 +#define SADB_EALG_DESCBC 2 +#define SADB_EALG_3DESCBC 3 +#define SADB_EALG_NULL 11 +#define SADB_EALG_MAX 253 +/* private allocations - based on RFC2407/IANA assignment */ +#define SADB_X_EALG_CAST128CBC 6 +#define SADB_X_EALG_BLOWFISHCBC 7 +#define SADB_X_EALG_RIJNDAELCBC 12 +#define SADB_X_EALG_AES 12 +/* private allocations should use 249-255 (RFC2407) */ +#define SADB_X_EALG_TWOFISHCBC 253 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ + +#if 1 /*nonstandard */ +#define SADB_X_CALG_NONE 0 +#define SADB_X_CALG_OUI 1 +#define SADB_X_CALG_DEFLATE 2 +#define SADB_X_CALG_LZS 3 +#define SADB_X_CALG_MAX 4 +#endif + +#define SADB_IDENTTYPE_RESERVED 0 +#define SADB_IDENTTYPE_PREFIX 1 +#define SADB_IDENTTYPE_FQDN 2 +#define SADB_IDENTTYPE_USERFQDN 3 +#define SADB_X_IDENTTYPE_ADDR 4 +#define SADB_IDENTTYPE_MAX 4 + +/* `flags' in sadb_sa structure holds followings */ +#define SADB_X_EXT_NONE 0x0000 /* i.e. new format. */ +#define SADB_X_EXT_OLD 0x0001 /* old format. */ + +#define SADB_X_EXT_IV4B 0x0010 /* IV length of 4 bytes in use */ +#define SADB_X_EXT_DERIV 0x0020 /* DES derived */ +#define SADB_X_EXT_CYCSEQ 0x0040 /* allowing to cyclic sequence. */ + + /* three of followings are exclusive flags each them */ +#define SADB_X_EXT_PSEQ 0x0000 /* sequencial padding for ESP */ +#define SADB_X_EXT_PRAND 0x0100 /* random padding for ESP */ +#define SADB_X_EXT_PZERO 0x0200 /* zero padding for ESP */ +#define SADB_X_EXT_PMASK 0x0300 /* mask for padding flag */ + +#if 1 +#define SADB_X_EXT_RAWCPI 0x0080 /* use well known CPI (IPComp) */ +#endif + +#define SADB_KEY_FLAGS_MAX 0x0fff + +/* SPI size for PF_KEYv2 */ +#define PFKEY_SPI_SIZE sizeof(u_int32_t) + +/* Identifier for menber of lifetime structure */ +#define SADB_X_LIFETIME_ALLOCATIONS 0 +#define SADB_X_LIFETIME_BYTES 1 +#define SADB_X_LIFETIME_ADDTIME 2 +#define SADB_X_LIFETIME_USETIME 3 + +/* The rate for SOFT lifetime against HARD one. */ +#define PFKEY_SOFT_LIFETIME_RATE 80 + +/* Utilities */ +#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1))) +#define PFKEY_EXTLEN(msg) \ + PFKEY_UNUNIT64(((struct sadb_ext *)(msg))->sadb_ext_len) +#define PFKEY_ADDR_PREFIX(ext) \ + (((struct sadb_address *)(ext))->sadb_address_prefixlen) +#define PFKEY_ADDR_PROTO(ext) \ + (((struct sadb_address *)(ext))->sadb_address_proto) +#define PFKEY_ADDR_SADDR(ext) \ + ((struct sockaddr *)((caddr_t)(ext) + sizeof(struct sadb_address))) + +/* in 64bits */ +#define PFKEY_UNUNIT64(a) ((a) << 3) +#define PFKEY_UNIT64(a) ((a) >> 3) + +#endif /* __PFKEY_V2_H */ + +#endif /* _NET_PFKEYV2_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/net/radix.h b/packages/net/bsd_tcpip/current/include/net/radix.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/radix.h @@ -0,0 +1,187 @@ +//========================================================================== +// +// include/net/radix.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1988, 1989, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)radix.h 8.2 (Berkeley) 10/31/94 + * $FreeBSD: src/sys/net/radix.h,v 1.16.2.1 2000/05/03 19:17:11 wollman Exp $ + */ + +#ifndef _RADIX_H_ +#define _RADIX_H_ + +/* + * Radix search tree node layout. + */ + +struct radix_node { + struct radix_mask *rn_mklist; /* list of masks contained in subtree */ + struct radix_node *rn_parent; /* parent */ + short rn_bit; /* bit offset; -1-index(netmask) */ + char rn_bmask; /* node: mask for bit test*/ + u_char rn_flags; /* enumerated next */ +#define RNF_NORMAL 1 /* leaf contains normal route */ +#define RNF_ROOT 2 /* leaf is root leaf for tree */ +#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */ + union { + struct { /* leaf only data: */ + caddr_t rn_Key; /* object of search */ + caddr_t rn_Mask; /* netmask, if present */ + struct radix_node *rn_Dupedkey; + } rn_leaf; + struct { /* node only data: */ + int rn_Off; /* where to start compare */ + struct radix_node *rn_L;/* progeny */ + struct radix_node *rn_R;/* progeny */ + } rn_node; + } rn_u; +#ifdef RN_DEBUG + int rn_info; + struct radix_node *rn_twin; + struct radix_node *rn_ybro; +#endif +}; + +#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey +#define rn_key rn_u.rn_leaf.rn_Key +#define rn_mask rn_u.rn_leaf.rn_Mask +#define rn_offset rn_u.rn_node.rn_Off +#define rn_left rn_u.rn_node.rn_L +#define rn_right rn_u.rn_node.rn_R + +/* + * Annotations to tree concerning potential routes applying to subtrees. + */ + +struct radix_mask { + short rm_bit; /* bit offset; -1-index(netmask) */ + char rm_unused; /* cf. rn_bmask */ + u_char rm_flags; /* cf. rn_flags */ + struct radix_mask *rm_mklist; /* more masks to try */ + union { + caddr_t rmu_mask; /* the mask */ + struct radix_node *rmu_leaf; /* for normal routes */ + } rm_rmu; + int rm_refs; /* # of references to this struct */ +}; + +#define rm_mask rm_rmu.rmu_mask +#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ + +#define MKGet(m) {\ + if (rn_mkfreelist) {\ + m = rn_mkfreelist; \ + rn_mkfreelist = (m)->rm_mklist; \ + } else \ + R_Malloc(m, struct radix_mask *, sizeof (*(m))); }\ + +#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);} + +typedef int walktree_f_t __P((struct radix_node *, void *)); + +struct radix_node_head { + struct radix_node *rnh_treetop; + int rnh_addrsize; /* permit, but not require fixed keys */ + int rnh_pktsize; /* permit, but not require fixed keys */ + struct radix_node *(*rnh_addaddr) /* add based on sockaddr */ + __P((void *v, void *mask, + struct radix_node_head *head, struct radix_node nodes[])); + struct radix_node *(*rnh_addpkt) /* add based on packet hdr */ + __P((void *v, void *mask, + struct radix_node_head *head, struct radix_node nodes[])); + struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */ + __P((void *v, void *mask, struct radix_node_head *head)); + struct radix_node *(*rnh_delpkt) /* remove based on packet hdr */ + __P((void *v, void *mask, struct radix_node_head *head)); + struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */ + __P((void *v, struct radix_node_head *head)); + struct radix_node *(*rnh_lookup) /* locate based on sockaddr */ + __P((void *v, void *mask, struct radix_node_head *head)); + struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */ + __P((void *v, struct radix_node_head *head)); + int (*rnh_walktree) /* traverse tree */ + __P((struct radix_node_head *head, walktree_f_t *f, void *w)); + int (*rnh_walktree_from) /* traverse tree below a */ + __P((struct radix_node_head *head, void *a, void *m, + walktree_f_t *f, void *w)); + void (*rnh_close) /* do something when the last ref drops */ + __P((struct radix_node *rn, struct radix_node_head *head)); + struct radix_node rnh_nodes[3]; /* empty tree for common case */ +}; + +#ifndef _KERNEL +#define Bcmp(a, b, n) bcmp(((char *)(a)), ((char *)(b)), (n)) +#define Bcopy(a, b, n) bcopy(((char *)(a)), ((char *)(b)), (unsigned)(n)) +#define Bzero(p, n) bzero((char *)(p), (int)(n)); +#define R_Malloc(p, t, n) (p = (t) malloc((unsigned int)(n))) +#define Free(p) free((char *)p); +#else +#define Bcmp(a, b, n) bcmp(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n)) +#define Bcopy(a, b, n) bcopy(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n)) +#define Bzero(p, n) bzero((caddr_t)(p), (unsigned)(n)); +#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_DONTWAIT)) +#define Free(p) free((caddr_t)p, M_RTABLE); +#endif /* _KERNEL */ + +void rn_init __P((void)); +int rn_inithead __P((void **, int)); +int rn_refines __P((void *, void *)); +struct radix_node + *rn_addmask __P((void *, int, int)), + *rn_addroute __P((void *, void *, struct radix_node_head *, + struct radix_node [2])), + *rn_delete __P((void *, void *, struct radix_node_head *)), + *rn_lookup __P((void *v_arg, void *m_arg, + struct radix_node_head *head)), + *rn_match __P((void *, struct radix_node_head *)); + + +#endif /* _RADIX_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/net/raw_cb.h b/packages/net/bsd_tcpip/current/include/net/raw_cb.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/raw_cb.h @@ -0,0 +1,97 @@ +//========================================================================== +// +// include/net/raw_cb.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1980, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)raw_cb.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/raw_cb.h,v 1.12 1999/12/29 04:38:37 peter Exp $ + */ + +#ifndef _NET_RAW_CB_H_ +#define _NET_RAW_CB_H_ + +#include + +/* + * Raw protocol interface control block. Used + * to tie a socket to the generic raw interface. + */ +struct rawcb { + LIST_ENTRY(rawcb) list; + struct socket *rcb_socket; /* back pointer to socket */ + struct sockaddr *rcb_faddr; /* destination address */ + struct sockaddr *rcb_laddr; /* socket's address */ + struct sockproto rcb_proto; /* protocol family, protocol */ +}; + +#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb) + +/* + * Nominal space allocated to a raw socket. + */ +#define RAWSNDQ 8192 +#define RAWRCVQ 8192 + +#ifdef _KERNEL +extern LIST_HEAD(rawcb_list_head, rawcb) rawcb_list; + +int raw_attach __P((struct socket *, int)); +void raw_ctlinput __P((int, struct sockaddr *, void *)); +void raw_detach __P((struct rawcb *)); +void raw_disconnect __P((struct rawcb *)); +void raw_init __P((void)); +void raw_input __P((struct mbuf *, + struct sockproto *, struct sockaddr *, struct sockaddr *)); + +extern struct pr_usrreqs raw_usrreqs; +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/net/route.h b/packages/net/bsd_tcpip/current/include/net/route.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/net/route.h @@ -0,0 +1,341 @@ +//========================================================================== +// +// include/net/route.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1980, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)route.h 8.3 (Berkeley) 4/19/94 + * $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $ + */ + +#ifndef _NET_ROUTE_H_ +#define _NET_ROUTE_H_ + +/* + * Kernel resident routing tables. + * + * The routing tables are initialized when interface addresses + * are set by making entries for all directly connected interfaces. + */ + +/* + * A route consists of a destination address and a reference + * to a routing entry. These are often held by protocols + * in their control blocks, e.g. inpcb. + */ +struct route { + struct rtentry *ro_rt; + union { + struct sockaddr_storage rou_dst_ss; + struct sockaddr ro_dst_sa; + } ro_u; +}; +#define ro_dst ro_u.ro_dst_sa + +/* + * These numbers are used by reliable protocols for determining + * retransmission behavior and are included in the routing structure. + */ +struct rt_metrics { + u_long rmx_locks; /* Kernel must leave these values alone */ + u_long rmx_mtu; /* MTU for this path */ + u_long rmx_hopcount; /* max hops expected */ + u_long rmx_expire; /* lifetime for route, e.g. redirect */ + u_long rmx_recvpipe; /* inbound delay-bandwidth product */ + u_long rmx_sendpipe; /* outbound delay-bandwidth product */ + u_long rmx_ssthresh; /* outbound gateway buffer limit */ + u_long rmx_rtt; /* estimated round trip time */ + u_long rmx_rttvar; /* estimated rtt variance */ + u_long rmx_pksent; /* packets sent using this route */ + u_long rmx_filler[4]; /* will be used for T/TCP later */ +}; + +/* + * rmx_rtt and rmx_rttvar are stored as microseconds; + * RTTTOPRHZ(rtt) converts to a value suitable for use + * by a protocol slowtimo counter. + */ +#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ +#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) + +/* + * XXX kernel function pointer `rt_output' is visible to applications. + */ +struct mbuf; + +/* + * We distinguish between routes to hosts and routes to networks, + * preferring the former if available. For each route we infer + * the interface to use from the gateway address supplied when + * the route was entered. Routes that forward packets through + * gateways are marked so that the output routines know to address the + * gateway rather than the ultimate destination. + */ +#ifndef RNF_NORMAL +#include +#endif +struct rtentry { + struct radix_node rt_nodes[2]; /* tree glue, and other values */ +#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key)) +#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask)) + struct sockaddr *rt_gateway; /* value */ + long rt_refcnt; /* # held references */ + u_long rt_flags; /* up/down?, host/net */ + struct ifnet *rt_ifp; /* the answer: interface to use */ + struct ifaddr *rt_ifa; /* the answer: interface to use */ + struct sockaddr *rt_genmask; /* for generation of cloned routes */ + caddr_t rt_llinfo; /* pointer to link level info cache */ + struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */ + struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ + int (*rt_output) __P((struct ifnet *, struct mbuf *, + struct sockaddr *, struct rtentry *)); + /* output routine for this (rt,if) */ + struct rtentry *rt_parent; /* cloning parent of this route */ + void *rt_filler2; /* more filler */ +}; + +/* + * Following structure necessary for 4.3 compatibility; + * We should eventually move it to a compat file. + */ +struct ortentry { + u_long rt_hash; /* to speed lookups */ + struct sockaddr rt_dst; /* key */ + struct sockaddr rt_gateway; /* value */ + short rt_flags; /* up/down?, host/net */ + short rt_refcnt; /* # held references */ + u_long rt_use; /* raw # packets forwarded */ + struct ifnet *rt_ifp; /* the answer: interface to use */ +}; + +#define rt_use rt_rmx.rmx_pksent + +/* + * This structure modelled after the Linux 'route' functions + * Used by the SIOCADDRT and SIOCDELRT calls + */ +struct ecos_rtentry { + struct sockaddr rt_dst; /* Target address. */ + struct sockaddr rt_gateway; /* Gateway addr (RTF_GATEWAY). */ + struct sockaddr rt_genmask; /* Target network mask (IP). */ + unsigned short int rt_flags; + unsigned char rt_tos; + unsigned char rt_class; + short int rt_metric; /* +1 for binary compatibility! */ + char *rt_dev; /* Forcing the device at add. */ + unsigned long int rt_mtu; /* Per route MTU/Window. */ + unsigned long int rt_window; /* Window clamping. */ + unsigned short int rt_irtt; /* Initial RTT. */ +}; +/* Compatibility hack. */ +#define rt_mss rt_mtu + +#define RTF_UP 0x1 /* route usable */ +#define RTF_GATEWAY 0x2 /* destination is a gateway */ +#define RTF_HOST 0x4 /* host entry (net otherwise) */ +#define RTF_REJECT 0x8 /* host or net unreachable */ +#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ +#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ +#define RTF_DONE 0x40 /* message confirmed */ +#define RTF_DELCLONE 0x80 /* delete cloned route */ +#define RTF_CLONING 0x100 /* generate new routes on use */ +#define RTF_XRESOLVE 0x200 /* external daemon resolves name */ +#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */ +#define RTF_STATIC 0x800 /* manually added */ +#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ +#define RTF_PROTO2 0x4000 /* protocol specific routing flag */ +#define RTF_PROTO1 0x8000 /* protocol specific routing flag */ + +#define RTF_PRCLONING 0x10000 /* protocol requires cloning */ +#define RTF_WASCLONED 0x20000 /* route generated through cloning */ +#define RTF_PROTO3 0x40000 /* protocol specific routing flag */ +/* 0x80000 unused */ +#define RTF_PINNED 0x100000 /* future use */ +#define RTF_LOCAL 0x200000 /* route represents a local address */ +#define RTF_BROADCAST 0x400000 /* route represents a bcast address */ +#define RTF_MULTICAST 0x800000 /* route represents a mcast address */ + /* 0x1000000 and up unassigned */ + +/* + * Routing statistics. + */ +struct rtstat { + short rts_badredirect; /* bogus redirect calls */ + short rts_dynamic; /* routes created by redirects */ + short rts_newgateway; /* routes modified by redirects */ + short rts_unreach; /* lookups which failed */ + short rts_wildcard; /* lookups satisfied by a wildcard */ +}; +/* + * Structures for routing messages. + */ +struct rt_msghdr { + u_short rtm_msglen; /* to skip over non-understood messages */ + u_char rtm_version; /* future binary compatibility */ + u_char rtm_type; /* message type */ + u_short rtm_index; /* index for associated ifp */ + int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ + int rtm_addrs; /* bitmask identifying sockaddrs in msg */ + pid_t rtm_pid; /* identify sender */ + int rtm_seq; /* for sender to identify action */ + int rtm_errno; /* why failed */ + int rtm_use; /* from rtentry */ + u_long rtm_inits; /* which metrics we are initializing */ + struct rt_metrics rtm_rmx; /* metrics themselves */ +}; + +#define RTM_VERSION 5 /* Up the ante and ignore older versions */ + +/* + * Message types. + */ +#define RTM_ADD 0x1 /* Add Route */ +#define RTM_DELETE 0x2 /* Delete Route */ +#define RTM_CHANGE 0x3 /* Change Metrics or flags */ +#define RTM_GET 0x4 /* Report Metrics */ +#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */ +#define RTM_REDIRECT 0x6 /* Told to use different route */ +#define RTM_MISS 0x7 /* Lookup failed on this address */ +#define RTM_LOCK 0x8 /* fix specified metrics */ +#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ +#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ +#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ +#define RTM_NEWADDR 0xc /* address being added to iface */ +#define RTM_DELADDR 0xd /* address being removed from iface */ +#define RTM_IFINFO 0xe /* iface going up/down etc. */ +#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */ +#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */ + +/* + * Bitmask values for rtm_inits and rmx_locks. + */ +#define RTV_MTU 0x1 /* init or lock _mtu */ +#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ +#define RTV_EXPIRE 0x4 /* init or lock _expire */ +#define RTV_RPIPE 0x8 /* init or lock _recvpipe */ +#define RTV_SPIPE 0x10 /* init or lock _sendpipe */ +#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ +#define RTV_RTT 0x40 /* init or lock _rtt */ +#define RTV_RTTVAR 0x80 /* init or lock _rttvar */ + +/* + * Bitmask values for rtm_addrs. + */ +#define RTA_DST 0x1 /* destination sockaddr present */ +#define RTA_GATEWAY 0x2 /* gateway sockaddr present */ +#define RTA_NETMASK 0x4 /* netmask sockaddr present */ +#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ +#define RTA_IFP 0x10 /* interface name sockaddr present */ +#define RTA_IFA 0x20 /* interface addr sockaddr present */ +#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ +#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ + +/* + * Index offsets for sockaddr array for alternate internal encoding. + */ +#define RTAX_DST 0 /* destination sockaddr present */ +#define RTAX_GATEWAY 1 /* gateway sockaddr present */ +#define RTAX_NETMASK 2 /* netmask sockaddr present */ +#define RTAX_GENMASK 3 /* cloning mask sockaddr present */ +#define RTAX_IFP 4 /* interface name sockaddr present */ +#define RTAX_IFA 5 /* interface addr sockaddr present */ +#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ +#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ +#define RTAX_MAX 8 /* size of array to allocate */ + +struct rt_addrinfo { + int rti_addrs; + struct sockaddr *rti_info[RTAX_MAX]; +}; + +struct route_cb { + int ip_count; + int ip6_count; + int ipx_count; + int ns_count; + int any_count; +}; + +#ifdef _KERNEL +#define RTFREE(rt) \ + do { \ + if ((rt)->rt_refcnt <= 1) \ + rtfree(rt); \ + else \ + (rt)->rt_refcnt--; \ + } while (0) + +extern struct route_cb route_cb; +extern struct radix_node_head *rt_tables[AF_MAX+1]; + +struct ifmultiaddr; +struct proc; + +void route_init __P((void)); +void rt_ifmsg __P((struct ifnet *)); +void rt_missmsg __P((int, struct rt_addrinfo *, int, int)); +void rt_newaddrmsg __P((int, struct ifaddr *, int, struct rtentry *)); +void rt_newmaddrmsg __P((int, struct ifmultiaddr *)); +int rt_setgate __P((struct rtentry *, + struct sockaddr *, struct sockaddr *)); +void rtalloc __P((struct route *)); +void rtalloc_ign __P((struct route *, u_long)); +struct rtentry * + rtalloc1 __P((struct sockaddr *, int, u_long)); +void rtfree __P((struct rtentry *)); +int rtinit __P((struct ifaddr *, int, int)); +int rtioctl __P((int, caddr_t, struct proc *)); +void rtredirect __P((struct sockaddr *, struct sockaddr *, + struct sockaddr *, int, struct sockaddr *, struct rtentry **)); +int rtrequest __P((int, struct sockaddr *, + struct sockaddr *, struct sockaddr *, int, struct rtentry **)); +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/icmp6.h b/packages/net/bsd_tcpip/current/include/netinet/icmp6.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/icmp6.h @@ -0,0 +1,888 @@ +//========================================================================== +// +// include/netinet/icmp6.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: icmp6.h,v 1.66 2001/12/18 02:19:14 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_ICMP6_H_ +#define _NETINET_ICMP6_H_ + +#define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) + - sizeof(struct icmp6_hdr) */ + +struct icmp6_hdr { + u_int8_t icmp6_type; /* type field */ + u_int8_t icmp6_code; /* code field */ + u_int16_t icmp6_cksum; /* checksum field */ + union { + u_int32_t icmp6_un_data32[1]; /* type-specific field */ + u_int16_t icmp6_un_data16[2]; /* type-specific field */ + u_int8_t icmp6_un_data8[4]; /* type-specific field */ + } icmp6_dataun; +} __attribute__ ((aligned(1), packed)); + +#define icmp6_data32 icmp6_dataun.icmp6_un_data32 +#define icmp6_data16 icmp6_dataun.icmp6_un_data16 +#define icmp6_data8 icmp6_dataun.icmp6_un_data8 +#define icmp6_pptr icmp6_data32[0] /* parameter prob */ +#define icmp6_mtu icmp6_data32[0] /* packet too big */ +#define icmp6_id icmp6_data16[0] /* echo request/reply */ +#define icmp6_seq icmp6_data16[1] /* echo request/reply */ +#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ + +#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ +#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ +#define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ +#define ICMP6_PARAM_PROB 4 /* ip6 header bad */ + +#define ICMP6_ECHO_REQUEST 128 /* echo service */ +#define ICMP6_ECHO_REPLY 129 /* echo reply */ +#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */ +#define MLD_LISTENER_QUERY 130 /* multicast listener query */ +#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ +#define MLD_LISTENER_REPORT 131 /* multicast listener report */ +#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ +#define MLD_LISTENER_DONE 132 /* multicast listener done */ + +#ifndef _KERNEL +/* the followings are for backward compatibility to old KAME apps. */ +#define MLD6_LISTENER_QUERY MLD_LISTENER_QUERY +#define MLD6_LISTENER_REPORT MLD_LISTENER_REPORT +#define MLD6_LISTENER_DONE MLD_LISTENER_DONE +#endif + +#define ND_ROUTER_SOLICIT 133 /* router solicitation */ +#define ND_ROUTER_ADVERT 134 /* router advertisment */ +#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */ +#define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisment */ +#define ND_REDIRECT 137 /* redirect */ + +#define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */ + +#define ICMP6_WRUREQUEST 139 /* who are you request */ +#define ICMP6_WRUREPLY 140 /* who are you reply */ +#define ICMP6_FQDN_QUERY 139 /* FQDN query */ +#define ICMP6_FQDN_REPLY 140 /* FQDN reply */ +#define ICMP6_NI_QUERY 139 /* node information request */ +#define ICMP6_NI_REPLY 140 /* node information reply */ + +/* The belows are not yet defined in 2292bis. They will be renamed */ +#define IND_SOLICIT 141 /* inverse neighbor solicitation */ +#define IND_ADVERT 142 /* inverse neighbor advertisment */ + +/* Folloing numbers are defined in the mobile-ip draft. */ +#define ICMP6_HADISCOV_REQUEST 150 /* XXX To be authorized */ +#define ICMP6_HADISCOV_REPLY 151 /* XXX To be authorized */ +#define ICMP6_MOBILEPREFIX_SOLICIT 152 /* XXX To be authorized */ +#define ICMP6_MOBILEPREFIX_ADVERT 153 /* XXX To be authorized */ + +/* The definitions below are experimental. TBA */ +#define MLD_MTRACE_RESP 200 /* mtrace resp (to sender) */ +#define MLD_MTRACE 201 /* mtrace messages */ + +#define MLDV2_LISTENER_REPORT 206 /* MLDv2 report */ + +#ifndef _KERNEL +#define MLD6_MTRACE_RESP MLD_MTRACE_RESP +#define MLD6_MTRACE MLD_MTRACE +#define MLD6V2_LISTENER_REPORT MLDV2_LISTENER_REPORT +#endif + +#define ICMP6_MAXTYPE 206 + +#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ +#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */ +#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */ +#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ +#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ +#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */ + +#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */ +#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */ + +#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ +#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */ +#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */ + +#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ + +#define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */ +#define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */ +#define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */ + +#define ICMP6_NI_SUCCESS 0 /* node information successful reply */ +#define ICMP6_NI_REFUSED 1 /* node information request is refused */ +#define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */ + +#define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */ +#define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ +#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ + +/* Used in kernel only */ +#define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ +#define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ + +/* + * Multicast Listener Discovery + */ +struct mld_hdr { + struct icmp6_hdr mld_icmp6_hdr; + struct in6_addr mld_addr; /* multicast address */ +} __attribute__ ((aligned(1), packed)); + +/* definitions to provide backward compatibility to old KAME applications */ +#ifndef _KERNEL +#define mld6_hdr mld_hdr +#define mld6_type mld_type +#define mld6_code mld_code +#define mld6_cksum mld_cksum +#define mld6_maxdelay mld_maxdelay +#define mld6_reserved mld_reserved +#define mld6_addr mld_addr +#endif + +/* shortcut macro definitions */ +#define mld_type mld_icmp6_hdr.icmp6_type +#define mld_code mld_icmp6_hdr.icmp6_code +#define mld_cksum mld_icmp6_hdr.icmp6_cksum +#define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] +#define mld_reserved mld_icmp6_hdr.icmp6_data16[1] + +/* + * Neighbor Discovery + */ + +struct nd_router_solicit { /* router solicitation */ + struct icmp6_hdr nd_rs_hdr; + /* could be followed by options */ +} __attribute__ ((aligned(1), packed)); + +#define nd_rs_type nd_rs_hdr.icmp6_type +#define nd_rs_code nd_rs_hdr.icmp6_code +#define nd_rs_cksum nd_rs_hdr.icmp6_cksum +#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] + +struct nd_router_advert { /* router advertisement */ + struct icmp6_hdr nd_ra_hdr; + u_int32_t nd_ra_reachable; /* reachable time */ + u_int32_t nd_ra_retransmit; /* retransmit timer */ + /* could be followed by options */ +} __attribute__ ((aligned(1), packed)); + +#define nd_ra_type nd_ra_hdr.icmp6_type +#define nd_ra_code nd_ra_hdr.icmp6_code +#define nd_ra_cksum nd_ra_hdr.icmp6_cksum +#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] +#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] +#define ND_RA_FLAG_MANAGED 0x80 +#define ND_RA_FLAG_OTHER 0x40 +#define ND_RA_FLAG_HOME_AGENT 0x20 + +/* + * Router preference values based on draft-draves-ipngwg-router-selection-01. + * These are non-standard definitions. + */ +#define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ + +#define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */ +#define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */ +#define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */ +#define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ + +#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] + +struct nd_neighbor_solicit { /* neighbor solicitation */ + struct icmp6_hdr nd_ns_hdr; + struct in6_addr nd_ns_target; /*target address */ + /* could be followed by options */ +} __attribute__((aligned(1), packed)); + +#define nd_ns_type nd_ns_hdr.icmp6_type +#define nd_ns_code nd_ns_hdr.icmp6_code +#define nd_ns_cksum nd_ns_hdr.icmp6_cksum +#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] + +struct nd_neighbor_advert { /* neighbor advertisement */ + struct icmp6_hdr nd_na_hdr; + struct in6_addr nd_na_target; /* target address */ + /* could be followed by options */ +} __attribute__((aligned(1), packed)); + +#define nd_na_type nd_na_hdr.icmp6_type +#define nd_na_code nd_na_hdr.icmp6_code +#define nd_na_cksum nd_na_hdr.icmp6_cksum +#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] +#if BYTE_ORDER == BIG_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80000000 +#define ND_NA_FLAG_SOLICITED 0x40000000 +#define ND_NA_FLAG_OVERRIDE 0x20000000 +#else +#if BYTE_ORDER == LITTLE_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80 +#define ND_NA_FLAG_SOLICITED 0x40 +#define ND_NA_FLAG_OVERRIDE 0x20 +#endif +#endif + +struct nd_redirect { /* redirect */ + struct icmp6_hdr nd_rd_hdr; + struct in6_addr nd_rd_target; /* target address */ + struct in6_addr nd_rd_dst; /* destination address */ + /* could be followed by options */ +} __attribute__((aligned(1), packed)); + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +struct ind_neighbor_solicit { /* inverse neighbor solicitation */ + struct icmp6_hdr ind_ns_hdr; + /* could be followed by options */ +} __attribute__((aligned(1), packed)); + +#define ind_ns_type ind_ns_hdr.icmp6_type +#define ind_ns_code ind_ns_hdr.icmp6_code +#define ind_ns_cksum ind_ns_hdr.icmp6_cksum +#define ind_ns_reserved ind_ns_hdr.icmp6_data32[0] + +struct ind_neighbor_advert { /* inverse neighbor advertisement */ + struct icmp6_hdr ind_na_hdr; + /* could be followed by options */ +} __attribute__((aligned(1), packed)); + +#define ind_na_type ind_na_hdr.icmp6_type +#define ind_na_code ind_na_hdr.icmp6_code +#define ind_na_cksum ind_na_hdr.icmp6_cksum +#define ind_na_flags_reserved ind_na_hdr.icmp6_data32[0] + +struct ha_discov_req { /* HA Address Discovery Request */ + struct icmp6_hdr ha_dreq_hdr; +#ifdef MIP6_DRAFT13 + u_int32_t ha_dreq_reserved1; + u_int32_t ha_dreq_reserved2; + struct in6_addr ha_dreq_home; /* MN home address */ +#endif /* MIP6_DRAFT13 */ +} __attribute__((aligned(1), packed)); + +#define discov_req_type ha_dreq_hdr.icmp6_type +#define discov_req_code ha_dreq_hdr.icmp6_code +#define discov_req_cksum ha_dreq_hdr.icmp6_cksum +#define discov_req_id ha_dreq_hdr.icmp6_data16[0] + +struct ha_discov_rep { /* HA Address Discovery Reply */ + struct icmp6_hdr ha_drep_hdr; + u_int32_t ha_drep_reserved1; + u_int32_t ha_drep_reserved2; + /* could be followed by Home Agent addresses */ +} __attribute__((aligned(1), packed)); + +#define discov_rep_type ha_drep_hdr.icmp6_type +#define discov_rep_code ha_drep_hdr.icmp6_code +#define discov_rep_cksum ha_drep_hdr.icmp6_cksum +#define discov_rep_id ha_drep_hdr.icmp6_data16[0] + +struct mobile_prefix_solicit { /* Mobile Prefix Solicitation */ + struct icmp6_hdr mp_sol_hdr; +} __attribute__((aligned(1), packed)); + +#define mp_sol_type mp_sol_hdr.icmp6_type +#define mp_sol_code mp_sol_hdr.icmp6_code +#define mp_sol_cksum mp_sol_hdr.icmp6_cksum +#define mp_sol_reserved mp_sol_hdr.icmp6_data32[0] + +struct mobile_prefix_advert { /* Mobile Prefix Advertisement */ + struct icmp6_hdr mp_adv_hdr; +} __attribute__((aligned(1), packed)); + +#define mp_adv_type mp_adv_hdr.icmp6_type +#define mp_adv_code mp_adv_hdr.icmp6_code +#define mp_adv_cksum mp_adv_hdr.icmp6_cksum +#define mp_adv_opts mp_adv_hdr.icmp6_data8 + +struct nd_opt_hdr { /* Neighbor discovery option header */ + u_int8_t nd_opt_type; + u_int8_t nd_opt_len; + /* followed by option specific data*/ +} __attribute__((aligned(1), packed)); + +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define ND_OPT_PREFIX_INFORMATION 3 +#define ND_OPT_REDIRECTED_HEADER 4 +#define ND_OPT_MTU 5 +#define ND_OPT_ADVINTERVAL 7 /* 2292bis-02 */ +#define ND_OPT_HOMEAGENT_INFO 8 /* 2292bis-02 */ +#define ND_OPT_SOURCE_ADDRLIST 9 /* will be renamed */ +#define ND_OPT_TARGET_ADDRLIST 10 /* will be renamed */ + +#define ND_OPT_ROUTE_INFO 200 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */ + +struct nd_opt_prefix_info { /* prefix information */ + u_int8_t nd_opt_pi_type; + u_int8_t nd_opt_pi_len; + u_int8_t nd_opt_pi_prefix_len; + u_int8_t nd_opt_pi_flags_reserved; + u_int32_t nd_opt_pi_valid_time; + u_int32_t nd_opt_pi_preferred_time; + u_int32_t nd_opt_pi_reserved2; + struct in6_addr nd_opt_pi_prefix; +} __attribute__((aligned(1), packed)); + +#define ND_OPT_PI_FLAG_ONLINK 0x80 +#define ND_OPT_PI_FLAG_AUTO 0x40 +#define ND_OPT_PI_FLAG_ROUTER 0x20 /* 2292bis-02 */ + +struct nd_opt_rd_hdr { /* redirected header */ + u_int8_t nd_opt_rh_type; + u_int8_t nd_opt_rh_len; + u_int16_t nd_opt_rh_reserved1; + u_int32_t nd_opt_rh_reserved2; + /* followed by IP header and data */ +} __attribute__((aligned(1), packed)); + +struct nd_opt_mtu { /* MTU option */ + u_int8_t nd_opt_mtu_type; + u_int8_t nd_opt_mtu_len; + u_int16_t nd_opt_mtu_reserved; + u_int32_t nd_opt_mtu_mtu; +} __attribute__((aligned(1), packed)); + +struct nd_opt_advinterval { /* Advertisement interval option */ + u_int8_t nd_opt_adv_type; + u_int8_t nd_opt_adv_len; + u_int16_t nd_opt_adv_reserved; + u_int32_t nd_opt_adv_interval; +} __attribute__((aligned(1), packed)); + +struct nd_opt_homeagent_info { /* Home Agent info */ + u_int8_t nd_opt_hai_type; + u_int8_t nd_opt_hai_len; + u_int16_t nd_opt_hai_reserved; + int16_t nd_opt_hai_preference; + u_int16_t nd_opt_hai_lifetime; +} __attribute__((aligned(1), packed)); + +struct nd_opt_route_info { /* route info */ + u_int8_t nd_opt_rti_type; + u_int8_t nd_opt_rti_len; + u_int8_t nd_opt_rti_prefixlen; + u_int8_t nd_opt_rti_flags; + u_int32_t nd_opt_rti_lifetime; + /* prefix follows */ +} __attribute__((aligned(1), packed)); + +/* + * icmp6 namelookup + */ + +struct icmp6_namelookup { + struct icmp6_hdr icmp6_nl_hdr; + u_int8_t icmp6_nl_nonce[8]; + int32_t icmp6_nl_ttl; +#if 0 + u_int8_t icmp6_nl_len; + u_int8_t icmp6_nl_name[3]; +#endif + /* could be followed by options */ +} __attribute__((aligned(1), packed)); + +/* + * icmp6 node information + */ +struct icmp6_nodeinfo { + struct icmp6_hdr icmp6_ni_hdr; + u_int8_t icmp6_ni_nonce[8]; + /* could be followed by reply data */ +} __attribute__((aligned(1), packed)); + +#define ni_type icmp6_ni_hdr.icmp6_type +#define ni_code icmp6_ni_hdr.icmp6_code +#define ni_cksum icmp6_ni_hdr.icmp6_cksum +#define ni_qtype icmp6_ni_hdr.icmp6_data16[0] +#define ni_flags icmp6_ni_hdr.icmp6_data16[1] + +#define NI_QTYPE_NOOP 0 /* NOOP */ +#define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ +#define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ +#define NI_QTYPE_DNSNAME 2 /* DNS Name */ +#define NI_QTYPE_NODEADDR 3 /* Node Addresses */ +#define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ + +#if BYTE_ORDER == BIG_ENDIAN +#define NI_SUPTYPE_FLAG_COMPRESS 0x1 +#define NI_FQDN_FLAG_VALIDTTL 0x1 +#elif BYTE_ORDER == LITTLE_ENDIAN +#define NI_SUPTYPE_FLAG_COMPRESS 0x0100 +#define NI_FQDN_FLAG_VALIDTTL 0x0100 +#endif + +#ifdef NAME_LOOKUPS_04 +#if BYTE_ORDER == BIG_ENDIAN +#define NI_NODEADDR_FLAG_LINKLOCAL 0x1 +#define NI_NODEADDR_FLAG_SITELOCAL 0x2 +#define NI_NODEADDR_FLAG_GLOBAL 0x4 +#define NI_NODEADDR_FLAG_ALL 0x8 +#define NI_NODEADDR_FLAG_TRUNCATE 0x10 +#define NI_NODEADDR_FLAG_ANYCAST 0x20 /* just experimental. not in spec */ +#elif BYTE_ORDER == LITTLE_ENDIAN +#define NI_NODEADDR_FLAG_LINKLOCAL 0x0100 +#define NI_NODEADDR_FLAG_SITELOCAL 0x0200 +#define NI_NODEADDR_FLAG_GLOBAL 0x0400 +#define NI_NODEADDR_FLAG_ALL 0x0800 +#define NI_NODEADDR_FLAG_TRUNCATE 0x1000 +#define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */ +#endif +#else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */ +#if BYTE_ORDER == BIG_ENDIAN +#define NI_NODEADDR_FLAG_TRUNCATE 0x1 +#define NI_NODEADDR_FLAG_ALL 0x2 +#define NI_NODEADDR_FLAG_COMPAT 0x4 +#define NI_NODEADDR_FLAG_LINKLOCAL 0x8 +#define NI_NODEADDR_FLAG_SITELOCAL 0x10 +#define NI_NODEADDR_FLAG_GLOBAL 0x20 +#define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */ +#elif BYTE_ORDER == LITTLE_ENDIAN +#define NI_NODEADDR_FLAG_TRUNCATE 0x0100 +#define NI_NODEADDR_FLAG_ALL 0x0200 +#define NI_NODEADDR_FLAG_COMPAT 0x0400 +#define NI_NODEADDR_FLAG_LINKLOCAL 0x0800 +#define NI_NODEADDR_FLAG_SITELOCAL 0x1000 +#define NI_NODEADDR_FLAG_GLOBAL 0x2000 +#define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ +#endif +#endif + +struct ni_reply_fqdn { + u_int32_t ni_fqdn_ttl; /* TTL */ + u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ + u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ +} __attribute__((aligned(1), packed)); + +/* + * Router Renumbering. as router-renum-08.txt + */ +struct icmp6_router_renum { /* router renumbering header */ + struct icmp6_hdr rr_hdr; + u_int8_t rr_segnum; + u_int8_t rr_flags; + u_int16_t rr_maxdelay; + u_int32_t rr_reserved; +} __attribute__((aligned(1), packed)); + +#define ICMP6_RR_FLAGS_TEST 0x80 +#define ICMP6_RR_FLAGS_REQRESULT 0x40 +#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 +#define ICMP6_RR_FLAGS_SPECSITE 0x10 +#define ICMP6_RR_FLAGS_PREVDONE 0x08 + +#define rr_type rr_hdr.icmp6_type +#define rr_code rr_hdr.icmp6_code +#define rr_cksum rr_hdr.icmp6_cksum +#define rr_seqnum rr_hdr.icmp6_data32[0] + +struct rr_pco_match { /* match prefix part */ + u_int8_t rpm_code; + u_int8_t rpm_len; + u_int8_t rpm_ordinal; + u_int8_t rpm_matchlen; + u_int8_t rpm_minlen; + u_int8_t rpm_maxlen; + u_int16_t rpm_reserved; + struct in6_addr rpm_prefix; +} __attribute__((aligned(1), packed)); + +#define RPM_PCO_ADD 1 +#define RPM_PCO_CHANGE 2 +#define RPM_PCO_SETGLOBAL 3 +#define RPM_PCO_MAX 4 + +struct rr_pco_use { /* use prefix part */ + u_int8_t rpu_uselen; + u_int8_t rpu_keeplen; + u_int8_t rpu_ramask; + u_int8_t rpu_raflags; + u_int32_t rpu_vltime; + u_int32_t rpu_pltime; + u_int32_t rpu_flags; + struct in6_addr rpu_prefix; +} __attribute__((aligned(1), packed)); +#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 +#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 + +#if BYTE_ORDER == BIG_ENDIAN +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 +#elif BYTE_ORDER == LITTLE_ENDIAN +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 +#endif + +struct rr_result { /* router renumbering result message */ + u_int16_t rrr_flags; + u_int8_t rrr_ordinal; + u_int8_t rrr_matchedlen; + u_int32_t rrr_ifid; + struct in6_addr rrr_prefix; +} __attribute__((aligned(1), packed)); +#if BYTE_ORDER == BIG_ENDIAN +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 +#elif BYTE_ORDER == LITTLE_ENDIAN +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 +#endif + +/* + * icmp6 filter structures. + */ + +struct icmp6_filter { + u_int32_t icmp6_filt[8]; +}; + +#ifdef _KERNEL +#define ICMP6_FILTER_SETPASSALL(filterp) \ +do { \ + int i; u_char *p; \ + p = (u_char *)filterp; \ + for (i = 0; i < sizeof(struct icmp6_filter); i++) \ + p[i] = 0xff; \ +} while (0) +#define ICMP6_FILTER_SETBLOCKALL(filterp) \ + bzero(filterp, sizeof(struct icmp6_filter)) +#else /* _KERNEL */ +#define ICMP6_FILTER_SETPASSALL(filterp) \ + memset(filterp, 0xff, sizeof(struct icmp6_filter)) +#define ICMP6_FILTER_SETBLOCKALL(filterp) \ + memset(filterp, 0x00, sizeof(struct icmp6_filter)) +#endif /* _KERNEL */ + +#define ICMP6_FILTER_SETPASS(type, filterp) \ + (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))) +#define ICMP6_FILTER_SETBLOCK(type, filterp) \ + (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))) +#define ICMP6_FILTER_WILLPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) +#define ICMP6_FILTER_WILLBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) + +/* + * Variables related to this implementation + * of the internet control message protocol version 6. + */ +struct icmp6errstat { + u_quad_t icp6errs_dst_unreach_noroute; + u_quad_t icp6errs_dst_unreach_admin; + u_quad_t icp6errs_dst_unreach_beyondscope; + u_quad_t icp6errs_dst_unreach_addr; + u_quad_t icp6errs_dst_unreach_noport; + u_quad_t icp6errs_packet_too_big; + u_quad_t icp6errs_time_exceed_transit; + u_quad_t icp6errs_time_exceed_reassembly; + u_quad_t icp6errs_paramprob_header; + u_quad_t icp6errs_paramprob_nextheader; + u_quad_t icp6errs_paramprob_option; + u_quad_t icp6errs_redirect; /* we regard redirect as an error here */ + u_quad_t icp6errs_unknown; +}; + +struct icmp6stat { +/* statistics related to icmp6 packets generated */ + u_quad_t icp6s_error; /* # of calls to icmp6_error */ + u_quad_t icp6s_canterror; /* no error 'cuz old was icmp */ + u_quad_t icp6s_toofreq; /* no error 'cuz rate limitation */ + u_quad_t icp6s_outhist[256]; +/* statistics related to input message processed */ + u_quad_t icp6s_badcode; /* icmp6_code out of range */ + u_quad_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */ + u_quad_t icp6s_checksum; /* bad checksum */ + u_quad_t icp6s_badlen; /* calculated bound mismatch */ + /* + * number of responses: this member is inherited from netinet code, but + * for netinet6 code, it is already available in icp6s_outhist[]. + */ + u_quad_t icp6s_reflect; + u_quad_t icp6s_inhist[256]; + u_quad_t icp6s_nd_toomanyopt; /* too many ND options */ + struct icmp6errstat icp6s_outerrhist; +#define icp6s_odst_unreach_noroute \ + icp6s_outerrhist.icp6errs_dst_unreach_noroute +#define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin +#define icp6s_odst_unreach_beyondscope \ + icp6s_outerrhist.icp6errs_dst_unreach_beyondscope +#define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr +#define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport +#define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big +#define icp6s_otime_exceed_transit \ + icp6s_outerrhist.icp6errs_time_exceed_transit +#define icp6s_otime_exceed_reassembly \ + icp6s_outerrhist.icp6errs_time_exceed_reassembly +#define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header +#define icp6s_oparamprob_nextheader \ + icp6s_outerrhist.icp6errs_paramprob_nextheader +#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option +#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect +#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown + u_quad_t icp6s_pmtuchg; /* path MTU changes */ + u_quad_t icp6s_nd_badopt; /* bad ND options */ + u_quad_t icp6s_badns; /* bad neighbor solicitation */ + u_quad_t icp6s_badna; /* bad neighbor advertisement */ + u_quad_t icp6s_badrs; /* bad router advertisement */ + u_quad_t icp6s_badra; /* bad router advertisement */ + u_quad_t icp6s_badredirect; /* bad redirect message */ +}; + +/* + * Names for ICMP sysctl objects + */ +#define ICMPV6CTL_STATS 1 +#define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */ +#define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */ +#if 0 /*obsoleted*/ +#define ICMPV6CTL_ERRRATELIMIT 5 /* ICMPv6 error rate limitation */ +#endif +#define ICMPV6CTL_ND6_PRUNE 6 +#define ICMPV6CTL_ND6_DELAY 8 +#define ICMPV6CTL_ND6_UMAXTRIES 9 +#define ICMPV6CTL_ND6_MMAXTRIES 10 +#define ICMPV6CTL_ND6_USELOOPBACK 11 +/*#define ICMPV6CTL_ND6_PROXYALL 12 obsoleted, do not reuse here */ +#define ICMPV6CTL_NODEINFO 13 +#define ICMPV6CTL_ERRPPSLIMIT 14 /* ICMPv6 error pps limitation */ +#define ICMPV6CTL_ND6_MAXNUDHINT 15 +#define ICMPV6CTL_MTUDISC_HIWAT 16 +#define ICMPV6CTL_MTUDISC_LOWAT 17 +#define ICMPV6CTL_ND6_DEBUG 18 +#define ICMPV6CTL_ND6_DRLIST 19 +#define ICMPV6CTL_ND6_PRLIST 20 +#define ICMPV6CTL_MAXID 21 + +#define ICMPV6CTL_NAMES { \ + { 0, 0 }, \ + { 0, 0 }, \ + { "rediraccept", CTLTYPE_INT }, \ + { "redirtimeout", CTLTYPE_INT }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "nd6_prune", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "nd6_delay", CTLTYPE_INT }, \ + { "nd6_umaxtries", CTLTYPE_INT }, \ + { "nd6_mmaxtries", CTLTYPE_INT }, \ + { "nd6_useloopback", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "nodeinfo", CTLTYPE_INT }, \ + { "errppslimit", CTLTYPE_INT }, \ + { "nd6_maxnudhint", CTLTYPE_INT }, \ + { "mtudisc_hiwat", CTLTYPE_INT }, \ + { "mtudisc_lowat", CTLTYPE_INT }, \ + { "nd6_debug", CTLTYPE_INT }, \ + { 0, 0 }, \ + { 0, 0 }, \ +} + +#ifdef __bsdi__ +#define ICMPV6CTL_VARS { \ + 0, \ + 0, \ + &icmp6_rediraccept, \ + &icmp6_redirtimeout, \ + 0, \ + 0, \ + &nd6_prune, \ + 0, \ + &nd6_delay, \ + &nd6_umaxtries, \ + &nd6_mmaxtries, \ + &nd6_useloopback, \ + 0, \ + &icmp6_nodeinfo, \ + &icmp6errppslim, \ + &nd6_maxnudhint, \ + 0, \ + 0, \ + &nd6_debug, \ + 0, \ + 0, \ +} +#endif + +#define RTF_PROBEMTU RTF_PROTO1 + +#ifdef _KERNEL +# ifdef __STDC__ +struct rtentry; +struct rttimer; +struct in6_multi; +# endif +void icmp6_init __P((void)); +void icmp6_paramerror __P((struct mbuf *, int)); +void icmp6_error __P((struct mbuf *, int, int, int)); +int icmp6_input __P((struct mbuf **, int *, int)); +void icmp6_fasttimo __P((void)); +void icmp6_reflect __P((struct mbuf *, size_t)); +void icmp6_prepare __P((struct mbuf *)); +void icmp6_redirect_input __P((struct mbuf *, int)); +void icmp6_redirect_output __P((struct mbuf *, struct rtentry *)); +#ifdef __bsdi__ +int icmp6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); +void icmp6_mtuexpire __P((struct rtentry *, struct rttimer *)); +#endif /*__bsdi__*/ +#if defined(__NetBSD__) || defined(__OpenBSD__) +int icmp6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); +#endif + +struct ip6ctlparam; +void icmp6_mtudisc_update __P((struct ip6ctlparam *, int)); +#if defined(__NetBSD__) || defined(__OpenBSD__) +void icmp6_mtudisc_callback_register __P((void (*)(struct in6_addr *))); +#endif + +/* XXX: is this the right place for these macros? */ +#define icmp6_ifstat_inc(ifp, tag) \ +do { \ + if ((ifp) && (ifp)->if_index <= if_index \ + && (ifp)->if_index < icmp6_ifstatmax \ + && icmp6_ifstat && icmp6_ifstat[(ifp)->if_index]) { \ + icmp6_ifstat[(ifp)->if_index]->tag++; \ + } \ +} while (0) + +#define icmp6_ifoutstat_inc(ifp, type, code) \ +do { \ + icmp6_ifstat_inc(ifp, ifs6_out_msg); \ + switch(type) { \ + case ICMP6_DST_UNREACH: \ + icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \ + if (code == ICMP6_DST_UNREACH_ADMIN) \ + icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \ + break; \ + case ICMP6_PACKET_TOO_BIG: \ + icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \ + break; \ + case ICMP6_TIME_EXCEEDED: \ + icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \ + break; \ + case ICMP6_PARAM_PROB: \ + icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \ + break; \ + case ICMP6_ECHO_REQUEST: \ + icmp6_ifstat_inc(ifp, ifs6_out_echo); \ + break; \ + case ICMP6_ECHO_REPLY: \ + icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \ + break; \ + case MLD_LISTENER_QUERY: \ + icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \ + break; \ + case MLD_LISTENER_REPORT: \ + icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \ + break; \ + case MLD_LISTENER_DONE: \ + icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \ + break; \ + case ND_ROUTER_SOLICIT: \ + icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \ + break; \ + case ND_ROUTER_ADVERT: \ + icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \ + break; \ + case ND_NEIGHBOR_SOLICIT: \ + icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \ + break; \ + case ND_NEIGHBOR_ADVERT: \ + icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \ + break; \ + case ND_REDIRECT: \ + icmp6_ifstat_inc(ifp, ifs6_out_redirect); \ + break; \ + } \ +} while (0) + +extern int icmp6_rediraccept; /* accept/process redirects */ +extern int icmp6_redirtimeout; /* cache time for redirect routes */ +#endif /* _KERNEL */ + +#endif /* not _NETINET_ICMP6_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/icmp_var.h b/packages/net/bsd_tcpip/current/include/netinet/icmp_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/icmp_var.h @@ -0,0 +1,99 @@ +//========================================================================== +// +// include/netinet/icmp_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)icmp_var.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/icmp_var.h,v 1.15.2.1 2001/02/24 21:35:18 bmilekic Exp $ + */ + +#ifndef _NETINET_ICMP_VAR_H_ +#define _NETINET_ICMP_VAR_H_ + +/* + * Variables related to this implementation + * of the internet control message protocol. + */ +struct icmpstat { +/* statistics related to icmp packets generated */ + u_long icps_error; /* # of calls to icmp_error */ + u_long icps_oldshort; /* no error 'cuz old ip too short */ + u_long icps_oldicmp; /* no error 'cuz old was icmp */ + u_long icps_outhist[ICMP_MAXTYPE + 1]; +/* statistics related to input messages processed */ + u_long icps_badcode; /* icmp_code out of range */ + u_long icps_tooshort; /* packet < ICMP_MINLEN */ + u_long icps_checksum; /* bad checksum */ + u_long icps_badlen; /* calculated bound mismatch */ + u_long icps_reflect; /* number of responses */ + u_long icps_inhist[ICMP_MAXTYPE + 1]; + u_long icps_bmcastecho; /* b/mcast echo requests dropped */ + u_long icps_bmcasttstamp; /* b/mcast tstamp requests dropped */ +}; + +#ifdef _KERNEL +#ifdef ICMP_BANDLIM +extern int badport_bandlim __P((int)); +#endif +#define BANDLIM_UNLIMITED -1 +#define BANDLIM_ICMP_UNREACH 0 +#define BANDLIM_ICMP_ECHO 1 +#define BANDLIM_ICMP_TSTAMP 2 +#define BANDLIM_RST_CLOSEDPORT 3 /* No connection, and no listeners */ +#define BANDLIM_RST_OPENPORT 4 /* No connection, listener */ +#define BANDLIM_MAX 4 + +// Used by SNMP +struct icmpstat icmpstat; + +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/if_ether.h b/packages/net/bsd_tcpip/current/include/netinet/if_ether.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/if_ether.h @@ -0,0 +1,143 @@ +//========================================================================== +// +// include/netinet/if_ether.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 + * $FreeBSD: src/sys/netinet/if_ether.h,v 1.24 1999/12/29 04:40:58 peter Exp $ + */ + +#ifndef _NETINET_IF_ETHER_H_ +#define _NETINET_IF_ETHER_H_ + +#include +#include + +/* + * Macro to map an IP multicast address to an Ethernet multicast address. + * The high-order 25 bits of the Ethernet address are statically assigned, + * and the low-order 23 bits are taken from the low end of the IP address. + */ +#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ + /* struct in_addr *ipaddr; */ \ + /* u_char enaddr[ETHER_ADDR_LEN]; */ \ +{ \ + (enaddr)[0] = 0x01; \ + (enaddr)[1] = 0x00; \ + (enaddr)[2] = 0x5e; \ + (enaddr)[3] = ((u_char *)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((u_char *)ipaddr)[2]; \ + (enaddr)[5] = ((u_char *)ipaddr)[3]; \ +} +/* + * Macro to map an IP6 multicast address to an Ethernet multicast address. + * The high-order 16 bits of the Ethernet address are statically assigned, + * and the low-order 32 bits are taken from the low end of the IP6 address. + */ +#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) \ +/* struct in6_addr *ip6addr; */ \ +/* u_char enaddr[ETHER_ADDR_LEN]; */ \ +{ \ + (enaddr)[0] = 0x33; \ + (enaddr)[1] = 0x33; \ + (enaddr)[2] = ((u_char *)ip6addr)[12]; \ + (enaddr)[3] = ((u_char *)ip6addr)[13]; \ + (enaddr)[4] = ((u_char *)ip6addr)[14]; \ + (enaddr)[5] = ((u_char *)ip6addr)[15]; \ +} + +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct ether_arp { + struct arphdr ea_hdr; /* fixed-size header */ + u_char arp_sha[ETHER_ADDR_LEN]; /* sender hardware address */ + u_char arp_spa[4]; /* sender protocol address */ + u_char arp_tha[ETHER_ADDR_LEN]; /* target hardware address */ + u_char arp_tpa[4]; /* target protocol address */ +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +struct sockaddr_inarp { + u_char sin_len; + u_char sin_family; + u_short sin_port; + struct in_addr sin_addr; + struct in_addr sin_srcaddr; + u_short sin_tos; + u_short sin_other; +#define SIN_PROXY 1 +}; +/* + * IP and ethernet specific routing flags + */ +#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */ +#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */ + +#ifdef _KERNEL +extern u_char ether_ipmulticast_min[ETHER_ADDR_LEN]; +extern u_char ether_ipmulticast_max[ETHER_ADDR_LEN]; +extern struct ifqueue arpintrq; + +int arpresolve __P((struct arpcom *, struct rtentry *, struct mbuf *, + struct sockaddr *, u_char *, struct rtentry *)); +void arp_ifinit __P((struct arpcom *, struct ifaddr *)); +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/igmp.h b/packages/net/bsd_tcpip/current/include/netinet/igmp.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/igmp.h @@ -0,0 +1,117 @@ +//========================================================================== +// +// include/netinet/igmp.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)igmp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/igmp.h,v 1.10 1999/08/28 00:49:15 peter Exp $ + */ + +#ifndef _NETINET_IGMP_H_ +#define _NETINET_IGMP_H_ + +/* + * Internet Group Management Protocol (IGMP) definitions. + * + * Written by Steve Deering, Stanford, May 1988. + * + * MULTICAST Revision: 3.5.1.2 + */ + +/* + * IGMP packet format. + */ +struct igmp { + u_char igmp_type; /* version & type of IGMP message */ + u_char igmp_code; /* subtype for routing msgs */ + u_short igmp_cksum; /* IP-style checksum */ + struct in_addr igmp_group; /* group address being reported */ +}; /* (zero for queries) */ + +#define IGMP_MINLEN 8 + +/* + * Message types, including version number. + */ +#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ +#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ +#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ +#define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */ + +#define IGMP_DVMRP 0x13 /* DVMRP routing message */ +#define IGMP_PIM 0x14 /* PIM routing message */ + +#define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/ +#define IGMP_MTRACE 0x1f /* mcast traceroute messages */ + +#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ + /* query (in seconds) according */ + /* to RFC1112 */ + + +#define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */ + /* specifies time in 10th of seconds*/ + +/* + * The following four defininitions are for backwards compatibility. + * They should be removed as soon as all applications are updated to + * use the new constant names. + */ +#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY +#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT +#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP + +#endif /* _NETINET_IGMP_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/igmp_var.h b/packages/net/bsd_tcpip/current/include/netinet/igmp_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/igmp_var.h @@ -0,0 +1,117 @@ +//========================================================================== +// +// include/netinet/igmp_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * from: @(#)igmp_var.h 8.1 (Berkeley) 7/19/93 + * $FreeBSD: src/sys/netinet/igmp_var.h,v 1.17 1999/12/29 04:40:59 peter Exp $ + */ + +#ifndef _NETINET_IGMP_VAR_H_ +#define _NETINET_IGMP_VAR_H_ + +/* + * Internet Group Management Protocol (IGMP), + * implementation-specific definitions. + * + * Written by Steve Deering, Stanford, May 1988. + * + * MULTICAST Revision: 3.5.1.3 + */ + +struct igmpstat { + u_int igps_rcv_total; /* total IGMP messages received */ + u_int igps_rcv_tooshort; /* received with too few bytes */ + u_int igps_rcv_badsum; /* received with bad checksum */ + u_int igps_rcv_queries; /* received membership queries */ + u_int igps_rcv_badqueries; /* received invalid queries */ + u_int igps_rcv_reports; /* received membership reports */ + u_int igps_rcv_badreports; /* received invalid reports */ + u_int igps_rcv_ourreports; /* received reports for our groups */ + u_int igps_snd_reports; /* sent membership reports */ +}; + +#ifdef _KERNEL +#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1) + +/* + * States for IGMPv2's leave processing + */ +#define IGMP_OTHERMEMBER 0 +#define IGMP_IREPORTEDLAST 1 + +/* + * We must remember what version the subnet's querier is. + * We conveniently use the IGMP message type for the proper + * membership report to keep this state. + */ +#define IGMP_V1_ROUTER IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_V2_ROUTER IGMP_V2_MEMBERSHIP_REPORT + +/* + * Revert to new router if we haven't heard from an old router in + * this amount of time. + */ +#define IGMP_AGE_THRESHOLD 540 + +void igmp_init __P((void)); +void igmp_input __P((struct mbuf *, int)); +void igmp_joingroup __P((struct in_multi *)); +void igmp_leavegroup __P((struct in_multi *)); +void igmp_fasttimo __P((void)); +void igmp_slowtimo __P((void)); + +#endif +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/in.h b/packages/net/bsd_tcpip/current/include/netinet/in.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/in.h @@ -0,0 +1,512 @@ +//========================================================================== +// +// include/netinet/in.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in.h 8.3 (Berkeley) 1/3/94 + * $FreeBSD: src/sys/netinet/in.h,v 1.48.2.2 2001/04/21 14:53:06 ume Exp $ + */ + +#ifndef _NETINET_IN_H_ +#define _NETINET_IN_H_ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981, and numerous additions. + */ + +/* + * Protocols (RFC 1700) + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group mgmt protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_IPV4 4 /* IPv4 encapsulation */ +#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_ST 7 /* Stream protocol II */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PIGP 9 /* private interior gateway */ +#define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */ +#define IPPROTO_NVPII 11 /* network voice protocol*/ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_ARGUS 13 /* Argus */ +#define IPPROTO_EMCON 14 /* EMCON */ +#define IPPROTO_XNET 15 /* Cross Net Debugger */ +#define IPPROTO_CHAOS 16 /* Chaos*/ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_MUX 18 /* Multiplexing */ +#define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */ +#define IPPROTO_HMP 20 /* Host Monitoring */ +#define IPPROTO_PRM 21 /* Packet Radio Measurement */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_TRUNK1 23 /* Trunk-1 */ +#define IPPROTO_TRUNK2 24 /* Trunk-2 */ +#define IPPROTO_LEAF1 25 /* Leaf-1 */ +#define IPPROTO_LEAF2 26 /* Leaf-2 */ +#define IPPROTO_RDP 27 /* Reliable Data */ +#define IPPROTO_IRTP 28 /* Reliable Transaction */ +#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ +#define IPPROTO_BLT 30 /* Bulk Data Transfer */ +#define IPPROTO_NSP 31 /* Network Services */ +#define IPPROTO_INP 32 /* Merit Internodal */ +#define IPPROTO_SEP 33 /* Sequential Exchange */ +#define IPPROTO_3PC 34 /* Third Party Connect */ +#define IPPROTO_IDPR 35 /* InterDomain Policy Routing */ +#define IPPROTO_XTP 36 /* XTP */ +#define IPPROTO_DDP 37 /* Datagram Delivery */ +#define IPPROTO_CMTP 38 /* Control Message Transport */ +#define IPPROTO_TPXX 39 /* TP++ Transport */ +#define IPPROTO_IL 40 /* IL transport protocol */ +#define IPPROTO_IPV6 41 /* IP6 header */ +#define IPPROTO_SDRP 42 /* Source Demand Routing */ +#define IPPROTO_ROUTING 43 /* IP6 routing header */ +#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */ +#define IPPROTO_IDRP 45 /* InterDomain Routing*/ +#define IPPROTO_RSVP 46 /* resource reservation */ +#define IPPROTO_GRE 47 /* General Routing Encap. */ +#define IPPROTO_MHRP 48 /* Mobile Host Routing */ +#define IPPROTO_BHA 49 /* BHA */ +#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */ +#define IPPROTO_AH 51 /* IP6 Auth Header */ +#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */ +#define IPPROTO_SWIPE 53 /* IP with encryption */ +#define IPPROTO_NHRP 54 /* Next Hop Resolution */ +/* 55-57: Unassigned */ +#define IPPROTO_ICMPV6 58 /* ICMP6 */ +#define IPPROTO_NONE 59 /* IP6 no next header */ +#define IPPROTO_DSTOPTS 60 /* IP6 destination option */ +#define IPPROTO_AHIP 61 /* any host internal protocol */ +#define IPPROTO_CFTP 62 /* CFTP */ +#define IPPROTO_HELLO 63 /* "hello" routing protocol */ +#define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */ +#define IPPROTO_KRYPTOLAN 65 /* Kryptolan */ +#define IPPROTO_RVD 66 /* Remote Virtual Disk */ +#define IPPROTO_IPPC 67 /* Pluribus Packet Core */ +#define IPPROTO_ADFS 68 /* Any distributed FS */ +#define IPPROTO_SATMON 69 /* Satnet Monitoring */ +#define IPPROTO_VISA 70 /* VISA Protocol */ +#define IPPROTO_IPCV 71 /* Packet Core Utility */ +#define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */ +#define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */ +#define IPPROTO_WSN 74 /* Wang Span Network */ +#define IPPROTO_PVP 75 /* Packet Video Protocol */ +#define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */ +#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */ +#define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */ +#define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */ +#define IPPROTO_EON 80 /* ISO cnlp */ +#define IPPROTO_VMTP 81 /* VMTP */ +#define IPPROTO_SVMTP 82 /* Secure VMTP */ +#define IPPROTO_VINES 83 /* Banyon VINES */ +#define IPPROTO_TTP 84 /* TTP */ +#define IPPROTO_IGP 85 /* NSFNET-IGP */ +#define IPPROTO_DGP 86 /* dissimilar gateway prot. */ +#define IPPROTO_TCF 87 /* TCF */ +#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */ +#define IPPROTO_OSPFIGP 89 /* OSPFIGP */ +#define IPPROTO_SRPC 90 /* Strite RPC protocol */ +#define IPPROTO_LARP 91 /* Locus Address Resoloution */ +#define IPPROTO_MTP 92 /* Multicast Transport */ +#define IPPROTO_AX25 93 /* AX.25 Frames */ +#define IPPROTO_IPEIP 94 /* IP encapsulated in IP */ +#define IPPROTO_MICP 95 /* Mobile Int.ing control */ +#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */ +#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */ +#define IPPROTO_ENCAP 98 /* encapsulation header */ +#define IPPROTO_APES 99 /* any private encr. scheme */ +#define IPPROTO_GMTP 100 /* GMTP*/ +#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */ +#define IPPROTO_PIM 103 /* Protocol Independent Mcast */ +#define IPPROTO_PGM 113 /* PGM */ +#define IPPROTO_SCTP 132 /* SCTP (RFC2960) */ +/* 134-254: Partly Unassigned */ +/* 255: Reserved */ +/* BSD Private, local use, namespace incursion */ +#define IPPROTO_DIVERT 254 /* divert pseudo-protocol */ +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + +/* last return value of *_input(), meaning "all job for this pkt is done". */ +#define IPPROTO_DONE 257 + +/* + * Local port number conventions: + * + * When a user does a bind(2) or connect(2) with a port number of zero, + * a non-conflicting local port address is chosen. + * The default range is IPPORT_RESERVED through + * IPPORT_USERRESERVED, although that is settable by sysctl. + * + * A user may set the IPPROTO_IP option IP_PORTRANGE to change this + * default assignment range. + * + * The value IP_PORTRANGE_DEFAULT causes the default behavior. + * + * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers + * into the "high" range. These are reserved for client outbound connections + * which do not want to be filtered by any firewalls. + * + * The value IP_PORTRANGE_LOW changes the range to the "low" are + * that is (by convention) restricted to privileged processes. This + * convention is based on "vouchsafe" principles only. It is only secure + * if you trust the remote host to restrict these ports. + * + * The default range of ports and the high range can be changed by + * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto) + * + * Changing those values has bad security implications if you are + * using a a stateless firewall that is allowing packets outside of that + * range in order to allow transparent outgoing connections. + * + * Such a firewall configuration will generally depend on the use of these + * default values. If you change them, you may find your Security + * Administrator looking for you with a heavy object. + * + * For a slightly more orthodox text view on this: + * + * ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers + * + * port numbers are divided into three ranges: + * + * 0 - 1023 Well Known Ports + * 1024 - 49151 Registered Ports + * 49152 - 65535 Dynamic and/or Private Ports + * + */ + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). (IP_PORTRANGE_LOW) + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. (IP_PORTRANGE_DEFAULT) + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Default local port range to use by setting IP_PORTRANGE_HIGH + */ +#define IPPORT_HIFIRSTAUTO 49152 +#define IPPORT_HILASTAUTO 65535 + +/* + * Scanning for a free reserved port return a value below IPPORT_RESERVED, + * but higher than IPPORT_RESERVEDSTART. Traditionally the start value was + * 512, but that conflicts with some well-known-services that firewalls may + * have a fit if we use. + */ +#define IPPORT_RESERVEDSTART 600 + +/* + * Internet address (a structure for historical reasons) + */ +struct in_addr { + in_addr_t s_addr; +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((u_int32_t)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((u_int32_t)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((u_int32_t)(i) & 0xf0000000) == 0xe0000000) +#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ +#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ +#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) +#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY (u_int32_t)0x00000000 +#define INADDR_LOOPBACK (u_int32_t)0x7f000001 +#define INADDR_BROADCAST (u_int32_t)0xffffffff /* must be masked */ +#define INADDR_NONE 0xffffffff /* -1 return */ + +#define INADDR_UNSPEC_GROUP (u_int32_t)0xe0000000 /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP (u_int32_t)0xe0000001 /* 224.0.0.1 */ +#define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002 /* 224.0.0.2 */ +#define INADDR_MAX_LOCAL_GROUP (u_int32_t)0xe00000ff /* 224.0.0.255 */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + u_char sin_len; + u_char sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +#define INET_ADDRSTRLEN 16 + +/* + * Structure used to describe IP options. + * Used to store options internally, to pass them to a process, + * or to restore options retrieved earlier. + * The ip_dst is used for the first-hop gateway when using a source route + * (this gets put into the header proper). + */ +struct ip_opts { + struct in_addr ip_dst; /* first hop, 0 w/o src rt */ + char ip_opts[40]; /* actually variable in size */ +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + * First word of comment is data type; bool is stored in int. + */ +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ +#define IP_HDRINCL 2 /* int; header is included with data */ +#define IP_TOS 3 /* int; IP type of service and preced. */ +#define IP_TTL 4 /* int; IP time to live */ +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ +#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */ +#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ +#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ +#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ +#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */ +#define IP_RSVP_ON 15 /* enable RSVP in kernel */ +#define IP_RSVP_OFF 16 /* disable RSVP in kernel */ +#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */ +#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */ +#define IP_PORTRANGE 19 /* int; range to choose for unspec port */ +#define IP_RECVIF 20 /* bool; receive reception if w/dgram */ +/* for IPSEC */ +#define IP_IPSEC_POLICY 21 /* int; set/get security policy */ +#define IP_FAITH 22 /* bool; accept FAITH'ed connections */ + +#define IP_FW_ADD 50 /* add a firewall rule to chain */ +#define IP_FW_DEL 51 /* delete a firewall rule from chain */ +#define IP_FW_FLUSH 52 /* flush firewall rule chain */ +#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */ +#define IP_FW_GET 54 /* get entire firewall rule chain */ +#define IP_FW_RESETLOG 55 /* reset logging counters */ + +#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */ +#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */ +#define IP_DUMMYNET_FLUSH 62 /* flush dummynet */ +#define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */ + +/* + * Defaults and limits for options + */ +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ +#define IP_MAX_MEMBERSHIPS 20 /* per socket */ + +/* + * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. + */ +struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + +/* + * Argument for IP_PORTRANGE: + * - which range to search when port is unspecified at bind() or connect() + */ +#define IP_PORTRANGE_DEFAULT 0 /* default range */ +#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ +#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ + +/* + * Definitions for inet sysctl operations. + * + * Third level is protocol number. + * Fourth level is desired variable within that protocol. + */ +#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */ + +#define CTL_IPPROTO_NAMES { \ + { "ip", CTLTYPE_NODE }, \ + { "icmp", CTLTYPE_NODE }, \ + { "igmp", CTLTYPE_NODE }, \ + { "ggp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "tcp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { "egp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "pup", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "udp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "idp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "ipsec", CTLTYPE_NODE }, \ +} + +/* + * Names for IP sysctl objects + */ +#define IPCTL_FORWARDING 1 /* act as router */ +#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ +#define IPCTL_DEFTTL 3 /* default TTL */ +#ifdef notyet +#define IPCTL_DEFMTU 4 /* default MTU */ +#endif +#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */ +#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */ +#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */ +#define IPCTL_SOURCEROUTE 8 /* may perform source routes */ +#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */ +#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */ +#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */ +#define IPCTL_STATS 12 /* ipstat structure */ +#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */ +#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */ +#define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */ +#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */ +#define IPCTL_MAXID 17 + +#define IPCTL_NAMES { \ + { 0, 0 }, \ + { "forwarding", CTLTYPE_INT }, \ + { "redirect", CTLTYPE_INT }, \ + { "ttl", CTLTYPE_INT }, \ + { "mtu", CTLTYPE_INT }, \ + { "rtexpire", CTLTYPE_INT }, \ + { "rtminexpire", CTLTYPE_INT }, \ + { "rtmaxcache", CTLTYPE_INT }, \ + { "sourceroute", CTLTYPE_INT }, \ + { "directed-broadcast", CTLTYPE_INT }, \ + { "intr-queue-maxlen", CTLTYPE_INT }, \ + { "intr-queue-drops", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "accept_sourceroute", CTLTYPE_INT }, \ + { "fastforwarding", CTLTYPE_INT }, \ +} + +#ifdef _KERNEL +struct ifnet; struct mbuf; /* forward declarations for Standard C */ +#endif + +/* INET6 stuff */ +#define __KAME_NETINET_IN_H_INCLUDED_ +#include +#undef __KAME_NETINET_IN_H_INCLUDED_ + +#ifdef _KERNEL + +int in_broadcast __P((struct in_addr, struct ifnet *)); +int in_canforward __P((struct in_addr)); +int in_cksum __P((struct mbuf *, int)); +int in_localaddr __P((struct in_addr)); +char *inet_ntoa __P((struct in_addr)); + +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/in_pcb.h b/packages/net/bsd_tcpip/current/include/netinet/in_pcb.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/in_pcb.h @@ -0,0 +1,343 @@ +//========================================================================== +// +// include/netinet/in_pcb.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/in_pcb.h,v 1.32.2.4 2001/08/13 16:26:17 ume Exp $ + */ + +#ifndef _NETINET_IN_PCB_H_ +#define _NETINET_IN_PCB_H_ + +#include + +//#include /* for IPSEC */ + +#define in6pcb inpcb /* for KAME src sync over BSD*'s */ +#define in6p_sp inp_sp /* for KAME src sync over BSD*'s */ + +/* + * Common structure pcb for internet protocol implementation. + * Here are stored pointers to local and foreign host table + * entries, local and foreign socket numbers, and pointers + * up (to a socket structure) and down (to a protocol-specific) + * control block. + */ +LIST_HEAD(inpcbhead, inpcb); +LIST_HEAD(inpcbporthead, inpcbport); +typedef u_quad_t inp_gen_t; + +/* + * PCB with AF_INET6 null bind'ed laddr can receive AF_INET input packet. + * So, AF_INET6 null laddr is also used as AF_INET null laddr, + * by utilize following structure. (At last, same as INRIA) + */ +struct in_addr_4in6 { + u_int32_t ia46_pad32[3]; + struct in_addr ia46_addr4; +}; + +/* + * NB: the zone allocator is type-stable EXCEPT FOR THE FIRST TWO LONGS + * of the structure. Therefore, it is important that the members in + * that position not contain any information which is required to be + * stable. + */ +struct icmp6_filter; + +struct inpcb { + LIST_ENTRY(inpcb) inp_hash; /* hash list */ + u_short inp_fport; /* foreign port */ + u_short inp_lport; /* local port */ + LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */ + u_int32_t inp_flow; + + /* protocol dependent part, local and foreign addr */ + union { + /* foreign host table entry */ + struct in_addr_4in6 inp46_foreign; + struct in6_addr inp6_foreign; + } inp_dependfaddr; + union { + /* local host table entry */ + struct in_addr_4in6 inp46_local; + struct in6_addr inp6_local; + } inp_dependladdr; + + caddr_t inp_ppcb; /* pointer to per-protocol pcb */ + struct inpcbinfo *inp_pcbinfo; /* PCB list info */ + struct socket *inp_socket; /* back pointer to socket */ + /* list for this PCB's local port */ + int inp_flags; /* generic IP/datagram flags */ + + /* protocol dependent part; cached route */ + union { + /* placeholder for routing entry */ + struct route inp4_route; + struct route inp6_route; + } inp_dependroute; + + struct inpcbpolicy *inp_sp; /* for IPSEC */ + u_char inp_vflag; +#define INP_IPV4 0x1 +#define INP_IPV6 0x2 + u_char inp_ip_ttl; /* time to live proto */ + u_char inp_ip_p; /* protocol proto */ + + /* protocol dependent part; options */ + struct { + u_char inp4_ip_tos; /* type of service proto */ + struct mbuf *inp4_options; /* IP options */ + struct ip_moptions *inp4_moptions; /* IP multicast options */ + } inp_depend4; +#define inp_faddr inp_dependfaddr.inp46_foreign.ia46_addr4 +#define inp_laddr inp_dependladdr.inp46_local.ia46_addr4 +#define inp_route inp_dependroute.inp4_route +#define inp_ip_tos inp_depend4.inp4_ip_tos +#define inp_options inp_depend4.inp4_options +#define inp_moptions inp_depend4.inp4_moptions + struct { + /* IP options */ + struct mbuf *inp6_options; + /* IP6 options for incoming packets */ + struct ip6_recvpktopts *inp6_inputopts; + /* IP6 options for outgoing packets */ + struct ip6_pktopts *inp6_outputopts; + /* IP multicast options */ + struct ip6_moptions *inp6_moptions; + /* ICMPv6 code type filter */ + struct icmp6_filter *inp6_icmp6filt; + /* IPV6_CHECKSUM setsockopt */ + int inp6_cksum; + u_short inp6_ifindex; + short inp6_hops; + } inp_depend6; + LIST_ENTRY(inpcb) inp_portlist; + struct inpcbport *inp_phd; /* head of this list */ + inp_gen_t inp_gencnt; /* generation count of this instance */ +#define in6p_faddr inp_dependfaddr.inp6_foreign +#define in6p_laddr inp_dependladdr.inp6_local +#define in6p_route inp_dependroute.inp6_route +#define in6p_hops inp_depend6.inp6_hops /* default hop limit */ +#define in6p_ip6_nxt inp_ip_p +#define in6p_flowinfo inp_flow +#define in6p_vflag inp_vflag +#define in6p_options inp_depend6.inp6_options +#define in6p_inputopts inp_depend6.inp6_inputopts +#define in6p_outputopts inp_depend6.inp6_outputopts +#define in6p_moptions inp_depend6.inp6_moptions +#define in6p_icmp6filt inp_depend6.inp6_icmp6filt +#define in6p_cksum inp_depend6.inp6_cksum +#define inp6_ifindex inp_depend6.inp6_ifindex +#define in6p_flags inp_flags /* for KAME src sync over BSD*'s */ +#define in6p_socket inp_socket /* for KAME src sync over BSD*'s */ +#define in6p_lport inp_lport /* for KAME src sync over BSD*'s */ +#define in6p_fport inp_fport /* for KAME src sync over BSD*'s */ +#define in6p_ppcb inp_ppcb /* for KAME src sync over BSD*'s */ +}; +/* + * The range of the generation count, as used in this implementation, + * is 9e19. We would have to create 300 billion connections per + * second for this number to roll over in a year. This seems sufficiently + * unlikely that we simply don't concern ourselves with that possibility. + */ + +/* + * Interface exported to userland by various protocols which use + * inpcbs. Hack alert -- only define if struct xsocket is in scope. + */ +#ifdef _SYS_SOCKETVAR_H_ +struct xinpcb { + size_t xi_len; /* length of this structure */ + struct inpcb xi_inp; + struct xsocket xi_socket; + u_quad_t xi_alignment_hack; +}; + +struct xinpgen { + size_t xig_len; /* length of this structure */ + u_int xig_count; /* number of PCBs at this time */ + inp_gen_t xig_gen; /* generation count at this time */ + so_gen_t xig_sogen; /* socket generation count at this time */ +}; +#endif /* _SYS_SOCKETVAR_H_ */ + +struct inpcbport { + LIST_ENTRY(inpcbport) phd_hash; + struct inpcbhead phd_pcblist; + u_short phd_port; +}; + +struct inpcbinfo { /* XXX documentation, prefixes */ + struct inpcbhead *hashbase; + u_long hashmask; + struct inpcbporthead *porthashbase; + u_long porthashmask; + struct inpcbhead *listhead; + u_short lastport; + u_short lastlow; + u_short lasthi; + struct vm_zone *ipi_zone; /* zone to allocate pcbs from */ + u_int ipi_count; /* number of pcbs in this list */ + u_quad_t ipi_gencnt; /* current generation count */ +}; + +#define INP_PCBHASH(faddr, lport, fport, mask) \ + (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) +#define INP_PCBPORTHASH(lport, mask) \ + (ntohs((lport)) & (mask)) + +/* flags in inp_flags: */ +#define INP_RECVOPTS 0x01 /* receive incoming IP options */ +#define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ +#define INP_RECVDSTADDR 0x04 /* receive IP dst address */ +#define INP_HDRINCL 0x08 /* user supplies entire IP header */ +#define INP_HIGHPORT 0x10 /* user wants "high" port binding */ +#define INP_LOWPORT 0x20 /* user wants "low" port binding */ +#define INP_ANONPORT 0x40 /* port chosen for user */ +#define INP_RECVIF 0x80 /* receive incoming interface */ +#define INP_MTUDISC 0x100 /* user can do MTU discovery */ +#define INP_FAITH 0x200 /* accept FAITH'ed connections */ + +#define IN6P_IPV6_V6ONLY 0x008000 /* restrict AF_INET6 socket for v6 */ + +#define IN6P_PKTINFO 0x010000 /* receive IP6 dst and I/F */ +#define IN6P_HOPLIMIT 0x020000 /* receive hoplimit */ +#define IN6P_HOPOPTS 0x040000 /* receive hop-by-hop options */ +#define IN6P_DSTOPTS 0x080000 /* receive dst options after rthdr */ +#define IN6P_RTHDR 0x100000 /* receive routing header */ +#define IN6P_RTHDRDSTOPTS 0x200000 /* receive dstoptions before rthdr */ +#define IN6P_TCLASS 0x400000 /* receive traffic class value */ +#define IN6P_AUTOFLOWLABEL 0x800000 /* attach flowlabel automatically */ +#if 0 +/* + * IN6P_BINDV6ONLY should be obsoleted by IN6P_IPV6_V6ONLY. + * Once we are sure that this macro is not referred from anywhere, we should + * completely delete the definition. + * jinmei@kame.net, 20010625. + */ +#define IN6P_BINDV6ONLY 0x10000000 /* do not grab IPv4 traffic */ +#endif +#define IN6P_MINMTU 0x20000000 /* use minimum MTU */ +#define IN6P_RFC2292 0x40000000 /* used RFC2292 API on the socket */ +#define IN6P_MTU 0x80000000 /* receive path MTU */ + +#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ + INP_RECVIF|\ + IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\ + IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\ + IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\ + IN6P_MTU) +#define INP_UNMAPPABLEOPTS (IN6P_HOPOPTS|IN6P_DSTOPTS|IN6P_RTHDR|\ + IN6P_TCLASS|IN6P_AUTOFLOWLABEL) + + /* for KAME src sync over BSD*'s */ +#define IN6P_HIGHPORT INP_HIGHPORT +#define IN6P_LOWPORT INP_LOWPORT +#define IN6P_ANONPORT INP_ANONPORT +#define IN6P_RECVIF INP_RECVIF +#define IN6P_MTUDISC INP_MTUDISC +#define IN6P_FAITH INP_FAITH +#define IN6P_CONTROLOPTS INP_CONTROLOPTS + /* + * socket AF version is {newer than,or include} + * actual datagram AF version + */ + +#define INPLOOKUP_WILDCARD 1 +#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) +#define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */ + +#define INP_SOCKAF(so) so->so_proto->pr_domain->dom_family + +#define INP_CHECK_SOCKAF(so, af) (INP_SOCKAF(so) == af) + +#ifdef _KERNEL +extern int ipport_lowfirstauto; +extern int ipport_lowlastauto; +extern int ipport_firstauto; +extern int ipport_lastauto; +extern int ipport_hifirstauto; +extern int ipport_hilastauto; + +void in_pcbpurgeif0 __P((struct inpcb *, struct ifnet *)); +void in_losing __P((struct inpcb *)); +void in_rtchange __P((struct inpcb *, int)); +int in_pcballoc __P((struct socket *, struct inpcbinfo *, struct proc *)); +int in_pcbbind __P((struct inpcb *, struct sockaddr *, struct proc *)); +int in_pcbconnect __P((struct inpcb *, struct sockaddr *, struct proc *)); +void in_pcbdetach __P((struct inpcb *)); +void in_pcbdisconnect __P((struct inpcb *)); +int in_pcbinshash __P((struct inpcb *)); +int in_pcbladdr __P((struct inpcb *, struct sockaddr *, + struct sockaddr_in **)); +struct inpcb * + in_pcblookup_local __P((struct inpcbinfo *, + struct in_addr, u_int, int)); +struct inpcb * + in_pcblookup_hash __P((struct inpcbinfo *, + struct in_addr, u_int, struct in_addr, u_int, + int, struct ifnet *)); +void in_pcbnotifyall __P((struct inpcbhead *, struct in_addr, + int, void (*)(struct inpcb *, int))); +void in_pcbrehash __P((struct inpcb *)); +int in_setpeeraddr __P((struct socket *so, struct sockaddr **nam)); +int in_setsockaddr __P((struct socket *so, struct sockaddr **nam)); +void in_pcbremlists __P((struct inpcb *inp)); +int prison_xinpcb __P((struct proc *p, struct inpcb *inp)); + +int in6_selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, + struct ip6_moptions *, struct route *, + struct ifnet **, struct rtentry **, int)); +#endif /* _KERNEL */ + +#endif /* !_NETINET_IN_PCB_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/in_systm.h b/packages/net/bsd_tcpip/current/include/netinet/in_systm.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/in_systm.h @@ -0,0 +1,84 @@ +//========================================================================== +// +// include/netinet/in_systm.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_systm.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/in_systm.h,v 1.9 1999/12/29 04:41:00 peter Exp $ + */ + +#ifndef _NETINET_IN_SYSTM_H_ +#define _NETINET_IN_SYSTM_H_ + +/* + * Miscellaneous internetwork + * definitions for kernel. + */ + +/* + * Network types. + * + * Internally the system keeps counters in the headers with the bytes + * swapped so that VAX instructions will work on them. It reverses + * the bytes before transmission at each protocol level. The n_ types + * represent the types with the bytes in ``high-ender'' order. + */ +#include +typedef uint16_t n_short; /* short as received from the net */ +typedef uint32_t n_long; /* long as received from the net */ + +typedef uint32_t n_time; /* ms since 00:00 GMT, byte rev */ + +#ifdef _KERNEL +n_time iptime __P((void)); +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/in_var.h b/packages/net/bsd_tcpip/current/include/netinet/in_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/in_var.h @@ -0,0 +1,244 @@ +//========================================================================== +// +// include/netinet/in_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1985, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_var.h 8.2 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/netinet/in_var.h,v 1.33.2.2 2001/07/17 10:50:01 ru Exp $ + */ + +#ifndef _NETINET_IN_VAR_H_ +#define _NETINET_IN_VAR_H_ + +#include + +/* + * Interface address, Internet version. One of these structures + * is allocated for each Internet address on an interface. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ +struct in_ifaddr { + struct ifaddr ia_ifa; /* protocol-independent info */ +#define ia_ifp ia_ifa.ifa_ifp +#define ia_flags ia_ifa.ifa_flags + /* ia_{,sub}net{,mask} in host order */ + u_long ia_net; /* network number of interface */ + u_long ia_netmask; /* mask of net part */ + u_long ia_subnet; /* subnet number, including net */ + u_long ia_subnetmask; /* mask of subnet part */ + struct in_addr ia_netbroadcast; /* to recognize net broadcasts */ + TAILQ_ENTRY(in_ifaddr) ia_link; /* tailq macro glue */ + struct sockaddr_in ia_addr; /* reserve space for interface name */ + struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ +#define ia_broadaddr ia_dstaddr + struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ +}; + +struct in_aliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr_in ifra_addr; + struct sockaddr_in ifra_broadaddr; +#define ifra_dstaddr ifra_broadaddr + struct sockaddr_in ifra_mask; +}; +/* + * Given a pointer to an in_ifaddr (ifaddr), + * return a pointer to the addr as a sockaddr_in. + */ +#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) +#define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr)) + +#define IN_LNAOF(in, ifa) \ + ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask)) + + +#ifdef _KERNEL +extern TAILQ_HEAD(in_ifaddrhead, in_ifaddr) in_ifaddrhead; +extern struct ifqueue ipintrq; /* ip packet input queue */ +extern struct in_addr zeroin_addr; +extern int /*u_char*/ inetctlerrmap[]; + +/* + * Macro for finding the interface (ifnet structure) corresponding to one + * of our IP addresses. + */ +#define INADDR_TO_IFP(addr, ifp) \ + /* struct in_addr addr; */ \ + /* struct ifnet *ifp; */ \ +{ \ + struct in_ifaddr *ia; \ +\ + TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) \ + if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \ + break; \ + (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \ +} + +/* + * Macro for finding the internet address structure (in_ifaddr) corresponding + * to a given interface (ifnet structure). + */ +#define IFP_TO_IA(ifp, ia) \ + /* struct ifnet *ifp; */ \ + /* struct in_ifaddr *ia; */ \ +{ \ + for ((ia) = TAILQ_FIRST(&in_ifaddrhead); \ + (ia) != NULL && (ia)->ia_ifp != (ifp); \ + (ia) = TAILQ_NEXT((ia), ia_link)) \ + continue; \ +} +#endif + +/* + * This information should be part of the ifnet structure but we don't wish + * to change that - as it might break a number of things + */ + +struct router_info { + struct ifnet *rti_ifp; + int rti_type; /* type of router which is querier on this interface */ + int rti_time; /* # of slow timeouts since last old query */ + struct router_info *rti_next; +}; + +/* + * Internet multicast address structure. There is one of these for each IP + * multicast group to which this host belongs on a given network interface. + * For every entry on the interface's if_multiaddrs list which represents + * an IP multicast group, there is one of these structures. They are also + * kept on a system-wide list to make it easier to keep our legacy IGMP code + * compatible with the rest of the world (see IN_FIRST_MULTI et al, below). + */ +struct in_multi { + LIST_ENTRY(in_multi) inm_link; /* queue macro glue */ + struct in_addr inm_addr; /* IP multicast address, convenience */ + struct ifnet *inm_ifp; /* back pointer to ifnet */ + struct ifmultiaddr *inm_ifma; /* back pointer to ifmultiaddr */ + u_int inm_timer; /* IGMP membership report timer */ + u_int inm_state; /* state of the membership */ + struct router_info *inm_rti; /* router info*/ +}; + +#ifdef _KERNEL + +extern LIST_HEAD(in_multihead, in_multi) in_multihead; + +/* + * Structure used by macros below to remember position when stepping through + * all of the in_multi records. + */ +struct in_multistep { + struct in_multi *i_inm; +}; + +/* + * Macro for looking up the in_multi record for a given IP multicast address + * on a given interface. If no matching record is found, "inm" is set null. + */ +#define IN_LOOKUP_MULTI(addr, ifp, inm) \ + /* struct in_addr addr; */ \ + /* struct ifnet *ifp; */ \ + /* struct in_multi *inm; */ \ +do { \ + struct ifmultiaddr *ifma; \ +\ + LIST_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { \ + if (ifma->ifma_addr->sa_family == AF_INET \ + && ((struct sockaddr_in *)ifma->ifma_addr)->sin_addr.s_addr == \ + (addr).s_addr) \ + break; \ + } \ + (inm) = ifma ? ifma->ifma_protospec : 0; \ +} while(0) + +/* + * Macro to step through all of the in_multi records, one at a time. + * The current position is remembered in "step", which the caller must + * provide. IN_FIRST_MULTI(), below, must be called to initialize "step" + * and get the first record. Both macros return a NULL "inm" when there + * are no remaining records. + */ +#define IN_NEXT_MULTI(step, inm) \ + /* struct in_multistep step; */ \ + /* struct in_multi *inm; */ \ +do { \ + if (((inm) = (step).i_inm) != NULL) \ + (step).i_inm = LIST_NEXT((step).i_inm, inm_link); \ +} while(0) + +#define IN_FIRST_MULTI(step, inm) \ + /* struct in_multistep step; */ \ + /* struct in_multi *inm; */ \ +do { \ + (step).i_inm = LIST_FIRST(&in_multihead); \ + IN_NEXT_MULTI((step), (inm)); \ +} while(0) + +struct route; +struct in_multi *in_addmulti __P((struct in_addr *, struct ifnet *)); +void in_delmulti __P((struct in_multi *)); +int in_control __P((struct socket *, u_long, caddr_t, struct ifnet *, + struct proc *)); +void in_rtqdrain __P((void)); +void ip_input __P((struct mbuf *)); +int in_ifadown __P((struct ifaddr *ifa, int)); +void in_ifscrub __P((struct ifnet *, struct in_ifaddr *)); +int ipflow_fastforward __P((struct mbuf *)); +void ipflow_create __P((const struct route *, struct mbuf *)); +void ipflow_slowtimo __P((void)); + +#endif /* _KERNEL */ + +/* INET6 stuff */ +#include + +#endif /* _NETINET_IN_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/ip.h b/packages/net/bsd_tcpip/current/include/netinet/ip.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/ip.h @@ -0,0 +1,211 @@ +//========================================================================== +// +// include/netinet/ip.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip.h 8.2 (Berkeley) 6/1/94 + * $FreeBSD: src/sys/netinet/ip.h,v 1.17 1999/12/22 19:13:20 shin Exp $ + */ + +#ifndef _NETINET_IP_H_ +#define _NETINET_IP_H_ + +#include + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ +#define IPVERSION 4 + +/* + * Structure of an internet header, naked of options. + */ +struct ip { +#ifdef _IP_VHL + u_char ip_vhl; /* version << 4 | header length >> 2 */ +#else +#if BYTE_ORDER == LITTLE_ENDIAN + u_int ip_hl:4, /* header length */ + ip_v:4; /* version */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_int ip_v:4, /* version */ + ip_hl:4; /* header length */ +#endif +#endif /* not _IP_VHL */ + u_char ip_tos; /* type of service */ + u_short ip_len; /* total length */ + u_short ip_id; /* identification */ + u_short ip_off; /* fragment offset field */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +} __attribute__ ((aligned(1), packed)); + +#ifdef _IP_VHL +#define IP_MAKE_VHL(v, hl) ((v) << 4 | (hl)) +#define IP_VHL_HL(vhl) ((vhl) & 0x0f) +#define IP_VHL_V(vhl) ((vhl) >> 4) +#define IP_VHL_BORING 0x45 +#endif + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for IP type of service (ip_tos) + */ +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_MINCOST 0x02 +/* ECN bits proposed by Sally Floyd */ +#define IPTOS_CE 0x01 /* congestion experienced */ +#define IPTOS_ECT 0x02 /* ECN-capable transport */ + + +/* + * Definitions for IP precedence (also in ip_tos) (hopefully unused) + */ +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + +/* + * Definitions for options. + */ +#define IPOPT_COPIED(o) ((o)&0x80) +#define IPOPT_CLASS(o) ((o)&0x60) +#define IPOPT_NUMBER(o) ((o)&0x1f) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ +#define IPOPT_RA 148 /* router alert */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + +/* + * Time stamp option structure. + */ +struct ip_timestamp { + u_char ipt_code; /* IPOPT_TS */ + u_char ipt_len; /* size of structure (variable) */ + u_char ipt_ptr; /* index of current entry */ +#if BYTE_ORDER == LITTLE_ENDIAN + u_int ipt_flg:4, /* flags, see below */ + ipt_oflw:4; /* overflow counter */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_int ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ +#endif + union ipt_timestamp { + n_long ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + n_long ipt_time; + } ipt_ta[1]; + } ipt_timestamp; +} __attribute__ ((aligned(1), packed)); + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 3 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPDEFTTL 64 /* default ttl, from RFC 1340 */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/ip6.h b/packages/net/bsd_tcpip/current/include/netinet/ip6.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/ip6.h @@ -0,0 +1,437 @@ +//========================================================================== +// +// include/netinet/ip6.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip6.h,v 1.25 2001/11/29 04:38:37 keiichi Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_IP6_H_ +#define _NETINET_IP6_H_ + +/* + * Definition for internet protocol version 6. + * RFC 2460 + */ + +struct ip6_hdr { + union { + struct ip6_hdrctl { + u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ + u_int16_t ip6_un1_plen; /* payload length */ + u_int8_t ip6_un1_nxt; /* next header */ + u_int8_t ip6_un1_hlim; /* hop limit */ + } ip6_un1; + u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ + } ip6_ctlun; + struct in6_addr ip6_src; /* source address */ + struct in6_addr ip6_dst; /* destination address */ +} __attribute__ ((aligned(1), packed)); + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +#define IPV6_VERSION 0x60 +#define IPV6_VERSION_MASK 0xf0 + +#if BYTE_ORDER == BIG_ENDIAN +#define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */ +#define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */ +#else +#if BYTE_ORDER == LITTLE_ENDIAN +#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */ +#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */ +#endif /* LITTLE_ENDIAN */ +#endif +#if 1 +/* ECN bits proposed by Sally Floyd */ +#define IP6TOS_CE 0x01 /* congestion experienced */ +#define IP6TOS_ECT 0x02 /* ECN-capable transport */ +#endif + +/* + * Extension Headers + */ + +struct ip6_ext { + u_int8_t ip6e_nxt; + u_int8_t ip6e_len; +} __attribute__ ((aligned(1), packed)); + +/* Hop-by-Hop options header */ +/* XXX should we pad it to force alignment on an 8-byte boundary? */ +struct ip6_hbh { + u_int8_t ip6h_nxt; /* next header */ + u_int8_t ip6h_len; /* length in units of 8 octets */ + /* followed by options */ +} __attribute__ ((aligned(1), packed)); + +/* Destination options header */ +/* XXX should we pad it to force alignment on an 8-byte boundary? */ +struct ip6_dest { + u_int8_t ip6d_nxt; /* next header */ + u_int8_t ip6d_len; /* length in units of 8 octets */ + /* followed by options */ +} __attribute__ ((aligned(1), packed)); + +/* Option types and related macros */ +#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ +#define IP6OPT_PADN 0x01 /* 00 0 00001 */ +#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ +#define IP6OPT_NSAP_ADDR 0xC3 /* 11 0 00011 */ +#define IP6OPT_TUNNEL_LIMIT 0x04 /* 00 0 00100 */ +#define IP6OPT_RTALERT 0x05 /* 00 0 00101 (KAME definition) */ +#define IP6OPT_ROUTER_ALERT 0x05 /* (2292bis def, recommended) */ + +#define IP6OPT_RTALERT_LEN 4 +#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ +#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ +#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ +#define IP6OPT_MINLEN 2 + +#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ +#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ +#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ +#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ +#define IP6OPT_EID 0x8a /* 10 0 01010 */ + +#define IP6OPT_TYPE(o) ((o) & 0xC0) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xC0 + +#define IP6OPT_MUTABLE 0x20 + +/* IPv6 options: common part */ +struct ip6_opt { + u_int8_t ip6o_type; + u_int8_t ip6o_len; +} __attribute__ ((aligned(1), packed)); + +/* Jumbo Payload Option */ +struct ip6_opt_jumbo { + u_int8_t ip6oj_type; + u_int8_t ip6oj_len; + u_int8_t ip6oj_jumbo_len[4]; +} __attribute__ ((aligned(1), packed)); +#define IP6OPT_JUMBO_LEN 6 + +/* NSAP Address Option */ +struct ip6_opt_nsap { + u_int8_t ip6on_type; + u_int8_t ip6on_len; + u_int8_t ip6on_src_nsap_len; + u_int8_t ip6on_dst_nsap_len; + /* followed by source NSAP */ + /* followed by destination NSAP */ +} __attribute__ ((aligned(1), packed)); + +/* Tunnel Limit Option */ +struct ip6_opt_tunnel { + u_int8_t ip6ot_type; + u_int8_t ip6ot_len; + u_int8_t ip6ot_encap_limit; +} __attribute__ ((aligned(1), packed)); + +/* Router Alert Option */ +struct ip6_opt_router { + u_int8_t ip6or_type; + u_int8_t ip6or_len; + u_int8_t ip6or_value[2]; +} __attribute__ ((aligned(1), packed)); +/* Router alert values (in network byte order) */ +#if BYTE_ORDER == BIG_ENDIAN +#define IP6_ALERT_MLD 0x0000 +#define IP6_ALERT_RSVP 0x0001 +#define IP6_ALERT_AN 0x0002 +#else +#if BYTE_ORDER == LITTLE_ENDIAN +#define IP6_ALERT_MLD 0x0000 +#define IP6_ALERT_RSVP 0x0100 +#define IP6_ALERT_AN 0x0200 +#endif /* LITTLE_ENDIAN */ +#endif + +/* Binding Update Option */ +struct ip6_opt_binding_update { + u_int8_t ip6ou_type; + u_int8_t ip6ou_len; +#ifdef MIP6_DRAFT13 + u_int8_t ip6ou_flags; + u_int8_t ip6ou_prefixlen; + u_int16_t ip6ou_seqno; +#else + u_int8_t ip6ou_flags; + u_int8_t ip6ou_reserved[2]; + u_int8_t ip6ou_seqno; +#endif /* MIP6_DRAFT13 */ + u_int8_t ip6ou_lifetime[4]; + /* followed by sub-options */ +} __attribute__ ((aligned(1), packed)); + +/* Binding Update Flags */ +#define IP6_BUF_ACK 0x80 /* Request a binding ack */ +#define IP6_BUF_HOME 0x40 /* Home Registration */ +#ifdef MIP6_DRAFT13 +#define IP6_BUF_ROUTER 0x20 /* Sending mobile node is a router */ +#else +#define IP6_BUF_SINGLE 0x20 /* Update the specified address only */ +#endif /* MIP6_DRAFT13 */ +#define IP6_BUF_DAD 0x10 /* Perform Duplicate Address Detection */ + +/* Binding Ack Option */ +struct ip6_opt_binding_ack { + u_int8_t ip6oa_type; + u_int8_t ip6oa_len; + u_int8_t ip6oa_status; +#ifdef MIP6_DRAFT13 + u_int16_t ip6oa_seqno; +#else + u_int8_t ip6oa_reserved; + u_int8_t ip6oa_seqno; +#endif /* MIP6_DRAFT13 */ + u_int8_t ip6oa_lifetime[4]; + u_int8_t ip6oa_refresh[4]; + /* followed by sub-options */ +} __attribute__ ((aligned(1), packed)); + +/* Binding Request Option */ +struct ip6_opt_binding_request { + u_int8_t ip6or_type; + u_int8_t ip6or_len; + /* followed by sub-options */ +} __attribute__ ((aligned(1), packed)); + +/* Home Address Option */ +struct ip6_opt_home_address { + u_int8_t ip6oh_type; + u_int8_t ip6oh_len; + u_int8_t ip6oh_addr[16];/* Home Address */ + /* followed by sub-options */ +} __attribute__ ((aligned(1), packed)); + +/* Routing header */ +struct ip6_rthdr { + u_int8_t ip6r_nxt; /* next header */ + u_int8_t ip6r_len; /* length in units of 8 octets */ + u_int8_t ip6r_type; /* routing type */ + u_int8_t ip6r_segleft; /* segments left */ + /* followed by routing type specific data */ +} __attribute__ ((aligned(1), packed)); + +/* Type 0 Routing header */ +struct ip6_rthdr0 { + u_int8_t ip6r0_nxt; /* next header */ + u_int8_t ip6r0_len; /* length in units of 8 octets */ + u_int8_t ip6r0_type; /* always zero */ + u_int8_t ip6r0_segleft; /* segments left */ + u_int32_t ip6r0_reserved; /* reserved field */ + /* followed by up to 127 struct in6_addr */ +} __attribute__ ((aligned(1), packed)); + +/* Fragment header */ +struct ip6_frag { + u_int8_t ip6f_nxt; /* next header */ + u_int8_t ip6f_reserved; /* reserved field */ + u_int16_t ip6f_offlg; /* offset, reserved, and flag */ + u_int32_t ip6f_ident; /* identification */ +} __attribute__ ((aligned(1), packed)); + +#if BYTE_ORDER == BIG_ENDIAN +#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ +#else /* BYTE_ORDER == LITTLE_ENDIAN */ +#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */ +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +/* + * Internet implementation parameters. + */ +#define IPV6_MAXHLIM 255 /* maximun hoplimit */ +#define IPV6_DEFHLIM 64 /* default hlim */ +#define IPV6_FRAGTTL 120 /* ttl for fragment packets, in slowtimo tick */ +#define IPV6_HLIMDEC 1 /* subtracted when forwaeding */ + +#define IPV6_MMTU 1280 /* minimal MTU and reassembly. 1024 + 256 */ +#define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/ + +#ifdef _KERNEL +/* + * IP6_EXTHDR_CHECK ensures that region between the IP6 header and the + * target header (including IPv6 itself, extension headers and + * TCP/UDP/ICMP6 headers) are continuous. KAME requires drivers + * to store incoming data into one internal mbuf or one or more external + * mbufs(never into two or more internal mbufs). Thus, the third case is + * supposed to never be matched but is prepared just in case. + */ + +#define IP6_EXTHDR_CHECK(m, off, hlen, ret) \ +do { \ + if ((m)->m_next != NULL) { \ + if ((m)->m_flags & M_EXT) { \ + if ((m)->m_len < (off) + (hlen)) { \ + ip6stat.ip6s_exthdrtoolong++; \ + m_freem(m); \ + return ret; \ + } \ + } else { \ + if ((m)->m_len < (off) + (hlen)) { \ + ip6stat.ip6s_exthdrtoolong++; \ + m_freem(m); \ + return ret; \ + } \ + } \ + } else { \ + if ((m)->m_len < (off) + (hlen)) { \ + ip6stat.ip6s_tooshort++; \ + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \ + m_freem(m); \ + return ret; \ + } \ + } \ +} while (0) + +#ifdef PULLDOWN_STAT +#define IP6_EXTHDR_STAT(x) x +#else +#define IP6_EXTHDR_STAT(x) +#endif + +/* + * IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to + * "len") is located in single mbuf, on contiguous memory region. + * The pointer to the region will be returned to pointer variable "val", + * with type "typ". + * IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the + * very top of mbuf. GET0 is likely to make memory copy than GET. + * + * XXX we're now testing this, needs m_pulldown() + */ +#define IP6_EXTHDR_GET(val, typ, m, off, len) \ +do { \ + struct mbuf *t; \ + int tmp; \ + IP6_EXTHDR_STAT(mbstat.m_exthdrget++); \ + if ((m)->m_len >= (off) + (len)) \ + (val) = (typ)(mtod((m), caddr_t) + (off)); \ + else { \ + t = m_pulldown((m), (off), (len), &tmp); \ + if (t) { \ + if (t->m_len < tmp + (len)) \ + panic("m_pulldown malfunction"); \ + (val) = (typ)(mtod(t, caddr_t) + tmp); \ + } else { \ + (val) = (typ)NULL; \ + (m) = NULL; \ + } \ + } \ +} while (0) + +#define IP6_EXTHDR_GET0(val, typ, m, off, len) \ +do { \ + struct mbuf *t; \ + IP6_EXTHDR_STAT(mbstat.m_exthdrget0++); \ + if ((off) == 0 && (m)->m_len >= len) \ + (val) = (typ)mtod((m), caddr_t); \ + else { \ + t = m_pulldown((m), (off), (len), NULL); \ + if (t) { \ + if (t->m_len < (len)) \ + panic("m_pulldown malfunction"); \ + (val) = (typ)mtod(t, caddr_t); \ + } else { \ + (val) = (typ)NULL; \ + (m) = NULL; \ + } \ + } \ +} while (0) +#endif /*_KERNEL*/ + +#endif /* not _NETINET_IP6_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/ip_encap.h b/packages/net/bsd_tcpip/current/include/netinet/ip_encap.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/ip_encap.h @@ -0,0 +1,96 @@ +//========================================================================== +// +// include/netinet/ip_encap.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip_encap.h,v 1.12 2001/09/04 08:43:18 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#ifndef _NETINET_IP_ENCAP_H_ +#define _NETINET_IP_ENCAP_H_ + +#ifdef _KERNEL + +#ifndef RNF_NORMAL +#include +#endif + +struct encaptab { + struct radix_node nodes[2]; + LIST_ENTRY(encaptab) chain; + int af; + int proto; /* -1: don't care, I'll check myself */ + struct sockaddr *addrpack; /* malloc'ed, for radix lookup */ + struct sockaddr *maskpack; /* ditto */ + struct sockaddr *src; /* my addr */ + struct sockaddr *srcmask; + struct sockaddr *dst; /* remote addr */ + struct sockaddr *dstmask; + int (*func) __P((const struct mbuf *, int, int, void *)); + const struct protosw *psw; /* only pr_input will be used */ + void *arg; /* passed via m->m_pkthdr.aux */ +}; + +void encap_init __P((void)); +#if (defined(__FreeBSD__) && __FreeBSD__ >= 4) +void encap4_input __P((struct mbuf *, int)); +#else +void encap4_input __P((struct mbuf *, ...)); +#endif /* (defined(__FreeBSD__) && __FreeBSD__ >= 4) */ +int encap6_input __P((struct mbuf **, int *, int)); +const struct encaptab *encap_attach __P((int, int, const struct sockaddr *, + const struct sockaddr *, const struct sockaddr *, + const struct sockaddr *, const struct protosw *, void *)); +const struct encaptab *encap_attach_func __P((int, int, + int (*) __P((const struct mbuf *, int, int, void *)), + const struct protosw *, void *)); +void encap6_ctlinput __P((int, struct sockaddr *, void *)); +int encap_detach __P((const struct encaptab *)); +void *encap_getarg __P((struct mbuf *)); +#endif + +#endif /*_NETINET_IP_ENCAP_H_*/ diff --git a/packages/net/bsd_tcpip/current/include/netinet/ip_flow.h b/packages/net/bsd_tcpip/current/include/netinet/ip_flow.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/ip_flow.h @@ -0,0 +1,78 @@ +//========================================================================== +// +// include/netinet/ip_flow.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by the 3am Software Foundry ("3am"). It was developed by Matt Thomas. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + * + * $FreeBSD: src/sys/netinet/ip_flow.h,v 1.2 1999/08/28 00:49:22 peter Exp $ + */ + +#ifndef _NETINET_IP_FLOW_H +#define _NETINET_IP_FLOW_H + +struct ipflow { + LIST_ENTRY(ipflow) ipf_next; /* next ipflow in bucket */ + struct in_addr ipf_dst; /* destination address */ + struct in_addr ipf_src; /* source address */ + + u_int8_t ipf_tos; /* type-of-service */ + struct route ipf_ro; /* associated route entry */ + u_long ipf_uses; /* number of uses in this period */ + + int ipf_timer; /* remaining lifetime of this entry */ + u_long ipf_dropped; /* ENOBUFS returned by if_output */ + u_long ipf_errors; /* other errors returned by if_output */ + u_long ipf_last_uses; /* number of uses in last period */ +}; + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/ip_fw.h b/packages/net/bsd_tcpip/current/include/netinet/ip_fw.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/ip_fw.h @@ -0,0 +1,309 @@ +//========================================================================== +// +// include/netinet/ip_fw.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1993 Daniel Boulet + * Copyright (c) 1994 Ugen J.S.Antsilevich + * + * Redistribution and use in source forms, with and without modification, + * are permitted provided that this entire comment appears intact. + * + * Redistribution in binary form may occur without any restrictions. + * Obviously, it would be nice if you gave credit where credit is due + * but requiring it would be too onerous. + * + * This software is provided ``AS IS'' without any warranties of any kind. + * + * $FreeBSD: src/sys/netinet/ip_fw.h,v 1.47.2.8 2001/02/20 11:39:17 phk Exp $ + */ + +#ifndef _IP_FW_H +#define _IP_FW_H + +#include + +/* + * This union structure identifies an interface, either explicitly + * by name or implicitly by IP address. The flags IP_FW_F_IIFNAME + * and IP_FW_F_OIFNAME say how to interpret this structure. An + * interface unit number of -1 matches any unit number, while an + * IP address of 0.0.0.0 indicates matches any interface. + * + * The receive and transmit interfaces are only compared against the + * the packet if the corresponding bit (IP_FW_F_IIFACE or IP_FW_F_OIFACE) + * is set. Note some packets lack a receive or transmit interface + * (in which case the missing "interface" never matches). + */ + +union ip_fw_if { + struct in_addr fu_via_ip; /* Specified by IP address */ + struct { /* Specified by interface name */ +#define FW_IFNLEN 10 /* need room ! was IFNAMSIZ */ + char name[FW_IFNLEN]; + short unit; /* -1 means match any unit */ + } fu_via_if; +}; + +/* + * Format of an IP firewall descriptor + * + * fw_src, fw_dst, fw_smsk, fw_dmsk are always stored in network byte order. + * fw_flg and fw_n*p are stored in host byte order (of course). + * Port numbers are stored in HOST byte order. + */ + +struct ip_fw { + u_int64_t fw_pcnt,fw_bcnt; /* Packet and byte counters */ + struct in_addr fw_src, fw_dst; /* Source and destination IP addr */ + struct in_addr fw_smsk, fw_dmsk; /* Mask for src and dest IP addr */ + u_short fw_number; /* Rule number */ + u_int fw_flg; /* Flags word */ +#define IP_FW_MAX_PORTS 10 /* A reasonable maximum */ + union { + u_short fw_pts[IP_FW_MAX_PORTS]; /* Array of port numbers to match */ +#define IP_FW_ICMPTYPES_MAX 128 +#define IP_FW_ICMPTYPES_DIM (IP_FW_ICMPTYPES_MAX / (sizeof(unsigned) * 8)) + unsigned fw_icmptypes[IP_FW_ICMPTYPES_DIM]; /* ICMP types bitmap */ + } fw_uar; + u_int fw_ipflg; /* IP flags word */ + u_char fw_ipopt,fw_ipnopt; /* IP options set/unset */ + u_char fw_tcpopt,fw_tcpnopt; /* TCP options set/unset */ + u_char fw_tcpf,fw_tcpnf; /* TCP flags set/unset */ + long timestamp; /* timestamp (tv_sec) of last match */ + union ip_fw_if fw_in_if, fw_out_if; /* Incoming and outgoing interfaces */ + union { + u_short fu_divert_port; /* Divert/tee port (options IPDIVERT) */ + u_short fu_pipe_nr; /* queue number (option DUMMYNET) */ + u_short fu_skipto_rule; /* SKIPTO command rule number */ + u_short fu_reject_code; /* REJECT response code */ + struct sockaddr_in fu_fwd_ip; + } fw_un; + u_char fw_prot; /* IP protocol */ + /* + * N'of src ports and # of dst ports in ports array (dst ports + * follow src ports; max of 10 ports in all; count of 0 means + * match all ports) + */ + u_char fw_nports; + void *pipe_ptr; /* flow_set ptr for dummynet pipe */ + void *next_rule_ptr ; /* next rule in case of match */ + uid_t fw_uid; /* uid to match */ + gid_t fw_gid; /* gid to match */ + int fw_logamount; /* amount to log */ + u_int64_t fw_loghighest; /* highest number packet to log */ +}; + +/* + * extended ipfw structure... some fields in the original struct + * can be used to pass parameters up/down, namely pointers + * void *pipe_ptr + * void *next_rule_ptr + * some others can be used to pass parameters down, namely counters etc. + * u_int64_t fw_pcnt,fw_bcnt; + * long timestamp; + */ + +struct ip_fw_ext { /* extended structure */ + struct ip_fw rule; /* must be at offset 0 */ + long dont_match_prob; /* 0x7fffffff means 1.0, always fail */ + u_int dyn_type; /* type for dynamic rule */ +}; + +#define IP_FW_GETNSRCP(rule) ((rule)->fw_nports & 0x0f) +#define IP_FW_SETNSRCP(rule, n) do { \ + (rule)->fw_nports &= ~0x0f; \ + (rule)->fw_nports |= (n); \ + } while (0) +#define IP_FW_GETNDSTP(rule) ((rule)->fw_nports >> 4) +#define IP_FW_SETNDSTP(rule, n) do { \ + (rule)->fw_nports &= ~0xf0; \ + (rule)->fw_nports |= (n) << 4;\ + } while (0) + +#define fw_divert_port fw_un.fu_divert_port +#define fw_skipto_rule fw_un.fu_skipto_rule +#define fw_reject_code fw_un.fu_reject_code +#define fw_pipe_nr fw_un.fu_pipe_nr +#define fw_fwd_ip fw_un.fu_fwd_ip + +struct ip_fw_chain { + LIST_ENTRY(ip_fw_chain) next; + struct ip_fw *rule; +}; + +/* + * Flow mask/flow id for each queue. + */ +struct ipfw_flow_id { + u_int32_t dst_ip, src_ip ; + u_int16_t dst_port, src_port ; + u_int8_t proto ; + u_int8_t flags ; /* protocol-specific flags */ +} ; + +/* + * dynamic ipfw rule + */ +struct ipfw_dyn_rule { + struct ipfw_dyn_rule *next ; + + struct ipfw_flow_id id ; + struct ipfw_flow_id mask ; + struct ip_fw_chain *chain ; /* pointer to parent rule */ + u_int32_t type ; /* rule type */ + u_int32_t expire ; /* expire time */ + u_int64_t pcnt, bcnt; /* match counters */ + u_int32_t bucket ; /* which bucket in hash table */ + u_int32_t state ; /* state of this rule (typ. a */ + /* combination of TCP flags) */ +} ; + +/* + * Values for "flags" field . + */ +#define IP_FW_F_COMMAND 0x000000ff /* Mask for type of chain entry: */ +#define IP_FW_F_DENY 0x00000000 /* This is a deny rule */ +#define IP_FW_F_REJECT 0x00000001 /* Deny and send a response packet */ +#define IP_FW_F_ACCEPT 0x00000002 /* This is an accept rule */ +#define IP_FW_F_COUNT 0x00000003 /* This is a count rule */ +#define IP_FW_F_DIVERT 0x00000004 /* This is a divert rule */ +#define IP_FW_F_TEE 0x00000005 /* This is a tee rule */ +#define IP_FW_F_SKIPTO 0x00000006 /* This is a skipto rule */ +#define IP_FW_F_FWD 0x00000007 /* This is a "change forwarding address" rule */ +#define IP_FW_F_PIPE 0x00000008 /* This is a dummynet rule */ +#define IP_FW_F_QUEUE 0x00000009 /* This is a dummynet queue */ + +#define IP_FW_F_IN 0x00000100 /* Check inbound packets */ +#define IP_FW_F_OUT 0x00000200 /* Check outbound packets */ +#define IP_FW_F_IIFACE 0x00000400 /* Apply inbound interface test */ +#define IP_FW_F_OIFACE 0x00000800 /* Apply outbound interface test */ + +#define IP_FW_F_PRN 0x00001000 /* Print if this rule matches */ + +#define IP_FW_F_SRNG 0x00002000 /* The first two src ports are a min * + * and max range (stored in host byte * + * order). */ + +#define IP_FW_F_DRNG 0x00004000 /* The first two dst ports are a min * + * and max range (stored in host byte * + * order). */ + +#define IP_FW_F_FRAG 0x00008000 /* Fragment */ + +#define IP_FW_F_IIFNAME 0x00010000 /* In interface by name/unit (not IP) */ +#define IP_FW_F_OIFNAME 0x00020000 /* Out interface by name/unit (not IP) */ + +#define IP_FW_F_INVSRC 0x00040000 /* Invert sense of src check */ +#define IP_FW_F_INVDST 0x00080000 /* Invert sense of dst check */ + +#define IP_FW_F_ICMPBIT 0x00100000 /* ICMP type bitmap is valid */ + +#define IP_FW_F_UID 0x00200000 /* filter by uid */ + +#define IP_FW_F_GID 0x00400000 /* filter by gid */ + +#define IP_FW_F_RND_MATCH 0x00800000 /* probabilistic rule match */ +#define IP_FW_F_SMSK 0x01000000 /* src-port + mask */ +#define IP_FW_F_DMSK 0x02000000 /* dst-port + mask */ +#define IP_FW_BRIDGED 0x04000000 /* only match bridged packets */ +#define IP_FW_F_KEEP_S 0x08000000 /* keep state */ +#define IP_FW_F_CHECK_S 0x10000000 /* check state */ + +#define IP_FW_F_SME 0x20000000 /* source = me */ +#define IP_FW_F_DME 0x40000000 /* destination = me */ + +#define IP_FW_F_MASK 0x7FFFFFFF /* All possible flag bits mask */ + +/* + * Flags for the 'fw_ipflg' field, for comparing values of ip and its protocols. + */ +#define IP_FW_IF_TCPEST 0x00000020 /* established TCP connection */ +#define IP_FW_IF_TCPMSK 0x00000020 /* mask of all TCP values */ + +/* + * For backwards compatibility with rules specifying "via iface" but + * not restricted to only "in" or "out" packets, we define this combination + * of bits to represent this configuration. + */ + +#define IF_FW_F_VIAHACK (IP_FW_F_IN|IP_FW_F_OUT|IP_FW_F_IIFACE|IP_FW_F_OIFACE) + +/* + * Definitions for REJECT response codes. + * Values less than 256 correspond to ICMP unreachable codes. + */ +#define IP_FW_REJECT_RST 0x0100 /* TCP packets: send RST */ + +/* + * Definitions for IP option names. + */ +#define IP_FW_IPOPT_LSRR 0x01 +#define IP_FW_IPOPT_SSRR 0x02 +#define IP_FW_IPOPT_RR 0x04 +#define IP_FW_IPOPT_TS 0x08 + +/* + * Definitions for TCP option names. + */ +#define IP_FW_TCPOPT_MSS 0x01 +#define IP_FW_TCPOPT_WINDOW 0x02 +#define IP_FW_TCPOPT_SACK 0x04 +#define IP_FW_TCPOPT_TS 0x08 +#define IP_FW_TCPOPT_CC 0x10 + +/* + * Definitions for TCP flags. + */ +#define IP_FW_TCPF_FIN TH_FIN +#define IP_FW_TCPF_SYN TH_SYN +#define IP_FW_TCPF_RST TH_RST +#define IP_FW_TCPF_PSH TH_PUSH +#define IP_FW_TCPF_ACK TH_ACK +#define IP_FW_TCPF_URG TH_URG + +/* + * Main firewall chains definitions and global var's definitions. + */ +#ifdef _KERNEL + +#define IP_FW_PORT_DYNT_FLAG 0x10000 +#define IP_FW_PORT_TEE_FLAG 0x20000 +#define IP_FW_PORT_DENY_FLAG 0x40000 + +/* + * Function definitions. + */ +void ip_fw_init __P((void)); + +/* Firewall hooks */ +struct ip; +struct sockopt; +typedef int ip_fw_chk_t __P((struct ip **, int, struct ifnet *, u_int16_t *, + struct mbuf **, struct ip_fw_chain **, struct sockaddr_in **)); +typedef int ip_fw_ctl_t __P((struct sockopt *)); +extern ip_fw_chk_t *ip_fw_chk_ptr; +extern ip_fw_ctl_t *ip_fw_ctl_ptr; +extern int fw_one_pass; +extern int fw_enable; +extern struct ipfw_flow_id last_pkt ; +#endif /* _KERNEL */ + +#endif /* _IP_FW_H */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/ip_icmp.h b/packages/net/bsd_tcpip/current/include/netinet/ip_icmp.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/ip_icmp.h @@ -0,0 +1,213 @@ +//========================================================================== +// +// include/netinet/ip_icmp.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/ip_icmp.h,v 1.16 1999/12/29 04:41:01 peter Exp $ + */ + +#ifndef _NETINET_IP_ICMP_H_ +#define _NETINET_IP_ICMP_H_ + +/* + * Interface Control Message Protocol Definitions. + * Per RFC 792, September 1981. + */ + +/* + * Internal of an ICMP Router Advertisement + */ +struct icmp_ra_addr { + u_int32_t ira_addr; + u_int32_t ira_preference; +}; + +/* + * Structure of an icmp header. + */ +struct icmp { + u_char icmp_type; /* type of message, see below */ + u_char icmp_code; /* type sub code */ + u_short icmp_cksum; /* ones complement cksum of struct */ + union { + u_char ih_pptr; /* ICMP_PARAMPROB */ + struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ + struct ih_idseq { + n_short icd_id; + n_short icd_seq; + } ih_idseq; + int ih_void; + + /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ + struct ih_pmtu { + n_short ipm_void; + n_short ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv { + u_char irt_num_addrs; + u_char irt_wpa; + u_int16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime + union { + struct id_ts { + n_time its_otime; + n_time its_rtime; + n_time its_ttime; + } id_ts; + struct id_ip { + struct ip idi_ip; + /* options and then 64 bits of data */ + } id_ip; + struct icmp_ra_addr id_radv; + u_int32_t id_mask; + char id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +} __attribute__ ((aligned(1), packed)); + +/* + * Lower bounds on packet lengths for various types. + * For the error advice packets must first insure that the + * packet is large enough to contain the returned ip header. + * Only then can we do the check to see if 64 bits of packet + * data have been returned, since we need to check the returned + * ip header length. + */ +#define ICMP_MINLEN 8 /* abs minimum */ +#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ +#define ICMP_MASKLEN 12 /* address mask */ +#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ +#ifndef _IP_VHL +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + /* N.B.: must separately check that ip_hl >= 5 */ +#else +#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8) + /* N.B.: must separately check that header length >= 5 */ +#endif + +/* + * Definition of type and code field values. + */ +#define ICMP_ECHOREPLY 0 /* echo reply */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ +#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ +#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ +#define ICMP_UNREACH_NET_PROHIB 9 /* prohibited access */ +#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */ +#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ +#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ +#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */ +#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */ +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_REDIRECT 5 /* shorter route, codes: */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ +#define ICMP_ECHO 8 /* echo service */ +#define ICMP_ROUTERADVERT 9 /* router advertisement */ +#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_PARAMPROB_ERRATPTR 0 /* error at param ptr */ +#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ +#define ICMP_PARAMPROB_LENGTH 2 /* bad length */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREPLY 18 /* address mask reply */ + +#define ICMP_MAXTYPE 18 + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ + (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ + (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ + (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ + (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) + +#ifdef _KERNEL +void icmp_error __P((struct mbuf *, int, int, n_long, struct ifnet *)); +void icmp_input __P((struct mbuf *, int)); +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/ip_mroute.h b/packages/net/bsd_tcpip/current/include/netinet/ip_mroute.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/ip_mroute.h @@ -0,0 +1,288 @@ +//========================================================================== +// +// include/netinet/ip_mroute.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1989 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_mroute.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/ip_mroute.h,v 1.17 1999/12/29 04:41:01 peter Exp $ + */ + +#ifndef _NETINET_IP_MROUTE_H_ +#define _NETINET_IP_MROUTE_H_ + +/* + * Definitions for IP multicast forwarding. + * + * Written by David Waitzman, BBN Labs, August 1988. + * Modified by Steve Deering, Stanford, February 1989. + * Modified by Ajit Thyagarajan, PARC, August 1993. + * Modified by Ajit Thyagarajan, PARC, August 1994. + * + * MROUTING Revision: 3.3.1.3 + */ + + +/* + * Multicast Routing set/getsockopt commands. + */ +#define MRT_INIT 100 /* initialize forwarder */ +#define MRT_DONE 101 /* shut down forwarder */ +#define MRT_ADD_VIF 102 /* create virtual interface */ +#define MRT_DEL_VIF 103 /* delete virtual interface */ +#define MRT_ADD_MFC 104 /* insert forwarding cache entry */ +#define MRT_DEL_MFC 105 /* delete forwarding cache entry */ +#define MRT_VERSION 106 /* get kernel version number */ +#define MRT_ASSERT 107 /* enable PIM assert processing */ + + +#define GET_TIME(t) microtime(&t) + +/* + * Types and macros for handling bitmaps with one bit per virtual interface. + */ +#define MAXVIFS 32 +typedef u_long vifbitmap_t; +typedef u_short vifi_t; /* type of a vif index */ +#define ALL_VIFS (vifi_t)-1 + +#define VIFM_SET(n, m) ((m) |= (1 << (n))) +#define VIFM_CLR(n, m) ((m) &= ~(1 << (n))) +#define VIFM_ISSET(n, m) ((m) & (1 << (n))) +#define VIFM_CLRALL(m) ((m) = 0x00000000) +#define VIFM_COPY(mfrom, mto) ((mto) = (mfrom)) +#define VIFM_SAME(m1, m2) ((m1) == (m2)) + + +/* + * Argument structure for MRT_ADD_VIF. + * (MRT_DEL_VIF takes a single vifi_t argument.) + */ +struct vifctl { + vifi_t vifc_vifi; /* the index of the vif to be added */ + u_char vifc_flags; /* VIFF_ flags defined below */ + u_char vifc_threshold; /* min ttl required to forward on vif */ + u_int vifc_rate_limit; /* max rate */ + struct in_addr vifc_lcl_addr; /* local interface address */ + struct in_addr vifc_rmt_addr; /* remote address (tunnels only) */ +}; + +#define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */ +#define VIFF_SRCRT 0x2 /* tunnel uses IP source routing */ + +/* + * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC + * (mfcc_tos to be added at a future point) + */ +struct mfcctl { + struct in_addr mfcc_origin; /* ip origin of mcasts */ + struct in_addr mfcc_mcastgrp; /* multicast group associated*/ + vifi_t mfcc_parent; /* incoming vif */ + u_char mfcc_ttls[MAXVIFS]; /* forwarding ttls on vifs */ +}; + +/* + * The kernel's multicast routing statistics. + */ +struct mrtstat { + u_long mrts_mfc_lookups; /* # forw. cache hash table hits */ + u_long mrts_mfc_misses; /* # forw. cache hash table misses */ + u_long mrts_upcalls; /* # calls to mrouted */ + u_long mrts_no_route; /* no route for packet's origin */ + u_long mrts_bad_tunnel; /* malformed tunnel options */ + u_long mrts_cant_tunnel; /* no room for tunnel options */ + u_long mrts_wrong_if; /* arrived on wrong interface */ + u_long mrts_upq_ovflw; /* upcall Q overflow */ + u_long mrts_cache_cleanups; /* # entries with no upcalls */ + u_long mrts_drop_sel; /* pkts dropped selectively */ + u_long mrts_q_overflow; /* pkts dropped - Q overflow */ + u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */ + u_long mrts_upq_sockfull; /* upcalls dropped - socket full */ +}; + +/* + * Argument structure used by mrouted to get src-grp pkt counts + */ +struct sioc_sg_req { + struct in_addr src; + struct in_addr grp; + u_long pktcnt; + u_long bytecnt; + u_long wrong_if; +}; + +/* + * Argument structure used by mrouted to get vif pkt counts + */ +struct sioc_vif_req { + vifi_t vifi; /* vif number */ + u_long icount; /* Input packet count on vif */ + u_long ocount; /* Output packet count on vif */ + u_long ibytes; /* Input byte count on vif */ + u_long obytes; /* Output byte count on vif */ +}; + + +/* + * The kernel's virtual-interface structure. + */ +struct vif { + u_char v_flags; /* VIFF_ flags defined above */ + u_char v_threshold; /* min ttl required to forward on vif*/ + u_int v_rate_limit; /* max rate */ + struct tbf *v_tbf; /* token bucket structure at intf. */ + struct in_addr v_lcl_addr; /* local interface address */ + struct in_addr v_rmt_addr; /* remote address (tunnels only) */ + struct ifnet *v_ifp; /* pointer to interface */ + u_long v_pkt_in; /* # pkts in on interface */ + u_long v_pkt_out; /* # pkts out on interface */ + u_long v_bytes_in; /* # bytes in on interface */ + u_long v_bytes_out; /* # bytes out on interface */ + struct route v_route; /* cached route if this is a tunnel */ + u_int v_rsvp_on; /* RSVP listening on this vif */ + struct socket *v_rsvpd; /* RSVP daemon socket */ +}; + +/* + * The kernel's multicast forwarding cache entry structure + * (A field for the type of service (mfc_tos) is to be added + * at a future point) + */ +struct mfc { + struct in_addr mfc_origin; /* IP origin of mcasts */ + struct in_addr mfc_mcastgrp; /* multicast group associated*/ + vifi_t mfc_parent; /* incoming vif */ + u_char mfc_ttls[MAXVIFS]; /* forwarding ttls on vifs */ + u_long mfc_pkt_cnt; /* pkt count for src-grp */ + u_long mfc_byte_cnt; /* byte count for src-grp */ + u_long mfc_wrong_if; /* wrong if for src-grp */ + int mfc_expire; /* time to clean entry up */ + struct timeval mfc_last_assert; /* last time I sent an assert*/ + struct rtdetq *mfc_stall; /* q of packets awaiting mfc */ + struct mfc *mfc_next; /* next mfc entry */ +}; + +/* + * Struct used to communicate from kernel to multicast router + * note the convenient similarity to an IP packet + */ +struct igmpmsg { + u_long unused1; + u_long unused2; + u_char im_msgtype; /* what type of message */ +#define IGMPMSG_NOCACHE 1 +#define IGMPMSG_WRONGVIF 2 + u_char im_mbz; /* must be zero */ + u_char im_vif; /* vif rec'd on */ + u_char unused3; + struct in_addr im_src, im_dst; +}; + +/* + * Argument structure used for pkt info. while upcall is made + */ +struct rtdetq { + struct mbuf *m; /* A copy of the packet */ + struct ifnet *ifp; /* Interface pkt came in on */ + vifi_t xmt_vif; /* Saved copy of imo_multicast_vif */ +#ifdef UPCALL_TIMING + struct timeval t; /* Timestamp */ +#endif /* UPCALL_TIMING */ + struct rtdetq *next; /* Next in list of packets */ +}; + +#define MFCTBLSIZ 256 +#if (MFCTBLSIZ & (MFCTBLSIZ - 1)) == 0 /* from sys:route.h */ +#define MFCHASHMOD(h) ((h) & (MFCTBLSIZ - 1)) +#else +#define MFCHASHMOD(h) ((h) % MFCTBLSIZ) +#endif + +#define MAX_UPQ 4 /* max. no of pkts in upcall Q */ + +/* + * Token Bucket filter code + */ +#define MAX_BKT_SIZE 10000 /* 10K bytes size */ +#define MAXQSIZE 10 /* max # of pkts in queue */ + +/* + * the token bucket filter at each vif + */ +struct tbf +{ + struct timeval tbf_last_pkt_t; /* arr. time of last pkt */ + u_long tbf_n_tok; /* no of tokens in bucket */ + u_long tbf_q_len; /* length of queue at this vif */ + u_long tbf_max_q_len; /* max. queue length */ + struct mbuf *tbf_q; /* Packet queue */ + struct mbuf *tbf_t; /* tail-insertion pointer */ +}; + +#ifdef _KERNEL + +struct sockopt; + +extern int (*ip_mrouter_set) __P((struct socket *, struct sockopt *)); +extern int (*ip_mrouter_get) __P((struct socket *, struct sockopt *)); +extern int (*ip_mrouter_done) __P((void)); +#ifdef MROUTING +extern int (*mrt_ioctl) __P((int, caddr_t)); +#else +extern int (*mrt_ioctl) __P((int, caddr_t, struct proc *)); +#endif + +#endif /* _KERNEL */ + +#endif /* _NETINET_IP_MROUTE_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/ip_var.h b/packages/net/bsd_tcpip/current/include/netinet/ip_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/ip_var.h @@ -0,0 +1,224 @@ +//========================================================================== +// +// include/netinet/ip_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_var.h 8.2 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/netinet/ip_var.h,v 1.50.2.4 2001/07/19 06:37:26 kris Exp $ + */ + +#ifndef _NETINET_IP_VAR_H_ +#define _NETINET_IP_VAR_H_ + +#include + +/* + * Overlay for ip header used by other protocols (tcp, udp). + */ +struct ipovly { + u_char ih_x1[9]; /* (unused) */ + u_char ih_pr; /* protocol */ + u_short ih_len; /* protocol length */ + struct in_addr ih_src; /* source internet address */ + struct in_addr ih_dst; /* destination internet address */ +} __attribute__ ((aligned(1), packed)); + +/* + * Ip reassembly queue structure. Each fragment + * being reassembled is attached to one of these structures. + * They are timed out after ipq_ttl drops to 0, and may also + * be reclaimed if memory becomes tight. + */ +struct ipq { + struct ipq *next,*prev; /* to other reass headers */ + u_char ipq_ttl; /* time for reass q to live */ + u_char ipq_p; /* protocol of this fragment */ + u_short ipq_id; /* sequence id for reassembly */ + struct mbuf *ipq_frags; /* to ip headers of fragments */ + struct in_addr ipq_src,ipq_dst; +#ifdef IPDIVERT + u_int32_t ipq_div_info; /* ipfw divert port & flags */ + u_int16_t ipq_div_cookie; /* ipfw divert cookie */ +#endif +}; + +/* + * Structure stored in mbuf in inpcb.ip_options + * and passed to ip_output when ip options are in use. + * The actual length of the options (including ipopt_dst) + * is in m_len. + */ +#define MAX_IPOPTLEN 40 + +struct ipoption { + struct in_addr ipopt_dst; /* first-hop dst if source routed */ + char ipopt_list[MAX_IPOPTLEN]; /* options proper */ +}; + +/* + * Structure attached to inpcb.ip_moptions and + * passed to ip_output when IP multicast options are in use. + */ +struct ip_moptions { + struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */ + struct in_addr imo_multicast_addr; /* ifindex/addr on MULTICAST_IF */ + u_char imo_multicast_ttl; /* TTL for outgoing multicasts */ + u_char imo_multicast_loop; /* 1 => hear sends if a member */ + u_short imo_num_memberships; /* no. memberships this socket */ + struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS]; + u_long imo_multicast_vif; /* vif num outgoing multicasts */ +}; + +struct ipstat { + u_long ips_total; /* total packets received */ + u_long ips_badsum; /* checksum bad */ + u_long ips_tooshort; /* packet too short */ + u_long ips_toosmall; /* not enough data */ + u_long ips_badhlen; /* ip header length < data size */ + u_long ips_badlen; /* ip length < ip header length */ + u_long ips_fragments; /* fragments received */ + u_long ips_fragdropped; /* frags dropped (dups, out of space) */ + u_long ips_fragtimeout; /* fragments timed out */ + u_long ips_forward; /* packets forwarded */ + u_long ips_fastforward; /* packets fast forwarded */ + u_long ips_cantforward; /* packets rcvd for unreachable dest */ + u_long ips_redirectsent; /* packets forwarded on same net */ + u_long ips_noproto; /* unknown or unsupported protocol */ + u_long ips_delivered; /* datagrams delivered to upper level*/ + u_long ips_localout; /* total ip packets generated here */ + u_long ips_odropped; /* lost packets due to nobufs, etc. */ + u_long ips_reassembled; /* total packets reassembled ok */ + u_long ips_fragmented; /* datagrams successfully fragmented */ + u_long ips_ofragments; /* output fragments created */ + u_long ips_cantfrag; /* don't fragment flag was set, etc. */ + u_long ips_badoptions; /* error in option processing */ + u_long ips_noroute; /* packets discarded due to no route */ + u_long ips_badvers; /* ip version != 4 */ + u_long ips_rawout; /* total raw ip packets generated */ + u_long ips_toolong; /* ip length > max ip packet size */ + u_long ips_notmember; /* multicasts for unregistered grps */ + u_long ips_nogif; /* no match gif found */ + u_long ips_badaddr; /* invalid address on header */ +}; + +#ifdef _KERNEL + +/* flags passed to ip_output as last parameter */ +#define IP_FORWARDING 0x1 /* most of ip header exists */ +#define IP_RAWOUTPUT 0x2 /* raw ip header exists */ +#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */ +#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ + +struct ip; +struct inpcb; +struct route; +struct sockopt; + +extern struct ipstat ipstat; +#ifndef RANDOM_IP_ID +extern u_short ip_id; /* ip packet ctr, for ids */ +#endif +extern int ip_defttl; /* default IP ttl */ +extern int ipforwarding; /* ip forwarding */ +extern u_char ip_protox[]; +extern struct socket *ip_rsvpd; /* reservation protocol daemon */ +extern struct socket *ip_mrouter; /* multicast routing daemon */ +extern int (*legal_vif_num) __P((int)); +extern u_long (*ip_mcast_src) __P((int)); +extern int rsvp_on; +extern struct pr_usrreqs rip_usrreqs; + +int ip_ctloutput __P((struct socket *, struct sockopt *sopt)); +void ip_drain __P((void)); +void ip_freemoptions __P((struct ip_moptions *)); +void ip_init __P((void)); +extern int (*ip_mforward) __P((struct ip *, struct ifnet *, struct mbuf *, + struct ip_moptions *)); +int ip_output __P((struct mbuf *, + struct mbuf *, struct route *, int, struct ip_moptions *)); +void ip_savecontrol __P((struct inpcb *, struct mbuf **, struct ip *, + struct mbuf *)); +void ip_slowtimo __P((void)); +struct mbuf * + ip_srcroute __P((void)); +void ip_stripoptions __P((struct mbuf *, struct mbuf *)); +#ifdef RANDOM_IP_ID +u_int16_t + ip_randomid __P((void)); +#endif +int rip_ctloutput __P((struct socket *, struct sockopt *)); +void rip_ctlinput __P((int, struct sockaddr *, void *)); +void rip_init __P((void)); +void rip_input __P((struct mbuf *, int)); +int rip_output __P((struct mbuf *, struct socket *, u_long)); +void ipip_input __P((struct mbuf *, int)); +void rsvp_input __P((struct mbuf *, int)); +int ip_rsvp_init __P((struct socket *)); +int ip_rsvp_done __P((void)); +int ip_rsvp_vif_init __P((struct socket *, struct sockopt *)); +int ip_rsvp_vif_done __P((struct socket *, struct sockopt *)); +void ip_rsvp_force_done __P((struct socket *)); + +#ifdef IPDIVERT +void div_init __P((void)); +void div_input __P((struct mbuf *, int)); +void divert_packet __P((struct mbuf *, int, int)); +extern struct pr_usrreqs div_usrreqs; +extern u_int16_t ip_divert_cookie; +#endif + +extern struct sockaddr_in *ip_fw_fwd_addr; + +void in_delayed_cksum(struct mbuf *m); + +#endif /* _KERNEL */ + +#endif /* !_NETINET_IP_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/tcp.h b/packages/net/bsd_tcpip/current/include/netinet/tcp.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/tcp.h @@ -0,0 +1,158 @@ +//========================================================================== +// +// include/netinet/tcp.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp.h,v 1.13.2.3 2001/03/01 22:08:42 jlemon Exp $ + */ + +#ifndef _NETINET_TCP_H_ +#define _NETINET_TCP_H_ + +typedef u_int32_t tcp_seq; +typedef u_int32_t tcp_cc; /* connection count per rfc1644 */ + +#define tcp6_seq tcp_seq /* for KAME src sync over BSD*'s */ +#define tcp6hdr tcphdr /* for KAME src sync over BSD*'s */ + +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + u_short th_sport; /* source port */ + u_short th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +#if BYTE_ORDER == LITTLE_ENDIAN + u_int th_x2:4, /* (unused) */ + th_off:4; /* data offset */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_int th_off:4, /* data offset */ + th_x2:4; /* (unused) */ +#endif + u_char th_flags; +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 +#define TH_ECE 0x40 +#define TH_CWR 0x80 +#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR) + + u_short th_win; /* window */ + u_short th_sum; /* checksum */ + u_short th_urp; /* urgent pointer */ +} __attribute__ ((aligned(1), packed)); + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 +#define TCPOLEN_MAXSEG 4 +#define TCPOPT_WINDOW 3 +#define TCPOLEN_WINDOW 3 +#define TCPOPT_SACK_PERMITTED 4 /* Experimental */ +#define TCPOLEN_SACK_PERMITTED 2 +#define TCPOPT_SACK 5 /* Experimental */ +#define TCPOPT_TIMESTAMP 8 +#define TCPOLEN_TIMESTAMP 10 +#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ +#define TCPOPT_TSTAMP_HDR \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) + +#define TCPOPT_CC 11 /* CC options: RFC-1644 */ +#define TCPOPT_CCNEW 12 +#define TCPOPT_CCECHO 13 +#define TCPOLEN_CC 6 +#define TCPOLEN_CC_APPA (TCPOLEN_CC+2) +#define TCPOPT_CC_HDR(ccopt) \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC) + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). + */ +#define TCP_MSS 512 + +/* + * Default maximum segment size for TCP6. + * With an IP6 MSS of 1280, this is 1220, + * but 1024 is probably more convenient. (xxx kazu in doubt) + * This should be defined as MIN(1024, IP6_MSS - sizeof (struct tcpip6hdr)) + */ +#define TCP6_MSS 1024 + +#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ +#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */ + +#define TCP_MAX_WINSHIFT 14 /* maximum window shift */ + +#define TCP_MAXBURST 4 /* maximum segments in a burst */ + +#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */ +#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr)) + /* max space left for options */ + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ +#define TCP_MAXSEG 0x02 /* set maximum segment size */ +#define TCP_NOPUSH 0x04 /* don't push last block of write */ +#define TCP_NOOPT 0x08 /* don't use TCP options */ + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/tcp_debug.h b/packages/net/bsd_tcpip/current/include/netinet/tcp_debug.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/tcp_debug.h @@ -0,0 +1,106 @@ +//========================================================================== +// +// include/netinet/tcp_debug.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_debug.h,v 1.11 2000/01/29 11:49:05 shin Exp $ + */ + +#ifndef _NETINET_TCP_DEBUG_H_ +#define _NETINET_TCP_DEBUG_H_ + +#ifdef TCPDEBUG +struct tcp_debug { + n_time td_time; + short td_act; + short td_ostate; + caddr_t td_tcb; + int td_family; + /* + * Co-existense of td_ti and td_ti6 below is ugly, but it is necessary + * to achieve backword compatibility to some extent. + */ + struct tcpiphdr td_ti; + struct { +#if !defined(_KERNEL) && defined(INET6) + struct ip6_hdr ip6; +#else + u_char ip6buf[40]; /* sizeof(struct ip6_hdr) */ +#endif + struct tcphdr th; + } td_ti6; +#define td_ip6buf td_ti6.ip6buf + short td_req; + struct tcpcb td_cb; +}; + +#define TA_INPUT 0 +#define TA_OUTPUT 1 +#define TA_USER 2 +#define TA_RESPOND 3 +#define TA_DROP 4 + +#ifdef TANAMES +static char *tanames[] = + { "input", "output", "user", "respond", "drop" }; +#endif + +#define TCP_NDEBUG 100 + +#ifndef _KERNEL +/* XXX common variables for broken applications. */ +struct tcp_debug tcp_debug[TCP_NDEBUG]; +int tcp_debx; +#endif +#endif /* TCPDEBUG */ + +#endif /* !_NETINET_TCP_DEBUG_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/tcp_fsm.h b/packages/net/bsd_tcpip/current/include/netinet/tcp_fsm.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/tcp_fsm.h @@ -0,0 +1,135 @@ +//========================================================================== +// +// include/netinet/tcp_fsm.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_fsm.h,v 1.14 1999/11/07 04:18:30 jlemon Exp $ + */ + +#ifndef _NETINET_TCP_FSM_H_ +#define _NETINET_TCP_FSM_H_ + +/* + * TCP FSM state definitions. + * Per RFC793, September, 1981. + */ + +#define TCP_NSTATES 11 + +#define TCPS_CLOSED 0 /* closed */ +#define TCPS_LISTEN 1 /* listening for connection */ +#define TCPS_SYN_SENT 2 /* active, have sent syn */ +#define TCPS_SYN_RECEIVED 3 /* have send and received syn */ +/* states < TCPS_ESTABLISHED are those where connections not established */ +#define TCPS_ESTABLISHED 4 /* established */ +#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ +/* states > TCPS_CLOSE_WAIT are those where user has closed */ +#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ +#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ +#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ +/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ +#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ +#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ + +/* for KAME src sync over BSD*'s */ +#define TCP6_NSTATES TCP_NSTATES +#define TCP6S_CLOSED TCPS_CLOSED +#define TCP6S_LISTEN TCPS_LISTEN +#define TCP6S_SYN_SENT TCPS_SYN_SENT +#define TCP6S_SYN_RECEIVED TCPS_SYN_RECEIVED +#define TCP6S_ESTABLISHED TCPS_ESTABLISHED +#define TCP6S_CLOSE_WAIT TCPS_CLOSE_WAIT +#define TCP6S_FIN_WAIT_1 TCPS_FIN_WAIT_1 +#define TCP6S_CLOSING TCPS_CLOSING +#define TCP6S_LAST_ACK TCPS_LAST_ACK +#define TCP6S_FIN_WAIT_2 TCPS_FIN_WAIT_2 +#define TCP6S_TIME_WAIT TCPS_TIME_WAIT + +#define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED) +#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED) +#define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT) + +#ifdef TCPOUTFLAGS +/* + * Flags used when sending segments in tcp_output. + * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally + * determined by state, with the proviso that TH_FIN is sent only + * if all data queued for output is included in the segment. + */ +static u_char tcp_outflags[TCP_NSTATES] = { + TH_RST|TH_ACK, /* 0, CLOSED */ + 0, /* 1, LISTEN */ + TH_SYN, /* 2, SYN_SENT */ + TH_SYN|TH_ACK, /* 3, SYN_RECEIVED */ + TH_ACK, /* 4, ESTABLISHED */ + TH_ACK, /* 5, CLOSE_WAIT */ + TH_FIN|TH_ACK, /* 6, FIN_WAIT_1 */ + TH_FIN|TH_ACK, /* 7, CLOSING */ + TH_FIN|TH_ACK, /* 8, LAST_ACK */ + TH_ACK, /* 9, FIN_WAIT_2 */ + TH_ACK, /* 10, TIME_WAIT */ +}; +#endif + +#ifdef KPROF +int tcp_acounts[TCP_NSTATES][PRU_NREQ]; +#endif + +#ifdef TCPSTATES +char *tcpstates[] = { + "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", + "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING", + "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT", +}; +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/tcp_seq.h b/packages/net/bsd_tcpip/current/include/netinet/tcp_seq.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/tcp_seq.h @@ -0,0 +1,105 @@ +//========================================================================== +// +// include/netinet/tcp_seq.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1993, 1995 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_seq.h 8.3 (Berkeley) 6/21/95 + * $FreeBSD: src/sys/netinet/tcp_seq.h,v 1.11.2.5 2001/08/22 00:59:12 silby Exp $ + */ + +#ifndef _NETINET_TCP_SEQ_H_ +#define _NETINET_TCP_SEQ_H_ +/* + * TCP sequence numbers are 32 bit integers operated + * on with modular arithmetic. These macros can be + * used to compare such integers. + */ +#define SEQ_LT(a,b) ((int)((a)-(b)) < 0) +#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) +#define SEQ_GT(a,b) ((int)((a)-(b)) > 0) +#define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) + +/* for modulo comparisons of timestamps */ +#define TSTMP_LT(a,b) ((int)((a)-(b)) < 0) +#define TSTMP_GEQ(a,b) ((int)((a)-(b)) >= 0) + +/* + * TCP connection counts are 32 bit integers operated + * on with modular arithmetic. These macros can be + * used to compare such integers. + */ +#define CC_LT(a,b) ((int)((a)-(b)) < 0) +#define CC_LEQ(a,b) ((int)((a)-(b)) <= 0) +#define CC_GT(a,b) ((int)((a)-(b)) > 0) +#define CC_GEQ(a,b) ((int)((a)-(b)) >= 0) + +/* Macro to increment a CC: skip 0 which has a special meaning */ +#define CC_INC(c) (++(c) == 0 ? ++(c) : (c)) + +/* + * Macros to initialize tcp sequence numbers for + * send and receive from initial send and receive + * sequence numbers. + */ +#define tcp_rcvseqinit(tp) \ + (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 + +#define tcp_sendseqinit(tp) \ + (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ + (tp)->iss + +#define TCP_PAWS_IDLE (24 * 24 * 60 * 60 * hz) + /* timestamp wrap-around time */ + +#ifdef _KERNEL +extern tcp_cc tcp_ccgen; /* global connection count */ +#endif /* _KERNEL */ +#endif /* _NETINET_TCP_SEQ_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/tcp_timer.h b/packages/net/bsd_tcpip/current/include/netinet/tcp_timer.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/tcp_timer.h @@ -0,0 +1,160 @@ +//========================================================================== +// +// include/netinet/tcp_timer.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_timer.h,v 1.18 1999/12/29 04:41:03 peter Exp $ + */ + +#ifndef _NETINET_TCP_TIMER_H_ +#define _NETINET_TCP_TIMER_H_ + +/* + * The TCPT_REXMT timer is used to force retransmissions. + * The TCP has the TCPT_REXMT timer set whenever segments + * have been sent for which ACKs are expected but not yet + * received. If an ACK is received which advances tp->snd_una, + * then the retransmit timer is cleared (if there are no more + * outstanding segments) or reset to the base value (if there + * are more ACKs expected). Whenever the retransmit timer goes off, + * we retransmit one unacknowledged segment, and do a backoff + * on the retransmit timer. + * + * The TCPT_PERSIST timer is used to keep window size information + * flowing even if the window goes shut. If all previous transmissions + * have been acknowledged (so that there are no retransmissions in progress), + * and the window is too small to bother sending anything, then we start + * the TCPT_PERSIST timer. When it expires, if the window is nonzero, + * we go to transmit state. Otherwise, at intervals send a single byte + * into the peer's window to force him to update our window information. + * We do this at most as often as TCPT_PERSMIN time intervals, + * but no more frequently than the current estimate of round-trip + * packet time. The TCPT_PERSIST timer is cleared whenever we receive + * a window update from the peer. + * + * The TCPT_KEEP timer is used to keep connections alive. If an + * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time, + * but not yet established, then we drop the connection. Once the connection + * is established, if the connection is idle for TCPTV_KEEP_IDLE time + * (and keepalives have been enabled on the socket), we begin to probe + * the connection. We force the peer to send us a segment by sending: + * + * This segment is (deliberately) outside the window, and should elicit + * an ack segment in response from the peer. If, despite the TCPT_KEEP + * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE + * amount of time probing, then we drop the connection. + */ + +/* + * Time constants. + */ +#define TCPTV_MSL ( 30*hz) /* max seg lifetime (hah!) */ +#define TCPTV_SRTTBASE 0 /* base roundtrip time; + if 0, no idea yet */ +#define TCPTV_RTOBASE ( 3*hz) /* assumed RTO if no info */ +#define TCPTV_SRTTDFLT ( 3*hz) /* assumed RTT if no info */ + +#define TCPTV_PERSMIN ( 5*hz) /* retransmit persistence */ +#define TCPTV_PERSMAX ( 60*hz) /* maximum persist interval */ + +#define TCPTV_KEEP_INIT ( 75*hz) /* initial connect keepalive */ +#define TCPTV_KEEP_IDLE (120*60*hz) /* dflt time before probing */ +#define TCPTV_KEEPINTVL ( 75*hz) /* default probe interval */ +#define TCPTV_KEEPCNT 8 /* max probes before drop */ + +#define TCPTV_MIN ( 1*hz) /* minimum allowable value */ +#define TCPTV_REXMTMAX ( 64*hz) /* max allowable REXMT value */ + +#define TCPTV_TWTRUNC 8 /* RTO factor to truncate TW */ + +#define TCP_LINGERTIME 120 /* linger at most 2 minutes */ + +#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */ + +#define TCPTV_DELACK (hz / PR_FASTHZ / 2) /* 100ms timeout */ + +#ifdef TCPTIMERS +static char *tcptimers[] = + { "REXMT", "PERSIST", "KEEP", "2MSL" }; +#endif + +/* + * Force a time value to be in a certain range. + */ +#define TCPT_RANGESET(tv, value, tvmin, tvmax) do { \ + (tv) = (value); \ + if ((u_long)(tv) < (u_long)(tvmin)) \ + (tv) = (tvmin); \ + else if ((u_long)(tv) > (u_long)(tvmax)) \ + (tv) = (tvmax); \ +} while(0) + +#ifdef _KERNEL +extern int tcp_keepinit; /* time to establish connection */ +extern int tcp_keepidle; /* time before keepalive probes begin */ +extern int tcp_keepintvl; /* time between keepalive probes */ +extern int tcp_maxidle; /* time to drop after starting probes */ +extern int tcp_delacktime; /* time before sending a delayed ACK */ +extern int tcp_maxpersistidle; +extern int tcp_msl; +extern int tcp_ttl; /* time to live for TCP segs */ +extern int tcp_backoff[]; + +void tcp_timer_2msl __P((void *xtp)); +void tcp_timer_keep __P((void *xtp)); +void tcp_timer_persist __P((void *xtp)); +void tcp_timer_rexmt __P((void *xtp)); +void tcp_timer_delack __P((void *xtp)); + +#endif /* _KERNEL */ + +#endif /* !_NETINET_TCP_TIMER_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/tcp_var.h b/packages/net/bsd_tcpip/current/include/netinet/tcp_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/tcp_var.h @@ -0,0 +1,438 @@ +//========================================================================== +// +// include/netinet/tcp_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1993, 1994, 1995 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_var.h 8.4 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet/tcp_var.h,v 1.56.2.8 2001/08/22 00:59:13 silby Exp $ + */ + +#ifndef _NETINET_TCP_VAR_H_ +#define _NETINET_TCP_VAR_H_ +/* + * Kernel variables for tcp. + */ + +/* TCP segment queue entry */ +struct tseg_qent { + LIST_ENTRY(tseg_qent) tqe_q; + int tqe_len; /* TCP segment data length */ + struct tcphdr *tqe_th; /* a pointer to tcp header */ + struct mbuf *tqe_m; /* mbuf contains packet */ +}; +LIST_HEAD(tsegqe_head, tseg_qent); +#ifdef MALLOC_DECLARE +MALLOC_DECLARE(M_TSEGQ); +#endif + +struct tcptemp { + u_char tt_ipgen[40]; /* the size must be of max ip header, now IPv6 */ + struct tcphdr tt_t; +}; + +#define tcp6cb tcpcb /* for KAME src sync over BSD*'s */ + +/* + * Tcp control block, one per tcp; fields: + * Organized for 16 byte cacheline efficiency. + */ +struct tcpcb { + struct tsegqe_head t_segq; + int t_dupacks; /* consecutive dup acks recd */ + struct tcptemp *unused; /* unused */ + + struct callout *tt_rexmt; /* retransmit timer */ + struct callout *tt_persist; /* retransmit persistence */ + struct callout *tt_keep; /* keepalive */ + struct callout *tt_2msl; /* 2*msl TIME_WAIT timer */ + struct callout *tt_delack; /* delayed ACK timer */ + + struct inpcb *t_inpcb; /* back pointer to internet pcb */ + int t_state; /* state of this connection */ + u_int t_flags; +#define TF_ACKNOW 0x00001 /* ack peer immediately */ +#define TF_DELACK 0x00002 /* ack, but try to delay it */ +#define TF_NODELAY 0x00004 /* don't delay packets to coalesce */ +#define TF_NOOPT 0x00008 /* don't use tcp options */ +#define TF_SENTFIN 0x00010 /* have sent FIN */ +#define TF_REQ_SCALE 0x00020 /* have/will request window scaling */ +#define TF_RCVD_SCALE 0x00040 /* other side has requested scaling */ +#define TF_REQ_TSTMP 0x00080 /* have/will request timestamps */ +#define TF_RCVD_TSTMP 0x00100 /* a timestamp was received in SYN */ +#define TF_SACK_PERMIT 0x00200 /* other side said I could SACK */ +#define TF_NEEDSYN 0x00400 /* send SYN (implicit state) */ +#define TF_NEEDFIN 0x00800 /* send FIN (implicit state) */ +#define TF_NOPUSH 0x01000 /* don't push */ +#define TF_REQ_CC 0x02000 /* have/will request CC */ +#define TF_RCVD_CC 0x04000 /* a CC was received in SYN */ +#define TF_SENDCCNEW 0x08000 /* send CCnew instead of CC in SYN */ +#define TF_MORETOCOME 0x10000 /* More data to be appended to sock */ +#define TF_LQ_OVERFLOW 0x20000 /* listen queue overflow */ + int t_force; /* 1 if forcing out a byte */ + + tcp_seq snd_una; /* send unacknowledged */ + tcp_seq snd_max; /* highest sequence number sent; + * used to recognize retransmits + */ + tcp_seq snd_nxt; /* send next */ + tcp_seq snd_up; /* send urgent pointer */ + + tcp_seq snd_wl1; /* window update seg seq number */ + tcp_seq snd_wl2; /* window update seg ack number */ + tcp_seq iss; /* initial send sequence number */ + tcp_seq irs; /* initial receive sequence number */ + + tcp_seq rcv_nxt; /* receive next */ + tcp_seq rcv_adv; /* advertised window */ + u_long rcv_wnd; /* receive window */ + tcp_seq rcv_up; /* receive urgent pointer */ + + u_long snd_wnd; /* send window */ + u_long snd_cwnd; /* congestion-controlled window */ + u_long snd_ssthresh; /* snd_cwnd size threshold for + * for slow start exponential to + * linear switch + */ + tcp_seq snd_recover; /* for use in fast recovery */ + + u_int t_maxopd; /* mss plus options */ + + u_long t_rcvtime; /* inactivity time */ + u_long t_starttime; /* time connection was established */ + int t_rtttime; /* round trip time */ + tcp_seq t_rtseq; /* sequence number being timed */ + + int t_rxtcur; /* current retransmit value (ticks) */ + u_int t_maxseg; /* maximum segment size */ + int t_srtt; /* smoothed round-trip time */ + int t_rttvar; /* variance in round-trip time */ + + int t_rxtshift; /* log(2) of rexmt exp. backoff */ + u_int t_rttmin; /* minimum rtt allowed */ + u_long t_rttupdated; /* number of times rtt sampled */ + u_long max_sndwnd; /* largest window peer has offered */ + + int t_softerror; /* possible error not yet reported */ +/* out-of-band data */ + char t_oobflags; /* have some */ + char t_iobc; /* input character */ +#define TCPOOB_HAVEDATA 0x01 +#define TCPOOB_HADDATA 0x02 +/* RFC 1323 variables */ + u_char snd_scale; /* window scaling for send window */ + u_char rcv_scale; /* window scaling for recv window */ + u_char request_r_scale; /* pending window scaling */ + u_char requested_s_scale; + u_long ts_recent; /* timestamp echo data */ + + u_long ts_recent_age; /* when last updated */ + tcp_seq last_ack_sent; +/* RFC 1644 variables */ + tcp_cc cc_send; /* send connection count */ + tcp_cc cc_recv; /* receive connection count */ +/* experimental */ + u_long snd_cwnd_prev; /* cwnd prior to retransmit */ + u_long snd_ssthresh_prev; /* ssthresh prior to retransmit */ + u_long t_badrxtwin; /* window for retransmit recovery */ +}; + +/* + * Structure to hold TCP options that are only used during segment + * processing (in tcp_input), but not held in the tcpcb. + * It's basically used to reduce the number of parameters + * to tcp_dooptions. + */ +struct tcpopt { + u_long to_flag; /* which options are present */ +#define TOF_TS 0x0001 /* timestamp */ +#define TOF_CC 0x0002 /* CC and CCnew are exclusive */ +#define TOF_CCNEW 0x0004 +#define TOF_CCECHO 0x0008 + u_long to_tsval; + u_long to_tsecr; + tcp_cc to_cc; /* holds CC or CCnew */ + tcp_cc to_ccecho; +}; + +/* + * The TAO cache entry which is stored in the protocol family specific + * portion of the route metrics. + */ +struct rmxp_tao { + tcp_cc tao_cc; /* latest CC in valid SYN */ + tcp_cc tao_ccsent; /* latest CC sent to peer */ + u_short tao_mssopt; /* peer's cached MSS */ +#ifdef notyet + u_short tao_flags; /* cache status flags */ +#define TAOF_DONT 0x0001 /* peer doesn't understand rfc1644 */ +#define TAOF_OK 0x0002 /* peer does understand rfc1644 */ +#define TAOF_UNDEF 0 /* we don't know yet */ +#endif /* notyet */ +}; +#define rmx_taop(r) ((struct rmxp_tao *)(r).rmx_filler) + +#define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb) +#define sototcpcb(so) (intotcpcb(sotoinpcb(so))) + +/* + * The smoothed round-trip time and estimated variance + * are stored as fixed point numbers scaled by the values below. + * For convenience, these scales are also used in smoothing the average + * (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed). + * With these scales, srtt has 3 bits to the right of the binary point, + * and thus an "ALPHA" of 0.875. rttvar has 2 bits to the right of the + * binary point, and is smoothed with an ALPHA of 0.75. + */ +#define TCP_RTT_SCALE 32 /* multiplier for srtt; 3 bits frac. */ +#define TCP_RTT_SHIFT 5 /* shift for srtt; 3 bits frac. */ +#define TCP_RTTVAR_SCALE 16 /* multiplier for rttvar; 2 bits */ +#define TCP_RTTVAR_SHIFT 4 /* shift for rttvar; 2 bits */ +#define TCP_DELTA_SHIFT 2 /* see tcp_input.c */ + +/* + * The initial retransmission should happen at rtt + 4 * rttvar. + * Because of the way we do the smoothing, srtt and rttvar + * will each average +1/2 tick of bias. When we compute + * the retransmit timer, we want 1/2 tick of rounding and + * 1 extra tick because of +-1/2 tick uncertainty in the + * firing of the timer. The bias will give us exactly the + * 1.5 tick we need. But, because the bias is + * statistical, we have to test that we don't drop below + * the minimum feasible timer (which is 2 ticks). + * This version of the macro adapted from a paper by Lawrence + * Brakmo and Larry Peterson which outlines a problem caused + * by insufficient precision in the original implementation, + * which results in inappropriately large RTO values for very + * fast networks. + */ +#define TCP_REXMTVAL(tp) \ + max((tp)->t_rttmin, (((tp)->t_srtt >> (TCP_RTT_SHIFT - TCP_DELTA_SHIFT)) \ + + (tp)->t_rttvar) >> TCP_DELTA_SHIFT) + +/* + * TCP statistics. + * Many of these should be kept per connection, + * but that's inconvenient at the moment. + */ +struct tcpstat { + u_long tcps_connattempt; /* connections initiated */ + u_long tcps_accepts; /* connections accepted */ + u_long tcps_connects; /* connections established */ + u_long tcps_drops; /* connections dropped */ + u_long tcps_conndrops; /* embryonic connections dropped */ + u_long tcps_closed; /* conn. closed (includes drops) */ + u_long tcps_segstimed; /* segs where we tried to get rtt */ + u_long tcps_rttupdated; /* times we succeeded */ + u_long tcps_delack; /* delayed acks sent */ + u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ + u_long tcps_rexmttimeo; /* retransmit timeouts */ + u_long tcps_persisttimeo; /* persist timeouts */ + u_long tcps_keeptimeo; /* keepalive timeouts */ + u_long tcps_keepprobe; /* keepalive probes sent */ + u_long tcps_keepdrops; /* connections dropped in keepalive */ + + u_long tcps_sndtotal; /* total packets sent */ + u_long tcps_sndpack; /* data packets sent */ + u_long tcps_sndbyte; /* data bytes sent */ + u_long tcps_sndrexmitpack; /* data packets retransmitted */ + u_long tcps_sndrexmitbyte; /* data bytes retransmitted */ + u_long tcps_sndacks; /* ack-only packets sent */ + u_long tcps_sndprobe; /* window probes sent */ + u_long tcps_sndurg; /* packets sent with URG only */ + u_long tcps_sndwinup; /* window update-only packets sent */ + u_long tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ + + u_long tcps_rcvtotal; /* total packets received */ + u_long tcps_rcvpack; /* packets received in sequence */ + u_long tcps_rcvbyte; /* bytes received in sequence */ + u_long tcps_rcvbadsum; /* packets received with ccksum errs */ + u_long tcps_rcvbadoff; /* packets received with bad offset */ + u_long tcps_rcvmemdrop; /* packets dropped for lack of memory */ + u_long tcps_rcvshort; /* packets received too short */ + u_long tcps_rcvduppack; /* duplicate-only packets received */ + u_long tcps_rcvdupbyte; /* duplicate-only bytes received */ + u_long tcps_rcvpartduppack; /* packets with some duplicate data */ + u_long tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ + u_long tcps_rcvoopack; /* out-of-order packets received */ + u_long tcps_rcvoobyte; /* out-of-order bytes received */ + u_long tcps_rcvpackafterwin; /* packets with data after window */ + u_long tcps_rcvbyteafterwin; /* bytes rcvd after window */ + u_long tcps_rcvafterclose; /* packets rcvd after "close" */ + u_long tcps_rcvwinprobe; /* rcvd window probe packets */ + u_long tcps_rcvdupack; /* rcvd duplicate acks */ + u_long tcps_rcvacktoomuch; /* rcvd acks for unsent data */ + u_long tcps_rcvackpack; /* rcvd ack packets */ + u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */ + u_long tcps_rcvwinupd; /* rcvd window update packets */ + u_long tcps_pawsdrop; /* segments dropped due to PAWS */ + u_long tcps_predack; /* times hdr predict ok for acks */ + u_long tcps_preddat; /* times hdr predict ok for data pkts */ + u_long tcps_pcbcachemiss; + u_long tcps_cachedrtt; /* times cached RTT in route updated */ + u_long tcps_cachedrttvar; /* times cached rttvar updated */ + u_long tcps_cachedssthresh; /* times cached ssthresh updated */ + u_long tcps_usedrtt; /* times RTT initialized from route */ + u_long tcps_usedrttvar; /* times RTTVAR initialized from rt */ + u_long tcps_usedssthresh; /* times ssthresh initialized from rt*/ + u_long tcps_persistdrop; /* timeout in persist state */ + u_long tcps_badsyn; /* bogus SYN, e.g. premature ACK */ + u_long tcps_mturesent; /* resends due to MTU discovery */ + u_long tcps_listendrop; /* listen queue overflows */ +}; + +/* + * TCB structure exported to user-land via sysctl(3). + * Evil hack: declare only if in_pcb.h and sys/socketvar.h have been + * included. Not all of our clients do. + */ +#if defined(_NETINET_IN_PCB_H_) && defined(_SYS_SOCKETVAR_H_) +struct xtcpcb { + size_t xt_len; + struct inpcb xt_inp; + struct tcpcb xt_tp; + struct xsocket xt_socket; + u_quad_t xt_alignment_hack; +}; +#endif + +/* + * Names for TCP sysctl objects + */ +#define TCPCTL_DO_RFC1323 1 /* use RFC-1323 extensions */ +#define TCPCTL_DO_RFC1644 2 /* use RFC-1644 extensions */ +#define TCPCTL_MSSDFLT 3 /* MSS default */ +#define TCPCTL_STATS 4 /* statistics (read-only) */ +#define TCPCTL_RTTDFLT 5 /* default RTT estimate */ +#define TCPCTL_KEEPIDLE 6 /* keepalive idle timer */ +#define TCPCTL_KEEPINTVL 7 /* interval to send keepalives */ +#define TCPCTL_SENDSPACE 8 /* send buffer space */ +#define TCPCTL_RECVSPACE 9 /* receive buffer space */ +#define TCPCTL_KEEPINIT 10 /* timeout for establishing syn */ +#define TCPCTL_PCBLIST 11 /* list of all outstanding PCBs */ +#define TCPCTL_DELACKTIME 12 /* time before sending delayed ACK */ +#define TCPCTL_V6MSSDFLT 13 /* MSS default for IPv6 */ +#define TCPCTL_MAXID 14 + +#define TCPCTL_NAMES { \ + { 0, 0 }, \ + { "rfc1323", CTLTYPE_INT }, \ + { "rfc1644", CTLTYPE_INT }, \ + { "mssdflt", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "rttdflt", CTLTYPE_INT }, \ + { "keepidle", CTLTYPE_INT }, \ + { "keepintvl", CTLTYPE_INT }, \ + { "sendspace", CTLTYPE_INT }, \ + { "recvspace", CTLTYPE_INT }, \ + { "keepinit", CTLTYPE_INT }, \ + { "pcblist", CTLTYPE_STRUCT }, \ + { "delacktime", CTLTYPE_INT }, \ + { "v6mssdflt", CTLTYPE_INT }, \ +} + + +#ifdef _KERNEL +#ifdef SYSCTL_DECL +SYSCTL_DECL(_net_inet_tcp); +#endif + +extern struct inpcbhead tcb; /* head of queue of active tcpcb's */ +extern struct inpcbinfo tcbinfo; +extern struct tcpstat tcpstat; /* tcp statistics */ +extern int tcp_mssdflt; /* XXX */ +extern int tcp_delack_enabled; +extern int tcp_do_newreno; +extern int ss_fltsz; +extern int ss_fltsz_local; + +void tcp_canceltimers __P((struct tcpcb *)); +struct tcpcb * + tcp_close __P((struct tcpcb *)); +void tcp_ctlinput __P((int, struct sockaddr *, void *)); +int tcp_ctloutput __P((struct socket *, struct sockopt *)); +struct tcpcb * + tcp_drop __P((struct tcpcb *, int)); +void tcp_drain __P((void)); +void tcp_fasttimo __P((void)); +struct rmxp_tao * + tcp_gettaocache __P((struct inpcb *)); +void tcp_init __P((void)); +void tcp_input __P((struct mbuf *, int)); +void tcp_mss __P((struct tcpcb *, int)); +int tcp_mssopt __P((struct tcpcb *)); +void tcp_drop_syn_sent __P((struct inpcb *, int)); +void tcp_mtudisc __P((struct inpcb *, int)); +struct tcpcb * + tcp_newtcpcb __P((struct inpcb *)); +int tcp_output __P((struct tcpcb *)); +void tcp_quench __P((struct inpcb *, int)); +void tcp_respond __P((struct tcpcb *, void *, + struct tcphdr *, struct mbuf *, tcp_seq, tcp_seq, int)); +struct rtentry * + tcp_rtlookup __P((struct inpcb *)); +void tcp_setpersist __P((struct tcpcb *)); +void tcp_slowtimo __P((void)); +struct tcptemp * + tcp_maketemplate __P((struct tcpcb *)); +void tcp_fillheaders __P((struct tcpcb *, void *, void *)); +struct tcpcb * + tcp_timers __P((struct tcpcb *, int)); +void tcp_trace __P((int, int, struct tcpcb *, void *, struct tcphdr *, + int)); + +extern struct pr_usrreqs tcp_usrreqs; +extern u_long tcp_sendspace; +extern u_long tcp_recvspace; +tcp_seq tcp_new_isn __P((struct tcpcb *)); + +#endif /* _KERNEL */ + +#endif /* _NETINET_TCP_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet/tcpip.h b/packages/net/bsd_tcpip/current/include/netinet/tcpip.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/tcpip.h @@ -0,0 +1,94 @@ +//========================================================================== +// +// include/netinet/tcpip.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcpip.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcpip.h,v 1.8 1999/08/28 00:49:34 peter Exp $ + */ + +#ifndef _NETINET_TCPIP_H_ +#define _NETINET_TCPIP_H_ + +/* + * Tcp+ip header, after ip options removed. + */ +struct tcpiphdr { + struct ipovly ti_i; /* overlaid ip structure */ + struct tcphdr ti_t; /* tcp header */ +}; +#ifdef notyet +/* + * Tcp+ip header, after ip options removed but including TCP options. + */ +struct full_tcpiphdr { + struct ipovly ti_i; /* overlaid ip structure */ + struct tcphdr ti_t; /* tcp header */ + char ti_o[TCP_MAXOLEN]; /* space for tcp options */ +}; +#endif /* notyet */ +#define ti_x1 ti_i.ih_x1 +#define ti_pr ti_i.ih_pr +#define ti_len ti_i.ih_len +#define ti_src ti_i.ih_src +#define ti_dst ti_i.ih_dst +#define ti_sport ti_t.th_sport +#define ti_dport ti_t.th_dport +#define ti_seq ti_t.th_seq +#define ti_ack ti_t.th_ack +#define ti_x2 ti_t.th_x2 +#define ti_off ti_t.th_off +#define ti_flags ti_t.th_flags +#define ti_win ti_t.th_win +#define ti_sum ti_t.th_sum +#define ti_urp ti_t.th_urp + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/udp.h b/packages/net/bsd_tcpip/current/include/netinet/udp.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/udp.h @@ -0,0 +1,72 @@ +//========================================================================== +// +// include/netinet/udp.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)udp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/udp.h,v 1.7 1999/08/28 00:49:34 peter Exp $ + */ + +#ifndef _NETINET_UDP_H_ +#define _NETINET_UDP_H_ + +/* + * Udp protocol header. + * Per RFC 768, September, 1981. + */ +struct udphdr { + u_short uh_sport; /* source port */ + u_short uh_dport; /* destination port */ + u_short uh_ulen; /* udp length */ + u_short uh_sum; /* udp checksum */ +} __attribute__ ((aligned(1), packed)); + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet/udp_var.h b/packages/net/bsd_tcpip/current/include/netinet/udp_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet/udp_var.h @@ -0,0 +1,115 @@ +//========================================================================== +// +// include/netinet/udp_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1989, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/udp_var.h,v 1.22.2.1 2001/02/18 07:12:25 luigi Exp $ + */ + +#ifndef _NETINET_UDP_VAR_H_ +#define _NETINET_UDP_VAR_H_ + +/* + * UDP kernel structures and variables. + */ +struct udpiphdr { + struct ipovly ui_i; /* overlaid ip structure */ + struct udphdr ui_u; /* udp header */ +}; +#define ui_x1 ui_i.ih_x1 +#define ui_pr ui_i.ih_pr +#define ui_len ui_i.ih_len +#define ui_src ui_i.ih_src +#define ui_dst ui_i.ih_dst +#define ui_sport ui_u.uh_sport +#define ui_dport ui_u.uh_dport +#define ui_ulen ui_u.uh_ulen +#define ui_sum ui_u.uh_sum + +struct udpstat { + /* input statistics: */ + u_long udps_ipackets; /* total input packets */ + u_long udps_hdrops; /* packet shorter than header */ + u_long udps_badsum; /* checksum error */ + u_long udps_nosum; /* no checksum */ + u_long udps_badlen; /* data length larger than packet */ + u_long udps_noport; /* no socket on port */ + u_long udps_noportbcast; /* of above, arrived as broadcast */ + u_long udps_fullsock; /* not delivered, input socket full */ + u_long udpps_pcbcachemiss; /* input packets missing pcb cache */ + u_long udpps_pcbhashmiss; /* input packets not for hashed pcb */ + /* output statistics: */ + u_long udps_opackets; /* total output packets */ + u_long udps_fastout; /* output packets on fast path */ + /* of no socket on port, arrived as multicast */ + u_long udps_noportmcast; +}; + +#ifdef _KERNEL + +extern struct pr_usrreqs udp_usrreqs; +extern struct inpcbhead udb; +extern struct inpcbinfo udbinfo; +extern u_long udp_sendspace; +extern u_long udp_recvspace; +extern struct udpstat udpstat; +extern int log_in_vain; + +void udp_ctlinput __P((int, struct sockaddr *, void *)); +void udp_init __P((void)); +void udp_input __P((struct mbuf *, int)); + +void udp_notify __P((struct inpcb *inp, int _errno)); +int udp_shutdown __P((struct socket *so)); +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet6/in6.h b/packages/net/bsd_tcpip/current/include/netinet6/in6.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/in6.h @@ -0,0 +1,934 @@ +//========================================================================== +// +// include/netinet6/in6.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: in6.h,v 1.115 2002/01/02 06:43:13 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in.h 8.3 (Berkeley) 1/3/94 + */ + +#ifndef __KAME_NETINET_IN_H_INCLUDED_ +#error "do not include netinet6/in6.h directly, include netinet/in.h. see RFC2553" +#endif + +#ifndef _NETINET6_IN6_H_ +#define _NETINET6_IN6_H_ + +/* + * Identification of the network protocol stack + * for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE + * has the table of implementation/integration differences. + */ +#define __KAME__ +#define __KAME_VERSION "SNAP 20020107" + +/* + * Local port number conventions: + * + * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root), + * unless a kernel is compiled with IPNOPRIVPORTS defined. + * + * When a user does a bind(2) or connect(2) with a port number of zero, + * a non-conflicting local port address is chosen. + * + * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although + * that is settable by sysctl(3); net.inet.ip.anonportmin and + * net.inet.ip.anonportmax respectively. + * + * A user may set the IPPROTO_IP option IP_PORTRANGE to change this + * default assignment range. + * + * The value IP_PORTRANGE_DEFAULT causes the default behavior. + * + * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT, + * and exists only for FreeBSD compatibility purposes. + * + * The value IP_PORTRANGE_LOW changes the range to the "low" are + * that is (by convention) restricted to privileged processes. + * This convention is based on "vouchsafe" principles only. + * It is only secure if you trust the remote host to restrict these ports. + * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX. + */ + +#define IPV6PORT_RESERVED 1024 +#define IPV6PORT_ANONMIN 49152 +#define IPV6PORT_ANONMAX 65535 +#define IPV6PORT_RESERVEDMIN 600 +#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1) + +/* + * IPv6 address + */ +struct in6_addr { + union { + u_int8_t __u6_addr8[16]; + u_int16_t __u6_addr16[8]; + u_int32_t __u6_addr32[4]; + } __u6_addr; /* 128-bit IP6 address */ +}; + +#define s6_addr __u6_addr.__u6_addr8 +#ifdef _KERNEL /* XXX nonstandard */ +#define s6_addr8 __u6_addr.__u6_addr8 +#define s6_addr16 __u6_addr.__u6_addr16 +#define s6_addr32 __u6_addr.__u6_addr32 +#endif + +#define INET6_ADDRSTRLEN 46 + +/* + * Socket address for IPv6 + */ +#ifndef _XOPEN_SOURCE +#define SIN6_LEN +#endif +struct sockaddr_in6 { + u_int8_t sin6_len; /* length of this struct(sa_family_t)*/ + u_int8_t sin6_family; /* AF_INET6 (sa_family_t) */ + u_int16_t sin6_port; /* Transport layer port # (in_port_t)*/ + u_int32_t sin6_flowinfo; /* IP6 flow information */ + struct in6_addr sin6_addr; /* IP6 address */ + u_int32_t sin6_scope_id; /* scope zone index */ +}; + +/* + * Local definition for masks + */ +#ifdef _KERNEL /* XXX nonstandard */ +#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}} +#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}} +#endif + +#ifdef _KERNEL +extern const struct sockaddr_in6 sa6_any; + +extern const struct in6_addr in6mask0; +extern const struct in6_addr in6mask32; +extern const struct in6_addr in6mask64; +extern const struct in6_addr in6mask96; +extern const struct in6_addr in6mask128; +#endif /* _KERNEL */ + +/* + * Macros started with IPV6_ADDR is KAME local + */ +#ifdef _KERNEL /* XXX nonstandard */ +#if BYTE_ORDER == BIG_ENDIAN +#define IPV6_ADDR_INT32_ONE 1 +#define IPV6_ADDR_INT32_TWO 2 +#define IPV6_ADDR_INT32_MNL 0xff010000 +#define IPV6_ADDR_INT32_MLL 0xff020000 +#define IPV6_ADDR_INT32_SMP 0x0000ffff +#define IPV6_ADDR_INT16_ULL 0xfe80 +#define IPV6_ADDR_INT16_USL 0xfec0 +#define IPV6_ADDR_INT16_MLL 0xff02 +#elif BYTE_ORDER == LITTLE_ENDIAN +#define IPV6_ADDR_INT32_ONE 0x01000000 +#define IPV6_ADDR_INT32_TWO 0x02000000 +#define IPV6_ADDR_INT32_MNL 0x000001ff +#define IPV6_ADDR_INT32_MLL 0x000002ff +#define IPV6_ADDR_INT32_SMP 0xffff0000 +#define IPV6_ADDR_INT16_ULL 0x80fe +#define IPV6_ADDR_INT16_USL 0xc0fe +#define IPV6_ADDR_INT16_MLL 0x02ff +#endif +#endif + +/* + * Definition of some useful macros to handle IP6 addresses + */ +#define IN6ADDR_ANY_INIT \ + {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6ADDR_LOOPBACK_INIT \ + {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_NODELOCAL_ALLNODES_INIT \ + {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \ + {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \ + {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ + {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}} + +extern const struct in6_addr in6addr_any; +extern const struct in6_addr in6addr_loopback; +extern const struct in6_addr in6addr_nodelocal_allnodes; +extern const struct in6_addr in6addr_linklocal_allnodes; +extern const struct in6_addr in6addr_linklocal_allrouters; + +/* + * Equality + * NOTE: Some of kernel programming environment (for example, openbsd/sparc) + * does not supply memcmp(). For userland memcmp() is preferred as it is + * in ANSI standard. + */ +#ifdef _KERNEL +#define IN6_ARE_ADDR_EQUAL(a, b) \ + (bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) +#else +#define IN6_ARE_ADDR_EQUAL(a, b) \ + (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) +#endif + +#ifdef _KERNEL /* non standard */ +/* see if two addresses are equal in a scope-conscious manner. */ +#define SA6_ARE_ADDR_EQUAL(a, b) \ + (((a)->sin6_scope_id == 0 || (b)->sin6_scope_id == 0 || \ + ((a)->sin6_scope_id == (b)->sin6_scope_id)) && \ + (bcmp(&(a)->sin6_addr, &(b)->sin6_addr, sizeof(struct in6_addr)) == 0)) +#endif + +/* + * Unspecified + */ +#define IN6_IS_ADDR_UNSPECIFIED(a) \ + ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == 0)) + +/* + * Loopback + */ +#define IN6_IS_ADDR_LOOPBACK(a) \ + ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1))) + +/* + * IPv4 compatible + */ +#define IN6_IS_ADDR_V4COMPAT(a) \ + ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1))) + +/* + * Mapped + */ +#define IN6_IS_ADDR_V4MAPPED(a) \ + ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff))) + +/* + * KAME Scope Values + */ + +#ifdef _KERNEL /* XXX nonstandard */ +#define IPV6_ADDR_SCOPE_NODELOCAL 0x01 +#define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 +#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 +#define IPV6_ADDR_SCOPE_SITELOCAL 0x05 +#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ +#define IPV6_ADDR_SCOPE_GLOBAL 0x0e +#else +#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01 +#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 +#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02 +#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 +#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ +#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e +#endif + +/* + * Unicast Scope + * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373). + */ +#define IN6_IS_ADDR_LINKLOCAL(a) \ + (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) +#define IN6_IS_ADDR_SITELOCAL(a) \ + (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) + +/* + * Multicast + */ +#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) + +#ifdef _KERNEL /* XXX nonstandard */ +#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) +#else +#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) +#endif + +/* + * Multicast Scope + */ +#ifdef _KERNEL /* refers nonstandard items */ +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL)) +#define IN6_IS_ADDR_MC_INTFACELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL)) +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL)) +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL)) +#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL)) +#define IN6_IS_ADDR_MC_GLOBAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL)) +#else +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL)) +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL)) +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL)) +#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL)) +#define IN6_IS_ADDR_MC_GLOBAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL)) +#endif + +#ifdef _KERNEL /* nonstandard */ +/* + * KAME Scope + */ +#define IN6_IS_SCOPE_LINKLOCAL(a) \ + ((IN6_IS_ADDR_LINKLOCAL(a)) || \ + (IN6_IS_ADDR_MC_LINKLOCAL(a))) + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) +#define IFA6_IS_DEPRECATED(a) \ + ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \ + (u_int32_t)((time_second - (a)->ia6_updatetime)) > \ + (a)->ia6_lifetime.ia6t_pltime) +#define IFA6_IS_INVALID(a) \ + ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \ + (u_int32_t)((time_second - (a)->ia6_updatetime)) > \ + (a)->ia6_lifetime.ia6t_vltime) +#else +#define IFA6_IS_DEPRECATED(a) \ + ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \ + (u_int32_t)((time.tv_sec - (a)->ia6_updatetime)) > \ + (a)->ia6_lifetime.ia6t_pltime) +#define IFA6_IS_INVALID(a) \ + ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \ + (u_int32_t)((time.tv_sec - (a)->ia6_updatetime)) > \ + (a)->ia6_lifetime.ia6t_vltime) +#endif +#endif /* _KERNEL */ + +/* + * IP6 route structure + */ +#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) +#ifndef _XOPEN_SOURCE +#ifndef NEW_STRUCT_ROUTE +struct route_in6 { + struct rtentry *ro_rt; + struct sockaddr_in6 ro_dst; +}; +#endif /* !NEW_STRUCT_ROUTE */ +#endif +#endif + +/* + * Options for use with [gs]etsockopt at the IPV6 level. + * First word of comment is data type; bool is stored in int. + */ +/* no hdrincl */ +#if 0 /* the followings are relic in IPv4 and hence are disabled */ +#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */ +#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */ +#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */ +#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */ +#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */ +#endif +#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */ +#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */ +#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */ +#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */ +#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */ +#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */ +#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */ +#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */ +#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */ +/* RFC2292 options */ +#ifdef _KERNEL +#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */ +#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */ +#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */ +#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */ +#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */ +#define IPV6_2292RTHDR 24 /* bool; routing header */ +#define IPV6_2292PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */ +#endif + +#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */ +#define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */ +#ifndef _KERNEL +#define IPV6_BINDV6ONLY IPV6_V6ONLY +#endif + +#if 1 /* IPSEC */ +#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */ +#endif +#define IPV6_FAITH 29 /* bool; accept FAITH'ed connections */ + +#if 1 /* IPV6FIREWALL */ +#define IPV6_FW_ADD 30 /* add a firewall rule to chain */ +#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */ +#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */ +#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */ +#define IPV6_FW_GET 34 /* get entire firewall rule chain */ +#endif + +/* new socket options introduced in RFC2292bis */ +#define IPV6_RTHDRDSTOPTS 35 /* ip6_dest; send dst option before rthdr */ + +#define IPV6_RECVPKTINFO 36 /* bool; recv if, dst addr */ +#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */ +#define IPV6_RECVRTHDR 38 /* bool; recv routing header */ +#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */ +#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */ +#ifdef _KERNEL +#define IPV6_RECVRTHDRDSTOPTS 41 /* bool; recv dst option before rthdr */ +#endif + +#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */ +#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */ + +#define IPV6_PATHMTU 44 /* mtuinfo; get the current path MTU (sopt), + 4 bytes int; MTU notification (cmsg) */ +#define IPV6_REACHCONF 45 /* no data; ND reachability confirm + (cmsg only) */ + +/* more new socket options introduced in RFC2292bis */ +#define IPV6_PKTINFO 46 /* in6_pktinfo; send if, src addr */ +#define IPV6_HOPLIMIT 47 /* int; send hop limit */ +#define IPV6_NEXTHOP 48 /* sockaddr; next hop addr */ +#define IPV6_HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */ +#define IPV6_DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */ +#define IPV6_RTHDR 51 /* ip6_rthdr; send routing header */ +#if 0 +#define IPV6_PKTOPTIONS 52 /* buf/cmsghdr; set/get IPv6 options */ + /* obsoleted by 2292bis */ +#endif + +#ifdef __OpenBSD__ +#define IPV6_AUTH_LEVEL 53 /* int; authentication used */ +#define IPV6_ESP_TRANS_LEVEL 54 /* int; transport encryption */ +#define IPV6_ESP_NETWORK_LEVEL 55 /* int; full-packet encryption */ +#define IPSEC6_OUTSA 56 /* set the outbound SA for a socket */ +#endif + +#define IPV6_RECVTCLASS 57 /* bool; recv traffic class values */ +#ifdef _KERNEL +#define IPV6_OTCLASS 58 /* u_int8_t; send traffic class value */ +#endif +#define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */ + +#ifdef __OpenBSD__ +#define IPV6_IPCOMP_LEVEL 60 /* int; compression */ +#endif + +#define IPV6_TCLASS 61 /* int; send traffic class value */ +#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */ + +/* to define items, should talk with KAME guys first, for *BSD compatibility */ + +#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */ +#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */ +#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */ + +/* + * Defaults and limits for options + */ +#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */ +#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ + +/* + * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. + */ +struct ipv6_mreq { + struct in6_addr ipv6mr_multiaddr; + unsigned int ipv6mr_interface; +}; + +/* + * IPV6_PKTINFO: Packet information(RFC2292 sec 5) + */ +struct in6_pktinfo { + struct in6_addr ipi6_addr; /* src/dst IPv6 address */ + unsigned int ipi6_ifindex; /* send/recv interface index */ +}; + +/* + * Control structure for IPV6_RECVPATHMTU socket option. + * Note that this structure is not fully conformant to rfc2292bis-02. + * However, since how to tell the destination of the path (or the path itself) + * to the application is not determined, we use our original structure. + */ +struct ip6_mtuinfo { + struct sockaddr_in6 ip6m_addr; /* or sockaddr_storage? */ + u_int32_t ip6m_mtu; +}; + +/* + * Argument for IPV6_PORTRANGE: + * - which range to search when port is unspecified at bind() or connect() + */ +#define IPV6_PORTRANGE_DEFAULT 0 /* default range */ +#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ +#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ + +#ifndef _XOPEN_SOURCE +/* + * Definitions for inet6 sysctl operations. + * + * Third level is protocol number. + * Fourth level is desired variable within that protocol. + */ +#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */ + +#define CTL_IPV6PROTO_NAMES { \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { "tcp6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "udp6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { "ip6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { "ipsec6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "icmp6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "pim6", CTLTYPE_NODE }, \ +} + +/* + * Names for IP sysctl objects + */ +#define IPV6CTL_FORWARDING 1 /* act as router */ +#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/ +#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */ +#ifdef notyet +#define IPV6CTL_DEFMTU 4 /* default MTU */ +#endif +#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */ +#define IPV6CTL_STATS 6 /* stats */ +#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */ +#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */ +#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */ +#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */ +#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */ +#define IPV6CTL_ACCEPT_RTADV 12 +#define IPV6CTL_KEEPFAITH 13 +#define IPV6CTL_LOG_INTERVAL 14 +#define IPV6CTL_HDRNESTLIMIT 15 +#define IPV6CTL_DAD_COUNT 16 +#define IPV6CTL_AUTO_FLOWLABEL 17 +#define IPV6CTL_DEFMCASTHLIM 18 +#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */ +#define IPV6CTL_KAME_VERSION 20 +#define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */ +#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */ +#if 0 /* obsolete */ +#define IPV6CTL_MAPPED_ADDR 23 +#endif +#define IPV6CTL_V6ONLY 24 +#ifdef __FreeBSD__ +#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */ +#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */ +#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */ +#endif +#ifdef __NetBSD__ +#define IPV6CTL_ANONPORTMIN 28 /* minimum ephemeral port */ +#define IPV6CTL_ANONPORTMAX 29 /* maximum ephemeral port */ +#define IPV6CTL_LOWPORTMIN 30 /* minimum reserved port */ +#define IPV6CTL_LOWPORTMAX 31 /* maximum reserved port */ +#endif +#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses for + privacy extension */ +#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */ +#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */ +#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */ +#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */ +#define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */ +#define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */ +#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */ + +/* New entries should be added here from current IPV6CTL_MAXID value. */ +/* to define items, should talk with KAME guys first, for *BSD compatibility */ +#define IPV6CTL_MAXID 40 + +#ifdef IPV6CTL_RTEXPIRE +#define __IPV6CTL_NAMES_RTEXPIRE "rtexpire" +#define __IPV6CTL_TYPE_RTEXPIRE CTLTYPE_INT +#define __IPV6CTL_VARS_RTEXPIRE 0 /* &rtq_reallyold */ +#else +#define __IPV6CTL_NAMES_RTEXPIRE 0 +#define __IPV6CTL_TYPE_RTEXPIRE 0 +#define __IPV6CTL_VARS_RTEXPIRE 0 +#endif + +#ifdef IPV6CTL_RTMINEXPIRE +#define __IPV6CTL_NAMES_RTMINEXPIRE "minexpire" +#define __IPV6CTL_TYPE_RTMINEXPIRE CTLTYPE_INT +#define __IPV6CTL_VARS_RTMINEXPIRE 0 /* &rtq_minreallyold */ +#else +#define __IPV6CTL_NAMES_RTMINEXPIRE 0 +#define __IPV6CTL_TYPE_RTMINEXPIRE 0 +#define __IPV6CTL_VARS_RTMINEXPIRE 0 +#endif + +#ifdef IPV6CTL_RTMAXCACHE +#define __IPV6CTL_NAMES_RTMAXCACHE "maxcache" +#define __IPV6CTL_TYPE_RTMAXCACHE CTLTYPE_INT +#define __IPV6CTL_VARS_RTMAXCACHE 0 /* &rtq_toomany */ +#else +#define __IPV6CTL_NAMES_RTMAXCACHE 0 +#define __IPV6CTL_TYPE_RTMAXCACHE 0 +#define __IPV6CTL_VARS_RTMAXCACHE 0 +#endif + +#ifdef IPV6CTL_ANONPORTMIN +#define __IPV6CTL_NAMES_ANONPORTMIN "anonportmin" +#define __IPV6CTL_TYPE_ANONPORTMIN CTLTYPE_INT +#define __IPV6CTL_VARS_ANONPORTMIN 0 +#else +#define __IPV6CTL_NAMES_ANONPORTMIN 0 +#define __IPV6CTL_TYPE_ANONPORTMIN 0 +#define __IPV6CTL_VARS_ANONPORTMIN 0 +#endif + +#ifdef IPV6CTL_ANONPORTMAX +#define __IPV6CTL_NAMES_ANONPORTMAX "anonportmax" +#define __IPV6CTL_TYPE_ANONPORTMAX CTLTYPE_INT +#define __IPV6CTL_VARS_ANONPORTMAX 0 +#else +#define __IPV6CTL_NAMES_ANONPORTMAX 0 +#define __IPV6CTL_TYPE_ANONPORTMAX 0 +#define __IPV6CTL_VARS_ANONPORTMAX 0 +#endif + +#ifdef IPV6CTL_LOWPORTMIN +#define __IPV6CTL_NAMES_LOWPORTMIN "lowportmin" +#define __IPV6CTL_TYPE_LOWPORTMIN CTLTYPE_INT +#define __IPV6CTL_VARS_LOWPORTMIN 0 +#else +#define __IPV6CTL_NAMES_LOWPORTMIN 0 +#define __IPV6CTL_TYPE_LOWPORTMIN 0 +#define __IPV6CTL_VARS_LOWPORTMIN 0 +#endif + +#ifdef IPV6CTL_LOWPORTMAX +#define __IPV6CTL_NAMES_LOWPORTMAX "lowportmax" +#define __IPV6CTL_TYPE_LOWPORTMAX CTLTYPE_INT +#define __IPV6CTL_VARS_LOWPORTMAX 0 +#else +#define __IPV6CTL_NAMES_LOWPORTMAX 0 +#define __IPV6CTL_TYPE_LOWPORTMAX 0 +#define __IPV6CTL_VARS_LOWPORTMAX 0 +#endif + + +#define IPV6CTL_NAMES { \ + { 0, 0 }, \ + { "forwarding", CTLTYPE_INT }, \ + { "redirect", CTLTYPE_INT }, \ + { "hlim", CTLTYPE_INT }, \ + { "mtu", CTLTYPE_INT }, \ + { "forwsrcrt", CTLTYPE_INT }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "mrtproto", CTLTYPE_INT }, \ + { "maxfragpackets", CTLTYPE_INT }, \ + { "sourcecheck", CTLTYPE_INT }, \ + { "sourcecheck_logint", CTLTYPE_INT }, \ + { "accept_rtadv", CTLTYPE_INT }, \ + { "keepfaith", CTLTYPE_INT }, \ + { "log_interval", CTLTYPE_INT }, \ + { "hdrnestlimit", CTLTYPE_INT }, \ + { "dad_count", CTLTYPE_INT }, \ + { "auto_flowlabel", CTLTYPE_INT }, \ + { "defmcasthlim", CTLTYPE_INT }, \ + { "gifhlim", CTLTYPE_INT }, \ + { "kame_version", CTLTYPE_STRING }, \ + { "use_deprecated", CTLTYPE_INT }, \ + { "rr_prune", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "v6only", CTLTYPE_INT }, \ + { __IPV6CTL_NAMES_RTEXPIRE, __IPV6CTL_TYPE_RTEXPIRE }, \ + { __IPV6CTL_NAMES_RTMINEXPIRE, __IPV6CTL_TYPE_RTMINEXPIRE }, \ + { __IPV6CTL_NAMES_RTMAXCACHE, __IPV6CTL_TYPE_RTMAXCACHE }, \ + { __IPV6CTL_NAMES_ANONPORTMIN, __IPV6CTL_TYPE_ANONPORTMIN }, \ + { __IPV6CTL_NAMES_ANONPORTMAX, __IPV6CTL_TYPE_ANONPORTMAX }, \ + { __IPV6CTL_NAMES_LOWPORTMIN, __IPV6CTL_TYPE_LOWPORTMIN }, \ + { __IPV6CTL_NAMES_LOWPORTMAX, __IPV6CTL_TYPE_LOWPORTMAX }, \ + { "use_tempaddr", CTLTYPE_INT }, \ + { "temppltime", CTLTYPE_INT }, \ + { "tempvltime", CTLTYPE_INT }, \ + { "auto_linklocal", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "prefer_tempaddr", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "use_defaultzone", CTLTYPE_INT }, \ +} + +#ifdef __bsdi__ +#define IPV6CTL_VARS { \ + 0, \ + &ip6_forwarding, \ + &ip6_sendredirects, \ + &ip6_defhlim, \ + 0, \ + &ip6_forward_srcrt, \ + 0, \ + 0, \ + 0, \ + &ip6_maxfragpackets, \ + &ip6_sourcecheck, \ + &ip6_sourcecheck_interval, \ + &ip6_accept_rtadv, \ + &ip6_keepfaith, \ + &ip6_log_interval, \ + &ip6_hdrnestlimit, \ + &ip6_dad_count, \ + &ip6_auto_flowlabel, \ + &ip6_defmcasthlim, \ + &ip6_gif_hlim, \ + 0, \ + &ip6_use_deprecated, \ + &ip6_rr_prune, \ + 0, \ + &ip6_v6only, \ + __IPV6CTL_VARS_RTEXPIRE, \ + __IPV6CTL_VARS_RTMINEXPIRE, \ + __IPV6CTL_VARS_RTMAXCACHE, \ + __IPV6CTL_VARS_ANONPORTMIN, \ + __IPV6CTL_VARS_ANONPORTMAX, \ + __IPV6CTL_VARS_LOWPORTMIN, \ + __IPV6CTL_VARS_LOWPORTMAX, \ + &ip6_use_tempaddr, \ + &ip6_temp_preferred_lifetime, \ + &ip6_temp_valid_lifetime, \ + &ip6_auto_linklocal, \ + 0, \ + &ip6_prefer_tempaddr, \ + 0, \ + &ip6_use_defzone,\ +} +#endif +#endif /* !_XOPEN_SOURCE */ + +/* + * Redefinition of mbuf flags + */ +#define M_AUTHIPHDR M_PROTO2 +#define M_DECRYPTED M_PROTO3 +#define M_LOOP M_PROTO4 +#define M_AUTHIPDGM M_PROTO5 + +#ifdef _KERNEL +struct cmsghdr; +struct mbuf; +struct ifnet; + +int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t)); +int in6_localaddr __P((struct in6_addr *)); +int in6_addrscope __P((struct in6_addr *)); +struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *)); +extern void in6_if_up __P((struct ifnet *)); +struct sockaddr; + +void in6_sin6_2_sin __P((struct sockaddr_in *sin, + struct sockaddr_in6 *sin6)); +void in6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin, + struct sockaddr_in6 *sin6)); +void in6_sin6_2_sin_in_sock __P((struct sockaddr *nam)); +void in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam)); +extern void addrsel_policy_init __P((void)); + +#define satosin6(sa) ((struct sockaddr_in6 *)(sa)) +#define sin6tosa(sin6) ((struct sockaddr *)(sin6)) +#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) +#endif /* _KERNEL */ + +__BEGIN_DECLS +struct cmsghdr; + +extern int inet6_option_space __P((int)); +extern int inet6_option_init __P((void *, struct cmsghdr **, int)); +extern int inet6_option_append __P((struct cmsghdr *, const u_int8_t *, + int, int)); +extern u_int8_t *inet6_option_alloc __P((struct cmsghdr *, int, int, int)); +extern int inet6_option_next __P((const struct cmsghdr *, u_int8_t **)); +extern int inet6_option_find __P((const struct cmsghdr *, u_int8_t **, int)); + +extern size_t inet6_rthdr_space __P((int, int)); +extern struct cmsghdr *inet6_rthdr_init __P((void *, int)); +extern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *, + unsigned int)); +extern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int)); +#if 0 /* not implemented yet */ +extern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *)); +#endif +extern int inet6_rthdr_segments __P((const struct cmsghdr *)); +extern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int)); +extern int inet6_rthdr_getflags __P((const struct cmsghdr *, int)); + +extern int inet6_opt_init __P((void *, size_t)); +extern int inet6_opt_append __P((void *, size_t, int, u_int8_t, + size_t, u_int8_t, void **)); +extern int inet6_opt_finish __P((void *, size_t, int)); +extern int inet6_opt_set_val __P((void *, size_t, void *, int)); + +extern int inet6_opt_next __P((void *, size_t, int, u_int8_t *, + size_t *, void **)); +extern int inet6_opt_find __P((void *, size_t, int, u_int8_t, + size_t *, void **)); +extern int inet6_opt_get_val __P((void *, size_t, void *, int)); +extern size_t inet6_rth_space __P((int, int)); +extern void *inet6_rth_init __P((void *, int, int, int)); +extern int inet6_rth_add __P((void *, const struct in6_addr *)); +extern int inet6_rth_reverse __P((const void *, void *)); +extern int inet6_rth_segments __P((const void *)); +extern struct in6_addr *inet6_rth_getaddr __P((const void *, int)); + +/* the followings two are experimental. should not merge them to *BSD. */ +struct sockaddr; /* XXX */ + +extern int addr2scopetype __P((struct sockaddr *)); +extern int inet_zoneid __P((int, int, char *, u_int32_t *)); +__END_DECLS + +#endif /* !_NETINET6_IN6_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/in6_ifattach.h b/packages/net/bsd_tcpip/current/include/netinet6/in6_ifattach.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/in6_ifattach.h @@ -0,0 +1,69 @@ +//========================================================================== +// +// include/netinet6/in6_ifattach.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: in6_ifattach.h,v 1.16 2001/08/31 05:13:40 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#ifndef _NETINET6_IN6_IFATTACH_H_ +#define _NETINET6_IN6_IFATTACH_H_ + +#ifdef _KERNEL +void in6_nigroup_attach __P((const char *, int)); +void in6_nigroup_detach __P((const char *, int)); +void in6_ifattach __P((struct ifnet *, struct ifnet *)); +void in6_ifdetach __P((struct ifnet *)); +int in6_get_tmpifid __P((struct ifnet *, u_int8_t *, const u_int8_t *, int)); +void in6_tmpaddrtimer __P((void *)); +int in6_nigroup __P((struct ifnet *, const char *, int, struct in6_addr *)); +#ifdef MIP6 +int get_ifid __P((struct ifnet *, struct ifnet *, struct in6_addr *)); +#endif /* MIP6 */ +#endif /* _KERNEL */ + +#endif /* _NETINET6_IN6_IFATTACH_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/in6_pcb.h b/packages/net/bsd_tcpip/current/include/netinet6/in6_pcb.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/in6_pcb.h @@ -0,0 +1,137 @@ +//========================================================================== +// +// include/netinet6/in6_pcb.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $FreeBSD: src/sys/netinet6/in6_pcb.h,v 1.2.2.3 2001/08/13 16:26:17 ume Exp $ */ +/* $KAME: in6_pcb.h,v 1.17 2001/11/12 11:11:22 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + * + */ + +/* + * Copyright (c) 1982, 1986, 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET6_IN6_PCB_H_ +#define _NETINET6_IN6_PCB_H_ + +#ifdef _KERNEL +#define satosin6(sa) ((struct sockaddr_in6 *)(sa)) +#define sin6tosa(sin6) ((struct sockaddr *)(sin6)) +#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) + +void in6_pcbpurgeif0 __P((struct in6pcb *, struct ifnet *)); +void in6_losing __P((struct inpcb *)); +int in6_pcballoc __P((struct socket *, struct inpcbinfo *, struct proc *)); +int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct proc *)); +int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct proc *)); +void in6_pcbdetach __P((struct inpcb *)); +void in6_pcbdisconnect __P((struct inpcb *)); +int in6_pcbladdr __P((struct inpcb *, struct sockaddr *, + struct in6_addr **)); +struct inpcb * + in6_pcblookup_local __P((struct inpcbinfo *, + struct in6_addr *, u_int, int)); +struct inpcb * + in6_pcblookup_hash __P((struct inpcbinfo *, + struct in6_addr *, u_int, struct in6_addr *, + u_int, int, struct ifnet *)); +void in6_pcbnotify __P((struct inpcbhead *, struct sockaddr *, + u_int, struct sockaddr *, u_int, int, void *, + void (*)(struct inpcb *, int))); +void in6_rtchange __P((struct inpcb *, int)); +int in6_setpeeraddr __P((struct socket *so, struct sockaddr **nam)); +int in6_setsockaddr __P((struct socket *so, struct sockaddr **nam)); +int in6_mapped_sockaddr __P((struct socket *so, struct sockaddr **nam)); +int in6_mapped_peeraddr __P((struct socket *so, struct sockaddr **nam)); +struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *, + struct ip6_pktopts *, + struct ip6_moptions *, + struct route *, + struct ifnet **, + struct in6_addr *, + int *)); +int in6_selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, + struct ip6_moptions *, struct route *, + struct ifnet **, struct rtentry **, int)); +int in6_selecthlim __P((struct in6pcb *, struct ifnet *)); +int in6_pcbsetport __P((struct in6_addr *, struct inpcb *, struct proc *)); +void init_sin6 __P((struct sockaddr_in6 *sin6, struct mbuf *m)); +#endif /* _KERNEL */ + +#endif /* !_NETINET6_IN6_PCB_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/in6_var.h b/packages/net/bsd_tcpip/current/include/netinet6/in6_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/in6_var.h @@ -0,0 +1,753 @@ +//========================================================================== +// +// include/netinet6/in6_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: in6_var.h,v 1.74 2001/12/24 10:39:30 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1985, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_var.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET6_IN6_VAR_H_ +#define _NETINET6_IN6_VAR_H_ + +/* + * Interface address, Internet version. One of these structures + * is allocated for each interface with an Internet address. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ + +/* + * pltime/vltime are just for future reference (required to implements 2 + * hour rule for hosts). they should never be modified by nd6_timeout or + * anywhere else. + * userland -> kernel: accept pltime/vltime + * kernel -> userland: throw up everything + * in kernel: modify preferred/expire only + */ +struct in6_addrlifetime { + time_t ia6t_expire; /* valid lifetime expiration time */ + time_t ia6t_preferred; /* preferred lifetime expiration time */ + u_int32_t ia6t_vltime; /* valid lifetime */ + u_int32_t ia6t_pltime; /* prefix lifetime */ +}; + +#ifdef MEASURE_PERFORMANCE +/* + * Structure for hashing "local" IPv6 addresses for lookup in IPv6 input. + */ +struct in6hash { + struct in6hash *in6h_next; + struct in6_addr in6h_addr; + struct in6_ifaddr *in6h_ifa; + int in6h_flags; + int in6h_hit; /* number of hits for this entry */ + int in6h_miss; /* number of failures for this entry */ +}; +#endif + +struct in6_ifaddr { + struct ifaddr ia_ifa; /* protocol-independent info */ +#define ia_ifp ia_ifa.ifa_ifp +#define ia_flags ia_ifa.ifa_flags + struct sockaddr_in6 ia_addr; /* interface address */ + struct sockaddr_in6 ia_net; /* network number of interface */ + struct sockaddr_in6 ia_dstaddr; /* space for destination addr */ + struct sockaddr_in6 ia_prefixmask; /* prefix mask */ + u_int32_t ia_plen; /* prefix length */ + struct in6_ifaddr *ia_next; /* next in6 list of IP6 addresses */ +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + LIST_HEAD(in6_multihead, in6_multi) ia6_multiaddrs; + /* list of multicast addresses */ +#endif + int ia6_flags; + + struct in6_addrlifetime ia6_lifetime; + time_t ia6_createtime; /* the creation time of this address, which is + * currently used for temporary addresses only. + */ + time_t ia6_updatetime; + + /* back pointer to the ND prefix (for autoconfigured addresses only) */ + struct nd_prefix *ia6_ndpr; + +#ifdef MEASURE_PERFORMANCE + struct in6hash ia6_hash; /* hash for ia_addr */ +#endif + + /* multicast addresses joined from the kernel */ + LIST_HEAD(, in6_multi_mship) ia6_memberships; +}; + +/* control structure to manage address selection policy */ +struct in6_addrpolicy { + struct sockaddr_in6 addr; /* prefix address */ + struct sockaddr_in6 addrmask; /* prefix mask */ + int preced; /* precedence */ + int label; /* matching label */ + u_quad_t use; /* statistics */ +}; + +/* + * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12). + */ +struct in6_ifstat { + u_quad_t ifs6_in_receive; /* # of total input datagram */ + u_quad_t ifs6_in_hdrerr; /* # of datagrams with invalid hdr */ + u_quad_t ifs6_in_toobig; /* # of datagrams exceeded MTU */ + u_quad_t ifs6_in_noroute; /* # of datagrams with no route */ + u_quad_t ifs6_in_addrerr; /* # of datagrams with invalid dst */ + u_quad_t ifs6_in_protounknown; /* # of datagrams with unknown proto */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_in_truncated; /* # of truncated datagrams */ + u_quad_t ifs6_in_discard; /* # of discarded datagrams */ + /* NOTE: fragment timeout is not here */ + u_quad_t ifs6_in_deliver; /* # of datagrams delivered to ULP */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_out_forward; /* # of datagrams forwarded */ + /* NOTE: increment on outgoing if */ + u_quad_t ifs6_out_request; /* # of outgoing datagrams from ULP */ + /* NOTE: does not include forwrads */ + u_quad_t ifs6_out_discard; /* # of discarded datagrams */ + u_quad_t ifs6_out_fragok; /* # of datagrams fragmented */ + u_quad_t ifs6_out_fragfail; /* # of datagrams failed on fragment */ + u_quad_t ifs6_out_fragcreat; /* # of fragment datagrams */ + /* NOTE: this is # after fragment */ + u_quad_t ifs6_reass_reqd; /* # of incoming fragmented packets */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_reass_ok; /* # of reassembled packets */ + /* NOTE: this is # after reass */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_reass_fail; /* # of reass failures */ + /* NOTE: may not be packet count */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_in_mcast; /* # of inbound multicast datagrams */ + u_quad_t ifs6_out_mcast; /* # of outbound multicast datagrams */ +}; + +/* + * ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry. + * XXX: I'm not sure if this file is the right place for this structure... + */ +struct icmp6_ifstat { + /* + * Input statistics + */ + /* ipv6IfIcmpInMsgs, total # of input messages */ + u_quad_t ifs6_in_msg; + /* ipv6IfIcmpInErrors, # of input error messages */ + u_quad_t ifs6_in_error; + /* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */ + u_quad_t ifs6_in_dstunreach; + /* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */ + u_quad_t ifs6_in_adminprohib; + /* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */ + u_quad_t ifs6_in_timeexceed; + /* ipv6IfIcmpInParmProblems, # of input parameter problem errors */ + u_quad_t ifs6_in_paramprob; + /* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */ + u_quad_t ifs6_in_pkttoobig; + /* ipv6IfIcmpInEchos, # of input echo requests */ + u_quad_t ifs6_in_echo; + /* ipv6IfIcmpInEchoReplies, # of input echo replies */ + u_quad_t ifs6_in_echoreply; + /* ipv6IfIcmpInRouterSolicits, # of input router solicitations */ + u_quad_t ifs6_in_routersolicit; + /* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */ + u_quad_t ifs6_in_routeradvert; + /* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */ + u_quad_t ifs6_in_neighborsolicit; + /* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */ + u_quad_t ifs6_in_neighboradvert; + /* ipv6IfIcmpInRedirects, # of input redirects */ + u_quad_t ifs6_in_redirect; + /* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */ + u_quad_t ifs6_in_mldquery; + /* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */ + u_quad_t ifs6_in_mldreport; + /* ipv6IfIcmpInGroupMembReductions, # of input MLD done */ + u_quad_t ifs6_in_mlddone; + + /* + * Output statistics. We should solve unresolved routing problem... + */ + /* ipv6IfIcmpOutMsgs, total # of output messages */ + u_quad_t ifs6_out_msg; + /* ipv6IfIcmpOutErrors, # of output error messages */ + u_quad_t ifs6_out_error; + /* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */ + u_quad_t ifs6_out_dstunreach; + /* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */ + u_quad_t ifs6_out_adminprohib; + /* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */ + u_quad_t ifs6_out_timeexceed; + /* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */ + u_quad_t ifs6_out_paramprob; + /* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */ + u_quad_t ifs6_out_pkttoobig; + /* ipv6IfIcmpOutEchos, # of output echo requests */ + u_quad_t ifs6_out_echo; + /* ipv6IfIcmpOutEchoReplies, # of output echo replies */ + u_quad_t ifs6_out_echoreply; + /* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */ + u_quad_t ifs6_out_routersolicit; + /* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */ + u_quad_t ifs6_out_routeradvert; + /* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */ + u_quad_t ifs6_out_neighborsolicit; + /* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */ + u_quad_t ifs6_out_neighboradvert; + /* ipv6IfIcmpOutRedirects, # of output redirects */ + u_quad_t ifs6_out_redirect; + /* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */ + u_quad_t ifs6_out_mldquery; + /* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */ + u_quad_t ifs6_out_mldreport; + /* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */ + u_quad_t ifs6_out_mlddone; +}; + +struct in6_ifreq { + char ifr_name[IFNAMSIZ]; + union { + struct sockaddr_in6 ifru_addr; + struct sockaddr_in6 ifru_dstaddr; + short ifru_flags; + int ifru_flags6; + int ifru_metric; + caddr_t ifru_data; + struct in6_addrlifetime ifru_lifetime; + struct in6_ifstat ifru_stat; + struct icmp6_ifstat ifru_icmp6stat; + u_int32_t ifru_scope_id[16]; + } ifr_ifru; +}; + +struct in6_aliasreq { + char ifra_name[IFNAMSIZ]; + struct sockaddr_in6 ifra_addr; + struct sockaddr_in6 ifra_dstaddr; + struct sockaddr_in6 ifra_prefixmask; + int ifra_flags; + struct in6_addrlifetime ifra_lifetime; +}; + +/* prefix type macro */ +#define IN6_PREFIX_ND 1 +#define IN6_PREFIX_RR 2 + +/* + * prefix related flags passed between kernel(NDP related part) and + * user land command(ifconfig) and daemon(rtadvd). + */ +struct in6_prflags { + struct prf_ra { + u_char onlink : 1; + u_char autonomous : 1; + u_char router : 1; + u_char reserved : 5; + } prf_ra; + u_char prf_reserved1; + u_short prf_reserved2; + /* want to put this on 4byte offset */ + struct prf_rr { + u_char decrvalid : 1; + u_char decrprefd : 1; + u_char reserved : 6; + } prf_rr; + u_char prf_reserved3; + u_short prf_reserved4; +}; + +struct in6_prefixreq { + char ipr_name[IFNAMSIZ]; + u_char ipr_origin; + u_char ipr_plen; + u_int32_t ipr_vltime; + u_int32_t ipr_pltime; + struct in6_prflags ipr_flags; + struct sockaddr_in6 ipr_prefix; +}; + +#define PR_ORIG_RA 0 +#define PR_ORIG_RR 1 +#define PR_ORIG_STATIC 2 +#define PR_ORIG_KERNEL 3 + +#define ipr_raf_onlink ipr_flags.prf_ra.onlink +#define ipr_raf_auto ipr_flags.prf_ra.autonomous + +#define ipr_statef_onlink ipr_flags.prf_state.onlink + +#define ipr_rrf_decrvalid ipr_flags.prf_rr.decrvalid +#define ipr_rrf_decrprefd ipr_flags.prf_rr.decrprefd + +struct in6_rrenumreq { + char irr_name[IFNAMSIZ]; + u_char irr_origin; + u_char irr_m_len; /* match len for matchprefix */ + u_char irr_m_minlen; /* minlen for matching prefix */ + u_char irr_m_maxlen; /* maxlen for matching prefix */ + u_char irr_u_uselen; /* uselen for adding prefix */ + u_char irr_u_keeplen; /* keeplen from matching prefix */ + struct irr_raflagmask { + u_char onlink : 1; + u_char autonomous : 1; + u_char reserved : 6; + } irr_raflagmask; + u_int32_t irr_vltime; + u_int32_t irr_pltime; + struct in6_prflags irr_flags; + struct sockaddr_in6 irr_matchprefix; + struct sockaddr_in6 irr_useprefix; +}; + +#define irr_raf_mask_onlink irr_raflagmask.onlink +#define irr_raf_mask_auto irr_raflagmask.autonomous +#define irr_raf_mask_reserved irr_raflagmask.reserved + +#define irr_raf_onlink irr_flags.prf_ra.onlink +#define irr_raf_auto irr_flags.prf_ra.autonomous + +#define irr_statef_onlink irr_flags.prf_state.onlink + +#define irr_rrf irr_flags.prf_rr +#define irr_rrf_decrvalid irr_flags.prf_rr.decrvalid +#define irr_rrf_decrprefd irr_flags.prf_rr.decrprefd + +/* + * Given a pointer to an in6_ifaddr (ifaddr), + * return a pointer to the addr as a sockaddr_in6 + */ +#define IA6_IN6(ia) (&((ia)->ia_addr.sin6_addr)) +#define IA6_DSTIN6(ia) (&((ia)->ia_dstaddr.sin6_addr)) +#define IA6_MASKIN6(ia) (&((ia)->ia_prefixmask.sin6_addr)) +#define IA6_SIN6(ia) (&((ia)->ia_addr)) +#define IA6_DSTSIN6(ia) (&((ia)->ia_dstaddr)) +#define IFA_IN6(x) (&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr) +#define IFA_DSTIN6(x) (&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr) + +#ifdef _KERNEL +#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ + (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \ + (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \ + (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \ + (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 ) +#endif + +#define SIOCSIFADDR_IN6 _IOW('i', 12, struct in6_ifreq) +#define SIOCGIFADDR_IN6 _IOWR('i', 33, struct in6_ifreq) + +#ifdef _KERNEL +/* + * SIOCSxxx ioctls should be unused (see comments in in6.c), but + * we do not shift numbers for binary compatibility. + */ +#define SIOCSIFDSTADDR_IN6 _IOW('i', 14, struct in6_ifreq) +#define SIOCSIFNETMASK_IN6 _IOW('i', 22, struct in6_ifreq) +#endif + +#define SIOCGIFDSTADDR_IN6 _IOWR('i', 34, struct in6_ifreq) +#define SIOCGIFNETMASK_IN6 _IOWR('i', 37, struct in6_ifreq) + +#define SIOCDIFADDR_IN6 _IOW('i', 25, struct in6_ifreq) +#define SIOCAIFADDR_IN6 _IOW('i', 26, struct in6_aliasreq) + +#define SIOCSIFPHYADDR_IN6 _IOW('i', 70, struct in6_aliasreq) +#define SIOCGIFPSRCADDR_IN6 _IOWR('i', 71, struct in6_ifreq) +#define SIOCGIFPDSTADDR_IN6 _IOWR('i', 72, struct in6_ifreq) + +#define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq) + +#define SIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist) +#define SIOCGPRLST_IN6 _IOWR('i', 75, struct in6_oprlist) +#ifdef _KERNEL +#define OSIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq) +#endif +#define SIOCGIFINFO_IN6 _IOWR('i', 108, struct in6_ndireq) +#define SIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq) +#define SIOCGNBRINFO_IN6 _IOWR('i', 78, struct in6_nbrinfo) +#define SIOCSPFXFLUSH_IN6 _IOWR('i', 79, struct in6_ifreq) +#define SIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq) + +#define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq) +#define SIOCSIFALIFETIME_IN6 _IOWR('i', 82, struct in6_ifreq) +#define SIOCGIFSTAT_IN6 _IOWR('i', 83, struct in6_ifreq) +#define SIOCGIFSTAT_ICMP6 _IOWR('i', 84, struct in6_ifreq) + +#define SIOCSDEFIFACE_IN6 _IOWR('i', 85, struct in6_ndifreq) +#define SIOCGDEFIFACE_IN6 _IOWR('i', 86, struct in6_ndifreq) + +#define SIOCSIFINFO_FLAGS _IOWR('i', 87, struct in6_ndireq) /* XXX */ + +#define SIOCSSCOPE6 _IOW('i', 88, struct in6_ifreq) +#define SIOCGSCOPE6 _IOWR('i', 89, struct in6_ifreq) +#define SIOCGSCOPE6DEF _IOWR('i', 90, struct in6_ifreq) + +#define SIOCSIFPREFIX_IN6 _IOW('i', 100, struct in6_prefixreq) /* set */ +#define SIOCGIFPREFIX_IN6 _IOWR('i', 101, struct in6_prefixreq) /* get */ +#define SIOCDIFPREFIX_IN6 _IOW('i', 102, struct in6_prefixreq) /* del */ +#define SIOCAIFPREFIX_IN6 _IOW('i', 103, struct in6_rrenumreq) /* add */ +#define SIOCCIFPREFIX_IN6 _IOW('i', 104, \ + struct in6_rrenumreq) /* change */ +#define SIOCSGIFPREFIX_IN6 _IOW('i', 105, \ + struct in6_rrenumreq) /* set global */ + +#define SIOCGETSGCNT_IN6 _IOWR('u', 106, \ + struct sioc_sg_req6) /* get s,g pkt cnt */ +#define SIOCGETMIFCNT_IN6 _IOWR('u', 107, \ + struct sioc_mif_req6) /* get pkt cnt per if */ + +#define SIOCAADDRCTL_POLICY _IOW('u', 108, struct in6_addrpolicy) +#define SIOCDADDRCTL_POLICY _IOW('u', 109, struct in6_addrpolicy) + +#define IN6_IFF_ANYCAST 0x01 /* anycast address */ +#define IN6_IFF_TENTATIVE 0x02 /* tentative address */ +#define IN6_IFF_DUPLICATED 0x04 /* DAD detected duplicate */ +#define IN6_IFF_DETACHED 0x08 /* may be detached from the link */ +#define IN6_IFF_DEPRECATED 0x10 /* deprecated address */ +#define IN6_IFF_NODAD 0x20 /* don't perform DAD on this address + * (used only at first SIOC* call) + */ +#define IN6_IFF_AUTOCONF 0x40 /* autoconfigurable address. */ +#define IN6_IFF_TEMPORARY 0x80 /* temporary (anonymous) address. */ +#define IN6_IFF_HOME 0x100 /* MIP6 home address. */ + +/* do not input/output */ +#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED) + +#ifdef _KERNEL +#define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b)) +#define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b)) +#endif + +#ifdef _KERNEL +extern struct in6_ifaddr *in6_ifaddr; + +extern struct in6_ifstat **in6_ifstat; +extern size_t in6_ifstatmax; +extern struct icmp6stat icmp6stat; +extern struct icmp6_ifstat **icmp6_ifstat; +extern size_t icmp6_ifstatmax; +#define in6_ifstat_inc(ifp, tag) \ +do { \ + if ((ifp) && (ifp)->if_index <= if_index \ + && (ifp)->if_index < in6_ifstatmax \ + && in6_ifstat && in6_ifstat[(ifp)->if_index]) { \ + in6_ifstat[(ifp)->if_index]->tag++; \ + } \ +} while (0) + +extern struct ifqueue ip6intrq; /* IP6 packet input queue */ +extern struct in6_addr zeroin6_addr; +extern int inet6ctlerrmap[]; +extern unsigned long in6_maxmtu; + +/* + * Macro for finding the internet address structure (in6_ifaddr) corresponding + * to a given interface (ifnet structure). + */ +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + +#define IFP_TO_IA6(ifp, ia) \ +/* struct ifnet *ifp; */ \ +/* struct in6_ifaddr *ia; */ \ +do { \ + struct ifaddr *ifa; \ + for (ifa = (ifp)->if_addrlist; ifa; ifa = ifa->ifa_next) { \ + if (!ifa->ifa_addr) \ + continue; \ + if (ifa->ifa_addr->sa_family == AF_INET6) \ + break; \ + } \ + (ia) = (struct in6_ifaddr *)ifa; \ +} while (0) + +#else + +#define IFP_TO_IA6(ifp, ia) \ +/* struct ifnet *ifp; */ \ +/* struct in6_ifaddr *ia; */ \ +do { \ + struct ifaddr *ifa; \ + for (ifa = (ifp)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) { \ + if (!ifa->ifa_addr) \ + continue; \ + if (ifa->ifa_addr->sa_family == AF_INET6) \ + break; \ + } \ + (ia) = (struct in6_ifaddr *)ifa; \ +} while (0) +#endif + +#endif /* _KERNEL */ + +/* + * Multi-cast membership entry. One for each group/ifp that a PCB + * belongs to. + */ +struct in6_multi_mship { + struct in6_multi *i6mm_maddr; /* Multicast address pointer */ + LIST_ENTRY(in6_multi_mship) i6mm_chain; /* multicast options chain */ +}; + +struct in6_multi { + LIST_ENTRY(in6_multi) in6m_entry; /* list glue */ + struct in6_addr in6m_addr; /* IP6 multicast address */ + struct ifnet *in6m_ifp; /* back pointer to ifnet */ +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + struct in6_ifaddr *in6m_ia; /* back pointer to in6_ifaddr */ +#else + struct ifmultiaddr *in6m_ifma; /* back pointer to ifmultiaddr */ +#endif + u_int in6m_refcount; /* # membership claims by sockets */ + u_int in6m_state; /* state of the membership */ + u_int in6m_timer; /* MLD6 listener report timer */ +}; + +#ifdef _KERNEL +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +extern LIST_HEAD(in6_multihead, in6_multi) in6_multihead; +#endif + +/* + * Structure used by macros below to remember position when stepping through + * all of the in6_multi records. + */ +struct in6_multistep { + struct in6_ifaddr *i_ia; + struct in6_multi *i_in6m; +}; + +/* + * Macros for looking up the in6_multi record for a given IP6 multicast + * address on a given interface. If no matching record is found, "in6m" + * returns NLL. + */ + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + +#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \ +/* struct in6_addr addr; */ \ +/* struct ifnet *ifp; */ \ +/* struct in6_multi *in6m; */ \ +do { \ + struct ifmultiaddr *ifma; \ + for (ifma = (ifp)->if_multiaddrs.lh_first; ifma; \ + ifma = ifma->ifma_link.le_next) { \ + if (ifma->ifma_addr->sa_family == AF_INET6 \ + && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \ + &(addr))) \ + break; \ + } \ + (in6m) = (struct in6_multi *)(ifma ? ifma->ifma_protospec : 0); \ +} while(0) + +/* + * Macro to step through all of the in6_multi records, one at a time. + * The current position is remembered in "step", which the caller must + * provide. IN6_FIRST_MULTI(), below, must be called to initialize "step" + * and get the first record. Both macros return a NULL "in6m" when there + * are no remaining records. + */ +#define IN6_NEXT_MULTI(step, in6m) \ +/* struct in6_multistep step; */ \ +/* struct in6_multi *in6m; */ \ +do { \ + if (((in6m) = (step).i_in6m) != NULL) \ + (step).i_in6m = (step).i_in6m->in6m_entry.le_next; \ +} while(0) + +#define IN6_FIRST_MULTI(step, in6m) \ +/* struct in6_multistep step; */ \ +/* struct in6_multi *in6m */ \ +do { \ + (step).i_in6m = in6_multihead.lh_first; \ + IN6_NEXT_MULTI((step), (in6m)); \ +} while(0) + +#else /* not FreeBSD3 */ + +#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \ +/* struct in6_addr addr; */ \ +/* struct ifnet *ifp; */ \ +/* struct in6_multi *in6m; */ \ +do { \ + struct in6_ifaddr *ia; \ + \ + IFP_TO_IA6((ifp), ia); \ + if (ia == NULL) \ + (in6m) = NULL; \ + else \ + for ((in6m) = ia->ia6_multiaddrs.lh_first; \ + (in6m) != NULL && \ + !IN6_ARE_ADDR_EQUAL(&(in6m)->in6m_addr, &(addr)); \ + (in6m) = in6m->in6m_entry.le_next) \ + continue; \ +} while (0) + +/* + * Macro to step through all of the in6_multi records, one at a time. + * The current position is remembered in "step", which the caller must + * provide. IN6_FIRST_MULTI(), below, must be called to initialize "step" + * and get the first record. Both macros return a NULL "in6m" when there + * are no remaining records. + */ +#define IN6_NEXT_MULTI(step, in6m) \ +/* struct in6_multistep step; */ \ +/* struct in6_multi *in6m; */ \ +do { \ + if (((in6m) = (step).i_in6m) != NULL) \ + (step).i_in6m = (in6m)->in6m_entry.le_next; \ + else \ + while ((step).i_ia != NULL) { \ + (in6m) = (step).i_ia->ia6_multiaddrs.lh_first; \ + (step).i_ia = (step).i_ia->ia_next; \ + if ((in6m) != NULL) { \ + (step).i_in6m = (in6m)->in6m_entry.le_next; \ + break; \ + } \ + } \ +} while (0) + +#define IN6_FIRST_MULTI(step, in6m) \ +/* struct in6_multistep step; */ \ +/* struct in6_multi *in6m */ \ +do { \ + (step).i_ia = in6_ifaddr; \ + (step).i_in6m = NULL; \ + IN6_NEXT_MULTI((step), (in6m)); \ +} while (0) + +#endif /* not FreeBSD3 */ + +struct in6_multi *in6_addmulti __P((struct in6_addr *, struct ifnet *, + int *)); +void in6_delmulti __P((struct in6_multi *)); +struct in6_multi_mship *in6_joingroup __P((struct ifnet *, struct in6_addr *, + int *)); +int in6_leavegroup __P((struct in6_multi_mship *)); +extern int in6_ifindex2scopeid __P((int)); +extern int in6_mask2len __P((struct in6_addr *, u_char *)); +#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3) +int in6_control __P((struct socket *, + u_long, caddr_t, struct ifnet *, struct proc *)); +#else +int in6_control __P((struct socket *, u_long, caddr_t, struct ifnet *)); +#endif +int in6_update_ifa __P((struct ifnet *, struct in6_aliasreq *, + struct in6_ifaddr *)); +void in6_purgeaddr __P((struct ifaddr *)); +int in6if_do_dad __P((struct ifnet *)); +void in6_purgeif __P((struct ifnet *)); +void in6_savemkludge __P((struct in6_ifaddr *)); +void in6_setmaxmtu __P((void)); +void in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *)); +void in6_createmkludge __P((struct ifnet *)); +void in6_purgemkludge __P((struct ifnet *)); +struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int)); +struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *, + struct in6_addr *)); +char *ip6_sprintf __P((const struct in6_addr *)); +int64_t in6_addr2zoneid __P((struct ifnet *, struct in6_addr *)); +int in6_matchlen __P((struct in6_addr *, struct in6_addr *)); +int in6_are_prefix_equal __P((struct in6_addr *p1, struct in6_addr *p2, + int len)); +void in6_prefixlen2mask __P((struct in6_addr *maskp, int len)); +void in6_prefix_remove_ifid __P((int iilen, struct in6_ifaddr *ia)); +void in6_purgeprefix __P((struct ifnet *)); + +int in6_is_addr_deprecated __P((struct sockaddr_in6 *)); +int in6_embedscope __P((struct in6_addr *, const struct sockaddr_in6 *)); +int in6_recoverscope __P((struct sockaddr_in6 *, const struct in6_addr *, + struct ifnet *)); +void in6_clearscope __P((struct in6_addr *)); +int in6_src_ioctl __P((u_long, caddr_t)); + +#ifdef MEASURE_PERFORMANCE +void in6h_hashinit __P((void)); +void in6h_addifa __P((struct in6_ifaddr *)); +struct in6hash *in6h_lookup __P((const struct in6_addr *, struct ifnet *)); +void in6h_rebuild __P((int)); +#endif +#endif /* _KERNEL */ + +#endif /* _NETINET6_IN6_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/ip6_fw.h b/packages/net/bsd_tcpip/current/include/netinet6/ip6_fw.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/ip6_fw.h @@ -0,0 +1,252 @@ +//========================================================================== +// +// include/netinet6/ip6_fw.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip6_fw.h,v 1.9 2001/08/01 04:29:57 sumikawa Exp $ */ + +/* + * Copyright (C) 1998, 1999, 2000 and 2001 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1993 Daniel Boulet + * Copyright (c) 1994 Ugen J.S.Antsilevich + * + * Redistribution and use in source forms, with and without modification, + * are permitted provided that this entire comment appears intact. + * + * Redistribution in binary form may occur without any restrictions. + * Obviously, it would be nice if you gave credit where credit is due + * but requiring it would be too onerous. + * + * This software is provided ``AS IS'' without any warranties of any kind. + * + */ + +#ifndef _IP6_FW_H +#define _IP6_FW_H + +#include + +/* + * This union structure identifies an interface, either explicitly + * by name or implicitly by IP address. The flags IP_FW_F_IIFNAME + * and IP_FW_F_OIFNAME say how to interpret this structure. An + * interface unit number of -1 matches any unit number, while an + * IP address of 0.0.0.0 indicates matches any interface. + * + * The receive and transmit interfaces are only compared against the + * the packet if the corresponding bit (IP_FW_F_IIFACE or IP_FW_F_OIFACE) + * is set. Note some packets lack a receive or transmit interface + * (in which case the missing "interface" never matches). + */ + +union ip6_fw_if { + struct in6_addr fu_via_ip6; /* Specified by IPv6 address */ + struct { /* Specified by interface name */ +#define IP6FW_IFNLEN IFNAMSIZ + char name[IP6FW_IFNLEN]; + short unit; /* -1 means match any unit */ + } fu_via_if; +}; + +/* + * Format of an IP firewall descriptor + * + * fw_src, fw_dst, fw_smsk, fw_dmsk are always stored in network byte order. + * fw_flg and fw_n*p are stored in host byte order (of course). + * Port numbers are stored in HOST byte order. + * Warning: setsockopt() will fail if sizeof(struct ip_fw) > MLEN (108) + */ + +struct ip6_fw { + u_long fw_pcnt,fw_bcnt; /* Packet and byte counters */ + struct in6_addr fw_src, fw_dst; /* Source and destination IPv6 addr */ + struct in6_addr fw_smsk, fw_dmsk; /* Mask for src and dest IPv6 addr */ + u_short fw_number; /* Rule number */ + u_short fw_flg; /* Flags word */ +#define IPV6_FW_MAX_PORTS 10 /* A reasonable maximum */ + u_int fw_ipflg; /* IP flags word */ + u_short fw_pts[IPV6_FW_MAX_PORTS]; /* Array of port numbers to match */ + u_char fw_ip6opt,fw_ip6nopt; /* IPv6 options set/unset */ + u_char fw_tcpf,fw_tcpnf; /* TCP flags set/unset */ +#define IPV6_FW_ICMPTYPES_DIM (256 / (sizeof(unsigned) * 8)) + unsigned fw_icmp6types[IPV6_FW_ICMPTYPES_DIM]; /* ICMP types bitmap */ + long timestamp; /* timestamp (tv_sec) of last match */ + union ip6_fw_if fw_in_if, fw_out_if;/* Incoming and outgoing interfaces */ + union { + u_short fu_divert_port; /* Divert/tee port (options IP6DIVERT) */ + u_short fu_skipto_rule; /* SKIPTO command rule number */ + u_short fu_reject_code; /* REJECT response code */ + } fw_un; + u_char fw_prot; /* IPv6 protocol */ + u_char fw_nports; /* N'of src ports and # of dst ports */ + /* in ports array (dst ports follow */ + /* src ports; max of 10 ports in all; */ + /* count of 0 means match all ports) */ +}; + +#define IPV6_FW_GETNSRCP(rule) ((rule)->fw_nports & 0x0f) +#define IPV6_FW_SETNSRCP(rule, n) do { \ + (rule)->fw_nports &= ~0x0f; \ + (rule)->fw_nports |= (n); \ + } while (0) +#define IPV6_FW_GETNDSTP(rule) ((rule)->fw_nports >> 4) +#define IPV6_FW_SETNDSTP(rule, n) do { \ + (rule)->fw_nports &= ~0xf0; \ + (rule)->fw_nports |= (n) << 4;\ + } while (0) + +#define fw_divert_port fw_un.fu_divert_port +#define fw_skipto_rule fw_un.fu_skipto_rule +#define fw_reject_code fw_un.fu_reject_code + +struct ip6_fw_chain { + LIST_ENTRY(ip6_fw_chain) chain; + struct ip6_fw *rule; +}; + +/* + * Values for "flags" field . + */ +#define IPV6_FW_F_IN 0x0001 /* Check inbound packets */ +#define IPV6_FW_F_OUT 0x0002 /* Check outbound packets */ +#define IPV6_FW_F_IIFACE 0x0004 /* Apply inbound interface test */ +#define IPV6_FW_F_OIFACE 0x0008 /* Apply outbound interface test */ + +#define IPV6_FW_F_COMMAND 0x0070 /* Mask for type of chain entry: */ +#define IPV6_FW_F_DENY 0x0000 /* This is a deny rule */ +#define IPV6_FW_F_REJECT 0x0010 /* Deny and send a response packet */ +#define IPV6_FW_F_ACCEPT 0x0020 /* This is an accept rule */ +#define IPV6_FW_F_COUNT 0x0030 /* This is a count rule */ +#define IPV6_FW_F_DIVERT 0x0040 /* This is a divert rule */ +#define IPV6_FW_F_TEE 0x0050 /* This is a tee rule */ +#define IPV6_FW_F_SKIPTO 0x0060 /* This is a skipto rule */ + +#define IPV6_FW_F_PRN 0x0080 /* Print if this rule matches */ + +#define IPV6_FW_F_SRNG 0x0100 /* The first two src ports are a min * + * and max range (stored in host byte * + * order). */ + +#define IPV6_FW_F_DRNG 0x0200 /* The first two dst ports are a min * + * and max range (stored in host byte * + * order). */ + +#define IPV6_FW_F_IIFNAME 0x0400 /* In interface by name/unit (not IP) */ +#define IPV6_FW_F_OIFNAME 0x0800 /* Out interface by name/unit (not IP) */ + +#define IPV6_FW_F_INVSRC 0x1000 /* Invert sense of src check */ +#define IPV6_FW_F_INVDST 0x2000 /* Invert sense of dst check */ + +#define IPV6_FW_F_FRAG 0x4000 /* Fragment */ + +#define IPV6_FW_F_ICMPBIT 0x8000 /* ICMP type bitmap is valid */ + +#define IPV6_FW_F_MASK 0xFFFF /* All possible flag bits mask */ + +/* + * Flags for the 'fw_ipflg' field, for comparing values of ip and its protocols. */ +#define IPV6_FW_IF_TCPEST 0x00000020 /* established TCP connection */ +#define IPV6_FW_IF_TCPMSK 0x00000020 /* mask of all TCP values */ + +/* + * For backwards compatibility with rules specifying "via iface" but + * not restricted to only "in" or "out" packets, we define this combination + * of bits to represent this configuration. + */ + +#define IF6_FW_F_VIAHACK (IPV6_FW_F_IN|IPV6_FW_F_OUT|IPV6_FW_F_IIFACE|IPV6_FW_F_OIFACE) + +/* + * Definitions for REJECT response codes. + * Values less than 256 correspond to ICMP unreachable codes. + */ +#define IPV6_FW_REJECT_RST 0x0100 /* TCP packets: send RST */ + +/* + * Definitions for IPv6 option names. + */ +#define IPV6_FW_IP6OPT_HOPOPT 0x01 +#define IPV6_FW_IP6OPT_ROUTE 0x02 +#define IPV6_FW_IP6OPT_FRAG 0x04 +#define IPV6_FW_IP6OPT_ESP 0x08 +#define IPV6_FW_IP6OPT_AH 0x10 +#define IPV6_FW_IP6OPT_NONXT 0x20 +#define IPV6_FW_IP6OPT_OPTS 0x40 + +/* + * Definitions for TCP flags. + */ +#define IPV6_FW_TCPF_FIN TH_FIN +#define IPV6_FW_TCPF_SYN TH_SYN +#define IPV6_FW_TCPF_RST TH_RST +#define IPV6_FW_TCPF_PSH TH_PUSH +#define IPV6_FW_TCPF_ACK TH_ACK +#define IPV6_FW_TCPF_URG TH_URG + +/* + * Main firewall chains definitions and global var's definitions. + */ +#ifdef _KERNEL + +/* + * Function definitions. + */ +void ip6_fw_init(void); + +/* Firewall hooks */ +struct ip6_hdr; +typedef int ip6_fw_chk_t __P((struct ip6_hdr**, struct ifnet*, struct mbuf**)); +typedef int ip6_fw_ctl_t __P((int, struct mbuf**)); +extern ip6_fw_chk_t *ip6_fw_chk_ptr; +extern ip6_fw_ctl_t *ip6_fw_ctl_ptr; +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 +extern int ip6_fw_enable; +#endif + +#endif /* _KERNEL */ + +#endif /* _IP6_FW_H */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/ip6_mroute.h b/packages/net/bsd_tcpip/current/include/netinet6/ip6_mroute.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/ip6_mroute.h @@ -0,0 +1,291 @@ +//========================================================================== +// +// include/netinet6/ip6_mroute.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp */ + +/* + * Definitions for IP multicast forwarding. + * + * Written by David Waitzman, BBN Labs, August 1988. + * Modified by Steve Deering, Stanford, February 1989. + * Modified by Ajit Thyagarajan, PARC, August 1993. + * Modified by Ajit Thyagarajan, PARC, August 1994. + * Modified by Ahmed Helmy, USC, September 1996. + * + * MROUTING Revision: 1.2 + */ + +#ifndef _NETINET6_IP6_MROUTE_H_ +#define _NETINET6_IP6_MROUTE_H_ + +/* + * Multicast Routing set/getsockopt commands. + */ +#ifdef _KERNEL +#define MRT6_OINIT 100 /* initialize forwarder (omrt6msg) */ +#endif +#define MRT6_DONE 101 /* shut down forwarder */ +#define MRT6_ADD_MIF 102 /* add multicast interface */ +#define MRT6_DEL_MIF 103 /* delete multicast interface */ +#define MRT6_ADD_MFC 104 /* insert forwarding cache entry */ +#define MRT6_DEL_MFC 105 /* delete forwarding cache entry */ +#define MRT6_PIM 107 /* enable pim code */ +#define MRT6_INIT 108 /* initialize forwarder (mrt6msg) */ + +#define GET_TIME(t) microtime(&t) + +/* + * Types and macros for handling bitmaps with one bit per multicast interface. + */ +typedef u_short mifi_t; /* type of a mif index */ +#define MAXMIFS 64 + +#ifndef IF_SETSIZE +#define IF_SETSIZE 256 +#endif + +typedef u_int32_t if_mask; +#define NIFBITS (sizeof(if_mask) * NBBY) /* bits per mask */ + +#ifndef howmany +#define howmany(x, y) (((x) + ((y) - 1)) / (y)) +#endif + +typedef struct if_set { + if_mask ifs_bits[howmany(IF_SETSIZE, NIFBITS)]; +} if_set; + +#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS))) +#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS))) +#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS))) +#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f))) +#define IF_ZERO(p) bzero(p, sizeof(*(p))) + +/* + * Argument structure for MRT6_ADD_IF. + */ +struct mif6ctl { + mifi_t mif6c_mifi; /* the index of the mif to be added */ + u_char mif6c_flags; /* MIFF_ flags defined below */ + u_short mif6c_pifi; /* the index of the physical IF */ +#ifdef notyet + u_int mif6c_rate_limit; /* max rate */ +#endif +}; + +#define MIFF_REGISTER 0x1 /* mif represents a register end-point */ + +/* + * Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC + */ +struct mf6cctl { + struct sockaddr_in6 mf6cc_origin; /* IPv6 origin of mcasts */ + struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */ + mifi_t mf6cc_parent; /* incoming ifindex */ + struct if_set mf6cc_ifset; /* set of forwarding ifs */ +}; + +/* + * The kernel's multicast routing statistics. + */ +struct mrt6stat { + u_quad_t mrt6s_mfc_lookups; /* # forw. cache hash table hits */ + u_quad_t mrt6s_mfc_misses; /* # forw. cache hash table misses */ + u_quad_t mrt6s_upcalls; /* # calls to mrouted */ + u_quad_t mrt6s_no_route; /* no route for packet's origin */ + u_quad_t mrt6s_bad_tunnel; /* malformed tunnel options */ + u_quad_t mrt6s_cant_tunnel; /* no room for tunnel options */ + u_quad_t mrt6s_wrong_if; /* arrived on wrong interface */ + u_quad_t mrt6s_upq_ovflw; /* upcall Q overflow */ + u_quad_t mrt6s_cache_cleanups; /* # entries with no upcalls */ + u_quad_t mrt6s_drop_sel; /* pkts dropped selectively */ + u_quad_t mrt6s_q_overflow; /* pkts dropped - Q overflow */ + u_quad_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */ + u_quad_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */ +}; + +#ifdef MRT6_OINIT +/* + * Struct used to communicate from kernel to multicast router + * note the convenient similarity to an IPv6 header. + * XXX old version, superseded by mrt6msg. + */ +struct omrt6msg { + u_long unused1; + u_char im6_msgtype; /* what type of message */ +#if 0 +#define MRT6MSG_NOCACHE 1 +#define MRT6MSG_WRONGMIF 2 +#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/ +#endif + u_char im6_mbz; /* must be zero */ + u_char im6_mif; /* mif rec'd on */ + u_char unused2; + struct in6_addr im6_src, im6_dst; +}; +#endif + +/* + * Structure used to communicate from kernel to multicast router. + * We'll overlay the structure onto an MLD header (not an IPv6 header + * like igmpmsg{} used for IPv4 implementation). This is because this + * structure will be passed via an IPv6 raw socket, on which an application + * will only receive the payload i.e. the data after the IPv6 header and all + * the extension headers. (see Section 3 of draft-ietf-ipngwg-2292bis-01) + */ +struct mrt6msg { +#define MRT6MSG_NOCACHE 1 +#define MRT6MSG_WRONGMIF 2 +#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/ + u_char im6_mbz; /* must be zero */ + u_char im6_msgtype; /* what type of message */ + u_int16_t im6_mif; /* mif rec'd on */ + u_int32_t im6_pad; /* padding for 64bit arch */ + struct in6_addr im6_src, im6_dst; +}; + +/* + * Argument structure used by multicast routing daemon to get src-grp + * packet counts + */ +struct sioc_sg_req6 { + struct sockaddr_in6 src; + struct sockaddr_in6 grp; + u_quad_t pktcnt; + u_quad_t bytecnt; + u_quad_t wrong_if; +}; + +/* + * Argument structure used by mrouted to get mif pkt counts + */ +struct sioc_mif_req6 { + mifi_t mifi; /* mif number */ + u_quad_t icount; /* Input packet count on mif */ + u_quad_t ocount; /* Output packet count on mif */ + u_quad_t ibytes; /* Input byte count on mif */ + u_quad_t obytes; /* Output byte count on mif */ +}; + +#if defined(_KERNEL) || defined(KERNEL) +/* + * The kernel's multicast-interface structure. + */ +struct mif6 { + u_char m6_flags; /* MIFF_ flags defined above */ + u_int m6_rate_limit; /* max rate */ +#ifdef notyet + struct tbf *m6_tbf; /* token bucket structure at intf. */ +#endif + struct in6_addr m6_lcl_addr; /* local interface address */ + struct ifnet *m6_ifp; /* pointer to interface */ + u_quad_t m6_pkt_in; /* # pkts in on interface */ + u_quad_t m6_pkt_out; /* # pkts out on interface */ + u_quad_t m6_bytes_in; /* # bytes in on interface */ + u_quad_t m6_bytes_out; /* # bytes out on interface */ + struct route m6_route;/* cached route if this is a tunnel */ +#ifdef notyet + u_int m6_rsvp_on; /* RSVP listening on this vif */ + struct socket *m6_rsvpd; /* RSVP daemon socket */ +#endif +}; + +/* + * The kernel's multicast forwarding cache entry structure + */ +struct mf6c { + struct sockaddr_in6 mf6c_origin; /* IPv6 origin of mcasts */ + struct sockaddr_in6 mf6c_mcastgrp; /* multicast group associated*/ + mifi_t mf6c_parent; /* incoming IF */ + struct if_set mf6c_ifset; /* set of outgoing IFs */ + + u_quad_t mf6c_pkt_cnt; /* pkt count for src-grp */ + u_quad_t mf6c_byte_cnt; /* byte count for src-grp */ + u_quad_t mf6c_wrong_if; /* wrong if for src-grp */ + int mf6c_expire; /* time to clean entry up */ + struct timeval mf6c_last_assert; /* last time I sent an assert*/ + struct rtdetq *mf6c_stall; /* pkts waiting for route */ + struct mf6c *mf6c_next; /* hash table linkage */ +}; + +#define MF6C_INCOMPLETE_PARENT ((mifi_t)-1) + +/* + * Argument structure used for pkt info. while upcall is made + */ +#ifndef _NETINET_IP_MROUTE_H_ +struct rtdetq { /* XXX: rtdetq is also defined in ip_mroute.h */ + struct mbuf *m; /* A copy of the packet */ + struct ifnet *ifp; /* Interface pkt came in on */ +#ifdef UPCALL_TIMING + struct timeval t; /* Timestamp */ +#endif /* UPCALL_TIMING */ + struct rtdetq *next; +}; +#endif /* _NETINET_IP_MROUTE_H_ */ + +#define MF6CTBLSIZ 256 +#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0 /* from sys:route.h */ +#define MF6CHASHMOD(h) ((h) & (MF6CTBLSIZ - 1)) +#else +#define MF6CHASHMOD(h) ((h) % MF6CTBLSIZ) +#endif + +#define MAX_UPQ6 4 /* max. no of pkts in upcall Q */ + +int ip6_mrouter_set __P((struct socket *so, struct sockopt *sopt)); +int ip6_mrouter_get __P((struct socket *so, struct sockopt *sopt)); +int ip6_mrouter_done __P((void)); +int mrt6_ioctl __P((int, caddr_t)); +#endif /* _KERNEL */ + +#endif /* !_NETINET6_IP6_MROUTE_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/ip6_var.h b/packages/net/bsd_tcpip/current/include/netinet6/ip6_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/ip6_var.h @@ -0,0 +1,479 @@ +//========================================================================== +// +// include/netinet6/ip6_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip6_var.h,v 1.79 2001/12/27 15:37:41 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_var.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET6_IP6_VAR_H_ +#define _NETINET6_IP6_VAR_H_ + +/* + * IP6 reassembly queue structure. Each fragment + * being reassembled is attached to one of these structures. + */ +struct ip6q { + u_int32_t ip6q_head; + u_int16_t ip6q_len; + u_int8_t ip6q_nxt; /* ip6f_nxt in first fragment */ + u_int8_t ip6q_hlim; + struct ip6asfrag *ip6q_down; + struct ip6asfrag *ip6q_up; + u_int32_t ip6q_ident; + u_int8_t ip6q_arrive; + u_int8_t ip6q_ttl; + struct in6_addr ip6q_src, ip6q_dst; + struct ip6q *ip6q_next; + struct ip6q *ip6q_prev; + int ip6q_unfrglen; /* len of unfragmentable part */ +#ifdef notyet + u_char *ip6q_nxtp; +#endif +}; + +struct ip6asfrag { + u_int32_t ip6af_head; + u_int16_t ip6af_len; + u_int8_t ip6af_nxt; + u_int8_t ip6af_hlim; + /* must not override the above members during reassembling */ + struct ip6asfrag *ip6af_down; + struct ip6asfrag *ip6af_up; + struct mbuf *ip6af_m; + int ip6af_offset; /* offset in ip6af_m to next header */ + int ip6af_frglen; /* fragmentable part length */ + int ip6af_off; /* fragment offset */ + u_int16_t ip6af_mff; /* more fragment bit in frag off */ +}; + +#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) + +struct ip6_moptions { + struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */ + u_char im6o_multicast_hlim; /* hoplimit for outgoing multicasts */ + u_char im6o_multicast_loop; /* 1 >= hear sends if a member */ + LIST_HEAD(, in6_multi_mship) im6o_memberships; +}; + +/* + * Control options for outgoing packets + */ + +/* Routing header related info */ +struct ip6po_rhinfo { + struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */ +#if defined(NEW_STRUCT_ROUTE) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) + struct route ip6po_rhi_route; /* Route to the 1st hop */ +#else + struct route_in6 ip6po_rhi_route; /* Route to the 1st hop */ +#endif +}; +#define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr +#define ip6po_route ip6po_rhinfo.ip6po_rhi_route + +/* Nexthop related info */ +struct ip6po_nhinfo { + struct sockaddr *ip6po_nhi_nexthop; +#if defined(NEW_STRUCT_ROUTE) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) + struct route ip6po_nhi_route; /* Route to the nexthop */ +#else + struct route_in6 ip6po_nhi_route; /* Route to the nexthop */ +#endif +}; +#define ip6po_nexthop ip6po_nhinfo.ip6po_nhi_nexthop +#define ip6po_nextroute ip6po_nhinfo.ip6po_nhi_route + +struct ip6_pktopts { + int ip6po_hlim; /* Hoplimit for outgoing packets */ + + /* Outgoing IF/address information */ + struct in6_pktinfo *ip6po_pktinfo; + + /* Next-hop address information */ + struct ip6po_nhinfo ip6po_nhinfo; + + struct ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */ + + /* Destination options header (before a routing header) */ + struct ip6_dest *ip6po_dest1; + + /* Routing header related info. */ + struct ip6po_rhinfo ip6po_rhinfo; + + /* Destination options header (after a routing header) */ + struct ip6_dest *ip6po_dest2; + + /* traffic class */ + int ip6po_tclass; + + int ip6po_flags; +#define IP6PO_REACHCONF 0x01 /* upper-layer reachability confirmation */ +#define IP6PO_MINMTU 0x02 /* use minimum MTU (IPV6_USE_MIN_MTU) */ +#define IP6PO_DONTFRAG 0x04 /* disable fragmentation (IPV6_DONTFRAG) */ + + int needfree; /* members dynamically allocated */ +}; + +/* + * Control options for incoming packets + */ + +struct ip6_recvpktopts { + struct mbuf *head; /* mbuf chain of data passed to a user */ + +#ifdef SO_TIMESTAMP + struct mbuf *timestamp; /* timestamp */ +#endif + struct mbuf *hlim; /* received hop limit */ + struct mbuf *pktinfo; /* packet information of rcv packet */ + struct mbuf *hbh; /* HbH options header of rcv packet */ + struct mbuf *dest; /* Dest opt header of rcv packet */ + struct mbuf *rthdr; /* Routing header of rcv packet */ +}; + +struct ip6stat { + u_quad_t ip6s_total; /* total packets received */ + u_quad_t ip6s_tooshort; /* packet too short */ + u_quad_t ip6s_toosmall; /* not enough data */ + u_quad_t ip6s_fragments; /* fragments received */ + u_quad_t ip6s_fragdropped; /* frags dropped(dups, out of space) */ + u_quad_t ip6s_fragtimeout; /* fragments timed out */ + u_quad_t ip6s_fragoverflow; /* fragments that exceeded limit */ + u_quad_t ip6s_forward; /* packets forwarded */ + u_quad_t ip6s_cantforward; /* packets rcvd for unreachable dest */ + u_quad_t ip6s_redirectsent; /* packets forwarded on same net */ + u_quad_t ip6s_delivered; /* datagrams delivered to upper level*/ + u_quad_t ip6s_localout; /* total ip packets generated here */ + u_quad_t ip6s_odropped; /* lost packets due to nobufs, etc. */ + u_quad_t ip6s_reassembled; /* total packets reassembled ok */ + u_quad_t ip6s_fragmented; /* datagrams sucessfully fragmented */ + u_quad_t ip6s_ofragments; /* output fragments created */ + u_quad_t ip6s_cantfrag; /* don't fragment flag was set, etc. */ + u_quad_t ip6s_badoptions; /* error in option processing */ + u_quad_t ip6s_noroute; /* packets discarded due to no route */ + u_quad_t ip6s_badvers; /* ip6 version != 6 */ + u_quad_t ip6s_rawout; /* total raw ip packets generated */ + u_quad_t ip6s_badscope; /* scope error */ + u_quad_t ip6s_notmember; /* don't join this multicast group */ + u_quad_t ip6s_nxthist[256]; /* next header history */ + u_quad_t ip6s_m1; /* one mbuf */ + u_quad_t ip6s_m2m[32]; /* two or more mbuf */ + u_quad_t ip6s_mext1; /* one ext mbuf */ + u_quad_t ip6s_mext2m; /* two or more ext mbuf */ + u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */ + u_quad_t ip6s_nogif; /* no match gif found */ + u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */ + + /* + * statistics for improvement of the source address selection + * algorithm: + * XXX: hardcoded 16 = # of ip6 multicast scope types + 1 + */ + /* number of times that address selection fails */ + u_quad_t ip6s_sources_none; + /* number of times that an address on the outgoing I/F is chosen */ + u_quad_t ip6s_sources_sameif[16]; + /* number of times that an address on a non-outgoing I/F is chosen */ + u_quad_t ip6s_sources_otherif[16]; + /* + * number of times that an address that has the same scope + * from the destination is chosen. + */ + u_quad_t ip6s_sources_samescope[16]; + /* + * number of times that an address that has a different scope + * from the destination is chosen. + */ + u_quad_t ip6s_sources_otherscope[16]; + /* number of times that an deprecated address is chosen */ + u_quad_t ip6s_sources_deprecated[16]; + + u_quad_t ip6s_forward_cachehit; + u_quad_t ip6s_forward_cachemiss; + + /* number of times that each rule of source selection is applied. */ + u_quad_t ip6s_sources_rule[16]; +}; + +#ifdef _KERNEL +/* + * IPv6 onion peeling state. + * it will be initialized when we come into ip6_input(). + * XXX do not make it a kitchen sink! + */ +struct ip6aux { + u_int32_t ip6a_flags; +#define IP6A_SWAP 0x01 /* swapped home/care-of on packet */ +#define IP6A_HASEEN 0x02 /* HA was present */ +#define IP6A_BRUID 0x04 /* BR Unique Identifier was present */ +#define IP6A_RTALERTSEEN 0x08 /* rtalert present */ +#define IP6A_ROUTEOPTIMIZED 0x10 /* route optimized packet */ + + /* ip6.ip6_src */ + struct in6_addr ip6a_careof; /* care-of address of the peer */ + struct in6_addr ip6a_home; /* home address of the peer */ + + /* ip6.ip6_dst */ + struct in6_ifaddr *ip6a_dstia6; /* my ifaddr that matches ip6_dst */ + + /* rtalert */ + u_int16_t ip6a_rtalert; /* rtalert option value */ + + /* + * decapsulation history will be here. + * with IPsec it may not be accurate. + */ +}; +#endif + +#ifdef _KERNEL +/* flags passed to ip6_output as last parameter */ +#define IPV6_UNSPECSRC 0x01 /* allow :: as the source address */ +#define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */ +#define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */ + +extern struct ip6stat ip6stat; /* statistics */ +extern u_int32_t ip6_id; /* fragment identifier */ +extern int ip6_defhlim; /* default hop limit */ +extern int ip6_defmcasthlim; /* default multicast hop limit */ +extern int ip6_forwarding; /* act as router? */ +extern int ip6_forward_srcrt; /* forward src-routed? */ +extern int ip6_use_deprecated; /* allow deprecated addr as source */ +extern int ip6_rr_prune; /* router renumbering prefix + * walk list every 5 sec. */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +#define ip6_mapped_addr_on (!ip6_v6only) +#endif +#if defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ == 2) || (defined(__bsdi__) && _BSDI_VERSION < 199802) +extern const int ip6_v6only; +#else +extern int ip6_v6only; +#endif + +extern struct socket *ip6_mrouter; /* multicast routing daemon */ +extern int ip6_sendredirects; /* send IP redirects when forwarding? */ +extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */ +extern int ip6_sourcecheck; /* Verify source interface */ +extern int ip6_sourcecheck_interval; /* Interval between log messages */ +extern int ip6_accept_rtadv; /* Acts as a host not a router */ +extern int ip6_keepfaith; /* Firewall Aided Internet Translator */ +extern int ip6_log_interval; +extern time_t ip6_log_time; +extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */ +extern int ip6_dad_count; /* DupAddrDetectionTransmits */ + +extern u_int32_t ip6_flow_seq; +extern int ip6_auto_flowlabel; +extern int ip6_auto_linklocal; + +extern int ip6_anonportmin; /* minimum ephemeral port */ +extern int ip6_anonportmax; /* maximum ephemeral port */ +extern int ip6_lowportmin; /* minimum reserved port */ +extern int ip6_lowportmax; /* maximum reserved port */ + +extern int ip6_use_tempaddr; /* whether to use temporary addresses. */ +extern int ip6_prefer_tempaddr; /* whether to prefer temporary addresses + in the source address selection */ + +extern int ip6_use_defzone; /* whether to use the default scope zone + when unspecified */ + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) +struct in6pcb; +#endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +extern struct pr_usrreqs rip6_usrreqs; +struct sockopt; +#endif + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) /* fbsd3 || HAVE_NRL_INPCB */ +struct inpcb; +#endif + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +int icmp6_ctloutput __P((struct socket *, struct sockopt *sopt)); +#else +int icmp6_ctloutput __P((int, struct socket *, int, int, struct mbuf **)); +#endif + +struct in6_ifaddr; +void ip6_init __P((void)); +void ip6intr __P((void)); +void ip6_input __P((struct mbuf *)); +struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *)); +void ip6_freepcbopts __P((struct ip6_pktopts *)); +void ip6_freemoptions __P((struct ip6_moptions *)); +int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int)); +char * ip6_get_prevhdr __P((struct mbuf *, int)); +int ip6_nexthdr __P((struct mbuf *, int, int, int *)); +int ip6_lasthdr __P((struct mbuf *, int, int, int *)); + +struct mbuf *ip6_addaux __P((struct mbuf *)); +struct mbuf *ip6_findaux __P((struct mbuf *)); +void ip6_delaux __P((struct mbuf *)); + +int ip6_mforward __P((struct ip6_hdr *, struct ifnet *, struct mbuf *)); +int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *, + u_int32_t *)); +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) /* fbsd3 || HAVE_NRL_INPCB */ +void ip6_savecontrol __P((struct inpcb *, struct ip6_hdr *, struct mbuf *, + struct ip6_recvpktopts *, + struct ip6_recvpktopts **)); +void ip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *, + u_int32_t *)); +#else +void ip6_savecontrol __P((struct in6pcb *, struct ip6_hdr *, struct mbuf *, + struct ip6_recvpktopts *, + struct ip6_recvpktopts **)); +void ip6_notify_pmtu __P((struct in6pcb *, struct sockaddr_in6 *, + u_int32_t *)); +#endif +void ip6_update_recvpcbopt __P((struct ip6_recvpktopts *, + struct ip6_recvpktopts *)); +void ip6_reset_rcvopt __P((struct ip6_recvpktopts *, int)); +int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); + +void ip6_forward __P((struct mbuf *, int)); + +void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *)); +#if defined(NEW_STRUCT_ROUTE) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) +int ip6_output __P((struct mbuf *, struct ip6_pktopts *, + struct route *, + int, + struct ip6_moptions *, struct ifnet **)); +#else +int ip6_output __P((struct mbuf *, struct ip6_pktopts *, + struct route_in6 *, + int, + struct ip6_moptions *, struct ifnet **)); +#endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +int ip6_ctloutput __P((struct socket *, struct sockopt *sopt)); +#else +int ip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **)); +#endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +int ip6_raw_ctloutput __P((struct socket *, struct sockopt *sopt)); +#else +int ip6_raw_ctloutput __P((int, struct socket *, int, int, + struct mbuf **)); +#endif +void init_ip6pktopts __P((struct ip6_pktopts *)); +int ip6_setpktoptions __P((struct mbuf *, struct ip6_pktopts *, struct ip6_pktopts *, int, int)); +void ip6_clearpktopts __P((struct ip6_pktopts *, int)); +struct ip6_pktopts *ip6_copypktopts __P((struct ip6_pktopts *, int)); +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) /* fbsd3 || HAVE_NRL_INPCB */ +int ip6_optlen __P((struct inpcb *)); +#else +int ip6_optlen __P((struct in6pcb *)); +#endif + +int route6_input __P((struct mbuf **, int *, int)); + +void frag6_init __P((void)); +int frag6_input __P((struct mbuf **, int *, int)); +void frag6_slowtimo __P((void)); +void frag6_drain __P((void)); + +void rip6_init __P((void)); +int rip6_input __P((struct mbuf **mp, int *offp, int proto)); +void rip6_ctlinput __P((int, struct sockaddr *, void *)); +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +int rip6_ctloutput __P((struct socket *so, struct sockopt *sopt)); +#else +int rip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **)); +#endif +#if (defined(__FreeBSD__) && __FreeBSD__ >= 4) +int rip6_output __P((struct mbuf *, struct socket *, + struct sockaddr_in6 *, struct mbuf *)); +#else +int rip6_output __P((struct mbuf *, ...)); +#endif /* (defined(__FreeBSD__) && __FreeBSD__ >= 4) */ +int rip6_usrreq __P((struct socket *, + int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *)); + +int dest6_input __P((struct mbuf **, int *, int)); +int none_input __P((struct mbuf **, int *, int)); +#endif /* _KERNEL */ + +#endif /* !_NETINET6_IP6_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/ip6protosw.h b/packages/net/bsd_tcpip/current/include/netinet6/ip6protosw.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/ip6protosw.h @@ -0,0 +1,216 @@ +//========================================================================== +// +// include/netinet6/ip6protosw.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip6protosw.h,v 1.25 2001/09/26 06:13:03 keiichi Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + * + */ + +/* BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp */ + +/*- + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)protosw.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _NETINET6_IP6PROTOSW_H_ +#define _NETINET6_IP6PROTOSW_H_ + +/* + * Protocol switch table for IPv6. + * All other definitions should refer to sys/protosw.h + */ + +#ifdef __NetBSD__ +/* + * For pfil_head structure. + */ +#include +#endif + +struct mbuf; +struct sockaddr; +struct socket; +struct domain; +struct proc; +struct ip6_hdr; +struct icmp6_hdr; +struct in6_addr; +#ifdef __FreeBSD__ +struct pr_usrreqs; +#endif + +/* + * argument type for the last arg of pr_ctlinput(). + * should be consulted only with AF_INET6 family. + * + * IPv6 ICMP IPv6 [exthdrs] finalhdr paylaod + * ^ ^ ^ ^ + * | | ip6c_ip6 ip6c_off + * | ip6c_icmp6 + * ip6c_m + * + * ip6c_finaldst usually points to ip6c_ip6->ip6_dst. if the original + * (internal) packet carries a routing header, it may point the final + * dstination address in the routing header. + * + * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6 + * (beware of flowlabel, if you try to compare it against others) + * ip6c_dst: ip6c_finaldst + scope info + */ +struct ip6ctlparam { + struct mbuf *ip6c_m; /* start of mbuf chain */ + struct icmp6_hdr *ip6c_icmp6; /* icmp6 header of target packet */ + struct ip6_hdr *ip6c_ip6; /* ip6 header of target packet */ + int ip6c_off; /* offset of the target proto header */ + struct sockaddr_in6 *ip6c_src; /* srcaddr w/ additional info */ + struct sockaddr_in6 *ip6c_dst; /* (final) dstaddr w/ additional info */ + struct in6_addr *ip6c_finaldst; /* final destination address */ + void *ip6c_cmdarg; /* control command dependent data */ + u_int8_t ip6c_nxt; /* final next header field */ +}; + +struct ip6protosw { +#ifdef __NetBSD__ + int pr_type; /* socket type used for */ +#else + short pr_type; /* socket type used for */ +#endif + struct domain *pr_domain; /* domain protocol a member of */ + short pr_protocol; /* protocol number */ + short pr_flags; /* see below */ + +/* protocol-protocol hooks */ + int (*pr_input) /* input to protocol (from below) */ + __P((struct mbuf **, int *, int)); +#ifdef __bsdi__ + int (*pr_output)(); /* output to protocol (from above) */ +#else + int (*pr_output) /* output to protocol (from above) */ + __P((struct mbuf *, ...)); +#endif + void (*pr_ctlinput) /* control input (from below) */ + __P((int, struct sockaddr *, void *)); +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 + int (*pr_ctloutput) /* control output (from above) */ + __P((struct socket *, struct sockopt *)); +#else + int (*pr_ctloutput) /* control output (from above) */ + __P((int, struct socket *, int, int, struct mbuf **)); +#endif + +/* user-protocol hook */ +#if !(defined(__FreeBSD__) && __FreeBSD__ < 3) && !defined(__bsdi__) + int (*pr_usrreq) /* user request: see list below */ + __P((struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *, struct proc *)); +#else + int (*pr_usrreq) /* user request: see list below */ + __P((struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *)); +#endif + +/* utility hooks */ + void (*pr_init) /* initialization hook */ + __P((void)); + + void (*pr_fasttimo) /* fast timeout (200ms) */ + __P((void)); + void (*pr_slowtimo) /* slow timeout (500ms) */ + __P((void)); + void (*pr_drain) /* flush any excess space possible */ + __P((void)); +#ifdef __FreeBSD__ + struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ +#else + int (*pr_sysctl) /* sysctl for protocol */ + __P((int *, u_int, void *, size_t *, void *, size_t)); +#endif +#ifdef __NetBSD__ + struct pfil_head pr_pfh; +#endif +}; + +#ifdef __NetBSD__ +extern struct ip6protosw inet6sw[]; +#endif + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 4) +void pfctlinput2 __P((int, struct sockaddr *, void *)); +#endif +#endif /* !_NETINET6_IP6PROTOSW_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/ipsec.h b/packages/net/bsd_tcpip/current/include/netinet6/ipsec.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/ipsec.h @@ -0,0 +1,529 @@ +//========================================================================== +// +// include/netinet6/ipsec.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * IPsec controller part. + */ + +#ifndef _NETINET6_IPSEC_H_ +#define _NETINET6_IPSEC_H_ + +#if defined(_KERNEL) && !defined(_LKM) && !defined(KLD_MODULE) +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +#include "opt_inet.h" +#include "opt_inet6.h" +#include "opt_ipsec.h" +#endif +#if defined(__NetBSD__) +#include "opt_inet.h" +#include "opt_ipsec.h" +#endif +#endif + +#include +#include + +#ifdef _KERNEL + +/* + * Security Policy Index + * Ensure that both address families in the "src" and "dst" are same. + * When the value of the ul_proto is ICMPv6, the port field in "src" + * specifies ICMPv6 type, and the port field in "dst" specifies ICMPv6 code. + */ +struct secpolicyindex { + u_int8_t dir; /* direction of packet flow, see blow */ + struct sockaddr_storage src; /* IP src address for SP */ + struct sockaddr_storage dst; /* IP dst address for SP */ + u_int8_t prefs; /* prefix length in bits for src */ + u_int8_t prefd; /* prefix length in bits for dst */ + u_int16_t ul_proto; /* upper layer Protocol */ +#ifdef notyet + uid_t uids; + uid_t uidd; + gid_t gids; + gid_t gidd; +#endif +}; + +/* Security Policy Data Base */ +struct secpolicy { + LIST_ENTRY(secpolicy) chain; + + int refcnt; /* reference count */ + struct secpolicyindex spidx; /* selector */ + u_int32_t id; /* It's unique number on the system. */ + u_int state; /* 0: dead, others: alive */ +#define IPSEC_SPSTATE_DEAD 0 +#define IPSEC_SPSTATE_ALIVE 1 + + u_int policy; /* DISCARD, NONE or IPSEC, see keyv2.h */ + struct ipsecrequest *req; + /* pointer to the ipsec request tree, */ + /* if policy == IPSEC else this value == NULL.*/ + + /* + * lifetime handler. + * the policy can be used without limitiation if both lifetime and + * validtime are zero. + * "lifetime" is passed by sadb_lifetime.sadb_lifetime_addtime. + * "validtime" is passed by sadb_lifetime.sadb_lifetime_usetime. + */ + long created; /* time created the policy */ + long lastused; /* updated every when kernel sends a packet */ + long lifetime; /* duration of the lifetime of this policy */ + long validtime; /* duration this policy is valid without use */ +}; + +/* Request for IPsec */ +struct ifnet; +struct ipsecrequest { + struct ipsecrequest *next; + /* pointer to next structure */ + /* If NULL, it means the end of chain. */ + struct secasindex saidx;/* hint for search proper SA */ + /* if __ss_len == 0 then no address specified.*/ + u_int level; /* IPsec level defined below. */ + + struct secasvar *sav; /* place holder of SA for use */ + struct secpolicy *sp; /* back pointer to SP */ + + struct ifnet *tunifp; /* interface for tunnelling */ +}; + +/* security policy in PCB */ +struct inpcbpolicy { + struct secpolicy *sp_in; + struct secpolicy *sp_out; + int priv; /* privileged socket ? */ + + /* cached policy */ + /* XXX 3 == IPSEC_DIR_MAX */ + struct secpolicy *cache[3]; + struct secpolicyindex cacheidx[3]; + int cachegen[3]; /* cache generation #, the time we filled it */ + int cacheflags; +#define IPSEC_PCBSP_CONNECTED 1 +}; + +/* SP acquiring list table. */ +struct secspacq { + LIST_ENTRY(secspacq) chain; + + struct secpolicyindex spidx; + + long created; /* for lifetime */ + int count; /* for lifetime */ + /* XXX: here is mbuf place holder to be sent ? */ +}; + +struct ipsecaux { + struct socket *so; + int hdrs; /* # of ipsec headers */ + + struct secpolicy *sp; + struct ipsecrequest *req; +}; +#endif /* _KERNEL */ + +/* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */ +#define IPSEC_PORT_ANY 0 +#define IPSEC_ULPROTO_ANY 255 +#define IPSEC_PROTO_ANY 255 + +/* mode of security protocol */ +/* NOTE: DON'T use IPSEC_MODE_ANY at SPD. It's only use in SAD */ +#define IPSEC_MODE_ANY 0 /* i.e. wildcard. */ +#define IPSEC_MODE_TRANSPORT 1 +#define IPSEC_MODE_TUNNEL 2 + +/* + * Direction of security policy. + * NOTE: Since INVALID is used just as flag. + * The other are used for loop counter too. + */ +#define IPSEC_DIR_ANY 0 +#define IPSEC_DIR_INBOUND 1 +#define IPSEC_DIR_OUTBOUND 2 +#define IPSEC_DIR_MAX 3 +#define IPSEC_DIR_INVALID 4 + +/* Policy level */ +/* + * IPSEC, ENTRUST and BYPASS are allowed for setsockopt() in PCB, + * DISCARD, IPSEC and NONE are allowed for setkey() in SPD. + * DISCARD and NONE are allowed for system default. + */ +#define IPSEC_POLICY_DISCARD 0 /* discarding packet */ +#define IPSEC_POLICY_NONE 1 /* through IPsec engine */ +#define IPSEC_POLICY_IPSEC 2 /* do IPsec */ +#define IPSEC_POLICY_ENTRUST 3 /* consulting SPD if present. */ +#define IPSEC_POLICY_BYPASS 4 /* only for privileged socket. */ + +/* Security protocol level */ +#define IPSEC_LEVEL_DEFAULT 0 /* reference to system default */ +#define IPSEC_LEVEL_USE 1 /* use SA if present. */ +#define IPSEC_LEVEL_REQUIRE 2 /* require SA. */ +#define IPSEC_LEVEL_UNIQUE 3 /* unique SA. */ + +#define IPSEC_MANUAL_REQID_MAX 0x3fff + /* + * if security policy level == unique, this id + * indicate to a relative SA for use, else is + * zero. + * 1 - 0x3fff are reserved for manual keying. + * 0 are reserved for above reason. Others is + * for kernel use. + * Note that this id doesn't identify SA + * by only itself. + */ +#define IPSEC_REPLAYWSIZE 32 + +/* statistics for ipsec processing */ +struct ipsecstat { + u_quad_t in_success; /* succeeded inbound process */ + u_quad_t in_polvio; + /* security policy violation for inbound process */ + u_quad_t in_nosa; /* inbound SA is unavailable */ + u_quad_t in_inval; /* inbound processing failed due to EINVAL */ + u_quad_t in_nomem; /* inbound processing failed due to ENOBUFS */ + u_quad_t in_badspi; /* failed getting a SPI */ + u_quad_t in_ahreplay; /* AH replay check failed */ + u_quad_t in_espreplay; /* ESP replay check failed */ + u_quad_t in_ahauthsucc; /* AH authentication success */ + u_quad_t in_ahauthfail; /* AH authentication failure */ + u_quad_t in_espauthsucc; /* ESP authentication success */ + u_quad_t in_espauthfail; /* ESP authentication failure */ + u_quad_t in_esphist[256]; + u_quad_t in_ahhist[256]; + u_quad_t in_comphist[256]; + u_quad_t out_success; /* succeeded outbound process */ + u_quad_t out_polvio; + /* security policy violation for outbound process */ + u_quad_t out_nosa; /* outbound SA is unavailable */ + u_quad_t out_inval; /* outbound process failed due to EINVAL */ + u_quad_t out_nomem; /* inbound processing failed due to ENOBUFS */ + u_quad_t out_noroute; /* there is no route */ + u_quad_t out_esphist[256]; + u_quad_t out_ahhist[256]; + u_quad_t out_comphist[256]; + + u_quad_t spdcachelookup; + u_quad_t spdcachemiss; +}; + +/* + * Definitions for IPsec & Key sysctl operations. + */ +/* + * Names for IPsec & Key sysctl objects + */ +#define IPSECCTL_STATS 1 /* stats */ +#define IPSECCTL_DEF_POLICY 2 +#define IPSECCTL_DEF_ESP_TRANSLEV 3 /* int; ESP transport mode */ +#define IPSECCTL_DEF_ESP_NETLEV 4 /* int; ESP tunnel mode */ +#define IPSECCTL_DEF_AH_TRANSLEV 5 /* int; AH transport mode */ +#define IPSECCTL_DEF_AH_NETLEV 6 /* int; AH tunnel mode */ +#if 0 /* obsolete, do not reuse */ +#define IPSECCTL_INBOUND_CALL_IKE 7 +#endif +#define IPSECCTL_AH_CLEARTOS 8 +#define IPSECCTL_AH_OFFSETMASK 9 +#define IPSECCTL_DFBIT 10 +#define IPSECCTL_ECN 11 +#define IPSECCTL_DEBUG 12 +#define IPSECCTL_ESP_RANDPAD 13 +#define IPSECCTL_MAXID 14 + +#define IPSECCTL_NAMES { \ + { 0, 0 }, \ + { 0, 0 }, \ + { "def_policy", CTLTYPE_INT }, \ + { "esp_trans_deflev", CTLTYPE_INT }, \ + { "esp_net_deflev", CTLTYPE_INT }, \ + { "ah_trans_deflev", CTLTYPE_INT }, \ + { "ah_net_deflev", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "ah_cleartos", CTLTYPE_INT }, \ + { "ah_offsetmask", CTLTYPE_INT }, \ + { "dfbit", CTLTYPE_INT }, \ + { "ecn", CTLTYPE_INT }, \ + { "debug", CTLTYPE_INT }, \ + { "esp_randpad", CTLTYPE_INT }, \ +} + +#define IPSEC6CTL_NAMES { \ + { 0, 0 }, \ + { 0, 0 }, \ + { "def_policy", CTLTYPE_INT }, \ + { "esp_trans_deflev", CTLTYPE_INT }, \ + { "esp_net_deflev", CTLTYPE_INT }, \ + { "ah_trans_deflev", CTLTYPE_INT }, \ + { "ah_net_deflev", CTLTYPE_INT }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "ecn", CTLTYPE_INT }, \ + { "debug", CTLTYPE_INT }, \ + { "esp_randpad", CTLTYPE_INT }, \ +} + +#ifdef __bsdi__ +#define IPSECCTL_VARS { \ + 0, \ + 0, \ + &ip4_def_policy.policy, \ + &ip4_esp_trans_deflev, \ + &ip4_esp_net_deflev, \ + &ip4_ah_trans_deflev, \ + &ip4_ah_net_deflev, \ + 0, \ + &ip4_ah_cleartos, \ + &ip4_ah_offsetmask, \ + &ip4_ipsec_dfbit, \ + &ip4_ipsec_ecn, \ + &ipsec_debug, \ + &ip4_esp_randpad, \ +} + +#define IPSEC6CTL_VARS { \ + 0, \ + 0, \ + &ip6_def_policy.policy, \ + &ip6_esp_trans_deflev, \ + &ip6_esp_net_deflev, \ + &ip6_ah_trans_deflev, \ + &ip6_ah_net_deflev, \ + 0, \ + 0, \ + 0, \ + 0, \ + &ip6_ipsec_ecn, \ + &ipsec_debug, \ + &ip6_esp_randpad, \ +} +#endif + +#ifdef _KERNEL +struct ipsec_output_state { + struct mbuf *m; + struct route *ro; + struct sockaddr *dst; + int encap; +}; + +struct ipsec_history { + int ih_proto; + u_int32_t ih_spi; +}; + +extern int ipsec_debug; +extern int ipsec_tunnel_device; + +#ifdef INET +extern struct ipsecstat ipsecstat; +extern struct secpolicy ip4_def_policy; +extern int ip4_esp_trans_deflev; +extern int ip4_esp_net_deflev; +extern int ip4_ah_trans_deflev; +extern int ip4_ah_net_deflev; +extern int ip4_ah_cleartos; +extern int ip4_ah_offsetmask; +extern int ip4_ipsec_dfbit; +extern int ip4_ipsec_ecn; +extern int ip4_esp_randpad; +#endif + +#ifdef INET6 +extern struct ipsecstat ipsec6stat; +extern struct secpolicy ip6_def_policy; +extern int ip6_esp_trans_deflev; +extern int ip6_esp_net_deflev; +extern int ip6_ah_trans_deflev; +extern int ip6_ah_net_deflev; +extern int ip6_ipsec_ecn; +extern int ip6_esp_randpad; +#endif + +#define ipseclog(x) do { if (ipsec_debug) log x; } while (0) + +extern int ipsec_pcbconn __P((struct inpcbpolicy *)); +extern int ipsec_pcbdisconn __P((struct inpcbpolicy *)); +extern int ipsec_invalpcbcacheall __P((void)); + +extern struct secpolicy *ipsec4_getpolicybysock + __P((struct mbuf *, u_int, struct socket *, int *)); +extern struct secpolicy *ipsec4_getpolicybyaddr + __P((struct mbuf *, u_int, int, int *)); + +#ifdef INET6 +extern struct secpolicy *ipsec6_getpolicybysock + __P((struct mbuf *, u_int, struct socket *, int *)); +extern struct secpolicy *ipsec6_getpolicybyaddr + __P((struct mbuf *, u_int, int, int *)); +#endif /* INET6 */ + +struct inpcb; +#ifdef INET6 +struct in6pcb; +#endif +extern int ipsec_init_policy __P((struct socket *so, struct inpcbpolicy **)); +extern int ipsec_copy_policy + __P((struct inpcbpolicy *, struct inpcbpolicy *)); +extern u_int ipsec_get_reqlevel __P((struct ipsecrequest *)); + +extern int ipsec4_set_policy __P((struct inpcb *inp, int optname, + caddr_t request, size_t len, int priv)); +extern int ipsec4_get_policy __P((struct inpcb *inpcb, caddr_t request, + size_t len, struct mbuf **mp)); +extern int ipsec4_delete_pcbpolicy __P((struct inpcb *)); +extern int ipsec4_in_reject_so __P((struct mbuf *, struct socket *)); +extern int ipsec4_in_reject __P((struct mbuf *, struct inpcb *)); + +#ifdef INET6 +extern int ipsec6_in_reject_so __P((struct mbuf *, struct socket *)); +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +extern int ipsec6_delete_pcbpolicy __P((struct inpcb *)); +extern int ipsec6_set_policy __P((struct inpcb *inp, int optname, + caddr_t request, size_t len, int priv)); +extern int ipsec6_get_policy + __P((struct inpcb *inp, caddr_t request, size_t len, struct mbuf **mp)); +extern int ipsec6_in_reject __P((struct mbuf *, struct inpcb *)); +#else +extern int ipsec6_delete_pcbpolicy __P((struct in6pcb *)); +extern int ipsec6_set_policy __P((struct in6pcb *in6p, int optname, + caddr_t request, size_t len, int priv)); +extern int ipsec6_get_policy __P((struct in6pcb *in6p, caddr_t request, + size_t len, struct mbuf **mp)); +extern int ipsec6_in_reject __P((struct mbuf *, struct in6pcb *)); +#endif +#endif /* INET6 */ + +struct secas; +struct tcpcb; +struct tcp6cb; +extern int ipsec_chkreplay __P((u_int32_t, struct secasvar *)); +extern int ipsec_updatereplay __P((u_int32_t, struct secasvar *)); + +extern size_t ipsec4_hdrsiz __P((struct mbuf *, u_int, struct inpcb *)); +#if (defined(__FreeBSD__) && __FreeBSD__ == 3) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +extern size_t ipsec_hdrsiz_tcp __P((struct tcpcb *, int)); +#elif (defined(__FreeBSD__) && __FreeBSD__ >= 4) +extern size_t ipsec_hdrsiz_tcp __P((struct tcpcb *)); +#else +extern size_t ipsec4_hdrsiz_tcp __P((struct tcpcb *)); +#endif +#ifdef INET6 +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +extern size_t ipsec6_hdrsiz __P((struct mbuf *, u_int, struct inpcb *)); +#else +extern size_t ipsec6_hdrsiz __P((struct mbuf *, u_int, struct in6pcb *)); +#if defined(__NetBSD__) && !defined(TCP6) +extern size_t ipsec6_hdrsiz_tcp __P((struct tcpcb *)); +#else +extern size_t ipsec6_hdrsiz_tcp __P((struct tcp6cb *)); +#endif +#endif +#endif + +struct ip; +#ifdef INET6 +struct ip6_hdr; +#endif +extern const char *ipsec4_logpacketstr __P((struct ip *, u_int32_t)); +#ifdef INET6 +extern const char *ipsec6_logpacketstr __P((struct ip6_hdr *, u_int32_t)); +#endif +extern const char *ipsec_logsastr __P((struct secasvar *)); + +extern void ipsec_dumpmbuf __P((struct mbuf *)); + +extern int ipsec4_output __P((struct ipsec_output_state *, struct secpolicy *, + int)); +#ifdef INET6 +extern int ipsec6_output_trans __P((struct ipsec_output_state *, u_char *, + struct mbuf *, struct secpolicy *, int, int *)); +extern int ipsec6_output_tunnel __P((struct ipsec_output_state *, + struct secpolicy *, int)); +#endif +extern int ipsec4_tunnel_validate __P((struct mbuf *, int, u_int, + struct secasvar *)); +#ifdef INET6 +extern int ipsec6_tunnel_validate __P((struct mbuf *, int, u_int, + struct secasvar *)); +#endif +extern struct mbuf *ipsec_copypkt __P((struct mbuf *)); +extern void ipsec_delaux __P((struct mbuf *)); +extern int ipsec_setsocket __P((struct mbuf *, struct socket *)); +extern struct socket *ipsec_getsocket __P((struct mbuf *)); +extern int ipsec_addhist __P((struct mbuf *, int, u_int32_t)); +extern int ipsec_getnhist __P((struct mbuf *)); +extern struct ipsec_history *ipsec_gethist __P((struct mbuf *, int *)); +extern void ipsec_clearhist __P((struct mbuf *)); + +#if defined(__bsdi__) || defined(__NetBSD__) +extern int ipsec_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); +extern int ipsec6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); +#endif /* __bsdi__ || __NetBSD__ */ + +#endif /* _KERNEL */ + +#ifndef _KERNEL +extern caddr_t ipsec_set_policy __P((char *, int)); +extern int ipsec_get_policylen __P((caddr_t)); +extern char *ipsec_dump_policy __P((caddr_t, char *)); + +extern const char *ipsec_strerror __P((void)); +#endif /* !_KERNEL */ + +#endif /* _NETINET6_IPSEC_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/mld6_var.h b/packages/net/bsd_tcpip/current/include/netinet6/mld6_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/mld6_var.h @@ -0,0 +1,77 @@ +//========================================================================== +// +// include/netinet6/mld6_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: mld6_var.h,v 1.4 2000/03/25 07:23:54 sumikawa Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#ifndef _NETINET6_MLD6_VAR_H_ +#define _NETINET6_MLD6_VAR_H_ + +#ifdef _KERNEL + +#ifndef __OpenBSD__ +#define MLD6_RANDOM_DELAY(X) (random() % (X) + 1) +#else +#define MLD6_RANDOM_DELAY(X) (arc4random() % (X) + 1) +#endif + +/* + * States for MLD stop-listening processing + */ +#define MLD6_OTHERLISTENER 0 +#define MLD6_IREPORTEDLAST 1 + +void mld6_init __P((void)); +void mld6_input __P((struct mbuf *, int)); +void mld6_start_listening __P((struct in6_multi *)); +void mld6_stop_listening __P((struct in6_multi *)); +void mld6_fasttimeo __P((void)); +#endif /* _KERNEL */ + +#endif /* _NETINET6_MLD6_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/nd6.h b/packages/net/bsd_tcpip/current/include/netinet6/nd6.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/nd6.h @@ -0,0 +1,446 @@ +//========================================================================== +// +// include/netinet6/nd6.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: nd6.h,v 1.76 2001/12/18 02:10:31 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#ifndef _NETINET6_ND6_H_ +#define _NETINET6_ND6_H_ + +/* see net/route.h, or net/if_inarp.h */ +#ifndef RTF_ANNOUNCE +#define RTF_ANNOUNCE RTF_PROTO2 +#endif + +#include + +struct llinfo_nd6 { + struct llinfo_nd6 *ln_next; + struct llinfo_nd6 *ln_prev; + struct rtentry *ln_rt; + struct mbuf *ln_hold; /* last packet until resolved/timeout */ + long ln_asked; /* number of queries already sent for this addr */ + u_long ln_expire; /* lifetime for NDP state transition */ + short ln_state; /* reachability state */ + short ln_router; /* 2^0: ND6 router bit */ + int ln_byhint; /* # of times we made it reachable by UL hint */ +}; + +#define ND6_LLINFO_NOSTATE -2 +/* + * We don't need the WAITDELETE state any more, but we keep the definition + * in a comment line instead of removing it. This is necessary to avoid + * unintentionally reusing the value for another purpose, which might + * affect backward compatibility with old applications. + * (20000711 jinmei@kame.net) + */ +/* #define ND6_LLINFO_WAITDELETE -1 */ +#define ND6_LLINFO_INCOMPLETE 0 +#define ND6_LLINFO_REACHABLE 1 +#define ND6_LLINFO_STALE 2 +#define ND6_LLINFO_DELAY 3 +#define ND6_LLINFO_PROBE 4 + +#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE) + +struct nd_ifinfo { + u_int32_t linkmtu; /* LinkMTU */ + u_int32_t maxmtu; /* Upper bound of LinkMTU */ + u_int32_t basereachable; /* BaseReachableTime */ + u_int32_t reachable; /* Reachable Time */ + u_int32_t retrans; /* Retrans Timer */ + u_int32_t flags; /* Flags */ + int recalctm; /* BaseReacable re-calculation timer */ + u_int8_t chlim; /* CurHopLimit */ + u_int8_t receivedra; + /* the following 3 members are for privacy extension for addrconf */ + u_int8_t randomseed0[8]; /* upper 64 bits of MD5 digest */ + u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */ + u_int8_t randomid[8]; /* current random ID */ +}; + +#define ND6_IFF_PERFORMNUD 0x1 +#define ND6_IFF_ACCEPT_RTADV 0x2 +#define ND6_IFF_PREFER_SOURCE 0x4 /* XXX: not related to ND. */ + +struct in6_nbrinfo { + char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct in6_addr addr; /* IPv6 address of the neighbor */ + long asked; /* number of queries already sent for this addr */ + int isrouter; /* if it acts as a router */ + int state; /* reachability state */ + int expire; /* lifetime for NDP state transition */ +}; + +#define DRLSTSIZ 10 +#define PRLSTSIZ 10 +struct in6_drlist { + char ifname[IFNAMSIZ]; + struct { + struct in6_addr rtaddr; + u_char flags; + u_short rtlifetime; + u_long expire; + u_short if_index; + } defrouter[DRLSTSIZ]; +}; + +struct in6_defrouter { + struct sockaddr_in6 rtaddr; + u_char flags; + u_short rtlifetime; + u_long expire; + u_short if_index; +}; + +#ifdef _KERNEL +struct in6_oprlist { + char ifname[IFNAMSIZ]; + struct { + struct in6_addr prefix; + struct prf_ra raflags; + u_char prefixlen; + u_char origin; + u_long vltime; + u_long pltime; + u_long expire; + u_short if_index; + u_short advrtrs; /* number of advertisement routers */ + struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */ + } prefix[PRLSTSIZ]; +}; +#endif + +struct in6_prlist { + char ifname[IFNAMSIZ]; + struct { + struct in6_addr prefix; + struct prf_ra raflags; + u_char prefixlen; + u_char origin; + u_int32_t vltime; + u_int32_t pltime; + time_t expire; + u_short if_index; + u_short advrtrs; /* number of advertisement routers */ + struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */ + } prefix[PRLSTSIZ]; +}; + +struct in6_prefix { + struct sockaddr_in6 prefix; + struct prf_ra raflags; + u_char prefixlen; + u_char origin; + u_int32_t vltime; + u_int32_t pltime; + time_t expire; + u_int32_t flags; + int refcnt; + u_short if_index; + u_short advrtrs; /* number of advertisement routers */ + /* struct sockaddr_in6 advrtr[] */ +}; + +#ifdef _KERNEL +struct in6_ondireq { + char ifname[IFNAMSIZ]; + struct { + u_int32_t linkmtu; /* LinkMTU */ + u_int32_t maxmtu; /* Upper bound of LinkMTU */ + u_int32_t basereachable; /* BaseReachableTime */ + u_int32_t reachable; /* Reachable Time */ + u_int32_t retrans; /* Retrans Timer */ + u_int32_t flags; /* Flags */ + int recalctm; /* BaseReacable re-calculation timer */ + u_int8_t chlim; /* CurHopLimit */ + u_int8_t receivedra; + } ndi; +}; +#endif + +struct in6_ndireq { + char ifname[IFNAMSIZ]; + struct nd_ifinfo ndi; +}; + +struct in6_ndifreq { + char ifname[IFNAMSIZ]; + u_long ifindex; +}; + +/* Prefix status */ +#define NDPRF_ONLINK 0x1 +#define NDPRF_DETACHED 0x2 +#define NDPRF_HOME 0x4 + +/* protocol constants */ +#define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */ +#define RTR_SOLICITATION_INTERVAL 4 /* 4sec */ +#define MAX_RTR_SOLICITATIONS 3 + +#define ND6_INFINITE_LIFETIME 0xffffffff + +#ifdef _KERNEL +/* node constants */ +#define MAX_REACHABLE_TIME 3600000 /* msec */ +#define REACHABLE_TIME 30000 /* msec */ +#define RETRANS_TIMER 1000 /* msec */ +#define MIN_RANDOM_FACTOR 512 /* 1024 * 0.5 */ +#define MAX_RANDOM_FACTOR 1536 /* 1024 * 1.5 */ +#define DEF_TEMP_VALID_LIFETIME 604800 /* 1 week */ +#define DEF_TEMP_PREFERRED_LIFETIME 86400 /* 1 day */ +#define TEMPADDR_REGEN_ADVANCE 5 /* sec */ +#define MAX_TEMP_DESYNC_FACTOR 600 /* 10 min */ +#define ND_COMPUTE_RTIME(x) \ + (((MIN_RANDOM_FACTOR * (x >> 10)) + (random() & \ + ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000) + +TAILQ_HEAD(nd_drhead, nd_defrouter); +struct nd_defrouter { + TAILQ_ENTRY(nd_defrouter) dr_entry; + struct in6_addr rtaddr; + u_char flags; /* flags on RA message */ + u_short rtlifetime; + u_long expire; + u_long advint; /* Mobile IPv6 addition (milliseconds) */ + u_long advint_expire; /* Mobile IPv6 addition */ + int advints_lost; /* Mobile IPv6 addition */ + struct ifnet *ifp; + int installed; /* is installed into kernel routing table */ +}; + +struct nd_prefix { + struct ifnet *ndpr_ifp; + LIST_ENTRY(nd_prefix) ndpr_entry; + struct sockaddr_in6 ndpr_prefix; /* prefix */ + struct in6_addr ndpr_mask; /* netmask derived from the prefix */ + + u_int32_t ndpr_vltime; /* advertised valid lifetime */ + u_int32_t ndpr_pltime; /* advertised preferred lifetime */ + + time_t ndpr_expire; /* expiration time of the prefix */ + time_t ndpr_preferred; /* preferred time of the prefix */ + time_t ndpr_lastupdate; /* reception time of last advertisement */ + + struct prf_ra ndpr_flags; + u_int32_t ndpr_stateflags; /* actual state flags */ + /* list of routers that advertise the prefix: */ + LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs; + u_char ndpr_plen; + int ndpr_refcnt; /* reference couter from addresses */ +}; + +#define ndpr_next ndpr_entry.le_next + +#define ndpr_raf ndpr_flags +#define ndpr_raf_onlink ndpr_flags.onlink +#define ndpr_raf_auto ndpr_flags.autonomous +#define ndpr_raf_router ndpr_flags.router + +/* + * Message format for use in obtaining information about prefixes + * from inet6 sysctl function + */ +struct inet6_ndpr_msghdr { + u_short inpm_msglen; /* to skip over non-understood messages */ + u_char inpm_version; /* future binary compatibility */ + u_char inpm_type; /* message type */ + struct in6_addr inpm_prefix; + u_long prm_vltim; + u_long prm_pltime; + u_long prm_expire; + u_long prm_preferred; + struct in6_prflags prm_flags; + u_short prm_index; /* index for associated ifp */ + u_char prm_plen; /* length of prefix in bits */ +}; + +#define prm_raf_onlink prm_flags.prf_ra.onlink +#define prm_raf_auto prm_flags.prf_ra.autonomous + +#define prm_statef_onlink prm_flags.prf_state.onlink + +#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid +#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd + +#define ifpr2ndpr(ifpr) ((struct nd_prefix *)(ifpr)) +#define ndpr2ifpr(ndpr) ((struct ifprefix *)(ndpr)) + +struct nd_pfxrouter { + LIST_ENTRY(nd_pfxrouter) pfr_entry; +#define pfr_next pfr_entry.le_next + struct nd_defrouter *router; +}; + +LIST_HEAD(nd_prhead, nd_prefix); + +/* nd6.c */ +extern int nd6_prune; +extern int nd6_delay; +extern int nd6_umaxtries; +extern int nd6_mmaxtries; +extern int nd6_useloopback; +extern int nd6_maxnudhint; +extern int nd6_gctimer; +extern struct llinfo_nd6 llinfo_nd6; +extern struct nd_ifinfo *nd_ifinfo; +extern struct nd_drhead nd_defrouter; +extern struct nd_prhead nd_prefix; +extern int nd6_debug; + +#define nd6log(x) do { if (nd6_debug) log x; } while (0) + +extern struct callout nd6_timer_ch; + +/* nd6_rtr.c */ +extern int nd6_defifindex; +extern int ip6_desync_factor; /* seconds */ +extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */ +extern u_int32_t ip6_temp_valid_lifetime; /* seconds */ +extern int ip6_temp_regen_advance; /* seconds */ + +union nd_opts { + struct nd_opt_hdr *nd_opt_array[13]; /* max = target address list */ + struct { + struct nd_opt_hdr *zero; + struct nd_opt_hdr *src_lladdr; + struct nd_opt_hdr *tgt_lladdr; + struct nd_opt_prefix_info *pi_beg; /* multiple opts, start */ + struct nd_opt_rd_hdr *rh; + struct nd_opt_mtu *mtu; + struct nd_opt_hdr *six; + struct nd_opt_advinterval *adv; + struct nd_opt_homeagent_info *hai; + struct nd_opt_hdr *src_addrlist; + struct nd_opt_hdr *tgt_addrlist; + struct nd_opt_hdr *search; /* multiple opts */ + struct nd_opt_hdr *last; /* multiple opts */ + int done; + struct nd_opt_prefix_info *pi_end;/* multiple opts, end */ + } nd_opt_each; +}; +#define nd_opts_src_lladdr nd_opt_each.src_lladdr +#define nd_opts_tgt_lladdr nd_opt_each.tgt_lladdr +#define nd_opts_pi nd_opt_each.pi_beg +#define nd_opts_pi_end nd_opt_each.pi_end +#define nd_opts_rh nd_opt_each.rh +#define nd_opts_mtu nd_opt_each.mtu +#define nd_opts_adv nd_opt_each.adv +#define nd_opts_hai nd_opt_each.hai +#define nd_opts_src_addrlist nd_opt_each.src_addrlist +#define nd_opts_tgt_addrlist nd_opt_each.tgt_addrlist +#define nd_opts_search nd_opt_each.search +#define nd_opts_last nd_opt_each.last +#define nd_opts_done nd_opt_each.done + +/* XXX: need nd6_var.h?? */ +/* nd6.c */ +void nd6_init __P((void)); +void nd6_ifattach __P((struct ifnet *)); +int nd6_is_addr_neighbor __P((struct sockaddr_in6 *, struct ifnet *)); +void nd6_option_init __P((void *, int, union nd_opts *)); +struct nd_opt_hdr *nd6_option __P((union nd_opts *)); +int nd6_options __P((union nd_opts *)); +struct rtentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *)); +void nd6_setmtu __P((struct ifnet *)); +void nd6_timer __P((void *)); +void nd6_purge __P((struct ifnet *)); +void nd6_nud_hint __P((struct rtentry *, struct in6_addr *, int)); +int nd6_resolve __P((struct ifnet *, struct rtentry *, + struct mbuf *, struct sockaddr *, u_char *)); +void nd6_rtrequest __P((int, struct rtentry *, struct sockaddr *)); +int nd6_ioctl __P((u_long, caddr_t, struct ifnet *)); +struct rtentry *nd6_cache_lladdr __P((struct ifnet *, struct in6_addr *, + char *, int, int, int)); +int nd6_output __P((struct ifnet *, struct ifnet *, struct mbuf *, + struct sockaddr_in6 *, struct rtentry *)); +int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *, + struct sockaddr *, u_char *)); +int nd6_need_cache __P((struct ifnet *)); + +/* nd6_nbr.c */ +void nd6_na_input __P((struct mbuf *, int, int)); +void nd6_na_output __P((struct ifnet *, const struct in6_addr *, + const struct in6_addr *, u_long, int, struct sockaddr *)); +void nd6_ns_input __P((struct mbuf *, int, int)); +void nd6_ns_output __P((struct ifnet *, const struct in6_addr *, + const struct in6_addr *, struct llinfo_nd6 *, int)); +caddr_t nd6_ifptomac __P((struct ifnet *)); +void nd6_dad_start __P((struct ifaddr *, int *)); +void nd6_dad_stop __P((struct ifaddr *)); +void nd6_dad_duplicated __P((struct ifaddr *)); + +/* nd6_rtr.c */ +void nd6_rs_input __P((struct mbuf *, int, int)); +void nd6_ra_input __P((struct mbuf *, int, int)); +void prelist_del __P((struct nd_prefix *)); +void defrouter_addreq __P((struct nd_defrouter *)); +void defrouter_reset __P((void)); +void defrouter_select __P((void)); +void defrtrlist_del __P((struct nd_defrouter *)); +void prelist_remove __P((struct nd_prefix *)); +int prelist_update __P((struct nd_prefix *, struct nd_defrouter *, + struct mbuf *)); +int nd6_prelist_add __P((struct nd_prefix *, struct nd_defrouter *, + struct nd_prefix **)); +int nd6_prefix_onlink __P((struct nd_prefix *)); +int nd6_prefix_offlink __P((struct nd_prefix *)); +void pfxlist_onlink_check __P((void)); +struct nd_defrouter *defrouter_lookup __P((struct in6_addr *, + struct ifnet *)); +struct nd_prefix *nd6_prefix_lookup __P((struct nd_prefix *)); +int in6_init_prefix_ltimes __P((struct nd_prefix *ndpr)); +void rt6_flush __P((struct in6_addr *, struct ifnet *)); +int nd6_setdefaultiface __P((int)); +int in6_tmpifadd __P((const struct in6_ifaddr *, int)); + +#endif /* _KERNEL */ + +#endif /* _NETINET6_ND6_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/pim6.h b/packages/net/bsd_tcpip/current/include/netinet6/pim6.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/pim6.h @@ -0,0 +1,89 @@ +//========================================================================== +// +// include/netinet6/pim6.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: pim6.h,v 1.3 2000/03/25 07:23:58 sumikawa Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ +/* + * Protocol Independent Multicast (PIM) definitions + * + * Written by Ahmed Helmy, SGI, July 1996 + * + * MULTICAST + */ + +/* + * PIM packet header + */ +#define PIM_VERSION 2 +struct pim { +#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN) + u_char pim_type:4, /* the PIM message type, currently they are: + * Hello, Register, Register-Stop, Join/Prune, + * Bootstrap, Assert, Graft (PIM-DM only), + * Graft-Ack (PIM-DM only), C-RP-Adv + */ + pim_ver:4; /* PIM version number; 2 for PIMv2 */ +#else + u_char pim_ver:4, /* PIM version */ + pim_type:4; /* PIM type */ +#endif + u_char pim_rsv; /* Reserved */ + u_short pim_cksum; /* IP style check sum */ +}; + +#define PIM_MINLEN 8 /* The header min. length is 8 */ +#define PIM6_REG_MINLEN (PIM_MINLEN+40) /* Register message + inner IP6 header */ + +/* + * Message types + */ +#define PIM_REGISTER 1 /* PIM Register type is 1 */ + +/* second bit in reg_head is the null bit */ +#define PIM_NULL_REGISTER 0x40000000 diff --git a/packages/net/bsd_tcpip/current/include/netinet6/pim6_var.h b/packages/net/bsd_tcpip/current/include/netinet6/pim6_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/pim6_var.h @@ -0,0 +1,90 @@ +//========================================================================== +// +// include/netinet6/pim6_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: pim6_var.h,v 1.8 2000/06/06 08:07:43 jinmei Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#ifndef _NETINET6_PIM6_VAR_H_ +#define _NETINET6_PIM6_VAR_H_ + +/* + * Protocol Independent Multicast (PIM), + * implementation-specific definitions. + * + * Written by George Edmond Eddy (Rusty), ISI, February 1998 + * Modified by Pavlin Ivanov Radoslavov, USC/ISI, May 1998 + */ + +struct pim6stat { + u_quad_t pim6s_rcv_total; /* total PIM messages received */ + u_quad_t pim6s_rcv_tooshort; /* received with too few bytes */ + u_quad_t pim6s_rcv_badsum; /* received with bad checksum */ + u_quad_t pim6s_rcv_badversion; /* received bad PIM version */ + u_quad_t pim6s_rcv_registers; /* received registers */ + u_quad_t pim6s_rcv_badregisters; /* received invalid registers */ + u_quad_t pim6s_snd_registers; /* sent registers */ +}; + +#if (defined(KERNEL)) || (defined(_KERNEL)) +extern struct pim6stat pim6stat; + +int pim6_input __P((struct mbuf **, int*, int)); +#endif /* KERNEL */ + +/* + * Names for PIM sysctl objects + */ +#define PIM6CTL_STATS 1 /* statistics (read-only) */ +#define PIM6CTL_MAXID 2 + +#define PIM6CTL_NAMES { \ + { 0, 0 }, \ + { 0, 0 }, \ +} +#endif /* _NETINET6_PIM6_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/raw_ip6.h b/packages/net/bsd_tcpip/current/include/netinet6/raw_ip6.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/raw_ip6.h @@ -0,0 +1,74 @@ +//========================================================================== +// +// include/netinet6/raw_ip6.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: raw_ip6.h,v 1.2 2001/05/27 13:28:35 itojun Exp $ */ + +/* + * Copyright (C) 2001 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#ifndef _NETINET6_RAW_IP6_H_ +#define _NETINET6_RAW_IP6_H_ + +/* + * ICMPv6 stat is counted separately. see netinet/icmp6.h + */ +struct rip6stat { + u_quad_t rip6s_ipackets; /* total input packets */ + u_quad_t rip6s_isum; /* input checksum computations */ + u_quad_t rip6s_badsum; /* of above, checksum error */ + u_quad_t rip6s_nosock; /* no matching socket */ + u_quad_t rip6s_nosockmcast; /* of above, arrived as multicast */ + u_quad_t rip6s_fullsock; /* not delivered, input socket full */ + + u_quad_t rip6s_opackets; /* total output packets */ +}; + +#ifdef _KERNEL +extern struct rip6stat rip6stat; +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/netinet6/scope6_var.h b/packages/net/bsd_tcpip/current/include/netinet6/scope6_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/scope6_var.h @@ -0,0 +1,68 @@ +//========================================================================== +// +// include/netinet6/scope6_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: scope6_var.h,v 1.6 2001/11/13 03:09:47 jinmei Exp $ */ + +/* + * Copyright (C) 2000 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#ifndef _NETINET6_SCOPE6_VAR_H_ +#define _NETINET6_SCOPE6_VAR_H_ + +#ifdef _KERNEL +void scope6_ifattach __P((struct ifnet *)); +int scope6_set __P((struct ifnet *, u_int32_t *)); +int scope6_get __P((struct ifnet *, u_int32_t *)); +void scope6_setdefault __P((struct ifnet *)); +int scope6_get_default __P((u_int32_t *)); +u_int32_t scope6_in6_addrscope __P((struct in6_addr *)); +u_int32_t scope6_addr2default __P((struct in6_addr *)); +int scope6_setzoneid __P((struct ifnet *, struct sockaddr_in6 *)); +int scope6_check_id __P((struct sockaddr_in6 *, int)); +#endif /* _KERNEL */ + +#endif /* _NETINET6_SCOPE6_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/tcp6_var.h b/packages/net/bsd_tcpip/current/include/netinet6/tcp6_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/tcp6_var.h @@ -0,0 +1,106 @@ +//========================================================================== +// +// include/netinet6/tcp6_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + * + * $FreeBSD: src/sys/netinet6/tcp6_var.h,v 1.3.2.1 2000/07/15 07:14:38 kris Exp $ + */ + +/* + * Copyright (c) 1982, 1986, 1993, 1994, 1995 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_var.h 8.4 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet6/tcp6_var.h,v 1.3.2.1 2000/07/15 07:14:38 kris Exp $ + */ + +#ifndef _NETINET_TCP6_VAR_H_ +#define _NETINET_TCP6_VAR_H_ + +#ifdef _KERNEL + +extern int tcp_v6mssdflt; /* XXX */ + +struct ip6_hdr; +void tcp6_ctlinput __P((int, struct sockaddr *, void *)); +void tcp6_init __P((void)); +int tcp6_input __P((struct mbuf **, int *, int)); +struct rtentry *tcp_rtlookup6 __P((struct inpcb *)); + +extern struct pr_usrreqs tcp6_usrreqs; + +#endif /* _KERNEL */ + +#endif /* _NETINET_TCP6_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netinet6/udp6_var.h b/packages/net/bsd_tcpip/current/include/netinet6/udp6_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netinet6/udp6_var.h @@ -0,0 +1,102 @@ +//========================================================================== +// +// include/netinet6/udp6_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + * + * $FreeBSD: src/sys/netinet6/udp6_var.h,v 1.3.2.1 2000/07/15 07:14:38 kris Exp $ + */ + +/* + * Copyright (c) 1982, 1986, 1989, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET6_UDP6_VAR_H_ +#define _NETINET6_UDP6_VAR_H_ + +#ifdef _KERNEL + +extern struct pr_usrreqs udp6_usrreqs; + +void udp6_ctlinput __P((int, struct sockaddr *, void *)); +int udp6_input __P((struct mbuf **, int *, int)); +int udp6_output __P((struct inpcb *inp, struct mbuf *m, + struct sockaddr *addr, struct mbuf *control, + struct proc *p)); +#endif + +#endif /*_NETINET6_UDP6_VAR_H_*/ diff --git a/packages/net/bsd_tcpip/current/include/netkey/key_var.h b/packages/net/bsd_tcpip/current/include/netkey/key_var.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netkey/key_var.h @@ -0,0 +1,113 @@ +//========================================================================== +// +// include/netkey/key_var.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: key_var.h,v 1.12 2001/11/06 03:48:29 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#ifndef _NETKEY_KEY_VAR_H_ +#define _NETKEY_KEY_VAR_H_ + + +/* sysctl */ +#define KEYCTL_DEBUG_LEVEL 1 +#define KEYCTL_SPI_TRY 2 +#define KEYCTL_SPI_MIN_VALUE 3 +#define KEYCTL_SPI_MAX_VALUE 4 +#define KEYCTL_RANDOM_INT 5 +#define KEYCTL_LARVAL_LIFETIME 6 +#define KEYCTL_BLOCKACQ_COUNT 7 +#define KEYCTL_BLOCKACQ_LIFETIME 8 +#define KEYCTL_ESP_KEYMIN 9 +#define KEYCTL_ESP_AUTH 10 +#define KEYCTL_AH_KEYMIN 11 +#define KEYCTL_PREFERED_OLDSA 12 +#define KEYCTL_MAXID 13 + +#define KEYCTL_NAMES { \ + { 0, 0 }, \ + { "debug", CTLTYPE_INT }, \ + { "spi_try", CTLTYPE_INT }, \ + { "spi_min_value", CTLTYPE_INT }, \ + { "spi_max_value", CTLTYPE_INT }, \ + { "random_int", CTLTYPE_INT }, \ + { "larval_lifetime", CTLTYPE_INT }, \ + { "blockacq_count", CTLTYPE_INT }, \ + { "blockacq_lifetime", CTLTYPE_INT }, \ + { "esp_keymin", CTLTYPE_INT }, \ + { "esp_auth", CTLTYPE_INT }, \ + { "ah_keymin", CTLTYPE_INT }, \ + { "preferred_oldsa", CTLTYPE_INT }, \ +} + +#ifdef __bsdi__ +#define KEYCTL_VARS { \ + 0, \ + 0, \ + &key_spi_trycnt, \ + &key_spi_minval, \ + &key_spi_maxval, \ + &key_int_random, \ + &key_larval_lifetime, \ + &key_blockacq_count, \ + &key_blockacq_lifetime, \ + &ipsec_esp_keymin, \ + &ipsec_esp_auth, \ + &ipsec_ah_keymin, \ + &key_preferred_oldsa, \ +} +#endif + +#ifdef _KERNEL +#define _ARRAYLEN(p) (sizeof(p)/sizeof(p[0])) +#define _KEYLEN(key) ((u_int)((key)->sadb_key_bits >> 3)) +#define _KEYBITS(key) ((u_int)((key)->sadb_key_bits)) +#define _KEYBUF(key) ((caddr_t)((caddr_t)(key) + sizeof(struct sadb_key))) +#endif /*_KERNEL*/ + +#endif /* _NETKEY_KEY_VAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/netkey/keydb.h b/packages/net/bsd_tcpip/current/include/netkey/keydb.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/netkey/keydb.h @@ -0,0 +1,180 @@ +//========================================================================== +// +// include/netkey/keydb.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: keydb.h,v 1.14 2000/08/02 17:58:26 sakane Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#ifndef _NETKEY_KEYDB_H_ +#define _NETKEY_KEYDB_H_ + +#ifdef _KERNEL + +#include + +/* Security Assocciation Index */ +/* NOTE: Ensure to be same address family */ +struct secasindex { + struct sockaddr_storage src; /* srouce address for SA */ + struct sockaddr_storage dst; /* destination address for SA */ + u_int16_t proto; /* IPPROTO_ESP or IPPROTO_AH */ + u_int8_t mode; /* mode of protocol, see ipsec.h */ + u_int32_t reqid; /* reqid id who owned this SA */ + /* see IPSEC_MANUAL_REQID_MAX. */ +}; + +/* Security Association Data Base */ +struct secashead { + LIST_ENTRY(secashead) chain; + + struct secasindex saidx; + + struct sadb_ident *idents; /* source identity */ + struct sadb_ident *identd; /* destination identity */ + /* XXX I don't know how to use them. */ + + u_int8_t state; /* MATURE or DEAD. */ + LIST_HEAD(_satree, secasvar) savtree[SADB_SASTATE_MAX+1]; + /* SA chain */ + /* The first of this list is newer SA */ + + struct route sa_route; /* route cache */ +}; + +/* Security Association */ +struct secasvar { + LIST_ENTRY(secasvar) chain; + + int refcnt; /* reference count */ + u_int8_t state; /* Status of this Association */ + + u_int8_t alg_auth; /* Authentication Algorithm Identifier*/ + u_int8_t alg_enc; /* Cipher Algorithm Identifier */ + u_int32_t spi; /* SPI Value, network byte order */ + u_int32_t flags; /* holder for SADB_KEY_FLAGS */ + + struct sadb_key *key_auth; /* Key for Authentication */ + struct sadb_key *key_enc; /* Key for Encryption */ + caddr_t iv; /* Initilization Vector */ + u_int ivlen; /* length of IV */ + void *sched; /* intermediate encryption key */ + size_t schedlen; + + struct secreplay *replay; /* replay prevention */ + long created; /* for lifetime */ + + struct sadb_lifetime *lft_c; /* CURRENT lifetime, it's constant. */ + struct sadb_lifetime *lft_h; /* HARD lifetime */ + struct sadb_lifetime *lft_s; /* SOFT lifetime */ + + u_int32_t seq; /* sequence number */ + pid_t pid; /* message's pid */ + + struct secashead *sah; /* back pointer to the secashead */ +}; + +/* replay prevention */ +struct secreplay { + u_int32_t count; + u_int wsize; /* window size, i.g. 4 bytes */ + u_int32_t seq; /* used by sender */ + u_int32_t lastseq; /* used by receiver */ + caddr_t bitmap; /* used by receiver */ + int overflow; /* overflow flag */ +}; + +/* socket table due to send PF_KEY messages. */ +struct secreg { + LIST_ENTRY(secreg) chain; + + struct socket *so; +}; + +#ifndef IPSEC_NONBLOCK_ACQUIRE +/* acquiring list table. */ +struct secacq { + LIST_ENTRY(secacq) chain; + + struct secasindex saidx; + + u_int32_t seq; /* sequence number */ + long created; /* for lifetime */ + int count; /* for lifetime */ +}; +#endif + +/* Sensitivity Level Specification */ +/* nothing */ + +#define SADB_KILL_INTERVAL 600 /* six seconds */ + +struct key_cb { + int key_count; + int any_count; +}; + +/* secpolicy */ +extern struct secpolicy *keydb_newsecpolicy __P((void)); +extern void keydb_delsecpolicy __P((struct secpolicy *)); +/* secashead */ +extern struct secashead *keydb_newsecashead __P((void)); +extern void keydb_delsecashead __P((struct secashead *)); +/* secasvar */ +extern struct secasvar *keydb_newsecasvar __P((void)); +extern void keydb_refsecasvar __P((struct secasvar *)); +extern void keydb_freesecasvar __P((struct secasvar *)); +/* secreplay */ +extern struct secreplay *keydb_newsecreplay __P((size_t)); +extern void keydb_delsecreplay __P((struct secreplay *)); +/* secreg */ +extern struct secreg *keydb_newsecreg __P((void)); +extern void keydb_delsecreg __P((struct secreg *)); + +#endif /* _KERNEL */ + +#endif /* _NETKEY_KEYDB_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/sys/bsdtypes.h b/packages/net/bsd_tcpip/current/include/sys/bsdtypes.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/bsdtypes.h @@ -0,0 +1,98 @@ +//========================================================================== +// +// include/sys/bsdtypes.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +#ifndef _SYS_BSDTYPES_H_ +#define _SYS_BSDTYPES_H_ + +#include +#include + +#define __BIT_TYPES_DEFINED__ +typedef __signed char int8_t; +typedef unsigned char u_int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +typedef unsigned int uint32_t; +typedef long long int64_t; +typedef unsigned long long u_int64_t; +typedef unsigned long long uint64_t; + +// Types inherited from HAL + +typedef CYG_ADDRESS vaddr_t; +typedef CYG_ADDRWORD vsize_t; +typedef CYG_ADDRESS paddr_t; +typedef CYG_ADDRWORD psize_t; + +typedef CYG_ADDRESS vm_offset_t; +typedef CYG_ADDRWORD vm_size_t; + +// No good HAL definition for this + +typedef CYG_ADDRWORD register_t; + + +// From +/* + * Types which are fundamental to the implementation and may appear in + * more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_CLOCKID_T_ int +#define _BSD_TIMER_T_ int +#ifndef __time_t_defined // As defined/used by eCos libc +#define _BSD_CLOCK_T_ cyg_int64 /* clock() */ +#define _BSD_TIME_T_ cyg_count32 /* time() */ +#endif + +#endif // _MACHINE_TYPES_H_ + +// Standard BSD types +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef char *caddr_t; + +typedef u_int64_t u_quad_t; /* quads */ +typedef int64_t quad_t; +typedef quad_t * qaddr_t; + +/* + * XPG4.2 states that inclusion of must pull these + * in and that inclusion of must pull in sa_family_t. + * We put there here because there are other headers that require + * these types and and will indirectly + * include . Thus we are compliant without too many hoops. + */ +typedef u_int32_t in_addr_t; /* base type for internet address */ +typedef u_int16_t in_port_t; /* IP port type */ +typedef u_int8_t sa_family_t; /* sockaddr address family type */ +typedef u_int32_t socklen_t; /* length type for network syscalls */ diff --git a/packages/net/bsd_tcpip/current/include/sys/domain.h b/packages/net/bsd_tcpip/current/include/sys/domain.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/domain.h @@ -0,0 +1,97 @@ +//========================================================================== +// +// include/sys/domain.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)domain.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/sys/domain.h,v 1.14 1999/12/29 04:24:40 peter Exp $ + */ + +#ifndef _SYS_DOMAIN_H_ +#define _SYS_DOMAIN_H_ + +/* + * Structure per communications domain. + */ + +/* + * Forward structure declarations for function prototypes [sic]. + */ +struct mbuf; + +struct domain { + int dom_family; /* AF_xxx */ + char *dom_name; + void (*dom_init) /* initialize domain data structures */ + __P((void)); + int (*dom_externalize) /* externalize access rights */ + __P((struct mbuf *)); + void (*dom_dispose) /* dispose of internalized rights */ + __P((struct mbuf *)); + struct protosw *dom_protosw, *dom_protoswNPROTOSW; + struct domain *dom_next; + int (*dom_rtattach) /* initialize routing table */ + __P((void **, int)); + int dom_rtoffset; /* an arg to rtattach, in bits */ + int dom_maxrtkey; /* for routing layer */ +}; + +#ifdef _KERNEL +extern struct domain *domains; +extern struct domain localdomain; +extern void net_add_domain(void *); + +#define DOMAIN_SET(name) \ + SYSINIT(domain_ ## name, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, net_add_domain, & name ## domain) + +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/sys/endian.h b/packages/net/bsd_tcpip/current/include/sys/endian.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/endian.h @@ -0,0 +1,248 @@ +//========================================================================== +// +// include/sys/endian.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +//========================================================================== +// +// include/sys/endian.h +// +// +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +/* $OpenBSD: endian.h,v 1.4 1999/07/21 05:58:25 csapuntz Exp $ */ + +/*- + * Copyright (c) 1997 Niklas Hallqvist. 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Niklas Hallqvist. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + */ + +/* + * Generic definitions for little- and big-endian systems. Other endianesses + * has to be dealt with in the specific machine/endian.h file for that port. + * + * This file is meant to be included from a little- or big-endian port's + * machine/endian.h after setting BYTE_ORDER to either 1234 for little endian + * or 4321 for big.. + */ + +#ifndef _SYS_ENDIAN_H_ +#define _SYS_ENDIAN_H_ + +#include + +#if CYG_BYTEORDER == CYG_MSBFIRST +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif + +#ifndef _POSIX_SOURCE + +#define LITTLE_ENDIAN 1234 +#define BIG_ENDIAN 4321 +#define PDP_ENDIAN 3412 + +#ifdef __GNUC__ + +#define __swap16gen(x) ({ \ + cyg_uint16 __swap16gen_x = (x); \ + \ + (cyg_uint16)((__swap16gen_x & 0xff) << 8 | \ + (__swap16gen_x & 0xff00) >> 8); \ +}) + +#define __swap32gen(x) ({ \ + cyg_uint32 __swap32gen_x = (x); \ + \ + (cyg_uint32)((__swap32gen_x & 0xff) << 24 | \ + (__swap32gen_x & 0xff00) << 8 | \ + (__swap32gen_x & 0xff0000) >> 8 | \ + (__swap32gen_x & 0xff000000) >> 24); \ +}) + +#else /* __GNUC__ */ + +/* Note that these macros evaluate their arguments several times. */ +#define __swap16gen(x) \ + (cyg_uint16)(((cyg_uint16)(x) & 0xff) << 8 | ((cyg_uint16)(x) & 0xff00) >> 8) + +#define __swap32gen(x) \ + (cyg_uint32)(((cyg_uint32)(x) & 0xff) << 24 | \ + ((cyg_uint32)(x) & 0xff00) << 8 | ((cyg_uint32)(x) & 0xff0000) >> 8 | \ + ((cyg_uint32)(x) & 0xff000000) >> 24) + +#endif /* __GNUC__ */ + +/* + * Define MD_SWAP if you provide swap{16,32}md functions/macros that are + * optimized for your architecture, These will be used for swap{16,32} + * unless the argument is a constant and we are using GCC, where we can + * take advantage of the CSE phase much better by using the generic version. + */ +#ifdef MD_SWAP +#if __GNUC__ + +#define swap16(x) ({ \ + cyg_uint16 __swap16_x = (x); \ + \ + __builtin_constant_p(x) ? __swap16gen(__swap16_x) : \ + __swap16md(__swap16_x); \ +}) + +#define swap32(x) ({ \ + cyg_uint32 __swap32_x = (x); \ + \ + __builtin_constant_p(x) ? __swap32gen(__swap32_x) : \ + __swap32md(__swap32_x); \ +}) + +#endif /* __GNUC__ */ + +#else /* MD_SWAP */ +#define swap16 __swap16gen +#define swap32 __swap32gen +#endif /* MD_SWAP */ + +#define swap16_multi(v, n) do { \ + size_t __swap16_multi_n = (n); \ + cyg_uint16 *__swap16_multi_v = (v); \ + \ + while (__swap16_multi_n) { \ + *__swap16_multi_v = swap16(*__swap16_multi_v); \ + __swap16_multi_v++; \ + __swap16_multi_n--; \ + } \ +} while (0) + +cyg_uint32 htobe32 __P((cyg_uint32)); +cyg_uint16 htobe16 __P((cyg_uint16)); +cyg_uint32 betoh32 __P((cyg_uint32)); +cyg_uint16 betoh16 __P((cyg_uint16)); + +cyg_uint32 htole32 __P((cyg_uint32)); +cyg_uint16 htole16 __P((cyg_uint16)); +cyg_uint32 letoh32 __P((cyg_uint32)); +cyg_uint16 letoh16 __P((cyg_uint16)); + +#if BYTE_ORDER == LITTLE_ENDIAN + +/* Can be overridden by machine/endian.h before inclusion of this file. */ +#ifndef _QUAD_HIGHWORD +#define _QUAD_HIGHWORD 1 +#endif +#ifndef _QUAD_LOWWORD +#define _QUAD_LOWWORD 0 +#endif + +#define htobe16 swap16 +#define htobe32 swap32 +#define betoh16 swap16 +#define betoh32 swap32 + +#define htole16(x) (x) +#define htole32(x) (x) +#define letoh16(x) (x) +#define letoh32(x) (x) + +#endif /* BYTE_ORDER */ + +#if BYTE_ORDER == BIG_ENDIAN + +/* Can be overridden by machine/endian.h before inclusion of this file. */ +#ifndef _QUAD_HIGHWORD +#define _QUAD_HIGHWORD 0 +#endif +#ifndef _QUAD_LOWWORD +#define _QUAD_LOWWORD 1 +#endif + +#define htole16 swap16 +#define htole32 swap32 +#define letoh16 swap16 +#define letoh32 swap32 + +#define htobe16(x) (x) +#define htobe32(x) (x) +#define betoh16(x) (x) +#define betoh32(x) (x) + +#endif /* BYTE_ORDER */ + +#define htons htobe16 +#define htonl htobe32 +#define ntohs betoh16 +#define ntohl betoh32 + +#define NTOHL(x) (x) = ntohl((cyg_uint32)(x)) +#define NTOHS(x) (x) = ntohs((cyg_uint16)(x)) +#define HTONL(x) (x) = htonl((cyg_uint32)(x)) +#define HTONS(x) (x) = htons((cyg_uint16)(x)) + +#endif /* _POSIX_SOURCE */ +#endif /* _SYS_ENDIAN_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/sys/errno.h b/packages/net/bsd_tcpip/current/include/sys/errno.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/errno.h @@ -0,0 +1,35 @@ +//========================================================================== +// +// include/sys/errno.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Just another name for the standard file +#include diff --git a/packages/net/bsd_tcpip/current/include/sys/ioccom.h b/packages/net/bsd_tcpip/current/include/sys/ioccom.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/ioccom.h @@ -0,0 +1,97 @@ +//========================================================================== +// +// include/sys/ioccom.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ioccom.h 8.2 (Berkeley) 3/28/94 + * $FreeBSD: src/sys/sys/ioccom.h,v 1.9 1999/12/29 04:24:42 peter Exp $ + */ + +#ifndef _SYS_IOCCOM_H_ +#define _SYS_IOCCOM_H_ + +/* + * Ioctl's have the command encoded in the lower word, and the size of + * any in or out parameters in the upper word. The high 3 bits of the + * upper word are used to encode the in/out status of the parameter. + */ +#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ +#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) +#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) +#define IOCGROUP(x) (((x) >> 8) & 0xff) + +#define IOCPARM_MAX PAGE_SIZE /* max size of ioctl, mult. of PAGE_SIZE */ +#define IOC_VOID 0x20000000 /* no parameters */ +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN 0x80000000 /* copy in parameters */ +#define IOC_INOUT (IOC_IN|IOC_OUT) +#define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */ + +#define _IOC(inout,group,num,len) \ + ((unsigned long)(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))) +#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) +#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) +#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) +/* this should be _IORW, but stdio got there first */ +#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) + +#ifndef _KERNEL + +//#include +#include + +__BEGIN_DECLS +int ioctl __P((int, unsigned long, ...)); +__END_DECLS + +#endif + +#endif /* !_SYS_IOCCOM_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/sys/ioctl.h b/packages/net/bsd_tcpip/current/include/sys/ioctl.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/ioctl.h @@ -0,0 +1,91 @@ +//========================================================================== +// +// include/sys/ioctl.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +/* $OpenBSD: ioctl.h,v 1.3 1996/03/03 12:11:50 niklas Exp $ */ +/* $NetBSD: ioctl.h,v 1.20 1996/01/30 18:21:47 thorpej Exp $ */ + +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 + */ + +#ifndef _SYS_IOCTL_H_ +#define _SYS_IOCTL_H_ + +#include +#include + +#ifndef _KERNEL +#include + +__BEGIN_DECLS +int ioctl __P((int, unsigned long, ...)); +__END_DECLS +#endif /* !_KERNEL */ +#endif /* !_SYS_IOCTL_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/sys/malloc.h b/packages/net/bsd_tcpip/current/include/sys/malloc.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/malloc.h @@ -0,0 +1,63 @@ +//========================================================================== +// +// include/sys/malloc.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +#ifndef _SYS_MALLOC_H_ +#define _SYS_MALLOC_H_ + +#ifndef _KERNEL +#warn This file is only suitable for kernel level code in a network stack! +#endif + +/* + * flags to malloc + */ +#define M_WAITOK 0x0000 +#define M_NOWAIT 0x0001 +#define M_ZERO 0x0008 // bzero (clear) allocated area + +externC void *cyg_net_malloc(u_long size, int type, int flags); +externC void cyg_net_free(caddr_t addr, int type); +#define MALLOC(space, cast, size, type, flags) \ + (space) = (cast)cyg_net_malloc((u_long)(size), (int)type, flags) +#define malloc(size, type, flags) cyg_net_malloc((u_long)size, (int)type, flags) +#define FREE(addr, type) cyg_net_free((caddr_t)(addr), (int)type) +#define free(addr, type) FREE(addr, (int)type) + +// Memory types +#define M_PCB (void *)4 /* protocol control block */ +#define M_RTABLE 5 /* routing tables */ +#define M_IFADDR 9 /* interface address */ +#define M_IFMADDR 55 /* link-level multicast address */ +#define M_IPMADDR 66 /* link-level multicast address */ +#define M_IGMP 99 /* gateway info */ +#define M_SONAME 98 +#define M_IPMOPTS 97 +#define M_TSEGQ 96 +#define M_ACCF 95 /* accept filter data */ +#define M_TEMP 94 /* misc temp buffers */ +#define M_IPFLOW 93 +#define M_NETADDR 92 +#define M_IP6OPT 91 +#define M_IP6NDP 90 +#define M_MRTABLE 89 +#define M_FTABLE 88 + +#endif // _SYS_MALLOC_H_ diff --git a/packages/net/bsd_tcpip/current/include/sys/mbuf.h b/packages/net/bsd_tcpip/current/include/sys/mbuf.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/mbuf.h @@ -0,0 +1,639 @@ +//========================================================================== +// +// include/sys/mbuf.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 + * $FreeBSD: src/sys/sys/mbuf.h,v 1.44.2.10 2001/07/03 11:02:01 ume Exp $ + */ + +#ifndef _SYS_MBUF_H_ +#define _SYS_MBUF_H_ + +/* + * Mbufs are of a single size, MSIZE (machine/param.h), which + * includes overhead. An mbuf may add a single "mbuf cluster" of size + * MCLBYTES (also in machine/param.h), which has no additional overhead + * and is used instead of the internal data area; this is done when + * at least MINCLSIZE of data must be stored. + */ + +#define MLEN (MSIZE - sizeof(struct m_hdr)) /* normal data len */ +#define MHLEN (MLEN - sizeof(struct pkthdr)) /* data len w/pkthdr */ + +#define MINCLSIZE (MHLEN + 1) /* smallest amount to put in cluster */ +#define M_MAXCOMPRESS (MHLEN / 2) /* max amount to copy for compression */ + +/* + * Macros for type conversion + * mtod(m, t) - convert mbuf pointer to data pointer of correct type + * dtom(x) - convert data pointer within mbuf to mbuf pointer (XXX) + * mtocl(x) - convert pointer within cluster to cluster index # + * cltom(x) - convert cluster # to ptr to beginning of cluster + */ +#define mtod(m, t) ((t)((m)->m_data)) +#define dtom(x) ((struct mbuf *)((CYG_ADDRESS)(x) & ~(MSIZE-1))) +extern int cyg_mtocl(u_long); +extern struct mbuf *cyg_cltom(u_long); +#define mtocl(x) cyg_mtocl((u_long)x) +#define cltom(x) cyg_cltom((u_long)x) + +/* header at beginning of each mbuf: */ +struct m_hdr { + struct mbuf *mh_next; /* next buffer in chain */ + struct mbuf *mh_nextpkt; /* next chain in queue/record */ + caddr_t mh_data; /* location of data */ + int mh_len; /* amount of data in this mbuf */ + short mh_type; /* type of data in this mbuf */ + short mh_flags; /* flags; see below */ +}; + +/* record/packet header in first mbuf of chain; valid if M_PKTHDR set */ +struct pkthdr { + struct ifnet *rcvif; /* rcv interface */ + int len; /* total packet length */ + /* variables for ip and tcp reassembly */ + void *header; /* pointer to packet header */ + /* variables for hardware checksum */ + int csum_flags; /* flags regarding checksum */ + int csum_data; /* data field used by csum routines */ + struct mbuf *aux; /* extra data buffer; ipsec/others */ +}; + +/* description of external storage mapped into mbuf, valid if M_EXT set */ +struct m_ext { + caddr_t ext_buf; /* start of buffer */ + void (*ext_free) /* free routine if not the usual */ + __P((caddr_t, u_int)); + u_int ext_size; /* size of buffer, for ext_free */ + void (*ext_ref) /* add a reference to the ext object */ + __P((caddr_t, u_int)); +}; + +struct mbuf { + struct m_hdr m_hdr; + union { + struct { + struct pkthdr MH_pkthdr; /* M_PKTHDR set */ + union { + struct m_ext MH_ext; /* M_EXT set */ + char MH_databuf[MHLEN]; + } MH_dat; + } MH; + char M_databuf[MLEN]; /* !M_PKTHDR, !M_EXT */ + } M_dat; +}; +#define m_next m_hdr.mh_next +#define m_len m_hdr.mh_len +#define m_data m_hdr.mh_data +#define m_type m_hdr.mh_type +#define m_flags m_hdr.mh_flags +#define m_nextpkt m_hdr.mh_nextpkt +#define m_act m_nextpkt +#define m_pkthdr M_dat.MH.MH_pkthdr +#define m_ext M_dat.MH.MH_dat.MH_ext +#define m_pktdat M_dat.MH.MH_dat.MH_databuf +#define m_dat M_dat.M_databuf + +/* mbuf flags */ +#define M_EXT 0x0001 /* has associated external storage */ +#define M_PKTHDR 0x0002 /* start of record */ +#define M_EOR 0x0004 /* end of record */ +#define M_PROTO1 0x0008 /* protocol-specific */ +#define M_PROTO2 0x0010 /* protocol-specific */ +#define M_PROTO3 0x0020 /* protocol-specific */ +#define M_PROTO4 0x0040 /* protocol-specific */ +#define M_PROTO5 0x0080 /* protocol-specific */ +#define M_PROTO6 0x2000 /* protocol-specific */ + +/* mbuf pkthdr flags, also in m_flags */ +#define M_BCAST 0x0100 /* send/received as link-level broadcast */ +#define M_MCAST 0x0200 /* send/received as link-level multicast */ +#define M_FRAG 0x0400 /* packet is a fragment of a larger packet */ +#define M_FIRSTFRAG 0x0800 /* packet is first fragment */ +#define M_LASTFRAG 0x1000 /* packet is last fragment */ + +#define M_AUX 0x4000 /* mbufs pointed to by m->m_pkthdr.aux */ + +/* flags copied when copying m_pkthdr */ +#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_PROTO1|M_PROTO1|M_PROTO2|M_PROTO3| \ + M_PROTO4|M_PROTO5|M_PROTO6|M_BCAST|M_MCAST|M_FRAG| \ + M_AUX) + +/* flags indicating hw checksum support and sw checksum requirements */ +#define CSUM_IP 0x0001 /* will csum IP */ +#define CSUM_TCP 0x0002 /* will csum TCP */ +#define CSUM_UDP 0x0004 /* will csum UDP */ +#define CSUM_IP_FRAGS 0x0008 /* will csum IP fragments */ +#define CSUM_FRAGMENT 0x0010 /* will do IP fragmentation */ + +#define CSUM_IP_CHECKED 0x0100 /* did csum IP */ +#define CSUM_IP_VALID 0x0200 /* ... the csum is valid */ +#define CSUM_DATA_VALID 0x0400 /* csum_data field is valid */ +#define CSUM_PSEUDO_HDR 0x0800 /* csum_data has pseudo hdr */ + +#define CSUM_DELAY_DATA (CSUM_TCP | CSUM_UDP) +#define CSUM_DELAY_IP (CSUM_IP) /* XXX add ipv6 here too? */ + +/* mbuf types */ +#define MT_FREE 0 /* should be on free list */ +#define MT_DATA 1 /* dynamic (data) allocation */ +#define MT_HEADER 2 /* packet header */ +#if 0 +#define MT_SOCKET 3 /* socket structure */ +#define MT_PCB 4 /* protocol control block */ +#define MT_RTABLE 5 /* routing tables */ +#define MT_HTABLE 6 /* IMP host tables */ +#define MT_ATABLE 7 /* address resolution tables */ +#endif +#define MT_SONAME 8 /* socket name */ +#if 0 +#define MT_SOOPTS 10 /* socket options */ +#endif +#define MT_FTABLE 11 /* fragment reassembly header */ +#if 0 +#define MT_RIGHTS 12 /* access rights */ +#define MT_IFADDR 13 /* interface address */ +#endif +#define MT_CONTROL 14 /* extra-data protocol message */ +#define MT_OOBDATA 15 /* expedited data */ + +#define MT_NTYPES 16 /* number of mbuf types for mbtypes[] */ + +/* + * mbuf statistics + */ +struct mbstat { + u_long m_mbufs; /* mbufs obtained from page pool */ + u_long m_clusters; /* clusters obtained from page pool */ + u_long m_spare; /* spare field */ + u_long m_clfree; /* free clusters */ + u_long m_drops; /* times failed to find space */ + u_long m_wait; /* times waited for space */ + u_long m_drain; /* times drained protocols for space */ + u_long m_mcfail; /* times m_copym failed */ + u_long m_mpfail; /* times m_pullup failed */ + u_long m_msize; /* length of an mbuf */ + u_long m_mclbytes; /* length of an mbuf cluster */ + u_long m_minclsize; /* min length of data to allocate a cluster */ + u_long m_mlen; /* length of data in an mbuf */ + u_long m_mhlen; /* length of data in a header mbuf */ + + u_quad_t m_exthdrget; /* # of calls to IP6_EXTHDR_GET */ + u_quad_t m_exthdrget0; /* # of calls to IP6_EXTHDR_GET0 */ + u_quad_t m_pulldowns; /* # of calls to m_pulldown */ + u_quad_t m_pulldown_copy; /* # of mbuf copies in m_pulldown */ + u_quad_t m_pulldown_alloc; /* # of mbuf allocs in m_pulldown */ + u_quad_t m_pullups; /* # of calls to m_pullup */ + u_quad_t m_pullup_copy; /* # of possible m_pullup copies */ + u_quad_t m_pullup_alloc; /* # of possible m_pullup mallocs */ + u_quad_t m_pullup_fail; /* # of possible m_pullup failures */ + u_quad_t m_pullup2; /* # of calls to m_pullup2 */ + u_quad_t m_pullup2_copy; /* # of possible m_pullup2 copies */ + u_quad_t m_pullup2_alloc; /* # of possible m_pullup2 mallocs */ + u_quad_t m_pullup2_fail; /* # of possible m_pullup2 failures */ +}; + +/* flags to m_get/MGET */ +#define M_DONTWAIT 1 +#define M_WAIT 0 + +/* Freelists: + * + * Normal mbuf clusters are normally treated as character arrays + * after allocation, but use the first word of the buffer as a free list + * pointer while on the free list. + */ +union mcluster { + union mcluster *mcl_next; + char mcl_buf[MCLBYTES]; +}; + + +/* + * These are identifying numbers passed to the m_mballoc_wait function, + * allowing us to determine whether the call came from an MGETHDR or + * an MGET. + */ +#define MGETHDR_C 1 +#define MGET_C 2 + +/* + * Wake up the next instance (if any) of m_mballoc_wait() which is + * waiting for an mbuf to be freed. This should be called at splimp(). + * + * XXX: If there is another free mbuf, this routine will be called [again] + * from the m_mballoc_wait routine in order to wake another sleep instance. + */ +#define MMBWAKEUP() do { \ + if (m_mballoc_wid) { \ + m_mballoc_wid--; \ + wakeup_one(&m_mballoc_wid); \ + } \ +} while (0) + +/* + * Same as above, but for mbuf cluster(s). + */ +#define MCLWAKEUP() do { \ + if (m_clalloc_wid) { \ + m_clalloc_wid--; \ + wakeup_one(&m_clalloc_wid); \ + } \ +} while (0) + +/* + * mbuf utility macros: + * + * MBUFLOCK(code) + * prevents a section of code from from being interrupted by network + * drivers. + */ +#define MBUFLOCK(code) do { \ + int _ms = splimp(); \ + \ + { code } \ + splx(_ms); \ +} while (0) + +/* + * mbuf allocation/deallocation macros: + * + * MGET(struct mbuf *m, int how, int type) + * allocates an mbuf and initializes it to contain internal data. + * + * MGETHDR(struct mbuf *m, int how, int type) + * allocates an mbuf and initializes it to contain a packet header + * and internal data. + */ +#define MGET(m, how, type) do { \ + struct mbuf *_mm; \ + int _mhow = (how); \ + int _mtype = (type); \ + int _ms = splimp(); \ + \ + if (mmbfree == NULL) \ + (void)m_mballoc(1, _mhow); \ + _mm = mmbfree; \ + if (_mm != NULL) { \ + mmbfree = _mm->m_next; \ + mbtypes[MT_FREE]--; \ + _mm->m_type = _mtype; \ + mbtypes[_mtype]++; \ + _mm->m_next = NULL; \ + _mm->m_nextpkt = NULL; \ + _mm->m_data = _mm->m_dat; \ + _mm->m_flags = 0; \ + (m) = _mm; \ + splx(_ms); \ + } else { \ + splx(_ms); \ + _mm = m_retry(_mhow, _mtype); \ + if (_mm == NULL && _mhow == M_WAIT) \ + (m) = m_mballoc_wait(MGET_C, _mtype); \ + else \ + (m) = _mm; \ + } \ +} while (0) + +#define MGETHDR(m, how, type) do { \ + struct mbuf *_mm; \ + int _mhow = (how); \ + int _mtype = (type); \ + int _ms = splimp(); \ + \ + if (mmbfree == NULL) \ + (void)m_mballoc(1, _mhow); \ + _mm = mmbfree; \ + if (_mm != NULL) { \ + mmbfree = _mm->m_next; \ + mbtypes[MT_FREE]--; \ + _mm->m_type = _mtype; \ + mbtypes[_mtype]++; \ + _mm->m_next = NULL; \ + _mm->m_nextpkt = NULL; \ + _mm->m_data = _mm->m_pktdat; \ + _mm->m_flags = M_PKTHDR; \ + bzero(&(_mm)->m_pkthdr, sizeof((_mm)->m_pkthdr)); \ + (m) = _mm; \ + splx(_ms); \ + } else { \ + splx(_ms); \ + _mm = m_retryhdr(_mhow, _mtype); \ + if (_mm == NULL && _mhow == M_WAIT) \ + (m) = m_mballoc_wait(MGETHDR_C, _mtype); \ + else \ + (m) = _mm; \ + } \ +} while (0) + +/* + * Mbuf cluster macros. + * MCLALLOC(caddr_t p, int how) allocates an mbuf cluster. + * MCLGET adds such clusters to a normal mbuf; + * the flag M_EXT is set upon success. + * MCLFREE releases a reference to a cluster allocated by MCLALLOC, + * freeing the cluster if the reference count has reached 0. + */ +#define MCLALLOC(p, how) do { \ + caddr_t _mp; \ + int _mhow = (how); \ + int _ms = splimp(); \ + \ + if (mclfree == NULL) \ + (void)m_clalloc(1, _mhow); \ + _mp = (caddr_t)mclfree; \ + if (_mp != NULL) { \ + mclrefcnt[mtocl(_mp)]++; \ + mbstat.m_clfree--; \ + mclfree = ((union mcluster *)_mp)->mcl_next; \ + (p) = _mp; \ + splx(_ms); \ + } else { \ + splx(_ms); \ + if (_mhow == M_WAIT) \ + (p) = m_clalloc_wait(); \ + else \ + (p) = NULL; \ + } \ +} while (0) + +#define MCLGET(m, how) do { \ + struct mbuf *_mm = (m); \ + \ + MCLALLOC(_mm->m_ext.ext_buf, (how)); \ + if (_mm->m_ext.ext_buf != NULL) { \ + _mm->m_data = _mm->m_ext.ext_buf; \ + _mm->m_flags |= M_EXT; \ + _mm->m_ext.ext_free = NULL; \ + _mm->m_ext.ext_ref = NULL; \ + _mm->m_ext.ext_size = MCLBYTES; \ + } \ +} while (0) + +#define MCLFREE1(p) do { \ + union mcluster *_mp = (union mcluster *)(p); \ + \ + /* KASSERT(mclrefcnt[mtocl(_mp)] > 0, ("freeing free cluster")); */ \ + if (--mclrefcnt[mtocl(_mp)] == 0) { \ + _mp->mcl_next = mclfree; \ + mclfree = _mp; \ + mbstat.m_clfree++; \ + MCLWAKEUP(); \ + } \ +} while (0) + +#define MCLFREE(p) MBUFLOCK( \ + MCLFREE1(p); \ +) + +#define MEXTFREE1(m) do { \ + struct mbuf *_mm = (m); \ + \ + if (_mm->m_ext.ext_free != NULL) \ + (*_mm->m_ext.ext_free)(_mm->m_ext.ext_buf, \ + _mm->m_ext.ext_size); \ + else \ + MCLFREE1(_mm->m_ext.ext_buf); \ +} while (0) + +#define MEXTFREE(m) MBUFLOCK( \ + MEXTFREE1(m); \ +) + +/* + * MFREE(struct mbuf *m, struct mbuf *n) + * Free a single mbuf and associated external storage. + * Place the successor, if any, in n. + * + * we do need to check non-first mbuf for m_aux, since some of existing + * code does not call M_PREPEND properly. + * (example: call to bpf_mtap from drivers) + */ +#define MFREE(m, n) MBUFLOCK( \ + struct mbuf *_mm = (m); \ + \ + /* KASSERT(_mm->m_type != MT_FREE, ("freeing free mbuf")); */ \ + mbtypes[_mm->m_type]--; \ + if ((_mm->m_flags & M_PKTHDR) != 0 && _mm->m_pkthdr.aux) { \ + m_freem(_mm->m_pkthdr.aux); \ + _mm->m_pkthdr.aux = NULL; \ + } \ + if (_mm->m_flags & M_EXT) \ + MEXTFREE1(m); \ + (n) = _mm->m_next; \ + _mm->m_type = MT_FREE; \ + mbtypes[MT_FREE]++; \ + _mm->m_next = mmbfree; \ + mmbfree = _mm; \ + MMBWAKEUP(); \ +) + +/* + * Copy mbuf pkthdr from "from" to "to". + * from must have M_PKTHDR set, and to must be empty. + * aux pointer will be moved to `to'. + */ +#define M_COPY_PKTHDR(to, from) do { \ + struct mbuf *_mfrom = (from); \ + struct mbuf *_mto = (to); \ + \ + _mto->m_data = _mto->m_pktdat; \ + _mto->m_flags = _mfrom->m_flags & M_COPYFLAGS; \ + _mto->m_pkthdr = _mfrom->m_pkthdr; \ + _mfrom->m_pkthdr.aux = (struct mbuf *)NULL; \ +} while (0) + +/* + * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place + * an object of the specified size at the end of the mbuf, longword aligned. + */ +#define M_ALIGN(m, len) do { \ + (m)->m_data += (MLEN - (len)) & ~(sizeof(long) - 1); \ +} while (0) + +/* + * As above, for mbufs allocated with m_gethdr/MGETHDR + * or initialized by M_COPY_PKTHDR. + */ +#define MH_ALIGN(m, len) do { \ + (m)->m_data += (MHLEN - (len)) & ~(sizeof(long) - 1); \ +} while (0) + +/* + * Check if we can write to an mbuf. + */ +#define M_WRITABLE(m) (!((m)->m_flags & M_EXT) || \ + ((m)->m_ext.ext_free == NULL && mclrefcnt[mtocl((m)->m_ext.ext_buf)] == 1)) + +/* + * Compute the amount of space available + * before the current start of data in an mbuf. + */ +#define M_LEADINGSPACE(m) \ + ((m)->m_flags & M_EXT ? \ + /* (m)->m_data - (m)->m_ext.ext_buf */ 0 : \ + (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \ + (m)->m_data - (m)->m_dat) + +/* + * Compute the amount of space available + * after the end of data in an mbuf. + */ +#define M_TRAILINGSPACE(m) \ + ((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + \ + (m)->m_ext.ext_size - ((m)->m_data + (m)->m_len) : \ + &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len)) + +/* + * Arrange to prepend space of size plen to mbuf m. + * If a new mbuf must be allocated, how specifies whether to wait. + * If how is M_DONTWAIT and allocation fails, the original mbuf chain + * is freed and m is set to NULL. + */ +#define M_PREPEND(m, plen, how) do { \ + struct mbuf **_mmp = &(m); \ + struct mbuf *_mm = *_mmp; \ + int _mplen = (plen); \ + int __mhow = (how); \ + \ + if (M_LEADINGSPACE(_mm) >= _mplen) { \ + _mm->m_data -= _mplen; \ + _mm->m_len += _mplen; \ + } else \ + _mm = m_prepend(_mm, _mplen, __mhow); \ + if (_mm != NULL && _mm->m_flags & M_PKTHDR) \ + _mm->m_pkthdr.len += _mplen; \ + *_mmp = _mm; \ +} while (0) + +/* change mbuf to new type */ +#define MCHTYPE(m, t) do { \ + struct mbuf *_mm = (m); \ + int _mt = (t); \ + int _ms = splimp(); \ + \ + mbtypes[_mm->m_type]--; \ + mbtypes[_mt]++; \ + splx(_ms); \ + _mm->m_type = (_mt); \ +} while (0) + +/* length to m_copy to copy all */ +#define M_COPYALL 1000000000 + +/* compatibility with 4.3 */ +#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT) + +/* + * pkthdr.aux type tags. + */ +struct mauxtag { + int af; + int type; + void* p; +}; + +#ifdef _KERNEL +extern u_int m_clalloc_wid; /* mbuf cluster wait count */ +extern u_int m_mballoc_wid; /* mbuf wait count */ +extern int max_linkhdr; /* largest link-level header */ +extern int max_protohdr; /* largest protocol header */ +extern int max_hdr; /* largest link+protocol header */ +extern int max_datalen; /* MHLEN - max_hdr */ +extern struct mbstat mbstat; +extern u_long mbtypes[MT_NTYPES]; /* per-type mbuf allocations */ +extern int mbuf_wait; /* mbuf sleep time */ +extern struct mbuf *mbutl; /* virtual address of mclusters */ +extern char *mclrefcnt; /* cluster reference counts */ +extern union mcluster *mclfree; +extern struct mbuf *mmbfree; +extern int nmbclusters; +extern int nmbufs; +extern int nsfbufs; + +void m_adj __P((struct mbuf *, int)); +void m_cat __P((struct mbuf *,struct mbuf *)); +int m_clalloc __P((int, int)); +caddr_t m_clalloc_wait __P((void)); +void m_copyback __P((struct mbuf *, int, int, caddr_t)); +void m_copydata __P((struct mbuf *,int,int,caddr_t)); +struct mbuf *m_copym __P((struct mbuf *, int, int, int)); +struct mbuf *m_copypacket __P((struct mbuf *, int)); +struct mbuf *m_devget __P((char *, int, int, struct ifnet *, + void (*copy)(char *, caddr_t, u_int))); +struct mbuf *m_dup __P((struct mbuf *, int)); +struct mbuf *m_free __P((struct mbuf *)); +void m_freem __P((struct mbuf *)); +struct mbuf *m_get __P((int, int)); +struct mbuf *m_getclr __P((int, int)); +struct mbuf *m_gethdr __P((int, int)); +struct mbuf *m_getm __P((struct mbuf *, int, int, int)); +int m_mballoc __P((int, int)); +struct mbuf *m_mballoc_wait __P((int, int)); +struct mbuf *m_prepend __P((struct mbuf *,int,int)); +struct mbuf *m_pulldown __P((struct mbuf *, int, int, int *)); +void m_print __P((const struct mbuf *m)); +struct mbuf *m_pullup __P((struct mbuf *, int)); +struct mbuf *m_retry __P((int, int)); +struct mbuf *m_retryhdr __P((int, int)); +struct mbuf *m_split __P((struct mbuf *,int,int)); +struct mbuf *m_aux_add2 __P((struct mbuf *, int, int, void *)); +struct mbuf *m_aux_find2 __P((struct mbuf *, int, int, void *)); +struct mbuf *m_aux_add __P((struct mbuf *, int, int)); +struct mbuf *m_aux_find __P((struct mbuf *, int, int)); +void m_aux_delete __P((struct mbuf *, struct mbuf *)); +extern void *cyg_net_mbuf_alloc(int type, int flags); +extern void cyg_net_mbuf_free(caddr_t addr, int type); +extern void *cyg_net_cluster_alloc(void ); +#endif /* _KERNEL */ + +#endif /* !_SYS_MBUF_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/sys/md5.h b/packages/net/bsd_tcpip/current/include/sys/md5.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/md5.h @@ -0,0 +1,71 @@ +//========================================================================== +// +// include/sys/md5.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* MD5.H - header file for MD5C.C + * $FreeBSD: src/sys/sys/md5.h,v 1.13 1999/12/29 04:24:44 peter Exp $ + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +#ifndef _SYS_MD5_H_ +#define _SYS_MD5_H_ +/* MD5 context. */ +typedef struct MD5Context { + u_int32_t state[4]; /* state (ABCD) */ + u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD5_CTX; + +#include + +__BEGIN_DECLS +void MD5Init (MD5_CTX *); +void MD5Update (MD5_CTX *, const unsigned char *, unsigned int); +void MD5Pad (MD5_CTX *); +void MD5Final (unsigned char [16], MD5_CTX *); +char * MD5End(MD5_CTX *, char *); +char * MD5File(const char *, char *); +char * MD5Data(const unsigned char *, unsigned int, char *); +#ifdef _KERNEL +void MD5Transform __P((u_int32_t [4], const unsigned char [64])); +#endif +__END_DECLS +#endif /* _SYS_MD5_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/sys/param.h b/packages/net/bsd_tcpip/current/include/sys/param.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/param.h @@ -0,0 +1,990 @@ +//========================================================================== +// +// include/sys/param.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +#ifndef _SYS_PARAM_H_ +#define _SYS_PARAM_H_ + +#ifndef __ECOS +#define __ECOS +#endif + +#ifdef _KERNEL +// Namespace munging - this should keep the "kernel" namespace +// polution to a minimum + +// TEXT symbols +#define MD5Final cyg_MD5Final +#define MD5Init cyg_MD5Init +#define MD5Pad cyg_MD5Pad +#define MD5Transform cyg_MD5Transform +#define MD5Update cyg_MD5Update +#define _ip_mcast_src cyg__ip_mcast_src +#define _ip_mforward cyg__ip_mforward +#define _ip_mrouter_done cyg__ip_mrouter_done +#define _ip_mrouter_get cyg__ip_mrouter_get +#define _ip_mrouter_set cyg__ip_mrouter_set +#define _mrt_ioctl cyg__mrt_ioctl +#define addrsel_policy_init cyg_addrsel_policy_init +#define arc4random cyg_arc4random +#define random cyg_arc4random +#define arp_ifinit cyg_arp_ifinit +#define arpresolve cyg_arpresolve +#define asr_default__15Cyg_SchedThreadUi cyg_asr_default__15Cyg_SchedThreadUi +#define callout_active cyg_callout_active +#define callout_deactivate cyg_callout_deactivate +#define callout_init cyg_callout_init +#define callout_pending cyg_callout_pending +#define callout_reset cyg_callout_reset +#define callout_stop cyg_callout_stop +#define copyin cyg_copyin +#define copyout cyg_copyout +#define defrouter_addreq cyg_defrouter_addreq +#define defrouter_lookup cyg_defrouter_lookup +#define defrouter_reset cyg_defrouter_reset +#define defrouter_select cyg_defrouter_select +#define defrtrlist_del cyg_defrtrlist_del +#define dest6_input cyg_dest6_input +#define dup_sockaddr cyg_dup_sockaddr +#define encap4_input cyg_encap4_input +#define encap6_ctlinput cyg_encap6_ctlinput +#define encap6_input cyg_encap6_input +#define encap_init cyg_encap_init +#define ether_demux cyg_ether_demux +#define ether_ifattach cyg_ether_ifattach +#define ether_input cyg_ether_input +#define ether_ioctl cyg_ether_ioctl +#define ether_output cyg_ether_output +#define ether_output_frame cyg_ether_output_frame +#define frag6_drain cyg_frag6_drain +#define frag6_init cyg_frag6_init +#define frag6_input cyg_frag6_input +#define frag6_slowtimo cyg_frag6_slowtimo +#define getmicrotime cyg_getmicrotime +#define getmicrouptime cyg_getmicrouptime +#define hashinit cyg_hashinit +#define icmp6_ctloutput cyg_icmp6_ctloutput +#define icmp6_error cyg_icmp6_error +#define icmp6_fasttimo cyg_icmp6_fasttimo +#define icmp6_init cyg_icmp6_init +#define icmp6_input cyg_icmp6_input +#define icmp6_mtudisc_update cyg_icmp6_mtudisc_update +#define icmp6_redirect_input cyg_icmp6_redirect_input +#define icmp6_redirect_output cyg_icmp6_redirect_output +#define icmp6_reflect cyg_icmp6_reflect +#define icmp_error cyg_icmp_error +#define icmp_input cyg_icmp_input +#define if_addmulti cyg_if_addmulti +#define if_allmulti cyg_if_allmulti +#define if_attach cyg_if_attach +#define if_clone_create cyg_if_clone_create +#define if_clone_destroy cyg_if_clone_destroy +#define if_clone_list cyg_if_clone_list +#define if_clone_lookup cyg_if_clone_lookup +#define if_delmulti cyg_if_delmulti +#define if_down cyg_if_down +#define if_route cyg_if_route +#define if_setlladdr cyg_if_setlladdr +#define if_simloop cyg_if_simloop +#define if_unroute cyg_if_unroute +#define if_up cyg_if_up +#define ifa_ifwithaddr cyg_ifa_ifwithaddr +#define ifa_ifwithdstaddr cyg_ifa_ifwithdstaddr +#define ifa_ifwithnet cyg_ifa_ifwithnet +#define ifa_ifwithroute cyg_ifa_ifwithroute +#define ifafree cyg_ifafree +#define ifaof_ifpforaddr cyg_ifaof_ifpforaddr +#define ifioctl cyg_ifioctl +#define ifunit cyg_ifunit +#define igmp_fasttimo cyg_igmp_fasttimo +#define igmp_init cyg_igmp_init +#define igmp_input cyg_igmp_input +#define igmp_joingroup cyg_igmp_joingroup +#define igmp_leavegroup cyg_igmp_leavegroup +#define igmp_slowtimo cyg_igmp_slowtimo +#define in6_addmulti cyg_in6_addmulti +#define in6_addr2zoneid cyg_in6_addr2zoneid +#define in6_addrscope cyg_in6_addrscope +#define in6_are_prefix_equal cyg_in6_are_prefix_equal +#define in6_cksum cyg_in6_cksum +#define in6_clearscope cyg_in6_clearscope +#define in6_control cyg_in6_control +#define in6_delmulti cyg_in6_delmulti +#define in6_embedscope cyg_in6_embedscope +#define in6_get_tmpifid cyg_in6_get_tmpifid +#define in6_if_up cyg_in6_if_up +#define in6_ifattach cyg_in6_ifattach +#define in6_ifawithifp cyg_in6_ifawithifp +#define in6_init_prefix_ltimes cyg_in6_init_prefix_ltimes +#define in6_inithead cyg_in6_inithead +#define in6_joingroup cyg_in6_joingroup +#define in6_leavegroup cyg_in6_leavegroup +#define in6_localaddr cyg_in6_localaddr +#define in6_losing cyg_in6_losing +#define in6_mapped_peeraddr cyg_in6_mapped_peeraddr +#define in6_mapped_sockaddr cyg_in6_mapped_sockaddr +#define in6_mask2len cyg_in6_mask2len +#define in6_matchlen cyg_in6_matchlen +#define in6_nigroup cyg_in6_nigroup +#define in6_pcbbind cyg_in6_pcbbind +#define in6_pcbconnect cyg_in6_pcbconnect +#define in6_pcbdetach cyg_in6_pcbdetach +#define in6_pcbdisconnect cyg_in6_pcbdisconnect +#define in6_pcbladdr cyg_in6_pcbladdr +#define in6_pcblookup_hash cyg_in6_pcblookup_hash +#define in6_pcblookup_local cyg_in6_pcblookup_local +#define in6_pcbnotify cyg_in6_pcbnotify +#define in6_pcbsetport cyg_in6_pcbsetport +#define in6_prefixlen2mask cyg_in6_prefixlen2mask +#define in6_purgeaddr cyg_in6_purgeaddr +#define in6_recoverscope cyg_in6_recoverscope +#define in6_rtchange cyg_in6_rtchange +#define in6_selecthlim cyg_in6_selecthlim +#define in6_selectroute cyg_in6_selectroute +#define in6_selectsrc cyg_in6_selectsrc +#define in6_setmaxmtu cyg_in6_setmaxmtu +#define in6_setpeeraddr cyg_in6_setpeeraddr +#define in6_setsockaddr cyg_in6_setsockaddr +#define in6_sin6_2_sin cyg_in6_sin6_2_sin +#define in6_sin6_2_sin_in_sock cyg_in6_sin6_2_sin_in_sock +#define in6_sin_2_v4mapsin6 cyg_in6_sin_2_v4mapsin6 +#define in6_sin_2_v4mapsin6_in_sock cyg_in6_sin_2_v4mapsin6_in_sock +#define in6_src_ioctl cyg_in6_src_ioctl +#define in6_tmpaddrtimer cyg_in6_tmpaddrtimer +#define in6_tmpifadd cyg_in6_tmpifadd +#define in6_update_ifa cyg_in6_update_ifa +#define in6if_do_dad cyg_in6if_do_dad +#define in6ifa_ifpforlinklocal cyg_in6ifa_ifpforlinklocal +#define in6ifa_ifpwithaddr cyg_in6ifa_ifpwithaddr +#define in_addmulti cyg_in_addmulti +#define in_addword cyg_in_addword +#define in_broadcast cyg_in_broadcast +#define in_canforward cyg_in_canforward +#define in_cksum cyg_in_cksum +#define in_cksum_hdr cyg_in_cksum_hdr +#define in_cksum_skip cyg_in_cksum_skip +#define in_cksumdata cyg_in_cksumdata +#define in_control cyg_in_control +#define in_delayed_cksum cyg_in_delayed_cksum +#define in_delmulti cyg_in_delmulti +#define in_ifadown cyg_in_ifadown +#define in_ifscrub cyg_in_ifscrub +#define in_inithead cyg_in_inithead +#define in_localaddr cyg_in_localaddr +#define in_losing cyg_in_losing +#define in_pcballoc cyg_in_pcballoc +#define in_pcbbind cyg_in_pcbbind +#define in_pcbconnect cyg_in_pcbconnect +#define in_pcbdetach cyg_in_pcbdetach +#define in_pcbdisconnect cyg_in_pcbdisconnect +#define in_pcbinshash cyg_in_pcbinshash +#define in_pcbladdr cyg_in_pcbladdr +#define in_pcblookup_hash cyg_in_pcblookup_hash +#define in_pcblookup_local cyg_in_pcblookup_local +#define in_pcbnotifyall cyg_in_pcbnotifyall +#define in_pcbpurgeif0 cyg_in_pcbpurgeif0 +#define in_pcbrehash cyg_in_pcbrehash +#define in_pcbremlists cyg_in_pcbremlists +#define in_pseudo cyg_in_pseudo +#define in_rtchange cyg_in_rtchange +#define in_rtqdrain cyg_in_rtqdrain +#define in_setpeeraddr cyg_in_setpeeraddr +#define in_setsockaddr cyg_in_setsockaddr +#define init_ip6pktopts cyg_init_ip6pktopts +#define init_loopback_interface cyg_init_loopback_interface +#define init_net cyg_init_net +#define init_net_IPv6 cyg_init_net_IPv6 +#define init_sin6 cyg_init_sin6 +#define ip6_addaux cyg_ip6_addaux +#define ip6_clearpktopts cyg_ip6_clearpktopts +#define ip6_copypktopts cyg_ip6_copypktopts +#define ip6_ctloutput cyg_ip6_ctloutput +#define ip6_delaux cyg_ip6_delaux +#define ip6_findaux cyg_ip6_findaux +#define ip6_forward cyg_ip6_forward +#define ip6_freemoptions cyg_ip6_freemoptions +#define ip6_freepcbopts cyg_ip6_freepcbopts +#define ip6_get_prevhdr cyg_ip6_get_prevhdr +#define ip6_getdstifaddr cyg_ip6_getdstifaddr +#define ip6_init cyg_ip6_init +#define ip6_input cyg_ip6_input +#define ip6_lasthdr cyg_ip6_lasthdr +#define ip6_mforward cyg_ip6_mforward +#define ip6_mloopback cyg_ip6_mloopback +#define ip6_mrouter_done cyg_ip6_mrouter_done +#define ip6_mrouter_get cyg_ip6_mrouter_get +#define ip6_mrouter_set cyg_ip6_mrouter_set +#define ip6_nexthdr cyg_ip6_nexthdr +#define ip6_notify_pmtu cyg_ip6_notify_pmtu +#define ip6_optlen cyg_ip6_optlen +#define ip6_output cyg_ip6_output +#define ip6_process_hopopts cyg_ip6_process_hopopts +#define ip6_raw_ctloutput cyg_ip6_raw_ctloutput +#define ip6_reset_rcvopt cyg_ip6_reset_rcvopt +#define ip6_savecontrol cyg_ip6_savecontrol +#define ip6_setpktoptions cyg_ip6_setpktoptions +#define ip6_sprintf cyg_ip6_sprintf +#define ip6_unknown_opt cyg_ip6_unknown_opt +#define ip6_update_recvpcbopt cyg_ip6_update_recvpcbopt +#define ip6intr cyg_ip6intr +#define ip_ctloutput cyg_ip_ctloutput +#define ip_drain cyg_ip_drain +#define ip_freemoptions cyg_ip_freemoptions +#define ip_init cyg_ip_init +#define ip_input cyg_ip_input +#define ip_optcopy cyg_ip_optcopy +#define ip_output cyg_ip_output +#define ip_rsvp_done cyg_ip_rsvp_done +#define ip_rsvp_force_done cyg_ip_rsvp_force_done +#define ip_rsvp_init cyg_ip_rsvp_init +#define ip_rsvp_vif_done cyg_ip_rsvp_vif_done +#define ip_rsvp_vif_init cyg_ip_rsvp_vif_init +#define ip_savecontrol cyg_ip_savecontrol +#define ip_slowtimo cyg_ip_slowtimo +#define ip_srcroute cyg_ip_srcroute +#define ip_stripoptions cyg_ip_stripoptions +#define ipflow_create cyg_ipflow_create +#define ipflow_fastforward cyg_ipflow_fastforward +#define ipflow_slowtimo cyg_ipflow_slowtimo +#define iptime cyg_iptime +#define loioctl cyg_loioctl +#define looutput cyg_looutput +#define m_adj cyg_m_adj +#define m_aux_add cyg_m_aux_add +#define m_aux_add2 cyg_m_aux_add2 +#define m_aux_delete cyg_m_aux_delete +#define m_aux_find cyg_m_aux_find +#define m_aux_find2 cyg_m_aux_find2 +#define m_cat cyg_m_cat +#define m_clalloc cyg_m_clalloc +#define m_clalloc_wait cyg_m_clalloc_wait +#define m_copyback cyg_m_copyback +#define m_copydata cyg_m_copydata +#define m_copym cyg_m_copym +#define m_free cyg_m_free +#define m_freem cyg_m_freem +#define m_get cyg_m_get +#define m_getclr cyg_m_getclr +#define m_gethdr cyg_m_gethdr +#define m_mballoc cyg_m_mballoc +#define m_mballoc_wait cyg_m_mballoc_wait +#define m_prepend cyg_m_prepend +#define m_pulldown cyg_m_pulldown +#define m_pullup cyg_m_pullup +#define m_retry cyg_m_retry +#define m_retryhdr cyg_m_retryhdr +#define m_split cyg_m_split +#define microtime cyg_microtime +#define mld6_fasttimeo cyg_mld6_fasttimeo +#define mld6_init cyg_mld6_init +#define mld6_input cyg_mld6_input +#define mld6_start_listening cyg_mld6_start_listening +#define mld6_stop_listening cyg_mld6_stop_listening +#define mrt6_ioctl cyg_mrt6_ioctl +#define nd6_cache_lladdr cyg_nd6_cache_lladdr +#define nd6_dad_duplicated cyg_nd6_dad_duplicated +#define nd6_dad_start cyg_nd6_dad_start +#define nd6_dad_stop cyg_nd6_dad_stop +#define nd6_ifattach cyg_nd6_ifattach +#define nd6_ifptomac cyg_nd6_ifptomac +#define nd6_init cyg_nd6_init +#define nd6_ioctl cyg_nd6_ioctl +#define nd6_is_addr_neighbor cyg_nd6_is_addr_neighbor +#define nd6_lookup cyg_nd6_lookup +#define nd6_na_input cyg_nd6_na_input +#define nd6_na_output cyg_nd6_na_output +#define nd6_need_cache cyg_nd6_need_cache +#define nd6_ns_input cyg_nd6_ns_input +#define nd6_ns_output cyg_nd6_ns_output +#define nd6_nud_hint cyg_nd6_nud_hint +#define nd6_option cyg_nd6_option +#define nd6_option_init cyg_nd6_option_init +#define nd6_options cyg_nd6_options +#define nd6_output cyg_nd6_output +#define nd6_prefix_lookup cyg_nd6_prefix_lookup +#define nd6_prefix_offlink cyg_nd6_prefix_offlink +#define nd6_prefix_onlink cyg_nd6_prefix_onlink +#define nd6_prelist_add cyg_nd6_prelist_add +#define nd6_ra_input cyg_nd6_ra_input +#define nd6_rs_input cyg_nd6_rs_input +#define nd6_rtrequest cyg_nd6_rtrequest +#define nd6_setdefaultiface cyg_nd6_setdefaultiface +#define nd6_setmtu cyg_nd6_setmtu +#define nd6_storelladdr cyg_nd6_storelladdr +#define nd6_timer cyg_nd6_timer +#define net_add_domain cyg_net_add_domain +#define ovbcopy cyg_ovbcopy +#define pfctlinput cyg_pfctlinput +#define pfctlinput2 cyg_pfctlinput2 +#define pffindproto cyg_pffindproto +#define pffindtype cyg_pffindtype +#define pfxlist_onlink_check cyg_pfxlist_onlink_check +#define pim6_input cyg_pim6_input +#define prelist_remove cyg_prelist_remove +#define prelist_update cyg_prelist_update +#define pru_accept_notsupp cyg_pru_accept_notsupp +#define pru_connect2_notsupp cyg_pru_connect2_notsupp +#define pru_control_notsupp cyg_pru_control_notsupp +#define pru_listen_notsupp cyg_pru_listen_notsupp +#define pru_rcvd_notsupp cyg_pru_rcvd_notsupp +#define pru_rcvoob_notsupp cyg_pru_rcvoob_notsupp +#define pru_sense_null cyg_pru_sense_null +#define raw_attach cyg_raw_attach +#define raw_ctlinput cyg_raw_ctlinput +#define raw_detach cyg_raw_detach +#define raw_disconnect cyg_raw_disconnect +#define raw_init cyg_raw_init +#define raw_input cyg_raw_input +#define register_netisr cyg_register_netisr +#define rip6_ctlinput cyg_rip6_ctlinput +#define rip6_ctloutput cyg_rip6_ctloutput +#define rip6_input cyg_rip6_input +#define rip6_output cyg_rip6_output +#define rip_ctlinput cyg_rip_ctlinput +#define rip_ctloutput cyg_rip_ctloutput +#define rip_init cyg_rip_init +#define rip_input cyg_rip_input +#define rip_output cyg_rip_output +#define rn_addmask cyg_rn_addmask +#define rn_addroute cyg_rn_addroute +#define rn_delete cyg_rn_delete +#define rn_init cyg_rn_init +#define rn_inithead cyg_rn_inithead +#define rn_lookup cyg_rn_lookup +#define rn_match cyg_rn_match +#define rn_refines cyg_rn_refines +#define route6_input cyg_route6_input +#define route_init cyg_route_init +//#define route_reinit cyg_route_reinit +#define rsvp_input cyg_rsvp_input +#define rt6_flush cyg_rt6_flush +#define rt_ifmsg cyg_rt_ifmsg +#define rt_missmsg cyg_rt_missmsg +#define rt_newaddrmsg cyg_rt_newaddrmsg +#define rt_newmaddrmsg cyg_rt_newmaddrmsg +#define rt_setgate cyg_rt_setgate +#define rtalloc cyg_rtalloc +#define rtalloc1 cyg_rtalloc1 +#define rtalloc_ign cyg_rtalloc_ign +#define rtfree cyg_rtfree +#define rtinit cyg_rtinit +#define rtioctl cyg_rtioctl +#define rtredirect cyg_rtredirect +#define rtrequest cyg_rtrequest +#define sb_lock cyg_sb_lock +#define sbappend cyg_sbappend +#define sbappendaddr cyg_sbappendaddr +#define sbappendcontrol cyg_sbappendcontrol +#define sbappendrecord cyg_sbappendrecord +#define sbcompress cyg_sbcompress +#define sbcreatecontrol cyg_sbcreatecontrol +#define sbdrop cyg_sbdrop +#define sbdroprecord cyg_sbdroprecord +#define sbflush cyg_sbflush +#define sbrelease cyg_sbrelease +#define sbreserve cyg_sbreserve +#define sbwait cyg_sbwait +#define scope6_addr2default cyg_scope6_addr2default +#define scope6_check_id cyg_scope6_check_id +#define scope6_get cyg_scope6_get +#define scope6_get_default cyg_scope6_get_default +#define scope6_ifattach cyg_scope6_ifattach +#define scope6_set cyg_scope6_set +#define scope6_setdefault cyg_scope6_setdefault +#define scope6_setzoneid cyg_scope6_setzoneid +#define selwakeup cyg_selwakeup +#define soabort cyg_soabort +#define soaccept cyg_soaccept +#define soalloc cyg_soalloc +#define sobind cyg_sobind +#define socantrcvmore cyg_socantrcvmore +#define socantsendmore cyg_socantsendmore +#define soclose cyg_soclose +#define soconnect cyg_soconnect +#define socreate cyg_socreate +#define sodealloc cyg_sodealloc +#define sodisconnect cyg_sodisconnect +#define sodropablereq cyg_sodropablereq +#define sofree cyg_sofree +#define sogetopt cyg_sogetopt +#define sohasoutofband cyg_sohasoutofband +#define soisconnected cyg_soisconnected +#define soisconnecting cyg_soisconnecting +#define soisdisconnected cyg_soisdisconnected +#define soisdisconnecting cyg_soisdisconnecting +#define solisten cyg_solisten +#define sonewconn cyg_sonewconn +#define sonewconn3 cyg_sonewconn3 +#define soopt_getm cyg_soopt_getm +#define soopt_mcopyin cyg_soopt_mcopyin +#define soopt_mcopyout cyg_soopt_mcopyout +#define sooptcopyin cyg_sooptcopyin +#define sooptcopyout cyg_sooptcopyout +#define sopoll cyg_sopoll +#define soreceive cyg_soreceive +#define soreserve cyg_soreserve +#define sorflush cyg_sorflush +#define sosend cyg_sosend +#define sosetopt cyg_sosetopt +#define soshutdown cyg_soshutdown +#define sowakeup cyg_sowakeup +#define tcp6_ctlinput cyg_tcp6_ctlinput +#define tcp6_input cyg_tcp6_input +#define tcp_canceltimers cyg_tcp_canceltimers +#define tcp_close cyg_tcp_close +#define tcp_ctlinput cyg_tcp_ctlinput +#define tcp_ctloutput cyg_tcp_ctloutput +#define tcp_drain cyg_tcp_drain +#define tcp_drop cyg_tcp_drop +#define tcp_drop_syn_sent cyg_tcp_drop_syn_sent +#define tcp_fillheaders cyg_tcp_fillheaders +#define tcp_gettaocache cyg_tcp_gettaocache +#define tcp_init cyg_tcp_init +#define tcp_input cyg_tcp_input +#define tcp_maketemplate cyg_tcp_maketemplate +#define tcp_mss cyg_tcp_mss +#define tcp_mssopt cyg_tcp_mssopt +#define tcp_mtudisc cyg_tcp_mtudisc +#define tcp_new_isn cyg_tcp_new_isn +#define tcp_newtcpcb cyg_tcp_newtcpcb +#define tcp_output cyg_tcp_output +#define tcp_quench cyg_tcp_quench +#define tcp_respond cyg_tcp_respond +#define tcp_rtlookup cyg_tcp_rtlookup +#define tcp_rtlookup6 cyg_tcp_rtlookup6 +#define tcp_setpersist cyg_tcp_setpersist +#define tcp_slowtimo cyg_tcp_slowtimo +#define tcp_timer_2msl cyg_tcp_timer_2msl +#define tcp_timer_delack cyg_tcp_timer_delack +#define tcp_timer_keep cyg_tcp_timer_keep +#define tcp_timer_persist cyg_tcp_timer_persist +#define tcp_timer_rexmt cyg_tcp_timer_rexmt +#define timeout cyg_timeout +#define tvtohz cyg_tvtohz +#define udp6_ctlinput cyg_udp6_ctlinput +#define udp6_input cyg_udp6_input +#define udp6_output cyg_udp6_output +#define udp_ctlinput cyg_udp_ctlinput +#define udp_init cyg_udp_init +#define udp_input cyg_udp_input +#define udp_notify cyg_udp_notify +#define udp_shutdown cyg_udp_shutdown +#define uiomove cyg_uiomove + +// DATA symbols +#define arpintrq cyg_arpintrq +#define bsd_nste cyg_bsd_nste +#define bsd_sock_fileops cyg_bsd_sock_fileops +#define bsd_sockops cyg_bsd_sockops +#define encaptab cyg_encaptab +#define etherbroadcastaddr cyg_etherbroadcastaddr +#define fr_checkp cyg_fr_checkp +#define fw_enable cyg_fw_enable +#define hostname cyg_hostname +#define hz cyg_hz +#define icmp6_ifstat cyg_icmp6_ifstat +#define icmp6_ifstatmax cyg_icmp6_ifstatmax +#define icmp6_nodeinfo cyg_icmp6_nodeinfo +#define icmp6_rediraccept cyg_icmp6_rediraccept +#define icmp6errppslim cyg_icmp6errppslim +#define if_cloners cyg_if_cloners +#define if_index cyg_if_index +#define ifindex2ifnet cyg_ifindex2ifnet +#define ifqmaxlen cyg_ifqmaxlen +#define in6_ifstat cyg_in6_ifstat +#define in6_ifstatmax cyg_in6_ifstatmax +#define in6_maxmtu cyg_in6_maxmtu +#define inet6ctlerrmap cyg_inet6ctlerrmap +#define inet6domain cyg_inet6domain +#define inet6sw cyg_inet6sw +#define inetctlerrmap cyg_inetctlerrmap +#define inetdomain cyg_inetdomain +#define inetsw cyg_inetsw +#define ip6_accept_rtadv cyg_ip6_accept_rtadv +#define ip6_auto_flowlabel cyg_ip6_auto_flowlabel +#define ip6_auto_linklocal cyg_ip6_auto_linklocal +#define ip6_dad_count cyg_ip6_dad_count +#define ip6_defhlim cyg_ip6_defhlim +#define ip6_defmcasthlim cyg_ip6_defmcasthlim +#define ip6_forwarding cyg_ip6_forwarding +#define ip6_fw_enable cyg_ip6_fw_enable +#define ip6_hdrnestlimit cyg_ip6_hdrnestlimit +#define ip6_id cyg_ip6_id +#define ip6_log_interval cyg_ip6_log_interval +#define ip6_log_time cyg_ip6_log_time +#define ip6_mrouter cyg_ip6_mrouter +#define ip6_mrouter_ver cyg_ip6_mrouter_ver +#define ip6_prefer_tempaddr cyg_ip6_prefer_tempaddr +#define ip6_temp_preferred_lifetime cyg_ip6_temp_preferred_lifetime +#define ip6_temp_regen_advance cyg_ip6_temp_regen_advance +#define ip6_temp_valid_lifetime cyg_ip6_temp_valid_lifetime +#define ip6_use_defzone cyg_ip6_use_defzone +#define ip6_use_deprecated cyg_ip6_use_deprecated +#define ip6_use_tempaddr cyg_ip6_use_tempaddr +#define ip6_v6only cyg_ip6_v6only +#define ip_defttl cyg_ip_defttl +#define ip_mcast_src cyg_ip_mcast_src +#define ip_mforward cyg_ip_mforward +#define ip_mrouter cyg_ip_mrouter +#define ip_mrouter_done cyg_ip_mrouter_done +#define ip_mrouter_get cyg_ip_mrouter_get +#define ip_mrouter_set cyg_ip_mrouter_set +#define ipforwarding cyg_ipforwarding +#define ipport_firstauto cyg_ipport_firstauto +#define ipport_hifirstauto cyg_ipport_hifirstauto +#define ipport_hilastauto cyg_ipport_hilastauto +#define ipport_lastauto cyg_ipport_lastauto +#define ipport_lowfirstauto cyg_ipport_lowfirstauto +#define ipport_lowlastauto cyg_ipport_lowlastauto +#define legal_vif_num cyg_legal_vif_num +#define llinfo_nd6 cyg_llinfo_nd6 +#define log_in_vain cyg_log_in_vain +#define m_clalloc_wid cyg_m_clalloc_wid +#define m_mballoc_wid cyg_m_mballoc_wid +#define maxsockets cyg_maxsockets +#define mbuf_wait cyg_mbuf_wait +#define mrt_ioctl cyg_mrt_ioctl +#define nd6_debug cyg_nd6_debug +#define nd6_delay cyg_nd6_delay +#define nd6_gctimer cyg_nd6_gctimer +#define nd6_maxndopt cyg_nd6_maxndopt +#define nd6_maxnudhint cyg_nd6_maxnudhint +#define nd6_mmaxtries cyg_nd6_mmaxtries +#define nd6_prune cyg_nd6_prune +#define nd6_recalc_reachtm_interval cyg_nd6_recalc_reachtm_interval +#define nd6_umaxtries cyg_nd6_umaxtries +#define nd6_useloopback cyg_nd6_useloopback +#define nd_ifinfo cyg_nd_ifinfo +#define nd_prefix cyg_nd_prefix +#define nmbclusters cyg_nmbclusters +#define proc0 cyg_proc0 +#define raw_usrreqs cyg_raw_usrreqs +#define rip6_usrreqs cyg_rip6_usrreqs +#define rip_recvspace cyg_rip_recvspace +#define rip_sendspace cyg_rip_sendspace +#define rip_usrreqs cyg_rip_usrreqs +#define rsvp_on cyg_rsvp_on +#define rsvpdebug cyg_rsvpdebug +#define rtc_resolution cyg_rtc_resolution +#define sb_max cyg_sb_max +#define scope6_ids cyg_scope6_ids +#define ss_fltsz cyg_ss_fltsz +#define ss_fltsz_local cyg_ss_fltsz_local +#define tcp6_usrreqs cyg_tcp6_usrreqs +#define tcp_backoff cyg_tcp_backoff +#define tcp_delack_enabled cyg_tcp_delack_enabled +#define tcp_do_newreno cyg_tcp_do_newreno +#define tcp_lq_overflow cyg_tcp_lq_overflow +#define tcp_mssdflt cyg_tcp_mssdflt +#define tcp_recvspace cyg_tcp_recvspace +#define tcp_sendspace cyg_tcp_sendspace +#define tcp_syn_backoff cyg_tcp_syn_backoff +#define tcp_usrreqs cyg_tcp_usrreqs +#define tcp_v6mssdflt cyg_tcp_v6mssdflt +#define tick cyg_tick +#define udp6_usrreqs cyg_udp6_usrreqs +#define udp_in6 cyg_udp_in6 +#define udp_recvspace cyg_udp_recvspace +#define udp_sendspace cyg_udp_sendspace +#define udp_usrreqs cyg_udp_usrreqs +#define udpcksum cyg_udpcksum + +// BSS symbols +#define addrsel_policytab cyg_addrsel_policytab +#define defaultaddrpolicy cyg_defaultaddrpolicy +#define domains cyg_domains +#define frag6_doing_reass cyg_frag6_doing_reass +#define frag6_nfragpackets cyg_frag6_nfragpackets +#define icmp6stat cyg_icmp6stat +#define icmpstat cyg_icmpstat +#define if_cloners_count cyg_if_cloners_count +#define ifnet cyg_ifnet +#define ifnet_addrs cyg_ifnet_addrs +#define in6_ifaddr cyg_in6_ifaddr +#define in6_multihead cyg_in6_multihead +#define in6_tmpaddrtimer_ch cyg_in6_tmpaddrtimer_ch +#define in_ifaddrhead cyg_in_ifaddrhead +#define in_multihead cyg_in_multihead +#define ip6_desync_factor cyg_ip6_desync_factor +#define ip6_flow_seq cyg_ip6_flow_seq +#define ip6_forward_rt cyg_ip6_forward_rt +#define ip6_forward_srcrt cyg_ip6_forward_srcrt +#define ip6_fw_chk_ptr cyg_ip6_fw_chk_ptr +#define ip6_fw_ctl_ptr cyg_ip6_fw_ctl_ptr +#define ip6_maxfragpackets cyg_ip6_maxfragpackets +#define ip6_ours_check_algorithm cyg_ip6_ours_check_algorithm +#define ip6_protox cyg_ip6_protox +#define ip6_sourcecheck cyg_ip6_sourcecheck +#define ip6_sourcecheck_interval cyg_ip6_sourcecheck_interval +#define ip6intrq cyg_ip6intrq +#define ip6q cyg_ip6q +#define ip6stat cyg_ip6stat +#define ip_fw_chk_ptr cyg_ip_fw_chk_ptr +#define ip_fw_ctl_ptr cyg_ip_fw_ctl_ptr +#define ip_fw_fwd_addr cyg_ip_fw_fwd_addr +#define ip_id cyg_ip_id +#define ip_protox cyg_ip_protox +#define ip_rsvpd cyg_ip_rsvpd +#define ipintrq cyg_ipintrq +#define ipstat cyg_ipstat +#define isn_ctx cyg_isn_ctx +#define isn_last_reseed cyg_isn_last_reseed +#define isn_secret cyg_isn_secret +#define ktime cyg_ktime +#define loif cyg_loif +#define max_datalen cyg_max_datalen +#define max_hdr cyg_max_hdr +#define max_linkhdr cyg_max_linkhdr +#define max_protohdr cyg_max_protohdr +#define mbstat cyg_mbstat +#define mbtypes cyg_mbtypes +#define mbutl cyg_mbutl +#define mclfree cyg_mclfree +#define mclrefcnt cyg_mclrefcnt +#define mf6ctable cyg_mf6ctable +#define mmbfree cyg_mmbfree +#define mono_time cyg_mono_time +#define mrt6stat cyg_mrt6stat +#define mtab_lock cyg_mtab_lock +#define multicast_register_if cyg_multicast_register_if +#define n6expire cyg_n6expire +#define nd6_defifindex cyg_nd6_defifindex +#define nd6_slowtimo_ch cyg_nd6_slowtimo_ch +#define nd6_timer_ch cyg_nd6_timer_ch +#define nd_defrouter cyg_nd_defrouter +#define netint_flags cyg_netint_flags +#define ng_ether_attach_p cyg_ng_ether_attach_p +#define ng_ether_detach_p cyg_ng_ether_detach_p +#define ng_ether_input_orphan_p cyg_ng_ether_input_orphan_p +#define ng_ether_input_p cyg_ng_ether_input_p +#define ng_ether_output_p cyg_ng_ether_output_p +#define nstab_lock cyg_nstab_lock +#define rawcb_list cyg_rawcb_list +#define rip6stat cyg_rip6stat +#define ripcb cyg_ripcb +#define ripcbinfo cyg_ripcbinfo +#define route_cb cyg_route_cb +#define rt_tables cyg_rt_tables +#define sig_pending cyg_sig_pending +#define signal_mutex cyg_signal_mutex +#define signal_sigwait cyg_signal_sigwait +#define so_gencnt cyg_so_gencnt +#define socket_zone cyg_socket_zone +#define tcb cyg_tcb +#define tcbinfo cyg_tcbinfo +#define tcp_ccgen cyg_tcp_ccgen +#define tcp_delacktime cyg_tcp_delacktime +#define tcp_keepidle cyg_tcp_keepidle +#define tcp_keepinit cyg_tcp_keepinit +#define tcp_keepintvl cyg_tcp_keepintvl +#define tcp_maxidle cyg_tcp_maxidle +#define tcp_maxpersistidle cyg_tcp_maxpersistidle +#define tcp_msl cyg_tcp_msl +#define tcpstat cyg_tcpstat +#define udb cyg_udb +#define udbinfo cyg_udbinfo +#define udp_ip6 cyg_udp_ip6 +#define udpstat cyg_udpstat +#endif + +#include +#include // Standard eCos types + +#define __P(protos) protos +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif + +#include +#include + +#ifdef _KERNEL +// External [common] variables +extern int hz; +extern volatile struct timeval ktime; +#define time_second ktime.tv_sec +extern int tick; +extern int proc0; +#define curproc 0 +extern void microtime(struct timeval *tp); +extern void getmicrotime(struct timeval *tp); +extern void getmicrouptime(struct timeval *tp); +extern int tvtohz(struct timeval *tv); +extern int arc4random(void); + +//extern u_int in_cksum_hdr(const struct ip *ip); +//extern u_short in_cksum_skip(struct mbuf *m, int len, int skip); +//extern u_short in_pseudo(u_int32_t a, u_int32_t b, u_int32_t c); + + +// Function mappings + +extern int cyg_ticks(void); +#define ticks cyg_ticks() +extern int cyg_tsleep(void *, int, char *, int); +extern void cyg_wakeup(void *); +#define tsleep(e,p,w,t) cyg_tsleep(e,0,w,t) +#define wakeup(e) cyg_wakeup(e) +#define wakeup_one(e) cyg_wakeup(e) + +#ifdef CYGIMPL_TRACE_SPLX +extern cyg_uint32 cyg_splimp(const char *file, const int line); +extern cyg_uint32 cyg_splnet(const char *file, const int line); +extern cyg_uint32 cyg_splclock(const char *file, const int line); +extern cyg_uint32 cyg_splsoftnet(const char *file, const int line); +extern void cyg_splx(cyg_uint32, const char *file, const int line); +#define splimp() cyg_splimp(__FUNCTION__, __LINE__) +#define splnet() cyg_splnet(__FUNCTION__, __LINE__) +#define splclock() cyg_splclock(__FUNCTION__, __LINE__) +#define splsoftnet() cyg_splsoftnet(__FUNCTION__, __LINE__) +#define splx(x) cyg_splx(x, __FUNCTION__, __LINE__) +#define cyg_scheduler_lock() _cyg_scheduler_lock(__FUNCTION__, __LINE__) +#define cyg_scheduler_safe_lock() _cyg_scheduler_safe_lock(__FUNCTION__, __LINE__) +#define cyg_scheduler_unlock() _cyg_scheduler_unlock(__FUNCTION__, __LINE__) +#else +extern cyg_uint32 cyg_splimp(void); +extern cyg_uint32 cyg_splnet(void); +extern cyg_uint32 cyg_splclock(void); +extern cyg_uint32 cyg_splsoftnet(void); +extern cyg_uint32 cyg_splhigh(void); +extern void cyg_splx(cyg_uint32); +#define splimp cyg_splimp +#define splnet cyg_splnet +#define splclock cyg_splclock +#define splsoftnet cyg_splsoftnet +#define splhigh cyg_splhigh +#define splx cyg_splx +#endif + +extern void cyg_panic(const char *msg, ...); +#define panic cyg_panic + +/* + * Constants related to network buffer management. + * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * on machines that exchange pages of input or output buffers with mbuf + * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple + * of the hardware page size. + */ +#define MSIZE 128 /* size of an mbuf */ +#define MCLSHIFT 11 /* convert bytes to m_buf clusters */ +#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ +#define MCLOFSET (MCLBYTES - 1) /* offset within a m_buf cluster */ +#define CLBYTES 4096 /* size of actual cluster */ +#define PAGE_SIZE CLBYTES + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is u_int and + * must be cast to any desired pointer type. + */ +#define ALIGNBYTES (sizeof(int) - 1) +#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) + +// These symbols are used in the IPV6 stuff +// (be more defensive about external setup) +#undef __linux__ +#undef __bsdi__ +#undef __FreeBSD__ +#undef __OpenBSD__ +#undef __NetBSD__ + +#define __FreeBSD__ 4 +#define __FreeBSD_version 440000 + +// TEMP + +#include +#include +#include +#include + +struct net_stats { + int count; + cyg_uint32 min_time, max_time, total_time; +}; + +#ifdef CYGDBG_NET_TIMING_STATS +#define START_STATS() \ + cyg_uint32 start_time, end_time, elapsed_time; \ + HAL_CLOCK_READ(&start_time); +#define FINISH_STATS(stats) \ + HAL_CLOCK_READ(&end_time); \ + if (end_time < start_time) { \ + elapsed_time = (end_time+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - start_time; \ + } else { \ + elapsed_time = end_time - start_time; \ + } \ + if (stats.min_time == 0) { \ + stats.min_time = 0x7FFFFFFF; \ + } \ + if (elapsed_time < stats.min_time) \ + stats.min_time = elapsed_time; \ + if (elapsed_time > stats.max_time) \ + stats.max_time = elapsed_time; \ + stats.total_time += elapsed_time; \ + stats.count++; +#else +#define START_STATS() +#define FINISH_STATS(X) +#endif + +// TEMP + +// timeout support +typedef void (timeout_fun)(void *); +typedef struct callout { + struct callout *next, *prev; + cyg_int32 delta; // Number of "ticks" in the future for this timeout + timeout_fun *fun; // Function to execute when it expires + void *arg; // Argument to pass when it does + int flags; // Info about this item +} timeout_entry; +#define CALLOUT_LOCAL 0x0001 +#define CALLOUT_ACTIVE 0x0002 +#define CALLOUT_PENDING 0x0004 +extern cyg_uint32 timeout(timeout_fun *fun, void *arg, cyg_int32 delta); +extern void untimeout(timeout_fun *fun, void *arg); + +extern void callout_init(struct callout *); +extern void callout_reset(struct callout *, int, timeout_fun *, void *); +extern void callout_stop(struct callout *); +extern int callout_active(struct callout *); +extern void callout_deactivate(struct callout *); +extern int callout_pending(struct callout *); + +extern int uiomove(caddr_t cp, int n, struct uio *uio); +extern int copyout(const void *s, void *d, size_t len); +extern int copyin(const void *s, void *d, size_t len); +extern void ovbcopy(const void *s, void *d, size_t len); +extern void get_mono_time(void); +extern int arc4random(void); +extern void get_random_bytes(void *buf, size_t len); +extern void read_random_unlimited(void *buf, size_t len); +extern void *hashinit(int elements, void *type, u_long *hashmask); + +// Initialization support - cross between RedBoot & FreeBSD +typedef void _init_fun(void *); +typedef _init_fun *_init_fun_ptr; +struct init_tab_entry { + _init_fun_ptr fun; + void *data; + char *name; +} CYG_HAL_TABLE_TYPE; +#define _cat(a,b) a##b +#define __Net_init(_p1_,_p2_,_f_,_d_) \ +struct init_tab_entry _cat(_net_init_tab,_p1_##_p2_##_f_) \ + CYG_HAL_TABLE_QUALIFIED_ENTRY(_Net_inits,_p1_##_p2_##_f_) = { _f_, _d_, #_f_ }; +#define _Net_init(_p1_,_p2_,_f_,_d_) \ + __Net_init(_p1_,_p2_,_f_,_d_) + +#define SI_ORDER_FIRST 000000 +#define SI_ORDER_SECOND 000001 +#define SI_ORDER_THIRD 000002 +#define SI_ORDER_MIDDLE 080000 +#define SI_ORDER_ANY FFFFFF + +#define SI_SUB_MBUF 0x50 +#define SI_SUB_DEVICES 0x60 +#define SI_SUB_PSEUDO 0x70 +#define SI_SUB_PROTO_IF 0x84 +#define SI_SUB_PROTO_DOMAIN 0x88 + +#define SYSINIT(label, group, order, fun, ident) \ + _Net_init(_cat(group,order), label, fun, ident) +#define PSEUDO_SET(fun, sys) \ + SYSINIT(sys, SI_SUB_PSEUDO, SI_ORDER_FIRST, fun, NULL) + +// VM zone stuff +#define ZONE_INTERRUPT 1 + +typedef struct _elem { + struct _elem *next; +} elem; + +typedef struct vm_zone { + char *name; + int elem_size, free, total; + int alloc_tries, alloc_fails, alloc_frees; + elem *pool; + struct vm_zone *next; +} *vm_zone_t; +vm_zone_t zinit(char *name, int size, int nentries, int flags, int zalloc); +void * zalloci(vm_zone_t z); +void zfreei(vm_zone_t z, void *item); + +// Function mapping +#define printf diag_printf +#define snprintf diag_snprintf + +// Missing standard functions +static __inline int imax(int a, int b) { return (a > b ? a : b); } +static __inline int imin(int a, int b) { return (a < b ? a : b); } +static __inline long lmax(long a, long b) { return (a > b ? a : b); } +static __inline long lmin(long a, long b) { return (a < b ? a : b); } +static __inline u_int max(u_int a, u_int b) { return (a > b ? a : b); } +static __inline u_int min(u_int a, u_int b) { return (a < b ? a : b); } +static __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); } +static __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); } +static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); } +static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); } + +// Align a value to a natural multiple (4) +#define _ALIGN(n) (((n)+3)&~3) // Is this right? +// Round a number 'n' up to a multiple of 'm' +#define roundup(n,m) ((((n)+((m)-1))/(m))*(m)) + +#define NEW_STRUCT_ROUTE +extern char *hostname; + +// Logging facilities +#ifdef CYGPKG_NET_FREEBSD_LOGGING +extern int cyg_net_log_mask; +#define LOG_ERR 0x0001 +#define LOG_WARNING 0x0002 +#define LOG_NOTICE 0x0004 +#define LOG_INFO 0x0008 +#define LOG_DEBUG 0x0010 +#define LOG_MDEBUG 0x0020 +#define LOG_IOCTL 0x0040 +#define LOG_ADDR 0x0100 +#define LOG_FAIL 0x0200 +#define LOG_INIT 0x0080 +#define LOG_EMERG 0x4000 +#define LOG_CRIT 0x8000 +#define log(lvl, args...) \ +do { if (cyg_net_log_mask & lvl) diag_printf(args); } while (0) +#define log_dump(lvl, buf, len) \ +do { if (cyg_net_log_mask & lvl) diag_dump_buf(buf, len); } while (0) +#define log_(lvl) \ +if (cyg_net_log_mask & lvl) +#else +#define log(lvl, args...) +#define log_dump(lvl, buf, len) +#define log_(lvl) +#endif + +#endif // _KERNEL + +#endif //_SYS_PARAM_H_ diff --git a/packages/net/bsd_tcpip/current/include/sys/protosw.h b/packages/net/bsd_tcpip/current/include/sys/protosw.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/protosw.h @@ -0,0 +1,343 @@ +//========================================================================== +// +// include/sys/protosw.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/*- + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)protosw.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/sys/protosw.h,v 1.28.2.2 2001/07/03 11:02:01 ume Exp $ + */ + +#ifndef _SYS_PROTOSW_H_ +#define _SYS_PROTOSW_H_ + +/* Forward declare these structures referenced from prototypes below. */ +struct mbuf; +struct proc; +struct sockaddr; +struct socket; +struct sockopt; + +/*#ifdef _KERNEL*/ +/* + * Protocol switch table. + * + * Each protocol has a handle initializing one of these structures, + * which is used for protocol-protocol and system-protocol communication. + * + * A protocol is called through the pr_init entry before any other. + * Thereafter it is called every 200ms through the pr_fasttimo entry and + * every 500ms through the pr_slowtimo for timer based actions. + * The system will call the pr_drain entry if it is low on space and + * this should throw away any non-critical data. + * + * Protocols pass data between themselves as chains of mbufs using + * the pr_input and pr_output hooks. Pr_input passes data up (towards + * the users) and pr_output passes it down (towards the interfaces); control + * information passes up and down on pr_ctlinput and pr_ctloutput. + * The protocol is responsible for the space occupied by any the + * arguments to these entries and must dispose it. + * + * In retrospect, it would be a lot nicer to use an interface + * similar to the vnode VOP interface. + */ +struct protosw { + short pr_type; /* socket type used for */ + struct domain *pr_domain; /* domain protocol a member of */ + short pr_protocol; /* protocol number */ + short pr_flags; /* see below */ +/* protocol-protocol hooks */ + void (*pr_input) __P((struct mbuf *, int len)); + /* input to protocol (from below) */ + int (*pr_output) __P((struct mbuf *m, struct socket *so)); + /* output to protocol (from above) */ + void (*pr_ctlinput)__P((int, struct sockaddr *, void *)); + /* control input (from below) */ + int (*pr_ctloutput)__P((struct socket *, struct sockopt *)); + /* control output (from above) */ +/* user-protocol hook */ + void *pr_ousrreq; +/* utility hooks */ + void (*pr_init) __P((void)); /* initialization hook */ + void (*pr_fasttimo) __P((void)); + /* fast timeout (200ms) */ + void (*pr_slowtimo) __P((void)); + /* slow timeout (500ms) */ + void (*pr_drain) __P((void)); + /* flush any excess space possible */ + struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ +}; +/*#endif*/ + +#define PR_SLOWHZ 2 /* 2 slow timeouts per second */ +#define PR_FASTHZ 5 /* 5 fast timeouts per second */ + +/* + * Values for pr_flags. + * PR_ADDR requires PR_ATOMIC; + * PR_ADDR and PR_CONNREQUIRED are mutually exclusive. + * PR_IMPLOPCL means that the protocol allows sendto without prior connect, + * and the protocol understands the MSG_EOF flag. The first property is + * is only relevant if PR_CONNREQUIRED is set (otherwise sendto is allowed + * anyhow). + */ +#define PR_ATOMIC 0x01 /* exchange atomic messages only */ +#define PR_ADDR 0x02 /* addresses given with messages */ +#define PR_CONNREQUIRED 0x04 /* connection required by protocol */ +#define PR_WANTRCVD 0x08 /* want PRU_RCVD calls */ +#define PR_RIGHTS 0x10 /* passes capabilities */ +#define PR_IMPLOPCL 0x20 /* implied open/close */ +#define PR_LASTHDR 0x40 /* enforce ipsec policy; last header */ + +/* + * The arguments to usrreq are: + * (*protosw[].pr_usrreq)(up, req, m, nam, opt); + * where up is a (struct socket *), req is one of these requests, + * m is a optional mbuf chain containing a message, + * nam is an optional mbuf chain containing an address, + * and opt is a pointer to a socketopt structure or nil. + * The protocol is responsible for disposal of the mbuf chain m, + * the caller is responsible for any space held by nam and opt. + * A non-zero return from usrreq gives an + * UNIX error number which should be passed to higher level software. + */ +#define PRU_ATTACH 0 /* attach protocol to up */ +#define PRU_DETACH 1 /* detach protocol from up */ +#define PRU_BIND 2 /* bind socket to address */ +#define PRU_LISTEN 3 /* listen for connection */ +#define PRU_CONNECT 4 /* establish connection to peer */ +#define PRU_ACCEPT 5 /* accept connection from peer */ +#define PRU_DISCONNECT 6 /* disconnect from peer */ +#define PRU_SHUTDOWN 7 /* won't send any more data */ +#define PRU_RCVD 8 /* have taken data; more room now */ +#define PRU_SEND 9 /* send this data */ +#define PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */ +#define PRU_CONTROL 11 /* control operations on protocol */ +#define PRU_SENSE 12 /* return status into m */ +#define PRU_RCVOOB 13 /* retrieve out of band data */ +#define PRU_SENDOOB 14 /* send out of band data */ +#define PRU_SOCKADDR 15 /* fetch socket's address */ +#define PRU_PEERADDR 16 /* fetch peer's address */ +#define PRU_CONNECT2 17 /* connect two sockets */ +/* begin for protocols internal use */ +#define PRU_FASTTIMO 18 /* 200ms timeout */ +#define PRU_SLOWTIMO 19 /* 500ms timeout */ +#define PRU_PROTORCV 20 /* receive from below */ +#define PRU_PROTOSEND 21 /* send to below */ +/* end for protocol's internal use */ +#define PRU_SEND_EOF 22 /* send and close */ +#define PRU_NREQ 22 + +#ifdef PRUREQUESTS +char *prurequests[] = { + "ATTACH", "DETACH", "BIND", "LISTEN", + "CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN", + "RCVD", "SEND", "ABORT", "CONTROL", + "SENSE", "RCVOOB", "SENDOOB", "SOCKADDR", + "PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO", + "PROTORCV", "PROTOSEND", + "SEND_EOF", +}; +#endif + +#ifdef _KERNEL /* users shouldn't see this decl */ + +struct ifnet; +struct stat; +struct ucred; +struct uio; + +/* + * If the ordering here looks odd, that's because it's alphabetical. + * Having this structure separated out from the main protoswitch is allegedly + * a big (12 cycles per call) lose on high-end CPUs. We will eventually + * migrate this stuff back into the main structure. + */ +struct pr_usrreqs { + int (*pru_abort) __P((struct socket *so)); + int (*pru_accept) __P((struct socket *so, struct sockaddr **nam)); + int (*pru_attach) __P((struct socket *so, int proto, + struct proc *p)); + int (*pru_bind) __P((struct socket *so, struct sockaddr *nam, + struct proc *p)); + int (*pru_connect) __P((struct socket *so, struct sockaddr *nam, + struct proc *p)); + int (*pru_connect2) __P((struct socket *so1, struct socket *so2)); + int (*pru_control) __P((struct socket *so, u_long cmd, caddr_t data, + struct ifnet *ifp, struct proc *p)); + int (*pru_detach) __P((struct socket *so)); + int (*pru_disconnect) __P((struct socket *so)); + int (*pru_listen) __P((struct socket *so, struct proc *p)); + int (*pru_peeraddr) __P((struct socket *so, + struct sockaddr **nam)); + int (*pru_rcvd) __P((struct socket *so, int flags)); + int (*pru_rcvoob) __P((struct socket *so, struct mbuf *m, + int flags)); + int (*pru_send) __P((struct socket *so, int flags, struct mbuf *m, + struct sockaddr *addr, struct mbuf *control, + struct proc *p)); +#define PRUS_OOB 0x1 +#define PRUS_EOF 0x2 +#define PRUS_MORETOCOME 0x4 + int (*pru_sense) __P((struct socket *so, struct stat *sb)); + int (*pru_shutdown) __P((struct socket *so)); + int (*pru_sockaddr) __P((struct socket *so, + struct sockaddr **nam)); + + /* + * These three added later, so they are out of order. They are used + * for shortcutting (fast path input/output) in some protocols. + * XXX - that's a lie, they are not implemented yet + * Rather than calling sosend() etc. directly, calls are made + * through these entry points. For protocols which still use + * the generic code, these just point to those routines. + */ + int (*pru_sosend) __P((struct socket *so, struct sockaddr *addr, + struct uio *uio, struct mbuf *top, + struct mbuf *control, int flags, + struct proc *p)); + int (*pru_soreceive) __P((struct socket *so, + struct sockaddr **paddr, + struct uio *uio, struct mbuf **mp0, + struct mbuf **controlp, int *flagsp)); + int (*pru_sopoll) __P((struct socket *so, int events, + struct ucred *cred, struct proc *p)); +}; + +int pru_accept_notsupp __P((struct socket *so, struct sockaddr **nam)); +int pru_connect_notsupp __P((struct socket *so, struct sockaddr *nam, + struct proc *p)); +int pru_connect2_notsupp __P((struct socket *so1, struct socket *so2)); +int pru_control_notsupp __P((struct socket *so, u_long cmd, caddr_t data, + struct ifnet *ifp, struct proc *p)); +int pru_listen_notsupp __P((struct socket *so, struct proc *p)); +int pru_rcvd_notsupp __P((struct socket *so, int flags)); +int pru_rcvoob_notsupp __P((struct socket *so, struct mbuf *m, int flags)); +int pru_sense_null __P((struct socket *so, struct stat *sb)); + +#endif /* _KERNEL */ + +/* + * The arguments to the ctlinput routine are + * (*protosw[].pr_ctlinput)(cmd, sa, arg); + * where cmd is one of the commands below, sa is a pointer to a sockaddr, + * and arg is a `void *' argument used within a protocol family. + */ +#define PRC_IFDOWN 0 /* interface transition */ +#define PRC_ROUTEDEAD 1 /* select new route if possible ??? */ +#define PRC_IFUP 2 /* interface has come back up */ +#define PRC_QUENCH2 3 /* DEC congestion bit says slow down */ +#define PRC_QUENCH 4 /* some one said to slow down */ +#define PRC_MSGSIZE 5 /* message size forced drop */ +#define PRC_HOSTDEAD 6 /* host appears to be down */ +#define PRC_HOSTUNREACH 7 /* deprecated (use PRC_UNREACH_HOST) */ +#define PRC_UNREACH_NET 8 /* no route to network */ +#define PRC_UNREACH_HOST 9 /* no route to host */ +#define PRC_UNREACH_PROTOCOL 10 /* dst says bad protocol */ +#define PRC_UNREACH_PORT 11 /* bad port # */ +/* was PRC_UNREACH_NEEDFRAG 12 (use PRC_MSGSIZE) */ +#define PRC_UNREACH_SRCFAIL 13 /* source route failed */ +#define PRC_REDIRECT_NET 14 /* net routing redirect */ +#define PRC_REDIRECT_HOST 15 /* host routing redirect */ +#define PRC_REDIRECT_TOSNET 16 /* redirect for type of service & net */ +#define PRC_REDIRECT_TOSHOST 17 /* redirect for tos & host */ +#define PRC_TIMXCEED_INTRANS 18 /* packet lifetime expired in transit */ +#define PRC_TIMXCEED_REASS 19 /* lifetime expired on reass q */ +#define PRC_PARAMPROB 20 /* header incorrect */ +#define PRC_UNREACH_ADMIN_PROHIB 21 /* packet administrativly prohibited */ + +#define PRC_NCMDS 22 + +#define PRC_IS_REDIRECT(cmd) \ + ((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST) + +#ifdef PRCREQUESTS +char *prcrequests[] = { + "IFDOWN", "ROUTEDEAD", "IFUP", "DEC-BIT-QUENCH2", + "QUENCH", "MSGSIZE", "HOSTDEAD", "#7", + "NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH", + "#12", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT", + "TOSNET-REDIRECT", "TOSHOST-REDIRECT", "TX-INTRANS", "TX-REASS", + "PARAMPROB", "ADMIN-UNREACH" +}; +#endif + +/* + * The arguments to ctloutput are: + * (*protosw[].pr_ctloutput)(req, so, level, optname, optval, p); + * req is one of the actions listed below, so is a (struct socket *), + * level is an indication of which protocol layer the option is intended. + * optname is a protocol dependent socket option request, + * optval is a pointer to a mbuf-chain pointer, for value-return results. + * The protocol is responsible for disposal of the mbuf chain *optval + * if supplied, + * the caller is responsible for any space held by *optval, when returned. + * A non-zero return from usrreq gives an + * UNIX error number which should be passed to higher level software. + */ +#define PRCO_GETOPT 0 +#define PRCO_SETOPT 1 + +#define PRCO_NCMDS 2 + +#ifdef PRCOREQUESTS +char *prcorequests[] = { + "GETOPT", "SETOPT", +}; +#endif + +#ifdef _KERNEL +void pfctlinput __P((int, struct sockaddr *)); +void pfctlinput2 __P((int, struct sockaddr *, void *)); +struct protosw *pffindproto __P((int family, int protocol, int type)); +struct protosw *pffindtype __P((int family, int type)); +#endif + +#endif diff --git a/packages/net/bsd_tcpip/current/include/sys/queue.h b/packages/net/bsd_tcpip/current/include/sys/queue.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/queue.h @@ -0,0 +1,565 @@ +//========================================================================== +// +// include/sys/queue.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1991, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + * $FreeBSD: src/sys/sys/queue.h,v 1.32.2.4 2001/03/31 03:33:39 hsu Exp $ + */ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +/* + * This file defines five types of data structures: singly-linked lists, + * singly-linked tail queues, lists, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The elements + * are singly linked for minimum space and pointer manipulation overhead at + * the expense of O(n) removal for arbitrary elements. New elements can be + * added to the list after an existing element or at the head of the list. + * Elements being removed from the head of the list should use the explicit + * macro for this purpose for optimum efficiency. A singly-linked list may + * only be traversed in the forward direction. Singly-linked lists are ideal + * for applications with large datasets and few or no removals or for + * implementing a LIFO queue. + * + * A singly-linked tail queue is headed by a pair of pointers, one to the + * head of the list and the other to the tail of the list. The elements are + * singly linked for minimum space and pointer manipulation overhead at the + * expense of O(n) removal for arbitrary elements. New elements can be added + * to the list after an existing element, at the head of the list, or at the + * end of the list. Elements being removed from the head of the tail queue + * should use the explicit macro for this purpose for optimum efficiency. + * A singly-linked tail queue may only be traversed in the forward direction. + * Singly-linked tail queues are ideal for applications with large datasets + * and few or no removals or for implementing a FIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + * + * + * SLIST LIST STAILQ TAILQ CIRCLEQ + * _HEAD + + + + + + * _ENTRY + + + + + + * _INIT + + + + + + * _EMPTY + + + + + + * _FIRST + + + + + + * _NEXT + + + + + + * _PREV - - - + + + * _LAST - - + + + + * _FOREACH + + + + + + * _FOREACH_REVERSE - - - + + + * _INSERT_HEAD + + + + + + * _INSERT_BEFORE - + - + + + * _INSERT_AFTER + + + + + + * _INSERT_TAIL - - + + + + * _REMOVE_HEAD + - + - - + * _REMOVE + + + + + + * + */ + +/* + * Singly-linked List definitions. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) + +#define SLIST_FIRST(head) ((head)->slh_first) + +#define SLIST_FOREACH(var, head, field) \ + for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) + +#define SLIST_INIT(head) { \ + (head)->slh_first = NULL; \ +} + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + (elm)->field.sle_next = (slistelm)->field.sle_next; \ + (slistelm)->field.sle_next = (elm); \ +} while (0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.sle_next = (head)->slh_first; \ + (head)->slh_first = (elm); \ +} while (0) + +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + (head)->slh_first = (head)->slh_first->field.sle_next; \ +} while (0) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if ((head)->slh_first == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = (head)->slh_first; \ + while( curelm->field.sle_next != (elm) ) \ + curelm = curelm->field.sle_next; \ + curelm->field.sle_next = \ + curelm->field.sle_next->field.sle_next; \ + } \ +} while (0) + +/* + * Singly-linked Tail queue definitions. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first;/* first element */ \ + struct type **stqh_last;/* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) + +#define STAILQ_INIT(head) do { \ + (head)->stqh_first = NULL; \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (0) + +#define STAILQ_FIRST(head) ((head)->stqh_first) + +#define STAILQ_LAST(head, type, field) \ + (STAILQ_EMPTY(head) ? \ + NULL : \ + ((struct type *) \ + ((char *)((head)->stqh_last) - __offsetof(struct type, field)))) + +#define STAILQ_FOREACH(var, head, field) \ + for((var) = (head)->stqh_first; (var); (var) = (var)->field.stqe_next) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (head)->stqh_first = (elm); \ +} while (0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.stqe_next = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &(elm)->field.stqe_next; \ +} while (0) + +#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ + if (((elm)->field.stqe_next = (tqelm)->field.stqe_next) == NULL)\ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (tqelm)->field.stqe_next = (elm); \ +} while (0) + +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if (((head)->stqh_first = \ + (head)->stqh_first->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (0) + +#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \ + if (((head)->stqh_first = (elm)->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (0) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if ((head)->stqh_first == (elm)) { \ + STAILQ_REMOVE_HEAD(head, field); \ + } \ + else { \ + struct type *curelm = (head)->stqh_first; \ + while( curelm->field.stqe_next != (elm) ) \ + curelm = curelm->field.stqe_next; \ + if((curelm->field.stqe_next = \ + curelm->field.stqe_next->field.stqe_next) == NULL) \ + (head)->stqh_last = &(curelm)->field.stqe_next; \ + } \ +} while (0) + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ + +#define LIST_EMPTY(head) ((head)->lh_first == NULL) + +#define LIST_FIRST(head) ((head)->lh_first) + +#define LIST_FOREACH(var, head, field) \ + for((var) = (head)->lh_first; (var); (var) = (var)->field.le_next) + +#define LIST_INIT(head) do { \ + (head)->lh_first = NULL; \ +} while (0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} while (0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + (elm)->field.le_next = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &(elm)->field.le_next; \ +} while (0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (0) + +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + +#define LIST_REMOVE(elm, field) do { \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ +} while (0) + +/* + * Tail queue definitions. + */ +#define TAILQ_HEAD(name, type) \ +struct name { \ + struct type *tqh_first; /* first element */ \ + struct type **tqh_last; /* addr of last next element */ \ +} + +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ +} + +/* + * Tail queue functions. + */ +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) + +#define TAILQ_FOREACH(var, head, field) \ + for (var = TAILQ_FIRST(head); var; var = TAILQ_NEXT(var, field)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = TAILQ_LAST((head), headname); \ + (var); \ + (var) = TAILQ_PREV((var), headname, field)) + +#define TAILQ_FIRST(head) ((head)->tqh_first) + +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) + +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (0) + +#define TAILQ_REMOVE(head, elm, field) do { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} while (0) + +/* + * Circular queue definitions. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) + +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) + +#define CIRCLEQ_FOREACH(var, head, field) \ + for((var) = (head)->cqh_first; \ + (var) != (void *)(head); \ + (var) = (var)->field.cqe_next) + +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for((var) = (head)->cqh_last; \ + (var) != (void *)(head); \ + (var) = (var)->field.cqe_prev) + +#define CIRCLEQ_INIT(head) do { \ + (head)->cqh_first = (void *)(head); \ + (head)->cqh_last = (void *)(head); \ +} while (0) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm)->field.cqe_next; \ + (elm)->field.cqe_prev = (listelm); \ + if ((listelm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (listelm)->field.cqe_next->field.cqe_prev = (elm); \ + (listelm)->field.cqe_next = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm); \ + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ + if ((listelm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (listelm)->field.cqe_prev->field.cqe_next = (elm); \ + (listelm)->field.cqe_prev = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.cqe_next = (head)->cqh_first; \ + (elm)->field.cqe_prev = (void *)(head); \ + if ((head)->cqh_last == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (head)->cqh_first->field.cqe_prev = (elm); \ + (head)->cqh_first = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.cqe_next = (void *)(head); \ + (elm)->field.cqe_prev = (head)->cqh_last; \ + if ((head)->cqh_first == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (head)->cqh_last->field.cqe_next = (elm); \ + (head)->cqh_last = (elm); \ +} while (0) + +#define CIRCLEQ_LAST(head) ((head)->cqh_last) + +#define CIRCLEQ_NEXT(elm,field) ((elm)->field.cqe_next) + +#define CIRCLEQ_PREV(elm,field) ((elm)->field.cqe_prev) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + if ((elm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm)->field.cqe_prev; \ + else \ + (elm)->field.cqe_next->field.cqe_prev = \ + (elm)->field.cqe_prev; \ + if ((elm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm)->field.cqe_next; \ + else \ + (elm)->field.cqe_prev->field.cqe_next = \ + (elm)->field.cqe_next; \ +} while (0) + +#ifdef _KERNEL + +/* + * XXX insque() and remque() are an old way of handling certain queues. + * They bogusly assumes that all queue heads look alike. + */ + +struct quehead { + struct quehead *qh_link; + struct quehead *qh_rlink; +}; + +#ifdef __GNUC__ + +static __inline void +insque(void *a, void *b) +{ + struct quehead *element = a, *head = b; + + element->qh_link = head->qh_link; + element->qh_rlink = head; + head->qh_link = element; + element->qh_link->qh_rlink = element; +} + +static __inline void +remque(void *a) +{ + struct quehead *element = a; + + element->qh_link->qh_rlink = element->qh_rlink; + element->qh_rlink->qh_link = element->qh_link; + element->qh_rlink = 0; +} + +#else /* !__GNUC__ */ + +void insque __P((void *a, void *b)); +void remque __P((void *a)); + +#endif /* __GNUC__ */ + +#endif /* _KERNEL */ + +#endif /* !_SYS_QUEUE_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/sys/socket.h b/packages/net/bsd_tcpip/current/include/sys/socket.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/socket.h @@ -0,0 +1,483 @@ +//========================================================================== +// +// include/sys/socket.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)socket.h 8.4 (Berkeley) 2/21/94 + * $FreeBSD: src/sys/sys/socket.h,v 1.39.2.7 2001/07/03 11:02:01 ume Exp $ + */ + +#ifndef _SYS_SOCKET_H_ +#define _SYS_SOCKET_H_ + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Data types. + */ +#include + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ +#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */ +#define SO_ACCEPTFILTER 0x1000 /* there is an accept filter */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +/*efine SO_PRIVSTATE 0x1009 get/deny privileged state */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +struct accept_filter_arg { + char af_name[16]; + char af_arg[256-16]; +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_LOCAL 1 /* local to host (pipes, portals) */ +#define AF_UNIX AF_LOCAL /* backward compatibility */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* European computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ +#define AF_COIP 20 /* connection-oriented IP, aka ST II */ +#define AF_CNT 21 /* Computer Network Technology */ +#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ +#define AF_IPX 23 /* Novell Internet Protocol */ +#define AF_SIP 24 /* Simple Internet Protocol */ +#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ +#define AF_ISDN 26 /* Integrated Services Digital Network*/ +#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ +#define pseudo_AF_KEY 27 /* Internal key-management function */ +#define AF_INET6 28 /* IPv6 */ +#define AF_NATM 29 /* native ATM access */ +#define AF_ATM 30 /* ATM */ +#define pseudo_AF_HDRCMPLT 31 /* Used by BPF to not rewrite headers + * in interface output routine + */ +#define AF_NETGRAPH 32 /* Netgraph sockets */ + +#define AF_MAX 33 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + u_char sa_len; /* total length */ + sa_family_t sa_family; /* address family */ + char sa_data[30]; /* actually longer; address value */ +}; +#define SOCK_MAXADDRLEN 255 /* longest possible addresses */ + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + u_short sp_family; /* address family */ + u_short sp_protocol; /* protocol */ +}; + +/* + * RFC 2553: protocol-independent placeholder for socket addresses + */ +#define _SS_MAXSIZE 128 +#define _SS_ALIGNSIZE (sizeof(int64_t)) +#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) - sizeof(sa_family_t)) +#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) - sizeof(sa_family_t) - \ + _SS_PAD1SIZE - _SS_ALIGNSIZE) + +struct sockaddr_storage { + u_char ss_len; /* address length */ + sa_family_t ss_family; /* address family */ + char __ss_pad1[_SS_PAD1SIZE]; + int64_t __ss_align; /* force desired structure storage alignment */ + char __ss_pad2[_SS_PAD2SIZE]; +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_LOCAL AF_LOCAL +#define PF_UNIX PF_LOCAL /* backward compatibility */ +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ +#define PF_COIP AF_COIP +#define PF_CNT AF_CNT +#define PF_SIP AF_SIP +#define PF_IPX AF_IPX /* same format as AF_NS */ +#define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */ +#define PF_PIP pseudo_AF_PIP +#define PF_ISDN AF_ISDN +#define PF_KEY pseudo_AF_KEY +#define PF_INET6 AF_INET6 +#define PF_NATM AF_NATM +#define PF_ATM AF_ATM +#define PF_NETGRAPH AF_NETGRAPH + +#define PF_MAX AF_MAX + +#if 0 // sysctl() interface not supported +/* + * Definitions for network related sysctl, CTL_NET. + * + * Second level is protocol family. + * Third level is protocol number. + * + * Further levels are defined by the individual families below. + */ +#define NET_MAXID AF_MAX + +#define CTL_NET_NAMES { \ + { 0, 0 }, \ + { "unix", CTLTYPE_NODE }, \ + { "inet", CTLTYPE_NODE }, \ + { "implink", CTLTYPE_NODE }, \ + { "pup", CTLTYPE_NODE }, \ + { "chaos", CTLTYPE_NODE }, \ + { "xerox_ns", CTLTYPE_NODE }, \ + { "iso", CTLTYPE_NODE }, \ + { "emca", CTLTYPE_NODE }, \ + { "datakit", CTLTYPE_NODE }, \ + { "ccitt", CTLTYPE_NODE }, \ + { "ibm_sna", CTLTYPE_NODE }, \ + { "decnet", CTLTYPE_NODE }, \ + { "dec_dli", CTLTYPE_NODE }, \ + { "lat", CTLTYPE_NODE }, \ + { "hylink", CTLTYPE_NODE }, \ + { "appletalk", CTLTYPE_NODE }, \ + { "route", CTLTYPE_NODE }, \ + { "link_layer", CTLTYPE_NODE }, \ + { "xtp", CTLTYPE_NODE }, \ + { "coip", CTLTYPE_NODE }, \ + { "cnt", CTLTYPE_NODE }, \ + { "rtip", CTLTYPE_NODE }, \ + { "ipx", CTLTYPE_NODE }, \ + { "sip", CTLTYPE_NODE }, \ + { "pip", CTLTYPE_NODE }, \ + { "isdn", CTLTYPE_NODE }, \ + { "key", CTLTYPE_NODE }, \ + { "inet6", CTLTYPE_NODE }, \ + { "natm", CTLTYPE_NODE }, \ + { "atm", CTLTYPE_NODE }, \ + { "hdrcomplete", CTLTYPE_NODE }, \ + { "netgraph", CTLTYPE_NODE }, \ +} + +/* + * PF_ROUTE - Routing table + * + * Three additional levels are defined: + * Fourth: address family, 0 is wildcard + * Fifth: type of info, defined below + * Sixth: flag(s) to mask with for NET_RT_FLAGS + */ +#define NET_RT_DUMP 1 /* dump; may limit to a.f. */ +#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ +#define NET_RT_IFLIST 3 /* survey interface list */ +#define NET_RT_MAXID 4 + +#define CTL_NET_RT_NAMES { \ + { 0, 0 }, \ + { "dump", CTLTYPE_STRUCT }, \ + { "flags", CTLTYPE_STRUCT }, \ + { "iflist", CTLTYPE_STRUCT }, \ +} +#endif // sysctl() support + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 128 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +struct msghdr { + void *msg_name; /* optional address */ + socklen_t msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + void *msg_control; /* ancillary data, see below */ + socklen_t msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#define MSG_EOR 0x8 /* data completes record */ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ +#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ +#define MSG_EOF 0x100 /* data completes connection */ +#define MSG_COMPAT 0x8000 /* used in sendit() */ + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr { + socklen_t cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +/* followed by u_char cmsg_data[]; */ +}; + +/* + * While we may have more groups than this, the cmsgcred struct must + * be able to fit in an mbuf, and NGROUPS_MAX is too large to allow + * this. +*/ +#define CMGROUP_MAX 16 + +/* + * Credentials structure, used to verify the identity of a peer + * process that has sent us a message. This is allocated by the + * peer process but filled in by the kernel. This prevents the + * peer from lying about its identity. (Note that cmcred_groups[0] + * is the effective GID.) + */ +struct cmsgcred { + pid_t cmcred_pid; /* PID of sending process */ + uid_t cmcred_uid; /* real UID of sending process */ + uid_t cmcred_euid; /* effective UID of sending process */ + gid_t cmcred_gid; /* real GID of sending process */ + short cmcred_ngroups; /* number or groups */ + gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ +}; + +/* given pointer to struct cmsghdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((u_char *)(cmsg) + \ + _ALIGN(sizeof(struct cmsghdr))) + +/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((caddr_t)(cmsg) + _ALIGN((cmsg)->cmsg_len) + \ + _ALIGN(sizeof(struct cmsghdr)) > \ + (caddr_t)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((caddr_t)(cmsg) + _ALIGN((cmsg)->cmsg_len))) + +/* + * RFC 2292 requires to check msg_controllen, in case that the kernel returns + * an empty list for some reasons. + */ +#define CMSG_FIRSTHDR(mhdr) \ + ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ + (struct cmsghdr *)(mhdr)->msg_control : \ + (struct cmsghdr *)NULL) + +/* RFC 2292 additions */ + +#define CMSG_SPACE(l) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l)) +#define CMSG_LEN(l) (_ALIGN(sizeof(struct cmsghdr)) + (l)) + +#ifdef _KERNEL +#define CMSG_ALIGN(n) _ALIGN(n) +#endif + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of int) */ +#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */ +#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ + +/* + * 4.3 compat sockaddr, move to compat file later + */ +struct osockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * 4.3-compat message header (move to compat file later). + */ +struct omsghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +/* + * howto arguments for shutdown(2), specified by Posix.1g. + */ +#define SHUT_RD 0 /* shut down the reading side */ +#define SHUT_WR 1 /* shut down the writing side */ +#define SHUT_RDWR 2 /* shut down both sides */ + +/* + * sendfile(2) header/trailer struct + */ +struct sf_hdtr { + struct iovec *headers; /* pointer to an array of header struct iovec's */ + int hdr_cnt; /* number of header iovec's */ + struct iovec *trailers; /* pointer to an array of trailer struct iovec's */ + int trl_cnt; /* number of trailer iovec's */ +}; + +#ifndef _KERNEL + +#include + +__BEGIN_DECLS +int accept __P((int, struct sockaddr *, socklen_t *)); +int bind __P((int, const struct sockaddr *, socklen_t)); +int connect __P((int, const struct sockaddr *, socklen_t)); +int getpeername __P((int, struct sockaddr *, socklen_t *)); +int getsockname __P((int, struct sockaddr *, socklen_t *)); +int getsockopt __P((int, int, int, void *, socklen_t *)); +int listen __P((int, int)); +ssize_t recv __P((int, void *, size_t, int)); +ssize_t recvfrom __P((int, void *, size_t, int, struct sockaddr *, socklen_t *)); +ssize_t recvmsg __P((int, struct msghdr *, int)); +ssize_t send __P((int, const void *, size_t, int)); +ssize_t sendto __P((int, const void *, + size_t, int, const struct sockaddr *, socklen_t)); +ssize_t sendmsg __P((int, const struct msghdr *, int)); +int sendfile __P((int, int, off_t, size_t, struct sf_hdtr *, off_t *, int)); +int setsockopt __P((int, int, int, const void *, socklen_t)); +int shutdown __P((int, int)); +int socket __P((int, int, int)); +int socketpair __P((int, int, int, int *)); + +void pfctlinput __P((int, struct sockaddr *)); +__END_DECLS + +#endif /* !_KERNEL */ + +#endif /* !_SYS_SOCKET_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/sys/socketvar.h b/packages/net/bsd_tcpip/current/include/sys/socketvar.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/socketvar.h @@ -0,0 +1,434 @@ +//========================================================================== +// +// include/sys/socketvar.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/*- + * Copyright (c) 1982, 1986, 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 + * $FreeBSD: src/sys/sys/socketvar.h,v 1.46.2.6 2001/08/31 13:45:49 jlemon Exp $ + */ + +#ifndef _SYS_SOCKETVAR_H_ +#define _SYS_SOCKETVAR_H_ + +#include /* for TAILQ macros */ + +/* + * Kernel structure per socket. + * Contains send and receive buffer queues, + * handle on protocol and pointer to protocol + * private data and error information. + */ +typedef u_quad_t so_gen_t; + +struct accept_filter; + +struct socket { + struct vm_zone *so_zone; /* zone we were allocated from */ + short so_type; /* generic type, see socket.h */ + short so_options; /* from socket call, see socket.h */ + short so_linger; /* time to linger while closing */ + short so_state; /* internal state flags SS_*, below */ + caddr_t so_pcb; /* protocol control block */ + struct protosw *so_proto; /* protocol handle */ +/* + * Variables for connection queuing. + * Socket where accepts occur is so_head in all subsidiary sockets. + * If so_head is 0, socket is not related to an accept. + * For head socket so_incomp queues partially completed connections, + * while so_comp is a queue of connections ready to be accepted. + * If a connection is aborted and it has so_head set, then + * it has to be pulled out of either so_incomp or so_comp. + * We allow connections to queue up based on current queue lengths + * and limit on number of queued connections for this socket. + */ + struct socket *so_head; /* back pointer to accept socket */ + TAILQ_HEAD(, socket) so_incomp; /* queue of partial unaccepted connections */ + TAILQ_HEAD(, socket) so_comp; /* queue of complete unaccepted connections */ + TAILQ_ENTRY(socket) so_list; /* list of unaccepted connections */ + short so_qlen; /* number of unaccepted connections */ + short so_incqlen; /* number of unaccepted incomplete + connections */ + short so_qlimit; /* max number queued connections */ + short so_timeo; /* connection timeout */ + u_short so_error; /* error affecting connection */ + struct sigio *so_sigio; /* information for async I/O or + out of band data (SIGURG) */ + u_long so_oobmark; /* chars to oob mark */ + TAILQ_HEAD(, aiocblist) so_aiojobq; /* AIO ops waiting on socket */ +/* + * Variables for socket buffering. + */ + struct sockbuf { + u_long sb_cc; /* actual chars in buffer */ + u_long sb_hiwat; /* max actual char count */ + u_long sb_mbcnt; /* chars of mbufs used */ + u_long sb_mbmax; /* max chars of mbufs to use */ + long sb_lowat; /* low water mark */ + struct mbuf *sb_mb; /* the mbuf chain */ + struct selinfo sb_sel; /* process selecting read/write */ + short sb_flags; /* flags, see below */ + short sb_timeo; /* timeout for read/write */ + } so_rcv, so_snd; +#define SB_MAX (256*1024) /* default for max chars in sockbuf */ +#define SB_LOCK 0x01 /* lock on data queue */ +#define SB_WANT 0x02 /* someone is waiting to lock */ +#define SB_WAIT 0x04 /* someone is waiting for data/space */ +#define SB_SEL 0x08 /* someone is selecting */ +#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */ +#define SB_UPCALL 0x20 /* someone wants an upcall */ +#define SB_NOINTR 0x40 /* operations not interruptible */ +#define SB_AIO 0x80 /* AIO operations queued */ +#define SB_KNOTE 0x100 /* kernel note attached */ + + void (*so_upcall) __P((struct socket *, void *, int)); + void *so_upcallarg; + struct ucred *so_cred; /* user credentials */ + /* NB: generation count must not be first; easiest to make it last. */ + so_gen_t so_gencnt; /* generation count */ + void *so_emuldata; /* private data for emulators */ + struct so_accf { + struct accept_filter *so_accept_filter; + void *so_accept_filter_arg; /* saved filter args */ + char *so_accept_filter_str; /* saved user args */ + } *so_accf; +}; + +/* + * Socket state bits. + */ +#define SS_NOFDREF 0x0001 /* no file table ref any more */ +#define SS_ISCONNECTED 0x0002 /* socket connected to a peer */ +#define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */ +#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */ +#define SS_CANTSENDMORE 0x0010 /* can't send more data to peer */ +#define SS_CANTRCVMORE 0x0020 /* can't receive more data from peer */ +#define SS_RCVATMARK 0x0040 /* at mark on input */ + +#define SS_NBIO 0x0100 /* non-blocking ops */ +#define SS_ASYNC 0x0200 /* async i/o notify */ +#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */ + +#define SS_INCOMP 0x0800 /* unaccepted, incomplete connection */ +#define SS_COMP 0x1000 /* unaccepted, complete connection */ +#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */ + +/* + * Externalized form of struct socket used by the sysctl(3) interface. + */ +struct xsocket { + size_t xso_len; /* length of this structure */ + struct socket *xso_so; /* makes a convenient handle sometimes */ + short so_type; + short so_options; + short so_linger; + short so_state; + caddr_t so_pcb; /* another convenient handle */ + int xso_protocol; + int xso_family; + short so_qlen; + short so_incqlen; + short so_qlimit; + short so_timeo; + u_short so_error; + pid_t so_pgid; + u_long so_oobmark; + struct xsockbuf { + u_long sb_cc; + u_long sb_hiwat; + u_long sb_mbcnt; + u_long sb_mbmax; + long sb_lowat; + short sb_flags; + short sb_timeo; + } so_rcv, so_snd; + uid_t so_uid; /* XXX */ +}; + +/* + * Macros for sockets and socket buffering. + */ + +/* + * Do we need to notify the other side when I/O is possible? + */ +#define sb_notify(sb) (((sb)->sb_flags & (SB_WAIT | SB_SEL | SB_ASYNC | \ + SB_UPCALL | SB_AIO | SB_KNOTE)) != 0) + +/* + * How much space is there in a socket buffer (so->so_snd or so->so_rcv)? + * This is problematical if the fields are unsigned, as the space might + * still be negative (cc > hiwat or mbcnt > mbmax). Should detect + * overflow and return 0. Should use "lmin" but it doesn't exist now. + */ +#define sbspace(sb) \ + ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \ + (int)((sb)->sb_mbmax - (sb)->sb_mbcnt))) + +/* do we have to send all at once on a socket? */ +#define sosendallatonce(so) \ + ((so)->so_proto->pr_flags & PR_ATOMIC) + +/* can we read something from so? */ +#define soreadable(so) \ + ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \ + ((so)->so_state & SS_CANTRCVMORE) || \ + (so)->so_comp.tqh_first || (so)->so_error) + +/* can we write something to so? */ +#define sowriteable(so) \ + ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \ + (((so)->so_state&SS_ISCONNECTED) || \ + ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \ + ((so)->so_state & SS_CANTSENDMORE) || \ + (so)->so_error) + +/* adjust counters in sb reflecting allocation of m */ +#define sballoc(sb, m) { \ + (sb)->sb_cc += (m)->m_len; \ + (sb)->sb_mbcnt += MSIZE; \ + if ((m)->m_flags & M_EXT) \ + (sb)->sb_mbcnt += (m)->m_ext.ext_size; \ +} + +/* adjust counters in sb reflecting freeing of m */ +#define sbfree(sb, m) { \ + (sb)->sb_cc -= (m)->m_len; \ + (sb)->sb_mbcnt -= MSIZE; \ + if ((m)->m_flags & M_EXT) \ + (sb)->sb_mbcnt -= (m)->m_ext.ext_size; \ +} + +/* + * Set lock on sockbuf sb; sleep if lock is already held. + * Unless SB_NOINTR is set on sockbuf, sleep is interruptible. + * Returns error without lock if sleep is interrupted. + */ +#define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \ + (((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \ + ((sb)->sb_flags |= SB_LOCK), 0) + +/* release lock on sockbuf sb */ +#define sbunlock(sb) { \ + (sb)->sb_flags &= ~SB_LOCK; \ + if ((sb)->sb_flags & SB_WANT) { \ + (sb)->sb_flags &= ~SB_WANT; \ + wakeup((caddr_t)&(sb)->sb_flags); \ + } \ +} + +#define sorwakeup(so) do { \ + if (sb_notify(&(so)->so_rcv)) \ + sowakeup((so), &(so)->so_rcv); \ + } while (0) + +#define sowwakeup(so) do { \ + if (sb_notify(&(so)->so_snd)) \ + sowakeup((so), &(so)->so_snd); \ + } while (0) + +#ifdef _KERNEL + +/* + * Argument structure for sosetopt et seq. This is in the KERNEL + * section because it will never be visible to user code. + */ +enum sopt_dir { SOPT_GET, SOPT_SET }; +struct sockopt { + enum sopt_dir sopt_dir; /* is this a get or a set? */ + int sopt_level; /* second arg of [gs]etsockopt */ + int sopt_name; /* third arg of [gs]etsockopt */ + void *sopt_val; /* fourth arg of [gs]etsockopt */ + size_t sopt_valsize; /* (almost) fifth arg of [gs]etsockopt */ + struct proc *sopt_p; /* calling process or null if kernel */ +}; + +struct sf_buf { + SLIST_ENTRY(sf_buf) free_list; /* list of free buffer slots */ + int refcnt; /* reference count */ + struct vm_page *m; /* currently mapped page */ + vm_offset_t kva; /* va of mapping */ +}; + +struct accept_filter { + char accf_name[16]; + void (*accf_callback) + __P((struct socket *so, void *arg, int waitflag)); + void * (*accf_create) + __P((struct socket *so, char *arg)); + void (*accf_destroy) + __P((struct socket *so)); + SLIST_ENTRY(accept_filter) accf_next; /* next on the list */ +}; + +#ifdef MALLOC_DECLARE +MALLOC_DECLARE(M_PCB); +MALLOC_DECLARE(M_SONAME); +MALLOC_DECLARE(M_ACCF); +#endif + +extern int maxsockets; +extern u_long sb_max; +extern struct vm_zone *socket_zone; +extern so_gen_t so_gencnt; + +struct file; +struct filedesc; +struct mbuf; +struct sockaddr; +struct stat; +struct ucred; +struct uio; +struct knote; + +/* + * File operations on sockets. + */ +int soo_read __P((struct file *fp, struct uio *uio, struct ucred *cred, + int flags, struct proc *p)); +int soo_write __P((struct file *fp, struct uio *uio, struct ucred *cred, + int flags, struct proc *p)); +int soo_close __P((struct file *fp, struct proc *p)); +int soo_ioctl __P((struct file *fp, u_long cmd, caddr_t data, + struct proc *p)); +int soo_poll __P((struct file *fp, int events, struct ucred *cred, + struct proc *p)); +int soo_stat __P((struct file *fp, struct stat *ub, struct proc *p)); +int sokqfilter __P((struct file *fp, struct knote *kn)); + +/* + * From uipc_socket and friends + */ +struct sockaddr *dup_sockaddr __P((struct sockaddr *sa, int canwait)); +int holdsock __P((struct filedesc *fdp, int fdes, struct file **fpp)); +int sockargs __P((struct mbuf **mp, caddr_t buf, int buflen, int type)); +void sbappend __P((struct sockbuf *sb, struct mbuf *m)); +int sbappendaddr __P((struct sockbuf *sb, struct sockaddr *asa, + struct mbuf *m0, struct mbuf *control)); +int sbappendcontrol __P((struct sockbuf *sb, struct mbuf *m0, + struct mbuf *control)); +void sbappendrecord __P((struct sockbuf *sb, struct mbuf *m0)); +void sbcheck __P((struct sockbuf *sb)); +void sbcompress __P((struct sockbuf *sb, struct mbuf *m, struct mbuf *n)); +struct mbuf * + sbcreatecontrol __P((caddr_t p, int size, int type, int level)); +void sbdrop __P((struct sockbuf *sb, int len)); +void sbdroprecord __P((struct sockbuf *sb)); +void sbflush __P((struct sockbuf *sb)); +void sbinsertoob __P((struct sockbuf *sb, struct mbuf *m0)); +void sbrelease __P((struct sockbuf *sb, struct socket *so)); +int sbreserve __P((struct sockbuf *sb, u_long cc, struct socket *so, + struct proc *p)); +void sbtoxsockbuf __P((struct sockbuf *sb, struct xsockbuf *xsb)); +int sbwait __P((struct sockbuf *sb)); +int sb_lock __P((struct sockbuf *sb)); +int soabort __P((struct socket *so)); +int soaccept __P((struct socket *so, struct sockaddr **nam)); +struct socket *soalloc __P((int waitok)); +int sobind __P((struct socket *so, struct sockaddr *nam, struct proc *p)); +void socantrcvmore __P((struct socket *so)); +void socantsendmore __P((struct socket *so)); +int soclose __P((struct socket *so)); +int soconnect __P((struct socket *so, struct sockaddr *nam, struct proc *p)); +int soconnect2 __P((struct socket *so1, struct socket *so2)); +int socreate __P((int dom, struct socket **aso, int type, int proto, + struct proc *p)); +void sodealloc __P((struct socket *so)); +int sodisconnect __P((struct socket *so)); +void sofree __P((struct socket *so)); +int sogetopt __P((struct socket *so, struct sockopt *sopt)); +void sohasoutofband __P((struct socket *so)); +void soisconnected __P((struct socket *so)); +void soisconnecting __P((struct socket *so)); +void soisdisconnected __P((struct socket *so)); +void soisdisconnecting __P((struct socket *so)); +int solisten __P((struct socket *so, int backlog, struct proc *p)); +struct socket * + sodropablereq __P((struct socket *head)); +struct socket * + sonewconn __P((struct socket *head, int connstatus)); +struct socket * + sonewconn3 __P((struct socket *head, int connstatus, struct proc *p)); +int sooptcopyin __P((struct sockopt *sopt, void *buf, size_t len, + size_t minlen)); +int sooptcopyout __P((struct sockopt *sopt, void *buf, size_t len)); + +/* XXX; prepare mbuf for (__FreeBSD__ < 3) routines. */ +int soopt_getm __P((struct sockopt *sopt, struct mbuf **mp)); +int soopt_mcopyin __P((struct sockopt *sopt, struct mbuf *m)); +int soopt_mcopyout __P((struct sockopt *sopt, struct mbuf *m)); + +int sopoll __P((struct socket *so, int events, struct ucred *cred, + struct proc *p)); +int soreceive __P((struct socket *so, struct sockaddr **paddr, + struct uio *uio, struct mbuf **mp0, + struct mbuf **controlp, int *flagsp)); +int soreserve __P((struct socket *so, u_long sndcc, u_long rcvcc)); +void sorflush __P((struct socket *so)); +int sosend __P((struct socket *so, struct sockaddr *addr, struct uio *uio, + struct mbuf *top, struct mbuf *control, int flags, + struct proc *p)); +int sosetopt __P((struct socket *so, struct sockopt *sopt)); +int soshutdown __P((struct socket *so, int how)); +void sotoxsocket __P((struct socket *so, struct xsocket *xso)); +void sowakeup __P((struct socket *so, struct sockbuf *sb)); + +/* accept filter functions */ +int accept_filt_add __P((struct accept_filter *filt)); +int accept_filt_del __P((char *name)); +struct accept_filter * accept_filt_get __P((char *name)); +#ifdef ACCEPT_FILTER_MOD +int accept_filt_generic_mod_event __P((module_t mod, int event, void *data)); +SYSCTL_DECL(_net_inet_accf); +#endif /* ACCEPT_FILTER_MOD */ + +#endif /* _KERNEL */ + +#endif /* !_SYS_SOCKETVAR_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/sys/sockio.h b/packages/net/bsd_tcpip/current/include/sys/sockio.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/sockio.h @@ -0,0 +1,138 @@ +//========================================================================== +// +// include/sys/sockio.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)sockio.h 8.1 (Berkeley) 3/28/94 + * $FreeBSD: src/sys/sys/sockio.h,v 1.14.2.4 2001/07/24 19:10:19 brooks Exp $ + */ + +#ifndef _SYS_SOCKIO_H_ +#define _SYS_SOCKIO_H_ + +#include + +/* Socket ioctl's. */ +#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ +#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ +#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ +#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ + +#define SIOCADDRT _IOW('r', 10, struct ecos_rtentry) /* add route */ +#define SIOCDELRT _IOW('r', 11, struct ecos_rtentry) /* delete route */ +#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */ +#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */ + +#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ +#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */ +#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ +#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ +#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */ +#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ +#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ +#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ +#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */ +#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ +#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ +#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ +#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ +#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ +#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ +#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ +#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ +#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ +#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ +#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ + +#define SIOCALIFADDR _IOW('i', 27, struct if_laddrreq) /* add IF addr */ +#define SIOCGLIFADDR _IOWR('i', 28, struct if_laddrreq) /* get IF addr */ +#define SIOCDLIFADDR _IOW('i', 29, struct if_laddrreq) /* delete IF addr */ + +#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ +#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ +#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */ +#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */ +#define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */ +#define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */ +#define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */ +#define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get net media */ + +#define SIOCSIFPHYADDR _IOW('i', 70, struct ifaliasreq) /* set gif addres */ +#define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq) /* get gif psrc addr */ +#define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq) /* get gif pdst addr */ +#define SIOCDIFPHYADDR _IOW('i', 73, struct ifreq) /* delete gif addrs */ +#define SIOCSLIFPHYADDR _IOW('i', 74, struct if_laddrreq) /* set gif addrs */ +#define SIOCGLIFPHYADDR _IOWR('i', 75, struct if_laddrreq) /* get gif addrs */ + +#define SIOCSIFGENERIC _IOW('i', 57, struct ifreq) /* generic IF set op */ +#define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */ + +#define SIOCGIFSTATUS _IOWR('i', 59, struct ifstat) /* get IF status */ +#define SIOCSIFLLADDR _IOW('i', 60, struct ifreq) /* set link level addr */ + +#define SIOCIFCREATE _IOWR('i', 122, struct ifreq) /* create clone if */ +#define SIOCIFDESTROY _IOW('i', 121, struct ifreq) /* destroy clone if */ +#define SIOCIFGCLONERS _IOWR('i', 120, struct if_clonereq) /* get cloners */ + +#define FIONBIO _IOW('s', 80, int) /* set non-blocking I/O */ +#define FIOASYNC _IOW('s', 81, int) /* set async I/O */ +#define FIONREAD _IOR('s', 82, int) /* get number of avail chars */ + +#define SIOCGIFHWADDR _IOWR('i',100, struct ifreq) /* get MAC address */ +#define SIOCSIFHWADDR _IOW('i',101, struct ifreq) /* set MAC address */ +/* NB these two take a struct ifreq followed by the useful data */ +#define SIOCGIFSTATSUD _IOWR('i',102, struct ifreq) /* get uptodate if stats */ +#define SIOCGIFSTATS _IOWR('i',103, struct ifreq) /* get interface stats */ + +#endif /* !_SYS_SOCKIO_H_ */ diff --git a/packages/net/bsd_tcpip/current/include/sys/time.h b/packages/net/bsd_tcpip/current/include/sys/time.h new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/include/sys/time.h @@ -0,0 +1,263 @@ +//========================================================================== +// +// include/sys/time.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +//========================================================================== +// +// include/sys/time.h +// +// +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +/* $OpenBSD: time.h,v 1.9 1999/12/06 19:36:42 aaron Exp $ */ +/* $NetBSD: time.h,v 1.18 1996/04/23 10:29:33 mycroft Exp $ */ + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)time.h 8.2 (Berkeley) 7/10/94 + */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include +#include + +#if 0 //ndef __time_t_defined +typedef int time_t; +# define __time_t_defined +#endif + +#if 0 + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ +struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; + +#endif + +#if 0 +/* + * Structure defined by POSIX.1b to be like a timeval. + */ +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ +}; +#endif + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ + +/* Operations on timevals. */ +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec == (uvp)->tv_sec) ? \ + ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ + ((tvp)->tv_sec cmp (uvp)->tv_sec)) +#define timeradd(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \ + if ((vvp)->tv_usec >= 1000000) { \ + (vvp)->tv_sec++; \ + (vvp)->tv_usec -= 1000000; \ + } \ + } while (0) +#define timersub(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ + if ((vvp)->tv_usec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_usec += 1000000; \ + } \ + } while (0) + +/* Operations on timespecs. */ +#define timespecclear(tsp) (tsp)->tv_sec = (tsp)->tv_nsec = 0 +#define timespecisset(tsp) ((tsp)->tv_sec || (tsp)->tv_nsec) +#define timespeccmp(tsp, usp, cmp) \ + (((tsp)->tv_sec == (usp)->tv_sec) ? \ + ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \ + ((tsp)->tv_sec cmp (usp)->tv_sec)) +#define timespecadd(tsp, usp, vsp) \ + do { \ + (vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \ + (vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \ + if ((vsp)->tv_nsec >= 1000000000L) { \ + (vsp)->tv_sec++; \ + (vsp)->tv_nsec -= 1000000000L; \ + } \ + } while (0) +#define timespecsub(tsp, usp, vsp) \ + do { \ + (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \ + (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \ + if ((vsp)->tv_nsec < 0) { \ + (vsp)->tv_sec--; \ + (vsp)->tv_nsec += 1000000000L; \ + } \ + } while (0) + +/* + * Names of the interval timers, and structure + * defining a timer setting. + */ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; + +/* + * Getkerninfo clock information structure + */ +struct clockinfo { + int hz; /* clock frequency */ + int tick; /* micro-seconds per hz tick */ + int tickadj; /* clock skew rate for adjtime() */ + int stathz; /* statistics clock frequency */ + int profhz; /* profiling clock frequency */ +}; + +#define CLOCK_REALTIME 0 +#define CLOCK_VIRTUAL 1 +#define CLOCK_PROF 2 + +#define TIMER_RELTIME 0x0 /* relative timer */ +#ifndef TIMER_ABSTIME +#define TIMER_ABSTIME 0x1 /* absolute timer */ +#endif + +#if defined(_KERNEL) || defined(_STANDALONE) +int itimerfix __P((struct timeval *tv)); +int itimerdecr __P((struct itimerval *itp, int usec)); +void microtime __P((struct timeval *tv)); +void settime __P((struct timeval *tv)); +#else /* !_KERNEL */ + +#ifndef __ECOS +#include +#endif + +#if 0 //ndef _POSIX_SOURCE +#include + +__BEGIN_DECLS +int adjtime __P((const struct timeval *, struct timeval *)); +int clock_getres __P((clockid_t, struct timespec *)); +int clock_gettime __P((clockid_t, struct timespec *)); +int clock_settime __P((clockid_t, const struct timespec *)); +int futimes __P((int, const struct timeval *)); +int getitimer __P((int, struct itimerval *)); +int gettimeofday __P((struct timeval *, struct timezone *)); +int nanosleep __P((const struct timespec *, struct timespec *)); +int setitimer __P((int, const struct itimerval *, struct itimerval *)); +int settimeofday __P((const struct timeval *, const struct timezone *)); +int utimes __P((const char *, const struct timeval *)); +__END_DECLS +#endif /* !POSIX */ + +#endif /* !_KERNEL */ + +#endif /* !_SYS_TIME_H_ */ diff --git a/packages/net/bsd_tcpip/current/src/ecos/init.cxx b/packages/net/bsd_tcpip/current/src/ecos/init.cxx new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/ecos/init.cxx @@ -0,0 +1,70 @@ +//========================================================================== +// +// src/ecos/init.cxx +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +//========================================================================== +// +// ecos/init.cxx +// +// Networking package initializer class +// +//========================================================================== +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +// Network initialization + +#include +#include +#include + +#define NET_INIT CYGBLD_ATTRIB_INIT_AFTER(CYG_INIT_LIBC) + +// This is a dummy class just so we can execute the network package +// initialization at it's proper priority + +externC void cyg_net_init(void); + +class net_init_class { +public: + net_init_class(void) { + cyg_net_init(); + } +}; + +// And here's an instance of the class just to make the code run +static net_init_class _net_init NET_INIT; + +externC void +cyg_do_net_init(void) +{ +} diff --git a/packages/net/bsd_tcpip/current/src/ecos/support.c b/packages/net/bsd_tcpip/current/src/ecos/support.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/ecos/support.c @@ -0,0 +1,821 @@ +//========================================================================== +// +// src/ecos/support.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +//========================================================================== +// +// ecos/support.c +// +// eCos wrapper and support functions +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas, hmt +// Contributors: gthomas, hmt +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +// Support routines, etc., used by network code + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#if !CYGPKG_NET_DRIVER_FRAMEWORK // Interface +#error At least one network driver framework must be defined! +#else +#include + +// Define table boundaries +CYG_HAL_TABLE_BEGIN( __NETDEVTAB__, netdev ); +CYG_HAL_TABLE_END( __NETDEVTAB_END__, netdev ); +CYG_HAL_TABLE_BEGIN( __NET_INIT_TAB__, _Net_inits ); +CYG_HAL_TABLE_END( __NET_INIT_TAB_END__, _Net_inits ); +extern struct init_tab_entry __NET_INIT_TAB__[], __NET_INIT_TAB_END__; + +// Used for system-wide "ticks per second" +#undef ticks +int hz = 100; +int tick = 10000; // usec per "tick" +volatile struct timeval ktime; +int proc = 0; // unused +int proc0 = 0; // unused + +volatile struct timeval mono_time; + +// Low-level network debugging & logging +#ifdef CYGPKG_NET_FREEBSD_LOGGING +int cyg_net_log_mask = CYGPKG_NET_FREEBSD_LOGGING; +#endif + +#define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL +static char netint_stack[STACK_SIZE]; +static cyg_thread netint_thread_data; +static cyg_handle_t netint_thread_handle; + +cyg_flag_t netint_flags; +#define NETISR_ANY 0xFFFFFFFF // Any possible bit... + +extern void cyg_test_exit(void); // TEMP +void +cyg_panic(const char *msg, ...) +{ + cyg_uint32 old_ints; + CYG_FAIL( msg ); + HAL_DISABLE_INTERRUPTS(old_ints); + diag_printf("PANIC: %s\n", msg); + cyg_test_exit(); // FIXME +} + +#define NET_MEMPOOL_SIZE roundup(CYGPKG_NET_MEM_USAGE/4,MSIZE) +#define NET_MBUFS_SIZE roundup(CYGPKG_NET_MEM_USAGE/4,MSIZE) +#define NET_CLUSTERS_SIZE roundup(CYGPKG_NET_MEM_USAGE/2,MCLBYTES) + +static unsigned char net_mempool_area[NET_MEMPOOL_SIZE]; +static cyg_mempool_var net_mem_pool; +static cyg_handle_t net_mem; +static unsigned char net_mbufs_area[NET_MBUFS_SIZE]; +static cyg_mempool_fix net_mbufs_pool; +static cyg_handle_t net_mbufs; +static unsigned char net_clusters_area[NET_CLUSTERS_SIZE]; +static cyg_mempool_fix net_clusters_pool; +static cyg_handle_t net_clusters; +static char net_clusters_refcnt[(NET_CLUSTERS_SIZE/MCLBYTES)+1]; +int nmbclusters = (NET_CLUSTERS_SIZE/MCLBYTES); + +#ifdef CYGDBG_NET_TIMING_STATS +static struct net_stats stats_malloc, stats_free, + stats_memcpy, stats_memset, + stats_mbuf_alloc, stats_mbuf_free, stats_cluster_alloc; +extern struct net_stats stats_in_cksum; + +// Display a number of ticks as microseconds +// Note: for improved calculation significance, values are kept in ticks*1000 +static long rtc_resolution[] = CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION; +static long ns_per_system_clock; + +static void +show_ticks_in_us(cyg_uint32 ticks) +{ + long long ns; + ns_per_system_clock = 1000000/rtc_resolution[1]; + ns = (ns_per_system_clock * ((long long)ticks * 1000)) / + CYGNUM_KERNEL_COUNTERS_RTC_PERIOD; + ns += 5; // for rounding to .01us + diag_printf("%7d.%02d", (int)(ns/1000), (int)((ns%1000)/10)); +} + +void +show_net_stats(struct net_stats *stats, const char *title) +{ + int ave; + ave = stats->total_time / stats->count; + diag_printf("%s:\n", title); + diag_printf(" count: %6d", stats->count); + diag_printf(", min: "); + show_ticks_in_us(stats->min_time); + diag_printf(", max: "); + show_ticks_in_us(stats->max_time); + diag_printf(", total: "); + show_ticks_in_us(stats->total_time); + diag_printf(", ave: "); + show_ticks_in_us(ave); + diag_printf("\n"); + // Reset stats + memset(stats, 0, sizeof(*stats)); +} + +void +show_net_times(void) +{ + show_net_stats(&stats_malloc, "Net malloc"); + show_net_stats(&stats_free, "Net free"); + show_net_stats(&stats_mbuf_alloc, "Mbuf alloc"); + show_net_stats(&stats_mbuf_free, "Mbuf free"); + show_net_stats(&stats_cluster_alloc, "Cluster alloc"); + show_net_stats(&stats_in_cksum, "Checksum"); + show_net_stats(&stats_memcpy, "Net memcpy"); + show_net_stats(&stats_memset, "Net memset"); +} +#endif /* CYGDBG_NET_TIMING_STATS */ + +void * +cyg_net_malloc(u_long size, int type, int flags) +{ + void *res; + + log(LOG_MDEBUG, "Net malloc[%d] = ", size); + START_STATS(); + if (flags & M_NOWAIT) { + res = cyg_mempool_var_try_alloc(net_mem, size); + } else { + res = cyg_mempool_var_alloc(net_mem, size); + } + FINISH_STATS(stats_malloc); + log(LOG_MDEBUG, "%p\n", res); + return (res); +} + +void +cyg_net_free(caddr_t addr, int type) +{ + START_STATS(); + cyg_mempool_var_free(net_mem, addr); + FINISH_STATS(stats_free); +} + +void * +cyg_net_mbuf_alloc(int type, int flags) +{ + void *res; + + log(LOG_MDEBUG, "Alloc mbuf = "); + START_STATS(); + mbstat.m_mbufs++; + if (flags & M_NOWAIT) { + res = cyg_mempool_fix_try_alloc(net_mbufs); + } else { + res = cyg_mempool_fix_alloc(net_mbufs); + } + FINISH_STATS(stats_mbuf_alloc); + // Check that this nastiness works OK + CYG_ASSERT( dtom(res) == res, "dtom failed, base of mbuf" ); + CYG_ASSERT( dtom((char *)res + MSIZE/2) == res, "dtom failed, mid mbuf" ); + log(LOG_MDEBUG, "%p\n", res); + return (res); +} + +void +cyg_net_mbuf_free(caddr_t addr, int type) +{ + START_STATS(); + mbstat.m_mbufs--; + cyg_mempool_fix_free(net_mbufs, addr); + FINISH_STATS(stats_mbuf_free); +} + +void * +cyg_net_cluster_alloc(void) +{ + void *res; + log(LOG_MDEBUG, "Allocate cluster = "); + START_STATS(); + res = cyg_mempool_fix_try_alloc(net_clusters); + FINISH_STATS(stats_cluster_alloc); + log(LOG_MDEBUG, "%p\n", res); + return res; +} + +static struct vm_zone *vm_zones = (struct vm_zone *)NULL; + +vm_zone_t +zinit(char *name, int size, int nentries, int flags, int zalloc) +{ + void *res; + vm_zone_t zone = (vm_zone_t)0; + elem *p; + + log(LOG_MDEBUG, "zinit '%s', size: %d, num: %d, flags: %d, alloc: %d\n", + name, size, nentries, flags, zalloc); + res = cyg_mempool_var_try_alloc(net_mem, sizeof(struct vm_zone)); + if (res) { + zone = (vm_zone_t)res; + res = cyg_mempool_var_try_alloc(net_mem, size*nentries); + } + if (!res) { + log(LOG_MDEBUG, "Can't allocate memory for %s\n", name); + panic("zinit: Out of memory\n"); + } + p = (elem *)res; + zone->pool = (elem *)0; + zone->elem_size = size; + zone->name = name; + zone->free = zone->total = nentries; + zone->next = vm_zones; + zone->alloc_tries = zone->alloc_fails = zone->alloc_frees = 0; + vm_zones = zone; + while (nentries-- > 0) { + p->next = zone->pool; + zone->pool = p; + p = (elem *)((char *)p + size); + } + p = zone->pool; +#if 0 + while (p) { + log(LOG_MDEBUG, "p: %p, next: %p\n", p, p->next); + p = p->next; + } +#endif + return zone; +} + +void * +zalloci(vm_zone_t zone) +{ + elem *p; + + p = zone->pool; + zone->alloc_tries++; + if (p) { + zone->pool = p->next; + zone->free--; + } else { + zone->alloc_fails++; + } + log(LOG_MDEBUG, "zalloci from %s => %p\n", zone->name, p); + return (void *)p; +} + +void +zfreei(vm_zone_t zone, void *item) +{ + elem *p = (elem *)item; + + log(LOG_MDEBUG, "zfreei to %s <= %p\n", zone->name, p); + p->next = zone->pool; + zone->pool = p; + zone->free++; + zone->alloc_frees++; +} + +static void +cyg_kmem_init(void) +{ + unsigned char *p; +#ifdef CYGPKG_NET_DEBUG + diag_printf("Network stack using %d bytes for misc space\n", NET_MEMPOOL_SIZE); + diag_printf(" %d bytes for mbufs\n", NET_MBUFS_SIZE); + diag_printf(" %d bytes for mbuf clusters\n", NET_CLUSTERS_SIZE); +#endif + cyg_mempool_var_create(&net_mempool_area, + NET_MEMPOOL_SIZE, + &net_mem, + &net_mem_pool); + // Align the mbufs on MSIZE boudaries so that dtom() can work. + p = (unsigned char *)(((long)(&net_mbufs_area) + MSIZE - 1) & ~(MSIZE-1)); + cyg_mempool_fix_create(p, + ((&(net_mbufs_area[NET_MBUFS_SIZE])) - p) & ~(MSIZE-1), + MSIZE, + &net_mbufs, + &net_mbufs_pool); + cyg_mempool_fix_create(&net_clusters_area, + NET_CLUSTERS_SIZE, + MCLBYTES, + &net_clusters, + &net_clusters_pool); + mbutl = (struct mbuf *)&net_clusters_area; + mclrefcnt = net_clusters_refcnt; +} + +void cyg_kmem_print_stats( void ) +{ + cyg_mempool_info info; + struct vm_zone *zone; + + diag_printf( "Network stack mbuf stats:\n" ); + diag_printf( " mbufs %d, clusters %d, free clusters %d\n", + mbstat.m_mbufs, /* mbufs obtained from page pool */ + mbstat.m_clusters, /* clusters obtained from page pool */ + /* mbstat.m_spare, */ /* spare field */ + mbstat.m_clfree /* free clusters */ + ); + diag_printf( " Failed to get %d times\n" + " Waited to get %d times\n" + " Drained queues to get %d times\n", + mbstat.m_drops, /* times failed to find space */ + mbstat.m_wait, /* times waited for space */ + mbstat.m_drain /* times drained protocols for space */ + /* mbstat.m_mtypes[256]; type specific mbuf allocations */ + ); + + zone = vm_zones; + while (zone) { + diag_printf("VM zone '%s':\n", zone->name); + diag_printf(" Total: %d, Free: %d, Allocs: %d, Frees: %d, Fails: %d\n", + zone->total, zone->free, + zone->alloc_tries, zone->alloc_frees, zone->alloc_fails); + zone = zone->next; + } + + cyg_mempool_var_get_info( net_mem, &info ); + diag_printf( "Misc mpool: total %7d, free %7d, max free block %d\n", + info.totalmem, + info.freemem, + info.maxfree + ); + + cyg_mempool_fix_get_info( net_mbufs, &info ); + diag_printf( "Mbufs pool: total %7d, free %7d, blocksize %4d\n", + info.totalmem, + info.freemem, + info.blocksize + ); + + + cyg_mempool_fix_get_info( net_clusters, &info ); + diag_printf( "Clust pool: total %7d, free %7d, blocksize %4d\n", + info.totalmem, + info.freemem, + info.blocksize + ); +} + +// This API is for our own automated network tests. It's not in any header +// files because it's not at all supported. +int cyg_net_get_mem_stats( int which, cyg_mempool_info *p ) +{ + CYG_CHECK_DATA_PTR( p, "Bad pointer to mempool_info" ); + CYG_ASSERT( 0 <= which, "Mempool selector underflow" ); + CYG_ASSERT( 2 >=which, "Mempool selector overflow" ); + + if ( p ) + switch ( which ) { + case 0: + cyg_mempool_var_get_info( net_mem, p ); + break; + case 1: + cyg_mempool_fix_get_info( net_mbufs, p ); + break; + case 2: + cyg_mempool_fix_get_info( net_clusters, p ); + break; + default: + return 0; + } + return (int)p; +} + +int +cyg_mtocl(u_long x) +{ + int res; + res = (((u_long)(x) - (u_long)mbutl) >> MCLSHIFT); + return res; +} + +struct mbuf * +cyg_cltom(u_long x) +{ + struct mbuf *res; + res = (struct mbuf *)((caddr_t)((u_long)mbutl + ((u_long)(x) << MCLSHIFT))); + return res; +} + +externC void +net_memcpy(void *d, void *s, int n) +{ + START_STATS(); + memcpy(d, s, n); + FINISH_STATS(stats_memcpy); +} + +externC void +net_memset(void *s, int v, int n) +{ + START_STATS(); + memset(s, v, n); + FINISH_STATS(stats_memset); +} + +// Rather than bring in the whole BSD 'random' code... +int +arc4random(void) +{ + cyg_uint32 res; + static unsigned long seed = 0xDEADB00B; + HAL_CLOCK_READ(&res); // Not so bad... (but often 0..N where N is small) + seed = ((seed & 0x007F00FF) << 7) ^ + ((seed & 0x0F80FF00) >> 8) ^ // be sure to stir those low bits + (res << 13) ^ (res >> 9); // using the clock too! + return (int)seed; +} + +void +get_random_bytes(void *buf, size_t len) +{ + unsigned long ranbuf, *lp; + lp = (unsigned long *)buf; + while (len > 0) { + ranbuf = arc4random(); + *lp++ = ranbuf; + len -= sizeof(ranbuf); + } +} + +void +read_random_unlimited(void *buf, size_t len) +{ + get_random_bytes(buf, len); +} + +void +microtime(struct timeval *tp) +{ + *tp = ktime; + log(LOG_DEBUG, "%s: = %d.%d\n", __FUNCTION__, tp->tv_sec, tp->tv_usec); + ktime.tv_usec++; // In case clock isn't running yet +} + +void +getmicrotime(struct timeval *tp) +{ + *tp = ktime; + log(LOG_DEBUG, "%s: = %d.%d\n", __FUNCTION__, tp->tv_sec, tp->tv_usec); + ktime.tv_usec++; // In case clock isn't running yet +} + +void +getmicrouptime(struct timeval *tp) +{ + *tp = ktime; + log(LOG_DEBUG, "%s: = %d.%d\n", __FUNCTION__, tp->tv_sec, tp->tv_usec); + ktime.tv_usec++; // In case clock isn't running yet +} + +// Taken from kern/kern_clock.c +/* + * Compute number of ticks in the specified amount of time. + */ +#ifndef LONG_MAX +#define LONG_MAX 0x7FFFFFFF +#endif +int +tvtohz(struct timeval *tv) +{ + register unsigned long ticks; + register long sec, usec; + + /* + * If the number of usecs in the whole seconds part of the time + * difference fits in a long, then the total number of usecs will + * fit in an unsigned long. Compute the total and convert it to + * ticks, rounding up and adding 1 to allow for the current tick + * to expire. Rounding also depends on unsigned long arithmetic + * to avoid overflow. + * + * Otherwise, if the number of ticks in the whole seconds part of + * the time difference fits in a long, then convert the parts to + * ticks separately and add, using similar rounding methods and + * overflow avoidance. This method would work in the previous + * case but it is slightly slower and assumes that hz is integral. + * + * Otherwise, round the time difference down to the maximum + * representable value. + * + * If ints have 32 bits, then the maximum value for any timeout in + * 10ms ticks is 248 days. + */ + sec = tv->tv_sec; + usec = tv->tv_usec; + if (usec < 0) { + sec--; + usec += 1000000; + } + if (sec < 0) { +#ifdef DIAGNOSTIC + if (usec > 0) { + sec++; + usec -= 1000000; + } + printf("tvotohz: negative time difference %ld sec %ld usec\n", + sec, usec); +#endif + ticks = 1; + } else if (sec <= LONG_MAX / 1000000) + ticks = (sec * 1000000 + (unsigned long)usec + (tick - 1)) + / tick + 1; + else if (sec <= LONG_MAX / hz) + ticks = sec * hz + + ((unsigned long)usec + (tick - 1)) / tick + 1; + else + ticks = LONG_MAX; + if (ticks > INT_MAX) + ticks = INT_MAX; + return ((int)ticks); +} + +void +get_mono_time(void) +{ + panic("get_mono_time"); +} + +void +csignal(pid_t pgid, int signum, uid_t uid, uid_t euid) +{ + panic("csignal"); +} + +int +bcmp(const void *_p1, const void *_p2, size_t len) +{ + int res = 0; + unsigned char *p1 = (unsigned char *)_p1; + unsigned char *p2 = (unsigned char *)_p2; + while (len-- > 0) { + res = *p1++ - *p2++; + if (res) break; + } + return res; +} + +int +copyout(const void *s, void *d, size_t len) +{ + memcpy(d, s, len); + return 0; +} + +int +copyin(const void *s, void *d, size_t len) +{ + memcpy(d, s, len); + return 0; +} + +void +ovbcopy(const void *s, void *d, size_t len) +{ + memcpy(d, s, len); +} + + +// ------------------------------------------------------------------------ +// THE NETWORK THREAD ITSELF +// +// Network software interrupt handler +// This function is run as a separate thread to allow +// processing of network events (mostly incoming packets) +// at "user level" instead of at interrupt time. +// +// The actual handlers are 'registered' at system startup +// + +// The set of handlers +static netisr_t *_netisr_handlers[NETISR_MAX+1]; +struct ifqueue ipintrq; +#ifdef INET6 +struct ifqueue ip6intrq; +#endif +char *hostname = "eCos_node"; + +// Register a 'netisr' handler for a given level +int +register_netisr(int level, netisr_t *fun) +{ + CYG_ASSERT(level <= NETISR_MAX, "invalid netisr level"); + CYG_ASSERT(_netisr_handlers[level] == 0, "re-registered netisr"); + _netisr_handlers[level] = fun; + return 0; // ignored +} + +//int unregister_netisr __P((int)); + +static void +cyg_netint(cyg_addrword_t param) +{ + cyg_flag_value_t curisr; + int lvl, spl; + + while (true) { + curisr = cyg_flag_wait(&netint_flags, NETISR_ANY, + CYG_FLAG_WAITMODE_OR|CYG_FLAG_WAITMODE_CLR); + spl = splsoftnet(); // Prevent any overlapping "stack" processing + for (lvl = NETISR_MIN; lvl <= NETISR_MAX; lvl++) { + if (curisr & (1<name); + if (t->init(t)) { + t->status = CYG_NETDEVTAB_STATUS_AVAIL; + } else { + // What to do if device init fails? + t->status = 0; // Device not [currently] available + } + } +#if 0 // Bridge code not available yet +#if NBRIDGE > 0 + bridgeattach(0); +#endif +#endif +} +SYSINIT(devs, SI_SUB_DEVICES, SI_ORDER_FIRST, cyg_net_init_devs, NULL) + +void +cyg_net_init(void) +{ + static int _init = false; + struct init_tab_entry *init_entry; + + if (_init) return; + + cyg_do_net_init(); // Just forces linking in the initializer/constructor + // Initialize interrupt "flags" + cyg_flag_init(&netint_flags); + // Initialize timeouts and net service thread (pseudo-DSRs) + cyg_alarm_timeout_init(); + // Initialize tsleep/wakeup support + cyg_tsleep_init(); + // Initialize network memory system + cyg_kmem_init(); + // Initialize network time + cyg_ktime_init(); + // Create network background thread + cyg_thread_create(CYGPKG_NET_THREAD_PRIORITY, // Priority + cyg_netint, // entry + 0, // entry parameter + "Network support", // Name + &netint_stack[0], // Stack + STACK_SIZE, // Size + &netint_thread_handle, // Handle + &netint_thread_data // Thread data structure + ); + cyg_thread_resume(netint_thread_handle); // Start it + + // Run through dynamic initializers + for (init_entry = __NET_INIT_TAB__; init_entry != &__NET_INIT_TAB_END__; init_entry++) { + log(LOG_INIT, "[%s] Init: %s(%p)\n", __FUNCTION__, init_entry->name, init_entry->data); + (*init_entry->fun)(init_entry->data); + } + log(LOG_INIT, "[%s] Done\n", __FUNCTION__); + + // Done + _init = true; +} + +#endif // CYGPKG_NET_DRIVER_FRAMEWORK + +// EOF support.c diff --git a/packages/net/bsd_tcpip/current/src/ecos/synch.c b/packages/net/bsd_tcpip/current/src/ecos/synch.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/ecos/synch.c @@ -0,0 +1,421 @@ +//========================================================================== +// +// src/ecos/synch.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +//========================================================================== +// +// ecos/synch.c +// +// eCos wrapper and synch functions +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas, hmt +// Contributors: gthomas, hmt +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +// Synch routines, etc., used by network code + +#include +#include + +#include +#include +#include + +#include + +//---------------------------- splx() emulation ------------------------------ +// This contains both the SPLX stuff and tsleep/wakeup - because those must +// be SPLX aware. They release the SPLX lock when sleeping, and reclaim it +// (if needs be) at wakeup. +// +// The variable spl_state (and the associated bit patterns) is used to keep +// track of the "splx()" level. This is an artifact of the original stack, +// based on the BSD interrupt world (interrupts and processing could be +// masked based on a level value, supported by hardware). This is not very +// real-time, so the emulation uses proper eCos tools and techniques to +// accomplish the same result. The key here is in the analysis of the +// various "levels", why they are used, etc. +// +// SPL_IMP is called in order to protect internal data structures +// short-term, primarily so that interrupt processing does not interfere +// with them. +// +// SPL_CLOCK is called in order to ensure that a timestamp is valid i.e. no +// time passes while the stamp is being taken (since it is a potentially +// non-idempotent data structure). +// +// SPL_SOFTNET is used to prevent all other stack processing, including +// interrupts (DSRs), etc. +// +// SPL_INTERNAL is used when running the pseudo-DSR in timeout.c - this +// runs what should really be the network interface device's DSR, and any +// timeout routines that are scheduled. (They are broken out into a thread +// to isolate the network locking from the rest of the system) +// +// NB a thread in thi state can tsleep(); see below. Tsleep releases and +// reclaims the locks and so on. This necessary because of the possible +// conflict where +// I splsoft +// I tsleep +// He runs, he is lower priority +// He splsofts +// He or something else awakens me +// I want to run, but he has splsoft, so I wait +// He runs and releases splsoft +// I awaken and go. + +static volatile cyg_uint32 spl_state = 0; +#define SPL_IMP 0x01 +#define SPL_NET 0x02 +#define SPL_CLOCK 0x04 +#define SPL_SOFTNET 0x08 +#define SPL_INTERNAL 0x10 + +static cyg_mutex_t splx_mutex; +static volatile cyg_handle_t splx_thread; + + +#ifdef CYGIMPL_TRACE_SPLX +#define SPLXARGS const char *file, const int line +#define SPLXMOREARGS , const char *file, const int line +#define SPLXTRACE do_sched_event(__FUNCTION__, file, line, spl_state) +#else +#define SPLXARGS void +#define SPLXMOREARGS +#define SPLXTRACE +#endif + + +static inline cyg_uint32 +spl_any( cyg_uint32 which ) +{ + cyg_uint32 old_spl = spl_state; + if ( cyg_thread_self() != splx_thread ) { + cyg_mutex_lock( &splx_mutex ); + old_spl = 0; // Free when we unlock this context + CYG_ASSERT( 0 == splx_thread, "Thread still owned" ); + CYG_ASSERT( 0 == spl_state, "spl still set" ); + splx_thread = cyg_thread_self(); + } + CYG_ASSERT( splx_mutex.locked, "spl_any: mutex not locked" ); + CYG_ASSERT( (cyg_handle_t)splx_mutex.owner == cyg_thread_self(), + "spl_any: mutex not mine" ); + spl_state |= which; + return old_spl; +} + + +cyg_uint32 +cyg_splimp(SPLXARGS) +{ + SPLXTRACE; + return spl_any( SPL_IMP ); +} + +cyg_uint32 +cyg_splclock(SPLXARGS) +{ + SPLXTRACE; + return spl_any( SPL_CLOCK ); +} + +cyg_uint32 +cyg_splnet(SPLXARGS) +{ + SPLXTRACE; + return spl_any( SPL_NET ); +} + +cyg_uint32 +cyg_splhigh(SPLXARGS) +{ + SPLXTRACE; + // splhigh did SPLSOFTNET in the contrib, so this is the same + return spl_any( SPL_SOFTNET ); +} + +cyg_uint32 +cyg_splsoftnet(SPLXARGS) +{ + SPLXTRACE; + return spl_any( SPL_SOFTNET ); +} + +cyg_uint32 +cyg_splinternal(SPLXARGS) +{ + SPLXTRACE; + return spl_any( SPL_INTERNAL ); +} + + +// +// Return to a previous interrupt state/level. +// +void +cyg_splx(cyg_uint32 old_state SPLXMOREARGS) +{ + SPLXTRACE; + + CYG_ASSERT( 0 != spl_state, "No state set" ); + CYG_ASSERT( splx_mutex.locked, "splx: mutex not locked" ); + CYG_ASSERT( (cyg_handle_t)splx_mutex.owner == cyg_thread_self(), + "splx: mutex not mine" ); + + spl_state &= old_state; + + if ( 0 == spl_state ) { + splx_thread = 0; + cyg_mutex_unlock( &splx_mutex ); + } +} + +//------------------ tsleep() and wakeup() emulation --------------------------- +// +// Structure used to keep track of 'tsleep' style events +// +struct wakeup_event { + void *chan; + cyg_sem_t sem; +}; +static struct wakeup_event wakeup_list[CYGPKG_NET_NUM_WAKEUP_EVENTS]; + + +// Called to initialize structures used by timeout functions +void +cyg_tsleep_init(void) +{ + int i; + struct wakeup_event *ev; + // Create list of "wakeup event" semaphores + for (i = 0, ev = wakeup_list; i < CYGPKG_NET_NUM_WAKEUP_EVENTS; i++, ev++) { + ev->chan = 0; + cyg_semaphore_init(&ev->sem, 0); + } + // Initialize the mutex and thread id: + cyg_mutex_init( &splx_mutex ); + splx_thread = 0; +} + + +// +// Signal an event +void +cyg_wakeup(void *chan) +{ + int i; + struct wakeup_event *ev; + cyg_scheduler_lock(); // Ensure scan is safe + // NB this is broadcast semantics because a sleeper/wakee holds the + // slot until they exit. This avoids a race condition whereby the + // semaphore can get an extra post - and then the slot is freed, so the + // sem wait returns immediately, AOK, so the slot wasn't freed. + for (i = 0, ev = wakeup_list; i < CYGPKG_NET_NUM_WAKEUP_EVENTS; i++, ev++) + if (ev->chan == chan) + cyg_semaphore_post(&ev->sem); + + cyg_scheduler_unlock(); +} + +// ------------------------------------------------------------------------ +// Wait for an event with timeout +// tsleep(event, priority, state, timeout) +// event - the thing to wait for +// priority - unused +// state - a descriptive message +// timeout - max time (in ticks) to wait +// returns: +// 0 - event was "signalled" +// ETIMEDOUT - timeout occurred +// EINTR - thread broken out of sleep +// +int +cyg_tsleep(void *chan, int pri, char *wmesg, int timo) +{ + int i, res = 0; + struct wakeup_event *ev; + cyg_tick_count_t sleep_time; + cyg_handle_t self = cyg_thread_self(); + int old_splflags = 0; // no flags held + + cyg_scheduler_lock(); + + // Safely find a free slot: + for (i = 0, ev = wakeup_list; i < CYGPKG_NET_NUM_WAKEUP_EVENTS; i++, ev++) { + if (ev->chan == 0) { + ev->chan = chan; + break; + } + } + CYG_ASSERT( i < CYGPKG_NET_NUM_WAKEUP_EVENTS, "no sleep slots" ); + CYG_ASSERT( 1 == cyg_scheduler_read_lock(), + "Tsleep - called with scheduler locked" ); + // Defensive: + if ( i >= CYGPKG_NET_NUM_WAKEUP_EVENTS ) { + cyg_scheduler_unlock(); + return ETIMEDOUT; + } + + // If we are the owner, then we must release the mutex when + // we wait. + if ( self == splx_thread ) { + old_splflags = spl_state; // Keep them for restoration + CYG_ASSERT( spl_state, "spl_state not set" ); + // Also want to assert that the mutex is locked... + CYG_ASSERT( splx_mutex.locked, "Splx mutex not locked" ); + CYG_ASSERT( (cyg_handle_t)splx_mutex.owner == self, "Splx mutex not mine" ); + splx_thread = 0; + spl_state = 0; + cyg_mutex_unlock( &splx_mutex ); + } + + // Re-initialize the semaphore - it might have counted up arbitrarily + // in the time between a prior sleeper being signalled and them + // actually running. + cyg_semaphore_init(&ev->sem, 0); + + // This part actually does the wait: + // As of the new kernel, we can do this without unlocking the scheduler + if (timo) { + sleep_time = cyg_current_time() + timo; + if (!cyg_semaphore_timed_wait(&ev->sem, sleep_time)) { + if( cyg_current_time() >= sleep_time ) + res = ETIMEDOUT; + else + res = EINTR; + } + } else { + if (!cyg_semaphore_wait(&ev->sem) ) { + res = EINTR; + } + } + + ev->chan = 0; // Free the slot - the wakeup call cannot do this. + + if ( old_splflags ) { // restore to previous state + // As of the new kernel, we can do this with the scheduler locked + cyg_mutex_lock( &splx_mutex ); // this might wait + CYG_ASSERT( 0 == splx_thread, "Splx thread set in tsleep" ); + CYG_ASSERT( 0 == spl_state, "spl_state set in tsleep" ); + splx_thread = self; // got it now... + spl_state = old_splflags; + } + + cyg_scheduler_unlock(); + return res; +} + + + +// ------------------------------------------------------------------------ +// DEBUGGING ROUTINES +#ifdef CYGIMPL_TRACE_SPLX +#undef cyg_scheduler_lock +#undef cyg_scheduler_safe_lock +#undef cyg_scheduler_unlock + +#define MAX_SCHED_EVENTS 256 +static struct _sched_event { + char *fun, *file; + int line, lock; +} sched_event[MAX_SCHED_EVENTS]; +static int next_sched_event = 0; +static int total_sched_events = 0; + +static void +do_sched_event(char *fun, char *file, int line, int lock) +{ + struct _sched_event *se = &sched_event[next_sched_event]; + if (++next_sched_event == MAX_SCHED_EVENTS) { + next_sched_event = 0; + } + se->fun = fun; + se->file = file; + se->line = line; + se->lock = lock; + total_sched_events++; +} + +static void +show_sched_events(void) +{ + int i; + struct _sched_event *se; + if (total_sched_events < MAX_SCHED_EVENTS) { + i = 0; + } else { + i = next_sched_event + 1; + if (i == MAX_SCHED_EVENTS) i = 0; + } + diag_printf("%d total scheduler events\n", total_sched_events); + while (i != next_sched_event) { + se = &sched_event[i]; + diag_printf("%s - lock: %d, called from %s.%d\n", se->fun, se->lock, se->file, se->line); + if (++i == MAX_SCHED_EVENTS) i = 0; + } +} + +#define SPLX_TRACE_DATA() cyg_scheduler_read_lock() + +void +_cyg_scheduler_lock(char *file, int line) +{ + cyg_scheduler_lock(); + do_sched_event(__FUNCTION__, file, line, SPLX_TRACE_DATA()); +} + +void +_cyg_scheduler_safe_lock(char *file, int line) +{ + cyg_scheduler_safe_lock(); + do_sched_event(__FUNCTION__, file, line, SPLX_TRACE_DATA()); +} + +void +_cyg_scheduler_unlock(char *file, int line) +{ + cyg_scheduler_unlock(); + do_sched_event(__FUNCTION__, file, line, SPLX_TRACE_DATA()); +} +#endif // CYGIMPL_TRACE_SPLX + +// EOF synch.c diff --git a/packages/net/bsd_tcpip/current/src/ecos/timeout.c b/packages/net/bsd_tcpip/current/src/ecos/timeout.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/ecos/timeout.c @@ -0,0 +1,463 @@ +//========================================================================== +// +// src/ecos/timeout.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +//========================================================================== +// +// lib/timeout.c +// +// timeout support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas, hmt +// Contributors: gthomas, hmt +// Date: 1999-02-05 +// Description: Simple timeout functions +//####DESCRIPTIONEND#### + +#include +#include +#include +#include + +// Timeout support + +void alarm_timeout_init(void); + +#ifndef NTIMEOUTS +#define NTIMEOUTS 8 +#endif +static timeout_entry _timeouts[NTIMEOUTS]; +static timeout_entry *timeouts = (timeout_entry *)NULL; +static cyg_handle_t timeout_alarm_handle; +static cyg_alarm timeout_alarm; +static cyg_int32 last_delta; +static cyg_tick_count_t last_set_time; + +#define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL +static char alarm_stack[STACK_SIZE]; +static cyg_thread alarm_thread_data; +static cyg_handle_t alarm_thread_handle; + +static cyg_flag_t alarm_flag; + +// ------------------------------------------------------------------------ +// This routine exists so that this module can synchronize: +extern cyg_uint32 cyg_splinternal(void); + +#ifdef TIMEOUT_DEBUG +static void +_show_timeouts(void) +{ + timeout_entry *f; + for (f = timeouts; f; f = f->next) { + diag_printf("%p: delta: %d, fun: %p, param: %p\n", f, f->delta, f->fun, f->arg); + } +} +#endif // TIMEOUT_DEBUG + +// ------------------------------------------------------------------------ +// CALLBACK FUNCTION +// Called from the thread, this runs the alarm callbacks. +// Locking is already in place when this is called. +static void +do_timeout(void) +{ + cyg_int32 min_delta; + timeout_entry *e, *e_next; + + CYG_ASSERT( 0 < last_delta, "last_delta underflow" ); + + min_delta = last_delta; // local copy + last_delta = -1; // flag recursive call underway + + e = _timeouts; + while (e) { + e_next = e->next; // Because this can change during processing + if (e->delta) { +#ifdef TIMEOUT_DEBUG + if ( !(e->delta >= min_delta)) { + diag_printf("Bad delta in timeout: %p, delta: %d, min: %d, last: %ld\n", e, e->delta, min_delta, last_set_time); + _show_timeouts(); + } +#endif +// Note: this _can_ happen if timeouts are scheduled before the clock starts! +// CYG_ASSERT( e->delta >= min_delta, "e->delta underflow" ); + e->delta -= min_delta; + if (e->delta <= 0) { // Defensive + // Time for this item to 'fire' + timeout_fun *fun = e->fun; + void *arg = e->arg; + // Call it *after* cleansing the record +// diag_printf("%s(%p, %p, %p)\n", __FUNCTION__, e, e->fun, e->arg); + e->flags &= ~CALLOUT_PENDING; + e->delta = 0; + if (e->next) { + e->next->prev = e->prev; + } + if (e->prev) { + e->prev->next = e->next; + } else { + timeouts = e->next; + } + (*fun)(arg); + } + } + e = e_next; + } + + // Now scan for a new timeout *after* running all the callbacks + // (because they can add timeouts themselves) + min_delta = 0x7FFFFFFF; // Maxint + for (e = timeouts; e; e = e->next ) + if (e->delta) + if (e->delta < min_delta) + min_delta = e->delta; + + CYG_ASSERT( 0 < min_delta, "min_delta underflow" ); + + if (min_delta != 0x7FFFFFFF) { + // Still something to do, schedule it + last_set_time = cyg_current_time(); + cyg_alarm_initialize(timeout_alarm_handle, last_set_time+min_delta, 0); + last_delta = min_delta; + } else { + last_delta = 0; // flag no activity + } +#ifdef TIMEOUT_DEBUG + diag_printf("Timeout list after %s\n", __FUNCTION__); + _show_timeouts(); +#endif +} + +// ------------------------------------------------------------------------ +// ALARM EVENT FUNCTION +// This is the DSR for the alarm firing: +static void +do_alarm(cyg_handle_t alarm, cyg_addrword_t data) +{ + cyg_flag_setbits( &alarm_flag, 1 ); +} + +void ecos_synch_eth_drv_dsr(void) +{ + cyg_flag_setbits( &alarm_flag, 2 ); +} + +// ------------------------------------------------------------------------ +// HANDLER THREAD ENTRY ROUTINE +// This waits on the DSR to tell it to run: +static void +alarm_thread(cyg_addrword_t param) +{ + // This is from the logical ethernet dev; it calls those delivery + // functions who need attention. + extern void eth_drv_run_deliveries( void ); + + // This is from the logical ethernet dev; it tickles somehow + // all ethernet devices in case one is wedged. + extern void eth_drv_tickle_devices( void ); + + while ( 1 ) { + int spl; + int x; +#ifdef CYGPKG_NET_FAST_THREAD_TICKLE_DEVS + cyg_tick_count_t later = cyg_current_time(); + later += CYGNUM_NET_FAST_THREAD_TICKLE_DEVS_DELAY; + x = cyg_flag_timed_wait( + &alarm_flag, + -1, + CYG_FLAG_WAITMODE_OR | CYG_FLAG_WAITMODE_CLR, + later ); +#else + x = cyg_flag_wait( + &alarm_flag, + -1, + CYG_FLAG_WAITMODE_OR | CYG_FLAG_WAITMODE_CLR ); + + CYG_ASSERT( 3 & x, "Lost my bits" ); +#endif // CYGPKG_NET_FAST_THREAD_TICKLE_DEVS + CYG_ASSERT( !((~3) & x), "Extra bits" ); + + spl = cyg_splinternal(); + + CYG_ASSERT( 0 == spl, "spl nonzero" ); + + if ( 2 & x ) + eth_drv_run_deliveries(); +#ifdef CYGPKG_NET_FAST_THREAD_TICKLE_DEVS + // This is in the else clause for "do we deliver" because the + // network stack might have continuous timing events anyway - so + // the timeout would not occur, x would be 1 every time. + else // Tickle the devices... + eth_drv_tickle_devices(); +#endif // CYGPKG_NET_FAST_THREAD_TICKLE_DEVS + + if ( 1 & x ) + do_timeout(); + + cyg_splx(spl); + } +} + +// ------------------------------------------------------------------------ +// INITIALIZATION FUNCTION +void +cyg_alarm_timeout_init( void ) +{ + // Init the alarm object, attached to the real time clock + cyg_handle_t h; + cyg_clock_to_counter(cyg_real_time_clock(), &h); + cyg_alarm_create(h, do_alarm, 0, &timeout_alarm_handle, &timeout_alarm); + // Init the flag of waking up + cyg_flag_init( &alarm_flag ); + // Create alarm background thread to run the callbacks + cyg_thread_create( + CYGPKG_NET_FAST_THREAD_PRIORITY, // Priority + alarm_thread, // entry + 0, // entry parameter + "Network alarm support", // Name + &alarm_stack[0], // Stack + STACK_SIZE, // Size + &alarm_thread_handle, // Handle + &alarm_thread_data // Thread data structure + ); + cyg_thread_resume(alarm_thread_handle); // Start it +} + +// ------------------------------------------------------------------------ +// EXPORTED API: SET A TIMEOUT +// This can be called from anywhere, including recursively from the timeout +// functions themselves. +cyg_uint32 +timeout(timeout_fun *fun, void *arg, cyg_int32 delta) +{ + timeout_entry *e; + cyg_uint32 stamp; + + // this needs to be atomic - recursive calls from the alarm + // handler thread itself are allowed: + int spl = cyg_splinternal(); + + stamp = 0; // Assume no slots available + for (e = _timeouts; e; e = e->next) { + if ((e->flags & CALLOUT_PENDING) == 0) { + // Free entry + callout_init(e); + e->flags = CALLOUT_LOCAL; + callout_reset(e, delta, fun, arg); + stamp = (cyg_uint32)e; + break; + } + } + cyg_splx(spl); + return stamp; +} + +// ------------------------------------------------------------------------ +// EXPORTED API: CANCEL A TIMEOUT +// This can be called from anywhere, including recursively from the timeout +// functions themselves. +void +untimeout(timeout_fun *fun, void * arg) +{ + timeout_entry *e; + int spl = cyg_splinternal(); + + for (e = _timeouts; e; e = e->next) { + if (e->delta && (e->fun == fun) && (e->arg == arg)) { + callout_stop(e); + break; + } + } + cyg_splx(spl); +} + +void +callout_init(struct callout *c) +{ + bzero(c, sizeof(*c)); +} + +void +callout_reset(struct callout *c, int delta, timeout_fun *f, void *p) +{ + int spl = cyg_splinternal(); + + CYG_ASSERT( 0 < delta, "delta is right now, or even sooner!" ); + + // Renormalize delta wrt the existing set alarm, if there is one + if (last_delta > 0) { +#ifdef TIMEOUT_DEBUG + int _delta = delta; + int _time = cyg_current_time(); +#endif // TIMEOUT_DEBUG + // There is an active alarm + if (last_set_time != 0) { + // Adjust the delta to be absolute, relative to the alarm + delta += (cyg_int32)(cyg_current_time() - last_set_time); + } else { + // We don't know exactly when the alarm will fire, so just + // schedule this event for the first time, or sometime after + ; // Leaving the value alone won't be "too wrong" + } +#ifdef TIMEOUT_DEBUG + diag_printf("delta changed from %d to %d, now: %d, then: %d, last_delta: %d\n", + _delta, delta, _time, (int)last_set_time, last_delta); + _show_timeouts(); +#endif + } + // So recorded_delta is set to either: + // alarm is active: delta + NOW - THEN + // alarm is inactive: delta + + // Add this callout/timeout to the list of things to do + if (c->flags & CALLOUT_PENDING) { + callout_stop(c); + } + c->prev = (timeout_entry *)NULL; + c->next = timeouts; + if (c->next != (timeout_entry *)NULL) { + c->next->prev = c; + } + timeouts = c; + c->flags |= CALLOUT_PENDING | CALLOUT_ACTIVE; + c->fun = f; + c->arg = p; + c->delta = delta; + +#ifdef TIMEOUT_DEBUG + diag_printf("%s(%p, %d, %p, %p)\n", __FUNCTION__, c, delta, f, p); + _show_timeouts(); +#endif + + if ((0 == last_delta || // alarm was inactive OR + delta < last_delta) ) { // alarm was active but later than we need + + // (if last_delta is -1, this call is recursive from the handler so + // also do nothing in that case) + + // Here, we know the new item added is sooner than that which was + // most recently set, if any, so we can just go and set it up. + if ( 0 == last_delta ) + last_set_time = cyg_current_time(); + + // So we use, to set the alarm either: + // alarm is active: (delta + NOW - THEN) + THEN + // alarm is inactive: delta + NOW + // and in either case it is true that + // (recorded_delta + last_set_time) == (delta + NOW) + cyg_alarm_initialize(timeout_alarm_handle, last_set_time+delta, 0); +#ifdef TIMEOUT_DEBUG + if ((int)last_set_time == 0) { + diag_printf("delta: %d, time: %ld, last_delta: %d\n", delta, last_set_time, last_delta); + } +#endif + last_delta = delta; + } + // Otherwise, the alarm is active, AND it is set to fire sooner than we + // require, so when it does, that will sort out calling the item we + // just added. + +#ifdef CYGPKG_INFRA_DEBUG + // Do some more checking akin to that in the alarm handler: + if ( last_delta != -1 ) { // not a recursive call + cyg_tick_count_t now = cyg_current_time(); + timeout_entry *e; + + CYG_ASSERT( last_delta >= 0, "Bad last delta" ); + delta = 0x7fffffff; + for (e = timeouts; e; e = e->next) { + if (e->delta) { + CYG_ASSERT( e->delta >= last_delta, "e->delta underflow" ); + CYG_ASSERT( last_set_time + e->delta + 1000 > now, + "Recorded alarm not in the future!" ); + if ( e->delta < delta ) + delta = e->delta; + } else { + CYG_ASSERT( 0 == e->fun, "Function recorded for 0 delta" ); + } + } + CYG_ASSERT( delta == last_delta, "We didn't pick the smallest delta!" ); + } +#endif + cyg_splx(spl); +} + +void +callout_stop(struct callout *c) +{ + int spl = cyg_splinternal(); + +#ifdef TIMEOUT_DEBUG + diag_printf("%s(%p) = %x\n", __FUNCTION__, c, c->flags); +#endif + if ((c->flags & CALLOUT_PENDING) == 0) { + c->flags &= ~CALLOUT_ACTIVE; + cyg_splx(spl); + return; + } + c->flags &= ~(CALLOUT_PENDING | CALLOUT_ACTIVE); + if (c->next) { + c->next->prev = c->prev; + } + if (c->prev) { + c->prev->next = c->next; + } else { + timeouts = c->next; + } + cyg_splx(spl); +} + +int +callout_active(struct callout *c) +{ + return ((c->flags & CALLOUT_ACTIVE) != 0); +} + +void +callout_deactivate(struct callout *c) +{ + c->flags &= ~CALLOUT_ACTIVE; +} + +int +callout_pending(struct callout *c) +{ + return ((c->flags & CALLOUT_PENDING) != 0); +} + + +// ------------------------------------------------------------------------ + +// EOF timeout.c diff --git a/packages/net/bsd_tcpip/current/src/sys/kern/kern_subr.c b/packages/net/bsd_tcpip/current/src/sys/kern/kern_subr.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/kern/kern_subr.c @@ -0,0 +1,168 @@ +//========================================================================== +// +// src/sys/kern/kern_subr.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 + * $FreeBSD: src/sys/kern/kern_subr.c,v 1.31 1999/10/29 18:08:51 phk Exp $ + */ + +#include +#include +#include +#include + +int +uiomove(cp, n, uio) + register caddr_t cp; + register int n; + register struct uio *uio; +{ + register struct iovec *iov; + u_int cnt; + int error = 0; + + while (n > 0 && uio->uio_resid) { + iov = uio->uio_iov; + cnt = iov->iov_len; + if (cnt == 0) { + uio->uio_iov++; + uio->uio_iovcnt--; + continue; + } + if (cnt > n) + cnt = n; + + switch (uio->uio_segflg) { + + case UIO_USERSPACE: + if (uio->uio_rw == UIO_READ) + error = copyout(cp, iov->iov_base, cnt); + else + error = copyin(iov->iov_base, cp, cnt); + if (error) + break; + break; + + case UIO_SYSSPACE: + if (uio->uio_rw == UIO_READ) + bcopy((caddr_t)cp, iov->iov_base, cnt); + else + bcopy(iov->iov_base, (caddr_t)cp, cnt); + break; + } + (char *)(iov->iov_base) += cnt; + iov->iov_len -= cnt; + uio->uio_resid -= cnt; + uio->uio_offset += cnt; + cp += cnt; + n -= cnt; + } + return (error); +} + +/* + * General routine to allocate a hash table. + */ +void * +hashinit(int elements, void *type, u_long *hashmask) +{ + long hashsize; + LIST_HEAD(generic, generic) *hashtbl; + int i; + + if (elements <= 0) + panic("hashinit: bad elements"); + for (hashsize = 1; hashsize <= elements; hashsize <<= 1) + continue; + hashsize >>= 1; + hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); + for (i = 0; i < hashsize; i++) + LIST_INIT(&hashtbl[i]); + *hashmask = hashsize - 1; + return (hashtbl); +} + +static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039, + 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, 6653, + 7159, 7673, 8191, 12281, 16381, 24571, 32749 }; +#define NPRIMES (sizeof(primes) / sizeof(primes[0])) + +/* + * General routine to allocate a prime number sized hash table. + */ +void * +phashinit(int elements, void *type, u_long *nentries) +{ + long hashsize; + LIST_HEAD(generic, generic) *hashtbl; + int i; + + if (elements <= 0) + panic("phashinit: bad elements"); + for (i = 1, hashsize = primes[1]; hashsize <= elements;) { + i++; + if (i == NPRIMES) + break; + hashsize = primes[i]; + } + hashsize = primes[i - 1]; + hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); + for (i = 0; i < hashsize; i++) + LIST_INIT(&hashtbl[i]); + *nentries = hashsize; + return (hashtbl); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/kern/md5c.c b/packages/net/bsd_tcpip/current/src/sys/kern/md5c.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/kern/md5c.c @@ -0,0 +1,356 @@ +//========================================================================== +// +// src/sys/kern/md5c.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + * + * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + * rights reserved. + * + * License to copy and use this software is granted provided that it + * is identified as the "RSA Data Security, Inc. MD5 Message-Digest + * Algorithm" in all material mentioning or referencing this software + * or this function. + * + * License is also granted to make and use derivative works provided + * that such works are identified as "derived from the RSA Data + * Security, Inc. MD5 Message-Digest Algorithm" in all material + * mentioning or referencing the derived work. + * + * RSA Data Security, Inc. makes no representations concerning either + * the merchantability of this software or the suitability of this + * software for any particular purpose. It is provided "as is" + * without express or implied warranty of any kind. + * + * These notices must be retained in any copies of any part of this + * documentation and/or software. + * + * $FreeBSD: src/sys/kern/md5c.c,v 1.17 1999/12/29 04:54:39 peter Exp $ + * + * This code is the same as the code published by RSA Inc. It has been + * edited for clarity and style only. + */ + +#include +#include + +#ifdef _KERNEL +#include +#endif + +#include + + +#ifdef _KERNEL +#define memset(x,y,z) bzero(x,z); +#define memcpy(x,y,z) bcopy(y, x, z) +#endif + +#if defined(__i386__) || defined(__alpha__) +#define Encode memcpy +#define Decode memcpy +#else /* __i386__ */ + +/* + * Encodes input (u_int32_t) into output (unsigned char). Assumes len is + * a multiple of 4. + */ + +/* XXX not prototyped, and not compatible with memcpy(). */ +static void +Encode (unsigned char *output, u_int32_t *input, unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char)(input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); + } +} + +/* + * Decodes input (unsigned char) into output (u_int32_t). Assumes len is + * a multiple of 4. + */ + +static void +Decode (u_int32_t *output, const unsigned char *input, unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((u_int32_t)input[j]) | (((u_int32_t)input[j+1]) << 8) | + (((u_int32_t)input[j+2]) << 16) | (((u_int32_t)input[j+3]) << 24); +} +#endif /* i386 */ + +static unsigned char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G, H and I are basic MD5 functions. */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits. */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* + * FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. + * Rotation is separate from addition to prevent recomputation. + */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + +/* MD5 initialization. Begins an MD5 operation, writing a new context. */ + +void +MD5Init (context) + MD5_CTX *context; +{ + + context->count[0] = context->count[1] = 0; + + /* Load magic initialization constants. */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* + * MD5 block update operation. Continues an MD5 message-digest + * operation, processing another message block, and updating the + * context. + */ + +void +MD5Update (context, input, inputLen) + MD5_CTX *context; + const unsigned char *input; + unsigned int inputLen; +{ + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int)((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((u_int32_t)inputLen << 3)) + < ((u_int32_t)inputLen << 3)) + context->count[1]++; + context->count[1] += ((u_int32_t)inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. */ + if (inputLen >= partLen) { + memcpy((void *)&context->buffer[index], (const void *)input, + partLen); + MD5Transform (context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform (context->state, &input[i]); + + index = 0; + } + else + i = 0; + + /* Buffer remaining input */ + memcpy ((void *)&context->buffer[index], (const void *)&input[i], + inputLen-i); +} + +/* + * MD5 padding. Adds padding followed by original length. + */ + +void +MD5Pad (context) + MD5_CTX *context; +{ + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + Encode (bits, context->count, 8); + + /* Pad out to 56 mod 64. */ + index = (unsigned int)((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + MD5Update (context, PADDING, padLen); + + /* Append length (before padding) */ + MD5Update (context, bits, 8); +} + +/* + * MD5 finalization. Ends an MD5 message-digest operation, writing the + * the message digest and zeroizing the context. + */ + +void +MD5Final (digest, context) + unsigned char digest[16]; + MD5_CTX *context; +{ + /* Do padding. */ + MD5Pad (context); + + /* Store state in digest */ + Encode (digest, context->state, 16); + + /* Zeroize sensitive information. */ + memset ((void *)context, 0, sizeof (*context)); +} + +/* MD5 basic transformation. Transforms state based on block. */ + +void +MD5Transform (state, block) + u_int32_t state[4]; + const unsigned char block[64]; +{ + u_int32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode (x, block, 64); + + /* Round 1 */ +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. */ + memset ((void *)x, 0, sizeof (x)); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/kern/sockio.c b/packages/net/bsd_tcpip/current/src/sys/kern/sockio.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/kern/sockio.c @@ -0,0 +1,1071 @@ +//========================================================================== +// +// src/sys/kern/sockio.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +//========================================================================== +// +// sys/kern/sockio.c +// +// Socket interface to Fileio subsystem +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, gthomas +// Date: 2000-06-06 +// Purpose: +// Description: File I/O operations for network sockets. Ruthelessly +// cribbed from the BSD sources and adapted to eCos. +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1989, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * sendfile(2) and related extensions: + * Copyright (c) 1998, David Greenman. 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94 + * $FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.65.2.9 2001/07/31 10:49:39 dwmalone Exp $ + */ +//========================================================================== + +#include +#include + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//========================================================================== +// Forward definitions + +static int bsd_init (cyg_nstab_entry *nste); +static int bsd_socket(cyg_nstab_entry *nste, int domain, int type, + int protocol, cyg_file *file); + +static int bsd_bind (cyg_file *fp, const sockaddr *sa, socklen_t len); +static int bsd_connect (cyg_file *fp, const sockaddr *sa, socklen_t len); +static int bsd_accept (cyg_file *fp, cyg_file *new_fp, + struct sockaddr *name, socklen_t *anamelen); +static int bsd_listen (cyg_file *fp, int len); +static int bsd_getname (cyg_file *fp, sockaddr *sa, socklen_t *len, int peer); +static int bsd_shutdown (cyg_file *fp, int flags); +static int bsd_getsockopt(cyg_file *fp, int level, int optname, + void *optval, socklen_t *optlen); +static int bsd_setsockopt(cyg_file *fp, int level, int optname, + const void *optval, socklen_t optlen); +static int bsd_sendmsg (cyg_file *fp, const struct msghdr *m, + int flags, ssize_t *retsize); +static int bsd_recvmsg (cyg_file *fp, struct msghdr *m, + socklen_t *namelen, ssize_t *retsize); + + +// File operations +static int bsd_read (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); +static int bsd_write (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); +static int bsd_lseek (struct CYG_FILE_TAG *fp, off_t *pos, int whence); +static int bsd_ioctl (struct CYG_FILE_TAG *fp, CYG_ADDRWORD com, + CYG_ADDRWORD data); +static int bsd_select (struct CYG_FILE_TAG *fp, int which, CYG_ADDRWORD info); +static int bsd_fsync (struct CYG_FILE_TAG *fp, int mode); +static int bsd_close (struct CYG_FILE_TAG *fp); +static int bsd_fstat (struct CYG_FILE_TAG *fp, struct stat *buf); +static int bsd_getinfo (struct CYG_FILE_TAG *fp, int key, char *buf, int len); +static int bsd_setinfo (struct CYG_FILE_TAG *fp, int key, char *buf, int len); + +static int bsd_recvit (cyg_file *fp, struct msghdr *mp, + socklen_t *namelenp, ssize_t *retsize); +static int bsd_sendit (cyg_file *fp, const struct msghdr *mp, + int flags, ssize_t *retsize); + +static int getsockaddr (struct sockaddr **namp, caddr_t uaddr, size_t len); + +//========================================================================== +// Table entrys + +NSTAB_ENTRY( bsd_nste, 0, + "bsd_tcpip", + "", + 0, + bsd_init, + bsd_socket); + +struct cyg_sock_ops bsd_sockops = +{ + bsd_bind, + bsd_connect, + bsd_accept, + bsd_listen, + bsd_getname, + bsd_shutdown, + bsd_getsockopt, + bsd_setsockopt, + bsd_sendmsg, + bsd_recvmsg +}; + +cyg_fileops bsd_sock_fileops = +{ + bsd_read, + bsd_write, + bsd_lseek, + bsd_ioctl, + bsd_select, + bsd_fsync, + bsd_close, + bsd_fstat, + bsd_getinfo, + bsd_setinfo +}; + +//========================================================================== +// NStab functions + + + +// ------------------------------------------------------------------------- + +static int +bsd_init(cyg_nstab_entry *nste) +{ + // Initialization already handled via constructor + + return ENOERR; +} + +// ------------------------------------------------------------------------- + +static int +bsd_socket(cyg_nstab_entry *nste, int domain, int type, + int protocol, cyg_file *file) +{ + int error = 0; + struct socket *so; + + error = socreate(domain, &so, type, protocol, (struct proc *)&proc0); + + if( error == ENOERR) + { + + cyg_selinit(&so->so_rcv.sb_sel); + cyg_selinit(&so->so_snd.sb_sel); + + file->f_flag |= CYG_FREAD|CYG_FWRITE; + file->f_type = CYG_FILE_TYPE_SOCKET; + file->f_ops = &bsd_sock_fileops; + file->f_offset = 0; + file->f_data = (CYG_ADDRWORD)so; + file->f_xops = (CYG_ADDRWORD)&bsd_sockops; + } + + return error; +} + + +//========================================================================== +// Sockops functions + +// ------------------------------------------------------------------------- + +static int +bsd_bind(cyg_file *fp, const sockaddr *sa, socklen_t len) +{ + int error; + + error = sobind((struct socket *)fp->f_data, (sockaddr *)sa, 0); + return error; +} + +// ------------------------------------------------------------------------- + +static int +bsd_connect(cyg_file *fp, const sockaddr *sa, socklen_t len) +{ + struct socket *so; + int error, s; + + so = (struct socket *)fp->f_data; + + if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) + return (EALREADY); + + error = soconnect(so, (struct sockaddr *)sa, 0); + if (error) + goto bad; + + if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) { + return (EINPROGRESS); + } + + s = splsoftnet(); + while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { + error = tsleep((caddr_t)&so->so_timeo, PSOCK | PCATCH, + "netcon", 0); + if (error) + break; + } + + if (error == 0) { + error = so->so_error; + so->so_error = 0; + } + + splx(s); + +bad: + so->so_state &= ~SS_ISCONNECTING; + + return error; +} + +// ------------------------------------------------------------------------- + +static int +bsd_accept(cyg_file *fp, cyg_file *new_fp, + struct sockaddr *name, socklen_t *anamelen) +{ + socklen_t namelen = 0; + int error = 0, s; + struct socket *head, *so; + struct sockaddr *sa; + + if( anamelen != NULL) + namelen = *anamelen; + + s = splsoftnet(); + head = (struct socket *)fp->f_data; + + if ((head->so_options & SO_ACCEPTCONN) == 0) { + splx(s); + return (EINVAL); + } + + if ((head->so_state & SS_NBIO) && TAILQ_EMPTY(&head->so_comp)) { + splx(s); + return (EWOULDBLOCK); + } + + while (TAILQ_EMPTY(&head->so_comp) && head->so_error == 0) { + if (head->so_state & SS_CANTRCVMORE) { + head->so_error = ECONNABORTED; + break; + } + error = tsleep((caddr_t)&head->so_timeo, PSOCK | PCATCH, + "netcon", 0); + if (error) { + splx(s); + return (error); + } + } + + if (head->so_error) { + error = head->so_error; + head->so_error = 0; + splx(s); + return (error); + } + + /* + * At this point we know that there is at least one connection + * ready to be accepted. Remove it from the queue prior to + * allocating the file descriptor for it since falloc() may + * block allowing another process to accept the connection + * instead. + */ + so = TAILQ_FIRST(&head->so_comp); + TAILQ_REMOVE(&head->so_comp, so, so_list); + head->so_qlen--; + +#if 0 // FIXME + fflag = lfp->f_flag; + error = falloc(p, &nfp, &fd); + if (error) { + /* + * Probably ran out of file descriptors. Put the + * unaccepted connection back onto the queue and + * do another wakeup so some other process might + * have a chance at it. + */ + TAILQ_INSERT_HEAD(&head->so_comp, so, so_list); + head->so_qlen++; + wakeup_one(&head->so_timeo); + splx(s); + goto done; + } + fhold(nfp); + p->p_retval[0] = fd; + + /* connection has been removed from the listen queue */ + KNOTE(&head->so_rcv.sb_sel.si_note, 0); +#endif + + so->so_state &= ~SS_COMP; + so->so_head = NULL; + + cyg_selinit(&so->so_rcv.sb_sel); + cyg_selinit(&so->so_snd.sb_sel); + + new_fp->f_type = DTYPE_SOCKET; + new_fp->f_flag |= FREAD|FWRITE; + new_fp->f_offset = 0; + new_fp->f_ops = &bsd_sock_fileops; + new_fp->f_data = (CYG_ADDRWORD)so; + new_fp->f_xops = (CYG_ADDRWORD)&bsd_sockops; + + sa = 0; + error = soaccept(so, &sa); + if (error) { + /* + * return a namelen of zero for older code which might + * ignore the return value from accept. + */ + if (name != NULL) { + *anamelen = 0; + } + goto noconnection; + } + if (sa == NULL) { + namelen = 0; + if (name) + goto gotnoname; + splx(s); + error = 0; + goto done; + } + if (name) { + if (namelen > sa->sa_len) + namelen = sa->sa_len; +#ifdef COMPAT_OLDSOCK + if (compat) + ((struct osockaddr *)sa)->sa_family = sa->sa_family; +#endif + error = copyout(sa, (caddr_t)name, namelen); + if (!error) +gotnoname: + *anamelen = namelen; + } +noconnection: + +#if 0 // FIXME + /* + * close the new descriptor, assuming someone hasn't ripped it + * out from under us. + */ + if (error) { + if (fdp->fd_ofiles[fd] == nfp) { + fdp->fd_ofiles[fd] = NULL; + fdrop(nfp, p); + } + } + splx(s); + + /* + * Release explicitly held references before returning. + */ +done: + if (nfp != NULL) + fdrop(nfp, p); + fdrop(lfp, p); + return (error); + m_freem(nam); +#else + done: +#endif + splx(s); + + return (error); +} + +// ------------------------------------------------------------------------- + +static int +bsd_listen(cyg_file *fp, int backlog) +{ + return (solisten((struct socket *)fp->f_data, backlog, 0)); +} + +// ------------------------------------------------------------------------- + +static int +bsd_getname(cyg_file *fp, sockaddr *asa, socklen_t *alen, int peer) +{ + struct socket *so; + socklen_t len = 0; + int error; + int type = peer ? PRU_PEERADDR : PRU_SOCKADDR; + sockaddr *sa; + + if( alen != NULL) + len = *alen; + + so = (struct socket *)fp->f_data; + sa = 0; + if (type) { + // getpeername() + if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) { + return (ENOTCONN); + } + error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, &sa); + } else { + // getsockname() + error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, &sa); + } + if (error) + goto bad; + if (sa == 0) { + len = 0; + goto gotnothing; + } + len = min(len, sa->sa_len); +#ifdef COMPAT_OLDSOCK + if (compat) + ((struct osockaddr *)sa)->sa_family = sa->sa_family; +#endif + error = copyout(sa, (caddr_t)asa, (u_int)len); + gotnothing: + *alen = len; + bad: + if (sa) + FREE(sa, M_SONAME); + return (error); +} + +// ------------------------------------------------------------------------- + +static int +bsd_shutdown(cyg_file *fp, int how) +{ + return (soshutdown((struct socket *)fp->f_data, how)); +} + +// ------------------------------------------------------------------------- + +static int +bsd_getsockopt(cyg_file *fp, int level, int optname, + void *optval, socklen_t *optlen) +{ + socklen_t valsize = 0; + int error; + struct sockopt opt; + + if( optval != NULL && optlen != NULL) + valsize = *optlen; + + opt.sopt_dir = SOPT_GET; + opt.sopt_level = level; + opt.sopt_name = optname; + opt.sopt_val = optval; + opt.sopt_valsize = valsize; + opt.sopt_p = 0; + + error = sogetopt((struct socket *)fp->f_data, &opt); + if (error == 0) { + *optlen = opt.sopt_valsize; + } + return (error); +} + +// ------------------------------------------------------------------------- + +static int +bsd_setsockopt(cyg_file *fp, int level, int optname, + const void *optval, socklen_t optlen) +{ + struct sockopt opt; + + opt.sopt_dir = SOPT_SET; + opt.sopt_level = level; + opt.sopt_name = optname; + opt.sopt_val = (void *)optval; + opt.sopt_valsize = optlen; + opt.sopt_p = 0; + + return sosetopt((struct socket *)fp->f_data, &opt); +} + +// ------------------------------------------------------------------------- + +static int +bsd_sendmsg(cyg_file *fp, const struct msghdr *m, int flags, ssize_t *retsize) +{ + return bsd_sendit(fp, m, flags, retsize); +} + +// ------------------------------------------------------------------------- + +static int +bsd_recvmsg(cyg_file *fp, struct msghdr *m, socklen_t *namelen, ssize_t *retsize) +{ + return bsd_recvit(fp, m, namelen, retsize); +} + +//========================================================================== +// File system call functions + +// ------------------------------------------------------------------------- + +static int +bsd_read(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio) +{ + return (soreceive((struct socket *)fp->f_data, (struct sockaddr **)0, + uio, (struct mbuf **)0, (struct mbuf **)0, (int *)0)); +} + +// ------------------------------------------------------------------------- + +static int +bsd_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio) +{ + return (sosend((struct socket *)fp->f_data, (struct sockaddr *)0, + uio, (struct mbuf *)0, (struct mbuf *)0, 0, 0)); +} + +// ------------------------------------------------------------------------- + +static int +bsd_lseek(struct CYG_FILE_TAG *fp, off_t *pos, int whence) +{ + return ESPIPE; +} + +// ------------------------------------------------------------------------- + +static int +bsd_ioctl(struct CYG_FILE_TAG *fp, CYG_ADDRWORD cmd, CYG_ADDRWORD data) +{ + struct socket *so = (struct socket *)fp->f_data; + void *p = 0; + + switch (cmd) { + + case FIONBIO: + if (*(int *)data) + so->so_state |= SS_NBIO; + else + so->so_state &= ~SS_NBIO; + return (0); + + case FIOASYNC: + if (*(int *)data) { + so->so_state |= SS_ASYNC; + so->so_rcv.sb_flags |= SB_ASYNC; + so->so_snd.sb_flags |= SB_ASYNC; + } else { + so->so_state &= ~SS_ASYNC; + so->so_rcv.sb_flags &= ~SB_ASYNC; + so->so_snd.sb_flags &= ~SB_ASYNC; + } + return (0); + + case FIONREAD: + *(int *)data = so->so_rcv.sb_cc; + return (0); + + case SIOCATMARK: + *(int *)data = (so->so_state&SS_RCVATMARK) != 0; + return (0); + } + /* + * Interface/routing/protocol specific ioctls: + * interface and routing ioctls should have a + * different entry since a socket's unnecessary + */ + if (IOCGROUP(cmd) == 'i') + return (ifioctl(so, (u_long)cmd, (caddr_t)data, p)); + if (IOCGROUP(cmd) == 'r') + return (rtioctl((u_long)cmd, (caddr_t)data, p)); + return ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, (caddr_t)data, 0, 0)); +} + +#if 0 // DEBUG support +static int +bsd_ioctl(struct CYG_FILE_TAG *fp, CYG_ADDRWORD cmd, CYG_ADDRWORD data) +{ + int res = _bsd_ioctl(fp, cmd, data); + diag_printf("ioctl(%x,%x) = %x\n", cmd, data, res); + return res; +} +#endif + +// ------------------------------------------------------------------------- + +static int +bsd_select(struct CYG_FILE_TAG *fp, int which, CYG_ADDRWORD info) +{ + register struct socket *so = (struct socket *)fp->f_data; + register int s = splsoftnet(); + + switch (which) { + + case FREAD: + if (soreadable(so)) { + splx(s); + return (1); + } + cyg_selrecord(info, &so->so_rcv.sb_sel); + so->so_rcv.sb_flags |= SB_SEL; + break; + + case FWRITE: + if (sowriteable(so)) { + splx(s); + return (1); + } + cyg_selrecord(info, &so->so_snd.sb_sel); + so->so_snd.sb_flags |= SB_SEL; + break; + + case 0: + if (so->so_oobmark || (so->so_state & SS_RCVATMARK)) { + splx(s); + return (1); + } + cyg_selrecord(info, &so->so_rcv.sb_sel); + so->so_rcv.sb_flags |= SB_SEL; + break; + } + splx(s); + + return ENOERR; +} + +// ------------------------------------------------------------------------- + +static int +bsd_fsync(struct CYG_FILE_TAG *fp, int mode) +{ + // FIXME: call some sort of flush IOCTL? + return 0; +} + +// ------------------------------------------------------------------------- + +static int +bsd_close(struct CYG_FILE_TAG *fp) +{ + int error = 0; + + if (fp->f_data) + error = soclose((struct socket *)fp->f_data); + fp->f_data = 0; + return (error); +} + +// ------------------------------------------------------------------------- + +static int +bsd_fstat(struct CYG_FILE_TAG *fp, struct stat *buf) +{ + register struct socket *so = (struct socket *)fp->f_data; + + bzero((caddr_t)buf, sizeof (*buf)); + + // Mark socket as a fifo for now. We need to add socket types to + // sys/stat.h. + buf->st_mode = __stat_mode_FIFO; + + return ((*so->so_proto->pr_usrreqs->pru_sense)(so, buf)); +} + +// ------------------------------------------------------------------------- + +static int +bsd_getinfo(struct CYG_FILE_TAG *fp, int key, char *buf, int len) +{ + return ENOSYS; +} + +// ------------------------------------------------------------------------- + +static int +bsd_setinfo(struct CYG_FILE_TAG *fp, int key, char *buf, int len) +{ + return ENOSYS; +} + + +#if 0 +//========================================================================== +// Select support + +// ------------------------------------------------------------------------- +// This function is called by the lower layers to record the +// fact that a particular 'select' event is being requested. +// + +void +selrecord(void *selector, struct selinfo *info) +{ + // Unused by this implementation +} + +// ------------------------------------------------------------------------- +// This function is called to indicate that a 'select' event +// may have occurred. +// + +void +selwakeup(struct selinfo *info) +{ + cyg_selwakeup( info); +} +#endif + +//========================================================================== +// Misc support functions + +int +sockargs(mp, buf, buflen, type) + struct mbuf **mp; + caddr_t buf; + int buflen; + int type; +{ + register struct sockaddr *sa; + register struct mbuf *m; + int error; + + if (buflen > MLEN) { +#ifdef COMPAT_OLDSOCK + if (type == MT_SONAME && buflen <= 112) + buflen = MLEN; /* unix domain compat. hack */ + else +#endif + return (EINVAL); + } + m = m_get(M_WAIT, type); + if (m == NULL) + return (ENOBUFS); + m->m_len = buflen; + error = copyin(buf, mtod(m, caddr_t), buflen); + if (error) { + (void) m_free(m); + return (error); + } + *mp = m; + if (type == MT_SONAME) { + sa = mtod(m, struct sockaddr *); + +#if defined(COMPAT_OLDSOCK) && BYTE_ORDER != BIG_ENDIAN + if (sa->sa_family == 0 && sa->sa_len < AF_MAX) + sa->sa_family = sa->sa_len; +#endif + sa->sa_len = buflen; + } + return (0); +} + + +// ------------------------------------------------------------------------- +// bsd_recvit() +// Support for message reception. This is a lightly edited version of the +// recvit() function is uipc_syscalls.c. + +static int +bsd_recvit(cyg_file *fp, struct msghdr *mp, socklen_t *namelenp, ssize_t *retsize) +{ + struct uio auio; + struct iovec *iov; + int i; + size_t len; + int error; + struct mbuf *m, *control = 0; + caddr_t ctlbuf; + struct socket *so; + struct sockaddr *fromsa = 0; + + auio.uio_iov = mp->msg_iov; + auio.uio_iovcnt = mp->msg_iovlen; + auio.uio_segflg = UIO_USERSPACE; + auio.uio_rw = UIO_READ; + auio.uio_offset = 0; /* XXX */ + auio.uio_resid = 0; + iov = mp->msg_iov; + for (i = 0; i < mp->msg_iovlen; i++, iov++) { + /* Don't allow sum > SSIZE_MAX */ + if (iov->iov_len > SSIZE_MAX || + (auio.uio_resid += iov->iov_len) > SSIZE_MAX) + return (EINVAL); + } + + len = auio.uio_resid; + so = (struct socket *)fp->f_data; + error = so->so_proto->pr_usrreqs->pru_soreceive(so, &fromsa, &auio, + (struct mbuf **)0, mp->msg_control ? &control : (struct mbuf **)0, + &mp->msg_flags); + if (error) { + if (auio.uio_resid != len && + (error == EINTR || error == EWOULDBLOCK)) + error = 0; + } + if (error) + goto out; + *retsize = len - auio.uio_resid; + if (mp->msg_name) { + len = mp->msg_namelen; + if (len <= 0 || fromsa == 0) + len = 0; + else { + /* save sa_len before it is destroyed by MSG_COMPAT */ + if (len > fromsa->sa_len) + len = fromsa->sa_len; +#ifdef COMPAT_OLDSOCK + if (mp->msg_flags & MSG_COMPAT) + ((struct osockaddr *)fromsa)->sa_family = + fromsa->sa_family; +#endif + error = copyout(fromsa, + (caddr_t)mp->msg_name, (unsigned)len); + if (error) + goto out; + } + mp->msg_namelen = len; + if (namelenp) { + *namelenp = len; +#ifdef COMPAT_OLDSOCK + if (mp->msg_flags & MSG_COMPAT) + error = 0; /* old recvfrom didn't check */ + else +#endif + goto out; + } + } + if (mp->msg_control) { +#ifdef COMPAT_OLDSOCK + /* + * We assume that old recvmsg calls won't receive access + * rights and other control info, esp. as control info + * is always optional and those options didn't exist in 4.3. + * If we receive rights, trim the cmsghdr; anything else + * is tossed. + */ + if (control && mp->msg_flags & MSG_COMPAT) { + if (mtod(control, struct cmsghdr *)->cmsg_level != + SOL_SOCKET || + mtod(control, struct cmsghdr *)->cmsg_type != + SCM_RIGHTS) { + mp->msg_controllen = 0; + goto out; + } + control->m_len -= sizeof (struct cmsghdr); + control->m_data += sizeof (struct cmsghdr); + } +#endif + len = mp->msg_controllen; + m = control; + mp->msg_controllen = 0; + ctlbuf = (caddr_t) mp->msg_control; + + while (m && len > 0) { + unsigned int tocopy; + + if (len >= m->m_len) + tocopy = m->m_len; + else { + mp->msg_flags |= MSG_CTRUNC; + tocopy = len; + } + + if ((error = copyout((caddr_t)mtod(m, caddr_t), + ctlbuf, tocopy)) != 0) + goto out; + + ctlbuf += tocopy; + len -= tocopy; + m = m->m_next; + } + mp->msg_controllen = ctlbuf - (caddr_t)mp->msg_control; + } + out: + if (fromsa) + FREE(fromsa, M_SONAME); + if (control) + m_freem(control); + return (error); +} + +// ------------------------------------------------------------------------- +// sendit() +// Support for message transmission. This is a lightly edited version of the +// synonymous function is uipc_syscalls.c. + +static int +bsd_sendit(cyg_file *fp, const struct msghdr *mp, int flags, ssize_t *retsize) +{ + struct uio auio; + register struct iovec *iov; + register int i; + struct mbuf *control; + struct sockaddr *to; + int len, error; + struct socket *so; + + auio.uio_iov = mp->msg_iov; + auio.uio_iovcnt = mp->msg_iovlen; + auio.uio_segflg = UIO_USERSPACE; + auio.uio_rw = UIO_WRITE; + auio.uio_offset = 0; /* XXX */ + auio.uio_resid = 0; + iov = mp->msg_iov; + for (i = 0; i < mp->msg_iovlen; i++, iov++) { + /* Don't allow sum > SSIZE_MAX */ + if (iov->iov_len > SSIZE_MAX || + (auio.uio_resid += iov->iov_len) > SSIZE_MAX) + return (EINVAL); + } + if (mp->msg_name) { + error = getsockaddr(&to, mp->msg_name, mp->msg_namelen); + if (error) { + return (error); + } + } else { + to = 0; + } + if (mp->msg_control) { + if (mp->msg_controllen < sizeof(struct cmsghdr) +#ifdef COMPAT_OLDSOCK + && mp->msg_flags != MSG_COMPAT +#endif + ) { + error = EINVAL; + goto bad; + } + error = sockargs(&control, mp->msg_control, + mp->msg_controllen, MT_CONTROL); + if (error) + goto bad; +#ifdef COMPAT_OLDSOCK + if (mp->msg_flags == MSG_COMPAT) { + register struct cmsghdr *cm; + + M_PREPEND(control, sizeof(*cm), M_WAIT); + if (control == 0) { + error = ENOBUFS; + goto bad; + } else { + cm = mtod(control, struct cmsghdr *); + cm->cmsg_len = control->m_len; + cm->cmsg_level = SOL_SOCKET; + cm->cmsg_type = SCM_RIGHTS; + } + } +#endif + } else + control = 0; + + len = auio.uio_resid; + so = (struct socket *)fp->f_data; + error = so->so_proto->pr_usrreqs->pru_sosend(so, to, &auio, 0, control, + flags, 0); + if (error) { + if (auio.uio_resid != len && (error == EINTR || error == EWOULDBLOCK)) + error = 0; + } + if (error == 0) + *retsize = len - auio.uio_resid; + bad: + if (to) + FREE(to, M_SONAME); + return (error); +} + +static int +getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len) +{ + struct sockaddr *sa; + int error; + + if (len > SOCK_MAXADDRLEN) + return ENAMETOOLONG; + MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK); + error = copyin(uaddr, sa, len); + if (error) { + FREE(sa, M_SONAME); + } else { +#if defined(COMPAT_OLDSOCK) && BYTE_ORDER != BIG_ENDIAN + if (sa->sa_family == 0 && sa->sa_len < AF_MAX) + sa->sa_family = sa->sa_len; +#endif + sa->sa_len = len; + *namp = sa; + } + return error; +} + +//========================================================================== +// End of sockio.c diff --git a/packages/net/bsd_tcpip/current/src/sys/kern/uipc_accf.c b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_accf.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_accf.c @@ -0,0 +1,160 @@ +//========================================================================== +// +// src/sys/kern/uipc_accf.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 2000 Paycounter, Inc. + * Author: Alfred Perlstein , + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD: src/sys/kern/uipc_accf.c,v 1.2.2.2 2000/09/20 21:19:21 ps Exp $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static SLIST_HEAD(, accept_filter) accept_filtlsthd = + SLIST_HEAD_INITIALIZER(&accept_filtlsthd); + +static int unloadable = 0; + +/* + * must be passed a malloc'd structure so we don't explode if the kld + * is unloaded, we leak the struct on deallocation to deal with this, + * but if a filter is loaded with the same name as a leaked one we re-use + * the entry. + */ +int +accept_filt_add(struct accept_filter *filt) +{ + struct accept_filter *p; + + SLIST_FOREACH(p, &accept_filtlsthd, accf_next) + if (strcmp(p->accf_name, filt->accf_name) == 0) { + if (p->accf_callback != NULL) { + return (EEXIST); + } else { + p->accf_callback = filt->accf_callback; + FREE(filt, M_ACCF); + return (0); + } + } + + if (p == NULL) + SLIST_INSERT_HEAD(&accept_filtlsthd, filt, accf_next); + return (0); +} + +int +accept_filt_del(char *name) +{ + struct accept_filter *p; + + p = accept_filt_get(name); + if (p == NULL) + return (ENOENT); + + p->accf_callback = NULL; + return (0); +} + +struct accept_filter * +accept_filt_get(char *name) +{ + struct accept_filter *p; + + SLIST_FOREACH(p, &accept_filtlsthd, accf_next) + if (strcmp(p->accf_name, name) == 0) + return (p); + + return (NULL); +} + +#ifdef ACCEPT_FILTER_MOD +int +accept_filt_generic_mod_event(module_t mod, int event, void *data) +{ + struct accept_filter *p; + struct accept_filter *accfp = (struct accept_filter *) data; + int s, error; + + switch (event) { + case MOD_LOAD: + MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF, M_WAITOK); + bcopy(accfp, p, sizeof(*p)); + s = splnet(); + error = accept_filt_add(p); + splx(s); + break; + + case MOD_UNLOAD: + /* + * Do not support unloading yet. we don't keep track of refcounts + * and unloading an accept filter callback and then having it called + * is a bad thing. A simple fix would be to track the refcount + * in the struct accept_filter. + */ + if (unloadable != 0) { + s = splnet(); + error = accept_filt_del(accfp->accf_name); + splx(s); + } else + error = EOPNOTSUPP; + break; + + case MOD_SHUTDOWN: + error = 0; + break; + + default: + error = EOPNOTSUPP; + break; + } + + return (error); +} +#endif diff --git a/packages/net/bsd_tcpip/current/src/sys/kern/uipc_domain.c b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_domain.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_domain.c @@ -0,0 +1,277 @@ +//========================================================================== +// +// src/sys/kern/uipc_domain.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)uipc_domain.c 8.2 (Berkeley) 10/18/93 + * $FreeBSD: src/sys/kern/uipc_domain.c,v 1.22.2.1 2001/07/03 11:01:37 ume Exp $ + */ + +#include +#include +#include +#include +#include +#include + +/* + * System initialization + * + * Note: domain initialization wants to take place on a per domain basis + * as a result of traversing a linker set. Most likely, each domain + * want to call a registration function rather than being handled here + * in domaininit(). Probably this will look like: + * + * SYSINIT(unique, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY, domain_add, xxx) + * + * Where 'xxx' is replaced by the address of a parameter struct to be + * passed to the doamin_add() function. + */ + +static void domaininit __P((void *)); +SYSINIT(domain, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, domaininit, NULL) + +static void pffasttimo __P((void *)); +static void pfslowtimo __P((void *)); + +struct domain *domains; + +/* + * Add a new protocol domain to the list of supported domains + * Note: you cant unload it again because a socket may be using it. + * XXX can't fail at this time. + */ +static void +net_init_domain(struct domain *dp) +{ + register struct protosw *pr; + int s; + + s = splnet(); + log(LOG_INIT, "New domain %s at %p\n", dp->dom_name, dp->dom_init); + if (dp->dom_init) + (*dp->dom_init)(); + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++){ + if (pr->pr_usrreqs == 0) + panic("domaininit: %ssw[%d] has no usrreqs!", + dp->dom_name, + (int)(pr - dp->dom_protosw)); + if (pr->pr_init) + (*pr->pr_init)(); + } + /* + * update global informatio about maximums + */ + max_hdr = max_linkhdr + max_protohdr; + max_datalen = MHLEN - max_hdr; + splx(s); +} + +/* + * Add a new protocol domain to the list of supported domains + * Note: you cant unload it again because a socket may be using it. + * XXX can't fail at this time. + */ +void +net_add_domain(void *data) +{ + int s; + struct domain *dp; + + dp = (struct domain *)data; + s = splnet(); + dp->dom_next = domains; + domains = dp; + splx(s); + net_init_domain(dp); +} + +/* ARGSUSED*/ +static void +domaininit(void *dummy) +{ + /* + * Before we do any setup, make sure to initialize the + * zone allocator we get struct sockets from. The obvious + * maximum number of sockets is `maxfiles', but it is possible + * to have a socket without an open file (e.g., a connection waiting + * to be accept(2)ed). Rather than think up and define a + * better value, we just use nmbclusters, since that's what people + * are told to increase first when the network runs out of memory. + * Perhaps we should have two pools, one of unlimited size + * for use during socreate(), and one ZONE_INTERRUPT pool for + * use in sonewconn(). + */ + socket_zone = zinit("socket", sizeof(struct socket), maxsockets, + ZONE_INTERRUPT, 0); + + if (max_linkhdr < 16) /* XXX */ + max_linkhdr = 16; + + timeout(pffasttimo, (void *)0, 1); + timeout(pfslowtimo, (void *)0, 1); +} + + +struct protosw * +pffindtype(family, type) + int family; + int type; +{ + register struct domain *dp; + register struct protosw *pr; + + for (dp = domains; dp; dp = dp->dom_next) + if (dp->dom_family == family) + goto found; + return (0); +found: + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) + if (pr->pr_type && pr->pr_type == type) + return (pr); + return (0); +} + +struct protosw * +pffindproto(family, protocol, type) + int family; + int protocol; + int type; +{ + register struct domain *dp; + register struct protosw *pr; + struct protosw *maybe = 0; + + if (family == 0) + return (0); + for (dp = domains; dp; dp = dp->dom_next) + if (dp->dom_family == family) + goto found; + return (0); +found: + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { + if ((pr->pr_protocol == protocol) && (pr->pr_type == type)) + return (pr); + + if (type == SOCK_RAW && pr->pr_type == SOCK_RAW && + pr->pr_protocol == 0 && maybe == (struct protosw *)0) + maybe = pr; + } + return (maybe); +} + +void +pfctlinput(cmd, sa) + int cmd; + struct sockaddr *sa; +{ + register struct domain *dp; + register struct protosw *pr; + + for (dp = domains; dp; dp = dp->dom_next) + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) + if (pr->pr_ctlinput) + (*pr->pr_ctlinput)(cmd, sa, (void *)0); +} + +void +pfctlinput2(cmd, sa, ctlparam) + int cmd; + struct sockaddr *sa; + void *ctlparam; +{ + struct domain *dp; + struct protosw *pr; + + if (!sa) + return; + for (dp = domains; dp; dp = dp->dom_next) { + /* + * the check must be made by xx_ctlinput() anyways, to + * make sure we use data item pointed to by ctlparam in + * correct way. the following check is made just for safety. + */ + if (dp->dom_family != sa->sa_family) + continue; + + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) + if (pr->pr_ctlinput) + (*pr->pr_ctlinput)(cmd, sa, ctlparam); + } +} + +static void +pfslowtimo(arg) + void *arg; +{ + register struct domain *dp; + register struct protosw *pr; + + for (dp = domains; dp; dp = dp->dom_next) + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) + if (pr->pr_slowtimo) + (*pr->pr_slowtimo)(); + timeout(pfslowtimo, (void *)0, hz/2); +} + +static void +pffasttimo(arg) + void *arg; +{ + register struct domain *dp; + register struct protosw *pr; + + for (dp = domains; dp; dp = dp->dom_next) + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) + if (pr->pr_fasttimo) + (*pr->pr_fasttimo)(); + timeout(pffasttimo, (void *)0, hz/5); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c @@ -0,0 +1,1166 @@ +//========================================================================== +// +// src/sys/kern/uipc_mbuf.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 1991, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/sys/kern/uipc_mbuf.c,v 1.51.2.7 2001/07/30 23:28:00 peter Exp $ + */ + +#include +#include +#include +#include +#include + +static void mbinit __P((void *)); +SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbinit, NULL) + +struct mbuf *mbutl; +char *mclrefcnt; +struct mbstat mbstat; +u_long mbtypes[MT_NTYPES]; +struct mbuf *mmbfree; +union mcluster *mclfree; +int max_linkhdr; +int max_protohdr; +int max_hdr; +int max_datalen; +u_int m_mballoc_wid = 0; +u_int m_clalloc_wid = 0; + +int mbuf_wait = 32; // Time in ticks to wait for mbufs to come free + +static void m_reclaim __P((void)); + +#ifndef NMBCLUSTERS +#define NMBCLUSTERS (512 + maxusers * 16) +#endif +#ifndef NMBUFS +#define NMBUFS (nmbclusters * 4) +#endif + + +/* "number of clusters of pages" */ +#define NCL_INIT 1 + +#define NMB_INIT 16 + +/* ARGSUSED*/ +static void +mbinit(dummy) + void *dummy; +{ + int s; + + mmbfree = NULL; mclfree = NULL; + mbstat.m_msize = MSIZE; + mbstat.m_mclbytes = MCLBYTES; + mbstat.m_minclsize = MINCLSIZE; + mbstat.m_mlen = MLEN; + mbstat.m_mhlen = MHLEN; + + s = splimp(); + if (m_mballoc(NMB_INIT, M_DONTWAIT) == 0) + goto bad; +#if MCLBYTES <= PAGE_SIZE + if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0) + goto bad; +#else + /* It's OK to call contigmalloc in this context. */ + if (m_clalloc(16, M_WAIT) == 0) + goto bad; +#endif + splx(s); + return; +bad: + panic("mbinit"); +} + +/* + * Allocate at least nmb mbufs and place on mbuf free list. + * Must be called at splimp. + */ +/* ARGSUSED */ +int +m_mballoc(nmb, how) + register int nmb; + int how; +{ + struct mbuf *p; + int i; + + for (i = 0; i < nmb; i++) { + p = (struct mbuf *)cyg_net_mbuf_alloc(0, 0); + if (p != (struct mbuf *)0) { + ((struct mbuf *)p)->m_next = mmbfree; + mmbfree = (struct mbuf *)p; + mbstat.m_mbufs++; + mbtypes[MT_FREE]++; + } else { + // Warn - out of mbufs? + return (0); + } + } + return (1); +} + +/* + * Once the mb_map has been exhausted and if the call to the allocation macros + * (or, in some cases, functions) is with M_WAIT, then it is necessary to rely + * solely on reclaimed mbufs. Here we wait for an mbuf to be freed for a + * designated (mbuf_wait) time. + */ +struct mbuf * +m_mballoc_wait(int caller, int type) +{ + struct mbuf *p; + int s; + + s = splimp(); + m_mballoc_wid++; + if ((tsleep(&m_mballoc_wid, PVM, "mballc", mbuf_wait)) == EWOULDBLOCK) + m_mballoc_wid--; + splx(s); + + /* + * Now that we (think) that we've got something, we will redo an + * MGET, but avoid getting into another instance of m_mballoc_wait() + * XXX: We retry to fetch _even_ if the sleep timed out. This is left + * this way, purposely, in the [unlikely] case that an mbuf was + * freed but the sleep was not awakened in time. + */ + p = NULL; + switch (caller) { + case MGET_C: + MGET(p, M_DONTWAIT, type); + break; + case MGETHDR_C: + MGETHDR(p, M_DONTWAIT, type); + break; + default: + panic("m_mballoc_wait: invalid caller (%d)", caller); + } + + s = splimp(); + if (p != NULL) { /* We waited and got something... */ + mbstat.m_wait++; + /* Wake up another if we have more free. */ + if (mmbfree != NULL) + MMBWAKEUP(); + } + splx(s); + return (p); +} + +#if MCLBYTES > PAGE_SIZE +static int i_want_my_mcl; + +static void +kproc_mclalloc(void) +{ + int status; + + while (1) { + tsleep(&i_want_my_mcl, PVM, "mclalloc", 0); + + for (; i_want_my_mcl; i_want_my_mcl--) { + if (m_clalloc(1, M_WAIT) == 0) + printf("m_clalloc failed even in process context!\n"); + } + } +} + +static struct proc *mclallocproc; +static struct kproc_desc mclalloc_kp = { + "mclalloc", + kproc_mclalloc, + &mclallocproc +}; +SYSINIT(mclallocproc, SI_SUB_KTHREAD_UPDATE, SI_ORDER_ANY, kproc_start, + &mclalloc_kp); +#endif + +/* + * Allocate some number of mbuf clusters + * and place on cluster free list. + * Must be called at splimp. + */ +/* ARGSUSED */ +int +m_clalloc(ncl, how) + register int ncl; + int how; +{ + union mcluster *p; + int i; + + for (i = 0; i < ncl; i++) { + p = (union mcluster *)cyg_net_cluster_alloc(); + if (p != (union mcluster *)0) { + ((union mcluster *)p)->mcl_next = mclfree; + mclfree = (union mcluster *)p; + mbstat.m_clfree++; + mbstat.m_clusters++; + } else { + // Warn - no more clusters? + return (0); + } + } + return (1); +} + +/* + * Once the mb_map submap has been exhausted and the allocation is called with + * M_WAIT, we rely on the mclfree union pointers. If nothing is free, we will + * sleep for a designated amount of time (mbuf_wait) or until we're woken up + * due to sudden mcluster availability. + */ +caddr_t +m_clalloc_wait(void) +{ + caddr_t p; + int s; + + /* Sleep until something's available or until we expire. */ + m_clalloc_wid++; + if ((tsleep(&m_clalloc_wid, PVM, "mclalc", mbuf_wait)) == EWOULDBLOCK) + m_clalloc_wid--; + + /* + * Now that we (think) that we've got something, we will redo and + * MGET, but avoid getting into another instance of m_clalloc_wait() + */ + p = NULL; + MCLALLOC(p, M_DONTWAIT); + + s = splimp(); + if (p != NULL) { /* We waited and got something... */ + mbstat.m_wait++; + /* Wake up another if we have more free. */ + if (mclfree != NULL) + MCLWAKEUP(); + } + + splx(s); + return (p); +} + +/* + * When MGET fails, ask protocols to free space when short of memory, + * then re-attempt to allocate an mbuf. + */ +struct mbuf * +m_retry(i, t) + int i, t; +{ + register struct mbuf *m; + + /* + * Must only do the reclaim if not in an interrupt context. + */ + if (i == M_WAIT) { + m_reclaim(); + } + + /* + * Both m_mballoc_wait and m_retry must be nulled because + * when the MGET macro is run from here, we deffinately do _not_ + * want to enter an instance of m_mballoc_wait() or m_retry() (again!) + */ +#undef m_retry +#undef m_mballoc_wait +#define m_mballoc_wait(caller,type) (struct mbuf *)0 +#define m_retry(i, t) (struct mbuf *)0 + MGET(m, i, t); +#undef m_retry +#undef m_mballoc_wait +#define m_retry cyg_m_retry +#define m_retryhdr cyg_m_retryhdr +#define m_mballoc_wait cyg_m_mballoc_wait + + if (m != NULL) + mbstat.m_wait++; + else + mbstat.m_drops++; + + return (m); +} + +/* + * As above; retry an MGETHDR. + */ +struct mbuf * +m_retryhdr(i, t) + int i, t; +{ + register struct mbuf *m; + + /* + * Must only do the reclaim if not in an interrupt context. + */ + if (i == M_WAIT) { + m_reclaim(); + } + +#undef m_retryhdr +#undef m_mballoc_wait +#define m_mballoc_wait(caller,type) (struct mbuf *)0 +#define m_retryhdr(i, t) (struct mbuf *)0 + MGETHDR(m, i, t); +#undef m_retryhdr +#undef m_mballoc_wait +#define m_retry cyg_m_retry +#define m_retryhdr cyg_m_retryhdr +#define m_mballoc_wait cyg_m_mballoc_wait + + if (m != NULL) + mbstat.m_wait++; + else + mbstat.m_drops++; + + return (m); +} + +static void +m_reclaim() +{ + register struct domain *dp; + register struct protosw *pr; + int s = splimp(); + + for (dp = domains; dp; dp = dp->dom_next) + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) + if (pr->pr_drain) + (*pr->pr_drain)(); + splx(s); + mbstat.m_drain++; +} + +/* + * Space allocation routines. + * These are also available as macros + * for critical paths. + */ +struct mbuf * +m_get(how, type) + int how, type; +{ + register struct mbuf *m; + + MGET(m, how, type); + return (m); +} + +struct mbuf * +m_gethdr(how, type) + int how, type; +{ + register struct mbuf *m; + + MGETHDR(m, how, type); + return (m); +} + +struct mbuf * +m_getclr(how, type) + int how, type; +{ + register struct mbuf *m; + + MGET(m, how, type); + if (m == 0) + return (0); + bzero(mtod(m, caddr_t), MLEN); + return (m); +} + +/* + * struct mbuf * + * m_getm(m, len, how, type) + * + * This will allocate len-worth of mbufs and/or mbuf clusters (whatever fits + * best) and return a pointer to the top of the allocated chain. If m is + * non-null, then we assume that it is a single mbuf or an mbuf chain to + * which we want len bytes worth of mbufs and/or clusters attached, and so + * if we succeed in allocating it, we will just return a pointer to m. + * + * If we happen to fail at any point during the allocation, we will free + * up everything we have already allocated and return NULL. + * + */ +struct mbuf * +m_getm(struct mbuf *m, int len, int how, int type) +{ + struct mbuf *top, *tail, *mp, *mtail = NULL; + + MGET(mp, how, type); + if (mp == NULL) + return (NULL); + else if (len > MINCLSIZE) { + MCLGET(mp, how); + if ((mp->m_flags & M_EXT) == 0) { + m_free(mp); + return (NULL); + } + } + mp->m_len = 0; + len -= M_TRAILINGSPACE(mp); + + if (m != NULL) + for (mtail = m; mtail->m_next != NULL; mtail = mtail->m_next); + else + m = mp; + + top = tail = mp; + while (len > 0) { + MGET(mp, how, type); + if (mp == NULL) + goto failed; + + tail->m_next = mp; + tail = mp; + if (len > MINCLSIZE) { + MCLGET(mp, how); + if ((mp->m_flags & M_EXT) == 0) + goto failed; + } + + mp->m_len = 0; + len -= M_TRAILINGSPACE(mp); + } + + if (mtail != NULL) + mtail->m_next = top; + return (m); + +failed: + m_freem(top); + return (NULL); +} + +struct mbuf * +m_free(m) + struct mbuf *m; +{ + register struct mbuf *n; + + MFREE(m, n); + return (n); +} + +void +m_freem(m) + register struct mbuf *m; +{ + register struct mbuf *n; + struct mbuf *orig = m; + + if (m == NULL) + return; + do { + MFREE(m, n); + m = n; + if (m == orig) { + diag_printf("DEBUG: Circular MBUF %p!\n", orig); + return; + } + } while (m); +} + +/* + * Mbuffer utility routines. + */ + +/* + * Lesser-used path for M_PREPEND: + * allocate new mbuf to prepend to chain, + * copy junk along. + */ +struct mbuf * +m_prepend(m, len, how) + register struct mbuf *m; + int len, how; +{ + struct mbuf *mn; + + MGET(mn, how, m->m_type); + if (mn == (struct mbuf *)NULL) { + m_freem(m); + return ((struct mbuf *)NULL); + } + if (m->m_flags & M_PKTHDR) { + M_COPY_PKTHDR(mn, m); + m->m_flags &= ~M_PKTHDR; + } + mn->m_next = m; + m = mn; + if (len < MHLEN) + MH_ALIGN(m, len); + m->m_len = len; + return (m); +} + +/* + * Make a copy of an mbuf chain starting "off0" bytes from the beginning, + * continuing for "len" bytes. If len is M_COPYALL, copy to end of mbuf. + * The wait parameter is a choice of M_WAIT/M_DONTWAIT from caller. + * Note that the copy is read-only, because clusters are not copied, + * only their reference counts are incremented. + */ +#define MCFail (mbstat.m_mcfail) + +struct mbuf * +m_copym(m, off0, len, wait) + register struct mbuf *m; + int off0, wait; + register int len; +{ + register struct mbuf *n, **np; + register int off = off0; + struct mbuf *top; + int copyhdr = 0; + + if (off == 0 && m->m_flags & M_PKTHDR) + copyhdr = 1; + while (off > 0) { + if (off < m->m_len) + break; + off -= m->m_len; + m = m->m_next; + } + np = ⊤ + top = 0; + while (len > 0) { + if (m == 0) { + break; + } + MGET(n, wait, m->m_type); + *np = n; + if (n == 0) + goto nospace; + if (copyhdr) { + M_COPY_PKTHDR(n, m); + if (len == M_COPYALL) + n->m_pkthdr.len -= off0; + else + n->m_pkthdr.len = len; + copyhdr = 0; + } + n->m_len = min(len, m->m_len - off); + if (m->m_flags & M_EXT) { + n->m_data = m->m_data + off; + if(!m->m_ext.ext_ref) + mclrefcnt[mtocl(m->m_ext.ext_buf)]++; + else + (*(m->m_ext.ext_ref))(m->m_ext.ext_buf, + m->m_ext.ext_size); + n->m_ext = m->m_ext; + n->m_flags |= M_EXT; + } else + bcopy(mtod(m, caddr_t)+off, mtod(n, caddr_t), + (unsigned)n->m_len); + if (len != M_COPYALL) + len -= n->m_len; + off = 0; + m = m->m_next; + np = &n->m_next; + } + if (top == 0) + MCFail++; + return (top); +nospace: + m_freem(top); + MCFail++; + return (0); +} + +/* + * Copy an entire packet, including header (which must be present). + * An optimization of the common case `m_copym(m, 0, M_COPYALL, how)'. + * Note that the copy is read-only, because clusters are not copied, + * only their reference counts are incremented. + */ +struct mbuf * +m_copypacket(m, how) + struct mbuf *m; + int how; +{ + struct mbuf *top, *n, *o; + + MGET(n, how, m->m_type); + top = n; + if (!n) + goto nospace; + + M_COPY_PKTHDR(n, m); + n->m_len = m->m_len; + if (m->m_flags & M_EXT) { + n->m_data = m->m_data; + if(!m->m_ext.ext_ref) + mclrefcnt[mtocl(m->m_ext.ext_buf)]++; + else + (*(m->m_ext.ext_ref))(m->m_ext.ext_buf, + m->m_ext.ext_size); + n->m_ext = m->m_ext; + n->m_flags |= M_EXT; + } else { + bcopy(mtod(m, char *), mtod(n, char *), n->m_len); + } + + m = m->m_next; + while (m) { + MGET(o, how, m->m_type); + if (!o) + goto nospace; + + n->m_next = o; + n = n->m_next; + + n->m_len = m->m_len; + if (m->m_flags & M_EXT) { + n->m_data = m->m_data; + if(!m->m_ext.ext_ref) + mclrefcnt[mtocl(m->m_ext.ext_buf)]++; + else + (*(m->m_ext.ext_ref))(m->m_ext.ext_buf, + m->m_ext.ext_size); + n->m_ext = m->m_ext; + n->m_flags |= M_EXT; + } else { + bcopy(mtod(m, char *), mtod(n, char *), n->m_len); + } + + m = m->m_next; + } + return top; +nospace: + m_freem(top); + MCFail++; + return 0; +} + +/* + * Copy data from an mbuf chain starting "off" bytes from the beginning, + * continuing for "len" bytes, into the indicated buffer. + */ +void +m_copydata(m, off, len, cp) + register struct mbuf *m; + register int off; + register int len; + caddr_t cp; +{ + register unsigned count; + + while (off > 0) { + if (off < m->m_len) + break; + off -= m->m_len; + m = m->m_next; + } + while (len > 0) { + count = min(m->m_len - off, len); + bcopy(mtod(m, caddr_t) + off, cp, count); + len -= count; + cp += count; + off = 0; + m = m->m_next; + } +} + +/* + * Copy a packet header mbuf chain into a completely new chain, including + * copying any mbuf clusters. Use this instead of m_copypacket() when + * you need a writable copy of an mbuf chain. + */ +struct mbuf * +m_dup(m, how) + struct mbuf *m; + int how; +{ + struct mbuf **p, *top = NULL; + int remain, moff, nsize; + + /* Sanity check */ + if (m == NULL) + return (0); + + /* While there's more data, get a new mbuf, tack it on, and fill it */ + remain = m->m_pkthdr.len; + moff = 0; + p = ⊤ + while (remain > 0 || top == NULL) { /* allow m->m_pkthdr.len == 0 */ + struct mbuf *n; + + /* Get the next new mbuf */ + MGET(n, how, m->m_type); + if (n == NULL) + goto nospace; + if (top == NULL) { /* first one, must be PKTHDR */ + M_COPY_PKTHDR(n, m); + nsize = MHLEN; + } else /* not the first one */ + nsize = MLEN; + if (remain >= MINCLSIZE) { + MCLGET(n, how); + if ((n->m_flags & M_EXT) == 0) { + (void)m_free(n); + goto nospace; + } + nsize = MCLBYTES; + } + n->m_len = 0; + + /* Link it into the new chain */ + *p = n; + p = &n->m_next; + + /* Copy data from original mbuf(s) into new mbuf */ + while (n->m_len < nsize && m != NULL) { + int chunk = min(nsize - n->m_len, m->m_len - moff); + + bcopy(m->m_data + moff, n->m_data + n->m_len, chunk); + moff += chunk; + n->m_len += chunk; + remain -= chunk; + if (moff == m->m_len) { + m = m->m_next; + moff = 0; + } + } + } + return (top); + +nospace: + m_freem(top); + MCFail++; + return (0); +} + +/* + * Concatenate mbuf chain n to m. + * Both chains must be of the same type (e.g. MT_DATA). + * Any m_pkthdr is not updated. + */ +void +m_cat(m, n) + register struct mbuf *m, *n; +{ + while (m->m_next) + m = m->m_next; + while (n) { + if (m->m_flags & M_EXT || + m->m_data + m->m_len + n->m_len >= &m->m_dat[MLEN]) { + /* just join the two chains */ + m->m_next = n; + return; + } + /* splat the data from one into the other */ + bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len, + (u_int)n->m_len); + m->m_len += n->m_len; + n = m_free(n); + } +} + +void +m_adj(mp, req_len) + struct mbuf *mp; + int req_len; +{ + register int len = req_len; + register struct mbuf *m; + register int count; + + if ((m = mp) == NULL) + return; + if (len >= 0) { + /* + * Trim from head. + */ + while (m != NULL && len > 0) { + if (m->m_len <= len) { + len -= m->m_len; + m->m_len = 0; + m = m->m_next; + } else { + m->m_len -= len; + m->m_data += len; + len = 0; + } + } + m = mp; + if (mp->m_flags & M_PKTHDR) + m->m_pkthdr.len -= (req_len - len); + } else { + /* + * Trim from tail. Scan the mbuf chain, + * calculating its length and finding the last mbuf. + * If the adjustment only affects this mbuf, then just + * adjust and return. Otherwise, rescan and truncate + * after the remaining size. + */ + len = -len; + count = 0; + for (;;) { + count += m->m_len; + if (m->m_next == (struct mbuf *)0) + break; + m = m->m_next; + } + if (m->m_len >= len) { + m->m_len -= len; + if (mp->m_flags & M_PKTHDR) + mp->m_pkthdr.len -= len; + return; + } + count -= len; + if (count < 0) + count = 0; + /* + * Correct length for chain is "count". + * Find the mbuf with last data, adjust its length, + * and toss data from remaining mbufs on chain. + */ + m = mp; + if (m->m_flags & M_PKTHDR) + m->m_pkthdr.len = count; + for (; m; m = m->m_next) { + if (m->m_len >= count) { + m->m_len = count; + break; + } + count -= m->m_len; + } + while (m->m_next) + (m = m->m_next) ->m_len = 0; + } +} + +/* + * Rearange an mbuf chain so that len bytes are contiguous + * and in the data area of an mbuf (so that mtod and dtom + * will work for a structure of size len). Returns the resulting + * mbuf chain on success, frees it and returns null on failure. + * If there is room, it will add up to max_protohdr-len extra bytes to the + * contiguous region in an attempt to avoid being called next time. + */ +#define MPFail (mbstat.m_mpfail) + +struct mbuf * +m_pullup(n, len) + register struct mbuf *n; + int len; +{ + register struct mbuf *m; + register int count; + int space; + + /* + * If first mbuf has no cluster, and has room for len bytes + * without shifting current data, pullup into it, + * otherwise allocate a new mbuf to prepend to the chain. + */ + if ((n->m_flags & M_EXT) == 0 && + n->m_data + len < &n->m_dat[MLEN] && n->m_next) { + if (n->m_len >= len) + return (n); + m = n; + n = n->m_next; + len -= m->m_len; + } else { + if (len > MHLEN) + goto bad; + MGET(m, M_DONTWAIT, n->m_type); + if (m == 0) + goto bad; + m->m_len = 0; + if (n->m_flags & M_PKTHDR) { + M_COPY_PKTHDR(m, n); + n->m_flags &= ~M_PKTHDR; + } + } + space = &m->m_dat[MLEN] - (m->m_data + m->m_len); + do { + count = min(min(max(len, max_protohdr), space), n->m_len); + bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len, + (unsigned)count); + len -= count; + m->m_len += count; + n->m_len -= count; + space -= count; + if (n->m_len) + n->m_data += count; + else + n = m_free(n); + } while (len > 0 && n); + if (len > 0) { + (void) m_free(m); + goto bad; + } + m->m_next = n; + return (m); +bad: + m_freem(n); + MPFail++; + return (0); +} + +/* + * Partition an mbuf chain in two pieces, returning the tail -- + * all but the first len0 bytes. In case of failure, it returns NULL and + * attempts to restore the chain to its original state. + */ +struct mbuf * +m_split(m0, len0, wait) + register struct mbuf *m0; + int len0, wait; +{ + register struct mbuf *m, *n; + unsigned len = len0, remain; + + for (m = m0; m && len > m->m_len; m = m->m_next) + len -= m->m_len; + if (m == 0) + return (0); + remain = m->m_len - len; + if (m0->m_flags & M_PKTHDR) { + MGETHDR(n, wait, m0->m_type); + if (n == 0) + return (0); + n->m_pkthdr.rcvif = m0->m_pkthdr.rcvif; + n->m_pkthdr.len = m0->m_pkthdr.len - len0; + m0->m_pkthdr.len = len0; + if (m->m_flags & M_EXT) + goto extpacket; + if (remain > MHLEN) { + /* m can't be the lead packet */ + MH_ALIGN(n, 0); + n->m_next = m_split(m, len, wait); + if (n->m_next == 0) { + (void) m_free(n); + return (0); + } else + return (n); + } else + MH_ALIGN(n, remain); + } else if (remain == 0) { + n = m->m_next; + m->m_next = 0; + return (n); + } else { + MGET(n, wait, m->m_type); + if (n == 0) + return (0); + M_ALIGN(n, remain); + } +extpacket: + if (m->m_flags & M_EXT) { + n->m_flags |= M_EXT; + n->m_ext = m->m_ext; + if(!m->m_ext.ext_ref) + mclrefcnt[mtocl(m->m_ext.ext_buf)]++; + else + (*(m->m_ext.ext_ref))(m->m_ext.ext_buf, + m->m_ext.ext_size); + m->m_ext.ext_size = 0; /* For Accounting XXXXXX danger */ + n->m_data = m->m_data + len; + } else { + bcopy(mtod(m, caddr_t) + len, mtod(n, caddr_t), remain); + } + n->m_len = remain; + m->m_len = len; + n->m_next = m->m_next; + m->m_next = 0; + return (n); +} +/* + * Routine to copy from device local memory into mbufs. + */ +struct mbuf * +m_devget(buf, totlen, off0, ifp, copy) + char *buf; + int totlen, off0; + struct ifnet *ifp; + void (*copy) __P((char *from, caddr_t to, u_int len)); +{ + register struct mbuf *m; + struct mbuf *top = 0, **mp = ⊤ + register int off = off0, len; + register char *cp; + char *epkt; + + cp = buf; + epkt = cp + totlen; + if (off) { + cp += off + 2 * sizeof(u_short); + totlen -= 2 * sizeof(u_short); + } + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m == 0) + return (0); + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = totlen; + m->m_len = MHLEN; + + while (totlen > 0) { + if (top) { + MGET(m, M_DONTWAIT, MT_DATA); + if (m == 0) { + m_freem(top); + return (0); + } + m->m_len = MLEN; + } + len = min(totlen, epkt - cp); + if (len >= MINCLSIZE) { + MCLGET(m, M_DONTWAIT); + if (m->m_flags & M_EXT) + m->m_len = len = min(len, MCLBYTES); + else + len = m->m_len; + } else { + /* + * Place initial small packet/header at end of mbuf. + */ + if (len < m->m_len) { + if (top == 0 && len + max_linkhdr <= m->m_len) + m->m_data += max_linkhdr; + m->m_len = len; + } else + len = m->m_len; + } + if (copy) + copy(cp, mtod(m, caddr_t), (unsigned)len); + else + bcopy(cp, mtod(m, caddr_t), (unsigned)len); + cp += len; + *mp = m; + mp = &m->m_next; + totlen -= len; + if (cp == epkt) + cp = buf; + } + return (top); +} + +/* + * Copy data from a buffer back into the indicated mbuf chain, + * starting "off" bytes from the beginning, extending the mbuf + * chain if necessary. + */ +void +m_copyback(m0, off, len, cp) + struct mbuf *m0; + register int off; + register int len; + caddr_t cp; +{ + register int mlen; + register struct mbuf *m = m0, *n; + int totlen = 0; + + if (m0 == 0) + return; + while (off > (mlen = m->m_len)) { + off -= mlen; + totlen += mlen; + if (m->m_next == 0) { + n = m_getclr(M_DONTWAIT, m->m_type); + if (n == 0) + goto out; + n->m_len = min(MLEN, len + off); + m->m_next = n; + } + m = m->m_next; + } + while (len > 0) { + mlen = min (m->m_len - off, len); + bcopy(cp, off + mtod(m, caddr_t), (unsigned)mlen); + cp += mlen; + len -= mlen; + mlen += off; + off = 0; + totlen += mlen; + if (len == 0) + break; + if (m->m_next == 0) { + n = m_get(M_DONTWAIT, m->m_type); + if (n == 0) + break; + n->m_len = min(MLEN, len); + m->m_next = n; + } + m = m->m_next; + } +out: if (((m = m0)->m_flags & M_PKTHDR) && (m->m_pkthdr.len < totlen)) + m->m_pkthdr.len = totlen; +} + +#ifndef __ECOS +void +m_print(const struct mbuf *m) +{ + int len; + const struct mbuf *m2; + + len = m->m_pkthdr.len; + m2 = m; + while (len) { + printf("%p %*D\n", m2, m2->m_len, (u_char *)m2->m_data, "-"); + len -= m2->m_len; + m2 = m2->m_next; + } + return; +} +#endif + diff --git a/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf2.c b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf2.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf2.c @@ -0,0 +1,685 @@ +//========================================================================== +// +// src/sys/kern/uipc_mbuf2.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: uipc_mbuf2.c,v 1.31 2001/11/28 11:08:53 itojun Exp $ */ +/* $NetBSD: uipc_mbuf.c,v 1.40 1999/04/01 00:23:25 thorpej Exp $ */ + +/* + * Copyright (C) 1999 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 1988, 1991, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)uipc_mbuf.c 8.4 (Berkeley) 2/14/95 + */ + +#include +#include +#include + +#ifdef __bsdi__ +#define M_SHAREDCLUSTER(m) \ + (((m)->m_flags & M_EXT) != 0 && \ + ((m)->m_ext.ext_func || mclrefcnt[mtocl((m)->m_ext.ext_buf)] > 1)) +#elif defined(__NetBSD__) || defined(__OpenBSD__) +#define M_SHAREDCLUSTER(m) \ + (((m)->m_flags & M_EXT) != 0 && \ + ((m)->m_ext.ext_free || MCLISREFERENCED((m)))) +#else +#define M_SHAREDCLUSTER(m) \ + (((m)->m_flags & M_EXT) != 0 && \ + ((m)->m_ext.ext_free || mclrefcnt[mtocl((m)->m_ext.ext_buf)] > 1)) +#endif + +#ifndef __NetBSD__ +/* can't call it m_dup(), as freebsd[34] uses m_dup() with different arg */ +static struct mbuf *m_dup1 __P((struct mbuf *, int, int, int)); +#endif + +/* + * ensure that [off, off + len) is contiguous on the mbuf chain "m". + * packet chain before "off" is kept untouched. + * if offp == NULL, the target will start at on resulting chain. + * if offp != NULL, the target will start at on resulting chain. + * + * on error return (NULL return value), original "m" will be freed. + * + * XXX M_TRAILINGSPACE/M_LEADINGSPACE on shared cluster (sharedcluster) + */ +struct mbuf * +m_pulldown(m, off, len, offp) + struct mbuf *m; + int off, len; + int *offp; +{ + struct mbuf *n, *o; + int hlen, tlen, olen; + int sharedcluster; +#ifdef PULLDOWN_STAT + static struct mbuf *prev = NULL; + int prevlen = 0, prevmlen = 0; +#endif + + /* check invalid arguments. */ + if (m == NULL) + panic("m == NULL in m_pulldown()"); + if (len > MCLBYTES) { + m_freem(m); + return NULL; /* impossible */ + } + +#ifdef PULLDOWN_STAT + mbstat.m_pulldowns++; +#endif + +#ifdef PULLDOWN_STAT + /* statistics for m_pullup */ + mbstat.m_pullups++; + if (off + len > MHLEN) + mbstat.m_pullup_fail++; + else { + int dlen, mlen; + + dlen = (prev == m) ? prevlen : m->m_len; + mlen = (prev == m) ? prevmlen : m->m_len + M_TRAILINGSPACE(m); + + if (dlen >= off + len) + mbstat.m_pullups--; /* call will not be made! */ + else if ((m->m_flags & M_EXT) != 0) { + mbstat.m_pullup_alloc++; + mbstat.m_pullup_copy++; + } else { + if (mlen >= off + len) + mbstat.m_pullup_copy++; + else { + mbstat.m_pullup_alloc++; + mbstat.m_pullup_copy++; + } + } + + prevlen = off + len; + prevmlen = MHLEN; + } + + /* statistics for m_pullup2 */ + mbstat.m_pullup2++; + if (off + len > MCLBYTES) + mbstat.m_pullup2_fail++; + else { + int dlen, mlen; + + dlen = (prev == m) ? prevlen : m->m_len; + mlen = (prev == m) ? prevmlen : m->m_len + M_TRAILINGSPACE(m); + prevlen = off + len; + prevmlen = mlen; + + if (dlen >= off + len) + mbstat.m_pullup2--; /* call will not be made! */ + else if ((m->m_flags & M_EXT) != 0) { + mbstat.m_pullup2_alloc++; + mbstat.m_pullup2_copy++; + prevmlen = (off + len > MHLEN) ? MCLBYTES : MHLEN; + } else { + if (mlen >= off + len) + mbstat.m_pullup2_copy++; + else { + mbstat.m_pullup2_alloc++; + mbstat.m_pullup2_copy++; + prevmlen = (off + len > MHLEN) ? MCLBYTES + : MHLEN; + } + } + } + + prev = m; +#endif + +#ifdef PULLDOWN_DEBUG + { + struct mbuf *t; + printf("before:"); + for (t = m; t; t = t->m_next) + printf(" %d", t->m_len); + printf("\n"); + } +#endif + n = m; + while (n != NULL && off > 0) { + if (n->m_len > off) + break; + off -= n->m_len; + n = n->m_next; + } + /* be sure to point non-empty mbuf */ + while (n != NULL && n->m_len == 0) + n = n->m_next; + if (!n) { + m_freem(m); + return NULL; /* mbuf chain too short */ + } + + sharedcluster = M_SHAREDCLUSTER(n); + + /* + * the target data is on . + * if we got enough data on the mbuf "n", we're done. + */ + if ((off == 0 || offp) && len <= n->m_len - off && !sharedcluster) + goto ok; + +#ifdef PULLDOWN_STAT + mbstat.m_pulldown_copy++; +#endif + + /* + * when len <= n->m_len - off and off != 0, it is a special case. + * len bytes from sits in single mbuf, but the caller does + * not like the starting position (off). + * chop the current mbuf into two pieces, set off to 0. + */ + if (len <= n->m_len - off) { +#ifdef __NetBSD__ + o = m_dup(n, off, n->m_len - off, M_DONTWAIT); +#else + o = m_dup1(n, off, n->m_len - off, M_DONTWAIT); +#endif + if (o == NULL) { + m_freem(m); + return NULL; /* ENOBUFS */ + } + n->m_len = off; + o->m_next = n->m_next; + n->m_next = o; + n = n->m_next; + off = 0; + goto ok; + } + + /* + * we need to take hlen from and tlen from m_next, 0>, + * and construct contiguous mbuf with m_len == len. + * note that hlen + tlen == len, and tlen > 0. + */ + hlen = n->m_len - off; + tlen = len - hlen; + + /* + * ensure that we have enough trailing data on mbuf chain. + * if not, we can do nothing about the chain. + */ + olen = 0; + for (o = n->m_next; o != NULL; o = o->m_next) + olen += o->m_len; + if (hlen + olen < len) { + m_freem(m); + return NULL; /* mbuf chain too short */ + } + + /* + * easy cases first. + * we need to use m_copydata() to get data from m_next, 0>. + */ + if ((off == 0 || offp) && M_TRAILINGSPACE(n) >= tlen && + !sharedcluster) { + m_copydata(n->m_next, 0, tlen, mtod(n, caddr_t) + n->m_len); + n->m_len += tlen; + m_adj(n->m_next, tlen); + goto ok; + } + if ((off == 0 || offp) && M_LEADINGSPACE(n->m_next) >= hlen && + !sharedcluster) { + n->m_next->m_data -= hlen; + n->m_next->m_len += hlen; + bcopy(mtod(n, caddr_t) + off, mtod(n->m_next, caddr_t), hlen); + n->m_len -= hlen; + n = n->m_next; + off = 0; + goto ok; + } + + /* + * now, we need to do the hard way. don't m_copy as there's no room + * on both end. + */ +#ifdef PULLDOWN_STAT + mbstat.m_pulldown_alloc++; +#endif + MGET(o, M_DONTWAIT, m->m_type); + if (o && len > MLEN) { + MCLGET(o, M_DONTWAIT); + if ((o->m_flags & M_EXT) == 0) { + m_free(o); + o = NULL; + } + } + if (!o) { + m_freem(m); + return NULL; /* ENOBUFS */ + } + /* get hlen from into */ + o->m_len = hlen; + bcopy(mtod(n, caddr_t) + off, mtod(o, caddr_t), hlen); + n->m_len -= hlen; + /* get tlen from m_next, 0> into */ + m_copydata(n->m_next, 0, tlen, mtod(o, caddr_t) + o->m_len); + o->m_len += tlen; + m_adj(n->m_next, tlen); + o->m_next = n->m_next; + n->m_next = o; + n = o; + off = 0; + +ok: +#ifdef PULLDOWN_DEBUG + { + struct mbuf *t; + printf("after:"); + for (t = m; t; t = t->m_next) + printf("%c%d", t == n ? '*' : ' ', t->m_len); + printf(" (off=%d)\n", off); + } +#endif + if (offp) + *offp = off; + return n; +} + +#ifndef __NetBSD__ +static struct mbuf * +m_dup1(m, off, len, wait) + struct mbuf *m; + int off; + int len; + int wait; +{ + struct mbuf *n; + int l; + int copyhdr; + + if (len > MCLBYTES) + return NULL; + if (off == 0 && (m->m_flags & M_PKTHDR) != 0) { + copyhdr = 1; + MGETHDR(n, wait, m->m_type); + l = MHLEN; + } else { + copyhdr = 0; + MGET(n, wait, m->m_type); + l = MLEN; + } + if (n && len > l) { + MCLGET(n, wait); + if ((n->m_flags & M_EXT) == 0) { + m_free(n); + n = NULL; + } + } + if (!n) + return NULL; + + if (copyhdr) { +#ifdef __OpenBSD__ + M_MOVE_PKTHDR(n, m); +#else + M_COPY_PKTHDR(n, m); +#endif + } + m_copydata(m, off, len, mtod(n, caddr_t)); + n->m_len = len; + + return n; +} +#endif + +/* + * pkthdr.aux chain manipulation. + * we don't allow clusters at this moment. + */ +struct mbuf * +m_aux_add2(m, af, type, p) + struct mbuf *m; + int af, type; + void *p; +{ + struct mbuf *n; + struct mauxtag *t; + + if ((m->m_flags & M_PKTHDR) == 0) + return NULL; + + n = m_aux_find(m, af, type); + if (n) + return n; + + MGET(n, M_DONTWAIT, m->m_type); + if (n == NULL) + return NULL; + + t = mtod(n, struct mauxtag *); + bzero(t, sizeof(*t)); + t->af = af; + t->type = type; + t->p = p; + n->m_data += sizeof(struct mauxtag); + n->m_len = 0; + n->m_next = m->m_pkthdr.aux; + m->m_pkthdr.aux = n; + return n; +} + +struct mbuf * +m_aux_find2(m, af, type, p) + struct mbuf *m; + int af, type; + void *p; +{ + struct mbuf *n; + struct mauxtag *t; + + if ((m->m_flags & M_PKTHDR) == 0) + return NULL; + + for (n = m->m_pkthdr.aux; n; n = n->m_next) { + t = (struct mauxtag *)n->m_dat; + if (n->m_data != ((caddr_t)t) + sizeof(struct mauxtag)) { + printf("m_aux_find: invalid m_data for mbuf=%p (%p %p)\n", n, t, n->m_data); + continue; + } + if (t->af == af && t->type == type && t->p == p) + return n; + } + return NULL; +} + +struct mbuf * +m_aux_find(m, af, type) + struct mbuf *m; + int af, type; +{ + + return m_aux_find2(m, af, type, NULL); +} + +struct mbuf * +m_aux_add(m, af, type) + struct mbuf *m; + int af, type; +{ + + return m_aux_add2(m, af, type, NULL); +} + +void +m_aux_delete(m, victim) + struct mbuf *m; + struct mbuf *victim; +{ + struct mbuf *n, *prev, *next; + struct mauxtag *t; + + if ((m->m_flags & M_PKTHDR) == 0) + return; + + prev = NULL; + n = m->m_pkthdr.aux; + while (n) { + t = (struct mauxtag *)n->m_dat; + next = n->m_next; + if (n->m_data != ((caddr_t)t) + sizeof(struct mauxtag)) { + printf("m_aux_delete: invalid m_data for mbuf=%p (%p %p)\n", n, t, n->m_data); + prev = n; + n = next; + continue; + } + if (n == victim) { + if (prev) + prev->m_next = n->m_next; + else + m->m_pkthdr.aux = n->m_next; + n->m_next = NULL; + m_free(n); + } else + prev = n; + n = next; + } +} + +#ifdef __OpenBSD__ +/* Get a packet tag structure along with specified data following. */ +struct m_tag * +m_tag_get(type, len, wait) + int type; + int len; + int wait; +{ + struct m_tag *t; + + if (len < 0) + return (NULL); + MALLOC(t, struct m_tag *, len + sizeof(struct m_tag), M_PACKET_TAGS, + wait); + if (t == NULL) + return (NULL); + t->m_tag_id = type; + t->m_tag_len = len; + return (t); +} + +/* Free a packet tag. */ +void +m_tag_free(t) + struct m_tag *t; +{ + FREE(t, M_PACKET_TAGS); +} + +/* Prepend a packet tag. */ +void +m_tag_prepend(m, t) + struct mbuf *m; + struct m_tag *t; +{ + SLIST_INSERT_HEAD(&m->m_pkthdr.tags, t, m_tag_link); +} + +/* Unlink a packet tag. */ +void +m_tag_unlink(m, t) + struct mbuf *m; + struct m_tag *t; +{ + SLIST_REMOVE(&m->m_pkthdr.tags, t, m_tag, m_tag_link); +} + +/* Unlink and free a packet tag. */ +void +m_tag_delete(m, t) + struct mbuf *m; + struct m_tag *t; +{ + m_tag_unlink(m, t); + m_tag_free(t); +} + +/* Unlink and free a packet tag chain, starting from given tag. */ +void +m_tag_delete_chain(m, t) + struct mbuf *m; + struct m_tag *t; +{ + struct m_tag *p, *q; + + if (t != NULL) + p = t; + else + p = SLIST_FIRST(&m->m_pkthdr.tags); + if (p == NULL) + return; + while ((q = SLIST_NEXT(p, m_tag_link)) != NULL) + m_tag_delete(m, q); + m_tag_delete(m, p); +} + +/* Find a tag, starting from a given position. */ +struct m_tag * +m_tag_find(m, type, t) + struct mbuf *m; + int type; + struct m_tag *t; +{ + struct m_tag *p; + + if (t == NULL) + p = SLIST_FIRST(&m->m_pkthdr.tags); + else + p = SLIST_NEXT(t, m_tag_link); + while (p != NULL) { + if (p->m_tag_id == type) + return (p); + p = SLIST_NEXT(p, m_tag_link); + } + return (NULL); +} + +/* Copy a single tag. */ +struct m_tag * +m_tag_copy(t) + struct m_tag *t; +{ + struct m_tag *p; + + p = m_tag_get(t->m_tag_id, t->m_tag_len, M_NOWAIT); + if (p == NULL) + return (NULL); + bcopy(t + 1, p + 1, t->m_tag_len); /* Copy the data */ + return (p); +} + +/* + * Copy two tag chains. The destination mbuf (to) loses any attached + * tags even if the operation fails. This should not be a problem, as + * m_tag_copy_chain() is typically called with a newly-allocated + * destination mbuf. + */ +int +m_tag_copy_chain(to, from) + struct mbuf *to; + struct mbuf *from; +{ + struct m_tag *p, *t, *tprev = NULL; + + m_tag_delete_chain(to, NULL); + SLIST_FOREACH(p, &from->m_pkthdr.tags, m_tag_link) { + t = m_tag_copy(p); + if (t == NULL) { + m_tag_delete_chain(to, NULL); + return (0); + } + if (tprev == NULL) + SLIST_INSERT_HEAD(&to->m_pkthdr.tags, t, m_tag_link); + else { + SLIST_INSERT_AFTER(tprev, t, m_tag_link); + tprev = t; + } + } + return (1); +} + +/* Initialize tags on an mbuf. */ +void +m_tag_init(m) + struct mbuf *m; +{ + SLIST_INIT(&m->m_pkthdr.tags); +} + +/* Get first tag in chain. */ +struct m_tag * +m_tag_first(m) + struct mbuf *m; +{ + return (SLIST_FIRST(&m->m_pkthdr.tags)); +} + +/* Get next tag in chain. */ +struct m_tag * +m_tag_next(m, t) + struct mbuf *m; + struct m_tag *t; +{ + return (SLIST_NEXT(t, m_tag_link)); +} +#endif /* OpenBSD */ diff --git a/packages/net/bsd_tcpip/current/src/sys/kern/uipc_socket.c b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_socket.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_socket.c @@ -0,0 +1,1521 @@ +//========================================================================== +// +// src/sys/kern/uipc_socket.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 + * $FreeBSD: src/sys/kern/uipc_socket.c,v 1.68.2.16 2001/06/14 20:46:06 ume Exp $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef INET +static int do_setopt_accept_filter(struct socket *so, struct sockopt *sopt); +#endif /* INET */ + +#if 0 // FILT +static void filt_sordetach(struct knote *kn); +static int filt_soread(struct knote *kn, long hint); +static void filt_sowdetach(struct knote *kn); +static int filt_sowrite(struct knote *kn, long hint); +static int filt_solisten(struct knote *kn, long hint); + +static struct filterops solisten_filtops = + { 1, NULL, filt_sordetach, filt_solisten }; +static struct filterops soread_filtops = + { 1, NULL, filt_sordetach, filt_soread }; +static struct filterops sowrite_filtops = + { 1, NULL, filt_sowdetach, filt_sowrite }; +#endif + +struct vm_zone *socket_zone; +so_gen_t so_gencnt; /* generation count for sockets */ + +static int somaxconn = SOMAXCONN; + +/* + * Socket operation routines. + * These routines are called by the routines in + * sys_socket.c or from a system process, and + * implement the semantics of socket operations by + * switching out to the protocol specific routines. + */ + +/* + * Get a socket structure from our zone, and initialize it. + * 'waitok' has been implemented for eCos, with [currently] some + * rather fixed strategy - it will retry some number of times (10) + * after at most 2 minutes. This seems sufficient for sockets which + * are tied up in the TCP close process. + */ +struct socket * +soalloc(int waitok) +{ + struct socket *so; + int maxtries = waitok ? 10 : 1; + + while (maxtries-- > 0) { + so = zalloci(socket_zone); + if (so) { + /* XXX race condition for reentrant kernel */ + bzero(so, sizeof *so); + so->so_gencnt = ++so_gencnt; + so->so_zone = socket_zone; + TAILQ_INIT(&so->so_aiojobq); + return so; + } + if (waitok) { + diag_printf("DEBUG: Out of sockets - waiting\n"); + tsleep(socket_zone, PVM|PCATCH, "soalloc", 120*100); + diag_printf("DEBUG: ... retry sockets\n"); + } + } + return so; +} + +int +socreate(dom, aso, type, proto, p) + int dom; + struct socket **aso; + register int type; + int proto; + struct proc *p; +{ + register struct protosw *prp; + register struct socket *so; + register int error; + + if (proto) + prp = pffindproto(dom, proto, type); + else + prp = pffindtype(dom, type); + + if (prp == 0 || prp->pr_usrreqs->pru_attach == 0) + return (EPROTONOSUPPORT); + + if (prp->pr_type != type) + return (EPROTOTYPE); + so = soalloc(p != 0); + if (so == 0) { + return (ENOBUFS); + } + + TAILQ_INIT(&so->so_incomp); + TAILQ_INIT(&so->so_comp); + so->so_type = type; + so->so_proto = prp; + error = (*prp->pr_usrreqs->pru_attach)(so, proto, p); + if (error) { + so->so_state |= SS_NOFDREF; + sofree(so); + return (error); + } + *aso = so; + return (0); +} + +int +sobind(so, nam, p) + struct socket *so; + struct sockaddr *nam; + struct proc *p; +{ + int s = splnet(); + int error; + + error = (*so->so_proto->pr_usrreqs->pru_bind)(so, nam, p); + splx(s); + return (error); +} + +void +sodealloc(so) + struct socket *so; +{ + + so->so_gencnt = ++so_gencnt; +#ifdef INET + if (so->so_accf != NULL) { + if (so->so_accf->so_accept_filter != NULL && + so->so_accf->so_accept_filter->accf_destroy != NULL) { + so->so_accf->so_accept_filter->accf_destroy(so); + } + if (so->so_accf->so_accept_filter_str != NULL) + FREE(so->so_accf->so_accept_filter_str, M_ACCF); + FREE(so->so_accf, M_ACCF); + } +#endif /* INET */ + zfreei(so->so_zone, so); + wakeup(so->so_zone); +} + +int +solisten(so, backlog, p) + register struct socket *so; + int backlog; + struct proc *p; +{ + int s, error; + + s = splnet(); + error = (*so->so_proto->pr_usrreqs->pru_listen)(so, p); + if (error) { + splx(s); + return (error); + } + if (TAILQ_EMPTY(&so->so_comp)) + so->so_options |= SO_ACCEPTCONN; + if (backlog < 0 || backlog > somaxconn) + backlog = somaxconn; + so->so_qlimit = backlog; + splx(s); + return (0); +} + +void +sofree(so) + register struct socket *so; +{ + struct socket *head = so->so_head; + + if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0) + return; + if (head != NULL) { + if (so->so_state & SS_INCOMP) { + TAILQ_REMOVE(&head->so_incomp, so, so_list); + head->so_incqlen--; + } else if (so->so_state & SS_COMP) { + /* + * We must not decommission a socket that's + * on the accept(2) queue. If we do, then + * accept(2) may hang after select(2) indicated + * that the listening socket was ready. + */ + return; + } else { + panic("sofree: not queued"); + } + head->so_qlen--; + so->so_state &= ~SS_INCOMP; + so->so_head = NULL; + } + sbrelease(&so->so_snd, so); + sorflush(so); + sodealloc(so); +} + +/* + * Close a socket on last file table reference removal. + * Initiate disconnect if connected. + * Free socket when disconnect complete. + */ +int +soclose(so) + register struct socket *so; +{ + int s = splnet(); /* conservative */ + int error = 0; + + if (so->so_options & SO_ACCEPTCONN) { + struct socket *sp, *sonext; + + sp = TAILQ_FIRST(&so->so_incomp); + for (; sp != NULL; sp = sonext) { + sonext = TAILQ_NEXT(sp, so_list); + (void) soabort(sp); + } + for (sp = TAILQ_FIRST(&so->so_comp); sp != NULL; sp = sonext) { + sonext = TAILQ_NEXT(sp, so_list); + /* Dequeue from so_comp since sofree() won't do it */ + TAILQ_REMOVE(&so->so_comp, sp, so_list); + so->so_qlen--; + sp->so_state &= ~SS_COMP; + sp->so_head = NULL; + (void) soabort(sp); + } + } + if (so->so_pcb == 0) + goto discard; + if (so->so_state & SS_ISCONNECTED) { + if ((so->so_state & SS_ISDISCONNECTING) == 0) { + error = sodisconnect(so); + if (error) + goto drop; + } + if (so->so_options & SO_LINGER) { + if ((so->so_state & SS_ISDISCONNECTING) && + (so->so_state & SS_NBIO)) + goto drop; + while (so->so_state & SS_ISCONNECTED) { + error = tsleep((caddr_t)&so->so_timeo, + PSOCK | PCATCH, "soclos", so->so_linger * hz); + if (error) + break; + } + } + } +drop: + if (so->so_pcb) { + int error2 = (*so->so_proto->pr_usrreqs->pru_detach)(so); + if (error == 0) + error = error2; + } +discard: + if (so->so_state & SS_NOFDREF) + panic("soclose: NOFDREF"); + so->so_state |= SS_NOFDREF; + sofree(so); + splx(s); + return (error); +} + +/* + * Must be called at splnet... + */ +int +soabort(so) + struct socket *so; +{ + int error; + + error = (*so->so_proto->pr_usrreqs->pru_abort)(so); + if (error) { + sofree(so); + return error; + } + return (0); +} + +int +soaccept(so, nam) + register struct socket *so; + struct sockaddr **nam; +{ + int s = splnet(); + int error; + + if ((so->so_state & SS_NOFDREF) == 0) + panic("soaccept: !NOFDREF"); + so->so_state &= ~SS_NOFDREF; + error = (*so->so_proto->pr_usrreqs->pru_accept)(so, nam); + splx(s); + return (error); +} + +int +soconnect(so, nam, p) + register struct socket *so; + struct sockaddr *nam; + struct proc *p; +{ + int s; + int error; + + if (so->so_options & SO_ACCEPTCONN) + return (EOPNOTSUPP); + s = splnet(); + /* + * If protocol is connection-based, can only connect once. + * Otherwise, if connected, try to disconnect first. + * This allows user to disconnect by connecting to, e.g., + * a null address. + */ + if (so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING) && + ((so->so_proto->pr_flags & PR_CONNREQUIRED) || + (error = sodisconnect(so)))) + error = EISCONN; + else + error = (*so->so_proto->pr_usrreqs->pru_connect)(so, nam, p); + splx(s); + return (error); +} + +int +soconnect2(so1, so2) + register struct socket *so1; + struct socket *so2; +{ + int s = splnet(); + int error; + + error = (*so1->so_proto->pr_usrreqs->pru_connect2)(so1, so2); + splx(s); + return (error); +} + +int +sodisconnect(so) + register struct socket *so; +{ + int s = splnet(); + int error; + + if ((so->so_state & SS_ISCONNECTED) == 0) { + error = ENOTCONN; + goto bad; + } + if (so->so_state & SS_ISDISCONNECTING) { + error = EALREADY; + goto bad; + } + error = (*so->so_proto->pr_usrreqs->pru_disconnect)(so); +bad: + splx(s); + return (error); +} + +#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? M_NOWAIT : M_WAITOK) +/* + * Send on a socket. + * If send must go all at once and message is larger than + * send buffering, then hard error. + * Lock against other senders. + * If must go all at once and not enough room now, then + * inform user that this would block and do nothing. + * Otherwise, if nonblocking, send as much as possible. + * The data to be sent is described by "uio" if nonzero, + * otherwise by the mbuf chain "top" (which must be null + * if uio is not). Data provided in mbuf chain must be small + * enough to send all at once. + * + * Returns nonzero on error, timeout or signal; callers + * must check for short counts if EINTR/ERESTART are returned. + * Data and control buffers are freed on return. + */ +int +sosend(so, addr, uio, top, control, flags, p) + register struct socket *so; + struct sockaddr *addr; + struct uio *uio; + struct mbuf *top; + struct mbuf *control; + int flags; + struct proc *p; +{ + struct mbuf **mp; + register struct mbuf *m; + register long space, len, resid; + int clen = 0, error, s, dontroute, mlen; + int atomic = sosendallatonce(so) || top; + + if (uio) + resid = uio->uio_resid; + else + resid = top->m_pkthdr.len; + /* + * In theory resid should be unsigned. + * However, space must be signed, as it might be less than 0 + * if we over-committed, and we must use a signed comparison + * of space and resid. On the other hand, a negative resid + * causes us to loop sending 0-length segments to the protocol. + * + * Also check to make sure that MSG_EOR isn't used on SOCK_STREAM + * type sockets since that's an error. + */ + if (resid < 0 || (so->so_type == SOCK_STREAM && (flags & MSG_EOR))) { + error = EINVAL; + goto out; + } + + dontroute = + (flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 && + (so->so_proto->pr_flags & PR_ATOMIC); + if (control) + clen = control->m_len; +#define snderr(errno) { error = errno; splx(s); goto release; } + +restart: + error = sblock(&so->so_snd, SBLOCKWAIT(flags)); + if (error) + goto out; + do { + s = splnet(); + if (so->so_state & SS_CANTSENDMORE) + snderr(EPIPE); + if (so->so_error) { + error = so->so_error; + so->so_error = 0; + splx(s); + goto release; + } + if ((so->so_state & SS_ISCONNECTED) == 0) { + /* + * `sendto' and `sendmsg' is allowed on a connection- + * based socket if it supports implied connect. + * Return ENOTCONN if not connected and no address is + * supplied. + */ + if ((so->so_proto->pr_flags & PR_CONNREQUIRED) && + (so->so_proto->pr_flags & PR_IMPLOPCL) == 0) { + if ((so->so_state & SS_ISCONFIRMING) == 0 && + !(resid == 0 && clen != 0)) + snderr(ENOTCONN); + } else if (addr == 0) + snderr(so->so_proto->pr_flags & PR_CONNREQUIRED ? + ENOTCONN : EDESTADDRREQ); + } + space = sbspace(&so->so_snd); + if (flags & MSG_OOB) + space += 1024; + if ((atomic && resid > so->so_snd.sb_hiwat) || + clen > so->so_snd.sb_hiwat) + snderr(EMSGSIZE); + if (space < resid + clen && uio && + (atomic || space < so->so_snd.sb_lowat || space < clen)) { + if (so->so_state & SS_NBIO) + snderr(EWOULDBLOCK); + sbunlock(&so->so_snd); + error = sbwait(&so->so_snd); + splx(s); + if (error) + goto out; + goto restart; + } + splx(s); + mp = ⊤ + space -= clen; + do { + if (uio == NULL) { + /* + * Data is prepackaged in "top". + */ + resid = 0; + if (flags & MSG_EOR) + top->m_flags |= M_EOR; + } else do { + if (top == 0) { + MGETHDR(m, M_WAIT, MT_DATA); + if (m == NULL) { + error = ENOBUFS; + goto release; + } + mlen = MHLEN; + m->m_pkthdr.len = 0; + m->m_pkthdr.rcvif = (struct ifnet *)0; + } else { + MGET(m, M_WAIT, MT_DATA); + if (m == NULL) { + error = ENOBUFS; + goto release; + } + mlen = MLEN; + } + if (resid >= MINCLSIZE) { + MCLGET(m, M_WAIT); + if ((m->m_flags & M_EXT) == 0) + goto nopages; + mlen = MCLBYTES; + len = min(min(mlen, resid), space); + } else { +nopages: + len = min(min(mlen, resid), space); + /* + * For datagram protocols, leave room + * for protocol headers in first mbuf. + */ + if (atomic && top == 0 && len < mlen) + MH_ALIGN(m, len); + } + space -= len; + error = uiomove(mtod(m, caddr_t), (int)len, uio); + resid = uio->uio_resid; + m->m_len = len; + *mp = m; + top->m_pkthdr.len += len; + if (error) + goto release; + mp = &m->m_next; + if (resid <= 0) { + if (flags & MSG_EOR) + top->m_flags |= M_EOR; + break; + } + } while (space > 0 && atomic); + if (dontroute) + so->so_options |= SO_DONTROUTE; + s = splnet(); /* XXX */ + /* + * XXX all the SS_CANTSENDMORE checks previously + * done could be out of date. We could have recieved + * a reset packet in an interrupt or maybe we slept + * while doing page faults in uiomove() etc. We could + * probably recheck again inside the splnet() protection + * here, but there are probably other places that this + * also happens. We must rethink this. + */ + error = (*so->so_proto->pr_usrreqs->pru_send)(so, + (flags & MSG_OOB) ? PRUS_OOB : + /* + * If the user set MSG_EOF, the protocol + * understands this flag and nothing left to + * send then use PRU_SEND_EOF instead of PRU_SEND. + */ + ((flags & MSG_EOF) && + (so->so_proto->pr_flags & PR_IMPLOPCL) && + (resid <= 0)) ? + PRUS_EOF : + /* If there is more to send set PRUS_MORETOCOME */ + (resid > 0 && space > 0) ? PRUS_MORETOCOME : 0, + top, addr, control, p); + splx(s); + if (dontroute) + so->so_options &= ~SO_DONTROUTE; + clen = 0; + control = 0; + top = 0; + mp = ⊤ + if (error) + goto release; + } while (resid && space > 0); + } while (resid); + +release: + sbunlock(&so->so_snd); +out: + if (top) + m_freem(top); + if (control) + m_freem(control); + return (error); +} + +/* + * Implement receive operations on a socket. + * We depend on the way that records are added to the sockbuf + * by sbappend*. In particular, each record (mbufs linked through m_next) + * must begin with an address if the protocol so specifies, + * followed by an optional mbuf or mbufs containing ancillary data, + * and then zero or more mbufs of data. + * In order to avoid blocking network interrupts for the entire time here, + * we splx() while doing the actual copy to user space. + * Although the sockbuf is locked, new data may still be appended, + * and thus we must maintain consistency of the sockbuf during that time. + * + * The caller may receive the data as a single mbuf chain by supplying + * an mbuf **mp0 for use in returning the chain. The uio is then used + * only for the count in uio_resid. + */ +int +soreceive(so, psa, uio, mp0, controlp, flagsp) + register struct socket *so; + struct sockaddr **psa; + struct uio *uio; + struct mbuf **mp0; + struct mbuf **controlp; + int *flagsp; +{ + register struct mbuf *m, **mp; + register int flags, len, error, s, offset; + struct protosw *pr = so->so_proto; + struct mbuf *nextrecord; + int moff, type = 0; + int orig_resid = uio->uio_resid; + + mp = mp0; + if (psa) + *psa = 0; + if (controlp) + *controlp = 0; + if (flagsp) + flags = *flagsp &~ MSG_EOR; + else + flags = 0; + if (flags & MSG_OOB) { + m = m_get(M_WAIT, MT_DATA); + if (m == NULL) { + return (ENOBUFS); + } + error = (*pr->pr_usrreqs->pru_rcvoob)(so, m, flags & MSG_PEEK); + if (error) + goto bad; + do { + error = uiomove(mtod(m, caddr_t), + (int) min(uio->uio_resid, m->m_len), uio); + m = m_free(m); + } while (uio->uio_resid && error == 0 && m); +bad: + if (m) + m_freem(m); + return (error); + } + if (mp) + *mp = (struct mbuf *)0; + if (so->so_state & SS_ISCONFIRMING && uio->uio_resid) + (*pr->pr_usrreqs->pru_rcvd)(so, 0); + +restart: + error = sblock(&so->so_rcv, SBLOCKWAIT(flags)); + if (error) + return (error); + s = splnet(); + + m = so->so_rcv.sb_mb; + /* + * If we have less data than requested, block awaiting more + * (subject to any timeout) if: + * 1. the current count is less than the low water mark, or + * 2. MSG_WAITALL is set, and it is possible to do the entire + * receive operation at once if we block (resid <= hiwat). + * 3. MSG_DONTWAIT is not set + * If MSG_WAITALL is set but resid is larger than the receive buffer, + * we have to do the receive in sections, and thus risk returning + * a short count if a timeout or signal occurs after we start. + */ + if (m == 0 || (((flags & MSG_DONTWAIT) == 0 && + so->so_rcv.sb_cc < uio->uio_resid) && + (so->so_rcv.sb_cc < so->so_rcv.sb_lowat || + ((flags & MSG_WAITALL) && uio->uio_resid <= so->so_rcv.sb_hiwat)) && + m->m_nextpkt == 0 && (pr->pr_flags & PR_ATOMIC) == 0)) { + if (so->so_error) { + if (m) + goto dontblock; + error = so->so_error; + if ((flags & MSG_PEEK) == 0) + so->so_error = 0; + goto release; + } + if (so->so_state & SS_CANTRCVMORE) { + if (m) + goto dontblock; + else + goto release; + } + for (; m; m = m->m_next) + if (m->m_type == MT_OOBDATA || (m->m_flags & M_EOR)) { + m = so->so_rcv.sb_mb; + goto dontblock; + } + if ((so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING)) == 0 && + (so->so_proto->pr_flags & PR_CONNREQUIRED)) { + error = ENOTCONN; + goto release; + } + if (uio->uio_resid == 0) + goto release; + if ((so->so_state & SS_NBIO) || (flags & MSG_DONTWAIT)) { + error = EWOULDBLOCK; + goto release; + } + sbunlock(&so->so_rcv); + error = sbwait(&so->so_rcv); + splx(s); + if (error) + return (error); + goto restart; + } +dontblock: + nextrecord = m->m_nextpkt; + if (pr->pr_flags & PR_ADDR) { + orig_resid = 0; + if (psa) + *psa = dup_sockaddr(mtod(m, struct sockaddr *), + mp0 == 0); + if (flags & MSG_PEEK) { + m = m->m_next; + } else { + sbfree(&so->so_rcv, m); + MFREE(m, so->so_rcv.sb_mb); + m = so->so_rcv.sb_mb; + } + } + while (m && m->m_type == MT_CONTROL && error == 0) { + if (flags & MSG_PEEK) { + if (controlp) + *controlp = m_copy(m, 0, m->m_len); + m = m->m_next; + } else { + sbfree(&so->so_rcv, m); + if (controlp) { + if (pr->pr_domain->dom_externalize && + mtod(m, struct cmsghdr *)->cmsg_type == + SCM_RIGHTS) + error = (*pr->pr_domain->dom_externalize)(m); + *controlp = m; + so->so_rcv.sb_mb = m->m_next; + m->m_next = 0; + m = so->so_rcv.sb_mb; + } else { + MFREE(m, so->so_rcv.sb_mb); + m = so->so_rcv.sb_mb; + } + } + if (controlp) { + orig_resid = 0; + controlp = &(*controlp)->m_next; + } + } + if (m) { + if ((flags & MSG_PEEK) == 0) + m->m_nextpkt = nextrecord; + type = m->m_type; + if (type == MT_OOBDATA) + flags |= MSG_OOB; + } + moff = 0; + offset = 0; + while (m && uio->uio_resid > 0 && error == 0) { + if (m->m_type == MT_OOBDATA) { + if (type != MT_OOBDATA) + break; + } else if (type == MT_OOBDATA) + break; + so->so_state &= ~SS_RCVATMARK; + len = uio->uio_resid; + if (so->so_oobmark && len > so->so_oobmark - offset) + len = so->so_oobmark - offset; + if (len > m->m_len - moff) + len = m->m_len - moff; + /* + * If mp is set, just pass back the mbufs. + * Otherwise copy them out via the uio, then free. + * Sockbuf must be consistent here (points to current mbuf, + * it points to next record) when we drop priority; + * we must note any additions to the sockbuf when we + * block interrupts again. + */ + if (mp == 0) { + splx(s); + error = uiomove(mtod(m, caddr_t) + moff, (int)len, uio); + s = splnet(); + if (error) + goto release; + } else + uio->uio_resid -= len; + if (len == m->m_len - moff) { + if (m->m_flags & M_EOR) + flags |= MSG_EOR; + if (flags & MSG_PEEK) { + m = m->m_next; + moff = 0; + } else { + nextrecord = m->m_nextpkt; + sbfree(&so->so_rcv, m); + if (mp) { + *mp = m; + mp = &m->m_next; + so->so_rcv.sb_mb = m = m->m_next; + *mp = (struct mbuf *)0; + } else { + MFREE(m, so->so_rcv.sb_mb); + m = so->so_rcv.sb_mb; + } + if (m) + m->m_nextpkt = nextrecord; + } + } else { + if (flags & MSG_PEEK) + moff += len; + else { + if (mp) + *mp = m_copym(m, 0, len, M_WAIT); + m->m_data += len; + m->m_len -= len; + so->so_rcv.sb_cc -= len; + } + } + if (so->so_oobmark) { + if ((flags & MSG_PEEK) == 0) { + so->so_oobmark -= len; + if (so->so_oobmark == 0) { + so->so_state |= SS_RCVATMARK; + break; + } + } else { + offset += len; + if (offset == so->so_oobmark) + break; + } + } + if (flags & MSG_EOR) + break; + /* + * If the MSG_WAITALL flag is set (for non-atomic socket), + * we must not quit until "uio->uio_resid == 0" or an error + * termination. If a signal/timeout occurs, return + * with a short count but without error. + * Keep sockbuf locked against other readers. + */ + while (flags & MSG_WAITALL && m == 0 && uio->uio_resid > 0 && + !sosendallatonce(so) && !nextrecord) { + if (so->so_error || so->so_state & SS_CANTRCVMORE) + break; + error = sbwait(&so->so_rcv); + if (error) { + sbunlock(&so->so_rcv); + splx(s); + return (0); + } + m = so->so_rcv.sb_mb; + if (m) + nextrecord = m->m_nextpkt; + } + } + + if (m && pr->pr_flags & PR_ATOMIC) { + flags |= MSG_TRUNC; + if ((flags & MSG_PEEK) == 0) + (void) sbdroprecord(&so->so_rcv); + } + if ((flags & MSG_PEEK) == 0) { + if (m == 0) + so->so_rcv.sb_mb = nextrecord; + if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) + (*pr->pr_usrreqs->pru_rcvd)(so, flags); + } + if (orig_resid == uio->uio_resid && orig_resid && + (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) { + sbunlock(&so->so_rcv); + splx(s); + goto restart; + } + + if (flagsp) + *flagsp |= flags; +release: + sbunlock(&so->so_rcv); + splx(s); + return (error); +} + +int +soshutdown(so, how) + register struct socket *so; + register int how; +{ + register struct protosw *pr = so->so_proto; + + if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR)) + return (EINVAL); + + if (how != SHUT_WR) + sorflush(so); + if (how != SHUT_RD) + return ((*pr->pr_usrreqs->pru_shutdown)(so)); + return (0); +} + +void +sorflush(so) + register struct socket *so; +{ + register struct sockbuf *sb = &so->so_rcv; + register struct protosw *pr = so->so_proto; + register int s; + struct sockbuf asb; + + sb->sb_flags |= SB_NOINTR; + (void) sblock(sb, M_WAITOK); + s = splimp(); + socantrcvmore(so); + sbunlock(sb); + asb = *sb; + bzero((caddr_t)sb, sizeof (*sb)); + splx(s); + if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose) + (*pr->pr_domain->dom_dispose)(asb.sb_mb); + sbrelease(&asb, so); +} + +#ifdef INET +static int +do_setopt_accept_filter(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + struct accept_filter_arg *afap = NULL; + struct accept_filter *afp; + struct so_accf *af = so->so_accf; + int error = 0; + + /* do not set/remove accept filters on non listen sockets */ + if ((so->so_options & SO_ACCEPTCONN) == 0) { + error = EINVAL; + goto out; + } + + /* removing the filter */ + if (sopt == NULL) { + if (af != NULL) { + if (af->so_accept_filter != NULL && + af->so_accept_filter->accf_destroy != NULL) { + af->so_accept_filter->accf_destroy(so); + } + if (af->so_accept_filter_str != NULL) { + FREE(af->so_accept_filter_str, M_ACCF); + } + FREE(af, M_ACCF); + so->so_accf = NULL; + } + so->so_options &= ~SO_ACCEPTFILTER; + return (0); + } + /* adding a filter */ + /* must remove previous filter first */ + if (af != NULL) { + error = EINVAL; + goto out; + } + /* don't put large objects on the kernel stack */ + MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), M_TEMP, M_WAITOK); + error = sooptcopyin(sopt, afap, sizeof *afap, sizeof *afap); + afap->af_name[sizeof(afap->af_name)-1] = '\0'; + afap->af_arg[sizeof(afap->af_arg)-1] = '\0'; + if (error) + goto out; + afp = accept_filt_get(afap->af_name); + if (afp == NULL) { + error = ENOENT; + goto out; + } + MALLOC(af, struct so_accf *, sizeof(*af), M_ACCF, M_WAITOK); + bzero(af, sizeof(*af)); + if (afp->accf_create != NULL) { + if (afap->af_name[0] != '\0') { + int len = strlen(afap->af_name) + 1; + + MALLOC(af->so_accept_filter_str, char *, len, M_ACCF, M_WAITOK); + strcpy(af->so_accept_filter_str, afap->af_name); + } + af->so_accept_filter_arg = afp->accf_create(so, afap->af_arg); + if (af->so_accept_filter_arg == NULL) { + FREE(af->so_accept_filter_str, M_ACCF); + FREE(af, M_ACCF); + so->so_accf = NULL; + error = EINVAL; + goto out; + } + } + af->so_accept_filter = afp; + so->so_accf = af; + so->so_options |= SO_ACCEPTFILTER; +out: + if (afap != NULL) + FREE(afap, M_TEMP); + return (error); +} +#endif /* INET */ + +/* + * Perhaps this routine, and sooptcopyout(), below, ought to come in + * an additional variant to handle the case where the option value needs + * to be some kind of integer, but not a specific size. + * In addition to their use here, these functions are also called by the + * protocol-level pr_ctloutput() routines. + */ +int +sooptcopyin(sopt, buf, len, minlen) + struct sockopt *sopt; + void *buf; + size_t len; + size_t minlen; +{ + size_t valsize; + + /* + * If the user gives us more than we wanted, we ignore it, + * but if we don't get the minimum length the caller + * wants, we return EINVAL. On success, sopt->sopt_valsize + * is set to however much we actually retrieved. + */ + if ((valsize = sopt->sopt_valsize) < minlen) + return EINVAL; + if (valsize > len) + sopt->sopt_valsize = valsize = len; + + if (sopt->sopt_p != 0) + return (copyin(sopt->sopt_val, buf, valsize)); + + bcopy(sopt->sopt_val, buf, valsize); + return 0; +} + +int +sosetopt(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + int error, optval; + struct linger l; + struct timeval tv; + u_long val; + + error = 0; + if (sopt->sopt_level != SOL_SOCKET) { + if (so->so_proto && so->so_proto->pr_ctloutput) + return ((*so->so_proto->pr_ctloutput) + (so, sopt)); + error = ENOPROTOOPT; + } else { + switch (sopt->sopt_name) { +#ifdef INET + case SO_ACCEPTFILTER: + error = do_setopt_accept_filter(so, sopt); + if (error) + goto bad; + break; +#endif /* INET */ + case SO_LINGER: + error = sooptcopyin(sopt, &l, sizeof l, sizeof l); + if (error) + goto bad; + + so->so_linger = l.l_linger; + if (l.l_onoff) + so->so_options |= SO_LINGER; + else + so->so_options &= ~SO_LINGER; + break; + + case SO_DEBUG: + case SO_KEEPALIVE: + case SO_DONTROUTE: + case SO_USELOOPBACK: + case SO_BROADCAST: + case SO_REUSEADDR: + case SO_REUSEPORT: + case SO_OOBINLINE: + case SO_TIMESTAMP: + error = sooptcopyin(sopt, &optval, sizeof optval, + sizeof optval); + if (error) + goto bad; + if (optval) + so->so_options |= sopt->sopt_name; + else + so->so_options &= ~sopt->sopt_name; + break; + + case SO_SNDBUF: + case SO_RCVBUF: + case SO_SNDLOWAT: + case SO_RCVLOWAT: + error = sooptcopyin(sopt, &optval, sizeof optval, + sizeof optval); + if (error) + goto bad; + + /* + * Values < 1 make no sense for any of these + * options, so disallow them. + */ + if (optval < 1) { + error = EINVAL; + goto bad; + } + + switch (sopt->sopt_name) { + case SO_SNDBUF: + case SO_RCVBUF: + if (sbreserve(sopt->sopt_name == SO_SNDBUF ? + &so->so_snd : &so->so_rcv, (u_long)optval, + so, curproc) == 0) { + error = ENOBUFS; + goto bad; + } + break; + + /* + * Make sure the low-water is never greater than + * the high-water. + */ + case SO_SNDLOWAT: + so->so_snd.sb_lowat = + (optval > so->so_snd.sb_hiwat) ? + so->so_snd.sb_hiwat : optval; + break; + case SO_RCVLOWAT: + so->so_rcv.sb_lowat = + (optval > so->so_rcv.sb_hiwat) ? + so->so_rcv.sb_hiwat : optval; + break; + } + break; + + case SO_SNDTIMEO: + case SO_RCVTIMEO: + error = sooptcopyin(sopt, &tv, sizeof tv, + sizeof tv); + if (error) + goto bad; + + /* assert(hz > 0); */ + if (tv.tv_sec < 0 || tv.tv_sec > SHRT_MAX / hz || + tv.tv_usec < 0 || tv.tv_usec >= 1000000) { + error = EDOM; + goto bad; + } + /* assert(tick > 0); */ + /* assert(ULONG_MAX - SHRT_MAX >= 1000000); */ + val = (u_long)(tv.tv_sec * hz) + tv.tv_usec / tick; + if (val > SHRT_MAX) { + error = EDOM; + goto bad; + } + + switch (sopt->sopt_name) { + case SO_SNDTIMEO: + so->so_snd.sb_timeo = val; + break; + case SO_RCVTIMEO: + so->so_rcv.sb_timeo = val; + break; + } + break; + default: + error = ENOPROTOOPT; + break; + } + if (error == 0 && so->so_proto && so->so_proto->pr_ctloutput) { + (void) ((*so->so_proto->pr_ctloutput) + (so, sopt)); + } + } +bad: + return (error); +} + +/* Helper routine for getsockopt */ +int +sooptcopyout(sopt, buf, len) + struct sockopt *sopt; + void *buf; + size_t len; +{ + int error; + size_t valsize; + + error = 0; + + /* + * Documented get behavior is that we always return a value, + * possibly truncated to fit in the user's buffer. + * Traditional behavior is that we always tell the user + * precisely how much we copied, rather than something useful + * like the total amount we had available for her. + * Note that this interface is not idempotent; the entire answer must + * generated ahead of time. + */ + valsize = min(len, sopt->sopt_valsize); + sopt->sopt_valsize = valsize; + if (sopt->sopt_val != 0) { + if (sopt->sopt_p != 0) + error = copyout(buf, sopt->sopt_val, valsize); + else + bcopy(buf, sopt->sopt_val, valsize); + } + return error; +} + +int +sogetopt(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + int error, optval; + struct linger l; + struct timeval tv; + struct accept_filter_arg *afap; + + error = 0; + if (sopt->sopt_level != SOL_SOCKET) { + if (so->so_proto && so->so_proto->pr_ctloutput) { + return ((*so->so_proto->pr_ctloutput) + (so, sopt)); + } else + return (ENOPROTOOPT); + } else { + switch (sopt->sopt_name) { +#ifdef INET + case SO_ACCEPTFILTER: + if ((so->so_options & SO_ACCEPTCONN) == 0) + return (EINVAL); + MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), + M_TEMP, M_WAITOK); + bzero(afap, sizeof(*afap)); + if ((so->so_options & SO_ACCEPTFILTER) != 0) { + strcpy(afap->af_name, so->so_accf->so_accept_filter->accf_name); + if (so->so_accf->so_accept_filter_str != NULL) + strcpy(afap->af_arg, so->so_accf->so_accept_filter_str); + } + error = sooptcopyout(sopt, afap, sizeof(*afap)); + FREE(afap, M_TEMP); + break; +#endif /* INET */ + + case SO_LINGER: + l.l_onoff = so->so_options & SO_LINGER; + l.l_linger = so->so_linger; + error = sooptcopyout(sopt, &l, sizeof l); + break; + + case SO_USELOOPBACK: + case SO_DONTROUTE: + case SO_DEBUG: + case SO_KEEPALIVE: + case SO_REUSEADDR: + case SO_REUSEPORT: + case SO_BROADCAST: + case SO_OOBINLINE: + case SO_TIMESTAMP: + optval = so->so_options & sopt->sopt_name; +integer: + error = sooptcopyout(sopt, &optval, sizeof optval); + break; + + case SO_TYPE: + optval = so->so_type; + goto integer; + + case SO_ERROR: + optval = so->so_error; + so->so_error = 0; + goto integer; + + case SO_SNDBUF: + optval = so->so_snd.sb_hiwat; + goto integer; + + case SO_RCVBUF: + optval = so->so_rcv.sb_hiwat; + goto integer; + + case SO_SNDLOWAT: + optval = so->so_snd.sb_lowat; + goto integer; + + case SO_RCVLOWAT: + optval = so->so_rcv.sb_lowat; + goto integer; + + case SO_SNDTIMEO: + case SO_RCVTIMEO: + optval = (sopt->sopt_name == SO_SNDTIMEO ? + so->so_snd.sb_timeo : so->so_rcv.sb_timeo); + + tv.tv_sec = optval / hz; + tv.tv_usec = (optval % hz) * tick; + error = sooptcopyout(sopt, &tv, sizeof tv); + break; + + default: + error = ENOPROTOOPT; + break; + } + return (error); + } +} + +/* XXX; prepare mbuf for (__FreeBSD__ < 3) routines. */ +int +soopt_getm(struct sockopt *sopt, struct mbuf **mp) +{ + struct mbuf *m, *m_prev; + int sopt_size = sopt->sopt_valsize; + + MGET(m, sopt->sopt_p ? M_WAIT : M_DONTWAIT, MT_DATA); + if (m == 0) { + return ENOBUFS; + } + if (sopt_size > MLEN) { + MCLGET(m, sopt->sopt_p ? M_WAIT : M_DONTWAIT); + if ((m->m_flags & M_EXT) == 0) { + m_free(m); + return ENOBUFS; + } + m->m_len = min(MCLBYTES, sopt_size); + } else { + m->m_len = min(MLEN, sopt_size); + } + sopt_size -= m->m_len; + *mp = m; + m_prev = m; + + while (sopt_size) { + MGET(m, sopt->sopt_p ? M_WAIT : M_DONTWAIT, MT_DATA); + if (m == 0) { + m_freem(*mp); + return ENOBUFS; + } + if (sopt_size > MLEN) { + MCLGET(m, sopt->sopt_p ? M_WAIT : M_DONTWAIT); + if ((m->m_flags & M_EXT) == 0) { + m_freem(*mp); + return ENOBUFS; + } + m->m_len = min(MCLBYTES, sopt_size); + } else { + m->m_len = min(MLEN, sopt_size); + } + sopt_size -= m->m_len; + m_prev->m_next = m; + m_prev = m; + } + return 0; +} + +/* XXX; copyin sopt data into mbuf chain for (__FreeBSD__ < 3) routines. */ +int +soopt_mcopyin(struct sockopt *sopt, struct mbuf *m) +{ + struct mbuf *m0 = m; + + if (sopt->sopt_val == NULL) + return 0; + while (m != NULL && sopt->sopt_valsize >= m->m_len) { + if (sopt->sopt_p != NULL) { + int error; + + error = copyin(sopt->sopt_val, mtod(m, char *), + m->m_len); + if (error != 0) { + m_freem(m0); + return(error); + } + } else + bcopy(sopt->sopt_val, mtod(m, char *), m->m_len); + sopt->sopt_valsize -= m->m_len; + (caddr_t)sopt->sopt_val += m->m_len; + m = m->m_next; + } + if (m != NULL) /* should be allocated enoughly at ip6_sooptmcopyin() */ + panic("ip6_sooptmcopyin"); + return 0; +} + +/* XXX; copyout mbuf chain data into soopt for (__FreeBSD__ < 3) routines. */ +int +soopt_mcopyout(struct sockopt *sopt, struct mbuf *m) +{ + struct mbuf *m0 = m; + size_t valsize = 0; + + if (sopt->sopt_val == NULL) + return 0; + while (m != NULL && sopt->sopt_valsize >= m->m_len) { + if (sopt->sopt_p != NULL) { + int error; + + error = copyout(mtod(m, char *), sopt->sopt_val, + m->m_len); + if (error != 0) { + m_freem(m0); + return(error); + } + } else + bcopy(mtod(m, char *), sopt->sopt_val, m->m_len); + sopt->sopt_valsize -= m->m_len; + (caddr_t)sopt->sopt_val += m->m_len; + valsize += m->m_len; + m = m->m_next; + } + if (m != NULL) { + /* enough soopt buffer should be given from user-land */ + m_freem(m0); + return(EINVAL); + } + sopt->sopt_valsize = valsize; + return 0; +} + +void +sohasoutofband(so) + register struct socket *so; +{ + selwakeup(&so->so_rcv.sb_sel); +} + +int +sopoll(struct socket *so, int events, struct ucred *cred, struct proc *p) +{ + panic(__FUNCTION__"\n"); + return 0; +#if 0 // POLL + int revents = 0; + int s = splnet(); + + if (events & (POLLIN | POLLRDNORM)) + if (soreadable(so)) + revents |= events & (POLLIN | POLLRDNORM); + + if (events & (POLLOUT | POLLWRNORM)) + if (sowriteable(so)) + revents |= events & (POLLOUT | POLLWRNORM); + + if (events & (POLLPRI | POLLRDBAND)) + if (so->so_oobmark || (so->so_state & SS_RCVATMARK)) + revents |= events & (POLLPRI | POLLRDBAND); + + if (revents == 0) { + if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { + selrecord(p, &so->so_rcv.sb_sel); + so->so_rcv.sb_flags |= SB_SEL; + } + + if (events & (POLLOUT | POLLWRNORM)) { + selrecord(p, &so->so_snd.sb_sel); + so->so_snd.sb_flags |= SB_SEL; + } + } + + splx(s); + return (revents); +#endif // POLL +} + diff --git a/packages/net/bsd_tcpip/current/src/sys/kern/uipc_socket2.c b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_socket2.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_socket2.c @@ -0,0 +1,986 @@ +//========================================================================== +// +// src/sys/kern/uipc_socket2.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/kern/uipc_socket2.c,v 1.55.2.9 2001/07/26 18:53:02 peter Exp $ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +int maxsockets = CYGPKG_NET_MAXSOCKETS; + +/* + * Primitive routines for operating on sockets and socket buffers + */ + +u_long sb_max = SB_MAX; /* XXX should be static */ + +static u_long sb_efficiency = 8; /* parameter for sbreserve() */ + +/* + * Procedures to manipulate state flags of socket + * and do appropriate wakeups. Normal sequence from the + * active (originating) side is that soisconnecting() is + * called during processing of connect() call, + * resulting in an eventual call to soisconnected() if/when the + * connection is established. When the connection is torn down + * soisdisconnecting() is called during processing of disconnect() call, + * and soisdisconnected() is called when the connection to the peer + * is totally severed. The semantics of these routines are such that + * connectionless protocols can call soisconnected() and soisdisconnected() + * only, bypassing the in-progress calls when setting up a ``connection'' + * takes no time. + * + * From the passive side, a socket is created with + * two queues of sockets: so_incomp for connections in progress + * and so_comp for connections already made and awaiting user acceptance. + * As a protocol is preparing incoming connections, it creates a socket + * structure queued on so_incomp by calling sonewconn(). When the connection + * is established, soisconnected() is called, and transfers the + * socket structure to so_comp, making it available to accept(). + * + * If a socket is closed with sockets on either + * so_incomp or so_comp, these sockets are dropped. + * + * If higher level protocols are implemented in + * the kernel, the wakeups done here will sometimes + * cause software-interrupt process scheduling. + */ + +void +soisconnecting(so) + register struct socket *so; +{ + + so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING); + so->so_state |= SS_ISCONNECTING; +} + +void +soisconnected(so) + struct socket *so; +{ + struct socket *head = so->so_head; + + so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING); + so->so_state |= SS_ISCONNECTED; + if (head && (so->so_state & SS_INCOMP)) { + if ((so->so_options & SO_ACCEPTFILTER) != 0) { + so->so_upcall = head->so_accf->so_accept_filter->accf_callback; + so->so_upcallarg = head->so_accf->so_accept_filter_arg; + so->so_rcv.sb_flags |= SB_UPCALL; + so->so_options &= ~SO_ACCEPTFILTER; + so->so_upcall(so, so->so_upcallarg, 0); + return; + } + TAILQ_REMOVE(&head->so_incomp, so, so_list); + head->so_incqlen--; + so->so_state &= ~SS_INCOMP; + TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); + so->so_state |= SS_COMP; + sorwakeup(head); + wakeup_one(&head->so_timeo); + } else { + wakeup(&so->so_timeo); + sorwakeup(so); + sowwakeup(so); + } +} + +void +soisdisconnecting(so) + register struct socket *so; +{ + + so->so_state &= ~SS_ISCONNECTING; + so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE|SS_CANTSENDMORE); + wakeup((caddr_t)&so->so_timeo); + sowwakeup(so); + sorwakeup(so); +} + +void +soisdisconnected(so) + register struct socket *so; +{ + + so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING); + so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE|SS_ISDISCONNECTED); + wakeup((caddr_t)&so->so_timeo); + sowwakeup(so); + sorwakeup(so); +} + +/* + * Return a random connection that hasn't been serviced yet and + * is eligible for discard. There is a one in qlen chance that + * we will return a null, saying that there are no dropable + * requests. In this case, the protocol specific code should drop + * the new request. This insures fairness. + * + * This may be used in conjunction with protocol specific queue + * congestion routines. + */ +struct socket * +sodropablereq(head) + register struct socket *head; +{ + register struct socket *so; + unsigned int i, j, qlen; + static int rnd; + static struct timeval old_runtime; + static unsigned int cur_cnt, old_cnt; + struct timeval tv; + + getmicrouptime(&tv); + if ((i = (tv.tv_sec - old_runtime.tv_sec)) != 0) { + old_runtime = tv; + old_cnt = cur_cnt / i; + cur_cnt = 0; + } + + so = TAILQ_FIRST(&head->so_incomp); + if (!so) + return (so); + + qlen = head->so_incqlen; + if (++cur_cnt > qlen || old_cnt > qlen) { + rnd = (314159 * rnd + 66329) & 0xffff; + j = ((qlen + 1) * rnd) >> 16; + + while (j-- && so) + so = TAILQ_NEXT(so, so_list); + } + + return (so); +} + +/* + * When an attempt at a new connection is noted on a socket + * which accepts connections, sonewconn is called. If the + * connection is possible (subject to space constraints, etc.) + * then we allocate a new structure, propoerly linked into the + * data structure of the original socket, and return this. + * Connstatus may be 0, or SO_ISCONFIRMING, or SO_ISCONNECTED. + */ +struct socket * +sonewconn(head, connstatus) + register struct socket *head; + int connstatus; +{ + + return (sonewconn3(head, connstatus, NULL)); +} + +struct socket * +sonewconn3(head, connstatus, p) + register struct socket *head; + int connstatus; + struct proc *p; +{ + register struct socket *so; + + if (head->so_qlen > 3 * head->so_qlimit / 2) + return ((struct socket *)0); + so = soalloc(0); + if (so == NULL) + return ((struct socket *)0); + so->so_head = head; + so->so_type = head->so_type; + so->so_options = head->so_options &~ SO_ACCEPTCONN; + so->so_linger = head->so_linger; + so->so_state = head->so_state | SS_NOFDREF; + so->so_proto = head->so_proto; + so->so_timeo = head->so_timeo; + if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat) || + (*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) { + sodealloc(so); + return ((struct socket *)0); + } + + if (connstatus) { + TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); + so->so_state |= SS_COMP; + } else { + TAILQ_INSERT_TAIL(&head->so_incomp, so, so_list); + so->so_state |= SS_INCOMP; + head->so_incqlen++; + } + head->so_qlen++; + if (connstatus) { + sorwakeup(head); + wakeup((caddr_t)&head->so_timeo); + so->so_state |= connstatus; + } + return (so); +} + +/* + * Socantsendmore indicates that no more data will be sent on the + * socket; it would normally be applied to a socket when the user + * informs the system that no more data is to be sent, by the protocol + * code (in case PRU_SHUTDOWN). Socantrcvmore indicates that no more data + * will be received, and will normally be applied to the socket by a + * protocol when it detects that the peer will send no more data. + * Data queued for reading in the socket may yet be read. + */ + +void +socantsendmore(so) + struct socket *so; +{ + + so->so_state |= SS_CANTSENDMORE; + sowwakeup(so); +} + +void +socantrcvmore(so) + struct socket *so; +{ + + so->so_state |= SS_CANTRCVMORE; + sorwakeup(so); +} + +/* + * Wait for data to arrive at/drain from a socket buffer. + */ +int +sbwait(sb) + struct sockbuf *sb; +{ + + sb->sb_flags |= SB_WAIT; + return (tsleep((caddr_t)&sb->sb_cc, + (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK | PCATCH, "sbwait", + sb->sb_timeo)); +} + +/* + * Lock a sockbuf already known to be locked; + * return any error returned from sleep (EINTR). + */ +int +sb_lock(sb) + register struct sockbuf *sb; +{ + int error; + + while (sb->sb_flags & SB_LOCK) { + sb->sb_flags |= SB_WANT; + error = tsleep((caddr_t)&sb->sb_flags, + (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK|PCATCH, + "sblock", 0); + if (error) + return (error); + } + sb->sb_flags |= SB_LOCK; + return (0); +} + +/* + * Wakeup processes waiting on a socket buffer. + * Do asynchronous notification via SIGIO + * if the socket has the SS_ASYNC flag set. + */ +void +sowakeup(so, sb) + register struct socket *so; + register struct sockbuf *sb; +{ + selwakeup(&sb->sb_sel); + sb->sb_flags &= ~SB_SEL; + if (sb->sb_flags & SB_WAIT) { + sb->sb_flags &= ~SB_WAIT; + wakeup((caddr_t)&sb->sb_cc); + } + if (sb->sb_flags & SB_UPCALL) + (*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT); +} + +/* + * Socket buffer (struct sockbuf) utility routines. + * + * Each socket contains two socket buffers: one for sending data and + * one for receiving data. Each buffer contains a queue of mbufs, + * information about the number of mbufs and amount of data in the + * queue, and other fields allowing select() statements and notification + * on data availability to be implemented. + * + * Data stored in a socket buffer is maintained as a list of records. + * Each record is a list of mbufs chained together with the m_next + * field. Records are chained together with the m_nextpkt field. The upper + * level routine soreceive() expects the following conventions to be + * observed when placing information in the receive buffer: + * + * 1. If the protocol requires each message be preceded by the sender's + * name, then a record containing that name must be present before + * any associated data (mbuf's must be of type MT_SONAME). + * 2. If the protocol supports the exchange of ``access rights'' (really + * just additional data associated with the message), and there are + * ``rights'' to be received, then a record containing this data + * should be present (mbuf's must be of type MT_RIGHTS). + * 3. If a name or rights record exists, then it must be followed by + * a data record, perhaps of zero length. + * + * Before using a new socket structure it is first necessary to reserve + * buffer space to the socket, by calling sbreserve(). This should commit + * some of the available buffer space in the system buffer pool for the + * socket (currently, it does nothing but enforce limits). The space + * should be released by calling sbrelease() when the socket is destroyed. + */ + +int +soreserve(so, sndcc, rcvcc) + register struct socket *so; + u_long sndcc, rcvcc; +{ + struct proc *p = curproc; + + if (sbreserve(&so->so_snd, sndcc, so, p) == 0) + goto bad; + if (sbreserve(&so->so_rcv, rcvcc, so, p) == 0) + goto bad2; + if (so->so_rcv.sb_lowat == 0) + so->so_rcv.sb_lowat = 1; + if (so->so_snd.sb_lowat == 0) + so->so_snd.sb_lowat = MCLBYTES; + if (so->so_snd.sb_lowat > so->so_snd.sb_hiwat) + so->so_snd.sb_lowat = so->so_snd.sb_hiwat; + return (0); +bad2: + sbrelease(&so->so_snd, so); +bad: + return (ENOBUFS); +} + +/* + * Allot mbufs to a sockbuf. + * Attempt to scale mbmax so that mbcnt doesn't become limiting + * if buffering efficiency is near the normal case. + */ +int +sbreserve(sb, cc, so, p) + struct sockbuf *sb; + u_long cc; + struct socket *so; + struct proc *p; +{ + + /* + * p will only be NULL when we're in an interrupt + * (e.g. in tcp_input()) + */ + if ((u_quad_t)cc > (u_quad_t)sb_max * MCLBYTES / (MSIZE + MCLBYTES)) + return (0); + sb->sb_hiwat = cc; + sb->sb_mbmax = min(cc * sb_efficiency, sb_max); + if (sb->sb_lowat > sb->sb_hiwat) + sb->sb_lowat = sb->sb_hiwat; + return (1); +} + +/* + * Free mbufs held by a socket, and reserved mbuf space. + */ +void +sbrelease(sb, so) + struct sockbuf *sb; + struct socket *so; +{ + + sbflush(sb); + sb->sb_mbmax = 0; +} + +/* + * Routines to add and remove + * data from an mbuf queue. + * + * The routines sbappend() or sbappendrecord() are normally called to + * append new mbufs to a socket buffer, after checking that adequate + * space is available, comparing the function sbspace() with the amount + * of data to be added. sbappendrecord() differs from sbappend() in + * that data supplied is treated as the beginning of a new record. + * To place a sender's address, optional access rights, and data in a + * socket receive buffer, sbappendaddr() should be used. To place + * access rights and data in a socket receive buffer, sbappendrights() + * should be used. In either case, the new data begins a new record. + * Note that unlike sbappend() and sbappendrecord(), these routines check + * for the caller that there will be enough space to store the data. + * Each fails if there is not enough space, or if it cannot find mbufs + * to store additional information in. + * + * Reliable protocols may use the socket send buffer to hold data + * awaiting acknowledgement. Data is normally copied from a socket + * send buffer in a protocol with m_copy for output to a peer, + * and then removing the data from the socket buffer with sbdrop() + * or sbdroprecord() when the data is acknowledged by the peer. + */ + +/* + * Append mbuf chain m to the last record in the + * socket buffer sb. The additional space associated + * the mbuf chain is recorded in sb. Empty mbufs are + * discarded and mbufs are compacted where possible. + */ +void +sbappend(sb, m) + struct sockbuf *sb; + struct mbuf *m; +{ + register struct mbuf *n; + + if (m == 0) + return; + n = sb->sb_mb; + if (n) { + while (n->m_nextpkt) + n = n->m_nextpkt; + do { + if (n->m_flags & M_EOR) { + sbappendrecord(sb, m); /* XXXXXX!!!! */ + return; + } + } while (n->m_next && (n = n->m_next)); + } + sbcompress(sb, m, n); +} + +#ifdef SOCKBUF_DEBUG +void +sbcheck(sb) + register struct sockbuf *sb; +{ + register struct mbuf *m; + register struct mbuf *n = 0; + register u_long len = 0, mbcnt = 0; + + for (m = sb->sb_mb; m; m = n) { + n = m->m_nextpkt; + for (; m; m = m->m_next) { + len += m->m_len; + mbcnt += MSIZE; + if (m->m_flags & M_EXT) /*XXX*/ /* pretty sure this is bogus */ + mbcnt += m->m_ext.ext_size; + } + } + if (len != sb->sb_cc || mbcnt != sb->sb_mbcnt) { + printf("cc %ld != %ld || mbcnt %ld != %ld\n", len, sb->sb_cc, + mbcnt, sb->sb_mbcnt); + panic("sbcheck"); + } +} +#endif + +/* + * As above, except the mbuf chain + * begins a new record. + */ +void +sbappendrecord(sb, m0) + register struct sockbuf *sb; + register struct mbuf *m0; +{ + register struct mbuf *m; + + if (m0 == 0) + return; + m = sb->sb_mb; + if (m) + while (m->m_nextpkt) + m = m->m_nextpkt; + /* + * Put the first mbuf on the queue. + * Note this permits zero length records. + */ + sballoc(sb, m0); + if (m) + m->m_nextpkt = m0; + else + sb->sb_mb = m0; + m = m0->m_next; + m0->m_next = 0; + if (m && (m0->m_flags & M_EOR)) { + m0->m_flags &= ~M_EOR; + m->m_flags |= M_EOR; + } + sbcompress(sb, m, m0); +} + +/* + * As above except that OOB data + * is inserted at the beginning of the sockbuf, + * but after any other OOB data. + */ +void +sbinsertoob(sb, m0) + register struct sockbuf *sb; + register struct mbuf *m0; +{ + register struct mbuf *m; + register struct mbuf **mp; + + if (m0 == 0) + return; + for (mp = &sb->sb_mb; *mp ; mp = &((*mp)->m_nextpkt)) { + m = *mp; + again: + switch (m->m_type) { + + case MT_OOBDATA: + continue; /* WANT next train */ + + case MT_CONTROL: + m = m->m_next; + if (m) + goto again; /* inspect THIS train further */ + } + break; + } + /* + * Put the first mbuf on the queue. + * Note this permits zero length records. + */ + sballoc(sb, m0); + m0->m_nextpkt = *mp; + *mp = m0; + m = m0->m_next; + m0->m_next = 0; + if (m && (m0->m_flags & M_EOR)) { + m0->m_flags &= ~M_EOR; + m->m_flags |= M_EOR; + } + sbcompress(sb, m, m0); +} + +/* + * Append address and data, and optionally, control (ancillary) data + * to the receive queue of a socket. If present, + * m0 must include a packet header with total length. + * Returns 0 if no space in sockbuf or insufficient mbufs. + */ +int +sbappendaddr(sb, asa, m0, control) + register struct sockbuf *sb; + struct sockaddr *asa; + struct mbuf *m0, *control; +{ + register struct mbuf *m, *n; + int space = asa->sa_len; + +if (m0 && (m0->m_flags & M_PKTHDR) == 0) +panic("sbappendaddr"); + if (m0) + space += m0->m_pkthdr.len; + for (n = control; n; n = n->m_next) { + space += n->m_len; + if (n->m_next == 0) /* keep pointer to last control buf */ + break; + } + if (space > sbspace(sb)) + return (0); + if (asa->sa_len > MLEN) + return (0); + MGET(m, M_DONTWAIT, MT_SONAME); + if (m == 0) + return (0); + m->m_len = asa->sa_len; + bcopy((caddr_t)asa, mtod(m, caddr_t), asa->sa_len); + if (n) + n->m_next = m0; /* concatenate data to control */ + else + control = m0; + m->m_next = control; + for (n = m; n; n = n->m_next) + sballoc(sb, n); + n = sb->sb_mb; + if (n) { + while (n->m_nextpkt) + n = n->m_nextpkt; + n->m_nextpkt = m; + } else + sb->sb_mb = m; + return (1); +} + +int +sbappendcontrol(sb, m0, control) + struct sockbuf *sb; + struct mbuf *control, *m0; +{ + register struct mbuf *m, *n; + int space = 0; + + if (control == 0) + panic("sbappendcontrol"); + for (m = control; ; m = m->m_next) { + space += m->m_len; + if (m->m_next == 0) + break; + } + n = m; /* save pointer to last control buffer */ + for (m = m0; m; m = m->m_next) + space += m->m_len; + if (space > sbspace(sb)) + return (0); + n->m_next = m0; /* concatenate data to control */ + for (m = control; m; m = m->m_next) + sballoc(sb, m); + n = sb->sb_mb; + if (n) { + while (n->m_nextpkt) + n = n->m_nextpkt; + n->m_nextpkt = control; + } else + sb->sb_mb = control; + return (1); +} + +/* + * Compress mbuf chain m into the socket + * buffer sb following mbuf n. If n + * is null, the buffer is presumed empty. + */ +void +sbcompress(sb, m, n) + register struct sockbuf *sb; + register struct mbuf *m, *n; +{ + register int eor = 0; + register struct mbuf *o; + + while (m) { + eor |= m->m_flags & M_EOR; + if (m->m_len == 0 && + (eor == 0 || + (((o = m->m_next) || (o = n)) && + o->m_type == m->m_type))) { + m = m_free(m); + continue; + } + if (n && (n->m_flags & M_EOR) == 0 && + M_WRITABLE(n) && + m->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */ + m->m_len <= M_TRAILINGSPACE(n) && + n->m_type == m->m_type) { + bcopy(mtod(m, caddr_t), mtod(n, caddr_t) + n->m_len, + (unsigned)m->m_len); + n->m_len += m->m_len; + sb->sb_cc += m->m_len; + m = m_free(m); + continue; + } + if (n) + n->m_next = m; + else + sb->sb_mb = m; + sballoc(sb, m); + n = m; + m->m_flags &= ~M_EOR; + m = m->m_next; + n->m_next = 0; + } + if (eor) { + if (n) + n->m_flags |= eor; + else + printf("semi-panic: sbcompress\n"); + } +} + +/* + * Free all mbufs in a sockbuf. + * Check that all resources are reclaimed. + */ +void +sbflush(sb) + register struct sockbuf *sb; +{ + + if (sb->sb_flags & SB_LOCK) + panic("sbflush: locked"); + while (sb->sb_mbcnt) { + /* + * Don't call sbdrop(sb, 0) if the leading mbuf is non-empty: + * we would loop forever. Panic instead. + */ + if (!sb->sb_cc && (sb->sb_mb == NULL || sb->sb_mb->m_len)) + break; + sbdrop(sb, (int)sb->sb_cc); + } + if (sb->sb_cc || sb->sb_mb || sb->sb_mbcnt) + panic("sbflush: cc %ld || mb %p || mbcnt %ld", sb->sb_cc, (void *)sb->sb_mb, sb->sb_mbcnt); +} + +/* + * Drop data from (the front of) a sockbuf. + */ +void +sbdrop(sb, len) + register struct sockbuf *sb; + register int len; +{ + register struct mbuf *m, *mn; + struct mbuf *next; + + next = (m = sb->sb_mb) ? m->m_nextpkt : 0; + while (len > 0) { + if (m == 0) { + if (next == 0) + panic("sbdrop"); + m = next; + next = m->m_nextpkt; + continue; + } + if (m->m_len > len) { + m->m_len -= len; + m->m_data += len; + sb->sb_cc -= len; + break; + } + len -= m->m_len; + sbfree(sb, m); + MFREE(m, mn); + m = mn; + } + while (m && m->m_len == 0) { + sbfree(sb, m); + MFREE(m, mn); + m = mn; + } + if (m) { + sb->sb_mb = m; + m->m_nextpkt = next; + } else + sb->sb_mb = next; +} + +/* + * Drop a record off the front of a sockbuf + * and move the next record to the front. + */ +void +sbdroprecord(sb) + register struct sockbuf *sb; +{ + register struct mbuf *m, *mn; + + m = sb->sb_mb; + if (m) { + sb->sb_mb = m->m_nextpkt; + do { + sbfree(sb, m); + MFREE(m, mn); + m = mn; + } while (m); + } +} + +/* + * Create a "control" mbuf containing the specified data + * with the specified type for presentation on a socket buffer. + */ +struct mbuf * +sbcreatecontrol(p, size, type, level) + caddr_t p; + register int size; + int type, level; +{ + register struct cmsghdr *cp; + struct mbuf *m; + + if (CMSG_SPACE((u_int)size) > MLEN) + return ((struct mbuf *) NULL); + if ((m = m_get(M_DONTWAIT, MT_CONTROL)) == NULL) + return ((struct mbuf *) NULL); + cp = mtod(m, struct cmsghdr *); + /* XXX check size? */ + (void)memcpy(CMSG_DATA(cp), p, size); + m->m_len = CMSG_SPACE(size); + cp->cmsg_len = CMSG_LEN(size); + cp->cmsg_level = level; + cp->cmsg_type = type; + return (m); +} + +/* + * Some routines that return EOPNOTSUPP for entry points that are not + * supported by a protocol. Fill in as needed. + */ +int +pru_accept_notsupp(struct socket *so, struct sockaddr **nam) +{ + return EOPNOTSUPP; +} + +int +pru_connect_notsupp(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + return EOPNOTSUPP; +} + +int +pru_connect2_notsupp(struct socket *so1, struct socket *so2) +{ + return EOPNOTSUPP; +} + +int +pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data, + struct ifnet *ifp, struct proc *p) +{ + return EOPNOTSUPP; +} + +int +pru_listen_notsupp(struct socket *so, struct proc *p) +{ + return EOPNOTSUPP; +} + +int +pru_rcvd_notsupp(struct socket *so, int flags) +{ + return EOPNOTSUPP; +} + +int +pru_rcvoob_notsupp(struct socket *so, struct mbuf *m, int flags) +{ + return EOPNOTSUPP; +} + +/* + * This isn't really a ``null'' operation, but it's the default one + * and doesn't do anything destructive. + */ +int +pru_sense_null(struct socket *so, struct stat *sb) +{ + return 0; +} + +/* + * Make a copy of a sockaddr in a malloced buffer of type M_SONAME. + */ +struct sockaddr * +dup_sockaddr(sa, canwait) + struct sockaddr *sa; + int canwait; +{ + struct sockaddr *sa2; + + MALLOC(sa2, struct sockaddr *, sa->sa_len, M_SONAME, + canwait ? M_WAITOK : M_NOWAIT); + if (sa2) + bcopy(sa, sa2, sa->sa_len); + return sa2; +} + +/* + * Create an external-format (``xsocket'') structure using the information + * in the kernel-format socket structure pointed to by so. This is done + * to reduce the spew of irrelevant information over this interface, + * to isolate user code from changes in the kernel structure, and + * potentially to provide information-hiding if we decide that + * some of this information should be hidden from users. + */ +void +sotoxsocket(struct socket *so, struct xsocket *xso) +{ + xso->xso_len = sizeof *xso; + xso->xso_so = so; + xso->so_type = so->so_type; + xso->so_options = so->so_options; + xso->so_linger = so->so_linger; + xso->so_state = so->so_state; + xso->so_pcb = so->so_pcb; + xso->xso_protocol = so->so_proto->pr_protocol; + xso->xso_family = so->so_proto->pr_domain->dom_family; + xso->so_qlen = so->so_qlen; + xso->so_incqlen = so->so_incqlen; + xso->so_qlimit = so->so_qlimit; + xso->so_timeo = so->so_timeo; + xso->so_error = so->so_error; + xso->so_oobmark = so->so_oobmark; + sbtoxsockbuf(&so->so_snd, &xso->so_snd); + sbtoxsockbuf(&so->so_rcv, &xso->so_rcv); +} + +/* + * This does the same for sockbufs. Note that the xsockbuf structure, + * since it is always embedded in a socket, does not include a self + * pointer nor a length. We make this entry point public in case + * some other mechanism needs it. + */ +void +sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb) +{ + xsb->sb_cc = sb->sb_cc; + xsb->sb_hiwat = sb->sb_hiwat; + xsb->sb_mbcnt = sb->sb_mbcnt; + xsb->sb_mbmax = sb->sb_mbmax; + xsb->sb_lowat = sb->sb_lowat; + xsb->sb_flags = sb->sb_flags; + xsb->sb_timeo = sb->sb_timeo; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/net/if.c b/packages/net/bsd_tcpip/current/src/sys/net/if.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/net/if.c @@ -0,0 +1,1731 @@ +//========================================================================== +// +// src/sys/net/if.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1980, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)if.c 8.3 (Berkeley) 1/4/94 + * $FreeBSD: src/sys/net/if.c,v 1.85.2.9 2001/07/24 19:10:17 brooks Exp $ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#if defined(INET) || defined(INET6) +/*XXX*/ +#include +#include +#ifdef INET6 +#include +#include +#endif +#endif + +/* + * System initialization + */ + +static int ifconf __P((u_long, caddr_t)); +static void ifinit __P((void *)); +static void if_qflush __P((struct ifqueue *)); +static void if_slowtimo __P((void *)); +static void link_rtrequest __P((int, struct rtentry *, struct sockaddr *)); +static int if_rtdel __P((struct radix_node *, void *)); + +SYSINIT(interfaces, SI_SUB_PROTO_IF, SI_ORDER_FIRST, ifinit, NULL) + +int ifqmaxlen = IFQ_MAXLEN; +struct ifnethead ifnet; /* depend on static init XXX */ + +#ifdef INET6 +/* + * XXX: declare here to avoid to include many inet6 related files.. + * should be more generalized? + */ +extern void nd6_setmtu __P((struct ifnet *)); +#endif + +struct if_clone *if_clone_lookup __P((const char *, int *)); +int if_clone_list __P((struct if_clonereq *)); + +LIST_HEAD(, if_clone) if_cloners = LIST_HEAD_INITIALIZER(if_cloners); +int if_cloners_count; + +/* + * Network interface utility routines. + * + * Routines with ifa_ifwith* names take sockaddr *'s as + * parameters. + */ +/* ARGSUSED*/ +void +ifinit(dummy) + void *dummy; +{ + struct ifnet *ifp; + int s; + + s = splimp(); + for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { + printf("IFP: %p, next: %p\n", ifp, ifp->if_link.tqe_next); + } + for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) + if (ifp->if_snd.ifq_maxlen == 0) { + printf("%s%d XXX: driver didn't set ifq_maxlen\n", + ifp->if_name, ifp->if_unit); + ifp->if_snd.ifq_maxlen = ifqmaxlen; + } + splx(s); + if_slowtimo(0); +} + +int if_index = 0; +struct ifaddr **ifnet_addrs; +struct ifnet **ifindex2ifnet = NULL; + +char * +_sa(struct ifaddr *ifa) +{ + struct sockaddr *sa = ifa->ifa_addr; + static char _unknown[128]; + + switch (sa->sa_family) { + case AF_INET: + return inet_ntoa((struct in_addr)((struct sockaddr_in *)(ifa->ifa_addr))->sin_addr); +#ifdef INET6 + case AF_INET6: + diag_sprintf(_unknown, "%s/%d", ip6_sprintf(IFA_IN6(ifa)), + in6_mask2len(&((struct in6_ifaddr *)ifa)->ia_prefixmask.sin6_addr, NULL)); + return _unknown; +#endif + case AF_LINK: + diag_sprintf(_unknown, "<<%p>>", sa); + return _unknown; + default: + diag_sprintf(_unknown, "[%d]", sa->sa_family); + return _unknown; + } +} + +void +_show_ifp(struct ifnet *ifp) +{ + log_(LOG_ADDR) { + struct ifaddr *ifa; + diag_printf("IFP: %p (%s%d)\n", ifp, ifp->if_name, ifp->if_unit); + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + diag_printf("IFA: %p - %s\n", ifa, _sa(ifa)); + } + } +} + +/* + * Attach an interface to the + * list of "active" interfaces. + */ +void +if_attach(ifp) + struct ifnet *ifp; +{ + unsigned socksize, ifasize; + int namelen, masklen; + char workbuf[64]; + register struct sockaddr_dl *sdl; + register struct ifaddr *ifa; + static int if_indexlim = 8; + static int inited; + + if (!inited) { + TAILQ_INIT(&ifnet); + inited = 1; + } + + TAILQ_INSERT_TAIL(&ifnet, ifp, if_link); + ifp->if_index = ++if_index; + /* + * XXX - + * The old code would work if the interface passed a pre-existing + * chain of ifaddrs to this code. We don't trust our callers to + * properly initialize the tailq, however, so we no longer allow + * this unlikely case. + */ + TAILQ_INIT(&ifp->if_addrhead); + log_(LOG_ADDR) { + diag_printf("%s.%d - After initialize list %p\n", + __FUNCTION__, __LINE__, + &ifp->if_addrlist); + _show_ifp(ifp); + } + TAILQ_INIT(&ifp->if_prefixhead); + LIST_INIT(&ifp->if_multiaddrs); + getmicrotime(&ifp->if_lastchange); + if (ifnet_addrs == 0 || if_index >= if_indexlim) { + unsigned n = (if_indexlim <<= 1) * sizeof(ifa); + caddr_t q = malloc(n, M_IFADDR, M_WAITOK); + bzero(q, n); + if (ifnet_addrs) { + bcopy((caddr_t)ifnet_addrs, (caddr_t)q, n/2); + free((caddr_t)ifnet_addrs, M_IFADDR); + } + ifnet_addrs = (struct ifaddr **)q; + + /* grow ifindex2ifnet */ + n = if_indexlim * sizeof(struct ifnet *); + q = malloc(n, M_IFADDR, M_WAITOK); + bzero(q, n); + if (ifindex2ifnet) { + bcopy((caddr_t)ifindex2ifnet, q, n/2); + free((caddr_t)ifindex2ifnet, M_IFADDR); + } + ifindex2ifnet = (struct ifnet **)q; + } + + ifindex2ifnet[if_index] = ifp; + + /* + * create a Link Level name for this device + */ + namelen = snprintf(workbuf, sizeof(workbuf), + "%s%d", ifp->if_name, ifp->if_unit); +#define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m)) + masklen = _offsetof(struct sockaddr_dl, sdl_data[0]) + namelen; + socksize = masklen + ifp->if_addrlen; +#define ROUNDUP(a) (1 + (((a) - 1) | (sizeof(long) - 1))) + if (socksize < sizeof(*sdl)) + socksize = sizeof(*sdl); + socksize = ROUNDUP(socksize); + ifasize = sizeof(*ifa) + 2 * socksize; + ifa = (struct ifaddr *)malloc(ifasize, M_IFADDR, M_WAITOK); + if (ifa) { + bzero((caddr_t)ifa, ifasize); + sdl = (struct sockaddr_dl *)(ifa + 1); + sdl->sdl_len = socksize; + sdl->sdl_family = AF_LINK; + bcopy(workbuf, sdl->sdl_data, namelen); + sdl->sdl_nlen = namelen; + sdl->sdl_index = ifp->if_index; + sdl->sdl_type = ifp->if_type; + ifnet_addrs[if_index - 1] = ifa; + ifa->ifa_ifp = ifp; + ifa->ifa_rtrequest = link_rtrequest; + ifa->ifa_addr = (struct sockaddr *)sdl; + sdl = (struct sockaddr_dl *)(socksize + (caddr_t)sdl); + ifa->ifa_netmask = (struct sockaddr *)sdl; + sdl->sdl_len = masklen; + while (namelen != 0) + sdl->sdl_data[--namelen] = 0xff; + TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); + log_(LOG_ADDR) { + diag_printf("%s.%d - After inserting %p into list %p\n", + __FUNCTION__, __LINE__, + ifa, &ifp->if_addrlist); + _show_ifp(ifp); + } + } +#ifdef ALTQ + ifp->if_snd.altq_type = 0; + ifp->if_snd.altq_disc = NULL; + ifp->if_snd.altq_flags &= ALTQF_CANTCHANGE; + ifp->if_snd.altq_tbr = NULL; + ifp->if_snd.altq_ifp = ifp; +#endif +} + +/* + * Detach an interface, removing it from the + * list of "active" interfaces. + */ +void +if_detach(ifp) + struct ifnet *ifp; +{ + struct ifaddr *ifa; + struct radix_node_head *rnh; + int s; + int i; + + /* + * Remove routes and flush queues. + */ + s = splnet(); + if_down(ifp); +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) + altq_disable(&ifp->if_snd); + if (ALTQ_IS_ATTACHED(&ifp->if_snd)) + altq_detach(&ifp->if_snd); +#endif + + /* + * Remove address from ifnet_addrs[] and maybe decrement if_index. + * Clean up all addresses. + */ + ifnet_addrs[ifp->if_index - 1] = 0; + while (if_index > 0 && ifnet_addrs[if_index - 1] == 0) + if_index--; + + for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; + ifa = TAILQ_FIRST(&ifp->if_addrhead)) { +#ifdef INET + /* XXX: Ugly!! ad hoc just for INET */ + if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) { + struct ifaliasreq ifr; + + bzero(&ifr, sizeof(ifr)); + ifr.ifra_addr = *ifa->ifa_addr; + if (ifa->ifa_dstaddr) + ifr.ifra_broadaddr = *ifa->ifa_dstaddr; + if (in_control(NULL, SIOCDIFADDR, (caddr_t)&ifr, ifp, + NULL) == 0) + continue; + } +#endif /* INET */ +#ifdef INET6 + if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET6) { + in6_purgeaddr(ifa); + /* ifp_addrhead is already updated */ + continue; + } +#endif /* INET6 */ + TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); + IFAFREE(ifa); + } + +#ifdef INET6 + /* + * Remove all IPv6 kernel structs related to ifp. This should be done + * before removing routing entries below, since IPv6 interface direct + * routes are expected to be removed by the IPv6-specific kernel API. + * Otherwise, the kernel will detect some inconsistency and bark it. + */ + in6_ifdetach(ifp); +#endif + + /* + * Delete all remaining routes using this interface + * Unfortuneatly the only way to do this is to slog through + * the entire routing table looking for routes which point + * to this interface...oh well... + */ + for (i = 1; i <= AF_MAX; i++) { + if ((rnh = rt_tables[i]) == NULL) + continue; + (void) rnh->rnh_walktree(rnh, if_rtdel, ifp); + } + + TAILQ_REMOVE(&ifnet, ifp, if_link); + splx(s); +} + +/* + * Delete Routes for a Network Interface + * + * Called for each routing entry via the rnh->rnh_walktree() call above + * to delete all route entries referencing a detaching network interface. + * + * Arguments: + * rn pointer to node in the routing table + * arg argument passed to rnh->rnh_walktree() - detaching interface + * + * Returns: + * 0 successful + * errno failed - reason indicated + * + */ +static int +if_rtdel(rn, arg) + struct radix_node *rn; + void *arg; +{ + struct rtentry *rt = (struct rtentry *)rn; + struct ifnet *ifp = arg; + int err; + + if (rt->rt_ifp == ifp) { + + /* + * Protect (sorta) against walktree recursion problems + * with cloned routes + */ + if ((rt->rt_flags & RTF_UP) == 0) + return (0); + + err = rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, + rt_mask(rt), rt->rt_flags, + (struct rtentry **) NULL); + if (err) { + log(LOG_WARNING, "if_rtdel: error %d\n", err); + } + } + + return (0); +} + +/* + * Create a clone network interface. + */ +int +if_clone_create(name, len) + char *name; + int len; +{ + struct if_clone *ifc; + char *dp; + int wildcard; + int unit; + int err; + + ifc = if_clone_lookup(name, &unit); + if (ifc == NULL) + return (EINVAL); + + if (ifunit(name) != NULL) + return (EEXIST); + + wildcard = (unit < 0); + + err = (*ifc->ifc_create)(ifc, &unit); + if (err != 0) + return (err); + + /* In the wildcard case, we need to update the name. */ + if (wildcard) { + for (dp = name; *dp != '\0'; dp++); + if (snprintf(dp, len - (dp-name), "%d", unit) > + len - (dp-name) - 1) { + /* + * This can only be a programmer error and + * there's no straightforward way to recover if + * it happens. + */ + panic("if_clone_create(): interface name too long"); + } + + } + + return (0); +} + +/* + * Destroy a clone network interface. + */ +int +if_clone_destroy(name) + const char *name; +{ + struct if_clone *ifc; + struct ifnet *ifp; + + ifc = if_clone_lookup(name, NULL); + if (ifc == NULL) + return (EINVAL); + + ifp = ifunit(name); + if (ifp == NULL) + return (ENXIO); + + if (ifc->ifc_destroy == NULL) + return (EOPNOTSUPP); + + (*ifc->ifc_destroy)(ifp); + return (0); +} + +/* + * Look up a network interface cloner. + */ +struct if_clone * +if_clone_lookup(name, unitp) + const char *name; + int *unitp; +{ + struct if_clone *ifc; + const char *cp; + int i; + + for (ifc = LIST_FIRST(&if_cloners); ifc != NULL;) { + for (cp = name, i = 0; i < ifc->ifc_namelen; i++, cp++) { + if (ifc->ifc_name[i] != *cp) + goto next_ifc; + } + goto found_name; + next_ifc: + ifc = LIST_NEXT(ifc, ifc_list); + } + + /* No match. */ + return ((struct if_clone *)NULL); + + found_name: + if (*cp == '\0') { + i = -1; + } else { + for (i = 0; *cp != '\0'; cp++) { + if (*cp < '0' || *cp > '9') { + /* Bogus unit number. */ + return (NULL); + } + i = (i * 10) + (*cp - '0'); + } + } + + if (unitp != NULL) + *unitp = i; + return (ifc); +} + +/* + * Register a network interface cloner. + */ +void +if_clone_attach(ifc) + struct if_clone *ifc; +{ + + LIST_INSERT_HEAD(&if_cloners, ifc, ifc_list); + if_cloners_count++; +} + +/* + * Unregister a network interface cloner. + */ +void +if_clone_detach(ifc) + struct if_clone *ifc; +{ + + LIST_REMOVE(ifc, ifc_list); + if_cloners_count--; +} + +/* + * Provide list of interface cloners to userspace. + */ +int +if_clone_list(ifcr) + struct if_clonereq *ifcr; +{ + char outbuf[IFNAMSIZ], *dst; + struct if_clone *ifc; + int count, error = 0; + + ifcr->ifcr_total = if_cloners_count; + if ((dst = ifcr->ifcr_buffer) == NULL) { + /* Just asking how many there are. */ + return (0); + } + + if (ifcr->ifcr_count < 0) + return (EINVAL); + + count = (if_cloners_count < ifcr->ifcr_count) ? + if_cloners_count : ifcr->ifcr_count; + + for (ifc = LIST_FIRST(&if_cloners); ifc != NULL && count != 0; + ifc = LIST_NEXT(ifc, ifc_list), count--, dst += IFNAMSIZ) { + strncpy(outbuf, ifc->ifc_name, IFNAMSIZ); + outbuf[IFNAMSIZ - 1] = '\0'; /* sanity */ + error = copyout(outbuf, dst, IFNAMSIZ); + if (error) + break; + } + + return (error); +} + +/* + * Locate an interface based on a complete address. + */ +/*ARGSUSED*/ +struct ifaddr * +ifa_ifwithaddr(addr) + register struct sockaddr *addr; +{ + register struct ifnet *ifp; + register struct ifaddr *ifa; + +#define equal(a1, a2) \ + (bcmp((caddr_t)(a1), (caddr_t)(a2), ((struct sockaddr *)(a1))->sa_len) == 0) + for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) + for (ifa = ifp->if_addrhead.tqh_first; ifa; + ifa = ifa->ifa_link.tqe_next) { + if (ifa->ifa_addr->sa_family != addr->sa_family) + continue; + if (equal(addr, ifa->ifa_addr)) + return (ifa); + if ((ifp->if_flags & IFF_BROADCAST) && ifa->ifa_broadaddr && + /* IP6 doesn't have broadcast */ + ifa->ifa_broadaddr->sa_len != 0 && + equal(ifa->ifa_broadaddr, addr)) + return (ifa); + } + return ((struct ifaddr *)0); +} +/* + * Locate the point to point interface with a given destination address. + */ +/*ARGSUSED*/ +struct ifaddr * +ifa_ifwithdstaddr(addr) + register struct sockaddr *addr; +{ + register struct ifnet *ifp; + register struct ifaddr *ifa; + + for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) + if (ifp->if_flags & IFF_POINTOPOINT) + for (ifa = ifp->if_addrhead.tqh_first; ifa; + ifa = ifa->ifa_link.tqe_next) { + if (ifa->ifa_addr->sa_family != addr->sa_family) + continue; + if (ifa->ifa_dstaddr && equal(addr, ifa->ifa_dstaddr)) + return (ifa); + } + return ((struct ifaddr *)0); +} + +/* + * Find an interface on a specific network. If many, choice + * is most specific found. + */ +struct ifaddr * +ifa_ifwithnet(addr) + struct sockaddr *addr; +{ + register struct ifnet *ifp; + register struct ifaddr *ifa; + struct ifaddr *ifa_maybe = (struct ifaddr *) 0; + u_int af = addr->sa_family; + char *addr_data = addr->sa_data, *cplim; + + /* + * AF_LINK addresses can be looked up directly by their index number, + * so do that if we can. + */ + if (af == AF_LINK) { + register struct sockaddr_dl *sdl = (struct sockaddr_dl *)addr; + if (sdl->sdl_index && sdl->sdl_index <= if_index) + return (ifnet_addrs[sdl->sdl_index - 1]); + } + + /* + * Scan though each interface, looking for ones that have + * addresses in this address family. + */ + for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { + for (ifa = ifp->if_addrhead.tqh_first; ifa; + ifa = ifa->ifa_link.tqe_next) { + register char *cp, *cp2, *cp3; + + if (ifa->ifa_addr->sa_family != af) +next: continue; + if ( +#ifdef INET6 /* XXX: for maching gif tunnel dst as routing entry gateway */ + addr->sa_family != AF_INET6 && +#endif + ifp->if_flags & IFF_POINTOPOINT) { + /* + * This is a bit broken as it doesn't + * take into account that the remote end may + * be a single node in the network we are + * looking for. + * The trouble is that we don't know the + * netmask for the remote end. + */ + if (ifa->ifa_dstaddr != 0 + && equal(addr, ifa->ifa_dstaddr)) + return (ifa); + } else { + /* + * if we have a special address handler, + * then use it instead of the generic one. + */ + if (ifa->ifa_claim_addr) { + if ((*ifa->ifa_claim_addr)(ifa, addr)) { + return (ifa); + } else { + continue; + } + } + + /* + * Scan all the bits in the ifa's address. + * If a bit dissagrees with what we are + * looking for, mask it with the netmask + * to see if it really matters. + * (A byte at a time) + */ + if (ifa->ifa_netmask == 0) + continue; + cp = addr_data; + cp2 = ifa->ifa_addr->sa_data; + cp3 = ifa->ifa_netmask->sa_data; + cplim = ifa->ifa_netmask->sa_len + + (char *)ifa->ifa_netmask; + while (cp3 < cplim) + if ((*cp++ ^ *cp2++) & *cp3++) + goto next; /* next address! */ + /* + * If the netmask of what we just found + * is more specific than what we had before + * (if we had one) then remember the new one + * before continuing to search + * for an even better one. + */ + if (ifa_maybe == 0 || + rn_refines((caddr_t)ifa->ifa_netmask, + (caddr_t)ifa_maybe->ifa_netmask)) + ifa_maybe = ifa; + } + } + } + return (ifa_maybe); +} + +/* + * Find an interface address specific to an interface best matching + * a given address. + */ +struct ifaddr * +ifaof_ifpforaddr(addr, ifp) + struct sockaddr *addr; + register struct ifnet *ifp; +{ + register struct ifaddr *ifa; + register char *cp, *cp2, *cp3; + register char *cplim; + struct ifaddr *ifa_maybe = 0; + u_int af = addr->sa_family; + + if (af >= AF_MAX) + return (0); + for (ifa = ifp->if_addrhead.tqh_first; ifa; + ifa = ifa->ifa_link.tqe_next) { + if (ifa->ifa_addr->sa_family != af) + continue; + if (ifa_maybe == 0) + ifa_maybe = ifa; + if (ifa->ifa_netmask == 0) { + if (equal(addr, ifa->ifa_addr) || + (ifa->ifa_dstaddr && equal(addr, ifa->ifa_dstaddr))) + return (ifa); + continue; + } + if (ifp->if_flags & IFF_POINTOPOINT) { + if (equal(addr, ifa->ifa_dstaddr)) + return (ifa); + } else { + cp = addr->sa_data; + cp2 = ifa->ifa_addr->sa_data; + cp3 = ifa->ifa_netmask->sa_data; + cplim = ifa->ifa_netmask->sa_len + (char *)ifa->ifa_netmask; + for (; cp3 < cplim; cp3++) + if ((*cp++ ^ *cp2++) & *cp3) + break; + if (cp3 == cplim) + return (ifa); + } + } + return (ifa_maybe); +} + +/* + * Default action when installing a route with a Link Level gateway. + * Lookup an appropriate real ifa to point to. + * This should be moved to /sys/net/link.c eventually. + */ +static void +link_rtrequest(cmd, rt, sa) + int cmd; + register struct rtentry *rt; + struct sockaddr *sa; +{ + register struct ifaddr *ifa; + struct sockaddr *dst; + struct ifnet *ifp; + + if (cmd != RTM_ADD || ((ifa = rt->rt_ifa) == 0) || + ((ifp = ifa->ifa_ifp) == 0) || ((dst = rt_key(rt)) == 0)) + return; + ifa = ifaof_ifpforaddr(dst, ifp); + if (ifa) { + IFAFREE(rt->rt_ifa); + rt->rt_ifa = ifa; + ifa->ifa_refcnt++; + if (ifa->ifa_rtrequest && ifa->ifa_rtrequest != link_rtrequest) + ifa->ifa_rtrequest(cmd, rt, sa); + } +} + +/* + * Mark an interface down and notify protocols of + * the transition. + * NOTE: must be called at splnet or eqivalent. + */ +void +if_unroute(ifp, flag, fam) + register struct ifnet *ifp; + int flag, fam; +{ + register struct ifaddr *ifa; + + ifp->if_flags &= ~flag; + getmicrotime(&ifp->if_lastchange); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) + pfctlinput(PRC_IFDOWN, ifa->ifa_addr); + if_qflush(&ifp->if_snd); + rt_ifmsg(ifp); +} + +/* + * Mark an interface up and notify protocols of + * the transition. + * NOTE: must be called at splnet or eqivalent. + */ +void +if_route(ifp, flag, fam) + register struct ifnet *ifp; + int flag, fam; +{ + register struct ifaddr *ifa; + + ifp->if_flags |= flag; + getmicrotime(&ifp->if_lastchange); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) + pfctlinput(PRC_IFUP, ifa->ifa_addr); + rt_ifmsg(ifp); +#ifdef INET6 + in6_if_up(ifp); +#endif +} + +/* + * Mark an interface down and notify protocols of + * the transition. + * NOTE: must be called at splnet or eqivalent. + */ +void +if_down(ifp) + register struct ifnet *ifp; +{ + + if_unroute(ifp, IFF_UP, AF_UNSPEC); +} + +/* + * Mark an interface up and notify protocols of + * the transition. + * NOTE: must be called at splnet or eqivalent. + */ +void +if_up(ifp) + register struct ifnet *ifp; +{ + + if_route(ifp, IFF_UP, AF_UNSPEC); +} + +/* + * Flush an interface queue. + */ +static void +if_qflush(ifq) +#ifdef ALTQ + struct ifaltq *ifq; +#else + register struct ifqueue *ifq; +#endif +{ + register struct mbuf *m, *n; + +#ifdef ALTQ + if (ALTQ_IS_ENABLED(ifq)) + ALTQ_PURGE(ifq); +#endif + n = ifq->ifq_head; + while ((m = n) != 0) { + n = m->m_act; + m_freem(m); + } + ifq->ifq_head = 0; + ifq->ifq_tail = 0; + ifq->ifq_len = 0; +} + +/* + * Handle interface watchdog timer routines. Called + * from softclock, we decrement timers (if set) and + * call the appropriate interface routine on expiration. + */ +static void +if_slowtimo(arg) + void *arg; +{ + register struct ifnet *ifp; + int s = splimp(); + + for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { + if (ifp->if_timer == 0 || --ifp->if_timer) + continue; + if (ifp->if_watchdog) + (*ifp->if_watchdog)(ifp); + } + splx(s); + timeout(if_slowtimo, (void *)0, hz / IFNET_SLOWHZ); +} + +/* + * Map interface name to + * interface structure pointer. + */ +struct ifnet * +ifunit(const char *name) +{ + char namebuf[IFNAMSIZ + 1]; + const char *cp; + struct ifnet *ifp; + int unit; + unsigned len, m; + char c; + + len = strlen(name); + if (len < 2 || len > IFNAMSIZ) + return NULL; + cp = name + len - 1; + c = *cp; + if (c < '0' || c > '9') + return NULL; /* trailing garbage */ + unit = 0; + m = 1; + do { + if (cp == name) + return NULL; /* no interface name */ + unit += (c - '0') * m; + if (unit > 1000000) + return NULL; /* number is unreasonable */ + m *= 10; + c = *--cp; + } while (c >= '0' && c <= '9'); + len = cp - name + 1; + bcopy(name, namebuf, len); + namebuf[len] = '\0'; + /* + * Now search all the interfaces for this name/number + */ + for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { + if (strcmp(ifp->if_name, namebuf)) + continue; + if (unit == ifp->if_unit) + break; + } + return (ifp); +} + + +/* + * Map interface name in a sockaddr_dl to + * interface structure pointer. + */ +struct ifnet * +if_withname(sa) + struct sockaddr *sa; +{ + char ifname[IFNAMSIZ+1]; + struct sockaddr_dl *sdl = (struct sockaddr_dl *)sa; + + if ( (sa->sa_family != AF_LINK) || (sdl->sdl_nlen == 0) || + (sdl->sdl_nlen > IFNAMSIZ) ) + return NULL; + + /* + * ifunit wants a null-terminated name. It may not be null-terminated + * in the sockaddr. We don't want to change the caller's sockaddr, + * and there might not be room to put the trailing null anyway, so we + * make a local copy that we know we can null terminate safely. + */ + + bcopy(sdl->sdl_data, ifname, sdl->sdl_nlen); + ifname[sdl->sdl_nlen] = '\0'; + return ifunit(ifname); +} + + +// TEMP? +#define _NAME(s) \ + case s: return #s; break; +char * +_ioctl_name(u_long cmd) +{ + static char unknown[32]; + + switch (cmd) { + _NAME(SIOCSHIWAT); + _NAME(SIOCGHIWAT); + _NAME(SIOCSLOWAT); + _NAME(SIOCGLOWAT); + _NAME(SIOCATMARK); + _NAME(SIOCSPGRP); + _NAME(SIOCGPGRP); + _NAME(SIOCADDRT); + _NAME(SIOCDELRT); +//_NAME(SIOCGETVIFCNT); +//_NAME(SIOCGETSGCNT); + _NAME(SIOCSIFADDR); + _NAME(OSIOCGIFADDR); + _NAME(SIOCGIFADDR); + _NAME(SIOCSIFDSTADDR); + _NAME(OSIOCGIFDSTADDR); + _NAME(SIOCGIFDSTADDR); + _NAME(SIOCSIFFLAGS); + _NAME(SIOCGIFFLAGS); + _NAME(OSIOCGIFBRDADDR); + _NAME(SIOCGIFBRDADDR); + _NAME(SIOCSIFBRDADDR); + _NAME(OSIOCGIFCONF); + _NAME(SIOCGIFCONF); + _NAME(OSIOCGIFNETMASK); + _NAME(SIOCGIFNETMASK); + _NAME(SIOCSIFNETMASK); + _NAME(SIOCGIFMETRIC); + _NAME(SIOCSIFMETRIC); + _NAME(SIOCDIFADDR); + _NAME(SIOCAIFADDR); + _NAME(SIOCALIFADDR); + _NAME(SIOCGLIFADDR); + _NAME(SIOCDLIFADDR); + _NAME(SIOCADDMULTI); + _NAME(SIOCDELMULTI); + _NAME(SIOCGIFMTU); + _NAME(SIOCSIFMTU); + _NAME(SIOCGIFPHYS); + _NAME(SIOCSIFPHYS); + _NAME(SIOCSIFMEDIA); + _NAME(SIOCGIFMEDIA); + _NAME(SIOCSIFPHYADDR ); + _NAME(SIOCGIFPSRCADDR); + _NAME(SIOCGIFPDSTADDR); + _NAME(SIOCDIFPHYADDR); + _NAME(SIOCSLIFPHYADDR); + _NAME(SIOCGLIFPHYADDR); + _NAME(SIOCSIFGENERIC); + _NAME(SIOCGIFGENERIC); + _NAME(SIOCGIFSTATUS); + _NAME(SIOCSIFLLADDR); + _NAME(SIOCIFCREATE); + _NAME(SIOCIFDESTROY); + _NAME(SIOCIFGCLONERS); + _NAME(FIONBIO); + _NAME(FIOASYNC); + _NAME(FIONREAD); + _NAME(SIOCGIFHWADDR); + _NAME(SIOCSIFHWADDR); + _NAME(SIOCGIFSTATSUD); + _NAME(SIOCGIFSTATS); + default: + diag_sprintf(unknown, "0x%08x", cmd); + return unknown; + } +} +// TEMP? + +/* + * Interface ioctls. + */ +int +ifioctl(so, cmd, data, p) + struct socket *so; + u_long cmd; + caddr_t data; + struct proc *p; +{ + register struct ifnet *ifp; + register struct ifreq *ifr; + struct ifstat *ifs; + int error; + short oif_flags; + + log(LOG_IOCTL, "%s: cmd: %s, data:\n", __FUNCTION__, _ioctl_name(cmd)); + switch (cmd) { + + case SIOCGIFCONF: + case OSIOCGIFCONF: + return (ifconf(cmd, data)); + } + ifr = (struct ifreq *)data; + + switch (cmd) { + case SIOCIFCREATE: + case SIOCIFDESTROY: + return ((cmd == SIOCIFCREATE) ? + if_clone_create(ifr->ifr_name, sizeof(ifr->ifr_name)) : + if_clone_destroy(ifr->ifr_name)); + + case SIOCIFGCLONERS: + return (if_clone_list((struct if_clonereq *)data)); + } + + ifp = ifunit(ifr->ifr_name); + if (ifp == 0) + return (ENXIO); + switch (cmd) { + + case SIOCGIFFLAGS: + ifr->ifr_flags = ifp->if_flags; + break; + + case SIOCGIFMETRIC: + ifr->ifr_metric = ifp->if_metric; + break; + + case SIOCGIFMTU: + ifr->ifr_mtu = ifp->if_mtu; + break; + + case SIOCGIFPHYS: + ifr->ifr_phys = ifp->if_physical; + break; + + case SIOCSIFFLAGS: + ifr->ifr_prevflags = ifp->if_flags; + if (ifp->if_flags & IFF_SMART) { + /* Smart drivers twiddle their own routes */ + } else if (ifp->if_flags & IFF_UP && + (ifr->ifr_flags & IFF_UP) == 0) { + int s = splimp(); + if_down(ifp); + splx(s); + } else if (ifr->ifr_flags & IFF_UP && + (ifp->if_flags & IFF_UP) == 0) { + int s = splimp(); + if_up(ifp); + splx(s); + } + ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) | + (ifr->ifr_flags &~ IFF_CANTCHANGE); + if (ifp->if_ioctl) + (void) (*ifp->if_ioctl)(ifp, cmd, data); + getmicrotime(&ifp->if_lastchange); + break; + + case SIOCSIFMETRIC: + ifp->if_metric = ifr->ifr_metric; + getmicrotime(&ifp->if_lastchange); + break; + + case SIOCSIFPHYS: + if (!ifp->if_ioctl) + return EOPNOTSUPP; + error = (*ifp->if_ioctl)(ifp, cmd, data); + if (error == 0) + getmicrotime(&ifp->if_lastchange); + return(error); + + case SIOCSIFMTU: + { + u_long oldmtu = ifp->if_mtu; + + if (ifp->if_ioctl == NULL) + return (EOPNOTSUPP); + if (ifr->ifr_mtu < IF_MINMTU || ifr->ifr_mtu > IF_MAXMTU) + return (EINVAL); + error = (*ifp->if_ioctl)(ifp, cmd, data); + if (error == 0) { + getmicrotime(&ifp->if_lastchange); + rt_ifmsg(ifp); + } + /* + * If the link MTU changed, do network layer specific procedure. + */ + if (ifp->if_mtu != oldmtu) { +#ifdef INET6 + nd6_setmtu(ifp); +#endif + } + return (error); + } + + case SIOCADDMULTI: + case SIOCDELMULTI: + + /* Don't allow group membership on non-multicast interfaces. */ + if ((ifp->if_flags & IFF_MULTICAST) == 0) + return EOPNOTSUPP; + + /* Don't let users screw up protocols' entries. */ + if (ifr->ifr_addr.sa_family != AF_LINK) + return EINVAL; + + log(LOG_IOCTL, "%s: %s Multi\n", __FUNCTION__, + (cmd == SIOCADDMULTI) ? "Add" : "Del"); + log_dump(LOG_IOCTL, &ifr->ifr_addr, 32); + if (cmd == SIOCADDMULTI) { + struct ifmultiaddr *ifma; + error = if_addmulti(ifp, &ifr->ifr_addr, &ifma); + } else { + error = if_delmulti(ifp, &ifr->ifr_addr); + } + if (error == 0) + getmicrotime(&ifp->if_lastchange); + return error; + + case SIOCSIFPHYADDR: + case SIOCDIFPHYADDR: +#ifdef INET6 + case SIOCSIFPHYADDR_IN6: +#endif + case SIOCSLIFPHYADDR: + case SIOCSIFMEDIA: + case SIOCSIFGENERIC: + if (ifp->if_ioctl == 0) + return (EOPNOTSUPP); + error = (*ifp->if_ioctl)(ifp, cmd, data); + if (error == 0) + getmicrotime(&ifp->if_lastchange); + return error; + + case SIOCGIFSTATUS: + ifs = (struct ifstat *)data; + ifs->ascii[0] = '\0'; + + case SIOCGIFPSRCADDR: + case SIOCGIFPDSTADDR: + case SIOCGLIFPHYADDR: + case SIOCGIFMEDIA: + case SIOCGIFGENERIC: + if (ifp->if_ioctl == 0) + return (EOPNOTSUPP); + return ((*ifp->if_ioctl)(ifp, cmd, data)); + + case SIOCSIFLLADDR: + return if_setlladdr(ifp, + ifr->ifr_addr.sa_data, ifr->ifr_addr.sa_len); + + default: + oif_flags = ifp->if_flags; + if (so->so_proto == 0) + return (EOPNOTSUPP); +#ifndef COMPAT_43 + error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, + data, + ifp, p)); +#else + { + int ocmd = cmd; + + switch (cmd) { + + case SIOCSIFDSTADDR: + case SIOCSIFADDR: + case SIOCSIFBRDADDR: + case SIOCSIFNETMASK: +#if BYTE_ORDER != BIG_ENDIAN + if (ifr->ifr_addr.sa_family == 0 && + ifr->ifr_addr.sa_len < 16) { + ifr->ifr_addr.sa_family = ifr->ifr_addr.sa_len; + ifr->ifr_addr.sa_len = 16; + } +#else + if (ifr->ifr_addr.sa_len == 0) + ifr->ifr_addr.sa_len = 16; +#endif + break; + + case OSIOCGIFADDR: + cmd = SIOCGIFADDR; + break; + + case OSIOCGIFDSTADDR: + cmd = SIOCGIFDSTADDR; + break; + + case OSIOCGIFBRDADDR: + cmd = SIOCGIFBRDADDR; + break; + + case OSIOCGIFNETMASK: + cmd = SIOCGIFNETMASK; + } + error = ((*so->so_proto->pr_usrreqs->pru_control)(so, + cmd, + data, + ifp, p)); + switch (ocmd) { + + case OSIOCGIFADDR: + case OSIOCGIFDSTADDR: + case OSIOCGIFBRDADDR: + case OSIOCGIFNETMASK: + *(u_short *)&ifr->ifr_addr = ifr->ifr_addr.sa_family; + + } + } +#endif /* COMPAT_43 */ + + if ((oif_flags ^ ifp->if_flags) & IFF_UP) { +#ifdef INET6 +#define DELAY cyg_thread_delay + DELAY(100);/* XXX: temporary workaround for fxp issue*/ + if (ifp->if_flags & IFF_UP) { + int s = splimp(); + in6_if_up(ifp); + splx(s); + } +#endif + } + return (error); + + } + return (0); +} + +/* + * Set/clear promiscuous mode on interface ifp based on the truth value + * of pswitch. The calls are reference counted so that only the first + * "on" request actually has an effect, as does the final "off" request. + * Results are undefined if the "off" and "on" requests are not matched. + */ +int +ifpromisc(ifp, pswitch) + struct ifnet *ifp; + int pswitch; +{ + struct ifreq ifr; + int error; + int oldflags; + + oldflags = ifp->if_flags; + if (pswitch) { + /* + * If the device is not configured up, we cannot put it in + * promiscuous mode. + */ + if ((ifp->if_flags & IFF_UP) == 0) + return (ENETDOWN); + if (ifp->if_pcount++ != 0) + return (0); + ifp->if_flags |= IFF_PROMISC; + log(LOG_INFO, "%s%d: promiscuous mode enabled\n", + ifp->if_name, ifp->if_unit); + } else { + if (--ifp->if_pcount > 0) + return (0); + ifp->if_flags &= ~IFF_PROMISC; + log(LOG_INFO, "%s%d: promiscuous mode disabled\n", + ifp->if_name, ifp->if_unit); + } + ifr.ifr_flags = ifp->if_flags; + error = (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr); + if (error == 0) + rt_ifmsg(ifp); + else + ifp->if_flags = oldflags; + return error; +} + +/* + * Return interface configuration + * of system. List may be used + * in later ioctl's (above) to get + * other information. + */ +/*ARGSUSED*/ +static int +ifconf(cmd, data) + u_long cmd; + caddr_t data; +{ + register struct ifconf *ifc = (struct ifconf *)data; + register struct ifnet *ifp = ifnet.tqh_first; + register struct ifaddr *ifa; + struct ifreq ifr, *ifrp; + int space = ifc->ifc_len, error = 0; + + ifrp = ifc->ifc_req; + for (; space > sizeof (ifr) && ifp; ifp = ifp->if_link.tqe_next) { + char workbuf[64]; + int ifnlen, addrs; + + ifnlen = snprintf(workbuf, sizeof(workbuf), + "%s%d", ifp->if_name, ifp->if_unit); + if(ifnlen + 1 > sizeof ifr.ifr_name) { + error = ENAMETOOLONG; + break; + } else { + strcpy(ifr.ifr_name, workbuf); + } + + addrs = 0; + ifa = ifp->if_addrhead.tqh_first; + for ( ; space > sizeof (ifr) && ifa; + ifa = ifa->ifa_link.tqe_next) { + register struct sockaddr *sa = ifa->ifa_addr; + addrs++; +#ifdef COMPAT_43 + if (cmd == OSIOCGIFCONF) { + struct osockaddr *osa = + (struct osockaddr *)&ifr.ifr_addr; + ifr.ifr_addr = *sa; + osa->sa_family = sa->sa_family; + error = copyout((caddr_t)&ifr, (caddr_t)ifrp, + sizeof (ifr)); + ifrp++; + } else +#endif + if (sa->sa_len <= sizeof(*sa)) { + ifr.ifr_addr = *sa; + error = copyout((caddr_t)&ifr, (caddr_t)ifrp, + sizeof (ifr)); + ifrp++; + } else { + if (space < sizeof (ifr) + sa->sa_len - + sizeof(*sa)) + break; + space -= sa->sa_len - sizeof(*sa); + error = copyout((caddr_t)&ifr, (caddr_t)ifrp, + sizeof (ifr.ifr_name)); + if (error == 0) + error = copyout((caddr_t)sa, + (caddr_t)&ifrp->ifr_addr, sa->sa_len); + ifrp = (struct ifreq *) + (sa->sa_len + (caddr_t)&ifrp->ifr_addr); + } + if (error) + break; + space -= sizeof (ifr); + } + if (error) + break; + if (!addrs) { + bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr)); + error = copyout((caddr_t)&ifr, (caddr_t)ifrp, + sizeof (ifr)); + if (error) + break; + space -= sizeof (ifr); + ifrp++; + } + } + ifc->ifc_len -= space; + return (error); +} + +/* + * Just like if_promisc(), but for all-multicast-reception mode. + */ +int +if_allmulti(ifp, onswitch) + struct ifnet *ifp; + int onswitch; +{ + int error = 0; + int s = splimp(); + + if (onswitch) { + if (ifp->if_amcount++ == 0) { + ifp->if_flags |= IFF_ALLMULTI; + error = ifp->if_ioctl(ifp, SIOCSIFFLAGS, 0); + } + } else { + if (ifp->if_amcount > 1) { + ifp->if_amcount--; + } else { + ifp->if_amcount = 0; + ifp->if_flags &= ~IFF_ALLMULTI; + error = ifp->if_ioctl(ifp, SIOCSIFFLAGS, 0); + } + } + splx(s); + + if (error == 0) + rt_ifmsg(ifp); + return error; +} + +/* + * Add a multicast listenership to the interface in question. + * The link layer provides a routine which converts + */ +int +if_addmulti(ifp, sa, retifma) + struct ifnet *ifp; /* interface to manipulate */ + struct sockaddr *sa; /* address to add */ + struct ifmultiaddr **retifma; +{ + struct sockaddr *llsa, *dupsa; + int error, s; + struct ifmultiaddr *ifma; + + /* + * If the matching multicast address already exists + * then don't add a new one, just add a reference + */ + for (ifma = ifp->if_multiaddrs.lh_first; ifma; + ifma = ifma->ifma_link.le_next) { + if (equal(sa, ifma->ifma_addr)) { + ifma->ifma_refcount++; + if (retifma) + *retifma = ifma; + return 0; + } + } + + /* + * Give the link layer a chance to accept/reject it, and also + * find out which AF_LINK address this maps to, if it isn't one + * already. + */ + if (ifp->if_resolvemulti) { + error = ifp->if_resolvemulti(ifp, &llsa, sa); + if (error) return error; + } else { + llsa = 0; + } + + MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, M_WAITOK); + MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, M_WAITOK); + bcopy(sa, dupsa, sa->sa_len); + + ifma->ifma_addr = dupsa; + ifma->ifma_lladdr = llsa; + ifma->ifma_ifp = ifp; + ifma->ifma_refcount = 1; + ifma->ifma_protospec = 0; + rt_newmaddrmsg(RTM_NEWMADDR, ifma); + + /* + * Some network interfaces can scan the address list at + * interrupt time; lock them out. + */ + s = splimp(); + LIST_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link); + splx(s); + *retifma = ifma; + + if (llsa != 0) { + for (ifma = ifp->if_multiaddrs.lh_first; ifma; + ifma = ifma->ifma_link.le_next) { + if (equal(ifma->ifma_addr, llsa)) + break; + } + if (ifma) { + ifma->ifma_refcount++; + } else { + MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, + M_IFMADDR, M_WAITOK); + MALLOC(dupsa, struct sockaddr *, llsa->sa_len, + M_IFMADDR, M_WAITOK); + bcopy(llsa, dupsa, llsa->sa_len); + ifma->ifma_addr = dupsa; + ifma->ifma_ifp = ifp; + ifma->ifma_refcount = 1; + s = splimp(); + LIST_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link); + splx(s); + } + } + /* + * We are certain we have added something, so call down to the + * interface to let them know about it. + */ + s = splimp(); + ifp->if_ioctl(ifp, SIOCADDMULTI, 0); + splx(s); + + return 0; +} + +/* + * Remove a reference to a multicast address on this interface. Yell + * if the request does not match an existing membership. + */ +int +if_delmulti(ifp, sa) + struct ifnet *ifp; + struct sockaddr *sa; +{ + struct ifmultiaddr *ifma; + int s; + + for (ifma = ifp->if_multiaddrs.lh_first; ifma; + ifma = ifma->ifma_link.le_next) + if (equal(sa, ifma->ifma_addr)) + break; + if (ifma == 0) + return ENOENT; + + if (ifma->ifma_refcount > 1) { + ifma->ifma_refcount--; + return 0; + } + + rt_newmaddrmsg(RTM_DELMADDR, ifma); + sa = ifma->ifma_lladdr; + s = splimp(); + LIST_REMOVE(ifma, ifma_link); + /* + * Make sure the interface driver is notified + * in the case of a link layer mcast group being left. + */ + if (ifma->ifma_addr->sa_family == AF_LINK && sa == 0) + ifp->if_ioctl(ifp, SIOCDELMULTI, 0); + splx(s); + free(ifma->ifma_addr, M_IFMADDR); + free(ifma, M_IFMADDR); + if (sa == 0) + return 0; + + /* + * Now look for the link-layer address which corresponds to + * this network address. It had been squirreled away in + * ifma->ifma_lladdr for this purpose (so we don't have + * to call ifp->if_resolvemulti() again), and we saved that + * value in sa above. If some nasty deleted the + * link-layer address out from underneath us, we can deal because + * the address we stored was is not the same as the one which was + * in the record for the link-layer address. (So we don't complain + * in that case.) + */ + for (ifma = ifp->if_multiaddrs.lh_first; ifma; + ifma = ifma->ifma_link.le_next) + if (equal(sa, ifma->ifma_addr)) + break; + if (ifma == 0) + return 0; + + if (ifma->ifma_refcount > 1) { + ifma->ifma_refcount--; + return 0; + } + + s = splimp(); + LIST_REMOVE(ifma, ifma_link); + ifp->if_ioctl(ifp, SIOCDELMULTI, 0); + splx(s); + free(ifma->ifma_addr, M_IFMADDR); + free(sa, M_IFMADDR); + free(ifma, M_IFMADDR); + + return 0; +} + +/* + * Set the link layer address on an interface. + * + * At this time we only support certain types of interfaces, + * and we don't allow the length of the address to change. + */ +int +if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len) +{ + struct sockaddr_dl *sdl; + struct ifaddr *ifa; + + ifa = ifnet_addrs[ifp->if_index - 1]; + if (ifa == NULL) + return (EINVAL); + sdl = (struct sockaddr_dl *)ifa->ifa_addr; + if (sdl == NULL) + return (EINVAL); + if (len != sdl->sdl_alen) /* don't allow length to change */ + return (EINVAL); + switch (ifp->if_type) { + case IFT_ETHER: /* these types use struct arpcom */ + case IFT_FDDI: + case IFT_XETHER: + case IFT_ISO88025: + case IFT_L2VLAN: + bcopy(lladdr, ((struct arpcom *)ifp->if_softc)->ac_enaddr, len); + bcopy(lladdr, LLADDR(sdl), len); + break; + default: + return (ENODEV); + } + /* + * If the interface is already up, we need + * to re-init it in order to reprogram its + * address filter. + */ + if ((ifp->if_flags & IFF_UP) != 0) { + ifp->if_flags &= ~IFF_UP; + (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, NULL); + ifp->if_flags |= IFF_UP; + (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, NULL); + } + return (0); +} + +struct ifmultiaddr * +ifmaof_ifpforaddr(sa, ifp) + struct sockaddr *sa; + struct ifnet *ifp; +{ + struct ifmultiaddr *ifma; + + for (ifma = ifp->if_multiaddrs.lh_first; ifma; + ifma = ifma->ifma_link.le_next) + if (equal(ifma->ifma_addr, sa)) + break; + + return ifma; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/net/if_ethersubr.c b/packages/net/bsd_tcpip/current/src/sys/net/if_ethersubr.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/net/if_ethersubr.c @@ -0,0 +1,944 @@ +//========================================================================== +// +// src/sys/net/if_ethersubr.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1989, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_ethersubr.c,v 1.70.2.17 2001/08/01 00:47:49 fenner Exp $ + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#if defined(INET) || defined(INET6) +#include +#include +#include +#endif +#ifdef INET6 +#include +#endif + +#ifdef IPX +#include +#include +int (*ef_inputp)(struct ifnet*, struct ether_header *eh, struct mbuf *m); +int (*ef_outputp)(struct ifnet *ifp, struct mbuf **mp, + struct sockaddr *dst, short *tp, int *hlen); +#endif + +#ifdef NS +#include +#include +ushort ns_nettype; +int ether_outputdebug = 0; +int ether_inputdebug = 0; +#endif + +#ifdef NETATALK +#include +#include +#include + +#define llc_snap_org_code llc_un.type_snap.org_code +#define llc_snap_ether_type llc_un.type_snap.ether_type + +extern u_char at_org_code[3]; +extern u_char aarp_org_code[3]; +#endif /* NETATALK */ + +#ifdef BRIDGE +#include +#endif + +#define NVLAN 0 +#if NVLAN > 0 +#include +#endif /* NVLAN > 0 */ + +/* netgraph node hooks for ng_ether(4) */ +void (*ng_ether_input_p)(struct ifnet *ifp, + struct mbuf **mp, struct ether_header *eh); +void (*ng_ether_input_orphan_p)(struct ifnet *ifp, + struct mbuf *m, struct ether_header *eh); +int (*ng_ether_output_p)(struct ifnet *ifp, struct mbuf **mp); +void (*ng_ether_attach_p)(struct ifnet *ifp); +void (*ng_ether_detach_p)(struct ifnet *ifp); + +static int ether_resolvemulti __P((struct ifnet *, struct sockaddr **, + struct sockaddr *)); +u_char etherbroadcastaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +#define senderr(e) do { error = (e); goto bad;} while (0) +#define IFP2AC(IFP) ((struct arpcom *)IFP) + +/* + * Ethernet output routine. + * Encapsulate a packet of type family for the local net. + * Use trailer local net encapsulation if enough data in first + * packet leaves a multiple of 512 bytes of data in remainder. + * Assumes that ifp is actually pointer to arpcom structure. + */ +int +ether_output(ifp, m, dst, rt0) + register struct ifnet *ifp; + struct mbuf *m; + struct sockaddr *dst; + struct rtentry *rt0; +{ + short type; + int error = 0, hdrcmplt = 0; + u_char esrc[6], edst[6]; + register struct rtentry *rt; + register struct ether_header *eh; + int off, loop_copy = 0; + int hlen; /* link layer header lenght */ + struct arpcom *ac = IFP2AC(ifp); + + if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) + senderr(ENETDOWN); + rt = rt0; + if (rt) { + if ((rt->rt_flags & RTF_UP) == 0) { + rt0 = rt = rtalloc1(dst, 1, 0UL); + if (rt0) + rt->rt_refcnt--; + else + senderr(EHOSTUNREACH); + } + if (rt->rt_flags & RTF_GATEWAY) { + if (rt->rt_gwroute == 0) + goto lookup; + if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) { + rtfree(rt); rt = rt0; + lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1, + 0UL); + if ((rt = rt->rt_gwroute) == 0) + senderr(EHOSTUNREACH); + } + } + if (rt->rt_flags & RTF_REJECT) + if (rt->rt_rmx.rmx_expire == 0 || + time_second < rt->rt_rmx.rmx_expire) + senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH); + } + hlen = ETHER_HDR_LEN; + switch (dst->sa_family) { +#ifdef INET + case AF_INET: + if (!arpresolve(ac, rt, m, dst, edst, rt0)) + return (0); /* if not yet resolved */ + off = m->m_pkthdr.len - m->m_len; + type = htons(ETHERTYPE_IP); + break; +#endif +#ifdef INET6 + case AF_INET6: + if (!nd6_storelladdr(&ac->ac_if, rt, m, dst, (u_char *)edst)) { + /* Something bad happened */ + return(0); + } + off = m->m_pkthdr.len - m->m_len; + type = htons(ETHERTYPE_IPV6); + break; +#endif +#ifdef IPX + case AF_IPX: + if (ef_outputp) { + error = ef_outputp(ifp, &m, dst, &type, &hlen); + if (error) + goto bad; + } else + type = htons(ETHERTYPE_IPX); + bcopy((caddr_t)&(((struct sockaddr_ipx *)dst)->sipx_addr.x_host), + (caddr_t)edst, sizeof (edst)); + break; +#endif +#ifdef NETATALK + case AF_APPLETALK: + { + struct at_ifaddr *aa; + + if ((aa = at_ifawithnet((struct sockaddr_at *)dst)) == NULL) { + goto bad; + } + if (!aarpresolve(ac, m, (struct sockaddr_at *)dst, edst)) + return (0); + /* + * In the phase 2 case, need to prepend an mbuf for the llc header. + * Since we must preserve the value of m, which is passed to us by + * value, we m_copy() the first mbuf, and use it for our llc header. + */ + if ( aa->aa_flags & AFA_PHASE2 ) { + struct llc llc; + + M_PREPEND(m, sizeof(struct llc), M_WAIT); + llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP; + llc.llc_control = LLC_UI; + bcopy(at_org_code, llc.llc_snap_org_code, sizeof(at_org_code)); + llc.llc_snap_ether_type = htons( ETHERTYPE_AT ); + bcopy(&llc, mtod(m, caddr_t), sizeof(struct llc)); + type = htons(m->m_pkthdr.len); + hlen = sizeof(struct llc) + ETHER_HDR_LEN; + } else { + type = htons(ETHERTYPE_AT); + } + break; + } +#endif NETATALK +#ifdef NS + case AF_NS: + switch(ns_nettype){ + default: + case 0x8137: /* Novell Ethernet_II Ethernet TYPE II */ + type = 0x8137; + break; + case 0x0: /* Novell 802.3 */ + type = htons( m->m_pkthdr.len); + break; + case 0xe0e0: /* Novell 802.2 and Token-Ring */ + M_PREPEND(m, 3, M_WAIT); + type = htons( m->m_pkthdr.len); + cp = mtod(m, u_char *); + *cp++ = 0xE0; + *cp++ = 0xE0; + *cp++ = 0x03; + break; + } + bcopy((caddr_t)&(((struct sockaddr_ns *)dst)->sns_addr.x_host), + (caddr_t)edst, sizeof (edst)); + /* + * XXX if ns_thishost is the same as the node's ethernet + * address then just the default code will catch this anyhow. + * So I'm not sure if this next clause should be here at all? + * [JRE] + */ + if (!bcmp((caddr_t)edst, (caddr_t)&ns_thishost, sizeof(edst))){ + m->m_pkthdr.rcvif = ifp; + schednetisr(NETISR_NS); + inq = &nsintrq; + s = splimp(); + if (IF_QFULL(inq)) { + IF_DROP(inq); + m_freem(m); + } else + IF_ENQUEUE(inq, m); + splx(s); + return (error); + } + if (!bcmp((caddr_t)edst, (caddr_t)&ns_broadhost, sizeof(edst))){ + m->m_flags |= M_BCAST; + } + break; +#endif /* NS */ + + case pseudo_AF_HDRCMPLT: + hdrcmplt = 1; + eh = (struct ether_header *)dst->sa_data; + (void)memcpy(esrc, eh->ether_shost, sizeof (esrc)); + /* FALLTHROUGH */ + + case AF_UNSPEC: + loop_copy = -1; /* if this is for us, don't do it */ + eh = (struct ether_header *)dst->sa_data; + (void)memcpy(edst, eh->ether_dhost, sizeof (edst)); + type = eh->ether_type; + break; + + default: + printf("%s%d: can't handle af%d\n", ifp->if_name, ifp->if_unit, + dst->sa_family); + senderr(EAFNOSUPPORT); + } + + /* + * Add local net header. If no space in first mbuf, + * allocate another. + */ + M_PREPEND(m, sizeof (struct ether_header), M_DONTWAIT); + if (m == 0) + senderr(ENOBUFS); + eh = mtod(m, struct ether_header *); + (void)memcpy(&eh->ether_type, &type, + sizeof(eh->ether_type)); + (void)memcpy(eh->ether_dhost, edst, sizeof (edst)); + if (hdrcmplt) + (void)memcpy(eh->ether_shost, esrc, + sizeof(eh->ether_shost)); + else + (void)memcpy(eh->ether_shost, ac->ac_enaddr, + sizeof(eh->ether_shost)); + + /* + * If a simplex interface, and the packet is being sent to our + * Ethernet address or a broadcast address, loopback a copy. + * XXX To make a simplex device behave exactly like a duplex + * device, we should copy in the case of sending to our own + * ethernet address (thus letting the original actually appear + * on the wire). However, we don't do that here for security + * reasons and compatibility with the original behavior. + */ + if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) { + if ((m->m_flags & M_BCAST) || (loop_copy > 0)) { + struct mbuf *n = m_copy(m, 0, (int)M_COPYALL); + + (void) if_simloop(ifp, n, dst->sa_family, hlen); + } else if (bcmp(eh->ether_dhost, + eh->ether_shost, ETHER_ADDR_LEN) == 0) { + (void) if_simloop(ifp, m, dst->sa_family, hlen); + return (0); /* XXX */ + } + } + + /* Handle ng_ether(4) processing, if any */ + if (ng_ether_output_p != NULL) { + if ((error = (*ng_ether_output_p)(ifp, &m)) != 0) { +bad: if (m != NULL) + m_freem(m); + return (error); + } + if (m == NULL) + return (0); + } + + /* Continue with link-layer output */ + return ether_output_frame(ifp, m); +} + +/* + * Ethernet link layer output routine to send a raw frame to the device. + * + * This assumes that the 14 byte Ethernet header is present and contiguous + * in the first mbuf (if BRIDGE'ing). + */ +int +ether_output_frame(ifp, m) + struct ifnet *ifp; + struct mbuf *m; +{ + int s, len, error = 0; + short mflags; +#ifdef ALTQ + struct altq_pktattr pktattr; +#endif + +#ifdef BRIDGE + if (do_bridge && BDG_USED(ifp) ) { + struct ether_header *eh; /* a ptr suffices */ + + m->m_pkthdr.rcvif = NULL; + eh = mtod(m, struct ether_header *); + m_adj(m, ETHER_HDR_LEN); + m = bdg_forward(m, eh, ifp); + if (m != NULL) + m_freem(m); + return (0); + } +#endif +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) + altq_etherclassify(&ifp->if_snd, m, &pktattr); +#endif + mflags = m->m_flags; + len = m->m_pkthdr.len; + s = splimp(); + /* + * Queue message on interface, and start output if interface + * not yet active. + */ +#ifdef ALTQ + IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error); +#else + IFQ_ENQUEUE(&ifp->if_snd, m, error); +#endif + if (error) { + /* mbuf is already freed */ + splx(s); + return (error); + } + ifp->if_obytes += len; + if (mflags & M_MCAST) + ifp->if_omcasts++; + if ((ifp->if_flags & IFF_OACTIVE) == 0) + (*ifp->if_start)(ifp); + splx(s); + return (error); +} + +/* + * Process a received Ethernet packet; + * the packet is in the mbuf chain m without + * the ether header, which is provided separately. + * + * First we perform any link layer operations, then continue + * to the upper layers with ether_demux(). + */ +void +ether_input(ifp, eh, m) + struct ifnet *ifp; + struct ether_header *eh; + struct mbuf *m; +{ +#ifdef BRIDGE + struct ether_header save_eh; +#endif + +#ifdef BPF + /* Check for a BPF tap */ + if (ifp->if_bpf != NULL) { + struct m_hdr mh; + + /* This kludge is OK; BPF treats the "mbuf" as read-only */ + mh.mh_next = m; + mh.mh_data = (char *)eh; + mh.mh_len = ETHER_HDR_LEN; + bpf_mtap(ifp, (struct mbuf *)&mh); + } +#endif + + /* Handle ng_ether(4) processing, if any */ + if (ng_ether_input_p != NULL) { + (*ng_ether_input_p)(ifp, &m, eh); + if (m == NULL) + return; + } + +#ifdef BRIDGE + /* Check for bridging mode */ + if (do_bridge && BDG_USED(ifp) ) { + struct ifnet *bif; + + /* Check with bridging code */ + if ((bif = bridge_in(ifp, eh)) == BDG_DROP) { + m_freem(m); + return; + } + if (bif != BDG_LOCAL) { + struct mbuf *oldm = m ; + + save_eh = *eh ; /* because it might change */ + m = bdg_forward(m, eh, bif); /* needs forwarding */ + /* + * Do not continue if bdg_forward() processed our + * packet (and cleared the mbuf pointer m) or if + * it dropped (m_free'd) the packet itself. + */ + if (m == NULL) { + if (bif == BDG_BCAST || bif == BDG_MCAST) + printf("bdg_forward drop MULTICAST PKT\n"); + return; + } + if (m != oldm) /* m changed! */ + eh = &save_eh ; + } + if (bif == BDG_LOCAL + || bif == BDG_BCAST + || bif == BDG_MCAST) + goto recvLocal; /* receive locally */ + + /* If not local and not multicast, just drop it */ + if (m != NULL) + m_freem(m); + return; + } +#endif + +#ifdef BRIDGE +recvLocal: +#endif + /* Continue with upper layer processing */ + ether_demux(ifp, eh, m); +} + +/* + * Upper layer processing for a received Ethernet packet. + */ +void +ether_demux(ifp, eh, m) + struct ifnet *ifp; + struct ether_header *eh; + struct mbuf *m; +{ + struct ifqueue *inq; + u_short ether_type; + int s; +#if defined(NETATALK) + register struct llc *l; +#endif + +#ifdef BRIDGE + if (! (do_bridge && BDG_USED(ifp) ) ) +#endif + /* Discard packet if upper layers shouldn't see it because it was + unicast to a different Ethernet address. If the driver is working + properly, then this situation can only happen when the interface + is in promiscuous mode. */ + if ((ifp->if_flags & IFF_PROMISC) != 0 + && (eh->ether_dhost[0] & 1) == 0 + && bcmp(eh->ether_dhost, + IFP2AC(ifp)->ac_enaddr, ETHER_ADDR_LEN) != 0) { + m_freem(m); + return; + } + + /* Discard packet if interface is not up */ + if ((ifp->if_flags & IFF_UP) == 0) { + m_freem(m); + return; + } + if (eh->ether_dhost[0] & 1) { + /* + * If this is not a simplex interface, drop the packet + * if it came from us. + */ + if ((ifp->if_flags & IFF_SIMPLEX) == 0) { + struct ifaddr *ifa; + struct sockaddr_dl *sdl = NULL; + + /* find link-layer address */ + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && + sdl->sdl_family == AF_LINK) + break; + + if (sdl && bcmp(LLADDR(sdl), eh->ether_shost, + ETHER_ADDR_LEN) == 0) { + m_freem(m); + return; + } + } + if (bcmp((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost, + sizeof(etherbroadcastaddr)) == 0) + m->m_flags |= M_BCAST; + else + m->m_flags |= M_MCAST; + } + if (m->m_flags & (M_BCAST|M_MCAST)) + ifp->if_imcasts++; + + ifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh); + + ether_type = ntohs(eh->ether_type); + +#if NVLAN > 0 + if (ether_type == vlan_proto) { + if (vlan_input(eh, m) < 0) + ifp->if_data.ifi_noproto++; + return; + } +#endif /* NVLAN > 0 */ + + switch (ether_type) { +#ifdef INET + case ETHERTYPE_IP: + if (ipflow_fastforward(m)) + return; + schednetisr(NETISR_IP); + inq = &ipintrq; + break; + + case ETHERTYPE_ARP: + if (ifp->if_flags & IFF_NOARP) { + /* Discard packet if ARP is disabled on interface */ + m_freem(m); + return; + } + schednetisr(NETISR_ARP); + inq = &arpintrq; + break; +#endif +#ifdef IPX + case ETHERTYPE_IPX: + if (ef_inputp && ef_inputp(ifp, eh, m) == 0) + return; + schednetisr(NETISR_IPX); + inq = &ipxintrq; + break; +#endif +#ifdef INET6 + case ETHERTYPE_IPV6: + schednetisr(NETISR_IPV6); + inq = &ip6intrq; + break; +#endif +#ifdef NS + case 0x8137: /* Novell Ethernet_II Ethernet TYPE II */ + schednetisr(NETISR_NS); + inq = &nsintrq; + break; + +#endif /* NS */ +#ifdef NETATALK + case ETHERTYPE_AT: + schednetisr(NETISR_ATALK); + inq = &atintrq1; + break; + case ETHERTYPE_AARP: + /* probably this should be done with a NETISR as well */ + aarpinput(IFP2AC(ifp), m); /* XXX */ + return; +#endif NETATALK + default: +#ifdef IPX + if (ef_inputp && ef_inputp(ifp, eh, m) == 0) + return; +#endif /* IPX */ +#ifdef NS + checksum = mtod(m, ushort *); + /* Novell 802.3 */ + if ((ether_type <= ETHERMTU) && + ((*checksum == 0xffff) || (*checksum == 0xE0E0))){ + if(*checksum == 0xE0E0) { + m->m_pkthdr.len -= 3; + m->m_len -= 3; + m->m_data += 3; + } + schednetisr(NETISR_NS); + inq = &nsintrq; + break; + } +#endif /* NS */ +#if defined(NETATALK) + if (ether_type > ETHERMTU) + goto dropanyway; + l = mtod(m, struct llc *); + switch (l->llc_dsap) { + case LLC_SNAP_LSAP: + switch (l->llc_control) { + case LLC_UI: + if (l->llc_ssap != LLC_SNAP_LSAP) + goto dropanyway; + + if (Bcmp(&(l->llc_snap_org_code)[0], at_org_code, + sizeof(at_org_code)) == 0 && + ntohs(l->llc_snap_ether_type) == ETHERTYPE_AT) { + inq = &atintrq2; + m_adj( m, sizeof( struct llc )); + schednetisr(NETISR_ATALK); + break; + } + + if (Bcmp(&(l->llc_snap_org_code)[0], aarp_org_code, + sizeof(aarp_org_code)) == 0 && + ntohs(l->llc_snap_ether_type) == ETHERTYPE_AARP) { + m_adj( m, sizeof( struct llc )); + aarpinput(IFP2AC(ifp), m); /* XXX */ + return; + } + + default: + goto dropanyway; + } + break; + dropanyway: + default: + if (ng_ether_input_orphan_p != NULL) + (*ng_ether_input_orphan_p)(ifp, m, eh); + else + m_freem(m); + return; + } +#else /* NETATALK */ + if (ng_ether_input_orphan_p != NULL) + (*ng_ether_input_orphan_p)(ifp, m, eh); + else + m_freem(m); + return; +#endif /* NETATALK */ + } + + s = splimp(); + if (IF_QFULL(inq)) { + IF_DROP(inq); + m_freem(m); + } else + IF_ENQUEUE(inq, m); + splx(s); +} + +/* + * Perform common duties while attaching to interface list + */ +void +ether_ifattach(ifp, bpf) + register struct ifnet *ifp; + int bpf; +{ + register struct ifaddr *ifa; + register struct sockaddr_dl *sdl; + + if_attach(ifp); + ifp->if_type = IFT_ETHER; + ifp->if_addrlen = 6; + ifp->if_hdrlen = 14; + ifp->if_mtu = ETHERMTU; + ifp->if_resolvemulti = ether_resolvemulti; + if (ifp->if_baudrate == 0) + ifp->if_baudrate = 10000000; + ifa = ifnet_addrs[ifp->if_index - 1]; + sdl = (struct sockaddr_dl *)ifa->ifa_addr; + sdl->sdl_type = IFT_ETHER; + sdl->sdl_alen = ifp->if_addrlen; + bcopy((IFP2AC(ifp))->ac_enaddr, LLADDR(sdl), ifp->if_addrlen); +#ifdef BPF + if (bpf) + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); +#endif + if (ng_ether_attach_p != NULL) + (*ng_ether_attach_p)(ifp); +} + +/* + * Perform common duties while detaching an Ethernet interface + */ +void +ether_ifdetach(ifp, bpf) + struct ifnet *ifp; + int bpf; +{ + if (ng_ether_detach_p != NULL) + (*ng_ether_detach_p)(ifp); +#ifdef BPF + if (bpf) + bpfdetach(ifp); +#endif + if_detach(ifp); +} + +int +ether_ioctl(ifp, command, data) + struct ifnet *ifp; + int command; + caddr_t data; +{ + struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; + int error = 0; + + switch (command) { + case SIOCSIFADDR: + ifp->if_flags |= IFF_UP; + + switch (ifa->ifa_addr->sa_family) { +#ifdef INET + case AF_INET: + ifp->if_init(ifp->if_softc); /* before arpwhohas */ + arp_ifinit(IFP2AC(ifp), ifa); + break; +#endif +#ifdef IPX + /* + * XXX - This code is probably wrong + */ + case AF_IPX: + { + register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr); + struct arpcom *ac = IFP2AC(ifp); + + if (ipx_nullhost(*ina)) + ina->x_host = + *(union ipx_host *) + ac->ac_enaddr; + else { + bcopy((caddr_t) ina->x_host.c_host, + (caddr_t) ac->ac_enaddr, + sizeof(ac->ac_enaddr)); + } + + /* + * Set new address + */ + ifp->if_init(ifp->if_softc); + break; + } +#endif +#ifdef NS + /* + * XXX - This code is probably wrong + */ + case AF_NS: + { + register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr); + struct arpcom *ac = IFP2AC(ifp); + + if (ns_nullhost(*ina)) + ina->x_host = + *(union ns_host *) (ac->ac_enaddr); + else { + bcopy((caddr_t) ina->x_host.c_host, + (caddr_t) ac->ac_enaddr, + sizeof(ac->ac_enaddr)); + } + + /* + * Set new address + */ + ifp->if_init(ifp->if_softc); + break; + } +#endif + default: + ifp->if_init(ifp->if_softc); + break; + } + break; + + case SIOCGIFADDR: + { + struct sockaddr *sa; + + sa = (struct sockaddr *) & ifr->ifr_data; + bcopy(IFP2AC(ifp)->ac_enaddr, + (caddr_t) sa->sa_data, ETHER_ADDR_LEN); + } + break; + + case SIOCSIFMTU: + /* + * Set the interface MTU. + */ + if (ifr->ifr_mtu > ETHERMTU) { + error = EINVAL; + } else { + ifp->if_mtu = ifr->ifr_mtu; + } + break; + } + return (error); +} + +int +ether_resolvemulti(ifp, llsa, sa) + struct ifnet *ifp; + struct sockaddr **llsa; + struct sockaddr *sa; +{ + struct sockaddr_dl *sdl; + struct sockaddr_in *sin; +#ifdef INET6 + struct sockaddr_in6 *sin6; +#endif + u_char *e_addr; + + switch(sa->sa_family) { + case AF_LINK: + /* + * No mapping needed. Just check that it's a valid MC address. + */ + sdl = (struct sockaddr_dl *)sa; + e_addr = LLADDR(sdl); + if ((e_addr[0] & 1) != 1) + return EADDRNOTAVAIL; + *llsa = 0; + return 0; + +#ifdef INET + case AF_INET: + sin = (struct sockaddr_in *)sa; + if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) + return EADDRNOTAVAIL; + MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, + M_WAITOK|M_ZERO); + sdl->sdl_len = sizeof *sdl; + sdl->sdl_family = AF_LINK; + sdl->sdl_index = ifp->if_index; + sdl->sdl_type = IFT_ETHER; + sdl->sdl_alen = ETHER_ADDR_LEN; + e_addr = LLADDR(sdl); + ETHER_MAP_IP_MULTICAST(&sin->sin_addr, e_addr); + *llsa = (struct sockaddr *)sdl; + return 0; +#endif +#ifdef INET6 + case AF_INET6: + sin6 = (struct sockaddr_in6 *)sa; + if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { + /* + * An IP6 address of 0 means listen to all + * of the Ethernet multicast address used for IP6. + * (This is used for multicast routers.) + */ + ifp->if_flags |= IFF_ALLMULTI; + *llsa = 0; + return 0; + } + if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) + return EADDRNOTAVAIL; + MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, + M_WAITOK|M_ZERO); + sdl->sdl_len = sizeof *sdl; + sdl->sdl_family = AF_LINK; + sdl->sdl_index = ifp->if_index; + sdl->sdl_type = IFT_ETHER; + sdl->sdl_alen = ETHER_ADDR_LEN; + e_addr = LLADDR(sdl); + ETHER_MAP_IPV6_MULTICAST(&sin6->sin6_addr, e_addr); + *llsa = (struct sockaddr *)sdl; + return 0; +#endif + + default: + /* + * Well, the text isn't quite right, but it's the name + * that counts... + */ + return EAFNOSUPPORT; + } +} diff --git a/packages/net/bsd_tcpip/current/src/sys/net/if_loop.c b/packages/net/bsd_tcpip/current/src/sys/net/if_loop.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/net/if_loop.c @@ -0,0 +1,493 @@ +//========================================================================== +// +// src/sys/net/if_loop.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)if_loop.c 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_loop.c,v 1.47.2.5 2001/07/03 11:01:41 ume Exp $ + */ + +/* + * Loopback interface driver for protocol testing and timing. + */ +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifdef INET +#include +#include +#endif + +#ifdef IPX +#include +#include +#endif + +#ifdef INET6 +#ifndef INET +#include +#endif +#include +#include +#endif + +#ifdef NS +#include +#include +#endif + +#ifdef NETATALK +#include +#include +#endif NETATALK + +int loioctl __P((struct ifnet *, u_long, caddr_t)); +static void lortrequest __P((int, struct rtentry *, struct sockaddr *)); + +static void loopattach __P((void *)); +#ifdef ALTQ +static void lo_altqstart __P((struct ifnet *)); +#endif +PSEUDO_SET(loopattach, if_loop); + +int looutput __P((struct ifnet *ifp, + struct mbuf *m, struct sockaddr *dst, struct rtentry *rt)); + +#ifdef TINY_LOMTU +#define LOMTU (1024+512) +#elif defined(LARGE_LOMTU) +#define LOMTU 131072 +#else +#define LOMTU 16384 +#endif + +struct ifnet loif[NLOOP]; + +/* ARGSUSED */ +static void +loopattach(dummy) + void *dummy; +{ + register struct ifnet *ifp; + register int i = 0; + + for (ifp = loif; i < NLOOP; ifp++) { + ifp->if_name = "lo"; + ifp->if_unit = i++; + ifp->if_mtu = LOMTU; + ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST; + ifp->if_ioctl = loioctl; + ifp->if_output = looutput; + ifp->if_type = IFT_LOOP; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + IFQ_SET_READY(&ifp->if_snd); + if_attach(ifp); +#ifdef BPF + bpfattach(ifp, DLT_NULL, sizeof(u_int)); +#endif + } +} + +int +looutput(ifp, m, dst, rt) + struct ifnet *ifp; + register struct mbuf *m; + struct sockaddr *dst; + register struct rtentry *rt; +{ + if ((m->m_flags & M_PKTHDR) == 0) + panic("looutput no HDR"); + + if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) { + m_freem(m); + return (rt->rt_flags & RTF_BLACKHOLE ? 0 : + rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH); + } + /* + * KAME requires that the packet to be contiguous on the + * mbuf. We need to make that sure. + * this kind of code should be avoided. + * XXX: fails to join if interface MTU > MCLBYTES. jumbogram? + */ + if (m && m->m_next != NULL && m->m_pkthdr.len < MCLBYTES) { + struct mbuf *n; + + MGETHDR(n, M_DONTWAIT, MT_HEADER); + if (!n) + goto contiguousfail; + MCLGET(n, M_DONTWAIT); + if (! (n->m_flags & M_EXT)) { + m_freem(n); + goto contiguousfail; + } + + m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t)); + n->m_pkthdr = m->m_pkthdr; + n->m_len = m->m_pkthdr.len; + n->m_pkthdr.aux = m->m_pkthdr.aux; + m->m_pkthdr.aux = (struct mbuf *)NULL; + m_freem(m); + m = n; + } + if (0) { +contiguousfail: + printf("looutput: mbuf allocation failed\n"); + } + + ifp->if_opackets++; + ifp->if_obytes += m->m_pkthdr.len; +#if 1 /* XXX */ + switch (dst->sa_family) { + case AF_INET: + case AF_INET6: + case AF_IPX: + case AF_NS: + case AF_APPLETALK: + break; + default: + printf("looutput: af=%d unexpected\n", dst->sa_family); + m_freem(m); + return (EAFNOSUPPORT); + } +#endif + return(if_simloop(ifp, m, dst->sa_family, 0)); +} + +/* + * if_simloop() + * + * This function is to support software emulation of hardware loopback, + * i.e., for interfaces with the IFF_SIMPLEX attribute. Since they can't + * hear their own broadcasts, we create a copy of the packet that we + * would normally receive via a hardware loopback. + * + * This function expects the packet to include the media header of length hlen. + */ + +int +if_simloop(ifp, m, af, hlen) + struct ifnet *ifp; + struct mbuf *m; + int af; + int hlen; +{ + int s, isr; + register struct ifqueue *ifq = 0; + + m->m_pkthdr.rcvif = ifp; + + /* BPF write needs to be handled specially */ + if (af == AF_UNSPEC) { + af = *(mtod(m, int *)); + m->m_len -= sizeof(int); + m->m_pkthdr.len -= sizeof(int); + m->m_data += sizeof(int); + } + +#ifdef BPF + /* Let BPF see incoming packet */ + if (ifp->if_bpf) { + struct mbuf m0, *n = m; + + if (ifp->if_bpf->bif_dlt == DLT_NULL) { + /* + * We need to prepend the address family as + * a four byte field. Cons up a dummy header + * to pacify bpf. This is safe because bpf + * will only read from the mbuf (i.e., it won't + * try to free it or keep a pointer a to it). + */ + m0.m_next = m; + m0.m_len = 4; + m0.m_data = (char *)⁡ + n = &m0; + } + bpf_mtap(ifp, n); + } +#endif + + /* Strip away media header */ + if (hlen > 0) { + m_adj(m, hlen); +#ifdef __alpha__ + /* The alpha doesn't like unaligned data. + * We move data down in the first mbuf */ + if (mtod(m, vm_offset_t) & 3) { +// KASSERT(hlen >= 3, ("if_simloop: hlen too small")); + bcopy(m->m_data, + (char *)(mtod(m, vm_offset_t) + - (mtod(m, vm_offset_t) & 3)), + m->m_len); + mtod(m,vm_offset_t) -= (mtod(m, vm_offset_t) & 3); + } +#endif + } + + /* Deliver to upper layer protocol */ + switch (af) { +#ifdef INET + case AF_INET: + ifq = &ipintrq; + isr = NETISR_IP; + break; +#endif +#ifdef INET6 + case AF_INET6: + m->m_flags |= M_LOOP; + ifq = &ip6intrq; + isr = NETISR_IPV6; + break; +#endif +#ifdef IPX + case AF_IPX: + ifq = &ipxintrq; + isr = NETISR_IPX; + break; +#endif +#ifdef NS + case AF_NS: + ifq = &nsintrq; + isr = NETISR_NS; + break; +#endif +#ifdef NETATALK + case AF_APPLETALK: + ifq = &atintrq2; + isr = NETISR_ATALK; + break; +#endif NETATALK + default: + printf("if_simloop: can't handle af=%d\n", af); + m_freem(m); + return (EAFNOSUPPORT); + } + s = splimp(); + if (IF_QFULL(ifq)) { + IF_DROP(ifq); + m_freem(m); + splx(s); + return (ENOBUFS); + } + IF_ENQUEUE(ifq, m); + schednetisr(isr); + ifp->if_ipackets++; + ifp->if_ibytes += m->m_pkthdr.len; + splx(s); + return (0); +} + +#ifdef ALTQ +static void +lo_altqstart(ifp) + struct ifnet *ifp; +{ + struct ifqueue *ifq; + struct mbuf *m; + int32_t af, *afp; + int s, isr; + + while (1) { + s = splimp(); + IFQ_DEQUEUE(&ifp->if_snd, m); + splx(s); + if (m == NULL) + return; + + afp = mtod(m, int32_t *); + af = *afp; + m_adj(m, sizeof(int32_t)); + + switch (af) { +#ifdef INET + case AF_INET: + ifq = &ipintrq; + isr = NETISR_IP; + break; +#endif +#ifdef INET6 + case AF_INET6: + m->m_flags |= M_LOOP; + ifq = &ip6intrq; + isr = NETISR_IPV6; + break; +#endif +#ifdef IPX + case AF_IPX: + ifq = &ipxintrq; + isr = NETISR_IPX; + break; +#endif +#ifdef NS + case AF_NS: + ifq = &nsintrq; + isr = NETISR_NS; + break; +#endif +#ifdef ISO + case AF_ISO: + ifq = &clnlintrq; + isr = NETISR_ISO; + break; +#endif +#ifdef NETATALK + case AF_APPLETALK: + ifq = &atintrq2; + isr = NETISR_ATALK; + break; +#endif NETATALK + default: + printf("lo_altqstart: can't handle af%d\n", af); + m_freem(m); + return; + } + + s = splimp(); + if (IF_QFULL(ifq)) { + IF_DROP(ifq); + m_freem(m); + splx(s); + return; + } + IF_ENQUEUE(ifq, m); + schednetisr(isr); + ifp->if_ipackets++; + ifp->if_ibytes += m->m_pkthdr.len; + splx(s); + } +} +#endif /* ALTQ */ + +/* ARGSUSED */ +static void +lortrequest(cmd, rt, sa) + int cmd; + struct rtentry *rt; + struct sockaddr *sa; +{ + if (rt) { + rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; /* for ISO */ + /* + * For optimal performance, the send and receive buffers + * should be at least twice the MTU plus a little more for + * overhead. + */ + rt->rt_rmx.rmx_recvpipe = + rt->rt_rmx.rmx_sendpipe = 3 * LOMTU; + } +} + +/* + * Process an ioctl request. + */ +/* ARGSUSED */ +int +loioctl(ifp, cmd, data) + register struct ifnet *ifp; + u_long cmd; + caddr_t data; +{ + register struct ifaddr *ifa; + register struct ifreq *ifr = (struct ifreq *)data; + register int error = 0; + + switch (cmd) { + + case SIOCSIFADDR: + ifp->if_flags |= IFF_UP | IFF_RUNNING | IFF_LOOPBACK; + ifa = (struct ifaddr *)data; + ifa->ifa_rtrequest = lortrequest; + /* + * Everything else is done at a higher level. + */ + break; + + case SIOCADDMULTI: + case SIOCDELMULTI: + if (ifr == 0) { + error = EAFNOSUPPORT; /* XXX */ + break; + } + switch (ifr->ifr_addr.sa_family) { + +#ifdef INET + case AF_INET: + break; +#endif +#ifdef INET6 + case AF_INET6: + break; +#endif + + default: + error = EAFNOSUPPORT; + break; + } + break; + + case SIOCSIFMTU: + ifp->if_mtu = ifr->ifr_mtu; + break; + + case SIOCSIFFLAGS: + break; + + default: + error = EINVAL; + } + return (error); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/net/radix.c b/packages/net/bsd_tcpip/current/src/sys/net/radix.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/net/radix.c @@ -0,0 +1,1095 @@ +//========================================================================== +// +// src/sys/net/radix.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1988, 1989, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)radix.c 8.4 (Berkeley) 11/2/94 + * $FreeBSD: src/sys/net/radix.c,v 1.20.2.2 2001/03/06 00:56:50 obrien Exp $ + */ + +/* + * Routines to build and maintain radix trees for routing lookups. + */ +#ifndef _RADIX_H_ +#include +#ifdef _KERNEL +#include +#define M_DONTWAIT M_NOWAIT +#include +#else +#include +#endif +#include +#endif + +static int rn_walktree_from __P((struct radix_node_head *h, void *a, + void *m, walktree_f_t *f, void *w)); +static int rn_walktree __P((struct radix_node_head *, walktree_f_t *, void *)); +static struct radix_node + *rn_insert __P((void *, struct radix_node_head *, int *, + struct radix_node [2])), + *rn_newpair __P((void *, int, struct radix_node[2])), + *rn_search __P((void *, struct radix_node *)), + *rn_search_m __P((void *, struct radix_node *, void *)); + +static int max_keylen; +static struct radix_mask *rn_mkfreelist; +static struct radix_node_head *mask_rnhead; +static char *addmask_key; +static char normal_chars[] = {0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, -1}; +static char *rn_zeros, *rn_ones; + +#define rn_masktop (mask_rnhead->rnh_treetop) +#undef Bcmp +#define Bcmp(a, b, l) \ + (l == 0 ? 0 : bcmp((caddr_t)(a), (caddr_t)(b), (u_long)l)) + +static int rn_lexobetter __P((void *m_arg, void *n_arg)); +static struct radix_mask * + rn_new_radix_mask __P((struct radix_node *tt, + struct radix_mask *next)); +static int rn_satsifies_leaf __P((char *trial, struct radix_node *leaf, + int skip)); + +/* + * The data structure for the keys is a radix tree with one way + * branching removed. The index rn_bit at an internal node n represents a bit + * position to be tested. The tree is arranged so that all descendants + * of a node n have keys whose bits all agree up to position rn_bit - 1. + * (We say the index of n is rn_bit.) + * + * There is at least one descendant which has a one bit at position rn_bit, + * and at least one with a zero there. + * + * A route is determined by a pair of key and mask. We require that the + * bit-wise logical and of the key and mask to be the key. + * We define the index of a route to associated with the mask to be + * the first bit number in the mask where 0 occurs (with bit number 0 + * representing the highest order bit). + * + * We say a mask is normal if every bit is 0, past the index of the mask. + * If a node n has a descendant (k, m) with index(m) == index(n) == rn_bit, + * and m is a normal mask, then the route applies to every descendant of n. + * If the index(m) < rn_bit, this implies the trailing last few bits of k + * before bit b are all 0, (and hence consequently true of every descendant + * of n), so the route applies to all descendants of the node as well. + * + * Similar logic shows that a non-normal mask m such that + * index(m) <= index(n) could potentially apply to many children of n. + * Thus, for each non-host route, we attach its mask to a list at an internal + * node as high in the tree as we can go. + * + * The present version of the code makes use of normal routes in short- + * circuiting an explict mask and compare operation when testing whether + * a key satisfies a normal route, and also in remembering the unique leaf + * that governs a subtree. + */ + +static struct radix_node * +rn_search(v_arg, head) + void *v_arg; + struct radix_node *head; +{ + register struct radix_node *x; + register caddr_t v; + + for (x = head, v = v_arg; x->rn_bit >= 0;) { + if (x->rn_bmask & v[x->rn_offset]) + x = x->rn_right; + else + x = x->rn_left; + } + return (x); +} + +static struct radix_node * +rn_search_m(v_arg, head, m_arg) + struct radix_node *head; + void *v_arg, *m_arg; +{ + register struct radix_node *x; + register caddr_t v = v_arg, m = m_arg; + + for (x = head; x->rn_bit >= 0;) { + if ((x->rn_bmask & m[x->rn_offset]) && + (x->rn_bmask & v[x->rn_offset])) + x = x->rn_right; + else + x = x->rn_left; + } + return x; +} + +int +rn_refines(m_arg, n_arg) + void *m_arg, *n_arg; +{ + register caddr_t m = m_arg, n = n_arg; + register caddr_t lim, lim2 = lim = n + *(u_char *)n; + int longer = (*(u_char *)n++) - (int)(*(u_char *)m++); + int masks_are_equal = 1; + + if (longer > 0) + lim -= longer; + while (n < lim) { + if (*n & ~(*m)) + return 0; + if (*n++ != *m++) + masks_are_equal = 0; + } + while (n < lim2) + if (*n++) + return 0; + if (masks_are_equal && (longer < 0)) + for (lim2 = m - longer; m < lim2; ) + if (*m++) + return 1; + return (!masks_are_equal); +} + +struct radix_node * +rn_lookup(v_arg, m_arg, head) + void *v_arg, *m_arg; + struct radix_node_head *head; +{ + register struct radix_node *x; + caddr_t netmask = 0; + + if (m_arg) { + x = rn_addmask(m_arg, 1, head->rnh_treetop->rn_offset); + if (x == 0) + return (0); + netmask = x->rn_key; + } + x = rn_match(v_arg, head); + if (x && netmask) { + while (x && x->rn_mask != netmask) + x = x->rn_dupedkey; + } + return x; +} + +static int +rn_satsifies_leaf(trial, leaf, skip) + char *trial; + register struct radix_node *leaf; + int skip; +{ + register char *cp = trial, *cp2 = leaf->rn_key, *cp3 = leaf->rn_mask; + char *cplim; + int length = min(*(u_char *)cp, *(u_char *)cp2); + + if (cp3 == 0) + cp3 = rn_ones; + else + length = min(length, *(u_char *)cp3); + cplim = cp + length; cp3 += skip; cp2 += skip; + for (cp += skip; cp < cplim; cp++, cp2++, cp3++) + if ((*cp ^ *cp2) & *cp3) + return 0; + return 1; +} + +struct radix_node * +rn_match(v_arg, head) + void *v_arg; + struct radix_node_head *head; +{ + caddr_t v = v_arg; + register struct radix_node *t = head->rnh_treetop, *x; + register caddr_t cp = v, cp2; + caddr_t cplim; + struct radix_node *saved_t, *top = t; + int off = t->rn_offset, vlen = *(u_char *)cp, matched_off; + register int test, b, rn_bit; + + /* + * Open code rn_search(v, top) to avoid overhead of extra + * subroutine call. + */ + for (; t->rn_bit >= 0; ) { + if (t->rn_bmask & cp[t->rn_offset]) + t = t->rn_right; + else + t = t->rn_left; + } + /* + * See if we match exactly as a host destination + * or at least learn how many bits match, for normal mask finesse. + * + * It doesn't hurt us to limit how many bytes to check + * to the length of the mask, since if it matches we had a genuine + * match and the leaf we have is the most specific one anyway; + * if it didn't match with a shorter length it would fail + * with a long one. This wins big for class B&C netmasks which + * are probably the most common case... + */ + if (t->rn_mask) + vlen = *(u_char *)t->rn_mask; + cp += off; cp2 = t->rn_key + off; cplim = v + vlen; + for (; cp < cplim; cp++, cp2++) + if (*cp != *cp2) + goto on1; + /* + * This extra grot is in case we are explicitly asked + * to look up the default. Ugh! + * + * Never return the root node itself, it seems to cause a + * lot of confusion. + */ + if (t->rn_flags & RNF_ROOT) + t = t->rn_dupedkey; + return t; +on1: + test = (*cp ^ *cp2) & 0xff; /* find first bit that differs */ + for (b = 7; (test >>= 1) > 0;) + b--; + matched_off = cp - v; + b += matched_off << 3; + rn_bit = -1 - b; + /* + * If there is a host route in a duped-key chain, it will be first. + */ + if ((saved_t = t)->rn_mask == 0) + t = t->rn_dupedkey; + for (; t; t = t->rn_dupedkey) + /* + * Even if we don't match exactly as a host, + * we may match if the leaf we wound up at is + * a route to a net. + */ + if (t->rn_flags & RNF_NORMAL) { + if (rn_bit <= t->rn_bit) + return t; + } else if (rn_satsifies_leaf(v, t, matched_off)) + return t; + t = saved_t; + /* start searching up the tree */ + do { + register struct radix_mask *m; + t = t->rn_parent; + m = t->rn_mklist; + /* + * If non-contiguous masks ever become important + * we can restore the masking and open coding of + * the search and satisfaction test and put the + * calculation of "off" back before the "do". + */ + while (m) { + if (m->rm_flags & RNF_NORMAL) { + if (rn_bit <= m->rm_bit) + return (m->rm_leaf); + } else { + off = min(t->rn_offset, matched_off); + x = rn_search_m(v, t, m->rm_mask); + while (x && x->rn_mask != m->rm_mask) + x = x->rn_dupedkey; + if (x && rn_satsifies_leaf(v, x, off)) + return x; + } + m = m->rm_mklist; + } + } while (t != top); + return 0; +} + +#ifdef RN_DEBUG +int rn_nodenum; +struct radix_node *rn_clist; +int rn_saveinfo; +int rn_debug = 1; +#endif + +static struct radix_node * +rn_newpair(v, b, nodes) + void *v; + int b; + struct radix_node nodes[2]; +{ + register struct radix_node *tt = nodes, *t = tt + 1; + t->rn_bit = b; + t->rn_bmask = 0x80 >> (b & 7); + t->rn_left = tt; + t->rn_offset = b >> 3; + tt->rn_bit = -1; + tt->rn_key = (caddr_t)v; + tt->rn_parent = t; + tt->rn_flags = t->rn_flags = RNF_ACTIVE; + tt->rn_mklist = t->rn_mklist = 0; +#ifdef RN_DEBUG + tt->rn_info = rn_nodenum++; t->rn_info = rn_nodenum++; + tt->rn_twin = t; + tt->rn_ybro = rn_clist; + rn_clist = tt; +#endif + return t; +} + +static struct radix_node * +rn_insert(v_arg, head, dupentry, nodes) + void *v_arg; + struct radix_node_head *head; + int *dupentry; + struct radix_node nodes[2]; +{ + caddr_t v = v_arg; + struct radix_node *top = head->rnh_treetop; + int head_off = top->rn_offset, vlen = (int)*((u_char *)v); + register struct radix_node *t = rn_search(v_arg, top); + register caddr_t cp = v + head_off; + register int b; + struct radix_node *tt; + /* + * Find first bit at which v and t->rn_key differ + */ + { + register caddr_t cp2 = t->rn_key + head_off; + register int cmp_res; + caddr_t cplim = v + vlen; + + while (cp < cplim) + if (*cp2++ != *cp++) + goto on1; + *dupentry = 1; + return t; +on1: + *dupentry = 0; + cmp_res = (cp[-1] ^ cp2[-1]) & 0xff; + for (b = (cp - v) << 3; cmp_res; b--) + cmp_res >>= 1; + } + { + register struct radix_node *p, *x = top; + cp = v; + do { + p = x; + if (cp[x->rn_offset] & x->rn_bmask) + x = x->rn_right; + else + x = x->rn_left; + } while (b > (unsigned) x->rn_bit); + /* x->rn_bit < b && x->rn_bit >= 0 */ +#ifdef RN_DEBUG + if (rn_debug) + log(LOG_DEBUG, "rn_insert: Going In:\n"), traverse(p); +#endif + t = rn_newpair(v_arg, b, nodes); + tt = t->rn_left; + if ((cp[p->rn_offset] & p->rn_bmask) == 0) + p->rn_left = t; + else + p->rn_right = t; + x->rn_parent = t; + t->rn_parent = p; /* frees x, p as temp vars below */ + if ((cp[t->rn_offset] & t->rn_bmask) == 0) { + t->rn_right = x; + } else { + t->rn_right = tt; + t->rn_left = x; + } +#ifdef RN_DEBUG + if (rn_debug) + log(LOG_DEBUG, "rn_insert: Coming Out:\n"), traverse(p); +#endif + } + return (tt); +} + +struct radix_node * +rn_addmask(n_arg, search, skip) + int search, skip; + void *n_arg; +{ + caddr_t netmask = (caddr_t)n_arg; + register struct radix_node *x; + register caddr_t cp, cplim; + register int b = 0, mlen, j; + int maskduplicated, m0, isnormal; + struct radix_node *saved_x; + static int last_zeroed = 0; + + if ((mlen = *(u_char *)netmask) > max_keylen) + mlen = max_keylen; + if (skip == 0) + skip = 1; + if (mlen <= skip) + return (mask_rnhead->rnh_nodes); + if (skip > 1) + Bcopy(rn_ones + 1, addmask_key + 1, skip - 1); + if ((m0 = mlen) > skip) + Bcopy(netmask + skip, addmask_key + skip, mlen - skip); + /* + * Trim trailing zeroes. + */ + for (cp = addmask_key + mlen; (cp > addmask_key) && cp[-1] == 0;) + cp--; + mlen = cp - addmask_key; + if (mlen <= skip) { + if (m0 >= last_zeroed) + last_zeroed = mlen; + return (mask_rnhead->rnh_nodes); + } + if (m0 < last_zeroed) + Bzero(addmask_key + m0, last_zeroed - m0); + *addmask_key = last_zeroed = mlen; + x = rn_search(addmask_key, rn_masktop); + if (Bcmp(addmask_key, x->rn_key, mlen) != 0) + x = 0; + if (x || search) + return (x); + R_Malloc(x, struct radix_node *, max_keylen + 2 * sizeof (*x)); + if ((saved_x = x) == 0) + return (0); + Bzero(x, max_keylen + 2 * sizeof (*x)); + netmask = cp = (caddr_t)(x + 2); + Bcopy(addmask_key, cp, mlen); + x = rn_insert(cp, mask_rnhead, &maskduplicated, x); + if (maskduplicated) { + log(LOG_ERR, "rn_addmask: mask impossibly already in tree"); + Free(saved_x); + return (x); + } + /* + * Calculate index of mask, and check for normalcy. + */ + cplim = netmask + mlen; isnormal = 1; + for (cp = netmask + skip; (cp < cplim) && *(u_char *)cp == 0xff;) + cp++; + if (cp != cplim) { + for (j = 0x80; (j & *cp) != 0; j >>= 1) + b++; + if (*cp != normal_chars[b] || cp != (cplim - 1)) + isnormal = 0; + } + b += (cp - netmask) << 3; + x->rn_bit = -1 - b; + if (isnormal) + x->rn_flags |= RNF_NORMAL; + return (x); +} + +static int /* XXX: arbitrary ordering for non-contiguous masks */ +rn_lexobetter(m_arg, n_arg) + void *m_arg, *n_arg; +{ + register u_char *mp = m_arg, *np = n_arg, *lim; + + if (*mp > *np) + return 1; /* not really, but need to check longer one first */ + if (*mp == *np) + for (lim = mp + *mp; mp < lim;) + if (*mp++ > *np++) + return 1; + return 0; +} + +static struct radix_mask * +rn_new_radix_mask(tt, next) + register struct radix_node *tt; + register struct radix_mask *next; +{ + register struct radix_mask *m; + + MKGet(m); + if (m == 0) { + log(LOG_ERR, "Mask for route not entered\n"); + return (0); + } + Bzero(m, sizeof *m); + m->rm_bit = tt->rn_bit; + m->rm_flags = tt->rn_flags; + if (tt->rn_flags & RNF_NORMAL) + m->rm_leaf = tt; + else + m->rm_mask = tt->rn_mask; + m->rm_mklist = next; + tt->rn_mklist = m; + return m; +} + +struct radix_node * +rn_addroute(v_arg, n_arg, head, treenodes) + void *v_arg, *n_arg; + struct radix_node_head *head; + struct radix_node treenodes[2]; +{ + caddr_t v = (caddr_t)v_arg, netmask = (caddr_t)n_arg; + register struct radix_node *t, *x = 0, *tt; + struct radix_node *saved_tt, *top = head->rnh_treetop; + short b = 0, b_leaf = 0; + int keyduplicated; + caddr_t mmask; + struct radix_mask *m, **mp; + + /* + * In dealing with non-contiguous masks, there may be + * many different routes which have the same mask. + * We will find it useful to have a unique pointer to + * the mask to speed avoiding duplicate references at + * nodes and possibly save time in calculating indices. + */ + if (netmask) { + if ((x = rn_addmask(netmask, 0, top->rn_offset)) == 0) + return (0); + b_leaf = x->rn_bit; + b = -1 - x->rn_bit; + netmask = x->rn_key; + } + /* + * Deal with duplicated keys: attach node to previous instance + */ + saved_tt = tt = rn_insert(v, head, &keyduplicated, treenodes); + if (keyduplicated) { + for (t = tt; tt; t = tt, tt = tt->rn_dupedkey) { + if (tt->rn_mask == netmask) + return (0); + if (netmask == 0 || + (tt->rn_mask && + ((b_leaf < tt->rn_bit) /* index(netmask) > node */ + || rn_refines(netmask, tt->rn_mask) + || rn_lexobetter(netmask, tt->rn_mask)))) + break; + } + /* + * If the mask is not duplicated, we wouldn't + * find it among possible duplicate key entries + * anyway, so the above test doesn't hurt. + * + * We sort the masks for a duplicated key the same way as + * in a masklist -- most specific to least specific. + * This may require the unfortunate nuisance of relocating + * the head of the list. + */ + if (tt == saved_tt) { + struct radix_node *xx = x; + /* link in at head of list */ + (tt = treenodes)->rn_dupedkey = t; + tt->rn_flags = t->rn_flags; + tt->rn_parent = x = t->rn_parent; + t->rn_parent = tt; /* parent */ + if (x->rn_left == t) + x->rn_left = tt; + else + x->rn_right = tt; + saved_tt = tt; x = xx; + } else { + (tt = treenodes)->rn_dupedkey = t->rn_dupedkey; + t->rn_dupedkey = tt; + tt->rn_parent = t; /* parent */ + if (tt->rn_dupedkey) /* parent */ + tt->rn_dupedkey->rn_parent = tt; /* parent */ + } +#ifdef RN_DEBUG + t=tt+1; tt->rn_info = rn_nodenum++; t->rn_info = rn_nodenum++; + tt->rn_twin = t; tt->rn_ybro = rn_clist; rn_clist = tt; +#endif + tt->rn_key = (caddr_t) v; + tt->rn_bit = -1; + tt->rn_flags = RNF_ACTIVE; + } + /* + * Put mask in tree. + */ + if (netmask) { + tt->rn_mask = netmask; + tt->rn_bit = x->rn_bit; + tt->rn_flags |= x->rn_flags & RNF_NORMAL; + } + t = saved_tt->rn_parent; + if (keyduplicated) + goto on2; + b_leaf = -1 - t->rn_bit; + if (t->rn_right == saved_tt) + x = t->rn_left; + else + x = t->rn_right; + /* Promote general routes from below */ + if (x->rn_bit < 0) { + for (mp = &t->rn_mklist; x; x = x->rn_dupedkey) + if (x->rn_mask && (x->rn_bit >= b_leaf) && x->rn_mklist == 0) { + *mp = m = rn_new_radix_mask(x, 0); + if (m) + mp = &m->rm_mklist; + } + } else if (x->rn_mklist) { + /* + * Skip over masks whose index is > that of new node + */ + for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) + if (m->rm_bit >= b_leaf) + break; + t->rn_mklist = m; *mp = 0; + } +on2: + /* Add new route to highest possible ancestor's list */ + if ((netmask == 0) || (b > t->rn_bit )) + return tt; /* can't lift at all */ + b_leaf = tt->rn_bit; + do { + x = t; + t = t->rn_parent; + } while (b <= t->rn_bit && x != top); + /* + * Search through routes associated with node to + * insert new route according to index. + * Need same criteria as when sorting dupedkeys to avoid + * double loop on deletion. + */ + for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) { + if (m->rm_bit < b_leaf) + continue; + if (m->rm_bit > b_leaf) + break; + if (m->rm_flags & RNF_NORMAL) { + mmask = m->rm_leaf->rn_mask; + if (tt->rn_flags & RNF_NORMAL) { + log(LOG_ERR, + "Non-unique normal route, mask not entered\n"); + return tt; + } + } else + mmask = m->rm_mask; + if (mmask == netmask) { + m->rm_refs++; + tt->rn_mklist = m; + return tt; + } + if (rn_refines(netmask, mmask) + || rn_lexobetter(netmask, mmask)) + break; + } + *mp = rn_new_radix_mask(tt, *mp); + return tt; +} + +struct radix_node * +rn_delete(v_arg, netmask_arg, head) + void *v_arg, *netmask_arg; + struct radix_node_head *head; +{ + register struct radix_node *t, *p, *x, *tt; + struct radix_mask *m, *saved_m, **mp; + struct radix_node *dupedkey, *saved_tt, *top; + caddr_t v, netmask; + int b, head_off, vlen; + + v = v_arg; + netmask = netmask_arg; + x = head->rnh_treetop; + tt = rn_search(v, x); + head_off = x->rn_offset; + vlen = *(u_char *)v; + saved_tt = tt; + top = x; + if (tt == 0 || + Bcmp(v + head_off, tt->rn_key + head_off, vlen - head_off)) + return (0); + /* + * Delete our route from mask lists. + */ + if (netmask) { + if ((x = rn_addmask(netmask, 1, head_off)) == 0) + return (0); + netmask = x->rn_key; + while (tt->rn_mask != netmask) + if ((tt = tt->rn_dupedkey) == 0) + return (0); + } + if (tt->rn_mask == 0 || (saved_m = m = tt->rn_mklist) == 0) + goto on1; + if (tt->rn_flags & RNF_NORMAL) { + if (m->rm_leaf != tt || m->rm_refs > 0) { + log(LOG_ERR, "rn_delete: inconsistent annotation\n"); + return 0; /* dangling ref could cause disaster */ + } + } else { + if (m->rm_mask != tt->rn_mask) { + log(LOG_ERR, "rn_delete: inconsistent annotation\n"); + goto on1; + } + if (--m->rm_refs >= 0) + goto on1; + } + b = -1 - tt->rn_bit; + t = saved_tt->rn_parent; + if (b > t->rn_bit) + goto on1; /* Wasn't lifted at all */ + do { + x = t; + t = t->rn_parent; + } while (b <= t->rn_bit && x != top); + for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) + if (m == saved_m) { + *mp = m->rm_mklist; + MKFree(m); + break; + } + if (m == 0) { + log(LOG_ERR, "rn_delete: couldn't find our annotation\n"); + if (tt->rn_flags & RNF_NORMAL) + return (0); /* Dangling ref to us */ + } +on1: + /* + * Eliminate us from tree + */ + if (tt->rn_flags & RNF_ROOT) + return (0); +#ifdef RN_DEBUG + /* Get us out of the creation list */ + for (t = rn_clist; t && t->rn_ybro != tt; t = t->rn_ybro) {} + if (t) t->rn_ybro = tt->rn_ybro; +#endif + t = tt->rn_parent; + dupedkey = saved_tt->rn_dupedkey; + if (dupedkey) { + /* + * at this point, tt is the deletion target and saved_tt + * is the head of the dupekey chain + */ + if (tt == saved_tt) { + /* remove from head of chain */ + x = dupedkey; x->rn_parent = t; + if (t->rn_left == tt) + t->rn_left = x; + else + t->rn_right = x; + } else { + /* find node in front of tt on the chain */ + for (x = p = saved_tt; p && p->rn_dupedkey != tt;) + p = p->rn_dupedkey; + if (p) { + p->rn_dupedkey = tt->rn_dupedkey; + if (tt->rn_dupedkey) /* parent */ + tt->rn_dupedkey->rn_parent = p; + /* parent */ + } else { + log(LOG_ERR, "rn_delete: couldn't find us\n"); + } + } + t = tt + 1; + if (t->rn_flags & RNF_ACTIVE) { +#ifndef RN_DEBUG + *++x = *t; + p = t->rn_parent; +#else + b = t->rn_info; + *++x = *t; + t->rn_info = b; + p = t->rn_parent; +#endif + if (p->rn_left == t) + p->rn_left = x; + else + p->rn_right = x; + x->rn_left->rn_parent = x; + x->rn_right->rn_parent = x; + } + goto out; + } + if (t->rn_left == tt) + x = t->rn_right; + else + x = t->rn_left; + p = t->rn_parent; + if (p->rn_right == t) + p->rn_right = x; + else + p->rn_left = x; + x->rn_parent = p; + /* + * Demote routes attached to us. + */ + if (t->rn_mklist) { + if (x->rn_bit >= 0) { + for (mp = &x->rn_mklist; (m = *mp);) + mp = &m->rm_mklist; + *mp = t->rn_mklist; + } else { + /* If there are any key,mask pairs in a sibling + duped-key chain, some subset will appear sorted + in the same order attached to our mklist */ + for (m = t->rn_mklist; m && x; x = x->rn_dupedkey) + if (m == x->rn_mklist) { + struct radix_mask *mm = m->rm_mklist; + x->rn_mklist = 0; + if (--(m->rm_refs) < 0) + MKFree(m); + m = mm; + } + if (m) + log(LOG_ERR, + "rn_delete: Orphaned Mask %p at %p\n", + (void *)m, (void *)x); + } + } + /* + * We may be holding an active internal node in the tree. + */ + x = tt + 1; + if (t != x) { +#ifndef RN_DEBUG + *t = *x; +#else + b = t->rn_info; + *t = *x; + t->rn_info = b; +#endif + t->rn_left->rn_parent = t; + t->rn_right->rn_parent = t; + p = x->rn_parent; + if (p->rn_left == x) + p->rn_left = t; + else + p->rn_right = t; + } +out: + tt->rn_flags &= ~RNF_ACTIVE; + tt[1].rn_flags &= ~RNF_ACTIVE; + return (tt); +} + +/* + * This is the same as rn_walktree() except for the parameters and the + * exit. + */ +static int +rn_walktree_from(h, a, m, f, w) + struct radix_node_head *h; + void *a, *m; + walktree_f_t *f; + void *w; +{ + int error; + struct radix_node *base, *next; + u_char *xa = (u_char *)a; + u_char *xm = (u_char *)m; + register struct radix_node *rn, *last = 0 /* shut up gcc */; + int stopping = 0; + int lastb; + + /* + * rn_search_m is sort-of-open-coded here. + */ + /* printf("about to search\n"); */ + for (rn = h->rnh_treetop; rn->rn_bit >= 0; ) { + last = rn; + /* printf("rn_bit %d, rn_bmask %x, xm[rn_offset] %x\n", + rn->rn_bit, rn->rn_bmask, xm[rn->rn_offset]); */ + if (!(rn->rn_bmask & xm[rn->rn_offset])) { + break; + } + if (rn->rn_bmask & xa[rn->rn_offset]) { + rn = rn->rn_right; + } else { + rn = rn->rn_left; + } + } + /* printf("done searching\n"); */ + + /* + * Two cases: either we stepped off the end of our mask, + * in which case last == rn, or we reached a leaf, in which + * case we want to start from the last node we looked at. + * Either way, last is the node we want to start from. + */ + rn = last; + lastb = rn->rn_bit; + + /* printf("rn %p, lastb %d\n", rn, lastb);*/ + + /* + * This gets complicated because we may delete the node + * while applying the function f to it, so we need to calculate + * the successor node in advance. + */ + while (rn->rn_bit >= 0) + rn = rn->rn_left; + + while (!stopping) { + /* printf("node %p (%d)\n", rn, rn->rn_bit); */ + base = rn; + /* If at right child go back up, otherwise, go right */ + while (rn->rn_parent->rn_right == rn + && !(rn->rn_flags & RNF_ROOT)) { + rn = rn->rn_parent; + + /* if went up beyond last, stop */ + if (rn->rn_bit < lastb) { + stopping = 1; + /* printf("up too far\n"); */ + } + } + + /* Find the next *leaf* since next node might vanish, too */ + for (rn = rn->rn_parent->rn_right; rn->rn_bit >= 0;) + rn = rn->rn_left; + next = rn; + /* Process leaves */ + while ((rn = base) != 0) { + base = rn->rn_dupedkey; + /* printf("leaf %p\n", rn); */ + if (!(rn->rn_flags & RNF_ROOT) + && (error = (*f)(rn, w))) + return (error); + } + rn = next; + + if (rn->rn_flags & RNF_ROOT) { + /* printf("root, stopping"); */ + stopping = 1; + } + + } + return 0; +} + +static int +rn_walktree(h, f, w) + struct radix_node_head *h; + walktree_f_t *f; + void *w; +{ + int error; + struct radix_node *base, *next; + register struct radix_node *rn = h->rnh_treetop; + /* + * This gets complicated because we may delete the node + * while applying the function f to it, so we need to calculate + * the successor node in advance. + */ + /* First time through node, go left */ + while (rn->rn_bit >= 0) + rn = rn->rn_left; + for (;;) { + base = rn; + /* If at right child go back up, otherwise, go right */ + while (rn->rn_parent->rn_right == rn + && (rn->rn_flags & RNF_ROOT) == 0) + rn = rn->rn_parent; + /* Find the next *leaf* since next node might vanish, too */ + for (rn = rn->rn_parent->rn_right; rn->rn_bit >= 0;) + rn = rn->rn_left; + next = rn; + /* Process leaves */ + while ((rn = base)) { + base = rn->rn_dupedkey; + if (!(rn->rn_flags & RNF_ROOT) + && (error = (*f)(rn, w))) + return (error); + } + rn = next; + if (rn->rn_flags & RNF_ROOT) + return (0); + } + /* NOTREACHED */ +} + +int +rn_inithead(head, off) + void **head; + int off; +{ + register struct radix_node_head *rnh; + register struct radix_node *t, *tt, *ttt; + if (*head) + return (1); + R_Malloc(rnh, struct radix_node_head *, sizeof (*rnh)); + if (rnh == 0) + return (0); + Bzero(rnh, sizeof (*rnh)); + *head = rnh; + t = rn_newpair(rn_zeros, off, rnh->rnh_nodes); + ttt = rnh->rnh_nodes + 2; + t->rn_right = ttt; + t->rn_parent = t; + tt = t->rn_left; + tt->rn_flags = t->rn_flags = RNF_ROOT | RNF_ACTIVE; + tt->rn_bit = -1 - off; + *ttt = *tt; + ttt->rn_key = rn_ones; + rnh->rnh_addaddr = rn_addroute; + rnh->rnh_deladdr = rn_delete; + rnh->rnh_matchaddr = rn_match; + rnh->rnh_lookup = rn_lookup; + rnh->rnh_walktree = rn_walktree; + rnh->rnh_walktree_from = rn_walktree_from; + rnh->rnh_treetop = t; + return (1); +} + +void +rn_init() +{ + char *cp, *cplim; +#ifdef _KERNEL + struct domain *dom; + + for (dom = domains; dom; dom = dom->dom_next) + if (dom->dom_maxrtkey > max_keylen) + max_keylen = dom->dom_maxrtkey; +#endif + if (max_keylen == 0) { + log(LOG_ERR, + "rn_init: radix functions require max_keylen be set\n"); + return; + } + R_Malloc(rn_zeros, char *, 3 * max_keylen); + if (rn_zeros == NULL) + panic("rn_init"); + Bzero(rn_zeros, 3 * max_keylen); + rn_ones = cp = rn_zeros + max_keylen; + addmask_key = cplim = rn_ones + max_keylen; + while (cp < cplim) + *cp++ = -1; + if (rn_inithead((void **)&mask_rnhead, 0) == 0) + panic("rn_init 2"); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/net/raw_cb.c b/packages/net/bsd_tcpip/current/src/sys/net/raw_cb.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/net/raw_cb.c @@ -0,0 +1,166 @@ +//========================================================================== +// +// src/sys/net/raw_cb.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1980, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)raw_cb.c 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/raw_cb.c,v 1.16 1999/08/28 00:48:27 peter Exp $ + */ + +#include +#include +#include +#include +#include +#include + +#include + +/* + * Routines to manage the raw protocol control blocks. + * + * TODO: + * hash lookups by protocol family/protocol + address family + * take care of unique address problems per AF? + * redo address binding to allow wildcards + */ + +struct rawcb_list_head rawcb_list; + +static u_long raw_sendspace = RAWSNDQ; +static u_long raw_recvspace = RAWRCVQ; + +/* + * Allocate a control block and a nominal amount + * of buffer space for the socket. + */ +int +raw_attach(so, proto) + register struct socket *so; + int proto; +{ + register struct rawcb *rp = sotorawcb(so); + int error; + + /* + * It is assumed that raw_attach is called + * after space has been allocated for the + * rawcb. + */ + if (rp == 0) + return (ENOBUFS); + error = soreserve(so, raw_sendspace, raw_recvspace); + if (error) + return (error); + rp->rcb_socket = so; + rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family; + rp->rcb_proto.sp_protocol = proto; + LIST_INSERT_HEAD(&rawcb_list, rp, list); + return (0); +} + +/* + * Detach the raw connection block and discard + * socket resources. + */ +void +raw_detach(rp) + register struct rawcb *rp; +{ + struct socket *so = rp->rcb_socket; + + so->so_pcb = 0; + sofree(so); + LIST_REMOVE(rp, list); +#ifdef notdef + if (rp->rcb_laddr) + m_freem(dtom(rp->rcb_laddr)); + rp->rcb_laddr = 0; +#endif + free((caddr_t)(rp), M_PCB); +} + +/* + * Disconnect and possibly release resources. + */ +void +raw_disconnect(rp) + struct rawcb *rp; +{ + +#ifdef notdef + if (rp->rcb_faddr) + m_freem(dtom(rp->rcb_faddr)); + rp->rcb_faddr = 0; +#endif + if (rp->rcb_socket->so_state & SS_NOFDREF) + raw_detach(rp); +} + +#ifdef notdef +#include + +int +raw_bind(so, nam) + register struct socket *so; + struct mbuf *nam; +{ + struct sockaddr *addr = mtod(nam, struct sockaddr *); + register struct rawcb *rp; + + if (ifnet == 0) + return (EADDRNOTAVAIL); + rp = sotorawcb(so); + nam = m_copym(nam, 0, M_COPYALL, M_WAITOK); + rp->rcb_laddr = mtod(nam, struct sockaddr *); + return (0); +} +#endif diff --git a/packages/net/bsd_tcpip/current/src/sys/net/raw_usrreq.c b/packages/net/bsd_tcpip/current/src/sys/net/raw_usrreq.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/net/raw_usrreq.c @@ -0,0 +1,316 @@ +//========================================================================== +// +// src/sys/net/raw_usrreq.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1980, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/raw_usrreq.c,v 1.18 1999/08/28 00:48:28 peter Exp $ + */ + +#include +#include +#include +#include +#include + +#include + +/* + * Initialize raw connection block q. + */ +void +raw_init() +{ + LIST_INIT(&rawcb_list); +} + + +/* + * Raw protocol input routine. Find the socket + * associated with the packet(s) and move them over. If + * nothing exists for this packet, drop it. + */ +/* + * Raw protocol interface. + */ +void +raw_input(m0, proto, src, dst) + struct mbuf *m0; + register struct sockproto *proto; + struct sockaddr *src, *dst; +{ + register struct rawcb *rp; + register struct mbuf *m = m0; + register int sockets = 0; + struct socket *last; + + last = 0; + LIST_FOREACH(rp, &rawcb_list, list) { + if (rp->rcb_proto.sp_family != proto->sp_family) + continue; + if (rp->rcb_proto.sp_protocol && + rp->rcb_proto.sp_protocol != proto->sp_protocol) + continue; + /* + * We assume the lower level routines have + * placed the address in a canonical format + * suitable for a structure comparison. + * + * Note that if the lengths are not the same + * the comparison will fail at the first byte. + */ +#define equal(a1, a2) \ + (bcmp((caddr_t)(a1), (caddr_t)(a2), a1->sa_len) == 0) + if (rp->rcb_laddr && !equal(rp->rcb_laddr, dst)) + continue; + if (rp->rcb_faddr && !equal(rp->rcb_faddr, src)) + continue; + if (last) { + struct mbuf *n; + n = m_copy(m, 0, (int)M_COPYALL); + if (n) { + if (sbappendaddr(&last->so_rcv, src, + n, (struct mbuf *)0) == 0) + /* should notify about lost packet */ + m_freem(n); + else { + sorwakeup(last); + sockets++; + } + } + } + last = rp->rcb_socket; + } + if (last) { + if (sbappendaddr(&last->so_rcv, src, + m, (struct mbuf *)0) == 0) + m_freem(m); + else { + sorwakeup(last); + sockets++; + } + } else + m_freem(m); +} + +/*ARGSUSED*/ +void +raw_ctlinput(cmd, arg, dummy) + int cmd; + struct sockaddr *arg; + void *dummy; +{ + + if (cmd < 0 || cmd > PRC_NCMDS) + return; + /* INCOMPLETE */ +} + +static int +raw_uabort(struct socket *so) +{ + struct rawcb *rp = sotorawcb(so); + + if (rp == 0) + return EINVAL; + raw_disconnect(rp); + sofree(so); + soisdisconnected(so); + return 0; +} + +/* pru_accept is EOPNOTSUPP */ + +static int +raw_uattach(struct socket *so, int proto, struct proc *p) +{ + struct rawcb *rp = sotorawcb(so); + + if (rp == 0) + return EINVAL; + return raw_attach(so, proto); +} + +static int +raw_ubind(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + return EINVAL; +} + +static int +raw_uconnect(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + return EINVAL; +} + +/* pru_connect2 is EOPNOTSUPP */ +/* pru_control is EOPNOTSUPP */ + +static int +raw_udetach(struct socket *so) +{ + struct rawcb *rp = sotorawcb(so); + + if (rp == 0) + return EINVAL; + + raw_detach(rp); + return 0; +} + +static int +raw_udisconnect(struct socket *so) +{ + struct rawcb *rp = sotorawcb(so); + + if (rp == 0) + return EINVAL; + if (rp->rcb_faddr == 0) { + return ENOTCONN; + } + raw_disconnect(rp); + soisdisconnected(so); + return 0; +} + +/* pru_listen is EOPNOTSUPP */ + +static int +raw_upeeraddr(struct socket *so, struct sockaddr **nam) +{ + struct rawcb *rp = sotorawcb(so); + + if (rp == 0) + return EINVAL; + if (rp->rcb_faddr == 0) { + return ENOTCONN; + } + *nam = dup_sockaddr(rp->rcb_faddr, 1); + return 0; +} + +/* pru_rcvd is EOPNOTSUPP */ +/* pru_rcvoob is EOPNOTSUPP */ + +static int +raw_usend(struct socket *so, int flags, struct mbuf *m, + struct sockaddr *nam, struct mbuf *control, struct proc *p) +{ + int error; + struct rawcb *rp = sotorawcb(so); + + if (rp == 0) { + error = EINVAL; + goto release; + } + + if (flags & PRUS_OOB) { + error = EOPNOTSUPP; + goto release; + } + + if (control && control->m_len) { + error = EOPNOTSUPP; + goto release; + } + if (nam) { + if (rp->rcb_faddr) { + error = EISCONN; + goto release; + } + rp->rcb_faddr = nam; + } else if (rp->rcb_faddr == 0) { + error = ENOTCONN; + goto release; + } + error = (*so->so_proto->pr_output)(m, so); + m = NULL; + if (nam) + rp->rcb_faddr = 0; +release: + if (m != NULL) + m_freem(m); + return (error); +} + +/* pru_sense is null */ + +static int +raw_ushutdown(struct socket *so) +{ + struct rawcb *rp = sotorawcb(so); + + if (rp == 0) + return EINVAL; + socantsendmore(so); + return 0; +} + +static int +raw_usockaddr(struct socket *so, struct sockaddr **nam) +{ + struct rawcb *rp = sotorawcb(so); + + if (rp == 0) + return EINVAL; + if (rp->rcb_laddr == 0) + return EINVAL; + *nam = dup_sockaddr(rp->rcb_laddr, 1); + return 0; +} + +struct pr_usrreqs raw_usrreqs = { + raw_uabort, pru_accept_notsupp, raw_uattach, raw_ubind, raw_uconnect, + pru_connect2_notsupp, pru_control_notsupp, raw_udetach, + raw_udisconnect, pru_listen_notsupp, raw_upeeraddr, pru_rcvd_notsupp, + pru_rcvoob_notsupp, raw_usend, pru_sense_null, raw_ushutdown, + raw_usockaddr, sosend, soreceive, sopoll +}; diff --git a/packages/net/bsd_tcpip/current/src/sys/net/route.c b/packages/net/bsd_tcpip/current/src/sys/net/route.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/net/route.c @@ -0,0 +1,1183 @@ +//========================================================================== +// +// src/sys/net/route.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1980, 1986, 1991, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)route.c 8.2 (Berkeley) 11/15/93 + * $FreeBSD: src/sys/net/route.c,v 1.59.2.3 2001/07/29 19:18:02 ume Exp $ + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include // for eCos routing protocols + +#define SA(p) ((struct sockaddr *)(p)) + +struct route_cb route_cb; +static struct rtstat rtstat; +struct radix_node_head *rt_tables[AF_MAX+1]; + +static int rttrash; /* routes not in table but not freed */ + +static void rt_maskedcopy __P((struct sockaddr *, + struct sockaddr *, struct sockaddr *)); +static void rtable_init __P((void **)); + +static void +rtable_init(table) + void **table; +{ + struct domain *dom; + for (dom = domains; dom; dom = dom->dom_next) + if (dom->dom_rtattach) + dom->dom_rtattach(&table[dom->dom_family], + dom->dom_rtoffset); +} + +void +route_init() +{ + rn_init(); /* initialize all zeroes, all ones, mask table */ + rtable_init((void **)rt_tables); +} + +// FIXME: This function is only here because BOOTP fails on a second interface. +// This failure is due to the fact that a route to 0.0.0.0 seems to be +// incredibly sticky, i.e. can't be deleted. BOOTP uses this to +// achieve a generic broadcast. Sadly it seems that BOOTP servers will +// only work this way, thus the hack. +// +// This version enumerates all routes and deletes them - this leaks less +// store than the previous version. + +static int +rt_reinit_rtdelete( struct radix_node *rn, void *vifp ) +{ + struct rtentry *rt = (struct rtentry *)rn; + rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt), + 0, NULL); + return (0); +} + +void +cyg_route_reinit(void) +{ + int i; + for (i = 0; i < AF_MAX+1; i++) { + struct radix_node_head *rnh; + rnh = rt_tables[i]; + if (rnh) { + (*rnh->rnh_walktree)(rnh, rt_reinit_rtdelete, NULL); + } + } +} + +/* + * Packet routing routines. + */ +void +rtalloc(ro) + register struct route *ro; +{ + rtalloc_ign(ro, 0UL); +} + +void +rtalloc_ign(ro, ignore) + register struct route *ro; + u_long ignore; +{ + struct rtentry *rt; + int s; + + if ((rt = ro->ro_rt) != NULL) { + if (rt->rt_ifp != NULL && rt->rt_flags & RTF_UP) + return; + /* XXX - We are probably always at splnet here already. */ + s = splnet(); + RTFREE(rt); + ro->ro_rt = NULL; + splx(s); + } + ro->ro_rt = rtalloc1(&ro->ro_dst, 1, ignore); +} + +/* + * Look up the route that matches the address given + * Or, at least try.. Create a cloned route if needed. + */ +struct rtentry * +rtalloc1(dst, report, ignflags) + register struct sockaddr *dst; + int report; + u_long ignflags; +{ + register struct radix_node_head *rnh = rt_tables[dst->sa_family]; + register struct rtentry *rt; + register struct radix_node *rn; + struct rtentry *newrt = 0; + struct rt_addrinfo info; + u_long nflags; + int s = splnet(), err = 0, msgtype = RTM_MISS; + + /* + * Look up the address in the table for that Address Family + */ + if (rnh && (rn = rnh->rnh_matchaddr((caddr_t)dst, rnh)) && + ((rn->rn_flags & RNF_ROOT) == 0)) { + /* + * If we find it and it's not the root node, then + * get a refernce on the rtentry associated. + */ + newrt = rt = (struct rtentry *)rn; + nflags = rt->rt_flags & ~ignflags; + if (report && (nflags & (RTF_CLONING | RTF_PRCLONING))) { + /* + * We are apparently adding (report = 0 in delete). + * If it requires that it be cloned, do so. + * (This implies it wasn't a HOST route.) + */ + err = rtrequest(RTM_RESOLVE, dst, SA(0), + SA(0), 0, &newrt); + if (err) { + /* + * If the cloning didn't succeed, maybe + * what we have will do. Return that. + */ + newrt = rt; + rt->rt_refcnt++; + goto miss; + } + if ((rt = newrt) && (rt->rt_flags & RTF_XRESOLVE)) { + /* + * If the new route specifies it be + * externally resolved, then go do that. + */ + msgtype = RTM_RESOLVE; + goto miss; + } + } else + rt->rt_refcnt++; + } else { + /* + * Either we hit the root or couldn't find any match, + * Which basically means + * "caint get there frm here" + */ + rtstat.rts_unreach++; + miss: if (report) { + /* + * If required, report the failure to the supervising + * Authorities. + * For a delete, this is not an error. (report == 0) + */ + bzero((caddr_t)&info, sizeof(info)); + info.rti_info[RTAX_DST] = dst; + rt_missmsg(msgtype, &info, 0, err); + } + } + splx(s); + return (newrt); +} + +/* + * Remove a reference count from an rtentry. + * If the count gets low enough, take it out of the routing table + */ +void +rtfree(rt) + register struct rtentry *rt; +{ + /* + * find the tree for that address family + */ + register struct radix_node_head *rnh = + rt_tables[rt_key(rt)->sa_family]; + register struct ifaddr *ifa; + + if (rt == 0 || rnh == 0) + panic("rtfree"); + + /* + * decrement the reference count by one and if it reaches 0, + * and there is a close function defined, call the close function + */ + rt->rt_refcnt--; + if(rnh->rnh_close && rt->rt_refcnt == 0) { + rnh->rnh_close((struct radix_node *)rt, rnh); + } + + /* + * If we are no longer "up" (and ref == 0) + * then we can free the resources associated + * with the route. + */ + if (rt->rt_refcnt <= 0 && (rt->rt_flags & RTF_UP) == 0) { + if (rt->rt_nodes->rn_flags & (RNF_ACTIVE | RNF_ROOT)) + panic ("rtfree 2"); + /* + * the rtentry must have been removed from the routing table + * so it is represented in rttrash.. remove that now. + */ + rttrash--; + +#ifdef DIAGNOSTIC + if (rt->rt_refcnt < 0) { + printf("rtfree: %p not freed (neg refs)\n", rt); + return; + } +#endif + + /* + * release references on items we hold them on.. + * e.g other routes and ifaddrs. + */ + if((ifa = rt->rt_ifa)) + IFAFREE(ifa); + if (rt->rt_parent) { + RTFREE(rt->rt_parent); + } + + /* + * The key is separatly alloc'd so free it (see rt_setgate()). + * This also frees the gateway, as they are always malloc'd + * together. + */ + Free(rt_key(rt)); + + /* + * and the rtentry itself of course + */ + Free(rt); + } +} + +void +ifafree(ifa) + register struct ifaddr *ifa; +{ + if (ifa == NULL) + panic("ifafree"); + if (ifa->ifa_refcnt == 0) + free(ifa, M_IFADDR); + else + ifa->ifa_refcnt--; +} + +/* + * Force a routing table entry to the specified + * destination to go through the given gateway. + * Normally called as a result of a routing redirect + * message from the network layer. + * + * N.B.: must be called at splnet + * + */ +void +rtredirect(dst, gateway, netmask, flags, src, rtp) + struct sockaddr *dst, *gateway, *netmask, *src; + int flags; + struct rtentry **rtp; +{ + register struct rtentry *rt; + int error = 0; + short *stat = 0; + struct rt_addrinfo info; + struct ifaddr *ifa; + + /* verify the gateway is directly reachable */ + if ((ifa = ifa_ifwithnet(gateway)) == 0) { + error = ENETUNREACH; + goto out; + } + rt = rtalloc1(dst, 0, 0UL); + /* + * If the redirect isn't from our current router for this dst, + * it's either old or wrong. If it redirects us to ourselves, + * we have a routing loop, perhaps as a result of an interface + * going down recently. + */ +#define equal(a1, a2) \ + ((a1)->sa_len == (a2)->sa_len && \ + bcmp((caddr_t)(a1), (caddr_t)(a2), (a1)->sa_len) == 0) + if (!(flags & RTF_DONE) && rt && + (!equal(src, rt->rt_gateway) || rt->rt_ifa != ifa)) + error = EINVAL; + else if (ifa_ifwithaddr(gateway)) + error = EHOSTUNREACH; + if (error) + goto done; + /* + * Create a new entry if we just got back a wildcard entry + * or the the lookup failed. This is necessary for hosts + * which use routing redirects generated by smart gateways + * to dynamically build the routing tables. + */ + if ((rt == 0) || (rt_mask(rt) && rt_mask(rt)->sa_len < 2)) + goto create; + /* + * Don't listen to the redirect if it's + * for a route to an interface. + */ + if (rt->rt_flags & RTF_GATEWAY) { + if (((rt->rt_flags & RTF_HOST) == 0) && (flags & RTF_HOST)) { + /* + * Changing from route to net => route to host. + * Create new route, rather than smashing route to net. + */ + create: + flags |= RTF_GATEWAY | RTF_DYNAMIC; + error = rtrequest((int)RTM_ADD, dst, gateway, + netmask, flags, + (struct rtentry **)0); + stat = &rtstat.rts_dynamic; + } else { + /* + * Smash the current notion of the gateway to + * this destination. Should check about netmask!!! + */ + rt->rt_flags |= RTF_MODIFIED; + flags |= RTF_MODIFIED; + stat = &rtstat.rts_newgateway; + /* + * add the key and gateway (in one malloc'd chunk). + */ + rt_setgate(rt, rt_key(rt), gateway); + } + } else + error = EHOSTUNREACH; +done: + if (rt) { + if (rtp && !error) + *rtp = rt; + else + rtfree(rt); + } +out: + if (error) + rtstat.rts_badredirect++; + else if (stat != NULL) + (*stat)++; + bzero((caddr_t)&info, sizeof(info)); + info.rti_info[RTAX_DST] = dst; + info.rti_info[RTAX_GATEWAY] = gateway; + info.rti_info[RTAX_NETMASK] = netmask; + info.rti_info[RTAX_AUTHOR] = src; + rt_missmsg(RTM_REDIRECT, &info, flags, error); +} + +/* +* Routing table ioctl interface. +*/ +int +rtioctl(req, data, p) + int req; + caddr_t data; + struct proc *p; +{ +#ifdef INET + struct ecos_rtentry *rt; + int res; + + switch (req) { + case SIOCADDRT: + rt = (struct ecos_rtentry *)data; + res = rtrequest(RTM_ADD, + &rt->rt_dst, + &rt->rt_gateway, + &rt->rt_genmask, + rt->rt_flags, + NULL); + return (res); + case SIOCDELRT: + rt = (struct ecos_rtentry *)data; + res = rtrequest(RTM_DELETE, + &rt->rt_dst, + &rt->rt_gateway, + &rt->rt_genmask, + rt->rt_flags, + NULL); + return (res); + default: + break; + } + /* Multicast goop, grrr... */ +#ifdef MROUTING + return mrt_ioctl(req, data); +#else + return mrt_ioctl(req, data, p); +#endif +#else /* INET */ + return ENXIO; +#endif /* INET */ +} + +struct ifaddr * +ifa_ifwithroute(flags, dst, gateway) + int flags; + struct sockaddr *dst, *gateway; +{ + register struct ifaddr *ifa; + if ((flags & RTF_GATEWAY) == 0) { + /* + * If we are adding a route to an interface, + * and the interface is a pt to pt link + * we should search for the destination + * as our clue to the interface. Otherwise + * we can use the local address. + */ + ifa = 0; + if (flags & RTF_HOST) { + ifa = ifa_ifwithdstaddr(dst); + } + if (ifa == 0) + ifa = ifa_ifwithaddr(gateway); + } else { + /* + * If we are adding a route to a remote net + * or host, the gateway may still be on the + * other end of a pt to pt link. + */ + ifa = ifa_ifwithdstaddr(gateway); + } + if (ifa == 0) + ifa = ifa_ifwithnet(gateway); + if (ifa == 0) { + struct rtentry *rt = rtalloc1(dst, 0, 0UL); + if (rt == 0) + return (0); + rt->rt_refcnt--; + if ((ifa = rt->rt_ifa) == 0) + return (0); + } + if (ifa->ifa_addr->sa_family != dst->sa_family) { + struct ifaddr *oifa = ifa; + ifa = ifaof_ifpforaddr(dst, ifa->ifa_ifp); + if (ifa == 0) + ifa = oifa; + } + return (ifa); +} + +#define ROUNDUP(a) (a>0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) + +static int rt_fixdelete __P((struct radix_node *, void *)); +static int rt_fixchange __P((struct radix_node *, void *)); + +struct rtfc_arg { + struct rtentry *rt0; + struct radix_node_head *rnh; +}; + +/* + * Do appropriate manipulations of a routing tree given + * all the bits of info needed + */ +int +rtrequest(req, dst, gateway, netmask, flags, ret_nrt) + int req, flags; + struct sockaddr *dst, *gateway, *netmask; + struct rtentry **ret_nrt; +{ + int s = splnet(); int error = 0; + register struct rtentry *rt; + register struct radix_node *rn; + register struct radix_node_head *rnh; + struct ifaddr *ifa; + struct sockaddr *ndst; +#define senderr(x) { error = x ; goto bad; } + + /* + * Find the correct routing tree to use for this Address Family + */ + if ((rnh = rt_tables[dst->sa_family]) == 0) + senderr(ESRCH); + /* + * If we are adding a host route then we don't want to put + * a netmask in the tree + */ + if (flags & RTF_HOST) + netmask = 0; + switch (req) { + case RTM_DELETE: + /* + * Remove the item from the tree and return it. + * Complain if it is not there and do no more processing. + */ + if ((rn = rnh->rnh_deladdr(dst, netmask, rnh)) == 0) + senderr(ESRCH); + if (rn->rn_flags & (RNF_ACTIVE | RNF_ROOT)) + panic ("rtrequest delete"); + rt = (struct rtentry *)rn; + + /* + * Now search what's left of the subtree for any cloned + * routes which might have been formed from this node. + */ + if ((rt->rt_flags & (RTF_CLONING | RTF_PRCLONING)) && + rt_mask(rt)) { + rnh->rnh_walktree_from(rnh, dst, rt_mask(rt), + rt_fixdelete, rt); + } + + /* + * Remove any external references we may have. + * This might result in another rtentry being freed if + * we held its last reference. + */ + if (rt->rt_gwroute) { + if (rt != rt->rt_gwroute) + RTFREE( rt->rt_gwroute ); // Free it up as normal + else + rt->rt_refcnt--; // Just dec the refcount - freeing + // it here would be premature + rt->rt_gwroute = NULL; + } + + /* + * NB: RTF_UP must be set during the search above, + * because we might delete the last ref, causing + * rt to get freed prematurely. + * eh? then why not just add a reference? + * I'm not sure how RTF_UP helps matters. (JRE) + */ + rt->rt_flags &= ~RTF_UP; + + /* + * give the protocol a chance to keep things in sync. + */ + if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest) + ifa->ifa_rtrequest(RTM_DELETE, rt, SA(0)); + + /* + * one more rtentry floating around that is not + * linked to the routing table. + */ + rttrash++; + + /* + * If the caller wants it, then it can have it, + * but it's up to it to free the rtentry as we won't be + * doing it. + */ + if (ret_nrt) + *ret_nrt = rt; + else if (rt->rt_refcnt <= 0) { + rt->rt_refcnt++; /* make a 1->0 transition */ + rtfree(rt); + } + break; + + case RTM_RESOLVE: + if (ret_nrt == 0 || (rt = *ret_nrt) == 0) + senderr(EINVAL); + ifa = rt->rt_ifa; + flags = rt->rt_flags & + ~(RTF_CLONING | RTF_PRCLONING | RTF_STATIC); + flags |= RTF_WASCLONED; + gateway = rt->rt_gateway; + if ((netmask = rt->rt_genmask) == 0) + flags |= RTF_HOST; + goto makeroute; + + case RTM_ADD: + if ((flags & RTF_GATEWAY) && !gateway) + panic("rtrequest: GATEWAY but no gateway"); + + if ((ifa = ifa_ifwithroute(flags, dst, gateway)) == 0) + senderr(ENETUNREACH); + + makeroute: + R_Malloc(rt, struct rtentry *, sizeof(*rt)); + if (rt == 0) + senderr(ENOBUFS); + Bzero(rt, sizeof(*rt)); + rt->rt_flags = RTF_UP | flags; + /* + * Add the gateway. Possibly re-malloc-ing the storage for it + * also add the rt_gwroute if possible. + */ + if ((error = rt_setgate(rt, dst, gateway)) != 0) { + Free(rt); + senderr(error); + } + + /* + * point to the (possibly newly malloc'd) dest address. + */ + ndst = rt_key(rt); + + /* + * make sure it contains the value we want (masked if needed). + */ + if (netmask) { + rt_maskedcopy(dst, ndst, netmask); + } else + Bcopy(dst, ndst, dst->sa_len); + + /* + * Note that we now have a reference to the ifa. + * This moved from below so that rnh->rnh_addaddr() can + * examine the ifa and ifa->ifa_ifp if it so desires. + */ + ifa->ifa_refcnt++; + rt->rt_ifa = ifa; + rt->rt_ifp = ifa->ifa_ifp; + /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ + + rn = rnh->rnh_addaddr((caddr_t)ndst, (caddr_t)netmask, + rnh, rt->rt_nodes); + if (rn == 0) { + struct rtentry *rt2; + /* + * Uh-oh, we already have one of these in the tree. + * We do a special hack: if the route that's already + * there was generated by the protocol-cloning + * mechanism, then we just blow it away and retry + * the insertion of the new one. + */ + rt2 = rtalloc1(dst, 0, RTF_PRCLONING); + if (rt2 && rt2->rt_parent) { + rtrequest(RTM_DELETE, + (struct sockaddr *)rt_key(rt2), + rt2->rt_gateway, + rt_mask(rt2), rt2->rt_flags, 0); + RTFREE(rt2); + rn = rnh->rnh_addaddr((caddr_t)ndst, + (caddr_t)netmask, + rnh, rt->rt_nodes); + } else if (rt2) { + /* undo the extra ref we got */ + RTFREE(rt2); + } + } + + /* + * If it still failed to go into the tree, + * then un-make it (this should be a function) + */ + if (rn == 0) { + if (rt->rt_gwroute) + rtfree(rt->rt_gwroute); + if (rt->rt_ifa) { + IFAFREE(rt->rt_ifa); + } + Free(rt_key(rt)); + Free(rt); + senderr(EEXIST); + } + + rt->rt_parent = 0; + + /* + * If we got here from RESOLVE, then we are cloning + * so clone the rest, and note that we + * are a clone (and increment the parent's references) + */ + if (req == RTM_RESOLVE) { + rt->rt_rmx = (*ret_nrt)->rt_rmx; /* copy metrics */ + if ((*ret_nrt)->rt_flags & (RTF_CLONING | RTF_PRCLONING)) { + rt->rt_parent = (*ret_nrt); + (*ret_nrt)->rt_refcnt++; + } + } + + /* + * if this protocol has something to add to this then + * allow it to do that as well. + */ + if (ifa->ifa_rtrequest) + ifa->ifa_rtrequest(req, rt, SA(ret_nrt ? *ret_nrt : 0)); + + /* + * We repeat the same procedure from rt_setgate() here because + * it doesn't fire when we call it there because the node + * hasn't been added to the tree yet. + */ + if (!(rt->rt_flags & RTF_HOST) && rt_mask(rt) != 0) { + struct rtfc_arg arg; + arg.rnh = rnh; + arg.rt0 = rt; + rnh->rnh_walktree_from(rnh, rt_key(rt), rt_mask(rt), + rt_fixchange, &arg); + } + + /* + * actually return a resultant rtentry and + * give the caller a single reference. + */ + if (ret_nrt) { + *ret_nrt = rt; + rt->rt_refcnt++; + } + break; + } +bad: + splx(s); + return (error); +} + +/* + * Called from rtrequest(RTM_DELETE, ...) to fix up the route's ``family'' + * (i.e., the routes related to it by the operation of cloning). This + * routine is iterated over all potential former-child-routes by way of + * rnh->rnh_walktree_from() above, and those that actually are children of + * the late parent (passed in as VP here) are themselves deleted. + */ +static int +rt_fixdelete(rn, vp) + struct radix_node *rn; + void *vp; +{ + struct rtentry *rt = (struct rtentry *)rn; + struct rtentry *rt0 = vp; + + if (rt->rt_parent == rt0 && !(rt->rt_flags & RTF_PINNED)) { + return rtrequest(RTM_DELETE, rt_key(rt), + (struct sockaddr *)0, rt_mask(rt), + rt->rt_flags, (struct rtentry **)0); + } + return 0; +} + +/* + * This routine is called from rt_setgate() to do the analogous thing for + * adds and changes. There is the added complication in this case of a + * middle insert; i.e., insertion of a new network route between an older + * network route and (cloned) host routes. For this reason, a simple check + * of rt->rt_parent is insufficient; each candidate route must be tested + * against the (mask, value) of the new route (passed as before in vp) + * to see if the new route matches it. + * + * XXX - it may be possible to do fixdelete() for changes and reserve this + * routine just for adds. I'm not sure why I thought it was necessary to do + * changes this way. + */ +#ifdef DEBUG +static int rtfcdebug = 0; +#endif + +static int +rt_fixchange(rn, vp) + struct radix_node *rn; + void *vp; +{ + struct rtentry *rt = (struct rtentry *)rn; + struct rtfc_arg *ap = vp; + struct rtentry *rt0 = ap->rt0; + struct radix_node_head *rnh = ap->rnh; + u_char *xk1, *xm1, *xk2, *xmp; + int i, len, mlen; + +#ifdef DEBUG + if (rtfcdebug) + printf("rt_fixchange: rt %p, rt0 %p\n", rt, rt0); +#endif + + if (!rt->rt_parent || (rt->rt_flags & RTF_PINNED)) { +#ifdef DEBUG + if(rtfcdebug) printf("no parent or pinned\n"); +#endif + return 0; + } + + if (rt->rt_parent == rt0) { +#ifdef DEBUG + if(rtfcdebug) printf("parent match\n"); +#endif + return rtrequest(RTM_DELETE, rt_key(rt), + (struct sockaddr *)0, rt_mask(rt), + rt->rt_flags, (struct rtentry **)0); + } + + /* + * There probably is a function somewhere which does this... + * if not, there should be. + */ + len = imin(((struct sockaddr *)rt_key(rt0))->sa_len, + ((struct sockaddr *)rt_key(rt))->sa_len); + + xk1 = (u_char *)rt_key(rt0); + xm1 = (u_char *)rt_mask(rt0); + xk2 = (u_char *)rt_key(rt); + + /* avoid applying a less specific route */ + xmp = (u_char *)rt_mask(rt->rt_parent); + mlen = ((struct sockaddr *)rt_key(rt->rt_parent))->sa_len; + if (mlen > ((struct sockaddr *)rt_key(rt0))->sa_len) { +#ifdef DEBUG + if (rtfcdebug) + printf("rt_fixchange: inserting a less " + "specific route\n"); +#endif + return 0; + } + for (i = rnh->rnh_treetop->rn_offset; i < mlen; i++) { + if ((xmp[i] & ~(xmp[i] ^ xm1[i])) != xmp[i]) { +#ifdef DEBUG + if (rtfcdebug) + printf("rt_fixchange: inserting a less " + "specific route\n"); +#endif + return 0; + } + } + + for (i = rnh->rnh_treetop->rn_offset; i < len; i++) { + if ((xk2[i] & xm1[i]) != xk1[i]) { +#ifdef DEBUG + if(rtfcdebug) printf("no match\n"); +#endif + return 0; + } + } + + /* + * OK, this node is a clone, and matches the node currently being + * changed/added under the node's mask. So, get rid of it. + */ +#ifdef DEBUG + if(rtfcdebug) printf("deleting\n"); +#endif + return rtrequest(RTM_DELETE, rt_key(rt), (struct sockaddr *)0, + rt_mask(rt), rt->rt_flags, (struct rtentry **)0); +} + +int +rt_setgate(rt0, dst, gate) + struct rtentry *rt0; + struct sockaddr *dst, *gate; +{ + caddr_t new, old; + int dlen = ROUNDUP(dst->sa_len), glen = ROUNDUP(gate->sa_len); + register struct rtentry *rt = rt0; + struct radix_node_head *rnh = rt_tables[dst->sa_family]; + + /* + * A host route with the destination equal to the gateway + * will interfere with keeping LLINFO in the routing + * table, so disallow it. + */ + if (((rt0->rt_flags & (RTF_HOST|RTF_GATEWAY|RTF_LLINFO)) == + (RTF_HOST|RTF_GATEWAY)) && + (dst->sa_len == gate->sa_len) && + (bcmp(dst, gate, dst->sa_len) == 0)) { + /* + * The route might already exist if this is an RTM_CHANGE + * or a routing redirect, so try to delete it. + */ + if (rt_key(rt0)) + rtrequest(RTM_DELETE, (struct sockaddr *)rt_key(rt0), + rt0->rt_gateway, rt_mask(rt0), rt0->rt_flags, 0); + return EADDRNOTAVAIL; + } + + /* + * Both dst and gateway are stored in the same malloc'd chunk + * (If I ever get my hands on....) + * if we need to malloc a new chunk, then keep the old one around + * till we don't need it any more. + */ + if (rt->rt_gateway == 0 || glen > ROUNDUP(rt->rt_gateway->sa_len)) { + old = (caddr_t)rt_key(rt); + R_Malloc(new, caddr_t, dlen + glen); + if (new == 0) + return ENOBUFS; + rt->rt_nodes->rn_key = new; + } else { + /* + * otherwise just overwrite the old one + */ + new = rt->rt_nodes->rn_key; + old = 0; + } + + /* + * copy the new gateway value into the memory chunk + */ + Bcopy(gate, (rt->rt_gateway = (struct sockaddr *)(new + dlen)), glen); + + /* + * if we are replacing the chunk (or it's new) we need to + * replace the dst as well + */ + if (old) { + Bcopy(dst, new, dlen); + Free(old); + } + + /* + * If there is already a gwroute, it's now almost definitly wrong + * so drop it. + */ + if (rt->rt_gwroute) { + rt = rt->rt_gwroute; RTFREE(rt); + rt = rt0; rt->rt_gwroute = 0; + } + /* + * Cloning loop avoidance: + * In the presence of protocol-cloning and bad configuration, + * it is possible to get stuck in bottomless mutual recursion + * (rtrequest rt_setgate rtalloc1). We avoid this by not allowing + * protocol-cloning to operate for gateways (which is probably the + * correct choice anyway), and avoid the resulting reference loops + * by disallowing any route to run through itself as a gateway. + * This is obviously mandatory when we get rt->rt_output(). + */ + if (rt->rt_flags & RTF_GATEWAY) { + rt->rt_gwroute = rtalloc1(gate, 1, RTF_PRCLONING); + if (rt->rt_gwroute == rt) { + RTFREE(rt->rt_gwroute); + rt->rt_gwroute = 0; +#define EDQUOT ENFILE + return EDQUOT; /* failure */ + } + } + + /* + * This isn't going to do anything useful for host routes, so + * don't bother. Also make sure we have a reasonable mask + * (we don't yet have one during adds). + */ + if (!(rt->rt_flags & RTF_HOST) && rt_mask(rt) != 0) { + struct rtfc_arg arg; + arg.rnh = rnh; + arg.rt0 = rt; + rnh->rnh_walktree_from(rnh, rt_key(rt), rt_mask(rt), + rt_fixchange, &arg); + } + + return 0; +} + +static void +rt_maskedcopy(src, dst, netmask) + struct sockaddr *src, *dst, *netmask; +{ + register u_char *cp1 = (u_char *)src; + register u_char *cp2 = (u_char *)dst; + register u_char *cp3 = (u_char *)netmask; + u_char *cplim = cp2 + *cp3; + u_char *cplim2 = cp2 + *cp1; + + *cp2++ = *cp1++; *cp2++ = *cp1++; /* copies sa_len & sa_family */ + cp3 += 2; + if (cplim > cplim2) + cplim = cplim2; + while (cp2 < cplim) + *cp2++ = *cp1++ & *cp3++; + if (cp2 < cplim2) + bzero((caddr_t)cp2, (unsigned)(cplim2 - cp2)); +} + +/* + * Set up a routing table entry, normally + * for an interface. + */ +int +rtinit(ifa, cmd, flags) + register struct ifaddr *ifa; + int cmd, flags; +{ + register struct rtentry *rt; + register struct sockaddr *dst; + register struct sockaddr *deldst; + struct mbuf *m = 0; + struct rtentry *nrt = 0; + int error; + + dst = flags & RTF_HOST ? ifa->ifa_dstaddr : ifa->ifa_addr; + /* + * If it's a delete, check that if it exists, it's on the correct + * interface or we might scrub a route to another ifa which would + * be confusing at best and possibly worse. + */ + if (cmd == RTM_DELETE) { + /* + * It's a delete, so it should already exist.. + * If it's a net, mask off the host bits + * (Assuming we have a mask) + */ + if ((flags & RTF_HOST) == 0 && ifa->ifa_netmask) { + m = m_get(M_DONTWAIT, MT_SONAME); + if (m == NULL) + return(ENOBUFS); + deldst = mtod(m, struct sockaddr *); + rt_maskedcopy(dst, deldst, ifa->ifa_netmask); + dst = deldst; + } + /* + * Get an rtentry that is in the routing tree and + * contains the correct info. (if this fails, can't get there). + * We set "report" to FALSE so that if it doesn't exist, + * it doesn't report an error or clone a route, etc. etc. + */ + rt = rtalloc1(dst, 0, 0UL); + if (rt) { + /* + * Ok so we found the rtentry. it has an extra reference + * for us at this stage. we won't need that so + * lop that off now. + */ + rt->rt_refcnt--; + if (rt->rt_ifa != ifa) { + /* + * If the interface in the rtentry doesn't match + * the interface we are using, then we don't + * want to delete it, so return an error. + * This seems to be the only point of + * this whole RTM_DELETE clause. + */ + if (m) + (void) m_free(m); + return (flags & RTF_HOST ? EHOSTUNREACH + : ENETUNREACH); + } + } + /* XXX */ +#if 0 + else { + /* + * One would think that as we are deleting, and we know + * it doesn't exist, we could just return at this point + * with an "ELSE" clause, but apparently not.. + */ + return (flags & RTF_HOST ? EHOSTUNREACH + : ENETUNREACH); + } +#endif + } + /* + * Do the actual request + */ + error = rtrequest(cmd, dst, ifa->ifa_addr, ifa->ifa_netmask, + flags | ifa->ifa_flags, &nrt); + if (m) + (void) m_free(m); + /* + * If we are deleting, and we found an entry, then + * it's been removed from the tree.. now throw it away. + */ + if (cmd == RTM_DELETE && error == 0 && (rt = nrt)) { + /* + * notify any listenning routing agents of the change + */ + rt_newaddrmsg(cmd, ifa, error, nrt); + if (rt->rt_refcnt <= 0) { + rt->rt_refcnt++; /* need a 1->0 transition to free */ + rtfree(rt); + } + } + + /* + * We are adding, and we have a returned routing entry. + * We need to sanity check the result. + */ + if (cmd == RTM_ADD && error == 0 && (rt = nrt)) { + /* + * We just wanted to add it.. we don't actually need a reference + */ + rt->rt_refcnt--; + /* + * If it came back with an unexpected interface, then it must + * have already existed or something. (XXX) + */ + if (rt->rt_ifa != ifa) { + if (!(rt->rt_ifa->ifa_ifp->if_flags & + (IFF_POINTOPOINT|IFF_LOOPBACK))) + printf("rtinit: wrong ifa (%p) was (%p)\n", + ifa, rt->rt_ifa); + /* + * Ask that the protocol in question + * remove anything it has associated with + * this route and ifaddr. + */ + if (rt->rt_ifa->ifa_rtrequest) + rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, SA(0)); + /* + * Remove the reference to its ifaddr. + */ + IFAFREE(rt->rt_ifa); + /* + * And substitute in references to the ifaddr + * we are adding. + */ + rt->rt_ifa = ifa; + rt->rt_ifp = ifa->ifa_ifp; + rt->rt_rmx.rmx_mtu = ifa->ifa_ifp->if_mtu; /*XXX*/ + ifa->ifa_refcnt++; + /* + * Now ask the protocol to check if it needs + * any special processing in its new form. + */ + if (ifa->ifa_rtrequest) + ifa->ifa_rtrequest(RTM_ADD, rt, SA(0)); + } + /* + * notify any listenning routing agents of the change + */ + rt_newaddrmsg(cmd, ifa, error, nrt); + } + return (error); +} + +/* This must be before ip6_init2(), which is now SI_ORDER_MIDDLE */ +SYSINIT(route, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init, 0); diff --git a/packages/net/bsd_tcpip/current/src/sys/net/rtsock.c b/packages/net/bsd_tcpip/current/src/sys/net/rtsock.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/net/rtsock.c @@ -0,0 +1,895 @@ +//========================================================================== +// +// src/sys/net/rtsock.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1988, 1991, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)rtsock.c 8.5 (Berkeley) 11/2/94 + * $FreeBSD: src/sys/net/rtsock.c,v 1.44.2.4 2001/07/11 09:37:37 ume Exp $ + */ + + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +static struct sockaddr route_dst = { 2, PF_ROUTE, }; +static struct sockaddr route_src = { 2, PF_ROUTE, }; +static struct sockaddr sa_zero = { sizeof(sa_zero), AF_INET, }; +static struct sockproto route_proto = { PF_ROUTE, }; + +struct walkarg { + int w_tmemsize; + int w_op, w_arg; + caddr_t w_tmem; + struct sysctl_req *w_req; +}; + +static struct mbuf * + rt_msg1 __P((int, struct rt_addrinfo *)); +static int rt_msg2 __P((int, + struct rt_addrinfo *, caddr_t, struct walkarg *)); +static int rt_xaddrs __P((caddr_t, caddr_t, struct rt_addrinfo *)); +static int route_output __P((struct mbuf *, struct socket *)); +static void rt_setmetrics __P((u_long, struct rt_metrics *, struct rt_metrics *)); + +/* Sleazy use of local variables throughout file, warning!!!! */ +#define dst info.rti_info[RTAX_DST] +#define gate info.rti_info[RTAX_GATEWAY] +#define netmask info.rti_info[RTAX_NETMASK] +#define genmask info.rti_info[RTAX_GENMASK] +#define ifpaddr info.rti_info[RTAX_IFP] +#define ifaaddr info.rti_info[RTAX_IFA] +#define brdaddr info.rti_info[RTAX_BRD] + +/* + * It really doesn't make any sense at all for this code to share much + * with raw_usrreq.c, since its functionality is so restricted. XXX + */ +static int +rts_abort(struct socket *so) +{ + int s, error; + s = splnet(); + error = raw_usrreqs.pru_abort(so); + splx(s); + return error; +} + +/* pru_accept is EOPNOTSUPP */ + +static int +rts_attach(struct socket *so, int proto, struct proc *p) +{ + struct rawcb *rp; + int s, error; + + if (sotorawcb(so) != 0) + return EISCONN; /* XXX panic? */ + MALLOC(rp, struct rawcb *, sizeof *rp, M_PCB, M_WAITOK); /* XXX */ + if (rp == 0) + return ENOBUFS; + bzero(rp, sizeof *rp); + + /* + * The splnet() is necessary to block protocols from sending + * error notifications (like RTM_REDIRECT or RTM_LOSING) while + * this PCB is extant but incompletely initialized. + * Probably we should try to do more of this work beforehand and + * eliminate the spl. + */ + s = splnet(); + so->so_pcb = (caddr_t)rp; + error = raw_usrreqs.pru_attach(so, proto, p); + rp = sotorawcb(so); + if (error) { + splx(s); + free(rp, M_PCB); + return error; + } + switch(rp->rcb_proto.sp_protocol) { + case AF_INET: + route_cb.ip_count++; + break; + case AF_INET6: + route_cb.ip6_count++; + break; + case AF_IPX: + route_cb.ipx_count++; + break; + case AF_NS: + route_cb.ns_count++; + break; + } + rp->rcb_faddr = &route_src; + route_cb.any_count++; + soisconnected(so); + so->so_options |= SO_USELOOPBACK; + splx(s); + return 0; +} + +static int +rts_bind(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + int s, error; + s = splnet(); + error = raw_usrreqs.pru_bind(so, nam, p); /* xxx just EINVAL */ + splx(s); + return error; +} + +static int +rts_connect(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + int s, error; + s = splnet(); + error = raw_usrreqs.pru_connect(so, nam, p); /* XXX just EINVAL */ + splx(s); + return error; +} + +/* pru_connect2 is EOPNOTSUPP */ +/* pru_control is EOPNOTSUPP */ + +static int +rts_detach(struct socket *so) +{ + struct rawcb *rp = sotorawcb(so); + int s, error; + + s = splnet(); + if (rp != 0) { + switch(rp->rcb_proto.sp_protocol) { + case AF_INET: + route_cb.ip_count--; + break; + case AF_INET6: + route_cb.ip6_count--; + break; + case AF_IPX: + route_cb.ipx_count--; + break; + case AF_NS: + route_cb.ns_count--; + break; + } + route_cb.any_count--; + } + error = raw_usrreqs.pru_detach(so); + splx(s); + return error; +} + +static int +rts_disconnect(struct socket *so) +{ + int s, error; + s = splnet(); + error = raw_usrreqs.pru_disconnect(so); + splx(s); + return error; +} + +/* pru_listen is EOPNOTSUPP */ + +static int +rts_peeraddr(struct socket *so, struct sockaddr **nam) +{ + int s, error; + s = splnet(); + error = raw_usrreqs.pru_peeraddr(so, nam); + splx(s); + return error; +} + +/* pru_rcvd is EOPNOTSUPP */ +/* pru_rcvoob is EOPNOTSUPP */ + +static int +rts_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, + struct mbuf *control, struct proc *p) +{ + int s, error; + s = splnet(); + error = raw_usrreqs.pru_send(so, flags, m, nam, control, p); + splx(s); + return error; +} + +/* pru_sense is null */ + +static int +rts_shutdown(struct socket *so) +{ + int s, error; + s = splnet(); + error = raw_usrreqs.pru_shutdown(so); + splx(s); + return error; +} + +static int +rts_sockaddr(struct socket *so, struct sockaddr **nam) +{ + int s, error; + s = splnet(); + error = raw_usrreqs.pru_sockaddr(so, nam); + splx(s); + return error; +} + +static struct pr_usrreqs route_usrreqs = { + rts_abort, pru_accept_notsupp, rts_attach, rts_bind, rts_connect, + pru_connect2_notsupp, pru_control_notsupp, rts_detach, rts_disconnect, + pru_listen_notsupp, rts_peeraddr, pru_rcvd_notsupp, pru_rcvoob_notsupp, + rts_send, pru_sense_null, rts_shutdown, rts_sockaddr, + sosend, soreceive, sopoll +}; + +/*ARGSUSED*/ +static int +route_output(m, so) + register struct mbuf *m; + struct socket *so; +{ + register struct rt_msghdr *rtm = 0; + register struct rtentry *rt = 0; + struct rtentry *saved_nrt = 0; + struct radix_node_head *rnh; + struct rt_addrinfo info; + int len, error = 0; + struct ifnet *ifp = 0; + struct ifaddr *ifa = 0; + +#define senderr(e) { error = e; goto flush;} + if (m == 0 || ((m->m_len < sizeof(long)) && + (m = m_pullup(m, sizeof(long))) == 0)) + return (ENOBUFS); + if ((m->m_flags & M_PKTHDR) == 0) + panic("route_output"); + len = m->m_pkthdr.len; + if (len < sizeof(*rtm) || + len != mtod(m, struct rt_msghdr *)->rtm_msglen) { + dst = 0; + senderr(EINVAL); + } + R_Malloc(rtm, struct rt_msghdr *, len); + if (rtm == 0) { + dst = 0; + senderr(ENOBUFS); + } + m_copydata(m, 0, len, (caddr_t)rtm); + if (rtm->rtm_version != RTM_VERSION) { + dst = 0; + senderr(EPROTONOSUPPORT); + } + rtm->rtm_pid = 0; + info.rti_addrs = rtm->rtm_addrs; + if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, &info)) { + dst = 0; + senderr(EINVAL); + } + if (dst == 0 || (dst->sa_family >= AF_MAX) + || (gate != 0 && (gate->sa_family >= AF_MAX))) + senderr(EINVAL); + if (genmask) { + struct radix_node *t; + t = rn_addmask((caddr_t)genmask, 0, 1); + if (t && genmask->sa_len >= ((struct sockaddr *)t->rn_key)->sa_len && + Bcmp((caddr_t *)genmask + 1, (caddr_t *)t->rn_key + 1, + ((struct sockaddr *)t->rn_key)->sa_len) - 1) + genmask = (struct sockaddr *)(t->rn_key); + else + senderr(ENOBUFS); + } + switch (rtm->rtm_type) { + + case RTM_ADD: + if (gate == 0) + senderr(EINVAL); + error = rtrequest(RTM_ADD, dst, gate, netmask, + rtm->rtm_flags, &saved_nrt); + if (error == 0 && saved_nrt) { + rt_setmetrics(rtm->rtm_inits, + &rtm->rtm_rmx, &saved_nrt->rt_rmx); + saved_nrt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); + saved_nrt->rt_rmx.rmx_locks |= + (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); + saved_nrt->rt_refcnt--; + saved_nrt->rt_genmask = genmask; + } + break; + + case RTM_DELETE: + error = rtrequest(RTM_DELETE, dst, gate, netmask, + rtm->rtm_flags, &saved_nrt); + if (error == 0) { + if ((rt = saved_nrt)) + rt->rt_refcnt++; + goto report; + } + break; + + case RTM_GET: + case RTM_CHANGE: + case RTM_LOCK: + if ((rnh = rt_tables[dst->sa_family]) == 0) { + senderr(EAFNOSUPPORT); + } else if ((rt = (struct rtentry *) + rnh->rnh_lookup(dst, netmask, rnh)) != NULL) + rt->rt_refcnt++; + else + senderr(ESRCH); + switch(rtm->rtm_type) { + + case RTM_GET: + report: + dst = rt_key(rt); + gate = rt->rt_gateway; + netmask = rt_mask(rt); + genmask = rt->rt_genmask; + if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { + ifp = rt->rt_ifp; + if (ifp) { + ifpaddr = ifp->if_addrhead.tqh_first->ifa_addr; + ifaaddr = rt->rt_ifa->ifa_addr; + rtm->rtm_index = ifp->if_index; + } else { + ifpaddr = 0; + ifaaddr = 0; + } + } + len = rt_msg2(rtm->rtm_type, &info, (caddr_t)0, + (struct walkarg *)0); + if (len > rtm->rtm_msglen) { + struct rt_msghdr *new_rtm; + R_Malloc(new_rtm, struct rt_msghdr *, len); + if (new_rtm == 0) + senderr(ENOBUFS); + Bcopy(rtm, new_rtm, rtm->rtm_msglen); + Free(rtm); rtm = new_rtm; + } + (void)rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm, + (struct walkarg *)0); + rtm->rtm_flags = rt->rt_flags; + rtm->rtm_rmx = rt->rt_rmx; + rtm->rtm_addrs = info.rti_addrs; + break; + + case RTM_CHANGE: + if (gate && (error = rt_setgate(rt, rt_key(rt), gate))) + senderr(error); + + /* + * If they tried to change things but didn't specify + * the required gateway, then just use the old one. + * This can happen if the user tries to change the + * flags on the default route without changing the + * default gateway. Changing flags still doesn't work. + */ + if ((rt->rt_flags & RTF_GATEWAY) && !gate) + gate = rt->rt_gateway; + + /* new gateway could require new ifaddr, ifp; + flags may also be different; ifp may be specified + by ll sockaddr when protocol address is ambiguous */ + if (ifpaddr && (ifa = ifa_ifwithnet(ifpaddr)) && + (ifp = ifa->ifa_ifp) && (ifaaddr || gate)) + ifa = ifaof_ifpforaddr(ifaaddr ? ifaaddr : gate, + ifp); + else if ((ifaaddr && (ifa = ifa_ifwithaddr(ifaaddr))) || + (gate && (ifa = ifa_ifwithroute(rt->rt_flags, + rt_key(rt), gate)))) + ifp = ifa->ifa_ifp; + if (ifa) { + register struct ifaddr *oifa = rt->rt_ifa; + if (oifa != ifa) { + if (oifa && oifa->ifa_rtrequest) + oifa->ifa_rtrequest(RTM_DELETE, + rt, gate); + IFAFREE(rt->rt_ifa); + rt->rt_ifa = ifa; + ifa->ifa_refcnt++; + rt->rt_ifp = ifp; + } + } + rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, + &rt->rt_rmx); + if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest) + rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, gate); + if (genmask) + rt->rt_genmask = genmask; + /* + * Fall into + */ + case RTM_LOCK: + rt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); + rt->rt_rmx.rmx_locks |= + (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); + break; + } + break; + + default: + senderr(EOPNOTSUPP); + } + +flush: + if (rtm) { + if (error) + rtm->rtm_errno = error; + else + rtm->rtm_flags |= RTF_DONE; + } + if (rt) + rtfree(rt); + { + register struct rawcb *rp = 0; + /* + * Check to see if we don't want our own messages. + */ + if ((so->so_options & SO_USELOOPBACK) == 0) { + if (route_cb.any_count <= 1) { + if (rtm) + Free(rtm); + m_freem(m); + return (error); + } + /* There is another listener, so construct message */ + rp = sotorawcb(so); + } + if (rtm) { + m_copyback(m, 0, rtm->rtm_msglen, (caddr_t)rtm); + if (m->m_pkthdr.len < rtm->rtm_msglen) { + m_freem(m); + m = NULL; + } else if (m->m_pkthdr.len > rtm->rtm_msglen) + m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len); + Free(rtm); + } + if (rp) + rp->rcb_proto.sp_family = 0; /* Avoid us */ + if (dst) + route_proto.sp_protocol = dst->sa_family; + if (m) + raw_input(m, &route_proto, &route_src, &route_dst); + if (rp) + rp->rcb_proto.sp_family = PF_ROUTE; + } + return (error); +} + +static void +rt_setmetrics(which, in, out) + u_long which; + register struct rt_metrics *in, *out; +{ +#define metric(f, e) if (which & (f)) out->e = in->e; + metric(RTV_RPIPE, rmx_recvpipe); + metric(RTV_SPIPE, rmx_sendpipe); + metric(RTV_SSTHRESH, rmx_ssthresh); + metric(RTV_RTT, rmx_rtt); + metric(RTV_RTTVAR, rmx_rttvar); + metric(RTV_HOPCOUNT, rmx_hopcount); + metric(RTV_MTU, rmx_mtu); + metric(RTV_EXPIRE, rmx_expire); +#undef metric +} + +#define ROUNDUP(a) \ + ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) +#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) + + +/* + * Extract the addresses of the passed sockaddrs. + * Do a little sanity checking so as to avoid bad memory references. + * This data is derived straight from userland. + */ +static int +rt_xaddrs(cp, cplim, rtinfo) + register caddr_t cp, cplim; + register struct rt_addrinfo *rtinfo; +{ + register struct sockaddr *sa; + register int i; + + bzero(rtinfo->rti_info, sizeof(rtinfo->rti_info)); + for (i = 0; (i < RTAX_MAX) && (cp < cplim); i++) { + if ((rtinfo->rti_addrs & (1 << i)) == 0) + continue; + sa = (struct sockaddr *)cp; + /* + * It won't fit. + */ + if ( (cp + sa->sa_len) > cplim ) { + return (EINVAL); + } + + /* + * there are no more.. quit now + * If there are more bits, they are in error. + * I've seen this. route(1) can evidently generate these. + * This causes kernel to core dump. + * for compatibility, If we see this, point to a safe address. + */ + if (sa->sa_len == 0) { + rtinfo->rti_info[i] = &sa_zero; + return (0); /* should be EINVAL but for compat */ + } + + /* accept it */ + rtinfo->rti_info[i] = sa; + ADVANCE(cp, sa); + } + return (0); +} + +static struct mbuf * +rt_msg1(type, rtinfo) + int type; + register struct rt_addrinfo *rtinfo; +{ + register struct rt_msghdr *rtm; + register struct mbuf *m; + register int i; + register struct sockaddr *sa; + int len, dlen; + + switch (type) { + + case RTM_DELADDR: + case RTM_NEWADDR: + len = sizeof(struct ifa_msghdr); + break; + + case RTM_DELMADDR: + case RTM_NEWMADDR: + len = sizeof(struct ifma_msghdr); + break; + + case RTM_IFINFO: + len = sizeof(struct if_msghdr); + break; + + default: + len = sizeof(struct rt_msghdr); + } + if (len > MCLBYTES) + panic("rt_msg1"); + m = m_gethdr(M_DONTWAIT, MT_DATA); + if (m && len > MHLEN) { + MCLGET(m, M_DONTWAIT); + if ((m->m_flags & M_EXT) == 0) { + m_free(m); + m = NULL; + } + } + if (m == 0) + return (m); + m->m_pkthdr.len = m->m_len = len; + m->m_pkthdr.rcvif = 0; + rtm = mtod(m, struct rt_msghdr *); + bzero((caddr_t)rtm, len); + for (i = 0; i < RTAX_MAX; i++) { + if ((sa = rtinfo->rti_info[i]) == NULL) + continue; + rtinfo->rti_addrs |= (1 << i); + dlen = ROUNDUP(sa->sa_len); + m_copyback(m, len, dlen, (caddr_t)sa); + len += dlen; + } + if (m->m_pkthdr.len != len) { + m_freem(m); + return (NULL); + } + rtm->rtm_msglen = len; + rtm->rtm_version = RTM_VERSION; + rtm->rtm_type = type; + return (m); +} + +static int +rt_msg2(type, rtinfo, cp, w) + int type; + register struct rt_addrinfo *rtinfo; + caddr_t cp; + struct walkarg *w; +{ + register int i; + int len, dlen, second_time = 0; + caddr_t cp0; + + rtinfo->rti_addrs = 0; +again: + switch (type) { + + case RTM_DELADDR: + case RTM_NEWADDR: + len = sizeof(struct ifa_msghdr); + break; + + case RTM_IFINFO: + len = sizeof(struct if_msghdr); + break; + + default: + len = sizeof(struct rt_msghdr); + } + cp0 = cp; + if (cp0) + cp += len; + for (i = 0; i < RTAX_MAX; i++) { + register struct sockaddr *sa; + + if ((sa = rtinfo->rti_info[i]) == 0) + continue; + rtinfo->rti_addrs |= (1 << i); + dlen = ROUNDUP(sa->sa_len); + if (cp) { + bcopy((caddr_t)sa, cp, (unsigned)dlen); + cp += dlen; + } + len += dlen; + } + if (cp == 0 && w != NULL && !second_time) { + register struct walkarg *rw = w; + + if (rw->w_req) { + if (rw->w_tmemsize < len) { + if (rw->w_tmem) + free(rw->w_tmem, M_RTABLE); + rw->w_tmem = (caddr_t) + malloc(len, M_RTABLE, M_NOWAIT); + if (rw->w_tmem) + rw->w_tmemsize = len; + } + if (rw->w_tmem) { + cp = rw->w_tmem; + second_time = 1; + goto again; + } + } + } + if (cp) { + register struct rt_msghdr *rtm = (struct rt_msghdr *)cp0; + + rtm->rtm_version = RTM_VERSION; + rtm->rtm_type = type; + rtm->rtm_msglen = len; + } + return (len); +} + +/* + * This routine is called to generate a message from the routing + * socket indicating that a redirect has occured, a routing lookup + * has failed, or that a protocol has detected timeouts to a particular + * destination. + */ +void +rt_missmsg(type, rtinfo, flags, error) + int type, flags, error; + register struct rt_addrinfo *rtinfo; +{ + register struct rt_msghdr *rtm; + register struct mbuf *m; + struct sockaddr *sa = rtinfo->rti_info[RTAX_DST]; + + if (route_cb.any_count == 0) + return; + m = rt_msg1(type, rtinfo); + if (m == 0) + return; + rtm = mtod(m, struct rt_msghdr *); + rtm->rtm_flags = RTF_DONE | flags; + rtm->rtm_errno = error; + rtm->rtm_addrs = rtinfo->rti_addrs; + route_proto.sp_protocol = sa ? sa->sa_family : 0; + raw_input(m, &route_proto, &route_src, &route_dst); +} + +/* + * This routine is called to generate a message from the routing + * socket indicating that the status of a network interface has changed. + */ +void +rt_ifmsg(ifp) + register struct ifnet *ifp; +{ + register struct if_msghdr *ifm; + struct mbuf *m; + struct rt_addrinfo info; + + if (route_cb.any_count == 0) + return; + bzero((caddr_t)&info, sizeof(info)); + m = rt_msg1(RTM_IFINFO, &info); + if (m == 0) + return; + ifm = mtod(m, struct if_msghdr *); + ifm->ifm_index = ifp->if_index; + ifm->ifm_flags = (u_short)ifp->if_flags; + ifm->ifm_data = ifp->if_data; + ifm->ifm_addrs = 0; + route_proto.sp_protocol = 0; + raw_input(m, &route_proto, &route_src, &route_dst); +} + +/* + * This is called to generate messages from the routing socket + * indicating a network interface has had addresses associated with it. + * if we ever reverse the logic and replace messages TO the routing + * socket indicate a request to configure interfaces, then it will + * be unnecessary as the routing socket will automatically generate + * copies of it. + */ +void +rt_newaddrmsg(cmd, ifa, error, rt) + int cmd, error; + register struct ifaddr *ifa; + register struct rtentry *rt; +{ + struct rt_addrinfo info; + struct sockaddr *sa = 0; + int pass; + struct mbuf *m = 0; + struct ifnet *ifp = ifa->ifa_ifp; + + if (route_cb.any_count == 0) + return; + for (pass = 1; pass < 3; pass++) { + bzero((caddr_t)&info, sizeof(info)); + if ((cmd == RTM_ADD && pass == 1) || + (cmd == RTM_DELETE && pass == 2)) { + register struct ifa_msghdr *ifam; + int ncmd = cmd == RTM_ADD ? RTM_NEWADDR : RTM_DELADDR; + + ifaaddr = sa = ifa->ifa_addr; + ifpaddr = ifp->if_addrhead.tqh_first->ifa_addr; + netmask = ifa->ifa_netmask; + brdaddr = ifa->ifa_dstaddr; + if ((m = rt_msg1(ncmd, &info)) == NULL) + continue; + ifam = mtod(m, struct ifa_msghdr *); + ifam->ifam_index = ifp->if_index; + ifam->ifam_metric = ifa->ifa_metric; + ifam->ifam_flags = ifa->ifa_flags; + ifam->ifam_addrs = info.rti_addrs; + } + if ((cmd == RTM_ADD && pass == 2) || + (cmd == RTM_DELETE && pass == 1)) { + register struct rt_msghdr *rtm; + + if (rt == 0) + continue; + netmask = rt_mask(rt); + dst = sa = rt_key(rt); + gate = rt->rt_gateway; + if ((m = rt_msg1(cmd, &info)) == NULL) + continue; + rtm = mtod(m, struct rt_msghdr *); + rtm->rtm_index = ifp->if_index; + rtm->rtm_flags |= rt->rt_flags; + rtm->rtm_errno = error; + rtm->rtm_addrs = info.rti_addrs; + } + route_proto.sp_protocol = sa ? sa->sa_family : 0; + raw_input(m, &route_proto, &route_src, &route_dst); + } +} + +/* + * This is the analogue to the rt_newaddrmsg which performs the same + * function but for multicast group memberhips. This is easier since + * there is no route state to worry about. + */ +void +rt_newmaddrmsg(cmd, ifma) + int cmd; + struct ifmultiaddr *ifma; +{ + struct rt_addrinfo info; + struct mbuf *m = 0; + struct ifnet *ifp = ifma->ifma_ifp; + struct ifma_msghdr *ifmam; + + if (route_cb.any_count == 0) + return; + + bzero((caddr_t)&info, sizeof(info)); + ifaaddr = ifma->ifma_addr; + if (ifp && ifp->if_addrhead.tqh_first) + ifpaddr = ifp->if_addrhead.tqh_first->ifa_addr; + else + ifpaddr = NULL; + /* + * If a link-layer address is present, present it as a ``gateway'' + * (similarly to how ARP entries, e.g., are presented). + */ + gate = ifma->ifma_lladdr; + if ((m = rt_msg1(cmd, &info)) == NULL) + return; + ifmam = mtod(m, struct ifma_msghdr *); + ifmam->ifmam_index = ifp->if_index; + ifmam->ifmam_addrs = info.rti_addrs; + route_proto.sp_protocol = ifma->ifma_addr->sa_family; + raw_input(m, &route_proto, &route_src, &route_dst); +} + +/* + * Definitions of protocols supported in the ROUTE domain. + */ + +extern struct domain routedomain; /* or at least forward */ + +static struct protosw routesw[] = { +{ SOCK_RAW, &routedomain, 0, PR_ATOMIC|PR_ADDR, + 0, route_output, raw_ctlinput, 0, + 0, + raw_init, 0, 0, 0, + &route_usrreqs +} +}; + +static struct domain routedomain = + { PF_ROUTE, "route", 0, 0, 0, + routesw, &routesw[sizeof(routesw)/sizeof(routesw[0])] }; + +DOMAIN_SET(route); diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/if_ether.c b/packages/net/bsd_tcpip/current/src/sys/netinet/if_ether.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/if_ether.c @@ -0,0 +1,815 @@ +//========================================================================== +// +// src/sys/netinet/if_ether.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)if_ether.c 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/if_ether.c,v 1.64.2.11 2001/07/25 17:27:56 jlemon Exp $ + */ + +/* + * Ethernet address resolution protocol. + * TODO: + * add "inuse/lock" bit (or ref. count) along with valid bit + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#ifdef BRIDGE +#include +#include +#endif + +#include +#include +#include + +#include + +#define SIN(s) ((struct sockaddr_in *)s) +#define SDL(s) ((struct sockaddr_dl *)s) + +/* timer values */ +static int arpt_prune = (5*60*1); /* walk list every 5 minutes */ +static int arpt_keep = (20*60); /* once resolved, good for 20 more minutes */ +static int arpt_down = 20; /* once declared down, don't send for 20 sec */ + +#define rt_expire rt_rmx.rmx_expire + +struct llinfo_arp { + LIST_ENTRY(llinfo_arp) la_le; + struct rtentry *la_rt; + struct mbuf *la_hold; /* last packet until resolved/timeout */ + long la_asked; /* last time we QUERIED for this addr */ +#define la_timer la_rt->rt_rmx.rmx_expire /* deletion time in seconds */ +}; + +static LIST_HEAD(, llinfo_arp) llinfo_arp; + +struct ifqueue arpintrq = {0, 0, 0, 50}; +static int arp_inuse, arp_allocated; + +static int arp_maxtries = 5; +static int useloopback = 1; /* use loopback interface for local traffic */ +static int arp_proxyall = 0; + +static void arp_rtrequest __P((int, struct rtentry *, struct sockaddr *)); +static void arprequest __P((struct arpcom *, + struct in_addr *, struct in_addr *, u_char *)); +static void arpintr __P((void)); +static void arptfree __P((struct llinfo_arp *)); +static void arptimer __P((void *)); +static struct llinfo_arp + *arplookup __P((u_long, int, int)); +#ifdef INET +static void in_arpinput __P((struct mbuf *)); +#endif + +/* + * Timeout routine. Age arp_tab entries periodically. + */ +/* ARGSUSED */ +static void +arptimer(ignored_arg) + void *ignored_arg; +{ + int s = splnet(); + register struct llinfo_arp *la = llinfo_arp.lh_first; + struct llinfo_arp *ola; + + timeout(arptimer, (caddr_t)0, arpt_prune * hz); + while ((ola = la) != 0) { + register struct rtentry *rt = la->la_rt; + la = la->la_le.le_next; + if (rt->rt_expire && rt->rt_expire <= time_second) + arptfree(ola); /* timer has expired, clear */ + } + splx(s); +} + +/* + * Parallel to llc_rtrequest. + */ +static void +arp_rtrequest(req, rt, sa) + int req; + register struct rtentry *rt; + struct sockaddr *sa; +{ + register struct sockaddr *gate = rt->rt_gateway; + register struct llinfo_arp *la = (struct llinfo_arp *)rt->rt_llinfo; + static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; + static int arpinit_done; + + if (!arpinit_done) { + arpinit_done = 1; + LIST_INIT(&llinfo_arp); + timeout(arptimer, (caddr_t)0, hz); + register_netisr(NETISR_ARP, arpintr); + } + if (rt->rt_flags & RTF_GATEWAY) + return; + switch (req) { + + case RTM_ADD: + /* + * XXX: If this is a manually added route to interface + * such as older version of routed or gated might provide, + * restore cloning bit. + */ + if ((rt->rt_flags & RTF_HOST) == 0 && + SIN(rt_mask(rt))->sin_addr.s_addr != 0xffffffff) + rt->rt_flags |= RTF_CLONING; + if (rt->rt_flags & RTF_CLONING) { + /* + * Case 1: This route should come from a route to iface. + */ + rt_setgate(rt, rt_key(rt), + (struct sockaddr *)&null_sdl); + gate = rt->rt_gateway; + SDL(gate)->sdl_type = rt->rt_ifp->if_type; + SDL(gate)->sdl_index = rt->rt_ifp->if_index; + rt->rt_expire = time_second; + break; + } + /* Announce a new entry if requested. */ + if (rt->rt_flags & RTF_ANNOUNCE) + arprequest((struct arpcom *)rt->rt_ifp, + &SIN(rt_key(rt))->sin_addr, + &SIN(rt_key(rt))->sin_addr, + (u_char *)LLADDR(SDL(gate))); + /*FALLTHROUGH*/ + case RTM_RESOLVE: + if (gate->sa_family != AF_LINK || + gate->sa_len < sizeof(null_sdl)) { + log(LOG_DEBUG, "arp_rtrequest: bad gateway value\n"); + break; + } + SDL(gate)->sdl_type = rt->rt_ifp->if_type; + SDL(gate)->sdl_index = rt->rt_ifp->if_index; + if (la != 0) + break; /* This happens on a route change */ + /* + * Case 2: This route may come from cloning, or a manual route + * add with a LL address. + */ + R_Malloc(la, struct llinfo_arp *, sizeof(*la)); + rt->rt_llinfo = (caddr_t)la; + if (la == 0) { + log(LOG_DEBUG, "arp_rtrequest: malloc failed\n"); + break; + } + arp_inuse++, arp_allocated++; + Bzero(la, sizeof(*la)); + la->la_rt = rt; + rt->rt_flags |= RTF_LLINFO; + LIST_INSERT_HEAD(&llinfo_arp, la, la_le); + +#ifdef INET + /* + * This keeps the multicast addresses from showing up + * in `arp -a' listings as unresolved. It's not actually + * functional. Then the same for broadcast. + */ + if (IN_MULTICAST(ntohl(SIN(rt_key(rt))->sin_addr.s_addr))) { + ETHER_MAP_IP_MULTICAST(&SIN(rt_key(rt))->sin_addr, + LLADDR(SDL(gate))); + SDL(gate)->sdl_alen = 6; + rt->rt_expire = 0; + } + if (in_broadcast(SIN(rt_key(rt))->sin_addr, rt->rt_ifp)) { + memcpy(LLADDR(SDL(gate)), etherbroadcastaddr, 6); + SDL(gate)->sdl_alen = 6; + rt->rt_expire = 0; + } +#endif + + if (SIN(rt_key(rt))->sin_addr.s_addr == + (IA_SIN(rt->rt_ifa))->sin_addr.s_addr) { + /* + * This test used to be + * if (loif.if_flags & IFF_UP) + * It allowed local traffic to be forced + * through the hardware by configuring the loopback down. + * However, it causes problems during network configuration + * for boards that can't receive packets they send. + * It is now necessary to clear "useloopback" and remove + * the route to force traffic out to the hardware. + */ + rt->rt_expire = 0; + Bcopy(((struct arpcom *)rt->rt_ifp)->ac_enaddr, + LLADDR(SDL(gate)), SDL(gate)->sdl_alen = 6); + if (useloopback) + rt->rt_ifp = loif; + + } + break; + + case RTM_DELETE: + if (la == 0) + break; + arp_inuse--; + LIST_REMOVE(la, la_le); + rt->rt_llinfo = 0; + rt->rt_flags &= ~RTF_LLINFO; + if (la->la_hold) + m_freem(la->la_hold); + Free((caddr_t)la); + } +} + +/* + * Broadcast an ARP request. Caller specifies: + * - arp header source ip address + * - arp header target ip address + * - arp header source ethernet address + */ +static void +arprequest(ac, sip, tip, enaddr) + register struct arpcom *ac; + register struct in_addr *sip, *tip; + register u_char *enaddr; +{ + register struct mbuf *m; + register struct ether_header *eh; + register struct ether_arp *ea; + struct sockaddr sa; + static u_char llcx[] = { 0x82, 0x40, LLC_SNAP_LSAP, LLC_SNAP_LSAP, + LLC_UI, 0x00, 0x00, 0x00, 0x08, 0x06 }; + + if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) + return; + m->m_pkthdr.rcvif = (struct ifnet *)0; + switch (ac->ac_if.if_type) { + case IFT_ISO88025: + m->m_len = sizeof(*ea) + sizeof(llcx); + m->m_pkthdr.len = sizeof(*ea) + sizeof(llcx); + MH_ALIGN(m, sizeof(*ea) + sizeof(llcx)); + (void)memcpy(mtod(m, caddr_t), llcx, sizeof(llcx)); + (void)memcpy(sa.sa_data, etherbroadcastaddr, 6); + (void)memcpy(sa.sa_data + 6, enaddr, 6); + sa.sa_data[6] |= TR_RII; + sa.sa_data[12] = TR_AC; + sa.sa_data[13] = TR_LLC_FRAME; + ea = (struct ether_arp *)(mtod(m, char *) + sizeof(llcx)); + bzero((caddr_t)ea, sizeof (*ea)); + ea->arp_hrd = htons(ARPHRD_IEEE802); + break; + case IFT_FDDI: + case IFT_ETHER: + /* + * This may not be correct for types not explicitly + * listed, but this is our best guess + */ + default: + m->m_len = sizeof(*ea); + m->m_pkthdr.len = sizeof(*ea); + MH_ALIGN(m, sizeof(*ea)); + ea = mtod(m, struct ether_arp *); + eh = (struct ether_header *)sa.sa_data; + bzero((caddr_t)ea, sizeof (*ea)); + /* if_output will not swap */ + eh->ether_type = htons(ETHERTYPE_ARP); + (void)memcpy(eh->ether_dhost, etherbroadcastaddr, + sizeof(eh->ether_dhost)); + ea->arp_hrd = htons(ARPHRD_ETHER); + break; + } + ea->arp_pro = htons(ETHERTYPE_IP); + ea->arp_hln = sizeof(ea->arp_sha); /* hardware address length */ + ea->arp_pln = sizeof(ea->arp_spa); /* protocol address length */ + ea->arp_op = htons(ARPOP_REQUEST); + (void)memcpy(ea->arp_sha, enaddr, sizeof(ea->arp_sha)); + (void)memcpy(ea->arp_spa, sip, sizeof(ea->arp_spa)); + (void)memcpy(ea->arp_tpa, tip, sizeof(ea->arp_tpa)); + sa.sa_family = AF_UNSPEC; + sa.sa_len = sizeof(sa); + (*ac->ac_if.if_output)(&ac->ac_if, m, &sa, (struct rtentry *)0); +} + +/* + * Resolve an IP address into an ethernet address. If success, + * desten is filled in. If there is no entry in arptab, + * set one up and broadcast a request for the IP address. + * Hold onto this mbuf and resend it once the address + * is finally resolved. A return value of 1 indicates + * that desten has been filled in and the packet should be sent + * normally; a 0 return indicates that the packet has been + * taken over here, either now or for later transmission. + */ +int +arpresolve(ac, rt, m, dst, desten, rt0) + register struct arpcom *ac; + register struct rtentry *rt; + struct mbuf *m; + register struct sockaddr *dst; + register u_char *desten; + struct rtentry *rt0; +{ + struct llinfo_arp *la = 0; + struct sockaddr_dl *sdl; + + if (m->m_flags & M_BCAST) { /* broadcast */ + (void)memcpy(desten, etherbroadcastaddr, sizeof(etherbroadcastaddr)); + return (1); + } + if (m->m_flags & M_MCAST) { /* multicast */ + ETHER_MAP_IP_MULTICAST(&SIN(dst)->sin_addr, desten); + return(1); + } + if (rt) + la = (struct llinfo_arp *)rt->rt_llinfo; + if (la == 0) { + la = arplookup(SIN(dst)->sin_addr.s_addr, 1, 0); + if (la) + rt = la->la_rt; + } + if (la == 0 || rt == 0) { + log(LOG_DEBUG, "arpresolve: can't allocate llinfo for %s%s%s\n", + inet_ntoa(SIN(dst)->sin_addr), la ? "la" : "", + rt ? "rt" : ""); + m_freem(m); + return (0); + } + sdl = SDL(rt->rt_gateway); + /* + * Check the address family and length is valid, the address + * is resolved; otherwise, try to resolve. + */ + if ((rt->rt_expire == 0 || rt->rt_expire > time_second) && + sdl->sdl_family == AF_LINK && sdl->sdl_alen != 0) { + bcopy(LLADDR(sdl), desten, sdl->sdl_alen); + return 1; + } + /* + * If ARP is disabled on this interface, stop. + * XXX + * Probably should not allocate empty llinfo struct if we are + * not going to be sending out an arp request. + */ + if (ac->ac_if.if_flags & IFF_NOARP) + return (0); + /* + * There is an arptab entry, but no ethernet address + * response yet. Replace the held mbuf with this + * latest one. + */ + if (la->la_hold) + m_freem(la->la_hold); + la->la_hold = m; + if (rt->rt_expire) { + rt->rt_flags &= ~RTF_REJECT; + if (la->la_asked == 0 || rt->rt_expire != time_second) { + rt->rt_expire = time_second; + if (la->la_asked++ < arp_maxtries) + arprequest(ac, + &SIN(rt->rt_ifa->ifa_addr)->sin_addr, + &SIN(dst)->sin_addr, ac->ac_enaddr); + else { + rt->rt_flags |= RTF_REJECT; + rt->rt_expire += arpt_down; + la->la_asked = 0; + } + + } + } + return (0); +} + +/* + * Common length and type checks are done here, + * then the protocol-specific routine is called. + */ +static void +arpintr() +{ + register struct mbuf *m; + register struct arphdr *ar; + int s; + + while (arpintrq.ifq_head) { + s = splimp(); + IF_DEQUEUE(&arpintrq, m); + splx(s); + if (m == 0 || (m->m_flags & M_PKTHDR) == 0) + panic("arpintr"); + + if (m->m_len < sizeof(struct arphdr) && + ((m = m_pullup(m, sizeof(struct arphdr))) == NULL)) { + log(LOG_ERR, "arp: runt packet -- m_pullup failed\n"); + continue; + } + ar = mtod(m, struct arphdr *); + + if (ntohs(ar->ar_hrd) != ARPHRD_ETHER + && ntohs(ar->ar_hrd) != ARPHRD_IEEE802) { + log(LOG_ERR, + "arp: unknown hardware address format (0x%2D)\n", + (unsigned char *)&ar->ar_hrd, ""); + m_freem(m); + continue; + } + + if (m->m_pkthdr.len < sizeof(struct arphdr) + 2 * ar->ar_hln + + 2 * ar->ar_pln) { + log(LOG_ERR, "arp: runt packet\n"); + m_freem(m); + continue; + } + + switch (ntohs(ar->ar_pro)) { +#ifdef INET + case ETHERTYPE_IP: + in_arpinput(m); + continue; +#endif + } + m_freem(m); + } +} + +#ifdef INET +/* + * ARP for Internet protocols on 10 Mb/s Ethernet. + * Algorithm is that given in RFC 826. + * In addition, a sanity check is performed on the sender + * protocol address, to catch impersonators. + * We no longer handle negotiations for use of trailer protocol: + * Formerly, ARP replied for protocol type ETHERTYPE_TRAIL sent + * along with IP replies if we wanted trailers sent to us, + * and also sent them in response to IP replies. + * This allowed either end to announce the desire to receive + * trailer packets. + * We no longer reply to requests for ETHERTYPE_TRAIL protocol either, + * but formerly didn't normally send requests. + */ +static int log_arp_wrong_iface = 1; + +//SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_wrong_iface, CTLFLAG_RW, +// &log_arp_wrong_iface, 0, +// "log arp packets arriving on the wrong interface"); + +static void +in_arpinput(m) + struct mbuf *m; +{ + register struct ether_arp *ea; + register struct arpcom *ac = (struct arpcom *)m->m_pkthdr.rcvif; + struct ether_header *eh; + struct iso88025_header *th = (struct iso88025_header *)0; + register struct llinfo_arp *la = 0; + register struct rtentry *rt; + struct in_ifaddr *ia, *maybe_ia = 0; + struct sockaddr_dl *sdl; + struct sockaddr sa; + struct in_addr isaddr, itaddr, myaddr; + int op, rif_len; + + if (m->m_len < sizeof(struct ether_arp) && + (m = m_pullup(m, sizeof(struct ether_arp))) == NULL) { + log(LOG_ERR, "in_arp: runt packet -- m_pullup failed\n"); + return; + } + + ea = mtod(m, struct ether_arp *); + op = ntohs(ea->arp_op); + (void)memcpy(&isaddr, ea->arp_spa, sizeof (isaddr)); + (void)memcpy(&itaddr, ea->arp_tpa, sizeof (itaddr)); + for (ia = in_ifaddrhead.tqh_first; ia; ia = ia->ia_link.tqe_next) { + /* + * For a bridge, we want to check the address irrespective + * of the receive interface. (This will change slightly + * when we have clusters of interfaces). + */ +#ifdef BRIDGE +#define BRIDGE_TEST (do_bridge) +#else +#define BRIDGE_TEST (0) /* cc will optimise the test away */ +#endif + if ((BRIDGE_TEST) || (ia->ia_ifp == &ac->ac_if)) { + maybe_ia = ia; + if ((itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) || + (isaddr.s_addr == ia->ia_addr.sin_addr.s_addr)) { + break; + } + } + } + if (maybe_ia == 0) { + m_freem(m); + return; + } + myaddr = ia ? ia->ia_addr.sin_addr : maybe_ia->ia_addr.sin_addr; + if (!bcmp((caddr_t)ea->arp_sha, (caddr_t)ac->ac_enaddr, + sizeof (ea->arp_sha))) { + m_freem(m); /* it's from me, ignore it. */ + return; + } + if (!bcmp((caddr_t)ea->arp_sha, (caddr_t)etherbroadcastaddr, + sizeof (ea->arp_sha))) { + log(LOG_ERR, + "arp: ether address is broadcast for IP address %s!\n", + inet_ntoa(isaddr)); + m_freem(m); + return; + } + if (isaddr.s_addr == myaddr.s_addr) { + log(LOG_ERR, + "arp: %6D is using my IP address %s!\n", + ea->arp_sha, ":", inet_ntoa(isaddr)); + itaddr = myaddr; + goto reply; + } + la = arplookup(isaddr.s_addr, itaddr.s_addr == myaddr.s_addr, 0); + if (la && (rt = la->la_rt) && (sdl = SDL(rt->rt_gateway))) { + /* the following is not an error when doing bridging */ + if (!BRIDGE_TEST && rt->rt_ifp != &ac->ac_if) { + if (log_arp_wrong_iface) + log(LOG_ERR, "arp: %s is on %s%d but got reply from %6D on %s%d\n", + inet_ntoa(isaddr), + rt->rt_ifp->if_name, rt->rt_ifp->if_unit, + ea->arp_sha, ":", + ac->ac_if.if_name, ac->ac_if.if_unit); + goto reply; + } + if (sdl->sdl_alen && + bcmp((caddr_t)ea->arp_sha, LLADDR(sdl), sdl->sdl_alen)) { + if (rt->rt_expire) + log(LOG_INFO, "arp: %s moved from %6D to %6D on %s%d\n", + inet_ntoa(isaddr), (u_char *)LLADDR(sdl), ":", + ea->arp_sha, ":", + ac->ac_if.if_name, ac->ac_if.if_unit); + else { + log(LOG_ERR, + "arp: %6D attempts to modify permanent entry for %s on %s%d\n", + ea->arp_sha, ":", inet_ntoa(isaddr), + ac->ac_if.if_name, ac->ac_if.if_unit); + goto reply; + } + } + (void)memcpy(LLADDR(sdl), ea->arp_sha, sizeof(ea->arp_sha)); + sdl->sdl_alen = sizeof(ea->arp_sha); + sdl->sdl_rcf = (u_short)0; + /* + * If we receive an arp from a token-ring station over + * a token-ring nic then try to save the source + * routing info. + */ + if (ac->ac_if.if_type == IFT_ISO88025) { + th = (struct iso88025_header *)m->m_pkthdr.header; + rif_len = TR_RCF_RIFLEN(th->rcf); + if ((th->iso88025_shost[0] & TR_RII) && + (rif_len > 2)) { + sdl->sdl_rcf = th->rcf; + sdl->sdl_rcf ^= htons(TR_RCF_DIR); + memcpy(sdl->sdl_route, th->rd, rif_len - 2); + sdl->sdl_rcf &= ~htons(TR_RCF_BCST_MASK); + /* + * Set up source routing information for + * reply packet (XXX) + */ + m->m_data -= rif_len; + m->m_len += rif_len; + m->m_pkthdr.len += rif_len; + } else { + th->iso88025_shost[0] &= ~TR_RII; + } + m->m_data -= 8; + m->m_len += 8; + m->m_pkthdr.len += 8; + th->rcf = sdl->sdl_rcf; + } else { + sdl->sdl_rcf = (u_short)0; + } + if (rt->rt_expire) + rt->rt_expire = time_second + arpt_keep; + rt->rt_flags &= ~RTF_REJECT; + la->la_asked = 0; + if (la->la_hold) { + (*ac->ac_if.if_output)(&ac->ac_if, la->la_hold, + rt_key(rt), rt); + la->la_hold = 0; + } + } +reply: + if (op != ARPOP_REQUEST) { + m_freem(m); + return; + } + if (itaddr.s_addr == myaddr.s_addr) { + /* I am the target */ + (void)memcpy(ea->arp_tha, ea->arp_sha, sizeof(ea->arp_sha)); + (void)memcpy(ea->arp_sha, ac->ac_enaddr, sizeof(ea->arp_sha)); + } else { + la = arplookup(itaddr.s_addr, 0, SIN_PROXY); + if (la == NULL) { + struct sockaddr_in sin; + + if (!arp_proxyall) { + m_freem(m); + return; + } + + bzero(&sin, sizeof sin); + sin.sin_family = AF_INET; + sin.sin_len = sizeof sin; + sin.sin_addr = itaddr; + + rt = rtalloc1((struct sockaddr *)&sin, 0, 0UL); + if (!rt) { + m_freem(m); + return; + } + /* + * Don't send proxies for nodes on the same interface + * as this one came out of, or we'll get into a fight + * over who claims what Ether address. + */ + if (rt->rt_ifp == &ac->ac_if) { + rtfree(rt); + m_freem(m); + return; + } + (void)memcpy(ea->arp_tha, ea->arp_sha, sizeof(ea->arp_sha)); + (void)memcpy(ea->arp_sha, ac->ac_enaddr, sizeof(ea->arp_sha)); + rtfree(rt); +#ifdef DEBUG_PROXY + printf("arp: proxying for %s\n", + inet_ntoa(itaddr)); +#endif + } else { + rt = la->la_rt; + (void)memcpy(ea->arp_tha, ea->arp_sha, sizeof(ea->arp_sha)); + sdl = SDL(rt->rt_gateway); + (void)memcpy(ea->arp_sha, LLADDR(sdl), sizeof(ea->arp_sha)); + } + } + + (void)memcpy(ea->arp_tpa, ea->arp_spa, sizeof(ea->arp_spa)); + (void)memcpy(ea->arp_spa, &itaddr, sizeof(ea->arp_spa)); + ea->arp_op = htons(ARPOP_REPLY); + ea->arp_pro = htons(ETHERTYPE_IP); /* let's be sure! */ + switch (ac->ac_if.if_type) { + case IFT_ISO88025: + /* Re-arrange the source/dest address */ + memcpy(th->iso88025_dhost, th->iso88025_shost, + sizeof(th->iso88025_dhost)); + memcpy(th->iso88025_shost, ac->ac_enaddr, + sizeof(th->iso88025_shost)); + /* Set the source routing bit if neccesary */ + if (th->iso88025_dhost[0] & TR_RII) { + th->iso88025_dhost[0] &= ~TR_RII; + if (TR_RCF_RIFLEN(th->rcf) > 2) + th->iso88025_shost[0] |= TR_RII; + } + /* Copy the addresses, ac and fc into sa_data */ + memcpy(sa.sa_data, th->iso88025_dhost, + sizeof(th->iso88025_dhost) * 2); + sa.sa_data[(sizeof(th->iso88025_dhost) * 2)] = TR_AC; + sa.sa_data[(sizeof(th->iso88025_dhost) * 2) + 1] = TR_LLC_FRAME; + break; + case IFT_ETHER: + case IFT_FDDI: + /* + * May not be correct for types not explictly + * listed, but it is our best guess. + */ + default: + eh = (struct ether_header *)sa.sa_data; + (void)memcpy(eh->ether_dhost, ea->arp_tha, + sizeof(eh->ether_dhost)); + eh->ether_type = htons(ETHERTYPE_ARP); + break; + } + sa.sa_family = AF_UNSPEC; + sa.sa_len = sizeof(sa); + (*ac->ac_if.if_output)(&ac->ac_if, m, &sa, (struct rtentry *)0); + return; +} +#endif + +/* + * Free an arp entry. + */ +static void +arptfree(la) + register struct llinfo_arp *la; +{ + register struct rtentry *rt = la->la_rt; + register struct sockaddr_dl *sdl; + if (rt == 0) + panic("arptfree"); + if (rt->rt_refcnt > 0 && (sdl = SDL(rt->rt_gateway)) && + sdl->sdl_family == AF_LINK) { + sdl->sdl_alen = 0; + la->la_asked = 0; + rt->rt_flags &= ~RTF_REJECT; + return; + } + rtrequest(RTM_DELETE, rt_key(rt), (struct sockaddr *)0, rt_mask(rt), + 0, (struct rtentry **)0); +} +/* + * Lookup or enter a new address in arptab. + */ +static struct llinfo_arp * +arplookup(addr, create, proxy) + u_long addr; + int create, proxy; +{ + register struct rtentry *rt; + static struct sockaddr_inarp sin = {sizeof(sin), AF_INET }; + const char *why = 0; + + sin.sin_addr.s_addr = addr; + sin.sin_other = proxy ? SIN_PROXY : 0; + rt = rtalloc1((struct sockaddr *)&sin, create, 0UL); + if (rt == 0) + return (0); + rt->rt_refcnt--; + + if (rt->rt_flags & RTF_GATEWAY) + why = "host is not on local network"; + else if ((rt->rt_flags & RTF_LLINFO) == 0) + why = "could not allocate llinfo"; + else if (rt->rt_gateway->sa_family != AF_LINK) + why = "gateway route is not ours"; + + if (why && create) { + log(LOG_DEBUG, "arplookup %s failed: %s\n", + inet_ntoa(sin.sin_addr), why); + return 0; + } else if (why) { + return 0; + } + return ((struct llinfo_arp *)rt->rt_llinfo); +} + +void +arp_ifinit(ac, ifa) + struct arpcom *ac; + struct ifaddr *ifa; +{ + if (ntohl(IA_SIN(ifa)->sin_addr.s_addr) != INADDR_ANY) + arprequest(ac, &IA_SIN(ifa)->sin_addr, + &IA_SIN(ifa)->sin_addr, ac->ac_enaddr); + ifa->ifa_rtrequest = arp_rtrequest; + ifa->ifa_flags |= RTF_CLONING; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/igmp.c b/packages/net/bsd_tcpip/current/src/sys/netinet/igmp.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/igmp.c @@ -0,0 +1,498 @@ +//========================================================================== +// +// src/sys/netinet/igmp.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)igmp.c 8.1 (Berkeley) 7/19/93 + * $FreeBSD: src/sys/netinet/igmp.c,v 1.29 1999/12/22 19:13:17 shin Exp $ + */ + +/* + * Internet Group Management Protocol (IGMP) routines. + * + * Written by Steve Deering, Stanford, May 1988. + * Modified by Rosen Sharma, Stanford, Aug 1994. + * Modified by Bill Fenner, Xerox PARC, Feb 1995. + * Modified to fully comply to IGMPv2 by Bill Fenner, Oct 1995. + * + * MULTICAST Revision: 3.5.1.4 + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static struct router_info * + find_rti __P((struct ifnet *ifp)); + +static struct igmpstat igmpstat; + +static int igmp_timers_are_running; +static u_long igmp_all_hosts_group; +static u_long igmp_all_rtrs_group; +static struct mbuf *router_alert; +static struct router_info *Head; + +static void igmp_sendpkt __P((struct in_multi *, int, unsigned long)); + +void +igmp_init() +{ + struct ipoption *ra; + + /* + * To avoid byte-swapping the same value over and over again. + */ + igmp_all_hosts_group = htonl(INADDR_ALLHOSTS_GROUP); + igmp_all_rtrs_group = htonl(INADDR_ALLRTRS_GROUP); + + igmp_timers_are_running = 0; + + /* + * Construct a Router Alert option to use in outgoing packets + */ + MGET(router_alert, M_DONTWAIT, MT_DATA); + ra = mtod(router_alert, struct ipoption *); + ra->ipopt_dst.s_addr = 0; + ra->ipopt_list[0] = IPOPT_RA; /* Router Alert Option */ + ra->ipopt_list[1] = 0x04; /* 4 bytes long */ + ra->ipopt_list[2] = 0x00; + ra->ipopt_list[3] = 0x00; + router_alert->m_len = sizeof(ra->ipopt_dst) + ra->ipopt_list[1]; + + Head = (struct router_info *) 0; +} + +static struct router_info * +find_rti(ifp) + struct ifnet *ifp; +{ + register struct router_info *rti = Head; + +#ifdef IGMP_DEBUG + printf("[igmp.c, _find_rti] --> entering \n"); +#endif + while (rti) { + if (rti->rti_ifp == ifp) { +#ifdef IGMP_DEBUG + printf("[igmp.c, _find_rti] --> found old entry \n"); +#endif + return rti; + } + rti = rti->rti_next; + } + MALLOC(rti, struct router_info *, sizeof *rti, M_IGMP, M_NOWAIT); + rti->rti_ifp = ifp; + rti->rti_type = IGMP_V2_ROUTER; + rti->rti_time = 0; + rti->rti_next = Head; + Head = rti; +#ifdef IGMP_DEBUG + printf("[igmp.c, _find_rti] --> created an entry \n"); +#endif + return rti; +} + +void +igmp_input(m, off) + register struct mbuf *m; + int off; +{ + register int iphlen = off; + register struct igmp *igmp; + register struct ip *ip; + register int igmplen; + register struct ifnet *ifp = m->m_pkthdr.rcvif; + register int minlen; + register struct in_multi *inm; + register struct in_ifaddr *ia; + struct in_multistep step; + struct router_info *rti; + + int timer; /** timer value in the igmp query header **/ + + ++igmpstat.igps_rcv_total; + + ip = mtod(m, struct ip *); + igmplen = ip->ip_len; + + /* + * Validate lengths + */ + if (igmplen < IGMP_MINLEN) { + ++igmpstat.igps_rcv_tooshort; + m_freem(m); + return; + } + minlen = iphlen + IGMP_MINLEN; + if ((m->m_flags & M_EXT || m->m_len < minlen) && + (m = m_pullup(m, minlen)) == 0) { + ++igmpstat.igps_rcv_tooshort; + return; + } + + /* + * Validate checksum + */ + m->m_data += iphlen; + m->m_len -= iphlen; + igmp = mtod(m, struct igmp *); + if (in_cksum(m, igmplen)) { + ++igmpstat.igps_rcv_badsum; + m_freem(m); + return; + } + m->m_data -= iphlen; + m->m_len += iphlen; + + ip = mtod(m, struct ip *); + timer = igmp->igmp_code * PR_FASTHZ / IGMP_TIMER_SCALE; + if (timer == 0) + timer = 1; + rti = find_rti(ifp); + + /* + * In the IGMPv2 specification, there are 3 states and a flag. + * + * In Non-Member state, we simply don't have a membership record. + * In Delaying Member state, our timer is running (inm->inm_timer) + * In Idle Member state, our timer is not running (inm->inm_timer==0) + * + * The flag is inm->inm_state, it is set to IGMP_OTHERMEMBER if + * we have heard a report from another member, or IGMP_IREPORTEDLAST + * if I sent the last report. + */ + switch (igmp->igmp_type) { + + case IGMP_MEMBERSHIP_QUERY: + ++igmpstat.igps_rcv_queries; + + if (ifp->if_flags & IFF_LOOPBACK) + break; + + if (igmp->igmp_code == 0) { + /* + * Old router. Remember that the querier on this + * interface is old, and set the timer to the + * value in RFC 1112. + */ + + rti->rti_type = IGMP_V1_ROUTER; + rti->rti_time = 0; + + timer = IGMP_MAX_HOST_REPORT_DELAY * PR_FASTHZ; + + if (ip->ip_dst.s_addr != igmp_all_hosts_group || + igmp->igmp_group.s_addr != 0) { + ++igmpstat.igps_rcv_badqueries; + m_freem(m); + return; + } + } else { + /* + * New router. Simply do the new validity check. + */ + + if (igmp->igmp_group.s_addr != 0 && + !IN_MULTICAST(ntohl(igmp->igmp_group.s_addr))) { + ++igmpstat.igps_rcv_badqueries; + m_freem(m); + return; + } + } + + /* + * - Start the timers in all of our membership records + * that the query applies to for the interface on + * which the query arrived excl. those that belong + * to the "all-hosts" group (224.0.0.1). + * - Restart any timer that is already running but has + * a value longer than the requested timeout. + * - Use the value specified in the query message as + * the maximum timeout. + */ + IN_FIRST_MULTI(step, inm); + while (inm != NULL) { + if (inm->inm_ifp == ifp && + inm->inm_addr.s_addr != igmp_all_hosts_group && + (igmp->igmp_group.s_addr == 0 || + igmp->igmp_group.s_addr == inm->inm_addr.s_addr)) { + if (inm->inm_timer == 0 || + inm->inm_timer > timer) { + inm->inm_timer = + IGMP_RANDOM_DELAY(timer); + igmp_timers_are_running = 1; + } + } + IN_NEXT_MULTI(step, inm); + } + + break; + + case IGMP_V1_MEMBERSHIP_REPORT: + case IGMP_V2_MEMBERSHIP_REPORT: + /* + * For fast leave to work, we have to know that we are the + * last person to send a report for this group. Reports + * can potentially get looped back if we are a multicast + * router, so discard reports sourced by me. + */ + IFP_TO_IA(ifp, ia); + if (ia && ip->ip_src.s_addr == IA_SIN(ia)->sin_addr.s_addr) + break; + + ++igmpstat.igps_rcv_reports; + + if (ifp->if_flags & IFF_LOOPBACK) + break; + + if (!IN_MULTICAST(ntohl(igmp->igmp_group.s_addr))) { + ++igmpstat.igps_rcv_badreports; + m_freem(m); + return; + } + + /* + * KLUDGE: if the IP source address of the report has an + * unspecified (i.e., zero) subnet number, as is allowed for + * a booting host, replace it with the correct subnet number + * so that a process-level multicast routing demon can + * determine which subnet it arrived from. This is necessary + * to compensate for the lack of any way for a process to + * determine the arrival interface of an incoming packet. + */ + if ((ntohl(ip->ip_src.s_addr) & IN_CLASSA_NET) == 0) + if (ia) ip->ip_src.s_addr = htonl(ia->ia_subnet); + + /* + * If we belong to the group being reported, stop + * our timer for that group. + */ + IN_LOOKUP_MULTI(igmp->igmp_group, ifp, inm); + + if (inm != NULL) { + inm->inm_timer = 0; + ++igmpstat.igps_rcv_ourreports; + + inm->inm_state = IGMP_OTHERMEMBER; + } + + break; + } + + /* + * Pass all valid IGMP packets up to any process(es) listening + * on a raw IGMP socket. + */ + rip_input(m, off); +} + +void +igmp_joingroup(inm) + struct in_multi *inm; +{ + int s = splnet(); + + if (inm->inm_addr.s_addr == igmp_all_hosts_group + || inm->inm_ifp->if_flags & IFF_LOOPBACK) { + inm->inm_timer = 0; + inm->inm_state = IGMP_OTHERMEMBER; + } else { + inm->inm_rti = find_rti(inm->inm_ifp); + igmp_sendpkt(inm, inm->inm_rti->rti_type, 0); + inm->inm_timer = IGMP_RANDOM_DELAY( + IGMP_MAX_HOST_REPORT_DELAY*PR_FASTHZ); + inm->inm_state = IGMP_IREPORTEDLAST; + igmp_timers_are_running = 1; + } + splx(s); +} + +void +igmp_leavegroup(inm) + struct in_multi *inm; +{ + if (inm->inm_state == IGMP_IREPORTEDLAST && + inm->inm_addr.s_addr != igmp_all_hosts_group && + !(inm->inm_ifp->if_flags & IFF_LOOPBACK) && + inm->inm_rti->rti_type != IGMP_V1_ROUTER) + igmp_sendpkt(inm, IGMP_V2_LEAVE_GROUP, igmp_all_rtrs_group); +} + +void +igmp_fasttimo() +{ + register struct in_multi *inm; + struct in_multistep step; + int s; + + /* + * Quick check to see if any work needs to be done, in order + * to minimize the overhead of fasttimo processing. + */ + + if (!igmp_timers_are_running) + return; + + s = splnet(); + igmp_timers_are_running = 0; + IN_FIRST_MULTI(step, inm); + while (inm != NULL) { + if (inm->inm_timer == 0) { + /* do nothing */ + } else if (--inm->inm_timer == 0) { + igmp_sendpkt(inm, inm->inm_rti->rti_type, 0); + inm->inm_state = IGMP_IREPORTEDLAST; + } else { + igmp_timers_are_running = 1; + } + IN_NEXT_MULTI(step, inm); + } + splx(s); +} + +void +igmp_slowtimo() +{ + int s = splnet(); + register struct router_info *rti = Head; + +#ifdef IGMP_DEBUG + printf("[igmp.c,_slowtimo] -- > entering \n"); +#endif + while (rti) { + if (rti->rti_type == IGMP_V1_ROUTER) { + rti->rti_time++; + if (rti->rti_time >= IGMP_AGE_THRESHOLD) { + rti->rti_type = IGMP_V2_ROUTER; + } + } + rti = rti->rti_next; + } +#ifdef IGMP_DEBUG + printf("[igmp.c,_slowtimo] -- > exiting \n"); +#endif + splx(s); +} + +static struct route igmprt; + +static void +igmp_sendpkt(inm, type, addr) + struct in_multi *inm; + int type; + unsigned long addr; +{ + struct mbuf *m; + struct igmp *igmp; + struct ip *ip; + struct ip_moptions imo; + + MGETHDR(m, M_DONTWAIT, MT_HEADER); + if (m == NULL) + return; + + m->m_pkthdr.rcvif = loif; + m->m_pkthdr.len = sizeof(struct ip) + IGMP_MINLEN; + MH_ALIGN(m, IGMP_MINLEN + sizeof(struct ip)); + m->m_data += sizeof(struct ip); + m->m_len = IGMP_MINLEN; + igmp = mtod(m, struct igmp *); + igmp->igmp_type = type; + igmp->igmp_code = 0; + igmp->igmp_group = inm->inm_addr; + igmp->igmp_cksum = 0; + igmp->igmp_cksum = in_cksum(m, IGMP_MINLEN); + + m->m_data -= sizeof(struct ip); + m->m_len += sizeof(struct ip); + ip = mtod(m, struct ip *); + ip->ip_tos = 0; + ip->ip_len = sizeof(struct ip) + IGMP_MINLEN; + ip->ip_off = 0; + ip->ip_p = IPPROTO_IGMP; + ip->ip_src.s_addr = INADDR_ANY; + ip->ip_dst.s_addr = addr ? addr : igmp->igmp_group.s_addr; + + imo.imo_multicast_ifp = inm->inm_ifp; + imo.imo_multicast_ttl = 1; + imo.imo_multicast_vif = -1; + /* + * Request loopback of the report if we are acting as a multicast + * router, so that the process-level routing demon can hear it. + */ + imo.imo_multicast_loop = (ip_mrouter != NULL); + + /* + * XXX + * Do we have to worry about reentrancy here? Don't think so. + */ + ip_output(m, router_alert, &igmprt, 0, &imo); + + ++igmpstat.igps_snd_reports; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/in.c b/packages/net/bsd_tcpip/current/src/sys/netinet/in.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/in.c @@ -0,0 +1,871 @@ +//========================================================================== +// +// src/sys/netinet/in.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1991, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in.c 8.4 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/netinet/in.c,v 1.44.2.5 2001/08/13 16:26:17 ume Exp $ + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +static int in_mask2len __P((struct in_addr *)); +static void in_len2mask __P((struct in_addr *, int)); +static int in_lifaddr_ioctl __P((struct socket *, u_long, caddr_t, + struct ifnet *, struct proc *)); + +static void in_socktrim __P((struct sockaddr_in *)); +static int in_ifinit __P((struct ifnet *, + struct in_ifaddr *, struct sockaddr_in *, int)); + +static int subnetsarelocal = 0; + +struct in_multihead in_multihead; /* XXX BSS initialization */ + +extern struct inpcbinfo ripcbinfo; +extern struct inpcbinfo udbinfo; + +/* + * Return 1 if an internet address is for a ``local'' host + * (one to which we have a connection). If subnetsarelocal + * is true, this includes other subnets of the local net. + * Otherwise, it includes only the directly-connected (sub)nets. + */ +int +in_localaddr(in) + struct in_addr in; +{ + register u_long i = ntohl(in.s_addr); + register struct in_ifaddr *ia; + + if (subnetsarelocal) { + for (ia = in_ifaddrhead.tqh_first; ia; + ia = ia->ia_link.tqe_next) + if ((i & ia->ia_netmask) == ia->ia_net) + return (1); + } else { + for (ia = in_ifaddrhead.tqh_first; ia; + ia = ia->ia_link.tqe_next) + if ((i & ia->ia_subnetmask) == ia->ia_subnet) + return (1); + } + return (0); +} + +/* + * Determine whether an IP address is in a reserved set of addresses + * that may not be forwarded, or whether datagrams to that destination + * may be forwarded. + */ +int +in_canforward(in) + struct in_addr in; +{ + register u_long i = ntohl(in.s_addr); + register u_long net; + + if (IN_EXPERIMENTAL(i) || IN_MULTICAST(i)) + return (0); + if (IN_CLASSA(i)) { + net = i & IN_CLASSA_NET; + if (net == 0 || net == (IN_LOOPBACKNET << IN_CLASSA_NSHIFT)) + return (0); + } + return (1); +} + +/* + * Trim a mask in a sockaddr + */ +static void +in_socktrim(ap) +struct sockaddr_in *ap; +{ + register char *cplim = (char *) &ap->sin_addr; + register char *cp = (char *) (&ap->sin_addr + 1); + + ap->sin_len = 0; + while (--cp >= cplim) + if (*cp) { + (ap)->sin_len = cp - (char *) (ap) + 1; + break; + } +} + +static int +in_mask2len(mask) + struct in_addr *mask; +{ + int x, y; + u_char *p; + + p = (u_char *)mask; + for (x = 0; x < sizeof(*mask); x++) { + if (p[x] != 0xff) + break; + } + y = 0; + if (x < sizeof(*mask)) { + for (y = 0; y < 8; y++) { + if ((p[x] & (0x80 >> y)) == 0) + break; + } + } + return x * 8 + y; +} + +static void +in_len2mask(mask, len) + struct in_addr *mask; + int len; +{ + int i; + u_char *p; + + p = (u_char *)mask; + bzero(mask, sizeof(*mask)); + for (i = 0; i < len / 8; i++) + p[i] = 0xff; + if (len % 8) + p[i] = (0xff00 >> (len % 8)) & 0xff; +} + +static int in_interfaces; /* number of external internet interfaces */ + +/* + * Generic internet control operations (ioctl's). + * Ifp is 0 if not an interface-specific ioctl. + */ +/* ARGSUSED */ +int +in_control(so, cmd, data, ifp, p) + struct socket *so; + u_long cmd; + caddr_t data; + register struct ifnet *ifp; + struct proc *p; +{ + register struct ifreq *ifr = (struct ifreq *)data; + register struct in_ifaddr *ia = 0, *iap; + register struct ifaddr *ifa; + struct in_ifaddr *oia; + struct in_aliasreq *ifra = (struct in_aliasreq *)data; + struct sockaddr_in oldaddr; + int error, hostIsNew, maskIsNew, s; + u_long i; + + switch (cmd) { + case SIOCALIFADDR: + case SIOCDLIFADDR: + /*fall through*/ + case SIOCGLIFADDR: + if (!ifp) + return EINVAL; + return in_lifaddr_ioctl(so, cmd, data, ifp, p); + } + + /* + * Find address for this interface, if it exists. + * + * If an alias address was specified, find that one instead of + * the first one on the interface. + */ + if (ifp) + for (iap = in_ifaddrhead.tqh_first; iap; + iap = iap->ia_link.tqe_next) + if (iap->ia_ifp == ifp) { + if (((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr.s_addr == + iap->ia_addr.sin_addr.s_addr) { + ia = iap; + break; + } else if (ia == NULL) { + ia = iap; + if (ifr->ifr_addr.sa_family != AF_INET) + break; + } + } + + switch (cmd) { + + case SIOCAIFADDR: + case SIOCDIFADDR: + + case SIOCSIFADDR: // Moved from after this search, otherwise repeated + // identical SIOCSIFADDRs leaked the previously allocated record. + + if (ifp == 0) + return (EADDRNOTAVAIL); + if (ifra->ifra_addr.sin_family == AF_INET) { + for (oia = ia; ia; ia = ia->ia_link.tqe_next) { + if (ia->ia_ifp == ifp && + ia->ia_addr.sin_addr.s_addr == + ifra->ifra_addr.sin_addr.s_addr) + break; + } + if ((ifp->if_flags & IFF_POINTOPOINT) + && (cmd == SIOCAIFADDR) + && (ifra->ifra_dstaddr.sin_addr.s_addr + == INADDR_ANY)) { + return EDESTADDRREQ; + } + } + if (cmd == SIOCDIFADDR && ia == 0) + return (EADDRNOTAVAIL); + /* FALLTHROUGH */ + case SIOCSIFNETMASK: + case SIOCSIFDSTADDR: + if (ifp == 0) + return (EADDRNOTAVAIL); + if (ia == (struct in_ifaddr *)0) { + ia = (struct in_ifaddr *) + malloc(sizeof *ia, M_IFADDR, M_WAITOK); // This alloc was leaked + if (ia == (struct in_ifaddr *)NULL) + return (ENOBUFS); + bzero((caddr_t)ia, sizeof *ia); + /* + * Protect from ipintr() traversing address list + * while we're modifying it. + */ + s = splnet(); + + TAILQ_INSERT_TAIL(&in_ifaddrhead, ia, ia_link); + ifa = &ia->ia_ifa; + TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); + + ifa->ifa_addr = (struct sockaddr *)&ia->ia_addr; + ifa->ifa_dstaddr = (struct sockaddr *)&ia->ia_dstaddr; + ifa->ifa_netmask = (struct sockaddr *)&ia->ia_sockmask; + ia->ia_sockmask.sin_len = 8; + if (ifp->if_flags & IFF_BROADCAST) { + ia->ia_broadaddr.sin_len = sizeof(ia->ia_addr); + ia->ia_broadaddr.sin_family = AF_INET; + } + ia->ia_ifp = ifp; + if (!(ifp->if_flags & IFF_LOOPBACK)) + in_interfaces++; + splx(s); + } + break; + + case SIOCSIFBRDADDR: + /* FALLTHROUGH */ + + case SIOCGIFADDR: + case SIOCGIFNETMASK: + case SIOCGIFDSTADDR: + case SIOCGIFBRDADDR: + if (ia == (struct in_ifaddr *)0) + return (EADDRNOTAVAIL); + break; + } + switch (cmd) { + + case SIOCGIFADDR: + *((struct sockaddr_in *)&ifr->ifr_addr) = ia->ia_addr; + break; + + case SIOCGIFBRDADDR: + if ((ifp->if_flags & IFF_BROADCAST) == 0) + return (EINVAL); + *((struct sockaddr_in *)&ifr->ifr_dstaddr) = ia->ia_broadaddr; + break; + + case SIOCGIFDSTADDR: + if ((ifp->if_flags & IFF_POINTOPOINT) == 0) + return (EINVAL); + *((struct sockaddr_in *)&ifr->ifr_dstaddr) = ia->ia_dstaddr; + break; + + case SIOCGIFNETMASK: + *((struct sockaddr_in *)&ifr->ifr_addr) = ia->ia_sockmask; + break; + + case SIOCSIFDSTADDR: + if ((ifp->if_flags & IFF_POINTOPOINT) == 0) + return (EINVAL); + oldaddr = ia->ia_dstaddr; + ia->ia_dstaddr = *(struct sockaddr_in *)&ifr->ifr_dstaddr; + if (ifp->if_ioctl && (error = (*ifp->if_ioctl) + (ifp, SIOCSIFDSTADDR, (caddr_t)ia))) { + ia->ia_dstaddr = oldaddr; + return (error); + } + if (ia->ia_flags & IFA_ROUTE) { + ia->ia_ifa.ifa_dstaddr = (struct sockaddr *)&oldaddr; + rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST); + ia->ia_ifa.ifa_dstaddr = + (struct sockaddr *)&ia->ia_dstaddr; + rtinit(&(ia->ia_ifa), (int)RTM_ADD, RTF_HOST|RTF_UP); + } + break; + + case SIOCSIFBRDADDR: + if ((ifp->if_flags & IFF_BROADCAST) == 0) + return (EINVAL); + ia->ia_broadaddr = *(struct sockaddr_in *)&ifr->ifr_broadaddr; + break; + + case SIOCSIFADDR: + return (in_ifinit(ifp, ia, + (struct sockaddr_in *) &ifr->ifr_addr, 1)); + + case SIOCSIFNETMASK: + i = ifra->ifra_addr.sin_addr.s_addr; + ia->ia_subnetmask = ntohl(ia->ia_sockmask.sin_addr.s_addr = i); + break; + + case SIOCAIFADDR: + maskIsNew = 0; + hostIsNew = 1; + error = 0; + if (ia->ia_addr.sin_family == AF_INET) { + if (ifra->ifra_addr.sin_len == 0) { + ifra->ifra_addr = ia->ia_addr; + hostIsNew = 0; + } else if (ifra->ifra_addr.sin_addr.s_addr == + ia->ia_addr.sin_addr.s_addr) + hostIsNew = 0; + } + if (ifra->ifra_mask.sin_len) { + in_ifscrub(ifp, ia); + ia->ia_sockmask = ifra->ifra_mask; + ia->ia_subnetmask = + ntohl(ia->ia_sockmask.sin_addr.s_addr); + maskIsNew = 1; + } + if ((ifp->if_flags & IFF_POINTOPOINT) && + (ifra->ifra_dstaddr.sin_family == AF_INET)) { + in_ifscrub(ifp, ia); + ia->ia_dstaddr = ifra->ifra_dstaddr; + maskIsNew = 1; /* We lie; but the effect's the same */ + } + if (ifra->ifra_addr.sin_family == AF_INET && + (hostIsNew || maskIsNew)) + error = in_ifinit(ifp, ia, &ifra->ifra_addr, 0); + if ((ifp->if_flags & IFF_BROADCAST) && + (ifra->ifra_broadaddr.sin_family == AF_INET)) + ia->ia_broadaddr = ifra->ifra_broadaddr; + return (error); + + case SIOCDIFADDR: + /* + * in_ifscrub kills the interface route. + */ + in_ifscrub(ifp, ia); + /* + * in_ifadown gets rid of all the rest of + * the routes. This is not quite the right + * thing to do, but at least if we are running + * a routing process they will come back. + */ + in_ifadown(&ia->ia_ifa, 1); + /* + * XXX horrible hack to detect that we are being called + * from if_detach() + */ + if (!ifnet_addrs[ifp->if_index - 1]) { + in_pcbpurgeif0(LIST_FIRST(ripcbinfo.listhead), ifp); + in_pcbpurgeif0(LIST_FIRST(udbinfo.listhead), ifp); + } + + /* + * Protect from ipintr() traversing address list + * while we're modifying it. + */ + s = splnet(); + + ifa = &ia->ia_ifa; + TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); + oia = ia; + TAILQ_REMOVE(&in_ifaddrhead, oia, ia_link); + IFAFREE(&oia->ia_ifa); + splx(s); + break; + + default: + if (ifp == 0 || ifp->if_ioctl == 0) + return (EOPNOTSUPP); + return ((*ifp->if_ioctl)(ifp, cmd, data)); + } + return (0); +} + +/* + * SIOC[GAD]LIFADDR. + * SIOCGLIFADDR: get first address. (?!?) + * SIOCGLIFADDR with IFLR_PREFIX: + * get first address that matches the specified prefix. + * SIOCALIFADDR: add the specified address. + * SIOCALIFADDR with IFLR_PREFIX: + * EINVAL since we can't deduce hostid part of the address. + * SIOCDLIFADDR: delete the specified address. + * SIOCDLIFADDR with IFLR_PREFIX: + * delete the first address that matches the specified prefix. + * return values: + * EINVAL on invalid parameters + * EADDRNOTAVAIL on prefix match failed/specified address not found + * other values may be returned from in_ioctl() + */ +static int +in_lifaddr_ioctl(so, cmd, data, ifp, p) + struct socket *so; + u_long cmd; + caddr_t data; + struct ifnet *ifp; + struct proc *p; +{ + struct if_laddrreq *iflr = (struct if_laddrreq *)data; + struct ifaddr *ifa; + + /* sanity checks */ + if (!data || !ifp) { + panic("invalid argument to in_lifaddr_ioctl"); + /*NOTRECHED*/ + } + + switch (cmd) { + case SIOCGLIFADDR: + /* address must be specified on GET with IFLR_PREFIX */ + if ((iflr->flags & IFLR_PREFIX) == 0) + break; + /*FALLTHROUGH*/ + case SIOCALIFADDR: + case SIOCDLIFADDR: + /* address must be specified on ADD and DELETE */ + if (iflr->addr.ss_family != AF_INET) + return EINVAL; + if (iflr->addr.ss_len != sizeof(struct sockaddr_in)) + return EINVAL; + /* XXX need improvement */ + if (iflr->dstaddr.ss_family + && iflr->dstaddr.ss_family != AF_INET) + return EINVAL; + if (iflr->dstaddr.ss_family + && iflr->dstaddr.ss_len != sizeof(struct sockaddr_in)) + return EINVAL; + break; + default: /*shouldn't happen*/ + return EOPNOTSUPP; + } + if (sizeof(struct in_addr) * 8 < iflr->prefixlen) + return EINVAL; + + switch (cmd) { + case SIOCALIFADDR: + { + struct in_aliasreq ifra; + + if (iflr->flags & IFLR_PREFIX) + return EINVAL; + + /* copy args to in_aliasreq, perform ioctl(SIOCAIFADDR_IN6). */ + bzero(&ifra, sizeof(ifra)); + bcopy(iflr->iflr_name, ifra.ifra_name, + sizeof(ifra.ifra_name)); + + bcopy(&iflr->addr, &ifra.ifra_addr, iflr->addr.ss_len); + + if (iflr->dstaddr.ss_family) { /*XXX*/ + bcopy(&iflr->dstaddr, &ifra.ifra_dstaddr, + iflr->dstaddr.ss_len); + } + + ifra.ifra_mask.sin_family = AF_INET; + ifra.ifra_mask.sin_len = sizeof(struct sockaddr_in); + in_len2mask(&ifra.ifra_mask.sin_addr, iflr->prefixlen); + + return in_control(so, SIOCAIFADDR, (caddr_t)&ifra, ifp, p); + } + case SIOCGLIFADDR: + case SIOCDLIFADDR: + { + struct in_ifaddr *ia; + struct in_addr mask, candidate, match; + struct sockaddr_in *sin; + int cmp; + + bzero(&mask, sizeof(mask)); + if (iflr->flags & IFLR_PREFIX) { + /* lookup a prefix rather than address. */ + in_len2mask(&mask, iflr->prefixlen); + + sin = (struct sockaddr_in *)&iflr->addr; + match.s_addr = sin->sin_addr.s_addr; + match.s_addr &= mask.s_addr; + + /* if you set extra bits, that's wrong */ + if (match.s_addr != sin->sin_addr.s_addr) + return EINVAL; + + cmp = 1; + } else { + if (cmd == SIOCGLIFADDR) { + /* on getting an address, take the 1st match */ + cmp = 0; /*XXX*/ + } else { + /* on deleting an address, do exact match */ + in_len2mask(&mask, 32); + sin = (struct sockaddr_in *)&iflr->addr; + match.s_addr = sin->sin_addr.s_addr; + + cmp = 1; + } + } + + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + if (!cmp) + break; + candidate.s_addr = ((struct sockaddr_in *)&ifa->ifa_addr)->sin_addr.s_addr; + candidate.s_addr &= mask.s_addr; + if (candidate.s_addr == match.s_addr) + break; + } + if (!ifa) + return EADDRNOTAVAIL; + ia = (struct in_ifaddr *)ifa; + + if (cmd == SIOCGLIFADDR) { + /* fill in the if_laddrreq structure */ + bcopy(&ia->ia_addr, &iflr->addr, ia->ia_addr.sin_len); + + if ((ifp->if_flags & IFF_POINTOPOINT) != 0) { + bcopy(&ia->ia_dstaddr, &iflr->dstaddr, + ia->ia_dstaddr.sin_len); + } else + bzero(&iflr->dstaddr, sizeof(iflr->dstaddr)); + + iflr->prefixlen = + in_mask2len(&ia->ia_sockmask.sin_addr); + + iflr->flags = 0; /*XXX*/ + + return 0; + } else { + struct in_aliasreq ifra; + + /* fill in_aliasreq and do ioctl(SIOCDIFADDR_IN6) */ + bzero(&ifra, sizeof(ifra)); + bcopy(iflr->iflr_name, ifra.ifra_name, + sizeof(ifra.ifra_name)); + + bcopy(&ia->ia_addr, &ifra.ifra_addr, + ia->ia_addr.sin_len); + if ((ifp->if_flags & IFF_POINTOPOINT) != 0) { + bcopy(&ia->ia_dstaddr, &ifra.ifra_dstaddr, + ia->ia_dstaddr.sin_len); + } + bcopy(&ia->ia_sockmask, &ifra.ifra_dstaddr, + ia->ia_sockmask.sin_len); + + return in_control(so, SIOCDIFADDR, (caddr_t)&ifra, + ifp, p); + } + } + } + + return EOPNOTSUPP; /*just for safety*/ +} + +/* + * Delete any existing route for an interface. + */ +void +in_ifscrub(ifp, ia) + register struct ifnet *ifp; + register struct in_ifaddr *ia; +{ + + if ((ia->ia_flags & IFA_ROUTE) == 0) + return; + if (ifp->if_flags & (IFF_LOOPBACK|IFF_POINTOPOINT)) + rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST); + else + rtinit(&(ia->ia_ifa), (int)RTM_DELETE, 0); + ia->ia_flags &= ~IFA_ROUTE; +} + +/* + * Initialize an interface's internet address + * and routing table entry. + */ +static int +in_ifinit(ifp, ia, sin, scrub) + register struct ifnet *ifp; + register struct in_ifaddr *ia; + struct sockaddr_in *sin; + int scrub; +{ + register u_long i = ntohl(sin->sin_addr.s_addr); + struct sockaddr_in oldaddr; + int s = splimp(), flags = RTF_UP, error; + + oldaddr = ia->ia_addr; + ia->ia_addr = *sin; + /* + * Give the interface a chance to initialize + * if this is its first address, + * and to validate the address if necessary. + */ + if (ifp->if_ioctl && + (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia))) { + splx(s); + ia->ia_addr = oldaddr; + return (error); + } + splx(s); + if (scrub) { + ia->ia_ifa.ifa_addr = (struct sockaddr *)&oldaddr; + in_ifscrub(ifp, ia); + ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr; + } + if (IN_CLASSA(i)) + ia->ia_netmask = IN_CLASSA_NET; + else if (IN_CLASSB(i)) + ia->ia_netmask = IN_CLASSB_NET; + else + ia->ia_netmask = IN_CLASSC_NET; + /* + * The subnet mask usually includes at least the standard network part, + * but may may be smaller in the case of supernetting. + * If it is set, we believe it. + */ + if (ia->ia_subnetmask == 0) { + ia->ia_subnetmask = ia->ia_netmask; + ia->ia_sockmask.sin_addr.s_addr = htonl(ia->ia_subnetmask); + } else + ia->ia_netmask &= ia->ia_subnetmask; + ia->ia_net = i & ia->ia_netmask; + ia->ia_subnet = i & ia->ia_subnetmask; + in_socktrim(&ia->ia_sockmask); + /* + * Add route for the network. + */ + ia->ia_ifa.ifa_metric = ifp->if_metric; + if (ifp->if_flags & IFF_BROADCAST) { + ia->ia_broadaddr.sin_addr.s_addr = + htonl(ia->ia_subnet | ~ia->ia_subnetmask); + ia->ia_netbroadcast.s_addr = + htonl(ia->ia_net | ~ ia->ia_netmask); + } else if (ifp->if_flags & IFF_LOOPBACK) { + ia->ia_ifa.ifa_dstaddr = ia->ia_ifa.ifa_addr; + flags |= RTF_HOST; + } else if (ifp->if_flags & IFF_POINTOPOINT) { + if (ia->ia_dstaddr.sin_family != AF_INET) + return (0); + flags |= RTF_HOST; + } + if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, flags)) == 0) + ia->ia_flags |= IFA_ROUTE; + /* XXX check if the subnet route points to the same interface */ + if (error == EEXIST) + error = 0; + + /* + * If the interface supports multicast, join the "all hosts" + * multicast group on that interface. + */ + if (ifp->if_flags & IFF_MULTICAST) { + struct in_addr addr; + + addr.s_addr = htonl(INADDR_ALLHOSTS_GROUP); + in_addmulti(&addr, ifp); + } + return (error); +} + + +/* + * Return 1 if the address might be a local broadcast address. + */ +int +in_broadcast(in, ifp) + struct in_addr in; + struct ifnet *ifp; +{ + register struct ifaddr *ifa; + u_long t; + + if (in.s_addr == INADDR_BROADCAST || + in.s_addr == INADDR_ANY) + return 1; + if ((ifp->if_flags & IFF_BROADCAST) == 0) + return 0; + t = ntohl(in.s_addr); + /* + * Look through the list of addresses for a match + * with a broadcast address. + */ +#define ia ((struct in_ifaddr *)ifa) + for (ifa = ifp->if_addrhead.tqh_first; ifa; + ifa = ifa->ifa_link.tqe_next) + if (ifa->ifa_addr->sa_family == AF_INET && + (in.s_addr == ia->ia_broadaddr.sin_addr.s_addr || + in.s_addr == ia->ia_netbroadcast.s_addr || + /* + * Check for old-style (host 0) broadcast. + */ + t == ia->ia_subnet || t == ia->ia_net) && + /* + * Check for an all one subnetmask. These + * only exist when an interface gets a secondary + * address. + */ + ia->ia_subnetmask != (u_long)0xffffffff) + return 1; + return (0); +#undef ia +} +/* + * Add an address to the list of IP multicast addresses for a given interface. + */ +struct in_multi * +in_addmulti(ap, ifp) + register struct in_addr *ap; + register struct ifnet *ifp; +{ + register struct in_multi *inm; + int error; + struct sockaddr_in sin; + struct ifmultiaddr *ifma; + int s = splnet(); + + /* + * Call generic routine to add membership or increment + * refcount. It wants addresses in the form of a sockaddr, + * so we build one here (being careful to zero the unused bytes). + */ + bzero(&sin, sizeof sin); + sin.sin_family = AF_INET; + sin.sin_len = sizeof sin; + sin.sin_addr = *ap; + error = if_addmulti(ifp, (struct sockaddr *)&sin, &ifma); + if (error) { + splx(s); + return 0; + } + + /* + * If ifma->ifma_protospec is null, then if_addmulti() created + * a new record. Otherwise, we are done. + */ + if (ifma->ifma_protospec != 0) { + splx(s); + return ifma->ifma_protospec; + } + + /* XXX - if_addmulti uses M_WAITOK. Can this really be called + at interrupt time? If so, need to fix if_addmulti. XXX */ + inm = (struct in_multi *)malloc(sizeof(*inm), M_IPMADDR, M_NOWAIT); + if (inm == NULL) { + splx(s); + return (NULL); + } + + bzero(inm, sizeof *inm); + inm->inm_addr = *ap; + inm->inm_ifp = ifp; + inm->inm_ifma = ifma; + ifma->ifma_protospec = inm; + LIST_INSERT_HEAD(&in_multihead, inm, inm_link); + + /* + * Let IGMP know that we have joined a new IP multicast group. + */ + igmp_joingroup(inm); + splx(s); + return (inm); +} + +/* + * Delete a multicast address record. + */ +void +in_delmulti(inm) + register struct in_multi *inm; +{ + struct ifmultiaddr *ifma = inm->inm_ifma; + struct in_multi my_inm; + int s = splnet(); + + my_inm.inm_ifp = NULL ; /* don't send the leave msg */ + if (ifma->ifma_refcount == 1) { + /* + * No remaining claims to this record; let IGMP know that + * we are leaving the multicast group. + * But do it after the if_delmulti() which might reset + * the interface and nuke the packet. + */ + my_inm = *inm ; + ifma->ifma_protospec = 0; + LIST_REMOVE(inm, inm_link); + free(inm, M_IPMADDR); + } + /* XXX - should be separate API for when we have an ifma? */ + if_delmulti(ifma->ifma_ifp, ifma->ifma_addr); + if (my_inm.inm_ifp != NULL) + igmp_leavegroup(&my_inm); + splx(s); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/in_cksum.c b/packages/net/bsd_tcpip/current/src/sys/netinet/in_cksum.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/in_cksum.c @@ -0,0 +1,289 @@ +//========================================================================== +// +// src/sys/netinet/in_cksum.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $FreeBSD: src/sys/alpha/alpha/in_cksum.c,v 1.2.2.2 2001/05/04 15:36:43 ru Exp $ */ +/* $NetBSD: in_cksum.c,v 1.7 1997/09/02 13:18:15 thorpej Exp $ */ + +/* + * Copyright (c) 1988, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * Copyright (c) 1996 + * Matt Thomas + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_cksum.c 8.1 (Berkeley) 6/10/93 + */ + +#include +#include +#include +#include +#include + +/* + * Checksum routine for Internet Protocol family headers + * (Portable Alpha version). + * + * This routine is very heavily used in the network + * code and should be modified for each CPU to be as fast as possible. + */ + +#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x) +#define REDUCE32 \ + { \ + q_util.q = sum; \ + sum = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ + } +#define REDUCE16 \ + { \ + q_util.q = sum; \ + l_util.l = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ + sum = l_util.s[0] + l_util.s[1]; \ + ADDCARRY(sum); \ + } + +static const u_int32_t in_masks[] = { + /*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/ + 0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */ + 0x00000000, 0x0000FF00, 0x00FFFF00, 0xFFFFFF00, /* offset 1 */ + 0x00000000, 0x00FF0000, 0xFFFF0000, 0xFFFF0000, /* offset 2 */ + 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, /* offset 3 */ +}; + +union l_util { + u_int16_t s[2]; + u_int32_t l; +}; +union q_util { + u_int16_t s[4]; + u_int32_t l[2]; + u_int64_t q; +}; + +u_int64_t in_cksumdata __P((caddr_t buf, int len)); + +u_int64_t +in_cksumdata(caddr_t buf, int len) +{ + const u_int32_t *lw = (u_int32_t *) buf; + u_int64_t sum = 0; + u_int64_t prefilled; + int offset; + union q_util q_util; + + if ((3 & (long) lw) == 0 && len == 20) { + sum = (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3] + lw[4]; + REDUCE32; + return sum; + } + + if ((offset = 3 & (long) lw) != 0) { + const u_int32_t *masks = in_masks + (offset << 2); + lw = (u_int32_t *) (((long) lw) - offset); + sum = *lw++ & masks[len >= 3 ? 3 : len]; + len -= 4 - offset; + if (len <= 0) { + REDUCE32; + return sum; + } + } +#if 0 + /* + * Force to cache line boundary. + */ + offset = 32 - (0x1f & (long) lw); + if (offset < 32 && len > offset) { + len -= offset; + if (4 & offset) { + sum += (u_int64_t) lw[0]; + lw += 1; + } + if (8 & offset) { + sum += (u_int64_t) lw[0] + lw[1]; + lw += 2; + } + if (16 & offset) { + sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3]; + lw += 4; + } + } +#endif + /* + * access prefilling to start load of next cache line. + * then add current cache line + * save result of prefilling for loop iteration. + */ + prefilled = lw[0]; + while ((len -= 32) >= 4) { + u_int64_t prefilling = lw[8]; + sum += prefilled + lw[1] + lw[2] + lw[3] + + lw[4] + lw[5] + lw[6] + lw[7]; + lw += 8; + prefilled = prefilling; + } + if (len >= 0) { + sum += prefilled + lw[1] + lw[2] + lw[3] + + lw[4] + lw[5] + lw[6] + lw[7]; + lw += 8; + } else { + len += 32; + } + while ((len -= 16) >= 0) { + sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3]; + lw += 4; + } + len += 16; + while ((len -= 4) >= 0) { + sum += (u_int64_t) *lw++; + } + len += 4; + if (len > 0) + sum += (u_int64_t) (in_masks[len] & *lw); + REDUCE32; + return sum; +} + +u_short +in_addword(u_short a, u_short b) +{ + u_int32_t sum = a + b; + + ADDCARRY(sum); + return (sum); +} + +u_short +in_pseudo(u_int32_t a, u_int32_t b, u_int32_t c) +{ + u_int64_t sum; + union q_util q_util; + union l_util l_util; + + sum = (u_int64_t) a + b + c; + REDUCE16; + return (sum); +} + +int +in_cksum(struct mbuf *m, int len) +{ + register u_int64_t sum = 0; + register int mlen = 0; + register int clen = 0; + register caddr_t addr; + union q_util q_util; + union l_util l_util; + + for (; m && len; m = m->m_next) { + if (m->m_len == 0) + continue; + mlen = m->m_len; + if (len < mlen) + mlen = len; + addr = mtod(m, caddr_t); + if ((clen ^ (long) addr) & 1) + sum += in_cksumdata(addr, mlen) << 8; + else + sum += in_cksumdata(addr, mlen); + + clen += mlen; + len -= mlen; + } + REDUCE16; + return (~sum & 0xffff); +} + +u_short +in_cksum_skip(struct mbuf *m, int len, int skip) +{ + u_int64_t sum = 0; + int mlen = 0; + int clen = 0; + caddr_t addr; + union q_util q_util; + union l_util l_util; + + len -= skip; + for (; skip && m; m = m->m_next) { + if (m->m_len > skip) { + mlen = m->m_len - skip; + addr = mtod(m, caddr_t) + skip; + goto skip_start; + } else { + skip -= m->m_len; + } + } + + for (; m && len; m = m->m_next) { + if (m->m_len == 0) + continue; + mlen = m->m_len; + addr = mtod(m, caddr_t); +skip_start: + if (len < mlen) + mlen = len; + if ((clen ^ (long) addr) & 1) + sum += in_cksumdata(addr, mlen) << 8; + else + sum += in_cksumdata(addr, mlen); + + clen += mlen; + len -= mlen; + } + REDUCE16; + return (~sum & 0xffff); +} + +u_int in_cksum_hdr(const struct ip *ip) +{ + u_int64_t sum = in_cksumdata((caddr_t) ip, sizeof(struct ip)); + union q_util q_util; + union l_util l_util; + REDUCE16; + return (~sum & 0xffff); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/in_pcb.c b/packages/net/bsd_tcpip/current/src/sys/netinet/in_pcb.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/in_pcb.c @@ -0,0 +1,965 @@ +//========================================================================== +// +// src/sys/netinet/in_pcb.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1991, 1993, 1995 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet/in_pcb.c,v 1.59.2.17 2001/08/13 16:26:17 ume Exp $ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#ifdef INET6 +#include +#include +#endif /* INET6 */ + +#ifdef IPSEC +#include +#include +#endif /* IPSEC */ + +struct in_addr zeroin_addr; + +/* + * These configure the range of local port addresses assigned to + * "unspecified" outgoing connections/packets/whatever. + */ +int ipport_lowfirstauto = IPPORT_RESERVED - 1; /* 1023 */ +int ipport_lowlastauto = IPPORT_RESERVEDSTART; /* 600 */ +int ipport_firstauto = IPPORT_RESERVED; /* 1024 */ +int ipport_lastauto = IPPORT_USERRESERVED; /* 5000 */ +int ipport_hifirstauto = IPPORT_HIFIRSTAUTO; /* 49152 */ +int ipport_hilastauto = IPPORT_HILASTAUTO; /* 65535 */ + + +/* + * in_pcb.c: manage the Protocol Control Blocks. + * + * NOTE: It is assumed that most of these functions will be called at + * splnet(). XXX - There are, unfortunately, a few exceptions to this + * rule that should be fixed. + */ + +/* + * Allocate a PCB and associate it with the socket. + */ +int +in_pcballoc(so, pcbinfo, p) + struct socket *so; + struct inpcbinfo *pcbinfo; + struct proc *p; +{ + register struct inpcb *inp; +#ifdef IPSEC + int error; +#endif + + inp = zalloci(pcbinfo->ipi_zone); + if (inp == NULL) + return (ENOBUFS); + bzero((caddr_t)inp, sizeof(*inp)); + inp->inp_gencnt = ++pcbinfo->ipi_gencnt; + inp->inp_pcbinfo = pcbinfo; + inp->inp_socket = so; +#ifdef IPSEC + error = ipsec_init_policy(so, &inp->inp_sp); + if (error != 0) { + zfreei(pcbinfo->ipi_zone, inp); + return error; + } +#endif /*IPSEC*/ +#if defined(INET6) + if (INP_SOCKAF(so) == AF_INET6 && !ip6_mapped_addr_on) + inp->inp_flags |= IN6P_IPV6_V6ONLY; +#endif + LIST_INSERT_HEAD(pcbinfo->listhead, inp, inp_list); + pcbinfo->ipi_count++; + so->so_pcb = (caddr_t)inp; +#ifdef INET6 + if (ip6_auto_flowlabel) + inp->inp_flags |= IN6P_AUTOFLOWLABEL; +#endif + return (0); +} + +int +in_pcbbind(inp, nam, p) + register struct inpcb *inp; + struct sockaddr *nam; + struct proc *p; +{ + register struct socket *so = inp->inp_socket; + unsigned short *lastport; + struct sockaddr_in *sin; + struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; + u_short lport = 0; + int wild = 0, reuseport = (so->so_options & SO_REUSEPORT); + + if (TAILQ_EMPTY(&in_ifaddrhead)) /* XXX broken! */ + return (EADDRNOTAVAIL); + if (inp->inp_lport || inp->inp_laddr.s_addr != INADDR_ANY) + return (EINVAL); + if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0) + wild = 1; + if (nam) { + sin = (struct sockaddr_in *)nam; + // HACK + if (nam->sa_len == 0) nam->sa_len = sizeof(*sin); + // HACK + if (nam->sa_len != sizeof (*sin)) + return (EINVAL); +#ifdef notdef + /* + * We should check the family, but old programs + * incorrectly fail to initialize it. + */ + if (sin->sin_family != AF_INET) + return (EAFNOSUPPORT); +#endif + lport = sin->sin_port; + if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) { + /* + * Treat SO_REUSEADDR as SO_REUSEPORT for multicast; + * allow complete duplication of binding if + * SO_REUSEPORT is set, or if SO_REUSEADDR is set + * and a multicast address is bound on both + * new and duplicated sockets. + */ + if (so->so_options & SO_REUSEADDR) + reuseport = SO_REUSEADDR|SO_REUSEPORT; + } else if (sin->sin_addr.s_addr != INADDR_ANY) { + sin->sin_port = 0; /* yech... */ + if (ifa_ifwithaddr((struct sockaddr *)sin) == 0) + return (EADDRNOTAVAIL); + } + if (lport) { + struct inpcb *t; + + /* GROSS */ + t = in_pcblookup_local(pcbinfo, sin->sin_addr, lport, wild); + if (t && + (reuseport & t->inp_socket->so_options) == 0) { +#if defined(INET6) + if (ntohl(sin->sin_addr.s_addr) != + INADDR_ANY || + ntohl(t->inp_laddr.s_addr) != + INADDR_ANY || + INP_SOCKAF(so) == + INP_SOCKAF(t->inp_socket)) +#endif /* defined(INET6) */ + return (EADDRINUSE); + } + } + inp->inp_laddr = sin->sin_addr; + } + if (lport == 0) { + u_short first, last; + int count; + + inp->inp_flags |= INP_ANONPORT; + + if (inp->inp_flags & INP_HIGHPORT) { + first = ipport_hifirstauto; /* sysctl */ + last = ipport_hilastauto; + lastport = &pcbinfo->lasthi; + } else if (inp->inp_flags & INP_LOWPORT) { + first = ipport_lowfirstauto; /* 1023 */ + last = ipport_lowlastauto; /* 600 */ + lastport = &pcbinfo->lastlow; + } else { + first = ipport_firstauto; /* sysctl */ + last = ipport_lastauto; + lastport = &pcbinfo->lastport; + } + /* + * Simple check to ensure all ports are not used up causing + * a deadlock here. + * + * We split the two cases (up and down) so that the direction + * is not being tested on each round of the loop. + */ + if (first > last) { + /* + * counting down + */ + count = first - last; + + do { + if (count-- < 0) { /* completely used? */ + inp->inp_laddr.s_addr = INADDR_ANY; + return (EADDRNOTAVAIL); + } + --*lastport; + if (*lastport > first || *lastport < last) + *lastport = first; + lport = htons(*lastport); + } while (in_pcblookup_local(pcbinfo, + inp->inp_laddr, lport, wild)); + } else { + /* + * counting up + */ + count = last - first; + + do { + if (count-- < 0) { /* completely used? */ + inp->inp_laddr.s_addr = INADDR_ANY; + return (EADDRNOTAVAIL); + } + ++*lastport; + if (*lastport < first || *lastport > last) + *lastport = first; + lport = htons(*lastport); + } while (in_pcblookup_local(pcbinfo, + inp->inp_laddr, lport, wild)); + } + } + inp->inp_lport = lport; + if (in_pcbinshash(inp) != 0) { + inp->inp_laddr.s_addr = INADDR_ANY; + inp->inp_lport = 0; + return (EAGAIN); + } + return (0); +} + +/* + * Transform old in_pcbconnect() into an inner subroutine for new + * in_pcbconnect(): Do some validity-checking on the remote + * address (in mbuf 'nam') and then determine local host address + * (i.e., which interface) to use to access that remote host. + * + * This preserves definition of in_pcbconnect(), while supporting a + * slightly different version for T/TCP. (This is more than + * a bit of a kludge, but cleaning up the internal interfaces would + * have forced minor changes in every protocol). + */ + +int +in_pcbladdr(inp, nam, plocal_sin) + register struct inpcb *inp; + struct sockaddr *nam; + struct sockaddr_in **plocal_sin; +{ + struct in_ifaddr *ia; + register struct sockaddr_in *sin = (struct sockaddr_in *)nam; + + if (nam->sa_len != sizeof (*sin)) + return (EINVAL); + if (sin->sin_family != AF_INET) + return (EAFNOSUPPORT); + if (sin->sin_port == 0) + return (EADDRNOTAVAIL); + if (!TAILQ_EMPTY(&in_ifaddrhead)) { + /* + * If the destination address is INADDR_ANY, + * use the primary local address. + * If the supplied address is INADDR_BROADCAST, + * and the primary interface supports broadcast, + * choose the broadcast address for that interface. + */ +#define satosin(sa) ((struct sockaddr_in *)(sa)) +#define sintosa(sin) ((struct sockaddr *)(sin)) +#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) + if (sin->sin_addr.s_addr == INADDR_ANY) + sin->sin_addr = IA_SIN(TAILQ_FIRST(&in_ifaddrhead))->sin_addr; + else if (sin->sin_addr.s_addr == (u_long)INADDR_BROADCAST && + (TAILQ_FIRST(&in_ifaddrhead)->ia_ifp->if_flags & IFF_BROADCAST)) + sin->sin_addr = satosin(&TAILQ_FIRST(&in_ifaddrhead)->ia_broadaddr)->sin_addr; + } + if (inp->inp_laddr.s_addr == INADDR_ANY) { + register struct route *ro; + + ia = (struct in_ifaddr *)0; + /* + * If route is known or can be allocated now, + * our src addr is taken from the i/f, else punt. + */ + ro = &inp->inp_route; + if (ro->ro_rt && + (satosin(&ro->ro_dst)->sin_addr.s_addr != + sin->sin_addr.s_addr || + inp->inp_socket->so_options & SO_DONTROUTE)) { + RTFREE(ro->ro_rt); + ro->ro_rt = (struct rtentry *)0; + } + if ((inp->inp_socket->so_options & SO_DONTROUTE) == 0 && /*XXX*/ + (ro->ro_rt == (struct rtentry *)0 || + ro->ro_rt->rt_ifp == (struct ifnet *)0)) { + /* No route yet, so try to acquire one */ + ro->ro_dst.sa_family = AF_INET; + ro->ro_dst.sa_len = sizeof(struct sockaddr_in); + ((struct sockaddr_in *) &ro->ro_dst)->sin_addr = + sin->sin_addr; + rtalloc(ro); + } + /* + * If we found a route, use the address + * corresponding to the outgoing interface + * unless it is the loopback (in case a route + * to our address on another net goes to loopback). + */ + if (ro->ro_rt && !(ro->ro_rt->rt_ifp->if_flags & IFF_LOOPBACK)) + ia = ifatoia(ro->ro_rt->rt_ifa); + if (ia == 0) { + u_short fport = sin->sin_port; + + sin->sin_port = 0; + ia = ifatoia(ifa_ifwithdstaddr(sintosa(sin))); + if (ia == 0) + ia = ifatoia(ifa_ifwithnet(sintosa(sin))); + sin->sin_port = fport; + if (ia == 0) + ia = TAILQ_FIRST(&in_ifaddrhead); + if (ia == 0) + return (EADDRNOTAVAIL); + } + /* + * If the destination address is multicast and an outgoing + * interface has been set as a multicast option, use the + * address of that interface as our source address. + */ + if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr)) && + inp->inp_moptions != NULL) { + struct ip_moptions *imo; + struct ifnet *ifp; + + imo = inp->inp_moptions; + if (imo->imo_multicast_ifp != NULL) { + ifp = imo->imo_multicast_ifp; + TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) + if (ia->ia_ifp == ifp) + break; + if (ia == 0) + return (EADDRNOTAVAIL); + } + } + /* + * Don't do pcblookup call here; return interface in plocal_sin + * and exit to caller, that will do the lookup. + */ + *plocal_sin = &ia->ia_addr; + + } + return(0); +} + +/* + * Outer subroutine: + * Connect from a socket to a specified address. + * Both address and port must be specified in argument sin. + * If don't have a local address for this socket yet, + * then pick one. + */ +int +in_pcbconnect(inp, nam, p) + register struct inpcb *inp; + struct sockaddr *nam; + struct proc *p; +{ + struct sockaddr_in *ifaddr; + struct sockaddr_in *sin = (struct sockaddr_in *)nam; + int error; + + /* + * Call inner routine, to assign local interface address. + */ + if ((error = in_pcbladdr(inp, nam, &ifaddr)) != 0) + return(error); + + if (in_pcblookup_hash(inp->inp_pcbinfo, sin->sin_addr, sin->sin_port, + inp->inp_laddr.s_addr ? inp->inp_laddr : ifaddr->sin_addr, + inp->inp_lport, 0, NULL) != NULL) { + return (EADDRINUSE); + } + if (inp->inp_laddr.s_addr == INADDR_ANY) { + if (inp->inp_lport == 0) { + error = in_pcbbind(inp, (struct sockaddr *)0, p); + if (error) + return (error); + } + inp->inp_laddr = ifaddr->sin_addr; + } + inp->inp_faddr = sin->sin_addr; + inp->inp_fport = sin->sin_port; + in_pcbrehash(inp); +#ifdef IPSEC + if (inp->inp_socket->so_type == SOCK_STREAM) + ipsec_pcbconn(inp->inp_sp); +#endif + return (0); +} + +void +in_pcbdisconnect(inp) + struct inpcb *inp; +{ + + inp->inp_faddr.s_addr = INADDR_ANY; + inp->inp_fport = 0; + in_pcbrehash(inp); + if (inp->inp_socket->so_state & SS_NOFDREF) + in_pcbdetach(inp); +#ifdef IPSEC + ipsec_pcbdisconn(inp->inp_sp); +#endif +} + +void +in_pcbdetach(inp) + struct inpcb *inp; +{ + struct socket *so = inp->inp_socket; + struct inpcbinfo *ipi = inp->inp_pcbinfo; + struct rtentry *rt = inp->inp_route.ro_rt; + +#ifdef IPSEC + ipsec4_delete_pcbpolicy(inp); +#endif /*IPSEC*/ + inp->inp_gencnt = ++ipi->ipi_gencnt; + in_pcbremlists(inp); + so->so_pcb = 0; + sofree(so); + if (inp->inp_options) + (void)m_free(inp->inp_options); + if (rt) { + /* + * route deletion requires reference count to be <= zero + */ + if ((rt->rt_flags & RTF_DELCLONE) && + (rt->rt_flags & RTF_WASCLONED) && + (rt->rt_refcnt <= 1)) { + rt->rt_refcnt--; + rt->rt_flags &= ~RTF_UP; + rtrequest(RTM_DELETE, rt_key(rt), + rt->rt_gateway, rt_mask(rt), + rt->rt_flags, (struct rtentry **)0); + } + else + rtfree(rt); + } + ip_freemoptions(inp->inp_moptions); + inp->inp_vflag = 0; + zfreei(ipi->ipi_zone, inp); +} + +/* + * The calling convention of in_setsockaddr() and in_setpeeraddr() was + * modified to match the pru_sockaddr() and pru_peeraddr() entry points + * in struct pr_usrreqs, so that protocols can just reference then directly + * without the need for a wrapper function. The socket must have a valid + * (i.e., non-nil) PCB, but it should be impossible to get an invalid one + * except through a kernel programming error, so it is acceptable to panic + * (or in this case trap) if the PCB is invalid. (Actually, we don't trap + * because there actually /is/ a programming error somewhere... XXX) + */ +int +in_setsockaddr(so, nam) + struct socket *so; + struct sockaddr **nam; +{ + int s; + register struct inpcb *inp; + register struct sockaddr_in *sin; + + /* + * Do the malloc first in case it blocks. + */ + MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, + M_WAITOK | M_ZERO); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + + s = splnet(); + inp = sotoinpcb(so); + if (!inp) { + splx(s); + free(sin, M_SONAME); + return ECONNRESET; + } + sin->sin_port = inp->inp_lport; + sin->sin_addr = inp->inp_laddr; + splx(s); + + *nam = (struct sockaddr *)sin; + return 0; +} + +int +in_setpeeraddr(so, nam) + struct socket *so; + struct sockaddr **nam; +{ + int s; + struct inpcb *inp; + register struct sockaddr_in *sin; + + /* + * Do the malloc first in case it blocks. + */ + MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, + M_WAITOK | M_ZERO); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + + s = splnet(); + inp = sotoinpcb(so); + if (!inp) { + splx(s); + free(sin, M_SONAME); + return ECONNRESET; + } + sin->sin_port = inp->inp_fport; + sin->sin_addr = inp->inp_faddr; + splx(s); + + *nam = (struct sockaddr *)sin; + return 0; +} + +void +in_pcbnotifyall(head, faddr, errno, notify) + struct inpcbhead *head; + struct in_addr faddr; + void (*notify) __P((struct inpcb *, int)); +{ + struct inpcb *inp, *ninp; + int s; + + s = splnet(); + for (inp = LIST_FIRST(head); inp != NULL; inp = ninp) { + ninp = LIST_NEXT(inp, inp_list); +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV4) == 0) + continue; +#endif + if (inp->inp_faddr.s_addr != faddr.s_addr || + inp->inp_socket == NULL) + continue; + (*notify)(inp, errno); + } + splx(s); +} + +void +in_pcbpurgeif0(head, ifp) + struct inpcb *head; + struct ifnet *ifp; +{ + struct inpcb *inp; + struct ip_moptions *imo; + int i, gap; + + for (inp = head; inp != NULL; inp = LIST_NEXT(inp, inp_list)) { + imo = inp->inp_moptions; + if ((inp->inp_vflag & INP_IPV4) && + imo != NULL) { + /* + * Unselect the outgoing interface if it is being + * detached. + */ + if (imo->imo_multicast_ifp == ifp) + imo->imo_multicast_ifp = NULL; + + /* + * Drop multicast group membership if we joined + * through the interface being detached. + */ + for (i = 0, gap = 0; i < imo->imo_num_memberships; + i++) { + if (imo->imo_membership[i]->inm_ifp == ifp) { + in_delmulti(imo->imo_membership[i]); + gap++; + } else if (gap != 0) + imo->imo_membership[i - gap] = + imo->imo_membership[i]; + } + imo->imo_num_memberships -= gap; + } + } +} + +/* + * Check for alternatives when higher level complains + * about service problems. For now, invalidate cached + * routing information. If the route was created dynamically + * (by a redirect), time to try a default gateway again. + */ +void +in_losing(inp) + struct inpcb *inp; +{ + register struct rtentry *rt; + struct rt_addrinfo info; + + if ((rt = inp->inp_route.ro_rt)) { + bzero((caddr_t)&info, sizeof(info)); + info.rti_info[RTAX_DST] = + (struct sockaddr *)&inp->inp_route.ro_dst; + info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; + info.rti_info[RTAX_NETMASK] = rt_mask(rt); + rt_missmsg(RTM_LOSING, &info, rt->rt_flags, 0); + if (rt->rt_flags & RTF_DYNAMIC) + (void) rtrequest(RTM_DELETE, rt_key(rt), + rt->rt_gateway, rt_mask(rt), rt->rt_flags, + (struct rtentry **)0); + inp->inp_route.ro_rt = 0; + rtfree(rt); + /* + * A new route can be allocated + * the next time output is attempted. + */ + } +} + +/* + * After a routing change, flush old routing + * and allocate a (hopefully) better one. + */ +void +in_rtchange(inp, errno) + register struct inpcb *inp; + int errno; +{ + if (inp->inp_route.ro_rt) { + rtfree(inp->inp_route.ro_rt); + inp->inp_route.ro_rt = 0; + /* + * A new route can be allocated the next time + * output is attempted. + */ + } +} + +/* + * Lookup a PCB based on the local address and port. + */ +struct inpcb * +in_pcblookup_local(pcbinfo, laddr, lport_arg, wild_okay) + struct inpcbinfo *pcbinfo; + struct in_addr laddr; + u_int lport_arg; + int wild_okay; +{ + register struct inpcb *inp; + int matchwild = 3, wildcard; + u_short lport = lport_arg; + + if (!wild_okay) { + struct inpcbhead *head; + /* + * Look for an unconnected (wildcard foreign addr) PCB that + * matches the local address and port we're looking for. + */ + head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0, pcbinfo->hashmask)]; + LIST_FOREACH(inp, head, inp_hash) { +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV4) == 0) + continue; +#endif + if (inp->inp_faddr.s_addr == INADDR_ANY && + inp->inp_laddr.s_addr == laddr.s_addr && + inp->inp_lport == lport) { + /* + * Found. + */ + return (inp); + } + } + /* + * Not found. + */ + return (NULL); + } else { + struct inpcbporthead *porthash; + struct inpcbport *phd; + struct inpcb *match = NULL; + /* + * Best fit PCB lookup. + * + * First see if this local port is in use by looking on the + * port hash list. + */ + porthash = &pcbinfo->porthashbase[INP_PCBPORTHASH(lport, + pcbinfo->porthashmask)]; + LIST_FOREACH(phd, porthash, phd_hash) { + if (phd->phd_port == lport) + break; + } + if (phd != NULL) { + /* + * Port is in use by one or more PCBs. Look for best + * fit. + */ + LIST_FOREACH(inp, &phd->phd_pcblist, inp_portlist) { + wildcard = 0; +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV4) == 0) + continue; +#endif + if (inp->inp_faddr.s_addr != INADDR_ANY) + wildcard++; + if (inp->inp_laddr.s_addr != INADDR_ANY) { + if (laddr.s_addr == INADDR_ANY) + wildcard++; + else if (inp->inp_laddr.s_addr != laddr.s_addr) + continue; + } else { + if (laddr.s_addr != INADDR_ANY) + wildcard++; + } + if (wildcard < matchwild) { + match = inp; + matchwild = wildcard; + if (matchwild == 0) { + break; + } + } + } + } + return (match); + } +} + +/* + * Lookup PCB in hash list. + */ +struct inpcb * +in_pcblookup_hash(pcbinfo, faddr, fport_arg, laddr, lport_arg, wildcard, + ifp) + struct inpcbinfo *pcbinfo; + struct in_addr faddr, laddr; + u_int fport_arg, lport_arg; + int wildcard; + struct ifnet *ifp; +{ + struct inpcbhead *head; + register struct inpcb *inp; + u_short fport = fport_arg, lport = lport_arg; + + /* + * First look for an exact match. + */ + head = &pcbinfo->hashbase[INP_PCBHASH(faddr.s_addr, lport, fport, pcbinfo->hashmask)]; + LIST_FOREACH(inp, head, inp_hash) { +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV4) == 0) + continue; +#endif + if (inp->inp_faddr.s_addr == faddr.s_addr && + inp->inp_laddr.s_addr == laddr.s_addr && + inp->inp_fport == fport && + inp->inp_lport == lport) { + /* + * Found. + */ + return (inp); + } + } + if (wildcard) { + struct inpcb *local_wild = NULL; +#if defined(INET6) + struct inpcb *local_wild_mapped = NULL; +#endif /* defined(INET6) */ + + head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0, pcbinfo->hashmask)]; + LIST_FOREACH(inp, head, inp_hash) { +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV4) == 0) + continue; +#endif + if (inp->inp_faddr.s_addr == INADDR_ANY && + inp->inp_lport == lport) { +#if defined(NFAITH) && NFAITH > 0 + if (ifp && ifp->if_type == IFT_FAITH && + (inp->inp_flags & INP_FAITH) == 0) + continue; +#endif + if (inp->inp_laddr.s_addr == laddr.s_addr) + return (inp); + else if (inp->inp_laddr.s_addr == INADDR_ANY) { +#if defined(INET6) + if (INP_CHECK_SOCKAF(inp->inp_socket, + AF_INET6)) + local_wild_mapped = inp; + else +#endif /* defined(INET6) */ + local_wild = inp; + } + } + } +#if defined(INET6) + if (local_wild == NULL) + return (local_wild_mapped); +#endif /* defined(INET6) */ + return (local_wild); + } + + /* + * Not found. + */ + return (NULL); +} + +/* + * Insert PCB onto various hash lists. + */ +int +in_pcbinshash(inp) + struct inpcb *inp; +{ + struct inpcbhead *pcbhash; + struct inpcbporthead *pcbporthash; + struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; + struct inpcbport *phd; + u_int32_t hashkey_faddr; + +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6) + hashkey_faddr = inp->in6p_faddr.s6_addr32[3] /* XXX */; + else +#endif /* INET6 */ + hashkey_faddr = inp->inp_faddr.s_addr; + + pcbhash = &pcbinfo->hashbase[INP_PCBHASH(hashkey_faddr, + inp->inp_lport, inp->inp_fport, pcbinfo->hashmask)]; + + pcbporthash = &pcbinfo->porthashbase[INP_PCBPORTHASH(inp->inp_lport, + pcbinfo->porthashmask)]; + + /* + * Go through port list and look for a head for this lport. + */ + LIST_FOREACH(phd, pcbporthash, phd_hash) { + if (phd->phd_port == inp->inp_lport) + break; + } + /* + * If none exists, malloc one and tack it on. + */ + if (phd == NULL) { + MALLOC(phd, struct inpcbport *, sizeof(struct inpcbport), M_PCB, M_NOWAIT); + if (phd == NULL) { + return (ENOBUFS); /* XXX */ + } + phd->phd_port = inp->inp_lport; + LIST_INIT(&phd->phd_pcblist); + LIST_INSERT_HEAD(pcbporthash, phd, phd_hash); + } + inp->inp_phd = phd; + LIST_INSERT_HEAD(&phd->phd_pcblist, inp, inp_portlist); + LIST_INSERT_HEAD(pcbhash, inp, inp_hash); + return (0); +} + +/* + * Move PCB to the proper hash bucket when { faddr, fport } have been + * changed. NOTE: This does not handle the case of the lport changing (the + * hashed port list would have to be updated as well), so the lport must + * not change after in_pcbinshash() has been called. + */ +void +in_pcbrehash(inp) + struct inpcb *inp; +{ + struct inpcbhead *head; + u_int32_t hashkey_faddr; + +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6) + hashkey_faddr = inp->in6p_faddr.s6_addr32[3] /* XXX */; + else +#endif /* INET6 */ + hashkey_faddr = inp->inp_faddr.s_addr; + + head = &inp->inp_pcbinfo->hashbase[INP_PCBHASH(hashkey_faddr, + inp->inp_lport, inp->inp_fport, inp->inp_pcbinfo->hashmask)]; + + LIST_REMOVE(inp, inp_hash); + LIST_INSERT_HEAD(head, inp, inp_hash); +} + +/* + * Remove PCB from various lists. + */ +void +in_pcbremlists(inp) + struct inpcb *inp; +{ + inp->inp_gencnt = ++inp->inp_pcbinfo->ipi_gencnt; + if (inp->inp_lport) { + struct inpcbport *phd = inp->inp_phd; + + LIST_REMOVE(inp, inp_hash); + LIST_REMOVE(inp, inp_portlist); + if (LIST_FIRST(&phd->phd_pcblist) == NULL) { + LIST_REMOVE(phd, phd_hash); + free(phd, M_PCB); + } + } + LIST_REMOVE(inp, inp_list); + inp->inp_pcbinfo->ipi_count--; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/in_proto.c b/packages/net/bsd_tcpip/current/src/sys/netinet/in_proto.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/in_proto.c @@ -0,0 +1,241 @@ +//========================================================================== +// +// src/sys/netinet/in_proto.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_proto.c 8.2 (Berkeley) 2/9/95 + * $FreeBSD: src/sys/netinet/in_proto.c,v 1.53.2.4 2001/07/24 19:10:18 brooks Exp $ + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * TCP/IP protocol family: IP, ICMP, UDP, TCP. + */ + +#ifdef IPSEC +#include +#include +#ifdef IPSEC_ESP +#include +#endif +#include +#endif /* IPSEC */ + +#ifdef IPXIP +#include +#endif + +#ifdef NSIP +#include +#include +#endif + +#ifdef NATPT +void natpt_init __P((void)); +int natpt_ctloutput __P((int, struct socket *, int, int, struct mbuf **)); +struct pr_usrreqs natpt_usrreqs; +#endif + +extern struct domain inetdomain; +static struct pr_usrreqs nousrreqs; + +struct protosw inetsw[] = { +{ 0, &inetdomain, 0, 0, + 0, 0, 0, 0, + 0, + ip_init, 0, ip_slowtimo, ip_drain, + &nousrreqs +}, +{ SOCK_DGRAM, &inetdomain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR, + udp_input, 0, udp_ctlinput, ip_ctloutput, + 0, + udp_init, 0, 0, 0, + &udp_usrreqs +}, +{ SOCK_STREAM, &inetdomain, IPPROTO_TCP, + PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD, + tcp_input, 0, tcp_ctlinput, tcp_ctloutput, + 0, + tcp_init, 0, tcp_slowtimo, tcp_drain, + &tcp_usrreqs +}, +{ SOCK_RAW, &inetdomain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR, + rip_input, 0, rip_ctlinput, rip_ctloutput, + 0, + 0, 0, 0, 0, + &rip_usrreqs +}, +{ SOCK_RAW, &inetdomain, IPPROTO_ICMP, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + icmp_input, 0, 0, rip_ctloutput, + 0, + 0, 0, 0, 0, + &rip_usrreqs +}, +{ SOCK_RAW, &inetdomain, IPPROTO_IGMP, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + igmp_input, 0, 0, rip_ctloutput, + 0, + igmp_init, igmp_fasttimo, igmp_slowtimo, 0, + &rip_usrreqs +}, +{ SOCK_RAW, &inetdomain, IPPROTO_RSVP, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + rsvp_input, 0, 0, rip_ctloutput, + 0, + 0, 0, 0, 0, + &rip_usrreqs +}, +#ifdef IPSEC +{ SOCK_RAW, &inetdomain, IPPROTO_AH, PR_ATOMIC|PR_ADDR, + ah4_input, 0, 0, 0, + 0, + 0, 0, 0, 0, + &nousrreqs +}, +#ifdef IPSEC_ESP +{ SOCK_RAW, &inetdomain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR, + esp4_input, 0, 0, 0, + 0, + 0, 0, 0, 0, + &nousrreqs +}, +#endif +{ SOCK_RAW, &inetdomain, IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR, + ipcomp4_input, 0, 0, 0, + 0, + 0, 0, 0, 0, + &nousrreqs +}, +#endif /* IPSEC */ +{ SOCK_RAW, &inetdomain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + encap4_input, 0, 0, rip_ctloutput, + 0, + encap_init, 0, 0, 0, + &rip_usrreqs +}, +# ifdef INET6 +{ SOCK_RAW, &inetdomain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + encap4_input, 0, 0, rip_ctloutput, + 0, + encap_init, 0, 0, 0, + &rip_usrreqs +}, +#endif +#ifdef IPDIVERT +{ SOCK_RAW, &inetdomain, IPPROTO_DIVERT, PR_ATOMIC|PR_ADDR, + div_input, 0, 0, ip_ctloutput, + 0, + div_init, 0, 0, 0, + &div_usrreqs, +}, +#endif +#ifdef IPXIP +{ SOCK_RAW, &inetdomain, IPPROTO_IDP, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + ipxip_input, 0, ipxip_ctlinput, 0, + 0, + 0, 0, 0, 0, + &rip_usrreqs +}, +#endif +#ifdef NSIP +{ SOCK_RAW, &inetdomain, IPPROTO_IDP, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + idpip_input, 0, nsip_ctlinput, 0, + 0, + 0, 0, 0, 0, + &rip_usrreqs +}, +#endif +#ifdef NATPT +{ SOCK_RAW, &inetdomain, IPPROTO_AHIP, PR_ATOMIC|PR_ADDR, + 0, 0, 0, 0, + 0, + natpt_init, 0, 0, 0, + &natpt_usrreqs +}, +#endif + /* raw wildcard */ +{ SOCK_RAW, &inetdomain, 0, PR_ATOMIC|PR_ADDR, + rip_input, 0, 0, rip_ctloutput, + 0, + rip_init, 0, 0, 0, + &rip_usrreqs +}, +}; + +extern int in_inithead __P((void **, int)); + +struct domain inetdomain = + { AF_INET, "internet", 0, 0, 0, + (struct protosw *)inetsw, + (struct protosw *)&inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0, + in_inithead, 32, sizeof(struct sockaddr_in) + }; + +DOMAIN_SET(inet); diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/in_rmx.c b/packages/net/bsd_tcpip/current/src/sys/netinet/in_rmx.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/in_rmx.c @@ -0,0 +1,423 @@ +//========================================================================== +// +// src/sys/netinet/in_rmx.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright 1994, 1995 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. 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. + * + * $FreeBSD: src/sys/netinet/in_rmx.c,v 1.37.2.1 2001/05/14 08:23:49 ru Exp $ + */ + +/* + * This code does two things necessary for the enhanced TCP metrics to + * function in a useful manner: + * 1) It marks all non-host routes as `cloning', thus ensuring that + * every actual reference to such a route actually gets turned + * into a reference to a host route to the specific destination + * requested. + * 2) When such routes lose all their references, it arranges for them + * to be deleted in some random collection of circumstances, so that + * a large quantity of stale routing data is not kept in kernel memory + * indefinitely. See in_rtqtimo() below for the exact mechanism. + */ + +#include +#include +#include + +#include +#include +#include +#include + +extern int in_inithead __P((void **head, int off)); + +#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */ + +/* + * Do what we need to do when inserting a route. + */ +static struct radix_node * +in_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, + struct radix_node *treenodes) +{ + struct rtentry *rt = (struct rtentry *)treenodes; + struct sockaddr_in *sin = (struct sockaddr_in *)rt_key(rt); + struct radix_node *ret; + + /* + * For IP, all unicast non-host routes are automatically cloning. + */ + if(IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) + rt->rt_flags |= RTF_MULTICAST; + + if(!(rt->rt_flags & (RTF_HOST | RTF_CLONING | RTF_MULTICAST))) { + rt->rt_flags |= RTF_PRCLONING; + } + + /* + * A little bit of help for both IP output and input: + * For host routes, we make sure that RTF_BROADCAST + * is set for anything that looks like a broadcast address. + * This way, we can avoid an expensive call to in_broadcast() + * in ip_output() most of the time (because the route passed + * to ip_output() is almost always a host route). + * + * We also do the same for local addresses, with the thought + * that this might one day be used to speed up ip_input(). + * + * We also mark routes to multicast addresses as such, because + * it's easy to do and might be useful (but this is much more + * dubious since it's so easy to inspect the address). (This + * is done above.) + */ + if (rt->rt_flags & RTF_HOST) { + if (in_broadcast(sin->sin_addr, rt->rt_ifp)) { + rt->rt_flags |= RTF_BROADCAST; + } else { +#define satosin(sa) ((struct sockaddr_in *)sa) + if (satosin(rt->rt_ifa->ifa_addr)->sin_addr.s_addr + == sin->sin_addr.s_addr) + rt->rt_flags |= RTF_LOCAL; +#undef satosin + } + } + + if (!rt->rt_rmx.rmx_mtu && !(rt->rt_rmx.rmx_locks & RTV_MTU) + && rt->rt_ifp) + rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; + + ret = rn_addroute(v_arg, n_arg, head, treenodes); + if (ret == NULL && rt->rt_flags & RTF_HOST) { + struct rtentry *rt2; + /* + * We are trying to add a host route, but can't. + * Find out if it is because of an + * ARP entry and delete it if so. + */ + rt2 = rtalloc1((struct sockaddr *)sin, 0, + RTF_CLONING | RTF_PRCLONING); + if (rt2) { + if (rt2->rt_flags & RTF_LLINFO && + rt2->rt_flags & RTF_HOST && + rt2->rt_gateway && + rt2->rt_gateway->sa_family == AF_LINK) { + rtrequest(RTM_DELETE, + (struct sockaddr *)rt_key(rt2), + rt2->rt_gateway, + rt_mask(rt2), rt2->rt_flags, 0); + ret = rn_addroute(v_arg, n_arg, head, + treenodes); + } + RTFREE(rt2); + } + } + return ret; +} + +/* + * This code is the inverse of in_clsroute: on first reference, if we + * were managing the route, stop doing so and set the expiration timer + * back off again. + */ +static struct radix_node * +in_matroute(void *v_arg, struct radix_node_head *head) +{ + struct radix_node *rn = rn_match(v_arg, head); + struct rtentry *rt = (struct rtentry *)rn; + + if(rt && rt->rt_refcnt == 0) { /* this is first reference */ + if(rt->rt_flags & RTPRF_OURS) { + rt->rt_flags &= ~RTPRF_OURS; + rt->rt_rmx.rmx_expire = 0; + } + } + return rn; +} + +static int rtq_reallyold = 60*60; + /* one hour is ``really old'' */ +static int rtq_minreallyold = 10; + /* never automatically crank down to less */ +static int rtq_toomany = 128; + /* 128 cached routes is ``too many'' */ + +/* + * On last reference drop, mark the route as belong to us so that it can be + * timed out. + */ +static void +in_clsroute(struct radix_node *rn, struct radix_node_head *head) +{ + struct rtentry *rt = (struct rtentry *)rn; + + if(!(rt->rt_flags & RTF_UP)) + return; /* prophylactic measures */ + + if((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST) + return; + + if((rt->rt_flags & (RTF_WASCLONED | RTPRF_OURS)) + != RTF_WASCLONED) + return; + + /* + * As requested by David Greenman: + * If rtq_reallyold is 0, just delete the route without + * waiting for a timeout cycle to kill it. + */ + if(rtq_reallyold != 0) { + rt->rt_flags |= RTPRF_OURS; + rt->rt_rmx.rmx_expire = time_second + rtq_reallyold; + } else { + rtrequest(RTM_DELETE, + (struct sockaddr *)rt_key(rt), + rt->rt_gateway, rt_mask(rt), + rt->rt_flags, 0); + } +} + +struct rtqk_arg { + struct radix_node_head *rnh; + int draining; + int killed; + int found; + int updating; + time_t nextstop; +}; + +/* + * Get rid of old routes. When draining, this deletes everything, even when + * the timeout is not expired yet. When updating, this makes sure that + * nothing has a timeout longer than the current value of rtq_reallyold. + */ +static int +in_rtqkill(struct radix_node *rn, void *rock) +{ + struct rtqk_arg *ap = rock; + struct rtentry *rt = (struct rtentry *)rn; + int err; + + if(rt->rt_flags & RTPRF_OURS) { + ap->found++; + + if(ap->draining || rt->rt_rmx.rmx_expire <= time_second) { + if(rt->rt_refcnt > 0) + panic("rtqkill route really not free"); + + err = rtrequest(RTM_DELETE, + (struct sockaddr *)rt_key(rt), + rt->rt_gateway, rt_mask(rt), + rt->rt_flags, 0); + if(err) { + log(LOG_WARNING, "in_rtqkill: error %d\n", err); + } else { + ap->killed++; + } + } else { + if(ap->updating + && (rt->rt_rmx.rmx_expire - time_second + > rtq_reallyold)) { + rt->rt_rmx.rmx_expire = time_second + + rtq_reallyold; + } + ap->nextstop = lmin(ap->nextstop, + rt->rt_rmx.rmx_expire); + } + } + + return 0; +} + +#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ +static int rtq_timeout = RTQ_TIMEOUT; + +static void +in_rtqtimo(void *rock) +{ + struct radix_node_head *rnh = rock; + struct rtqk_arg arg; + struct timeval atv; + static time_t last_adjusted_timeout = 0; + int s; + + arg.found = arg.killed = 0; + arg.rnh = rnh; + arg.nextstop = time_second + rtq_timeout; + arg.draining = arg.updating = 0; + s = splnet(); + rnh->rnh_walktree(rnh, in_rtqkill, &arg); + splx(s); + + /* + * Attempt to be somewhat dynamic about this: + * If there are ``too many'' routes sitting around taking up space, + * then crank down the timeout, and see if we can't make some more + * go away. However, we make sure that we will never adjust more + * than once in rtq_timeout seconds, to keep from cranking down too + * hard. + */ + if((arg.found - arg.killed > rtq_toomany) + && (time_second - last_adjusted_timeout >= rtq_timeout) + && rtq_reallyold > rtq_minreallyold) { + rtq_reallyold = 2*rtq_reallyold / 3; + if(rtq_reallyold < rtq_minreallyold) { + rtq_reallyold = rtq_minreallyold; + } + + last_adjusted_timeout = time_second; +#ifdef DIAGNOSTIC + log(LOG_DEBUG, "in_rtqtimo: adjusted rtq_reallyold to %d\n", + rtq_reallyold); +#endif + arg.found = arg.killed = 0; + arg.updating = 1; + s = splnet(); + rnh->rnh_walktree(rnh, in_rtqkill, &arg); + splx(s); + } + + atv.tv_usec = 0; + atv.tv_sec = arg.nextstop - time_second; + timeout(in_rtqtimo, rock, tvtohz(&atv)); +} + +void +in_rtqdrain(void) +{ + struct radix_node_head *rnh = rt_tables[AF_INET]; + struct rtqk_arg arg; + int s; + arg.found = arg.killed = 0; + arg.rnh = rnh; + arg.nextstop = 0; + arg.draining = 1; + arg.updating = 0; + s = splnet(); + rnh->rnh_walktree(rnh, in_rtqkill, &arg); + splx(s); +} + +/* + * Initialize our routing tree. + */ +int +in_inithead(void **head, int off) +{ + struct radix_node_head *rnh; + + if(!rn_inithead(head, off)) + return 0; + + if(head != (void **)&rt_tables[AF_INET]) /* BOGUS! */ + return 1; /* only do this for the real routing table */ + + rnh = *head; + rnh->rnh_addaddr = in_addroute; + rnh->rnh_matchaddr = in_matroute; + rnh->rnh_close = in_clsroute; + in_rtqtimo(rnh); /* kick off timeout first time */ + return 1; +} + + +/* + * This zaps old routes when the interface goes down or interface + * address is deleted. In the latter case, it deletes static routes + * that point to this address. If we don't do this, we may end up + * using the old address in the future. The ones we always want to + * get rid of are things like ARP entries, since the user might down + * the interface, walk over to a completely different network, and + * plug back in. + */ +struct in_ifadown_arg { + struct radix_node_head *rnh; + struct ifaddr *ifa; + int del; +}; + +static int +in_ifadownkill(struct radix_node *rn, void *xap) +{ + struct in_ifadown_arg *ap = xap; + struct rtentry *rt = (struct rtentry *)rn; + int err; + + if (rt->rt_ifa == ap->ifa && + (ap->del || !(rt->rt_flags & RTF_STATIC))) { + /* + * We need to disable the automatic prune that happens + * in this case in rtrequest() because it will blow + * away the pointers that rn_walktree() needs in order + * continue our descent. We will end up deleting all + * the routes that rtrequest() would have in any case, + * so that behavior is not needed there. + */ + rt->rt_flags &= ~(RTF_CLONING | RTF_PRCLONING); + err = rtrequest(RTM_DELETE, (struct sockaddr *)rt_key(rt), + rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0); + if (err) { + log(LOG_WARNING, "in_ifadownkill: error %d\n", err); + } + } + return 0; +} + +int +in_ifadown(struct ifaddr *ifa, int delete) +{ + struct in_ifadown_arg arg; + struct radix_node_head *rnh; + + if (ifa->ifa_addr->sa_family != AF_INET) + return 1; + + arg.rnh = rnh = rt_tables[AF_INET]; + arg.ifa = ifa; + arg.del = delete; + rnh->rnh_walktree(rnh, in_ifadownkill, &arg); + ifa->ifa_flags &= ~IFA_ROUTE; + return 0; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/ip_encap.c b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_encap.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_encap.c @@ -0,0 +1,1058 @@ +//========================================================================== +// +// src/sys/netinet/ip_encap.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ +/* + * My grandfather said that there's a devil inside tunnelling technology... + * + * We have surprisingly many protocols that want packets with IP protocol + * #4 or #41. Here's a list of protocols that want protocol #41: + * RFC1933 configured tunnel + * RFC1933 automatic tunnel + * RFC2401 IPsec tunnel + * RFC2473 IPv6 generic packet tunnelling + * RFC2529 6over4 tunnel + * RFC3056 6to4 tunnel + * isatap tunnel + * mobile-ip6 (uses RFC2473) + * Here's a list of protocol that want protocol #4: + * RFC1853 IPv4-in-IPv4 tunnelling + * RFC2003 IPv4 encapsulation within IPv4 + * RFC2344 reverse tunnelling for mobile-ip4 + * RFC2401 IPsec tunnel + * Well, what can I say. They impose different en/decapsulation mechanism + * from each other, so they need separate protocol handler. The only one + * we can easily determine by protocol # is IPsec, which always has + * AH/ESP/IPComp header right after outer IP header. + * + * So, clearly good old protosw does not work for protocol #4 and #41. + * The code will let you match protocol via src/dst address pair. + */ +/* XXX is M_NETADDR correct? */ + +/* + * With USE_RADIX the code will use radix table for tunnel lookup, for + * tunnels registered with encap_attach() with a addr/mask pair. + * Faster on machines with thousands of tunnel registerations (= interfaces). + * + * The code assumes that radix table code can handle non-continuous netmask, + * as it will pass radix table memory region with (src + dst) sockaddr pair. + * + * FreeBSD is excluded here as they make max_keylen a static variable, and + * thus forbid definition of radix table other than proper domains. + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#ifdef MROUTING +#include +#endif /* MROUTING */ +#ifdef __OpenBSD__ +#include +#endif + +#ifdef INET6 +#include +#include +#include +#include +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#else +#include +#endif +#include +#endif + +#include +#include + +/* to lookup a pair of address using radix tree */ +struct sockaddr_pack { + u_int8_t sp_len; + u_int8_t sp_family; /* not really used */ + /* followed by variable-length data */ +} __attribute__((__packed__)); + +struct pack4 { + struct sockaddr_pack p; + struct sockaddr_in mine; + struct sockaddr_in yours; +} __attribute__((__packed__)); +struct pack6 { + struct sockaddr_pack p; + struct sockaddr_in6 mine; + struct sockaddr_in6 yours; +} __attribute__((__packed__)); + +enum direction { INBOUND, OUTBOUND }; + +#ifdef INET +static struct encaptab *encap4_lookup __P((struct mbuf *, int, int, + enum direction)); +#endif +#ifdef INET6 +static struct encaptab *encap6_lookup __P((struct mbuf *, int, int, + enum direction)); +#endif +static int encap_add __P((struct encaptab *)); +static int encap_remove __P((struct encaptab *)); +static int encap_afcheck __P((int, const struct sockaddr *, const struct sockaddr *)); +#ifdef USE_RADIX +static struct radix_node_head *encap_rnh __P((int)); +static int mask_matchlen __P((const struct sockaddr *)); +#endif +#ifndef USE_RADIX +static int mask_match __P((const struct encaptab *, const struct sockaddr *, + const struct sockaddr *)); +#endif +static void encap_fillarg __P((struct mbuf *, const struct encaptab *)); + +#ifndef LIST_HEAD_INITIALIZER +/* rely upon BSS initialization */ +LIST_HEAD(, encaptab) encaptab; +#else +LIST_HEAD(, encaptab) encaptab = LIST_HEAD_INITIALIZER(&encaptab); +#endif + +#ifdef USE_RADIX +extern int max_keylen; /* radix.c */ +struct radix_node_head *encap_head[2]; /* 0 for AF_INET, 1 for AF_INET6 */ +#endif + +void +encap_init() +{ + static int initialized = 0; + + if (initialized) + return; + initialized++; +#if 0 + /* + * we cannot use LIST_INIT() here, since drivers may want to call + * encap_attach(), on driver attach. encap_init() will be called + * on AF_INET{,6} initialization, which happens after driver + * initialization - using LIST_INIT() here can nuke encap_attach() + * from drivers. + */ + LIST_INIT(&encaptab); +#endif + +#ifdef USE_RADIX + /* + * initialize radix lookup table. + * max_keylen initialization should happen before the call to rn_init(). + */ + rn_inithead((void **)&encap_head[0], sizeof(struct sockaddr_pack) << 3); + if (sizeof(struct pack4) > max_keylen) + max_keylen = sizeof(struct pack4); +#ifdef INET6 + rn_inithead((void **)&encap_head[1], sizeof(struct sockaddr_pack) << 3); + if (sizeof(struct pack6) > max_keylen) + max_keylen = sizeof(struct pack6); +#endif +#endif +} + +#ifdef INET +static struct encaptab * +encap4_lookup(m, off, proto, dir) + struct mbuf *m; + int off; + int proto; + enum direction dir; +{ + struct ip *ip; + struct pack4 pack; + struct encaptab *ep, *match; + int prio, matchprio; +#ifdef USE_RADIX + struct radix_node_head *rnh = encap_rnh(AF_INET); + struct radix_node *rn; +#endif + +#ifdef DIAGNOSTIC + if (m->m_len < sizeof(*ip)) + panic("encap4_lookup"); +#endif + ip = mtod(m, struct ip *); + + bzero(&pack, sizeof(pack)); + pack.p.sp_len = sizeof(pack); + pack.mine.sin_family = pack.yours.sin_family = AF_INET; + pack.mine.sin_len = pack.yours.sin_len = sizeof(struct sockaddr_in); + if (dir == INBOUND) { + pack.mine.sin_addr = ip->ip_dst; + pack.yours.sin_addr = ip->ip_src; + } else { + pack.mine.sin_addr = ip->ip_src; + pack.yours.sin_addr = ip->ip_dst; + } + + match = NULL; + matchprio = 0; + +#ifdef USE_RADIX + rn = rnh->rnh_matchaddr((caddr_t)&pack, rnh); + if (rn && (rn->rn_flags & RNF_ROOT) == 0) { + match = (struct encaptab *)rn; + matchprio = mask_matchlen(match->srcmask) + + mask_matchlen(match->dstmask); + } +#endif + + for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) { + if (ep->af != AF_INET) + continue; + if (ep->proto >= 0 && ep->proto != proto) + continue; + if (ep->func) + prio = (*ep->func)(m, off, proto, ep->arg); + else { +#ifdef USE_RADIX + continue; +#else + prio = mask_match(ep, (struct sockaddr *)&pack.mine, + (struct sockaddr *)&pack.yours); +#endif + } + + /* + * We prioritize the matches by using bit length of the + * matches. mask_match() and user-supplied matching function + * should return the bit length of the matches (for example, + * if both src/dst are matched for IPv4, 64 should be returned). + * 0 or negative return value means "it did not match". + * + * The question is, since we have two "mask" portion, we + * cannot really define total order between entries. + * For example, which of these should be preferred? + * mask_match() returns 48 (32 + 16) for both of them. + * src=3ffe::/16, dst=3ffe:501::/32 + * src=3ffe:501::/32, dst=3ffe::/16 + * + * We need to loop through all the possible candidates + * to get the best match - the search takes O(n) for + * n attachments (i.e. interfaces). + * + * For radix-based lookup, I guess source takes precedence. + * See rn_{refines,lexobetter} for the correct answer. + */ + if (prio <= 0) + continue; + if (prio > matchprio) { + matchprio = prio; + match = ep; + } + } + + return match; +#undef s +#undef d +} + +void +#if (defined(__FreeBSD__) && __FreeBSD__ >= 4) +encap4_input(struct mbuf *m, int off) +#else +#if __STDC__ +encap4_input(struct mbuf *m, ...) +#else +encap4_input(m, va_alist) + struct mbuf *m; + va_dcl +#endif +#endif /* (defined(__FreeBSD__) && __FreeBSD__ >= 4) */ +{ +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 4) + int off, proto; + va_list ap; +#else + int proto; +#endif /* !(defined(__FreeBSD__) && __FreeBSD__ >= 4) */ + const struct protosw *psw; + struct encaptab *match; + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 4) + va_start(ap, m); + off = va_arg(ap, int); +#if !defined(__OpenBSD__) + proto = va_arg(ap, int); +#endif + va_end(ap); +#endif /* !(defined(__FreeBSD__) && __FreeBSD__ >= 4) */ + +#if defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 4) + proto = mtod(m, struct ip *)->ip_p; +#endif + + match = encap4_lookup(m, off, proto, INBOUND); + + if (match) { + /* found a match, "match" has the best one */ + psw = match->psw; + if (psw && psw->pr_input) { + encap_fillarg(m, match); +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 + (*psw->pr_input)(m, off); +#else + (*psw->pr_input)(m, off, proto); +#endif + } else + m_freem(m); + return; + } + + /* for backward compatibility - messy... */ +#if defined(__NetBSD__) + /* last resort: inject to raw socket */ + rip_input(m, off, proto); +#elif defined(__OpenBSD__) +# if defined(MROUTING) || defined(IPSEC) + if (proto == IPPROTO_IPV4) { + ip4_input(m, off, proto); + return; + } +# endif + + /* last resort: inject to raw socket */ + rip_input(m, off, proto); +#elif (defined(__FreeBSD__) && __FreeBSD__ >= 5) + /* last resort: inject to raw socket */ + rip_input(m, off); +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 +#ifdef MROUTING + if (proto == IPPROTO_IPV4) { + ipip_input(m, off); + return; + } +#endif + + /* last resort: inject to raw socket */ + rip_input(m, off); +#else +#ifdef MROUTING + if (proto == IPPROTO_IPV4) { + ipip_input(m, off, proto); + return; + } +#endif + + /* last resort: inject to raw socket */ + rip_input(m, off, proto); +#endif +} +#endif + +#ifdef INET6 +static struct encaptab * +encap6_lookup(m, off, proto, dir) + struct mbuf *m; + int off; + int proto; + enum direction dir; +{ + struct ip6_hdr *ip6; + struct pack6 pack; + int prio, matchprio; + struct encaptab *ep, *match; +#ifdef USE_RADIX + struct radix_node_head *rnh = encap_rnh(AF_INET6); + struct radix_node *rn; +#endif + +#ifdef DIAGNOSTIC + if (m->m_len < sizeof(*ip6)) + panic("encap6_lookup"); +#endif + ip6 = mtod(m, struct ip6_hdr *); + + bzero(&pack, sizeof(pack)); + pack.p.sp_len = sizeof(pack); + pack.mine.sin6_family = pack.yours.sin6_family = AF_INET6; + pack.mine.sin6_len = pack.yours.sin6_len = sizeof(struct sockaddr_in6); + if (dir == INBOUND) { + pack.mine.sin6_addr = ip6->ip6_dst; + pack.yours.sin6_addr = ip6->ip6_src; + } else { + pack.mine.sin6_addr = ip6->ip6_src; + pack.yours.sin6_addr = ip6->ip6_dst; + } + + match = NULL; + matchprio = 0; + +#ifdef USE_RADIX + rn = rnh->rnh_matchaddr((caddr_t)&pack, rnh); + if (rn && (rn->rn_flags & RNF_ROOT) == 0) { + match = (struct encaptab *)rn; + matchprio = mask_matchlen(match->srcmask) + + mask_matchlen(match->dstmask); + } +#endif + + for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) { + if (ep->af != AF_INET6) + continue; + if (ep->proto >= 0 && ep->proto != proto) + continue; + if (ep->func) + prio = (*ep->func)(m, off, proto, ep->arg); + else { +#ifdef USE_RADIX + continue; +#else + prio = mask_match(ep, (struct sockaddr *)&pack.mine, + (struct sockaddr *)&pack.yours); +#endif + } + + /* see encap4_lookup() for issues here */ + if (prio <= 0) + continue; + if (prio > matchprio) { + matchprio = prio; + match = ep; + } + } + + return match; +#undef s +#undef d +} + +int +encap6_input(mp, offp, proto) + struct mbuf **mp; + int *offp; + int proto; +{ + struct mbuf *m = *mp; + const struct ip6protosw *psw; + struct encaptab *match; + + match = encap6_lookup(m, *offp, proto, INBOUND); + + if (match) { + /* found a match */ + psw = (const struct ip6protosw *)match->psw; + if (psw && psw->pr_input) { + encap_fillarg(m, match); + return (*psw->pr_input)(mp, offp, proto); + } else { + m_freem(m); + return IPPROTO_DONE; + } + } + +#ifdef __OpenBSD__ + /* last resort */ + return ip4_input6(mp, offp, 0); /* XXX last argument ignored */ +#else + /* last resort: inject to raw socket */ + return rip6_input(mp, offp, proto); +#endif +} +#endif + +static int +encap_add(ep) + struct encaptab *ep; +{ +#ifdef USE_RADIX + struct radix_node_head *rnh = encap_rnh(ep->af); +#endif + int error = 0; + + LIST_INSERT_HEAD(&encaptab, ep, chain); +#ifdef USE_RADIX + if (!ep->func && rnh) { + if (!rnh->rnh_addaddr((caddr_t)ep->addrpack, + (caddr_t)ep->maskpack, rnh, ep->nodes)) { + error = EEXIST; + goto fail; + } + } +#endif + return error; + +#ifdef USE_RADIX + fail: + LIST_REMOVE(ep, chain); + return error; +#endif +} + +static int +encap_remove(ep) + struct encaptab *ep; +{ +#ifdef USE_RADIX + struct radix_node_head *rnh = encap_rnh(ep->af); +#endif + int error = 0; + + LIST_REMOVE(ep, chain); +#ifdef USE_RADIX + if (!ep->func && rnh) { + if (!rnh->rnh_deladdr((caddr_t)ep->addrpack, + (caddr_t)ep->maskpack, rnh)) + error = ESRCH; + } +#endif + return error; +} + +static int +encap_afcheck(af, sp, dp) + int af; + const struct sockaddr *sp; + const struct sockaddr *dp; +{ + if (sp && dp) { + if (sp->sa_len != dp->sa_len) + return EINVAL; + if (af != sp->sa_family || af != dp->sa_family) + return EINVAL; + } else if (!sp && !dp) + ; + else + return EINVAL; + + switch (af) { + case AF_INET: + if (sp && sp->sa_len != sizeof(struct sockaddr_in)) + return EINVAL; + if (dp && dp->sa_len != sizeof(struct sockaddr_in)) + return EINVAL; + break; +#ifdef INET6 + case AF_INET6: + if (sp && sp->sa_len != sizeof(struct sockaddr_in6)) + return EINVAL; + if (dp && dp->sa_len != sizeof(struct sockaddr_in6)) + return EINVAL; + break; +#endif + default: + return EAFNOSUPPORT; + } + + return 0; +} + +/* + * sp (src ptr) is always my side, and dp (dst ptr) is always remote side. + * length of mask (sm and dm) is assumed to be same as sp/dp. + * Return value will be necessary as input (cookie) for encap_detach(). + */ +const struct encaptab * +encap_attach(af, proto, sp, sm, dp, dm, psw, arg) + int af; + int proto; + const struct sockaddr *sp, *sm; + const struct sockaddr *dp, *dm; + const struct protosw *psw; + void *arg; +{ + struct encaptab *ep; + int error; + int s; + size_t l; + struct pack4 *pack4; +#ifdef INET6 + struct pack6 *pack6; +#endif + +#if defined(__NetBSD__) || defined(__OpenBSD__) + s = splsoftnet(); +#else + s = splnet(); +#endif + /* sanity check on args */ + error = encap_afcheck(af, sp, dp); + if (error) + goto fail; + + /* check if anyone have already attached with exactly same config */ + for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) { + if (ep->af != af) + continue; + if (ep->proto != proto) + continue; + if (ep->func) + continue; +#ifdef DIAGNOSTIC + if (!ep->src || !ep->dst || !ep->srcmask || !ep->dstmask) + panic("null pointers in encaptab"); +#endif + if (ep->src->sa_len != sp->sa_len || + bcmp(ep->src, sp, sp->sa_len) != 0 || + bcmp(ep->srcmask, sm, sp->sa_len) != 0) + continue; + if (ep->dst->sa_len != dp->sa_len || + bcmp(ep->dst, dp, dp->sa_len) != 0 || + bcmp(ep->dstmask, dm, dp->sa_len) != 0) + continue; + + error = EEXIST; + goto fail; + } + + switch (af) { + case AF_INET: + l = sizeof(*pack4); + break; +#ifdef INET6 + case AF_INET6: + l = sizeof(*pack6); + break; +#endif + default: + goto fail; + } + +#ifdef DIAGNOSTIC + /* if l exceeds the value sa_len can possibly express, it's wrong. */ + if (l > (1 << (8 * sizeof(ep->addrpack->sa_len)))) { + error = EINVAL; + goto fail; + } +#endif + + ep = malloc(sizeof(*ep), M_NETADDR, M_NOWAIT); /* M_NETADDR ok? */ + if (ep == NULL) { + error = ENOBUFS; + goto fail; + } + bzero(ep, sizeof(*ep)); + ep->addrpack = malloc(l, M_NETADDR, M_NOWAIT); + if (ep->addrpack == NULL) { + error = ENOBUFS; + goto gc; + } + ep->maskpack = malloc(l, M_NETADDR, M_NOWAIT); + if (ep->maskpack == NULL) { + error = ENOBUFS; + goto gc; + } + + ep->af = af; + ep->proto = proto; + ep->addrpack->sa_len = l & 0xff; + ep->maskpack->sa_len = l & 0xff; + switch (af) { + case AF_INET: + pack4 = (struct pack4 *)ep->addrpack; + ep->src = (struct sockaddr *)&pack4->mine; + ep->dst = (struct sockaddr *)&pack4->yours; + pack4 = (struct pack4 *)ep->maskpack; + ep->srcmask = (struct sockaddr *)&pack4->mine; + ep->dstmask = (struct sockaddr *)&pack4->yours; + break; +#ifdef INET6 + case AF_INET6: + pack6 = (struct pack6 *)ep->addrpack; + ep->src = (struct sockaddr *)&pack6->mine; + ep->dst = (struct sockaddr *)&pack6->yours; + pack6 = (struct pack6 *)ep->maskpack; + ep->srcmask = (struct sockaddr *)&pack6->mine; + ep->dstmask = (struct sockaddr *)&pack6->yours; + break; +#endif + } + + bcopy(sp, ep->src, sp->sa_len); + bcopy(sm, ep->srcmask, sp->sa_len); + bcopy(dp, ep->dst, dp->sa_len); + bcopy(dm, ep->dstmask, dp->sa_len); + ep->psw = psw; + ep->arg = arg; + + error = encap_add(ep); + if (error) + goto gc; + + error = 0; + splx(s); + return ep; + +gc: + if (ep->addrpack) + free(ep->addrpack, M_NETADDR); + if (ep->maskpack) + free(ep->maskpack, M_NETADDR); + if (ep) + free(ep, M_NETADDR); +fail: + splx(s); + return NULL; +} + +const struct encaptab * +encap_attach_func(af, proto, func, psw, arg) + int af; + int proto; + int (*func) __P((const struct mbuf *, int, int, void *)); + const struct protosw *psw; + void *arg; +{ + struct encaptab *ep; + int error; + int s; + +#if defined(__NetBSD__) || defined(__OpenBSD__) + s = splsoftnet(); +#else + s = splnet(); +#endif + /* sanity check on args */ + if (!func) { + error = EINVAL; + goto fail; + } + + error = encap_afcheck(af, NULL, NULL); + if (error) + goto fail; + + ep = malloc(sizeof(*ep), M_NETADDR, M_NOWAIT); /*XXX*/ + if (ep == NULL) { + error = ENOBUFS; + goto fail; + } + bzero(ep, sizeof(*ep)); + + ep->af = af; + ep->proto = proto; + ep->func = func; + ep->psw = psw; + ep->arg = arg; + + error = encap_add(ep); + if (error) + goto fail; + + error = 0; + splx(s); + return ep; + +fail: + splx(s); + return NULL; +} + +/* XXX encap4_ctlinput() is necessary if we set DF=1 on outer IPv4 header */ + +#ifdef INET6 +#if defined(HAVE_NRL_INPCB) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) +#undef in6_rtchange +#define in6_rtchange in_rtchange +#define in6pcb inpcb +#endif + +void +encap6_ctlinput(cmd, sa, d0) + int cmd; + struct sockaddr *sa; + void *d0; +{ + void *d = d0; + struct ip6_hdr *ip6; + struct mbuf *m; + int off; + struct ip6ctlparam *ip6cp = NULL; + const struct sockaddr_in6 *sa6_src = NULL; + void *cmdarg; + int nxt; + struct encaptab *ep; + const struct ip6protosw *psw; + + if (sa->sa_family != AF_INET6 || + sa->sa_len != sizeof(struct sockaddr_in6)) + return; + + if ((unsigned)cmd >= PRC_NCMDS) + return; + if (cmd == PRC_HOSTDEAD) + d = NULL; +#if defined(__NetBSD__) || defined(__OpenBSD__) + else if (cmd == PRC_MSGSIZE) + ; /* special code is present, see below */ +#endif + else if (inet6ctlerrmap[cmd] == 0) + return; + + /* if the parameter is from icmp6, decode it. */ + if (d != NULL) { + ip6cp = (struct ip6ctlparam *)d; + m = ip6cp->ip6c_m; + ip6 = ip6cp->ip6c_ip6; + off = ip6cp->ip6c_off; + cmdarg = ip6cp->ip6c_cmdarg; + sa6_src = ip6cp->ip6c_src; + nxt = ip6cp->ip6c_nxt; + } else { + m = NULL; + ip6 = NULL; + cmdarg = NULL; + sa6_src = &sa6_any; + nxt = -1; + } + +#if defined(__NetBSD__) || defined(__OpenBSD__) + if (ip6 && cmd == PRC_MSGSIZE) { + int valid = 0; + struct encaptab *match; + + /* + * Check to see if we have a valid encap configuration. + */ + match = encap6_lookup(m, off, nxt, OUTBOUND); + + if (match) + valid++; + + /* + * Depending on the value of "valid" and routing table + * size (mtudisc_{hi,lo}wat), we will: + * - recalcurate the new MTU and create the + * corresponding routing entry, or + * - ignore the MTU change notification. + */ + icmp6_mtudisc_update((struct ip6ctlparam *)d, valid); + } +#endif + + /* inform all listeners */ + for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) { + if (ep->af != AF_INET6) + continue; + if (ep->proto >= 0 && ep->proto != nxt) + continue; + + /* should optimize by looking at address pairs */ + + /* XXX need to pass ep->arg or ep itself to listeners */ + psw = (const struct ip6protosw *)ep->psw; + if (psw && psw->pr_ctlinput) + (*psw->pr_ctlinput)(cmd, sa, d); + } + + rip6_ctlinput(cmd, sa, d0); +} +#endif + +int +encap_detach(cookie) + const struct encaptab *cookie; +{ + const struct encaptab *ep = cookie; + struct encaptab *p; + int error; + + for (p = LIST_FIRST(&encaptab); p; p = LIST_NEXT(p, chain)) { + if (p == ep) { + error = encap_remove(p); + if (error) + return error; + if (!ep->func) { + free(p->addrpack, M_NETADDR); + free(p->maskpack, M_NETADDR); + } + free(p, M_NETADDR); /*XXX*/ + return 0; + } + } + + return ENOENT; +} + +#ifdef USE_RADIX +static struct radix_node_head * +encap_rnh(af) + int af; +{ + + switch (af) { + case AF_INET: + return encap_head[0]; +#ifdef INET6 + case AF_INET6: + return encap_head[1]; +#endif + default: + return NULL; + } +} + +static int +mask_matchlen(sa) + const struct sockaddr *sa; +{ + const char *p, *ep; + int l; + + p = (const char *)sa; + ep = p + sa->sa_len; + p += 2; /* sa_len + sa_family */ + + l = 0; + while (p < ep) { + l += (*p ? 8 : 0); /* estimate */ + p++; + } + return l; +} +#endif + +#ifndef USE_RADIX +static int +mask_match(ep, sp, dp) + const struct encaptab *ep; + const struct sockaddr *sp; + const struct sockaddr *dp; +{ + struct sockaddr_storage s; + struct sockaddr_storage d; + int i; + const u_int8_t *p, *q; + u_int8_t *r; + int matchlen; + +#ifdef DIAGNOSTIC + if (ep->func) + panic("wrong encaptab passed to mask_match"); +#endif + if (sp->sa_len > sizeof(s) || dp->sa_len > sizeof(d)) + return 0; + if (sp->sa_family != ep->af || dp->sa_family != ep->af) + return 0; + if (sp->sa_len != ep->src->sa_len || dp->sa_len != ep->dst->sa_len) + return 0; + + matchlen = 0; + + p = (const u_int8_t *)sp; + q = (const u_int8_t *)ep->srcmask; + r = (u_int8_t *)&s; + for (i = 0 ; i < sp->sa_len; i++) { + r[i] = p[i] & q[i]; + /* XXX estimate */ + matchlen += (q[i] ? 8 : 0); + } + + p = (const u_int8_t *)dp; + q = (const u_int8_t *)ep->dstmask; + r = (u_int8_t *)&d; + for (i = 0 ; i < dp->sa_len; i++) { + r[i] = p[i] & q[i]; + /* XXX rough estimate */ + matchlen += (q[i] ? 8 : 0); + } + + /* need to overwrite len/family portion as we don't compare them */ + s.ss_len = sp->sa_len; + s.ss_family = sp->sa_family; + d.ss_len = dp->sa_len; + d.ss_family = dp->sa_family; + + if (bcmp(&s, ep->src, ep->src->sa_len) == 0 && + bcmp(&d, ep->dst, ep->dst->sa_len) == 0) { + return matchlen; + } else + return 0; +} +#endif + +static void +encap_fillarg(m, ep) + struct mbuf *m; + const struct encaptab *ep; +{ + struct mbuf *n; + + n = m_aux_add(m, AF_INET, IPPROTO_IPV4); + if (n) { + *mtod(n, void **) = ep->arg; + n->m_len = sizeof(void *); + } +} + +void * +encap_getarg(m) + struct mbuf *m; +{ + void *p; + struct mbuf *n; + + p = NULL; + n = m_aux_find(m, AF_INET, IPPROTO_IPV4); + if (n) { + if (n->m_len == sizeof(void *)) + p = *mtod(n, void **); + m_aux_delete(m, n); + } + return p; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/ip_flow.c b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_flow.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_flow.c @@ -0,0 +1,346 @@ +//========================================================================== +// +// src/sys/netinet/ip_flow.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by the 3am Software Foundry ("3am"). It was developed by Matt Thomas. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + * + * $FreeBSD: src/sys/netinet/ip_flow.c,v 1.9.2.1 2001/08/08 08:20:35 ru Exp $ + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#define IPFLOW_TIMER (5 * PR_SLOWHZ) +#define IPFLOW_HASHBITS 6 /* should not be a multiple of 8 */ +#define IPFLOW_HASHSIZE (1 << IPFLOW_HASHBITS) +static LIST_HEAD(ipflowhead, ipflow) ipflows[IPFLOW_HASHSIZE]; +static int ipflow_inuse; +#define IPFLOW_MAX 256 + +static int ipflow_active = 0; + +static unsigned +ipflow_hash( + struct in_addr dst, + struct in_addr src, + unsigned tos) +{ + unsigned hash = tos; + int idx; + for (idx = 0; idx < 32; idx += IPFLOW_HASHBITS) + hash += (dst.s_addr >> (32 - idx)) + (src.s_addr >> idx); + return hash & (IPFLOW_HASHSIZE-1); +} + +static struct ipflow * +ipflow_lookup( + const struct ip *ip) +{ + unsigned hash; + struct ipflow *ipf; + + hash = ipflow_hash(ip->ip_dst, ip->ip_src, ip->ip_tos); + + ipf = LIST_FIRST(&ipflows[hash]); + while (ipf != NULL) { + if (ip->ip_dst.s_addr == ipf->ipf_dst.s_addr + && ip->ip_src.s_addr == ipf->ipf_src.s_addr + && ip->ip_tos == ipf->ipf_tos) + break; + ipf = LIST_NEXT(ipf, ipf_next); + } + return ipf; +} + +int +ipflow_fastforward( + struct mbuf *m) +{ + struct ip *ip; + struct ipflow *ipf; + struct rtentry *rt; + struct sockaddr *dst; + int error; + + /* + * Are we forwarding packets? Big enough for an IP packet? + */ + if (!ipforwarding || !ipflow_active || m->m_len < sizeof(struct ip)) + return 0; + /* + * IP header with no option and valid version and length + */ + ip = mtod(m, struct ip *); + if (ip->ip_v != IPVERSION || ip->ip_hl != (sizeof(struct ip) >> 2) + || ntohs(ip->ip_len) > m->m_pkthdr.len) + return 0; + /* + * Find a flow. + */ + if ((ipf = ipflow_lookup(ip)) == NULL) + return 0; + + /* + * Route and interface still up? + */ + rt = ipf->ipf_ro.ro_rt; + if ((rt->rt_flags & RTF_UP) == 0 || (rt->rt_ifp->if_flags & IFF_UP) == 0) + return 0; + + /* + * Packet size OK? TTL? + */ + if (m->m_pkthdr.len > rt->rt_ifp->if_mtu || ip->ip_ttl <= IPTTLDEC) + return 0; + + /* + * Everything checks out and so we can forward this packet. + * Modify the TTL and incrementally change the checksum. + */ + ip->ip_ttl -= IPTTLDEC; + if (ip->ip_sum >= htons(0xffff - (IPTTLDEC << 8))) { + ip->ip_sum += htons(IPTTLDEC << 8) + 1; + } else { + ip->ip_sum += htons(IPTTLDEC << 8); + } + + /* + * Send the packet on its way. All we can get back is ENOBUFS + */ + ipf->ipf_uses++; + ipf->ipf_timer = IPFLOW_TIMER; + + if (rt->rt_flags & RTF_GATEWAY) + dst = rt->rt_gateway; + else + dst = &ipf->ipf_ro.ro_dst; + if ((error = (*rt->rt_ifp->if_output)(rt->rt_ifp, m, dst, rt)) != 0) { + if (error == ENOBUFS) + ipf->ipf_dropped++; + else + ipf->ipf_errors++; + } + return 1; +} + +static void +ipflow_addstats( + struct ipflow *ipf) +{ + ipf->ipf_ro.ro_rt->rt_use += ipf->ipf_uses; + ipstat.ips_cantforward += ipf->ipf_errors + ipf->ipf_dropped; + ipstat.ips_forward += ipf->ipf_uses; + ipstat.ips_fastforward += ipf->ipf_uses; +} + +static void +ipflow_free( + struct ipflow *ipf) +{ + int s; + /* + * Remove the flow from the hash table (at elevated IPL). + * Once it's off the list, we can deal with it at normal + * network IPL. + */ + s = splimp(); + LIST_REMOVE(ipf, ipf_next); + splx(s); + ipflow_addstats(ipf); + RTFREE(ipf->ipf_ro.ro_rt); + ipflow_inuse--; + FREE(ipf, M_IPFLOW); +} + +static struct ipflow * +ipflow_reap( + void) +{ + struct ipflow *ipf, *maybe_ipf = NULL; + int idx; + int s; + + for (idx = 0; idx < IPFLOW_HASHSIZE; idx++) { + ipf = LIST_FIRST(&ipflows[idx]); + while (ipf != NULL) { + /* + * If this no longer points to a valid route + * reclaim it. + */ + if ((ipf->ipf_ro.ro_rt->rt_flags & RTF_UP) == 0) + goto done; + /* + * choose the one that's been least recently used + * or has had the least uses in the last 1.5 + * intervals. + */ + if (maybe_ipf == NULL + || ipf->ipf_timer < maybe_ipf->ipf_timer + || (ipf->ipf_timer == maybe_ipf->ipf_timer + && ipf->ipf_last_uses + ipf->ipf_uses < + maybe_ipf->ipf_last_uses + + maybe_ipf->ipf_uses)) + maybe_ipf = ipf; + ipf = LIST_NEXT(ipf, ipf_next); + } + } + ipf = maybe_ipf; + done: + /* + * Remove the entry from the flow table. + */ + s = splimp(); + LIST_REMOVE(ipf, ipf_next); + splx(s); + ipflow_addstats(ipf); + RTFREE(ipf->ipf_ro.ro_rt); + return ipf; +} + +void +ipflow_slowtimo( + void) +{ + struct ipflow *ipf; + int idx; + + for (idx = 0; idx < IPFLOW_HASHSIZE; idx++) { + ipf = LIST_FIRST(&ipflows[idx]); + while (ipf != NULL) { + struct ipflow *next_ipf = LIST_NEXT(ipf, ipf_next); + if (--ipf->ipf_timer == 0) { + ipflow_free(ipf); + } else { + ipf->ipf_last_uses = ipf->ipf_uses; + ipf->ipf_ro.ro_rt->rt_use += ipf->ipf_uses; + ipstat.ips_forward += ipf->ipf_uses; + ipstat.ips_fastforward += ipf->ipf_uses; + ipf->ipf_uses = 0; + } + ipf = next_ipf; + } + } +} + +void +ipflow_create( + const struct route *ro, + struct mbuf *m) +{ + const struct ip *const ip = mtod(m, struct ip *); + struct ipflow *ipf; + unsigned hash; + int s; + + /* + * Don't create cache entries for ICMP messages. + */ + if (!ipflow_active || ip->ip_p == IPPROTO_ICMP) + return; + /* + * See if an existing flow struct exists. If so remove it from it's + * list and free the old route. If not, try to malloc a new one + * (if we aren't at our limit). + */ + ipf = ipflow_lookup(ip); + if (ipf == NULL) { + if (ipflow_inuse == IPFLOW_MAX) { + ipf = ipflow_reap(); + } else { + ipf = (struct ipflow *) malloc(sizeof(*ipf), M_IPFLOW, + M_NOWAIT); + if (ipf == NULL) + return; + ipflow_inuse++; + } + bzero((caddr_t) ipf, sizeof(*ipf)); + } else { + s = splimp(); + LIST_REMOVE(ipf, ipf_next); + splx(s); + ipflow_addstats(ipf); + RTFREE(ipf->ipf_ro.ro_rt); + ipf->ipf_uses = ipf->ipf_last_uses = 0; + ipf->ipf_errors = ipf->ipf_dropped = 0; + } + + /* + * Fill in the updated information. + */ + ipf->ipf_ro = *ro; + ro->ro_rt->rt_refcnt++; + ipf->ipf_dst = ip->ip_dst; + ipf->ipf_src = ip->ip_src; + ipf->ipf_tos = ip->ip_tos; + ipf->ipf_timer = IPFLOW_TIMER; + /* + * Insert into the approriate bucket of the flow table. + */ + hash = ipflow_hash(ip->ip_dst, ip->ip_src, ip->ip_tos); + s = splimp(); + LIST_INSERT_HEAD(&ipflows[hash], ipf, ipf_next); + splx(s); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/ip_icmp.c b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_icmp.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_icmp.c @@ -0,0 +1,878 @@ +//========================================================================== +// +// src/sys/netinet/ip_icmp.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/sys/netinet/ip_icmp.c,v 1.39.2.9 2001/07/03 11:01:46 ume Exp $ + */ + +#include +#include +#include +#include + +#include +#include + +#define _IP_VHL +#include +#include +#include +#include +#include +#include +#include + +#ifdef IPSEC +#include +#include +#endif + +/* + * ICMP routines: error generation, receive packet processing, and + * routines to turnaround packets back to the originator, and + * host table maintenance routines. + */ + +static int icmpmaskrepl = 0; +static int drop_redirect = 0; +static int log_redirect = 0; + +#ifdef ICMP_BANDLIM + +/* + * ICMP error-response bandwidth limiting sysctl. If not enabled, sysctl + * variable content is -1 and read-only. + */ + +static int icmplim = 200; +#else + +static int icmplim = -1; +#endif + +/* + * ICMP broadcast echo sysctl + */ + +static int icmpbmcastecho = 0; + +#ifdef ICMPPRINTFS +int icmpprintfs = 0; +#endif + +static void icmp_reflect __P((struct mbuf *)); +static void icmp_send __P((struct mbuf *, struct mbuf *)); +static int ip_next_mtu __P((int, int)); + +extern struct protosw inetsw[]; + +/* + * Generate an error packet of type error + * in response to bad packet ip. + */ +void +icmp_error(n, type, code, dest, destifp) + struct mbuf *n; + int type, code; + n_long dest; + struct ifnet *destifp; +{ + register struct ip *oip = mtod(n, struct ip *), *nip; + register unsigned oiplen = IP_VHL_HL(oip->ip_vhl) << 2; + register struct icmp *icp; + register struct mbuf *m; + unsigned icmplen; + +#ifdef ICMPPRINTFS + if (icmpprintfs) + printf("icmp_error(%p, %x, %d)\n", oip, type, code); +#endif + if (type != ICMP_REDIRECT) + icmpstat.icps_error++; + /* + * Don't send error if not the first fragment of message. + * Don't error if the old packet protocol was ICMP + * error message, only known informational types. + */ + if (oip->ip_off &~ (IP_MF|IP_DF)) + goto freeit; + if (oip->ip_p == IPPROTO_ICMP && type != ICMP_REDIRECT && + n->m_len >= oiplen + ICMP_MINLEN && + !ICMP_INFOTYPE(((struct icmp *)((caddr_t)oip + oiplen))->icmp_type)) { + icmpstat.icps_oldicmp++; + goto freeit; + } + /* Don't send error in response to a multicast or broadcast packet */ + if (n->m_flags & (M_BCAST|M_MCAST)) + goto freeit; + /* + * First, formulate icmp message + */ + m = m_gethdr(M_DONTWAIT, MT_HEADER); + if (m == NULL) + goto freeit; + icmplen = min(oiplen + 8, oip->ip_len); + if (icmplen < sizeof(struct ip)) { + printf("icmp_error: bad length\n"); + m_free(m); + goto freeit; + } + m->m_len = icmplen + ICMP_MINLEN; + MH_ALIGN(m, m->m_len); + icp = mtod(m, struct icmp *); + if ((u_int)type > ICMP_MAXTYPE) + panic("icmp_error"); + icmpstat.icps_outhist[type]++; + icp->icmp_type = type; + if (type == ICMP_REDIRECT) + icp->icmp_gwaddr.s_addr = dest; + else { + icp->icmp_void = 0; + /* + * The following assignments assume an overlay with the + * zeroed icmp_void field. + */ + if (type == ICMP_PARAMPROB) { + icp->icmp_pptr = code; + code = 0; + } else if (type == ICMP_UNREACH && + code == ICMP_UNREACH_NEEDFRAG && destifp) { + icp->icmp_nextmtu = htons(destifp->if_mtu); + } + } + + icp->icmp_code = code; + m_copydata(n, 0, icmplen, (caddr_t)&icp->icmp_ip); + nip = &icp->icmp_ip; + + /* + * Convert fields to network representation. + */ + HTONS(nip->ip_len); + HTONS(nip->ip_off); + + /* + * Now, copy old ip header (without options) + * in front of icmp message. + */ + if (m->m_data - sizeof(struct ip) < m->m_pktdat) + panic("icmp len"); + m->m_data -= sizeof(struct ip); + m->m_len += sizeof(struct ip); + m->m_pkthdr.len = m->m_len; + m->m_pkthdr.rcvif = n->m_pkthdr.rcvif; + nip = mtod(m, struct ip *); + bcopy((caddr_t)oip, (caddr_t)nip, sizeof(struct ip)); + nip->ip_len = m->m_len; + nip->ip_vhl = IP_VHL_BORING; + nip->ip_p = IPPROTO_ICMP; + nip->ip_tos = 0; + icmp_reflect(m); + +freeit: + m_freem(n); +} + +static struct sockaddr_in icmpsrc = { sizeof (struct sockaddr_in), AF_INET }; +static struct sockaddr_in icmpdst = { sizeof (struct sockaddr_in), AF_INET }; +static struct sockaddr_in icmpgw = { sizeof (struct sockaddr_in), AF_INET }; + +/* + * Process a received ICMP message. + */ +void +icmp_input(m, off) + register struct mbuf *m; + int off; +{ + int hlen = off; + register struct icmp *icp; + register struct ip *ip = mtod(m, struct ip *); + int icmplen = ip->ip_len; + register int i; + struct in_ifaddr *ia; + void (*ctlfunc) __P((int, struct sockaddr *, void *)); + int code; + + /* + * Locate icmp structure in mbuf, and check + * that not corrupted and of at least minimum length. + */ +#ifdef ICMPPRINTFS + if (icmpprintfs) { + char buf[4 * sizeof "123"]; + strcpy(buf, inet_ntoa(ip->ip_src)); + printf("icmp_input from %s to %s, len %d\n", + buf, inet_ntoa(ip->ip_dst), icmplen); + } +#endif + if (icmplen < ICMP_MINLEN) { + icmpstat.icps_tooshort++; + goto freeit; + } + i = hlen + min(icmplen, ICMP_ADVLENMIN); + if (m->m_len < i && (m = m_pullup(m, i)) == 0) { + icmpstat.icps_tooshort++; + return; + } + ip = mtod(m, struct ip *); + m->m_len -= hlen; + m->m_data += hlen; + icp = mtod(m, struct icmp *); + if (in_cksum(m, icmplen)) { + icmpstat.icps_checksum++; + goto freeit; + } + m->m_len += hlen; + m->m_data -= hlen; + +#if defined(NFAITH) && 0 < NFAITH + if (m->m_pkthdr.rcvif && m->m_pkthdr.rcvif->if_type == IFT_FAITH) { + /* + * Deliver very specific ICMP type only. + */ + switch (icp->icmp_type) { + case ICMP_UNREACH: + case ICMP_TIMXCEED: + break; + default: + goto freeit; + } + } +#endif + +#ifdef ICMPPRINTFS + if (icmpprintfs) + printf("icmp_input, type %d code %d\n", icp->icmp_type, + icp->icmp_code); +#endif + + /* + * Message type specific processing. + */ + if (icp->icmp_type > ICMP_MAXTYPE) + goto raw; + icmpstat.icps_inhist[icp->icmp_type]++; + code = icp->icmp_code; + switch (icp->icmp_type) { + + case ICMP_UNREACH: + switch (code) { + case ICMP_UNREACH_NET: + case ICMP_UNREACH_HOST: + case ICMP_UNREACH_SRCFAIL: + case ICMP_UNREACH_NET_UNKNOWN: + case ICMP_UNREACH_HOST_UNKNOWN: + case ICMP_UNREACH_ISOLATED: + case ICMP_UNREACH_TOSNET: + case ICMP_UNREACH_TOSHOST: + case ICMP_UNREACH_HOST_PRECEDENCE: + case ICMP_UNREACH_PRECEDENCE_CUTOFF: + code = PRC_UNREACH_NET; + break; + + case ICMP_UNREACH_NEEDFRAG: + code = PRC_MSGSIZE; + break; + + /* + * RFC 1122, Sections 3.2.2.1 and 4.2.3.9. + * Treat subcodes 2,3 as immediate RST + */ + case ICMP_UNREACH_PROTOCOL: + case ICMP_UNREACH_PORT: + code = PRC_UNREACH_PORT; + break; + + case ICMP_UNREACH_NET_PROHIB: + case ICMP_UNREACH_HOST_PROHIB: + case ICMP_UNREACH_FILTER_PROHIB: + code = PRC_UNREACH_ADMIN_PROHIB; + break; + + default: + goto badcode; + } + goto deliver; + + case ICMP_TIMXCEED: + if (code > 1) + goto badcode; + code += PRC_TIMXCEED_INTRANS; + goto deliver; + + case ICMP_PARAMPROB: + if (code > 1) + goto badcode; + code = PRC_PARAMPROB; + goto deliver; + + case ICMP_SOURCEQUENCH: + if (code) + goto badcode; + code = PRC_QUENCH; + deliver: + /* + * Problem with datagram; advise higher level routines. + */ + if (icmplen < ICMP_ADVLENMIN || icmplen < ICMP_ADVLEN(icp) || + IP_VHL_HL(icp->icmp_ip.ip_vhl) < (sizeof(struct ip) >> 2)) { + icmpstat.icps_badlen++; + goto freeit; + } + NTOHS(icp->icmp_ip.ip_len); + /* Discard ICMP's in response to multicast packets */ + if (IN_MULTICAST(ntohl(icp->icmp_ip.ip_dst.s_addr))) + goto badcode; +#ifdef ICMPPRINTFS + if (icmpprintfs) + printf("deliver to protocol %d\n", icp->icmp_ip.ip_p); +#endif + icmpsrc.sin_addr = icp->icmp_ip.ip_dst; +#if 1 + /* + * MTU discovery: + * If we got a needfrag and there is a host route to the + * original destination, and the MTU is not locked, then + * set the MTU in the route to the suggested new value + * (if given) and then notify as usual. The ULPs will + * notice that the MTU has changed and adapt accordingly. + * If no new MTU was suggested, then we guess a new one + * less than the current value. If the new MTU is + * unreasonably small (arbitrarily set at 296), then + * we reset the MTU to the interface value and enable the + * lock bit, indicating that we are no longer doing MTU + * discovery. + */ + if (code == PRC_MSGSIZE) { + struct rtentry *rt; + int mtu; + + rt = rtalloc1((struct sockaddr *)&icmpsrc, 0, + RTF_CLONING | RTF_PRCLONING); + if (rt && (rt->rt_flags & RTF_HOST) + && !(rt->rt_rmx.rmx_locks & RTV_MTU)) { + mtu = ntohs(icp->icmp_nextmtu); + if (!mtu) + mtu = ip_next_mtu(rt->rt_rmx.rmx_mtu, + 1); +#ifdef DEBUG_MTUDISC + printf("MTU for %s reduced to %d\n", + inet_ntoa(icmpsrc.sin_addr), mtu); +#endif + if (mtu < 296) { + /* rt->rt_rmx.rmx_mtu = + rt->rt_ifp->if_mtu; */ + rt->rt_rmx.rmx_locks |= RTV_MTU; + } else if (rt->rt_rmx.rmx_mtu > mtu) { + rt->rt_rmx.rmx_mtu = mtu; + } + } + if (rt) + RTFREE(rt); + } + +#endif + /* + * XXX if the packet contains [IPv4 AH TCP], we can't make a + * notification to TCP layer. + */ + ctlfunc = inetsw[ip_protox[icp->icmp_ip.ip_p]].pr_ctlinput; + if (ctlfunc) + (*ctlfunc)(code, (struct sockaddr *)&icmpsrc, + (void *)&icp->icmp_ip); + break; + + badcode: + icmpstat.icps_badcode++; + break; + + case ICMP_ECHO: + if (!icmpbmcastecho + && (m->m_flags & (M_MCAST | M_BCAST)) != 0) { + icmpstat.icps_bmcastecho++; + break; + } + icp->icmp_type = ICMP_ECHOREPLY; +#ifdef ICMP_BANDLIM + if (badport_bandlim(BANDLIM_ICMP_ECHO) < 0) + goto freeit; + else +#endif + goto reflect; + + case ICMP_TSTAMP: + if (!icmpbmcastecho + && (m->m_flags & (M_MCAST | M_BCAST)) != 0) { + icmpstat.icps_bmcasttstamp++; + break; + } + if (icmplen < ICMP_TSLEN) { + icmpstat.icps_badlen++; + break; + } + icp->icmp_type = ICMP_TSTAMPREPLY; + icp->icmp_rtime = iptime(); + icp->icmp_ttime = icp->icmp_rtime; /* bogus, do later! */ +#ifdef ICMP_BANDLIM + if (badport_bandlim(BANDLIM_ICMP_TSTAMP) < 0) + goto freeit; + else +#endif + goto reflect; + + case ICMP_MASKREQ: +#define satosin(sa) ((struct sockaddr_in *)(sa)) + if (icmpmaskrepl == 0) + break; + /* + * We are not able to respond with all ones broadcast + * unless we receive it over a point-to-point interface. + */ + if (icmplen < ICMP_MASKLEN) + break; + switch (ip->ip_dst.s_addr) { + + case INADDR_BROADCAST: + case INADDR_ANY: + icmpdst.sin_addr = ip->ip_src; + break; + + default: + icmpdst.sin_addr = ip->ip_dst; + } + ia = (struct in_ifaddr *)ifaof_ifpforaddr( + (struct sockaddr *)&icmpdst, m->m_pkthdr.rcvif); + if (ia == 0) + break; + if (ia->ia_ifp == 0) + break; + icp->icmp_type = ICMP_MASKREPLY; + icp->icmp_mask = ia->ia_sockmask.sin_addr.s_addr; + if (ip->ip_src.s_addr == 0) { + if (ia->ia_ifp->if_flags & IFF_BROADCAST) + ip->ip_src = satosin(&ia->ia_broadaddr)->sin_addr; + else if (ia->ia_ifp->if_flags & IFF_POINTOPOINT) + ip->ip_src = satosin(&ia->ia_dstaddr)->sin_addr; + } +reflect: + ip->ip_len += hlen; /* since ip_input deducts this */ + icmpstat.icps_reflect++; + icmpstat.icps_outhist[icp->icmp_type]++; + icmp_reflect(m); + return; + + case ICMP_REDIRECT: + if (log_redirect) { + u_long src, dst, gw; + + src = ntohl(ip->ip_src.s_addr); + dst = ntohl(icp->icmp_ip.ip_dst.s_addr); + gw = ntohl(icp->icmp_gwaddr.s_addr); + printf("icmp redirect from %d.%d.%d.%d: " + "%d.%d.%d.%d => %d.%d.%d.%d\n", + (int)(src >> 24), (int)((src >> 16) & 0xff), + (int)((src >> 8) & 0xff), (int)(src & 0xff), + (int)(dst >> 24), (int)((dst >> 16) & 0xff), + (int)((dst >> 8) & 0xff), (int)(dst & 0xff), + (int)(gw >> 24), (int)((gw >> 16) & 0xff), + (int)((gw >> 8) & 0xff), (int)(gw & 0xff)); + } + if (drop_redirect) + break; + if (code > 3) + goto badcode; + if (icmplen < ICMP_ADVLENMIN || icmplen < ICMP_ADVLEN(icp) || + IP_VHL_HL(icp->icmp_ip.ip_vhl) < (sizeof(struct ip) >> 2)) { + icmpstat.icps_badlen++; + break; + } + /* + * Short circuit routing redirects to force + * immediate change in the kernel's routing + * tables. The message is also handed to anyone + * listening on a raw socket (e.g. the routing + * daemon for use in updating its tables). + */ + icmpgw.sin_addr = ip->ip_src; + icmpdst.sin_addr = icp->icmp_gwaddr; +#ifdef ICMPPRINTFS + if (icmpprintfs) { + char buf[4 * sizeof "123"]; + strcpy(buf, inet_ntoa(icp->icmp_ip.ip_dst)); + + printf("redirect dst %s to %s\n", + buf, inet_ntoa(icp->icmp_gwaddr)); + } +#endif + icmpsrc.sin_addr = icp->icmp_ip.ip_dst; + rtredirect((struct sockaddr *)&icmpsrc, + (struct sockaddr *)&icmpdst, + (struct sockaddr *)0, RTF_GATEWAY | RTF_HOST, + (struct sockaddr *)&icmpgw, (struct rtentry **)0); + pfctlinput(PRC_REDIRECT_HOST, (struct sockaddr *)&icmpsrc); +#ifdef IPSEC + key_sa_routechange((struct sockaddr *)&icmpsrc); +#endif + break; + + /* + * No kernel processing for the following; + * just fall through to send to raw listener. + */ + case ICMP_ECHOREPLY: + case ICMP_ROUTERADVERT: + case ICMP_ROUTERSOLICIT: + case ICMP_TSTAMPREPLY: + case ICMP_IREQREPLY: + case ICMP_MASKREPLY: + default: + break; + } + +raw: + rip_input(m, off); + return; + +freeit: + m_freem(m); +} + +/* + * Reflect the ip packet back to the source + */ +static void +icmp_reflect(m) + struct mbuf *m; +{ + register struct ip *ip = mtod(m, struct ip *); + register struct in_ifaddr *ia; + struct in_addr t; + struct mbuf *opts = 0; + int optlen = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof(struct ip); + + if (!in_canforward(ip->ip_src) && + ((ntohl(ip->ip_src.s_addr) & IN_CLASSA_NET) != + (IN_LOOPBACKNET << IN_CLASSA_NSHIFT))) { + m_freem(m); /* Bad return address */ + goto done; /* Ip_output() will check for broadcast */ + } + t = ip->ip_dst; + ip->ip_dst = ip->ip_src; + /* + * If the incoming packet was addressed directly to us, + * use dst as the src for the reply. Otherwise (broadcast + * or anonymous), use the address which corresponds + * to the incoming interface. + */ + for (ia = in_ifaddrhead.tqh_first; ia; ia = ia->ia_link.tqe_next) { + if (t.s_addr == IA_SIN(ia)->sin_addr.s_addr) + break; + if (ia->ia_ifp && (ia->ia_ifp->if_flags & IFF_BROADCAST) && + t.s_addr == satosin(&ia->ia_broadaddr)->sin_addr.s_addr) + break; + } + icmpdst.sin_addr = t; + if ((ia == (struct in_ifaddr *)0) && m->m_pkthdr.rcvif) + ia = (struct in_ifaddr *)ifaof_ifpforaddr( + (struct sockaddr *)&icmpdst, m->m_pkthdr.rcvif); + /* + * The following happens if the packet was not addressed to us, + * and was received on an interface with no IP address. + */ + if (ia == (struct in_ifaddr *)0) + ia = in_ifaddrhead.tqh_first; + t = IA_SIN(ia)->sin_addr; + ip->ip_src = t; + ip->ip_ttl = ip_defttl; + + if (optlen > 0) { + register u_char *cp; + int opt, cnt; + u_int len; + + /* + * Retrieve any source routing from the incoming packet; + * add on any record-route or timestamp options. + */ + cp = (u_char *) (ip + 1); + if ((opts = ip_srcroute()) == 0 && + (opts = m_gethdr(M_DONTWAIT, MT_HEADER))) { + opts->m_len = sizeof(struct in_addr); + mtod(opts, struct in_addr *)->s_addr = 0; + } + if (opts) { +#ifdef ICMPPRINTFS + if (icmpprintfs) + printf("icmp_reflect optlen %d rt %d => ", + optlen, opts->m_len); +#endif + for (cnt = optlen; cnt > 0; cnt -= len, cp += len) { + opt = cp[IPOPT_OPTVAL]; + if (opt == IPOPT_EOL) + break; + if (opt == IPOPT_NOP) + len = 1; + else { + if (cnt < IPOPT_OLEN + sizeof(*cp)) + break; + len = cp[IPOPT_OLEN]; + if (len < IPOPT_OLEN + sizeof(*cp) || + len > cnt) + break; + } + /* + * Should check for overflow, but it "can't happen" + */ + if (opt == IPOPT_RR || opt == IPOPT_TS || + opt == IPOPT_SECURITY) { + bcopy((caddr_t)cp, + mtod(opts, caddr_t) + opts->m_len, len); + opts->m_len += len; + } + } + /* Terminate & pad, if necessary */ + cnt = opts->m_len % 4; + if (cnt) { + for (; cnt < 4; cnt++) { + *(mtod(opts, caddr_t) + opts->m_len) = + IPOPT_EOL; + opts->m_len++; + } + } +#ifdef ICMPPRINTFS + if (icmpprintfs) + printf("%d\n", opts->m_len); +#endif + } + /* + * Now strip out original options by copying rest of first + * mbuf's data back, and adjust the IP length. + */ + ip->ip_len -= optlen; + ip->ip_vhl = IP_VHL_BORING; + m->m_len -= optlen; + if (m->m_flags & M_PKTHDR) + m->m_pkthdr.len -= optlen; + optlen += sizeof(struct ip); + bcopy((caddr_t)ip + optlen, (caddr_t)(ip + 1), + (unsigned)(m->m_len - sizeof(struct ip))); + } + m->m_flags &= ~(M_BCAST|M_MCAST); + icmp_send(m, opts); +done: + if (opts) + (void)m_free(opts); +} + +/* + * Send an icmp packet back to the ip level, + * after supplying a checksum. + */ +static void +icmp_send(m, opts) + register struct mbuf *m; + struct mbuf *opts; +{ + register struct ip *ip = mtod(m, struct ip *); + register int hlen; + register struct icmp *icp; + struct route ro; + + hlen = IP_VHL_HL(ip->ip_vhl) << 2; + m->m_data += hlen; + m->m_len -= hlen; + icp = mtod(m, struct icmp *); + icp->icmp_cksum = 0; + icp->icmp_cksum = in_cksum(m, ip->ip_len - hlen); + m->m_data -= hlen; + m->m_len += hlen; + m->m_pkthdr.rcvif = (struct ifnet *)0; +#ifdef ICMPPRINTFS + if (icmpprintfs) { + char buf[4 * sizeof "123"]; + strcpy(buf, inet_ntoa(ip->ip_dst)); + printf("icmp_send dst %s src %s\n", + buf, inet_ntoa(ip->ip_src)); + } +#endif + bzero(&ro, sizeof ro); + (void) ip_output(m, opts, &ro, 0, NULL); + if (ro.ro_rt) + RTFREE(ro.ro_rt); +} + +n_time +iptime() +{ + struct timeval atv; + u_long t; + + microtime(&atv); + t = (atv.tv_sec % (24*60*60)) * 1000 + atv.tv_usec / 1000; + return (htonl(t)); +} + +#if 1 +/* + * Return the next larger or smaller MTU plateau (table from RFC 1191) + * given current value MTU. If DIR is less than zero, a larger plateau + * is returned; otherwise, a smaller value is returned. + */ +static int +ip_next_mtu(mtu, dir) + int mtu; + int dir; +{ + static int mtutab[] = { + 65535, 32000, 17914, 8166, 4352, 2002, 1492, 1006, 508, 296, + 68, 0 + }; + int i; + + for (i = 0; i < (sizeof mtutab) / (sizeof mtutab[0]); i++) { + if (mtu >= mtutab[i]) + break; + } + + if (dir < 0) { + if (i == 0) { + return 0; + } else { + return mtutab[i - 1]; + } + } else { + if (mtutab[i] == 0) { + return 0; + } else if(mtu > mtutab[i]) { + return mtutab[i]; + } else { + return mtutab[i + 1]; + } + } +} +#endif + +#ifdef ICMP_BANDLIM + +/* + * badport_bandlim() - check for ICMP bandwidth limit + * + * Return 0 if it is ok to send an ICMP error response, -1 if we have + * hit our bandwidth limit and it is not ok. + * + * If icmplim is <= 0, the feature is disabled and 0 is returned. + * + * For now we separate the TCP and UDP subsystems w/ different 'which' + * values. We may eventually remove this separation (and simplify the + * code further). + * + * Note that the printing of the error message is delayed so we can + * properly print the icmp error rate that the system was trying to do + * (i.e. 22000/100 pps, etc...). This can cause long delays in printing + * the 'final' error, but it doesn't make sense to solve the printing + * delay with more complex code. + */ + +int +badport_bandlim(int which) +{ + static int lticks[BANDLIM_MAX + 1]; + static int lpackets[BANDLIM_MAX + 1]; + int dticks; + const char *bandlimittype[] = { + "Limiting icmp unreach response", + "Limiting icmp ping response", + "Limiting icmp tstamp response", + "Limiting closed port RST response", + "Limiting open port RST response" + }; + + /* + * Return ok status if feature disabled or argument out of + * ranage. + */ + + if (icmplim <= 0 || which > BANDLIM_MAX || which < 0) + return(0); + dticks = ticks - lticks[which]; + + /* + * reset stats when cumulative dt exceeds one second. + */ + + if ((unsigned int)dticks > hz) { + if (lpackets[which] > icmplim) { + printf("%s from %d to %d packets per second\n", + bandlimittype[which], + lpackets[which], + icmplim + ); + } + lticks[which] = ticks; + lpackets[which] = 0; + } + + /* + * bump packet count + */ + + if (++lpackets[which] > icmplim) { + return(-1); + } + return(0); +} + +#endif + + diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/ip_id.c b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_id.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_id.c @@ -0,0 +1,227 @@ +//========================================================================== +// +// src/sys/netinet/ip_id.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $OpenBSD: ip_id.c,v 1.2 1999/08/26 13:37:01 provos Exp $ */ + +/* + * Copyright 1998 Niels Provos + * All rights reserved. + * + * Theo de Raadt came up with the idea of using + * such a mathematical system to generate more random (yet non-repeating) + * ids to solve the resolver/named problem. But Niels designed the + * actual system based on the constraints. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Niels Provos. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * $FreeBSD: src/sys/netinet/ip_id.c,v 1.1.2.1 2001/07/19 06:37:26 kris Exp $ + */ + +/* + * seed = random 15bit + * n = prime, g0 = generator to n, + * j = random so that gcd(j,n-1) == 1 + * g = g0^j mod n will be a generator again. + * + * X[0] = random seed. + * X[n] = a*X[n-1]+b mod m is a Linear Congruential Generator + * with a = 7^(even random) mod m, + * b = random with gcd(b,m) == 1 + * m = 31104 and a maximal period of m-1. + * + * The transaction id is determined by: + * id[n] = seed xor (g^X[n] mod n) + * + * Effectivly the id is restricted to the lower 15 bits, thus + * yielding two different cycles by toggling the msb on and off. + * This avoids reuse issues caused by reseeding. + */ + +#include + +#ifdef RANDOM_IP_ID +#define RU_OUT 180 /* Time after wich will be reseeded */ +#define RU_MAX 30000 /* Uniq cycle, avoid blackjack prediction */ +#define RU_GEN 2 /* Starting generator */ +#define RU_N 32749 /* RU_N-1 = 2*2*3*2729 */ +#define RU_AGEN 7 /* determine ru_a as RU_AGEN^(2*rand) */ +#define RU_M 31104 /* RU_M = 2^7*3^5 - don't change */ + +#define PFAC_N 3 +const static u_int16_t pfacts[PFAC_N] = { + 2, + 3, + 2729 +}; + +static u_int16_t ru_x; +static u_int16_t ru_seed, ru_seed2; +static u_int16_t ru_a, ru_b; +static u_int16_t ru_g; +static u_int16_t ru_counter = 0; +static u_int16_t ru_msb = 0; +static long ru_reseed; +static u_int32_t tmp; /* Storage for unused random */ + +static u_int16_t pmod __P((u_int16_t, u_int16_t, u_int16_t)); +static void ip_initid __P((void)); +u_int16_t ip_randomid __P((void)); + +/* + * Do a fast modular exponation, returned value will be in the range + * of 0 - (mod-1) + */ + +#ifdef __STDC__ +static u_int16_t +pmod(u_int16_t gen, u_int16_t exp, u_int16_t mod) +#else +static u_int16_t +pmod(gen, exp, mod) + u_int16_t gen, exp, mod; +#endif +{ + u_int16_t s, t, u; + + s = 1; + t = gen; + u = exp; + + while (u) { + if (u & 1) + s = (s*t) % mod; + u >>= 1; + t = (t*t) % mod; + } + return (s); +} + +/* + * Initalizes the seed and chooses a suitable generator. Also toggles + * the msb flag. The msb flag is used to generate two distinct + * cycles of random numbers and thus avoiding reuse of ids. + * + * This function is called from id_randomid() when needed, an + * application does not have to worry about it. + */ +static void +ip_initid(void) +{ + u_int16_t j, i; + int noprime = 1; + struct timeval time; + + getmicrotime(&time); + read_random((void *) &tmp, sizeof(tmp)); + ru_x = (tmp & 0xFFFF) % RU_M; + + /* 15 bits of random seed */ + ru_seed = (tmp >> 16) & 0x7FFF; + read_random((void *) &tmp, sizeof(tmp)); + ru_seed2 = tmp & 0x7FFF; + + read_random((void *) &tmp, sizeof(tmp)); + + /* Determine the LCG we use */ + ru_b = (tmp & 0xfffe) | 1; + ru_a = pmod(RU_AGEN, (tmp >> 16) & 0xfffe, RU_M); + while (ru_b % 3 == 0) + ru_b += 2; + + read_random((void *) &tmp, sizeof(tmp)); + j = tmp % RU_N; + tmp = tmp >> 16; + + /* + * Do a fast gcd(j,RU_N-1), so we can find a j with + * gcd(j, RU_N-1) == 1, giving a new generator for + * RU_GEN^j mod RU_N + */ + + while (noprime) { + for (i=0; i=PFAC_N) + noprime = 0; + else + j = (j+1) % RU_N; + } + + ru_g = pmod(RU_GEN,j,RU_N); + ru_counter = 0; + + ru_reseed = time.tv_sec + RU_OUT; + ru_msb = ru_msb == 0x8000 ? 0 : 0x8000; +} + +u_int16_t +ip_randomid(void) +{ + int i, n; + struct timeval time; + + getmicrotime(&time); + if (ru_counter >= RU_MAX || time.tv_sec > ru_reseed) + ip_initid(); + + if (!tmp) + read_random((void *) &tmp, sizeof(tmp)); + + /* Skip a random number of ids */ + n = tmp & 0x3; tmp = tmp >> 2; + if (ru_counter + n >= RU_MAX) + ip_initid(); + + for (i = 0; i <= n; i++) + /* Linear Congruential Generator */ + ru_x = (ru_a*ru_x + ru_b) % RU_M; + + ru_counter += i; + + return (ru_seed ^ pmod(ru_g,ru_seed2 ^ ru_x,RU_N)) | ru_msb; +} + +#endif /* RANDOM_IP_ID */ diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/ip_input.c b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_input.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_input.c @@ -0,0 +1,1943 @@ +//========================================================================== +// +// src/sys/netinet/ip_input.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/sys/netinet/ip_input.c,v 1.130.2.25 2001/08/29 21:41:37 jesper Exp $ + */ + +#define _IP_VHL + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#ifdef IPSEC +#include +#include +#endif + +#ifdef DUMMYNET +#include +#endif + +int rsvp_on = 0; +static int ip_rsvp_on; +struct socket *ip_rsvpd; + +int ipforwarding = 0; +static int ipsendredirects = 1; /* XXX */ +int ip_defttl = IPDEFTTL; +static int ip_dosourceroute = 0; +static int ip_acceptsourceroute = 0; +static int ip_keepfaith = 0; +static int ip_nfragpackets = 0; +static int ip_maxfragpackets; /* initialized in ip_init() */ + +/* + * XXX - Setting ip_checkinterface mostly implements the receive side of + * the Strong ES model described in RFC 1122, but since the routing table + * and transmit implementation do not implement the Strong ES model, + * setting this to 1 results in an odd hybrid. + * + * XXX - ip_checkinterface currently must be disabled if you use ipnat + * to translate the destination address to another local interface. + * + * XXX - ip_checkinterface must be disabled if you add IP aliases + * to the loopback interface instead of the interface where the + * packets for those addresses are received. + */ +static int ip_checkinterface = 0; + +#ifdef DIAGNOSTIC +static int ipprintfs = 0; +#endif + +extern struct domain inetdomain; +extern struct protosw inetsw[]; +u_char ip_protox[IPPROTO_MAX]; +static int ipqmaxlen = IFQ_MAXLEN; +struct in_ifaddrhead in_ifaddrhead; /* first inet address */ +struct ipstat ipstat; + +/* Packet reassembly stuff */ +#define IPREASS_NHASH_LOG2 6 +#define IPREASS_NHASH (1 << IPREASS_NHASH_LOG2) +#define IPREASS_HMASK (IPREASS_NHASH - 1) +#define IPREASS_HASH(x,y) \ + (((((x) & 0xF) | ((((x) >> 8) & 0xF) << 4)) ^ (y)) & IPREASS_HMASK) + +static struct ipq ipq[IPREASS_NHASH]; +static int nipq = 0; /* total # of reass queues */ +static int maxnipq; +const int ipintrq_present = 1; + +#ifdef IPSTEALTH +static int ipstealth = 0; +#endif + + +/* Firewall hooks */ +ip_fw_chk_t *ip_fw_chk_ptr; +ip_fw_ctl_t *ip_fw_ctl_ptr; +int fw_enable = 1 ; + +#ifdef DUMMYNET +ip_dn_ctl_t *ip_dn_ctl_ptr; +#endif + +int (*fr_checkp) __P((struct ip *, int, struct ifnet *, int, struct mbuf **)) = NULL; + + +/* + * We need to save the IP options in case a protocol wants to respond + * to an incoming packet over the same route if the packet got here + * using IP source routing. This allows connection establishment and + * maintenance when the remote end is on a network that is not known + * to us. + */ +static int ip_nhops = 0; +static struct ip_srcrt { + struct in_addr dst; /* final destination */ + char nop; /* one NOP to align */ + char srcopt[IPOPT_OFFSET + 1]; /* OPTVAL, OLEN and OFFSET */ + struct in_addr route[MAX_IPOPTLEN/sizeof(struct in_addr)]; +} ip_srcrt; + +struct sockaddr_in *ip_fw_fwd_addr; + +static void save_rte __P((u_char *, struct in_addr)); +static int ip_dooptions __P((struct mbuf *)); +#ifdef NATPT + void ip_forward __P((struct mbuf *, int)); +#else +static void ip_forward __P((struct mbuf *, int)); +#endif +static void ip_freef __P((struct ipq *)); +#ifdef IPDIVERT +static struct mbuf *ip_reass __P((struct mbuf *, + struct ipq *, struct ipq *, u_int32_t *, u_int16_t *)); +#else +static struct mbuf *ip_reass __P((struct mbuf *, struct ipq *, struct ipq *)); +#endif +static struct in_ifaddr *ip_rtaddr __P((struct in_addr)); +static void ipintr __P((void)); + +#ifdef NATPT +extern int ip6_protocol_tr; +int natpt_in4 __P((struct mbuf *, struct mbuf **)); +extern void ip6_forward __P((struct mbuf *, int)); +#endif /* NATPT */ + +/* + * IP initialization: fill in IP protocol switch table. + * All protocols not implemented in kernel go to raw IP protocol handler. + */ +void +ip_init() +{ + register struct protosw *pr; + register int i; + + TAILQ_INIT(&in_ifaddrhead); + pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); + if (pr == 0) + panic("ip_init"); + for (i = 0; i < IPPROTO_MAX; i++) + ip_protox[i] = pr - inetsw; + for (pr = inetdomain.dom_protosw; + pr < inetdomain.dom_protoswNPROTOSW; pr++) + if (pr->pr_domain->dom_family == PF_INET && + pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) + ip_protox[pr->pr_protocol] = pr - inetsw; + + for (i = 0; i < IPREASS_NHASH; i++) + ipq[i].next = ipq[i].prev = &ipq[i]; + + maxnipq = nmbclusters / 4; + ip_maxfragpackets = nmbclusters / 4; + +#ifndef RANDOM_IP_ID + ip_id = time_second & 0xffff; +#endif + ipintrq.ifq_maxlen = ipqmaxlen; + + register_netisr(NETISR_IP, ipintr); +} + +static struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; +static struct route ipforward_rt; + +/* + * Ip input routine. Checksum and byte swap header. If fragmented + * try to reassemble. Process options. Pass to next level. + */ +void +ip_input(struct mbuf *m) +{ + struct ip *ip; + struct ipq *fp; + struct in_ifaddr *ia = NULL; + int i, hlen, mff, checkif; + u_short sum; + u_int16_t divert_cookie; /* firewall cookie */ + struct in_addr pkt_dst; +#ifdef IPDIVERT + u_int32_t divert_info = 0; /* packet divert/tee info */ +#endif + struct ip_fw_chain *rule = NULL; + +#ifdef IPDIVERT + /* Get and reset firewall cookie */ + divert_cookie = ip_divert_cookie; + ip_divert_cookie = 0; +#else + divert_cookie = 0; +#endif + +#if defined(IPFIREWALL) && defined(DUMMYNET) + /* + * dummynet packet are prepended a vestigial mbuf with + * m_type = MT_DUMMYNET and m_data pointing to the matching + * rule. + */ + if (m->m_type == MT_DUMMYNET) { + rule = (struct ip_fw_chain *)(m->m_data) ; + m = m->m_next ; + ip = mtod(m, struct ip *); + hlen = IP_VHL_HL(ip->ip_vhl) << 2; + goto iphack ; + } else + rule = NULL ; +#endif + +#ifdef DIAGNOSTIC + if (m == NULL || (m->m_flags & M_PKTHDR) == 0) + panic("ip_input no HDR"); +#endif + ipstat.ips_total++; + + if (m->m_pkthdr.len < sizeof(struct ip)) + goto tooshort; + + if (m->m_len < sizeof (struct ip) && + (m = m_pullup(m, sizeof (struct ip))) == 0) { + ipstat.ips_toosmall++; + return; + } + ip = mtod(m, struct ip *); + + if (IP_VHL_V(ip->ip_vhl) != IPVERSION) { + ipstat.ips_badvers++; + goto bad; + } + + hlen = IP_VHL_HL(ip->ip_vhl) << 2; + if (hlen < sizeof(struct ip)) { /* minimum header length */ + ipstat.ips_badhlen++; + goto bad; + } + if (hlen > m->m_len) { + if ((m = m_pullup(m, hlen)) == 0) { + ipstat.ips_badhlen++; + return; + } + ip = mtod(m, struct ip *); + } + + /* 127/8 must not appear on wire - RFC1122 */ + if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || + (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { + if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) { + ipstat.ips_badaddr++; + goto bad; + } + } + + if (m->m_pkthdr.csum_flags & CSUM_IP_CHECKED) { + sum = !(m->m_pkthdr.csum_flags & CSUM_IP_VALID); + } else { + if (hlen == sizeof(struct ip)) { + sum = in_cksum_hdr(ip); + } else { + sum = in_cksum(m, hlen); + } + } + if (sum) { + ipstat.ips_badsum++; + goto bad; + } + +#ifdef ALTQ + if (altq_input != NULL && (*altq_input)(m, AF_INET) == 0) + /* packet is dropped by traffic conditioner */ + return; +#endif + /* + * Convert fields to host representation. + */ + NTOHS(ip->ip_len); + if (ip->ip_len < hlen) { + ipstat.ips_badlen++; + goto bad; + } + NTOHS(ip->ip_off); + + /* + * Check that the amount of data in the buffers + * is as at least much as the IP header would have us expect. + * Trim mbufs if longer than we expect. + * Drop packet if shorter than we expect. + */ + if (m->m_pkthdr.len < ip->ip_len) { +tooshort: + ipstat.ips_tooshort++; + goto bad; + } + if (m->m_pkthdr.len > ip->ip_len) { + if (m->m_len == m->m_pkthdr.len) { + m->m_len = ip->ip_len; + m->m_pkthdr.len = ip->ip_len; + } else + m_adj(m, ip->ip_len - m->m_pkthdr.len); + } + +#ifdef IPSEC + if (ipsec_getnhist(m)) + goto pass; +#endif + + /* + * IpHack's section. + * Right now when no processing on packet has done + * and it is still fresh out of network we do our black + * deals with it. + * - Firewall: deny/allow/divert + * - Xlate: translate packet's addr/port (NAT). + * - Pipe: pass pkt through dummynet. + * - Wrap: fake packet's addr/port + * - Encapsulate: put it in another IP and send out. + */ + +#if defined(IPFIREWALL) && defined(DUMMYNET) +iphack: +#endif + /* + * Check if we want to allow this packet to be processed. + * Consider it to be bad if not. + */ + if (fr_checkp) { + struct mbuf *m1 = m; + + if ((*fr_checkp)(ip, hlen, m->m_pkthdr.rcvif, 0, &m1) || !m1) + return; + ip = mtod(m = m1, struct ip *); + } + if (fw_enable && ip_fw_chk_ptr) { +#ifdef IPFIREWALL_FORWARD + /* + * If we've been forwarded from the output side, then + * skip the firewall a second time + */ + if (ip_fw_fwd_addr) + goto ours; +#endif /* IPFIREWALL_FORWARD */ + /* + * See the comment in ip_output for the return values + * produced by the firewall. + */ + i = (*ip_fw_chk_ptr)(&ip, + hlen, NULL, &divert_cookie, &m, &rule, &ip_fw_fwd_addr); + if ( (i & IP_FW_PORT_DENY_FLAG) || m == NULL) { /* drop */ + if (m) + m_freem(m); + return ; + } + ip = mtod(m, struct ip *); /* just in case m changed */ + if (i == 0 && ip_fw_fwd_addr == NULL) /* common case */ + goto pass; +#ifdef DUMMYNET + if ((i & IP_FW_PORT_DYNT_FLAG) != 0) { + /* Send packet to the appropriate pipe */ + dummynet_io(i&0xffff,DN_TO_IP_IN,m,NULL,NULL,0, rule, + 0); + return; + } +#endif +#ifdef IPDIVERT + if (i != 0 && (i & IP_FW_PORT_DYNT_FLAG) == 0) { + /* Divert or tee packet */ + divert_info = i; + goto ours; + } +#endif +#ifdef IPFIREWALL_FORWARD + if (i == 0 && ip_fw_fwd_addr != NULL) + goto pass; +#endif + /* + * if we get here, the packet must be dropped + */ + m_freem(m); + return; + } +pass: + + /* + * Process options and, if not destined for us, + * ship it on. ip_dooptions returns 1 when an + * error was detected (causing an icmp message + * to be sent and the original packet to be freed). + */ + ip_nhops = 0; /* for source routed packets */ + if (hlen > sizeof (struct ip) && ip_dooptions(m)) { +#ifdef IPFIREWALL_FORWARD + ip_fw_fwd_addr = NULL; +#endif + return; + } + + /* greedy RSVP, snatches any PATH packet of the RSVP protocol and no + * matter if it is destined to another node, or whether it is + * a multicast one, RSVP wants it! and prevents it from being forwarded + * anywhere else. Also checks if the rsvp daemon is running before + * grabbing the packet. + */ + if (rsvp_on && ip->ip_p==IPPROTO_RSVP) + goto ours; + +#ifdef NATPT + /* + * NATPT (Network Address Translation - Protocol Translation) + */ + if (ip6_protocol_tr) { + struct mbuf *m1 = NULL; + + switch (natpt_in4(m, &m1)) { + case IPPROTO_IP: /* this packet is not changed */ + goto checkaddresses; + + case IPPROTO_IPV4: + ip_forward(m1, 0); + break; + + case IPPROTO_IPV6: + ip6_forward(m1, 1); + break; + + case IPPROTO_DONE: /* discard without free */ + return; + + case IPPROTO_MAX: /* discard this packet */ + default: + break; + } + + if (m != m1) + m_freem(m); + + return; + } +checkaddresses:; +#endif + + /* + * Check our list of addresses, to see if the packet is for us. + * If we don't have any addresses, assume any unicast packet + * we receive might be for us (and let the upper layers deal + * with it). + */ + if (TAILQ_EMPTY(&in_ifaddrhead) && + (m->m_flags & (M_MCAST|M_BCAST)) == 0) + goto ours; + + /* + * Cache the destination address of the packet; this may be + * changed by use of 'ipfw fwd'. + */ + pkt_dst = ip_fw_fwd_addr == NULL ? + ip->ip_dst : ip_fw_fwd_addr->sin_addr; + + /* + * Enable a consistency check between the destination address + * and the arrival interface for a unicast packet (the RFC 1122 + * strong ES model) if IP forwarding is disabled and the packet + * is not locally generated and the packet is not subject to + * 'ipfw fwd'. + * + * XXX - Checking also should be disabled if the destination + * address is ipnat'ed to a different interface. + * + * XXX - Checking is incompatible with IP aliases added + * to the loopback interface instead of the interface where + * the packets are received. + */ + checkif = ip_checkinterface && (ipforwarding == 0) && + ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) && + (ip_fw_fwd_addr == NULL); + + TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) { +#define satosin(sa) ((struct sockaddr_in *)(sa)) + +#ifdef BOOTP_COMPAT + if (IA_SIN(ia)->sin_addr.s_addr == INADDR_ANY) + goto ours; +#endif + /* + * If the address matches, verify that the packet + * arrived via the correct interface if checking is + * enabled. + */ + if (IA_SIN(ia)->sin_addr.s_addr == pkt_dst.s_addr && + (!checkif || ia->ia_ifp == m->m_pkthdr.rcvif)) + goto ours; + /* + * Only accept broadcast packets that arrive via the + * matching interface. Reception of forwarded directed + * broadcasts would be handled via ip_forward() and + * ether_output() with the loopback into the stack for + * SIMPLEX interfaces handled by ether_output(). + */ + if (ia->ia_ifp == m->m_pkthdr.rcvif && + ia->ia_ifp && ia->ia_ifp->if_flags & IFF_BROADCAST) { + if (satosin(&ia->ia_broadaddr)->sin_addr.s_addr == + pkt_dst.s_addr) + goto ours; + if (ia->ia_netbroadcast.s_addr == pkt_dst.s_addr) + goto ours; + } + } + if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { + struct in_multi *inm; + if (ip_mrouter) { + /* + * If we are acting as a multicast router, all + * incoming multicast packets are passed to the + * kernel-level multicast forwarding function. + * The packet is returned (relatively) intact; if + * ip_mforward() returns a non-zero value, the packet + * must be discarded, else it may be accepted below. + */ + if (ip_mforward(ip, m->m_pkthdr.rcvif, m, 0) != 0) { + ipstat.ips_cantforward++; + m_freem(m); + return; + } + + /* + * The process-level routing demon needs to receive + * all multicast IGMP packets, whether or not this + * host belongs to their destination groups. + */ + if (ip->ip_p == IPPROTO_IGMP) + goto ours; + ipstat.ips_forward++; + } + /* + * See if we belong to the destination multicast group on the + * arrival interface. + */ + IN_LOOKUP_MULTI(ip->ip_dst, m->m_pkthdr.rcvif, inm); + if (inm == NULL) { + ipstat.ips_notmember++; + m_freem(m); + return; + } + goto ours; + } + if (ip->ip_dst.s_addr == (u_long)INADDR_BROADCAST) + goto ours; + if (ip->ip_dst.s_addr == INADDR_ANY) + goto ours; + +#if defined(NFAITH) && 0 < NFAITH + /* + * FAITH(Firewall Aided Internet Translator) + */ + if (m->m_pkthdr.rcvif && m->m_pkthdr.rcvif->if_type == IFT_FAITH) { + if (ip_keepfaith) { + if (ip->ip_p == IPPROTO_TCP || ip->ip_p == IPPROTO_ICMP) + goto ours; + } + m_freem(m); + return; + } +#endif + /* + * Not for us; forward if possible and desirable. + */ + if (ipforwarding == 0) { + ipstat.ips_cantforward++; + m_freem(m); + } else + ip_forward(m, 0); +#ifdef IPFIREWALL_FORWARD + ip_fw_fwd_addr = NULL; +#endif + return; + +ours: + /* Count the packet in the ip address stats */ + if (ia != NULL) { + ia->ia_ifa.if_ipackets++; + ia->ia_ifa.if_ibytes += m->m_pkthdr.len; + } + + /* + * If offset or IP_MF are set, must reassemble. + * Otherwise, nothing need be done. + * (We could look in the reassembly queue to see + * if the packet was previously fragmented, + * but it's not worth the time; just let them time out.) + */ + if (ip->ip_off & (IP_MF | IP_OFFMASK | IP_RF)) { + +#if 0 /* + * Reassembly should be able to treat a mbuf cluster, for later + * operation of contiguous protocol headers on the cluster. (KAME) + */ + if (m->m_flags & M_EXT) { /* XXX */ + if ((m = m_pullup(m, hlen)) == 0) { + ipstat.ips_toosmall++; +#ifdef IPFIREWALL_FORWARD + ip_fw_fwd_addr = NULL; +#endif + return; + } + ip = mtod(m, struct ip *); + } +#endif + sum = IPREASS_HASH(ip->ip_src.s_addr, ip->ip_id); + /* + * Look for queue of fragments + * of this datagram. + */ + for (fp = ipq[sum].next; fp != &ipq[sum]; fp = fp->next) + if (ip->ip_id == fp->ipq_id && + ip->ip_src.s_addr == fp->ipq_src.s_addr && + ip->ip_dst.s_addr == fp->ipq_dst.s_addr && + ip->ip_p == fp->ipq_p) + goto found; + + fp = 0; + + /* check if there's a place for the new queue */ + if (nipq > maxnipq) { + /* + * drop something from the tail of the current queue + * before proceeding further + */ + if (ipq[sum].prev == &ipq[sum]) { /* gak */ + for (i = 0; i < IPREASS_NHASH; i++) { + if (ipq[i].prev != &ipq[i]) { + ip_freef(ipq[i].prev); + break; + } + } + } else + ip_freef(ipq[sum].prev); + } +found: + /* + * Adjust ip_len to not reflect header, + * set ip_mff if more fragments are expected, + * convert offset of this to bytes. + */ + ip->ip_len -= hlen; + mff = (ip->ip_off & IP_MF) != 0; + if (mff) { + /* + * Make sure that fragments have a data length + * that's a non-zero multiple of 8 bytes. + */ + if (ip->ip_len == 0 || (ip->ip_len & 0x7) != 0) { + ipstat.ips_toosmall++; /* XXX */ + goto bad; + } + m->m_flags |= M_FRAG; + } + ip->ip_off <<= 3; + + /* + * If datagram marked as having more fragments + * or if this is not the first fragment, + * attempt reassembly; if it succeeds, proceed. + */ + if (mff || ip->ip_off) { + ipstat.ips_fragments++; + m->m_pkthdr.header = ip; +#ifdef IPDIVERT + m = ip_reass(m, + fp, &ipq[sum], &divert_info, &divert_cookie); +#else + m = ip_reass(m, fp, &ipq[sum]); +#endif + if (m == 0) { +#ifdef IPFIREWALL_FORWARD + ip_fw_fwd_addr = NULL; +#endif + return; + } + ipstat.ips_reassembled++; + ip = mtod(m, struct ip *); + /* Get the header length of the reassembled packet */ + hlen = IP_VHL_HL(ip->ip_vhl) << 2; +#ifdef IPDIVERT + /* Restore original checksum before diverting packet */ + if (divert_info != 0) { + ip->ip_len += hlen; + HTONS(ip->ip_len); + HTONS(ip->ip_off); + ip->ip_sum = 0; + if (hlen == sizeof(struct ip)) + ip->ip_sum = in_cksum_hdr(ip); + else + ip->ip_sum = in_cksum(m, hlen); + NTOHS(ip->ip_off); + NTOHS(ip->ip_len); + ip->ip_len -= hlen; + } +#endif + } else + if (fp) + ip_freef(fp); + } else + ip->ip_len -= hlen; + +#ifdef IPDIVERT + /* + * Divert or tee packet to the divert protocol if required. + * + * If divert_info is zero then cookie should be too, so we shouldn't + * need to clear them here. Assume divert_packet() does so also. + */ + if (divert_info != 0) { + struct mbuf *clone = NULL; + + /* Clone packet if we're doing a 'tee' */ + if ((divert_info & IP_FW_PORT_TEE_FLAG) != 0) + clone = m_dup(m, M_DONTWAIT); + + /* Restore packet header fields to original values */ + ip->ip_len += hlen; + HTONS(ip->ip_len); + HTONS(ip->ip_off); + + /* Deliver packet to divert input routine */ + ip_divert_cookie = divert_cookie; + divert_packet(m, 1, divert_info & 0xffff); + ipstat.ips_delivered++; + + /* If 'tee', continue with original packet */ + if (clone == NULL) + return; + m = clone; + ip = mtod(m, struct ip *); + } +#endif + +#ifdef IPSEC + /* + * enforce IPsec policy checking if we are seeing last header. + * note that we do not visit this with protocols with pcb layer + * code - like udp/tcp/raw ip. + */ + if ((inetsw[ip_protox[ip->ip_p]].pr_flags & PR_LASTHDR) != 0 && + ipsec4_in_reject(m, NULL)) { + ipsecstat.in_polvio++; + goto bad; + } +#endif + + /* + * Switch out to protocol's input routine. + */ + ipstat.ips_delivered++; + { + int off = hlen; + + (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, off); +#ifdef IPFIREWALL_FORWARD + ip_fw_fwd_addr = NULL; /* tcp needed it */ +#endif + return; + } +bad: +#ifdef IPFIREWALL_FORWARD + ip_fw_fwd_addr = NULL; +#endif + m_freem(m); +} + +/* + * IP software interrupt routine - to go away sometime soon + */ +static void +ipintr(void) +{ + int s; + struct mbuf *m; + + while(1) { + s = splimp(); + IF_DEQUEUE(&ipintrq, m); + splx(s); + if (m == 0) + return; + ip_input(m); + } +} + +/* + * Take incoming datagram fragment and try to reassemble it into + * whole datagram. If a chain for reassembly of this datagram already + * exists, then it is given as fp; otherwise have to make a chain. + * + * When IPDIVERT enabled, keep additional state with each packet that + * tells us if we need to divert or tee the packet we're building. + */ + +static struct mbuf * +#ifdef IPDIVERT +ip_reass(m, fp, where, divinfo, divcookie) +#else +ip_reass(m, fp, where) +#endif + register struct mbuf *m; + register struct ipq *fp; + struct ipq *where; +#ifdef IPDIVERT + u_int32_t *divinfo; + u_int16_t *divcookie; +#endif +{ + struct ip *ip = mtod(m, struct ip *); + register struct mbuf *p = 0, *q, *nq; + struct mbuf *t; + int hlen = IP_VHL_HL(ip->ip_vhl) << 2; + int i, next; + + /* + * Presence of header sizes in mbufs + * would confuse code below. + */ + m->m_data += hlen; + m->m_len -= hlen; + + /* + * If first fragment to arrive, create a reassembly queue. + */ + if (fp == 0) { + /* + * Enforce upper bound on number of fragmented packets + * for which we attempt reassembly; + * If maxfrag is 0, never accept fragments. + * If maxfrag is -1, accept all fragments without limitation. + */ + if ((ip_maxfragpackets >= 0) && (ip_nfragpackets >= ip_maxfragpackets)) + goto dropfrag; + ip_nfragpackets++; + if ((t = m_get(M_DONTWAIT, MT_FTABLE)) == NULL) + goto dropfrag; + fp = mtod(t, struct ipq *); + insque(fp, where); + nipq++; + fp->ipq_ttl = IPFRAGTTL; + fp->ipq_p = ip->ip_p; + fp->ipq_id = ip->ip_id; + fp->ipq_src = ip->ip_src; + fp->ipq_dst = ip->ip_dst; + fp->ipq_frags = m; + m->m_nextpkt = NULL; +#ifdef IPDIVERT + fp->ipq_div_info = 0; + fp->ipq_div_cookie = 0; +#endif + goto inserted; + } + +#define GETIP(m) ((struct ip*)((m)->m_pkthdr.header)) + + /* + * Find a segment which begins after this one does. + */ + for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) + if (GETIP(q)->ip_off > ip->ip_off) + break; + + /* + * If there is a preceding segment, it may provide some of + * our data already. If so, drop the data from the incoming + * segment. If it provides all of our data, drop us, otherwise + * stick new segment in the proper place. + * + * If some of the data is dropped from the the preceding + * segment, then it's checksum is invalidated. + */ + if (p) { + i = GETIP(p)->ip_off + GETIP(p)->ip_len - ip->ip_off; + if (i > 0) { + if (i >= ip->ip_len) + goto dropfrag; + m_adj(m, i); + m->m_pkthdr.csum_flags = 0; + ip->ip_off += i; + ip->ip_len -= i; + } + m->m_nextpkt = p->m_nextpkt; + p->m_nextpkt = m; + } else { + m->m_nextpkt = fp->ipq_frags; + fp->ipq_frags = m; + } + + /* + * While we overlap succeeding segments trim them or, + * if they are completely covered, dequeue them. + */ + for (; q != NULL && ip->ip_off + ip->ip_len > GETIP(q)->ip_off; + q = nq) { + i = (ip->ip_off + ip->ip_len) - + GETIP(q)->ip_off; + if (i < GETIP(q)->ip_len) { + GETIP(q)->ip_len -= i; + GETIP(q)->ip_off += i; + m_adj(q, i); + q->m_pkthdr.csum_flags = 0; + break; + } + nq = q->m_nextpkt; + m->m_nextpkt = nq; + m_freem(q); + } + +inserted: + +#ifdef IPDIVERT + /* + * Transfer firewall instructions to the fragment structure. + * Any fragment diverting causes the whole packet to divert. + */ + fp->ipq_div_info = *divinfo; + fp->ipq_div_cookie = *divcookie; + *divinfo = 0; + *divcookie = 0; +#endif + + /* + * Check for complete reassembly. + */ + next = 0; + for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) { + if (GETIP(q)->ip_off != next) + return (0); + next += GETIP(q)->ip_len; + } + /* Make sure the last packet didn't have the IP_MF flag */ + if (p->m_flags & M_FRAG) + return (0); + + /* + * Reassembly is complete. Make sure the packet is a sane size. + */ + q = fp->ipq_frags; + ip = GETIP(q); + if (next + (IP_VHL_HL(ip->ip_vhl) << 2) > IP_MAXPACKET) { + ipstat.ips_toolong++; + ip_freef(fp); + return (0); + } + + /* + * Concatenate fragments. + */ + m = q; + t = m->m_next; + m->m_next = 0; + m_cat(m, t); + nq = q->m_nextpkt; + q->m_nextpkt = 0; + for (q = nq; q != NULL; q = nq) { + nq = q->m_nextpkt; + q->m_nextpkt = NULL; + m->m_pkthdr.csum_flags &= q->m_pkthdr.csum_flags; + m->m_pkthdr.csum_data += q->m_pkthdr.csum_data; + m_cat(m, q); + } + +#ifdef IPDIVERT + /* + * Extract firewall instructions from the fragment structure. + */ + *divinfo = fp->ipq_div_info; + *divcookie = fp->ipq_div_cookie; +#endif + + /* + * Create header for new ip packet by + * modifying header of first packet; + * dequeue and discard fragment reassembly header. + * Make header visible. + */ + ip->ip_len = next; + ip->ip_src = fp->ipq_src; + ip->ip_dst = fp->ipq_dst; + remque(fp); + nipq--; + (void) m_free(dtom(fp)); + ip_nfragpackets--; + m->m_len += (IP_VHL_HL(ip->ip_vhl) << 2); + m->m_data -= (IP_VHL_HL(ip->ip_vhl) << 2); + /* some debugging cruft by sklower, below, will go away soon */ + if (m->m_flags & M_PKTHDR) { /* XXX this should be done elsewhere */ + register int plen = 0; + for (t = m; t; t = t->m_next) + plen += t->m_len; + m->m_pkthdr.len = plen; + } + return (m); + +dropfrag: +#ifdef IPDIVERT + *divinfo = 0; + *divcookie = 0; +#endif + ipstat.ips_fragdropped++; + m_freem(m); + return (0); + +#undef GETIP +} + +/* + * Free a fragment reassembly header and all + * associated datagrams. + */ +static void +ip_freef(fp) + struct ipq *fp; +{ + register struct mbuf *q; + + while (fp->ipq_frags) { + q = fp->ipq_frags; + fp->ipq_frags = q->m_nextpkt; + m_freem(q); + } + remque(fp); + (void) m_free(dtom(fp)); + ip_nfragpackets--; + nipq--; +} + +/* + * IP timer processing; + * if a timer expires on a reassembly + * queue, discard it. + */ +void +ip_slowtimo() +{ + register struct ipq *fp; + int s = splnet(); + int i; + + for (i = 0; i < IPREASS_NHASH; i++) { + fp = ipq[i].next; + if (fp == 0) + continue; + while (fp != &ipq[i]) { + --fp->ipq_ttl; + fp = fp->next; + if (fp->prev->ipq_ttl == 0) { + ipstat.ips_fragtimeout++; + ip_freef(fp->prev); + } + } + } + /* + * If we are over the maximum number of fragments + * (due to the limit being lowered), drain off + * enough to get down to the new limit. + */ + for (i = 0; i < IPREASS_NHASH; i++) { + if (ip_maxfragpackets >= 0) { + while ((ip_nfragpackets > ip_maxfragpackets) && + (ipq[i].next != &ipq[i])) { + ipstat.ips_fragdropped++; + ip_freef(ipq[i].next); + } + } + } + ipflow_slowtimo(); + splx(s); +} + +/* + * Drain off all datagram fragments. + */ +void +ip_drain() +{ + int i; + + for (i = 0; i < IPREASS_NHASH; i++) { + while (ipq[i].next != &ipq[i]) { + ipstat.ips_fragdropped++; + ip_freef(ipq[i].next); + } + } + in_rtqdrain(); +} + +/* + * Do option processing on a datagram, + * possibly discarding it if bad options are encountered, + * or forwarding it if source-routed. + * Returns 1 if packet has been forwarded/freed, + * 0 if the packet should be processed further. + */ +static int +ip_dooptions(m) + struct mbuf *m; +{ + register struct ip *ip = mtod(m, struct ip *); + register u_char *cp; + register struct ip_timestamp *ipt; + register struct in_ifaddr *ia; + int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0; + struct in_addr *sin, dst; + n_time ntime; + + dst = ip->ip_dst; + cp = (u_char *)(ip + 1); + cnt = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof (struct ip); + for (; cnt > 0; cnt -= optlen, cp += optlen) { + opt = cp[IPOPT_OPTVAL]; + if (opt == IPOPT_EOL) + break; + if (opt == IPOPT_NOP) + optlen = 1; + else { + if (cnt < IPOPT_OLEN + sizeof(*cp)) { + code = &cp[IPOPT_OLEN] - (u_char *)ip; + goto bad; + } + optlen = cp[IPOPT_OLEN]; + if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) { + code = &cp[IPOPT_OLEN] - (u_char *)ip; + goto bad; + } + } + switch (opt) { + + default: + break; + + /* + * Source routing with record. + * Find interface with current destination address. + * If none on this machine then drop if strictly routed, + * or do nothing if loosely routed. + * Record interface address and bring up next address + * component. If strictly routed make sure next + * address is on directly accessible net. + */ + case IPOPT_LSRR: + case IPOPT_SSRR: + if (optlen < IPOPT_OFFSET + sizeof(*cp)) { + code = &cp[IPOPT_OLEN] - (u_char *)ip; + goto bad; + } + if ((off = cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { + code = &cp[IPOPT_OFFSET] - (u_char *)ip; + goto bad; + } + ipaddr.sin_addr = ip->ip_dst; + ia = (struct in_ifaddr *) + ifa_ifwithaddr((struct sockaddr *)&ipaddr); + if (ia == 0) { + if (opt == IPOPT_SSRR) { + type = ICMP_UNREACH; + code = ICMP_UNREACH_SRCFAIL; + goto bad; + } + if (!ip_dosourceroute) + goto nosourcerouting; + /* + * Loose routing, and not at next destination + * yet; nothing to do except forward. + */ + break; + } + off--; /* 0 origin */ + if (off > optlen - (int)sizeof(struct in_addr)) { + /* + * End of source route. Should be for us. + */ + if (!ip_acceptsourceroute) + goto nosourcerouting; + save_rte(cp, ip->ip_src); + break; + } + + if (!ip_dosourceroute) { + if (ipforwarding) { + char buf[16]; /* aaa.bbb.ccc.ddd\0 */ + /* + * Acting as a router, so generate ICMP + */ +nosourcerouting: + strcpy(buf, inet_ntoa(ip->ip_dst)); + log(LOG_WARNING, + "attempted source route from %s to %s\n", + inet_ntoa(ip->ip_src), buf); + type = ICMP_UNREACH; + code = ICMP_UNREACH_SRCFAIL; + goto bad; + } else { + /* + * Not acting as a router, so silently drop. + */ + ipstat.ips_cantforward++; + m_freem(m); + return (1); + } + } + + /* + * locate outgoing interface + */ + (void)memcpy(&ipaddr.sin_addr, cp + off, + sizeof(ipaddr.sin_addr)); + + if (opt == IPOPT_SSRR) { +#define INA struct in_ifaddr * +#define SA struct sockaddr * + if ((ia = (INA)ifa_ifwithdstaddr((SA)&ipaddr)) == 0) + ia = (INA)ifa_ifwithnet((SA)&ipaddr); + } else + ia = ip_rtaddr(ipaddr.sin_addr); + if (ia == 0) { + type = ICMP_UNREACH; + code = ICMP_UNREACH_SRCFAIL; + goto bad; + } + ip->ip_dst = ipaddr.sin_addr; + (void)memcpy(cp + off, &(IA_SIN(ia)->sin_addr), + sizeof(struct in_addr)); + cp[IPOPT_OFFSET] += sizeof(struct in_addr); + /* + * Let ip_intr's mcast routing check handle mcast pkts + */ + forward = !IN_MULTICAST(ntohl(ip->ip_dst.s_addr)); + break; + + case IPOPT_RR: + if (optlen < IPOPT_OFFSET + sizeof(*cp)) { + code = &cp[IPOPT_OFFSET] - (u_char *)ip; + goto bad; + } + if ((off = cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { + code = &cp[IPOPT_OFFSET] - (u_char *)ip; + goto bad; + } + /* + * If no space remains, ignore. + */ + off--; /* 0 origin */ + if (off > optlen - (int)sizeof(struct in_addr)) + break; + (void)memcpy(&ipaddr.sin_addr, &ip->ip_dst, + sizeof(ipaddr.sin_addr)); + /* + * locate outgoing interface; if we're the destination, + * use the incoming interface (should be same). + */ + if ((ia = (INA)ifa_ifwithaddr((SA)&ipaddr)) == 0 && + (ia = ip_rtaddr(ipaddr.sin_addr)) == 0) { + type = ICMP_UNREACH; + code = ICMP_UNREACH_HOST; + goto bad; + } + (void)memcpy(cp + off, &(IA_SIN(ia)->sin_addr), + sizeof(struct in_addr)); + cp[IPOPT_OFFSET] += sizeof(struct in_addr); + break; + + case IPOPT_TS: + code = cp - (u_char *)ip; + ipt = (struct ip_timestamp *)cp; + if (ipt->ipt_len < 4 || ipt->ipt_len > 40) { + code = (u_char *)&ipt->ipt_len - (u_char *)ip; + goto bad; + } + if (ipt->ipt_ptr < 5) { + code = (u_char *)&ipt->ipt_ptr - (u_char *)ip; + goto bad; + } + if (ipt->ipt_ptr > + ipt->ipt_len - (int)sizeof(int32_t)) { + if (++ipt->ipt_oflw == 0) { + code = (u_char *)&ipt->ipt_ptr - + (u_char *)ip; + goto bad; + } + break; + } + sin = (struct in_addr *)(cp + ipt->ipt_ptr - 1); + switch (ipt->ipt_flg) { + + case IPOPT_TS_TSONLY: + break; + + case IPOPT_TS_TSANDADDR: + if (ipt->ipt_ptr - 1 + sizeof(n_time) + + sizeof(struct in_addr) > ipt->ipt_len) { + code = (u_char *)&ipt->ipt_ptr - + (u_char *)ip; + goto bad; + } + ipaddr.sin_addr = dst; + ia = (INA)ifaof_ifpforaddr((SA)&ipaddr, + m->m_pkthdr.rcvif); + if (ia == 0) + continue; + (void)memcpy(sin, &IA_SIN(ia)->sin_addr, + sizeof(struct in_addr)); + ipt->ipt_ptr += sizeof(struct in_addr); + break; + + case IPOPT_TS_PRESPEC: + if (ipt->ipt_ptr - 1 + sizeof(n_time) + + sizeof(struct in_addr) > ipt->ipt_len) { + code = (u_char *)&ipt->ipt_ptr - + (u_char *)ip; + goto bad; + } + (void)memcpy(&ipaddr.sin_addr, sin, + sizeof(struct in_addr)); + if (ifa_ifwithaddr((SA)&ipaddr) == 0) + continue; + ipt->ipt_ptr += sizeof(struct in_addr); + break; + + default: + /* XXX can't take &ipt->ipt_flg */ + code = (u_char *)&ipt->ipt_ptr - + (u_char *)ip + 1; + goto bad; + } + ntime = iptime(); + (void)memcpy(cp + ipt->ipt_ptr - 1, &ntime, + sizeof(n_time)); + ipt->ipt_ptr += sizeof(n_time); + } + } + if (forward && ipforwarding) { + ip_forward(m, 1); + return (1); + } + return (0); +bad: + icmp_error(m, type, code, 0, 0); + ipstat.ips_badoptions++; + return (1); +} + +/* + * Given address of next destination (final or next hop), + * return internet address info of interface to be used to get there. + */ +static struct in_ifaddr * +ip_rtaddr(dst) + struct in_addr dst; +{ + register struct sockaddr_in *sin; + + sin = (struct sockaddr_in *) &ipforward_rt.ro_dst; + + if (ipforward_rt.ro_rt == 0 || dst.s_addr != sin->sin_addr.s_addr) { + if (ipforward_rt.ro_rt) { + RTFREE(ipforward_rt.ro_rt); + ipforward_rt.ro_rt = 0; + } + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_addr = dst; + + rtalloc_ign(&ipforward_rt, RTF_PRCLONING); + } + if (ipforward_rt.ro_rt == 0) + return ((struct in_ifaddr *)0); + return ((struct in_ifaddr *) ipforward_rt.ro_rt->rt_ifa); +} + +/* + * Save incoming source route for use in replies, + * to be picked up later by ip_srcroute if the receiver is interested. + */ +void +save_rte(option, dst) + u_char *option; + struct in_addr dst; +{ + unsigned olen; + + olen = option[IPOPT_OLEN]; +#ifdef DIAGNOSTIC + if (ipprintfs) + printf("save_rte: olen %d\n", olen); +#endif + if (olen > sizeof(ip_srcrt) - (1 + sizeof(dst))) + return; + bcopy(option, ip_srcrt.srcopt, olen); + ip_nhops = (olen - IPOPT_OFFSET - 1) / sizeof(struct in_addr); + ip_srcrt.dst = dst; +} + +/* + * Retrieve incoming source route for use in replies, + * in the same form used by setsockopt. + * The first hop is placed before the options, will be removed later. + */ +struct mbuf * +ip_srcroute() +{ + register struct in_addr *p, *q; + register struct mbuf *m; + + if (ip_nhops == 0) + return ((struct mbuf *)0); + m = m_get(M_DONTWAIT, MT_HEADER); + if (m == 0) + return ((struct mbuf *)0); + +#define OPTSIZ (sizeof(ip_srcrt.nop) + sizeof(ip_srcrt.srcopt)) + + /* length is (nhops+1)*sizeof(addr) + sizeof(nop + srcrt header) */ + m->m_len = ip_nhops * sizeof(struct in_addr) + sizeof(struct in_addr) + + OPTSIZ; +#ifdef DIAGNOSTIC + if (ipprintfs) + printf("ip_srcroute: nhops %d mlen %d", ip_nhops, m->m_len); +#endif + + /* + * First save first hop for return route + */ + p = &ip_srcrt.route[ip_nhops - 1]; + *(mtod(m, struct in_addr *)) = *p--; +#ifdef DIAGNOSTIC + if (ipprintfs) + printf(" hops %lx", (u_long)ntohl(mtod(m, struct in_addr *)->s_addr)); +#endif + + /* + * Copy option fields and padding (nop) to mbuf. + */ + ip_srcrt.nop = IPOPT_NOP; + ip_srcrt.srcopt[IPOPT_OFFSET] = IPOPT_MINOFF; + (void)memcpy(mtod(m, caddr_t) + sizeof(struct in_addr), + &ip_srcrt.nop, OPTSIZ); + q = (struct in_addr *)(mtod(m, caddr_t) + + sizeof(struct in_addr) + OPTSIZ); +#undef OPTSIZ + /* + * Record return path as an IP source route, + * reversing the path (pointers are now aligned). + */ + while (p >= ip_srcrt.route) { +#ifdef DIAGNOSTIC + if (ipprintfs) + printf(" %lx", (u_long)ntohl(q->s_addr)); +#endif + *q++ = *p--; + } + /* + * Last hop goes to final destination. + */ + *q = ip_srcrt.dst; +#ifdef DIAGNOSTIC + if (ipprintfs) + printf(" %lx\n", (u_long)ntohl(q->s_addr)); +#endif + return (m); +} + +/* + * Strip out IP options, at higher + * level protocol in the kernel. + * Second argument is buffer to which options + * will be moved, and return value is their length. + * XXX should be deleted; last arg currently ignored. + */ +void +ip_stripoptions(m, mopt) + register struct mbuf *m; + struct mbuf *mopt; +{ + register int i; + struct ip *ip = mtod(m, struct ip *); + register caddr_t opts; + int olen; + + olen = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof (struct ip); + opts = (caddr_t)(ip + 1); + i = m->m_len - (sizeof (struct ip) + olen); + bcopy(opts + olen, opts, (unsigned)i); + m->m_len -= olen; + if (m->m_flags & M_PKTHDR) + m->m_pkthdr.len -= olen; + ip->ip_vhl = IP_MAKE_VHL(IPVERSION, sizeof(struct ip) >> 2); +} + +int inetctlerrmap[PRC_NCMDS] = { + 0, 0, 0, 0, + 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, + EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, + EMSGSIZE, EHOSTUNREACH, 0, 0, + 0, 0, 0, 0, + ENOPROTOOPT, ECONNREFUSED +}; + +/* + * Forward a packet. If some error occurs return the sender + * an icmp packet. Note we can't always generate a meaningful + * icmp message because icmp doesn't have a large enough repertoire + * of codes and types. + * + * If not forwarding, just drop the packet. This could be confusing + * if ipforwarding was zero but some routing protocol was advancing + * us as a gateway to somewhere. However, we must let the routing + * protocol deal with that. + * + * The srcrt parameter indicates whether the packet is being forwarded + * via a source route. + */ +#ifdef NATPT +void +#else +static void +#endif +ip_forward(m, srcrt) + struct mbuf *m; + int srcrt; +{ + register struct ip *ip = mtod(m, struct ip *); + register struct sockaddr_in *sin; + register struct rtentry *rt; + int error, type = 0, code = 0; + struct mbuf *mcopy; + n_long dest; + struct ifnet *destifp; +#ifdef IPSEC + struct ifnet dummyifp; +#endif + + dest = 0; +#ifdef DIAGNOSTIC + if (ipprintfs) + printf("forward: src %lx dst %lx ttl %x\n", + (u_long)ip->ip_src.s_addr, (u_long)ip->ip_dst.s_addr, + ip->ip_ttl); +#endif + + + if (m->m_flags & (M_BCAST|M_MCAST) || in_canforward(ip->ip_dst) == 0) { + ipstat.ips_cantforward++; + m_freem(m); + return; + } +#ifdef IPSTEALTH + if (!ipstealth) { +#endif + if (ip->ip_ttl <= IPTTLDEC) { + icmp_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, + dest, 0); + return; + } +#ifdef IPSTEALTH + } +#endif + + sin = (struct sockaddr_in *)&ipforward_rt.ro_dst; + if ((rt = ipforward_rt.ro_rt) == 0 || + ip->ip_dst.s_addr != sin->sin_addr.s_addr) { + if (ipforward_rt.ro_rt) { + RTFREE(ipforward_rt.ro_rt); + ipforward_rt.ro_rt = 0; + } + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_addr = ip->ip_dst; + + rtalloc_ign(&ipforward_rt, RTF_PRCLONING); + if (ipforward_rt.ro_rt == 0) { + icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, dest, 0); + return; + } + rt = ipforward_rt.ro_rt; + } + + /* + * Save the IP header and at most 8 bytes of the payload, + * in case we need to generate an ICMP message to the src. + * + * We don't use m_copy() because it might return a reference + * to a shared cluster. Both this function and ip_output() + * assume exclusive access to the IP header in `m', so any + * data in a cluster may change before we reach icmp_error(). + */ + MGET(mcopy, M_DONTWAIT, m->m_type); + if (mcopy != NULL) { + M_COPY_PKTHDR(mcopy, m); + mcopy->m_len = imin((IP_VHL_HL(ip->ip_vhl) << 2) + 8, + (int)ip->ip_len); + m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t)); + } + +#ifdef IPSTEALTH + if (!ipstealth) { +#endif + ip->ip_ttl -= IPTTLDEC; +#ifdef IPSTEALTH + } +#endif + + /* + * If forwarding packet using same interface that it came in on, + * perhaps should send a redirect to sender to shortcut a hop. + * Only send redirect if source is sending directly to us, + * and if packet was not source routed (or has any options). + * Also, don't send redirect if forwarding using a default route + * or a route modified by a redirect. + */ +#define satosin(sa) ((struct sockaddr_in *)(sa)) + if (rt->rt_ifp == m->m_pkthdr.rcvif && + (rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 && + satosin(rt_key(rt))->sin_addr.s_addr != 0 && + ipsendredirects && !srcrt) { +#define RTA(rt) ((struct in_ifaddr *)(rt->rt_ifa)) + u_long src = ntohl(ip->ip_src.s_addr); + + if (RTA(rt) && + (src & RTA(rt)->ia_subnetmask) == RTA(rt)->ia_subnet) { + if (rt->rt_flags & RTF_GATEWAY) + dest = satosin(rt->rt_gateway)->sin_addr.s_addr; + else + dest = ip->ip_dst.s_addr; + /* Router requirements says to only send host redirects */ + type = ICMP_REDIRECT; + code = ICMP_REDIRECT_HOST; +#ifdef DIAGNOSTIC + if (ipprintfs) + printf("redirect (%d) to %lx\n", code, (u_long)dest); +#endif + } + } + + error = ip_output(m, (struct mbuf *)0, &ipforward_rt, + IP_FORWARDING, 0); + if (error) + ipstat.ips_cantforward++; + else { + ipstat.ips_forward++; + if (type) + ipstat.ips_redirectsent++; + else { + if (mcopy) { + ipflow_create(&ipforward_rt, mcopy); + m_freem(mcopy); + } + return; + } + } + if (mcopy == NULL) + return; + destifp = NULL; + + switch (error) { + + case 0: /* forwarded, but need redirect */ + /* type, code set above */ + break; + + case ENETUNREACH: /* shouldn't happen, checked above */ + case EHOSTUNREACH: + case ENETDOWN: + case EHOSTDOWN: + default: + type = ICMP_UNREACH; + code = ICMP_UNREACH_HOST; + break; + + case EMSGSIZE: + type = ICMP_UNREACH; + code = ICMP_UNREACH_NEEDFRAG; +#ifndef IPSEC + if (ipforward_rt.ro_rt) + destifp = ipforward_rt.ro_rt->rt_ifp; +#else + /* + * If the packet is routed over IPsec tunnel, tell the + * originator the tunnel MTU. + * tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz + * XXX quickhack!!! + */ + if (ipforward_rt.ro_rt) { + struct secpolicy *sp = NULL; + int ipsecerror; + int ipsechdr; + struct route *ro; + + sp = ipsec4_getpolicybyaddr(mcopy, + IPSEC_DIR_OUTBOUND, + IP_FORWARDING, + &ipsecerror); + + if (sp == NULL) + destifp = ipforward_rt.ro_rt->rt_ifp; + else { + /* count IPsec header size */ + ipsechdr = ipsec4_hdrsiz(mcopy, + IPSEC_DIR_OUTBOUND, + NULL); + + /* + * find the correct route for outer IPv4 + * header, compute tunnel MTU. + * + * XXX BUG ALERT + * The "dummyifp" code relies upon the fact + * that icmp_error() touches only ifp->if_mtu. + */ + /*XXX*/ + destifp = NULL; + if (sp->req != NULL + && sp->req->sav != NULL + && sp->req->sav->sah != NULL) { + ro = &sp->req->sav->sah->sa_route; + if (ro->ro_rt && ro->ro_rt->rt_ifp) { + dummyifp.if_mtu = + ro->ro_rt->rt_ifp->if_mtu; + dummyifp.if_mtu -= ipsechdr; + destifp = &dummyifp; + } + } + + key_freesp(sp); + } + } +#endif /*IPSEC*/ + ipstat.ips_cantfrag++; + break; + + case ENOBUFS: +#ifdef ALTQ + /* + * don't generate ICMP_SOURCEQUENCH + * (RFC1812 Requirements for IP Version 4 Routers) + */ + if (mcopy) + m_freem(mcopy); + return; +#else + type = ICMP_SOURCEQUENCH; + code = 0; + break; +#endif + + case EACCES: /* ipfw denied packet */ + m_freem(mcopy); + return; + } + icmp_error(mcopy, type, code, dest, destifp); +} + +void +ip_savecontrol(inp, mp, ip, m) + register struct inpcb *inp; + register struct mbuf **mp; + register struct ip *ip; + register struct mbuf *m; +{ + if (inp->inp_socket->so_options & SO_TIMESTAMP) { + struct timeval tv; + + microtime(&tv); + *mp = sbcreatecontrol((caddr_t) &tv, sizeof(tv), + SCM_TIMESTAMP, SOL_SOCKET); + if (*mp) + mp = &(*mp)->m_next; + } + if (inp->inp_flags & INP_RECVDSTADDR) { + *mp = sbcreatecontrol((caddr_t) &ip->ip_dst, + sizeof(struct in_addr), IP_RECVDSTADDR, IPPROTO_IP); + if (*mp) + mp = &(*mp)->m_next; + } +#ifdef notyet + /* XXX + * Moving these out of udp_input() made them even more broken + * than they already were. + */ + /* options were tossed already */ + if (inp->inp_flags & INP_RECVOPTS) { + *mp = sbcreatecontrol((caddr_t) opts_deleted_above, + sizeof(struct in_addr), IP_RECVOPTS, IPPROTO_IP); + if (*mp) + mp = &(*mp)->m_next; + } + /* ip_srcroute doesn't do what we want here, need to fix */ + if (inp->inp_flags & INP_RECVRETOPTS) { + *mp = sbcreatecontrol((caddr_t) ip_srcroute(), + sizeof(struct in_addr), IP_RECVRETOPTS, IPPROTO_IP); + if (*mp) + mp = &(*mp)->m_next; + } +#endif + if (inp->inp_flags & INP_RECVIF) { + struct ifnet *ifp; + struct sdlbuf { + struct sockaddr_dl sdl; + u_char pad[32]; + } sdlbuf; + struct sockaddr_dl *sdp; + struct sockaddr_dl *sdl2 = &sdlbuf.sdl; + + if (((ifp = m->m_pkthdr.rcvif)) + && ( ifp->if_index && (ifp->if_index <= if_index))) { + sdp = (struct sockaddr_dl *)(ifnet_addrs + [ifp->if_index - 1]->ifa_addr); + /* + * Change our mind and don't try copy. + */ + if ((sdp->sdl_family != AF_LINK) + || (sdp->sdl_len > sizeof(sdlbuf))) { + goto makedummy; + } + bcopy(sdp, sdl2, sdp->sdl_len); + } else { +makedummy: + sdl2->sdl_len + = offsetof(struct sockaddr_dl, sdl_data[0]); + sdl2->sdl_family = AF_LINK; + sdl2->sdl_index = 0; + sdl2->sdl_nlen = sdl2->sdl_alen = sdl2->sdl_slen = 0; + } + *mp = sbcreatecontrol((caddr_t) sdl2, sdl2->sdl_len, + IP_RECVIF, IPPROTO_IP); + if (*mp) + mp = &(*mp)->m_next; + } +} + +int +ip_rsvp_init(struct socket *so) +{ + if (so->so_type != SOCK_RAW || + so->so_proto->pr_protocol != IPPROTO_RSVP) + return EOPNOTSUPP; + + if (ip_rsvpd != NULL) + return EADDRINUSE; + + ip_rsvpd = so; + /* + * This may seem silly, but we need to be sure we don't over-increment + * the RSVP counter, in case something slips up. + */ + if (!ip_rsvp_on) { + ip_rsvp_on = 1; + rsvp_on++; + } + + return 0; +} + +int +ip_rsvp_done(void) +{ + ip_rsvpd = NULL; + /* + * This may seem silly, but we need to be sure we don't over-decrement + * the RSVP counter, in case something slips up. + */ + if (ip_rsvp_on) { + ip_rsvp_on = 0; + rsvp_on--; + } + return 0; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/ip_mroute.c b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_mroute.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_mroute.c @@ -0,0 +1,2319 @@ +//========================================================================== +// +// src/sys/netinet/ip_mroute.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * IP multicast forwarding procedures + * + * Written by David Waitzman, BBN Labs, August 1988. + * Modified by Steve Deering, Stanford, February 1989. + * Modified by Mark J. Steiglitz, Stanford, May, 1991 + * Modified by Van Jacobson, LBL, January 1993 + * Modified by Ajit Thyagarajan, PARC, August 1993 + * Modified by Bill Fenner, PARC, April 1995 + * + * MROUTING Revision: 3.5 + * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.56.2.2 2001/07/19 06:37:26 kris Exp $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef NTOHL +#if BYTE_ORDER != BIG_ENDIAN +#define NTOHL(d) ((d) = ntohl((d))) +#define NTOHS(d) ((d) = ntohs((u_short)(d))) +#define HTONL(d) ((d) = htonl((d))) +#define HTONS(d) ((d) = htons((u_short)(d))) +#else +#define NTOHL(d) +#define NTOHS(d) +#define HTONL(d) +#define HTONS(d) +#endif +#endif + +#ifndef MROUTING +extern u_long _ip_mcast_src __P((int vifi)); +extern int _ip_mforward __P((struct ip *ip, struct ifnet *ifp, + struct mbuf *m, struct ip_moptions *imo)); +extern int _ip_mrouter_done __P((void)); +extern int _ip_mrouter_get __P((struct socket *so, struct sockopt *sopt)); +extern int _ip_mrouter_set __P((struct socket *so, struct sockopt *sopt)); +extern int _mrt_ioctl __P((int req, caddr_t data, struct proc *p)); + +/* + * Dummy routines and globals used when multicast routing is not compiled in. + */ + +struct socket *ip_mrouter = NULL; +u_int rsvpdebug = 0; + +int +_ip_mrouter_set(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + return(EOPNOTSUPP); +} + +int (*ip_mrouter_set)(struct socket *, struct sockopt *) = _ip_mrouter_set; + + +int +_ip_mrouter_get(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + return(EOPNOTSUPP); +} + +int (*ip_mrouter_get)(struct socket *, struct sockopt *) = _ip_mrouter_get; + +int +_ip_mrouter_done() +{ + return(0); +} + +int (*ip_mrouter_done)(void) = _ip_mrouter_done; + +int +_ip_mforward(ip, ifp, m, imo) + struct ip *ip; + struct ifnet *ifp; + struct mbuf *m; + struct ip_moptions *imo; +{ + return(0); +} + +int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *, + struct ip_moptions *) = _ip_mforward; + +int +_mrt_ioctl(int req, caddr_t data, struct proc *p) +{ + return EOPNOTSUPP; +} + +int (*mrt_ioctl)(int, caddr_t, struct proc *) = _mrt_ioctl; + +void +rsvp_input(m, off) /* XXX must fixup manually */ + struct mbuf *m; + int off; +{ + /* Can still get packets with rsvp_on = 0 if there is a local member + * of the group to which the RSVP packet is addressed. But in this + * case we want to throw the packet away. + */ + if (!rsvp_on) { + m_freem(m); + return; + } + + if (ip_rsvpd != NULL) { + if (rsvpdebug) + printf("rsvp_input: Sending packet up old-style socket\n"); + rip_input(m, off); + return; + } + /* Drop the packet */ + m_freem(m); +} + +void ipip_input(struct mbuf *m, int off) { /* XXX must fixup manually */ + rip_input(m, off); +} + +int (*legal_vif_num)(int) = 0; + +/* + * This should never be called, since IP_MULTICAST_VIF should fail, but + * just in case it does get called, the code a little lower in ip_output + * will assign the packet a local address. + */ +u_long +_ip_mcast_src(int vifi) { return INADDR_ANY; } +u_long (*ip_mcast_src)(int) = _ip_mcast_src; + +int +ip_rsvp_vif_init(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + return(EINVAL); +} + +int +ip_rsvp_vif_done(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + return(EINVAL); +} + +void +ip_rsvp_force_done(so) + struct socket *so; +{ + return; +} + +#else /* MROUTING */ + +#define M_HASCL(m) ((m)->m_flags & M_EXT) + +#define INSIZ sizeof(struct in_addr) +#define same(a1, a2) \ + (bcmp((caddr_t)(a1), (caddr_t)(a2), INSIZ) == 0) + +/* + * Globals. All but ip_mrouter and ip_mrtproto could be static, + * except for netstat or debugging purposes. + */ +#ifndef MROUTE_LKM +struct socket *ip_mrouter = NULL; +static struct mrtstat mrtstat; +#else /* MROUTE_LKM */ +extern void X_ipip_input __P((struct mbuf *m, int iphlen)); +extern struct mrtstat mrtstat; +static int ip_mrtproto; +#endif + +#define NO_RTE_FOUND 0x1 +#define RTE_FOUND 0x2 + +static struct mfc *mfctable[MFCTBLSIZ]; +static u_char nexpire[MFCTBLSIZ]; +static struct vif viftable[MAXVIFS]; +static u_int mrtdebug = 0; /* debug level */ +#define DEBUG_MFC 0x02 +#define DEBUG_FORWARD 0x04 +#define DEBUG_EXPIRE 0x08 +#define DEBUG_XMIT 0x10 +static u_int tbfdebug = 0; /* tbf debug level */ +static u_int rsvpdebug = 0; /* rsvp debug level */ + +static struct callout_handle expire_upcalls_ch; + +#define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */ +#define UPCALL_EXPIRE 6 /* number of timeouts */ + +/* + * Define the token bucket filter structures + * tbftable -> each vif has one of these for storing info + */ + +static struct tbf tbftable[MAXVIFS]; +#define TBF_REPROCESS (hz / 100) /* 100x / second */ + +/* + * 'Interfaces' associated with decapsulator (so we can tell + * packets that went through it from ones that get reflected + * by a broken gateway). These interfaces are never linked into + * the system ifnet list & no routes point to them. I.e., packets + * can't be sent this way. They only exist as a placeholder for + * multicast source verification. + */ +static struct ifnet multicast_decap_if[MAXVIFS]; + +#define ENCAP_TTL 64 +#define ENCAP_PROTO IPPROTO_IPIP /* 4 */ + +/* prototype IP hdr for encapsulated packets */ +static struct ip multicast_encap_iphdr = { +#if BYTE_ORDER == LITTLE_ENDIAN + sizeof(struct ip) >> 2, IPVERSION, +#else + IPVERSION, sizeof(struct ip) >> 2, +#endif + 0, /* tos */ + sizeof(struct ip), /* total length */ + 0, /* id */ + 0, /* frag offset */ + ENCAP_TTL, ENCAP_PROTO, + 0, /* checksum */ +}; + +/* + * Private variables. + */ +static vifi_t numvifs = 0; +static int have_encap_tunnel = 0; + +/* + * one-back cache used by ipip_input to locate a tunnel's vif + * given a datagram's src ip address. + */ +static u_long last_encap_src; +static struct vif *last_encap_vif; + +static u_long X_ip_mcast_src __P((int vifi)); +static int X_ip_mforward __P((struct ip *ip, struct ifnet *ifp, struct mbuf *m, struct ip_moptions *imo)); +static int X_ip_mrouter_done __P((void)); +static int X_ip_mrouter_get __P((struct socket *so, struct sockopt *m)); +static int X_ip_mrouter_set __P((struct socket *so, struct sockopt *m)); +static int X_legal_vif_num __P((int vif)); +static int X_mrt_ioctl __P((int cmd, caddr_t data)); + +static int get_sg_cnt(struct sioc_sg_req *); +static int get_vif_cnt(struct sioc_vif_req *); +static int ip_mrouter_init(struct socket *, int); +static int add_vif(struct vifctl *); +static int del_vif(vifi_t); +static int add_mfc(struct mfcctl *); +static int del_mfc(struct mfcctl *); +static int socket_send(struct socket *, struct mbuf *, struct sockaddr_in *); +static int set_assert(int); +static void expire_upcalls(void *); +static int ip_mdq(struct mbuf *, struct ifnet *, struct mfc *, + vifi_t); +static void phyint_send(struct ip *, struct vif *, struct mbuf *); +static void encap_send(struct ip *, struct vif *, struct mbuf *); +static void tbf_control(struct vif *, struct mbuf *, struct ip *, u_long); +static void tbf_queue(struct vif *, struct mbuf *); +static void tbf_process_q(struct vif *); +static void tbf_reprocess_q(void *); +static int tbf_dq_sel(struct vif *, struct ip *); +static void tbf_send_packet(struct vif *, struct mbuf *); +static void tbf_update_tokens(struct vif *); +static int priority(struct vif *, struct ip *); +void multiencap_decap(struct mbuf *); + +/* + * whether or not special PIM assert processing is enabled. + */ +static int pim_assert; +/* + * Rate limit for assert notification messages, in usec + */ +#define ASSERT_MSG_TIME 3000000 + +/* + * Hash function for a source, group entry + */ +#define MFCHASH(a, g) MFCHASHMOD(((a) >> 20) ^ ((a) >> 10) ^ (a) ^ \ + ((g) >> 20) ^ ((g) >> 10) ^ (g)) + +/* + * Find a route for a given origin IP address and Multicast group address + * Type of service parameter to be added in the future!!! + */ + +#define MFCFIND(o, g, rt) { \ + register struct mfc *_rt = mfctable[MFCHASH(o,g)]; \ + rt = NULL; \ + ++mrtstat.mrts_mfc_lookups; \ + while (_rt) { \ + if ((_rt->mfc_origin.s_addr == o) && \ + (_rt->mfc_mcastgrp.s_addr == g) && \ + (_rt->mfc_stall == NULL)) { \ + rt = _rt; \ + break; \ + } \ + _rt = _rt->mfc_next; \ + } \ + if (rt == NULL) { \ + ++mrtstat.mrts_mfc_misses; \ + } \ +} + + +/* + * Macros to compute elapsed time efficiently + * Borrowed from Van Jacobson's scheduling code + */ +#define TV_DELTA(a, b, delta) { \ + register int xxs; \ + \ + delta = (a).tv_usec - (b).tv_usec; \ + if ((xxs = (a).tv_sec - (b).tv_sec)) { \ + switch (xxs) { \ + case 2: \ + delta += 1000000; \ + /* fall through */ \ + case 1: \ + delta += 1000000; \ + break; \ + default: \ + delta += (1000000 * xxs); \ + } \ + } \ +} + +#define TV_LT(a, b) (((a).tv_usec < (b).tv_usec && \ + (a).tv_sec <= (b).tv_sec) || (a).tv_sec < (b).tv_sec) + +#ifdef UPCALL_TIMING +u_long upcall_data[51]; +static void collate(struct timeval *); +#endif /* UPCALL_TIMING */ + + +/* + * Handle MRT setsockopt commands to modify the multicast routing tables. + */ +static int +X_ip_mrouter_set(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + int error, optval; + vifi_t vifi; + struct vifctl vifc; + struct mfcctl mfc; + + if (so != ip_mrouter && sopt->sopt_name != MRT_INIT) + return (EPERM); + + error = 0; + switch (sopt->sopt_name) { + case MRT_INIT: + error = sooptcopyin(sopt, &optval, sizeof optval, + sizeof optval); + if (error) + break; + error = ip_mrouter_init(so, optval); + break; + + case MRT_DONE: + error = ip_mrouter_done(); + break; + + case MRT_ADD_VIF: + error = sooptcopyin(sopt, &vifc, sizeof vifc, sizeof vifc); + if (error) + break; + error = add_vif(&vifc); + break; + + case MRT_DEL_VIF: + error = sooptcopyin(sopt, &vifi, sizeof vifi, sizeof vifi); + if (error) + break; + error = del_vif(vifi); + break; + + case MRT_ADD_MFC: + case MRT_DEL_MFC: + error = sooptcopyin(sopt, &mfc, sizeof mfc, sizeof mfc); + if (error) + break; + if (sopt->sopt_name == MRT_ADD_MFC) + error = add_mfc(&mfc); + else + error = del_mfc(&mfc); + break; + + case MRT_ASSERT: + error = sooptcopyin(sopt, &optval, sizeof optval, + sizeof optval); + if (error) + break; + set_assert(optval); + break; + + default: + error = EOPNOTSUPP; + break; + } + return (error); +} + +#ifndef MROUTE_LKM +int (*ip_mrouter_set)(struct socket *, struct sockopt *) = X_ip_mrouter_set; +#endif + +/* + * Handle MRT getsockopt commands + */ +static int +X_ip_mrouter_get(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + int error; + static int version = 0x0305; /* !!! why is this here? XXX */ + + switch (sopt->sopt_name) { + case MRT_VERSION: + error = sooptcopyout(sopt, &version, sizeof version); + break; + + case MRT_ASSERT: + error = sooptcopyout(sopt, &pim_assert, sizeof pim_assert); + break; + default: + error = EOPNOTSUPP; + break; + } + return (error); +} + +#ifndef MROUTE_LKM +int (*ip_mrouter_get)(struct socket *, struct sockopt *) = X_ip_mrouter_get; +#endif + +/* + * Handle ioctl commands to obtain information from the cache + */ +static int +X_mrt_ioctl(cmd, data) + int cmd; + caddr_t data; +{ + int error = 0; + + switch (cmd) { + case (SIOCGETVIFCNT): + return (get_vif_cnt((struct sioc_vif_req *)data)); + break; + case (SIOCGETSGCNT): + return (get_sg_cnt((struct sioc_sg_req *)data)); + break; + default: + return (EINVAL); + break; + } + return error; +} + +#ifndef MROUTE_LKM +int (*mrt_ioctl)(int, caddr_t) = X_mrt_ioctl; +#endif + +/* + * returns the packet, byte, rpf-failure count for the source group provided + */ +static int +get_sg_cnt(req) + register struct sioc_sg_req *req; +{ + register struct mfc *rt; + int s; + + s = splnet(); + MFCFIND(req->src.s_addr, req->grp.s_addr, rt); + splx(s); + if (rt != NULL) { + req->pktcnt = rt->mfc_pkt_cnt; + req->bytecnt = rt->mfc_byte_cnt; + req->wrong_if = rt->mfc_wrong_if; + } else + req->pktcnt = req->bytecnt = req->wrong_if = 0xffffffff; + + return 0; +} + +/* + * returns the input and output packet and byte counts on the vif provided + */ +static int +get_vif_cnt(req) + register struct sioc_vif_req *req; +{ + register vifi_t vifi = req->vifi; + + if (vifi >= numvifs) return EINVAL; + + req->icount = viftable[vifi].v_pkt_in; + req->ocount = viftable[vifi].v_pkt_out; + req->ibytes = viftable[vifi].v_bytes_in; + req->obytes = viftable[vifi].v_bytes_out; + + return 0; +} + +/* + * Enable multicast routing + */ +static int +ip_mrouter_init(so, version) + struct socket *so; + int version; +{ + if (mrtdebug) + log(LOG_DEBUG,"ip_mrouter_init: so_type = %d, pr_protocol = %d\n", + so->so_type, so->so_proto->pr_protocol); + + if (so->so_type != SOCK_RAW || + so->so_proto->pr_protocol != IPPROTO_IGMP) return EOPNOTSUPP; + + if (version != 1) + return ENOPROTOOPT; + + if (ip_mrouter != NULL) return EADDRINUSE; + + ip_mrouter = so; + + bzero((caddr_t)mfctable, sizeof(mfctable)); + bzero((caddr_t)nexpire, sizeof(nexpire)); + + pim_assert = 0; + + expire_upcalls_ch = timeout(expire_upcalls, (caddr_t)NULL, EXPIRE_TIMEOUT); + + if (mrtdebug) + log(LOG_DEBUG, "ip_mrouter_init\n"); + + return 0; +} + +/* + * Disable multicast routing + */ +static int +X_ip_mrouter_done() +{ + vifi_t vifi; + int i; + struct ifnet *ifp; + struct ifreq ifr; + struct mfc *rt; + struct rtdetq *rte; + int s; + + s = splnet(); + + /* + * For each phyint in use, disable promiscuous reception of all IP + * multicasts. + */ + for (vifi = 0; vifi < numvifs; vifi++) { + if (viftable[vifi].v_lcl_addr.s_addr != 0 && + !(viftable[vifi].v_flags & VIFF_TUNNEL)) { + ((struct sockaddr_in *)&(ifr.ifr_addr))->sin_family = AF_INET; + ((struct sockaddr_in *)&(ifr.ifr_addr))->sin_addr.s_addr + = INADDR_ANY; + ifp = viftable[vifi].v_ifp; + if_allmulti(ifp, 0); + } + } + bzero((caddr_t)tbftable, sizeof(tbftable)); + bzero((caddr_t)viftable, sizeof(viftable)); + numvifs = 0; + pim_assert = 0; + + untimeout(expire_upcalls, (caddr_t)NULL, expire_upcalls_ch); + + /* + * Free all multicast forwarding cache entries. + */ + for (i = 0; i < MFCTBLSIZ; i++) { + for (rt = mfctable[i]; rt != NULL; ) { + struct mfc *nr = rt->mfc_next; + + for (rte = rt->mfc_stall; rte != NULL; ) { + struct rtdetq *n = rte->next; + + m_freem(rte->m); + free(rte, M_MRTABLE); + rte = n; + } + free(rt, M_MRTABLE); + rt = nr; + } + } + + bzero((caddr_t)mfctable, sizeof(mfctable)); + + /* + * Reset de-encapsulation cache + */ + last_encap_src = 0; + last_encap_vif = NULL; + have_encap_tunnel = 0; + + ip_mrouter = NULL; + + splx(s); + + if (mrtdebug) + log(LOG_DEBUG, "ip_mrouter_done\n"); + + return 0; +} + +#ifndef MROUTE_LKM +int (*ip_mrouter_done)(void) = X_ip_mrouter_done; +#endif + +/* + * Set PIM assert processing global + */ +static int +set_assert(i) + int i; +{ + if ((i != 1) && (i != 0)) + return EINVAL; + + pim_assert = i; + + return 0; +} + +/* + * Add a vif to the vif table + */ +static int +add_vif(vifcp) + register struct vifctl *vifcp; +{ + register struct vif *vifp = viftable + vifcp->vifc_vifi; + static struct sockaddr_in sin = {sizeof sin, AF_INET}; + struct ifaddr *ifa; + struct ifnet *ifp; + int error, s; + struct tbf *v_tbf = tbftable + vifcp->vifc_vifi; + + if (vifcp->vifc_vifi >= MAXVIFS) return EINVAL; + if (vifp->v_lcl_addr.s_addr != 0) return EADDRINUSE; + + /* Find the interface with an address in AF_INET family */ + sin.sin_addr = vifcp->vifc_lcl_addr; + ifa = ifa_ifwithaddr((struct sockaddr *)&sin); + if (ifa == 0) return EADDRNOTAVAIL; + ifp = ifa->ifa_ifp; + + if (vifcp->vifc_flags & VIFF_TUNNEL) { + if ((vifcp->vifc_flags & VIFF_SRCRT) == 0) { + /* + * An encapsulating tunnel is wanted. Tell ipip_input() to + * start paying attention to encapsulated packets. + */ + if (have_encap_tunnel == 0) { + have_encap_tunnel = 1; + for (s = 0; s < MAXVIFS; ++s) { + multicast_decap_if[s].if_name = "mdecap"; + multicast_decap_if[s].if_unit = s; + } + } + /* + * Set interface to fake encapsulator interface + */ + ifp = &multicast_decap_if[vifcp->vifc_vifi]; + /* + * Prepare cached route entry + */ + bzero(&vifp->v_route, sizeof(vifp->v_route)); + } else { + log(LOG_ERR, "source routed tunnels not supported\n"); + return EOPNOTSUPP; + } + } else { + /* Make sure the interface supports multicast */ + if ((ifp->if_flags & IFF_MULTICAST) == 0) + return EOPNOTSUPP; + + /* Enable promiscuous reception of all IP multicasts from the if */ + s = splnet(); + error = if_allmulti(ifp, 1); + splx(s); + if (error) + return error; + } + + s = splnet(); + /* define parameters for the tbf structure */ + vifp->v_tbf = v_tbf; + GET_TIME(vifp->v_tbf->tbf_last_pkt_t); + vifp->v_tbf->tbf_n_tok = 0; + vifp->v_tbf->tbf_q_len = 0; + vifp->v_tbf->tbf_max_q_len = MAXQSIZE; + vifp->v_tbf->tbf_q = vifp->v_tbf->tbf_t = NULL; + + vifp->v_flags = vifcp->vifc_flags; + vifp->v_threshold = vifcp->vifc_threshold; + vifp->v_lcl_addr = vifcp->vifc_lcl_addr; + vifp->v_rmt_addr = vifcp->vifc_rmt_addr; + vifp->v_ifp = ifp; + /* scaling up here allows division by 1024 in critical code */ + vifp->v_rate_limit= vifcp->vifc_rate_limit * 1024 / 1000; + vifp->v_rsvp_on = 0; + vifp->v_rsvpd = NULL; + /* initialize per vif pkt counters */ + vifp->v_pkt_in = 0; + vifp->v_pkt_out = 0; + vifp->v_bytes_in = 0; + vifp->v_bytes_out = 0; + splx(s); + + /* Adjust numvifs up if the vifi is higher than numvifs */ + if (numvifs <= vifcp->vifc_vifi) numvifs = vifcp->vifc_vifi + 1; + + if (mrtdebug) + log(LOG_DEBUG, "add_vif #%d, lcladdr %lx, %s %lx, thresh %x, rate %d\n", + vifcp->vifc_vifi, + (u_long)ntohl(vifcp->vifc_lcl_addr.s_addr), + (vifcp->vifc_flags & VIFF_TUNNEL) ? "rmtaddr" : "mask", + (u_long)ntohl(vifcp->vifc_rmt_addr.s_addr), + vifcp->vifc_threshold, + vifcp->vifc_rate_limit); + + return 0; +} + +/* + * Delete a vif from the vif table + */ +static int +del_vif(vifi) + vifi_t vifi; +{ + register struct vif *vifp = &viftable[vifi]; + register struct mbuf *m; + struct ifnet *ifp; + struct ifreq ifr; + int s; + + if (vifi >= numvifs) return EINVAL; + if (vifp->v_lcl_addr.s_addr == 0) return EADDRNOTAVAIL; + + s = splnet(); + + if (!(vifp->v_flags & VIFF_TUNNEL)) { + ((struct sockaddr_in *)&(ifr.ifr_addr))->sin_family = AF_INET; + ((struct sockaddr_in *)&(ifr.ifr_addr))->sin_addr.s_addr = INADDR_ANY; + ifp = vifp->v_ifp; + if_allmulti(ifp, 0); + } + + if (vifp == last_encap_vif) { + last_encap_vif = 0; + last_encap_src = 0; + } + + /* + * Free packets queued at the interface + */ + while (vifp->v_tbf->tbf_q) { + m = vifp->v_tbf->tbf_q; + vifp->v_tbf->tbf_q = m->m_act; + m_freem(m); + } + + bzero((caddr_t)vifp->v_tbf, sizeof(*(vifp->v_tbf))); + bzero((caddr_t)vifp, sizeof (*vifp)); + + if (mrtdebug) + log(LOG_DEBUG, "del_vif %d, numvifs %d\n", vifi, numvifs); + + /* Adjust numvifs down */ + for (vifi = numvifs; vifi > 0; vifi--) + if (viftable[vifi-1].v_lcl_addr.s_addr != 0) break; + numvifs = vifi; + + splx(s); + + return 0; +} + +/* + * Add an mfc entry + */ +static int +add_mfc(mfccp) + struct mfcctl *mfccp; +{ + struct mfc *rt; + u_long hash; + struct rtdetq *rte; + register u_short nstl; + int s; + int i; + + MFCFIND(mfccp->mfcc_origin.s_addr, mfccp->mfcc_mcastgrp.s_addr, rt); + + /* If an entry already exists, just update the fields */ + if (rt) { + if (mrtdebug & DEBUG_MFC) + log(LOG_DEBUG,"add_mfc update o %lx g %lx p %x\n", + (u_long)ntohl(mfccp->mfcc_origin.s_addr), + (u_long)ntohl(mfccp->mfcc_mcastgrp.s_addr), + mfccp->mfcc_parent); + + s = splnet(); + rt->mfc_parent = mfccp->mfcc_parent; + for (i = 0; i < numvifs; i++) + rt->mfc_ttls[i] = mfccp->mfcc_ttls[i]; + splx(s); + return 0; + } + + /* + * Find the entry for which the upcall was made and update + */ + s = splnet(); + hash = MFCHASH(mfccp->mfcc_origin.s_addr, mfccp->mfcc_mcastgrp.s_addr); + for (rt = mfctable[hash], nstl = 0; rt; rt = rt->mfc_next) { + + if ((rt->mfc_origin.s_addr == mfccp->mfcc_origin.s_addr) && + (rt->mfc_mcastgrp.s_addr == mfccp->mfcc_mcastgrp.s_addr) && + (rt->mfc_stall != NULL)) { + + if (nstl++) + log(LOG_ERR, "add_mfc %s o %lx g %lx p %x dbx %p\n", + "multiple kernel entries", + (u_long)ntohl(mfccp->mfcc_origin.s_addr), + (u_long)ntohl(mfccp->mfcc_mcastgrp.s_addr), + mfccp->mfcc_parent, (void *)rt->mfc_stall); + + if (mrtdebug & DEBUG_MFC) + log(LOG_DEBUG,"add_mfc o %lx g %lx p %x dbg %p\n", + (u_long)ntohl(mfccp->mfcc_origin.s_addr), + (u_long)ntohl(mfccp->mfcc_mcastgrp.s_addr), + mfccp->mfcc_parent, (void *)rt->mfc_stall); + + rt->mfc_origin = mfccp->mfcc_origin; + rt->mfc_mcastgrp = mfccp->mfcc_mcastgrp; + rt->mfc_parent = mfccp->mfcc_parent; + for (i = 0; i < numvifs; i++) + rt->mfc_ttls[i] = mfccp->mfcc_ttls[i]; + /* initialize pkt counters per src-grp */ + rt->mfc_pkt_cnt = 0; + rt->mfc_byte_cnt = 0; + rt->mfc_wrong_if = 0; + rt->mfc_last_assert.tv_sec = rt->mfc_last_assert.tv_usec = 0; + + rt->mfc_expire = 0; /* Don't clean this guy up */ + nexpire[hash]--; + + /* free packets Qed at the end of this entry */ + for (rte = rt->mfc_stall; rte != NULL; ) { + struct rtdetq *n = rte->next; + + ip_mdq(rte->m, rte->ifp, rt, -1); + m_freem(rte->m); +#ifdef UPCALL_TIMING + collate(&(rte->t)); +#endif /* UPCALL_TIMING */ + free(rte, M_MRTABLE); + rte = n; + } + rt->mfc_stall = NULL; + } + } + + /* + * It is possible that an entry is being inserted without an upcall + */ + if (nstl == 0) { + if (mrtdebug & DEBUG_MFC) + log(LOG_DEBUG,"add_mfc no upcall h %lu o %lx g %lx p %x\n", + hash, (u_long)ntohl(mfccp->mfcc_origin.s_addr), + (u_long)ntohl(mfccp->mfcc_mcastgrp.s_addr), + mfccp->mfcc_parent); + + for (rt = mfctable[hash]; rt != NULL; rt = rt->mfc_next) { + + if ((rt->mfc_origin.s_addr == mfccp->mfcc_origin.s_addr) && + (rt->mfc_mcastgrp.s_addr == mfccp->mfcc_mcastgrp.s_addr)) { + + rt->mfc_origin = mfccp->mfcc_origin; + rt->mfc_mcastgrp = mfccp->mfcc_mcastgrp; + rt->mfc_parent = mfccp->mfcc_parent; + for (i = 0; i < numvifs; i++) + rt->mfc_ttls[i] = mfccp->mfcc_ttls[i]; + /* initialize pkt counters per src-grp */ + rt->mfc_pkt_cnt = 0; + rt->mfc_byte_cnt = 0; + rt->mfc_wrong_if = 0; + rt->mfc_last_assert.tv_sec = rt->mfc_last_assert.tv_usec = 0; + if (rt->mfc_expire) + nexpire[hash]--; + rt->mfc_expire = 0; + } + } + if (rt == NULL) { + /* no upcall, so make a new entry */ + rt = (struct mfc *)malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT); + if (rt == NULL) { + splx(s); + return ENOBUFS; + } + + /* insert new entry at head of hash chain */ + rt->mfc_origin = mfccp->mfcc_origin; + rt->mfc_mcastgrp = mfccp->mfcc_mcastgrp; + rt->mfc_parent = mfccp->mfcc_parent; + for (i = 0; i < numvifs; i++) + rt->mfc_ttls[i] = mfccp->mfcc_ttls[i]; + /* initialize pkt counters per src-grp */ + rt->mfc_pkt_cnt = 0; + rt->mfc_byte_cnt = 0; + rt->mfc_wrong_if = 0; + rt->mfc_last_assert.tv_sec = rt->mfc_last_assert.tv_usec = 0; + rt->mfc_expire = 0; + rt->mfc_stall = NULL; + + /* link into table */ + rt->mfc_next = mfctable[hash]; + mfctable[hash] = rt; + } + } + splx(s); + return 0; +} + +#ifdef UPCALL_TIMING +/* + * collect delay statistics on the upcalls + */ +static void collate(t) +register struct timeval *t; +{ + register u_long d; + register struct timeval tp; + register u_long delta; + + GET_TIME(tp); + + if (TV_LT(*t, tp)) + { + TV_DELTA(tp, *t, delta); + + d = delta >> 10; + if (d > 50) + d = 50; + + ++upcall_data[d]; + } +} +#endif /* UPCALL_TIMING */ + +/* + * Delete an mfc entry + */ +static int +del_mfc(mfccp) + struct mfcctl *mfccp; +{ + struct in_addr origin; + struct in_addr mcastgrp; + struct mfc *rt; + struct mfc **nptr; + u_long hash; + int s; + + origin = mfccp->mfcc_origin; + mcastgrp = mfccp->mfcc_mcastgrp; + hash = MFCHASH(origin.s_addr, mcastgrp.s_addr); + + if (mrtdebug & DEBUG_MFC) + log(LOG_DEBUG,"del_mfc orig %lx mcastgrp %lx\n", + (u_long)ntohl(origin.s_addr), (u_long)ntohl(mcastgrp.s_addr)); + + s = splnet(); + + nptr = &mfctable[hash]; + while ((rt = *nptr) != NULL) { + if (origin.s_addr == rt->mfc_origin.s_addr && + mcastgrp.s_addr == rt->mfc_mcastgrp.s_addr && + rt->mfc_stall == NULL) + break; + + nptr = &rt->mfc_next; + } + if (rt == NULL) { + splx(s); + return EADDRNOTAVAIL; + } + + *nptr = rt->mfc_next; + free(rt, M_MRTABLE); + + splx(s); + + return 0; +} + +/* + * Send a message to mrouted on the multicast routing socket + */ +static int +socket_send(s, mm, src) + struct socket *s; + struct mbuf *mm; + struct sockaddr_in *src; +{ + if (s) { + if (sbappendaddr(&s->so_rcv, + (struct sockaddr *)src, + mm, (struct mbuf *)0) != 0) { + sorwakeup(s); + return 0; + } + } + m_freem(mm); + return -1; +} + +/* + * IP multicast forwarding function. This function assumes that the packet + * pointed to by "ip" has arrived on (or is about to be sent to) the interface + * pointed to by "ifp", and the packet is to be relayed to other networks + * that have members of the packet's destination IP multicast group. + * + * The packet is returned unscathed to the caller, unless it is + * erroneous, in which case a non-zero return value tells the caller to + * discard it. + */ + +#define IP_HDR_LEN 20 /* # bytes of fixed IP header (excluding options) */ +#define TUNNEL_LEN 12 /* # bytes of IP option for tunnel encapsulation */ + +static int +X_ip_mforward(ip, ifp, m, imo) + register struct ip *ip; + struct ifnet *ifp; + struct mbuf *m; + struct ip_moptions *imo; +{ + register struct mfc *rt; + register u_char *ipoptions; + static struct sockaddr_in k_igmpsrc = { sizeof k_igmpsrc, AF_INET }; + static int srctun = 0; + register struct mbuf *mm; + int s; + vifi_t vifi; + struct vif *vifp; + + if (mrtdebug & DEBUG_FORWARD) + log(LOG_DEBUG, "ip_mforward: src %lx, dst %lx, ifp %p\n", + (u_long)ntohl(ip->ip_src.s_addr), (u_long)ntohl(ip->ip_dst.s_addr), + (void *)ifp); + + if (ip->ip_hl < (IP_HDR_LEN + TUNNEL_LEN) >> 2 || + (ipoptions = (u_char *)(ip + 1))[1] != IPOPT_LSRR ) { + /* + * Packet arrived via a physical interface or + * an encapsulated tunnel. + */ + } else { + /* + * Packet arrived through a source-route tunnel. + * Source-route tunnels are no longer supported. + */ + if ((srctun++ % 1000) == 0) + log(LOG_ERR, + "ip_mforward: received source-routed packet from %lx\n", + (u_long)ntohl(ip->ip_src.s_addr)); + + return 1; + } + + if ((imo) && ((vifi = imo->imo_multicast_vif) < numvifs)) { + if (ip->ip_ttl < 255) + ip->ip_ttl++; /* compensate for -1 in *_send routines */ + if (rsvpdebug && ip->ip_p == IPPROTO_RSVP) { + vifp = viftable + vifi; + printf("Sending IPPROTO_RSVP from %lx to %lx on vif %d (%s%s%d)\n", + ntohl(ip->ip_src.s_addr), ntohl(ip->ip_dst.s_addr), vifi, + (vifp->v_flags & VIFF_TUNNEL) ? "tunnel on " : "", + vifp->v_ifp->if_name, vifp->v_ifp->if_unit); + } + return (ip_mdq(m, ifp, NULL, vifi)); + } + if (rsvpdebug && ip->ip_p == IPPROTO_RSVP) { + printf("Warning: IPPROTO_RSVP from %lx to %lx without vif option\n", + ntohl(ip->ip_src.s_addr), ntohl(ip->ip_dst.s_addr)); + if(!imo) + printf("In fact, no options were specified at all\n"); + } + + /* + * Don't forward a packet with time-to-live of zero or one, + * or a packet destined to a local-only group. + */ + if (ip->ip_ttl <= 1 || + ntohl(ip->ip_dst.s_addr) <= INADDR_MAX_LOCAL_GROUP) + return 0; + + /* + * Determine forwarding vifs from the forwarding cache table + */ + s = splnet(); + MFCFIND(ip->ip_src.s_addr, ip->ip_dst.s_addr, rt); + + /* Entry exists, so forward if necessary */ + if (rt != NULL) { + splx(s); + return (ip_mdq(m, ifp, rt, -1)); + } else { + /* + * If we don't have a route for packet's origin, + * Make a copy of the packet & + * send message to routing daemon + */ + + register struct mbuf *mb0; + register struct rtdetq *rte; + register u_long hash; + int hlen = ip->ip_hl << 2; +#ifdef UPCALL_TIMING + struct timeval tp; + + GET_TIME(tp); +#endif + + mrtstat.mrts_no_route++; + if (mrtdebug & (DEBUG_FORWARD | DEBUG_MFC)) + log(LOG_DEBUG, "ip_mforward: no rte s %lx g %lx\n", + (u_long)ntohl(ip->ip_src.s_addr), + (u_long)ntohl(ip->ip_dst.s_addr)); + + /* + * Allocate mbufs early so that we don't do extra work if we are + * just going to fail anyway. Make sure to pullup the header so + * that other people can't step on it. + */ + rte = (struct rtdetq *)malloc((sizeof *rte), M_MRTABLE, M_NOWAIT); + if (rte == NULL) { + splx(s); + return ENOBUFS; + } + mb0 = m_copy(m, 0, M_COPYALL); + if (mb0 && (M_HASCL(mb0) || mb0->m_len < hlen)) + mb0 = m_pullup(mb0, hlen); + if (mb0 == NULL) { + free(rte, M_MRTABLE); + splx(s); + return ENOBUFS; + } + + /* is there an upcall waiting for this packet? */ + hash = MFCHASH(ip->ip_src.s_addr, ip->ip_dst.s_addr); + for (rt = mfctable[hash]; rt; rt = rt->mfc_next) { + if ((ip->ip_src.s_addr == rt->mfc_origin.s_addr) && + (ip->ip_dst.s_addr == rt->mfc_mcastgrp.s_addr) && + (rt->mfc_stall != NULL)) + break; + } + + if (rt == NULL) { + int i; + struct igmpmsg *im; + + /* no upcall, so make a new entry */ + rt = (struct mfc *)malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT); + if (rt == NULL) { + free(rte, M_MRTABLE); + m_freem(mb0); + splx(s); + return ENOBUFS; + } + /* Make a copy of the header to send to the user level process */ + mm = m_copy(mb0, 0, hlen); + if (mm == NULL) { + free(rte, M_MRTABLE); + m_freem(mb0); + free(rt, M_MRTABLE); + splx(s); + return ENOBUFS; + } + + /* + * Send message to routing daemon to install + * a route into the kernel table + */ + k_igmpsrc.sin_addr = ip->ip_src; + + im = mtod(mm, struct igmpmsg *); + im->im_msgtype = IGMPMSG_NOCACHE; + im->im_mbz = 0; + + mrtstat.mrts_upcalls++; + + if (socket_send(ip_mrouter, mm, &k_igmpsrc) < 0) { + log(LOG_WARNING, "ip_mforward: ip_mrouter socket queue full\n"); + ++mrtstat.mrts_upq_sockfull; + free(rte, M_MRTABLE); + m_freem(mb0); + free(rt, M_MRTABLE); + splx(s); + return ENOBUFS; + } + + /* insert new entry at head of hash chain */ + rt->mfc_origin.s_addr = ip->ip_src.s_addr; + rt->mfc_mcastgrp.s_addr = ip->ip_dst.s_addr; + rt->mfc_expire = UPCALL_EXPIRE; + nexpire[hash]++; + for (i = 0; i < numvifs; i++) + rt->mfc_ttls[i] = 0; + rt->mfc_parent = -1; + + /* link into table */ + rt->mfc_next = mfctable[hash]; + mfctable[hash] = rt; + rt->mfc_stall = rte; + + } else { + /* determine if q has overflowed */ + int npkts = 0; + struct rtdetq **p; + + for (p = &rt->mfc_stall; *p != NULL; p = &(*p)->next) + npkts++; + + if (npkts > MAX_UPQ) { + mrtstat.mrts_upq_ovflw++; + free(rte, M_MRTABLE); + m_freem(mb0); + splx(s); + return 0; + } + + /* Add this entry to the end of the queue */ + *p = rte; + } + + rte->m = mb0; + rte->ifp = ifp; +#ifdef UPCALL_TIMING + rte->t = tp; +#endif + rte->next = NULL; + + splx(s); + + return 0; + } +} + +#ifndef MROUTE_LKM +int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *, + struct ip_moptions *) = X_ip_mforward; +#endif + +/* + * Clean up the cache entry if upcall is not serviced + */ +static void +expire_upcalls(void *unused) +{ + struct rtdetq *rte; + struct mfc *mfc, **nptr; + int i; + int s; + + s = splnet(); + for (i = 0; i < MFCTBLSIZ; i++) { + if (nexpire[i] == 0) + continue; + nptr = &mfctable[i]; + for (mfc = *nptr; mfc != NULL; mfc = *nptr) { + /* + * Skip real cache entries + * Make sure it wasn't marked to not expire (shouldn't happen) + * If it expires now + */ + if (mfc->mfc_stall != NULL && + mfc->mfc_expire != 0 && + --mfc->mfc_expire == 0) { + if (mrtdebug & DEBUG_EXPIRE) + log(LOG_DEBUG, "expire_upcalls: expiring (%lx %lx)\n", + (u_long)ntohl(mfc->mfc_origin.s_addr), + (u_long)ntohl(mfc->mfc_mcastgrp.s_addr)); + /* + * drop all the packets + * free the mbuf with the pkt, if, timing info + */ + for (rte = mfc->mfc_stall; rte; ) { + struct rtdetq *n = rte->next; + + m_freem(rte->m); + free(rte, M_MRTABLE); + rte = n; + } + ++mrtstat.mrts_cache_cleanups; + nexpire[i]--; + + *nptr = mfc->mfc_next; + free(mfc, M_MRTABLE); + } else { + nptr = &mfc->mfc_next; + } + } + } + splx(s); + expire_upcalls_ch = timeout(expire_upcalls, (caddr_t)NULL, EXPIRE_TIMEOUT); +} + +/* + * Packet forwarding routine once entry in the cache is made + */ +static int +ip_mdq(m, ifp, rt, xmt_vif) + register struct mbuf *m; + register struct ifnet *ifp; + register struct mfc *rt; + register vifi_t xmt_vif; +{ + register struct ip *ip = mtod(m, struct ip *); + register vifi_t vifi; + register struct vif *vifp; + register int plen = ip->ip_len; + +/* + * Macro to send packet on vif. Since RSVP packets don't get counted on + * input, they shouldn't get counted on output, so statistics keeping is + * seperate. + */ +#define MC_SEND(ip,vifp,m) { \ + if ((vifp)->v_flags & VIFF_TUNNEL) \ + encap_send((ip), (vifp), (m)); \ + else \ + phyint_send((ip), (vifp), (m)); \ +} + + /* + * If xmt_vif is not -1, send on only the requested vif. + * + * (since vifi_t is u_short, -1 becomes MAXUSHORT, which > numvifs.) + */ + if (xmt_vif < numvifs) { + MC_SEND(ip, viftable + xmt_vif, m); + return 1; + } + + /* + * Don't forward if it didn't arrive from the parent vif for its origin. + */ + vifi = rt->mfc_parent; + if ((vifi >= numvifs) || (viftable[vifi].v_ifp != ifp)) { + /* came in the wrong interface */ + if (mrtdebug & DEBUG_FORWARD) + log(LOG_DEBUG, "wrong if: ifp %p vifi %d vififp %p\n", + (void *)ifp, vifi, (void *)viftable[vifi].v_ifp); + ++mrtstat.mrts_wrong_if; + ++rt->mfc_wrong_if; + /* + * If we are doing PIM assert processing, and we are forwarding + * packets on this interface, and it is a broadcast medium + * interface (and not a tunnel), send a message to the routing daemon. + */ + if (pim_assert && rt->mfc_ttls[vifi] && + (ifp->if_flags & IFF_BROADCAST) && + !(viftable[vifi].v_flags & VIFF_TUNNEL)) { + struct sockaddr_in k_igmpsrc; + struct mbuf *mm; + struct igmpmsg *im; + int hlen = ip->ip_hl << 2; + struct timeval now; + register u_long delta; + + GET_TIME(now); + + TV_DELTA(rt->mfc_last_assert, now, delta); + + if (delta > ASSERT_MSG_TIME) { + mm = m_copy(m, 0, hlen); + if (mm && (M_HASCL(mm) || mm->m_len < hlen)) + mm = m_pullup(mm, hlen); + if (mm == NULL) { + return ENOBUFS; + } + + rt->mfc_last_assert = now; + + im = mtod(mm, struct igmpmsg *); + im->im_msgtype = IGMPMSG_WRONGVIF; + im->im_mbz = 0; + im->im_vif = vifi; + + k_igmpsrc.sin_addr = im->im_src; + + socket_send(ip_mrouter, mm, &k_igmpsrc); + } + } + return 0; + } + + /* If I sourced this packet, it counts as output, else it was input. */ + if (ip->ip_src.s_addr == viftable[vifi].v_lcl_addr.s_addr) { + viftable[vifi].v_pkt_out++; + viftable[vifi].v_bytes_out += plen; + } else { + viftable[vifi].v_pkt_in++; + viftable[vifi].v_bytes_in += plen; + } + rt->mfc_pkt_cnt++; + rt->mfc_byte_cnt += plen; + + /* + * For each vif, decide if a copy of the packet should be forwarded. + * Forward if: + * - the ttl exceeds the vif's threshold + * - there are group members downstream on interface + */ + for (vifp = viftable, vifi = 0; vifi < numvifs; vifp++, vifi++) + if ((rt->mfc_ttls[vifi] > 0) && + (ip->ip_ttl > rt->mfc_ttls[vifi])) { + vifp->v_pkt_out++; + vifp->v_bytes_out += plen; + MC_SEND(ip, vifp, m); + } + + return 0; +} + +/* + * check if a vif number is legal/ok. This is used by ip_output, to export + * numvifs there, + */ +static int +X_legal_vif_num(vif) + int vif; +{ + if (vif >= 0 && vif < numvifs) + return(1); + else + return(0); +} + +#ifndef MROUTE_LKM +int (*legal_vif_num)(int) = X_legal_vif_num; +#endif + +/* + * Return the local address used by this vif + */ +static u_long +X_ip_mcast_src(vifi) + int vifi; +{ + if (vifi >= 0 && vifi < numvifs) + return viftable[vifi].v_lcl_addr.s_addr; + else + return INADDR_ANY; +} + +#ifndef MROUTE_LKM +u_long (*ip_mcast_src)(int) = X_ip_mcast_src; +#endif + +static void +phyint_send(ip, vifp, m) + struct ip *ip; + struct vif *vifp; + struct mbuf *m; +{ + register struct mbuf *mb_copy; + register int hlen = ip->ip_hl << 2; + + /* + * Make a new reference to the packet; make sure that + * the IP header is actually copied, not just referenced, + * so that ip_output() only scribbles on the copy. + */ + mb_copy = m_copy(m, 0, M_COPYALL); + if (mb_copy && (M_HASCL(mb_copy) || mb_copy->m_len < hlen)) + mb_copy = m_pullup(mb_copy, hlen); + if (mb_copy == NULL) + return; + + if (vifp->v_rate_limit == 0) + tbf_send_packet(vifp, mb_copy); + else + tbf_control(vifp, mb_copy, mtod(mb_copy, struct ip *), ip->ip_len); +} + +static void +encap_send(ip, vifp, m) + register struct ip *ip; + register struct vif *vifp; + register struct mbuf *m; +{ + register struct mbuf *mb_copy; + register struct ip *ip_copy; + register int i, len = ip->ip_len; + + /* + * copy the old packet & pullup its IP header into the + * new mbuf so we can modify it. Try to fill the new + * mbuf since if we don't the ethernet driver will. + */ + MGETHDR(mb_copy, M_DONTWAIT, MT_HEADER); + if (mb_copy == NULL) + return; + mb_copy->m_data += max_linkhdr; + mb_copy->m_len = sizeof(multicast_encap_iphdr); + + if ((mb_copy->m_next = m_copy(m, 0, M_COPYALL)) == NULL) { + m_freem(mb_copy); + return; + } + i = MHLEN - M_LEADINGSPACE(mb_copy); + if (i > len) + i = len; + mb_copy = m_pullup(mb_copy, i); + if (mb_copy == NULL) + return; + mb_copy->m_pkthdr.len = len + sizeof(multicast_encap_iphdr); + + /* + * fill in the encapsulating IP header. + */ + ip_copy = mtod(mb_copy, struct ip *); + *ip_copy = multicast_encap_iphdr; +#ifdef RANDOM_IP_ID + ip_copy->ip_id = ip_randomid(); +#else + ip_copy->ip_id = htons(ip_id++); +#endif + ip_copy->ip_len += len; + ip_copy->ip_src = vifp->v_lcl_addr; + ip_copy->ip_dst = vifp->v_rmt_addr; + + /* + * turn the encapsulated IP header back into a valid one. + */ + ip = (struct ip *)((caddr_t)ip_copy + sizeof(multicast_encap_iphdr)); + --ip->ip_ttl; + HTONS(ip->ip_len); + HTONS(ip->ip_off); + ip->ip_sum = 0; + mb_copy->m_data += sizeof(multicast_encap_iphdr); + ip->ip_sum = in_cksum(mb_copy, ip->ip_hl << 2); + mb_copy->m_data -= sizeof(multicast_encap_iphdr); + + if (vifp->v_rate_limit == 0) + tbf_send_packet(vifp, mb_copy); + else + tbf_control(vifp, mb_copy, ip, ip_copy->ip_len); +} + +/* + * De-encapsulate a packet and feed it back through ip input (this + * routine is called whenever IP gets a packet with proto type + * ENCAP_PROTO and a local destination address). + */ +void +#ifdef MROUTE_LKM +X_ipip_input(m, off) +#else +ipip_input(m, off) +#endif + register struct mbuf *m; + int off; +{ + struct ifnet *ifp = m->m_pkthdr.rcvif; + register struct ip *ip = mtod(m, struct ip *); + register int hlen = ip->ip_hl << 2; + register int s; + register struct ifqueue *ifq; + register struct vif *vifp; + + if (!have_encap_tunnel) { + rip_input(m, off); + return; + } + /* + * dump the packet if it's not to a multicast destination or if + * we don't have an encapsulating tunnel with the source. + * Note: This code assumes that the remote site IP address + * uniquely identifies the tunnel (i.e., that this site has + * at most one tunnel with the remote site). + */ + if (! IN_MULTICAST(ntohl(((struct ip *)((char *)ip + hlen))->ip_dst.s_addr))) { + ++mrtstat.mrts_bad_tunnel; + m_freem(m); + return; + } + if (ip->ip_src.s_addr != last_encap_src) { + register struct vif *vife; + + vifp = viftable; + vife = vifp + numvifs; + last_encap_src = ip->ip_src.s_addr; + last_encap_vif = 0; + for ( ; vifp < vife; ++vifp) + if (vifp->v_rmt_addr.s_addr == ip->ip_src.s_addr) { + if ((vifp->v_flags & (VIFF_TUNNEL|VIFF_SRCRT)) + == VIFF_TUNNEL) + last_encap_vif = vifp; + break; + } + } + if ((vifp = last_encap_vif) == 0) { + last_encap_src = 0; + mrtstat.mrts_cant_tunnel++; /*XXX*/ + m_freem(m); + if (mrtdebug) + log(LOG_DEBUG, "ip_mforward: no tunnel with %lx\n", + (u_long)ntohl(ip->ip_src.s_addr)); + return; + } + ifp = vifp->v_ifp; + + if (hlen > IP_HDR_LEN) + ip_stripoptions(m, (struct mbuf *) 0); + m->m_data += IP_HDR_LEN; + m->m_len -= IP_HDR_LEN; + m->m_pkthdr.len -= IP_HDR_LEN; + m->m_pkthdr.rcvif = ifp; + + ifq = &ipintrq; + s = splimp(); + if (IF_QFULL(ifq)) { + IF_DROP(ifq); + m_freem(m); + } else { + IF_ENQUEUE(ifq, m); + /* + * normally we would need a "schednetisr(NETISR_IP)" + * here but we were called by ip_input and it is going + * to loop back & try to dequeue the packet we just + * queued as soon as we return so we avoid the + * unnecessary software interrrupt. + */ + } + splx(s); +} + +/* + * Token bucket filter module + */ + +static void +tbf_control(vifp, m, ip, p_len) + register struct vif *vifp; + register struct mbuf *m; + register struct ip *ip; + register u_long p_len; +{ + register struct tbf *t = vifp->v_tbf; + + if (p_len > MAX_BKT_SIZE) { + /* drop if packet is too large */ + mrtstat.mrts_pkt2large++; + m_freem(m); + return; + } + + tbf_update_tokens(vifp); + + /* if there are enough tokens, + * and the queue is empty, + * send this packet out + */ + + if (t->tbf_q_len == 0) { + /* queue empty, send packet if enough tokens */ + if (p_len <= t->tbf_n_tok) { + t->tbf_n_tok -= p_len; + tbf_send_packet(vifp, m); + } else { + /* queue packet and timeout till later */ + tbf_queue(vifp, m); + timeout(tbf_reprocess_q, (caddr_t)vifp, TBF_REPROCESS); + } + } else if (t->tbf_q_len < t->tbf_max_q_len) { + /* finite queue length, so queue pkts and process queue */ + tbf_queue(vifp, m); + tbf_process_q(vifp); + } else { + /* queue length too much, try to dq and queue and process */ + if (!tbf_dq_sel(vifp, ip)) { + mrtstat.mrts_q_overflow++; + m_freem(m); + return; + } else { + tbf_queue(vifp, m); + tbf_process_q(vifp); + } + } + return; +} + +/* + * adds a packet to the queue at the interface + */ +static void +tbf_queue(vifp, m) + register struct vif *vifp; + register struct mbuf *m; +{ + register int s = splnet(); + register struct tbf *t = vifp->v_tbf; + + if (t->tbf_t == NULL) { + /* Queue was empty */ + t->tbf_q = m; + } else { + /* Insert at tail */ + t->tbf_t->m_act = m; + } + + /* Set new tail pointer */ + t->tbf_t = m; + +#ifdef DIAGNOSTIC + /* Make sure we didn't get fed a bogus mbuf */ + if (m->m_act) + panic("tbf_queue: m_act"); +#endif + m->m_act = NULL; + + t->tbf_q_len++; + + splx(s); +} + + +/* + * processes the queue at the interface + */ +static void +tbf_process_q(vifp) + register struct vif *vifp; +{ + register struct mbuf *m; + register int len; + register int s = splnet(); + register struct tbf *t = vifp->v_tbf; + + /* loop through the queue at the interface and send as many packets + * as possible + */ + while (t->tbf_q_len > 0) { + m = t->tbf_q; + + len = mtod(m, struct ip *)->ip_len; + + /* determine if the packet can be sent */ + if (len <= t->tbf_n_tok) { + /* if so, + * reduce no of tokens, dequeue the packet, + * send the packet. + */ + t->tbf_n_tok -= len; + + t->tbf_q = m->m_act; + if (--t->tbf_q_len == 0) + t->tbf_t = NULL; + + m->m_act = NULL; + tbf_send_packet(vifp, m); + + } else break; + } + splx(s); +} + +static void +tbf_reprocess_q(xvifp) + void *xvifp; +{ + register struct vif *vifp = xvifp; + if (ip_mrouter == NULL) + return; + + tbf_update_tokens(vifp); + + tbf_process_q(vifp); + + if (vifp->v_tbf->tbf_q_len) + timeout(tbf_reprocess_q, (caddr_t)vifp, TBF_REPROCESS); +} + +/* function that will selectively discard a member of the queue + * based on the precedence value and the priority + */ +static int +tbf_dq_sel(vifp, ip) + register struct vif *vifp; + register struct ip *ip; +{ + register int s = splnet(); + register u_int p; + register struct mbuf *m, *last; + register struct mbuf **np; + register struct tbf *t = vifp->v_tbf; + + p = priority(vifp, ip); + + np = &t->tbf_q; + last = NULL; + while ((m = *np) != NULL) { + if (p > priority(vifp, mtod(m, struct ip *))) { + *np = m->m_act; + /* If we're removing the last packet, fix the tail pointer */ + if (m == t->tbf_t) + t->tbf_t = last; + m_freem(m); + /* it's impossible for the queue to be empty, but + * we check anyway. */ + if (--t->tbf_q_len == 0) + t->tbf_t = NULL; + splx(s); + mrtstat.mrts_drop_sel++; + return(1); + } + np = &m->m_act; + last = m; + } + splx(s); + return(0); +} + +static void +tbf_send_packet(vifp, m) + register struct vif *vifp; + register struct mbuf *m; +{ + struct ip_moptions imo; + int error; + static struct route ro; + int s = splnet(); + + if (vifp->v_flags & VIFF_TUNNEL) { + /* If tunnel options */ + ip_output(m, (struct mbuf *)0, &vifp->v_route, + IP_FORWARDING, (struct ip_moptions *)0); + } else { + imo.imo_multicast_ifp = vifp->v_ifp; + imo.imo_multicast_ttl = mtod(m, struct ip *)->ip_ttl - 1; + imo.imo_multicast_loop = 1; + imo.imo_multicast_vif = -1; + + /* + * Re-entrancy should not be a problem here, because + * the packets that we send out and are looped back at us + * should get rejected because they appear to come from + * the loopback interface, thus preventing looping. + */ + error = ip_output(m, (struct mbuf *)0, &ro, + IP_FORWARDING, &imo); + + if (mrtdebug & DEBUG_XMIT) + log(LOG_DEBUG, "phyint_send on vif %d err %d\n", + vifp - viftable, error); + } + splx(s); +} + +/* determine the current time and then + * the elapsed time (between the last time and time now) + * in milliseconds & update the no. of tokens in the bucket + */ +static void +tbf_update_tokens(vifp) + register struct vif *vifp; +{ + struct timeval tp; + register u_long tm; + register int s = splnet(); + register struct tbf *t = vifp->v_tbf; + + GET_TIME(tp); + + TV_DELTA(tp, t->tbf_last_pkt_t, tm); + + /* + * This formula is actually + * "time in seconds" * "bytes/second". + * + * (tm / 1000000) * (v_rate_limit * 1000 * (1000/1024) / 8) + * + * The (1000/1024) was introduced in add_vif to optimize + * this divide into a shift. + */ + t->tbf_n_tok += tm * vifp->v_rate_limit / 1024 / 8; + t->tbf_last_pkt_t = tp; + + if (t->tbf_n_tok > MAX_BKT_SIZE) + t->tbf_n_tok = MAX_BKT_SIZE; + + splx(s); +} + +static int +priority(vifp, ip) + register struct vif *vifp; + register struct ip *ip; +{ + register int prio; + + /* temporary hack; may add general packet classifier some day */ + + /* + * The UDP port space is divided up into four priority ranges: + * [0, 16384) : unclassified - lowest priority + * [16384, 32768) : audio - highest priority + * [32768, 49152) : whiteboard - medium priority + * [49152, 65536) : video - low priority + */ + if (ip->ip_p == IPPROTO_UDP) { + struct udphdr *udp = (struct udphdr *)(((char *)ip) + (ip->ip_hl << 2)); + switch (ntohs(udp->uh_dport) & 0xc000) { + case 0x4000: + prio = 70; + break; + case 0x8000: + prio = 60; + break; + case 0xc000: + prio = 55; + break; + default: + prio = 50; + break; + } + if (tbfdebug > 1) + log(LOG_DEBUG, "port %x prio%d\n", ntohs(udp->uh_dport), prio); + } else { + prio = 50; + } + return prio; +} + +/* + * End of token bucket filter modifications + */ + +int +ip_rsvp_vif_init(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + int error, i, s; + + if (rsvpdebug) + printf("ip_rsvp_vif_init: so_type = %d, pr_protocol = %d\n", + so->so_type, so->so_proto->pr_protocol); + + if (so->so_type != SOCK_RAW || so->so_proto->pr_protocol != IPPROTO_RSVP) + return EOPNOTSUPP; + + /* Check mbuf. */ + error = sooptcopyin(sopt, &i, sizeof i, sizeof i); + if (error) + return (error); + + if (rsvpdebug) + printf("ip_rsvp_vif_init: vif = %d rsvp_on = %d\n", i, rsvp_on); + + s = splnet(); + + /* Check vif. */ + if (!legal_vif_num(i)) { + splx(s); + return EADDRNOTAVAIL; + } + + /* Check if socket is available. */ + if (viftable[i].v_rsvpd != NULL) { + splx(s); + return EADDRINUSE; + } + + viftable[i].v_rsvpd = so; + /* This may seem silly, but we need to be sure we don't over-increment + * the RSVP counter, in case something slips up. + */ + if (!viftable[i].v_rsvp_on) { + viftable[i].v_rsvp_on = 1; + rsvp_on++; + } + + splx(s); + return 0; +} + +int +ip_rsvp_vif_done(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + int error, i, s; + + if (rsvpdebug) + printf("ip_rsvp_vif_done: so_type = %d, pr_protocol = %d\n", + so->so_type, so->so_proto->pr_protocol); + + if (so->so_type != SOCK_RAW || + so->so_proto->pr_protocol != IPPROTO_RSVP) + return EOPNOTSUPP; + + error = sooptcopyin(sopt, &i, sizeof i, sizeof i); + if (error) + return (error); + + s = splnet(); + + /* Check vif. */ + if (!legal_vif_num(i)) { + splx(s); + return EADDRNOTAVAIL; + } + + if (rsvpdebug) + printf("ip_rsvp_vif_done: v_rsvpd = %p so = %p\n", + viftable[i].v_rsvpd, so); + + viftable[i].v_rsvpd = NULL; + /* + * This may seem silly, but we need to be sure we don't over-decrement + * the RSVP counter, in case something slips up. + */ + if (viftable[i].v_rsvp_on) { + viftable[i].v_rsvp_on = 0; + rsvp_on--; + } + + splx(s); + return 0; +} + +void +ip_rsvp_force_done(so) + struct socket *so; +{ + int vifi; + register int s; + + /* Don't bother if it is not the right type of socket. */ + if (so->so_type != SOCK_RAW || so->so_proto->pr_protocol != IPPROTO_RSVP) + return; + + s = splnet(); + + /* The socket may be attached to more than one vif...this + * is perfectly legal. + */ + for (vifi = 0; vifi < numvifs; vifi++) { + if (viftable[vifi].v_rsvpd == so) { + viftable[vifi].v_rsvpd = NULL; + /* This may seem silly, but we need to be sure we don't + * over-decrement the RSVP counter, in case something slips up. + */ + if (viftable[vifi].v_rsvp_on) { + viftable[vifi].v_rsvp_on = 0; + rsvp_on--; + } + } + } + + splx(s); + return; +} + +void +rsvp_input(m, off) + struct mbuf *m; + int off; +{ + int vifi; + register struct ip *ip = mtod(m, struct ip *); + int proto = ip->ip_p; + static struct sockaddr_in rsvp_src = { sizeof rsvp_src, AF_INET }; + register int s; + struct ifnet *ifp; +#ifdef ALTQ + /* support IP_RECVIF used by rsvpd rel4.2a1 */ + struct inpcb *inp; + struct socket *so; + struct mbuf *opts; +#endif + + if (rsvpdebug) + printf("rsvp_input: rsvp_on %d\n",rsvp_on); + + /* Can still get packets with rsvp_on = 0 if there is a local member + * of the group to which the RSVP packet is addressed. But in this + * case we want to throw the packet away. + */ + if (!rsvp_on) { + m_freem(m); + return; + } + + s = splnet(); + + if (rsvpdebug) + printf("rsvp_input: check vifs\n"); + +#ifdef DIAGNOSTIC + if (!(m->m_flags & M_PKTHDR)) + panic("rsvp_input no hdr"); +#endif + + ifp = m->m_pkthdr.rcvif; + /* Find which vif the packet arrived on. */ + for (vifi = 0; vifi < numvifs; vifi++) + if (viftable[vifi].v_ifp == ifp) + break; + +#ifdef ALTQ + if (vifi == numvifs || (so = viftable[vifi].v_rsvpd) == NULL) { +#else + if (vifi == numvifs || viftable[vifi].v_rsvpd == NULL) { +#endif + /* + * If the old-style non-vif-associated socket is set, + * then use it. Otherwise, drop packet since there + * is no specific socket for this vif. + */ + if (ip_rsvpd != NULL) { + if (rsvpdebug) + printf("rsvp_input: Sending packet up old-style socket\n"); + rip_input(m, off); /* xxx */ + } else { + if (rsvpdebug && vifi == numvifs) + printf("rsvp_input: Can't find vif for packet.\n"); + else if (rsvpdebug && viftable[vifi].v_rsvpd == NULL) + printf("rsvp_input: No socket defined for vif %d\n",vifi); + m_freem(m); + } + splx(s); + return; + } + rsvp_src.sin_addr = ip->ip_src; + + if (rsvpdebug && m) + printf("rsvp_input: m->m_len = %d, sbspace() = %ld\n", + m->m_len,sbspace(&(viftable[vifi].v_rsvpd->so_rcv))); + +#ifdef ALTQ + opts = NULL; + inp = (struct inpcb *)so->so_pcb; + if (inp->inp_flags & INP_CONTROLOPTS || + inp->inp_socket->so_options & SO_TIMESTAMP) + ip_savecontrol(inp, &opts, ip, m); + if (sbappendaddr(&so->so_rcv, + (struct sockaddr *)&rsvp_src,m, opts) == 0) { + m_freem(m); + if (opts) + m_freem(opts); + if (rsvpdebug) + printf("rsvp_input: Failed to append to socket\n"); + } + else { + sorwakeup(so); + if (rsvpdebug) + printf("rsvp_input: send packet up\n"); + } +#else /* !ALTQ */ + if (socket_send(viftable[vifi].v_rsvpd, m, &rsvp_src) < 0) { + if (rsvpdebug) + printf("rsvp_input: Failed to append to socket\n"); + } else { + if (rsvpdebug) + printf("rsvp_input: send packet up\n"); + } +#endif /* !ALTQ */ + + splx(s); +} + +#ifdef MROUTE_LKM +#include +#include +#include +#include + +MOD_MISC("ip_mroute_mod") + +static int +ip_mroute_mod_handle(struct lkm_table *lkmtp, int cmd) +{ + int i; + struct lkm_misc *args = lkmtp->private.lkm_misc; + int err = 0; + + switch(cmd) { + static int (*old_ip_mrouter_cmd)(); + static int (*old_ip_mrouter_done)(); + static int (*old_ip_mforward)(); + static int (*old_mrt_ioctl)(); + static void (*old_proto4_input)(); + static int (*old_legal_vif_num)(); + extern struct protosw inetsw[]; + + case LKM_E_LOAD: + if(lkmexists(lkmtp) || ip_mrtproto) + return(EEXIST); + old_ip_mrouter_cmd = ip_mrouter_cmd; + ip_mrouter_cmd = X_ip_mrouter_cmd; + old_ip_mrouter_done = ip_mrouter_done; + ip_mrouter_done = X_ip_mrouter_done; + old_ip_mforward = ip_mforward; + ip_mforward = X_ip_mforward; + old_mrt_ioctl = mrt_ioctl; + mrt_ioctl = X_mrt_ioctl; + old_proto4_input = inetsw[ip_protox[ENCAP_PROTO]].pr_input; + inetsw[ip_protox[ENCAP_PROTO]].pr_input = X_ipip_input; + old_legal_vif_num = legal_vif_num; + legal_vif_num = X_legal_vif_num; + ip_mrtproto = IGMP_DVMRP; + + printf("\nIP multicast routing loaded\n"); + break; + + case LKM_E_UNLOAD: + if (ip_mrouter) + return EINVAL; + + ip_mrouter_cmd = old_ip_mrouter_cmd; + ip_mrouter_done = old_ip_mrouter_done; + ip_mforward = old_ip_mforward; + mrt_ioctl = old_mrt_ioctl; + inetsw[ip_protox[ENCAP_PROTO]].pr_input = old_proto4_input; + legal_vif_num = old_legal_vif_num; + ip_mrtproto = 0; + break; + + default: + err = EINVAL; + break; + } + + return(err); +} + +int +ip_mroute_mod(struct lkm_table *lkmtp, int cmd, int ver) { + DISPATCH(lkmtp, cmd, ver, ip_mroute_mod_handle, ip_mroute_mod_handle, + nosys); +} + +#endif /* MROUTE_LKM */ +#endif /* MROUTING */ diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/ip_output.c b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_output.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/ip_output.c @@ -0,0 +1,1961 @@ +//========================================================================== +// +// src/sys/netinet/ip_output.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 + * $FreeBSD: src/sys/netinet/ip_output.c,v 1.99.2.16 2001/07/19 06:37:26 kris Exp $ + */ + +#define _IP_VHL + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef IPSEC +#include +#include +#ifdef IPSEC_DEBUG +#include +#else +#define KEYDEBUG(lev,arg) +#endif +#endif /*IPSEC*/ + +#include + +#ifdef DUMMYNET +#include +#endif + +#ifdef IPFIREWALL_FORWARD_DEBUG +#define print_ip(a) printf("%ld.%ld.%ld.%ld",(ntohl(a.s_addr)>>24)&0xFF,\ + (ntohl(a.s_addr)>>16)&0xFF,\ + (ntohl(a.s_addr)>>8)&0xFF,\ + (ntohl(a.s_addr))&0xFF); +#endif + +u_short ip_id; + +static struct mbuf *ip_insertoptions __P((struct mbuf *, struct mbuf *, int *)); +static struct ifnet *ip_multicast_if __P((struct in_addr *, int *)); +static void ip_mloopback + __P((struct ifnet *, struct mbuf *, struct sockaddr_in *, int)); +static int ip_getmoptions + __P((struct sockopt *, struct ip_moptions *)); +static int ip_pcbopts __P((int, struct mbuf **, struct mbuf *)); +static int ip_setmoptions + __P((struct sockopt *, struct ip_moptions **)); + +int ip_optcopy __P((struct ip *, struct ip *)); +extern int (*fr_checkp) __P((struct ip *, int, struct ifnet *, int, struct mbuf **)); + + +extern struct protosw inetsw[]; + +/* + * IP output. The packet in mbuf chain m contains a skeletal IP + * header (with len, off, ttl, proto, tos, src, dst). + * The mbuf chain containing the packet will be freed. + * The mbuf opt, if present, will not be freed. + */ +int +ip_output(m0, opt, ro, flags, imo) + struct mbuf *m0; + struct mbuf *opt; + struct route *ro; + int flags; + struct ip_moptions *imo; +{ + struct ip *ip, *mhip; + struct ifnet *ifp; + struct mbuf *m = m0; + int hlen = sizeof (struct ip); + int len, off, error = 0; + struct sockaddr_in *dst; + struct in_ifaddr *ia = NULL; + int isbroadcast, sw_csum; +#ifdef IPSEC + struct route iproute; + struct socket *so = NULL; + struct secpolicy *sp = NULL; +#endif + u_int16_t divert_cookie; /* firewall cookie */ +#ifdef IPFIREWALL_FORWARD + int fwd_rewrite_src = 0; +#endif + struct ip_fw_chain *rule = NULL; + +#ifdef IPDIVERT + /* Get and reset firewall cookie */ + divert_cookie = ip_divert_cookie; + ip_divert_cookie = 0; +#else + divert_cookie = 0; +#endif + +#if defined(IPFIREWALL) && defined(DUMMYNET) + /* + * dummynet packet are prepended a vestigial mbuf with + * m_type = MT_DUMMYNET and m_data pointing to the matching + * rule. + */ + if (m->m_type == MT_DUMMYNET) { + /* + * the packet was already tagged, so part of the + * processing was already done, and we need to go down. + * Get parameters from the header. + */ + rule = (struct ip_fw_chain *)(m->m_data) ; + opt = NULL ; + ro = & ( ((struct dn_pkt *)m)->ro ) ; + imo = NULL ; + dst = ((struct dn_pkt *)m)->dn_dst ; + ifp = ((struct dn_pkt *)m)->ifp ; + flags = ((struct dn_pkt *)m)->flags ; + + m0 = m = m->m_next ; +#ifdef IPSEC + so = ipsec_getsocket(m); + (void)ipsec_setsocket(m, NULL); +#endif + ip = mtod(m, struct ip *); + hlen = IP_VHL_HL(ip->ip_vhl) << 2 ; + if (ro->ro_rt != NULL) + ia = (struct in_ifaddr *)ro->ro_rt->rt_ifa; + goto sendit; + } else + rule = NULL ; +#endif +#ifdef IPSEC + so = ipsec_getsocket(m); + (void)ipsec_setsocket(m, NULL); +#endif + +#ifdef DIAGNOSTIC + if ((m->m_flags & M_PKTHDR) == 0) + panic("ip_output no HDR"); + if (!ro) + panic("ip_output no route, proto = %d", + mtod(m, struct ip *)->ip_p); +#endif + if (opt) { + m = ip_insertoptions(m, opt, &len); + hlen = len; + } + ip = mtod(m, struct ip *); + /* + * Fill in IP header. + */ + if ((flags & (IP_FORWARDING|IP_RAWOUTPUT)) == 0) { + ip->ip_vhl = IP_MAKE_VHL(IPVERSION, hlen >> 2); + ip->ip_off &= IP_DF; +#ifdef RANDOM_IP_ID + ip->ip_id = ip_randomid(); +#else + ip->ip_id = htons(ip_id++); +#endif + ipstat.ips_localout++; + } else { + hlen = IP_VHL_HL(ip->ip_vhl) << 2; + } + + dst = (struct sockaddr_in *)&ro->ro_dst; + /* + * If there is a cached route, + * check that it is to the same destination + * and is still up. If not, free it and try again. + */ + if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || + dst->sin_addr.s_addr != ip->ip_dst.s_addr)) { + RTFREE(ro->ro_rt); + ro->ro_rt = (struct rtentry *)0; + } + if (ro->ro_rt == 0) { + dst->sin_family = AF_INET; + dst->sin_len = sizeof(*dst); + dst->sin_addr = ip->ip_dst; + } + /* + * If routing to interface only, + * short circuit routing lookup. + */ +#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) +#define sintosa(sin) ((struct sockaddr *)(sin)) + if (flags & IP_ROUTETOIF) { + if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == 0 && + (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == 0) { + ipstat.ips_noroute++; + error = ENETUNREACH; + goto bad; + } + ifp = ia->ia_ifp; + ip->ip_ttl = 1; + isbroadcast = in_broadcast(dst->sin_addr, ifp); + } else { + /* + * If this is the case, we probably don't want to allocate + * a protocol-cloned route since we didn't get one from the + * ULP. This lets TCP do its thing, while not burdening + * forwarding or ICMP with the overhead of cloning a route. + * Of course, we still want to do any cloning requested by + * the link layer, as this is probably required in all cases + * for correct operation (as it is for ARP). + */ + if (ro->ro_rt == 0) + rtalloc_ign(ro, RTF_PRCLONING); + if (ro->ro_rt == 0) { + ipstat.ips_noroute++; + error = EHOSTUNREACH; + goto bad; + } + ia = ifatoia(ro->ro_rt->rt_ifa); + ifp = ro->ro_rt->rt_ifp; + ro->ro_rt->rt_use++; + if (ro->ro_rt->rt_flags & RTF_GATEWAY) + dst = (struct sockaddr_in *)ro->ro_rt->rt_gateway; + if (ro->ro_rt->rt_flags & RTF_HOST) + isbroadcast = (ro->ro_rt->rt_flags & RTF_BROADCAST); + else + isbroadcast = in_broadcast(dst->sin_addr, ifp); + } + if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { + struct in_multi *inm; + + m->m_flags |= M_MCAST; + /* + * IP destination address is multicast. Make sure "dst" + * still points to the address in "ro". (It may have been + * changed to point to a gateway address, above.) + */ + dst = (struct sockaddr_in *)&ro->ro_dst; + /* + * See if the caller provided any multicast options + */ + if (imo != NULL) { + ip->ip_ttl = imo->imo_multicast_ttl; + if (imo->imo_multicast_ifp != NULL) + ifp = imo->imo_multicast_ifp; + if (imo->imo_multicast_vif != -1) + ip->ip_src.s_addr = + ip_mcast_src(imo->imo_multicast_vif); + } else + ip->ip_ttl = IP_DEFAULT_MULTICAST_TTL; + /* + * Confirm that the outgoing interface supports multicast. + */ + if ((imo == NULL) || (imo->imo_multicast_vif == -1)) { + if ((ifp->if_flags & IFF_MULTICAST) == 0) { + ipstat.ips_noroute++; + error = ENETUNREACH; + goto bad; + } + } + /* + * If source address not specified yet, use address + * of outgoing interface. + */ + if (ip->ip_src.s_addr == INADDR_ANY) { + register struct in_ifaddr *ia1; + + TAILQ_FOREACH(ia1, &in_ifaddrhead, ia_link) + if (ia1->ia_ifp == ifp) { + ip->ip_src = IA_SIN(ia1)->sin_addr; + break; + } + } + + IN_LOOKUP_MULTI(ip->ip_dst, ifp, inm); + if (inm != NULL && + (imo == NULL || imo->imo_multicast_loop)) { + /* + * If we belong to the destination multicast group + * on the outgoing interface, and the caller did not + * forbid loopback, loop back a copy. + */ + ip_mloopback(ifp, m, dst, hlen); + } + else { + /* + * If we are acting as a multicast router, perform + * multicast forwarding as if the packet had just + * arrived on the interface to which we are about + * to send. The multicast forwarding function + * recursively calls this function, using the + * IP_FORWARDING flag to prevent infinite recursion. + * + * Multicasts that are looped back by ip_mloopback(), + * above, will be forwarded by the ip_input() routine, + * if necessary. + */ + if (ip_mrouter && (flags & IP_FORWARDING) == 0) { + /* + * Check if rsvp daemon is running. If not, don't + * set ip_moptions. This ensures that the packet + * is multicast and not just sent down one link + * as prescribed by rsvpd. + */ + if (!rsvp_on) + imo = NULL; + if (ip_mforward(ip, ifp, m, imo) != 0) { + m_freem(m); + goto done; + } + } + } + + /* + * Multicasts with a time-to-live of zero may be looped- + * back, above, but must not be transmitted on a network. + * Also, multicasts addressed to the loopback interface + * are not sent -- the above call to ip_mloopback() will + * loop back a copy if this host actually belongs to the + * destination group on the loopback interface. + */ + if (ip->ip_ttl == 0 || ifp->if_flags & IFF_LOOPBACK) { + m_freem(m); + goto done; + } + + goto sendit; + } +#ifndef notdef + /* + * If source address not specified yet, use address + * of outgoing interface. + */ + if (ip->ip_src.s_addr == INADDR_ANY) { + ip->ip_src = IA_SIN(ia)->sin_addr; +#ifdef IPFIREWALL_FORWARD + /* Keep note that we did this - if the firewall changes + * the next-hop, our interface may change, changing the + * default source IP. It's a shame so much effort happens + * twice. Oh well. + */ + fwd_rewrite_src++; +#endif /* IPFIREWALL_FORWARD */ + } +#endif /* notdef */ +#ifdef ALTQ + /* + * disable packet drop hack. + * packetdrop should be done by queueing. + */ +#else /* !ALTQ */ + /* + * Verify that we have any chance at all of being able to queue + * the packet or packet fragments + */ + if ((ifp->if_snd.ifq_len + ip->ip_len / ifp->if_mtu + 1) >= + ifp->if_snd.ifq_maxlen) { + error = ENOBUFS; + goto bad; + } +#endif /* !ALTQ */ + + /* + * Look for broadcast address and + * and verify user is allowed to send + * such a packet. + */ + if (isbroadcast) { + if ((ifp->if_flags & IFF_BROADCAST) == 0) { + error = EADDRNOTAVAIL; + goto bad; + } + if ((flags & IP_ALLOWBROADCAST) == 0) { + error = EACCES; + goto bad; + } + /* don't allow broadcast messages to be fragmented */ + if ((u_short)ip->ip_len > ifp->if_mtu) { + error = EMSGSIZE; + goto bad; + } + m->m_flags |= M_BCAST; + } else { + m->m_flags &= ~M_BCAST; + } + +sendit: +#ifdef IPSEC + /* get SP for this packet */ + if (so == NULL) + sp = ipsec4_getpolicybyaddr(m, IPSEC_DIR_OUTBOUND, flags, &error); + else + sp = ipsec4_getpolicybysock(m, IPSEC_DIR_OUTBOUND, so, &error); + + if (sp == NULL) { + ipsecstat.out_inval++; + goto bad; + } + + error = 0; + + /* check policy */ + switch (sp->policy) { + case IPSEC_POLICY_DISCARD: + /* + * This packet is just discarded. + */ + ipsecstat.out_polvio++; + goto bad; + + case IPSEC_POLICY_BYPASS: + case IPSEC_POLICY_NONE: + /* no need to do IPsec. */ + goto skip_ipsec; + + case IPSEC_POLICY_IPSEC: + if (sp->req == NULL) { + /* acquire a policy */ + error = key_spdacquire(sp); + goto bad; + } + break; + + case IPSEC_POLICY_ENTRUST: + default: + printf("ip_output: Invalid policy found. %d\n", sp->policy); + } + { + struct ipsec_output_state state; + bzero(&state, sizeof(state)); + state.m = m; + if (flags & IP_ROUTETOIF) { + state.ro = &iproute; + bzero(&iproute, sizeof(iproute)); + } else + state.ro = ro; + state.dst = (struct sockaddr *)dst; + + ip->ip_sum = 0; + + /* + * XXX + * delayed checksums are not currently compatible with IPsec + */ + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + in_delayed_cksum(m); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; + } + + HTONS(ip->ip_len); + HTONS(ip->ip_off); + + error = ipsec4_output(&state, sp, flags); + + m = state.m; + if (flags & IP_ROUTETOIF) { + /* + * if we have tunnel mode SA, we may need to ignore + * IP_ROUTETOIF. + */ + if (state.ro != &iproute || state.ro->ro_rt != NULL) { + flags &= ~IP_ROUTETOIF; + ro = state.ro; + } + } else + ro = state.ro; + dst = (struct sockaddr_in *)state.dst; + if (error) { + /* mbuf is already reclaimed in ipsec4_output. */ + m0 = NULL; + switch (error) { + case EHOSTUNREACH: + case ENETUNREACH: + case EMSGSIZE: + case ENOBUFS: + case ENOMEM: + break; + default: + printf("ip4_output (ipsec): error code %d\n", error); + /*fall through*/ + case ENOENT: + /* don't show these error codes to the user */ + error = 0; + break; + } + goto bad; + } + + /* be sure to update variables that are affected by ipsec4_output() */ + ip = mtod(m, struct ip *); +#ifdef _IP_VHL + hlen = IP_VHL_HL(ip->ip_vhl) << 2; +#else + hlen = ip->ip_hl << 2; +#endif + if (ro->ro_rt == NULL) { + if ((flags & IP_ROUTETOIF) == 0) { + printf("ip_output: " + "can't update route after IPsec processing\n"); + error = EHOSTUNREACH; /*XXX*/ + goto bad; + } + } else { + if (state.encap) { + ia = ifatoia(ro->ro_rt->rt_ifa); + ifp = ro->ro_rt->rt_ifp; + } + } + } + + /* make it flipped, again. */ + NTOHS(ip->ip_len); + NTOHS(ip->ip_off); +skip_ipsec: +#endif /*IPSEC*/ + + /* + * IpHack's section. + * - Xlate: translate packet's addr/port (NAT). + * - Firewall: deny/allow/etc. + * - Wrap: fake packet's addr/port + * - Encapsulate: put it in another IP and send out. + */ + if (fr_checkp) { + struct mbuf *m1 = m; + + if ((error = (*fr_checkp)(ip, hlen, ifp, 1, &m1)) || !m1) + goto done; + ip = mtod(m = m1, struct ip *); + } + + /* + * Check with the firewall... + */ + if (fw_enable && ip_fw_chk_ptr) { + struct sockaddr_in *old = dst; + + off = (*ip_fw_chk_ptr)(&ip, + hlen, ifp, &divert_cookie, &m, &rule, &dst); + /* + * On return we must do the following: + * IP_FW_PORT_DENY_FLAG -> drop the pkt (XXX new) + * 1<=off<= 0xffff -> DIVERT + * (off & IP_FW_PORT_DYNT_FLAG) -> send to a DUMMYNET pipe + * (off & IP_FW_PORT_TEE_FLAG) -> TEE the packet + * dst != old -> IPFIREWALL_FORWARD + * off==0, dst==old -> accept + * If some of the above modules is not compiled in, then + * we should't have to check the corresponding condition + * (because the ipfw control socket should not accept + * unsupported rules), but better play safe and drop + * packets in case of doubt. + */ + if ( (off & IP_FW_PORT_DENY_FLAG) || m == NULL) { + if (m) + m_freem(m); + error = EACCES ; + goto done ; + } + ip = mtod(m, struct ip *); + if (off == 0 && dst == old) /* common case */ + goto pass ; +#ifdef DUMMYNET + if ((off & IP_FW_PORT_DYNT_FLAG) != 0) { + /* + * pass the pkt to dummynet. Need to include + * pipe number, m, ifp, ro, dst because these are + * not recomputed in the next pass. + * All other parameters have been already used and + * so they are not needed anymore. + * XXX note: if the ifp or ro entry are deleted + * while a pkt is in dummynet, we are in trouble! + */ + error = dummynet_io(off & 0xffff, DN_TO_IP_OUT, m, + ifp,ro,dst,rule, flags); + goto done; + } +#endif +#ifdef IPDIVERT + if (off != 0 && (off & IP_FW_PORT_DYNT_FLAG) == 0) { + struct mbuf *clone = NULL; + + /* Clone packet if we're doing a 'tee' */ + if ((off & IP_FW_PORT_TEE_FLAG) != 0) + clone = m_dup(m, M_DONTWAIT); + + /* + * XXX + * delayed checksums are not currently compatible + * with divert sockets. + */ + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + in_delayed_cksum(m); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; + } + + /* Restore packet header fields to original values */ + HTONS(ip->ip_len); + HTONS(ip->ip_off); + + /* Deliver packet to divert input routine */ + ip_divert_cookie = divert_cookie; + divert_packet(m, 0, off & 0xffff); + + /* If 'tee', continue with original packet */ + if (clone != NULL) { + m = clone; + ip = mtod(m, struct ip *); + goto pass; + } + goto done; + } +#endif + +#ifdef IPFIREWALL_FORWARD + /* Here we check dst to make sure it's directly reachable on the + * interface we previously thought it was. + * If it isn't (which may be likely in some situations) we have + * to re-route it (ie, find a route for the next-hop and the + * associated interface) and set them here. This is nested + * forwarding which in most cases is undesirable, except where + * such control is nigh impossible. So we do it here. + * And I'm babbling. + */ + if (off == 0 && old != dst) { + struct in_ifaddr *ia; + + /* It's changed... */ + /* There must be a better way to do this next line... */ + static struct route sro_fwd, *ro_fwd = &sro_fwd; +#ifdef IPFIREWALL_FORWARD_DEBUG + printf("IPFIREWALL_FORWARD: New dst ip: "); + print_ip(dst->sin_addr); + printf("\n"); +#endif + /* + * We need to figure out if we have been forwarded + * to a local socket. If so then we should somehow + * "loop back" to ip_input, and get directed to the + * PCB as if we had received this packet. This is + * because it may be dificult to identify the packets + * you want to forward until they are being output + * and have selected an interface. (e.g. locally + * initiated packets) If we used the loopback inteface, + * we would not be able to control what happens + * as the packet runs through ip_input() as + * it is done through a ISR. + */ + TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) { + /* + * If the addr to forward to is one + * of ours, we pretend to + * be the destination for this packet. + */ + if (IA_SIN(ia)->sin_addr.s_addr == + dst->sin_addr.s_addr) + break; + } + if (ia) { + /* tell ip_input "dont filter" */ + ip_fw_fwd_addr = dst; + if (m->m_pkthdr.rcvif == NULL) + m->m_pkthdr.rcvif = ifunit("lo0"); + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m0->m_pkthdr.csum_data = 0xffff; + } + m->m_pkthdr.csum_flags |= + CSUM_IP_CHECKED | CSUM_IP_VALID; + HTONS(ip->ip_len); + HTONS(ip->ip_off); + ip_input(m); + goto done; + } + /* Some of the logic for this was + * nicked from above. + * + * This rewrites the cached route in a local PCB. + * Is this what we want to do? + */ + bcopy(dst, &ro_fwd->ro_dst, sizeof(*dst)); + + ro_fwd->ro_rt = 0; + rtalloc_ign(ro_fwd, RTF_PRCLONING); + + if (ro_fwd->ro_rt == 0) { + ipstat.ips_noroute++; + error = EHOSTUNREACH; + goto bad; + } + + ia = ifatoia(ro_fwd->ro_rt->rt_ifa); + ifp = ro_fwd->ro_rt->rt_ifp; + ro_fwd->ro_rt->rt_use++; + if (ro_fwd->ro_rt->rt_flags & RTF_GATEWAY) + dst = (struct sockaddr_in *)ro_fwd->ro_rt->rt_gateway; + if (ro_fwd->ro_rt->rt_flags & RTF_HOST) + isbroadcast = + (ro_fwd->ro_rt->rt_flags & RTF_BROADCAST); + else + isbroadcast = in_broadcast(dst->sin_addr, ifp); + RTFREE(ro->ro_rt); + ro->ro_rt = ro_fwd->ro_rt; + dst = (struct sockaddr_in *)&ro_fwd->ro_dst; + + /* + * If we added a default src ip earlier, + * which would have been gotten from the-then + * interface, do it again, from the new one. + */ + if (fwd_rewrite_src) + ip->ip_src = IA_SIN(ia)->sin_addr; + goto pass ; + } +#endif /* IPFIREWALL_FORWARD */ + /* + * if we get here, none of the above matches, and + * we have to drop the pkt + */ + m_freem(m); + error = EACCES; /* not sure this is the right error msg */ + goto done; + } + +pass: + m->m_pkthdr.csum_flags |= CSUM_IP; + sw_csum = m->m_pkthdr.csum_flags & ~ifp->if_hwassist; + if (sw_csum & CSUM_DELAY_DATA) { + in_delayed_cksum(m); + sw_csum &= ~CSUM_DELAY_DATA; + } + m->m_pkthdr.csum_flags &= ifp->if_hwassist; + + /* + * If small enough for interface, or the interface will take + * care of the fragmentation for us, can just send directly. + */ + if ((u_short)ip->ip_len <= ifp->if_mtu || + ifp->if_hwassist & CSUM_FRAGMENT) { + HTONS(ip->ip_len); + HTONS(ip->ip_off); + ip->ip_sum = 0; + if (sw_csum & CSUM_DELAY_IP) { + if (ip->ip_vhl == IP_VHL_BORING) { + ip->ip_sum = in_cksum_hdr(ip); + } else { + ip->ip_sum = in_cksum(m, hlen); + } + } + + /* Record statistics for this interface address. */ + if (!(flags & IP_FORWARDING) && ia != NULL) { + ia->ia_ifa.if_opackets++; + ia->ia_ifa.if_obytes += m->m_pkthdr.len; + } + +#ifdef IPSEC + /* clean ipsec history once it goes out of the node */ + ipsec_delaux(m); +#endif + + error = (*ifp->if_output)(ifp, m, + (struct sockaddr *)dst, ro->ro_rt); + goto done; + } + /* + * Too large for interface; fragment if possible. + * Must be able to put at least 8 bytes per fragment. + */ + if (ip->ip_off & IP_DF) { + error = EMSGSIZE; + /* + * This case can happen if the user changed the MTU + * of an interface after enabling IP on it. Because + * most netifs don't keep track of routes pointing to + * them, there is no way for one to update all its + * routes when the MTU is changed. + */ + if ((ro->ro_rt->rt_flags & (RTF_UP | RTF_HOST)) + && !(ro->ro_rt->rt_rmx.rmx_locks & RTV_MTU) + && (ro->ro_rt->rt_rmx.rmx_mtu > ifp->if_mtu)) { + ro->ro_rt->rt_rmx.rmx_mtu = ifp->if_mtu; + } + ipstat.ips_cantfrag++; + goto bad; + } + len = (ifp->if_mtu - hlen) &~ 7; + if (len < 8) { + error = EMSGSIZE; + goto bad; + } + + /* + * if the interface will not calculate checksums on + * fragmented packets, then do it here. + */ + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA && + (ifp->if_hwassist & CSUM_IP_FRAGS) == 0) { + in_delayed_cksum(m); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; + } + + { + int mhlen, firstlen = len; + struct mbuf **mnext = &m->m_nextpkt; + int nfrags = 1; + + /* + * Loop through length of segment after first fragment, + * make new header and copy data of each part and link onto chain. + */ + m0 = m; + mhlen = sizeof (struct ip); + for (off = hlen + len; off < (u_short)ip->ip_len; off += len) { + MGETHDR(m, M_DONTWAIT, MT_HEADER); + if (m == 0) { + error = ENOBUFS; + ipstat.ips_odropped++; + goto sendorfree; + } + m->m_flags |= (m0->m_flags & M_MCAST) | M_FRAG; + m->m_data += max_linkhdr; + mhip = mtod(m, struct ip *); + *mhip = *ip; + if (hlen > sizeof (struct ip)) { + mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip); + mhip->ip_vhl = IP_MAKE_VHL(IPVERSION, mhlen >> 2); + } + m->m_len = mhlen; + mhip->ip_off = ((off - hlen) >> 3) + (ip->ip_off & ~IP_MF); + if (ip->ip_off & IP_MF) + mhip->ip_off |= IP_MF; + if (off + len >= (u_short)ip->ip_len) + len = (u_short)ip->ip_len - off; + else + mhip->ip_off |= IP_MF; + mhip->ip_len = htons((u_short)(len + mhlen)); + m->m_next = m_copy(m0, off, len); + if (m->m_next == 0) { + (void) m_free(m); + error = ENOBUFS; /* ??? */ + ipstat.ips_odropped++; + goto sendorfree; + } + m->m_pkthdr.len = mhlen + len; + m->m_pkthdr.rcvif = (struct ifnet *)0; + m->m_pkthdr.csum_flags = m0->m_pkthdr.csum_flags; + HTONS(mhip->ip_off); + mhip->ip_sum = 0; + if (sw_csum & CSUM_DELAY_IP) { + if (mhip->ip_vhl == IP_VHL_BORING) { + mhip->ip_sum = in_cksum_hdr(mhip); + } else { + mhip->ip_sum = in_cksum(m, mhlen); + } + } + *mnext = m; + mnext = &m->m_nextpkt; + nfrags++; + } + ipstat.ips_ofragments += nfrags; + + /* set first/last markers for fragment chain */ + m->m_flags |= M_LASTFRAG; + m0->m_flags |= M_FIRSTFRAG | M_FRAG; + m0->m_pkthdr.csum_data = nfrags; + + /* + * Update first fragment by trimming what's been copied out + * and updating header, then send each fragment (in order). + */ + m = m0; + m_adj(m, hlen + firstlen - (u_short)ip->ip_len); + m->m_pkthdr.len = hlen + firstlen; + ip->ip_len = htons((u_short)m->m_pkthdr.len); + ip->ip_off |= IP_MF; + HTONS(ip->ip_off); + ip->ip_sum = 0; + if (sw_csum & CSUM_DELAY_IP) { + if (ip->ip_vhl == IP_VHL_BORING) { + ip->ip_sum = in_cksum_hdr(ip); + } else { + ip->ip_sum = in_cksum(m, hlen); + } + } +sendorfree: + for (m = m0; m; m = m0) { + m0 = m->m_nextpkt; + m->m_nextpkt = 0; +#ifdef IPSEC + /* clean ipsec history once it goes out of the node */ + ipsec_delaux(m); +#endif + if (error == 0) { + /* Record statistics for this interface address. */ + if (ia != NULL) { + ia->ia_ifa.if_opackets++; + ia->ia_ifa.if_obytes += m->m_pkthdr.len; + } + + error = (*ifp->if_output)(ifp, m, + (struct sockaddr *)dst, ro->ro_rt); + } else + m_freem(m); + } + + if (error == 0) + ipstat.ips_fragmented++; + } +done: +#ifdef IPSEC + if (ro == &iproute && ro->ro_rt) { + RTFREE(ro->ro_rt); + ro->ro_rt = NULL; + } + if (sp != NULL) { + KEYDEBUG(KEYDEBUG_IPSEC_STAMP, + printf("DP ip_output call free SP:%p\n", sp)); + key_freesp(sp); + } +#endif /* IPSEC */ + return (error); +bad: + m_freem(m0); + goto done; +} + +void +in_delayed_cksum(struct mbuf *m) +{ + struct ip *ip; + u_short csum, offset; + + ip = mtod(m, struct ip *); + offset = IP_VHL_HL(ip->ip_vhl) << 2 ; + csum = in_cksum_skip(m, ip->ip_len, offset); + if (m->m_pkthdr.csum_flags & CSUM_UDP && csum == 0) + csum = 0xffff; + offset += m->m_pkthdr.csum_data; /* checksum offset */ + + if (offset + sizeof(u_short) > m->m_len) { + printf("delayed m_pullup, m->len: %d off: %d p: %d\n", + m->m_len, offset, ip->ip_p); + /* + * XXX + * this shouldn't happen, but if it does, the + * correct behavior may be to insert the checksum + * in the existing chain instead of rearranging it. + */ + m = m_pullup(m, offset + sizeof(u_short)); + } + *(u_short *)(m->m_data + offset) = csum; +} + +/* + * Insert IP options into preformed packet. + * Adjust IP destination as required for IP source routing, + * as indicated by a non-zero in_addr at the start of the options. + * + * XXX This routine assumes that the packet has no options in place. + */ +static struct mbuf * +ip_insertoptions(m, opt, phlen) + register struct mbuf *m; + struct mbuf *opt; + int *phlen; +{ + register struct ipoption *p = mtod(opt, struct ipoption *); + struct mbuf *n; + register struct ip *ip = mtod(m, struct ip *); + unsigned optlen; + + optlen = opt->m_len - sizeof(p->ipopt_dst); + if (optlen + (u_short)ip->ip_len > IP_MAXPACKET) + return (m); /* XXX should fail */ + if (p->ipopt_dst.s_addr) + ip->ip_dst = p->ipopt_dst; + if (m->m_flags & M_EXT || m->m_data - optlen < m->m_pktdat) { + MGETHDR(n, M_DONTWAIT, MT_HEADER); + if (n == 0) + return (m); + n->m_pkthdr.rcvif = (struct ifnet *)0; + n->m_pkthdr.len = m->m_pkthdr.len + optlen; + m->m_len -= sizeof(struct ip); + m->m_data += sizeof(struct ip); + n->m_next = m; + m = n; + m->m_len = optlen + sizeof(struct ip); + m->m_data += max_linkhdr; + (void)memcpy(mtod(m, void *), ip, sizeof(struct ip)); + } else { + m->m_data -= optlen; + m->m_len += optlen; + m->m_pkthdr.len += optlen; + ovbcopy((caddr_t)ip, mtod(m, caddr_t), sizeof(struct ip)); + } + ip = mtod(m, struct ip *); + bcopy(p->ipopt_list, ip + 1, optlen); + *phlen = sizeof(struct ip) + optlen; + ip->ip_vhl = IP_MAKE_VHL(IPVERSION, *phlen >> 2); + ip->ip_len += optlen; + return (m); +} + +/* + * Copy options from ip to jp, + * omitting those not copied during fragmentation. + */ +int +ip_optcopy(ip, jp) + struct ip *ip, *jp; +{ + register u_char *cp, *dp; + int opt, optlen, cnt; + + cp = (u_char *)(ip + 1); + dp = (u_char *)(jp + 1); + cnt = (IP_VHL_HL(ip->ip_vhl) << 2) - sizeof (struct ip); + for (; cnt > 0; cnt -= optlen, cp += optlen) { + opt = cp[0]; + if (opt == IPOPT_EOL) + break; + if (opt == IPOPT_NOP) { + /* Preserve for IP mcast tunnel's LSRR alignment. */ + *dp++ = IPOPT_NOP; + optlen = 1; + continue; + } +#ifdef DIAGNOSTIC + if (cnt < IPOPT_OLEN + sizeof(*cp)) + panic("malformed IPv4 option passed to ip_optcopy"); +#endif + optlen = cp[IPOPT_OLEN]; +#ifdef DIAGNOSTIC + if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) + panic("malformed IPv4 option passed to ip_optcopy"); +#endif + /* bogus lengths should have been caught by ip_dooptions */ + if (optlen > cnt) + optlen = cnt; + if (IPOPT_COPIED(opt)) { + bcopy(cp, dp, optlen); + dp += optlen; + } + } + for (optlen = dp - (u_char *)(jp+1); optlen & 0x3; optlen++) + *dp++ = IPOPT_EOL; + return (optlen); +} + +/* + * IP socket option processing. + */ +int +ip_ctloutput(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + struct inpcb *inp = sotoinpcb(so); + int error, optval; + + error = optval = 0; + if (sopt->sopt_level != IPPROTO_IP) { + return (EINVAL); + } + + switch (sopt->sopt_dir) { + case SOPT_SET: + switch (sopt->sopt_name) { + case IP_OPTIONS: +#ifdef notyet + case IP_RETOPTS: +#endif + { + struct mbuf *m; + if (sopt->sopt_valsize > MLEN) { + error = EMSGSIZE; + break; + } + MGET(m, sopt->sopt_p ? M_WAIT : M_DONTWAIT, MT_HEADER); + if (m == 0) { + error = ENOBUFS; + break; + } + m->m_len = sopt->sopt_valsize; + error = sooptcopyin(sopt, mtod(m, char *), m->m_len, + m->m_len); + + return (ip_pcbopts(sopt->sopt_name, &inp->inp_options, + m)); + } + + case IP_TOS: + case IP_TTL: + case IP_RECVOPTS: + case IP_RECVRETOPTS: + case IP_RECVDSTADDR: + case IP_RECVIF: +#if defined(NFAITH) && NFAITH > 0 + case IP_FAITH: +#endif + error = sooptcopyin(sopt, &optval, sizeof optval, + sizeof optval); + if (error) + break; + + switch (sopt->sopt_name) { + case IP_TOS: + inp->inp_ip_tos = optval; + break; + + case IP_TTL: + inp->inp_ip_ttl = optval; + break; +#define OPTSET(bit) \ + if (optval) \ + inp->inp_flags |= bit; \ + else \ + inp->inp_flags &= ~bit; + + case IP_RECVOPTS: + OPTSET(INP_RECVOPTS); + break; + + case IP_RECVRETOPTS: + OPTSET(INP_RECVRETOPTS); + break; + + case IP_RECVDSTADDR: + OPTSET(INP_RECVDSTADDR); + break; + + case IP_RECVIF: + OPTSET(INP_RECVIF); + break; + +#if defined(NFAITH) && NFAITH > 0 + case IP_FAITH: + OPTSET(INP_FAITH); + break; +#endif + } + break; +#undef OPTSET + + case IP_MULTICAST_IF: + case IP_MULTICAST_VIF: + case IP_MULTICAST_TTL: + case IP_MULTICAST_LOOP: + case IP_ADD_MEMBERSHIP: + case IP_DROP_MEMBERSHIP: + error = ip_setmoptions(sopt, &inp->inp_moptions); + break; + + case IP_PORTRANGE: + error = sooptcopyin(sopt, &optval, sizeof optval, + sizeof optval); + if (error) + break; + + switch (optval) { + case IP_PORTRANGE_DEFAULT: + inp->inp_flags &= ~(INP_LOWPORT); + inp->inp_flags &= ~(INP_HIGHPORT); + break; + + case IP_PORTRANGE_HIGH: + inp->inp_flags &= ~(INP_LOWPORT); + inp->inp_flags |= INP_HIGHPORT; + break; + + case IP_PORTRANGE_LOW: + inp->inp_flags &= ~(INP_HIGHPORT); + inp->inp_flags |= INP_LOWPORT; + break; + + default: + error = EINVAL; + break; + } + break; + +#ifdef IPSEC + case IP_IPSEC_POLICY: + { + caddr_t req; + size_t len = 0; + int priv; + struct mbuf *m; + int optname; + + if ((error = soopt_getm(sopt, &m)) != 0) /* XXX */ + break; + if ((error = soopt_mcopyin(sopt, m)) != 0) /* XXX */ + break; + priv = (sopt->sopt_p != NULL && + suser(sopt->sopt_p) != 0) ? 0 : 1; + req = mtod(m, caddr_t); + len = m->m_len; + optname = sopt->sopt_name; + error = ipsec4_set_policy(inp, optname, req, len, priv); + m_freem(m); + break; + } +#endif /*IPSEC*/ + + default: + error = ENOPROTOOPT; + break; + } + break; + + case SOPT_GET: + switch (sopt->sopt_name) { + case IP_OPTIONS: + case IP_RETOPTS: + if (inp->inp_options) + error = sooptcopyout(sopt, + mtod(inp->inp_options, + char *), + inp->inp_options->m_len); + else + sopt->sopt_valsize = 0; + break; + + case IP_TOS: + case IP_TTL: + case IP_RECVOPTS: + case IP_RECVRETOPTS: + case IP_RECVDSTADDR: + case IP_RECVIF: + case IP_PORTRANGE: +#if defined(NFAITH) && NFAITH > 0 + case IP_FAITH: +#endif + switch (sopt->sopt_name) { + + case IP_TOS: + optval = inp->inp_ip_tos; + break; + + case IP_TTL: + optval = inp->inp_ip_ttl; + break; + +#define OPTBIT(bit) (inp->inp_flags & bit ? 1 : 0) + + case IP_RECVOPTS: + optval = OPTBIT(INP_RECVOPTS); + break; + + case IP_RECVRETOPTS: + optval = OPTBIT(INP_RECVRETOPTS); + break; + + case IP_RECVDSTADDR: + optval = OPTBIT(INP_RECVDSTADDR); + break; + + case IP_RECVIF: + optval = OPTBIT(INP_RECVIF); + break; + + case IP_PORTRANGE: + if (inp->inp_flags & INP_HIGHPORT) + optval = IP_PORTRANGE_HIGH; + else if (inp->inp_flags & INP_LOWPORT) + optval = IP_PORTRANGE_LOW; + else + optval = 0; + break; + +#if defined(NFAITH) && NFAITH > 0 + case IP_FAITH: + optval = OPTBIT(INP_FAITH); + break; +#endif + } + error = sooptcopyout(sopt, &optval, sizeof optval); + break; + + case IP_MULTICAST_IF: + case IP_MULTICAST_VIF: + case IP_MULTICAST_TTL: + case IP_MULTICAST_LOOP: + case IP_ADD_MEMBERSHIP: + case IP_DROP_MEMBERSHIP: + error = ip_getmoptions(sopt, inp->inp_moptions); + break; + +#ifdef IPSEC + case IP_IPSEC_POLICY: + { + struct mbuf *m = NULL; + caddr_t req = NULL; + size_t len = 0; + + if (m != 0) { + req = mtod(m, caddr_t); + len = m->m_len; + } + error = ipsec4_get_policy(sotoinpcb(so), req, len, &m); + if (error == 0) + error = soopt_mcopyout(sopt, m); /* XXX */ + if (error == 0) + m_freem(m); + break; + } +#endif /*IPSEC*/ + + default: + error = ENOPROTOOPT; + break; + } + break; + } + return (error); +} + +/* + * Set up IP options in pcb for insertion in output packets. + * Store in mbuf with pointer in pcbopt, adding pseudo-option + * with destination address if source routed. + */ +static int +ip_pcbopts(optname, pcbopt, m) + int optname; + struct mbuf **pcbopt; + register struct mbuf *m; +{ + register int cnt, optlen; + register u_char *cp; + u_char opt; + + /* turn off any old options */ + if (*pcbopt) + (void)m_free(*pcbopt); + *pcbopt = 0; + if (m == (struct mbuf *)0 || m->m_len == 0) { + /* + * Only turning off any previous options. + */ + if (m) + (void)m_free(m); + return (0); + } + +#ifndef vax + if (m->m_len % sizeof(int32_t)) + goto bad; +#endif + /* + * IP first-hop destination address will be stored before + * actual options; move other options back + * and clear it when none present. + */ + if (m->m_data + m->m_len + sizeof(struct in_addr) >= &m->m_dat[MLEN]) + goto bad; + cnt = m->m_len; + m->m_len += sizeof(struct in_addr); + cp = mtod(m, u_char *) + sizeof(struct in_addr); + ovbcopy(mtod(m, caddr_t), (caddr_t)cp, (unsigned)cnt); + bzero(mtod(m, caddr_t), sizeof(struct in_addr)); + + for (; cnt > 0; cnt -= optlen, cp += optlen) { + opt = cp[IPOPT_OPTVAL]; + if (opt == IPOPT_EOL) + break; + if (opt == IPOPT_NOP) + optlen = 1; + else { + if (cnt < IPOPT_OLEN + sizeof(*cp)) + goto bad; + optlen = cp[IPOPT_OLEN]; + if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) + goto bad; + } + switch (opt) { + + default: + break; + + case IPOPT_LSRR: + case IPOPT_SSRR: + /* + * user process specifies route as: + * ->A->B->C->D + * D must be our final destination (but we can't + * check that since we may not have connected yet). + * A is first hop destination, which doesn't appear in + * actual IP option, but is stored before the options. + */ + if (optlen < IPOPT_MINOFF - 1 + sizeof(struct in_addr)) + goto bad; + m->m_len -= sizeof(struct in_addr); + cnt -= sizeof(struct in_addr); + optlen -= sizeof(struct in_addr); + cp[IPOPT_OLEN] = optlen; + /* + * Move first hop before start of options. + */ + bcopy((caddr_t)&cp[IPOPT_OFFSET+1], mtod(m, caddr_t), + sizeof(struct in_addr)); + /* + * Then copy rest of options back + * to close up the deleted entry. + */ + ovbcopy((caddr_t)(&cp[IPOPT_OFFSET+1] + + sizeof(struct in_addr)), + (caddr_t)&cp[IPOPT_OFFSET+1], + (unsigned)cnt + sizeof(struct in_addr)); + break; + } + } + if (m->m_len > MAX_IPOPTLEN + sizeof(struct in_addr)) + goto bad; + *pcbopt = m; + return (0); + +bad: + (void)m_free(m); + return (EINVAL); +} + +/* + * XXX + * The whole multicast option thing needs to be re-thought. + * Several of these options are equally applicable to non-multicast + * transmission, and one (IP_MULTICAST_TTL) totally duplicates a + * standard option (IP_TTL). + */ + +/* + * following RFC1724 section 3.3, 0.0.0.0/8 is interpreted as interface index. + */ +static struct ifnet * +ip_multicast_if(a, ifindexp) + struct in_addr *a; + int *ifindexp; +{ + int ifindex; + struct ifnet *ifp; + + if (ifindexp) + *ifindexp = 0; + if (ntohl(a->s_addr) >> 24 == 0) { + ifindex = ntohl(a->s_addr) & 0xffffff; + if (ifindex < 0 || if_index < ifindex) + return NULL; + ifp = ifindex2ifnet[ifindex]; + if (ifindexp) + *ifindexp = ifindex; + } else { + INADDR_TO_IFP(*a, ifp); + } + return ifp; +} + +/* + * Set the IP multicast options in response to user setsockopt(). + */ +static int +ip_setmoptions(sopt, imop) + struct sockopt *sopt; + struct ip_moptions **imop; +{ + int error = 0; + int i; + struct in_addr addr; + struct ip_mreq mreq; + struct ifnet *ifp; + struct ip_moptions *imo = *imop; + struct route ro; + struct sockaddr_in *dst; + int ifindex; + int s; + + if (imo == NULL) { + /* + * No multicast option buffer attached to the pcb; + * allocate one and initialize to default values. + */ + imo = (struct ip_moptions*)malloc(sizeof(*imo), M_IPMOPTS, + M_WAITOK); + + if (imo == NULL) + return (ENOBUFS); + *imop = imo; + imo->imo_multicast_ifp = NULL; + imo->imo_multicast_addr.s_addr = INADDR_ANY; + imo->imo_multicast_vif = -1; + imo->imo_multicast_ttl = IP_DEFAULT_MULTICAST_TTL; + imo->imo_multicast_loop = IP_DEFAULT_MULTICAST_LOOP; + imo->imo_num_memberships = 0; + } + + switch (sopt->sopt_name) { + /* store an index number for the vif you wanna use in the send */ + case IP_MULTICAST_VIF: + if (legal_vif_num == 0) { + error = EOPNOTSUPP; + break; + } + error = sooptcopyin(sopt, &i, sizeof i, sizeof i); + if (error) + break; + if (!legal_vif_num(i) && (i != -1)) { + error = EINVAL; + break; + } + imo->imo_multicast_vif = i; + break; + + case IP_MULTICAST_IF: + /* + * Select the interface for outgoing multicast packets. + */ + error = sooptcopyin(sopt, &addr, sizeof addr, sizeof addr); + if (error) + break; + /* + * INADDR_ANY is used to remove a previous selection. + * When no interface is selected, a default one is + * chosen every time a multicast packet is sent. + */ + if (addr.s_addr == INADDR_ANY) { + imo->imo_multicast_ifp = NULL; + break; + } + /* + * The selected interface is identified by its local + * IP address. Find the interface and confirm that + * it supports multicasting. + */ + s = splimp(); + ifp = ip_multicast_if(&addr, &ifindex); + if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) { + splx(s); + error = EADDRNOTAVAIL; + break; + } + imo->imo_multicast_ifp = ifp; + if (ifindex) + imo->imo_multicast_addr = addr; + else + imo->imo_multicast_addr.s_addr = INADDR_ANY; + splx(s); + break; + + case IP_MULTICAST_TTL: + /* + * Set the IP time-to-live for outgoing multicast packets. + * The original multicast API required a char argument, + * which is inconsistent with the rest of the socket API. + * We allow either a char or an int. + */ + if (sopt->sopt_valsize == 1) { + u_char ttl; + error = sooptcopyin(sopt, &ttl, 1, 1); + if (error) + break; + imo->imo_multicast_ttl = ttl; + } else { + u_int ttl; + error = sooptcopyin(sopt, &ttl, sizeof ttl, + sizeof ttl); + if (error) + break; + if (ttl > 255) + error = EINVAL; + else + imo->imo_multicast_ttl = ttl; + } + break; + + case IP_MULTICAST_LOOP: + /* + * Set the loopback flag for outgoing multicast packets. + * Must be zero or one. The original multicast API required a + * char argument, which is inconsistent with the rest + * of the socket API. We allow either a char or an int. + */ + if (sopt->sopt_valsize == 1) { + u_char loop; + error = sooptcopyin(sopt, &loop, 1, 1); + if (error) + break; + imo->imo_multicast_loop = !!loop; + } else { + u_int loop; + error = sooptcopyin(sopt, &loop, sizeof loop, + sizeof loop); + if (error) + break; + imo->imo_multicast_loop = !!loop; + } + break; + + case IP_ADD_MEMBERSHIP: + /* + * Add a multicast group membership. + * Group must be a valid IP multicast address. + */ + error = sooptcopyin(sopt, &mreq, sizeof mreq, sizeof mreq); + if (error) + break; + + if (!IN_MULTICAST(ntohl(mreq.imr_multiaddr.s_addr))) { + error = EINVAL; + break; + } + s = splimp(); + /* + * If no interface address was provided, use the interface of + * the route to the given multicast address. + */ + if (mreq.imr_interface.s_addr == INADDR_ANY) { + bzero((caddr_t)&ro, sizeof(ro)); + dst = (struct sockaddr_in *)&ro.ro_dst; + dst->sin_len = sizeof(*dst); + dst->sin_family = AF_INET; + dst->sin_addr = mreq.imr_multiaddr; + rtalloc(&ro); + if (ro.ro_rt == NULL) { + error = EADDRNOTAVAIL; + splx(s); + break; + } + ifp = ro.ro_rt->rt_ifp; + rtfree(ro.ro_rt); + } + else { + ifp = ip_multicast_if(&mreq.imr_interface, NULL); + } + + /* + * See if we found an interface, and confirm that it + * supports multicast. + */ + if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) { + error = EADDRNOTAVAIL; + splx(s); + break; + } + /* + * See if the membership already exists or if all the + * membership slots are full. + */ + for (i = 0; i < imo->imo_num_memberships; ++i) { + if (imo->imo_membership[i]->inm_ifp == ifp && + imo->imo_membership[i]->inm_addr.s_addr + == mreq.imr_multiaddr.s_addr) + break; + } + if (i < imo->imo_num_memberships) { + error = EADDRINUSE; + splx(s); + break; + } + if (i == IP_MAX_MEMBERSHIPS) { + error = ETOOMANYREFS; + splx(s); + break; + } + /* + * Everything looks good; add a new record to the multicast + * address list for the given interface. + */ + if ((imo->imo_membership[i] = + in_addmulti(&mreq.imr_multiaddr, ifp)) == NULL) { + error = ENOBUFS; + splx(s); + break; + } + ++imo->imo_num_memberships; + splx(s); + break; + + case IP_DROP_MEMBERSHIP: + /* + * Drop a multicast group membership. + * Group must be a valid IP multicast address. + */ + error = sooptcopyin(sopt, &mreq, sizeof mreq, sizeof mreq); + if (error) + break; + + if (!IN_MULTICAST(ntohl(mreq.imr_multiaddr.s_addr))) { + error = EINVAL; + break; + } + + s = splimp(); + /* + * If an interface address was specified, get a pointer + * to its ifnet structure. + */ + if (mreq.imr_interface.s_addr == INADDR_ANY) + ifp = NULL; + else { + ifp = ip_multicast_if(&mreq.imr_interface, NULL); + if (ifp == NULL) { + error = EADDRNOTAVAIL; + splx(s); + break; + } + } + /* + * Find the membership in the membership array. + */ + for (i = 0; i < imo->imo_num_memberships; ++i) { + if ((ifp == NULL || + imo->imo_membership[i]->inm_ifp == ifp) && + imo->imo_membership[i]->inm_addr.s_addr == + mreq.imr_multiaddr.s_addr) + break; + } + if (i == imo->imo_num_memberships) { + error = EADDRNOTAVAIL; + splx(s); + break; + } + /* + * Give up the multicast address record to which the + * membership points. + */ + in_delmulti(imo->imo_membership[i]); + /* + * Remove the gap in the membership array. + */ + for (++i; i < imo->imo_num_memberships; ++i) + imo->imo_membership[i-1] = imo->imo_membership[i]; + --imo->imo_num_memberships; + splx(s); + break; + + default: + error = EOPNOTSUPP; + break; + } + + /* + * If all options have default values, no need to keep the mbuf. + */ + if (imo->imo_multicast_ifp == NULL && + imo->imo_multicast_vif == -1 && + imo->imo_multicast_ttl == IP_DEFAULT_MULTICAST_TTL && + imo->imo_multicast_loop == IP_DEFAULT_MULTICAST_LOOP && + imo->imo_num_memberships == 0) { + free(*imop, M_IPMOPTS); + *imop = NULL; + } + + return (error); +} + +/* + * Return the IP multicast options in response to user getsockopt(). + */ +static int +ip_getmoptions(sopt, imo) + struct sockopt *sopt; + register struct ip_moptions *imo; +{ + struct in_addr addr; + struct in_ifaddr *ia; + int error, optval; + u_char coptval; + + error = 0; + switch (sopt->sopt_name) { + case IP_MULTICAST_VIF: + if (imo != NULL) + optval = imo->imo_multicast_vif; + else + optval = -1; + error = sooptcopyout(sopt, &optval, sizeof optval); + break; + + case IP_MULTICAST_IF: + if (imo == NULL || imo->imo_multicast_ifp == NULL) + addr.s_addr = INADDR_ANY; + else if (imo->imo_multicast_addr.s_addr) { + /* return the value user has set */ + addr = imo->imo_multicast_addr; + } else { + IFP_TO_IA(imo->imo_multicast_ifp, ia); + addr.s_addr = (ia == NULL) ? INADDR_ANY + : IA_SIN(ia)->sin_addr.s_addr; + } + error = sooptcopyout(sopt, &addr, sizeof addr); + break; + + case IP_MULTICAST_TTL: + if (imo == 0) + optval = coptval = IP_DEFAULT_MULTICAST_TTL; + else + optval = coptval = imo->imo_multicast_ttl; + if (sopt->sopt_valsize == 1) + error = sooptcopyout(sopt, &coptval, 1); + else + error = sooptcopyout(sopt, &optval, sizeof optval); + break; + + case IP_MULTICAST_LOOP: + if (imo == 0) + optval = coptval = IP_DEFAULT_MULTICAST_LOOP; + else + optval = coptval = imo->imo_multicast_loop; + if (sopt->sopt_valsize == 1) + error = sooptcopyout(sopt, &coptval, 1); + else + error = sooptcopyout(sopt, &optval, sizeof optval); + break; + + default: + error = ENOPROTOOPT; + break; + } + return (error); +} + +/* + * Discard the IP multicast options. + */ +void +ip_freemoptions(imo) + register struct ip_moptions *imo; +{ + register int i; + + if (imo != NULL) { + for (i = 0; i < imo->imo_num_memberships; ++i) + in_delmulti(imo->imo_membership[i]); + free(imo, M_IPMOPTS); + } +} + +/* + * Routine called from ip_output() to loop back a copy of an IP multicast + * packet to the input queue of a specified interface. Note that this + * calls the output routine of the loopback "driver", but with an interface + * pointer that might NOT be a loopback interface -- evil, but easier than + * replicating that code here. + */ +static void +ip_mloopback(ifp, m, dst, hlen) + struct ifnet *ifp; + register struct mbuf *m; + register struct sockaddr_in *dst; + int hlen; +{ + register struct ip *ip; + struct mbuf *copym; + + copym = m_copy(m, 0, M_COPYALL); + if (copym != NULL && (copym->m_flags & M_EXT || copym->m_len < hlen)) + copym = m_pullup(copym, hlen); + if (copym != NULL) { + /* + * We don't bother to fragment if the IP length is greater + * than the interface's MTU. Can this possibly matter? + */ + ip = mtod(copym, struct ip *); + HTONS(ip->ip_len); + HTONS(ip->ip_off); + ip->ip_sum = 0; + if (ip->ip_vhl == IP_VHL_BORING) { + ip->ip_sum = in_cksum_hdr(ip); + } else { + ip->ip_sum = in_cksum(copym, hlen); + } + /* + * NB: + * It's not clear whether there are any lingering + * reentrancy problems in other areas which might + * be exposed by using ip_input directly (in + * particular, everything which modifies the packet + * in-place). Yet another option is using the + * protosw directly to deliver the looped back + * packet. For the moment, we'll err on the side + * of safety by using if_simloop(). + */ +#if 1 /* XXX */ + if (dst->sin_family != AF_INET) { + printf("ip_mloopback: bad address family %d\n", + dst->sin_family); + dst->sin_family = AF_INET; + } +#endif + +#ifdef notdef + copym->m_pkthdr.rcvif = ifp; + ip_input(copym); +#else + /* if the checksum hasn't been computed, mark it as valid */ + if (copym->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + copym->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + copym->m_pkthdr.csum_data = 0xffff; + } + if_simloop(ifp, copym, dst->sin_family, 0); +#endif + } +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/raw_ip.c b/packages/net/bsd_tcpip/current/src/sys/netinet/raw_ip.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/raw_ip.c @@ -0,0 +1,600 @@ +//========================================================================== +// +// src/sys/netinet/raw_ip.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 + * $FreeBSD: src/sys/netinet/raw_ip.c,v 1.64.2.8 2001/07/29 19:32:40 ume Exp $ + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#define _IP_VHL +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef IPSEC +#include +#endif /*IPSEC*/ + +#ifdef DUMMYNET +#include +#endif + +struct inpcbhead ripcb; +struct inpcbinfo ripcbinfo; + +/* + * Nominal space allocated to a raw ip socket. + */ +#define RIPSNDQ 8192 +#define RIPRCVQ 8192 + +/* + * Raw interface to IP protocol. + */ + +/* + * Initialize raw connection block q. + */ +void +rip_init() +{ + LIST_INIT(&ripcb); + ripcbinfo.listhead = &ripcb; + /* + * XXX We don't use the hash list for raw IP, but it's easier + * to allocate a one entry hash list than it is to check all + * over the place for hashbase == NULL. + */ + ripcbinfo.hashbase = hashinit(1, M_PCB, &ripcbinfo.hashmask); + ripcbinfo.porthashbase = hashinit(1, M_PCB, &ripcbinfo.porthashmask); + ripcbinfo.ipi_zone = zinit("ripcb", sizeof(struct inpcb), + maxsockets, ZONE_INTERRUPT, 0); +} + +static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; +/* + * Setup generic address and protocol structures + * for raw_input routine, then pass them along with + * mbuf chain. + */ +void +rip_input(m, off) + struct mbuf *m; + int off; +{ + register struct ip *ip = mtod(m, struct ip *); + register struct inpcb *inp; + struct inpcb *last = 0; + struct mbuf *opts = 0; + int proto = ip->ip_p; + + ripsrc.sin_addr = ip->ip_src; + LIST_FOREACH(inp, &ripcb, inp_list) { +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV4) == 0) + continue; +#endif + if (inp->inp_ip_p && inp->inp_ip_p != proto) + continue; + if (inp->inp_laddr.s_addr && + inp->inp_laddr.s_addr != ip->ip_dst.s_addr) + continue; + if (inp->inp_faddr.s_addr && + inp->inp_faddr.s_addr != ip->ip_src.s_addr) + continue; + if (last) { + struct mbuf *n = m_copy(m, 0, (int)M_COPYALL); + +#ifdef IPSEC + /* check AH/ESP integrity. */ + if (n && ipsec4_in_reject_so(n, last->inp_socket)) { + m_freem(n); + ipsecstat.in_polvio++; + /* do not inject data to pcb */ + } else +#endif /*IPSEC*/ + if (n) { + if (last->inp_flags & INP_CONTROLOPTS || + last->inp_socket->so_options & SO_TIMESTAMP) + ip_savecontrol(last, &opts, ip, n); + if (sbappendaddr(&last->inp_socket->so_rcv, + (struct sockaddr *)&ripsrc, n, + opts) == 0) { + /* should notify about lost packet */ + m_freem(n); + if (opts) + m_freem(opts); + } else + sorwakeup(last->inp_socket); + opts = 0; + } + } + last = inp; + } +#ifdef IPSEC + /* check AH/ESP integrity. */ + if (last && ipsec4_in_reject_so(m, last->inp_socket)) { + m_freem(m); + ipsecstat.in_polvio++; + ipstat.ips_delivered--; + /* do not inject data to pcb */ + } else +#endif /*IPSEC*/ + if (last) { + if (last->inp_flags & INP_CONTROLOPTS || + last->inp_socket->so_options & SO_TIMESTAMP) + ip_savecontrol(last, &opts, ip, m); + if (sbappendaddr(&last->inp_socket->so_rcv, + (struct sockaddr *)&ripsrc, m, opts) == 0) { + m_freem(m); + if (opts) + m_freem(opts); + } else + sorwakeup(last->inp_socket); + } else { + m_freem(m); + ipstat.ips_noproto++; + ipstat.ips_delivered--; + } +} + +/* + * Generate IP header and pass packet to ip_output. + * Tack on options user may have setup with control call. + */ +int +rip_output(m, so, dst) + struct mbuf *m; + struct socket *so; + u_long dst; +{ + register struct ip *ip; + register struct inpcb *inp = sotoinpcb(so); + int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST; + + /* + * If the user handed us a complete IP packet, use it. + * Otherwise, allocate an mbuf for a header and fill it in. + */ + if ((inp->inp_flags & INP_HDRINCL) == 0) { + if (m->m_pkthdr.len + sizeof(struct ip) > IP_MAXPACKET) { + m_freem(m); + return(EMSGSIZE); + } + M_PREPEND(m, sizeof(struct ip), M_WAIT); + ip = mtod(m, struct ip *); + ip->ip_tos = inp->inp_ip_tos; + ip->ip_off = 0; + ip->ip_p = inp->inp_ip_p; + ip->ip_len = m->m_pkthdr.len; + ip->ip_src = inp->inp_laddr; + ip->ip_dst.s_addr = dst; + ip->ip_ttl = inp->inp_ip_ttl; + } else { + if (m->m_pkthdr.len > IP_MAXPACKET) { + m_freem(m); + return(EMSGSIZE); + } + ip = mtod(m, struct ip *); + /* don't allow both user specified and setsockopt options, + and don't allow packet length sizes that will crash */ + if (((IP_VHL_HL(ip->ip_vhl) != (sizeof (*ip) >> 2)) + && inp->inp_options) + || (ip->ip_len > m->m_pkthdr.len) + || (ip->ip_len < (IP_VHL_HL(ip->ip_vhl) << 2))) { + m_freem(m); + return EINVAL; + } + if (ip->ip_id == 0) +#ifdef RANDOM_IP_ID + ip->ip_id = ip_randomid(); +#else + ip->ip_id = htons(ip_id++); +#endif + /* XXX prevent ip_output from overwriting header fields */ + flags |= IP_RAWOUTPUT; + ipstat.ips_rawout++; + } + +#ifdef IPSEC + if (ipsec_setsocket(m, so) != 0) { + m_freem(m); + return ENOBUFS; + } +#endif /*IPSEC*/ + + return (ip_output(m, inp->inp_options, &inp->inp_route, flags, + inp->inp_moptions)); +} + +/* + * Raw IP socket option processing. + */ +int +rip_ctloutput(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + struct inpcb *inp = sotoinpcb(so); + int error, optval; + + if (sopt->sopt_level != IPPROTO_IP) + return (EINVAL); + + error = 0; + + switch (sopt->sopt_dir) { + case SOPT_GET: + switch (sopt->sopt_name) { + case IP_HDRINCL: + optval = inp->inp_flags & INP_HDRINCL; + error = sooptcopyout(sopt, &optval, sizeof optval); + break; + + case IP_FW_ADD: + case IP_FW_GET: + if (ip_fw_ctl_ptr == 0) + error = ENOPROTOOPT; + else + error = ip_fw_ctl_ptr(sopt); + break; + +#ifdef DUMMYNET + case IP_DUMMYNET_GET: + if (ip_dn_ctl_ptr == NULL) + error = ENOPROTOOPT ; + else + error = ip_dn_ctl_ptr(sopt); + break ; +#endif /* DUMMYNET */ + + case MRT_INIT: + case MRT_DONE: + case MRT_ADD_VIF: + case MRT_DEL_VIF: + case MRT_ADD_MFC: + case MRT_DEL_MFC: + case MRT_VERSION: + case MRT_ASSERT: + error = ip_mrouter_get(so, sopt); + break; + + default: + error = ip_ctloutput(so, sopt); + break; + } + break; + + case SOPT_SET: + switch (sopt->sopt_name) { + case IP_HDRINCL: + error = sooptcopyin(sopt, &optval, sizeof optval, + sizeof optval); + if (error) + break; + if (optval) + inp->inp_flags |= INP_HDRINCL; + else + inp->inp_flags &= ~INP_HDRINCL; + break; + + case IP_FW_ADD: + case IP_FW_DEL: + case IP_FW_FLUSH: + case IP_FW_ZERO: + case IP_FW_RESETLOG: + if (ip_fw_ctl_ptr == 0) + error = ENOPROTOOPT; + else + error = ip_fw_ctl_ptr(sopt); + break; + +#ifdef DUMMYNET + case IP_DUMMYNET_CONFIGURE: + case IP_DUMMYNET_DEL: + case IP_DUMMYNET_FLUSH: + if (ip_dn_ctl_ptr == NULL) + error = ENOPROTOOPT ; + else + error = ip_dn_ctl_ptr(sopt); + break ; +#endif + + case IP_RSVP_ON: + error = ip_rsvp_init(so); + break; + + case IP_RSVP_OFF: + error = ip_rsvp_done(); + break; + + /* XXX - should be combined */ + case IP_RSVP_VIF_ON: + error = ip_rsvp_vif_init(so, sopt); + break; + + case IP_RSVP_VIF_OFF: + error = ip_rsvp_vif_done(so, sopt); + break; + + case MRT_INIT: + case MRT_DONE: + case MRT_ADD_VIF: + case MRT_DEL_VIF: + case MRT_ADD_MFC: + case MRT_DEL_MFC: + case MRT_VERSION: + case MRT_ASSERT: + error = ip_mrouter_set(so, sopt); + break; + + default: + error = ip_ctloutput(so, sopt); + break; + } + break; + } + + return (error); +} + +/* + * This function exists solely to receive the PRC_IFDOWN messages which + * are sent by if_down(). It looks for an ifaddr whose ifa_addr is sa, + * and calls in_ifadown() to remove all routes corresponding to that address. + * It also receives the PRC_IFUP messages from if_up() and reinstalls the + * interface routes. + */ +void +rip_ctlinput(cmd, sa, vip) + int cmd; + struct sockaddr *sa; + void *vip; +{ + struct in_ifaddr *ia; + struct ifnet *ifp; + int err; + int flags; + + switch (cmd) { + case PRC_IFDOWN: + for (ia = in_ifaddrhead.tqh_first; ia; + ia = ia->ia_link.tqe_next) { + if (ia->ia_ifa.ifa_addr == sa + && (ia->ia_flags & IFA_ROUTE)) { + /* + * in_ifscrub kills the interface route. + */ + in_ifscrub(ia->ia_ifp, ia); + /* + * in_ifadown gets rid of all the rest of + * the routes. This is not quite the right + * thing to do, but at least if we are running + * a routing process they will come back. + */ + in_ifadown(&ia->ia_ifa, 0); + break; + } + } + break; + + case PRC_IFUP: + for (ia = in_ifaddrhead.tqh_first; ia; + ia = ia->ia_link.tqe_next) { + if (ia->ia_ifa.ifa_addr == sa) + break; + } + if (ia == 0 || (ia->ia_flags & IFA_ROUTE)) + return; + flags = RTF_UP; + ifp = ia->ia_ifa.ifa_ifp; + + if ((ifp->if_flags & IFF_LOOPBACK) + || (ifp->if_flags & IFF_POINTOPOINT)) + flags |= RTF_HOST; + + err = rtinit(&ia->ia_ifa, RTM_ADD, flags); + if (err == 0) + ia->ia_flags |= IFA_ROUTE; + break; + } +} + +u_long rip_sendspace = RIPSNDQ; +u_long rip_recvspace = RIPRCVQ; + +static int +rip_attach(struct socket *so, int proto, struct proc *p) +{ + struct inpcb *inp; + int error, s; + + inp = sotoinpcb(so); + if (inp) + panic("rip_attach"); + + error = soreserve(so, rip_sendspace, rip_recvspace); + if (error) + return error; + s = splnet(); + error = in_pcballoc(so, &ripcbinfo, p); + splx(s); + if (error) + return error; + inp = (struct inpcb *)so->so_pcb; + inp->inp_vflag |= INP_IPV4; + inp->inp_ip_p = proto; + inp->inp_ip_ttl = ip_defttl; + return 0; +} + +static int +rip_detach(struct socket *so) +{ + struct inpcb *inp; + + inp = sotoinpcb(so); + if (inp == 0) + panic("rip_detach"); + if (so == ip_mrouter) + ip_mrouter_done(); + ip_rsvp_force_done(so); + if (so == ip_rsvpd) + ip_rsvp_done(); + in_pcbdetach(inp); + return 0; +} + +static int +rip_abort(struct socket *so) +{ + soisdisconnected(so); + return rip_detach(so); +} + +static int +rip_disconnect(struct socket *so) +{ + if ((so->so_state & SS_ISCONNECTED) == 0) + return ENOTCONN; + return rip_abort(so); +} + +static int +rip_bind(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + struct inpcb *inp = sotoinpcb(so); + struct sockaddr_in *addr = (struct sockaddr_in *)nam; + + if (nam->sa_len != sizeof(*addr)) + return EINVAL; + + if (TAILQ_EMPTY(&ifnet) || ((addr->sin_family != AF_INET) && + (addr->sin_family != AF_IMPLINK)) || + (addr->sin_addr.s_addr && + ifa_ifwithaddr((struct sockaddr *)addr) == 0)) + return EADDRNOTAVAIL; + inp->inp_laddr = addr->sin_addr; + return 0; +} + +static int +rip_connect(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + struct inpcb *inp = sotoinpcb(so); + struct sockaddr_in *addr = (struct sockaddr_in *)nam; + + if (nam->sa_len != sizeof(*addr)) + return EINVAL; + if (TAILQ_EMPTY(&ifnet)) + return EADDRNOTAVAIL; + if ((addr->sin_family != AF_INET) && + (addr->sin_family != AF_IMPLINK)) + return EAFNOSUPPORT; + inp->inp_faddr = addr->sin_addr; + soisconnected(so); + return 0; +} + +static int +rip_shutdown(struct socket *so) +{ + socantsendmore(so); + return 0; +} + +static int +rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, + struct mbuf *control, struct proc *p) +{ + struct inpcb *inp = sotoinpcb(so); + register u_long dst; + + if (so->so_state & SS_ISCONNECTED) { + if (nam) { + m_freem(m); + return EISCONN; + } + dst = inp->inp_faddr.s_addr; + } else { + if (nam == NULL) { + m_freem(m); + return ENOTCONN; + } + dst = ((struct sockaddr_in *)nam)->sin_addr.s_addr; + } + return rip_output(m, so, dst); +} + +struct pr_usrreqs rip_usrreqs = { + rip_abort, pru_accept_notsupp, rip_attach, rip_bind, rip_connect, + pru_connect2_notsupp, in_control, rip_detach, rip_disconnect, + pru_listen_notsupp, in_setpeeraddr, pru_rcvd_notsupp, + pru_rcvoob_notsupp, rip_send, pru_sense_null, rip_shutdown, + in_setsockaddr, sosend, soreceive, sopoll +}; diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_debug.c b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_debug.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_debug.c @@ -0,0 +1,250 @@ +//========================================================================== +// +// src/sys/netinet/tcp_debug.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_debug.c 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_debug.c,v 1.16.2.1 2000/07/15 07:14:31 kris Exp $ + */ + +#include +#ifdef TCPDEBUG +#ifndef INET +#error The option TCPDEBUG requires option INET. +#endif + +#ifdef TCPDEBUG +/* load symbolic names */ +#define PRUREQUESTS +#define TCPSTATES +#define TCPTIMERS +#define TANAMES +#endif + +#include +#include +#include + +#include +#include +#include +#ifdef INET6 +#include +#endif +#include +#include +#include +#include +#include +#include +#include + +static int tcpconsdebug = 0; + +static struct tcp_debug tcp_debug[TCP_NDEBUG]; +static int tcp_debx; + +/* + * Tcp debug routines + */ +void +tcp_trace(act, ostate, tp, ipgen, th, req) + short act, ostate; + struct tcpcb *tp; + void *ipgen; + struct tcphdr *th; + int req; +{ +#ifdef INET6 + int isipv6; +#endif /* INET6 */ +#ifdef TCPDEBUG + tcp_seq seq, ack; + int len, flags; +#endif + struct tcp_debug *td = &tcp_debug[tcp_debx++]; + +#ifdef INET6 + isipv6 = (ipgen != NULL && ((struct ip *)ipgen)->ip_v == 6) ? 1 : 0; +#endif /* INET6 */ + td->td_family = +#ifdef INET6 + (isipv6 != 0) ? AF_INET6 : +#endif + AF_INET; + if (tcp_debx == TCP_NDEBUG) + tcp_debx = 0; + td->td_time = iptime(); + td->td_act = act; + td->td_ostate = ostate; + td->td_tcb = (caddr_t)tp; + if (tp) + td->td_cb = *tp; + else + bzero((caddr_t)&td->td_cb, sizeof (*tp)); + if (ipgen) { + switch (td->td_family) { + case AF_INET: + bcopy((caddr_t)ipgen, (caddr_t)&td->td_ti.ti_i, + sizeof(td->td_ti.ti_i)); + bzero((caddr_t)td->td_ip6buf, sizeof(td->td_ip6buf)); + break; +#ifdef INET6 + case AF_INET6: + bcopy((caddr_t)ipgen, (caddr_t)td->td_ip6buf, + sizeof(td->td_ip6buf)); + bzero((caddr_t)&td->td_ti.ti_i, + sizeof(td->td_ti.ti_i)); + break; +#endif + default: + bzero((caddr_t)td->td_ip6buf, sizeof(td->td_ip6buf)); + bzero((caddr_t)&td->td_ti.ti_i, + sizeof(td->td_ti.ti_i)); + break; + } + } else { + bzero((caddr_t)&td->td_ti.ti_i, sizeof(td->td_ti.ti_i)); + bzero((caddr_t)td->td_ip6buf, sizeof(td->td_ip6buf)); + } + if (th) { + switch (td->td_family) { + case AF_INET: + td->td_ti.ti_t = *th; + bzero((caddr_t)&td->td_ti6.th, sizeof(td->td_ti6.th)); + break; +#ifdef INET6 + case AF_INET6: + td->td_ti6.th = *th; + bzero((caddr_t)&td->td_ti.ti_t, + sizeof(td->td_ti.ti_t)); + break; +#endif + default: + bzero((caddr_t)&td->td_ti.ti_t, + sizeof(td->td_ti.ti_t)); + bzero((caddr_t)&td->td_ti6.th, sizeof(td->td_ti6.th)); + break; + } + } else { + bzero((caddr_t)&td->td_ti.ti_t, sizeof(td->td_ti.ti_t)); + bzero((caddr_t)&td->td_ti6.th, sizeof(td->td_ti6.th)); + } + td->td_req = req; +#ifdef TCPDEBUG + if (tcpconsdebug == 0) + return; + if (tp) + printf("%p %s:", tp, tcpstates[ostate]); + else + printf("???????? "); + printf("%s ", tanames[act]); + switch (act) { + + case TA_INPUT: + case TA_OUTPUT: + case TA_DROP: + if (ipgen == NULL || th == NULL) + break; + seq = th->th_seq; + ack = th->th_ack; + len = +#ifdef INET6 + isipv6 ? ((struct ip6_hdr *)ipgen)->ip6_plen : +#endif + ((struct ip *)ipgen)->ip_len; + if (act == TA_OUTPUT) { + seq = ntohl(seq); + ack = ntohl(ack); + len = ntohs((u_short)len); + } + if (act == TA_OUTPUT) + len -= sizeof (struct tcphdr); + if (len) + printf("[%x..%x)", seq, seq+len); + else + printf("%x", seq); + printf("@%x, urp=%x", ack, th->th_urp); + flags = th->th_flags; + if (flags) { + char *cp = "<"; +#define pf(f) { \ + if (th->th_flags & TH_##f) { \ + printf("%s%s", cp, #f); \ + cp = ","; \ + } \ +} + pf(SYN); pf(ACK); pf(FIN); pf(RST); pf(PUSH); pf(URG); + printf(">"); + } + break; + + case TA_USER: + printf("%s", prurequests[req&0xff]); + if ((req & 0xff) == PRU_SLOWTIMO) + printf("<%s>", tcptimers[req>>8]); + break; + } + if (tp) + printf(" -> %s", tcpstates[tp->t_state]); + /* print out internal state of tp !?! */ + printf("\n"); + if (tp == 0) + return; + printf( + "\trcv_(nxt,wnd,up) (%lx,%lx,%lx) snd_(una,nxt,max) (%lx,%lx,%lx)\n", + (u_long)tp->rcv_nxt, tp->rcv_wnd, (u_long)tp->rcv_up, + (u_long)tp->snd_una, (u_long)tp->snd_nxt, (u_long)tp->snd_max); + printf("\tsnd_(wl1,wl2,wnd) (%lx,%lx,%lx)\n", + (u_long)tp->snd_wl1, (u_long)tp->snd_wl2, tp->snd_wnd); +#endif /* TCPDEBUG */ +} +#endif diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_input.c b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_input.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_input.c @@ -0,0 +1,2937 @@ +//========================================================================== +// +// src/sys/netinet/tcp_input.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.107.2.16 2001/08/22 00:59:12 silby Exp $ + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include /* for ICMP_BANDLIM */ +#include +#include /* for ICMP_BANDLIM */ +#include +#include +#ifdef INET6 +#include +#include +#include +#include +#include +#endif +#include +#include +#include +#include +#include +#ifdef INET6 +#include +#endif +#include +#ifdef TCPDEBUG +#include + +u_char tcp_saveipgen[40]; /* the size must be of max ip header, now IPv6 */ +struct tcphdr tcp_savetcp; +#endif /* TCPDEBUG */ + +#ifdef IPSEC +#include +#include +#endif /*IPSEC*/ + +static int tcprexmtthresh = 3; +tcp_cc tcp_ccgen; + +struct tcpstat tcpstat; +static int log_in_vain = 0; +static int blackhole = 0; +int tcp_delack_enabled = 1; +int tcp_lq_overflow = 1; + +#ifdef TCP_DROP_SYNFIN +static int drop_synfin = 0; +#endif + +struct inpcbhead tcb; +#define tcb6 tcb /* for KAME src sync over BSD*'s */ +struct inpcbinfo tcbinfo; + +static void tcp_dooptions __P((struct tcpcb *, + u_char *, int, struct tcphdr *, struct tcpopt *)); +static void tcp_pulloutofband __P((struct socket *, + struct tcphdr *, struct mbuf *, int)); +static int tcp_reass __P((struct tcpcb *, struct tcphdr *, int *, + struct mbuf *)); +static void tcp_xmit_timer __P((struct tcpcb *, int)); +static int tcp_newreno __P((struct tcpcb *, struct tcphdr *)); + +/* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */ +#ifdef INET6 +#define ND6_HINT(tp) \ +do { \ + if ((tp) && (tp)->t_inpcb && \ + ((tp)->t_inpcb->inp_vflag & INP_IPV6) != 0 && \ + (tp)->t_inpcb->in6p_route.ro_rt) \ + nd6_nud_hint((tp)->t_inpcb->in6p_route.ro_rt, NULL, 0); \ +} while (0) +#else +#define ND6_HINT(tp) +#endif + +/* + * Indicate whether this ack should be delayed. + */ +#define DELAY_ACK(tp) \ + (tcp_delack_enabled && !callout_pending(tp->tt_delack)) + +static int +tcp_reass(tp, th, tlenp, m) + register struct tcpcb *tp; + register struct tcphdr *th; + int *tlenp; + struct mbuf *m; +{ + struct tseg_qent *q; + struct tseg_qent *p = NULL; + struct tseg_qent *nq; + struct tseg_qent *te; + struct socket *so = tp->t_inpcb->inp_socket; + int flags; + + /* + * Call with th==0 after become established to + * force pre-ESTABLISHED data up to user socket. + */ + if (th == 0) + goto present; + + /* Allocate a new queue entry. If we can't, just drop the pkt. XXX */ + MALLOC(te, struct tseg_qent *, sizeof (struct tseg_qent), M_TSEGQ, + M_NOWAIT); + if (te == NULL) { + tcpstat.tcps_rcvmemdrop++; + m_freem(m); + return (0); + } + + /* + * Find a segment which begins after this one does. + */ + LIST_FOREACH(q, &tp->t_segq, tqe_q) { + if (SEQ_GT(q->tqe_th->th_seq, th->th_seq)) + break; + p = q; + } + + /* + * If there is a preceding segment, it may provide some of + * our data already. If so, drop the data from the incoming + * segment. If it provides all of our data, drop us. + */ + if (p != NULL) { + register int i; + /* conversion to int (in i) handles seq wraparound */ + i = p->tqe_th->th_seq + p->tqe_len - th->th_seq; + if (i > 0) { + if (i >= *tlenp) { + tcpstat.tcps_rcvduppack++; + tcpstat.tcps_rcvdupbyte += *tlenp; + m_freem(m); + FREE(te, M_TSEGQ); + /* + * Try to present any queued data + * at the left window edge to the user. + * This is needed after the 3-WHS + * completes. + */ + goto present; /* ??? */ + } + m_adj(m, i); + *tlenp -= i; + th->th_seq += i; + } + } + tcpstat.tcps_rcvoopack++; + tcpstat.tcps_rcvoobyte += *tlenp; + + /* + * While we overlap succeeding segments trim them or, + * if they are completely covered, dequeue them. + */ + while (q) { + register int i = (th->th_seq + *tlenp) - q->tqe_th->th_seq; + if (i <= 0) + break; + if (i < q->tqe_len) { + q->tqe_th->th_seq += i; + q->tqe_len -= i; + m_adj(q->tqe_m, i); + break; + } + + nq = LIST_NEXT(q, tqe_q); + LIST_REMOVE(q, tqe_q); + m_freem(q->tqe_m); + FREE(q, M_TSEGQ); + q = nq; + } + + /* Insert the new segment queue entry into place. */ + te->tqe_m = m; + te->tqe_th = th; + te->tqe_len = *tlenp; + + if (p == NULL) { + LIST_INSERT_HEAD(&tp->t_segq, te, tqe_q); + } else { + LIST_INSERT_AFTER(p, te, tqe_q); + } + +present: + /* + * Present data to user, advancing rcv_nxt through + * completed sequence space. + */ + if (!TCPS_HAVEESTABLISHED(tp->t_state)) + return (0); + q = LIST_FIRST(&tp->t_segq); + if (!q || q->tqe_th->th_seq != tp->rcv_nxt) + return (0); + do { + tp->rcv_nxt += q->tqe_len; + flags = q->tqe_th->th_flags & TH_FIN; + nq = LIST_NEXT(q, tqe_q); + LIST_REMOVE(q, tqe_q); + if (so->so_state & SS_CANTRCVMORE) + m_freem(q->tqe_m); + else + sbappend(&so->so_rcv, q->tqe_m); + FREE(q, M_TSEGQ); + q = nq; + } while (q && q->tqe_th->th_seq == tp->rcv_nxt); + ND6_HINT(tp); + sorwakeup(so); + return (flags); +} + +/* + * TCP input routine, follows pages 65-76 of the + * protocol specification dated September, 1981 very closely. + */ +#ifdef INET6 +int +tcp6_input(mp, offp, proto) + struct mbuf **mp; + int *offp, proto; +{ + register struct mbuf *m = *mp; + struct in6_ifaddr *ia6; + + IP6_EXTHDR_CHECK(m, *offp, sizeof(struct tcphdr), IPPROTO_DONE); + + /* + * draft-itojun-ipv6-tcp-to-anycast + * better place to put this in? + */ + ia6 = ip6_getdstifaddr(m); + if (ia6 && (ia6->ia6_flags & IN6_IFF_ANYCAST)) { + struct ip6_hdr *ip6; + + ip6 = mtod(m, struct ip6_hdr *); + icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR, + (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); + return IPPROTO_DONE; + } + + tcp_input(m, *offp); + return IPPROTO_DONE; +} +#endif + +void +tcp_input(m, off0) + register struct mbuf *m; + int off0; +{ + register struct tcphdr *th; + register struct ip *ip = NULL; + register struct ipovly *ipov; + register struct inpcb *inp; + u_char *optp = NULL; + int optlen = 0; + int len, tlen, off; + int drop_hdrlen; + register struct tcpcb *tp = 0; + register int thflags; + struct socket *so = 0; + int todrop, acked, ourfinisacked, needoutput = 0; + struct in_addr laddr; +#ifdef INET6 + struct in6_addr laddr6; +#endif + int dropsocket = 0; + int iss = 0; + u_long tiwin; + struct tcpopt to; /* options in this segment */ + struct rmxp_tao *taop; /* pointer to our TAO cache entry */ + struct rmxp_tao tao_noncached; /* in case there's no cached entry */ +#ifdef TCPDEBUG + short ostate = 0; +#endif +#ifdef INET6 + struct ip6_hdr *ip6 = NULL; + int isipv6; +#endif /* INET6 */ + int rstreason; /* For badport_bandlim accounting purposes */ + +#ifdef INET6 + isipv6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0; +#endif + bzero((char *)&to, sizeof(to)); + + tcpstat.tcps_rcvtotal++; + +#ifdef INET6 + if (isipv6) { + /* IP6_EXTHDR_CHECK() is already done at tcp6_input() */ + ip6 = mtod(m, struct ip6_hdr *); + tlen = sizeof(*ip6) + ntohs(ip6->ip6_plen) - off0; + if (in6_cksum(m, IPPROTO_TCP, off0, tlen)) { + tcpstat.tcps_rcvbadsum++; + goto drop; + } + th = (struct tcphdr *)((caddr_t)ip6 + off0); + + /* + * Be proactive about unspecified IPv6 address in source. + * As we use all-zero to indicate unbounded/unconnected pcb, + * unspecified IPv6 address can be used to confuse us. + * + * Note that packets with unspecified IPv6 destination is + * already dropped in ip6_input. + */ + if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { + /* XXX stat */ + goto drop; + } + } else +#endif /* INET6 */ + { + /* + * Get IP and TCP header together in first mbuf. + * Note: IP leaves IP header in first mbuf. + */ + if (off0 > sizeof (struct ip)) { + ip_stripoptions(m, (struct mbuf *)0); + off0 = sizeof(struct ip); + } + if (m->m_len < sizeof (struct tcpiphdr)) { + if ((m = m_pullup(m, sizeof (struct tcpiphdr))) == 0) { + tcpstat.tcps_rcvshort++; + return; + } + } + ip = mtod(m, struct ip *); + ipov = (struct ipovly *)ip; + th = (struct tcphdr *)((caddr_t)ip + off0); + tlen = ip->ip_len; + + if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { + if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) + th->th_sum = m->m_pkthdr.csum_data; + else + th->th_sum = in_pseudo(ip->ip_src.s_addr, + ip->ip_dst.s_addr, htonl(m->m_pkthdr.csum_data + + ip->ip_len + IPPROTO_TCP)); + th->th_sum ^= 0xffff; + } else { + /* + * Checksum extended TCP header and data. + */ + len = sizeof (struct ip) + tlen; + bzero(ipov->ih_x1, sizeof(ipov->ih_x1)); + ipov->ih_len = (u_short)tlen; + HTONS(ipov->ih_len); + th->th_sum = in_cksum(m, len); + } + if (th->th_sum) { + tcpstat.tcps_rcvbadsum++; + goto drop; + } +#ifdef INET6 + /* Re-initialization for later version check */ + ip->ip_v = IPVERSION; +#endif + } + + /* + * Check that TCP offset makes sense, + * pull out TCP options and adjust length. XXX + */ + off = th->th_off << 2; + if (off < sizeof (struct tcphdr) || off > tlen) { + tcpstat.tcps_rcvbadoff++; + goto drop; + } + tlen -= off; /* tlen is used instead of ti->ti_len */ + if (off > sizeof (struct tcphdr)) { +#ifdef INET6 + if (isipv6) { + IP6_EXTHDR_CHECK(m, off0, off, ); + ip6 = mtod(m, struct ip6_hdr *); + th = (struct tcphdr *)((caddr_t)ip6 + off0); + } else +#endif /* INET6 */ + { + if (m->m_len < sizeof(struct ip) + off) { + if ((m = m_pullup(m, sizeof (struct ip) + off)) == 0) { + tcpstat.tcps_rcvshort++; + return; + } + ip = mtod(m, struct ip *); + ipov = (struct ipovly *)ip; + th = (struct tcphdr *)((caddr_t)ip + off0); + } + } + optlen = off - sizeof (struct tcphdr); + optp = (u_char *)(th + 1); + } + thflags = th->th_flags; + +#ifdef TCP_DROP_SYNFIN + /* + * If the drop_synfin option is enabled, drop all packets with + * both the SYN and FIN bits set. This prevents e.g. nmap from + * identifying the TCP/IP stack. + * + * This is incompatible with RFC1644 extensions (T/TCP). + */ + if (drop_synfin && (thflags & (TH_SYN|TH_FIN)) == (TH_SYN|TH_FIN)) + goto drop; +#endif + + /* + * Convert TCP protocol specific fields to host format. + */ + NTOHL(th->th_seq); + NTOHL(th->th_ack); + NTOHS(th->th_win); + NTOHS(th->th_urp); + + /* + * Delay droping TCP, IP headers, IPv6 ext headers, and TCP options, + * until after ip6_savecontrol() is called and before other functions + * which don't want those proto headers. + * Because ip6_savecontrol() is going to parse the mbuf to + * search for data to be passed up to user-land, it wants mbuf + * parameters to be unchanged. + */ + drop_hdrlen = off0 + off; + + /* + * Locate pcb for segment. + */ +findpcb: +#ifdef IPFIREWALL_FORWARD + if (ip_fw_fwd_addr != NULL +#ifdef INET6 + && isipv6 == NULL /* IPv6 support is not yet */ +#endif /* INET6 */ + ) { + /* + * Diverted. Pretend to be the destination. + * already got one like this? + */ + inp = in_pcblookup_hash(&tcbinfo, ip->ip_src, th->th_sport, + ip->ip_dst, th->th_dport, 0, m->m_pkthdr.rcvif); + if (!inp) { + /* + * No, then it's new. Try find the ambushing socket + */ + if (!ip_fw_fwd_addr->sin_port) { + inp = in_pcblookup_hash(&tcbinfo, ip->ip_src, + th->th_sport, ip_fw_fwd_addr->sin_addr, + th->th_dport, 1, m->m_pkthdr.rcvif); + } else { + inp = in_pcblookup_hash(&tcbinfo, + ip->ip_src, th->th_sport, + ip_fw_fwd_addr->sin_addr, + ntohs(ip_fw_fwd_addr->sin_port), 1, + m->m_pkthdr.rcvif); + } + } + ip_fw_fwd_addr = NULL; + } else +#endif /* IPFIREWALL_FORWARD */ + { +#ifdef INET6 + if (isipv6) + inp = in6_pcblookup_hash(&tcbinfo, &ip6->ip6_src, th->th_sport, + &ip6->ip6_dst, th->th_dport, 1, + m->m_pkthdr.rcvif); + else +#endif /* INET6 */ + inp = in_pcblookup_hash(&tcbinfo, ip->ip_src, th->th_sport, + ip->ip_dst, th->th_dport, 1, m->m_pkthdr.rcvif); + } + +#ifdef IPSEC +#ifdef INET6 + if (isipv6) { + if (inp != NULL && ipsec6_in_reject_so(m, inp->inp_socket)) { + ipsec6stat.in_polvio++; + goto drop; + } + } else +#endif /* INET6 */ + if (inp != NULL && ipsec4_in_reject_so(m, inp->inp_socket)) { + ipsecstat.in_polvio++; + goto drop; + } +#endif /*IPSEC*/ + + /* + * If the state is CLOSED (i.e., TCB does not exist) then + * all data in the incoming segment is discarded. + * If the TCB exists but is in CLOSED state, it is embryonic, + * but should either do a listen or a connect soon. + */ + if (inp == NULL) { + if (log_in_vain) { +#ifdef INET6 + char dbuf[INET6_ADDRSTRLEN], sbuf[INET6_ADDRSTRLEN]; +#else /* INET6 */ + char dbuf[4*sizeof "123"], sbuf[4*sizeof "123"]; +#endif /* INET6 */ + +#ifdef INET6 + if (isipv6) { + strcpy(dbuf, ip6_sprintf(&ip6->ip6_dst)); + strcpy(sbuf, ip6_sprintf(&ip6->ip6_src)); + } else +#endif + { + strcpy(dbuf, inet_ntoa(ip->ip_dst)); + strcpy(sbuf, inet_ntoa(ip->ip_src)); + } + switch (log_in_vain) { + case 1: + if(thflags & TH_SYN) + log(LOG_INFO, + "Connection attempt to TCP %s:%d from %s:%d\n", + dbuf, ntohs(th->th_dport), + sbuf, + ntohs(th->th_sport)); + break; + case 2: + log(LOG_INFO, + "Connection attempt to TCP %s:%d from %s:%d flags:0x%x\n", + dbuf, ntohs(th->th_dport), sbuf, + ntohs(th->th_sport), thflags); + break; + default: + break; + } + } + if (blackhole) { + switch (blackhole) { + case 1: + if (thflags & TH_SYN) + goto drop; + break; + case 2: + goto drop; + default: + goto drop; + } + } + rstreason = BANDLIM_RST_CLOSEDPORT; + goto dropwithreset; + } + tp = intotcpcb(inp); + if (tp == 0) { + rstreason = BANDLIM_RST_CLOSEDPORT; + goto dropwithreset; + } + if (tp->t_state == TCPS_CLOSED) + goto drop; + + /* Unscale the window into a 32-bit value. */ + if ((thflags & TH_SYN) == 0) + tiwin = th->th_win << tp->snd_scale; + else + tiwin = th->th_win; + + so = inp->inp_socket; + if (so->so_options & (SO_DEBUG|SO_ACCEPTCONN)) { +#ifdef TCPDEBUG + if (so->so_options & SO_DEBUG) { + ostate = tp->t_state; +#ifdef INET6 + if (isipv6) + bcopy((char *)ip6, (char *)tcp_saveipgen, + sizeof(*ip6)); + else +#endif /* INET6 */ + bcopy((char *)ip, (char *)tcp_saveipgen, sizeof(*ip)); + tcp_savetcp = *th; + } +#endif + if (so->so_options & SO_ACCEPTCONN) { + register struct tcpcb *tp0 = tp; + struct socket *so2; +#ifdef IPSEC + struct socket *oso; +#endif +#ifdef INET6 + struct inpcb *oinp = sotoinpcb(so); +#endif /* INET6 */ + +#ifndef IPSEC + /* + * Current IPsec implementation makes incorrect IPsec + * cache if this check is done here. + * So delay this until duplicated socket is created. + */ + if ((thflags & (TH_RST|TH_ACK|TH_SYN)) != TH_SYN) { + /* + * Note: dropwithreset makes sure we don't + * send a RST in response to a RST. + */ + if (thflags & TH_ACK) { + tcpstat.tcps_badsyn++; + rstreason = BANDLIM_RST_OPENPORT; + goto dropwithreset; + } + goto drop; + } +#endif + +#ifdef INET6 + /* + * If deprecated address is forbidden, + * we do not accept SYN to deprecated interface + * address to prevent any new inbound connection from + * getting established. + * When we do not accept SYN, we send a TCP RST, + * with deprecated source address (instead of dropping + * it). We compromise it as it is much better for peer + * to send a RST, and RST will be the final packet + * for the exchange. + * + * If we do not forbid deprecated addresses, we accept + * the SYN packet. RFC2462 does not suggest dropping + * SYN in this case. + * If we decipher RFC2462 5.5.4, it says like this: + * 1. use of deprecated addr with existing + * communication is okay - "SHOULD continue to be + * used" + * 2. use of it with new communication: + * (2a) "SHOULD NOT be used if alternate address + * with sufficient scope is available" + * (2b) nothing mentioned otherwise. + * Here we fall into (2b) case as we have no choice in + * our source address selection - we must obey the peer. + * + * The wording in RFC2462 is confusing, and there are + * multiple description text for deprecated address + * handling - worse, they are not exactly the same. + * I believe 5.5.4 is the best one, so we follow 5.5.4. + */ + if (isipv6 && !ip6_use_deprecated) { + struct in6_ifaddr *ia6; + + if ((ia6 = ip6_getdstifaddr(m)) && + (ia6->ia6_flags & IN6_IFF_DEPRECATED)) { + tp = NULL; + rstreason = BANDLIM_RST_OPENPORT; + goto dropwithreset; + } + } +#endif + + so2 = sonewconn(so, 0); + if (so2 == 0) { + tcpstat.tcps_listendrop++; + so2 = sodropablereq(so); + if (so2) { + if (tcp_lq_overflow) + sototcpcb(so2)->t_flags |= + TF_LQ_OVERFLOW; + tcp_drop(sototcpcb(so2), ETIMEDOUT); + so2 = sonewconn(so, 0); + } + if (!so2) + goto drop; + } +#ifdef IPSEC + oso = so; +#endif + so = so2; + /* + * This is ugly, but .... + * + * Mark socket as temporary until we're + * committed to keeping it. The code at + * ``drop'' and ``dropwithreset'' check the + * flag dropsocket to see if the temporary + * socket created here should be discarded. + * We mark the socket as discardable until + * we're committed to it below in TCPS_LISTEN. + */ + dropsocket++; + inp = (struct inpcb *)so->so_pcb; +#ifdef INET6 + if (isipv6) + inp->in6p_laddr = ip6->ip6_dst; + else { + inp->inp_vflag &= ~INP_IPV6; + inp->inp_vflag |= INP_IPV4; +#endif /* INET6 */ + inp->inp_laddr = ip->ip_dst; +#ifdef INET6 + } +#endif /* INET6 */ + inp->inp_lport = th->th_dport; + if (in_pcbinshash(inp) != 0) { + /* + * Undo the assignments above if we failed to + * put the PCB on the hash lists. + */ +#ifdef INET6 + if (isipv6) + inp->in6p_laddr = in6addr_any; + else +#endif /* INET6 */ + inp->inp_laddr.s_addr = INADDR_ANY; + inp->inp_lport = 0; + goto drop; + } +#ifdef IPSEC + /* + * To avoid creating incorrectly cached IPsec + * association, this is need to be done here. + * + * Subject: (KAME-snap 748) + * From: Wayne Knowles + * ftp://ftp.kame.net/pub/mail-list/snap-users/748 + */ + if ((thflags & (TH_RST|TH_ACK|TH_SYN)) != TH_SYN) { + /* + * Note: dropwithreset makes sure we don't + * send a RST in response to a RST. + */ + if (thflags & TH_ACK) { + tcpstat.tcps_badsyn++; + rstreason = BANDLIM_RST_OPENPORT; + goto dropwithreset; + } + goto drop; + } +#endif +#ifdef INET6 + if (isipv6) { + /* + * Inherit socket options from the listening + * socket. + * Note that in6p_inputopts are not (even + * should not be) copied, since it stores + * previously received options and is used to + * detect if each new option is different than + * the previous one and hence should be passed + * to a user. + * If we copied in6p_inputopts, a user would + * not be able to receive options just after + * calling the accept system call. + */ + inp->inp_flags |= + oinp->inp_flags & INP_CONTROLOPTS; + if (oinp->in6p_outputopts) + inp->in6p_outputopts = + ip6_copypktopts(oinp->in6p_outputopts, + M_NOWAIT); + } else +#endif /* INET6 */ + inp->inp_options = ip_srcroute(); +#ifdef IPSEC + /* copy old policy into new socket's */ + if (ipsec_copy_policy(sotoinpcb(oso)->inp_sp, + inp->inp_sp)) + printf("tcp_input: could not copy policy\n"); +#endif + tp = intotcpcb(inp); + tp->t_state = TCPS_LISTEN; + tp->t_flags |= tp0->t_flags & (TF_NOPUSH|TF_NOOPT); + + /* Compute proper scaling value from buffer space */ + while (tp->request_r_scale < TCP_MAX_WINSHIFT && + TCP_MAXWIN << tp->request_r_scale < + so->so_rcv.sb_hiwat) + tp->request_r_scale++; + } + } + +#ifdef INET6 + /* save packet options if user wanted */ + if (isipv6 && (inp->in6p_flags & INP_CONTROLOPTS) != 0) { + struct ip6_recvpktopts opts6; + + /* + * Temporarily re-adjusting the mbuf before ip6_savecontrol(), + * which is necessary for FreeBSD only due to difference from + * other BSD stacks. + * XXX: we'll soon make a more natural fix after getting a + * consensus. + */ + ip6_savecontrol(inp, ip6, m, &opts6, &inp->in6p_inputopts); + if (inp->in6p_inputopts) + ip6_update_recvpcbopt(inp->in6p_inputopts, &opts6); + if (opts6.head) { + if (sbappendcontrol(&inp->in6p_socket->so_rcv, + NULL, opts6.head) + == 0) + m_freem(opts6.head); + } + } +#endif /* INET6 */ + + /* + * Segment received on connection. + * Reset idle time and keep-alive timer. + */ + tp->t_rcvtime = ticks; + if (TCPS_HAVEESTABLISHED(tp->t_state)) + callout_reset(tp->tt_keep, tcp_keepidle, tcp_timer_keep, tp); + + /* + * Process options if not in LISTEN state, + * else do it below (after getting remote address). + */ + if (tp->t_state != TCPS_LISTEN) + tcp_dooptions(tp, optp, optlen, th, &to); + + /* + * Header prediction: check for the two common cases + * of a uni-directional data xfer. If the packet has + * no control flags, is in-sequence, the window didn't + * change and we're not retransmitting, it's a + * candidate. If the length is zero and the ack moved + * forward, we're the sender side of the xfer. Just + * free the data acked & wake any higher level process + * that was blocked waiting for space. If the length + * is non-zero and the ack didn't move, we're the + * receiver side. If we're getting packets in-order + * (the reassembly queue is empty), add the data to + * the socket buffer and note that we need a delayed ack. + * Make sure that the hidden state-flags are also off. + * Since we check for TCPS_ESTABLISHED above, it can only + * be TH_NEEDSYN. + */ + if (tp->t_state == TCPS_ESTABLISHED && + (thflags & (TH_SYN|TH_FIN|TH_RST|TH_URG|TH_ACK)) == TH_ACK && + ((tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN)) == 0) && + ((to.to_flag & TOF_TS) == 0 || + TSTMP_GEQ(to.to_tsval, tp->ts_recent)) && + /* + * Using the CC option is compulsory if once started: + * the segment is OK if no T/TCP was negotiated or + * if the segment has a CC option equal to CCrecv + */ + ((tp->t_flags & (TF_REQ_CC|TF_RCVD_CC)) != (TF_REQ_CC|TF_RCVD_CC) || + ((to.to_flag & TOF_CC) != 0 && to.to_cc == tp->cc_recv)) && + th->th_seq == tp->rcv_nxt && + tiwin && tiwin == tp->snd_wnd && + tp->snd_nxt == tp->snd_max) { + + /* + * If last ACK falls within this segment's sequence numbers, + * record the timestamp. + * NOTE that the test is modified according to the latest + * proposal of the tcplw@cray.com list (Braden 1993/04/26). + */ + if ((to.to_flag & TOF_TS) != 0 && + SEQ_LEQ(th->th_seq, tp->last_ack_sent)) { + tp->ts_recent_age = ticks; + tp->ts_recent = to.to_tsval; + } + + if (tlen == 0) { + if (SEQ_GT(th->th_ack, tp->snd_una) && + SEQ_LEQ(th->th_ack, tp->snd_max) && + tp->snd_cwnd >= tp->snd_wnd && + tp->t_dupacks < tcprexmtthresh) { + /* + * this is a pure ack for outstanding data. + */ + ++tcpstat.tcps_predack; + /* + * "bad retransmit" recovery + */ + if (tp->t_rxtshift == 1 && + ticks < tp->t_badrxtwin) { + tp->snd_cwnd = tp->snd_cwnd_prev; + tp->snd_ssthresh = + tp->snd_ssthresh_prev; + tp->snd_nxt = tp->snd_max; + tp->t_badrxtwin = 0; + } + if ((to.to_flag & TOF_TS) != 0) + tcp_xmit_timer(tp, + ticks - to.to_tsecr + 1); + else if (tp->t_rtttime && + SEQ_GT(th->th_ack, tp->t_rtseq)) + tcp_xmit_timer(tp, ticks - tp->t_rtttime); + acked = th->th_ack - tp->snd_una; + tcpstat.tcps_rcvackpack++; + tcpstat.tcps_rcvackbyte += acked; + sbdrop(&so->so_snd, acked); + tp->snd_una = th->th_ack; + m_freem(m); + ND6_HINT(tp); /* some progress has been done */ + + /* + * If all outstanding data are acked, stop + * retransmit timer, otherwise restart timer + * using current (possibly backed-off) value. + * If process is waiting for space, + * wakeup/selwakeup/signal. If data + * are ready to send, let tcp_output + * decide between more output or persist. + */ + if (tp->snd_una == tp->snd_max) + callout_stop(tp->tt_rexmt); + else if (!callout_active(tp->tt_persist)) + callout_reset(tp->tt_rexmt, + tp->t_rxtcur, + tcp_timer_rexmt, tp); + + sowwakeup(so); + if (so->so_snd.sb_cc) + (void) tcp_output(tp); + return; + } + } else if (th->th_ack == tp->snd_una && + LIST_EMPTY(&tp->t_segq) && + tlen <= sbspace(&so->so_rcv)) { + /* + * this is a pure, in-sequence data packet + * with nothing on the reassembly queue and + * we have enough buffer space to take it. + */ + ++tcpstat.tcps_preddat; + tp->rcv_nxt += tlen; + tcpstat.tcps_rcvpack++; + tcpstat.tcps_rcvbyte += tlen; + ND6_HINT(tp); /* some progress has been done */ + /* + * Add data to socket buffer. + */ + m_adj(m, drop_hdrlen); /* delayed header drop */ + sbappend(&so->so_rcv, m); + sorwakeup(so); + if (DELAY_ACK(tp)) { + callout_reset(tp->tt_delack, tcp_delacktime, + tcp_timer_delack, tp); + } else { + tp->t_flags |= TF_ACKNOW; + tcp_output(tp); + } + return; + } + } + + /* + * Calculate amount of space in receive window, + * and then do TCP input processing. + * Receive window is amount of space in rcv queue, + * but not less than advertised window. + */ + { int win; + + win = sbspace(&so->so_rcv); + if (win < 0) + win = 0; + tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt)); + } + + switch (tp->t_state) { + + /* + * If the state is LISTEN then ignore segment if it contains an RST. + * If the segment contains an ACK then it is bad and send a RST. + * If it does not contain a SYN then it is not interesting; drop it. + * If it is from this socket, drop it, it must be forged. + * Don't bother responding if the destination was a broadcast. + * Otherwise initialize tp->rcv_nxt, and tp->irs, select an initial + * tp->iss, and send a segment: + * + * Also initialize tp->snd_nxt to tp->iss+1 and tp->snd_una to tp->iss. + * Fill in remote peer address fields if not previously specified. + * Enter SYN_RECEIVED state, and process any other fields of this + * segment in this state. + */ + case TCPS_LISTEN: { + register struct sockaddr_in *sin; +#ifdef INET6 + register struct sockaddr_in6 *sin6; +#endif + + if (thflags & TH_RST) + goto drop; + if (thflags & TH_ACK) { + rstreason = BANDLIM_RST_OPENPORT; + goto dropwithreset; + } + if ((thflags & TH_SYN) == 0) + goto drop; + if (th->th_dport == th->th_sport) { +#ifdef INET6 + if (isipv6) { + if (IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, + &ip6->ip6_src)) + goto drop; + } else +#endif /* INET6 */ + if (ip->ip_dst.s_addr == ip->ip_src.s_addr) + goto drop; + } + /* + * RFC1122 4.2.3.10, p. 104: discard bcast/mcast SYN + * in_broadcast() should never return true on a received + * packet with M_BCAST not set. + * + * Packets with a multicast source address should also + * be discarded. + */ + if (m->m_flags & (M_BCAST|M_MCAST)) + goto drop; +#ifdef INET6 + if (isipv6) { + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || + IN6_IS_ADDR_MULTICAST(&ip6->ip6_src)) + goto drop; + } else +#endif + if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) || + IN_MULTICAST(ntohl(ip->ip_src.s_addr)) || + ip->ip_src.s_addr == htonl(INADDR_BROADCAST)) + goto drop; +#ifdef INET6 + if (isipv6) { + MALLOC(sin6, struct sockaddr_in6 *, sizeof *sin6, + M_SONAME, M_NOWAIT); + if (sin6 == NULL) + goto drop; + bzero(sin6, sizeof(*sin6)); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_addr = ip6->ip6_src; + sin6->sin6_port = th->th_sport; + laddr6 = inp->in6p_laddr; + if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) + inp->in6p_laddr = ip6->ip6_dst; + if (in6_pcbconnect(inp, (struct sockaddr *)sin6, + (struct proc *)&proc0)) { + inp->in6p_laddr = laddr6; + FREE(sin6, M_SONAME); + goto drop; + } + FREE(sin6, M_SONAME); + } else +#endif + { + MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, + M_NOWAIT); + if (sin == NULL) + goto drop; + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_addr = ip->ip_src; + sin->sin_port = th->th_sport; + bzero((caddr_t)sin->sin_zero, sizeof(sin->sin_zero)); + laddr = inp->inp_laddr; + if (inp->inp_laddr.s_addr == INADDR_ANY) + inp->inp_laddr = ip->ip_dst; + if (in_pcbconnect(inp, (struct sockaddr *)sin, (struct proc *)&proc0)) { + inp->inp_laddr = laddr; + FREE(sin, M_SONAME); + goto drop; + } + FREE(sin, M_SONAME); + } + if ((taop = tcp_gettaocache(inp)) == NULL) { + taop = &tao_noncached; + bzero(taop, sizeof(*taop)); + } + tcp_dooptions(tp, optp, optlen, th, &to); + if (iss) + tp->iss = iss; + else { + tp->iss = tcp_new_isn(tp); + } + tp->irs = th->th_seq; + tcp_sendseqinit(tp); + tcp_rcvseqinit(tp); + tp->snd_recover = tp->snd_una; + /* + * Initialization of the tcpcb for transaction; + * set SND.WND = SEG.WND, + * initialize CCsend and CCrecv. + */ + tp->snd_wnd = tiwin; /* initial send-window */ + tp->cc_send = CC_INC(tcp_ccgen); + tp->cc_recv = to.to_cc; + /* + * Perform TAO test on incoming CC (SEG.CC) option, if any. + * - compare SEG.CC against cached CC from the same host, + * if any. + * - if SEG.CC > chached value, SYN must be new and is accepted + * immediately: save new CC in the cache, mark the socket + * connected, enter ESTABLISHED state, turn on flag to + * send a SYN in the next segment. + * A virtual advertised window is set in rcv_adv to + * initialize SWS prevention. Then enter normal segment + * processing: drop SYN, process data and FIN. + * - otherwise do a normal 3-way handshake. + */ + if ((to.to_flag & TOF_CC) != 0) { + if (((tp->t_flags & TF_NOPUSH) != 0) && + taop->tao_cc != 0 && CC_GT(to.to_cc, taop->tao_cc)) { + + taop->tao_cc = to.to_cc; + tp->t_starttime = ticks; + tp->t_state = TCPS_ESTABLISHED; + + /* + * If there is a FIN, or if there is data and the + * connection is local, then delay SYN,ACK(SYN) in + * the hope of piggy-backing it on a response + * segment. Otherwise must send ACK now in case + * the other side is slow starting. + */ + if (DELAY_ACK(tp) && ((thflags & TH_FIN) || + (tlen != 0 && +#ifdef INET6 + ((isipv6 && in6_localaddr(&inp->in6p_faddr)) + || + (!isipv6 && +#endif + in_localaddr(inp->inp_faddr) +#ifdef INET6 + )) +#endif + ))) { + callout_reset(tp->tt_delack, tcp_delacktime, + tcp_timer_delack, tp); + tp->t_flags |= TF_NEEDSYN; + } else + tp->t_flags |= (TF_ACKNOW | TF_NEEDSYN); + + /* + * Limit the `virtual advertised window' to TCP_MAXWIN + * here. Even if we requested window scaling, it will + * become effective only later when our SYN is acked. + */ + tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN); + tcpstat.tcps_connects++; + soisconnected(so); + callout_reset(tp->tt_keep, tcp_keepinit, + tcp_timer_keep, tp); + dropsocket = 0; /* committed to socket */ + tcpstat.tcps_accepts++; + goto trimthenstep6; + } + /* else do standard 3-way handshake */ + } else { + /* + * No CC option, but maybe CC.NEW: + * invalidate cached value. + */ + taop->tao_cc = 0; + } + /* + * TAO test failed or there was no CC option, + * do a standard 3-way handshake. + */ + tp->t_flags |= TF_ACKNOW; + tp->t_state = TCPS_SYN_RECEIVED; + callout_reset(tp->tt_keep, tcp_keepinit, tcp_timer_keep, tp); + dropsocket = 0; /* committed to socket */ + tcpstat.tcps_accepts++; + goto trimthenstep6; + } + + /* + * If the state is SYN_RECEIVED: + * if seg contains an ACK, but not for our SYN/ACK, send a RST. + */ + case TCPS_SYN_RECEIVED: + if ((thflags & TH_ACK) && + (SEQ_LEQ(th->th_ack, tp->snd_una) || + SEQ_GT(th->th_ack, tp->snd_max))) { + rstreason = BANDLIM_RST_OPENPORT; + goto dropwithreset; + } + break; + + /* + * If the state is SYN_SENT: + * if seg contains an ACK, but not for our SYN, drop the input. + * if seg contains a RST, then drop the connection. + * if seg does not contain SYN, then drop it. + * Otherwise this is an acceptable SYN segment + * initialize tp->rcv_nxt and tp->irs + * if seg contains ack then advance tp->snd_una + * if SYN has been acked change to ESTABLISHED else SYN_RCVD state + * arrange for segment to be acked (eventually) + * continue processing rest of data/controls, beginning with URG + */ + case TCPS_SYN_SENT: + if ((taop = tcp_gettaocache(inp)) == NULL) { + taop = &tao_noncached; + bzero(taop, sizeof(*taop)); + } + + if ((thflags & TH_ACK) && + (SEQ_LEQ(th->th_ack, tp->iss) || + SEQ_GT(th->th_ack, tp->snd_max))) { + /* + * If we have a cached CCsent for the remote host, + * hence we haven't just crashed and restarted, + * do not send a RST. This may be a retransmission + * from the other side after our earlier ACK was lost. + * Our new SYN, when it arrives, will serve as the + * needed ACK. + */ + if (taop->tao_ccsent != 0) + goto drop; + else { + rstreason = BANDLIM_UNLIMITED; + goto dropwithreset; + } + } + if (thflags & TH_RST) { + if (thflags & TH_ACK) + tp = tcp_drop(tp, ECONNREFUSED); + goto drop; + } + if ((thflags & TH_SYN) == 0) + goto drop; + tp->snd_wnd = th->th_win; /* initial send window */ + tp->cc_recv = to.to_cc; /* foreign CC */ + + tp->irs = th->th_seq; + tcp_rcvseqinit(tp); + if (thflags & TH_ACK) { + /* + * Our SYN was acked. If segment contains CC.ECHO + * option, check it to make sure this segment really + * matches our SYN. If not, just drop it as old + * duplicate, but send an RST if we're still playing + * by the old rules. If no CC.ECHO option, make sure + * we don't get fooled into using T/TCP. + */ + if (to.to_flag & TOF_CCECHO) { + if (tp->cc_send != to.to_ccecho) { + if (taop->tao_ccsent != 0) + goto drop; + else { + rstreason = BANDLIM_UNLIMITED; + goto dropwithreset; + } + } + } else + tp->t_flags &= ~TF_RCVD_CC; + tcpstat.tcps_connects++; + soisconnected(so); + /* Do window scaling on this connection? */ + if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == + (TF_RCVD_SCALE|TF_REQ_SCALE)) { + tp->snd_scale = tp->requested_s_scale; + tp->rcv_scale = tp->request_r_scale; + } + /* Segment is acceptable, update cache if undefined. */ + if (taop->tao_ccsent == 0) + taop->tao_ccsent = to.to_ccecho; + + tp->rcv_adv += tp->rcv_wnd; + tp->snd_una++; /* SYN is acked */ + /* + * If there's data, delay ACK; if there's also a FIN + * ACKNOW will be turned on later. + */ + if (DELAY_ACK(tp) && tlen != 0) + callout_reset(tp->tt_delack, tcp_delacktime, + tcp_timer_delack, tp); + else + tp->t_flags |= TF_ACKNOW; + /* + * Received in SYN_SENT[*] state. + * Transitions: + * SYN_SENT --> ESTABLISHED + * SYN_SENT* --> FIN_WAIT_1 + */ + tp->t_starttime = ticks; + if (tp->t_flags & TF_NEEDFIN) { + tp->t_state = TCPS_FIN_WAIT_1; + tp->t_flags &= ~TF_NEEDFIN; + thflags &= ~TH_SYN; + } else { + tp->t_state = TCPS_ESTABLISHED; + callout_reset(tp->tt_keep, tcp_keepidle, + tcp_timer_keep, tp); + } + } else { + /* + * Received initial SYN in SYN-SENT[*] state => simul- + * taneous open. If segment contains CC option and there is + * a cached CC, apply TAO test; if it succeeds, connection is + * half-synchronized. Otherwise, do 3-way handshake: + * SYN-SENT -> SYN-RECEIVED + * SYN-SENT* -> SYN-RECEIVED* + * If there was no CC option, clear cached CC value. + */ + tp->t_flags |= TF_ACKNOW; + callout_stop(tp->tt_rexmt); + if (to.to_flag & TOF_CC) { + if (taop->tao_cc != 0 && + CC_GT(to.to_cc, taop->tao_cc)) { + /* + * update cache and make transition: + * SYN-SENT -> ESTABLISHED* + * SYN-SENT* -> FIN-WAIT-1* + */ + taop->tao_cc = to.to_cc; + tp->t_starttime = ticks; + if (tp->t_flags & TF_NEEDFIN) { + tp->t_state = TCPS_FIN_WAIT_1; + tp->t_flags &= ~TF_NEEDFIN; + } else { + tp->t_state = TCPS_ESTABLISHED; + callout_reset(tp->tt_keep, + tcp_keepidle, + tcp_timer_keep, + tp); + } + tp->t_flags |= TF_NEEDSYN; + } else + tp->t_state = TCPS_SYN_RECEIVED; + } else { + /* CC.NEW or no option => invalidate cache */ + taop->tao_cc = 0; + tp->t_state = TCPS_SYN_RECEIVED; + } + } + +trimthenstep6: + /* + * Advance th->th_seq to correspond to first data byte. + * If data, trim to stay within window, + * dropping FIN if necessary. + */ + th->th_seq++; + if (tlen > tp->rcv_wnd) { + todrop = tlen - tp->rcv_wnd; + m_adj(m, -todrop); + tlen = tp->rcv_wnd; + thflags &= ~TH_FIN; + tcpstat.tcps_rcvpackafterwin++; + tcpstat.tcps_rcvbyteafterwin += todrop; + } + tp->snd_wl1 = th->th_seq - 1; + tp->rcv_up = th->th_seq; + /* + * Client side of transaction: already sent SYN and data. + * If the remote host used T/TCP to validate the SYN, + * our data will be ACK'd; if so, enter normal data segment + * processing in the middle of step 5, ack processing. + * Otherwise, goto step 6. + */ + if (thflags & TH_ACK) + goto process_ACK; + goto step6; + /* + * If the state is LAST_ACK or CLOSING or TIME_WAIT: + * if segment contains a SYN and CC [not CC.NEW] option: + * if state == TIME_WAIT and connection duration > MSL, + * drop packet and send RST; + * + * if SEG.CC > CCrecv then is new SYN, and can implicitly + * ack the FIN (and data) in retransmission queue. + * Complete close and delete TCPCB. Then reprocess + * segment, hoping to find new TCPCB in LISTEN state; + * + * else must be old SYN; drop it. + * else do normal processing. + */ + case TCPS_LAST_ACK: + case TCPS_CLOSING: + case TCPS_TIME_WAIT: + if ((thflags & TH_SYN) && + (to.to_flag & TOF_CC) && tp->cc_recv != 0) { + if (tp->t_state == TCPS_TIME_WAIT && + (ticks - tp->t_starttime) > tcp_msl) { + rstreason = BANDLIM_UNLIMITED; + goto dropwithreset; + } + if (CC_GT(to.to_cc, tp->cc_recv)) { + tp = tcp_close(tp); + goto findpcb; + } + else + goto drop; + } + break; /* continue normal processing */ + } + + /* + * States other than LISTEN or SYN_SENT. + * First check the RST flag and sequence number since reset segments + * are exempt from the timestamp and connection count tests. This + * fixes a bug introduced by the Stevens, vol. 2, p. 960 bugfix + * below which allowed reset segments in half the sequence space + * to fall though and be processed (which gives forged reset + * segments with a random sequence number a 50 percent chance of + * killing a connection). + * Then check timestamp, if present. + * Then check the connection count, if present. + * Then check that at least some bytes of segment are within + * receive window. If segment begins before rcv_nxt, + * drop leading data (and SYN); if nothing left, just ack. + * + * + * If the RST bit is set, check the sequence number to see + * if this is a valid reset segment. + * RFC 793 page 37: + * In all states except SYN-SENT, all reset (RST) segments + * are validated by checking their SEQ-fields. A reset is + * valid if its sequence number is in the window. + * Note: this does not take into account delayed ACKs, so + * we should test against last_ack_sent instead of rcv_nxt. + * The sequence number in the reset segment is normally an + * echo of our outgoing acknowlegement numbers, but some hosts + * send a reset with the sequence number at the rightmost edge + * of our receive window, and we have to handle this case. + * If we have multiple segments in flight, the intial reset + * segment sequence numbers will be to the left of last_ack_sent, + * but they will eventually catch up. + * In any case, it never made sense to trim reset segments to + * fit the receive window since RFC 1122 says: + * 4.2.2.12 RST Segment: RFC-793 Section 3.4 + * + * A TCP SHOULD allow a received RST segment to include data. + * + * DISCUSSION + * It has been suggested that a RST segment could contain + * ASCII text that encoded and explained the cause of the + * RST. No standard has yet been established for such + * data. + * + * If the reset segment passes the sequence number test examine + * the state: + * SYN_RECEIVED STATE: + * If passive open, return to LISTEN state. + * If active open, inform user that connection was refused. + * ESTABLISHED, FIN_WAIT_1, FIN_WAIT2, CLOSE_WAIT STATES: + * Inform user that connection was reset, and close tcb. + * CLOSING, LAST_ACK STATES: + * Close the tcb. + * TIME_WAIT STATE: + * Drop the segment - see Stevens, vol. 2, p. 964 and + * RFC 1337. + */ + if (thflags & TH_RST) { + if (SEQ_GEQ(th->th_seq, tp->last_ack_sent) && + SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) { + switch (tp->t_state) { + + case TCPS_SYN_RECEIVED: + so->so_error = ECONNREFUSED; + goto close; + + case TCPS_ESTABLISHED: + case TCPS_FIN_WAIT_1: + case TCPS_FIN_WAIT_2: + case TCPS_CLOSE_WAIT: + so->so_error = ECONNRESET; + close: + tp->t_state = TCPS_CLOSED; + tcpstat.tcps_drops++; + tp = tcp_close(tp); + break; + + case TCPS_CLOSING: + case TCPS_LAST_ACK: + tp = tcp_close(tp); + break; + + case TCPS_TIME_WAIT: + break; + } + } + goto drop; + } + + /* + * RFC 1323 PAWS: If we have a timestamp reply on this segment + * and it's less than ts_recent, drop it. + */ + if ((to.to_flag & TOF_TS) != 0 && tp->ts_recent && + TSTMP_LT(to.to_tsval, tp->ts_recent)) { + + /* Check to see if ts_recent is over 24 days old. */ + if ((int)(ticks - tp->ts_recent_age) > TCP_PAWS_IDLE) { + /* + * Invalidate ts_recent. If this segment updates + * ts_recent, the age will be reset later and ts_recent + * will get a valid value. If it does not, setting + * ts_recent to zero will at least satisfy the + * requirement that zero be placed in the timestamp + * echo reply when ts_recent isn't valid. The + * age isn't reset until we get a valid ts_recent + * because we don't want out-of-order segments to be + * dropped when ts_recent is old. + */ + tp->ts_recent = 0; + } else { + tcpstat.tcps_rcvduppack++; + tcpstat.tcps_rcvdupbyte += tlen; + tcpstat.tcps_pawsdrop++; + goto dropafterack; + } + } + + /* + * T/TCP mechanism + * If T/TCP was negotiated and the segment doesn't have CC, + * or if its CC is wrong then drop the segment. + * RST segments do not have to comply with this. + */ + if ((tp->t_flags & (TF_REQ_CC|TF_RCVD_CC)) == (TF_REQ_CC|TF_RCVD_CC) && + ((to.to_flag & TOF_CC) == 0 || tp->cc_recv != to.to_cc)) + goto dropafterack; + + /* + * In the SYN-RECEIVED state, validate that the packet belongs to + * this connection before trimming the data to fit the receive + * window. Check the sequence number versus IRS since we know + * the sequence numbers haven't wrapped. This is a partial fix + * for the "LAND" DoS attack. + */ + if (tp->t_state == TCPS_SYN_RECEIVED && SEQ_LT(th->th_seq, tp->irs)) { + rstreason = BANDLIM_UNLIMITED; + goto dropwithreset; + } + + todrop = tp->rcv_nxt - th->th_seq; + if (todrop > 0) { + if (thflags & TH_SYN) { + thflags &= ~TH_SYN; + th->th_seq++; + if (th->th_urp > 1) + th->th_urp--; + else + thflags &= ~TH_URG; + todrop--; + } + /* + * Following if statement from Stevens, vol. 2, p. 960. + */ + if (todrop > tlen + || (todrop == tlen && (thflags & TH_FIN) == 0)) { + /* + * Any valid FIN must be to the left of the window. + * At this point the FIN must be a duplicate or out + * of sequence; drop it. + */ + thflags &= ~TH_FIN; + + /* + * Send an ACK to resynchronize and drop any data. + * But keep on processing for RST or ACK. + */ + tp->t_flags |= TF_ACKNOW; + todrop = tlen; + tcpstat.tcps_rcvduppack++; + tcpstat.tcps_rcvdupbyte += todrop; + } else { + tcpstat.tcps_rcvpartduppack++; + tcpstat.tcps_rcvpartdupbyte += todrop; + } + drop_hdrlen += todrop; /* drop from the top afterwards */ + th->th_seq += todrop; + tlen -= todrop; + if (th->th_urp > todrop) + th->th_urp -= todrop; + else { + thflags &= ~TH_URG; + th->th_urp = 0; + } + } + + /* + * If new data are received on a connection after the + * user processes are gone, then RST the other end. + */ + if ((so->so_state & SS_NOFDREF) && + tp->t_state > TCPS_CLOSE_WAIT && tlen) { + tp = tcp_close(tp); + tcpstat.tcps_rcvafterclose++; + rstreason = BANDLIM_UNLIMITED; + goto dropwithreset; + } + + /* + * If segment ends after window, drop trailing data + * (and PUSH and FIN); if nothing left, just ACK. + */ + todrop = (th->th_seq+tlen) - (tp->rcv_nxt+tp->rcv_wnd); + if (todrop > 0) { + tcpstat.tcps_rcvpackafterwin++; + if (todrop >= tlen) { + tcpstat.tcps_rcvbyteafterwin += tlen; + /* + * If a new connection request is received + * while in TIME_WAIT, drop the old connection + * and start over if the sequence numbers + * are above the previous ones. + */ + if (thflags & TH_SYN && + tp->t_state == TCPS_TIME_WAIT && + SEQ_GT(th->th_seq, tp->rcv_nxt)) { + iss = tcp_new_isn(tp); + tp = tcp_close(tp); + goto findpcb; + } + /* + * If window is closed can only take segments at + * window edge, and have to drop data and PUSH from + * incoming segments. Continue processing, but + * remember to ack. Otherwise, drop segment + * and ack. + */ + if (tp->rcv_wnd == 0 && th->th_seq == tp->rcv_nxt) { + tp->t_flags |= TF_ACKNOW; + tcpstat.tcps_rcvwinprobe++; + } else + goto dropafterack; + } else + tcpstat.tcps_rcvbyteafterwin += todrop; + m_adj(m, -todrop); + tlen -= todrop; + thflags &= ~(TH_PUSH|TH_FIN); + } + + /* + * If last ACK falls within this segment's sequence numbers, + * record its timestamp. + * NOTE that the test is modified according to the latest + * proposal of the tcplw@cray.com list (Braden 1993/04/26). + */ + if ((to.to_flag & TOF_TS) != 0 && + SEQ_LEQ(th->th_seq, tp->last_ack_sent)) { + tp->ts_recent_age = ticks; + tp->ts_recent = to.to_tsval; + } + + /* + * If a SYN is in the window, then this is an + * error and we send an RST and drop the connection. + */ + if (thflags & TH_SYN) { + tp = tcp_drop(tp, ECONNRESET); + rstreason = BANDLIM_UNLIMITED; + goto dropwithreset; + } + + /* + * If the ACK bit is off: if in SYN-RECEIVED state or SENDSYN + * flag is on (half-synchronized state), then queue data for + * later processing; else drop segment and return. + */ + if ((thflags & TH_ACK) == 0) { + if (tp->t_state == TCPS_SYN_RECEIVED || + (tp->t_flags & TF_NEEDSYN)) + goto step6; + else + goto drop; + } + + /* + * Ack processing. + */ + switch (tp->t_state) { + + /* + * In SYN_RECEIVED state, the ack ACKs our SYN, so enter + * ESTABLISHED state and continue processing. + * The ACK was checked above. + */ + case TCPS_SYN_RECEIVED: + + tcpstat.tcps_connects++; + soisconnected(so); + /* Do window scaling? */ + if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == + (TF_RCVD_SCALE|TF_REQ_SCALE)) { + tp->snd_scale = tp->requested_s_scale; + tp->rcv_scale = tp->request_r_scale; + } + /* + * Upon successful completion of 3-way handshake, + * update cache.CC if it was undefined, pass any queued + * data to the user, and advance state appropriately. + */ + if ((taop = tcp_gettaocache(inp)) != NULL && + taop->tao_cc == 0) + taop->tao_cc = tp->cc_recv; + + /* + * Make transitions: + * SYN-RECEIVED -> ESTABLISHED + * SYN-RECEIVED* -> FIN-WAIT-1 + */ + tp->t_starttime = ticks; + if (tp->t_flags & TF_NEEDFIN) { + tp->t_state = TCPS_FIN_WAIT_1; + tp->t_flags &= ~TF_NEEDFIN; + } else { + tp->t_state = TCPS_ESTABLISHED; + callout_reset(tp->tt_keep, tcp_keepidle, + tcp_timer_keep, tp); + } + /* + * If segment contains data or ACK, will call tcp_reass() + * later; if not, do so now to pass queued data to user. + */ + if (tlen == 0 && (thflags & TH_FIN) == 0) + (void) tcp_reass(tp, (struct tcphdr *)0, 0, + (struct mbuf *)0); + tp->snd_wl1 = th->th_seq - 1; + /* fall into ... */ + + /* + * In ESTABLISHED state: drop duplicate ACKs; ACK out of range + * ACKs. If the ack is in the range + * tp->snd_una < th->th_ack <= tp->snd_max + * then advance tp->snd_una to th->th_ack and drop + * data from the retransmission queue. If this ACK reflects + * more up to date window information we update our window information. + */ + case TCPS_ESTABLISHED: + case TCPS_FIN_WAIT_1: + case TCPS_FIN_WAIT_2: + case TCPS_CLOSE_WAIT: + case TCPS_CLOSING: + case TCPS_LAST_ACK: + case TCPS_TIME_WAIT: + + if (SEQ_LEQ(th->th_ack, tp->snd_una)) { + if (tlen == 0 && tiwin == tp->snd_wnd) { + tcpstat.tcps_rcvdupack++; + /* + * If we have outstanding data (other than + * a window probe), this is a completely + * duplicate ack (ie, window info didn't + * change), the ack is the biggest we've + * seen and we've seen exactly our rexmt + * threshhold of them, assume a packet + * has been dropped and retransmit it. + * Kludge snd_nxt & the congestion + * window so we send only this one + * packet. + * + * We know we're losing at the current + * window size so do congestion avoidance + * (set ssthresh to half the current window + * and pull our congestion window back to + * the new ssthresh). + * + * Dup acks mean that packets have left the + * network (they're now cached at the receiver) + * so bump cwnd by the amount in the receiver + * to keep a constant cwnd packets in the + * network. + */ + if (!callout_active(tp->tt_rexmt) || + th->th_ack != tp->snd_una) + tp->t_dupacks = 0; + else if (++tp->t_dupacks == tcprexmtthresh) { + tcp_seq onxt = tp->snd_nxt; + u_int win = + min(tp->snd_wnd, tp->snd_cwnd) / 2 / + tp->t_maxseg; + if (tcp_do_newreno && SEQ_LT(th->th_ack, + tp->snd_recover)) { + /* False retransmit, should not + * cut window + */ + tp->snd_cwnd += tp->t_maxseg; + tp->t_dupacks = 0; + (void) tcp_output(tp); + goto drop; + } + if (win < 2) + win = 2; + tp->snd_ssthresh = win * tp->t_maxseg; + tp->snd_recover = tp->snd_max; + callout_stop(tp->tt_rexmt); + tp->t_rtttime = 0; + tp->snd_nxt = th->th_ack; + tp->snd_cwnd = tp->t_maxseg; + (void) tcp_output(tp); + tp->snd_cwnd = tp->snd_ssthresh + + tp->t_maxseg * tp->t_dupacks; + if (SEQ_GT(onxt, tp->snd_nxt)) + tp->snd_nxt = onxt; + goto drop; + } else if (tp->t_dupacks > tcprexmtthresh) { + tp->snd_cwnd += tp->t_maxseg; + (void) tcp_output(tp); + goto drop; + } + } else + tp->t_dupacks = 0; + break; + } + /* + * If the congestion window was inflated to account + * for the other side's cached packets, retract it. + */ + if (tcp_do_newreno == 0) { + if (tp->t_dupacks >= tcprexmtthresh && + tp->snd_cwnd > tp->snd_ssthresh) + tp->snd_cwnd = tp->snd_ssthresh; + tp->t_dupacks = 0; + } else if (tp->t_dupacks >= tcprexmtthresh && + !tcp_newreno(tp, th)) { + /* + * Window inflation should have left us with approx. + * snd_ssthresh outstanding data. But in case we + * would be inclined to send a burst, better to do + * it via the slow start mechanism. + */ + if (SEQ_GT(th->th_ack + tp->snd_ssthresh, tp->snd_max)) + tp->snd_cwnd = + tp->snd_max - th->th_ack + tp->t_maxseg; + else + tp->snd_cwnd = tp->snd_ssthresh; + tp->t_dupacks = 0; + } + if (SEQ_GT(th->th_ack, tp->snd_max)) { + tcpstat.tcps_rcvacktoomuch++; + goto dropafterack; + } + /* + * If we reach this point, ACK is not a duplicate, + * i.e., it ACKs something we sent. + */ + if (tp->t_flags & TF_NEEDSYN) { + /* + * T/TCP: Connection was half-synchronized, and our + * SYN has been ACK'd (so connection is now fully + * synchronized). Go to non-starred state, + * increment snd_una for ACK of SYN, and check if + * we can do window scaling. + */ + tp->t_flags &= ~TF_NEEDSYN; + tp->snd_una++; + /* Do window scaling? */ + if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == + (TF_RCVD_SCALE|TF_REQ_SCALE)) { + tp->snd_scale = tp->requested_s_scale; + tp->rcv_scale = tp->request_r_scale; + } + } + +process_ACK: + acked = th->th_ack - tp->snd_una; + tcpstat.tcps_rcvackpack++; + tcpstat.tcps_rcvackbyte += acked; + + /* + * If we just performed our first retransmit, and the ACK + * arrives within our recovery window, then it was a mistake + * to do the retransmit in the first place. Recover our + * original cwnd and ssthresh, and proceed to transmit where + * we left off. + */ + if (tp->t_rxtshift == 1 && ticks < tp->t_badrxtwin) { + tp->snd_cwnd = tp->snd_cwnd_prev; + tp->snd_ssthresh = tp->snd_ssthresh_prev; + tp->snd_nxt = tp->snd_max; + tp->t_badrxtwin = 0; /* XXX probably not required */ + } + + /* + * If we have a timestamp reply, update smoothed + * round trip time. If no timestamp is present but + * transmit timer is running and timed sequence + * number was acked, update smoothed round trip time. + * Since we now have an rtt measurement, cancel the + * timer backoff (cf., Phil Karn's retransmit alg.). + * Recompute the initial retransmit timer. + */ + if (to.to_flag & TOF_TS) + tcp_xmit_timer(tp, ticks - to.to_tsecr + 1); + else if (tp->t_rtttime && SEQ_GT(th->th_ack, tp->t_rtseq)) + tcp_xmit_timer(tp, ticks - tp->t_rtttime); + + /* + * If all outstanding data is acked, stop retransmit + * timer and remember to restart (more output or persist). + * If there is more data to be acked, restart retransmit + * timer, using current (possibly backed-off) value. + */ + if (th->th_ack == tp->snd_max) { + callout_stop(tp->tt_rexmt); + needoutput = 1; + } else if (!callout_active(tp->tt_persist)) + callout_reset(tp->tt_rexmt, tp->t_rxtcur, + tcp_timer_rexmt, tp); + + /* + * If no data (only SYN) was ACK'd, + * skip rest of ACK processing. + */ + if (acked == 0) + goto step6; + + /* + * When new data is acked, open the congestion window. + * If the window gives us less than ssthresh packets + * in flight, open exponentially (maxseg per packet). + * Otherwise open linearly: maxseg per window + * (maxseg^2 / cwnd per packet). + */ + { + register u_int cw = tp->snd_cwnd; + register u_int incr = tp->t_maxseg; + + if (cw > tp->snd_ssthresh) + incr = incr * incr / cw; + /* + * If t_dupacks != 0 here, it indicates that we are still + * in NewReno fast recovery mode, so we leave the congestion + * window alone. + */ + if (tcp_do_newreno == 0 || tp->t_dupacks == 0) + tp->snd_cwnd = min(cw + incr,TCP_MAXWIN<snd_scale); + } + if (acked > so->so_snd.sb_cc) { + tp->snd_wnd -= so->so_snd.sb_cc; + sbdrop(&so->so_snd, (int)so->so_snd.sb_cc); + ourfinisacked = 1; + } else { + sbdrop(&so->so_snd, acked); + tp->snd_wnd -= acked; + ourfinisacked = 0; + } + sowwakeup(so); + tp->snd_una = th->th_ack; + if (SEQ_LT(tp->snd_nxt, tp->snd_una)) + tp->snd_nxt = tp->snd_una; + + switch (tp->t_state) { + + /* + * In FIN_WAIT_1 STATE in addition to the processing + * for the ESTABLISHED state if our FIN is now acknowledged + * then enter FIN_WAIT_2. + */ + case TCPS_FIN_WAIT_1: + if (ourfinisacked) { + /* + * If we can't receive any more + * data, then closing user can proceed. + * Starting the timer is contrary to the + * specification, but if we don't get a FIN + * we'll hang forever. + */ + if (so->so_state & SS_CANTRCVMORE) { + soisdisconnected(so); + callout_reset(tp->tt_2msl, tcp_maxidle, + tcp_timer_2msl, tp); + } + tp->t_state = TCPS_FIN_WAIT_2; + } + break; + + /* + * In CLOSING STATE in addition to the processing for + * the ESTABLISHED state if the ACK acknowledges our FIN + * then enter the TIME-WAIT state, otherwise ignore + * the segment. + */ + case TCPS_CLOSING: + if (ourfinisacked) { + tp->t_state = TCPS_TIME_WAIT; + tcp_canceltimers(tp); + /* Shorten TIME_WAIT [RFC-1644, p.28] */ + if (tp->cc_recv != 0 && + (ticks - tp->t_starttime) < tcp_msl) { + callout_reset(tp->tt_2msl, + tp->t_rxtcur * + TCPTV_TWTRUNC, + tcp_timer_2msl, tp); + } + else { + callout_reset(tp->tt_2msl, 2 * tcp_msl, + tcp_timer_2msl, tp); + } + soisdisconnected(so); + } + break; + + /* + * In LAST_ACK, we may still be waiting for data to drain + * and/or to be acked, as well as for the ack of our FIN. + * If our FIN is now acknowledged, delete the TCB, + * enter the closed state and return. + */ + case TCPS_LAST_ACK: + if (ourfinisacked) { + tp = tcp_close(tp); + goto drop; + } + break; + + /* + * In TIME_WAIT state the only thing that should arrive + * is a retransmission of the remote FIN. Acknowledge + * it and restart the finack timer. + */ + case TCPS_TIME_WAIT: + callout_reset(tp->tt_2msl, 2 * tcp_msl, + tcp_timer_2msl, tp); + goto dropafterack; + } + } + +step6: + /* + * Update window information. + * Don't look at window if no ACK: TAC's send garbage on first SYN. + */ + if ((thflags & TH_ACK) && + (SEQ_LT(tp->snd_wl1, th->th_seq) || + (tp->snd_wl1 == th->th_seq && (SEQ_LT(tp->snd_wl2, th->th_ack) || + (tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd))))) { + /* keep track of pure window updates */ + if (tlen == 0 && + tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd) + tcpstat.tcps_rcvwinupd++; + tp->snd_wnd = tiwin; + tp->snd_wl1 = th->th_seq; + tp->snd_wl2 = th->th_ack; + if (tp->snd_wnd > tp->max_sndwnd) + tp->max_sndwnd = tp->snd_wnd; + needoutput = 1; + } + + /* + * Process segments with URG. + */ + if ((thflags & TH_URG) && th->th_urp && + TCPS_HAVERCVDFIN(tp->t_state) == 0) { + /* + * This is a kludge, but if we receive and accept + * random urgent pointers, we'll crash in + * soreceive. It's hard to imagine someone + * actually wanting to send this much urgent data. + */ + if (th->th_urp + so->so_rcv.sb_cc > sb_max) { + th->th_urp = 0; /* XXX */ + thflags &= ~TH_URG; /* XXX */ + goto dodata; /* XXX */ + } + /* + * If this segment advances the known urgent pointer, + * then mark the data stream. This should not happen + * in CLOSE_WAIT, CLOSING, LAST_ACK or TIME_WAIT STATES since + * a FIN has been received from the remote side. + * In these states we ignore the URG. + * + * According to RFC961 (Assigned Protocols), + * the urgent pointer points to the last octet + * of urgent data. We continue, however, + * to consider it to indicate the first octet + * of data past the urgent section as the original + * spec states (in one of two places). + */ + if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) { + tp->rcv_up = th->th_seq + th->th_urp; + so->so_oobmark = so->so_rcv.sb_cc + + (tp->rcv_up - tp->rcv_nxt) - 1; + if (so->so_oobmark == 0) + so->so_state |= SS_RCVATMARK; + sohasoutofband(so); + tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA); + } + /* + * Remove out of band data so doesn't get presented to user. + * This can happen independent of advancing the URG pointer, + * but if two URG's are pending at once, some out-of-band + * data may creep in... ick. + */ + if (th->th_urp <= (u_long)tlen +#ifdef SO_OOBINLINE + && (so->so_options & SO_OOBINLINE) == 0 +#endif + ) + tcp_pulloutofband(so, th, m, + drop_hdrlen); /* hdr drop is delayed */ + } else + /* + * If no out of band data is expected, + * pull receive urgent pointer along + * with the receive window. + */ + if (SEQ_GT(tp->rcv_nxt, tp->rcv_up)) + tp->rcv_up = tp->rcv_nxt; +dodata: /* XXX */ + + /* + * Process the segment text, merging it into the TCP sequencing queue, + * and arranging for acknowledgment of receipt if necessary. + * This process logically involves adjusting tp->rcv_wnd as data + * is presented to the user (this happens in tcp_usrreq.c, + * case PRU_RCVD). If a FIN has already been received on this + * connection then we just ignore the text. + */ + if ((tlen || (thflags&TH_FIN)) && + TCPS_HAVERCVDFIN(tp->t_state) == 0) { + m_adj(m, drop_hdrlen); /* delayed header drop */ + /* + * Insert segment which inludes th into reassembly queue of tcp with + * control block tp. Return TH_FIN if reassembly now includes + * a segment with FIN. This handle the common case inline (segment + * is the next to be received on an established connection, and the + * queue is empty), avoiding linkage into and removal from the queue + * and repetition of various conversions. + * Set DELACK for segments received in order, but ack immediately + * when segments are out of order (so fast retransmit can work). + */ + if (th->th_seq == tp->rcv_nxt && + LIST_EMPTY(&tp->t_segq) && + TCPS_HAVEESTABLISHED(tp->t_state)) { + if (DELAY_ACK(tp)) + callout_reset(tp->tt_delack, tcp_delacktime, + tcp_timer_delack, tp); + else + tp->t_flags |= TF_ACKNOW; + tp->rcv_nxt += tlen; + thflags = th->th_flags & TH_FIN; + tcpstat.tcps_rcvpack++; + tcpstat.tcps_rcvbyte += tlen; + ND6_HINT(tp); + sbappend(&so->so_rcv, m); + sorwakeup(so); + } else { + thflags = tcp_reass(tp, th, &tlen, m); + tp->t_flags |= TF_ACKNOW; + } + + /* + * Note the amount of data that peer has sent into + * our window, in order to estimate the sender's + * buffer size. + */ + len = so->so_rcv.sb_hiwat - (tp->rcv_adv - tp->rcv_nxt); + } else { + m_freem(m); + thflags &= ~TH_FIN; + } + + /* + * If FIN is received ACK the FIN and let the user know + * that the connection is closing. + */ + if (thflags & TH_FIN) { + if (TCPS_HAVERCVDFIN(tp->t_state) == 0) { + socantrcvmore(so); + /* + * If connection is half-synchronized + * (ie NEEDSYN flag on) then delay ACK, + * so it may be piggybacked when SYN is sent. + * Otherwise, since we received a FIN then no + * more input can be expected, send ACK now. + */ + if (DELAY_ACK(tp) && (tp->t_flags & TF_NEEDSYN)) + callout_reset(tp->tt_delack, tcp_delacktime, + tcp_timer_delack, tp); + else + tp->t_flags |= TF_ACKNOW; + tp->rcv_nxt++; + } + switch (tp->t_state) { + + /* + * In SYN_RECEIVED and ESTABLISHED STATES + * enter the CLOSE_WAIT state. + */ + case TCPS_SYN_RECEIVED: + tp->t_starttime = ticks; + /*FALLTHROUGH*/ + case TCPS_ESTABLISHED: + tp->t_state = TCPS_CLOSE_WAIT; + break; + + /* + * If still in FIN_WAIT_1 STATE FIN has not been acked so + * enter the CLOSING state. + */ + case TCPS_FIN_WAIT_1: + tp->t_state = TCPS_CLOSING; + break; + + /* + * In FIN_WAIT_2 state enter the TIME_WAIT state, + * starting the time-wait timer, turning off the other + * standard timers. + */ + case TCPS_FIN_WAIT_2: + tp->t_state = TCPS_TIME_WAIT; + tcp_canceltimers(tp); + /* Shorten TIME_WAIT [RFC-1644, p.28] */ + if (tp->cc_recv != 0 && + (ticks - tp->t_starttime) < tcp_msl) { + callout_reset(tp->tt_2msl, + tp->t_rxtcur * TCPTV_TWTRUNC, + tcp_timer_2msl, tp); + /* For transaction client, force ACK now. */ + tp->t_flags |= TF_ACKNOW; + } + else { + callout_reset(tp->tt_2msl, 2 * tcp_msl, + tcp_timer_2msl, tp); + } + soisdisconnected(so); + break; + + /* + * In TIME_WAIT state restart the 2 MSL time_wait timer. + */ + case TCPS_TIME_WAIT: + callout_reset(tp->tt_2msl, 2 * tcp_msl, + tcp_timer_2msl, tp); + break; + } + } +#ifdef TCPDEBUG + if (so->so_options & SO_DEBUG) + tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen, + &tcp_savetcp, 0); +#endif + + /* + * Return any desired output. + */ + if (needoutput || (tp->t_flags & TF_ACKNOW)) + (void) tcp_output(tp); + return; + +dropafterack: + /* + * Generate an ACK dropping incoming segment if it occupies + * sequence space, where the ACK reflects our state. + * + * We can now skip the test for the RST flag since all + * paths to this code happen after packets containing + * RST have been dropped. + * + * In the SYN-RECEIVED state, don't send an ACK unless the + * segment we received passes the SYN-RECEIVED ACK test. + * If it fails send a RST. This breaks the loop in the + * "LAND" DoS attack, and also prevents an ACK storm + * between two listening ports that have been sent forged + * SYN segments, each with the source address of the other. + */ + if (tp->t_state == TCPS_SYN_RECEIVED && (thflags & TH_ACK) && + (SEQ_GT(tp->snd_una, th->th_ack) || + SEQ_GT(th->th_ack, tp->snd_max)) ) { + rstreason = BANDLIM_RST_OPENPORT; + goto dropwithreset; + } +#ifdef TCPDEBUG + if (so->so_options & SO_DEBUG) + tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen, + &tcp_savetcp, 0); +#endif + m_freem(m); + tp->t_flags |= TF_ACKNOW; + (void) tcp_output(tp); + return; + +dropwithreset: + /* + * Generate a RST, dropping incoming segment. + * Make ACK acceptable to originator of segment. + * Don't bother to respond if destination was broadcast/multicast. + */ + if ((thflags & TH_RST) || m->m_flags & (M_BCAST|M_MCAST)) + goto drop; +#ifdef INET6 + if (isipv6) { + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || + IN6_IS_ADDR_MULTICAST(&ip6->ip6_src)) + goto drop; + } else +#endif /* INET6 */ + if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) || + IN_MULTICAST(ntohl(ip->ip_src.s_addr)) || + ip->ip_src.s_addr == htonl(INADDR_BROADCAST)) + goto drop; + /* IPv6 anycast check is done at tcp6_input() */ + + /* + * Perform bandwidth limiting. + */ +#ifdef ICMP_BANDLIM + if (badport_bandlim(rstreason) < 0) + goto drop; +#endif + +#ifdef TCPDEBUG + if (tp == 0 || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) + tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen, + &tcp_savetcp, 0); +#endif + if (thflags & TH_ACK) + /* mtod() below is safe as long as hdr dropping is delayed */ + tcp_respond(tp, mtod(m, void *), th, m, (tcp_seq)0, th->th_ack, + TH_RST); + else { + if (thflags & TH_SYN) + tlen++; + /* mtod() below is safe as long as hdr dropping is delayed */ + tcp_respond(tp, mtod(m, void *), th, m, th->th_seq+tlen, + (tcp_seq)0, TH_RST|TH_ACK); + } + /* destroy temporarily created socket */ + if (dropsocket) + (void) soabort(so); + return; + +drop: + /* + * Drop space held by incoming segment and return. + */ +#ifdef TCPDEBUG + if (tp == 0 || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) + tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen, + &tcp_savetcp, 0); +#endif + m_freem(m); + /* destroy temporarily created socket */ + if (dropsocket) + (void) soabort(so); + return; +} + +static void +tcp_dooptions(tp, cp, cnt, th, to) + struct tcpcb *tp; + u_char *cp; + int cnt; + struct tcphdr *th; + struct tcpopt *to; +{ + u_short mss = 0; + int opt, optlen; + + for (; cnt > 0; cnt -= optlen, cp += optlen) { + opt = cp[0]; + if (opt == TCPOPT_EOL) + break; + if (opt == TCPOPT_NOP) + optlen = 1; + else { + if (cnt < 2) + break; + optlen = cp[1]; + if (optlen < 2 || optlen > cnt) + break; + } + switch (opt) { + + default: + continue; + + case TCPOPT_MAXSEG: + if (optlen != TCPOLEN_MAXSEG) + continue; + if (!(th->th_flags & TH_SYN)) + continue; + bcopy((char *) cp + 2, (char *) &mss, sizeof(mss)); + NTOHS(mss); + break; + + case TCPOPT_WINDOW: + if (optlen != TCPOLEN_WINDOW) + continue; + if (!(th->th_flags & TH_SYN)) + continue; + tp->t_flags |= TF_RCVD_SCALE; + tp->requested_s_scale = min(cp[2], TCP_MAX_WINSHIFT); + break; + + case TCPOPT_TIMESTAMP: + if (optlen != TCPOLEN_TIMESTAMP) + continue; + to->to_flag |= TOF_TS; + bcopy((char *)cp + 2, + (char *)&to->to_tsval, sizeof(to->to_tsval)); + NTOHL(to->to_tsval); + bcopy((char *)cp + 6, + (char *)&to->to_tsecr, sizeof(to->to_tsecr)); + NTOHL(to->to_tsecr); + + /* + * A timestamp received in a SYN makes + * it ok to send timestamp requests and replies. + */ + if (th->th_flags & TH_SYN) { + tp->t_flags |= TF_RCVD_TSTMP; + tp->ts_recent = to->to_tsval; + tp->ts_recent_age = ticks; + } + break; + case TCPOPT_CC: + if (optlen != TCPOLEN_CC) + continue; + to->to_flag |= TOF_CC; + bcopy((char *)cp + 2, + (char *)&to->to_cc, sizeof(to->to_cc)); + NTOHL(to->to_cc); + /* + * A CC or CC.new option received in a SYN makes + * it ok to send CC in subsequent segments. + */ + if (th->th_flags & TH_SYN) + tp->t_flags |= TF_RCVD_CC; + break; + case TCPOPT_CCNEW: + if (optlen != TCPOLEN_CC) + continue; + if (!(th->th_flags & TH_SYN)) + continue; + to->to_flag |= TOF_CCNEW; + bcopy((char *)cp + 2, + (char *)&to->to_cc, sizeof(to->to_cc)); + NTOHL(to->to_cc); + /* + * A CC or CC.new option received in a SYN makes + * it ok to send CC in subsequent segments. + */ + tp->t_flags |= TF_RCVD_CC; + break; + case TCPOPT_CCECHO: + if (optlen != TCPOLEN_CC) + continue; + if (!(th->th_flags & TH_SYN)) + continue; + to->to_flag |= TOF_CCECHO; + bcopy((char *)cp + 2, + (char *)&to->to_ccecho, sizeof(to->to_ccecho)); + NTOHL(to->to_ccecho); + break; + } + } + if (th->th_flags & TH_SYN) + tcp_mss(tp, mss); /* sets t_maxseg */ +} + +/* + * Pull out of band byte out of a segment so + * it doesn't appear in the user's data queue. + * It is still reflected in the segment length for + * sequencing purposes. + */ +static void +tcp_pulloutofband(so, th, m, off) + struct socket *so; + struct tcphdr *th; + register struct mbuf *m; + int off; /* delayed to be droped hdrlen */ +{ + int cnt = off + th->th_urp - 1; + + while (cnt >= 0) { + if (m->m_len > cnt) { + char *cp = mtod(m, caddr_t) + cnt; + struct tcpcb *tp = sototcpcb(so); + + tp->t_iobc = *cp; + tp->t_oobflags |= TCPOOB_HAVEDATA; + bcopy(cp+1, cp, (unsigned)(m->m_len - cnt - 1)); + m->m_len--; + if (m->m_flags & M_PKTHDR) + m->m_pkthdr.len--; + return; + } + cnt -= m->m_len; + m = m->m_next; + if (m == 0) + break; + } + panic("tcp_pulloutofband"); +} + +/* + * Collect new round-trip time estimate + * and update averages and current timeout. + */ +static void +tcp_xmit_timer(tp, rtt) + register struct tcpcb *tp; + int rtt; +{ + register int delta; + + tcpstat.tcps_rttupdated++; + tp->t_rttupdated++; + if (tp->t_srtt != 0) { + /* + * srtt is stored as fixed point with 5 bits after the + * binary point (i.e., scaled by 8). The following magic + * is equivalent to the smoothing algorithm in rfc793 with + * an alpha of .875 (srtt = rtt/8 + srtt*7/8 in fixed + * point). Adjust rtt to origin 0. + */ + delta = ((rtt - 1) << TCP_DELTA_SHIFT) + - (tp->t_srtt >> (TCP_RTT_SHIFT - TCP_DELTA_SHIFT)); + + if ((tp->t_srtt += delta) <= 0) + tp->t_srtt = 1; + + /* + * We accumulate a smoothed rtt variance (actually, a + * smoothed mean difference), then set the retransmit + * timer to smoothed rtt + 4 times the smoothed variance. + * rttvar is stored as fixed point with 4 bits after the + * binary point (scaled by 16). The following is + * equivalent to rfc793 smoothing with an alpha of .75 + * (rttvar = rttvar*3/4 + |delta| / 4). This replaces + * rfc793's wired-in beta. + */ + if (delta < 0) + delta = -delta; + delta -= tp->t_rttvar >> (TCP_RTTVAR_SHIFT - TCP_DELTA_SHIFT); + if ((tp->t_rttvar += delta) <= 0) + tp->t_rttvar = 1; + } else { + /* + * No rtt measurement yet - use the unsmoothed rtt. + * Set the variance to half the rtt (so our first + * retransmit happens at 3*rtt). + */ + tp->t_srtt = rtt << TCP_RTT_SHIFT; + tp->t_rttvar = rtt << (TCP_RTTVAR_SHIFT - 1); + } + tp->t_rtttime = 0; + tp->t_rxtshift = 0; + + /* + * the retransmit should happen at rtt + 4 * rttvar. + * Because of the way we do the smoothing, srtt and rttvar + * will each average +1/2 tick of bias. When we compute + * the retransmit timer, we want 1/2 tick of rounding and + * 1 extra tick because of +-1/2 tick uncertainty in the + * firing of the timer. The bias will give us exactly the + * 1.5 tick we need. But, because the bias is + * statistical, we have to test that we don't drop below + * the minimum feasible timer (which is 2 ticks). + */ + TCPT_RANGESET(tp->t_rxtcur, TCP_REXMTVAL(tp), + max(tp->t_rttmin, rtt + 2), TCPTV_REXMTMAX); + + /* + * We received an ack for a packet that wasn't retransmitted; + * it is probably safe to discard any error indications we've + * received recently. This isn't quite right, but close enough + * for now (a route might have failed after we sent a segment, + * and the return path might not be symmetrical). + */ + tp->t_softerror = 0; +} + +/* + * Determine a reasonable value for maxseg size. + * If the route is known, check route for mtu. + * If none, use an mss that can be handled on the outgoing + * interface without forcing IP to fragment; if bigger than + * an mbuf cluster (MCLBYTES), round down to nearest multiple of MCLBYTES + * to utilize large mbufs. If no route is found, route has no mtu, + * or the destination isn't local, use a default, hopefully conservative + * size (usually 512 or the default IP max size, but no more than the mtu + * of the interface), as we can't discover anything about intervening + * gateways or networks. We also initialize the congestion/slow start + * window to be a single segment if the destination isn't local. + * While looking at the routing entry, we also initialize other path-dependent + * parameters from pre-set or cached values in the routing entry. + * + * Also take into account the space needed for options that we + * send regularly. Make maxseg shorter by that amount to assure + * that we can send maxseg amount of data even when the options + * are present. Store the upper limit of the length of options plus + * data in maxopd. + * + * NOTE that this routine is only called when we process an incoming + * segment, for outgoing segments only tcp_mssopt is called. + * + * In case of T/TCP, we call this routine during implicit connection + * setup as well (offer = -1), to initialize maxseg from the cached + * MSS of our peer. + */ +void +tcp_mss(tp, offer) + struct tcpcb *tp; + int offer; +{ + register struct rtentry *rt; + struct ifnet *ifp; + register int rtt, mss; + u_long bufsize; + struct inpcb *inp; + struct socket *so; + struct rmxp_tao *taop; + int origoffer = offer; +#ifdef INET6 + int isipv6; + int min_protoh; +#endif + + inp = tp->t_inpcb; +#ifdef INET6 + isipv6 = ((inp->inp_vflag & INP_IPV6) != 0) ? 1 : 0; + min_protoh = isipv6 ? sizeof (struct ip6_hdr) + sizeof (struct tcphdr) + : sizeof (struct tcpiphdr); +#else +#define min_protoh (sizeof (struct tcpiphdr)) +#endif +#ifdef INET6 + if (isipv6) + rt = tcp_rtlookup6(inp); + else +#endif + rt = tcp_rtlookup(inp); + if (rt == NULL) { + tp->t_maxopd = tp->t_maxseg = +#ifdef INET6 + isipv6 ? tcp_v6mssdflt : +#endif /* INET6 */ + tcp_mssdflt; + return; + } + ifp = rt->rt_ifp; + so = inp->inp_socket; + + taop = rmx_taop(rt->rt_rmx); + /* + * Offer == -1 means that we didn't receive SYN yet, + * use cached value in that case; + */ + if (offer == -1) + offer = taop->tao_mssopt; + /* + * Offer == 0 means that there was no MSS on the SYN segment, + * in this case we use tcp_mssdflt. + */ + if (offer == 0) + offer = +#ifdef INET6 + isipv6 ? tcp_v6mssdflt : +#endif /* INET6 */ + tcp_mssdflt; + else + /* + * Sanity check: make sure that maxopd will be large + * enough to allow some data on segments even is the + * all the option space is used (40bytes). Otherwise + * funny things may happen in tcp_output. + */ + offer = max(offer, 64); + taop->tao_mssopt = offer; + + /* + * While we're here, check if there's an initial rtt + * or rttvar. Convert from the route-table units + * to scaled multiples of the slow timeout timer. + */ + if (tp->t_srtt == 0 && (rtt = rt->rt_rmx.rmx_rtt)) { + /* + * XXX the lock bit for RTT indicates that the value + * is also a minimum value; this is subject to time. + */ + if (rt->rt_rmx.rmx_locks & RTV_RTT) + tp->t_rttmin = rtt / (RTM_RTTUNIT / hz); + tp->t_srtt = rtt / (RTM_RTTUNIT / (hz * TCP_RTT_SCALE)); + tcpstat.tcps_usedrtt++; + if (rt->rt_rmx.rmx_rttvar) { + tp->t_rttvar = rt->rt_rmx.rmx_rttvar / + (RTM_RTTUNIT / (hz * TCP_RTTVAR_SCALE)); + tcpstat.tcps_usedrttvar++; + } else { + /* default variation is +- 1 rtt */ + tp->t_rttvar = + tp->t_srtt * TCP_RTTVAR_SCALE / TCP_RTT_SCALE; + } + TCPT_RANGESET(tp->t_rxtcur, + ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1, + tp->t_rttmin, TCPTV_REXMTMAX); + } + /* + * if there's an mtu associated with the route, use it + * else, use the link mtu. + */ + if (rt->rt_rmx.rmx_mtu) + mss = rt->rt_rmx.rmx_mtu - min_protoh; + else + { + mss = +#ifdef INET6 + (isipv6 ? nd_ifinfo[rt->rt_ifp->if_index].linkmtu : +#endif + ifp->if_mtu +#ifdef INET6 + ) +#endif + - min_protoh; +#ifdef INET6 + if (isipv6) { + if (!in6_localaddr(&inp->in6p_faddr)) + mss = min(mss, tcp_v6mssdflt); + } else +#endif + if (!in_localaddr(inp->inp_faddr)) + mss = min(mss, tcp_mssdflt); + } + mss = min(mss, offer); + /* + * maxopd stores the maximum length of data AND options + * in a segment; maxseg is the amount of data in a normal + * segment. We need to store this value (maxopd) apart + * from maxseg, because now every segment carries options + * and thus we normally have somewhat less data in segments. + */ + tp->t_maxopd = mss; + + /* + * In case of T/TCP, origoffer==-1 indicates, that no segments + * were received yet. In this case we just guess, otherwise + * we do the same as before T/TCP. + */ + if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP && + (origoffer == -1 || + (tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP)) + mss -= TCPOLEN_TSTAMP_APPA; + if ((tp->t_flags & (TF_REQ_CC|TF_NOOPT)) == TF_REQ_CC && + (origoffer == -1 || + (tp->t_flags & TF_RCVD_CC) == TF_RCVD_CC)) + mss -= TCPOLEN_CC_APPA; + +#if (MCLBYTES & (MCLBYTES - 1)) == 0 + if (mss > MCLBYTES) + mss &= ~(MCLBYTES-1); +#else + if (mss > MCLBYTES) + mss = mss / MCLBYTES * MCLBYTES; +#endif + /* + * If there's a pipesize, change the socket buffer + * to that size. Make the socket buffers an integral + * number of mss units; if the mss is larger than + * the socket buffer, decrease the mss. + */ +#ifdef RTV_SPIPE + if ((bufsize = rt->rt_rmx.rmx_sendpipe) == 0) +#endif + bufsize = so->so_snd.sb_hiwat; + if (bufsize < mss) + mss = bufsize; + else { + bufsize = roundup(bufsize, mss); + if (bufsize > sb_max) + bufsize = sb_max; + (void)sbreserve(&so->so_snd, bufsize, so, NULL); + } + tp->t_maxseg = mss; + +#ifdef RTV_RPIPE + if ((bufsize = rt->rt_rmx.rmx_recvpipe) == 0) +#endif + bufsize = so->so_rcv.sb_hiwat; + if (bufsize > mss) { + bufsize = roundup(bufsize, mss); + if (bufsize > sb_max) + bufsize = sb_max; + (void)sbreserve(&so->so_rcv, bufsize, so, NULL); + } + + /* + * Set the slow-start flight size depending on whether this + * is a local network or not. + */ + if ( +#ifdef INET6 + (isipv6 && in6_localaddr(&inp->in6p_faddr)) || + (!isipv6 && +#endif + in_localaddr(inp->inp_faddr) +#ifdef INET6 + ) +#endif + ) + tp->snd_cwnd = mss * ss_fltsz_local; + else + tp->snd_cwnd = mss * ss_fltsz; + + if (rt->rt_rmx.rmx_ssthresh) { + /* + * There's some sort of gateway or interface + * buffer limit on the path. Use this to set + * the slow start threshhold, but set the + * threshold to no less than 2*mss. + */ + tp->snd_ssthresh = max(2 * mss, rt->rt_rmx.rmx_ssthresh); + tcpstat.tcps_usedssthresh++; + } +} + +/* + * Determine the MSS option to send on an outgoing SYN. + */ +int +tcp_mssopt(tp) + struct tcpcb *tp; +{ + struct rtentry *rt; +#ifdef INET6 + int isipv6; + int min_protoh; +#endif + +#ifdef INET6 + isipv6 = ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0) ? 1 : 0; + min_protoh = isipv6 ? sizeof (struct ip6_hdr) + sizeof (struct tcphdr) + : sizeof (struct tcpiphdr); +#else +#define min_protoh (sizeof (struct tcpiphdr)) +#endif +#ifdef INET6 + if (isipv6) + rt = tcp_rtlookup6(tp->t_inpcb); + else +#endif /* INET6 */ + rt = tcp_rtlookup(tp->t_inpcb); + if (rt == NULL) + return +#ifdef INET6 + isipv6 ? tcp_v6mssdflt : +#endif /* INET6 */ + tcp_mssdflt; + + return rt->rt_ifp->if_mtu - min_protoh; +} + + +/* + * Checks for partial ack. If partial ack arrives, force the retransmission + * of the next unacknowledged segment, do not clear tp->t_dupacks, and return + * 1. By setting snd_nxt to ti_ack, this forces retransmission timer to + * be started again. If the ack advances at least to tp->snd_recover, return 0. + */ +static int +tcp_newreno(tp, th) + struct tcpcb *tp; + struct tcphdr *th; +{ + if (SEQ_LT(th->th_ack, tp->snd_recover)) { + tcp_seq onxt = tp->snd_nxt; + u_long ocwnd = tp->snd_cwnd; + + callout_stop(tp->tt_rexmt); + tp->t_rtttime = 0; + tp->snd_nxt = th->th_ack; + /* + * Set snd_cwnd to one segment beyond acknowledged offset + * (tp->snd_una has not yet been updated when this function + * is called) + */ + tp->snd_cwnd = tp->t_maxseg + (th->th_ack - tp->snd_una); + (void) tcp_output(tp); + tp->snd_cwnd = ocwnd; + if (SEQ_GT(onxt, tp->snd_nxt)) + tp->snd_nxt = onxt; + /* + * Partial window deflation. Relies on fact that tp->snd_una + * not updated yet. + */ + tp->snd_cwnd -= (th->th_ack - tp->snd_una - tp->t_maxseg); + return (1); + } + return (0); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_output.c b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_output.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_output.c @@ -0,0 +1,937 @@ +//========================================================================== +// +// src/sys/netinet/tcp_output.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet/tcp_output.c,v 1.39.2.10 2001/07/07 04:30:38 silby Exp $ + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#ifdef INET6 +#include +#include +#include +#endif +#include +#define TCPOUTFLAGS +#include +#include +#include +#include +#include +#ifdef TCPDEBUG +#include +#endif + +#ifdef IPSEC +#include +#endif /*IPSEC*/ + +#ifdef notyet +extern struct mbuf *m_copypack(); +#endif + +static int path_mtu_discovery = 1; +int ss_fltsz = 1; +int ss_fltsz_local = TCP_MAXWIN; /* something large */ +int tcp_do_newreno = 1; + +/* + * Tcp output routine: figure out what should be sent and send it. + */ +int +tcp_output(tp) + register struct tcpcb *tp; +{ + register struct socket *so = tp->t_inpcb->inp_socket; + register long len, win; + int off, flags, error; + register struct mbuf *m; + struct ip *ip = NULL; + register struct ipovly *ipov = NULL; +#ifdef INET6 + struct ip6_hdr *ip6 = NULL; +#endif /* INET6 */ + register struct tcphdr *th; + u_char opt[TCP_MAXOLEN]; + unsigned ipoptlen, optlen, hdrlen; + int idle, sendalot; + int maxburst = TCP_MAXBURST; + struct rmxp_tao *taop; + struct rmxp_tao tao_noncached; +#ifdef INET6 + int isipv6; +#endif + +#ifdef INET6 + isipv6 = (tp->t_inpcb->inp_vflag & INP_IPV6) != 0; +#endif + + /* + * Determine length of data that should be transmitted, + * and flags that will be used. + * If there is some data or critical controls (SYN, RST) + * to send, then transmit; otherwise, investigate further. + */ + idle = (tp->snd_max == tp->snd_una); + if (idle && (ticks - tp->t_rcvtime) >= tp->t_rxtcur) { + /* + * We have been idle for "a while" and no acks are + * expected to clock out any data we send -- + * slow start to get ack "clock" running again. + * + * Set the slow-start flight size depending on whether + * this is a local network or not. + */ + if ( +#ifdef INET6 + (isipv6 && in6_localaddr(&tp->t_inpcb->in6p_faddr)) || + (!isipv6 && +#endif + in_localaddr(tp->t_inpcb->inp_faddr) +#ifdef INET6 + ) +#endif + ) + tp->snd_cwnd = tp->t_maxseg * ss_fltsz_local; + else + tp->snd_cwnd = tp->t_maxseg * ss_fltsz; + } +again: + sendalot = 0; + off = tp->snd_nxt - tp->snd_una; + win = min(tp->snd_wnd, tp->snd_cwnd); + + flags = tcp_outflags[tp->t_state]; + /* + * Get standard flags, and add SYN or FIN if requested by 'hidden' + * state flags. + */ + if (tp->t_flags & TF_NEEDFIN) + flags |= TH_FIN; + if (tp->t_flags & TF_NEEDSYN) + flags |= TH_SYN; + + /* + * If in persist timeout with window of 0, send 1 byte. + * Otherwise, if window is small but nonzero + * and timer expired, we will send what we can + * and go to transmit state. + */ + if (tp->t_force) { + if (win == 0) { + /* + * If we still have some data to send, then + * clear the FIN bit. Usually this would + * happen below when it realizes that we + * aren't sending all the data. However, + * if we have exactly 1 byte of unsent data, + * then it won't clear the FIN bit below, + * and if we are in persist state, we wind + * up sending the packet without recording + * that we sent the FIN bit. + * + * We can't just blindly clear the FIN bit, + * because if we don't have any more data + * to send then the probe will be the FIN + * itself. + */ + if (off < so->so_snd.sb_cc) + flags &= ~TH_FIN; + win = 1; + } else { + callout_stop(tp->tt_persist); + tp->t_rxtshift = 0; + } + } + + len = (long)ulmin(so->so_snd.sb_cc, win) - off; + + if ((taop = tcp_gettaocache(tp->t_inpcb)) == NULL) { + taop = &tao_noncached; + bzero(taop, sizeof(*taop)); + } + + /* + * Lop off SYN bit if it has already been sent. However, if this + * is SYN-SENT state and if segment contains data and if we don't + * know that foreign host supports TAO, suppress sending segment. + */ + if ((flags & TH_SYN) && SEQ_GT(tp->snd_nxt, tp->snd_una)) { + flags &= ~TH_SYN; + off--, len++; + if (len > 0 && tp->t_state == TCPS_SYN_SENT && + taop->tao_ccsent == 0) + return 0; + } + + /* + * Be careful not to send data and/or FIN on SYN segments + * in cases when no CC option will be sent. + * This measure is needed to prevent interoperability problems + * with not fully conformant TCP implementations. + */ + if ((flags & TH_SYN) && + ((tp->t_flags & TF_NOOPT) || !(tp->t_flags & TF_REQ_CC) || + ((flags & TH_ACK) && !(tp->t_flags & TF_RCVD_CC)))) { + len = 0; + flags &= ~TH_FIN; + } + + if (len < 0) { + /* + * If FIN has been sent but not acked, + * but we haven't been called to retransmit, + * len will be -1. Otherwise, window shrank + * after we sent into it. If window shrank to 0, + * cancel pending retransmit, pull snd_nxt back + * to (closed) window, and set the persist timer + * if it isn't already going. If the window didn't + * close completely, just wait for an ACK. + */ + len = 0; + if (win == 0) { + callout_stop(tp->tt_rexmt); + tp->t_rxtshift = 0; + tp->snd_nxt = tp->snd_una; + if (!callout_active(tp->tt_persist)) + tcp_setpersist(tp); + } + } + if (len > tp->t_maxseg) { + len = tp->t_maxseg; + sendalot = 1; + } + if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + so->so_snd.sb_cc)) + flags &= ~TH_FIN; + + win = sbspace(&so->so_rcv); + + /* + * Sender silly window avoidance. If connection is idle + * and can send all data, a maximum segment, + * at least a maximum default-size segment do it, + * or are forced, do it; otherwise don't bother. + * If peer's buffer is tiny, then send + * when window is at least half open. + * If retransmitting (possibly after persist timer forced us + * to send into a small window), then must resend. + */ + if (len) { + if (len == tp->t_maxseg) + goto send; + if (!(tp->t_flags & TF_MORETOCOME) && + (idle || tp->t_flags & TF_NODELAY) && + (tp->t_flags & TF_NOPUSH) == 0 && + len + off >= so->so_snd.sb_cc) + goto send; + if (tp->t_force) + goto send; + if (len >= tp->max_sndwnd / 2 && tp->max_sndwnd > 0) + goto send; + if (SEQ_LT(tp->snd_nxt, tp->snd_max)) + goto send; + } + + /* + * Compare available window to amount of window + * known to peer (as advertised window less + * next expected input). If the difference is at least two + * max size segments, or at least 50% of the maximum possible + * window, then want to send a window update to peer. + */ + if (win > 0) { + /* + * "adv" is the amount we can increase the window, + * taking into account that we are limited by + * TCP_MAXWIN << tp->rcv_scale. + */ + long adv = min(win, (long)TCP_MAXWIN << tp->rcv_scale) - + (tp->rcv_adv - tp->rcv_nxt); + + if (adv >= (long) (2 * tp->t_maxseg)) + goto send; + if (2 * adv >= (long) so->so_rcv.sb_hiwat) + goto send; + } + + /* + * Send if we owe peer an ACK. + */ + if (tp->t_flags & TF_ACKNOW) + goto send; + if ((flags & TH_RST) || + ((flags & TH_SYN) && (tp->t_flags & TF_NEEDSYN) == 0)) + goto send; + if (SEQ_GT(tp->snd_up, tp->snd_una)) + goto send; + /* + * If our state indicates that FIN should be sent + * and we have not yet done so, or we're retransmitting the FIN, + * then we need to send. + */ + if (flags & TH_FIN && + ((tp->t_flags & TF_SENTFIN) == 0 || tp->snd_nxt == tp->snd_una)) + goto send; + + /* + * TCP window updates are not reliable, rather a polling protocol + * using ``persist'' packets is used to insure receipt of window + * updates. The three ``states'' for the output side are: + * idle not doing retransmits or persists + * persisting to move a small or zero window + * (re)transmitting and thereby not persisting + * + * callout_active(tp->tt_persist) + * is true when we are in persist state. + * tp->t_force + * is set when we are called to send a persist packet. + * callout_active(tp->tt_rexmt) + * is set when we are retransmitting + * The output side is idle when both timers are zero. + * + * If send window is too small, there is data to transmit, and no + * retransmit or persist is pending, then go to persist state. + * If nothing happens soon, send when timer expires: + * if window is nonzero, transmit what we can, + * otherwise force out a byte. + */ + if (so->so_snd.sb_cc && !callout_active(tp->tt_rexmt) && + !callout_active(tp->tt_persist)) { + tp->t_rxtshift = 0; + tcp_setpersist(tp); + } + + /* + * No reason to send a segment, just return. + */ + return (0); + +send: + /* + * Before ESTABLISHED, force sending of initial options + * unless TCP set not to do any options. + * NOTE: we assume that the IP/TCP header plus TCP options + * always fit in a single mbuf, leaving room for a maximum + * link header, i.e. + * max_linkhdr + sizeof (struct tcpiphdr) + optlen <= MCLBYTES + */ + optlen = 0; +#ifdef INET6 + if (isipv6) + hdrlen = sizeof (struct ip6_hdr) + sizeof (struct tcphdr); + else +#endif + hdrlen = sizeof (struct tcpiphdr); + if (flags & TH_SYN) { + tp->snd_nxt = tp->iss; + if ((tp->t_flags & TF_NOOPT) == 0) { + u_short mss; + + opt[0] = TCPOPT_MAXSEG; + opt[1] = TCPOLEN_MAXSEG; + mss = htons((u_short) tcp_mssopt(tp)); + (void)memcpy(opt + 2, &mss, sizeof(mss)); + optlen = TCPOLEN_MAXSEG; + + if ((tp->t_flags & TF_REQ_SCALE) && + ((flags & TH_ACK) == 0 || + (tp->t_flags & TF_RCVD_SCALE))) { + *((u_int32_t *)(opt + optlen)) = htonl( + TCPOPT_NOP << 24 | + TCPOPT_WINDOW << 16 | + TCPOLEN_WINDOW << 8 | + tp->request_r_scale); + optlen += 4; + } + } + } + + /* + * Send a timestamp and echo-reply if this is a SYN and our side + * wants to use timestamps (TF_REQ_TSTMP is set) or both our side + * and our peer have sent timestamps in our SYN's. + */ + if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP && + (flags & TH_RST) == 0 && + ((flags & TH_ACK) == 0 || + (tp->t_flags & TF_RCVD_TSTMP))) { + u_int32_t *lp = (u_int32_t *)(opt + optlen); + + /* Form timestamp option as shown in appendix A of RFC 1323. */ + *lp++ = htonl(TCPOPT_TSTAMP_HDR); + *lp++ = htonl(ticks); + *lp = htonl(tp->ts_recent); + optlen += TCPOLEN_TSTAMP_APPA; + } + + /* + * Send `CC-family' options if our side wants to use them (TF_REQ_CC), + * options are allowed (!TF_NOOPT) and it's not a RST. + */ + if ((tp->t_flags & (TF_REQ_CC|TF_NOOPT)) == TF_REQ_CC && + (flags & TH_RST) == 0) { + switch (flags & (TH_SYN|TH_ACK)) { + /* + * This is a normal ACK, send CC if we received CC before + * from our peer. + */ + case TH_ACK: + if (!(tp->t_flags & TF_RCVD_CC)) + break; + /*FALLTHROUGH*/ + + /* + * We can only get here in T/TCP's SYN_SENT* state, when + * we're a sending a non-SYN segment without waiting for + * the ACK of our SYN. A check above assures that we only + * do this if our peer understands T/TCP. + */ + case 0: + opt[optlen++] = TCPOPT_NOP; + opt[optlen++] = TCPOPT_NOP; + opt[optlen++] = TCPOPT_CC; + opt[optlen++] = TCPOLEN_CC; + *(u_int32_t *)&opt[optlen] = htonl(tp->cc_send); + + optlen += 4; + break; + + /* + * This is our initial SYN, check whether we have to use + * CC or CC.new. + */ + case TH_SYN: + opt[optlen++] = TCPOPT_NOP; + opt[optlen++] = TCPOPT_NOP; + opt[optlen++] = tp->t_flags & TF_SENDCCNEW ? + TCPOPT_CCNEW : TCPOPT_CC; + opt[optlen++] = TCPOLEN_CC; + *(u_int32_t *)&opt[optlen] = htonl(tp->cc_send); + optlen += 4; + break; + + /* + * This is a SYN,ACK; send CC and CC.echo if we received + * CC from our peer. + */ + case (TH_SYN|TH_ACK): + if (tp->t_flags & TF_RCVD_CC) { + opt[optlen++] = TCPOPT_NOP; + opt[optlen++] = TCPOPT_NOP; + opt[optlen++] = TCPOPT_CC; + opt[optlen++] = TCPOLEN_CC; + *(u_int32_t *)&opt[optlen] = + htonl(tp->cc_send); + optlen += 4; + opt[optlen++] = TCPOPT_NOP; + opt[optlen++] = TCPOPT_NOP; + opt[optlen++] = TCPOPT_CCECHO; + opt[optlen++] = TCPOLEN_CC; + *(u_int32_t *)&opt[optlen] = + htonl(tp->cc_recv); + optlen += 4; + } + break; + } + } + + hdrlen += optlen; + +#ifdef INET6 + if (isipv6) + ipoptlen = ip6_optlen(tp->t_inpcb); + else +#endif + { + if (tp->t_inpcb->inp_options) { + ipoptlen = tp->t_inpcb->inp_options->m_len - + offsetof(struct ipoption, ipopt_list); + } else { + ipoptlen = 0; + } + } +#ifdef IPSEC + ipoptlen += ipsec_hdrsiz_tcp(tp); +#endif + + /* + * Adjust data length if insertion of options will + * bump the packet length beyond the t_maxopd length. + * Clear the FIN bit because we cut off the tail of + * the segment. + */ + if (len + optlen + ipoptlen > tp->t_maxopd) { + /* + * If there is still more to send, don't close the connection. + */ + flags &= ~TH_FIN; + len = tp->t_maxopd - optlen - ipoptlen; + sendalot = 1; + } + +/*#ifdef DIAGNOSTIC*/ +#ifdef INET6 + if (max_linkhdr + hdrlen > MCLBYTES) + panic("tcphdr too big"); +#else + if (max_linkhdr + hdrlen > MHLEN) + panic("tcphdr too big"); +#endif +/*#endif*/ + + /* + * Grab a header mbuf, attaching a copy of data to + * be transmitted, and initialize the header from + * the template for sends on this connection. + */ + if (len) { + if (tp->t_force && len == 1) + tcpstat.tcps_sndprobe++; + else if (SEQ_LT(tp->snd_nxt, tp->snd_max)) { + tcpstat.tcps_sndrexmitpack++; + tcpstat.tcps_sndrexmitbyte += len; + } else { + tcpstat.tcps_sndpack++; + tcpstat.tcps_sndbyte += len; + } +#ifdef notyet + if ((m = m_copypack(so->so_snd.sb_mb, off, + (int)len, max_linkhdr + hdrlen)) == 0) { + error = ENOBUFS; + goto out; + } + /* + * m_copypack left space for our hdr; use it. + */ + m->m_len += hdrlen; + m->m_data -= hdrlen; +#else + MGETHDR(m, M_DONTWAIT, MT_HEADER); + if (m == NULL) { + error = ENOBUFS; + goto out; + } +#ifdef INET6 + if (MHLEN < hdrlen + max_linkhdr) { + MCLGET(m, M_DONTWAIT); + if ((m->m_flags & M_EXT) == 0) { + m_freem(m); + error = ENOBUFS; + goto out; + } + } +#endif + m->m_data += max_linkhdr; + m->m_len = hdrlen; + if (len <= MHLEN - hdrlen - max_linkhdr) { + m_copydata(so->so_snd.sb_mb, off, (int) len, + mtod(m, caddr_t) + hdrlen); + m->m_len += len; + } else { + m->m_next = m_copy(so->so_snd.sb_mb, off, (int) len); + if (m->m_next == 0) { + (void) m_free(m); + error = ENOBUFS; + goto out; + } + } +#endif + /* + * If we're sending everything we've got, set PUSH. + * (This will keep happy those implementations which only + * give data to the user when a buffer fills or + * a PUSH comes in.) + */ + if (off + len == so->so_snd.sb_cc) + flags |= TH_PUSH; + } else { + if (tp->t_flags & TF_ACKNOW) + tcpstat.tcps_sndacks++; + else if (flags & (TH_SYN|TH_FIN|TH_RST)) + tcpstat.tcps_sndctrl++; + else if (SEQ_GT(tp->snd_up, tp->snd_una)) + tcpstat.tcps_sndurg++; + else + tcpstat.tcps_sndwinup++; + + MGETHDR(m, M_DONTWAIT, MT_HEADER); + if (m == NULL) { + error = ENOBUFS; + goto out; + } +#ifdef INET6 + if (isipv6 && (MHLEN < hdrlen + max_linkhdr) && + MHLEN >= hdrlen) { + MH_ALIGN(m, hdrlen); + } else +#endif + m->m_data += max_linkhdr; + m->m_len = hdrlen; + } + m->m_pkthdr.rcvif = (struct ifnet *)0; +#ifdef INET6 + if (isipv6) { + ip6 = mtod(m, struct ip6_hdr *); + th = (struct tcphdr *)(ip6 + 1); + tcp_fillheaders(tp, ip6, th); + } else +#endif /* INET6 */ + { + ip = mtod(m, struct ip *); + ipov = (struct ipovly *)ip; + th = (struct tcphdr *)(ip + 1); + /* this picks up the pseudo header (w/o the length) */ + tcp_fillheaders(tp, ip, th); + } + + /* + * Fill in fields, remembering maximum advertised + * window for use in delaying messages about window sizes. + * If resending a FIN, be sure not to use a new sequence number. + */ + if (flags & TH_FIN && tp->t_flags & TF_SENTFIN && + tp->snd_nxt == tp->snd_max) + tp->snd_nxt--; + /* + * If we are doing retransmissions, then snd_nxt will + * not reflect the first unsent octet. For ACK only + * packets, we do not want the sequence number of the + * retransmitted packet, we want the sequence number + * of the next unsent octet. So, if there is no data + * (and no SYN or FIN), use snd_max instead of snd_nxt + * when filling in ti_seq. But if we are in persist + * state, snd_max might reflect one byte beyond the + * right edge of the window, so use snd_nxt in that + * case, since we know we aren't doing a retransmission. + * (retransmit and persist are mutually exclusive...) + */ + if (len || (flags & (TH_SYN|TH_FIN)) + || callout_active(tp->tt_persist)) + th->th_seq = htonl(tp->snd_nxt); + else + th->th_seq = htonl(tp->snd_max); + th->th_ack = htonl(tp->rcv_nxt); + if (optlen) { + bcopy(opt, th + 1, optlen); + th->th_off = (sizeof (struct tcphdr) + optlen) >> 2; + } + th->th_flags = flags; + /* + * Calculate receive window. Don't shrink window, + * but avoid silly window syndrome. + */ + if (win < (long)(so->so_rcv.sb_hiwat / 4) && win < (long)tp->t_maxseg) + win = 0; + if (win < (long)(tp->rcv_adv - tp->rcv_nxt)) + win = (long)(tp->rcv_adv - tp->rcv_nxt); + if (win > (long)TCP_MAXWIN << tp->rcv_scale) + win = (long)TCP_MAXWIN << tp->rcv_scale; + th->th_win = htons((u_short) (win>>tp->rcv_scale)); + if (SEQ_GT(tp->snd_up, tp->snd_nxt)) { + th->th_urp = htons((u_short)(tp->snd_up - tp->snd_nxt)); + th->th_flags |= TH_URG; + } else + /* + * If no urgent pointer to send, then we pull + * the urgent pointer to the left edge of the send window + * so that it doesn't drift into the send window on sequence + * number wraparound. + */ + tp->snd_up = tp->snd_una; /* drag it along */ + + /* + * Put TCP length in extended header, and then + * checksum extended header and data. + */ + m->m_pkthdr.len = hdrlen + len; /* in6_cksum() need this */ +#ifdef INET6 + if (isipv6) + /* + * ip6_plen is not need to be filled now, and will be filled + * in ip6_output. + */ + th->th_sum = in6_cksum(m, IPPROTO_TCP, sizeof(struct ip6_hdr), + sizeof(struct tcphdr) + optlen + len); + else +#endif /* INET6 */ + { + m->m_pkthdr.csum_flags = CSUM_TCP; + m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum); + if (len + optlen) + th->th_sum = in_addword(th->th_sum, + htons((u_short)(optlen + len))); + + /* IP version must be set here for ipv4/ipv6 checking later */ + } + + /* + * In transmit state, time the transmission and arrange for + * the retransmit. In persist state, just set snd_max. + */ + if (tp->t_force == 0 || !callout_active(tp->tt_persist)) { + tcp_seq startseq = tp->snd_nxt; + + /* + * Advance snd_nxt over sequence space of this segment. + */ + if (flags & (TH_SYN|TH_FIN)) { + if (flags & TH_SYN) + tp->snd_nxt++; + if (flags & TH_FIN) { + tp->snd_nxt++; + tp->t_flags |= TF_SENTFIN; + } + } + tp->snd_nxt += len; + if (SEQ_GT(tp->snd_nxt, tp->snd_max)) { + tp->snd_max = tp->snd_nxt; + /* + * Time this transmission if not a retransmission and + * not currently timing anything. + */ + if (tp->t_rtttime == 0) { + tp->t_rtttime = ticks; + tp->t_rtseq = startseq; + tcpstat.tcps_segstimed++; + } + } + + /* + * Set retransmit timer if not currently set, + * and not doing an ack or a keep-alive probe. + * Initial value for retransmit timer is smoothed + * round-trip time + 2 * round-trip time variance. + * Initialize shift counter which is used for backoff + * of retransmit time. + */ + if (!callout_active(tp->tt_rexmt) && + tp->snd_nxt != tp->snd_una) { + if (callout_active(tp->tt_persist)) { + callout_stop(tp->tt_persist); + tp->t_rxtshift = 0; + } + callout_reset(tp->tt_rexmt, tp->t_rxtcur, + tcp_timer_rexmt, tp); + } + } else + if (SEQ_GT(tp->snd_nxt + len, tp->snd_max)) + tp->snd_max = tp->snd_nxt + len; + +#ifdef TCPDEBUG + /* + * Trace. + */ + if (so->so_options & SO_DEBUG) + tcp_trace(TA_OUTPUT, tp->t_state, tp, mtod(m, void *), th, 0); +#endif + + /* + * Fill in IP length and desired time to live and + * send to IP level. There should be a better way + * to handle ttl and tos; we could keep them in + * the template, but need a way to checksum without them. + */ + /* + * m->m_pkthdr.len should have been set before cksum calcuration, + * because in6_cksum() need it. + */ +#ifdef INET6 + if (isipv6) { + /* + * we separately set hoplimit for every segment, since the + * user might want to change the value via setsockopt. + * Also, desired default hop limit might be changed via + * Neighbor Discovery. + */ + ip6->ip6_hlim = in6_selecthlim(tp->t_inpcb, + tp->t_inpcb->in6p_route.ro_rt ? + tp->t_inpcb->in6p_route.ro_rt->rt_ifp + : NULL); + + /* TODO: IPv6 IP6TOS_ECT bit on */ +#ifdef IPSEC + if (ipsec_setsocket(m, so) != 0) { + m_freem(m); + error = ENOBUFS; + goto out; + } +#endif /*IPSEC*/ + error = ip6_output(m, + tp->t_inpcb->in6p_outputopts, + &tp->t_inpcb->in6p_route, + (so->so_options & SO_DONTROUTE), NULL, NULL); + } else +#endif /* INET6 */ + { + struct rtentry *rt; + ip->ip_len = m->m_pkthdr.len; +#ifdef INET6 + if (INP_CHECK_SOCKAF(so, AF_INET6)) + ip->ip_ttl = in6_selecthlim(tp->t_inpcb, + tp->t_inpcb->in6p_route.ro_rt ? + tp->t_inpcb->in6p_route.ro_rt->rt_ifp + : NULL); + else +#endif /* INET6 */ + ip->ip_ttl = tp->t_inpcb->inp_ip_ttl; /* XXX */ + ip->ip_tos = tp->t_inpcb->inp_ip_tos; /* XXX */ + /* + * See if we should do MTU discovery. We do it only if the following + * are true: + * 1) we have a valid route to the destination + * 2) the MTU is not locked (if it is, then discovery has been + * disabled) + */ + if (path_mtu_discovery + && (rt = tp->t_inpcb->inp_route.ro_rt) + && rt->rt_flags & RTF_UP + && !(rt->rt_rmx.rmx_locks & RTV_MTU)) { + ip->ip_off |= IP_DF; + } +#ifdef IPSEC + ipsec_setsocket(m, so); +#endif /*IPSEC*/ + error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route, + (so->so_options & SO_DONTROUTE), 0); + } + if (error) { + + /* + * We know that the packet was lost, so back out the + * sequence number advance, if any. + */ + if (tp->t_force == 0 || !callout_active(tp->tt_persist)) { + /* + * No need to check for TH_FIN here because + * the TF_SENTFIN flag handles that case. + */ + if ((flags & TH_SYN) == 0) + tp->snd_nxt -= len; + } + +out: + if (error == ENOBUFS) { + if (!callout_active(tp->tt_rexmt) && + !callout_active(tp->tt_persist)) + callout_reset(tp->tt_rexmt, tp->t_rxtcur, + tcp_timer_rexmt, tp); + tcp_quench(tp->t_inpcb, 0); + return (0); + } + if (error == EMSGSIZE) { + /* + * ip_output() will have already fixed the route + * for us. tcp_mtudisc() will, as its last action, + * initiate retransmission, so it is important to + * not do so here. + */ + tcp_mtudisc(tp->t_inpcb, 0); + return 0; + } + if ((error == EHOSTUNREACH || error == ENETDOWN) + && TCPS_HAVERCVDSYN(tp->t_state)) { + tp->t_softerror = error; + return (0); + } + return (error); + } + tcpstat.tcps_sndtotal++; + + /* + * Data sent (as far as we can tell). + * If this advertises a larger window than any other segment, + * then remember the size of the advertised window. + * Any pending ACK has now been sent. + */ + if (win > 0 && SEQ_GT(tp->rcv_nxt+win, tp->rcv_adv)) + tp->rcv_adv = tp->rcv_nxt + win; + tp->last_ack_sent = tp->rcv_nxt; + tp->t_flags &= ~TF_ACKNOW; + if (tcp_delack_enabled) + callout_stop(tp->tt_delack); + if (sendalot && (!tcp_do_newreno || --maxburst)) + goto again; + return (0); +} + +void +tcp_setpersist(tp) + register struct tcpcb *tp; +{ + int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1; + int tt; + + if (callout_active(tp->tt_rexmt)) + panic("tcp_setpersist: retransmit pending"); + /* + * Start/restart persistance timer. + */ + TCPT_RANGESET(tt, t * tcp_backoff[tp->t_rxtshift], + TCPTV_PERSMIN, TCPTV_PERSMAX); + callout_reset(tp->tt_persist, tt, tcp_timer_persist, tp); + if (tp->t_rxtshift < TCP_MAXRXTSHIFT) + tp->t_rxtshift++; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_subr.c b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_subr.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_subr.c @@ -0,0 +1,1269 @@ +//========================================================================== +// +// src/sys/netinet/tcp_subr.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.73.2.22 2001/08/22 00:59:12 silby Exp $ + */ + +#include +#include +#include +#ifdef INET6 +#include +#endif +#include +#include +#include + +#include +#include + +#define _IP_VHL +#include +#include +#include +#ifdef INET6 +#include +#endif +#include +#ifdef INET6 +#include +#endif +#include +#include +#ifdef INET6 +#include +#endif +#include +#include +#include +#include +#include +#ifdef INET6 +#include +#include +#endif +#include +#ifdef TCPDEBUG +#include +#endif + +#ifdef IPSEC +#include +#endif /*IPSEC*/ + +#include + +int tcp_mssdflt = TCP_MSS; + +#ifdef INET6 +int tcp_v6mssdflt = TCP6_MSS; +#endif + +#if 0 +static int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ; +#endif + +static int tcp_do_rfc1323 = 1; +static int tcp_do_rfc1644 = 0; +static int tcp_tcbhashsize = 0; +static int do_tcpdrain = 1; +static int icmp_may_rst = 1; +static int tcp_strict_rfc1948 = 0; +static int tcp_isn_reseed_interval = 0; +static void tcp_cleartaocache __P((void)); +static void tcp_notify __P((struct inpcb *, int)); + +/* + * Target size of TCP PCB hash tables. Must be a power of two. + * + * Note that this can be overridden by the kernel environment + * variable net.inet.tcp.tcbhashsize + */ +#ifndef TCBHASHSIZE +#define TCBHASHSIZE 512 +#endif + +/* + * This is the actual shape of what we allocate using the zone + * allocator. Doing it this way allows us to protect both structures + * using the same generation count, and also eliminates the overhead + * of allocating tcpcbs separately. By hiding the structure here, + * we avoid changing most of the rest of the code (although it needs + * to be changed, eventually, for greater efficiency). + */ +#define ALIGNMENT 32 +#define ALIGNM1 (ALIGNMENT - 1) +struct inp_tp { + union { + struct inpcb inp; + char align[(sizeof(struct inpcb) + ALIGNM1) & ~ALIGNM1]; + } inp_tp_u; + struct tcpcb tcb; + struct callout inp_tp_rexmt, inp_tp_persist, inp_tp_keep, inp_tp_2msl; + struct callout inp_tp_delack; +}; +#undef ALIGNMENT +#undef ALIGNM1 + +/* + * Tcp initialization + */ +void +tcp_init() +{ + int hashsize = TCBHASHSIZE; + + tcp_ccgen = 1; + tcp_cleartaocache(); + + tcp_delacktime = TCPTV_DELACK; + tcp_keepinit = TCPTV_KEEP_INIT; + tcp_keepidle = TCPTV_KEEP_IDLE; + tcp_keepintvl = TCPTV_KEEPINTVL; + tcp_maxpersistidle = TCPTV_KEEP_IDLE; + tcp_msl = TCPTV_MSL; + + LIST_INIT(&tcb); + tcbinfo.listhead = &tcb; + tcp_tcbhashsize = hashsize; + tcbinfo.hashbase = hashinit(hashsize, M_PCB, &tcbinfo.hashmask); + tcbinfo.porthashbase = hashinit(hashsize, M_PCB, + &tcbinfo.porthashmask); + tcbinfo.ipi_zone = zinit("tcpcb", sizeof(struct inp_tp), maxsockets, + ZONE_INTERRUPT, 0); +#ifdef INET6 +#define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr)) +#else /* INET6 */ +#define TCP_MINPROTOHDR (sizeof(struct tcpiphdr)) +#endif /* INET6 */ + if (max_protohdr < TCP_MINPROTOHDR) + max_protohdr = TCP_MINPROTOHDR; + if (max_linkhdr + TCP_MINPROTOHDR > MHLEN) + panic("tcp_init"); +#undef TCP_MINPROTOHDR +} + +/* + * Fill in the IP and TCP headers for an outgoing packet, given the tcpcb. + * tcp_template used to store this data in mbufs, but we now recopy it out + * of the tcpcb each time to conserve mbufs. + */ +void +tcp_fillheaders(tp, ip_ptr, tcp_ptr) + struct tcpcb *tp; + void *ip_ptr; + void *tcp_ptr; +{ + struct inpcb *inp = tp->t_inpcb; + struct tcphdr *tcp_hdr = (struct tcphdr *)tcp_ptr; + +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV6) != 0) { + struct ip6_hdr *ip6; + + ip6 = (struct ip6_hdr *)ip_ptr; + ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) | + (inp->in6p_flowinfo & IPV6_FLOWINFO_MASK); + ip6->ip6_vfc = (ip6->ip6_vfc & ~IPV6_VERSION_MASK) | + (IPV6_VERSION & IPV6_VERSION_MASK); + ip6->ip6_nxt = IPPROTO_TCP; + ip6->ip6_plen = sizeof(struct tcphdr); + ip6->ip6_src = inp->in6p_laddr; + ip6->ip6_dst = inp->in6p_faddr; + tcp_hdr->th_sum = 0; + } else +#endif + { + struct ip *ip = (struct ip *) ip_ptr; + + ip->ip_vhl = IP_VHL_BORING; + ip->ip_tos = 0; + ip->ip_len = 0; + ip->ip_id = 0; + ip->ip_off = 0; + ip->ip_ttl = 0; + ip->ip_sum = 0; + ip->ip_p = IPPROTO_TCP; + ip->ip_src = inp->inp_laddr; + ip->ip_dst = inp->inp_faddr; + tcp_hdr->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, + htons(sizeof(struct tcphdr) + IPPROTO_TCP)); + } + + tcp_hdr->th_sport = inp->inp_lport; + tcp_hdr->th_dport = inp->inp_fport; + tcp_hdr->th_seq = 0; + tcp_hdr->th_ack = 0; + tcp_hdr->th_x2 = 0; + tcp_hdr->th_off = 5; + tcp_hdr->th_flags = 0; + tcp_hdr->th_win = 0; + tcp_hdr->th_urp = 0; +} + +/* + * Create template to be used to send tcp packets on a connection. + * Allocates an mbuf and fills in a skeletal tcp/ip header. The only + * use for this function is in keepalives, which use tcp_respond. + */ +struct tcptemp * +tcp_maketemplate(tp) + struct tcpcb *tp; +{ + struct mbuf *m; + struct tcptemp *n; + + m = m_get(M_DONTWAIT, MT_HEADER); + if (m == NULL) + return (0); + m->m_len = sizeof(struct tcptemp); + n = mtod(m, struct tcptemp *); + + tcp_fillheaders(tp, (void *)&n->tt_ipgen, (void *)&n->tt_t); + return (n); +} + +/* + * Send a single message to the TCP at address specified by + * the given TCP/IP header. If m == 0, then we make a copy + * of the tcpiphdr at ti and send directly to the addressed host. + * This is used to force keep alive messages out using the TCP + * template for a connection. If flags are given then we send + * a message back to the TCP which originated the * segment ti, + * and discard the mbuf containing it and any other attached mbufs. + * + * In any case the ack and sequence number of the transmitted + * segment are as specified by the parameters. + * + * NOTE: If m != NULL, then ti must point to *inside* the mbuf. + */ +void +tcp_respond(tp, ipgen, th, m, ack, seq, flags) + struct tcpcb *tp; + void *ipgen; + register struct tcphdr *th; + register struct mbuf *m; + tcp_seq ack, seq; + int flags; +{ + register int tlen; + int win = 0; + struct route *ro = 0; + struct route sro; + struct ip *ip; + struct tcphdr *nth; +#ifdef INET6 +#ifdef NEW_STRUCT_ROUTE + struct route *ro6 = 0; + struct route sro6; +#else + struct route_in6 *ro6 = 0; + struct route_in6 sro6; +#endif + struct ip6_hdr *ip6; + int isipv6; +#endif /* INET6 */ + int ipflags = 0; + +#ifdef INET6 + isipv6 = IP_VHL_V(((struct ip *)ipgen)->ip_vhl) == 6; + ip6 = ipgen; +#endif /* INET6 */ + ip = ipgen; + + if (tp) { + if (!(flags & TH_RST)) { + win = sbspace(&tp->t_inpcb->inp_socket->so_rcv); + if (win > (long)TCP_MAXWIN << tp->rcv_scale) + win = (long)TCP_MAXWIN << tp->rcv_scale; + } +#ifdef INET6 + if (isipv6) + ro6 = &tp->t_inpcb->in6p_route; + else +#endif /* INET6 */ + ro = &tp->t_inpcb->inp_route; + } else { +#ifdef INET6 + if (isipv6) { + ro6 = &sro6; + bzero(ro6, sizeof *ro6); + } else +#endif /* INET6 */ + { + ro = &sro; + bzero(ro, sizeof *ro); + } + } + if (m == 0) { + m = m_gethdr(M_DONTWAIT, MT_HEADER); + if (m == NULL) + return; + tlen = 0; + m->m_data += max_linkhdr; +#ifdef INET6 + if (isipv6) { + bcopy((caddr_t)ip6, mtod(m, caddr_t), + sizeof(struct ip6_hdr)); + ip6 = mtod(m, struct ip6_hdr *); + nth = (struct tcphdr *)(ip6 + 1); + } else +#endif /* INET6 */ + { + bcopy((caddr_t)ip, mtod(m, caddr_t), sizeof(struct ip)); + ip = mtod(m, struct ip *); + nth = (struct tcphdr *)(ip + 1); + } + bcopy((caddr_t)th, (caddr_t)nth, sizeof(struct tcphdr)); + flags = TH_ACK; + } else { + m_freem(m->m_next); + m->m_next = 0; + m->m_data = (caddr_t)ipgen; + /* m_len is set later */ + tlen = 0; +#define xchg(a,b,type) { type t; t=a; a=b; b=t; } +#ifdef INET6 + if (isipv6) { + xchg(ip6->ip6_dst, ip6->ip6_src, struct in6_addr); + nth = (struct tcphdr *)(ip6 + 1); + } else +#endif /* INET6 */ + { + xchg(ip->ip_dst.s_addr, ip->ip_src.s_addr, n_long); + nth = (struct tcphdr *)(ip + 1); + } + if (th != nth) { + /* + * this is usually a case when an extension header + * exists between the IPv6 header and the + * TCP header. + */ + nth->th_sport = th->th_sport; + nth->th_dport = th->th_dport; + } + xchg(nth->th_dport, nth->th_sport, n_short); +#undef xchg + } +#ifdef INET6 + if (isipv6) { + ip6->ip6_plen = htons((u_short)(sizeof (struct tcphdr) + + tlen)); + tlen += sizeof (struct ip6_hdr) + sizeof (struct tcphdr); + } else +#endif + { + tlen += sizeof (struct tcpiphdr); + ip->ip_len = tlen; + ip->ip_ttl = ip_defttl; + } + m->m_len = tlen; + m->m_pkthdr.len = tlen; + m->m_pkthdr.rcvif = (struct ifnet *) 0; + nth->th_seq = htonl(seq); + nth->th_ack = htonl(ack); + nth->th_x2 = 0; + nth->th_off = sizeof (struct tcphdr) >> 2; + nth->th_flags = flags; + if (tp) + nth->th_win = htons((u_short) (win >> tp->rcv_scale)); + else + nth->th_win = htons((u_short)win); + nth->th_urp = 0; +#ifdef INET6 + if (isipv6) { + nth->th_sum = 0; + nth->th_sum = in6_cksum(m, IPPROTO_TCP, + sizeof(struct ip6_hdr), + tlen - sizeof(struct ip6_hdr)); + ip6->ip6_hlim = in6_selecthlim(tp ? tp->t_inpcb : NULL, + ro6 && ro6->ro_rt ? + ro6->ro_rt->rt_ifp : + NULL); + } else +#endif /* INET6 */ + { + nth->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, + htons((u_short)(tlen - sizeof(struct ip) + ip->ip_p))); + m->m_pkthdr.csum_flags = CSUM_TCP; + m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum); + } +#ifdef TCPDEBUG + if (tp == NULL || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) + tcp_trace(TA_OUTPUT, 0, tp, mtod(m, void *), th, 0); +#endif +#ifdef IPSEC + if (ipsec_setsocket(m, tp ? tp->t_inpcb->inp_socket : NULL) != 0) { + m_freem(m); + return; + } +#endif +#ifdef INET6 + if (isipv6) { + (void)ip6_output(m, NULL, ro6, ipflags, NULL, NULL); + if (ro6 == &sro6 && ro6->ro_rt) { + RTFREE(ro6->ro_rt); + ro6->ro_rt = NULL; + } + } else +#endif /* INET6 */ + { + (void) ip_output(m, NULL, ro, ipflags, NULL); + if (ro == &sro && ro->ro_rt) { + RTFREE(ro->ro_rt); + ro->ro_rt = NULL; + } + } +} + +/* + * Create a new TCP control block, making an + * empty reassembly queue and hooking it to the argument + * protocol control block. The `inp' parameter must have + * come from the zone allocator set up in tcp_init(). + */ +struct tcpcb * +tcp_newtcpcb(inp) + struct inpcb *inp; +{ + struct inp_tp *it; + register struct tcpcb *tp; +#ifdef INET6 + int isipv6 = (inp->inp_vflag & INP_IPV6) != 0; +#endif /* INET6 */ + + it = (struct inp_tp *)inp; + tp = &it->tcb; + bzero((char *) tp, sizeof(struct tcpcb)); + LIST_INIT(&tp->t_segq); + tp->t_maxseg = tp->t_maxopd = +#ifdef INET6 + isipv6 ? tcp_v6mssdflt : +#endif /* INET6 */ + tcp_mssdflt; + + /* Set up our timeouts. */ + callout_init(tp->tt_rexmt = &it->inp_tp_rexmt); + callout_init(tp->tt_persist = &it->inp_tp_persist); + callout_init(tp->tt_keep = &it->inp_tp_keep); + callout_init(tp->tt_2msl = &it->inp_tp_2msl); + callout_init(tp->tt_delack = &it->inp_tp_delack); + + if (tcp_do_rfc1323) + tp->t_flags = (TF_REQ_SCALE|TF_REQ_TSTMP); + if (tcp_do_rfc1644) + tp->t_flags |= TF_REQ_CC; + tp->t_inpcb = inp; /* XXX */ + /* + * Init srtt to TCPTV_SRTTBASE (0), so we can tell that we have no + * rtt estimate. Set rttvar so that srtt + 4 * rttvar gives + * reasonable initial retransmit time. + */ + tp->t_srtt = TCPTV_SRTTBASE; + tp->t_rttvar = ((TCPTV_RTOBASE - TCPTV_SRTTBASE) << TCP_RTTVAR_SHIFT) / 4; + tp->t_rttmin = TCPTV_MIN; + tp->t_rxtcur = TCPTV_RTOBASE; + tp->snd_cwnd = TCP_MAXWIN << TCP_MAX_WINSHIFT; + tp->snd_ssthresh = TCP_MAXWIN << TCP_MAX_WINSHIFT; + tp->t_rcvtime = ticks; + /* + * IPv4 TTL initialization is necessary for an IPv6 socket as well, + * because the socket may be bound to an IPv6 wildcard address, + * which may match an IPv4-mapped IPv6 address. + */ + inp->inp_ip_ttl = ip_defttl; + inp->inp_ppcb = (caddr_t)tp; + return (tp); /* XXX */ +} + +/* + * Drop a TCP connection, reporting + * the specified error. If connection is synchronized, + * then send a RST to peer. + */ +struct tcpcb * +tcp_drop(tp, errno) + register struct tcpcb *tp; + int errno; +{ + struct socket *so = tp->t_inpcb->inp_socket; + + if (TCPS_HAVERCVDSYN(tp->t_state)) { + tp->t_state = TCPS_CLOSED; + (void) tcp_output(tp); + tcpstat.tcps_drops++; + } else + tcpstat.tcps_conndrops++; + if (errno == ETIMEDOUT && tp->t_softerror) + errno = tp->t_softerror; + so->so_error = errno; + return (tcp_close(tp)); +} + +/* + * Close a TCP control block: + * discard all space held by the tcp + * discard internet protocol block + * wake up any sleepers + */ +struct tcpcb * +tcp_close(tp) + register struct tcpcb *tp; +{ + register struct tseg_qent *q; + struct inpcb *inp = tp->t_inpcb; + struct socket *so = inp->inp_socket; +#ifdef INET6 + int isipv6 = (inp->inp_vflag & INP_IPV6) != 0; +#endif /* INET6 */ + register struct rtentry *rt; + int dosavessthresh; + + /* + * Make sure that all of our timers are stopped before we + * delete the PCB. + */ + callout_stop(tp->tt_rexmt); + callout_stop(tp->tt_persist); + callout_stop(tp->tt_keep); + callout_stop(tp->tt_2msl); + callout_stop(tp->tt_delack); + + /* + * If we got enough samples through the srtt filter, + * save the rtt and rttvar in the routing entry. + * 'Enough' is arbitrarily defined as the 16 samples. + * 16 samples is enough for the srtt filter to converge + * to within 5% of the correct value; fewer samples and + * we could save a very bogus rtt. + * + * Don't update the default route's characteristics and don't + * update anything that the user "locked". + */ + if (tp->t_rttupdated >= 16) { + register u_long i = 0; +#ifdef INET6 + if (isipv6) { + struct sockaddr_in6 *sin6; + + if ((rt = inp->in6p_route.ro_rt) == NULL) + goto no_valid_rt; + sin6 = (struct sockaddr_in6 *)rt_key(rt); + if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) + goto no_valid_rt; + } + else +#endif /* INET6 */ + if ((rt = inp->inp_route.ro_rt) == NULL || + ((struct sockaddr_in *)rt_key(rt))->sin_addr.s_addr + == INADDR_ANY) + goto no_valid_rt; + + if ((rt->rt_rmx.rmx_locks & RTV_RTT) == 0) { + i = tp->t_srtt * + (RTM_RTTUNIT / (hz * TCP_RTT_SCALE)); + if (rt->rt_rmx.rmx_rtt && i) + /* + * filter this update to half the old & half + * the new values, converting scale. + * See route.h and tcp_var.h for a + * description of the scaling constants. + */ + rt->rt_rmx.rmx_rtt = + (rt->rt_rmx.rmx_rtt + i) / 2; + else + rt->rt_rmx.rmx_rtt = i; + tcpstat.tcps_cachedrtt++; + } + if ((rt->rt_rmx.rmx_locks & RTV_RTTVAR) == 0) { + i = tp->t_rttvar * + (RTM_RTTUNIT / (hz * TCP_RTTVAR_SCALE)); + if (rt->rt_rmx.rmx_rttvar && i) + rt->rt_rmx.rmx_rttvar = + (rt->rt_rmx.rmx_rttvar + i) / 2; + else + rt->rt_rmx.rmx_rttvar = i; + tcpstat.tcps_cachedrttvar++; + } + /* + * The old comment here said: + * update the pipelimit (ssthresh) if it has been updated + * already or if a pipesize was specified & the threshhold + * got below half the pipesize. I.e., wait for bad news + * before we start updating, then update on both good + * and bad news. + * + * But we want to save the ssthresh even if no pipesize is + * specified explicitly in the route, because such + * connections still have an implicit pipesize specified + * by the global tcp_sendspace. In the absence of a reliable + * way to calculate the pipesize, it will have to do. + */ + i = tp->snd_ssthresh; + if (rt->rt_rmx.rmx_sendpipe != 0) + dosavessthresh = (i < rt->rt_rmx.rmx_sendpipe / 2); + else + dosavessthresh = (i < so->so_snd.sb_hiwat / 2); + if (((rt->rt_rmx.rmx_locks & RTV_SSTHRESH) == 0 && + i != 0 && rt->rt_rmx.rmx_ssthresh != 0) + || dosavessthresh) { + /* + * convert the limit from user data bytes to + * packets then to packet data bytes. + */ + i = (i + tp->t_maxseg / 2) / tp->t_maxseg; + if (i < 2) + i = 2; + i *= (u_long)(tp->t_maxseg + +#ifdef INET6 + (isipv6 ? sizeof (struct ip6_hdr) + + sizeof (struct tcphdr) : +#endif + sizeof (struct tcpiphdr) +#ifdef INET6 + ) +#endif + ); + if (rt->rt_rmx.rmx_ssthresh) + rt->rt_rmx.rmx_ssthresh = + (rt->rt_rmx.rmx_ssthresh + i) / 2; + else + rt->rt_rmx.rmx_ssthresh = i; + tcpstat.tcps_cachedssthresh++; + } + } + rt = inp->inp_route.ro_rt; + if (rt) { + /* + * mark route for deletion if no information is + * cached. + */ + if ((tp->t_flags & TF_LQ_OVERFLOW) && + ((rt->rt_rmx.rmx_locks & RTV_RTT) == 0)){ + if (rt->rt_rmx.rmx_rtt == 0) + rt->rt_flags |= RTF_DELCLONE; + } + } + no_valid_rt: + /* free the reassembly queue, if any */ + while((q = LIST_FIRST(&tp->t_segq)) != NULL) { + LIST_REMOVE(q, tqe_q); + m_freem(q->tqe_m); + FREE(q, M_TSEGQ); + } + inp->inp_ppcb = NULL; + soisdisconnected(so); +#ifdef INET6 + if (INP_CHECK_SOCKAF(so, AF_INET6)) + in6_pcbdetach(inp); + else +#endif /* INET6 */ + in_pcbdetach(inp); + tcpstat.tcps_closed++; + return ((struct tcpcb *)0); +} + +void +tcp_drain() +{ + if (do_tcpdrain) + { + struct inpcb *inpb; + struct tcpcb *tcpb; + struct tseg_qent *te; + + /* + * Walk the tcpbs, if existing, and flush the reassembly queue, + * if there is one... + * XXX: The "Net/3" implementation doesn't imply that the TCP + * reassembly queue should be flushed, but in a situation + * where we're really low on mbufs, this is potentially + * usefull. + */ + for (inpb = LIST_FIRST(tcbinfo.listhead); inpb; + inpb = LIST_NEXT(inpb, inp_list)) { + if ((tcpb = intotcpcb(inpb))) { + while ((te = LIST_FIRST(&tcpb->t_segq)) + != NULL) { + LIST_REMOVE(te, tqe_q); + m_freem(te->tqe_m); + FREE(te, M_TSEGQ); + } + } + } + + } +} + +/* + * Notify a tcp user of an asynchronous error; + * store error as soft error, but wake up user + * (for now, won't do anything until can select for soft error). + * + * Do not wake up user since there currently is no mechanism for + * reporting soft errors (yet - a kqueue filter may be added). + */ +static void +tcp_notify(inp, error) + struct inpcb *inp; + int error; +{ + struct tcpcb *tp = (struct tcpcb *)inp->inp_ppcb; + + /* + * Ignore some errors if we are hooked up. + * If connection hasn't completed, has retransmitted several times, + * and receives a second error, give up now. This is better + * than waiting a long time to establish a connection that + * can never complete. + */ + if (tp->t_state == TCPS_ESTABLISHED && + (error == EHOSTUNREACH || error == ENETUNREACH || + error == EHOSTDOWN)) { + return; + } else if (tp->t_state < TCPS_ESTABLISHED && tp->t_rxtshift > 3 && + tp->t_softerror) + tcp_drop(tp, error); + else + tp->t_softerror = error; +#if 0 + wakeup((caddr_t) &so->so_timeo); + sorwakeup(so); + sowwakeup(so); +#endif +} + +void +tcp_ctlinput(cmd, sa, vip) + int cmd; + struct sockaddr *sa; + void *vip; +{ + struct ip *ip = vip; + struct tcphdr *th; + struct in_addr faddr; + struct inpcb *inp; + struct tcpcb *tp; + void (*notify) __P((struct inpcb *, int)) = tcp_notify; + tcp_seq icmp_seq; + int s; + + faddr = ((struct sockaddr_in *)sa)->sin_addr; + if (sa->sa_family != AF_INET || faddr.s_addr == INADDR_ANY) + return; + + if (cmd == PRC_QUENCH) + notify = tcp_quench; + else if (icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB || + cmd == PRC_UNREACH_PORT) && ip) + notify = tcp_drop_syn_sent; + else if (cmd == PRC_MSGSIZE) + notify = tcp_mtudisc; + else if (PRC_IS_REDIRECT(cmd)) { + ip = 0; + notify = in_rtchange; + } else if (cmd == PRC_HOSTDEAD) + ip = 0; + else if ((unsigned)cmd > PRC_NCMDS || inetctlerrmap[cmd] == 0) + return; + if (ip) { + s = splnet(); + th = (struct tcphdr *)((caddr_t)ip + + (IP_VHL_HL(ip->ip_vhl) << 2)); + inp = in_pcblookup_hash(&tcbinfo, faddr, th->th_dport, + ip->ip_src, th->th_sport, 0, NULL); + if (inp != NULL && inp->inp_socket != NULL) { + icmp_seq = htonl(th->th_seq); + tp = intotcpcb(inp); + if (SEQ_GEQ(icmp_seq, tp->snd_una) && + SEQ_LT(icmp_seq, tp->snd_max)) + (*notify)(inp, inetctlerrmap[cmd]); + } + splx(s); + } else + in_pcbnotifyall(&tcb, faddr, inetctlerrmap[cmd], notify); +} + +#ifdef INET6 +void +tcp6_ctlinput(cmd, sa, d) + int cmd; + struct sockaddr *sa; + void *d; +{ + struct tcphdr th; + void (*notify) __P((struct inpcb *, int)) = tcp_notify; + struct ip6_hdr *ip6; + struct mbuf *m; + struct ip6ctlparam *ip6cp = NULL; + const struct sockaddr_in6 *sa6_src = NULL; + int off; + struct tcp_portonly { + u_int16_t th_sport; + u_int16_t th_dport; + } *thp; + + if (sa->sa_family != AF_INET6 || + sa->sa_len != sizeof(struct sockaddr_in6)) + return; + + if (cmd == PRC_QUENCH) + notify = tcp_quench; + else if (cmd == PRC_MSGSIZE) + notify = tcp_mtudisc; + else if (!PRC_IS_REDIRECT(cmd) && + ((unsigned)cmd > PRC_NCMDS || inet6ctlerrmap[cmd] == 0)) + return; + + /* if the parameter is from icmp6, decode it. */ + if (d != NULL) { + ip6cp = (struct ip6ctlparam *)d; + m = ip6cp->ip6c_m; + ip6 = ip6cp->ip6c_ip6; + off = ip6cp->ip6c_off; + sa6_src = ip6cp->ip6c_src; + } else { + m = NULL; + ip6 = NULL; + off = 0; /* fool gcc */ + sa6_src = &sa6_any; + } + + if (ip6) { + /* + * XXX: We assume that when IPV6 is non NULL, + * M and OFF are valid. + */ + + /* check if we can safely examine src and dst ports */ + if (m->m_pkthdr.len < off + sizeof(*thp)) + return; + + bzero(&th, sizeof(th)); + m_copydata(m, off, sizeof(*thp), (caddr_t)&th); + + in6_pcbnotify(&tcb, sa, th.th_dport, + (struct sockaddr *)ip6cp->ip6c_src, + th.th_sport, cmd, NULL, notify); + } else + in6_pcbnotify(&tcb, sa, 0, (struct sockaddr *)sa6_src, + 0, cmd, NULL, notify); +} +#endif /* INET6 */ + +/* + * Following is where TCP initial sequence number generation occurs. + * + * There are two places where we must use initial sequence numbers: + * 1. In SYN-ACK packets. + * 2. In SYN packets. + * + * The ISNs in SYN-ACK packets have no monotonicity requirement, + * and should be as unpredictable as possible to avoid the possibility + * of spoofing and/or connection hijacking. To satisfy this + * requirement, SYN-ACK ISNs are generated via the arc4random() + * function. If exact RFC 1948 compliance is requested via sysctl, + * these ISNs will be generated just like those in SYN packets. + * + * The ISNs in SYN packets must be monotonic; TIME_WAIT recycling + * depends on this property. In addition, these ISNs should be + * unguessable so as to prevent connection hijacking. To satisfy + * the requirements of this situation, the algorithm outlined in + * RFC 1948 is used to generate sequence numbers. + * + * For more information on the theory of operation, please see + * RFC 1948. + * + * Implementation details: + * + * Time is based off the system timer, and is corrected so that it + * increases by one megabyte per second. This allows for proper + * recycling on high speed LANs while still leaving over an hour + * before rollover. + * + * Two sysctls control the generation of ISNs: + * + * net.inet.tcp.isn_reseed_interval controls the number of seconds + * between seeding of isn_secret. This is normally set to zero, + * as reseeding should not be necessary. + * + * net.inet.tcp.strict_rfc1948 controls whether RFC 1948 is followed + * strictly. When strict compliance is requested, reseeding is + * disabled and SYN-ACKs will be generated in the same manner as + * SYNs. Strict mode is disabled by default. + * + */ + +#define ISN_BYTES_PER_SECOND 1048576 + +u_char isn_secret[32]; +int isn_last_reseed; +MD5_CTX isn_ctx; + +tcp_seq +tcp_new_isn(tp) + struct tcpcb *tp; +{ + u_int32_t md5_buffer[4]; + tcp_seq new_isn; + + /* Use arc4random for SYN-ACKs when not in exact RFC1948 mode. */ + if (((tp->t_state == TCPS_LISTEN) || (tp->t_state == TCPS_TIME_WAIT)) + && tcp_strict_rfc1948 == 0) + return arc4random(); + + /* Seed if this is the first use, reseed if requested. */ + if ((isn_last_reseed == 0) || + ((tcp_strict_rfc1948 == 0) && (tcp_isn_reseed_interval > 0) && + (((u_int)isn_last_reseed + (u_int)tcp_isn_reseed_interval*hz) + < (u_int)ticks))) { + read_random_unlimited(&isn_secret, sizeof(isn_secret)); + isn_last_reseed = ticks; + } + + /* Compute the md5 hash and return the ISN. */ + MD5Init(&isn_ctx); + MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_fport, sizeof(u_short)); + MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_lport, sizeof(u_short)); +#ifdef INET6 + if ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0) { + MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->in6p_faddr, + sizeof(struct in6_addr)); + MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->in6p_laddr, + sizeof(struct in6_addr)); + } else +#endif + { + MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_faddr, + sizeof(struct in_addr)); + MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_laddr, + sizeof(struct in_addr)); + } + MD5Update(&isn_ctx, (u_char *) &isn_secret, sizeof(isn_secret)); + MD5Final((u_char *) &md5_buffer, &isn_ctx); + new_isn = (tcp_seq) md5_buffer[0]; + new_isn += ticks * (ISN_BYTES_PER_SECOND / hz); + return new_isn; +} + +/* + * When a source quench is received, close congestion window + * to one segment. We will gradually open it again as we proceed. + */ +void +tcp_quench(inp, errno) + struct inpcb *inp; + int errno; +{ + struct tcpcb *tp = intotcpcb(inp); + + if (tp) + tp->snd_cwnd = tp->t_maxseg; +} + +/* + * When a specific ICMP unreachable message is received and the + * connection state is SYN-SENT, drop the connection. This behavior + * is controlled by the icmp_may_rst sysctl. + */ +void +tcp_drop_syn_sent(inp, errno) + struct inpcb *inp; + int errno; +{ + struct tcpcb *tp = intotcpcb(inp); + + if (tp && tp->t_state == TCPS_SYN_SENT) + tcp_drop(tp, errno); +} + +/* + * When `need fragmentation' ICMP is received, update our idea of the MSS + * based on the new value in the route. Also nudge TCP to send something, + * since we know the packet we just sent was dropped. + * This duplicates some code in the tcp_mss() function in tcp_input.c. + */ +void +tcp_mtudisc(inp, errno) + struct inpcb *inp; + int errno; +{ + struct tcpcb *tp = intotcpcb(inp); + struct rtentry *rt; + struct rmxp_tao *taop; + struct socket *so = inp->inp_socket; + int offered; + int mss; +#ifdef INET6 + int isipv6 = (tp->t_inpcb->inp_vflag & INP_IPV6) != 0; +#endif /* INET6 */ + + if (tp) { +#ifdef INET6 + if (isipv6) + rt = tcp_rtlookup6(inp); + else +#endif /* INET6 */ + rt = tcp_rtlookup(inp); + if (!rt || !rt->rt_rmx.rmx_mtu) { + tp->t_maxopd = tp->t_maxseg = +#ifdef INET6 + isipv6 ? tcp_v6mssdflt : +#endif /* INET6 */ + tcp_mssdflt; + return; + } + taop = rmx_taop(rt->rt_rmx); + offered = taop->tao_mssopt; + mss = rt->rt_rmx.rmx_mtu - +#ifdef INET6 + (isipv6 ? + sizeof(struct ip6_hdr) + sizeof(struct tcphdr) : +#endif /* INET6 */ + sizeof(struct tcpiphdr) +#ifdef INET6 + ) +#endif /* INET6 */ + ; + + if (offered) + mss = min(mss, offered); + /* + * XXX - The above conditional probably violates the TCP + * spec. The problem is that, since we don't know the + * other end's MSS, we are supposed to use a conservative + * default. But, if we do that, then MTU discovery will + * never actually take place, because the conservative + * default is much less than the MTUs typically seen + * on the Internet today. For the moment, we'll sweep + * this under the carpet. + * + * The conservative default might not actually be a problem + * if the only case this occurs is when sending an initial + * SYN with options and data to a host we've never talked + * to before. Then, they will reply with an MSS value which + * will get recorded and the new parameters should get + * recomputed. For Further Study. + */ + if (tp->t_maxopd <= mss) + return; + tp->t_maxopd = mss; + + if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP && + (tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP) + mss -= TCPOLEN_TSTAMP_APPA; + if ((tp->t_flags & (TF_REQ_CC|TF_NOOPT)) == TF_REQ_CC && + (tp->t_flags & TF_RCVD_CC) == TF_RCVD_CC) + mss -= TCPOLEN_CC_APPA; +#if (MCLBYTES & (MCLBYTES - 1)) == 0 + if (mss > MCLBYTES) + mss &= ~(MCLBYTES-1); +#else + if (mss > MCLBYTES) + mss = mss / MCLBYTES * MCLBYTES; +#endif + if (so->so_snd.sb_hiwat < mss) + mss = so->so_snd.sb_hiwat; + + tp->t_maxseg = mss; + + tcpstat.tcps_mturesent++; + tp->t_rtttime = 0; + tp->snd_nxt = tp->snd_una; + tcp_output(tp); + } +} + +/* + * Look-up the routing entry to the peer of this inpcb. If no route + * is found and it cannot be allocated the return NULL. This routine + * is called by TCP routines that access the rmx structure and by tcp_mss + * to get the interface MTU. + */ +struct rtentry * +tcp_rtlookup(inp) + struct inpcb *inp; +{ + struct route *ro; + struct rtentry *rt; + + ro = &inp->inp_route; + rt = ro->ro_rt; + if (rt == NULL || !(rt->rt_flags & RTF_UP)) { + /* No route yet, so try to acquire one */ + if (inp->inp_faddr.s_addr != INADDR_ANY) { + ro->ro_dst.sa_family = AF_INET; + ro->ro_dst.sa_len = sizeof(struct sockaddr_in); + ((struct sockaddr_in *) &ro->ro_dst)->sin_addr = + inp->inp_faddr; + rtalloc(ro); + rt = ro->ro_rt; + } + } + return rt; +} + +#ifdef INET6 +struct rtentry * +tcp_rtlookup6(inp) + struct inpcb *inp; +{ +#ifdef NEW_STRUCT_ROUTE + struct route *ro6; +#else + struct route_in6 *ro6; +#endif + struct rtentry *rt; + + ro6 = &inp->in6p_route; + rt = ro6->ro_rt; + if (rt == NULL || !(rt->rt_flags & RTF_UP)) { + /* No route yet, so try to acquire one */ + if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { + struct sockaddr_in6 *dst6; + + dst6 = (struct sockaddr_in6 *)&ro6->ro_dst; + dst6->sin6_family = AF_INET6; + dst6->sin6_len = sizeof(*dst6); + dst6->sin6_addr = inp->in6p_faddr; + rtalloc((struct route *)ro6); + rt = ro6->ro_rt; + } + } + return rt; +} +#endif /* INET6 */ + +#ifdef IPSEC +/* compute ESP/AH header size for TCP, including outer IP header. */ +size_t +ipsec_hdrsiz_tcp(tp) + struct tcpcb *tp; +{ + struct inpcb *inp; + struct mbuf *m; + size_t hdrsiz; + struct ip *ip; +#ifdef INET6 + struct ip6_hdr *ip6; +#endif /* INET6 */ + struct tcphdr *th; + + if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL)) + return 0; + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (!m) + return 0; + +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV6) != 0) { + ip6 = mtod(m, struct ip6_hdr *); + th = (struct tcphdr *)(ip6 + 1); + m->m_pkthdr.len = m->m_len = + sizeof(struct ip6_hdr) + sizeof(struct tcphdr); + tcp_fillheaders(tp, ip6, th); + hdrsiz = ipsec6_hdrsiz(m, IPSEC_DIR_OUTBOUND, inp); + } else +#endif /* INET6 */ + { + ip = mtod(m, struct ip *); + th = (struct tcphdr *)(ip + 1); + m->m_pkthdr.len = m->m_len = sizeof(struct tcpiphdr); + tcp_fillheaders(tp, ip, th); + hdrsiz = ipsec4_hdrsiz(m, IPSEC_DIR_OUTBOUND, inp); + } + + m_free(m); + return hdrsiz; +} +#endif /*IPSEC*/ + +/* + * Return a pointer to the cached information about the remote host. + * The cached information is stored in the protocol specific part of + * the route metrics. + */ +struct rmxp_tao * +tcp_gettaocache(inp) + struct inpcb *inp; +{ + struct rtentry *rt; + +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV6) != 0) + rt = tcp_rtlookup6(inp); + else +#endif /* INET6 */ + rt = tcp_rtlookup(inp); + + /* Make sure this is a host route and is up. */ + if (rt == NULL || + (rt->rt_flags & (RTF_UP|RTF_HOST)) != (RTF_UP|RTF_HOST)) + return NULL; + + return rmx_taop(rt->rt_rmx); +} + +/* + * Clear all the TAO cache entries, called from tcp_init. + * + * XXX + * This routine is just an empty one, because we assume that the routing + * routing tables are initialized at the same time when TCP, so there is + * nothing in the cache left over. + */ +static void +tcp_cleartaocache() +{ +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_timer.c b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_timer.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_timer.c @@ -0,0 +1,453 @@ +//========================================================================== +// +// src/sys/netinet/tcp_timer.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet/tcp_timer.c,v 1.34.2.11 2001/08/22 00:59:12 silby Exp $ + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#ifdef INET6 +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#ifdef TCPDEBUG +#include +#endif + +int tcp_keepinit; +int tcp_keepidle; +int tcp_keepintvl; +int tcp_delacktime; +int tcp_msl; +static int always_keepalive = 0; +static int tcp_keepcnt = TCPTV_KEEPCNT; + /* max idle probes */ +int tcp_maxpersistidle; + /* max idle time in persist */ +int tcp_maxidle; + +/* + * Tcp protocol timeout routine called every 500 ms. + * Updates timestamps used for TCP + * causes finite state machine actions if timers expire. + */ +void +tcp_slowtimo() +{ + int s; + + s = splnet(); + + tcp_maxidle = tcp_keepcnt * tcp_keepintvl; + + splx(s); +} + +/* + * Cancel all timers for TCP tp. + */ +void +tcp_canceltimers(tp) + struct tcpcb *tp; +{ + callout_stop(tp->tt_2msl); + callout_stop(tp->tt_persist); + callout_stop(tp->tt_keep); + callout_stop(tp->tt_rexmt); +} + +int tcp_syn_backoff[TCP_MAXRXTSHIFT + 1] = + { 1, 1, 1, 1, 1, 2, 4, 8, 16, 32, 64, 64, 64 }; + +int tcp_backoff[TCP_MAXRXTSHIFT + 1] = + { 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 }; + +static int tcp_totbackoff = 511; /* sum of tcp_backoff[] */ + +/* + * TCP timer processing. + */ +void +tcp_timer_delack(xtp) + void *xtp; +{ + struct tcpcb *tp = xtp; + int s; + + s = splnet(); + if (callout_pending(tp->tt_delack) || !callout_active(tp->tt_delack)) { + splx(s); + return; + } + callout_deactivate(tp->tt_delack); + + tp->t_flags |= TF_ACKNOW; + tcpstat.tcps_delack++; + (void) tcp_output(tp); + splx(s); +} + +void +tcp_timer_2msl(xtp) + void *xtp; +{ + struct tcpcb *tp = xtp; + int s; +#ifdef TCPDEBUG + int ostate; + + ostate = tp->t_state; +#endif + s = splnet(); + if (callout_pending(tp->tt_2msl) || !callout_active(tp->tt_2msl)) { + splx(s); + return; + } + callout_deactivate(tp->tt_2msl); + /* + * 2 MSL timeout in shutdown went off. If we're closed but + * still waiting for peer to close and connection has been idle + * too long, or if 2MSL time is up from TIME_WAIT, delete connection + * control block. Otherwise, check again in a bit. + */ + if (tp->t_state != TCPS_TIME_WAIT && + (ticks - tp->t_rcvtime) <= tcp_maxidle) { + callout_reset(tp->tt_2msl, tcp_keepintvl, + tcp_timer_2msl, tp); + } + else { + tp = tcp_close(tp); + } + +#ifdef TCPDEBUG + if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) + tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0, + PRU_SLOWTIMO); +#endif + splx(s); +} + +void +tcp_timer_keep(xtp) + void *xtp; +{ + struct tcpcb *tp = xtp; + struct tcptemp *t_template; + int s; +#ifdef TCPDEBUG + int ostate; + + ostate = tp->t_state; +#endif + s = splnet(); + if (callout_pending(tp->tt_keep) || !callout_active(tp->tt_keep)) { + splx(s); + return; + } + callout_deactivate(tp->tt_keep); + /* + * Keep-alive timer went off; send something + * or drop connection if idle for too long. + */ + tcpstat.tcps_keeptimeo++; + if (tp->t_state < TCPS_ESTABLISHED) + goto dropit; + if ((always_keepalive || + tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) && + tp->t_state <= TCPS_CLOSING) { + if ((ticks - tp->t_rcvtime) >= tcp_keepidle + tcp_maxidle) + goto dropit; + /* + * Send a packet designed to force a response + * if the peer is up and reachable: + * either an ACK if the connection is still alive, + * or an RST if the peer has closed the connection + * due to timeout or reboot. + * Using sequence number tp->snd_una-1 + * causes the transmitted zero-length segment + * to lie outside the receive window; + * by the protocol spec, this requires the + * correspondent TCP to respond. + */ + tcpstat.tcps_keepprobe++; + t_template = tcp_maketemplate(tp); + if (t_template) { + tcp_respond(tp, t_template->tt_ipgen, + &t_template->tt_t, (struct mbuf *)NULL, + tp->rcv_nxt, tp->snd_una - 1, 0); + (void) m_free(dtom(t_template)); + } + callout_reset(tp->tt_keep, tcp_keepintvl, tcp_timer_keep, tp); + } else + callout_reset(tp->tt_keep, tcp_keepidle, tcp_timer_keep, tp); + +#ifdef TCPDEBUG + if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) + tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0, + PRU_SLOWTIMO); +#endif + splx(s); + return; + +dropit: + tcpstat.tcps_keepdrops++; + tp = tcp_drop(tp, ETIMEDOUT); + +#ifdef TCPDEBUG + if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) + tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0, + PRU_SLOWTIMO); +#endif + splx(s); +} + +void +tcp_timer_persist(xtp) + void *xtp; +{ + struct tcpcb *tp = xtp; + int s; +#ifdef TCPDEBUG + int ostate; + + ostate = tp->t_state; +#endif + s = splnet(); + if (callout_pending(tp->tt_persist) || !callout_active(tp->tt_persist)){ + splx(s); + return; + } + callout_deactivate(tp->tt_persist); + /* + * Persistance timer into zero window. + * Force a byte to be output, if possible. + */ + tcpstat.tcps_persisttimeo++; + /* + * Hack: if the peer is dead/unreachable, we do not + * time out if the window is closed. After a full + * backoff, drop the connection if the idle time + * (no responses to probes) reaches the maximum + * backoff that we would use if retransmitting. + */ + if (tp->t_rxtshift == TCP_MAXRXTSHIFT && + ((ticks - tp->t_rcvtime) >= tcp_maxpersistidle || + (ticks - tp->t_rcvtime) >= TCP_REXMTVAL(tp) * tcp_totbackoff)) { + tcpstat.tcps_persistdrop++; + tp = tcp_drop(tp, ETIMEDOUT); + goto out; + } + tcp_setpersist(tp); + tp->t_force = 1; + (void) tcp_output(tp); + tp->t_force = 0; + +out: +#ifdef TCPDEBUG + if (tp && tp->t_inpcb->inp_socket->so_options & SO_DEBUG) + tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0, + PRU_SLOWTIMO); +#endif + splx(s); +} + +void +tcp_timer_rexmt(xtp) + void *xtp; +{ + struct tcpcb *tp = xtp; + int s; + int rexmt; +#ifdef TCPDEBUG + int ostate; + + ostate = tp->t_state; +#endif + s = splnet(); + if (callout_pending(tp->tt_rexmt) || !callout_active(tp->tt_rexmt)) { + splx(s); + return; + } + callout_deactivate(tp->tt_rexmt); + /* + * Retransmission timer went off. Message has not + * been acked within retransmit interval. Back off + * to a longer retransmit interval and retransmit one segment. + */ + if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) { + tp->t_rxtshift = TCP_MAXRXTSHIFT; + tcpstat.tcps_timeoutdrop++; + tp = tcp_drop(tp, tp->t_softerror ? + tp->t_softerror : ETIMEDOUT); + goto out; + } + if (tp->t_rxtshift == 1) { + /* + * first retransmit; record ssthresh and cwnd so they can + * be recovered if this turns out to be a "bad" retransmit. + * A retransmit is considered "bad" if an ACK for this + * segment is received within RTT/2 interval; the assumption + * here is that the ACK was already in flight. See + * "On Estimating End-to-End Network Path Properties" by + * Allman and Paxson for more details. + */ + tp->snd_cwnd_prev = tp->snd_cwnd; + tp->snd_ssthresh_prev = tp->snd_ssthresh; + tp->t_badrxtwin = ticks + (tp->t_srtt >> (TCP_RTT_SHIFT + 1)); + } + tcpstat.tcps_rexmttimeo++; + if (tp->t_state == TCPS_SYN_SENT) + rexmt = TCP_REXMTVAL(tp) * tcp_syn_backoff[tp->t_rxtshift]; + else + rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; + TCPT_RANGESET(tp->t_rxtcur, rexmt, + tp->t_rttmin, TCPTV_REXMTMAX); + /* + * Disable rfc1323 and rfc1644 if we havn't got any response to + * our third SYN to work-around some broken terminal servers + * (most of which have hopefully been retired) that have bad VJ + * header compression code which trashes TCP segments containing + * unknown-to-them TCP options. + */ + if ((tp->t_state == TCPS_SYN_SENT) && (tp->t_rxtshift == 3)) + tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP|TF_REQ_CC); + /* + * If losing, let the lower level know and try for + * a better route. Also, if we backed off this far, + * our srtt estimate is probably bogus. Clobber it + * so we'll take the next rtt measurement as our srtt; + * move the current srtt into rttvar to keep the current + * retransmit times until then. + */ + if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 4) { +#ifdef INET6 + if ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0) + in6_losing(tp->t_inpcb); + else +#endif + in_losing(tp->t_inpcb); + tp->t_rttvar += (tp->t_srtt >> TCP_RTT_SHIFT); + tp->t_srtt = 0; + } + tp->snd_nxt = tp->snd_una; + /* + * Note: We overload snd_recover to function also as the + * snd_last variable described in RFC 2582 + */ + tp->snd_recover = tp->snd_max; + /* + * Force a segment to be sent. + */ + tp->t_flags |= TF_ACKNOW; + /* + * If timing a segment in this window, stop the timer. + */ + tp->t_rtttime = 0; + /* + * Close the congestion window down to one segment + * (we'll open it by one segment for each ack we get). + * Since we probably have a window's worth of unacked + * data accumulated, this "slow start" keeps us from + * dumping all that data as back-to-back packets (which + * might overwhelm an intermediate gateway). + * + * There are two phases to the opening: Initially we + * open by one mss on each ack. This makes the window + * size increase exponentially with time. If the + * window is larger than the path can handle, this + * exponential growth results in dropped packet(s) + * almost immediately. To get more time between + * drops but still "push" the network to take advantage + * of improving conditions, we switch from exponential + * to linear window opening at some threshhold size. + * For a threshhold, we use half the current window + * size, truncated to a multiple of the mss. + * + * (the minimum cwnd that will give us exponential + * growth is 2 mss. We don't allow the threshhold + * to go below this.) + */ + { + u_int win = min(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_maxseg; + if (win < 2) + win = 2; + tp->snd_cwnd = tp->t_maxseg; + tp->snd_ssthresh = win * tp->t_maxseg; + tp->t_dupacks = 0; + } + (void) tcp_output(tp); + +out: +#ifdef TCPDEBUG + if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) + tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0, + PRU_SLOWTIMO); +#endif + splx(s); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_usrreq.c b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_usrreq.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/tcp_usrreq.c @@ -0,0 +1,1126 @@ +//========================================================================== +// +// src/sys/netinet/tcp_usrreq.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94 + * $FreeBSD: src/sys/netinet/tcp_usrreq.c,v 1.51.2.9 2001/08/22 00:59:12 silby Exp $ + */ + +#include +#include +#ifdef INET6 +#include +#endif /* INET6 */ +#include +#include +#include + +#include +#include + +#include +#include +#ifdef INET6 +#include +#endif +#include +#ifdef INET6 +#include +#endif +#include +#include +#ifdef INET6 +#include +#endif +#include +#include +#include +#include +#include +#include +#ifdef TCPDEBUG +#include +#endif + +#ifdef IPSEC +#include +#endif /*IPSEC*/ + +/* + * TCP protocol interface to socket abstraction. + */ +extern char *tcpstates[]; /* XXX ??? */ + +static int tcp_attach __P((struct socket *, struct proc *)); +static int tcp_connect __P((struct tcpcb *, struct sockaddr *, + struct proc *)); +#ifdef INET6 +static int tcp6_connect __P((struct tcpcb *, struct sockaddr *, + struct proc *)); +#endif /* INET6 */ +static struct tcpcb * + tcp_disconnect __P((struct tcpcb *)); +static struct tcpcb * + tcp_usrclosed __P((struct tcpcb *)); + +#ifdef TCPDEBUG +#define TCPDEBUG0 int ostate = 0 +#define TCPDEBUG1() ostate = tp ? tp->t_state : 0 +#define TCPDEBUG2(req) if (tp && (so->so_options & SO_DEBUG)) \ + tcp_trace(TA_USER, ostate, tp, 0, 0, req) +#else +#define TCPDEBUG0 +#define TCPDEBUG1() +#define TCPDEBUG2(req) +#endif + +/* + * TCP attaches to socket via pru_attach(), reserving space, + * and an internet control block. + */ +static int +tcp_usr_attach(struct socket *so, int proto, struct proc *p) +{ + int s = splnet(); + int error; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp = 0; + TCPDEBUG0; + + TCPDEBUG1(); + if (inp) { + error = EISCONN; + goto out; + } + + error = tcp_attach(so, p); + if (error) + goto out; + + if ((so->so_options & SO_LINGER) && so->so_linger == 0) + so->so_linger = TCP_LINGERTIME; + tp = sototcpcb(so); +out: + TCPDEBUG2(PRU_ATTACH); + splx(s); + return error; +} + +/* + * pru_detach() detaches the TCP protocol from the socket. + * If the protocol state is non-embryonic, then can't + * do this directly: have to initiate a pru_disconnect(), + * which may finish later; embryonic TCB's can just + * be discarded here. + */ +static int +tcp_usr_detach(struct socket *so) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + TCPDEBUG0; + + if (inp == 0) { + splx(s); + return EINVAL; /* XXX */ + } + tp = intotcpcb(inp); + TCPDEBUG1(); + tp = tcp_disconnect(tp); + + TCPDEBUG2(PRU_DETACH); + splx(s); + return error; +} + +#define COMMON_START() TCPDEBUG0; \ + do { \ + if (inp == 0) { \ + splx(s); \ + return EINVAL; \ + } \ + tp = intotcpcb(inp); \ + TCPDEBUG1(); \ + } while(0) + +#define COMMON_END(req) out: TCPDEBUG2(req); splx(s); return error; goto out + + +/* + * Give the socket an address. + */ +static int +tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + struct sockaddr_in *sinp; + + COMMON_START(); + + /* + * Must check for multicast addresses and disallow binding + * to them. + */ + sinp = (struct sockaddr_in *)nam; + if (sinp->sin_family == AF_INET && + IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) { + error = EAFNOSUPPORT; + goto out; + } + error = in_pcbbind(inp, nam, p); + if (error) + goto out; + COMMON_END(PRU_BIND); + +} + +#ifdef INET6 +static int +tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + struct sockaddr_in6 *sin6p; + + COMMON_START(); + + /* + * Must check for multicast addresses and disallow binding + * to them. + */ + sin6p = (struct sockaddr_in6 *)nam; + if (sin6p->sin6_family == AF_INET6 && + IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) { + error = EAFNOSUPPORT; + goto out; + } + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; + if (ip6_mapped_addr_on && (inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { + if (IN6_IS_ADDR_UNSPECIFIED(&sin6p->sin6_addr)) + inp->inp_vflag |= INP_IPV4; + else if (IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) { + struct sockaddr_in sin; + + in6_sin6_2_sin(&sin, sin6p); + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; + error = in_pcbbind(inp, (struct sockaddr *)&sin, p); + goto out; + } + } + error = in6_pcbbind(inp, nam, p); + if (error) + goto out; + COMMON_END(PRU_BIND); +} +#endif /* INET6 */ + +/* + * Prepare to accept connections. + */ +static int +tcp_usr_listen(struct socket *so, struct proc *p) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + + COMMON_START(); + if (inp->inp_lport == 0) + error = in_pcbbind(inp, (struct sockaddr *)0, p); + if (error == 0) + tp->t_state = TCPS_LISTEN; + COMMON_END(PRU_LISTEN); +} + +#ifdef INET6 +static int +tcp6_usr_listen(struct socket *so, struct proc *p) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + + COMMON_START(); + if (inp->inp_lport == 0) { + inp->inp_vflag &= ~INP_IPV4; + if (ip6_mapped_addr_on && + (inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) + inp->inp_vflag |= INP_IPV4; + error = in6_pcbbind(inp, (struct sockaddr *)0, p); + } + if (error == 0) + tp->t_state = TCPS_LISTEN; + COMMON_END(PRU_LISTEN); +} +#endif /* INET6 */ + +/* + * Initiate connection to peer. + * Create a template for use in transmissions on this connection. + * Enter SYN_SENT state, and mark socket as connecting. + * Start keep-alive timer, and seed output sequence space. + * Send initial segment on connection. + */ +static int +tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + struct sockaddr_in *sinp; + + COMMON_START(); + + /* + * Must disallow TCP ``connections'' to multicast addresses. + */ + sinp = (struct sockaddr_in *)nam; + if (sinp->sin_family == AF_INET + && IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) { + error = EAFNOSUPPORT; + goto out; + } + + + if ((error = tcp_connect(tp, nam, p)) != 0) + goto out; + error = tcp_output(tp); + COMMON_END(PRU_CONNECT); +} + +#ifdef INET6 +static int +tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + struct sockaddr_in6 *sin6p; + + COMMON_START(); + + /* + * Must disallow TCP ``connections'' to multicast addresses. + */ + sin6p = (struct sockaddr_in6 *)nam; + if (sin6p->sin6_family == AF_INET6 + && IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) { + error = EAFNOSUPPORT; + goto out; + } + + if (IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) { + struct sockaddr_in sin; + + if (!ip6_mapped_addr_on || + (inp->inp_flags & IN6P_IPV6_V6ONLY)) + return(EINVAL); + + in6_sin6_2_sin(&sin, sin6p); + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; + if ((error = tcp_connect(tp, (struct sockaddr *)&sin, p)) != 0) + goto out; + error = tcp_output(tp); + goto out; + } + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; + if ((error = tcp6_connect(tp, nam, p)) != 0) + goto out; + error = tcp_output(tp); + COMMON_END(PRU_CONNECT); +} +#endif /* INET6 */ + +/* + * Initiate disconnect from peer. + * If connection never passed embryonic stage, just drop; + * else if don't need to let data drain, then can just drop anyways, + * else have to begin TCP shutdown process: mark socket disconnecting, + * drain unread data, state switch to reflect user close, and + * send segment (e.g. FIN) to peer. Socket will be really disconnected + * when peer sends FIN and acks ours. + * + * SHOULD IMPLEMENT LATER PRU_CONNECT VIA REALLOC TCPCB. + */ +static int +tcp_usr_disconnect(struct socket *so) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + + COMMON_START(); + tp = tcp_disconnect(tp); + COMMON_END(PRU_DISCONNECT); +} + +/* + * Accept a connection. Essentially all the work is + * done at higher levels; just return the address + * of the peer, storing through addr. + */ +static int +tcp_usr_accept(struct socket *so, struct sockaddr **nam) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp = NULL; + TCPDEBUG0; + + if (so->so_state & SS_ISDISCONNECTED) { + error = ECONNABORTED; + goto out; + } + if (inp == 0) { + splx(s); + return (EINVAL); + } + tp = intotcpcb(inp); + TCPDEBUG1(); + in_setpeeraddr(so, nam); + COMMON_END(PRU_ACCEPT); +} + +#ifdef INET6 +static int +tcp6_usr_accept(struct socket *so, struct sockaddr **nam) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp = NULL; + TCPDEBUG0; + + if (so->so_state & SS_ISDISCONNECTED) { + error = ECONNABORTED; + goto out; + } + if (inp == 0) { + splx(s); + return (EINVAL); + } + tp = intotcpcb(inp); + TCPDEBUG1(); + in6_mapped_peeraddr(so, nam); + COMMON_END(PRU_ACCEPT); +} +#endif /* INET6 */ +/* + * Mark the connection as being incapable of further output. + */ +static int +tcp_usr_shutdown(struct socket *so) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + + COMMON_START(); + socantsendmore(so); + tp = tcp_usrclosed(tp); + if (tp) + error = tcp_output(tp); + COMMON_END(PRU_SHUTDOWN); +} + +/* + * After a receive, possibly send window update to peer. + */ +static int +tcp_usr_rcvd(struct socket *so, int flags) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + + COMMON_START(); + tcp_output(tp); + COMMON_END(PRU_RCVD); +} + +/* + * Do a send by putting data in output queue and updating urgent + * marker if URG set. Possibly send more data. Unlike the other + * pru_*() routines, the mbuf chains are our responsibility. We + * must either enqueue them or free them. The other pru_* routines + * generally are caller-frees. + */ +static int +tcp_usr_send(struct socket *so, int flags, struct mbuf *m, + struct sockaddr *nam, struct mbuf *control, struct proc *p) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; +#ifdef INET6 + int isipv6; +#endif + TCPDEBUG0; + + if (inp == NULL) { + /* + * OOPS! we lost a race, the TCP session got reset after + * we checked SS_CANTSENDMORE, eg: while doing uiomove or a + * network interrupt in the non-splnet() section of sosend(). + */ + if (m) + m_freem(m); + if (control) + m_freem(control); + error = ECONNRESET; /* XXX EPIPE? */ + tp = NULL; + TCPDEBUG1(); + goto out; + } +#ifdef INET6 + isipv6 = nam && nam->sa_family == AF_INET6; +#endif /* INET6 */ + tp = intotcpcb(inp); + TCPDEBUG1(); + if (control) { + /* TCP doesn't do control messages (rights, creds, etc) */ + if (control->m_len) { + m_freem(control); + if (m) + m_freem(m); + error = EINVAL; + goto out; + } + m_freem(control); /* empty control, just free it */ + } + if(!(flags & PRUS_OOB)) { + sbappend(&so->so_snd, m); + if (nam && tp->t_state < TCPS_SYN_SENT) { + /* + * Do implied connect if not yet connected, + * initialize window to default value, and + * initialize maxseg/maxopd using peer's cached + * MSS. + */ +#ifdef INET6 + if (isipv6) + error = tcp6_connect(tp, nam, p); + else +#endif /* INET6 */ + error = tcp_connect(tp, nam, p); + if (error) + goto out; + tp->snd_wnd = TTCP_CLIENT_SND_WND; + tcp_mss(tp, -1); + } + + if (flags & PRUS_EOF) { + /* + * Close the send side of the connection after + * the data is sent. + */ + socantsendmore(so); + tp = tcp_usrclosed(tp); + } + if (tp != NULL) { + if (flags & PRUS_MORETOCOME) + tp->t_flags |= TF_MORETOCOME; + error = tcp_output(tp); + if (flags & PRUS_MORETOCOME) + tp->t_flags &= ~TF_MORETOCOME; + } + } else { + if (sbspace(&so->so_snd) < -512) { + m_freem(m); + error = ENOBUFS; + goto out; + } + /* + * According to RFC961 (Assigned Protocols), + * the urgent pointer points to the last octet + * of urgent data. We continue, however, + * to consider it to indicate the first octet + * of data past the urgent section. + * Otherwise, snd_up should be one lower. + */ + sbappend(&so->so_snd, m); + if (nam && tp->t_state < TCPS_SYN_SENT) { + /* + * Do implied connect if not yet connected, + * initialize window to default value, and + * initialize maxseg/maxopd using peer's cached + * MSS. + */ +#ifdef INET6 + if (isipv6) + error = tcp6_connect(tp, nam, p); + else +#endif /* INET6 */ + error = tcp_connect(tp, nam, p); + if (error) + goto out; + tp->snd_wnd = TTCP_CLIENT_SND_WND; + tcp_mss(tp, -1); + } + tp->snd_up = tp->snd_una + so->so_snd.sb_cc; + tp->t_force = 1; + error = tcp_output(tp); + tp->t_force = 0; + } + COMMON_END((flags & PRUS_OOB) ? PRU_SENDOOB : + ((flags & PRUS_EOF) ? PRU_SEND_EOF : PRU_SEND)); +} + +/* + * Abort the TCP. + */ +static int +tcp_usr_abort(struct socket *so) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + + COMMON_START(); + tp = tcp_drop(tp, ECONNABORTED); + COMMON_END(PRU_ABORT); +} + +/* + * Receive out-of-band data. + */ +static int +tcp_usr_rcvoob(struct socket *so, struct mbuf *m, int flags) +{ + int s = splnet(); + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct tcpcb *tp; + + COMMON_START(); + if ((so->so_oobmark == 0 && + (so->so_state & SS_RCVATMARK) == 0) || + so->so_options & SO_OOBINLINE || + tp->t_oobflags & TCPOOB_HADDATA) { + error = EINVAL; + goto out; + } + if ((tp->t_oobflags & TCPOOB_HAVEDATA) == 0) { + error = EWOULDBLOCK; + goto out; + } + m->m_len = 1; + *mtod(m, caddr_t) = tp->t_iobc; + if ((flags & MSG_PEEK) == 0) + tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA); + COMMON_END(PRU_RCVOOB); +} + +/* xxx - should be const */ +struct pr_usrreqs tcp_usrreqs = { + tcp_usr_abort, tcp_usr_accept, tcp_usr_attach, tcp_usr_bind, + tcp_usr_connect, pru_connect2_notsupp, in_control, tcp_usr_detach, + tcp_usr_disconnect, tcp_usr_listen, in_setpeeraddr, tcp_usr_rcvd, + tcp_usr_rcvoob, tcp_usr_send, pru_sense_null, tcp_usr_shutdown, + in_setsockaddr, sosend, soreceive, sopoll +}; + +#ifdef INET6 +struct pr_usrreqs tcp6_usrreqs = { + tcp_usr_abort, tcp6_usr_accept, tcp_usr_attach, tcp6_usr_bind, + tcp6_usr_connect, pru_connect2_notsupp, in6_control, tcp_usr_detach, + tcp_usr_disconnect, tcp6_usr_listen, in6_mapped_peeraddr, tcp_usr_rcvd, + tcp_usr_rcvoob, tcp_usr_send, pru_sense_null, tcp_usr_shutdown, + in6_mapped_sockaddr, sosend, soreceive, sopoll +}; +#endif /* INET6 */ + +/* + * Common subroutine to open a TCP connection to remote host specified + * by struct sockaddr_in in mbuf *nam. Call in_pcbbind to assign a local + * port number if needed. Call in_pcbladdr to do the routing and to choose + * a local host address (interface). If there is an existing incarnation + * of the same connection in TIME-WAIT state and if the remote host was + * sending CC options and if the connection duration was < MSL, then + * truncate the previous TIME-WAIT state and proceed. + * Initialize connection parameters and enter SYN-SENT state. + */ +static int +tcp_connect(tp, nam, p) + register struct tcpcb *tp; + struct sockaddr *nam; + struct proc *p; +{ + struct inpcb *inp = tp->t_inpcb, *oinp; + struct socket *so = inp->inp_socket; + struct tcpcb *otp; + struct sockaddr_in *sin = (struct sockaddr_in *)nam; + struct sockaddr_in *ifaddr; + struct rmxp_tao *taop; + struct rmxp_tao tao_noncached; + int error; + + if (inp->inp_lport == 0) { + error = in_pcbbind(inp, (struct sockaddr *)0, p); + if (error) + return error; + } + + /* + * Cannot simply call in_pcbconnect, because there might be an + * earlier incarnation of this same connection still in + * TIME_WAIT state, creating an ADDRINUSE error. + */ + error = in_pcbladdr(inp, nam, &ifaddr); + if (error) + return error; + oinp = in_pcblookup_hash(inp->inp_pcbinfo, + sin->sin_addr, sin->sin_port, + inp->inp_laddr.s_addr != INADDR_ANY ? inp->inp_laddr + : ifaddr->sin_addr, + inp->inp_lport, 0, NULL); + if (oinp) { + if (oinp != inp && (otp = intotcpcb(oinp)) != NULL && + otp->t_state == TCPS_TIME_WAIT && + (ticks - otp->t_starttime) < tcp_msl && + (otp->t_flags & TF_RCVD_CC)) + otp = tcp_close(otp); + else + return EADDRINUSE; + } + if (inp->inp_laddr.s_addr == INADDR_ANY) + inp->inp_laddr = ifaddr->sin_addr; + inp->inp_faddr = sin->sin_addr; + inp->inp_fport = sin->sin_port; + in_pcbrehash(inp); + + /* Compute window scaling to request. */ + while (tp->request_r_scale < TCP_MAX_WINSHIFT && + (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat) + tp->request_r_scale++; + + soisconnecting(so); + tcpstat.tcps_connattempt++; + tp->t_state = TCPS_SYN_SENT; + callout_reset(tp->tt_keep, tcp_keepinit, tcp_timer_keep, tp); + tp->iss = tcp_new_isn(tp); + tcp_sendseqinit(tp); + + /* + * Generate a CC value for this connection and + * check whether CC or CCnew should be used. + */ + if ((taop = tcp_gettaocache(tp->t_inpcb)) == NULL) { + taop = &tao_noncached; + bzero(taop, sizeof(*taop)); + } + + tp->cc_send = CC_INC(tcp_ccgen); + if (taop->tao_ccsent != 0 && + CC_GEQ(tp->cc_send, taop->tao_ccsent)) { + taop->tao_ccsent = tp->cc_send; + } else { + taop->tao_ccsent = 0; + tp->t_flags |= TF_SENDCCNEW; + } + + return 0; +} + +#ifdef INET6 +static int +tcp6_connect(tp, nam, p) + register struct tcpcb *tp; + struct sockaddr *nam; + struct proc *p; +{ + struct inpcb *inp = tp->t_inpcb, *oinp; + struct socket *so = inp->inp_socket; + struct tcpcb *otp; + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; + struct in6_addr *addr6; + struct rmxp_tao *taop; + struct rmxp_tao tao_noncached; + int error; + + if (inp->inp_lport == 0) { + error = in6_pcbbind(inp, (struct sockaddr *)0, p); + if (error) + return error; + } + + /* + * Cannot simply call in_pcbconnect, because there might be an + * earlier incarnation of this same connection still in + * TIME_WAIT state, creating an ADDRINUSE error. + */ + error = in6_pcbladdr(inp, nam, &addr6); + if (error) + return error; + oinp = in6_pcblookup_hash(inp->inp_pcbinfo, + &sin6->sin6_addr, sin6->sin6_port, + IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) + ? addr6 + : &inp->in6p_laddr, + inp->inp_lport, 0, NULL); + if (oinp) { + if (oinp != inp && (otp = intotcpcb(oinp)) != NULL && + otp->t_state == TCPS_TIME_WAIT && + (ticks - otp->t_starttime) < tcp_msl && + (otp->t_flags & TF_RCVD_CC)) + otp = tcp_close(otp); + else + return EADDRINUSE; + } + if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) + inp->in6p_laddr = *addr6; + inp->in6p_faddr = sin6->sin6_addr; + inp->inp_fport = sin6->sin6_port; + if ((sin6->sin6_flowinfo & IPV6_FLOWINFO_MASK) != (u_int32_t)NULL) + inp->in6p_flowinfo = sin6->sin6_flowinfo; + in_pcbrehash(inp); + + /* Compute window scaling to request. */ + while (tp->request_r_scale < TCP_MAX_WINSHIFT && + (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat) + tp->request_r_scale++; + + soisconnecting(so); + tcpstat.tcps_connattempt++; + tp->t_state = TCPS_SYN_SENT; + callout_reset(tp->tt_keep, tcp_keepinit, tcp_timer_keep, tp); + tp->iss = tcp_new_isn(tp); + tcp_sendseqinit(tp); + + /* + * Generate a CC value for this connection and + * check whether CC or CCnew should be used. + */ + if ((taop = tcp_gettaocache(tp->t_inpcb)) == NULL) { + taop = &tao_noncached; + bzero(taop, sizeof(*taop)); + } + + tp->cc_send = CC_INC(tcp_ccgen); + if (taop->tao_ccsent != 0 && + CC_GEQ(tp->cc_send, taop->tao_ccsent)) { + taop->tao_ccsent = tp->cc_send; + } else { + taop->tao_ccsent = 0; + tp->t_flags |= TF_SENDCCNEW; + } + + return 0; +} +#endif /* INET6 */ + +/* + * The new sockopt interface makes it possible for us to block in the + * copyin/out step (if we take a page fault). Taking a page fault at + * splnet() is probably a Bad Thing. (Since sockets and pcbs both now + * use TSM, there probably isn't any need for this function to run at + * splnet() any more. This needs more examination.) + */ +int +tcp_ctloutput(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + int error, opt, optval, s; + struct inpcb *inp; + struct tcpcb *tp; + + error = 0; + s = splnet(); /* XXX */ + inp = sotoinpcb(so); + if (inp == NULL) { + splx(s); + return (ECONNRESET); + } + if (sopt->sopt_level != IPPROTO_TCP) { +#ifdef INET6 + if (INP_CHECK_SOCKAF(so, AF_INET6)) + error = ip6_ctloutput(so, sopt); + else +#endif /* INET6 */ + error = ip_ctloutput(so, sopt); + splx(s); + return (error); + } + tp = intotcpcb(inp); + + switch (sopt->sopt_dir) { + case SOPT_SET: + switch (sopt->sopt_name) { + case TCP_NODELAY: + case TCP_NOOPT: + case TCP_NOPUSH: + error = sooptcopyin(sopt, &optval, sizeof optval, + sizeof optval); + if (error) + break; + + switch (sopt->sopt_name) { + case TCP_NODELAY: + opt = TF_NODELAY; + break; + case TCP_NOOPT: + opt = TF_NOOPT; + break; + case TCP_NOPUSH: + opt = TF_NOPUSH; + break; + default: + opt = 0; /* dead code to fool gcc */ + break; + } + + if (optval) + tp->t_flags |= opt; + else + tp->t_flags &= ~opt; + break; + + case TCP_MAXSEG: + error = sooptcopyin(sopt, &optval, sizeof optval, + sizeof optval); + if (error) + break; + + if (optval > 0 && optval <= tp->t_maxseg) + tp->t_maxseg = optval; + else + error = EINVAL; + break; + + default: + error = ENOPROTOOPT; + break; + } + break; + + case SOPT_GET: + switch (sopt->sopt_name) { + case TCP_NODELAY: + optval = tp->t_flags & TF_NODELAY; + break; + case TCP_MAXSEG: + optval = tp->t_maxseg; + break; + case TCP_NOOPT: + optval = tp->t_flags & TF_NOOPT; + break; + case TCP_NOPUSH: + optval = tp->t_flags & TF_NOPUSH; + break; + default: + error = ENOPROTOOPT; + break; + } + if (error == 0) + error = sooptcopyout(sopt, &optval, sizeof optval); + break; + } + splx(s); + return (error); +} + +/* + * tcp_sendspace and tcp_recvspace are the default send and receive window + * sizes, respectively. These are obsolescent (this information should + * be set by the route). + */ +u_long tcp_sendspace = 1024*16; +u_long tcp_recvspace = 1024*16; + +/* + * Attach TCP protocol to socket, allocating + * internet protocol control block, tcp control block, + * bufer space, and entering LISTEN state if to accept connections. + */ +static int +tcp_attach(so, p) + struct socket *so; + struct proc *p; +{ + register struct tcpcb *tp; + struct inpcb *inp; + int error; +#ifdef INET6 + int isipv6 = INP_CHECK_SOCKAF(so, AF_INET6) != (int)NULL; +#endif + + if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { + error = soreserve(so, tcp_sendspace, tcp_recvspace); + if (error) + return (error); + } + error = in_pcballoc(so, &tcbinfo, p); + if (error) + return (error); + inp = sotoinpcb(so); +#ifdef INET6 + if (isipv6) { + inp->inp_vflag |= INP_IPV6; + inp->in6p_hops = -1; /* use kernel default */ + } + else +#endif + inp->inp_vflag |= INP_IPV4; + tp = tcp_newtcpcb(inp); + if (tp == 0) { + int nofd = so->so_state & SS_NOFDREF; /* XXX */ + + so->so_state &= ~SS_NOFDREF; /* don't free the socket yet */ +#ifdef INET6 + if (isipv6) + in6_pcbdetach(inp); + else +#endif + in_pcbdetach(inp); + so->so_state |= nofd; + return (ENOBUFS); + } + tp->t_state = TCPS_CLOSED; + return (0); +} + +/* + * Initiate (or continue) disconnect. + * If embryonic state, just send reset (once). + * If in ``let data drain'' option and linger null, just drop. + * Otherwise (hard), mark socket disconnecting and drop + * current input data; switch states based on user close, and + * send segment to peer (with FIN). + */ +static struct tcpcb * +tcp_disconnect(tp) + register struct tcpcb *tp; +{ + struct socket *so = tp->t_inpcb->inp_socket; + + if (tp->t_state < TCPS_ESTABLISHED) + tp = tcp_close(tp); + else if ((so->so_options & SO_LINGER) && so->so_linger == 0) + tp = tcp_drop(tp, 0); + else { + soisdisconnecting(so); + sbflush(&so->so_rcv); + tp = tcp_usrclosed(tp); + if (tp) + (void) tcp_output(tp); + } + return (tp); +} + +/* + * User issued close, and wish to trail through shutdown states: + * if never received SYN, just forget it. If got a SYN from peer, + * but haven't sent FIN, then go to FIN_WAIT_1 state to send peer a FIN. + * If already got a FIN from peer, then almost done; go to LAST_ACK + * state. In all other cases, have already sent FIN to peer (e.g. + * after PRU_SHUTDOWN), and just have to play tedious game waiting + * for peer to send FIN or not respond to keep-alives, etc. + * We can let the user exit from the close as soon as the FIN is acked. + */ +static struct tcpcb * +tcp_usrclosed(tp) + register struct tcpcb *tp; +{ + + switch (tp->t_state) { + + case TCPS_CLOSED: + case TCPS_LISTEN: + tp->t_state = TCPS_CLOSED; + tp = tcp_close(tp); + break; + + case TCPS_SYN_SENT: + case TCPS_SYN_RECEIVED: + tp->t_flags |= TF_NEEDFIN; + break; + + case TCPS_ESTABLISHED: + tp->t_state = TCPS_FIN_WAIT_1; + break; + + case TCPS_CLOSE_WAIT: + tp->t_state = TCPS_LAST_ACK; + break; + } + if (tp && tp->t_state >= TCPS_FIN_WAIT_2) { + soisdisconnected(tp->t_inpcb->inp_socket); + /* To prevent the connection hanging in FIN_WAIT_2 forever. */ + if (tp->t_state == TCPS_FIN_WAIT_2) + callout_reset(tp->tt_2msl, tcp_maxidle, + tcp_timer_2msl, tp); + } + return (tp); +} + diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet/udp_usrreq.c b/packages/net/bsd_tcpip/current/src/sys/netinet/udp_usrreq.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet/udp_usrreq.c @@ -0,0 +1,827 @@ +//========================================================================== +// +// src/sys/netinet/udp_usrreq.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 + * $FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.64.2.13 2001/08/08 18:59:54 ghelmer Exp $ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#ifdef INET6 +#include +#endif +#include +#include +#include +#ifdef INET6 +#include +#endif +#include +#include +#include +#include + +#ifdef IPSEC +#include +#endif /*IPSEC*/ + +/* + * UDP protocol implementation. + * Per RFC 768, August, 1980. + */ +#ifndef COMPAT_42 +int udpcksum = 1; +#else +int udpcksum = 0; /* XXX */ +#endif + +int log_in_vain = 0; +static int blackhole = 0; +struct inpcbhead udb; /* from udp_var.h */ + +#define udb6 udb /* for KAME src sync over BSD*'s */ +struct inpcbinfo udbinfo; + +#ifndef UDBHASHSIZE +#define UDBHASHSIZE 16 +#endif + +struct udpstat udpstat; /* from udp_var.h */ + +static struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET }; +#ifdef INET6 +struct udp_in6 { + struct sockaddr_in6 uin6_sin; + u_char uin6_init_done : 1; +} udp_in6 = { + { sizeof(udp_in6.uin6_sin), AF_INET6 }, + 0 +}; +struct udp_ip6 { + struct ip6_hdr uip6_ip6; + u_char uip6_init_done : 1; +} udp_ip6; +#endif /* INET6 */ + +static void udp_append __P((struct inpcb *last, struct ip *ip, + struct mbuf *n, int off)); +#ifdef INET6 +static void ip_2_ip6_hdr __P((struct ip6_hdr *ip6, struct ip *ip)); +#endif + +static int udp_detach __P((struct socket *so)); +static int udp_output __P((struct inpcb *, struct mbuf *, struct sockaddr *, + struct mbuf *, struct proc *)); + +void +udp_init() +{ + LIST_INIT(&udb); + udbinfo.listhead = &udb; + udbinfo.hashbase = hashinit(UDBHASHSIZE, M_PCB, &udbinfo.hashmask); + udbinfo.porthashbase = hashinit(UDBHASHSIZE, M_PCB, + &udbinfo.porthashmask); + udbinfo.ipi_zone = zinit("udpcb", sizeof(struct inpcb), maxsockets, + ZONE_INTERRUPT, 0); +} + +void +udp_input(m, off) + register struct mbuf *m; + int off; +{ + int iphlen = off; + register struct ip *ip; + register struct udphdr *uh; + register struct inpcb *inp; + struct mbuf *opts = 0; +#ifdef INET6 + struct ip6_recvpktopts opts6; +#endif + int len; + struct ip save_ip; + struct sockaddr *append_sa; + + udpstat.udps_ipackets++; +#ifdef INET6 + bzero(&opts6, sizeof(opts6)); +#endif + + /* + * Strip IP options, if any; should skip this, + * make available to user, and use on returned packets, + * but we don't yet have a way to check the checksum + * with options still present. + */ + if (iphlen > sizeof (struct ip)) { + ip_stripoptions(m, (struct mbuf *)0); + iphlen = sizeof(struct ip); + } + + /* + * Get IP and UDP header together in first mbuf. + */ + ip = mtod(m, struct ip *); +#ifndef PULLDOWN_TEST + if (m->m_len < iphlen + sizeof(struct udphdr)) { + if ((m = m_pullup(m, iphlen + sizeof(struct udphdr))) == 0) { + udpstat.udps_hdrops++; + return; + } + ip = mtod(m, struct ip *); + } + uh = (struct udphdr *)((caddr_t)ip + iphlen); +#else + IP6_EXTHDR_GET(uh, struct udphdr *, m, iphlen, sizeof(struct udphdr)); + if (!uh) { + udpstat.udps_hdrops++; + return; + } +#endif + + /* destination port of 0 is illegal, based on RFC768. */ + if (uh->uh_dport == 0) + goto bad; + + /* + * Make mbuf data length reflect UDP length. + * If not enough data to reflect UDP length, drop. + */ + len = ntohs((u_short)uh->uh_ulen); + if (ip->ip_len != len) { + if (len > ip->ip_len || len < sizeof(struct udphdr)) { + udpstat.udps_badlen++; + goto bad; + } + m_adj(m, len - ip->ip_len); + /* ip->ip_len = len; */ + } + /* + * Save a copy of the IP header in case we want restore it + * for sending an ICMP error message in response. + */ + save_ip = *ip; + + /* + * Checksum extended UDP header and data. + */ + if (uh->uh_sum) { + if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { + if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) + uh->uh_sum = m->m_pkthdr.csum_data; + else + uh->uh_sum = in_pseudo(ip->ip_src.s_addr, + ip->ip_dst.s_addr, htonl((u_short)len + + m->m_pkthdr.csum_data + IPPROTO_UDP)); + uh->uh_sum ^= 0xffff; + } else { + char b[9]; + bcopy(((struct ipovly *)ip)->ih_x1, b, 9); + bzero(((struct ipovly *)ip)->ih_x1, 9); + ((struct ipovly *)ip)->ih_len = uh->uh_ulen; + uh->uh_sum = in_cksum(m, len + sizeof (struct ip)); + bcopy(b, ((struct ipovly *)ip)->ih_x1, 9); + } + if (uh->uh_sum) { + udpstat.udps_badsum++; + m_freem(m); + return; + } + } else + udpstat.udps_nosum++; + + if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) || + in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) { + struct inpcb *last; + /* + * Deliver a multicast or broadcast datagram to *all* sockets + * for which the local and remote addresses and ports match + * those of the incoming datagram. This allows more than + * one process to receive multi/broadcasts on the same port. + * (This really ought to be done for unicast datagrams as + * well, but that would cause problems with existing + * applications that open both address-specific sockets and + * a wildcard socket listening to the same port -- they would + * end up receiving duplicates of every unicast datagram. + * Those applications open the multiple sockets to overcome an + * inadequacy of the UDP socket interface, but for backwards + * compatibility we avoid the problem here rather than + * fixing the interface. Maybe 4.5BSD will remedy this?) + */ + + /* + * Construct sockaddr format source address. + */ + udp_in.sin_port = uh->uh_sport; + udp_in.sin_addr = ip->ip_src; + /* + * Locate pcb(s) for datagram. + * (Algorithm copied from raw_intr().) + */ + last = NULL; +#ifdef INET6 + udp_in6.uin6_init_done = udp_ip6.uip6_init_done = 0; +#endif + LIST_FOREACH(inp, &udb, inp_list) { +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV4) == 0) + continue; +#endif + if (inp->inp_lport != uh->uh_dport) + continue; + if (inp->inp_laddr.s_addr != INADDR_ANY) { + if (inp->inp_laddr.s_addr != + ip->ip_dst.s_addr) + continue; + } + if (inp->inp_faddr.s_addr != INADDR_ANY) { + if (inp->inp_faddr.s_addr != + ip->ip_src.s_addr || + inp->inp_fport != uh->uh_sport) + continue; + } + + if (last != NULL) { + struct mbuf *n; + +#ifdef IPSEC + /* check AH/ESP integrity. */ + if (ipsec4_in_reject_so(m, last->inp_socket)) + ipsecstat.in_polvio++; + /* do not inject data to pcb */ + else +#endif /*IPSEC*/ + if ((n = m_copy(m, 0, M_COPYALL)) != NULL) + udp_append(last, ip, n, + iphlen + + sizeof(struct udphdr)); + } + last = inp; + /* + * Don't look for additional matches if this one does + * not have either the SO_REUSEPORT or SO_REUSEADDR + * socket options set. This heuristic avoids searching + * through all pcbs in the common case of a non-shared + * port. It * assumes that an application will never + * clear these options after setting them. + */ + if ((last->inp_socket->so_options&(SO_REUSEPORT|SO_REUSEADDR)) == 0) + break; + } + + if (last == NULL) { + /* + * No matching pcb found; discard datagram. + * (No need to send an ICMP Port Unreachable + * for a broadcast or multicast datgram.) + */ + udpstat.udps_noportbcast++; + goto bad; + } +#ifdef IPSEC + /* check AH/ESP integrity. */ + if (ipsec4_in_reject_so(m, last->inp_socket)) { + ipsecstat.in_polvio++; + goto bad; + } +#endif /*IPSEC*/ + udp_append(last, ip, m, iphlen + sizeof(struct udphdr)); + return; + } + /* + * Locate pcb for datagram. + */ + inp = in_pcblookup_hash(&udbinfo, ip->ip_src, uh->uh_sport, + ip->ip_dst, uh->uh_dport, 1, m->m_pkthdr.rcvif); + if (inp == NULL) { + if (log_in_vain) { + char buf[4*sizeof "123"]; + + strcpy(buf, inet_ntoa(ip->ip_dst)); + log(LOG_INFO, + "Connection attempt to UDP %s:%d from %s:%d\n", + buf, ntohs(uh->uh_dport), inet_ntoa(ip->ip_src), + ntohs(uh->uh_sport)); + } + udpstat.udps_noport++; + if (m->m_flags & (M_BCAST | M_MCAST)) { + udpstat.udps_noportbcast++; + goto bad; + } +#ifdef ICMP_BANDLIM + if (badport_bandlim(BANDLIM_ICMP_UNREACH) < 0) + goto bad; +#endif + if (blackhole) + goto bad; + *ip = save_ip; + ip->ip_len += iphlen; + icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); + return; + } +#ifdef IPSEC + if (ipsec4_in_reject_so(m, inp->inp_socket)) { + ipsecstat.in_polvio++; + goto bad; + } +#endif /*IPSEC*/ + + /* + * Construct sockaddr format source address. + * Stuff source address and datagram in user buffer. + */ + udp_in.sin_port = uh->uh_sport; + udp_in.sin_addr = ip->ip_src; + if (inp->inp_flags & INP_CONTROLOPTS + || inp->inp_socket->so_options & SO_TIMESTAMP) { +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6) { + int savedflags; + + ip_2_ip6_hdr(&udp_ip6.uip6_ip6, ip); + savedflags = inp->inp_flags; + inp->inp_flags &= ~INP_UNMAPPABLEOPTS; + ip6_savecontrol(inp, &udp_ip6.uip6_ip6, m, + &opts6, NULL); + inp->inp_flags = savedflags; + } else +#endif + ip_savecontrol(inp, &opts, ip, m); + } + m_adj(m, iphlen + sizeof(struct udphdr)); +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6) { + in6_sin_2_v4mapsin6(&udp_in, &udp_in6.uin6_sin); + append_sa = (struct sockaddr *)&udp_in6; + opts = opts6.head; + } else +#endif + append_sa = (struct sockaddr *)&udp_in; + if (sbappendaddr(&inp->inp_socket->so_rcv, append_sa, m, opts) == 0) { + udpstat.udps_fullsock++; + goto bad; + } + sorwakeup(inp->inp_socket); + return; +bad: + m_freem(m); + if (opts) + m_freem(opts); + return; +} + +#ifdef INET6 +static void +ip_2_ip6_hdr(ip6, ip) + struct ip6_hdr *ip6; + struct ip *ip; +{ + bzero(ip6, sizeof(*ip6)); + + ip6->ip6_vfc = IPV6_VERSION; + ip6->ip6_plen = ip->ip_len; + ip6->ip6_nxt = ip->ip_p; + ip6->ip6_hlim = ip->ip_ttl; + ip6->ip6_src.s6_addr32[2] = ip6->ip6_dst.s6_addr32[2] = + IPV6_ADDR_INT32_SMP; + ip6->ip6_src.s6_addr32[3] = ip->ip_src.s_addr; + ip6->ip6_dst.s6_addr32[3] = ip->ip_dst.s_addr; +} +#endif + +/* + * subroutine of udp_input(), mainly for source code readability. + * caller must properly init udp_ip6 and udp_in6 beforehand. + */ +static void +udp_append(last, ip, n, off) + struct inpcb *last; + struct ip *ip; + struct mbuf *n; + int off; +{ + struct sockaddr *append_sa; + struct mbuf *opts = 0; +#ifdef INET6 + struct ip6_recvpktopts opts6; + + bzero(&opts6, sizeof(opts6)); +#endif + if (last->inp_flags & INP_CONTROLOPTS || + last->inp_socket->so_options & SO_TIMESTAMP) { +#ifdef INET6 + if (last->inp_vflag & INP_IPV6) { + int savedflags; + + if (udp_ip6.uip6_init_done == 0) { + ip_2_ip6_hdr(&udp_ip6.uip6_ip6, ip); + udp_ip6.uip6_init_done = 1; + } + savedflags = last->inp_flags; + last->inp_flags &= ~INP_UNMAPPABLEOPTS; + ip6_savecontrol(last, &udp_ip6.uip6_ip6, n, + &opts6, NULL); + last->inp_flags = savedflags; + } else +#endif + ip_savecontrol(last, &opts, ip, n); + } +#ifdef INET6 + if (last->inp_vflag & INP_IPV6) { + if (udp_in6.uin6_init_done == 0) { + in6_sin_2_v4mapsin6(&udp_in, &udp_in6.uin6_sin); + udp_in6.uin6_init_done = 1; + } + append_sa = (struct sockaddr *)&udp_in6.uin6_sin; + opts = opts6.head; + } else +#endif + append_sa = (struct sockaddr *)&udp_in; + m_adj(n, off); + if (sbappendaddr(&last->inp_socket->so_rcv, append_sa, n, opts) == 0) { + m_freem(n); + if (opts) + m_freem(opts); + udpstat.udps_fullsock++; + } else + sorwakeup(last->inp_socket); +} + +/* + * Notify a udp user of an asynchronous error; + * just wake up so that he can collect error status. + */ +void +udp_notify(inp, errno) + register struct inpcb *inp; + int errno; +{ + inp->inp_socket->so_error = errno; + sorwakeup(inp->inp_socket); + sowwakeup(inp->inp_socket); +} + +void +udp_ctlinput(cmd, sa, vip) + int cmd; + struct sockaddr *sa; + void *vip; +{ + struct ip *ip = vip; + struct udphdr *uh; + void (*notify) __P((struct inpcb *, int)) = udp_notify; + struct in_addr faddr; + struct inpcb *inp; + int s; + + faddr = ((struct sockaddr_in *)sa)->sin_addr; + if (sa->sa_family != AF_INET || faddr.s_addr == INADDR_ANY) + return; + + if (PRC_IS_REDIRECT(cmd)) { + ip = 0; + notify = in_rtchange; + } else if (cmd == PRC_HOSTDEAD) + ip = 0; + else if ((unsigned)cmd >= PRC_NCMDS || inetctlerrmap[cmd] == 0) + return; + if (ip) { + s = splnet(); + uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2)); + inp = in_pcblookup_hash(&udbinfo, faddr, uh->uh_dport, + ip->ip_src, uh->uh_sport, 0, NULL); + if (inp != NULL && inp->inp_socket != NULL) + (*notify)(inp, inetctlerrmap[cmd]); + splx(s); + } else + in_pcbnotifyall(&udb, faddr, inetctlerrmap[cmd], notify); +} + +static int +udp_output(inp, m, addr, control, p) + register struct inpcb *inp; + struct mbuf *m; + struct sockaddr *addr; + struct mbuf *control; + struct proc *p; +{ + register struct udpiphdr *ui; + register int len = m->m_pkthdr.len; + struct in_addr laddr; + struct sockaddr_in *sin; + int s = 0, error = 0; + + if (control) + m_freem(control); /* XXX */ + + if (len + sizeof(struct udpiphdr) > IP_MAXPACKET) { + error = EMSGSIZE; + goto release; + } + + if (addr) { + sin = (struct sockaddr_in *)addr; + laddr = inp->inp_laddr; + if (inp->inp_faddr.s_addr != INADDR_ANY) { + error = EISCONN; + goto release; + } + /* + * Must block input while temporarily connected. + */ + s = splnet(); + error = in_pcbconnect(inp, addr, p); + if (error) { + splx(s); + goto release; + } + } else { + if (inp->inp_faddr.s_addr == INADDR_ANY) { + error = ENOTCONN; + goto release; + } + } + /* + * Calculate data length and get a mbuf + * for UDP and IP headers. + */ + M_PREPEND(m, sizeof(struct udpiphdr), M_DONTWAIT); + if (m == 0) { + error = ENOBUFS; + if (addr) + splx(s); + goto release; + } + + /* + * Fill in mbuf with extended UDP header + * and addresses and length put into network format. + */ + ui = mtod(m, struct udpiphdr *); + bzero(ui->ui_x1, sizeof(ui->ui_x1)); /* XXX still needed? */ + ui->ui_pr = IPPROTO_UDP; + ui->ui_src = inp->inp_laddr; + ui->ui_dst = inp->inp_faddr; + ui->ui_sport = inp->inp_lport; + ui->ui_dport = inp->inp_fport; + ui->ui_ulen = htons((u_short)len + sizeof(struct udphdr)); + + /* + * Set up checksum and output datagram. + */ + if (udpcksum) { + ui->ui_sum = in_pseudo(ui->ui_src.s_addr, ui->ui_dst.s_addr, + htons((u_short)len + sizeof(struct udphdr) + IPPROTO_UDP)); + m->m_pkthdr.csum_flags = CSUM_UDP; + m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); + } else { + ui->ui_sum = 0; + } + ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; + ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */ + ((struct ip *)ui)->ip_tos = inp->inp_ip_tos; /* XXX */ + udpstat.udps_opackets++; + +#ifdef IPSEC + if (ipsec_setsocket(m, inp->inp_socket) != 0) { + error = ENOBUFS; + goto release; + } +#endif /*IPSEC*/ + error = ip_output(m, inp->inp_options, &inp->inp_route, + (inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST)), + inp->inp_moptions); + + if (addr) { + in_pcbdisconnect(inp); + inp->inp_laddr = laddr; /* XXX rehash? */ + splx(s); + } + return (error); + +release: + m_freem(m); + return (error); +} + +u_long udp_sendspace = 9216; /* really max datagram size */ + /* 40 1K datagrams */ +u_long udp_recvspace = 40 * (1024 + +#ifdef INET6 + sizeof(struct sockaddr_in6) +#else + sizeof(struct sockaddr_in) +#endif + ); + +static int +udp_abort(struct socket *so) +{ + struct inpcb *inp; + int s; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; /* ??? possible? panic instead? */ + soisdisconnected(so); + s = splnet(); + in_pcbdetach(inp); + splx(s); + return 0; +} + +static int +udp_attach(struct socket *so, int proto, struct proc *p) +{ + struct inpcb *inp; + int s, error; + + inp = sotoinpcb(so); + if (inp != 0) + return EINVAL; + + error = soreserve(so, udp_sendspace, udp_recvspace); + if (error) + return error; + s = splnet(); + error = in_pcballoc(so, &udbinfo, p); + splx(s); + if (error) + return error; + + inp = (struct inpcb *)so->so_pcb; + inp->inp_vflag |= INP_IPV4; + inp->inp_ip_ttl = ip_defttl; + return 0; +} + +static int +udp_bind(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + struct inpcb *inp; + int s, error; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; + s = splnet(); + error = in_pcbbind(inp, nam, p); + splx(s); + return error; +} + +static int +udp_connect(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + struct inpcb *inp; + int s, error; + struct sockaddr_in *sin; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; + if (inp->inp_faddr.s_addr != INADDR_ANY) + return EISCONN; + error = 0; + s = splnet(); + if (error == 0) { + sin = (struct sockaddr_in *)nam; + error = in_pcbconnect(inp, nam, p); + } + splx(s); + if (error == 0) + soisconnected(so); + return error; +} + +static int +udp_detach(struct socket *so) +{ + struct inpcb *inp; + int s; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; + s = splnet(); + in_pcbdetach(inp); + splx(s); + return 0; +} + +static int +udp_disconnect(struct socket *so) +{ + struct inpcb *inp; + int s; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; + if (inp->inp_faddr.s_addr == INADDR_ANY) + return ENOTCONN; + + s = splnet(); + in_pcbdisconnect(inp); + inp->inp_laddr.s_addr = INADDR_ANY; + splx(s); + so->so_state &= ~SS_ISCONNECTED; /* XXX */ + return 0; +} + +static int +udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, + struct mbuf *control, struct proc *p) +{ + struct inpcb *inp; + + inp = sotoinpcb(so); + if (inp == 0) { + m_freem(m); + return EINVAL; + } + return udp_output(inp, m, addr, control, p); +} + +int +udp_shutdown(struct socket *so) +{ + struct inpcb *inp; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; + socantsendmore(so); + return 0; +} + +struct pr_usrreqs udp_usrreqs = { + udp_abort, pru_accept_notsupp, udp_attach, udp_bind, udp_connect, + pru_connect2_notsupp, in_control, udp_detach, udp_disconnect, + pru_listen_notsupp, in_setpeeraddr, pru_rcvd_notsupp, + pru_rcvoob_notsupp, udp_send, pru_sense_null, udp_shutdown, + in_setsockaddr, sosend, soreceive, sopoll +}; + diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/dest6.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/dest6.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/dest6.c @@ -0,0 +1,244 @@ +//========================================================================== +// +// src/sys/netinet6/dest6.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: dest6.c,v 1.33 2001/10/05 10:01:32 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__OpenBSD__) && !(defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#endif +#include +#ifdef MIP6 +#include +#endif + +/* + * Destination options header processing. + */ +int +dest6_input(mp, offp, proto) + struct mbuf **mp; + int *offp, proto; +{ + struct mbuf *m = *mp; + int off = *offp, dstoptlen, optlen; + struct ip6_dest *dstopts; + struct mbuf *n; + struct ip6_opt_home_address *haopt = NULL; + struct ip6aux *ip6a = NULL; + u_int8_t *opt; + struct ip6_hdr *ip6; + + ip6 = mtod(m, struct ip6_hdr *); + + /* validation of the length of the header */ +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, sizeof(*dstopts), IPPROTO_DONE); + dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(dstopts, struct ip6_dest *, m, off, sizeof(*dstopts)); + if (dstopts == NULL) + return IPPROTO_DONE; +#endif + dstoptlen = (dstopts->ip6d_len + 1) << 3; + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, dstoptlen, IPPROTO_DONE); + dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(dstopts, struct ip6_dest *, m, off, dstoptlen); + if (dstopts == NULL) + return IPPROTO_DONE; +#endif + off += dstoptlen; + dstoptlen -= sizeof(struct ip6_dest); + opt = (u_int8_t *)dstopts + sizeof(struct ip6_dest); + + /* search header for all options. */ + for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) { + if (*opt != IP6OPT_PAD1 && + (dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) { + ip6stat.ip6s_toosmall++; + goto bad; + } + + switch (*opt) { + case IP6OPT_PAD1: + optlen = 1; + break; + case IP6OPT_PADN: + optlen = *(opt + 1) + 2; + break; + case IP6OPT_HOME_ADDRESS: + /* + * XXX we assume that home address option appear after + * AH. if the assumption does not hold, the validation + * of AH will fail due to the address swap. + */ +#if 0 + /* be picky about alignment: 8n+6 */ + if ((opt - (u_int8_t *)dstopts) % 8 != 6) + goto bad; +#endif + + /* HA option must appear only once */ + n = ip6_addaux(m); + if (!n) { + /* not enough core */ + goto bad; + } + ip6a = mtod(n, struct ip6aux *); + if ((ip6a->ip6a_flags & IP6A_HASEEN) != 0) { + /* XXX icmp6 paramprob? */ + goto bad; + } + + haopt = (struct ip6_opt_home_address *)opt; + optlen = haopt->ip6oh_len + 2; + + /* + * don't complain even if it is larger, + * we don't support suboptions at this moment. + */ + if (optlen < sizeof(*haopt)) { + ip6stat.ip6s_toosmall++; + goto bad; + } + + /* XXX check header ordering */ + + bcopy(haopt->ip6oh_addr, &ip6a->ip6a_home, + sizeof(ip6a->ip6a_home)); + bcopy(&ip6->ip6_src, &ip6a->ip6a_careof, + sizeof(ip6a->ip6a_careof)); + ip6a->ip6a_flags |= IP6A_HASEEN; + + /* + * reject invalid home-addresses + */ + /* XXX linklocal-address is not supported */ + if (IN6_IS_ADDR_MULTICAST(&ip6a->ip6a_home) || + IN6_IS_ADDR_LINKLOCAL(&ip6a->ip6a_home) || + IN6_IS_ADDR_V4MAPPED(&ip6a->ip6a_home) || + IN6_IS_ADDR_UNSPECIFIED(&ip6a->ip6a_home) || + IN6_IS_ADDR_LOOPBACK(&ip6a->ip6a_home)) { + ip6stat.ip6s_badscope++; + goto bad; + } + + /* + * Currently, no valid sub-options are + * defined for use in a Home Address option. + */ + + break; + +#ifdef MIP6 + case IP6OPT_BINDING_UPDATE: + case IP6OPT_BINDING_ACK: + case IP6OPT_BINDING_REQ: + if (mip6_process_destopt(m, dstopts, opt, dstoptlen) + == -1) + goto bad; + optlen = *(opt + 1) + 2; + break; +#endif /* MIP6 */ + + default: /* unknown option */ + optlen = ip6_unknown_opt(opt, m, + opt - mtod(m, u_int8_t *)); + if (optlen == -1) + return (IPPROTO_DONE); + optlen += 2; + break; + } + } + + /* if haopt is non-NULL, we are sure we have seen fresh HA option */ + if (haopt && ip6a && + (ip6a->ip6a_flags & (IP6A_HASEEN | IP6A_SWAP)) == IP6A_HASEEN) { + /* XXX should we do this at all? do it now or later? */ + /* XXX interaction with 2292bis IPV6_RECVDSTOPT */ + /* XXX interaction with ipsec - should be okay */ + /* XXX icmp6 responses is modified - which is bad */ + bcopy(&ip6a->ip6a_careof, haopt->ip6oh_addr, + sizeof(haopt->ip6oh_addr)); + bcopy(&ip6a->ip6a_home, &ip6->ip6_src, + sizeof(ip6->ip6_src)); +#if 0 + /* XXX linklocal address is (currently) not supported */ + if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) + ip6->ip6_src.s6_addr16[1] + = htons(m->m_pkthdr.rcvif->if_index); +#endif + ip6a->ip6a_flags |= IP6A_SWAP; + } + + *offp = off; + return (dstopts->ip6d_nxt); + + bad: + m_freem(m); + return (IPPROTO_DONE); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/frag6.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/frag6.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/frag6.c @@ -0,0 +1,736 @@ +//========================================================================== +// +// src/sys/netinet6/frag6.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: frag6.c,v 1.32 2001/06/21 09:06:29 sumikawa Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__OpenBSD__) && !(defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#endif +#include + +#ifdef __OpenBSD__ +#include +#endif + +/* + * Define it to get a correct behavior on per-interface statistics. + * You will need to perform an extra routing table lookup, per fragment, + * to do it. This may, or may not be, a performance hit. + */ +#define IN6_IFSTAT_STRICT + +static void frag6_enq __P((struct ip6asfrag *, struct ip6asfrag *)); +static void frag6_deq __P((struct ip6asfrag *)); +static void frag6_insque __P((struct ip6q *, struct ip6q *)); +static void frag6_remque __P((struct ip6q *)); +static void frag6_freef __P((struct ip6q *)); + +/* XXX we eventually need splreass6, or some real semaphore */ +int frag6_doing_reass; +u_int frag6_nfragpackets; +struct ip6q ip6q; /* ip6 reassemble queue */ + + +#ifndef offsetof /* XXX */ +#define offsetof(type, member) ((size_t)(&((type *)0)->member)) +#endif + +/* + * Initialise reassembly queue and fragment identifier. + */ +void +frag6_init() +{ +#ifndef __OpenBSD__ + struct timeval tv; + +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 + ip6_maxfragpackets = nmbclusters / 4; +#endif + + /* + * in many cases, random() here does NOT return random number + * as initialization during bootstrap time occur in fixed order. + */ + microtime(&tv); + ip6_id = random() ^ tv.tv_usec; +#else + ip6_id = arc4random(); +#endif + ip6q.ip6q_next = ip6q.ip6q_prev = &ip6q; +} + +/* + * In RFC2460, fragment and reassembly rule do not agree with each other, + * in terms of next header field handling in fragment header. + * While the sender will use the same value for all of the fragmented packets, + * receiver is suggested not to check the consistency. + * + * fragment rule (p20): + * (2) A Fragment header containing: + * The Next Header value that identifies the first header of + * the Fragmentable Part of the original packet. + * -> next header field is same for all fragments + * + * reassembly rule (p21): + * The Next Header field of the last header of the Unfragmentable + * Part is obtained from the Next Header field of the first + * fragment's Fragment header. + * -> should grab it from the first fragment only + * + * The following note also contradicts with fragment rule - noone is going to + * send different fragment with different next header field. + * + * additional note (p22): + * The Next Header values in the Fragment headers of different + * fragments of the same original packet may differ. Only the value + * from the Offset zero fragment packet is used for reassembly. + * -> should grab it from the first fragment only + * + * There is no explicit reason given in the RFC. Historical reason maybe? + */ +/* + * Fragment input + */ +int +frag6_input(mp, offp, proto) + struct mbuf **mp; + int *offp, proto; +{ + struct mbuf *m = *mp, *t; + struct ip6_hdr *ip6; + struct ip6_frag *ip6f; + struct ip6q *q6; + struct ip6asfrag *af6, *ip6af, *af6dwn; + int offset = *offp, nxt, i, next; + int first_frag = 0; + int fragoff, frgpartlen; /* must be larger than u_int16_t */ + struct ifnet *dstifp; +#ifdef IN6_IFSTAT_STRICT +#ifdef NEW_STRUCT_ROUTE + static struct route ro; +#else + static struct route_in6 ro; +#endif + struct sockaddr_in6 *dst; +#endif + + ip6 = mtod(m, struct ip6_hdr *); +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, offset, sizeof(struct ip6_frag), IPPROTO_DONE); + ip6f = (struct ip6_frag *)((caddr_t)ip6 + offset); +#else + IP6_EXTHDR_GET(ip6f, struct ip6_frag *, m, offset, sizeof(*ip6f)); + if (ip6f == NULL) + return IPPROTO_DONE; +#endif + + dstifp = NULL; +#ifdef IN6_IFSTAT_STRICT + /* find the destination interface of the packet. */ + dst = (struct sockaddr_in6 *)&ro.ro_dst; + if (ro.ro_rt + && ((ro.ro_rt->rt_flags & RTF_UP) == 0 + || !IN6_ARE_ADDR_EQUAL(&dst->sin6_addr, &ip6->ip6_dst))) { + RTFREE(ro.ro_rt); + ro.ro_rt = (struct rtentry *)0; + } + if (ro.ro_rt == NULL) { + bzero(dst, sizeof(*dst)); + dst->sin6_family = AF_INET6; + dst->sin6_len = sizeof(struct sockaddr_in6); + dst->sin6_addr = ip6->ip6_dst; + } +#ifndef __bsdi__ + rtalloc((struct route *)&ro); +#else + rtcalloc((struct route *)&ro); +#endif + if (ro.ro_rt != NULL && ro.ro_rt->rt_ifa != NULL) + dstifp = ((struct in6_ifaddr *)ro.ro_rt->rt_ifa)->ia_ifp; +#else + /* we are violating the spec, this is not the destination interface */ + if ((m->m_flags & M_PKTHDR) != 0) + dstifp = m->m_pkthdr.rcvif; +#endif + + /* jumbo payload can't contain a fragment header */ + if (ip6->ip6_plen == 0) { + icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset); + in6_ifstat_inc(dstifp, ifs6_reass_fail); + return IPPROTO_DONE; + } + + /* + * check whether fragment packet's fragment length is + * multiple of 8 octets. + * sizeof(struct ip6_frag) == 8 + * sizeof(struct ip6_hdr) = 40 + */ + if ((ip6f->ip6f_offlg & IP6F_MORE_FRAG) && + (((ntohs(ip6->ip6_plen) - offset) & 0x7) != 0)) { + icmp6_error(m, ICMP6_PARAM_PROB, + ICMP6_PARAMPROB_HEADER, + offsetof(struct ip6_hdr, ip6_plen)); + in6_ifstat_inc(dstifp, ifs6_reass_fail); + return IPPROTO_DONE; + } + + ip6stat.ip6s_fragments++; + in6_ifstat_inc(dstifp, ifs6_reass_reqd); + + /* offset now points to data portion */ + offset += sizeof(struct ip6_frag); + + frag6_doing_reass = 1; + + for (q6 = ip6q.ip6q_next; q6 != &ip6q; q6 = q6->ip6q_next) + if (ip6f->ip6f_ident == q6->ip6q_ident && + IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &q6->ip6q_src) && + IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &q6->ip6q_dst)) + break; + + if (q6 == &ip6q) { + /* + * the first fragment to arrive, create a reassembly queue. + */ + first_frag = 1; + + /* + * Enforce upper bound on number of fragmented packets + * for which we attempt reassembly; + * If maxfrag is 0, never accept fragments. + * If maxfrag is -1, accept all fragments without limitation. + */ + if (ip6_maxfragpackets < 0) + ; + else if (frag6_nfragpackets >= (u_int)ip6_maxfragpackets) + goto dropfrag; + frag6_nfragpackets++; + q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FTABLE, + M_DONTWAIT); + if (q6 == NULL) + goto dropfrag; + bzero(q6, sizeof(*q6)); + + frag6_insque(q6, &ip6q); + + /* ip6q_nxt will be filled afterwards, from 1st fragment */ + q6->ip6q_down = q6->ip6q_up = (struct ip6asfrag *)q6; +#ifdef notyet + q6->ip6q_nxtp = (u_char *)nxtp; +#endif + q6->ip6q_ident = ip6f->ip6f_ident; + q6->ip6q_arrive = 0; /* Is it used anywhere? */ + q6->ip6q_ttl = IPV6_FRAGTTL; + q6->ip6q_src = ip6->ip6_src; + q6->ip6q_dst = ip6->ip6_dst; + q6->ip6q_unfrglen = -1; /* The 1st fragment has not arrived. */ + } + + /* + * If it's the 1st fragment, record the length of the + * unfragmentable part and the next header of the fragment header. + */ + fragoff = ntohs(ip6f->ip6f_offlg & IP6F_OFF_MASK); + if (fragoff == 0) { + q6->ip6q_unfrglen = offset - sizeof(struct ip6_hdr) + - sizeof(struct ip6_frag); + q6->ip6q_nxt = ip6f->ip6f_nxt; + } + + /* + * Check that the reassembled packet would not exceed 65535 bytes + * in size. + * If it would exceed, discard the fragment and return an ICMP error. + */ + frgpartlen = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen) - offset; + if (q6->ip6q_unfrglen >= 0) { + /* The 1st fragment has already arrived. */ + if (q6->ip6q_unfrglen + fragoff + frgpartlen > IPV6_MAXPACKET) { + icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, + offset - sizeof(struct ip6_frag) + + offsetof(struct ip6_frag, ip6f_offlg)); + frag6_doing_reass = 0; + return(IPPROTO_DONE); + } + } + else if (fragoff + frgpartlen > IPV6_MAXPACKET) { + icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, + offset - sizeof(struct ip6_frag) + + offsetof(struct ip6_frag, ip6f_offlg)); + frag6_doing_reass = 0; + return(IPPROTO_DONE); + } + /* + * If it's the first fragment, do the above check for each + * fragment already stored in the reassembly queue. + */ + if (fragoff == 0) { + for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; + af6 = af6dwn) { + af6dwn = af6->ip6af_down; + + if (q6->ip6q_unfrglen + af6->ip6af_off + af6->ip6af_frglen > + IPV6_MAXPACKET) { + struct mbuf *merr = IP6_REASS_MBUF(af6); + struct ip6_hdr *ip6err; + int erroff = af6->ip6af_offset; + + /* dequeue the fragment. */ + frag6_deq(af6); + free(af6, M_FTABLE); + + /* adjust pointer. */ + ip6err = mtod(merr, struct ip6_hdr *); + + /* + * Restore source and destination addresses + * in the erroneous IPv6 header. + */ + ip6err->ip6_src = q6->ip6q_src; + ip6err->ip6_dst = q6->ip6q_dst; + + icmp6_error(merr, ICMP6_PARAM_PROB, + ICMP6_PARAMPROB_HEADER, + erroff - sizeof(struct ip6_frag) + + offsetof(struct ip6_frag, ip6f_offlg)); + } + } + } + + ip6af = (struct ip6asfrag *)malloc(sizeof(struct ip6asfrag), M_FTABLE, + M_DONTWAIT); + if (ip6af == NULL) + goto dropfrag; + bzero(ip6af, sizeof(*ip6af)); + ip6af->ip6af_head = ip6->ip6_flow; + ip6af->ip6af_len = ip6->ip6_plen; + ip6af->ip6af_nxt = ip6->ip6_nxt; + ip6af->ip6af_hlim = ip6->ip6_hlim; + ip6af->ip6af_mff = ip6f->ip6f_offlg & IP6F_MORE_FRAG; + ip6af->ip6af_off = fragoff; + ip6af->ip6af_frglen = frgpartlen; + ip6af->ip6af_offset = offset; + IP6_REASS_MBUF(ip6af) = m; + + if (first_frag) { + af6 = (struct ip6asfrag *)q6; + goto insert; + } + + /* + * Find a segment which begins after this one does. + */ + for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; + af6 = af6->ip6af_down) + if (af6->ip6af_off > ip6af->ip6af_off) + break; + +#if 0 + /* + * If there is a preceding segment, it may provide some of + * our data already. If so, drop the data from the incoming + * segment. If it provides all of our data, drop us. + */ + if (af6->ip6af_up != (struct ip6asfrag *)q6) { + i = af6->ip6af_up->ip6af_off + af6->ip6af_up->ip6af_frglen + - ip6af->ip6af_off; + if (i > 0) { + if (i >= ip6af->ip6af_frglen) + goto dropfrag; + m_adj(IP6_REASS_MBUF(ip6af), i); + ip6af->ip6af_off += i; + ip6af->ip6af_frglen -= i; + } + } + + /* + * While we overlap succeeding segments trim them or, + * if they are completely covered, dequeue them. + */ + while (af6 != (struct ip6asfrag *)q6 && + ip6af->ip6af_off + ip6af->ip6af_frglen > af6->ip6af_off) { + i = (ip6af->ip6af_off + ip6af->ip6af_frglen) - af6->ip6af_off; + if (i < af6->ip6af_frglen) { + af6->ip6af_frglen -= i; + af6->ip6af_off += i; + m_adj(IP6_REASS_MBUF(af6), i); + break; + } + af6 = af6->ip6af_down; + m_freem(IP6_REASS_MBUF(af6->ip6af_up)); + frag6_deq(af6->ip6af_up); + } +#else + /* + * If the incoming framgent overlaps some existing fragments in + * the reassembly queue, drop it, since it is dangerous to override + * existing fragments from a security point of view. + */ + if (af6->ip6af_up != (struct ip6asfrag *)q6) { + i = af6->ip6af_up->ip6af_off + af6->ip6af_up->ip6af_frglen + - ip6af->ip6af_off; + if (i > 0) { +#if 0 /* suppress the noisy log */ + log(LOG_ERR, "%d bytes of a fragment from %s " + "overlaps the previous fragment\n", + i, ip6_sprintf(&q6->ip6q_src)); +#endif + free(ip6af, M_FTABLE); + goto dropfrag; + } + } + if (af6 != (struct ip6asfrag *)q6) { + i = (ip6af->ip6af_off + ip6af->ip6af_frglen) - af6->ip6af_off; + if (i > 0) { +#if 0 /* suppress the noisy log */ + log(LOG_ERR, "%d bytes of a fragment from %s " + "overlaps the succeeding fragment", + i, ip6_sprintf(&q6->ip6q_src)); +#endif + free(ip6af, M_FTABLE); + goto dropfrag; + } + } +#endif + +insert: + + /* + * Stick new segment in its place; + * check for complete reassembly. + * Move to front of packet queue, as we are + * the most recently active fragmented packet. + */ + frag6_enq(ip6af, af6->ip6af_up); +#if 0 /* xxx */ + if (q6 != ip6q.ip6q_next) { + frag6_remque(q6); + frag6_insque(q6, &ip6q); + } +#endif + next = 0; + for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; + af6 = af6->ip6af_down) { + if (af6->ip6af_off != next) { + frag6_doing_reass = 0; + return IPPROTO_DONE; + } + next += af6->ip6af_frglen; + } + if (af6->ip6af_up->ip6af_mff) { + frag6_doing_reass = 0; + return IPPROTO_DONE; + } + + /* + * Reassembly is complete; concatenate fragments. + */ + ip6af = q6->ip6q_down; + t = m = IP6_REASS_MBUF(ip6af); + af6 = ip6af->ip6af_down; + frag6_deq(ip6af); + while (af6 != (struct ip6asfrag *)q6) { + af6dwn = af6->ip6af_down; + frag6_deq(af6); + while (t->m_next) + t = t->m_next; + t->m_next = IP6_REASS_MBUF(af6); + m_adj(t->m_next, af6->ip6af_offset); + free(af6, M_FTABLE); + af6 = af6dwn; + } + + /* adjust offset to point where the original next header starts */ + offset = ip6af->ip6af_offset - sizeof(struct ip6_frag); + free(ip6af, M_FTABLE); + ip6 = mtod(m, struct ip6_hdr *); + ip6->ip6_plen = htons((u_short)next + offset - sizeof(struct ip6_hdr)); + ip6->ip6_src = q6->ip6q_src; + ip6->ip6_dst = q6->ip6q_dst; + nxt = q6->ip6q_nxt; +#ifdef notyet + *q6->ip6q_nxtp = (u_char)(nxt & 0xff); +#endif + + /* + * Delete frag6 header with as a few cost as possible. + */ + if (offset < m->m_len) { + ovbcopy((caddr_t)ip6, (caddr_t)ip6 + sizeof(struct ip6_frag), + offset); + m->m_data += sizeof(struct ip6_frag); + m->m_len -= sizeof(struct ip6_frag); + } else { + /* this comes with no copy if the boundary is on cluster */ + if ((t = m_split(m, offset, M_DONTWAIT)) == NULL) { + frag6_remque(q6); + free(q6, M_FTABLE); + frag6_nfragpackets--; + goto dropfrag; + } + m_adj(t, sizeof(struct ip6_frag)); + m_cat(m, t); + } + + /* + * Store NXT to the original. + */ + { + char *prvnxtp = ip6_get_prevhdr(m, offset); /* XXX */ + *prvnxtp = nxt; + } + + frag6_remque(q6); + free(q6, M_FTABLE); + frag6_nfragpackets--; + + if (m->m_flags & M_PKTHDR) { /* Isn't it always true? */ + int plen = 0; + for (t = m; t; t = t->m_next) + plen += t->m_len; + m->m_pkthdr.len = plen; + } + + ip6stat.ip6s_reassembled++; + in6_ifstat_inc(dstifp, ifs6_reass_ok); + + /* + * Tell launch routine the next header + */ + + *mp = m; + *offp = offset; + + frag6_doing_reass = 0; + return nxt; + + dropfrag: + in6_ifstat_inc(dstifp, ifs6_reass_fail); + ip6stat.ip6s_fragdropped++; + m_freem(m); + frag6_doing_reass = 0; + return IPPROTO_DONE; +} + +/* + * Free a fragment reassembly header and all + * associated datagrams. + */ +void +frag6_freef(q6) + struct ip6q *q6; +{ + struct ip6asfrag *af6, *down6; + + for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; + af6 = down6) { + struct mbuf *m = IP6_REASS_MBUF(af6); + + down6 = af6->ip6af_down; + frag6_deq(af6); + + /* + * Return ICMP time exceeded error for the 1st fragment. + * Just free other fragments. + */ + if (af6->ip6af_off == 0) { + struct ip6_hdr *ip6; + + /* adjust pointer */ + ip6 = mtod(m, struct ip6_hdr *); + + /* restoure source and destination addresses */ + ip6->ip6_src = q6->ip6q_src; + ip6->ip6_dst = q6->ip6q_dst; + + icmp6_error(m, ICMP6_TIME_EXCEEDED, + ICMP6_TIME_EXCEED_REASSEMBLY, 0); + } else + m_freem(m); + free(af6, M_FTABLE); + } + frag6_remque(q6); + free(q6, M_FTABLE); + frag6_nfragpackets--; +} + +/* + * Put an ip fragment on a reassembly chain. + * Like insque, but pointers in middle of structure. + */ +void +frag6_enq(af6, up6) + struct ip6asfrag *af6, *up6; +{ + af6->ip6af_up = up6; + af6->ip6af_down = up6->ip6af_down; + up6->ip6af_down->ip6af_up = af6; + up6->ip6af_down = af6; +} + +/* + * To frag6_enq as remque is to insque. + */ +void +frag6_deq(af6) + struct ip6asfrag *af6; +{ + af6->ip6af_up->ip6af_down = af6->ip6af_down; + af6->ip6af_down->ip6af_up = af6->ip6af_up; +} + +void +frag6_insque(new, old) + struct ip6q *new, *old; +{ + new->ip6q_prev = old; + new->ip6q_next = old->ip6q_next; + old->ip6q_next->ip6q_prev= new; + old->ip6q_next = new; +} + +void +frag6_remque(p6) + struct ip6q *p6; +{ + p6->ip6q_prev->ip6q_next = p6->ip6q_next; + p6->ip6q_next->ip6q_prev = p6->ip6q_prev; +} + +/* + * IPv6 reassembling timer processing; + * if a timer expires on a reassembly + * queue, discard it. + */ +void +frag6_slowtimo() +{ + struct ip6q *q6; +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + + frag6_doing_reass = 1; + q6 = ip6q.ip6q_next; + if (q6) + while (q6 != &ip6q) { + --q6->ip6q_ttl; + q6 = q6->ip6q_next; + if (q6->ip6q_prev->ip6q_ttl == 0) { + ip6stat.ip6s_fragtimeout++; + /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ + frag6_freef(q6->ip6q_prev); + } + } + /* + * If we are over the maximum number of fragments + * (due to the limit being lowered), drain off + * enough to get down to the new limit. + */ + while (frag6_nfragpackets > (u_int)ip6_maxfragpackets && + ip6q.ip6q_prev) { + ip6stat.ip6s_fragoverflow++; + /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ + frag6_freef(ip6q.ip6q_prev); + } + frag6_doing_reass = 0; + +#if 0 + /* + * Routing changes might produce a better route than we last used; + * make sure we notice eventually, even if forwarding only for one + * destination and the cache is never replaced. + */ + if (ip6_forward_rt.ro_rt) { + RTFREE(ip6_forward_rt.ro_rt); + ip6_forward_rt.ro_rt = 0; + } + if (ipsrcchk_rt.ro_rt) { + RTFREE(ipsrcchk_rt.ro_rt); + ipsrcchk_rt.ro_rt = 0; + } +#endif + + splx(s); +} + +/* + * Drain off all datagram fragments. + */ +void +frag6_drain() +{ + if (frag6_doing_reass) + return; + while (ip6q.ip6q_next != &ip6q) { + ip6stat.ip6s_fragdropped++; + /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ + frag6_freef(ip6q.ip6q_next); + } +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/icmp6.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/icmp6.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/icmp6.c @@ -0,0 +1,3623 @@ +//========================================================================== +// +// src/sys/netinet6/icmp6.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: icmp6.c,v 1.269 2001/12/18 02:19:16 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#if defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#include +#endif +#include +#include +#include +#include +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +#include +#include +#elif defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#else +#include +#endif +#include +#include +#include + +#ifdef __OpenBSD__ /* KAME IPSEC */ +#undef IPSEC +#endif + +#ifdef IPSEC +#include +#include +#endif + +#ifdef MIP6 +#include +#endif + +#ifdef HAVE_NRL_INPCB +/* inpcb members */ +#define in6pcb inpcb +#define in6p_laddr inp_laddr6 +#define in6p_faddr inp_faddr6 +#define in6p_icmp6filt inp_icmp6filt +#define in6p_route inp_route +#define in6p_socket inp_socket +#define in6p_flags inp_flags +#define in6p_moptions inp_moptions6 +#define in6p_outputopts inp_outputopts6 +#define in6p_ip6 inp_ipv6 +#define in6p_flowinfo inp_flowinfo +#define in6p_sp inp_sp +#define in6p_next inp_next +#define in6p_prev inp_prev + +/* + * for KAME src sync over BSD*'s. XXX: FreeBSD (>=3) are VERY different from + * others... + */ +#define in6p_ip6_nxt inp_ipv6.ip6_nxt +#endif + +extern struct domain inet6domain; +extern struct ip6protosw inet6sw[]; +extern u_char ip6_protox[]; + +struct icmp6stat icmp6stat; + +#if defined (__OpenBSD__) +extern struct inpcbtable rawin6pcbtable; +#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) +extern struct in6pcb rawin6pcb; +#else +extern struct inpcbhead ripcb; +#endif +extern int icmp6errppslim; +static int icmp6errpps_count = 0; +static struct timeval icmp6errppslim_last; +extern int icmp6_nodeinfo; +#if defined(__NetBSD__) || defined(__OpenBSD__) +/* + * List of callbacks to notify when Path MTU changes are made. + */ +struct icmp6_mtudisc_callback { + LIST_ENTRY(icmp6_mtudisc_callback) mc_list; + void (*mc_func) __P((struct in6_addr *)); +}; + +LIST_HEAD(, icmp6_mtudisc_callback) icmp6_mtudisc_callbacks = + LIST_HEAD_INITIALIZER(&icmp6_mtudisc_callbacks); + +static struct rttimer_queue *icmp6_mtudisc_timeout_q = NULL; +extern int pmtu_expire; + +/* XXX do these values make any sense? */ +static int icmp6_mtudisc_hiwat = 1280; +static int icmp6_mtudisc_lowat = 256; + +/* + * keep track of # of redirect routes. + */ +static struct rttimer_queue *icmp6_redirect_timeout_q = NULL; + +/* XXX do these values make any sense? */ +static int icmp6_redirect_hiwat = 1280; +static int icmp6_redirect_lowat = 1024; +#endif + +static void icmp6_errcount __P((struct icmp6errstat *, int, int)); +static int icmp6_rip6_input __P((struct mbuf **, int)); +static int icmp6_ratelimit __P((const struct in6_addr *, const int, const int)); +static const char *icmp6_redirect_diag __P((struct in6_addr *, + struct in6_addr *, struct in6_addr *)); +#ifndef HAVE_PPSRATECHECK +static int ppsratecheck __P((struct timeval *, int *, int)); +#endif +static struct mbuf *ni6_input __P((struct mbuf *, int)); +static struct mbuf *ni6_nametodns __P((const char *, int, int)); +static int ni6_dnsmatch __P((const char *, int, const char *, int)); +static int ni6_addrs __P((struct icmp6_nodeinfo *, struct mbuf *, + struct ifnet **, char *)); +static int ni6_store_addrs __P((struct icmp6_nodeinfo *, struct icmp6_nodeinfo *, + struct ifnet *, int)); +static int icmp6_notify_error __P((struct mbuf *, int, int, int)); +static int icmp6_recover_src __P((struct mbuf *)); +#if defined(__NetBSD__) || defined(__OpenBSD__) +static struct rtentry *icmp6_mtudisc_clone __P((struct sockaddr *)); +static void icmp6_mtudisc_timeout __P((struct rtentry *, struct rttimer *)); +static void icmp6_redirect_timeout __P((struct rtentry *, struct rttimer *)); +#endif + +void +icmp6_init() +{ + mld6_init(); +#if defined(__NetBSD__) || defined(__OpenBSD__) + icmp6_mtudisc_timeout_q = rt_timer_queue_create(pmtu_expire); + icmp6_redirect_timeout_q = rt_timer_queue_create(icmp6_redirtimeout); +#endif +} + +static void +icmp6_errcount(stat, type, code) + struct icmp6errstat *stat; + int type, code; +{ + switch (type) { + case ICMP6_DST_UNREACH: + switch (code) { + case ICMP6_DST_UNREACH_NOROUTE: + stat->icp6errs_dst_unreach_noroute++; + return; + case ICMP6_DST_UNREACH_ADMIN: + stat->icp6errs_dst_unreach_admin++; + return; + case ICMP6_DST_UNREACH_BEYONDSCOPE: + stat->icp6errs_dst_unreach_beyondscope++; + return; + case ICMP6_DST_UNREACH_ADDR: + stat->icp6errs_dst_unreach_addr++; + return; + case ICMP6_DST_UNREACH_NOPORT: + stat->icp6errs_dst_unreach_noport++; + return; + } + break; + case ICMP6_PACKET_TOO_BIG: + stat->icp6errs_packet_too_big++; + return; + case ICMP6_TIME_EXCEEDED: + switch (code) { + case ICMP6_TIME_EXCEED_TRANSIT: + stat->icp6errs_time_exceed_transit++; + return; + case ICMP6_TIME_EXCEED_REASSEMBLY: + stat->icp6errs_time_exceed_reassembly++; + return; + } + break; + case ICMP6_PARAM_PROB: + switch (code) { + case ICMP6_PARAMPROB_HEADER: + stat->icp6errs_paramprob_header++; + return; + case ICMP6_PARAMPROB_NEXTHEADER: + stat->icp6errs_paramprob_nextheader++; + return; + case ICMP6_PARAMPROB_OPTION: + stat->icp6errs_paramprob_option++; + return; + } + break; + case ND_REDIRECT: + stat->icp6errs_redirect++; + return; + } + stat->icp6errs_unknown++; +} + +#if defined(__NetBSD__) || defined(__OpenBSD__) +/* + * Register a Path MTU Discovery callback. + */ +void +icmp6_mtudisc_callback_register(func) + void (*func) __P((struct in6_addr *)); +{ + struct icmp6_mtudisc_callback *mc; + + for (mc = LIST_FIRST(&icmp6_mtudisc_callbacks); mc != NULL; + mc = LIST_NEXT(mc, mc_list)) { + if (mc->mc_func == func) + return; + } + + mc = malloc(sizeof(*mc), M_PCB, M_NOWAIT); + if (mc == NULL) + panic("icmp6_mtudisc_callback_register"); + + mc->mc_func = func; + LIST_INSERT_HEAD(&icmp6_mtudisc_callbacks, mc, mc_list); +} +#endif + +/* + * Generate an error packet of type error in response to bad IP6 packet. + */ +void +icmp6_error(m, type, code, param) + struct mbuf *m; + int type, code, param; +{ + struct ip6_hdr *oip6, *nip6; + struct icmp6_hdr *icmp6; + struct mbuf *n; + struct ip6aux *ip6a; + struct in6_addr nip6_src, *nip6_srcp; + u_int preplen; + int off; + int nxt; + + icmp6stat.icp6s_error++; + + /* count per-type-code statistics */ + icmp6_errcount(&icmp6stat.icp6s_outerrhist, type, code); + +#ifdef M_DECRYPTED /* not openbsd */ + if (m->m_flags & M_DECRYPTED) { + icmp6stat.icp6s_canterror++; + goto freeit; + } +#endif + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), ); +#else + if (m->m_len < sizeof(struct ip6_hdr)) { + m = m_pullup(m, sizeof(struct ip6_hdr)); + if (m == NULL) + return; + } +#endif + oip6 = mtod(m, struct ip6_hdr *); + + /* + * If the destination address of the erroneous packet is a multicast + * address, or the packet was sent using link-layer multicast, + * we should basically suppress sending an error (RFC 2463, Section + * 2.4). + * We have two exceptions (the item e.2 in that section): + * - the Pakcet Too Big message can be sent for path MTU discovery. + * - the Parameter Problem Message that can be allowed an icmp6 error + * in the option type field. This check has been done in + * ip6_unknown_opt(), so we can just check the type and code. + */ + if ((m->m_flags & (M_BCAST|M_MCAST) || + IN6_IS_ADDR_MULTICAST(&oip6->ip6_dst)) && + (type != ICMP6_PACKET_TOO_BIG && + (type != ICMP6_PARAM_PROB || + code != ICMP6_PARAMPROB_OPTION))) + goto freeit; + + /* + * RFC 2463, 2.4 (e.5): source address check. + * XXX: the case of anycast source? + */ + if (IN6_IS_ADDR_UNSPECIFIED(&oip6->ip6_src) || + IN6_IS_ADDR_MULTICAST(&oip6->ip6_src)) + goto freeit; + + /* + * If we are about to send ICMPv6 against ICMPv6 error/redirect, + * don't do it. + */ + nxt = -1; + off = ip6_lasthdr(m, 0, IPPROTO_IPV6, &nxt); + if (off >= 0 && nxt == IPPROTO_ICMPV6) { + struct icmp6_hdr *icp; + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, 0, off + sizeof(struct icmp6_hdr), ); + icp = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(icp, struct icmp6_hdr *, m, off, + sizeof(*icp)); + if (icp == NULL) { + icmp6stat.icp6s_tooshort++; + return; + } +#endif + if (icp->icmp6_type < ICMP6_ECHO_REQUEST || + icp->icmp6_type == ND_REDIRECT) { + /* + * ICMPv6 error + * Special case: for redirect (which is + * informational) we must not send icmp6 error. + */ + icmp6stat.icp6s_canterror++; + goto freeit; + } else { + /* ICMPv6 informational - send the error */ + } + } +#if 0 /* controversial */ + else if (off >= 0 && nxt == IPPROTO_ESP) { + /* + * It could be ICMPv6 error inside ESP. Take a safer side, + * don't respond. + */ + icmp6stat.icp6s_canterror++; + goto freeit; + } +#endif + else { + /* non-ICMPv6 - send the error */ + } + + oip6 = mtod(m, struct ip6_hdr *); /* adjust pointer */ + + /* Finally, do rate limitation check. */ + if (icmp6_ratelimit(&oip6->ip6_src, type, code)) { + icmp6stat.icp6s_toofreq++; + goto freeit; + } + + /* + * OK, ICMP6 can be generated. + */ + + /* + * Recover the original ip6_src if the src and the homeaddr + * have been swapped while dest6 processing (see dest6.c). To + * avoid m_pulldown, we had better to swap addresses before + * m_prepend below. + * + * XXX: We should consider the other candidate to keep the + * icmp6 error packet correct that not swapping ip6_src and + * homeaddr in the dest6 processing. + */ + nip6_srcp = &oip6->ip6_src; + n = ip6_findaux(m); + if (n != NULL) { + ip6a = mtod(n, struct ip6aux *); + if ((ip6a->ip6a_flags & IP6A_HASEEN) != 0 && + (ip6a->ip6a_flags & IP6A_SWAP) != 0) { + nip6_src = oip6->ip6_src; + nip6_srcp = &nip6_src; + if (icmp6_recover_src(m)) { + /* mbuf is freed in icmp6_recover_src */ + return; + } + oip6 = mtod(m, struct ip6_hdr *); /* adjust pointer */ + } + } + + if (m->m_pkthdr.len >= ICMPV6_PLD_MAXLEN) + m_adj(m, ICMPV6_PLD_MAXLEN - m->m_pkthdr.len); + + preplen = sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr); + M_PREPEND(m, preplen, M_DONTWAIT); + if (m && m->m_len < preplen) + m = m_pullup(m, preplen); + if (m == NULL) { + nd6log((LOG_DEBUG, "ENOBUFS in icmp6_error %d\n", __LINE__)); + return; + } + + nip6 = mtod(m, struct ip6_hdr *); + nip6->ip6_src = *nip6_srcp; + nip6->ip6_dst = oip6->ip6_dst; + + if (IN6_IS_SCOPE_LINKLOCAL(&oip6->ip6_src)) + oip6->ip6_src.s6_addr16[1] = 0; + if (IN6_IS_SCOPE_LINKLOCAL(&oip6->ip6_dst)) + oip6->ip6_dst.s6_addr16[1] = 0; + + icmp6 = (struct icmp6_hdr *)(nip6 + 1); + icmp6->icmp6_type = type; + icmp6->icmp6_code = code; + icmp6->icmp6_pptr = htonl((u_int32_t)param); + + /* + * icmp6_reflect() is designed to be in the input path. + * icmp6_error() can be called from both input and outut path, + * and if we are in output path rcvif could contain bogus value. + * clear m->m_pkthdr.rcvif for safety, we should have enough scope + * information in ip header (nip6). + */ + m->m_pkthdr.rcvif = NULL; + + icmp6stat.icp6s_outhist[type]++; + icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */ + + return; + + freeit: + /* + * If we can't tell wheter or not we can generate ICMP6, free it. + */ + m_freem(m); +} + +/* + * Process a received ICMP6 message. + */ +int +icmp6_input(mp, offp, proto) + struct mbuf **mp; + int *offp, proto; +{ + struct mbuf *m = *mp, *n; + struct ip6_hdr *ip6, *nip6; + struct icmp6_hdr *icmp6, *nicmp6; + int off = *offp; + int icmp6len = m->m_pkthdr.len - *offp; + int code, sum, noff; + + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_msg); + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE); + /* m might change if M_LOOP. So, call mtod after this */ +#endif + + /* + * Locate icmp6 structure in mbuf, and check + * that not corrupted and of at least minimum length + */ + + ip6 = mtod(m, struct ip6_hdr *); + if (icmp6len < sizeof(struct icmp6_hdr)) { + icmp6stat.icp6s_tooshort++; + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error); + goto freeit; + } + + /* + * calculate the checksum + */ +#ifndef PULLDOWN_TEST + icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off); +#else + IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6)); + if (icmp6 == NULL) { + icmp6stat.icp6s_tooshort++; + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error); + return IPPROTO_DONE; + } +#endif + code = icmp6->icmp6_code; + + if ((sum = in6_cksum(m, IPPROTO_ICMPV6, off, icmp6len)) != 0) { + nd6log((LOG_ERR, + "ICMP6 checksum error(%d|%x) %s\n", + icmp6->icmp6_type, sum, ip6_sprintf(&ip6->ip6_src))); + icmp6stat.icp6s_checksum++; + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error); + goto freeit; + } + +#if defined(NFAITH) && 0 < NFAITH + if (faithprefix(&ip6->ip6_dst)) { + /* + * Deliver very specific ICMP6 type only. + * This is important to deilver TOOBIG. Otherwise PMTUD + * will not work. + */ + switch (icmp6->icmp6_type) { + case ICMP6_DST_UNREACH: + case ICMP6_PACKET_TOO_BIG: + case ICMP6_TIME_EXCEEDED: + break; + default: + goto freeit; + } + } +#endif + + icmp6stat.icp6s_inhist[icmp6->icmp6_type]++; + +#ifdef MIP6 + if (mip6_icmp6_tunnel_input(m, off, icmp6len)) { + goto freeit; + } +#endif /* MIP6 */ + switch (icmp6->icmp6_type) { + case ICMP6_DST_UNREACH: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_dstunreach); +#ifdef MIP6 + if (mip6_icmp6_input(m, off, icmp6len)) + goto freeit; +#endif /* MIP6 */ + switch (code) { + case ICMP6_DST_UNREACH_NOROUTE: + code = PRC_UNREACH_NET; + break; + case ICMP6_DST_UNREACH_ADMIN: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_adminprohib); + code = PRC_UNREACH_PROTOCOL; /* is this a good code? */ + break; + case ICMP6_DST_UNREACH_ADDR: + code = PRC_HOSTDEAD; + break; +#ifdef COMPAT_RFC1885 + case ICMP6_DST_UNREACH_NOTNEIGHBOR: + code = PRC_UNREACH_SRCFAIL; + break; +#else + case ICMP6_DST_UNREACH_BEYONDSCOPE: + /* I mean "source address was incorrect." */ + code = PRC_UNREACH_NET; + break; +#endif + case ICMP6_DST_UNREACH_NOPORT: + code = PRC_UNREACH_PORT; + break; + default: + goto badcode; + } + goto deliver; + break; + + case ICMP6_PACKET_TOO_BIG: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_pkttoobig); + if (code != 0) + goto badcode; + + code = PRC_MSGSIZE; + + /* + * Updating the path MTU will be done after examining + * intermediate extension headers. + */ + goto deliver; + break; + + case ICMP6_TIME_EXCEEDED: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_timeexceed); + switch (code) { + case ICMP6_TIME_EXCEED_TRANSIT: + code = PRC_TIMXCEED_INTRANS; + break; + case ICMP6_TIME_EXCEED_REASSEMBLY: + code = PRC_TIMXCEED_REASS; + break; + default: + goto badcode; + } + goto deliver; + break; + + case ICMP6_PARAM_PROB: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_paramprob); + switch (code) { + case ICMP6_PARAMPROB_NEXTHEADER: + code = PRC_UNREACH_PROTOCOL; + break; + case ICMP6_PARAMPROB_HEADER: + case ICMP6_PARAMPROB_OPTION: +#ifdef MIP6 + if (mip6_icmp6_input(m, off, icmp6len)) + goto freeit; +#endif /* MIP6 */ + code = PRC_PARAMPROB; + break; + default: + goto badcode; + } + goto deliver; + break; + + case ICMP6_ECHO_REQUEST: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_echo); + if (code != 0) + goto badcode; + /* + * Copy mbuf to send to two data paths: userland socket(s), + * and to the querier (echo reply). + * m: a copy for socket, n: a copy for querier + */ + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { + /* Give up local */ + n = m; + m = NULL; + goto deliverecho; + } + /* + * If the first mbuf is shared, or the first mbuf is too short, + * copy the first part of the data into a fresh mbuf. + * Otherwise, we will wrongly overwrite both copies. + */ + if ((n->m_flags & M_EXT) != 0 || + n->m_len < off + sizeof(struct icmp6_hdr)) { + struct mbuf *n0 = n; + const int maxlen = sizeof(*nip6) + sizeof(*nicmp6); + + /* + * Prepare an internal mbuf. m_pullup() doesn't + * always copy the length we specified. + */ + if (maxlen >= MCLBYTES) { + /* Give up remote */ + m_freem(n0); + break; + } + MGETHDR(n, M_DONTWAIT, n0->m_type); + if (n && maxlen >= MHLEN) { + MCLGET(n, M_DONTWAIT); + if ((n->m_flags & M_EXT) == 0) { + m_free(n); + n = NULL; + } + } + if (n == NULL) { + /* Give up local */ + m_freem(n0); + n = m; + m = NULL; + goto deliverecho; + } +#ifdef __OpenBSD__ + M_MOVE_PKTHDR(n, n0); +#else + M_COPY_PKTHDR(n, n0); +#endif + /* + * Copy IPv6 and ICMPv6 only. + */ + nip6 = mtod(n, struct ip6_hdr *); + bcopy(ip6, nip6, sizeof(struct ip6_hdr)); + nicmp6 = (struct icmp6_hdr *)(nip6 + 1); + bcopy(icmp6, nicmp6, sizeof(struct icmp6_hdr)); + noff = sizeof(struct ip6_hdr); + n->m_len = noff + sizeof(struct icmp6_hdr); + /* + * Adjust mbuf. ip6_plen will be adjusted in + * ip6_output(). + * n->m_pkthdr.len == n0->m_pkthdr.len at this point. + */ + n->m_pkthdr.len += noff + sizeof(struct icmp6_hdr); + n->m_pkthdr.len -= (off + sizeof(struct icmp6_hdr)); + m_adj(n0, off + sizeof(struct icmp6_hdr)); + n->m_next = n0; + n0->m_flags &= ~M_PKTHDR; + } else { + deliverecho: + nip6 = mtod(n, struct ip6_hdr *); + nicmp6 = (struct icmp6_hdr *)((caddr_t)nip6 + off); + noff = off; + } + nicmp6->icmp6_type = ICMP6_ECHO_REPLY; + nicmp6->icmp6_code = 0; + if (n) { + icmp6stat.icp6s_reflect++; + icmp6stat.icp6s_outhist[ICMP6_ECHO_REPLY]++; + icmp6_reflect(n, noff); + } + if (!m) + goto freeit; + break; + + case ICMP6_ECHO_REPLY: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_echoreply); + if (code != 0) + goto badcode; + break; + +#ifdef MIP6 + case ICMP6_HADISCOV_REQUEST: + if (icmp6len < sizeof(struct ha_discov_req)) + goto badlen; + if (code != 0) + goto badcode; + if (mip6_icmp6_input(m, off, icmp6len)) + goto freeit; + break; + case ICMP6_HADISCOV_REPLY: + if (icmp6len < sizeof(struct ha_discov_rep)) + goto badlen; + if (code != 0) + goto badcode; + if (mip6_icmp6_input(m, off, icmp6len)) + goto freeit; + break; +#ifndef MIP6_DRAFT13 + case ICMP6_MOBILEPREFIX_SOLICIT: + if (icmp6len < sizeof(struct mobile_prefix_solicit)) + goto badlen; + if (code != 0) + goto badcode; + if (mip6_icmp6_input(m, off, icmp6len)) + goto freeit; + break; + + case ICMP6_MOBILEPREFIX_ADVERT: + if (icmp6len < sizeof (struct mobile_prefix_advert)) + goto badlen; + if (code != 0) + goto badcode; + if (mip6_icmp6_input(m, off, icmp6len)) + goto freeit; + break; +#endif /* !MIP6_DRAFT13 */ +#endif /* MIP6 */ + + case MLD_LISTENER_QUERY: + case MLD_LISTENER_REPORT: + if (icmp6len < sizeof(struct mld_hdr)) + goto badlen; + if (icmp6->icmp6_type == MLD_LISTENER_QUERY) /* XXX: ugly... */ + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mldquery); + else + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mldreport); + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { + /* give up local */ + mld6_input(m, off); + m = NULL; + goto freeit; + } + mld6_input(n, off); + /* m stays. */ + break; + + case MLD_LISTENER_DONE: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mlddone); + if (icmp6len < sizeof(struct mld_hdr)) /* necessary? */ + goto badlen; + break; /* nothing to be done in kernel */ + + case MLD_MTRACE_RESP: + case MLD_MTRACE: + /* XXX: these two are experimental. not officially defined. */ + /* XXX: per-interface statistics? */ + break; /* just pass it to applications */ + + case ICMP6_WRUREQUEST: /* ICMP6_FQDN_QUERY */ + { + enum { WRU, FQDN } mode; + + if (!icmp6_nodeinfo) + break; + + if (icmp6len == sizeof(struct icmp6_hdr) + 4) + mode = WRU; + else if (icmp6len >= sizeof(struct icmp6_nodeinfo)) + mode = FQDN; + else + goto badlen; + +#ifdef __FreeBSD__ +#define hostnamelen strlen(hostname) +#endif + if (mode == FQDN) { +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_nodeinfo), + IPPROTO_DONE); +#endif + n = m_copym(m, 0, M_COPYALL, M_DONTWAIT); + if (n) + n = ni6_input(n, off); + /* XXX meaningless if n == NULL */ + noff = sizeof(struct ip6_hdr); + } else { + u_char *p; + int maxlen, maxhlen; + + if ((icmp6_nodeinfo & 5) != 5) + break; + + if (code != 0) + goto badcode; + maxlen = sizeof(*nip6) + sizeof(*nicmp6) + 4; + if (maxlen >= MCLBYTES) { + /* Give up remote */ + break; + } + MGETHDR(n, M_DONTWAIT, m->m_type); + if (n && maxlen > MHLEN) { + MCLGET(n, M_DONTWAIT); + if ((n->m_flags & M_EXT) == 0) { + m_free(n); + n = NULL; + } + } + if (n == NULL) { + /* Give up remote */ + break; + } + n->m_pkthdr.rcvif = NULL; + n->m_len = 0; + maxhlen = M_TRAILINGSPACE(n) - maxlen; + if (maxhlen > hostnamelen) + maxhlen = hostnamelen; + /* + * Copy IPv6 and ICMPv6 only. + */ + nip6 = mtod(n, struct ip6_hdr *); + bcopy(ip6, nip6, sizeof(struct ip6_hdr)); + nicmp6 = (struct icmp6_hdr *)(nip6 + 1); + bcopy(icmp6, nicmp6, sizeof(struct icmp6_hdr)); + p = (u_char *)(nicmp6 + 1); + bzero(p, 4); + bcopy(hostname, p + 4, maxhlen); /* meaningless TTL */ + noff = sizeof(struct ip6_hdr); +#ifdef __OpenBSD__ + M_DUP_PKTHDR(n, m); /* just for rcvif */ +#else + M_COPY_PKTHDR(n, m); /* just for rcvif */ +#endif + n->m_pkthdr.len = n->m_len = sizeof(struct ip6_hdr) + + sizeof(struct icmp6_hdr) + 4 + maxhlen; + nicmp6->icmp6_type = ICMP6_WRUREPLY; + nicmp6->icmp6_code = 0; + } +#undef hostnamelen + if (n) { + icmp6stat.icp6s_reflect++; + icmp6stat.icp6s_outhist[ICMP6_WRUREPLY]++; + icmp6_reflect(n, noff); + } + break; + } + + case ICMP6_WRUREPLY: + if (code != 0) + goto badcode; + break; + + case ND_ROUTER_SOLICIT: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_routersolicit); + if (code != 0) + goto badcode; + if (icmp6len < sizeof(struct nd_router_solicit)) + goto badlen; + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { + /* give up local */ + nd6_rs_input(m, off, icmp6len); + m = NULL; + goto freeit; + } + nd6_rs_input(n, off, icmp6len); + /* m stays. */ + break; + + case ND_ROUTER_ADVERT: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_routeradvert); + if (code != 0) + goto badcode; + if (icmp6len < sizeof(struct nd_router_advert)) + goto badlen; + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { + /* give up local */ + nd6_ra_input(m, off, icmp6len); + m = NULL; + goto freeit; + } + nd6_ra_input(n, off, icmp6len); + /* m stays. */ + break; + + case ND_NEIGHBOR_SOLICIT: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_neighborsolicit); + if (code != 0) + goto badcode; + if (icmp6len < sizeof(struct nd_neighbor_solicit)) + goto badlen; + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { + /* give up local */ + nd6_ns_input(m, off, icmp6len); + m = NULL; + goto freeit; + } + nd6_ns_input(n, off, icmp6len); + /* m stays. */ + break; + + case ND_NEIGHBOR_ADVERT: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_neighboradvert); + if (code != 0) + goto badcode; + if (icmp6len < sizeof(struct nd_neighbor_advert)) + goto badlen; + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { + /* give up local */ + nd6_na_input(m, off, icmp6len); + m = NULL; + goto freeit; + } + nd6_na_input(n, off, icmp6len); + /* m stays. */ + break; + + case ND_REDIRECT: + icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_redirect); + if (code != 0) + goto badcode; + if (icmp6len < sizeof(struct nd_redirect)) + goto badlen; + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { + /* give up local */ + icmp6_redirect_input(m, off); + m = NULL; + goto freeit; + } + icmp6_redirect_input(n, off); + /* m stays. */ + break; + + case ICMP6_ROUTER_RENUMBERING: + if (code != ICMP6_ROUTER_RENUMBERING_COMMAND && + code != ICMP6_ROUTER_RENUMBERING_RESULT) + goto badcode; + if (icmp6len < sizeof(struct icmp6_router_renum)) + goto badlen; + break; + + default: + nd6log((LOG_DEBUG, + "icmp6_input: unknown type %d(src=%s, dst=%s, ifid=%d)\n", + icmp6->icmp6_type, ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), + m->m_pkthdr.rcvif ? m->m_pkthdr.rcvif->if_index : 0)); + if (icmp6->icmp6_type < ICMP6_ECHO_REQUEST) { + /* ICMPv6 error: MUST deliver it by spec... */ + code = PRC_NCMDS; + /* deliver */ + } else { + /* ICMPv6 informational: MUST not deliver */ + break; + } + deliver: + if (icmp6_notify_error(m, off, icmp6len, code)) { + /* In this case, m should've been freed. */ + return(IPPROTO_DONE); + } + break; + + badcode: + icmp6stat.icp6s_badcode++; + break; + + badlen: + icmp6stat.icp6s_badlen++; + break; + } + + /* deliver the packet to appropriate sockets */ + icmp6_rip6_input(&m, *offp); + + return IPPROTO_DONE; + + freeit: + m_freem(m); + return IPPROTO_DONE; +} + +static int +icmp6_notify_error(m, off, icmp6len, code) + struct mbuf *m; + int off, icmp6len; +{ + struct icmp6_hdr *icmp6; + struct ip6_hdr *eip6; + u_int32_t notifymtu; + int64_t zoneid; + struct sockaddr_in6 icmp6src, icmp6dst; + + if (icmp6len < sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr)) { + icmp6stat.icp6s_tooshort++; + goto freeit; + } +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, + sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr), + -1); + icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, + sizeof(*icmp6) + sizeof(struct ip6_hdr)); + if (icmp6 == NULL) { + icmp6stat.icp6s_tooshort++; + return(-1); + } +#endif + eip6 = (struct ip6_hdr *)(icmp6 + 1); + + /* Detect the upper level protocol */ + { + void (*ctlfunc) __P((int, struct sockaddr *, void *)); + u_int8_t nxt = eip6->ip6_nxt; + int eoff = off + sizeof(struct icmp6_hdr) + + sizeof(struct ip6_hdr); + struct ip6ctlparam ip6cp; + struct in6_addr *finaldst = NULL; + int icmp6type = icmp6->icmp6_type; + struct ip6_frag *fh; + struct ip6_rthdr *rth; + struct ip6_rthdr0 *rth0; + int rthlen; + + while (1) { /* XXX: should avoid infinite loop explicitly? */ + struct ip6_ext *eh; + + switch (nxt) { + case IPPROTO_HOPOPTS: + case IPPROTO_DSTOPTS: + case IPPROTO_AH: +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, 0, eoff + + sizeof(struct ip6_ext), + -1); + eh = (struct ip6_ext *)(mtod(m, caddr_t) + + eoff); +#else + IP6_EXTHDR_GET(eh, struct ip6_ext *, m, + eoff, sizeof(*eh)); + if (eh == NULL) { + icmp6stat.icp6s_tooshort++; + return(-1); + } +#endif + + if (nxt == IPPROTO_AH) + eoff += (eh->ip6e_len + 2) << 2; + else + eoff += (eh->ip6e_len + 1) << 3; + nxt = eh->ip6e_nxt; + break; + case IPPROTO_ROUTING: + /* + * When the erroneous packet contains a + * routing header, we should examine the + * header to determine the final destination. + * Otherwise, we can't properly update + * information that depends on the final + * destination (e.g. path MTU). + */ +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, 0, eoff + sizeof(*rth), + -1); + rth = (struct ip6_rthdr *)(mtod(m, caddr_t) + + eoff); +#else + IP6_EXTHDR_GET(rth, struct ip6_rthdr *, m, + eoff, sizeof(*rth)); + if (rth == NULL) { + icmp6stat.icp6s_tooshort++; + return(-1); + } +#endif + rthlen = (rth->ip6r_len + 1) << 3; + /* + * XXX: currently there is no + * officially defined type other + * than type-0. + * Note that if the segment left field + * is 0, all intermediate hops must + * have been passed. + */ + if (rth->ip6r_segleft && + rth->ip6r_type == IPV6_RTHDR_TYPE_0) { + int hops; + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, 0, eoff + rthlen, + -1); + rth0 = (struct ip6_rthdr0 *)(mtod(m, caddr_t) + eoff); +#else + IP6_EXTHDR_GET(rth0, + struct ip6_rthdr0 *, m, + eoff, rthlen); + if (rth0 == NULL) { + icmp6stat.icp6s_tooshort++; + return(-1); + } +#endif + /* just ignore a bogus header */ + if ((rth0->ip6r0_len % 2) == 0 && + (hops = rth0->ip6r0_len/2)) + finaldst = (struct in6_addr *)(rth0 + 1) + (hops - 1); + } + eoff += rthlen; + nxt = rth->ip6r_nxt; + break; + case IPPROTO_FRAGMENT: +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, 0, eoff + + sizeof(struct ip6_frag), + -1); + fh = (struct ip6_frag *)(mtod(m, caddr_t) + + eoff); +#else + IP6_EXTHDR_GET(fh, struct ip6_frag *, m, + eoff, sizeof(*fh)); + if (fh == NULL) { + icmp6stat.icp6s_tooshort++; + return(-1); + } +#endif + /* + * Data after a fragment header is meaningless + * unless it is the first fragment, but + * we'll go to the notify label for path MTU + * discovery. + */ + if (fh->ip6f_offlg & IP6F_OFF_MASK) + goto notify; + + eoff += sizeof(struct ip6_frag); + nxt = fh->ip6f_nxt; + break; + default: + /* + * This case includes ESP and the No Next + * Header. In such cases going to the notify + * label does not have any meaning + * (i.e. ctlfunc will be NULL), but we go + * anyway since we might have to update + * path MTU information. + */ + goto notify; + } + } + notify: +#ifndef PULLDOWN_TEST + icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, + sizeof(*icmp6) + sizeof(struct ip6_hdr)); + if (icmp6 == NULL) { + icmp6stat.icp6s_tooshort++; + return(-1); + } +#endif + + eip6 = (struct ip6_hdr *)(icmp6 + 1); + bzero(&icmp6dst, sizeof(icmp6dst)); + icmp6dst.sin6_len = sizeof(struct sockaddr_in6); + icmp6dst.sin6_family = AF_INET6; + if (finaldst == NULL) + icmp6dst.sin6_addr = eip6->ip6_dst; + else + icmp6dst.sin6_addr = *finaldst; + if ((zoneid = in6_addr2zoneid(m->m_pkthdr.rcvif, + &icmp6dst.sin6_addr)) < 0) + goto freeit; + icmp6dst.sin6_scope_id = zoneid; + if (in6_embedscope(&icmp6dst.sin6_addr, &icmp6dst)) { + /* should be impossbile */ + nd6log((LOG_DEBUG, + "icmp6_notify_error: in6_embedscope failed\n")); + goto freeit; + } + + /* + * retrieve parameters from the inner IPv6 header, and convert + * them into sockaddr structures. + */ + bzero(&icmp6src, sizeof(icmp6src)); + icmp6src.sin6_len = sizeof(struct sockaddr_in6); + icmp6src.sin6_family = AF_INET6; + icmp6src.sin6_addr = eip6->ip6_src; + if ((zoneid = in6_addr2zoneid(m->m_pkthdr.rcvif, + &icmp6src.sin6_addr)) < 0) + goto freeit; + icmp6src.sin6_scope_id = zoneid; + if (in6_embedscope(&icmp6src.sin6_addr, &icmp6src)) { + /* should be impossbile */ + nd6log((LOG_DEBUG, + "icmp6_notify_error: in6_embedscope failed\n")); + goto freeit; + } + icmp6src.sin6_flowinfo = + (eip6->ip6_flow & IPV6_FLOWLABEL_MASK); + + if (finaldst == NULL) + finaldst = &eip6->ip6_dst; + ip6cp.ip6c_m = m; + ip6cp.ip6c_icmp6 = icmp6; + ip6cp.ip6c_ip6 = (struct ip6_hdr *)(icmp6 + 1); + ip6cp.ip6c_off = eoff; + ip6cp.ip6c_finaldst = finaldst; + ip6cp.ip6c_src = &icmp6src; + ip6cp.ip6c_nxt = nxt; + + if (icmp6type == ICMP6_PACKET_TOO_BIG) { + notifymtu = ntohl(icmp6->icmp6_mtu); + ip6cp.ip6c_cmdarg = (void *)¬ifymtu; +#if !(defined(__NetBSD__) || defined(__OpenBSD__)) + icmp6_mtudisc_update(&ip6cp, 1); /* XXX */ +#endif + } + + ctlfunc = (void (*) __P((int, struct sockaddr *, void *))) + (inet6sw[ip6_protox[nxt]].pr_ctlinput); + if (ctlfunc) { + (void) (*ctlfunc)(code, (struct sockaddr *)&icmp6dst, + &ip6cp); + } + } + return(0); + + freeit: + m_freem(m); + return(-1); +} + +void +icmp6_mtudisc_update(ip6cp, validated) + struct ip6ctlparam *ip6cp; + int validated; +{ +#if defined(__NetBSD__) || defined(__OpenBSD__) + unsigned long rtcount; + struct icmp6_mtudisc_callback *mc; +#endif + struct in6_addr *dst = ip6cp->ip6c_finaldst; + struct icmp6_hdr *icmp6 = ip6cp->ip6c_icmp6; + struct mbuf *m = ip6cp->ip6c_m; /* will be necessary for scope issue */ + u_int mtu = ntohl(icmp6->icmp6_mtu); + struct rtentry *rt = NULL; + struct sockaddr_in6 sin6; +#ifdef __bsdi__ +#ifdef NEW_STRUCT_ROUTE + struct route ro6; +#else + struct route_in6 ro6; +#endif +#endif + +#if defined(__NetBSD__) || defined(__OpenBSD__) + /* + * allow non-validated cases if memory is plenty, to make traffic + * from non-connected pcb happy. + */ + rtcount = rt_timer_count(icmp6_mtudisc_timeout_q); + if (validated) { + if (0 <= icmp6_mtudisc_hiwat && rtcount > icmp6_mtudisc_hiwat) + return; + else if (0 <= icmp6_mtudisc_lowat && + rtcount > icmp6_mtudisc_lowat) { + /* + * XXX nuke a victim, install the new one. + */ + } + } else { + if (0 <= icmp6_mtudisc_lowat && rtcount > icmp6_mtudisc_lowat) + return; + } +#else + if (!validated) + return; +#endif + + bzero(&sin6, sizeof(sin6)); + sin6.sin6_family = PF_INET6; + sin6.sin6_len = sizeof(struct sockaddr_in6); + sin6.sin6_addr = *dst; + /* XXX normally, this won't happen */ + if (IN6_IS_ADDR_LINKLOCAL(dst)) { + sin6.sin6_addr.s6_addr16[1] = + htons(m->m_pkthdr.rcvif->if_index); + } + /* sin6.sin6_scope_id = XXX: should be set if DST is a scoped addr */ +#if defined(__NetBSD__) || defined(__OpenBSD__) + rt = icmp6_mtudisc_clone((struct sockaddr *)&sin6); +#else +#ifdef __FreeBSD__ + rt = rtalloc1((struct sockaddr *)&sin6, 0, + RTF_CLONING | RTF_PRCLONING); +#else +#ifdef __bsdi__ + bcopy(&sin6, &ro6.ro_dst, sizeof(struct sockaddr_in6)); + ro6.ro_rt = 0; + /* rtcalloc((struct route *)&ro6); */ + rtalloc((struct route *)&ro6); + rt = ro6.ro_rt; +#else +#error no case for this particular operating system +#endif +#endif +#endif + + if (rt && (rt->rt_flags & RTF_HOST) + && !(rt->rt_rmx.rmx_locks & RTV_MTU)) { + if (mtu < IPV6_MMTU) { + /* xxx */ + rt->rt_rmx.rmx_locks |= RTV_MTU; + } else if (mtu < rt->rt_ifp->if_mtu && + rt->rt_rmx.rmx_mtu > mtu) { + icmp6stat.icp6s_pmtuchg++; + rt->rt_rmx.rmx_mtu = mtu; + } + } + if (rt) { /* XXX: need braces to avoid conflict with else in RTFREE. */ + RTFREE(rt); + } + +#if defined(__NetBSD__) || defined(__OpenBSD__) + /* + * Notify protocols that the MTU for this destination + * has changed. + */ + for (mc = LIST_FIRST(&icmp6_mtudisc_callbacks); mc != NULL; + mc = LIST_NEXT(mc, mc_list)) + (*mc->mc_func)(&sin6.sin6_addr); +#endif +} + +/* + * Process a Node Information Query packet, based on + * draft-ietf-ipngwg-icmp-name-lookups-07. + * + * Spec incompatibilities: + * - IPv6 Subject address handling + * - IPv4 Subject address handling support missing + * - Proxy reply (answer even if it's not for me) + * - joins NI group address at in6_ifattach() time only, does not cope + * with hostname changes by sethostname(3) + */ +#ifdef __FreeBSD__ +#define hostnamelen strlen(hostname) +#endif +#ifndef offsetof /* XXX */ +#define offsetof(type, member) ((size_t)(&((type *)0)->member)) +#endif +static struct mbuf * +ni6_input(m, off) + struct mbuf *m; + int off; +{ + struct icmp6_nodeinfo *ni6, *nni6; + struct mbuf *n = NULL; + u_int16_t qtype; + int subjlen; + int replylen = sizeof(struct ip6_hdr) + sizeof(struct icmp6_nodeinfo); + struct ni_reply_fqdn *fqdn; + int addrs; /* for NI_QTYPE_NODEADDR */ + struct ifnet *ifp = NULL; /* for NI_QTYPE_NODEADDR */ + struct sockaddr_in6 sin6; /* double meaning; ip6_dst and subjectaddr */ + struct sockaddr_in6 sin6_d; /* XXX: we should retrieve this from m_aux */ + struct ip6_hdr *ip6; + int oldfqdn = 0; /* if 1, return pascal string (03 draft) */ + char *subj = NULL; + struct in6_ifaddr *ia6 = NULL; + int64_t zoneid; + + ip6 = mtod(m, struct ip6_hdr *); +#ifndef PULLDOWN_TEST + ni6 = (struct icmp6_nodeinfo *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(ni6, struct icmp6_nodeinfo *, m, off, sizeof(*ni6)); + if (ni6 == NULL) { + /* m is already reclaimed */ + return NULL; + } +#endif + + /* + * Validate IPv6 destination address. + * + * The Responder must discard the Query without further processing + * unless it is one of the Responder's unicast or anycast addresses, or + * a link-local scope multicast address which the Responder has joined. + * [icmp-name-lookups-07, Section 4.] + */ + bzero(&sin6, sizeof(sin6)); + sin6.sin6_family = AF_INET6; + sin6.sin6_len = sizeof(struct sockaddr_in6); + bcopy(&ip6->ip6_dst, &sin6.sin6_addr, sizeof(sin6.sin6_addr)); + /* XXX scopeid */ + if ((ia6 = (struct in6_ifaddr *)ifa_ifwithaddr((struct sockaddr *)&sin6)) != NULL) { + /* unicast/anycast, fine */ + if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) != 0 && + (icmp6_nodeinfo & 4) == 0) { + nd6log((LOG_DEBUG, "ni6_input: ignore node info to " + "a temporary address in %s:%d", + __FILE__, __LINE__)); + goto bad; + } + } else if (IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) + ; /* link-local multicast, fine */ + else + goto bad; + + /* validate query Subject field. */ + qtype = ntohs(ni6->ni_qtype); + subjlen = m->m_pkthdr.len - off - sizeof(struct icmp6_nodeinfo); + switch (qtype) { + case NI_QTYPE_NOOP: + case NI_QTYPE_SUPTYPES: + /* 07 draft */ + if (ni6->ni_code == ICMP6_NI_SUBJ_FQDN && subjlen == 0) + break; + /* FALLTHROUGH */ + case NI_QTYPE_FQDN: + case NI_QTYPE_NODEADDR: + case NI_QTYPE_IPV4ADDR: + switch (ni6->ni_code) { + case ICMP6_NI_SUBJ_IPV6: +#if ICMP6_NI_SUBJ_IPV6 != 0 + case 0: +#endif + /* + * backward compatibility - try to accept 03 draft + * format, where no Subject is present. + */ + if (qtype == NI_QTYPE_FQDN && ni6->ni_code == 0 && + subjlen == 0) { + oldfqdn++; + break; + } +#if ICMP6_NI_SUBJ_IPV6 != 0 + if (ni6->ni_code != ICMP6_NI_SUBJ_IPV6) + goto bad; +#endif + + if (subjlen != sizeof(sin6.sin6_addr)) + goto bad; + + /* + * Validate Subject address. + * + * Not sure what exactly "address belongs to the node" + * means in the spec, is it just unicast, or what? + * + * At this moment we consider Subject address as + * "belong to the node" if the Subject address equals + * to the IPv6 destination address; validation for + * IPv6 destination address should have done enough + * check for us. + * + * We do not do proxy at this moment. + */ + /* m_pulldown instead of copy? */ + m_copydata(m, off + sizeof(struct icmp6_nodeinfo), + subjlen, (caddr_t)&sin6.sin6_addr); + if ((zoneid = in6_addr2zoneid(m->m_pkthdr.rcvif, + &sin6.sin6_addr)) < 0) + goto bad; + sin6.sin6_scope_id = zoneid; + + if (in6_embedscope(&sin6.sin6_addr, &sin6)) + goto bad; /* XXX should not happen */ + bzero(&sin6_d, sizeof(sin6_d)); + sin6_d.sin6_family = AF_INET6; /* not used, actually */ + sin6_d.sin6_len = sizeof(sin6_d); /* ditto */ + sin6_d.sin6_addr = ip6->ip6_dst; + if ((zoneid = in6_addr2zoneid(m->m_pkthdr.rcvif, + &ip6->ip6_dst)) < 0) + goto bad; + sin6_d.sin6_scope_id = zoneid; + if (in6_embedscope(&sin6_d.sin6_addr, &sin6_d)) + goto bad; /* XXX should not happen */ + subj = (char *)&sin6; + if (SA6_ARE_ADDR_EQUAL(&sin6, &sin6_d)) + break; + + /* + * XXX if we are to allow other cases, we should really + * be careful about scope here. + * basically, we should disallow queries toward IPv6 + * destination X with subject Y, if scope(X) > scope(Y). + * if we allow scope(X) > scope(Y), it will result in + * information leakage across scope boundary. + */ + goto bad; + + case ICMP6_NI_SUBJ_FQDN: + /* + * Validate Subject name with gethostname(3). + * + * The behavior may need some debate, since: + * - we are not sure if the node has FQDN as + * hostname (returned by gethostname(3)). + * - the code does wildcard match for truncated names. + * however, we are not sure if we want to perform + * wildcard match, if gethostname(3) side has + * truncated hostname. + */ + n = ni6_nametodns(hostname, hostnamelen, 0); + if (!n || n->m_next || n->m_len == 0) + goto bad; + IP6_EXTHDR_GET(subj, char *, m, + off + sizeof(struct icmp6_nodeinfo), subjlen); + if (subj == NULL) + goto bad; + if (!ni6_dnsmatch(subj, subjlen, mtod(n, const char *), + n->m_len)) { + goto bad; + } + m_freem(n); + n = NULL; + break; + + case ICMP6_NI_SUBJ_IPV4: /* XXX: to be implemented? */ + default: + goto bad; + } + break; + } + + /* refuse based on configuration. XXX ICMP6_NI_REFUSED? */ + switch (qtype) { + case NI_QTYPE_FQDN: + if ((icmp6_nodeinfo & 1) == 0) + goto bad; + break; + case NI_QTYPE_NODEADDR: + case NI_QTYPE_IPV4ADDR: + if ((icmp6_nodeinfo & 2) == 0) + goto bad; + break; + } + + /* guess reply length */ + switch (qtype) { + case NI_QTYPE_NOOP: + break; /* no reply data */ + case NI_QTYPE_SUPTYPES: + replylen += sizeof(u_int32_t); + break; + case NI_QTYPE_FQDN: + /* XXX will append an mbuf */ + replylen += offsetof(struct ni_reply_fqdn, ni_fqdn_namelen); + break; + case NI_QTYPE_NODEADDR: + addrs = ni6_addrs(ni6, m, &ifp, subj); + if ((replylen += addrs * (sizeof(struct in6_addr) + + sizeof(u_int32_t))) > MCLBYTES) + replylen = MCLBYTES; /* XXX: will truncate pkt later */ + break; + case NI_QTYPE_IPV4ADDR: + /* unsupported - should respond with unknown Qtype? */ + goto bad; + default: + /* + * XXX: We must return a reply with the ICMP6 code + * `unknown Qtype' in this case. However we regard the case + * as an FQDN query for backward compatibility. + * Older versions set a random value to this field, + * so it rarely varies in the defined qtypes. + * But the mechanism is not reliable... + * maybe we should obsolete older versions. + */ + qtype = NI_QTYPE_FQDN; + /* XXX will append an mbuf */ + replylen += offsetof(struct ni_reply_fqdn, ni_fqdn_namelen); + oldfqdn++; + break; + } + + /* allocate an mbuf to reply. */ + MGETHDR(n, M_DONTWAIT, m->m_type); + if (n == NULL) { + m_freem(m); + return(NULL); + } +#ifdef __OpenBSD__ + M_DUP_PKTHDR(n, m); /* just for rcvif */ +#else + M_COPY_PKTHDR(n, m); /* just for rcvif */ +#endif + if (replylen > MHLEN) { + if (replylen > MCLBYTES) { + /* + * XXX: should we try to allocate more? But MCLBYTES + * is probably much larger than IPV6_MMTU... + */ + goto bad; + } + MCLGET(n, M_DONTWAIT); + if ((n->m_flags & M_EXT) == 0) { + goto bad; + } + } + n->m_pkthdr.len = n->m_len = replylen; + + /* copy mbuf header and IPv6 + Node Information base headers */ + bcopy(mtod(m, caddr_t), mtod(n, caddr_t), sizeof(struct ip6_hdr)); + nni6 = (struct icmp6_nodeinfo *)(mtod(n, struct ip6_hdr *) + 1); + bcopy((caddr_t)ni6, (caddr_t)nni6, sizeof(struct icmp6_nodeinfo)); + + /* qtype dependent procedure */ + switch (qtype) { + case NI_QTYPE_NOOP: + nni6->ni_code = ICMP6_NI_SUCCESS; + nni6->ni_flags = 0; + break; + case NI_QTYPE_SUPTYPES: + { + u_int32_t v; + nni6->ni_code = ICMP6_NI_SUCCESS; + nni6->ni_flags = htons(0x0000); /* raw bitmap */ + /* supports NOOP, SUPTYPES, FQDN, and NODEADDR */ + v = (u_int32_t)htonl(0x0000000f); + bcopy(&v, nni6 + 1, sizeof(u_int32_t)); + break; + } + case NI_QTYPE_FQDN: + nni6->ni_code = ICMP6_NI_SUCCESS; + fqdn = (struct ni_reply_fqdn *)(mtod(n, caddr_t) + + sizeof(struct ip6_hdr) + + sizeof(struct icmp6_nodeinfo)); + nni6->ni_flags = 0; /* XXX: meaningless TTL */ + fqdn->ni_fqdn_ttl = 0; /* ditto. */ + /* + * XXX do we really have FQDN in variable "hostname"? + */ + n->m_next = ni6_nametodns(hostname, hostnamelen, oldfqdn); + if (n->m_next == NULL) + goto bad; + /* XXX we assume that n->m_next is not a chain */ + if (n->m_next->m_next != NULL) + goto bad; + n->m_pkthdr.len += n->m_next->m_len; + break; + case NI_QTYPE_NODEADDR: + { + int lenlim, copied; + + nni6->ni_code = ICMP6_NI_SUCCESS; + n->m_pkthdr.len = n->m_len = + sizeof(struct ip6_hdr) + sizeof(struct icmp6_nodeinfo); + lenlim = M_TRAILINGSPACE(n); + copied = ni6_store_addrs(ni6, nni6, ifp, lenlim); + /* XXX: reset mbuf length */ + n->m_pkthdr.len = n->m_len = sizeof(struct ip6_hdr) + + sizeof(struct icmp6_nodeinfo) + copied; + break; + } + default: + break; /* XXX impossible! */ + } + + nni6->ni_type = ICMP6_NI_REPLY; + m_freem(m); + return(n); + + bad: + m_freem(m); + if (n) + m_freem(n); + return(NULL); +} +#undef hostnamelen + +/* + * make a mbuf with DNS-encoded string. no compression support. + * + * XXX names with less than 2 dots (like "foo" or "foo.section") will be + * treated as truncated name (two \0 at the end). this is a wild guess. + */ +static struct mbuf * +ni6_nametodns(name, namelen, old) + const char *name; + int namelen; + int old; /* return pascal string if non-zero */ +{ + struct mbuf *m; + char *cp, *ep; + const char *p, *q; + int i, len, nterm; + + if (old) + len = namelen + 1; + else + len = MCLBYTES; + + /* because MAXHOSTNAMELEN is usually 256, we use cluster mbuf */ + MGET(m, M_DONTWAIT, MT_DATA); + if (m && len > MLEN) { + MCLGET(m, M_DONTWAIT); + if ((m->m_flags & M_EXT) == 0) + goto fail; + } + if (!m) + goto fail; + m->m_next = NULL; + + if (old) { + m->m_len = len; + *mtod(m, char *) = namelen; + bcopy(name, mtod(m, char *) + 1, namelen); + return m; + } else { + m->m_len = 0; + cp = mtod(m, char *); + ep = mtod(m, char *) + M_TRAILINGSPACE(m); + + /* if not certain about my name, return empty buffer */ + if (namelen == 0) + return m; + + /* + * guess if it looks like shortened hostname, or FQDN. + * shortened hostname needs two trailing "\0". + */ + i = 0; + for (p = name; p < name + namelen; p++) { + if (*p && *p == '.') + i++; + } + if (i < 2) + nterm = 2; + else + nterm = 1; + + p = name; + while (cp < ep && p < name + namelen) { + i = 0; + for (q = p; q < name + namelen && *q && *q != '.'; q++) + i++; + /* result does not fit into mbuf */ + if (cp + i + 1 >= ep) + goto fail; + /* + * DNS label length restriction, RFC1035 page 8. + * "i == 0" case is included here to avoid returning + * 0-length label on "foo..bar". + */ + if (i <= 0 || i >= 64) + goto fail; + *cp++ = i; + bcopy(p, cp, i); + cp += i; + p = q; + if (p < name + namelen && *p == '.') + p++; + } + /* termination */ + if (cp + nterm >= ep) + goto fail; + while (nterm-- > 0) + *cp++ = '\0'; + m->m_len = cp - mtod(m, char *); + return m; + } + + panic("should not reach here"); + /* NOTREACHED */ + + fail: + if (m) + m_freem(m); + return NULL; +} + +/* + * check if two DNS-encoded string matches. takes care of truncated + * form (with \0\0 at the end). no compression support. + * XXX upper/lowercase match (see RFC2065) + */ +static int +ni6_dnsmatch(a, alen, b, blen) + const char *a; + int alen; + const char *b; + int blen; +{ + const char *a0, *b0; + int l; + + /* simplest case - need validation? */ + if (alen == blen && bcmp(a, b, alen) == 0) + return 1; + + a0 = a; + b0 = b; + + /* termination is mandatory */ + if (alen < 2 || blen < 2) + return 0; + if (a0[alen - 1] != '\0' || b0[blen - 1] != '\0') + return 0; + alen--; + blen--; + + while (a - a0 < alen && b - b0 < blen) { + if (a - a0 + 1 > alen || b - b0 + 1 > blen) + return 0; + + if ((signed char)a[0] < 0 || (signed char)b[0] < 0) + return 0; + /* we don't support compression yet */ + if (a[0] >= 64 || b[0] >= 64) + return 0; + + /* truncated case */ + if (a[0] == 0 && a - a0 == alen - 1) + return 1; + if (b[0] == 0 && b - b0 == blen - 1) + return 1; + if (a[0] == 0 || b[0] == 0) + return 0; + + if (a[0] != b[0]) + return 0; + l = a[0]; + if (a - a0 + 1 + l > alen || b - b0 + 1 + l > blen) + return 0; + if (bcmp(a + 1, b + 1, l) != 0) + return 0; + + a += 1 + l; + b += 1 + l; + } + + if (a - a0 == alen && b - b0 == blen) + return 1; + else + return 0; +} + +/* + * calculate the number of addresses to be returned in the node info reply. + */ +static int +ni6_addrs(ni6, m, ifpp, subj) + struct icmp6_nodeinfo *ni6; + struct mbuf *m; + struct ifnet **ifpp; + char *subj; +{ + struct ifnet *ifp; + struct in6_ifaddr *ifa6; + struct ifaddr *ifa; + struct sockaddr_in6 *subj_ip6 = NULL; /* XXX pedant */ + int addrs = 0, addrsofif, iffound = 0; + int niflags = ni6->ni_flags; + + if ((niflags & NI_NODEADDR_FLAG_ALL) == 0) { + switch (ni6->ni_code) { + case ICMP6_NI_SUBJ_IPV6: + if (subj == NULL) /* must be impossible... */ + return(0); + subj_ip6 = (struct sockaddr_in6 *)subj; + break; + default: + /* + * XXX: we only support IPv6 subject address for + * this Qtype. + */ + return(0); + } + } + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifp = ifnet; ifp; ifp = ifp->if_next) +#else + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) +#endif + { + addrsofif = 0; +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; + ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + ifa6 = (struct in6_ifaddr *)ifa; + + if ((niflags & NI_NODEADDR_FLAG_ALL) == 0 && + IN6_ARE_ADDR_EQUAL(&subj_ip6->sin6_addr, + &ifa6->ia_addr.sin6_addr)) + iffound = 1; + + /* + * IPv4-mapped addresses can only be returned by a + * Node Information proxy, since they represent + * addresses of IPv4-only nodes, which perforce do + * not implement this protocol. + * [icmp-name-lookups-07, Section 5.4] + * So we don't support NI_NODEADDR_FLAG_COMPAT in + * this function at this moment. + */ + + /* What do we have to do about ::1? */ + switch (in6_addrscope(&ifa6->ia_addr.sin6_addr)) { + case IPV6_ADDR_SCOPE_LINKLOCAL: + if ((niflags & NI_NODEADDR_FLAG_LINKLOCAL) == 0) + continue; + break; + case IPV6_ADDR_SCOPE_SITELOCAL: + if ((niflags & NI_NODEADDR_FLAG_SITELOCAL) == 0) + continue; + break; + case IPV6_ADDR_SCOPE_GLOBAL: + if ((niflags & NI_NODEADDR_FLAG_GLOBAL) == 0) + continue; + break; + default: + continue; + } + + /* + * check if anycast is okay. + * XXX: just experimental. not in the spec. + */ + if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0 && + (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0) + continue; /* we need only unicast addresses */ + if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0 && + (icmp6_nodeinfo & 4) == 0) { + continue; + } + addrsofif++; /* count the address */ + } + if (iffound) { + *ifpp = ifp; + return(addrsofif); + } + + addrs += addrsofif; + } + + return(addrs); +} + +static int +ni6_store_addrs(ni6, nni6, ifp0, resid) + struct icmp6_nodeinfo *ni6, *nni6; + struct ifnet *ifp0; + int resid; +{ +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + struct ifnet *ifp = ifp0 ? ifp0 : ifnet; +#else + struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&ifnet); +#endif + struct in6_ifaddr *ifa6; + struct ifaddr *ifa; + struct ifnet *ifp_dep = NULL; + int copied = 0, allow_deprecated = 0; + u_char *cp = (u_char *)(nni6 + 1); + int niflags = ni6->ni_flags; + u_int32_t ltime; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + + if (ifp0 == NULL && !(niflags & NI_NODEADDR_FLAG_ALL)) + return(0); /* needless to copy */ + + again: + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (; ifp; ifp = ifp->if_next) +#else + for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) +#endif + { +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; + ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + ifa6 = (struct in6_ifaddr *)ifa; + + if (IFA6_IS_DEPRECATED(ifa6) && + allow_deprecated == 0) { + /* + * prefererred address should be put before + * deprecated addresses. + */ + + /* record the interface for later search */ + if (ifp_dep == NULL) + ifp_dep = ifp; + + continue; + } + else if (!IFA6_IS_DEPRECATED(ifa6) && + allow_deprecated != 0) + continue; /* we now collect deprecated addrs */ + + /* What do we have to do about ::1? */ + switch (in6_addrscope(&ifa6->ia_addr.sin6_addr)) { + case IPV6_ADDR_SCOPE_LINKLOCAL: + if ((niflags & NI_NODEADDR_FLAG_LINKLOCAL) == 0) + continue; + break; + case IPV6_ADDR_SCOPE_SITELOCAL: + if ((niflags & NI_NODEADDR_FLAG_SITELOCAL) == 0) + continue; + break; + case IPV6_ADDR_SCOPE_GLOBAL: + if ((niflags & NI_NODEADDR_FLAG_GLOBAL) == 0) + continue; + break; + default: + continue; + } + + /* + * check if anycast is okay. + * XXX: just experimental. not in the spec. + */ + if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0 && + (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0) + continue; + if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0 && + (icmp6_nodeinfo & 4) == 0) { + continue; + } + + /* now we can copy the address */ + if (resid < sizeof(struct in6_addr) + + sizeof(u_int32_t)) { + /* + * We give up much more copy. + * Set the truncate flag and return. + */ + nni6->ni_flags |= + NI_NODEADDR_FLAG_TRUNCATE; + return(copied); + } + + /* + * Set the TTL of the address. + * The TTL value should be one of the following + * according to the specification: + * + * 1. The remaining lifetime of a DHCP lease on the + * address, or + * 2. The remaining Valid Lifetime of a prefix from + * which the address was derived through Stateless + * Autoconfiguration. + * + * Note that we currently do not support stateful + * address configuration by DHCPv6, so the former + * case can't happen. + * + * TTL must be 2^31 > TTL >= 0. + */ + if (ifa6->ia6_lifetime.ia6t_expire == 0) + ltime = ND6_INFINITE_LIFETIME; + else { + if (ifa6->ia6_lifetime.ia6t_expire > + time_second) { + ltime = ifa6->ia6_lifetime.ia6t_expire + - time_second; + } else + ltime = 0; + } + if (ltime > 0x7fffffff) + ltime = 0x7fffffff; + ltime = htonl(ltime); + + bcopy(<ime, cp, sizeof(u_int32_t)); + cp += sizeof(u_int32_t); + + /* copy the address itself */ + bcopy(&ifa6->ia_addr.sin6_addr, cp, + sizeof(struct in6_addr)); + /* XXX: KAME link-local hack; remove ifindex */ + if (IN6_IS_ADDR_LINKLOCAL(&ifa6->ia_addr.sin6_addr)) + ((struct in6_addr *)cp)->s6_addr16[1] = 0; + cp += sizeof(struct in6_addr); + + resid -= (sizeof(struct in6_addr) + sizeof(u_int32_t)); + copied += (sizeof(struct in6_addr) + + sizeof(u_int32_t)); + } + if (ifp0) /* we need search only on the specified IF */ + break; + } + + if (allow_deprecated == 0 && ifp_dep != NULL) { + ifp = ifp_dep; + allow_deprecated = 1; + + goto again; + } + + return(copied); +} + +/* + * XXX almost dup'ed code with rip6_input. + */ +static int +icmp6_rip6_input(mp, off) + struct mbuf **mp; + int off; +{ + struct mbuf *m = *mp; + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct in6pcb *in6p; + struct in6pcb *last = NULL; + struct sockaddr_in6 rip6src; + struct icmp6_hdr *icmp6; + struct ip6_recvpktopts opts; + +#ifndef PULLDOWN_TEST + /* this is assumed to be safe. */ + icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off); +#else + IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6)); + if (icmp6 == NULL) { + /* m is already reclaimed */ + return IPPROTO_DONE; + } +#endif + + bzero(&opts, sizeof(opts)); + bzero(&rip6src, sizeof(rip6src)); + rip6src.sin6_len = sizeof(struct sockaddr_in6); + rip6src.sin6_family = AF_INET6; + /* KAME hack: recover scopeid */ + (void)in6_recoverscope(&rip6src, &ip6->ip6_src, m->m_pkthdr.rcvif); + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + LIST_FOREACH(in6p, &ripcb, inp_list) +#elif defined(__OpenBSD__) + for (in6p = rawin6pcbtable.inpt_queue.cqh_first; + in6p != (struct inpcb *)&rawin6pcbtable.inpt_queue; + in6p = in6p->inp_queue.cqe_next) +#else + for (in6p = rawin6pcb.in6p_next; + in6p != &rawin6pcb; in6p = in6p->in6p_next) +#endif + { +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if ((in6p->inp_vflag & INP_IPV6) == 0) + continue; +#endif +#ifdef HAVE_NRL_INPCB + if (!(in6p->in6p_flags & INP_IPV6)) + continue; +#endif + if (in6p->in6p_ip6_nxt != IPPROTO_ICMPV6) + continue; + if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) && + !IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &ip6->ip6_dst)) + continue; + if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) && + !IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src)) + continue; + if (in6p->in6p_icmp6filt + && ICMP6_FILTER_WILLBLOCK(icmp6->icmp6_type, + in6p->in6p_icmp6filt)) + continue; + if (last) { + struct mbuf *n; + if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { + if (last->in6p_flags & IN6P_CONTROLOPTS) + ip6_savecontrol(last, ip6, n, &opts, + NULL); + /* strip intermediate headers */ + m_adj(n, off); + if (sbappendaddr(&last->in6p_socket->so_rcv, + (struct sockaddr *)&rip6src, + n, opts.head) == 0) { + /* should notify about lost packet */ + m_freem(n); + if (opts.head) { + m_freem(opts.head); + } + } else + sorwakeup(last->in6p_socket); + bzero(&opts, sizeof(opts)); + } + } + last = in6p; + } + if (last) { + if (last->in6p_flags & IN6P_CONTROLOPTS) + ip6_savecontrol(last, ip6, m, &opts, NULL); + /* strip intermediate headers */ + m_adj(m, off); + if (sbappendaddr(&last->in6p_socket->so_rcv, + (struct sockaddr *)&rip6src, + m, opts.head) == 0) { + m_freem(m); + if (opts.head) + m_freem(opts.head); + } else + sorwakeup(last->in6p_socket); + } else { + m_freem(m); + ip6stat.ip6s_delivered--; + } + return IPPROTO_DONE; +} + +/* + * Reflect the ip6 packet back to the source. + * OFF points to the icmp6 header, counted from the top of the mbuf. + * + * Note: RFC 1885 required that an echo reply should be truncated if it + * did not fit in with (return) path MTU, and KAME code supported the + * behavior. However, as a clarification after the RFC, this limitation + * was removed in a revised version of the spec, RFC 2463. We had kept the + * old behavior, with a (non-default) ifdef block, while the new version of + * the spec was an internet-draft status, and even after the new RFC was + * published. But it would rather make sense to clean the obsoleted part + * up, and to make the code simpler at this stage. + */ +void +icmp6_reflect(m, off) + struct mbuf *m; + size_t off; +{ + struct ip6_hdr *ip6; + struct icmp6_hdr *icmp6; + struct in6_ifaddr *ia; + struct in6_addr t, *src = 0; + int plen; + int type, code; + struct ifnet *outif = NULL; + struct sockaddr_in6 sa6_src, sa6_dst; + + /* too short to reflect */ + if (off < sizeof(struct ip6_hdr)) { + nd6log((LOG_DEBUG, + "sanity fail: off=%lx, sizeof(ip6)=%lx in %s:%d\n", + (u_long)off, (u_long)sizeof(struct ip6_hdr), + __FILE__, __LINE__)); + goto bad; + } + + /* + * If there are extra headers between IPv6 and ICMPv6, strip + * off that header first. + */ +#ifdef DIAGNOSTIC + if (sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr) > MHLEN) + panic("assumption failed in icmp6_reflect"); +#endif + if (off > sizeof(struct ip6_hdr)) { + size_t l; + struct ip6_hdr nip6; + + l = off - sizeof(struct ip6_hdr); + m_copydata(m, 0, sizeof(nip6), (caddr_t)&nip6); + m_adj(m, l); + l = sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr); + if (m->m_len < l) { + if ((m = m_pullup(m, l)) == NULL) + return; + } + bcopy((caddr_t)&nip6, mtod(m, caddr_t), sizeof(nip6)); + } else /* off == sizeof(struct ip6_hdr) */ { + size_t l; + l = sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr); + if (m->m_len < l) { + if ((m = m_pullup(m, l)) == NULL) + return; + } + } + plen = m->m_pkthdr.len - sizeof(struct ip6_hdr); + ip6 = mtod(m, struct ip6_hdr *); + ip6->ip6_nxt = IPPROTO_ICMPV6; + icmp6 = (struct icmp6_hdr *)(ip6 + 1); + type = icmp6->icmp6_type; /* keep type for statistics */ + code = icmp6->icmp6_code; /* ditto. */ + + t = ip6->ip6_dst; + /* + * ip6_input() drops a packet if its src is multicast. + * So, the src is never multicast. + */ + ip6->ip6_dst = ip6->ip6_src; + + /* + * XXX: make sure to embed scope zone information, using + * already embedded IDs or the received interface (if any). + * Note that rcvif may be NULL. + * TODO: scoped routing case (XXX). + */ + bzero(&sa6_src, sizeof(sa6_src)); + sa6_src.sin6_family = AF_INET6; + sa6_src.sin6_len = sizeof(sa6_src); + sa6_src.sin6_addr = ip6->ip6_dst; + in6_recoverscope(&sa6_src, &ip6->ip6_dst, m->m_pkthdr.rcvif); + in6_embedscope(&sa6_src.sin6_addr, &sa6_src); + ip6->ip6_dst = sa6_src.sin6_addr; + + bzero(&sa6_dst, sizeof(sa6_dst)); + sa6_dst.sin6_family = AF_INET6; + sa6_dst.sin6_len = sizeof(sa6_dst); + sa6_dst.sin6_addr = t; + in6_recoverscope(&sa6_dst, &t, m->m_pkthdr.rcvif); + in6_embedscope(&t, &sa6_dst); + + /* + * If the incoming packet was addressed directly to us (i.e. unicast), + * use dst as the src for the reply. + * The IN6_IFF_NOTREADY case would be VERY rare, but is possible + * (for example) when we encounter an error while forwarding procedure + * destined to a duplicated address of ours. + */ + for (ia = in6_ifaddr; ia; ia = ia->ia_next) + if (IN6_ARE_ADDR_EQUAL(&t, &ia->ia_addr.sin6_addr) && + (ia->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)) == 0) { + src = &t; + break; + } + if (ia == NULL && IN6_IS_ADDR_LINKLOCAL(&t) && (m->m_flags & M_LOOP)) { + /* + * This is the case if the dst is our link-local address + * and the sender is also ourselves. + */ + src = &t; + } + + if (src == 0) { + int e; +#ifdef NEW_STRUCT_ROUTE + struct route ro; +#else + struct route_in6 ro; +#endif + + /* + * This case matches to multicasts, our anycast, or unicasts + * that we do not own. Select a source address based on the + * source address of the erroneous packet. + */ + bzero(&ro, sizeof(ro)); + src = in6_selectsrc(&sa6_src, NULL, NULL, &ro, NULL, NULL, &e); + if (ro.ro_rt) { /* XXX: see comments in icmp6_mtudisc_update */ + RTFREE(ro.ro_rt); /* XXX: we could use this */ + } + if (src == NULL) { + nd6log((LOG_DEBUG, + "icmp6_reflect: source can't be determined: " + "dst=%s, error=%d\n", + ip6_sprintf(&sa6_src.sin6_addr), e)); + goto bad; + } + } + + ip6->ip6_src = *src; + + ip6->ip6_flow = 0; + ip6->ip6_vfc &= ~IPV6_VERSION_MASK; + ip6->ip6_vfc |= IPV6_VERSION; + ip6->ip6_nxt = IPPROTO_ICMPV6; + if (m->m_pkthdr.rcvif) { + /* XXX: This may not be the outgoing interface */ + ip6->ip6_hlim = nd_ifinfo[m->m_pkthdr.rcvif->if_index].chlim; + } else + ip6->ip6_hlim = ip6_defhlim; + + icmp6->icmp6_cksum = 0; + icmp6->icmp6_cksum = in6_cksum(m, IPPROTO_ICMPV6, + sizeof(struct ip6_hdr), plen); + + /* + * XXX option handling + */ + + m->m_flags &= ~(M_BCAST|M_MCAST); +#ifdef IPSEC + /* Don't lookup socket */ + (void)ipsec_setsocket(m, NULL); +#endif /* IPSEC */ + + /* + * To avoid a "too big" situation at an intermediate router + * and the path MTU discovery process, specify the IPV6_MINMTU flag. + * Note that only echo and node information replies are affected, + * since the length of ICMP6 errors is limited to the minimum MTU. + */ + if (ip6_output(m, NULL, NULL, IPV6_MINMTU, NULL, &outif) != 0 && outif) + icmp6_ifstat_inc(outif, ifs6_out_error); + + if (outif) + icmp6_ifoutstat_inc(outif, type, code); + + return; + + bad: + m_freem(m); + return; +} + +void +icmp6_fasttimo() +{ + + mld6_fasttimeo(); +} + +static const char * +icmp6_redirect_diag(src6, dst6, tgt6) + struct in6_addr *src6; + struct in6_addr *dst6; + struct in6_addr *tgt6; +{ + static char buf[1024]; +#ifndef __bsdi__ + snprintf(buf, sizeof(buf), "(src=%s dst=%s tgt=%s)", + ip6_sprintf(src6), ip6_sprintf(dst6), ip6_sprintf(tgt6)); +#else + sprintf(buf, "(src=%s dst=%s tgt=%s)", + ip6_sprintf(src6), ip6_sprintf(dst6), ip6_sprintf(tgt6)); +#endif + return buf; +} + +void +icmp6_redirect_input(m, off) + struct mbuf *m; + int off; +{ + struct ifnet *ifp = m->m_pkthdr.rcvif; + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct nd_redirect *nd_rd; + int icmp6len = ntohs(ip6->ip6_plen); + char *lladdr = NULL; + int lladdrlen = 0; + u_char *redirhdr = NULL; + int redirhdrlen = 0; + struct rtentry *rt = NULL; + int is_router; + int is_onlink; + struct in6_addr src6 = ip6->ip6_src; + struct in6_addr redtgt6; + struct in6_addr reddst6; + union nd_opts ndopts; + + if (!m || !ifp) + return; + + /* XXX if we are router, we don't update route by icmp6 redirect */ + if (ip6_forwarding) + goto freeit; + if (!icmp6_rediraccept) + goto freeit; + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, icmp6len,); + nd_rd = (struct nd_redirect *)((caddr_t)ip6 + off); +#else + IP6_EXTHDR_GET(nd_rd, struct nd_redirect *, m, off, icmp6len); + if (nd_rd == NULL) { + icmp6stat.icp6s_tooshort++; + return; + } +#endif + redtgt6 = nd_rd->nd_rd_target; + reddst6 = nd_rd->nd_rd_dst; + + if (IN6_IS_ADDR_LINKLOCAL(&redtgt6)) + redtgt6.s6_addr16[1] = htons(ifp->if_index); + if (IN6_IS_ADDR_LINKLOCAL(&reddst6)) + reddst6.s6_addr16[1] = htons(ifp->if_index); + + /* validation */ + if (!IN6_IS_ADDR_LINKLOCAL(&src6)) { + nd6log((LOG_ERR, + "ICMP6 redirect sent from %s rejected; " + "must be from linklocal\n", ip6_sprintf(&src6))); + goto bad; + } + if (ip6->ip6_hlim != 255) { + nd6log((LOG_ERR, + "ICMP6 redirect sent from %s rejected; " + "hlim=%d (must be 255)\n", + ip6_sprintf(&src6), ip6->ip6_hlim)); + goto bad; + } + { + /* ip6->ip6_src must be equal to gw for icmp6->icmp6_reddst */ + struct sockaddr_in6 sin6; + struct in6_addr *gw6; + + bzero(&sin6, sizeof(sin6)); + sin6.sin6_family = AF_INET6; + sin6.sin6_len = sizeof(struct sockaddr_in6); + bcopy(&reddst6, &sin6.sin6_addr, sizeof(reddst6)); + rt = rtalloc1((struct sockaddr *)&sin6, 0 +#ifdef __FreeBSD__ + , 0UL +#endif + ); + if (rt) { + if (rt->rt_gateway == NULL || + rt->rt_gateway->sa_family != AF_INET6) { + nd6log((LOG_ERR, + "ICMP6 redirect rejected; no route " + "with inet6 gateway found for redirect dst: %s\n", + icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); + RTFREE(rt); + goto bad; + } + + gw6 = &(((struct sockaddr_in6 *)rt->rt_gateway)->sin6_addr); + if (bcmp(&src6, gw6, sizeof(struct in6_addr)) != 0) { + nd6log((LOG_ERR, + "ICMP6 redirect rejected; " + "not equal to gw-for-src=%s (must be same): " + "%s\n", + ip6_sprintf(gw6), + icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); + RTFREE(rt); + goto bad; + } + } else { + nd6log((LOG_ERR, + "ICMP6 redirect rejected; " + "no route found for redirect dst: %s\n", + icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); + goto bad; + } + RTFREE(rt); + rt = NULL; + } + if (IN6_IS_ADDR_MULTICAST(&reddst6)) { + nd6log((LOG_ERR, + "ICMP6 redirect rejected; " + "redirect dst must be unicast: %s\n", + icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); + goto bad; + } + + is_router = is_onlink = 0; + if (IN6_IS_ADDR_LINKLOCAL(&redtgt6)) + is_router = 1; /* router case */ + if (bcmp(&redtgt6, &reddst6, sizeof(redtgt6)) == 0) + is_onlink = 1; /* on-link destination case */ + if (!is_router && !is_onlink) { + nd6log((LOG_ERR, + "ICMP6 redirect rejected; " + "neither router case nor onlink case: %s\n", + icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); + goto bad; + } + /* validation passed */ + + icmp6len -= sizeof(*nd_rd); + nd6_option_init(nd_rd + 1, icmp6len, &ndopts); + if (nd6_options(&ndopts) < 0) { + nd6log((LOG_INFO, "icmp6_redirect_input: " + "invalid ND option, rejected: %s\n", + icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); + /* nd6_options have incremented stats */ + goto freeit; + } + + if (ndopts.nd_opts_tgt_lladdr) { + lladdr = (char *)(ndopts.nd_opts_tgt_lladdr + 1); + lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; + } + + if (ndopts.nd_opts_rh) { + redirhdrlen = ndopts.nd_opts_rh->nd_opt_rh_len; + redirhdr = (u_char *)(ndopts.nd_opts_rh + 1); /* xxx */ + } + + if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { + nd6log((LOG_INFO, + "icmp6_redirect_input: lladdrlen mismatch for %s " + "(if %d, icmp6 packet %d): %s\n", + ip6_sprintf(&redtgt6), ifp->if_addrlen, lladdrlen - 2, + icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); + goto bad; + } + + /* RFC 2461 8.3 */ + nd6_cache_lladdr(ifp, &redtgt6, lladdr, lladdrlen, ND_REDIRECT, + is_onlink ? ND_REDIRECT_ONLINK : ND_REDIRECT_ROUTER); + + if (!is_onlink) { /* better router case. perform rtredirect. */ + /* perform rtredirect */ + struct sockaddr_in6 sdst; + struct sockaddr_in6 sgw; + struct sockaddr_in6 ssrc; +#ifdef __bsdi__ + extern int icmp_redirtimeout; /* XXX */ +#endif +#if defined(__NetBSD__) || defined(__OpenBSD__) + unsigned long rtcount; + struct rtentry *newrt = NULL; +#endif + +#if defined(__NetBSD__) || defined(__OpenBSD__) + /* + * do not install redirect route, if the number of entries + * is too much (> hiwat). note that, the node (= host) will + * work just fine even if we do not install redirect route + * (there will be additional hops, though). + */ + rtcount = rt_timer_count(icmp6_redirect_timeout_q); + if (0 <= icmp6_redirect_hiwat && rtcount > icmp6_redirect_hiwat) + return; + else if (0 <= icmp6_redirect_lowat && + rtcount > icmp6_redirect_lowat) { + /* + * XXX nuke a victim, install the new one. + */ + } +#endif + + bzero(&sdst, sizeof(sdst)); + bzero(&sgw, sizeof(sgw)); + bzero(&ssrc, sizeof(ssrc)); + sdst.sin6_family = sgw.sin6_family = ssrc.sin6_family = AF_INET6; + sdst.sin6_len = sgw.sin6_len = ssrc.sin6_len = + sizeof(struct sockaddr_in6); + bcopy(&redtgt6, &sgw.sin6_addr, sizeof(struct in6_addr)); + bcopy(&reddst6, &sdst.sin6_addr, sizeof(struct in6_addr)); + bcopy(&src6, &ssrc.sin6_addr, sizeof(struct in6_addr)); + rtredirect((struct sockaddr *)&sdst, (struct sockaddr *)&sgw, + (struct sockaddr *)NULL, RTF_GATEWAY | RTF_HOST, + (struct sockaddr *)&ssrc, +#ifdef __bsdi__ + icmp_redirtimeout +#elif defined(__NetBSD__) || defined(__OpenBSD__) + &newrt +#else + (struct rtentry **)NULL +#endif + ); + +#if defined(__NetBSD__) || defined(__OpenBSD__) + if (newrt) { + (void)rt_timer_add(newrt, icmp6_redirect_timeout, + icmp6_redirect_timeout_q); + rtfree(newrt); + } +#endif + } + /* finally update cached route in each socket via pfctlinput */ + { + struct sockaddr_in6 sdst; + + bzero(&sdst, sizeof(sdst)); + sdst.sin6_family = AF_INET6; + sdst.sin6_len = sizeof(struct sockaddr_in6); + bcopy(&reddst6, &sdst.sin6_addr, sizeof(struct in6_addr)); + pfctlinput(PRC_REDIRECT_HOST, (struct sockaddr *)&sdst); +#ifdef IPSEC + key_sa_routechange((struct sockaddr *)&sdst); +#endif + } + + freeit: + m_freem(m); + return; + + bad: + icmp6stat.icp6s_badredirect++; + m_freem(m); +} + +void +icmp6_redirect_output(m0, rt) + struct mbuf *m0; + struct rtentry *rt; +{ + struct ifnet *ifp; /* my outgoing interface */ + struct in6_addr *ifp_ll6; + struct in6_addr *router_ll6; + struct ip6_hdr *sip6; /* m0 as struct ip6_hdr */ + struct mbuf *m = NULL; /* newly allocated one */ + struct ip6_hdr *ip6; /* m as struct ip6_hdr */ + struct nd_redirect *nd_rd; + size_t maxlen; + u_char *p; + struct sockaddr_in6 src_sa; + int64_t zoneid; + + icmp6_errcount(&icmp6stat.icp6s_outerrhist, ND_REDIRECT, 0); + + /* if we are not router, we don't send icmp6 redirect */ + if (!ip6_forwarding || ip6_accept_rtadv) + goto fail; + + /* sanity check */ + if (!m0 || !rt || !(rt->rt_flags & RTF_UP) || !(ifp = rt->rt_ifp)) + goto fail; + + /* + * Address check: + * the source address must identify a neighbor, and + * the destination address must not be a multicast address + * [RFC 2461, sec 8.2] + */ + sip6 = mtod(m0, struct ip6_hdr *); + bzero(&src_sa, sizeof(src_sa)); + src_sa.sin6_family = AF_INET6; + src_sa.sin6_len = sizeof(src_sa); + src_sa.sin6_addr = sip6->ip6_src; + /* we don't currently use sin6_scope_id, but eventually use it */ + if ((zoneid = in6_addr2zoneid(ifp, &sip6->ip6_src)) < 0) + goto fail; + src_sa.sin6_scope_id = zoneid; + if (nd6_is_addr_neighbor(&src_sa, ifp) == 0) + goto fail; + if (IN6_IS_ADDR_MULTICAST(&sip6->ip6_dst)) + goto fail; /* what should we do here? */ + + /* rate limit */ + if (icmp6_ratelimit(&sip6->ip6_src, ND_REDIRECT, 0)) + goto fail; + + /* + * Since we are going to append up to 1280 bytes (= IPV6_MMTU), + * we almost always ask for an mbuf cluster for simplicity. + * (MHLEN < IPV6_MMTU is almost always true) + */ +#if IPV6_MMTU >= MCLBYTES +# error assumption failed about IPV6_MMTU and MCLBYTES +#endif + MGETHDR(m, M_DONTWAIT, MT_HEADER); + if (m && IPV6_MMTU >= MHLEN) + MCLGET(m, M_DONTWAIT); + if (!m) + goto fail; + m->m_pkthdr.rcvif = NULL; + m->m_len = 0; + maxlen = M_TRAILINGSPACE(m); + maxlen = min(IPV6_MMTU, maxlen); + /* just for safety */ + if (maxlen < sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr) + + ((sizeof(struct nd_opt_hdr) + ifp->if_addrlen + 7) & ~7)) { + goto fail; + } + + { + /* get ip6 linklocal address for ifp(my outgoing interface). */ + struct in6_ifaddr *ia; + if ((ia = in6ifa_ifpforlinklocal(ifp, + IN6_IFF_NOTREADY| + IN6_IFF_ANYCAST)) == NULL) + goto fail; + ifp_ll6 = &ia->ia_addr.sin6_addr; + } + + /* get ip6 linklocal address for the router. */ + if (rt->rt_gateway && (rt->rt_flags & RTF_GATEWAY)) { + struct sockaddr_in6 *sin6; + sin6 = (struct sockaddr_in6 *)rt->rt_gateway; + router_ll6 = &sin6->sin6_addr; + if (!IN6_IS_ADDR_LINKLOCAL(router_ll6)) + router_ll6 = (struct in6_addr *)NULL; + } else + router_ll6 = (struct in6_addr *)NULL; + + /* ip6 */ + ip6 = mtod(m, struct ip6_hdr *); + ip6->ip6_flow = 0; + ip6->ip6_vfc &= ~IPV6_VERSION_MASK; + ip6->ip6_vfc |= IPV6_VERSION; + /* ip6->ip6_plen will be set later */ + ip6->ip6_nxt = IPPROTO_ICMPV6; + ip6->ip6_hlim = 255; + /* ip6->ip6_src must be linklocal addr for my outgoing if. */ + bcopy(ifp_ll6, &ip6->ip6_src, sizeof(struct in6_addr)); + bcopy(&sip6->ip6_src, &ip6->ip6_dst, sizeof(struct in6_addr)); + + /* ND Redirect */ + nd_rd = (struct nd_redirect *)(ip6 + 1); + nd_rd->nd_rd_type = ND_REDIRECT; + nd_rd->nd_rd_code = 0; + nd_rd->nd_rd_reserved = 0; + if (rt->rt_flags & RTF_GATEWAY) { + /* + * nd_rd->nd_rd_target must be a link-local address in + * better router cases. + */ + if (!router_ll6) + goto fail; + bcopy(router_ll6, &nd_rd->nd_rd_target, + sizeof(nd_rd->nd_rd_target)); + bcopy(&sip6->ip6_dst, &nd_rd->nd_rd_dst, + sizeof(nd_rd->nd_rd_dst)); + } else { + /* make sure redtgt == reddst */ + bcopy(&sip6->ip6_dst, &nd_rd->nd_rd_target, + sizeof(nd_rd->nd_rd_target)); + bcopy(&sip6->ip6_dst, &nd_rd->nd_rd_dst, + sizeof(nd_rd->nd_rd_dst)); + } + + p = (u_char *)(nd_rd + 1); + + if (!router_ll6) + goto nolladdropt; + + { + /* target lladdr option */ + struct rtentry *rt_router = NULL; + int len; + struct sockaddr_dl *sdl; + struct nd_opt_hdr *nd_opt; + char *lladdr; + + rt_router = nd6_lookup(router_ll6, 0, ifp); + if (!rt_router) + goto nolladdropt; + len = sizeof(*nd_opt) + ifp->if_addrlen; + len = (len + 7) & ~7; /* round by 8 */ + /* safety check */ + if (len + (p - (u_char *)ip6) > maxlen) + goto nolladdropt; + if (!(rt_router->rt_flags & RTF_GATEWAY) && + (rt_router->rt_flags & RTF_LLINFO) && + (rt_router->rt_gateway->sa_family == AF_LINK) && + (sdl = (struct sockaddr_dl *)rt_router->rt_gateway) && + sdl->sdl_alen) { + nd_opt = (struct nd_opt_hdr *)p; + nd_opt->nd_opt_type = ND_OPT_TARGET_LINKADDR; + nd_opt->nd_opt_len = len >> 3; + lladdr = (char *)(nd_opt + 1); + bcopy(LLADDR(sdl), lladdr, ifp->if_addrlen); + p += len; + } + } +nolladdropt:; + + m->m_pkthdr.len = m->m_len = p - (u_char *)ip6; + + /* just to be safe */ +#ifdef M_DECRYPTED /* not openbsd */ + if (m0->m_flags & M_DECRYPTED) + goto noredhdropt; +#endif + if (p - (u_char *)ip6 > maxlen) + goto noredhdropt; + + { + /* redirected header option */ + int len; + struct nd_opt_rd_hdr *nd_opt_rh; + + /* + * compute the maximum size for icmp6 redirect header option. + * XXX room for auth header? + */ + len = maxlen - (p - (u_char *)ip6); + len &= ~7; + + /* This is just for simplicity. */ + if (m0->m_pkthdr.len != m0->m_len) { + if (m0->m_next) { + m_freem(m0->m_next); + m0->m_next = NULL; + } + m0->m_pkthdr.len = m0->m_len; + } + + /* + * Redirected header option spec (RFC2461 4.6.3) talks nothing + * about padding/truncate rule for the original IP packet. + * From the discussion on IPv6imp in Feb 1999, the consensus was: + * - "attach as much as possible" is the goal + * - pad if not aligned (original size can be guessed by original + * ip6 header) + * Following code adds the padding if it is simple enough, + * and truncates if not. + */ + if (m0->m_next || m0->m_pkthdr.len != m0->m_len) + panic("assumption failed in %s:%d\n", __FILE__, __LINE__); + + if (len - sizeof(*nd_opt_rh) < m0->m_pkthdr.len) { + /* not enough room, truncate */ + m0->m_pkthdr.len = m0->m_len = len - sizeof(*nd_opt_rh); + } else { + /* enough room, pad or truncate */ + size_t extra; + + extra = m0->m_pkthdr.len % 8; + if (extra) { + /* pad if easy enough, truncate if not */ + if (8 - extra <= M_TRAILINGSPACE(m0)) { + /* pad */ + m0->m_len += (8 - extra); + m0->m_pkthdr.len += (8 - extra); + } else { + /* truncate */ + m0->m_pkthdr.len -= extra; + m0->m_len -= extra; + } + } + len = m0->m_pkthdr.len + sizeof(*nd_opt_rh); + m0->m_pkthdr.len = m0->m_len = len - sizeof(*nd_opt_rh); + } + + nd_opt_rh = (struct nd_opt_rd_hdr *)p; + bzero(nd_opt_rh, sizeof(*nd_opt_rh)); + nd_opt_rh->nd_opt_rh_type = ND_OPT_REDIRECTED_HEADER; + nd_opt_rh->nd_opt_rh_len = len >> 3; + p += sizeof(*nd_opt_rh); + m->m_pkthdr.len = m->m_len = p - (u_char *)ip6; + + /* connect m0 to m */ + m->m_next = m0; + m->m_pkthdr.len = m->m_len + m0->m_len; + } +noredhdropt:; + + if (IN6_IS_ADDR_LINKLOCAL(&sip6->ip6_src)) + sip6->ip6_src.s6_addr16[1] = 0; + if (IN6_IS_ADDR_LINKLOCAL(&sip6->ip6_dst)) + sip6->ip6_dst.s6_addr16[1] = 0; +#if 0 + if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src)) + ip6->ip6_src.s6_addr16[1] = 0; + if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst)) + ip6->ip6_dst.s6_addr16[1] = 0; +#endif + if (IN6_IS_ADDR_LINKLOCAL(&nd_rd->nd_rd_target)) + nd_rd->nd_rd_target.s6_addr16[1] = 0; + if (IN6_IS_ADDR_LINKLOCAL(&nd_rd->nd_rd_dst)) + nd_rd->nd_rd_dst.s6_addr16[1] = 0; + + ip6->ip6_plen = htons(m->m_pkthdr.len - sizeof(struct ip6_hdr)); + + nd_rd->nd_rd_cksum = 0; + nd_rd->nd_rd_cksum + = in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), ntohs(ip6->ip6_plen)); + + /* send the packet to outside... */ +#ifdef IPSEC + /* Don't lookup socket */ + (void)ipsec_setsocket(m, NULL); +#endif /* IPSEC */ + if (ip6_output(m, NULL, NULL, 0, NULL, NULL) != 0) + icmp6_ifstat_inc(ifp, ifs6_out_error); + + icmp6_ifstat_inc(ifp, ifs6_out_msg); + icmp6_ifstat_inc(ifp, ifs6_out_redirect); + icmp6stat.icp6s_outhist[ND_REDIRECT]++; + + return; + +fail: + if (m) + m_freem(m); + if (m0) + m_freem(m0); +} + +#ifdef HAVE_NRL_INPCB +#define sotoin6pcb sotoinpcb +#define in6pcb inpcb +#define in6p_icmp6filt inp_icmp6filt +#endif +/* + * ICMPv6 socket option processing. + */ +int +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +icmp6_ctloutput(so, sopt) + struct socket *so; + struct sockopt *sopt; +#else +icmp6_ctloutput(op, so, level, optname, mp) + int op; + struct socket *so; + int level, optname; + struct mbuf **mp; +#endif +{ + int error = 0; + int optlen; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + struct inpcb *inp = sotoinpcb(so); + int level, op, optname; + + if (sopt) { + level = sopt->sopt_level; + op = sopt->sopt_dir; + optname = sopt->sopt_name; + optlen = sopt->sopt_valsize; + } else + level = op = optname = optlen = 0; +#else + struct in6pcb *in6p = sotoin6pcb(so); + struct mbuf *m = *mp; + + optlen = m ? m->m_len : 0; +#endif + + if (level != IPPROTO_ICMPV6) { +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + if (op == PRCO_SETOPT && m) + (void)m_free(m); +#endif + return EINVAL; + } + + switch (op) { + case PRCO_SETOPT: + switch (optname) { + case ICMP6_FILTER: + { + struct icmp6_filter *p; + + if (optlen != sizeof(*p)) { + error = EMSGSIZE; + break; + } +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if (inp->in6p_icmp6filt == NULL) { + error = EINVAL; + break; + } + error = sooptcopyin(sopt, inp->in6p_icmp6filt, optlen, + optlen); +#else + p = mtod(m, struct icmp6_filter *); + if (!p || !in6p->in6p_icmp6filt) { + error = EINVAL; + break; + } + bcopy(p, in6p->in6p_icmp6filt, + sizeof(struct icmp6_filter)); + error = 0; +#endif + break; + } + + default: + error = ENOPROTOOPT; + break; + } +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + if (m) + (void)m_freem(m); +#endif + break; + + case PRCO_GETOPT: + switch (optname) { + case ICMP6_FILTER: + { +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if (inp->in6p_icmp6filt == NULL) { + error = EINVAL; + break; + } + error = sooptcopyout(sopt, inp->in6p_icmp6filt, + sizeof(struct icmp6_filter)); +#else + struct icmp6_filter *p; + + if (!in6p->in6p_icmp6filt) { + error = EINVAL; + break; + } + *mp = m = m_get(M_WAIT, MT_SOOPTS); + m->m_len = sizeof(struct icmp6_filter); + p = mtod(m, struct icmp6_filter *); + bcopy(in6p->in6p_icmp6filt, p, + sizeof(struct icmp6_filter)); + error = 0; +#endif + break; + } + + default: + error = ENOPROTOOPT; + break; + } + break; + } + + return(error); +} +#ifdef HAVE_NRL_INPCB +#undef sotoin6pcb +#undef in6pcb +#undef in6p_icmp6filt +#endif + +#ifndef HAVE_PPSRATECHECK +#ifndef timersub +#define timersub(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ + if ((vvp)->tv_usec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_usec += 1000000; \ + } \ + } while (0) +#endif + +/* + * ppsratecheck(): packets (or events) per second limitation. + */ +static int +ppsratecheck(lasttime, curpps, maxpps) + struct timeval *lasttime; + int *curpps; + int maxpps; /* maximum pps allowed */ +{ + struct timeval tv, delta; + int s, rv; + + s = splclock(); +#ifndef __FreeBSD__ + tv = mono_time; +#else + microtime(&tv); +#endif + splx(s); + + timersub(&tv, lasttime, &delta); + + /* + * Check for 0,0 so that the message will be seen at least once. + * If more than one second has passed since the last update of + * lasttime, reset the counter. + * + * We do increment *curpps even in *curpps < maxpps case, as some may + * try to use *curpps for stat purposes as well. + */ + if ((lasttime->tv_sec == 0 && lasttime->tv_usec == 0) || + delta.tv_sec >= 1) { + *lasttime = tv; + *curpps = 0; + rv = 1; + } else if (maxpps < 0) + rv = 1; + else if (*curpps < maxpps) + rv = 1; + else + rv = 0; + +#if 1 /* DIAGNOSTIC? */ + /* be careful about wrap-around */ + if (*curpps + 1 > *curpps) + *curpps = *curpps + 1; +#else + /* + * assume that there's not too many calls to this function. + * not sure if the assumption holds, as it depends on *caller's* + * behavior, not the behavior of this function. + * IMHO it is wrong to make assumption on the caller's behavior, + * so the above #if is #if 1, not #ifdef DIAGNOSTIC. + */ + *curpps = *curpps + 1; +#endif + + return (rv); +} +#endif + +/* + * Perform rate limit check. + * Returns 0 if it is okay to send the icmp6 packet. + * Returns 1 if the router SHOULD NOT send this icmp6 packet due to rate + * limitation. + * + * XXX per-destination/type check necessary? + */ +static int +icmp6_ratelimit(dst, type, code) + const struct in6_addr *dst; /* not used at this moment */ + const int type; /* not used at this moment */ + const int code; /* not used at this moment */ +{ + int ret; + + ret = 0; /* okay to send */ + + /* PPS limit */ + if (!ppsratecheck(&icmp6errppslim_last, &icmp6errpps_count, + icmp6errppslim)) { + /* The packet is subject to rate limit */ + ret++; + } + + return ret; +} + +/* + * Swap ip6_src and the address in the homeaddress destination option. + * Since the dest6 processing routine swaps ip6_src and homeaddr (if + * any), we must swap them again when we send back the ip datagram to + * the sender (ex. icmp6_error). + * + * returns 0 if succeeded. + */ +static int +icmp6_recover_src(m) + struct mbuf *m; /* original ip6 packet */ +{ + int off, nxt, finished = 0; + struct ip6_hdr *oip6; + struct ip6_ext *exts; + struct ip6_dest *dstopts; + int dstoptlen; + u_int8_t *opt; + int optlen; + struct ip6_opt_home_address *haopt; + struct in6_addr t; + int error = 0; + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), ENOBUFS); + oip6 = mtod(m, struct ip6_hdr *); +#else + IP6_EXTHDR_GET(oip6, struct ip6_hdr *, m, 0, sizeof(*oip6)); + if (oip6 == NULL) { + error = ENOBUFS; + goto bad; + } +#endif + + off = sizeof(struct ip6_hdr); + nxt = oip6->ip6_nxt; + while (off + 2 < m->m_pkthdr.len) { + switch (nxt) { + case IPPROTO_DSTOPTS: +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, sizeof(struct ip6_dest), + ENOBUFS); + dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(dstopts, struct ip6_dest *, + m, off, sizeof(*dstopts)); + if (dstopts == NULL) { + error = ENOBUFS; + goto bad; + } +#endif + + dstoptlen = (dstopts->ip6d_len + 1) << 3; +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, dstoptlen, ENOBUFS); + dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(dstopts, struct ip6_dest *, + m, off, dstoptlen); + if (dstopts == NULL) { + error = ENOBUFS; + goto bad; + } +#endif + off += dstoptlen; + nxt = dstopts->ip6d_nxt; + + /* find homeaddress dstopt */ + dstoptlen -= sizeof(struct ip6_dest); + opt = (u_int8_t *)dstopts + sizeof(struct ip6_dest); + for (optlen = 0; (dstoptlen > 0 && finished == 0); + dstoptlen -= optlen, opt += optlen) { + if ((*opt != IP6OPT_PAD1) && + (dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) { + error = EINVAL; + goto bad; + } + switch (*opt) { + case IP6OPT_PAD1: + optlen = 1; + break; + case IP6OPT_PADN: + optlen = *(opt + 1) + 2; + break; + case IP6OPT_HOME_ADDRESS: + haopt = (struct ip6_opt_home_address *)opt; + optlen = haopt->ip6oh_len + 2; + if (optlen < sizeof(*haopt)) { + error = EINVAL; + goto bad; + } + + /* swap */ + bcopy(haopt->ip6oh_addr, &t, + sizeof(haopt->ip6oh_addr)); + bcopy(&oip6->ip6_src, + haopt->ip6oh_addr, + sizeof(oip6->ip6_src)); + bcopy(&t, &oip6->ip6_src, + sizeof(t)); + finished = 1; + break; + default: + optlen = ip6_unknown_opt(opt, m, + opt - mtod(m, u_int8_t *)); + if (optlen == -1) { + error = EINVAL; + goto bad; + } + optlen += 2; + break; + } + } + break; + + default: +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, sizeof(struct ip6_ext), + ENOBUFS); + exts = (struct ip6_ext *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(exts, struct ip6_ext *, + m, off, sizeof(*exts)); + if (exts == NULL) { + error = ENOBUFS; + goto bad; + } +#endif + if (nxt == IPPROTO_AH) + off += (exts->ip6e_len + 2) << 2; + else + off += (exts->ip6e_len + 1) << 3; + nxt = exts->ip6e_nxt; + break; + } + if (finished) + break; + } + + return (0); + bad: + ip6_delaux(m); + m_freem(m); + return (error); +} + +#if defined(__NetBSD__) || defined(__OpenBSD__) +static struct rtentry * +icmp6_mtudisc_clone(dst) + struct sockaddr *dst; +{ + struct rtentry *rt; + int error; + + rt = rtalloc1(dst, 1); + if (rt == 0) + return NULL; + + /* If we didn't get a host route, allocate one */ + if ((rt->rt_flags & RTF_HOST) == 0) { + struct rtentry *nrt; + + error = rtrequest((int) RTM_ADD, dst, + (struct sockaddr *) rt->rt_gateway, + (struct sockaddr *) 0, + RTF_GATEWAY | RTF_HOST | RTF_DYNAMIC, &nrt); + if (error) { + rtfree(rt); + return NULL; + } + nrt->rt_rmx = rt->rt_rmx; + rtfree(rt); + rt = nrt; + } + error = rt_timer_add(rt, icmp6_mtudisc_timeout, + icmp6_mtudisc_timeout_q); + if (error) { + rtfree(rt); + return NULL; + } + + return rt; /* caller need to call rtfree() */ +} + +static void +icmp6_mtudisc_timeout(rt, r) + struct rtentry *rt; + struct rttimer *r; +{ + if (rt == NULL) + panic("icmp6_mtudisc_timeout: bad route to timeout"); + if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) == + (RTF_DYNAMIC | RTF_HOST)) { + rtrequest((int) RTM_DELETE, (struct sockaddr *)rt_key(rt), + rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0); + } else { + if ((rt->rt_rmx.rmx_locks & RTV_MTU) == 0) + rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; + } +} + +static void +icmp6_redirect_timeout(rt, r) + struct rtentry *rt; + struct rttimer *r; +{ + if (rt == NULL) + panic("icmp6_redirect_timeout: bad route to timeout"); + if ((rt->rt_flags & (RTF_GATEWAY | RTF_DYNAMIC | RTF_HOST)) == + (RTF_GATEWAY | RTF_DYNAMIC | RTF_HOST)) { + rtrequest((int) RTM_DELETE, (struct sockaddr *)rt_key(rt), + rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0); + } +} +#endif /* __NetBSD__ || __OpenBSD__ */ + +#ifdef __bsdi__ +void +icmp6_mtuexpire(rt, rtt) + struct rtentry *rt; + struct rttimer *rtt; +{ + rt->rt_flags |= RTF_PROBEMTU; + Free(rtt); +} + +int *icmp6_sysvars[] = ICMPV6CTL_VARS; + +int +icmp6_sysctl(name, namelen, oldp, oldlenp, newp, newlen) + int *name; + u_int namelen; + void *oldp; + size_t *oldlenp; + void *newp; + size_t newlen; +{ + if (name[0] >= ICMPV6CTL_MAXID) + return (EOPNOTSUPP); + switch (name[0]) { +#if 0 + ICMPV6CTL_ND6_PRUNE: + ICMPV6CTL_ND6_DELAY: + ICMPV6CTL_ND6_UMAXTRIES: + ICMPV6CTL_ND6_MMAXTRIES: + ICMPV6CTL_ND6_USELOOPBACK: + /* need to check the value. */ +#endif + case ICMPV6CTL_STATS: + return sysctl_rdtrunc(oldp, oldlenp, newp, &icmp6stat, + sizeof(icmp6stat)); + case ICMPV6CTL_ND6_DRLIST: + case ICMPV6CTL_ND6_PRLIST: + return nd6_sysctl(name[0], oldp, oldlenp, newp, newlen); + default: + return (sysctl_int_arr(icmp6_sysvars, name, namelen, + oldp, oldlenp, newp, newlen)); + } +} +#endif /* __bsdi__ */ + +#if defined(__NetBSD__) || defined(__OpenBSD__) +#include +#include +int +icmp6_sysctl(name, namelen, oldp, oldlenp, newp, newlen) + int *name; + u_int namelen; + void *oldp; + size_t *oldlenp; + void *newp; + size_t newlen; +{ + + /* All sysctl names at this level are terminal. */ + if (namelen != 1) + return ENOTDIR; + + switch (name[0]) { + + case ICMPV6CTL_REDIRACCEPT: + return sysctl_int(oldp, oldlenp, newp, newlen, + &icmp6_rediraccept); + case ICMPV6CTL_REDIRTIMEOUT: + return sysctl_int(oldp, oldlenp, newp, newlen, + &icmp6_redirtimeout); + case ICMPV6CTL_STATS: + return sysctl_rdstruct(oldp, oldlenp, newp, + &icmp6stat, sizeof(icmp6stat)); + case ICMPV6CTL_ND6_PRUNE: + return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_prune); + case ICMPV6CTL_ND6_DELAY: + return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_delay); + case ICMPV6CTL_ND6_UMAXTRIES: + return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_umaxtries); + case ICMPV6CTL_ND6_MMAXTRIES: + return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_mmaxtries); + case ICMPV6CTL_ND6_USELOOPBACK: + return sysctl_int(oldp, oldlenp, newp, newlen, + &nd6_useloopback); + case ICMPV6CTL_NODEINFO: + return sysctl_int(oldp, oldlenp, newp, newlen, &icmp6_nodeinfo); + case ICMPV6CTL_ERRPPSLIMIT: + return sysctl_int(oldp, oldlenp, newp, newlen, &icmp6errppslim); + case ICMPV6CTL_ND6_MAXNUDHINT: + return sysctl_int(oldp, oldlenp, newp, newlen, + &nd6_maxnudhint); + case ICMPV6CTL_MTUDISC_HIWAT: + return sysctl_int(oldp, oldlenp, newp, newlen, + &icmp6_mtudisc_hiwat); + case ICMPV6CTL_MTUDISC_LOWAT: + return sysctl_int(oldp, oldlenp, newp, newlen, + &icmp6_mtudisc_lowat); + case ICMPV6CTL_ND6_DEBUG: + return sysctl_int(oldp, oldlenp, newp, newlen, &nd6_debug); + case ICMPV6CTL_ND6_DRLIST: + case ICMPV6CTL_ND6_PRLIST: + return nd6_sysctl(name[0], oldp, oldlenp, newp, newlen); + default: + return ENOPROTOOPT; + } + /* NOTREACHED */ +} +#endif /* __NetBSD__ */ diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/in6.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6.c @@ -0,0 +1,3053 @@ +//========================================================================== +// +// src/sys/netinet6/in6.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: in6.c,v 1.256 2001/12/24 10:39:29 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 1991, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in.c 8.2 (Berkeley) 11/15/93 + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#ifdef __NetBSD__ +#include +#else +#include +#endif +#ifndef SCOPEDROUTING +#if defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) +#include +#include +#include +#endif +#endif + +#include +#include +#include +#include +#include +#include +#include +#ifndef SCOPEDROUTING +#if defined(__NetBSD__) || (defined(__bsdi__) && _BSDI_VERSION < 199802) || defined(__FreeBSD__) +#include +#endif +#endif + +#ifdef MIP6 +#include +#endif /* MIP6 */ + +/* + * Definitions of some costant IP6 addresses. + */ +const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; +const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; +const struct in6_addr in6addr_nodelocal_allnodes = + IN6ADDR_NODELOCAL_ALLNODES_INIT; +const struct in6_addr in6addr_linklocal_allnodes = + IN6ADDR_LINKLOCAL_ALLNODES_INIT; +const struct in6_addr in6addr_linklocal_allrouters = + IN6ADDR_LINKLOCAL_ALLROUTERS_INIT; + +const struct in6_addr in6mask0 = IN6MASK0; +const struct in6_addr in6mask32 = IN6MASK32; +const struct in6_addr in6mask64 = IN6MASK64; +const struct in6_addr in6mask96 = IN6MASK96; +const struct in6_addr in6mask128 = IN6MASK128; + +const struct sockaddr_in6 sa6_any = {sizeof(sa6_any), AF_INET6, + 0, 0, IN6ADDR_ANY_INIT, 0}; + +#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3) +static int in6_lifaddr_ioctl __P((struct socket *, u_long, caddr_t, + struct ifnet *, struct proc *)); +#else +static int in6_lifaddr_ioctl __P((struct socket *, u_long, caddr_t, + struct ifnet *)); +#endif +static int in6_ifinit __P((struct ifnet *, struct in6_ifaddr *, + struct sockaddr_in6 *, int)); +static void in6_unlink_ifa __P((struct in6_ifaddr *, struct ifnet *)); + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +struct in6_multihead in6_multihead; /* XXX BSS initialization */ +#else +/* + * This structure is used to keep track of in6_multi chains which belong to + * deleted interface addresses. + */ +static LIST_HEAD(, multi6_kludge) in6_mk; /* XXX BSS initialization */ + +struct multi6_kludge { + LIST_ENTRY(multi6_kludge) mk_entry; + struct ifnet *mk_ifp; + struct in6_multihead mk_head; +}; +#endif + +#ifdef MEASURE_PERFORMANCE +static void in6h_delifa __P((struct in6_ifaddr *)); +static void in6h_addhash __P((struct in6hash *)); +static void in6h_delhash __P((struct in6hash *)); +#endif + +/* + * Subroutine for in6_ifaddloop() and in6_ifremloop(). + * This routine does actual work. + */ +static void +in6_ifloop_request(int cmd, struct ifaddr *ifa) +{ + struct sockaddr_in6 all1_sa; + struct rtentry *nrt = NULL; + int e; + + bzero(&all1_sa, sizeof(all1_sa)); + all1_sa.sin6_family = AF_INET6; + all1_sa.sin6_len = sizeof(struct sockaddr_in6); + all1_sa.sin6_addr = in6mask128; + + /* + * We specify the address itself as the gateway, and set the + * RTF_LLINFO flag, so that the corresponding host route would have + * the flag, and thus applications that assume traditional behavior + * would be happy. Note that we assume the caller of the function + * (probably implicitly) set nd6_rtrequest() to ifa->ifa_rtrequest, + * which changes the outgoing interface to the loopback interface. + */ + e = rtrequest(cmd, ifa->ifa_addr, ifa->ifa_addr, + (struct sockaddr *)&all1_sa, + RTF_UP|RTF_HOST|RTF_LLINFO, &nrt); + if (e != 0) { + log(LOG_ERR, "in6_ifloop_request: " + "%s operation failed for %s (errno=%d)\n", + cmd == RTM_ADD ? "ADD" : "DELETE", + ip6_sprintf(&((struct in6_ifaddr *)ifa)->ia_addr.sin6_addr), + e); + } + + /* + * Make sure rt_ifa be equal to IFA, the second argument of the + * function. + * We need this because when we refer to rt_ifa->ia6_flags in + * ip6_input, we assume that the rt_ifa points to the address instead + * of the loopback address. + */ + if (cmd == RTM_ADD && nrt && ifa != nrt->rt_ifa) { + IFAFREE(nrt->rt_ifa); + IFAREF(ifa); + nrt->rt_ifa = ifa; + } + + /* + * Report the addition/removal of the address to the routing socket. + * XXX: since we called rtinit for a p2p interface with a destination, + * we end up reporting twice in such a case. Should we rather + * omit the second report? + */ + if (nrt) { + rt_newaddrmsg(cmd, ifa, e, nrt); + if (cmd == RTM_DELETE) { + if (nrt->rt_refcnt <= 0) { + /* XXX: we should free the entry ourselves. */ + nrt->rt_refcnt++; + rtfree(nrt); + } + } else { + /* the cmd must be RTM_ADD here */ + nrt->rt_refcnt--; + } + } +} + +/* + * Add ownaddr as loopback rtentry. We previously add the route only if + * necessary (ex. on a p2p link). However, since we now manage addresses + * separately from prefixes, we should always add the route. We can't + * rely on the cloning mechanism from the corresponding interface route + * any more. + */ +static void +in6_ifaddloop(struct ifaddr *ifa) +{ + struct rtentry *rt; + + /* If there is no loopback entry, allocate one. */ + rt = rtalloc1(ifa->ifa_addr, 0 +#ifdef __FreeBSD__ + , 0 +#endif /* __FreeBSD__ */ + ); + if (rt == NULL || (rt->rt_flags & RTF_HOST) == 0 || + (rt->rt_ifp->if_flags & IFF_LOOPBACK) == 0) + in6_ifloop_request(RTM_ADD, ifa); + if (rt) + rt->rt_refcnt--; +} + +/* + * Remove loopback rtentry of ownaddr generated by in6_ifaddloop(), + * if it exists. + */ +static void +in6_ifremloop(struct ifaddr *ifa) +{ + struct in6_ifaddr *ia; + struct rtentry *rt; + int ia_count = 0; + + /* + * Some of BSD variants do not remove cloned routes + * from an interface direct route, when removing the direct route + * (see comments in net/net_osdep.h). Even for variants that do remove + * cloned routes, they could fail to remove the cloned routes when + * we handle multple addresses that share a common prefix. + * So, we should remove the route corresponding to the deleted address + * regardless of the result of in6_is_ifloop_auto(). + */ + + /* + * Delete the entry only if exact one ifa exists. More than one ifa + * can exist if we assign a same single address to multiple + * (probably p2p) interfaces. + * XXX: we should avoid such a configuration in IPv6... + */ + for (ia = in6_ifaddr; ia; ia = ia->ia_next) { + if (IN6_ARE_ADDR_EQUAL(IFA_IN6(ifa), &ia->ia_addr.sin6_addr)) { + ia_count++; + if (ia_count > 1) + break; + } + } + + if (ia_count == 1) { + /* + * Before deleting, check if a corresponding loopbacked host + * route surely exists. With this check, we can avoid to + * delete an interface direct route whose destination is same + * as the address being removed. This can happen when remofing + * a subnet-router anycast address on an interface attahced + * to a shared medium. + */ + rt = rtalloc1(ifa->ifa_addr, 0 +#ifdef __FreeBSD__ + , 0 +#endif /* __FreeBSD__ */ + ); + if (rt != NULL && (rt->rt_flags & RTF_HOST) != 0 && + (rt->rt_ifp->if_flags & IFF_LOOPBACK) != 0) { + rt->rt_refcnt--; + in6_ifloop_request(RTM_DELETE, ifa); + } + } +} + +int +in6_ifindex2scopeid(idx) + int idx; +{ + struct ifnet *ifp; + struct ifaddr *ifa; + struct sockaddr_in6 *sin6; + + if (idx < 0 || if_index < idx) + return -1; +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + ifp = ifnet_byindex(idx); +#else + ifp = ifindex2ifnet[idx]; +#endif + if (!ifp) + return -1; + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; + if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) + return sin6->sin6_scope_id & 0xffff; + } + + return -1; +} + +int +in6_mask2len(mask, lim0) + struct in6_addr *mask; + u_char *lim0; +{ + int x = 0, y; + u_char *lim = lim0, *p; + + if (lim0 == NULL || + lim0 - (u_char *)mask > sizeof(*mask)) /* ignore the scope_id part */ + lim = (u_char *)mask + sizeof(*mask); + for (p = (u_char *)mask; p < lim; x++, p++) { + if (*p != 0xff) + break; + } + y = 0; + if (p < lim) { + for (y = 0; y < 8; y++) { + if ((*p & (0x80 >> y)) == 0) + break; + } + } + + /* + * when the limit pointer is given, do a stricter check on the + * remaining bits. + */ + if (p < lim) { + if (y != 0 && (*p & (0x00ff >> y)) != 0) + return(-1); + for (p = p + 1; p < lim; p++) + if (*p != 0) + return(-1); + } + + return x * 8 + y; +} + +#define ifa2ia6(ifa) ((struct in6_ifaddr *)(ifa)) +#define ia62ifa(ia6) (&((ia6)->ia_ifa)) + +int +#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3) +in6_control(so, cmd, data, ifp, p) + struct socket *so; + u_long cmd; + caddr_t data; + struct ifnet *ifp; + struct proc *p; +#else +in6_control(so, cmd, data, ifp) + struct socket *so; + u_long cmd; + caddr_t data; + struct ifnet *ifp; +#endif +{ + struct in6_ifreq *ifr = (struct in6_ifreq *)data; + struct in6_ifaddr *ia = NULL; + struct in6_aliasreq *ifra = (struct in6_aliasreq *)data; + struct sockaddr_in6 *sa6; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + time_t time_second = (time_t)time.tv_sec; +#endif + + switch (cmd) { + case SIOCGETSGCNT_IN6: + case SIOCGETMIFCNT_IN6: + return (mrt6_ioctl(cmd, data)); + } + + switch(cmd) { + case SIOCAADDRCTL_POLICY: + case SIOCDADDRCTL_POLICY: + return(in6_src_ioctl(cmd, data)); + } + +#ifdef MIP6 + switch (cmd) { + case SIOCENABLEMN: + case SIOCENABLEHA: + return(mip6_ioctl(cmd, data)); + case SIOCGBC: + return(mip6_ioctl(cmd, data)); + } +#endif /* MIP6 */ + + if (ifp == NULL) + return(EOPNOTSUPP); + + switch (cmd) { + case SIOCSNDFLUSH_IN6: + case SIOCSPFXFLUSH_IN6: + case SIOCSRTRFLUSH_IN6: + case SIOCSDEFIFACE_IN6: + case SIOCSIFINFO_FLAGS: + /* fall through */ + case OSIOCGIFINFO_IN6: + case SIOCGIFINFO_IN6: + case SIOCGDRLST_IN6: + case SIOCGPRLST_IN6: + case SIOCGNBRINFO_IN6: + case SIOCGDEFIFACE_IN6: + return(nd6_ioctl(cmd, data, ifp)); + } + + switch (cmd) { + case SIOCSIFPREFIX_IN6: + case SIOCDIFPREFIX_IN6: + case SIOCAIFPREFIX_IN6: + case SIOCCIFPREFIX_IN6: + case SIOCSGIFPREFIX_IN6: + case SIOCGIFPREFIX_IN6: + log(LOG_NOTICE, + "prefix ioctls are now invalidated. " + "please use ifconfig.\n"); + return(EOPNOTSUPP); + } + + switch (cmd) { + case SIOCSSCOPE6: + return(scope6_set(ifp, ifr->ifr_ifru.ifru_scope_id)); + case SIOCGSCOPE6: + return(scope6_get(ifp, ifr->ifr_ifru.ifru_scope_id)); + case SIOCGSCOPE6DEF: + return(scope6_get_default(ifr->ifr_ifru.ifru_scope_id)); + } + + switch (cmd) { + case SIOCALIFADDR: + case SIOCDLIFADDR: + /* fall through */ + case SIOCGLIFADDR: +#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3) + return in6_lifaddr_ioctl(so, cmd, data, ifp, p); +#else + return in6_lifaddr_ioctl(so, cmd, data, ifp); +#endif + } + + /* + * Find address for this interface, if it exists. + * + * In netinet code, we have checked ifra_addr in SIOCSIF*ADDR operation + * only, and used the first interface address as the target of other + * operations (without checking ifra_addr). This was because netinet + * code/API assumed at most 1 interface address per interface. + * Since IPv6 allows a node to assign multiple addresses + * on a single interface, we almost always look and check the + * presence of ifra_addr, and reject invalid ones here. + * It also decreases duplicated code among SIOC*_IN6 operations. + */ + switch (cmd) { + case SIOCAIFADDR_IN6: + case SIOCSIFPHYADDR_IN6: + sa6 = &ifra->ifra_addr; + break; + case SIOCSIFADDR_IN6: + case SIOCGIFADDR_IN6: + case SIOCSIFDSTADDR_IN6: + case SIOCSIFNETMASK_IN6: + case SIOCGIFDSTADDR_IN6: + case SIOCGIFNETMASK_IN6: + case SIOCDIFADDR_IN6: + case SIOCGIFPSRCADDR_IN6: + case SIOCGIFPDSTADDR_IN6: + case SIOCGIFAFLAG_IN6: + case SIOCSNDFLUSH_IN6: + case SIOCSPFXFLUSH_IN6: + case SIOCSRTRFLUSH_IN6: + case SIOCGIFALIFETIME_IN6: + case SIOCSIFALIFETIME_IN6: + case SIOCGIFSTAT_IN6: + case SIOCGIFSTAT_ICMP6: + sa6 = &ifr->ifr_addr; + break; + default: + sa6 = NULL; + break; + } + if (sa6 && sa6->sin6_family == AF_INET6) { + if (IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr)) { + if (sa6->sin6_addr.s6_addr16[1] == 0) { + /* link ID is not embedded by the user */ + sa6->sin6_addr.s6_addr16[1] = + htons(ifp->if_index); + } else if (sa6->sin6_addr.s6_addr16[1] != + htons(ifp->if_index)) { + return(EINVAL); /* link ID contradicts */ + } + if (sa6->sin6_scope_id) { + if (sa6->sin6_scope_id != + (u_int32_t)ifp->if_index) + return(EINVAL); + sa6->sin6_scope_id = 0; /* XXX: good way? */ + } + } + ia = in6ifa_ifpwithaddr(ifp, &sa6->sin6_addr); + } else + ia = NULL; + + switch (cmd) { + case SIOCSIFADDR_IN6: + case SIOCSIFDSTADDR_IN6: + case SIOCSIFNETMASK_IN6: + /* + * Since IPv6 allows a node to assign multiple addresses + * on a single interface, SIOCSIFxxx ioctls are deprecated. + */ + return(EINVAL); + + case SIOCDIFADDR_IN6: + /* + * for IPv4, we look for existing in_ifaddr here to allow + * "ifconfig if0 delete" to remove the first IPv4 address on + * the interface. For IPv6, as the spec allows multiple + * interface address from the day one, we consider "remove the + * first one" semantics to be not preferable. + */ + if (ia == NULL) + return(EADDRNOTAVAIL); + /* FALLTHROUGH */ + case SIOCAIFADDR_IN6: + /* + * We always require users to specify a valid IPv6 address for + * the corresponding operation. + */ + if (ifra->ifra_addr.sin6_family != AF_INET6 || + ifra->ifra_addr.sin6_len != sizeof(struct sockaddr_in6)) + return(EAFNOSUPPORT); + + break; + + case SIOCGIFADDR_IN6: + /* This interface is basically deprecated. use SIOCGIFCONF. */ + /* fall through */ + case SIOCGIFAFLAG_IN6: + case SIOCGIFNETMASK_IN6: + case SIOCGIFDSTADDR_IN6: + case SIOCGIFALIFETIME_IN6: + /* must think again about its semantics */ + if (ia == NULL) + return(EADDRNOTAVAIL); + break; + case SIOCSIFALIFETIME_IN6: + { + struct in6_addrlifetime *lt; + + if (ia == NULL) + return(EADDRNOTAVAIL); + /* sanity for overflow - beware unsigned */ + lt = &ifr->ifr_ifru.ifru_lifetime; + if (lt->ia6t_vltime != ND6_INFINITE_LIFETIME + && lt->ia6t_vltime + time_second < time_second) { + return EINVAL; + } + if (lt->ia6t_pltime != ND6_INFINITE_LIFETIME + && lt->ia6t_pltime + time_second < time_second) { + return EINVAL; + } + break; + } + } + + switch (cmd) { + + case SIOCGIFADDR_IN6: + ifr->ifr_addr = ia->ia_addr; + break; + + case SIOCGIFDSTADDR_IN6: + if ((ifp->if_flags & IFF_POINTOPOINT) == 0) + return(EINVAL); + /* + * XXX: should we check if ifa_dstaddr is NULL and return + * an error? + */ + ifr->ifr_dstaddr = ia->ia_dstaddr; + break; + + case SIOCGIFNETMASK_IN6: + ifr->ifr_addr = ia->ia_prefixmask; + break; + + case SIOCGIFAFLAG_IN6: + ifr->ifr_ifru.ifru_flags6 = ia->ia6_flags; + break; + + case SIOCGIFSTAT_IN6: + if (ifp == NULL) + return EINVAL; + if (in6_ifstat == NULL || ifp->if_index >= in6_ifstatmax + || in6_ifstat[ifp->if_index] == NULL) { + /* return EAFNOSUPPORT? */ + bzero(&ifr->ifr_ifru.ifru_stat, + sizeof(ifr->ifr_ifru.ifru_stat)); + } else + ifr->ifr_ifru.ifru_stat = *in6_ifstat[ifp->if_index]; + break; + + case SIOCGIFSTAT_ICMP6: + if (ifp == NULL) + return EINVAL; + if (icmp6_ifstat == NULL || ifp->if_index >= icmp6_ifstatmax || + icmp6_ifstat[ifp->if_index] == NULL) { + /* return EAFNOSUPPORT? */ + bzero(&ifr->ifr_ifru.ifru_stat, + sizeof(ifr->ifr_ifru.ifru_icmp6stat)); + } else + ifr->ifr_ifru.ifru_icmp6stat = + *icmp6_ifstat[ifp->if_index]; + break; + + case SIOCGIFALIFETIME_IN6: + ifr->ifr_ifru.ifru_lifetime = ia->ia6_lifetime; + if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { + time_t maxexpire; + struct in6_addrlifetime *retlt = &ifr->ifr_ifru.ifru_lifetime; + + /* + * XXX: adjust expiration time assuming time_t is + * signed. + */ + maxexpire = (-1) & + ~(1 << ((sizeof(maxexpire) * 8) - 1)); + if (ia->ia6_lifetime.ia6t_vltime < + maxexpire - ia->ia6_updatetime) { + retlt->ia6t_expire = ia->ia6_updatetime + + ia->ia6_lifetime.ia6t_vltime; + } else + retlt->ia6t_expire = maxexpire; + } + if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { + time_t maxexpire; + struct in6_addrlifetime *retlt = &ifr->ifr_ifru.ifru_lifetime; + + /* + * XXX: adjust expiration time assuming time_t is + * signed. + */ + maxexpire = (-1) & + ~(1 << ((sizeof(maxexpire) * 8) - 1)); + if (ia->ia6_lifetime.ia6t_pltime < + maxexpire - ia->ia6_updatetime) { + retlt->ia6t_preferred = ia->ia6_updatetime + + ia->ia6_lifetime.ia6t_pltime; + } else + retlt->ia6t_preferred = maxexpire; + } + break; + + case SIOCSIFALIFETIME_IN6: + ia->ia6_lifetime = ifr->ifr_ifru.ifru_lifetime; + /* for sanity */ + if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { + ia->ia6_lifetime.ia6t_expire = + time_second + ia->ia6_lifetime.ia6t_vltime; + } else + ia->ia6_lifetime.ia6t_expire = 0; + if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { + ia->ia6_lifetime.ia6t_preferred = + time_second + ia->ia6_lifetime.ia6t_pltime; + } else + ia->ia6_lifetime.ia6t_preferred = 0; + break; + + case SIOCAIFADDR_IN6: + { + int i, error = 0; + struct nd_prefix pr0, *pr; + + /* + * first, make or update the interface address structure, + * and link it to the list. + */ + if ((error = in6_update_ifa(ifp, ifra, ia)) != 0) + return(error); + if ((ia = in6ifa_ifpwithaddr(ifp, &ifra->ifra_addr.sin6_addr)) + == NULL) { + /* + * this can happen when the user specify the 0 valid + * lifetime. + */ + break; + } + + /* + * then, make the prefix on-link on the interface. + * XXX: we'd rather create the prefix before the address, but + * we need at least one address to install the corresponding + * interface route, so we configure the address first. + */ + + /* + * convert mask to prefix length (prefixmask has already + * been validated in in6_update_ifa(). + */ + bzero(&pr0, sizeof(pr0)); + pr0.ndpr_ifp = ifp; + pr0.ndpr_plen = in6_mask2len(&ifra->ifra_prefixmask.sin6_addr, + NULL); + if (pr0.ndpr_plen == 128) + break; /* we don't need to install a host route. */ + pr0.ndpr_prefix = ifra->ifra_addr; + pr0.ndpr_mask = ifra->ifra_prefixmask.sin6_addr; + /* apply the mask for safety. */ + for (i = 0; i < 4; i++) { + pr0.ndpr_prefix.sin6_addr.s6_addr32[i] &= + ifra->ifra_prefixmask.sin6_addr.s6_addr32[i]; + } + /* + * XXX: since we don't have an API to set prefix (not address) + * lifetimes, we just use the same lifetimes as addresses. + * The (temporarily) installed lifetimes can be overridden by + * later advertised RAs (when accept_rtadv is non 0), which is + * an intended behavior. + */ + pr0.ndpr_raf_onlink = 1; /* should be configurable? */ + pr0.ndpr_raf_auto = + ((ifra->ifra_flags & IN6_IFF_AUTOCONF) != 0); + pr0.ndpr_vltime = ifra->ifra_lifetime.ia6t_vltime; + pr0.ndpr_pltime = ifra->ifra_lifetime.ia6t_pltime; + + /* add the prefix if there's one. */ + if ((pr = nd6_prefix_lookup(&pr0)) == NULL) { + /* + * nd6_prelist_add will install the corresponding + * interface route. + */ + if ((error = nd6_prelist_add(&pr0, NULL, &pr)) != 0) + return(error); + if (pr == NULL) { + log(LOG_ERR, "nd6_prelist_add succeeded but " + "no prefix\n"); + return(EINVAL); /* XXX panic here? */ + } + } + if ((ia->ia6_flags & IN6_IFF_AUTOCONF) && + ia->ia6_ndpr == NULL) { /* new autoconfed addr */ + ia->ia6_ndpr = pr; + pr->ndpr_refcnt++; + + /* + * If this is the first autoconf address from + * the prefix, create a temporary address + * as well (when specified). + */ + if (ip6_use_tempaddr && pr->ndpr_refcnt == 1) { + int e; + if ((e = in6_tmpifadd(ia, 1)) != 0) { + log(LOG_NOTICE, "in6_control: failed " + "to create a temporary address, " + "errno=%d\n", + e); + } + } + } + + /* + * this might affect the status of autoconfigured addresses, + * that is, this address might make other addresses detached. + */ + pfxlist_onlink_check(); + + break; + } + + case SIOCDIFADDR_IN6: + { + int i = 0, purgeprefix = 0; + struct nd_prefix pr0, *pr = NULL; + + /* + * If the address being deleted is the only one that owns + * the corresponding prefix, expire the prefix as well. + * XXX: theoretically, we don't have to worry about such + * relationship, since we separate the address management + * and the prefix management. We do this, however, to provide + * as much backward compatibility as possible in terms of + * the ioctl operation. + */ + bzero(&pr0, sizeof(pr0)); + pr0.ndpr_ifp = ifp; + pr0.ndpr_plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, + NULL); + if (pr0.ndpr_plen == 128) + goto purgeaddr; + pr0.ndpr_prefix = ia->ia_addr; + pr0.ndpr_mask = ia->ia_prefixmask.sin6_addr; + for (i = 0; i < 4; i++) { + pr0.ndpr_prefix.sin6_addr.s6_addr32[i] &= + ia->ia_prefixmask.sin6_addr.s6_addr32[i]; + } + /* + * The logic of the following condition is a bit complicated. + * We expire the prefix when + * 1. the address obeys autoconfiguration and it is the + * only owner of the associated prefix, or + * 2. the address does not obey autoconf and there is no + * other owner of the prefix. + */ + if ((pr = nd6_prefix_lookup(&pr0)) != NULL && + (((ia->ia6_flags & IN6_IFF_AUTOCONF) != 0 && + pr->ndpr_refcnt == 1) || + ((ia->ia6_flags & IN6_IFF_AUTOCONF) == 0 && + pr->ndpr_refcnt == 0))) + purgeprefix = 1; + + purgeaddr: + in6_purgeaddr(&ia->ia_ifa); + if (pr && purgeprefix) + prelist_remove(pr); + break; + } + + default: + if (ifp == NULL || ifp->if_ioctl == 0) + return(EOPNOTSUPP); + return((*ifp->if_ioctl)(ifp, cmd, data)); + } + + return(0); +} + +/* + * Update parameters of an IPv6 interface address. + * If necessary, a new entry is created and linked into address chains. + * This function is separated from in6_control(). + * XXX: should this be performed under splnet()? + */ +static int +_in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, + struct in6_ifaddr *ia) +{ + int error = 0, hostIsNew = 0, plen = -1; + struct in6_ifaddr *oia; +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + struct ifaddr *ifa; +#endif + struct sockaddr_in6 dst6; + struct in6_addrlifetime *lt; + struct in6_multi_mship *imm; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + time_t time_second = (time_t)time.tv_sec; +#endif +#ifdef MEASURE_PERFORMANCE + int new_ifa = 0; +#endif + struct rtentry *rt; + + /* Validate parameters */ + if (ifp == NULL || ifra == NULL) /* this maybe redundant */ + return(EINVAL); + + /* + * The destination address for a p2p link must have a family + * of AF_UNSPEC or AF_INET6. + */ + if ((ifp->if_flags & IFF_POINTOPOINT) != 0 && + ifra->ifra_dstaddr.sin6_family != AF_INET6 && + ifra->ifra_dstaddr.sin6_family != AF_UNSPEC) + return(EAFNOSUPPORT); + /* + * validate ifra_prefixmask. don't check sin6_family, netmask + * does not carry fields other than sin6_len. + */ + if (ifra->ifra_prefixmask.sin6_len > sizeof(struct sockaddr_in6)) + return(EINVAL); + /* + * Because the IPv6 address architecture is classless, we require + * users to specify a (non 0) prefix length (mask) for a new address. + * We also require the prefix (when specified) mask is valid, and thus + * reject a non-consecutive mask. + */ + if (ia == NULL && ifra->ifra_prefixmask.sin6_len == 0) + return(EINVAL); + if (ifra->ifra_prefixmask.sin6_len != 0) { + plen = in6_mask2len(&ifra->ifra_prefixmask.sin6_addr, + (u_char *)&ifra->ifra_prefixmask + + ifra->ifra_prefixmask.sin6_len); + if (plen <= 0) + return(EINVAL); + } + else { + /* + * In this case, ia must not be NULL. We just use its prefix + * length. + */ + plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); + } + /* + * If the destination address on a p2p interface is specified, + * and the address is a scoped one, validate/set the scope + * zone identifier. + */ + dst6 = ifra->ifra_dstaddr; + if ((ifp->if_flags & (IFF_POINTOPOINT|IFF_LOOPBACK)) && + (dst6.sin6_family == AF_INET6)) { + int64_t zoneid; + +#ifndef SCOPEDROUTING + if ((error = in6_recoverscope(&dst6, + &ifra->ifra_dstaddr.sin6_addr, + ifp)) != 0) + return(error); +#endif + if ((zoneid = in6_addr2zoneid(ifp, &dst6.sin6_addr)) < 0) + return(EINVAL); + if (dst6.sin6_scope_id == 0) /* user omit to specify the ID. */ + dst6.sin6_scope_id = zoneid; + else if (dst6.sin6_scope_id != zoneid) + return(EINVAL); /* scope ID mismatch. */ + if ((error = in6_embedscope(&dst6.sin6_addr, &dst6)) != 0) + return(error); +#ifndef SCOPEDROUTING + dst6.sin6_scope_id = 0; /* XXX */ +#endif + } + /* + * The destination address can be specified only for a p2p or a + * loopback interface. If specified, the corresponding prefix length + * must be 128. + */ + if (ifra->ifra_dstaddr.sin6_family == AF_INET6) { +#ifdef FORCE_P2PPLEN + int i; +#endif + + if ((ifp->if_flags & (IFF_POINTOPOINT|IFF_LOOPBACK)) == 0) { + /* XXX: noisy message */ + log(LOG_INFO, "in6_update_ifa: a destination can be " + "specified for a p2p or a loopback IF only\n"); + return(EINVAL); + } + if (plen != 128) { + log(LOG_INFO, "in6_update_ifa: prefixlen should be " + "128 when dstaddr is specified\n"); +#ifdef FORCE_P2PPLEN + /* + * To be compatible with old configurations, + * such as ifconfig gif0 inet6 2001::1 2001::2 + * prefixlen 126, we override the specified + * prefixmask as if the prefix length was 128. + */ + ifra->ifra_prefixmask.sin6_len + = sizeof(struct sockaddr_in6); + for (i = 0; i < 4; i++) + ifra->ifra_prefixmask.sin6_addr.s6_addr32[i] = + 0xffffffff; + plen = 128; +#else + return(EINVAL); +#endif + } + } + /* lifetime consistency check */ + lt = &ifra->ifra_lifetime; + if (lt->ia6t_pltime > lt->ia6t_vltime) + return(EINVAL); + if (lt->ia6t_vltime == 0) { + /* + * the following log might be noisy, but this is a typical + * configuration mistake or a tool's bug. + */ + log(LOG_INFO, + "in6_update_ifa: valid lifetime is 0 for %s\n", + ip6_sprintf(&ifra->ifra_addr.sin6_addr)); + + if (ia == NULL) + return(0); /* there's nothing to do */ + } + + /* + * If this is a new address, allocate a new ifaddr and link it + * into chains. + */ + if (ia == NULL) { + hostIsNew = 1; + /* + * When in6_update_ifa() is called in a process of a received + * RA, it is called under an interrupt context. So, we should + * call malloc with M_NOWAIT. + */ + ia = (struct in6_ifaddr *) + malloc(sizeof(*ia), M_IFADDR, M_NOWAIT); + if (ia == NULL) + return (ENOBUFS); + bzero((caddr_t)ia, sizeof(*ia)); + LIST_INIT(&ia->ia6_memberships); + /* Initialize the address and masks, and put time stamp */ + ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr; + ia->ia_addr.sin6_family = AF_INET6; + ia->ia_addr.sin6_len = sizeof(ia->ia_addr); + ia->ia6_createtime = ia->ia6_updatetime = time_second; + if ((ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) != 0) { + /* + * XXX: some functions expect that ifa_dstaddr is not + * NULL for p2p interfaces. + */ + ia->ia_ifa.ifa_dstaddr + = (struct sockaddr *)&ia->ia_dstaddr; + } else { + ia->ia_ifa.ifa_dstaddr = NULL; + } + ia->ia_ifa.ifa_netmask + = (struct sockaddr *)&ia->ia_prefixmask; + + ia->ia_ifp = ifp; + if ((oia = in6_ifaddr) != NULL) { + for ( ; oia->ia_next; oia = oia->ia_next) + continue; + oia->ia_next = ia; + } else + in6_ifaddr = ia; +#ifdef __NetBSD__ + /* gain a refcnt for the link from in6_ifaddr */ + IFAREF(&ia->ia_ifa); +#endif + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + if ((ifa = ifp->if_addrlist) != NULL) { + for ( ; ifa->ifa_next; ifa = ifa->ifa_next) + continue; + ifa->ifa_next = ia62ifa(ia); + } else + ifp->if_addrlist = ia62ifa(ia); +#else + TAILQ_INSERT_TAIL(&ifp->if_addrlist, &ia->ia_ifa, + ifa_list); + log_(LOG_ADDR) { + diag_printf("%s.%d - After inserting %p into list %p\n", + __FUNCTION__, __LINE__, + &ia->ia_ifa, &ifp->if_addrlist); + _show_ifp(ifp); + } +#endif +#ifdef __NetBSD__ + /* gain another refcnt for the link from if_addrlist */ + IFAREF(&ia->ia_ifa); +#endif + +#ifdef MEASURE_PERFORMANCE + new_ifa = 1; +#endif + } + + /* set prefix mask */ + if (ifra->ifra_prefixmask.sin6_len) { + /* + * We prohibit changing the prefix length of an existing + * address, because + * + such an operation should be rare in IPv6, and + * + the operation would confuse prefix management. + */ + if (ia->ia_prefixmask.sin6_len && + in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL) != plen) { + log(LOG_INFO, "in6_update_ifa: the prefix length of an" + " existing (%s) address should not be changed\n", + ip6_sprintf(&ia->ia_addr.sin6_addr)); + error = EINVAL; + goto unlink; + } + ia->ia_prefixmask = ifra->ifra_prefixmask; + } + + /* + * If a new destination address is specified, scrub the old one and + * install the new destination. Note that the interface must be + * p2p or loopback (see the check above.) + */ + if (dst6.sin6_family == AF_INET6 && + !IN6_ARE_ADDR_EQUAL(&dst6.sin6_addr, + &ia->ia_dstaddr.sin6_addr)) { + int e; + + if ((ia->ia_flags & IFA_ROUTE) != 0 && + (e = rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST)) + != 0) { + log(LOG_ERR, "in6_update_ifa: failed to remove " + "a route to the old destination: %s\n", + ip6_sprintf(&ia->ia_addr.sin6_addr)); + /* proceed anyway... */ + } + else + ia->ia_flags &= ~IFA_ROUTE; + ia->ia_dstaddr = dst6; + } + + /* + * Set lifetimes. We do not refer to ia6t_expire and ia6t_preferred + * to see if the address is deprecated or invalidated, but initialize + * these members for applications. + */ + ia->ia6_lifetime = ifra->ifra_lifetime; + if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { + ia->ia6_lifetime.ia6t_expire = + time_second + ia->ia6_lifetime.ia6t_vltime; + } else + ia->ia6_lifetime.ia6t_expire = 0; + if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { + ia->ia6_lifetime.ia6t_preferred = + time_second + ia->ia6_lifetime.ia6t_pltime; + } else + ia->ia6_lifetime.ia6t_preferred = 0; + + /* reset the interface and routing table appropriately. */ + if ((error = in6_ifinit(ifp, ia, &ifra->ifra_addr, hostIsNew)) != 0) + goto unlink; + + /* + * Make the address tentative before joining multicast addresses, + * so that corresponding MLD responses would not have a tentative + * source address. + */ + ia->ia6_flags = ifra->ifra_flags; + ia->ia6_flags &= ~IN6_IFF_DUPLICATED; /* safety */ +#ifdef MIP6 + if (hostIsNew && in6if_do_dad(ifp) && mip6_ifa_need_dad(ia)) +#else /* MIP6 */ + if (hostIsNew && in6if_do_dad(ifp)) +#endif /* MIP6 */ + ia->ia6_flags |= IN6_IFF_TENTATIVE; + + /* + * Beyond this point, we should call in6_purgeaddr upon an error, + * not just go to unlink. + */ + + if ((ifp->if_flags & IFF_MULTICAST) != 0) { + struct sockaddr_in6 mltaddr, mltmask; + + if (hostIsNew) { + /* + * join solicited multicast addr for new host id + */ + struct in6_addr llsol; + bzero(&llsol, sizeof(struct in6_addr)); + llsol.s6_addr16[0] = htons(0xff02); + llsol.s6_addr16[1] = htons(ifp->if_index); + llsol.s6_addr32[1] = 0; + llsol.s6_addr32[2] = htonl(1); + llsol.s6_addr32[3] = + ifra->ifra_addr.sin6_addr.s6_addr32[3]; + llsol.s6_addr8[12] = 0xff; + imm = in6_joingroup(ifp, &llsol, &error); + if (imm) { + LIST_INSERT_HEAD(&ia->ia6_memberships, imm, + i6mm_chain); + } else { + log(LOG_ERR, + "in6_update_ifa: addmulti failed for " + "%s on %s (errno=%d)\n", + ip6_sprintf(&llsol), + if_name(ifp), error); + goto cleanup; + } + } + + bzero(&mltmask, sizeof(mltmask)); + mltmask.sin6_len = sizeof(struct sockaddr_in6); + mltmask.sin6_family = AF_INET6; + mltmask.sin6_addr = in6mask32; + + /* + * join link-local all-nodes address + */ + bzero(&mltaddr, sizeof(mltaddr)); + mltaddr.sin6_len = sizeof(struct sockaddr_in6); + mltaddr.sin6_family = AF_INET6; + mltaddr.sin6_addr = in6addr_linklocal_allnodes; + mltaddr.sin6_addr.s6_addr16[1] = htons(ifp->if_index); + +#ifdef __FreeBSD__ + rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL); +#else + rt = rtalloc1((struct sockaddr *)&mltaddr, 0); +#endif + if (rt) { + /* 32bit came from "mltmask" */ + if (memcmp(&mltaddr.sin6_addr, + &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, + 32 / 8)) { + RTFREE(rt); + rt = NULL; + } + } + if (!rt) { +#if (defined(__bsdi__) && _BSDI_VERSION >= 199802) + struct rt_addrinfo info; + + bzero(&info, sizeof(info)); + info.rti_info[RTAX_DST] = (struct sockaddr *)&mltaddr; + info.rti_info[RTAX_GATEWAY] = + (struct sockaddr *)&ia->ia_addr; + info.rti_info[RTAX_NETMASK] = + (struct sockaddr *)&mltmask; + info.rti_info[RTAX_IFA] = + (struct sockaddr *)&ia->ia_addr; + /* XXX: we need RTF_CLONING to fake nd6_rtrequest */ + info.rti_flags = RTF_UP | RTF_CLONING; + error = rtrequest1(RTM_ADD, &info, NULL); +#else + error = rtrequest(RTM_ADD, + (struct sockaddr *)&mltaddr, + (struct sockaddr *)&ia->ia_addr, + (struct sockaddr *)&mltmask, + RTF_UP | RTF_CLONING, + (struct rtentry **)0); +#endif + if (error) + goto cleanup; + } else { + RTFREE(rt); + } + imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error); + if (imm) { + LIST_INSERT_HEAD(&ia->ia6_memberships, imm, + i6mm_chain); + } else { + log(LOG_WARNING, + "in6_update_ifa: addmulti failed for " + "%s on %s (errno=%d)\n", + ip6_sprintf(&mltaddr.sin6_addr), + if_name(ifp), error); + goto cleanup; + } + + /* + * join node information group address + */ +#ifdef __FreeBSD__ +#define hostnamelen strlen(hostname) +#endif + if (in6_nigroup(ifp, hostname, hostnamelen, &mltaddr.sin6_addr) + == 0) { + imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error); + if (imm) { + LIST_INSERT_HEAD(&ia->ia6_memberships, imm, + i6mm_chain); + } else { + log(LOG_WARNING, "in6_update_ifa: " + "addmulti failed for " + "%s on %s (errno=%d)\n", + ip6_sprintf(&mltaddr.sin6_addr), + if_name(ifp), error); + /* XXX not very fatal, go on... */ + } + } +#ifdef __FreeBSD__ +#undef hostnamelen +#endif + + /* + * join interface-local all-nodes address, on loopback. + * (ff01::1%ifN, and ff01::%ifN/32) + */ + mltaddr.sin6_addr = in6addr_nodelocal_allnodes; + mltaddr.sin6_addr.s6_addr16[1] = htons(ifp->if_index); +#ifdef __FreeBSD__ + rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL); +#else + rt = rtalloc1((struct sockaddr *)&mltaddr, 0); +#endif + if (rt) { + /* 32bit came from "mltmask" */ + if (memcmp(&mltaddr.sin6_addr, + &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, + 32 / 8)) { + RTFREE(rt); + rt = NULL; + } + } + if (!rt) { +#if (defined(__bsdi__) && _BSDI_VERSION >= 199802) + struct rt_addrinfo info; + + bzero(&info, sizeof(info)); + info.rti_info[RTAX_DST] = (struct sockaddr *)&mltaddr; + info.rti_info[RTAX_GATEWAY] = + (struct sockaddr *)&ia->ia_addr; + info.rti_info[RTAX_NETMASK] = + (struct sockaddr *)&mltmask; + info.rti_info[RTAX_IFA] = + (struct sockaddr *)&ia->ia_addr; + info.rti_flags = RTF_UP | RTF_CLONING; + error = rtrequest1(RTM_ADD, &info, NULL); +#else + error = rtrequest(RTM_ADD, + (struct sockaddr *)&mltaddr, + (struct sockaddr *)&ia->ia_addr, + (struct sockaddr *)&mltmask, + RTF_UP | RTF_CLONING, + (struct rtentry **)0); +#endif + if (error) + goto cleanup; + } else { + RTFREE(rt); + } + + imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error); + if (imm) { + LIST_INSERT_HEAD(&ia->ia6_memberships, imm, + i6mm_chain); + } else { + log(LOG_WARNING, "in6_update_ifa: " + "addmulti failed for %s on %s " + "(errno=%d)\n", + ip6_sprintf(&mltaddr.sin6_addr), + if_name(ifp), error); + goto cleanup; + } + } + +#ifdef MEASURE_PERFORMANCE + { + int s = splnet(); + if (new_ifa) + in6h_addifa(ia); + else + in6h_rebuild(0); + splx(s); + } +#endif + + /* + * make sure to initialize ND6 information. this is to workaround + * issues with interfaces with IPv6 addresses, which have never brought + * up. We are assuming that it is safe to nd6_ifattach multiple times. + */ + nd6_ifattach(ifp); + + /* + * Perform DAD, if needed. + * XXX It may be of use, if we can administratively + * disable DAD. + */ +#ifdef MIP6 + if (hostIsNew && in6if_do_dad(ifp) && mip6_ifa_need_dad(ia) && + (ifra->ifra_flags & IN6_IFF_NODAD) == 0) +#else /* MIP6 */ + if (hostIsNew && in6if_do_dad(ifp) && + (ifra->ifra_flags & IN6_IFF_NODAD) == 0) +#endif /* MIP6 */ + { + nd6_dad_start((struct ifaddr *)ia, NULL); + } + + return(error); + + unlink: + /* + * XXX: if a change of an existing address failed, keep the entry + * anyway. + */ + if (hostIsNew) + in6_unlink_ifa(ia, ifp); + return(error); + + cleanup: + in6_purgeaddr(&ia->ia_ifa); + return error; +} + +void +in6_purgeaddr(ifa) + struct ifaddr *ifa; +{ + struct ifnet *ifp = ifa->ifa_ifp; + struct in6_ifaddr *ia = (struct in6_ifaddr *) ifa; + struct in6_multi_mship *imm; + + /* stop DAD processing */ + nd6_dad_stop(ifa); + + /* + * delete route to the destination of the address being purged. + * The interface must be p2p or loopback in this case. + */ + if ((ia->ia_flags & IFA_ROUTE) != 0 && ia->ia_dstaddr.sin6_len != 0) { + int e; + + if ((e = rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST)) + != 0) { + log(LOG_ERR, "in6_purgeaddr: failed to remove " + "a route to the p2p destination: %s on %s, " + "errno=%d\n", + ip6_sprintf(&ia->ia_addr.sin6_addr), if_name(ifp), + e); + /* proceed anyway... */ + } + else + ia->ia_flags &= ~IFA_ROUTE; + } + + /* Remove ownaddr's loopback rtentry, if it exists. */ + in6_ifremloop(&(ia->ia_ifa)); + + /* + * leave from multicast groups we have joined for the interface + */ + while ((imm = ia->ia6_memberships.lh_first) != NULL) { + LIST_REMOVE(imm, i6mm_chain); + in6_leavegroup(imm); + } + + in6_unlink_ifa(ia, ifp); +} + +int +in6_update_ifa(ifp, ifra, ia) + struct ifnet *ifp; + struct in6_aliasreq *ifra; + struct in6_ifaddr *ia; +{ + int res; + int s = splnet(); +// extern int irq_level; +// if (irq_level) { +// diag_printf("%s - called from IRQ!\n", __FUNCTION__); +// } + res = _in6_update_ifa(ifp, ifra, ia); + splx(s); + return res; +} + +static void +in6_unlink_ifa(ia, ifp) + struct in6_ifaddr *ia; + struct ifnet *ifp; +{ + struct in6_ifaddr *oia; +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + struct ifaddr *ifa; +#endif + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + if ((ifa = ifp->if_addrlist) == ia62ifa(ia)) + ifp->if_addrlist = ifa->ifa_next; + else { + while (ifa->ifa_next && + (ifa->ifa_next != ia62ifa(ia))) + ifa = ifa->ifa_next; + if (ifa->ifa_next) + ifa->ifa_next = ia62ifa(ia)->ifa_next; + else { + /* search failed */ + printf("Couldn't unlink in6_ifaddr from ifp\n"); + } + } +#else + TAILQ_REMOVE(&ifp->if_addrlist, &ia->ia_ifa, ifa_list); + log_(LOG_ADDR) { + diag_printf("%s.%d - After removing %p into list %p\n", + __FUNCTION__, __LINE__, + &ia->ia_ifa, &ifp->if_addrlist); + _show_ifp(ifp); + } +#endif +#ifdef __NetBSD__ + /* release a refcnt for the link from if_addrlist */ + IFAFREE(&ia->ia_ifa); +#endif + + oia = ia; + if (oia == (ia = in6_ifaddr)) + in6_ifaddr = ia->ia_next; + else { + while (ia->ia_next && (ia->ia_next != oia)) + ia = ia->ia_next; + if (ia->ia_next) + ia->ia_next = oia->ia_next; + else { + /* search failed */ + printf("Couldn't unlink in6_ifaddr from in6_ifaddr\n"); + } + } + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + if (oia->ia6_multiaddrs.lh_first != NULL) { +#ifdef __NetBSD__ + /* + * XXX thorpej@netbsd.org -- if the interface is going + * XXX away, don't save the multicast entries, delete them! + */ + if (oia->ia_ifa.ifa_ifp->if_output == if_nulloutput) { + struct in6_multi *in6m; + + while ((in6m = + LIST_FIRST(&oia->ia6_multiaddrs)) != NULL) + in6_delmulti(in6m); + } else + in6_savemkludge(oia); +#else + in6_savemkludge(oia); +#endif + } +#endif + +#ifdef MEASURE_PERFORMANCE + in6h_delifa(oia); +#endif + + /* + * When an autoconfigured address is being removed, release the + * reference to the base prefix. Also, since the release might + * affect the status of other (detached) addresses, call + * pfxlist_onlink_check(). + */ + if ((oia->ia6_flags & IN6_IFF_AUTOCONF) != 0) { + if (oia->ia6_ndpr == NULL) { + log(LOG_NOTICE, "in6_unlink_ifa: autoconf'ed address " + "%p has no prefix\n", oia); + } else { + oia->ia6_ndpr->ndpr_refcnt--; + oia->ia6_flags &= ~IN6_IFF_AUTOCONF; + oia->ia6_ndpr = NULL; + } + + pfxlist_onlink_check(); + } + + /* + * release another refcnt for the link from in6_ifaddr. + * Note that we should decrement the refcnt at least once for all *BSD. + */ + IFAFREE(&oia->ia_ifa); + + splx(s); +} + +void +in6_purgeif(ifp) + struct ifnet *ifp; +{ + struct ifaddr *ifa, *nifa; + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = nifa) +#else + for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa != NULL; ifa = nifa) +#endif + { +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + nifa = ifa->ifa_next; +#else + nifa = TAILQ_NEXT(ifa, ifa_list); +#endif + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + in6_purgeaddr(ifa); + } + +#if !(defined(__bsdi__) && _BSDI_VERSION >= 199802) + in6_ifdetach(ifp); +#endif +} + +/* + * SIOC[GAD]LIFADDR. + * SIOCGLIFADDR: get first address. (?) + * SIOCGLIFADDR with IFLR_PREFIX: + * get first address that matches the specified prefix. + * SIOCALIFADDR: add the specified address. + * SIOCALIFADDR with IFLR_PREFIX: + * add the specified prefix, filling hostid part from + * the first link-local address. prefixlen must be <= 64. + * SIOCDLIFADDR: delete the specified address. + * SIOCDLIFADDR with IFLR_PREFIX: + * delete the first address that matches the specified prefix. + * return values: + * EINVAL on invalid parameters + * EADDRNOTAVAIL on prefix match failed/specified address not found + * other values may be returned from in6_ioctl() + * + * NOTE: SIOCALIFADDR(with IFLR_PREFIX set) allows prefixlen less than 64. + * this is to accomodate address naming scheme other than RFC2374, + * in the future. + * RFC2373 defines interface id to be 64bit, but it allows non-RFC2374 + * address encoding scheme. (see figure on page 8) + */ +static int +#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3) +in6_lifaddr_ioctl(so, cmd, data, ifp, p) + struct socket *so; + u_long cmd; + caddr_t data; + struct ifnet *ifp; + struct proc *p; +#else +in6_lifaddr_ioctl(so, cmd, data, ifp) + struct socket *so; + u_long cmd; + caddr_t data; + struct ifnet *ifp; +#endif +{ + struct if_laddrreq *iflr = (struct if_laddrreq *)data; + struct ifaddr *ifa; + struct sockaddr *sa; + int64_t zoneid; + + /* sanity checks */ + if (!data || !ifp) { + panic("invalid argument to in6_lifaddr_ioctl"); + /* NOTREACHED */ + } + + switch (cmd) { + case SIOCGLIFADDR: + /* address must be specified on GET with IFLR_PREFIX */ + if ((iflr->flags & IFLR_PREFIX) == 0) + break; + /* FALLTHROUGH */ + case SIOCALIFADDR: + case SIOCDLIFADDR: + /* address must be specified on ADD and DELETE */ + sa = (struct sockaddr *)&iflr->addr; + if (sa->sa_family != AF_INET6) + return EINVAL; + if (sa->sa_len != sizeof(struct sockaddr_in6)) + return EINVAL; + /* XXX need improvement */ + sa = (struct sockaddr *)&iflr->dstaddr; + if (sa->sa_family && sa->sa_family != AF_INET6) + return EINVAL; + if (sa->sa_len && sa->sa_len != sizeof(struct sockaddr_in6)) + return EINVAL; + break; + default: /* shouldn't happen */ +#if 0 + panic("invalid cmd to in6_lifaddr_ioctl"); + /* NOTREACHED */ +#else + return EOPNOTSUPP; +#endif + } + if (sizeof(struct in6_addr) * 8 < iflr->prefixlen) + return EINVAL; + + switch (cmd) { + case SIOCALIFADDR: + { + struct in6_aliasreq ifra; + struct in6_addr *hostid = NULL; + int prefixlen; + + if ((iflr->flags & IFLR_PREFIX) != 0) { + struct sockaddr_in6 *sin6; + + /* + * hostid is to fill in the hostid part of the + * address. hostid points to the first link-local + * address attached to the interface. + */ + ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, 0); + if (!ifa) + return EADDRNOTAVAIL; + hostid = IFA_IN6(ifa); + + /* prefixlen must be <= 64. */ + if (64 < iflr->prefixlen) + return EINVAL; + prefixlen = iflr->prefixlen; + + /* hostid part must be zero. */ + sin6 = (struct sockaddr_in6 *)&iflr->addr; + if (sin6->sin6_addr.s6_addr32[2] != 0 + || sin6->sin6_addr.s6_addr32[3] != 0) { + return EINVAL; + } + } else + prefixlen = iflr->prefixlen; + + /* copy args to in6_aliasreq, perform ioctl(SIOCAIFADDR_IN6). */ + bzero(&ifra, sizeof(ifra)); + bcopy(iflr->iflr_name, ifra.ifra_name, + sizeof(ifra.ifra_name)); + + bcopy(&iflr->addr, &ifra.ifra_addr, + ((struct sockaddr *)&iflr->addr)->sa_len); + if (hostid) { + /* fill in hostid part */ + ifra.ifra_addr.sin6_addr.s6_addr32[2] = + hostid->s6_addr32[2]; + ifra.ifra_addr.sin6_addr.s6_addr32[3] = + hostid->s6_addr32[3]; + } + + if (((struct sockaddr *)&iflr->dstaddr)->sa_family) { /* XXX */ + bcopy(&iflr->dstaddr, &ifra.ifra_dstaddr, + ((struct sockaddr *)&iflr->dstaddr)->sa_len); + if (hostid) { + ifra.ifra_dstaddr.sin6_addr.s6_addr32[2] = + hostid->s6_addr32[2]; + ifra.ifra_dstaddr.sin6_addr.s6_addr32[3] = + hostid->s6_addr32[3]; + } + } + + ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); + in6_prefixlen2mask(&ifra.ifra_prefixmask.sin6_addr, prefixlen); + + ifra.ifra_flags = iflr->flags & ~IFLR_PREFIX; +#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3) + return in6_control(so, SIOCAIFADDR_IN6, (caddr_t)&ifra, ifp, p); +#else + return in6_control(so, SIOCAIFADDR_IN6, (caddr_t)&ifra, ifp); +#endif + } + case SIOCGLIFADDR: + case SIOCDLIFADDR: + { + struct in6_ifaddr *ia; + struct in6_addr mask, candidate, match; + struct sockaddr_in6 *sin6; + int cmp; + + bzero(&mask, sizeof(mask)); + if (iflr->flags & IFLR_PREFIX) { + /* lookup a prefix rather than address. */ + in6_prefixlen2mask(&mask, iflr->prefixlen); + + sin6 = (struct sockaddr_in6 *)&iflr->addr; + bcopy(&sin6->sin6_addr, &match, sizeof(match)); + match.s6_addr32[0] &= mask.s6_addr32[0]; + match.s6_addr32[1] &= mask.s6_addr32[1]; + match.s6_addr32[2] &= mask.s6_addr32[2]; + match.s6_addr32[3] &= mask.s6_addr32[3]; + + /* if you set extra bits, that's wrong */ + if (bcmp(&match, &sin6->sin6_addr, sizeof(match))) + return EINVAL; + + cmp = 1; + } else { + if (cmd == SIOCGLIFADDR) { + /* on getting an address, take the 1st match */ + cmp = 0; /* XXX */ + } else { + /* on deleting an address, do exact match */ + in6_prefixlen2mask(&mask, 128); + sin6 = (struct sockaddr_in6 *)&iflr->addr; + bcopy(&sin6->sin6_addr, &match, sizeof(match)); + + cmp = 1; + } + } + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; + ifa; + ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + if (!cmp) + break; + + bcopy(IFA_IN6(ifa), &candidate, sizeof(candidate)); +#ifndef SCOPEDROUTING + /* + * XXX: this is adhoc, but is necessary to allow + * a user to specify fe80::/64 (not /10) for a + * link-local address. + */ + if (IN6_IS_ADDR_LINKLOCAL(&candidate)) + candidate.s6_addr16[1] = 0; +#endif + candidate.s6_addr32[0] &= mask.s6_addr32[0]; + candidate.s6_addr32[1] &= mask.s6_addr32[1]; + candidate.s6_addr32[2] &= mask.s6_addr32[2]; + candidate.s6_addr32[3] &= mask.s6_addr32[3]; + if (IN6_ARE_ADDR_EQUAL(&candidate, &match)) + break; + } + if (!ifa) + return EADDRNOTAVAIL; + ia = ifa2ia6(ifa); + + if (cmd == SIOCGLIFADDR) { +#ifndef SCOPEDROUTING + struct sockaddr_in6 *s6; +#endif + + /* fill in the if_laddrreq structure */ + bcopy(&ia->ia_addr, &iflr->addr, ia->ia_addr.sin6_len); +#ifndef SCOPEDROUTING /* XXX see above */ + s6 = (struct sockaddr_in6 *)&iflr->addr; + if (IN6_IS_ADDR_LINKLOCAL(&s6->sin6_addr)) { + s6->sin6_addr.s6_addr16[1] = 0; + zoneid = in6_addr2zoneid(ifp, &s6->sin6_addr); + if (zoneid < 0) /* XXX: should not happen */ + return(EINVAL); + s6->sin6_scope_id = zoneid; + } +#endif + if ((ifp->if_flags & IFF_POINTOPOINT) != 0) { + bcopy(&ia->ia_dstaddr, &iflr->dstaddr, + ia->ia_dstaddr.sin6_len); +#ifndef SCOPEDROUTING /* XXX see above */ + s6 = (struct sockaddr_in6 *)&iflr->dstaddr; + if (IN6_IS_ADDR_LINKLOCAL(&s6->sin6_addr)) { + s6->sin6_addr.s6_addr16[1] = 0; + zoneid = in6_addr2zoneid(ifp, + &s6->sin6_addr); + if (zoneid < 0) /* XXX */ + return(EINVAL); + s6->sin6_scope_id = zoneid; + } +#endif + } else + bzero(&iflr->dstaddr, sizeof(iflr->dstaddr)); + + iflr->prefixlen = + in6_mask2len(&ia->ia_prefixmask.sin6_addr, + NULL); + + iflr->flags = ia->ia6_flags; /* XXX */ + + return 0; + } else { + struct in6_aliasreq ifra; + + /* fill in6_aliasreq and do ioctl(SIOCDIFADDR_IN6) */ + bzero(&ifra, sizeof(ifra)); + bcopy(iflr->iflr_name, ifra.ifra_name, + sizeof(ifra.ifra_name)); + + bcopy(&ia->ia_addr, &ifra.ifra_addr, + ia->ia_addr.sin6_len); + if ((ifp->if_flags & IFF_POINTOPOINT) != 0) { + bcopy(&ia->ia_dstaddr, &ifra.ifra_dstaddr, + ia->ia_dstaddr.sin6_len); + } else { + bzero(&ifra.ifra_dstaddr, + sizeof(ifra.ifra_dstaddr)); + } + bcopy(&ia->ia_prefixmask, &ifra.ifra_dstaddr, + ia->ia_prefixmask.sin6_len); + + ifra.ifra_flags = ia->ia6_flags; +#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3) + return in6_control(so, SIOCDIFADDR_IN6, (caddr_t)&ifra, + ifp, p); +#else + return in6_control(so, SIOCDIFADDR_IN6, (caddr_t)&ifra, + ifp); +#endif + } + } + } + + return EOPNOTSUPP; /* just for safety */ +} + +/* + * Initialize an interface's intetnet6 address + * and routing table entry. + */ +static int +in6_ifinit(ifp, ia, sin6, newhost) + struct ifnet *ifp; + struct in6_ifaddr *ia; + struct sockaddr_in6 *sin6; + int newhost; +{ + int error = 0, plen, ifacount = 0; + int s = splimp(); + struct ifaddr *ifa; + + /* + * Give the interface a chance to initialize + * if this is its first address, + * and to validate the address if necessary. + */ +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; + ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr == NULL) + continue; /* just for safety */ + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + ifacount++; + } + + ia->ia_addr = *sin6; + + if (ifacount <= 1 && ifp->if_ioctl && + (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia))) { + splx(s); + return(error); + } + splx(s); + + ia->ia_ifa.ifa_metric = ifp->if_metric; + + /* we could do in(6)_socktrim here, but just omit it at this moment. */ + + /* + * Special case: + * If the destination address is specified for a point-to-point + * interface, install a route to the destination as an interface + * direct route. + */ + plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ + if (plen == 128 && ia->ia_dstaddr.sin6_family == AF_INET6) { + if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, + RTF_UP | RTF_HOST)) != 0) + return(error); + ia->ia_flags |= IFA_ROUTE; + } + if (plen < 128) { + /* + * The RTF_CLONING flag is necessary for in6_is_ifloop_auto(). + */ + ia->ia_ifa.ifa_flags |= RTF_CLONING; + } + + /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */ + if (newhost) { + /* set the rtrequest function to create llinfo */ + ia->ia_ifa.ifa_rtrequest = nd6_rtrequest; + in6_ifaddloop(&(ia->ia_ifa)); + } + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + if (ifp->if_flags & IFF_MULTICAST) + in6_restoremkludge(ia, ifp); +#endif + + return(error); +} + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) +/* + * Multicast address kludge: + * If there were any multicast addresses attached to this interface address, + * either move them to another address on this interface, or save them until + * such time as this interface is reconfigured for IPv6. + */ +void +in6_savemkludge(oia) + struct in6_ifaddr *oia; +{ + struct in6_ifaddr *ia; + struct in6_multi *in6m, *next; + + IFP_TO_IA6(oia->ia_ifp, ia); + if (ia) { /* there is another address */ + for (in6m = oia->ia6_multiaddrs.lh_first; in6m; in6m = next){ + next = in6m->in6m_entry.le_next; + IFAFREE(&in6m->in6m_ia->ia_ifa); + IFAREF(&ia->ia_ifa); + in6m->in6m_ia = ia; + LIST_INSERT_HEAD(&ia->ia6_multiaddrs, in6m, in6m_entry); + } + } else { /* last address on this if deleted, save */ + struct multi6_kludge *mk; + + for (mk = in6_mk.lh_first; mk; mk = mk->mk_entry.le_next) { + if (mk->mk_ifp == oia->ia_ifp) + break; + } + if (mk == NULL) /* this should not happen! */ + panic("in6_savemkludge: no kludge space"); + + for (in6m = oia->ia6_multiaddrs.lh_first; in6m; in6m = next){ + next = in6m->in6m_entry.le_next; + IFAFREE(&in6m->in6m_ia->ia_ifa); /* release reference */ + in6m->in6m_ia = NULL; + LIST_INSERT_HEAD(&mk->mk_head, in6m, in6m_entry); + } + } +} + +/* + * Continuation of multicast address hack: + * If there was a multicast group list previously saved for this interface, + * then we re-attach it to the first address configured on the i/f. + */ +void +in6_restoremkludge(ia, ifp) + struct in6_ifaddr *ia; + struct ifnet *ifp; +{ + struct multi6_kludge *mk; + + for (mk = in6_mk.lh_first; mk; mk = mk->mk_entry.le_next) { + if (mk->mk_ifp == ifp) { + struct in6_multi *in6m, *next; + + for (in6m = mk->mk_head.lh_first; in6m; in6m = next) { + next = in6m->in6m_entry.le_next; + in6m->in6m_ia = ia; + IFAREF(&ia->ia_ifa); + LIST_INSERT_HEAD(&ia->ia6_multiaddrs, + in6m, in6m_entry); + } + LIST_INIT(&mk->mk_head); + break; + } + } +} + +/* + * Allocate space for the kludge at interface initialization time. + * Formerly, we dynamically allocated the space in in6_savemkludge() with + * malloc(M_WAITOK). However, it was wrong since the function could be called + * under an interrupt context (software timer on address lifetime expiration). + * Also, we cannot just give up allocating the strucutre, since the group + * membership structure is very complex and we need to keep it anyway. + * Of course, this function MUST NOT be called under an interrupt context. + * Specifically, it is expected to be called only from in6_ifattach(), though + * it is a global function. + */ +void +in6_createmkludge(ifp) + struct ifnet *ifp; +{ + struct multi6_kludge *mk; + + for (mk = in6_mk.lh_first; mk; mk = mk->mk_entry.le_next) { + /* If we've already had one, do not allocate. */ + if (mk->mk_ifp == ifp) + return; + } + + mk = malloc(sizeof(*mk), M_IPMADDR, M_WAITOK); + + bzero(mk, sizeof(*mk)); + LIST_INIT(&mk->mk_head); + mk->mk_ifp = ifp; + LIST_INSERT_HEAD(&in6_mk, mk, mk_entry); +} + +void +in6_purgemkludge(ifp) + struct ifnet *ifp; +{ + struct multi6_kludge *mk; + struct in6_multi *in6m; + + for (mk = in6_mk.lh_first; mk; mk = mk->mk_entry.le_next) { + if (mk->mk_ifp != ifp) + continue; + + /* leave from all multicast groups joined */ + while ((in6m = LIST_FIRST(&mk->mk_head)) != NULL) + in6_delmulti(in6m); + LIST_REMOVE(mk, mk_entry); + free(mk, M_IPMADDR); + break; + } +} + +/* + * Add an address to the list of IP6 multicast addresses for a + * given interface. + */ +struct in6_multi * +in6_addmulti(maddr6, ifp, errorp) + struct in6_addr *maddr6; + struct ifnet *ifp; + int *errorp; +{ + struct in6_ifaddr *ia; + struct in6_ifreq ifr; + struct in6_multi *in6m; +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + + *errorp = 0; + /* + * See if address already in list. + */ + IN6_LOOKUP_MULTI(*maddr6, ifp, in6m); + if (in6m != NULL) { + /* + * Found it; just increment the refrence count. + */ + in6m->in6m_refcount++; + } else { + /* + * New address; allocate a new multicast record + * and link it into the interface's multicast list. + */ + in6m = (struct in6_multi *) + malloc(sizeof(*in6m), M_IPMADDR, M_NOWAIT); + if (in6m == NULL) { + splx(s); + *errorp = ENOBUFS; + return(NULL); + } + in6m->in6m_addr = *maddr6; + in6m->in6m_ifp = ifp; + in6m->in6m_refcount = 1; + IFP_TO_IA6(ifp, ia); + if (ia == NULL) { + free(in6m, M_IPMADDR); + splx(s); + *errorp = EADDRNOTAVAIL; /* appropriate? */ + return(NULL); + } + in6m->in6m_ia = ia; + IFAREF(&ia->ia_ifa); /* gain a reference */ + LIST_INSERT_HEAD(&ia->ia6_multiaddrs, in6m, in6m_entry); + + /* + * Ask the network driver to update its multicast reception + * filter appropriately for the new address. + */ + bzero(&ifr.ifr_addr, sizeof(struct sockaddr_in6)); + ifr.ifr_addr.sin6_len = sizeof(struct sockaddr_in6); + ifr.ifr_addr.sin6_family = AF_INET6; + ifr.ifr_addr.sin6_addr = *maddr6; + if (ifp->if_ioctl == NULL) + *errorp = ENXIO; /* XXX: appropriate? */ + else + *errorp = (*ifp->if_ioctl)(ifp, SIOCADDMULTI, + (caddr_t)&ifr); + if (*errorp) { + LIST_REMOVE(in6m, in6m_entry); + free(in6m, M_IPMADDR); + IFAFREE(&ia->ia_ifa); + splx(s); + return(NULL); + } + /* + * Let MLD6 know that we have joined a new IP6 multicast + * group. + */ + mld6_start_listening(in6m); + } + splx(s); + return(in6m); +} + +/* + * Delete a multicast address record. + */ +void +in6_delmulti(in6m) + struct in6_multi *in6m; +{ + struct in6_ifreq ifr; +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + + if (--in6m->in6m_refcount == 0) { + /* + * No remaining claims to this record; let MLD6 know + * that we are leaving the multicast group. + */ + mld6_stop_listening(in6m); + + /* + * Unlink from list. + */ + LIST_REMOVE(in6m, in6m_entry); + if (in6m->in6m_ia) { + IFAFREE(&in6m->in6m_ia->ia_ifa); /* release reference */ + } + + /* + * Notify the network driver to update its multicast + * reception filter. + */ + bzero(&ifr.ifr_addr, sizeof(struct sockaddr_in6)); + ifr.ifr_addr.sin6_len = sizeof(struct sockaddr_in6); + ifr.ifr_addr.sin6_family = AF_INET6; + ifr.ifr_addr.sin6_addr = in6m->in6m_addr; + (*in6m->in6m_ifp->if_ioctl)(in6m->in6m_ifp, + SIOCDELMULTI, (caddr_t)&ifr); + free(in6m, M_IPMADDR); + } + splx(s); +} +#else /* not FreeBSD3 */ +/* + * Add an address to the list of IP6 multicast addresses for a + * given interface. + */ +struct in6_multi * +in6_addmulti(maddr6, ifp, errorp) + struct in6_addr *maddr6; + struct ifnet *ifp; + int *errorp; +{ + struct in6_multi *in6m; + struct sockaddr_in6 sin6; + struct ifmultiaddr *ifma; + int s = splnet(); + + *errorp = 0; + + /* + * Call generic routine to add membership or increment + * refcount. It wants addresses in the form of a sockaddr, + * so we build one here (being careful to zero the unused bytes). + */ + bzero(&sin6, sizeof sin6); + sin6.sin6_family = AF_INET6; + sin6.sin6_len = sizeof sin6; + sin6.sin6_addr = *maddr6; + *errorp = if_addmulti(ifp, (struct sockaddr *)&sin6, &ifma); + if (*errorp) { + splx(s); + return 0; + } + + /* + * If ifma->ifma_protospec is null, then if_addmulti() created + * a new record. Otherwise, we are done. + */ + if (ifma->ifma_protospec != 0) + return ifma->ifma_protospec; + + /* XXX - if_addmulti uses M_WAITOK. Can this really be called + at interrupt time? If so, need to fix if_addmulti. XXX */ + in6m = (struct in6_multi *)malloc(sizeof(*in6m), M_IPMADDR, M_NOWAIT); + if (in6m == NULL) { + splx(s); + return (NULL); + } + + bzero(in6m, sizeof *in6m); + in6m->in6m_addr = *maddr6; + in6m->in6m_ifp = ifp; + in6m->in6m_ifma = ifma; + ifma->ifma_protospec = in6m; + LIST_INSERT_HEAD(&in6_multihead, in6m, in6m_entry); + + /* + * Let MLD6 know that we have joined a new IP6 multicast + * group. + */ + mld6_start_listening(in6m); + splx(s); + return(in6m); +} + +/* + * Delete a multicast address record. + */ +void +in6_delmulti(in6m) + struct in6_multi *in6m; +{ + struct ifmultiaddr *ifma = in6m->in6m_ifma; + int s = splnet(); + + if (ifma->ifma_refcount == 1) { + /* + * No remaining claims to this record; let MLD6 know + * that we are leaving the multicast group. + */ + mld6_stop_listening(in6m); + ifma->ifma_protospec = 0; + LIST_REMOVE(in6m, in6m_entry); + free(in6m, M_IPMADDR); + } + /* XXX - should be separate API for when we have an ifma? */ + if_delmulti(ifma->ifma_ifp, ifma->ifma_addr); + splx(s); +} +#endif /* not FreeBSD3 */ + +struct in6_multi_mship * +in6_joingroup(ifp, addr, errorp) + struct ifnet *ifp; + struct in6_addr *addr; + int *errorp; +{ + struct in6_multi_mship *imm; + + imm = malloc(sizeof(*imm), M_IPMADDR, M_NOWAIT); + if (!imm) { + *errorp = ENOBUFS; + return NULL; + } + imm->i6mm_maddr = in6_addmulti(addr, ifp, errorp); + if (!imm->i6mm_maddr) { + /* *errorp is alrady set */ + free(imm, M_IPMADDR); + return NULL; + } + return imm; +} + +int +in6_leavegroup(imm) + struct in6_multi_mship *imm; +{ + + if (imm->i6mm_maddr) + in6_delmulti(imm->i6mm_maddr); + free(imm, M_IPMADDR); + return 0; +} + +/* + * Find an IPv6 interface link-local address specific to an interface. + */ +struct in6_ifaddr * +in6ifa_ifpforlinklocal(ifp, ignoreflags) + struct ifnet *ifp; + int ignoreflags; +{ + struct ifaddr *ifa; + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr == NULL) + continue; /* just for safety */ + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + if (IN6_IS_ADDR_LINKLOCAL(IFA_IN6(ifa))) { + if ((((struct in6_ifaddr *)ifa)->ia6_flags & + ignoreflags) != 0) + continue; + break; + } + } + + return((struct in6_ifaddr *)ifa); +} + + +/* + * find the internet address corresponding to a given interface and address. + */ +static struct in6_ifaddr * +_in6ifa_ifpwithaddr(struct ifnet *ifp, struct in6_addr *addr) +{ + struct ifaddr *ifa; + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr == NULL) + continue; /* just for safety */ + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + if (IN6_ARE_ADDR_EQUAL(addr, IFA_IN6(ifa))) + break; + } + + return((struct in6_ifaddr *)ifa); +} + +struct in6_ifaddr * +in6ifa_ifpwithaddr(ifp, addr) + struct ifnet *ifp; + struct in6_addr *addr; +{ + struct in6_ifaddr *_ifa = _in6ifa_ifpwithaddr(ifp, addr); +#if 0 + if (!_ifa) { + struct ifaddr *ifa; + + diag_printf("%s\n", __FUNCTION__); + diag_dump_buf(addr, 16); + diag_printf("==============================================================\n"); + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) + { + if (ifa->ifa_addr == NULL) + continue; /* just for safety */ + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + diag_dump_buf(IFA_IN6(ifa), 16); + diag_printf("--------------------------------------------------------------\n"); + } + } +#endif + return(_ifa); +} + +/* + * Convert IP6 address to printable (loggable) representation. + */ +static char digits[] = "0123456789abcdef"; +static int ip6round = 0; +char * +ip6_sprintf(addr) + const struct in6_addr *addr; +{ + static char ip6buf[8][48]; + int i; + char *cp; + const u_short *a = (const u_short *)addr; + const u_char *d; + int dcolon = 0; + + ip6round = (ip6round + 1) & 7; + cp = ip6buf[ip6round]; + + for (i = 0; i < 8; i++) { + if (dcolon == 1) { + if (*a == 0) { + if (i == 7) + *cp++ = ':'; + a++; + continue; + } else + dcolon = 2; + } + if (*a == 0) { + if (dcolon == 0 && *(a + 1) == 0) { + if (i == 0) + *cp++ = ':'; + *cp++ = ':'; + dcolon = 1; + } else { + *cp++ = '0'; + *cp++ = ':'; + } + a++; + continue; + } + d = (const u_char *)a; + *cp++ = digits[*d >> 4]; + *cp++ = digits[*d++ & 0xf]; + *cp++ = digits[*d >> 4]; + *cp++ = digits[*d & 0xf]; + *cp++ = ':'; + a++; + } + *--cp = 0; + return(ip6buf[ip6round]); +} + +int +in6_localaddr(in6) + struct in6_addr *in6; +{ + struct in6_ifaddr *ia; + + if (IN6_IS_ADDR_LOOPBACK(in6) || IN6_IS_ADDR_LINKLOCAL(in6)) + return 1; + + for (ia = in6_ifaddr; ia; ia = ia->ia_next) + if (IN6_ARE_MASKED_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr, + &ia->ia_prefixmask.sin6_addr)) + return 1; + + return (0); +} + +int +in6_is_addr_deprecated(sa6) + struct sockaddr_in6 *sa6; +{ + struct in6_ifaddr *ia; + + for (ia = in6_ifaddr; ia; ia = ia->ia_next) { + if (IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, + &sa6->sin6_addr) && +#ifdef SCOPEDROUTING + ia->ia_addr.sin6_scope_id == sa6->sin6_scope_id && +#endif + (ia->ia6_flags & IN6_IFF_DEPRECATED) != 0) + return(1); /* true */ + + /* XXX: do we still have to go thru the rest of the list? */ + } + + return(0); /* false */ +} + +/* + * return length of part which dst and src are equal + * hard coding... + */ +int +in6_matchlen(src, dst) +struct in6_addr *src, *dst; +{ + int match = 0; + u_char *s = (u_char *)src, *d = (u_char *)dst; + u_char *lim = s + 16, r; + + while (s < lim) + if ((r = (*d++ ^ *s++)) != 0) { + while (r < 128) { + match++; + r <<= 1; + } + break; + } else + match += 8; + return match; +} + +/* XXX: to be scope conscious */ +int +in6_are_prefix_equal(p1, p2, len) + struct in6_addr *p1, *p2; + int len; +{ + int bytelen, bitlen; + + /* sanity check */ + if (0 > len || len > 128) { + log(LOG_ERR, "in6_are_prefix_equal: invalid prefix length(%d)\n", + len); + return(0); + } + + bytelen = len / 8; + bitlen = len % 8; + + if (bcmp(&p1->s6_addr, &p2->s6_addr, bytelen)) + return(0); + if (p1->s6_addr[bytelen] >> (8 - bitlen) != + p2->s6_addr[bytelen] >> (8 - bitlen)) + return(0); + + return(1); +} + +void +in6_prefixlen2mask(maskp, len) + struct in6_addr *maskp; + int len; +{ + u_char maskarray[8] = {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; + int bytelen, bitlen, i; + + /* sanity check */ + if (0 > len || len > 128) { + log(LOG_ERR, "in6_prefixlen2mask: invalid prefix length(%d)\n", + len); + return; + } + + bzero(maskp, sizeof(*maskp)); + bytelen = len / 8; + bitlen = len % 8; + for (i = 0; i < bytelen; i++) + maskp->s6_addr[i] = 0xff; + if (bitlen) + maskp->s6_addr[bytelen] = maskarray[bitlen - 1]; +} + +/* + * return the best address out of the same scope. if no address was + * found, return the first valid address from designated IF. + */ +struct in6_ifaddr * +in6_ifawithifp(ifp, dst) + struct ifnet *ifp; + struct in6_addr *dst; +{ + int dst_scope = in6_addrscope(dst), blen = -1, tlen; + struct ifaddr *ifa; + struct in6_ifaddr *besta = 0; + struct in6_ifaddr *dep[2]; /* last-resort: deprecated */ + + dep[0] = dep[1] = NULL; + + /* + * We first look for addresses in the same scope. + * If there is one, return it. + * If two or more, return one which matches the dst longest. + * If none, return one of global addresses assigned other ifs. + */ +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST) + continue; /* XXX: is there any case to allow anycast? */ + if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_NOTREADY) + continue; /* don't use this interface */ + if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DETACHED) + continue; + if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DEPRECATED) { + if (ip6_use_deprecated) + dep[0] = (struct in6_ifaddr *)ifa; + continue; + } + + if (dst_scope == in6_addrscope(IFA_IN6(ifa))) { + /* + * call in6_matchlen() as few as possible + */ + if (besta) { + if (blen == -1) + blen = in6_matchlen(&besta->ia_addr.sin6_addr, dst); + tlen = in6_matchlen(IFA_IN6(ifa), dst); + if (tlen > blen) { + blen = tlen; + besta = (struct in6_ifaddr *)ifa; + } + } else + besta = (struct in6_ifaddr *)ifa; + } + } + if (besta) + return(besta); + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST) + continue; /* XXX: is there any case to allow anycast? */ + if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_NOTREADY) + continue; /* don't use this interface */ + if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DETACHED) + continue; + if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DEPRECATED) { + if (ip6_use_deprecated) + dep[1] = (struct in6_ifaddr *)ifa; + continue; + } + + return (struct in6_ifaddr *)ifa; + } + + /* use the last-resort values, that are, deprecated addresses */ + if (dep[0]) + return dep[0]; + if (dep[1]) + return dep[1]; + + return NULL; +} + +/* + * perform DAD when interface becomes IFF_UP. + */ +void +in6_if_up(ifp) + struct ifnet *ifp; +{ + struct ifaddr *ifa; + struct in6_ifaddr *ia; + int dad_delay; /* delay ticks before DAD output */ + + /* + * special cases, like 6to4, are handled in in6_ifattach + */ + in6_ifattach(ifp, NULL); + + dad_delay = 0; +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + ia = (struct in6_ifaddr *)ifa; + if (ia->ia6_flags & IN6_IFF_TENTATIVE) + nd6_dad_start(ifa, &dad_delay); + } +} + +int +in6if_do_dad(ifp) + struct ifnet *ifp; +{ + if ((ifp->if_flags & IFF_LOOPBACK) != 0) + return(0); + + switch (ifp->if_type) { +#ifdef IFT_DUMMY + case IFT_DUMMY: +#endif + case IFT_FAITH: + /* + * These interfaces do not have the IFF_LOOPBACK flag, + * but loop packets back. We do not have to do DAD on such + * interfaces. We should even omit it, because loop-backed + * NS would confuse the DAD procedure. + */ + return(0); + default: + /* + * Our DAD routine requires the interface up and running. + * However, some interfaces can be up before the RUNNING + * status. Additionaly, users may try to assign addresses + * before the interface becomes up (or running). + * We simply skip DAD in such a case as a work around. + * XXX: we should rather mark "tentative" on such addresses, + * and do DAD after the interface becomes ready. + */ + if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != + (IFF_UP|IFF_RUNNING)) + return(0); + + return(1); + } +} + +/* + * Calculate max IPv6 MTU through all the interfaces and store it + * to in6_maxmtu. + */ +void +in6_setmaxmtu() +{ + unsigned long maxmtu = 0; + struct ifnet *ifp; + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifp = ifnet; ifp; ifp = ifp->if_next) +#else + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) +#endif + { + if ((ifp->if_flags & IFF_LOOPBACK) == 0 && + nd_ifinfo[ifp->if_index].linkmtu > maxmtu) + maxmtu = nd_ifinfo[ifp->if_index].linkmtu; + } + if (maxmtu) /* update only when maxmtu is positive */ + in6_maxmtu = maxmtu; +} + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +/* + * Convert sockaddr_in6 to sockaddr_in. Original sockaddr_in6 must be + * v4 mapped addr or v4 compat addr + */ +void +in6_sin6_2_sin(struct sockaddr_in *sin, struct sockaddr_in6 *sin6) +{ + bzero(sin, sizeof(*sin)); + sin->sin_len = sizeof(struct sockaddr_in); + sin->sin_family = AF_INET; + sin->sin_port = sin6->sin6_port; + sin->sin_addr.s_addr = sin6->sin6_addr.s6_addr32[3]; +} + +/* Convert sockaddr_in to sockaddr_in6 in v4 mapped addr format. */ +void +in6_sin_2_v4mapsin6(struct sockaddr_in *sin, struct sockaddr_in6 *sin6) +{ + bzero(sin6, sizeof(*sin6)); + sin6->sin6_len = sizeof(struct sockaddr_in6); + sin6->sin6_family = AF_INET6; + sin6->sin6_port = sin->sin_port; + sin6->sin6_addr.s6_addr32[0] = 0; + sin6->sin6_addr.s6_addr32[1] = 0; + sin6->sin6_addr.s6_addr32[2] = IPV6_ADDR_INT32_SMP; + sin6->sin6_addr.s6_addr32[3] = sin->sin_addr.s_addr; +} + +/* Convert sockaddr_in6 into sockaddr_in. */ +void +in6_sin6_2_sin_in_sock(struct sockaddr *nam) +{ + struct sockaddr_in *sin_p; + struct sockaddr_in6 sin6; + + /* + * Save original sockaddr_in6 addr and convert it + * to sockaddr_in. + */ + sin6 = *(struct sockaddr_in6 *)nam; + sin_p = (struct sockaddr_in *)nam; + in6_sin6_2_sin(sin_p, &sin6); +} + +/* Convert sockaddr_in into sockaddr_in6 in v4 mapped addr format. */ +void +in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam) +{ + struct sockaddr_in *sin_p; + struct sockaddr_in6 *sin6_p; + + MALLOC(sin6_p, struct sockaddr_in6 *, sizeof *sin6_p, M_SONAME, + M_WAITOK); + sin_p = (struct sockaddr_in *)*nam; + in6_sin_2_v4mapsin6(sin_p, sin6_p); + FREE(*nam, M_SONAME); + *nam = (struct sockaddr *)sin6_p; +} +#endif /* freebsd3 */ + +#ifdef MEASURE_PERFORMANCE +#define IN6_MAXADDRHASH 1000 +#ifndef IN6_ADDRHASH +#ifndef INET6_SERVER +#define IN6_ADDRHASH 23 +#else +#define IN6_ADDRHASH 997 +#endif +#endif + +static struct in6hash in6h_hash_any = { NULL, IN6ADDR_ANY_INIT, NULL, 0 }; +struct in6hash *in6hash[IN6_MAXADDRHASH];/* hash buckets for local IPv6 addrs */ +int in6_nhash = IN6_ADDRHASH; /* number of hash buckets for addrs */ +int in6_hash_nullhit; + +#define HASH6(in6) ((in6)->s6_addr32[0]^(in6)->s6_addr32[1]^\ + (in6)->s6_addr32[2]^(in6)->s6_addr32[3]) + +/* + * Initialize the hash by adding entries for IN6ADDR_ANY + */ +struct in6hash *ih_cache = NULL; + +void +in6h_hashinit() +{ + in6h_addhash(&in6h_hash_any); +} + +void +in6h_addifa(ia) + struct in6_ifaddr *ia; +{ + if (ia->ia6_hash.in6h_ifa == NULL) + ia->ia6_hash.in6h_ifa = ia; + + ia->ia6_hash.in6h_addr = IA6_SIN6(ia)->sin6_addr; /* scope? */ + if (IN6_IS_ADDR_UNSPECIFIED(&ia->ia6_hash.in6h_addr)) + return; + in6h_addhash(&ia->ia6_hash); +} + +/* + * Rebuild the hash when any interface addresses have been changed. + * Since this should happen infrequently we remove all the interfaces + * from the hash and add them all back. This insures that the order + * of addresses in the hash is consistent. + */ +void +in6h_rebuild(newhashsiz) + int newhashsiz; /* can be 0, meaning unchange the size */ +{ + struct in6_ifaddr *ia; + + if (newhashsiz > IN6_MAXADDRHASH) + return; /* XXX invalid */ + + for (ia = in6_ifaddr; ia != NULL; ia = ia->ia_next) + in6h_delifa(ia); + + if (newhashsiz) + in6_nhash = newhashsiz; + + for (ia = in6_ifaddr; ia != NULL; ia = ia->ia_next) + in6h_addifa(ia); +} + +/* Remove hash entries for local address on an in6_ifaddr. */ +void +in6h_delifa(ia) + struct in6_ifaddr *ia; +{ + if (IN6_IS_ADDR_UNSPECIFIED(&ia->ia6_hash.in6h_addr)) + return; + in6h_delhash(&ia->ia6_hash); + ia->ia6_hash.in6h_addr = in6addr_any; +} + +static void +in6h_addhash(ih) + struct in6hash *ih; +{ + struct in6hash **prev; + + /* Add to tail of hash list, as address is at end of address list */ + for (prev = &in6hash[HASH6(&ih->in6h_addr) % in6_nhash]; *prev; + prev = &((*prev)->in6h_next)) { + /* however, we always prefer non-global addresses */ + if (IN6_IS_ADDR_LINKLOCAL(&(*prev)->in6h_addr)) + break; + } + ih->in6h_next = *prev; + *prev = ih; +} + +static void +in6h_delhash(ih) + struct in6hash *ih; +{ + struct in6hash **prev; + + ih_cache = NULL; + + for (prev = &in6hash[HASH6(&ih->in6h_addr) % in6_nhash]; + *prev != ih; prev = &((*prev)->in6h_next)) { +#ifdef DEBUG + if (*prev == NULL) + panic("in6h_delhash: lost entry"); +#endif + } + *prev = (*prev)->in6h_next; +} + +/* + * Look up hash structure for specified IP address + * and (optional) interface; matches any interface + * if ifp is null, or this address is not associated + * with the specified interface. + */ +struct in6hash * +in6h_lookup(addr, ifp) + const struct in6_addr *addr; + struct ifnet *ifp; +{ + struct in6hash *ih, *maybe_ih = NULL; + + /* just for measurement */ + if ((ih = in6hash[HASH6(addr) % in6_nhash]) == NULL) + in6_hash_nullhit++; + + for (; ih; ih = ih->in6h_next) { + if (IN6_ARE_ADDR_EQUAL(&ih->in6h_addr, addr)) { + ih->in6h_hit++; + + if (ih->in6h_ifa == NULL || + ih->in6h_ifa->ia_ifp == ifp || ifp == NULL) { + ih_cache = ih; + return (ih); + } + if (maybe_ih == NULL) + maybe_ih = ih; + } + else + ih->in6h_miss++; + } + if (maybe_ih) + ih_cache = maybe_ih; + return (maybe_ih); +} +#endif /* MEASURE_PERFORMANCE */ diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_cksum.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_cksum.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_cksum.c @@ -0,0 +1,338 @@ +//========================================================================== +// +// src/sys/netinet6/in6_cksum.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: in6_cksum.c,v 1.10 2000/12/03 00:53:59 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_cksum.c 8.1 (Berkeley) 6/10/93 + */ + +#include +#include +#include +#include + +/* + * Checksum routine for Internet Protocol family headers (Portable Version). + * + * This routine is very heavily used in the network + * code and should be modified for each CPU to be as fast as possible. + */ + +#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x) +#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);} + +/* + * m MUST contain a continuous IP6 header. + * off is a offset where TCP/UDP/ICMP6 header starts. + * len is a total length of a transport segment. + * (e.g. TCP header + TCP payload) + */ + +int +in6_cksum(m, nxt, off, len) + struct mbuf *m; + u_int8_t nxt; + u_int32_t off, len; +{ + u_int16_t *w; + int sum = 0; + int mlen = 0; + int byte_swapped = 0; +#if 0 + int srcifid = 0, dstifid = 0; +#endif + struct ip6_hdr *ip6; + union { + u_int16_t phs[4]; + struct { + u_int32_t ph_len; + u_int8_t ph_zero[3]; + u_int8_t ph_nxt; + } ph __attribute__((__packed__)); + } uph; + union { + u_int8_t c[2]; + u_int16_t s; + } s_util; + union { + u_int16_t s[2]; + u_int32_t l; + } l_util; + + /* sanity check */ + if (m->m_pkthdr.len < off + len) { + panic("in6_cksum: mbuf len (%d) < off+len (%d+%d)\n", + m->m_pkthdr.len, off, len); + } + + bzero(&uph, sizeof(uph)); + + /* + * First create IP6 pseudo header and calculate a summary. + */ + ip6 = mtod(m, struct ip6_hdr *); +#if 0 + if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) { + srcifid = ip6->ip6_src.s6_addr16[1]; + ip6->ip6_src.s6_addr16[1] = 0; + } + if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) { + dstifid = ip6->ip6_dst.s6_addr16[1]; + ip6->ip6_dst.s6_addr16[1] = 0; + } +#endif + w = (u_int16_t *)&ip6->ip6_src; + uph.ph.ph_len = htonl(len); + uph.ph.ph_nxt = nxt; + + /* IPv6 source address */ + sum += w[0]; + if (!IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) + sum += w[1]; + sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5]; + sum += w[6]; sum += w[7]; + /* IPv6 destination address */ + sum += w[8]; + if (!IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) + sum += w[9]; + sum += w[10]; sum += w[11]; sum += w[12]; sum += w[13]; + sum += w[14]; sum += w[15]; + /* Payload length and upper layer identifier */ + sum += uph.phs[0]; sum += uph.phs[1]; + sum += uph.phs[2]; sum += uph.phs[3]; + +#if 0 + if (srcifid) + ip6->ip6_src.s6_addr16[1] = srcifid; + if (dstifid) + ip6->ip6_dst.s6_addr16[1] = dstifid; +#endif + /* + * Secondly calculate a summary of the first mbuf excluding offset. + */ + while (m != NULL && off > 0) { + if (m->m_len <= off) + off -= m->m_len; + else + break; + m = m->m_next; + } + w = (u_int16_t *)(mtod(m, u_char *) + off); + mlen = m->m_len - off; + if (len < mlen) + mlen = len; + len -= mlen; + /* + * Force to even boundary. + */ + if ((1 & (long) w) && (mlen > 0)) { + REDUCE; + sum <<= 8; + s_util.c[0] = *(u_char *)w; + w = (u_int16_t *)((char *)w + 1); + mlen--; + byte_swapped = 1; + } + /* + * Unroll the loop to make overhead from + * branches &c small. + */ + while ((mlen -= 32) >= 0) { + sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; + sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7]; + sum += w[8]; sum += w[9]; sum += w[10]; sum += w[11]; + sum += w[12]; sum += w[13]; sum += w[14]; sum += w[15]; + w += 16; + } + mlen += 32; + while ((mlen -= 8) >= 0) { + sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; + w += 4; + } + mlen += 8; + if (mlen == 0 && byte_swapped == 0) + goto next; + REDUCE; + while ((mlen -= 2) >= 0) { + sum += *w++; + } + if (byte_swapped) { + REDUCE; + sum <<= 8; + byte_swapped = 0; + if (mlen == -1) { + s_util.c[1] = *(char *)w; + sum += s_util.s; + mlen = 0; + } else + mlen = -1; + } else if (mlen == -1) + s_util.c[0] = *(char *)w; + next: + m = m->m_next; + + /* + * Lastly calculate a summary of the rest of mbufs. + */ + + for (;m && len; m = m->m_next) { + if (m->m_len == 0) + continue; + w = mtod(m, u_int16_t *); + if (mlen == -1) { + /* + * The first byte of this mbuf is the continuation + * of a word spanning between this mbuf and the + * last mbuf. + * + * s_util.c[0] is already saved when scanning previous + * mbuf. + */ + s_util.c[1] = *(char *)w; + sum += s_util.s; + w = (u_int16_t *)((char *)w + 1); + mlen = m->m_len - 1; + len--; + } else + mlen = m->m_len; + if (len < mlen) + mlen = len; + len -= mlen; + /* + * Force to even boundary. + */ + if ((1 & (long) w) && (mlen > 0)) { + REDUCE; + sum <<= 8; + s_util.c[0] = *(u_char *)w; + w = (u_int16_t *)((char *)w + 1); + mlen--; + byte_swapped = 1; + } + /* + * Unroll the loop to make overhead from + * branches &c small. + */ + while ((mlen -= 32) >= 0) { + sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; + sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7]; + sum += w[8]; sum += w[9]; sum += w[10]; sum += w[11]; + sum += w[12]; sum += w[13]; sum += w[14]; sum += w[15]; + w += 16; + } + mlen += 32; + while ((mlen -= 8) >= 0) { + sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; + w += 4; + } + mlen += 8; + if (mlen == 0 && byte_swapped == 0) + continue; + REDUCE; + while ((mlen -= 2) >= 0) { + sum += *w++; + } + if (byte_swapped) { + REDUCE; + sum <<= 8; + byte_swapped = 0; + if (mlen == -1) { + s_util.c[1] = *(char *)w; + sum += s_util.s; + mlen = 0; + } else + mlen = -1; + } else if (mlen == -1) + s_util.c[0] = *(char *)w; + } + if (len) + panic("in6_cksum: out of data\n"); + if (mlen == -1) { + /* The last mbuf has odd # of bytes. Follow the + standard (the odd byte may be shifted left by 8 bits + or not as determined by endian-ness of the machine) */ + s_util.c[1] = 0; + sum += s_util.s; + } + REDUCE; + return (~sum & 0xffff); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_ifattach.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_ifattach.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_ifattach.c @@ -0,0 +1,1339 @@ +//========================================================================== +// +// src/sys/netinet6/in6_ifattach.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: in6_ifattach.c,v 1.149 2001/12/07 07:07:09 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#include +#include +#include +#include +#ifdef __bsdi__ +#include +#elif defined(__OpenBSD__) +#include +#else +#include +#endif + +#ifdef __OpenBSD__ +#include +#endif + +#include +#include +#include +#include + +#include +#include +#ifndef __NetBSD__ +#include +#endif +#if (defined(__FreeBSD__) && __FreeBSD__ >= 4) +#include +#endif + +#include +#include +#include +#if (defined(__FreeBSD__) && __FreeBSD__ >= 4) +#include +#endif +#include +#include +#include +#include + +struct in6_ifstat **in6_ifstat = NULL; +struct icmp6_ifstat **icmp6_ifstat = NULL; +size_t in6_ifstatmax = 0; +size_t icmp6_ifstatmax = 0; +unsigned long in6_maxmtu = 0; + +#ifdef IP6_AUTO_LINKLOCAL +int ip6_auto_linklocal = IP6_AUTO_LINKLOCAL; +#else +int ip6_auto_linklocal = 1; /* enable by default */ +#endif + +#ifdef __NetBSD__ +struct callout in6_tmpaddrtimer_ch = CALLOUT_INITIALIZER; +#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) +struct callout in6_tmpaddrtimer_ch; +#elif defined(__OpenBSD__) +struct timeout in6_tmpaddrtimer_ch; +#endif + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 4) +extern struct inpcbinfo udbinfo; +extern struct inpcbinfo ripcbinfo; +#endif + +#if defined(__NetBSD__) || defined(__OpenBSD__) +static int get_hostid_ifid __P((struct ifnet *, struct in6_addr *)); +#endif +static int get_rand_ifid __P((struct ifnet *, struct in6_addr *)); +static int generate_tmp_ifid __P((u_int8_t *, const u_int8_t *, u_int8_t *)); +static int get_hw_ifid __P((struct ifnet *, struct in6_addr *)); +#ifndef MIP6 +static int get_ifid __P((struct ifnet *, struct ifnet *, struct in6_addr *)); +#endif /* !MIP6 */ +static int in6_ifattach_linklocal __P((struct ifnet *, struct ifnet *)); +static int in6_ifattach_loopback __P((struct ifnet *)); + +#define EUI64_GBIT 0x01 +#define EUI64_UBIT 0x02 +#define EUI64_TO_IFID(in6) do {(in6)->s6_addr[8] ^= EUI64_UBIT; } while (0) +#define EUI64_GROUP(in6) ((in6)->s6_addr[8] & EUI64_GBIT) +#define EUI64_INDIVIDUAL(in6) (!EUI64_GROUP(in6)) +#define EUI64_LOCAL(in6) ((in6)->s6_addr[8] & EUI64_UBIT) +#define EUI64_UNIVERSAL(in6) (!EUI64_LOCAL(in6)) + +#define IFID_LOCAL(in6) (!EUI64_LOCAL(in6)) +#define IFID_UNIVERSAL(in6) (!EUI64_UNIVERSAL(in6)) + +#define GEN_TEMPID_RETRY_MAX 5 + +#if defined(__NetBSD__) || defined(__OpenBSD__) +/* + * Generate a last-resort interface identifier from hostid. + * works only for certain architectures (like sparc). + * also, using hostid itself may constitute a privacy threat, much worse + * than MAC addresses (hostids are used for software licensing). + * maybe we should use MD5(hostid) instead. + */ +static int +get_hostid_ifid(ifp, in6) + struct ifnet *ifp; + struct in6_addr *in6; /* upper 64bits are preserved */ +{ + int off, len; + static u_int8_t allzero[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + static u_int8_t allone[8] = + { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + + if (!hostid) + return -1; + + /* get up to 8 bytes from the hostid field - should we get */ + len = (sizeof(hostid) > 8) ? 8 : sizeof(hostid); + off = sizeof(*in6) - len; + bcopy(&hostid, &in6->s6_addr[off], len); + + /* make sure we do not return anything bogus */ + if (bcmp(&in6->s6_addr[8], allzero, sizeof(allzero))) + return -1; + if (bcmp(&in6->s6_addr[8], allone, sizeof(allone))) + return -1; + + /* make sure to set "u" bit to local, and "g" bit to individual. */ + in6->s6_addr[8] &= ~EUI64_GBIT; /* g bit to "individual" */ + in6->s6_addr[8] |= EUI64_UBIT; /* u bit to "local" */ + + /* convert EUI64 into IPv6 interface identifier */ + EUI64_TO_IFID(in6); + + return 0; +} +#endif + +/* + * Generate a last-resort interface identifier, when the machine has no + * IEEE802/EUI64 address sources. + * The goal here is to get an interface identifier that is + * (1) random enough and (2) does not change across reboot. + * We currently use MD5(hostname) for it. + */ +static int +get_rand_ifid(ifp, in6) + struct ifnet *ifp; + struct in6_addr *in6; /* upper 64bits are preserved */ +{ + MD5_CTX ctxt; + u_int8_t digest[16]; +#ifdef __FreeBSD__ + int hostnamelen = strlen(hostname); +#endif + +#if 0 + /* we need at least several letters as seed for ifid */ + if (hostnamelen < 3) + return -1; +#endif + + /* generate 8 bytes of pseudo-random value. */ + bzero(&ctxt, sizeof(ctxt)); + MD5Init(&ctxt); + MD5Update(&ctxt, hostname, hostnamelen); + MD5Final(digest, &ctxt); + + /* assumes sizeof(digest) > sizeof(ifid) */ + bcopy(digest, &in6->s6_addr[8], 8); + + /* make sure to set "u" bit to local, and "g" bit to individual. */ + in6->s6_addr[8] &= ~EUI64_GBIT; /* g bit to "individual" */ + in6->s6_addr[8] |= EUI64_UBIT; /* u bit to "local" */ + + /* convert EUI64 into IPv6 interface identifier */ + EUI64_TO_IFID(in6); + + return 0; +} + +static int +generate_tmp_ifid(seed0, seed1, ret) + u_int8_t *seed0, *ret; + const u_int8_t *seed1; +{ + MD5_CTX ctxt; + u_int8_t seed[16], digest[16], nullbuf[8]; + u_int32_t val32; +#ifndef __OpenBSD__ + struct timeval tv; +#endif + /* + * interface ID for subnet anycast addresses. + * XXX: we assume the unicast address range that requires IDs + * in EUI-64 format. + */ + const u_int8_t anycast_id[8] = {0xfd, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x80}; + const u_int8_t isatap_id[4] = {0x00, 0x00, 0x5e, 0xfe}; + int badid, retry = 0; + + /* If there's no hisotry, start with a random seed. */ + bzero(nullbuf, sizeof(nullbuf)); + if (bcmp(nullbuf, seed0, sizeof(nullbuf)) == 0) { + int i; + + for (i = 0; i < 2; i++) { +#ifndef __OpenBSD__ + microtime(&tv); + val32 = random() ^ tv.tv_usec; +#else + val32 = arc4random(); +#endif + bcopy(&val32, seed + sizeof(val32) * i, sizeof(val32)); + } + } else { + bcopy(seed0, seed, 8); + } + + /* copy the right-most 64-bits of the given address */ + /* XXX assumption on the size of IFID */ + bcopy(seed1, &seed[8], 8); + + again: + if (0) { /* for debugging purposes only */ + int i; + + printf("generate_tmp_ifid: new randomized ID from: "); + for (i = 0; i < 16; i++) + printf("%02x", seed[i]); + printf(" "); + } + + /* generate 16 bytes of pseudo-random value. */ + bzero(&ctxt, sizeof(ctxt)); + MD5Init(&ctxt); + MD5Update(&ctxt, seed, sizeof(seed)); + MD5Final(digest, &ctxt); + + /* + * draft-ietf-ipngwg-temp-addresses-v2-00.txt 3.2.1. (3) + * Take the left-most 64-bits of the MD5 digest and set bit 6 (the + * left-most bit is numbered 0) to zero. + */ + bcopy(digest, ret, 8); + ret[0] &= ~EUI64_UBIT; + + /* + * Reject inappropriate identifiers according to + * draft-ietf-ipngwg-temp-addresses-v2-00.txt 3.2.1. (4) + * At this moment, we reject following cases: + * - all 0 identifier + * - identifiers that conflict with reserved subnet anycast addresses, + * which are defined in RFC 2526. + * - identifiers that conflict with ISATAP addresses + * - identifiers used in our own addresses + */ + badid = 0; + if (bcmp(nullbuf, ret, sizeof(nullbuf)) == 0) + badid = 1; + else if (bcmp(anycast_id, ret, 7) == 0 && + (anycast_id[7] & ret[7]) == anycast_id[7]) { + badid = 1; + } else if (bcmp(isatap_id, ret, sizeof(isatap_id)) == 0) + badid = 1; + else { + struct in6_ifaddr *ia; + + for (ia = in6_ifaddr; ia; ia = ia->ia_next) { + if (bcmp(&ia->ia_addr.sin6_addr.s6_addr[8], ret, 8) + == 0) { + badid = 1; + break; + } + } + } + + /* + * In the event that an unacceptable identifier has been generated, + * restart the process, using the right-most 64 bits of the MD5 digest + * obtained in place of the history value. + */ + if (badid) { + if (0) { /* for debugging purposes only */ + int i; + + printf("unacceptable random ID: "); + for (i = 0; i < 16; i++) + printf("%02x", digest[i]); + printf("\n"); + } + + if (++retry < GEN_TEMPID_RETRY_MAX) { + bcopy(&digest[8], seed, 8); + goto again; + } else { + /* + * We're so unlucky. Give up for now, and return + * all 0 IDs to tell the caller not to make a + * temporary address. + */ + nd6log((LOG_NOTICE, + "generate_tmp_ifid: never found a good ID\n")); + bzero(ret, 8); + } + } + + /* + * draft-ietf-ipngwg-temp-addresses-v2-00.txt 3.2.1. (6) + * Take the rightmost 64-bits of the MD5 digest and save them in + * stable storage as the history value to be used in the next + * iteration of the algorithm. + */ + bcopy(&digest[8], seed0, 8); + + if (0) { /* for debugging purposes only */ + int i; + + printf("to: "); + for (i = 0; i < 16; i++) + printf("%02x", digest[i]); + printf("\n"); + } + + return 0; +} + +/* + * Get interface identifier for the specified interface. + * XXX assumes single sockaddr_dl (AF_LINK address) per an interface + */ +static int +get_hw_ifid(ifp, in6) + struct ifnet *ifp; + struct in6_addr *in6; /* upper 64bits are preserved */ +{ + struct ifaddr *ifa; + struct sockaddr_dl *sdl; + u_int8_t *addr; + size_t addrlen; + static u_int8_t allzero[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + static u_int8_t allone[8] = + { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#else + for (ifa = ifp->if_addrlist.tqh_first; + ifa; + ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr->sa_family != AF_LINK) + continue; + sdl = (struct sockaddr_dl *)ifa->ifa_addr; + if (sdl == NULL) + continue; + if (sdl->sdl_alen == 0) + continue; + + goto found; + } + + return -1; + +found: + addr = LLADDR(sdl); + addrlen = sdl->sdl_alen; + + switch (ifp->if_type) { + case IFT_IEEE1394: +#ifdef IFT_IEEE80211 + case IFT_IEEE80211: +#endif + /* IEEE1394 uses 16byte length address starting with EUI64 */ + if (addrlen > 8) + addrlen = 8; + break; + default: + break; + } + + /* get EUI64 */ + switch (ifp->if_type) { + /* IEEE802/EUI64 cases - what others? */ + case IFT_ETHER: + case IFT_FDDI: + case IFT_ATM: + case IFT_IEEE1394: +#ifdef IFT_IEEE80211 + case IFT_IEEE80211: +#endif + /* look at IEEE802/EUI64 only */ + if (addrlen != 8 && addrlen != 6) + return -1; + + /* + * check for invalid MAC address - on bsdi, we see it a lot + * since wildboar configures all-zero MAC on pccard before + * card insertion. + */ + if (bcmp(addr, allzero, addrlen) == 0) + return -1; + if (bcmp(addr, allone, addrlen) == 0) + return -1; + + /* make EUI64 address */ + if (addrlen == 8) + bcopy(addr, &in6->s6_addr[8], 8); + else if (addrlen == 6) { + in6->s6_addr[8] = addr[0]; + in6->s6_addr[9] = addr[1]; + in6->s6_addr[10] = addr[2]; + in6->s6_addr[11] = 0xff; + in6->s6_addr[12] = 0xfe; + in6->s6_addr[13] = addr[3]; + in6->s6_addr[14] = addr[4]; + in6->s6_addr[15] = addr[5]; + } + break; + + case IFT_ARCNET: + if (addrlen != 1) + return -1; + if (!addr[0]) + return -1; + + bzero(&in6->s6_addr[8], 8); + in6->s6_addr[15] = addr[0]; + + /* + * due to insufficient bitwidth, we mark it local. + */ + in6->s6_addr[8] &= ~EUI64_GBIT; /* g bit to "individual" */ + in6->s6_addr[8] |= EUI64_UBIT; /* u bit to "local" */ + break; + + case IFT_GIF: +#ifdef IFT_STF + case IFT_STF: +#endif + /* + * RFC2893 says: "SHOULD use IPv4 address as ifid source". + * however, IPv4 address is not very suitable as unique + * identifier source (can be renumbered). + * we don't do this. + */ + return -1; + + default: + return -1; + } + + /* sanity check: g bit must not indicate "group" */ + if (EUI64_GROUP(in6)) + return -1; + + /* convert EUI64 into IPv6 interface identifier */ + EUI64_TO_IFID(in6); + + /* + * sanity check: ifid must not be all zero, avoid conflict with + * subnet router anycast + */ + if ((in6->s6_addr[8] & ~(EUI64_GBIT | EUI64_UBIT)) == 0x00 && + bcmp(&in6->s6_addr[9], allzero, 7) == 0) { + return -1; + } + + return 0; +} + +/* + * Get interface identifier for the specified interface. If it is not + * available on ifp0, borrow interface identifier from other information + * sources. + */ +#ifdef MIP6 +int +#else /* MIP6 */ +static int +#endif /* MIP6 */ +get_ifid(ifp0, altifp, in6) + struct ifnet *ifp0; + struct ifnet *altifp; /* secondary EUI64 source */ + struct in6_addr *in6; +{ + struct ifnet *ifp; + + /* first, try to get it from the interface itself */ + if (get_hw_ifid(ifp0, in6) == 0) { + nd6log((LOG_DEBUG, "%s: got interface identifier from itself\n", + if_name(ifp0))); + goto success; + } + + /* try secondary EUI64 source. this basically is for ATM PVC */ + if (altifp && get_hw_ifid(altifp, in6) == 0) { + nd6log((LOG_DEBUG, "%s: got interface identifier from %s\n", + if_name(ifp0), if_name(altifp))); + goto success; + } + + /* next, try to get it from some other hardware interface */ +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifp = ifnet; ifp; ifp = ifp->if_next) +#else + for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) +#endif + { + if (ifp == ifp0) + continue; + if (get_hw_ifid(ifp, in6) != 0) + continue; + + /* + * to borrow ifid from other interface, ifid needs to be + * globally unique + */ + if (IFID_UNIVERSAL(in6)) { + nd6log((LOG_DEBUG, + "%s: borrow interface identifier from %s\n", + if_name(ifp0), if_name(ifp))); + goto success; + } + } + +#if defined(__NetBSD__) || defined(__OpenBSD__) + /* get from hostid - only for certain architectures */ + if (0 && get_hostid_ifid(ifp, in6) == 0) { + nd6log((LOG_DEBUG, + "%s: interface identifier generated by hostid\n", + if_name(ifp0))); + goto success; + } +#endif + + /* last resort: get from random number source */ + if (get_rand_ifid(ifp, in6) == 0) { + nd6log((LOG_DEBUG, + "%s: interface identifier generated by random number\n", + if_name(ifp0))); + goto success; + } + + printf("%s: failed to get interface identifier\n", if_name(ifp0)); + return -1; + +success: + nd6log((LOG_INFO, "%s: ifid: " + "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + if_name(ifp0), + in6->s6_addr[8], in6->s6_addr[9], + in6->s6_addr[10], in6->s6_addr[11], + in6->s6_addr[12], in6->s6_addr[13], + in6->s6_addr[14], in6->s6_addr[15])); + return 0; +} + +static int +in6_ifattach_linklocal(ifp, altifp) + struct ifnet *ifp; + struct ifnet *altifp; /* secondary EUI64 source */ +{ + struct in6_ifaddr *ia; + struct in6_aliasreq ifra; + struct nd_prefix pr0; + int i, error; +#ifdef SCOPEDROUTING + int64_t zoneid; +#endif + + /* + * configure link-local address. + */ + bzero(&ifra, sizeof(ifra)); + + /* + * in6_update_ifa() does not use ifra_name, but we accurately set it + * for safety. + */ + strncpy(ifra.ifra_name, if_name(ifp), sizeof(ifra.ifra_name)); + + ifra.ifra_addr.sin6_family = AF_INET6; + ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); + ifra.ifra_addr.sin6_addr.s6_addr16[0] = htons(0xfe80); +#ifdef SCOPEDROUTING + ifra.ifra_addr.sin6_addr.s6_addr16[1] = 0 +#else + ifra.ifra_addr.sin6_addr.s6_addr16[1] = htons(ifp->if_index); /* XXX */ +#endif + ifra.ifra_addr.sin6_addr.s6_addr32[1] = 0; + if ((ifp->if_flags & IFF_LOOPBACK) != 0) { + ifra.ifra_addr.sin6_addr.s6_addr32[2] = 0; + ifra.ifra_addr.sin6_addr.s6_addr32[3] = htonl(1); + } else { + if (get_ifid(ifp, altifp, &ifra.ifra_addr.sin6_addr) != 0) { + nd6log((LOG_ERR, + "%s: no ifid available\n", if_name(ifp))); + return(-1); + } + } +#ifdef SCOPEDROUTING + if ((zoneid = in6_addr2zoneid(ifp, &ifra.ifra_addr.sin6_addr)) < 0) + return(-1); + ifra.ifra_addr.sin6_scope_id = zoneid; +#endif + + ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); + ifra.ifra_prefixmask.sin6_family = AF_INET6; + ifra.ifra_prefixmask.sin6_addr = in6mask64; +#ifdef SCOPEDROUTING + /* take into account the sin6_scope_id field for routing */ + ifra.ifra_prefixmask.sin6_scope_id = 0xffffffff; +#endif + /* link-local addresses should NEVER expire. */ + ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; + ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; + + /* + * Do not let in6_update_ifa() do DAD, since we need a random delay + * before sending an NS at the first time the interface becomes up. + * Instead, in6_if_up() will start DAD with a proper random delay. + */ + ifra.ifra_flags |= IN6_IFF_NODAD; + + /* + * Now call in6_update_ifa() to do a bunch of procedures to configure + * a link-local address. We can set NULL to the 3rd argument, because + * we know there's no other link-local address on the interface + * and therefore we are adding one (instead of updating one). + */ + if ((error = in6_update_ifa(ifp, &ifra, NULL)) != 0) { + /* + * XXX: When the interface does not support IPv6, this call + * would fail in the SIOCSIFADDR ioctl. I believe the + * notification is rather confusing in this case, so just + * suppress it. (jinmei@kame.net 20010130) + */ + if (error != EAFNOSUPPORT) + log(LOG_NOTICE, "in6_ifattach_linklocal: failed to " + "configure a link-local address on %s " + "(errno=%d)\n", + if_name(ifp), error); + return(-1); + } + + /* + * Adjust ia6_flags so that in6_if_up will perform DAD. + * XXX: Some P2P interfaces seem not to send packets just after + * becoming up, so we skip p2p interfaces for safety. + */ + ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */ +#ifdef DIAGNOSTIC + if (!ia) { + panic("ia == NULL in in6_ifattach_linklocal"); + /* NOTREACHED */ + } +#endif + if (in6if_do_dad(ifp) && (ifp->if_flags & IFF_POINTOPOINT) == 0) { + ia->ia6_flags &= ~IN6_IFF_NODAD; + ia->ia6_flags |= IN6_IFF_TENTATIVE; + } + + /* + * Make the link-local prefix (fe80::/64%link) as on-link. + * Since we'd like to manage prefixes separately from addresses, + * we make an ND6 prefix structure for the link-local prefix, + * and add it to the prefix list as a never-expire prefix. + * XXX: this change might affect some existing code base... + */ + bzero(&pr0, sizeof(pr0)); + pr0.ndpr_ifp = ifp; + /* this should be 64 at this moment. */ + pr0.ndpr_plen = in6_mask2len(&ifra.ifra_prefixmask.sin6_addr, NULL); + pr0.ndpr_mask = ifra.ifra_prefixmask.sin6_addr; + pr0.ndpr_prefix = ifra.ifra_addr; + /* apply the mask for safety. (nd6_prelist_add will apply it again) */ + for (i = 0; i < 4; i++) { + pr0.ndpr_prefix.sin6_addr.s6_addr32[i] &= + in6mask64.s6_addr32[i]; + } + /* + * Initialize parameters. The link-local prefix must always be + * on-link, and its lifetimes never expire. + */ + pr0.ndpr_raf_onlink = 1; + pr0.ndpr_raf_auto = 1; /* probably meaningless */ + pr0.ndpr_vltime = ND6_INFINITE_LIFETIME; + pr0.ndpr_pltime = ND6_INFINITE_LIFETIME; + /* + * Since there is no other link-local addresses, nd6_prefix_lookup() + * probably returns NULL. However, we cannot always expect the result. + * For example, if we first remove the (only) existing link-local + * address, and then reconfigure another one, the prefix is still + * valid with referring to the old link-local address. + */ + if (nd6_prefix_lookup(&pr0) == NULL) { + if ((error = nd6_prelist_add(&pr0, NULL, NULL)) != 0) + return(error); + } + + log_(LOG_ADDR) { + diag_printf("%s.%d\n", __FUNCTION__, __LINE__); + _show_ifp(ifp); + } + return 0; +} + +static int +in6_ifattach_loopback(ifp) + struct ifnet *ifp; /* must be IFT_LOOP */ +{ + struct in6_aliasreq ifra; + int error; + + bzero(&ifra, sizeof(ifra)); + + /* + * in6_update_ifa() does not use ifra_name, but we accurately set it + * for safety. + */ + strncpy(ifra.ifra_name, if_name(ifp), sizeof(ifra.ifra_name)); + + ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); + ifra.ifra_prefixmask.sin6_family = AF_INET6; + ifra.ifra_prefixmask.sin6_addr = in6mask128; + + /* + * Always initialize ia_dstaddr (= broadcast address) to loopback + * address. Follows IPv4 practice - see in_ifinit(). + */ + ifra.ifra_dstaddr.sin6_len = sizeof(struct sockaddr_in6); + ifra.ifra_dstaddr.sin6_family = AF_INET6; + ifra.ifra_dstaddr.sin6_addr = in6addr_loopback; + + ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); + ifra.ifra_addr.sin6_family = AF_INET6; + ifra.ifra_addr.sin6_addr = in6addr_loopback; + + /* the loopback address should NEVER expire. */ + ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; + ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; + + /* we don't need to perform DAD on loopback interfaces. */ + ifra.ifra_flags |= IN6_IFF_NODAD; + + /* + * We are sure that this is a newly assigned address, so we can set + * NULL to the 3rd arg. + */ + if ((error = in6_update_ifa(ifp, &ifra, NULL)) != 0) { + log(LOG_ERR, "in6_ifattach_loopback: failed to configure " + "the loopback address on %s (errno=%d)\n", + if_name(ifp), error); + return(-1); + } + + return 0; +} + +/* + * compute NI group address, based on the current hostname setting. + * see draft-ietf-ipngwg-icmp-name-lookup-* (04 and later). + * + * when ifp == NULL, the caller is responsible for filling scopeid. + */ +int +in6_nigroup(ifp, name, namelen, in6) + struct ifnet *ifp; + const char *name; + int namelen; + struct in6_addr *in6; +{ + const char *p; + u_char *q; + MD5_CTX ctxt; + u_int8_t digest[16]; + char l; + char n[64]; /* a single label must not exceed 63 chars */ + + if (!namelen || !name) + return -1; + + p = name; + while (p && *p && *p != '.' && p - name < namelen) + p++; + if (p - name > sizeof(n) - 1) + return -1; /* label too long */ + l = p - name; + strncpy(n, name, l); + n[(int)l] = '\0'; + for (q = n; *q; q++) { + if ('A' <= *q && *q <= 'Z') + *q = *q - 'A' + 'a'; + } + + /* generate 8 bytes of pseudo-random value. */ + bzero(&ctxt, sizeof(ctxt)); + MD5Init(&ctxt); + MD5Update(&ctxt, &l, sizeof(l)); + MD5Update(&ctxt, n, l); + MD5Final(digest, &ctxt); + + bzero(in6, sizeof(*in6)); + in6->s6_addr16[0] = htons(0xff02); + if (ifp) + in6->s6_addr16[1] = htons(ifp->if_index); + in6->s6_addr8[11] = 2; + bcopy(digest, &in6->s6_addr32[3], sizeof(in6->s6_addr32[3])); + + return 0; +} + +#if 0 +void +in6_nigroup_attach(name, namelen) + const char *name; + int namelen; +{ + struct ifnet *ifp; + struct sockaddr_in6 mltaddr; + struct in6_multi *in6m; + int error; + + bzero(&mltaddr, sizeof(mltaddr)); + mltaddr.sin6_family = AF_INET6; + mltaddr.sin6_len = sizeof(struct sockaddr_in6); + if (in6_nigroup(NULL, name, namelen, &mltaddr.sin6_addr) != 0) + return; + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifp = ifnet; ifp; ifp = ifp->if_next) +#else + for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) +#endif + { + mltaddr.sin6_addr.s6_addr16[1] = htons(ifp->if_index); + IN6_LOOKUP_MULTI(mltaddr.sin6_addr, ifp, in6m); + if (!in6m) { + if (!in6_addmulti(&mltaddr.sin6_addr, ifp, &error)) { + nd6log((LOG_ERR, "%s: failed to join %s " + "(errno=%d)\n", if_name(ifp), + ip6_sprintf(&mltaddr.sin6_addr), + error)); + } + } + } +} + +void +in6_nigroup_detach(name, namelen) + const char *name; + int namelen; +{ + struct ifnet *ifp; + struct sockaddr_in6 mltaddr; + struct in6_multi *in6m; + + bzero(&mltaddr, sizeof(mltaddr)); + mltaddr.sin6_family = AF_INET6; + mltaddr.sin6_len = sizeof(struct sockaddr_in6); + if (in6_nigroup(NULL, name, namelen, &mltaddr.sin6_addr) != 0) + return; + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifp = ifnet; ifp; ifp = ifp->if_next) +#else + for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) +#endif + { + mltaddr.sin6_addr.s6_addr16[1] = htons(ifp->if_index); + IN6_LOOKUP_MULTI(mltaddr.sin6_addr, ifp, in6m); + if (in6m) + in6_delmulti(in6m); + } +} +#endif + +/* + * XXX multiple loopback interface needs more care. for instance, + * nodelocal address needs to be configured onto only one of them. + * XXX multiple link-local address case + */ +void +in6_ifattach(ifp, altifp) + struct ifnet *ifp; + struct ifnet *altifp; /* secondary EUI64 source */ +{ + static size_t if_indexlim = 8; + struct in6_ifaddr *ia; + struct in6_addr in6; + + /* some of the interfaces are inherently not IPv6 capable */ + switch (ifp->if_type) { +#ifdef IFT_BRIDGE /* OpenBSD 2.8 */ + case IFT_BRIDGE: + return; +#endif +#if defined(__OpenBSD__) || defined(__NetBSD__) + case IFT_PROPVIRTUAL: + if (strncmp("bridge", ifp->if_xname, sizeof("bridge")) == 0 && + '0' <= ifp->if_xname[sizeof("bridge")] && + ifp->if_xname[sizeof("bridge")] <= '9') + return; + break; +#endif +#ifdef IFT_PFLOG + case IFT_PFLOG: + return; +#endif + } + + /* + * We have some arrays that should be indexed by if_index. + * since if_index will grow dynamically, they should grow too. + * struct in6_ifstat **in6_ifstat + * struct icmp6_ifstat **icmp6_ifstat + */ + if (in6_ifstat == NULL || icmp6_ifstat == NULL || + if_index >= if_indexlim) { + size_t n; + caddr_t q; + size_t olim; + + olim = if_indexlim; + while (if_index >= if_indexlim) + if_indexlim <<= 1; + + /* grow in6_ifstat */ + n = if_indexlim * sizeof(struct in6_ifstat *); + q = (caddr_t)malloc(n, M_IFADDR, M_WAITOK); + bzero(q, n); + if (in6_ifstat) { + bcopy((caddr_t)in6_ifstat, q, + olim * sizeof(struct in6_ifstat *)); + free((caddr_t)in6_ifstat, M_IFADDR); + } + in6_ifstat = (struct in6_ifstat **)q; + in6_ifstatmax = if_indexlim; + + /* grow icmp6_ifstat */ + n = if_indexlim * sizeof(struct icmp6_ifstat *); + q = (caddr_t)malloc(n, M_IFADDR, M_WAITOK); + bzero(q, n); + if (icmp6_ifstat) { + bcopy((caddr_t)icmp6_ifstat, q, + olim * sizeof(struct icmp6_ifstat *)); + free((caddr_t)icmp6_ifstat, M_IFADDR); + } + icmp6_ifstat = (struct icmp6_ifstat **)q; + icmp6_ifstatmax = if_indexlim; + } + + /* initialize scope identifiers */ + scope6_ifattach(ifp); + + /* initialize NDP variables */ + nd6_ifattach(ifp); + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + /* create a multicast kludge storage (if we have not had one) */ + in6_createmkludge(ifp); +#endif + + /* + * quirks based on interface type + */ + switch (ifp->if_type) { +#ifdef IFT_STF + case IFT_STF: + /* + * 6to4 interface is a very special kind of beast. + * no multicast, no linklocal. RFC2529 specifies how to make + * linklocals for 6to4 interface, but there's no use and + * it is rather harmful to have one. + */ + goto statinit; +#endif + default: + break; + } + + /* + * usually, we require multicast capability to the interface + */ + if ((ifp->if_flags & IFF_MULTICAST) == 0) { + log(LOG_INFO, "in6_ifattach: " + "%s is not multicast capable, IPv6 not enabled\n", + if_name(ifp)); + return; + } + + /* + * assign loopback address for loopback interface. + * XXX multiple loopback interface case. + */ + if ((ifp->if_flags & IFF_LOOPBACK) != 0) { + in6 = in6addr_loopback; + if (in6ifa_ifpwithaddr(ifp, &in6) == NULL) { + if (in6_ifattach_loopback(ifp) != 0) + return; + } + } + + /* + * assign a link-local address, if there's none. + */ + if (ip6_auto_linklocal) { + int s = splnet(); + ia = in6ifa_ifpforlinklocal(ifp, 0); + if (ia == NULL) { + if (in6_ifattach_linklocal(ifp, altifp) == 0) { + /* linklocal address assigned */ + } else { + /* failed to assign linklocal address. bark? */ + } + } + splx(s); + } + +#ifdef IFT_STF /* XXX */ +statinit: +#endif + + /* update dynamically. */ + if (in6_maxmtu < ifp->if_mtu) + in6_maxmtu = ifp->if_mtu; + + if (in6_ifstat[ifp->if_index] == NULL) { + in6_ifstat[ifp->if_index] = (struct in6_ifstat *) + malloc(sizeof(struct in6_ifstat), M_IFADDR, M_WAITOK); + bzero(in6_ifstat[ifp->if_index], sizeof(struct in6_ifstat)); + } + if (icmp6_ifstat[ifp->if_index] == NULL) { + icmp6_ifstat[ifp->if_index] = (struct icmp6_ifstat *) + malloc(sizeof(struct icmp6_ifstat), M_IFADDR, M_WAITOK); + bzero(icmp6_ifstat[ifp->if_index], sizeof(struct icmp6_ifstat)); + } +} + +/* + * NOTE: in6_ifdetach() does not support loopback if at this moment. + * We don't need this function in bsdi, because interfaces are never removed + * from the ifnet list in bsdi. + */ +#if !(defined(__bsdi__) && _BSDI_VERSION >= 199802) +void +in6_ifdetach(ifp) + struct ifnet *ifp; +{ + struct in6_ifaddr *ia, *oia; + struct ifaddr *ifa, *next; +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + struct ifaddr *ifaprev = NULL; +#endif + struct rtentry *rt; + short rtflags; + struct sockaddr_in6 sin6; +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) + struct in6_multi *in6m, *in6m_next; +#endif + struct in6_multi_mship *imm; + + /* remove neighbor management table */ + nd6_purge(ifp); + + /* nuke any of IPv6 addresses we have */ +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = next) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = next) +#endif + { +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + next = ifa->ifa_next; +#else + next = ifa->ifa_list.tqe_next; +#endif + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + in6_purgeaddr(ifa); + } + + /* undo everything done by in6_ifattach(), just in case */ +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = next) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = next) +#endif + { +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + next = ifa->ifa_next; +#else + next = ifa->ifa_list.tqe_next; +#endif + + + if (ifa->ifa_addr->sa_family != AF_INET6 + || !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) { +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + ifaprev = ifa; +#endif + continue; + } + + ia = (struct in6_ifaddr *)ifa; + + /* + * leave from multicast groups we have joined for the interface + */ + while ((imm = ia->ia6_memberships.lh_first) != NULL) { + LIST_REMOVE(imm, i6mm_chain); + in6_leavegroup(imm); + } + + /* remove from the routing table */ + if ((ia->ia_flags & IFA_ROUTE) + && (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0 +#ifdef __FreeBSD__ + , 0UL +#endif + ))) { + rtflags = rt->rt_flags; + rtfree(rt); + rtrequest(RTM_DELETE, + (struct sockaddr *)&ia->ia_addr, + (struct sockaddr *)&ia->ia_addr, + (struct sockaddr *)&ia->ia_prefixmask, + rtflags, (struct rtentry **)0); + } + + /* remove from the linked list */ +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + if (ifaprev) + ifaprev->ifa_next = ifa->ifa_next; + else + ifp->if_addrlist = ifa->ifa_next; +#else + TAILQ_REMOVE(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list); +#endif + IFAFREE(&ia->ia_ifa); + + /* also remove from the IPv6 address chain(itojun&jinmei) */ + oia = ia; + if (oia == (ia = in6_ifaddr)) + in6_ifaddr = ia->ia_next; + else { + while (ia->ia_next && (ia->ia_next != oia)) + ia = ia->ia_next; + if (ia->ia_next) + ia->ia_next = oia->ia_next; + else { + nd6log((LOG_ERR, + "%s: didn't unlink in6ifaddr from " + "list\n", if_name(ifp))); + } + } + + IFAFREE(&oia->ia_ifa); + } + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) + /* leave from all multicast groups joined */ + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 4) + in6_pcbpurgeif0(LIST_FIRST(udbinfo.listhead), ifp); + in6_pcbpurgeif0(LIST_FIRST(ripcbinfo.listhead), ifp); +#endif + + for (in6m = LIST_FIRST(&in6_multihead); in6m; in6m = in6m_next) { + in6m_next = LIST_NEXT(in6m, in6m_entry); + if (in6m->in6m_ifp != ifp) + continue; + in6_delmulti(in6m); + in6m = NULL; + } +#endif + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + /* cleanup multicast address kludge table, if there is any */ + in6_purgemkludge(ifp); +#endif + + /* + * remove neighbor management table. we call it twice just to make + * sure we nuke everything. maybe we need just one call. + * XXX: since the first call did not release addresses, some prefixes + * might remain. We should call nd6_purge() again to release the + * prefixes after removing all addresses above. + * (Or can we just delay calling nd6_purge until at this point?) + */ + nd6_purge(ifp); + + /* remove route to link-local allnodes multicast (ff02::1) */ + bzero(&sin6, sizeof(sin6)); + sin6.sin6_len = sizeof(struct sockaddr_in6); + sin6.sin6_family = AF_INET6; + sin6.sin6_addr = in6addr_linklocal_allnodes; + sin6.sin6_addr.s6_addr16[1] = htons(ifp->if_index); +#ifndef __FreeBSD__ + rt = rtalloc1((struct sockaddr *)&sin6, 0); +#else + rt = rtalloc1((struct sockaddr *)&sin6, 0, 0UL); +#endif + if (rt && rt->rt_ifp == ifp) { + rtrequest(RTM_DELETE, (struct sockaddr *)rt_key(rt), + rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0); + rtfree(rt); + } +} +#endif + +int +in6_get_tmpifid(ifp, retbuf, baseid, generate) + struct ifnet *ifp; + u_int8_t *retbuf; + const u_int8_t *baseid; + int generate; +{ + u_int8_t nullbuf[8]; + struct nd_ifinfo *ndi = &nd_ifinfo[ifp->if_index]; + + bzero(nullbuf, sizeof(nullbuf)); + if (bcmp(ndi->randomid, nullbuf, sizeof(nullbuf)) == 0) { + /* we've never created a random ID. Create a new one. */ + generate = 1; + } + + if (generate) { + bcopy(baseid, ndi->randomseed1, sizeof(ndi->randomseed1)); + + /* generate_tmp_ifid will update seedn and buf */ + (void)generate_tmp_ifid(ndi->randomseed0, ndi->randomseed1, + ndi->randomid); + } + bcopy(ndi->randomid, retbuf, 8); + if (generate && bcmp(retbuf, nullbuf, sizeof(nullbuf)) == 0) { + /* generate_tmp_ifid could not found a good ID. */ + return(-1); + } + + return(0); +} + +void +in6_tmpaddrtimer(ignored_arg) + void *ignored_arg; +{ + int i; + struct nd_ifinfo *ndi; + u_int8_t nullbuf[8]; +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_reset(&in6_tmpaddrtimer_ch, + (ip6_temp_preferred_lifetime - ip6_desync_factor - + ip6_temp_regen_advance) * hz, + in6_tmpaddrtimer, NULL); +#elif defined(__OpenBSD__) + timeout_set(&in6_tmpaddrtimer_ch, in6_tmpaddrtimer, NULL); + timeout_add(&in6_tmpaddrtimer_ch, + (ip6_temp_preferred_lifetime - ip6_desync_factor - + ip6_temp_regen_advance) * hz); +#else + timeout(in6_tmpaddrtimer, (caddr_t)0, + (ip6_temp_preferred_lifetime - ip6_desync_factor - + ip6_temp_regen_advance) * hz); +#endif + + bzero(nullbuf, sizeof(nullbuf)); + for (i = 1; i < if_index + 1; i++) { + ndi = &nd_ifinfo[i]; + if (bcmp(ndi->randomid, nullbuf, sizeof(nullbuf)) != 0) { + /* + * We've been generating a random ID on this interface. + * Create a new one. + */ + (void)generate_tmp_ifid(ndi->randomseed0, + ndi->randomseed1, + ndi->randomid); + } + } + + splx(s); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_pcb.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_pcb.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_pcb.c @@ -0,0 +1,1103 @@ +//========================================================================== +// +// src/sys/netinet6/in6_pcb.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $FreeBSD: src/sys/netinet6/in6_pcb.c,v 1.10.2.4 2001/08/13 16:26:17 ume Exp $ */ +/* $KAME: in6_pcb.c,v 1.42 2001/11/13 03:09:44 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + * + */ + +/* + * Copyright (c) 1982, 1986, 1991, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef IPSEC +#include +#include +#include +#endif /* IPSEC */ + +struct in6_addr zeroin6_addr; + +int +in6_pcbbind(inp, nam, p) + register struct inpcb *inp; + struct sockaddr *nam; + struct proc *p; +{ + struct socket *so = inp->inp_socket; + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)NULL; + struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; + u_short lport = 0; + int wild = 0, reuseport = (so->so_options & SO_REUSEPORT); + + if (!in6_ifaddr) /* XXX broken! */ + return (EADDRNOTAVAIL); + if (inp->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) + return(EINVAL); + if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0) + wild = 1; + if (nam) { + int error; + + sin6 = (struct sockaddr_in6 *)nam; + if (nam->sa_len != sizeof(*sin6)) + return(EINVAL); + /* + * family check. + */ + if (nam->sa_family != AF_INET6) + return(EAFNOSUPPORT); + + if ((error = scope6_check_id(sin6, ip6_use_defzone)) != 0) + return(error); +#ifndef SCOPEDROUTING + /* this must be cleared for ifa_ifwithaddr() */ + sin6->sin6_scope_id = 0; +#endif + + lport = sin6->sin6_port; + if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) { + /* + * Treat SO_REUSEADDR as SO_REUSEPORT for multicast; + * allow compepte duplication of binding if + * SO_REUSEPORT is set, or if SO_REUSEADDR is set + * and a multicast address is bound on both + * new and duplicated sockets. + */ + if (so->so_options & SO_REUSEADDR) + reuseport = SO_REUSEADDR|SO_REUSEPORT; + } else if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { + struct ifaddr *ia = NULL; + + sin6->sin6_port = 0; /* yech... */ + if ((ia = ifa_ifwithaddr((struct sockaddr *)sin6)) == 0) + return(EADDRNOTAVAIL); + + /* + * XXX: bind to an anycast address might accidentally + * cause sending a packet with anycast source address. + * We should allow to bind to a deprecated address, since + * the application dare to use it. + */ + if (ia && + ((struct in6_ifaddr *)ia)->ia6_flags & + (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|IN6_IFF_DETACHED)) { + return(EADDRNOTAVAIL); + } + } + if (lport) { + struct inpcb *t; + + /* GROSS */ + t = in6_pcblookup_local(pcbinfo, &sin6->sin6_addr, + lport, wild); + if (t && (reuseport & t->inp_socket->so_options) == 0) + return(EADDRINUSE); + if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 && + IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { + struct sockaddr_in sin; + + in6_sin6_2_sin(&sin, sin6); + t = in_pcblookup_local(pcbinfo, sin.sin_addr, + lport, wild); + if (t && + (reuseport & t->inp_socket->so_options) + == 0 && + (ntohl(t->inp_laddr.s_addr) + != INADDR_ANY || + INP_SOCKAF(so) == + INP_SOCKAF(t->inp_socket))) + return (EADDRINUSE); + } + } + inp->in6p_laddr = sin6->sin6_addr; + } + if (lport == 0) { + int e; + if ((e = in6_pcbsetport(&inp->in6p_laddr, inp, p)) != 0) + return(e); + } + else { + inp->inp_lport = lport; + if (in_pcbinshash(inp) != 0) { + inp->in6p_laddr = in6addr_any; + inp->inp_lport = 0; + return (EAGAIN); + } + } + return(0); +} + +/* + * Transform old in6_pcbconnect() into an inner subroutine for new + * in6_pcbconnect(): Do some validity-checking on the remote + * address (in mbuf 'nam') and then determine local host address + * (i.e., which interface) to use to access that remote host. + * + * This preserves definition of in6_pcbconnect(), while supporting a + * slightly different version for T/TCP. (This is more than + * a bit of a kludge, but cleaning up the internal interfaces would + * have forced minor changes in every protocol). + */ + +int +in6_pcbladdr(inp, nam, plocal_addr6) + register struct inpcb *inp; + struct sockaddr *nam; + struct in6_addr **plocal_addr6; +{ + register struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; + int error = 0; + + if (nam->sa_len != sizeof (*sin6)) + return (EINVAL); + if (sin6->sin6_family != AF_INET6) + return (EAFNOSUPPORT); + if (sin6->sin6_port == 0) + return (EADDRNOTAVAIL); + + if ((error = scope6_check_id(sin6, ip6_use_defzone)) != 0) + return(error); +#ifndef SCOPEDROUTING + sin6->sin6_scope_id = 0; +#endif + + if (in6_ifaddr) { + /* + * If the destination address is UNSPECIFIED addr, + * use the loopback addr, e.g ::1. + */ + if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) + sin6->sin6_addr = in6addr_loopback; + } + { + struct ifnet *ifp = NULL; + + *plocal_addr6 = in6_selectsrc(sin6, inp->in6p_outputopts, + inp->in6p_moptions, + &inp->in6p_route, + &ifp, &inp->in6p_laddr, &error); + if (ifp && sin6->sin6_scope_id == 0 && + (error = scope6_setzoneid(ifp, sin6)) != 0) { /* XXX */ + return(error); + } + + if (*plocal_addr6 == 0) { + if (error == 0) + error = EADDRNOTAVAIL; + return(error); + } + /* + * Don't do pcblookup call here; return interface in + * plocal_addr6 + * and exit to caller, that will do the lookup. + */ + } + + return(0); +} + +/* + * Outer subroutine: + * Connect from a socket to a specified address. + * Both address and port must be specified in argument sin. + * If don't have a local address for this socket yet, + * then pick one. + */ +int +in6_pcbconnect(inp, nam, p) + register struct inpcb *inp; + struct sockaddr *nam; + struct proc *p; +{ + struct in6_addr *addr6; + register struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; + int error; + + /* + * Call inner routine, to assign local interface address. + * in6_pcbladdr() may automatically fill in sin6_scope_id. + */ + if ((error = in6_pcbladdr(inp, nam, &addr6)) != 0) + return(error); + + if (in6_pcblookup_hash(inp->inp_pcbinfo, &sin6->sin6_addr, + sin6->sin6_port, + IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) + ? addr6 : &inp->in6p_laddr, + inp->inp_lport, 0, NULL) != NULL) { + return (EADDRINUSE); + } + if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) { + if (inp->inp_lport == 0) { + error = in6_pcbbind(inp, (struct sockaddr *)0, p); + if (error) + return (error); + } + inp->in6p_laddr = *addr6; + } + inp->in6p_faddr = sin6->sin6_addr; + inp->inp_fport = sin6->sin6_port; + /* update flowinfo - draft-itojun-ipv6-flowlabel-api-00 */ + inp->in6p_flowinfo &= ~IPV6_FLOWLABEL_MASK; + if (inp->in6p_flags & IN6P_AUTOFLOWLABEL) + inp->in6p_flowinfo |= + (htonl(ip6_flow_seq++) & IPV6_FLOWLABEL_MASK); + + in_pcbrehash(inp); + return (0); +} + +#if 0 +/* + * Return an IPv6 address, which is the most appropriate for given + * destination and user specified options. + * If necessary, this function lookups the routing table and return + * an entry to the caller for later use. + */ +struct in6_addr * +in6_selectsrc(dstsock, opts, mopts, ro, laddr, errorp) + struct sockaddr_in6 *dstsock; + struct ip6_pktopts *opts; + struct ip6_moptions *mopts; +#ifdef NEW_STRUCT_ROUTE + struct route *ro; +#else + struct route_in6 *ro; +#endif + struct in6_addr *laddr; + int *errorp; +{ + struct in6_addr *dst; + struct in6_ifaddr *ia6 = 0; + struct in6_pktinfo *pi = NULL; + + dst = &dstsock->sin6_addr; + *errorp = 0; + + /* + * If the source address is explicitly specified by the caller, + * use it. + */ + if (opts && (pi = opts->ip6po_pktinfo) && + !IN6_IS_ADDR_UNSPECIFIED(&pi->ipi6_addr)) + return(&pi->ipi6_addr); + + /* + * If the source address is not specified but the socket(if any) + * is already bound, use the bound address. + */ + if (laddr && !IN6_IS_ADDR_UNSPECIFIED(laddr)) + return(laddr); + + /* + * If the caller doesn't specify the source address but + * the outgoing interface, use an address associated with + * the interface. + */ + if (pi && pi->ipi6_ifindex) { + /* XXX boundary check is assumed to be already done. */ + ia6 = in6_ifawithscope(ifindex2ifnet[pi->ipi6_ifindex], + dst); + if (ia6 == 0) { + *errorp = EADDRNOTAVAIL; + return(0); + } + return(&satosin6(&ia6->ia_addr)->sin6_addr); + } + + /* + * If the destination address is a link-local unicast address or + * a multicast address, and if the outgoing interface is specified + * by the sin6_scope_id filed, use an address associated with the + * interface. + * XXX: We're now trying to define more specific semantics of + * sin6_scope_id field, so this part will be rewritten in + * the near future. + */ + if ((IN6_IS_ADDR_LINKLOCAL(dst) || IN6_IS_ADDR_MULTICAST(dst)) && + dstsock->sin6_scope_id) { + /* + * I'm not sure if boundary check for scope_id is done + * somewhere... + */ + if (dstsock->sin6_scope_id < 0 || + if_index < dstsock->sin6_scope_id) { + *errorp = ENXIO; /* XXX: better error? */ + return(0); + } + ia6 = in6_ifawithscope(ifindex2ifnet[dstsock->sin6_scope_id], + dst); + if (ia6 == 0) { + *errorp = EADDRNOTAVAIL; + return(0); + } + return(&satosin6(&ia6->ia_addr)->sin6_addr); + } + + /* + * If the destination address is a multicast address and + * the outgoing interface for the address is specified + * by the caller, use an address associated with the interface. + * There is a sanity check here; if the destination has node-local + * scope, the outgoing interfacde should be a loopback address. + * Even if the outgoing interface is not specified, we also + * choose a loopback interface as the outgoing interface. + */ + if (IN6_IS_ADDR_MULTICAST(dst)) { + struct ifnet *ifp = mopts ? mopts->im6o_multicast_ifp : NULL; + + if (ifp == NULL && IN6_IS_ADDR_MC_NODELOCAL(dst)) { + ifp = &loif[0]; + } + + if (ifp) { + ia6 = in6_ifawithscope(ifp, dst); + if (ia6 == 0) { + *errorp = EADDRNOTAVAIL; + return(0); + } + return(&ia6->ia_addr.sin6_addr); + } + } + + /* + * If the next hop address for the packet is specified + * by caller, use an address associated with the route + * to the next hop. + */ + { + struct sockaddr_in6 *sin6_next; + struct rtentry *rt; + + if (opts && opts->ip6po_nexthop) { + sin6_next = satosin6(opts->ip6po_nexthop); + rt = nd6_lookup(&sin6_next->sin6_addr, 1, NULL); + if (rt) { + ia6 = in6_ifawithscope(rt->rt_ifp, dst); + if (ia6 == 0) + ia6 = ifatoia6(rt->rt_ifa); + } + if (ia6 == 0) { + *errorp = EADDRNOTAVAIL; + return(0); + } + return(&satosin6(&ia6->ia_addr)->sin6_addr); + } + } + + /* + * If route is known or can be allocated now, + * our src addr is taken from the i/f, else punt. + */ + if (ro) { + if (ro->ro_rt && + !IN6_ARE_ADDR_EQUAL(&satosin6(&ro->ro_dst)->sin6_addr, dst)) { + RTFREE(ro->ro_rt); + ro->ro_rt = (struct rtentry *)0; + } + if (ro->ro_rt == (struct rtentry *)0 || + ro->ro_rt->rt_ifp == (struct ifnet *)0) { + struct sockaddr_in6 *dst6; + + /* No route yet, so try to acquire one */ + bzero(&ro->ro_dst, sizeof(struct sockaddr_in6)); + dst6 = (struct sockaddr_in6 *)&ro->ro_dst; + dst6->sin6_family = AF_INET6; + dst6->sin6_len = sizeof(struct sockaddr_in6); + dst6->sin6_addr = *dst; + if (IN6_IS_ADDR_MULTICAST(dst)) { + ro->ro_rt = rtalloc1(&((struct route *)ro) + ->ro_dst, 0, 0UL); + } else { + rtalloc((struct route *)ro); + } + } + + /* + * in_pcbconnect() checks out IFF_LOOPBACK to skip using + * the address. But we don't know why it does so. + * It is necessary to ensure the scope even for lo0 + * so doesn't check out IFF_LOOPBACK. + */ + + if (ro->ro_rt) { + ia6 = in6_ifawithscope(ro->ro_rt->rt_ifa->ifa_ifp, dst); + if (ia6 == 0) /* xxx scope error ?*/ + ia6 = ifatoia6(ro->ro_rt->rt_ifa); + } + if (ia6 == 0) { + *errorp = EHOSTUNREACH; /* no route */ + return(0); + } + return(&satosin6(&ia6->ia_addr)->sin6_addr); + } + + *errorp = EADDRNOTAVAIL; + return(0); +} + +/* + * Default hop limit selection. The precedence is as follows: + * 1. Hoplimit valued specified via ioctl. + * 2. (If the outgoing interface is detected) the current + * hop limit of the interface specified by router advertisement. + * 3. The system default hoplimit. +*/ +int +in6_selecthlim(in6p, ifp) + struct in6pcb *in6p; + struct ifnet *ifp; +{ + if (in6p && in6p->in6p_hops >= 0) + return(in6p->in6p_hops); + else if (ifp) + return(nd_ifinfo[ifp->if_index].chlim); + else + return(ip6_defhlim); +} +#endif + +void +in6_pcbdisconnect(inp) + struct inpcb *inp; +{ + bzero((caddr_t)&inp->in6p_faddr, sizeof(inp->in6p_faddr)); + inp->inp_fport = 0; + /* clear flowinfo - draft-itojun-ipv6-flowlabel-api-00 */ + inp->in6p_flowinfo &= ~IPV6_FLOWLABEL_MASK; + in_pcbrehash(inp); + if (inp->inp_socket->so_state & SS_NOFDREF) + in6_pcbdetach(inp); +} + +void +in6_pcbdetach(inp) + struct inpcb *inp; +{ + struct socket *so = inp->inp_socket; + struct inpcbinfo *ipi = inp->inp_pcbinfo; + +#ifdef IPSEC + if (inp->in6p_sp != NULL) + ipsec6_delete_pcbpolicy(inp); +#endif /* IPSEC */ + inp->inp_gencnt = ++ipi->ipi_gencnt; + in_pcbremlists(inp); + sotoinpcb(so) = 0; + sofree(so); + + if (inp->in6p_inputopts) /* Free all received options. */ + m_freem(inp->in6p_inputopts->head); /* this is safe */ + ip6_freepcbopts(inp->in6p_outputopts); + ip6_freemoptions(inp->in6p_moptions); + if (inp->in6p_route.ro_rt) + rtfree(inp->in6p_route.ro_rt); + /* Check and free IPv4 related resources in case of mapped addr */ + if (inp->inp_options) + (void)m_free(inp->inp_options); + ip_freemoptions(inp->inp_moptions); + + inp->inp_vflag = 0; + zfreei(ipi->ipi_zone, inp); +} + +/* + * The calling convention of in6_setsockaddr() and in6_setpeeraddr() was + * modified to match the pru_sockaddr() and pru_peeraddr() entry points + * in struct pr_usrreqs, so that protocols can just reference then directly + * without the need for a wrapper function. The socket must have a valid + * (i.e., non-nil) PCB, but it should be impossible to get an invalid one + * except through a kernel programming error, so it is acceptable to panic + * (or in this case trap) if the PCB is invalid. (Actually, we don't trap + * because there actually /is/ a programming error somewhere... XXX) + */ +int +in6_setsockaddr(so, nam) + struct socket *so; + struct sockaddr **nam; +{ + int s; + register struct inpcb *inp; + register struct sockaddr_in6 *sin6; + + /* + * Do the malloc first in case it blocks. + */ + MALLOC(sin6, struct sockaddr_in6 *, sizeof *sin6, M_SONAME, M_WAITOK); + bzero(sin6, sizeof *sin6); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(*sin6); + + s = splnet(); + inp = sotoinpcb(so); + if (!inp) { + splx(s); + free(sin6, M_SONAME); + return EINVAL; + } + sin6->sin6_port = inp->inp_lport; + sin6->sin6_addr = inp->in6p_laddr; + splx(s); + +#ifndef SCOPEDROUTING + in6_recoverscope(sin6, &inp->in6p_laddr, NULL); +#endif + + *nam = (struct sockaddr *)sin6; + return 0; +} + +int +in6_setpeeraddr(so, nam) + struct socket *so; + struct sockaddr **nam; +{ + int s; + struct inpcb *inp; + register struct sockaddr_in6 *sin6; + + /* + * Do the malloc first in case it blocks. + */ + MALLOC(sin6, struct sockaddr_in6 *, sizeof(*sin6), M_SONAME, M_WAITOK); + bzero((caddr_t)sin6, sizeof (*sin6)); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(struct sockaddr_in6); + + s = splnet(); + inp = sotoinpcb(so); + if (!inp) { + splx(s); + free(sin6, M_SONAME); + return EINVAL; + } + sin6->sin6_port = inp->inp_fport; + sin6->sin6_addr = inp->in6p_faddr; + splx(s); + +#ifndef SCOPEDROUTING + in6_recoverscope(sin6, &inp->in6p_faddr, NULL); +#endif + + *nam = (struct sockaddr *)sin6; + return 0; +} + +int +in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam) +{ + struct inpcb *inp = sotoinpcb(so); + int error; + + if (inp == NULL) + return EINVAL; + if (inp->inp_vflag & INP_IPV4) { + error = in_setsockaddr(so, nam); + if (error == 0) + in6_sin_2_v4mapsin6_in_sock(nam); + } else + /* scope issues will be handled in in6_setsockaddr(). */ + error = in6_setsockaddr(so, nam); + + return error; +} + +int +in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam) +{ + struct inpcb *inp = sotoinpcb(so); + int error; + + if (inp == NULL) + return EINVAL; + if (inp->inp_vflag & INP_IPV4) { + error = in_setpeeraddr(so, nam); + if (error == 0) + in6_sin_2_v4mapsin6_in_sock(nam); + } else + /* scope issues will be handled in in6_setpeeraddr(). */ + error = in6_setpeeraddr(so, nam); + + return error; +} + +/* + * Pass some notification to all connections of a protocol + * associated with address dst. The local address and/or port numbers + * may be specified to limit the search. The "usual action" will be + * taken, depending on the ctlinput cmd. The caller must filter any + * cmds that are uninteresting (e.g., no error in the map). + * Call the protocol specific routine (if any) to report + * any errors for each matching socket. + * + * Must be called at splnet. + */ +void +in6_pcbnotify(head, dst, fport_arg, src, lport_arg, cmd, cmdarg, notify) + struct inpcbhead *head; + struct sockaddr *dst, *src; + u_int fport_arg, lport_arg; + int cmd; + void *cmdarg; + void (*notify) __P((struct inpcb *, int)); +{ + struct inpcb *inp, *ninp; + struct sockaddr_in6 sa6_src, *sa6_dst; + u_short fport = fport_arg, lport = lport_arg; + u_int32_t flowinfo; + int errno, s; + + if ((unsigned)cmd > PRC_NCMDS || dst->sa_family != AF_INET6) + return; + + sa6_dst = (struct sockaddr_in6 *)dst; + if (IN6_IS_ADDR_UNSPECIFIED(&sa6_dst->sin6_addr)) + return; + + /* + * note that src can be NULL when we get notify by local fragmentation. + */ + sa6_src = (src == NULL) ? sa6_any : *(struct sockaddr_in6 *)src; + flowinfo = sa6_src.sin6_flowinfo; + + /* + * Redirects go to all references to the destination, + * and use in6_rtchange to invalidate the route cache. + * Dead host indications: also use in6_rtchange to invalidate + * the cache, and deliver the error to all the sockets. + * Otherwise, if we have knowledge of the local port and address, + * deliver only to that socket. + */ + if (PRC_IS_REDIRECT(cmd) || cmd == PRC_HOSTDEAD) { + fport = 0; + lport = 0; + bzero((caddr_t)&sa6_src.sin6_addr, sizeof(sa6_src.sin6_addr)); + + if (cmd != PRC_HOSTDEAD) + notify = in6_rtchange; + } + errno = inet6ctlerrmap[cmd]; + s = splnet(); + for (inp = LIST_FIRST(head); inp != NULL; inp = ninp) { + ninp = LIST_NEXT(inp, inp_list); + + if ((inp->inp_vflag & INP_IPV6) == 0) + continue; + + /* + * If the error designates a new path MTU for a destination + * and the application (associated with this socket) wanted to + * know the value, notify. Note that we notify for all + * disconnected sockets if the corresponding application + * wanted. This is because some UDP applications keep sending + * sockets disconnected. + * XXX: should we avoid to notify the value to TCP sockets? + */ + if (cmd == PRC_MSGSIZE && (inp->inp_flags & IN6P_MTU) != 0 && + (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) || + IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, + &sa6_dst->sin6_addr))) { + ip6_notify_pmtu(inp, (struct sockaddr_in6 *)dst, + (u_int32_t *)cmdarg); + } + + /* + * Detect if we should notify the error. If no source and + * destination ports are specifed, but non-zero flowinfo and + * local address match, notify the error. This is the case + * when the error is delivered with an encrypted buffer + * by ESP. Otherwise, just compare addresses and ports + * as usual. + */ + if (lport == 0 && fport == 0 && flowinfo && + inp->inp_socket != NULL && + flowinfo == (inp->in6p_flowinfo & IPV6_FLOWLABEL_MASK) && + IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, &sa6_src.sin6_addr)) + goto do_notify; + else if (!IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, + &sa6_dst->sin6_addr) || + inp->inp_socket == 0 || + (lport && inp->inp_lport != lport) || + (!IN6_IS_ADDR_UNSPECIFIED(&sa6_src.sin6_addr) && + !IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, + &sa6_src.sin6_addr)) || + (fport && inp->inp_fport != fport)) + continue; + + do_notify: + if (notify) + (*notify)(inp, errno); + } + splx(s); +} + +/* + * Lookup a PCB based on the local address and port. + */ +struct inpcb * +in6_pcblookup_local(pcbinfo, laddr, lport_arg, wild_okay) + struct inpcbinfo *pcbinfo; + struct in6_addr *laddr; + u_int lport_arg; + int wild_okay; +{ + register struct inpcb *inp; + int matchwild = 3, wildcard; + u_short lport = lport_arg; + + if (!wild_okay) { + struct inpcbhead *head; + /* + * Look for an unconnected (wildcard foreign addr) PCB that + * matches the local address and port we're looking for. + */ + head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0, + pcbinfo->hashmask)]; + LIST_FOREACH(inp, head, inp_hash) { + if ((inp->inp_vflag & INP_IPV6) == 0) + continue; + if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) && + IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && + inp->inp_lport == lport) { + /* + * Found. + */ + return (inp); + } + } + /* + * Not found. + */ + return (NULL); + } else { + struct inpcbporthead *porthash; + struct inpcbport *phd; + struct inpcb *match = NULL; + /* + * Best fit PCB lookup. + * + * First see if this local port is in use by looking on the + * port hash list. + */ + porthash = &pcbinfo->porthashbase[INP_PCBPORTHASH(lport, + pcbinfo->porthashmask)]; + LIST_FOREACH(phd, porthash, phd_hash) { + if (phd->phd_port == lport) + break; + } + if (phd != NULL) { + /* + * Port is in use by one or more PCBs. Look for best + * fit. + */ + LIST_FOREACH(inp, &phd->phd_pcblist, inp_portlist) { + wildcard = 0; + if ((inp->inp_vflag & INP_IPV6) == 0) + continue; + if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) + wildcard++; + if (!IN6_IS_ADDR_UNSPECIFIED( + &inp->in6p_laddr)) { + if (IN6_IS_ADDR_UNSPECIFIED(laddr)) + wildcard++; + else if (!IN6_ARE_ADDR_EQUAL( + &inp->in6p_laddr, laddr)) + continue; + } else { + if (!IN6_IS_ADDR_UNSPECIFIED(laddr)) + wildcard++; + } + if (wildcard < matchwild) { + match = inp; + matchwild = wildcard; + if (matchwild == 0) { + break; + } + } + } + } + return (match); + } +} + +void +in6_pcbpurgeif0(head, ifp) + struct in6pcb *head; + struct ifnet *ifp; +{ + struct in6pcb *in6p; + struct ip6_moptions *im6o; + struct in6_multi_mship *imm, *nimm; + + for (in6p = head; in6p != NULL; in6p = LIST_NEXT(in6p, inp_list)) { + im6o = in6p->in6p_moptions; + if ((in6p->inp_vflag & INP_IPV6) && + im6o) { + /* + * Unselect the outgoing interface if it is being + * detached. + */ + if (im6o->im6o_multicast_ifp == ifp) + im6o->im6o_multicast_ifp = NULL; + + /* + * Drop multicast group membership if we joined + * through the interface being detached. + * XXX controversial - is it really legal for kernel + * to force this? + */ + for (imm = im6o->im6o_memberships.lh_first; + imm != NULL; imm = nimm) { + nimm = imm->i6mm_chain.le_next; + if (imm->i6mm_maddr->in6m_ifp == ifp) { + LIST_REMOVE(imm, i6mm_chain); + in6_delmulti(imm->i6mm_maddr); + free(imm, M_IPMADDR); + } + } + } + } +} + +/* + * Check for alternatives when higher level complains + * about service problems. For now, invalidate cached + * routing information. If the route was created dynamically + * (by a redirect), time to try a default gateway again. + */ +void +in6_losing(in6p) + struct inpcb *in6p; +{ + struct rtentry *rt; + struct rt_addrinfo info; + + if ((rt = in6p->in6p_route.ro_rt) != NULL) { + bzero((caddr_t)&info, sizeof(info)); + info.rti_info[RTAX_DST] = + (struct sockaddr *)&in6p->in6p_route.ro_dst; + info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; + info.rti_info[RTAX_NETMASK] = rt_mask(rt); + rt_missmsg(RTM_LOSING, &info, rt->rt_flags, 0); + if (rt->rt_flags & RTF_DYNAMIC) + (void)rtrequest(RTM_DELETE, rt_key(rt), + rt->rt_gateway, rt_mask(rt), rt->rt_flags, + (struct rtentry **)0); + in6p->in6p_route.ro_rt = NULL; + rtfree(rt); + /* + * A new route can be allocated + * the next time output is attempted. + */ + } +} + +/* + * After a routing change, flush old routing + * and allocate a (hopefully) better one. + */ +void +in6_rtchange(inp, _errno) + struct inpcb *inp; + int _errno; +{ + if (inp->in6p_route.ro_rt) { + rtfree(inp->in6p_route.ro_rt); + inp->in6p_route.ro_rt = 0; + /* + * A new route can be allocated the next time + * output is attempted. + */ + } +} + +/* + * Lookup PCB in hash list. + */ +struct inpcb * +in6_pcblookup_hash(pcbinfo, faddr, fport_arg, laddr, lport_arg, wildcard, ifp) + struct inpcbinfo *pcbinfo; + struct in6_addr *faddr, *laddr; + u_int fport_arg, lport_arg; + int wildcard; + struct ifnet *ifp; +{ + struct inpcbhead *head; + register struct inpcb *inp; + u_short fport = fport_arg, lport = lport_arg; + int faith; + +#if defined(NFAITH) && NFAITH > 0 + faith = faithprefix(laddr); +#else + faith = 0; +#endif + + /* + * First look for an exact match. + */ + head = &pcbinfo->hashbase[INP_PCBHASH(faddr->s6_addr32[3] /* XXX */, + lport, fport, + pcbinfo->hashmask)]; + LIST_FOREACH(inp, head, inp_hash) { + if ((inp->inp_vflag & INP_IPV6) == 0) + continue; + if (IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, faddr) && + IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && + inp->inp_fport == fport && + inp->inp_lport == lport) { + /* + * Found. + */ + return (inp); + } + } + if (wildcard) { + struct inpcb *local_wild = NULL; + + head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0, + pcbinfo->hashmask)]; + LIST_FOREACH(inp, head, inp_hash) { + if ((inp->inp_vflag & INP_IPV6) == 0) + continue; + if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) && + inp->inp_lport == lport) { + if (faith && (inp->inp_flags & INP_FAITH) == 0) + continue; + if (IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, + laddr)) + return (inp); + else if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) + local_wild = inp; + } + } + return (local_wild); + } + + /* + * Not found. + */ + return (NULL); +} + +void +init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m) +{ + struct ip6_hdr *ip; + + ip = mtod(m, struct ip6_hdr *); + bzero(sin6, sizeof(*sin6)); + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_family = AF_INET6; + sin6->sin6_addr = ip->ip6_src; + if (IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr)) + sin6->sin6_addr.s6_addr16[1] = 0; + sin6->sin6_scope_id = + (m->m_pkthdr.rcvif && IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr)) + ? m->m_pkthdr.rcvif->if_index : 0; + + return; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_proto.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_proto.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_proto.c @@ -0,0 +1,639 @@ +//========================================================================== +// +// src/sys/netinet6/in6_proto.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: in6_proto.c,v 1.111 2001/12/21 03:32:34 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_proto.c 8.1 (Berkeley) 6/10/93 + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#ifdef RADIX_ART +#include +#elif defined(RADIX_MPATH) +#include +#endif +#include + +#include +#include +#include +#include +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || (defined(__NetBSD__) && !defined(TCP6)) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#include +#endif +#if (defined(__NetBSD__) && !defined(TCP6)) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#endif +#include +#include +#include +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__OpenBSD__) && !(defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#endif + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#include +#include +#include +#include +#if (defined(__FreeBSD__) && __FreeBSD__ >= 4) +#include +#endif +#else +#if defined(__NetBSD__) && !defined(TCP6) +#include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include +#endif +#endif + +#ifdef __FreeBSD__ +#include +#endif + +#if !defined(__OpenBSD__) && !(defined(__bsdi__) && _BSDI_VERSION >= 199802) +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 4) +#include +#endif +#include +#endif + +#include + +#include + +#ifdef IPSEC +#ifdef __OpenBSD__ +#include +#include +#include +#include +#else +#include +#include +#ifdef IPSEC_ESP +#include +#endif +#include +#endif +#endif /* IPSEC */ + +#include + +#ifdef MIP6 +#include +#endif /* MIP6 */ + +#ifndef offsetof +#define offsetof(type, member) ((size_t)(&((type *)0)->member)) +#endif + +/* + * TCP/IP protocol family: IP6, ICMP6, UDP, TCP. + */ + +extern struct domain inet6domain; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +static struct pr_usrreqs nousrreqs; +#endif + +#ifndef __NetBSD__ +#define PR_LISTEN 0 +#endif +#if !defined(__NetBSD__) && !defined(__OpenBSD__) +#define PR_ABRTACPTDIS 0 +#endif +#ifdef __OpenBSD__ +#define PR_LASTHDR 0 +#endif + +struct ip6protosw inet6sw[] = { +{ 0, &inet6domain, IPPROTO_IPV6, 0, + 0, 0, 0, 0, + 0, + ip6_init, 0, frag6_slowtimo, frag6_drain, +#ifndef __FreeBSD__ + ip6_sysctl, +#else +# if __FreeBSD__ >= 3 + &nousrreqs, +# endif +#endif +}, +{ SOCK_DGRAM, &inet6domain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR, + udp6_input, 0, udp6_ctlinput, ip6_ctloutput, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + 0, 0, +#elif defined(HAVE_NRL_INPCB) + udp6_usrreq, 0, +#else + udp6_usrreq, udp6_init, +#endif + 0, 0, 0, +#ifndef __FreeBSD__ +#ifdef HAVE_NRL_INPCB + udp_sysctl, +#else + udp6_sysctl, +#endif +#else +# if __FreeBSD__ >= 3 + &udp6_usrreqs, +# endif +#endif +}, +#ifdef TCP6 +{ SOCK_STREAM, &inet6domain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS, + tcp6_input, 0, tcp6_ctlinput, tcp6_ctloutput, + tcp6_usrreq, + tcp6_init, tcp6_fasttimo, tcp6_slowtimo, tcp6_drain, +#ifndef __FreeBSD__ + tcp6_sysctl, +#else +# if __FreeBSD__ >= 3 + &tcp6_usrreqs, +# endif +#endif +}, +#else +{ SOCK_STREAM, &inet6domain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN, + tcp6_input, 0, tcp6_ctlinput, tcp_ctloutput, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + 0, +#elif defined(HAVE_NRL_INPCB) + tcp6_usrreq, +#else + tcp_usrreq, +#endif +#ifdef INET /* don't call initialization and timeout routines twice */ + 0, 0, 0, tcp_drain, +#else + tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain, +#endif +#ifndef __FreeBSD__ + tcp_sysctl, +#else +# if __FreeBSD__ >= 3 + &tcp6_usrreqs, +# endif +#endif +}, +#endif /* TCP6 */ +{ SOCK_RAW, &inet6domain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR, + rip6_input, rip6_output, rip6_ctlinput, rip6_ctloutput, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + 0, +#else + rip6_usrreq, +#endif + 0, 0, 0, 0, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + &rip6_usrreqs +#endif +}, +{ SOCK_RAW, &inet6domain, IPPROTO_ICMPV6, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + icmp6_input, rip6_output, rip6_ctlinput, rip6_ctloutput, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + 0, +#else + rip6_usrreq, +#endif + icmp6_init, icmp6_fasttimo, 0, 0, +#ifndef __FreeBSD__ + icmp6_sysctl, +#else +# if __FreeBSD__ >= 3 + &rip6_usrreqs +# endif +#endif +}, +{ SOCK_RAW, &inet6domain, IPPROTO_DSTOPTS,PR_ATOMIC|PR_ADDR, + dest6_input, 0, 0, 0, + 0, + 0, 0, 0, 0, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + &nousrreqs +#endif +}, +{ SOCK_RAW, &inet6domain, IPPROTO_ROUTING,PR_ATOMIC|PR_ADDR, + route6_input, 0, 0, 0, + 0, + 0, 0, 0, 0, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + &nousrreqs +#endif +}, +{ SOCK_RAW, &inet6domain, IPPROTO_FRAGMENT,PR_ATOMIC|PR_ADDR, + frag6_input, 0, 0, 0, + 0, + 0, 0, 0, 0, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + &nousrreqs +#endif +}, +#ifdef IPSEC +{ SOCK_RAW, &inet6domain, IPPROTO_AH, PR_ATOMIC|PR_ADDR, + ah6_input, 0, +#ifdef __NetBSD__ + ah6_ctlinput, +#else + 0, +#endif + 0, + 0, + 0, 0, 0, 0, +#ifdef __OpenBSD__ + ah_sysctl, +#elif !defined(__FreeBSD__) + ipsec6_sysctl, +#else +# if __FreeBSD__ >= 3 + &nousrreqs, +# endif +#endif +}, +#ifdef IPSEC_ESP +{ SOCK_RAW, &inet6domain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR, + esp6_input, 0, + esp6_ctlinput, + 0, + 0, + 0, 0, 0, 0, +#ifdef __OpenBSD__ + esp_sysctl, +#elif !defined(__FreeBSD__) + ipsec6_sysctl, +#else +# if __FreeBSD__ >= 3 + &nousrreqs, +# endif +#endif +}, +#endif +#ifndef __OpenBSD__ +{ SOCK_RAW, &inet6domain, IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR, + ipcomp6_input, 0, 0, 0, + 0, + 0, 0, 0, 0, +#ifndef __FreeBSD__ + ipsec6_sysctl, +#else +# if __FreeBSD__ >= 3 + &nousrreqs, +# endif +#endif +}, +#endif /* !OpenBSD */ +#endif /* IPSEC */ +#ifdef INET +{ SOCK_RAW, &inet6domain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + encap6_input, rip6_output, encap6_ctlinput, rip6_ctloutput, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + 0, +#else + rip6_usrreq, +#endif + encap_init, 0, 0, 0, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + &rip6_usrreqs +#endif +}, +#endif /* INET */ +{ SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + encap6_input, rip6_output, encap6_ctlinput, rip6_ctloutput, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + 0, +#else + rip6_usrreq, +#endif + encap_init, 0, 0, 0, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + &rip6_usrreqs +#endif +}, +#if defined(__NetBSD__) && defined(ISO) +{ SOCK_RAW, &inet6domain, IPPROTO_EON, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + encap6_input, rip6_output, encap6_ctlinput, rip6_ctloutput, + rip6_usrreq, /* XXX */ + encap_init, 0, 0, 0, +}, +#endif +{ SOCK_RAW, &inet6domain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR|PR_LASTHDR, + pim6_input, rip6_output, 0, rip6_ctloutput, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + 0, +#else + rip6_usrreq, +#endif + 0, 0, 0, 0, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + &rip6_usrreqs +# endif +}, +/* raw wildcard */ +{ SOCK_RAW, &inet6domain, 0, PR_ATOMIC|PR_ADDR, + rip6_input, rip6_output, 0, rip6_ctloutput, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + 0, 0, +#else + rip6_usrreq, rip6_init, +#endif + 0, 0, 0, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + &rip6_usrreqs +#endif +}, +}; + +#ifdef MIP6 +struct ip6protosw mip6_tunnel_protosw = +{ SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR, + mip6_tunnel_input, rip6_output, 0, rip6_ctloutput, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + 0, +#else + rip6_usrreq, +#endif + 0, 0, 0, 0, +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + &rip6_usrreqs +#endif +}; +#endif /* MIP6 */ + +#ifdef __FreeBSD__ +extern int in6_inithead __P((void **, int)); +#endif + +struct domain inet6domain = + { AF_INET6, "internet6", 0, 0, 0, + (struct protosw *)inet6sw, + (struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])], 0, +#ifdef __FreeBSD__ + in6_inithead, +#else +#ifdef RADIX_ART + rn_art_inithead, +#elif defined(RADIX_MPATH) + rn_mpath_inithead, +#else + rn_inithead, +#endif +#endif + offsetof(struct sockaddr_in6, sin6_addr) << 3, + sizeof(struct sockaddr_in6) }; + +#ifdef __FreeBSD__ +DOMAIN_SET(inet6); +#endif + +/* + * Internet configuration info + */ +#ifndef IPV6FORWARDING +#ifdef GATEWAY6 +#define IPV6FORWARDING 1 /* forward IP6 packets not for us */ +#else +#define IPV6FORWARDING 0 /* don't forward IP6 packets not for us */ +#endif /* GATEWAY6 */ +#endif /* !IPV6FORWARDING */ + +#ifndef IPV6_SENDREDIRECTS +#define IPV6_SENDREDIRECTS 1 +#endif + +int ip6_forwarding = IPV6FORWARDING; /* act as router? */ +int ip6_sendredirects = IPV6_SENDREDIRECTS; +int ip6_defhlim = IPV6_DEFHLIM; +int ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS; +int ip6_accept_rtadv = 1; // was 0; /* "IPV6FORWARDING ? 0 : 1" is dangerous */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 +int ip6_maxfragpackets; /* initialized in frag6.c:frag6_init() */ +#else +int ip6_maxfragpackets = 200; +#endif +int ip6_log_interval = 5; +int ip6_hdrnestlimit = 50; /* appropriate? */ +int ip6_dad_count = 1; /* DupAddrDetectionTransmits */ +u_int32_t ip6_flow_seq; +int ip6_auto_flowlabel = 1; +int ip6_use_deprecated = 1; /* allow deprecated addr (RFC2462 5.5.4) */ +int ip6_rr_prune = 5; /* router renumbering prefix + * walk list every 5 sec. */ +#if defined(__NetBSD__) +int ip6_v6only = 1; +#elif defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ == 2) || (defined(__bsdi__) && _BSDI_VERSION < 199802) || defined(TCP6) +const int ip6_v6only = 1; +#else +int ip6_v6only = 0; +#endif + +u_int32_t ip6_id = 0UL; +int ip6_keepfaith = 0; +time_t ip6_log_time = (time_t)0L; + +/* icmp6 */ +#ifndef __bsdi__ +/* + * BSDI4 defines these variables in in_proto.c... + * XXX: what if we don't define INET? Should we define pmtu6_expire + * or so? (jinmei@kame.net 19990310) + */ +int pmtu_expire = 60*10; +int pmtu_probe = 60*2; +#endif + +/* raw IP6 parameters */ +/* + * Nominal space allocated to a raw ip socket. + */ +#define RIPV6SNDQ 8192 +#define RIPV6RCVQ 8192 + +u_long rip6_sendspace = RIPV6SNDQ; +u_long rip6_recvspace = RIPV6RCVQ; + +/* ICMPV6 parameters */ +int icmp6_rediraccept = 1; /* accept and process redirects */ +int icmp6_redirtimeout = 10 * 60; /* 10 minutes */ +int icmp6errppslim = 100; /* 100pps */ +int icmp6_nodeinfo = 3; /* enable/disable NI response */ + +#ifdef TCP6 +/* TCP on IP6 parameters */ +int tcp6_sendspace = 1024 * 8; +int tcp6_recvspace = 1024 * 8; +int tcp6_mssdflt = TCP6_MSS; +int tcp6_rttdflt = TCP6TV_SRTTDFLT / PR_SLOWHZ; +int tcp6_do_rfc1323 = 1; +int tcp6_conntimeo = TCP6TV_KEEP_INIT; /* initial connection timeout */ +int tcp6_43maxseg = 0; +int tcp6_pmtu = 0; + +/* + * Parameters for keepalive option. + * Connections for which SO_KEEPALIVE is set will be probed + * after being idle for a time of tcp6_keepidle (in units of PR_SLOWHZ). + * Starting at that time, the connection is probed at intervals + * of tcp6_keepintvl (same units) until a response is received + * or until tcp6_keepcnt probes have been made, at which time + * the connection is dropped. Note that a tcp6_keepidle value + * under 2 hours is nonconformant with RFC-1122, Internet Host Requirements. + */ +int tcp6_keepidle = TCP6TV_KEEP_IDLE; /* time before probing idle */ +int tcp6_keepintvl = TCP6TV_KEEPINTVL; /* interval betwn idle probes */ +int tcp6_keepcnt = TCP6TV_KEEPCNT; /* max idle probes */ +int tcp6_maxpersistidle = TCP6TV_KEEP_IDLE; /* max idle time in persist */ + +#ifndef INET_SERVER +#define TCP6_LISTEN_HASH_SIZE 17 +#define TCP6_CONN_HASH_SIZE 97 +#define TCP6_SYN_HASH_SIZE 293 +#define TCP6_SYN_BUCKET_SIZE 35 +#else +#define TCP6_LISTEN_HASH_SIZE 97 +#define TCP6_CONN_HASH_SIZE 9973 +#define TCP6_SYN_HASH_SIZE 997 +#define TCP6_SYN_BUCKET_SIZE 35 +#endif +int tcp6_listen_hash_size = TCP6_LISTEN_HASH_SIZE; +int tcp6_conn_hash_size = TCP6_CONN_HASH_SIZE; +struct tcp6_hash_list tcp6_listen_hash[TCP6_LISTEN_HASH_SIZE], + tcp6_conn_hash[TCP6_CONN_HASH_SIZE]; + +int tcp6_syn_cache_size = TCP6_SYN_HASH_SIZE; +int tcp6_syn_cache_limit = TCP6_SYN_HASH_SIZE*TCP6_SYN_BUCKET_SIZE; +int tcp6_syn_bucket_limit = 3*TCP6_SYN_BUCKET_SIZE; +struct syn_cache_head6 tcp6_syn_cache[TCP6_SYN_HASH_SIZE]; +struct syn_cache_head6 *tcp6_syn_cache_first; +int tcp6_syn_cache_interval = 8; /* runs timer every 4 seconds */ +int tcp6_syn_cache_timeo = TCP6TV_KEEP_INIT; + +/* + * Parameters for computing a desirable data segment size + * given an upper bound (either interface MTU, or peer's MSS option)_. + * As applications tend to use a buffer size that is a multiple + * of kilobytes, try for something that divides evenly. However, + * do not round down too much. + * + * Round segment size down to a multiple of TCP6_ROUNDSIZE if this + * does not result in lowering by more than (size/TCP6_ROUNDFRAC). + * For example, round 536 to 512. Older versions of the system + * effectively used MCLBYTES (1K or 2K) as TCP6_ROUNDSIZE, with + * a value of 1 for TCP6_ROUNDFRAC (eliminating its effect). + * We round to a multiple of 256 for SLIP. + */ +#ifndef TCP6_ROUNDSIZE +#define TCP6_ROUNDSIZE 256 /* round to multiple of 256 */ +#endif +#ifndef TCP6_ROUNDFRAC +#define TCP6_ROUNDFRAC 10 /* round down at most N/10, or 10% */ +#endif + +int tcp6_roundsize = TCP6_ROUNDSIZE; +int tcp6_roundfrac = TCP6_ROUNDFRAC; +#endif /* TCP6 */ + +/* UDP on IP6 parameters */ +int udp6_sendspace = 9216; /* really max datagram size */ +int udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6)); + /* 40 1K datagrams */ diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_rmx.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_rmx.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_rmx.c @@ -0,0 +1,520 @@ +//========================================================================== +// +// src/sys/netinet6/in6_rmx.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: in6_rmx.c,v 1.11 2001/07/26 06:53:16 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright 1994, 1995 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. 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 code does two things necessary for the enhanced TCP metrics to + * function in a useful manner: + * 1) It marks all non-host routes as `cloning', thus ensuring that + * every actual reference to such a route actually gets turned + * into a reference to a host route to the specific destination + * requested. + * 2) When such routes lose all their references, it arranges for them + * to be deleted in some random collection of circumstances, so that + * a large quantity of stale routing data is not kept in kernel memory + * indefinitely. See in6_rtqtimo() below for the exact mechanism. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +#include +#endif +#include + +#include +#include + +#include + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) +#include +#include +#include +#include +#else +#include +#include +#include +#include +#endif + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) +#define tcp_sendspace tcp6_sendspace +#define tcp_recvspace tcp6_recvspace +#define time_second time.tv_sec +#define tvtohz hzto +#endif + +extern int in6_inithead __P((void **head, int off)); + +#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */ + +/* + * Do what we need to do when inserting a route. + */ +static struct radix_node * +in6_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, + struct radix_node *treenodes) +{ + struct rtentry *rt = (struct rtentry *)treenodes; + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rt_key(rt); + struct radix_node *ret; + + /* + * For IPv6, all unicast non-host routes are automatically cloning. + */ + if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) + rt->rt_flags |= RTF_MULTICAST; + + if (!(rt->rt_flags & (RTF_HOST | RTF_CLONING | RTF_MULTICAST))) { + rt->rt_flags |= RTF_PRCLONING; + } + + /* + * A little bit of help for both IPv6 output and input: + * For local addresses, we make sure that RTF_LOCAL is set, + * with the thought that this might one day be used to speed up + * ip_input(). + * + * We also mark routes to multicast addresses as such, because + * it's easy to do and might be useful (but this is much more + * dubious since it's so easy to inspect the address). (This + * is done above.) + * + * XXX + * should elaborate the code. + */ + if (rt->rt_flags & RTF_HOST) { + if (IN6_ARE_ADDR_EQUAL(&satosin6(rt->rt_ifa->ifa_addr) + ->sin6_addr, + &sin6->sin6_addr)) { + rt->rt_flags |= RTF_LOCAL; + } + } + +#if __FreeBSD__ <= 2 + /* + * We also specify a send and receive pipe size for every + * route added, to help TCP a bit. TCP doesn't actually + * want a true pipe size, which would be prohibitive in memory + * costs and is hard to compute anyway; it simply uses these + * values to size its buffers. So, we fill them in with the + * same values that TCP would have used anyway, and allow the + * installing program or the link layer to override these values + * as it sees fit. This will hopefully allow TCP more + * opportunities to save its ssthresh value. + */ + if (!rt->rt_rmx.rmx_sendpipe && !(rt->rt_rmx.rmx_locks & RTV_SPIPE)) + rt->rt_rmx.rmx_sendpipe = tcp_sendspace; + + if (!rt->rt_rmx.rmx_recvpipe && !(rt->rt_rmx.rmx_locks & RTV_RPIPE)) + rt->rt_rmx.rmx_recvpipe = tcp_recvspace; +#endif + + if (!rt->rt_rmx.rmx_mtu && !(rt->rt_rmx.rmx_locks & RTV_MTU) + && rt->rt_ifp) + rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; + + ret = rn_addroute(v_arg, n_arg, head, treenodes); + if (ret == NULL && rt->rt_flags & RTF_HOST) { + struct rtentry *rt2; + /* + * We are trying to add a host route, but can't. + * Find out if it is because of an + * ARP entry and delete it if so. + */ + rt2 = rtalloc1((struct sockaddr *)sin6, 0, + RTF_CLONING | RTF_PRCLONING); + if (rt2) { + if (rt2->rt_flags & RTF_LLINFO && + rt2->rt_flags & RTF_HOST && + rt2->rt_gateway && + rt2->rt_gateway->sa_family == AF_LINK) { + rtrequest(RTM_DELETE, + (struct sockaddr *)rt_key(rt2), + rt2->rt_gateway, + rt_mask(rt2), rt2->rt_flags, 0); + ret = rn_addroute(v_arg, n_arg, head, + treenodes); + } + RTFREE(rt2); + } + } else if (ret == NULL && rt->rt_flags & RTF_CLONING) { + struct rtentry *rt2; + /* + * We are trying to add a net route, but can't. + * The following case should be allowed, so we'll make a + * special check for this: + * Two IPv6 addresses with the same prefix is assigned + * to a single interrface. + * # ifconfig if0 inet6 3ffe:0501::1 prefix 64 alias (*1) + * # ifconfig if0 inet6 3ffe:0501::2 prefix 64 alias (*2) + * In this case, (*1) and (*2) want to add the same + * net route entry, 3ffe:0501:: -> if0. + * This case should not raise an error. + */ + rt2 = rtalloc1((struct sockaddr *)sin6, 0, + RTF_CLONING | RTF_PRCLONING); + if (rt2) { + if ((rt2->rt_flags & (RTF_CLONING|RTF_HOST|RTF_GATEWAY)) + == RTF_CLONING + && rt2->rt_gateway + && rt2->rt_gateway->sa_family == AF_LINK + && rt2->rt_ifp == rt->rt_ifp) { + ret = rt2->rt_nodes; + } + RTFREE(rt2); + } + } + return ret; +} + +/* + * This code is the inverse of in6_clsroute: on first reference, if we + * were managing the route, stop doing so and set the expiration timer + * back off again. + */ +static struct radix_node * +in6_matroute(void *v_arg, struct radix_node_head *head) +{ + struct radix_node *rn = rn_match(v_arg, head); + struct rtentry *rt = (struct rtentry *)rn; + + if (rt && rt->rt_refcnt == 0) { /* this is first reference */ + if (rt->rt_flags & RTPRF_OURS) { + rt->rt_flags &= ~RTPRF_OURS; + rt->rt_rmx.rmx_expire = 0; + } + } + return rn; +} + +static int rtq_reallyold = 60*60; + /* one hour is ``really old'' */ +static int rtq_minreallyold = 10; + /* never automatically crank down to less */ +static int rtq_toomany = 128; + /* 128 cached routes is ``too many'' */ + +/* + * On last reference drop, mark the route as belong to us so that it can be + * timed out. + */ +static void +in6_clsroute(struct radix_node *rn, struct radix_node_head *head) +{ + struct rtentry *rt = (struct rtentry *)rn; + + if (!(rt->rt_flags & RTF_UP)) + return; /* prophylactic measures */ + + if ((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST) + return; + + if ((rt->rt_flags & (RTF_WASCLONED | RTPRF_OURS)) + != RTF_WASCLONED) + return; + + /* + * As requested by David Greenman: + * If rtq_reallyold is 0, just delete the route without + * waiting for a timeout cycle to kill it. + */ + if (rtq_reallyold != 0) { + rt->rt_flags |= RTPRF_OURS; + rt->rt_rmx.rmx_expire = time_second + rtq_reallyold; + } else { + rtrequest(RTM_DELETE, + (struct sockaddr *)rt_key(rt), + rt->rt_gateway, rt_mask(rt), + rt->rt_flags, 0); + } +} + +struct rtqk_arg { + struct radix_node_head *rnh; + int mode; + int updating; + int draining; + int killed; + int found; + time_t nextstop; +}; + +/* + * Get rid of old routes. When draining, this deletes everything, even when + * the timeout is not expired yet. When updating, this makes sure that + * nothing has a timeout longer than the current value of rtq_reallyold. + */ +static int +in6_rtqkill(struct radix_node *rn, void *rock) +{ + struct rtqk_arg *ap = rock; + struct rtentry *rt = (struct rtentry *)rn; + int err; + + if (rt->rt_flags & RTPRF_OURS) { + ap->found++; + + if (ap->draining || rt->rt_rmx.rmx_expire <= time_second) { + if (rt->rt_refcnt > 0) + panic("rtqkill route really not free"); + + err = rtrequest(RTM_DELETE, + (struct sockaddr *)rt_key(rt), + rt->rt_gateway, rt_mask(rt), + rt->rt_flags, 0); + if (err) { + log(LOG_WARNING, "in6_rtqkill: error %d", err); + } else { + ap->killed++; + } + } else { + if (ap->updating + && (rt->rt_rmx.rmx_expire - time_second + > rtq_reallyold)) { + rt->rt_rmx.rmx_expire = time_second + + rtq_reallyold; + } + ap->nextstop = lmin(ap->nextstop, + rt->rt_rmx.rmx_expire); + } + } + + return 0; +} + +#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ +static int rtq_timeout = RTQ_TIMEOUT; + +static void +in6_rtqtimo(void *rock) +{ + struct radix_node_head *rnh = rock; + struct rtqk_arg arg; + struct timeval atv; + static time_t last_adjusted_timeout = 0; + int s; + + arg.found = arg.killed = 0; + arg.rnh = rnh; + arg.nextstop = time_second + rtq_timeout; + arg.draining = arg.updating = 0; + s = splnet(); + rnh->rnh_walktree(rnh, in6_rtqkill, &arg); + splx(s); + + /* + * Attempt to be somewhat dynamic about this: + * If there are ``too many'' routes sitting around taking up space, + * then crank down the timeout, and see if we can't make some more + * go away. However, we make sure that we will never adjust more + * than once in rtq_timeout seconds, to keep from cranking down too + * hard. + */ + if ((arg.found - arg.killed > rtq_toomany) + && (time_second - last_adjusted_timeout >= rtq_timeout) + && rtq_reallyold > rtq_minreallyold) { + rtq_reallyold = 2*rtq_reallyold / 3; + if (rtq_reallyold < rtq_minreallyold) { + rtq_reallyold = rtq_minreallyold; + } + + last_adjusted_timeout = time_second; +#ifdef DIAGNOSTIC + log(LOG_DEBUG, "in6_rtqtimo: adjusted rtq_reallyold to %d", + rtq_reallyold); +#endif + arg.found = arg.killed = 0; + arg.updating = 1; + s = splnet(); + rnh->rnh_walktree(rnh, in6_rtqkill, &arg); + splx(s); + } + + atv.tv_usec = 0; + atv.tv_sec = arg.nextstop; + timeout(in6_rtqtimo, rock, tvtohz(&atv)); +} + +/* + * Age old PMTUs. + */ +struct mtuex_arg { + struct radix_node_head *rnh; + time_t nextstop; +}; + +static int +in6_mtuexpire(struct radix_node *rn, void *rock) +{ + struct rtentry *rt = (struct rtentry *)rn; + struct mtuex_arg *ap = rock; + + /* sanity */ + if (!rt) + panic("rt == NULL in in6_mtuexpire"); + + if (rt->rt_rmx.rmx_expire && !(rt->rt_flags & RTF_PROBEMTU)) { + if (rt->rt_rmx.rmx_expire <= time_second) { + rt->rt_flags |= RTF_PROBEMTU; + } else { + ap->nextstop = lmin(ap->nextstop, + rt->rt_rmx.rmx_expire); + } + } + + return 0; +} + +#define MTUTIMO_DEFAULT (60*1) + +static void +in6_mtutimo(void *rock) +{ + struct radix_node_head *rnh = rock; + struct mtuex_arg arg; + struct timeval atv; + int s; + + arg.rnh = rnh; + arg.nextstop = time_second + MTUTIMO_DEFAULT; + s = splnet(); + rnh->rnh_walktree(rnh, in6_mtuexpire, &arg); + splx(s); + + atv.tv_usec = 0; + atv.tv_sec = arg.nextstop; + if (atv.tv_sec < time_second) { + printf("invalid mtu expiration time on routing table\n"); + arg.nextstop = time_second + 30; /* last resort */ + } + timeout(in6_mtutimo, rock, tvtohz(&atv)); +} + +#if 0 +void +in6_rtqdrain() +{ + struct radix_node_head *rnh = rt_tables[AF_INET6]; + struct rtqk_arg arg; + int s; + arg.found = arg.killed = 0; + arg.rnh = rnh; + arg.nextstop = 0; + arg.draining = 1; + arg.updating = 0; + s = splnet(); + rnh->rnh_walktree(rnh, in6_rtqkill, &arg); + splx(s); +} +#endif + +/* + * Initialize our routing tree. + */ +int +in6_inithead(void **head, int off) +{ + struct radix_node_head *rnh; + + if (!rn_inithead(head, off)) + return 0; + + if (head != (void **)&rt_tables[AF_INET6]) /* BOGUS! */ + return 1; /* only do this for the real routing table */ + + rnh = *head; + rnh->rnh_addaddr = in6_addroute; + rnh->rnh_matchaddr = in6_matroute; + rnh->rnh_close = in6_clsroute; + in6_rtqtimo(rnh); /* kick off timeout first time */ + in6_mtutimo(rnh); /* kick off timeout first time */ + return 1; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_src.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_src.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/in6_src.c @@ -0,0 +1,1335 @@ +//========================================================================== +// +// src/sys/netinet6/in6_src.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: in6_src.c,v 1.96 2001/12/24 10:39:29 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 1991, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef MIP6 +#include +#endif /* MIP6 */ + +#if defined(__NetBSD__) +extern struct ifnet loif[NLOOP]; +#endif + +#define ADDR_LABEL_NOTAPP (-1) +struct in6_addrpolicy defaultaddrpolicy; + +int ip6_prefer_tempaddr = 0; + +#ifdef NEW_STRUCT_ROUTE +static int in6_selectif __P((struct sockaddr_in6 *, struct ip6_pktopts *, + struct ip6_moptions *, + struct route *ro, + struct ifnet **)); +#else +static int in6_selectif __P((struct sockaddr_in6 *, struct ip6_pktopts *, + struct ip6_moptions *, + struct route_in6 *ro, + struct ifnet **)); +#endif + +static struct in6_addrpolicy *lookup_addrsel_policy __P((struct sockaddr_in6 *)); + +static void init_policy_queue __P((void)); +static int add_addrsel_policyent __P((struct in6_addrpolicy *)); +static int delete_addrsel_policyent __P((struct in6_addrpolicy *)); +static struct in6_addrpolicy *match_addrsel_policy __P((struct sockaddr_in6 *)); + +/* + * Return an IPv6 address, which is the most appropriate for a given + * destination and user specified options. + * If necessary, this function lookups the routing table and returns + * an entry to the caller for later use. + */ +#define REPLACE(r) do {\ + if ((r) < sizeof(ip6stat.ip6s_sources_rule) / \ + sizeof(ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ + ip6stat.ip6s_sources_rule[(r)]++; \ + /* printf("in6_selectsrc: replace %s with %s by %d\n", ia_best ? ip6_sprintf(&ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(&ia->ia_addr.sin6_addr), (r)); */ \ + goto replace; \ +} while(0) +#define NEXT(r) do {\ + if ((r) < sizeof(ip6stat.ip6s_sources_rule) / \ + sizeof(ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ + ip6stat.ip6s_sources_rule[(r)]++; \ + /* printf("in6_selectsrc: keep %s against %s by %d\n", ia_best ? ip6_sprintf(&ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(&ia->ia_addr.sin6_addr), (r)); */ \ + goto next; /* XXX: we can't use 'continue' here */ \ +} while(0) +#define BREAK(r) do { \ + if ((r) < sizeof(ip6stat.ip6s_sources_rule) / \ + sizeof(ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ + ip6stat.ip6s_sources_rule[(r)]++; \ + goto out; /* XXX: we can't use 'break' here */ \ +} while(0) + +struct in6_addr * +in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, + struct ip6_moptions *mopts, struct route *ro, + struct ifnet **ifpp, struct in6_addr *laddr, + int *errorp) +{ + struct in6_addr *dst; + struct ifnet *ifp = NULL; + struct in6_ifaddr *ia = NULL, *ia_best = NULL; + struct in6_pktinfo *pi = NULL; + int dst_scope = -1, best_scope = -1, best_matchlen = -1; + struct in6_addrpolicy *dst_policy = NULL, *best_policy = NULL; +#ifdef MIP6 + struct hif_softc *sc; +#ifdef MIP6_ALLOW_COA_FALLBACK + struct mip6_bu *mbu_dst; + u_int8_t coafallback = 0; +#endif +#endif + + dst = &dstsock->sin6_addr; + *errorp = 0; + if (ifpp) + *ifpp = NULL; + + /* + * If the source address is explicitly specified by the caller, + * check if the requested source address is indeed a unicast address + * assigned to the node, and can be used as the packet's source + * address. If everything is okay, use the address as source. + */ + if (opts && (pi = opts->ip6po_pktinfo) && + !IN6_IS_ADDR_UNSPECIFIED(&pi->ipi6_addr)) { + struct sockaddr_in6 srcsock; + struct in6_ifaddr *ia6; + + /* get the outgoing interface */ + if ((*errorp = in6_selectif(dstsock, opts, mopts, ro, &ifp)) + != 0) { + return(NULL); + } + + /* + * determine the appropriate zone id of the source based on + * the zone of the destination and the outgoing interface. + */ + bzero(&srcsock, sizeof(srcsock)); + srcsock.sin6_family = AF_INET6; + srcsock.sin6_len = sizeof(srcsock); + srcsock.sin6_addr = pi->ipi6_addr; + if (ifp) { + int64_t zone; + + zone = in6_addr2zoneid(ifp, &pi->ipi6_addr); + if (zone < 0) { /* XXX: this should not happen */ + *errorp = EINVAL; + return(NULL); + } + srcsock.sin6_scope_id = zone; + } + if ((*errorp = in6_embedscope(&srcsock.sin6_addr, &srcsock)) + != 0) { + return(NULL); + } +#ifndef SCOPEDROUTING + srcsock.sin6_scope_id = 0; /* XXX: ifa_ifwithaddr expects 0 */ +#endif + ia6 = (struct in6_ifaddr *)ifa_ifwithaddr((struct sockaddr *)(&srcsock)); + if (ia6 == NULL || + (ia6->ia6_flags & (IN6_IFF_ANYCAST | IN6_IFF_NOTREADY))) { + *errorp = EADDRNOTAVAIL; + return(NULL); + } + pi->ipi6_addr = srcsock.sin6_addr; /* XXX: this overrides pi */ + if (*ifpp) + *ifpp = ifp; + return(&pi->ipi6_addr); + } + + /* + * Otherwise, if the socket has already bound the source, just use it. + */ + if (laddr && !IN6_IS_ADDR_UNSPECIFIED(laddr)) + return(laddr); + + /* + * If the address is not specified, choose the best one based on + * the outgoing interface and the destination address. + */ + /* get the outgoing interface */ + if ((*errorp = in6_selectif(dstsock, opts, mopts, ro, &ifp)) != 0) + return(NULL); + +#ifdef MIP6 +#ifdef MIP6_ALLOW_COA_FALLBACK + for (sc = TAILQ_FIRST(&hif_softc_list); + sc; + sc = TAILQ_NEXT(sc, hif_entry)) { + mbu_dst = mip6_bu_list_find_withpaddr(&sc->hif_bu_list, dst); + if (mbu_dst != NULL) + coafallback = mbu_dst->mbu_coafallback; + } +#endif /* MIP6_ALLOW_COA_FALLBACK */ +#endif /* MIP6 */ + +#ifdef DIAGNOSTIC + if (ifp == NULL) /* this should not happen */ + panic("in6_selectsrc: NULL ifp"); +#endif + for (ia = in6_ifaddr; ia; ia = ia->ia_next) { + int new_scope = -1, new_matchlen = -1; + struct in6_addrpolicy *new_policy = NULL; + int64_t srczone, dstzone; + struct ifnet *ifp1 = ia->ia_ifp; + + /* + * We'll never take an address that breaks the scope zone + * of the destination. We also skip an address if its zone + * does not contain the outgoing interface. + * XXX: we should probably use sin6_scope_id here. + */ + if ((dstzone = in6_addr2zoneid(ifp1, dst)) < 0 || + dstzone != in6_addr2zoneid(ifp, dst)) { + continue; + } + if ((srczone = in6_addr2zoneid(ifp1, &ia->ia_addr.sin6_addr)) + < 0 || + srczone != in6_addr2zoneid(ifp, &ia->ia_addr.sin6_addr)) { + continue; + } + + /* avoid unusable addresses */ + if ((ia->ia6_flags & + (IN6_IFF_NOTREADY | IN6_IFF_ANYCAST | IN6_IFF_DETACHED))) { + continue; + } + if (!ip6_use_deprecated && IFA6_IS_DEPRECATED(ia)) + continue; + + /* Rule 1: Prefer same address */ + if (IN6_ARE_ADDR_EQUAL(dst, &ia->ia_addr.sin6_addr)) { + ia_best = ia; + BREAK(1); /* there should be no better candidate */ + } + + if (ia_best == NULL) + REPLACE(0); + + /* Rule 2: Prefer appropriate scope */ + if (dst_scope < 0) + dst_scope = in6_addrscope(dst); + new_scope = in6_addrscope(&ia->ia_addr.sin6_addr); + if (IN6_ARE_SCOPE_CMP(best_scope, new_scope) < 0) { + if (IN6_ARE_SCOPE_CMP(best_scope, dst_scope) < 0) + REPLACE(2); + NEXT(2); + } else if (IN6_ARE_SCOPE_CMP(new_scope, best_scope) < 0) { + if (IN6_ARE_SCOPE_CMP(new_scope, dst_scope) < 0) + NEXT(2); + REPLACE(2); + } + + /* + * Rule 3: Avoid deprecated addresses. Note that the case of + * !ip6_use_deprecated is already rejected above. + */ + if (!IFA6_IS_DEPRECATED(ia_best) && IFA6_IS_DEPRECATED(ia)) + NEXT(3); + if (IFA6_IS_DEPRECATED(ia_best) && !IFA6_IS_DEPRECATED(ia)) + REPLACE(3); + + /* Rule 4: Prefer home addresses */ + /* + * XXX: This is a TODO. We should probably merge the MIP6 + * case above. + */ +#ifdef MIP6 + /* + * If SA is simultaneously a home address and care-of address + * and SB is not, then prefer SA. Similarly, if SB is + * simultaneously a home address and care-of address and SA is + * not, then prefer SB. + */ + { + struct mip6_bu *mbu_ia_best = NULL, *mbu_ia = NULL; + + if (ia_best->ia6_flags & IN6_IFF_HOME) { + /* + * find a binding update entry for ia_best. + */ + for (sc = TAILQ_FIRST(&hif_softc_list); + sc; + sc = TAILQ_NEXT(sc, hif_entry)) { + mbu_ia_best = mip6_bu_list_find_home_registration( + &sc->hif_bu_list, + &ia->ia_addr.sin6_addr); + if (mbu_ia_best) + break; + } + } + if (ia->ia6_flags & IN6_IFF_HOME) { + /* + * find a binding update entry for ia. + */ + for (sc = TAILQ_FIRST(&hif_softc_list); + sc; + sc = TAILQ_NEXT(sc, hif_entry)) { + mbu_ia = mip6_bu_list_find_home_registration( + &sc->hif_bu_list, + &ia->ia_addr.sin6_addr); + if (mbu_ia) + break; + } + } + /* + * if the binding update entry for a certain address + * exists and its registration status is + * MIP6_BU_REG_STATE_NOTREG, the address is a home + * address and a care of addres simultaneously. + */ + if ((mbu_ia_best && + (mbu_ia_best->mbu_reg_state + == MIP6_BU_REG_STATE_NOTREG)) + && + !(mbu_ia && + (mbu_ia->mbu_reg_state + == MIP6_BU_REG_STATE_NOTREG))) { + NEXT(4); + } + if (!(mbu_ia_best && + (mbu_ia_best->mbu_reg_state + == MIP6_BU_REG_STATE_NOTREG)) + && + (mbu_ia && + (mbu_ia->mbu_reg_state + == MIP6_BU_REG_STATE_NOTREG))) { + REPLACE(4); + } + } +#ifdef MIP6_ALLOW_COA_FALLBACK + if (coafallback) { + /* + * if the peer doesn't recognize a home + * address destination option, we will use a + * CoA as a source address instead of a home + * address we have registered before. Though + * this behavior may arouse a mip6 beleiver's + * anger, is very useful in the current + * transition period that many hosts don't + * recognize a home address destination + * option... + */ + if ((ia_best->ia6_flags & IN6_IFF_HOME) == 0 && + (ia->ia6_flags & IN6_IFF_HOME) != 0) { + /* XXX will break stat! */ + NEXT(0); + } + if ((ia_best->ia6_flags & IN6_IFF_HOME) != 0 && + (ia->ia6_flags & IN6_IFF_HOME) == 0) { + /* XXX will break stat! */ + REPLACE(0); + } + } else +#endif + { + /* + * If SA is just a home address and SB is just + * a care-of address, then prefer + * SA. Similarly, if SB is just a home address + * and SA is just a care-of address, then + * prefer SB. + */ + if ((ia_best->ia6_flags & IN6_IFF_HOME) != 0 && + (ia->ia6_flags & IN6_IFF_HOME) == 0) { + NEXT(4); + } + if ((ia_best->ia6_flags & IN6_IFF_HOME) == 0 && + (ia->ia6_flags & IN6_IFF_HOME) != 0) { + REPLACE(4); + } + } +#endif /* MIP6 */ + + /* Rule 5: Prefer outgoing interface */ + if (ia_best->ia_ifp == ifp && ia->ia_ifp != ifp) + NEXT(5); + if (ia_best->ia_ifp != ifp && ia->ia_ifp == ifp) + REPLACE(5); + + /* + * Rule 6: Prefer matching label + * Note that best_policy should be non-NULL here. + */ + if (dst_policy == NULL) + dst_policy = lookup_addrsel_policy(dstsock); + if (dst_policy->label != ADDR_LABEL_NOTAPP) { + new_policy = lookup_addrsel_policy(&ia->ia_addr); + if (dst_policy->label == best_policy->label && + dst_policy->label != new_policy->label) + NEXT(6); + if (dst_policy->label != best_policy->label && + dst_policy->label == new_policy->label) + REPLACE(6); + } + + /* + * Rule 7: Prefer public addresses. + * We allow users to reverse the logic by configuring + * a sysctl variable, so that privacy conscious users can + * always prefer temporary addresses. + */ + if (!(ia_best->ia6_flags & IN6_IFF_TEMPORARY) && + (ia->ia6_flags & IN6_IFF_TEMPORARY)) { + if (ip6_prefer_tempaddr) + REPLACE(7); + else + NEXT(7); + } + if ((ia_best->ia6_flags & IN6_IFF_TEMPORARY) && + !(ia->ia6_flags & IN6_IFF_TEMPORARY)) { + if (ip6_prefer_tempaddr) + NEXT(7); + else + REPLACE(7); + } + + /* + * Rule 8: prefer addresses on alive interfaces. + * This is a KAME specific rule. + */ + if ((ia_best->ia_ifp->if_flags & IFF_UP) && + !(ia->ia_ifp->if_flags & IFF_UP)) + NEXT(8); + if (!(ia_best->ia_ifp->if_flags & IFF_UP) && + (ia->ia_ifp->if_flags & IFF_UP)) + REPLACE(8); + + /* + * Rule 9: prefer addresses on "preferred" interfaces. + * This is a KAME specific rule. + */ +#define NDI_BEST (nd_ifinfo[ia_best->ia_ifp->if_index]) +#define NDI_NEW (nd_ifinfo[ia->ia_ifp->if_index]) + if ((NDI_BEST.flags & ND6_IFF_PREFER_SOURCE) && + !(NDI_NEW.flags & ND6_IFF_PREFER_SOURCE)) + NEXT(9); + if (!(NDI_BEST.flags & ND6_IFF_PREFER_SOURCE) && + (NDI_NEW.flags & ND6_IFF_PREFER_SOURCE)) + REPLACE(9); +#undef NDI_BEST +#undef NDI_NEW + + /* + * Rule 14: Use longest matching prefix. + * Note: in the address selection draft, this rule is + * documented as "Rule 8". However, since it is also + * documented that this rule can be overridden, we assign + * a large number so that it is easy to assign smaller numbers + * to more preferred rules. + */ + new_matchlen = in6_matchlen(&ia->ia_addr.sin6_addr, dst); + if (best_matchlen < new_matchlen) + REPLACE(14); + if (new_matchlen < best_matchlen) + NEXT(14); + + /* Rule 15 is reserved. */ + + /* + * Last resort: just keep the current candidate. + * Or, do we need more rules? + */ + continue; + + replace: + ia_best = ia; + best_scope = (new_scope >= 0 ? new_scope : + in6_addrscope(&ia_best->ia_addr.sin6_addr)); + best_policy = (new_policy ? new_policy : + lookup_addrsel_policy(&ia_best->ia_addr)); + best_matchlen = (new_matchlen >= 0 ? new_matchlen : + in6_matchlen(&ia_best->ia_addr.sin6_addr, + dst)); + + next: + continue; + + out: + break; + } + + if ((ia = ia_best) == NULL) { + *errorp = EADDRNOTAVAIL; + return(NULL); + } + + if (ifpp) + *ifpp = ifp; + return(&ia->ia_addr.sin6_addr); +} +#undef REPLACE +#undef BREAK +#undef NEXT + +static int +in6_selectif(dstsock, opts, mopts, ro, retifp) + struct sockaddr_in6 *dstsock; + struct ip6_pktopts *opts; + struct ip6_moptions *mopts; +#ifdef NEW_STRUCT_ROUTE + struct route *ro; +#else + struct route_in6 *ro; +#endif + struct ifnet **retifp; +{ + int error, clone; + struct rtentry *rt = NULL; + + clone = IN6_IS_ADDR_MULTICAST(&dstsock->sin6_addr) ? 0 : 1; + if ((error = in6_selectroute(dstsock, opts, mopts, ro, retifp, + &rt, clone)) != 0) { + return(error); + } + /* + * Adjust the "outgoing" interface. If we're going to loop the packet + * back to ourselves, the ifp would be the loopback interface. + * However, we'd rather know the interface associated to the + * destination address (which should probably be one of our own + * addresses.) + */ + if (rt && rt->rt_ifa && rt->rt_ifa->ifa_ifp) + *retifp = rt->rt_ifa->ifa_ifp; + + return(0); +} + +int +in6_selectroute(dstsock, opts, mopts, ro, retifp, retrt, clone) + struct sockaddr_in6 *dstsock; + struct ip6_pktopts *opts; + struct ip6_moptions *mopts; +#ifdef NEW_STRUCT_ROUTE + struct route *ro; +#else + struct route_in6 *ro; +#endif + struct ifnet **retifp; + struct rtentry **retrt; + int clone; /* meaningful only for bsdi and freebsd. */ +{ + int error = 0; + struct ifnet *ifp = NULL; + struct rtentry *rt = NULL; + struct sockaddr_in6 *sin6_next; + struct in6_pktinfo *pi = NULL; + struct in6_addr *dst = &dstsock->sin6_addr; + + /* If the caller specify the outgoing interface explicitly, use it. */ + if (opts && (pi = opts->ip6po_pktinfo) != NULL && pi->ipi6_ifindex) { + /* XXX boundary check is assumed to be already done. */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + ifp = ifnet_byindex(pi->ipi6_ifindex); +#else + ifp = ifindex2ifnet[pi->ipi6_ifindex]; +#endif + if (ifp != NULL && + (retrt == NULL || IN6_IS_ADDR_MULTICAST(dst))) { + /* + * we do not have to check nor get the route for + * multicast. + */ + goto done; + } else + goto getroute; + } + + /* + * If the destination address is a multicast address and the outgoing + * interface for the address is specified by the caller, use it. + */ + if (IN6_IS_ADDR_MULTICAST(dst) && + mopts != NULL && (ifp = mopts->im6o_multicast_ifp) != NULL) { + goto done; /* we do not need a route for multicast. */ + } + + getroute: + /* + * If the next hop address for the packet is specified by the caller, + * use it as the gateway. + */ + if (opts && opts->ip6po_nexthop) { +#ifdef NEW_STRUCT_ROUTE + struct route *ron; +#else + struct route_in6 *ron; +#endif + + sin6_next = satosin6(opts->ip6po_nexthop); + + /* at this moment, we only support AF_INET6 next hops */ + if (sin6_next->sin6_family != AF_INET6) { + error = EAFNOSUPPORT; /* or should we proceed? */ + goto done; + } + + /* + * If the next hop is an IPv6 address, then the node identified + * by that address must be a neighbor of the sending host. + */ + ron = &opts->ip6po_nextroute; + if ((ron->ro_rt && + (ron->ro_rt->rt_flags & (RTF_UP | RTF_LLINFO)) != + (RTF_UP | RTF_LLINFO)) || + !SA6_ARE_ADDR_EQUAL(satosin6(&ron->ro_dst), sin6_next)) { + if (ron->ro_rt) { + RTFREE(ron->ro_rt); + ron->ro_rt = NULL; + } + *satosin6(&ron->ro_dst) = *sin6_next; + } + if (ron->ro_rt == NULL) { + rtalloc((struct route *)ron); /* multi path case? */ + if (ron->ro_rt == NULL || + !(ron->ro_rt->rt_flags & RTF_LLINFO)) { + if (ron->ro_rt) { + RTFREE(ron->ro_rt); + ron->ro_rt = NULL; + } + error = EHOSTUNREACH; + goto done; + } + } + rt = ron->ro_rt; + ifp = rt->rt_ifp; + + /* + * When cloning is required, try to allocate a route to the + * destination so that the caller can store path MTU + * information. + */ + if (!clone) + goto done; + } + + /* + * Use a cached route if it exists and is valid, else try to allocate + * a new one. + */ + if (ro) { + int newroute = 0; + + if (ro->ro_rt && + (!(ro->ro_rt->rt_flags & RTF_UP) || + !IN6_ARE_ADDR_EQUAL(&satosin6(&ro->ro_dst)->sin6_addr, + dst))) { + RTFREE(ro->ro_rt); + ro->ro_rt = (struct rtentry *)NULL; + } + if (ro->ro_rt == (struct rtentry *)NULL) { + struct sockaddr_in6 *sa6; + + /* No route yet, so try to acquire one */ + newroute = 1; + bzero(&ro->ro_dst, sizeof(struct sockaddr_in6)); + sa6 = (struct sockaddr_in6 *)&ro->ro_dst; + sa6->sin6_family = AF_INET6; + sa6->sin6_len = sizeof(struct sockaddr_in6); + sa6->sin6_addr = *dst; +#ifdef SCOPEDROUTING + sa6->sin6_scope_id = dstsock->sin6_scope_id; +#endif + if (clone) { +#ifdef __bsdi__ + rtcalloc((struct route *)ro); +#else /* !bsdi */ +#ifdef RADIX_MPATH + rtalloc_mpath((struct route *)ro, + ntohl(dstsock->sin6_addr.s6_addr32[3])); +#else + rtalloc((struct route *)ro); +#endif /* RADIX_MPATH */ +#endif /* bsdi */ + } else { +#ifdef __FreeBSD__ + ro->ro_rt = rtalloc1(&((struct route *)ro) + ->ro_dst, (int)NULL, 0UL); +#else +#ifdef RADIX_MPATH + rtalloc_mpath((struct route *)ro, + ntohl(dstsock->sin6_addr.s6_addr32[3])); +#else + ro->ro_rt = rtalloc1(&((struct route *)ro) + ->ro_dst, NULL); +#endif /* RADIX_MPATH */ +#endif /* __FreeBSD__ */ + } + } + + /* + * do not care about the result if we have the nexthop + * explicitly specified. + */ + if (opts && opts->ip6po_nexthop) + goto done; + + if (ro->ro_rt) { + ifp = ro->ro_rt->rt_ifp; + + if (ifp == NULL) { /* can this really happen? */ + RTFREE(ro->ro_rt); + ro->ro_rt = NULL; + } + } + if (ro->ro_rt == NULL) + error = EHOSTUNREACH; + rt = ro->ro_rt; + + /* + * Check if the outgoing interface conflicts with + * the interface specified by ipi6_ifindex (if specified). + * Note that loopback interface is always okay. + * (this may happen when we are sending a packet to one of + * our own addresses.) + */ + if (opts && opts->ip6po_pktinfo + && opts->ip6po_pktinfo->ipi6_ifindex) { + if (!(ifp->if_flags & IFF_LOOPBACK) && + ifp->if_index != + opts->ip6po_pktinfo->ipi6_ifindex) { + error = EHOSTUNREACH; + goto done; + } + } + } + + done: + if (error == EHOSTUNREACH) + ip6stat.ip6s_noroute++; + + if (retifp != NULL) + *retifp = ifp; + if (retrt != NULL) + *retrt = rt; /* rt may be NULL */ + + return(error); +} + +/* + * Default hop limit selection. The precedence is as follows: + * 1. Hoplimit value specified via ioctl. + * 2. (If the outgoing interface is detected) the current + * hop limit of the interface specified by router advertisement. + * 3. The system default hoplimit. +*/ +#ifdef HAVE_NRL_INPCB +#define in6pcb inpcb +#define in6p_hops inp_hops +#endif +int +in6_selecthlim(struct in6pcb *in6p, struct ifnet *ifp) +{ + if (in6p && in6p->in6p_hops >= 0) + return(in6p->in6p_hops); + else if (ifp) + return(nd_ifinfo[ifp->if_index].chlim); + else + return(ip6_defhlim); +} +#ifdef HAVE_NRL_INPCB +#undef in6pcb +#undef in6p_hops +#endif + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__OpenBSD__) +/* + * Find an empty port and set it to the specified PCB. + */ +#ifdef HAVE_NRL_INPCB /* XXX: I really hate such ugly macros...(jinmei) */ +#define in6pcb inpcb +#define in6p_socket inp_socket +#define in6p_lport inp_lport +#define in6p_head inp_head +#define in6p_flags inp_flags +#define IN6PLOOKUP_WILDCARD INPLOOKUP_WILDCARD +#endif +int +in6_pcbsetport(struct in6_addr *laddr, struct in6pcb *in6p) +{ + struct socket *so = in6p->in6p_socket; + struct in6pcb *head = in6p->in6p_head; + u_int16_t last_port, lport = 0; + int wild = 0; + void *t; + u_int16_t min, max; + + /* XXX: this is redundant when called from in6_pcbbind */ + if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0 && + ((so->so_proto->pr_flags & PR_CONNREQUIRED) == 0 || + (so->so_options & SO_ACCEPTCONN) == 0)) + wild = IN6PLOOKUP_WILDCARD; + + if (in6p->in6p_flags & IN6P_LOWPORT) { + min = ip6_lowportmin; + max = ip6_lowportmax; + } else { + min = ip6_anonportmin; + max = ip6_anonportmax; + } + + /* value out of range */ + if (head->in6p_lport < min) + head->in6p_lport = min; + else if (head->in6p_lport > max) + head->in6p_lport = min; + last_port = head->in6p_lport; + goto startover; /*to randomize*/ + for (;;) { + lport = htons(head->in6p_lport); + if (IN6_IS_ADDR_V4MAPPED(laddr)) { +#ifdef HAVE_NRL_INPCB +#ifdef INPLOOKUP_WILDCARD6 + wild &= ~INPLOOKUP_WILDCARD6; +#endif +#endif +#if 0 + t = in_pcblookup_bind(&tcbtable, + (struct in_addr *)&in6p->in6p_laddr.s6_addr32[3], + lport); +#else + t = NULL; +#endif + } else { +#ifdef HAVE_NRL_INPCB +#ifdef INPLOOKUP_WILDCARD4 + wild &= ~INPLOOKUP_WILDCARD4; +#endif + /* XXX: ugly cast... */ + t = in_pcblookup(head, (struct in_addr *)&zeroin6_addr, + 0, (struct in_addr *)laddr, + lport, wild | INPLOOKUP_IPV6); +#else + t = in6_pcblookup(head, &zeroin6_addr, 0, laddr, + lport, wild); +#endif + } + if (t == 0) + break; + startover: + if (head->in6p_lport >= max) + head->in6p_lport = min; + else + head->in6p_lport++; + if (head->in6p_lport == last_port) + return (EADDRINUSE); + } + + in6p->in6p_lport = lport; + return(0); /* success */ +} +#ifdef HAVE_NRL_INPCB +#undef in6pcb +#undef in6p_socket +#undef in6p_lport +#undef in6p_head +#undef in6p_flags +#undef IN6PLOOKUP_WILDCARD +#endif +#endif /* !FreeBSD3 && !OpenBSD*/ + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) +/* + * XXX: this is borrowed from in6_pcbbind(). If possible, we should + * share this function by all *bsd*... + */ +int +in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct proc *p) +{ + struct socket *so = inp->inp_socket; + u_int16_t lport = 0, first, last, *lastport; + int count, wild = 0; + struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; + + /* XXX: this is redundant when called from in6_pcbbind */ + if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0) + wild = INPLOOKUP_WILDCARD; + + inp->inp_flags |= INP_ANONPORT; + + if (inp->inp_flags & INP_HIGHPORT) { + first = ipport_hifirstauto; /* sysctl */ + last = ipport_hilastauto; + lastport = &pcbinfo->lasthi; + } else if (inp->inp_flags & INP_LOWPORT) { + first = ipport_lowfirstauto; /* 1023 */ + last = ipport_lowlastauto; /* 600 */ + lastport = &pcbinfo->lastlow; + } else { + first = ipport_firstauto; /* sysctl */ + last = ipport_lastauto; + lastport = &pcbinfo->lastport; + } + /* + * Simple check to ensure all ports are not used up causing + * a deadlock here. + * + * We split the two cases (up and down) so that the direction + * is not being tested on each round of the loop. + */ + if (first > last) { + /* + * counting down + */ + count = first - last; + + do { + if (count-- < 0) { /* completely used? */ + /* + * Undo any address bind that may have + * occurred above. + */ + inp->in6p_laddr = in6addr_any; + return (EAGAIN); + } + --*lastport; + if (*lastport > first || *lastport < last) + *lastport = first; + lport = htons(*lastport); + } while (in6_pcblookup_local(pcbinfo, + &inp->in6p_laddr, lport, wild)); + } else { + /* + * counting up + */ + count = last - first; + + do { + if (count-- < 0) { /* completely used? */ + /* + * Undo any address bind that may have + * occurred above. + */ + inp->in6p_laddr = in6addr_any; + return (EAGAIN); + } + ++*lastport; + if (*lastport < first || *lastport > last) + *lastport = first; + lport = htons(*lastport); + } while (in6_pcblookup_local(pcbinfo, + &inp->in6p_laddr, lport, wild)); + } + + inp->inp_lport = lport; + if (in_pcbinshash(inp) != 0) { + inp->in6p_laddr = in6addr_any; + inp->inp_lport = 0; + return (EAGAIN); + } + + return(0); +} +#endif + +/* + * Generate kernel-internal form (scopeid embedded into s6_addr16[1]). + * If the address scope of is interface-local or link-local, embed the + * interface index in the address. + * + * This function should be nuked in the future, when we get rid of embedded + * scopeid thing. + */ +int +in6_embedscope(in6, sin6) + struct in6_addr *in6; + const struct sockaddr_in6 *sin6; +{ +#ifdef SCOPEDROUTING + /* + * XXX: the SCOPEDROUTING code path is NOT expected to work at this + * moment (20011112). We added this just in case. + */ + return(0); /* do nothing */ +#else + struct ifnet *ifp; + u_int32_t zoneid = sin6->sin6_scope_id; + + *in6 = sin6->sin6_addr; + + /* + * don't try to read sin6->sin6_addr beyond here, since the caller may + * ask us to overwrite existing sockaddr_in6 + */ + + if (IN6_IS_SCOPE_LINKLOCAL(in6) || IN6_IS_ADDR_MC_INTFACELOCAL(in6)) { + /* KAME assumption: link id == interface id */ + if (zoneid) { + if (if_index < zoneid) + return(ENXIO); /* XXX EINVAL? */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + ifp = ifnet_byindex(zoneid); +#else + ifp = ifindex2ifnet[zoneid]; +#endif + if (ifp == NULL) /* XXX: this can happen for some OS */ + return(ENXIO); + + /* XXX assignment to 16bit from 32bit variable */ + in6->s6_addr16[1] = htons(zoneid & 0xffff); + } + } + + return 0; +#endif +} + +/* + * generate standard sockaddr_in6 from embedded form. + * touches sin6_addr and sin6_scope_id only. + * + * this function should be nuked in the future, when we get rid of + * embedded scopeid thing. + */ +int +in6_recoverscope(sin6, in6, ifp) + struct sockaddr_in6 *sin6; + const struct in6_addr *in6; + struct ifnet *ifp; +{ + u_int32_t zoneid; + + sin6->sin6_addr = *in6; + + /* + * don't try to read *in6 beyond here, since the caller may + * ask us to overwrite existing sockaddr_in6 + */ + + sin6->sin6_scope_id = 0; + if (IN6_IS_SCOPE_LINKLOCAL(in6) || IN6_IS_ADDR_MC_INTFACELOCAL(in6)) { + /* + * KAME assumption: link id == interface id + */ + zoneid = ntohs(sin6->sin6_addr.s6_addr16[1]); + if (zoneid) { + /* sanity check */ + if (zoneid < 0 || if_index < zoneid) + return ENXIO; + if (ifp && ifp->if_index != zoneid) + return ENXIO; + sin6->sin6_addr.s6_addr16[1] = 0; + sin6->sin6_scope_id = zoneid; + } + } + + return 0; +} + +/* + * just clear the embedded scope identifer. + * XXX: currently used for bsdi4 only as a supplement function. + */ +void +in6_clearscope(addr) + struct in6_addr *addr; +{ + if (IN6_IS_SCOPE_LINKLOCAL(addr) || IN6_IS_ADDR_MC_INTFACELOCAL(addr)) + addr->s6_addr16[1] = 0; +} + +void +addrsel_policy_init() +{ + init_policy_queue(); + + /* initialize the "last resort" policy */ + bzero(&defaultaddrpolicy, sizeof(defaultaddrpolicy)); + defaultaddrpolicy.label = ADDR_LABEL_NOTAPP; +} + +static struct in6_addrpolicy * +lookup_addrsel_policy(key) + struct sockaddr_in6 *key; +{ + struct in6_addrpolicy *match = NULL; + + match = match_addrsel_policy(key); + + if (match == NULL) + match = &defaultaddrpolicy; + else + match->use++; + + return(match); +} + + +int +in6_src_ioctl(cmd, data) + u_long cmd; + caddr_t data; +{ + int i; + struct in6_addrpolicy ent0; + + if (cmd != SIOCAADDRCTL_POLICY && cmd != SIOCDADDRCTL_POLICY) + return(EOPNOTSUPP); /* check for safety */ + + ent0 = *(struct in6_addrpolicy *)data; + + if (ent0.label == ADDR_LABEL_NOTAPP) + return(EINVAL); + /* check if the prefix mask is consecutive. */ + if (in6_mask2len(&ent0.addrmask.sin6_addr, NULL) < 0) + return(EINVAL); + /* clear trailing garbages (if any) of the prefix address. */ + for (i = 0; i < 4; i++) { + ent0.addr.sin6_addr.s6_addr32[i] &= + ent0.addrmask.sin6_addr.s6_addr32[i]; + } + ent0.use = 0; + + switch (cmd) { + case SIOCAADDRCTL_POLICY: + return(add_addrsel_policyent(&ent0)); + case SIOCDADDRCTL_POLICY: + return(delete_addrsel_policyent(&ent0)); + } + + return(0); /* XXX: compromise compilers */ +} + +/* + * The followings are implementation of the policy table using a + * simple tail queue. + * XXX such details should be hidden. + * XXX implementation using binary tree should be more efficient. + */ +struct addrsel_policyent { + TAILQ_ENTRY(addrsel_policyent) ape_entry; + struct in6_addrpolicy ape_policy; +}; + +TAILQ_HEAD(addrsel_policyhead, addrsel_policyent); + +struct addrsel_policyhead addrsel_policytab; + +static void +init_policy_queue() +{ + TAILQ_INIT(&addrsel_policytab); +} + +static int +add_addrsel_policyent(newpolicy) + struct in6_addrpolicy *newpolicy; +{ + struct addrsel_policyent *new, *pol; + + /* duplication check */ + for (pol = TAILQ_FIRST(&addrsel_policytab); pol; + pol = TAILQ_NEXT(pol, ape_entry)) { + if (SA6_ARE_ADDR_EQUAL(&newpolicy->addr, + &pol->ape_policy.addr) && + SA6_ARE_ADDR_EQUAL(&newpolicy->addrmask, + &pol->ape_policy.addrmask)) { + return(EEXIST); /* or override it? */ + } + } + + MALLOC(new, struct addrsel_policyent *, sizeof(*new), M_IFADDR, + M_WAITOK); + bzero(new, sizeof(*new)); + + /* XXX: should validate entry */ + new->ape_policy = *newpolicy; + + TAILQ_INSERT_TAIL(&addrsel_policytab, new, ape_entry); + + return(0); +} + +static int +delete_addrsel_policyent(key) + struct in6_addrpolicy *key; +{ + struct addrsel_policyent *pol; + + /* search for the entry in the table */ + for (pol = TAILQ_FIRST(&addrsel_policytab); pol; + pol = TAILQ_NEXT(pol, ape_entry)) { + if (SA6_ARE_ADDR_EQUAL(&key->addr, &pol->ape_policy.addr) && + SA6_ARE_ADDR_EQUAL(&key->addrmask, + &pol->ape_policy.addrmask)) { + break; + } + } + if (pol == NULL) + return(ESRCH); + + TAILQ_REMOVE(&addrsel_policytab, pol, ape_entry); + + return(0); +} + +void +_show_addrsel_policy(void) +{ + struct addrsel_policyent *pol; + + log(LOG_ADDR, "IPv6 address policy table\n"); + for (pol = TAILQ_FIRST(&addrsel_policytab); pol; + pol = TAILQ_NEXT(pol, ape_entry)) { + log(LOG_ADDR, "Addr: \n"); + log_dump(LOG_ADDR, &pol->ape_policy.addr, 16); + log(LOG_ADDR, "Mask:\n"); + log_dump(LOG_ADDR, &pol->ape_policy.addrmask, 16); + } +} + +static struct in6_addrpolicy * +match_addrsel_policy(key) + struct sockaddr_in6 *key; +{ + struct addrsel_policyent *pent; + struct in6_addrpolicy *bestpol = NULL, *pol; + int matchlen, bestmatchlen = -1; + u_char *mp, *ep, *k, *p, m; + + for (pent = TAILQ_FIRST(&addrsel_policytab); pent; + pent = TAILQ_NEXT(pent, ape_entry)) { + matchlen = 0; + + pol = &pent->ape_policy; + mp = (u_char *)&pol->addrmask.sin6_addr; + ep = mp + 16; /* XXX: scope field? */ + k = (u_char *)&key->sin6_addr; + p = (u_char *)&pol->addr.sin6_addr; + for (; mp < ep && *mp; mp++, k++, p++) { + m = *mp; + if ((*k & m) != *p) + goto next; /* not match */ + if (m == 0xff) /* short cut for a typical case */ + matchlen += 8; + else { + while(m >= 0x80) { + matchlen++; + m <<= 1; + } + } + } + + /* matched. check if this is better than the current best. */ + if (bestpol == NULL || + matchlen > bestmatchlen) { + bestpol = pol; + bestmatchlen = matchlen; + } + + next: + continue; + } + + return(bestpol); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_forward.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_forward.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_forward.c @@ -0,0 +1,750 @@ +//========================================================================== +// +// src/sys/netinet6/ip6_forward.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip6_forward.c,v 1.87 2001/12/18 01:30:43 keiichi Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#endif +#if !((defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)) +#include +#endif + +#ifdef __OpenBSD__ +#if NPF > 0 +#include +#endif +#endif + +#ifdef __OpenBSD__ /* KAME IPSEC */ +#undef IPSEC +#endif + +#ifdef IPSEC +#include +#include +#endif /* IPSEC */ + +#if defined(IPV6FIREWALL) || (defined(__FreeBSD__) && __FreeBSD__ >= 4) +#include +#endif +#if defined(__NetBSD__) && defined(PFIL_HOOKS) +#include +#endif + +#ifdef MIP6 +#include +extern struct mip6_bc_list mip6_bc_list; +#endif /* MIP6 */ + +//#include + +#ifdef NEW_STRUCT_ROUTE +struct route ip6_forward_rt; +#else +struct route_in6 ip6_forward_rt; +#endif + +#ifdef MEASURE_PERFORMANCE +#define OURS_CHECK_ALG_RTABLE 0 /* XXX: duplicated def. */ + +extern int ip6_logentry; +extern int ip6_logsize; +extern unsigned long long ip6_performance_log[]; +extern long long ip6_performance_log2[]; +extern int ip6_ours_check_algorithm; + +int ip6_forward_cache_miss; + +static unsigned long long ctr_beg, ctr_end; + +static __inline unsigned long long read_tsc __P((void)); +static __inline void add_performance_log2 __P((unsigned long long)); + +/* XXX: duplicated code */ +static __inline unsigned long long +read_tsc(void) +{ + unsigned int h,l; + /* read Pentium counter */ + __asm__(".byte 0x0f,0x31" :"=a" (l), "=d" (h)); + return ((unsigned long long)h<<32) | l; +} + +static __inline void +add_performance_log2(val) + unsigned long long val; +{ + ip6_performance_log[ip6_logentry] += val; + ip6_performance_log2[ip6_logentry] = val; +} +#endif + +/* + * Forward a packet. If some error occurs return the sender + * an icmp packet. Note we can't always generate a meaningful + * icmp message because icmp doesn't have a large enough repertoire + * of codes and types. + * + * If not forwarding, just drop the packet. This could be confusing + * if ipforwarding was zero but some routing protocol was advancing + * us as a gateway to somewhere. However, we must let the routing + * protocol deal with that. + * + */ + +void +ip6_forward(m, srcrt) + struct mbuf *m; + int srcrt; +{ + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct sockaddr_in6 *dst; + struct rtentry *rt; + int error, type = 0, code = 0; + struct mbuf *mcopy = NULL; + struct ifnet *origifp; /* maybe unnecessary */ + int64_t srczone, dstzone; +#ifdef IPSEC + struct secpolicy *sp = NULL; +#endif +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + +#ifdef IPSEC + /* + * Check AH/ESP integrity. + */ + /* + * Don't increment ip6s_cantforward because this is the check + * before forwarding packet actually. + */ + if (ipsec6_in_reject(m, NULL)) { + ipsec6stat.in_polvio++; + m_freem(m); + return; + } +#endif /* IPSEC */ + + /* + * Do not forward packets to multicast destination (should be handled + * by ip6_mforward(). + * Do not forward packets with unspecified source. It was discussed + * in July 2000, on ipngwg mailing list. + */ + if ((m->m_flags & (M_BCAST|M_MCAST)) != 0 || + IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || + IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { + ip6stat.ip6s_cantforward++; + /* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard) */ + if (ip6_log_time + ip6_log_interval < time_second) { + ip6_log_time = time_second; + log(LOG_DEBUG, + "cannot forward " + "from %s to %s nxt %d received on %s\n", + ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), + ip6->ip6_nxt, + if_name(m->m_pkthdr.rcvif)); + } + m_freem(m); + return; + } + + if (ip6->ip6_hlim <= IPV6_HLIMDEC) { + /* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard) */ + icmp6_error(m, ICMP6_TIME_EXCEEDED, + ICMP6_TIME_EXCEED_TRANSIT, 0); + return; + } + ip6->ip6_hlim -= IPV6_HLIMDEC; + + /* + * Save at most ICMPV6_PLD_MAXLEN (= the min IPv6 MTU - + * size of IPv6 + ICMPv6 headers) bytes of the packet in case + * we need to generate an ICMP6 message to the src. + * Thanks to M_EXT, in most cases copy will not occur. + * + * It is important to save it before IPsec processing as IPsec + * processing may modify the mbuf. + */ + mcopy = m_copy(m, 0, imin(m->m_pkthdr.len, ICMPV6_PLD_MAXLEN)); + +#ifdef IPSEC + /* get a security policy for this packet */ + sp = ipsec6_getpolicybyaddr(m, IPSEC_DIR_OUTBOUND, IP_FORWARDING, + &error); + if (sp == NULL) { + ipsec6stat.out_inval++; + ip6stat.ip6s_cantforward++; + if (mcopy) { +#if 0 + /* XXX: what icmp ? */ +#else + m_freem(mcopy); +#endif + } + m_freem(m); + return; + } + + error = 0; + + /* check policy */ + switch (sp->policy) { + case IPSEC_POLICY_DISCARD: + /* + * This packet is just discarded. + */ + ipsec6stat.out_polvio++; + ip6stat.ip6s_cantforward++; + key_freesp(sp); + if (mcopy) { +#if 0 + /* XXX: what icmp ? */ +#else + m_freem(mcopy); +#endif + } + m_freem(m); + return; + + case IPSEC_POLICY_BYPASS: + case IPSEC_POLICY_NONE: + /* no need to do IPsec. */ + key_freesp(sp); + goto skip_ipsec; + + case IPSEC_POLICY_IPSEC: + if (sp->req == NULL) { + /* XXX should be panic ? */ + printf("ip6_forward: No IPsec request specified.\n"); + ip6stat.ip6s_cantforward++; + key_freesp(sp); + if (mcopy) { +#if 0 + /* XXX: what icmp ? */ +#else + m_freem(mcopy); +#endif + } + m_freem(m); + return; + } + /* do IPsec */ + break; + + case IPSEC_POLICY_ENTRUST: + default: + /* should be panic ?? */ + printf("ip6_forward: Invalid policy found. %d\n", sp->policy); + key_freesp(sp); + goto skip_ipsec; + } + + { + struct ipsec_output_state state; + + /* + * All the extension headers will become inaccessible + * (since they can be encrypted). + * Don't panic, we need no more updates to extension headers + * on inner IPv6 packet (since they are now encapsulated). + * + * IPv6 [ESP|AH] IPv6 [extension headers] payload + */ + bzero(&state, sizeof(state)); + state.m = m; + state.ro = NULL; /* update at ipsec6_output_tunnel() */ + state.dst = NULL; /* update at ipsec6_output_tunnel() */ + + error = ipsec6_output_tunnel(&state, sp, 0); + + m = state.m; + key_freesp(sp); + + if (error) { + /* mbuf is already reclaimed in ipsec6_output_tunnel. */ + switch (error) { + case EHOSTUNREACH: + case ENETUNREACH: + case EMSGSIZE: + case ENOBUFS: + case ENOMEM: + break; + default: + printf("ip6_output (ipsec): error code %d\n", error); + /* fall through */ + case ENOENT: + /* don't show these error codes to the user */ + break; + } + ip6stat.ip6s_cantforward++; + if (mcopy) { +#if 0 + /* XXX: what icmp ? */ +#else + m_freem(mcopy); +#endif + } + m_freem(m); + return; + } + } + skip_ipsec: +#endif /* IPSEC */ + +#ifdef MIP6 + { + /* + * intercept and tunnel packets for home addresses + * which we are acting as a home agent for. + */ + struct mip6_bc *mbc; + + mbc = mip6_bc_list_find_withphaddr(&mip6_bc_list, + &ip6->ip6_dst); + if (mbc && + (mbc->mbc_flags & IP6_BUF_HOME) && + (mbc->mbc_encap != NULL)) { + /* + * if we have a binding cache entry for the + * ip6_dst, we are acting as a home agent for + * that node. before sending a packet as a + * tunneled packet, we must make sure that + * encaptab is ready. if dad is enabled and + * not completed yet, encaptab will be NULL. + */ + if (mip6_tunnel_output(&m, mbc) != 0) { + ip6stat.ip6s_cantforward++; + } + if (mcopy) + m_freem(mcopy); + return; + } + } +#endif /* MIP6 */ + + dst = (struct sockaddr_in6 *)&ip6_forward_rt.ro_dst; + if (!srcrt) { +#ifdef MEASURE_PERFORMANCE + ctr_beg = read_tsc(); +#endif + + /* + * ip6_forward_rt.ro_dst.sin6_addr is equal to ip6->ip6_dst + */ + if (ip6_forward_rt.ro_rt == 0 || + (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) == 0 +#ifdef MEASURE_PERFORMANCE + || (ip6_ours_check_algorithm != OURS_CHECK_ALG_RTABLE && + !IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &dst->sin6_addr)) +#endif + ) { + if (ip6_forward_rt.ro_rt) { + RTFREE(ip6_forward_rt.ro_rt); + ip6_forward_rt.ro_rt = 0; + } +#ifdef MEASURE_PERFORMANCE + ip6_forward_cache_miss++; + bzero(dst, sizeof(*dst)); + dst->sin6_family = AF_INET6; + dst->sin6_len = sizeof(*dst); + dst->sin6_addr = ip6->ip6_dst; +#endif + /* this probably fails but give it a try again */ +#ifdef __FreeBSD__ + rtalloc_ign((struct route *)&ip6_forward_rt, + RTF_PRCLONING); +#else + rtalloc((struct route *)&ip6_forward_rt); +#endif + } + +#ifdef MEASURE_PERFORMANCE + ctr_end = read_tsc(); +#ifdef MEASURE_PERFORMANCE_UDPONLY + if (ip6->ip6_nxt == IPPROTO_UDP) +#endif + add_performance_log2(ctr_end - ctr_beg); +#endif + + if (ip6_forward_rt.ro_rt == 0) { + ip6stat.ip6s_noroute++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute); + if (mcopy) { + icmp6_error(mcopy, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_NOROUTE, 0); + } + m_freem(m); + return; + } + } else if ((rt = ip6_forward_rt.ro_rt) == 0 || + !IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &dst->sin6_addr)) { + if (ip6_forward_rt.ro_rt) { + RTFREE(ip6_forward_rt.ro_rt); + ip6_forward_rt.ro_rt = 0; + } + bzero(dst, sizeof(*dst)); + dst->sin6_len = sizeof(struct sockaddr_in6); + dst->sin6_family = AF_INET6; + dst->sin6_addr = ip6->ip6_dst; + +#ifdef __FreeBSD__ + rtalloc_ign((struct route *)&ip6_forward_rt, RTF_PRCLONING); +#else + rtalloc((struct route *)&ip6_forward_rt); +#endif + if (ip6_forward_rt.ro_rt == 0) { + ip6stat.ip6s_noroute++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute); + if (mcopy) { + icmp6_error(mcopy, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_NOROUTE, 0); + } + m_freem(m); + return; + } + } + rt = ip6_forward_rt.ro_rt; + + /* + * Scope check: if a packet can't be delivered to its destination + * for the reason that the destination is beyond the scope of the + * source address, discard the packet and return an icmp6 destination + * unreachable error with Code 2 (beyond scope of source address). + * [draft-ietf-ipngwg-icmp-v3-00.txt, Section 3.1] + */ + if ((srczone = in6_addr2zoneid(m->m_pkthdr.rcvif, &ip6->ip6_src)) < 0 + || (dstzone = in6_addr2zoneid(rt->rt_ifp, &ip6->ip6_src)) < 0) { + /* XXX: will this really happen? should return an icmp error? */ + ip6stat.ip6s_cantforward++; + ip6stat.ip6s_badscope++; + m_freem(m); + return; + } + if (srczone != dstzone) { + ip6stat.ip6s_cantforward++; + ip6stat.ip6s_badscope++; + in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard); + + if (ip6_log_time + ip6_log_interval < time_second) { + ip6_log_time = time_second; + log(LOG_DEBUG, + "cannot forward " + "src %s, dst %s, nxt %d, rcvif %s, outif %s\n", + ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), + ip6->ip6_nxt, + if_name(m->m_pkthdr.rcvif), if_name(rt->rt_ifp)); + } + if (mcopy) + icmp6_error(mcopy, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_BEYONDSCOPE, 0); + m_freem(m); + return; + } + + if (m->m_pkthdr.len > rt->rt_ifp->if_mtu) { + in6_ifstat_inc(rt->rt_ifp, ifs6_in_toobig); + if (mcopy) { + u_long mtu; +#ifdef IPSEC + struct secpolicy *sp; + int ipsecerror; + size_t ipsechdrsiz; +#endif + + mtu = rt->rt_ifp->if_mtu; +#ifdef IPSEC + /* + * When we do IPsec tunnel ingress, we need to play + * with if_mtu value (decrement IPsec header size + * from mtu value). The code is much simpler than v4 + * case, as we have the outgoing interface for + * encapsulated packet as "rt->rt_ifp". + */ + sp = ipsec6_getpolicybyaddr(mcopy, IPSEC_DIR_OUTBOUND, + IP_FORWARDING, &ipsecerror); + if (sp) { + ipsechdrsiz = ipsec6_hdrsiz(mcopy, + IPSEC_DIR_OUTBOUND, NULL); + if (ipsechdrsiz < mtu) + mtu -= ipsechdrsiz; + } + + /* + * if mtu becomes less than minimum MTU, + * tell minimum MTU (and I'll need to fragment it). + */ + if (mtu < IPV6_MMTU) + mtu = IPV6_MMTU; +#endif + icmp6_error(mcopy, ICMP6_PACKET_TOO_BIG, 0, mtu); + } + m_freem(m); + return; + } + + if (rt->rt_flags & RTF_GATEWAY) + dst = (struct sockaddr_in6 *)rt->rt_gateway; + + /* + * If we are to forward the packet using the same interface + * as one we got the packet from, perhaps we should send a redirect + * to sender to shortcut a hop. + * Only send redirect if source is sending directly to us, + * and if packet was not source routed (or has any options). + * Also, don't send redirect if forwarding using a route + * modified by a redirect. + */ + if (rt->rt_ifp == m->m_pkthdr.rcvif && !srcrt && + (rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0) { + if ((rt->rt_ifp->if_flags & IFF_POINTOPOINT) && + nd6_is_addr_neighbor((struct sockaddr_in6 *)&ip6_forward_rt.ro_dst, rt->rt_ifp)) { + /* + * If the incoming interface is equal to the outgoing + * one, the link attached to the interface is + * point-to-point, and the IPv6 destination is + * regarded as on-link on the link, then it will be + * highly probable that the destination address does + * not exist on the link and that the packet is going + * to loop. Thus, we immediately drop the packet and + * send an ICMPv6 error message. + * For other routing loops, we dare to let the packet + * go to the loop, so that a remote diagnosing host + * can detect the loop by traceroute. + * type/code is based on suggestion by Rich Draves. + * not sure if it is the best pick. + */ + icmp6_error(mcopy, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_ADDR, 0); + m_freem(m); + return; + } + type = ND_REDIRECT; + } + +#if defined(IPV6FIREWALL) || (defined(__FreeBSD__) && __FreeBSD__ >= 4) + /* + * Check with the firewall... + */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 + if (ip6_fw_enable && ip6_fw_chk_ptr) { +#else + if (ip6_fw_chk_ptr) { +#endif + /* If ipfw says divert, we have to just drop packet */ + if ((*ip6_fw_chk_ptr)(&ip6, rt->rt_ifp, &m)) { + m_freem(m); + goto freecopy; + } + if (!m) + goto freecopy; + } +#endif + + /* + * Fake scoped addresses. Note that even link-local source or + * destinaion can appear, if the originating node just sends the + * packet to us (without address resolution for the destination). + * Since both icmp6_error and icmp6_redirect_output fill the embedded + * link identifiers, we can do this stuff after making a copy for + * returning an error. + */ + if ((rt->rt_ifp->if_flags & IFF_LOOPBACK) != 0) { + /* + * See corresponding comments in ip6_output. + * XXX: but is it possible that ip6_forward() sends a packet + * to a loopback interface? I don't think so, and thus + * I bark here. (jinmei@kame.net) + * XXX: it is common to route invalid packets to loopback. + * also, the codepath will be visited on use of ::1 in + * rthdr. (itojun) + */ +#if 1 + if (0) +#else + if ((rt->rt_flags & (RTF_BLACKHOLE|RTF_REJECT)) == 0) +#endif + { + printf("ip6_forward: outgoing interface is loopback. " + "src %s, dst %s, nxt %d, rcvif %s, outif %s\n", + ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), + ip6->ip6_nxt, if_name(m->m_pkthdr.rcvif), + if_name(rt->rt_ifp)); + } + + /* we can just use rcvif in forwarding. */ + origifp = m->m_pkthdr.rcvif; + } + else + origifp = rt->rt_ifp; +#ifndef SCOPEDROUTING + /* + * clear embedded scope identifiers if necessary. + * in6_clearscope will touch the addresses only when necessary. + */ + in6_clearscope(&ip6->ip6_src); + in6_clearscope(&ip6->ip6_dst); +#endif + +#if defined(__NetBSD__) && defined(PFIL_HOOKS) + { + struct packet_filter_hook *pfh; + struct mbuf *m1; + int rv; + + /* + * Run through list of hooks for output packets. + */ + m1 = m; + pfh = pfil_hook_get(PFIL_OUT, &inetsw[ip_protox[IPPROTO_IPV6]].pr_pfh); + for (; pfh; pfh = pfh->pfil_link.tqe_next) + if (pfh->pfil_func) { + rv = pfh->pfil_func(ip6, sizeof(*ip6), rt->rt_ifp, 1, &m1); + if (rv) { + error = EHOSTUNREACH; + goto senderr; + } + m = m1; + if (m == NULL) + goto freecopy; + ip6 = mtod(m, struct ip6_hdr *); + } + } +#endif /* PFIL_HOOKS */ + +#if defined(__OpenBSD__) && NPF > 0 + if (pf_test6(PF_OUT, rt->rt_ifp, &m) != PF_PASS) { + m_freem(m); + goto senderr; + } + ip6 = mtod(m, struct ip6_hdr *); +#endif + + error = nd6_output(rt->rt_ifp, origifp, m, dst, rt); + if (error) { + in6_ifstat_inc(rt->rt_ifp, ifs6_out_discard); + ip6stat.ip6s_cantforward++; + } else { + ip6stat.ip6s_forward++; + in6_ifstat_inc(rt->rt_ifp, ifs6_out_forward); + if (type) + ip6stat.ip6s_redirectsent++; + else { + if (mcopy) + goto freecopy; + } + } + +#if (defined(__NetBSD__) && defined(PFIL_HOOKS)) || (defined(__OpenBSD__) && NPF > 0) + senderr: +#endif + if (mcopy == NULL) + return; + switch (error) { + case 0: +#if 1 + if (type == ND_REDIRECT) { + icmp6_redirect_output(mcopy, rt); + return; + } +#endif + goto freecopy; + + case EMSGSIZE: + /* xxx MTU is constant in PPP? */ + goto freecopy; + + case ENOBUFS: + /* Tell source to slow down like source quench in IP? */ + goto freecopy; + + case ENETUNREACH: /* shouldn't happen, checked above */ + case EHOSTUNREACH: + case ENETDOWN: + case EHOSTDOWN: + default: + type = ICMP6_DST_UNREACH; + code = ICMP6_DST_UNREACH_ADDR; + break; + } + icmp6_error(mcopy, type, code, 0); + return; + + freecopy: + m_freem(mcopy); + return; +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_fw.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_fw.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_fw.c @@ -0,0 +1,1389 @@ +//========================================================================== +// +// src/sys/netinet6/ip6_fw.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip6_fw.c,v 1.29 2001/12/18 02:23:44 itojun Exp $ */ + +/* + * Copyright (C) 1998, 1999, 2000 and 2001 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1993 Daniel Boulet + * Copyright (c) 1994 Ugen J.S.Antsilevich + * Copyright (c) 1996 Alex Nash + * + * Redistribution and use in source forms, with and without modification, + * are permitted provided that this entire comment appears intact. + * + * Redistribution in binary form may occur without any restrictions. + * Obviously, it would be nice if you gave credit where credit is due + * but requiring it would be too onerous. + * + * This software is provided ``AS IS'' without any warranties of any kind. + */ + +/* + * Implement IPv6 packet firewall + */ + +#ifdef IP6DIVERT +#error "NOT SUPPORTED IPV6 DIVERT" +#endif +#ifdef IP6FW_DIVERT_RESTART +#error "NOT SUPPORTED IPV6 DIVERT" +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +#include +#endif +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#ifdef TCP6 +#include +#include +#include +#endif +#include +#include +#include +#include +#include +#include + +#if defined(__NetBSD__) || defined(__OpenBSD__) +#include +#endif +#ifdef __FreeBSD__ +#include +#endif + +#include + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +MALLOC_DEFINE(M_IP6FW, "Ip6Fw/Ip6Acct", "Ip6Fw/Ip6Acct chain's"); +#else +#ifndef M_IP6FW +#define M_IP6FW M_TEMP +#endif +#endif + +#ifndef LOG_SECURITY +#define LOG_SECURITY LOG_AUTH +#endif +static int fw6_debug = 1; +#ifdef IPV6FIREWALL_VERBOSE +static int fw6_verbose = 1; +#else +static int fw6_verbose = 0; +#endif +#ifdef IPV6FIREWALL_VERBOSE_LIMIT +static int fw6_verbose_limit = IPV6FIREWALL_VERBOSE_LIMIT; +#else +static int fw6_verbose_limit = 0; +#endif + +LIST_HEAD (ip6_fw_head, ip6_fw_chain) ip6_fw_chain; + +#ifdef SYSCTL_NODE +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 +SYSCTL_DECL(_net_inet6_ip6); +#endif +SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, fw, CTLFLAG_RW, 0, "Firewall"); +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 +SYSCTL_INT(_net_inet6_ip6_fw, OID_AUTO, enable, CTLFLAG_RW, + &ip6_fw_enable, 0, "Enable ip6fw"); +#endif +SYSCTL_INT(_net_inet6_ip6_fw, OID_AUTO, debug, CTLFLAG_RW, &fw6_debug, 0, ""); +SYSCTL_INT(_net_inet6_ip6_fw, OID_AUTO, verbose, CTLFLAG_RW, &fw6_verbose, 0, ""); +SYSCTL_INT(_net_inet6_ip6_fw, OID_AUTO, verbose_limit, CTLFLAG_RW, &fw6_verbose_limit, 0, ""); +#endif + +#define dprintf(a) do { \ + if (fw6_debug) \ + printf a; \ + } while (0) +#define SNPARGS(buf, len) buf + len, sizeof(buf) > len ? sizeof(buf) - len : 0 + +static int add_entry6 __P((struct ip6_fw_head *chainptr, struct ip6_fw *frwl)); +static int del_entry6 __P((struct ip6_fw_head *chainptr, u_short number)); +static int zero_entry6 __P((struct mbuf *m)); +static struct ip6_fw *check_ip6fw_struct __P((struct ip6_fw *m)); +static struct ip6_fw *check_ip6fw_mbuf __P((struct mbuf *fw)); +static int ip6opts_match __P((struct ip6_hdr **ip6, struct ip6_fw *f, + struct mbuf **m, + int *off, int *nxt, u_short *offset)); +static int port_match6 __P((u_short *portptr, int nports, u_short port, + int range_flag)); +static int tcp6flg_match __P((struct tcphdr *tcp6, struct ip6_fw *f)); +static int icmp6type_match __P((struct icmp6_hdr * icmp, struct ip6_fw * f)); +static void ip6fw_report __P((struct ip6_fw *f, struct ip6_hdr *ip6, + struct ifnet *rif, struct ifnet *oif, int off, int nxt)); + +static int ip6_fw_chk __P((struct ip6_hdr **pip6, struct ifnet *oif, + struct mbuf **m)); +static int ip6_fw_ctl __P((int stage, struct mbuf **mm)); + +static char err_prefix[] = "ip6_fw_ctl:"; + +/* + * Returns 1 if the port is matched by the vector, 0 otherwise + */ +static +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +__inline +#else +inline +#endif +int +port_match6(u_short *portptr, int nports, u_short port, int range_flag) +{ + if (!nports) + return 1; + if (range_flag) { + if (portptr[0] <= port && port <= portptr[1]) { + return 1; + } + nports -= 2; + portptr += 2; + } + while (nports-- > 0) { + if (*portptr++ == port) { + return 1; + } + } + return 0; +} + +static int +tcp6flg_match(struct tcphdr *tcp6, struct ip6_fw *f) +{ + u_char flg_set, flg_clr; + + /* + * If an established connection is required, reject packets that + * have only SYN of RST|ACK|SYN set. Otherwise, fall through to + * other flag requirements. + */ + if ((f->fw_ipflg & IPV6_FW_IF_TCPEST) && + ((tcp6->th_flags & (IPV6_FW_TCPF_RST | IPV6_FW_TCPF_ACK | + IPV6_FW_TCPF_SYN)) == IPV6_FW_TCPF_SYN)) + return 0; + + flg_set = tcp6->th_flags & f->fw_tcpf; + flg_clr = tcp6->th_flags & f->fw_tcpnf; + + if (flg_set != f->fw_tcpf) + return 0; + if (flg_clr) + return 0; + + return 1; +} + +static int +icmp6type_match(struct icmp6_hdr *icmp6, struct ip6_fw *f) +{ + int type; + + if (!(f->fw_flg & IPV6_FW_F_ICMPBIT)) + return(1); + + type = icmp6->icmp6_type; + + /* check for matching type in the bitmap */ + if (type < IPV6_FW_ICMPTYPES_DIM * sizeof(unsigned) * 8 && + (f->fw_icmp6types[type / (sizeof(unsigned) * 8)] & + (1U << (type % (8 * sizeof(unsigned)))))) + return(1); + + return(0); /* no match */ +} + +static int +is_icmp6_query(struct ip6_hdr *ip6, int off) +{ + const struct icmp6_hdr *icmp6; + int icmp6_type; + + icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off); + icmp6_type = icmp6->icmp6_type; + + if (icmp6_type == ICMP6_ECHO_REQUEST || + icmp6_type == ICMP6_MEMBERSHIP_QUERY || + icmp6_type == ICMP6_WRUREQUEST || + icmp6_type == ICMP6_FQDN_QUERY || + icmp6_type == ICMP6_NI_QUERY) + return(1); + + return(0); +} + +static int +ip6opts_match(struct ip6_hdr **pip6, struct ip6_fw *f, struct mbuf **m, + int *off, int *nxt, u_short *offset) +{ + int len; + struct ip6_hdr *ip6 = *pip6; + struct ip6_ext *ip6e; + u_char opts, nopts, nopts_sve; + + opts = f->fw_ip6opt; + nopts = nopts_sve = f->fw_ip6nopt; + + *nxt = ip6->ip6_nxt; + *off = sizeof(struct ip6_hdr); + len = ntohs(ip6->ip6_plen) + sizeof(struct ip6_hdr); + while (*off < len) { + ip6e = (struct ip6_ext *)((caddr_t) ip6 + *off); + if ((*m)->m_len < *off + sizeof(*ip6e)) + goto opts_check; /* XXX */ + + switch (*nxt) { + case IPPROTO_FRAGMENT: + if ((*m)->m_len >= *off + sizeof(struct ip6_frag)) { + struct ip6_frag *ip6f; + + ip6f = (struct ip6_frag *) ((caddr_t)ip6 + *off); + *offset = ip6f->ip6f_offlg & IP6F_OFF_MASK; + } + opts &= ~IPV6_FW_IP6OPT_FRAG; + nopts &= ~IPV6_FW_IP6OPT_FRAG; + *off += sizeof(struct ip6_frag); + break; + case IPPROTO_AH: + opts &= ~IPV6_FW_IP6OPT_AH; + nopts &= ~IPV6_FW_IP6OPT_AH; + *off += (ip6e->ip6e_len + 2) << 2; + break; + default: + switch (*nxt) { + case IPPROTO_HOPOPTS: + opts &= ~IPV6_FW_IP6OPT_HOPOPT; + nopts &= ~IPV6_FW_IP6OPT_HOPOPT; + break; + case IPPROTO_ROUTING: + opts &= ~IPV6_FW_IP6OPT_ROUTE; + nopts &= ~IPV6_FW_IP6OPT_ROUTE; + break; + case IPPROTO_ESP: + opts &= ~IPV6_FW_IP6OPT_ESP; + nopts &= ~IPV6_FW_IP6OPT_ESP; + break; + case IPPROTO_NONE: + opts &= ~IPV6_FW_IP6OPT_NONXT; + nopts &= ~IPV6_FW_IP6OPT_NONXT; + goto opts_check; + break; + case IPPROTO_DSTOPTS: + opts &= ~IPV6_FW_IP6OPT_OPTS; + nopts &= ~IPV6_FW_IP6OPT_OPTS; + break; + default: + goto opts_check; + break; + } + *off += (ip6e->ip6e_len + 1) << 3; + break; + } + *nxt = ip6e->ip6e_nxt; + + } + opts_check: + if (f->fw_ip6opt == f->fw_ip6nopt) /* XXX */ + return 1; + + if (opts == 0 && nopts == nopts_sve) + return 1; + else + return 0; +} + +static +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +__inline +#else +inline +#endif +int +iface_match(struct ifnet *ifp, union ip6_fw_if *ifu, int byname) +{ + /* Check by name or by IP address */ + if (byname) { +#ifdef __NetBSD__ + { + char xname[IFNAMSIZ]; + snprintf(xname, sizeof(xname), "%s%d", ifu->fu_via_if.name, + ifu->fu_via_if.unit); + if (strcmp(ifp->if_xname, xname)) + return(0); + } +#else + /* Check unit number (-1 is wildcard) */ + if (ifu->fu_via_if.unit != -1 + && ifp->if_unit != ifu->fu_via_if.unit) + return(0); + /* Check name */ + if (strncmp(ifp->if_name, ifu->fu_via_if.name, IP6FW_IFNLEN)) + return(0); +#endif + return(1); + } else if (!IN6_IS_ADDR_UNSPECIFIED(&ifu->fu_via_ip6)) { /* Zero == wildcard */ + struct ifaddr *ia; + +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ia = ifp->if_addrlist; ia; ia = ia->ifa_next) +#else + for (ia = ifp->if_addrlist.tqh_first; ia; ia = ia->ifa_list.tqe_next) +#endif + { + + if (ia->ifa_addr == NULL) + continue; + if (ia->ifa_addr->sa_family != AF_INET6) + continue; + if (!IN6_ARE_ADDR_EQUAL(&ifu->fu_via_ip6, + &(((struct sockaddr_in6 *) + (ia->ifa_addr))->sin6_addr))) + continue; + return(1); + } + return(0); + } + return(1); +} + +static void +ip6fw_report(struct ip6_fw *f, struct ip6_hdr *ip6, + struct ifnet *rif, struct ifnet *oif, int off, int nxt) +{ + static int counter; + struct tcphdr *const tcp6 = (struct tcphdr *) ((caddr_t) ip6+ off); + struct udphdr *const udp = (struct udphdr *) ((caddr_t) ip6+ off); + struct icmp6_hdr *const icmp6 = (struct icmp6_hdr *) ((caddr_t) ip6+ off); + int count; + char *action; + char action2[32], proto[102], name[18]; + int len; + + count = f ? f->fw_pcnt : ++counter; + if (fw6_verbose_limit != 0 && count > fw6_verbose_limit) + return; + + /* Print command name */ + snprintf(SNPARGS(name, 0), "ip6fw: %d", f ? f->fw_number : -1); + + action = action2; + if (!f) + action = "Refuse"; + else { + switch (f->fw_flg & IPV6_FW_F_COMMAND) { + case IPV6_FW_F_DENY: + action = "Deny"; + break; + case IPV6_FW_F_REJECT: + if (f->fw_reject_code == IPV6_FW_REJECT_RST) + action = "Reset"; + else + action = "Unreach"; + break; + case IPV6_FW_F_ACCEPT: + action = "Accept"; + break; + case IPV6_FW_F_COUNT: + action = "Count"; + break; + case IPV6_FW_F_DIVERT: + snprintf(SNPARGS(action2, 0), "Divert %d", + f->fw_divert_port); + break; + case IPV6_FW_F_TEE: + snprintf(SNPARGS(action2, 0), "Tee %d", + f->fw_divert_port); + break; + case IPV6_FW_F_SKIPTO: + snprintf(SNPARGS(action2, 0), "SkipTo %d", + f->fw_skipto_rule); + break; + default: + action = "UNKNOWN"; + break; + } + } + + switch (nxt) { + case IPPROTO_TCP: + len = snprintf(SNPARGS(proto, 0), "TCP [%s]", + ip6_sprintf(&ip6->ip6_src)); + if (off > 0) + len += snprintf(SNPARGS(proto, len), ":%d ", + ntohs(tcp6->th_sport)); + else + len += snprintf(SNPARGS(proto, len), " "); + len += snprintf(SNPARGS(proto, len), "[%s]", + ip6_sprintf(&ip6->ip6_dst)); + if (off > 0) + snprintf(SNPARGS(proto, len), ":%d", + ntohs(tcp6->th_dport)); + break; + case IPPROTO_UDP: + len = snprintf(SNPARGS(proto, 0), "UDP [%s]", + ip6_sprintf(&ip6->ip6_src)); + if (off > 0) + len += snprintf(SNPARGS(proto, len), ":%d ", + ntohs(udp->uh_sport)); + else + len += snprintf(SNPARGS(proto, len), " "); + len += snprintf(SNPARGS(proto, len), "[%s]", + ip6_sprintf(&ip6->ip6_dst)); + if (off > 0) + snprintf(SNPARGS(proto, len), ":%d", + ntohs(udp->uh_dport)); + break; + case IPPROTO_ICMPV6: + if (off > 0) + len = snprintf(SNPARGS(proto, 0), "IPV6-ICMP:%u.%u ", + icmp6->icmp6_type, icmp6->icmp6_code); + else + len = snprintf(SNPARGS(proto, 0), "IPV6-ICMP "); + len += snprintf(SNPARGS(proto, len), "[%s]", + ip6_sprintf(&ip6->ip6_src)); + snprintf(SNPARGS(proto, len), " [%s]", + ip6_sprintf(&ip6->ip6_dst)); + break; + default: + len = snprintf(SNPARGS(proto, 0), "P:%d [%s]", nxt, + ip6_sprintf(&ip6->ip6_src)); + snprintf(SNPARGS(proto, len), " [%s]", + ip6_sprintf(&ip6->ip6_dst)); + break; + } + + if (oif) + log(LOG_SECURITY | LOG_INFO, "%s %s %s out via %s\n", + name, action, proto, if_name(oif)); + else if (rif) + log(LOG_SECURITY | LOG_INFO, "%s %s %s in via %s\n", + name, action, proto, if_name(rif)); + else + log(LOG_SECURITY | LOG_INFO, "%s %s %s", + name, action, proto); + if (fw6_verbose_limit != 0 && count == fw6_verbose_limit) + log(LOG_SECURITY | LOG_INFO, "ip6fw: limit reached on entry %d\n", + f ? f->fw_number : -1); +} + +/* + * Parameters: + * + * ip Pointer to packet header (struct ip6_hdr *) + * hlen Packet header length + * oif Outgoing interface, or NULL if packet is incoming + * *m The packet; we set to NULL when/if we nuke it. + * + * Return value: + * + * 0 The packet is to be accepted and routed normally OR + * the packet was denied/rejected and has been dropped; + * in the latter case, *m is equal to NULL upon return. + * port Divert the packet to port. + */ + +static int +ip6_fw_chk(struct ip6_hdr **pip6, + struct ifnet *oif, struct mbuf **m) +{ + struct ip6_fw_chain *chain; + struct ip6_fw *rule = NULL; + struct ip6_hdr *ip6 = *pip6; + struct ifnet *const rif = (*m)->m_pkthdr.rcvif; + u_short offset = 0; + int off = sizeof(struct ip6_hdr), nxt = ip6->ip6_nxt; + u_short src_port, dst_port; +#ifdef IP6FW_DIVERT_RESTART + u_int16_t skipto = 0; +#else + u_int16_t ignport = 0; +#endif + + /* + * Go down the chain, looking for enlightment + * #ifdef IP6FW_DIVERT_RESTART + * If we've been asked to start at a given rule immediatly, do so. + * #endif + */ + chain = LIST_FIRST(&ip6_fw_chain); +#ifdef IP6FW_DIVERT_RESTART + if (skipto) { + if (skipto >= 65535) + goto dropit; + while (chain && (chain->rule->fw_number <= skipto)) { + chain = LIST_NEXT(chain, chain); + } + if (! chain) goto dropit; + } +#endif /* IP6FW_DIVERT_RESTART */ + for (; chain; chain = LIST_NEXT(chain, chain)) { + struct ip6_fw *const f = chain->rule; + + if (oif) { + /* Check direction outbound */ + if (!(f->fw_flg & IPV6_FW_F_OUT)) + continue; + } else { + /* Check direction inbound */ + if (!(f->fw_flg & IPV6_FW_F_IN)) + continue; + } + +#define IN6_ARE_ADDR_MASKEQUAL(x,y,z) (\ + (((x)->s6_addr32[0] & (y)->s6_addr32[0]) == (z)->s6_addr32[0]) && \ + (((x)->s6_addr32[1] & (y)->s6_addr32[1]) == (z)->s6_addr32[1]) && \ + (((x)->s6_addr32[2] & (y)->s6_addr32[2]) == (z)->s6_addr32[2]) && \ + (((x)->s6_addr32[3] & (y)->s6_addr32[3]) == (z)->s6_addr32[3])) + + /* If src-addr doesn't match, not this rule. */ + if (((f->fw_flg & IPV6_FW_F_INVSRC) != 0) ^ + (!IN6_ARE_ADDR_MASKEQUAL(&ip6->ip6_src,&f->fw_smsk,&f->fw_src))) + continue; + + /* If dest-addr doesn't match, not this rule. */ + if (((f->fw_flg & IPV6_FW_F_INVDST) != 0) ^ + (!IN6_ARE_ADDR_MASKEQUAL(&ip6->ip6_dst,&f->fw_dmsk,&f->fw_dst))) + continue; + +#undef IN6_ARE_ADDR_MASKEQUAL + /* Interface check */ + if ((f->fw_flg & IF6_FW_F_VIAHACK) == IF6_FW_F_VIAHACK) { + struct ifnet *const iface = oif ? oif : rif; + + /* Backwards compatibility hack for "via" */ + if (!iface || !iface_match(iface, + &f->fw_in_if, f->fw_flg & IPV6_FW_F_OIFNAME)) + continue; + } else { + /* Check receive interface */ + if ((f->fw_flg & IPV6_FW_F_IIFACE) + && (!rif || !iface_match(rif, + &f->fw_in_if, f->fw_flg & IPV6_FW_F_IIFNAME))) + continue; + /* Check outgoing interface */ + if ((f->fw_flg & IPV6_FW_F_OIFACE) + && (!oif || !iface_match(oif, + &f->fw_out_if, f->fw_flg & IPV6_FW_F_OIFNAME))) + continue; + } + + /* Check IP options */ + if (!ip6opts_match(&ip6, f, m, &off, &nxt, &offset)) + continue; + + /* Fragments */ + if ((f->fw_flg & IPV6_FW_F_FRAG) && !offset) + continue; + + /* Check protocol; if wildcard, match */ + if (f->fw_prot == IPPROTO_IPV6) + goto got_match; + + /* If different, don't match */ + if (nxt != f->fw_prot) + continue; + +#define PULLUP_TO(len) do { \ + if ((*m)->m_len < (len) \ + && (*m = m_pullup(*m, (len))) == 0) { \ + goto dropit; \ + } \ + *pip6 = ip6 = mtod(*m, struct ip6_hdr *); \ + } while (0) + + /* Protocol specific checks */ + switch (nxt) { + case IPPROTO_TCP: + { + struct tcphdr *tcp6; + + if (offset == 1) { /* cf. RFC 1858 */ + PULLUP_TO(off + 4); /* XXX ? */ + goto bogusfrag; + } + if (offset != 0) { + /* + * TCP flags and ports aren't available in this + * packet -- if this rule specified either one, + * we consider the rule a non-match. + */ + if (f->fw_nports != 0 || + f->fw_tcpf != f->fw_tcpnf) + continue; + + break; + } + PULLUP_TO(off + 14); + tcp6 = (struct tcphdr *) ((caddr_t)ip6 + off); + if (((f->fw_tcpf != f->fw_tcpnf) || + (f->fw_ipflg & IPV6_FW_IF_TCPEST)) && + !tcp6flg_match(tcp6, f)) + continue; + src_port = ntohs(tcp6->th_sport); + dst_port = ntohs(tcp6->th_dport); + goto check_ports; + } + + case IPPROTO_UDP: + { + struct udphdr *udp; + + if (offset != 0) { + /* + * Port specification is unavailable -- if this + * rule specifies a port, we consider the rule + * a non-match. + */ + if (f->fw_nports != 0) + continue; + + break; + } + PULLUP_TO(off + 4); + udp = (struct udphdr *) ((caddr_t)ip6 + off); + src_port = ntohs(udp->uh_sport); + dst_port = ntohs(udp->uh_dport); +check_ports: + if (!port_match6(&f->fw_pts[0], + IPV6_FW_GETNSRCP(f), src_port, + f->fw_flg & IPV6_FW_F_SRNG)) + continue; + if (!port_match6(&f->fw_pts[IPV6_FW_GETNSRCP(f)], + IPV6_FW_GETNDSTP(f), dst_port, + f->fw_flg & IPV6_FW_F_DRNG)) + continue; + break; + } + + case IPPROTO_ICMPV6: + { + struct icmp6_hdr *icmp; + + if (offset != 0) /* Type isn't valid */ + break; + PULLUP_TO(off + 2); + icmp = (struct icmp6_hdr *) ((caddr_t)ip6 + off); + if (!icmp6type_match(icmp, f)) + continue; + break; + } +#undef PULLUP_TO + +bogusfrag: + if (fw6_verbose) + ip6fw_report(NULL, ip6, rif, oif, off, nxt); + goto dropit; + } + +got_match: +#ifndef IP6FW_DIVERT_RESTART + /* Ignore divert/tee rule if socket port is "ignport" */ + switch (f->fw_flg & IPV6_FW_F_COMMAND) { + case IPV6_FW_F_DIVERT: + case IPV6_FW_F_TEE: + if (f->fw_divert_port == ignport) + continue; /* ignore this rule */ + break; + } + +#endif /* IP6FW_DIVERT_RESTART */ + /* Update statistics */ + f->fw_pcnt += 1; + f->fw_bcnt += ntohs(ip6->ip6_plen); +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + f->timestamp = time_second; +#else + f->timestamp = time.tv_sec; +#endif + + /* Log to console if desired */ + if ((f->fw_flg & IPV6_FW_F_PRN) && fw6_verbose) + ip6fw_report(f, ip6, rif, oif, off, nxt); + + /* Take appropriate action */ + switch (f->fw_flg & IPV6_FW_F_COMMAND) { + case IPV6_FW_F_ACCEPT: + return(0); + case IPV6_FW_F_COUNT: + continue; + case IPV6_FW_F_DIVERT: + return(f->fw_divert_port); + case IPV6_FW_F_TEE: + /* + * XXX someday tee packet here, but beware that you + * can't use m_copym() or m_copypacket() because + * the divert input routine modifies the mbuf + * (and these routines only increment reference + * counts in the case of mbuf clusters), so need + * to write custom routine. + */ + continue; + case IPV6_FW_F_SKIPTO: +#ifdef DIAGNOSTIC + while (chain->chain.le_next + && chain->chain.le_next->rule->fw_number + < f->fw_skipto_rule) +#else + while (chain->chain.le_next->rule->fw_number + < f->fw_skipto_rule) +#endif + chain = chain->chain.le_next; + continue; + } + + /* Deny/reject this packet using this rule */ + rule = f; + break; + } + +#ifdef DIAGNOSTIC + /* Rule 65535 should always be there and should always match */ + if (!chain) + panic("ip6_fw: chain"); +#endif + + /* + * At this point, we're going to drop the packet. + * Send a reject notice if all of the following are true: + * + * - The packet matched a reject rule + * - The packet is not an ICMP packet, or is an ICMP query packet + * - The packet is not a multicast or broadcast packet + */ + if ((rule->fw_flg & IPV6_FW_F_COMMAND) == IPV6_FW_F_REJECT + && (nxt != IPPROTO_ICMPV6 || is_icmp6_query(ip6, off)) + && !((*m)->m_flags & (M_BCAST|M_MCAST)) + && !IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { + switch (rule->fw_reject_code) { + case IPV6_FW_REJECT_RST: +#if 1 /* not tested */ + { + struct tcphdr *const tcp = + (struct tcphdr *) ((caddr_t)ip6 + off); + struct { + struct ip6_hdr ip6; + struct tcphdr th; + } ti; + tcp_seq ack, seq; + int flags; + + if (offset != 0 || (tcp->th_flags & TH_RST)) + break; + + ti.ip6 = *ip6; + ti.th = *tcp; + NTOHL(ti.th.th_seq); + NTOHL(ti.th.th_ack); + ti.ip6.ip6_nxt = IPPROTO_TCP; + if (ti.th.th_flags & TH_ACK) { + ack = 0; + seq = ti.th.th_ack; + flags = TH_RST; + } else { + ack = ti.th.th_seq; + if (((*m)->m_flags & M_PKTHDR) != 0) { + ack += (*m)->m_pkthdr.len - off + - (ti.th.th_off << 2); + } else if (ip6->ip6_plen) { + ack += ntohs(ip6->ip6_plen) + sizeof(*ip6) + - off - (ti.th.th_off << 2); + } else { + m_freem(*m); + *m = 0; + break; + } + seq = 0; + flags = TH_RST|TH_ACK; + } + bcopy(&ti, ip6, sizeof(ti)); +#ifdef TCP6 + tcp6_respond(NULL, ip6, (struct tcp6hdr *)(ip6 + 1), + *m, ack, seq, flags); +#elif defined(__NetBSD__) + tcp_respond(NULL, NULL, *m, (struct tcphdr *)(ip6 + 1), + ack, seq, flags); +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + tcp_respond(NULL, ip6, (struct tcphdr *)(ip6 + 1), + *m, ack, seq, flags); +#elif defined(__FreeBSD__) && __FreeBSD__ >= 3 + tcp_respond(NULL, ip6, (struct tcphdr *)(ip6 + 1), + *m, ack, seq, flags, 1); +#else + m_freem(*m); +#endif + *m = NULL; + break; + } +#endif + default: /* Send an ICMP unreachable using code */ + if (oif) + (*m)->m_pkthdr.rcvif = oif; + icmp6_error(*m, ICMP6_DST_UNREACH, + rule->fw_reject_code, 0); + *m = NULL; + break; + } + } + +dropit: + /* + * Finally, drop the packet. + */ + if (*m) { + m_freem(*m); + *m = NULL; + } + return(0); +} + +static int +add_entry6(struct ip6_fw_head *chainptr, struct ip6_fw *frwl) +{ + struct ip6_fw *ftmp = 0; + struct ip6_fw_chain *fwc = 0, *fcp, *fcpl = 0; + u_short nbr = 0; + int s; + + fwc = malloc(sizeof *fwc, M_IP6FW, M_DONTWAIT); + ftmp = malloc(sizeof *ftmp, M_IP6FW, M_DONTWAIT); + if (!fwc || !ftmp) { + dprintf(("%s malloc said no\n", err_prefix)); + if (fwc) free(fwc, M_IP6FW); + if (ftmp) free(ftmp, M_IP6FW); + return (ENOSPC); + } + + bcopy(frwl, ftmp, sizeof(struct ip6_fw)); + ftmp->fw_in_if.fu_via_if.name[IP6FW_IFNLEN - 1] = '\0'; + ftmp->fw_pcnt = 0L; + ftmp->fw_bcnt = 0L; + fwc->rule = ftmp; + + s = splnet(); + + if (!chainptr->lh_first) { + LIST_INSERT_HEAD(chainptr, fwc, chain); + splx(s); + return(0); + } else if (ftmp->fw_number == (u_short)-1) { + if (fwc) free(fwc, M_IP6FW); + if (ftmp) free(ftmp, M_IP6FW); + splx(s); + dprintf(("%s bad rule number\n", err_prefix)); + return (EINVAL); + } + + /* If entry number is 0, find highest numbered rule and add 100 */ + if (ftmp->fw_number == 0) { + for (fcp = chainptr->lh_first; fcp; fcp = fcp->chain.le_next) { + if (fcp->rule->fw_number != (u_short)-1) + nbr = fcp->rule->fw_number; + else + break; + } + if (nbr < (u_short)-1 - 100) + nbr += 100; + ftmp->fw_number = nbr; + } + + /* Got a valid number; now insert it, keeping the list ordered */ + for (fcp = chainptr->lh_first; fcp; fcp = fcp->chain.le_next) { + if (fcp->rule->fw_number > ftmp->fw_number) { + if (fcpl) { + LIST_INSERT_AFTER(fcpl, fwc, chain); + } else { + LIST_INSERT_HEAD(chainptr, fwc, chain); + } + break; + } else { + fcpl = fcp; + } + } + + splx(s); + return (0); +} + +static int +del_entry6(struct ip6_fw_head *chainptr, u_short number) +{ + struct ip6_fw_chain *fcp; + int s; + + s = splnet(); + + fcp = chainptr->lh_first; + if (number != (u_short)-1) { + for (; fcp; fcp = fcp->chain.le_next) { + if (fcp->rule->fw_number == number) { + LIST_REMOVE(fcp, chain); + splx(s); + free(fcp->rule, M_IP6FW); + free(fcp, M_IP6FW); + return 0; + } + } + } + + splx(s); + return (EINVAL); +} + +static int +zero_entry6(struct mbuf *m) +{ + struct ip6_fw *frwl; + struct ip6_fw_chain *fcp; + int s; + + if (m && m->m_len != 0) { + if (m->m_len != sizeof(struct ip6_fw)) + return(EINVAL); + frwl = mtod(m, struct ip6_fw *); + } + else + frwl = NULL; + + /* + * It's possible to insert multiple chain entries with the + * same number, so we don't stop after finding the first + * match if zeroing a specific entry. + */ + s = splnet(); + for (fcp = ip6_fw_chain.lh_first; fcp; fcp = fcp->chain.le_next) + if (!frwl || frwl->fw_number == fcp->rule->fw_number) { + fcp->rule->fw_bcnt = fcp->rule->fw_pcnt = 0; + fcp->rule->timestamp = 0; + } + splx(s); + + if (fw6_verbose) { + if (frwl) + log(LOG_SECURITY | LOG_NOTICE, + "ip6fw: Entry %d cleared.\n", frwl->fw_number); + else + log(LOG_SECURITY | LOG_NOTICE, + "ip6fw: Accounting cleared.\n"); + } + + return(0); +} + +static struct ip6_fw * +check_ip6fw_mbuf(struct mbuf *m) +{ + /* Check length */ + if (m->m_len != sizeof(struct ip6_fw)) { + dprintf(("%s len=%d, want %d\n", err_prefix, m->m_len, + sizeof(struct ip6_fw))); + return (NULL); + } + return(check_ip6fw_struct(mtod(m, struct ip6_fw *))); +} + +static struct ip6_fw * +check_ip6fw_struct(struct ip6_fw *frwl) +{ + /* Check for invalid flag bits */ + if ((frwl->fw_flg & ~IPV6_FW_F_MASK) != 0) { + dprintf(("%s undefined flag bits set (flags=%x)\n", + err_prefix, frwl->fw_flg)); + return (NULL); + } + /* Must apply to incoming or outgoing (or both) */ + if (!(frwl->fw_flg & (IPV6_FW_F_IN | IPV6_FW_F_OUT))) { + dprintf(("%s neither in nor out\n", err_prefix)); + return (NULL); + } + /* Empty interface name is no good */ + if (((frwl->fw_flg & IPV6_FW_F_IIFNAME) + && !*frwl->fw_in_if.fu_via_if.name) + || ((frwl->fw_flg & IPV6_FW_F_OIFNAME) + && !*frwl->fw_out_if.fu_via_if.name)) { + dprintf(("%s empty interface name\n", err_prefix)); + return (NULL); + } + /* Sanity check interface matching */ + if ((frwl->fw_flg & IF6_FW_F_VIAHACK) == IF6_FW_F_VIAHACK) { + ; /* allow "via" backwards compatibility */ + } else if ((frwl->fw_flg & IPV6_FW_F_IN) + && (frwl->fw_flg & IPV6_FW_F_OIFACE)) { + dprintf(("%s outgoing interface check on incoming\n", + err_prefix)); + return (NULL); + } + /* Sanity check port ranges */ + if ((frwl->fw_flg & IPV6_FW_F_SRNG) && IPV6_FW_GETNSRCP(frwl) < 2) { + dprintf(("%s src range set but n_src_p=%d\n", + err_prefix, IPV6_FW_GETNSRCP(frwl))); + return (NULL); + } + if ((frwl->fw_flg & IPV6_FW_F_DRNG) && IPV6_FW_GETNDSTP(frwl) < 2) { + dprintf(("%s dst range set but n_dst_p=%d\n", + err_prefix, IPV6_FW_GETNDSTP(frwl))); + return (NULL); + } + if (IPV6_FW_GETNSRCP(frwl) + IPV6_FW_GETNDSTP(frwl) > IPV6_FW_MAX_PORTS) { + dprintf(("%s too many ports (%d+%d)\n", + err_prefix, IPV6_FW_GETNSRCP(frwl), IPV6_FW_GETNDSTP(frwl))); + return (NULL); + } + /* + * Protocols other than TCP/UDP don't use port range + */ + if ((frwl->fw_prot != IPPROTO_TCP) && + (frwl->fw_prot != IPPROTO_UDP) && + (IPV6_FW_GETNSRCP(frwl) || IPV6_FW_GETNDSTP(frwl))) { + dprintf(("%s port(s) specified for non TCP/UDP rule\n", + err_prefix)); + return(NULL); + } + + /* + * Rather than modify the entry to make such entries work, + * we reject this rule and require user level utilities + * to enforce whatever policy they deem appropriate. + */ + if ((frwl->fw_src.s6_addr32[0] & (~frwl->fw_smsk.s6_addr32[0])) || + (frwl->fw_src.s6_addr32[1] & (~frwl->fw_smsk.s6_addr32[1])) || + (frwl->fw_src.s6_addr32[2] & (~frwl->fw_smsk.s6_addr32[2])) || + (frwl->fw_src.s6_addr32[3] & (~frwl->fw_smsk.s6_addr32[3])) || + (frwl->fw_dst.s6_addr32[0] & (~frwl->fw_dmsk.s6_addr32[0])) || + (frwl->fw_dst.s6_addr32[1] & (~frwl->fw_dmsk.s6_addr32[1])) || + (frwl->fw_dst.s6_addr32[2] & (~frwl->fw_dmsk.s6_addr32[2])) || + (frwl->fw_dst.s6_addr32[3] & (~frwl->fw_dmsk.s6_addr32[3]))) { + dprintf(("%s rule never matches\n", err_prefix)); + return(NULL); + } + + if ((frwl->fw_flg & IPV6_FW_F_FRAG) && + (frwl->fw_prot == IPPROTO_UDP || frwl->fw_prot == IPPROTO_TCP)) { + if (frwl->fw_nports) { + dprintf(("%s cannot mix 'frag' and ports\n", err_prefix)); + return(NULL); + } + if (frwl->fw_prot == IPPROTO_TCP && + frwl->fw_tcpf != frwl->fw_tcpnf) { + dprintf(("%s cannot mix 'frag' with TCP flags\n", err_prefix)); + return(NULL); + } + } + + /* Check command specific stuff */ + switch (frwl->fw_flg & IPV6_FW_F_COMMAND) + { + case IPV6_FW_F_REJECT: + if (frwl->fw_reject_code >= 0x100 + && !(frwl->fw_prot == IPPROTO_TCP + && frwl->fw_reject_code == IPV6_FW_REJECT_RST)) { + dprintf(("%s unknown reject code\n", err_prefix)); + return(NULL); + } + break; + case IPV6_FW_F_DIVERT: /* Diverting to port zero is invalid */ + case IPV6_FW_F_TEE: + if (frwl->fw_divert_port == 0) { + dprintf(("%s can't divert to port 0\n", err_prefix)); + return (NULL); + } + break; + case IPV6_FW_F_DENY: + case IPV6_FW_F_ACCEPT: + case IPV6_FW_F_COUNT: + case IPV6_FW_F_SKIPTO: + break; + default: + dprintf(("%s invalid command\n", err_prefix)); + return(NULL); + } + + return frwl; +} + +static int +ip6_fw_ctl(int stage, struct mbuf **mm) +{ + int error; + struct mbuf *m; + + if (stage == IPV6_FW_GET) { + struct ip6_fw_chain *fcp = ip6_fw_chain.lh_first; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + *mm = m = m_get(M_WAIT, MT_DATA); /* XXX */ +#else + *mm = m = m_get(M_WAIT, MT_SOOPTS); +#endif + if (!m) + return(ENOBUFS); + if (sizeof *(fcp->rule) > MLEN) { + MCLGET(m, M_WAIT); + if ((m->m_flags & M_EXT) == 0) { + m_free(m); + return(ENOBUFS); + } + } + for (; fcp; fcp = fcp->chain.le_next) { + bcopy(fcp->rule, m->m_data, sizeof *(fcp->rule)); + m->m_len = sizeof *(fcp->rule); +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + m->m_next = m_get(M_WAIT, MT_DATA); /* XXX */ +#else + m->m_next = m_get(M_WAIT, MT_SOOPTS); +#endif + if (!m->m_next) { + m_freem(*mm); + return(ENOBUFS); + } + m = m->m_next; + if (sizeof *(fcp->rule) > MLEN) { + MCLGET(m, M_WAIT); + if ((m->m_flags & M_EXT) == 0) { + m_freem(*mm); + return(ENOBUFS); + } + } + m->m_len = 0; + } + return (0); + } + m = *mm; + /* only allow get calls if secure mode > 2 */ + if (securelevel > 2) { + if (m) { + (void)m_freem(m); + *mm = 0; + } + return(EPERM); + } + if (stage == IPV6_FW_FLUSH) { + while (ip6_fw_chain.lh_first != NULL && + ip6_fw_chain.lh_first->rule->fw_number != (u_short)-1) { + struct ip6_fw_chain *fcp = ip6_fw_chain.lh_first; + int s = splnet(); + LIST_REMOVE(ip6_fw_chain.lh_first, chain); + splx(s); + free(fcp->rule, M_IP6FW); + free(fcp, M_IP6FW); + } + if (m) { + (void)m_freem(m); + *mm = 0; + } + return (0); + } + if (stage == IPV6_FW_ZERO) { + error = zero_entry6(m); + if (m) { + (void)m_freem(m); + *mm = 0; + } + return (error); + } + if (m == NULL) { + printf("%s NULL mbuf ptr\n", err_prefix); + return (EINVAL); + } + + if (stage == IPV6_FW_ADD) { + struct ip6_fw *frwl = check_ip6fw_mbuf(m); + + if (!frwl) + error = EINVAL; + else + error = add_entry6(&ip6_fw_chain, frwl); + if (m) { + (void)m_freem(m); + *mm = 0; + } + return error; + } + if (stage == IPV6_FW_DEL) { + if (m->m_len != sizeof(struct ip6_fw)) { + dprintf(("%s len=%d, want %d\n", err_prefix, m->m_len, + sizeof(struct ip6_fw))); + error = EINVAL; + } else if (mtod(m, struct ip6_fw *)->fw_number == (u_short)-1) { + dprintf(("%s can't delete rule 65535\n", err_prefix)); + error = EINVAL; + } else + error = del_entry6(&ip6_fw_chain, + mtod(m, struct ip6_fw *)->fw_number); + if (m) { + (void)m_freem(m); + *mm = 0; + } + return error; + } + + dprintf(("%s unknown request %d\n", err_prefix, stage)); + if (m) { + (void)m_freem(m); + *mm = 0; + } + return (EINVAL); +} + +void +ip6_fw_init(void) +{ + struct ip6_fw default_rule; + + ip6_fw_chk_ptr = ip6_fw_chk; + ip6_fw_ctl_ptr = ip6_fw_ctl; + LIST_INIT(&ip6_fw_chain); + + bzero(&default_rule, sizeof default_rule); + default_rule.fw_prot = IPPROTO_IPV6; + default_rule.fw_number = (u_short)-1; +#ifdef IPV6FIREWALL_DEFAULT_TO_ACCEPT + default_rule.fw_flg |= IPV6_FW_F_ACCEPT; +#else + default_rule.fw_flg |= IPV6_FW_F_DENY; +#endif + default_rule.fw_flg |= IPV6_FW_F_IN | IPV6_FW_F_OUT; + if (check_ip6fw_struct(&default_rule) == NULL || + add_entry6(&ip6_fw_chain, &default_rule)) + panic(__FUNCTION__); + +#if 1 /* NOT SUPPORTED IPV6 DIVERT */ + printf("IPv6 packet filtering initialized, "); +#else + printf("IPv6 packet filtering initialized, " +#ifdef IP6DIVERT + "divert enabled, "); +#else + "divert disabled, "); +#endif +#endif +#ifdef IPV6FIREWALL_DEFAULT_TO_ACCEPT + printf("default to accept, "); +#endif +#ifndef IPV6FIREWALL_VERBOSE + printf("logging disabled\n"); +#else + if (fw6_verbose_limit == 0) + printf("unlimited logging\n"); + else + printf("logging limited to %d packets/entry\n", + fw6_verbose_limit); +#endif +} + +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 +static ip6_fw_chk_t *old_chk_ptr; +static ip6_fw_ctl_t *old_ctl_ptr; + +static int +ip6fw_modevent(module_t mod, int type, void *unused) +{ + int s; + + switch (type) { + case MOD_LOAD: + s = splnet(); + + old_chk_ptr = ip6_fw_chk_ptr; + old_ctl_ptr = ip6_fw_ctl_ptr; + + ip6_fw_init(); + splx(s); + return 0; + case MOD_UNLOAD: + s = splnet(); + ip6_fw_chk_ptr = old_chk_ptr; + ip6_fw_ctl_ptr = old_ctl_ptr; + while (LIST_FIRST(&ip6_fw_chain) != NULL) { + struct ip6_fw_chain *fcp = LIST_FIRST(&ip6_fw_chain); + LIST_REMOVE(LIST_FIRST(&ip6_fw_chain), chain); + free(fcp->rule, M_IP6FW); + free(fcp, M_IP6FW); + } + + splx(s); + printf("IPv6 firewall unloaded\n"); + return 0; + default: + break; + } + return 0; +} + +static moduledata_t ip6fwmod = { + "ip6fw", + ip6fw_modevent, + 0 +}; +DECLARE_MODULE(ip6fw, ip6fwmod, SI_SUB_PSEUDO, SI_ORDER_ANY); +#endif + + diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_input.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_input.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_input.c @@ -0,0 +1,2514 @@ +//========================================================================== +// +// src/sys/netinet6/ip6_input.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip6_input.c,v 1.242 2001/12/27 17:40:10 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 +#include +#endif + +#include +#include +#ifdef INET +#include +#include +#endif /* INET */ +#include +#include +#include +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) +#include +#endif +#if !((defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)) +#include +#endif +#include +#include +#include +#ifdef __bsdi__ +#include +#endif +#ifdef MIP6 +#include +#endif + +#if defined(IPSEC) && !defined(__OpenBSD__) +#include +#endif + +#if defined(IPV6FIREWALL) || (defined(__FreeBSD__) && __FreeBSD__ >= 4) +#include +#endif + +#include + +/* we need it for NLOOP. */ + +#if NGIF > 0 +#include +#endif + +#ifdef MIP6 +#include +#endif /* MIP6 */ + +#ifdef __OpenBSD__ +#if NPF > 0 +#include +#endif +#endif + +extern struct domain inet6domain; +extern struct ip6protosw inet6sw[]; +#ifdef __bsdi__ +#if _BSDI_VERSION < 199802 +extern struct ifnet loif; +#else +extern struct ifnet *loifp; +#endif +#endif + +u_char ip6_protox[IPPROTO_MAX]; +static int ip6qmaxlen = IFQ_MAXLEN; +struct in6_ifaddr *in6_ifaddr; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 4) +struct ifqueue ip6intrq; +#endif + +#if defined(__NetBSD__) +extern struct ifnet loif[NLOOP]; +#endif +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) +extern struct callout in6_tmpaddrtimer_ch; +#elif defined(__OpenBSD__) +extern struct timeout in6_tmpaddrtimer_ch; +#endif + +int ip6_forward_srcrt; /* XXX */ +int ip6_sourcecheck; /* XXX */ +int ip6_sourcecheck_interval; /* XXX */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 +const int int6intrq_present = 1; +#endif + +#ifdef MEASURE_PERFORMANCE +#define MEASURE_PERFORMANCE_UDPONLY +#define IP6_PERFORM_LOGSIZE 10000 +int ip6_logentry; +int ip6_logsize = IP6_PERFORM_LOGSIZE; +unsigned long long ip6_performance_log[IP6_PERFORM_LOGSIZE]; +unsigned long long ip6_performance_log2[IP6_PERFORM_LOGSIZE]; +struct in6_addr ip6_performance_addrlog[IP6_PERFORM_LOGSIZE]; +#endif +#ifdef MEASURE_PERFORMANCE +#define OURS_CHECK_ALG_RTABLE 0 +#define OURS_CHECK_ALG_LINEAR 1 +#define OURS_CHECK_ALG_HASH 2 +#define OURS_CHECK_ALG_LARGEHASH 3 +#ifdef OURS_CHECK_LINEAR +int ip6_ours_check_algorithm = OURS_CHECK_ALG_LINEAR; +#elif OURS_CHECK_HASH +int ip6_ours_check_algorithm = OURS_CHECK_ALG_HASH; +#else +int ip6_ours_check_algorithm = OURS_CHECK_ALG_RTABLE; +#endif +#else +int ip6_ours_check_algorithm; +#endif + + +#if defined(IPV6FIREWALL) || (defined(__FreeBSD__) && __FreeBSD__ >= 4) +/* firewall hooks */ +ip6_fw_chk_t *ip6_fw_chk_ptr; +ip6_fw_ctl_t *ip6_fw_ctl_ptr; +#endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 +int ip6_fw_enable = 1; +#endif + +struct ip6stat ip6stat; + +static void ip6_init2 __P((void *)); +static struct mbuf *ip6_setdstifaddr __P((struct mbuf *, struct in6_ifaddr *)); + +static int ip6_hopopts_input __P((u_int32_t *, u_int32_t *, struct mbuf **, int *)); +#ifdef PULLDOWN_TEST +static struct mbuf *ip6_pullexthdr __P((struct mbuf *, size_t, int)); +#endif + +#ifdef NATPT +extern int ip6_protocol_tr; + +int natpt_in6 __P((struct mbuf *, struct mbuf **)); +extern void ip_forward __P((struct mbuf *, int)); +#endif + + +#ifdef MEASURE_PERFORMANCE +static unsigned long long ctr_beg, ctr_end; + +static __inline unsigned long long read_tsc __P((void)); +static __inline void add_performance_log __P((unsigned long long, + struct in6_addr *)); +#endif + +#ifdef MEASURE_PERFORMANCE +static __inline unsigned long long +read_tsc(void) +{ + unsigned int h,l; + /* read Pentium counter */ + __asm__(".byte 0x0f,0x31" :"=a" (l), "=d" (h)); + return ((unsigned long long)h<<32) | l; +} + +static __inline void +add_performance_log(val, addr) + unsigned long long val; + struct in6_addr *addr; +{ + ip6_logentry = (ip6_logentry + 1) % ip6_logsize; + ip6_performance_log[ip6_logentry] = val; + ip6_performance_addrlog[ip6_logentry] = *addr; +} +#endif + +/* + * IP6 initialization: fill in IP6 protocol switch table. + * All protocols not implemented in kernel go to raw IP6 protocol handler. + */ +void +ip6_init() +{ + struct ip6protosw *pr; + int i; +#ifndef __OpenBSD__ + struct timeval tv; +#endif + +#ifdef RADIX_ART + rt_tables[AF_INET6]->rnh_addrsize = sizeof(struct in6_addr); +#endif + +#ifdef DIAGNOSTIC + if (sizeof(struct protosw) != sizeof(struct ip6protosw)) + panic("sizeof(protosw) != sizeof(ip6protosw)"); +#endif + pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); + if (pr == 0) + panic("ip6_init"); + for (i = 0; i < IPPROTO_MAX; i++) + ip6_protox[i] = pr - inet6sw; + for (pr = (struct ip6protosw *)inet6domain.dom_protosw; + pr < (struct ip6protosw *)inet6domain.dom_protoswNPROTOSW; pr++) + if (pr->pr_domain->dom_family == PF_INET6 && + pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) + ip6_protox[pr->pr_protocol] = pr - inet6sw; + ip6intrq.ifq_maxlen = ip6qmaxlen; +#if (defined(__FreeBSD__) && __FreeBSD__ >= 4) + register_netisr(NETISR_IPV6, ip6intr); +#endif + addrsel_policy_init(); + nd6_init(); + frag6_init(); +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 +#else +#ifdef IPV6FIREWALL + ip6_fw_init(); +#endif +#endif +#ifndef __OpenBSD__ + /* + * in many cases, random() here does NOT return random number + * as initialization during bootstrap time occur in fixed order. + */ + microtime(&tv); + ip6_flow_seq = random() ^ tv.tv_usec; + microtime(&tv); + ip6_desync_factor = (random() ^ tv.tv_usec) % MAX_TEMP_DESYNC_FACTOR; +#else + ip6_flow_seq = arc4random(); + ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR; +#endif + +#ifndef __FreeBSD__ + ip6_init2((void *)0); +#endif + +#ifdef MIP6 + mip6_init(); +#endif /* MIP6 */ + +#ifdef MEASURE_PERFORMANCE + in6h_hashinit(); +#endif +} + +static void +ip6_init2(dummy) + void *dummy; +{ +#if defined(__bsdi__) && _BSDI_VERSION < 199802 + struct ifnet *loifp = &loif; +#endif + + /* + * to route local address of p2p link to loopback, + * assign loopback address first. + */ +#ifdef __bsdi__ + in6_ifattach(loifp, NULL); +#elif defined(__OpenBSD__) + in6_ifattach(lo0ifp, NULL); +#else + in6_ifattach(&loif[0], NULL); +#endif + + /* nd6_timer_init */ +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_init(&nd6_timer_ch); + callout_reset(&nd6_timer_ch, hz, nd6_timer, NULL); +#elif defined(__OpenBSD__) + bzero(&nd6_timer_ch, sizeof(nd6_timer_ch)); + timeout_set(&nd6_timer_ch, nd6_timer, NULL); + timeout_add(&nd6_timer_ch, hz); +#else + timeout(nd6_timer, (caddr_t)0, hz); +#endif + + /* timer for regeneranation of temporary addresses randomize ID */ +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_init(&in6_tmpaddrtimer_ch); + callout_reset(&in6_tmpaddrtimer_ch, + (ip6_temp_preferred_lifetime - ip6_desync_factor - + ip6_temp_regen_advance) * hz, + in6_tmpaddrtimer, NULL); +#elif defined(__OpenBSD__) + timeout_set(&in6_tmpaddrtimer_ch, in6_tmpaddrtimer, NULL); + timeout_add(&in6_tmpaddrtimer_ch, + (ip6_temp_preferred_lifetime - ip6_desync_factor - + ip6_temp_regen_advance) * hz); +#else + timeout(in6_tmpaddrtimer, (caddr_t)0, + (ip6_temp_preferred_lifetime - ip6_desync_factor - + ip6_temp_regen_advance) * hz); +#endif +} + +SYSINIT(netinet6init2, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ip6_init2, NULL); + +/* + * IP6 input interrupt handling. Just pass the packet to ip6_input. + */ +void +ip6intr() +{ + int s; + struct mbuf *m; + + for (;;) { + s = splimp(); + IF_DEQUEUE(&ip6intrq, m); + splx(s); + if (m == 0) + return; + ip6_input(m); + } +} + +#if (defined(__FreeBSD__) && __FreeBSD__ <= 3) +NETISR_SET(NETISR_IPV6, ip6intr); +#endif + +#ifdef NEW_STRUCT_ROUTE +extern struct route ip6_forward_rt; +#else +extern struct route_in6 ip6_forward_rt; + +/* NetBSD/OpenBSD requires NEW_STRUCT_ROUTE */ +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) +#error NEW_STRUCT_ROUTE is required +#endif +#endif + +void +ip6_input(m) + struct mbuf *m; +{ + struct ip6_hdr *ip6; + int off = sizeof(struct ip6_hdr), nest; + u_int32_t plen; + u_int32_t rtalert = ~0; + int nxt, ours = 0; + struct ifnet *deliverifp = NULL; +#if 0 + struct mbuf *mhist; /* onion peeling history */ + caddr_t hist; +#endif +#if defined(__bsdi__) && _BSDI_VERSION < 199802 + struct ifnet *loifp = &loif; +#endif +#if defined(__NetBSD__) && defined(PFIL_HOOKS) + struct packet_filter_hook *pfh; + struct mbuf *m0; + int rv; +#endif /* PFIL_HOOKS */ + +#if defined(IPSEC) && !defined(__OpenBSD__) + /* + * should the inner packet be considered authentic? + * see comment in ah4_input(). + */ + m->m_flags &= ~M_AUTHIPHDR; + m->m_flags &= ~M_AUTHIPDGM; +#endif + + /* + * make sure we don't have onion peering information into m_aux. + */ + ip6_delaux(m); + + /* + * mbuf statistics + */ + if (m->m_flags & M_EXT) { + if (m->m_next) + ip6stat.ip6s_mext2m++; + else + ip6stat.ip6s_mext1++; + } else { +#define M2MMAX (sizeof(ip6stat.ip6s_m2m)/sizeof(ip6stat.ip6s_m2m[0])) + if (m->m_next) { + if (m->m_flags & M_LOOP) { +#ifdef __bsdi__ + ip6stat.ip6s_m2m[loifp->if_index]++; /* XXX */ +#elif defined(__OpenBSD__) + ip6stat.ip6s_m2m[lo0ifp->if_index]++; /* XXX */ +#else + ip6stat.ip6s_m2m[loif[0].if_index]++; /* XXX */ +#endif + } else if (m->m_pkthdr.rcvif->if_index < M2MMAX) + ip6stat.ip6s_m2m[m->m_pkthdr.rcvif->if_index]++; + else + ip6stat.ip6s_m2m[0]++; + } else + ip6stat.ip6s_m1++; +#undef M2MMAX + } + + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive); + ip6stat.ip6s_total++; + +#ifndef PULLDOWN_TEST + /* + * L2 bridge code and some other code can return mbuf chain + * that does not conform to KAME requirement. too bad. + * XXX: fails to join if interface MTU > MCLBYTES. jumbogram? + */ + if (m && m->m_next != NULL && m->m_pkthdr.len < MCLBYTES) { + struct mbuf *n; + + MGETHDR(n, M_DONTWAIT, MT_HEADER); + if (n != NULL) { +#ifdef __OpenBSD__ + M_MOVE_PKTHDR(n, m); +#else + M_COPY_PKTHDR(n, m); +#endif + } + if (n != NULL && m->m_pkthdr.len > MHLEN) { + MCLGET(n, M_DONTWAIT); + if ((n->m_flags & M_EXT) == 0) { + m_freem(n); + n = NULL; + } + } + if (n == NULL) { + m_freem(m); + return; /* ENOBUFS */ + } + + m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t)); + n->m_len = m->m_pkthdr.len; + m_freem(m); + m = n; + } + IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), /* nothing */); +#endif + +#if defined(__OpenBSD__) && NPF > 0 + /* + * Packet filter + */ + if (pf_test6(PF_IN, m->m_pkthdr.rcvif, &m) != PF_PASS) + goto bad; +#endif + + if (m->m_len < sizeof(struct ip6_hdr)) { + struct ifnet *inifp; + inifp = m->m_pkthdr.rcvif; + if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == 0) { + ip6stat.ip6s_toosmall++; + in6_ifstat_inc(inifp, ifs6_in_hdrerr); + return; + } + } + + ip6 = mtod(m, struct ip6_hdr *); + + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { + ip6stat.ip6s_badvers++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); + goto bad; + } + +#if defined(__NetBSD__) && defined(PFIL_HOOKS) + /* + * Run through list of hooks for input packets. If there are any + * filters which require that additional packets in the flow are + * not fast-forwarded, they must clear the M_CANFASTFWD flag. + * Note that filters must _never_ set this flag, as another filter + * in the list may have previously cleared it. + */ + /* + * let ipfilter look at packet on the wire, + * not the decapsulated packet. + */ +#ifdef IPSEC + if (!ipsec_getnhist(m)) +#else + if (1 /* CONSTCOND */) +#endif + { + m0 = m; + pfh = pfil_hook_get(PFIL_IN, + &inetsw[ip_protox[IPPROTO_IPV6]].pr_pfh); + } else + pfh = NULL; + for (; pfh; pfh = pfh->pfil_link.tqe_next) + if (pfh->pfil_func) { + rv = pfh->pfil_func(ip6, sizeof(*ip6), + m->m_pkthdr.rcvif, 0, &m0); + if (rv) + return; + m = m0; + if (m == NULL) + return; + ip6 = mtod(m, struct ip6_hdr *); + } +#endif /* PFIL_HOOKS */ + + ip6stat.ip6s_nxthist[ip6->ip6_nxt]++; + +#if defined(IPV6FIREWALL) || (defined(__FreeBSD__) && __FreeBSD__ >= 4) + /* + * Check with the firewall... + */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 + if (ip6_fw_enable && ip6_fw_chk_ptr) +#else + if (ip6_fw_chk_ptr) +#endif + { + /* If ipfw says divert, we have to just drop packet */ + /* use port as a dummy argument */ + if ((*ip6_fw_chk_ptr)(&ip6, NULL, &m)) { + m_freem(m); + m = NULL; + } + if (!m) + return; + } +#endif + +#ifdef ALTQ + if (altq_input != NULL && (*altq_input)(m, AF_INET6) == 0) { + /* packet is dropped by traffic conditioner */ + return; + } +#endif + + /* + * Check against address spoofing/corruption. + */ +#if 0 + diag_printf("%s.%d\n", __FUNCTION__, __LINE__); + diag_dump_buf(&ip6->ip6_src, 16); + diag_dump_buf(&ip6->ip6_dst, 16); +#endif + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src) || + IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst)) { + /* + * XXX: "badscope" is not very suitable for a multicast source. + */ + ip6stat.ip6s_badscope++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } + if ((IN6_IS_ADDR_LOOPBACK(&ip6->ip6_src) || + IN6_IS_ADDR_LOOPBACK(&ip6->ip6_dst)) && + (m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) { + ip6stat.ip6s_badscope++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } + if (IN6_IS_ADDR_MC_INTFACELOCAL(&ip6->ip6_dst) && + !(m->m_flags & M_LOOP)) { + /* + * In this case, the packet should come from the loopback + * interface. However, we cannot just check the if_flags, + * because ip6_mloopback() passes the "actual" interface + * as the outgoing/incoming interface. + */ + ip6stat.ip6s_badscope++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } + + /* + * The following check is not documented in specs. A malicious + * party may be able to use IPv4 mapped addr to confuse tcp/udp stack + * and bypass security checks (act as if it was from 127.0.0.1 by using + * IPv6 src ::ffff:127.0.0.1). Be cautious. + * + * This check chokes if we are in an SIIT cloud. As none of BSDs + * support IPv4-less kernel compilation, we cannot support SIIT + * environment at all. So, it makes more sense for us to reject any + * malicious packets for non-SIIT environment, than try to do a + * partical support for SIIT environment. + */ + if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || + IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { + ip6stat.ip6s_badscope++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } +#if 0 + /* + * Reject packets with IPv4 compatible addresses (auto tunnel). + * + * The code forbids auto tunnel relay case in RFC1933 (the check is + * stronger than RFC1933). We may want to re-enable it if mech-xx + * is revised to forbid relaying case. + */ + if (IN6_IS_ADDR_V4COMPAT(&ip6->ip6_src) || + IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) { + ip6stat.ip6s_badscope++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + goto bad; + } +#endif + + /* drop packets if interface ID portion is already filled */ + if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) { + if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src) && + ip6->ip6_src.s6_addr16[1]) { + ip6stat.ip6s_badscope++; + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } + if ((IN6_IS_ADDR_MC_INTFACELOCAL(&ip6->ip6_dst) || + IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) && + ip6->ip6_dst.s6_addr16[1]) { + ip6stat.ip6s_badscope++; + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } + } + + /* + * Embed interface ID as the zone ID for interface-local and + * link-local addresses. + * XXX: KAME assumes one-to-one mapping between interfaces and + * links. + */ + if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) + ip6->ip6_src.s6_addr16[1] + = htons(m->m_pkthdr.rcvif->if_index); + if (IN6_IS_ADDR_MC_INTFACELOCAL(&ip6->ip6_dst) || + IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) + ip6->ip6_dst.s6_addr16[1] + = htons(m->m_pkthdr.rcvif->if_index); + +#if 0 /* this case seems to be unnecessary. (jinmei, 20010401) */ + /* + * We use rt->rt_ifp to determine if the address is ours or not. + * If rt_ifp is lo0, the address is ours. + * The problem here is, rt->rt_ifp for fe80::%lo0/64 is set to lo0, + * so any address under fe80::%lo0/64 will be mistakenly considered + * local. The special case is supplied to handle the case properly + * by actually looking at interface addresses + * (using in6ifa_ifpwithaddr). + */ + if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) != 0 && + IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst)) { + if (!in6ifa_ifpwithaddr(m->m_pkthdr.rcvif, &ip6->ip6_dst)) { + icmp6_error(m, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_ADDR, 0); + /* m is already freed */ + return; + } + + ours = 1; + deliverifp = m->m_pkthdr.rcvif; + goto hbhcheck; + } +#endif + + /* + * Multicast check + */ + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { + struct in6_multi *in6m = 0; + + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mcast); + /* + * See if we belong to the destination multicast group on the + * arrival interface. + */ + IN6_LOOKUP_MULTI(ip6->ip6_dst, m->m_pkthdr.rcvif, in6m); +// TEMP + if (0) { + struct in6_addr *_addr = &ip6->ip6_dst; + struct ifnet *_ifp = m->m_pkthdr.rcvif; + struct ifmultiaddr *_ifma; + diag_printf("Lookup Multi = %p\n", in6m); + diag_dump_buf(_addr, 16); + diag_printf("=====================================================================\n"); + for (_ifma = (_ifp)->if_multiaddrs.lh_first; _ifma; + _ifma = _ifma->ifma_link.le_next) { + diag_dump_buf(&((struct sockaddr_in6 *)_ifma->ifma_addr)->sin6_addr, 16); + diag_printf("---------------------------------------------------------------------\n"); + } + } +// TEMP + if (in6m) + ours = 1; + else if (!ip6_mrouter) { + ip6stat.ip6s_notmember++; + ip6stat.ip6s_cantforward++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); + log(LOG_FAIL, "%s.%d - wrong multi group\n", + __FUNCTION__, __LINE__); + log_dump(LOG_FAIL, &ip6->ip6_dst, 16); + goto bad; + } + deliverifp = m->m_pkthdr.rcvif; + goto hbhcheck; + } + + /* + * Unicast check + */ +#ifdef MEASURE_PERFORMANCE + ctr_beg = read_tsc(); +#endif + switch (ip6_ours_check_algorithm) { +#ifdef MEASURE_PERFORMANCE + case OURS_CHECK_ALG_LINEAR: + /* traditional linear search: just for measurement */ + { + struct in6_ifaddr *ia; + + for (ia = in6_ifaddr; ia; ia = ia->ia_next) { + if ((ia->ia6_flags & IN6_IFF_NOTREADY) == 0 && + IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, + &ip6->ip6_dst)) { +#ifdef MEASURE_PERFORMANCE + ctr_end = read_tsc(); +#ifdef MEASURE_PERFORMANCE_UDPONLY + if (ip6->ip6_nxt == IPPROTO_UDP) +#else + if (1) +#endif + add_performance_log(ctr_end - ctr_beg, + &ip6->ip6_dst); +#endif + /* record address information into m_aux. */ + (void)ip6_setdstifaddr(m, ia); + + ours = 1; + deliverifp = ia->ia_ifp; + goto hbhcheck; + } + } + } + break; + case OURS_CHECK_ALG_HASH: + case OURS_CHECK_ALG_LARGEHASH: + { + struct in6_ifaddr *ia; + struct in6hash *ih = NULL; + + if ((ih = in6h_lookup(&ip6->ip6_dst, m->m_pkthdr.rcvif)) != + NULL && (ia = ih->in6h_ifa) != NULL) { +#ifdef MEASURE_PERFORMANCE + ctr_end = read_tsc(); +#ifdef MEASURE_PERFORMANCE_UDPONLY + if (ip6->ip6_nxt == IPPROTO_UDP) +#else + if (1) +#endif + add_performance_log(ctr_end - ctr_beg, + &ip6->ip6_dst); +#endif + + /* record address information into m_aux. */ + (void)ip6_setdstifaddr(m, ia); + + ours = 1; + deliverifp = m->m_pkthdr.rcvif; + goto hbhcheck; + } + } + break; +#endif /* MEASURE_PERFORMANCE */ + default: + /* + * XXX: I intentionally broke our indentation rule here, + * since this switch-case is just for measurement and + * therefore should soon be removed. + */ + if (ip6_forward_rt.ro_rt != NULL && + (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) != 0 && + IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, + &((struct sockaddr_in6 *)(&ip6_forward_rt.ro_dst))->sin6_addr)) + ip6stat.ip6s_forward_cachehit++; + else { + struct sockaddr_in6 *dst6; +#ifdef SCOPEDROUTING + int64_t dstzone; +#endif + + if (ip6_forward_rt.ro_rt) { + /* route is down or destination is different */ + ip6stat.ip6s_forward_cachemiss++; + RTFREE(ip6_forward_rt.ro_rt); + ip6_forward_rt.ro_rt = 0; + } + + bzero(&ip6_forward_rt.ro_dst, sizeof(struct sockaddr_in6)); + dst6 = (struct sockaddr_in6 *)&ip6_forward_rt.ro_dst; + dst6->sin6_len = sizeof(struct sockaddr_in6); + dst6->sin6_family = AF_INET6; + dst6->sin6_addr = ip6->ip6_dst; +#ifdef SCOPEDROUTING + if ((dstzone = in6_addr2zoneid(m->m_pkthdr.rcvif, + &ip6->ip6_dst)) < 0) { + ip6stat.ip6s_badscope++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } + ip6_forward_rt.ro_dst.sin6_scope_id = dstzone; +#endif + +#ifdef __FreeBSD__ + rtalloc_ign((struct route *)&ip6_forward_rt, RTF_PRCLONING); +#else + rtalloc((struct route *)&ip6_forward_rt); +#endif + } + +#define rt6_key(r) ((struct sockaddr_in6 *)((r)->rt_nodes->rn_key)) + + /* + * Accept the packet if the forwarding interface to the destination + * according to the routing table is the loopback interface, + * unless the associated route has a gateway. + * Note that this approach causes to accept a packet if there is a + * route to the loopback interface for the destination of the packet. + * But we think it's even useful in some situations, e.g. when using + * a special daemon which wants to intercept the packet. + * + * XXX: some OSes automatically make a cloned route for the destination + * of an outgoing packet. If the outgoing interface of the packet + * is a loopback one, the kernel would consider the packet to be + * accepted, even if we have no such address assinged on the interface. + * We check the cloned flag of the route entry to reject such cases, + * assuming that route entries for our own addresses are not made by + * cloning (it should be true because in6_addloop explicitly installs + * the host route). However, we might have to do an explicit check + * while it would be less efficient. Or, should we rather install a + * reject route for such a case? + */ + if (ip6_forward_rt.ro_rt && + (ip6_forward_rt.ro_rt->rt_flags & + (RTF_HOST|RTF_GATEWAY)) == RTF_HOST && +#ifdef RTF_WASCLONED + !(ip6_forward_rt.ro_rt->rt_flags & RTF_WASCLONED) && +#endif +#ifdef RTF_CLONED + !(ip6_forward_rt.ro_rt->rt_flags & RTF_CLONED) && +#endif +#if 0 + /* + * The check below is redundant since the comparison of + * the destination and the key of the rtentry has + * already done through looking up the routing table. + */ + IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, + &rt6_key(ip6_forward_rt.ro_rt)->sin6_addr) +#endif + ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_LOOP) { + struct in6_ifaddr *ia6 = + (struct in6_ifaddr *)ip6_forward_rt.ro_rt->rt_ifa; + +#ifdef MEASURE_PERFORMANCE + ctr_end = read_tsc(); +#ifdef MEASURE_PERFORMANCE_UDPONLY + if (ip6->ip6_nxt == IPPROTO_UDP) +#else + if (1) +#endif + add_performance_log(ctr_end - ctr_beg, &ip6->ip6_dst); +#endif + + /* + * record address information into m_aux. + */ + (void)ip6_setdstifaddr(m, ia6); + + /* + * packets to a tentative, duplicated, or somehow invalid + * address must not be accepted. + */ + if (!(ia6->ia6_flags & IN6_IFF_NOTREADY)) { + /* this address is ready */ + ours = 1; + deliverifp = ia6->ia_ifp; /* correct? */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 + /* Count the packet in the ip address stats */ + ia6->ia_ifa.if_ipackets++; + ia6->ia_ifa.if_ibytes += m->m_pkthdr.len; +#elif defined(__bsdi__) && _BSDI_VERSION >= 199802 + /* Count the packet in the ip address stats */ + ia6->ia_ifa.ifa_ipackets++; + ia6->ia_ifa.ifa_ibytes += m->m_pkthdr.len; +#endif + goto hbhcheck; + } else { + /* address is not ready, so discard the packet. */ + nd6log((LOG_INFO, + "ip6_input: packet to an unready address %s->%s\n", + ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst))); + goto bad; + } + } + } /* XXX indentation (see above) */ + +#ifdef MEASURE_PERFORMANCE + /* we detected that packet is not ours thru the basic algorithm */ + ctr_end = read_tsc(); +#ifdef MEASURE_PERFORMANCE_UDPONLY + if (ip6->ip6_nxt == IPPROTO_UDP) +#else + if (1) +#endif + add_performance_log(ctr_end - ctr_beg, &ip6->ip6_dst); +#endif + + /* + * FAITH(Firewall Aided Internet Translator) + */ +#if defined(NFAITH) && 0 < NFAITH + if (ip6_keepfaith) { + if (ip6_forward_rt.ro_rt && ip6_forward_rt.ro_rt->rt_ifp + && ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_FAITH) { + /* XXX do we need more sanity checks? */ + ours = 1; + deliverifp = ip6_forward_rt.ro_rt->rt_ifp; /* faith */ + goto hbhcheck; + } + } +#endif + +#ifdef NATPT + /* + * NAT-PT (Network Address Translation - Protocol Translation) + */ + if (ip6_protocol_tr) { + struct mbuf *m1 = NULL; + + switch (natpt_in6(m, &m1)) { + case IPPROTO_IP: + goto processpacket; + case IPPROTO_IPV4: + ip_forward(m1, 0); + break; + case IPPROTO_IPV6: + ip6_forward(m1, 0); + break; + case IPPROTO_MAX: /* discard this packet */ + default: + break; + case IPPROTO_DONE: /* discard without free */ + return; + } + + if (m != m1) + m_freem(m); + + return; + } + + processpacket: +#endif + +#if 0 + { + /* + * Last resort: check in6_ifaddr for incoming interface. + * The code is here until I update the "goto ours hack" code above + * working right. + */ + struct ifaddr *ifa; + for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first; + ifa; + ifa = ifa->ifa_list.tqe_next) { + if (ifa->ifa_addr == NULL) + continue; /* just for safety */ + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + if (IN6_ARE_ADDR_EQUAL(IFA_IN6(ifa), &ip6->ip6_dst)) { + ours = 1; + deliverifp = ifa->ifa_ifp; + goto hbhcheck; + } + } + } +#endif + + /* + * Now there is no reason to process the packet if it's not our own + * and we're not a router. + */ + if (!ip6_forwarding) { + ip6stat.ip6s_cantforward++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } + + hbhcheck: + /* + * record address information into m_aux, if we don't have one yet. + * note that we are unable to record it, if the address is not listed + * as our interface address (e.g. multicast addresses, addresses + * within FAITH prefixes and such). + */ + if (deliverifp && !ip6_getdstifaddr(m)) { + struct in6_ifaddr *ia6; + + ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); + if (ia6) { + if (!ip6_setdstifaddr(m, ia6)) { + /* + * XXX maybe we should drop the packet here, + * as we could not provide enough information + * to the upper layers. + */ + } + } + } + + /* + * Process Hop-by-Hop options header if it's contained. + * m may be modified in ip6_hopopts_input(). + * If a JumboPayload option is included, plen will also be modified. + */ + plen = (u_int32_t)ntohs(ip6->ip6_plen); + if (ip6->ip6_nxt == IPPROTO_HOPOPTS) { + struct ip6_hbh *hbh; + + if (ip6_hopopts_input(&plen, &rtalert, &m, &off)) { +#if 0 /*touches NULL pointer*/ + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); +#endif + return; /* m have already been freed */ + } + + /* adjust pointer */ + ip6 = mtod(m, struct ip6_hdr *); + + /* + * if the payload length field is 0 and the next header field + * indicates Hop-by-Hop Options header, then a Jumbo Payload + * option MUST be included. + */ + if (ip6->ip6_plen == 0 && plen == 0) { + /* + * Note that if a valid jumbo payload option is + * contained, ip6_hoptops_input() must set a valid + * (non-zero) payload length to the variable plen. + */ + ip6stat.ip6s_badoptions++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); + icmp6_error(m, ICMP6_PARAM_PROB, + ICMP6_PARAMPROB_HEADER, + (caddr_t)&ip6->ip6_plen - (caddr_t)ip6); + return; + } +#ifndef PULLDOWN_TEST + /* ip6_hopopts_input() ensures that mbuf is contiguous */ + hbh = (struct ip6_hbh *)(ip6 + 1); +#else + IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), + sizeof(struct ip6_hbh)); + if (hbh == NULL) { + ip6stat.ip6s_tooshort++; + return; + } +#endif + nxt = hbh->ip6h_nxt; + + /* + * accept the packet if a router alert option is included + * and we act as an IPv6 router. + */ + if (rtalert != ~0 && ip6_forwarding) + ours = 1; + } else + nxt = ip6->ip6_nxt; + + /* + * Check that the amount of data in the buffers + * is as at least much as the IPv6 header would have us expect. + * Trim mbufs if longer than we expect. + * Drop packet if shorter than we expect. + */ + if (m->m_pkthdr.len - sizeof(struct ip6_hdr) < plen) { + ip6stat.ip6s_tooshort++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); + goto bad; + } + if (m->m_pkthdr.len > sizeof(struct ip6_hdr) + plen) { + if (m->m_len == m->m_pkthdr.len) { + m->m_len = sizeof(struct ip6_hdr) + plen; + m->m_pkthdr.len = sizeof(struct ip6_hdr) + plen; + } else + m_adj(m, sizeof(struct ip6_hdr) + plen - m->m_pkthdr.len); + } + + /* + * Forward if desirable. + */ + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { + /* + * If we are acting as a multicast router, all + * incoming multicast packets are passed to the + * kernel-level multicast forwarding function. + * The packet is returned (relatively) intact; if + * ip6_mforward() returns a non-zero value, the packet + * must be discarded, else it may be accepted below. + */ + if (ip6_mrouter && ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) { + ip6stat.ip6s_cantforward++; + m_freem(m); + return; + } + if (!ours) { + m_freem(m); + return; + } + } else if (!ours) { + ip6_forward(m, 0); + return; + } + + ip6 = mtod(m, struct ip6_hdr *); + + /* + * Malicious party may be able to use IPv4 mapped addr to confuse + * tcp/udp stack and bypass security checks (act as if it was from + * 127.0.0.1 by using IPv6 src ::ffff:127.0.0.1). Be cautious. + * + * For SIIT end node behavior, you may want to disable the check. + * However, you will become vulnerable to attacks using IPv4 mapped + * source. + */ + if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || + IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { + ip6stat.ip6s_badscope++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } + + /* + * Tell launch routine the next header + */ +#if defined(__NetBSD__) && defined(IFA_STATS) + if (deliverifp != NULL) { + struct in6_ifaddr *ia6; + ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); + if (ia6) + ia6->ia_ifa.ifa_data.ifad_inbytes += m->m_pkthdr.len; + } +#endif + ip6stat.ip6s_delivered++; + in6_ifstat_inc(deliverifp, ifs6_in_deliver); + nest = 0; + + while (nxt != IPPROTO_DONE) { + if (ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) { + ip6stat.ip6s_toomanyhdr++; + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } + + /* + * protection against faulty packet - there should be + * more sanity checks in header chain processing. + */ + if (m->m_pkthdr.len < off) { + ip6stat.ip6s_tooshort++; + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } + +#if 0 + /* + * do we need to do it for every header? yeah, other + * functions can play with it (like re-allocate and copy). + */ + mhist = ip6_addaux(m); + if (mhist && M_TRAILINGSPACE(mhist) >= sizeof(nxt)) { + hist = mtod(mhist, caddr_t) + mhist->m_len; + bcopy(&nxt, hist, sizeof(nxt)); + mhist->m_len += sizeof(nxt); + } else { + ip6stat.ip6s_toomanyhdr++; + log(LOG_FAIL, "%s.%d\n", __FUNCTION__, __LINE__); + goto bad; + } +#endif + +#if defined(IPSEC) && !defined(__OpenBSD__) + /* + * enforce IPsec policy checking if we are seeing last header. + * note that we do not visit this with protocols with pcb layer + * code - like udp/tcp/raw ip. + */ + if ((inet6sw[ip6_protox[nxt]].pr_flags & PR_LASTHDR) != 0 && + ipsec6_in_reject(m, NULL)) { + ipsec6stat.in_polvio++; + goto bad; + } +#endif +#ifdef MIP6 + /* + * XXX + * check if the packet was tunneled after all extion + * headers have been processed. get from Ericsson + * code. need more consideration. + */ + if ((nxt != IPPROTO_HOPOPTS) && (nxt != IPPROTO_DSTOPTS) && + (nxt != IPPROTO_ROUTING) && (nxt != IPPROTO_FRAGMENT) && + (nxt != IPPROTO_ESP) && (nxt != IPPROTO_AH)) { + if (mip6_route_optimize(m)) + goto bad; + } +#endif /* MIP6 */ + nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &off, nxt); + } + return; + bad: + m_freem(m); +} + +/* + * set/grab in6_ifaddr correspond to IPv6 destination address. + * XXX backward compatibility wrapper + */ +static struct mbuf * +ip6_setdstifaddr(m, ia6) + struct mbuf *m; + struct in6_ifaddr *ia6; +{ + struct mbuf *n; + + n = ip6_addaux(m); + if (n) + mtod(n, struct ip6aux *)->ip6a_dstia6 = ia6; + return n; /* NULL if failed to set */ +} + +struct in6_ifaddr * +ip6_getdstifaddr(m) + struct mbuf *m; +{ + struct mbuf *n; + + n = ip6_findaux(m); + if (n) + return mtod(n, struct ip6aux *)->ip6a_dstia6; + else + return NULL; +} + +/* + * Hop-by-Hop options header processing. If a valid jumbo payload option is + * included, the real payload length will be stored in plenp. + */ +static int +ip6_hopopts_input(plenp, rtalertp, mp, offp) + u_int32_t *plenp; + u_int32_t *rtalertp; /* XXX: should be stored more smart way */ + struct mbuf **mp; + int *offp; +{ + struct mbuf *m = *mp; + int off = *offp, hbhlen; + struct ip6_hbh *hbh; + u_int8_t *opt; + + /* validation of the length of the header */ +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, sizeof(*hbh), -1); + hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off); + hbhlen = (hbh->ip6h_len + 1) << 3; + + IP6_EXTHDR_CHECK(m, off, hbhlen, -1); + hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, + sizeof(struct ip6_hdr), sizeof(struct ip6_hbh)); + if (hbh == NULL) { + ip6stat.ip6s_tooshort++; + return -1; + } + hbhlen = (hbh->ip6h_len + 1) << 3; + IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), + hbhlen); + if (hbh == NULL) { + ip6stat.ip6s_tooshort++; + return -1; + } +#endif + off += hbhlen; + hbhlen -= sizeof(struct ip6_hbh); + opt = (u_int8_t *)hbh + sizeof(struct ip6_hbh); + + if (ip6_process_hopopts(m, (u_int8_t *)hbh + sizeof(struct ip6_hbh), + hbhlen, rtalertp, plenp) < 0) + return(-1); + + *offp = off; + *mp = m; + return(0); +} + +/* + * Search header for all Hop-by-hop options and process each option. + * This function is separate from ip6_hopopts_input() in order to + * handle a case where the sending node itself process its hop-by-hop + * options header. In such a case, the function is called from ip6_output(). + * + * The function assumes that hbh header is located right after the IPv6 header + * (RFC2460 p7), opthead is pointer into data content in m, and opthead to + * opthead + hbhlen is located in continuous memory region. + */ +int +ip6_process_hopopts(m, opthead, hbhlen, rtalertp, plenp) + struct mbuf *m; + u_int8_t *opthead; + int hbhlen; + u_int32_t *rtalertp; + u_int32_t *plenp; +{ + struct ip6_hdr *ip6; + int optlen = 0; + u_int8_t *opt = opthead; + u_int16_t rtalert_val; + u_int32_t jumboplen; + const int erroff = sizeof(struct ip6_hdr) + sizeof(struct ip6_hbh); + + for (; hbhlen > 0; hbhlen -= optlen, opt += optlen) { + switch (*opt) { + case IP6OPT_PAD1: + optlen = 1; + break; + case IP6OPT_PADN: + if (hbhlen < IP6OPT_MINLEN) { + ip6stat.ip6s_toosmall++; + goto bad; + } + optlen = *(opt + 1) + 2; + break; + case IP6OPT_RTALERT: + /* XXX may need check for alignment */ + if (hbhlen < IP6OPT_RTALERT_LEN) { + ip6stat.ip6s_toosmall++; + goto bad; + } + if (*(opt + 1) != IP6OPT_RTALERT_LEN - 2) { + /* XXX stat */ + icmp6_error(m, ICMP6_PARAM_PROB, + ICMP6_PARAMPROB_HEADER, + erroff + opt + 1 - opthead); + return(-1); + } + optlen = IP6OPT_RTALERT_LEN; + bcopy((caddr_t)(opt + 2), (caddr_t)&rtalert_val, 2); + *rtalertp = ntohs(rtalert_val); + break; + case IP6OPT_JUMBO: + /* XXX may need check for alignment */ + if (hbhlen < IP6OPT_JUMBO_LEN) { + ip6stat.ip6s_toosmall++; + goto bad; + } + if (*(opt + 1) != IP6OPT_JUMBO_LEN - 2) { + /* XXX stat */ + icmp6_error(m, ICMP6_PARAM_PROB, + ICMP6_PARAMPROB_HEADER, + erroff + opt + 1 - opthead); + return(-1); + } + optlen = IP6OPT_JUMBO_LEN; + + /* + * IPv6 packets that have non 0 payload length + * must not contain a jumbo payload option. + */ + ip6 = mtod(m, struct ip6_hdr *); + if (ip6->ip6_plen) { + ip6stat.ip6s_badoptions++; + icmp6_error(m, ICMP6_PARAM_PROB, + ICMP6_PARAMPROB_HEADER, + erroff + opt - opthead); + return(-1); + } + + /* + * We may see jumbolen in unaligned location, so + * we'd need to perform bcopy(). + */ + bcopy(opt + 2, &jumboplen, sizeof(jumboplen)); + jumboplen = (u_int32_t)htonl(jumboplen); + +#if 1 + /* + * if there are multiple jumbo payload options, + * *plenp will be non-zero and the packet will be + * rejected. + * the behavior may need some debate in ipngwg - + * multiple options does not make sense, however, + * there's no explicit mention in specification. + */ + if (*plenp != 0) { + ip6stat.ip6s_badoptions++; + icmp6_error(m, ICMP6_PARAM_PROB, + ICMP6_PARAMPROB_HEADER, + erroff + opt + 2 - opthead); + return(-1); + } +#endif + + /* + * jumbo payload length must be larger than 65535. + */ + if (jumboplen <= IPV6_MAXPACKET) { + ip6stat.ip6s_badoptions++; + icmp6_error(m, ICMP6_PARAM_PROB, + ICMP6_PARAMPROB_HEADER, + erroff + opt + 2 - opthead); + return(-1); + } + *plenp = jumboplen; + + break; + default: /* unknown option */ + if (hbhlen < IP6OPT_MINLEN) { + ip6stat.ip6s_toosmall++; + goto bad; + } + optlen = ip6_unknown_opt(opt, m, + erroff + opt - opthead); + if (optlen == -1) + return(-1); + optlen += 2; + break; + } + } + + return(0); + + bad: + m_freem(m); + return(-1); +} + +/* + * Unknown option processing. + * The third argument `off' is the offset from the IPv6 header to the option, + * which is necessary if the IPv6 header the and option header and IPv6 header + * is not continuous in order to return an ICMPv6 error. + */ +int +ip6_unknown_opt(optp, m, off) + u_int8_t *optp; + struct mbuf *m; + int off; +{ + struct ip6_hdr *ip6; + + switch (IP6OPT_TYPE(*optp)) { + case IP6OPT_TYPE_SKIP: /* ignore the option */ + return((int)*(optp + 1)); + case IP6OPT_TYPE_DISCARD: /* silently discard */ + m_freem(m); + return(-1); + case IP6OPT_TYPE_FORCEICMP: /* send ICMP even if multicasted */ + ip6stat.ip6s_badoptions++; + icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, off); + return(-1); + case IP6OPT_TYPE_ICMP: /* send ICMP if not multicasted */ + ip6stat.ip6s_badoptions++; + ip6 = mtod(m, struct ip6_hdr *); + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || + (m->m_flags & (M_BCAST|M_MCAST))) + m_freem(m); + else + icmp6_error(m, ICMP6_PARAM_PROB, + ICMP6_PARAMPROB_OPTION, off); + return(-1); + } + + m_freem(m); /* XXX: NOTREACHED */ + return(-1); +} + +/* + * Create the "control" list for this pcb. + * The function will not modify mbuf chain at all. + * + * with KAME mbuf chain restriction: + * The routine will be called from upper layer handlers like tcp6_input(). + * Thus the routine assumes that the caller (tcp6_input) have already + * called IP6_EXTHDR_CHECK() and all the extension headers are located in the + * very first mbuf on the mbuf chain. + */ +void +ip6_savecontrol(in6p, ip6, m, ctl, prevctlp) +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(HAVE_NRL_INPCB) + struct inpcb *in6p; +#else + struct in6pcb *in6p; +#endif + struct ip6_hdr *ip6; + struct mbuf *m; + struct ip6_recvpktopts *ctl, **prevctlp; +{ +#define IS2292(x, y) ((in6p->in6p_flags & IN6P_RFC2292) ? (x) : (y)) + struct mbuf **mp; + struct cmsghdr *cm = NULL; + struct ip6_recvpktopts *prevctl = NULL; +#ifdef HAVE_NRL_INPCB +# define in6p_flags inp_flags +#endif +#ifdef __bsdi__ +# define sbcreatecontrol so_cmsg +#endif + int privileged = 1; + + if (ctl == NULL) /* validity check */ + return; + bzero(ctl, sizeof(*ctl)); /* XXX is it really OK? */ + mp = &ctl->head; + + /* + * If caller wanted to keep history, allocate space to store the + * history at the first time. + */ + if (prevctlp) { + if (*prevctlp == NULL) { + MALLOC(prevctl, struct ip6_recvpktopts *, + sizeof(*prevctl), M_IP6OPT, M_NOWAIT); + if (prevctl == NULL) { + printf("ip6_savecontrol: can't allocate " + " enough space for history\n"); + return; + } + bzero(prevctl, sizeof(*prevctl)); + *prevctlp = prevctl; + } + else + prevctl = *prevctlp; + } + + +#ifdef SO_TIMESTAMP + if ((in6p->in6p_socket->so_options & SO_TIMESTAMP) != 0) { + struct timeval tv; + + microtime(&tv); + *mp = sbcreatecontrol((caddr_t) &tv, sizeof(tv), + SCM_TIMESTAMP, SOL_SOCKET); + if (*mp) { + /* always set regradless of the previous value */ + ctl->timestamp = *mp; + mp = &(*mp)->m_next; + } + } +#endif + + /* RFC 2292 sec. 5 */ + if ((in6p->in6p_flags & IN6P_PKTINFO) != 0) { + struct in6_pktinfo pi6, *prevpi = NULL; + bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr)); + if (IN6_IS_SCOPE_LINKLOCAL(&pi6.ipi6_addr) || + IN6_IS_ADDR_MC_INTFACELOCAL(&pi6.ipi6_addr)) + pi6.ipi6_addr.s6_addr16[1] = 0; + pi6.ipi6_ifindex = (m && m->m_pkthdr.rcvif) + ? m->m_pkthdr.rcvif->if_index + : 0; + if (prevctl && prevctl->pktinfo) { + cm = mtod(prevctl->pktinfo, struct cmsghdr *); + prevpi = (struct in6_pktinfo *)CMSG_DATA(cm); + } + + /* + * Make a new option only if this is the first time or if the + * option value is chaned from last time. + */ + if (prevpi == NULL || bcmp(prevpi, &pi6, sizeof(pi6))) { + *mp = sbcreatecontrol((caddr_t) &pi6, + sizeof(struct in6_pktinfo), + IS2292(IPV6_2292PKTINFO, IPV6_PKTINFO), + IPPROTO_IPV6); + if (*mp) { + ctl->pktinfo = *mp; + mp = &(*mp)->m_next; + } + } + } + + if ((in6p->in6p_flags & IN6P_HOPLIMIT) != 0) { + int hlim = ip6->ip6_hlim & 0xff, oldhlim = -1; + + if (prevctl && prevctl->hlim) { + cm = mtod(prevctl->hlim, struct cmsghdr *); + bcopy(CMSG_DATA(cm), &oldhlim, sizeof(oldhlim)); + oldhlim &= 0xff; + } + + if (oldhlim < 0 || hlim != oldhlim) { + *mp = sbcreatecontrol((caddr_t) &hlim, sizeof(int), + IS2292(IPV6_2292HOPLIMIT, IPV6_HOPLIMIT), + IPPROTO_IPV6); + if (*mp) { + ctl->hlim = *mp; + mp = &(*mp)->m_next; + } + } + } + + if ((in6p->in6p_flags & IN6P_TCLASS) != 0) { + u_int32_t flowinfo; + int oflowinfo = -1; + int v; + + flowinfo = (u_int32_t)ntohl(ip6->ip6_flow & IPV6_FLOWINFO_MASK); + flowinfo >>= 20; + + if (prevctl && prevctl->hlim) { + cm = mtod(prevctl->hlim, struct cmsghdr *); + bcopy(CMSG_DATA(cm), &v, sizeof(v)); + oflowinfo = v & 0xff; + } + + if (oflowinfo < 0 || flowinfo != oflowinfo) { + v = flowinfo & 0xff; + *mp = sbcreatecontrol((caddr_t) &v, sizeof(v), + IPV6_TCLASS, IPPROTO_IPV6); + if (*mp) { + ctl->hlim = *mp; + mp = &(*mp)->m_next; + } + } + } + + /* + * IPV6_HOPOPTS socket option. We require super-user privilege + * for the option, but it might be too strict, since there might + * be some hop-by-hop options which can be returned to normal user. + * See RFC 2292 section 6. + */ + if ((in6p->in6p_flags & IN6P_HOPOPTS) != 0 && privileged) { + /* + * Check if a hop-by-hop options header is contatined in the + * received packet, and if so, store the options as ancillary + * data. Note that a hop-by-hop options header must be + * just after the IPv6 header, which fact is assured through + * the IPv6 input processing. + */ + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + if (ip6->ip6_nxt == IPPROTO_HOPOPTS) { + struct ip6_hbh *hbh, *prevhbh = NULL; + int hbhlen = 0, prevhbhlen = 0; +#ifdef PULLDOWN_TEST + struct mbuf *ext; +#endif + +#ifndef PULLDOWN_TEST + hbh = (struct ip6_hbh *)(ip6 + 1); + hbhlen = (hbh->ip6h_len + 1) << 3; +#else + ext = ip6_pullexthdr(m, sizeof(struct ip6_hdr), + ip6->ip6_nxt); + if (ext == NULL) { + ip6stat.ip6s_tooshort++; + return; + } + hbh = mtod(ext, struct ip6_hbh *); + hbhlen = (hbh->ip6h_len + 1) << 3; + if (hbhlen != ext->m_len) { + m_freem(ext); + ip6stat.ip6s_tooshort++; + return; + } +#endif + + if (prevctl && prevctl->hbh) { + cm = mtod(prevctl->hbh, struct cmsghdr *); + prevhbh = (struct ip6_hbh *)CMSG_DATA(cm); + prevhbhlen = (prevhbh->ip6h_len + 1) << 3; + } + /* + * Check if there's difference between the current + * and previous HbH headers. + * XXX: should the next header field be ignored? + */ + if (prevhbh == NULL || hbhlen != prevhbhlen || + bcmp(prevhbh, hbh, hbhlen)) { + /* + * XXX: We copy whole the header even if a + * jumbo payload option is included, which + * option is to be removed before returning + * in the RFC 2292. + * Note: this constraint is removed in + * 2292bis. + */ + *mp = sbcreatecontrol((caddr_t)hbh, hbhlen, + IS2292(IPV6_2292HOPOPTS, IPV6_HOPOPTS), + IPPROTO_IPV6); + if (*mp) { + ctl->hbh = *mp; + mp = &(*mp)->m_next; + } + } +#ifdef PULLDOWN_TEST + m_freem(ext); +#endif + } + } + + if ((in6p->in6p_flags & (IN6P_RTHDR | IN6P_DSTOPTS)) != 0) { + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + int nxt = ip6->ip6_nxt, off = sizeof(struct ip6_hdr); + + /* + * Search for destination options headers or routing + * header(s) through the header chain, and stores each + * header as ancillary data. + * Note that the order of the headers remains in + * the chain of ancillary data. + */ + while (1) { /* is explicit loop prevention necessary? */ + struct ip6_ext *ip6e = NULL; + int elen; +#ifdef PULLDOWN_TEST + struct mbuf *ext = NULL; +#endif + + /* + * if it is not an extension header, don't try to + * pull it from the chain. + */ + switch (nxt) { + case IPPROTO_DSTOPTS: + case IPPROTO_ROUTING: + case IPPROTO_HOPOPTS: + case IPPROTO_AH: /* is it possible? */ + break; + default: + goto loopend; + } + +#ifndef PULLDOWN_TEST + if (off + sizeof(*ip6e) > m->m_len) + goto loopend; + ip6e = (struct ip6_ext *)(mtod(m, caddr_t) + off); + if (nxt == IPPROTO_AH) + elen = (ip6e->ip6e_len + 2) << 2; + else + elen = (ip6e->ip6e_len + 1) << 3; + if (off + elen > m->m_len) + goto loopend; +#else + ext = ip6_pullexthdr(m, off, nxt); + if (ext == NULL) { + ip6stat.ip6s_tooshort++; + return; + } + ip6e = mtod(ext, struct ip6_ext *); + if (nxt == IPPROTO_AH) + elen = (ip6e->ip6e_len + 2) << 2; + else + elen = (ip6e->ip6e_len + 1) << 3; + if (elen != ext->m_len) { + m_freem(ext); + ip6stat.ip6s_tooshort++; + return; + } +#endif + + switch (nxt) { + case IPPROTO_DSTOPTS: + { + struct ip6_dest *prevdest = NULL; + int prevdestlen = 0; + + if (!(in6p->in6p_flags & IN6P_DSTOPTS)) + break; + + /* + * We also require super-user privilege for + * the option. See comments on IN6_HOPOPTS. + */ + + if (prevctl && prevctl->dest) { + cm = mtod(prevctl->dest, + struct cmsghdr *); + prevdest = (struct ip6_dest *)CMSG_DATA(cm); + prevdestlen = + (prevdest->ip6d_len + 1) << 3; + } + + /* + * If this is the 1st dst opt header + * we enconter and this header is + * not different from the previous one, + * simply ignore the header. + */ + if (ctl->dest == NULL && prevdest && + prevdestlen == elen && + bcmp(ip6e, prevdest, elen) == 0) + break; + + *mp = sbcreatecontrol((caddr_t)ip6e, elen, + IS2292(IPV6_2292DSTOPTS, + IPV6_DSTOPTS), + IPPROTO_IPV6); + if (ctl->dest == NULL) + ctl->dest = *mp; + if (*mp) + mp = &(*mp)->m_next; + break; + } + case IPPROTO_ROUTING: + { + struct ip6_rthdr *prevrth = NULL; + int prevrhlen = 0; + + if (!in6p->in6p_flags & IN6P_RTHDR) + break; + + if (prevctl && prevctl->rthdr) { + cm = mtod(prevctl->rthdr, + struct cmsghdr *); + prevrth = (struct ip6_rthdr *)CMSG_DATA(cm); + prevrhlen = + (prevrth->ip6r_len + 1) << 3; + } + + /* + * Check if the rthdr should be passed to + * a user. See the comments for dstopt hdr. + */ + if (ctl->rthdr == NULL && prevrth && + prevrhlen == elen && + bcmp(ip6e, prevrth, elen) == 0) + break; + + *mp = sbcreatecontrol((caddr_t)ip6e, elen, + IS2292(IPV6_2292RTHDR, + IPV6_RTHDR), + IPPROTO_IPV6); + if (ctl->rthdr == NULL) + ctl->rthdr = *mp; + if (*mp) + mp = &(*mp)->m_next; + break; + } + case IPPROTO_HOPOPTS: + case IPPROTO_AH: /* is it possible? */ + break; + + default: + /* + * other cases have been filtered in the above. + * none will visit this case. here we supply + * the code just in case (nxt overwritten or + * other cases). + */ +#ifdef PULLDOWN_TEST + m_freem(ext); +#endif + goto loopend; + + } + + /* proceed with the next header. */ + off += elen; + nxt = ip6e->ip6e_nxt; + ip6e = NULL; +#ifdef PULLDOWN_TEST + m_freem(ext); + ext = NULL; +#endif + } + loopend: + ; + } + +#ifdef __bsdi__ +# undef sbcreatecontrol +#endif +#ifdef __OpenBSD__ +# undef in6p_flags +#endif +#undef IS2292 +} + +void +ip6_notify_pmtu(in6p, dst, mtu) +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(HAVE_NRL_INPCB) + struct inpcb *in6p; +#else + struct in6pcb *in6p; +#endif + struct sockaddr_in6 *dst; + u_int32_t *mtu; +{ + struct socket *so; + struct mbuf *m_mtu; + struct ip6_mtuinfo mtuctl; +#ifdef __bsdi__ +# define sbcreatecontrol so_cmsg +#endif + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(HAVE_NRL_INPCB) + so = in6p->inp_socket; +#else + so = in6p->in6p_socket; +#endif + + if (mtu == NULL) + return; + +#ifdef DIAGNOSTIC + if (so == NULL) /* I believe this is impossible */ + panic("ip6_notify_pmtu: socket is NULL"); +#endif + + bzero(&mtuctl, sizeof(mtuctl)); /* zero-clear for safety */ + mtuctl.ip6m_mtu = *mtu; + mtuctl.ip6m_addr = *dst; +#ifndef SCOPEDROUTING + in6_recoverscope(&mtuctl.ip6m_addr, &mtuctl.ip6m_addr.sin6_addr, NULL); +#endif + + if ((m_mtu = sbcreatecontrol((caddr_t)&mtuctl, sizeof(mtuctl), + IPV6_PATHMTU, IPPROTO_IPV6)) == NULL) + return; + + if (sbappendaddr(&so->so_rcv, (struct sockaddr *)dst, NULL, m_mtu) + == 0) { + m_freem(m_mtu); + /* XXX: should count statistics */ + } else + sorwakeup(so); + + return; + +#ifdef __bsdi__ +# undef sbcreatecontrol +#endif +} + +#ifdef PULLDOWN_TEST +/* + * pull single extension header from mbuf chain. returns single mbuf that + * contains the result, or NULL on error. + */ +static struct mbuf * +ip6_pullexthdr(m, off, nxt) + struct mbuf *m; + size_t off; + int nxt; +{ + struct ip6_ext ip6e; + size_t elen; + struct mbuf *n; + +#ifdef DIAGNOSTIC + switch (nxt) { + case IPPROTO_DSTOPTS: + case IPPROTO_ROUTING: + case IPPROTO_HOPOPTS: + case IPPROTO_AH: /* is it possible? */ + break; + default: + printf("ip6_pullexthdr: invalid nxt=%d\n", nxt); + } +#endif + + m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e); + if (nxt == IPPROTO_AH) + elen = (ip6e.ip6e_len + 2) << 2; + else + elen = (ip6e.ip6e_len + 1) << 3; + + MGET(n, M_DONTWAIT, MT_DATA); + if (n && elen >= MLEN) { + MCLGET(n, M_DONTWAIT); + if ((n->m_flags & M_EXT) == 0) { + m_free(n); + n = NULL; + } + } + if (!n) + return NULL; + + n->m_len = 0; + if (elen >= M_TRAILINGSPACE(n)) { + m_free(n); + return NULL; + } + + m_copydata(m, off, elen, mtod(n, caddr_t)); + n->m_len = elen; + return n; +} +#endif + +/* + * Merge new IPv6 received options to previous ones. + * If a new option is not given, just re-link the option chain. + * If an old option exists but a corresponding new one doesn't, just + * keep the ole option. + * If a new option exists but a corresponding old one doesn't, just + * copy the new option. + * If both new and old options exist, free old one and overwrite the option + * with the new option. + * Otherwise, do nothing for the option. + * XXX: in any case, options that don't follow the recommend order and + * number of extension headers (RFC 2460 Section 4.1) are simply ignored. + * XXX: We assume that each option is stored in a single mbuf. + */ +#define CLEAN_RECVOPT(old, type) \ +do { \ + if ((old)->type && (old)->type->m_next) { \ + (old)->type->m_next = NULL; \ + } \ +} while (0) +#define MERGE_RECVOPT(new, old, type) if ((new)->type) {\ + if ((old)->type)\ + m_free((old)->type);\ + (old)->type = m_copy((new)->type, 0, (new)->type->m_len);\ + if (((old)->type) && ((old)->type->m_next)) {\ + m_freem((old)->type);\ + old->type = NULL;\ + }\ + } +#define LINK_RECVOPTS(opt, type, p) if ((opt)->type) {\ + *(p) = (opt)->type;\ + (p) = &(opt)->type->m_next;\ + } + +static void dump_inputopts __P((char *, struct ip6_recvpktopts *)); +static void +dump_inputopts(str, p) + char *str; + struct ip6_recvpktopts *p; +{ +#if 1 + return; +#else +#define PRINT1(p, name) \ +do { \ + if (p->name) { \ + printf(" %s: %p", #name, (p)->name); \ + if (p->name->m_next) \ + printf("[%p]", (p)->name->m_next); \ + } \ +} while (0) + + printf("%s p=%p head=%p", str, p, p->head); + PRINT1(p, hlim); + PRINT1(p, pktinfo); + PRINT1(p, hbh); + PRINT1(p, dest); + PRINT1(p, rthdr); + printf("\n"); +#undef PRINT1 +#endif +} + +void +ip6_update_recvpcbopt(old, new) + struct ip6_recvpktopts *new, *old; +{ + struct mbuf **mp; + + if (old == NULL) { + printf("ip6_update_recvpcbopt: invalid arguments\n"); + return; + } + + dump_inputopts("old before", old); + if (new) + dump_inputopts("new before", new); + +#if 0 + /* + * cleanup m->m_next linkage. note that we do it in reverse order + * to prevent possible memory leakage. + */ + old->head = NULL; + CLEAN_RECVOPT(old, rthdr); + CLEAN_RECVOPT(old, dest); + CLEAN_RECVOPT(old, hbh); + CLEAN_RECVOPT(old, pktinfo); + CLEAN_RECVOPT(old, hlim); +#endif + + if (new) { + MERGE_RECVOPT(new, old, hlim); + MERGE_RECVOPT(new, old, pktinfo); + MERGE_RECVOPT(new, old, hbh); + MERGE_RECVOPT(new, old, dest); + MERGE_RECVOPT(new, old, rthdr); + } + + dump_inputopts("old middle", old); + if (new) + dump_inputopts("new middle", new); + + /* link options */ + mp = &old->head; + LINK_RECVOPTS(old, hlim, mp); + LINK_RECVOPTS(old, pktinfo, mp); + LINK_RECVOPTS(old, hbh, mp); + LINK_RECVOPTS(old, dest, mp); + LINK_RECVOPTS(old, rthdr, mp); + *mp = NULL; + + dump_inputopts("old after", old); + if (new) + dump_inputopts("new after", new); +} + +#undef MERGE_RECVOPT +#undef LINK_RECVOPTS + +void +ip6_reset_rcvopt(opts, optname) + struct ip6_recvpktopts *opts; + int optname; +{ + if (opts == NULL) + return; + + switch (optname) { + case IPV6_RECVPKTINFO: + if (opts->pktinfo) m_free(opts->pktinfo); + opts->pktinfo = NULL; + break; + case IPV6_RECVHOPLIMIT: + if (opts->hlim) m_free(opts->hlim); + opts->hlim = NULL; + break; + case IPV6_RECVHOPOPTS: + if (opts->hbh) m_free(opts->hbh); + opts->hbh = NULL; + break; + case IPV6_RECVDSTOPTS: + if (opts->dest) m_free(opts->dest); + opts->dest = NULL; + break; + case IPV6_RECVRTHDR: + if (opts->rthdr) m_free(opts->rthdr); + opts->rthdr = NULL; + break; + default: + printf("ip6_reset_rcvopt: invalid option name (%d)\n", + optname); + return; + } + + ip6_update_recvpcbopt(opts, NULL); /* re-link the option chain */ +} + +/* + * Get pointer to the previous header followed by the header + * currently processed. + * XXX: This function supposes that + * M includes all headers, + * the next header field and the header length field of each header + * are valid, and + * the sum of each header length equals to OFF. + * Because of these assumptions, this function must be called very + * carefully. Moreover, it will not be used in the near future when + * we develop `neater' mechanism to process extension headers. + */ +char * +ip6_get_prevhdr(m, off) + struct mbuf *m; + int off; +{ + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + + if (off == sizeof(struct ip6_hdr)) + return(&ip6->ip6_nxt); + else { + int len, nxt; + struct ip6_ext *ip6e = NULL; + + nxt = ip6->ip6_nxt; + len = sizeof(struct ip6_hdr); + while (len < off) { + ip6e = (struct ip6_ext *)(mtod(m, caddr_t) + len); + + switch (nxt) { + case IPPROTO_FRAGMENT: + len += sizeof(struct ip6_frag); + break; + case IPPROTO_AH: + len += (ip6e->ip6e_len + 2) << 2; + break; + default: + len += (ip6e->ip6e_len + 1) << 3; + break; + } + nxt = ip6e->ip6e_nxt; + } + if (ip6e) + return(&ip6e->ip6e_nxt); + else + return NULL; + } +} + +/* + * get next header offset. m will be retained. + */ +int +ip6_nexthdr(m, off, proto, nxtp) + struct mbuf *m; + int off; + int proto; + int *nxtp; +{ + struct ip6_hdr ip6; + struct ip6_ext ip6e; + struct ip6_frag fh; + + /* just in case */ + if (m == NULL) + panic("ip6_nexthdr: m == NULL"); + if ((m->m_flags & M_PKTHDR) == 0 || m->m_pkthdr.len < off) + return -1; + + switch (proto) { + case IPPROTO_IPV6: + /* do not chase beyond intermediate IPv6 headers */ + if (off != 0) + return -1; + if (m->m_pkthdr.len < off + sizeof(ip6)) + return -1; + m_copydata(m, off, sizeof(ip6), (caddr_t)&ip6); + if (nxtp) + *nxtp = ip6.ip6_nxt; + off += sizeof(ip6); + return off; + + case IPPROTO_FRAGMENT: + /* + * terminate parsing if it is not the first fragment, + * it does not make sense to parse through it. + */ + if (m->m_pkthdr.len < off + sizeof(fh)) + return -1; + m_copydata(m, off, sizeof(fh), (caddr_t)&fh); + if ((ntohs(fh.ip6f_offlg) & IP6F_OFF_MASK) != 0) + return -1; + if (nxtp) + *nxtp = fh.ip6f_nxt; + off += sizeof(struct ip6_frag); + return off; + + case IPPROTO_AH: + if (m->m_pkthdr.len < off + sizeof(ip6e)) + return -1; + m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e); + if (nxtp) + *nxtp = ip6e.ip6e_nxt; + off += (ip6e.ip6e_len + 2) << 2; + if (m->m_pkthdr.len < off) + return -1; + return off; + + case IPPROTO_HOPOPTS: + case IPPROTO_ROUTING: + case IPPROTO_DSTOPTS: + if (m->m_pkthdr.len < off + sizeof(ip6e)) + return -1; + m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e); + if (nxtp) + *nxtp = ip6e.ip6e_nxt; + off += (ip6e.ip6e_len + 1) << 3; + if (m->m_pkthdr.len < off) + return -1; + return off; + + case IPPROTO_NONE: + case IPPROTO_ESP: + case IPPROTO_IPCOMP: + /* give up */ + return -1; + + default: + return -1; + } + + return -1; +} + +/* + * get offset for the last header in the chain. m will be kept untainted. + */ +int +ip6_lasthdr(m, off, proto, nxtp) + struct mbuf *m; + int off; + int proto; + int *nxtp; +{ + int newoff; + int nxt; + + if (!nxtp) { + nxt = -1; + nxtp = &nxt; + } + while (1) { + newoff = ip6_nexthdr(m, off, proto, nxtp); + if (newoff < 0) + return off; + else if (newoff < off) + return -1; /* invalid */ + else if (newoff == off) + return newoff; + + off = newoff; + proto = *nxtp; + } +} + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 4) +void +pfctlinput2(cmd, sa, ctlparam) + int cmd; + struct sockaddr *sa; + void *ctlparam; +{ + struct domain *dp; + struct protosw *pr; + + if (!sa) + return; + for (dp = domains; dp; dp = dp->dom_next) { + /* + * the check must be made by xx_ctlinput() anyways, to + * make sure we use data item pointed to by ctlparam in + * correct way. the following check is made just for safety. + */ + if (dp->dom_family != sa->sa_family) + continue; + + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) + if (pr->pr_ctlinput) + (*pr->pr_ctlinput)(cmd, sa, ctlparam); + } +} +#endif + +struct mbuf * +ip6_addaux(m) + struct mbuf *m; +{ + struct mbuf *n; + +#ifdef DIAGNOSTIC + if (sizeof(struct ip6aux) > MHLEN) + panic("assumption failed on sizeof(ip6aux)"); +#endif + n = m_aux_find(m, AF_INET6, -1); + if (n) { + if (n->m_len < sizeof(struct ip6aux)) { + printf("conflicting use of ip6aux"); + return NULL; + } + } else { + n = m_aux_add(m, AF_INET6, -1); + n->m_len = sizeof(struct ip6aux); + bzero(mtod(n, caddr_t), n->m_len); + } + return n; +} + +struct mbuf * +ip6_findaux(m) + struct mbuf *m; +{ + struct mbuf *n; + + n = m_aux_find(m, AF_INET6, -1); + if (n && n->m_len < sizeof(struct ip6aux)) { + printf("conflicting use of ip6aux"); + n = NULL; + } + return n; +} + +void +ip6_delaux(m) + struct mbuf *m; +{ + struct mbuf *n; + + n = m_aux_find(m, AF_INET6, -1); + if (n) + m_aux_delete(m, n); +} + +/* + * System control for IP6 + */ + +int inet6ctlerrmap[PRC_NCMDS] = { + 0, 0, 0, 0, + 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, + EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, + EMSGSIZE, EHOSTUNREACH, 0, 0, + 0, 0, 0, 0, + ENOPROTOOPT +}; + diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_mroute.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_mroute.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_mroute.c @@ -0,0 +1,2031 @@ +//========================================================================== +// +// src/sys/netinet6/ip6_mroute.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip6_mroute.c,v 1.58 2001/12/18 02:36:31 itojun Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* BSDI ip_mroute.c,v 2.10 1996/11/14 00:29:52 jch Exp */ + +/* + * IP multicast forwarding procedures + * + * Written by David Waitzman, BBN Labs, August 1988. + * Modified by Steve Deering, Stanford, February 1989. + * Modified by Mark J. Steiglitz, Stanford, May, 1991 + * Modified by Van Jacobson, LBL, January 1993 + * Modified by Ajit Thyagarajan, PARC, August 1993 + * Modified by Bill Fenenr, PARC, April 1994 + * + * MROUTING Revision: 3.5.1.2 + PIM-SMv2 (pimd) Support + */ + +/* + * XXX it seems that home address option processing should be reverted + * before calls to socket_send(). see sys/netinet6/dest6.c for details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#define M_HASCL(m) ((m)->m_flags & M_EXT) + +static int ip6_mdq __P((struct mbuf *, struct ifnet *, struct mf6c *)); +static void phyint_send __P((struct ip6_hdr *, struct mif6 *, struct mbuf *)); + +static int set_pim6 __P((int *)); +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) +static int get_pim6 __P((struct mbuf *)); +#endif +static int socket_send __P((struct socket *, struct mbuf *, + struct sockaddr_in6 *)); +static int register_send __P((struct ip6_hdr *, struct mif6 *, + struct mbuf *)); + +/* + * Globals. All but ip6_mrouter, ip6_mrtproto and mrt6stat could be static, + * except for netstat or debugging purposes. + */ +struct socket *ip6_mrouter = NULL; +int ip6_mrouter_ver = 0; +int ip6_mrtproto = IPPROTO_PIM; /* for netstat only */ +struct mrt6stat mrt6stat; + +#define NO_RTE_FOUND 0x1 +#define RTE_FOUND 0x2 + +struct mf6c *mf6ctable[MF6CTBLSIZ]; +u_char n6expire[MF6CTBLSIZ]; +#if (defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)) +struct mif6 mif6table[MAXMIFS]; +#else +static struct mif6 mif6table[MAXMIFS]; +#endif +#ifdef MRT6DEBUG +u_int mrt6debug = 0; /* debug level */ +#define DEBUG_MFC 0x02 +#define DEBUG_FORWARD 0x04 +#define DEBUG_EXPIRE 0x08 +#define DEBUG_XMIT 0x10 +#define DEBUG_REG 0x20 +#define DEBUG_PIM 0x40 +#endif + +static void expire_upcalls __P((void *)); +#define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */ +#define UPCALL_EXPIRE 6 /* number of timeouts */ + +#ifdef INET +#ifdef MROUTING +extern struct socket *ip_mrouter; +#endif +#endif + +/* + * 'Interfaces' associated with decapsulator (so we can tell + * packets that went through it from ones that get reflected + * by a broken gateway). These interfaces are never linked into + * the system ifnet list & no routes point to them. I.e., packets + * can't be sent this way. They only exist as a placeholder for + * multicast source verification. + */ +struct ifnet multicast_register_if; + +#define ENCAP_HOPS 64 + +/* + * Private variables. + */ +static mifi_t nummifs = 0; +static mifi_t reg_mif_num = (mifi_t)-1; + +static struct pim6stat pim6stat; +static int pim6; + +/* + * Hash function for a source, group entry + */ +#define MF6CHASH(a, g) MF6CHASHMOD((a).s6_addr32[0] ^ (a).s6_addr32[1] ^ \ + (a).s6_addr32[2] ^ (a).s6_addr32[3] ^ \ + (g).s6_addr32[0] ^ (g).s6_addr32[1] ^ \ + (g).s6_addr32[2] ^ (g).s6_addr32[3]) + +/* + * Find a route for a given origin IPv6 address and Multicast group address. + * Quality of service parameter to be added in the future!!! + */ + +#define MF6CFIND(o, g, rt) do { \ + struct mf6c *_rt = mf6ctable[MF6CHASH(o,g)]; \ + rt = NULL; \ + mrt6stat.mrt6s_mfc_lookups++; \ + while (_rt) { \ + if (IN6_ARE_ADDR_EQUAL(&_rt->mf6c_origin.sin6_addr, &(o)) && \ + IN6_ARE_ADDR_EQUAL(&_rt->mf6c_mcastgrp.sin6_addr, &(g)) && \ + (_rt->mf6c_stall == NULL)) { \ + rt = _rt; \ + break; \ + } \ + _rt = _rt->mf6c_next; \ + } \ + if (rt == NULL) { \ + mrt6stat.mrt6s_mfc_misses++; \ + } \ +} while (0) + +/* + * Macros to compute elapsed time efficiently + * Borrowed from Van Jacobson's scheduling code + */ +#define TV_DELTA(a, b, delta) do { \ + int xxs; \ + \ + delta = (a).tv_usec - (b).tv_usec; \ + if ((xxs = (a).tv_sec - (b).tv_sec)) { \ + switch (xxs) { \ + case 2: \ + delta += 1000000; \ + /* fall through */ \ + case 1: \ + delta += 1000000; \ + break; \ + default: \ + delta += (1000000 * xxs); \ + } \ + } \ +} while (0) + +#define TV_LT(a, b) (((a).tv_usec < (b).tv_usec && \ + (a).tv_sec <= (b).tv_sec) || (a).tv_sec < (b).tv_sec) + +#ifdef UPCALL_TIMING +#define UPCALL_MAX 50 +u_long upcall_data[UPCALL_MAX + 1]; +static void collate(); +#endif /* UPCALL_TIMING */ + +static int get_sg_cnt __P((struct sioc_sg_req6 *)); +static int get_mif6_cnt __P((struct sioc_mif_req6 *)); +static int ip6_mrouter_init __P((struct socket *, struct mbuf *, int)); +static int add_m6if __P((struct mif6ctl *)); +static int del_m6if __P((mifi_t *)); +static int add_m6fc __P((struct mf6cctl *)); +static int del_m6fc __P((struct mf6cctl *)); + +#ifdef __NetBSD__ +static struct callout expire_upcalls_ch = CALLOUT_INITIALIZER; +#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) +static struct callout expire_upcalls_ch; +#elif defined(__OpenBSD__) +static struct timeout expire_upcalls_ch; +#endif + +/* + * Handle MRT setsockopt commands to modify the multicast routing tables. + */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +int +ip6_mrouter_set(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + int error = 0; + struct mbuf *m; + + if (so != ip6_mrouter && sopt->sopt_name != MRT6_INIT) + return (EACCES); + + if ((error = soopt_getm(sopt, &m)) != 0) /* XXX */ + return (error); + if ((error = soopt_mcopyin(sopt, m)) != 0) /* XXX */ + return (error); + + switch (sopt->sopt_name) { + case MRT6_INIT: +#ifdef MRT6_OINIT + case MRT6_OINIT: +#endif + error = ip6_mrouter_init(so, m, sopt->sopt_name); + break; + case MRT6_DONE: + error = ip6_mrouter_done(); + break; + case MRT6_ADD_MIF: + error = add_m6if(mtod(m, struct mif6ctl *)); + break; + case MRT6_DEL_MIF: + error = del_m6if(mtod(m, mifi_t *)); + break; + case MRT6_ADD_MFC: + error = add_m6fc(mtod(m, struct mf6cctl *)); + break; + case MRT6_DEL_MFC: + error = del_m6fc(mtod(m, struct mf6cctl *)); + break; + case MRT6_PIM: + error = set_pim6(mtod(m, int *)); + break; + default: + error = EOPNOTSUPP; + break; + } + + (void)m_freem(m); + return(error); +} +#else +int +ip6_mrouter_set(cmd, so, m) + int cmd; + struct socket *so; + struct mbuf *m; +{ + if (cmd != MRT6_INIT && so != ip6_mrouter) + return EACCES; + + switch (cmd) { +#ifdef MRT6_OINIT + case MRT6_OINIT: return ip6_mrouter_init(so, m, cmd); +#endif + case MRT6_INIT: return ip6_mrouter_init(so, m, cmd); + case MRT6_DONE: return ip6_mrouter_done(); + case MRT6_ADD_MIF: return add_m6if(mtod(m, struct mif6ctl *)); + case MRT6_DEL_MIF: return del_m6if(mtod(m, mifi_t *)); + case MRT6_ADD_MFC: return add_m6fc(mtod(m, struct mf6cctl *)); + case MRT6_DEL_MFC: return del_m6fc(mtod(m, struct mf6cctl *)); + case MRT6_PIM: return set_pim6(mtod(m, int *)); + default: return EOPNOTSUPP; + } +} +#endif + +/* + * Handle MRT getsockopt commands + */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +int +ip6_mrouter_get(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + int error = 0; + + if (so != ip6_mrouter) return EACCES; + + switch (sopt->sopt_name) { + case MRT6_PIM: + error = sooptcopyout(sopt, &pim6, sizeof(pim6)); + break; + } + return (error); +} +#else +int +ip6_mrouter_get(cmd, so, m) + int cmd; + struct socket *so; + struct mbuf **m; +{ + struct mbuf *mb; + + if (so != ip6_mrouter) return EACCES; + + *m = mb = m_get(M_WAIT, MT_SOOPTS); + + switch (cmd) { + case MRT6_PIM: + return get_pim6(mb); + default: + m_free(mb); + return EOPNOTSUPP; + } +} +#endif + +/* + * Handle ioctl commands to obtain information from the cache + */ +int +mrt6_ioctl(cmd, data) + int cmd; + caddr_t data; +{ + int error = 0; + + switch (cmd) { + case SIOCGETSGCNT_IN6: + return(get_sg_cnt((struct sioc_sg_req6 *)data)); + break; /* for safety */ + case SIOCGETMIFCNT_IN6: + return(get_mif6_cnt((struct sioc_mif_req6 *)data)); + break; /* for safety */ + default: + return (EINVAL); + break; + } + return error; +} + +/* + * returns the packet, byte, rpf-failure count for the source group provided + */ +static int +get_sg_cnt(req) + struct sioc_sg_req6 *req; +{ + struct mf6c *rt; + int s; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + MF6CFIND(req->src.sin6_addr, req->grp.sin6_addr, rt); + splx(s); + if (rt != NULL) { + req->pktcnt = rt->mf6c_pkt_cnt; + req->bytecnt = rt->mf6c_byte_cnt; + req->wrong_if = rt->mf6c_wrong_if; + } else + return(ESRCH); +#if 0 + req->pktcnt = req->bytecnt = req->wrong_if = 0xffffffff; +#endif + + return 0; +} + +/* + * returns the input and output packet and byte counts on the mif provided + */ +static int +get_mif6_cnt(req) + struct sioc_mif_req6 *req; +{ + mifi_t mifi = req->mifi; + + if (mifi >= nummifs) + return EINVAL; + + req->icount = mif6table[mifi].m6_pkt_in; + req->ocount = mif6table[mifi].m6_pkt_out; + req->ibytes = mif6table[mifi].m6_bytes_in; + req->obytes = mif6table[mifi].m6_bytes_out; + + return 0; +} + +#if !(defined(__FreeBSD__) && __FreeBSD__ >=3) +/* + * Get PIM processiong global + */ +static int +get_pim6(m) + struct mbuf *m; +{ + int *i; + + i = mtod(m, int *); + + *i = pim6; + + return 0; +} +#endif + +static int +set_pim6(i) + int *i; +{ + if ((*i != 1) && (*i != 0)) + return EINVAL; + + pim6 = *i; + + return 0; +} + +/* + * Enable multicast routing + */ +static int +ip6_mrouter_init(so, m, cmd) + struct socket *so; + struct mbuf *m; + int cmd; +{ + int *v; + +#ifdef MRT6DEBUG + if (mrt6debug) + log(LOG_DEBUG, + "ip6_mrouter_init: so_type = %d, pr_protocol = %d\n", + so->so_type, so->so_proto->pr_protocol); +#endif + + if (so->so_type != SOCK_RAW || + so->so_proto->pr_protocol != IPPROTO_ICMPV6) + return EOPNOTSUPP; + + if (!m || (m->m_len != sizeof(int *))) + return ENOPROTOOPT; + + v = mtod(m, int *); + if (*v != 1) + return ENOPROTOOPT; + + if (ip6_mrouter != NULL) return EADDRINUSE; + + ip6_mrouter = so; + ip6_mrouter_ver = cmd; + + bzero((caddr_t)mf6ctable, sizeof(mf6ctable)); + bzero((caddr_t)n6expire, sizeof(n6expire)); + + pim6 = 0;/* used for stubbing out/in pim stuff */ + +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, + expire_upcalls, NULL); +#elif defined(__OpenBSD__) + timeout_set(&expire_upcalls_ch, expire_upcalls, NULL); + timeout_add(&expire_upcalls_ch, EXPIRE_TIMEOUT); +#else + timeout(expire_upcalls, (caddr_t)NULL, EXPIRE_TIMEOUT); +#endif + +#ifdef MRT6DEBUG + if (mrt6debug) + log(LOG_DEBUG, "ip6_mrouter_init\n"); +#endif + + return 0; +} + +/* + * Disable multicast routing + */ +int +ip6_mrouter_done() +{ + mifi_t mifi; + int i; + struct ifnet *ifp; + struct in6_ifreq ifr; + struct mf6c *rt; + struct rtdetq *rte; + int s; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + + /* + * For each phyint in use, disable promiscuous reception of all IPv6 + * multicasts. + */ +#ifdef INET +#ifdef MROUTING + /* + * If there is still IPv4 multicast routing daemon, + * we remain interfaces to receive all muliticasted packets. + * XXX: there may be an interface in which the IPv4 multicast + * daemon is not interested... + */ + if (!ip_mrouter) +#endif +#endif + { + for (mifi = 0; mifi < nummifs; mifi++) { + if (mif6table[mifi].m6_ifp && + !(mif6table[mifi].m6_flags & MIFF_REGISTER)) { + ifr.ifr_addr.sin6_family = AF_INET6; + ifr.ifr_addr.sin6_addr= in6addr_any; + ifp = mif6table[mifi].m6_ifp; + (*ifp->if_ioctl)(ifp, SIOCDELMULTI, + (caddr_t)&ifr); + } + } + } +#ifdef notyet + bzero((caddr_t)qtable, sizeof(qtable)); + bzero((caddr_t)tbftable, sizeof(tbftable)); +#endif + bzero((caddr_t)mif6table, sizeof(mif6table)); + nummifs = 0; + + pim6 = 0; /* used to stub out/in pim specific code */ + +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_stop(&expire_upcalls_ch); +#elif defined(__OpenBSD__) + timeout_del(&expire_upcalls_ch); +#else + untimeout(expire_upcalls, (caddr_t)NULL); +#endif + + /* + * Free all multicast forwarding cache entries. + */ + for (i = 0; i < MF6CTBLSIZ; i++) { + rt = mf6ctable[i]; + while (rt) { + struct mf6c *frt; + + for (rte = rt->mf6c_stall; rte != NULL; ) { + struct rtdetq *n = rte->next; + + m_free(rte->m); + free(rte, M_MRTABLE); + rte = n; + } + frt = rt; + rt = rt->mf6c_next; + free(frt, M_MRTABLE); + } + } + + bzero((caddr_t)mf6ctable, sizeof(mf6ctable)); + + /* + * Reset de-encapsulation cache + */ + reg_mif_num = -1; + + ip6_mrouter = NULL; + ip6_mrouter_ver = 0; + + splx(s); + +#ifdef MRT6DEBUG + if (mrt6debug) + log(LOG_DEBUG, "ip6_mrouter_done\n"); +#endif + + return 0; +} + +static struct sockaddr_in6 sin6 = { sizeof(sin6), AF_INET6 }; + +/* + * Add a mif to the mif table + */ +static int +add_m6if(mifcp) + struct mif6ctl *mifcp; +{ + struct mif6 *mifp; + struct ifnet *ifp; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + struct in6_ifreq ifr; +#endif + int error, s; +#ifdef notyet + struct tbf *m_tbf = tbftable + mifcp->mif6c_mifi; +#endif + + if (mifcp->mif6c_mifi >= MAXMIFS) + return EINVAL; + mifp = mif6table + mifcp->mif6c_mifi; + if (mifp->m6_ifp) + return EADDRINUSE; /* XXX: is it appropriate? */ + if (mifcp->mif6c_pifi == 0 || mifcp->mif6c_pifi > if_index) + return ENXIO; + /* + * XXX: some OSes can remove ifp and clear ifindex2ifnet[id] + * even for id between 0 and if_index. + */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + ifp = ifnet_byindex(mifcp->mif6c_pifi); +#else + ifp = ifindex2ifnet[mifcp->mif6c_pifi]; +#endif + if (ifp == NULL) + return ENXIO; + + if (mifcp->mif6c_flags & MIFF_REGISTER) { + if (reg_mif_num == (mifi_t)-1) { +#if defined(__NetBSD__) || defined(__OpenBSD__) + strcpy(multicast_register_if.if_xname, + "register_mif"); /* XXX */ +#else + multicast_register_if.if_name = "register_mif"; +#endif + multicast_register_if.if_flags |= IFF_LOOPBACK; + multicast_register_if.if_index = mifcp->mif6c_mifi; + reg_mif_num = mifcp->mif6c_mifi; + } + + ifp = &multicast_register_if; + + } /* if REGISTER */ + else { + /* Make sure the interface supports multicast */ + if ((ifp->if_flags & IFF_MULTICAST) == 0) + return EOPNOTSUPP; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) + error = if_allmulti(ifp, 1); +#else + /* + * Enable promiscuous reception of all IPv6 multicasts + * from the interface. + */ + ifr.ifr_addr.sin6_family = AF_INET6; + ifr.ifr_addr.sin6_addr = in6addr_any; + error = (*ifp->if_ioctl)(ifp, SIOCADDMULTI, (caddr_t)&ifr); +#endif + splx(s); + if (error) + return error; + } + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + mifp->m6_flags = mifcp->mif6c_flags; + mifp->m6_ifp = ifp; +#ifdef notyet + /* scaling up here allows division by 1024 in critical code */ + mifp->m6_rate_limit = mifcp->mif6c_rate_limit * 1024 / 1000; +#endif + /* initialize per mif pkt counters */ + mifp->m6_pkt_in = 0; + mifp->m6_pkt_out = 0; + mifp->m6_bytes_in = 0; + mifp->m6_bytes_out = 0; + splx(s); + + /* Adjust nummifs up if the mifi is higher than nummifs */ + if (nummifs <= mifcp->mif6c_mifi) + nummifs = mifcp->mif6c_mifi + 1; + +#ifdef MRT6DEBUG + if (mrt6debug) + log(LOG_DEBUG, + "add_mif #%d, phyint %s%d\n", + mifcp->mif6c_mifi, + ifp->if_name, ifp->if_unit); +#endif + + return 0; +} + +/* + * Delete a mif from the mif table + */ +static int +del_m6if(mifip) + mifi_t *mifip; +{ + struct mif6 *mifp = mif6table + *mifip; + mifi_t mifi; + struct ifnet *ifp; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + struct in6_ifreq ifr; +#endif + int s; + + if (*mifip >= nummifs) + return EINVAL; + if (mifp->m6_ifp == NULL) + return EINVAL; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + + if (!(mifp->m6_flags & MIFF_REGISTER)) { + /* + * XXX: what if there is yet IPv4 multicast daemon + * using the interface? + */ + ifp = mifp->m6_ifp; + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) + if_allmulti(ifp, 0); +#else + ifr.ifr_addr.sin6_family = AF_INET6; + ifr.ifr_addr.sin6_addr = in6addr_any; + (*ifp->if_ioctl)(ifp, SIOCDELMULTI, (caddr_t)&ifr); +#endif + } + +#ifdef notyet + bzero((caddr_t)qtable[*mifip], sizeof(qtable[*mifip])); + bzero((caddr_t)mifp->m6_tbf, sizeof(*(mifp->m6_tbf))); +#endif + bzero((caddr_t)mifp, sizeof (*mifp)); + + /* Adjust nummifs down */ + for (mifi = nummifs; mifi > 0; mifi--) + if (mif6table[mifi - 1].m6_ifp) + break; + nummifs = mifi; + + splx(s); + +#ifdef MRT6DEBUG + if (mrt6debug) + log(LOG_DEBUG, "del_m6if %d, nummifs %d\n", *mifip, nummifs); +#endif + + return 0; +} + +/* + * Add an mfc entry + */ +static int +add_m6fc(mfccp) + struct mf6cctl *mfccp; +{ + struct mf6c *rt; + u_long hash; + struct rtdetq *rte; + u_short nstl; + int s; + + MF6CFIND(mfccp->mf6cc_origin.sin6_addr, + mfccp->mf6cc_mcastgrp.sin6_addr, rt); + + /* If an entry already exists, just update the fields */ + if (rt) { +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_MFC) + log(LOG_DEBUG,"add_m6fc update o %s g %s p %x\n", + ip6_sprintf(&mfccp->mf6cc_origin.sin6_addr), + ip6_sprintf(&mfccp->mf6cc_mcastgrp.sin6_addr), + mfccp->mf6cc_parent); +#endif + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + rt->mf6c_parent = mfccp->mf6cc_parent; + rt->mf6c_ifset = mfccp->mf6cc_ifset; + splx(s); + return 0; + } + + /* + * Find the entry for which the upcall was made and update + */ +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + hash = MF6CHASH(mfccp->mf6cc_origin.sin6_addr, + mfccp->mf6cc_mcastgrp.sin6_addr); + for (rt = mf6ctable[hash], nstl = 0; rt; rt = rt->mf6c_next) { + if (IN6_ARE_ADDR_EQUAL(&rt->mf6c_origin.sin6_addr, + &mfccp->mf6cc_origin.sin6_addr) && + IN6_ARE_ADDR_EQUAL(&rt->mf6c_mcastgrp.sin6_addr, + &mfccp->mf6cc_mcastgrp.sin6_addr) && + (rt->mf6c_stall != NULL)) { + + if (nstl++) + log(LOG_ERR, + "add_m6fc: %s o %s g %s p %x dbx %p\n", + "multiple kernel entries", + ip6_sprintf(&mfccp->mf6cc_origin.sin6_addr), + ip6_sprintf(&mfccp->mf6cc_mcastgrp.sin6_addr), + mfccp->mf6cc_parent, rt->mf6c_stall); + +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_MFC) + log(LOG_DEBUG, + "add_m6fc o %s g %s p %x dbg %x\n", + ip6_sprintf(&mfccp->mf6cc_origin.sin6_addr), + ip6_sprintf(&mfccp->mf6cc_mcastgrp.sin6_addr), + mfccp->mf6cc_parent, rt->mf6c_stall); +#endif + + rt->mf6c_origin = mfccp->mf6cc_origin; + rt->mf6c_mcastgrp = mfccp->mf6cc_mcastgrp; + rt->mf6c_parent = mfccp->mf6cc_parent; + rt->mf6c_ifset = mfccp->mf6cc_ifset; + /* initialize pkt counters per src-grp */ + rt->mf6c_pkt_cnt = 0; + rt->mf6c_byte_cnt = 0; + rt->mf6c_wrong_if = 0; + + rt->mf6c_expire = 0; /* Don't clean this guy up */ + n6expire[hash]--; + + /* free packets Qed at the end of this entry */ + for (rte = rt->mf6c_stall; rte != NULL; ) { + struct rtdetq *n = rte->next; + ip6_mdq(rte->m, rte->ifp, rt); + m_freem(rte->m); +#ifdef UPCALL_TIMING + collate(&(rte->t)); +#endif /* UPCALL_TIMING */ + free(rte, M_MRTABLE); + rte = n; + } + rt->mf6c_stall = NULL; + } + } + + /* + * It is possible that an entry is being inserted without an upcall + */ + if (nstl == 0) { +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_MFC) + log(LOG_DEBUG, + "add_m6fc no upcall h %d o %s g %s p %x\n", + hash, + ip6_sprintf(&mfccp->mf6cc_origin.sin6_addr), + ip6_sprintf(&mfccp->mf6cc_mcastgrp.sin6_addr), + mfccp->mf6cc_parent); +#endif + + for (rt = mf6ctable[hash]; rt; rt = rt->mf6c_next) { + + if (IN6_ARE_ADDR_EQUAL(&rt->mf6c_origin.sin6_addr, + &mfccp->mf6cc_origin.sin6_addr)&& + IN6_ARE_ADDR_EQUAL(&rt->mf6c_mcastgrp.sin6_addr, + &mfccp->mf6cc_mcastgrp.sin6_addr)) { + + rt->mf6c_origin = mfccp->mf6cc_origin; + rt->mf6c_mcastgrp = mfccp->mf6cc_mcastgrp; + rt->mf6c_parent = mfccp->mf6cc_parent; + rt->mf6c_ifset = mfccp->mf6cc_ifset; + /* initialize pkt counters per src-grp */ + rt->mf6c_pkt_cnt = 0; + rt->mf6c_byte_cnt = 0; + rt->mf6c_wrong_if = 0; + + if (rt->mf6c_expire) + n6expire[hash]--; + rt->mf6c_expire = 0; + } + } + if (rt == NULL) { + /* no upcall, so make a new entry */ + rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE, + M_NOWAIT); + if (rt == NULL) { + splx(s); + return ENOBUFS; + } + + /* insert new entry at head of hash chain */ + rt->mf6c_origin = mfccp->mf6cc_origin; + rt->mf6c_mcastgrp = mfccp->mf6cc_mcastgrp; + rt->mf6c_parent = mfccp->mf6cc_parent; + rt->mf6c_ifset = mfccp->mf6cc_ifset; + /* initialize pkt counters per src-grp */ + rt->mf6c_pkt_cnt = 0; + rt->mf6c_byte_cnt = 0; + rt->mf6c_wrong_if = 0; + rt->mf6c_expire = 0; + rt->mf6c_stall = NULL; + + /* link into table */ + rt->mf6c_next = mf6ctable[hash]; + mf6ctable[hash] = rt; + } + } + splx(s); + return 0; +} + +#ifdef UPCALL_TIMING +/* + * collect delay statistics on the upcalls + */ +static void +collate(t) + struct timeval *t; +{ + u_long d; + struct timeval tp; + u_long delta; + + GET_TIME(tp); + + if (TV_LT(*t, tp)) + { + TV_DELTA(tp, *t, delta); + + d = delta >> 10; + if (d > UPCALL_MAX) + d = UPCALL_MAX; + + ++upcall_data[d]; + } +} +#endif /* UPCALL_TIMING */ + +/* + * Delete an mfc entry + */ +static int +del_m6fc(mfccp) + struct mf6cctl *mfccp; +{ + struct sockaddr_in6 origin; + struct sockaddr_in6 mcastgrp; + struct mf6c *rt; + struct mf6c **nptr; + u_long hash; + int s; + + origin = mfccp->mf6cc_origin; + mcastgrp = mfccp->mf6cc_mcastgrp; + hash = MF6CHASH(origin.sin6_addr, mcastgrp.sin6_addr); + +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_MFC) + log(LOG_DEBUG,"del_m6fc orig %s mcastgrp %s\n", + ip6_sprintf(&origin.sin6_addr), + ip6_sprintf(&mcastgrp.sin6_addr)); +#endif + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + + nptr = &mf6ctable[hash]; + while ((rt = *nptr) != NULL) { + if (IN6_ARE_ADDR_EQUAL(&origin.sin6_addr, + &rt->mf6c_origin.sin6_addr) && + IN6_ARE_ADDR_EQUAL(&mcastgrp.sin6_addr, + &rt->mf6c_mcastgrp.sin6_addr) && + rt->mf6c_stall == NULL) + break; + + nptr = &rt->mf6c_next; + } + if (rt == NULL) { + splx(s); + return EADDRNOTAVAIL; + } + + *nptr = rt->mf6c_next; + free(rt, M_MRTABLE); + + splx(s); + + return 0; +} + +static int +socket_send(s, mm, src) + struct socket *s; + struct mbuf *mm; + struct sockaddr_in6 *src; +{ + if (s) { + if (sbappendaddr(&s->so_rcv, + (struct sockaddr *)src, + mm, (struct mbuf *)0) != 0) { + sorwakeup(s); + return 0; + } + } + m_freem(mm); + return -1; +} + +/* + * IPv6 multicast forwarding function. This function assumes that the packet + * pointed to by "ip6" has arrived on (or is about to be sent to) the interface + * pointed to by "ifp", and the packet is to be relayed to other networks + * that have members of the packet's destination IPv6 multicast group. + * + * The packet is returned unscathed to the caller, unless it is + * erroneous, in which case a non-zero return value tells the caller to + * discard it. + */ + +int +ip6_mforward(ip6, ifp, m) + struct ip6_hdr *ip6; + struct ifnet *ifp; + struct mbuf *m; +{ + struct mf6c *rt; + struct mif6 *mifp; + struct mbuf *mm; + int s; + mifi_t mifi; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_FORWARD) + log(LOG_DEBUG, "ip6_mforward: src %s, dst %s, ifindex %d\n", + ip6_sprintf(&ip6->ip6_src), ip6_sprintf(&ip6->ip6_dst), + ifp->if_index); +#endif + + /* + * Don't forward a packet with Hop limit of zero or one, + * or a packet destined to a local-only group. + */ + if (ip6->ip6_hlim <= 1 || IN6_IS_ADDR_MC_INTFACELOCAL(&ip6->ip6_dst) || + IN6_IS_ADDR_MC_LINKLOCAL(&ip6->ip6_dst)) + return 0; + ip6->ip6_hlim--; + + /* + * Source address check: do not forward packets with unspecified + * source. It was discussed in July 2000, on ipngwg mailing list. + * This is rather more serious than unicast cases, because some + * MLD packets can be sent with the unspecified source address + * (although such packets must normally set 1 to the hop limit field). + */ + if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { + ip6stat.ip6s_cantforward++; + if (ip6_log_time + ip6_log_interval < time_second) { + ip6_log_time = time_second; + log(LOG_DEBUG, + "cannot forward " + "from %s to %s nxt %d received on %s\n", + ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), + ip6->ip6_nxt, + m->m_pkthdr.rcvif ? + if_name(m->m_pkthdr.rcvif) : "?"); + } + return 0; + } + + /* + * Determine forwarding mifs from the forwarding cache table + */ +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + MF6CFIND(ip6->ip6_src, ip6->ip6_dst, rt); + + /* Entry exists, so forward if necessary */ + if (rt) { + splx(s); + return (ip6_mdq(m, ifp, rt)); + } else { + /* + * If we don't have a route for packet's origin, + * Make a copy of the packet & + * send message to routing daemon + */ + + struct mbuf *mb0; + struct rtdetq *rte; + u_long hash; +/* int i, npkts;*/ +#ifdef UPCALL_TIMING + struct timeval tp; + + GET_TIME(tp); +#endif /* UPCALL_TIMING */ + + mrt6stat.mrt6s_no_route++; +#ifdef MRT6DEBUG + if (mrt6debug & (DEBUG_FORWARD | DEBUG_MFC)) + log(LOG_DEBUG, "ip6_mforward: no rte s %s g %s\n", + ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst)); +#endif + + /* + * Allocate mbufs early so that we don't do extra work if we + * are just going to fail anyway. + */ + rte = (struct rtdetq *)malloc(sizeof(*rte), M_MRTABLE, + M_NOWAIT); + if (rte == NULL) { + splx(s); + return ENOBUFS; + } + mb0 = m_copy(m, 0, M_COPYALL); + /* + * Pullup packet header if needed before storing it, + * as other references may modify it in the meantime. + */ + if (mb0 && + (M_HASCL(mb0) || mb0->m_len < sizeof(struct ip6_hdr))) + mb0 = m_pullup(mb0, sizeof(struct ip6_hdr)); + if (mb0 == NULL) { + free(rte, M_MRTABLE); + splx(s); + return ENOBUFS; + } + + /* is there an upcall waiting for this packet? */ + hash = MF6CHASH(ip6->ip6_src, ip6->ip6_dst); + for (rt = mf6ctable[hash]; rt; rt = rt->mf6c_next) { + if (IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, + &rt->mf6c_origin.sin6_addr) && + IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, + &rt->mf6c_mcastgrp.sin6_addr) && + (rt->mf6c_stall != NULL)) + break; + } + + if (rt == NULL) { + struct mrt6msg *im; +#ifdef MRT6_OINIT + struct omrt6msg *oim; +#endif + + /* no upcall, so make a new entry */ + rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE, + M_NOWAIT); + if (rt == NULL) { + free(rte, M_MRTABLE); + m_freem(mb0); + splx(s); + return ENOBUFS; + } + /* + * Make a copy of the header to send to the user + * level process + */ + mm = m_copy(mb0, 0, sizeof(struct ip6_hdr)); + + if (mm == NULL) { + free(rte, M_MRTABLE); + m_freem(mb0); + free(rt, M_MRTABLE); + splx(s); + return ENOBUFS; + } + + /* + * Send message to routing daemon + */ + sin6.sin6_addr = ip6->ip6_src; + + im = NULL; +#ifdef MRT6_OINIT + oim = NULL; +#endif + switch (ip6_mrouter_ver) { +#ifdef MRT6_OINIT + case MRT6_OINIT: + oim = mtod(mm, struct omrt6msg *); + oim->im6_msgtype = MRT6MSG_NOCACHE; + oim->im6_mbz = 0; + break; +#endif + case MRT6_INIT: + im = mtod(mm, struct mrt6msg *); + im->im6_msgtype = MRT6MSG_NOCACHE; + im->im6_mbz = 0; + break; + default: + free(rte, M_MRTABLE); + m_freem(mb0); + free(rt, M_MRTABLE); + splx(s); + return EINVAL; + } + +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_FORWARD) + log(LOG_DEBUG, + "getting the iif info in the kernel\n"); +#endif + + for (mifp = mif6table, mifi = 0; + mifi < nummifs && mifp->m6_ifp != ifp; + mifp++, mifi++) + ; + + switch (ip6_mrouter_ver) { +#ifdef MRT6_OINIT + case MRT6_OINIT: + oim->im6_mif = mifi; + break; +#endif + case MRT6_INIT: + im->im6_mif = mifi; + break; + } + + if (socket_send(ip6_mrouter, mm, &sin6) < 0) { + log(LOG_WARNING, "ip6_mforward: ip6_mrouter " + "socket queue full\n"); + mrt6stat.mrt6s_upq_sockfull++; + free(rte, M_MRTABLE); + m_freem(mb0); + free(rt, M_MRTABLE); + splx(s); + return ENOBUFS; + } + + mrt6stat.mrt6s_upcalls++; + + /* insert new entry at head of hash chain */ + bzero(rt, sizeof(*rt)); + rt->mf6c_origin.sin6_family = AF_INET6; + rt->mf6c_origin.sin6_len = sizeof(struct sockaddr_in6); + rt->mf6c_origin.sin6_addr = ip6->ip6_src; + rt->mf6c_mcastgrp.sin6_family = AF_INET6; + rt->mf6c_mcastgrp.sin6_len = sizeof(struct sockaddr_in6); + rt->mf6c_mcastgrp.sin6_addr = ip6->ip6_dst; + rt->mf6c_expire = UPCALL_EXPIRE; + n6expire[hash]++; + rt->mf6c_parent = MF6C_INCOMPLETE_PARENT; + + /* link into table */ + rt->mf6c_next = mf6ctable[hash]; + mf6ctable[hash] = rt; + /* Add this entry to the end of the queue */ + rt->mf6c_stall = rte; + } else { + /* determine if q has overflowed */ + struct rtdetq **p; + int npkts = 0; + + for (p = &rt->mf6c_stall; *p != NULL; p = &(*p)->next) + if (++npkts > MAX_UPQ6) { + mrt6stat.mrt6s_upq_ovflw++; + free(rte, M_MRTABLE); + m_freem(mb0); + splx(s); + return 0; + } + + /* Add this entry to the end of the queue */ + *p = rte; + } + + rte->next = NULL; + rte->m = mb0; + rte->ifp = ifp; +#ifdef UPCALL_TIMING + rte->t = tp; +#endif /* UPCALL_TIMING */ + + splx(s); + + return 0; + } +} + +/* + * Clean up cache entries if upcalls are not serviced + * Call from the Slow Timeout mechanism, every half second. + */ +static void +expire_upcalls(unused) + void *unused; +{ + struct rtdetq *rte; + struct mf6c *mfc, **nptr; + int i; + int s; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + for (i = 0; i < MF6CTBLSIZ; i++) { + if (n6expire[i] == 0) + continue; + nptr = &mf6ctable[i]; + while ((mfc = *nptr) != NULL) { + rte = mfc->mf6c_stall; + /* + * Skip real cache entries + * Make sure it wasn't marked to not expire (shouldn't happen) + * If it expires now + */ + if (rte != NULL && + mfc->mf6c_expire != 0 && + --mfc->mf6c_expire == 0) { +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_EXPIRE) + log(LOG_DEBUG, "expire_upcalls: expiring (%s %s)\n", + ip6_sprintf(&mfc->mf6c_origin.sin6_addr), + ip6_sprintf(&mfc->mf6c_mcastgrp.sin6_addr)); +#endif + /* + * drop all the packets + * free the mbuf with the pkt, if, timing info + */ + do { + struct rtdetq *n = rte->next; + m_freem(rte->m); + free(rte, M_MRTABLE); + rte = n; + } while (rte != NULL); + mrt6stat.mrt6s_cache_cleanups++; + n6expire[i]--; + + *nptr = mfc->mf6c_next; + free(mfc, M_MRTABLE); + } else { + nptr = &mfc->mf6c_next; + } + } + } + splx(s); +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, + expire_upcalls, NULL); +#elif defined(__OpenBSD__) + timeout_set(&expire_upcalls_ch, expire_upcalls, NULL); + timeout_add(&expire_upcalls_ch, EXPIRE_TIMEOUT); +#else + timeout(expire_upcalls, (caddr_t)NULL, EXPIRE_TIMEOUT); +#endif +} + +/* + * Packet forwarding routine once entry in the cache is made + */ +static int +ip6_mdq(m, ifp, rt) + struct mbuf *m; + struct ifnet *ifp; + struct mf6c *rt; +{ + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + mifi_t mifi, iif; + struct mif6 *mifp; + int plen = m->m_pkthdr.len; + +/* + * Macro to send packet on mif. Since RSVP packets don't get counted on + * input, they shouldn't get counted on output, so statistics keeping is + * seperate. + */ + +#define MC6_SEND(ip6, mifp, m) do { \ + if ((mifp)->m6_flags & MIFF_REGISTER) \ + register_send((ip6), (mifp), (m)); \ + else \ + phyint_send((ip6), (mifp), (m)); \ +} while (0) + + /* + * Don't forward if it didn't arrive from the parent mif + * for its origin. + */ + mifi = rt->mf6c_parent; + if ((mifi >= nummifs) || (mif6table[mifi].m6_ifp != ifp)) { + /* came in the wrong interface */ +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_FORWARD) + log(LOG_DEBUG, + "wrong if: ifid %d mifi %d mififid %x\n", + ifp->if_index, mifi, + mif6table[mifi].m6_ifp->if_index); +#endif + mrt6stat.mrt6s_wrong_if++; + rt->mf6c_wrong_if++; + /* + * If we are doing PIM processing, and we are forwarding + * packets on this interface, send a message to the + * routing daemon. + */ + /* have to make sure this is a valid mif */ + if (mifi < nummifs && mif6table[mifi].m6_ifp) + if (pim6 && (m->m_flags & M_LOOP) == 0) { + /* + * Check the M_LOOP flag to avoid an + * unnecessary PIM assert. + * XXX: M_LOOP is an ad-hoc hack... + */ + static struct sockaddr_in6 sin6 = + { sizeof(sin6), AF_INET6 }; + + struct mbuf *mm; + struct mrt6msg *im; +#ifdef MRT6_OINIT + struct omrt6msg *oim; +#endif + + mm = m_copy(m, 0, sizeof(struct ip6_hdr)); + if (mm && + (M_HASCL(mm) || + mm->m_len < sizeof(struct ip6_hdr))) + mm = m_pullup(mm, sizeof(struct ip6_hdr)); + if (mm == NULL) + return ENOBUFS; + +#ifdef MRT6_OINIT + oim = NULL; +#endif + im = NULL; + switch (ip6_mrouter_ver) { +#ifdef MRT6_OINIT + case MRT6_OINIT: + oim = mtod(mm, struct omrt6msg *); + oim->im6_msgtype = MRT6MSG_WRONGMIF; + oim->im6_mbz = 0; + break; +#endif + case MRT6_INIT: + im = mtod(mm, struct mrt6msg *); + im->im6_msgtype = MRT6MSG_WRONGMIF; + im->im6_mbz = 0; + break; + default: + m_freem(mm); + return EINVAL; + } + + for (mifp = mif6table, iif = 0; + iif < nummifs && mifp && + mifp->m6_ifp != ifp; + mifp++, iif++) + ; + + switch (ip6_mrouter_ver) { +#ifdef MRT6_OINIT + case MRT6_OINIT: + oim->im6_mif = iif; + sin6.sin6_addr = oim->im6_src; + break; +#endif + case MRT6_INIT: + im->im6_mif = iif; + sin6.sin6_addr = im->im6_src; + break; + } + + mrt6stat.mrt6s_upcalls++; + + if (socket_send(ip6_mrouter, mm, &sin6) < 0) { +#ifdef MRT6DEBUG + if (mrt6debug) + log(LOG_WARNING, "mdq, ip6_mrouter socket queue full\n"); +#endif + ++mrt6stat.mrt6s_upq_sockfull; + return ENOBUFS; + } /* if socket Q full */ + } /* if PIM */ + return 0; + } /* if wrong iif */ + + /* If I sourced this packet, it counts as output, else it was input. */ + if (m->m_pkthdr.rcvif == NULL) { + /* XXX: is rcvif really NULL when output?? */ + mif6table[mifi].m6_pkt_out++; + mif6table[mifi].m6_bytes_out += plen; + } else { + mif6table[mifi].m6_pkt_in++; + mif6table[mifi].m6_bytes_in += plen; + } + rt->mf6c_pkt_cnt++; + rt->mf6c_byte_cnt += plen; + + /* + * For each mif, forward a copy of the packet if there are group + * members downstream on the interface. + */ + for (mifp = mif6table, mifi = 0; mifi < nummifs; mifp++, mifi++) + if (IF_ISSET(mifi, &rt->mf6c_ifset)) { + int64_t dscopein, sscopein, dscopeout, sscopeout; + + /* + * check if the outgoing packet is going to break + * a scope boundary. + * XXX For packets through PIM register tunnel + * interface, we believe a routing daemon. + */ + if ((mif6table[rt->mf6c_parent].m6_flags & + MIFF_REGISTER) == 0 && + (mif6table[mifi].m6_flags & MIFF_REGISTER) == 0) { + if ((dscopein = in6_addr2zoneid(ifp, &ip6->ip6_dst)) < 0 || + (dscopeout = in6_addr2zoneid(mif6table[mifi].m6_ifp, &ip6->ip6_dst)) < 0 || + (sscopein = in6_addr2zoneid(ifp, &ip6->ip6_src)) < 0 || + (sscopeout = in6_addr2zoneid(mif6table[mifi].m6_ifp, &ip6->ip6_src)) < 0 || + dscopein != dscopeout || + sscopein != sscopeout) { + ip6stat.ip6s_badscope++; + continue; + } + } + + mifp->m6_pkt_out++; + mifp->m6_bytes_out += plen; + MC6_SEND(ip6, mifp, m); + } + return 0; +} + +static void +phyint_send(ip6, mifp, m) + struct ip6_hdr *ip6; + struct mif6 *mifp; + struct mbuf *m; +{ + struct mbuf *mb_copy; + struct ifnet *ifp = mifp->m6_ifp; + int error = 0; +#ifdef __NetBSD__ + int s = splsoftnet(); /* needs to protect static "ro" below. */ +#else + int s = splnet(); /* needs to protect static "ro" below. */ +#endif +#ifdef NEW_STRUCT_ROUTE + static struct route ro; +#else + static struct route_in6 ro; +#endif + struct in6_multi *in6m; + struct sockaddr_in6 *dst6; + + /* + * Make a new reference to the packet; make sure that + * the IPv6 header is actually copied, not just referenced, + * so that ip6_output() only scribbles on the copy. + */ + mb_copy = m_copy(m, 0, M_COPYALL); + if (mb_copy && + (M_HASCL(mb_copy) || mb_copy->m_len < sizeof(struct ip6_hdr))) + mb_copy = m_pullup(mb_copy, sizeof(struct ip6_hdr)); + if (mb_copy == NULL) { + splx(s); + return; + } + /* set MCAST flag to the outgoing packet */ + mb_copy->m_flags |= M_MCAST; + + /* + * If we sourced the packet, call ip6_output since we may devide + * the packet into fragments when the packet is too big for the + * outgoing interface. + * Otherwise, we can simply send the packet to the interface + * sending queue. + */ + if (m->m_pkthdr.rcvif == NULL) { + struct ip6_moptions im6o; + + im6o.im6o_multicast_ifp = ifp; + /* XXX: ip6_output will override ip6->ip6_hlim */ + im6o.im6o_multicast_hlim = ip6->ip6_hlim; + im6o.im6o_multicast_loop = 1; + error = ip6_output(mb_copy, NULL, &ro, + IPV6_FORWARDING, &im6o, NULL); + +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_XMIT) + log(LOG_DEBUG, "phyint_send on mif %d err %d\n", + mifp - mif6table, error); +#endif + splx(s); + return; + } + + /* + * If we belong to the destination multicast group + * on the outgoing interface, loop back a copy. + */ + dst6 = (struct sockaddr_in6 *)&ro.ro_dst; + IN6_LOOKUP_MULTI(ip6->ip6_dst, ifp, in6m); + if (in6m != NULL) { + dst6->sin6_len = sizeof(struct sockaddr_in6); + dst6->sin6_family = AF_INET6; + dst6->sin6_addr = ip6->ip6_dst; + ip6_mloopback(ifp, m, (struct sockaddr_in6 *)&ro.ro_dst); + } + /* + * Put the packet into the sending queue of the outgoing interface + * if it would fit in the MTU of the interface. + */ + if (mb_copy->m_pkthdr.len < ifp->if_mtu || ifp->if_mtu < IPV6_MMTU) { + dst6->sin6_len = sizeof(struct sockaddr_in6); + dst6->sin6_family = AF_INET6; + dst6->sin6_addr = ip6->ip6_dst; + /* + * We just call if_output instead of nd6_output here, since + * we need no ND for a multicast forwarded packet...right? + */ + error = (*ifp->if_output)(ifp, mb_copy, + (struct sockaddr *)&ro.ro_dst, NULL); +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_XMIT) + log(LOG_DEBUG, "phyint_send on mif %d err %d\n", + mifp - mif6table, error); +#endif + } else { +#ifdef MULTICAST_PMTUD + icmp6_error(mb_copy, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu); +#else +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_XMIT) + log(LOG_DEBUG, + "phyint_send: packet too big on %s o %s g %s" + " size %d(discarded)\n", + if_name(ifp), + ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), + mb_copy->m_pkthdr.len); +#endif /* MRT6DEBUG */ + m_freem(mb_copy); /* simply discard the packet */ +#endif + } + + splx(s); +} + +static int +register_send(ip6, mif, m) + struct ip6_hdr *ip6; + struct mif6 *mif; + struct mbuf *m; +{ + struct mbuf *mm; + int i, len = m->m_pkthdr.len; + static struct sockaddr_in6 sin6 = { sizeof(sin6), AF_INET6 }; + struct mrt6msg *im6; + +#ifdef MRT6DEBUG + if (mrt6debug) + log(LOG_DEBUG, "** IPv6 register_send **\n src %s dst %s\n", + ip6_sprintf(&ip6->ip6_src), ip6_sprintf(&ip6->ip6_dst)); +#endif + ++pim6stat.pim6s_snd_registers; + + /* Make a copy of the packet to send to the user level process */ + MGETHDR(mm, M_DONTWAIT, MT_HEADER); + if (mm == NULL) + return ENOBUFS; + mm->m_pkthdr.rcvif = NULL; + mm->m_data += max_linkhdr; + mm->m_len = sizeof(struct ip6_hdr); + + if ((mm->m_next = m_copy(m, 0, M_COPYALL)) == NULL) { + m_freem(mm); + return ENOBUFS; + } + i = MHLEN - M_LEADINGSPACE(mm); + if (i > len) + i = len; + mm = m_pullup(mm, i); + if (mm == NULL){ + m_freem(mm); + return ENOBUFS; + } +/* TODO: check it! */ + mm->m_pkthdr.len = len + sizeof(struct ip6_hdr); + + /* + * Send message to routing daemon + */ + sin6.sin6_addr = ip6->ip6_src; + + im6 = mtod(mm, struct mrt6msg *); + im6->im6_msgtype = MRT6MSG_WHOLEPKT; + im6->im6_mbz = 0; + + im6->im6_mif = mif - mif6table; + + /* iif info is not given for reg. encap.n */ + mrt6stat.mrt6s_upcalls++; + + if (socket_send(ip6_mrouter, mm, &sin6) < 0) { +#ifdef MRT6DEBUG + if (mrt6debug) + log(LOG_WARNING, + "register_send: ip6_mrouter socket queue full\n"); +#endif + ++mrt6stat.mrt6s_upq_sockfull; + return ENOBUFS; + } + return 0; +} + +/* + * PIM sparse mode hook + * Receives the pim control messages, and passes them up to the listening + * socket, using rip6_input. + * The only message processed is the REGISTER pim message; the pim header + * is stripped off, and the inner packet is passed to register_mforward. + */ +int +pim6_input(mp, offp, proto) + struct mbuf **mp; + int *offp, proto; +{ + struct pim *pim; /* pointer to a pim struct */ + struct ip6_hdr *ip6; + int pimlen; + struct mbuf *m = *mp; + int minlen; + int off = *offp; + + ++pim6stat.pim6s_rcv_total; + + ip6 = mtod(m, struct ip6_hdr *); + pimlen = m->m_pkthdr.len - *offp; + + /* + * Validate lengths + */ + if (pimlen < PIM_MINLEN) { + ++pim6stat.pim6s_rcv_tooshort; +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_PIM) + log(LOG_DEBUG,"pim6_input: PIM packet too short\n"); +#endif + m_freem(m); + return(IPPROTO_DONE); + } + + /* + * if the packet is at least as big as a REGISTER, go ahead + * and grab the PIM REGISTER header size, to avoid another + * possible m_pullup() later. + * + * PIM_MINLEN == pimhdr + u_int32 == 8 + * PIM6_REG_MINLEN == pimhdr + reghdr + eip6hdr == 4 + 4 + 40 + */ + minlen = (pimlen >= PIM6_REG_MINLEN) ? PIM6_REG_MINLEN : PIM_MINLEN; + + /* + * Make sure that the IP6 and PIM headers in contiguous memory, and + * possibly the PIM REGISTER header + */ +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, minlen, IPPROTO_DONE); + /* adjust pointer */ + ip6 = mtod(m, struct ip6_hdr *); + + /* adjust mbuf to point to the PIM header */ + pim = (struct pim *)((caddr_t)ip6 + off); +#else + IP6_EXTHDR_GET(pim, struct pim *, m, off, minlen); + if (pim == NULL) { + pim6stat.pim6s_rcv_tooshort++; + return IPPROTO_DONE; + } +#endif + +#define PIM6_CHECKSUM +#ifdef PIM6_CHECKSUM + { + int cksumlen; + + /* + * Validate checksum. + * If PIM REGISTER, exclude the data packet + */ + if (pim->pim_type == PIM_REGISTER) + cksumlen = PIM_MINLEN; + else + cksumlen = pimlen; + + if (in6_cksum(m, IPPROTO_PIM, off, cksumlen)) { + ++pim6stat.pim6s_rcv_badsum; +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_PIM) + log(LOG_DEBUG, + "pim6_input: invalid checksum\n"); +#endif + m_freem(m); + return(IPPROTO_DONE); + } + } +#endif /* PIM_CHECKSUM */ + + /* PIM version check */ + if (pim->pim_ver != PIM_VERSION) { + ++pim6stat.pim6s_rcv_badversion; +#ifdef MRT6DEBUG + log(LOG_ERR, + "pim6_input: incorrect version %d, expecting %d\n", + pim->pim_ver, PIM_VERSION); +#endif + m_freem(m); + return(IPPROTO_DONE); + } + + if (pim->pim_type == PIM_REGISTER) { + /* + * since this is a REGISTER, we'll make a copy of the register + * headers ip6+pim+u_int32_t+encap_ip6, to be passed up to the + * routing daemon. + */ + static struct sockaddr_in6 dst = { sizeof(dst), AF_INET6 }; + + struct mbuf *mcp; + struct ip6_hdr *eip6; + u_int32_t *reghdr; + int rc; + + ++pim6stat.pim6s_rcv_registers; + + if ((reg_mif_num >= nummifs) || (reg_mif_num == (mifi_t) -1)) { +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_PIM) + log(LOG_DEBUG, + "pim6_input: register mif not set: %d\n", + reg_mif_num); +#endif + m_freem(m); + return(IPPROTO_DONE); + } + + reghdr = (u_int32_t *)(pim + 1); + + if ((ntohl(*reghdr) & PIM_NULL_REGISTER)) + goto pim6_input_to_daemon; + + /* + * Validate length + */ + if (pimlen < PIM6_REG_MINLEN) { + ++pim6stat.pim6s_rcv_tooshort; + ++pim6stat.pim6s_rcv_badregisters; +#ifdef MRT6DEBUG + log(LOG_ERR, + "pim6_input: register packet size too " + "small %d from %s\n", + pimlen, ip6_sprintf(&ip6->ip6_src)); +#endif + m_freem(m); + return(IPPROTO_DONE); + } + + eip6 = (struct ip6_hdr *) (reghdr + 1); +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_PIM) + log(LOG_DEBUG, + "pim6_input[register], eip6: %s -> %s, " + "eip6 plen %d\n", + ip6_sprintf(&eip6->ip6_src), + ip6_sprintf(&eip6->ip6_dst), + ntohs(eip6->ip6_plen)); +#endif + + /* verify the version number of the inner packet */ + if ((eip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { + ++pim6stat.pim6s_rcv_badregisters; +#ifdef MRT6DEBUG + log(LOG_DEBUG, "pim6_input: invalid IP version (%d) " + "of the inner packet\n", + (eip6->ip6_vfc & IPV6_VERSION)); +#endif + m_freem(m); + return(IPPROTO_NONE); + } + + /* verify the inner packet is destined to a mcast group */ + if (!IN6_IS_ADDR_MULTICAST(&eip6->ip6_dst)) { + ++pim6stat.pim6s_rcv_badregisters; +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_PIM) + log(LOG_DEBUG, + "pim6_input: inner packet of register " + "is not multicast %s\n", + ip6_sprintf(&eip6->ip6_dst)); +#endif + m_freem(m); + return(IPPROTO_DONE); + } + + /* + * make a copy of the whole header to pass to the daemon later. + */ + mcp = m_copy(m, 0, off + PIM6_REG_MINLEN); + if (mcp == NULL) { +#ifdef MRT6DEBUG + log(LOG_ERR, + "pim6_input: pim register: " + "could not copy register head\n"); +#endif + m_freem(m); + return(IPPROTO_DONE); + } + + /* + * forward the inner ip6 packet; point m_data at the inner ip6. + */ + m_adj(m, off + PIM_MINLEN); +#ifdef MRT6DEBUG + if (mrt6debug & DEBUG_PIM) { + log(LOG_DEBUG, + "pim6_input: forwarding decapsulated register: " + "src %s, dst %s, mif %d\n", + ip6_sprintf(&eip6->ip6_src), + ip6_sprintf(&eip6->ip6_dst), + reg_mif_num); + } +#endif + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +#if (__FreeBSD_version >= 410000) + rc = if_simloop(mif6table[reg_mif_num].m6_ifp, m, + dst.sin6_family, (int)NULL); +#else + rc = if_simloop(mif6table[reg_mif_num].m6_ifp, m, + (struct sockaddr *) &dst, NULL); + +#endif +#else + rc = looutput(mif6table[reg_mif_num].m6_ifp, m, + (struct sockaddr *) &dst, + (struct rtentry *) NULL); +#endif + + /* prepare the register head to send to the mrouting daemon */ + m = mcp; + } + + /* + * Pass the PIM message up to the daemon; if it is a register message + * pass the 'head' only up to the daemon. This includes the + * encapsulator ip6 header, pim header, register header and the + * encapsulated ip6 header. + */ + pim6_input_to_daemon: + rip6_input(&m, offp, proto); + return(IPPROTO_DONE); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_output.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_output.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/ip6_output.c @@ -0,0 +1,4234 @@ +//========================================================================== +// +// src/sys/netinet6/ip6_output.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: ip6_output.c,v 1.272 2001/12/26 01:03:28 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 1988, 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef IPSEC +#ifdef __OpenBSD__ +#include +#include +#include +#include +#include + +extern u_int8_t get_sa_require __P((struct inpcb *)); + +extern int ipsec_auth_default_level; +extern int ipsec_esp_trans_default_level; +extern int ipsec_esp_network_default_level; +extern int ipsec_ipcomp_default_level; +#else +#include +#include +#endif +#endif /* IPSEC */ + +#if defined(IPV6FIREWALL) || (defined(__FreeBSD__) && __FreeBSD__ >= 4) +#include +#endif + +#ifdef MIP6 +#include +#include +#endif /* MIP6 */ + +struct ip6_exthdrs { + struct mbuf *ip6e_ip6; + struct mbuf *ip6e_hbh; + struct mbuf *ip6e_dest1; + struct mbuf *ip6e_rthdr; + struct mbuf *ip6e_haddr; /* for MIP6 */ + struct mbuf *ip6e_dest2; +}; + +static int ip6_pcbopt __P((int, u_char *, int, struct ip6_pktopts **, int)); +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +static int ip6_pcbopts __P((struct ip6_pktopts **, struct mbuf *, + struct socket *, struct sockopt *)); +static int ip6_getpcbopt __P((struct ip6_pktopts *, int, struct sockopt *)); +#else +static int ip6_pcbopts __P((struct ip6_pktopts **, struct mbuf *, + struct socket *)); +static int ip6_getpcbopt __P((struct ip6_pktopts *, int, struct mbuf **)); +#endif +static int ip6_setpktoption __P((int, u_char *, int, struct ip6_pktopts *, int, + int, int)); +static int ip6_setmoptions __P((int, struct ip6_moptions **, struct mbuf *)); +static int ip6_getmoptions __P((int, struct ip6_moptions *, struct mbuf **)); +static int ip6_copyexthdr __P((struct mbuf **, caddr_t, int)); +static int ip6_insertfraghdr __P((struct mbuf *, struct mbuf *, int, + struct ip6_frag **)); +static int ip6_insert_jumboopt __P((struct ip6_exthdrs *, u_int32_t)); +static int ip6_splithdr __P((struct mbuf *, struct ip6_exthdrs *)); +#ifdef NEW_STRUCT_ROUTE +static int ip6_getpmtu __P((struct route *, struct route *, struct ifnet *, + struct in6_addr *, u_long *)); +#else +static int ip6_getpmtu __P((struct route *, struct route *, struct ifnet *, + struct in6_addr *, u_long *)); +#endif + +#ifdef __bsdi__ +#if _BSDI_VERSION < 199802 +extern struct ifnet loif; +#else +extern struct ifnet *loifp; +#endif +#endif +#if defined(__NetBSD__) +extern struct ifnet loif[NLOOP]; +#endif + + +/* + * IP6 output. The packet in mbuf chain m contains a skeletal IP6 + * header (with pri, len, nxt, hlim, src, dst). + * This function may modify ver and hlim only. + * The mbuf chain containing the packet will be freed. + * The mbuf opt, if present, will not be freed. + * + * type of "mtu": rt_rmx.rmx_mtu is u_long, ifnet.ifr_mtu is int, and + * nd_ifinfo.linkmtu is u_int32_t. so we use u_long to hold largest one, + * which is rt_rmx.rmx_mtu. + */ +int +ip6_output(m0, opt, ro, flags, im6o, ifpp) + struct mbuf *m0; + struct ip6_pktopts *opt; +#ifdef NEW_STRUCT_ROUTE + struct route *ro; +#else + struct route_in6 *ro; +#endif + int flags; + struct ip6_moptions *im6o; + struct ifnet **ifpp; /* XXX: just for statistics */ +{ + struct ip6_hdr *ip6, *mhip6; + struct ifnet *ifp, *origifp; + struct mbuf *m = m0; + int hlen, tlen, len, off; +#ifdef NEW_STRUCT_ROUTE + struct route ip6route; +#else + struct route_in6 ip6route; +#endif + struct rtentry *rt = NULL; + struct sockaddr_in6 *dst; + int error = 0; + struct in6_ifaddr *ia = NULL; + u_long mtu; + u_int32_t optlen = 0, plen = 0, unfragpartlen = 0; + struct ip6_exthdrs exthdrs; + struct in6_addr finaldst; +#ifdef NEW_STRUCT_ROUTE + struct route *ro_pmtu = NULL; +#else + struct route_in6 *ro_pmtu = NULL; +#endif + int hdrsplit = 0; +#ifdef __OpenBSD__ + u_int8_t sproto = 0; +#else + int needipsec = 0; +#endif +#if defined(__NetBSD__) && defined(PFIL_HOOKS) + struct packet_filter_hook *pfh; + struct mbuf *m1; + int rv; +#endif /* PFIL_HOOKS */ +#if defined(__bsdi__) && _BSDI_VERSION < 199802 + struct ifnet *loifp = &loif; +#endif +#ifdef MIP6 + struct mip6_pktopts mip6opt; +#ifdef NEW_STRUCT_ROUTE + struct route mip6_ip6route; +#else + struct route_in6 mip6_ip6route; +#endif +#endif /* MIP6 */ +#ifdef IPSEC +#ifdef __OpenBSD__ + struct m_tag *mtag; + union sockaddr_union sdst; + struct tdb_ident *tdbi; + u_int32_t sspi; + struct inpcb *inp; + struct tdb *tdb; + int s; + + inp = NULL; /* XXX */ + if (inp && (inp->inp_flags & INP_IPV6) == 0) + panic("ip6_output: IPv4 pcb is passed"); +#else + int needipsectun = 0; + struct socket *so; + struct secpolicy *sp = NULL; + + /* for AH processing. stupid to have "socket" variable in IP layer... */ + so = ipsec_getsocket(m); + (void)ipsec_setsocket(m, NULL); + ip6 = mtod(m, struct ip6_hdr *); +#endif +#endif /* IPSEC */ + +#define MAKE_EXTHDR(hp, mp) \ + do { \ + if (hp) { \ + struct ip6_ext *eh = (struct ip6_ext *)(hp); \ + error = ip6_copyexthdr((mp), (caddr_t)(hp), \ + ((eh)->ip6e_len + 1) << 3); \ + if (error) \ + goto freehdrs; \ + } \ + } while (0) + + bzero(&exthdrs, sizeof(exthdrs)); + + if (opt) { + /* Hop-by-Hop options header */ + MAKE_EXTHDR(opt->ip6po_hbh, &exthdrs.ip6e_hbh); + /* Destination options header(1st part) */ + if (opt->ip6po_rthdr) { + /* + * Destination options header(1st part) + * This only makes sence with a routing header. + * See Section 9.2 of + * draft-ietf-ipngwg-rfc2292bis-02.txt. + * Disabling this part just for MIP6 convenience is + * a bad idea. We need to think carefully about a + * way to make the advanced API coexist with MIP6 + * options, which might automatically be inserted in + * the kernel. + */ + MAKE_EXTHDR(opt->ip6po_dest1, &exthdrs.ip6e_dest1); + } + /* Routing header */ + MAKE_EXTHDR(opt->ip6po_rthdr, &exthdrs.ip6e_rthdr); + /* Destination options header(2nd part) */ + MAKE_EXTHDR(opt->ip6po_dest2, &exthdrs.ip6e_dest2); + } +#ifdef MIP6 + bzero((caddr_t)&mip6opt, sizeof(mip6opt)); + if ((flags & IPV6_FORWARDING) == 0) { + /* + * XXX: reconsider the following routine. + */ + /* + * MIP6 extention headers handling. + * insert HA, BU, BA, BR options if necessary. + */ + if (mip6_exthdr_create(m, opt, &mip6opt)) + goto freehdrs; + + if (((opt != NULL) && (opt->ip6po_rthdr != NULL)) + || (mip6opt.mip6po_rthdr != NULL)) { + m_freem(exthdrs.ip6e_rthdr); + if (mip6opt.mip6po_rthdr != NULL) { + /* + * there is no rthdr specified in the + * ip6_pktopts. but mip6 create a + * rthdr for the router optimization + * purpose. + */ + MAKE_EXTHDR(mip6opt.mip6po_rthdr, + &exthdrs.ip6e_rthdr); + } else { + /* + * there is a rthdr specified in the + * ip6_pktopts. if mip6 require the + * route optimization, the rthdr for + * that purpose is already included in + * the ip6po_rthdr in the + * mip6_destopt_create(). + */ + MAKE_EXTHDR(opt->ip6po_rthdr, + &exthdrs.ip6e_rthdr); + } + /* + * if a routing header exists dest1 must be + * inserted if it exists. + */ + if ((opt != NULL) && (opt->ip6po_dest1)) { + m_freem(exthdrs.ip6e_dest1); + MAKE_EXTHDR(opt->ip6po_dest1, + &exthdrs.ip6e_dest1); + } + } + MAKE_EXTHDR(mip6opt.mip6po_haddr, &exthdrs.ip6e_haddr); + if (mip6opt.mip6po_dest2) { + m_freem(exthdrs.ip6e_dest2); + MAKE_EXTHDR(mip6opt.mip6po_dest2, &exthdrs.ip6e_dest2); + } + } else { + /* + * this is the forwarding packet. do not modify any + * extension headers. + */ + } +#endif /* MIP6 */ + +#ifdef IPSEC +#ifdef __OpenBSD__ + /* + * splnet is chosen over spltdb because we are not allowed to + * lower the level, and udp6_output calls us in splnet(). XXX check + */ + s = splnet(); + + /* + * Check if there was an outgoing SA bound to the flow + * from a transport protocol. + */ + ip6 = mtod(m, struct ip6_hdr *); + + /* Do we have any pending SAs to apply ? */ + mtag = m_tag_find(m, PACKET_TAG_IPSEC_PENDING_TDB, NULL); + if (mtag != NULL) { +#ifdef DIAGNOSTIC + if (mtag->m_tag_len != sizeof (struct tdb_ident)) + panic("ip6_output: tag of length %d (should be %d", + mtag->m_tag_len, sizeof (struct tdb_ident)); +#endif + tdbi = (struct tdb_ident *)(mtag + 1); + tdb = gettdb(tdbi->spi, &tdbi->dst, tdbi->proto); + if (tdb == NULL) + error = -EINVAL; + m_tag_delete(m, mtag); + } + else + tdb = ipsp_spd_lookup(m, AF_INET6, sizeof(struct ip6_hdr), + &error, IPSP_DIRECTION_OUT, NULL, inp); + + if (tdb == NULL) { + splx(s); + + if (error == 0) { + /* + * No IPsec processing required, we'll just send the + * packet out. + */ + sproto = 0; + + /* Fall through to routing/multicast handling */ + } else { + /* + * -EINVAL is used to indicate that the packet should + * be silently dropped, typically because we've asked + * key management for an SA. + */ + if (error == -EINVAL) /* Should silently drop packet */ + error = 0; + + goto freehdrs; + } + } else { + /* Loop detection */ + for (mtag = m_tag_first(m); mtag != NULL; + mtag = m_tag_next(m, mtag)) { + if (mtag->m_tag_id != PACKET_TAG_IPSEC_OUT_DONE && + mtag->m_tag_id != + PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED) + continue; + tdbi = (struct tdb_ident *)(mtag + 1); + if (tdbi->spi == tdb->tdb_spi && + tdbi->proto == tdb->tdb_sproto && + !bcmp(&tdbi->dst, &tdb->tdb_dst, + sizeof(union sockaddr_union))) { + splx(s); + sproto = 0; /* mark as no-IPsec-needed */ + goto done_spd; + } + } + + /* We need to do IPsec */ + bcopy(&tdb->tdb_dst, &sdst, sizeof(sdst)); + sspi = tdb->tdb_spi; + sproto = tdb->tdb_sproto; + splx(s); + +#if 1 /* XXX */ + /* if we have any extension header, we cannot perform IPsec */ + if (exthdrs.ip6e_hbh || exthdrs.ip6e_dest1 || +#ifdef MIP6 + exthdrs.ip6e_haddr || +#endif /* MIP6 */ + exthdrs.ip6e_rthdr || exthdrs.ip6e_dest2) { + error = EHOSTUNREACH; + goto freehdrs; + } +#endif + } + + /* Fall through to the routing/multicast handling code */ + done_spd: +#else + /* get a security policy for this packet */ + if (so == NULL) + sp = ipsec6_getpolicybyaddr(m, IPSEC_DIR_OUTBOUND, 0, &error); + else + sp = ipsec6_getpolicybysock(m, IPSEC_DIR_OUTBOUND, so, &error); + + if (sp == NULL) { + ipsec6stat.out_inval++; + goto freehdrs; + } + + error = 0; + + /* check policy */ + switch (sp->policy) { + case IPSEC_POLICY_DISCARD: + /* + * This packet is just discarded. + */ + ipsec6stat.out_polvio++; + goto freehdrs; + + case IPSEC_POLICY_BYPASS: + case IPSEC_POLICY_NONE: + /* no need to do IPsec. */ + needipsec = 0; + break; + + case IPSEC_POLICY_IPSEC: + if (sp->req == NULL) { + /* acquire a policy */ + error = key_spdacquire(sp); + goto freehdrs; + } + needipsec = 1; + break; + + case IPSEC_POLICY_ENTRUST: + default: + printf("ip6_output: Invalid policy found. %d\n", sp->policy); + } +#endif /* OpenBSD */ +#endif /* IPSEC */ + + /* + * Calculate the total length of the extension header chain. + * Keep the length of the unfragmentable part for fragmentation. + */ + optlen = 0; + if (exthdrs.ip6e_hbh) optlen += exthdrs.ip6e_hbh->m_len; + if (exthdrs.ip6e_dest1) optlen += exthdrs.ip6e_dest1->m_len; + if (exthdrs.ip6e_rthdr) optlen += exthdrs.ip6e_rthdr->m_len; +#ifdef MIP6 + if (exthdrs.ip6e_haddr) optlen += exthdrs.ip6e_haddr->m_len; +#endif /* MIP6 */ + unfragpartlen = optlen + sizeof(struct ip6_hdr); + /* NOTE: we don't add AH/ESP length here. do that later. */ + if (exthdrs.ip6e_dest2) optlen += exthdrs.ip6e_dest2->m_len; + + /* + * If we need IPsec, or there is at least one extension header, + * separate IP6 header from the payload. + */ +#ifdef __OpenBSD__ + if ((sproto || optlen) && !hdrsplit) +#else + if ((needipsec || optlen) && !hdrsplit) +#endif + { + if ((error = ip6_splithdr(m, &exthdrs)) != 0) { + m = NULL; + goto freehdrs; + } + m = exthdrs.ip6e_ip6; + hdrsplit++; + } + + /* adjust pointer */ + ip6 = mtod(m, struct ip6_hdr *); + + /* adjust mbuf packet header length */ + m->m_pkthdr.len += optlen; + plen = m->m_pkthdr.len - sizeof(*ip6); + + /* If this is a jumbo payload, insert a jumbo payload option. */ + if (plen > IPV6_MAXPACKET) { + if (!hdrsplit) { + if ((error = ip6_splithdr(m, &exthdrs)) != 0) { + m = NULL; + goto freehdrs; + } + m = exthdrs.ip6e_ip6; + hdrsplit++; + } + /* adjust pointer */ + ip6 = mtod(m, struct ip6_hdr *); + if ((error = ip6_insert_jumboopt(&exthdrs, plen)) != 0) + goto freehdrs; + ip6->ip6_plen = 0; + } else + ip6->ip6_plen = htons(plen); + + /* + * Concatenate headers and fill in next header fields. + * Here we have, on "m" + * IPv6 payload + * and we insert headers accordingly. Finally, we should be getting: + * IPv6 hbh dest1 rthdr ah* [esp* dest2 payload] + * + * during the header composing process, "m" points to IPv6 header. + * "mprev" points to an extension header prior to esp. + */ + { + u_char *nexthdrp = &ip6->ip6_nxt; + struct mbuf *mprev = m; + + /* + * we treat dest2 specially. this makes IPsec processing + * much easier. the goal here is to make mprev point the + * mbuf prior to dest2. + * + * result: IPv6 dest2 payload + * m and mprev will point to IPv6 header. + */ + if (exthdrs.ip6e_dest2) { + if (!hdrsplit) + panic("assumption failed: hdr not split"); + exthdrs.ip6e_dest2->m_next = m->m_next; + m->m_next = exthdrs.ip6e_dest2; + *mtod(exthdrs.ip6e_dest2, u_char *) = ip6->ip6_nxt; + ip6->ip6_nxt = IPPROTO_DSTOPTS; + } + +#define MAKE_CHAIN(m, mp, p, i)\ + do {\ + if (m) {\ + if (!hdrsplit) \ + panic("assumption failed: hdr not split"); \ + *mtod((m), u_char *) = *(p);\ + *(p) = (i);\ + p = mtod((m), u_char *);\ + (m)->m_next = (mp)->m_next;\ + (mp)->m_next = (m);\ + (mp) = (m);\ + }\ + } while (0) + /* + * result: IPv6 hbh dest1 rthdr dest2 payload + * m will point to IPv6 header. mprev will point to the + * extension header prior to dest2 (rthdr in the above case). + */ + MAKE_CHAIN(exthdrs.ip6e_hbh, mprev, + nexthdrp, IPPROTO_HOPOPTS); + MAKE_CHAIN(exthdrs.ip6e_dest1, mprev, + nexthdrp, IPPROTO_DSTOPTS); + MAKE_CHAIN(exthdrs.ip6e_rthdr, mprev, + nexthdrp, IPPROTO_ROUTING); +#ifdef MIP6 + /* + * XXX + * MIP6 homeaddress destination option must reside + * after rthdr and before ah/esp/frag hdr. + * this order is not recommended in the ipv6 spec of course. + * result: IPv6 hbh dest1 rthdr ha dest2 payload. + */ + MAKE_CHAIN(exthdrs.ip6e_haddr, mprev, + nexthdrp, IPPROTO_DSTOPTS); +#endif /* MIP6 */ + +#if defined(IPSEC) && !defined(__OpenBSD__) + if (!needipsec) + goto skip_ipsec2; + + /* + * pointers after IPsec headers are not valid any more. + * other pointers need a great care too. + * (IPsec routines should not mangle mbufs prior to AH/ESP) + */ + exthdrs.ip6e_dest2 = NULL; + + { + struct ip6_rthdr *rh = NULL; + int segleft_org = 0; + struct ipsec_output_state state; + + if (exthdrs.ip6e_rthdr) { + rh = mtod(exthdrs.ip6e_rthdr, struct ip6_rthdr *); + segleft_org = rh->ip6r_segleft; + rh->ip6r_segleft = 0; + } + + bzero(&state, sizeof(state)); + state.m = m; + error = ipsec6_output_trans(&state, nexthdrp, mprev, sp, flags, + &needipsectun); + m = state.m; + if (error) { + /* mbuf is already reclaimed in ipsec6_output_trans. */ + m = NULL; + switch (error) { + case EHOSTUNREACH: + case ENETUNREACH: + case EMSGSIZE: + case ENOBUFS: + case ENOMEM: + break; + default: + printf("ip6_output (ipsec): error code %d\n", error); + /* fall through */ + case ENOENT: + /* don't show these error codes to the user */ + error = 0; + break; + } + goto bad; + } + if (exthdrs.ip6e_rthdr) { + /* ah6_output doesn't modify mbuf chain */ + rh->ip6r_segleft = segleft_org; + } + } +skip_ipsec2:; +#endif + } + +#ifdef MIP6 + if ((flags & IPV6_FORWARDING) == 0) { + /* + * After the IPsec processing the IPv6 header source + * address (this is the homeaddress of this node) and + * the address currently stored in the Home Address + * destination option (this is the coa of this node) + * must be swapped. + */ + if ((error = mip6_addr_exchange(m, exthdrs.ip6e_haddr)) != 0) { + mip6log((LOG_ERR, + "%s:%d: " + "addr exchange between haddr and " + "coa failed.\n", + __FILE__, __LINE__)); + goto bad; + } + } else { + /* + * this is the forwarding packet. The typical (and + * only ?) case is multicast packet forwarding. The + * swapping has been already done before (if + * necessary). we must not touch any extension + * headers at all. + */ + } +#endif /* MIP6 */ + + /* + * If there is a routing header, replace destination address field + * with the first hop of the routing header. + */ + if (exthdrs.ip6e_rthdr) { + struct ip6_rthdr *rh = + (struct ip6_rthdr *)(mtod(exthdrs.ip6e_rthdr, + struct ip6_rthdr *)); + struct ip6_rthdr0 *rh0; + struct in6_addr *addr; + + finaldst = ip6->ip6_dst; + switch (rh->ip6r_type) { + case IPV6_RTHDR_TYPE_0: + rh0 = (struct ip6_rthdr0 *)rh; + addr = (struct in6_addr *)(rh0 + 1); + + ip6->ip6_dst = *addr; + bcopy((caddr_t)(addr + 1), (caddr_t)addr, + sizeof(struct in6_addr) * (rh0->ip6r0_segleft - 1) + ); + *(addr + rh0->ip6r0_segleft - 1) = finaldst; + break; + default: /* is it possible? */ + error = EINVAL; + goto bad; + } + } + + /* Source address validation */ + if (!(flags & IPV6_UNSPECSRC) && + IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { + /* + * XXX: we can probably assume validation in the caller, but + * we explicitly check the address here for safety. + */ + error = EOPNOTSUPP; + ip6stat.ip6s_badscope++; + goto bad; + } + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src)) { + error = EOPNOTSUPP; + ip6stat.ip6s_badscope++; + goto bad; + } + + ip6stat.ip6s_localout++; + + /* + * Route packet. + */ + if (ro == 0) { + ro = &ip6route; + bzero((caddr_t)ro, sizeof(*ro)); + } + ro_pmtu = ro; + if (opt && opt->ip6po_rthdr) + ro = &opt->ip6po_route; +#ifdef MIP6 + else if (exthdrs.ip6e_rthdr) { + struct sockaddr_in6 *firsthop; + struct ip6_hdr *ip6 + = mtod(m, struct ip6_hdr *); /* needed ? */; + + ro = &mip6_ip6route; + bzero((caddr_t)ro, sizeof(*ro)); + firsthop = (struct sockaddr_in6 *)&ro->ro_dst; + bzero(firsthop, sizeof(*firsthop)); + firsthop->sin6_family = AF_INET6; + firsthop->sin6_len = sizeof(struct sockaddr_in6); + firsthop->sin6_addr = ip6->ip6_dst; + } +#endif /* MIP6 */ + dst = (struct sockaddr_in6 *)&ro->ro_dst; + +#ifdef IPSEC +#ifdef __OpenBSD__ + /* + * Check if the packet needs encapsulation. + * ipsp_process_packet will never come back to here. + */ + if (sproto != 0) { + s = splnet(); + + /* fill in IPv6 header which would be filled later */ + if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { + if (opt && opt->ip6po_hlim != -1) + ip6->ip6_hlim = opt->ip6po_hlim & 0xff; + } else { + if (im6o != NULL) + ip6->ip6_hlim = im6o->im6o_multicast_hlim; + else + ip6->ip6_hlim = ip6_defmcasthlim; + if (opt && opt->ip6po_hlim != -1) + ip6->ip6_hlim = opt->ip6po_hlim & 0xff; + + /* + * XXX what should we do if ip6_hlim == 0 and the packet + * gets tunnelled? + */ + } + + tdb = gettdb(sspi, &sdst, sproto); + if (tdb == NULL) { + splx(s); + error = EHOSTUNREACH; + m_freem(m); + goto done; + } + + /* Latch to PCB */ + if (inp) + tdb_add_inp(tdb, inp, 0); + + m->m_flags &= ~(M_BCAST | M_MCAST); /* just in case */ + + /* Callee frees mbuf */ + error = ipsp_process_packet(m, tdb, AF_INET6, 0); + splx(s); + + return error; /* Nothing more to be done */ + } +#else + if (needipsec && needipsectun) { + struct ipsec_output_state state; + + /* + * All the extension headers will become inaccessible + * (since they can be encrypted). + * Don't panic, we need no more updates to extension headers + * on inner IPv6 packet (since they are now encapsulated). + * + * IPv6 [ESP|AH] IPv6 [extension headers] payload + */ + bzero(&exthdrs, sizeof(exthdrs)); + exthdrs.ip6e_ip6 = m; + + bzero(&state, sizeof(state)); + state.m = m; + state.ro = (struct route *)ro; + state.dst = (struct sockaddr *)dst; + + error = ipsec6_output_tunnel(&state, sp, flags); + + m = state.m; +#ifdef NEW_STRUCT_ROUTE + ro = state.ro; +#else + ro = (struct route_in6 *)state.ro; +#endif + dst = (struct sockaddr_in6 *)state.dst; + if (error) { + /* mbuf is already reclaimed in ipsec6_output_tunnel. */ + m0 = m = NULL; + m = NULL; + switch (error) { + case EHOSTUNREACH: + case ENETUNREACH: + case EMSGSIZE: + case ENOBUFS: + case ENOMEM: + break; + default: + printf("ip6_output (ipsec): error code %d\n", error); + /* fall through */ + case ENOENT: + /* don't show these error codes to the user */ + error = 0; + break; + } + goto bad; + } + + exthdrs.ip6e_ip6 = m; + } +#endif /* OpenBSD */ +#endif /* IPSEC */ + + /* if specified, fill in the traffic class field. */ + if (opt) { + ip6->ip6_flow &= ~htonl(0xff << 20); + if (opt->ip6po_tclass >= 0) + ip6->ip6_flow |= + htonl((opt->ip6po_tclass & 0xff) << 20); + } + /* fill in or override the hop limit field, if necessary. */ + if (opt && opt->ip6po_hlim != -1) + ip6->ip6_hlim = opt->ip6po_hlim & 0xff; + else if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { + if (im6o != NULL) + ip6->ip6_hlim = im6o->im6o_multicast_hlim; + else + ip6->ip6_hlim = ip6_defmcasthlim; + } + + { + /* + * XXX: using a block just to define a local variables is not + * a good style.... + */ + struct ifnet *ifp0 = NULL; + struct sockaddr_in6 src; + struct sockaddr_in6 dst0; + int clone = 0; + int64_t zone; + + /* + * XXX: sockaddr_in6 for the destination should be passed + * from the upper layer with a proper scope zone ID, in order + * to make a copy here. + */ + bzero(&dst0, sizeof(dst0)); + dst0.sin6_family = AF_INET6; + dst0.sin6_len = sizeof(dst0); + dst0.sin6_addr = ip6->ip6_dst; +#ifdef SCOPEDROUTING + /* XXX: in6_recoverscope will clear the embedded ID */ + error = in6_recoverscope(&dst0, &dst0.sin6_addr, NULL); + if (error != 0) { + ip6stat.ip6s_badscope++; + in6_ifstat_inc(ifp, ifs6_out_discard); + goto bad; + } +#endif + +#if defined(__bsdi__) || defined(__FreeBSD__) + if (ro != &ip6route && !IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) + clone = 1; +#endif + + if ((error = in6_selectroute(&dst0, opt, im6o, ro, + &ifp, &rt, clone)) != 0) { + switch (error) { + case EHOSTUNREACH: + ip6stat.ip6s_noroute++; + break; + case EADDRNOTAVAIL: + default: + break; /* XXX statistics? */ + } + if (ifp != NULL) + in6_ifstat_inc(ifp, ifs6_out_discard); + goto bad; + } + if (rt == NULL) { + /* + * If in6_selectroute() does not return a route entry, + * dst may not have been updated. + */ + *dst = dst0; /* XXX */ + } + + /* + * then rt (for unicast) and ifp must be non-NULL valid values. + */ + if ((flags & IPV6_FORWARDING) == 0) { + /* XXX: the FORWARDING flag can be set for mrouting. */ + in6_ifstat_inc(ifp, ifs6_out_request); + } + if (rt != NULL) { + ia = (struct in6_ifaddr *)(rt->rt_ifa); + rt->rt_use++; + } + + /* + * The outgoing interface must be in the zone of source and + * destination addresses. We should use ia_ifp to support the + * case of sending packets to an address of our own. + */ + if (ia != NULL && ia->ia_ifp) + ifp0 = ia->ia_ifp; + else + ifp0 = ifp; + /* XXX: we should not do this conversion for every packet. */ + bzero(&src, sizeof(src)); + src.sin6_family = AF_INET6; + src.sin6_len = sizeof(src); + src.sin6_addr = ip6->ip6_src; + if ((error = in6_recoverscope(&src, &ip6->ip6_src, NULL)) + != 0) { + goto badscope; + } + if ((zone = in6_addr2zoneid(ifp0, &src.sin6_addr)) < 0 || + zone != src.sin6_scope_id) { +#ifdef SCOPEDEBUG /* will be removed shortly */ + printf("ip6 output: bad source scope %s for %s on %s\n", + ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), if_name(ifp0)); +#endif + goto badscope; + } + /* XXX: in6_recoverscope will clear the embedded ID */ + if ((error = in6_recoverscope(&dst0, &ip6->ip6_dst, NULL)) + != 0) { + goto badscope; + } + if ((zone = in6_addr2zoneid(ifp0, &dst0.sin6_addr)) < 0 || + zone != dst0.sin6_scope_id) { +#ifdef SCOPEDEBUG /* will be removed shortly */ + printf("ip6 output: bad dst scope %s on %s\n", + ip6_sprintf(&dst0.sin6_addr), if_name(ifp0)); +#endif + goto badscope; + } + + /* scope check is done. */ + goto routefound; + + badscope: + ip6stat.ip6s_badscope++; + in6_ifstat_inc(ifp0, ifs6_out_discard); + if (error == 0) + error = EHOSTUNREACH; /* XXX */ + goto bad; + } + + routefound: + if (rt) { + if (opt && opt->ip6po_nextroute.ro_rt) { + /* + * The nexthop is explicitly specified by the + * application. We assume the next hop is an IPv6 + * address. + */ + dst = (struct sockaddr_in6 *)opt->ip6po_nexthop; + } + else if ((rt->rt_flags & RTF_GATEWAY)) + dst = (struct sockaddr_in6 *)rt->rt_gateway; + } + + if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { + m->m_flags &= ~(M_BCAST | M_MCAST); /* just in case */ + } else { + struct in6_multi *in6m; + + m->m_flags = (m->m_flags & ~M_BCAST) | M_MCAST; + + in6_ifstat_inc(ifp, ifs6_out_mcast); + + /* + * Confirm that the outgoing interface supports multicast. + */ + if (!(ifp->if_flags & IFF_MULTICAST)) { + ip6stat.ip6s_noroute++; + in6_ifstat_inc(ifp, ifs6_out_discard); + error = ENETUNREACH; + goto bad; + } + IN6_LOOKUP_MULTI(ip6->ip6_dst, ifp, in6m); + if (in6m != NULL && + (im6o == NULL || im6o->im6o_multicast_loop)) { + /* + * If we belong to the destination multicast group + * on the outgoing interface, and the caller did not + * forbid loopback, loop back a copy. + */ + ip6_mloopback(ifp, m, dst); + } else { + /* + * If we are acting as a multicast router, perform + * multicast forwarding as if the packet had just + * arrived on the interface to which we are about + * to send. The multicast forwarding function + * recursively calls this function, using the + * IPV6_FORWARDING flag to prevent infinite recursion. + * + * Multicasts that are looped back by ip6_mloopback(), + * above, will be forwarded by the ip6_input() routine, + * if necessary. + */ + if (ip6_mrouter && (flags & IPV6_FORWARDING) == 0) { + /* + * XXX: ip6_mforward expects that rcvif is NULL + * when it is called from the originating path. + * However, it is not always the case, since + * some versions of MGETHDR() does not + * initialize the field. + */ + m->m_pkthdr.rcvif = NULL; + if (ip6_mforward(ip6, ifp, m) != 0) { + m_freem(m); + goto done; + } + } + } + /* + * Multicasts with a hoplimit of zero may be looped back, + * above, but must not be transmitted on a network. + * Also, multicasts addressed to the loopback interface + * are not sent -- the above call to ip6_mloopback() will + * loop back a copy if this host actually belongs to the + * destination group on the loopback interface. + */ + if (ip6->ip6_hlim == 0 || (ifp->if_flags & IFF_LOOPBACK) || + IN6_IS_ADDR_MC_INTFACELOCAL(&ip6->ip6_dst)) { + m_freem(m); + goto done; + } + } + + /* + * Fill the outgoing inteface to tell the upper layer + * to increment per-interface statistics. + */ + if (ifpp) + *ifpp = ifp; + + /* + * Upper-layer reachability confirmation + */ + if (opt && (opt->ip6po_flags & IP6PO_REACHCONF)) + nd6_nud_hint(rt, NULL, 0); + + /* Determine path MTU. */ + if ((error = ip6_getpmtu(ro_pmtu, ro, ifp, &finaldst, &mtu)) != 0) + goto bad; + + /* + * An advanced API option (IPV6_USE_MIN_MTU) overrides mtu setting. + * We ignore the specified MTU if it is larger than the already-known + * path MTU. + */ + if (mtu > IPV6_MMTU && opt && (opt->ip6po_flags & IP6PO_MINMTU)) + mtu = IPV6_MMTU; + + /* Fake scoped addresses */ + if ((ifp->if_flags & IFF_LOOPBACK) != 0) { + /* + * If source or destination address is a scoped address, and + * the packet is going to be sent to a loopback interface, + * we should keep the original interface. + */ + + /* + * XXX: this is a very experimental and temporary solution. + * We eventually have sockaddr_in6 and use the sin6_scope_id + * field of the structure here. + * We rely on the consistency between two scope zone ids + * of source and destination, which should already be assured. + * Larger scopes than link will be supported in the future. + */ + origifp = NULL; + if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) { +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + origifp = ifnet_byindex(ntohs(ip6->ip6_src.s6_addr16[1])); +#else + origifp = ifindex2ifnet[ntohs(ip6->ip6_src.s6_addr16[1])]; +#endif + } else if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) { +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + origifp = ifnet_byindex(ntohs(ip6->ip6_dst.s6_addr16[1])); +#else + origifp = ifindex2ifnet[ntohs(ip6->ip6_dst.s6_addr16[1])]; +#endif + } else if (IN6_IS_ADDR_MC_INTFACELOCAL(&ip6->ip6_dst)) { +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + origifp = ifnet_byindex(ntohs(ip6->ip6_dst.s6_addr16[1])); +#else + origifp = ifindex2ifnet[ntohs(ip6->ip6_dst.s6_addr16[1])]; +#endif + } + + /* + * XXX: origifp can be NULL even in those two cases above. + * For example, if we remove the (only) link-local address + * from the loopback interface, and try to send a link-local + * address without link-id information. Then the source + * address is ::1, and the destination address is the + * link-local address with its s6_addr16[1] being zero. + * What is worse, if the packet goes to the loopback interface + * by a default rejected route, the null pointer would be + * passed to looutput, and the kernel would hang. + * The following last resort would prevent such disaster. + */ + if (origifp == NULL) + origifp = ifp; + } + else + origifp = ifp; +#ifndef SCOPEDROUTING + /* + * clear embedded scope identifiers if necessary. + * in6_clearscope will touch the addresses only when necessary. + */ + in6_clearscope(&ip6->ip6_src); + in6_clearscope(&ip6->ip6_dst); +#endif + +#if defined(IPV6FIREWALL) || (defined(__FreeBSD__) && __FreeBSD__ >= 4) + /* + * Check with the firewall... + */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 4 + if (ip6_fw_enable && ip6_fw_chk_ptr) { +#else + if (ip6_fw_chk_ptr) { +#endif + m->m_pkthdr.rcvif = NULL; /* XXX */ + /* If ipfw says divert, we have to just drop packet */ + if ((*ip6_fw_chk_ptr)(&ip6, ifp, &m)) { + m_freem(m); + goto done; + } + if (!m) { + error = EACCES; + goto done; + } + } +#endif + + /* + * If the outgoing packet contains a hop-by-hop options header, + * it must be examined and processed even by the source node. + * (RFC 2460, section 4.) + */ + if (exthdrs.ip6e_hbh) { + struct ip6_hbh *hbh = mtod(exthdrs.ip6e_hbh, struct ip6_hbh *); + u_int32_t dummy; /* XXX unused */ + u_int32_t plen = 0; /* XXX: ip6_process will check the value */ + +#ifdef DIAGNOSTIC + if ((hbh->ip6h_len + 1) << 3 > exthdrs.ip6e_hbh->m_len) + panic("ip6e_hbh is not continuous"); +#endif + /* + * XXX: if we have to send an ICMPv6 error to the sender, + * we need the M_LOOP flag since icmp6_error() expects + * the IPv6 and the hop-by-hop options header are + * continuous unless the flag is set. + */ + m->m_flags |= M_LOOP; + m->m_pkthdr.rcvif = ifp; + if (ip6_process_hopopts(m, + (u_int8_t *)(hbh + 1), + ((hbh->ip6h_len + 1) << 3) - + sizeof(struct ip6_hbh), + &dummy, &plen) < 0) { + /* m was already freed at this point */ + error = EINVAL;/* better error? */ + goto done; + } + m->m_flags &= ~M_LOOP; /* XXX */ + m->m_pkthdr.rcvif = NULL; + } + +#if defined(__NetBSD__) && defined(PFIL_HOOKS) + /* + * Run through list of hooks for output packets. + */ + m1 = m; + pfh = pfil_hook_get(PFIL_OUT, &inetsw[ip_protox[IPPROTO_IPV6]].pr_pfh); + for (; pfh; pfh = pfh->pfil_link.tqe_next) + if (pfh->pfil_func) { + rv = pfh->pfil_func(ip6, sizeof(*ip6), ifp, 1, &m1); + if (rv) { + error = EHOSTUNREACH; + goto done; + } + m = m1; + if (m == NULL) + goto done; + ip6 = mtod(m, struct ip6_hdr *); + } +#endif /* PFIL_HOOKS */ + +#if defined(__OpenBSD__) && NPF > 0 + if (pf_test6(PF_OUT, ifp, &m) != PF_PASS) { + error = EHOSTUNREACH; + m_freem(m); + goto done; + } + ip6 = mtod(m, struct ip6_hdr *); +#endif + + /* + * Send the packet to the outgoing interface. + * If necessary, do IPv6 fragmentation before sending. + */ + tlen = m->m_pkthdr.len; + /* + * Even if the DONTFRAG option is specified, we cannot send the packet + * when the data length is larger than the MTU of the outgoing + * interface. + * Notify the error by sending IPV6_PATHMTU ancillary data as well + * as returning an error code (the latter is not described in the API + * spec.) + */ + if (opt && (opt->ip6po_flags & IP6PO_DONTFRAG) && tlen > ifp->if_mtu +#ifdef notyet + && !(ifp->if_flags & IFF_FRAGMENTABLE) +#endif + ) { + u_int32_t mtu32; + struct ip6ctlparam ip6cp; + + mtu32 = (u_int32_t)mtu; + bzero(&ip6cp, sizeof(ip6cp)); + ip6cp.ip6c_cmdarg = (void *)&mtu32; + pfctlinput2(PRC_MSGSIZE, &ro_pmtu->ro_dst, (void *)&ip6cp); + + error = EMSGSIZE; + goto bad; + } + if (tlen <= mtu || (opt && (opt->ip6po_flags & IP6PO_DONTFRAG)) +#ifdef notyet + /* + * On any link that cannot convey a 1280-octet packet in one piece, + * link-specific fragmentation and reassembly must be provided at + * a layer below IPv6. [RFC 2460, sec.5] + * Thus if the interface has ability of link-level fragmentation, + * we can just send the packet even if the packet size is + * larger than the link's MTU. + * XXX: IFF_FRAGMENTABLE (or such) flag has not been defined yet... + */ + + || (ifp->if_flags & IFF_FRAGMENTABLE) +#endif + ) + { + struct in6_ifaddr *ia6; + + ip6 = mtod(m, struct ip6_hdr *); + ia6 = in6_ifawithifp(ifp, &ip6->ip6_src); + if (ia6) { + /* Record statistics for this interface address. */ +#if defined(__NetBSD__) && defined(IFA_STATS) + ia6->ia_ifa.ifa_data.ifad_outbytes += + m->m_pkthdr.len; +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + ia6->ia_ifa.if_opackets++; + ia6->ia_ifa.if_obytes += m->m_pkthdr.len; +#elif defined(__bsdi__) && _BSDI_VERSION >= 199802 + ia6->ia_ifa.ifa_opackets++; + ia6->ia_ifa.ifa_obytes += m->m_pkthdr.len; +#endif + } +#if defined(IPSEC) && !defined(__OpenBSD__) + /* clean ipsec history once it goes out of the node */ + ipsec_delaux(m); +#endif + error = nd6_output(ifp, origifp, m, dst, rt); + goto done; + } else if (mtu < IPV6_MMTU) { + /* + * note that path MTU is never less than IPV6_MMTU + * (see icmp6_input). + */ + error = EMSGSIZE; + in6_ifstat_inc(ifp, ifs6_out_fragfail); + goto bad; + } else if (ip6->ip6_plen == 0) { /* jumbo payload cannot be fragmented */ + error = EMSGSIZE; + in6_ifstat_inc(ifp, ifs6_out_fragfail); + goto bad; + } else { + struct mbuf **mnext, *m_frgpart; + struct ip6_frag *ip6f; + u_int32_t id = htonl(ip6_id++); + u_char nextproto; + struct ip6ctlparam ip6cp; + u_int32_t mtu32; + + /* + * Too large for the destination or interface; + * fragment if possible. + * Must be able to put at least 8 bytes per fragment. + */ + hlen = unfragpartlen; + if (mtu > IPV6_MAXPACKET) + mtu = IPV6_MAXPACKET; + + /* Notify a proper path MTU to applications. */ + mtu32 = (u_int32_t)mtu; + bzero(&ip6cp, sizeof(ip6cp)); + ip6cp.ip6c_cmdarg = (void *)&mtu32; + pfctlinput2(PRC_MSGSIZE, &ro_pmtu->ro_dst, (void *)&ip6cp); + + len = (mtu - hlen - sizeof(struct ip6_frag)) & ~7; + if (len < 8) { + error = EMSGSIZE; + in6_ifstat_inc(ifp, ifs6_out_fragfail); + goto bad; + } + + mnext = &m->m_nextpkt; + + /* + * Change the next header field of the last header in the + * unfragmentable part. + */ +#ifdef MIP6 + if (exthdrs.ip6e_haddr) { + nextproto = *mtod(exthdrs.ip6e_haddr, u_char *); + *mtod(exthdrs.ip6e_haddr, u_char *) = IPPROTO_FRAGMENT; + } else +#endif /* MIP6 */ + if (exthdrs.ip6e_rthdr) { + nextproto = *mtod(exthdrs.ip6e_rthdr, u_char *); + *mtod(exthdrs.ip6e_rthdr, u_char *) = IPPROTO_FRAGMENT; + } else if (exthdrs.ip6e_dest1) { + nextproto = *mtod(exthdrs.ip6e_dest1, u_char *); + *mtod(exthdrs.ip6e_dest1, u_char *) = IPPROTO_FRAGMENT; + } else if (exthdrs.ip6e_hbh) { + nextproto = *mtod(exthdrs.ip6e_hbh, u_char *); + *mtod(exthdrs.ip6e_hbh, u_char *) = IPPROTO_FRAGMENT; + } else { + nextproto = ip6->ip6_nxt; + ip6->ip6_nxt = IPPROTO_FRAGMENT; + } + + /* + * Loop through length of segment after first fragment, + * make new header and copy data of each part and link onto + * chain. + */ + m0 = m; + for (off = hlen; off < tlen; off += len) { + MGETHDR(m, M_DONTWAIT, MT_HEADER); + if (!m) { + error = ENOBUFS; + ip6stat.ip6s_odropped++; + goto sendorfree; + } + m->m_pkthdr.rcvif = NULL; + m->m_flags = m0->m_flags & M_COPYFLAGS; + *mnext = m; + mnext = &m->m_nextpkt; + m->m_data += max_linkhdr; + mhip6 = mtod(m, struct ip6_hdr *); + *mhip6 = *ip6; + m->m_len = sizeof(*mhip6); + error = ip6_insertfraghdr(m0, m, hlen, &ip6f); + if (error) { + ip6stat.ip6s_odropped++; + goto sendorfree; + } + ip6f->ip6f_offlg = htons((u_short)((off - hlen) & ~7)); + if (off + len >= tlen) + len = tlen - off; + else + ip6f->ip6f_offlg |= IP6F_MORE_FRAG; + mhip6->ip6_plen = htons((u_short)(len + hlen + + sizeof(*ip6f) - + sizeof(struct ip6_hdr))); + if ((m_frgpart = m_copy(m0, off, len)) == 0) { + error = ENOBUFS; + ip6stat.ip6s_odropped++; + goto sendorfree; + } + m_cat(m, m_frgpart); + m->m_pkthdr.len = len + hlen + sizeof(*ip6f); + m->m_pkthdr.rcvif = (struct ifnet *)0; + ip6f->ip6f_reserved = 0; + ip6f->ip6f_ident = id; + ip6f->ip6f_nxt = nextproto; + ip6stat.ip6s_ofragments++; + in6_ifstat_inc(ifp, ifs6_out_fragcreat); + } + + in6_ifstat_inc(ifp, ifs6_out_fragok); + } + + /* + * Remove leading garbages. + */ +sendorfree: + m = m0->m_nextpkt; + m0->m_nextpkt = 0; + m_freem(m0); + for (m0 = m; m; m = m0) { + m0 = m->m_nextpkt; + m->m_nextpkt = 0; + if (error == 0) { + struct in6_ifaddr *ia6; + ip6 = mtod(m, struct ip6_hdr *); + ia6 = in6_ifawithifp(ifp, &ip6->ip6_src); + if (ia6) { + /* + * Record statistics for this interface + * address. + */ +#if defined(__NetBSD__) && defined(IFA_STATS) + ia6->ia_ifa.ifa_data.ifad_outbytes += + m->m_pkthdr.len; +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + ia6->ia_ifa.if_opackets++; + ia6->ia_ifa.if_obytes += m->m_pkthdr.len; +#elif defined(__bsdi__) && _BSDI_VERSION >= 199802 + ia6->ia_ifa.ifa_opackets++; + ia6->ia_ifa.ifa_obytes += m->m_pkthdr.len; +#endif + } +#if defined(IPSEC) && !defined(__OpenBSD__) + /* clean ipsec history once it goes out of the node */ + ipsec_delaux(m); +#endif + error = nd6_output(ifp, origifp, m, dst, rt); + } else + m_freem(m); + } + + if (error == 0) + ip6stat.ip6s_fragmented++; + +done: + if (ro == &ip6route && ro->ro_rt) { /* brace necessary for RTFREE */ + RTFREE(ro->ro_rt); + } else if (ro_pmtu == &ip6route && ro_pmtu->ro_rt) { + RTFREE(ro_pmtu->ro_rt); + } + +#if defined(IPSEC) && !defined(__OpenBSD__) + if (sp != NULL) + key_freesp(sp); +#endif /* IPSEC */ + +#ifdef MIP6 + mip6_destopt_discard(&mip6opt); +#endif /* MIP6 */ + + return(error); + +freehdrs: +#ifdef MIP6 + mip6_destopt_discard(&mip6opt); +#endif /* MIP6 */ + m_freem(exthdrs.ip6e_hbh); /* m_freem will check if mbuf is 0 */ + m_freem(exthdrs.ip6e_dest1); + m_freem(exthdrs.ip6e_rthdr); +#ifdef MIP6 + m_freem(exthdrs.ip6e_haddr); +#endif /* MIP6 */ + m_freem(exthdrs.ip6e_dest2); + /* fall through */ +bad: + m_freem(m); + goto done; +} + +static int +ip6_copyexthdr(mp, hdr, hlen) + struct mbuf **mp; + caddr_t hdr; + int hlen; +{ + struct mbuf *m; + + if (hlen > MCLBYTES) + return(ENOBUFS); /* XXX */ + + MGET(m, M_DONTWAIT, MT_DATA); + if (!m) + return(ENOBUFS); + + if (hlen > MLEN) { + MCLGET(m, M_DONTWAIT); + if ((m->m_flags & M_EXT) == 0) { + m_free(m); + return(ENOBUFS); + } + } + m->m_len = hlen; + if (hdr) + bcopy(hdr, mtod(m, caddr_t), hlen); + + *mp = m; + return(0); +} + +/* + * Insert jumbo payload option. + */ +static int +ip6_insert_jumboopt(exthdrs, plen) + struct ip6_exthdrs *exthdrs; + u_int32_t plen; +{ + struct mbuf *mopt; + u_char *optbuf; + u_int32_t v; + +#define JUMBOOPTLEN 8 /* length of jumbo payload option and padding */ + + /* + * If there is no hop-by-hop options header, allocate new one. + * If there is one but it doesn't have enough space to store the + * jumbo payload option, allocate a cluster to store the whole options. + * Otherwise, use it to store the options. + */ + if (exthdrs->ip6e_hbh == 0) { + MGET(mopt, M_DONTWAIT, MT_DATA); + if (mopt == 0) + return(ENOBUFS); + mopt->m_len = JUMBOOPTLEN; + optbuf = mtod(mopt, u_char *); + optbuf[1] = 0; /* = ((JUMBOOPTLEN) >> 3) - 1 */ + exthdrs->ip6e_hbh = mopt; + } else { + struct ip6_hbh *hbh; + + mopt = exthdrs->ip6e_hbh; + if (M_TRAILINGSPACE(mopt) < JUMBOOPTLEN) { + /* + * XXX assumption: + * - exthdrs->ip6e_hbh is not referenced from places + * other than exthdrs. + * - exthdrs->ip6e_hbh is not an mbuf chain. + */ + int oldoptlen = mopt->m_len; + struct mbuf *n; + + /* + * XXX: give up if the whole (new) hbh header does + * not fit even in an mbuf cluster. + */ + if (oldoptlen + JUMBOOPTLEN > MCLBYTES) + return(ENOBUFS); + + /* + * As a consequence, we must always prepare a cluster + * at this point. + */ + MGET(n, M_DONTWAIT, MT_DATA); + if (n) { + MCLGET(n, M_DONTWAIT); + if ((n->m_flags & M_EXT) == 0) { + m_freem(n); + n = NULL; + } + } + if (!n) + return(ENOBUFS); + n->m_len = oldoptlen + JUMBOOPTLEN; + bcopy(mtod(mopt, caddr_t), mtod(n, caddr_t), + oldoptlen); + optbuf = mtod(n, caddr_t) + oldoptlen; + m_freem(mopt); + mopt = exthdrs->ip6e_hbh = n; + } else { + optbuf = mtod(mopt, u_char *) + mopt->m_len; + mopt->m_len += JUMBOOPTLEN; + } + optbuf[0] = IP6OPT_PADN; + optbuf[1] = 1; + + /* + * Adjust the header length according to the pad and + * the jumbo payload option. + */ + hbh = mtod(mopt, struct ip6_hbh *); + hbh->ip6h_len += (JUMBOOPTLEN >> 3); + } + + /* fill in the option. */ + optbuf[2] = IP6OPT_JUMBO; + optbuf[3] = 4; + v = (u_int32_t)htonl(plen + JUMBOOPTLEN); + bcopy(&v, &optbuf[4], sizeof(u_int32_t)); + + /* finally, adjust the packet header length */ + exthdrs->ip6e_ip6->m_pkthdr.len += JUMBOOPTLEN; + + return(0); +#undef JUMBOOPTLEN +} + +/* + * Insert fragment header and copy unfragmentable header portions. + */ +static int +ip6_insertfraghdr(m0, m, hlen, frghdrp) + struct mbuf *m0, *m; + int hlen; + struct ip6_frag **frghdrp; +{ + struct mbuf *n, *mlast; + + if (hlen > sizeof(struct ip6_hdr)) { + n = m_copym(m0, sizeof(struct ip6_hdr), + hlen - sizeof(struct ip6_hdr), M_DONTWAIT); + if (n == 0) + return(ENOBUFS); + m->m_next = n; + } else + n = m; + + /* Search for the last mbuf of unfragmentable part. */ + for (mlast = n; mlast->m_next; mlast = mlast->m_next) + ; + + if ((mlast->m_flags & M_EXT) == 0 && + M_TRAILINGSPACE(mlast) >= sizeof(struct ip6_frag)) { + /* use the trailing space of the last mbuf for the fragment hdr */ + *frghdrp = + (struct ip6_frag *)(mtod(mlast, caddr_t) + mlast->m_len); + mlast->m_len += sizeof(struct ip6_frag); + m->m_pkthdr.len += sizeof(struct ip6_frag); + } else { + /* allocate a new mbuf for the fragment header */ + struct mbuf *mfrg; + + MGET(mfrg, M_DONTWAIT, MT_DATA); + if (mfrg == 0) + return(ENOBUFS); + mfrg->m_len = sizeof(struct ip6_frag); + *frghdrp = mtod(mfrg, struct ip6_frag *); + mlast->m_next = mfrg; + } + + return(0); +} + +static int +ip6_getpmtu(ro_pmtu, ro, ifp, dst, mtup) +#ifdef NEW_STRUCT_ROUTE + struct route *ro_pmtu, *ro; +#else + struct route_in6 *ro_pmtu, *ro; +#endif + struct ifnet *ifp; + struct in6_addr *dst; /* XXX: should be sockaddr_in6 */ + u_long *mtup; +{ + u_int32_t mtu = 0; + int error = 0; + + if (ro_pmtu != ro) { + /* The first hop and the final destination may differ. */ + struct sockaddr_in6 *sa6_dst = + (struct sockaddr_in6 *)&ro_pmtu->ro_dst; + if (ro_pmtu->ro_rt && ((ro_pmtu->ro_rt->rt_flags & RTF_UP) + == 0 || + !IN6_ARE_ADDR_EQUAL(&sa6_dst->sin6_addr, + dst))) { + RTFREE(ro_pmtu->ro_rt); + ro_pmtu->ro_rt = (struct rtentry *)NULL; + } + if (ro_pmtu->ro_rt == NULL) { + bzero(sa6_dst, sizeof(*sa6_dst)); + sa6_dst->sin6_family = AF_INET6; + sa6_dst->sin6_len = sizeof(struct sockaddr_in6); + sa6_dst->sin6_addr = *dst; + +#ifdef __bsdi__ /* bsdi needs rtcalloc to clone a route. */ + rtcalloc((struct route *)ro_pmtu); +#else + rtalloc((struct route *)ro_pmtu); +#endif + } + } + if (ro_pmtu->ro_rt) { + u_int32_t ifmtu; + + if (ifp == NULL) + ifp = ro_pmtu->ro_rt->rt_ifp; + ifmtu = nd_ifinfo[ifp->if_index].linkmtu; + mtu = ro_pmtu->ro_rt->rt_rmx.rmx_mtu; + if (mtu > ifmtu || mtu == 0) { + /* + * The MTU on the route is larger than the MTU on + * the interface! This shouldn't happen, unless the + * MTU of the interface has been changed after the + * interface was brought up. Change the MTU in the + * route to match the interface MTU (as long as the + * field isn't locked). + * + * if MTU on the route is 0, we need to fix the MTU. + * this case happens with path MTU discovery timeouts. + */ + mtu = ifmtu; + if ((ro_pmtu->ro_rt->rt_rmx.rmx_locks & RTV_MTU) == 0) + ro_pmtu->ro_rt->rt_rmx.rmx_mtu = mtu; /* XXX */ + } + } else if (ifp) { + mtu = nd_ifinfo[ifp->if_index].linkmtu; + } else + error = EHOSTUNREACH; /* XXX */ + + *mtup = mtu; + return(error); +} + +/* + * IP6 socket option processing. + */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +int +ip6_ctloutput(so, sopt) + struct socket *so; + struct sockopt *sopt; +#else +int +ip6_ctloutput(op, so, level, optname, mp) + int op; + struct socket *so; + int level, optname; + struct mbuf **mp; +#endif +{ + int privileged, optdatalen; + void *optdata; + struct ip6_recvpktopts *rcvopts; +#if defined(IPSEC) && defined(__OpenBSD__) + struct proc *p = curproc; /* XXX */ + struct tdb *tdb; + struct tdb_ident *tdbip, tdbi; + int s; +#endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + struct inpcb *in6p = sotoinpcb(so); + int error, optval; + int level, op, optname; + int optlen; + struct proc *p; + + if (!sopt) { + panic("ip6_ctloutput: arg soopt is NULL"); + } + level = sopt->sopt_level; + op = sopt->sopt_dir; + optname = sopt->sopt_name; + optlen = sopt->sopt_valsize; + p = sopt->sopt_p; +#else +#ifdef HAVE_NRL_INPCB + struct inpcb *inp = sotoinpcb(so); +#define in6p inp +#else /* !NRL */ + struct in6pcb *in6p = sotoin6pcb(so); +#endif /* HAVE_NRL_INPCB */ + struct mbuf *m = *mp; + int error, optval; + int optlen; +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + struct proc *p = curproc; /* XXX */ +#endif + + optlen = m ? m->m_len : 0; +#endif /* FreeBSD >= 3 */ + error = optval = 0; + privileged = 1; + + rcvopts = in6p->in6p_inputopts; + + if (level == IPPROTO_IPV6) { + switch (op) { + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + case SOPT_SET: +#else + case PRCO_SETOPT: +#endif + switch (optname) { + case IPV6_2292PKTOPTIONS: +#ifdef IPV6_PKTOPTIONS + case IPV6_PKTOPTIONS: +#endif + { +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + struct mbuf *m; + + error = soopt_getm(sopt, &m); /* XXX */ + if (error) + break; + error = soopt_mcopyin(sopt, m); /* XXX */ + if (error) + break; + error = ip6_pcbopts(&in6p->in6p_outputopts, + m, so, sopt); + m_freem(m); /* XXX */ +#else + error = ip6_pcbopts(&in6p->in6p_outputopts, + m, so); +#endif /* FreeBSD >= 3 */ + break; + } + + /* + * Use of some Hop-by-Hop options or some + * Destination options, might require special + * privilege. That is, normal applications + * (without special privilege) might be forbidden + * from setting certain options in outgoing packets, + * and might never see certain options in received + * packets. [RFC 2292 Section 6] + * KAME specific note: + * KAME prevents non-privileged users from sending or + * receiving ANY hbh/dst options in order to avoid + * overhead of parsing options in the kernel. + */ + case IPV6_RECVHOPOPTS: + case IPV6_RECVDSTOPTS: + case IPV6_RECVRTHDRDSTOPTS: + /* fall through */ + case IPV6_UNICAST_HOPS: + case IPV6_HOPLIMIT: + case IPV6_FAITH: + + case IPV6_RECVPKTINFO: + case IPV6_RECVHOPLIMIT: + case IPV6_RECVRTHDR: + case IPV6_RECVPATHMTU: + case IPV6_RECVTCLASS: + case IPV6_V6ONLY: + case IPV6_AUTOFLOWLABEL: + if (optlen != sizeof(int)) { + error = EINVAL; + break; + } +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyin(sopt, &optval, + sizeof optval, sizeof optval); + if (error) + break; +#else + optval = *mtod(m, int *); +#endif + switch (optname) { + + case IPV6_UNICAST_HOPS: + if (optval < -1 || optval >= 256) + error = EINVAL; + else { + /* -1 = kernel default */ + in6p->in6p_hops = optval; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if ((in6p->in6p_vflag & + INP_IPV4) != 0) + in6p->inp_ip_ttl = optval; +#endif + } + break; +#define OPTSET(bit) \ +do { \ + if (optval) \ + in6p->in6p_flags |= (bit); \ + else \ + in6p->in6p_flags &= ~(bit); \ +} while (0) +#define OPTSET2292(bit) \ +do { \ + in6p->in6p_flags |= IN6P_RFC2292; \ + if (optval) \ + in6p->in6p_flags |= (bit); \ + else \ + in6p->in6p_flags &= ~(bit); \ +} while (0) +#define OPTBIT(bit) (in6p->in6p_flags & (bit) ? 1 : 0) + + case IPV6_RECVPKTINFO: + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + OPTSET(IN6P_PKTINFO); + if (OPTBIT(IN6P_PKTINFO) == 0) + ip6_reset_rcvopt(rcvopts, IPV6_RECVPKTINFO); + break; + + case IPV6_HOPLIMIT: + { + struct ip6_pktopts **optp; + + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + optp = &in6p->in6p_outputopts; + error = ip6_pcbopt(IPV6_HOPLIMIT, + (u_char *)&optval, + sizeof(optval), + optp, + privileged); + break; + } + + case IPV6_RECVHOPLIMIT: + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + OPTSET(IN6P_HOPLIMIT); + if (OPTBIT(IN6P_HOPLIMIT) == 0) + ip6_reset_rcvopt(rcvopts, IPV6_RECVHOPLIMIT); + break; + + case IPV6_RECVHOPOPTS: + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + OPTSET(IN6P_HOPOPTS); + if (OPTBIT(IN6P_HOPOPTS) == 0) + ip6_reset_rcvopt(rcvopts, IPV6_RECVHOPOPTS); + break; + + case IPV6_RECVDSTOPTS: + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + OPTSET(IN6P_DSTOPTS); + if (OPTBIT(IN6P_DSTOPTS) == 0) + ip6_reset_rcvopt(rcvopts, IPV6_RECVDSTOPTS); + break; + + case IPV6_RECVRTHDRDSTOPTS: + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + OPTSET(IN6P_RTHDRDSTOPTS); + if (OPTBIT(IN6P_RTHDRDSTOPTS) == 0) + ip6_reset_rcvopt(rcvopts, IPV6_RECVRTHDRDSTOPTS); + break; + + case IPV6_RECVRTHDR: + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + OPTSET(IN6P_RTHDR); + if (OPTBIT(IN6P_RTHDR) == 0) + ip6_reset_rcvopt(rcvopts, IPV6_RECVRTHDR); + break; + + case IPV6_FAITH: + OPTSET(IN6P_FAITH); + break; + + case IPV6_RECVPATHMTU: + OPTSET(IN6P_MTU); + break; + + case IPV6_V6ONLY: + /* + * make setsockopt(IPV6_V6ONLY) + * available only prior to bind(2). + * see ipng mailing list, Jun 22 2001. + */ + if (in6p->in6p_lport || + !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) + { + error = EINVAL; + break; + } +#ifdef __NetBSD__ +#ifdef INET6_BINDV6ONLY + if (!optval) + error = EINVAL; +#else + OPTSET(IN6P_IPV6_V6ONLY); +#endif +#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) + OPTSET(IN6P_IPV6_V6ONLY); +#else + if ((ip6_v6only && optval) || + (!ip6_v6only && !optval)) + error = 0; + else + error = EINVAL; +#endif + break; + case IPV6_RECVTCLASS: + /* cannot mix with RFC2292 XXX */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + OPTSET(IN6P_TCLASS); + break; + case IPV6_AUTOFLOWLABEL: + OPTSET(IN6P_AUTOFLOWLABEL); + break; + + } + break; + + case IPV6_OTCLASS: + { + struct ip6_pktopts **optp; + u_int8_t tclass; + + if (optlen != sizeof(tclass)) { + error = EINVAL; + break; + } +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyin(sopt, &tclass, + sizeof tclass, sizeof tclass); + if (error) + break; +#else + tclass = *mtod(m, u_int8_t *); +#endif + optp = &in6p->in6p_outputopts; + error = ip6_pcbopt(optname, + (u_char *)&tclass, + sizeof(tclass), + optp, + privileged); + break; + } + + case IPV6_TCLASS: + case IPV6_DONTFRAG: + case IPV6_USE_MIN_MTU: + if (optlen != sizeof(optval)) { + error = EINVAL; + break; + } +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyin(sopt, &optval, + sizeof optval, sizeof optval); + if (error) + break; +#else + optval = *mtod(m, int *); +#endif + { + struct ip6_pktopts **optp; + optp = &in6p->in6p_outputopts; + error = ip6_pcbopt(optname, + (u_char *)&optval, + sizeof(optval), + optp, + privileged); + break; + } + + case IPV6_2292PKTINFO: + case IPV6_2292HOPLIMIT: + case IPV6_2292HOPOPTS: + case IPV6_2292DSTOPTS: + case IPV6_2292RTHDR: + /* RFC 2292 */ + if (optlen != sizeof(int)) { + error = EINVAL; + break; + } +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyin(sopt, &optval, + sizeof optval, sizeof optval); + if (error) + break; +#else + optval = *mtod(m, int *); +#endif + switch (optname) { + case IPV6_2292PKTINFO: + OPTSET2292(IN6P_PKTINFO); + if (OPTBIT(IN6P_PKTINFO) == 0) + ip6_reset_rcvopt(rcvopts, IPV6_RECVPKTINFO); + break; + case IPV6_2292HOPLIMIT: + OPTSET2292(IN6P_HOPLIMIT); + if (OPTBIT(IN6P_HOPLIMIT) == 0) + ip6_reset_rcvopt(rcvopts, IPV6_RECVHOPLIMIT); + break; + case IPV6_2292HOPOPTS: + /* + * Check super-user privilege. + * See comments for IPV6_RECVHOPOPTS. + */ + OPTSET2292(IN6P_HOPOPTS); + if (OPTBIT(IN6P_HOPOPTS) == 0) + ip6_reset_rcvopt(rcvopts, IPV6_RECVHOPOPTS); + break; + case IPV6_2292DSTOPTS: + OPTSET2292(IN6P_DSTOPTS|IN6P_RTHDRDSTOPTS); /* XXX */ + if (OPTBIT(IN6P_DSTOPTS) == 0) { + ip6_reset_rcvopt(rcvopts, IPV6_RECVDSTOPTS); + ip6_reset_rcvopt(rcvopts, IPV6_RECVRTHDRDSTOPTS); + } + break; + case IPV6_2292RTHDR: + OPTSET2292(IN6P_RTHDR); + if (OPTBIT(IN6P_RTHDR) == 0) + ip6_reset_rcvopt(rcvopts, IPV6_RECVRTHDR); + break; + } + break; + case IPV6_PKTINFO: + case IPV6_HOPOPTS: + case IPV6_RTHDR: + case IPV6_DSTOPTS: + case IPV6_RTHDRDSTOPTS: + case IPV6_NEXTHOP: + { + /* new advanced API (2292bis) */ + u_char *optbuf; + int optlen; + struct ip6_pktopts **optp; + + /* cannot mix with RFC2292 */ + if (OPTBIT(IN6P_RFC2292)) { + error = EINVAL; + break; + } + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + optbuf = sopt->sopt_val; + optlen = sopt->sopt_valsize; +#else /* !fbsd3 */ + if (m && m->m_next) { + error = EINVAL; /* XXX */ + break; + } + if (m) { + optbuf = mtod(m, u_char *); + optlen = m->m_len; + } else { + optbuf = NULL; + optlen = 0; + } +#endif + optp = &in6p->in6p_outputopts; + error = ip6_pcbopt(optname, + optbuf, optlen, + optp, privileged); + break; + } +#undef OPTSET + + case IPV6_MULTICAST_IF: + case IPV6_MULTICAST_HOPS: + case IPV6_MULTICAST_LOOP: + case IPV6_JOIN_GROUP: + case IPV6_LEAVE_GROUP: +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + { + struct mbuf *m; + if (sopt->sopt_valsize > MLEN) { + error = EMSGSIZE; + break; + } + /* XXX */ + MGET(m, sopt->sopt_p ? M_WAIT : M_DONTWAIT, MT_HEADER); + if (m == 0) { + error = ENOBUFS; + break; + } + m->m_len = sopt->sopt_valsize; + error = sooptcopyin(sopt, mtod(m, char *), + m->m_len, m->m_len); + error = ip6_setmoptions(sopt->sopt_name, + &in6p->in6p_moptions, + m); + (void)m_free(m); + } +#else + error = ip6_setmoptions(optname, + &in6p->in6p_moptions, + m); +#if defined(__bsdi__) && _BSDI_VERSION >= 199802 + if (in6p->in6p_moptions != NULL) + in6p->in6p_flags |= INP_IPV6_MCAST; /* XXX */ +#endif +#endif + break; + +#ifndef __bsdi__ + case IPV6_PORTRANGE: +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyin(sopt, &optval, + sizeof optval, sizeof optval); + if (error) + break; +#else + optval = *mtod(m, int *); +#endif + + switch (optval) { + case IPV6_PORTRANGE_DEFAULT: + in6p->in6p_flags &= ~(IN6P_LOWPORT); + in6p->in6p_flags &= ~(IN6P_HIGHPORT); + break; + + case IPV6_PORTRANGE_HIGH: + in6p->in6p_flags &= ~(IN6P_LOWPORT); + in6p->in6p_flags |= IN6P_HIGHPORT; + break; + + case IPV6_PORTRANGE_LOW: + in6p->in6p_flags &= ~(IN6P_HIGHPORT); + in6p->in6p_flags |= IN6P_LOWPORT; + break; + + default: + error = EINVAL; + break; + } + break; +#endif + +#ifdef __OpenBSD__ + case IPSEC6_OUTSA: +#ifndef IPSEC + error = EINVAL; +#else + s = spltdb(); + if (m == 0 || m->m_len != sizeof(struct tdb_ident)) { + error = EINVAL; + } else { + tdbip = mtod(m, struct tdb_ident *); + tdb = gettdb(tdbip->spi, &tdbip->dst, + tdbip->proto); + if (tdb == NULL) + error = ESRCH; + else + tdb_add_inp(tdb, inp, 0); + } + splx(s); +#endif + break; + + case IPV6_AUTH_LEVEL: + case IPV6_ESP_TRANS_LEVEL: + case IPV6_ESP_NETWORK_LEVEL: + case IPV6_IPCOMP_LEVEL: +#ifndef IPSEC + error = EINVAL; +#else + if (m == 0 || m->m_len != sizeof(int)) { + error = EINVAL; + break; + } + optval = *mtod(m, int *); + + if (optval < IPSEC_LEVEL_BYPASS || + optval > IPSEC_LEVEL_UNIQUE) { + error = EINVAL; + break; + } + + switch (optname) { + case IPV6_AUTH_LEVEL: + inp->inp_seclevel[SL_AUTH] = optval; + break; + + case IPV6_ESP_TRANS_LEVEL: + inp->inp_seclevel[SL_ESP_TRANS] = optval; + break; + + case IPV6_ESP_NETWORK_LEVEL: + inp->inp_seclevel[SL_ESP_NETWORK] = optval; + break; + + case IPV6_IPCOMP_LEVEL: + inp->inp_seclevel[SL_IPCOMP] = optval; + break; + } + if (!error) + inp->inp_secrequire = get_sa_require(inp); +#endif + break; +#endif /* OpenBSD */ + +#if defined(IPSEC) && !defined(__OpenBSD__) + case IPV6_IPSEC_POLICY: + { + caddr_t req = NULL; + size_t len = 0; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + struct mbuf *m; +#endif + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if ((error = soopt_getm(sopt, &m)) != 0) /* XXX */ + break; + if ((error = soopt_mcopyin(sopt, m)) != 0) /* XXX */ + break; +#endif + if (m) { + req = mtod(m, caddr_t); + len = m->m_len; + } + error = ipsec6_set_policy(in6p, optname, req, + len, privileged); +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + m_freem(m); +#endif + } + break; +#endif /* KAME IPSEC */ + +#if defined(IPV6FIREWALL) || (defined(__FreeBSD__) && __FreeBSD__ >= 4) + case IPV6_FW_ADD: + case IPV6_FW_DEL: + case IPV6_FW_FLUSH: + case IPV6_FW_ZERO: + { +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + struct mbuf *m; + struct mbuf **mp = &m; +#endif + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if (ip6_fw_ctl_ptr == NULL) + return EINVAL; + /* XXX */ + if ((error = soopt_getm(sopt, &m)) != 0) + break; + /* XXX */ + if ((error = soopt_mcopyin(sopt, m)) != 0) + break; +#else + if (ip6_fw_ctl_ptr == NULL) { + if (m) (void)m_free(m); + return EINVAL; + } +#endif + error = (*ip6_fw_ctl_ptr)(optname, mp); + m = *mp; + } + break; +#endif + + default: + error = ENOPROTOOPT; + break; + } +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + if (m) + (void)m_free(m); +#endif + break; + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + case SOPT_GET: +#else + case PRCO_GETOPT: +#endif + switch (optname) { + + case IPV6_2292PKTOPTIONS: +#ifdef IPV6_PKTOPTIONS + case IPV6_PKTOPTIONS: +#endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if (in6p->in6p_inputopts && + in6p->in6p_inputopts->head) { + struct mbuf *m; + m = m_copym(in6p->in6p_inputopts->head, + 0, M_COPYALL, M_WAIT); + error = soopt_mcopyout(sopt, m); + if (error == 0) + m_freem(m); + } else + sopt->sopt_valsize = 0; +#else + if (in6p->in6p_inputopts && + in6p->in6p_inputopts->head) { + *mp = m_copym(in6p->in6p_inputopts->head, + 0, M_COPYALL, M_WAIT); + } else { + *mp = m_get(M_WAIT, MT_SOOPTS); + (*mp)->m_len = 0; + } +#endif + break; + + case IPV6_RECVHOPOPTS: + case IPV6_RECVDSTOPTS: + case IPV6_RECVRTHDRDSTOPTS: + case IPV6_UNICAST_HOPS: + case IPV6_RECVPKTINFO: + case IPV6_RECVHOPLIMIT: + case IPV6_RECVRTHDR: + case IPV6_USE_MIN_MTU: + case IPV6_RECVPATHMTU: + case IPV6_DONTFRAG: + + case IPV6_FAITH: + case IPV6_V6ONLY: +#ifndef __bsdi__ + case IPV6_PORTRANGE: +#endif + case IPV6_RECVTCLASS: + case IPV6_AUTOFLOWLABEL: + switch (optname) { + + case IPV6_UNICAST_HOPS: + optval = in6p->in6p_hops; + break; + + case IPV6_RECVPKTINFO: + optval = OPTBIT(IN6P_PKTINFO); + break; + + case IPV6_RECVHOPLIMIT: + optval = OPTBIT(IN6P_HOPLIMIT); + break; + + case IPV6_RECVHOPOPTS: + optval = OPTBIT(IN6P_HOPOPTS); + break; + + case IPV6_RECVDSTOPTS: + optval = OPTBIT(IN6P_DSTOPTS); + break; + + case IPV6_RECVRTHDRDSTOPTS: + optval = OPTBIT(IN6P_RTHDRDSTOPTS); + break; + + case IPV6_RECVPATHMTU: + optval = OPTBIT(IN6P_MTU); + break; + + case IPV6_FAITH: + optval = OPTBIT(IN6P_FAITH); + break; + + case IPV6_V6ONLY: +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) + optval = OPTBIT(IN6P_IPV6_V6ONLY); +#else + optval = (ip6_v6only != 0); /* XXX */ +#endif + break; + +#ifndef __bsdi__ + case IPV6_PORTRANGE: + { + int flags; + flags = in6p->in6p_flags; + if (flags & IN6P_HIGHPORT) + optval = IPV6_PORTRANGE_HIGH; + else if (flags & IN6P_LOWPORT) + optval = IPV6_PORTRANGE_LOW; + else + optval = 0; + break; + } +#endif + case IPV6_RECVTCLASS: + optval = OPTBIT(IN6P_TCLASS); + break; + + case IPV6_AUTOFLOWLABEL: + optval = OPTBIT(IN6P_AUTOFLOWLABEL); + break; + +#define PKTOPTBIT(bit) ((in6p->in6p_outputopts && \ + (in6p->in6p_outputopts->ip6po_flags & (bit))) ? 1 : 0) + case IPV6_DONTFRAG: + optval = PKTOPTBIT(IP6PO_DONTFRAG); + break; + + case IPV6_USE_MIN_MTU: + optval = PKTOPTBIT(IP6PO_MINMTU); + break; +#undef PKTOPTBIT + } + if (error) + break; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyout(sopt, &optval, + sizeof optval); +#else + *mp = m = m_get(M_WAIT, MT_SOOPTS); + m->m_len = sizeof(int); + *mtod(m, int *) = optval; +#endif + break; + + case IPV6_PATHMTU: + { + u_long pmtu = 0; + struct ip6_mtuinfo mtuinfo; +#ifdef NEW_STRUCT_ROUTE + struct route *ro = &in6p->in6p_route; +#else + struct route_in6 *ro = (struct route_in6 *)&in6p->in6p_route; +#endif + + if (!(so->so_state & SS_ISCONNECTED)) + return(ENOTCONN); + /* + * XXX: we dot not consider the case of source + * routing, nor optional information to specify + * the outgoing interface. + */ + error = ip6_getpmtu(ro, NULL, NULL, + &in6p->in6p_faddr, &pmtu); + if (error) + break; + if (pmtu > IPV6_MAXPACKET) + pmtu = IPV6_MAXPACKET; + + bzero(&mtuinfo, sizeof(mtuinfo)); + mtuinfo.ip6m_mtu = (u_int32_t)pmtu; + optdata = (void *)&mtuinfo; + optdatalen = sizeof(mtuinfo); +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyout(sopt, optdata, + optdatalen); +#else /* !FreeBSD3 */ + if (optdatalen > MCLBYTES) + return(EMSGSIZE); /* XXX */ + *mp = m = m_get(M_WAIT, MT_SOOPTS); + if (optdatalen > MLEN) + MCLGET(m, M_WAIT); + m->m_len = optdatalen; + bcopy(optdata, mtod(m, void *), + optdatalen); +#endif /* FreeBSD3 */ + break; + } + + case IPV6_2292PKTINFO: + case IPV6_2292HOPLIMIT: + case IPV6_2292HOPOPTS: + case IPV6_2292RTHDR: + case IPV6_2292DSTOPTS: + if (optname == IPV6_2292HOPOPTS || + optname == IPV6_2292DSTOPTS || + !privileged) + return(EPERM); + switch (optname) { + case IPV6_2292PKTINFO: + optval = OPTBIT(IN6P_PKTINFO); + break; + case IPV6_2292HOPLIMIT: + optval = OPTBIT(IN6P_HOPLIMIT); + break; + case IPV6_2292HOPOPTS: + optval = OPTBIT(IN6P_HOPOPTS); + break; + case IPV6_2292RTHDR: + optval = OPTBIT(IN6P_RTHDR); + break; + case IPV6_2292DSTOPTS: + optval = OPTBIT(IN6P_DSTOPTS|IN6P_RTHDRDSTOPTS); + break; + } +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyout(sopt, &optval, + sizeof optval); +#else + *mp = m = m_get(M_WAIT, MT_SOOPTS); + m->m_len = sizeof(int); + *mtod(m, int *) = optval; +#endif /* FreeBSD3 */ + break; + case IPV6_PKTINFO: + case IPV6_HOPOPTS: + case IPV6_RTHDR: + case IPV6_DSTOPTS: + case IPV6_RTHDRDSTOPTS: + case IPV6_NEXTHOP: + case IPV6_OTCLASS: + case IPV6_TCLASS: +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = ip6_getpcbopt(in6p->in6p_outputopts, + optname, sopt); +#else + error = ip6_getpcbopt(in6p->in6p_outputopts, + optname, mp); +#endif + break; + + case IPV6_MULTICAST_IF: + case IPV6_MULTICAST_HOPS: + case IPV6_MULTICAST_LOOP: + case IPV6_JOIN_GROUP: + case IPV6_LEAVE_GROUP: +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + { + struct mbuf *m; + error = ip6_getmoptions(sopt->sopt_name, + in6p->in6p_moptions, &m); + if (error == 0) + error = sooptcopyout(sopt, + mtod(m, char *), m->m_len); + m_freem(m); + } +#else + error = ip6_getmoptions(optname, in6p->in6p_moptions, mp); +#endif + break; + +#ifdef __OpenBSD__ + case IPSEC6_OUTSA: +#ifndef IPSEC + error = EINVAL; +#else + s = spltdb(); + if (inp->inp_tdb_out == NULL) { + error = ENOENT; + } else { + tdbi.spi = inp->inp_tdb_out->tdb_spi; + tdbi.dst = inp->inp_tdb_out->tdb_dst; + tdbi.proto = inp->inp_tdb_out->tdb_sproto; + *mp = m = m_get(M_WAIT, MT_SOOPTS); + m->m_len = sizeof(tdbi); + bcopy((caddr_t)&tdbi, mtod(m, caddr_t), + (unsigned)m->m_len); + } + splx(s); +#endif + break; + + case IPV6_AUTH_LEVEL: + case IPV6_ESP_TRANS_LEVEL: + case IPV6_ESP_NETWORK_LEVEL: + case IPV6_IPCOMP_LEVEL: +#ifndef IPSEC + m->m_len = sizeof(int); + *mtod(m, int *) = IPSEC_LEVEL_NONE; +#else + m->m_len = sizeof(int); + switch (optname) { + case IPV6_AUTH_LEVEL: + optval = inp->inp_seclevel[SL_AUTH]; + break; + + case IPV6_ESP_TRANS_LEVEL: + optval = + inp->inp_seclevel[SL_ESP_TRANS]; + break; + + case IPV6_ESP_NETWORK_LEVEL: + optval = + inp->inp_seclevel[SL_ESP_NETWORK]; + break; + + case IPV6_IPCOMP_LEVEL: + optval = inp->inp_seclevel[SL_IPCOMP]; + break; + } + *mtod(m, int *) = optval; +#endif + break; +#endif /* OpenBSD */ + +#if defined(IPSEC) && !defined(__OpenBSD__) + case IPV6_IPSEC_POLICY: + { + caddr_t req = NULL; + size_t len = 0; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + struct mbuf *m = NULL; + struct mbuf **mp = &m; + + error = soopt_getm(sopt, &m); /* XXX */ + if (error != NULL) + break; + error = soopt_mcopyin(sopt, m); /* XXX */ + if (error != NULL) + break; +#endif + if (m) { + req = mtod(m, caddr_t); + len = m->m_len; + } + error = ipsec6_get_policy(in6p, req, len, mp); +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if (error == 0) + error = soopt_mcopyout(sopt, m); /* XXX */ + if (error == 0 && m) + m_freem(m); +#endif + break; + } +#endif /* KAME IPSEC */ + +#if defined(IPV6FIREWALL) || (defined(__FreeBSD__) && __FreeBSD__ >= 4) + case IPV6_FW_GET: + { +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + struct mbuf *m; + struct mbuf **mp = &m; +#endif + + if (ip6_fw_ctl_ptr == NULL) + { +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + if (m) + (void)m_free(m); +#endif + return EINVAL; + } + error = (*ip6_fw_ctl_ptr)(optname, mp); +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if (error == 0) + error = soopt_mcopyout(sopt, m); /* XXX */ + if (error == 0 && m) + m_freem(m); +#endif + } + break; +#endif + + default: + error = ENOPROTOOPT; + break; + } + break; + } + } else { /* level != IPPROTO_IPV6 */ + error = EINVAL; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + if (op == PRCO_SETOPT && *mp) + (void)m_free(*mp); +#endif + } + return(error); +} + +#ifndef offsetof +#define offsetof(type, member) ((size_t)(&((type *)0)->member)) /* XXX */ +#endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +int +ip6_raw_ctloutput(so, sopt) + struct socket *so; + struct sockopt *sopt; +#else +int +ip6_raw_ctloutput(op, so, level, optname, mp) + int op; + struct socket *so; + int level, optname; + struct mbuf **mp; +#endif +{ + int error = 0, optval, optlen; + const int icmp6off = offsetof(struct icmp6_hdr, icmp6_cksum); +#ifdef HAVE_NRL_INPCB + struct inpcb *inp = sotoinpcb(so); +#else + struct in6pcb *in6p = sotoin6pcb(so); +#endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + int level, op, optname; + struct proc *p; +#else + struct mbuf *m = *mp; +#endif /* FreeBSD >= 3 */ + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if (!sopt) { + panic("ip6_ctloutput: arg soopt is NULL"); + } + level = sopt->sopt_level; + op = sopt->sopt_dir; + optname = sopt->sopt_name; + optlen = sopt->sopt_valsize; + p = sopt->sopt_p; +#else + optlen = m ? m->m_len : 0; +#endif /* FreeBSD >= 3 */ + + if (level != IPPROTO_IPV6) { +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + if (op == PRCO_SETOPT && *mp) + (void)m_free(*mp); +#endif + return(EINVAL); + } + + switch (optname) { + case IPV6_CHECKSUM: + /* + * For ICMPv6 sockets, no modification allowed for checksum + * offset, permit "no change" values to help existing apps. + * + * XXX 2292bis says: "An attempt to set IPV6_CHECKSUM + * for an ICMPv6 socket will fail." + * The current behavior does not meet 2292bis. + */ + switch (op) { +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + case SOPT_SET: +#else + case PRCO_SETOPT: +#endif + if (optlen != sizeof(int)) { + error = EINVAL; + break; + } +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyin(sopt, &optval, sizeof(optval), + sizeof(optval)); + if (error) + break; +#else + optval = *mtod(m, int *); +#endif + if ((optval % 2) != 0) { + /* the API assumes even offset values */ + error = EINVAL; + } else if (so->so_proto->pr_protocol == + IPPROTO_ICMPV6) { + if (optval != icmp6off) + error = EINVAL; + } else + in6p->in6p_cksum = optval; + break; + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + case SOPT_GET: +#else + case PRCO_GETOPT: +#endif + if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) + optval = icmp6off; + else + optval = in6p->in6p_cksum; + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyout(sopt, &optval, sizeof(optval)); +#else + *mp = m = m_get(M_WAIT, MT_SOOPTS); + m->m_len = sizeof(int); + *mtod(m, int *) = optval; +#endif /* FreeBSD3 */ + break; + default: + error = EINVAL; + break; + } + + default: + error = ENOPROTOOPT; + break; + } + +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + if (op == PRCO_SETOPT && m) + (void)m_free(m); +#endif + + return(error); +} + +#ifdef HAVE_NRL_INPCB +#undef in6p +#endif + +/* + * Set up IP6 options in pcb for insertion in output packets or + * specifying behavior of outgoing packets. + */ +static int +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +ip6_pcbopts(pktopt, m, so, sopt) +#else +ip6_pcbopts(pktopt, m, so) +#endif + struct ip6_pktopts **pktopt; + struct mbuf *m; + struct socket *so; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + struct sockopt *sopt; +#endif +{ + struct ip6_pktopts *opt = *pktopt; + int error = 0; + int priv = 1; + + /* turn off any old options. */ + if (opt) { +#ifdef DIAGNOSTIC + if (opt->ip6po_pktinfo || opt->ip6po_nexthop || + opt->ip6po_hbh || opt->ip6po_dest1 || opt->ip6po_dest2 || + opt->ip6po_rhinfo.ip6po_rhi_rthdr) + printf("ip6_pcbopts: all specified options are cleared.\n"); +#endif + ip6_clearpktopts(opt, -1); + } else + opt = malloc(sizeof(*opt), M_IP6OPT, M_WAITOK); + *pktopt = NULL; + + if (!m || m->m_len == 0) { + /* + * Only turning off any previous options. + */ + if (opt) + free(opt, M_IP6OPT); + return(0); + } + + if ((error = ip6_setpktoptions(m, opt, NULL, priv, 1)) != 0) { + ip6_clearpktopts(opt, -1); /* XXX: discard all options */ + return(error); + } + *pktopt = opt; + return(0); +} + +/* + * initialize ip6_pktopts. beware that there are non-zero default values in + * the struct. + */ +void +init_ip6pktopts(opt) + struct ip6_pktopts *opt; +{ + + bzero(opt, sizeof(*opt)); + opt->ip6po_hlim = -1; /* -1 means default hop limit */ + opt->ip6po_tclass = -1; /* -1 means default traffic class */ +} + +#define sin6tosa(sin6) ((struct sockaddr *)(sin6)) /* XXX */ +static int +ip6_pcbopt(optname, buf, len, pktopt, priv) + int optname, len, priv; + u_char *buf; + struct ip6_pktopts **pktopt; +{ + struct ip6_pktopts *opt; + + if (*pktopt == NULL) { + *pktopt = malloc(sizeof(struct ip6_pktopts), M_IP6OPT, + M_WAITOK); + init_ip6pktopts(*pktopt); + (*pktopt)->needfree = 1; + } + opt = *pktopt; + + return(ip6_setpktoption(optname, buf, len, opt, priv, 1, 0)); +} + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +static int +ip6_getpcbopt(pktopt, optname, sopt) + struct ip6_pktopts *pktopt; + struct sockopt *sopt; + int optname; +#else +static int +ip6_getpcbopt(pktopt, optname, mp) + struct ip6_pktopts *pktopt; + int optname; + struct mbuf **mp; +#endif +{ + void *optdata = NULL; + int optdatalen = 0; + struct ip6_ext *ip6e; + int error = 0; + struct in6_pktinfo null_pktinfo; + int deftclass = 0; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + struct mbuf *m; +#endif + + switch (optname) { + case IPV6_PKTINFO: + if (pktopt && pktopt->ip6po_pktinfo) + optdata = (void *)pktopt->ip6po_pktinfo; + else { + /* XXX: we don't have to do this every time... */ + bzero(&null_pktinfo, sizeof(null_pktinfo)); + optdata = (void *)&null_pktinfo; + } + optdatalen = sizeof(struct in6_pktinfo); + break; + case IPV6_OTCLASS: + /* XXX */ + return(EINVAL); + case IPV6_TCLASS: + if (pktopt && pktopt->ip6po_tclass >= 0) + optdata = (void *)&pktopt->ip6po_tclass; + else + optdata = (void *)&deftclass; + optdatalen = sizeof(int); + break; + case IPV6_HOPOPTS: + if (pktopt && pktopt->ip6po_hbh) { + optdata = (void *)pktopt->ip6po_hbh; + ip6e = (struct ip6_ext *)pktopt->ip6po_hbh; + optdatalen = (ip6e->ip6e_len + 1) << 3; + } + break; + case IPV6_RTHDR: + if (pktopt && pktopt->ip6po_rthdr) { + optdata = (void *)pktopt->ip6po_rthdr; + ip6e = (struct ip6_ext *)pktopt->ip6po_rthdr; + optdatalen = (ip6e->ip6e_len + 1) << 3; + } + break; + case IPV6_RTHDRDSTOPTS: + if (pktopt && pktopt->ip6po_dest1) { + optdata = (void *)pktopt->ip6po_dest1; + ip6e = (struct ip6_ext *)pktopt->ip6po_dest1; + optdatalen = (ip6e->ip6e_len + 1) << 3; + } + break; + case IPV6_DSTOPTS: + if (pktopt && pktopt->ip6po_dest2) { + optdata = (void *)pktopt->ip6po_dest2; + ip6e = (struct ip6_ext *)pktopt->ip6po_dest2; + optdatalen = (ip6e->ip6e_len + 1) << 3; + } + break; + case IPV6_NEXTHOP: + if (pktopt && pktopt->ip6po_nexthop) { + optdata = (void *)pktopt->ip6po_nexthop; + optdatalen = pktopt->ip6po_nexthop->sa_len; + } + break; + default: /* should not happen */ + printf("ip6_getpcbopt: unexpected option: %d\n", optname); + return(ENOPROTOOPT); + } + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + error = sooptcopyout(sopt, optdata, optdatalen); +#else /* !FreeBSD3 */ + if (optdatalen > MCLBYTES) + return(EMSGSIZE); /* XXX */ + *mp = m = m_get(M_WAIT, MT_SOOPTS); + if (optdatalen > MLEN) + MCLGET(m, M_WAIT); + m->m_len = optdatalen; + if (optdatalen) + bcopy(optdata, mtod(m, void *), optdatalen); +#endif /* FreeBSD3 */ + + return(error); +} + +void +ip6_clearpktopts(pktopt, optname) + struct ip6_pktopts *pktopt; + int optname; +{ + int needfree = pktopt->needfree; + + if (pktopt == NULL) + return; + + if (optname == -1 || optname == IPV6_PKTINFO) { + if (needfree && pktopt->ip6po_pktinfo) + free(pktopt->ip6po_pktinfo, M_IP6OPT); + pktopt->ip6po_pktinfo = NULL; + } + if (optname == -1 || optname == IPV6_HOPLIMIT) + pktopt->ip6po_hlim = -1; + if (optname == -1 || optname == IPV6_TCLASS) + pktopt->ip6po_tclass = -1; + if (optname == -1 || optname == IPV6_NEXTHOP) { + if (pktopt->ip6po_nextroute.ro_rt) { + RTFREE(pktopt->ip6po_nextroute.ro_rt); + pktopt->ip6po_nextroute.ro_rt = NULL; + } + if (needfree && pktopt->ip6po_nexthop) + free(pktopt->ip6po_nexthop, M_IP6OPT); + pktopt->ip6po_nexthop = NULL; + } + if (optname == -1 || optname == IPV6_HOPOPTS) { + if (needfree && pktopt->ip6po_hbh) + free(pktopt->ip6po_hbh, M_IP6OPT); + pktopt->ip6po_hbh = NULL; + } + if (optname == -1 || optname == IPV6_RTHDRDSTOPTS) { + if (needfree && pktopt->ip6po_dest1) + free(pktopt->ip6po_dest1, M_IP6OPT); + pktopt->ip6po_dest1 = NULL; + } + if (optname == -1 || optname == IPV6_RTHDR) { + if (needfree && pktopt->ip6po_rhinfo.ip6po_rhi_rthdr) + free(pktopt->ip6po_rhinfo.ip6po_rhi_rthdr, M_IP6OPT); + pktopt->ip6po_rhinfo.ip6po_rhi_rthdr = NULL; + if (pktopt->ip6po_route.ro_rt) { + RTFREE(pktopt->ip6po_route.ro_rt); + pktopt->ip6po_route.ro_rt = NULL; + } + } + if (optname == -1 || optname == IPV6_DSTOPTS) { + if (needfree && pktopt->ip6po_dest2) + free(pktopt->ip6po_dest2, M_IP6OPT); + pktopt->ip6po_dest2 = NULL; + } +} + +#define PKTOPT_EXTHDRCPY(type) \ +do {\ + if (src->type) {\ + int hlen =\ + (((struct ip6_ext *)src->type)->ip6e_len + 1) << 3;\ + dst->type = malloc(hlen, M_IP6OPT, canwait);\ + if (dst->type == NULL && canwait == M_NOWAIT)\ + goto bad;\ + bcopy(src->type, dst->type, hlen);\ + }\ +} while (0) + +struct ip6_pktopts * +ip6_copypktopts(src, canwait) + struct ip6_pktopts *src; + int canwait; +{ + struct ip6_pktopts *dst; + + if (src == NULL) { + printf("ip6_clearpktopts: invalid argument\n"); + return(NULL); + } + + dst = malloc(sizeof(*dst), M_IP6OPT, canwait); + if (dst == NULL && canwait == M_NOWAIT) + goto bad; + bzero(dst, sizeof(*dst)); + dst->needfree = 1; + + dst->ip6po_hlim = src->ip6po_hlim; + dst->ip6po_tclass = src->ip6po_tclass; + dst->ip6po_flags = src->ip6po_flags; + if (src->ip6po_pktinfo) { + dst->ip6po_pktinfo = malloc(sizeof(*dst->ip6po_pktinfo), + M_IP6OPT, canwait); + if (dst->ip6po_pktinfo == NULL && canwait == M_NOWAIT) + goto bad; + *dst->ip6po_pktinfo = *src->ip6po_pktinfo; + } + if (src->ip6po_nexthop) { + dst->ip6po_nexthop = malloc(src->ip6po_nexthop->sa_len, + M_IP6OPT, canwait); + if (dst->ip6po_nexthop == NULL && canwait == M_NOWAIT) + goto bad; + bcopy(src->ip6po_nexthop, dst->ip6po_nexthop, + src->ip6po_nexthop->sa_len); + } + PKTOPT_EXTHDRCPY(ip6po_hbh); + PKTOPT_EXTHDRCPY(ip6po_dest1); + PKTOPT_EXTHDRCPY(ip6po_dest2); + PKTOPT_EXTHDRCPY(ip6po_rthdr); /* not copy the cached route */ + return(dst); + + bad: + printf("ip6_copypktopts: copy failed"); + if (dst->ip6po_pktinfo) free(dst->ip6po_pktinfo, M_IP6OPT); + if (dst->ip6po_nexthop) free(dst->ip6po_nexthop, M_IP6OPT); + if (dst->ip6po_hbh) free(dst->ip6po_hbh, M_IP6OPT); + if (dst->ip6po_dest1) free(dst->ip6po_dest1, M_IP6OPT); + if (dst->ip6po_dest2) free(dst->ip6po_dest2, M_IP6OPT); + if (dst->ip6po_rthdr) free(dst->ip6po_rthdr, M_IP6OPT); + return(NULL); +} +#undef PKTOPT_EXTHDRCPY + +void +ip6_freepcbopts(pktopt) + struct ip6_pktopts *pktopt; +{ + if (pktopt == NULL) + return; + + ip6_clearpktopts(pktopt, -1); + + free(pktopt, M_IP6OPT); +} + +/* + * Set the IP6 multicast options in response to user setsockopt(). + */ +static int +ip6_setmoptions(optname, im6op, m) + int optname; + struct ip6_moptions **im6op; + struct mbuf *m; +{ + int error = 0; + u_int loop, ifindex; + struct ipv6_mreq *mreq; + struct ifnet *ifp; + struct ip6_moptions *im6o = *im6op; + struct route ro; + struct sockaddr_in6 *dst; + struct in6_multi_mship *imm; + + if (im6o == NULL) { + /* + * No multicast option buffer attached to the pcb; + * allocate one and initialize to default values. + */ + im6o = (struct ip6_moptions *) + malloc(sizeof(*im6o), M_IPMOPTS, M_WAITOK); + *im6op = im6o; + im6o->im6o_multicast_ifp = NULL; + im6o->im6o_multicast_hlim = ip6_defmcasthlim; + im6o->im6o_multicast_loop = IPV6_DEFAULT_MULTICAST_LOOP; + LIST_INIT(&im6o->im6o_memberships); + } + + switch (optname) { + + case IPV6_MULTICAST_IF: + /* + * Select the interface for outgoing multicast packets. + */ + if (m == NULL || m->m_len != sizeof(u_int)) { + error = EINVAL; + break; + } + bcopy(mtod(m, u_int *), &ifindex, sizeof(ifindex)); + if (ifindex < 0 || if_index < ifindex) { + error = ENXIO; /* XXX EINVAL? */ + break; + } +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + ifp = ifnet_byindex(ifindex); +#else + ifp = ifindex2ifnet[ifindex]; +#endif + if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) { + error = EADDRNOTAVAIL; + break; + } + im6o->im6o_multicast_ifp = ifp; + break; + + case IPV6_MULTICAST_HOPS: + { + /* + * Set the IP6 hoplimit for outgoing multicast packets. + */ + int optval; + if (m == NULL || m->m_len != sizeof(int)) { + error = EINVAL; + break; + } + bcopy(mtod(m, u_int *), &optval, sizeof(optval)); + if (optval < -1 || optval >= 256) + error = EINVAL; + else if (optval == -1) + im6o->im6o_multicast_hlim = ip6_defmcasthlim; + else + im6o->im6o_multicast_hlim = optval; + break; + } + + case IPV6_MULTICAST_LOOP: + /* + * Set the loopback flag for outgoing multicast packets. + * Must be zero or one. + */ + if (m == NULL || m->m_len != sizeof(u_int)) { + error = EINVAL; + break; + } + bcopy(mtod(m, u_int *), &loop, sizeof(loop)); + if (loop > 1) { + error = EINVAL; + break; + } + im6o->im6o_multicast_loop = loop; + break; + + case IPV6_JOIN_GROUP: + /* + * Add a multicast group membership. + * Group must be a valid IP6 multicast address. + */ + if (m == NULL || m->m_len != sizeof(struct ipv6_mreq)) { + error = EINVAL; + break; + } + mreq = mtod(m, struct ipv6_mreq *); + if (IN6_IS_ADDR_UNSPECIFIED(&mreq->ipv6mr_multiaddr)) { + /* + * We use the unspecified address to specify to accept + * all multicast addresses. Only super user is allowed + * to do this. + */ + } else if (!IN6_IS_ADDR_MULTICAST(&mreq->ipv6mr_multiaddr)) { + error = EINVAL; + break; + } + + /* + * If the interface is specified, validate it. + */ + if (mreq->ipv6mr_interface < 0 + || if_index < mreq->ipv6mr_interface) { + error = ENXIO; /* XXX EINVAL? */ + break; + } + /* + * If no interface was explicitly specified, choose an + * appropriate one according to the given multicast address. + */ + if (mreq->ipv6mr_interface == 0) { + /* + * Look up the routing table for the + * address, and choose the outgoing interface. + * XXX: is it a good approach? + */ + ro.ro_rt = NULL; + dst = (struct sockaddr_in6 *)&ro.ro_dst; + bzero(dst, sizeof(*dst)); + dst->sin6_len = sizeof(struct sockaddr_in6); + dst->sin6_family = AF_INET6; + dst->sin6_addr = mreq->ipv6mr_multiaddr; + rtalloc((struct route *)&ro); + if (ro.ro_rt == NULL) { + error = EADDRNOTAVAIL; + break; + } + ifp = ro.ro_rt->rt_ifp; + rtfree(ro.ro_rt); + } else { +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + ifp = ifnet_byindex(mreq->ipv6mr_interface); +#else + ifp = ifindex2ifnet[mreq->ipv6mr_interface]; +#endif + } + + /* + * See if we found an interface, and confirm that it + * supports multicast + */ + if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) { + error = EADDRNOTAVAIL; + break; + } + /* + * Put interface index into the multicast address, + * if the address has interface/link-local scope. + * XXX: the embedded form is a KAME-local hack. + */ + if (IN6_IS_ADDR_MC_INTFACELOCAL(&mreq->ipv6mr_multiaddr) || + IN6_IS_ADDR_MC_LINKLOCAL(&mreq->ipv6mr_multiaddr)) { + mreq->ipv6mr_multiaddr.s6_addr16[1] + = htons(mreq->ipv6mr_interface); + } + /* + * See if the membership already exists. + */ + for (imm = im6o->im6o_memberships.lh_first; + imm != NULL; imm = imm->i6mm_chain.le_next) + if (imm->i6mm_maddr->in6m_ifp == ifp && + IN6_ARE_ADDR_EQUAL(&imm->i6mm_maddr->in6m_addr, + &mreq->ipv6mr_multiaddr)) + break; + if (imm != NULL) { + error = EADDRINUSE; + break; + } + /* + * Everything looks good; add a new record to the multicast + * address list for the given interface. + */ + imm = in6_joingroup(ifp, &mreq->ipv6mr_multiaddr, &error); + if (!imm) + break; + LIST_INSERT_HEAD(&im6o->im6o_memberships, imm, i6mm_chain); + break; + + case IPV6_LEAVE_GROUP: + /* + * Drop a multicast group membership. + * Group must be a valid IP6 multicast address. + */ + if (m == NULL || m->m_len != sizeof(struct ipv6_mreq)) { + error = EINVAL; + break; + } + mreq = mtod(m, struct ipv6_mreq *); + if (IN6_IS_ADDR_UNSPECIFIED(&mreq->ipv6mr_multiaddr)) { + } else if (!IN6_IS_ADDR_MULTICAST(&mreq->ipv6mr_multiaddr)) { + error = EINVAL; + break; + } + /* + * If an interface address was specified, get a pointer + * to its ifnet structure. + */ + if (mreq->ipv6mr_interface < 0 + || if_index < mreq->ipv6mr_interface) { + error = ENXIO; /* XXX EINVAL? */ + break; + } +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + ifp = ifnet_byindex(mreq->ipv6mr_interface); +#else + ifp = ifindex2ifnet[mreq->ipv6mr_interface]; +#endif + /* + * Put interface index into the multicast address, + * if the address has interface/link-local scope. + */ + if (IN6_IS_ADDR_MC_INTFACELOCAL(&mreq->ipv6mr_multiaddr) || + IN6_IS_ADDR_MC_LINKLOCAL(&mreq->ipv6mr_multiaddr)) { + mreq->ipv6mr_multiaddr.s6_addr16[1] + = htons(mreq->ipv6mr_interface); + } + /* + * Find the membership in the membership list. + */ + for (imm = im6o->im6o_memberships.lh_first; + imm != NULL; imm = imm->i6mm_chain.le_next) { + if ((ifp == NULL || + imm->i6mm_maddr->in6m_ifp == ifp) && + IN6_ARE_ADDR_EQUAL(&imm->i6mm_maddr->in6m_addr, + &mreq->ipv6mr_multiaddr)) + break; + } + if (imm == NULL) { + /* Unable to resolve interface */ + error = EADDRNOTAVAIL; + break; + } + /* + * Give up the multicast address record to which the + * membership points. + */ + LIST_REMOVE(imm, i6mm_chain); + in6_leavegroup(imm); + break; + + default: + error = EOPNOTSUPP; + break; + } + + /* + * If all options have default values, no need to keep the mbuf. + */ + if (im6o->im6o_multicast_ifp == NULL && + im6o->im6o_multicast_hlim == ip6_defmcasthlim && + im6o->im6o_multicast_loop == IPV6_DEFAULT_MULTICAST_LOOP && + im6o->im6o_memberships.lh_first == NULL) { + free(*im6op, M_IPMOPTS); + *im6op = NULL; + } + + return(error); +} + +/* + * Return the IP6 multicast options in response to user getsockopt(). + */ +static int +ip6_getmoptions(optname, im6o, mp) + int optname; + struct ip6_moptions *im6o; + struct mbuf **mp; +{ + u_int *hlim, *loop, *ifindex; + +#ifdef __FreeBSD__ + *mp = m_get(M_WAIT, MT_HEADER); /* XXX */ +#else + *mp = m_get(M_WAIT, MT_SOOPTS); +#endif + + switch (optname) { + + case IPV6_MULTICAST_IF: + ifindex = mtod(*mp, u_int *); + (*mp)->m_len = sizeof(u_int); + if (im6o == NULL || im6o->im6o_multicast_ifp == NULL) + *ifindex = 0; + else + *ifindex = im6o->im6o_multicast_ifp->if_index; + return(0); + + case IPV6_MULTICAST_HOPS: + hlim = mtod(*mp, u_int *); + (*mp)->m_len = sizeof(u_int); + if (im6o == NULL) + *hlim = ip6_defmcasthlim; + else + *hlim = im6o->im6o_multicast_hlim; + return(0); + + case IPV6_MULTICAST_LOOP: + loop = mtod(*mp, u_int *); + (*mp)->m_len = sizeof(u_int); + if (im6o == NULL) + *loop = ip6_defmcasthlim; + else + *loop = im6o->im6o_multicast_loop; + return(0); + + default: + return(EOPNOTSUPP); + } +} + +/* + * Discard the IP6 multicast options. + */ +void +ip6_freemoptions(im6o) + struct ip6_moptions *im6o; +{ + struct in6_multi_mship *imm; + + if (im6o == NULL) + return; + + while ((imm = im6o->im6o_memberships.lh_first) != NULL) { + LIST_REMOVE(imm, i6mm_chain); + in6_leavegroup(imm); + } + free(im6o, M_IPMOPTS); +} + +/* + * Set IPv6 outgoing packet options based on advanced API. + */ +int +ip6_setpktoptions(control, opt, stickyopt, priv, needcopy) + struct mbuf *control; + struct ip6_pktopts *opt, *stickyopt; + int priv, needcopy; +{ + struct cmsghdr *cm = 0; + + if (control == 0 || opt == 0) + return(EINVAL); + + if (stickyopt) { + /* + * If stickyopt is provided, make a local copy of the options + * for this particular packet, then override them by ancillary + * objects. + * XXX: need to gain a reference for the cached route of the + * next hop in case of the overriding. + */ + *opt = *stickyopt; + if (opt->ip6po_nextroute.ro_rt) + opt->ip6po_nextroute.ro_rt->rt_refcnt++; + } else + init_ip6pktopts(opt); + opt->needfree = needcopy; + + /* + * XXX: Currently, we assume all the optional information is stored + * in a single mbuf. + */ + if (control->m_next) + return(EINVAL); + + for (; control->m_len; control->m_data += CMSG_ALIGN(cm->cmsg_len), + control->m_len -= CMSG_ALIGN(cm->cmsg_len)) { + int error; + + if (control->m_len < CMSG_LEN(0)) + return(EINVAL); + + cm = mtod(control, struct cmsghdr *); + if (cm->cmsg_len == 0 || cm->cmsg_len > control->m_len) + return(EINVAL); + if (cm->cmsg_level != IPPROTO_IPV6) + continue; + + error = ip6_setpktoption(cm->cmsg_type, CMSG_DATA(cm), + cm->cmsg_len - CMSG_LEN(0), + opt, priv, needcopy, 1); + if (error) + return(error); + } + + return(0); +} + +/* + * Set a particular packet option, as a sticky option or an ancillary data + * item. "len" can be 0 only when it's a sticky option. + * We have 4 cases of combination of "sticky" and "cmsg": + * "sticky=0, cmsg=0": impossible + * "sticky=0, cmsg=1": RFC2292 or rfc2292bis ancillary data + * "sticky=1, cmsg=0": rfc2292bis socket option + * "sticky=1, cmsg=1": RFC2292 socket option + */ +static int +ip6_setpktoption(optname, buf, len, opt, priv, sticky, cmsg) + int optname, len, priv, cmsg; + u_char *buf; + struct ip6_pktopts *opt; + int sticky; +{ + if (!sticky && !cmsg) { +#ifdef DIAGNOSTIC + printf("ip6_setpktoption: impossible case\n"); +#endif + return(EINVAL); + } + + /* + * IPV6_2292xxx is for backward compatibility to RFC2292, and should + * not be specified in the context of rfc2292bis. Conversely, + * rfc2292bis types should not be specified in the context of RFC2292. + * + */ + if (!cmsg) { + switch (optname) { + case IPV6_2292PKTINFO: + case IPV6_2292HOPLIMIT: + case IPV6_2292NEXTHOP: + case IPV6_2292HOPOPTS: + case IPV6_2292DSTOPTS: + case IPV6_2292RTHDR: + case IPV6_2292PKTOPTIONS: + return(ENOPROTOOPT); + } + } + if (sticky && cmsg) { + switch (optname) { + case IPV6_PKTINFO: + case IPV6_HOPLIMIT: + case IPV6_NEXTHOP: + case IPV6_HOPOPTS: + case IPV6_DSTOPTS: + case IPV6_RTHDRDSTOPTS: + case IPV6_RTHDR: + case IPV6_REACHCONF: + case IPV6_USE_MIN_MTU: + case IPV6_DONTFRAG: + case IPV6_OTCLASS: + case IPV6_TCLASS: + return(ENOPROTOOPT); + } + } + + switch (optname) { + case IPV6_2292PKTINFO: + case IPV6_PKTINFO: + { + struct ifnet *ifp = NULL; + struct in6_pktinfo *pktinfo; + + if (len != sizeof(struct in6_pktinfo)) + return(EINVAL); + + pktinfo = (struct in6_pktinfo *)buf; + + /* + * An application can clear any sticky IPV6_PKTINFO option by + * doing a "regular" setsockopt with ipi6_addr being + * in6addr_any and ipi6_ifindex being zero. + * [rfc2292bis-02, Section 6] + */ + if (optname == IPV6_PKTINFO && opt->ip6po_pktinfo) { + if (pktinfo->ipi6_ifindex == 0 && + IN6_IS_ADDR_UNSPECIFIED(&pktinfo->ipi6_addr)) { + ip6_clearpktopts(opt, optname); + break; + } + } + + /* validate the interface index if specified. */ + if (pktinfo->ipi6_ifindex > if_index || + pktinfo->ipi6_ifindex < 0) { + return(ENXIO); + } + if (pktinfo->ipi6_ifindex) { +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + ifp = ifnet_byindex(pktinfo->ipi6_ifindex); +#else + ifp = ifindex2ifnet[pktinfo->ipi6_ifindex]; +#endif + if (ifp == NULL) + return(ENXIO); + } + + /* + * We store the address anyway, and let in6_selectsrc() + * validate the specified address. This is because ipi6_addr + * may not have enough information about its scope zone, and + * we may need additional information (such as outgoing + * interface or the scope zone of a destination address) to + * disambiguate the scope. + * XXX: the delay of the validation may confuse the + * application when it is used as a sticky option. + */ + if (sticky) { + if (opt->ip6po_pktinfo == NULL) { + opt->ip6po_pktinfo = malloc(sizeof(*pktinfo), + M_IP6OPT, + M_WAITOK); + } + bcopy(pktinfo, opt->ip6po_pktinfo, sizeof(*pktinfo)); + } else + opt->ip6po_pktinfo = pktinfo; + break; + } + + case IPV6_2292HOPLIMIT: + case IPV6_HOPLIMIT: + { + int *hlimp; + + /* + * rfc2292bis-03 obsoleted the usage of sticky IPV6_HOPLIMIT + * to simplify the ordering among hoplimit options. + */ + if (optname == IPV6_HOPLIMIT && sticky) + return(ENOPROTOOPT); + + if (len != sizeof(int)) + return(EINVAL); + hlimp = (int *)buf; + if (*hlimp < -1 || *hlimp > 255) + return(EINVAL); + + opt->ip6po_hlim = *hlimp; + break; + } + + case IPV6_OTCLASS: + if (len != sizeof(u_int8_t)) + return(EINVAL); + + opt->ip6po_tclass = *(u_int8_t *)buf; + break; + + case IPV6_TCLASS: + { + int tclass; + + if (len != sizeof(int)) + return(EINVAL); + tclass = *(int *)buf; + if (tclass < -1 || tclass > 255) + return(EINVAL); + + opt->ip6po_tclass = tclass; + break; + } + + case IPV6_2292NEXTHOP: + case IPV6_NEXTHOP: + + if (len == 0) { /* just remove the option */ + ip6_clearpktopts(opt, IPV6_NEXTHOP); + break; + } + + /* check if cmsg_len is large enough for sa_len */ + if (len < sizeof(struct sockaddr) || len < *buf) + return(EINVAL); + + switch (((struct sockaddr *)buf)->sa_family) { + case AF_INET6: + { + struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)buf; + int error; + + if (sa6->sin6_len != sizeof(struct sockaddr_in6)) + return(EINVAL); + + if (IN6_IS_ADDR_UNSPECIFIED(&sa6->sin6_addr) || + IN6_IS_ADDR_MULTICAST(&sa6->sin6_addr)) { + return(EINVAL); + } + if ((error = scope6_check_id(sa6, ip6_use_defzone)) + != 0) { + return(error); + } +#ifndef SCOPEDROUTING + sa6->sin6_scope_id = 0; /* XXX */ +#endif + break; + } + case AF_LINK: /* should eventually be supported */ + default: + return(EAFNOSUPPORT); + } + + /* turn off the previous option, then set the new option. */ + ip6_clearpktopts(opt, IPV6_NEXTHOP); + if (sticky) { + opt->ip6po_nexthop = malloc(*buf, M_IP6OPT, M_WAITOK); + bcopy(buf, opt->ip6po_nexthop, *buf); + } else + opt->ip6po_nexthop = (struct sockaddr *)buf; + break; + + case IPV6_2292HOPOPTS: + case IPV6_HOPOPTS: + { + struct ip6_hbh *hbh; + int hbhlen; + + /* + * XXX: We don't allow a non-privileged user to set ANY HbH + * options, since per-option restriction has too much + * overhead. + */ + + if (len == 0) { + ip6_clearpktopts(opt, IPV6_HOPOPTS); + break; /* just remove the option */ + } + + /* message length validation */ + if (len < sizeof(struct ip6_hbh)) + return(EINVAL); + hbh = (struct ip6_hbh *)buf; + hbhlen = (hbh->ip6h_len + 1) << 3; + if (len != hbhlen) + return(EINVAL); + + /* turn off the previous option, then set the new option. */ + ip6_clearpktopts(opt, IPV6_HOPOPTS); + if (sticky) { + opt->ip6po_hbh = malloc(hbhlen, M_IP6OPT, M_WAITOK); + bcopy(hbh, opt->ip6po_hbh, hbhlen); + } else + opt->ip6po_hbh = hbh; + + break; + } + + case IPV6_2292DSTOPTS: + case IPV6_DSTOPTS: + case IPV6_RTHDRDSTOPTS: + { + struct ip6_dest *dest, **newdest = NULL; + int destlen; + + + if (len == 0) { + ip6_clearpktopts(opt, optname); + break; /* just remove the option */ + } + + /* message length validation */ + if (len < sizeof(struct ip6_dest)) + return(EINVAL); + dest = (struct ip6_dest *)buf; + destlen = (dest->ip6d_len + 1) << 3; + if (len != destlen) + return(EINVAL); + + /* + * Determine the position that the destination options header + * should be inserted; before or after the routing header. + */ + switch (optname) { + case IPV6_2292DSTOPTS: + /* + * The old advacned API is ambiguous on this point. + * Our approach is to determine the position based + * according to the existence of a routing header. + * Note, however, that this depends on the order of the + * extension headers in the ancillary data; the 1st + * part of the destination options header must appear + * before the routing header in the ancillary data, + * too. + * RFC2292bis solved the ambiguity by introducing + * separate ancillary data or option types. + */ + if (opt->ip6po_rthdr == NULL) + newdest = &opt->ip6po_dest1; + else + newdest = &opt->ip6po_dest2; + break; + case IPV6_RTHDRDSTOPTS: + newdest = &opt->ip6po_dest1; + break; + case IPV6_DSTOPTS: + newdest = &opt->ip6po_dest2; + break; + } + + /* turn off the previous option, then set the new option. */ + ip6_clearpktopts(opt, optname); + if (sticky) { + *newdest = malloc(destlen, M_IP6OPT, M_WAITOK); + bcopy(dest, *newdest, destlen); + } else + *newdest = dest; + + break; + } + + case IPV6_2292RTHDR: + case IPV6_RTHDR: + { + struct ip6_rthdr *rth; + int rthlen; + + if (len == 0) { + ip6_clearpktopts(opt, IPV6_RTHDR); + break; /* just remove the option */ + } + + /* message length validation */ + if (len < sizeof(struct ip6_rthdr)) + return(EINVAL); + rth = (struct ip6_rthdr *)buf; + rthlen = (rth->ip6r_len + 1) << 3; + if (len != rthlen) + return(EINVAL); + + switch (rth->ip6r_type) { + case IPV6_RTHDR_TYPE_0: + if (rth->ip6r_len == 0) /* must contain one addr */ + return(EINVAL); + if (rth->ip6r_len % 2) /* length must be even */ + return(EINVAL); + if (rth->ip6r_len / 2 != rth->ip6r_segleft) + return(EINVAL); + break; + default: + return(EINVAL); /* not supported */ + } + + /* turn off the previous option */ + ip6_clearpktopts(opt, IPV6_RTHDR); + if (sticky) { + opt->ip6po_rthdr = malloc(rthlen, M_IP6OPT, M_WAITOK); + bcopy(rth, opt->ip6po_rthdr, rthlen); + } else + opt->ip6po_rthdr = rth; + + break; + } + + case IPV6_REACHCONF: + if (!cmsg) + return(ENOPROTOOPT); + +#if 0 + /* + * it looks dangerous to allow IPV6_REACHCONF to + * normal user. it affects the ND state (system state) + * and can affect communication by others - jinmei + */ + if (!priv) + return(EPERM); +#else + /* + * we limit max # of subsequent userland reachability + * conformation by using ln->ln_byhint. + */ +#endif + if (len) + return(EINVAL); + opt->ip6po_flags |= IP6PO_REACHCONF; + break; + + case IPV6_USE_MIN_MTU: + case IPV6_DONTFRAG: + { + int on, flag = 0; + + if (len != sizeof(int)) + return(EINVAL); + on = *(int *)buf; + + switch (optname) { + case IPV6_USE_MIN_MTU: + flag = IP6PO_MINMTU; + break; + case IPV6_DONTFRAG: + flag = IP6PO_DONTFRAG; + break; + } + + if (on) + opt->ip6po_flags |= flag; + else + opt->ip6po_flags &= ~flag; + break; + } + + default: + return(ENOPROTOOPT); + } /* end of switch */ + + return(0); +} + +/* + * Routine called from ip6_output() to loop back a copy of an IP6 multicast + * packet to the input queue of a specified interface. Note that this + * calls the output routine of the loopback "driver", but with an interface + * pointer that might NOT be &loif -- easier than replicating that code here. + */ +void +ip6_mloopback(ifp, m, dst) + struct ifnet *ifp; + struct mbuf *m; + struct sockaddr_in6 *dst; +{ + struct mbuf *copym; + struct ip6_hdr *ip6; + + copym = m_copy(m, 0, M_COPYALL); + if (copym == NULL) + return; + + /* + * Make sure to deep-copy IPv6 header portion in case the data + * is in an mbuf cluster, so that we can safely override the IPv6 + * header portion later. + */ + if ((copym->m_flags & M_EXT) != 0 || + copym->m_len < sizeof(struct ip6_hdr)) { + copym = m_pullup(copym, sizeof(struct ip6_hdr)); + if (copym == NULL) + return; + } + +#ifdef DIAGNOSTIC + if (copym->m_len < sizeof(*ip6)) { + m_freem(copym); + return; + } +#endif + + ip6 = mtod(copym, struct ip6_hdr *); +#ifndef SCOPEDROUTING + /* + * clear embedded scope identifiers if necessary. + * in6_clearscope will touch the addresses only when necessary. + */ + in6_clearscope(&ip6->ip6_src); + in6_clearscope(&ip6->ip6_dst); +#endif + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +#if (__FreeBSD_version >= 410000) + (void)if_simloop(ifp, copym, dst->sin6_family, (int)NULL); +#else + (void)if_simloop(ifp, copym, (struct sockaddr *)dst, NULL); +#endif +#else + (void)looutput(ifp, copym, (struct sockaddr *)dst, NULL); +#endif +} + +/* + * Chop IPv6 header off from the payload. + */ +static int +ip6_splithdr(m, exthdrs) + struct mbuf *m; + struct ip6_exthdrs *exthdrs; +{ + struct mbuf *mh; + struct ip6_hdr *ip6; + + ip6 = mtod(m, struct ip6_hdr *); + if (m->m_len > sizeof(*ip6)) { + MGETHDR(mh, M_DONTWAIT, MT_HEADER); + if (mh == 0) { + m_freem(m); + return ENOBUFS; + } +#ifdef __OpenBSD__ + M_MOVE_PKTHDR(mh, m); +#else + M_COPY_PKTHDR(mh, m); +#endif + MH_ALIGN(mh, sizeof(*ip6)); + m->m_flags &= ~M_PKTHDR; + m->m_len -= sizeof(*ip6); + m->m_data += sizeof(*ip6); + mh->m_next = m; + m = mh; + m->m_len = sizeof(*ip6); + bcopy((caddr_t)ip6, mtod(m, caddr_t), sizeof(*ip6)); + } + exthdrs->ip6e_ip6 = m; + return 0; +} + +/* + * Compute IPv6 extension header length. + */ +#ifdef HAVE_NRL_INPCB +# define in6pcb inpcb +# define in6p_outputopts inp_outputopts6 +#endif +int +ip6_optlen(in6p) + struct in6pcb *in6p; +{ + int len; + + if (!in6p->in6p_outputopts) + return 0; + + len = 0; +#define elen(x) \ + (((struct ip6_ext *)(x)) ? (((struct ip6_ext *)(x))->ip6e_len + 1) << 3 : 0) + + len += elen(in6p->in6p_outputopts->ip6po_hbh); + if (in6p->in6p_outputopts->ip6po_rthdr) + /* dest1 is valid with rthdr only */ + len += elen(in6p->in6p_outputopts->ip6po_dest1); + len += elen(in6p->in6p_outputopts->ip6po_rthdr); + len += elen(in6p->in6p_outputopts->ip6po_dest2); + return len; +#undef elen +} +#ifdef HAVE_NRL_INPCB +# undef in6pcb +# undef in6p_outputopts +#endif diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/mld6.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/mld6.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/mld6.c @@ -0,0 +1,521 @@ +//========================================================================== +// +// src/sys/netinet6/mld6.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: mld6.c,v 1.35 2001/12/18 02:23:44 itojun Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)igmp.c 8.1 (Berkeley) 7/19/93 + */ + +#include +#include +#include +#include +#ifdef __OpenBSD__ +#include +#endif + +#include +#ifdef NEW_STRUCT_ROUTE +#include +#endif + +#include +#include +#include +#include +#include +#include + +/* + * Protocol constants + */ + +/* denotes that the MLD max response delay field specifies time in milliseconds */ +#define MLD6_TIMER_SCALE 1000 +/* + * time between repetitions of a node's initial report of interest in a + * multicast address(in seconds) + */ +#define MLD6_UNSOLICITED_REPORT_INTERVAL 10 + +static struct ip6_pktopts ip6_opts; +static int mld6_timers_are_running; +/* XXX: These are necessary for KAME's link-local hack */ +static struct in6_addr mld6_all_nodes_linklocal = IN6ADDR_LINKLOCAL_ALLNODES_INIT; +static struct in6_addr mld6_all_routers_linklocal = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT; + +static void mld6_sendpkt __P((struct in6_multi *, int, const struct in6_addr *)); + +void +mld6_init() +{ + static u_int8_t hbh_buf[8]; + struct ip6_hbh *hbh = (struct ip6_hbh *)hbh_buf; + u_int16_t rtalert_code = htons((u_int16_t)IP6OPT_RTALERT_MLD); + + mld6_timers_are_running = 0; + + /* ip6h_nxt will be fill in later */ + hbh->ip6h_len = 0; /* (8 >> 3) - 1 */ + + /* XXX: grotty hard coding... */ + hbh_buf[2] = IP6OPT_PADN; /* 2 byte padding */ + hbh_buf[3] = 0; + hbh_buf[4] = IP6OPT_RTALERT; + hbh_buf[5] = IP6OPT_RTALERT_LEN - 2; + bcopy((caddr_t)&rtalert_code, &hbh_buf[6], sizeof(u_int16_t)); + + init_ip6pktopts(&ip6_opts); + ip6_opts.ip6po_hbh = hbh; +} + +void +mld6_start_listening(in6m) + struct in6_multi *in6m; +{ +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + + /* + * RFC2710 page 10: + * The node never sends a Report or Done for the link-scope all-nodes + * address. + * MLD messages are never sent for multicast addresses whose scope is 0 + * (reserved) or 1 (node-local). + */ + mld6_all_nodes_linklocal.s6_addr16[1] = + htons(in6m->in6m_ifp->if_index); /* XXX */ + if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, &mld6_all_nodes_linklocal) || + IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) < IPV6_ADDR_SCOPE_LINKLOCAL) { + in6m->in6m_timer = 0; + in6m->in6m_state = MLD6_OTHERLISTENER; + } else { + mld6_sendpkt(in6m, MLD_LISTENER_REPORT, NULL); + in6m->in6m_timer = MLD6_RANDOM_DELAY( + MLD6_UNSOLICITED_REPORT_INTERVAL * PR_FASTHZ); + in6m->in6m_state = MLD6_IREPORTEDLAST; + mld6_timers_are_running = 1; + } + splx(s); +} + +void +mld6_stop_listening(in6m) + struct in6_multi *in6m; +{ + mld6_all_nodes_linklocal.s6_addr16[1] = + htons(in6m->in6m_ifp->if_index); /* XXX */ + mld6_all_routers_linklocal.s6_addr16[1] = + htons(in6m->in6m_ifp->if_index); /* XXX: necessary when mrouting */ + + if (in6m->in6m_state == MLD6_IREPORTEDLAST && + (!IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, &mld6_all_nodes_linklocal)) && + IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) > IPV6_ADDR_SCOPE_INTFACELOCAL) + mld6_sendpkt(in6m, MLD_LISTENER_DONE, + &mld6_all_routers_linklocal); +} + +void +mld6_input(m, off) + struct mbuf *m; + int off; +{ + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct mld_hdr *mldh; + struct ifnet *ifp = m->m_pkthdr.rcvif; + struct in6_multi *in6m; + struct in6_ifaddr *ia; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + struct ifmultiaddr *ifma; +#endif + int timer; /* timer value in the MLD query header */ + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, sizeof(*mldh),); + mldh = (struct mld_hdr *)(mtod(m, caddr_t) + off); +#else + IP6_EXTHDR_GET(mldh, struct mld_hdr *, m, off, sizeof(*mldh)); + if (mldh == NULL) { + icmp6stat.icp6s_tooshort++; + return; + } +#endif + + /* source address validation */ + ip6 = mtod(m, struct ip6_hdr *); /* in case mpullup */ + if (!(IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src) || + IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src))) { +#if 0 /* do not log in an input path */ + log(LOG_INFO, + "mld6_input: src %s is not link-local (grp=%s)\n", + ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&mldh->mld_addr)); +#endif + /* + * spec (RFC2710) does not explicitly + * specify to discard the packet from a non link-local + * source address. But we believe it's expected to do so. + */ + m_freem(m); + return; + } + + /* + * In the MLD6 specification, there are 3 states and a flag. + * + * In Non-Listener state, we simply don't have a membership record. + * In Delaying Listener state, our timer is running (in6m->in6m_timer) + * In Idle Listener state, our timer is not running (in6m->in6m_timer==0) + * + * The flag is in6m->in6m_state, it is set to MLD6_OTHERLISTENER if + * we have heard a report from another member, or MLD6_IREPORTEDLAST + * if we sent the last report. + */ + switch (mldh->mld_type) { + case MLD_LISTENER_QUERY: + if (ifp->if_flags & IFF_LOOPBACK) + break; + + if (!IN6_IS_ADDR_UNSPECIFIED(&mldh->mld_addr) && + !IN6_IS_ADDR_MULTICAST(&mldh->mld_addr)) + break; /* print error or log stat? */ + if (IN6_IS_ADDR_MC_LINKLOCAL(&mldh->mld_addr)) + mldh->mld_addr.s6_addr16[1] = + htons(ifp->if_index); /* XXX */ + + /* + * - Start the timers in all of our membership records + * that the query applies to for the interface on + * which the query arrived excl. those that belong + * to the "all-nodes" group (ff02::1). + * - Restart any timer that is already running but has + * A value longer than the requested timeout. + * - Use the value specified in the query message as + * the maximum timeout. + */ + IFP_TO_IA6(ifp, ia); + if (ia == NULL) + break; + + /* + * XXX: System timer resolution is too low to handle Max + * Response Delay, so set 1 to the internal timer even if + * the calculated value equals to zero when Max Response + * Delay is positive. + */ + timer = ntohs(mldh->mld_maxdelay)*PR_FASTHZ/MLD6_TIMER_SCALE; + if (timer == 0 && mldh->mld_maxdelay) + timer = 1; + mld6_all_nodes_linklocal.s6_addr16[1] = + htons(ifp->if_index); /* XXX */ + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) +#else + for (in6m = ia->ia6_multiaddrs.lh_first; + in6m; + in6m = in6m->in6m_entry.le_next) +#endif + { +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + if (ifma->ifma_addr->sa_family != AF_INET6) + continue; + in6m = (struct in6_multi *)ifma->ifma_protospec; + if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, + &mld6_all_nodes_linklocal) || + IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) < + IPV6_ADDR_SCOPE_LINKLOCAL) + continue; +#else + if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, + &mld6_all_nodes_linklocal) || + IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) < + IPV6_ADDR_SCOPE_LINKLOCAL) + continue; +#endif + + if (IN6_IS_ADDR_UNSPECIFIED(&mldh->mld_addr) || + IN6_ARE_ADDR_EQUAL(&mldh->mld_addr, + &in6m->in6m_addr)) + { + if (timer == 0) { + /* send a report immediately */ + mld6_sendpkt(in6m, MLD_LISTENER_REPORT, + NULL); + in6m->in6m_timer = 0; /* reset timer */ + in6m->in6m_state = MLD6_IREPORTEDLAST; + } + else if (in6m->in6m_timer == 0 || /* idle */ + in6m->in6m_timer > timer) { + in6m->in6m_timer = + MLD6_RANDOM_DELAY(timer); + mld6_timers_are_running = 1; + } + } + } + + if (IN6_IS_ADDR_MC_LINKLOCAL(&mldh->mld_addr)) + mldh->mld_addr.s6_addr16[1] = 0; /* XXX */ + break; + case MLD_LISTENER_REPORT: + /* + * For fast leave to work, we have to know that we are the + * last person to send a report for this group. Reports + * can potentially get looped back if we are a multicast + * router, so discard reports sourced by me. + * Note that it is impossible to check IFF_LOOPBACK flag of + * ifp for this purpose, since ip6_mloopback pass the physical + * interface to looutput. + */ + if (m->m_flags & M_LOOP) /* XXX: grotty flag, but efficient */ + break; + + if (!IN6_IS_ADDR_MULTICAST(&mldh->mld_addr)) + break; + + if (IN6_IS_ADDR_MC_LINKLOCAL(&mldh->mld_addr)) + mldh->mld_addr.s6_addr16[1] = + htons(ifp->if_index); /* XXX */ + /* + * If we belong to the group being reported, stop + * our timer for that group. + */ + IN6_LOOKUP_MULTI(mldh->mld_addr, ifp, in6m); + if (in6m) { + in6m->in6m_timer = 0; /* transit to idle state */ + in6m->in6m_state = MLD6_OTHERLISTENER; /* clear flag */ + } + + if (IN6_IS_ADDR_MC_LINKLOCAL(&mldh->mld_addr)) + mldh->mld_addr.s6_addr16[1] = 0; /* XXX */ + break; + default: /* this is impossible */ + log(LOG_ERR, "mld6_input: illegal type(%d)", mldh->mld_type); + break; + } + + m_freem(m); +} + +void +mld6_fasttimeo() +{ + struct in6_multi *in6m; + struct in6_multistep step; + int s; + + /* + * Quick check to see if any work needs to be done, in order + * to minimize the overhead of fasttimo processing. + */ + if (!mld6_timers_are_running) + return; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + mld6_timers_are_running = 0; + IN6_FIRST_MULTI(step, in6m); + while (in6m != NULL) { + if (in6m->in6m_timer == 0) { + /* do nothing */ + } else if (--in6m->in6m_timer == 0) { + mld6_sendpkt(in6m, MLD_LISTENER_REPORT, NULL); + in6m->in6m_state = MLD6_IREPORTEDLAST; + } else { + mld6_timers_are_running = 1; + } + IN6_NEXT_MULTI(step, in6m); + } + splx(s); +} + +static void +mld6_sendpkt(in6m, type, dst) + struct in6_multi *in6m; + int type; + const struct in6_addr *dst; +{ + struct mbuf *mh, *md; + struct mld_hdr *mldh; + struct ip6_hdr *ip6; + struct ip6_moptions im6o; + struct in6_ifaddr *ia; + struct ifnet *ifp = in6m->in6m_ifp; + int ignflags; + + /* + * At first, find a link local address on the outgoing interface + * to use as the source address of the MLD packet. + * We do not reject tentative addresses for MLD report to deal with + * the case where we first join a link-local address. + */ + ignflags = (IN6_IFF_NOTREADY|IN6_IFF_ANYCAST) & ~IN6_IFF_TENTATIVE; + if ((ia = in6ifa_ifpforlinklocal(ifp, ignflags)) == NULL) + return; + if ((ia->ia6_flags & IN6_IFF_TENTATIVE)) + ia = NULL; + + /* + * Allocate mbufs to store ip6 header and MLD header. + * We allocate 2 mbufs and make chain in advance because + * it is more convenient when inserting the hop-by-hop option later. + */ + MGETHDR(mh, M_DONTWAIT, MT_HEADER); + if (mh == NULL) + return; + MGET(md, M_DONTWAIT, MT_DATA); + if (md == NULL) { + m_free(mh); + return; + } + mh->m_next = md; + + mh->m_pkthdr.rcvif = NULL; + mh->m_pkthdr.len = sizeof(struct ip6_hdr) + sizeof(struct mld_hdr); + mh->m_len = sizeof(struct ip6_hdr); + MH_ALIGN(mh, sizeof(struct ip6_hdr)); + + /* fill in the ip6 header */ + ip6 = mtod(mh, struct ip6_hdr *); + ip6->ip6_flow = 0; + ip6->ip6_vfc &= ~IPV6_VERSION_MASK; + ip6->ip6_vfc |= IPV6_VERSION; + /* ip6_plen will be set later */ + ip6->ip6_nxt = IPPROTO_ICMPV6; + /* ip6_hlim will be set by im6o.im6o_multicast_hlim */ + ip6->ip6_src = ia ? ia->ia_addr.sin6_addr : in6addr_any; + ip6->ip6_dst = dst ? *dst : in6m->in6m_addr; + + /* fill in the MLD header */ + md->m_len = sizeof(struct mld_hdr); + mldh = mtod(md, struct mld_hdr *); + mldh->mld_type = type; + mldh->mld_code = 0; + mldh->mld_cksum = 0; + /* XXX: we assume the function will not be called for query messages */ + mldh->mld_maxdelay = 0; + mldh->mld_reserved = 0; + mldh->mld_addr = in6m->in6m_addr; + if (IN6_IS_ADDR_MC_LINKLOCAL(&mldh->mld_addr)) + mldh->mld_addr.s6_addr16[1] = 0; /* XXX */ + mldh->mld_cksum = in6_cksum(mh, IPPROTO_ICMPV6, + sizeof(struct ip6_hdr), + sizeof(struct mld_hdr)); + + /* construct multicast option */ + bzero(&im6o, sizeof(im6o)); + im6o.im6o_multicast_ifp = ifp; + im6o.im6o_multicast_hlim = 1; + + /* + * Request loopback of the report if we are acting as a multicast + * router, so that the process-level routing daemon can hear it. + */ + im6o.im6o_multicast_loop = (ip6_mrouter != NULL); + + /* increment output statictics */ + icmp6stat.icp6s_outhist[type]++; + icmp6_ifstat_inc(ifp, ifs6_out_msg); + switch (type) { + case MLD_LISTENER_QUERY: + icmp6_ifstat_inc(ifp, ifs6_out_mldquery); + break; + case MLD_LISTENER_REPORT: + icmp6_ifstat_inc(ifp, ifs6_out_mldreport); + break; + case MLD_LISTENER_DONE: + icmp6_ifstat_inc(ifp, ifs6_out_mlddone); + break; + } + + ip6_output(mh, &ip6_opts, NULL, ia ? 0 : IPV6_UNSPECSRC, &im6o, NULL); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6.c @@ -0,0 +1,2392 @@ +//========================================================================== +// +// src/sys/netinet6/nd6.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: nd6.c,v 1.221 2001/12/18 02:23:45 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * XXX + * KAME 970409 note: + * BSD/OS version heavily modifies this code, related to llinfo. + * Since we don't have BSD/OS version of net/route.c in our hand, + * I left the code mostly as it was in 970310. -- itojun + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#ifndef __NetBSD__ +#include +#ifdef __bsdi__ +#include +#endif +#ifdef __OpenBSD__ +#include +#endif +#else /* __NetBSD__ */ +#include +#include +#include +#endif /* __NetBSD__ */ +#include +#include +#include +#include +#include + +#if defined(__NetBSD__) +extern struct ifnet loif[NLOOP]; +#endif + +#define ND6_SLOWTIMER_INTERVAL (60 * 60) /* 1 hour */ +#define ND6_RECALC_REACHTM_INTERVAL (60 * 120) /* 2 hours */ + +#define SIN6(s) ((struct sockaddr_in6 *)s) +#define SDL(s) ((struct sockaddr_dl *)s) + +/* timer values */ +int nd6_prune = 1; /* walk list every 1 seconds */ +int nd6_delay = 5; /* delay first probe time 5 second */ +int nd6_umaxtries = 3; /* maximum unicast query */ +int nd6_mmaxtries = 3; /* maximum multicast query */ +int nd6_useloopback = 1; /* use loopback interface for local traffic */ +int nd6_gctimer = (60 * 60 * 24); /* 1 day: garbage collection timer */ + +/* preventing too many loops in ND option parsing */ +int nd6_maxndopt = 10; /* max # of ND options allowed */ + +int nd6_maxnudhint = 0; /* max # of subsequent upper layer hints */ + +int nd6_debug = 1; + +/* for debugging? */ +static int nd6_inuse, nd6_allocated; + +struct llinfo_nd6 llinfo_nd6 = {&llinfo_nd6, &llinfo_nd6}; +static size_t nd_ifinfo_indexlim = 8; +struct nd_ifinfo *nd_ifinfo = NULL; +struct nd_drhead nd_defrouter; +struct nd_prhead nd_prefix = { 0 }; + +int nd6_recalc_reachtm_interval = ND6_RECALC_REACHTM_INTERVAL; +static struct sockaddr_in6 all1_sa; + +static void nd6_slowtimo __P((void *)); +static int regen_tmpaddr __P((struct in6_ifaddr *)); +static struct llinfo_nd6 *nd6_free __P((struct rtentry *, int)); + +#ifdef __NetBSD__ +struct callout nd6_slowtimo_ch = CALLOUT_INITIALIZER; +struct callout nd6_timer_ch = CALLOUT_INITIALIZER; +extern struct callout in6_tmpaddrtimer_ch; +#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) +struct callout nd6_slowtimo_ch; +struct callout nd6_timer_ch; +extern struct callout in6_tmpaddrtimer_ch; +#elif defined(__OpenBSD__) +struct timeout nd6_slowtimo_ch; +struct timeout nd6_timer_ch; +extern struct timeout in6_tmpaddrtimer_ch; +#endif + +void +nd6_init() +{ + static int nd6_init_done = 0; + int i; + + if (nd6_init_done) { + log(LOG_NOTICE, "nd6_init called more than once(ignored)\n"); + return; + } + + all1_sa.sin6_family = AF_INET6; + all1_sa.sin6_len = sizeof(struct sockaddr_in6); + for (i = 0; i < sizeof(all1_sa.sin6_addr); i++) + all1_sa.sin6_addr.s6_addr[i] = 0xff; + + /* initialization of the default router list */ + TAILQ_INIT(&nd_defrouter); + + nd6_init_done = 1; + + /* start timer */ +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_reset(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz, + nd6_slowtimo, NULL); +#elif defined(__OpenBSD__) + timeout_set(&nd6_slowtimo_ch, nd6_slowtimo, NULL); + timeout_add(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz); +#else + timeout(nd6_slowtimo, (caddr_t)0, ND6_SLOWTIMER_INTERVAL * hz); +#endif +} + +void +nd6_ifattach(ifp) + struct ifnet *ifp; +{ + + /* + * We have some arrays that should be indexed by if_index. + * since if_index will grow dynamically, they should grow too. + */ + if (nd_ifinfo == NULL || if_index >= nd_ifinfo_indexlim) { + size_t n; + caddr_t q; + + while (if_index >= nd_ifinfo_indexlim) + nd_ifinfo_indexlim <<= 1; + + /* grow nd_ifinfo */ + n = nd_ifinfo_indexlim * sizeof(struct nd_ifinfo); + q = (caddr_t)malloc(n, M_IP6NDP, M_WAITOK); + bzero(q, n); + if (nd_ifinfo) { + bcopy((caddr_t)nd_ifinfo, q, n/2); + free((caddr_t)nd_ifinfo, M_IP6NDP); + } + nd_ifinfo = (struct nd_ifinfo *)q; + } + +#define ND nd_ifinfo[ifp->if_index] + + /* + * Don't initialize if called twice. + * XXX: to detect this, we should choose a member that is never set + * before initialization of the ND structure itself. We formaly used + * the linkmtu member, which was not suitable because it could be + * initialized via "ifconfig mtu". + */ + if (ND.basereachable) + return; + +#ifdef DIAGNOSTIC +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + if (!ifnet_byindex(ifp->if_index)) + panic("nd6_ifattach: ifnet_byindex is NULL"); +#else + if (!ifindex2ifnet[ifp->if_index]) + panic("nd6_ifattach: ifindex2ifnet is NULL"); +#endif +#endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + ND.linkmtu = ifnet_byindex(ifp->if_index)->if_mtu; +#else + ND.linkmtu = ifindex2ifnet[ifp->if_index]->if_mtu; +#endif + ND.chlim = IPV6_DEFHLIM; + ND.basereachable = REACHABLE_TIME; + ND.reachable = ND_COMPUTE_RTIME(ND.basereachable); + ND.retrans = RETRANS_TIMER; + ND.receivedra = 0; + /* + * Note that the default value of ip6_accept_rtadv is 0, which means + * we won't accept RAs by default even if we set ND6_IFF_ACCEPT_RTADV + * here. + */ + ND.flags = ND6_IFF_PERFORMNUD | ND6_IFF_ACCEPT_RTADV; + nd6_setmtu(ifp); +#undef ND +} + +/* + * Reset ND level link MTU. This function is called when the physical MTU + * changes, which means we might have to adjust the ND level MTU. + */ +void +nd6_setmtu(ifp) + struct ifnet *ifp; +{ +#ifndef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + struct nd_ifinfo *ndi = &nd_ifinfo[ifp->if_index]; + u_long oldmaxmtu = ndi->maxmtu; + u_long oldlinkmtu = ndi->linkmtu; + + switch (ifp->if_type) { + case IFT_ARCNET: /* XXX MTU handling needs more work */ + ndi->maxmtu = MIN(60480, ifp->if_mtu); + break; + case IFT_ETHER: + ndi->maxmtu = MIN(ETHERMTU, ifp->if_mtu); + break; +#if defined(__FreeBSD__) || defined(__bsdi__) + case IFT_FDDI: +#if 0 // FIXME +#if defined(__bsdi__) && _BSDI_VERSION >= 199802 + ndi->maxmtu = MIN(FDDIMTU, ifp->if_mtu); +#else + ndi->maxmtu = MIN(FDDIIPMTU, ifp->if_mtu); +#endif +#endif + break; +#endif +#if !(defined(__bsdi__) && _BSDI_VERSION >= 199802) + case IFT_ATM: +#if 0 // FIXME + ndi->maxmtu = MIN(ATMMTU, ifp->if_mtu); +#endif + break; +#endif + case IFT_IEEE1394: /* XXX should be IEEE1394MTU(1500) */ + ndi->maxmtu = MIN(ETHERMTU, ifp->if_mtu); + break; +#ifdef IFT_IEEE80211 + case IFT_IEEE80211: /* XXX should be IEEE80211MTU(1500) */ + ndi->maxmtu = MIN(ETHERMTU, ifp->if_mtu); + break; +#endif + default: + ndi->maxmtu = ifp->if_mtu; + break; + } + + if (oldmaxmtu != ndi->maxmtu) { + /* + * If the ND level MTU is not set yet, or if the maxmtu + * is reset to a smaller value than the ND level MTU, + * also reset the ND level MTU. + */ + if (ndi->linkmtu == 0 || + ndi->maxmtu < ndi->linkmtu) { + ndi->linkmtu = ndi->maxmtu; + /* also adjust in6_maxmtu if necessary. */ + if (oldlinkmtu == 0) { + /* + * XXX: the case analysis is grotty, but + * it is not efficient to call in6_setmaxmtu() + * here when we are during the initialization + * procedure. + */ + if (in6_maxmtu < ndi->linkmtu) + in6_maxmtu = ndi->linkmtu; + } else + in6_setmaxmtu(); + } + } +#undef MIN +} + +void +nd6_option_init(opt, icmp6len, ndopts) + void *opt; + int icmp6len; + union nd_opts *ndopts; +{ + bzero(ndopts, sizeof(*ndopts)); + ndopts->nd_opts_search = (struct nd_opt_hdr *)opt; + ndopts->nd_opts_last + = (struct nd_opt_hdr *)(((u_char *)opt) + icmp6len); + + if (icmp6len == 0) { + ndopts->nd_opts_done = 1; + ndopts->nd_opts_search = NULL; + } +} + +/* + * Take one ND option. + */ +struct nd_opt_hdr * +nd6_option(ndopts) + union nd_opts *ndopts; +{ + struct nd_opt_hdr *nd_opt; + int olen; + + if (!ndopts) + panic("ndopts == NULL in nd6_option\n"); + if (!ndopts->nd_opts_last) + panic("uninitialized ndopts in nd6_option\n"); + if (!ndopts->nd_opts_search) + return NULL; + if (ndopts->nd_opts_done) + return NULL; + + nd_opt = ndopts->nd_opts_search; + + /* make sure nd_opt_len is inside the buffer */ + if ((caddr_t)&nd_opt->nd_opt_len >= (caddr_t)ndopts->nd_opts_last) { + bzero(ndopts, sizeof(*ndopts)); + return NULL; + } + + olen = nd_opt->nd_opt_len << 3; + if (olen == 0) { + /* + * Message validation requires that all included + * options have a length that is greater than zero. + */ + bzero(ndopts, sizeof(*ndopts)); + return NULL; + } + + ndopts->nd_opts_search = (struct nd_opt_hdr *)((caddr_t)nd_opt + olen); + if (ndopts->nd_opts_search > ndopts->nd_opts_last) { + /* option overruns the end of buffer, invalid */ + bzero(ndopts, sizeof(*ndopts)); + return NULL; + } else if (ndopts->nd_opts_search == ndopts->nd_opts_last) { + /* reached the end of options chain */ + ndopts->nd_opts_done = 1; + ndopts->nd_opts_search = NULL; + } + return nd_opt; +} + +/* + * Parse multiple ND options. + * This function is much easier to use, for ND routines that do not need + * multiple options of the same type. + */ +int +nd6_options(ndopts) + union nd_opts *ndopts; +{ + struct nd_opt_hdr *nd_opt; + int i = 0; + + if (!ndopts) + panic("ndopts == NULL in nd6_options\n"); + if (!ndopts->nd_opts_last) + panic("uninitialized ndopts in nd6_options\n"); + if (!ndopts->nd_opts_search) + return 0; + + while (1) { + nd_opt = nd6_option(ndopts); + if (!nd_opt && !ndopts->nd_opts_last) { + /* + * Message validation requires that all included + * options have a length that is greater than zero. + */ + icmp6stat.icp6s_nd_badopt++; + bzero(ndopts, sizeof(*ndopts)); + return -1; + } + + if (!nd_opt) + goto skip1; + + switch (nd_opt->nd_opt_type) { + case ND_OPT_SOURCE_LINKADDR: + case ND_OPT_TARGET_LINKADDR: + case ND_OPT_MTU: + case ND_OPT_REDIRECTED_HEADER: + case ND_OPT_ADVINTERVAL: + case ND_OPT_SOURCE_ADDRLIST: + case ND_OPT_TARGET_ADDRLIST: + if (ndopts->nd_opt_array[nd_opt->nd_opt_type]) { + nd6log((LOG_INFO, + "duplicated ND6 option found (type=%d)\n", + nd_opt->nd_opt_type)); + /* XXX bark? */ + } else { + ndopts->nd_opt_array[nd_opt->nd_opt_type] + = nd_opt; + } + break; + case ND_OPT_PREFIX_INFORMATION: + if (ndopts->nd_opt_array[nd_opt->nd_opt_type] == 0) { + ndopts->nd_opt_array[nd_opt->nd_opt_type] + = nd_opt; + } + ndopts->nd_opts_pi_end = + (struct nd_opt_prefix_info *)nd_opt; + break; + case ND_OPT_HOMEAGENT_INFO: + break; + default: + /* + * Unknown options must be silently ignored, + * to accomodate future extension to the protocol. + */ + nd6log((LOG_DEBUG, + "nd6_options: unsupported option %d - " + "option ignored\n", nd_opt->nd_opt_type)); + } + +skip1: + i++; + if (i > nd6_maxndopt) { + icmp6stat.icp6s_nd_toomanyopt++; + nd6log((LOG_INFO, "too many loop in nd opt\n")); + break; + } + + if (ndopts->nd_opts_done) + break; + } + + return 0; +} + +/* + * ND6 timer routine to expire default route list and prefix list + */ +void +nd6_timer(ignored_arg) + void *ignored_arg; +{ + int s; + struct llinfo_nd6 *ln; + struct nd_defrouter *dr; + struct nd_prefix *pr; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + struct ifnet *ifp; + struct in6_ifaddr *ia6, *nia6; + struct in6_addrlifetime *lt6; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_reset(&nd6_timer_ch, nd6_prune * hz, + nd6_timer, NULL); +#elif defined(__OpenBSD__) + timeout_set(&nd6_timer_ch, nd6_timer, NULL); + timeout_add(&nd6_timer_ch, nd6_prune * hz); +#else + timeout(nd6_timer, (caddr_t)0, nd6_prune * hz); +#endif + + ln = llinfo_nd6.ln_next; + while (ln && ln != &llinfo_nd6) { + struct rtentry *rt; + struct sockaddr_in6 *dst; + struct llinfo_nd6 *next = ln->ln_next; + /* XXX: used for the DELAY case only: */ + struct nd_ifinfo *ndi = NULL; + + if ((rt = ln->ln_rt) == NULL) { + ln = next; + continue; + } + if ((ifp = rt->rt_ifp) == NULL) { + ln = next; + continue; + } + ndi = &nd_ifinfo[ifp->if_index]; + dst = (struct sockaddr_in6 *)rt_key(rt); + + if (ln->ln_expire > time_second) { + ln = next; + continue; + } + + /* sanity check */ + if (!rt) + panic("rt=0 in nd6_timer(ln=%p)\n", ln); + if (rt->rt_llinfo && (struct llinfo_nd6 *)rt->rt_llinfo != ln) + panic("rt_llinfo(%p) is not equal to ln(%p)\n", + rt->rt_llinfo, ln); + if (!dst) + panic("dst=0 in nd6_timer(ln=%p)\n", ln); + + switch (ln->ln_state) { + case ND6_LLINFO_INCOMPLETE: + if (ln->ln_asked < nd6_mmaxtries) { + ln->ln_asked++; + ln->ln_expire = time_second + + nd_ifinfo[ifp->if_index].retrans / 1000; + nd6_ns_output(ifp, NULL, &dst->sin6_addr, + ln, 0); + } else { + struct mbuf *m = ln->ln_hold; + if (m) { + struct ip6_hdr *ip6_in; + struct sockaddr_in6 sin6_in; + int64_t szoneid, dzoneid; + + /* + * Fake rcvif to make the ICMP error + * more helpful in diagnosing for the + * receiver. + * XXX: should we consider + * older rcvif? + */ + m->m_pkthdr.rcvif = rt->rt_ifp; + + /* + * XXX: for scoped addresses, we should + * disambiguate the zone. We should + * perhaps hang sockaddr_in6 as aux + * data in the mbuf. + */ + ip6_in = mtod(m, struct ip6_hdr *); + szoneid = in6_addr2zoneid(rt->rt_ifp, + &ip6_in->ip6_src); + dzoneid = in6_addr2zoneid(rt->rt_ifp, + &ip6_in->ip6_dst); + if (szoneid < 0 || dzoneid < 0) { + /* impossible... */ + m_freem(m); + } else { + bzero(&sin6_in, + sizeof(sin6_in)); + sin6_in.sin6_addr = ip6_in->ip6_src; + sin6_in.sin6_scope_id = szoneid; + in6_embedscope(&ip6_in->ip6_src, + &sin6_in); + bzero(&sin6_in, + sizeof(sin6_in)); + sin6_in.sin6_addr = ip6_in->ip6_dst; + sin6_in.sin6_scope_id = dzoneid; + in6_embedscope(&ip6_in->ip6_dst, + &sin6_in); + icmp6_error(m, + ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_ADDR, 0); + } + ln->ln_hold = NULL; + } + next = nd6_free(rt, 0); + } + break; + case ND6_LLINFO_REACHABLE: + if (ln->ln_expire) { + ln->ln_state = ND6_LLINFO_STALE; + ln->ln_expire = time_second + nd6_gctimer; + } + break; + + case ND6_LLINFO_STALE: + /* Garbage Collection(RFC 2461 5.3) */ + if (ln->ln_expire) + next = nd6_free(rt, 1); + break; + + case ND6_LLINFO_DELAY: + if (ndi && (ndi->flags & ND6_IFF_PERFORMNUD) != 0) { + /* We need NUD */ + ln->ln_asked = 1; + ln->ln_state = ND6_LLINFO_PROBE; + ln->ln_expire = time_second + + ndi->retrans / 1000; + nd6_ns_output(ifp, &dst->sin6_addr, + &dst->sin6_addr, + ln, 0); + } else { + ln->ln_state = ND6_LLINFO_STALE; /* XXX */ + ln->ln_expire = time_second + nd6_gctimer; + } + break; + case ND6_LLINFO_PROBE: + if (ln->ln_asked < nd6_umaxtries) { + ln->ln_asked++; + ln->ln_expire = time_second + + nd_ifinfo[ifp->if_index].retrans / 1000; + nd6_ns_output(ifp, &dst->sin6_addr, + &dst->sin6_addr, ln, 0); + } else { + next = nd6_free(rt, 0); + } + break; + } + ln = next; + } + + /* expire default router list */ + dr = TAILQ_FIRST(&nd_defrouter); + while (dr) { + if (dr->expire && dr->expire < time_second) { + struct nd_defrouter *t; + t = TAILQ_NEXT(dr, dr_entry); + defrtrlist_del(dr); + dr = t; + } else { + dr = TAILQ_NEXT(dr, dr_entry); + } + } + + /* + * expire interface addresses. + * in the past the loop was inside prefix expiry processing. + * However, from a stricter speci-confrmance standpoint, we should + * rather separate address lifetimes and prefix lifetimes. + */ + addrloop: + for (ia6 = in6_ifaddr; ia6; ia6 = nia6) { + nia6 = ia6->ia_next; + /* check address lifetime */ + lt6 = &ia6->ia6_lifetime; + if (IFA6_IS_INVALID(ia6)) { + int regen = 0; + + /* + * If the expiring address is temporary, try + * regenerating a new one. This would be useful when + * we suspended a laptop PC, then turned it on after a + * period that could invalidate all temporary + * addresses. Although we may have to restart the + * loop (see below), it must be after purging the + * address. Otherwise, we'd see an infinite loop of + * regeneration. + */ + if (ip6_use_tempaddr && + (ia6->ia6_flags & IN6_IFF_TEMPORARY) != 0) { + if (regen_tmpaddr(ia6) == 0) + regen = 1; + } + + in6_purgeaddr(&ia6->ia_ifa); + + if (regen) + goto addrloop; /* XXX: see below */ + } + if (IFA6_IS_DEPRECATED(ia6)) { + int oldflags = ia6->ia6_flags; + + ia6->ia6_flags |= IN6_IFF_DEPRECATED; + + /* + * If a temporary address has just become deprecated, + * regenerate a new one if possible. + */ + if (ip6_use_tempaddr && + (ia6->ia6_flags & IN6_IFF_TEMPORARY) != 0 && + (oldflags & IN6_IFF_DEPRECATED) == 0) { + + if (regen_tmpaddr(ia6) == 0) { + /* + * A new temporary address is + * generated. + * XXX: this means the address chain + * has changed while we are still in + * the loop. Although the change + * would not cause disaster (because + * it's not a deletion, but an + * addition,) we'd rather restart the + * loop just for safety. Or does this + * significantly reduce performance?? + */ + goto addrloop; + } + } + } else { + /* + * A new RA might have made a deprecated address + * preferred. + */ + ia6->ia6_flags &= ~IN6_IFF_DEPRECATED; + } + } + + /* expire prefix list */ + pr = nd_prefix.lh_first; + while (pr) { + /* + * check prefix lifetime. + * since pltime is just for autoconf, pltime processing for + * prefix is not necessary. + */ + if (pr->ndpr_vltime != ND6_INFINITE_LIFETIME && + time_second - pr->ndpr_lastupdate > pr->ndpr_vltime) { + struct nd_prefix *t; + t = pr->ndpr_next; + + /* + * address expiration and prefix expiration are + * separate. NEVER perform in6_purgeaddr here. + */ + + prelist_remove(pr); + pr = t; + } else + pr = pr->ndpr_next; + } + splx(s); +} + +static int +regen_tmpaddr(ia6) + struct in6_ifaddr *ia6; /* deprecated/invalidated temporary address */ +{ + struct ifaddr *ifa; + struct ifnet *ifp; + struct in6_ifaddr *public_ifa6 = NULL; + + ifp = ia6->ia_ifa.ifa_ifp; +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; + ifa = ifa->ifa_list.tqe_next) +#endif + { + struct in6_ifaddr *it6; + + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + + it6 = (struct in6_ifaddr *)ifa; + + /* ignore no autoconf addresses. */ + if ((it6->ia6_flags & IN6_IFF_AUTOCONF) == 0) + continue; + + /* ignore autoconf addresses with different prefixes. */ + if (it6->ia6_ndpr == NULL || it6->ia6_ndpr != ia6->ia6_ndpr) + continue; + + /* + * Now we are looking at an autoconf address with the same + * prefix as ours. If the address is temporary and is still + * preferred, do not create another one. It would be rare, but + * could happen, for example, when we resume a laptop PC after + * a long period. + */ + if ((it6->ia6_flags & IN6_IFF_TEMPORARY) != 0 && + !IFA6_IS_DEPRECATED(it6)) { + public_ifa6 = NULL; + break; + } + + /* + * This is a public autoconf address that has the same prefix + * as ours. If it is preferred, keep it. We can't break the + * loop here, because there may be a still-preferred temporary + * address with the prefix. + */ + if (!IFA6_IS_DEPRECATED(it6)) + public_ifa6 = it6; + } + + if (public_ifa6 != NULL) { + int e; + + if ((e = in6_tmpifadd(public_ifa6, 0)) != 0) { + log(LOG_NOTICE, "regen_tmpaddr: failed to create a new" + " tmp addr,errno=%d\n", e); + return(-1); + } + return(0); + } + + return(-1); +} + +/* + * Nuke neighbor cache/prefix/default router management table, right before + * ifp goes away. + */ +void +nd6_purge(ifp) + struct ifnet *ifp; +{ + struct llinfo_nd6 *ln, *nln; + struct nd_defrouter *dr, *ndr; + struct nd_prefix *pr, *npr; + + /* + * Nuke default router list entries toward ifp. + * We defer removal of default router list entries that is installed + * in the routing table, in order to keep additional side effects as + * small as possible. + */ + for (dr = TAILQ_FIRST(&nd_defrouter); dr; dr = ndr) { + ndr = TAILQ_NEXT(dr, dr_entry); + if (dr->installed) + continue; + + if (dr->ifp == ifp) + defrtrlist_del(dr); + } + for (dr = TAILQ_FIRST(&nd_defrouter); dr; dr = ndr) { + ndr = TAILQ_NEXT(dr, dr_entry); + if (!dr->installed) + continue; + + if (dr->ifp == ifp) + defrtrlist_del(dr); + } + + /* Nuke prefix list entries toward ifp */ + for (pr = nd_prefix.lh_first; pr; pr = npr) { + npr = pr->ndpr_next; + if (pr->ndpr_ifp == ifp) { + /* + * Previously, pr->ndpr_addr is removed as well, + * but I strongly believe we don't have to do it. + * nd6_purge() is only called from in6_ifdetach(), + * which removes all the associated interface addresses + * by itself. + * (jinmei@kame.net 20010129) + */ + prelist_remove(pr); + } + } + + /* cancel default outgoing interface setting */ + if (nd6_defifindex == ifp->if_index) + nd6_setdefaultiface(0); + + if (!ip6_forwarding && ip6_accept_rtadv) { /* XXX: too restrictive? */ + /* refresh default router list */ + defrouter_select(); + } + + /* + * Nuke neighbor cache entries for the ifp. + * Note that rt->rt_ifp may not be the same as ifp, + * due to KAME goto ours hack. See RTM_RESOLVE case in + * nd6_rtrequest(), and ip6_input(). + */ + ln = llinfo_nd6.ln_next; + while (ln && ln != &llinfo_nd6) { + struct rtentry *rt; + struct sockaddr_dl *sdl; + + nln = ln->ln_next; + rt = ln->ln_rt; + if (rt && rt->rt_gateway && + rt->rt_gateway->sa_family == AF_LINK) { + sdl = (struct sockaddr_dl *)rt->rt_gateway; + if (sdl->sdl_index == ifp->if_index) + nln = nd6_free(rt, 0); + } + ln = nln; + } +} + +struct rtentry * +nd6_lookup(addr6, create, ifp) + struct in6_addr *addr6; + int create; + struct ifnet *ifp; +{ + struct rtentry *rt; + struct sockaddr_in6 sin6; +#ifdef SCOPEDROUTING + int64_t zoneid; +#endif + + bzero(&sin6, sizeof(sin6)); + sin6.sin6_len = sizeof(struct sockaddr_in6); + sin6.sin6_family = AF_INET6; + sin6.sin6_addr = *addr6; +#ifdef SCOPEDROUTING + if ((zoneid = in6_addr2zoneid(ifp, addr6)) < 0) + return(NULL); + sin6.sin6_scope_id = zoneid; +#endif + rt = rtalloc1((struct sockaddr *)&sin6, create +#ifdef __FreeBSD__ + , 0UL +#endif /* __FreeBSD__ */ + ); + if (rt && (rt->rt_flags & RTF_LLINFO) == 0) { + /* + * This is the case for the default route. + * If we want to create a neighbor cache for the address, we + * should free the route for the destination and allocate an + * interface route. + */ + if (create) { + RTFREE(rt); + rt = 0; + } + } + if (!rt) { + if (create && ifp) { + int e; + + /* + * If no route is available and create is set, + * we allocate a host route for the destination + * and treat it like an interface route. + * This hack is necessary for a neighbor which can't + * be covered by our own prefix. + */ + struct ifaddr *ifa = + ifaof_ifpforaddr((struct sockaddr *)&sin6, ifp); + if (ifa == NULL) + return(NULL); + + /* + * Create a new route. RTF_LLINFO is necessary + * to create a Neighbor Cache entry for the + * destination in nd6_rtrequest which will be + * called in rtrequest via ifa->ifa_rtrequest. + */ + if ((e = rtrequest(RTM_ADD, (struct sockaddr *)&sin6, + ifa->ifa_addr, + (struct sockaddr *)&all1_sa, + (ifa->ifa_flags | + RTF_HOST | RTF_LLINFO) & + ~RTF_CLONING, + &rt)) != 0) { +#if 0 + log(LOG_ERR, + "nd6_lookup: failed to add route for a " + "neighbor(%s), errno=%d\n", + ip6_sprintf(addr6), e); +#endif + return(NULL); + } + if (rt == NULL) + return(NULL); + if (rt->rt_llinfo) { + struct llinfo_nd6 *ln = + (struct llinfo_nd6 *)rt->rt_llinfo; + ln->ln_state = ND6_LLINFO_NOSTATE; + } + } else + return(NULL); + } + rt->rt_refcnt--; + /* + * Validation for the entry. + * XXX: we can't use rt->rt_ifp to check for the interface, since + * it might be the loopback interface if the entry is for our + * own address on a non-loopback interface. Instead, we should + * use rt->rt_ifa->ifa_ifp, which would specify the REAL interface. + */ + if ((rt->rt_flags & RTF_GATEWAY) || (rt->rt_flags & RTF_LLINFO) == 0 || + rt->rt_gateway->sa_family != AF_LINK || + (ifp && rt->rt_ifa->ifa_ifp != ifp)) { + if (create) { + log(LOG_DEBUG, "nd6_lookup: failed to lookup %s (if = %s)\n", + ip6_sprintf(addr6), ifp ? if_name(ifp) : "unspec"); + } + return(0); + } + return(rt); +} + +/* + * Detect if a given IPv6 address identifies a neighbor on a given link. + * XXX: should take care of the destination of a p2p link? + */ +int +nd6_is_addr_neighbor(addr, ifp) + struct sockaddr_in6 *addr; + struct ifnet *ifp; +{ + struct nd_prefix *pr; + struct rtentry *rt; + int i; + +#define IFADDR6(a) ((((struct in6_ifaddr *)(a))->ia_addr).sin6_addr) +#define IFMASK6(a) ((((struct in6_ifaddr *)(a))->ia_prefixmask).sin6_addr) + + /* + * A link-local address is always a neighbor. + * XXX: we should use the sin6_scope_id field rather than the embedded + * interface index. + * XXX: a link does not necessarily specify a single interface. + */ + if (IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr) && + ntohs(*(u_int16_t *)&addr->sin6_addr.s6_addr[2]) == ifp->if_index) + return(1); + + /* + * If the address matches one of our on-link prefixes, it should be a + * neighbor. + */ + for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + + if (pr->ndpr_ifp != ifp) + continue; + + if (!(pr->ndpr_stateflags & NDPRF_ONLINK)) + continue; + + for (i = 0; i < 4; i++) { + if ((pr->ndpr_mask.s6_addr32[i] & + addr->sin6_addr.s6_addr32[i]) != + pr->ndpr_prefix.sin6_addr.s6_addr32[i]) + break; + } + if (i == 4) /* full match */ + return(1); + } + + /* + * If the default router list is empty, all addresses are regarded + * as on-link, and thus, as a neighbor. + * XXX: we restrict the condition to hosts, because routers usually do + * not have the "default router list". + */ + if (!ip6_forwarding && TAILQ_FIRST(&nd_defrouter) == NULL && + nd6_defifindex == ifp->if_index) { + return(1); + } + + /* + * Even if the address matches none of our addresses, it might be + * in the neighbor cache. + */ + if ((rt = nd6_lookup(&addr->sin6_addr, 0, ifp)) != NULL && + rt->rt_llinfo != NULL) + return(1); + + return(0); +#undef IFADDR6 +#undef IFMASK6 +} + +/* + * Free an nd6 llinfo entry. + * Since the function would cause significant changes in the kernel, DO NOT + * make it global, unless you have a strong reason for the change, and are sure + * that the change is safe. + */ +static struct llinfo_nd6 * +nd6_free(rt, gc) + struct rtentry *rt; + int gc; +{ + struct llinfo_nd6 *ln = (struct llinfo_nd6 *)rt->rt_llinfo, *next; + struct in6_addr in6 = ((struct sockaddr_in6 *)rt_key(rt))->sin6_addr; + struct nd_defrouter *dr; + + /* + * we used to have pfctlinput(PRC_HOSTDEAD) here. + * even though it is not harmful, it was not really necessary. + */ + + if (!ip6_forwarding && ip6_accept_rtadv) { /* XXX: too restrictive? */ + int s; +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + dr = defrouter_lookup(&((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, + rt->rt_ifp); + + if (dr != NULL && dr->expire && + ln->ln_state == ND6_LLINFO_STALE && gc) { + /* + * If the reason for the deletion is just garbage + * collection, and the neighbor is an active default + * router, do not delete it. Instead, reset the GC + * timer using the router's lifetime. + * Simply deleting the entry would affect default + * router selection, which is not necessarily a good + * thing, especially when we're using router preference + * values. + * XXX: the check for ln_state would be redundant, + * but we intentionally keep it just in case. + */ + ln->ln_expire = dr->expire; + splx(s); + return(ln->ln_next); + } + + if (ln->ln_router || dr) { + /* + * rt6_flush must be called whether or not the neighbor + * is in the Default Router List. + * See a corresponding comment in nd6_na_input(). + */ + rt6_flush(&in6, rt->rt_ifp); + } + + if (dr) { + /* + * Unreachablity of a router might affect the default + * router selection and on-link detection of advertised + * prefixes. + */ + + /* + * Temporarily fake the state to choose a new default + * router and to perform on-link determination of + * prefixes correctly. + * Below the state will be set correctly, + * or the entry itself will be deleted. + */ + ln->ln_state = ND6_LLINFO_INCOMPLETE; + + /* + * Since defrouter_select() does not affect the + * on-link determination and MIP6 needs the check + * before the default router selection, we perform + * the check now. + */ + pfxlist_onlink_check(); + + /* + * refresh default router list + */ + defrouter_select(); + } + splx(s); + } + + /* + * Before deleting the entry, remember the next entry as the + * return value. We need this because pfxlist_onlink_check() above + * might have freed other entries (particularly the old next entry) as + * a side effect (XXX). + */ + next = ln->ln_next; + + /* + * Detach the route from the routing tree and the list of neighbor + * caches, and disable the route entry not to be used in already + * cached routes. + */ + rtrequest(RTM_DELETE, rt_key(rt), (struct sockaddr *)0, + rt_mask(rt), 0, (struct rtentry **)0); + + return(next); +} + +/* + * Upper-layer reachability hint for Neighbor Unreachability Detection. + * + * XXX cost-effective metods? + */ +void +nd6_nud_hint(rt, dst6, force) + struct rtentry *rt; + struct in6_addr *dst6; + int force; +{ + struct llinfo_nd6 *ln; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + + /* + * If the caller specified "rt", use that. Otherwise, resolve the + * routing table by supplied "dst6". + */ + if (!rt) { + if (!dst6) + return; + if (!(rt = nd6_lookup(dst6, 0, NULL))) + return; + } + + if ((rt->rt_flags & RTF_GATEWAY) != 0 || + (rt->rt_flags & RTF_LLINFO) == 0 || + !rt->rt_llinfo || !rt->rt_gateway || + rt->rt_gateway->sa_family != AF_LINK) { + /* This is not a host route. */ + return; + } + + ln = (struct llinfo_nd6 *)rt->rt_llinfo; + if (ln->ln_state < ND6_LLINFO_REACHABLE) + return; + + /* + * if we get upper-layer reachability confirmation many times, + * it is possible we have false information. + */ + if (!force) { + ln->ln_byhint++; + if (ln->ln_byhint > nd6_maxnudhint) + return; + } + + ln->ln_state = ND6_LLINFO_REACHABLE; + if (ln->ln_expire) + ln->ln_expire = time_second + + nd_ifinfo[rt->rt_ifp->if_index].reachable; +} + +void +#if (defined(__bsdi__) && _BSDI_VERSION >= 199802) || defined(__NetBSD__) || defined(__OpenBSD__) +nd6_rtrequest(req, rt, info) + int req; + struct rtentry *rt; + struct rt_addrinfo *info; /* xxx unused */ +#else +nd6_rtrequest(req, rt, sa) + int req; + struct rtentry *rt; + struct sockaddr *sa; /* xxx unused */ +#endif +{ + struct sockaddr *gate = rt->rt_gateway; + struct llinfo_nd6 *ln = (struct llinfo_nd6 *)rt->rt_llinfo; + static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; + struct ifnet *ifp = rt->rt_ifp; + struct ifaddr *ifa; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + + if ((rt->rt_flags & RTF_GATEWAY)) + return; + + if (nd6_need_cache(ifp) == 0 && (rt->rt_flags & RTF_HOST) == 0) { + /* + * This is probably an interface direct route for a link + * which does not need neighbor caches (e.g. fe80::%lo0/64). + * We do not need special treatment below for such a route. + * Moreover, the RTF_LLINFO flag which would be set below + * would annoy the ndp(8) command. + */ + return; + } + + if (req == RTM_RESOLVE && + !nd6_is_addr_neighbor((struct sockaddr_in6 *)rt_key(rt), ifp)) { + /* + * FreeBSD and BSD/OS often make a cloned host route based + * on a less-specific route (e.g. the default route). + * If the less specific route does not have a "gateway" + * (this is the case when the route just goes to a p2p + * interface), we'll mistakenly make a neighbor cache for + * the host route, and will see strange neighbor solicitation + * for the corresponding destination. In order to avoid the + * confusion, we check if the destination of the route is + * a neighbor in terms of neighbor discovery, and stop the + * process if not. Additionally, we remove the LLINFO flag + * so that ndp(8) will not try to get the neighbor information + * of the destination. + */ + rt->rt_flags &= ~RTF_LLINFO; + return; + } + + switch (req) { + case RTM_ADD: + /* + * There is no backward compatibility :) + * + * if ((rt->rt_flags & RTF_HOST) == 0 && + * SIN(rt_mask(rt))->sin_addr.s_addr != 0xffffffff) + * rt->rt_flags |= RTF_CLONING; + */ + if (rt->rt_flags & (RTF_CLONING | RTF_LLINFO)) { + /* + * Case 1: This route should come from + * a route to interface. RTF_LLINFO flag is set + * for a host route whose destination should be + * treated as on-link. + */ + rt_setgate(rt, rt_key(rt), + (struct sockaddr *)&null_sdl); + gate = rt->rt_gateway; + SDL(gate)->sdl_type = ifp->if_type; + SDL(gate)->sdl_index = ifp->if_index; + if (ln) + ln->ln_expire = time_second; +#if 1 + if (ln && ln->ln_expire == 0) { + /* kludge for desktops */ +#if 0 + printf("nd6_rtequest: time.tv_sec is zero; " + "treat it as 1\n"); +#endif + ln->ln_expire = 1; + } +#endif + if ((rt->rt_flags & RTF_CLONING)) + break; + } + /* + * In IPv4 code, we try to annonuce new RTF_ANNOUNCE entry here. + * We don't do that here since llinfo is not ready yet. + * + * There are also couple of other things to be discussed: + * - unsolicited NA code needs improvement beforehand + * - RFC2461 says we MAY send multicast unsolicited NA + * (7.2.6 paragraph 4), however, it also says that we + * SHOULD provide a mechanism to prevent multicast NA storm. + * we don't have anything like it right now. + * note that the mechanism needs a mutual agreement + * between proxies, which means that we need to implement + * a new protocol, or a new kludge. + * - from RFC2461 6.2.4, host MUST NOT send an unsolicited NA. + * we need to check ip6forwarding before sending it. + * (or should we allow proxy ND configuration only for + * routers? there's no mention about proxy ND from hosts) + */ +#if 0 + /* XXX it does not work */ + if (rt->rt_flags & RTF_ANNOUNCE) + nd6_na_output(ifp, + &SIN6(rt_key(rt))->sin6_addr, + &SIN6(rt_key(rt))->sin6_addr, + ip6_forwarding ? ND_NA_FLAG_ROUTER : 0, + 1, NULL); +#endif + /* FALLTHROUGH */ + case RTM_RESOLVE: + if ((ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) == 0) { + /* + * Address resolution isn't necessary for a point to + * point link, so we can skip this test for a p2p link. + */ + if (gate->sa_family != AF_LINK || + gate->sa_len < sizeof(null_sdl)) { + log(LOG_DEBUG, + "nd6_rtrequest: bad gateway value: %s\n", + if_name(ifp)); + break; + } + SDL(gate)->sdl_type = ifp->if_type; + SDL(gate)->sdl_index = ifp->if_index; + } + if (ln != NULL) + break; /* This happens on a route change */ + /* + * Case 2: This route may come from cloning, or a manual route + * add with a LL address. + */ + R_Malloc(ln, struct llinfo_nd6 *, sizeof(*ln)); + rt->rt_llinfo = (caddr_t)ln; + if (!ln) { + log(LOG_DEBUG, "nd6_rtrequest: malloc failed\n"); + break; + } + nd6_inuse++; + nd6_allocated++; + Bzero(ln, sizeof(*ln)); + ln->ln_rt = rt; + /* this is required for "ndp" command. - shin */ + if (req == RTM_ADD) { + /* + * gate should have some valid AF_LINK entry, + * and ln->ln_expire should have some lifetime + * which is specified by ndp command. + */ + ln->ln_state = ND6_LLINFO_REACHABLE; + ln->ln_byhint = 0; + } else { + /* + * When req == RTM_RESOLVE, rt is created and + * initialized in rtrequest(), so rt_expire is 0. + */ + ln->ln_state = ND6_LLINFO_NOSTATE; + ln->ln_expire = time_second; + } + rt->rt_flags |= RTF_LLINFO; + ln->ln_next = llinfo_nd6.ln_next; + llinfo_nd6.ln_next = ln; + ln->ln_prev = &llinfo_nd6; + ln->ln_next->ln_prev = ln; + + /* + * check if rt_key(rt) is one of my address assigned + * to the interface. + */ + ifa = (struct ifaddr *)in6ifa_ifpwithaddr(rt->rt_ifp, + &SIN6(rt_key(rt))->sin6_addr); + if (ifa) { + caddr_t macp = nd6_ifptomac(ifp); + ln->ln_expire = 0; + ln->ln_state = ND6_LLINFO_REACHABLE; + ln->ln_byhint = 0; + if (macp) { + Bcopy(macp, LLADDR(SDL(gate)), ifp->if_addrlen); + SDL(gate)->sdl_alen = ifp->if_addrlen; + } + if (nd6_useloopback) { +#ifdef __bsdi__ +#if _BSDI_VERSION >= 199802 + extern struct ifnet *loifp; + rt->rt_ifp = loifp; /* XXX */ +#else + extern struct ifnet loif; + rt->rt_ifp = &loif; /* XXX */ +#endif +#elif defined(__OpenBSD__) + rt->rt_ifp = lo0ifp; /* XXX */ +#else + rt->rt_ifp = &loif[0]; /* XXX */ +#endif + /* + * Make sure rt_ifa be equal to the ifaddr + * corresponding to the address. + * We need this because when we refer + * rt_ifa->ia6_flags in ip6_input, we assume + * that the rt_ifa points to the address instead + * of the loopback address. + */ + if (ifa != rt->rt_ifa) { + IFAFREE(rt->rt_ifa); + IFAREF(ifa); + rt->rt_ifa = ifa; + } + } + } else if (rt->rt_flags & RTF_ANNOUNCE) { + ln->ln_expire = 0; + ln->ln_state = ND6_LLINFO_REACHABLE; + ln->ln_byhint = 0; + + /* join solicited node multicast for proxy ND */ + if (ifp->if_flags & IFF_MULTICAST) { + struct in6_addr llsol; + int error; + + llsol = SIN6(rt_key(rt))->sin6_addr; + llsol.s6_addr16[0] = htons(0xff02); + llsol.s6_addr16[1] = htons(ifp->if_index); + llsol.s6_addr32[1] = 0; + llsol.s6_addr32[2] = htonl(1); + llsol.s6_addr8[12] = 0xff; + + if (!in6_addmulti(&llsol, ifp, &error)) { + nd6log((LOG_ERR, "%s: failed to join " + "%s (errno=%d)\n", if_name(ifp), + ip6_sprintf(&llsol), error)); + } + } + } + break; + + case RTM_DELETE: + if (!ln) + break; + /* leave from solicited node multicast for proxy ND */ + if ((rt->rt_flags & RTF_ANNOUNCE) != 0 && + (ifp->if_flags & IFF_MULTICAST) != 0) { + struct in6_addr llsol; + struct in6_multi *in6m; + + llsol = SIN6(rt_key(rt))->sin6_addr; + llsol.s6_addr16[0] = htons(0xff02); + llsol.s6_addr16[1] = htons(ifp->if_index); + llsol.s6_addr32[1] = 0; + llsol.s6_addr32[2] = htonl(1); + llsol.s6_addr8[12] = 0xff; + + IN6_LOOKUP_MULTI(llsol, ifp, in6m); + if (in6m) + in6_delmulti(in6m); + } + nd6_inuse--; + ln->ln_next->ln_prev = ln->ln_prev; + ln->ln_prev->ln_next = ln->ln_next; + ln->ln_prev = NULL; + rt->rt_llinfo = 0; + rt->rt_flags &= ~RTF_LLINFO; + if (ln->ln_hold) + m_freem(ln->ln_hold); + Free((caddr_t)ln); + } +} + +int +nd6_ioctl(cmd, data, ifp) + u_long cmd; + caddr_t data; + struct ifnet *ifp; +{ + struct in6_drlist *drl = (struct in6_drlist *)data; + struct in6_oprlist *oprl = (struct in6_oprlist *)data; + struct in6_ndireq *ndi = (struct in6_ndireq *)data; + struct in6_nbrinfo *nbi = (struct in6_nbrinfo *)data; + struct in6_ndifreq *ndif = (struct in6_ndifreq *)data; + struct nd_defrouter *dr; + struct nd_prefix *pr; + struct rtentry *rt; + int i = 0, error = 0; + int s; + + switch (cmd) { + case SIOCGDRLST_IN6: + /* + * obsolete API, use sysctl under net.inet6.icmp6 + */ + bzero(drl, sizeof(*drl)); +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + dr = TAILQ_FIRST(&nd_defrouter); + while (dr && i < DRLSTSIZ) { + drl->defrouter[i].rtaddr = dr->rtaddr; + if (IN6_IS_ADDR_LINKLOCAL(&drl->defrouter[i].rtaddr)) { + /* XXX: need to this hack for KAME stack */ + drl->defrouter[i].rtaddr.s6_addr16[1] = 0; + } else + log(LOG_ERR, + "default router list contains a " + "non-linklocal address(%s)\n", + ip6_sprintf(&drl->defrouter[i].rtaddr)); + + drl->defrouter[i].flags = dr->flags; + drl->defrouter[i].rtlifetime = dr->rtlifetime; + drl->defrouter[i].expire = dr->expire; + drl->defrouter[i].if_index = dr->ifp->if_index; + i++; + dr = TAILQ_NEXT(dr, dr_entry); + } + splx(s); + break; + case SIOCGPRLST_IN6: + /* + * obsolete API, use sysctl under net.inet6.icmp6 + * + * XXX the structure in6_prlist was changed in backward- + * incompatible manner. in6_oprlist is used for SIOCGPRLST_IN6, + * in6_prlist is used for nd6_sysctl() - fill_prlist(). + */ + /* + * XXX meaning of fields, especialy "raflags", is very + * differnet between RA prefix list and RR/static prefix list. + * how about separating ioctls into two? + */ + bzero(oprl, sizeof(*oprl)); +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + pr = nd_prefix.lh_first; + while (pr && i < PRLSTSIZ) { + struct nd_pfxrouter *pfr; + int j; + + (void)in6_embedscope(&oprl->prefix[i].prefix, + &pr->ndpr_prefix); + oprl->prefix[i].raflags = pr->ndpr_raf; + oprl->prefix[i].prefixlen = pr->ndpr_plen; + oprl->prefix[i].vltime = pr->ndpr_vltime; + oprl->prefix[i].pltime = pr->ndpr_pltime; + oprl->prefix[i].if_index = pr->ndpr_ifp->if_index; + if (pr->ndpr_vltime == ND6_INFINITE_LIFETIME) + oprl->prefix[i].expire = 0; + else { + time_t maxexpire; + + /* XXX: we assume time_t is signed. */ + maxexpire = (-1) & + ~(1 << ((sizeof(maxexpire) * 8) - 1)); + if (pr->ndpr_vltime < + maxexpire - pr->ndpr_lastupdate) { + oprl->prefix[i].expire = + pr->ndpr_lastupdate + + pr->ndpr_vltime; + } else + oprl->prefix[i].expire = maxexpire; + } + pfr = pr->ndpr_advrtrs.lh_first; + j = 0; + while (pfr) { + if (j < DRLSTSIZ) { +#define RTRADDR oprl->prefix[i].advrtr[j] + RTRADDR = pfr->router->rtaddr; + if (IN6_IS_ADDR_LINKLOCAL(&RTRADDR)) { + /* XXX: hack for KAME */ + RTRADDR.s6_addr16[1] = 0; + } else + log(LOG_ERR, + "a router(%s) advertises " + "a prefix with " + "non-link local address\n", + ip6_sprintf(&RTRADDR)); +#undef RTRADDR + } + j++; + pfr = pfr->pfr_next; + } + oprl->prefix[i].advrtrs = j; + oprl->prefix[i].origin = PR_ORIG_RA; + + i++; + pr = pr->ndpr_next; + } + splx(s); + + break; + case OSIOCGIFINFO_IN6: + if (!nd_ifinfo || i >= nd_ifinfo_indexlim) { + error = EINVAL; + break; + } + ndi->ndi.linkmtu = nd_ifinfo[ifp->if_index].linkmtu; + ndi->ndi.maxmtu = nd_ifinfo[ifp->if_index].maxmtu; + ndi->ndi.basereachable = + nd_ifinfo[ifp->if_index].basereachable; + ndi->ndi.reachable = nd_ifinfo[ifp->if_index].reachable; + ndi->ndi.retrans = nd_ifinfo[ifp->if_index].retrans; + ndi->ndi.flags = nd_ifinfo[ifp->if_index].flags; + ndi->ndi.recalctm = nd_ifinfo[ifp->if_index].recalctm; + ndi->ndi.chlim = nd_ifinfo[ifp->if_index].chlim; + ndi->ndi.receivedra = nd_ifinfo[ifp->if_index].receivedra; + break; + case SIOCGIFINFO_IN6: + if (!nd_ifinfo || i >= nd_ifinfo_indexlim) { + error = EINVAL; + break; + } + ndi->ndi = nd_ifinfo[ifp->if_index]; + break; + case SIOCSIFINFO_FLAGS: + /* XXX: almost all other fields of ndi->ndi is unused */ + if (!nd_ifinfo || i >= nd_ifinfo_indexlim) { + error = EINVAL; + break; + } + nd_ifinfo[ifp->if_index].flags = ndi->ndi.flags; + break; + case SIOCSNDFLUSH_IN6: /* XXX: the ioctl name is confusing... */ + /* sync kernel routing table with the default router list */ + defrouter_reset(); + defrouter_select(); + break; + case SIOCSPFXFLUSH_IN6: + { + /* flush all the prefix advertised by routers */ + struct nd_prefix *pr, *next; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + for (pr = nd_prefix.lh_first; pr; pr = next) { + struct in6_ifaddr *ia, *ia_next; + + next = pr->ndpr_next; + + if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr)) + continue; /* XXX */ + + /* do we really have to remove addresses as well? */ + for (ia = in6_ifaddr; ia; ia = ia_next) { + /* ia might be removed. keep the next ptr. */ + ia_next = ia->ia_next; + + if ((ia->ia6_flags & IN6_IFF_AUTOCONF) == 0) + continue; + + if (ia->ia6_ndpr == pr) + in6_purgeaddr(&ia->ia_ifa); + } + prelist_remove(pr); + } + splx(s); + break; + } + case SIOCSRTRFLUSH_IN6: + { + /* flush all the default routers */ + struct nd_defrouter *dr, *next; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + defrouter_reset(); + for (dr = TAILQ_FIRST(&nd_defrouter); dr; dr = next) { + next = TAILQ_NEXT(dr, dr_entry); + defrtrlist_del(dr); + } + defrouter_select(); + splx(s); + break; + } + case SIOCGNBRINFO_IN6: + { + struct llinfo_nd6 *ln; + struct in6_addr nb_addr = nbi->addr; /* make local for safety */ + + /* + * XXX: KAME specific hack for scoped addresses + * XXXX: for other scopes than link-local? + */ + if (IN6_IS_ADDR_LINKLOCAL(&nbi->addr) || + IN6_IS_ADDR_MC_LINKLOCAL(&nbi->addr)) { + u_int16_t *idp = (u_int16_t *)&nb_addr.s6_addr[2]; + + if (*idp == 0) + *idp = htons(ifp->if_index); + } + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + if ((rt = nd6_lookup(&nb_addr, 0, ifp)) == NULL || + (ln = (struct llinfo_nd6 *)rt->rt_llinfo) == NULL) { + error = EINVAL; + splx(s); + break; + } + nbi->state = ln->ln_state; + nbi->asked = ln->ln_asked; + nbi->isrouter = ln->ln_router; + nbi->expire = ln->ln_expire; + splx(s); + + break; + } + case SIOCGDEFIFACE_IN6: /* XXX: should be implemented as a sysctl? */ + ndif->ifindex = nd6_defifindex; + break; + case SIOCSDEFIFACE_IN6: /* XXX: should be implemented as a sysctl? */ + return(nd6_setdefaultiface(ndif->ifindex)); + break; + } + return(error); +} + +/* + * Create neighbor cache entry and cache link-layer address, + * on reception of inbound ND6 packets. (RS/RA/NS/redirect) + */ +struct rtentry * +nd6_cache_lladdr(ifp, from, lladdr, lladdrlen, type, code) + struct ifnet *ifp; + struct in6_addr *from; + char *lladdr; + int lladdrlen; + int type; /* ICMP6 type */ + int code; /* type dependent information */ +{ + struct rtentry *rt = NULL; + struct llinfo_nd6 *ln = NULL; + int is_newentry; + struct sockaddr_dl *sdl = NULL; + int do_update; + int olladdr; + int llchange; + int newstate = 0; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + + if (!ifp) + panic("ifp == NULL in nd6_cache_lladdr"); + if (!from) + panic("from == NULL in nd6_cache_lladdr"); + + /* nothing must be updated for unspecified address */ + if (IN6_IS_ADDR_UNSPECIFIED(from)) + return NULL; + + /* + * Validation about ifp->if_addrlen and lladdrlen must be done in + * the caller. + * + * XXX If the link does not have link-layer adderss, what should + * we do? (ifp->if_addrlen == 0) + * Spec says nothing in sections for RA, RS and NA. There's small + * description on it in NS section (RFC 2461 7.2.3). + */ + + rt = nd6_lookup(from, 0, ifp); + if (!rt) { +#if 0 + /* nothing must be done if there's no lladdr */ + if (!lladdr || !lladdrlen) + return NULL; +#endif + + rt = nd6_lookup(from, 1, ifp); + is_newentry = 1; + } else { + /* do nothing if static ndp is set */ + if (rt->rt_flags & RTF_STATIC) + return NULL; + is_newentry = 0; + } + + if (!rt) + return NULL; + if ((rt->rt_flags & (RTF_GATEWAY | RTF_LLINFO)) != RTF_LLINFO) { +fail: + (void)nd6_free(rt, 0); + return NULL; + } + ln = (struct llinfo_nd6 *)rt->rt_llinfo; + if (!ln) + goto fail; + if (!rt->rt_gateway) + goto fail; + if (rt->rt_gateway->sa_family != AF_LINK) + goto fail; + sdl = SDL(rt->rt_gateway); + + olladdr = (sdl->sdl_alen) ? 1 : 0; + if (olladdr && lladdr) { + if (bcmp(lladdr, LLADDR(sdl), ifp->if_addrlen)) + llchange = 1; + else + llchange = 0; + } else + llchange = 0; + + /* + * newentry olladdr lladdr llchange (*=record) + * 0 n n -- (1) + * 0 y n -- (2) + * 0 n y -- (3) * STALE + * 0 y y n (4) * + * 0 y y y (5) * STALE + * 1 -- n -- (6) NOSTATE(= PASSIVE) + * 1 -- y -- (7) * STALE + */ + + if (lladdr) { /* (3-5) and (7) */ + /* + * Record source link-layer address + * XXX is it dependent to ifp->if_type? + */ + sdl->sdl_alen = ifp->if_addrlen; + bcopy(lladdr, LLADDR(sdl), ifp->if_addrlen); + } + + if (!is_newentry) { + if ((!olladdr && lladdr) /* (3) */ + || (olladdr && lladdr && llchange)) { /* (5) */ + do_update = 1; + newstate = ND6_LLINFO_STALE; + } else /* (1-2,4) */ + do_update = 0; + } else { + do_update = 1; + if (!lladdr) /* (6) */ + newstate = ND6_LLINFO_NOSTATE; + else /* (7) */ + newstate = ND6_LLINFO_STALE; + } + + if (do_update) { + /* + * Update the state of the neighbor cache. + */ + ln->ln_state = newstate; + + if (ln->ln_state == ND6_LLINFO_STALE) { + /* + * XXX: since nd6_output() below will cause + * state tansition to DELAY and reset the timer, + * we must set the timer now, although it is actually + * meaningless. + */ + ln->ln_expire = time_second + nd6_gctimer; + + if (ln->ln_hold) { + /* + * we assume ifp is not a p2p here, so just + * set the 2nd argument as the 1st one. + */ + nd6_output(ifp, ifp, ln->ln_hold, + (struct sockaddr_in6 *)rt_key(rt), + rt); + ln->ln_hold = NULL; + } + } else if (ln->ln_state == ND6_LLINFO_INCOMPLETE) { + /* probe right away */ + ln->ln_expire = time_second; + } + } + + /* + * ICMP6 type dependent behavior. + * + * NS: clear IsRouter if new entry + * RS: clear IsRouter + * RA: set IsRouter if there's lladdr + * redir: clear IsRouter if new entry + * + * RA case, (1): + * The spec says that we must set IsRouter in the following cases: + * - If lladdr exist, set IsRouter. This means (1-5). + * - If it is old entry (!newentry), set IsRouter. This means (7). + * So, based on the spec, in (1-5) and (7) cases we must set IsRouter. + * A quetion arises for (1) case. (1) case has no lladdr in the + * neighbor cache, this is similar to (6). + * This case is rare but we figured that we MUST NOT set IsRouter. + * + * newentry olladdr lladdr llchange NS RS RA redir + * D R + * 0 n n -- (1) c ? s + * 0 y n -- (2) c s s + * 0 n y -- (3) c s s + * 0 y y n (4) c s s + * 0 y y y (5) c s s + * 1 -- n -- (6) c c c s + * 1 -- y -- (7) c c s c s + * + * (c=clear s=set) + */ + switch (type & 0xff) { + case ND_NEIGHBOR_SOLICIT: + /* + * New entry must have is_router flag cleared. + */ + if (is_newentry) /* (6-7) */ + ln->ln_router = 0; + break; + case ND_REDIRECT: + /* + * If the icmp is a redirect to a better router, always set the + * is_router flag. Otherwise, if the entry is newly created, + * clear the flag. [RFC 2461, sec 8.3] + */ + if (code == ND_REDIRECT_ROUTER) + ln->ln_router = 1; + else if (is_newentry) /* (6-7) */ + ln->ln_router = 0; + break; + case ND_ROUTER_SOLICIT: + /* + * is_router flag must always be cleared. + */ + ln->ln_router = 0; + break; + case ND_ROUTER_ADVERT: + /* + * Mark an entry with lladdr as a router. + */ + if ((!is_newentry && (olladdr || lladdr)) /* (2-5) */ + || (is_newentry && lladdr)) { /* (7) */ + ln->ln_router = 1; + } + break; + } + + /* + * When the link-layer address of a router changes, select the + * best router again. In particular, when the neighbor entry is newly + * created, it might affect the selection policy. + * Question: can we restrict the first condition to the "is_newentry" + * case? + * XXX: when we hear an RA from a new router with the link-layer + * address option, defrouter_select() is called twice, since + * defrtrlist_update called the function as well. However, I believe + * we can compromise the overhead, since it only happens the first + * time. + * XXX: although defrouter_select() should not have a bad effect + * for those are not autoconfigured hosts, we explicitly avoid such + * cases for safety. + */ + if (do_update && ln->ln_router && !ip6_forwarding && ip6_accept_rtadv) + defrouter_select(); + + return rt; +} + +static void +nd6_slowtimo(ignored_arg) + void *ignored_arg; +{ +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + int i; + struct nd_ifinfo *nd6if; + +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_reset(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz, + nd6_slowtimo, NULL); +#elif defined(__OpenBSD__) + timeout_set(&nd6_slowtimo_ch, nd6_slowtimo, NULL); + timeout_add(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz); +#else + timeout(nd6_slowtimo, (caddr_t)0, ND6_SLOWTIMER_INTERVAL * hz); +#endif + for (i = 1; i < if_index + 1; i++) { + if (!nd_ifinfo || i >= nd_ifinfo_indexlim) + continue; + nd6if = &nd_ifinfo[i]; + if (nd6if->basereachable && /* already initialized */ + (nd6if->recalctm -= ND6_SLOWTIMER_INTERVAL) <= 0) { + /* + * Since reachable time rarely changes by router + * advertisements, we SHOULD insure that a new random + * value gets recomputed at least once every few hours. + * (RFC 2461, 6.3.4) + */ + nd6if->recalctm = nd6_recalc_reachtm_interval; + nd6if->reachable = ND_COMPUTE_RTIME(nd6if->basereachable); + } + } + splx(s); +} + +#define senderr(e) { error = (e); goto bad;} +int +nd6_output(ifp, origifp, m0, dst, rt0) + struct ifnet *ifp; + struct ifnet *origifp; + struct mbuf *m0; + struct sockaddr_in6 *dst; + struct rtentry *rt0; +{ + struct mbuf *m = m0; + struct rtentry *rt = rt0; + struct sockaddr_in6 *gw6 = NULL; + struct llinfo_nd6 *ln = NULL; + int error = 0; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif +#if defined(__OpenBSD__) && defined(IPSEC) + struct m_tag *mtag; +#endif /* IPSEC */ + + if (IN6_IS_ADDR_MULTICAST(&dst->sin6_addr)) + goto sendpkt; + + if (nd6_need_cache(ifp) == 0) + goto sendpkt; + + /* + * next hop determination. This routine is derived from ether_outpout. + */ + if (rt) { + if ((rt->rt_flags & RTF_UP) == 0) { +#ifdef __FreeBSD__ + if ((rt0 = rt = rtalloc1((struct sockaddr *)dst, 1, 0UL)) != + NULL) +#else + if ((rt0 = rt = rtalloc1((struct sockaddr *)dst, 1)) != + NULL) +#endif + { + rt->rt_refcnt--; + if (rt->rt_ifp != ifp) { + /* XXX: loop care? */ + return nd6_output(ifp, origifp, m0, + dst, rt); + } + } else + senderr(EHOSTUNREACH); + } + + if (rt->rt_flags & RTF_GATEWAY) { + gw6 = (struct sockaddr_in6 *)rt->rt_gateway; + + /* + * We skip link-layer address resolution and NUD + * if the gateway is not a neighbor from ND point + * of view, regardless of the value of nd_ifinfo.flags. + * The second condition is a bit tricky; we skip + * if the gateway is our own address, which is + * sometimes used to install a route to a p2p link. + */ + if (!nd6_is_addr_neighbor(gw6, ifp) || + in6ifa_ifpwithaddr(ifp, &gw6->sin6_addr)) { + /* + * We allow this kind of tricky route only + * when the outgoing interface is p2p. + * XXX: we may need a more generic rule here. + */ + if ((ifp->if_flags & IFF_POINTOPOINT) == 0) + senderr(EHOSTUNREACH); + + goto sendpkt; + } + + if (rt->rt_gwroute == 0) + goto lookup; + if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) { + rtfree(rt); rt = rt0; + lookup: +#ifdef __FreeBSD__ + rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1, 0UL); +#else + rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1); +#endif + if ((rt = rt->rt_gwroute) == 0) + senderr(EHOSTUNREACH); +#if defined(__bsdi__) || defined(__NetBSD__) + /* the "G" test below also prevents rt == rt0 */ + if ((rt->rt_flags & RTF_GATEWAY) || + (rt->rt_ifp != ifp)) { + rt->rt_refcnt--; + rt0->rt_gwroute = 0; + senderr(EHOSTUNREACH); + } +#endif + } + } + } + + /* + * Address resolution or Neighbor Unreachability Detection + * for the next hop. + * At this point, the destination of the packet must be a unicast + * or an anycast address(i.e. not a multicast). + */ + + /* Look up the neighbor cache for the nexthop */ + if (rt && (rt->rt_flags & RTF_LLINFO) != 0) + ln = (struct llinfo_nd6 *)rt->rt_llinfo; + else { + /* + * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), + * the condition below is not very efficient. But we believe + * it is tolerable, because this should be a rare case. + */ + if (nd6_is_addr_neighbor(dst, ifp) && + (rt = nd6_lookup(&dst->sin6_addr, 1, ifp)) != NULL) + ln = (struct llinfo_nd6 *)rt->rt_llinfo; + } + if (!ln || !rt) { + if ((ifp->if_flags & IFF_POINTOPOINT) == 0 && + !(nd_ifinfo[ifp->if_index].flags & ND6_IFF_PERFORMNUD)) { + log(LOG_DEBUG, + "nd6_output: can't allocate llinfo for %s " + "(ln=%p, rt=%p)\n", + ip6_sprintf(&dst->sin6_addr), ln, rt); + senderr(EIO); /* XXX: good error? */ + } + + goto sendpkt; /* send anyway */ + } + + /* We don't have to do link-layer address resolution on a p2p link. */ + if ((ifp->if_flags & IFF_POINTOPOINT) != 0 && + ln->ln_state < ND6_LLINFO_REACHABLE) { + ln->ln_state = ND6_LLINFO_STALE; + ln->ln_expire = time_second + nd6_gctimer; + } + + /* + * The first time we send a packet to a neighbor whose entry is + * STALE, we have to change the state to DELAY and a sets a timer to + * expire in DELAY_FIRST_PROBE_TIME seconds to ensure do + * neighbor unreachability detection on expiration. + * (RFC 2461 7.3.3) + */ + if (ln->ln_state == ND6_LLINFO_STALE) { + ln->ln_asked = 0; + ln->ln_state = ND6_LLINFO_DELAY; + ln->ln_expire = time_second + nd6_delay; + } + + /* + * If the neighbor cache entry has a state other than INCOMPLETE + * (i.e. its link-layer address is already resolved), just + * send the packet. + */ + if (ln->ln_state > ND6_LLINFO_INCOMPLETE) + goto sendpkt; + + /* + * There is a neighbor cache entry, but no ethernet address + * response yet. Replace the held mbuf (if any) with this + * latest one. + * This code conforms to the rate-limiting rule described in Section + * 7.2.2 of RFC 2461, because the timer is set correctly after sending + * an NS below. + */ + if (ln->ln_state == ND6_LLINFO_NOSTATE) + ln->ln_state = ND6_LLINFO_INCOMPLETE; + if (ln->ln_hold) + m_freem(ln->ln_hold); + ln->ln_hold = m; + if (ln->ln_expire) { + if (ln->ln_asked < nd6_mmaxtries && + ln->ln_expire < time_second) { + ln->ln_asked++; + ln->ln_expire = time_second + + nd_ifinfo[ifp->if_index].retrans / 1000; + nd6_ns_output(ifp, NULL, &dst->sin6_addr, ln, 0); + } + } + return(0); + + sendpkt: +#if defined(__OpenBSD__) && defined(IPSEC) + /* + * If the packet needs outgoing IPsec crypto processing and the + * interface doesn't support it, drop it. + */ + mtag = m_tag_find(m, PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED, NULL); +#endif /* IPSEC */ + + if ((ifp->if_flags & IFF_LOOPBACK) != 0) { +#if defined(__OpenBSD__) && defined(IPSEC) + if (mtag != NULL && + (origifp->if_capabilities & IFCAP_IPSEC) == 0) { + /* Tell IPsec to do its own crypto. */ + ipsp_skipcrypto_unmark((struct tdb_ident *)(mtag + 1)); + error = EACCES; + goto bad; + } +#endif /* IPSEC */ + return((*ifp->if_output)(origifp, m, (struct sockaddr *)dst, + rt)); + } +#if defined(__OpenBSD__) && defined(IPSEC) + if (mtag != NULL && + (ifp->if_capabilities & IFCAP_IPSEC) == 0) { + /* Tell IPsec to do its own crypto. */ + ipsp_skipcrypto_unmark((struct tdb_ident *)(mtag + 1)); + error = EACCES; + goto bad; + } +#endif /* IPSEC */ + return((*ifp->if_output)(ifp, m, (struct sockaddr *)dst, rt)); + + bad: + if (m) + m_freem(m); + return (error); +} +#undef senderr + +int +nd6_need_cache(ifp) + struct ifnet *ifp; +{ + /* + * XXX: we currently do not make neighbor cache on any interface + * other than ARCnet, Ethernet, FDDI and GIF. + * + * RFC2893 says: + * - unidirectional tunnels needs no ND + */ + switch (ifp->if_type) { + case IFT_ARCNET: + case IFT_ETHER: + case IFT_FDDI: + case IFT_IEEE1394: +#ifdef IFT_PROPVIRTUAL + case IFT_PROPVIRTUAL: +#endif +#ifdef IFT_L2VLAN + case IFT_L2VLAN: +#endif +#ifdef IFT_IEEE80211 + case IFT_IEEE80211: +#endif + case IFT_GIF: /* XXX need more cases? */ + return(1); + default: + return(0); + } +} + +int +nd6_storelladdr(ifp, rt, m, dst, desten) + struct ifnet *ifp; + struct rtentry *rt; + struct mbuf *m; + struct sockaddr *dst; + u_char *desten; +{ + int i; + struct sockaddr_dl *sdl; + + if (m->m_flags & M_MCAST) { + switch (ifp->if_type) { + case IFT_ETHER: + case IFT_FDDI: +#ifdef IFT_PROPVIRTUAL + case IFT_PROPVIRTUAL: +#endif +#ifdef IFT_L2VLAN + case IFT_L2VLAN: +#endif +#ifdef IFT_IEEE80211 + case IFT_IEEE80211: +#endif + ETHER_MAP_IPV6_MULTICAST(&SIN6(dst)->sin6_addr, + desten); + return(1); + case IFT_IEEE1394: + /* + * netbsd can use if_broadcastaddr, but we don't do so + * to reduce # of ifdef. + */ + for (i = 0; i < ifp->if_addrlen; i++) + desten[i] = ~0; + return(1); + case IFT_ARCNET: + *desten = 0; + return(1); + default: + m_freem(m); + return(0); + } + } + + if (rt == NULL) { + /* this could happen, if we could not allocate memory */ + m_freem(m); + return(0); + } + if (rt->rt_gateway->sa_family != AF_LINK) { + printf("nd6_storelladdr: something odd happens\n"); + m_freem(m); + return(0); + } + sdl = SDL(rt->rt_gateway); + if (sdl->sdl_alen == 0) { + /* this should be impossible, but we bark here for debugging */ + printf("nd6_storelladdr: sdl_alen == 0, dst=%s, if=%s\n", + ip6_sprintf(&SIN6(dst)->sin6_addr), if_name(ifp)); + m_freem(m); + return(0); + } + + bcopy(LLADDR(sdl), desten, sdl->sdl_alen); + return(1); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6_nbr.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6_nbr.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6_nbr.c @@ -0,0 +1,1525 @@ +//========================================================================== +// +// src/sys/netinet6/nd6_nbr.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: nd6_nbr.c,v 1.83 2001/12/18 02:06:55 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#ifdef __OpenBSD__ +#include +#endif + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __OpenBSD__ /* don't confuse KAME ipsec with OpenBSD ipsec */ +#undef IPSEC +#endif + +#ifdef IPSEC +#include +#endif + +#ifdef MIP6 +#include +#endif /* MIP6 */ + +#define SDL(s) ((struct sockaddr_dl *)s) + +struct dadq; +static struct dadq *nd6_dad_find __P((struct ifaddr *)); +static void nd6_dad_starttimer __P((struct dadq *, int)); +static void nd6_dad_stoptimer __P((struct dadq *)); +static void nd6_dad_timer __P((struct ifaddr *)); +static void nd6_dad_ns_output __P((struct dadq *, struct ifaddr *)); +static void nd6_dad_ns_input __P((struct ifaddr *)); +static void nd6_dad_na_input __P((struct ifaddr *)); + +static int dad_ignore_ns = 0; /* ignore NS in DAD - specwise incorrect*/ +static int dad_maxtry = 15; /* max # of *tries* to transmit DAD packet */ + +/* + * Input an Neighbor Solicitation Message. + * + * Based on RFC 2461 + * Based on RFC 2462 (duplicated address detection) + */ +void +nd6_ns_input(m, off, icmp6len) + struct mbuf *m; + int off, icmp6len; +{ + struct ifnet *ifp = m->m_pkthdr.rcvif; + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct nd_neighbor_solicit *nd_ns; + struct in6_addr saddr6 = ip6->ip6_src; + struct in6_addr daddr6 = ip6->ip6_dst; + struct in6_addr taddr6; + struct in6_addr myaddr6; + char *lladdr = NULL; + struct ifaddr *ifa; + int lladdrlen = 0; + int anycast = 0, proxy = 0, tentative = 0; + int tlladdr; + union nd_opts ndopts; + struct sockaddr_dl *proxydl = NULL; + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, icmp6len,); + nd_ns = (struct nd_neighbor_solicit *)((caddr_t)ip6 + off); +#else + IP6_EXTHDR_GET(nd_ns, struct nd_neighbor_solicit *, m, off, icmp6len); + if (nd_ns == NULL) { + icmp6stat.icp6s_tooshort++; + return; + } +#endif + ip6 = mtod(m, struct ip6_hdr *); /* adjust pointer for safety */ + taddr6 = nd_ns->nd_ns_target; + + if (ip6->ip6_hlim != 255) { + nd6log((LOG_ERR, + "nd6_ns_input: invalid hlim (%d) from %s to %s on %s\n", + ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), if_name(ifp))); + goto bad; + } + + if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) { + /* dst has to be solicited node multicast address. */ + if (daddr6.s6_addr16[0] == IPV6_ADDR_INT16_MLL + /* don't check ifindex portion */ + && daddr6.s6_addr32[1] == 0 + && daddr6.s6_addr32[2] == IPV6_ADDR_INT32_ONE + && daddr6.s6_addr8[12] == 0xff) { + ; /* good */ + } else { + nd6log((LOG_INFO, "nd6_ns_input: bad DAD packet " + "(wrong ip6 dst)\n")); + goto bad; + } + } + + if (IN6_IS_ADDR_MULTICAST(&taddr6)) { + nd6log((LOG_INFO, "nd6_ns_input: bad NS target (multicast)\n")); + goto bad; + + } + + if (IN6_IS_SCOPE_LINKLOCAL(&taddr6)) + taddr6.s6_addr16[1] = htons(ifp->if_index); + + icmp6len -= sizeof(*nd_ns); + nd6_option_init(nd_ns + 1, icmp6len, &ndopts); + if (nd6_options(&ndopts) < 0) { + nd6log((LOG_INFO, + "nd6_ns_input: invalid ND option, ignored\n")); + /* nd6_options have incremented stats */ + goto freeit; + } + + if (ndopts.nd_opts_src_lladdr) { + lladdr = (char *)(ndopts.nd_opts_src_lladdr + 1); + lladdrlen = ndopts.nd_opts_src_lladdr->nd_opt_len << 3; + } + + if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) && lladdr) { + nd6log((LOG_INFO, "nd6_ns_input: bad DAD packet " + "(link-layer address option)\n")); + goto bad; + } + + /* + * Attaching target link-layer address to the NA? + * (RFC 2461 7.2.4) + * + * NS IP dst is unicast/anycast MUST NOT add + * NS IP dst is solicited-node multicast MUST add + * + * In implementation, we add target link-layer address by default. + * We do not add one in MUST NOT cases. + */ +#if 0 /* too much! */ + ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &daddr6); + if (ifa && (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST)) + tlladdr = 0; + else +#endif + if (!IN6_IS_ADDR_MULTICAST(&daddr6)) + tlladdr = 0; + else + tlladdr = 1; + + /* + * Target address (taddr6) must be either: + * (1) Valid unicast/anycast address for my receiving interface, + * (2) Unicast address for which I'm offering proxy service, or + * (3) "tentative" address on which DAD is being performed. + */ + /* (1) and (3) check. */ + ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); + + /* (2) check. */ + if (!ifa) { + struct rtentry *rt; + struct sockaddr_in6 tsin6; + + bzero(&tsin6, sizeof tsin6); + tsin6.sin6_len = sizeof(struct sockaddr_in6); + tsin6.sin6_family = AF_INET6; + tsin6.sin6_addr = taddr6; + + rt = rtalloc1((struct sockaddr *)&tsin6, 0 +#ifdef __FreeBSD__ + , 0 +#endif /* __FreeBSD__ */ + ); + if (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 && + rt->rt_gateway->sa_family == AF_LINK) { + /* + * proxy NDP for single entry + */ + ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, + IN6_IFF_NOTREADY|IN6_IFF_ANYCAST); + if (ifa) { + proxy = 1; + proxydl = SDL(rt->rt_gateway); + } + } + if (rt) + rtfree(rt); + } +#ifdef MIP6 + if (!ifa) { + ifa = mip6_dad_find(&taddr6, ifp); + } +#endif + if (!ifa) { + /* + * We've got an NS packet, and we don't have that adddress + * assigned for us. We MUST silently ignore it. + * See RFC2461 7.2.3. + */ + goto freeit; + } + myaddr6 = *IFA_IN6(ifa); + anycast = ((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST; + tentative = ((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_TENTATIVE; + if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DUPLICATED) + goto freeit; + + if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { + nd6log((LOG_INFO, + "nd6_ns_input: lladdrlen mismatch for %s " + "(if %d, NS packet %d)\n", + ip6_sprintf(&taddr6), ifp->if_addrlen, lladdrlen - 2)); + goto bad; + } + + if (IN6_ARE_ADDR_EQUAL(&myaddr6, &saddr6)) { + nd6log((LOG_INFO, + "nd6_ns_input: duplicate IP6 address %s\n", + ip6_sprintf(&saddr6))); + goto freeit; + } + + /* + * We have neighbor solicitation packet, with target address equals to + * one of my tentative address. + * + * src addr how to process? + * --- --- + * multicast of course, invalid (rejected in ip6_input) + * unicast somebody is doing address resolution -> ignore + * unspec dup address detection + * + * The processing is defined in RFC 2462. + */ + if (tentative) { + /* + * If source address is unspecified address, it is for + * duplicated address detection. + * + * If not, the packet is for addess resolution; + * silently ignore it. + */ + if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) + nd6_dad_ns_input(ifa); + + goto freeit; + } + + /* + * If the source address is unspecified address, entries must not + * be created or updated. + * It looks that sender is performing DAD. Output NA toward + * all-node multicast address, to tell the sender that I'm using + * the address. + * S bit ("solicited") must be zero. + */ + if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) { + saddr6 = in6addr_linklocal_allnodes; + saddr6.s6_addr16[1] = htons(ifp->if_index); + nd6_na_output(ifp, &saddr6, &taddr6, + ((anycast || proxy || !tlladdr) + ? 0 : ND_NA_FLAG_OVERRIDE) + | (ip6_forwarding ? ND_NA_FLAG_ROUTER : 0), + tlladdr, (struct sockaddr *)proxydl); + goto freeit; + } + + nd6_cache_lladdr(ifp, &saddr6, lladdr, lladdrlen, ND_NEIGHBOR_SOLICIT, 0); + + nd6_na_output(ifp, &saddr6, &taddr6, + ((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) + | (ip6_forwarding ? ND_NA_FLAG_ROUTER : 0) + | ND_NA_FLAG_SOLICITED, + tlladdr, (struct sockaddr *)proxydl); + freeit: + m_freem(m); + return; + + bad: + nd6log((LOG_ERR, "nd6_ns_input: src=%s\n", ip6_sprintf(&saddr6))); + nd6log((LOG_ERR, "nd6_ns_input: dst=%s\n", ip6_sprintf(&daddr6))); + nd6log((LOG_ERR, "nd6_ns_input: tgt=%s\n", ip6_sprintf(&taddr6))); + icmp6stat.icp6s_badns++; + m_freem(m); +} + +/* + * Output an Neighbor Solicitation Message. Caller specifies: + * - ICMP6 header source IP6 address + * - ND6 header target IP6 address + * - ND6 header source datalink address + * + * Based on RFC 2461 + * Based on RFC 2462 (duplicated address detection) + */ +void +nd6_ns_output(ifp, daddr6, taddr6, ln, dad) + struct ifnet *ifp; + const struct in6_addr *daddr6, *taddr6; + struct llinfo_nd6 *ln; /* for source address determination */ + int dad; /* duplicated address detection */ +{ + struct mbuf *m; + struct ip6_hdr *ip6; + struct nd_neighbor_solicit *nd_ns; + struct in6_ifaddr *ia = NULL; + struct ip6_moptions im6o; + int icmp6len; + int maxlen; + caddr_t mac; + struct sockaddr_in6 sin6_in; +#ifdef MIP6 + int unicast_ns = 0; +#endif + + if (IN6_IS_ADDR_MULTICAST(taddr6)) + return; + + /* estimate the size of message */ + maxlen = sizeof(*ip6) + sizeof(*nd_ns); + maxlen += (sizeof(struct nd_opt_hdr) + ifp->if_addrlen + 7) & ~7; +#ifdef DIAGNOSTIC + if (max_linkhdr + maxlen >= MCLBYTES) { + printf("nd6_ns_output: max_linkhdr + maxlen >= MCLBYTES " + "(%d + %d > %d)\n", max_linkhdr, maxlen, MCLBYTES); + panic("nd6_ns_output: insufficient MCLBYTES"); + /* NOTREACHED */ + } +#endif + + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m && max_linkhdr + maxlen >= MHLEN) { + MCLGET(m, M_DONTWAIT); + if ((m->m_flags & M_EXT) == 0) { + m_free(m); + m = NULL; + } + } + if (m == NULL) + return; + m->m_pkthdr.rcvif = NULL; + +#ifdef MIP6 + if (MIP6_IS_MN && daddr6 == NULL && !dad) { + struct hif_softc *sc; + struct mip6_bu *mbu; + + /* 10.20. Returning Home */ + for (sc = TAILQ_FIRST(&hif_softc_list); + sc; + sc = TAILQ_NEXT(sc, hif_entry)) { + mbu = mip6_bu_list_find_withpaddr( + &sc->hif_bu_list, + (struct in6_addr *)taddr6); + if (mbu == NULL) + continue; + if ((mbu->mbu_flags & IP6_BUF_HOME) == 0) + continue; + if (mbu->mbu_reg_state == + MIP6_BU_REG_STATE_DEREGWAITACK) { + /* unspecified source */ + dad = 1; + if (ln && ND6_IS_LLINFO_PROBREACH(ln)) + unicast_ns = 1; + } + break; + } + } + if (!unicast_ns) +#endif + if (daddr6 == NULL || IN6_IS_ADDR_MULTICAST(daddr6)) { + m->m_flags |= M_MCAST; + im6o.im6o_multicast_ifp = ifp; + im6o.im6o_multicast_hlim = 255; + im6o.im6o_multicast_loop = 0; + } + + icmp6len = sizeof(*nd_ns); + m->m_pkthdr.len = m->m_len = sizeof(*ip6) + icmp6len; + m->m_data += max_linkhdr; /* or MH_ALIGN() equivalent? */ + + /* fill neighbor solicitation packet */ + ip6 = mtod(m, struct ip6_hdr *); + ip6->ip6_flow = 0; + ip6->ip6_vfc &= ~IPV6_VERSION_MASK; + ip6->ip6_vfc |= IPV6_VERSION; + /* ip6->ip6_plen will be set later */ + ip6->ip6_nxt = IPPROTO_ICMPV6; + ip6->ip6_hlim = 255; + if (daddr6) + ip6->ip6_dst = *daddr6; +#ifdef MIP6 + else if (unicast_ns) + ip6->ip6_dst = *taddr6; +#endif + else { + ip6->ip6_dst.s6_addr16[0] = IPV6_ADDR_INT16_MLL; + ip6->ip6_dst.s6_addr16[1] = htons(ifp->if_index); + ip6->ip6_dst.s6_addr32[1] = 0; + ip6->ip6_dst.s6_addr32[2] = IPV6_ADDR_INT32_ONE; + ip6->ip6_dst.s6_addr32[3] = taddr6->s6_addr32[3]; + ip6->ip6_dst.s6_addr8[12] = 0xff; + } + if (!dad) { + /* + * RFC2461 7.2.2: + * "If the source address of the packet prompting the + * solicitation is the same as one of the addresses assigned + * to the outgoing interface, that address SHOULD be placed + * in the IP Source Address of the outgoing solicitation. + * Otherwise, any one of the addresses assigned to the + * interface should be used." + * + * We use the source address for the prompting packet + * (saddr6), if: + * - saddr6 is given from the caller (by giving "ln"), and + * - saddr6 belongs to the outgoing interface. + * Otherwise, we perform a scope-wise match. + */ + struct ip6_hdr *hip6; /* hold ip6 */ + struct in6_addr *saddr6; + + if (ln && ln->ln_hold) { + hip6 = mtod(ln->ln_hold, struct ip6_hdr *); + if (sizeof(*hip6) < ln->ln_hold->m_len) { + int zone; + + bzero(&sin6_in, sizeof(sin6_in)); + sin6_in.sin6_family = AF_INET6; + sin6_in.sin6_len = sizeof(sin6_in); + sin6_in.sin6_addr = hip6->ip6_src; + zone = in6_addr2zoneid(ifp, + &sin6_in.sin6_addr); + if (zone < 0) /* XXX: should not happen! */ + goto bad; + sin6_in.sin6_scope_id = zone; + in6_embedscope(&sin6_in.sin6_addr, &sin6_in); + saddr6 = &sin6_in.sin6_addr; + } else + saddr6 = NULL; + } else + saddr6 = NULL; + if (saddr6 && in6ifa_ifpwithaddr(ifp, saddr6)) + bcopy(saddr6, &ip6->ip6_src, sizeof(*saddr6)); + else { + ia = in6_ifawithifp(ifp, &ip6->ip6_dst); + if (ia == NULL) { + m_freem(m); + return; + } + ip6->ip6_src = ia->ia_addr.sin6_addr; + } + } else { + /* + * Source address for DAD packet must always be IPv6 + * unspecified address. (0::0) + */ + bzero(&ip6->ip6_src, sizeof(ip6->ip6_src)); + } + nd_ns = (struct nd_neighbor_solicit *)(ip6 + 1); + nd_ns->nd_ns_type = ND_NEIGHBOR_SOLICIT; + nd_ns->nd_ns_code = 0; + nd_ns->nd_ns_reserved = 0; + nd_ns->nd_ns_target = *taddr6; + + if (IN6_IS_SCOPE_LINKLOCAL(&nd_ns->nd_ns_target)) + nd_ns->nd_ns_target.s6_addr16[1] = 0; + + /* + * Add source link-layer address option. + * + * spec implementation + * --- --- + * DAD packet MUST NOT do not add the option + * there's no link layer address: + * impossible do not add the option + * there's link layer address: + * Multicast NS MUST add one add the option + * Unicast NS SHOULD add one add the option + */ + if (!dad && (mac = nd6_ifptomac(ifp))) { + int optlen = sizeof(struct nd_opt_hdr) + ifp->if_addrlen; + struct nd_opt_hdr *nd_opt = (struct nd_opt_hdr *)(nd_ns + 1); + /* 8 byte alignments... */ + optlen = (optlen + 7) & ~7; + + m->m_pkthdr.len += optlen; + m->m_len += optlen; + icmp6len += optlen; + bzero((caddr_t)nd_opt, optlen); + nd_opt->nd_opt_type = ND_OPT_SOURCE_LINKADDR; + nd_opt->nd_opt_len = optlen >> 3; + bcopy(mac, (caddr_t)(nd_opt + 1), ifp->if_addrlen); + } + + ip6->ip6_plen = htons((u_short)icmp6len); + nd_ns->nd_ns_cksum = 0; + nd_ns->nd_ns_cksum + = in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), icmp6len); + +#ifdef IPSEC + /* Don't lookup socket */ + (void)ipsec_setsocket(m, NULL); +#endif + ip6_output(m, NULL, NULL, dad ? IPV6_UNSPECSRC : 0, &im6o, NULL); + icmp6_ifstat_inc(ifp, ifs6_out_msg); + icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); + icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT]++; + + return; + + bad: + m_freem(m); + return; +} + +/* + * Neighbor advertisement input handling. + * + * Based on RFC 2461 + * Based on RFC 2462 (duplicated address detection) + * + * the following items are not implemented yet: + * - proxy advertisement delay rule (RFC2461 7.2.8, last paragraph, SHOULD) + * - anycast advertisement delay rule (RFC2461 7.2.7, SHOULD) + */ +void +nd6_na_input(m, off, icmp6len) + struct mbuf *m; + int off, icmp6len; +{ + struct ifnet *ifp = m->m_pkthdr.rcvif; + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct nd_neighbor_advert *nd_na; +#if 0 + struct in6_addr saddr6 = ip6->ip6_src; +#endif + struct in6_addr daddr6 = ip6->ip6_dst; + struct in6_addr taddr6; + int flags; + int is_router; + int is_solicited; + int is_override; + char *lladdr = NULL; + int lladdrlen = 0; + struct ifaddr *ifa; + struct llinfo_nd6 *ln; + struct rtentry *rt; + struct sockaddr_dl *sdl; + union nd_opts ndopts; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + + if (ip6->ip6_hlim != 255) { + nd6log((LOG_ERR, + "nd6_na_input: invalid hlim (%d) from %s to %s on %s\n", + ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), if_name(ifp))); + goto bad; + } + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, icmp6len,); + nd_na = (struct nd_neighbor_advert *)((caddr_t)ip6 + off); +#else + IP6_EXTHDR_GET(nd_na, struct nd_neighbor_advert *, m, off, icmp6len); + if (nd_na == NULL) { + icmp6stat.icp6s_tooshort++; + return; + } +#endif + taddr6 = nd_na->nd_na_target; + flags = nd_na->nd_na_flags_reserved; + is_router = ((flags & ND_NA_FLAG_ROUTER) != 0); + is_solicited = ((flags & ND_NA_FLAG_SOLICITED) != 0); + is_override = ((flags & ND_NA_FLAG_OVERRIDE) != 0); + + if (IN6_IS_SCOPE_LINKLOCAL(&taddr6)) + taddr6.s6_addr16[1] = htons(ifp->if_index); + + if (IN6_IS_ADDR_MULTICAST(&taddr6)) { + nd6log((LOG_ERR, + "nd6_na_input: invalid target address %s\n", + ip6_sprintf(&taddr6))); + goto bad; + } + if (IN6_IS_ADDR_MULTICAST(&daddr6)) + if (is_solicited) { + nd6log((LOG_ERR, + "nd6_na_input: a solicited adv is multicasted\n")); + goto bad; + } + + icmp6len -= sizeof(*nd_na); + nd6_option_init(nd_na + 1, icmp6len, &ndopts); + if (nd6_options(&ndopts) < 0) { + nd6log((LOG_INFO, + "nd6_na_input: invalid ND option, ignored\n")); + /* nd6_options have incremented stats */ + goto freeit; + } + + if (ndopts.nd_opts_tgt_lladdr) { + lladdr = (char *)(ndopts.nd_opts_tgt_lladdr + 1); + lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; + } + + ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); +#ifdef MIP6 + if (!ifa) { + ifa = mip6_dad_find(&taddr6, ifp); + } +#endif + + /* + * Target address matches one of my interface address. + * + * If my address is tentative, this means that there's somebody + * already using the same address as mine. This indicates DAD failure. + * This is defined in RFC 2462. + * + * Otherwise, process as defined in RFC 2461. + */ + if (ifa + && (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_TENTATIVE)) { + nd6_dad_na_input(ifa); + goto freeit; + } + + /* Just for safety, maybe unnecessary. */ + if (ifa) { + log(LOG_ERR, + "nd6_na_input: duplicate IP6 address %s\n", + ip6_sprintf(&taddr6)); + goto freeit; + } + + if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { + nd6log((LOG_INFO, + "nd6_na_input: lladdrlen mismatch for %s " + "(if %d, NA packet %d)\n", + ip6_sprintf(&taddr6), ifp->if_addrlen, lladdrlen - 2)); + goto bad; + } + + /* + * If no neighbor cache entry is found, NA SHOULD silently be discarded. + */ + rt = nd6_lookup(&taddr6, 0, ifp); + if ((rt == NULL) || + ((ln = (struct llinfo_nd6 *)rt->rt_llinfo) == NULL) || + ((sdl = SDL(rt->rt_gateway)) == NULL)) + goto freeit; + + if (ln->ln_state == ND6_LLINFO_INCOMPLETE) { + /* + * If the link-layer has address, and no lladdr option came, + * discard the packet. + */ + if (ifp->if_addrlen && !lladdr) + goto freeit; + + /* + * Record link-layer address, and update the state. + */ + sdl->sdl_alen = ifp->if_addrlen; + bcopy(lladdr, LLADDR(sdl), ifp->if_addrlen); + if (is_solicited) { + ln->ln_state = ND6_LLINFO_REACHABLE; + ln->ln_byhint = 0; + if (ln->ln_expire) + ln->ln_expire = time_second + + nd_ifinfo[rt->rt_ifp->if_index].reachable; + } else { + ln->ln_state = ND6_LLINFO_STALE; + ln->ln_expire = time_second + nd6_gctimer; + } + if ((ln->ln_router = is_router) != 0) { + /* + * This means a router's state has changed from + * non-reachable to probably reachable, and might + * affect the status of associated prefixes.. + */ + pfxlist_onlink_check(); + } + } else { + int llchange; + + /* + * Check if the link-layer address has changed or not. + */ + if (!lladdr) + llchange = 0; + else { + if (sdl->sdl_alen) { + if (bcmp(lladdr, LLADDR(sdl), ifp->if_addrlen)) + llchange = 1; + else + llchange = 0; + } else + llchange = 1; + } + + /* + * This is VERY complex. Look at it with care. + * + * override solicit lladdr llchange action + * (L: record lladdr) + * + * 0 0 n -- (2c) + * 0 0 y n (2b) L + * 0 0 y y (1) REACHABLE->STALE + * 0 1 n -- (2c) *->REACHABLE + * 0 1 y n (2b) L *->REACHABLE + * 0 1 y y (1) REACHABLE->STALE + * 1 0 n -- (2a) + * 1 0 y n (2a) L + * 1 0 y y (2a) L *->STALE + * 1 1 n -- (2a) *->REACHABLE + * 1 1 y n (2a) L *->REACHABLE + * 1 1 y y (2a) L *->REACHABLE + */ + if (!is_override && (lladdr && llchange)) { /* (1) */ + /* + * If state is REACHABLE, make it STALE. + * no other updates should be done. + */ + if (ln->ln_state == ND6_LLINFO_REACHABLE) { + ln->ln_state = ND6_LLINFO_STALE; + ln->ln_expire = time_second + nd6_gctimer; + } + goto freeit; + } else if (is_override /* (2a) */ + || (!is_override && (lladdr && !llchange)) /* (2b) */ + || !lladdr) { /* (2c) */ + /* + * Update link-local address, if any. + */ + if (lladdr) { + sdl->sdl_alen = ifp->if_addrlen; + bcopy(lladdr, LLADDR(sdl), ifp->if_addrlen); + } + + /* + * If solicited, make the state REACHABLE. + * If not solicited and the link-layer address was + * changed, make it STALE. + */ + if (is_solicited) { + ln->ln_state = ND6_LLINFO_REACHABLE; + ln->ln_byhint = 0; + if (ln->ln_expire) { + ln->ln_expire = time_second + + nd_ifinfo[ifp->if_index].reachable; + } + } else { + if (lladdr && llchange) { + ln->ln_state = ND6_LLINFO_STALE; + ln->ln_expire = time_second + nd6_gctimer; + } + } + } + + if (ln->ln_router && !is_router) { + /* + * The peer dropped the router flag. + * Remove the sender from the Default Router List and + * update the Destination Cache entries. + */ + struct nd_defrouter *dr; + struct in6_addr *in6; + int s; + + in6 = &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr; + + /* + * Lock to protect the default router list. + * XXX: this might be unnecessary, since this function + * is only called under the network software interrupt + * context. However, we keep it just for safety. + */ +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + dr = defrouter_lookup(in6, rt->rt_ifp); + if (dr) + defrtrlist_del(dr); + else if (!ip6_forwarding && ip6_accept_rtadv) { + /* + * Even if the neighbor is not in the default + * router list, the neighbor may be used + * as a next hop for some destinations + * (e.g. redirect case). So we must + * call rt6_flush explicitly. + */ + rt6_flush(&ip6->ip6_src, rt->rt_ifp); + } + splx(s); + } + ln->ln_router = is_router; + } + rt->rt_flags &= ~RTF_REJECT; + ln->ln_asked = 0; + if (ln->ln_hold) { + /* + * we assume ifp is not a p2p here, so just set the 2nd + * argument as the 1st one. + */ + nd6_output(ifp, ifp, ln->ln_hold, + (struct sockaddr_in6 *)rt_key(rt), rt); + ln->ln_hold = 0; + } + + freeit: + m_freem(m); + return; + + bad: + icmp6stat.icp6s_badna++; + m_freem(m); +} + +/* + * Neighbor advertisement output handling. + * + * Based on RFC 2461 + * + * the following items are not implemented yet: + * - proxy advertisement delay rule (RFC2461 7.2.8, last paragraph, SHOULD) + * - anycast advertisement delay rule (RFC2461 7.2.7, SHOULD) + */ +void +nd6_na_output(ifp, daddr6, taddr6, flags, tlladdr, sdl0) + struct ifnet *ifp; + const struct in6_addr *daddr6, *taddr6; + u_long flags; + int tlladdr; /* 1 if include target link-layer address */ + struct sockaddr *sdl0; /* sockaddr_dl (= proxy NA) or NULL */ +{ + struct mbuf *m; + struct ip6_hdr *ip6; + struct nd_neighbor_advert *nd_na; + struct in6_ifaddr *ia = NULL; + struct ip6_moptions im6o; + int icmp6len; + int maxlen; + caddr_t mac = NULL; + + /* estimate the size of message */ + maxlen = sizeof(*ip6) + sizeof(*nd_na); + maxlen += (sizeof(struct nd_opt_hdr) + ifp->if_addrlen + 7) & ~7; +#ifdef DIAGNOSTIC + if (max_linkhdr + maxlen >= MCLBYTES) { + printf("nd6_na_output: max_linkhdr + maxlen >= MCLBYTES " + "(%d + %d > %d)\n", max_linkhdr, maxlen, MCLBYTES); + panic("nd6_na_output: insufficient MCLBYTES"); + /* NOTREACHED */ + } +#endif + + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m && max_linkhdr + maxlen >= MHLEN) { + MCLGET(m, M_DONTWAIT); + if ((m->m_flags & M_EXT) == 0) { + m_free(m); + m = NULL; + } + } + if (m == NULL) + return; + m->m_pkthdr.rcvif = NULL; + + if (IN6_IS_ADDR_MULTICAST(daddr6)) { + m->m_flags |= M_MCAST; + im6o.im6o_multicast_ifp = ifp; + im6o.im6o_multicast_hlim = 255; + im6o.im6o_multicast_loop = 0; + } + + icmp6len = sizeof(*nd_na); + m->m_pkthdr.len = m->m_len = sizeof(struct ip6_hdr) + icmp6len; + m->m_data += max_linkhdr; /* or MH_ALIGN() equivalent? */ + + /* fill neighbor advertisement packet */ + ip6 = mtod(m, struct ip6_hdr *); + ip6->ip6_flow = 0; + ip6->ip6_vfc &= ~IPV6_VERSION_MASK; + ip6->ip6_vfc |= IPV6_VERSION; + ip6->ip6_nxt = IPPROTO_ICMPV6; + ip6->ip6_hlim = 255; + if (IN6_IS_ADDR_UNSPECIFIED(daddr6)) { + /* reply to DAD */ + ip6->ip6_dst.s6_addr16[0] = IPV6_ADDR_INT16_MLL; + ip6->ip6_dst.s6_addr16[1] = htons(ifp->if_index); + ip6->ip6_dst.s6_addr32[1] = 0; + ip6->ip6_dst.s6_addr32[2] = 0; + ip6->ip6_dst.s6_addr32[3] = IPV6_ADDR_INT32_ONE; + flags &= ~ND_NA_FLAG_SOLICITED; + } else + ip6->ip6_dst = *daddr6; + + /* + * Select a source whose scope is the same as that of the dest. + */ + ia = in6_ifawithifp(ifp, &ip6->ip6_dst); + if (ia == NULL) { + m_freem(m); + return; + } + ip6->ip6_src = ia->ia_addr.sin6_addr; + nd_na = (struct nd_neighbor_advert *)(ip6 + 1); + nd_na->nd_na_type = ND_NEIGHBOR_ADVERT; + nd_na->nd_na_code = 0; + nd_na->nd_na_target = *taddr6; + if (IN6_IS_SCOPE_LINKLOCAL(&nd_na->nd_na_target)) + nd_na->nd_na_target.s6_addr16[1] = 0; + + /* + * "tlladdr" indicates NS's condition for adding tlladdr or not. + * see nd6_ns_input() for details. + * Basically, if NS packet is sent to unicast/anycast addr, + * target lladdr option SHOULD NOT be included. + */ + if (tlladdr) { + mac = NULL; + /* + * sdl0 != NULL indicates proxy NA. If we do proxy, use + * lladdr in sdl0. If we are not proxying (sending NA for + * my address) use lladdr configured for the interface. + */ + if (sdl0 == NULL) + mac = nd6_ifptomac(ifp); + else if (sdl0->sa_family == AF_LINK) { + struct sockaddr_dl *sdl; + sdl = (struct sockaddr_dl *)sdl0; + if (sdl->sdl_alen == ifp->if_addrlen) + mac = LLADDR(sdl); + } + } + if (tlladdr && mac) { + int optlen = sizeof(struct nd_opt_hdr) + ifp->if_addrlen; + struct nd_opt_hdr *nd_opt = (struct nd_opt_hdr *)(nd_na + 1); + + /* roundup to 8 bytes alignment! */ + optlen = (optlen + 7) & ~7; + + m->m_pkthdr.len += optlen; + m->m_len += optlen; + icmp6len += optlen; + bzero((caddr_t)nd_opt, optlen); + nd_opt->nd_opt_type = ND_OPT_TARGET_LINKADDR; + nd_opt->nd_opt_len = optlen >> 3; + bcopy(mac, (caddr_t)(nd_opt + 1), ifp->if_addrlen); + } else + flags &= ~ND_NA_FLAG_OVERRIDE; + + ip6->ip6_plen = htons((u_short)icmp6len); + nd_na->nd_na_flags_reserved = flags; + nd_na->nd_na_cksum = 0; + nd_na->nd_na_cksum = + in6_cksum(m, IPPROTO_ICMPV6, sizeof(struct ip6_hdr), icmp6len); + +#ifdef IPSEC + /* Don't lookup socket */ + (void)ipsec_setsocket(m, NULL); +#endif + ip6_output(m, NULL, NULL, 0, &im6o, NULL); + + icmp6_ifstat_inc(ifp, ifs6_out_msg); + icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); + icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT]++; +} + +caddr_t +nd6_ifptomac(ifp) + struct ifnet *ifp; +{ + switch (ifp->if_type) { + case IFT_ARCNET: + case IFT_ETHER: + case IFT_FDDI: + case IFT_IEEE1394: +#ifdef IFT_PROPVIRTUAL + case IFT_PROPVIRTUAL: +#endif +#ifdef IFT_L2VLAN + case IFT_L2VLAN: +#endif +#ifdef IFT_IEEE80211 + case IFT_IEEE80211: +#endif +#ifdef __NetBSD__ + return LLADDR(ifp->if_sadl); +#else + return ((caddr_t)(ifp + 1)); +#endif + break; + default: + return NULL; + } +} + +TAILQ_HEAD(dadq_head, dadq); +struct dadq { + TAILQ_ENTRY(dadq) dad_list; + struct ifaddr *dad_ifa; + int dad_count; /* max NS to send */ + int dad_ns_tcount; /* # of trials to send NS */ + int dad_ns_ocount; /* NS sent so far */ + int dad_ns_icount; + int dad_na_icount; +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + struct callout dad_timer_ch; +#elif defined(__OpenBSD__) + struct timeout dad_timer_ch; +#endif +}; + +static struct dadq_head dadq; +static int dad_init = 0; + +static struct dadq * +nd6_dad_find(ifa) + struct ifaddr *ifa; +{ + struct dadq *dp; + + for (dp = dadq.tqh_first; dp; dp = dp->dad_list.tqe_next) { + if (dp->dad_ifa == ifa) + return dp; + } + return NULL; +} + +static void +nd6_dad_starttimer(dp, _ticks) + struct dadq *dp; + int _ticks; +{ + +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_reset(&dp->dad_timer_ch, _ticks, + (void (*) __P((void *)))nd6_dad_timer, (void *)dp->dad_ifa); +#elif defined(__OpenBSD__) + timeout_set(&dp->dad_timer_ch, (void (*) __P((void *)))nd6_dad_timer, + (void *)dp->dad_ifa); + timeout_add(&dp->dad_timer_ch, _ticks); +#else + timeout((void (*) __P((void *)))nd6_dad_timer, (void *)dp->dad_ifa, + _ticks); +#endif +} + +static void +nd6_dad_stoptimer(dp) + struct dadq *dp; +{ + +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_stop(&dp->dad_timer_ch); +#elif defined(__OpenBSD__) + timeout_del(&dp->dad_timer_ch); +#else + untimeout((void (*) __P((void *)))nd6_dad_timer, (void *)dp->dad_ifa); +#endif +} + +/* + * Start Duplicated Address Detection (DAD) for specified interface address. + */ +void +nd6_dad_start(ifa, tick) + struct ifaddr *ifa; + int *tick; /* minimum delay ticks for IFF_UP event */ +{ + struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; + struct dadq *dp; + int ntick; + + if (!dad_init) { + TAILQ_INIT(&dadq); + dad_init++; + } + + /* + * If we don't need DAD, don't do it. + * There are several cases: + * - DAD is disabled (ip6_dad_count == 0) + * - the interface address is anycast + */ + if (!(ia->ia6_flags & IN6_IFF_TENTATIVE)) { + log(LOG_DEBUG, + "nd6_dad_start: called with non-tentative address " + "%s(%s)\n", + ip6_sprintf(&ia->ia_addr.sin6_addr), + ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); + return; + } + if (ia->ia6_flags & IN6_IFF_ANYCAST) { + ia->ia6_flags &= ~IN6_IFF_TENTATIVE; + return; + } + if (!ip6_dad_count) { + ia->ia6_flags &= ~IN6_IFF_TENTATIVE; + return; + } + if (!ifa->ifa_ifp) + panic("nd6_dad_start: ifa->ifa_ifp == NULL"); + if (!(ifa->ifa_ifp->if_flags & IFF_UP)) + return; + if (nd6_dad_find(ifa) != NULL) { + /* DAD already in progress */ + return; + } + + dp = malloc(sizeof(*dp), M_IP6NDP, M_NOWAIT); + if (dp == NULL) { + log(LOG_ERR, "nd6_dad_start: memory allocation failed for " + "%s(%s)\n", + ip6_sprintf(&ia->ia_addr.sin6_addr), + ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); + return; + } + bzero(dp, sizeof(*dp)); +#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) + callout_init(&dp->dad_timer_ch); +#elif defined(__OpenBSD__) + bzero(&dp->dad_timer_ch, sizeof(dp->dad_timer_ch)); +#endif + TAILQ_INSERT_TAIL(&dadq, (struct dadq *)dp, dad_list); + + nd6log((LOG_DEBUG, "%s: starting DAD for %s\n", if_name(ifa->ifa_ifp), + ip6_sprintf(&ia->ia_addr.sin6_addr))); + + /* + * Send NS packet for DAD, ip6_dad_count times. + * Note that we must delay the first transmission, if this is the + * first packet to be sent from the interface after interface + * (re)initialization. + */ + dp->dad_ifa = ifa; + IFAREF(ifa); /* just for safety */ + dp->dad_count = ip6_dad_count; + dp->dad_ns_icount = dp->dad_na_icount = 0; + dp->dad_ns_ocount = dp->dad_ns_tcount = 0; + if (tick == NULL) { + nd6_dad_ns_output(dp, ifa); + ntick = nd_ifinfo[ifa->ifa_ifp->if_index].retrans * hz / 1000; + } else { + +#ifdef __OpenBSD__ +#define random arc4random +#endif + if (*tick == 0) + ntick = random() % (MAX_RTR_SOLICITATION_DELAY * hz); + else + ntick = *tick + random() % (hz / 2); +#ifdef __OpenBSD__ +#undef random +#endif + *tick = ntick; + } + if (ntick <= 0) ntick = 1; // Defensive + nd6_dad_starttimer(dp, ntick); +} + +/* + * terminate DAD unconditionally. used for address removals. + */ +void +nd6_dad_stop(ifa) + struct ifaddr *ifa; +{ + struct dadq *dp; + + if (!dad_init) + return; + dp = nd6_dad_find(ifa); + if (!dp) { + /* DAD wasn't started yet */ + return; + } + + nd6_dad_stoptimer(dp); + + TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); + free(dp, M_IP6NDP); + dp = NULL; + IFAFREE(ifa); +} + +static void +nd6_dad_timer(ifa) + struct ifaddr *ifa; +{ + int s; + struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; + struct dadq *dp; + +#ifdef __NetBSD__ + s = splsoftnet(); /* XXX */ +#else + s = splnet(); /* XXX */ +#endif + + /* Sanity check */ + if (ia == NULL) { + log(LOG_ERR, "nd6_dad_timer: called with null parameter\n"); + goto done; + } + dp = nd6_dad_find(ifa); + if (dp == NULL) { + log(LOG_ERR, "nd6_dad_timer: DAD structure not found\n"); + goto done; + } + if (ia->ia6_flags & IN6_IFF_DUPLICATED) { + log(LOG_ERR, "nd6_dad_timer: called with duplicated address " + "%s(%s)\n", + ip6_sprintf(&ia->ia_addr.sin6_addr), + ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); + goto done; + } + if ((ia->ia6_flags & IN6_IFF_TENTATIVE) == 0) { + log(LOG_ERR, "nd6_dad_timer: called with non-tentative address " + "%s(%s)\n", + ip6_sprintf(&ia->ia_addr.sin6_addr), + ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); + goto done; + } + + /* timeouted with IFF_{RUNNING,UP} check */ + if (dp->dad_ns_tcount > dad_maxtry) { + nd6log((LOG_INFO, "%s: could not run DAD, driver problem?\n", + if_name(ifa->ifa_ifp))); + + TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); + free(dp, M_IP6NDP); + dp = NULL; + IFAFREE(ifa); + goto done; + } + + /* Need more checks? */ + if (dp->dad_ns_ocount < dp->dad_count) { + /* + * We have more NS to go. Send NS packet for DAD. + */ + nd6_dad_ns_output(dp, ifa); + nd6_dad_starttimer(dp, + nd_ifinfo[ifa->ifa_ifp->if_index].retrans * hz / 1000); + } else { + /* + * We have transmitted sufficient number of DAD packets. + * See what we've got. + */ + int duplicate; + + duplicate = 0; + + if (dp->dad_na_icount) { + /* + * the check is in nd6_dad_na_input(), + * but just in case + */ + duplicate++; + } + + if (dp->dad_ns_icount) { +#if 0 /* heuristics */ + /* + * if + * - we have sent many(?) DAD NS, and + * - the number of NS we sent equals to the + * number of NS we've got, and + * - we've got no NA + * we may have a faulty network card/driver which + * loops back multicasts to myself. + */ + if (3 < dp->dad_count + && dp->dad_ns_icount == dp->dad_count + && dp->dad_na_icount == 0) { + log(LOG_INFO, "DAD questionable for %s(%s): " + "network card loops back multicast?\n", + ip6_sprintf(&ia->ia_addr.sin6_addr), + if_name(ifa->ifa_ifp)); + /* XXX consider it a duplicate or not? */ + /* duplicate++; */ + } else { + /* We've seen NS, means DAD has failed. */ + duplicate++; + } +#else + /* We've seen NS, means DAD has failed. */ + duplicate++; +#endif + } + + if (duplicate) { + /* (*dp) will be freed in nd6_dad_duplicated() */ + dp = NULL; + nd6_dad_duplicated(ifa); + } else { + /* + * We are done with DAD. No NA came, no NS came. + * duplicated address found. + */ + ia->ia6_flags &= ~IN6_IFF_TENTATIVE; + + nd6log((LOG_DEBUG, + "%s: DAD complete for %s - no duplicates found\n", + if_name(ifa->ifa_ifp), + ip6_sprintf(&ia->ia_addr.sin6_addr))); + + TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); + free(dp, M_IP6NDP); + dp = NULL; +#ifdef MIP6 + if (mip6_dad_success(ifa) == ENOENT) +#endif + IFAFREE(ifa); + } + } + +done: + splx(s); +} + +void +nd6_dad_duplicated(ifa) + struct ifaddr *ifa; +{ + struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; + struct dadq *dp; + + dp = nd6_dad_find(ifa); + if (dp == NULL) { + log(LOG_ERR, "nd6_dad_duplicated: DAD structure not found\n"); + return; + } + + log(LOG_ERR, "%s: DAD detected duplicate IPv6 address %s: " + "NS in/out=%d/%d, NA in=%d\n", + if_name(ifa->ifa_ifp), ip6_sprintf(&ia->ia_addr.sin6_addr), + dp->dad_ns_icount, dp->dad_ns_ocount, dp->dad_na_icount); + + ia->ia6_flags &= ~IN6_IFF_TENTATIVE; + ia->ia6_flags |= IN6_IFF_DUPLICATED; + + /* We are done with DAD, with duplicated address found. (failure) */ + nd6_dad_stoptimer(dp); + + log(LOG_ERR, "%s: DAD complete for %s - duplicate found\n", + if_name(ifa->ifa_ifp), ip6_sprintf(&ia->ia_addr.sin6_addr)); + log(LOG_ERR, "%s: manual intervention required\n", + if_name(ifa->ifa_ifp)); + + TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); + free(dp, M_IP6NDP); + dp = NULL; +#ifdef MIP6 + if (mip6_dad_duplicated(ifa) == ENOENT) +#endif + IFAFREE(ifa); +} + +static void +nd6_dad_ns_output(dp, ifa) + struct dadq *dp; + struct ifaddr *ifa; +{ + struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; + struct ifnet *ifp = ifa->ifa_ifp; + + dp->dad_ns_tcount++; + if ((ifp->if_flags & IFF_UP) == 0) { +#if 0 + printf("%s: interface down?\n", if_name(ifp)); +#endif + return; + } + if ((ifp->if_flags & IFF_RUNNING) == 0) { +#if 0 + printf("%s: interface not running?\n", if_name(ifp)); +#endif + return; + } + + dp->dad_ns_ocount++; + nd6_ns_output(ifp, NULL, &ia->ia_addr.sin6_addr, NULL, 1); +} + +static void +nd6_dad_ns_input(ifa) + struct ifaddr *ifa; +{ + struct in6_ifaddr *ia; + struct ifnet *ifp; + const struct in6_addr *taddr6; + struct dadq *dp; + int duplicate; + + if (!ifa) + panic("ifa == NULL in nd6_dad_ns_input"); + + ia = (struct in6_ifaddr *)ifa; + ifp = ifa->ifa_ifp; + taddr6 = &ia->ia_addr.sin6_addr; + duplicate = 0; + dp = nd6_dad_find(ifa); + + /* Quickhack - completely ignore DAD NS packets */ + if (dad_ignore_ns) { + nd6log((LOG_INFO, + "nd6_dad_ns_input: ignoring DAD NS packet for " + "address %s(%s)\n", ip6_sprintf(taddr6), + if_name(ifa->ifa_ifp))); + return; + } + + /* + * if I'm yet to start DAD, someone else started using this address + * first. I have a duplicate and you win. + */ + if (!dp || dp->dad_ns_ocount == 0) + duplicate++; + + /* XXX more checks for loopback situation - see nd6_dad_timer too */ + + if (duplicate) { + dp = NULL; /* will be freed in nd6_dad_duplicated() */ + nd6_dad_duplicated(ifa); + } else { + /* + * not sure if I got a duplicate. + * increment ns count and see what happens. + */ + if (dp) + dp->dad_ns_icount++; + } +} + +static void +nd6_dad_na_input(ifa) + struct ifaddr *ifa; +{ + struct dadq *dp; + + if (!ifa) + panic("ifa == NULL in nd6_dad_na_input"); + + dp = nd6_dad_find(ifa); + if (dp) + dp->dad_na_icount++; + + /* remove the address. */ + nd6_dad_duplicated(ifa); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6_rtr.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6_rtr.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6_rtr.c @@ -0,0 +1,2387 @@ +//========================================================================== +// +// src/sys/netinet6/nd6_rtr.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: nd6_rtr.c,v 1.187 2001/12/18 02:01:25 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __OpenBSD__ +#include +#endif + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef MIP6 +#include +#endif /* MIP6 */ + +#define SDL(s) ((struct sockaddr_dl *)s) + +static int rtpref __P((struct nd_defrouter *)); +static struct nd_defrouter *defrtrlist_update __P((struct nd_defrouter *)); +static struct in6_ifaddr *in6_ifadd __P((struct nd_prefix *)); +static struct nd_pfxrouter *pfxrtr_lookup __P((struct nd_prefix *, + struct nd_defrouter *)); +static void pfxrtr_add __P((struct nd_prefix *, struct nd_defrouter *)); +static void pfxrtr_del __P((struct nd_pfxrouter *)); +static struct nd_pfxrouter *find_pfxlist_reachable_router + __P((struct nd_prefix *)); +static void defrouter_delreq __P((struct nd_defrouter *)); +static void defrouter_addifreq __P((struct ifnet *)); +static void defrouter_delifreq __P((void)); +static void nd6_rtmsg __P((int, struct rtentry *)); + +static void in6_init_address_ltimes __P((struct nd_prefix *ndpr, + struct in6_addrlifetime *lt6)); + +static int rt6_deleteroute __P((struct radix_node *, void *)); + +extern int nd6_recalc_reachtm_interval; + +static struct ifnet *nd6_defifp; +int nd6_defifindex; +static struct ifaddr *nd6_defif_installed = NULL; + +int ip6_use_tempaddr = 0; + +int ip6_desync_factor; +u_int32_t ip6_temp_preferred_lifetime = DEF_TEMP_PREFERRED_LIFETIME; +u_int32_t ip6_temp_valid_lifetime = DEF_TEMP_VALID_LIFETIME; +int ip6_temp_regen_advance = TEMPADDR_REGEN_ADVANCE; + +/* RTPREF_MEDIUM has to be 0! */ +#define RTPREF_HIGH 1 +#define RTPREF_MEDIUM 0 +#define RTPREF_LOW (-1) +#define RTPREF_INVALID (-2) + +/* + * Receive Router Solicitation Message - just for routers. + * Router solicitation/advertisement is mostly managed by userland program + * (rtadvd) so here we have no function like nd6_ra_output(). + * + * Based on RFC 2461 + */ +void +nd6_rs_input(m, off, icmp6len) + struct mbuf *m; + int off, icmp6len; +{ + struct ifnet *ifp = m->m_pkthdr.rcvif; + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct nd_router_solicit *nd_rs; + struct in6_addr saddr6 = ip6->ip6_src; +#if 0 + struct in6_addr daddr6 = ip6->ip6_dst; +#endif + char *lladdr = NULL; + int lladdrlen = 0; +#if 0 + struct sockaddr_dl *sdl = (struct sockaddr_dl *)NULL; + struct llinfo_nd6 *ln = (struct llinfo_nd6 *)NULL; + struct rtentry *rt = NULL; + int is_newentry; +#endif + union nd_opts ndopts; + + /* If I'm not a router, ignore it. */ + if (ip6_accept_rtadv != 0 || ip6_forwarding != 1) + goto freeit; + + /* Sanity checks */ + if (ip6->ip6_hlim != 255) { + nd6log((LOG_ERR, + "nd6_rs_input: invalid hlim (%d) from %s to %s on %s\n", + ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), if_name(ifp))); + goto bad; + } + + /* + * Don't update the neighbor cache, if src = ::. + * This indicates that the src has no IP address assigned yet. + */ + if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) + goto freeit; + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, icmp6len,); + nd_rs = (struct nd_router_solicit *)((caddr_t)ip6 + off); +#else + IP6_EXTHDR_GET(nd_rs, struct nd_router_solicit *, m, off, icmp6len); + if (nd_rs == NULL) { + icmp6stat.icp6s_tooshort++; + return; + } +#endif + + icmp6len -= sizeof(*nd_rs); + nd6_option_init(nd_rs + 1, icmp6len, &ndopts); + if (nd6_options(&ndopts) < 0) { + nd6log((LOG_INFO, + "nd6_rs_input: invalid ND option, ignored\n")); + /* nd6_options have incremented stats */ + goto freeit; + } + + if (ndopts.nd_opts_src_lladdr) { + lladdr = (char *)(ndopts.nd_opts_src_lladdr + 1); + lladdrlen = ndopts.nd_opts_src_lladdr->nd_opt_len << 3; + } + + if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { + nd6log((LOG_INFO, + "nd6_rs_input: lladdrlen mismatch for %s " + "(if %d, RS packet %d)\n", + ip6_sprintf(&saddr6), ifp->if_addrlen, lladdrlen - 2)); + goto bad; + } + + nd6_cache_lladdr(ifp, &saddr6, lladdr, lladdrlen, ND_ROUTER_SOLICIT, 0); + + freeit: + m_freem(m); + return; + + bad: + icmp6stat.icp6s_badrs++; + m_freem(m); +} + +/* + * Receive Router Advertisement Message. + * + * Based on RFC 2461 + * TODO: on-link bit on prefix information + * TODO: ND_RA_FLAG_{OTHER,MANAGED} processing + */ +void +nd6_ra_input(m, off, icmp6len) + struct mbuf *m; + int off, icmp6len; +{ + struct ifnet *ifp = m->m_pkthdr.rcvif; + struct nd_ifinfo *ndi = &nd_ifinfo[ifp->if_index]; + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct nd_router_advert *nd_ra; + struct in6_addr saddr6 = ip6->ip6_src; +#if 0 + struct in6_addr daddr6 = ip6->ip6_dst; + int flags; /* = nd_ra->nd_ra_flags_reserved; */ + int is_managed = ((flags & ND_RA_FLAG_MANAGED) != 0); + int is_other = ((flags & ND_RA_FLAG_OTHER) != 0); +#endif + union nd_opts ndopts; + struct nd_defrouter *dr; + + /* + * We only accept RAs only when + * the system-wide variable allows the acceptance, and + * per-interface variable allows RAs on the receiving interface. + */ + if (ip6_accept_rtadv == 0) + goto freeit; + if (!(nd_ifinfo[ifp->if_index].flags & ND6_IFF_ACCEPT_RTADV)) + goto freeit; + + if (ip6->ip6_hlim != 255) { + nd6log((LOG_ERR, + "nd6_ra_input: invalid hlim (%d) from %s to %s on %s\n", + ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src), + ip6_sprintf(&ip6->ip6_dst), if_name(ifp))); + goto bad; + } + + if (!IN6_IS_ADDR_LINKLOCAL(&saddr6)) { + nd6log((LOG_ERR, + "nd6_ra_input: src %s is not link-local\n", + ip6_sprintf(&saddr6))); + goto bad; + } + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, icmp6len,); + nd_ra = (struct nd_router_advert *)((caddr_t)ip6 + off); +#else + IP6_EXTHDR_GET(nd_ra, struct nd_router_advert *, m, off, icmp6len); + if (nd_ra == NULL) { + icmp6stat.icp6s_tooshort++; + return; + } +#endif + + icmp6len -= sizeof(*nd_ra); + nd6_option_init(nd_ra + 1, icmp6len, &ndopts); + if (nd6_options(&ndopts) < 0) { + nd6log((LOG_INFO, + "nd6_ra_input: invalid ND option, ignored\n")); + /* nd6_options have incremented stats */ + goto freeit; + } + + { + struct nd_defrouter dr0; + u_int32_t advreachable = nd_ra->nd_ra_reachable; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + + Bzero(&dr0, sizeof(dr0)); + dr0.rtaddr = saddr6; + dr0.flags = nd_ra->nd_ra_flags_reserved; + dr0.rtlifetime = ntohs(nd_ra->nd_ra_router_lifetime); + dr0.expire = time_second + dr0.rtlifetime; + dr0.ifp = ifp; + dr0.advint = 0; /* Mobile IPv6 */ + dr0.advint_expire = 0; /* Mobile IPv6 */ + dr0.advints_lost = 0; /* Mobile IPv6 */ + /* unspecified or not? (RFC 2461 6.3.4) */ + if (advreachable) { + NTOHL(advreachable); + if (advreachable <= MAX_REACHABLE_TIME && + ndi->basereachable != advreachable) { + ndi->basereachable = advreachable; + ndi->reachable = ND_COMPUTE_RTIME(ndi->basereachable); + ndi->recalctm = nd6_recalc_reachtm_interval; /* reset */ + } + } + if (nd_ra->nd_ra_retransmit) + ndi->retrans = ntohl(nd_ra->nd_ra_retransmit); + if (nd_ra->nd_ra_curhoplimit) + ndi->chlim = nd_ra->nd_ra_curhoplimit; + dr = defrtrlist_update(&dr0); + } + + /* + * prefix + */ + if (ndopts.nd_opts_pi) { + struct nd_opt_hdr *pt; + struct nd_opt_prefix_info *pi = NULL; + struct nd_prefix pr; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + + for (pt = (struct nd_opt_hdr *)ndopts.nd_opts_pi; + pt <= (struct nd_opt_hdr *)ndopts.nd_opts_pi_end; + pt = (struct nd_opt_hdr *)((caddr_t)pt + + (pt->nd_opt_len << 3))) { + if (pt->nd_opt_type != ND_OPT_PREFIX_INFORMATION) + continue; + pi = (struct nd_opt_prefix_info *)pt; + + if (pi->nd_opt_pi_len != 4) { + nd6log((LOG_INFO, + "nd6_ra_input: invalid option " + "len %d for prefix information option, " + "ignored\n", pi->nd_opt_pi_len)); + continue; + } + + if (128 < pi->nd_opt_pi_prefix_len) { + nd6log((LOG_INFO, + "nd6_ra_input: invalid prefix " + "len %d for prefix information option, " + "ignored\n", pi->nd_opt_pi_prefix_len)); + continue; + } + + if (IN6_IS_ADDR_MULTICAST(&pi->nd_opt_pi_prefix) + || IN6_IS_ADDR_LINKLOCAL(&pi->nd_opt_pi_prefix)) { + nd6log((LOG_INFO, + "nd6_ra_input: invalid prefix " + "%s, ignored\n", + ip6_sprintf(&pi->nd_opt_pi_prefix))); + continue; + } + + /* aggregatable unicast address, rfc2374 */ + if ((pi->nd_opt_pi_prefix.s6_addr8[0] & 0xe0) == 0x20 + && pi->nd_opt_pi_prefix_len != 64) { + nd6log((LOG_INFO, + "nd6_ra_input: invalid prefixlen " + "%d for rfc2374 prefix %s, ignored\n", + pi->nd_opt_pi_prefix_len, + ip6_sprintf(&pi->nd_opt_pi_prefix))); + continue; + } + + bzero(&pr, sizeof(pr)); + pr.ndpr_prefix.sin6_family = AF_INET6; + pr.ndpr_prefix.sin6_len = sizeof(pr.ndpr_prefix); + pr.ndpr_prefix.sin6_addr = pi->nd_opt_pi_prefix; + pr.ndpr_ifp = (struct ifnet *)m->m_pkthdr.rcvif; + + pr.ndpr_raf_onlink = (pi->nd_opt_pi_flags_reserved & + ND_OPT_PI_FLAG_ONLINK) ? 1 : 0; + pr.ndpr_raf_auto = (pi->nd_opt_pi_flags_reserved & + ND_OPT_PI_FLAG_AUTO) ? 1 : 0; +#ifdef MIP6 + pr.ndpr_raf_router = (pi->nd_opt_pi_flags_reserved & + ND_OPT_PI_FLAG_ROUTER) ? 1 : 0; +#endif /* MIP6 */ + pr.ndpr_plen = pi->nd_opt_pi_prefix_len; + pr.ndpr_vltime = ntohl(pi->nd_opt_pi_valid_time); + pr.ndpr_pltime = + ntohl(pi->nd_opt_pi_preferred_time); + pr.ndpr_lastupdate = time_second; + + if (in6_init_prefix_ltimes(&pr)) + continue; /* prefix lifetime init failed */ +#ifdef MIP6 + if (MIP6_IS_MN) { + if (mip6_prefix_list_update(&saddr6, &pr, dr, m)) { + mip6log((LOG_ERR, + "%s:%d: " + "prefix info processing " + "failed\n", + __FILE__, __LINE__)); + goto freeit; + } + } +#endif /* MIP6 */ + (void)prelist_update(&pr, dr, m); + } + } + +#ifdef MIP6 + if (MIP6_IS_MN) { + /* check reachability of all routers. */ + mip6_probe_routers(); + } + + /* update home agent list. */ + if ((MIP6_IS_MN || MIP6_IS_HA) + && dr + && (dr->flags & ND_RA_FLAG_HOME_AGENT)) { + if (mip6_ha_list_update_hainfo(&mip6_ha_list, + dr, ndopts.nd_opts_hai)) { + mip6log((LOG_ERR, + "%s:%d: global HA list update failed\n", + __FILE__, __LINE__)); + } + } + if (dr == NULL) { + struct mip6_ha *mha; + + /* the home agent is shutting down. */ + mha = mip6_ha_list_find_withaddr(&mip6_ha_list, &saddr6); + if (mha) { + if (mip6_ha_list_remove(&mip6_ha_list, mha)) { + mip6log((LOG_ERR, + "%s:%d: HA entry remove failed.\n", + __FILE__, __LINE__)); + } + } + } +#endif /* MIP6 */ + + /* + * MTU + */ + if (ndopts.nd_opts_mtu && ndopts.nd_opts_mtu->nd_opt_mtu_len == 1) { + u_int32_t mtu = ntohl(ndopts.nd_opts_mtu->nd_opt_mtu_mtu); + + /* lower bound */ + if (mtu < IPV6_MMTU) { + nd6log((LOG_INFO, "nd6_ra_input: bogus mtu option " + "mtu=%d sent from %s, ignoring\n", + mtu, ip6_sprintf(&ip6->ip6_src))); + goto skip; + } + + /* upper bound */ + if (ndi->maxmtu) { + if (mtu <= ndi->maxmtu) { + int change = (ndi->linkmtu != mtu); + + ndi->linkmtu = mtu; + if (change) /* in6_maxmtu may change */ + in6_setmaxmtu(); + } else { + nd6log((LOG_INFO, "nd6_ra_input: bogus mtu " + "mtu=%d sent from %s; " + "exceeds maxmtu %d, ignoring\n", + mtu, ip6_sprintf(&ip6->ip6_src), + ndi->maxmtu)); + } + } else { + nd6log((LOG_INFO, "nd6_ra_input: mtu option " + "mtu=%d sent from %s; maxmtu unknown, " + "ignoring\n", + mtu, ip6_sprintf(&ip6->ip6_src))); + } + } + + skip: + + /* + * Source link layer address + */ + { + char *lladdr = NULL; + int lladdrlen = 0; + + if (ndopts.nd_opts_src_lladdr) { + lladdr = (char *)(ndopts.nd_opts_src_lladdr + 1); + lladdrlen = ndopts.nd_opts_src_lladdr->nd_opt_len << 3; + } + + if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { + nd6log((LOG_INFO, + "nd6_ra_input: lladdrlen mismatch for %s " + "(if %d, RA packet %d)\n", + ip6_sprintf(&saddr6), ifp->if_addrlen, lladdrlen - 2)); + goto bad; + } + + nd6_cache_lladdr(ifp, &saddr6, lladdr, lladdrlen, ND_ROUTER_ADVERT, 0); + + /* + * Installing a link-layer address might change the state of the + * router's neighbor cache, which might also affect our on-link + * detection of adveritsed prefixes. + */ + pfxlist_onlink_check(); + } + + freeit: + m_freem(m); + return; + + bad: + icmp6stat.icp6s_badra++; + m_freem(m); +} + +/* + * default router list proccessing sub routines + */ + +/* tell the change to user processes watching the routing socket. */ +static void +nd6_rtmsg(cmd, rt) + int cmd; + struct rtentry *rt; +{ + struct rt_addrinfo info; + + bzero((caddr_t)&info, sizeof(info)); +#if (defined(__bsdi__) && _BSDI_VERSION >= 199802) /* BSDI4 */ + /* maybe this is unnecessary */ + info.rti_flags = rt->rt_flags; +#endif + info.rti_info[RTAX_DST] = rt_key(rt); + info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; + info.rti_info[RTAX_NETMASK] = rt_mask(rt); +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + info.rti_info[RTAX_IFP] = rt->rt_ifp->if_addrlist->ifa_addr; +#else + info.rti_info[RTAX_IFP] = + (struct sockaddr *)TAILQ_FIRST(&rt->rt_ifp->if_addrlist); +#endif + info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; + + rt_missmsg(cmd, &info, rt->rt_flags, 0); +} + +void +defrouter_addreq(new) + struct nd_defrouter *new; +{ + struct sockaddr_in6 def, mask, gate; + struct rtentry *newrt = NULL; + int s; + int error; + + Bzero(&def, sizeof(def)); + Bzero(&mask, sizeof(mask)); + Bzero(&gate, sizeof(gate)); + + def.sin6_len = mask.sin6_len = gate.sin6_len + = sizeof(struct sockaddr_in6); + def.sin6_family = mask.sin6_family = gate.sin6_family = AF_INET6; + gate.sin6_addr = new->rtaddr; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + error = rtrequest(RTM_ADD, (struct sockaddr *)&def, + (struct sockaddr *)&gate, (struct sockaddr *)&mask, + RTF_GATEWAY, &newrt); + if (newrt) { + nd6_rtmsg(RTM_ADD, newrt); /* tell user process */ + newrt->rt_refcnt--; + } + if (error == 0) + new->installed = 1; + splx(s); + return; +} + +/* Add a route to a given interface as default */ +static void +defrouter_addifreq(ifp) + struct ifnet *ifp; +{ + struct sockaddr_in6 def, mask; + struct ifaddr *ifa; + struct rtentry *newrt = NULL; + int error, flags; +#if (defined(__bsdi__) && _BSDI_VERSION >= 199802) + struct rt_addrinfo info; +#endif + + /* remove one if we have already installed one */ + if (nd6_defif_installed) + defrouter_delifreq(); + + bzero(&def, sizeof(def)); + bzero(&mask, sizeof(mask)); + + def.sin6_len = mask.sin6_len = sizeof(struct sockaddr_in6); + def.sin6_family = mask.sin6_family = AF_INET6; + + /* + * Search for an ifaddr beloging to the specified interface. + * XXX: An IPv6 address are required to be assigned on the interface. + */ + if ((ifa = ifaof_ifpforaddr((struct sockaddr *)&def, ifp)) == NULL) { + nd6log((LOG_ERR, /* better error? */ + "defrouter_addifreq: failed to find an ifaddr " + "to install a route to interface %s\n", + if_name(ifp))); + return; + } + + flags = ifa->ifa_flags; +#if (defined(__bsdi__) && _BSDI_VERSION >= 199802) + bzero(&info, sizeof(info)); + info.rti_info[RTAX_DST] = (struct sockaddr *)&def; + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)ifa->ifa_addr; + info.rti_info[RTAX_NETMASK] = (struct sockaddr *)&mask; + info.rti_info[RTAX_IFA] = (struct sockaddr *)ifa->ifa_addr; + info.rti_flags = flags; + error = rtrequest1(RTM_ADD, &info, &newrt); +#else + error = rtrequest(RTM_ADD, (struct sockaddr *)&def, ifa->ifa_addr, + (struct sockaddr *)&mask, flags, &newrt); +#endif + if (error != 0) { + nd6log((LOG_ERR, + "defrouter_addifreq: failed to install a route to " + "interface %s (errno = %d)\n", + if_name(ifp), error)); + + if (newrt) /* maybe unnecessary, but do it for safety */ + newrt->rt_refcnt--; + } else { + if (newrt) { + nd6_rtmsg(RTM_ADD, newrt); + newrt->rt_refcnt--; + } + } + + nd6_defif_installed = ifa; + IFAREF(ifa); +} + +/* Remove a default route points to interface */ +static void +defrouter_delifreq() +{ + struct sockaddr_in6 def, mask; + struct rtentry *oldrt = NULL; + + if (!nd6_defif_installed) + return; + + Bzero(&def, sizeof(def)); + Bzero(&mask, sizeof(mask)); + + def.sin6_len = mask.sin6_len = sizeof(struct sockaddr_in6); + def.sin6_family = mask.sin6_family = AF_INET6; + + rtrequest(RTM_DELETE, (struct sockaddr *)&def, + (struct sockaddr *)nd6_defif_installed->ifa_addr, + (struct sockaddr *)&mask, RTF_GATEWAY, &oldrt); + if (oldrt) { + nd6_rtmsg(RTM_DELETE, oldrt); + if (oldrt->rt_refcnt <= 0) { + /* + * XXX: borrowed from the RTM_DELETE case of + * rtrequest(). + */ + oldrt->rt_refcnt++; + rtfree(oldrt); + } + } + + IFAFREE(nd6_defif_installed); + nd6_defif_installed = NULL; +} + +struct nd_defrouter * +defrouter_lookup(addr, ifp) + struct in6_addr *addr; + struct ifnet *ifp; +{ + struct nd_defrouter *dr; + + for (dr = TAILQ_FIRST(&nd_defrouter); dr; + dr = TAILQ_NEXT(dr, dr_entry)) { + if (dr->ifp == ifp && IN6_ARE_ADDR_EQUAL(addr, &dr->rtaddr)) + return(dr); + } + + return(NULL); /* search failed */ +} + +void +defrtrlist_del(dr) + struct nd_defrouter *dr; +{ + struct nd_defrouter *deldr = NULL; + struct nd_prefix *pr; + + /* + * Flush all the routing table entries that use the router + * as a next hop. + */ + if (!ip6_forwarding && ip6_accept_rtadv) { + /* above is a good condition? */ + rt6_flush(&dr->rtaddr, dr->ifp); + } + + if (dr->installed) { + deldr = dr; + defrouter_delreq(dr); + } + TAILQ_REMOVE(&nd_defrouter, dr, dr_entry); + + /* + * Also delete all the pointers to the router in each prefix lists. + */ + for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + struct nd_pfxrouter *pfxrtr; + if ((pfxrtr = pfxrtr_lookup(pr, dr)) != NULL) + pfxrtr_del(pfxrtr); + } + pfxlist_onlink_check(); + + /* + * If the router is the primary one, choose a new one. + * Note that defrouter_select() will remove the current gateway + * from the routing table. + */ + if (deldr) + defrouter_select(); + + free(dr, M_IP6NDP); +} + +/* + * Remove the default route for a given router. + * This is just a subroutine function for defrouter_select(), and should + * not be called from anywhere else. + */ +static void +defrouter_delreq(dr) + struct nd_defrouter *dr; +{ + struct sockaddr_in6 def, mask, gw; + struct rtentry *oldrt = NULL; + + Bzero(&def, sizeof(def)); + Bzero(&mask, sizeof(mask)); + Bzero(&gw, sizeof(gw)); + + def.sin6_len = mask.sin6_len = gw.sin6_len = + sizeof(struct sockaddr_in6); + def.sin6_family = mask.sin6_family = gw.sin6_family = AF_INET6; + if (dr) + gw.sin6_addr = dr->rtaddr; + + rtrequest(RTM_DELETE, (struct sockaddr *)&def, + dr ? (struct sockaddr *)&gw : NULL, + (struct sockaddr *)&mask, RTF_GATEWAY, &oldrt); + if (oldrt) { + nd6_rtmsg(RTM_DELETE, oldrt); + if (oldrt->rt_refcnt <= 0) { + /* + * XXX: borrowed from the RTM_DELETE case of + * rtrequest(). + */ + oldrt->rt_refcnt++; + rtfree(oldrt); + } + } + + if (dr) + dr->installed = 0; +} + +/* + * remove all default routes from default router list + */ +void +defrouter_reset() +{ + struct nd_defrouter *dr; + + for (dr = TAILQ_FIRST(&nd_defrouter); dr; + dr = TAILQ_NEXT(dr, dr_entry)) + defrouter_delreq(dr); + defrouter_delifreq(); + + /* + * XXX should we also nuke any default routers in the kernel, by + * going through them by rtalloc1()? + */ +} + +/* + * Default Router Selection according to Section 6.3.6 of RFC 2461 and + * draft-ietf-ipngwg-router-selection: + * 1) Routers that are reachable or probably reachable should be preferred. + * If we have more than one (probably) reachable router, prefer ones + * with the highest router preference. + * 2) When no routers on the list are known to be reachable or + * probably reachable, routers SHOULD be selected in a round-robin + * fashion, regardless of router preference values. + * 3) If the Default Router List is empty, assume that all + * destinations are on-link. + * + * We assume nd_defrouter is sorted by router preference value. + * Since the code below covers both with and without router preference cases, + * we do not need to classify the cases by ifdef. + * + * At this moment, we do not try to install more than one default router, + * even when the multipath routing is available, because we're not sure about + * the benefits for stub hosts comparing to the risk of making the code + * complicated and the possibility of introducing bugs. + */ +void +defrouter_select() +{ +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + struct nd_defrouter *dr, *selected_dr = NULL, *installed_dr = NULL; + struct rtentry *rt = NULL; + struct llinfo_nd6 *ln = NULL; + + /* + * This function should be called only when acting as an autoconfigured + * host. Although the remaining part of this function is not effective + * if the node is not an autoconfigured host, we explicitly exclude + * such cases here for safety. + */ + if (ip6_forwarding || !ip6_accept_rtadv) { + nd6log((LOG_WARNING, + "defrouter_select: called unexpectedly (forwarding=%d, " + "accept_rtadv=%d)\n", ip6_forwarding, ip6_accept_rtadv)); + splx(s); + return; + } + + /* + * Let's handle easy case (3) first: + * If default router list is empty, we should probably install + * an interface route and assume that all destinations are on-link. + */ + if (!TAILQ_FIRST(&nd_defrouter)) { + /* + * XXX: The specification does not say this mechanism should + * be restricted to hosts, but this would be not useful + * (even harmful) for routers. + * This test is meaningless due to a test at the beginning of + * the function, but we intentionally keep it to make the note + * clear. + */ + if (!ip6_forwarding) { + if (nd6_defifp) { + /* + * Install a route to the default interface + * as default route. + */ + defrouter_addifreq(nd6_defifp); + } else { + /* + * purge the existing route. + * XXX: is this really correct? + */ + defrouter_delifreq(); + nd6log((LOG_INFO, "defrouter_select: " + "there's no default router and no default" + " interface\n")); + } + } + splx(s); + return; + } + + /* + * If we have a default route for the default interface, delete it. + * Note that the existence of the route is checked in the delete + * function. + */ + defrouter_delifreq(); + + /* + * Search for a (probably) reachable router from the list. + * We just pick up the first reachable one (if any), assuming that + * the ordering rule of the list described in defrtrlist_update(). + */ + for (dr = TAILQ_FIRST(&nd_defrouter); dr; + dr = TAILQ_NEXT(dr, dr_entry)) { + if (!selected_dr && + (rt = nd6_lookup(&dr->rtaddr, 0, dr->ifp)) && + (ln = (struct llinfo_nd6 *)rt->rt_llinfo) && + ND6_IS_LLINFO_PROBREACH(ln)) { + selected_dr = dr; + } + + if (dr->installed && !installed_dr) + installed_dr = dr; + else if (dr->installed && installed_dr) { + /* this should not happen. warn for diagnosis. */ + log(LOG_ERR, "defrouter_select: more than one router" + " is installed\n"); + } + } + /* + * If none of the default routers was found to be reachable, + * round-robin the list regardless of preference. + * Otherwise, if we have an installed router, check if the selected + * (reachable) router should really be preferred to the installed one. + * We only prefer the new router when the old one is not reachable + * or when the new one has a really higher preference value. + */ + if (!selected_dr) { + if (!installed_dr || !TAILQ_NEXT(installed_dr, dr_entry)) + selected_dr = TAILQ_FIRST(&nd_defrouter); + else + selected_dr = TAILQ_NEXT(installed_dr, dr_entry); + } else if (installed_dr && + (rt = nd6_lookup(&installed_dr->rtaddr, 0, + installed_dr->ifp)) && + (ln = (struct llinfo_nd6 *)rt->rt_llinfo) && + ND6_IS_LLINFO_PROBREACH(ln) && + rtpref(selected_dr) <= rtpref(installed_dr)) { + selected_dr = installed_dr; + } + + /* + * If the selected router is different than the installed one, + * remove the installed router and install the selected one. + * Note that the selected router is never NULL here. + */ + if (installed_dr != selected_dr) { + if (installed_dr) + defrouter_delreq(installed_dr); + defrouter_addreq(selected_dr); + } + + splx(s); + return; +} + +/* + * for default router selection + * regards router-preference field as a 2-bit signed integer + */ +static int +rtpref(struct nd_defrouter *dr) +{ +#ifdef RTPREF + switch (dr->flags & ND_RA_FLAG_RTPREF_MASK) { + case ND_RA_FLAG_RTPREF_HIGH: + return RTPREF_HIGH; + case ND_RA_FLAG_RTPREF_MEDIUM: + case ND_RA_FLAG_RTPREF_RSV: + return RTPREF_MEDIUM; + case ND_RA_FLAG_RTPREF_LOW: + return RTPREF_LOW; + default: + /* + * This case should never happen. If it did, it would mean a + * serious bug of kernel internal. We thus always bark here. + * Or, can we even panic? + */ + log(LOG_ERR, "rtpref: impossible RA flag %x", dr->flags); + return RTPREF_INVALID; + } + /* NOT REACH HERE */ +#else + return RTPREF_MEDIUM; +#endif +} + +static struct nd_defrouter * +defrtrlist_update(new) + struct nd_defrouter *new; +{ + struct nd_defrouter *dr, *n; +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + + if ((dr = defrouter_lookup(&new->rtaddr, new->ifp)) != NULL) { + /* entry exists */ + if (new->rtlifetime == 0) { + defrtrlist_del(dr); + dr = NULL; + } else { + int oldpref = rtpref(dr); + + /* override */ + dr->flags = new->flags; /* xxx flag check */ + dr->rtlifetime = new->rtlifetime; + dr->expire = new->expire; + + /* + * If the preference does not change, there's no need + * to sort the entries. + */ + if (rtpref(new) == oldpref) { + splx(s); + return(dr); + } + + /* + * preferred router may be changed, so relocate + * this router. + * XXX: calling TAILQ_REMOVE directly is a bad manner. + * However, since defrtrlist_del() has many side + * effects, we intentionally do so here. + * defrouter_select() below will handle routing + * changes later. + */ + TAILQ_REMOVE(&nd_defrouter, dr, dr_entry); + n = dr; + goto insert; + } + splx(s); + return(dr); + } + + /* entry does not exist */ + if (new->rtlifetime == 0) { + splx(s); + return(NULL); + } + + n = (struct nd_defrouter *)malloc(sizeof(*n), M_IP6NDP, M_NOWAIT); + if (n == NULL) { + splx(s); + return(NULL); + } + bzero(n, sizeof(*n)); + *n = *new; + +insert: + /* + * Insert the new router in the Default Router List; + * The Default Router List should be in the descending order + * of router-preferece. Routers with the same preference are + * sorted in the arriving time order. + */ + + /* insert at the end of the group */ + for (dr = TAILQ_FIRST(&nd_defrouter); dr; + dr = TAILQ_NEXT(dr, dr_entry)) { + if (rtpref(n) > rtpref(dr)) + break; + } + if (dr) + TAILQ_INSERT_BEFORE(dr, n, dr_entry); + else + TAILQ_INSERT_TAIL(&nd_defrouter, n, dr_entry); + + defrouter_select(); + + splx(s); + + return(n); +} + +static struct nd_pfxrouter * +pfxrtr_lookup(pr, dr) + struct nd_prefix *pr; + struct nd_defrouter *dr; +{ + struct nd_pfxrouter *search; + + for (search = pr->ndpr_advrtrs.lh_first; search; search = search->pfr_next) { + if (search->router == dr) + break; + } + + return(search); +} + +static void +pfxrtr_add(pr, dr) + struct nd_prefix *pr; + struct nd_defrouter *dr; +{ + struct nd_pfxrouter *new; + + new = (struct nd_pfxrouter *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT); + if (new == NULL) + return; + bzero(new, sizeof(*new)); + new->router = dr; + + LIST_INSERT_HEAD(&pr->ndpr_advrtrs, new, pfr_entry); + + pfxlist_onlink_check(); +} + +static void +pfxrtr_del(pfr) + struct nd_pfxrouter *pfr; +{ + LIST_REMOVE(pfr, pfr_entry); + free(pfr, M_IP6NDP); +} + +struct nd_prefix * +nd6_prefix_lookup(pr) + struct nd_prefix *pr; +{ + struct nd_prefix *search; + + for (search = nd_prefix.lh_first; search; search = search->ndpr_next) { + if (pr->ndpr_ifp == search->ndpr_ifp && + pr->ndpr_plen == search->ndpr_plen && + in6_are_prefix_equal(&pr->ndpr_prefix.sin6_addr, + &search->ndpr_prefix.sin6_addr, + pr->ndpr_plen) + ) { + break; + } + } + + return(search); +} + +int +nd6_prelist_add(pr, dr, newp) + struct nd_prefix *pr, **newp; + struct nd_defrouter *dr; +{ + struct nd_prefix *new = NULL; + int i, s; + + new = (struct nd_prefix *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT); + if (new == NULL) + return ENOMEM; + bzero(new, sizeof(*new)); + *new = *pr; + if (newp != NULL) + *newp = new; + + /* initilization */ + LIST_INIT(&new->ndpr_advrtrs); + in6_prefixlen2mask(&new->ndpr_mask, new->ndpr_plen); + /* make prefix in the canonical form */ + for (i = 0; i < 4; i++) + new->ndpr_prefix.sin6_addr.s6_addr32[i] &= + new->ndpr_mask.s6_addr32[i]; + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + /* link ndpr_entry to nd_prefix list */ + LIST_INSERT_HEAD(&nd_prefix, new, ndpr_entry); + splx(s); + + /* ND_OPT_PI_FLAG_ONLINK processing */ + if (new->ndpr_raf_onlink) { + int e; + + if ((e = nd6_prefix_onlink(new)) != 0) { + nd6log((LOG_ERR, "nd6_prelist_add: failed to make " + "the prefix %s/%d on-link on %s (errno=%d)\n", + ip6_sprintf(&pr->ndpr_prefix.sin6_addr), + pr->ndpr_plen, if_name(pr->ndpr_ifp), e)); + /* proceed anyway. XXX: is it correct? */ + } + } + + if (dr) + pfxrtr_add(new, dr); + + return 0; +} + +void +prelist_remove(pr) + struct nd_prefix *pr; +{ + struct nd_pfxrouter *pfr, *next; + int e, s; + + /* make sure to invalidate the prefix until it is really freed. */ + pr->ndpr_vltime = 0; + pr->ndpr_pltime = 0; +#if 0 + /* + * Though these flags are now meaningless, we'd rather keep the value + * not to confuse users when executing "ndp -p". + */ + pr->ndpr_raf_onlink = 0; + pr->ndpr_raf_auto = 0; +#endif + if ((pr->ndpr_stateflags & NDPRF_ONLINK) != 0 && + (e = nd6_prefix_offlink(pr)) != 0) { + nd6log((LOG_ERR, "prelist_remove: failed to make %s/%d offlink " + "on %s, errno=%d\n", + ip6_sprintf(&pr->ndpr_prefix.sin6_addr), + pr->ndpr_plen, if_name(pr->ndpr_ifp), e)); + /* what should we do? */ + } + + if (pr->ndpr_refcnt > 0) + return; /* notice here? */ + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + + /* unlink ndpr_entry from nd_prefix list */ + LIST_REMOVE(pr, ndpr_entry); + + /* free list of routers that adversed the prefix */ + for (pfr = pr->ndpr_advrtrs.lh_first; pfr; pfr = next) { + next = pfr->pfr_next; + + free(pfr, M_IP6NDP); + } + splx(s); + + free(pr, M_IP6NDP); + + pfxlist_onlink_check(); +} + +int +prelist_update(new, dr, m) + struct nd_prefix *new; + struct nd_defrouter *dr; /* may be NULL */ + struct mbuf *m; +{ + struct in6_ifaddr *ia6 = NULL, *ia6_match = NULL; + struct ifaddr *ifa; + struct ifnet *ifp = new->ndpr_ifp; + struct nd_prefix *pr; +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + int error = 0; + int newprefix = 0; + int auth; + struct in6_addrlifetime lt6_tmp; + + auth = 0; + if (m) { + /* + * Authenticity for NA consists authentication for + * both IP header and IP datagrams, doesn't it ? + */ +#if defined(M_AUTHIPHDR) && defined(M_AUTHIPDGM) + auth = (m->m_flags & M_AUTHIPHDR + && m->m_flags & M_AUTHIPDGM) ? 1 : 0; +#endif + } + + if ((pr = nd6_prefix_lookup(new)) != NULL) { + /* + * nd6_prefix_lookup() ensures that pr and new have the same + * prefix on a same interface. + */ + + /* + * Update prefix information. Note that the on-link (L) bit + * and the autonomous (A) bit should NOT be changed from 1 + * to 0. + */ + if (new->ndpr_raf_onlink == 1) + pr->ndpr_raf_onlink = 1; + if (new->ndpr_raf_auto == 1) + pr->ndpr_raf_auto = 1; + if (new->ndpr_raf_onlink) { + pr->ndpr_vltime = new->ndpr_vltime; + pr->ndpr_pltime = new->ndpr_pltime; + pr->ndpr_preferred = new->ndpr_preferred; + pr->ndpr_expire = new->ndpr_expire; + pr->ndpr_lastupdate = new->ndpr_lastupdate; + } + + if (new->ndpr_raf_onlink && + (pr->ndpr_stateflags & NDPRF_ONLINK) == 0) { + int e; + + if ((e = nd6_prefix_onlink(pr)) != 0) { + nd6log((LOG_ERR, + "prelist_update: failed to make " + "the prefix %s/%d on-link on %s " + "(errno=%d)\n", + ip6_sprintf(&pr->ndpr_prefix.sin6_addr), + pr->ndpr_plen, if_name(pr->ndpr_ifp), e)); + /* proceed anyway. XXX: is it correct? */ + } + } + + if (dr && pfxrtr_lookup(pr, dr) == NULL) + pfxrtr_add(pr, dr); + } else { + struct nd_prefix *newpr = NULL; + + newprefix = 1; + + if (new->ndpr_vltime == 0) + goto end; + if (new->ndpr_raf_onlink == 0 && new->ndpr_raf_auto == 0) + goto end; + + error = nd6_prelist_add(new, dr, &newpr); + if (error != 0 || newpr == NULL) { + nd6log((LOG_NOTICE, "prelist_update: " + "nd6_prelist_add failed for %s/%d on %s " + "errno=%d, returnpr=%p\n", + ip6_sprintf(&new->ndpr_prefix.sin6_addr), + new->ndpr_plen, if_name(new->ndpr_ifp), + error, newpr)); + goto end; /* we should just give up in this case. */ + } + + /* + * XXX: from the ND point of view, we can ignore a prefix + * with the on-link bit being zero. However, we need a + * prefix structure for references from autoconfigured + * addresses. Thus, we explicitly make sure that the prefix + * itself expires now. + */ + if (newpr->ndpr_raf_onlink == 0) { + newpr->ndpr_vltime = 0; + newpr->ndpr_pltime = 0; + in6_init_prefix_ltimes(newpr); + } + + pr = newpr; + } + + /* + * Address autoconfiguration based on Section 5.5.3 of RFC 2462. + * Note that pr must be non NULL at this point. + */ + + /* 5.5.3 (a). Ignore the prefix without the A bit set. */ + if (!new->ndpr_raf_auto) + goto end; + + /* + * 5.5.3 (b). the link-local prefix should have been ignored in + * nd6_ra_input. + */ + + /* + * 5.5.3 (c). Consistency check on lifetimes: pltime <= vltime. + * This should have been done in nd6_ra_input. + */ + + /* + * 5.5.3 (d). If the prefix advertised does not match the prefix of an + * address already in the list, and the Valid Lifetime is not 0, + * form an address. Note that even a manually configured address + * should reject autoconfiguration of a new address. + */ +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) +#endif + { + struct in6_ifaddr *ifa6; + int ifa_plen; + u_int32_t storedlifetime; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + + ifa6 = (struct in6_ifaddr *)ifa; + + /* + * Spec is not clear here, but I believe we should concentrate + * on unicast (i.e. not anycast) addresses. + * XXX: other ia6_flags? detached or duplicated? + */ + if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0) + continue; + + ifa_plen = in6_mask2len(&ifa6->ia_prefixmask.sin6_addr, NULL); + if (ifa_plen != new->ndpr_plen || + !in6_are_prefix_equal(&ifa6->ia_addr.sin6_addr, + &new->ndpr_prefix.sin6_addr, + ifa_plen)) + continue; + + if (ia6_match == NULL) /* remember the first one */ + ia6_match = ifa6; + + if ((ifa6->ia6_flags & IN6_IFF_AUTOCONF) == 0) + continue; + + /* + * An already autoconfigured address matched. Now that we + * are sure there is at least one matched address, we can + * proceed to 5.5.3. (e): update the lifetimes according to the + * "two hours" rule and the privacy extension. + */ +#define TWOHOUR (120*60) + /* + * RFC2462 introduces the notion of StoredLifetime to the + * "two hours" rule as follows: + * the Lifetime associated with the previously autoconfigured + * address. + * Our interpretation of this definition is "the remaining + * lifetime to expiration at the evaluation time". One might + * be wondering if this interpretation is really conform to the + * RFC, because the text can read that "Lifetimes" are never + * decreased, and our definition of the "storedlifetime" below + * essentially reduces the "Valid Lifetime" advertised in the + * previous RA. But, this is due to the wording of the text, + * and our interpretation is the same as an author's intention. + * See the discussion in the IETF ipngwg ML in August 2001, + * with the Subject "StoredLifetime in RFC 2462". + */ + lt6_tmp = ifa6->ia6_lifetime; + if (lt6_tmp.ia6t_vltime == ND6_INFINITE_LIFETIME) + storedlifetime = ND6_INFINITE_LIFETIME; + else if (time_second - ifa6->ia6_updatetime > + lt6_tmp.ia6t_vltime) { + /* + * The case of "invalid" address. We should usually + * not see this case. + */ + storedlifetime = 0; + } else + storedlifetime = lt6_tmp.ia6t_vltime - + (time_second - ifa6->ia6_updatetime); + if (TWOHOUR < new->ndpr_vltime || + storedlifetime < new->ndpr_vltime) { + lt6_tmp.ia6t_vltime = new->ndpr_vltime; + } else if (storedlifetime <= TWOHOUR +#if 0 + /* + * This condition is logically redundant, so we just + * omit it. + * See IPng 6712, 6717, and 6721. + */ + && new->ndpr_vltime <= storedlifetime +#endif + ) { + if (auth) { + lt6_tmp.ia6t_vltime = new->ndpr_vltime; + } + } else { + /* + * new->ndpr_vltime <= TWOHOUR && + * TWOHOUR < storedlifetime + */ + lt6_tmp.ia6t_vltime = TWOHOUR; + } + + /* The 2 hour rule is not imposed for preferred lifetime. */ + lt6_tmp.ia6t_pltime = new->ndpr_pltime; + + in6_init_address_ltimes(pr, <6_tmp); + + /* + * We need to treat lifetimes for temporary addresses + * differently, according to + * draft-ietf-ipngwg-temp-addresses-v2-00.txt 3.3 (1); + * we only update the lifetimes when they are in the maximum + * intervals. + */ + if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0) { + u_int32_t maxvltime, maxpltime; + + if (ip6_temp_valid_lifetime > + (u_int32_t)(time_second - ifa6->ia6_createtime)) { + maxvltime = ip6_temp_valid_lifetime - + (time_second - ifa6->ia6_createtime); + } else + maxvltime = 0; + if (ip6_temp_preferred_lifetime > + (u_int32_t)((time_second - ifa6->ia6_createtime) + + ip6_desync_factor)) { + maxpltime = ip6_temp_preferred_lifetime - + (time_second - ifa6->ia6_createtime) - + ip6_desync_factor; + } else + maxpltime = 0; + + if (lt6_tmp.ia6t_vltime == ND6_INFINITE_LIFETIME || + lt6_tmp.ia6t_vltime > maxvltime) { + lt6_tmp.ia6t_vltime = maxvltime; + } + if (lt6_tmp.ia6t_pltime == ND6_INFINITE_LIFETIME || + lt6_tmp.ia6t_pltime > maxpltime) { + lt6_tmp.ia6t_pltime = maxpltime; + } + } + + ifa6->ia6_lifetime = lt6_tmp; + ifa6->ia6_updatetime = time_second; + } + if (ia6_match == NULL && new->ndpr_vltime) { + /* + * No address matched and the valid lifetime is non-zero. + * Create a new address. + */ + if ((ia6 = in6_ifadd(new)) != NULL) { + /* + * note that we should use pr (not new) for reference. + */ + pr->ndpr_refcnt++; + ia6->ia6_ndpr = pr; + + /* + * draft-ietf-ipngwg-temp-addresses-v2-00 3.3 (2). + * When a new public address is created as described + * in RFC2462, also create a new temporary address. + * + * draft-ietf-ipngwg-temp-addresses-v2-00 3.5. + * When an interface connects to a new link, a new + * randomized interface identifier should be generated + * immediately together with a new set of temporary + * addresses. Thus, we specifiy 1 as the 2nd arg of + * in6_tmpifadd(). + */ + if (ip6_use_tempaddr) { + int e; + if ((e = in6_tmpifadd(ia6, 1)) != 0) { + nd6log((LOG_NOTICE, "prelist_update: " + "failed to create a temporary " + "address, errno=%d\n", + e)); + } + } + + /* + * A newly added address might affect the status + * of other addresses, so we check and update it. + * XXX: what if address duplication happens? + */ + pfxlist_onlink_check(); + } else { + /* just set an error. do not bark here. */ + error = EADDRNOTAVAIL; /* XXX: might be unused. */ + } + } + + end: + splx(s); + return error; +} + +/* + * A supplement function used in the on-link detection below; + * detect if a given prefix has a (probably) reachable advertising router. + * XXX: lengthy function name... + */ +static struct nd_pfxrouter * +find_pfxlist_reachable_router(pr) + struct nd_prefix *pr; +{ + struct nd_pfxrouter *pfxrtr; + struct rtentry *rt; + struct llinfo_nd6 *ln; + + for (pfxrtr = LIST_FIRST(&pr->ndpr_advrtrs); pfxrtr; + pfxrtr = LIST_NEXT(pfxrtr, pfr_entry)) { + if ((rt = nd6_lookup(&pfxrtr->router->rtaddr, 0, + pfxrtr->router->ifp)) && + (ln = (struct llinfo_nd6 *)rt->rt_llinfo) && + ND6_IS_LLINFO_PROBREACH(ln)) + break; /* found */ + } + + return(pfxrtr); + +} + +/* + * Check if each prefix in the prefix list has at least one available router + * that advertised the prefix (a router is "available" if its neighbor cache + * entry is reachable or probably reachable). + * If the check fails, the prefix may be off-link, because, for example, + * we have moved from the network but the lifetime of the prefix has not + * expired yet. So we should not use the prefix if there is another prefix + * that has an available router. + * But, if there is no prefix that has an available router, we still regards + * all the prefixes as on-link. This is because we can't tell if all the + * routers are simply dead or if we really moved from the network and there + * is no router around us. + */ +void +pfxlist_onlink_check() +{ + struct nd_prefix *pr; + struct in6_ifaddr *ifa; + + /* + * Check if there is a prefix that has a reachable advertising + * router. + */ + for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + if (pr->ndpr_raf_onlink && find_pfxlist_reachable_router(pr)) + break; + } + + if (pr != NULL || TAILQ_FIRST(&nd_defrouter) != NULL) { + /* + * There is at least one prefix that has a reachable router, + * or at least a router which probably does not advertise + * any prefixes. The latter would be the case when we move + * to a new link where we have a router that does not provide + * prefixes and we configure an address by hand. + * Detach prefixes which have no reachable advertising + * router, and attach other prefixes. + */ + for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + /* XXX: a link-local prefix should never be detached */ + if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr)) + continue; + + /* + * we aren't interested in prefixes without the L bit + * set. + */ + if (pr->ndpr_raf_onlink == 0) + continue; + + if ((pr->ndpr_stateflags & NDPRF_DETACHED) == 0 && + find_pfxlist_reachable_router(pr) == NULL) + pr->ndpr_stateflags |= NDPRF_DETACHED; + if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0 && + find_pfxlist_reachable_router(pr) != 0) + pr->ndpr_stateflags &= ~NDPRF_DETACHED; + } + } else { + /* there is no prefix that has a reachable router */ + for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr)) + continue; + + if (pr->ndpr_raf_onlink == 0) + continue; + + if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0) + pr->ndpr_stateflags &= ~NDPRF_DETACHED; + } + } + + /* + * Remove each interface route associated with a (just) detached + * prefix, and reinstall the interface route for a (just) attached + * prefix. Note that all attempt of reinstallation does not + * necessarily success, when a same prefix is shared among multiple + * interfaces. Such cases will be handled in nd6_prefix_onlink, + * so we don't have to care about them. + */ + for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) { + int e; + + if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr)) + continue; + + if (pr->ndpr_raf_onlink == 0) + continue; + + if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0 && + (pr->ndpr_stateflags & NDPRF_ONLINK) != 0) { + if ((e = nd6_prefix_offlink(pr)) != 0) { + nd6log((LOG_ERR, + "pfxlist_onlink_check: failed to " + "make %s/%d offlink, errno=%d\n", + ip6_sprintf(&pr->ndpr_prefix.sin6_addr), + pr->ndpr_plen, e)); + } + } + if ((pr->ndpr_stateflags & NDPRF_DETACHED) == 0 && + (pr->ndpr_stateflags & NDPRF_ONLINK) == 0 && + pr->ndpr_raf_onlink) { + if ((e = nd6_prefix_onlink(pr)) != 0) { + nd6log((LOG_ERR, + "pfxlist_onlink_check: failed to " + "make %s/%d offlink, errno=%d\n", + ip6_sprintf(&pr->ndpr_prefix.sin6_addr), + pr->ndpr_plen, e)); + } + } + } + + /* + * Changes on the prefix status might affect address status as well. + * Make sure that all addresses derived from an attached prefix are + * attached, and that all addresses derived from a detached prefix are + * detached. Note, however, that a manually configured address should + * always be attached. + * The precise detection logic is same as the one for prefixes. + */ + for (ifa = in6_ifaddr; ifa; ifa = ifa->ia_next) { + if (!(ifa->ia6_flags & IN6_IFF_AUTOCONF)) + continue; + + if (ifa->ia6_ndpr == NULL) { + /* + * This can happen when we first configure the address + * (i.e. the address exists, but the prefix does not). + * XXX: complicated relationships... + */ + continue; + } + + if (find_pfxlist_reachable_router(ifa->ia6_ndpr)) + break; + } + if (ifa) { + for (ifa = in6_ifaddr; ifa; ifa = ifa->ia_next) { + if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0) + continue; + + if (ifa->ia6_ndpr == NULL) /* XXX: see above. */ + continue; + + if (find_pfxlist_reachable_router(ifa->ia6_ndpr)) + ifa->ia6_flags &= ~IN6_IFF_DETACHED; + else + ifa->ia6_flags |= IN6_IFF_DETACHED; + } + } + else { + for (ifa = in6_ifaddr; ifa; ifa = ifa->ia_next) { + if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0) + continue; + + ifa->ia6_flags &= ~IN6_IFF_DETACHED; + } + } + +#ifdef MIP6 + if (MIP6_IS_MN) { + int coa_changed = 0; + + hif_save_location(); + coa_changed = mip6_select_coa2(); + (void)mip6_process_pfxlist_status_change(&hif_coa); + if (coa_changed == 1) + mip6_process_movement(); + else + hif_restore_location(); + } +#endif /* MIP6 */ +} + +int +nd6_prefix_onlink(pr) + struct nd_prefix *pr; +{ + struct ifaddr *ifa; + struct ifnet *ifp = pr->ndpr_ifp; + struct sockaddr_in6 mask6; + struct nd_prefix *opr; + u_long rtflags; + int error = 0; + struct rtentry *rt = NULL; + + /* sanity check */ + if ((pr->ndpr_stateflags & NDPRF_ONLINK) != 0) { + nd6log((LOG_ERR, + "nd6_prefix_onlink: %s/%d is already on-link\n", + ip6_sprintf(&pr->ndpr_prefix.sin6_addr), pr->ndpr_plen); + return(EEXIST)); + } + + /* + * Add the interface route associated with the prefix. Before + * installing the route, check if there's the same prefix on another + * interface, and the prefix has already installed the interface route. + * Although such a configuration is expected to be rare, we explicitly + * allow it. + */ + for (opr = nd_prefix.lh_first; opr; opr = opr->ndpr_next) { + if (opr == pr) + continue; + + if ((opr->ndpr_stateflags & NDPRF_ONLINK) == 0) + continue; + + if (opr->ndpr_plen == pr->ndpr_plen && + in6_are_prefix_equal(&pr->ndpr_prefix.sin6_addr, + &opr->ndpr_prefix.sin6_addr, + pr->ndpr_plen)) + return(0); + } + + /* + * We prefer link-local addresses as the associated interface address. + */ + /* search for a link-local addr */ + ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, + IN6_IFF_NOTREADY| + IN6_IFF_ANYCAST); + if (ifa == NULL) { + /* XXX: freebsd does not have ifa_ifwithaf */ +#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) + for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) +#elif defined(__FreeBSD__) && __FreeBSD__ >= 4 + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) +#else + for (ifa = ifp->if_addrlist.tqh_first; + ifa; + ifa = ifa->ifa_list.tqe_next) +#endif + { + if (ifa->ifa_addr->sa_family == AF_INET6) + break; + } + /* should we care about ia6_flags? */ + } + if (ifa == NULL) { + /* + * This can still happen, when, for example, we receive an RA + * containing a prefix with the L bit set and the A bit clear, + * after removing all IPv6 addresses on the receiving + * interface. This should, of course, be rare though. + */ + nd6log((LOG_NOTICE, + "nd6_prefix_onlink: failed to find any ifaddr" + " to add route for a prefix(%s/%d) on %s\n", + ip6_sprintf(&pr->ndpr_prefix.sin6_addr), + pr->ndpr_plen, if_name(ifp))); + return(0); + } + + /* + * in6_ifinit() sets nd6_rtrequest to ifa_rtrequest for all ifaddrs. + * ifa->ifa_rtrequest = nd6_rtrequest; + */ + bzero(&mask6, sizeof(mask6)); + mask6.sin6_len = sizeof(mask6); + mask6.sin6_addr = pr->ndpr_mask; + /* rtrequest() will probably set RTF_UP, but we're not sure. */ + rtflags = ifa->ifa_flags | RTF_UP; + if (nd6_need_cache(ifp)) { + /* explicitly set in case ifa_flags does not set the flag. */ + rtflags |= RTF_CLONING; + } else { + /* + * explicitly clear the cloning bit in case ifa_flags sets it. + */ + rtflags &= ~RTF_CLONING; + } + error = rtrequest(RTM_ADD, (struct sockaddr *)&pr->ndpr_prefix, + ifa->ifa_addr, (struct sockaddr *)&mask6, + rtflags, &rt); + if (error == 0) { + if (rt != NULL) /* this should be non NULL, though */ + nd6_rtmsg(RTM_ADD, rt); + pr->ndpr_stateflags |= NDPRF_ONLINK; + } + else { + nd6log((LOG_ERR, "nd6_prefix_onlink: failed to add route for a" + " prefix (%s/%d) on %s, gw=%s, mask=%s, flags=%lx " + "errno = %d\n", + ip6_sprintf(&pr->ndpr_prefix.sin6_addr), + pr->ndpr_plen, if_name(ifp), + ip6_sprintf(&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr), + ip6_sprintf(&mask6.sin6_addr), rtflags, error)); + } + + if (rt != NULL) + rt->rt_refcnt--; + + return(error); +} + +int +nd6_prefix_offlink(pr) + struct nd_prefix *pr; +{ + int error = 0; + struct ifnet *ifp = pr->ndpr_ifp; + struct nd_prefix *opr; + struct sockaddr_in6 sa6, mask6; + struct rtentry *rt = NULL; + + /* sanity check */ + if ((pr->ndpr_stateflags & NDPRF_ONLINK) == 0) { + nd6log((LOG_ERR, + "nd6_prefix_offlink: %s/%d is already off-link\n", + ip6_sprintf(&pr->ndpr_prefix.sin6_addr), pr->ndpr_plen)); + return(EEXIST); + } + + bzero(&sa6, sizeof(sa6)); + sa6.sin6_family = AF_INET6; + sa6.sin6_len = sizeof(sa6); + bcopy(&pr->ndpr_prefix.sin6_addr, &sa6.sin6_addr, + sizeof(struct in6_addr)); + bzero(&mask6, sizeof(mask6)); + mask6.sin6_family = AF_INET6; + mask6.sin6_len = sizeof(sa6); + bcopy(&pr->ndpr_mask, &mask6.sin6_addr, sizeof(struct in6_addr)); + error = rtrequest(RTM_DELETE, (struct sockaddr *)&sa6, NULL, + (struct sockaddr *)&mask6, 0, &rt); + if (error == 0) { + pr->ndpr_stateflags &= ~NDPRF_ONLINK; + + /* report the route deletion to the routing socket. */ + if (rt != NULL) + nd6_rtmsg(RTM_DELETE, rt); + + /* + * There might be the same prefix on another interface, + * the prefix which could not be on-link just because we have + * the interface route (see comments in nd6_prefix_onlink). + * If there's one, try to make the prefix on-link on the + * interface. + */ + for (opr = nd_prefix.lh_first; opr; opr = opr->ndpr_next) { + if (opr == pr) + continue; + + if ((opr->ndpr_stateflags & NDPRF_ONLINK) != 0) + continue; + + /* + * KAME specific: detached prefixes should not be + * on-link. + */ + if ((opr->ndpr_stateflags & NDPRF_DETACHED) != 0) + continue; + + if (opr->ndpr_plen == pr->ndpr_plen && + in6_are_prefix_equal(&pr->ndpr_prefix.sin6_addr, + &opr->ndpr_prefix.sin6_addr, + pr->ndpr_plen)) { + int e; + + if ((e = nd6_prefix_onlink(opr)) != 0) { + nd6log((LOG_ERR, + "nd6_prefix_offlink: failed to " + "recover a prefix %s/%d from %s " + "to %s (errno = %d)\n", + ip6_sprintf(&opr->ndpr_prefix.sin6_addr), + opr->ndpr_plen, if_name(ifp), + if_name(opr->ndpr_ifp), e)); + } + } + } + } + else { + /* XXX: can we still set the NDPRF_ONLINK flag? */ + nd6log((LOG_ERR, + "nd6_prefix_offlink: failed to delete route: " + "%s/%d on %s (errno = %d)\n", + ip6_sprintf(&sa6.sin6_addr), pr->ndpr_plen, if_name(ifp), + error)); + } + + if (rt != NULL) { + if (rt->rt_refcnt <= 0) { + /* XXX: we should free the entry ourselves. */ + rt->rt_refcnt++; + rtfree(rt); + } + } + + return(error); +} + +static struct in6_ifaddr * +in6_ifadd(pr) + struct nd_prefix *pr; +{ + struct ifnet *ifp = pr->ndpr_ifp; + struct ifaddr *ifa; + struct in6_aliasreq ifra; + struct in6_ifaddr *ia, *ib; + int error, plen0; + struct in6_addr mask; + int prefixlen = pr->ndpr_plen; + + in6_prefixlen2mask(&mask, prefixlen); + + /* + * find a link-local address (will be interface ID). + * Is it really mandatory? Theoretically, a global or a site-local + * address can be configured without a link-local address, if we + * have a unique interface identifier... + * + * it is not mandatory to have a link-local address, we can generate + * interface identifier on the fly. we do this because: + * (1) it should be the easiest way to find interface identifier. + * (2) RFC2462 5.4 suggesting the use of the same interface identifier + * for multiple addresses on a single interface, and possible shortcut + * of DAD. we omitted DAD for this reason in the past. + * (3) a user can prevent autoconfiguration of global address + * by removing link-local address by hand (this is partly because we + * don't have other way to control the use of IPv6 on a interface. + * this has been our design choice - cf. NRL's "ifconfig auto"). + * (4) it is easier to manage when an interface has addresses + * with the same interface identifier, than to have multiple addresses + * with different interface identifiers. + */ + ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, 0); /* 0 is OK? */ + if (ifa) + ib = (struct in6_ifaddr *)ifa; + else + return NULL; + +#if 0 /* don't care link local addr state, and always do DAD */ + /* if link-local address is not eligible, do not autoconfigure. */ + if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_NOTREADY) { + printf("in6_ifadd: link-local address not ready\n"); + return NULL; + } +#endif + + /* prefixlen + ifidlen must be equal to 128 */ + plen0 = in6_mask2len(&ib->ia_prefixmask.sin6_addr, NULL); + if (prefixlen != plen0) { + nd6log((LOG_INFO, "in6_ifadd: wrong prefixlen for %s " + "(prefix=%d ifid=%d)\n", + if_name(ifp), prefixlen, 128 - plen0)); + return NULL; + } + + /* make ifaddr */ + + bzero(&ifra, sizeof(ifra)); + /* + * in6_update_ifa() does not use ifra_name, but we accurately set it + * for safety. + */ + strncpy(ifra.ifra_name, if_name(ifp), sizeof(ifra.ifra_name)); + ifra.ifra_addr.sin6_family = AF_INET6; + ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); + /* prefix */ + bcopy(&pr->ndpr_prefix.sin6_addr, &ifra.ifra_addr.sin6_addr, + sizeof(ifra.ifra_addr.sin6_addr)); + ifra.ifra_addr.sin6_addr.s6_addr32[0] &= mask.s6_addr32[0]; + ifra.ifra_addr.sin6_addr.s6_addr32[1] &= mask.s6_addr32[1]; + ifra.ifra_addr.sin6_addr.s6_addr32[2] &= mask.s6_addr32[2]; + ifra.ifra_addr.sin6_addr.s6_addr32[3] &= mask.s6_addr32[3]; + + /* interface ID */ + ifra.ifra_addr.sin6_addr.s6_addr32[0] |= + (ib->ia_addr.sin6_addr.s6_addr32[0] & ~mask.s6_addr32[0]); + ifra.ifra_addr.sin6_addr.s6_addr32[1] |= + (ib->ia_addr.sin6_addr.s6_addr32[1] & ~mask.s6_addr32[1]); + ifra.ifra_addr.sin6_addr.s6_addr32[2] |= + (ib->ia_addr.sin6_addr.s6_addr32[2] & ~mask.s6_addr32[2]); + ifra.ifra_addr.sin6_addr.s6_addr32[3] |= + (ib->ia_addr.sin6_addr.s6_addr32[3] & ~mask.s6_addr32[3]); + + /* new prefix mask. */ + ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); + ifra.ifra_prefixmask.sin6_family = AF_INET6; + bcopy(&mask, &ifra.ifra_prefixmask.sin6_addr, + sizeof(ifra.ifra_prefixmask.sin6_addr)); + + /* + * lifetime. + * XXX: in6_init_address_ltimes would override these values later. + * We should reconsider this logic. + */ + ifra.ifra_lifetime.ia6t_vltime = pr->ndpr_vltime; + ifra.ifra_lifetime.ia6t_pltime = pr->ndpr_pltime; + + /* XXX: scope zone ID? */ + + ifra.ifra_flags |= IN6_IFF_AUTOCONF; /* obey autoconf */ + + /* allocate ifaddr structure, link into chain, etc. */ + if ((error = in6_update_ifa(ifp, &ifra, NULL)) != 0) { + nd6log((LOG_ERR, + "in6_ifadd: failed to make ifaddr %s on %s (errno=%d)\n", + ip6_sprintf(&ifra.ifra_addr.sin6_addr), if_name(ifp), + error)); + return(NULL); /* ifaddr must not have been allocated. */ + } + + ia = in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr); + + return(ia); /* this is always non-NULL */ +} + +int +in6_tmpifadd(ia0, forcegen) + const struct in6_ifaddr *ia0; /* corresponding public address */ + int forcegen; +{ + struct ifnet *ifp = ia0->ia_ifa.ifa_ifp; + struct in6_ifaddr *newia, *ia; + struct in6_aliasreq ifra; + int i, error; + int trylimit = 3; /* XXX: adhoc value */ + u_int32_t randid[2]; + u_int32_t vltime0, pltime0; +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + time_t time_second = (time_t)time.tv_sec; +#endif + + bzero(&ifra, sizeof(ifra)); + strncpy(ifra.ifra_name, if_name(ifp), sizeof(ifra.ifra_name)); + ifra.ifra_addr = ia0->ia_addr; + /* copy prefix mask */ + ifra.ifra_prefixmask = ia0->ia_prefixmask; + /* clear the old IFID */ + for (i = 0; i < 4; i++) { + ifra.ifra_addr.sin6_addr.s6_addr32[i] + &= ifra.ifra_prefixmask.sin6_addr.s6_addr32[i]; + } + + again: + if (in6_get_tmpifid(ifp, (u_int8_t *)randid, + (const u_int8_t *)&ia0->ia_addr.sin6_addr.s6_addr[8], + forcegen)) { + nd6log((LOG_NOTICE, "in6_tmpifadd: failed to find a good " + "random IFID\n")); + return(EINVAL); + } + ifra.ifra_addr.sin6_addr.s6_addr32[2] + |= (randid[0] & ~(ifra.ifra_prefixmask.sin6_addr.s6_addr32[2])); + ifra.ifra_addr.sin6_addr.s6_addr32[3] + |= (randid[1] & ~(ifra.ifra_prefixmask.sin6_addr.s6_addr32[3])); + + /* + * in6_get_tmpifid() quite likely provided a unique interface ID. + * However, we may still have a chance to see collision, because + * there may be a time lag between generation of the ID and generation + * of the address. So, we'll do one more sanity check. + */ + for (ia = in6_ifaddr; ia; ia = ia->ia_next) { + if (SA6_ARE_ADDR_EQUAL(&ia->ia_addr, + &ifra.ifra_addr)) { + if (trylimit-- == 0) { + /* + * Give up. Something strange should have + * happened. + */ + nd6log((LOG_NOTICE, "in6_tmpifadd: failed to " + "find a unique random IFID\n")); + return(EEXIST); + } + forcegen = 1; + goto again; + } + } + + /* + * The Valid Lifetime is the lower of the Valid Lifetime of the + * public address or TEMP_VALID_LIFETIME. + * The Preferred Lifetime is the lower of the Preferred Lifetime + * of the public address or TEMP_PREFERRED_LIFETIME - + * DESYNC_FACTOR. + */ + if (ia0->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { + vltime0 = IFA6_IS_INVALID(ia0) ? 0 : + (ia0->ia6_lifetime.ia6t_vltime - + (time_second - ia0->ia6_updatetime)); + if (vltime0 > ip6_temp_valid_lifetime) + vltime0 = ip6_temp_valid_lifetime; + } else + vltime0 = ip6_temp_valid_lifetime; + if (ia0->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { + pltime0 = IFA6_IS_DEPRECATED(ia0) ? 0 : + (ia0->ia6_lifetime.ia6t_pltime - + (time_second - ia0->ia6_updatetime)); + if (pltime0 > ip6_temp_preferred_lifetime - ip6_desync_factor){ + pltime0 = ip6_temp_preferred_lifetime - + ip6_desync_factor; + } + } else + pltime0 = ip6_temp_preferred_lifetime - ip6_desync_factor; + ifra.ifra_lifetime.ia6t_vltime = vltime0; + ifra.ifra_lifetime.ia6t_pltime = pltime0; + + /* + * A temporary address is created only if this calculated Preferred + * Lifetime is greater than REGEN_ADVANCE time units. + */ + if (ifra.ifra_lifetime.ia6t_pltime <= ip6_temp_regen_advance) + return(0); + + /* XXX: scope zone ID? */ + + ifra.ifra_flags |= (IN6_IFF_AUTOCONF|IN6_IFF_TEMPORARY); + + /* allocate ifaddr structure, link into chain, etc. */ + if ((error = in6_update_ifa(ifp, &ifra, NULL)) != 0) + return(error); + + newia = in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr); + if (newia == NULL) { /* XXX: can it happen? */ + nd6log((LOG_ERR, + "in6_tmpifadd: ifa update succeeded, but we got " + "no ifaddr\n")); + return(EINVAL); /* XXX */ + } + newia->ia6_ndpr = ia0->ia6_ndpr; + newia->ia6_ndpr->ndpr_refcnt++; + + /* + * A newly added address might affect the status of other addresses. + * XXX: when the temporary address is generated with a new public + * address, the onlink check is redundant. However, it would be safe + * to do the check explicitly everywhere a new address is generated, + * and, in fact, we surely need the check when we create a new + * temporary address due to deprecation of an old temporary address. + */ + pfxlist_onlink_check(); + + return(0); +} + +int +in6_init_prefix_ltimes(struct nd_prefix *ndpr) +{ +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + + /* check if preferred lifetime > valid lifetime. RFC2462 5.5.3 (c) */ + if (ndpr->ndpr_pltime > ndpr->ndpr_vltime) { + nd6log((LOG_INFO, "in6_init_prefix_ltimes: preferred lifetime" + "(%d) is greater than valid lifetime(%d)\n", + (u_int)ndpr->ndpr_pltime, (u_int)ndpr->ndpr_vltime)); + return (EINVAL); + } + if (ndpr->ndpr_pltime == ND6_INFINITE_LIFETIME) + ndpr->ndpr_preferred = 0; + else + ndpr->ndpr_preferred = time_second + ndpr->ndpr_pltime; + if (ndpr->ndpr_vltime == ND6_INFINITE_LIFETIME) + ndpr->ndpr_expire = 0; + else + ndpr->ndpr_expire = time_second + ndpr->ndpr_vltime; + + return 0; +} + +static void +in6_init_address_ltimes(struct nd_prefix *new, struct in6_addrlifetime *lt6) +{ +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + long time_second = time.tv_sec; +#endif + + /* Valid lifetime must not be updated unless explicitly specified. */ + /* init ia6t_expire */ + if (lt6->ia6t_vltime == ND6_INFINITE_LIFETIME) + lt6->ia6t_expire = 0; + else { + lt6->ia6t_expire = time_second; + lt6->ia6t_expire += lt6->ia6t_vltime; + } + + /* init ia6t_preferred */ + if (lt6->ia6t_pltime == ND6_INFINITE_LIFETIME) + lt6->ia6t_preferred = 0; + else { + lt6->ia6t_preferred = time_second; + lt6->ia6t_preferred += lt6->ia6t_pltime; + } +} + +/* + * Delete all the routing table entries that use the specified gateway. + * XXX: this function causes search through all entries of routing table, so + * it shouldn't be called when acting as a router. + */ +void +rt6_flush(gateway, ifp) + struct in6_addr *gateway; + struct ifnet *ifp; +{ + struct radix_node_head *rnh = rt_tables[AF_INET6]; +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + + /* We'll care only link-local addresses */ + if (!IN6_IS_ADDR_LINKLOCAL(gateway)) { + splx(s); + return; + } + /* XXX: hack for KAME's link-local address kludge */ + gateway->s6_addr16[1] = htons(ifp->if_index); + + rnh->rnh_walktree(rnh, rt6_deleteroute, (void *)gateway); + splx(s); +} + +static int +rt6_deleteroute(rn, arg) + struct radix_node *rn; + void *arg; +{ +#define SIN6(s) ((struct sockaddr_in6 *)s) + struct rtentry *rt = (struct rtentry *)rn; + struct in6_addr *gate = (struct in6_addr *)arg; + + if (rt->rt_gateway == NULL || rt->rt_gateway->sa_family != AF_INET6) + return(0); + + if (!IN6_ARE_ADDR_EQUAL(gate, &SIN6(rt->rt_gateway)->sin6_addr)) + return(0); + + /* + * Do not delete a static route. + * XXX: this seems to be a bit ad-hoc. Should we consider the + * 'cloned' bit instead? + */ + if ((rt->rt_flags & RTF_STATIC) != 0) + return(0); + + /* + * We delete only host route. This means, in particular, we don't + * delete default route. + */ + if ((rt->rt_flags & RTF_HOST) == 0) + return(0); + + return(rtrequest(RTM_DELETE, rt_key(rt), + rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0)); +#undef SIN6 +} + +int +nd6_setdefaultiface(ifindex) + int ifindex; +{ + int error = 0; + + if (ifindex < 0 || if_index < ifindex) + return(EINVAL); + + if (nd6_defifindex != ifindex) { + nd6_defifindex = ifindex; + if (nd6_defifindex > 0) { +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + nd6_defifp = ifnet_byindex[nd6_defifindex]; +#else + nd6_defifp = ifindex2ifnet[nd6_defifindex]; +#endif + } else + nd6_defifp = NULL; + + /* + * Rescan default router list, refresh default route(s). + */ + defrouter_select(); + + /* + * Our current implementation assumes one-to-one maping between + * interfaces and links, so it would be natural to use the + * default interface as the default link. + */ + scope6_setdefault(nd6_defifp); + } + + return(error); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/raw_ip6.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/raw_ip6.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/raw_ip6.c @@ -0,0 +1,714 @@ +//========================================================================== +// +// src/sys/netinet6/raw_ip6.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + * + * $FreeBSD: src/sys/netinet6/raw_ip6.c,v 1.7.2.4 2001/07/29 19:32:40 ume Exp $ + */ + +/* + * Copyright (c) 1982, 1986, 1988, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)raw_ip.c 8.2 (Berkeley) 1/4/94 + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef IPSEC +#include +#endif /*IPSEC*/ + +#define satosin6(sa) ((struct sockaddr_in6 *)(sa)) +#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) + +/* + * Raw interface to IP6 protocol. + */ + +extern struct inpcbhead ripcb; +extern struct inpcbinfo ripcbinfo; +extern u_long rip_sendspace; +extern u_long rip_recvspace; + +struct rip6stat rip6stat; + +/* + * Setup generic address and protocol structures + * for raw_input routine, then pass them along with + * mbuf chain. + */ +int +rip6_input(mp, offp, proto) + struct mbuf **mp; + int *offp, proto; +{ + struct mbuf *m = *mp; + register struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + register struct inpcb *in6p; + struct inpcb *last = 0; + struct ip6_recvpktopts opts; + struct sockaddr_in6 rip6src; + + rip6stat.rip6s_ipackets++; + +#if defined(NFAITH) && 0 < NFAITH + if (faithprefix(&ip6->ip6_dst)) { + /* XXX send icmp6 host/port unreach? */ + m_freem(m); + return IPPROTO_DONE; + } +#endif + + init_sin6(&rip6src, m); /* general init */ + bzero(&opts, sizeof(opts)); + + LIST_FOREACH(in6p, &ripcb, inp_list) { + if ((in6p->in6p_vflag & INP_IPV6) == 0) + continue; + if (in6p->in6p_ip6_nxt && + in6p->in6p_ip6_nxt != proto) + continue; + if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) && + !IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &ip6->ip6_dst)) + continue; + if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) && + !IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src)) + continue; + if (in6p->in6p_cksum != -1) { + rip6stat.rip6s_isum++; + if (in6_cksum(m, ip6->ip6_nxt, *offp, + m->m_pkthdr.len - *offp)) { + rip6stat.rip6s_badsum++; + continue; + } + } + if (last) { + struct mbuf *n = m_copy(m, 0, (int)M_COPYALL); + +#ifdef IPSEC + /* + * Check AH/ESP integrity. + */ + if (n && ipsec6_in_reject_so(n, last->inp_socket)) { + m_freem(n); + ipsec6stat.in_polvio++; + /* do not inject data into pcb */ + } else +#endif /*IPSEC*/ + if (n) { + if (last->in6p_flags & IN6P_CONTROLOPTS || + last->in6p_socket->so_options & SO_TIMESTAMP) + ip6_savecontrol(last, ip6, n, &opts, + NULL); + /* strip intermediate headers */ + m_adj(n, *offp); + if (sbappendaddr(&last->in6p_socket->so_rcv, + (struct sockaddr *)&rip6src, + n, opts.head) == 0) { + m_freem(n); + if (opts.head) + m_freem(opts.head); + rip6stat.rip6s_fullsock++; + } else + sorwakeup(last->in6p_socket); + bzero(&opts, sizeof(opts)); + } + } + last = in6p; + } +#ifdef IPSEC + /* + * Check AH/ESP integrity. + */ + if (last && ipsec6_in_reject_so(m, last->inp_socket)) { + m_freem(m); + ipsec6stat.in_polvio++; + ip6stat.ip6s_delivered--; + /* do not inject data into pcb */ + } else +#endif /*IPSEC*/ + if (last) { + if (last->in6p_flags & IN6P_CONTROLOPTS || + last->in6p_socket->so_options & SO_TIMESTAMP) + ip6_savecontrol(last, ip6, m, &opts, NULL); + /* strip intermediate headers */ + m_adj(m, *offp); + if (sbappendaddr(&last->in6p_socket->so_rcv, + (struct sockaddr *)&rip6src, m, opts.head) == 0) { + m_freem(m); + if (opts.head) + m_freem(opts.head); + rip6stat.rip6s_fullsock++; + } else + sorwakeup(last->in6p_socket); + } else { + rip6stat.rip6s_nosock++; + if (m->m_flags & M_MCAST) + rip6stat.rip6s_nosockmcast++; + if (proto == IPPROTO_NONE) + m_freem(m); + else { + char *prvnxtp = ip6_get_prevhdr(m, *offp); /* XXX */ + icmp6_error(m, ICMP6_PARAM_PROB, + ICMP6_PARAMPROB_NEXTHEADER, + prvnxtp - mtod(m, char *)); + } + ip6stat.ip6s_delivered--; + } + return IPPROTO_DONE; +} + +void +rip6_ctlinput(cmd, sa, d) + int cmd; + struct sockaddr *sa; + void *d; +{ + struct ip6_hdr *ip6; + struct mbuf *m; + int off = 0; + struct ip6ctlparam *ip6cp = NULL; + const struct sockaddr_in6 *sa6_src = NULL; + void *cmdarg; + void (*notify) __P((struct inpcb *, int)) = in6_rtchange; + + if (sa->sa_family != AF_INET6 || + sa->sa_len != sizeof(struct sockaddr_in6)) + return; + + if ((unsigned)cmd >= PRC_NCMDS) + return; + if (PRC_IS_REDIRECT(cmd)) + notify = in6_rtchange, d = NULL; + else if (cmd == PRC_HOSTDEAD) + d = NULL; + else if (inet6ctlerrmap[cmd] == 0) + return; + + /* if the parameter is from icmp6, decode it. */ + if (d != NULL) { + ip6cp = (struct ip6ctlparam *)d; + m = ip6cp->ip6c_m; + ip6 = ip6cp->ip6c_ip6; + off = ip6cp->ip6c_off; + cmdarg = ip6cp->ip6c_cmdarg; + sa6_src = ip6cp->ip6c_src; + } else { + m = NULL; + ip6 = NULL; + cmdarg = NULL; + sa6_src = &sa6_any; + } + + (void) in6_pcbnotify(&ripcb, sa, 0, (struct sockaddr *)sa6_src, + 0, cmd, cmdarg, notify); +} + +/* + * Generate IPv6 header and pass packet to ip6_output. + * Tack on options user may have setup with control call. + */ +int +rip6_output(m, so, dstsock, control) + struct mbuf *m; + struct socket *so; + struct sockaddr_in6 *dstsock; + struct mbuf *control; +{ + struct in6_addr *dst; + struct ip6_hdr *ip6; + struct inpcb *in6p; + u_int plen = m->m_pkthdr.len; + int error = 0; + struct ip6_pktopts opt, *stickyopt = NULL; + struct ifnet *oifp = NULL; + int type = 0, code = 0; /* for ICMPv6 output statistics only */ + int priv = 1; + struct in6_addr *in6a; + + in6p = sotoin6pcb(so); + stickyopt = in6p->in6p_outputopts; + + dst = &dstsock->sin6_addr; + if (control) { + if ((error = ip6_setpktoptions(control, &opt, + stickyopt, priv, 0)) != 0) { + goto bad; + } + in6p->in6p_outputopts = &opt; + } + + /* + * For an ICMPv6 packet, we should know its type and code + * to update statistics. + */ + if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) { + struct icmp6_hdr *icmp6; + if (m->m_len < sizeof(struct icmp6_hdr) && + (m = m_pullup(m, sizeof(struct icmp6_hdr))) == NULL) { + error = ENOBUFS; + goto bad; + } + icmp6 = mtod(m, struct icmp6_hdr *); + type = icmp6->icmp6_type; + code = icmp6->icmp6_code; + } + + M_PREPEND(m, sizeof(*ip6), M_WAIT); + ip6 = mtod(m, struct ip6_hdr *); + + /* Source address selection. */ + if ((in6a = in6_selectsrc(dstsock, in6p->in6p_outputopts, + in6p->in6p_moptions, + &in6p->in6p_route, + &oifp, &in6p->in6p_laddr, + &error)) == 0) { + if (error == 0) + error = EADDRNOTAVAIL; + goto bad; + } + ip6->ip6_src = *in6a; + + if (oifp && dstsock->sin6_scope_id == 0 && + (error = scope6_setzoneid(oifp, dstsock)) != 0) { /* XXX */ + goto bad; + } + if (oifp == NULL && in6p->in6p_route.ro_rt) + oifp = ifindex2ifnet[in6p->in6p_route.ro_rt->rt_ifp->if_index]; + + /* fill in the rest of the IPv6 header fields */ + ip6->ip6_dst = *dst; + ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) | + (in6p->in6p_flowinfo & IPV6_FLOWINFO_MASK); + ip6->ip6_vfc = (ip6->ip6_vfc & ~IPV6_VERSION_MASK) | + (IPV6_VERSION & IPV6_VERSION_MASK); + /* ip6_plen will be filled in ip6_output, so not fill it here. */ + ip6->ip6_nxt = in6p->in6p_ip6_nxt; + ip6->ip6_hlim = in6_selecthlim(in6p, oifp); + + if (so->so_proto->pr_protocol == IPPROTO_ICMPV6 || + in6p->in6p_cksum != -1) { + struct mbuf *n; + int off; + u_int16_t *p; + + /* compute checksum */ + if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) + off = offsetof(struct icmp6_hdr, icmp6_cksum); + else + off = in6p->in6p_cksum; + if (plen < off + 1) { + error = EINVAL; + goto bad; + } + off += sizeof(struct ip6_hdr); + + n = m; + while (n && n->m_len <= off) { + off -= n->m_len; + n = n->m_next; + } + if (!n) + goto bad; + p = (u_int16_t *)(mtod(n, caddr_t) + off); + *p = 0; + *p = in6_cksum(m, ip6->ip6_nxt, sizeof(*ip6), plen); + } + +#ifdef IPSEC + if (ipsec_setsocket(m, so) != 0) { + error = ENOBUFS; + goto bad; + } +#endif /*IPSEC*/ + + oifp = NULL; /* just in case */ + error = ip6_output(m, in6p->in6p_outputopts, &in6p->in6p_route, 0, + in6p->in6p_moptions, &oifp); + if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) { + if (oifp) + icmp6_ifoutstat_inc(oifp, type, code); + icmp6stat.icp6s_outhist[type]++; + } else + rip6stat.rip6s_opackets++; + + goto freectl; + + bad: + if (m) + m_freem(m); + + freectl: + if (control) { + ip6_clearpktopts(in6p->in6p_outputopts, -1); + in6p->in6p_outputopts = stickyopt; + m_freem(control); + } + return(error); +} + +/* + * Raw IPv6 socket option processing. + */ +int +rip6_ctloutput(so, sopt) + struct socket *so; + struct sockopt *sopt; +{ + int error; + + if (sopt->sopt_level == IPPROTO_ICMPV6) + /* + * XXX: is it better to call icmp6_ctloutput() directly + * from protosw? + */ + return(icmp6_ctloutput(so, sopt)); + else if (sopt->sopt_level != IPPROTO_IPV6) + return (EINVAL); + + error = 0; + + switch (sopt->sopt_dir) { + case SOPT_GET: + switch (sopt->sopt_name) { + case MRT6_INIT: + case MRT6_DONE: + case MRT6_ADD_MIF: + case MRT6_DEL_MIF: + case MRT6_ADD_MFC: + case MRT6_DEL_MFC: + case MRT6_PIM: + error = ip6_mrouter_get(so, sopt); + break; + case IPV6_CHECKSUM: + error = ip6_raw_ctloutput(so, sopt); + break; + default: + error = ip6_ctloutput(so, sopt); + break; + } + break; + + case SOPT_SET: + switch (sopt->sopt_name) { + case MRT6_INIT: + case MRT6_DONE: + case MRT6_ADD_MIF: + case MRT6_DEL_MIF: + case MRT6_ADD_MFC: + case MRT6_DEL_MFC: + case MRT6_PIM: + error = ip6_mrouter_set(so, sopt); + break; + case IPV6_CHECKSUM: + error = ip6_raw_ctloutput(so, sopt); + break; + default: + error = ip6_ctloutput(so, sopt); + break; + } + break; + } + + return (error); +} + +static int +rip6_attach(struct socket *so, int proto, struct proc *p) +{ + struct inpcb *inp; + int error, s; + + inp = sotoinpcb(so); + if (inp) + panic("rip6_attach"); + + error = soreserve(so, rip_sendspace, rip_recvspace); + if (error) + return error; + s = splnet(); + error = in_pcballoc(so, &ripcbinfo, p); + splx(s); + if (error) + return error; + inp = (struct inpcb *)so->so_pcb; + inp->inp_vflag |= INP_IPV6; + inp->in6p_ip6_nxt = (long)proto; + inp->in6p_hops = -1; /* use kernel default */ + inp->in6p_cksum = -1; + MALLOC(inp->in6p_icmp6filt, struct icmp6_filter *, + sizeof(struct icmp6_filter), M_PCB, M_NOWAIT); + ICMP6_FILTER_SETPASSALL(inp->in6p_icmp6filt); + return 0; +} + +static int +rip6_detach(struct socket *so) +{ + struct inpcb *inp; + + inp = sotoinpcb(so); + if (inp == 0) + panic("rip6_detach"); + /* xxx: RSVP */ + if (so == ip6_mrouter) + ip6_mrouter_done(); + if (inp->in6p_icmp6filt) { + FREE(inp->in6p_icmp6filt, M_PCB); + inp->in6p_icmp6filt = NULL; + } + in6_pcbdetach(inp); + return 0; +} + +static int +rip6_abort(struct socket *so) +{ + soisdisconnected(so); + return rip6_detach(so); +} + +static int +rip6_disconnect(struct socket *so) +{ + struct inpcb *inp = sotoinpcb(so); + + if ((so->so_state & SS_ISCONNECTED) == 0) + return ENOTCONN; + inp->in6p_faddr = in6addr_any; + return rip6_abort(so); +} + +static int +rip6_bind(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + struct inpcb *inp = sotoinpcb(so); + struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; + struct ifaddr *ia = NULL; + int error = 0; + + if (nam->sa_len != sizeof(*addr)) + return EINVAL; + if (nam->sa_family != AF_INET6) + return EAFNOSUPPORT; + if (TAILQ_EMPTY(&ifnet) || addr->sin6_family != AF_INET6) + return EADDRNOTAVAIL; + if ((error = scope6_check_id(addr, ip6_use_defzone)) != 0) + return(error); +#ifndef SCOPEDROUTING + addr->sin6_scope_id = 0; /* for ifa_ifwithaddr */ +#endif + + if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr) && + (ia = ifa_ifwithaddr((struct sockaddr *)addr)) == 0) + return EADDRNOTAVAIL; + if (ia && + ((struct in6_ifaddr *)ia)->ia6_flags & + (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY| + IN6_IFF_DETACHED|IN6_IFF_DEPRECATED)) { + return(EADDRNOTAVAIL); + } + inp->in6p_laddr = addr->sin6_addr; + return 0; +} + +static int +rip6_connect(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + struct inpcb *inp = sotoinpcb(so); + struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; + struct in6_addr *in6a = NULL; + struct ifnet *ifp = NULL; + int error = 0; + + if (nam->sa_len != sizeof(*addr)) + return EINVAL; + if (TAILQ_EMPTY(&ifnet)) + return EADDRNOTAVAIL; + if (addr->sin6_family != AF_INET6) + return EAFNOSUPPORT; + if ((error = scope6_check_id(addr, ip6_use_defzone)) != 0) + return(error); + + /* Source address selection. XXX: need pcblookup? */ + in6a = in6_selectsrc(addr, inp->in6p_outputopts, + inp->in6p_moptions, &inp->in6p_route, + &ifp, &inp->in6p_laddr, &error); + if (in6a == NULL) + return (error ? error : EADDRNOTAVAIL); + + /* see above */ + if (ifp && addr->sin6_scope_id == 0 && + (error = scope6_setzoneid(ifp, addr)) != 0) { /* XXX */ + return(error); + } + inp->in6p_laddr = *in6a; + inp->in6p_faddr = addr->sin6_addr; + soisconnected(so); + return 0; +} + +static int +rip6_shutdown(struct socket *so) +{ + socantsendmore(so); + return 0; +} + +static int +rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, + struct mbuf *control, struct proc *p) +{ + int error = 0; + struct inpcb *inp = sotoinpcb(so); + struct sockaddr_in6 tmp; + struct sockaddr_in6 *dst; + + /* always copy sockaddr to avoid overwrites */ + if (so->so_state & SS_ISCONNECTED) { + if (nam) { + m_freem(m); + return EISCONN; + } + /* XXX */ + bzero(&tmp, sizeof(tmp)); + tmp.sin6_family = AF_INET6; + tmp.sin6_len = sizeof(struct sockaddr_in6); + bcopy(&inp->in6p_faddr, &tmp.sin6_addr, + sizeof(struct in6_addr)); + dst = &tmp; + } else { + if (nam == NULL) { + m_freem(m); + return ENOTCONN; + } + if (nam->sa_len != sizeof(struct sockaddr_in6)) { + m_freem(m); + return(EINVAL); + } + tmp = *(struct sockaddr_in6 *)nam; + dst = &tmp; + if (dst->sin6_family == AF_UNSPEC) { + /* + * XXX: we allow this case for backward + * compatibility to buggy applications that + * rely on old (and wrong) kernel behavior. + */ + log(LOG_INFO, "rip6 SEND: address family is " + "unspec. Assume AF_INET6\n"); + } else if (dst->sin6_family != AF_INET6) { + m_freem(m); + return(EAFNOSUPPORT); + } + if ((error = scope6_check_id(dst, ip6_use_defzone)) != 0) { + m_freem(m); + return(error); + } + } + return rip6_output(m, so, dst, control); +} + +struct pr_usrreqs rip6_usrreqs = { + rip6_abort, pru_accept_notsupp, rip6_attach, rip6_bind, rip6_connect, + pru_connect2_notsupp, in6_control, rip6_detach, rip6_disconnect, + pru_listen_notsupp, in6_setpeeraddr, pru_rcvd_notsupp, + pru_rcvoob_notsupp, rip6_send, pru_sense_null, rip6_shutdown, + in6_setsockaddr, sosend, soreceive, sopoll +}; diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/route6.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/route6.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/route6.c @@ -0,0 +1,301 @@ +//========================================================================== +// +// src/sys/netinet6/route6.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: route6.c,v 1.28 2001/09/21 08:50:05 keiichi Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#include +#include +#include +#include + +#include +#ifdef NEW_STRUCT_ROUTE +#include +#endif + +#include +#include +#include +#include + +#include + +#ifdef MIP6 +#include +#endif + +static int ip6_rthdr0 __P((struct mbuf *, struct ip6_hdr *, + struct ip6_rthdr0 *)); + +int +route6_input(mp, offp, proto) + struct mbuf **mp; + int *offp, proto; /* proto is unused */ +{ + struct ip6_hdr *ip6; + struct mbuf *m = *mp; + struct ip6_rthdr *rh; + int off = *offp, rhlen; + struct mbuf *n; + + n = ip6_findaux(m); + if (n) { + struct ip6aux *ip6a = mtod(n, struct ip6aux *); + /* XXX reject home-address option before rthdr */ + if (ip6a->ip6a_flags & IP6A_SWAP) { + ip6stat.ip6s_badoptions++; + m_freem(m); + return IPPROTO_DONE; + } + } + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, sizeof(*rh), IPPROTO_DONE); + ip6 = mtod(m, struct ip6_hdr *); + rh = (struct ip6_rthdr *)((caddr_t)ip6 + off); +#else + ip6 = mtod(m, struct ip6_hdr *); + IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, sizeof(*rh)); + if (rh == NULL) { + ip6stat.ip6s_tooshort++; + return IPPROTO_DONE; + } +#endif + + switch (rh->ip6r_type) { + case IPV6_RTHDR_TYPE_0: + rhlen = (rh->ip6r_len + 1) << 3; +#ifndef PULLDOWN_TEST + /* + * note on option length: + * due to IP6_EXTHDR_CHECK assumption, we cannot handle + * very big routing header (max rhlen == 2048). + */ + IP6_EXTHDR_CHECK(m, off, rhlen, IPPROTO_DONE); +#else + /* + * note on option length: + * maximum rhlen: 2048 + * max mbuf m_pulldown can handle: MCLBYTES == usually 2048 + * so, here we are assuming that m_pulldown can handle + * rhlen == 2048 case. this may not be a good thing to + * assume - we may want to avoid pulling it up altogether. + */ + IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, rhlen); + if (rh == NULL) { + ip6stat.ip6s_tooshort++; + return IPPROTO_DONE; + } +#endif + if (ip6_rthdr0(m, ip6, (struct ip6_rthdr0 *)rh)) + return(IPPROTO_DONE); + break; + default: + /* unknown routing type */ + if (rh->ip6r_segleft == 0) { + rhlen = (rh->ip6r_len + 1) << 3; + break; /* Final dst. Just ignore the header. */ + } + ip6stat.ip6s_badoptions++; + icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, + (caddr_t)&rh->ip6r_type - (caddr_t)ip6); + return(IPPROTO_DONE); + } + + *offp += rhlen; + return(rh->ip6r_nxt); +} + +/* + * Type0 routing header processing + * + * RFC2292 backward compatibility warning: no support for strict/loose bitmap, + * as it was dropped between RFC1883 and RFC2460. + */ +static int +ip6_rthdr0(m, ip6, rh0) + struct mbuf *m; + struct ip6_hdr *ip6; + struct ip6_rthdr0 *rh0; +{ + int addrs, index; + struct in6_addr *nextaddr, tmpaddr; + + if (rh0->ip6r0_segleft == 0) +#ifdef MIP6 + { + struct hif_softc *sc; + struct mip6_bu *mbu; + int lastindex; + struct in6_addr *prevhop; + struct mbuf *n; + struct ip6aux *ip6a; + + if (!MIP6_IS_MN) + return (0); + + /* + * check if the ip6_dst is my home address or not. if + * true, check if the previous hop is the coa of the + * home address stored in the ip6_dst field. if above + * two is true, this packet is route optimized packet. + */ + for (sc = TAILQ_FIRST(&hif_softc_list); + sc; + sc = TAILQ_NEXT(sc, hif_entry)) { + for (mbu = LIST_FIRST(&sc->hif_bu_list); + mbu; + mbu = LIST_NEXT(mbu, mbu_entry)) { + if ((mbu->mbu_flags & IP6_BUF_HOME) == 0) + continue; + + /* XXX registration status ? */ + + /* check the final dest is a home address. */ + if (!IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, + &mbu->mbu_haddr)) + continue; + + /* check the last hop is a coa. */ + lastindex = rh0->ip6r0_len / 2; + prevhop = (struct in6_addr *)(rh0 + 1) + + lastindex - 1; + if (!IN6_ARE_ADDR_EQUAL(prevhop, + &mbu->mbu_coa)) + continue; + + /* + * route is already optimized. set + * optimized flag in m_aux. + */ + n = ip6_addaux(m); + if (n) { + ip6a = mtod(n, struct ip6aux *); + ip6a->ip6a_flags = IP6A_ROUTEOPTIMIZED; + } + } + } + return (0); + } +#else /* MIP6 */ + return(0); +#endif /* MIP6 */ + + if (rh0->ip6r0_len % 2 +#ifdef COMPAT_RFC1883 + || rh0->ip6r0_len > 46 +#endif + ) { + /* + * Type 0 routing header can't contain more than 23 addresses. + * RFC 2462: this limitation was removed since strict/loose + * bitmap field was deleted. + */ + ip6stat.ip6s_badoptions++; + icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, + (caddr_t)&rh0->ip6r0_len - (caddr_t)ip6); + return(-1); + } + + if ((addrs = rh0->ip6r0_len / 2) < rh0->ip6r0_segleft) { + ip6stat.ip6s_badoptions++; + icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, + (caddr_t)&rh0->ip6r0_segleft - (caddr_t)ip6); + return(-1); + } + + index = addrs - rh0->ip6r0_segleft; + rh0->ip6r0_segleft--; + nextaddr = ((struct in6_addr *)(rh0 + 1)) + index; + + /* + * reject invalid addresses. be proactive about malicious use of + * IPv4 mapped/compat address. + * XXX need more checks? + */ + if (IN6_IS_ADDR_MULTICAST(nextaddr) || + IN6_IS_ADDR_UNSPECIFIED(nextaddr) || + IN6_IS_ADDR_V4MAPPED(nextaddr) || + IN6_IS_ADDR_V4COMPAT(nextaddr)) { + ip6stat.ip6s_badoptions++; + m_freem(m); + return(-1); + } + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || + IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst) || + IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst) || + IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) { + ip6stat.ip6s_badoptions++; + m_freem(m); + return(-1); + } + + /* + * Swap the IPv6 destination address and nextaddr. Forward the packet. + */ + tmpaddr = *nextaddr; + *nextaddr = ip6->ip6_dst; + if (IN6_IS_ADDR_LINKLOCAL(nextaddr)) + nextaddr->s6_addr16[1] = 0; + ip6->ip6_dst = tmpaddr; + if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst)) + ip6->ip6_dst.s6_addr16[1] = htons(m->m_pkthdr.rcvif->if_index); + +#ifdef COMPAT_RFC1883 + if (rh0->ip6r0_slmap[index / 8] & (1 << (7 - (index % 8)))) + ip6_forward(m, IPV6_SRCRT_NEIGHBOR); + else + ip6_forward(m, IPV6_SRCRT_NOTNEIGHBOR); +#else + ip6_forward(m, 1); +#endif + + return(-1); /* m would be freed in ip6_forward() */ +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/scope6.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/scope6.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/scope6.c @@ -0,0 +1,467 @@ +//========================================================================== +// +// src/sys/netinet6/scope6.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: scope6.c,v 1.27 2001/12/18 02:23:45 itojun Exp $ */ + +/* + * Copyright (C) 2000 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#ifdef ENABLE_DEFAULT_SCOPE +int ip6_use_defzone = 1; +#else +int ip6_use_defzone = 0; +#endif + +struct scope6_id { + /* + * 16 is correspondent to 4bit multicast scope field. + * i.e. from node-local to global with some reserved/unassigned types. + */ + u_int32_t s6id_list[16]; +}; +static size_t if_indexlim = 8; +struct scope6_id *scope6_ids = NULL; + +void +scope6_ifattach(ifp) + struct ifnet *ifp; +{ +#ifdef __NetBSD__ + int s = splsoftnet(); +#else + int s = splnet(); +#endif + + /* + * We have some arrays that should be indexed by if_index. + * since if_index will grow dynamically, they should grow too. + */ + if (scope6_ids == NULL || if_index >= if_indexlim) { + size_t n; + caddr_t q; + + while (if_index >= if_indexlim) + if_indexlim <<= 1; + + /* grow scope index array */ + n = if_indexlim * sizeof(struct scope6_id); + /* XXX: need new malloc type? */ + q = (caddr_t)malloc(n, M_IFADDR, M_WAITOK); + bzero(q, n); + if (scope6_ids) { + bcopy((caddr_t)scope6_ids, q, n/2); + free((caddr_t)scope6_ids, M_IFADDR); + } + scope6_ids = (struct scope6_id *)q; + } + +#define SID scope6_ids[ifp->if_index] + + /* don't initialize if called twice */ + if (SID.s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL]) { + splx(s); + return; + } + + /* + * XXX: IPV6_ADDR_SCOPE_xxx macros are not standard. + * Should we rather hardcode here? + */ + SID.s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = ifp->if_index; + SID.s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = ifp->if_index; +#ifdef MULTI_SCOPE + /* by default, we don't care about scope boundary for these scopes. */ + SID.s6id_list[IPV6_ADDR_SCOPE_SITELOCAL] = 1; + SID.s6id_list[IPV6_ADDR_SCOPE_ORGLOCAL] = 1; +#endif +#undef SID + + splx(s); +} + +int +scope6_set(ifp, idlist) + struct ifnet *ifp; + u_int32_t *idlist; +{ + int i, s; + int error = 0; + + if (scope6_ids == NULL) /* paranoid? */ + return(EINVAL); + + /* + * XXX: We need more consistency checks of the relationship among + * scopes (e.g. an organization should be larger than a site). + */ + + /* + * TODO(XXX): after setting, we should reflect the changes to + * interface addresses, routing table entries, PCB entries... + */ + +#ifdef __NetBSD__ + s = splsoftnet(); +#else + s = splnet(); +#endif + + for (i = 0; i < 16; i++) { + if (idlist[i] && + idlist[i] != scope6_ids[ifp->if_index].s6id_list[i]) { + /* + * An interface zone ID must be the corresponding + * interface index by definition. + */ + if (i == IPV6_ADDR_SCOPE_INTFACELOCAL && + idlist[i] != ifp->if_index) { + splx(s); + return(EINVAL); + } + + if (i == IPV6_ADDR_SCOPE_LINKLOCAL && + idlist[i] > if_index) { + /* + * XXX: theoretically, there should be no + * relationship between link IDs and interface + * IDs, but we check the consistency for + * safety in later use. + */ + splx(s); + return(EINVAL); + } + + /* + * XXX: we must need lots of work in this case, + * but we simply set the new value in this initial + * implementation. + */ + scope6_ids[ifp->if_index].s6id_list[i] = idlist[i]; + } + } + splx(s); + + return(error); +} + +int +scope6_get(ifp, idlist) + struct ifnet *ifp; + u_int32_t *idlist; +{ + if (scope6_ids == NULL) /* paranoid? */ + return(EINVAL); + + bcopy(scope6_ids[ifp->if_index].s6id_list, idlist, + sizeof(scope6_ids[ifp->if_index].s6id_list)); + + return(0); +} + + +/* + * Get a scope of the address. Node-local, link-local, site-local or global. + */ +int +in6_addrscope(addr) + struct in6_addr *addr; +{ + int scope; + + if (addr->s6_addr[0] == 0xfe) { + scope = addr->s6_addr[1] & 0xc0; + + switch (scope) { + case 0x80: + return IPV6_ADDR_SCOPE_LINKLOCAL; + break; + case 0xc0: + return IPV6_ADDR_SCOPE_SITELOCAL; + break; + default: + return IPV6_ADDR_SCOPE_GLOBAL; /* just in case */ + break; + } + } + + + if (addr->s6_addr[0] == 0xff) { + scope = addr->s6_addr[1] & 0x0f; + + /* + * due to other scope such as reserved, + * return scope doesn't work. + */ + switch (scope) { + case IPV6_ADDR_SCOPE_INTFACELOCAL: + return IPV6_ADDR_SCOPE_INTFACELOCAL; + break; + case IPV6_ADDR_SCOPE_LINKLOCAL: + return IPV6_ADDR_SCOPE_LINKLOCAL; + break; + case IPV6_ADDR_SCOPE_SITELOCAL: + return IPV6_ADDR_SCOPE_SITELOCAL; + break; + default: + return IPV6_ADDR_SCOPE_GLOBAL; + break; + } + } + + /* + * Regard loopback and unspecified addresses as global, since + * they have no ambiguity. + */ + if (bcmp(&in6addr_loopback, addr, sizeof(addr) - 1) == 0) { + if (addr->s6_addr[15] == 1) /* loopback */ + return IPV6_ADDR_SCOPE_LINKLOCAL; + if (addr->s6_addr[15] == 0) /* unspecified */ + return IPV6_ADDR_SCOPE_GLOBAL; /* XXX: correct? */ + } + + return IPV6_ADDR_SCOPE_GLOBAL; +} + +/* + * When we introduce the "4+28" split semantics in sin6_scope_id, + * a 32bit integer is not enough to tell a large ID from an error (-1). + * So, we intentionally use a large type as the return value. + */ +int64_t +in6_addr2zoneid(ifp, addr) + struct ifnet *ifp; /* must not be NULL */ + struct in6_addr *addr; /* must not be NULL */ +{ + int scope; + +#ifdef DIAGNOSTIC + if (scope6_ids == NULL) { /* should not happen */ + panic("in6_addr2zoneid: scope array is NULL"); + /* NOTREACHED */ + } + if (ifp->if_index >= if_indexlim) { + panic("in6_addr2zoneid: invalid interface"); + /* NOTREACHED */ + } +#endif + + /* + * special case: the loopback address can only belong to a loopback + * interface. + */ + if (IN6_IS_ADDR_LOOPBACK(addr)) { + if (!(ifp->if_flags & IFF_LOOPBACK)) + return(-1); + else + return(0); /* there's no ambiguity */ + } + + scope = in6_addrscope(addr); + +#define SID scope6_ids[ifp->if_index] + switch (scope) { + case IPV6_ADDR_SCOPE_INTFACELOCAL: /* should be interface index */ + return(SID.s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL]); + + case IPV6_ADDR_SCOPE_LINKLOCAL: + return(SID.s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL]); + + case IPV6_ADDR_SCOPE_SITELOCAL: + return(SID.s6id_list[IPV6_ADDR_SCOPE_SITELOCAL]); + + case IPV6_ADDR_SCOPE_ORGLOCAL: + return(SID.s6id_list[IPV6_ADDR_SCOPE_ORGLOCAL]); + + default: + return(0); /* XXX: treat as global. */ + } +#undef SID +} + +void +scope6_setdefault(ifp) + struct ifnet *ifp; /* note that this might be NULL */ +{ + /* + * Currently, this function just set the default "interfaces" + * and "links" according to the given interface. + * We might eventually have to separate the notion of "link" from + * "interface" and provide a user interface to set the default. + */ + if (ifp) { + scope6_ids[0].s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = + ifp->if_index; + scope6_ids[0].s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = + ifp->if_index; + } + else { + scope6_ids[0].s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = 0; + scope6_ids[0].s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = 0; + } +} + +int +scope6_get_default(idlist) + u_int32_t *idlist; +{ + if (scope6_ids == NULL) /* paranoid? */ + return(EINVAL); + + bcopy(scope6_ids[0].s6id_list, idlist, + sizeof(scope6_ids[0].s6id_list)); + + return(0); +} + +u_int32_t +scope6_addr2default(addr) + struct in6_addr *addr; +{ + /* + * special case: The loopback address should be considered as + * link-local, but there's no ambiguity in the syntax. + */ + if (IN6_IS_ADDR_LOOPBACK(addr)) + return(0); + + return(scope6_ids[0].s6id_list[in6_addrscope(addr)]); +} + +/* + * XXX: some applications assume the kernel guesses a correct zone ID when the + * outgoing interface is explicitly specified, and omit specifying the ID. + * This is a bad manner, but we handle such cases anyway. + * Note that this function intentionally overrides the argument SIN6. + */ +int +scope6_setzoneid(ifp, sin6) + struct ifnet *ifp; + struct sockaddr_in6 *sin6; +{ + int64_t zoneid; + int error; + + zoneid = in6_addr2zoneid(ifp, &sin6->sin6_addr); + + if (zoneid < 0) + return(ENXIO); + if (zoneid) { + sin6->sin6_scope_id = zoneid; + if ((error = in6_embedscope(&sin6->sin6_addr, sin6)) != 0) + return(error); + } + + return(0); +} + +/* + * Check if the zone ID in SIN6 is valid according to the scope of the + * address. If DFEFAULTOK is true and the zone ID is unspecified, fill the + * default value for the scope type in the ID field. + * This function also embeds the zone ID into the 128bit address field if + * necessary. This format is internally used in the kernel. + * As a result, it is ensured that SIN6 has a valid scope zone ID and the + * address part is converted to the internal form. + * + * The caller must expect that SIN6 can be modified within this function; + * if it is not desired to override the original value a local copy must be + * made in advance. + */ +int +scope6_check_id(sin6, defaultok) + struct sockaddr_in6 *sin6; + int defaultok; +{ + u_int32_t zoneid; + struct in6_addr *in6 = &sin6->sin6_addr; + struct ifnet *ifp; + + if ((zoneid = sin6->sin6_scope_id) != 0) { + /* + * At this moment, we only check interface-local and + * link-local scope IDs, and use interface indices as the + * zone IDs assuming a one-to-one mapping between interfaces + * and links. + * XXX: in6_embedscope() below does the same check (in case + * of !SCOPEDROUTING). We should eventually centralize the + * check in this function. + */ + if (IN6_IS_SCOPE_LINKLOCAL(in6) || + IN6_IS_ADDR_MC_INTFACELOCAL(in6)) { + if (if_index < zoneid) + return(ENXIO); +#if defined(__FreeBSD__) && __FreeBSD__ >= 5 + ifp = ifnet_byindex(zoneid); +#else + ifp = ifindex2ifnet[zoneid]; +#endif + if (ifp == NULL) /* XXX: this can happen for some OS */ + return(ENXIO); + } + } else if (defaultok) + sin6->sin6_scope_id = scope6_addr2default(in6); + + /* KAME hack: embed scopeid */ + if (in6_embedscope(in6, sin6) != 0) + return(EINVAL); + + return(0); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/udp6_output.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/udp6_output.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/udp6_output.c @@ -0,0 +1,521 @@ +//========================================================================== +// +// src/sys/netinet6/udp6_output.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: udp6_output.c,v 1.54 2001/12/27 05:12:38 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 1989, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if !(defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)) +#include +#include +#endif +#include +#include +#include + +#ifdef __OpenBSD__ +#undef IPSEC +#else +#ifdef IPSEC +#include +#endif /* IPSEC */ +#endif + +/* + * UDP protocol inplementation. + * Per RFC 768, August, 1980. + */ + +#ifdef HAVE_NRL_INPCB +#define in6pcb inpcb + +#define udp6stat udpstat +#define udp6s_opackets udps_opackets +#endif +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) +#define in6pcb inpcb +#define udp6stat udpstat +#define udp6s_opackets udps_opackets +#endif + +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) +int +udp6_output(in6p, m, addr6, control, p) + struct in6pcb *in6p; + struct mbuf *m; + struct mbuf *control; + struct sockaddr *addr6; + struct proc *p; +#elif defined(__NetBSD__) +int +udp6_output(in6p, m, addr6, control, p) + struct in6pcb *in6p; + struct mbuf *m; + struct mbuf *addr6, *control; + struct proc *p; +#else +int +udp6_output(in6p, m, addr6, control) + struct in6pcb *in6p; + struct mbuf *m; + struct mbuf *addr6, *control; +#endif +{ + u_int32_t ulen = m->m_pkthdr.len; + u_int32_t plen = sizeof(struct udphdr) + ulen; + struct ip6_hdr *ip6; + struct udphdr *udp6; + struct in6_addr *laddr, *faddr; + u_short fport; + int error = 0; + struct ip6_pktopts opt, *stickyopt = in6p->in6p_outputopts; + int priv; + int af = AF_INET6, hlen = sizeof(struct ip6_hdr); +#ifdef INET +#if defined(__NetBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) + struct ip *ip; + struct udpiphdr *ui; +#endif +#endif + int flags = 0; + struct sockaddr_in6 tmp, *sin6 = NULL; + + priv = 1; + + if (addr6) { +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) + /* addr6 has been validated in udp6_send(). */ + sin6 = (struct sockaddr_in6 *)addr6; +#else + sin6 = mtod(addr6, struct sockaddr_in6 *); + + if (addr6->m_len != sizeof(*sin6)) + return(EINVAL); + + if (sin6->sin6_family != AF_INET6) + return(EAFNOSUPPORT); +#endif + + /* protect *sin6 from overwrites */ + tmp = *sin6; + sin6 = &tmp; + + if ((error = scope6_check_id(sin6, ip6_use_defzone)) != 0) + return(error); + } + + if (control) { + if ((error = ip6_setpktoptions(control, &opt, stickyopt, priv, 0)) != 0) + goto release; + in6p->in6p_outputopts = &opt; + } + + if (sin6) { + /* + * IPv4 version of udp_output calls in_pcbconnect in this case, + * which needs splnet and affects performance. + * Since we saw no essential reason for calling in_pcbconnect, + * we get rid of such kind of logic, and call in6_selectsrc + * and in6_pcbsetport in order to fill in the local address + * and the local port. + */ + if (sin6->sin6_port == 0) { + error = EADDRNOTAVAIL; + goto release; + } + + if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) { + /* how about ::ffff:0.0.0.0 case? */ + error = EISCONN; + goto release; + } + + faddr = &sin6->sin6_addr; + fport = sin6->sin6_port; /* allow 0 port */ + + if (IN6_IS_ADDR_V4MAPPED(faddr)) { +#ifdef __OpenBSD__ /* does not support mapped addresses */ + if (1) +#else + if ((in6p->in6p_flags & IN6P_IPV6_V6ONLY)) +#endif + { + /* + * I believe we should explicitly discard the + * packet when mapped addresses are disabled, + * rather than send the packet as an IPv6 one. + * If we chose the latter approach, the packet + * might be sent out on the wire based on the + * default route, the situation which we'd + * probably want to avoid. + * (20010421 jinmei@kame.net) + */ + error = EINVAL; + goto release; + } + if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) + && !IN6_IS_ADDR_V4MAPPED(&in6p->in6p_laddr)) { + /* + * when remote addr is an IPv4-mapped address, + * local addr should not be an IPv6 address, + * since you cannot determine how to map IPv6 + * source address to IPv4. + */ + error = EINVAL; + goto release; + } + + af = AF_INET; + } + + if (!IN6_IS_ADDR_V4MAPPED(faddr)) { + struct ifnet *ifp = NULL; + + laddr = in6_selectsrc(sin6, in6p->in6p_outputopts, + in6p->in6p_moptions, + &in6p->in6p_route, + &ifp, &in6p->in6p_laddr, &error); + + if (ifp && sin6->sin6_scope_id == 0 && + (error = scope6_setzoneid(ifp, sin6)) != 0) { + goto release; + } + } else { +#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) + struct in6_addr laddr_mapped; /* XXX ugly */ + /* + * XXX: freebsd[34] does not have in_selectsrc, but + * we can omit the whole part because freebsd4 calls + * udp_output() directly in this case, and thus we'll + * never see this path. + */ + if (IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { + struct sockaddr_in *sinp, sin_dst; + + bzero(&sin_dst, sizeof(sin_dst)); + sin_dst.sin_family = AF_INET; + sin_dst.sin_len = sizeof(sin_dst); + bcopy(&faddr->s6_addr[12], &sin_dst.sin_addr, + sizeof(sin_dst.sin_addr)); + sinp = in_selectsrc(&sin_dst, + (struct route *)&in6p->in6p_route, + in6p->in6p_socket->so_options, + NULL, &error); + if (sinp == NULL) { + if (error == 0) + error = EADDRNOTAVAIL; + goto release; + } + bzero(&laddr_mapped, sizeof(laddr_mapped)); + laddr_mapped.s6_addr16[5] = 0xffff; /* ugly */ + bcopy(&sinp->sin_addr, + &laddr_mapped.s6_addr[12], + sizeof(sinp->sin_addr)); + laddr = &laddr_mapped; + } else +#endif /* !(freebsd3 and later) */ + { + laddr = &in6p->in6p_laddr; /* XXX */ + } + } + if (laddr == NULL) { + if (error == 0) + error = EADDRNOTAVAIL; + goto release; + } + if (in6p->in6p_lport == 0 && +#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) + (error = in6_pcbsetport(laddr, in6p, p)) != 0 +#else + (error = in6_pcbsetport(laddr, in6p)) != 0 +#endif + ) + goto release; + } else { + if (IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) { + error = ENOTCONN; + goto release; + } + if (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_faddr)) { +#ifdef __OpenBSD__ /* does not support mapped addresses */ + if (1) +#else + if ((in6p->in6p_flags & IN6P_IPV6_V6ONLY)) +#endif + { + /* + * XXX: this case would happen when the + * application sets the V6ONLY flag after + * connecting the foreign address. + * Such applications should be fixed, + * so we bark here. + */ + log(LOG_INFO, "udp6_output: IPV6_V6ONLY " + "option was set for a connected socket\n"); + error = EINVAL; + goto release; + } else + af = AF_INET; + } + laddr = &in6p->in6p_laddr; + faddr = &in6p->in6p_faddr; + fport = in6p->in6p_fport; + } + + if (af == AF_INET) + hlen = sizeof(struct ip); + + /* + * Calculate data length and get a mbuf + * for UDP and IP6 headers. + */ + M_PREPEND(m, hlen + sizeof(struct udphdr), M_DONTWAIT); + if (m == 0) { + error = ENOBUFS; + goto release; + } + + /* + * Stuff checksum and output datagram. + */ + udp6 = (struct udphdr *)(mtod(m, caddr_t) + hlen); + udp6->uh_sport = in6p->in6p_lport; /* lport is always set in the PCB */ + udp6->uh_dport = fport; + if (plen <= 0xffff) + udp6->uh_ulen = htons((u_short)plen); + else + udp6->uh_ulen = 0; + udp6->uh_sum = 0; + + switch (af) { + case AF_INET6: + ip6 = mtod(m, struct ip6_hdr *); + ip6->ip6_flow = in6p->in6p_flowinfo & IPV6_FLOWINFO_MASK; + ip6->ip6_vfc &= ~IPV6_VERSION_MASK; + ip6->ip6_vfc |= IPV6_VERSION; +#if 0 /* ip6_plen will be filled in ip6_output. */ + ip6->ip6_plen = htons((u_short)plen); +#endif + ip6->ip6_nxt = IPPROTO_UDP; + ip6->ip6_hlim = in6_selecthlim(in6p, + in6p->in6p_route.ro_rt ? + in6p->in6p_route.ro_rt->rt_ifp : NULL); + ip6->ip6_src = *laddr; + ip6->ip6_dst = *faddr; + + if ((udp6->uh_sum = in6_cksum(m, IPPROTO_UDP, + sizeof(struct ip6_hdr), plen)) == 0) { + udp6->uh_sum = 0xffff; + } + + udp6stat.udp6s_opackets++; +#ifdef IPSEC + if (ipsec_setsocket(m, in6p->in6p_socket) != 0) { + error = ENOBUFS; + goto release; + } +#endif /* IPSEC */ + error = ip6_output(m, in6p->in6p_outputopts, &in6p->in6p_route, + flags, in6p->in6p_moptions, NULL); + break; + case AF_INET: +#if defined(INET) && (defined(__NetBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)) + /* can't transmit jumbogram over IPv4 */ + if (plen > 0xffff) { + error = EMSGSIZE; + goto release; + } + + ip = mtod(m, struct ip *); + ui = (struct udpiphdr *)ip; +#if defined(__bsdi__) && _BSDI_VERSION >= 199802 + ui->ui_x00 = 0; + ui->ui_x01 = 0; + ui->ui_x1 = 0; +#else + bzero(ui->ui_x1, sizeof ui->ui_x1); +#endif + ui->ui_pr = IPPROTO_UDP; + ui->ui_len = htons(plen); + bcopy(&laddr->s6_addr[12], &ui->ui_src, sizeof(ui->ui_src)); + ui->ui_ulen = ui->ui_len; + +#ifdef __NetBSD__ + flags = (in6p->in6p_socket->so_options & + (SO_DONTROUTE | SO_BROADCAST)); + bcopy(&faddr->s6_addr[12], &ui->ui_dst, sizeof(ui->ui_dst)); + udp6->uh_sum = in_cksum(m, hlen + plen); +#elif (defined(__bsdi__) && _BSDI_VERSION >= 199802) + flags = (in6p->inp_socket->so_options & + (SO_DONTROUTE | SO_BROADCAST)); + + if (in6p->inp_flags & INP_ONESBCAST) { + struct inhash *ih; + + /* + * If configured for an all-ones broadcast, determine + * if this packet is destined for a subnet broadcast + * address. + */ + ih = inh_lookup_bcast(ui->ui_dst); + if (ih != NULL && + (ih->inh_flags & (INH_BCAST|INH_LBCAST)) == + INH_BCAST) + flags |= IP_SENDONES; + } + if (flags & IP_SENDONES) { + /* See the comment in udp_output(). */ + ui->ui_dst.s_addr = INADDR_BROADCAST; + udp6->uh_sum = in_cksum(m, ulen); + bcopy(&faddr->s6_addr[12], &ui->ui_dst, + sizeof(ui->ui_dst)); + } else { + bcopy(&faddr->s6_addr[12], &ui->ui_dst, + sizeof(ui->ui_dst)); + udp6->uh_sum = in_cksum(m, ulen); + } +#else +#error OS not supported +#endif + if (udp6->uh_sum == 0) + udp6->uh_sum = 0xffff; + + ip->ip_len = hlen + plen; + ip->ip_ttl = in6_selecthlim(in6p, NULL); /* XXX */ + ip->ip_tos = 0; /* XXX */ + + ip->ip_len = hlen + plen; /* XXX */ + + udpstat.udps_opackets++; +#ifdef IPSEC + (void)ipsec_setsocket(m, NULL); /* XXX */ +#endif /* IPSEC */ +#ifdef __NetBSD__ + error = ip_output(m, NULL, &in6p->in6p_route, flags /* XXX */); +#elif defined(__bsdi__) && _BSDI_VERSION >= 199802 + error = ip_output(m, NULL, (struct route *)&in6p->in6p_route, + flags, NULL); +#else +#error OS not supported +#endif /* INET && (freebsd || bsdi4) */ + break; +#else + error = EAFNOSUPPORT; + goto release; +#endif + } + goto releaseopt; + +release: + m_freem(m); + +releaseopt: + if (control) { + ip6_clearpktopts(in6p->in6p_outputopts, -1); + in6p->in6p_outputopts = stickyopt; + m_freem(control); + } + return(error); +} diff --git a/packages/net/bsd_tcpip/current/src/sys/netinet6/udp6_usrreq.c b/packages/net/bsd_tcpip/current/src/sys/netinet6/udp6_usrreq.c new file mode 100644 --- /dev/null +++ b/packages/net/bsd_tcpip/current/src/sys/netinet6/udp6_usrreq.c @@ -0,0 +1,719 @@ +//========================================================================== +// +// src/sys/netinet6/udp6_usrreq.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $FreeBSD: src/sys/netinet6/udp6_usrreq.c,v 1.6.2.6 2001/07/29 19:32:40 ume Exp $ */ +/* $KAME: udp6_usrreq.c,v 1.43 2001/11/12 05:04:16 jinmei Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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 project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1982, 1986, 1989, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef IPSEC +#include +#endif /* IPSEC */ + +/* + * UDP protocol inplementation. + * Per RFC 768, August, 1980. + */ + +extern struct protosw inetsw[]; +static int udp6_detach __P((struct socket *so)); + +int +udp6_input(mp, offp, proto) + struct mbuf **mp; + int *offp, proto; +{ + struct mbuf *m = *mp; + register struct ip6_hdr *ip6; + register struct udphdr *uh; + register struct inpcb *in6p; + struct ip6_recvpktopts opts; + int off = *offp; + int plen, ulen; + struct sockaddr_in6 udp_in6; + + bzero(&opts, sizeof(opts)); + + ip6 = mtod(m, struct ip6_hdr *); + +#if defined(NFAITH) && 0 < NFAITH + if (faithprefix(&ip6->ip6_dst)) { + /* XXX send icmp6 host/port unreach? */ + m_freem(m); + return IPPROTO_DONE; + } +#endif + +#ifndef PULLDOWN_TEST + IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE); + ip6 = mtod(m, struct ip6_hdr *); + uh = (struct udphdr *)((caddr_t)ip6 + off); +#else + IP6_EXTHDR_GET(uh, struct udphdr *, m, off, sizeof(*uh)); + if (!uh) + return IPPROTO_DONE; +#endif + + udpstat.udps_ipackets++; + + plen = ntohs(ip6->ip6_plen) - off + sizeof(*ip6); + ulen = ntohs((u_short)uh->uh_ulen); + + if (plen != ulen) { + udpstat.udps_badlen++; + goto bad; + } + + /* + * Checksum extended UDP header and data. + */ + if (uh->uh_sum == 0) + udpstat.udps_nosum++; + else if (in6_cksum(m, IPPROTO_UDP, off, ulen) != 0) { + udpstat.udps_badsum++; + goto bad; + } + + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { + struct inpcb *last; + + /* + * Deliver a multicast datagram to all sockets + * for which the local and remote addresses and ports match + * those of the incoming datagram. This allows more than + * one process to receive multicasts on the same port. + * (This really ought to be done for unicast datagrams as + * well, but that would cause problems with existing + * applications that open both address-specific sockets and + * a wildcard socket listening to the same port -- they would + * end up receiving duplicates of every unicast datagram. + * Those applications open the multiple sockets to overcome an + * inadequacy of the UDP socket interface, but for backwards + * compatibility we avoid the problem here rather than + * fixing the interface. Maybe 4.5BSD will remedy this?) + */ + + /* + * In a case that laddr should be set to the link-local + * address (this happens in RIPng), the multicast address + * specified in the received packet does not match with + * laddr. To cure this situation, the matching is relaxed + * if the receiving interface is the same as one specified + * in the socket and if the destination multicast address + * matches one of the multicast groups specified in the socket. + */ + + /* + * Construct sockaddr format source address. + */ + init_sin6(&udp_in6, m); /* general init */ + udp_in6.sin6_port = uh->uh_sport; + /* + * KAME note: traditionally we dropped udpiphdr from mbuf here. + * We need udphdr for IPsec processing so we do that later. + */ + + /* + * Locate pcb(s) for datagram. + * (Algorithm copied from raw_intr().) + */ + last = NULL; + LIST_FOREACH(in6p, &udb, inp_list) { + if ((in6p->inp_vflag & INP_IPV6) == 0) + continue; + if (in6p->in6p_lport != uh->uh_dport) + continue; + if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) { + if (!IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, + &ip6->ip6_dst)) + continue; + } + if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) { + if (!IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, + &ip6->ip6_src) || + in6p->in6p_fport != uh->uh_sport) + continue; + } + + if (last != NULL) { + struct mbuf *n; + +#ifdef IPSEC + /* + * Check AH/ESP integrity. + */ + if (ipsec6_in_reject_so(m, last->inp_socket)) + ipsec6stat.in_polvio++; + /* do not inject data into pcb */ + else +#endif /* IPSEC */ + if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { + /* + * KAME NOTE: do not + * m_copy(m, offset, ...) above. + * sbappendaddr() expects M_PKTHDR, + * and m_copy() will copy M_PKTHDR + * only if offset is 0. + */ + if (last->in6p_flags & IN6P_CONTROLOPTS + || last->in6p_socket->so_options & SO_TIMESTAMP) + ip6_savecontrol(last, ip6, n, + &opts, NULL); + + m_adj(n, off + sizeof(struct udphdr)); + if (sbappendaddr(&last->in6p_socket->so_rcv, + (struct sockaddr *)&udp_in6, + n, opts.head) == 0) { + m_freem(n); + if (opts.head) + m_freem(opts.head); + udpstat.udps_fullsock++; + } else + sorwakeup(last->in6p_socket); + bzero(&opts, sizeof(opts)); + } + } + last = in6p; + /* + * Don't look for additional matches if this one does + * not have either the SO_REUSEPORT or SO_REUSEADDR + * socket options set. This heuristic avoids searching + * through all pcbs in the common case of a non-shared + * port. It assumes that an application will never + * clear these options after setting them. + */ + if ((last->in6p_socket->so_options & + (SO_REUSEPORT|SO_REUSEADDR)) == 0) + break; + } + + if (last == NULL) { + /* + * No matching pcb found; discard datagram. + * (No need to send an ICMP Port Unreachable + * for a broadcast or multicast datgram.) + */ + udpstat.udps_noport++; + udpstat.udps_noportmcast++; + goto bad; + } +#ifdef IPSEC + /* + * Check AH/ESP integrity. + */ + if (ipsec6_in_reject_so(m, last->inp_socket)) { + ipsec6stat.in_polvio++; + goto bad; + } +#endif /* IPSEC */ + if (last->in6p_flags & IN6P_CONTROLOPTS + || last->in6p_socket->so_options & SO_TIMESTAMP) + ip6_savecontrol(last, ip6, m, &opts, NULL); + + m_adj(m, off + sizeof(struct udphdr)); + if (sbappendaddr(&last->in6p_socket->so_rcv, + (struct sockaddr *)&udp_in6, + m, opts.head) == 0) { + udpstat.udps_fullsock++; + goto bad; + } + sorwakeup(last->in6p_socket); + return IPPROTO_DONE; + } + /* + * Locate pcb for datagram. + */ + in6p = in6_pcblookup_hash(&udbinfo, &ip6->ip6_src, uh->uh_sport, + &ip6->ip6_dst, uh->uh_dport, 1, + m->m_pkthdr.rcvif); + if (in6p == 0) { + if (log_in_vain) { + char buf[INET6_ADDRSTRLEN]; + + strcpy(buf, ip6_sprintf(&ip6->ip6_dst)); + log(LOG_INFO, + "Connection attempt to UDP %s:%d from %s:%d\n", + buf, ntohs(uh->uh_dport), + ip6_sprintf(&ip6->ip6_src), ntohs(uh->uh_sport)); + } + udpstat.udps_noport++; + if (m->m_flags & M_MCAST) { + printf("UDP6: M_MCAST is set in a unicast packet.\n"); + udpstat.udps_noportmcast++; + goto bad; + } + icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0); + return IPPROTO_DONE; + } +#ifdef IPSEC + /* + * Check AH/ESP integrity. + */ + if (ipsec6_in_reject_so(m, in6p->in6p_socket)) { + ipsec6stat.in_polvio++; + goto bad; + } +#endif /* IPSEC */ + + /* + * Construct sockaddr format source address. + * Stuff source address and datagram in user buffer. + */ + init_sin6(&udp_in6, m); /* general init */ + udp_in6.sin6_port = uh->uh_sport; + if (in6p->in6p_flags & IN6P_CONTROLOPTS + || in6p->in6p_socket->so_options & SO_TIMESTAMP) + ip6_savecontrol(in6p, ip6, m, &opts, NULL); + m_adj(m, off + sizeof(struct udphdr)); + if (sbappendaddr(&in6p->in6p_socket->so_rcv, + (struct sockaddr *)&udp_in6, + m, opts.head) == 0) { + udpstat.udps_fullsock++; + goto bad; + } + sorwakeup(in6p->in6p_socket); + return IPPROTO_DONE; +bad: + if (m) + m_freem(m); + if (opts.head) + m_freem(opts.head); + return IPPROTO_DONE; +} + +void +udp6_ctlinput(cmd, sa, d) + int cmd; + struct sockaddr *sa; + void *d; +{ + struct udphdr uh; + struct ip6_hdr *ip6; + struct mbuf *m; + int off = 0; + struct ip6ctlparam *ip6cp = NULL; + const struct sockaddr_in6 *sa6_src = NULL; + void *cmdarg; + void (*notify) __P((struct inpcb *, int)) = udp_notify; + struct udp_portonly { + u_int16_t uh_sport; + u_int16_t uh_dport; + } *uhp; + + if (sa->sa_family != AF_INET6 || + sa->sa_len != sizeof(struct sockaddr_in6)) + return; + + if ((unsigned)cmd >= PRC_NCMDS) + return; + if (PRC_IS_REDIRECT(cmd)) + notify = in6_rtchange, d = NULL; + else if (cmd == PRC_HOSTDEAD) + d = NULL; + else if (inet6ctlerrmap[cmd] == 0) + return; + + /* if the parameter is from icmp6, decode it. */ + if (d != NULL) { + ip6cp = (struct ip6ctlparam *)d; + m = ip6cp->ip6c_m; + ip6 = ip6cp->ip6c_ip6; + off = ip6cp->ip6c_off; + cmdarg = ip6cp->ip6c_cmdarg; + sa6_src = ip6cp->ip6c_src; + } else { + m = NULL; + ip6 = NULL; + cmdarg = NULL; + sa6_src = &sa6_any; + } + + if (ip6) { + /* + * XXX: We assume that when IPV6 is non NULL, + * M and OFF are valid. + */ + + /* check if we can safely examine src and dst ports */ + if (m->m_pkthdr.len < off + sizeof(*uhp)) + return; + + bzero(&uh, sizeof(uh)); + m_copydata(m, off, sizeof(*uhp), (caddr_t)&uh); + + (void) in6_pcbnotify(&udb, sa, uh.uh_dport, + (struct sockaddr *)ip6cp->ip6c_src, + uh.uh_sport, cmd, cmdarg, notify); + } else + (void) in6_pcbnotify(&udb, sa, 0, (struct sockaddr *)&sa6_src, + 0, cmd, cmdarg, notify); +} + +static int +udp6_abort(struct socket *so) +{ + struct inpcb *inp; + int s; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; /* ??? possible? panic instead? */ + soisdisconnected(so); + s = splnet(); + in6_pcbdetach(inp); + splx(s); + return 0; +} + +static int +udp6_attach(struct socket *so, int proto, struct proc *p) +{ + struct inpcb *inp; + int s, error; + + inp = sotoinpcb(so); + if (inp != 0) + return EINVAL; + + if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { + error = soreserve(so, udp_sendspace, udp_recvspace); + if (error) + return error; + } + s = splnet(); + error = in_pcballoc(so, &udbinfo, p); + splx(s); + if (error) + return error; + inp = (struct inpcb *)so->so_pcb; + inp->inp_vflag |= INP_IPV6; + inp->in6p_hops = -1; /* use kernel default */ + inp->in6p_cksum = -1; /* just to be sure */ + /* + * XXX: ugly!! + * IPv4 TTL initialization is necessary for an IPv6 socket as well, + * because the socket may be bound to an IPv6 wildcard address, + * which may match an IPv4-mapped IPv6 address. + */ + inp->inp_ip_ttl = ip_defttl; + return 0; +} + +static int +udp6_bind(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + struct inpcb *inp; + int s, error; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; + + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; + if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { + struct sockaddr_in6 *sin6_p; + + sin6_p = (struct sockaddr_in6 *)nam; + + if (IN6_IS_ADDR_UNSPECIFIED(&sin6_p->sin6_addr)) + inp->inp_vflag |= INP_IPV4; + else if (IN6_IS_ADDR_V4MAPPED(&sin6_p->sin6_addr)) { + struct sockaddr_in sin; + + in6_sin6_2_sin(&sin, sin6_p); + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; + s = splnet(); + error = in_pcbbind(inp, (struct sockaddr *)&sin, p); + splx(s); + return error; + } + } + + s = splnet(); + error = in6_pcbbind(inp, nam, p); + splx(s); + return error; +} + +static int +udp6_connect(struct socket *so, struct sockaddr *nam, struct proc *p) +{ + struct inpcb *inp; + int s, error; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; + + if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { + struct sockaddr_in6 *sin6_p; + + sin6_p = (struct sockaddr_in6 *)nam; + if (IN6_IS_ADDR_V4MAPPED(&sin6_p->sin6_addr)) { + struct sockaddr_in sin; + + if (inp->inp_faddr.s_addr != INADDR_ANY) + return EISCONN; + in6_sin6_2_sin(&sin, sin6_p); + s = splnet(); + error = in_pcbconnect(inp, (struct sockaddr *)&sin, p); + splx(s); + if (error == 0) { + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; + soisconnected(so); + } + return error; + } + } + if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) + return EISCONN; + s = splnet(); + error = in6_pcbconnect(inp, nam, p); + splx(s); + if (error == 0) { + if (ip6_mapped_addr_on) { /* should be non mapped addr */ + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; + } + soisconnected(so); + } + return error; +} + +static int +udp6_detach(struct socket *so) +{ + struct inpcb *inp; + int s; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; + s = splnet(); + in6_pcbdetach(inp); + splx(s); + return 0; +} + +static int +udp6_disconnect(struct socket *so) +{ + struct inpcb *inp; + int s; + + inp = sotoinpcb(so); + if (inp == 0) + return EINVAL; + +#ifdef INET + if (inp->inp_vflag & INP_IPV4) { + struct pr_usrreqs *pru; + + pru = inetsw[ip_protox[IPPROTO_UDP]].pr_usrreqs; + return ((*pru->pru_disconnect)(so)); + } +#endif + + if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) + return ENOTCONN; + + s = splnet(); + in6_pcbdisconnect(inp); + inp->in6p_laddr = in6addr_any; + splx(s); + so->so_state &= ~SS_ISCONNECTED; /* XXX */ + return 0; +} + +static int +udp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, + struct mbuf *control, struct proc *p) +{ + struct inpcb *inp; + int error = 0; + + inp = sotoinpcb(so); + if (inp == 0) { + error = EINVAL; + goto bad; + } + + if (addr) { + if (addr->sa_len != sizeof(struct sockaddr_in6)) { + error = EINVAL; + goto bad; + } + if (addr->sa_family != AF_INET6) { + error = EAFNOSUPPORT; + goto bad; + } + } + +#ifdef INET + if (ip6_mapped_addr_on) { + int hasv4addr; + struct sockaddr_in6 *sin6 = 0; + + if (addr == 0) + hasv4addr = (inp->inp_vflag & INP_IPV4); + else { + sin6 = (struct sockaddr_in6 *)addr; + hasv4addr = IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr) + ? 1 : 0; + } + if (hasv4addr) { + struct pr_usrreqs *pru; + + if ((inp->inp_flags & IN6P_IPV6_V6ONLY)) { + /* + * since a user of this socket set the + * IPV6_V6ONLY flag, we discard this + * datagram destined to a v4 addr. + */ + return EINVAL; + } + if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) + && !IN6_IS_ADDR_V4MAPPED(&inp->in6p_laddr)) { + /* + * when remote addr is IPv4-mapped + * address, local addr should not be + * an IPv6 address; since you cannot + * determine how to map IPv6 source + * address to IPv4. + */ + return EINVAL; + } + if (sin6) + in6_sin6_2_sin_in_sock(addr); + pru = inetsw[ip_protox[IPPROTO_UDP]].pr_usrreqs; + error = ((*pru->pru_send)(so, flags, m, addr, control, + p)); + /* addr will just be freed in sendit(). */ + return error; + } + } +#endif + + return udp6_output(inp, m, addr, control, p); + + bad: + m_freem(m); + return(error); +} + +struct pr_usrreqs udp6_usrreqs = { + udp6_abort, pru_accept_notsupp, udp6_attach, udp6_bind, udp6_connect, + pru_connect2_notsupp, in6_control, udp6_detach, udp6_disconnect, + pru_listen_notsupp, in6_mapped_peeraddr, pru_rcvd_notsupp, + pru_rcvoob_notsupp, udp6_send, pru_sense_null, udp_shutdown, + in6_mapped_sockaddr, sosend, soreceive, sopoll +}; diff --git a/packages/net/common/current/ChangeLog b/packages/net/common/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/net/common/current/ChangeLog @@ -0,0 +1,326 @@ +2002-05-14 Jesper Skov + + * src/tftp_dummy_file.c: Fixed warnings. + + * src/getaddrinfo.c: Fixed warnings. + +2002-04-26 Gary Thomas + + * cdl/net.cdl: Add option for making random IP packet IDs random. + +2002-04-22 Gary Thomas + + * src/ifaddrs.c: Reorg include files - remove warnings. + +2002-04-17 Gary Thomas + + * src/ipv6_routing_thread.c: New function - separate thread used to + send router soliciation messages periodically. + + * cdl/net.cdl: + * src/network_support.c (init_all_network_interfaces): + Support IPv6 routing thread. + + * src/getaddrinfo.c (_getaddr): Set ai_addrlen fields. + +2002-04-11 Gary Thomas + + * tests/ga_server_test.c: + * tests/nc6_test_slave.c: Fix handling of multiple sockets. + +2002-04-05 Gary Thomas + + * tests/ga_server_test.c: Use getnameinfo(). + + * include/net/netdb.h: + * src/getaddrinfo.c (getnameinfo): New [minimal] implementation. + +2002-04-04 Gary Thomas + + * src/network_support.c (build_bootp_record): Query device for hardware + address (required change in function profile). Bug #59369 + +2002-03-27 Gary Thomas + + * tests/make.linux: Add slave tests. + + * tests/nc_test_framework.h: + * tests/nc6_test_master.c: + * tests/nc6_test_slave.c: Fixing build problems on Linux & FreeBSD. + + * include/machine/types.h: Added [empty to keep OpenBSD stack happy]. + +2002-03-27 Jonathan Larmour + + * doc/tcpip.sgml: Place TCP/IP manpages here. + +2002-03-25 Gary Thomas + + * tests/nc_test_master.c: Fix problem with buffer size (static + buffer was only 8192 bytes, but the code tried to use 10240!) + + * tests/nc6_test_slave.c: Print memory statistics on failures and + at the end of each test. + + * tests/nc6_test_master.c: Fix problem with buffer size (static + buffer was only 8192 bytes, but the code tried to use 10240!) + Lots of improvements, including command line processing to suppress + certain classes of tests. + + * src/inet_addr.c: Add cast to isascii() macro to avoid warnings. + +2002-03-21 Gary Thomas + + * tests/nc6_test_slave.c: Minor cleanups - allow building without IPv6. + +2002-03-20 Gary Thomas + + * tests/tcp_source.c: + * tests/tcp_sink.c: Fix build problems on Linux (no sin_len). + + * tests/make.linux: + * tests/nc6_test_slave.c: + * tests/nc6_test_master.c: New tests using getaddrinfo() which + can test both IPv4 and IPv6 environments. + +2002-03-19 Gary Thomas + + * tests/addr_test.c: New test of getaddrinfo() functionality. + + * src/inet_ntop.c (_inet_port): + * src/getaddrinfo.c (_getaddr): Fix some byte-order problems. + + * src/network_support.c: Fix build when PCMCIA defined. + + * src/bootp_support.c (do_bootp): + * include/network.h: route_reinit renamed cyg_route_reinit. + + * include/bootp.h: Clean up warnings (add prototypes, etc). + +2002-03-12 Hugo Tyson + + * tests/dhcp_test2.c (cyg_user_start): Change priority of test + thread to CYGPKG_NET_DHCP_THREAD_PRIORITY, so that it is lower + than the network service thread. Otherwise down-up cycling the + state of some types of driver leaks MBUFs because of tx-done + events being lost. + +2002-03-11 Hugo Tyson + + * cdl/net.cdl: Add dhcp_test2 to the list. + + * tests/dhcp_test2.c: New testcase: repeatedly cycle interface(s) + up and down using DHCP to test for storeleaks. The test cannot + tell unless you run it forever, of course, but that it completes + without timeout is a fair test in itself. + +2002-03-08 Gary Thomas + + * tests/tcp_lo_test.c (server): Need to set 'len', otherwise + the source socket address is undefined. + +2002-03-07 Gary Thomas + + * src/dhcp_prot.c: Some [internal] function names have changed. + In particular, route_reinit() and arc4random(). + +2002-03-06 Gary Thomas + + * tests/ga_server_test.c: New test - used to exercise getaddrinfo(). + + * src/inet_pton.c: Minor source code cleanups. + + * src/inet_ntop.c (_inet_ntop): Add [non-standard] functions + which make it easier for code to be generic in the handling + of network addresses (struct sockaddr). + + * include/net/netdb.h: + * include/network.h: Reorg - network address functions are now + all in + + * cdl/net.cdl: Add getaddrinfo support. + * src/getaddrinfo.c: New file. + + * include/arpa/nameser.h: Fix some warnings. + +2002-02-26 Hugo Tyson + + * src/dhcp_prot.c (do_dhcp): Two things: a) not all ACK packets + contain all the information that we in the OFFER packet, so do not + overwrite the offer with any ACKs we receive. b) REQUEST packets + when in the RENEWING or REBINDING states "MUST NOT" contain REQ_IP + nor SERVER_ID tags. So remove 'em. Hence: + (unset_tag): New routine. + +2002-02-22 Hugo Tyson + + * doc/tcpip.sgml: New file. Separated generic documentation + of network support from the specific stack docs. Also much + tidying and improvement. + +2002-02-19 Gary Thomas + + * tests/ipv6_server_test.c: New file. Test TCP/IPv6 sockets. + + * src/bootp_support.c: + * src/inet_pton.c: Remove some warnings. + + * src/inet_ntop.c: New file(). + * cdl/net.cdl: + * include/network.h: Add prototypes for inet_ntop() and + inet_pton() - generic [numeric] address support. + +2002-02-18 Gary Thomas + + * cdl/net.cdl: + Add new interface CYGINT_IO_ETH_MULTICAST which is used to + insure that drivers support multicast addresses if IPv6 is used. + +2002-02-18 Gary Thomas + + * src/bootp_support.c (init_net_IPv6): Fix problem with static address + prefix mask(length). This kept the stack from accepting neighborhood + routing for that same prefix. + +2002-02-16 Gary Thomas + + * src/inet_pton.c: + New file - parse from presentation (ASCII) to network. + Useful for handling IPv6 addresses. + +2002-02-15 Gary Thomas + + * src/network_support.c (init_all_network_interfaces): Set IPv6 + static addresses if configured. + + * src/bootp_support.c (init_net_IPv6): New function used to set + static IPv6 addresses. + + * cdl/net.cdl: Improve layering to better support multiple + stacks. Move IPv4/IPv6 control to this level. + +2002-02-01 Hugo Tyson + + * tests/nc_test_slave.c (do_tcp_test): Make it build. There is no + test_chan here, only test_chan_slave and test_chan_master. + +2002-02-01 Gary Thomas + + * tests/udp_lo_test.c (server): + * tests/tcp_source.c (source_test): + * tests/tcp_sink.c (sink_test): + * tests/tcp_lo_test.c (server): + * tests/tcp_lo_select.c (server): + * tests/ping_test.c (ping_test): + * tests/ping_lo_test.c (ping_test_loopback): + * tests/nc_test_slave.c (do_udp_test): + * tests/multi_lo_select.c (dummy): + * tests/ftp_test.c (ftp_test): + * tests/flood.c (net_test): + * tests/dhcp_test.c (ping_test): + * src/tftp_server.c (tftpd_write_file): + * src/tftp_client.c (tftp_get): + * src/network_support.c (init_loopback_interface): + * src/dhcp_prot.c (bring_half_up): Need valid value for sin_len. + +2002-01-31 Hugo Tyson + + * src/dhcp_prot.c (do_dhcp): Also check the ESA in any received + answer matches, in case of an XID clash anyway. + +2002-01-31 Hugo Tyson + + * src/dhcp_prot.c (do_dhcp): Generate a new XID (transaction ID) + every time this routine is entered. Use the ESA and a random + source to avoid clashes with other net presences. (The ESA was + used uninitialized before this change.) Also use new macro + NEW_XID to increment the XID when we move to a new phase of the + protocol - one XID covers a question (identically transmitted + several times if necessary) and its answer. A new question => a + new XID. + + Also fixed a gedankenbug about the timeouts. Old version tried + RENEWING the lease when T1 timed out as it should; but if that + failed (after the normal retries), it went straight into REBINDING + whether or not T2 had already timed out. Likewise if REBINDING + failed, it terminated the lease, whether or not the EX time had + timed out. This is wrong - it meant that a lease of 600 seconds + would actually shutdown the interface after about 340 (T1 + some) + if the server was gone. + + The fix is to return to state BOUND from either RENEWING or + REBINDING (without resetting the lease timeouts) even if the + attempt failed; the rest of the lease machinery will take care of + things as and when the right time ticks by. It's still the case + that if a timeout occurs whilst trying on part or another, the + machine will be forced to the next state - all that is in order as + it always was. + +2002-01-29 Gary Thomas + + * tests/server_test.c (server_test): Add message for timeout. + +2002-01-28 Gary Thomas + + * tests/udp_lo_test.c: + * tests/tftp_server_test.c: + * tests/tftp_client_test.c: + * tests/tcp_source.c: + * tests/tcp_sink.c: + * tests/tcp_lo_test.c: + * tests/tcp_lo_select.c: + * tests/tcp_echo.c: + * tests/socket_test.c: + * tests/set_mac_address.c: + * tests/server_test.c: + * tests/ping_test.c: + * tests/ping_lo_test.c: + * tests/nc_test_slave.c: + * tests/nc_test_master.c: + * tests/nc_test_framework.h: + * tests/multi_lo_select.c: + * tests/mbuf_test.c: + * tests/make.linux: + * tests/linux_echo.c: + * tests/ftp_test.c: + * tests/flood.c: + * tests/dhcp_test.c: + * tests/bridge.c: + + * src/tftp_server.c: + * src/tftp_dummy_file.c: + * src/tftp_client.c: + * src/network_support.c: + * src/inet_ntoa.c: + * src/inet_addr.c: + * src/getserv.c: + * src/getproto.c: + * src/dhcp_support.c: + * src/dhcp_prot.c: + * src/bootp_support.c: + + * include/net/netdb.h: + * include/machine/endian.h: + * include/machine/ansi.h: + * include/arpa/tftp.h: + * include/arpa/telnet.h: + * include/arpa/nameser.h: + * include/arpa/inet.h: + * include/arpa/ftp.h: + * include/tftp_support.h: + * include/network.h: + * include/dhcp.h: + * include/bootp.h: + + * cdl/net.cdl: New [common] networking package. Actual stacks + are implementations provided alongside this package. + +#####ECOSPDCOPYRIGHTBEGIN#### +# +# Copyright (C) 2002 Red Hat, Inc. +# All Rights Reserved. +# +# Permission is granted to use, copy, modify and redistribute this +# file. +# +#####ECOSPDCOPYRIGHTEND#### diff --git a/packages/net/common/current/cdl/net.cdl b/packages/net/common/current/cdl/net.cdl new file mode 100644 --- /dev/null +++ b/packages/net/common/current/cdl/net.cdl @@ -0,0 +1,643 @@ +# ==================================================================== +# +# net.cdl +# +# Networking configuration data +# +# ==================================================================== +#####ECOSPDCOPYRIGHTBEGIN#### +# +# Copyright (C) 2000, 2001, 2002 Red Hat, Inc. +# All Rights Reserved. +# +# Permission is granted to use, copy, modify and redistribute this +# file. +# +#####ECOSPDCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): gthomas +# Original data: gthomas +# Contributors: +# Date: 1999-11-29 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_NET { + display "Basic networking framework" + doc doc/index.html + include_dir . + requires CYGPKG_IO + requires CYGPKG_ISOINFRA + requires CYGINT_ISO_C_TIME_TYPES + requires CYGINT_ISO_STRERROR + requires CYGINT_ISO_ERRNO + requires CYGINT_ISO_ERRNO_CODES + requires CYGINT_ISO_MALLOC + requires CYGINT_ISO_STRING_BSD_FUNCS + description "Basic networking support, including TCP/IP." + + cdl_interface CYGPKG_NET_DRIVER_FRAMEWORK { + display "Suitable driver framework interface, used by network package" + description " + In order to decouple the network stack from driver specifics, the + driver framework must be defined in a separate package." + } + + # Commonly exported infrastructure + implements CYGINT_ISO_NETDB_PROTO + implements CYGINT_ISO_NETDB_SERV + requires { CYGBLD_ISO_NETDB_PROTO_HEADER == "" } + requires { CYGBLD_ISO_NETDB_SERV_HEADER == "" } + + cdl_interface CYGPKG_NET_STACK { + display "Suitable network stack implementation, used by network package" + description " + In order to decouple the network support from most stack specifics, the + actual stack implementation must be defined in a separate package." + } + requires { CYGPKG_NET_STACK == 1 } + define_proc { + puts $::cdl_header "#include " + puts $::cdl_header "#include CYGDAT_NET_STACK_CFG" + } + + cdl_interface CYGPKG_NET_STACK_INET { + display "Network stack support for IPv4" + } + cdl_interface CYGPKG_NET_STACK_INET6 { + display "Network stack support for IPv6" + } + + cdl_component CYGPKG_NET_INET { + display "INET support" + active_if CYGPKG_NET_STACK_INET + flavor bool + no_define + default_value 1 + description " + This option enables support for INET (IP) network processing." + define INET + compile \ + inet_addr.c \ + inet_ntoa.c \ + inet_ntop.c \ + inet_pton.c \ + bootp_support.c \ + dhcp_support.c \ + dhcp_prot.c \ + network_support.c \ + getproto.c \ + getserv.c + compile getaddrinfo.c \ + ifaddrs.c + + cdl_option CYGPKG_NET_INET6 { + display "IPv6 support" + active_if CYGPKG_NET_STACK_INET6 + requires CYGINT_IO_ETH_MULTICAST + flavor bool + default_value 0 + description " + This option enables support for IPv6 networks." + define INET6 + } + + cdl_option CYGSEM_NET_ROUTING { + display "Multicast routing support" + flavor bool + no_define + default_value 0 + description " + This option enables support for packet routing." + define MROUTING + } + + cdl_option CYGSEM_NET_RANDOMID { + display "Use random sequence for IP packet identifiers" + flavor bool + no_define + default_value 0 + description " + This option enables the use of random IP packet sequence + identifiers, rather than a purely sequential sequence. It is + believed that use of random identifiers improves security, at + a fairly substantial computational overhead." + define RANDOM_IP_ID + } + + } + + cdl_component CYGPKG_NET_TFTP { + display "TFTP (RFC-1350) support" + requires CYGPKG_NET_INET + flavor bool + default_value 1 + compile tftp_client.c \ + tftp_server.c + description " + This option provides additional library support for + the TFTP (Trivial File Transfer Protocol)." + + cdl_option CYGPKG_NET_TFTPD_THREAD_PRIORITY { + display "Priority level for TFTP daemon thread." + flavor data + default_value 10 + description " + This option allows the thread priority level used by the + TFTP server thread to be adjusted by the user. It should be set + high enough that sufficient CPU resources are available to + process network data, but may be adjusted so that application + threads can have precedence over TFTP server processing." + } + + cdl_option CYGPKG_NET_TFTP_FILE_ACCESS { + display "File I/O functions for TFTP server" + flavor bool + default_value 1 + compile tftp_dummy_file.c + description " + Minimal in-memory file I/O support for TFTP server." + } + } + + cdl_component CYGPKG_NET_DHCP { + display "Use full DHCP instead of BOOTP" + requires CYGPKG_NET_INET + active_if (CYGHWR_NET_DRIVERS > 0) + flavor bool + default_value 1 + description " + Provide DHCP for initializing the IP address + of network interfaces. The DHCP client is capable of falling + back to BOOTP usage if the server does not support DHCP, so it + should never be necessary to disable this option. However, + depending on other configuration the DHCP client may provide or + require a kernel thread of its own; this consumes quite a lot + of resource which a BOOTP solution does not require." + + cdl_option CYGOPT_NET_DHCP_DHCP_THREAD { + display "DHCP management thread" + flavor bool + default_value 1 + description " + Provide a separate thread to renew DHCP leases; otherwise + the application MUST periodically examine the semaphore + dhcp_needs_attention and call dhcp_bind() if it is + signalled. If enabled, this thread does all that for you. + Independent of this option, initialization of the + interfaces still occurs in init_all_network_interfaces() + and your startup code must call that. It will start the + DHCP management thread if necessary. If a lease fails to + be renewed, the management thread will shut down all + interfaces and attempt to initialize all the interfaces + again from scratch. This may cause application problems, + in which case managing the DHCP state in an application + aware thread is recommended. See comments in dhcp.h" + } + + cdl_option CYGOPT_NET_DHCP_DHCP_THREAD_PARAM { + display "DHCP management thread loops forever" + flavor data + default_value 1 + active_if CYGOPT_NET_DHCP_DHCP_THREAD + description " + If the parameter is nonzero, it loops forever; if zero, + the thread exits if a lease expires, and the application + must detect this and tidy up or reboot the whole machine." + } + + cdl_option CYGPKG_NET_DHCP_THREAD_PRIORITY { + display "DHCP management thread priority" + flavor data + default_value CYGPKG_NET_THREAD_PRIORITY + 1 + active_if CYGOPT_NET_DHCP_DHCP_THREAD + description " + This option sets the thread priority level used by the DHCP + management thread. It should be high enough that it can run + when necessary, but it does not need to be as high as the + network thread itself." + } + } + + cdl_component CYGPKG_NET_IPV6_ROUTING { + display "Options controlling IPv6 routing" + active_if CYGPKG_NET_INET6 + flavor bool + default_value 1 + description " + Various options which control how routing is done for the + IPv6 enabled interfaces." + + cdl_component CYGOPT_NET_IPV6_ROUTING_THREAD { + display "Thread for IPv6 routing" + flavor bool + default_value 1 + description " + Provide a separate thread to send router solicitation + messages." + + compile ipv6_routing_thread.c + + cdl_option CYGINT_NET_IPV6_ROUTING_THREAD_PRIORITY { + display "IPv6 routing thread priority" + flavor data + default_value CYGPKG_NET_THREAD_PRIORITY + 1 + description " + This option sets the thread priority level used by the IPv6 + routing thread. It should be high enough that it can run + when necessary, but it does not need to be as high as the + network thread itself." + } + + cdl_option CYGINT_NET_IPV6_ROUTING_THREAD_PERIOD { + display "IPv6 routing thread rate" + flavor data + default_value 5*60 + description " + This option sets the rate at which router solicitations will + be sent out by the routing thread (in seconds)." + } + } + } + + cdl_component CYGPKG_NET_DEBUG { + display "Debug output" + default_value 0 + description " + This component controls whether there is diagnostic output + for stack operations. Options within this component allow + even more verbose output for certain areas." + + cdl_option CYGDBG_NET_DHCP_CHATTER { + display "Extra debug output for DHCP" + default_value 0 + } + } + + cdl_option CYGDBG_NET_TIMING_STATS { + display "Network timing statistics" + default_value 0 + description " + This component controls whether there is diagnostic + information about how long memcpy, malloc, mbuf_alloc + etc take to perform." + } + + cdl_component CYGPKG_NET_OPTIONS { + display "Networking support build options" + flavor none + no_define + + cdl_option CYGPKG_NET_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL -D__ECOS -D__INSIDE_NET" } + description " + This option modifies the set of compiler flags for + building the networking package. + These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_NET_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the networking package. These flags are removed from + the set of global flags if present." + } + } + + cdl_component CYGPKG_NET_BUILD_TESTS { + display "Build networking tests (demo programs)" + flavor bool + no_define + default_value 0 + description " + This option enables the building of additional network tests + which at this time are just demos; otherwise only loopback + interface tests will be built." + + cdl_option CYGPKG_NET_TESTS { + display "Networking tests" + flavor data + no_define + calculated { CYGPKG_NET_BUILD_TESTS ? \ + "tests/mbuf_test \ + tests/socket_test \ + tests/ftp_test \ + tests/server_test \ + tests/nc_test_slave \ + tests/tftp_client_test \ + tests/tftp_server_test \ + tests/tcp_echo \ + tests/set_mac_address \ + tests/bridge \ + tests/flood \ + tests/ping_test \ + tests/dhcp_test \ + tests/dhcp_test2 \ + tests/ping_lo_test \ + tests/tcp_lo_test \ + tests/udp_lo_test \ + tests/multi_lo_select \ + tests/tcp_lo_select" + : + "tests/ping_lo_test \ + tests/tcp_lo_test \ + tests/udp_lo_test \ + tests/multi_lo_select \ + tests/tcp_lo_select" + } + description " + This option specifies the set of tests + for the networking package." + } + + cdl_option CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS { + display "Use real-time response test harness (if available)" + default_value 0 + description " + Platform and/or ethernet device driver packages may + provide a test harness to verify that interrupts are + not disabled or flooded for too long during a test. If + such is provided, CYGTST_DEVS_ETH_TEST_NET_REALTIME is + defined and can be #include'd to acquire the support. + Some tests in the TCP/IP stack can use this harness; + this option controls whether they do. The StrongARM + EBSA285 Ethernet device driver is one package that + provides such a harness. See the file + tests/test_net_realtime.h in there for details." + } + } + +# Description and control over different interfaces + + cdl_interface CYGHWR_NET_DRIVERS { + display "Network drivers" + } + + cdl_interface CYGHWR_NET_DRIVER_ETH0 { + display "Does the hardware provide an 'eth0' device?" + requires { CYGHWR_NET_DRIVER_ETH0 <= 1 } + flavor bool + } + + cdl_component CYGHWR_NET_DRIVER_ETH0_SETUP_OPTIONS { + display "Initialization options for 'eth0'" + active_if (CYGHWR_NET_DRIVER_ETH0 == 1) + flavor none + no_define + + cdl_interface CYGHWR_NET_DRIVER_ETH0_SETUP { + display "Initialization options for 'eth0'" + requires 1 == CYGHWR_NET_DRIVER_ETH0_SETUP + no_define + } + + cdl_component CYGHWR_NET_DRIVER_ETH0_MANUAL { + display "Initialize 'eth0' manually?" + default_value 0 + implements CYGHWR_NET_DRIVER_ETH0_SETUP + description " + If this option is selected, the eCos library provides no + initialization code for this interface; you must perform + all the initialization in the application, by means of + appropriate ioctl() calls, or by calling init_net() with an + appropriate bootp record you have constructed yourself." + } + + cdl_component CYGHWR_NET_DRIVER_ETH0_BOOTP { + display "Use BOOTP/DHCP to initialize 'eth0'?" + default_value 1 + implements CYGHWR_NET_DRIVER_ETH0_SETUP + description " + If this option is selected, init_all_network_interfaces() + will use DHCP or BOOTP to acquire initialization data for + this interface, and then set it up accordingly." + + cdl_option CYGHWR_NET_DRIVER_ETH0_DHCP { + display "Use DHCP rather than BOOTP for 'eth0'?" + flavor bool + default_value 1 + active_if CYGPKG_NET_DHCP + } + + cdl_option CYGHWR_NET_DRIVER_ETH0_BOOTP_SHOW { + display "Show BOOTP/DHCP initialization values?" + flavor bool + default_value 1 + } + } + + cdl_option CYGHWR_NET_DRIVER_ETH0_IPV6_PREFIX { + display "Static IPv6 address prefix for 'eth0'" + flavor booldata + active_if CYGPKG_NET_INET6 + default_value { "3ffe:302:11:2" } + description " + This option allows a specific, static address prefix to be set + for an interface running IPv6. When used, the lower 64 bits + of the address will be set to the IPv4 IP address. Note: this + should not be confused with the standard IPv4->IPv6 mapped + addresses, but rather just a simple way to assign addresses + to nodes within an IPv6 network." + } + + cdl_component CYGHWR_NET_DRIVER_ETH0_ADDRS { + display "Address setups for 'eth0'" + implements CYGHWR_NET_DRIVER_ETH0_SETUP + no_define + + description " + These options let you configure all the initialization data + that init_all_network_interfaces() will use + for 'eth0' statically. Be careful when doing this, because + if you run the same application image on multiple boards, + they will have identical IP addresses and so on; this is a + Bad Thing. + The values you set are inserted in a bootp-style record + that is fed into a common setup routine to configure the + interface. That routine does not in fact use the 'Server + IP address' field. + The bootp record is also available to application code, and + some eCos networking test programs use the 'Server IP + address' field to mean 'a machine we can interact with' for + example to ping or perform ftp with. That is the rationale + for its inclusion here. + The gateway address is used to set up a default route if + nonzero. If you have more than one interface, setting up + more than one default route is will cause malfunctions. A + gateway address of 0.0.0.0 can be set to prevent that route + setup. Of course, your application can add real routes + once the interface(s) initialization is complete." + + cdl_option CYGHWR_NET_DRIVER_ETH0_ADDRS_IP { + display "IP address for 'eth0'" + flavor data + default_value { "192.168.1.2" } + } + + cdl_option CYGHWR_NET_DRIVER_ETH0_ADDRS_NETMASK { + display "Network mask address for 'eth0'" + flavor data + default_value { "255.255.255.0" } + } + + cdl_option CYGHWR_NET_DRIVER_ETH0_ADDRS_BROADCAST { + display "Broadcast address for 'eth0'" + flavor data + default_value { "192.168.1.255" } + } + + cdl_option CYGHWR_NET_DRIVER_ETH0_ADDRS_GATEWAY { + display "Gateway/router IP address for 'eth0'" + flavor data + default_value { "192.168.1.1" } + } + + cdl_option CYGHWR_NET_DRIVER_ETH0_ADDRS_SERVER { + display "Server IP address for 'eth0'" + flavor data + default_value { "192.168.1.101" } + } + } + } + + cdl_interface CYGHWR_NET_DRIVER_ETH1 { + display "Does the hardware provide an 'eth1' device?" + requires { CYGHWR_NET_DRIVER_ETH1 <= 1 } + flavor bool + } + + cdl_component CYGHWR_NET_DRIVER_ETH1_SETUP_OPTIONS { + display "Initialization options for 'eth1'" + active_if (CYGHWR_NET_DRIVER_ETH1 == 1) + flavor none + no_define + + cdl_interface CYGHWR_NET_DRIVER_ETH1_SETUP { + display "Initialization options for 'eth1'" + requires 1 == CYGHWR_NET_DRIVER_ETH1_SETUP + no_define + } + + cdl_component CYGHWR_NET_DRIVER_ETH1_MANUAL { + display "Initialize 'eth1' manually?" + default_value 0 + implements CYGHWR_NET_DRIVER_ETH1_SETUP + description " + If this option is selected, the eCos library provides no + initialization code for this interface; you must perform + all the initialization in the application, by means of + appropriate ioctl() calls, or by calling init_net() with an + appropriate bootp record you have constructed yourself." + } + + cdl_component CYGHWR_NET_DRIVER_ETH1_BOOTP { + display "Use BOOTP/DHCP to initialize 'eth1'?" + default_value 1 + implements CYGHWR_NET_DRIVER_ETH1_SETUP + description " + If this option is selected, init_all_network_interfaces() + will use DHCP or BOOTP to acquire initialization data for + this interface, and then set it up accordingly." + + cdl_option CYGHWR_NET_DRIVER_ETH1_DHCP { + display "Use DHCP rather than BOOTP for 'eth1'?" + flavor bool + default_value 1 + active_if CYGPKG_NET_DHCP + } + + cdl_option CYGHWR_NET_DRIVER_ETH1_BOOTP_SHOW { + display "Show BOOTP/DHCP initialization values?" + flavor bool + default_value 1 + } + } + + cdl_option CYGHWR_NET_DRIVER_ETH1_IPV6_PREFIX { + display "Static IPv6 address prefix for 'eth1'" + flavor booldata + active_if CYGPKG_NET_INET6 + default_value { "3ffe:302:12:2" } + description " + This option allows a specific, static address prefix to be set + for an interface running IPv6. When used, the lower 64 bits + of the address will be set to the IPv4 IP address. Note: this + should not be confused with the standard IPv4->IPv6 mapped + addresses, but rather just a simple way to assign addresses + to nodes within an IPv6 network." + } + + cdl_component CYGHWR_NET_DRIVER_ETH1_ADDRS { + display "Address setups for 'eth1'" + implements CYGHWR_NET_DRIVER_ETH1_SETUP + no_define + + description " + These options let you configure all the initialization data + that init_all_network_interfaces() will use + for 'eth1' statically. Be careful when doing this, because + if you run the same application image on multiple boards, + they will have identical IP addresses and so on; this is a + Bad Thing. + The values you set are inserted in a bootp-style record + that is fed into a common setup routine to configure the + interface. That routine does not in fact use the 'Server + IP address' field. + The bootp record is also available to application code, and + some eCos networking test programs use the 'Server IP + address' field to mean 'a machine we can interact with' for + example to ping or perform ftp with. That is the rationale + for its inclusion here. + The gateway address is used to set up a default route if + nonzero. If you have more than one interface, setting up + more than one default route is will cause malfunctions. A + gateway address of 0.0.0.0 can be set to prevent that route + setup. Of course, your application can add real routes + once the interface(s) initialization is complete. + This interface 'eth1' has no route set up in the default + configuration." + + cdl_option CYGHWR_NET_DRIVER_ETH1_ADDRS_IP { + display "IP address for 'eth1'" + flavor data + default_value { "192.168.1.2" } + } + + cdl_option CYGHWR_NET_DRIVER_ETH1_ADDRS_NETMASK { + display "Network mask address for 'eth1'" + flavor data + default_value { "255.255.255.0" } + } + + cdl_option CYGHWR_NET_DRIVER_ETH1_ADDRS_BROADCAST { + display "Broadcast address for 'eth1'" + flavor data + default_value { "192.168.1.255" } + } + + cdl_option CYGHWR_NET_DRIVER_ETH1_ADDRS_GATEWAY { + display "Gateway/router IP address for 'eth1'" + flavor data + default_value { "0.0.0.0" } + } + + cdl_option CYGHWR_NET_DRIVER_ETH1_ADDRS_SERVER { + display "Server IP address for 'eth1'" + flavor data + default_value { "192.168.1.101" } + } + } + } +} diff --git a/packages/net/common/current/doc/ChangeLog.0 b/packages/net/common/current/doc/ChangeLog.0 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/ChangeLog.0 @@ -0,0 +1,70 @@ +2002-01-04 Jonathan Larmour + + * prepare-manpages.sh: Use groff -Tascii -mandoc instead of nroff -man. + * tcpip-manpages.sgml: Regenerate. + +2001-12-22 Jonathan Larmour + + * tcpip.sgml: Give every chapter/part/sect1 an ID. + +2001-12-17 Mark Galassi + + * prepare-manpages.sh: fixed a little bug: the sed commands were + being called in the wrong order so that & was converted to & + after < was converted to <, with the result that < was being + converted to &lt; which is wrong. On top of that I had a typo + of > instead of < + + * tcpip-old-manpage-chapter.sgml: old deprecated stuff which I'm + saving off for now. It's been replaced by the prepare-manpages.sh + script which generates the tcpip-manpages.sgml file. + + * tcpip.sgml: took out the old ugly man pages and included the + auto-generated tcpip-manpages.sgml file instead. + + * manpages: directory with all the raw tcp/ip man pages. + + * prepare-manpages.sh: cute script to get the raw man pages from + the "manpages" directory and prepare a tcpip-manpages.sgml file + which has each man page in its own section. + + * tcpip.sgml: added legal and contact info front matter. + +2001-11-29 Jonathan Larmour + + * tcpip.sgml: Mostly cosmetic fixes revealed by comparing against the + original non-docbook version. + +2001-11-19 Mark Galassi + + * tcpip.sgml: two small items found upon visual inspection. + + * tcpip.sgml: made a proper list out of a bad one. + + * tcpip.sgml: some more work to address Jonathan's comments. + +2001-11-18 Mark Galassi + + * tcpip.sgml: started addressing Jonathan's comments on this + document. + + * man-page-send.sgml, man-page-select.sgml: added a couple of man + pages converted to DocBook. They are kind of primitive. + +2001-10-31 Mark Galassi + + * tcpip.sgml: now contains the normalized document. It is the + basis for future work. + + * tcpip-not-normalized.sgml: now contains the original hand-edited + document. It is now deprecated. + +2001-10-26 Mark Galassi + + * tcpip.sgml: now it all validates, but it's kludgy because the + man pages should be converted to something. + +2001-10-25 Mark Galassi + + * tcpip.sgml: started structuring this document. + diff --git a/packages/net/common/current/doc/README b/packages/net/common/current/doc/README new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/README @@ -0,0 +1,3 @@ +NOTE: before formatting tcpip.sgml you need to prepare the manual +pages in tcpip-manpages.smgl. This is done by running the shell +script prepare-manpages.sh diff --git a/packages/net/common/current/doc/manpages/gen/getdomainname.3 b/packages/net/common/current/doc/manpages/gen/getdomainname.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/gen/getdomainname.3 @@ -0,0 +1,108 @@ +.\" $OpenBSD: getdomainname.3,v 1.18 2000/12/24 00:30:48 aaron Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd May 6, 1994 +.Dt GETDOMAINNAME 3 +.Os +.Sh NAME +.Nm getdomainname , +.Nm setdomainname +.Nd get/set YP domain name of current host +.Sh SYNOPSIS +.Fd #include +.Ft int +.Fn getdomainname "char *name" "size_t namelen" +.Ft int +.Fn setdomainname "const char *name" "size_t namelen" +.Sh DESCRIPTION +The +.Fn getdomainname +function returns the YP domain name for the current processor, as +previously set by +.Fn setdomainname . +The parameter +.Fa namelen +specifies the size of the +.Fa name +array. +If insufficient space is provided, the returned name is truncated. +The returned name is always null terminated. +.Pp +.Fn setdomainname +sets the domain name of the host machine to be +.Fa name , +which has length +.Fa namelen . +This call is restricted to the superuser and +is normally used only when the system is bootstrapped. +.Sh RETURN VALUES +If the call succeeds a value of 0 is returned. +If the call fails, a value of \-1 is returned and an error code is +placed in the global variable +.Va errno . +.Sh ERRORS +The following errors may be returned by these calls: +.Bl -tag -width Er +.It Bq Er EFAULT +The +.Fa name +or +.Fa namelen +parameter gave an +invalid address. +.It Bq Er EPERM +The caller tried to set the domain name and was not the superuser. +.El +.Sh SEE ALSO +.Xr domainname 1 , +.Xr gethostid 3 , +.Xr gethostname 3 , +.Xr sysctl 3 , +.Xr sysctl 8 , +.Xr yp 8 +.Sh BUGS +Domain names are limited to +.Dv MAXHOSTNAMELEN +(from +.Ao Pa sys/param.h Ac ) +characters, currently 256. +This includes the terminating NUL character. +.Pp +If the buffer passed to +.Fn getdomainname +is too small, other operating systems may not guarantee termination with NUL. +.Sh HISTORY +The +.Nm +function call appeared in +SunOS 3.x. diff --git a/packages/net/common/current/doc/manpages/gen/gethostname.3 b/packages/net/common/current/doc/manpages/gen/gethostname.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/gen/gethostname.3 @@ -0,0 +1,114 @@ +.\" $OpenBSD: gethostname.3,v 1.18 2001/01/21 23:30:04 aaron Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd June 4, 1993 +.Dt GETHOSTNAME 3 +.Os +.Sh NAME +.Nm gethostname , +.Nm sethostname +.Nd get/set name of current host +.Sh SYNOPSIS +.Fd #include +.Ft int +.Fn gethostname "char *name" "size_t namelen" +.Ft int +.Fn sethostname "const char *name" "size_t namelen" +.Sh DESCRIPTION +The +.Fn gethostname +function returns the standard host name for the current +processor, as previously set by +.Fn sethostname . +The parameter +.Fa namelen +specifies the size of the +.Fa name +array. +If insufficient space is provided, the returned name is truncated. +The returned name is always null terminated. +.Pp +.Fn sethostname +sets the name of the host machine to be +.Fa name , +which has length +.Fa namelen . +This call is restricted to the superuser and +is normally used only when the system is bootstrapped. +.Sh RETURN VALUES +If the call succeeds a value of 0 is returned. +If the call fails, a value of \-1 is returned and an error code is +placed in the global variable +.Va errno . +.Sh ERRORS +The following errors may be returned by these calls: +.Bl -tag -width Er +.It Bq Er EFAULT +The +.Fa name +or +.Fa namelen +parameter gave an invalid address. +.It Bq Er EPERM +The caller tried to set the hostname and was not the superuser. +.El +.Sh SEE ALSO +.Xr hostname 1 , +.Xr getdomainname 3 , +.Xr gethostid 3 , +.Xr sysctl 3 , +.Xr sysctl 8 , +.Xr yp 8 +.Sh STANDARDS +The +.Fn gethostname +function call conforms to +.St -xpg4.2 . +.Sh HISTORY +The +.Fn gethostname +function call appeared in +.Bx 4.2 . +.Sh BUGS +Host names are limited to +.Dv MAXHOSTNAMELEN +(from +.Ao Pa sys/param.h Ac ) +characters, currently 256. +This includes the terminating NUL character. +.Pp +If the buffer passed to +.Fn gethostname +is smaller than +.Dv MAXHOSTNAMELEN , +other operating systems may not guarantee termination with NUL. diff --git a/packages/net/common/current/doc/manpages/net/byteorder.3 b/packages/net/common/current/doc/manpages/net/byteorder.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/byteorder.3 @@ -0,0 +1,183 @@ +.\" $OpenBSD: byteorder.3,v 1.8 2000/04/18 03:01:30 aaron Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd June 4, 1993 +.Dt BYTEORDER 3 +.Os +.Sh NAME +.Nm htonl , +.Nm htons , +.Nm ntohl , +.Nm ntohs , +.Nm htobe32 , +.Nm htobe16 , +.Nm betoh32 , +.Nm betoh16 , +.Nm htole32 , +.Nm htole16 , +.Nm letoh32 , +.Nm letoh16 , +.Nm swap32 , +.Nm swap16 +.Nd convert values between different byte orderings +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft u_int32_t +.Fn htonl "u_int32_t host32" +.Ft u_int16_t +.Fn htons "u_int16_t host16" +.Ft u_int32_t +.Fn ntohl "u_int32_t net32" +.Ft u_int16_t +.Fn ntohs "u_int16_t net16" +.Ft u_int32_t +.Fn htobe32 "u_int32_t host32" +.Ft u_int16_t +.Fn htobe16 "u_int16_t host16" +.Ft u_int32_t +.Fn betoh32 "u_int32_t big32" +.Ft u_int16_t +.Fn betoh16 "u_int16_t big16" +.Ft u_int32_t +.Fn htole32 "u_int32_t host32" +.Ft u_int16_t +.Fn htole16 "u_int16_t host16" +.Ft u_int32_t +.Fn letoh32 "u_int32_t little32" +.Ft u_int16_t +.Fn letoh16 "u_int16_t little16" +.Ft u_int32_t +.Fn swap32 "u_int32_t val32" +.Ft u_int16_t +.Fn swap16 "u_int16_t val16" +.Sh DESCRIPTION +These routines convert 16- and 32-bit quantities between different +byte orderings. +The +.Dq swap +functions reverse the byte ordering of +the given quantity, the others converts either from/to the native +byte order used by the host to/from either little- or big-endian (a.k.a +network) order. +.Pp +Apart from the swap functions, the names can be described by this form: +{src-order}to{dst-order}{size}. +Both {src-order} and {dst-order} can take the following forms: +.Pp +.Bl -tag -width "be " -offset indent -compact +.It h +Host order. +.It n +Network order (big-endian). +.It be +Big-endian (most significant byte first). +.It le +Little-endian (least significant byte first). +.El +.Pp +One of the specified orderings must be +.Sq h . +{size} will take these forms: +.Pp +.Bl -tag -width "32 " -offset indent -compact +.It l +Long (32-bit, used in conjunction with forms involving +.Sq n ) . +.It s +Short (16-bit, used in conjunction with forms involving +.Sq n ) . +.It 16 +16-bit. +.It 32 +32-bit. +.El +.Pp +The swap functions are of the form: swap{size}. +.Pp +Names involving +.Sq n +convert quantities between network +byte order and host byte order. +The last letter +.Pf ( Sq s +or +.Sq l ) +is a mnemonic +for the traditional names for such quantities, +.Li short +and +.Li long , +respectively. +Today, the C concept of +.Li short +and +.Li long +integers need not coincide with this traditional misunderstanding. +On machines which have a byte order which is the same as the network +order, routines are defined as null macros. +.Pp +The functions involving either +.Dq be , +.Dq le , +or +.Dq swap +use the numbers +16 and 32 for specifying the bitwidth of the quantities they operate on. +Currently all supported architectures are either big- or little-endian +so either the +.Dq be +or +.Dq le +variants are implemented as null macros. +.Pp +The routines mentioned above which have either {src-order} or {dst-order} +set to +.Sq n +are most often used in +conjunction with Internet addresses and ports as returned by +.Xr gethostbyname 3 +and +.Xr getservent 3 . +.Sh SEE ALSO +.Xr gethostbyname 3 , +.Xr getservent 3 +.Sh HISTORY +The +.Nm byteorder +functions appeared in +.Bx 4.2 . +.Sh BUGS +On the vax, alpha, i386, and so far mips, +bytes are handled backwards from most everyone else in the world. +This is not expected to be fixed in the near future. diff --git a/packages/net/common/current/doc/manpages/net/ethers.3 b/packages/net/common/current/doc/manpages/net/ethers.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/ethers.3 @@ -0,0 +1,119 @@ +.\" $OpenBSD: ethers.3,v 1.14 2001/08/06 10:42:26 mpech Exp $ +.\" +.\" Written by roland@frob.com. Public domain. +.\" +.Dd December 16, 1993 +.Dt ETHERS 3 +.Os +.Sh NAME +.Nm ether_aton , +.Nm ether_ntoa , +.Nm ether_addr , +.Nm ether_ntohost , +.Nm ether_hostton , +.Nm ether_line +.Nd get ethers entry +.Sh SYNOPSIS +.Fd #include +.Ft char * +.Fn ether_ntoa "struct ether_addr *e" +.Ft struct ether_addr * +.Fn ether_aton "char *s" +.Ft int +.Fn ether_ntohost "char *hostname" "struct ether_addr *e" +.Ft int +.Fn ether_hostton "char *hostname" "struct ether_addr *e" +.Ft int +.Fn ether_line "char *l" "struct ether_addr *e" "char *hostname" +.Sh DESCRIPTION +Ethernet addresses are represented by the +following structure: +.Bd -literal -offset indent +struct ether_addr { + u_int8_t ether_addr_octet[6]; +}; +.Ed +.Pp +The +.Fn ether_ntoa +function converts this structure into an +.Tn ASCII +string of the form +.Dq xx:xx:xx:xx:xx:xx , +consisting of 6 hexadecimal numbers separated +by colons. +It returns a pointer to a static buffer that is reused for each call. +The +.Fn ether_aton +converts an +.Tn ASCII +string of the same form and to a structure +containing the 6 octets of the address. +It returns a pointer to a static structure that is reused for each call. +.Pp +The +.Fn ether_ntohost +and +.Fn ether_hostton +functions interrogate the database mapping host names to Ethernet +addresses, +.Pa /etc/ethers . +The +.Fn ether_ntohost +function looks up the given Ethernet address and writes the associated +host name into the character buffer passed. +This buffer should be +.Dv MAXHOSTNAMELEN +characters in size. +The +.Fn ether_hostton +function looks up the given host name and writes the associated +Ethernet address into the structure passed. +Both functions return +zero if they find the requested host name or address, and \-1 if not. +.Pp +Each call reads +.Pa /etc/ethers +from the beginning; if a +.Ql + +appears alone on a line in the file, then +.Fn ether_hostton +will consult the +.Pa ethers.byname +YP map, and +.Fn ether_ntohost +will consult the +.Pa ethers.byaddr +YP map. +.Pp +The +.Fn ether_line +function parses a line from the +.Pa /etc/ethers +file and fills in the passed +.Li struct ether_addr +and character buffer with the Ethernet address and host name on the line. +It returns zero if the line was successfully parsed and \-1 if not. +The character buffer should be +.Dv MAXHOSTNAMELEN +characters in size. +.Sh FILES +.Bl -tag -width /etc/ethers -compact +.It Pa /etc/ethers +.El +.Sh SEE ALSO +.Xr ethers 5 +.Sh HISTORY +The +.Fn ether_ntoa , +.Fn ether_aton , +.Fn ether_ntohost , +.Fn ether_hostton , +and +.Fn ether_line +functions were adopted from SunOS and appeared in +.Nx 0.9 b. +.Sh BUGS +The data space used by these functions is static; if future use +requires the data, it should be copied before any subsequent calls to +these functions overwrite it. diff --git a/packages/net/common/current/doc/manpages/net/getaddrinfo.3 b/packages/net/common/current/doc/manpages/net/getaddrinfo.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/getaddrinfo.3 @@ -0,0 +1,581 @@ +.\" $OpenBSD: getaddrinfo.3,v 1.19 2001/08/06 10:42:26 mpech Exp $ +.\" $KAME: getaddrinfo.3,v 1.29 2001/02/12 09:24:45 itojun Exp $ +.\" +.\" Copyright (c) 1983, 1987, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95 +.\" +.Dd May 25, 1995 +.Dt GETADDRINFO 3 +.Os +.\" +.Sh NAME +.Nm getaddrinfo , +.Nm freeaddrinfo , +.Nm gai_strerror +.Nd nodename-to-address translation in protocol-independent manner +.\" +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include +.Ft int +.Fn getaddrinfo "const char *nodename" "const char *servname" \ +"const struct addrinfo *hints" "struct addrinfo **res" +.Ft void +.Fn freeaddrinfo "struct addrinfo *ai" +.Ft "char *" +.Fn gai_strerror "int ecode" +.\" +.Sh DESCRIPTION +The +.Fn getaddrinfo +function is defined for protocol-independent nodename-to-address translation. +It performs the functionality of +.Xr gethostbyname 3 +and +.Xr getservbyname 3 , +but in a more sophisticated manner. +.Pp +The +.Li addrinfo +structure is defined as a result of including the +.Aq Pa netdb.h +header: +.Bd -literal -offset +struct addrinfo { * + int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for nodename */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; +.Ed +.Pp +The +.Fa nodename +and +.Fa servname +arguments are pointers to NUL-terminated strings or +.Dv NULL . +One or both of these two arguments must be a non-null pointer. +In the normal client scenario, both the +.Fa nodename +and +.Fa servname +are specified. +In the normal server scenario, only the +.Fa servname +is specified. +A non-null +.Fa nodename +string can be either a node name or a numeric host address string +(i.e., a dotted-decimal IPv4 address or an IPv6 hex address). +A non-null +.Fa servname +string can be either a service name or a decimal port number. +.Pp +The caller can optionally pass an +.Li addrinfo +structure, pointed to by the third argument, +to provide hints concerning the type of socket that the caller supports. +In this +.Fa hints +structure all members other than +.Fa ai_flags , +.Fa ai_family , +.Fa ai_socktype , +and +.Fa ai_protocol +must be zero or a null pointer. +A value of +.Dv PF_UNSPEC +for +.Fa ai_family +means the caller will accept any protocol family. +A value of 0 for +.Fa ai_socktype +means the caller will accept any socket type. +A value of 0 for +.Fa ai_protocol +means the caller will accept any protocol. +For example, if the caller handles only TCP and not UDP, then the +.Fa ai_socktype +member of the hints structure should be set to +.Dv SOCK_STREAM +when +.Fn getaddrinfo +is called. +If the caller handles only IPv4 and not IPv6, then the +.Fa ai_family +member of the +.Fa hints +structure should be set to +.Dv PF_INET +when +.Fn getaddrinfo +is called. +If the third argument to +.Fn getaddrinfo +is a null pointer, this is the same as if the caller had filled in an +.Li addrinfo +structure initialized to zero with +.Fa ai_family +set to +.Dv PF_UNSPEC . +.Pp +Upon successful return a pointer to a linked list of one or more +.Li addrinfo +structures is returned through the final argument. +The caller can process each +.Li addrinfo +structure in this list by following the +.Fa ai_next +pointer, until a null pointer is encountered. +In each returned +.Li addrinfo +structure the three members +.Fa ai_family , +.Fa ai_socktype , +and +.Fa ai_protocol +are the corresponding arguments for a call to the +.Fn socket +function. +In each +.Li addrinfo +structure the +.Fa ai_addr +member points to a filled-in socket address structure whose length is +specified by the +.Fa ai_addrlen +member. +.Pp +If the +.Dv AI_PASSIVE +bit is set in the +.Fa ai_flags +member of the +.Fa hints +structure, then the caller plans to use the returned socket address +structure in a call to +.Fn bind . +In this case, if the +.Fa nodename +argument is a null pointer, then the IP address portion of the socket +address structure will be set to +.Dv INADDR_ANY +for an IPv4 address or +.Dv IN6ADDR_ANY_INIT +for an IPv6 address. +.Pp +If the +.Dv AI_PASSIVE +bit is not set in the +.Fa ai_flags +member of the +.Fa hints +structure, then the returned socket address structure will be ready for a +call to +.Fn connect +.Pq for a connection-oriented protocol +or either +.Fn connect , +.Fn sendto , +or +.Fn sendmsg +.Pq for a connectionless protocol . +In this case, if the +.Fa nodename +argument is a null pointer, then the IP address portion of the +socket address structure will be set to the loopback address. +.Pp +If the +.Dv AI_CANONNAME +bit is set in the +.Fa ai_flags +member of the +.Fa hints +structure, then upon successful return the +.Fa ai_canonname +member of the first +.Li addrinfo +structure in the linked list will point to a NUL-terminated string +containing the canonical name of the specified +.Fa nodename . +.Pp +If the +.Dv AI_NUMERICHOST +bit is set in the +.Fa ai_flags +member of the +.Fa hints +structure, then a non-null +.Fa nodename +string must be a numeric host address string. +Otherwise an error of +.Dv EAI_NONAME +is returned. +This flag prevents any type of name resolution service (e.g., the DNS) +from being called. +.Pp +The arguments to +.Fn getaddrinfo +must sufficiently be consistent and unambiguous. +Here are pitfall cases you may encounter: +.Bl -bullet +.It +.Fn getaddrinfo +will raise an error if members of the +.Fa hints +structure are not consistent. +For example, for internet address families, +.Fn getaddrinfo +will raise an error if you specify +.Dv SOCK_STREAM +to +.Fa ai_socktype +while you specify +.Dv IPPROTO_UDP +to +.Fa ai_protocol . +.It +If you specify a +.Fa servname +which is defined only for certain +.Fa ai_socktype , +.Fn getaddrinfo +will raise an error because the arguments are not consistent. +For example, +.Fn getaddrinfo +will raise an error if you ask for +.Dq Li tftp +service on +.Dv SOCK_STREAM . +.It +For internet address families, if you specify +.Fa servname +while you set +.Fa ai_socktype +to +.Dv SOCK_RAW , +.Fn getaddrinfo +will raise an error, because service names are not defined for the internet +.Dv SOCK_RAW +space. +.It +If you specify a numeric +.Fa servname , +while leaving +.Fa ai_socktype +and +.Fa ai_protocol +unspecified, +.Fn getaddrinfo +will raise an error. +This is because the numeric +.Fa servname +does not identify any socket type, and +.Fn getaddrinfo +is not allowed to glob the argument in such case. +.El +.Pp +All of the information returned by +.Fn getaddrinfo +is dynamically allocated: +the +.Li addrinfo +structures, the socket address structures, and canonical node name +strings pointed to by the addrinfo structures. +To return this information to the system the function +.Fn freeaddrinfo +is called. +The +.Fa addrinfo +structure pointed to by the +.Fa ai argument +is freed, along with any dynamic storage pointed to by the structure. +This operation is repeated until a +.Dv NULL +.Fa ai_next +pointer is encountered. +.Pp +To aid applications in printing error messages based on the +.Dv EAI_xxx +codes returned by +.Fn getaddrinfo , +.Fn gai_strerror +is defined. +The argument is one of the +.Dv EAI_xxx +values defined earlier and the return value points to a string describing +the error. +If the argument is not one of the +.Dv EAI_xxx +values, the function still returns a pointer to a string whose contents +indicate an unknown error. +.\" +.Ss Extension for scoped IPv6 address +The implementation allows experimental numeric IPv6 address notation with +scope identifier. +By appending the percent character and scope identifier to addresses, +you can fill +.Li sin6_scope_id +field for addresses. +This would make management of scoped address easier, +and allows cut-and-paste input of scoped address. +.Pp +At this moment the code supports only link-local addresses with the format. +Scope identifier is hardcoded to name of hardware interface associated +with the link. +.Po +such as +.Li ne0 +.Pc . +Example would be like +.Dq Li fe80::1%ne0 , +which means +.Do +.Li fe80::1 +on the link associated with +.Li ne0 +interface +.Dc . +.Pp +The implementation is still very experimental and non-standard. +The current implementation assumes one-by-one relationship between +interface and link, which is not necessarily true from the specification. +.\" +.Sh EXAMPLES +The following code tries to connect to +.Dq Li www.kame.net +service +.Dq Li http . +via stream socket. +It loops through all the addresses available, regardless from address family. +If the destination resolves to IPv4 address, it will use +.Dv AF_INET +socket. +Similarly, if it resolves to IPv6, +.Dv AF_INET6 +socket is used. +Observe that there is no hardcoded reference to particular address family. +The code works even if +.Nm getaddrinfo +returns addresses that are not IPv4/v6. +.Bd -literal -offset indent +struct addrinfo hints, *res, *res0; +int error; +int s; +const char *cause = NULL; + +memset(&hints, 0, sizeof(hints)); +hints.ai_family = PF_UNSPEC; +hints.ai_socktype = SOCK_STREAM; +error = getaddrinfo("www.kame.net", "http", &hints, &res0); +if (error) { + errx(1, "%s", gai_strerror(error)); + /*NOTREACHED*/ +} +s = -1; +for (res = res0; res; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (s < 0) { + cause = "socket"; + continue; + } + + if (connect(s, res->ai_addr, res->ai_addrlen) < 0) { + cause = "connect"; + close(s); + s = -1; + continue; + } + + break; /* okay we got one */ +} +if (s < 0) { + err(1, cause); + /*NOTREACHED*/ +} +freeaddrinfo(res0); +.Ed +.Pp +The following example tries to open a wildcard listening socket onto service +.Dq Li http , +for all the address families available. +.Bd -literal -offset indent +struct addrinfo hints, *res, *res0; +int error; +int s[MAXSOCK]; +int nsock; +const char *cause = NULL; + +memset(&hints, 0, sizeof(hints)); +hints.ai_family = PF_UNSPEC; +hints.ai_socktype = SOCK_STREAM; +hints.ai_flags = AI_PASSIVE; +error = getaddrinfo(NULL, "http", &hints, &res0); +if (error) { + errx(1, "%s", gai_strerror(error)); + /*NOTREACHED*/ +} +nsock = 0; +for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) { + s[nsock] = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (s[nsock] < 0) { + cause = "socket"; + continue; + } + + if (bind(s[nsock], res->ai_addr, res->ai_addrlen) < 0) { + cause = "bind"; + close(s[nsock]); + continue; + } + (void) listen(s[nsock], 5); + + nsock++; +} +if (nsock == 0) { + err(1, cause); + /*NOTREACHED*/ +} +freeaddrinfo(res0); +.Ed +.\" +.Sh DIAGNOSTICS +Error return status from +.Fn getaddrinfo +is zero on success and non-zero on errors. +Non-zero error codes are defined in +.Aq Pa netdb.h , +and as follows: +.Pp +.Bl -tag -width EAI_ADDRFAMILY -compact +.It Dv EAI_ADDRFAMILY +Address family for +.Fa nodename +not supported. +.It Dv EAI_AGAIN +Temporary failure in name resolution. +.It Dv EAI_BADFLAGS +Invalid value for +.Fa ai_flags . +.It Dv EAI_FAIL +Non-recoverable failure in name resolution. +.It Dv EAI_FAMILY +.Fa ai_family +not supported. +.It Dv EAI_MEMORY +Memory allocation failure. +.It Dv EAI_NODATA +No address associated with +.Fa nodename . +.It Dv EAI_NONAME +.Fa nodename +nor +.Fa servname +provided, or not known. +.It Dv EAI_SERVICE +.Fa servname +not supported for +.Fa ai_socktype . +.It Dv EAI_SOCKTYPE +.Fa ai_socktype +not supported. +.It Dv EAI_SYSTEM +System error returned in +.Va errno . +.El +.Pp +If called with proper argument, +.Fn gai_strerror +returns a pointer to a string describing the given error code. +If the argument is not one of the +.Dv EAI_xxx +values, the function still returns a pointer to a string whose contents +indicate an unknown error. +.\" +.Sh SEE ALSO +.Xr getnameinfo 3 , +.Xr gethostbyname 3 , +.Xr getservbyname 3 , +.Xr hosts 5 , +.Xr resolv.conf 5 , +.Xr services 5 , +.Xr hostname 7 , +.Xr named 8 +.Rs +.%A R. Gilligan +.%A S. Thomson +.%A J. Bound +.%A W. Stevens +.%T Basic Socket Interface Extensions for IPv6 +.%R RFC2553 +.%D March 1999 +.Re +.Rs +.%A Tatsuya Jinmei +.%A Atsushi Onoe +.%T "An Extension of Format for IPv6 Scoped Addresses" +.%R internet draft +.%N draft-ietf-ipngwg-scopedaddr-format-02.txt +.%O work in progress material +.Re +.Rs +.%A Craig Metz +.%T Protocol Independence Using the Sockets API +.%B "Proceedings of the freenix track: 2000 USENIX annual technical conference" +.%D June 2000 +.Re +.\" +.Sh HISTORY +The implementation first appeared in WIDE Hydrangea IPv6 protocol stack kit. +.\" +.Sh STANDARDS +The +.Fn getaddrinfo +function is defined in IEEE POSIX 1003.1g draft specification, +and documented in +.Dq Basic Socket Interface Extensions for IPv6 +.Pq RFC2553 . +.\" +.Sh BUGS +The current implementation is not thread-safe. +.Pp +The text was shamelessly copied from RFC2553. diff --git a/packages/net/common/current/doc/manpages/net/gethostbyname.3 b/packages/net/common/current/doc/manpages/net/gethostbyname.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/gethostbyname.3 @@ -0,0 +1,275 @@ +.\" $OpenBSD: gethostbyname.3,v 1.16 2000/12/24 00:30:56 aaron Exp $ +.\" +.\" Copyright (c) 1983, 1987, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd March 13, 1997 +.Dt GETHOSTBYNAME 3 +.Os +.Sh NAME +.Nm gethostbyname , +.Nm gethostbyname2 , +.Nm gethostbyaddr , +.Nm gethostent , +.Nm sethostent , +.Nm endhostent , +.Nm hstrerror , +.Nm herror +.Nd get network host entry +.Sh SYNOPSIS +.Fd #include +.Fd extern int h_errno; +.Ft struct hostent * +.Fn gethostbyname "const char *name" +.Ft struct hostent * +.Fn gethostbyname2 "const char *name" "int af" +.Ft struct hostent * +.Fn gethostbyaddr "const char *addr" "int len" "int af" +.Ft struct hostent * +.Fn gethostent void +.Ft void +.Fn sethostent "int stayopen" +.Ft void +.Fn endhostent void +.Ft void +.Fn herror "const char *string" +.Ft const char * +.Fn hstrerror "int err" +.Sh DESCRIPTION +The +.Fn gethostbyname +and +.Fn gethostbyaddr +functions each return a pointer to an object with the following structure +describing an internet host referenced by name or by address, respectively. +This structure contains either information obtained from the name server (i.e., +.Xr resolver 3 +and +.Xr named 8 ) , +broken-out fields from a line in +.Pa /etc/hosts , +or database entries supplied by the +.Xr yp 8 +system. +.Xr resolv.conf 5 +describes how the particular database is chosen. +.Bd -literal +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +}; +#define h_addr h_addr_list[0] /* address, for backward compatibility */ +.Ed +.Pp +The members of this structure are: +.Bl -tag -width h_addr_list +.It Fa h_name +Official name of the host. +.It Fa h_aliases +A zero-terminated array of alternate names for the host. +.It Fa h_addrtype +The type of address being returned. +.It Fa h_length +The length, in bytes, of the address. +.It Fa h_addr_list +A zero-terminated array of network addresses for the host. +Host addresses are returned in network byte order. +.It Fa h_addr +The first address in +.Fa h_addr_list ; +this is for backward compatibility. +.El +.Pp +The function +.Fn gethostbyname +will search for the named host in the current domain and its parents +using the search lookup semantics detailed in +.Xr resolv.conf 5 +and +.Xr hostname 7 . +.Pp +.Fn gethostbyname2 +is an advanced form of +.Fn gethostbyname +which allows lookups in address families other than +.Dv AF_INET , +for example +.Dv AF_INET6 . +.Pp +The +.Fn gethostbyaddr +function will search for the specified address of length +.Fa len +in the address family +.Fa af . +The only address family currently supported is +.Dv AF_INET . +.Pp +The +.Fn sethostent +function may be used to request the use of a connected +.Tn TCP +socket for queries. +If the +.Fa stayopen +flag is non-zero, +this sets the option to send all queries to the name server using +.Tn TCP +and to retain the connection after each call to +.Fn gethostbyname +or +.Fn gethostbyaddr . +Otherwise, queries are performed using +.Tn UDP +datagrams. +.Pp +The +.Fn endhostent +function closes the +.Tn TCP +connection. +.Pp +The +.Fn herror +function prints an error message describing the failure. +If its argument +.Fa string +is non-null, +it is prepended to the message string and separated from it by a colon +.Pq Ql \&: +and a space. +The error message is printed with a trailing newline. +The contents of the error message is the same as that returned by +.Fn hstrerror +with argument +.Fa h_errno . +.Sh FILES +.Bl -tag -width /etc/resolv.conf -compact +.It Pa /etc/hosts +.It Pa /etc/resolv.conf +.El +.Sh DIAGNOSTICS +Error return status from +.Fn gethostbyname , +.Fn gethostbyname2 , +and +.Fn gethostbyaddr +is indicated by return of a null pointer. +The external integer +.Va h_errno +may then be checked to see whether this is a temporary failure +or an invalid or unknown host. +.Pp +The variable +.Va h_errno +can have the following values: +.Bl -tag -width HOST_NOT_FOUND +.It Dv HOST_NOT_FOUND +No such host is known. +.It Dv TRY_AGAIN +This is usually a temporary error +and means that the local server did not receive +a response from an authoritative server. +A retry at some later time may succeed. +.It Dv NO_RECOVERY +Some unexpected server failure was encountered. +This is a non-recoverable error. +.It Dv NO_DATA +The requested name is valid but does not have an IP address; +this is not a temporary error. +This means that the name is known to the name server but there is no address +associated with this name. +Another type of request to the name server using this domain name +will result in an answer; +for example, a mail-forwarder may be registered for this domain. +.El +.Sh SEE ALSO +.Xr resolver 3 , +.Xr getaddrinfo 3 , +.Xr getnameinfo 3 , +.Xr hosts 5 , +.Xr resolv.conf 5 , +.Xr hostname 7 , +.Xr named 8 +.Sh CAVEAT +If the search routines in +.Xr resolv.conf 5 +decide to read the +.Pa /etc/hosts +file, +.Fn gethostent +and other functions will +read the next line of the file, +re-opening the file if necessary. +.Pp +The +.Fn sethostent +function opens and/or rewinds the file +.Pa /etc/hosts . +If the +.Fa stayopen +argument is non-zero, the file will not be closed after each call to +.Fn gethostbyname , +.Fn gethostbyname2 , +or +.Fn gethostbyaddr . +.Pp +The +.Fn endhostent +function closes the file. +.Sh HISTORY +The +.Fn herror +function appeared in +.Bx 4.3 . +The +.Fn endhostent , +.Fn gethostbyaddr , +.Fn gethostbyname , +.Fn gethostent , +and +.Fn sethostent +functions appeared in +.Bx 4.2 . +.Sh BUGS +These functions use static data storage; +if the data is needed for future use, it should be +copied before any subsequent calls overwrite it. +Only the Internet +address formats are currently understood. +.Pp +YP does not support any address families other than +.Dv AF_INET +and uses +the traditional database format. diff --git a/packages/net/common/current/doc/manpages/net/getifaddrs.3 b/packages/net/common/current/doc/manpages/net/getifaddrs.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/getifaddrs.3 @@ -0,0 +1,158 @@ +.\" $OpenBSD: getifaddrs.3,v 1.7 2001/10/01 21:58:53 millert Exp $ +.\" BSDI getifaddrs.3,v 2.5 2000/02/23 14:51:59 dab Exp +.\" +.\" Copyright (c) 1995, 1999 +.\" Berkeley Software Design, 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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. +.Dd "October 12, 1995" +.Dt GETIFADDRS 3 +.Sh NAME +.Nm getifaddrs +.Nd get interface addresses +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include +.Ft int +.Fn getifaddrs "struct ifaddrs **ifap" +.Ft void +.Fn freeifaddrs "struct ifaddrs *ifap" +.Sh DESCRIPTION +The +.Fn getifaddrs +function stores a reference to a linked list of the network interfaces +on the local machine in the memory referenced by +.Fa ifap . +The list consists of +.Nm ifaddrs +structures, as defined in the include file +.Aq Pa ifaddrs.h . +The +.Nm ifaddrs +structure contains at least the following entries: +.Bd -literal + struct ifaddrs *ifa_next; /* Pointer to next struct */ + char *ifa_name; /* Interface name */ + u_int ifa_flags; /* Interface flags */ + struct sockaddr *ifa_addr; /* Interface address */ + struct sockaddr *ifa_netmask; /* Interface netmask */ + struct sockaddr *ifa_broadaddr; /* Interface broadcast address */ + struct sockaddr *ifa_dstaddr; /* P2P interface destination */ + void *ifa_data; /* Address specific data */ +.Ed +.Pp +.Bl -tag -width Ds +.It Fa ifa_next +Contains a pointer to the next structure on the list. +This field is set to +.Dv NULL +in last structure on the list. +.It Fa ifa_name +Contains the interface name. +.It Fa ifa_flags +Contains the interface flags, as set by +.Xr ifconfig 8 . +.It Fa ifa_addr +References either the address of the interface or the link level +address of the interface, if one exists, otherwise it is +.Dv NULL . +(The +.Fa sa_family +field of the +.Fa ifa_addr +field should be consulted to determine the format of the +.Fa ifa_addr +address.) +.It Fa ifa_netmask +References the netmask associated with +.Fa ifa_addr , +if one is set, otherwise it is +.Dv NULL . +.It Fa ifa_broadaddr +This field, which should only be referenced for non-P2P interfaces, +references the broadcast address associated with +.Fa ifa_addr , +if one exists, otherwise it is +.Dv NULL . +.It Fa ifa_dstaddr +References the destination address on a P2P interface, +if one exists, otherwise it is +.Dv NULL . +.It Fa ifa_data +References address family specific data. +For +.Dv AF_LINK +addresses it contains a pointer to the +.Li struct if_data +(as defined in include file +.Aq Pa net/if.h ) +which contains various interface attributes and statistics. +For all other address families, it contains a pointer to the +.Li struct ifa_data +(as defined in include file +.Aq Pa net/if.h ) +which contains per-address interface statistics. +.El +.Pp +The data returned by +.Fn getifaddrs +is dynamically allocated and should be freed using +.Fn freeifaddrs +when no longer needed. +.Sh RETURN VALUES +Upon successful completion, a value of 0 is returned. +Otherwise, a value of \-1 is returned and +.Va errno +is set to indicate the error. +.Sh ERRORS +The +.Fn getifaddrs +may fail and set +.Va errno +for any of the errors specified for the library routines +.Xr ioctl 2 , +.Xr socket 2 , +.Xr malloc 3 , +or +.Xr sysctl 3 . +.Sh BUGS +If both +.Aq Pa net/if.h +and +.Aq Pa ifaddrs.h +are being included, +.Aq Pa net/if.h +.Em must +be included before +.Aq Pa ifaddrs.h . +.Sh SEE ALSO +.Xr ioctl 2 , +.Xr socket 2 , +.Xr sysctl 3 , +.Xr networking 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Fn getifaddrs +function first appeared in BSDI BSD/OS. +The function is supplied on +.Ox +since +.Ox 2.7 . diff --git a/packages/net/common/current/doc/manpages/net/getnameinfo.3 b/packages/net/common/current/doc/manpages/net/getnameinfo.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/getnameinfo.3 @@ -0,0 +1,302 @@ +.\" $OpenBSD: getnameinfo.3,v 1.16 2001/08/06 10:42:26 mpech Exp $ +.\" $KAME: getnameinfo.3,v 1.20 2001/01/05 13:37:37 itojun Exp $ +.\" +.\" Copyright (c) 1983, 1987, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95 +.\" +.Dd May 25, 1995 +.Dt GETNAMEINFO 3 +.Os +.\" +.Sh NAME +.Nm getnameinfo +.Nd address-to-nodename translation in protocol-independent manner +.\" +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include +.Ft int +.Fn getnameinfo "const struct sockaddr *sa" "socklen_t salen" \ +"char *host" "size_t hostlen" "char *serv" "size_t servlen" "int flags" +.\" +.Sh DESCRIPTION +The +.Fn getnameinfo +function is defined for protocol-independent address-to-nodename translation. +Its functionality is a reverse conversion of +.Xr getaddrinfo 3 , +and implements similar functionality with +.Xr gethostbyaddr 3 +and +.Xr getservbyport 3 +in more sophisticated manner. +.Pp +This function looks up an IP address and port number provided by the +caller in the DNS and system-specific database, and returns text +strings for both in buffers provided by the caller. +The function indicates successful completion by a zero return value; +a non-zero return value indicates failure. +.Pp +The first argument, +.Fa sa , +points to either a +.Li sockaddr_in +structure (for IPv4) or a +.Li sockaddr_in6 +structure (for IPv6) that holds the IP address and port number. +The +.Fa salen +argument gives the length of the +.Li sockaddr_in +or +.Li sockaddr_in6 +structure. +.Pp +The function returns the nodename associated with the IP address in +the buffer pointed to by the +.Fa host +argument. +The caller provides the size of this buffer via the +.Fa hostlen +argument. +The service name associated with the port number is returned in the buffer +pointed to by +.Fa serv , +and the +.Fa servlen +argument gives the length of this buffer. +The caller specifies not to return either string by providing a zero +value for the +.Fa hostlen +or +.Fa servlen +arguments. +Otherwise, the caller must provide buffers large enough to hold the +nodename and the service name, including the terminating null characters. +.Pp +Unfortunately most systems do not provide constants that specify the +maximum size of either a fully-qualified domain name or a service name. +Therefore to aid the application in allocating buffers for these two +returned strings the following constants are defined in +.Aq Pa netdb.h : +.Bd -literal -offset +#define NI_MAXHOST MAXHOSTNAMELEN +#define NI_MAXSERV 32 +.Ed +.Pp +The first value is actually defined as the constant +.Dv MAXDNAME +in recent versions of BIND's +.Aq Pa arpa/nameser.h +header (older versions of BIND define this constant to be 256) +and the second is a guess based on the services listed in the current +Assigned Numbers RFC. +.Pp +The final argument is a +.Fa flag +that changes the default actions of this function. +By default the fully-qualified domain name (FQDN) for the host is +looked up in the DNS and returned. +If the flag bit +.Dv NI_NOFQDN +is set, only the nodename portion of the FQDN is returned for local hosts. +.Pp +If the +.Fa flag +bit +.Dv NI_NUMERICHOST +is set, or if the host's name cannot be located in the DNS, +the numeric form of the host's address is returned instead of its name +.Po +e.g., by calling +.Fn inet_ntop +instead of +.Fn gethostbyaddr +.Pc . +If the +.Fa flag +bit +.Dv NI_NAMEREQD +is set, an error is returned if the host's name cannot be located in the DNS. +.Pp +If the flag bit +.Dv NI_NUMERICSERV +is set, the numeric form of the service address is returned +.Pq e.g., its port number +instead of its name. +The two +.Dv NI_NUMERICxxx +flags are required to support the +.Fl n +flag that many commands provide. +.Pp +A fifth flag bit, +.Dv NI_DGRAM , +specifies that the service is a datagram service, and causes +.Fn getservbyport +to be called with a second argument of +.Qq udp +instead of its default of +.Qq tcp . +This is required for the few ports (512-514) +that have different services for UDP and TCP. +.Pp +These +.Dv NI_xxx +flags are defined in +.Aq Pa netdb.h . +.\" +.Ss Extension for scoped IPv6 address +The implementation allows experimental numeric IPv6 address notation with +scope identifier. +IPv6 link-local address will appear as string like +.Dq Li fe80::1%ne0 , +if +.Dv NI_WITHSCOPEID +bit is enabled in +.Ar flags +argument. +Refer to +.Xr getaddrinfo 3 +for the notation. +.\" +.Sh EXAMPLES +The following code tries to get numeric hostname, and service name, +for given socket address. +Observe that there is no hardcoded reference to particular address family. +.Bd -literal -offset indent +struct sockaddr *sa; /* input */ +char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; + +if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), sbuf, + sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV)) { + errx(1, "could not get numeric hostname"); + /*NOTREACHED*/ +} +printf("host=%s, serv=%s\en", hbuf, sbuf); +.Ed +.Pp +The following version checks if the socket address has reverse address mapping. +.Bd -literal -offset indent +struct sockaddr *sa; /* input */ +char hbuf[NI_MAXHOST]; + +if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0, + NI_NAMEREQD)) { + errx(1, "could not resolve hostname"); + /*NOTREACHED*/ +} +printf("host=%s\en", hbuf); +.Ed +.\" +.Sh DIAGNOSTICS +The function indicates successful completion by a zero return value; +a non-zero return value indicates failure. +Error codes are as below: +.Bl -tag -width Er +.It Dv EAI_AGAIN +The name could not be resolved at this time. +Future attempts may succeed. +.It Dv EAI_BADFLAGS +The flags had an invalid value. +.It Dv EAI_FAIL +A non-recoverable error occurred. +.It Dv EAI_FAMILY +The address family was not recognized or the address length was invalid +for the specified family. +.It Dv EAI_MEMORY +There was a memory allocation failure. +.It Dv EAI_NONAME +The name does not resolve for the supplied parameters. +.Dv NI_NAMEREQD +is set and the host's name cannot be located, +or both nodename and servname were null. +.It Dv EAI_SYSTEM +A system error occurred. +The error code can be found in errno. +.El +.\" +.Sh SEE ALSO +.Xr getaddrinfo 3 , +.Xr gethostbyaddr 3 , +.Xr getservbyport 3 , +.Xr hosts 5 , +.Xr resolv.conf 5 , +.Xr services 5 , +.Xr hostname 7 , +.Xr named 8 +.Rs +.%A R. Gilligan +.%A S. Thomson +.%A J. Bound +.%A W. Stevens +.%T Basic Socket Interface Extensions for IPv6 +.%R RFC2553 +.%D March 1999 +.Re +.Rs +.%A Tatsuya Jinmei +.%A Atsushi Onoe +.%T "An Extension of Format for IPv6 Scoped Addresses" +.%R internet draft +.%N draft-ietf-ipngwg-scopedaddr-format-02.txt +.%O work in progress material +.Re +.Rs +.%A Craig Metz +.%T Protocol Independence Using the Sockets API +.%B "Proceedings of the freenix track: 2000 USENIX annual technical conference" +.%D June 2000 +.Re +.\" +.Sh HISTORY +The implementation first appeared in WIDE Hydrangea IPv6 protocol stack kit. +.\" +.Sh STANDARDS +The +.Fn getaddrinfo +function is defined IEEE POSIX 1003.1g draft specification, +and documented in +.Dq Basic Socket Interface Extensions for IPv6 +.Pq RFC2553 . +.\" +.Sh BUGS +The current implementation is not thread-safe. +.Pp +The text was shamelessly copied from RFC2553. +.Pp +.Ox +intentionally uses different +.Dv NI_MAXHOST +value from what RFC2553 suggests, to avoid buffer length handling mistakes. diff --git a/packages/net/common/current/doc/manpages/net/getnetent.3 b/packages/net/common/current/doc/manpages/net/getnetent.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/getnetent.3 @@ -0,0 +1,144 @@ +.\" $OpenBSD: getnetent.3,v 1.11 2000/12/24 00:30:56 aaron Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd March 13, 1997 +.Dt GETNETENT 3 +.Os +.Sh NAME +.Nm getnetent , +.Nm getnetbyaddr , +.Nm getnetbyname , +.Nm setnetent , +.Nm endnetent +.Nd get network entry +.Sh SYNOPSIS +.Fd #include +.Ft struct netent * +.Fn getnetent "void" +.Ft struct netent * +.Fn getnetbyname "char *name" +.Ft struct netent * +.Fn getnetbyaddr "in_addr_t net" "int type" +.Ft void +.Fn setnetent "int stayopen" +.Ft void +.Fn endnetent "void" +.Sh DESCRIPTION +The +.Fn getnetent , +.Fn getnetbyname , +and +.Fn getnetbyaddr +functions each return a pointer to an object with the following structure +containing the broken-out fields of a line in the network database, +.Pa /etc/networks . +.Bd -literal -offset indent +struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net number type */ + in_addr_t n_net; /* net number */ +}; +.Ed +.Pp +The members of this structure are: +.Bl -tag -width n_addrtype +.It Fa n_name +The official name of the network. +.It Fa n_aliases +A zero-terminated list of alternate names for the network. +.It Fa n_addrtype +The type of the network number returned; currently only +.Dv AF_INET . +.It Fa n_net +The network number. +Network numbers are returned in machine byte order. +.El +.Pp +The +.Fn getnetent +function reads the next line of the file, opening the file if necessary. +.Pp +The +.Fn setnetent +function opens and rewinds the file. +If the +.Fa stayopen +flag is non-zero, +the net database will not be closed after each call to +.Fn getnetbyname +or +.Fn getnetbyaddr . +.Pp +The +.Fn endnetent +function closes the file. +.Pp +The +.Fn getnetbyname +and +.Fn getnetbyaddr +functions search the domain name server if the system is configured to use one. +If the search fails, or no name server is configured, they sequentially +search from the beginning of the file until a matching net name or +net address and type is found, or until +.Dv EOF +is encountered. +Network numbers are supplied in host order. +.Sh FILES +.Bl -tag -width /etc/networks -compact +.It Pa /etc/networks +.El +.Sh DIAGNOSTICS +Null pointer (0) returned on +.Dv EOF +or error. +.Sh SEE ALSO +.Xr resolver 3 , +.Xr networks 5 +.Sh HISTORY +The +.Fn getnetent , +.Fn getnetbyaddr , +.Fn getnetbyname , +.Fn setnetent , +and +.Fn endnetent +functions appeared in +.Bx 4.2 . +.Sh BUGS +The data space used by these functions is static; if future use +requires the data, it should be copied before any subsequent calls +to these functions overwrite it. +Only Internet network numbers are currently understood. +Expecting network numbers to fit in no more than 32 bits is naive. diff --git a/packages/net/common/current/doc/manpages/net/getprotoent.3 b/packages/net/common/current/doc/manpages/net/getprotoent.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/getprotoent.3 @@ -0,0 +1,134 @@ +.\" $OpenBSD: getprotoent.3,v 1.8 2000/12/24 00:30:56 aaron Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd June 4, 1993 +.Dt GETPROTOENT 3 +.Os +.Sh NAME +.Nm getprotoent , +.Nm getprotobynumber , +.Nm getprotobyname , +.Nm setprotoent , +.Nm endprotoent +.Nd get protocol entry +.Sh SYNOPSIS +.Fd #include +.Ft struct protoent * +.Fn getprotoent "void" +.Ft struct protoent * +.Fn getprotobyname "char *name" +.Ft struct protoent * +.Fn getprotobynumber "int proto" +.Ft void +.Fn setprotoent "int stayopen" +.Ft void +.Fn endprotoent "void" +.Sh DESCRIPTION +The +.Fn getprotoent , +.Fn getprotobyname , +and +.Fn getprotobynumber +functions each return a pointer to an object with the following structure +containing the broken-out fields of a line in the network protocol database, +.Pa /etc/protocols . +.Bd -literal -offset indent +.Pp +struct protoent { + char *p_name; /* official name of protocol */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol number */ +}; +.Ed +.Pp +The members of this structure are: +.Bl -tag -width p_aliases +.It Fa p_name +The official name of the protocol. +.It Fa p_aliases +A zero-terminated list of alternate names for the protocol. +.It Fa p_proto +The protocol number. +.El +.Pp +The +.Fn getprotoent +function reads the next line of the file, opening the file if necessary. +.Pp +The +.Fn setprotoent +function opens and rewinds the file. +If the +.Fa stayopen +flag is non-zero, +the net database will not be closed after each call to +.Fn getprotobyname +or +.Fn getprotobynumber . +.Pp +The +.Fn endprotoent +function closes the file. +.Pp +The +.Fn getprotobyname +and +.Fn getprotobynumber +functions sequentially search from the beginning of the file until a +matching protocol name or protocol number is found, or until +.Dv EOF +is encountered. +.Sh RETURN VALUES +Null pointer (0) returned on +.Dv EOF +or error. +.Sh FILES +.Bl -tag -width /etc/protocols -compact +.It Pa /etc/protocols +.El +.Sh SEE ALSO +.Xr protocols 5 +.Sh HISTORY +The +.Fn getprotoent , +.Fn getprotobynumber , +.Fn getprotobyname , +.Fn setprotoent , +and +.Fn endprotoent +functions appeared in +.Bx 4.2 . +.Sh BUGS +These functions use a static data space; if the data is needed for future use, +it should be copied before any subsequent calls overwrite it. +Only the Internet protocols are currently understood. diff --git a/packages/net/common/current/doc/manpages/net/getrrsetbyname.3 b/packages/net/common/current/doc/manpages/net/getrrsetbyname.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/getrrsetbyname.3 @@ -0,0 +1,163 @@ +.\" $OpenBSD: getrrsetbyname.3,v 1.4 2001/08/08 16:28:43 jakob Exp $ +.\" +.\" Copyright (C) 2000, 2001 Internet Software Consortium. +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM +.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, +.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING +.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd Oct 18, 2000 +.Dt GETRRSETBYNAME 3 +.Os +.Sh NAME +.Nm getrrsetbyname +.Nd retrieve DNS records +.Sh SYNOPSIS +.Fd #include +.Ft int +.Fn getrrsetbyname "const char *hostname" "unsigned int rdclass" \ +"unsigned int rdtype" "unsigned int flags" "struct rrsetinfo **res" +.Ft int +.Fn freerrset "struct rrsetinfo **rrset" +.Sh DESCRIPTION +.Fn getrrsetbyname +gets a set of resource records associated with a +.Fa hostname , +.Fa class +and +.Fa type . +.Fa hostname +is a pointer a to null-terminated string. +The +.Fa flags +field is currently unused and must be zero. +.Pp +After a successful call to +.Fn getrrsetbyname , +.Fa *res +is a pointer to an +.Li rrsetinfo +structure, containing a list of one or more +.Li rdatainfo +structures containing resource records and potentially another list of +.Li rdatainfo +structures containing SIG resource records associated with those records. +The members +.Li rri_rdclass +and +.Li rri_rdtype +are copied from the parameters. +.Li rri_ttl +and +.Li rri_name +are properties of the obtained rrset. +The resource records contained in +.Li rri_rdatas +and +.Li rri_sigs +are in uncompressed DNS wire format. +Properties of the rdataset are represented in the +.Li rri_flags +bitfield. If the +.Dv RRSET_VALIDATED +bit is set, the data has been DNSSEC +validated and the signatures verified. +.Pp +The following structures are used: +.Bd -literal -offset +struct rdatainfo { + unsigned int rdi_length; /* length of data */ + unsigned char *rdi_data; /* record data */ +}; + +struct rrsetinfo { + unsigned int rri_flags; /* RRSET_VALIDATED ... */ + unsigned int rri_rdclass; /* class number */ + unsigned int rri_rdtype; /* RR type number */ + unsigned int rri_ttl; /* time to live */ + unsigned int rri_nrdatas; /* size of rdatas array */ + unsigned int rri_nsigs; /* size of sigs array */ + char *rri_name; /* canonical name */ + struct rdatainfo *rri_rdatas; /* individual records */ + struct rdatainfo *rri_sigs; /* individual signatures */ +}; +.Ed +.Pp +All of the information returned by +.Fn getrrsetbyname +is dynamically allocated: the +.Li rrsetinfo +and +.Li rdatainfo +structures, +and the canonical host name strings pointed to by the +.Li rrsetinfostructure. +Memory allocated for the dynamically allocated structures created by +a successful call to +.Fn getrrsetbyname +is released by +.Fn freerrset . +.Li rrset +is a pointer to a +.Li struct rrset +created by a call to +.Fn getrrsetbyname . +.Pp +If the EDNS0 option is activated in +.Xr resolv.conf 3 , +.Fn getrrsetbyname +will request DNSSEC authentication using the EDNS0 DNSSEC OK (DO) bit. +.Sh "RETURN VALUES" +.Fn getrrsetbyname +returns zero on success, and one of the following error +codes if an error occurred: +.Pp +.Bl -tag -width ERRSET_NOMEMORY -compact +.It Dv ERRSET_NONAME +the name does not exist +.It Dv ERRSET_NODATA +the name exists, but does not have data of the desired type +.It Dv ERRSET_NOMEMORY +memory could not be allocated +.It Dv ERRSET_INVAL +a parameter is invalid +.It Dv ERRSET_FAIL +other failure +.El +.Sh SEE ALSO +.Xr resolver 3 , +.Xr resolv.conf 5 , +.Xr named 8 +.Sh AUTHORS +Jakob Schlyter +.Aq jakob@openbsd.org +.Sh HISTORY +.Fn getrrsetbyname +first appeared in +.Ox 3.0 . +The API first appeared in ISC BIND version 9. +.Sh BUGS +The data in +.Li *rdi_data +should be returned in uncompressed wire format. +Currently, the data is in compressed format and the caller can't +uncompress since it doesn't have the full message. +.Sh CAVEATS +The +.Dv RRSET_VALIDATED +flag in +.Li rri_flags +is set if the AD (autenticated data) bit in the DNS answer is +set. This flag +.Em should not +be trusted unless the transport between the nameserver and the resolver +is secure (e.g. IPsec, trusted network, loopback communication). diff --git a/packages/net/common/current/doc/manpages/net/getservent.3 b/packages/net/common/current/doc/manpages/net/getservent.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/getservent.3 @@ -0,0 +1,141 @@ +.\" $OpenBSD: getservent.3,v 1.11 2000/12/24 00:30:56 aaron Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd January 12, 1994 +.Dt GETSERVENT 3 +.Os +.Sh NAME +.Nm getservent , +.Nm getservbyport , +.Nm getservbyname , +.Nm setservent , +.Nm endservent +.Nd get service entry +.Sh SYNOPSIS +.Fd #include +.Ft struct servent * +.Fn getservent "void" +.Ft struct servent * +.Fn getservbyname "char *name" "char *proto" +.Ft struct servent * +.Fn getservbyport "int port" "char *proto" +.Ft void +.Fn setservent "int stayopen" +.Ft void +.Fn endservent "void" +.Sh DESCRIPTION +The +.Fn getservent , +.Fn getservbyname , +and +.Fn getservbyport +functions each return a pointer to an object with the following structure +containing the broken-out fields of a line in the network services database, +.Pa /etc/services . +.Bd -literal -offset indent +struct servent { + char *s_name; /* official name of service */ + char **s_aliases; /* alias list */ + int s_port; /* port service resides at */ + char *s_proto; /* protocol to use */ +}; +.Ed +.Pp +The members of this structure are: +.Bl -tag -width s_aliases +.It Fa s_name +The official name of the service. +.It Fa s_aliases +A zero-terminated list of alternate names for the service. +.It Fa s_port +The port number at which the service resides. +Port numbers are returned in network byte order. +.It Fa s_proto +The name of the protocol to use when contacting the service. +.El +.Pp +The +.Fn getservent +function reads the next line of the file, opening the file if necessary. +.Pp +The +.Fn setservent +function opens and rewinds the file. +If the +.Fa stayopen +flag is non-zero, +the net database will not be closed after each call to +.Fn getservbyname +or +.Fn getservbyport . +.Pp +The +.Fn endservent +function closes the file. +.Pp +The +.Fn getservbyname +and +.Fn getservbyport +functions sequentially search from the beginning of the file until a +matching protocol name or port number (specified in network byte order) +is found, or until +.Dv EOF +is encountered. +If a protocol name is also supplied (non-null), +searches must also match the protocol. +.Sh FILES +.Bl -tag -width /etc/services -compact +.It Pa /etc/services +.El +.Sh DIAGNOSTICS +Null pointer (0) returned on +.Dv EOF +or error. +.Sh SEE ALSO +.Xr getprotoent 3 , +.Xr services 5 +.Sh HISTORY +The +.Fn getservent , +.Fn getservbyport , +.Fn getservbyname , +.Fn setservent , +and +.Fn endservent +functions appeared in +.Bx 4.2 . +.Sh BUGS +These functions use static data storage; if the data is needed for future use, +it should be copied before any subsequent calls overwrite it. +Expecting port numbers to fit in a 32-bit quantity is probably naive. diff --git a/packages/net/common/current/doc/manpages/net/if_indextoname.3 b/packages/net/common/current/doc/manpages/net/if_indextoname.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/if_indextoname.3 @@ -0,0 +1,137 @@ +.\" $OpenBSD: if_indextoname.3,v 1.4 2000/03/01 17:31:23 todd Exp $ +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93 +.\" +.Dd May 21, 1998 +.Dt IF_NAMETOINDEX 3 +.Os +.Sh NAME +.Nm if_nametoindex , +.Nm if_indextoname , +.Nm if_nameindex , +.Nm if_freenameindex +.Nd convert interface index to name, and vice versa +.Sh SYNOPSIS +.Fd #include +.Ft "unsigned int" +.Fn if_nametoindex "const char *ifname" +.Ft "char *" +.Fn if_indextoname "unsigned int ifindex" "char *ifname" +.Ft "struct if_nameindex *" +.Fn if_nameindex "void" +.Ft "void" +.Fn if_freenameindex "struct if_nameindex *ptr" +.Sh DESCRIPTION +These functions map interface indexes to interface names (such as +.Dq lo0 ) , +and vice versa. +.Pp +The +.Fn if_nametoindex +function converts an interface name specified by the +.Fa ifname +argument to an interface index (positive integer value). +If the specified interface does not exist, 0 will be returned. +.Pp +.Fn if_indextoname +converts an interface index specified by the +.Fa ifindex +argument to an interface name. +The +.Fa ifname +argument must point to a buffer of at least +.Dv IF_NAMESIZE +bytes into which the interface name corresponding to the specified index is +returned. +.Pf ( Dv IF_NAMESIZE +is also defined in +.Aq Pa net/if.h +and its value includes a terminating null byte at the end of the +interface name.) +This pointer is also the return value of the function. +If there is no interface corresponding to the specified index, +.Dv NULL +is returned. +.Pp +.Fn if_nameindex +returns an array of +.Fa if_nameindex +structures. +.Fa if_nametoindex +is also defined in +.Aq Pa net/if.h , +and is as follows: +.Bd -literal -offset +struct if_nameindex { + unsigned int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "le0", ... */ +}; +.Ed +.Pp +The end of the array of structures is indicated by a structure with +an +.Fa if_index +of 0 and an +.Fa if_name +of +.Dv NULL . +The function returns a null pointer on error. +The memory used for this array of structures along with the interface +names pointed to by the +.Fa if_name +members is obtained dynamically. +This memory is freed by the +.Fn if_freenameindex +function. +.Pp +.Fn if_freenameindex +takes a pointer that was returned by +.Fn if_nameindex +as argument +.Pq Fa ptr , +and it reclaims the region allocated. +.Sh DIAGNOSTICS +.Fn if_nametoindex +returns 0 on error, positive integer on success. +.Fn if_indextoname +and +.Fn if_nameindex +return +.Dv NULL +on errors. +.Sh SEE ALSO +R. Gilligan, S. Thomson, J. Bound, and W. Stevens, +``Basic Socket Interface Extensions for IPv6,'' RFC2553, March 1999. +.Sh STANDARDS +These functions are defined in ``Basic Socket Interface Extensions for IPv6'' +.Pq RFC2533 . diff --git a/packages/net/common/current/doc/manpages/net/inet.3 b/packages/net/common/current/doc/manpages/net/inet.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/inet.3 @@ -0,0 +1,349 @@ +.\" $OpenBSD: inet.3,v 1.13 2001/02/17 23:13:26 pjanzen Exp $ +.\" $NetBSD: inet.3,v 1.7 1997/06/18 02:25:24 lukem Exp $ +.\" +.\" Copyright (c) 1983, 1990, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)inet.3 8.1 (Berkeley) 6/4/93 +.\" +.Dd June 18, 1997 +.Dt INET 3 +.Os +.Sh NAME +.Nm inet_addr , +.Nm inet_aton , +.Nm inet_lnaof , +.Nm inet_makeaddr , +.Nm inet_netof , +.Nm inet_network , +.Nm inet_ntoa , +.Nm inet_ntop , +.Nm inet_pton +.Nd Internet address manipulation routines +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include +.Ft in_addr_t +.Fn inet_addr "const char *cp" +.Ft int +.Fn inet_aton "const char *cp" "struct in_addr *addr" +.Ft in_addr_t +.Fn inet_lnaof "struct in_addr in" +.Ft struct in_addr +.Fn inet_makeaddr "unsigned long net" "unsigned long lna" +.Ft in_addr_t +.Fn inet_netof "struct in_addr in" +.Ft in_addr_t +.Fn inet_network "const char *cp" +.Ft char * +.Fn inet_ntoa "struct in_addr in" +.Ft const char * +.Fn inet_ntop "int af" "const void *src" "char *dst" "size_t size" +.Ft int +.Fn inet_pton "int af" "const char *src" "void *dst" +.Sh DESCRIPTION +The routines +.Fn inet_aton , +.Fn inet_addr +and +.Fn inet_network +interpret character strings representing +numbers expressed in the Internet standard +.Ql \&. +notation. +The +.Fn inet_pton +function converts a presentation format address (that is, printable form +as held in a character string) to network format (usually a +.Li struct in_addr +or some other internal binary representation, in network byte order). +It returns 1 if the address was valid for the specified address family, or +0 if the address wasn't parseable in the specified address family, or \-1 +if some system error occurred (in which case +.Va errno +will have been set). +This function is presently valid for +.Dv AF_INET +and +.Dv AF_INET6 . +The +.Fn inet_aton +routine interprets the specified character string as an Internet address, +placing the address into the structure provided. +It returns 1 if the string was successfully interpreted, +or 0 if the string was invalid. +The +.Fn inet_addr +and +.Fn inet_network +functions return numbers suitable for use +as Internet addresses and Internet network +numbers, respectively. +.Pp +The function +.Fn inet_ntop +converts an address from network format (usually a +.Li struct in_addr +or some other binary form, in network byte order) to presentation format +(suitable for external display purposes). +It returns +.Dv NULL +if a system +error occurs (in which case, +.Va errno +will have been set), or it returns a pointer to the destination string. +The routine +.Fn inet_ntoa +takes an Internet address and returns an +.Tn ASCII +string representing the address in +.Ql \&. +notation. +The routine +.Fn inet_makeaddr +takes an Internet network number and a local +network address and constructs an Internet address +from it. +The routines +.Fn inet_netof +and +.Fn inet_lnaof +break apart Internet host addresses, returning +the network number and local network address part, +respectively. +.Pp +All Internet addresses are returned in network +order (bytes ordered from left to right). +All network numbers and local address parts are +returned as machine format integer values. +.Sh INTERNET ADDRESSES (IP VERSION 4) +Values specified using the +.Ql \&. +notation take one +of the following forms: +.Bd -literal -offset indent +a.b.c.d +a.b.c +a.b +a +.Ed +.Pp +When four parts are specified, each is interpreted +as a byte of data and assigned, from left to right, +to the four bytes of an Internet address. +Note that when an Internet address is viewed as a 32-bit +integer quantity on a system that uses little-endian +byte order (such as the +.Tn Intel 386, 486 +and +.Tn Pentium +processors) the bytes referred to above appear as +.Dq Li d.c.b.a . +That is, little-endian bytes are ordered from right to left. +.Pp +When a three part address is specified, the last +part is interpreted as a 16-bit quantity and placed +in the rightmost two bytes of the network address. +This makes the three part address format convenient +for specifying Class B network addresses as +.Dq Li 128.net.host . +.Pp +When a two part address is supplied, the last part +is interpreted as a 24-bit quantity and placed in +the rightmost three bytes of the network address. +This makes the two part address format convenient +for specifying Class A network addresses as +.Dq Li net.host . +.Pp +When only one part is given, the value is stored +directly in the network address without any byte +rearrangement. +.Pp +All numbers supplied as +.Dq parts +in a +.Ql \&. +notation +may be decimal, octal, or hexadecimal, as specified +in the C language (i.e., a leading 0x or 0X implies +hexadecimal; otherwise, a leading 0 implies octal; +otherwise, the number is interpreted as decimal). +.Sh INTERNET ADDRESSES (IP VERSION 6) +In order to support scoped IPv6 addresses, +.Xr getaddrinfo 3 +and +.Xr getnameinfo 3 +are recommended rather than the functions presented here. +.Pp +The presentation format of an IPv6 address is given in [RFC1884 2.2]: +.Pp +There are three conventional forms for representing IPv6 addresses as +text strings: +.Bl -enum +.It +The preferred form is x:x:x:x:x:x:x:x, where the 'x's are the +hexadecimal values of the eight 16-bit pieces of the address. +Examples: +.Bd -literal -offset indent +FEDC:BA98:7654:3210:FEDC:BA98:7654:3210 +1080:0:0:0:8:800:200C:417A +.Ed +.Pp +Note that it is not necessary to write the leading zeros in an +individual field, but there must be at least one numeral in +every field (except for the case described in 2.). +.It +Due to the method of allocating certain styles of IPv6 +addresses, it will be common for addresses to contain long +strings of zero bits. +In order to make writing addresses +.Pp +containing zero bits easier a special syntax is available to +compress the zeros. +The use of +.Dq \&:\&: +indicates multiple groups +of 16 bits of zeros. +The +.Dq \&:\&: +can only appear once in an +address. +The +.Dq \&:\&: +can also be used to compress the leading and/or trailing zeros in an address. +.Pp +For example the following addresses: +.Bd -literal -offset indent +1080:0:0:0:8:800:200C:417A a unicast address +FF01:0:0:0:0:0:0:43 a multicast address +0:0:0:0:0:0:0:1 the loopback address +0:0:0:0:0:0:0:0 the unspecified addresses +.Ed +.Pp +may be represented as: +.Bd -literal -offset indent +1080::8:800:200C:417A a unicast address +FF01::43 a multicast address +::1 the loopback address +:: the unspecified addresses +.Ed +.It +An alternative form that is sometimes more convenient when +dealing with a mixed environment of IPv4 and IPv6 nodes is +x:x:x:x:x:x:d.d.d.d, where the 'x's are the hexadecimal values +of the six high-order 16-bit pieces of the address, and the 'd's +are the decimal values of the four low-order 8-bit pieces of the +address (standard IPv4 representation). +Examples: +.Bd -literal -offset indent +0:0:0:0:0:0:13.1.68.3 +0:0:0:0:0:FFFF:129.144.52.38 +.Ed +.Pp +or in compressed form: +.Bd -literal -offset indent +::13.1.68.3 +::FFFF:129.144.52.38 +.Ed +.El +.Sh DIAGNOSTICS +The constant +.Dv INADDR_NONE +is returned by +.Fn inet_addr +and +.Fn inet_network +for malformed requests. +.Sh SEE ALSO +.Xr byteorder 3 , +.Xr gethostbyname 3 , +.Xr getnetent 3 , +.Xr inet_net 3 , +.Xr hosts 5 , +.Xr networks 5 +.Sh STANDARDS +The +.Nm inet_ntop +and +.Nm inet_pton +functions conforms to the IETF IPv6 BSD API and address formatting +specifications. +Note that +.Nm inet_pton +does not accept 1-, 2-, or 3-part dotted addresses; all four parts +must be specified. +This is a narrower input set than that accepted by +.Nm inet_aton . +.Sh HISTORY +The +.Nm inet_addr , +.Nm inet_network , +.Nm inet_makeaddr , +.Nm inet_lnaof +and +.Nm inet_netof +functions appeared in +.Bx 4.2 . +The +.Nm inet_aton +and +.Nm inet_ntoa +functions appeared in +.Bx 4.3 . +The +.Nm inet_pton +and +.Nm inet_ntop +functions appeared in BIND 4.9.4. +.Sh BUGS +The value +.Dv INADDR_NONE +(0xffffffff) is a valid broadcast address, but +.Fn inet_addr +cannot return that value without indicating failure. +Also, +.Fn inet_addr +should have been designed to return a +.Li struct in_addr . +The newer +.Fn inet_aton +function does not share these problems, and almost all existing code +should be modified to use +.Fn inet_aton +instead. +.Pp +The problem of host byte ordering versus network byte ordering is +confusing. +.Pp +The string returned by +.Fn inet_ntoa +resides in a static memory area. diff --git a/packages/net/common/current/doc/manpages/net/inet6_option_space.3 b/packages/net/common/current/doc/manpages/net/inet6_option_space.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/inet6_option_space.3 @@ -0,0 +1,452 @@ +.\" $OpenBSD: inet6_option_space.3,v 1.8 2001/06/23 05:57:04 deraadt Exp $ +.\" $KAME: inet6_option_space.3,v 1.7 2000/05/17 14:32:13 itojun Exp $ +.\" +.\" Copyright (c) 1983, 1987, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd December 10, 1999 +.Dt INET6_OPTION_SPACE 3 +.Os +.\" +.Sh NAME +.Nm inet6_option_space , +.Nm inet6_option_init , +.Nm inet6_option_append , +.Nm inet6_option_alloc , +.Nm inet6_option_next , +.Nm inet6_option_find +.Nd IPv6 Hop-by-Hop and Destination Options manipulation +.\" +.Sh SYNOPSIS +.Fd #include +.Ft "int" +.Fn inet6_option_space "int nbytes" +.Ft "int" +.Fn inet6_option_init "void *bp" "struct cmsghdr **cmsgp" "int type" +.Ft "int" +.Fn inet6_option_append "struct cmsghdr *cmsg" "const u_int8_t *typep" "int multx" "int plusy" +.Ft "u_int8_t *" +.Fn inet6_option_alloc "struct cmsghdr *cmsg" "int datalen" "int multx" "int plusy"; +.Ft "int" +.Fn inet6_option_next "const struct cmsghdr *cmsg" "u_int8_t **tptrp" +.Ft "int" +.Fn inet6_option_find "const struct cmsghdr *cmsg" "u_int8_t **tptrp" "int type" +.\" +.Sh DESCRIPTION +.\" +Building and parsing the Hop-by-Hop and Destination options is +complicated due to alignment constranints, padding and +ancillary data manipulation. +RFC2292 defines a set of functions to help the application. +The function prototypes for +these functions are all in the +.Aq Li netinet/in.h +header. +.\" +.Ss inet6_option_space +.Fn inet6_option_space +returns the number of bytes required to hold an option when it is stored as +ancillary data, including the +.Li cmsghdr +structure at the beginning, +and any padding at the end +.Po +to make its size a multiple of 8 bytes +.Pc . +The argument is the size of the structure defining the option, +which must include any pad bytes at the beginning +.Po +the value +.Li y +in the alignment term +.Dq Li xn + y +.Pc , +the type byte, the length byte, and the option data. +.Pp +Note: If multiple options are stored in a single ancillary data +object, which is the recommended technique, this function +overestimates the amount of space required by the size of +.Li N-1 +.Li cmsghdr +structures, +where +.Li N +is the number of options to be stored in the object. +This is of little consequence, since it is assumed that most +Hop-by-Hop option headers and Destination option headers carry only +one option +.Pq appendix B of [RFC-2460] . +.\" +.Ss inet6_option_init +.Fn inet6_option_init +is called once per ancillary data object that will +contain either Hop-by-Hop or Destination options. +It returns +.Li 0 +on success or +.Li -1 +on an error. +.Pp +.Fa bp +is a pointer to previously allocated space that will contain the +ancillary data object. +It must be large enough to contain all the +individual options to be added by later calls to +.Fn inet6_option_append +and +.Fn inet6_option_alloc . +.Pp +.Fa cmsgp +is a pointer to a pointer to a +.Li cmsghdr +structure. +.Fa *cmsgp +is initialized by this function to point to the +.Li cmsghdr +structure constructed by this function in the buffer pointed to by +.Fa bp . +.Pp +.Fa type +is either +.Dv IPV6_HOPOPTS +or +.Dv IPV6_DSTOPTS . +This +.Fa type +is stored in the +.Li cmsg_type +member of the +.Li cmsghdr +structure pointed to by +.Fa *cmsgp . +.\" +.Ss inet6_option_append +This function appends a Hop-by-Hop option or a Destination option +into an ancillary data object that has been initialized by +.Fn inet6_option_init . +This function returns +.Li 0 +if it succeeds or +.Li -1 +on an error. +.Pp +.Fa cmsg +is a pointer to the +.Li cmsghdr +structure that must have been +initialized by +.Fn inet6_option_init . +.Pp +.Fa typep +is a pointer to the 8-bit option type. +It is assumed that this +field is immediately followed by the 8-bit option data length field, +which is then followed immediately by the option data. +The caller +initializes these three fields +.Pq the type-length-value, or TLV +before calling this function. +.Pp +The option type must have a value from +.Li 2 +to +.Li 255 , +inclusive. +.Po +.Li 0 +and +.Li 1 +are reserved for the +.Li Pad1 +and +.Li PadN +options, respectively. +.Pc +.Pp +The option data length must have a value between +.Li 0 +and +.Li 255 , +inclusive, and is the length of the option data that follows. +.Pp +.Fa multx +is the value +.Li x +in the alignment term +.Dq Li xn + y . +It must have a value of +.Li 1 , +.Li 2 , +.Li 4 , +or +.Li 8 . +.Pp +.Fa plusy +is the value +.Li y +in the alignment term +.Dq Li xn + y . +It must have a value between +.Li 0 +and +.Li 7 , +inclusive. +.\" +.Ss inet6_option_alloc +This function appends a Hop-by-Hop option or a Destination option +into an ancillary data object that has been initialized by +.Fn inet6_option_init . +This function returns a pointer to the 8-bit +option type field that starts the option on success, or +.Dv NULL +on an error. +.Pp +The difference between this function and +.Fn inet6_option_append +is that the latter copies the contents of a previously built option into +the ancillary data object while the current function returns a +pointer to the space in the data object where the option's TLV must +then be built by the caller. +.Pp +.Fa cmsg +is a pointer to the +.Li cmsghdr +structure that must have been +initialized by +.Fn inet6_option_init . +.Pp +.Fa datalen +is the value of the option data length byte for this option. +This value is required as an argument to allow the function to +determine if padding must be appended at the end of the option. +.Po +The +.Fn inet6_option_append +function does not need a data length argument +since the option data length must already be stored by the caller. +.Pc +.Pp +.Fa multx +is the value +.Li x +in the alignment term +.Dq Li xn + y . +It must have a value of +.Li 1 , +.Li 2 , +.Li 4 , +or +.Li 8 . +.Pp +.Fa plusy +is the value +.Li y +in the alignment term +.Dq Li xn + y . +It must have a value between +.Li 0 +and +.Li 7 , +inclusive. +.\" +.Ss inet6_option_next +This function processes the next Hop-by-Hop option or Destination +option in an ancillary data object. +If another option remains to be +processed, the return value of the function is +.Li 0 +and +.Fa *tptrp +points to +the 8-bit option type field +.Po +which is followed by the 8-bit option +data length, followed by the option data +.Pc . +If no more options remain +to be processed, the return value is +.Li -1 +and +.Fa *tptrp +is +.Dv NULL . +If an error occurs, the return value is +.Li -1 +and +.Fa *tptrp +is not +.Dv NULL . +.Pp +.Fa cmsg +is a pointer to +.Li cmsghdr +structure of which +.Li cmsg_level +equals +.Dv IPPROTO_IPV6 +and +.Li cmsg_type +equals either +.Dv IPV6_HOPOPTS +or +.Dv IPV6_DSTOPTS . +.Pp +.Fa tptrp +is a pointer to a pointer to an 8-bit byte and +.Fa *tptrp +is used +by the function to remember its place in the ancillary data object +each time the function is called. +The first time this function is +called for a given ancillary data object, +.Fa *tptrp +must be set to +.Dv NULL . +.Pp +Each time this function returns success, +.Fa *tptrp +points to the 8-bit +option type field for the next option to be processed. +.\" +.Ss inet6_option_find +This function is similar to the previously described +.Fn inet6_option_next +function, except this function lets the caller +specify the option type to be searched for, instead of always +returning the next option in the ancillary data object. +.Fa cmsg +is a +pointer to +.Li cmsghdr +structure of which +.Li cmsg_level +equals +.Dv IPPROTO_IPV6 +and +.Li cmsg_type +equals either +.Dv IPV6_HOPOPTS +or +.Dv IPV6_DSTOPTS . +.Pp +.Fa tptrp +is a pointer to a pointer to an 8-bit byte and +.Fa *tptrp +is used +by the function to remember its place in the ancillary data object +each time the function is called. +The first time this function is +called for a given ancillary data object, +.Fa *tptrp +must be set to +.Dv NULL . +.Pa +This function starts searching for an option of the specified type +beginning after the value of +.Fa *tptrp . +If an option of the specified +type is located, this function returns +.Li 0 +and +.Fa *tptrp +points to the 8- +bit option type field for the option of the specified type. +If an +option of the specified type is not located, the return value is +.Li -1 +and +.Fa *tptrp +is +.Dv NULL . +If an error occurs, the return value is +.Li -1 +and +.Fa *tptrp +is not +.Dv NULL . +.\" +.Sh DIAGNOSTICS +.Fn inet6_option_init +and +.Fn inet6_option_append +return +.Li 0 +on success or +.Li -1 +on an error. +.Pp +.Fn inet6_option_alloc +returns +.Dv NULL +on an error. +.Pp +On errors, +.Fn inet6_option_next +and +.Fn inet6_option_find +return +.Li -1 +setting +.Fa *tptrp +to non +.Dv NULL +value. +.\" +.Sh EXAMPLES +RFC2292 gives comprehensive examples in chapter 6. +.\" +.Sh SEE ALSO +.Rs +.%A W. Stevens +.%A M. Thomas +.%T "Advanced Sockets API for IPv6" +.%N RFC2292 +.%D February 1998 +.Re +.Rs +.%A S. Deering +.%A R. Hinden +.%T "Internet Protocol, Version 6 (IPv6) Specification" +.%N RFC2460 +.%D December 1998 +.Re +.\" +.Sh HISTORY +The implementation first appeared in KAME advanced networking kit. +.\" +.Sh STANDARDS +The functions +are documented in +.Dq Advanced Sockets API for IPv6 +.Pq RFC2292 . +.\" +.Sh BUGS +The text was shamelessly copied from RFC2292. diff --git a/packages/net/common/current/doc/manpages/net/inet6_rthdr_space.3 b/packages/net/common/current/doc/manpages/net/inet6_rthdr_space.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/inet6_rthdr_space.3 @@ -0,0 +1,325 @@ +.\" $OpenBSD: inet6_rthdr_space.3,v 1.8 2001/06/23 05:57:04 deraadt Exp $ +.\" $KAME: inet6_rthdr_space.3,v 1.8 2000/05/17 14:30:15 itojun Exp $ +.\" +.\" Copyright (c) 1983, 1987, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd December 10, 1999 +.Dt INET6_RTHDR_SPACE 3 +.Os +.\" +.Sh NAME +.Nm inet6_rthdr_space , +.Nm inet6_rthdr_init , +.Nm inet6_rthdr_add , +.Nm inet6_rthdr_lasthop , +.Nm inet6_rthdr_reverse , +.Nm inet6_rthdr_segments , +.Nm inet6_rthdr_getaddr , +.Nm inet6_rthdr_getflags +.Nd IPv6 Routing Header Options manipulation +.\" +.Sh SYNOPSIS +.Fd #include +.Ft size_t +.Fn inet6_rthdr_space "int type" "int segments" +.Ft "struct cmsghdr *" +.Fn inet6_rthdr_init "void *bp" "int type" +.Ft int +.Fn inet6_rthdr_add "struct cmsghdr *cmsg" "const struct in6_addr *addr" "unsigned int flags" +.Ft int +.Fn inet6_rthdr_lasthop "struct cmsghdr *cmsg" "unsigned int flags" +.Ft int +.Fn inet6_rthdr_reverse "const struct cmsghdr *in" "struct cmsghdr *out" +.Ft int +.Fn inet6_rthdr_segments "const struct cmsghdr *cmsg" +.Ft "struct in6_addr *" +.Fn inet6_rthdr_getaddr "struct cmsghdr *cmsg" "int index" +.Ft int +.Fn inet6_rthdr_getflags "const struct cmsghdr *cmsg" "int index" +.\" +.Sh DESCRIPTION +RFC2292 IPv6 advanced API defines eight +functions that the application calls to build and examine a Routing +header. +Four functions build a Routing header: +.Bl -hang +.It Fn inet6_rthdr_space +return #bytes required for ancillary data +.It Fn inet6_rthdr_init +initialize ancillary data for Routing header +.It Fn inet6_rthdr_add +add IPv6 address & flags to Routing header +.It Fn inet6_rthdr_lasthop +specify the flags for the final hop +.El +.Pp +Four functions deal with a returned Routing header: +.Bl -hang +.It Fn inet6_rthdr_reverse +reverse a Routing header +.It Fn inet6_rthdr_segments +return #segments in a Routing header +.It Fn inet6_rthdr_getaddr +fetch one address from a Routing header +.It Fn inet6_rthdr_getflags +fetch one flag from a Routing header +.El +.Pp +The function prototypes for these functions are all in the +.Aq Li netinet/in.h +header. +.\" +.Ss inet6_rthdr_space +This function returns the number of bytes required to hold a Routing +header of the specified +.Fa type +containing the specified number of +.Fa segments +.Pq addresses . +For an IPv6 Type 0 Routing header, the number +of segments must be between 1 and 23, inclusive. +The return value +includes the size of the cmsghdr structure that precedes the Routing +header, and any required padding. +.Pp +If the return value is 0, then either the type of the Routing header +is not supported by this implementation or the number of segments is +invalid for this type of Routing header. +.Pp +Note: This function returns the size but does not allocate the space +required for the ancillary data. +This allows an application to +allocate a larger buffer, if other ancillary data objects are +desired, since all the ancillary data objects must be specified to +.Xr sendmsg 2 +as a single +.Li msg_control +buffer. +.\" +.Ss inet6_rthdr_init +This function initializes the buffer pointed to by +.Fa bp +to contain a +.Li cmsghdr +structure followed by a Routing header of the specified +.Fa type . +The +.Li cmsg_len +member of the +.Li cmsghdr +structure is initialized to the +size of the structure plus the amount of space required by the +Routing header. +The +.Li cmsg_level +and +.Li cmsg_type +members are also initialized as required. +.Pp +The caller must allocate the buffer and its size can be determined by +calling +.Fn inet6_rthdr_space . +.Pp +Upon success the return value is the pointer to the +.Li cmsghdr +structure, and this is then used as the first argument to the next +two functions. +Upon an error the return value is +.Dv NULL . +.\" +.Ss inet6_rthdr_add +This function adds the address pointed to by +.Fa addr +to the end of the +Routing header being constructed and sets the type of this hop to the +value of +.Fa flags . +For an IPv6 Type 0 Routing header, +.Fa flags +must be +either +.Dv IPV6_RTHDR_LOOSE +or +.Dv IPV6_RTHDR_STRICT . +.Pp +If successful, the +.Li cmsg_len +member of the +.Li cmsghdr +structure is +updated to account for the new address in the Routing header and the +return value of the function is 0. +Upon an error the return value of +the function is -1. +.\" +.Ss inet6_rthdr_lasthop +This function specifies the Strict/Loose flag for the final hop of a +Routing header. +For an IPv6 Type 0 Routing header, +.Fa flags +must be either +.Dv IPV6_RTHDR_LOOSE +or +.Dv IPV6_RTHDR_STRICT . +.Pp +The return value of the function is 0 upon success, or -1 upon an error. +.Pp +Notice that a Routing header specifying +.Li N +intermediate nodes requires +.Li N+1 +Strict/Loose flags. +This requires +.Li N +calls to +.Fn inet6_rthdr_add +followed by one call to +.Fn inet6_rthdr_lasthop . +.\" +.Ss inet6_rthdr_reverse +This function takes a Routing header that was received as ancillary +data +.Po +pointed to by the first argument, +.Fa in +.Pc +and writes a new Routing +header that sends datagrams along the reverse of that route. +Both +arguments are allowed to point to the same buffer +.Pq that is, the reversal can occur in place . +.Pp +The return value of the function is 0 on success, or -1 upon an +error. +.\" +.Ss inet6_rthdr_segments +This function returns the number of segments +.Pq addresses +contained in +the Routing header described by +.Fa cmsg . +On success the return value is +between 1 and 23, inclusive. +The return value of the function is -1 upon an error. +.\" +.Ss inet6_rthdr_getaddr +This function returns a pointer to the IPv6 address specified by +.Fa index +.Po +which must have a value between 1 and the value returned by +.Fn inet6_rthdr_segments +.Pc +in the Routing header described by +.Fa cmsg . +An +application should first call +.Fn inet6_rthdr_segments +to obtain the number of segments in the Routing header. +.Pp +Upon an error the return value of the function is +.Dv NULL . +.\" +.Ss inet6_rthdr_getflags +This function returns the flags value specified by +.Fa index +.Po +which must +have a value between 0 and the value returned by +.Fn inet6_rthdr_segments +.Pc +in the Routing header described by +.Fa cmsg . +For an IPv6 Type 0 Routing header the return value will be either +.Dv IPV6_RTHDR_LOOSE +or +.Dv IPV6_RTHDR_STRICT . +.Pp +Upon an error the return value of the function is -1. +.Pp +Note: Addresses are indexed starting at 1, and flags starting at 0, +to maintain consistency with the terminology and figures in RFC2460. +.\" +.Sh DIAGNOSTICS +.Fn inet6_rthdr_space +returns 0 on errors. +.Pp +.Fn inet6_rthdr_add , +.Fn inet6_rthdr_lasthop +and +.Fn inet6_rthdr_reverse +return 0 on success, and returns -1 on error. +.Pp +.Fn inet6_rthdr_init +and +.Fn inet6_rthdr_getaddr +return +.Dv NULL +on error. +.Pp +.Fn inet6_rthdr_segments +and +.Fn inet6_rthdr_getflags +return -1 on error. +.\" +.Sh EXAMPLES +RFC2292 gives comprehensive examples in chapter 8. +.\" +.Sh SEE ALSO +.Rs +.%A W. Stevens +.%A M. Thomas +.%T "Advanced Sockets API for IPv6" +.%N RFC2292 +.%D February 1998 +.Re +.Rs +.%A S. Deering +.%A R. Hinden +.%T "Internet Protocol, Version 6 (IPv6) Specification" +.%N RFC2460 +.%D December 1998 +.Re +.\" +.Sh HISTORY +The implementation first appeared in KAME advanced networking kit. +.\" +.Sh STANDARDS +The functions +are documented in +.Dq Advanced Sockets API for IPv6 +.Pq RFC2292 . +.\" +.Sh BUGS +The text was shamelessly copied from RFC2292. +.Pp +.Fn inet6_rthdr_reverse +is not implemented yet. diff --git a/packages/net/common/current/doc/manpages/net/inet_net.3 b/packages/net/common/current/doc/manpages/net/inet_net.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/inet_net.3 @@ -0,0 +1,148 @@ +.\" $OpenBSD: inet_net.3,v 1.6 2000/04/21 15:38:17 aaron Exp $ +.\" $NetBSD: inet_net.3,v 1.1 1997/06/18 02:25:27 lukem Exp $ +.\" +.\" Copyright (c) 1997 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Luke Mewburn. +.\" +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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. +.\" +.Dd June 18, 1997 +.Dt INET_NET 3 +.Os +.Sh NAME +.Nm inet_net_ntop , +.Nm inet_net_pton +.Nd Internet network number manipulation routines +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include +.Ft char * +.Fn inet_net_ntop "int af" "const void *src" "int bits" "char *dst" "size_t size" +.Ft int +.Fn inet_net_pton "int af" "const char *src" "void *dst" "size_t size" +.Sh DESCRIPTION +The +.Fn inet_net_ntop +function converts an Internet network number from network format (usually a +.Li struct in_addr +or some other binary form, in network byte order) to CIDR presentation format +(suitable for external display purposes). +.Fa bits +is the number of bits in +.Fa src +that are the network number. +It returns +.Dv NULL +if a system error occurs (in which case, +.Va errno +will have been set), or it returns a pointer to the destination string. +.Pp +The +.Fn inet_net_pton +function converts a presentation format Internet network number (that is, +printable form as held in a character string) to network format (usually a +.Li struct in_addr +or some other internal binary representation, in network byte order). +It returns the number of bits (either computed based on the class, or +specified with /CIDR), or \-1 if a failure occurred +(in which case +.Va errno +will have been set. +It will be set to +.Er ENOENT +if the Internet network number was not valid). +.Pp +The only value for +.Fa af +currently supported is +.Dv AF_INET . +.Fa size +is the size of the result buffer +.Fa dst . +.Sh NETWORK NUMBERS (IP VERSION 4) +Internet network numbers may be specified in one of the following forms: +.Bd -literal -offset indent +a.b.c.d/bits +a.b.c.d +a.b.c +a.b +a +.Ed +.Pp +When four parts are specified, each is interpreted +as a byte of data and assigned, from left to right, +to the four bytes of an Internet network number. +Note that when an Internet network number is viewed as a 32-bit +integer quantity on a system that uses little-endian +byte order (such as the Intel 386, 486, and Pentium processors) +the bytes referred to above appear as +.Dq Li d.c.b.a . +That is, little-endian bytes are ordered from right to left. +.Pp +When a three part number is specified, the last +part is interpreted as a 16-bit quantity and placed +in the rightmost two bytes of the Internet network number. +This makes the three part number format convenient +for specifying Class B network numbers as +.Dq Li 128.net.host . +.Pp +When a two part number is supplied, the last part +is interpreted as a 24-bit quantity and placed in +the rightmost three bytes of the Internet network number. +This makes the two part number format convenient +for specifying Class A network numbers as +.Dq Li net.host . +.Pp +When only one part is given, the value is stored +directly in the Internet network number without any byte +rearrangement. +.Pp +All numbers supplied as +.Dq parts +in a +.Ql \&. +notation +may be decimal, octal, or hexadecimal, as specified +in the C language (i.e., a leading 0x or 0X implies +hexadecimal; otherwise, a leading 0 implies octal; +otherwise, the number is interpreted as decimal). +.Sh SEE ALSO +.Xr byteorder 3 , +.Xr inet 3 , +.Xr networks 5 +.Sh HISTORY +The +.Nm inet_net_ntop +and +.Nm inet_net_pton +functions first appeared in BIND 4.9.4. diff --git a/packages/net/common/current/doc/manpages/net/ipx.3 b/packages/net/common/current/doc/manpages/net/ipx.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/ipx.3 @@ -0,0 +1,127 @@ +.\" $OpenBSD: ipx.3,v 1.8 2001/08/02 20:37:35 hugh Exp $ +.\" +.\" Copyright (c) 1986, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd June 4, 1993 +.Dt IPX 3 +.Os +.Sh NAME +.Nm ipx_addr , +.Nm ipx_ntoa +.Nd IPX address conversion routines +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft struct ipx_addr +.Fn ipx_addr "const char *cp" +.Ft char * +.Fn ipx_ntoa "struct ipx_addr ipx" +.Sh DESCRIPTION +The routine +.Fn ipx_addr +interprets character strings representing +.Tn IPX +addresses, returning binary information suitable +for use in system calls. +The routine +.Fn ipx_ntoa +takes +.Tn IPX +addresses and returns +.Tn ASCII +strings representing the address in a +notation in common use: +.Bd -filled -offset indent +.. +.Ed +.Pp +Trailing zero fields are suppressed, and each number is printed in hexadecimal, +in a format suitable for input to +.Fn ipx_addr . +Any fields lacking super-decimal digits will have a +trailing +.Sq H +appended. +.Pp +An effort has been made to ensure that +.Fn ipx_addr +be compatible with most formats in common use. +It will first separate an address into 1 to 3 fields using a single delimiter +chosen from +period +.Pq Ql \&. , +colon +.Pq Ql \&: , +or pound-sign +.Pq Ql # . +Each field is then examined for byte separators (colon or period). +If there are byte separators, each subfield separated is taken to be +a small hexadecimal number, and the entirety is taken as a network-byte-ordered +quantity to be zero extended in the high-network-order bytes. +Next, the field is inspected for hyphens, in which case +the field is assumed to be a number in decimal notation +with hyphens separating the millenia. +Next, the field is assumed to be a number: +It is interpreted +as hexadecimal if there is a leading +.Ql 0x +(as in C), +a trailing +.Sq H +(as in Mesa), or there are any super-decimal digits present. +It is interpreted as octal is there is a leading +.Ql 0 +and there are no super-octal digits. +Otherwise, it is converted as a decimal number. +.Sh RETURN VALUES +None. +(See +.Sx BUGS . ) +.Sh SEE ALSO +.Xr ns 4 , +.Xr hosts 5 , +.Xr networks 5 +.Sh HISTORY +The precursor +.Fn ns_addr +and +.Fn ns_ntoa +functions appeared in +.Bx 4.3 . +.Sh BUGS +The string returned by +.Fn ipx_ntoa +resides in a static memory area. +The function +.Fn ipx_addr +should diagnose improperly formed input, and there should be an unambiguous +way to recognize this. diff --git a/packages/net/common/current/doc/manpages/net/iso_addr.3 b/packages/net/common/current/doc/manpages/net/iso_addr.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/iso_addr.3 @@ -0,0 +1,111 @@ +.\" $OpenBSD: iso_addr.3,v 1.4 1999/07/05 06:08:05 aaron Exp $ +.\" +.\" Copyright (c) 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd June 4, 1993 +.Dt ISO_ADDR 3 +.Os +.Sh NAME +.Nm iso_addr , +.Nm iso_ntoa +.Nd "network address conversion routines for Open System Interconnection" +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft struct iso_addr * +.Fn iso_addr "char *cp" +.Ft char * +.Fn iso_ntoa "struct iso_addr *isoa" +.Sh DESCRIPTION +The routine +.Fn iso_addr +interprets character strings representing +.Tn OSI +addresses, returning binary information suitable +for use in system calls. +The routine +.Fn iso_ntoa +takes +.Tn OSI +addresses and returns +.Tn ASCII +strings representing NSAPs (network service +access points) in a +notation inverse to that accepted by +.Fn iso_addr . +.Pp +Unfortunately, no universal standard exists for representing +.Tn OSI +network addresses. +.Pp +The format employed by +.Fn iso_addr +is a sequence of hexadecimal +.Dq digits +(optionally separated by periods), +of the form: +.Bd -filled -offset indent +.. +.Ed +.Pp +Each pair of hexadecimal digits represents a byte +with the leading digit indicating the higher-ordered bits. +A period following an even number of bytes has no +effect (but may be used to increase legibility). +A period following an odd number of bytes has the +effect of causing the byte of address being translated +to have its higher order bits filled with zeros. +.Sh RETURN VALUES +.Fn iso_ntoa +always returns a null terminated string. +.Fn iso_addr +always returns a pointer to a +.Li struct iso_addr . +(See +.Sx BUGS . ) +.Sh SEE ALSO +.Xr iso 4 +.Sh HISTORY +The +.Fn iso_addr +and +.Fn iso_ntoa +functions appeared in +.Bx 4.3 Reno . +.Sh BUGS +The returned values +reside in a static memory area. +.Pp +The function +.Fn iso_addr +should diagnose improperly formed input, and there should be an unambiguous +way to recognize this. diff --git a/packages/net/common/current/doc/manpages/net/link_addr.3 b/packages/net/common/current/doc/manpages/net/link_addr.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/link_addr.3 @@ -0,0 +1,131 @@ +.\" $OpenBSD: link_addr.3,v 1.7 2000/04/18 03:01:32 aaron Exp $ +.\" +.\" Copyright (c) 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" Donn Seeley at BSDI. +.\" +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd July 28, 1993 +.Dt LINK_ADDR 3 +.Os +.Sh NAME +.Nm link_addr , +.Nm link_ntoa +.Nd elementary address specification routines for link level access +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include +.Ft void +.Fn link_addr "const char *addr" "struct sockaddr_dl *sdl" +.Ft char * +.Fn link_ntoa "const struct sockaddr_dl *sdl" +.Sh DESCRIPTION +The +.Fn link_addr +function interprets character strings representing +link-level addresses, returning binary information suitable +for use in system calls. +.Fn link_ntoa +takes +a link-level +address and returns an +.Tn ASCII +string representing some of the information present, +including the link level address itself, and the interface name +or number, if present. +This facility is experimental and is +still subject to change. +.Pp +For +.Fn link_addr , +the string +.Fa addr +may contain +an optional network interface identifier of the form +.Dq name unit-number , +suitable for the first argument to +.Xr ifconfig 8 , +followed in all cases by a colon and +an interface address in the form of +groups of hexadecimal digits +separated by periods. +Each group represents a byte of address; +address bytes are filled left to right from +low order bytes through high order bytes. +.Pp +.\" A regular expression may make this format clearer: +.\" .Bd -literal -offset indent +.\" ([a-z]+[0-9]+:)?[0-9a-f]+(\e.[0-9a-f]+)* +.\" .Ed +.\" .Pp +Thus +.Li le0:8.0.9.13.d.30 +represents an Ethernet address +to be transmitted on the first Lance Ethernet interface. +.Sh RETURN VALUES +.Fn link_ntoa +always returns a null-terminated string. +.Fn link_addr +has no return value. +(See +.Sx BUGS . ) +.Sh SEE ALSO +.Xr iso 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Fn link_addr +and +.Fn link_ntoa +functions appeared in +.Bx 4.3 Reno . +.Sh BUGS +The returned values for link_ntoa +reside in a static memory area. +.Pp +The function +.Fn link_addr +should diagnose improperly formed input, and there should be an unambiguous +way to recognize this. +.Pp +If the +.Fa sdl_len +field of the link socket address +.Fa sdl +is 0, +.Fn link_ntoa +will not insert a colon before the interface address bytes. +If this translated address is given to +.Fn link_addr +without inserting an initial colon, +the latter will not interpret it correctly. diff --git a/packages/net/common/current/doc/manpages/net/net_addrcmp.3 b/packages/net/common/current/doc/manpages/net/net_addrcmp.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/net_addrcmp.3 @@ -0,0 +1,91 @@ +.\" $OpenBSD: net_addrcmp.3,v 1.3 2001/08/07 06:53:27 deraadt Exp $ +.\" +.\" Copyright (c) 1999 Theo de Raadt +.\" +.\" 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. +.\" +.Dd July 3, 1999 +.Dt NET_ADDRCMP 3 +.Os +.Sh NAME +.Nm net_addrcmp +.Nd compare socket address structures +.Sh SYNOPSIS +.Fd #include +.Ft int +.Fn net_addrcmp "struct sockaddr *sa1" "struct sockaddr *sa2" +.Sh DESCRIPTION +The +.Fn net_addrcmp +function compares two socket address structures, +.Fa sa1 +and +.Fa sa2 . +.Sh RETURN VALUES +If +.Fa sa1 +and +.Fa sa2 +are for the same address, +.Fn net_addrcmp +returns 0. +.Pp +The +.Fa sa_len +fields are compared first. +If they do not match, +.Fn net_addrcmp +returns \-1 or 1 if +.Li sa1->sa_len +is less than or greater than +.Li sa2->sa_len , +respectively. +.Pp +Next, the +.Fa sa_family +members are compared. +If they do not match, +.Fn net_addrcmp +returns \-1 or 1 if +.Li sa1->sa_family +is less than or greater than +.Li sa2->sa_family , +respectively. +.Pp +Lastly, if each socket address structure's +.Fa sa_len +and +.Fa sa_family +fields match, +the protocol-specific data (the +.Fa sa_data +field) is compared. +If there's a match, both +.Fa sa1 +and +.Fa sa2 +must refer to the same address, and 0 is returned; otherwise, a value >0 +or <0 is returned. +.Sh HISTORY +A +.Fn net_addrcmp +function was added in +.Ox 2.5 . diff --git a/packages/net/common/current/doc/manpages/net/ns.3 b/packages/net/common/current/doc/manpages/net/ns.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/ns.3 @@ -0,0 +1,131 @@ +.\" $OpenBSD: ns.3,v 1.7 2001/08/02 20:37:35 hugh Exp $ +.\" +.\" Copyright (c) 1986, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd June 4, 1993 +.Dt NS 3 +.Os +.Sh NAME +.Nm ns_addr , +.Nm ns_ntoa +.Nd Xerox +.Tn NS Ns (tm) +address conversion routines +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft struct ns_addr +.Fn ns_addr "char *cp" +.Ft char * +.Fn ns_ntoa "struct ns_addr ns" +.Sh DESCRIPTION +The routine +.Fn ns_addr +interprets character strings representing +.Tn XNS +addresses, returning binary information suitable +for use in system calls. +The routine +.Fn ns_ntoa +takes +.Tn XNS +addresses and returns +.Tn ASCII +strings representing the address in a +notation in common use in the Xerox Development Environment: +.Bd -filled -offset indent +.. +.Ed +.Pp +Trailing zero fields are suppressed, and each number is printed in hexadecimal, +in a format suitable for input to +.Fn ns_addr . +Any fields lacking super-decimal digits will have a +trailing +.Sq H +appended. +.Pp +Unfortunately, no universal standard exists for representing +.Tn XNS +addresses. +An effort has been made to ensure that +.Fn ns_addr +be compatible with most formats in common use. +It will first separate an address into 1 to 3 fields using a single delimiter +chosen from +period +.Pq Ql \&. , +colon +.Pq Ql \&: , +or pound-sign +.Ql # . +Each field is then examined for byte separators (colon or period). +If there are byte separators, each subfield separated is taken to be +a small hexadecimal number, and the entirety is taken as a network-byte-ordered +quantity to be zero extended in the high-network-order bytes. +Next, the field is inspected for hyphens, in which case +the field is assumed to be a number in decimal notation +with hyphens separating the millenia. +Next, the field is assumed to be a number: +It is interpreted +as hexadecimal if there is a leading +.Ql 0x +(as in C), +a trailing +.Sq H +(as in Mesa), or there are any super-decimal digits present. +It is interpreted as octal is there is a leading +.Ql 0 +and there are no super-octal digits. +Otherwise, it is converted as a decimal number. +.Sh RETURN VALUES +None. +(See +.Sx BUGS . ) +.Sh SEE ALSO +.Xr hosts 5 , +.Xr networks 5 +.Sh HISTORY +The +.Fn ns_addr +and +.Fn ns_toa +functions appeared in +.Bx 4.3 . +.Sh BUGS +The string returned by +.Fn ns_ntoa +resides in a static memory area. +The function +.Fn ns_addr +should diagnose improperly formed input, and there should be an unambiguous +way to recognize this. diff --git a/packages/net/common/current/doc/manpages/net/resolver.3 b/packages/net/common/current/doc/manpages/net/resolver.3 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/net/resolver.3 @@ -0,0 +1,345 @@ +.\" $OpenBSD: resolver.3,v 1.15 2001/04/03 20:09:08 aaron Exp $ +.\" +.\" Copyright (c) 1985, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.Dd June 4, 1993 +.Dt RESOLVER 3 +.Os +.Sh NAME +.Nm res_query , +.Nm res_search , +.Nm res_mkquery , +.Nm res_send , +.Nm res_init , +.Nm dn_comp , +.Nm dn_expand +.Nd resolver routines +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include +.Fd #include +.Ft int +.Fo res_query +.Fa "char *dname" +.Fa "int class" +.Fa "int type" +.Fa "u_char *answer" +.Fa "int anslen" +.Fc +.Ft int +.Fo res_search +.Fa "char *dname" +.Fa "int class" +.Fa "int type" +.Fa "u_char *answer" +.Fa "int anslen" +.Fc +.Ft int +.Fo res_mkquery +.Fa "int op" +.Fa "char *dname" +.Fa "int class" +.Fa "int type" +.Fa "char *data" +.Fa "int datalen" +.Fa "struct rrec *newrr" +.Fa "char *buf" +.Fa "int buflen" +.Fc +.Ft int +.Fo res_send +.Fa "char *msg" +.Fa "int msglen" +.Fa "char *answer" +.Fa "int anslen" +.Fc +.Ft int +.Fn res_init "void" +.Ft int +.Fo dn_comp +.Fa "char *exp_dn" +.Fa "char *comp_dn" +.Fa "int length" +.Fa "char **dnptrs" +.Fa "char **lastdnptr" +.Fc +.Ft int +.Fo dn_expand +.Fa "u_char *msg" +.Fa "u_char *eomorig" +.Fa "u_char *comp_dn" +.Fa "u_char *exp_dn" +.Fa "int length" +.Fc +.Sh DESCRIPTION +These routines are used for making, sending, and interpreting +query and reply messages with Internet domain name servers. +.Pp +Global configuration and state information that is used by the +resolver routines is kept in the structure +.Li _res . +Most of the values have reasonable defaults and can be ignored. +Options stored in +.Li _res.options +are defined in +.Aq Pa resolv.h +and are as follows. +Options are stored as a simple bit mask containing the bitwise +.Tn OR +of the options enabled. +.Bl -tag -width RES_USE_INET6 +.It Dv RES_INIT +True if the initial name server address and default domain name are +initialized (i.e., +.Fn res_init +has been called). +.It Dv RES_DEBUG +Print debugging messages. +.It Dv RES_AAONLY +Accept authoritative answers only. +With this option, +.Fn res_send +should continue until it finds an authoritative answer or finds an error. +Currently this is not implemented. +.It Dv RES_USEVC +Use +.Tn TCP +connections for queries instead of +.Tn UDP +datagrams. +.It Dv RES_STAYOPEN +Used with +.Dv RES_USEVC +to keep the +.Tn TCP +connection open between queries. +This is useful only in programs that regularly do many queries. +.Tn UDP +should be the normal mode used. +.It Dv RES_IGNTC +Unused currently (ignore truncation errors, i.e., don't retry with +.Tn TCP ) . +.It Dv RES_RECURSE +Set the recursion-desired bit in queries. +This is the default. +.Pf ( Fn res_send +does not do iterative queries and expects the name server +to handle recursion.) +.It Dv RES_DEFNAMES +If set, +.Fn res_search +will append the default domain name to single-component names +(those that do not contain a dot). +This option is enabled by default. +.It Dv RES_DNSRCH +If this option is set, +.Fn res_search +will search for host names in the current domain and in parent domains; see +.Xr hostname 7 . +This is used by the standard host lookup routine +.Xr gethostbyname 3 . +This option is enabled by default. +.It Dv RES_USE_INET6 +Enables support for IPv6-only applications. +This causes IPv4 addresses to be returned as an IPv4 mapped address. +For example, 10.1.1.1 will be returned as ::ffff:10.1.1.1. +The option is not meaningful on +.Ox . +.El +.Pp +The +.Fn res_init +routine reads the configuration file (if any; see +.Xr resolv.conf 5 ) +to get the default domain name, search list, and the Internet address +of the local name server(s). +If no server is configured, the host running +the resolver is tried. +The current domain name is defined by the hostname +if not specified in the configuration file; +it can be overridden by the environment variable +.Ev LOCALDOMAIN . +This environment variable may contain several blank-separated +tokens if you wish to override the +.Fa search list +on a per-process basis. +This is similar to the +.Fa search +command in the configuration file. +Another environment variable +.Ev RES_OPTIONS +can be set to override certain internal resolver options which +are otherwise set by changing fields in the +.Fa _res +structure or are inherited from the configuration file's +.Fa options +command. +The syntax of the +.Ev RES_OPTIONS +environment variable is explained in +.Xr resolv.conf 5 . +Initialization normally occurs on the first call +to one of the following routines. +.Pp +The +.Fn res_query +function provides an interface to the server query mechanism. +It constructs a query, sends it to the local server, +awaits a response, and makes preliminary checks on the reply. +The query requests information of the specified +.Fa type +and +.Fa class +for the specified fully qualified domain name +.Fa dname . +The reply message is left in the +.Fa answer +buffer with length +.Fa anslen +supplied by the caller. +.Pp +The +.Fn res_search +routine makes a query and awaits a response like +.Fn res_query , +but in addition, it implements the default and search rules controlled by the +.Dv RES_DEFNAMES +and +.Dv RES_DNSRCH +options. +It returns the first successful reply. +.Pp +The remaining routines are lower-level routines used by +.Fn res_query . +The +.Fn res_mkquery +function constructs a standard query message and places it in +.Fa buf . +It returns the size of the query, or \-1 if the query is larger than +.Fa buflen . +The query type +.Fa op +is usually +.Dv QUERY , +but can be any of the query types defined in +.Aq Pa arpa/nameser.h . +The domain name for the query is given by +.Fa dname . +.Fa newrr +is currently unused but is intended for making update messages. +.Pp +The +.Fn res_send +routine sends a pre-formatted query and returns an answer. +It will call +.Fn res_init +if +.Dv RES_INIT +is not set, send the query to the local name server, and +handle timeouts and retries. +The length of the reply message is returned, or \-1 if there were errors. +.Pp +The +.Fn dn_comp +function compresses the domain name +.Fa exp_dn +and stores it in +.Fa comp_dn . +The size of the compressed name is returned or \-1 if there were errors. +The size of the array pointed to by +.Fa comp_dn +is given by +.Fa length . +The compression uses an array of pointers +.Fa dnptrs +to previously compressed names in the current message. +The first pointer points +to the beginning of the message and the list ends with +.Dv NULL . +The limit to the array is specified by +.Fa lastdnptr . +A side effect of +.Fn dn_comp +is to update the list of pointers for labels inserted into the message +as the name is compressed. +If +.Em dnptr +is +.Dv NULL , +names are not compressed. +If +.Fa lastdnptr +is +.Dv NULL , +the list of labels is not updated. +.Pp +The +.Fn dn_expand +entry expands the compressed domain name +.Fa comp_dn +to a full domain name +The compressed name is contained in a query or reply message; +.Fa msg +is a pointer to the beginning of the message. +The uncompressed name is placed in the buffer indicated by +.Fa exp_dn +which is of size +.Fa length . +The size of compressed name is returned or \-1 if there was an error. +.Sh FILES +.Bl -tag -width Pa +/etc/resolv.conf +configuration file +see +.Xr resolv.conf 5 . +.El +.Sh SEE ALSO +.Xr gethostbyname 3 , +.Xr resolv.conf 5 , +.Xr hostname 7 , +.Xr named 8 +.Pp +.%T RFC1032 , +.%T RFC1033 , +.%T RFC1034 , +.%T RFC1035 , +.%T RFC1535 , +.%T RFC974 +.Rs +.%T "Name Server Operations Guide for BIND" +.Re +.Sh HISTORY +The +.Nm +function appeared in +.Bx 4.3 . diff --git a/packages/net/common/current/doc/manpages/sys/accept.2 b/packages/net/common/current/doc/manpages/sys/accept.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/accept.2 @@ -0,0 +1,173 @@ +.\" $OpenBSD: accept.2,v 1.12 2001/03/11 05:02:29 aaron Exp $ +.\" $NetBSD: accept.2,v 1.7 1996/01/31 20:14:42 mycroft Exp $ +.\" +.\" Copyright (c) 1983, 1990, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)accept.2 8.2 (Berkeley) 12/11/93 +.\" +.Dd February 15, 1999 +.Dt ACCEPT 2 +.Os +.Sh NAME +.Nm accept +.Nd accept a connection on a socket +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn accept "int s" "struct sockaddr *addr" "socklen_t *addrlen" +.Sh DESCRIPTION +The argument +.Fa s +is a socket that has been created with +.Xr socket 2 , +bound to an address with +.Xr bind 2 , +and is listening for connections after a +.Xr listen 2 . +The +.Fn accept +argument extracts the first connection request on the queue of pending +connections, creates a new socket with the same properties of +.Fa s , +and allocates a new file descriptor for the socket. +If no pending connections are present on the queue, +and the socket is not marked as non-blocking, +.Fn accept +blocks the caller until a connection is present. +If the socket is marked non-blocking and no pending +connections are present on the queue, +.Fn accept +returns an error as described below. +The accepted socket may not be used to accept more connections. +The original socket +.Fa s +remains open. +.Pp +The argument +.Fa addr +is a result parameter that is filled in with the address of the connecting +entity as known to the communications layer. +The exact format of the +.Fa addr +parameter is determined by the domain in which the communication +is occurring. +The +.Fa addrlen +is a value-result parameter; it should initially contain the +amount of space pointed to by +.Fa addr ; +on return it will contain the actual length (in bytes) of the +address returned. +This call is used with connection-based socket types, currently with +.Dv SOCK_STREAM . +.Pp +It is possible to +.Xr select 2 +or +.Xr poll 2 +a socket for the purposes of doing an +.Fn accept +by selecting it for read. +.Pp +For certain protocols which require an explicit confirmation, such as +.Tn ISO +or +.Tn DATAKIT , +.Fn accept +can be thought of as merely dequeuing the next connection +request and not implying confirmation. +Confirmation can be implied by a normal read or write on the new file +descriptor, and rejection can be implied by closing the new socket. +.Pp +One can obtain user connection request data without confirming +the connection by issuing a +.Xr recvmsg 2 +call with an +.Fa msg_iovlen +of 0 and a non-zero +.Fa msg_controllen , +or by issuing a +.Xr getsockopt 2 +request. +Similarly, one can provide user connection rejection information +by issuing a +.Xr sendmsg 2 +call with providing only the control information, or by calling +.Xr setsockopt 2 . +.Sh RETURN VALUES +The call returns \-1 on error. +If it succeeds, it returns a non-negative integer that is a descriptor +for the accepted socket. +.Sh ERRORS +The +.Fn accept +will fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The descriptor is invalid. +.It Bq Er ENOTSOCK +The descriptor references a file, not a socket. +.It Bq Er EOPNOTSUPP +The referenced socket is not of type +.Dv SOCK_STREAM . +.It Bq Er EINVAL +The referenced socket is not listening for connections (that is, +.Xr listen 2 +has not yet been called). +.It Bq Er EFAULT +The +.Fa addr +parameter is not in a writable part of the user address space. +.It Bq Er EWOULDBLOCK +The socket is marked non-blocking and no connections +are present to be accepted. +.It Bq Er EMFILE +The per-process descriptor table is full. +.It Bq Er ENFILE +The system file table is full. +.It Bq Er ECONNABORTED +A connection has been aborted. +.El +.Sh SEE ALSO +.Xr bind 2 , +.Xr connect 2 , +.Xr listen 2 , +.Xr poll 2 , +.Xr select 2 , +.Xr poll 2 , +.Xr socket 2 +.Sh HISTORY +The +.Fn accept +function appeared in +.Bx 4.2 . diff --git a/packages/net/common/current/doc/manpages/sys/bind.2 b/packages/net/common/current/doc/manpages/sys/bind.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/bind.2 @@ -0,0 +1,131 @@ +.\" $OpenBSD: bind.2,v 1.10 2000/10/18 05:12:08 aaron Exp $ +.\" $NetBSD: bind.2,v 1.8 1995/10/12 15:40:46 jtc Exp $ +.\" +.\" Copyright (c) 1983, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)bind.2 8.1 (Berkeley) 6/4/93 +.\" +.Dd February 15, 1999 +.Dt BIND 2 +.Os +.Sh NAME +.Nm bind +.Nd bind a name to a socket +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn bind "int s" "const struct sockaddr *name" "socklen_t namelen" +.Sh DESCRIPTION +.Fn bind +assigns a name to an unnamed socket. +When a socket is created with +.Xr socket 2 +it exists in a name space (address family) but has no name assigned. +.Fn bind +requests that +.Fa name +be assigned to the socket. +.Sh NOTES +Binding a name in the UNIX domain creates a socket in the file +system that must be deleted by the caller when it is no longer +needed (using +.Xr unlink 2 ) . +.Pp +The rules used in name binding vary between communication domains. +Consult the manual entries in section 4 for detailed information. +.Sh RETURN VALUES +If the bind is successful, a 0 value is returned. +A return value of \-1 indicates an error, which is +further specified in the global +.Va errno . +.Sh ERRORS +The +.Fn bind +call will fail if: +.Bl -tag -width Er +.It Bq Er EBADF +.Fa S +is not a valid descriptor. +.It Bq Er ENOTSOCK +.Fa S +is not a socket. +.It Bq Er EADDRNOTAVAIL +The specified address is not available from the local machine. +.It Bq Er EADDRINUSE +The specified address is already in use. +.It Bq Er EINVAL +The socket is already bound to an address. +.It Bq Er EINVAL +The family of the socket and that requested in +.Va name->sa_family +are not equivalent. +.It Bq Er EACCES +The requested address is protected, and the current user +has inadequate permission to access it. +.It Bq Er EFAULT +The +.Fa name +parameter is not in a valid part of the user address space. +.El +.Pp +The following errors are specific to binding names in the UNIX domain. +.Bl -tag -width Er +.It Bq Er ENOTDIR +A component of the path prefix is not a directory. +.It Bq Er ENAMETOOLONG +A component of a pathname exceeded +.Dv {NAME_MAX} +characters, or an entire path name exceeded +.Dv {PATH_MAX} +characters. +.It Bq Er ENOENT +A prefix component of the path name does not exist. +.It Bq Er ELOOP +Too many symbolic links were encountered in translating the pathname. +.It Bq Er EIO +An I/O error occurred while making the directory entry or allocating the inode. +.It Bq Er EROFS +The name would reside on a read-only file system. +.It Bq Er EISDIR +An empty pathname was specified. +.El +.Sh SEE ALSO +.Xr connect 2 , +.Xr getsockname 2 , +.Xr listen 2 , +.Xr socket 2 +.Sh HISTORY +The +.Fn bind +function call appeared in +.Bx 4.2 . diff --git a/packages/net/common/current/doc/manpages/sys/connect.2 b/packages/net/common/current/doc/manpages/sys/connect.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/connect.2 @@ -0,0 +1,165 @@ +.\" $OpenBSD: connect.2,v 1.14 1999/08/15 13:14:11 deraadt Exp $ +.\" $NetBSD: connect.2,v 1.8 1995/10/12 15:40:48 jtc Exp $ +.\" +.\" Copyright (c) 1983, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)connect.2 8.1 (Berkeley) 6/4/93 +.\" +.Dd February 15, 1999 +.Dt CONNECT 2 +.Os +.Sh NAME +.Nm connect +.Nd initiate a connection on a socket +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn connect "int s" "const struct sockaddr *name" "socklen_t namelen" +.Sh DESCRIPTION +The parameter +.Fa s +is a socket. +If it is of type +.Dv SOCK_DGRAM , +this call specifies the peer with which the socket is to be associated; +this address is that to which datagrams are to be sent, +and the only address from which datagrams are to be received. +If the socket is of type +.Dv SOCK_STREAM , +this call attempts to make a connection to +another socket. +The other socket is specified by +.Fa name , +which is an address in the communications space of the socket. +Each communications space interprets the +.Fa name +parameter in its own way. +Generally, stream sockets may successfully +.Fn connect +only once; datagram sockets may use +.Fn connect +multiple times to change their association. +Datagram sockets may dissolve the association +by connecting to an invalid address, such as a null address. +.Sh RETURN VALUES +If the connection or binding succeeds, 0 is returned. +Otherwise a \-1 is returned, and a more specific error +code is stored in +.Va errno . +.Sh ERRORS +The +.Fn connect +call fails if: +.Bl -tag -width Er +.It Bq Er EBADF +.Fa S +is not a valid descriptor. +.It Bq Er ENOTSOCK +.Fa S +is a descriptor for a file, not a socket. +.It Bq Er EADDRNOTAVAIL +The specified address is not available on this machine. +.It Bq Er EAFNOSUPPORT +Addresses in the specified address family cannot be used with this socket. +.It Bq Er EISCONN +The socket is already connected. +.It Bq Er ETIMEDOUT +Connection establishment timed out without establishing a connection. +.It Bq Er EINVAL +A TCP connection with a local broadcast, the all-ones or a +multicast address as the peer was attempted. +.It Bq Er ECONNREFUSED +The attempt to connect was forcefully rejected. +.It Bq Er EINTR +A connect was interrupted before it succeeded +by the delivery of a signal. +.It Bq Er ENETUNREACH +The network isn't reachable from this host. +.It Bq Er EADDRINUSE +The address is already in use. +.It Bq Er EFAULT +The +.Fa name +parameter specifies an area outside +the process address space. +.It Bq Er EINPROGRESS +The socket is non-blocking +and the connection cannot +be completed immediately. +It is possible to +.Xr select 2 +or +.Xr poll 2 +for completion by selecting the socket for writing, and also use +.Xr getsockopt 2 +with +.Dv SO_ERROR +to check for error conditions. +.It Bq Er EALREADY +The socket is non-blocking +and a previous connection attempt +has not yet been completed. +.El +.Pp +The following errors are specific to connecting names in the UNIX domain. +These errors may not apply in future versions of the UNIX IPC domain. +.Bl -tag -width Er +.It Bq Er ENOTDIR +A component of the path prefix is not a directory. +.It Bq Er ENAMETOOLONG +A component of a pathname exceeded +.Dv {NAME_MAX} +characters, or an entire path name exceeded +.Dv {PATH_MAX} +characters. +.It Bq Er ENOENT +The named socket does not exist. +.It Bq Er EACCES +Search permission is denied for a component of the path prefix. +.It Bq Er EACCES +Write access to the named socket is denied. +.It Bq Er ELOOP +Too many symbolic links were encountered in translating the pathname. +.El +.Sh SEE ALSO +.Xr accept 2 , +.Xr getsockname 2 , +.Xr getsockopt 2 , +.Xr poll 2 , +.Xr select 2 , +.Xr socket 2 +.Sh HISTORY +The +.Fn connect +function call appeared in +.Bx 4.2 . diff --git a/packages/net/common/current/doc/manpages/sys/getpeername.2 b/packages/net/common/current/doc/manpages/sys/getpeername.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/getpeername.2 @@ -0,0 +1,141 @@ +.\" $OpenBSD: getpeername.2,v 1.16 2001/06/26 19:56:52 dugsong Exp $ +.\" $NetBSD: getpeername.2,v 1.6 1995/10/12 15:40:56 jtc Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)getpeername.2 8.1 (Berkeley) 6/4/93 +.\" +.Dd July 17, 1999 +.Dt GETPEERNAME 2 +.Os +.Sh NAME +.Nm getpeername +.Nd get name of connected peer +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn getpeername "int s" "struct sockaddr *name" "socklen_t *namelen" +.Sh DESCRIPTION +.Fn getpeername +returns the address information of the peer connected to socket +.Fa s . +One common use occurs when a process inherits an open socket, such as +TCP servers forked from +.Xr inetd 8 . +In this scenario, +.Fn getpeername +is used to determine the connecting client's IP address. +.Pp +.Fn getpeername +takes three parameters: +.Pp +.Fa s +Contains the file descriptor of the socket whose peer should be looked up. +.Pp +.Fa name +Points to a +.Li sockaddr +structure that will hold the address information for the connected peer. +Normal use requires one to use a structure +specific to the protocol family in use, such as +.Li sockaddr_in +(IPv4) or +.Li sockaddr_in6 +(IPv6), cast to a (struct sockaddr *). +.Pp +For greater portability, especially with the newer protocol families, the new +.Li struct sockaddr_storage +should be used. +.Li sockaddr_storage +is large enough to hold any of the other sockaddr_* variants. +On return, it can be cast to the correct sockaddr type, +based the protocol family contained in its ss_family field. +.Pp +.Fa namelen +Indicates the amount of space pointed to by +.Fa name , +in bytes. +.Pp +If address information for the local end of the socket is required, the +.Xr getsockname 2 +function should be used instead. +.Pp +If +.Fa name +does not point to enough space to hold the entire socket address, the +result will be truncated to +.Fa namelen +bytes. +.Sh RETURN VALUES +If the call succeeds, a 0 is returned and +.Fa namelen +is set to the actual size of the socket address returned in +.Fa name . +Otherwise, +.Va errno +is set and a value of \-1 is returned. +.Sh ERRORS +On failure, +.Va errno +is set to one of the following: +.Bl -tag -width Er +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is a file, not a socket. +.It Bq Er ENOTCONN +The socket is not connected. +.It Bq Er ENOBUFS +Insufficient resources were available in the system +to perform the operation. +.It Bq Er EFAULT +The +.Fa name +parameter points to memory not in a valid part of the +process address space. +.El +.Sh SEE ALSO +.Xr accept 2 , +.Xr bind 2 , +.Xr getsockname 2 , +.Xr getpeereid 2 , +.Xr socket 2 +.Sh HISTORY +The +.Fn getpeername +function call appeared in +.Bx 4.2 . diff --git a/packages/net/common/current/doc/manpages/sys/getsockname.2 b/packages/net/common/current/doc/manpages/sys/getsockname.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/getsockname.2 @@ -0,0 +1,164 @@ +.\" $OpenBSD: getsockname.2,v 1.16 2001/08/06 10:42:26 mpech Exp $ +.\" $NetBSD: getsockname.2,v 1.6 1995/10/12 15:41:00 jtc Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)getsockname.2 8.1 (Berkeley) 6/4/93 +.\" +.Dd July 17, 1999 +.Dt GETSOCKNAME 2 +.Os +.Sh NAME +.Nm getsockname +.Nd get socket name +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn getsockname "int s" "struct sockaddr *name" "socklen_t *namelen" +.Sh DESCRIPTION +.Fn getsockname +returns the locally bound address information for a specified socket. +.Pp +Common uses of this function are as follows: +.Bl -bullet +.It +When +.Xr bind 2 +is called with a port number of 0 (indicating the kernel should pick +an ephemeral port) +.Fn getsockname +is used to retrieve the kernel-assigned port number. +.It +When a process calls +.Xr bind 2 +on a wildcard IP address, +.Fn getsockname +is used to retrieve the local IP address for the connection. +.It +When a function wishes to know the address family of a socket, +.Fn getsockname +can be used. +.El +.Pp +.Fn getsockname +takes three parameters: +.Pp +.Fa s , +Contains the file desriptor for the socket to be looked up. +.Pp +.Fa name +points to a +.Li sockaddr +structure which will hold the resulting address information. +Normal use requires one to use a structure +specific to the protocol family in use, such as +.Li sockaddr_in +(IPv4) or +.Li sockaddr_in6 +(IPv6), cast to a (struct sockaddr *). +.Pp +For greater portability (such as newer protocol families) the new +structure sockaddr_storage exists. +.Li sockaddr_storage +is large enough to hold any of the other sockaddr_* variants. +On return, it should be cast to the correct sockaddr type, +according to the current protocol family. +.Pp +.Fa namelen +Indicates the amount of space pointed to by +.Fa name , +in bytes. +Upon return, +.Fa namelen +is set to the actual size of the returned address information. +.Pp +If the address of the destination socket for a given socket connection is +needed, the +.Xr getpeername 2 +function should be used instead. +.Pp +If +.Fa name +does not point to enough space to hold the entire socket address, the +result will be truncated to +.Fa namelen +bytes. +.Sh RETURN VALUES +On success, +.Fn getsockname +returns a 0, and +.Fa namelen +is set to the actual size of the socket address returned in +.Fa name . +Otherwise, +.Va errno +is set, and a value of \-1 is returned. +.Sh ERRORS +If +.Fn getsockname +fails, +.Va errno +is set to one of the following: +.Bl -tag -width Er +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is a file, not a socket. +.It Bq Er ENOBUFS +Insufficient resources were available in the system +to perform the operation. +.It Bq Er EFAULT +The +.Fa name +parameter points to memory not in a valid part of the +process address space. +.El +.Sh SEE ALSO +.Xr accept 2 , +.Xr bind 2 , +.Xr getpeername 2 , +.Xr getpeereid 2 , +.Xr socket 2 +.Sh BUGS +Names bound to sockets in the UNIX domain are inaccessible; +.Nm getsockname +returns a zero length name. +.Sh HISTORY +The +.Fn getsockname +function call appeared in +.Bx 4.2 . diff --git a/packages/net/common/current/doc/manpages/sys/getsockopt.2 b/packages/net/common/current/doc/manpages/sys/getsockopt.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/getsockopt.2 @@ -0,0 +1,348 @@ +.\" $OpenBSD: getsockopt.2,v 1.16 2000/10/18 05:12:10 aaron Exp $ +.\" $NetBSD: getsockopt.2,v 1.7 1995/02/27 12:33:29 cgd Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)getsockopt.2 8.3 (Berkeley) 4/19/94 +.\" +.Dd February 15, 1999 +.Dt GETSOCKOPT 2 +.Os +.Sh NAME +.Nm getsockopt , +.Nm setsockopt +.Nd get and set options on sockets +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn getsockopt "int s" "int level" "int optname" "void *optval" "socklen_t *optlen" +.Ft int +.Fn setsockopt "int s" "int level" "int optname" "const void *optval" "socklen_t optlen" +.Sh DESCRIPTION +.Fn getsockopt +and +.Fn setsockopt +manipulate the +.Em options +associated with a socket. +Options may exist at multiple protocol levels; +they are always present at the uppermost +.Dq socket +level. +.Pp +When manipulating socket options the level at which the +option resides and the name of the option must be specified. +To manipulate options at the socket level, +.Fa level +is specified as +.Dv SOL_SOCKET . +To manipulate options at any other level the protocol number of the +appropriate protocol controlling the option is supplied. +For example, to indicate that an option is to be interpreted by the +.Tn TCP +protocol, +.Fa level +should be set to the protocol number of +.Tn TCP ; +see +.Xr getprotoent 3 . +.Pp +The parameters +.Fa optval +and +.Fa optlen +are used to access option values for +.Fn setsockopt . +For +.Fn getsockopt +they identify a buffer in which the value for the +requested option(s) are to be returned. +For +.Fn getsockopt , +.Fa optlen +is a value-result parameter, initially containing the +size of the buffer pointed to by +.Fa optval , +and modified on return to indicate the actual size of the value returned. +If no option value is to be supplied or returned, +.Fa optval +may be +.Dv NULL . +.Pp +.Fa optname +and any specified options are passed uninterpreted to the appropriate +protocol module for interpretation. +The include file +.Ao Pa sys/socket.h Ac +contains definitions for socket level options, described below. +Options at other protocol levels vary in format and name; +consult the appropriate entries in section 4 of the manual. +.Pp +Most socket-level options utilize an +.Li int +parameter for +.Fa optval . +For +.Fn setsockopt , +the parameter should be non-zero to enable a boolean option, +or zero if the option is to be disabled. +.Dv SO_LINGER +uses a +.Li struct linger +parameter, defined in +.Aq Pa sys/socket.h , +which specifies the desired state of the option and the +linger interval (see below). +.Dv SO_SNDTIMEO +and +.Dv SO_RCVTIMEO +use a +.Li struct timeval +parameter, defined in +.Aq Pa sys/time.h . +.Pp +The following options are recognized at the socket level. +Except as noted, each may be examined with +.Fn getsockopt +and set with +.Fn setsockopt . +.Bl -column SO_OOBINLINE -offset indent +.It Dv SO_DEBUG Ta "enables recording of debugging information" +.It Dv SO_REUSEADDR Ta "enables local address reuse" +.It Dv SO_REUSEPORT Ta "enables duplicate address and port bindings" +.It Dv SO_KEEPALIVE Ta "enables keep connections alive" +.It Dv SO_DONTROUTE Ta "enables routing bypass for outgoing messages" +.It Dv SO_LINGER Ta "linger on close if data present" +.It Dv SO_BROADCAST Ta "enables permission to transmit broadcast messages" +.It Dv SO_OOBINLINE Ta "enables reception of out-of-band data in band" +.It Dv SO_SNDBUF Ta "set buffer size for output" +.It Dv SO_RCVBUF Ta "set buffer size for input" +.It Dv SO_SNDLOWAT Ta "set minimum count for output" +.It Dv SO_RCVLOWAT Ta "set minimum count for input" +.It Dv SO_SNDTIMEO Ta "set timeout value for output" +.It Dv SO_RCVTIMEO Ta "set timeout value for input" +.It Dv SO_TYPE Ta "get the type of the socket (get only)" +.It Dv SO_ERROR Ta "get and clear error on the socket (get only)" +.El +.Pp +.Dv SO_DEBUG +enables debugging in the underlying protocol modules. +.Dv SO_REUSEADDR +indicates that the rules used in validating addresses supplied in a +.Xr bind 2 +call should allow reuse of local addresses. +.Dv SO_REUSEPORT +allows completely duplicate bindings by multiple processes if they all set +.Dv SO_REUSEPORT +before binding the port. +This option permits multiple instances of a program to each +receive UDP/IP multicast or broadcast datagrams destined for the bound port. +.Dv SO_KEEPALIVE +enables the periodic transmission of messages on a connected socket. +Should the connected party fail to respond to these messages, the connection +is considered broken and processes using the socket are notified via a +.Dv SIGPIPE +signal when attempting to send data. +.Dv SO_DONTROUTE +indicates that outgoing messages should +bypass the standard routing facilities. +Instead, messages are directed to the appropriate network interface +according to the network portion of the destination address. +.Pp +.Dv SO_LINGER +controls the action taken when unsent messages +are queued on socket and a +.Xr close 2 +is performed. +If the socket promises reliable delivery of data and +.Dv SO_LINGER +is set, the system will block the process on the +.Xr close 2 +attempt until it is able to transmit the data or until it decides it +is unable to deliver the information (a timeout period measured in seconds, +termed the linger interval, is specified in the +.Fn setsockopt +call when +.Dv SO_LINGER +is requested). +If +.Dv SO_LINGER +is disabled and a +.Xr close 2 +is issued, the system will process the close in a manner that allows +the process to continue as quickly as possible. +.Pp +The option +.Dv SO_BROADCAST +requests permission to send broadcast datagrams +on the socket. +Broadcast was a privileged operation in earlier versions of the system. +With protocols that support out-of-band data, the +.Dv SO_OOBINLINE +option requests that out-of-band data be placed in the normal data input +queue as received; it will then be accessible with +.Xr recv 2 +or +.Xr read 2 +calls without the +.Dv MSG_OOB +flag. +Some protocols always behave as if this option is set. +.Dv SO_SNDBUF +and +.Dv SO_RCVBUF +are options to adjust the normal +buffer sizes allocated for output and input buffers, respectively. +The buffer size may be increased for high-volume connections, +or may be decreased to limit the possible backlog of incoming data. +The system places an absolute limit on these values. +.Pp +.Dv SO_SNDLOWAT +is an option to set the minimum count for output operations. +Most output operations process all of the data supplied +by the call, delivering data to the protocol for transmission +and blocking as necessary for flow control. +Nonblocking output operations will process as much data as permitted +subject to flow control without blocking, but will process no data +if flow control does not allow the smaller of the low water mark value +or the entire request to be processed. +A +.Xr select 2 +or +.Xr poll 2 +operation testing the ability to write to a socket will return true +only if the low water mark amount could be processed. +The default value for +.Dv SO_SNDLOWAT +is set to a convenient size for network efficiency, often 1024. +.Dv SO_RCVLOWAT +is an option to set the minimum count for input operations. +In general, receive calls will block until any (non-zero) amount of data +is received, then return with the smaller of the amount available or the amount +requested. +The default value for +.Dv SO_RCVLOWAT +is 1. +If +.Dv SO_RCVLOWAT +is set to a larger value, blocking receive calls normally +wait until they have received the smaller of the low water mark value +or the requested amount. +Receive calls may still return less than the low water mark if an error +occurs, a signal is caught, or the type of data next in the receive queue +is different than that returned. +.Pp +.Dv SO_SNDTIMEO +is an option to set a timeout value for output operations. +It accepts a +.Li struct timeval +parameter with the number of seconds and microseconds +used to limit waits for output operations to complete. +If a send operation has blocked for this much time, +it returns with a partial count or with the error +.Er EWOULDBLOCK +if no data was sent. +In the current implementation, this timer is restarted each time additional +data are delivered to the protocol, +implying that the limit applies to output portions ranging in size +from the low water mark to the high water mark for output. +.Dv SO_RCVTIMEO +is an option to set a timeout value for input operations. +It accepts a +.Li struct timeval +parameter with the number of seconds and microseconds +used to limit waits for input operations to complete. +In the current implementation, this timer is restarted each time additional +data are received by the protocol, +and thus the limit is in effect an inactivity timer. +If a receive operation has been blocked for this much time without +receiving additional data, it returns with a short count +or with the error +.Er EWOULDBLOCK +if no data were received. +.Pp +Finally, +.Dv SO_TYPE +and +.Dv SO_ERROR +are options used only with +.Fn getsockopt . +.Dv SO_TYPE +returns the type of the socket, such as +.Dv SOCK_STREAM ; +it is useful for servers that inherit sockets on startup. +.Dv SO_ERROR +returns any pending error on the socket and clears the error status. +It may be used to check for asynchronous errors on connected +datagram sockets or for other asynchronous errors. +.Sh RETURN VALUES +A 0 is returned if the call succeeds, \-1 if it fails. +.Sh ERRORS +The call succeeds unless: +.Bl -tag -width Er +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is a file, not a socket. +.It Bq Er ENOPROTOOPT +The option is unknown at the level indicated. +.It Bq Er EFAULT +The address pointed to by +.Fa optval +is not in a valid part of the process address space. +For +.Fn getsockopt , +this error may also be returned if +.Fa optlen +is not in a valid part of the process address space. +.El +.Sh SEE ALSO +.Xr connect 2 , +.Xr ioctl 2 , +.Xr poll 2 , +.Xr select 2 , +.Xr poll 2 , +.Xr socket 2 , +.Xr getprotoent 3 , +.Xr protocols 5 +.Sh BUGS +Several of the socket options should be handled at lower levels of the system. +.Sh HISTORY +The +.Fn getsockopt +system call appeared in +.Bx 4.2 . diff --git a/packages/net/common/current/doc/manpages/sys/ioctl.2 b/packages/net/common/current/doc/manpages/sys/ioctl.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/ioctl.2 @@ -0,0 +1,126 @@ +.\" $OpenBSD: ioctl.2,v 1.11 2001/07/30 01:12:43 deraadt Exp $ +.\" $NetBSD: ioctl.2,v 1.5 1995/02/27 12:33:47 cgd Exp $ +.\" +.\" Copyright (c) 1980, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)ioctl.2 8.2 (Berkeley) 12/11/93 +.\" +.Dd December 11, 1993 +.Dt IOCTL 2 +.Os +.Sh NAME +.Nm ioctl +.Nd control device +.Sh SYNOPSIS +.Fd #include +.Ft int +.Fn ioctl "int d" "unsigned long request" "..." +.Sh DESCRIPTION +The +.Fn ioctl +function manipulates the underlying device parameters of special files. +In particular, many operating +characteristics of character special files (e.g., terminals) +may be controlled with +.Fn ioctl +requests. +.Pp +The argument +.Fa d +must be an open file descriptor. The third argument is called +.Fa arg +and contains additional information needed by this device +to perform the requested function. +.Fa arg +is either an +.Li int +or a pointer to a device-specific data structure, depending upon +the given +.Fa request . +.Pp +An +.Nm +.Fa request +has encoded in it whether the argument is an +.Dq in +parameter +or +.Dq out +parameter, and the size of the third argument +.Pq Fa arg +in bytes. +Macros and defines used in specifying an ioctl +.Fa request +are located in the file +.Ao Pa sys/ioctl.h Ac . +.Sh RETURN VALUES +If an error has occurred, a value of \-1 is returned and +.Va errno +is set to indicate the error. +.Sh ERRORS +.Fn ioctl +will fail if: +.Bl -tag -width Er +.It Bq Er EBADF +.Fa d +is not a valid descriptor. +.It Bq Er ENOTTY +.Fa d +is not associated with a character +special device. +.It Bq Er ENOTTY +The specified request does not apply to the kind +of object that the descriptor +.Fa d +references. +.It Bq Er EINVAL +.Fa request +or +.Fa arg +is not valid. +.It Bq Er EFAULT +.Fa arg +points outside the process's allocated address space. +.El +.Sh SEE ALSO +.Xr cdio 1 , +.Xr chio 1 , +.Xr mt 1 , +.Xr execve 2 , +.Xr fcntl 2 , +.Xr intro 4 , +.Xr tty 4 +.Sh HISTORY +An +.Fn ioctl +function call appeared in +.At v7 . diff --git a/packages/net/common/current/doc/manpages/sys/poll.2 b/packages/net/common/current/doc/manpages/sys/poll.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/poll.2 @@ -0,0 +1,203 @@ +.\" $OpenBSD: poll.2,v 1.11 2001/08/11 08:13:18 fgsch Exp $ +.\" +.\" Copyright (c) 1994 Jason R. Thorpe +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Jason R. Thorpe. +.\" 4. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 +.\" +.Dd December 13, 1994 +.Dt POLL 2 +.Os +.Sh NAME +.Nm poll +.Nd synchronous I/O multiplexing +.Sh SYNOPSIS +.Fd #include +.Ft int +.Fn poll "struct pollfd *fds" "int nfds" "int timeout" +.Sh DESCRIPTION +.Fn poll +provides a mechanism for reporting I/O conditions across a set of file +descriptors. +.Pp +The arguments are as follows: +.Bl -tag -width timeout +.It Pa fds +Points to an array of +.Nm pollfd +structures, which are defined as: +.Bd -literal -offset indent +struct pollfd { + int fd; + short events; + short revents; +}; +.Ed +.Pp +The +.Pa fd +member is an open file descriptor. +The +.Pa events +and +.Pa revents +members are bitmasks of conditions to monitor and conditions found, +respectively. +.It Pa nfds +The number of +.Nm pollfd +structures in the array. +.It Pa timeout +Maximum interval to wait for the poll to complete, in milliseconds. +If this value is 0, then +.Fn poll +will return immediately. +If this value is INFTIM (-1), +.Fn poll +will block indefinitely until a condition is found. +.El +.Pp +The calling process sets the +.Pa events +bitmask and +.Fn poll +sets the +.Pa revents +bitmask. +Each call to +.Fn poll +resets the +.Pa revents +bitmask for accuracy. +The condition flags in the bitmasks are defined as: +.Bl -tag -width POLLRDNORM +.It Nm POLLIN +Data is available on the file descriptor for reading. +.It Nm POLLNORM +Same as +.Nm POLLIN . +.It Nm POLLPRI +Same as +.Nm POLLIN . +.It Nm POLLOUT +Data can be written to the file descriptor without blocking. +.It Nm POLLERR +This flag is not used in this implementation and is provided only for source +code compatibility. +.It Nm POLLHUP +The file descriptor was valid before the polling process and invalid after. +Presumably, this means that the file descriptor was closed sometime during +the poll. +.It Nm POLLNVAL +The corresponding file descriptor is invalid. +.It Nm POLLRDNORM +Same as +.Nm POLLIN . +.It Nm POLLRDBAND +Same as +.Nm POLLIN . +.It Nm POLLWRNORM +Same as +.Nm POLLOUT . +.It Nm POLLWRBAND +Same as +.Nm POLLOUT . +.It Nm POLLMSG +This flag is not used in this implementation and is provided only for source +code compatibility. +.El +.Pp +All flags except +.Nm POLLIN , +.Nm POLLOUT , +and their synonyms are for use only in the +.Pa revents +member of the +.Nm pollfd +structure. +An attempt to set any of these flags in the +.Pa events +member will generate an error condition. +.Pp +In addition to I/O multiplexing, +.Fn poll +can be used to generate simple timeouts. +This functionality may be achieved by passing a null pointer for +.Pa fds . +.Sh WARNINGS +The +.Nm POLLHUP +flag is only a close approximation and may not always be accurate. +.Sh RETURN VALUES +Upon error, +.Fn poll +returns a \-1 and sets the global variable +.Va errno +to indicate the error. +If the timeout interval was reached before any events occurred, +a 0 is returned. +Otherwise, +.Fn poll +returns the number of file descriptors for which +.Pa revents +is non-zero. +.Sh ERRORS +.Fn poll +will fail if: +.Bl -tag -width "EINVAL " +.It Bq Er EINVAL +.Pa nfds +was either a negative number or greater than the number of available +file descriptors. +.It Bq Er EINVAL +An invalid flags was set in the +.Pa events +member of the +.Nm pollfd +structure. +.It Bq Er EINVAL +The timeout passed to +.Fn poll +was too large. +.It Bq Er EAGAIN +Resource allocation failed inside of +.Fn poll . +Subsequent calls to +.Fn poll +may succeed. +.It Bq Er EINTR +.Fn poll +caught a signal during the polling process. +.El +.Sh SEE ALSO +.Xr poll 2 , +.Xr select 2 , +.Xr sysconf 3 +.Sh HISTORY +A +.Fn poll +system call appeared in +.At V . diff --git a/packages/net/common/current/doc/manpages/sys/select.2 b/packages/net/common/current/doc/manpages/sys/select.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/select.2 @@ -0,0 +1,260 @@ +.\" $OpenBSD: select.2,v 1.20 2001/09/04 08:04:08 deraadt Exp $ +.\" $NetBSD: select.2,v 1.5 1995/06/27 22:32:28 cgd Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)select.2 8.2 (Berkeley) 3/25/94 +.\" +.Dd March 25, 1994 +.Dt SELECT 2 +.Os +.Sh NAME +.Nm select +.Nd synchronous I/O multiplexing +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include +.Ft int +.Fn select "int nfds" "fd_set *readfds" "fd_set *writefds" "fd_set *exceptfds" "struct timeval *timeout" +.Fn FD_SET fd &fdset +.Fn FD_CLR fd &fdset +.Fn FD_ISSET fd &fdset +.Fn FD_ZERO &fdset +.Sh DESCRIPTION +.Fn select +examines the I/O descriptor sets whose addresses are passed in +.Fa readfds , +.Fa writefds , +and +.Fa exceptfds +to see if some of their descriptors +are ready for reading, are ready for writing, or have an exceptional +condition pending, respectively. +The first +.Fa nfds +descriptors are checked in each set; +i.e., the descriptors from 0 through +.Fa nfds Ns No -1 +in the descriptor sets are examined. +On return, +.Fn select +replaces the given descriptor sets +with subsets consisting of those descriptors that are ready +for the requested operation. +.Fn select +returns the total number of ready descriptors in all the sets. +.Pp +The descriptor sets are stored as bit fields in arrays of integers. +The following macros are provided for manipulating such descriptor sets: +.Fn FD_ZERO &fdset +initializes a descriptor set +.Fa fdset +to the null set. +.Fn FD_SET fd &fdset +includes a particular descriptor +.Fa fd +in +.Fa fdset . +.Fn FD_CLR fd &fdset +removes +.Fa fd +from +.Fa fdset . +.Fn FD_ISSET fd &fdset +is non-zero if +.Fa fd +is a member of +.Fa fdset , +zero otherwise. +The behavior of these macros is undefined if +a descriptor value is less than zero or greater than or equal to +.Dv FD_SETSIZE , +which is normally at least equal +to the maximum number of descriptors supported by the system. +.Pp +If +.Fa timeout +is a non-null pointer, it specifies a maximum interval to wait for the +selection to complete. +If +.Fa timeout +is a null pointer, the select blocks indefinitely. +To effect a poll, the +.Fa timeout +argument should be non-null, pointing to a zero-valued timeval structure. +.Fa timeout +is not changed by +.Fn select , +and may be reused on subsequent calls; however, it is good style to +re-initialize it before each invocation of +.Fn select . +.Pp +Any of +.Fa readfds , +.Fa writefds , +and +.Fa exceptfds +may be given as null pointers if no descriptors are of interest. +.Sh RETURN VALUES +.Fn select +returns the number of ready descriptors that are contained in +the descriptor sets, or \-1 is an error occurred. +If the time limit expires, +.Fn select +returns 0. +If +.Fn select +returns with an error, including one due to an interrupted call, +the descriptor sets will be unmodified. +.Sh ERRORS +An error return from +.Fn select +indicates: +.Bl -tag -width Er +.It Bq Er EFAULT +One or more of +.Fa readfds , +.Fa writefds , +or +.Fa exceptfds +points outside the process's allocated address space. +.It Bq Er EBADF +One of the descriptor sets specified an invalid descriptor. +.It Bq Er EINTR +A signal was delivered before the time limit expired and +before any of the selected events occurred. +.It Bq Er EINVAL +The specified time limit is invalid. +One of its components is negative or too large. +.El +.Sh SEE ALSO +.Xr accept 2 , +.Xr connect 2 , +.Xr gettimeofday 2 , +.Xr poll 2 , +.Xr read 2 , +.Xr recv 2 , +.Xr send 2 , +.Xr write 2 , +.Xr getdtablesize 3 +.Sh BUGS +Although the provision of +.Xr getdtablesize 3 +was intended to allow user programs to be written independent +of the kernel limit on the number of open files, the dimension +of a sufficiently large bit field for select remains a problem. +The default bit size of +.Ft fd_set +is based on the symbol +.Dv FD_SETSIZE +(currently 256), +but that is somewhat smaller than the current kernel limit +to the number of open files. +However, in order to accommodate programs which might potentially +use a larger number of open files with select, it is possible +to increase this size within a program by providing +a larger definition of +.Dv FD_SETSIZE +before the inclusion of +.Aq Pa sys/types.h . +The kernel will cope, and the userland libraries provided with the +system are also ready for large numbers of file descriptors. +.Pp +Alternatively, to be really safe, it is possible to allocate +.Ft fd_set +bit-arrays dynamically. +The idea is to permit a program to work properly even if it is +.Xr execve 2 Ns 'd +with 4000 file descriptors pre-allocated. +The following illustrates the technique which is used by +userland libraries: +.Pp +.Bd -literal -offset indent -compact + fd_set *fdsr; + int max = fd; + + fdsr = (fd_set *)calloc(howmany(max+1, NFDBITS), + sizeof(fd_mask)); + if (fdsr == NULL) { + ... + return (-1); + } + FD_SET(fd, fdsr); + n = select(max+1, fdsr, NULL, NULL, &tv); + ... + free(fdsr); +.Ed +.Pp +Alternatively, it is possible to use the +.Xr poll 2 +interface. +.Xr poll 2 +is more efficient when the size of +.Fn select Ns 's +.Ft fd_set +bit-arrays are very large, and for fixed numbers of +file descriptors one need not size and dynamically allocate a +memory object. +.Pp +.Fn select +should probably have been designed to return the time remaining from the +original timeout, if any, by modifying the time value in place. +Even though some systems stupidly act in this different way, it is +unlikely this semantic will ever be commonly implemented, as the +change causes massive source code compatibility problems. +Furthermore, recent new standards have dictated the current behaviour. +In general, due to the existence of those brain-damaged +non-conforming systems, it is unwise to assume that the timeout +value will be unmodified by the +.Fn select +call, and the caller should reinitialize it on each invocation. +Calculating the delta is easily done by calling +.Xr gettimeofday 2 +before and after the call to +.Fn select Ns , +and using +.Fn timersub +(as described in +.Xr getitimer 2 ) . +.Pp +Internally to the kernel, +.Fn select +works poorly if multiple processes wait on the same file descriptor. +Given that, it is rather surprising to see that many daemons are +written that way (i.e., +.Xr httpd 8 ) . +.Sh HISTORY +The +.Fn select +function call appeared in +.Bx 4.2 . diff --git a/packages/net/common/current/doc/manpages/sys/send.2 b/packages/net/common/current/doc/manpages/sys/send.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/send.2 @@ -0,0 +1,227 @@ +.\" $OpenBSD: send.2,v 1.19 2000/10/18 05:12:11 aaron Exp $ +.\" $NetBSD: send.2,v 1.6 1996/01/15 01:17:18 thorpej Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)send.2 8.2 (Berkeley) 2/21/94 +.\" +.Dd July 28, 1998 +.Dt SEND 2 +.Os +.Sh NAME +.Nm send , +.Nm sendto , +.Nm sendmsg +.Nd send a message from a socket +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft ssize_t +.Fn send "int s" "const void *msg" "size_t len" "int flags" +.Ft ssize_t +.Fn sendto "int s" "const void *msg" "size_t len" "int flags" "const struct sockaddr *to" "socklen_t tolen" +.Ft ssize_t +.Fn sendmsg "int s" "const struct msghdr *msg" "int flags" +.Sh DESCRIPTION +.Fn send , +.Fn sendto , +and +.Fn sendmsg +are used to transmit a message to another socket. +.Fn send +may be used only when the socket is in a +.Em connected +state, while +.Fn sendto +and +.Fn sendmsg +may be used at any time. +.Pp +The address of the target is given by +.Fa to +with +.Fa tolen +specifying its size. +The length of the message is given by +.Fa len . +If the message is too long to pass atomically through the +underlying protocol, the error +.Er EMSGSIZE +is returned, and +the message is not transmitted. +.Pp +No indication of failure to deliver is implicit in a +.Fn send . +Locally detected errors are indicated by a return value of \-1. +.Pp +If no messages space is available at the socket to hold +the message to be transmitted, then +.Fn send +normally blocks, unless the socket has been placed in +non-blocking I/O mode. +The +.Xr select 2 +or +.Xr poll 2 +system calls may be used to determine when it is possible to +send more data. +.Pp +The +.Fa flags +parameter may include one or more of the following: +.Bd -literal +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_DONTROUTE 0x4 /* bypass routing, use direct interface */ +.Ed +.Pp +The flag +.Dv MSG_OOB +is used to send +.Dq out-of-band +data on sockets that support this notion (e.g., +.Dv SOCK_STREAM ) ; +the underlying protocol must also support +.Dq out-of-band +data. +.Dv MSG_DONTROUTE +is usually used only by diagnostic or routing programs. +.Pp +See +.Xr recv 2 +for a description of the +.Fa msghdr +structure. +.Sh RETURN VALUES +The call returns the number of characters sent, or \-1 +if an error occurred. +.Sh ERRORS +.Fn send , +.Fn sendto , +and +.Fn sendmsg +fail if: +.Bl -tag -width Er +.It Bq Er EBADF +An invalid descriptor was specified. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.It Bq Er EFAULT +An invalid user space address was specified for a parameter. +.It Bq Er EMSGSIZE +The socket requires that message be sent atomically, +and the size of the message to be sent made this impossible. +.It Bq Er EAGAIN +The socket is marked non-blocking and the requested operation +would block. +.It Bq Er ENOBUFS +The system was unable to allocate an internal buffer. +The operation may succeed when buffers become available. +.It Bq Er ENOBUFS +The output queue for a network interface was full. +This generally indicates that the interface has stopped sending, +but may be caused by transient congestion. +.It Bq Er EACCES +The +.Dv SO_BROADCAST +option is not set on the socket, and a broadcast address +was given as the destination. +.It Bq Er EHOSTUNREACH +The destination address specified an unreachable host. +.It Bq Er EINVAL +The +.Fa flags +parameter is invalid. +.It Bq Er EHOSTDOWN +The destination address specified a host that is down. +.It Bq Er ENETDOWN +The destination address specified a network that is down. +.It Bq Er ECONNREFUSED +The destination host rejected the message (or a previous one). +This error can only be returned by connected sockets. +.It Bq Er ENOPROTOOPT +There was a problem sending the message. +This error can only be returned by connected sockets. +.It Bq Er EDESTADDRREQ +The socket is not connected, and no destination address was specified. +.It Bq Er EISCONN +The socket is already connected, and a destination address was specified. +.El +.Pp +In addition, +.Fn send +and +.Fn sendto +may return the following error: +.Bl -tag -width Er +.It Bq Er EINVAL +.Fa len +was larger than +.Dv SSIZE_MAX . +.El +.Pp +Also, +.Fn sendmsg +may return the following errors: +.Bl -tag -width Er +.It Bq Er EINVAL +The sum of the +.Fa iov_len +values in the +.Fa msg_iov +array overflowed an +.Em ssize_t . +.It Bq Er EMSGSIZE +The +.Fa msg_iovlen +member of +.Fa msg +was less than 0 or larger than +.Dv IOV_MAX . +.It Bq Er EAFNOSUPPORT +Addresses in the specified address family cannot be used with this socket. +.El +.Sh SEE ALSO +.Xr fcntl 2 , +.Xr getsockopt 2 , +.Xr poll 2 , +.Xr recv 2 , +.Xr select 2 , +.Xr poll 2 , +.Xr socket 2 , +.Xr write 2 +.Sh HISTORY +The +.Fn send +function call appeared in +.Bx 4.2 . diff --git a/packages/net/common/current/doc/manpages/sys/shutdown.2 b/packages/net/common/current/doc/manpages/sys/shutdown.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/shutdown.2 @@ -0,0 +1,103 @@ +.\" $OpenBSD: shutdown.2,v 1.9 2000/08/09 12:57:54 aaron Exp $ +.\" $NetBSD: shutdown.2,v 1.5 1995/02/27 12:37:11 cgd Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)shutdown.2 8.1 (Berkeley) 6/4/93 +.\" +.Dd June 4, 1993 +.Dt SHUTDOWN 2 +.Os +.Sh NAME +.Nm shutdown +.Nd shut down part of a full-duplex connection +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn shutdown "int s" "int how" +.Sh DESCRIPTION +The +.Fn shutdown +call causes all or part of a full-duplex connection on +the socket associated with +.Fa s +to be shut down. +If +.Fa how +is +.Ar SHUT_RD , +further receives will be disallowed. +If +.Fa how +is +.Ar SHUT_WR , +further sends will be disallowed. +If +.Fa how +is +.Ar SHUT_RDWR , +further sends and receives will be disallowed. +.Sh RETURN VALUES +A 0 is returned if the call succeeds, \-1 if it fails. +.Sh ERRORS +The call succeeds unless: +.Bl -tag -width Er +.It Bq Er EINVAL +.Fa how +is not +.Ar SHUT_RD , +.Ar SHUT_WR , +or +.Ar SHUT_RDWR . +.It Bq Er EBADF +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +.Fa s +is a file, not a socket. +.It Bq Er ENOTCONN +The specified socket is not connected. +.El +.Sh SEE ALSO +.Xr connect 2 , +.Xr socket 2 +.Sh HISTORY +The +.Fn shutdown +function call appeared in +.Bx 4.2 . +The +.Fa how +arguments used to be simply 0, 1, and 2, but now have named values +as specified by +.St -xpg4 . diff --git a/packages/net/common/current/doc/manpages/sys/socket.2 b/packages/net/common/current/doc/manpages/sys/socket.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/socket.2 @@ -0,0 +1,264 @@ +.\" $OpenBSD: socket.2,v 1.18 2000/10/18 05:12:12 aaron Exp $ +.\" $NetBSD: socket.2,v 1.5 1995/02/27 12:37:53 cgd Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)socket.2 8.1 (Berkeley) 6/4/93 +.\" +.Dd June 4, 1993 +.Dt SOCKET 2 +.Os +.Sh NAME +.Nm socket +.Nd create an endpoint for communication +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn socket "int domain" "int type" "int protocol" +.Sh DESCRIPTION +.Fn socket +creates an endpoint for communication and returns a descriptor. +.Pp +The +.Fa domain +parameter specifies a communications domain within which +communication will take place; this selects the protocol family +which should be used. +These families are defined in the include file +.Ao Pa sys/socket.h Ac . +The currently understood formats are +.Pp +.Bd -literal -offset indent -compact +AF_UNIX (UNIX internal protocols), +AF_INET (ARPA Internet protocols), +AF_INET6 (ARPA IPv6 protocols), +AF_ISO (ISO protocols), +AF_NS (Xerox Network Systems protocols), +AF_IPX (Internetwork Packet Exchange), and +AF_IMPLINK (IMP \*(lqhost at IMP\*(rq link layer). +.Ed +.Pp +The socket has the indicated +.Fa type , +which specifies the semantics of communication. +Currently defined types are: +.Pp +.Bd -literal -offset indent -compact +SOCK_STREAM +SOCK_DGRAM +SOCK_RAW +SOCK_SEQPACKET +SOCK_RDM +.Ed +.Pp +A +.Dv SOCK_STREAM +type provides sequenced, reliable, +two-way connection based byte streams. +An out-of-band data transmission mechanism may be supported. +A +.Dv SOCK_DGRAM +socket supports +datagrams (connectionless, unreliable messages of +a fixed (typically small) maximum length). +A +.Dv SOCK_SEQPACKET +socket may provide a sequenced, reliable, +two-way connection-based data transmission path for datagrams +of fixed maximum length; a consumer may be required to read +an entire packet with each read system call. +This facility is protocol specific, and presently implemented +only for +.Dv PF_NS . +.Dv SOCK_RAW +sockets provide access to internal network protocols and interfaces. +The types +.Dv SOCK_RAW , +which is available only to the superuser, and +.Dv SOCK_RDM , +which is planned, +but not yet implemented, are not described here. +.Pp +The +.Fa protocol +specifies a particular protocol to be used with the socket. +Normally only a single protocol exists to support a particular +socket type within a given protocol family. +However, it is possible that many protocols may exist, +in which case a particular protocol must be specified in this manner. +The protocol number to use is particular to the \*(lqcommunication domain\*(rq +in which communication is to take place; see +.Xr protocols 5 . +A value of 0 for +.Fa protocol +will let the system select an appropriate protocol for the requested +socket type. +.Pp +Sockets of type +.Dv SOCK_STREAM +are full-duplex byte streams, similar to pipes. +A stream socket must be in a +.Em connected +state before any data may be sent or received on it. +A connection to another socket is created with a +.Xr connect 2 +call. +Once connected, data may be transferred using +.Xr read 2 +and +.Xr write 2 +calls or some variant of the +.Xr send 2 +and +.Xr recv 2 +calls. +When a session has been completed a +.Xr close 2 +may be performed. +Out-of-band data may also be transmitted as described in +.Xr send 2 +and received as described in +.Xr recv 2 . +.Pp +The communications protocols used to implement a +.Dv SOCK_STREAM +ensure that data is not lost or duplicated. +If a piece of data for which the peer protocol has buffer space cannot +be successfully transmitted within a reasonable length of time, then the +connection is considered broken and calls will indicate an error with \-1 +returns and with +.Er ETIMEDOUT +as the specific code in the global variable +.Va errno . +The protocols optionally keep sockets +.Dq warm +by forcing transmissions roughly every minute in the absence of other activity. +An error is then indicated if no response can be elicited on an otherwise +idle connection for a extended period (e.g., 5 minutes). +A +.Dv SIGPIPE +signal is raised if a process sends on a broken stream; this causes +naive processes, which do not handle the signal, to exit. +.Pp +.Dv SOCK_SEQPACKET +sockets employ the same system calls +as +.Dv SOCK_STREAM +sockets. +The only difference is that +.Xr read 2 +calls will return only the amount of data requested, +and any remaining in the arriving packet will be discarded. +.Pp +.Dv SOCK_DGRAM +and +.Dv SOCK_RAW +sockets allow sending of datagrams to correspondents named in +.Xr send 2 +calls. +Datagrams are generally received with +.Xr recvfrom 2 , +which returns the next datagram with its return address. +.Pp +An +.Xr fcntl 2 +call can be used to specify a process group to receive +a +.Dv SIGURG +signal when the out-of-band data arrives. +It may also enable non-blocking I/O and asynchronous notification +of I/O events via +.Dv SIGIO . +.Pp +The operation of sockets is controlled by socket level +.Em options . +These options are defined in the file +.Ao Pa sys/socket.h Ac . +.Xr setsockopt 2 +and +.Xr getsockopt 2 +are used to set and get options, respectively. +.Sh RETURN VALUES +A \-1 is returned if an error occurs, otherwise the return +value is a descriptor referencing the socket. +.Sh ERRORS +The +.Fn socket +call fails if: +.Bl -tag -width Er +.It Bq Er EPROTONOSUPPORT +The protocol type or the specified protocol is not supported +within this domain. +.It Bq Er EMFILE +The per-process descriptor table is full. +.It Bq Er ENFILE +The system file table is full. +.It Bq Er EACCES +Permission to create a socket of the specified type and/or protocol +is denied. +.It Bq Er ENOBUFS +Insufficient buffer space is available. +The socket cannot be created until sufficient resources are freed. +.El +.Sh SEE ALSO +.Xr accept 2 , +.Xr bind 2 , +.Xr connect 2 , +.Xr getsockname 2 , +.Xr getsockopt 2 , +.Xr ioctl 2 , +.Xr listen 2 , +.Xr poll 2 , +.Xr read 2 , +.Xr recv 2 , +.Xr select 2 , +.Xr send 2 , +.Xr setsockopt 2 , +.Xr shutdown 2 , +.Xr socketpair 2 , +.Xr write 2 , +.Xr getprotoent 3 , +.Xr netintro 4 +.Rs +.%T "An Introductory 4.3 BSD Interprocess Communication Tutorial" +.%O "reprinted in UNIX Programmer's Supplementary Documents Volume 1" +.Re +.Rs +.%T "BSD Interprocess Communication Tutorial" +.%O "reprinted in UNIX Programmer's Supplementary Documents Volume 1" +.Re +.Sh HISTORY +The +.Fn socket +function call appeared in +.Bx 4.2 . diff --git a/packages/net/common/current/doc/manpages/sys/socketpair.2 b/packages/net/common/current/doc/manpages/sys/socketpair.2 new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/manpages/sys/socketpair.2 @@ -0,0 +1,109 @@ +.\" $OpenBSD: socketpair.2,v 1.10 1999/07/06 18:21:04 deraadt Exp $ +.\" $NetBSD: socketpair.2,v 1.5 1995/02/27 12:38:00 cgd Exp $ +.\" +.\" Copyright (c) 1983, 1991, 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 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. +.\" +.\" @(#)socketpair.2 8.1 (Berkeley) 6/4/93 +.\" +.Dd June 4, 1993 +.Dt SOCKETPAIR 2 +.Os +.Sh NAME +.Nm socketpair +.Nd create a pair of connected sockets +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn socketpair "int d" "int type" "int protocol" "int *sv" +.Sh DESCRIPTION +The +.Fn socketpair +call creates an unnamed pair of connected sockets in +the specified domain +.Fa d , +of the specified +.Fa type , +and using the optionally specified +.Fa protocol . +The descriptors used in referencing the new sockets +are returned in +.Fa sv Ns [0] +and +.Fa sv Ns [1] . +The two sockets are indistinguishable. +.Sh RETURN VALUES +A 0 is returned if the call succeeds, \-1 if it fails. +.Sh ERRORS +The call succeeds unless: +.Bl -tag -width Er +.It Bq Er EMFILE +Too many descriptors are in use by this process. +.It Bq Er EAFNOSUPPORT +The specified address family is not supported on this machine. +.It Bq Er EPROTONOSUPPORT +The specified protocol is not supported on this machine. +.It Bq Er EOPNOTSUPP +The specified protocol does not support creation of socket pairs. +.It Bq Er EFAULT +The address +.Fa sv +does not specify a valid part of the +process address space. +.It Bq Er ENFILE +The system file table is full. +.El +.Sh SEE ALSO +.Xr pipe 2 , +.Xr read 2 , +.Xr write 2 +.Sh BUGS +This call is currently implemented only for the +.Tn LOCAL +domain. +Many operating systems only accept a +.Ar protocol +of +.Ev PF_UNSPEC , +so that should be used instead of +.Ev PF_LOCAL +for maximal portability. +.Sh STANDARDS +The +.Fn socketpair +function conforms to +.St -xpg4.2 . +.Sh HISTORY +The +.Fn socketpair +function call appeared in +.Bx 4.2 . diff --git a/packages/net/common/current/doc/prepare-manpages.sh b/packages/net/common/current/doc/prepare-manpages.sh new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/prepare-manpages.sh @@ -0,0 +1,75 @@ +#! /bin/sh + +echo 'dude, assuming you are running this script from the ecos-docs/tcpip directory' + +MANPAGE_LIST=`find manpages -type f -name '*.?'` + +echo "MANPAGE_LIST is $MANPAGE_LIST" + +echo 'removing the previous file tcpip-manpages.sgml' +/bin/rm -f tcpip-manpages.sgml +touch tcpip-manpages.sgml +echo '' >> tcpip-manpages.sgml +echo '' >> tcpip-manpages.sgml +echo '' >> tcpip-manpages.sgml +echo '' >> tcpip-manpages.sgml +echo >> tcpip-manpages.sgml +echo >> tcpip-manpages.sgml + +echo "" >> tcpip-manpages.sgml +echo " TCP/IP Library Reference" >> tcpip-manpages.sgml + +echo >> tcpip-manpages.sgml +echo >> tcpip-manpages.sgml + +for manpage in $MANPAGE_LIST +do + echo "processing $manpage" + # get the title for this section + manpage_title=`egrep '^\.Dt' $manpage | awk '{print $2}'` + # note that _ is illegal in an id, so we canonicalize it to - + docbook_section_id=`echo $manpage_title | sed 's/_/-/g'` + # now prepare out a section and title + echo " " >> tcpip-manpages.sgml + echo " $manpage_title" >> tcpip-manpages.sgml + # we make it so that it is a monospaced font + echo " " >> tcpip-manpages.sgml + + # now put the contents into this section + cat $manpage | groff -Tascii -mandoc | sed 's/\_\(.\)/\1/g' \ + | sed 's/\(.\)\(.\)/\1/g' \ + | sed 's/\&/\&/g' \ + | sed 's/> tcpip-manpages.sgml + + # now close out the section + echo " " >> tcpip-manpages.sgml + echo " " >> tcpip-manpages.sgml + echo >> tcpip-manpages.sgml +done + +echo >> tcpip-manpages.sgml +echo "" >> tcpip-manpages.sgml + +cat <> tcpip-manpages.sgml + + + +EOF diff --git a/packages/net/common/current/doc/running_nc_tests b/packages/net/common/current/doc/running_nc_tests new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/running_nc_tests @@ -0,0 +1,321 @@ +The network performance tests are split into two parts, one +[nc6_test_master] which runs on a host (like Linux or FreeBSD) and the +other [nc6_test_slave] which runs on the target platform. Note that +these tests supplant older versions (nc_test_XXX) which did not +support IPv6 addressing. + +To run the tests, start the slave part first. On the target hardware, +run the program "nc6_test_slave". It will display a set of information +on the console (use serial console only as using a network console +would severely impact the numbers) similar to this: + + RedBoot> lo ipv6.test;g + Entry point: 0x00040040, address range: 0x00040000-0x000ae56c + [cyg_net_init] Init: mbinit(0x00000000) + [cyg_net_init] Init: cyg_net_init_devs(0x00000000) + Init device 'cs8900a_eth0' + [cyg_net_init] Init: loopattach(0x00000000) + [cyg_net_init] Init: ifinit(0x00000000) + IFP: 0x000acf1c, next: 0x00117a00 + IFP: 0x00117a00, next: 0x00000000 + eth0 XXX: driver didn't set ifq_maxlen + [cyg_net_init] Init: domaininit(0x00000000) + [cyg_net_init] Init: cyg_net_add_domain(0x000ad7f8) + New domain internet6 at 0x00000000 + [cyg_net_init] Init: cyg_net_add_domain(0x000adfbc) + New domain internet at 0x00000000 + [cyg_net_init] Init: cyg_net_add_domain(0x000ad314) + New domain route at 0x00000000 + [cyg_net_init] Init: cyg_route_init(0x00000000) + [cyg_net_init] Init: ip6_init2(0x00000000) + [cyg_net_init] Done + Start Network Characterization - SLAVE + BOOTP[eth0] op: REQUEST + htype: Ethernet + hlen: 6 + hops: 0 + xid: 0xe194048b + secs: 0 + flags: 0x80 + hw_addr: 00:30:d3:03:04:8b + client IP: 0.0.0.0 + my IP: 192.168.1.52 + server IP: 192.168.1.101 + gateway IP: 0.0.0.0 + server: hermes.chez-thomas.org + file: /tftpboot/192.168.1.52/zImage + options: + DHCP message: 3 REQUEST + DHCP server id: 63.225.98.241 + DHCP time 51: -1 + DHCP time 58: 0 + DHCP time 59: 0 + subnet mask: 255.255.255.0 + gateway: 192.168.1.101 + domain server: 63.225.98.241, 206.196.128.1, 205.180.230.20, 205.180.230.21 + domain name: chez-thomas.org + IP broadcast: 192.168.1.255 + DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28 + DHCP option: 39/57.2: 576 + DHCP requested ip: 192.168.1.52 + No load = 248826 + Set background load = 20% + Set background load = 0% + High Load[20] = 192089 => 23% + Set background load = 20% + Set background load = 0% + Load[10] = 220394 => 12% + Set background load = 20% + Set background load = 0% + Load[15] = 206082 => 18% + Set background load = 20% + Set background load = 0% + Final load[16] = 203142 => 19% + Start test for eth0 + Family: 2, Socket: 2, Addr: 0.0.0.0 + Family: 28, Socket: 2, Addr: :: + +At this point, the slave is ready to accept commands. The section with +lines like "Set background load = 20%" are the slave test self-calibrating +a background load level which is used later. + +Once the slave is started, then on your host system (Linux), run the +'nc6_test_master' program like this: + + [root@ebsa2 gthomas]# ./nc6_test_master 3ffe:302:11:2::192.168.1.52 + +This command would test against the IPv6 slave. You can also use an IPv4 +address. + +The master program will then run a sequence of tests. Each test is accomplished +by sending a command "packet" to the slave which initiates a sequence of +I/O requests. These are requests for UDP and TCP traffic patterns, adjusting +the slave background load, etc. The results are displayed by the master +program as they are obtained. For example: + + ================== No load, master at 100% ======================== + Start UDP echo [640,1024] - no delays + UDP echo - 1280 bufs of 1024 bytes in 2.03 seconds - 630.54 KB/S - 5.1654 Mbit/S (M = 10^6) + slave sent 640, recvd 640 + Start UDP send [640,1024] - no delays + Packets out of sequence - recvd: 51, expected: 50 + Packets out of sequence - recvd: 103, expected: 102 + Packets out of sequence - recvd: 155, expected: 154 + Packets out of sequence - recvd: 207, expected: 206 + Packets out of sequence - recvd: 259, expected: 258 + Packets out of sequence - recvd: 311, expected: 310 + Packets out of sequence - recvd: 363, expected: 362 + Packets out of sequence - recvd: 415, expected: 414 + Packets out of sequence - recvd: 467, expected: 466 + Packets out of sequence - recvd: 519, expected: 518 + Packets out of sequence - recvd: 571, expected: 570 + Packets out of sequence - recvd: 623, expected: 622 + UDP send - 628 bufs of 1024 bytes in 1.46 seconds - 430.14 KB/S - 3.5237 Mbit/S (M = 10^6), 12 out of sequence + slave sent 628, recvd 0 + Start UDP recv [640,1024] - no delays + UDP recv - 640 bufs of 1024 bytes in 0.05 seconds - 12800.00 KB/S - 104.8576 Mbit/S (M = 10^6) + slave sent 0, recvd 495 + Start TCP echo [640,1024] - no delays + TCP echo - 1280 bufs of 1024 bytes in 2.16 seconds - 592.59 KB/S - 4.8545 Mbit/S (M = 10^6) + slave sent 640, recvd 640 + Start TCP send [640,1024] - no delays + TCP send - 640 bufs of 1024 bytes in 0.80 seconds - 800.00 KB/S - 6.5536 Mbit/S (M = 10^6) + slave sent 640, recvd 0 + Start TCP recv [640,1024] - no delays + TCP recv - 640 bufs of 1024 bytes in 0.65 seconds - 984.62 KB/S - 8.0660 Mbit/S (M = 10^6) + slave sent 0, recvd 640 + Start TCP echo [64,10240] - no delays + TCP echo - 128 bufs of 10240 bytes in 3.80 seconds - 336.84 KB/S - 2.7594 Mbit/S (M = 10^6) + slave sent 64, recvd 64 + + ====================== Various slave compute loads =================== + >>>>>>>>>>>> slave processing load at 0% + Start UDP echo [2048,1024] - no delays + UDP echo - 4096 bufs of 1024 bytes in 6.51 seconds - 629.19 KB/S - 5.1543 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + Start TCP echo [2048,1024] - no delays + TCP echo - 4096 bufs of 1024 bytes in 6.90 seconds - 593.62 KB/S - 4.8630 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + >>>>>>>>>>>> slave processing load at 10% + Start UDP echo [2048,1024] - no delays + UDP echo - 4096 bufs of 1024 bytes in 6.81 seconds - 601.47 KB/S - 4.9272 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + Start TCP echo [2048,1024] - no delays + TCP echo - 4096 bufs of 1024 bytes in 7.00 seconds - 585.14 KB/S - 4.7935 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + >>>>>>>>>>>> slave processing load at 20% + Start UDP echo [2048,1024] - no delays + UDP echo - 4096 bufs of 1024 bytes in 6.81 seconds - 601.47 KB/S - 4.9272 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + Start TCP echo [2048,1024] - no delays + TCP echo - 4096 bufs of 1024 bytes in 7.32 seconds - 559.56 KB/S - 4.5839 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + >>>>>>>>>>>> slave processing load at 30% + Start UDP echo [2048,1024] - no delays + UDP echo - 4096 bufs of 1024 bytes in 8.04 seconds - 509.45 KB/S - 4.1734 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + Start TCP echo [2048,1024] - no delays + TCP echo - 4096 bufs of 1024 bytes in 8.78 seconds - 466.51 KB/S - 3.8217 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + >>>>>>>>>>>> slave processing load at 40% + Start UDP echo [2048,1024] - no delays + UDP echo - 4096 bufs of 1024 bytes in 10.22 seconds - 400.78 KB/S - 3.2832 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + Start TCP echo [2048,1024] - no delays + TCP echo - 4096 bufs of 1024 bytes in 10.24 seconds - 400.00 KB/S - 3.2768 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + >>>>>>>>>>>> slave processing load at 50% + Start UDP echo [2048,1024] - no delays + UDP echo - 4096 bufs of 1024 bytes in 10.22 seconds - 400.78 KB/S - 3.2832 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + Start TCP echo [2048,1024] - no delays + TCP echo - 4096 bufs of 1024 bytes in 10.24 seconds - 400.00 KB/S - 3.2768 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + + ====================== Various master loads =================== + Testing IDLE for 10 seconds + IDLE - ticks: 1003, count: 1367315 + Start UDP echo [2048,1024] - no delays + UDP echo - 4096 bufs of 1024 bytes in 10.22 seconds - 400.78 KB/S - 3.2832 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + IDLE - ticks: 1028, count: 641138, 45% idle + Start TCP echo [2048,1024] - no delays + TCP echo - 4096 bufs of 1024 bytes in 10.24 seconds - 400.00 KB/S - 3.2768 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + IDLE - ticks: 1330, count: 1004010, 55% idle + Start UDP echo [2048,1024] - 10ms delay after 10 packets + UDP echo - 4096 bufs of 1024 bytes in 13.01 seconds - 314.83 KB/S - 2.5791 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + IDLE - ticks: 1307, count: 1015862, 56% idle + Start TCP echo [2048,1024] - 10ms delay after 10 packets + TCP echo - 4096 bufs of 1024 bytes in 13.26 seconds - 308.90 KB/S - 2.5305 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + IDLE - ticks: 1633, count: 1410624, 63% idle + Start UDP echo [2048,1024] - 50ms delay after 10 packets + UDP echo - 4096 bufs of 1024 bytes in 21.00 seconds - 195.05 KB/S - 1.5978 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + IDLE - ticks: 2106, count: 2105817, 73% idle + Start TCP echo [2048,1024] - 50ms delay after 10 packets + TCP echo - 4096 bufs of 1024 bytes in 21.26 seconds - 192.66 KB/S - 1.5783 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + IDLE - ticks: 2434, count: 2471814, 74% idle + Start UDP echo [2048,1024] - 100ms delay after 10 packets + UDP echo - 4096 bufs of 1024 bytes in 31.28 seconds - 130.95 KB/S - 1.0727 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + IDLE - ticks: 3135, count: 3508880, 82% idle + Start TCP echo [2048,1024] - 100ms delay after 10 packets + TCP echo - 4096 bufs of 1024 bytes in 31.43 seconds - 130.32 KB/S - 1.0676 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + IDLE - ticks: 3451, count: 3859323, 82% idle + Start UDP echo [2048,1024] - 10ms delay after 1 packet + UDP echo - 4096 bufs of 1024 bytes in 40.94 seconds - 100.05 KB/S - 0.8196 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + IDLE - ticks: 4102, count: 4789770, 85% idle + Start TCP echo [2048,1024] - 10ms delay after 1 packet + TCP echo - 4096 bufs of 1024 bytes in 40.96 seconds - 100.00 KB/S - 0.8192 Mbit/S (M = 10^6) + slave sent 2048, recvd 2048 + IDLE - ticks: 4407, count: 5147211, 85% idle + ... Done + +The slave will display lines like: + UDP echo - 640 buffers, 1024 bytes + UDP send - 640 buffers, 1024 bytes + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + sendto UDP data: No buffer space available + UDP recv - 640 buffers, 1024 bytes + Packets out of sequence - recvd: 508, expected: 492 + Packets out of sequence - recvd: 528, expected: 510 + recvfrom timeout, expecting seq #529 + recvfrom timeout, expecting seq #530 + recvfrom timeout, expecting seq #531 + recvfrom timeout, expecting seq #532 + recvfrom timeout, expecting seq #533 + recvfrom timeout, expecting seq #534 + ... giving up + TCP echo - 640 buffers, 1024 bytes + TCP - listen on IPv6/8770 + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1085) + TCP send - 640 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1086) + TCP recv - 640 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1087) + TCP echo - 64 buffers, 10240 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1088) + Set background load = 0% + Set background load = 0% + UDP echo - 2048 buffers, 1024 bytes + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1089) + Set background load = 10% + UDP echo - 2048 buffers, 1024 bytes + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1090) + Set background load = 20% + UDP echo - 2048 buffers, 1024 bytes + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1091) + Set background load = 30% + UDP echo - 2048 buffers, 1024 bytes + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1092) + Set background load = 40% + UDP echo - 2048 buffers, 1024 bytes + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1093) + Set background load = 50% + UDP echo - 2048 buffers, 1024 bytes + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1094) + Start IDLE thread + Stop IDLE thread + Start IDLE thread + UDP echo - 2048 buffers, 1024 bytes + Stop IDLE thread + Start IDLE thread + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1095) + Stop IDLE thread + Start IDLE thread + UDP echo - 2048 buffers, 1024 bytes + Stop IDLE thread + Start IDLE thread + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1096) + Stop IDLE thread + Start IDLE thread + UDP echo - 2048 buffers, 1024 bytes + Stop IDLE thread + Start IDLE thread + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1097) + Stop IDLE thread + Start IDLE thread + UDP echo - 2048 buffers, 1024 bytes + Stop IDLE thread + Start IDLE thread + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1098) + Stop IDLE thread + Start IDLE thread + UDP echo - 2048 buffers, 1024 bytes + Stop IDLE thread + Start IDLE thread + TCP echo - 2048 buffers, 1024 bytes + connection from 3ffe:302:11:2:290:27ff:fe8b:8e1d(1099) + Stop IDLE thread + +Notice that if the host and target are not well balanced (in this example, +the host is a fairly fast P-II running with a very good 10/100Mb ethernet +controller and the slave is a reasonable [not fast!] ARM board with a very +simplistic [read "slow"] network adaptor), then the UDP tests can have +synchronization problems. This is the nature of UDP and is to be expected. diff --git a/packages/net/common/current/doc/tcpip-manpages.sgml b/packages/net/common/current/doc/tcpip-manpages.sgml new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/tcpip-manpages.sgml @@ -0,0 +1,4034 @@ + + + + + + + + TCP/IP Library Reference + + + + GETDOMAINNAME + + +GETDOMAINNAME(3) System Programmer's Manual GETDOMAINNAME(3) + +NAME + getdomainname, setdomainname - get/set YP domain name of current host + +SYNOPSIS + #include <unistd.h> + + int + getdomainname(char *name, size_t namelen) + + int + setdomainname(const char *name, size_t namelen) + +DESCRIPTION + The getdomainname() function returns the YP domain name for the current + processor, as previously set by setdomainname(). The parameter namelen + specifies the size of the name array. If insufficient space is provided, + the returned name is truncated. The returned name is always null termi- + nated. + + setdomainname() sets the domain name of the host machine to be name, + which has length namelen. This call is restricted to the superuser and is + normally used only when the system is bootstrapped. + +RETURN VALUES + If the call succeeds a value of 0 is returned. If the call fails, a val- + ue of -1 is returned and an error code is placed in the global variable + errno. + +ERRORS + The following errors may be returned by these calls: + + [EFAULT] The name or namelen parameter gave an invalid address. + + [EPERM] The caller tried to set the domain name and was not the su- + peruser. + +SEE ALSO + domainname(1), gethostid(3), gethostname(3), sysctl(3), sysctl(8), + yp(8) + +BUGS + Domain names are limited to MAXHOSTNAMELEN (from <sys/param.h>) charac- + ters, currently 256. This includes the terminating NUL character. + + If the buffer passed to getdomainname() is too small, other operating + systems may not guarantee termination with NUL. + +HISTORY + The getdomainname function call appeared in SunOS 3.x. + +BSD Experimental May 6, 1994 1 + + + + + GETHOSTNAME + + +GETHOSTNAME(3) System Programmer's Manual GETHOSTNAME(3) + +NAME + gethostname, sethostname - get/set name of current host + +SYNOPSIS + #include <unistd.h> + + int + gethostname(char *name, size_t namelen) + + int + sethostname(const char *name, size_t namelen) + +DESCRIPTION + The gethostname() function returns the standard host name for the current + processor, as previously set by sethostname(). The parameter namelen + specifies the size of the name array. If insufficient space is provided, + the returned name is truncated. The returned name is always null termi- + nated. + + sethostname() sets the name of the host machine to be name, which has + length namelen. This call is restricted to the superuser and is normally + used only when the system is bootstrapped. + +RETURN VALUES + If the call succeeds a value of 0 is returned. If the call fails, a val- + ue of -1 is returned and an error code is placed in the global variable + errno. + +ERRORS + The following errors may be returned by these calls: + + [EFAULT] The name or namelen parameter gave an invalid address. + + [EPERM] The caller tried to set the hostname and was not the supe- + ruser. + +SEE ALSO + hostname(1), getdomainname(3), gethostid(3), sysctl(3), sysctl(8), + yp(8) + +STANDARDS + The gethostname() function call conforms to . + +HISTORY + The gethostname() function call appeared in 4.2BSD. + +BUGS + Host names are limited to MAXHOSTNAMELEN (from <sys/param.h>) characters, + currently 256. This includes the terminating NUL character. + + If the buffer passed to gethostname() is smaller than MAXHOSTNAMELEN, + other operating systems may not guarantee termination with NUL. + +BSD Experimental June 4, 1993 1 + + + + + BYTEORDER + + +BYTEORDER(3) System Programmer's Manual BYTEORDER(3) + +NAME + htonl, htons, ntohl, ntohs, htobe32, htobe16, betoh32, betoh16, htole32, + htole16, letoh32, letoh16, swap32, swap16 - convert values between dif- + ferent byte orderings + +SYNOPSIS + #include <sys/types.h> + #include <machine/endian.h> + + u_int32_t + htonl(u_int32_t host32) + + u_int16_t + htons(u_int16_t host16) + + u_int32_t + ntohl(u_int32_t net32) + + u_int16_t + ntohs(u_int16_t net16) + + u_int32_t + htobe32(u_int32_t host32) + + u_int16_t + htobe16(u_int16_t host16) + + u_int32_t + betoh32(u_int32_t big32) + + u_int16_t + betoh16(u_int16_t big16) + + u_int32_t + htole32(u_int32_t host32) + + u_int16_t + htole16(u_int16_t host16) + + u_int32_t + letoh32(u_int32_t little32) + + u_int16_t + letoh16(u_int16_t little16) + + u_int32_t + swap32(u_int32_t val32) + + u_int16_t + swap16(u_int16_t val16) + +DESCRIPTION + These routines convert 16- and 32-bit quantities between different byte + orderings. The ``swap'' functions reverse the byte ordering of the given + quantity, the others converts either from/to the native byte order used + by the host to/from either little- or big-endian (a.k.a network) order. + + Apart from the swap functions, the names can be described by this form: + {src-order}to{dst-order}{size}. Both {src-order} and {dst-order} can + take the following forms: + + + + h Host order. + n Network order (big-endian). + be Big-endian (most significant byte first). + le Little-endian (least significant byte first). + + One of the specified orderings must be `h'. {size} will take these forms: + + l Long (32-bit, used in conjunction with forms involving `n'). + s Short (16-bit, used in conjunction with forms involving `n'). + 16 16-bit. + 32 32-bit. + + The swap functions are of the form: swap{size}. + + Names involving `n' convert quantities between network byte order and + host byte order. The last letter (`s' or `l') is a mnemonic for the tra- + ditional names for such quantities, short and long, respectively. Today, + the C concept of short and long integers need not coincide with this tra- + ditional misunderstanding. On machines which have a byte order which is + the same as the network order, routines are defined as null macros. + + The functions involving either ``be'', ``le'', or ``swap'' use the num- + bers 16 and 32 for specifying the bitwidth of the quantities they operate + on. Currently all supported architectures are either big- or little-en- + dian so either the ``be'' or ``le'' variants are implemented as null + macros. + + The routines mentioned above which have either {src-order} or {dst-order} + set to `n' are most often used in conjunction with Internet addresses and + ports as returned by gethostbyname(3) and getservent(3). + +SEE ALSO + gethostbyname(3), getservent(3) + +HISTORY + The byteorder functions appeared in 4.2BSD. + +BUGS + On the vax, alpha, i386, and so far mips, bytes are handled backwards + from most everyone else in the world. This is not expected to be fixed + in the near future. + +BSD Experimental June 4, 1993 2 + + + + + ETHERS + + +ETHERS(3) System Programmer's Manual ETHERS(3) + +NAME + ether_aton, ether_ntoa, ether_addr, ether_ntohost, ether_hostton, + ether_line - get ethers entry + +SYNOPSIS + #include <netinet/if_ether.h> + + char * + ether_ntoa(struct ether_addr *e) + + struct ether_addr * + ether_aton(char *s) + + int + ether_ntohost(char *hostname, struct ether_addr *e) + + int + ether_hostton(char *hostname, struct ether_addr *e) + + int + ether_line(char *l, struct ether_addr *e, char *hostname) + +DESCRIPTION + Ethernet addresses are represented by the following structure: + + struct ether_addr { + u_int8_t ether_addr_octet[6]; + }; + + The ether_ntoa() function converts this structure into an ASCII string of + the form ``xx:xx:xx:xx:xx:xx'', consisting of 6 hexadecimal numbers sepa- + rated by colons. It returns a pointer to a static buffer that is reused + for each call. The ether_aton() converts an ASCII string of the same + form and to a structure containing the 6 octets of the address. It re- + turns a pointer to a static structure that is reused for each call. + + The ether_ntohost() and ether_hostton() functions interrogate the + database mapping host names to Ethernet addresses, /etc/ethers. The + ether_ntohost() function looks up the given Ethernet address and writes + the associated host name into the character buffer passed. This buffer + should be MAXHOSTNAMELEN characters in size. The ether_hostton() func- + tion looks up the given host name and writes the associated Ethernet ad- + dress into the structure passed. Both functions return zero if they find + the requested host name or address, and -1 if not. + + Each call reads /etc/ethers from the beginning; if a `+' appears alone on + a line in the file, then ether_hostton() will consult the ethers.byname + YP map, and ether_ntohost() will consult the ethers.byaddr YP map. + + The ether_line() function parses a line from the /etc/ethers file and + fills in the passed struct ether_addr and character buffer with the Eth- + ernet address and host name on the line. It returns zero if the line was + successfully parsed and -1 if not. The character buffer should be + MAXHOSTNAMELEN characters in size. + +FILES + /etc/ethers + +SEE ALSO + ethers(5) + +HISTORY + The ether_ntoa(), ether_aton(), ether_ntohost(), ether_hostton(), and + ether_line() functions were adopted from SunOS and appeared in + +BUGS + The data space used by these functions is static; if future use requires + the data, it should be copied before any subsequent calls to these func- + tions overwrite it. + +BSD Experimental December 16, 1993 2 + + + + + GETADDRINFO + + +GETADDRINFO(3) System Programmer's Manual GETADDRINFO(3) + +NAME + getaddrinfo, freeaddrinfo, gai_strerror - nodename-to-address translation + in protocol-independent manner + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + #include <netdb.h> + + int + getaddrinfo(const char *nodename, const char *servname, + const struct addrinfo *hints, struct addrinfo **res) + + void + freeaddrinfo(struct addrinfo *ai) + + char * + gai_strerror(int ecode) + +DESCRIPTION + The getaddrinfo() function is defined for protocol-independent nodename- + to-address translation. It performs the functionality of gethostby- + name(3) and getservbyname(3), but in a more sophisticated manner. + + The addrinfo structure is defined as a result of including the <netdb.h> + header: + + struct addrinfo { * + int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for nodename */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ + }; + + The nodename and servname arguments are pointers to NUL-terminated + strings or NULL. One or both of these two arguments must be a non-null + pointer. In the normal client scenario, both the nodename and servname + are specified. In the normal server scenario, only the servname is spec- + ified. A non-null nodename string can be either a node name or a numeric + host address string (i.e., a dotted-decimal IPv4 address or an IPv6 hex + address). A non-null servname string can be either a service name or a + decimal port number. + + The caller can optionally pass an addrinfo structure, pointed to by the + third argument, to provide hints concerning the type of socket that the + caller supports. In this hints structure all members other than + ai_flags, ai_family, ai_socktype, and ai_protocol must be zero or a null + pointer. A value of PF_UNSPEC for ai_family means the caller will accept + any protocol family. A value of 0 for ai_socktype means the caller will + accept any socket type. A value of 0 for ai_protocol means the caller + will accept any protocol. For example, if the caller handles only TCP + and not UDP, then the ai_socktype member of the hints structure should be + set to SOCK_STREAM when getaddrinfo() is called. If the caller handles + only IPv4 and not IPv6, then the ai_family member of the hints structure + should be set to PF_INET when getaddrinfo() is called. If the third ar- + gument to getaddrinfo() is a null pointer, this is the same as if the + caller had filled in an addrinfo structure initialized to zero with + ai_family set to PF_UNSPEC. + + Upon successful return a pointer to a linked list of one or more addrinfo + structures is returned through the final argument. The caller can pro- + cess each addrinfo structure in this list by following the ai_next point- + er, until a null pointer is encountered. In each returned addrinfo + structure the three members ai_family, ai_socktype, and ai_protocol are + the corresponding arguments for a call to the socket() function. In each + addrinfo structure the ai_addr member points to a filled-in socket ad- + dress structure whose length is specified by the ai_addrlen member. + + If the AI_PASSIVE bit is set in the ai_flags member of the hints struc- + ture, then the caller plans to use the returned socket address structure + in a call to bind(). In this case, if the nodename argument is a null + pointer, then the IP address portion of the socket address structure will + be set to INADDR_ANY for an IPv4 address or IN6ADDR_ANY_INIT for an IPv6 + address. + + If the AI_PASSIVE bit is not set in the ai_flags member of the hints + structure, then the returned socket address structure will be ready for a + call to connect() (for a connection-oriented protocol) or either + connect(), sendto(), or sendmsg() (for a connectionless protocol). In + this case, if the nodename argument is a null pointer, then the IP ad- + dress portion of the socket address structure will be set to the loopback + address. + + If the AI_CANONNAME bit is set in the ai_flags member of the hints struc- + ture, then upon successful return the ai_canonname member of the first + addrinfo structure in the linked list will point to a NUL-terminated + string containing the canonical name of the specified nodename. + + If the AI_NUMERICHOST bit is set in the ai_flags member of the hints + structure, then a non-null nodename string must be a numeric host address + string. Otherwise an error of EAI_NONAME is returned. This flag pre- + vents any type of name resolution service (e.g., the DNS) from being + called. + + The arguments to getaddrinfo() must sufficiently be consistent and unam- + biguous. Here are pitfall cases you may encounter: + + o getaddrinfo() will raise an error if members of the hints structure + are not consistent. For example, for internet address families, + getaddrinfo() will raise an error if you specify SOCK_STREAM to + ai_socktype while you specify IPPROTO_UDP to ai_protocol. + + o If you specify a servname which is defined only for certain + ai_socktype, getaddrinfo() will raise an error because the arguments + are not consistent. For example, getaddrinfo() will raise an error + if you ask for ``tftp'' service on SOCK_STREAM. + + o For internet address families, if you specify servname while you set + ai_socktype to SOCK_RAW, getaddrinfo() will raise an error, because + service names are not defined for the internet SOCK_RAW space. + + o If you specify a numeric servname, while leaving ai_socktype and + ai_protocol unspecified, getaddrinfo() will raise an error. This is + because the numeric servname does not identify any socket type, and + getaddrinfo() is not allowed to glob the argument in such case. + + All of the information returned by getaddrinfo() is dynamically allocat- + ed: the addrinfo structures, the socket address structures, and canonical + node name strings pointed to by the addrinfo structures. To return this + information to the system the function freeaddrinfo() is called. The + addrinfo structure pointed to by the ai argument is freed, along with any + dynamic storage pointed to by the structure. This operation is repeated + until a NULL ai_next pointer is encountered. + + + To aid applications in printing error messages based on the EAI_xxx codes + returned by getaddrinfo(), gai_strerror() is defined. The argument is + one of the EAI_xxx values defined earlier and the return value points to + a string describing the error. If the argument is not one of the EAI_xxx + values, the function still returns a pointer to a string whose contents + indicate an unknown error. + + Extension for scoped IPv6 address + The implementation allows experimental numeric IPv6 address notation with + scope identifier. By appending the percent character and scope identifi- + er to addresses, you can fill sin6_scope_id field for addresses. This + would make management of scoped address easier, and allows cut-and-paste + input of scoped address. + + At this moment the code supports only link-local addresses with the for- + mat. Scope identifier is hardcoded to name of hardware interface associ- + ated with the link. (such as ne0). Example would be like + ``fe80::1%ne0'', which means ``fe80::1 on the link associated with ne0 + interface''. + + The implementation is still very experimental and non-standard. The cur- + rent implementation assumes one-by-one relationship between interface and + link, which is not necessarily true from the specification. + +EXAMPLES + The following code tries to connect to ``www.kame.net'' service ``http''. + via stream socket. It loops through all the addresses available, regard- + less from address family. If the destination resolves to IPv4 address, + it will use AF_INET socket. Similarly, if it resolves to IPv6, AF_INET6 + socket is used. Observe that there is no hardcoded reference to particu- + lar address family. The code works even if getaddrinfo returns addresses + that are not IPv4/v6. + + struct addrinfo hints, *res, *res0; + int error; + int s; + const char *cause = NULL; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo("www.kame.net", "http", &hints, &res0); + if (error) { + errx(1, "%s", gai_strerror(error)); + /*NOTREACHED*/ + } + s = -1; + for (res = res0; res; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (s < 0) { + cause = "socket"; + continue; + } + + if (connect(s, res->ai_addr, res->ai_addrlen) < 0) { + cause = "connect"; + close(s); + s = -1; + continue; + } + + break; /* okay we got one */ + } + if (s < 0) { + err(1, cause); + /*NOTREACHED*/ + } + freeaddrinfo(res0); + + The following example tries to open a wildcard listening socket onto ser- + vice ``http'', for all the address families available. + + struct addrinfo hints, *res, *res0; + int error; + int s[MAXSOCK]; + int nsock; + const char *cause = NULL; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + error = getaddrinfo(NULL, "http", &hints, &res0); + if (error) { + errx(1, "%s", gai_strerror(error)); + /*NOTREACHED*/ + } + nsock = 0; + for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) { + s[nsock] = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (s[nsock] < 0) { + cause = "socket"; + continue; + } + + if (bind(s[nsock], res->ai_addr, res->ai_addrlen) < 0) { + cause = "bind"; + close(s[nsock]); + continue; + } + (void) listen(s[nsock], 5); + + nsock++; + } + if (nsock == 0) { + err(1, cause); + /*NOTREACHED*/ + } + freeaddrinfo(res0); + +DIAGNOSTICS + Error return status from getaddrinfo() is zero on success and non-zero on + errors. Non-zero error codes are defined in <netdb.h>, and as follows: + + EAI_ADDRFAMILY Address family for nodename not supported. + EAI_AGAIN Temporary failure in name resolution. + EAI_BADFLAGS Invalid value for ai_flags. + EAI_FAIL Non-recoverable failure in name resolution. + EAI_FAMILY ai_family not supported. + EAI_MEMORY Memory allocation failure. + EAI_NODATA No address associated with nodename. + EAI_NONAME nodename nor servname provided, or not known. + EAI_SERVICE servname not supported for ai_socktype. + EAI_SOCKTYPE ai_socktype not supported. + EAI_SYSTEM System error returned in errno. + + If called with proper argument, gai_strerror() returns a pointer to a + string describing the given error code. If the argument is not one of + the EAI_xxx values, the function still returns a pointer to a string + whose contents indicate an unknown error. + +SEE ALSO + getnameinfo(3), gethostbyname(3), getservbyname(3), hosts(5), + resolv.conf(5), services(5), hostname(7), named(8) + + R. Gilligan, S. Thomson, J. Bound, and W. Stevens, Basic Socket Interface + Extensions for IPv6, RFC2553, March 1999. + + Tatsuya Jinmei, and Atsushi Onoe, An Extension of Format for IPv6 Scoped + Addresses, internet draft, draft-ietf-ipngwg-scopedaddr-format-02.txt, + work in progress material. + + Craig Metz, "Protocol Independence Using the Sockets API", Proceedings of + the freenix track: 2000 USENIX annual technical conference, June 2000. + +HISTORY + The implementation first appeared in WIDE Hydrangea IPv6 protocol stack + kit. + +STANDARDS + The getaddrinfo() function is defined in IEEE POSIX 1003.1g draft speci- + fication, and documented in ``Basic Socket Interface Extensions for + IPv6'' (RFC2553). + +BUGS + The current implementation is not thread-safe. + + The text was shamelessly copied from RFC2553. + +BSD Experimental May 25, 1995 5 + + + + + GETHOSTBYNAME + + +GETHOSTBYNAME(3) System Programmer's Manual GETHOSTBYNAME(3) + +NAME + gethostbyname, gethostbyname2, gethostbyaddr, gethostent, sethostent, + endhostent, hstrerror, herror - get network host entry + +SYNOPSIS + #include <netdb.h> + extern int h_errno; + + struct hostent * + gethostbyname(const char *name) + + struct hostent * + gethostbyname2(const char *name, int af) + + struct hostent * + gethostbyaddr(const char *addr, int len, int af) + + struct hostent * + gethostent(void) + + void + sethostent(int stayopen) + + void + endhostent(void) + + void + herror(const char *string) + + const char * + hstrerror(int err) + +DESCRIPTION + The gethostbyname() and gethostbyaddr() functions each return a pointer + to an object with the following structure describing an internet host + referenced by name or by address, respectively. This structure contains + either information obtained from the name server (i.e., resolver(3) and + named(8)), broken-out fields from a line in /etc/hosts, or database en- + tries supplied by the yp(8) system. resolv.conf(5) describes how the + particular database is chosen. + + struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ + }; + #define h_addr h_addr_list[0] /* address, for backward compatibility */ + + The members of this structure are: + + h_name Official name of the host. + + h_aliases A zero-terminated array of alternate names for the host. + + h_addrtype The type of address being returned. + + h_length The length, in bytes, of the address. + + h_addr_list A zero-terminated array of network addresses for the host. + + Host addresses are returned in network byte order. + + h_addr The first address in h_addr_list; this is for backward com- + patibility. + + The function gethostbyname() will search for the named host in the cur- + rent domain and its parents using the search lookup semantics detailed in + resolv.conf(5) and hostname(7). + + gethostbyname2() is an advanced form of gethostbyname() which allows + lookups in address families other than AF_INET, for example AF_INET6. + + The gethostbyaddr() function will search for the specified address of + length len in the address family af. The only address family currently + supported is AF_INET. + + The sethostent() function may be used to request the use of a connected + TCP socket for queries. If the stayopen flag is non-zero, this sets the + option to send all queries to the name server using TCP and to retain the + connection after each call to gethostbyname() or gethostbyaddr(). Other- + wise, queries are performed using UDP datagrams. + + The endhostent() function closes the TCP connection. + + The herror() function prints an error message describing the failure. If + its argument string is non-null, it is prepended to the message string + and separated from it by a colon (`:') and a space. The error message is + printed with a trailing newline. The contents of the error message is + the same as that returned by hstrerror() with argument h_errno. + +FILES + /etc/hosts + /etc/resolv.conf + +DIAGNOSTICS + Error return status from gethostbyname(), gethostbyname2(), and + gethostbyaddr() is indicated by return of a null pointer. The external + integer h_errno may then be checked to see whether this is a temporary + failure or an invalid or unknown host. + + The variable h_errno can have the following values: + + HOST_NOT_FOUND No such host is known. + + TRY_AGAIN This is usually a temporary error and means that the lo- + cal server did not receive a response from an authorita- + tive server. A retry at some later time may succeed. + + NO_RECOVERY Some unexpected server failure was encountered. This is + a non-recoverable error. + + NO_DATA The requested name is valid but does not have an IP ad- + dress; this is not a temporary error. This means that + the name is known to the name server but there is no ad- + dress associated with this name. Another type of request + to the name server using this domain name will result in + an answer; for example, a mail-forwarder may be regis- + tered for this domain. + +SEE ALSO + resolver(3), getaddrinfo(3), getnameinfo(3), hosts(5), + resolv.conf(5), hostname(7), named(8) + +CAVEAT + If the search routines in resolv.conf(5) decide to read the /etc/hosts + file, gethostent() and other functions will read the next line of the + file, re-opening the file if necessary. + + The sethostent() function opens and/or rewinds the file /etc/hosts. If + the stayopen argument is non-zero, the file will not be closed after each + call to gethostbyname(), gethostbyname2(), or gethostbyaddr(). + + The endhostent() function closes the file. + +HISTORY + The herror() function appeared in 4.3BSD. The endhostent(), + gethostbyaddr(), gethostbyname(), gethostent(), and sethostent() func- + tions appeared in 4.2BSD. + +BUGS + These functions use static data storage; if the data is needed for future + use, it should be copied before any subsequent calls overwrite it. Only + the Internet address formats are currently understood. + + YP does not support any address families other than AF_INET and uses the + traditional database format. + +BSD Experimental March 13, 1997 3 + + + + + GETIFADDRS + + +GETIFADDRS(3) System Programmer's Manual GETIFADDRS(3) + +NAME + getifaddrs - get interface addresses + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + #include <ifaddrs.h> + + int + getifaddrs(struct ifaddrs **ifap) + + void + freeifaddrs(struct ifaddrs *ifap) + +DESCRIPTION + The getifaddrs() function stores a reference to a linked list of the net- + work interfaces on the local machine in the memory referenced by ifap. + The list consists of ifaddrs structures, as defined in the include file + <ifaddrs.h>. The ifaddrs structure contains at least the following en- + tries: + + struct ifaddrs *ifa_next; /* Pointer to next struct */ + char *ifa_name; /* Interface name */ + u_int ifa_flags; /* Interface flags */ + struct sockaddr *ifa_addr; /* Interface address */ + struct sockaddr *ifa_netmask; /* Interface netmask */ + struct sockaddr *ifa_broadaddr; /* Interface broadcast address */ + struct sockaddr *ifa_dstaddr; /* P2P interface destination */ + void *ifa_data; /* Address specific data */ + + ifa_next + Contains a pointer to the next structure on the list. This field + is set to NULL in last structure on the list. + + ifa_name + Contains the interface name. + + ifa_flags + Contains the interface flags, as set by ifconfig(8). + + ifa_addr + References either the address of the interface or the link level + address of the interface, if one exists, otherwise it is NULL. + (The sa_family field of the ifa_addr field should be consulted to + determine the format of the ifa_addr address.) + + ifa_netmask + References the netmask associated with ifa_addr, if one is set, + otherwise it is NULL. + + ifa_broadaddr + This field, which should only be referenced for non-P2P inter- + faces, references the broadcast address associated with ifa_addr, + if one exists, otherwise it is NULL. + + ifa_dstaddr + References the destination address on a P2P interface, if one ex- + ists, otherwise it is NULL. + + ifa_data + References address family specific data. For AF_LINK addresses + it contains a pointer to the struct if_data (as defined in in- + clude file <net/if.h>) which contains various interface at- + tributes and statistics. For all other address families, it con- + tains a pointer to the struct ifa_data (as defined in include + file <net/if.h>) which contains per-address interface statistics. + + The data returned by getifaddrs() is dynamically allocated and should be + freed using freeifaddrs() when no longer needed. + +RETURN VALUES + Upon successful completion, a value of 0 is returned. Otherwise, a value + of -1 is returned and errno is set to indicate the error. + +ERRORS + The getifaddrs() may fail and set errno for any of the errors specified + for the library routines ioctl(2), socket(2), malloc(3), or sysctl(3). + + +BUGS + If both <net/if.h> and <ifaddrs.h> are being included, <net/if.h> must be + included before <ifaddrs.h>. + +SEE ALSO + ioctl(2), socket(2), sysctl(3), networking(4), ifconfig(8) + +HISTORY + The getifaddrs() function first appeared in BSDI BSD/OS. The function is + supplied on since + + January 4, 2002 2 + + + + + GETNAMEINFO + + +GETNAMEINFO(3) System Programmer's Manual GETNAMEINFO(3) + +NAME + getnameinfo - address-to-nodename translation in protocol-independent + manner + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + #include <netdb.h> + + int + getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, + size_t hostlen, char *serv, size_t servlen, int flags) + +DESCRIPTION + The getnameinfo() function is defined for protocol-independent address- + to-nodename translation. Its functionality is a reverse conversion of + getaddrinfo(3), and implements similar functionality with gethostbyad- + dr(3) and getservbyport(3) in more sophisticated manner. + + This function looks up an IP address and port number provided by the + caller in the DNS and system-specific database, and returns text strings + for both in buffers provided by the caller. The function indicates suc- + cessful completion by a zero return value; a non-zero return value indi- + cates failure. + + The first argument, sa, points to either a sockaddr_in structure (for + IPv4) or a sockaddr_in6 structure (for IPv6) that holds the IP address + and port number. The salen argument gives the length of the sockaddr_in + or sockaddr_in6 structure. + + The function returns the nodename associated with the IP address in the + buffer pointed to by the host argument. The caller provides the size of + this buffer via the hostlen argument. The service name associated with + the port number is returned in the buffer pointed to by serv, and the + servlen argument gives the length of this buffer. The caller specifies + not to return either string by providing a zero value for the hostlen or + servlen arguments. Otherwise, the caller must provide buffers large + enough to hold the nodename and the service name, including the terminat- + ing null characters. + + Unfortunately most systems do not provide constants that specify the max- + imum size of either a fully-qualified domain name or a service name. + Therefore to aid the application in allocating buffers for these two re- + turned strings the following constants are defined in <netdb.h>: + + #define NI_MAXHOST MAXHOSTNAMELEN + #define NI_MAXSERV 32 + + The first value is actually defined as the constant MAXDNAME in recent + versions of BIND's <arpa/nameser.h> header (older versions of BIND define + this constant to be 256) and the second is a guess based on the services + listed in the current Assigned Numbers RFC. + + The final argument is a flag that changes the default actions of this + function. By default the fully-qualified domain name (FQDN) for the host + is looked up in the DNS and returned. If the flag bit NI_NOFQDN is set, + only the nodename portion of the FQDN is returned for local hosts. + + If the flag bit NI_NUMERICHOST is set, or if the host's name cannot be + located in the DNS, the numeric form of the host's address is returned + instead of its name (e.g., by calling inet_ntop() instead of + gethostbyaddr()). If the flag bit NI_NAMEREQD is set, an error is re- + turned if the host's name cannot be located in the DNS. + + If the flag bit NI_NUMERICSERV is set, the numeric form of the service + address is returned (e.g., its port number) instead of its name. The two + NI_NUMERICxxx flags are required to support the -n flag that many com- + mands provide. + + A fifth flag bit, NI_DGRAM, specifies that the service is a datagram ser- + vice, and causes getservbyport() to be called with a second argument of + "udp" instead of its default of "tcp". This is required for the few ports + (512-514) that have different services for UDP and TCP. + + These NI_xxx flags are defined in <netdb.h>. + + Extension for scoped IPv6 address + The implementation allows experimental numeric IPv6 address notation with + scope identifier. IPv6 link-local address will appear as string like + ``fe80::1%ne0'', if NI_WITHSCOPEID bit is enabled in flags argument. Re- + fer to getaddrinfo(3) for the notation. + +EXAMPLES + The following code tries to get numeric hostname, and service name, for + given socket address. Observe that there is no hardcoded reference to + particular address family. + + struct sockaddr *sa; /* input */ + char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; + + if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), sbuf, + sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV)) { + errx(1, "could not get numeric hostname"); + /*NOTREACHED*/ + } + printf("host=%s, serv=%s\n", hbuf, sbuf); + + The following version checks if the socket address has reverse address + mapping. + + struct sockaddr *sa; /* input */ + char hbuf[NI_MAXHOST]; + + if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0, + NI_NAMEREQD)) { + errx(1, "could not resolve hostname"); + /*NOTREACHED*/ + } + printf("host=%s\n", hbuf); + +DIAGNOSTICS + The function indicates successful completion by a zero return value; a + non-zero return value indicates failure. Error codes are as below: + + EAI_AGAIN The name could not be resolved at this time. Future at- + tempts may succeed. + + EAI_BADFLAGS The flags had an invalid value. + + EAI_FAIL A non-recoverable error occurred. + + EAI_FAMILY The address family was not recognized or the address length + was invalid for the specified family. + + EAI_MEMORY There was a memory allocation failure. + + EAI_NONAME The name does not resolve for the supplied parameters. + NI_NAMEREQD is set and the host's name cannot be located, + + or both nodename and servname were null. + + EAI_SYSTEM A system error occurred. The error code can be found in + errno. + +SEE ALSO + getaddrinfo(3), gethostbyaddr(3), getservbyport(3), hosts(5), + resolv.conf(5), services(5), hostname(7), named(8) + + R. Gilligan, S. Thomson, J. Bound, and W. Stevens, Basic Socket Interface + Extensions for IPv6, RFC2553, March 1999. + + Tatsuya Jinmei, and Atsushi Onoe, An Extension of Format for IPv6 Scoped + Addresses, internet draft, draft-ietf-ipngwg-scopedaddr-format-02.txt, + work in progress material. + + Craig Metz, "Protocol Independence Using the Sockets API", Proceedings of + the freenix track: 2000 USENIX annual technical conference, June 2000. + +HISTORY + The implementation first appeared in WIDE Hydrangea IPv6 protocol stack + kit. + +STANDARDS + The getaddrinfo() function is defined IEEE POSIX 1003.1g draft specifica- + tion, and documented in ``Basic Socket Interface Extensions for IPv6'' + (RFC2553). + +BUGS + The current implementation is not thread-safe. + + The text was shamelessly copied from RFC2553. + + intentionally uses different NI_MAXHOST value from what RFC2553 suggests, + to avoid buffer length handling mistakes. + +BSD Experimental May 25, 1995 3 + + + + + GETNETENT + + +GETNETENT(3) System Programmer's Manual GETNETENT(3) + +NAME + getnetent, getnetbyaddr, getnetbyname, setnetent, endnetent - get network + entry + +SYNOPSIS + #include <netdb.h> + + struct netent * + getnetent(void) + + struct netent * + getnetbyname(char *name) + + struct netent * + getnetbyaddr(in_addr_t net, int type) + + void + setnetent(int stayopen) + + void + endnetent(void) + +DESCRIPTION + The getnetent(), getnetbyname(), and getnetbyaddr() functions each return + a pointer to an object with the following structure containing the bro- + ken-out fields of a line in the network database, /etc/networks. + + struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net number type */ + in_addr_t n_net; /* net number */ + }; + + The members of this structure are: + + n_name The official name of the network. + + n_aliases A zero-terminated list of alternate names for the network. + + n_addrtype The type of the network number returned; currently only + AF_INET. + + n_net The network number. Network numbers are returned in machine + byte order. + + The getnetent() function reads the next line of the file, opening the + file if necessary. + + The setnetent() function opens and rewinds the file. If the stayopen + flag is non-zero, the net database will not be closed after each call to + getnetbyname() or getnetbyaddr(). + + The endnetent() function closes the file. + + The getnetbyname() and getnetbyaddr() functions search the domain name + server if the system is configured to use one. If the search fails, or + no name server is configured, they sequentially search from the beginning + of the file until a matching net name or net address and type is found, + or until EOF is encountered. Network numbers are supplied in host order. + +FILES + + /etc/networks + +DIAGNOSTICS + Null pointer (0) returned on EOF or error. + +SEE ALSO + resolver(3), networks(5) + +HISTORY + The getnetent(), getnetbyaddr(), getnetbyname(), setnetent(), and + endnetent() functions appeared in 4.2BSD. + +BUGS + The data space used by these functions is static; if future use requires + the data, it should be copied before any subsequent calls to these func- + tions overwrite it. Only Internet network numbers are currently under- + stood. Expecting network numbers to fit in no more than 32 bits is + naive. + +BSD Experimental March 13, 1997 2 + + + + + GETPROTOENT + + +GETPROTOENT(3) System Programmer's Manual GETPROTOENT(3) + +NAME + getprotoent, getprotobynumber, getprotobyname, setprotoent, endprotoent - + get protocol entry + +SYNOPSIS + #include <netdb.h> + + struct protoent * + getprotoent(void) + + struct protoent * + getprotobyname(char *name) + + struct protoent * + getprotobynumber(int proto) + + void + setprotoent(int stayopen) + + void + endprotoent(void) + +DESCRIPTION + The getprotoent(), getprotobyname(), and getprotobynumber() functions + each return a pointer to an object with the following structure contain- + ing the broken-out fields of a line in the network protocol database, + /etc/protocols. + + + struct protoent { + char *p_name; /* official name of protocol */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol number */ + }; + + The members of this structure are: + + p_name The official name of the protocol. + + p_aliases A zero-terminated list of alternate names for the protocol. + + p_proto The protocol number. + + The getprotoent() function reads the next line of the file, opening the + file if necessary. + + The setprotoent() function opens and rewinds the file. If the stayopen + flag is non-zero, the net database will not be closed after each call to + getprotobyname() or getprotobynumber(). + + The endprotoent() function closes the file. + + The getprotobyname() and getprotobynumber() functions sequentially search + from the beginning of the file until a matching protocol name or protocol + number is found, or until EOF is encountered. + +RETURN VALUES + Null pointer (0) returned on EOF or error. + +FILES + + + /etc/protocols + +SEE ALSO + protocols(5) + +HISTORY + The getprotoent(), getprotobynumber(), getprotobyname(), setprotoent(), + and endprotoent() functions appeared in 4.2BSD. + +BUGS + These functions use a static data space; if the data is needed for future + use, it should be copied before any subsequent calls overwrite it. Only + the Internet protocols are currently understood. + +BSD Experimental June 4, 1993 2 + + + + + GETRRSETBYNAME + + +GETRRSETBYNAME(3) System Programmer's Manual GETRRSETBYNAME(3) + +NAME + getrrsetbyname - retrieve DNS records + +SYNOPSIS + #include <netdb.h> + + int + getrrsetbyname(const char *hostname, unsigned int rdclass, + unsigned int rdtype, unsigned int flags, struct rrsetinfo **res) + + int + freerrset(struct rrsetinfo **rrset) + +DESCRIPTION + getrrsetbyname() gets a set of resource records associated with a + hostname, class and type. hostname is a pointer a to null-terminated + string. The flags field is currently unused and must be zero. + + After a successful call to getrrsetbyname(), *res is a pointer to an + rrsetinfo structure, containing a list of one or more rdatainfo struc- + tures containing resource records and potentially another list of + rdatainfo structures containing SIG resource records associated with + those records. The members rri_rdclass and rri_rdtype are copied from + the parameters. rri_ttl and rri_name are properties of the obtained + rrset. The resource records contained in rri_rdatas and rri_sigs are in + uncompressed DNS wire format. Properties of the rdataset are represented + in the rri_flags bitfield. If the RRSET_VALIDATED bit is set, the data + has been DNSSEC validated and the signatures verified. + + The following structures are used: + + struct rdatainfo { + unsigned int rdi_length; /* length of data */ + unsigned char *rdi_data; /* record data */ + }; + + struct rrsetinfo { + unsigned int rri_flags; /* RRSET_VALIDATED ... */ + unsigned int rri_rdclass; /* class number */ + unsigned int rri_rdtype; /* RR type number */ + unsigned int rri_ttl; /* time to live */ + unsigned int rri_nrdatas; /* size of rdatas array */ + unsigned int rri_nsigs; /* size of sigs array */ + char *rri_name; /* canonical name */ + struct rdatainfo *rri_rdatas; /* individual records */ + struct rdatainfo *rri_sigs; /* individual signatures */ + }; + + All of the information returned by getrrsetbyname() is dynamically allo- + cated: the rrsetinfo and rdatainfo structures, and the canonical host + name strings pointed to by the rrsetinfostructure. Memory allocated for + the dynamically allocated structures created by a successful call to + getrrsetbyname() is released by freerrset(). rrset is a pointer to a + struct rrset created by a call to getrrsetbyname(). + + If the EDNS0 option is activated in resolv.conf(3), getrrsetbyname() + will request DNSSEC authentication using the EDNS0 DNSSEC OK (DO) bit. + +RETURN VALUES + getrrsetbyname() returns zero on success, and one of the following error + codes if an error occurred: + + + ERRSET_NONAME the name does not exist + ERRSET_NODATA the name exists, but does not have data of the desired + type + ERRSET_NOMEMORY memory could not be allocated + ERRSET_INVAL a parameter is invalid + ERRSET_FAIL other failure + +SEE ALSO + resolver(3), resolv.conf(5), named(8) + +AUTHORS + Jakob Schlyter <jakob@openbsd.org> + +HISTORY + getrrsetbyname() first appeared in The API first appeared in ISC BIND + version 9. + +BUGS + The data in *rdi_data should be returned in uncompressed wire format. + Currently, the data is in compressed format and the caller can't uncom- + press since it doesn't have the full message. + +CAVEATS + The RRSET_VALIDATED flag in rri_flags is set if the AD (autenticated da- + ta) bit in the DNS answer is set. This flag should not be trusted unless + the transport between the nameserver and the resolver is secure (e.g. + IPsec, trusted network, loopback communication). + +BSD Experimental Oct 18, 2000 2 + + + + + GETSERVENT + + +GETSERVENT(3) System Programmer's Manual GETSERVENT(3) + +NAME + getservent, getservbyport, getservbyname, setservent, endservent - get + service entry + +SYNOPSIS + #include <netdb.h> + + struct servent * + getservent(void) + + struct servent * + getservbyname(char *name, char *proto) + + struct servent * + getservbyport(int port, char *proto) + + void + setservent(int stayopen) + + void + endservent(void) + +DESCRIPTION + The getservent(), getservbyname(), and getservbyport() functions each re- + turn a pointer to an object with the following structure containing the + broken-out fields of a line in the network services database, + /etc/services. + + struct servent { + char *s_name; /* official name of service */ + char **s_aliases; /* alias list */ + int s_port; /* port service resides at */ + char *s_proto; /* protocol to use */ + }; + + The members of this structure are: + + s_name The official name of the service. + + s_aliases A zero-terminated list of alternate names for the service. + + s_port The port number at which the service resides. Port numbers + are returned in network byte order. + + s_proto The name of the protocol to use when contacting the service. + + The getservent() function reads the next line of the file, opening the + file if necessary. + + The setservent() function opens and rewinds the file. If the stayopen + flag is non-zero, the net database will not be closed after each call to + getservbyname() or getservbyport(). + + The endservent() function closes the file. + + The getservbyname() and getservbyport() functions sequentially search + from the beginning of the file until a matching protocol name or port + number (specified in network byte order) is found, or until EOF is en- + countered. If a protocol name is also supplied (non-null), searches must + also match the protocol. + +FILES + + /etc/services + +DIAGNOSTICS + Null pointer (0) returned on EOF or error. + +SEE ALSO + getprotoent(3), services(5) + +HISTORY + The getservent(), getservbyport(), getservbyname(), setservent(), and + endservent() functions appeared in 4.2BSD. + +BUGS + These functions use static data storage; if the data is needed for future + use, it should be copied before any subsequent calls overwrite it. Ex- + pecting port numbers to fit in a 32-bit quantity is probably naive. + +BSD Experimental January 12, 1994 2 + + + + + IF_NAMETOINDEX + + +IF_NAMETOINDEX(3) System Programmer's Manual IF_NAMETOINDEX(3) + +NAME + if_nametoindex, if_indextoname, if_nameindex, if_freenameindex - convert + interface index to name, and vice versa + +SYNOPSIS + #include <net/if.h> + + unsigned int + if_nametoindex(const char *ifname) + + char * + if_indextoname(unsigned int ifindex, char *ifname) + + struct if_nameindex * + if_nameindex(void) + + void + if_freenameindex(struct if_nameindex *ptr) + +DESCRIPTION + These functions map interface indexes to interface names (such as + ``lo0''), and vice versa. + + The if_nametoindex() function converts an interface name specified by the + ifname argument to an interface index (positive integer value). If the + specified interface does not exist, 0 will be returned. + + if_indextoname() converts an interface index specified by the ifindex ar- + gument to an interface name. The ifname argument must point to a buffer + of at least IF_NAMESIZE bytes into which the interface name corresponding + to the specified index is returned. (IF_NAMESIZE is also defined in + <net/if.h> and its value includes a terminating null byte at the end of + the interface name.) This pointer is also the return value of the func- + tion. If there is no interface corresponding to the specified index, + NULL is returned. + + if_nameindex() returns an array of if_nameindex structures. + if_nametoindex is also defined in <net/if.h>, and is as follows: + + struct if_nameindex { + unsigned int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "le0", ... */ + }; + + The end of the array of structures is indicated by a structure with an + if_index of 0 and an if_name of NULL. The function returns a null pointer + on error. The memory used for this array of structures along with the + interface names pointed to by the if_name members is obtained dynamical- + ly. This memory is freed by the if_freenameindex() function. + + if_freenameindex() takes a pointer that was returned by if_nameindex() as + argument (ptr), and it reclaims the region allocated. + +DIAGNOSTICS + if_nametoindex() returns 0 on error, positive integer on success. + if_indextoname() and if_nameindex() return NULL on errors. + +SEE ALSO + R. Gilligan, S. Thomson, J. Bound, and W. Stevens, ``Basic Socket Inter- + face Extensions for IPv6,'' RFC2553, March 1999. + +STANDARDS + These functions are defined in ``Basic Socket Interface Extensions for + IPv6'' (RFC2533). + +BSD Experimental May 21, 1998 2 + + + + + INET + + +INET(3) System Programmer's Manual INET(3) + +NAME + inet_addr, inet_aton, inet_lnaof, inet_makeaddr, inet_netof, + inet_network, inet_ntoa, inet_ntop, inet_pton - Internet address manipu- + lation routines + +SYNOPSIS + #include <sys/socket.h> + #include <netinet/in.h> + #include <arpa/inet.h> + + in_addr_t + inet_addr(const char *cp) + + int + inet_aton(const char *cp, struct in_addr *addr) + + in_addr_t + inet_lnaof(struct in_addr in) + + struct in_addr + inet_makeaddr(unsigned long net, unsigned long lna) + + in_addr_t + inet_netof(struct in_addr in) + + in_addr_t + inet_network(const char *cp) + + char * + inet_ntoa(struct in_addr in) + + const char * + inet_ntop(int af, const void *src, char *dst, size_t size) + + int + inet_pton(int af, const char *src, void *dst) + +DESCRIPTION + The routines inet_aton(), inet_addr() and inet_network() interpret char- + acter strings representing numbers expressed in the Internet standard `.' + notation. The inet_pton() function converts a presentation format ad- + dress (that is, printable form as held in a character string) to network + format (usually a struct in_addr or some other internal binary represen- + tation, in network byte order). It returns 1 if the address was valid + for the specified address family, or 0 if the address wasn't parseable in + the specified address family, or -1 if some system error occurred (in + which case errno will have been set). This function is presently valid + for AF_INET and AF_INET6. The inet_aton() routine interprets the speci- + fied character string as an Internet address, placing the address into + the structure provided. It returns 1 if the string was successfully in- + terpreted, or 0 if the string was invalid. The inet_addr() and + inet_network() functions return numbers suitable for use as Internet ad- + dresses and Internet network numbers, respectively. + + The function inet_ntop() converts an address from network format (usually + a struct in_addr or some other binary form, in network byte order) to + presentation format (suitable for external display purposes). It returns + NULL if a system error occurs (in which case, errno will have been set), + or it returns a pointer to the destination string. The routine + inet_ntoa() takes an Internet address and returns an ASCII string repre- + senting the address in `.' notation. The routine inet_makeaddr() takes + an Internet network number and a local network address and constructs an + Internet address from it. The routines inet_netof() and inet_lnaof() + break apart Internet host addresses, returning the network number and lo- + cal network address part, respectively. + + All Internet addresses are returned in network order (bytes ordered from + left to right). All network numbers and local address parts are returned + as machine format integer values. + +INTERNET ADDRESSES (IP VERSION 4) + Values specified using the `.' notation take one of the following forms: + + a.b.c.d + a.b.c + a.b + a + + When four parts are specified, each is interpreted as a byte of data and + assigned, from left to right, to the four bytes of an Internet address. + Note that when an Internet address is viewed as a 32-bit integer quantity + on a system that uses little-endian byte order (such as the Intel 386, + 486 and Pentium processors) the bytes referred to above appear as + ``d.c.b.a''. That is, little-endian bytes are ordered from right to left. + + When a three part address is specified, the last part is interpreted as a + 16-bit quantity and placed in the rightmost two bytes of the network ad- + dress. This makes the three part address format convenient for specify- + ing Class B network addresses as ``128.net.host''. + + When a two part address is supplied, the last part is interpreted as a + 24-bit quantity and placed in the rightmost three bytes of the network + address. This makes the two part address format convenient for specify- + ing Class A network addresses as ``net.host''. + + When only one part is given, the value is stored directly in the network + address without any byte rearrangement. + + All numbers supplied as ``parts'' in a `.' notation may be decimal, oc- + tal, or hexadecimal, as specified in the C language (i.e., a leading 0x + or 0X implies hexadecimal; otherwise, a leading 0 implies octal; other- + wise, the number is interpreted as decimal). + +INTERNET ADDRESSES (IP VERSION 6) + In order to support scoped IPv6 addresses, getaddrinfo(3) and getnamein- + fo(3) are recommended rather than the functions presented here. + + The presentation format of an IPv6 address is given in [RFC1884 2.2]: + + There are three conventional forms for representing IPv6 addresses as + text strings: + + 1. The preferred form is x:x:x:x:x:x:x:x, where the 'x's are the hex- + adecimal values of the eight 16-bit pieces of the address. Exam- + ples: + + FEDC:BA98:7654:3210:FEDC:BA98:7654:3210 + 1080:0:0:0:8:800:200C:417A + + Note that it is not necessary to write the leading zeros in an indi- + vidual field, but there must be at least one numeral in every field + (except for the case described in 2.). + + 2. Due to the method of allocating certain styles of IPv6 addresses, it + will be common for addresses to contain long strings of zero bits. + In order to make writing addresses + + + containing zero bits easier a special syntax is available to com- + press the zeros. The use of ``::'' indicates multiple groups of 16 + bits of zeros. The ``::'' can only appear once in an address. The + ``::'' can also be used to compress the leading and/or trailing ze- + ros in an address. + + For example the following addresses: + + 1080:0:0:0:8:800:200C:417A a unicast address + FF01:0:0:0:0:0:0:43 a multicast address + 0:0:0:0:0:0:0:1 the loopback address + 0:0:0:0:0:0:0:0 the unspecified addresses + + may be represented as: + + 1080::8:800:200C:417A a unicast address + FF01::43 a multicast address + ::1 the loopback address + :: the unspecified addresses + + 3. An alternative form that is sometimes more convenient when dealing + with a mixed environment of IPv4 and IPv6 nodes is + x:x:x:x:x:x:d.d.d.d, where the 'x's are the hexadecimal values of + the six high-order 16-bit pieces of the address, and the 'd's are + the decimal values of the four low-order 8-bit pieces of the address + (standard IPv4 representation). Examples: + + 0:0:0:0:0:0:13.1.68.3 + 0:0:0:0:0:FFFF:129.144.52.38 + + or in compressed form: + + ::13.1.68.3 + ::FFFF:129.144.52.38 + +DIAGNOSTICS + The constant INADDR_NONE is returned by inet_addr() and inet_network() + for malformed requests. + +SEE ALSO + byteorder(3), gethostbyname(3), getnetent(3), inet_net(3), hosts(5), + networks(5) + +STANDARDS + The inet_ntop and inet_pton functions conforms to the IETF IPv6 BSD API + and address formatting specifications. Note that inet_pton does not ac- + cept 1-, 2-, or 3-part dotted addresses; all four parts must be speci- + fied. This is a narrower input set than that accepted by inet_aton. + +HISTORY + The inet_addr, inet_network, inet_makeaddr, inet_lnaof and inet_netof + functions appeared in 4.2BSD. The inet_aton and inet_ntoa functions ap- + peared in 4.3BSD. The inet_pton and inet_ntop functions appeared in BIND + 4.9.4. + +BUGS + The value INADDR_NONE (0xffffffff) is a valid broadcast address, but + inet_addr() cannot return that value without indicating failure. Also, + inet_addr() should have been designed to return a struct in_addr. The + newer inet_aton() function does not share these problems, and almost all + existing code should be modified to use inet_aton() instead. + + The problem of host byte ordering versus network byte ordering is confus- + ing. + + + The string returned by inet_ntoa() resides in a static memory area. + + + + + INET6_OPTION_SPACE + + +INET6_OPTION_SPACE(3) System Programmer's Manual INET6_OPTION_SPACE(3) + +NAME + inet6_option_space, inet6_option_init, inet6_option_append, + inet6_option_alloc, inet6_option_next, inet6_option_find - IPv6 Hop-by- + Hop and Destination Options manipulation + +SYNOPSIS + #include <netinet/in.h> + + int + inet6_option_space(int nbytes) + + int + inet6_option_init(void *bp, struct cmsghdr **cmsgp, int type) + + int + inet6_option_append(struct cmsghdr *cmsg, const u_int8_t *typep, + int multx, int plusy) + + u_int8_t * + inet6_option_alloc(struct cmsghdr *cmsg, int datalen, int multx, + int plusy); + + int + inet6_option_next(const struct cmsghdr *cmsg, u_int8_t **tptrp) + + int + inet6_option_find(const struct cmsghdr *cmsg, u_int8_t **tptrp, int type) + +DESCRIPTION + Building and parsing the Hop-by-Hop and Destination options is complicat- + ed due to alignment constranints, padding and ancillary data manipula- + tion. RFC2292 defines a set of functions to help the application. The + function prototypes for these functions are all in the <netinet/in.h> + header. + + inet6_option_space + inet6_option_space() returns the number of bytes required to hold an op- + tion when it is stored as ancillary data, including the cmsghdr structure + at the beginning, and any padding at the end (to make its size a multiple + of 8 bytes). The argument is the size of the structure defining the op- + tion, which must include any pad bytes at the beginning (the value y in + the alignment term ``xn + y''), the type byte, the length byte, and the + option data. + + Note: If multiple options are stored in a single ancillary data object, + which is the recommended technique, this function overestimates the + amount of space required by the size of N-1 cmsghdr structures, where N + is the number of options to be stored in the object. This is of little + consequence, since it is assumed that most Hop-by-Hop option headers and + Destination option headers carry only one option (appendix B of + [RFC-2460]). + + inet6_option_init + inet6_option_init() is called once per ancillary data object that will + contain either Hop-by-Hop or Destination options. It returns 0 on suc- + cess or -1 on an error. + + bp is a pointer to previously allocated space that will contain the an- + cillary data object. It must be large enough to contain all the individ- + ual options to be added by later calls to inet6_option_append() and + inet6_option_alloc(). + + + cmsgp is a pointer to a pointer to a cmsghdr structure. *cmsgp is ini- + tialized by this function to point to the cmsghdr structure constructed + by this function in the buffer pointed to by bp. + + type is either IPV6_HOPOPTS or IPV6_DSTOPTS. This type is stored in the + cmsg_type member of the cmsghdr structure pointed to by *cmsgp. + + inet6_option_append + This function appends a Hop-by-Hop option or a Destination option into an + ancillary data object that has been initialized by inet6_option_init(). + This function returns 0 if it succeeds or -1 on an error. + + cmsg is a pointer to the cmsghdr structure that must have been initial- + ized by inet6_option_init(). + + typep is a pointer to the 8-bit option type. It is assumed that this + field is immediately followed by the 8-bit option data length field, + which is then followed immediately by the option data. The caller ini- + tializes these three fields (the type-length-value, or TLV) before call- + ing this function. + + The option type must have a value from 2 to 255, inclusive. (0 and 1 are + reserved for the Pad1 and PadN options, respectively.) + + The option data length must have a value between 0 and 255, inclusive, + and is the length of the option data that follows. + + multx is the value x in the alignment term ``xn + y''. It must have a + value of 1, 2, 4, or 8. + + plusy is the value y in the alignment term ``xn + y''. It must have a + value between 0 and 7, inclusive. + + inet6_option_alloc + This function appends a Hop-by-Hop option or a Destination option into an + ancillary data object that has been initialized by inet6_option_init(). + This function returns a pointer to the 8-bit option type field that + starts the option on success, or NULL on an error. + + The difference between this function and inet6_option_append() is that + the latter copies the contents of a previously built option into the an- + cillary data object while the current function returns a pointer to the + space in the data object where the option's TLV must then be built by the + caller. + + cmsg is a pointer to the cmsghdr structure that must have been initial- + ized by inet6_option_init(). + + datalen is the value of the option data length byte for this option. + This value is required as an argument to allow the function to determine + if padding must be appended at the end of the option. argument since + the option data length must already be stored by the caller. (The + inet6_option_append() function does not need a data length) + + multx is the value x in the alignment term ``xn + y''. It must have a + value of 1, 2, 4, or 8. + + plusy is the value y in the alignment term ``xn + y''. It must have a + value between 0 and 7, inclusive. + + inet6_option_next + This function processes the next Hop-by-Hop option or Destination option + in an ancillary data object. If another option remains to be processed, + the return value of the function is 0 and *tptrp points to the 8-bit op- + tion type field the option data (which is followed by the 8-bit option + data length, followed by). If no more options remain to be processed, the + return value is -1 and *tptrp is NULL. If an error occurs, the return + value is -1 and *tptrp is not NULL. + + cmsg is a pointer to cmsghdr structure of which cmsg_level equals + IPPROTO_IPV6 and cmsg_type equals either IPV6_HOPOPTS or IPV6_DSTOPTS. + + tptrp is a pointer to a pointer to an 8-bit byte and *tptrp is used by + the function to remember its place in the ancillary data object each time + the function is called. The first time this function is called for a + given ancillary data object, *tptrp must be set to NULL. + + Each time this function returns success, *tptrp points to the 8-bit op- + tion type field for the next option to be processed. + + inet6_option_find + This function is similar to the previously described inet6_option_next() + function, except this function lets the caller specify the option type to + be searched for, instead of always returning the next option in the an- + cillary data object. cmsg is a pointer to cmsghdr structure of which + cmsg_level equals IPPROTO_IPV6 and cmsg_type equals either IPV6_HOPOPTS + or IPV6_DSTOPTS. + + tptrp is a pointer to a pointer to an 8-bit byte and *tptrp is used by + the function to remember its place in the ancillary data object each time + the function is called. The first time this function is called for a + given ancillary data object, *tptrp must be set to NULL. ~ This function + starts searching for an option of the specified type beginning after the + value of *tptrp. If an option of the specified type is located, this + function returns 0 and *tptrp points to the 8- bit option type field for + the option of the specified type. If an option of the specified type is + not located, the return value is -1 and *tptrp is NULL. If an error oc- + curs, the return value is -1 and *tptrp is not NULL. + +DIAGNOSTICS + inet6_option_init() and inet6_option_append() return 0 on success or -1 + on an error. + + inet6_option_alloc() returns NULL on an error. + + On errors, inet6_option_next() and inet6_option_find() return -1 setting + *tptrp to non NULL value. + +EXAMPLES + RFC2292 gives comprehensive examples in chapter 6. + +SEE ALSO + W. Stevens, and M. Thomas, Advanced Sockets API for IPv6, RFC2292, + February 1998. + + S. Deering, and R. Hinden, Internet Protocol, Version 6 (IPv6) + Specification, RFC2460, December 1998. + +HISTORY + The implementation first appeared in KAME advanced networking kit. + +STANDARDS + The functions are documented in ``Advanced Sockets API for IPv6'' + (RFC2292). + +BUGS + The text was shamelessly copied from RFC2292. + +BSD Experimental December 10, 1999 3 + + + + + INET6_RTHDR_SPACE + + +INET6_RTHDR_SPACE(3) System Programmer's Manual INET6_RTHDR_SPACE(3) + +NAME + inet6_rthdr_space, inet6_rthdr_init, inet6_rthdr_add, + inet6_rthdr_lasthop, inet6_rthdr_reverse, inet6_rthdr_segments, + inet6_rthdr_getaddr, inet6_rthdr_getflags - IPv6 Routing Header Options + manipulation + +SYNOPSIS + #include <netinet/in.h> + + size_t + inet6_rthdr_space(int type, int segments) + + struct cmsghdr * + inet6_rthdr_init(void *bp, int type) + + int + inet6_rthdr_add(struct cmsghdr *cmsg, const struct in6_addr *addr, + unsigned int flags) + + int + inet6_rthdr_lasthop(struct cmsghdr *cmsg, unsigned int flags) + + int + inet6_rthdr_reverse(const struct cmsghdr *in, struct cmsghdr *out) + + int + inet6_rthdr_segments(const struct cmsghdr *cmsg) + + struct in6_addr * + inet6_rthdr_getaddr(struct cmsghdr *cmsg, int index) + + int + inet6_rthdr_getflags(const struct cmsghdr *cmsg, int index) + +DESCRIPTION + RFC2292 IPv6 advanced API defines eight functions that the application + calls to build and examine a Routing header. Four functions build a + Routing header: + + inet6_rthdr_space() return #bytes required for ancillary data + + inet6_rthdr_init() initialize ancillary data for Routing header + + inet6_rthdr_add() add IPv6 address & flags to Routing header + + inet6_rthdr_lasthop() specify the flags for the final hop + + Four functions deal with a returned Routing header: + + inet6_rthdr_reverse() reverse a Routing header + + inet6_rthdr_segments() return #segments in a Routing header + + inet6_rthdr_getaddr() fetch one address from a Routing header + + inet6_rthdr_getflags() fetch one flag from a Routing header + + The function prototypes for these functions are all in the <netinet/in.h> + header. + + inet6_rthdr_space + This function returns the number of bytes required to hold a Routing + header of the specified type containing the specified number of segments + (addresses). For an IPv6 Type 0 Routing header, the number of segments + must be between 1 and 23, inclusive. The return value includes the size + of the cmsghdr structure that precedes the Routing header, and any re- + quired padding. + + If the return value is 0, then either the type of the Routing header is + not supported by this implementation or the number of segments is invalid + for this type of Routing header. + + Note: This function returns the size but does not allocate the space re- + quired for the ancillary data. This allows an application to allocate a + larger buffer, if other ancillary data objects are desired, since all the + ancillary data objects must be specified to sendmsg(2) as a single + msg_control buffer. + + inet6_rthdr_init + This function initializes the buffer pointed to by bp to contain a + cmsghdr structure followed by a Routing header of the specified type. The + cmsg_len member of the cmsghdr structure is initialized to the size of + the structure plus the amount of space required by the Routing header. + The cmsg_level and cmsg_type members are also initialized as required. + + The caller must allocate the buffer and its size can be determined by + calling inet6_rthdr_space(). + + Upon success the return value is the pointer to the cmsghdr structure, + and this is then used as the first argument to the next two functions. + Upon an error the return value is NULL. + + inet6_rthdr_add + This function adds the address pointed to by addr to the end of the Rout- + ing header being constructed and sets the type of this hop to the value + of flags. For an IPv6 Type 0 Routing header, flags must be either + IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT. + + If successful, the cmsg_len member of the cmsghdr structure is updated to + account for the new address in the Routing header and the return value of + the function is 0. Upon an error the return value of the function is -1. + + inet6_rthdr_lasthop + This function specifies the Strict/Loose flag for the final hop of a + Routing header. For an IPv6 Type 0 Routing header, flags must be either + IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT. + + The return value of the function is 0 upon success, or -1 upon an error. + + Notice that a Routing header specifying N intermediate nodes requires N+1 + Strict/Loose flags. This requires N calls to inet6_rthdr_add() followed + by one call to inet6_rthdr_lasthop(). + + inet6_rthdr_reverse + This function takes a Routing header that was received as ancillary data + (pointed to by the first argument, in) and writes a new Routing header + that sends datagrams along the reverse of that route. Both arguments are + allowed to point to the same buffer (that is, the reversal can occur in + place). + + The return value of the function is 0 on success, or -1 upon an error. + + inet6_rthdr_segments + This function returns the number of segments (addresses) contained in the + Routing header described by cmsg. On success the return value is between + 1 and 23, inclusive. The return value of the function is -1 upon an er- + ror. + + + inet6_rthdr_getaddr + This function returns a pointer to the IPv6 address specified by index + inet6_rthdr_segments() (which must have a value between 1 and the + value returned by) in the Routing header described by cmsg. An applica- + tion should first call inet6_rthdr_segments() to obtain the number of + segments in the Routing header. + + Upon an error the return value of the function is NULL. + + inet6_rthdr_getflags + This function returns the flags value specified by index + inet6_rthdr_segments() (which must have a value between 0 and the + value returned by) in the Routing header described by cmsg. For an IPv6 + Type 0 Routing header the return value will be either IPV6_RTHDR_LOOSE or + IPV6_RTHDR_STRICT. + + Upon an error the return value of the function is -1. + + Note: Addresses are indexed starting at 1, and flags starting at 0, to + maintain consistency with the terminology and figures in RFC2460. + +DIAGNOSTICS + inet6_rthdr_space() returns 0 on errors. + + inet6_rthdr_add(), inet6_rthdr_lasthop() and inet6_rthdr_reverse() return + 0 on success, and returns -1 on error. + + inet6_rthdr_init() and inet6_rthdr_getaddr() return NULL on error. + + inet6_rthdr_segments() and inet6_rthdr_getflags() return -1 on error. + +EXAMPLES + RFC2292 gives comprehensive examples in chapter 8. + +SEE ALSO + W. Stevens, and M. Thomas, Advanced Sockets API for IPv6, RFC2292, + February 1998. + + S. Deering, and R. Hinden, Internet Protocol, Version 6 (IPv6) + Specification, RFC2460, December 1998. + +HISTORY + The implementation first appeared in KAME advanced networking kit. + +STANDARDS + The functions are documented in ``Advanced Sockets API for IPv6'' + (RFC2292). + +BUGS + The text was shamelessly copied from RFC2292. + + inet6_rthdr_reverse() is not implemented yet. + +BSD Experimental December 10, 1999 3 + + + + + INET_NET + + +INET_NET(3) System Programmer's Manual INET_NET(3) + +NAME + inet_net_ntop, inet_net_pton - Internet network number manipulation rou- + tines + +SYNOPSIS + #include <sys/socket.h> + #include <netinet/in.h> + #include <arpa/inet.h> + + char * + inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size) + + int + inet_net_pton(int af, const char *src, void *dst, size_t size) + +DESCRIPTION + The inet_net_ntop() function converts an Internet network number from + network format (usually a struct in_addr or some other binary form, in + network byte order) to CIDR presentation format (suitable for external + display purposes). bits is the number of bits in src that are the net- + work number. It returns NULL if a system error occurs (in which case, + errno will have been set), or it returns a pointer to the destination + string. + + The inet_net_pton() function converts a presentation format Internet net- + work number (that is, printable form as held in a character string) to + network format (usually a struct in_addr or some other internal binary + representation, in network byte order). It returns the number of bits + (either computed based on the class, or specified with /CIDR), or -1 if a + failure occurred (in which case errno will have been set. It will be set + to ENOENT if the Internet network number was not valid). + + The only value for af currently supported is AF_INET. size is the size of + the result buffer dst. + +NETWORK NUMBERS (IP VERSION 4) + Internet network numbers may be specified in one of the following forms: + + a.b.c.d/bits + a.b.c.d + a.b.c + a.b + a + + When four parts are specified, each is interpreted as a byte of data and + assigned, from left to right, to the four bytes of an Internet network + number. Note that when an Internet network number is viewed as a 32-bit + integer quantity on a system that uses little-endian byte order (such as + the Intel 386, 486, and Pentium processors) the bytes referred to above + appear as ``d.c.b.a''. That is, little-endian bytes are ordered from + right to left. + + When a three part number is specified, the last part is interpreted as a + 16-bit quantity and placed in the rightmost two bytes of the Internet + network number. This makes the three part number format convenient for + specifying Class B network numbers as ``128.net.host''. + + When a two part number is supplied, the last part is interpreted as a + 24-bit quantity and placed in the rightmost three bytes of the Internet + network number. This makes the two part number format convenient for + specifying Class A network numbers as ``net.host''. + + + When only one part is given, the value is stored directly in the Internet + network number without any byte rearrangement. + + All numbers supplied as ``parts'' in a `.' notation may be decimal, oc- + tal, or hexadecimal, as specified in the C language (i.e., a leading 0x + or 0X implies hexadecimal; otherwise, a leading 0 implies octal; other- + wise, the number is interpreted as decimal). + +SEE ALSO + byteorder(3), inet(3), networks(5) + +HISTORY + The inet_net_ntop and inet_net_pton functions first appeared in BIND + 4.9.4. + +BSD Experimental June 18, 1997 2 + + + + + IPX + + +IPX(3) System Programmer's Manual IPX(3) + +NAME + ipx_addr, ipx_ntoa - IPX address conversion routines + +SYNOPSIS + #include <sys/types.h> + #include <netipx/ipx.h> + + struct ipx_addr + ipx_addr(const char *cp) + + char * + ipx_ntoa(struct ipx_addr ipx) + +DESCRIPTION + The routine ipx_addr() interprets character strings representing IPX ad- + dresses, returning binary information suitable for use in system calls. + The routine ipx_ntoa() takes IPX addresses and returns ASCII strings rep- + resenting the address in a notation in common use: + + <network number>.<host number>.<port number> + + Trailing zero fields are suppressed, and each number is printed in hex- + adecimal, in a format suitable for input to ipx_addr(). Any fields lack- + ing super-decimal digits will have a trailing `H' appended. + + An effort has been made to ensure that ipx_addr() be compatible with most + formats in common use. It will first separate an address into 1 to 3 + fields using a single delimiter chosen from period (`.'), colon (`:'), or + pound-sign (`#'). Each field is then examined for byte separators (colon + or period). If there are byte separators, each subfield separated is + taken to be a small hexadecimal number, and the entirety is taken as a + network-byte-ordered quantity to be zero extended in the high-network-or- + der bytes. Next, the field is inspected for hyphens, in which case the + field is assumed to be a number in decimal notation with hyphens separat- + ing the millenia. Next, the field is assumed to be a number: It is in- + terpreted as hexadecimal if there is a leading `0x' (as in C), a trailing + `H' (as in Mesa), or there are any super-decimal digits present. It is + interpreted as octal is there is a leading `0' and there are no super-oc- + tal digits. Otherwise, it is converted as a decimal number. + +RETURN VALUES + None. (See BUGS.) + +SEE ALSO + ns(4), hosts(5), networks(5) + +HISTORY + The precursor ns_addr() and ns_ntoa() functions appeared in 4.3BSD. + +BUGS + The string returned by ipx_ntoa() resides in a static memory area. The + function ipx_addr() should diagnose improperly formed input, and there + should be an unambiguous way to recognize this. + +BSD Experimental June 4, 1993 1 + + + + + ISO_ADDR + + +ISO_ADDR(3) System Programmer's Manual ISO_ADDR(3) + +NAME + iso_addr, iso_ntoa - network address conversion routines for Open System + Interconnection + +SYNOPSIS + #include <sys/types.h> + #include <netiso/iso.h> + + struct iso_addr * + iso_addr(char *cp) + + char * + iso_ntoa(struct iso_addr *isoa) + +DESCRIPTION + The routine iso_addr() interprets character strings representing OSI ad- + dresses, returning binary information suitable for use in system calls. + The routine iso_ntoa() takes OSI addresses and returns ASCII strings rep- + resenting NSAPs (network service access points) in a notation inverse to + that accepted by iso_addr(). + + Unfortunately, no universal standard exists for representing OSI network + addresses. + + The format employed by iso_addr() is a sequence of hexadecimal ``digits'' + (optionally separated by periods), of the form: + + <hex digits>.<hex digits>.<hex digits> + + Each pair of hexadecimal digits represents a byte with the leading digit + indicating the higher-ordered bits. A period following an even number of + bytes has no effect (but may be used to increase legibility). A period + following an odd number of bytes has the effect of causing the byte of + address being translated to have its higher order bits filled with zeros. + +RETURN VALUES + iso_ntoa() always returns a null terminated string. iso_addr() always + returns a pointer to a struct iso_addr. (See BUGS.) + +SEE ALSO + iso(4) + +HISTORY + The iso_addr() and iso_ntoa() functions appeared in 4.3BSD-Reno. + +BUGS + The returned values reside in a static memory area. + + The function iso_addr() should diagnose improperly formed input, and + there should be an unambiguous way to recognize this. + +BSD Experimental June 4, 1993 1 + + + + + LINK_ADDR + + +LINK_ADDR(3) System Programmer's Manual LINK_ADDR(3) + +NAME + link_addr, link_ntoa - elementary address specification routines for link + level access + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + #include <net/if_dl.h> + + void + link_addr(const char *addr, struct sockaddr_dl *sdl) + + char * + link_ntoa(const struct sockaddr_dl *sdl) + +DESCRIPTION + The link_addr() function interprets character strings representing link- + level addresses, returning binary information suitable for use in system + calls. link_ntoa() takes a link-level address and returns an ASCII + string representing some of the information present, including the link + level address itself, and the interface name or number, if present. This + facility is experimental and is still subject to change. + + For link_addr(), the string addr may contain an optional network inter- + face identifier of the form ``name unit-number'', suitable for the first + argument to ifconfig(8), followed in all cases by a colon and an inter- + face address in the form of groups of hexadecimal digits separated by pe- + riods. Each group represents a byte of address; address bytes are filled + left to right from low order bytes through high order bytes. + + Thus le0:8.0.9.13.d.30 represents an Ethernet address to be transmitted + on the first Lance Ethernet interface. + +RETURN VALUES + link_ntoa() always returns a null-terminated string. link_addr() has no + return value. (See BUGS.) + +SEE ALSO + iso(4), ifconfig(8) + +HISTORY + The link_addr() and link_ntoa() functions appeared in 4.3BSD-Reno. + +BUGS + The returned values for link_ntoa reside in a static memory area. + + The function link_addr() should diagnose improperly formed input, and + there should be an unambiguous way to recognize this. + + If the sdl_len field of the link socket address sdl is 0, link_ntoa() + will not insert a colon before the interface address bytes. If this + translated address is given to link_addr() without inserting an initial + colon, the latter will not interpret it correctly. + +BSD Experimental July 28, 1993 1 + + + + + NET_ADDRCMP + + +NET_ADDRCMP(3) System Programmer's Manual NET_ADDRCMP(3) + +NAME + net_addrcmp - compare socket address structures + +SYNOPSIS + #include <netdb.h> + + int + net_addrcmp(struct sockaddr *sa1, struct sockaddr *sa2) + +DESCRIPTION + The net_addrcmp() function compares two socket address structures, sa1 + and sa2. + +RETURN VALUES + If sa1 and sa2 are for the same address, net_addrcmp() returns 0. + + The sa_len fields are compared first. If they do not match, + net_addrcmp() returns -1 or 1 if sa1->sa_len is less than or greater than + sa2->sa_len, respectively. + + Next, the sa_family members are compared. If they do not match, + net_addrcmp() returns -1 or 1 if sa1->sa_family is less than or greater + than sa2->sa_family, respectively. + + Lastly, if each socket address structure's sa_len and sa_family fields + match, the protocol-specific data (the sa_data field) is compared. If + there's a match, both sa1 and sa2 must refer to the same address, and 0 + is returned; otherwise, a value >0 or <0 is returned. + +HISTORY + A net_addrcmp() function was added in + +BSD Experimental July 3, 1999 1 + + + + + NS + + +NS(3) System Programmer's Manual NS(3) + +NAME + ns_addr, ns_ntoa - Xerox NS(tm) address conversion routines + +SYNOPSIS + #include <sys/types.h> + #include <netns/ns.h> + + struct ns_addr + ns_addr(char *cp) + + char * + ns_ntoa(struct ns_addr ns) + +DESCRIPTION + The routine ns_addr() interprets character strings representing XNS ad- + dresses, returning binary information suitable for use in system calls. + The routine ns_ntoa() takes XNS addresses and returns ASCII strings rep- + resenting the address in a notation in common use in the Xerox Develop- + ment Environment: + + <network number>.<host number>.<port number> + + Trailing zero fields are suppressed, and each number is printed in hex- + adecimal, in a format suitable for input to ns_addr(). Any fields lack- + ing super-decimal digits will have a trailing `H' appended. + + Unfortunately, no universal standard exists for representing XNS address- + es. An effort has been made to ensure that ns_addr() be compatible with + most formats in common use. It will first separate an address into 1 to + 3 fields using a single delimiter chosen from period (`.'), colon (`:'), + or pound-sign `#'. Each field is then examined for byte separators (colon + or period). If there are byte separators, each subfield separated is + taken to be a small hexadecimal number, and the entirety is taken as a + network-byte-ordered quantity to be zero extended in the high-network-or- + der bytes. Next, the field is inspected for hyphens, in which case the + field is assumed to be a number in decimal notation with hyphens separat- + ing the millenia. Next, the field is assumed to be a number: It is in- + terpreted as hexadecimal if there is a leading `0x' (as in C), a trailing + `H' (as in Mesa), or there are any super-decimal digits present. It is + interpreted as octal is there is a leading `0' and there are no super-oc- + tal digits. Otherwise, it is converted as a decimal number. + +RETURN VALUES + None. (See BUGS.) + +SEE ALSO + hosts(5), networks(5) + +HISTORY + The ns_addr() and ns_toa() functions appeared in 4.3BSD. + +BUGS + The string returned by ns_ntoa() resides in a static memory area. The + function ns_addr() should diagnose improperly formed input, and there + should be an unambiguous way to recognize this. + +BSD Experimental June 4, 1993 1 + + + + + RESOLVER + + +RESOLVER(3) System Programmer's Manual RESOLVER(3) + +NAME + res_query, res_search, res_mkquery, res_send, res_init, dn_comp, + dn_expand - resolver routines + +SYNOPSIS + #include <sys/types.h> + #include <netinet/in.h> + #include <arpa/nameser.h> + #include <resolv.h> + + int + res_query(char *dname, int class, int type, u_char *answer, int anslen) + + int + res_search(char *dname, int class, int type, u_char *answer, int anslen) + + int + res_mkquery(int op, char *dname, int class, int type, char *data, + int datalen, struct rrec *newrr, char *buf, int buflen) + + int + res_send(char *msg, int msglen, char *answer, int anslen) + + int + res_init(void) + + int + dn_comp(char *exp_dn, char *comp_dn, int length, char **dnptrs, + char **lastdnptr) + + int + dn_expand(u_char *msg, u_char *eomorig, u_char *comp_dn, u_char *exp_dn, + int length) + +DESCRIPTION + These routines are used for making, sending, and interpreting query and + reply messages with Internet domain name servers. + + Global configuration and state information that is used by the resolver + routines is kept in the structure _res. Most of the values have reason- + able defaults and can be ignored. Options stored in _res.options are de- + fined in <resolv.h> and are as follows. Options are stored as a simple + bit mask containing the bitwise OR of the options enabled. + + RES_INIT True if the initial name server address and default domain + name are initialized (i.e., res_init() has been called). + + RES_DEBUG Print debugging messages. + + RES_AAONLY Accept authoritative answers only. With this option, + res_send() should continue until it finds an authoritative + answer or finds an error. Currently this is not imple- + mented. + + RES_USEVC Use TCP connections for queries instead of UDP datagrams. + + RES_STAYOPEN Used with RES_USEVC to keep the TCP connection open be- + tween queries. This is useful only in programs that regu- + larly do many queries. UDP should be the normal mode + used. + + RES_IGNTC Unused currently (ignore truncation errors, i.e., don't + + retry with TCP). + + RES_RECURSE Set the recursion-desired bit in queries. This is the de- + fault. (res_send() does not do iterative queries and ex- + pects the name server to handle recursion.) + + RES_DEFNAMES If set, res_search() will append the default domain name + to single-component names (those that do not contain a + dot). This option is enabled by default. + + RES_DNSRCH If this option is set, res_search() will search for host + names in the current domain and in parent domains; see + hostname(7). This is used by the standard host lookup + routine gethostbyname(3). This option is enabled by de- + fault. + + RES_USE_INET6 Enables support for IPv6-only applications. This causes + IPv4 addresses to be returned as an IPv4 mapped address. + For example, 10.1.1.1 will be returned as ::ffff:10.1.1.1. + The option is not meaningful on + + The res_init() routine reads the configuration file (if any; see + resolv.conf(5)) to get the default domain name, search list, and the In- + ternet address of the local name server(s). If no server is configured, + the host running the resolver is tried. The current domain name is de- + fined by the hostname if not specified in the configuration file; it can + be overridden by the environment variable LOCALDOMAIN. This environment + variable may contain several blank-separated tokens if you wish to over- + ride the search list on a per-process basis. This is similar to the + search command in the configuration file. Another environment variable + RES_OPTIONS can be set to override certain internal resolver options + which are otherwise set by changing fields in the _res structure or are + inherited from the configuration file's options command. The syntax of + the RES_OPTIONS environment variable is explained in resolv.conf(5). + Initialization normally occurs on the first call to one of the following + routines. + + The res_query() function provides an interface to the server query mecha- + nism. It constructs a query, sends it to the local server, awaits a re- + sponse, and makes preliminary checks on the reply. The query requests + information of the specified type and class for the specified fully qual- + ified domain name dname. The reply message is left in the answer buffer + with length anslen supplied by the caller. + + The res_search() routine makes a query and awaits a response like + res_query(), but in addition, it implements the default and search rules + controlled by the RES_DEFNAMES and RES_DNSRCH options. It returns the + first successful reply. + + The remaining routines are lower-level routines used by res_query(). The + res_mkquery() function constructs a standard query message and places it + in buf. It returns the size of the query, or -1 if the query is larger + than buflen. The query type op is usually QUERY, but can be any of the + query types defined in <arpa/nameser.h>. The domain name for the query is + given by dname. newrr is currently unused but is intended for making up- + date messages. + + The res_send() routine sends a pre-formatted query and returns an answer. + It will call res_init() if RES_INIT is not set, send the query to the lo- + cal name server, and handle timeouts and retries. The length of the re- + ply message is returned, or -1 if there were errors. + + The dn_comp() function compresses the domain name exp_dn and stores it in + comp_dn. The size of the compressed name is returned or -1 if there were + errors. The size of the array pointed to by comp_dn is given by length. + The compression uses an array of pointers dnptrs to previously compressed + names in the current message. The first pointer points to the beginning + of the message and the list ends with NULL. The limit to the array is + specified by lastdnptr. A side effect of dn_comp() is to update the list + of pointers for labels inserted into the message as the name is com- + pressed. If dnptr is NULL, names are not compressed. If lastdnptr is + NULL, the list of labels is not updated. + + The dn_expand() entry expands the compressed domain name comp_dn to a + full domain name The compressed name is contained in a query or reply + message; msg is a pointer to the beginning of the message. The uncom- + pressed name is placed in the buffer indicated by exp_dn which is of size + length. The size of compressed name is returned or -1 if there was an er- + ror. + +FILES + /etc/resolv.conf configuration file see resolv.conf(5). + +SEE ALSO + gethostbyname(3), resolv.conf(5), hostname(7), named(8) + + RFC1032, RFC1033, RFC1034, RFC1035, RFC1535, RFC974 + + Name Server Operations Guide for BIND. + +HISTORY + The res_query function appeared in 4.3BSD. + +BSD Experimental June 4, 1993 3 + + + + + ACCEPT + + +ACCEPT(2) System Programmer's Manual ACCEPT(2) + +NAME + accept - accept a connection on a socket + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + + int + accept(int s, struct sockaddr *addr, socklen_t *addrlen) + +DESCRIPTION + The argument s is a socket that has been created with socket(2), bound + to an address with bind(2), and is listening for connections after a + listen(2). The accept() argument extracts the first connection request + on the queue of pending connections, creates a new socket with the same + properties of s, and allocates a new file descriptor for the socket. If + no pending connections are present on the queue, and the socket is not + marked as non-blocking, accept() blocks the caller until a connection is + present. If the socket is marked non-blocking and no pending connections + are present on the queue, accept() returns an error as described below. + The accepted socket may not be used to accept more connections. The + original socket s remains open. + + The argument addr is a result parameter that is filled in with the ad- + dress of the connecting entity as known to the communications layer. The + exact format of the addr parameter is determined by the domain in which + the communication is occurring. The addrlen is a value-result parameter; + it should initially contain the amount of space pointed to by addr; on + return it will contain the actual length (in bytes) of the address re- + turned. This call is used with connection-based socket types, currently + with SOCK_STREAM. + + It is possible to select(2) or poll(2) a socket for the purposes of doing + an accept() by selecting it for read. + + For certain protocols which require an explicit confirmation, such as ISO + or DATAKIT, accept() can be thought of as merely dequeuing the next con- + nection request and not implying confirmation. Confirmation can be im- + plied by a normal read or write on the new file descriptor, and rejection + can be implied by closing the new socket. + + One can obtain user connection request data without confirming the con- + nection by issuing a recvmsg(2) call with an msg_iovlen of 0 and a non- + zero msg_controllen, or by issuing a getsockopt(2) request. Similarly, + one can provide user connection rejection information by issuing a + sendmsg(2) call with providing only the control information, or by call- + ing setsockopt(2). + +RETURN VALUES + The call returns -1 on error. If it succeeds, it returns a non-negative + integer that is a descriptor for the accepted socket. + +ERRORS + The accept() will fail if: + + [EBADF] The descriptor is invalid. + + [ENOTSOCK] The descriptor references a file, not a socket. + + [EOPNOTSUPP] The referenced socket is not of type SOCK_STREAM. + + [EINVAL] The referenced socket is not listening for connections + + (that is, listen(2) has not yet been called). + + [EFAULT] The addr parameter is not in a writable part of the user + address space. + + [EWOULDBLOCK] + The socket is marked non-blocking and no connections are + present to be accepted. + + [EMFILE] The per-process descriptor table is full. + + [ENFILE] The system file table is full. + + [ECONNABORTED] + A connection has been aborted. + +SEE ALSO + bind(2), connect(2), listen(2), poll(2), select(2), poll(2), sock- + et(2) + +HISTORY + The accept() function appeared in 4.2BSD. + +BSD Experimental February 15, 1999 2 + + + + + BIND + + +BIND(2) System Programmer's Manual BIND(2) + +NAME + bind - bind a name to a socket + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + + int + bind(int s, const struct sockaddr *name, socklen_t namelen) + +DESCRIPTION + bind() assigns a name to an unnamed socket. When a socket is created + with socket(2) it exists in a name space (address family) but has no name + assigned. bind() requests that name be assigned to the socket. + +NOTES + Binding a name in the UNIX domain creates a socket in the file system + that must be deleted by the caller when it is no longer needed (using + unlink(2)). + + The rules used in name binding vary between communication domains. Con- + sult the manual entries in section 4 for detailed information. + +RETURN VALUES + If the bind is successful, a 0 value is returned. A return value of -1 + indicates an error, which is further specified in the global errno. + +ERRORS + The bind() call will fail if: + + [EBADF] S is not a valid descriptor. + + [ENOTSOCK] S is not a socket. + + [EADDRNOTAVAIL] + The specified address is not available from the local ma- + chine. + + [EADDRINUSE] The specified address is already in use. + + [EINVAL] The socket is already bound to an address. + + [EINVAL] The family of the socket and that requested in + name->sa_family are not equivalent. + + [EACCES] The requested address is protected, and the current user + has inadequate permission to access it. + + [EFAULT] The name parameter is not in a valid part of the user ad- + dress space. + + The following errors are specific to binding names in the UNIX domain. + + [ENOTDIR] A component of the path prefix is not a directory. + + [ENAMETOOLONG] + A component of a pathname exceeded {NAME_MAX} characters, + or an entire path name exceeded {PATH_MAX} characters. + + [ENOENT] A prefix component of the path name does not exist. + + [ELOOP] Too many symbolic links were encountered in translating the + + pathname. + + [EIO] An I/O error occurred while making the directory entry or + allocating the inode. + + [EROFS] The name would reside on a read-only file system. + + [EISDIR] An empty pathname was specified. + +SEE ALSO + connect(2), getsockname(2), listen(2), socket(2) + +HISTORY + The bind() function call appeared in 4.2BSD. + +BSD Experimental February 15, 1999 2 + + + + + CONNECT + + +CONNECT(2) System Programmer's Manual CONNECT(2) + +NAME + connect - initiate a connection on a socket + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + + int + connect(int s, const struct sockaddr *name, socklen_t namelen) + +DESCRIPTION + The parameter s is a socket. If it is of type SOCK_DGRAM, this call + specifies the peer with which the socket is to be associated; this ad- + dress is that to which datagrams are to be sent, and the only address + from which datagrams are to be received. If the socket is of type + SOCK_STREAM, this call attempts to make a connection to another socket. + The other socket is specified by name, which is an address in the commu- + nications space of the socket. Each communications space interprets the + name parameter in its own way. Generally, stream sockets may successful- + ly connect() only once; datagram sockets may use connect() multiple times + to change their association. Datagram sockets may dissolve the associa- + tion by connecting to an invalid address, such as a null address. + +RETURN VALUES + If the connection or binding succeeds, 0 is returned. Otherwise a -1 is + returned, and a more specific error code is stored in errno. + +ERRORS + The connect() call fails if: + + [EBADF] S is not a valid descriptor. + + [ENOTSOCK] S is a descriptor for a file, not a socket. + + [EADDRNOTAVAIL] + The specified address is not available on this machine. + + [EAFNOSUPPORT] + Addresses in the specified address family cannot be used + with this socket. + + [EISCONN] The socket is already connected. + + [ETIMEDOUT] Connection establishment timed out without establishing a + connection. + + [EINVAL] A TCP connection with a local broadcast, the all-ones or a + multicast address as the peer was attempted. + + [ECONNREFUSED] + The attempt to connect was forcefully rejected. + + [EINTR] A connect was interrupted before it succeeded by the deliv- + ery of a signal. + + [ENETUNREACH] + The network isn't reachable from this host. + + [EADDRINUSE] The address is already in use. + + [EFAULT] The name parameter specifies an area outside the process + + address space. + + [EINPROGRESS] + The socket is non-blocking and the connection cannot be + completed immediately. It is possible to select(2) or + poll(2) for completion by selecting the socket for writing, + and also use getsockopt(2) with SO_ERROR to check for error + conditions. + + [EALREADY] The socket is non-blocking and a previous connection at- + tempt has not yet been completed. + + The following errors are specific to connecting names in the UNIX domain. + These errors may not apply in future versions of the UNIX IPC domain. + + [ENOTDIR] A component of the path prefix is not a directory. + + [ENAMETOOLONG] + A component of a pathname exceeded {NAME_MAX} characters, + or an entire path name exceeded {PATH_MAX} characters. + + [ENOENT] The named socket does not exist. + + [EACCES] Search permission is denied for a component of the path + prefix. + + [EACCES] Write access to the named socket is denied. + + [ELOOP] Too many symbolic links were encountered in translating the + pathname. + +SEE ALSO + accept(2), getsockname(2), getsockopt(2), poll(2), select(2), sock- + et(2) + +HISTORY + The connect() function call appeared in 4.2BSD. + +BSD Experimental February 15, 1999 2 + + + + + GETPEERNAME + + +GETPEERNAME(2) System Programmer's Manual GETPEERNAME(2) + +NAME + getpeername - get name of connected peer + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + + int + getpeername(int s, struct sockaddr *name, socklen_t *namelen) + +DESCRIPTION + getpeername() returns the address information of the peer connected to + socket s. One common use occurs when a process inherits an open socket, + such as TCP servers forked from inetd(8). In this scenario, + getpeername() is used to determine the connecting client's IP address. + + getpeername() takes three parameters: + + s Contains the file descriptor of the socket whose peer should be looked + up. + + name Points to a sockaddr structure that will hold the address informa- + tion for the connected peer. Normal use requires one to use a structure + specific to the protocol family in use, such as sockaddr_in (IPv4) or + sockaddr_in6 (IPv6), cast to a (struct sockaddr *). + + For greater portability, especially with the newer protocol families, the + new struct sockaddr_storage should be used. sockaddr_storage is large + enough to hold any of the other sockaddr_* variants. On return, it can + be cast to the correct sockaddr type, based the protocol family contained + in its ss_family field. + + namelen Indicates the amount of space pointed to by name, in bytes. + + If address information for the local end of the socket is required, the + getsockname(2) function should be used instead. + + If name does not point to enough space to hold the entire socket address, + the result will be truncated to namelen bytes. + +RETURN VALUES + If the call succeeds, a 0 is returned and namelen is set to the actual + size of the socket address returned in name. Otherwise, errno is set and + a value of -1 is returned. + +ERRORS + On failure, errno is set to one of the following: + + [EBADF] The argument s is not a valid descriptor. + + [ENOTSOCK] The argument s is a file, not a socket. + + [ENOTCONN] The socket is not connected. + + [ENOBUFS] Insufficient resources were available in the system to per- + form the operation. + + [EFAULT] The name parameter points to memory not in a valid part of + the process address space. + +SEE ALSO + accept(2), bind(2), getsockname(2), getpeereid(2), socket(2) + +HISTORY + The getpeername() function call appeared in 4.2BSD. + +BSD Experimental July 17, 1999 2 + + + + + GETSOCKNAME + + +GETSOCKNAME(2) System Programmer's Manual GETSOCKNAME(2) + +NAME + getsockname - get socket name + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + + int + getsockname(int s, struct sockaddr *name, socklen_t *namelen) + +DESCRIPTION + getsockname() returns the locally bound address information for a speci- + fied socket. + + Common uses of this function are as follows: + + o When bind(2) is called with a port number of 0 (indicating the kernel + should pick an ephemeral port) getsockname() is used to retrieve the + kernel-assigned port number. + + o When a process calls bind(2) on a wildcard IP address, getsockname() + is used to retrieve the local IP address for the connection. + + o When a function wishes to know the address family of a socket, + getsockname() can be used. + + getsockname() takes three parameters: + + s, Contains the file desriptor for the socket to be looked up. + + name points to a sockaddr structure which will hold the resulting address + information. Normal use requires one to use a structure specific to the + protocol family in use, such as sockaddr_in (IPv4) or sockaddr_in6 + (IPv6), cast to a (struct sockaddr *). + + For greater portability (such as newer protocol families) the new struc- + ture sockaddr_storage exists. sockaddr_storage is large enough to hold + any of the other sockaddr_* variants. On return, it should be cast to + the correct sockaddr type, according to the current protocol family. + + namelen Indicates the amount of space pointed to by name, in bytes. Upon + return, namelen is set to the actual size of the returned address infor- + mation. + + If the address of the destination socket for a given socket connection is + needed, the getpeername(2) function should be used instead. + + If name does not point to enough space to hold the entire socket address, + the result will be truncated to namelen bytes. + +RETURN VALUES + On success, getsockname() returns a 0, and namelen is set to the actual + size of the socket address returned in name. Otherwise, errno is set, and + a value of -1 is returned. + +ERRORS + If getsockname() fails, errno is set to one of the following: + + [EBADF] The argument s is not a valid descriptor. + + + + [ENOTSOCK] The argument s is a file, not a socket. + + [ENOBUFS] Insufficient resources were available in the system to per- + form the operation. + + [EFAULT] The name parameter points to memory not in a valid part of + the process address space. + +SEE ALSO + accept(2), bind(2), getpeername(2), getpeereid(2), socket(2) + +BUGS + Names bound to sockets in the UNIX domain are inaccessible; getsockname + returns a zero length name. + +HISTORY + The getsockname() function call appeared in 4.2BSD. + +BSD Experimental July 17, 1999 2 + + + + + GETSOCKOPT + + +GETSOCKOPT(2) System Programmer's Manual GETSOCKOPT(2) + +NAME + getsockopt, setsockopt - get and set options on sockets + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + + int + getsockopt(int s, int level, int optname, void *optval, + socklen_t *optlen) + + int + setsockopt(int s, int level, int optname, const void *optval, + socklen_t optlen) + +DESCRIPTION + getsockopt() and setsockopt() manipulate the options associated with a + socket. Options may exist at multiple protocol levels; they are always + present at the uppermost ``socket'' level. + + When manipulating socket options the level at which the option resides + and the name of the option must be specified. To manipulate options at + the socket level, level is specified as SOL_SOCKET. To manipulate options + at any other level the protocol number of the appropriate protocol con- + trolling the option is supplied. For example, to indicate that an option + is to be interpreted by the TCP protocol, level should be set to the pro- + tocol number of TCP; see getprotoent(3). + + The parameters optval and optlen are used to access option values for + setsockopt(). For getsockopt() they identify a buffer in which the value + for the requested option(s) are to be returned. For getsockopt(), optlen + is a value-result parameter, initially containing the size of the buffer + pointed to by optval, and modified on return to indicate the actual size + of the value returned. If no option value is to be supplied or returned, + optval may be NULL. + + optname and any specified options are passed uninterpreted to the appro- + priate protocol module for interpretation. The include file + <sys/socket.h> contains definitions for socket level options, described + below. Options at other protocol levels vary in format and name; consult + the appropriate entries in section 4 of the manual. + + Most socket-level options utilize an int parameter for optval. For + setsockopt(), the parameter should be non-zero to enable a boolean op- + tion, or zero if the option is to be disabled. SO_LINGER uses a struct + linger parameter, defined in <sys/socket.h>, which specifies the desired + state of the option and the linger interval (see below). SO_SNDTIMEO and + SO_RCVTIMEO use a struct timeval parameter, defined in <sys/time.h>. + + The following options are recognized at the socket level. Except as not- + ed, each may be examined with getsockopt() and set with setsockopt(). + + SO_DEBUG enables recording of debugging information + SO_REUSEADDR enables local address reuse + SO_REUSEPORT enables duplicate address and port bindings + SO_KEEPALIVE enables keep connections alive + SO_DONTROUTE enables routing bypass for outgoing messages + SO_LINGER linger on close if data present + SO_BROADCAST enables permission to transmit broadcast messages + SO_OOBINLINE enables reception of out-of-band data in band + + + SO_SNDBUF set buffer size for output + SO_RCVBUF set buffer size for input + SO_SNDLOWAT set minimum count for output + SO_RCVLOWAT set minimum count for input + SO_SNDTIMEO set timeout value for output + SO_RCVTIMEO set timeout value for input + SO_TYPE get the type of the socket (get only) + SO_ERROR get and clear error on the socket (get only) + + SO_DEBUG enables debugging in the underlying protocol modules. + SO_REUSEADDR indicates that the rules used in validating addresses sup- + plied in a bind(2) call should allow reuse of local addresses. + SO_REUSEPORT allows completely duplicate bindings by multiple processes + if they all set SO_REUSEPORT before binding the port. This option per- + mits multiple instances of a program to each receive UDP/IP multicast or + broadcast datagrams destined for the bound port. SO_KEEPALIVE enables + the periodic transmission of messages on a connected socket. Should the + connected party fail to respond to these messages, the connection is con- + sidered broken and processes using the socket are notified via a SIGPIPE + signal when attempting to send data. SO_DONTROUTE indicates that outgo- + ing messages should bypass the standard routing facilities. Instead, + messages are directed to the appropriate network interface according to + the network portion of the destination address. + + SO_LINGER controls the action taken when unsent messages are queued on + socket and a close(2) is performed. If the socket promises reliable de- + livery of data and SO_LINGER is set, the system will block the process on + the close(2) attempt until it is able to transmit the data or until it + decides it is unable to deliver the information (a timeout period mea- + sured in seconds, termed the linger interval, is specified in the + setsockopt() call when SO_LINGER is requested). If SO_LINGER is disabled + and a close(2) is issued, the system will process the close in a manner + that allows the process to continue as quickly as possible. + + The option SO_BROADCAST requests permission to send broadcast datagrams + on the socket. Broadcast was a privileged operation in earlier versions + of the system. With protocols that support out-of-band data, the + SO_OOBINLINE option requests that out-of-band data be placed in the nor- + mal data input queue as received; it will then be accessible with recv(2) + or read(2) calls without the MSG_OOB flag. Some protocols always behave + as if this option is set. SO_SNDBUF and SO_RCVBUF are options to adjust + the normal buffer sizes allocated for output and input buffers, respec- + tively. The buffer size may be increased for high-volume connections, or + may be decreased to limit the possible backlog of incoming data. The + system places an absolute limit on these values. + + SO_SNDLOWAT is an option to set the minimum count for output operations. + Most output operations process all of the data supplied by the call, de- + livering data to the protocol for transmission and blocking as necessary + for flow control. Nonblocking output operations will process as much da- + ta as permitted subject to flow control without blocking, but will pro- + cess no data if flow control does not allow the smaller of the low water + mark value or the entire request to be processed. A select(2) or poll(2) + operation testing the ability to write to a socket will return true only + if the low water mark amount could be processed. The default value for + SO_SNDLOWAT is set to a convenient size for network efficiency, often + 1024. SO_RCVLOWAT is an option to set the minimum count for input opera- + tions. In general, receive calls will block until any (non-zero) amount + of data is received, then return with the smaller of the amount available + or the amount requested. The default value for SO_RCVLOWAT is 1. If + SO_RCVLOWAT is set to a larger value, blocking receive calls normally + wait until they have received the smaller of the low water mark value or + the requested amount. Receive calls may still return less than the low + water mark if an error occurs, a signal is caught, or the type of data + next in the receive queue is different than that returned. + + + SO_SNDTIMEO is an option to set a timeout value for output operations. + It accepts a struct timeval parameter with the number of seconds and mi- + croseconds used to limit waits for output operations to complete. If a + send operation has blocked for this much time, it returns with a partial + count or with the error EWOULDBLOCK if no data was sent. In the current + implementation, this timer is restarted each time additional data are de- + livered to the protocol, implying that the limit applies to output por- + tions ranging in size from the low water mark to the high water mark for + output. SO_RCVTIMEO is an option to set a timeout value for input opera- + tions. It accepts a struct timeval parameter with the number of seconds + and microseconds used to limit waits for input operations to complete. + In the current implementation, this timer is restarted each time addi- + tional data are received by the protocol, and thus the limit is in effect + an inactivity timer. If a receive operation has been blocked for this + much time without receiving additional data, it returns with a short + count or with the error EWOULDBLOCK if no data were received. + + Finally, SO_TYPE and SO_ERROR are options used only with getsockopt(). + SO_TYPE returns the type of the socket, such as SOCK_STREAM; it is useful + for servers that inherit sockets on startup. SO_ERROR returns any pend- + ing error on the socket and clears the error status. It may be used to + check for asynchronous errors on connected datagram sockets or for other + asynchronous errors. + +RETURN VALUES + A 0 is returned if the call succeeds, -1 if it fails. + +ERRORS + The call succeeds unless: + + [EBADF] The argument s is not a valid descriptor. + + [ENOTSOCK] The argument s is a file, not a socket. + + [ENOPROTOOPT] + The option is unknown at the level indicated. + + [EFAULT] The address pointed to by optval is not in a valid part of + the process address space. For getsockopt(), this error + may also be returned if optlen is not in a valid part of + the process address space. + +SEE ALSO + connect(2), ioctl(2), poll(2), select(2), poll(2), socket(2), + getprotoent(3), protocols(5) + +BUGS + Several of the socket options should be handled at lower levels of the + system. + +HISTORY + The getsockopt() system call appeared in 4.2BSD. + +BSD Experimental February 15, 1999 3 + + + + + IOCTL + + +IOCTL(2) System Programmer's Manual IOCTL(2) + +NAME + ioctl - control device + +SYNOPSIS + #include <sys/ioctl.h> + + int + ioctl(int d, unsigned long request, ...) + +DESCRIPTION + The ioctl() function manipulates the underlying device parameters of spe- + cial files. In particular, many operating characteristics of character + special files (e.g., terminals) may be controlled with ioctl() requests. + + The argument d must be an open file descriptor. The third argument is + called arg and contains additional information needed by this device to + perform the requested function. arg is either an int or a pointer to a + device-specific data structure, depending upon the given request. + + An ioctl request has encoded in it whether the argument is an ``in'' pa- + rameter or ``out'' parameter, and the size of the third argument (arg) in + bytes. Macros and defines used in specifying an ioctl request are locat- + ed in the file <sys/ioctl.h>. + +RETURN VALUES + If an error has occurred, a value of -1 is returned and errno is set to + indicate the error. + +ERRORS + ioctl() will fail if: + + [EBADF] d is not a valid descriptor. + + [ENOTTY] d is not associated with a character special device. + + [ENOTTY] The specified request does not apply to the kind of object + that the descriptor d references. + + [EINVAL] request or arg is not valid. + + [EFAULT] arg points outside the process's allocated address space. + +SEE ALSO + cdio(1), chio(1), mt(1), execve(2), fcntl(2), intro(4), tty(4) + +HISTORY + An ioctl() function call appeared in Version 7 AT&T UNIX. + +BSD Experimental December 11, 1993 1 + + + + + POLL + + +POLL(2) System Programmer's Manual POLL(2) + +NAME + poll - synchronous I/O multiplexing + +SYNOPSIS + #include <poll.h> + + int + poll(struct pollfd *fds, int nfds, int timeout) + +DESCRIPTION + poll() provides a mechanism for reporting I/O conditions across a set of + file descriptors. + + The arguments are as follows: + + fds Points to an array of pollfd structures, which are defined as: + + struct pollfd { + int fd; + short events; + short revents; + }; + + The fd member is an open file descriptor. The events and + revents members are bitmasks of conditions to monitor and condi- + tions found, respectively. + + nfds The number of pollfd structures in the array. + + timeout Maximum interval to wait for the poll to complete, in millisec- + onds. If this value is 0, then poll() will return immediately. + If this value is INFTIM (-1), poll() will block indefinitely un- + til a condition is found. + + The calling process sets the events bitmask and poll() sets the revents + bitmask. Each call to poll() resets the revents bitmask for accuracy. + The condition flags in the bitmasks are defined as: + + POLLIN Data is available on the file descriptor for reading. + + POLLNORM Same as POLLIN. + + POLLPRI Same as POLLIN. + + POLLOUT Data can be written to the file descriptor without blocking. + + POLLERR This flag is not used in this implementation and is provided + only for source code compatibility. + + POLLHUP The file descriptor was valid before the polling process and + invalid after. Presumably, this means that the file descrip- + tor was closed sometime during the poll. + + POLLNVAL The corresponding file descriptor is invalid. + + POLLRDNORM Same as POLLIN. + + POLLRDBAND Same as POLLIN. + + POLLWRNORM Same as POLLOUT. + + + POLLWRBAND Same as POLLOUT. + + POLLMSG This flag is not used in this implementation and is provided + only for source code compatibility. + + All flags except POLLIN, POLLOUT, and their synonyms are for use only in + the revents member of the pollfd structure. An attempt to set any of + these flags in the events member will generate an error condition. + + In addition to I/O multiplexing, poll() can be used to generate simple + timeouts. This functionality may be achieved by passing a null pointer + for fds. + +WARNINGS + The POLLHUP flag is only a close approximation and may not always be ac- + curate. + +RETURN VALUES + Upon error, poll() returns a -1 and sets the global variable errno to in- + dicate the error. If the timeout interval was reached before any events + occurred, a 0 is returned. Otherwise, poll() returns the number of file + descriptors for which revents is non-zero. + +ERRORS + poll() will fail if: + + [EINVAL] nfds was either a negative number or greater than the number + of available file descriptors. + + [EINVAL] An invalid flags was set in the events member of the pollfd + structure. + + [EINVAL] The timeout passed to poll() was too large. + + [EAGAIN] Resource allocation failed inside of poll(). Subsequent calls + to poll() may succeed. + + [EINTR] poll() caught a signal during the polling process. + +SEE ALSO + poll(2), select(2), sysconf(3) + +HISTORY + A poll() system call appeared in AT&T System V UNIX. + +BSD Experimental December 13, 1994 2 + + + + + SELECT + + +SELECT(2) System Programmer's Manual SELECT(2) + +NAME + select - synchronous I/O multiplexing + +SYNOPSIS + #include <sys/types.h> + #include <sys/time.h> + #include <unistd.h> + + int + select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + struct timeval *timeout) + + FD_SET(fd, &fdset) + + FD_CLR(fd, &fdset) + + FD_ISSET(fd, &fdset) + + FD_ZERO(&fdset) + +DESCRIPTION + select() examines the I/O descriptor sets whose addresses are passed in + readfds, writefds, and exceptfds to see if some of their descriptors are + ready for reading, are ready for writing, or have an exceptional condi- + tion pending, respectively. The first nfds descriptors are checked in + each set; i.e., the descriptors from 0 through nfds-1 in the descriptor + sets are examined. On return, select() replaces the given descriptor + sets with subsets consisting of those descriptors that are ready for the + requested operation. select() returns the total number of ready descrip- + tors in all the sets. + + The descriptor sets are stored as bit fields in arrays of integers. The + following macros are provided for manipulating such descriptor sets: + FD_ZERO(&fdset) initializes a descriptor set fdset to the null set. + FD_SET(fd, &fdset) includes a particular descriptor fd in fdset. + FD_CLR(fd, &fdset) removes fd from fdset. FD_ISSET(fd, &fdset) is non-ze- + ro if fd is a member of fdset, zero otherwise. The behavior of these + macros is undefined if a descriptor value is less than zero or greater + than or equal to FD_SETSIZE, which is normally at least equal to the max- + imum number of descriptors supported by the system. + + If timeout is a non-null pointer, it specifies a maximum interval to wait + for the selection to complete. If timeout is a null pointer, the select + blocks indefinitely. To effect a poll, the timeout argument should be + non-null, pointing to a zero-valued timeval structure. timeout is not + changed by select(), and may be reused on subsequent calls; however, it + is good style to re-initialize it before each invocation of select(). + + Any of readfds, writefds, and exceptfds may be given as null pointers if + no descriptors are of interest. + +RETURN VALUES + select() returns the number of ready descriptors that are contained in + the descriptor sets, or -1 is an error occurred. If the time limit ex- + pires, select() returns 0. If select() returns with an error, including + one due to an interrupted call, the descriptor sets will be unmodified. + +ERRORS + An error return from select() indicates: + + [EFAULT] One or more of readfds, writefds, or exceptfds points out- + + side the process's allocated address space. + + [EBADF] One of the descriptor sets specified an invalid descriptor. + + [EINTR] A signal was delivered before the time limit expired and + before any of the selected events occurred. + + [EINVAL] The specified time limit is invalid. One of its components + is negative or too large. + +SEE ALSO + accept(2), connect(2), gettimeofday(2), poll(2), read(2), recv(2), + send(2), write(2), getdtablesize(3) + +BUGS + Although the provision of getdtablesize(3) was intended to allow user + programs to be written independent of the kernel limit on the number of + open files, the dimension of a sufficiently large bit field for select + remains a problem. The default bit size of fd_set is based on the symbol + FD_SETSIZE (currently 256), but that is somewhat smaller than the current + kernel limit to the number of open files. However, in order to accommo- + date programs which might potentially use a larger number of open files + with select, it is possible to increase this size within a program by + providing a larger definition of FD_SETSIZE before the inclusion of + <sys/types.h>. The kernel will cope, and the userland libraries provided + with the system are also ready for large numbers of file descriptors. + + Alternatively, to be really safe, it is possible to allocate fd_set bit- + arrays dynamically. The idea is to permit a program to work properly + even if it is execve(2)'d with 4000 file descriptors pre-allocated. The + following illustrates the technique which is used by userland libraries: + + fd_set *fdsr; + int max = fd; + + fdsr = (fd_set *)calloc(howmany(max+1, NFDBITS), + sizeof(fd_mask)); + if (fdsr == NULL) { + ... + return (-1); + } + FD_SET(fd, fdsr); + n = select(max+1, fdsr, NULL, NULL, &tv); + ... + free(fdsr); + + Alternatively, it is possible to use the poll(2) interface. poll(2) is + more efficient when the size of select()'s fd_set bit-arrays are very + large, and for fixed numbers of file descriptors one need not size and + dynamically allocate a memory object. + + select() should probably have been designed to return the time remaining + from the original timeout, if any, by modifying the time value in place. + Even though some systems stupidly act in this different way, it is un- + likely this semantic will ever be commonly implemented, as the change + causes massive source code compatibility problems. Furthermore, recent + new standards have dictated the current behaviour. In general, due to + the existence of those brain-damaged non-conforming systems, it is unwise + to assume that the timeout value will be unmodified by the select() call, + and the caller should reinitialize it on each invocation. Calculating + the delta is easily done by calling gettimeofday(2) before and after the + call to select(), and using timersub() (as described in getitimer(2)). + + Internally to the kernel, select() works poorly if multiple processes + wait on the same file descriptor. Given that, it is rather surprising to + see that many daemons are written that way (i.e., httpd(8)). + +HISTORY + The select() function call appeared in 4.2BSD. + +BSD Experimental March 25, 1994 3 + + + + + SEND + + +SEND(2) System Programmer's Manual SEND(2) + +NAME + send, sendto, sendmsg - send a message from a socket + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + + ssize_t + send(int s, const void *msg, size_t len, int flags) + + ssize_t + sendto(int s, const void *msg, size_t len, int flags, + const struct sockaddr *to, socklen_t tolen) + + ssize_t + sendmsg(int s, const struct msghdr *msg, int flags) + +DESCRIPTION + send(), sendto(), and sendmsg() are used to transmit a message to another + socket. send() may be used only when the socket is in a connected state, + while sendto() and sendmsg() may be used at any time. + + The address of the target is given by to with tolen specifying its size. + The length of the message is given by len. If the message is too long to + pass atomically through the underlying protocol, the error EMSGSIZE is + returned, and the message is not transmitted. + + No indication of failure to deliver is implicit in a send(). Locally de- + tected errors are indicated by a return value of -1. + + If no messages space is available at the socket to hold the message to be + transmitted, then send() normally blocks, unless the socket has been + placed in non-blocking I/O mode. The select(2) or poll(2) system calls + may be used to determine when it is possible to send more data. + + The flags parameter may include one or more of the following: + + #define MSG_OOB 0x1 /* process out-of-band data */ + #define MSG_DONTROUTE 0x4 /* bypass routing, use direct interface */ + + The flag MSG_OOB is used to send ``out-of-band'' data on sockets that + support this notion (e.g., SOCK_STREAM); the underlying protocol must al- + so support ``out-of-band'' data. MSG_DONTROUTE is usually used only by + diagnostic or routing programs. + + See recv(2) for a description of the msghdr structure. + +RETURN VALUES + The call returns the number of characters sent, or -1 if an error oc- + curred. + +ERRORS + send(), sendto(), and sendmsg() fail if: + + [EBADF] An invalid descriptor was specified. + + [ENOTSOCK] The argument s is not a socket. + + [EFAULT] An invalid user space address was specified for a parame- + ter. + + [EMSGSIZE] The socket requires that message be sent atomically, and + + the size of the message to be sent made this impossible. + + [EAGAIN] The socket is marked non-blocking and the requested opera- + tion would block. + + [ENOBUFS] The system was unable to allocate an internal buffer. The + operation may succeed when buffers become available. + + [ENOBUFS] The output queue for a network interface was full. This + generally indicates that the interface has stopped sending, + but may be caused by transient congestion. + + [EACCES] The SO_BROADCAST option is not set on the socket, and a + broadcast address was given as the destination. + + [EHOSTUNREACH] + The destination address specified an unreachable host. + + [EINVAL] The flags parameter is invalid. + + [EHOSTDOWN] The destination address specified a host that is down. + + [ENETDOWN] The destination address specified a network that is down. + + [ECONNREFUSED] + The destination host rejected the message (or a previous + one). This error can only be returned by connected sock- + ets. + + [ENOPROTOOPT] + There was a problem sending the message. This error can + only be returned by connected sockets. + + [EDESTADDRREQ] + The socket is not connected, and no destination address was + specified. + + [EISCONN] The socket is already connected, and a destination address + was specified. + + In addition, send() and sendto() may return the following error: + + [EINVAL] len was larger than SSIZE_MAX. + + Also, sendmsg() may return the following errors: + + [EINVAL] The sum of the iov_len values in the msg_iov array over- + flowed an ssize_t. + + [EMSGSIZE] The msg_iovlen member of msg was less than 0 or larger than + IOV_MAX. + + [EAFNOSUPPORT] + Addresses in the specified address family cannot be used + with this socket. + +SEE ALSO + fcntl(2), getsockopt(2), poll(2), recv(2), select(2), poll(2), + socket(2), write(2) + +HISTORY + The send() function call appeared in 4.2BSD. + +BSD Experimental July 28, 1998 2 + + + + + SHUTDOWN + + +SHUTDOWN(2) System Programmer's Manual SHUTDOWN(2) + +NAME + shutdown - shut down part of a full-duplex connection + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + + int + shutdown(int s, int how) + +DESCRIPTION + The shutdown() call causes all or part of a full-duplex connection on the + socket associated with s to be shut down. If how is SHUT_RD, further re- + ceives will be disallowed. If how is SHUT_WR, further sends will be dis- + allowed. If how is SHUT_RDWR, further sends and receives will be disal- + lowed. + +RETURN VALUES + A 0 is returned if the call succeeds, -1 if it fails. + +ERRORS + The call succeeds unless: + + [EINVAL] how is not SHUT_RD, SHUT_WR, or SHUT_RDWR. + + [EBADF] s is not a valid descriptor. + + [ENOTSOCK] s is a file, not a socket. + + [ENOTCONN] The specified socket is not connected. + +SEE ALSO + connect(2), socket(2) + +HISTORY + The shutdown() function call appeared in 4.2BSD. The how arguments used + to be simply 0, 1, and 2, but now have named values as specified by . + +BSD Experimental June 4, 1993 1 + + + + + SOCKET + + +SOCKET(2) System Programmer's Manual SOCKET(2) + +NAME + socket - create an endpoint for communication + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + + int + socket(int domain, int type, int protocol) + +DESCRIPTION + socket() creates an endpoint for communication and returns a descriptor. + + The domain parameter specifies a communications domain within which com- + munication will take place; this selects the protocol family which should + be used. These families are defined in the include file <sys/socket.h>. + The currently understood formats are + + AF_UNIX (UNIX internal protocols), + AF_INET (ARPA Internet protocols), + AF_INET6 (ARPA IPv6 protocols), + AF_ISO (ISO protocols), + AF_NS (Xerox Network Systems protocols), + AF_IPX (Internetwork Packet Exchange), and + AF_IMPLINK (IMP host at IMP link layer). + + The socket has the indicated type, which specifies the semantics of com- + munication. Currently defined types are: + + SOCK_STREAM + SOCK_DGRAM + SOCK_RAW + SOCK_SEQPACKET + SOCK_RDM + + A SOCK_STREAM type provides sequenced, reliable, two-way connection based + byte streams. An out-of-band data transmission mechanism may be support- + ed. A SOCK_DGRAM socket supports datagrams (connectionless, unreliable + messages of a fixed (typically small) maximum length). A SOCK_SEQPACKET + socket may provide a sequenced, reliable, two-way connection-based data + transmission path for datagrams of fixed maximum length; a consumer may + be required to read an entire packet with each read system call. This + facility is protocol specific, and presently implemented only for PF_NS. + SOCK_RAW sockets provide access to internal network protocols and inter- + faces. The types SOCK_RAW, which is available only to the superuser, and + SOCK_RDM, which is planned, but not yet implemented, are not described + here. + + The protocol specifies a particular protocol to be used with the socket. + Normally only a single protocol exists to support a particular socket + type within a given protocol family. However, it is possible that many + protocols may exist, in which case a particular protocol must be speci- + fied in this manner. The protocol number to use is particular to the + communication domain in which communication is to take place; see + protocols(5). A value of 0 for protocol will let the system select an + appropriate protocol for the requested socket type. + + Sockets of type SOCK_STREAM are full-duplex byte streams, similar to + pipes. A stream socket must be in a connected state before any data may + be sent or received on it. A connection to another socket is created + with a connect(2) call. Once connected, data may be transferred using + read(2) and write(2) calls or some variant of the send(2) and recv(2) + calls. When a session has been completed a close(2) may be performed. + Out-of-band data may also be transmitted as described in send(2) and re- + ceived as described in recv(2). + + The communications protocols used to implement a SOCK_STREAM ensure that + data is not lost or duplicated. If a piece of data for which the peer + protocol has buffer space cannot be successfully transmitted within a + reasonable length of time, then the connection is considered broken and + calls will indicate an error with -1 returns and with ETIMEDOUT as the + specific code in the global variable errno. The protocols optionally keep + sockets ``warm'' by forcing transmissions roughly every minute in the ab- + sence of other activity. An error is then indicated if no response can + be elicited on an otherwise idle connection for a extended period (e.g., + 5 minutes). A SIGPIPE signal is raised if a process sends on a broken + stream; this causes naive processes, which do not handle the signal, to + exit. + + SOCK_SEQPACKET sockets employ the same system calls as SOCK_STREAM sock- + ets. The only difference is that read(2) calls will return only the + amount of data requested, and any remaining in the arriving packet will + be discarded. + + SOCK_DGRAM and SOCK_RAW sockets allow sending of datagrams to correspon- + dents named in send(2) calls. Datagrams are generally received with + recvfrom(2), which returns the next datagram with its return address. + + An fcntl(2) call can be used to specify a process group to receive a + SIGURG signal when the out-of-band data arrives. It may also enable non- + blocking I/O and asynchronous notification of I/O events via SIGIO. + + The operation of sockets is controlled by socket level options. These op- + tions are defined in the file <sys/socket.h>. setsockopt(2) and getsock- + opt(2) are used to set and get options, respectively. + +RETURN VALUES + A -1 is returned if an error occurs, otherwise the return value is a de- + scriptor referencing the socket. + +ERRORS + The socket() call fails if: + + [EPROTONOSUPPORT] + The protocol type or the specified protocol is not support- + ed within this domain. + + [EMFILE] The per-process descriptor table is full. + + [ENFILE] The system file table is full. + + [EACCES] Permission to create a socket of the specified type and/or + protocol is denied. + + [ENOBUFS] Insufficient buffer space is available. The socket cannot + be created until sufficient resources are freed. + +SEE ALSO + accept(2), bind(2), connect(2), getsockname(2), getsockopt(2), + ioctl(2), listen(2), poll(2), read(2), recv(2), select(2), send(2), + setsockopt(2), shutdown(2), socketpair(2), write(2), getprotoent(3), + netintro(4) + + An Introductory 4.3 BSD Interprocess Communication Tutorial, reprinted in + UNIX Programmer's Supplementary Documents Volume 1. + + BSD Interprocess Communication Tutorial, reprinted in UNIX Programmer's + Supplementary Documents Volume 1. + +HISTORY + The socket() function call appeared in 4.2BSD. + +BSD Experimental June 4, 1993 3 + + + + + SOCKETPAIR + + +SOCKETPAIR(2) System Programmer's Manual SOCKETPAIR(2) + +NAME + socketpair - create a pair of connected sockets + +SYNOPSIS + #include <sys/types.h> + #include <sys/socket.h> + + int + socketpair(int d, int type, int protocol, int *sv) + +DESCRIPTION + The socketpair() call creates an unnamed pair of connected sockets in the + specified domain d, of the specified type, and using the optionally spec- + ified protocol. The descriptors used in referencing the new sockets are + returned in sv[0] and sv[1]. The two sockets are indistinguishable. + +RETURN VALUES + A 0 is returned if the call succeeds, -1 if it fails. + +ERRORS + The call succeeds unless: + + [EMFILE] Too many descriptors are in use by this process. + + [EAFNOSUPPORT] + The specified address family is not supported on this ma- + chine. + + [EPROTONOSUPPORT] + The specified protocol is not supported on this machine. + + [EOPNOTSUPP] The specified protocol does not support creation of socket + pairs. + + [EFAULT] The address sv does not specify a valid part of the process + address space. + + [ENFILE] The system file table is full. + +SEE ALSO + pipe(2), read(2), write(2) + +BUGS + This call is currently implemented only for the LOCAL domain. Many oper- + ating systems only accept a protocol of PF_UNSPEC, so that should be used + instead of PF_LOCAL for maximal portability. + +STANDARDS + The socketpair() function conforms to . + +HISTORY + The socketpair() function call appeared in 4.2BSD. + +BSD Experimental June 4, 1993 1 + + + + + + + + diff --git a/packages/net/common/current/doc/tcpip.sgml b/packages/net/common/current/doc/tcpip.sgml new file mode 100644 --- /dev/null +++ b/packages/net/common/current/doc/tcpip.sgml @@ -0,0 +1,449 @@ + +TCP/IP Stack Support for eCos + + +The Common Networking for eCos package +provides support for a complete TCP/IP networking stack. +The design allows for the actual stack to be modular and at the +current time two different implementations, one based on OpenBSD +from 2000 and a new version based on FreeBSD, are available. +The particulars of each stack implementation are presented in +separate sections following this top-level discussion. + + + +Ethernet Driver Design +Currently, the networking stack only supports ethernet based +networking. +The network drivers use a two-layer design. One layer is +hardware independent and contains all the stack specific code. +The other layer is platform dependent and communicates with the +hardware independent layer via a very simple API. In this way, +hardware device drivers can actually be used with other stacks, +if the same API can be provided by that stack. We designed the +drivers this way to encourage the development of other stacks in +eCos while allowing re-use of the actual hardware specific code. +More comprehensive documentation of the ethernet device driver and +the associated API can be found in the generic ethernet device driver +documentation + +The driver and API is the same as the minimal debug stack used by +the RedBoot application. See the RedBoot documentation + +for further +information. + + +Sample Code +Many examples using the networking support are provided. +These are arranged as eCos test programs, primarily for use in verifying +the package, but they can also serve as useful frameworks for program +design. We have taken a +KISS +approach to building programs which +use the network. A single include file +<network.h> is +all that is required to access the stack. A complete, annotated +test program can be found at +net/common/VERSION/tests/ftp_test.c, +with its associated files. + + +Configuring IP Addresses +Each interface (“eth0” and “eth1”) +has independent configuration of its setup. Each can be set up +manually (in which case you must write code to do this), or by using +BOOTP/DHCP, +or explicitly, with configured values. If additional +interfaces are added, these must be configured manually. +The configurable values are: + +IP address +netmask +broadcast address +gateway/router +server address. + +Server address is the DHCP server if applicable, but in addition, +many test cases use it as “the machine to talk to” in +whatever manner the test exercises the protocol stack. +The initialization is invoked by calling the C routine + +void init_all_network_interfaces(void); + + + +Additionally, if the system is configured to support IPv6 then each +interface may have an address assigned which is a composite of a 64 bit +prefix and the 32 bit IPv4 address for that interface. +The prefix is controlled by the CDL setting +CYGHWR_NET_DRIVER_ETH0_IPV6_PREFIX for “eth0”, etc. +This is a CDL booldata type, allowing this address to be suppressed if +not desired. + + +Refer to the test cases, +…/packages/net/common/VERSION/tests/ftp_test.c +for example usage, and the source files in +…/packages/net/common/VERSION/src/bootp_support.c +and +network_support.c +to see what that call does. +This assumes that the MAC address (also known as +ESA or Ethernet Station Address) +is already defined in the +serial EEPROM or however the particular target implements this; +support for setting the MAC address is hardware dependent. +DHCP support is active by default, and there are configuration +options to control it. Firstly, in the top level of the +“Networking” configuration +tree, “Use full DHCP instead of BOOTP” enables +DHCP, and it contains an option to have the system provide a thread +to renew DHCP leases and manage lease expiry. Secondly, the individual +interfaces “eth0” and “eth1” each +have new options within the “Use BOOTP/DHCP to +initialize ‘ethX’” to +select whether to use DHCP rather than BOOTP. + +Note that you are completely at liberty to ignore this startup code and its +configuration in building your application. +init_all_network_interfaces() +is provided for three main purposes: + +For use by Red Hat's own test programs. +As an easy “get you going” utility for +newcomers to eCos. +As readable example code from which further development +might start. + + +If your application has different requirements for bringing up +available network interfaces, setting up routes, determining IP addresses +and the like from the defaults that the example code provides, you can +write your own initialization code to use whatever sequence of +ioctl() function +calls carries out the desired setup. Analogously, in larger systems, +a sequence of “ifconfig&rdquo invocations is used; these mostly +map to ioctl() calls to manipulate the state of +the interface in question. + + + +Tests and Demonstrations + +<!-- <xref> -->Loopback tests +By default, only tests which can execute on any target + will be built. These therefore do not actually use external + network interfaces (though they may configure and initialize + them) but are limited to testing via the loopback + interface. +ping_lo_test - ping test of the loopback address +tcp_lo_select - simple test of select with TCP via loopback +tcp_lo_test - trivial TCP test via loopback +udp_lo_test - trivial UDP test via loopback +multi_lo_select - test of multiple select() calls simultaneously + + +Building the Network Tests +To build further network tests, ensure that the configuration +option CYGPKG_NET_BUILD_TESTS is set in your build +and then make the tests in the usual way. Alternatively +(with that option set) use +make -C net/common/VERSION/ tests +after building the eCos library, if you wish to build +only +the network tests. +This should give test executables in +install/tests/net/common/VERSION/tests +including +the following: +socket_test - trivial test of socket creation API +mbuf_test - trivial test of mbuf allocation API +ftp_test - simple FTP test, connects to “server” +ping_test - pings “server” and non-existent host to test timeout +dhcp_test - ping test, but also relinquishes and + reacquires DHCP leases periodically +flood - a flood ping test; use with care +tcp_echo - data forwarding program for performance test +nc_test_master - network characterization master +nc_test_slave - network characterization slave +server_test - a very simple server example +tftp_client_test - performs a tftp get and put from/to “server” +tftp_server_test - runs a tftp server for a short while +set_mac_address - set MAC address(es) of interfaces in NVRAM +bridge - contributed network bridge code +nc6_test_master - IPv4/IPv6 network characterization master +nc6_test_slave - IPv4/IPv6 network characterization slave +ga_server_test - a very simple IPv4/IPv6 server example + + + +Standalone Tests +socket_test - trivial test of socket creation API +mbuf_test - trivial test of mbuf allocation API +These two do not communicate over the net; they just perform +simple API tests then exit. +ftp_test - simple FTP test, connects to “server” +This test initializes the interface(s) then connects to the +FTP server on the “server” machine for for each +active interface in turn, confirms that the connection was successful, +disconnects and exits. This tests interworking with the server. +ping_test - pings “server” and non-existent host to test timeout +This test initializes the interface(s) then pings the server +machine in the standard way, then pings address “32 up” from +the server in the expectation that there is no machine there. This +confirms that the successful ping is not a false positive, and tests +the receive timeout. If there is such a machine, of course the +2nd set of pings succeeds, confirming that we can talk to a machine +not previously mentioned by configuration or by bootp. It then does +the same thing on the other interface, eth1. +dhcp_test - ping test, but also manipulates DHCP leases +This test is very similar to the ping test, but in addition, +provided the network package is not configured to do this automatically, +it manually relinquishes and reclaims DHCP leases for all available +interfaces. This tests the external API to DHCP. See section below +describing this. +flood - a flood ping test; use with care +This test performs pings on all interfaces as quickly as possible, +and only prints status information periodically. Flood pinging is +bad for network performance; so do not use this test on general +purpose networks unless protected by a switch. + + +Performance Test +tcp_echo - data forwarding program for performance test +tcp_echo is one +part of the standard performance test we use. The other parts are +host programs tcp_source and tcp_sink. + To make these (under LINUX) cd to the tests source directory in +the eCos repository and type “make -f make.linux” - +this should build tcp_source and tcp_sink. +The LINUX program “tcp_source” sends +data to the target. On the target, “tcp_echo” sends +it onwards to “tcp_sink” running +on LINUX. So the target must receive and send on all the data that tcp_source sends +it; the time taken for this is measured and the data rate is calculated. +To invoke the test, first start tcp_echo on +the target board and wait for it to become quiescent - it will report +work to calibrate a CPU load which can be used to simulate real +operating conditions for the stack. +Then on your LINUX machine, in one terminal window, invoke tcp_sink giving +it the IP address (or hostname) of one interface of the target board. + For example “tcp_sink 10.130.39.66”. + tcp_echo on the target +will print something like “SINK connection +from 10.130.39.13:1143” when tcp_sink is +correctly invoked. +Next, in another LINUX terminal window, invoke tcp_source, +giving it the IP address (or hostname) of an interface of the target +board, and optionally a background load to apply to the target while +the test runs. For example, “tcp_source +194.130.39.66” to run the test with no +additional target CPU load, or “tcp_source +194.130.39.66 85” to load it up to 85% used. + The target load must be a multiple of 5. tcp_echo on +the target will print something like “SOURCE +connection from 194.130.39.13:1144” when +tcp_source is correctly invoked. +You can connect tcp_sink to one target interface +and tcp_source to another, or both to the same interface. + Similarly, you can run tcp_sink and tcp_source on +the same LINUX machine or different ones. TCP/IP and ARP +look after them finding one another, as intended. +nc_test_master - network characterization master +nc_test_slave - network characterization slave +These tests talk to each other to measure network performance. +They can each run on either a test target or a LINUX host computer +given some customization to your local environment. As provided, nc_test_slave must +run on the test target, and nc_test_master must +be run on a LINUX host, and be given the test target's +IP address or hostname. +The tests print network performance for various packet sizes +over UDP and TCP, versus various additional CPU loads on the target. + +The programs nc6_test_slave +nc6_test_master +are additional forms which support both IPv4 and IPv6 addressing. + + + +Interactive Tests +server_test - a very simple server example +This test simply awaits a connection on port 7734 and after +accepting a connection, gets a packet (with a timeout of a few seconds) +and prints it. +The connection is then closed. We then loop to await the next +connection, and so on. To use it, telnet to the target on port 7734 +then type something (quickly!) +% telnet 172.16.19.171 7734 +Hello target board +and the test program will print something like: +connection from 172.16.19.13:3369 +buf = "Hello target board" + +ga_server_test - another very simple server example +This is a variation on the ga_server_test test +with the difference being that it uses the getaddrinfo +function to set up its addresses. On a system with IPv6 enabled, it will +listen on port 7734 for a TCP connection via either IPv4 or IPv6. + + +tftp_client_test - performs a tftp get and put from/to “server” +This is only partially interactive. You need to set things +up on the “server” in order for this to work, +and you will need to look at the server afterwards to confirm that all +was well. +For each interface in turn, this test attempts to read by +tftp from the server, a file called +tftp_get +and +prints the status and contents it read (if any). It then writes +the same data to a file called +tftp_put +on +the same server. +In order for this to succeed, both files must already exist. + The TFTP protocol does not require that a WRQ request _create_ a +file, just that it can write it. The TFTP server on Linux certainly +will only allow writes to an existing file, given the appropriate +permission. Thus, you need to have these files in place, with proper permission, +before running the test. +The conventional place for the tftp server to operate in LINUX +is /tftpboot/; you will likely need root privileges +to create files there. The data contents of +tftp_get +can +be anything you like, but anything very large will waste lots of +time printing it on the test’s stdout, and anything above +32kB will cause a buffer overflow and unpredictable failure. +Creating an empty tftp_put file (eg. by copying /dev/null +to it) is neatest. So before the test you should have something +like: +-rw-rw-rw- 1 root 1076 May 1 11:39 tftp_get +-rw-rw-rw- 1 root 0 May 1 15:52 tftp_put +note that both files have public permissions wide open. After +running the test, +tftp_put +should +be a copy of +tftp_get. +-rw-rw-rw- 1 root 1076 May 1 11:39 tftp_get +-rw-rw-rw- 1 root 1076 May 1 15:52 tftp_put + + +tftp_server_test - runs a tftp server for a short while +This test is truly interactive, in that you can use a standard +tftp application to get and put files from the server, during the +5 minutes that it runs. The dummy filesystem which underlies the +server initially contains one file, called “uu” which contains +part of a familiar text and some padding. It also accommodates +creation of 3 further files of up to 1Mb in size and names of up +to 256 bytes. Exceeding these limits will cause a buffer overflow +and unpredictable failure. +The dummy filesystem is an implementation of the generic API +which allows a true filesystem to be attached to the tftp server +in the network stack. +We have been testing the tftp server by running the test on +the target board, then using two different host computers connecting +to the different target interfaces, putting a file from each, getting +the “uu” file, and getting the file from the other computer. + This verifies that data is preserved during the transfer as well +as interworking with standard tftp applications. + + +Maintenance Tools +set_mac_address - set MAC address(es) of interfaces in NVRAM +This program makes an example ioctl() call +SIOCSIFHWADDR +“Socket IO Set InterFace HardWare ADDRess” +to set the MAC address on targets +where this is supported and enabled in the configuration. You must +edit the source to choose a MAC address and further edit it to allow +this very dangerous operation. Not all ethernet drivers support +this operation, because most ethernet hardware does not support +it — or it comes pre-set from the factory. +Do not use this program. + + + +Support Features + +TFTP +The TFTP client and server are described in +tftp_support.h; +the client API is simple and can be easily understood by reading +tftp_client_test.c. +The server is more complex. It requires a filesystem implementation +to be supplied by the user, and attached to the tftp server by means +of a vector of function pointers: +struct tftpd_fileops { + int (*open)(const char *, int); + int (*close)(int); + int (*write)(int, const void *, int); + int (*read)(int, void *, int); +}; +These functions have the obvious semantics. The structure +describing the filesystem is an argument to the tftpd_start(int, +struct tftpd_fileops *); call. + The first argument is the port to use for the server. +As discussed in the description of the tftp_server_test +above, an example filesystem is provided in +net/common/VERSION/src/tftp_dummy_file.c +for +use by the tftp server test. The dummy filesystem is not a supported +part of the network stack, it exists purely for demonstration purposes. + + +DHCP +This API publishes a routine to maintain DHCP state, and a +semaphore that is signalled when a lease requires attention: this +is your clue to call the aforementioned routine. +The intent with this API is that a simple DHCP client thread, +which maintains the state of the interfaces, can go as follows: +(after init_all_network_interfaces() is +called from elsewhere) +while ( 1 ) { + while ( 1 ) { + cyg_semaphore_wait( &dhcp_needs_attention ); + if ( ! dhcp_bind() ) // a lease expired + break; // If we need to re-bind + } + dhcp_halt(); // tear everything down + init_all_network_interfaces(); // re-initialize +} +and if the application does not want to suffer the overhead +of a separate thread and its stack for this, this functionality +can be placed in the app’s server loop in an obvious fashion. + That is the goal of breaking out these internal elements. For example, +some server might be arranged to poll DHCP from time to time like +this: +while ( 1 ) { + init_all_network_interfaces(); + open-my-listen-sockets(); + while ( 1 ) { + serve-one-request(); + // sleeps if no connections, but not forever; + // so this loop is polled a few times a minute... + if ( cyg_semaphore_trywait( &dhcp_needs_attention )) { + if ( ! dhcp_bind() ) { + close-my-listen-sockets(); + dhcp_halt(); + break; + } + } + } +} +If the configuration option CYGOPT_NET_DHCP_DHCP_THREAD +is defined, then eCos provides a thread as described initially. +Independent of this option, initialization of the interfaces still +occurs in init_all_network_interfaces() and +your startup code can call that. It will start the DHCP management +thread if configured. If a lease fails to be renewed, the management +thread will shut down all interfaces and attempt to initialize all +the interfaces again from scratch. This may cause chaos in the +app, which is why managing the DHCP state in an application aware +thread is actually better, just far less convenient for testing. + + + &net-common-current-doc-tcpip-manpages-sgml; + diff --git a/packages/net/common/current/include/arpa/ftp.h b/packages/net/common/current/include/arpa/ftp.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/arpa/ftp.h @@ -0,0 +1,130 @@ +//========================================================================== +// +// include/arpa/ftp.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1983, 1989 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)ftp.h 5.6 (Berkeley) 4/3/91 + */ + +#ifndef _ARPA_FTP_H_ +#define _ARPA_FTP_H_ + +/* Definitions for FTP; see RFC-765. */ + +/* + * Reply codes. + */ +#define PRELIM 1 /* positive preliminary */ +#define COMPLETE 2 /* positive completion */ +#define CONTINUE 3 /* positive intermediate */ +#define TRANSIENT 4 /* transient negative completion */ +#define ERROR 5 /* permanent negative completion */ + +/* + * Type codes + */ +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ + +#ifdef FTP_NAMES +char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; +#endif + +/* + * Form codes + */ +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ +#ifdef FTP_NAMES +char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; +#endif + +/* + * Structure codes + */ +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ +#ifdef FTP_NAMES +char *strunames[] = {"0", "File", "Record", "Page" }; +#endif + +/* + * Mode types + */ +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ +#ifdef FTP_NAMES +char *modenames[] = {"0", "Stream", "Block", "Compressed" }; +#endif + +/* + * Record Tokens + */ +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* + * Block Header + */ +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +#endif /* !_ARPA_FTP_H_ */ diff --git a/packages/net/common/current/include/arpa/inet.h b/packages/net/common/current/include/arpa/inet.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/arpa/inet.h @@ -0,0 +1,72 @@ +//========================================================================== +// +// include/arpa/inet.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1983 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)inet.h 5.7 (Berkeley) 4/3/91 + */ + +#ifndef _ARPA_INET_H_ +#define _ARPA_INET_H_ + +/* External definitions for functions in inet(3) */ + +__BEGIN_DECLS +extern in_addr_t inet_addr __P((const char *)); +extern int inet_aton __P((const char *, struct in_addr *)); +extern unsigned long inet_lnaof __P((struct in_addr)); +extern struct in_addr inet_makeaddr __P((u_long , u_long)); +extern unsigned long inet_netof __P((struct in_addr)); +extern unsigned long inet_network __P((const char *)); +extern char *inet_ntoa __P((struct in_addr)); +__END_DECLS + +#endif /* !_ARPA_INET_H_ */ diff --git a/packages/net/common/current/include/arpa/nameser.h b/packages/net/common/current/include/arpa/nameser.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/arpa/nameser.h @@ -0,0 +1,251 @@ +//========================================================================== +// +// include/arpa/nameser.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1983, 1989 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)nameser.h 5.25 (Berkeley) 4/3/91 + */ + +#ifndef _ARPA_NAMESER_H_ +#define _ARPA_NAMESER_H_ + +/* + * Define constants based on rfc883 + */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 256 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define MAXLABEL 63 /* maximum length of domain label */ + /* Number of bytes of fixed size data in query structure */ +#define QFIXEDSZ 4 + /* number of bytes of fixed size data in resource record */ +#define RRFIXEDSZ 10 + +/* + * Internet nameserver port number + */ +#define NAMESERVER_PORT 53 + +/* + * Currently defined opcodes + */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define STATUS 0x2 /* nameserver status query */ +// #define xxx 0x3 /* 0x3 reserved */ + /* non standard */ +#define UPDATEA 0x9 /* add resource record */ +#define UPDATED 0xa /* delete a specific resource record */ +#define UPDATEDA 0xb /* delete all nemed resource record */ +#define UPDATEM 0xc /* modify a specific resource record */ +#define UPDATEMA 0xd /* modify all named resource record */ + +#define ZONEINIT 0xe /* initial zone transfer */ +#define ZONEREF 0xf /* incremental zone referesh */ + +/* + * Currently defined response codes + */ +#define NOERROR 0 /* no error */ +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ + /* non standard */ +#define NOCHANGE 0xf /* update failed to change db */ + +/* + * Type values for resources and queries + */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* connonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ + /* non standard */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ + /* Query type values which do not appear in resource records */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ + +/* + * Values for class field + */ + +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net at MIT */ +#define C_HS 4 /* for Hesiod name server at MIT */ + /* Query class values which do not appear in resource records */ +#define C_ANY 255 /* wildcard match */ + +/* + * Status return codes for T_UNSPEC conversion routines + */ +#define CONV_SUCCESS 0 +#define CONV_OVERFLOW -1 +#define CONV_BADFMT -2 +#define CONV_BADCKSUM -3 +#define CONV_BADBUFLEN -4 + +#include + +/* + * Structure for query header, the order of the fields is machine and + * compiler dependent, in our case, the bits within a byte are assignd + * least significant first, while the order of transmition is most + * significant first. This requires a somewhat confusing rearrangement. + */ + +typedef struct { + u_short id; /* query identification number */ +#if BYTE_ORDER == BIG_ENDIAN + /* fields in third byte */ + u_char qr:1; /* response flag */ + u_char opcode:4; /* purpose of message */ + u_char aa:1; /* authoritive answer */ + u_char tc:1; /* truncated message */ + u_char rd:1; /* recursion desired */ + /* fields in fourth byte */ + u_char ra:1; /* recursion available */ + u_char pr:1; /* primary server required (non standard) */ + u_char unused:2; /* unused bits */ + u_char rcode:4; /* response code */ +#endif +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + u_char rd:1; /* recursion desired */ + u_char tc:1; /* truncated message */ + u_char aa:1; /* authoritive answer */ + u_char opcode:4; /* purpose of message */ + u_char qr:1; /* response flag */ + /* fields in fourth byte */ + u_char rcode:4; /* response code */ + u_char unused:2; /* unused bits */ + u_char pr:1; /* primary server required (non standard) */ + u_char ra:1; /* recursion available */ +#endif + /* remaining bytes */ + u_short qdcount; /* number of question entries */ + u_short ancount; /* number of answer entries */ + u_short nscount; /* number of authority entries */ + u_short arcount; /* number of resource entries */ +} HEADER; + +/* + * Defines for handling compressed domain names + */ +#define INDIR_MASK 0xc0 + +/* + * Structure for passing resource records around. + */ +struct rrec { + short r_zone; /* zone number */ + short r_class; /* class number */ + short r_type; /* type number */ + u_long r_ttl; /* time to live */ + int r_size; /* size of data area */ + char *r_data; /* pointer to data */ +}; + +/* + * Inline versions of get/put short/long. + * Pointer is advanced; we assume that both arguments + * are lvalues and will already be in registers. + * cp MUST be u_char *. + */ +#define GETSHORT(s, cp) { \ + (s) = *(cp)++ << 8; \ + (s) |= *(cp)++; \ +} + +#define GETLONG(l, cp) { \ + (l) = *(cp)++ << 8; \ + (l) |= *(cp)++; (l) <<= 8; \ + (l) |= *(cp)++; (l) <<= 8; \ + (l) |= *(cp)++; \ +} + + +#define PUTSHORT(s, cp) { \ + *(cp)++ = (s) >> 8; \ + *(cp)++ = (s); \ +} + +/* + * Warning: PUTLONG destroys its first argument. + */ +#define PUTLONG(l, cp) { \ + (cp)[3] = l; \ + (cp)[2] = (l >>= 8); \ + (cp)[1] = (l >>= 8); \ + (cp)[0] = l >> 8; \ + (cp) += sizeof(u_long); \ +} + +#endif /* !_ARPA_NAMESER_H_ */ diff --git a/packages/net/common/current/include/arpa/telnet.h b/packages/net/common/current/include/arpa/telnet.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/arpa/telnet.h @@ -0,0 +1,331 @@ +//========================================================================== +// +// include/arpa/telnet.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1983 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)telnet.h 5.14 (Berkeley) 4/3/91 + */ + +#ifndef _ARPA_TELNET_H_ +#define _ARPA_TELNET_H_ + +/* + * Definitions for the TELNET protocol. + */ +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ +#define EOR 239 /* end of record (transparent mode) */ +#define ABORT 238 /* Abort process */ +#define SUSP 237 /* Suspend process */ +#define xEOF 236 /* End of file: EOF is already used... */ + +#define SYNCH 242 /* for telfunc calls */ + +#ifdef TELCMDS +char *telcmds[] = { + "EOF", "SUSP", "ABORT", "EOR", + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, +}; +#else +extern char *telcmds[]; +#endif + +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] + +/* telnet options */ +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_TUID 26 /* TACACS user identification */ +#define TELOPT_OUTMRK 27 /* output marking */ +#define TELOPT_TTYLOC 28 /* terminal location number */ +#define TELOPT_3270REGIME 29 /* 3270 regime */ +#define TELOPT_X3PAD 30 /* X.3 PAD */ +#define TELOPT_NAWS 31 /* window size */ +#define TELOPT_TSPEED 32 /* terminal speed */ +#define TELOPT_LFLOW 33 /* remote flow control */ +#define TELOPT_LINEMODE 34 /* Linemode option */ +#define TELOPT_XDISPLOC 35 /* X Display Location */ +#define TELOPT_ENVIRON 36 /* Environment variables */ +#define TELOPT_AUTHENTICATION 37/* Authenticate */ +#define TELOPT_ENCRYPT 38 /* Encryption option */ +#define TELOPT_EXOPL 255 /* extended-options-list */ + + +#define NTELOPTS (1+TELOPT_ENCRYPT) +#ifdef TELOPTS +char *telopts[NTELOPTS+1] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", + "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", + "LINEMODE", "XDISPLOC", "ENVIRON", "AUTHENTICATION", + "ENCRYPT", + 0, +}; +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_ENCRYPT +#define TELOPT_OK(x) ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] +#endif + +/* sub-option qualifiers */ +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ +#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ +#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ +#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ + +/* + * LINEMODE suboptions + */ + +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 + +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 + +#define MODE_MASK 0x1f + +/* Not part of protocol, but needed to simplify things... */ +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 + +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 + +#define NSLC 18 + +/* + * For backwards compatability, we define SLC_NAMES to be the + * list of names if SLC_NAMES is not defined. + */ +#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, +#ifdef SLC_NAMES +char *slc_names[] = { + SLC_NAMELIST +}; +#else +extern char *slc_names[]; +#define SLC_NAMES SLC_NAMELIST +#endif + +#define SLC_NAME_OK(x) ((x) >= 0 && (x) < NSLC) +#define SLC_NAME(x) slc_names[x] + +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 + +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 + +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 + +#define ENV_VALUE 0 +#define ENV_VAR 1 +#define ENV_ESC 2 + +/* + * AUTHENTICATION suboptions + */ + +/* + * Who is authenticating who ... + */ +#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ +#define AUTH_WHO_SERVER 1 /* Server authenticating client */ +#define AUTH_WHO_MASK 1 + +/* + * amount of authentication done + */ +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 + +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_SPX 3 +#define AUTHTYPE_MINK 4 +#define AUTHTYPE_CNT 5 + +#define AUTHTYPE_TEST 99 + +#ifdef AUTH_NAMES +char *authtype_names[] = { + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, +}; +#else +extern char *authtype_names[]; +#endif + +#define AUTHTYPE_NAME_OK(x) ((x) >= 0 && (x) < AUTHTYPE_CNT) +#define AUTHTYPE_NAME(x) authtype_names[x] + +/* + * ENCRYPTion suboptions + */ +#define ENCRYPT_IS 0 /* I pick encryption type ... */ +#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ +#define ENCRYPT_REPLY 2 /* Initial setup response */ +#define ENCRYPT_START 3 /* Am starting to send encrypted */ +#define ENCRYPT_END 4 /* Am ending encrypted */ +#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ +#define ENCRYPT_REQEND 6 /* Request you send encrypting */ +#define ENCRYPT_ENC_KEYID 7 +#define ENCRYPT_DEC_KEYID 8 +#define ENCRYPT_CNT 9 + +#define ENCTYPE_ANY 0 +#define ENCTYPE_DES_CFB64 1 +#define ENCTYPE_DES_OFB64 2 +#define ENCTYPE_CNT 3 + +#ifdef ENCRYPT_NAMES +char *encrypt_names[] = { + "IS", "SUPPORT", "REPLY", "START", "END", + "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", + 0, +}; +char *enctype_names[] = { + "ANY", "DES_CFB64", "DES_OFB64", 0, +}; +#else +extern char *encrypt_names[]; +extern char *enctype_names[]; +#endif + + +#define ENCRYPT_NAME_OK(x) ((x) >= 0 && (x) < ENCRYPT_CNT) +#define ENCRYPT_NAME(x) encrypt_names[x] + +#define ENCTYPE_NAME_OK(x) ((x) >= 0 && (x) < ENCTYPE_CNT) +#define ENCTYPE_NAME(x) enctype_names[x] + +#endif /* !_ARPA_TELNET_H_ */ diff --git a/packages/net/common/current/include/arpa/tftp.h b/packages/net/common/current/include/arpa/tftp.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/arpa/tftp.h @@ -0,0 +1,101 @@ +//========================================================================== +// +// include/arpa/tftp.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* + * Copyright (c) 1983 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * + * @(#)tftp.h 5.4 (Berkeley) 4/3/91 + */ + +#ifndef _ARPA_TFTP_H_ +#define _ARPA_TFTP_H_ + +/* + * Trivial File Transfer Protocol (IEN-133) + */ +#define SEGSIZE 512 /* data segment size */ + +/* + * Packet types. + */ +#define RRQ 01 /* read request */ +#define WRQ 02 /* write request */ +#define DATA 03 /* data packet */ +#define ACK 04 /* acknowledgement */ +#define ERROR 05 /* error code */ + +struct tftphdr { + short th_opcode; /* packet type */ + union { + short tu_block; /* block # */ + short tu_code; /* error code */ + char tu_stuff[1]; /* request packet stuff */ + } __attribute__ ((packed)) th_u; + char th_data[1]; /* data or error string */ +} __attribute__ ((packed)); + +#define th_block th_u.tu_block +#define th_code th_u.tu_code +#define th_stuff th_u.tu_stuff +#define th_msg th_data + +/* + * Error codes. + */ +#define EUNDEF 0 /* not defined */ +#define ENOTFOUND 1 /* file not found */ +#define EACCESS 2 /* access violation */ +#define ENOSPACE 3 /* disk full or allocation exceeded */ +#define EBADOP 4 /* illegal TFTP operation */ +#define EBADID 5 /* unknown transfer ID */ +#define EEXISTS 6 /* file already exists */ +#define ENOUSER 7 /* no such user */ + +#endif /* !_ARPA_TFTP_H_ */ diff --git a/packages/net/common/current/include/bootp.h b/packages/net/common/current/include/bootp.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/bootp.h @@ -0,0 +1,362 @@ +//========================================================================== +// +// include/bootp.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/************************************************************************ + Copyright 1988, 1991 by Carnegie Mellon University + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided +that the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of Carnegie Mellon University not be used +in advertising or publicity pertaining to distribution of the software +without specific, written prior permission. + +CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. +************************************************************************/ + +#ifndef _BOOTP_H_ +#define _BOOTP_H_ + +/* + * Bootstrap Protocol (BOOTP). RFC951 and RFC1395. + * + * This file specifies the "implementation-independent" BOOTP protocol + * information which is common to both client and server. + * + */ + +#ifdef __ECOS + +#include +#include + +#include +#else +#include "bptypes.h" /* for int32, u_int32 */ +#endif + +#define BP_CHADDR_LEN 16 +#define BP_SNAME_LEN 64 +#define BP_FILE_LEN 128 + +/* std min packet size to transmit for DHCP relays to work */ +#define BP_STD_TX_MINPKTSZ (300) + +#ifdef CYGPKG_NET_DHCP +// The standard requires only 312 bytes here +#define BP_VEND_LEN (312 + 32) +#define BP_MINPKTSZ 576 +#else +#define BP_VEND_LEN 64 +#define BP_MINPKTSZ 300 /* to check sizeof(struct bootp) */ +#endif + +#define BP_MAX_OPTION_LEN 256 + +struct bootp { + unsigned char bp_op; /* packet opcode type */ + unsigned char bp_htype; /* hardware addr type */ + unsigned char bp_hlen; /* hardware addr length */ + unsigned char bp_hops; /* gateway hops */ +#ifdef __ECOS + u_int32_t bp_xid; /* transaction ID */ +#else + unsigned int bp_xid; /* transaction ID */ +#endif + unsigned short bp_secs; /* seconds since boot began */ + unsigned short bp_flags; /* RFC1532 broadcast, etc. */ + struct in_addr bp_ciaddr; /* client IP address */ + struct in_addr bp_yiaddr; /* 'your' IP address */ + struct in_addr bp_siaddr; /* server IP address */ + struct in_addr bp_giaddr; /* gateway IP address */ + unsigned char bp_chaddr[BP_CHADDR_LEN]; /* client hardware address */ + char bp_sname[BP_SNAME_LEN]; /* server host name */ + char bp_file[BP_FILE_LEN]; /* boot file name */ + unsigned char bp_vend[BP_VEND_LEN]; /* vendor-specific area */ + /* note that bp_vend can be longer, extending to end of packet. */ +}; + +/* + * UDP port numbers, server and client. + */ +#define IPPORT_BOOTPS 67 +#define IPPORT_BOOTPC 68 + +#define BOOTREPLY 2 +#define BOOTREQUEST 1 + +/* + * Hardware types from Assigned Numbers RFC. + */ +#define HTYPE_ETHERNET 1 +#define HTYPE_EXP_ETHERNET 2 +#define HTYPE_AX25 3 +#define HTYPE_PRONET 4 +#define HTYPE_CHAOS 5 +#define HTYPE_IEEE802 6 +#define HTYPE_ARCNET 7 + +/* + * Vendor magic cookie (v_magic) for CMU + */ +#define VM_CMU "CMU" + +/* + * Vendor magic cookie (v_magic) for RFC1048 + */ +#define VM_RFC1048 { 99, 130, 83, 99 } + + + +/* + * Tag values used to specify what information is being supplied in + * the vendor (options) data area of the packet. + */ +/* RFC 1048 */ +/* End of cookie */ +#define TAG_END ((unsigned char) 255) +/* padding for alignment */ +#define TAG_PAD ((unsigned char) 0) +/* Subnet mask */ +#define TAG_SUBNET_MASK ((unsigned char) 1) +/* Time offset from UTC for this system */ +#define TAG_TIME_OFFSET ((unsigned char) 2) +/* List of routers on this subnet */ +#define TAG_GATEWAY ((unsigned char) 3) +/* List of rfc868 time servers available to client */ +#define TAG_TIME_SERVER ((unsigned char) 4) +/* List of IEN 116 name servers */ +#define TAG_NAME_SERVER ((unsigned char) 5) +/* List of DNS name servers */ +#define TAG_DOMAIN_SERVER ((unsigned char) 6) +/* List of MIT-LCS UDL log servers */ +#define TAG_LOG_SERVER ((unsigned char) 7) +/* List of rfc865 cookie servers */ +#define TAG_COOKIE_SERVER ((unsigned char) 8) +/* List of rfc1179 printer servers (in order to try) */ +#define TAG_LPR_SERVER ((unsigned char) 9) +/* List of Imagen Impress servers (in prefered order) */ +#define TAG_IMPRESS_SERVER ((unsigned char) 10) +/* List of rfc887 Resourse Location servers */ +#define TAG_RLP_SERVER ((unsigned char) 11) +/* Hostname of client */ +#define TAG_HOST_NAME ((unsigned char) 12) +/* boot file size */ +#define TAG_BOOT_SIZE ((unsigned char) 13) +/* RFC 1395 */ +/* path to dump to in case of crash */ +#define TAG_DUMP_FILE ((unsigned char) 14) +/* domain name for use with the DNS */ +#define TAG_DOMAIN_NAME ((unsigned char) 15) +/* IP address of the swap server for this machine */ +#define TAG_SWAP_SERVER ((unsigned char) 16) +/* The path name to the root filesystem for this machine */ +#define TAG_ROOT_PATH ((unsigned char) 17) +/* RFC 1497 */ +/* filename to tftp with more options in it */ +#define TAG_EXTEN_FILE ((unsigned char) 18) +/* RFC 1533 */ +/* The following are in rfc1533 and may be used by BOOTP/DHCP */ +/* IP forwarding enable/disable */ +#define TAG_IP_FORWARD ((unsigned char) 19) +/* Non-Local source routing enable/disable */ +#define TAG_IP_NLSR ((unsigned char) 20) +/* List of pairs of addresses/masks to allow non-local source routing to */ +#define TAG_IP_POLICY_FILTER ((unsigned char) 21) +/* Maximum size of datagrams client should be prepared to reassemble */ +#define TAG_IP_MAX_DRS ((unsigned char) 22) +/* Default IP TTL */ +#define TAG_IP_TTL ((unsigned char) 23) +/* Timeout in seconds to age path MTU values found with rfc1191 */ +#define TAG_IP_MTU_AGE ((unsigned char) 24) +/* Table of MTU sizes to use when doing rfc1191 MTU discovery */ +#define TAG_IP_MTU_PLAT ((unsigned char) 25) +/* MTU to use on this interface */ +#define TAG_IP_MTU ((unsigned char) 26) +/* All subnets are local option */ +#define TAG_IP_SNARL ((unsigned char) 27) +/* broadcast address */ +#define TAG_IP_BROADCAST ((unsigned char) 28) +/* perform subnet mask discovery using ICMP */ +#define TAG_IP_SMASKDISC ((unsigned char) 29) +/* act as a subnet mask server using ICMP */ +#define TAG_IP_SMASKSUPP ((unsigned char) 30) +/* perform rfc1256 router discovery */ +#define TAG_IP_ROUTERDISC ((unsigned char) 31) +/* address to send router solicitation requests */ +#define TAG_IP_ROUTER_SOL_ADDR ((unsigned char) 32) +/* list of static routes to addresses (addr, router) pairs */ +#define TAG_IP_STATIC_ROUTES ((unsigned char) 33) +/* use trailers (rfc893) when using ARP */ +#define TAG_IP_TRAILER_ENC ((unsigned char) 34) +/* timeout in seconds for ARP cache entries */ +#define TAG_ARP_TIMEOUT ((unsigned char) 35) +/* use either Ethernet version 2 (rfc894) or IEEE 802.3 (rfc1042) */ +#define TAG_ETHER_IEEE ((unsigned char) 36) +/* default TCP TTL when sending TCP segments */ +#define TAG_IP_TCP_TTL ((unsigned char) 37) +/* time for client to wait before sending a keepalive on a TCP connection */ +#define TAG_IP_TCP_KA_INT ((unsigned char) 38) +/* don't send keepalive with an octet of garbage for compatability */ +#define TAG_IP_TCP_KA_GARBAGE ((unsigned char) 39) +/* NIS domainname */ +#define TAG_NIS_DOMAIN ((unsigned char) 40) +/* list of NIS servers */ +#define TAG_NIS_SERVER ((unsigned char) 41) +/* list of NTP servers */ +#define TAG_NTP_SERVER ((unsigned char) 42) +/* and stuff vendors may want to add */ +#define TAG_VEND_SPECIFIC ((unsigned char) 43) +/* NetBios over TCP/IP name server */ +#define TAG_NBNS_SERVER ((unsigned char) 44) +/* NetBios over TCP/IP NBDD servers (rfc1001/1002) */ +#define TAG_NBDD_SERVER ((unsigned char) 45) +/* NetBios over TCP/IP node type option for use with above */ +#define TAG_NBOTCP_OTPION ((unsigned char) 46) +/* NetBios over TCP/IP scopt option for use with above */ +#define TAG_NB_SCOPE ((unsigned char) 47) +/* list of X Window system font servers */ +#define TAG_XFONT_SERVER ((unsigned char) 48) +/* list of systems running X Display Manager (xdm) available to this client */ +#define TAG_XDISPLAY_SERVER ((unsigned char) 49) + +/* While the following are only allowed for DHCP */ +/* DHCP requested IP address */ +#define TAG_DHCP_REQ_IP ((unsigned char) 50) +/* DHCP time for lease of IP address */ +#define TAG_DHCP_LEASE_TIME ((unsigned char) 51) +/* DHCP options overload */ +#define TAG_DHCP_OPTOVER ((unsigned char) 52) +/* DHCP message type */ +#define TAG_DHCP_MESS_TYPE ((unsigned char) 53) +/* DHCP server identification */ +#define TAG_DHCP_SERVER_ID ((unsigned char) 54) +/* DHCP ordered list of requested parameters */ +#define TAG_DHCP_PARM_REQ_LIST ((unsigned char) 55) +/* DHCP reply message */ +#define TAG_DHCP_TEXT_MESSAGE ((unsigned char) 56) +/* DHCP maximum packet size willing to accept */ +#define TAG_DHCP_MAX_MSGSZ ((unsigned char) 57) +/* DHCP time 'til client needs to renew */ +#define TAG_DHCP_RENEWAL_TIME ((unsigned char) 58) +/* DHCP time 'til client needs to rebind */ +#define TAG_DHCP_REBIND_TIME ((unsigned char) 59) +/* DHCP class identifier */ +#define TAG_DHCP_CLASSID ((unsigned char) 60) +/* DHCP client unique identifier */ +#define TAG_DHCP_CLIENTID ((unsigned char) 61) + +/* XXX - Add new tags here */ + + +/* + * "vendor" data permitted for CMU bootp clients. + */ + +struct cmu_vend { + char v_magic[4]; /* magic number */ +#ifdef __ECOS + u_int32_t v_flags; /* flags/opcodes, etc. */ +#else + unsigned int32 v_flags; /* flags/opcodes, etc. */ +#endif + struct in_addr v_smask; /* Subnet mask */ + struct in_addr v_dgate; /* Default gateway */ + struct in_addr v_dns1, v_dns2; /* Domain name servers */ + struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */ + struct in_addr v_ts1, v_ts2; /* Time servers */ +#ifdef __ECOS + int32_t v_unused[6]; /* currently unused */ +#else + int32 v_unused[6]; /* currently unused */ +#endif +}; + + +/* v_flags values */ +#define VF_SMASK 1 /* Subnet mask field contains valid data */ + +#ifdef __ECOS +#ifdef CYGHWR_NET_DRIVER_ETH0 +extern struct bootp eth0_bootp_data; +extern cyg_bool_t eth0_up; +extern const char *eth0_name; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 +extern struct bootp eth1_bootp_data; +extern cyg_bool_t eth1_up; +extern const char *eth1_name; +#endif + +// ------------------------------------------------------------------------ +// Initialize your own bootp record however you like, as far as is needed +// to bring up an interface. +__externC void +build_bootp_record(struct bootp *bp, + const char *if_name, + const char *addrs_ip, + const char *addrs_netmask, + const char *addrs_broadcast, + const char *addrs_gateway, + const char *addrs_server); + +// Do bootp to fill in the bootp record from the net (other interfaces must +// be down for this to work, because of the "half-up" state of the +// interface in use) +__externC cyg_bool_t do_bootp(const char *interface, struct bootp *res); + +// Initialize an interface (which is down) according to a bootp structure +__externC cyg_bool_t init_net(const char *interface, struct bootp *res); +#ifdef CYGPKG_NET_INET6 +__externC cyg_bool_t init_net_IPv6(const char *intf, struct bootp *bp, char *prefix); +#endif + +// Dump contents to diag_printf +__externC void show_bootp(const char *interface, struct bootp *res); + +// Interrogate a bootp record for a particular option +__externC cyg_bool_t get_bootp_option(struct bootp *bp, unsigned char tag, void *res, unsigned int * length); + +// ------------------------------------------------------------------------ +// This isn't exactly the right place for this since bootp is not involved +// BUT you will only be using this API if you are using bootp-style +// initialization of the other interfaces; it fits here in a documentation +// sense. +__externC cyg_bool_t init_loopback_interface(int lo); + +// ------------------------------------------------------------------------ +// Do all the above automatically according to the configuration. Do not +// mix using this and making the above calls yourself. +// (this is also declared in the much simpler API in network.h) +__externC void init_all_network_interfaces(void); + +#endif + +#endif // _BOOTP_H_ diff --git a/packages/net/common/current/include/dhcp.h b/packages/net/common/current/include/dhcp.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/dhcp.h @@ -0,0 +1,240 @@ +#ifndef CYGONCE_NET_TCPIP_DHCP_H +#define CYGONCE_NET_TCPIP_DHCP_H + +//========================================================================== +// +// include/dhcp.h +// +// DHCP protocol support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: gthomas +// Date: 2000-07-01 +// Purpose: Support DHCP initialization in eCos TCPIP stack +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// +// DHCP. RFC2131, RFC1533, RFC1534 +// See also bootp.h +// + +#include +#include + +#ifdef CYGPKG_NET_DHCP + +#include + +#include + +#include + +// DHCP messages; these are sent in the tag TAG_DHCP_MESS_TYPE already +// defined in bootp.h + +#define DHCPDISCOVER 1 +#define DHCPOFFER 2 +#define DHCPREQUEST 3 +#define DHCPDECLINE 4 +#define DHCPACK 5 +#define DHCPNAK 6 +#define DHCPRELEASE 7 + +// DHCP interface state machine states; these are published so that app +// code can know what to do... (see page 35 of RFC2131) + +// These we will use in the normal course of events +#define DHCPSTATE_INIT 1 +#define DHCPSTATE_SELECTING 2 // wait for replies to b/c DISCOVER +#define DHCPSTATE_REQUESTING 3 +#define DHCPSTATE_REQUEST_RECV 4 // wait for replies to b/c REQUEST +#define DHCPSTATE_BOUND 5 +#define DHCPSTATE_RENEWING 6 // wait for replies to u/c REQUEST +#define DHCPSTATE_RENEW_RECV 7 +#define DHCPSTATE_REBINDING 8 // wait for replies to b/c REQUEST +#define DHCPSTATE_REBIND_RECV 9 +#define DHCPSTATE_BOOTP_FALLBACK 10 // fall back to plain bootp +#define DHCPSTATE_NOTBOUND 11 // To let app tidy up +#define DHCPSTATE_FAILED 12 // Net is down +#define DHCPSTATE_DO_RELEASE 13 // Force release of the current lease +// These we don't use +//#define DHCPSTATE_INITREBOOT +//#define DHCPSTATE_REBOOTING + +// These are to let the app inspect the state of the interfaces when +// managing them itself, by analogy with eth0_up &c; eth0_bootp_data and so +// on will still be used with DHCP. +#ifdef CYGHWR_NET_DRIVER_ETH0 +extern cyg_uint8 eth0_dhcpstate; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 +extern cyg_uint8 eth1_dhcpstate; +#endif + +// This is public so the app can wait on it or poll it when managing DHCP +// itself. It will be zero while the app should wait, and posted when a +// call to do_dhcp() is needed. If, instead, the app wishes to manage DHCP +// with a thread per interface somehow, then separate semaphores may be used. +// See the dhcp_lease structure definition below. +extern cyg_sem_t dhcp_needs_attention; + +// This routine is used at startup time, and after relinquishing leases or +// after a lease timeout: it does DHCP or bootp or static setup according +// to configuration. +extern void init_all_network_interfaces(void); + +// This routine does the work of renewing leases &c. +// return value: 1 => everything OK, no change. +// 0 => close your connections, then call do_dhcp_halt() to halt the +// interface(s) in question (it knows because the state will be NOTBOUND). +// After that you can return to the start and use +// init_all_network_interfaces() as usual. +extern int dhcp_bind( void ); + +// Shutdown any interface which is not already shut down - whether +// initialized by DHCP or not. Reason: because of the broadcast-while-not- +// -fully-initialized nature of the DHCP conversation, all other interfaces +// must be shut down during that. So one down, all down, is required. +extern int dhcp_halt( void ); + +// Release (and set state to DHCPSTATE_NOTBOUND) all interfaces - we are +// closing down. (unlikely but useful for testing) +// Interfaces are left up; use dhcp_halt() to bring them right down, then +// call init_all_network_interfaces() as usual to restart all. +extern int dhcp_release( void ); + +// The intent with this API is that a simple DHCP client thread, which +// maintains the state of the interfaces, can go as follows: +// (after init_all_networks is called from elsewhere) +// +// while ( 1 ) { +// while ( 1 ) { +// cyg_semaphore_wait( &dhcp_needs_attention ); +// if ( ! dhcp_bind() ) // a lease expired +// break; // If we need to re-bind +// } +// dhcp_halt(); // tear everything down +// init_all_network_interfaces(); // re-initialize +// } +// +// and if the application does not want to suffer the overhead of a +// separate thread and its stack for this, this functionality can be placed +// in the app's server loop in an obvious fashion. That is the goal of +// breaking out these internal elements. For example, some server might +// be arranged to poll DHCP from time to time like this: +// +// while ( 1 ) { +// init_all_network_interfaces(); +// open-my-listen-sockets(); +// while ( 1 ) { +// serve-one-request(); +// // sleeps if no connections, but not forever; so this loop is +// // polled a few times a minute... +// if ( cyg_semaphore_trywait( &dhcp_needs_attention )) { +// if ( ! dhcp_bind() ) { +// close-my-listen-sockets(); +// dhcp_halt(); +// break; +// } +// } +// } +// } +// +// ------------------------------------------------------------------------ + +#ifdef CYGOPT_NET_DHCP_DHCP_THREAD +// Then we provide such a thread... + +// Provide a separate thread to renew DHCP leases; otherwise the +// application MUST periodically examine the semaphore dhcp_needs_attention +// and call dhcp_bind() if it is signalled. If enabled, this thread does +// all that for you. Independent of this option, initialization of the +// interfaces still occurs in init_all_network_interfaces() and your +// startup code must call that. It will start the DHCP management thread +// if necessary. If a lease fails to be renewed, the management thread +// will shut down all interfaces and attempt to initialize all the +// interfaces again from scratch. This may cause chaos in the app, which +// is why managing the DHCP state in an application aware thread is +// actually better, just far less convenient for testing. + +extern cyg_handle_t dhcp_mgt_thread_h; // To allow its external manipulation. +extern cyg_thread dhcp_mgt_thread; // The object itself + +extern void dhcp_start_dhcp_mgt_thread( void ); + +#endif + +// The function is provided unconditionally so that the app can put it in a +// thread of its own. If the parameter is true, it loops forever; if +// false, the call returns if a lease expires, and the caller must tidy up +// or reboot the whole machine. +extern cyg_thread_entry_t dhcp_mgt_entry; +extern void dhcp_mgt_entry( cyg_addrword_t loop_on_failure ); // the function + +// --------------------------------------------------------------------------- +// These are rather more internal routines, internal to the protocol engine +// in dhcp_prot.c - those above are in dhcp_support.c + +#define DHCP_LEASE_T1 1 +#define DHCP_LEASE_T2 2 +#define DHCP_LEASE_EX 4 + +struct dhcp_lease { + // Client settable: Semaphore to signal when attention is needed: + cyg_sem_t *needs_attention; + // Initialize all the rest to zero: + cyg_tick_count_t t1, t2, expiry; + volatile cyg_uint8 next; + volatile cyg_uint8 which; + cyg_handle_t alarm; + // except this one, which is just some space: + cyg_alarm alarm_obj; +}; + +// These dhcp_lease objects are initialized to use +// extern cyg_sem_t dhcp_needs_attention; +// for the semaphore. +#ifdef CYGHWR_NET_DRIVER_ETH0 +extern struct dhcp_lease eth0_lease; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 +extern struct dhcp_lease eth1_lease; +#endif + +extern int +do_dhcp(const char *interface, struct bootp *res, + cyg_uint8 *pstate, struct dhcp_lease *lease); +// NB *res and *pstate and *lease are all INOUT; *res must point to a valid +// record from "last time". + +extern int +do_dhcp_down_net(const char *intf, struct bootp *res, + cyg_uint8 *pstate, struct dhcp_lease *lease); + +extern int +do_dhcp_release(const char *intf, struct bootp *res, + cyg_uint8 *pstate, struct dhcp_lease *lease); + +#endif // CYGPKG_NET_DHCP + +#endif // CYGONCE_NET_TCPIP_DHCP_H +// EOF dhcp.h diff --git a/packages/net/common/current/include/ifaddrs.h b/packages/net/common/current/include/ifaddrs.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/ifaddrs.h @@ -0,0 +1,74 @@ +//========================================================================== +// +// include/ifaddrs.h +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +/* $KAME: ifaddrs.h,v 1.3 2001/01/26 08:14:55 itojun Exp $ */ + +/* + * Copyright (c) 1995, 1999 + * Berkeley Software Design, 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. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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. + * + * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp + */ + +#ifndef _IFADDRS_H_ +#define _IFADDRS_H_ + +struct ifaddrs { + struct ifaddrs *ifa_next; + char *ifa_name; + u_int ifa_flags; + struct sockaddr *ifa_addr; + struct sockaddr *ifa_netmask; + struct sockaddr *ifa_dstaddr; + void *ifa_data; +}; + +/* + * This may have been defined in . Note that if is + * to be included it must be included before this header file. + */ +#ifndef ifa_broadaddr +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ +#endif + +__BEGIN_DECLS +extern int getifaddrs __P((struct ifaddrs **)); +extern void freeifaddrs __P((struct ifaddrs *)); +__END_DECLS + +#endif diff --git a/packages/net/common/current/include/machine/ansi.h b/packages/net/common/current/include/machine/ansi.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/machine/ansi.h @@ -0,0 +1,41 @@ +//========================================================================== +// +// include/machine/ansi.h +// +// Architecture/platform specifics +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#ifndef _MACHINE_ANSI_H_ +#define _MACHINE_ANSI_H_ + +// Mappings of BSD-style functions used in networking code to those provided +// by the eCos environment. + +// Nothing to do here any more. + +#endif // _MACHINE_ANSI_H_ + diff --git a/packages/net/common/current/include/machine/endian.h b/packages/net/common/current/include/machine/endian.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/machine/endian.h @@ -0,0 +1,47 @@ +//========================================================================== +// +// include/machine/endian.h +// +// Architecture/platform specific byte ordering support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +#include + +#if CYG_BYTEORDER == CYG_MSBFIRST +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif +#include + +#endif // _MACHINE_ENDIAN_H_ + + diff --git a/packages/net/common/current/include/net/netdb.h b/packages/net/common/current/include/net/netdb.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/net/netdb.h @@ -0,0 +1,143 @@ +//========================================================================== +// +// include/netdb.h +// +// eCos implementations of network "database" functions +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// +// Support for various "network databases" +// + +#ifndef _NETDB_H_ +#define _NETDB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +// Internet protocols +struct protoent { + char *p_name; + int p_proto; +}; + +struct protoent *getprotobyname(const char *); +struct protoent *getprotobynumber(const int); + +// Internet services +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port number */ + char *s_proto; /* protocol to use */ +}; + +struct servent *getservbyname(const char *name, const char *proto); +struct servent *getservbyport(int port, const char *proto); + +// Name/address manipulation +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; + +/* + * Error return codes from getaddrinfo(), getnameinfo() + */ +#define EAI_NONE 0 /* valid return - no errors */ +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ +#define EAI_BADHINTS 12 /* inconsistent hints */ +#define EAI_PROTOCOL 13 +#define EAI_MAX 14 + +/* + * Flag values for getaddrinfo() + */ +#define AI_PASSIVE 0x00000001 /* get address to use bind() */ +#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ +#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ +/* valid flags for addrinfo */ +#define AI_MASK \ + (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG) + +#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ +#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ +#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ +#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ +/* special recommended flags for getipnodebyname */ +#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) + +int getaddrinfo(const char *, const char *, + const struct addrinfo *, struct addrinfo **); +void freeaddrinfo(struct addrinfo *); +char *gai_strerror(int); + +/* + * Support for getnameinfo() + */ + +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 + +#define NI_NUMERICHOST 1 /* Don't try to look up hostname. */ +#define NI_NUMERICSERV 2 /* Don't convert port number to name. */ +#define NI_NOFQDN 4 /* Only return nodename portion. */ +#define NI_NAMEREQD 8 /* Don't return numeric addresses. */ +#define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ + +/* Translate a socket address to a location and service name. */ +int getnameinfo (const struct sockaddr *sa, socklen_t salen, + char *host, socklen_t hostlen, + char *serv, socklen_t servlen, + unsigned int flags); + +// Miscellaneous address manipulation functions +char *inet_ntoa(struct in_addr); +char *inet_ntop(int af, char *src, char *dst, size_t len); +int inet_pton(int af, char *src, char *dst); +char *_inet_ntop(struct sockaddr *sa, char *dst, size_t len); +u_int16_t _inet_port(struct sockaddr *sa); + +#ifdef __cplusplus +} +#endif +#endif // _NETDB_H_ diff --git a/packages/net/common/current/include/network.h b/packages/net/common/current/include/network.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/network.h @@ -0,0 +1,84 @@ +//========================================================================== +// +// include/network.h +// +// Misc network support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#ifndef _NETWORK_H_ +#define _NETWORK_H_ + +#define NO_LIBKERN_INLINE // Avoid kernel inline functions + +#include +#include +#undef _KERNEL +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#ifdef CYGHWR_NET_DRIVER_ETH0 +extern struct bootp eth0_bootp_data; +extern cyg_bool_t eth0_up; +extern const char *eth0_name; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 +extern struct bootp eth1_bootp_data; +extern cyg_bool_t eth1_up; +extern const char *eth1_name; +#endif + +__externC void init_all_network_interfaces(void); + +__externC void cyg_route_reinit(void); +__externC void perror(const char *); +__externC int close(int); +__externC ssize_t read(int, void *, size_t); +__externC ssize_t write(int, const void *, size_t); +__externC int select(int, fd_set *, fd_set *, fd_set *, struct timeval *tv); + +// This API is for our own automated network tests. +// It's not at all supported. +#define CYG_NET_GET_MEM_STATS_MISC 0 // Misc mpool +#define CYG_NET_GET_MEM_STATS_MBUFS 1 // Mbufs pool +#define CYG_NET_GET_MEM_STATS_CLUST 2 // Clust pool +int cyg_net_get_mem_stats( int which, cyg_mempool_info *p ); + +#endif // _NETWORK_H_ diff --git a/packages/net/common/current/include/tftp_support.h b/packages/net/common/current/include/tftp_support.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/include/tftp_support.h @@ -0,0 +1,91 @@ +//========================================================================== +// +// include/tftp_support.h +// +// TFTP support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-04-06 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#ifndef _TFTP_SUPPORT_H_ +#define _TFTP_SUPPORT_H_ + +/* + * File transfer modes + */ +#define TFTP_NETASCII 0 // Text files +#define TFTP_OCTET 1 // Binary files + +/* + * Errors + */ + +// These initial 7 are passed across the net in "ERROR" packets. +#define TFTP_ENOTFOUND 1 /* file not found */ +#define TFTP_EACCESS 2 /* access violation */ +#define TFTP_ENOSPACE 3 /* disk full or allocation exceeded */ +#define TFTP_EBADOP 4 /* illegal TFTP operation */ +#define TFTP_EBADID 5 /* unknown transfer ID */ +#define TFTP_EEXISTS 6 /* file already exists */ +#define TFTP_ENOUSER 7 /* no such user */ +// These extensions are return codes in our API, *never* passed on the net. +#define TFTP_TIMEOUT 8 /* operation timed out */ +#define TFTP_NETERR 9 /* some sort of network error */ +#define TFTP_INVALID 10 /* invalid parameter */ +#define TFTP_PROTOCOL 11 /* protocol violation */ +#define TFTP_TOOLARGE 12 /* file is larger than buffer */ + +/* + * Server support + */ + +struct tftpd_fileops { + int (*open)(const char *, int); + int (*close)(int); + int (*write)(int, const void *, int); + int (*read)(int, void *, int); +}; + +// Flags - passed to "open" +#ifndef O_RDONLY +#define O_RDONLY 1 +#define O_WRONLY 2 +#endif + +__externC int tftpd_start(int, struct tftpd_fileops *); +__externC int tftpd_stop(int); + +/* + * Client support + */ + +__externC int tftp_get(char *, struct sockaddr_in *, char *, int, int, int *); +__externC int tftp_put(char *, struct sockaddr_in *, char *, int, int, int *); + +#define TFTP_TIMEOUT_PERIOD 5 // Seconds between retries +#define TFTP_TIMEOUT_MAX 50 // Max timeouts over all blocks +#define TFTP_RETRIES_MAX 5 // retries per block before giving up + +#endif // _TFTP_SUPPORT_H_ diff --git a/packages/net/common/current/src/bootp_support.c b/packages/net/common/current/src/bootp_support.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/bootp_support.c @@ -0,0 +1,555 @@ +//========================================================================== +// +// lib/bootp_support.c +// +// Minimal BOOTP functions +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// BOOTP support (and a little DHCP support also) + +#include +#include +#include + +#include +#ifdef CYGPKG_NET_FREEBSD_STACK // New layout +#include +#include +#include +#endif + +#ifdef CYGINT_ISO_DNS +#include +#endif + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +// This function sets up the interface it the simplest configuration. +// Just enough to broadcast a BOOTP request and get a response. +// It returns 'true' if a response was obtained. +cyg_bool_t +do_bootp(const char *intf, struct bootp *recv) +{ + struct sockaddr_in *addrp; + struct ifreq ifr; + struct sockaddr_in cli_addr, serv_addr, bootp_server_addr; + struct ecos_rtentry route; + int s, addrlen; + int one = 1; + struct bootp bootp_xmit; + unsigned char mincookie[] = {99,130,83,99,255} ; + struct timeval tv; + cyg_bool_t retcode = true; + + // Ensure clean slate + cyg_route_reinit(); // Force any existing routes to be forgotten + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + perror("socket"); + return false; + } + + if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { + perror("setsockopt"); + return false; + } + + addrp = (struct sockaddr_in *) &ifr.ifr_addr; + memset(addrp, 0, sizeof(*addrp)); + addrp->sin_family = AF_INET; + addrp->sin_len = sizeof(*addrp); + addrp->sin_port = 0; + addrp->sin_addr.s_addr = INADDR_ANY; + + strcpy(ifr.ifr_name, intf); + if (ioctl(s, SIOCSIFADDR, &ifr)) { + perror("SIOCSIFADDR"); + return false; + } + + if (ioctl(s, SIOCSIFNETMASK, &ifr)) { + perror("SIOCSIFNETMASK"); + return false; + } + + /* the broadcast address is 255.255.255.255 */ + memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr)); + if (ioctl(s, SIOCSIFBRDADDR, &ifr)) { + perror("SIOCSIFBRDADDR"); + return false; + } + + ifr.ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; + if (ioctl(s, SIOCSIFFLAGS, &ifr)) { + perror("SIOCSIFFLAGS"); + return false; + } + + if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) { + perror("SIOCGIFHWADDR"); + return false; + } + + // Set up routing + /* the broadcast address is 255.255.255.255 */ + memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr)); + memset(&route, 0, sizeof(route)); + memcpy(&route.rt_gateway, addrp, sizeof(*addrp)); + + addrp->sin_family = AF_INET; + addrp->sin_port = 0; + addrp->sin_addr.s_addr = INADDR_ANY; + memcpy(&route.rt_dst, addrp, sizeof(*addrp)); + memcpy(&route.rt_genmask, addrp, sizeof(*addrp)); + + route.rt_dev = ifr.ifr_name; + route.rt_flags = RTF_UP|RTF_GATEWAY; + route.rt_metric = 0; + + if (ioctl(s, SIOCADDRT, &route)) { + if (errno != EEXIST) { + perror("SIOCADDRT 3"); + return false; + } + } + + memset((char *) &cli_addr, 0, sizeof(cli_addr)); + cli_addr.sin_family = AF_INET; + cli_addr.sin_addr.s_addr = htonl(INADDR_ANY); + cli_addr.sin_port = htons(IPPORT_BOOTPC); + + if(bind(s, (struct sockaddr *) &cli_addr, sizeof(cli_addr)) < 0) { + perror("bind error"); + return false; + } + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + perror("setsockopt SO_REUSEADDR"); + return false; + } + if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { + perror("setsockopt SO_REUSEPORT"); + return false; + } + + memset((char *) &serv_addr, 0, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); + serv_addr.sin_port = htons(IPPORT_BOOTPS); + + // Fill in the BOOTP request + bzero(&bootp_xmit, sizeof(bootp_xmit)); + if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) { + perror("SIOCGIFHWADDR"); + return false; + } + bootp_xmit.bp_htype = HTYPE_ETHERNET; + bootp_xmit.bp_hlen = IFHWADDRLEN; + bcopy(ifr.ifr_hwaddr.sa_data, &bootp_xmit.bp_chaddr, bootp_xmit.bp_hlen); + + bootp_xmit.bp_secs = 0; + bcopy(mincookie, bootp_xmit.bp_vend, sizeof(mincookie)); + + bootp_xmit.bp_op = BOOTREQUEST; + + if(sendto(s, &bootp_xmit, sizeof(struct bootp), 0, + (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { + perror("sendto error"); + return false; + } + + tv.tv_sec = 5; + tv.tv_usec = 0; + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + + addrlen = sizeof(bootp_server_addr); + if (recvfrom(s, recv, sizeof(struct bootp), 0, + (struct sockaddr *)&bootp_server_addr, &addrlen) < 0) { + // This is an "acceptable" error, it means there is no server for + // us: do not initialize the interface. + retcode = false; + } + + // Shut things down regardless of success of rx, otherwise other + // interfaces cannot be initialised! + memset(addrp, 0, sizeof(*addrp)); + addrp->sin_family = AF_INET; + addrp->sin_len = sizeof(*addrp); + addrp->sin_port = 0; + addrp->sin_addr.s_addr = INADDR_ANY; + + strcpy(ifr.ifr_name, intf); + if (ioctl(s, SIOCDIFADDR, &ifr)) { + perror("SIOCDIFADDR"); + } + + // Shut down interface so it can be reinitialized + ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING); + if (ioctl(s, SIOCSIFFLAGS, &ifr)) { + perror("SIOCSIFFLAGS"); + return false; + } + + // All done with socket + close(s); + return retcode; +} + +static char *_bootp_op[] = {"", "REQUEST", "REPLY"}; +static char *_bootp_hw_type[] = {"", "Ethernet", "Exp Ethernet", "AX25", + "Pronet", "Chaos", "IEEE802", "Arcnet"}; + +static char *_dhcpmsgs[] = {"","DISCOVER", "OFFER", "REQUEST", "DECLINE", + "ACK", "NAK", "RELEASE" }; + +void +show_bootp(const char *intf, struct bootp *bp) +{ + int i, len; + unsigned char *op, *ap = 0, optover; + unsigned char name[128]; + struct in_addr addr[32]; + unsigned int length; + + diag_printf("BOOTP[%s] op: %s\n", intf, _bootp_op[bp->bp_op]); + diag_printf(" htype: %s\n", _bootp_hw_type[bp->bp_htype]); + diag_printf(" hlen: %d\n", bp->bp_hlen ); + diag_printf(" hops: %d\n", bp->bp_hops ); + diag_printf(" xid: 0x%x\n", bp->bp_xid ); + diag_printf(" secs: %d\n", bp->bp_secs ); + diag_printf(" flags: 0x%x\n", bp->bp_flags ); + diag_printf(" hw_addr: "); + for (i = 0; i < bp->bp_hlen; i++) { + diag_printf("%02x", bp->bp_chaddr[i]); + if (i != (bp->bp_hlen-1)) diag_printf(":"); + } + diag_printf("\n"); + diag_printf(" client IP: %s\n", inet_ntoa(bp->bp_ciaddr)); + diag_printf(" my IP: %s\n", inet_ntoa(bp->bp_yiaddr)); + diag_printf(" server IP: %s\n", inet_ntoa(bp->bp_siaddr)); + diag_printf(" gateway IP: %s\n", inet_ntoa(bp->bp_giaddr)); + + optover = 0; // See whether sname and file are overridden for options + length = sizeof(optover); + (void)get_bootp_option( bp, TAG_DHCP_OPTOVER, &optover, &length ); + if ( !(1 & optover) && bp->bp_sname[0] ) + diag_printf(" server: %s\n", bp->bp_sname); + if ( ! (2 & optover) && bp->bp_file[0] ) + diag_printf(" file: %s\n", bp->bp_file); + if (bp->bp_vend[0]) { + diag_printf(" options:\n"); + op = &bp->bp_vend[4]; + while (*op != TAG_END) { + switch (*op) { + case TAG_SUBNET_MASK: + case TAG_GATEWAY: + case TAG_IP_BROADCAST: + case TAG_DOMAIN_SERVER: + ap = (unsigned char *)&addr[0]; + len = *(op+1); + for (i = 0; i < len; i++) { + *ap++ = *(op+i+2); + } + if (*op == TAG_SUBNET_MASK) ap = " subnet mask"; + if (*op == TAG_GATEWAY) ap = " gateway"; + if (*op == TAG_IP_BROADCAST) ap = " IP broadcast"; + if (*op == TAG_DOMAIN_SERVER) ap = "domain server"; + diag_printf(" %s: ", ap); + ap = (unsigned char *)&addr[0]; + while (len > 0) { + diag_printf("%s", inet_ntoa(*(struct in_addr *)ap)); + len -= sizeof(struct in_addr); + ap += sizeof(struct in_addr); + if (len) diag_printf(", "); + } + diag_printf("\n"); + break; + case TAG_DOMAIN_NAME: + case TAG_HOST_NAME: + for (i = 0; i < *(op+1); i++) { + name[i] = *(op+i+2); + } + name[*(op+1)] = '\0'; + if (*op == TAG_DOMAIN_NAME) ap = " domain name"; + if (*op == TAG_HOST_NAME) ap = " host name"; + diag_printf(" %s: %s\n", ap, name); + break; + case TAG_DHCP_MESS_TYPE: + diag_printf(" DHCP message: %d %s\n", + op[2], _dhcpmsgs[op[2]] ); + break; + case TAG_DHCP_REQ_IP: + diag_printf(" DHCP requested ip: %d.%d.%d.%d\n", + op[2], op[3], op[4], op[5] ); + break; + case TAG_DHCP_LEASE_TIME : + case TAG_DHCP_RENEWAL_TIME : + case TAG_DHCP_REBIND_TIME : + diag_printf(" DHCP time %d: %d\n", + *op, ((((((op[2]<<8)+op[3])<<8)+op[4])<<8)+op[5]) ); + + break; + case TAG_DHCP_SERVER_ID : + diag_printf(" DHCP server id: %d.%d.%d.%d\n", + op[2], op[3], op[4], op[5] ); + break; + + case TAG_DHCP_OPTOVER : + case TAG_DHCP_PARM_REQ_LIST: + case TAG_DHCP_TEXT_MESSAGE : + case TAG_DHCP_MAX_MSGSZ : + case TAG_DHCP_CLASSID : + case TAG_DHCP_CLIENTID : + diag_printf(" DHCP option: %x/%d.%d:", *op, *op, *(op+1)); + if ( 1 == op[1] ) + diag_printf( " %d", op[2] ); + else if ( 2 == op[1] ) + diag_printf( " %d", (op[2]<<8)+op[3] ); + else if ( 4 == op[1] ) + diag_printf( " %d", ((((((op[2]<<8)+op[3])<<8)+op[4])<<8)+op[5]) ); + else + for ( i = 2; i < 2 + op[1]; i++ ) + diag_printf(" %d",op[i]); + diag_printf("\n"); + break; + + default: + diag_printf("Unknown option: %x/%d.%d:", *op, *op, *(op+1)); + for ( i = 2; i < 2 + op[1]; i++ ) + diag_printf(" %d",op[i]); + diag_printf("\n"); + break; + } + op += *(op+1)+2; + } + } +} + +cyg_bool_t +get_bootp_option(struct bootp *bp, unsigned char tag, void *opt, + unsigned int *length) +{ + unsigned char *val = (unsigned char *)opt; + int i; + cyg_uint8 optover; + +#define SCANTAG( ptr ) CYG_MACRO_START \ + unsigned int max; \ + unsigned char *op = (ptr); \ + while (*op != TAG_END) { \ + if (*op == tag) { \ + max=(*(op+1)>*length ? *length : *(op+1)); \ + for (i = 0; i < max; i++) { \ + *val++ = *(op+i+2); \ + } \ + *length=max; \ + return true; \ + } \ + op += *(op+1)+2; \ + } \ +CYG_MACRO_END + + SCANTAG( &bp->bp_vend[4] ); + + if ( TAG_DHCP_OPTOVER == tag ) // prevent recursion > once + return false; + // else, look for that tag to see if there's more... + optover = 0; + if ( ! get_bootp_option( bp, TAG_DHCP_OPTOVER, &optover, length) ) + return false; + + if ( 1 & optover ) // then the file field also holds options + SCANTAG( &bp->bp_file[0] ); + + if ( 2 & optover ) // then the sname field also holds options + SCANTAG( &bp->bp_sname[0] ); + + return false; +} + +// [Re]initialize the network interface with the info passed from BOOTP +cyg_bool_t +init_net(const char *intf, struct bootp *bp) +{ + struct sockaddr_in *addrp; + struct ifreq ifr; + int s; + int one = 1; + struct ecos_rtentry route; + struct in_addr netmask, gateway; + unsigned int length; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + perror("socket"); + return false; + } + + if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { + perror("setsockopt"); + return false; + } + + addrp = (struct sockaddr_in *) &ifr.ifr_addr; + memset(addrp, 0, sizeof(*addrp)); + addrp->sin_family = AF_INET; + addrp->sin_len = sizeof(*addrp); + addrp->sin_port = 0; + addrp->sin_addr = bp->bp_yiaddr; // The address BOOTP gave us + + // Must do this temporarily with default route and netmask so that + // [sub]netmask can be set. + strcpy(ifr.ifr_name, intf); + if (ioctl(s, SIOCSIFADDR, &ifr)) { + perror("SIOCIFADDR"); + return false; + } + + length = sizeof(addrp->sin_addr); + if (get_bootp_option(bp, TAG_SUBNET_MASK, &addrp->sin_addr,&length)) { + netmask = addrp->sin_addr; + if (ioctl(s, SIOCSIFNETMASK, &ifr)) { + perror("SIOCSIFNETMASK"); + return false; + } + // Must do this again so that [sub]netmask (and so default route) + // is taken notice of. + addrp->sin_addr = bp->bp_yiaddr; // The address BOOTP gave us + if (ioctl(s, SIOCSIFADDR, &ifr)) { + perror("SIOCIFADDR 2"); + return false; + } + } + + length = sizeof(addrp->sin_addr); + if (get_bootp_option(bp, TAG_IP_BROADCAST, &addrp->sin_addr,&length)) { + if (ioctl(s, SIOCSIFBRDADDR, &ifr)) { + perror("SIOCSIFBRDADDR"); + return false; + } + // Do not re-set the IFADDR after this; doing *that* resets the + // BRDADDR to the default! + } + + ifr.ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; + if (ioctl(s, SIOCSIFFLAGS, &ifr)) { + perror("SIOCSIFFLAGS"); + return false; + } + + // Set up routing + length = sizeof(addrp->sin_addr); + if (get_bootp_option(bp, TAG_GATEWAY, &gateway,&length)) { + // ...and it's a nonzero address... + if ( 0 != gateway.s_addr ) { + memset(&route, 0, sizeof(route)); + addrp->sin_family = AF_INET; + addrp->sin_port = 0; + addrp->sin_len = sizeof(*addrp); + addrp->sin_addr.s_addr = 0; // Use 0,0,GATEWAY for the default route + memcpy(&route.rt_dst, addrp, sizeof(*addrp)); + addrp->sin_addr.s_addr = 0; + memcpy(&route.rt_genmask, addrp, sizeof(*addrp)); + addrp->sin_addr = gateway; + memcpy(&route.rt_gateway, addrp, sizeof(*addrp)); + + route.rt_dev = ifr.ifr_name; + route.rt_flags = RTF_UP|RTF_GATEWAY; + route.rt_metric = 0; + + if (ioctl(s, SIOCADDRT, &route)) { + diag_printf("Route - dst: %s", + inet_ntoa(((struct sockaddr_in *)&route.rt_dst)->sin_addr)); + diag_printf(", mask: %s", + inet_ntoa(((struct sockaddr_in *)&route.rt_genmask)->sin_addr)); + diag_printf(", gateway: %s\n", + inet_ntoa(((struct sockaddr_in *)&route.rt_gateway)->sin_addr)); + if (errno != EEXIST) { + perror("SIOCADDRT 3"); + return false; + } + } + } + } + close(s); +#ifdef CYGINT_ISO_DNS + { +#define MAX_IP_ADDR_LEN 16 + char buf[BP_MAX_OPTION_LEN+1]; + memset(buf,0,sizeof(buf)); + length = sizeof(buf); + if (get_bootp_option(bp, TAG_DOMAIN_NAME, buf, &length)) { + setdomainname(buf, length); + } + length = sizeof(buf); + if (get_bootp_option(bp, TAG_DOMAIN_SERVER, buf, &length)) { + cyg_dns_res_init((struct in_addr *)buf); + } + } +#endif + return true; +} + +#ifdef INET6 +extern const struct in6_addr in6mask128; +cyg_bool_t +init_net_IPv6(const char *intf, struct bootp *bp, char *prefix) +{ + int s; + struct in6_aliasreq in6_addr; + char in6_ip[128]; + + // Set up non link-layer address + s = socket(AF_INET6, SOCK_DGRAM, 0); + if (s < 0) { + perror("socket IPv6"); + return false; + } + bzero(&in6_addr, sizeof(in6_addr)); + diag_sprintf(in6_ip, "%s::%s", prefix, inet_ntoa(bp->bp_yiaddr)); + in6_addr.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); + in6_addr.ifra_addr.sin6_family = AF_INET6; + if (!inet_pton(AF_INET6, in6_ip, (char *)&in6_addr.ifra_addr.sin6_addr)) { + diag_printf("Can't set IPv6 address: %s\n", in6_ip); + return false; + } + in6_addr.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); + in6_addr.ifra_prefixmask.sin6_family = AF_INET6; + in6_addr.ifra_prefixmask.sin6_addr = in6mask128; + strcpy(in6_addr.ifra_name, intf); + in6_addr.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; + in6_addr.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; + if (ioctl(s, SIOCAIFADDR_IN6, &in6_addr)) { + perror("SIOCAIFADDR_IN6"); + return false; + } + close(s); + return true; +} +#endif diff --git a/packages/net/common/current/src/dhcp_prot.c b/packages/net/common/current/src/dhcp_prot.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/dhcp_prot.c @@ -0,0 +1,1263 @@ +/*========================================================================== +// +// dhcp_prot.c +// +// DHCP protocol implementation for DHCP client +// +//========================================================================== +//####ECOSPDCOPYRIGHTBEGIN#### +// +// Copyright (C) 2000, 2001, 2002 Red Hat, Inc. +// All Rights Reserved. +// +// Permission is granted to use, copy, modify and redistribute this +// file. +// +//####ECOSPDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: gthomas +// Date: 2000-07-01 +// Purpose: DHCP support +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include + +#ifdef CYGPKG_NET_DHCP + +#if 0 +#define perror( txt ) // nothing +#endif + +#include +#include + +#include + +// ------------------------------------------------------------------------ +// Returns a pointer to the end of dhcp message (or NULL if invalid) +// meaning the address of the byte *after* the TAG_END token in the vendor +// data. + +static unsigned char * +scan_dhcp_size( struct bootp *ppkt ) +{ + unsigned char *op; + + op = &ppkt->bp_vend[0]; + // First check for the cookie! + if ( op[0] != 99 || + op[1] != 130 || + op[2] != 83 || + op[3] != 99 ) { + CYG_FAIL( "Bad DHCP cookie" ); + return NULL; + } + op += 4; + while (*op != TAG_END) { + op += *(op+1)+2; + if ( op > &ppkt->bp_vend[BP_VEND_LEN-1] ) { + CYG_FAIL( "Oversize DHCP packet in dhcp_size" ); + return NULL; + } + } + // Check op has not gone wild + CYG_ASSERT( op > (unsigned char *)(&ppkt[0]), "op pointer underflow!" ); + // Compare op with non-existent "next" struct bootp in the array. + CYG_ASSERT( op < (unsigned char *)(&ppkt[1]), "op pointer overflow!" ); + return op + 1; // Address of first invalid byte +} + +// ------------------------------------------------------------------------ +// Get the actual packet size of an initialized buffer + +static int +dhcp_size( struct bootp *ppkt ) +{ + unsigned char *op; + + op = scan_dhcp_size( ppkt ); + if ( !op ) return 0; + return (op - (unsigned char *)ppkt); +} + + +// ------------------------------------------------------------------------ +// Get the actual packet size of an initialized buffer +// This will also pad the packet with 0 if length is less +// than BP_STD_TX_MINPKTSZ. + +static int +dhcp_size_for_send( struct bootp *ppkt ) +{ + unsigned char *op; + + op = scan_dhcp_size( ppkt ); + if ( !op ) return 0; // Better not scribble! + // Zero extra bytes until the packet is large enough. + for ( ; op < (((unsigned char *)ppkt) + BP_STD_TX_MINPKTSZ); op++ ) + *op = 0; + return (op - (unsigned char *)ppkt); +} + +// ------------------------------------------------------------------------ +// Insert/set an option value in an initialized buffer + +static int +set_fixed_tag( struct bootp *ppkt, + unsigned char tag, + cyg_uint32 value, + int len) +{ + unsigned char *op; + + // Initially this will only scan the options field. + + op = &ppkt->bp_vend[4]; + while (*op != TAG_END) { + if ( op > &ppkt->bp_vend[BP_VEND_LEN-1] ) { + CYG_FAIL( "Oversize DHCP packet in set_fixed_tag" ); + return false; + } + if (*op == tag) // Found it... + break; + op += *(op+1)+2; + } + + if (*op == tag) { // Found it... + if ( *(op+1) != len ) { + CYG_FAIL( "Wrong size in set_fixed_tag" ); + return false; // wrong size + } + } + else { // overwrite the end tag and install a new one + if ( op + len + 2 > &ppkt->bp_vend[BP_VEND_LEN-1] ) { + CYG_FAIL( "Oversize DHCP packet in set_fixed_tag append" ); + return false; + } + *op = tag; + *(op+1) = len; + *(op + len + 2) = TAG_END; + } + // and insert the value. Net order is BE. + op += len + 2 - 1; // point to end of value + while ( len-- > 0 ) { + *op-- = (unsigned char)(value & 255); + value >>= 8; + } + return true; +} + +// Note that this does not permit changing the size of an extant tag. +static int +set_variable_tag( struct bootp *ppkt, + unsigned char tag, + cyg_uint8 *pvalue, + int len) +{ + unsigned char *op; + + // Initially this will only scan the options field. + op = &ppkt->bp_vend[4]; + while (*op != TAG_END) { + if ( op > &ppkt->bp_vend[BP_VEND_LEN-1] ) { + CYG_FAIL( "Oversize DHCP packet in set_variable_tag" ); + return false; + } + if (*op == tag) // Found it... + break; + op += *(op+1)+2; + } + + if (*op == tag) { // Found it... + if ( *(op+1) != len ) { + CYG_FAIL( "Wrong size in set_variable_tag" ); + return false; // wrong size + } + } + else { // overwrite the end tag and install a new one + if ( op + len + 2 > &ppkt->bp_vend[BP_VEND_LEN-1] ) { + CYG_FAIL( "Oversize DHCP packet in set_variable_tag append" ); + return false; + } + *op = tag; + *(op+1) = len; + *(op + len + 2) = TAG_END; + } + // and insert the value. No order is implied. + op += 2; // point to start of value + while ( len-- > 0 ) { + *op++ = *pvalue++; + } + return true; +} + +static int +unset_tag( struct bootp *ppkt, + unsigned char tag ) +{ + unsigned char *op, *nextp = 0, *killp = 0; + + // Initially this will only scan the options field. + + op = &ppkt->bp_vend[4]; + while (*op != TAG_END) { + if ( op > &ppkt->bp_vend[BP_VEND_LEN-1] ) { + CYG_FAIL( "Oversize DHCP packet in unset_tag" ); + return false; + } + if (*op == tag) { // Found it... + killp = op; // item to kill + nextp = op + *(op+1)+2; // next item address + } + op += *(op+1)+2; // scan to the end + } + + if ( !killp ) + return false; + + // Obliterate the found op by copying down: *op is the end. + while( nextp <= op ) // <= to copy the TAG_END too. + *killp++ = *nextp++; + + return true; +} + +// ------------------------------------------------------------------------ +// Bring up an interface enough to broadcast, before we know who we are + +static int +bring_half_up(const char *intf, struct ifreq *ifrp ) +{ + int s; + int one = 1; + + struct sockaddr_in *addrp; + struct ecos_rtentry route; + + // Ensure clean slate + cyg_route_reinit(); // Force any existing routes to be forgotten + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + perror("socket"); + return false; + } + + if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { + perror("setsockopt"); + return false; + } + + addrp = (struct sockaddr_in *) &ifrp->ifr_addr; + memset(addrp, 0, sizeof(*addrp)); + addrp->sin_family = AF_INET; + addrp->sin_len = sizeof(*addrp); + addrp->sin_port = 0; + addrp->sin_addr.s_addr = INADDR_ANY; + + strcpy(ifrp->ifr_name, intf); + if (ioctl(s, SIOCSIFADDR, ifrp)) { /* set ifnet address */ + perror("SIOCSIFADDR"); + return false; + } + + if (ioctl(s, SIOCSIFNETMASK, ifrp)) { /* set net addr mask */ + perror("SIOCSIFNETMASK"); + return false; + } + + /* the broadcast address is 255.255.255.255 */ + memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr)); + if (ioctl(s, SIOCSIFBRDADDR, ifrp)) { /* set broadcast addr */ + perror("SIOCSIFBRDADDR"); + return false; + } + + ifrp->ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; + if (ioctl(s, SIOCSIFFLAGS, ifrp)) { /* set ifnet flags */ + perror("SIOCSIFFLAGS up"); + return false; + } + + if (ioctl(s, SIOCGIFHWADDR, ifrp) < 0) { /* get MAC address */ + perror("SIOCGIFHWADDR 1"); + return false; + } + + // Set up routing + addrp->sin_family = AF_INET; + addrp->sin_port = 0; + addrp->sin_len = sizeof(*addrp); // Size of address + + /* the broadcast address is 255.255.255.255 */ + memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr)); + memset(&route, 0, sizeof(route)); + memcpy(&route.rt_gateway, addrp, sizeof(*addrp)); + + addrp->sin_addr.s_addr = INADDR_ANY; + memcpy(&route.rt_dst, addrp, sizeof(*addrp)); + memcpy(&route.rt_genmask, addrp, sizeof(*addrp)); + + route.rt_dev = ifrp->ifr_name; + route.rt_flags = RTF_UP|RTF_GATEWAY; + route.rt_metric = 0; + + if (ioctl(s, SIOCADDRT, &route)) { /* add route */ + if (errno != EEXIST) { + perror("SIOCADDRT 3"); + return false; + } + } + + close(s); + + return true; +} + + +// ------------------------------------------------------------------------ +// DHCP retransmission timeouts and number of tries +// +// To work better with simulated failures (or real ones!) so that the rest +// of the system is tested, rather than DHCP renewal failures pulling +// everything down, we try a little more zealously than the RFC suggests. + +static unsigned char timeout_random = 0; + +struct timeout_state { + unsigned int secs; + int countdown; +}; + +static inline void reset_timeout( struct timeval *ptv, struct timeout_state *pstate ) +{ + timeout_random++; + pstate->countdown = 4; // initial fast retries + pstate->secs = 3 + (timeout_random & 3); + ptv->tv_sec = 0; + ptv->tv_usec = 65536 * (2 + (timeout_random & 3)); // 0.1 - 0.3S, about +} + +static inline int next_timeout( struct timeval *ptv, struct timeout_state *pstate ) +{ + if ( 0 < pstate->countdown-- ) + return true; + if ( 0 == ptv->tv_sec ) + ptv->tv_sec = pstate->secs; + else { + timeout_random++; + pstate->secs = ptv->tv_sec * 2 - 2 + (timeout_random & 3); + pstate->countdown = 2; // later fast retries + ptv->tv_sec = 0; + } + return pstate->secs < 100; // If longer, too many tries... +} + +// ------------------------------------------------------------------------ +// Lease expiry and alarms to notify it + +static cyg_alarm_t alarm_function; + +static void alarm_function(cyg_handle_t alarm, cyg_addrword_t data) +{ + struct dhcp_lease *lease = (struct dhcp_lease *)data; + lease->which |= lease->next; + if ( lease->needs_attention ) + cyg_semaphore_post( lease->needs_attention ); + + // Step the lease on into its next state of being alarmed ;-) + if ( lease->next & DHCP_LEASE_EX ) { + cyg_alarm_disable( alarm ); + } + else if ( lease->next & DHCP_LEASE_T2 ) { + lease->next = DHCP_LEASE_EX; + cyg_alarm_initialize( lease->alarm, lease->expiry, 0 ); + cyg_alarm_enable( lease->alarm ); + } + else if ( lease->next & DHCP_LEASE_T1 ) { + lease->next = DHCP_LEASE_T2; + cyg_alarm_initialize( lease->alarm, lease->t2, 0 ); + cyg_alarm_enable( lease->alarm ); + } +} + +static inline void no_lease( struct dhcp_lease *lease ) +{ + if ( lease->alarm ) { + // Already set: delete this. + cyg_alarm_disable( lease->alarm ); + cyg_alarm_delete( lease->alarm ); + lease->alarm = 0; + } +} + +static inline void new_lease( struct bootp *bootp, struct dhcp_lease *lease ) +{ + cyg_tick_count_t now = cyg_current_time(); + cyg_tick_count_t then; + cyg_uint32 tag = 0; + cyg_uint32 expiry_then; + cyg_resolution_t resolution = + cyg_clock_get_resolution(cyg_real_time_clock()); + cyg_handle_t h; + unsigned int length; + + // Silence any jabbering from past lease on this interface + no_lease( lease ); + lease->which = lease->next = 0; + cyg_clock_to_counter(cyg_real_time_clock(), &h); + cyg_alarm_create( h, alarm_function, (cyg_addrword_t)lease, + &lease->alarm, &lease->alarm_obj ); + + // extract the lease time and scale it &c to now. + length = sizeof(tag); + if(!get_bootp_option( bootp, TAG_DHCP_LEASE_TIME, &tag ,&length)) + tag = 0xffffffff; + + if ( 0xffffffff == tag ) { + lease->expiry = 0xffffffffffffffff; + lease->t2 = 0xffffffffffffffff; + lease->t1 = 0xffffffffffffffff; + return; // it's an infinite lease, hurrah! + } + + then = (cyg_uint64)(ntohl(tag)); + expiry_then = then; + + then *= 1000000000; // into nS - we know there is room in a tick_count_t + then = (then / resolution.dividend) * resolution.divisor; // into system ticks + lease->expiry = now + then; + length = sizeof(tag); + if (get_bootp_option( bootp, TAG_DHCP_REBIND_TIME, &tag, &length )) + then = (cyg_uint64)(ntohl(tag)); + else + then = expiry_then - expiry_then/4; + then *= 1000000000; // into nS - we know there is room in a tick_count_t + then = (then / resolution.dividend) * resolution.divisor; // into system ticks + lease->t2 = now + then; + + length = sizeof(tag); + if (get_bootp_option( bootp, TAG_DHCP_RENEWAL_TIME, &tag, &length )) + then = (cyg_uint64)(ntohl(tag)); + else + then = expiry_then/2; + then *= 1000000000; // into nS - we know there is room in a tick_count_t + then = (then / resolution.dividend) * resolution.divisor; // into system ticks + lease->t1 = now + then; + +#if 0 // for testing this mechanism + lease->expiry = now + 5000; // 1000 here makes for failure in the DHCP test + lease->t2 = now + 3500; + lease->t1 = now + 2500; +#endif + +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf("new_lease:\n"); + diag_printf(" expiry = %d\n",lease->expiry); + diag_printf(" t1 = %d\n",lease->t1); + diag_printf(" t2 = %d\n",lease->t2); +#endif + + lease->next = DHCP_LEASE_T1; + + cyg_alarm_initialize( lease->alarm, lease->t1, 0 ); + cyg_alarm_enable( lease->alarm ); +} + +// ------------------------------------------------------------------------ +// Set all the tags we want to use when sending a packet. +// This has expanded to a large, explicit set to interwork better +// with a variety of DHCP servers. + +static void set_default_dhcp_tags( struct bootp *xmit ) +{ + // Explicitly request full set of params that are default for LINUX + // dhcp servers, but not default for others. This is rather arbitrary, + // but it preserves behaviour for people using those servers. + // Perhaps configury of this set will be needed in future? + // + // Here's the set: + static cyg_uint8 req_list[] = { +#ifdef CYGOPT_NET_DHCP_PARM_REQ_LIST_REPLACE + CYGOPT_NET_DHCP_PARM_REQ_LIST_REPLACE , +#else + TAG_DHCP_SERVER_ID , // DHCP server id: 10.16.19.66 + TAG_DHCP_LEASE_TIME , // DHCP time 51: 60 + TAG_DHCP_RENEWAL_TIME , // DHCP time 58: 30 + TAG_DHCP_REBIND_TIME , // DHCP time 59: 52 + TAG_SUBNET_MASK , // subnet mask: 255.255.255.0 + TAG_GATEWAY , // gateway: 10.16.19.66 + TAG_DOMAIN_SERVER , // domain server: 10.16.19.66 + TAG_DOMAIN_NAME , // domain name: hmt10.cambridge.redhat.com + TAG_IP_BROADCAST , // IP broadcast: 10.16.19.255 +#endif +#ifdef CYGOPT_NET_DHCP_PARM_REQ_LIST_ADDITIONAL + CYGOPT_NET_DHCP_PARM_REQ_LIST_ADDITIONAL , +#endif + }; + + if ( req_list[0] ) // So that one may easily turn it all off by configury + set_variable_tag( xmit, TAG_DHCP_PARM_REQ_LIST, + &req_list[0], sizeof( req_list ) ); + + // Explicitly specify our max message size. + set_fixed_tag( xmit, TAG_DHCP_MAX_MSGSZ, BP_MINPKTSZ, 2 ); +} + +// ------------------------------------------------------------------------ +// the DHCP state machine - this does all the work + +int +do_dhcp(const char *intf, struct bootp *res, + cyg_uint8 *pstate, struct dhcp_lease *lease) +{ + struct ifreq ifr; + struct sockaddr_in cli_addr, broadcast_addr, server_addr, rx_addr; + int s, addrlen; + int one = 1; + unsigned char mincookie[] = {99,130,83,99,255} ; + struct timeval tv; + struct timeout_state timeout_scratch; + cyg_uint8 oldstate = *pstate; + cyg_uint8 msgtype = 0, seen_bootp_reply = 0; + unsigned int length; + + cyg_uint32 xid; + +#define CHECK_XID() ( /* and other details */ \ + received->bp_xid != xid || /* not the same transaction */ \ + received->bp_htype != xmit->bp_htype || /* not the same ESA type */ \ + received->bp_hlen != xmit->bp_hlen || /* not the same length */ \ + bcmp( &received->bp_chaddr, &xmit->bp_chaddr, xmit->bp_hlen ) \ + ) + + // IMPORTANT: xmit is the same as res throughout this; *received is a + // scratch buffer for reception; its contents are always copied to res + // when we are happy with them. So we always transmit from the + // existing state. + struct bootp rx_local; + struct bootp *received = &rx_local; + struct bootp *xmit = res; + + // First, get a socket on the interface in question. But Zeroth, if + // needs be, bring it to the half-up broadcast only state if needs be. + + if ( DHCPSTATE_INIT == oldstate + || DHCPSTATE_FAILED == oldstate + || 0 == oldstate ) { + // either explicit init state or the beginning of time or retry + if ( ! bring_half_up( intf, &ifr ) ) + return false; + + *pstate = DHCPSTATE_INIT; + } + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + perror("socket"); + return false; + } + + if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { + perror("setsockopt"); + return false; + } + + memset((char *) &cli_addr, 0, sizeof(cli_addr)); + cli_addr.sin_family = AF_INET; + cli_addr.sin_len = sizeof(cli_addr); + cli_addr.sin_addr.s_addr = htonl(INADDR_ANY); + cli_addr.sin_port = htons(IPPORT_BOOTPC); + + memset((char *) &broadcast_addr, 0, sizeof(broadcast_addr)); + broadcast_addr.sin_family = AF_INET; + broadcast_addr.sin_len = sizeof(broadcast_addr); + broadcast_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); + broadcast_addr.sin_port = htons(IPPORT_BOOTPS); + + memset((char *) &server_addr, 0, sizeof(server_addr)); + server_addr.sin_family = AF_INET; + server_addr.sin_len = sizeof(server_addr); + server_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); // overwrite later + server_addr.sin_port = htons(IPPORT_BOOTPS); + + if(bind(s, (struct sockaddr *) &cli_addr, sizeof(cli_addr)) < 0) { + perror("bind error"); + return false; + } + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + perror("setsockopt SO_REUSEADDR"); + return false; + } + if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { + perror("setsockopt SO_REUSEPORT"); + return false; + } + + // Now, we can launch into the DHCP state machine. I think this will + // be the neatest way to do it; it returns from within the switch arms + // when all is well, or utterly failed. + + reset_timeout( &tv, &timeout_scratch ); + + // Choose a new XID: first get the ESA as a basis: + strcpy(&ifr.ifr_name[0], intf); + if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) { + perror("SIOCGIFHWADDR 2"); + return false; + } + + // Choose from scratch depending on ifr_hwaddr...[] + xid = ifr.ifr_hwaddr.sa_data[5]; + xid |= (ifr.ifr_hwaddr.sa_data[4]) << 8; + xid |= (ifr.ifr_hwaddr.sa_data[3]) << 16; + xid |= (ifr.ifr_hwaddr.sa_data[2]) << 24; + xid ^= (cyg_arc4random() & 0xffff0000); + + // Avoid adjacent ESAs colliding by increment +#define NEW_XID(_xid) CYG_MACRO_START (_xid)+= 0x10000; CYG_MACRO_END + + while ( 1 ) { + + // If we are active rather than in the process of shutting down, + // check for any lease expiry every time round, so that alarms + // *can* change the course of events even when already renewing, + // for example. + if ( DHCPSTATE_DO_RELEASE != *pstate + && DHCPSTATE_NOTBOUND != *pstate + && DHCPSTATE_FAILED != *pstate ) { + cyg_uint8 lease_state; + + cyg_scheduler_lock(); + lease_state = lease->which; + lease->which = 0; // flag that we have noticed it + cyg_scheduler_unlock(); + + if ( lease_state & DHCP_LEASE_EX ) { + // then the lease has expired completely! + *pstate = DHCPSTATE_NOTBOUND; + } + else if ( lease_state & DHCP_LEASE_T2 ) { + // Time to renew + reset_timeout( &tv, &timeout_scratch ); // next conversation + *pstate = DHCPSTATE_REBINDING; + } + else if ( lease_state & DHCP_LEASE_T1 ) { + // Time to renew + reset_timeout( &tv, &timeout_scratch ); // next conversation + *pstate = DHCPSTATE_RENEWING; + } + } + + switch ( *pstate ) { + + case DHCPSTATE_INIT: + + // Send the DHCPDISCOVER packet + + // Fill in the BOOTP request - DHCPDISCOVER packet + bzero(xmit, sizeof(*xmit)); + xmit->bp_op = BOOTREQUEST; + xmit->bp_htype = HTYPE_ETHERNET; + xmit->bp_hlen = IFHWADDRLEN; + xmit->bp_xid = xid; + xmit->bp_secs = 0; + xmit->bp_flags = htons(0x8000); // BROADCAST FLAG + bcopy(ifr.ifr_hwaddr.sa_data, &xmit->bp_chaddr, xmit->bp_hlen); + bcopy(mincookie, xmit->bp_vend, sizeof(mincookie)); + + // remove the next line to test ability to handle bootp packets. + set_fixed_tag( xmit, TAG_DHCP_MESS_TYPE, DHCPDISCOVER, 1 ); + // Set all the tags we want to use when sending a packet + set_default_dhcp_tags( xmit ); + +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf( "---------DHCPSTATE_INIT sending:\n" ); + show_bootp( intf, xmit ); +#endif + if(sendto(s, xmit, dhcp_size_for_send(xmit), 0, + (struct sockaddr *)&broadcast_addr, sizeof(broadcast_addr)) < 0) { + *pstate = DHCPSTATE_FAILED; + break; + } + + seen_bootp_reply = 0; + *pstate = DHCPSTATE_SELECTING; + break; + + case DHCPSTATE_SELECTING: + // This is a separate state so that we can listen again + // *without* retransmitting. + + // listen for the DHCPOFFER reply + + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + + addrlen = sizeof(rx_addr); + if (recvfrom(s, received, sizeof(struct bootp), 0, + (struct sockaddr *)&rx_addr, &addrlen) < 0) { + // No packet arrived (this time) + if ( seen_bootp_reply ) { // then already have a bootp reply + // Save the good packet in *xmit + bcopy( received, xmit, dhcp_size(received) ); + *pstate = DHCPSTATE_BOOTP_FALLBACK; + NEW_XID( xid ); // Happy to advance, so new XID + reset_timeout( &tv, &timeout_scratch ); + break; + } + // go to the next larger timeout and re-send: + if ( ! next_timeout( &tv, &timeout_scratch ) ) { + *pstate = DHCPSTATE_FAILED; + break; + } + *pstate = DHCPSTATE_INIT; // to retransmit + break; + } + +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf( "---------DHCPSTATE_SELECTING received:\n" ); + diag_printf( "...rx_addr is family %d, addr %08x, port %d\n", + rx_addr.sin_family, + rx_addr.sin_addr.s_addr, + rx_addr.sin_port ); + show_bootp( intf, received ); +#endif + if ( CHECK_XID() ) // XID and ESA matches? + break; // listen again... + + if ( 0 == received->bp_siaddr.s_addr ) { + // then fill in from the options... + length = sizeof(received->bp_siaddr.s_addr); + get_bootp_option( received, TAG_DHCP_SERVER_ID, + &received->bp_siaddr.s_addr, + &length); + } + + // see if it was a DHCP reply or a bootp reply; it could be + // either. + length = sizeof(msgtype); + if ( get_bootp_option( received, TAG_DHCP_MESS_TYPE, &msgtype, + &length) ) { + if ( DHCPOFFER == msgtype ) { // all is well + // Save the good packet in *xmit + bcopy( received, xmit, dhcp_size(received) ); + // we like the packet, so reset the timeout for next time + reset_timeout( &tv, &timeout_scratch ); + *pstate = DHCPSTATE_REQUESTING; + NEW_XID( xid ); // Happy to advance, so new XID + } + } + else // No TAG_DHCP_MESS_TYPE entry so it's a bootp reply + seen_bootp_reply = 1; // (keep the bootp packet in received) + + // If none of the above state changes occurred, we got a packet + // that "should not happen", OR we have a bootp reply in our + // hand; so listen again with the same timeout, without + // retrying the send, in the hope of getting a DHCP reply. + break; + + case DHCPSTATE_REQUESTING: + // Just send what you got with a DHCPREQUEST in the message type. + // then wait for an ACK in DHCPSTATE_REQUEST_RECV. + + // Fill in the BOOTP request - DHCPREQUEST packet + xmit->bp_xid = xid; + xmit->bp_op = BOOTREQUEST; + xmit->bp_flags = htons(0x8000); // BROADCAST FLAG + + set_fixed_tag( xmit, TAG_DHCP_MESS_TYPE, DHCPREQUEST, 1 ); + // Set all the tags we want to use when sending a packet + set_default_dhcp_tags( xmit ); + // And this will be a new one: + set_fixed_tag( xmit, TAG_DHCP_REQ_IP, ntohl(xmit->bp_yiaddr.s_addr), 4 ); + +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf( "---------DHCPSTATE_REQUESTING sending:\n" ); + show_bootp( intf, xmit ); +#endif + if(sendto(s, xmit, dhcp_size_for_send(xmit), 0, + (struct sockaddr *)&broadcast_addr, sizeof(broadcast_addr)) < 0) { + *pstate = DHCPSTATE_FAILED; + break; + } + + *pstate = DHCPSTATE_REQUEST_RECV; + break; + + case DHCPSTATE_REQUEST_RECV: + // wait for an ACK or a NACK - retry by going back to + // DHCPSTATE_REQUESTING; NACK means go back to INIT. + + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + + addrlen = sizeof(rx_addr); + if (recvfrom(s, received, sizeof(struct bootp), 0, + (struct sockaddr *)&rx_addr, &addrlen) < 0) { + // No packet arrived + // go to the next larger timeout and re-send: + if ( ! next_timeout( &tv, &timeout_scratch ) ) { + *pstate = DHCPSTATE_FAILED; + break; + } + *pstate = DHCPSTATE_REQUESTING; + break; + } + +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf( "---------DHCPSTATE_REQUEST_RECV received:\n" ); + diag_printf( "...rx_addr is family %d, addr %08x, port %d\n", + rx_addr.sin_family, + rx_addr.sin_addr.s_addr, + rx_addr.sin_port ); + show_bootp( intf, received ); +#endif + if ( CHECK_XID() ) // not the same transaction; + break; // listen again... + + if ( 0 == received->bp_siaddr.s_addr ) { + // then fill in from the options... + length = sizeof(received->bp_siaddr.s_addr ); + get_bootp_option( received, TAG_DHCP_SERVER_ID, + &received->bp_siaddr.s_addr, + &length); + } + + // check it was a DHCP reply + length = sizeof(msgtype); + if ( get_bootp_option( received, TAG_DHCP_MESS_TYPE, &msgtype, + &length) ) { + if ( DHCPACK == msgtype // Same offer & server? + && received->bp_yiaddr.s_addr == xmit->bp_yiaddr.s_addr + && received->bp_siaddr.s_addr == xmit->bp_siaddr.s_addr) { + // we like the packet, so reset the timeout for next time + reset_timeout( &tv, &timeout_scratch ); + // Record the new lease and set up timers &c + new_lease( received, lease ); + *pstate = DHCPSTATE_BOUND; + break; + } + if ( DHCPNAK == msgtype // Same server? + && received->bp_siaddr.s_addr == xmit->bp_siaddr.s_addr) { + // we're bounced! + *pstate = DHCPSTATE_INIT; // So back the start of the rigmarole. + NEW_XID( xid ); // Unhappy to advance, so new XID + reset_timeout( &tv, &timeout_scratch ); + break; + } + // otherwise it's something else, maybe another offer, or a bogus + // NAK from someone we are not asking! + // Just listen again, which implicitly discards it. + } + break; + + case DHCPSTATE_BOUND: + + // We are happy now, we have our address. + + // All done with socket + close(s); + + // Re-initialize the interface with the new state + if ( DHCPSTATE_BOUND != oldstate ) { + // Then need to go down and up + do_dhcp_down_net( intf, res, &oldstate, lease ); // oldstate used + if ( 0 != oldstate ) { + // Then not called from init_all_network_interfaces() + // so we must initialize the interface ourselves + if (!init_net(intf, res)) { + do_dhcp_down_net( intf, res, pstate, lease ); + *pstate = DHCPSTATE_FAILED; + return false; + } + } + } + + // Otherwise, nothing whatsoever to do... + return true; + + case DHCPSTATE_RENEWING: + // Just send what you got with a DHCPREQUEST in the message + // type UNICAST straight to the server. Then wait for an ACK. + + // Fill in the BOOTP request - DHCPREQUEST packet + xmit->bp_xid = xid; + xmit->bp_op = BOOTREQUEST; + xmit->bp_flags = htons(0); // No BROADCAST FLAG + // Use the *client* address here: + xmit->bp_ciaddr.s_addr = xmit->bp_yiaddr.s_addr; + + set_fixed_tag( xmit, TAG_DHCP_MESS_TYPE, DHCPREQUEST, 1 ); + // These must not be set in this context + unset_tag( xmit, TAG_DHCP_REQ_IP ); + unset_tag( xmit, TAG_DHCP_SERVER_ID ); + // Set all the tags we want to use when sending a packet + set_default_dhcp_tags( xmit ); + + // Set unicast address to *server* + server_addr.sin_addr.s_addr = res->bp_siaddr.s_addr; + +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf( "---------DHCPSTATE_RENEWING sending:\n" ); + diag_printf( "UNICAST to family %d, addr %08x, port %d\n", + server_addr.sin_family, + server_addr.sin_addr.s_addr, + server_addr.sin_port ); + show_bootp( intf, xmit ); +#endif + + if(sendto(s, xmit, dhcp_size_for_send(xmit), 0, + // UNICAST address of the server: + (struct sockaddr *)&server_addr, + sizeof(server_addr)) < 0) { + *pstate = DHCPSTATE_FAILED; + break; + } + + *pstate = DHCPSTATE_RENEW_RECV; + break; + + case DHCPSTATE_RENEW_RECV: + // wait for an ACK or a NACK - retry by going back to + // DHCPSTATE_RENEWING; NACK means go to NOTBOUND. + // No answer means just wait for T2, to broadcast. + + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + + addrlen = sizeof(rx_addr); + if (recvfrom(s, received, sizeof(struct bootp), 0, + (struct sockaddr *)&rx_addr, &addrlen) < 0) { + // No packet arrived + // go to the next larger timeout and re-send: + if ( ! next_timeout( &tv, &timeout_scratch ) ) { + // If we timed out completely, just give up until T2 + // expires - retain the lease meanwhile. The normal + // lease mechanism will invoke REBINDING as and when + // necessary. + *pstate = DHCPSTATE_BOUND; + break; + } + *pstate = DHCPSTATE_RENEWING; + break; + } + +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf( "---------DHCPSTATE_RENEW_RECV received:\n" ); + diag_printf( "...rx_addr is family %d, addr %08x, port %d\n", + rx_addr.sin_family, + rx_addr.sin_addr.s_addr, + rx_addr.sin_port ); + show_bootp( intf, received ); +#endif + if ( CHECK_XID() ) // not the same transaction; + break; // listen again... + + if ( 0 == received->bp_siaddr.s_addr ) { + // then fill in from the options... + length = sizeof(received->bp_siaddr.s_addr); + get_bootp_option( received, TAG_DHCP_SERVER_ID, + &received->bp_siaddr.s_addr, + &length); + } + + // check it was a DHCP reply + length = sizeof(msgtype); + if ( get_bootp_option( received, TAG_DHCP_MESS_TYPE, &msgtype, + &length) ) { + if ( DHCPACK == msgtype // Same offer? + && received->bp_yiaddr.s_addr == xmit->bp_yiaddr.s_addr) { + // we like the packet, so reset the timeout for next time + reset_timeout( &tv, &timeout_scratch ); + // Record the new lease and set up timers &c + new_lease( received, lease ); + *pstate = DHCPSTATE_BOUND; + break; + } + if ( DHCPNAK == msgtype ) { // we're bounced! + *pstate = DHCPSTATE_NOTBOUND; // So quit out. + break; + } + // otherwise it's something else, maybe another offer. + // Just listen again, which implicitly discards it. + } + break; + + case DHCPSTATE_REBINDING: + // Just send what you got with a DHCPREQUEST in the message type. + // Then wait for an ACK. This one is BROADCAST. + + // Fill in the BOOTP request - DHCPREQUEST packet + xmit->bp_xid = xid; + xmit->bp_op = BOOTREQUEST; + xmit->bp_flags = htons(0); // no BROADCAST FLAG + // Use the *client* address here: + xmit->bp_ciaddr.s_addr = xmit->bp_yiaddr.s_addr; + + set_fixed_tag( xmit, TAG_DHCP_MESS_TYPE, DHCPREQUEST, 1 ); + // These must not be set in this context + unset_tag( xmit, TAG_DHCP_REQ_IP ); + unset_tag( xmit, TAG_DHCP_SERVER_ID ); + // Set all the tags we want to use when sending a packet + set_default_dhcp_tags( xmit ); + +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf( "---------DHCPSTATE_REBINDING sending:\n" ); + show_bootp( intf, xmit ); +#endif + if(sendto(s, xmit, dhcp_size_for_send(xmit), 0, + (struct sockaddr *)&broadcast_addr, sizeof(broadcast_addr)) < 0) { + *pstate = DHCPSTATE_FAILED; + break; + } + + *pstate = DHCPSTATE_REBIND_RECV; + break; + + case DHCPSTATE_REBIND_RECV: + // wait for an ACK or a NACK - retry by going back to + // DHCPSTATE_REBINDING; NACK means go to NOTBOUND. + // No answer means just wait for expiry; we tried! + + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + + addrlen = sizeof(rx_addr); + if (recvfrom(s, received, sizeof(struct bootp), 0, + (struct sockaddr *)&rx_addr, &addrlen) < 0) { + // No packet arrived + // go to the next larger timeout and re-send: + if ( ! next_timeout( &tv, &timeout_scratch ) ) { + // If we timed out completely, just give up until EX + // expires - retain the lease meanwhile. The normal + // lease mechanism will invoke NOTBOUND state as and + // when necessary. + *pstate = DHCPSTATE_BOUND; + break; + } + *pstate = DHCPSTATE_REBINDING; + break; + } + +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf( "---------DHCPSTATE_REBIND_RECV received:\n" ); + diag_printf( "...rx_addr is family %d, addr %08x, port %d\n", + rx_addr.sin_family, + rx_addr.sin_addr.s_addr, + rx_addr.sin_port ); + show_bootp( intf, received ); +#endif + if ( CHECK_XID() ) // not the same transaction; + break; // listen again... + + if ( 0 == received->bp_siaddr.s_addr ) { + // then fill in from the options... + int length = sizeof(received->bp_siaddr.s_addr ); + get_bootp_option( received, TAG_DHCP_SERVER_ID, + &received->bp_siaddr.s_addr, + &length); + } + + // check it was a DHCP reply + length = sizeof(msgtype); + if ( get_bootp_option( received, TAG_DHCP_MESS_TYPE, &msgtype, + &length) ) { + if ( DHCPACK == msgtype // Same offer? + && received->bp_yiaddr.s_addr == xmit->bp_yiaddr.s_addr) { + // we like the packet, so reset the timeout for next time + reset_timeout( &tv, &timeout_scratch ); + // Record the new lease and set up timers &c + new_lease( received, lease ); + *pstate = DHCPSTATE_BOUND; + break; + } + else if ( DHCPNAK == msgtype ) { // we're bounced! + *pstate = DHCPSTATE_NOTBOUND; // So back the start of the rigmarole. + break; + } + // otherwise it's something else, maybe another offer. + // Just listen again, which implicitly discards it. + } + break; + + case DHCPSTATE_BOOTP_FALLBACK: + // All done with socket + close(s); + // And no lease should have become active, but JIC + no_lease( lease ); + // Re-initialize the interface with the new state + if ( DHCPSTATE_BOOTP_FALLBACK != oldstate ) { + // Then need to go down and up + do_dhcp_down_net( intf, res, &oldstate, lease ); // oldstate used + if ( 0 != oldstate ) { + // Then not called from init_all_network_interfaces() + // so we must initialize the interface ourselves + if (!init_net(intf, res)) { + do_dhcp_down_net( intf, res, pstate, lease ); + *pstate = DHCPSTATE_FAILED; + return false; + } + } + } + + // Otherwise, nothing whatsoever to do... + return true; + + case DHCPSTATE_NOTBOUND: + // All done with socket + close(s); + // No lease active + no_lease( lease ); + // Leave interface up so app can tidy. + return false; + + case DHCPSTATE_FAILED: + // All done with socket + close(s); + // No lease active + no_lease( lease ); + // Unconditionally down the interface. + do_dhcp_down_net( intf, res, &oldstate, lease ); + return false; + + case DHCPSTATE_DO_RELEASE: + // We have been forced here by external means, to release the + // lease for graceful shutdown. + + // Just send what you got with a DHCPRELEASE in the message + // type UNICAST straight to the server. No ACK. Then go to + // NOTBOUND state. + NEW_XID( xid ); + xmit->bp_xid = xid; + xmit->bp_op = BOOTREQUEST; + xmit->bp_flags = htons(0); // no BROADCAST FLAG + // Use the *client* address here: + xmit->bp_ciaddr.s_addr = xmit->bp_yiaddr.s_addr; + + set_fixed_tag( xmit, TAG_DHCP_MESS_TYPE, DHCPRELEASE, 1 ); + + // Set unicast address to *server* + server_addr.sin_addr.s_addr = res->bp_siaddr.s_addr; + +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf( "---------DHCPSTATE_DO_RELEASE sending:\n" ); + diag_printf( "UNICAST to family %d, addr %08x, port %d\n", + server_addr.sin_family, + server_addr.sin_addr.s_addr, + server_addr.sin_port ); + show_bootp( intf, xmit ); +#endif + if(sendto(s, xmit, dhcp_size_for_send(xmit), 0, + // UNICAST address of the server: + (struct sockaddr *)&server_addr, + sizeof(server_addr)) < 0) { + *pstate = DHCPSTATE_FAILED; + break; + } + + *pstate = DHCPSTATE_NOTBOUND; + break; + + default: + no_lease( lease ); + close(s); + return false; + } + } + /* NOTREACHED */ + return false; +} + +// ------------------------------------------------------------------------ +// Bring an interface down, failed to initialize it or lease is expired +// Also part of normal startup, bring down for proper reinitialization + +int +do_dhcp_down_net(const char *intf, struct bootp *res, + cyg_uint8 *pstate, struct dhcp_lease *lease) +{ + struct sockaddr_in *addrp; + struct ifreq ifr; + int s; + + // Ensure clean slate + cyg_route_reinit(); // Force any existing routes to be forgotten + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + perror("socket"); + return false; + } + + addrp = (struct sockaddr_in *) &ifr.ifr_addr; + + // Remove any existing address + if ( DHCPSTATE_FAILED == *pstate + || DHCPSTATE_INIT == *pstate + || 0 == *pstate ) { + // it was configured for broadcast only, "half-up" + memset(addrp, 0, sizeof(*addrp)); + addrp->sin_family = AF_INET; + addrp->sin_len = sizeof(*addrp); + addrp->sin_port = 0; + addrp->sin_addr.s_addr = INADDR_ANY; + } + else { + // get the specific address that was used + strcpy(ifr.ifr_name, intf); + if (ioctl(s, SIOCGIFADDR, &ifr)) { + perror("SIOCGIFADDR 1"); + return false; + } + } + + strcpy(ifr.ifr_name, intf); + if (ioctl(s, SIOCDIFADDR, &ifr)) { /* delete IF addr */ + perror("SIOCDIFADDR1"); + } + + // Shut down interface so it can be reinitialized + ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING); + if (ioctl(s, SIOCSIFFLAGS, &ifr)) { /* set ifnet flags */ + perror("SIOCSIFFLAGS down"); + return false; + } + + // All done with socket + close(s); + + if ( 0 != *pstate ) // preserve initial state + *pstate = DHCPSTATE_INIT; + + return true; +} + +// ------------------------------------------------------------------------ +// Release (relinquish) a leased address - if we have one - and bring down +// the interface. +int +do_dhcp_release(const char *intf, struct bootp *res, + cyg_uint8 *pstate, struct dhcp_lease *lease) +{ + if ( 0 != *pstate + && DHCPSTATE_INIT != *pstate + && DHCPSTATE_NOTBOUND != *pstate + && DHCPSTATE_FAILED != *pstate + && DHCPSTATE_BOOTP_FALLBACK != *pstate ) { + *pstate = DHCPSTATE_DO_RELEASE; + do_dhcp( intf, res, pstate, lease ); // to send the release packet + cyg_thread_delay( 100 ); // to let it leave the building + } + return true; +} + +// ------------------------------------------------------------------------ + +#endif // CYGPKG_NET_DHCP + +// EOF dhcp_prot.c diff --git a/packages/net/common/current/src/dhcp_support.c b/packages/net/common/current/src/dhcp_support.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/dhcp_support.c @@ -0,0 +1,229 @@ +/*========================================================================== +// +// dhcp_support.c +// +// Support code == friendly API for DHCP client +// +//========================================================================== +//####ECOSPDCOPYRIGHTBEGIN#### +// +// Copyright (C) 2000, 2001, 2002 Red Hat, Inc. +// All Rights Reserved. +// +// Permission is granted to use, copy, modify and redistribute this +// file. +// +//####ECOSPDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: gthomas +// Date: 2000-07-01 +// Purpose: DHCP support +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include + +#ifdef CYGPKG_NET_DHCP + +#include +#include + +// --------------------------------------------------------------------------- +#ifdef CYGHWR_NET_DRIVER_ETH0 +cyg_uint8 eth0_dhcpstate = 0; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 +cyg_uint8 eth1_dhcpstate = 0; +#endif + +cyg_sem_t dhcp_needs_attention; + +#ifdef CYGHWR_NET_DRIVER_ETH0 +struct dhcp_lease eth0_lease = { &dhcp_needs_attention, 0,0,0,0,0,0 }; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 +struct dhcp_lease eth1_lease = { &dhcp_needs_attention, 0,0,0,0,0,0 }; +#endif + +// --------------------------------------------------------------------------- +// +// The point of this module is to deal with all the horrid written out in +// full stuff of having two interfaces; it's ugly but it's also most +// flexible. The dhcp_prot.c module should do all the work... +// +// --------------------------------------------------------------------------- + +// return value: 1 => everything OK, no change. +// 0 => close your connections, then call do_dhcp_halt() to halt the +// interface(s) in question (it knows because the state will be NOTBOUND). +// After that you can return to the start and use +// init_all_network_interfaces(); as usual, or call do_dhcp_bind() by hand, +// or whatever... +int dhcp_bind( void ) +{ +#ifdef CYGHWR_NET_DRIVER_ETH0 + cyg_uint8 old_eth0_dhcpstate = eth0_dhcpstate; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + cyg_uint8 old_eth1_dhcpstate = eth1_dhcpstate; +#endif + + // If there are no interfaces at all, init it every time, doesn't + // matter. In case we are called from elsewhere... + if ( 1 +#ifdef CYGHWR_NET_DRIVER_ETH0 + && eth0_dhcpstate == 0 +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + && eth1_dhcpstate == 0 +#endif + ) + cyg_semaphore_init( &dhcp_needs_attention, 0 ); + + // Run the state machine... +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up + && DHCPSTATE_FAILED != eth0_dhcpstate ) + eth0_up = do_dhcp(eth0_name, ð0_bootp_data, ð0_dhcpstate, ð0_lease); +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if (eth1_up + && DHCPSTATE_FAILED != eth1_dhcpstate ) + eth1_up = do_dhcp(eth1_name, ð1_bootp_data, ð1_dhcpstate, ð1_lease); +#endif + + // If the interface newly came up, initialize it: + // (this duplicates the code in init_all_network_interfaces() really). +#ifdef CYGHWR_NET_DRIVER_ETH0 + if ( eth0_up + && eth0_dhcpstate == DHCPSTATE_BOUND + && old_eth0_dhcpstate != eth0_dhcpstate ) { + if (!init_net(eth0_name, ð0_bootp_data)) { + eth0_up = false; + } + } +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if ( eth1_up + && eth1_dhcpstate == DHCPSTATE_BOUND + && old_eth1_dhcpstate != eth1_dhcpstate ) { + if (!init_net(eth1_name, ð1_bootp_data)) { + eth1_up = false; + } + } +#endif + +#ifdef CYGHWR_NET_DRIVER_ETH0 + if ( old_eth0_dhcpstate == DHCPSTATE_BOUND && + eth0_dhcpstate == DHCPSTATE_NOTBOUND ) + return 0; // a lease timed out; we became unbound +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if ( old_eth1_dhcpstate == DHCPSTATE_BOUND && + eth1_dhcpstate == DHCPSTATE_NOTBOUND ) + return 0; // a lease timed out; we became unbound +#endif + return 1; // all is well +} + + +// Shutdown any interface whose state is DHCPSTATE_NOTBOUND. +int dhcp_halt( void ) +{ +#ifdef CYGHWR_NET_DRIVER_ETH0 + if ( eth0_up + && eth0_dhcpstate != DHCPSTATE_FAILED ) { + do_dhcp_down_net(eth0_name, ð0_bootp_data, ð0_dhcpstate, ð0_lease); + } + eth0_up = false; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if ( eth1_up + && eth1_dhcpstate != DHCPSTATE_FAILED ) { + do_dhcp_down_net(eth1_name, ð1_bootp_data, ð1_dhcpstate, ð1_lease); + } + eth1_up = false; +#endif + return 1; +} + + +// Release (and set state to DHCPSTATE_NOTBOUND) all interfaces - we are +// closing down. (unlikely but maybe useful for testing) +int dhcp_release( void ) +{ +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) + do_dhcp_release(eth0_name, ð0_bootp_data, ð0_dhcpstate, ð0_lease); +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if (eth1_up) + do_dhcp_release(eth1_name, ð1_bootp_data, ð1_dhcpstate, ð1_lease); +#endif + return 1; +} + + +// ------------------------------------------------------------------------ +// The management thread function +void dhcp_mgt_entry( cyg_addrword_t loop_on_failure ) +{ + int j; + while ( 1 ) { + while ( 1 ) { + cyg_semaphore_wait( &dhcp_needs_attention ); + if ( ! dhcp_bind() ) // a lease expired + break; // If we need to re-bind + } + dhcp_halt(); // tear everything down + if ( !loop_on_failure ) + return; // exit the thread/return + init_all_network_interfaces(); // re-initialize + for ( j = 0; j < CYGPKG_NET_NLOOP; j++ ) + init_loopback_interface( j ); +#ifdef CYGPKG_SNMPAGENT + SnmpdShutDown(0); // Cycle the snmpd state +#endif + } +} + +#ifdef CYGOPT_NET_DHCP_DHCP_THREAD +// Then we provide such a thread... +cyg_handle_t dhcp_mgt_thread_h = 0; +cyg_thread dhcp_mgt_thread; + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + sizeof(struct bootp)) +static cyg_uint8 dhcp_mgt_stack[ STACK_SIZE ]; + +void dhcp_start_dhcp_mgt_thread( void ) +{ + if ( ! dhcp_mgt_thread_h ) { + cyg_semaphore_init( &dhcp_needs_attention, 0 ); + cyg_thread_create( + CYGPKG_NET_DHCP_THREAD_PRIORITY, /* scheduling info (eg pri) */ + dhcp_mgt_entry, /* entry point function */ + CYGOPT_NET_DHCP_DHCP_THREAD_PARAM, /* entry data */ + "DHCP lease mgt", /* optional thread name */ + dhcp_mgt_stack, /* stack base, NULL = alloc */ + STACK_SIZE, /* stack size, 0 = default */ + &dhcp_mgt_thread_h, /* returned thread handle */ + &dhcp_mgt_thread /* put thread here */ + ); + + cyg_thread_resume(dhcp_mgt_thread_h); + } +} + + +#endif // CYGOPT_NET_DHCP_DHCP_THREAD + +#endif // CYGPKG_NET_DHCP + +// EOF dhcp_support.c diff --git a/packages/net/common/current/src/getaddrinfo.c b/packages/net/common/current/src/getaddrinfo.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/getaddrinfo.c @@ -0,0 +1,357 @@ +//========================================================================== +// +// lib/getaddrinfo.c +// +// getaddrinfo(), freeaddrinfo(), gai_strerror(), getnameinfo() +// +//========================================================================== +//####ECOSPDCOPYRIGHTBEGIN#### +// +// Copyright (C) 2000, 2001, 2002 Red Hat, Inc. +// All Rights Reserved. +// +// Permission is granted to use, copy, modify and redistribute this +// file. +// +//####ECOSPDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2002-03-05 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include // PF_xxx +#include // IPPROTO_xx +#include +#include +#include + +extern int sprintf(char *, const char *, ...); +extern long strtol(const char *, char **, int); +extern void *malloc(size_t); +extern void *calloc(int, size_t); +extern void free(void *); + +// This routine is the real meat of the host->address translation +static int +_getaddr(struct addrinfo *ai, const char *node, + const struct addrinfo *hints, int family, int port) +{ + switch (family) { + case AF_INET: + { + struct sockaddr_in *sa; + sa = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in)); + ai->ai_addr = (struct sockaddr *)sa; + ai->ai_addrlen = sizeof(*sa); + if (ai->ai_addr == (struct sockaddr *)NULL) { + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_MEMORY; + } + sa->sin_family = AF_INET; + sa->sin_len = sizeof(*sa); + sa->sin_port = htons(port); + if (node == (char *)NULL) { + if (hints->ai_flags & AI_PASSIVE) { + sa->sin_addr.s_addr = htonl(INADDR_ANY); + } else { + sa->sin_addr.s_addr = htonl(INADDR_LOOPBACK); + } + } else { + // For now, only numeric "presentation" addresses supported + if (!inet_pton(AF_INET, (char *)node, (char *)&sa->sin_addr.s_addr)) { + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_FAIL; // Couldn't resolve name + } + } + } + break; +#ifdef CYGPKG_NET_INET6 + case AF_INET6: + { + struct sockaddr_in6 *sa; + sa = (struct sockaddr_in6 *)malloc(sizeof(struct sockaddr_in6)); + ai->ai_addr = (struct sockaddr *)sa; + ai->ai_addrlen = sizeof(*sa); + if (ai->ai_addr == (struct sockaddr *)NULL) { + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_MEMORY; + } + sa->sin6_family = AF_INET6; + sa->sin6_len = sizeof(*sa); + sa->sin6_port = htons(port); + if (node == (char *)NULL) { + if (hints->ai_flags & AI_PASSIVE) { + sa->sin6_addr = in6addr_any; + } else { + sa->sin6_addr = in6addr_loopback; + } + } else { + // For now, only numeric "presentation" addresses supported + if (!inet_pton(AF_INET6, (char *)node, (char *)&sa->sin6_addr)) { + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_FAIL; // Couldn't resolve name + } + } + } + break; +#endif + } + return EAI_NONE; +} + +int +getaddrinfo(const char *nodename, const char *servname, + const struct addrinfo *hints, struct addrinfo **res) +{ + struct addrinfo dflt_hints; + struct protoent *proto = (struct protoent *)NULL; + struct addrinfo *ai; + char *protoname; + int port = 0; + int family; + int err; + + if (hints == (struct addrinfo *)NULL) { + dflt_hints.ai_flags = 0; // No special flags + dflt_hints.ai_family = PF_UNSPEC; + dflt_hints.ai_socktype = 0; + dflt_hints.ai_protocol = 0; + hints = &dflt_hints; + } + // Prevalidate parameters + if ((nodename == (char *)NULL) && (servname == (char *)NULL)) { + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_NONAME; + } + switch (hints->ai_family) { + case PF_UNSPEC: + case PF_INET: + family = AF_INET; + break; +#ifdef CYGPKG_NET_INET6 + case PF_INET6: + family = AF_INET6; + break; +#endif + default: + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_FAMILY; + } + // Allocate the first/primary result + *res = ai = (struct addrinfo *)calloc(1, sizeof(struct addrinfo)); + if (ai == (struct addrinfo *)NULL) { + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_MEMORY; + } + // Handle request + if (hints->ai_protocol != 0) { + proto = getprotobynumber(hints->ai_protocol); + } + ai->ai_family = family; + if (servname != (char *)NULL) { + switch (hints->ai_socktype) { + case 0: + case SOCK_STREAM: + protoname = "tcp"; + ai->ai_socktype = SOCK_STREAM; + break; + case SOCK_DGRAM: + protoname = "udp"; + ai->ai_socktype = SOCK_DGRAM; + break; + default: + freeaddrinfo(ai); + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_SOCKTYPE; + } + // See if this is just a port # + if ((port = strtol(servname, 0, 0)) > 0) { + ai->ai_socktype = hints->ai_socktype; + if (hints->ai_socktype == 0) { + // Need to have complete binding type/port + freeaddrinfo(ai); + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_SERVICE; + } + } else { + struct servent *serv = (struct servent *)NULL; + + serv = getservbyname(servname, protoname); + if (serv == (struct servent *)NULL) { + if (hints->ai_socktype == 0) { + protoname = "udp"; + serv = getservbyname(servname, protoname); + } + } + if (serv == (struct servent *)NULL) { + freeaddrinfo(ai); + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_SERVICE; + } + port = ntohs(serv->s_port); + } + proto = getprotobyname(protoname); + if (hints->ai_protocol && (hints->ai_protocol != proto->p_proto)) { + freeaddrinfo(ai); + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_SOCKTYPE; + } + ai->ai_protocol = proto->p_proto; + } + // Iterate through address types and create addresses + // Note: this does not handle the case where a given service can be + // handled via multiple protocols, e.g. http/tcp & http/udp + err = _getaddr(ai, nodename, hints, family, port); + if (err != EAI_NONE) { + freeaddrinfo(ai); + return err; + } +#ifdef CYGPKG_NET_INET6 + if (hints->ai_family == PF_UNSPEC) { + // Add IPv6 address as well + struct addrinfo *nai = (struct addrinfo *)calloc(1, sizeof(struct addrinfo)); + if (nai == (struct addrinfo *)NULL) { + freeaddrinfo(ai); + diag_printf("Error at %s.%d\n", __FUNCTION__, __LINE__); + return EAI_MEMORY; + } + ai->ai_next = nai; + nai->ai_family = PF_INET6; + nai->ai_socktype = ai->ai_socktype; + nai->ai_protocol = ai->ai_protocol; + err = _getaddr(nai, nodename, hints, AF_INET6, port); + if (err != EAI_NONE) { + freeaddrinfo(*res); + return err; + } + } +#endif + // Note: null nodename is the same as 'localhost' + if (nodename == (char *)NULL) { + nodename = (const char *)"localhost"; + } + if (hints->ai_flags & AI_CANONNAME) { + // Hack - until host name handling is more complete + ai = *res; // Canonical name is only in primary record + ai->ai_canonname = malloc(strlen(nodename)+1); + if (ai->ai_canonname) { + strcpy(ai->ai_canonname, nodename); + } + } + if (hints->ai_flags & AI_PASSIVE) { + // Incomplete addressing - used for bind/listen + } else { + // Complete addressing - used for connect/send/... + } + return EAI_NONE; // No errors +} + +void +freeaddrinfo(struct addrinfo *ai) +{ + struct addrinfo *next = ai; + + while ((ai = next) != (struct addrinfo *)NULL) { + if (ai->ai_canonname) free(ai->ai_canonname); + if (ai->ai_addr) free(ai->ai_addr); + next = ai->ai_next; + free(ai); + } +} + +char +*gai_strerror(int err) +{ + switch (err) { + case EAI_NONE: + return "EAI - no error"; + case EAI_AGAIN: + return "EAI - temporary failure in name resolution"; + case EAI_BADFLAGS: + return "EAI - invalid flags"; + case EAI_FAIL: + return "EAI - non-recoverable failure in name resolution"; + case EAI_FAMILY: + return "EAI - family not supported"; + case EAI_MEMORY: + return "EAI - memory allocation failure"; + case EAI_NONAME: + return "EAI - hostname nor servname provided, or not known"; + case EAI_SERVICE: + return "EAI - servname not supported for socket type"; + case EAI_SOCKTYPE: + return "EAI - socket type not supported"; + case EAI_SYSTEM: + return "EAI - system error"; + case EAI_BADHINTS: + return "EAI - inconsistent hints"; + case EAI_PROTOCOL: + return "EAI - bad protocol"; + default: + return "EAI - unknown error"; + } +} + +// Set of flags implemented +#define NI_MASK (NI_NUMERICHOST|NI_NUMERICSERV|NI_NOFQDN|NI_NAMEREQD|NI_DGRAM) + +int +getnameinfo (const struct sockaddr *sa, socklen_t salen, + char *host, socklen_t hostlen, + char *serv, socklen_t servlen, + unsigned int flags) +{ + int port; + char *s; + struct servent *se; + + if ((flags & ~NI_MASK) != 0) { + return EAI_BADFLAGS; + } + switch (sa->sa_family) { + case PF_INET: +#ifdef CYGPKG_NET_INET6 + case PF_INET6: +#endif + if (host != (char *)NULL) { + s = _inet_ntop((struct sockaddr *)sa, host, hostlen); + if (!s) { + return EAI_FAIL; + } + } + if (serv != (char *)NULL) { + port = _inet_port((struct sockaddr *)sa); + if (!port) { + return EAI_FAIL; + } + se = (struct servent *)NULL; + if ((flags & NI_NUMERICSERV) == 0) { + if ((flags & NI_DGRAM) == 0) { + se = getservbyport(port, "tcp"); + } + if (se == (struct servent *)NULL) { + se = getservbyport(port, "ucp"); + } + } + if (se != (struct servent *)NULL) { + sprintf(serv, "%s/%s", se->s_name, se->s_proto); + } else { + sprintf(serv, "%d", port); + } + } + break; + default: + return EAI_FAMILY; + } + return EAI_NONE; +} diff --git a/packages/net/common/current/src/getproto.c b/packages/net/common/current/src/getproto.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/getproto.c @@ -0,0 +1,87 @@ +//========================================================================== +// +// lib/getproto.c +// +// getprotobyname(), getprotobynumber() +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +static struct protoent protocols[] = { + { "ip", 0}, // internet protocol, pseudo protocol number + { "icmp", 1}, // internet control message protocol + { "igmp", 2}, // Internet Group Management + { "ggp", 3}, // gateway-gateway protocol + { "ipencap", 4}, // IP encapsulated in IP (officially ``IP'') + { "st", 5}, // ST datagram mode + { "tcp", 6}, // transmission control protocol + { "egp", 8}, // exterior gateway protocol + { "pup", 12}, // PARC universal packet protocol + { "udp", 17}, // user datagram protocol + { "hmp", 20}, // host monitoring protocol + { "xns-idp", 22}, // Xerox NS IDP + { "rdp", 27}, // "reliable datagram" protocol + { "iso-tp4", 29}, // ISO Transport Protocol class 4 + { "xtp", 36}, // Xpress Tranfer Protocol + { "ddp", 37}, // Datagram Delivery Protocol + { "idpr-cmtp", 39}, // IDPR Control Message Transport + { "rspf", 73}, //Radio Shortest Path First. + { "vmtp", 81}, // Versatile Message Transport + { "ospf", 89}, // Open Shortest Path First IGP + { "ipip", 94}, // Yet Another IP encapsulation + { "encap", 98}, // Yet Another IP encapsulation + { 0, 0} +}; + +struct protoent * +getprotobyname(const char *name) +{ + struct protoent *p = protocols; + while (p->p_name) { + if (strcmp(name, p->p_name) == 0) { + return p; + } + p++; + } + errno = ENOENT; + return (struct protoent *)0; +} + +struct protoent * +getprotobynumber(const int num) +{ + struct protoent *p = protocols; + while (p->p_name) { + if (p->p_proto == num) { + return p; + } + p++; + } + errno = ENOENT; + return (struct protoent *)0; +} diff --git a/packages/net/common/current/src/getserv.c b/packages/net/common/current/src/getserv.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/getserv.c @@ -0,0 +1,98 @@ +//========================================================================== +// +// lib/getserv.c +// +// getservbyname(), getservbyport() +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +#include +#include + +// These must return the port in network byte order. +// +// This means treated as a short, because it's a port, despite the types in +// the API and the struct being ints. +// +// The argument to getservbyport() is also network byte order, so that code +// must change to flip before comparing. + +static struct servent services[] = { + { "ftp", 0, 21 , "tcp" }, + { "ftp-data", 0, 20 , "tcp" }, + { "domain", 0, 53 , "udp" }, + { "tftp", 0, 69 , "udp" }, + { "snmp", 0, 161 , "udp" }, + + { NULL, 0, 0 , NULL } +}; + +// Note that this contains no interlocking between clients of the +// interface; but this is completely typical of such APIs. + +static struct servent * +setreturned( struct servent *p ) +{ + static struct servent returned; + + returned.s_name = p->s_name; + returned.s_aliases = p->s_aliases; + returned.s_port = htons(p->s_port); // return in net order + returned.s_proto = p->s_proto; + return &returned; +} + +struct servent * +getservbyname(const char *name, const char *proto) +{ + struct servent *p = services; + while (p->s_name) { + if ((strcmp(name, p->s_name) == 0) && + (strcmp(proto, p->s_proto) == 0)) { + return setreturned(p); + } + p++; + } + errno = ENOENT; + return (struct servent *)0; +} + +struct servent * +getservbyport(const int num, const char *proto) +{ + struct servent *p = services; + int port = ntohs(num); + while (p->s_name) { + if ((p->s_port == port) && + (strcmp(proto, p->s_proto) == 0)) { + return setreturned(p); + } + p++; + } + errno = ENOENT; + return (struct servent *)0; +} diff --git a/packages/net/common/current/src/ifaddrs.c b/packages/net/common/current/src/ifaddrs.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/ifaddrs.c @@ -0,0 +1,318 @@ +//========================================================================== +// +// src/ifaddrs.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +// +// Adapted from KAME getifaddrs.c, if_nametoindex.c, if_indextoname.c +// + +/* $KAME: getifaddrs.c,v 1.9 2001/08/20 02:31:20 itojun Exp $ */ +/* $KAME: if_nametoindex.c,v 1.6 2000/11/24 08:18:54 itojun Exp $ */ +/* $KAME: if_indextoname.c,v 1.7 2000/11/08 03:09:30 itojun Exp $ */ + +/* + * Copyright (c) 1995, 1999 + * Berkeley Software Design, 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. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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. + * + * BSDI getifaddrs.c,v 2.12 2000/02/23 14:51:59 dab Exp + */ + +#include +#include +#include + +#undef _KERNEL +#undef __INSIDE_NET +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(AF_LINK) +#define SA_LEN(sa) sizeof(struct sockaddr) +#endif + +#if !defined(SA_LEN) +#define SA_LEN(sa) (sa)->sa_len +#endif + +#define SALIGN (sizeof(long) - 1) +#define SA_RLEN(sa) ((sa)->sa_len ? (((sa)->sa_len + SALIGN) & ~SALIGN) : (SALIGN + 1)) + +#ifndef ALIGNBYTES +/* + * On systems with a routing socket, ALIGNBYTES should match the value + * that the kernel uses when building the messages. + */ +#define ALIGNBYTES XXX +#endif +#ifndef ALIGN +#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES) +#endif + +int +getifaddrs(struct ifaddrs **pif) +{ + int icnt = 1; // Interface count + int dcnt = 0; // Data [length] count + int ncnt = 0; // Length of interface names + char buf[1024]; + int i, sock; + struct ifconf ifc; + struct ifreq *ifr, *lifr; + char *data, *names; + struct ifaddrs *ifa, *ift; + + ifc.ifc_buf = buf; + ifc.ifc_len = sizeof(buf); + + if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) + return (-1); + i = ioctl(sock, SIOCGIFCONF, (char *)&ifc); + close(sock); + if (i < 0) + return (-1); + + ifr = ifc.ifc_req; + lifr = (struct ifreq *)&ifc.ifc_buf[ifc.ifc_len]; + + while (ifr < lifr) { + struct sockaddr *sa; + + sa = &ifr->ifr_addr; + ++icnt; + dcnt += SA_RLEN(sa); + ncnt += sizeof(ifr->ifr_name) + 1; + + if (SA_LEN(sa) < sizeof(*sa)) + ifr = (struct ifreq *)(((char *)sa) + sizeof(*sa)); + else + ifr = (struct ifreq *)(((char *)sa) + SA_LEN(sa)); + } + + if (icnt + dcnt + ncnt == 1) { + // Nothing found + *pif = NULL; + free(buf); + return (0); + } + data = malloc(sizeof(struct ifaddrs) * icnt + dcnt + ncnt); + if (data == NULL) { + free(buf); + return(-1); + } + + ifa = (struct ifaddrs *)(void *)data; + data += sizeof(struct ifaddrs) * icnt; + names = data + dcnt; + + memset(ifa, 0, sizeof(struct ifaddrs) * icnt); + ift = ifa; + + ifr = ifc.ifc_req; + lifr = (struct ifreq *)&ifc.ifc_buf[ifc.ifc_len]; + + while (ifr < lifr) { + struct sockaddr *sa; + + ift->ifa_name = names; + names[sizeof(ifr->ifr_name)] = 0; + strncpy(names, ifr->ifr_name, sizeof(ifr->ifr_name)); + while (*names++) ; + + ift->ifa_addr = (struct sockaddr *)data; + sa = &ifr->ifr_addr; + memcpy(data, sa, SA_LEN(sa)); + data += SA_RLEN(sa); + + if (SA_LEN(sa) < sizeof(*sa)) + ifr = (struct ifreq *)(((char *)sa) + sizeof(*sa)); + else + ifr = (struct ifreq *)(((char *)sa) + SA_LEN(sa)); + ift = (ift->ifa_next = ift + 1); + } + + if (--ift >= ifa) { + ift->ifa_next = NULL; + *pif = ifa; + } else { + *pif = NULL; + free(ifa); + } + return (0); +} + +void +freeifaddrs(struct ifaddrs *ifp) +{ + free(ifp); +} + +void +_show_all_interfaces(void) +{ + struct ifaddrs *iflist, *ifp; + char addr[64]; + int indx; + + if (getifaddrs(&iflist) < 0) { + diag_printf("Can't get interface information!!\n"); + return; + } + ifp = iflist; + while (ifp != (struct ifaddrs *)NULL) { + if (ifp->ifa_addr->sa_family != AF_LINK) { + getnameinfo (ifp->ifa_addr, ifp->ifa_addr->sa_len, addr, sizeof(addr), 0, 0, 0); + diag_printf("%p - %s - %s\n", ifp, ifp->ifa_name, addr); + } + ifp = ifp->ifa_next; + } + indx = if_nametoindex(iflist->ifa_name); + diag_printf("indx(%s) = %d\n", iflist->ifa_name, indx); + if (indx > 0) { + if (if_indextoname(indx, addr)) { + diag_printf("index(%s) = %d/%s\n", iflist->ifa_name, indx, addr); + } else { + diag_printf("index(%s) = %d: %s\n", iflist->ifa_name, indx, strerror(errno)); + } + } else { + diag_printf("index(%s): %s\n", iflist->ifa_name, strerror(errno)); + } + freeifaddrs(iflist); +} + +/* + * From RFC 2553: + * + * 4.1 Name-to-Index + * + * + * The first function maps an interface name into its corresponding + * index. + * + * #include + * + * unsigned int if_nametoindex(const char *ifname); + * + * If the specified interface name does not exist, the return value is + * 0, and errno is set to ENXIO. If there was a system error (such as + * running out of memory), the return value is 0 and errno is set to the + * proper value (e.g., ENOMEM). + */ + +unsigned int +if_nametoindex(const char *ifname) +{ + struct ifaddrs *ifaddrs, *ifa; + unsigned int ni; + + if (getifaddrs(&ifaddrs) < 0) + return(0); + + ni = 0; + + for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) { + if (ifa->ifa_addr && + ifa->ifa_addr->sa_family == AF_LINK && + strcmp(ifa->ifa_name, ifname) == 0) { + ni = ((struct sockaddr_dl*)ifa->ifa_addr)->sdl_index; + break; + } + } + + freeifaddrs(ifaddrs); + if (!ni) + errno = ENXIO; + return(ni); +} + +/* + * From RFC 2533: + * + * The second function maps an interface index into its corresponding + * name. + * + * #include + * + * char *if_indextoname(unsigned int ifindex, char *ifname); + * + * The ifname argument must point to a buffer of at least IF_NAMESIZE + * bytes into which the interface name corresponding to the specified + * index is returned. (IF_NAMESIZE is also defined in and + * its value includes a terminating null byte at the end of the + * interface name.) This pointer is also the return value of the + * function. If there is no interface corresponding to the specified + * index, NULL is returned, and errno is set to ENXIO, if there was a + * system error (such as running out of memory), if_indextoname returns + * NULL and errno would be set to the proper value (e.g., ENOMEM). + */ + +char * +if_indextoname(unsigned int ifindex, char *ifname) +{ + struct ifaddrs *ifaddrs, *ifa; + int error = 0; + + if (getifaddrs(&ifaddrs) < 0) + return(NULL); /* getifaddrs properly set errno */ + + for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) { + if (ifa->ifa_addr && + ifa->ifa_addr->sa_family == AF_LINK && + ifindex == ((struct sockaddr_dl*)ifa->ifa_addr)->sdl_index) + break; + } + + if (ifa == NULL) { + error = ENXIO; + ifname = NULL; + } + else + strncpy(ifname, ifa->ifa_name, IFNAMSIZ); + + freeifaddrs(ifaddrs); + + errno = error; + return(ifname); +} diff --git a/packages/net/common/current/src/inet_addr.c b/packages/net/common/current/src/inet_addr.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/inet_addr.c @@ -0,0 +1,235 @@ +//========================================================================== +// +// src/inet_addr.c +// +// INET address parse functions +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +/* $OpenBSD: inet_addr.c,v 1.6 1999/05/03 22:31:14 yanick Exp $ */ + +/* + * ++Copyright++ 1983, 1990, 1993 + * - + * Copyright (c) 1983, 1990, 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; +static char rcsid[] = "$From: inet_addr.c,v 8.5 1996/08/05 08:31:35 vixie Exp $"; +#else +static char rcsid[] = "$OpenBSD: inet_addr.c,v 1.6 1999/05/03 22:31:14 yanick Exp $"; +#endif +#endif /* LIBC_SCCS and not lint */ + +#ifdef __ECOS +#include +#undef _KERNEL +#include +#include +#include +#include + +#include +#include +#else +#include +#include +#include +#endif +#include +#include + +#ifdef __ECOS +#define isascii(c) (((unsigned char)(c) >= 0x20) && ((unsigned char)(c) <= 0x7F)) +#endif + +/* + * Ascii internet address interpretation routine. + * The value returned is in network order. + */ +in_addr_t +inet_addr(const char *cp) +{ + struct in_addr val; + + if (inet_aton(cp, &val)) + return (val.s_addr); + return (INADDR_NONE); +} + +/* + * Check whether "cp" is a valid ascii representation + * of an Internet address and convert to a binary address. + * Returns 1 if the address is valid, 0 if not. + * This replaces inet_addr, the return value from which + * cannot distinguish between failure and a local broadcast address. + */ +int +inet_aton(const char *cp, struct in_addr *addr) +{ + register in_addr_t val; + register int base, n; + register char c; + u_int parts[4]; + register u_int *pp = parts; + + c = *cp; + for (;;) { + /* + * Collect number up to ``.''. + * Values are specified as for C: + * 0x=hex, 0=octal, isdigit=decimal. + */ + if (!isdigit(c)) + return (0); + val = 0; base = 10; + if (c == '0') { + c = *++cp; + if (c == 'x' || c == 'X') + base = 16, c = *++cp; + else + base = 8; + } + for (;;) { + if (isascii(c) && isdigit(c)) { + val = (val * base) + (c - '0'); + c = *++cp; + } else if (base == 16 && isascii(c) && isxdigit(c)) { + val = (val << 4) | + (c + 10 - (islower(c) ? 'a' : 'A')); + c = *++cp; + } else + break; + } + if (c == '.') { + /* + * Internet format: + * a.b.c.d + * a.b.c (with c treated as 16 bits) + * a.b (with b treated as 24 bits) + */ + if (pp >= parts + 3) + return (0); + *pp++ = val; + c = *++cp; + } else + break; + } + /* + * Check for trailing characters. + */ + if (c != '\0' && (!isascii(c) || !isspace(c))) + return (0); + /* + * Concoct the address according to + * the number of parts specified. + */ + n = pp - parts + 1; + switch (n) { + + case 0: + return (0); /* initial nondigit */ + + case 1: /* a -- 32 bits */ + break; + + case 2: /* a.b -- 8.24 bits */ + if ((val > 0xffffff) || (parts[0] > 0xff)) + return (0); + val |= parts[0] << 24; + break; + + case 3: /* a.b.c -- 8.8.16 bits */ + if ((val > 0xffff) || (parts[0] > 0xff) || (parts[1] > 0xff)) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16); + break; + + case 4: /* a.b.c.d -- 8.8.8.8 bits */ + if ((val > 0xff) || (parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xff)) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); + break; + } + if (addr) + addr->s_addr = htonl(val); + return (1); +} diff --git a/packages/net/common/current/src/inet_ntoa.c b/packages/net/common/current/src/inet_ntoa.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/inet_ntoa.c @@ -0,0 +1,70 @@ +//========================================================================== +// +// src/inet_ntoa.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + + +/* + * Copyright 1994, 1995 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. 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. + * + * $FreeBSD: src/sys/libkern/inet_ntoa.c,v 1.2.16.1 2000/08/03 01:03:45 peter Exp $ + */ + +#include +#include + +char * +inet_ntoa(struct in_addr ina) +{ + static char buf[4*sizeof "123"]; + unsigned char *ucp = (unsigned char *)&ina; + + diag_sprintf(buf, "%d.%d.%d.%d", + ucp[0] & 0xff, + ucp[1] & 0xff, + ucp[2] & 0xff, + ucp[3] & 0xff); + return buf; +} + diff --git a/packages/net/common/current/src/inet_ntop.c b/packages/net/common/current/src/inet_ntop.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/inet_ntop.c @@ -0,0 +1,256 @@ +//========================================================================== +// +// src/inet_ntop.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $OpenBSD: inet_ntop.c,v 1.1 1997/03/13 19:07:32 downsj Exp $ */ + +/* Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef IN6ADDRSZ +#define IN6ADDRSZ 16 /* IPv6 T_AAAA */ +#endif +#ifndef INT16SZ +#define INT16SZ sizeof(u_int16_t) +#endif + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static const char *inet_ntop4 __P((const u_char *src, char *dst, size_t size)); +#ifdef CYGPKG_NET_INET6 +static const char *inet_ntop6 __P((const u_char *src, char *dst, size_t size)); +#endif + +/* char * + * inet_ntop(af, src, dst, size) + * convert a network format address to presentation format. + * return: + * pointer to presentation format address (`dst'), or NULL (see errno). + * author: + * Paul Vixie, 1996. + */ +const char * +inet_ntop(int af, const void *src, char *dst, size_t size) +{ + switch (af) { + case AF_INET: + return (inet_ntop4(src, dst, size)); +#ifdef CYGPKG_NET_INET6 + case AF_INET6: + return (inet_ntop6(src, dst, size)); +#endif + default: + errno = EAFNOSUPPORT; + return (NULL); + } + /* NOTREACHED */ +} + +// +// A more useful conversion routine +// Convert a network [socket] address to presentation format +// This routine handles all of the mapping required and isolates +// the knowledge of the structure format. +// +const char * +_inet_ntop(struct sockaddr *sa, char *dst, size_t size) +{ + switch (sa->sa_family) { + case AF_INET: + return (inet_ntop(AF_INET, (char *)&((struct sockaddr_in *)sa)->sin_addr, + dst, size)); +#ifdef CYGPKG_NET_INET6 + case AF_INET6: + return (inet_ntop(AF_INET6, (char *)&((struct sockaddr_in6 *)sa)->sin6_addr, + dst, size)); +#endif + default: + errno = EAFNOSUPPORT; + return (NULL); + } +} + +u_int16_t +_inet_port(struct sockaddr *sa) +{ + switch (sa->sa_family) { + case AF_INET: + return (ntohs(((struct sockaddr_in *)sa)->sin_port)); +#ifdef CYGPKG_NET_INET6 + case AF_INET6: + return (ntohs(((struct sockaddr_in6 *)sa)->sin6_port)); +#endif + default: + return 0; // Unknown! + } +} + +/* const char * + * inet_ntop4(src, dst, size) + * format an IPv4 address, more or less like inet_ntoa() + * return: + * `dst' (as a const) + * notes: + * (1) uses no statics + * (2) takes a u_char* not an in_addr as input + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop4(src, dst, size) + const u_char *src; + char *dst; + size_t size; +{ + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[sizeof "255.255.255.255"]; + + if (sprintf(tmp, fmt, src[0], src[1], src[2], src[3]) > size) { + errno = ENOSPC; + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +#ifdef CYGPKG_NET_INET6 +/* const char * + * inet_ntop6(src, dst, size) + * convert IPv6 binary address into presentation (printable) format + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop6(const u_char *src, char *dst, size_t size) +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ +#if 0 // This is too optimistic + char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; +#else + char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"], *tp; +#endif + struct { int base, len; } best, cur; + u_int words[IN6ADDRSZ / INT16SZ]; + int i; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof words); + for (i = 0; i < IN6ADDRSZ; i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + cur.base = -1; + for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) + *tp++ = ':'; + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *tp++ = ':'; + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && + (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { + if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) + return (NULL); + tp += strlen(tp); + break; + } + tp += sprintf(tp, "%x", words[i]); + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) + *tp++ = ':'; + *tp++ = '\0'; + + /* + * Check for overflow, copy, and we're done. + */ + if ((size_t)(tp - tmp) > size) { + errno = ENOSPC; + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} +#endif diff --git a/packages/net/common/current/src/inet_pton.c b/packages/net/common/current/src/inet_pton.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/inet_pton.c @@ -0,0 +1,269 @@ +//========================================================================== +// +// src/inet_pton.c +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD, +// FreeBSD or other sources, and are covered by the appropriate +// copyright disclaimers included herein. +// +// Portions created by Red Hat are +// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== + +/* $KAME: inet_pton.c,v 1.5 2001/08/20 02:32:40 itojun Exp $ */ + +/* + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +//#if defined(LIBC_SCCS) && !defined(lint) +//static char rcsid[] = "$Id: inet_pton.c,v 1.4 2002/03/06 15:20:46 gthomas Exp $"; +//#endif /* LIBC_SCCS and not lint */ + +//#ifdef HAVE_CONFIG_H +//#include +//#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +//#ifndef HAVE_PORTABLE_PROTOTYPE +//#include "cdecl_ext.h" +//#endif + +//#ifndef HAVE_U_INT16_T +//#include "bittypes.h" +//#endif + +//#if !(defined(HAVE_INADDRSZ) && defined(HAVE_IN6ADDRSZ)) +//#include "addrsize.h" +//#endif + +#define NS_INADDRSZ 4 /* IPv4 T_A */ +#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */ + +#ifndef NS_INADDRSZ +#define NS_INADDRSZ INADDRSZ +#endif +#ifndef NS_IN6ADDRSZ +#define NS_IN6ADDRSZ IN6ADDRSZ +#endif +#ifndef NS_INT16SZ +#define NS_INT16SZ sizeof(u_int16_t) +#endif + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static int inet_pton4 __P((const char *src, u_char *dst)); +#ifdef CYGPKG_NET_INET6 +static int inet_pton6 __P((const char *src, u_char *dst)); +#endif + +/* int + * inet_pton(af, src, dst) + * convert from presentation format (which usually means ASCII printable) + * to network format (which is usually some kind of binary format). + * return: + * 1 if the address was valid for the specified address family + * 0 if the address wasn't valid (`dst' is untouched in this case) + * -1 if some other error occurred (`dst' is untouched in this case, too) + * author: + * Paul Vixie, 1996. + */ +int +inet_pton(int af, const char *src, void *dst) +{ + switch (af) { + case AF_INET: + return (inet_pton4(src, dst)); +#ifdef CYGPKG_NET_INET6 + case AF_INET6: + return (inet_pton6(src, dst)); +#endif + default: + errno = EAFNOSUPPORT; + return (-1); + } + /* NOTREACHED */ +} + +/* int + * inet_pton4(src, dst) + * like inet_aton() but without all the hexadecimal and shorthand. + * return: + * 1 if `src' is a valid dotted quad, else 0. + * notice: + * does not touch `dst' unless it's returning 1. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton4(const char *src, u_char *dst) +{ + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; + u_char tmp[NS_INADDRSZ], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr(digits, ch)) != NULL) { + u_int new = *tp * 10 + (pch - digits); + + if (new > 255) + return (0); + *tp = new; + if (! saw_digit) { + if (++octets > 4) + return (0); + saw_digit = 1; + } + } else if (ch == '.' && saw_digit) { + if (octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } else + return (0); + } + if (octets < 4) + return (0); + memcpy(dst, tmp, NS_INADDRSZ); + return (1); +} + +#ifdef CYGPKG_NET_INET6 +/* int + * inet_pton6(src, dst) + * convert presentation level address to network order binary form. + * return: + * 1 if `src' is a valid [RFC1884 2.2] address, else 0. + * notice: + * (1) does not touch `dst' unless it's returning 1. + * (2) :: in a full address is silently ignored. + * credit: + * inspired by Mark Andrews. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton6(const char *src, u_char *dst) +{ + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; + u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, saw_xdigit; + u_int val; + + memset((tp = tmp), '\0', NS_IN6ADDRSZ); + endp = tp + NS_IN6ADDRSZ; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + return (0); + curtok = src; + saw_xdigit = 0; + val = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if (pch != NULL) { + val <<= 4; + val |= (pch - xdigits); + if (val > 0xffff) + return (0); + saw_xdigit = 1; + continue; + } + if (ch == ':') { + curtok = src; + if (!saw_xdigit) { + if (colonp) + return (0); + colonp = tp; + continue; + } else if (*src == '\0') { + return (0); + } + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + saw_xdigit = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && + inet_pton4(curtok, tp) > 0) { + tp += NS_INADDRSZ; + saw_xdigit = 0; + break; /* '\0' was seen by inet_pton4(). */ + } + return (0); + } + if (saw_xdigit) { + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + } + if (colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + int i; + + if (tp == endp) + return (0); + for (i = 1; i <= n; i++) { + endp[- i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) + return (0); + memcpy(dst, tmp, NS_IN6ADDRSZ); + return (1); +} +#endif /*INET6*/ diff --git a/packages/net/common/current/src/ipv6_routing_thread.c b/packages/net/common/current/src/ipv6_routing_thread.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/ipv6_routing_thread.c @@ -0,0 +1,161 @@ +//========================================================================== +// +// ipv6_routing_thread.c +// +// IPv6 routing support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2002-04-16 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// IPv6 routing support + +#include +#undef _KERNEL +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define ALLROUTER "ff02::2" + +#define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL+2048 +static char rs_stack[STACK_SIZE]; +static cyg_thread rs_thread_data; +static cyg_handle_t rs_thread_handle; + +static void +cyg_rs_exit(void) +{ + cyg_thread_exit(); +} + +static void +cyg_rs(cyg_addrword_t param) +{ + struct timeval tv; + struct addrinfo hints, *res; + int s, len, err; + struct sockaddr_in6 to; + struct icmp6_hdr *icp; + u_int hlim = 255; + u_char outpack[sizeof(struct icmp6_hdr)]; + int cc = sizeof(struct icmp6_hdr); + fd_set fdset; + char msg[1024]; + + _show_all_interfaces(); + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_INET6; + err = getaddrinfo(ALLROUTER, NULL, &hints, &res); + if (err) { + diag_printf("%s - failed to get ALL ROUTER: %s", + __FUNCTION__, gai_strerror(err)); + cyg_rs_exit(); + } + memcpy(&to, res->ai_addr, res->ai_addrlen); + *(u_int16_t *)&to.sin6_addr.s6_addr[2] = htons(1); + + if ((s = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0) { + diag_printf("%s - can't open socket: %s\n", + __FUNCTION__, strerror(errno)); + cyg_rs_exit(); + } + if (setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, + &hlim, sizeof(hlim)) < 0) { + diag_printf("%s - can set IPV6 MULTICAST HOPS: %s\n", + __FUNCTION__, strerror(errno)); + cyg_rs_exit(); + } + + tv.tv_sec = 15; + tv.tv_usec = 0; + select(0, 0, 0, 0, &tv); // Sleeps for tv + + icp = (struct icmp6_hdr *)outpack; + icp->icmp6_type = ND_ROUTER_SOLICIT; + icp->icmp6_code = 0; + icp->icmp6_cksum = 0; + icp->icmp6_data32[0] = 0; /* RS reserved field */ + + while (true) { + if (sendto(s, outpack, cc, 0, (struct sockaddr *)&to, to.sin6_len) < 0) { + diag_printf("%s - can't send RS: %s\n", + __FUNCTION__, strerror(errno)); + } + // See if a router gives back an answer + FD_ZERO(&fdset); + FD_SET(s, &fdset); + tv.tv_sec = RTR_SOLICITATION_INTERVAL; + tv.tv_usec = 0; + if (select(s + 1, &fdset, NULL, NULL, &tv) == 1) { + len = read(s, msg, sizeof(msg)); + if (len < 0) { + diag_printf("%s - can't read router message: %s\n", + __FUNCTION__, strerror(errno)); + } else { + diag_printf("%s - router message\n", __FUNCTION__); + diag_dump_buf(msg, len); + } + } + tv.tv_sec = CYGINT_NET_IPV6_ROUTING_THREAD_PERIOD - RTR_SOLICITATION_INTERVAL; + tv.tv_usec = 0; + select(0, 0, 0, 0, &tv); // Sleeps for tv + } +} + +void +ipv6_start_routing_thread(void) +{ + cyg_thread_create( + CYGINT_NET_IPV6_ROUTING_THREAD_PRIORITY, // Priority + cyg_rs, // entry + 0, // parameter + "IPv6 routing", // Name + &rs_stack[0], // Stack + STACK_SIZE, // Size + &rs_thread_handle, // Handle + &rs_thread_data // Thread data structure + ); + cyg_thread_resume(rs_thread_handle); // Start it + diag_printf("IPv6 routing thread started\n"); +} diff --git a/packages/net/common/current/src/network_support.c b/packages/net/common/current/src/network_support.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/network_support.c @@ -0,0 +1,437 @@ +//========================================================================== +// +// network_support.c +// +// Misc network support functions +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, sorin@netappi.com ("Sorin Babeanu"), hmt +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// BOOTP support + +#include +#undef _KERNEL +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include // for 'sprintf()' + +#include +#include +#include + +#ifdef CYGPKG_IO_PCMCIA +#include +#endif + +#ifdef CYGPKG_NET_DHCP +#include +#endif + +#ifdef CYGHWR_NET_DRIVER_ETH0 +struct bootp eth0_bootp_data; +cyg_bool_t eth0_up = false; +const char *eth0_name = "eth0"; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 +struct bootp eth1_bootp_data; +cyg_bool_t eth1_up = false; +const char *eth1_name = "eth1"; +#endif + +#define _string(s) #s +#define string(s) _string(s) + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#ifdef CYGPKG_NET_NLOOP +#if 0 < CYGPKG_NET_NLOOP +// +// Initialize loopback interface ---------- Added by sorin@netappi.com +// +cyg_bool_t init_loopback_interface(int lo) +{ + struct sockaddr_in *addrp; + struct ifreq ifr; + int s; + int one = 1; + struct ecos_rtentry route; + struct in_addr netmask, gateway; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + perror("socket"); + return false; + } + if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { + perror("setsockopt"); + return false; + } + + addrp = (struct sockaddr_in *) &ifr.ifr_addr; + memset(addrp, 0, sizeof(*addrp)); + addrp->sin_family = AF_INET; + addrp->sin_len = sizeof(*addrp); + addrp->sin_port = 0; + // Make an address 127.0..1 to manage multiple loopback ifs. + // (There is normally only 1, so it's the standard 127.0.0.1) + addrp->sin_addr.s_addr = htonl((0x100 * lo) + INADDR_LOOPBACK) ; + +#if CYGPKG_NET_NLOOP > 1 + // Init the one we were told to + sprintf(ifr.ifr_name, "lo%d", lo); +#else + strcpy(ifr.ifr_name, "lo0"); +#endif + + if (ioctl(s, SIOCSIFADDR, &ifr)) { + perror("SIOCIFADDR"); + return false; + } + +#if 1 < CYGPKG_NET_NLOOP + // We cheat to make different nets for multiple loopback devs + addrp->sin_addr.s_addr = netmask.s_addr = htonl(IN_CLASSC_NET); +#else + // + addrp->sin_addr.s_addr = netmask.s_addr = htonl(IN_CLASSA_NET); +#endif + if (ioctl(s, SIOCSIFNETMASK, &ifr)) { + perror("SIOCSIFNETMASK"); + return false; + } + ifr.ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; + if (ioctl(s, SIOCSIFFLAGS, &ifr)) { + perror("SIOCSIFFLAGS"); + return false; + } + + gateway.s_addr = htonl(INADDR_LOOPBACK); + memset(&route, 0, sizeof(route)); + addrp->sin_family = AF_INET; + addrp->sin_len = sizeof(*addrp); + addrp->sin_port = 0; + addrp->sin_addr.s_addr = htonl((0x100 * lo) + INADDR_LOOPBACK) & netmask.s_addr; + memcpy(&route.rt_dst, addrp, sizeof(*addrp)); + addrp->sin_addr = netmask; + memcpy(&route.rt_genmask, addrp, sizeof(*addrp)); + addrp->sin_addr = gateway; + memcpy(&route.rt_gateway, addrp, sizeof(*addrp)); + + route.rt_dev = ifr.ifr_name; + route.rt_flags = RTF_UP|RTF_GATEWAY; + route.rt_metric = 0; + + if (ioctl(s, SIOCADDRT, &route)) { + diag_printf("Route - dst: %s", inet_ntoa(((struct sockaddr_in *)&route.rt_dst)->sin_addr)); + diag_printf(", mask: %s", inet_ntoa(((struct sockaddr_in *)&route.rt_genmask)->sin_addr)); + diag_printf(", gateway: %s\n", inet_ntoa(((struct sockaddr_in *)&route.rt_gateway)->sin_addr)); + if (errno != EEXIST) { + perror("SIOCADDRT 3"); + return false; + } + } + close(s); + return true; +} +#endif +#endif + + +// +// Internal function which builds up a fake BOOTP database for +// an interface. +// + +static unsigned char * +add_tag(unsigned char *vp, + unsigned char tag, + void *val, + int len) +{ + int i; + unsigned char *xp = (unsigned char *)val; + *vp++ = tag; + *vp++ = len; + for (i = 0; i < len; i++) { + *vp++ = *xp++; + } + return vp; +} + +void +build_bootp_record(struct bootp *bp, + const char *if_name, + const char *addrs_ip, + const char *addrs_netmask, + const char *addrs_broadcast, + const char *addrs_gateway, + const char *addrs_server) +{ + int i, s; + in_addr_t addr; + unsigned char *vp; + unsigned char cookie[] = VM_RFC1048; + struct ifreq ifr; + + bzero(bp, sizeof(struct bootp)); + bp->bp_op = BOOTREPLY; + bp->bp_htype = HTYPE_ETHERNET; + bp->bp_hlen = 6; + + // Query the hardware address + for (i = 0; i < bp->bp_hlen; i++) { + bp->bp_chaddr[i] = 0xFF; // Unknown + } + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s >= 0) { + strcpy(ifr.ifr_name, if_name); + if (ioctl(s, SIOCGIFHWADDR, &ifr) >= 0) { + bcopy(ifr.ifr_hwaddr.sa_data, bp->bp_chaddr, bp->bp_hlen); + } + close(s); + } + + // Fill in the provided IP addresses + bp->bp_ciaddr.s_addr = inet_addr(addrs_ip); + bp->bp_yiaddr.s_addr = inet_addr(addrs_ip); + bp->bp_siaddr.s_addr = inet_addr(addrs_server); + bp->bp_giaddr.s_addr = inet_addr(addrs_gateway); + vp = &bp->bp_vend[0]; + bcopy(&cookie, vp, sizeof(cookie)); + vp += sizeof(cookie); + addr = inet_addr(addrs_netmask); + vp = add_tag(vp, TAG_SUBNET_MASK, &addr, sizeof(in_addr_t)); + addr = inet_addr(addrs_broadcast); + vp = add_tag(vp, TAG_IP_BROADCAST, &addr, sizeof(in_addr_t)); + addr = inet_addr(addrs_gateway); + vp = add_tag(vp, TAG_GATEWAY, &addr, sizeof(in_addr_t)); + *vp = TAG_END; +} + + +// +// Initialize network interface[s] using BOOTP/DHCP +// +void +init_all_network_interfaces(void) +{ + static volatile int in_init_all_network_interfaces = 0; +#ifdef CYGPKG_IO_PCMCIA + cyg_netdevtab_entry_t *t; +#endif // CYGPKG_IO_PCMCIA + + cyg_scheduler_lock(); + while ( in_init_all_network_interfaces ) { + // Another thread is doing this... + cyg_scheduler_unlock(); + cyg_thread_delay( 10 ); + cyg_scheduler_lock(); + } + in_init_all_network_interfaces = 1; + cyg_scheduler_unlock(); + +#ifdef CYGHWR_NET_DRIVER_ETH0 + if ( ! eth0_up ) { // Make this call idempotent +#ifdef CYGPKG_IO_PCMCIA + if ((t = eth_drv_netdev("eth0")) != (cyg_netdevtab_entry_t *)NULL) { + int tries = 0; + while (t->status != CYG_NETDEVTAB_STATUS_AVAIL) { + if (tries == 0) { + diag_printf("... Waiting for PCMCIA device 'eth0'\n"); + } + if (++tries == 5) { + diag_printf("... Giving up on PCMCIA device 'eth0'\n"); + goto bail_eth0; + } + cyg_thread_delay(100); + } + } +#endif // CYGPKG_IO_PCMCIA +#ifdef CYGHWR_NET_DRIVER_ETH0_BOOTP + // Perform a complete initialization, using BOOTP/DHCP + eth0_up = true; +#ifdef CYGHWR_NET_DRIVER_ETH0_DHCP + eth0_dhcpstate = 0; // Says that initialization is external to dhcp + if (do_dhcp(eth0_name, ð0_bootp_data, ð0_dhcpstate, ð0_lease)) +#else +#ifdef CYGPKG_NET_DHCP + eth0_dhcpstate = DHCPSTATE_BOOTP_FALLBACK; + // so the dhcp machine does no harm if called +#endif + if (do_bootp(eth0_name, ð0_bootp_data)) +#endif + { +#ifdef CYGHWR_NET_DRIVER_ETH0_BOOTP_SHOW + show_bootp(eth0_name, ð0_bootp_data); +#endif + } else { + diag_printf("BOOTP/DHCP failed on eth0\n"); + eth0_up = false; + } +#elif defined(CYGHWR_NET_DRIVER_ETH0_ADDRS_IP) + eth0_up = true; + build_bootp_record(ð0_bootp_data, + eth0_name, + string(CYGHWR_NET_DRIVER_ETH0_ADDRS_IP), + string(CYGHWR_NET_DRIVER_ETH0_ADDRS_NETMASK), + string(CYGHWR_NET_DRIVER_ETH0_ADDRS_BROADCAST), + string(CYGHWR_NET_DRIVER_ETH0_ADDRS_GATEWAY), + string(CYGHWR_NET_DRIVER_ETH0_ADDRS_SERVER)); + show_bootp(eth0_name, ð0_bootp_data); +#endif +#ifdef CYGPKG_IO_PCMCIA + bail_eth0: +#endif + } +#endif // CYGHWR_NET_DRIVER_ETH0 +#ifdef CYGHWR_NET_DRIVER_ETH1 + if ( ! eth1_up ) { // Make this call idempotent +#ifdef CYGPKG_IO_PCMCIA + if ((t = eth_drv_netdev("eth1")) != (cyg_netdevtab_entry_t *)NULL) { + int tries = 0; + while (t->status != CYG_NETDEVTAB_STATUS_AVAIL) { + if (tries == 0) { + diag_printf("... Waiting for PCMCIA device 'eth1'\n"); + } + if (++tries == 5) { + diag_printf("... Giving up on PCMCIA device 'eth1'\n"); + goto bail_eth1; + } + cyg_thread_delay(100); + } + } +#endif // CYGPKG_IO_PCMCIA +#ifdef CYGHWR_NET_DRIVER_ETH1_BOOTP + // Perform a complete initialization, using BOOTP/DHCP + eth1_up = true; +#ifdef CYGHWR_NET_DRIVER_ETH1_DHCP + eth1_dhcpstate = 0; // Says that initialization is external to dhcp + if (do_dhcp(eth1_name, ð1_bootp_data, ð1_dhcpstate, ð1_lease)) +#else +#ifdef CYGPKG_NET_DHCP + eth1_dhcpstate = DHCPSTATE_BOOTP_FALLBACK; + // so the dhcp machine does no harm if called +#endif + if (do_bootp(eth1_name, ð1_bootp_data)) +#endif + { +#ifdef CYGHWR_NET_DRIVER_ETH1_BOOTP_SHOW + show_bootp(eth1_name, ð1_bootp_data); +#endif + } else { + diag_printf("BOOTP/DHCP failed on eth1\n"); + eth1_up = false; + } +#elif defined(CYGHWR_NET_DRIVER_ETH1_ADDRS_IP) + eth1_up = true; + build_bootp_record(ð1_bootp_data, + eth1_name, + string(CYGHWR_NET_DRIVER_ETH1_ADDRS_IP), + string(CYGHWR_NET_DRIVER_ETH1_ADDRS_NETMASK), + string(CYGHWR_NET_DRIVER_ETH1_ADDRS_BROADCAST), + string(CYGHWR_NET_DRIVER_ETH1_ADDRS_GATEWAY), + string(CYGHWR_NET_DRIVER_ETH1_ADDRS_SERVER)); + show_bootp(eth1_name, ð1_bootp_data); +#endif +#ifdef CYGPKG_IO_PCMCIA + bail_eth1: +#endif + } +#endif // CYGHWR_NET_DRIVER_ETH1 +#ifdef CYGHWR_NET_DRIVER_ETH0 +#ifndef CYGHWR_NET_DRIVER_ETH0_MANUAL + if (eth0_up) { + if (!init_net(eth0_name, ð0_bootp_data)) { + diag_printf("Network initialization failed for eth0\n"); + eth0_up = false; + } +#ifdef CYGHWR_NET_DRIVER_ETH0_IPV6_PREFIX + if (!init_net_IPv6(eth0_name, ð0_bootp_data, + string(CYGHWR_NET_DRIVER_ETH0_IPV6_PREFIX))) { + diag_printf("Static IPv6 network initialization failed for eth0\n"); + eth0_up = false; // ??? + } +#endif + } +#endif +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 +#ifndef CYGHWR_NET_DRIVER_ETH1_MANUAL + if (eth1_up) { + if (!init_net(eth1_name, ð1_bootp_data)) { + diag_printf("Network initialization failed for eth1\n"); + eth1_up = false; + } +#ifdef CYGHWR_NET_DRIVER_ETH1_IPV6_PREFIX + if (!init_net_IPv6(eth1_name, ð1_bootp_data, + string(CYGHWR_NET_DRIVER_ETH1_IPV6_PREFIX))) { + diag_printf("Static IPv6 network initialization failed for eth1\n"); + eth1_up = false; // ??? + } +#endif + } +#endif +#endif + +#ifdef CYGPKG_NET_NLOOP +#if 0 < CYGPKG_NET_NLOOP + { + static int loop_init = 0; + int i; + if ( 0 == loop_init++ ) + for ( i = 0; i < CYGPKG_NET_NLOOP; i++ ) + init_loopback_interface( i ); + } +#endif +#endif + +#ifdef CYGOPT_NET_DHCP_DHCP_THREAD + dhcp_start_dhcp_mgt_thread(); +#endif + +#ifdef CYGOPT_NET_IPV6_ROUTING_THREAD + ipv6_start_routing_thread(); +#endif + + // Open the monitor to other threads. + in_init_all_network_interfaces = 0; + +} + +// EOF network_support.c diff --git a/packages/net/common/current/src/tftp_client.c b/packages/net/common/current/src/tftp_client.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/tftp_client.c @@ -0,0 +1,402 @@ +//========================================================================== +// +// lib/tftp_client.c +// +// TFTP client support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-04-06 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// TFTP client support + +#include +#include +#include + +#define min(x,y) (xth_opcode = htons(RRQ); // Read file + cp = (char *)&hdr->th_stuff; + fp = filename; + while (*fp) *cp++ = *fp++; + *cp++ = '\0'; + if (mode == TFTP_NETASCII) { + fp = "NETASCII"; + } else if (mode == TFTP_OCTET) { + fp = "OCTET"; + } else { + *err = TFTP_INVALID; + return -1; + } + while (*fp) *cp++ = *fp++; + *cp++ = '\0'; + server_info = getservbyname("tftp", "udp"); + if (server_info == (struct servent *)0) { + *err = TFTP_NETERR; + return -1; + } + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + // Couldn't open a communications channel + *err = TFTP_NETERR; + return -1; + } + memset((char *)&local_addr, 0, sizeof(local_addr)); + local_addr.sin_family = AF_INET; + local_addr.sin_len = sizeof(local_addr); + local_addr.sin_addr.s_addr = htonl(INADDR_ANY); + local_addr.sin_port = htons(get_port++); + if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) { + // Problem setting up my end + *err = TFTP_NETERR; + close(s); + return -1; + } + memset((char *)&server_addr, 0, sizeof(server_addr)); + server_addr.sin_family = AF_INET; + server_addr.sin_len = sizeof(server_addr); + server_addr.sin_addr = server->sin_addr; + if (server->sin_port == 0) { + server_addr.sin_port = server_info->s_port; // Network order already + } else { + server_addr.sin_port = server->sin_port; + } + + // Send request + if (sendto(s, data, sizeof(data), 0, + (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { + // Problem sending request + *err = TFTP_NETERR; + close(s); + return -1; + } + + // Read data + fp = buf; + while (true) { + timeout.tv_sec = TFTP_TIMEOUT_PERIOD; + timeout.tv_usec = 0; + FD_ZERO(&fds); + FD_SET(s, &fds); + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + if ((++total_timeouts > TFTP_TIMEOUT_MAX) || (last_good_block == 0)) { + // Timeout - no data received + *err = TFTP_TIMEOUT; + close(s); + return -1; + } + // Try resending last ACK + hdr->th_opcode = htons(ACK); + hdr->th_block = htons(last_good_block); + if (sendto(s, data, 4 /* FIXME */, 0, + (struct sockaddr *)&from_addr, from_len) < 0) { + // Problem sending request + *err = TFTP_NETERR; + close(s); + return -1; + } + } else { + recv_len = sizeof(data); + from_len = sizeof(from_addr); + if ((data_len = recvfrom(s, &data, recv_len, 0, + (struct sockaddr *)&from_addr, &from_len)) < 0) { + // What happened? + *err = TFTP_NETERR; + close(s); + return -1; + } + if (ntohs(hdr->th_opcode) == DATA) { + actual_len = 0; + if (ntohs(hdr->th_block) == (last_good_block+1)) { + // Consume this data + cp = hdr->th_data; + data_len -= 4; /* Sizeof TFTP header */ + actual_len = data_len; + res += actual_len; + while (data_len-- > 0) { + if (len-- > 0) { + *fp++ = *cp++; + } else { + // Buffer overflow + *err = TFTP_TOOLARGE; + close(s); + return -1; + } + } + last_good_block++; + } + // Send out the ACK + hdr->th_opcode = htons(ACK); + hdr->th_block = htons(last_good_block); + if (sendto(s, data, 4 /* FIXME */, 0, + (struct sockaddr *)&from_addr, from_len) < 0) { + // Problem sending request + *err = TFTP_NETERR; + close(s); + return -1; + } + if ((actual_len >= 0) && (actual_len < SEGSIZE)) { + // End of data + close(s); + return res; + } + } else + if (ntohs(hdr->th_opcode) == ERROR) { + *err = ntohs(hdr->th_code); + close(s); + return -1; + } else { + // What kind of packet is this? + *err = TFTP_PROTOCOL; + close(s); + return -1; + } + } + } +} + +// +// Send data to a file on a server via TFTP. +// +int +tftp_put(char *filename, + struct sockaddr_in *server, + char *buf, + int len, + int mode, + int *err) +{ + int res = 0; + int s, actual_len, data_len, recv_len, from_len; + static int put_port = 7800; + struct sockaddr_in local_addr, server_addr, from_addr; + char data[SEGSIZE+sizeof(struct tftphdr)]; + struct tftphdr *hdr = (struct tftphdr *)data; + char *cp, *fp, *sfp; + struct timeval timeout; + int last_good_block = 0; + struct servent *server_info; + fd_set fds; + int total_timeouts = 0; + + *err = 0; // Just in case + + server_info = getservbyname("tftp", "udp"); + if (server_info == (struct servent *)0) { + *err = TFTP_NETERR; + return -1; + } + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + // Couldn't open a communications channel + *err = TFTP_NETERR; + return -1; + } + memset((char *)&local_addr, 0, sizeof(local_addr)); + local_addr.sin_family = AF_INET; + local_addr.sin_len = sizeof(local_addr); + local_addr.sin_addr.s_addr = htonl(INADDR_ANY); + local_addr.sin_port = htons(put_port++); + if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) { + // Problem setting up my end + *err = TFTP_NETERR; + close(s); + return -1; + } + memset((char *)&server_addr, 0, sizeof(server_addr)); + server_addr.sin_family = AF_INET; + server_addr.sin_len = sizeof(server_addr); + server_addr.sin_addr = server->sin_addr; + if (server->sin_port == 0) { + server_addr.sin_port = server_info->s_port; // Network order already + } else { + server_addr.sin_port = server->sin_port; + } + + while (1) { + // Create initial request + hdr->th_opcode = htons(WRQ); // Create/write file + cp = (char *)&hdr->th_stuff; + fp = filename; + while (*fp) *cp++ = *fp++; + *cp++ = '\0'; + if (mode == TFTP_NETASCII) { + fp = "NETASCII"; + } else if (mode == TFTP_OCTET) { + fp = "OCTET"; + } else { + *err = TFTP_INVALID; + return -1; + } + while (*fp) *cp++ = *fp++; + *cp++ = '\0'; + // Send request + if (sendto(s, data, sizeof(data), 0, + (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { + // Problem sending request + *err = TFTP_NETERR; + close(s); + return -1; + } + // Wait for ACK + timeout.tv_sec = TFTP_TIMEOUT_PERIOD; + timeout.tv_usec = 0; + FD_ZERO(&fds); + FD_SET(s, &fds); + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + if (++total_timeouts > TFTP_TIMEOUT_MAX) { + // Timeout - no ACK received + *err = TFTP_TIMEOUT; + close(s); + return -1; + } + } else { + recv_len = sizeof(data); + from_len = sizeof(from_addr); + if ((data_len = recvfrom(s, &data, recv_len, 0, + (struct sockaddr *)&from_addr, &from_len)) < 0) { + // What happened? + *err = TFTP_NETERR; + close(s); + return -1; + } + if (ntohs(hdr->th_opcode) == ACK) { + // Write request accepted - start sending data + break; + } else + if (ntohs(hdr->th_opcode) == ERROR) { + *err = ntohs(hdr->th_code); + close(s); + return -1; + } else { + // What kind of packet is this? + *err = TFTP_PROTOCOL; + close(s); + return -1; + } + } + } + + // Send data + sfp = buf; + last_good_block = 1; + while (res < len) { + // Build packet of data to send + data_len = min(SEGSIZE, len-res); + hdr->th_opcode = htons(DATA); + hdr->th_block = htons(last_good_block); + cp = hdr->th_data; + fp = sfp; + actual_len = data_len + 4; + // FIXME - what about "netascii" data? + while (data_len-- > 0) *cp++ = *fp++; + // Send data packet + if (sendto(s, data, actual_len, 0, + (struct sockaddr *)&from_addr, from_len) < 0) { + // Problem sending request + *err = TFTP_NETERR; + close(s); + return -1; + } + // Wait for ACK + timeout.tv_sec = TFTP_TIMEOUT_PERIOD; + timeout.tv_usec = 0; + FD_ZERO(&fds); + FD_SET(s, &fds); + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + if (++total_timeouts > TFTP_TIMEOUT_MAX) { + // Timeout - no data received + *err = TFTP_TIMEOUT; + close(s); + return -1; + } + } else { + recv_len = sizeof(data); + from_len = sizeof(from_addr); + if ((data_len = recvfrom(s, &data, recv_len, 0, + (struct sockaddr *)&from_addr, &from_len)) < 0) { + // What happened? + *err = TFTP_NETERR; + close(s); + return -1; + } + if (ntohs(hdr->th_opcode) == ACK) { + if (ntohs(hdr->th_block) == last_good_block) { + // Advance pointers, etc + sfp = fp; + res += (actual_len - 4); + last_good_block++; + } else { + diag_printf("Send block #%d, got ACK for #%d\n", + last_good_block, ntohs(hdr->th_block)); + } + } else + if (ntohs(hdr->th_opcode) == ERROR) { + *err = ntohs(hdr->th_code); + close(s); + return -1; + } else { + // What kind of packet is this? + *err = TFTP_PROTOCOL; + close(s); + return -1; + } + } + } + close(s); + return res; +} + diff --git a/packages/net/common/current/src/tftp_dummy_file.c b/packages/net/common/current/src/tftp_dummy_file.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/tftp_dummy_file.c @@ -0,0 +1,198 @@ +//========================================================================== +// +// lib/tftp_dummy_file.c +// +// Dummy [in memory] file I/O functions +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-04-06 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// TFTP file support - minimal "dummy" version + +#include +#include + +static int dummy_open(const char *, int); +static int dummy_close(int); +static int dummy_write(int, const void *, int); +static int dummy_read(int, void *, int); + +struct tftpd_fileops dummy_fileops = { + dummy_open, dummy_close, dummy_write, dummy_read +}; + +struct _file_info; +struct _file { + unsigned char *pos, *eof; + int flags; + int mode; + struct _file_info *file; +}; +#define FILE_OPEN 0x0001 + +#define NUM_FILES 8 +static struct _file files[NUM_FILES]; + +struct _file_info { + char *name; + unsigned char *data; + int length, size; +}; + +// TEMP +static char _uu_data[] = "This is a test\n\ +Four score and seven years ago,\n\ +our forefathers brought forth a new nation,\n\ +conceived in liberty and dedicated to the\n\ +proposition that all men are created equal.\n\ +Now we are engaged in a great civil war, testing\n\ +whether that nation, or any nation so conceived\n\ +and so dedicated, can long endure.\n\ +1111111111111111111111111111111111\n\ +2222222222222222222222222222222222\n\ +3333333333333333333333333333333333\n\ +4444444444444444444444444444444444\n\ +5555555555555555555555555555555555\n\ +6666666666666666666666666666666666\n\ +"; + +static char _f0_data[1024*1024]; +static char _f1_data[1024*1024]; +static char _f2_data[1024*1024]; + +static char _name0[256] = "", _name1[256] = "", _name2[256] = ""; + +static struct _file_info file_list[] = { + { "uu", _uu_data, sizeof(_uu_data)-1, sizeof(_uu_data)-1}, + { _name0, _f0_data, 0, sizeof(_f0_data)}, // Empty file + { _name1, _f1_data, 0, sizeof(_f1_data)}, // Empty file + { _name2, _f2_data, 0, sizeof(_f2_data)}, // Empty file + { 0, 0, 0} // End of list +}; + +static inline struct _file * +dummy_fp(int fd) +{ + struct _file *fp; + if ((fd < 0) || (fd >= NUM_FILES)) return (struct _file *)0; + fp = &files[fd]; + if (!(fp->flags & FILE_OPEN)) return (struct _file *)0; + return fp; +} + +static int +dummy_open(const char *fn, int flags) +{ + int res = -1; + int fd; + struct _file *fp; + struct _file_info *fi; + + fp = files; + for (fd = 0; fd < NUM_FILES; fd++, fp++) { + if (!(fp->flags & FILE_OPEN)) break; + } + if (fd == NUM_FILES) { + return -1; // No free files + } + if (flags & O_RDONLY) { + // Search for an extant file + fi = file_list; + while (fi->name) { + if (strcmp(fi->name, fn) == 0) { + // Found it! + fp->pos = fi->data; + fp->eof = fi->data + fi->length; + fp->flags = FILE_OPEN; + fp->mode = flags; + return fd; + } + fi++; + } + } else { + // Search for a non-existant file + fi = file_list; + while (fi->name) { + if (fi->name[0] == '\0' || strcmp(fi->name, fn) == 0) { + if ( !fi->name[0] ) + // Empty slot found + strcpy(fi->name, fn); + fp->pos = fi->data; + fp->eof = fi->data + fi->size; + fp->file = fi; // So we can update file info later + fp->mode = flags; + fp->flags = FILE_OPEN; + return fd; + } + fi++; + } + } + // No such file + return res; +} + +static int +dummy_close(int fd) +{ + struct _file *fp = dummy_fp(fd); + if (!fp) return -1; + if (fp->mode & O_WRONLY) { + // Clean up - update file info for later + fp->file->length = fp->pos - fp->file->data; + } + fp->flags = 0; // No longer open + return 0; +} + +static int +dummy_write(int fd, const void *buf, int len) +{ + struct _file *fp = dummy_fp(fd); + int res; + if (!fp) return -1; + res = fp->eof - fp->pos; // Space left in file + if (res <= 0) return 0; // End of file + if (res > len) res = len; + bcopy(buf, fp->pos, res); + fp->pos += res; + return res; +} + +static int +dummy_read(int fd, void *buf, int len) +{ + struct _file *fp = dummy_fp(fd); + int res; + if (!fp) return -1; + res = fp->eof - fp->pos; // Number of bytes left in "file" + if (res > len) res = len; + if (res <= 0) return 0; // End of file + bcopy(fp->pos, buf, res); + fp->pos += res; + return res; +} + + +// EOF tftp_dummy_file.c diff --git a/packages/net/common/current/src/tftp_server.c b/packages/net/common/current/src/tftp_server.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/src/tftp_server.c @@ -0,0 +1,586 @@ +//========================================================================== +// +// lib/tftp_server.c +// +// TFTP server support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas, hmt, andrew.lunn@ascom.ch (Andrew Lunn) +// Date: 2000-04-06 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// TFTP server support + +#include // Basic networking support +#include // TFTP protocol definitions +#include // TFTPD structures +#include +#include // For malloc + +#define nCYGOPT_NET_TFTP_SERVER_INSTRUMENT +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + +struct subinfo { + int rx; + int rx_repeat; + int rx_skip; + int send; + int resend; +}; + +struct info { + struct subinfo ack, data; + int err_send; + int total_transactions; +}; + + +static struct info tftp_server_instrument = { + { 0,0,0,0,0 }, + { 0,0,0,0,0 }, + 0, 0, +}; + +#endif // CYGOPT_NET_TFTP_SERVER_INSTRUMENT + +#define STACK_SIZE (((CYGNUM_HAL_STACK_SIZE_TYPICAL+(3*(SEGSIZE+sizeof(struct tftphdr)))) + CYGARC_ALIGNMENT-1) & ~(CYGARC_ALIGNMENT-1)) +static char *TFTP_tag = "TFTPD"; +struct tftp_server { + char *tag; + char stack[STACK_SIZE]; + cyg_thread thread_data; + cyg_handle_t thread_handle; + int port; + struct tftpd_fileops *ops; +}; + +static char * errmsg[] = { + "Undefined error code", // 0 nothing defined + "File not found", // 1 TFTP_ENOTFOUND + "Access violation", // 2 TFTP_EACCESS + "Disk full or allocation exceeded", // 3 TFTP_ENOSPACE + "Illegal TFTP operation", // 4 TFTP_EBADOP + "Unknown transfer ID", // 5 TFTP_EBADID + "File already exists", // 6 TFTP_EEXISTS + "No such user", // 7 TFTP_ENOUSER +}; + +/* Send an error packet to the client */ +static void +tftpd_send_error(int s, struct tftphdr * reply, int err, + struct sockaddr_in *from_addr, int from_len) +{ + CYG_ASSERT( 0 <= err, "err underflow" ); + CYG_ASSERT( sizeof(errmsg)/sizeof(errmsg[0]) > err, "err overflow" ); + + reply->th_opcode = htons(ERROR); + reply->th_code = htons(err); + if ( (0 > err) || (sizeof(errmsg)/sizeof(errmsg[0]) <= err) ) + err = 0; // Do not copy a random string from hyperspace + strcpy(reply->th_msg, errmsg[err]); + sendto(s, reply, 4+strlen(reply->th_msg)+1, 0, + (struct sockaddr *)from_addr, from_len); +} + +// +// Receive a file from the client +// +static void +tftpd_write_file(struct tftp_server *server, + struct tftphdr *hdr, + struct sockaddr_in *from_addr, int from_len) +{ + char data_out[SEGSIZE+sizeof(struct tftphdr)]; + char data_in[SEGSIZE+sizeof(struct tftphdr)]; + struct tftphdr *reply = (struct tftphdr *)data_out; + struct tftphdr *response = (struct tftphdr *)data_in; + int fd, block, len, ok, tries, closed, data_len, s; + struct timeval timeout; + fd_set fds; + int total_timeouts = 0; + struct sockaddr_in client_addr, local_addr; + int client_len; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + diag_printf("TFTPD: can't open socket for 'write_file'\n"); + return; + } + memset((char *)&local_addr, 0, sizeof(local_addr)); + local_addr.sin_family = AF_INET; + local_addr.sin_len = sizeof(local_addr); + local_addr.sin_addr.s_addr = htonl(INADDR_ANY); + local_addr.sin_port = htons(INADDR_ANY); + if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) { + // Problem setting up my end + diag_printf("TFTPD: can't bind to reply port for 'write_file'\n"); + close(s); + return; + } + if ((fd = (server->ops->open)(hdr->th_stuff, O_WRONLY)) < 0) { + tftpd_send_error(s,reply,TFTP_ENOTFOUND,from_addr, from_len); + close(s); + return; + } + ok = true; + closed = false; + block = 0; + while (ok) { + // Send ACK telling client he can send data + reply->th_opcode = htons(ACK); + reply->th_block = htons(block++); // postincrement + for (tries = 0; tries < TFTP_RETRIES_MAX; tries++) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.ack.send++; +#endif + sendto(s, reply, 4, 0, (struct sockaddr *)from_addr, from_len); + repeat_select: + timeout.tv_sec = TFTP_TIMEOUT_PERIOD; + timeout.tv_usec = 0; + FD_ZERO(&fds); + FD_SET(s, &fds); + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + if (++total_timeouts > TFTP_TIMEOUT_MAX) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.err_send++; +#endif + tftpd_send_error(s,reply,TFTP_EBADOP,from_addr, from_len); + ok = false; + break; + } +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.ack.resend++; +#endif + continue; // retry the send, using up one retry. + } + // Some data has arrived + data_len = sizeof(data_in); + client_len = sizeof(client_addr); + if ((data_len = recvfrom(s, data_in, data_len, 0, + (struct sockaddr *)&client_addr, &client_len)) < 0) { + // What happened? No data here! +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.ack.resend++; +#endif + continue; // retry the send, using up one retry. + } + if (ntohs(response->th_opcode) == DATA && + ntohs(response->th_block) < block) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.data.rx_repeat++; +#endif + // Then it is repeat DATA with an old block; listen again, + // but do not repeat sending the current ack, and do not + // use up a retry count. (we do re-send the ack if + // subsequently we time out) + goto repeat_select; + } + if (ntohs(response->th_opcode) == DATA && + ntohs(response->th_block) == block) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.data.rx++; +#endif + // Good data - write to file + len = (server->ops->write)(fd, response->th_data, data_len-4); + if (len < (data_len-4)) { + // File is "full" + tftpd_send_error(s,reply,TFTP_ENOSPACE, + from_addr, from_len); + ok = false; // Give up + break; // out of the retries loop + } + if (data_len < (SEGSIZE+4)) { + // End of file + closed = true; + ok = false; + if ((server->ops->close)(fd) == -1) { + tftpd_send_error(s,reply,TFTP_EACCESS, + from_addr, from_len); + break; // out of the retries loop + } + // Exception to the loop structure: we must ACK the last + // packet, the one that implied EOF: +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.ack.send++; +#endif + reply->th_opcode = htons(ACK); + reply->th_block = htons(block++); // postincrement + sendto(s, reply, 4, 0, (struct sockaddr *)from_addr, from_len); + break; // out of the retries loop + } + // Happy! Break out of the retries loop. + break; + } + // Otherwise, we got something we do not understand! So repeat + // sending the current ACK, and use up a retry count. +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + if ( (ntohs(response->th_opcode) == DATA) ) + tftp_server_instrument.data.rx_skip++; + tftp_server_instrument.ack.resend++; +#endif + } // End of the retries loop. + if (TFTP_RETRIES_MAX <= tries) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.err_send++; +#endif + tftpd_send_error(s,reply,TFTP_EBADOP,from_addr, from_len); + ok = false; + } + } + close(s); + if (!closed) { + (server->ops->close)(fd); + } +} + +// +// Send a file to the client +// +static void +tftpd_read_file(struct tftp_server *server, + struct tftphdr *hdr, + struct sockaddr_in *from_addr, int from_len) +{ + char data_out[SEGSIZE+sizeof(struct tftphdr)]; + char data_in[SEGSIZE+sizeof(struct tftphdr)]; + struct tftphdr *reply = (struct tftphdr *)data_out; + struct tftphdr *response = (struct tftphdr *)data_in; + int fd, block, len, tries, ok, data_len, s; + struct timeval timeout; + fd_set fds; + int total_timeouts = 0; + struct sockaddr_in client_addr, local_addr; + int client_len; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + diag_printf("TFTPD: can't open socket for 'read_file'\n"); + return; + } + memset((char *)&local_addr, 0, sizeof(local_addr)); + local_addr.sin_family = AF_INET; + local_addr.sin_len = sizeof(local_addr); + local_addr.sin_addr.s_addr = htonl(INADDR_ANY); + local_addr.sin_port = htons(INADDR_ANY); + if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) { + // Problem setting up my end + diag_printf("TFTPD: can't bind to reply port for 'read_file'\n"); + close(s); + return; + } + if ((fd = (server->ops->open)(hdr->th_stuff, O_RDONLY)) < 0) { + tftpd_send_error(s,reply,TFTP_ENOTFOUND,from_addr, from_len); + close(s); + return; + } + block = 0; + ok = true; + while (ok) { + // Read next chunk of file + len = (server->ops->read)(fd, reply->th_data, SEGSIZE); + reply->th_block = htons(++block); // preincrement + reply->th_opcode = htons(DATA); + for (tries = 0; tries < TFTP_RETRIES_MAX; tries++) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.data.send++; +#endif + if (sendto(s, reply, 4+len, 0, + (struct sockaddr *)from_addr, from_len) < 0) { + // Something went wrong with the network! + ok = false; + break; + } + repeat_select: + timeout.tv_sec = TFTP_TIMEOUT_PERIOD; + timeout.tv_usec = 0; + FD_ZERO(&fds); + FD_SET(s, &fds); + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + if (++total_timeouts > TFTP_TIMEOUT_MAX) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.err_send++; +#endif + tftpd_send_error(s,reply,TFTP_EBADOP,from_addr, from_len); + ok = false; + break; + } +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.data.resend++; +#endif + continue; // retry the send, using up one retry. + } + data_len = sizeof(data_in); + client_len = sizeof(client_addr); + if ((data_len = recvfrom(s, data_in, data_len, 0, + (struct sockaddr *)&client_addr, + &client_len)) < 0) { + // What happened? Maybe someone lied to us... +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.data.resend++; +#endif + continue; // retry the send, using up one retry. + } + if ((ntohs(response->th_opcode) == ACK) && + (ntohs(response->th_block) < block)) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.ack.rx_repeat++; +#endif + // Then it is a repeat ACK for an old block; listen again, + // but do not repeat sending the current block, and do not + // use up a retry count. (we do re-send the data if + // subsequently we time out) + goto repeat_select; + } + if ((ntohs(response->th_opcode) == ACK) && + (ntohs(response->th_block) == block)) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.ack.rx++; +#endif + // Happy! Break out of the retries loop. + break; + } + // Otherwise, we got something we do not understand! So repeat + // sending the current block, and use up a retry count. +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + if ( (ntohs(response->th_opcode) == ACK) ) + tftp_server_instrument.ack.rx_skip++; + tftp_server_instrument.data.resend++; +#endif + } // End of the retries loop. + if (TFTP_RETRIES_MAX <= tries) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.err_send++; +#endif + tftpd_send_error(s,reply,TFTP_EBADOP,from_addr, from_len); + ok = false; + } + if (len < SEGSIZE) { + break; // That's end of file then. + } + } + close(s); + (server->ops->close)(fd); +} + +// +// Actual TFTP server +// +#define CYGSEM_TFTP_SERVER_MULTITHREADED +#ifdef CYGSEM_TFTP_SERVER_MULTITHREADED +static cyg_sem_t tftp_server_sem; +#endif + +static void +tftpd_server(cyg_addrword_t p) +{ + struct tftp_server *server = (struct tftp_server *)p; + int s; + int data_len, recv_len, from_len; + struct sockaddr_in local_addr, from_addr; + struct servent *server_info; + char data[SEGSIZE+sizeof(struct tftphdr)]; + struct tftphdr *hdr = (struct tftphdr *)data; + +#ifndef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS + // Otherwise routine printfs fail the test - interrupts disabled too long. + diag_printf("TFTPD [%x]: port %d\n", p, server->port); +#endif + + // Set up port + if (server->port == 0) { + server_info = getservbyname("tftp", "udp"); + if (server_info == (struct servent *)0) { + diag_printf("TFTPD: can't get TFTP service information\n"); + return; + } + // Network order in info; host order in server: + server->port = ntohs( server_info->s_port ); + } + + while (true) { +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + struct info o = tftp_server_instrument; +#endif + // Create socket + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + diag_printf("TFTPD [%x]: can't open socket\n", p); + return; + } + memset((char *)&local_addr, 0, sizeof(local_addr)); + local_addr.sin_family = AF_INET; + local_addr.sin_len = sizeof(local_addr); + local_addr.sin_addr.s_addr = htonl(INADDR_ANY); + local_addr.sin_port = htons(server->port); + if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) { + // Problem setting up my end + close(s); +#ifdef CYGSEM_TFTP_SERVER_MULTITHREADED +#ifndef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS + diag_printf("TFTPD [%x]: waiting to bind to service port\n", p); +#endif + // Wait until the socket is free... + cyg_semaphore_wait( &tftp_server_sem ); + continue; // try re-opening and rebinding the socket. +#else + diag_printf("TFTPD [%x]: can't bind to service port\n", p); + return; +#endif + } + + recv_len = sizeof(data); + from_len = sizeof(from_addr); + data_len = recvfrom(s, hdr, recv_len, 0, + (struct sockaddr *)&from_addr, &from_len); + close(s); // so that other servers can bind to the TFTP socket +#ifdef CYGSEM_TFTP_SERVER_MULTITHREADED + // The socket is free... + cyg_semaphore_post( &tftp_server_sem ); +#endif + + if ( data_len < 0) { + diag_printf("TFTPD [%x]: can't read request\n", p); + } else { +#ifndef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS + diag_printf("TFTPD [%x]: received %x from %s:%d\n", p, + ntohs(hdr->th_opcode), inet_ntoa(from_addr.sin_addr), + from_addr.sin_port); +#endif + switch (ntohs(hdr->th_opcode)) { + case WRQ: + tftpd_write_file(server, hdr, &from_addr, from_len); + break; + case RRQ: + tftpd_read_file(server, hdr, &from_addr, from_len); + break; + case ACK: + case DATA: + case ERROR: + // Ignore + break; + default: + diag_printf("TFTPD [%x]: bogus request %x from %s:%d\n", p, + ntohs(hdr->th_opcode), + inet_ntoa(from_addr.sin_addr), + from_addr.sin_port ); + tftpd_send_error(s,hdr,TFTP_EBADOP,&from_addr,from_len); + } + } +#ifdef CYGOPT_NET_TFTP_SERVER_INSTRUMENT + tftp_server_instrument.total_transactions++; + + o.data.rx -= tftp_server_instrument.data.rx ; + o.data.rx_repeat -= tftp_server_instrument.data.rx_repeat; + o.data.rx_skip -= tftp_server_instrument.data.rx_skip ; + o.data.send -= tftp_server_instrument.data.send ; + o.data.resend -= tftp_server_instrument.data.resend ; + + o.ack.rx -= tftp_server_instrument.ack.rx ; + o.ack.rx_repeat -= tftp_server_instrument.ack.rx_repeat ; + o.ack.rx_skip -= tftp_server_instrument.ack.rx_skip ; + o.ack.send -= tftp_server_instrument.ack.send ; + o.ack.resend -= tftp_server_instrument.ack.resend ; + + o.err_send -= tftp_server_instrument.err_send ; + +#ifndef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS + if ( o.data.rx ) diag_printf( "data rx %4d\n", -o.data.rx ); + if ( o.data.rx_repeat ) diag_printf( "data rx_repeat%4d\n", -o.data.rx_repeat ); + if ( o.data.rx_skip ) diag_printf( "data rx_skip %4d\n", -o.data.rx_skip ); + if ( o.data.send ) diag_printf( "data send %4d\n", -o.data.send ); + if ( o.data.resend ) diag_printf( "data resend %4d\n", -o.data.resend ); + + if ( o.ack.rx ) diag_printf( " ack rx %4d\n", -o.ack.rx ); + if ( o.ack.rx_repeat ) diag_printf( " ack rx_repeat%4d\n", -o.ack.rx_repeat ); + if ( o.ack.rx_skip ) diag_printf( " ack rx_skip %4d\n", -o.ack.rx_skip ); + if ( o.ack.send ) diag_printf( " ack send %4d\n", -o.ack.send ); + if ( o.ack.resend ) diag_printf( " ack resend %4d\n", -o.ack.resend ); + + if ( o.err_send ) diag_printf( "*error sends %4d\n", -o.err_send ); +#endif // CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS +#endif // CYGOPT_NET_TFTP_SERVER_INSTRUMENT + } +} + +// +// This function is used to create a new server [thread] which supports +// the TFTP protocol on the given port. A server 'id' will be returned +// which can later be used to destroy the server. +// +// Note: all [memory] resources for the server thread will be allocated +// dynamically. If there are insufficient resources, an error will be +// returned. +// +int +tftpd_start(int port, struct tftpd_fileops *ops) +{ + struct tftp_server *server; +#ifdef CYGSEM_TFTP_SERVER_MULTITHREADED + static char init = 0; + if ( 0 == init ) { + init++; + cyg_semaphore_init( &tftp_server_sem, 0 ); + } +#endif + + if ((server = malloc(sizeof(struct tftp_server)))) { + server->tag = TFTP_tag; + server->port = port; + server->ops = ops; + cyg_thread_create(CYGPKG_NET_TFTPD_THREAD_PRIORITY, // Priority + tftpd_server, // entry + (cyg_addrword_t)server, // entry parameter + "TFTP server", // Name + &server->stack[0], // Stack + STACK_SIZE, // Size + &server->thread_handle, // Handle + &server->thread_data // Thread data structure + ); + cyg_thread_resume(server->thread_handle); // Start it + + } + return (int)server; +} + +// +// Destroy a TFTP server, using a previously created server 'id'. +// +int +tftpd_stop(int p) +{ + struct tftp_server *server = (struct tftp_server *)p; + // Simple sanity check + if (server->tag == TFTP_tag) { + cyg_thread_kill(server->thread_handle); + cyg_thread_set_priority(server->thread_handle, 0); + cyg_thread_delay(1); // Make sure it gets to die... + if (cyg_thread_delete(server->thread_handle)) { + // Success shutting down the thread + free(server); // Give up memory + return 1; + } + } + return 0; +} + +// EOF tftp_server.c diff --git a/packages/net/common/current/tests/addr_test.c b/packages/net/common/current/tests/addr_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/addr_test.c @@ -0,0 +1,135 @@ +//========================================================================== +// +// tests/addr_test.c +// +// Test network "address" functions +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2002-03-19 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Networking library test code + +#include +#include + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +void +pexit(char *s) +{ + char msg[256]; + + diag_sprintf(msg, "%s: %s", s, strerror(errno)); + CYG_TEST_FAIL_FINISH(msg); +} + +static void +walk_addrs(struct addrinfo *ai, char *title) +{ + char addr_buf[256]; + + diag_printf("INFO: %s\n", title); + while (ai) { + _inet_ntop(ai->ai_addr, addr_buf, sizeof(addr_buf)); + diag_printf("INFO: Family: %d, Socket: %d, Addr: %s, Port: %d\n", + ai->ai_family, ai->ai_socktype, addr_buf, _inet_port(ai->ai_addr)); + ai = ai->ai_next; + } +} + +int +net_test(CYG_ADDRWORD data) +{ + int err; + struct addrinfo *addrs, hints; + + bzero(&hints, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + if ((err = getaddrinfo(NULL, "7734", &hints, &addrs)) != EAI_NONE) { + diag_printf(" can't getaddrinfo(): %s\n", gai_strerror(err)); + pexit("getaddrinfo"); + } + walk_addrs(addrs, "all passive"); + bzero(&hints, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = 0; + if ((err = getaddrinfo(NULL, "7734", &hints, &addrs)) != EAI_NONE) { + diag_printf(" can't getaddrinfo(): %s\n", gai_strerror(err)); + pexit("getaddrinfo"); + } + walk_addrs(addrs, "all active"); + bzero(&hints, sizeof(hints)); + hints.ai_family = PF_INET; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + if ((err = getaddrinfo(NULL, "7734", &hints, &addrs)) != EAI_NONE) { + diag_printf(" can't getaddrinfo(): %s\n", gai_strerror(err)); + pexit("getaddrinfo"); + } + walk_addrs(addrs, "IPv4 passive"); +#ifdef CYGPKG_NET_INET6 + bzero(&hints, sizeof(hints)); + hints.ai_family = PF_INET6; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + if ((err = getaddrinfo(NULL, "7734", &hints, &addrs)) != EAI_NONE) { + diag_printf(" can't getaddrinfo(): %s\n", gai_strerror(err)); + pexit("getaddrinfo"); + } + walk_addrs(addrs, "IPv6 passive"); +#endif + bzero(&hints, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_PASSIVE; + if ((err = getaddrinfo(NULL, "snmp", &hints, &addrs)) != EAI_NONE) { + diag_printf(" can't getaddrinfo(): %s\n", gai_strerror(err)); + pexit("getaddrinfo"); + } + walk_addrs(addrs, "all snmp/udp"); + CYG_TEST_PASS_FINISH("Address [library] test OK"); +} +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} diff --git a/packages/net/common/current/tests/bridge.c b/packages/net/common/current/tests/bridge.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/bridge.c @@ -0,0 +1,986 @@ +//========================================================================== +// +// tests/bridge.c +// +// +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Jason L. Wright (jason@thought.net) +// Contributors: andrew.lunn@ascom.ch (Andrew Lunn), hmt +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +/* $OpenBSD: brconfig.c,v 1.6 2000/02/04 06:32:04 deraadt Exp $ */ + +/* + * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jason L. Wright + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void bridge_usage __P((void)); +int main __P((int, char **)); +int bridge_setflag __P((int, char *, short)); +int bridge_clrflag __P((int, char *, short)); +int bridge_ifsetflag __P((int, char *, char *, u_int32_t)); +int bridge_ifclrflag __P((int, char *, char *, u_int32_t)); +int bridge_list __P((int, char *, char *)); +int bridge_addrs __P((int, char *, char *)); +int bridge_addaddr __P((int, char *, char *, char *)); +int bridge_deladdr __P((int, char *, char *)); +int bridge_maxaddr __P((int, char *, char *)); +int bridge_timeout __P((int, char *, char *)); +int bridge_flush __P((int, char *)); +int bridge_flushall __P((int, char *)); +int bridge_add __P((int, char *, char *)); +int bridge_delete __P((int, char *, char *)); +int bridge_status __P((int, char *)); +int is_bridge __P((int, char *)); +int bridge_show_all __P((int)); +void printb __P((char *, unsigned short, char *)); +int bridge_rule __P((int, char *, int, char **, int)); +int bridge_rules __P((int, char *, char *, char *)); +int bridge_flush_rule __P((int, char *, char *)); +void bridge_badrule __P((int, char **, int)); +void bridge_showrule __P((struct ifbrlreq *, char *)); +int bridge_rulefile __P((int, char *, char *)); + +/* if_flags bits: borrowed from ifconfig.c */ +#define IFFBITS \ +"\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS\7RUNNING\10NOARP\ +\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2\20MULTICAST" + +#define IFBAFBITS "\020\1STATIC" +#define IFBIFBITS "\020\1LEARNING\2DISCOVER\3BLOCKNONIP\4BLOCKARP" + +#define warnx(x) diag_printf(x); +#define warnx2(x,y) diag_printf(x,y) +#define warnx3(x,y,z) diag_printf(x,y,z) +#define err(x,y) assert(0); +extern int cyg_kmem_print_stats(void); + +static char * _ether_aton __P((char *, struct ether_addr *)); + +char * +ether_ntoa(e) + struct ether_addr *e; +{ + static char a[] = "xx:xx:xx:xx:xx:xx"; + + if (e->ether_addr_octet[0] > 0xFF || e->ether_addr_octet[1] > 0xFF || + e->ether_addr_octet[2] > 0xFF || e->ether_addr_octet[3] > 0xFF || + e->ether_addr_octet[4] > 0xFF || e->ether_addr_octet[5] > 0xFF) { + errno = EINVAL; + return (NULL); + } + + (void)sprintf(a, "%02x:%02x:%02x:%02x:%02x:%02x", + e->ether_addr_octet[0], e->ether_addr_octet[1], + e->ether_addr_octet[2], e->ether_addr_octet[3], + e->ether_addr_octet[4], e->ether_addr_octet[5]); + + return (a); +} + +static char * +_ether_aton(s, e) + char *s; + struct ether_addr *e; +{ + int i; + long l; + char *pp; + + while (isspace(*s)) + s++; + + /* expect 6 hex octets separated by ':' or space/NUL if last octet */ + for (i = 0; i < 6; i++) { + l = strtol(s, &pp, 16); + if (pp == s || l > 0xFF || l < 0) + return (NULL); + if (!(*pp == ':' || (i == 5 && (isspace(*pp) || *pp == '\0')))) + return (NULL); + e->ether_addr_octet[i] = (u_char)l; + s = pp + 1; + } + + /* return character after the octets ala strtol(3) */ + return (pp); +} + +struct ether_addr * +ether_aton(s) + char *s; +{ + static struct ether_addr n; + + return (_ether_aton(s, &n) ? &n : NULL); +} + +void +bridge_usage() +{ + diag_printf("usage: brconfig -a\n"); + diag_printf( + "usage: brconfig interface [up] [down] [add if] [del if] ...\n"); +} + + +int +bridge_ifsetflag(s, brdg, ifsname, flag) + int s; + char *brdg, *ifsname; + u_int32_t flag; +{ + struct ifbreq req; + + strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); + strncpy(req.ifbr_ifsname, ifsname, sizeof(req.ifbr_ifsname)); + if (ioctl(s, SIOCBRDGGIFFLGS, (caddr_t)&req) < 0) { + return (1); + } + + req.ifbr_ifsflags |= flag; + + if (ioctl(s, SIOCBRDGSIFFLGS, (caddr_t)&req) < 0) { + warnx3("%s: %s", brdg, ifsname); + return (1); + } + return (0); +} + +int +bridge_ifclrflag(s, brdg, ifsname, flag) + int s; + char *brdg, *ifsname; + u_int32_t flag; +{ + struct ifbreq req; + + strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); + strncpy(req.ifbr_ifsname, ifsname, sizeof(req.ifbr_ifsname)); + + if (ioctl(s, SIOCBRDGGIFFLGS, (caddr_t)&req) < 0) { + warnx3("%s: %s", brdg, ifsname); + return (1); + } + + req.ifbr_ifsflags &= ~flag; + + if (ioctl(s, SIOCBRDGSIFFLGS, (caddr_t)&req) < 0) { + warnx3("%s: %s", brdg, ifsname); + return (1); + } + return (0); +} + +int +bridge_show_all(s) + int s; +{ + char *inbuf = NULL; + struct ifconf ifc; + struct ifreq *ifrp, ifreq; + int len = 8192, i; + + while (1) { + ifc.ifc_len = len; + ifc.ifc_buf = inbuf = realloc(inbuf, len); + if (inbuf == NULL) + err(1, "malloc"); + if (ioctl(s, SIOCGIFCONF, &ifc) < 0) + err(1, "ioctl(SIOCGIFCONF)"); + if (ifc.ifc_len + sizeof(struct ifreq) < len) + break; + len *= 2; + } + ifrp = ifc.ifc_req; + ifreq.ifr_name[0] = '\0'; + for (i = 0; i < ifc.ifc_len; ) { + ifrp = (struct ifreq *)((caddr_t)ifc.ifc_req + i); + i += sizeof(ifrp->ifr_name) + + (ifrp->ifr_addr.sa_len > sizeof(struct sockaddr) ? + ifrp->ifr_addr.sa_len : sizeof(struct sockaddr)); + if (ifrp->ifr_addr.sa_family != AF_LINK) + continue; + if (!is_bridge(s, ifrp->ifr_name)) + continue; + bridge_status(s, ifrp->ifr_name); + } + free(ifc.ifc_buf); + return (0); +} + +int +bridge_setflag(s, brdg, f) + int s; + char *brdg; + short f; +{ + struct ifreq ifr; + + strncpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name)); + + if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { + warnx2("%s", brdg); + if (errno == EPERM) + return (1); + return (1); + } + + ifr.ifr_flags |= f; + + if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) { + warnx2("%s", brdg); + if (errno == EPERM) + return (1); + return (1); + } + + return (0); +} + +int +bridge_clrflag(s, brdg, f) + int s; + char *brdg; + short f; +{ + struct ifreq ifr; + + strncpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name)); + + if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { + warnx2("%s", brdg); + if (errno == EPERM) + return (1); + return (1); + } + + ifr.ifr_flags &= ~(f); + + if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) { + warnx2("%s", brdg); + if (errno == EPERM) + return (1); + return (1); + } + + return (0); +} + +int +bridge_flushall(s, brdg) + int s; + char *brdg; +{ + struct ifbreq req; + + strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); + req.ifbr_ifsflags = IFBF_FLUSHALL; + if (ioctl(s, SIOCBRDGFLUSH, &req) < 0) { + warnx2("%s", brdg); + return (1); + } + return (0); +} + +int +bridge_flush(s, brdg) + int s; + char *brdg; +{ + struct ifbreq req; + + strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); + req.ifbr_ifsflags = IFBF_FLUSHDYN; + if (ioctl(s, SIOCBRDGFLUSH, &req) < 0) { + warnx2("%s", brdg); + return (1); + } + return (0); +} + +int +bridge_list(s, brdg, delim) + int s; + char *brdg, *delim; +{ + struct ifbreq *reqp; + struct ifbifconf bifc; + int i, len = 8192; + char buf[sizeof(reqp->ifbr_ifsname) + 1], *inbuf = NULL; + + while (1) { + strncpy(bifc.ifbic_name, brdg, sizeof(bifc.ifbic_name)); + bifc.ifbic_len = len; + bifc.ifbic_buf = inbuf = realloc(inbuf, len); + if (inbuf == NULL) + err(1, "malloc"); + if (ioctl(s, SIOCBRDGIFS, &bifc) < 0) + err(1, brdg); + if (bifc.ifbic_len + sizeof(*reqp) < len) + break; + len *= 2; + } + for (i = 0; i < bifc.ifbic_len / sizeof(*reqp); i++) { + reqp = bifc.ifbic_req + i; + strncpy(buf, reqp->ifbr_ifsname, sizeof(buf)); + diag_printf("%s%s ", delim, buf); + printb("flags", reqp->ifbr_ifsflags, IFBIFBITS); + diag_printf("\n"); + bridge_rules(s, brdg, buf, delim); + } + free(bifc.ifbic_buf); + return (0); /* NOTREACHED */ +} + +int +bridge_add(s, brdg, ifn) + int s; + char *brdg, *ifn; +{ + struct ifbreq req; + + strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); + strncpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname)); + if (ioctl(s, SIOCBRDGADD, &req) < 0) { + warnx3("%s: %s", brdg, ifn); + if (errno == EPERM) + return (1); + return (1); + } + return (0); +} + +int +bridge_delete(s, brdg, ifn) + int s; + char *brdg, *ifn; +{ + struct ifbreq req; + + strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); + strncpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname)); + if (ioctl(s, SIOCBRDGDEL, &req) < 0) { + warnx3("%s: %s", brdg, ifn); + if (errno == EPERM) + return (1); + return (1); + } + return (0); +} + +int +bridge_timeout(s, brdg, arg) + int s; + char *brdg, *arg; +{ + struct ifbcachetoreq ifbct; + u_int32_t newtime; + char *endptr; + + newtime = strtoul(arg, &endptr, 0); + if (arg[0] == '\0' || endptr[0] != '\0') { + diag_printf("invalid arg for timeout: %s\n", arg); + return (1); + } + + strncpy(ifbct.ifbct_name, brdg, sizeof(ifbct.ifbct_name)); + ifbct.ifbct_time = newtime; + if (ioctl(s, SIOCBRDGSTO, (caddr_t)&ifbct) < 0) { + warnx2("%s", brdg); + return (1); + } + return (0); +} + +int +bridge_maxaddr(s, brdg, arg) + int s; + char *brdg, *arg; +{ + struct ifbcachereq ifbc; + u_int32_t newsize; + char *endptr; + + newsize = strtoul(arg, &endptr, 0); + if (arg[0] == '\0' || endptr[0] != '\0') { + diag_printf("invalid arg for maxaddr: %s\n", arg); + return (1); + } + + strncpy(ifbc.ifbc_name, brdg, sizeof(ifbc.ifbc_name)); + ifbc.ifbc_size = newsize; + if (ioctl(s, SIOCBRDGSCACHE, (caddr_t)&ifbc) < 0) { + warnx2("%s", brdg); + return (1); + } + return (0); +} + +int +bridge_deladdr(s, brdg, addr) + int s; + char *brdg, *addr; +{ + struct ifbareq ifba; + struct ether_addr *ea; + + strncpy(ifba.ifba_name, brdg, sizeof(ifba.ifba_name)); + ea = ether_aton(addr); + if (ea == NULL) { + warnx2("Invalid address: %s", addr); + return (1); + } + bcopy(ea, &ifba.ifba_dst, sizeof(struct ether_addr)); + + if (ioctl(s, SIOCBRDGDADDR, &ifba) < 0) { + warnx3("%s: %s", brdg, addr); + return (1); + } + + return (0); +} + +int +bridge_addaddr(s, brdg, ifname, addr) + int s; + char *brdg, *ifname, *addr; +{ + struct ifbareq ifba; + struct ether_addr *ea; + + strncpy(ifba.ifba_name, brdg, sizeof(ifba.ifba_name)); + strncpy(ifba.ifba_ifsname, ifname, sizeof(ifba.ifba_ifsname)); + + ea = ether_aton(addr); + if (ea == NULL) { + warnx2("Invalid address: %s", addr); + return (1); + } + bcopy(ea, &ifba.ifba_dst, sizeof(struct ether_addr)); + ifba.ifba_flags = IFBAF_STATIC; + + if (ioctl(s, SIOCBRDGSADDR, &ifba) < 0) { + warnx3("%s: %s", brdg, addr); + return (1); + } + + return (0); +} + +int +bridge_addrs(s, brdg, delim) + int s; + char *brdg, *delim; +{ + struct ifbaconf ifbac; + struct ifbareq *ifba; + char *inbuf = NULL, buf[sizeof(ifba->ifba_ifsname) + 1]; + int i, len = 8192; + + while (1) { + ifbac.ifbac_len = len; + ifbac.ifbac_buf = inbuf = realloc(inbuf, len); + strncpy(ifbac.ifbac_name, brdg, sizeof(ifbac.ifbac_name)); + if (inbuf == NULL) + err(1, "malloc"); + if (ioctl(s, SIOCBRDGRTS, &ifbac) < 0) { + if (errno == ENETDOWN) + return (0); + err(1, brdg); + } + if (ifbac.ifbac_len + sizeof(*ifba) < len) + break; + len *= 2; + } + + for (i = 0; i < ifbac.ifbac_len / sizeof(*ifba); i++) { + ifba = ifbac.ifbac_req + i; + strncpy(buf, ifba->ifba_ifsname, sizeof(buf)); + diag_printf("%s%s %s %d ", delim, ether_ntoa(&ifba->ifba_dst), + buf, ifba->ifba_age); + printb("flags", ifba->ifba_flags, IFBAFBITS); + diag_printf("\n"); + } + free(ifbac.ifbac_buf); + return (0); +} + +/* + * Check to make sure 'brdg' is really a bridge interface. + */ +int +is_bridge(s, brdg) + int s; + char *brdg; +{ + struct ifreq ifr; + struct ifbaconf ifbac; + + strncpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name)); + + if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) + return (0); + + ifbac.ifbac_len = 0; + strncpy(ifbac.ifbac_name, brdg, sizeof(ifbac.ifbac_name)); + if (ioctl(s, SIOCBRDGRTS, (caddr_t)&ifbac) < 0) { + if (errno == ENETDOWN) + return (1); + return (0); + } + return (1); +} + +int +bridge_status(s, brdg) + int s; + char *brdg; +{ + struct ifreq ifr; + struct ifbcachereq ifbc; + struct ifbcachetoreq ifbct; + int err; + + strncpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name)); + if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { + warnx2("%s", brdg); + if (errno == EPERM) + return (1); + return (1); + } + + diag_printf("%s: ", brdg); + printb("flags", ifr.ifr_flags, IFFBITS); + diag_printf("\n"); + + diag_printf("Interfaces:\n"); + err = bridge_list(s, brdg, " "); + if (err) + return (err); + + strncpy(ifbc.ifbc_name, brdg, sizeof(ifbc.ifbc_name)); + if (ioctl(s, SIOCBRDGGCACHE, (caddr_t)&ifbc) < 0) { + warnx2("%s", brdg); + return (1); + } + + strncpy(ifbct.ifbct_name, brdg, sizeof(ifbct.ifbct_name)); + if (ioctl(s, SIOCBRDGGTO, (caddr_t)&ifbct) < 0) { + warnx2("%s", brdg); + return (1); + } + + diag_printf("Addresses (max cache: %d, timeout: %d):\n", + ifbc.ifbc_size, ifbct.ifbct_time); + + err = bridge_addrs(s, brdg, " "); + return (err); +} + +int +bridge_flush_rule(s, brdg, ifname) + int s; + char *brdg, *ifname; +{ + struct ifbrlreq req; + + strncpy(req.ifbr_name, brdg, sizeof(req.ifbr_name)); + strncpy(req.ifbr_ifsname, ifname, sizeof(req.ifbr_ifsname)); + if (ioctl(s, SIOCBRDGFRL, &req) < 0) { + warnx3("%s: %s", brdg, ifname); + return (1); + } + return (0); +} + +int +bridge_rules(s, brdg, ifname, delim) + int s; + char *brdg, *ifname; + char *delim; +{ + char *inbuf = NULL; + struct ifbrlconf ifc; + struct ifbrlreq *ifrp, ifreq; + int len = 8192, i; + + while (1) { + ifc.ifbrl_len = len; + ifc.ifbrl_buf = inbuf = realloc(inbuf, len); + strncpy(ifc.ifbrl_name, brdg, sizeof(ifc.ifbrl_name)); + strncpy(ifc.ifbrl_ifsname, ifname, sizeof(ifc.ifbrl_ifsname)); + if (inbuf == NULL) + err(1, "malloc"); + if (ioctl(s, SIOCBRDGGRL, &ifc) < 0) + err(1, "ioctl(SIOCBRDGGRL)"); + if (ifc.ifbrl_len + sizeof(ifreq) < len) + break; + len *= 2; + } + ifrp = ifc.ifbrl_req; + for (i = 0; i < ifc.ifbrl_len; i += sizeof(ifreq)) { + ifrp = (struct ifbrlreq *)((caddr_t)ifc.ifbrl_req + i); + bridge_showrule(ifrp, delim); + } + free(ifc.ifbrl_buf); + return (0); +} + +void +bridge_showrule(r, delim) + struct ifbrlreq *r; + char *delim; +{ + if (delim) + diag_printf("%s ", delim); + else + diag_printf("%s: ", r->ifbr_name); + + if (r->ifbr_action == BRL_ACTION_BLOCK) + diag_printf("block "); + else if (r->ifbr_action == BRL_ACTION_PASS) + diag_printf("pass "); + else + diag_printf("[neither block nor pass?]\n"); + + if ((r->ifbr_flags & (BRL_FLAG_IN | BRL_FLAG_OUT)) == + (BRL_FLAG_IN | BRL_FLAG_OUT)) + diag_printf("in/out "); + else if (r->ifbr_flags & BRL_FLAG_IN) + diag_printf("in "); + else if (r->ifbr_flags & BRL_FLAG_OUT) + diag_printf("out "); + else + diag_printf("[neither in nor out?]\n"); + + diag_printf("on %s", r->ifbr_ifsname); + + if (r->ifbr_flags & BRL_FLAG_SRCVALID) + diag_printf(" src %s", ether_ntoa(&r->ifbr_src)); + if (r->ifbr_flags & BRL_FLAG_DSTVALID) + diag_printf(" dst %s", ether_ntoa(&r->ifbr_dst)); + + diag_printf("\n"); +} + +/* + * Parse a rule definition and send it upwards. + * + * Syntax: + * {block|pass} {in|out|in/out} on {ifs} [src {mac}] [dst {mac}] + */ +int +bridge_rule(int s, char *brdg, int targc, char **targv, int ln) +{ + char **argv = targv; + int argc = targc; + struct ifbrlreq rule; + struct ether_addr *ea, *dea; + + if (argc == 0) { + diag_printf( "invalid rule\n"); + return (1); + } + rule.ifbr_flags = 0; + rule.ifbr_action = 0; + strncpy(rule.ifbr_name, brdg, sizeof(rule.ifbr_name)); + + if (strcmp(argv[0], "block") == 0) + rule.ifbr_action = BRL_ACTION_BLOCK; + else if (strcmp(argv[0], "pass") == 0) + rule.ifbr_action = BRL_ACTION_PASS; + else + goto bad_rule; + argc--; argv++; + + if (argc == 0) { + bridge_badrule(targc, targv, ln); + return (1); + } + if (strcmp(argv[0], "in") == 0) + rule.ifbr_flags |= BRL_FLAG_IN; + else if (strcmp(argv[0], "out") == 0) + rule.ifbr_flags |= BRL_FLAG_OUT; + else if (strcmp(argv[0], "in/out") == 0) + rule.ifbr_flags |= BRL_FLAG_IN | BRL_FLAG_OUT; + else + goto bad_rule; + argc--; argv++; + + if (argc == 0 || strcmp(argv[0], "on")) + goto bad_rule; + argc--; argv++; + + if (argc == 0) + goto bad_rule; + strncpy(rule.ifbr_ifsname, argv[0], sizeof(rule.ifbr_ifsname)); + argc--; argv++; + + while (argc) { + if (strcmp(argv[0], "dst") == 0) { + if (rule.ifbr_flags & BRL_FLAG_DSTVALID) + goto bad_rule; + rule.ifbr_flags |= BRL_FLAG_DSTVALID; + dea = &rule.ifbr_dst; + } + else if (strcmp(argv[0], "src") == 0) { + if (rule.ifbr_flags & BRL_FLAG_SRCVALID) + goto bad_rule; + rule.ifbr_flags |= BRL_FLAG_SRCVALID; + dea = &rule.ifbr_src; + } + else + goto bad_rule; + + argc--; argv++; + + if (argc == 0) + goto bad_rule; + ea = ether_aton(argv[0]); + if (ea == NULL) { + warnx2("Invalid address: %s", argv[0]); + return (1); + } + bcopy(ea, dea, sizeof(*dea)); + argc--; argv++; + } + + if (ioctl(s, SIOCBRDGARL, &rule) < 0) { + warnx2("%s", brdg); + return (1); + } + return (0); + +bad_rule: + bridge_badrule(targc, targv, ln); + return (1); +} + +#define MAXRULEWORDS 8 +#ifdef ZAP +int +bridge_rulefile(s, brdg, fname) + int s; + char *brdg, *fname; +{ + FILE *f; + char *str, *argv[MAXRULEWORDS], buf[1024], xbuf[1024]; + int ln = 1, argc = 0, err = 0, xerr; + + f = fopen(fname, "r"); + if (f == NULL) { + warnx2("%s", fname); + return (1); + } + + while (1) { + fgets(buf, sizeof(buf), f); + if (feof(f)) + break; + ln++; + if (buf[0] == '#') + continue; + + argc = 0; + str = strtok(buf, "\n\r "); + strncpy(xbuf, buf, sizeof(xbuf)); + while (str != NULL) { + argv[argc++] = str; + if (argc > MAXRULEWORDS) { + diag_printf( "invalid rule: %d: %s\n", + ln, xbuf); + break; + } + str = strtok(NULL, "\n\r "); + } + + if (argc > MAXRULEWORDS) + continue; + + xerr = bridge_rule(s, brdg, argc, argv, ln); + if (xerr) + err = xerr; + } + fclose(f); + return (err); +} +#endif +void +bridge_badrule(argc, argv, ln) + int argc, ln; + char **argv; +{ + int i; + + diag_printf( "invalid rule: "); + if (ln != -1) + diag_printf( "%d: ", ln); + for (i = 0; i < argc; i++) { + diag_printf( "%s ", argv[i]); + } + diag_printf( "\n"); +} + +/* + * Print a value ala the %b format of the kernel's printf + * (borrowed from ifconfig.c) + */ +void +printb(s, v, bits) + char *s; + char *bits; + unsigned short v; +{ + register int i, any = 0; + register char c; + + if (bits && *bits == 8) + diag_printf("%s=%o", s, v); + else + diag_printf("%s=%x", s, v); + bits++; + if (bits) { + diag_printf("<"); + while ((i = *bits++)) { + if (v & (1 << (i-1))) { + if (any) + diag_printf(","); + any = 1; + for (; (c = *bits) > 32; bits++) + diag_printf("%c",c); + } else + for (; *bits > 32; bits++) + ; + } + diag_printf(">"); + } +} + +static void +interface_up(const char *intf) +{ + struct ifreq ifr; + int s; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + perror("socket"); + return; + } + + strcpy(ifr.ifr_name, intf); + ifr.ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; + if (ioctl(s, SIOCSIFFLAGS, &ifr)) { + perror("SIOCSIFFLAGS"); + } + close(s); +} + +static void +main_fn(cyg_addrword_t data) { + + int sock; + char brdg[] = "bridge0"; + + sock = socket(AF_INET, SOCK_DGRAM, 0); + assert(sock >= 0); + +#ifdef CYGHWR_NET_DRIVER_ETH0 + interface_up("eth0"); + eth0_up = 1; + bridge_add(sock,brdg,"eth0"); +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + interface_up("eth1"); + eth1_up = 1; + bridge_add(sock,brdg,"eth1"); +#endif + + bridge_status(sock,brdg); + bridge_setflag(sock,brdg, IFF_UP); + + while(1) { + cyg_kmem_print_stats(); + cyg_thread_delay(500); + } +} + +static char main_stack[8192]; +static cyg_handle_t main_handle; +static cyg_thread main_thread; + +void +cyg_user_start(void) { + printf("cyg_user_start starting\n"); + cyg_thread_create(4, &main_fn, 0, "main", &main_stack, sizeof(main_stack), + &main_handle, &main_thread); + cyg_thread_resume(main_handle); + printf("cyg_user_start done\n"); +} + + diff --git a/packages/net/common/current/tests/dhcp_test.c b/packages/net/common/current/tests/dhcp_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/dhcp_test.c @@ -0,0 +1,321 @@ +//========================================================================== +// +// tests/dhcp_test.c +// +// Simple test of DHCP (ICMP) and networking support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// DHCP test code + +#include + +#include +#include + +#include + +#include + +#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists +#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME +#endif + +#ifdef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS // do we use the rt test? +# ifdef CYGTST_DEVS_ETH_TEST_NET_REALTIME // Get the test ancilla if it exists +# include CYGTST_DEVS_ETH_TEST_NET_REALTIME +# endif +#endif + +// Fill in the blanks if necessary +#ifndef TNR_OFF +# define TNR_OFF() +#endif +#ifndef TNR_ON +# define TNR_ON() +#endif +#ifndef TNR_INIT +# define TNR_INIT() +#endif +#ifndef TNR_PRINT_ACTIVITY +# define TNR_PRINT_ACTIVITY() +#endif + + + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +#define NUM_PINGS 16 +#define MAX_PACKET 4096 +#define MIN_PACKET 64 +#define MAX_SEND 4000 + +#define PACKET_ADD ((MAX_SEND - MIN_PACKET)/NUM_PINGS) +#define nPACKET_ADD 1 + +static unsigned char pkt1[MAX_PACKET], pkt2[MAX_PACKET]; + +#define UNIQUEID 0x1234 + +void +pexit(char *s) +{ + CYG_TEST_FAIL_FINISH(s); +} + +// Compute INET checksum +int +inet_cksum(u_short *addr, int len) +{ + register int nleft = len; + register u_short *w = addr; + register u_short answer; + register u_int sum = 0; + u_short odd_byte = 0; + + /* + * Our algorithm is simple, using a 32 bit accumulator (sum), + * we add sequential 16 bit words to it, and at the end, fold + * back all the carry bits from the top 16 bits into the lower + * 16 bits. + */ + while( nleft > 1 ) { + sum += *w++; + nleft -= 2; + } + + /* mop up an odd byte, if necessary */ + if( nleft == 1 ) { + *(u_char *)(&odd_byte) = *(u_char *)w; + sum += odd_byte; + } + + /* + * add back carry outs from top 16 bits to low 16 bits + */ + sum = (sum >> 16) + (sum & 0x0000ffff); /* add hi 16 to low 16 */ + sum += (sum >> 16); /* add carry */ + answer = ~sum; /* truncate to 16 bits */ + return (answer); +} + +static int +show_icmp(unsigned char *pkt, int len, + struct sockaddr_in *from, struct sockaddr_in *to) +{ + cyg_tick_count_t *tp, tv; + struct ip *ip; + struct icmp *icmp; + tv = cyg_current_time(); + ip = (struct ip *)pkt; + if ((len < sizeof(*ip)) || ip->ip_v != IPVERSION) { + diag_printf("%s: Short packet or not IP! - Len: %d, Version: %d\n", + inet_ntoa(from->sin_addr), len, ip->ip_v); + return 0; + } + icmp = (struct icmp *)(pkt + sizeof(*ip)); + len -= (sizeof(*ip) + 8); + tp = (cyg_tick_count_t *)&icmp->icmp_data; + if (icmp->icmp_type != ICMP_ECHOREPLY) { + diag_printf("%s: Invalid ICMP - type: %d\n", + inet_ntoa(from->sin_addr), icmp->icmp_type); + return 0; + } + if (icmp->icmp_id != UNIQUEID) { + diag_printf("%s: ICMP received for wrong id - sent: %x, recvd: %x\n", + inet_ntoa(from->sin_addr), UNIQUEID, icmp->icmp_id); + } + diag_printf("%d bytes from %s: ", len, inet_ntoa(from->sin_addr)); + diag_printf("icmp_seq=%d", icmp->icmp_seq); + diag_printf(", time=%dms\n", (int)(tv - *tp)*10); + return (from->sin_addr.s_addr == to->sin_addr.s_addr); +} + +static void +ping_host(int s, struct sockaddr_in *host) +{ + struct icmp *icmp = (struct icmp *)pkt1; + int icmp_len = MIN_PACKET; + int seq, ok_recv, bogus_recv; + cyg_tick_count_t *tp; + long *dp; + struct sockaddr_in from; + int i, len, fromlen; + + ok_recv = 0; + bogus_recv = 0; + diag_printf("PING server %s\n", inet_ntoa(host->sin_addr)); + for (seq = 0; seq < NUM_PINGS; seq++, icmp_len += PACKET_ADD ) { + TNR_ON(); + // Build ICMP packet + icmp->icmp_type = ICMP_ECHO; + icmp->icmp_code = 0; + icmp->icmp_cksum = 0; + icmp->icmp_seq = seq; + icmp->icmp_id = 0x1234; + // Set up ping data + tp = (cyg_tick_count_t *)&icmp->icmp_data; + *tp++ = cyg_current_time(); + dp = (long *)tp; + for (i = sizeof(*tp); i < icmp_len; i += sizeof(*dp)) { + *dp++ = i; + } + // Add checksum + icmp->icmp_cksum = inet_cksum( (u_short *)icmp, icmp_len+8); + // Send it off + if (sendto(s, icmp, icmp_len+8, 0, (struct sockaddr *)host, sizeof(*host)) < 0) { + TNR_OFF(); + perror("sendto"); + continue; + } + // Wait for a response + fromlen = sizeof(from); + len = recvfrom(s, pkt2, sizeof(pkt2), 0, (struct sockaddr *)&from, &fromlen); + TNR_OFF(); + if (len < 0) { + perror("recvfrom"); + icmp_len = MIN_PACKET - PACKET_ADD; // go back to small packet size + seq+=4; + } else { + if (show_icmp(pkt2, len, &from, host)) { + ok_recv++; + } else { + bogus_recv++; + } + } + } + TNR_OFF(); +} + +static void +ping_test(struct bootp *bp) +{ + struct protoent *p; + struct timeval tv; + struct sockaddr_in host; + int s; + + if ((p = getprotobyname("icmp")) == (struct protoent *)0) { + pexit("getprotobyname"); + return; + } + s = socket(AF_INET, SOCK_RAW, p->p_proto); + if (s < 0) { + pexit("socket"); + return; + } + tv.tv_sec = 1; + tv.tv_usec = 0; + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + // Set up host address + host.sin_family = AF_INET; + host.sin_len = sizeof(host); + host.sin_addr = bp->bp_siaddr; + host.sin_port = 0; + ping_host(s, &host); + // Now try a bogus host + host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + 32); + ping_host(s, &host); + close(s); +} + +void +net_test(cyg_addrword_t p) +{ +#ifndef CYGPKG_NET_DHCP + CYG_TEST_NA( "DHCP is not enabled" ); + CYG_TEST_EXIT( "DHCP is not enabled" ); +#else + int i; + diag_printf("Start DHCP test\n"); + TNR_INIT(); + init_all_network_interfaces(); + + for ( i = 10; i > 0; i-- ) { +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) { + ping_test(ð0_bootp_data); + } +#endif + // Now do the DHCP renewal ritual... + if ( cyg_semaphore_trywait( &dhcp_needs_attention )) { + if ( ! dhcp_bind() ) { + // All done + dhcp_halt(); + CYG_TEST_FAIL_FINISH( "Rebind after lease failed"); + break; + } + } +#ifdef CYGHWR_NET_DRIVER_ETH1 + if (eth1_up) { + ping_test(ð1_bootp_data); + } +#endif + +#ifndef CYGOPT_NET_DHCP_DHCP_THREAD + // Now do the DHCP renewal ritual... + if ( cyg_semaphore_trywait( &dhcp_needs_attention )) { + if ( ! dhcp_bind() ) { + // All done + dhcp_halt(); + CYG_TEST_FAIL_FINISH( "Rebind after lease failed"); + break; + } + } +#endif // not CYGOPT_NET_DHCP_DHCP_THREAD + + if ( 1 == (i & 3) ) { + dhcp_release(); // relinquish leases + dhcp_halt(); + init_all_network_interfaces(); + } + } + dhcp_release(); + + TNR_PRINT_ACTIVITY(); + CYG_TEST_PASS_FINISH("Dhcp test OK"); +#endif +} + +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} diff --git a/packages/net/common/current/tests/dhcp_test2.c b/packages/net/common/current/tests/dhcp_test2.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/dhcp_test2.c @@ -0,0 +1,223 @@ +//========================================================================== +// +// tests/dhcp_test2.c +// +// Test of repeatedly releasing and reacquiring DHCP leases +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt, tomislav.sostaric@ascom.ch +// Contributors: +// Date: 2002-03-11 +// Purpose: Test repeated up-down cycles of interfaces with DHCP. +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +/* + * A test program for bringing out the DHCP memory leak bug + * This file is in the public domain and may be used for any purpose + */ + +/* INCLUDES */ + +#include + +#include +#include + +#include + +#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists +#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME +#endif + + +#include /* printf */ +#include /* strlen */ +#include /* All the kernel specific stuff */ +#include /* I/O functions */ +#include /* CYGNUM_HAL_STACK_SIZE_TYPICAL */ +#include +#include + +// ------------------------------------------------------------------------ + +#define FALSE 0 +#define TRUE 1 +#define TICKS_PER_SEC 100 + +#define nLOOPS 1000000 +#define LOOPS 10 + +// ------------------------------------------------------------------------ + +#define NINTERFACES (2) + +struct bootp bootp_data[ NINTERFACES ]; +cyg_uint8 state[ NINTERFACES ]; +struct dhcp_lease lease[ NINTERFACES ]; +int up[ NINTERFACES ], oldup[ NINTERFACES ]; + +char *eth[ NINTERFACES ] = { "eth0", "eth1" }; + +int counter = 0; + +void +tdhcp_init( int which ) +{ + printf("%s: Initializing device to use DHCP.\n", eth[which] ); + bzero( &bootp_data[which], sizeof( *bootp_data ) ); + state[which] = 0; + bzero( &lease[which], sizeof( *lease ) ); + up[which] = oldup[which] = FALSE; +} + + +void +tdhcp_do_one( int which ) +{ + oldup[which] = up[which]; + up[which] = do_dhcp( eth[which], &bootp_data[which], &state[which], &lease[which] ); +} + +void +tdhcp_updown_one( int which ) +{ + /* DHCP wants interface to go up or down, do it. */ + if (up[which] != oldup[which]) { + if (up[which]) { + char tbuf[256]; + int result; + + result = init_net( eth[which], &bootp_data[which]); + if (!result) { + printf("%s: Initialization (DHCP) failed.\n", eth[which] ); + return; + } + + if (lease[which].expiry == (cyg_tick_count_t)-1) { + strcpy(tbuf, "infinite"); + } else { + cyg_tick_count_t now; + unsigned int exp; + + now = cyg_current_time(); + exp = ((lease[which].expiry > now) ? lease[which].expiry - now : 0) / TICKS_PER_SEC; + sprintf(tbuf, "%ud %uh %um %us", exp / 86400, + (exp / 3600) % 24, (exp / 60) % 60, exp % 60); + } + printf("%s: Configured by DHCP, IP address %s, " + "lease expiry: %s.\n", eth[which], + inet_ntoa(bootp_data[which].bp_yiaddr), tbuf); + printf("%s: Interface ready\n", eth[which] ); + } else { + printf("%s: Deconfigured by DHCP.\n", eth[which] ); + cyg_thread_delay(10); + do_dhcp_down_net( eth[which], &bootp_data[which], &state[which], &lease[which]); + state[which] = DHCPSTATE_INIT; + } + } +} + +void +tdhcp_release_one( int which ) +{ + /* If DHCP failed (most probably because there was no DHCP server around), + * sleep a bit, then try again. Otherwise, just wait until DHCP needs our + * attention. + */ + if (state[which] == DHCPSTATE_FAILED) { + printf("%s: DHCP failed, will retry later.\n", eth[which] ); + cyg_thread_delay(10); + printf("%s: Retrying DHCP.\n", eth[which] ); + } + cyg_thread_delay(10); + printf("%s: Releasing DHCP lease.\n", eth[which] ); + do_dhcp_release( eth[which], &bootp_data[which], &state[which], &lease[which]); + cyg_thread_delay(10); + up[which] = FALSE; + state[which] = DHCPSTATE_INIT; +} + + +static void +dhcp_if_fn(cyg_addrword_t data) +{ + CYG_TEST_INIT(); +#ifndef CYGPKG_NET_DHCP + CYG_TEST_NA( "DHCP is not enabled" ); + CYG_TEST_EXIT( "DHCP is not enabled" ); +#else + +#ifdef CYGHWR_NET_DRIVER_ETH0 + tdhcp_init( 0 ); +#endif // CYGHWR_NET_DRIVER_ETH0 +#ifdef CYGHWR_NET_DRIVER_ETH1 + tdhcp_init( 1 ); +#endif // CYGHWR_NET_DRIVER_ETH1 + + while ( ++counter < LOOPS ) { + diag_printf( "--------- counter %d ---------\n", counter ); +#ifdef CYGHWR_NET_DRIVER_ETH0 + tdhcp_do_one( 0 ); +#endif // CYGHWR_NET_DRIVER_ETH0 +#ifdef CYGHWR_NET_DRIVER_ETH1 + tdhcp_do_one( 1 ); +#endif // CYGHWR_NET_DRIVER_ETH1 + +#ifdef CYGHWR_NET_DRIVER_ETH0 + tdhcp_updown_one( 0 ); +#endif // CYGHWR_NET_DRIVER_ETH0 +#ifdef CYGHWR_NET_DRIVER_ETH1 + tdhcp_updown_one( 1 ); +#endif // CYGHWR_NET_DRIVER_ETH1 + +#ifdef CYGHWR_NET_DRIVER_ETH0 + tdhcp_release_one( 0 ); +#endif // CYGHWR_NET_DRIVER_ETH0 +#ifdef CYGHWR_NET_DRIVER_ETH1 + tdhcp_release_one( 1 ); +#endif // CYGHWR_NET_DRIVER_ETH1 + } + CYG_TEST_PASS_EXIT( "All done" ); +#endif // CYGPKG_NET_DHCP +} + + +// ------------------------------------------------------------------------ + +#define NTHREADS 1 +#define STACKSIZE ( CYGNUM_HAL_STACK_SIZE_TYPICAL + 4096 ) + +static cyg_handle_t thread[NTHREADS]; +static cyg_thread thread_obj[NTHREADS]; +static char stack[NTHREADS][STACKSIZE]; + +void cyg_user_start(void) +{ + // Use the DHCP thread prio as provided even though we're not using the thread itself; + // This priroty should be right (lower than net thread prio) by default. + cyg_thread_create(CYGPKG_NET_DHCP_THREAD_PRIORITY, dhcp_if_fn, (cyg_addrword_t) 0, "dhcp", + (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]); + cyg_thread_resume(thread[0]); +} + +// ------------------------------------------------------------------------ + +// EOF dhcp_test2.c diff --git a/packages/net/common/current/tests/flood.c b/packages/net/common/current/tests/flood.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/flood.c @@ -0,0 +1,393 @@ +//========================================================================== +// +// tests/flood.c +// +// Flood PING test +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas, hmt +// Contributors: gthomas +// Date: 2000-05-03 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists +#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME +#endif + +#ifdef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS // do we use the rt test? +# ifdef CYGTST_DEVS_ETH_TEST_NET_REALTIME // Get the test ancilla if it exists +# include CYGTST_DEVS_ETH_TEST_NET_REALTIME +# endif +#endif + + +// Fill in the blanks if necessary +#ifndef TNR_OFF +# define TNR_OFF() +#endif +#ifndef TNR_ON +# define TNR_ON() +#endif +#ifndef TNR_INIT +# define TNR_INIT() +#endif +#ifndef TNR_PRINT_ACTIVITY +# define TNR_PRINT_ACTIVITY() +#endif + + +// FLOOD PING test code + +#include + +#define MAX_PACKET 4096 + +#define NUMTHREADS 3 +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + MAX_PACKET + MAX_PACKET + 0x1000) +static char thread_stack[NUMTHREADS][STACK_SIZE]; +static cyg_thread thread_data[NUMTHREADS]; +static cyg_handle_t thread_handle[NUMTHREADS]; + +#define DO_DUMPSTATS( seq ) (0 == (0xffff & seq)) + +#ifdef CYGHWR_NET_DRIVER_ETH0 +struct sockaddr_in host0; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 +struct sockaddr_in host1; +#endif +static int sock; + +static int uniqueid[3] = { 0x1234, 0x4321, 0xdead }; + +static int ok_recv[3] = { 0,0,0 }; +static int bogus_recv[3] = { 0,0,0 }; +static int pings_sent[3] = { 0,0,0 }; + +extern void cyg_kmem_print_stats( void ); + +extern void +cyg_test_exit(void); + +void +pexit(char *s) +{ + perror(s); + cyg_test_exit(); +} + +// ------------------------------------------------------------------------ +static void dumpstats(void) +{ + TNR_OFF(); + diag_printf( "------------------------\n" ); +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) { + diag_printf("%16s: Sent %d packets, received %d OK, %d bad\n", + inet_ntoa(host0.sin_addr), pings_sent[0], + ok_recv[0], bogus_recv[0]); + } +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if (eth1_up) { + diag_printf("%16s: Sent %d packets, received %d OK, %d bad\n", + inet_ntoa(host1.sin_addr), pings_sent[1], + ok_recv[1], bogus_recv[1]); + } +#endif + if ( pings_sent[2] ) + diag_printf("Wierd! %d unknown sends!\n", pings_sent[2] ); + if ( ok_recv[2] ) + diag_printf("Wierd! %d unknown good recvs!\n", ok_recv[2] ); + if ( bogus_recv[2] ) + diag_printf("Wierd! %d unknown bogus recvs!\n", bogus_recv[2] ); + cyg_kmem_print_stats(); + diag_printf( "------------------------\n" ); + TNR_ON(); +} + + +// ------------------------------------------------------------------------ +// Compute INET checksum +int +inet_cksum(u_short *addr, int len) +{ + register int nleft = len; + register u_short *w = addr; + register u_short answer; + register u_int sum = 0; + u_short odd_byte = 0; + + /* + * Our algorithm is simple, using a 32 bit accumulator (sum), + * we add sequential 16 bit words to it, and at the end, fold + * back all the carry bits from the top 16 bits into the lower + * 16 bits. + */ + while( nleft > 1 ) { + sum += *w++; + nleft -= 2; + } + + /* mop up an odd byte, if necessary */ + if( nleft == 1 ) { + *(u_char *)(&odd_byte) = *(u_char *)w; + sum += odd_byte; + } + + /* + * add back carry outs from top 16 bits to low 16 bits + */ + sum = (sum >> 16) + (sum & 0x0000ffff); /* add hi 16 to low 16 */ + sum += (sum >> 16); /* add carry */ + answer = ~sum; /* truncate to 16 bits */ + return (answer); +} + +// ------------------------------------------------------------------------ +static void +show_icmp(unsigned char *pkt, int len, struct sockaddr_in *from) +{ + cyg_tick_count_t *tp, tv; + struct ip *ip; + struct icmp *icmp; + int which = 2; + tv = cyg_current_time(); +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up && (from->sin_addr.s_addr == host0.sin_addr.s_addr) ) + which = 0; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if (eth1_up && (from->sin_addr.s_addr == host1.sin_addr.s_addr) ) + which = 1; +#endif + + ip = (struct ip *)pkt; + if ((len < sizeof(*ip)) || ip->ip_v != IPVERSION) { + diag_printf("%s: Short packet or not IP! - Len: %d, Version: %d\n", + inet_ntoa(from->sin_addr), len, ip->ip_v); + bogus_recv[which]++; + return; + } + icmp = (struct icmp *)(pkt + sizeof(*ip)); + len -= (sizeof(*ip) + 8); + tp = (cyg_tick_count_t *)&icmp->icmp_data; + if (icmp->icmp_type != ICMP_ECHOREPLY) { + diag_printf("%s: Invalid ICMP - type: %d\n", + inet_ntoa(from->sin_addr), icmp->icmp_type); + bogus_recv[which]++; + return; + } + ok_recv[which]++; + if (icmp->icmp_id != uniqueid[which]) { + diag_printf("%s: ICMP received for wrong id - sent: %x, recvd: %x\n", + inet_ntoa(from->sin_addr), uniqueid[which], icmp->icmp_id); + } +// diag_printf("%d bytes from %s: ", len, inet_ntoa(from->sin_addr)); +// diag_printf("icmp_seq=%d", icmp->icmp_seq); +// diag_printf(", time=%dms\n", (int)(tv - *tp)*10); +} + +// ------------------------------------------------------------------------ +static void +floodrecv(cyg_addrword_t p) +{ + unsigned char pkt[MAX_PACKET]; + struct sockaddr_in from; + int len, fromlen; + + diag_printf("PING listener...\n" ); + for (;;) { + // Wait for a response + fromlen = sizeof(from); + len = recvfrom(sock, pkt, sizeof(pkt), 0, + (struct sockaddr *)&from, &fromlen); + if (len < 0) + perror("recvfrom"); + else + show_icmp(pkt, len, &from); + } +} + +// ------------------------------------------------------------------------ +static void +pingsend( int seq, struct sockaddr_in *host, + struct icmp *icmp, int icmp_len, int which ) +{ + cyg_tick_count_t *tp; + long *dp; + int i; + // Build ICMP packet for interface + icmp->icmp_type = ICMP_ECHO; + icmp->icmp_code = 0; + icmp->icmp_cksum = 0; + icmp->icmp_seq = seq; + icmp->icmp_id = uniqueid[which]; + // Set up ping data + tp = (cyg_tick_count_t *)&icmp->icmp_data; + *tp++ = cyg_current_time(); + dp = (long *)tp; + for (i = sizeof(*tp); i < icmp_len; i += sizeof(*dp)) + *dp++ = i; + + // Add checksum + icmp->icmp_cksum = inet_cksum( (u_short *)icmp, icmp_len+8); + // Send it off + if (sendto(sock, icmp, icmp_len+8, MSG_DONTWAIT, + (struct sockaddr *)host, sizeof(*host)) < 0) { + perror("sendto"); + } + pings_sent[which]++; +} + +// ------------------------------------------------------------------------ +static void +floodsend(cyg_addrword_t param) +{ + unsigned char pkt0[MAX_PACKET], pkt1[MAX_PACKET]; + + struct icmp *icmp0 = (struct icmp *)pkt0; + struct icmp *icmp1 = (struct icmp *)pkt1; + + int icmp_len = 64; + int seq; + + for (seq = 0; 1 ; seq++) { + if ( DO_DUMPSTATS( seq ) ) + dumpstats(); + +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) + pingsend( seq, &host0, icmp0, icmp_len, 0 ); +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if (eth1_up) + pingsend( seq, &host1, icmp1, icmp_len, 1 ); +#endif + } +} + + +// ------------------------------------------------------------------------ +void +net_test(cyg_addrword_t param) +{ + struct protoent *p; + + diag_printf("Start Flood PING test\n"); + init_all_network_interfaces(); + diag_printf("Interfaces up:\n"); + cyg_kmem_print_stats(); + + TNR_INIT(); + + if ((p = getprotobyname("icmp")) == (struct protoent *)0) { + perror("getprotobyname"); + return; + } + sock = socket(AF_INET, SOCK_RAW, p->p_proto); + if (sock < 0) { + perror("tx socket"); + return; + } + +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) { + host0.sin_family = AF_INET; + host0.sin_len = sizeof(host0); + host0.sin_addr = eth0_bootp_data.bp_siaddr; + host0.sin_port = 0; + diag_printf("PING server %16s\n", inet_ntoa(host0.sin_addr)); + } +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if (eth1_up) { + host1.sin_family = AF_INET; + host1.sin_len = sizeof(host1); + host1.sin_addr = eth1_bootp_data.bp_siaddr; + host1.sin_port = 0; + diag_printf("PING server %16s\n", inet_ntoa(host1.sin_addr)); + } +#endif + + cyg_thread_resume(thread_handle[1]); + cyg_thread_resume(thread_handle[2]); + + cyg_thread_delay( 100 ); // let the other threads start and print + + TNR_ON(); // then enable the test + + cyg_thread_delay( 12000 ); // run for a couple of minutes + + TNR_OFF(); + + diag_printf("After running:\n"); + dumpstats(); + TNR_PRINT_ACTIVITY(); + cyg_test_exit(); +} + +// ------------------------------------------------------------------------ +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &thread_stack[0][0], // Stack + STACK_SIZE, // Size + &thread_handle[0], // Handle + &thread_data[0] // Thread data structure + ); + cyg_thread_resume(thread_handle[0]); // Start it + + // Create the secondary threads + cyg_thread_create(11, // Priority - just a number + floodrecv, // entry + 0, // entry parameter + "Flood Ping Recv", // Name + &thread_stack[1][0], // Stack + STACK_SIZE, // Size + &thread_handle[1], // Handle + &thread_data[1] // Thread data structure + ); + cyg_thread_create(12, // Priority - just a number + floodsend, // entry + 0, // entry parameter + "Flood Ping Send", // Name + &thread_stack[2][0], // Stack + STACK_SIZE, // Size + &thread_handle[2], // Handle + &thread_data[2] // Thread data structure + ); + + + cyg_scheduler_start(); +} + +// EOF flood.c + diff --git a/packages/net/common/current/tests/ftp_test.c b/packages/net/common/current/tests/ftp_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/ftp_test.c @@ -0,0 +1,170 @@ +//========================================================================== +// +// tests/ftp_test.c +// +// Simple FTP test +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== +// FTP test code + +#include + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +extern void +cyg_test_exit(void); + +void +pexit(char *s) +{ + perror(s); + cyg_test_exit(); +} + +static void +ftp_test(struct bootp *bp) +{ + int s, len, slen; + struct sockaddr_in host, local; + struct servent *sent; + char buf[256]; + char _USER[] = "USER anonymous\r\n"; + char _PASS[] = "PASS none@abc.com\r\n"; + char _QUIT[] = "QUIT\r\n"; + + s = socket(AF_INET, SOCK_STREAM, 0); + if (s < 0) { + pexit("stream socket"); + } + sent = getservbyname("ftp", "tcp"); + if (sent == (struct servent *)0) { + pexit("getservbyname"); + } + // Set up host address + host.sin_family = AF_INET; + host.sin_len = sizeof(host); + host.sin_addr = bp->bp_siaddr; + host.sin_port = sent->s_port; // Network order already + if (connect(s, (struct sockaddr *)&host, sizeof(host)) < 0) { + pexit("connect"); + } + len = sizeof(local); + if (getsockname(s, (struct sockaddr *)&local, &len) < 0) { + pexit("getsockname"); + } + diag_printf("connected to %s.%d", inet_ntoa(host.sin_addr), ntohs(host.sin_port)); + diag_printf(" as %s.%d\n", inet_ntoa(local.sin_addr), ntohs(local.sin_port)); + if ((len = read(s, buf, sizeof(buf))) < 0) { + pexit("read 1"); + } + buf[len] = '\0'; + diag_printf(">> %s", buf); + // Try and log in as 'anonymous' + slen = strlen(_USER); + if ((len = write(s, _USER, slen)) != slen) { + if (len < 0) { + pexit("write 1"); + } else { + diag_printf("wrote only %d bytes\n", len); + } + } + if ((len = read(s, buf, sizeof(buf))) < 0) { + pexit("read 1"); + } + buf[len] = '\0'; + diag_printf(">> %s", buf); + slen = strlen(_PASS); + if ((len = write(s, _PASS, slen)) != slen) { + if (len < 0) { + pexit("write 1"); + } else { + diag_printf("wrote only %d bytes\n", len); + } + } + if ((len = read(s, buf, sizeof(buf))) < 0) { + pexit("read 2"); + } + buf[len] = '\0'; + diag_printf(">> %s", buf); + slen = strlen(_QUIT); + if ((len = write(s, _QUIT, slen)) != slen) { + if (len < 0) { + pexit("write 1"); + } else { + diag_printf("wrote only %d bytes\n", len); + } + } + while ((len = read(s, buf, sizeof(buf))) > 0) { + buf[len] = '\0'; + diag_printf(">> %s", buf); + } + if (len < 0) { + perror("read 3"); + } + close(s); +} + +void +net_test(cyg_addrword_t param) +{ + diag_printf("Start FTP test\n"); + init_all_network_interfaces(); +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) { + ftp_test(ð0_bootp_data); + } +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if (eth1_up) { + ftp_test(ð1_bootp_data); + } +#endif + cyg_test_exit(); +} + +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} diff --git a/packages/net/common/current/tests/ga_server_test.c b/packages/net/common/current/tests/ga_server_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/ga_server_test.c @@ -0,0 +1,185 @@ +//========================================================================== +// +// tests/server_test.c +// +// Simple TCP 'server' test - using getaddrinfo() +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2002-03-05 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== +// Network server test code +#include +#include +#include + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +extern void +cyg_test_exit(void); + +void +pexit(char *s) +{ + perror(s); + cyg_test_exit(); +} + +#define MAXSOCK 16 +static void +server_test(struct bootp *bp) +{ + int sock_indx, i, s, socks[MAXSOCK], client, client_len; + struct sockaddr client_addr; + char buf[256], addr_buf[256]; + char host_addr_buf[256], host_port_buf[32]; + int one = 1; + fd_set in_fds, src_fds; + int num, len; + struct timeval tv; + struct addrinfo *ai, *addrs, hints; + int err, last_sock; + + bzero(&hints, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + if ((err = getaddrinfo(NULL, "7734", &hints, &addrs)) != EAI_NONE) { + diag_printf("can't getaddrinfo(): %s\n", gai_strerror(err)); + pexit("getaddrinfo failed"); + } + sock_indx = 0; last_sock = -1; + ai = addrs; + while (ai) { + _inet_ntop(ai->ai_addr, addr_buf, sizeof(addr_buf)); + diag_printf("Family: %d, Socket: %d, Addr: %s\n", ai->ai_family, ai->ai_socktype, addr_buf); + s = socket(ai->ai_family, ai->ai_socktype, 0); + if (s < 0) { + pexit("stream socket"); + } + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + pexit("setsockopt SO_REUSEADDR"); + } + if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { + pexit("setsockopt SO_REUSEPORT"); + } + if(bind(s, ai->ai_addr, ai->ai_addr->sa_len) < 0) { + pexit("bind error"); + } + listen(s, SOMAXCONN); + socks[sock_indx++] = s; + if (sock_indx >= MAXSOCK) { + pexit("Too many address types"); + } + ai = ai->ai_next; + if (s > last_sock) last_sock = s; + } + while (true) { + // Wait for some activity on one of the ports + FD_ZERO(&src_fds); + for (s = 0; s < sock_indx; s++) { + FD_SET(socks[s], &src_fds); + } + num = select(last_sock+1, &src_fds, 0, 0, 0); + if (num > 0) { + // There are 'num' sockets ready to connect + for (i = 0; i < sock_indx; i++) { + s = socks[i]; + if (FD_ISSET(s, &src_fds)) { + client_len = sizeof(client_addr); + if ((client = accept(s, (struct sockaddr *)&client_addr, &client_len)) < 0) { + pexit("accept"); + } + client_len = sizeof(client_addr); + getpeername(client, &client_addr, &client_len); + if (getnameinfo (&client_addr, client_len, + host_addr_buf, sizeof(host_addr_buf), + host_port_buf, sizeof(host_port_buf), 0) == EAI_NONE) { + diag_printf("connection from %s(%s)\n", host_addr_buf, host_port_buf); + diag_sprintf(buf, "Hello %s(%s)\n", host_addr_buf, host_port_buf); + } else { + _inet_ntop(&client_addr, addr_buf, sizeof(addr_buf)); + diag_printf("connection from %s(%d)\n", addr_buf, _inet_port(&client_addr)); + diag_sprintf(buf, "Hello %s(%d)\n", addr_buf, _inet_port(&client_addr)); + } + write(client, buf, strlen(buf)); + tv.tv_sec = 5; + tv.tv_usec = 0; + FD_ZERO(&in_fds); + FD_SET(client, &in_fds); + num = select(client+1, &in_fds, 0, 0, &tv); + if (num > 0) { + len = read(client, buf, sizeof(buf)-1); + buf[len-1] = '\0'; // Trim \n + diag_printf("buf = '%s'\n", buf); + } else if (num == 0) { + diag_printf("No reply - timed out\n"); + } else { + perror("select"); + } + close(client); + } + } + } else { + diag_printf("select returned: %d\n", num); + pexit("bad select"); + } + } +} + +void +net_test(cyg_addrword_t param) +{ + diag_printf("Start SERVER test\n"); + init_all_network_interfaces(); +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) { + server_test(ð0_bootp_data); + } +#endif + cyg_test_exit(); +} + +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} diff --git a/packages/net/common/current/tests/ipv6_server_test.c b/packages/net/common/current/tests/ipv6_server_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/ipv6_server_test.c @@ -0,0 +1,145 @@ +//========================================================================== +// +// tests/ipv6_server_test.c +// +// Simple TCP 'server' test - modified for IPv6 +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== +// Network server test code +#include +#include +#include + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +extern void +cyg_test_exit(void); + +void +pexit(char *s) +{ + perror(s); + cyg_test_exit(); +} + +static void +server_test(struct bootp *bp) +{ + int s, client, client_len; + struct sockaddr_in6 client_addr, local; + char buf[256], addr_buf[256]; + int one = 1; + fd_set in_fds; + int num, len; + struct timeval tv; + + s = socket(AF_INET6, SOCK_STREAM, 0); + if (s < 0) { + pexit("stream socket"); + } + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + pexit("setsockopt SO_REUSEADDR"); + } + if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { + pexit("setsockopt SO_REUSEPORT"); + } + memset(&local, 0, sizeof(local)); + local.sin6_family = AF_INET6; + local.sin6_len = sizeof(local); + local.sin6_port = htons(7734); + local.sin6_addr = in6addr_any; + if(bind(s, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind error"); + } + listen(s, SOMAXCONN); + while (true) { + client_len = sizeof(client_addr); + if ((client = accept(s, (struct sockaddr *)&client_addr, &client_len)) < 0) { + pexit("accept"); + } + client_len = sizeof(client_addr); + getpeername(client, (struct sockaddr *)&client_addr, &client_len); + inet_ntop(AF_INET6, (char *)&client_addr.sin6_addr, addr_buf, sizeof(addr_buf)); + diag_printf("connection from %s:%d\n", addr_buf, ntohs(client_addr.sin6_port)); + diag_sprintf(buf, "Hello %s:%d\n", addr_buf, ntohs(client_addr.sin6_port)); + write(client, buf, strlen(buf)); + tv.tv_sec = 5; + tv.tv_usec = 0; + FD_ZERO(&in_fds); + FD_SET(client, &in_fds); + num = select(client+1, &in_fds, 0, 0, &tv); + if (num > 0) { + len = read(client, buf, sizeof(buf)-1); + buf[len] = '\0'; + diag_printf("buf = '%s'\n", buf); + } else if (num == 0) { + diag_printf("No reply - timed out\n"); + } else { + perror("select"); + } + sprintf(buf, "Thanks, bye now!\n"); + write(client, buf, strlen(buf)); + close(client); + } + close(s); +} + +void +net_test(cyg_addrword_t param) +{ + diag_printf("Start SERVER test\n"); + init_all_network_interfaces(); +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) { + server_test(ð0_bootp_data); + } +#endif + cyg_test_exit(); +} + +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} diff --git a/packages/net/common/current/tests/linux_echo.c b/packages/net/common/current/tests/linux_echo.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/linux_echo.c @@ -0,0 +1,281 @@ +//========================================================================== +// +// tests/linux_echo.c +// +// Simple TCP throughput test - echo component FOR LINUX HOST +// * CAUTION: host, i.e. non eCos, only * +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: This is the middle part of a three part test. The idea is +// to test the throughput of box in a configuration like this: +// +// +------+ port +----+ port +----+ +// |SOURCE|=========>|ECHO|============>|SINK| +// +------+ 9990 +----+ 9991 +----+ +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#undef _KERNEL +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define true 1 +#define false 1 + +#define TNR_ON() +#define TNR_OFF() + +#define diag_printf printf + +void +pexit(char *s) +{ + perror(s); + exit(1); +} + + +#define SOURCE_PORT 9990 +#define SINK_PORT 9991 + +#define MAX_BUF 8192 +static unsigned char data_buf[MAX_BUF]; + +struct test_params { + long nbufs; + long bufsize; + long load; +}; + +struct test_status { + long ok; +}; + +int max( int a, int b ) { return (a>b)?a:b; } +int min( int a, int b ) { return (a +#include + +#include +#include + +void +cyg_start(void) +{ + int i; + struct mbuf *m[32]; + diag_printf("Start mbuf test\n"); + + for (i = 0; i < 32; i++) { + m[i] = m_get(M_DONTWAIT, MT_DATA); + diag_printf("allocate mbuf = %x\n", m[i]); + } + + cyg_test_exit(); +} diff --git a/packages/net/common/current/tests/multi_lo_select.c b/packages/net/common/current/tests/multi_lo_select.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/multi_lo_select.c @@ -0,0 +1,446 @@ +//========================================================================== +// +// tests/multi_lo_test.c +// +// Multiple selects-at-one-time test, using lo for portability. +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): sorin@netappi.com, hmt +// Contributors: gthomas,sorin@netappi.com +// Date: 2000-05-24 +// Description: +// +// This test is to test that the internal producer operation to select +// truly has broadcast semantics; there was a bug in there whereby it +// doesn't, so events get lost and/or the wrong thread is awakened. +// +// We need to create N threads selecting on different sockets +// (different ports) (including one or two selecting on several +// sockets) and have a further thread or threads which send data to +// the those sockets in an order "random" with respect to the order in +// which the N selectors entered the wait, and their thread +// priorities. +// +// If this all works, then we know that select always wakes the right +// thread in the right order. I think... +// +// I think 10 threads 0-9 where #2,#3,#6,#7 wait for multiple threads +// will do it. #0-4 will be prio HI, #5-9 will be prio LO. Sender +// thread A at prio MID will send to sockets 1,3,5,7,9. Sender thread +// B at prio LOWEST will send to sockets 0,2,4,6,8. +// +// Each sender thread will wait for a different semaphore signal +// before doing their next send, thus confirming correct ordering. +// Two common semaphores will also be signalled, one when a send +// occurs, the other when a recv happens. +// +// The master thread will start off VERYHIGHPRI, then drop after +// starting all the others, to VERYLOW... when it next runs, those +// common semaphores should both have value 10 == NLISTENERS. +// +// +//#####DESCRIPTIONEND##### +// +//========================================================================== + +#include + +#include + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#define SOURCE_PORT1 9900 +#define SOURCE_PORT2 9800 // for those who listen to multiple ports +#define SOURCE_PORT3 9700 // for the dummy consumers of events + +#define PRIO_DUMMY 4 // Really high, so they're always right back there + +#define PRIO_LISTENER_HI 10 +#define PRIO_LISTENER_LO 15 + +#define PRIO_SENDER_MID 12 +#define PRIO_SENDER_LOW 17 + +#define PRIO_MASTERHIGH 3 +#define PRIO_MASTERLOW 25 + +#ifndef CYGPKG_IO_FILEIO +#if CYGPKG_IO_NFILE > 30 +#define NLISTENERS 10 +#else +// fewer threads if not many sockets available +#define NLISTENERS (CYGPKG_IO_NFILE/3) +#endif +#else +#if CYGNUM_FILEIO_NFD > 30 +#define NLISTENERS 10 +#else +// fewer threads if not many sockets available +#define NLISTENERS (CYGNUM_FILEIO_NFD/3) +#endif +#endif + +#define NDUMMIES 10 + +#define NSENDERS 2 + +#define NUM_BUF NLISTENERS +#define MAX_BUF 100 + +// buffers for receiving into: +static unsigned char data_buf1[NUM_BUF][MAX_BUF]; + +static unsigned char data_buf_write1[]="Client is alive"; + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL) +#define MASTER_STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) + +static char stack_master[MASTER_STACK_SIZE]; +static cyg_thread master_thread_data; +static cyg_handle_t master_thread_handle; + +static char stack_dummy[NDUMMIES][STACK_SIZE]; +static cyg_thread dummy_thread_data[NDUMMIES]; +static cyg_handle_t dummy_thread_handle[NDUMMIES]; + +static char stack_listener[NLISTENERS][STACK_SIZE]; +static cyg_thread listener_thread_data[NLISTENERS]; +static cyg_handle_t listener_thread_handle[NLISTENERS]; + +static char stack_sender[NSENDERS][STACK_SIZE]; +static cyg_thread sender_thread_data[NSENDERS]; +static cyg_handle_t sender_thread_handle[NSENDERS]; + +static cyg_sem_t listen_sema[NLISTENERS]; + +static cyg_sem_t send_sema; +static cyg_sem_t recv_sema; + +static cyg_thread_entry_t master; +static cyg_thread_entry_t listener; +static cyg_thread_entry_t sender; + +// ------------------------------------------------------------------------ + +void +pexit(char *s) +{ + CYG_TEST_FAIL_FINISH( s ); +} + + +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +// ------------------------------------------------------------------------ + +void dummy( cyg_addrword_t which ) +{ + // Share the same socket... we appear to run out otherwise. + static int s_s1 = -1; + static struct sockaddr_in local; + + // locals... + fd_set in_fds; + int num; + + CYG_TEST_CHECK( 0 <= which, "which under" ); + CYG_TEST_CHECK( NDUMMIES > which, "which over" ); + + diag_printf( "Dummy %d alive\n", which ); + + if ( s_s1 < 0 ) { + s_s1 = socket(AF_INET, SOCK_STREAM, 0); + if (s_s1 < 0) { + pexit("stream socket 1"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = ntohs(SOURCE_PORT3 + which); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if(bind(s_s1, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("dummy bind /source_1/ error"); + } + listen(s_s1, SOMAXCONN); + } + + while (true) { + FD_ZERO(&in_fds); + FD_SET(s_s1, &in_fds); + num = select( s_s1+1, &in_fds,0,0,0); + + if (FD_ISSET(s_s1,&in_fds)) { + CYG_TEST_FAIL( "Activity on dummy port!" ); + } + } /* while (true) */ +} + +// ------------------------------------------------------------------------ + +void listener( cyg_addrword_t which ) +{ + int s_s1 = -1, e_s1 = 0, s_s2 = -1, e_s2 = 0; + struct sockaddr_in e_s1_addr,e_s2_addr,local; + fd_set in_fds; + int len; + int num; + + // do we select on multiple sources? + int dual = (3 == (which & 3)) || (2 == (which & 3)); + // then which is 2,3,6,7 so set up a 2nd listener + + CYG_TEST_CHECK( 0 <= which, "which under" ); + CYG_TEST_CHECK( NLISTENERS > which, "which over" ); + + diag_printf( "Listener %d alive [%s]\n", which, dual ? "dual" : "single" ); + + s_s1 = socket(AF_INET, SOCK_STREAM, 0); + if (s_s1 < 0) { + pexit("stream socket 1"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = ntohs(SOURCE_PORT1 + which); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if(bind(s_s1, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind /source_1/ error"); + } + listen(s_s1, SOMAXCONN); + + if ( dual ) { + s_s2 = socket(AF_INET, SOCK_STREAM, 0); + if (s_s2 < 0) { + pexit("stream socket 2"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = ntohs(SOURCE_PORT2 + which); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if(bind(s_s2, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind /source_2/ error"); + } + listen(s_s2, SOMAXCONN); + } + + while (true) { + FD_ZERO(&in_fds); + FD_SET(s_s1, &in_fds); + if ( dual ) + FD_SET(s_s2, &in_fds); + num = select ( max(s_s1,s_s2)+1, &in_fds,0,0,0); + + if (FD_ISSET(s_s1,&in_fds)) { + len = sizeof(e_s1_addr); + if ((e_s1 = accept(s_s1,(struct sockaddr *)&e_s1_addr,&len))<0) { + pexit("accept /source_1/"); + } + diag_printf("TCP SERVER connection from %s: %d\n", + inet_ntoa(e_s1_addr.sin_addr),ntohs(e_s1_addr.sin_port)); + } + + if ( dual ) { + if (FD_ISSET(s_s2,&in_fds)) { + len = sizeof(e_s2_addr); + if ((e_s2 = accept(s_s2,(struct sockaddr *)&e_s2_addr,&len))<0) { + pexit("accept /source_2/"); + } + diag_printf("TCP SERVER connection from %s: %d\n", + inet_ntoa(e_s2_addr.sin_addr), ntohs(e_s2_addr.sin_port)); + } + } + if ((e_s1 != 0) || ( e_s2 != 0)) { + break; + } + } /* while (true) */ + + CYG_TEST_CHECK( 0 != e_s1, "No connection made on s1!" ); + + if ((len = read(e_s1, data_buf1[which], MAX_BUF)) < 0 ) { + perror("I/O error s1"); + CYG_TEST_FAIL( "Read s1 failed" ); + } + diag_printf("Listener %d: %s\n", which, data_buf1[which]); + + close( s_s1 ); + if ( dual ) + close( s_s2 ); + if ( 0 != e_s1 ) + close ( e_s1 ); + if ( 0 != e_s2 ) + close ( e_s2 ); + + cyg_semaphore_post( &listen_sema[which] ); // Verify that I was here + cyg_semaphore_post( &recv_sema ); // Count receptions + + cyg_thread_exit(); // explicitly +} + +// ------------------------------------------------------------------------ +static void sender( cyg_addrword_t which ) // which means which set (odd/even) here... +{ + int s_source; + struct sockaddr_in local; + int len; + + diag_printf("client %d [%s] :started\n", which, (which & 1) ? "odd" : "even" ); + + for ( /* which as is */; which < NLISTENERS; which += 2 ) { + + s_source = socket(AF_INET, SOCK_STREAM, 0); + if (s_source < 0) { + pexit("stream socket"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = htons( SOURCE_PORT1 + which ); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (connect(s_source, (struct sockaddr *)&local, sizeof(local)) < 0) { + pexit("Can't connect to target"); + } + + if ((len = write(s_source,data_buf_write1,sizeof(data_buf_write1) )) < 0) { + CYG_TEST_FAIL_FINISH("Error writing buffer"); + } + cyg_semaphore_wait( &listen_sema[which] ); // wait for the appropriate semaphore "reply" + cyg_semaphore_post( &send_sema ); // count up successful sends + + close ( s_source ); + } + cyg_thread_exit(); // explicitly +} + + +static void +master(cyg_addrword_t param) +{ + int i; + cyg_handle_t self = cyg_thread_self(); + + cyg_semaphore_init( &send_sema, 0 ); + cyg_semaphore_init( &recv_sema, 0 ); + + for ( i = 0 ; i < NLISTENERS; i++ ) + cyg_semaphore_init( &listen_sema[i], 0 ); + + init_all_network_interfaces(); + CYG_TEST_INFO("Start multiple loopback select test"); +#if NLOOP > 0 + // We are currently running at high prio, so we can just go and make + // loads of threads: + + // Some at higher prio + for ( i = 0; i < NLISTENERS/2; i++ ) + cyg_thread_create(PRIO_LISTENER_HI, // Priority + listener, // entry + i, // entry parameter + "listener", // Name + &stack_listener[i][0], // Stack + STACK_SIZE, // Size + &listener_thread_handle[i], // Handle + &listener_thread_data[i] // Thread data structure + ); + // the rest at lower prio + for ( ; i < NLISTENERS ; i++ ) + cyg_thread_create(PRIO_LISTENER_LO, // Priority + listener, // entry + i, // entry parameter + "listener", // Name + &stack_listener[i][0], // Stack + STACK_SIZE, // Size + &listener_thread_handle[i], // Handle + &listener_thread_data[i] // Thread data structure + ); + + // make the dummy event-grabber threads + for ( i = 0; i < NDUMMIES; i++ ) + cyg_thread_create(PRIO_DUMMY, // Priority + dummy, // entry + i, // entry parameter + "dummy", // Name + &stack_dummy[i][0], // Stack + STACK_SIZE, // Size + &dummy_thread_handle[i], // Handle + &dummy_thread_data[i] // Thread data structure + ); + + // Start those threads + for ( i = 0; i < NLISTENERS; i++ ) + cyg_thread_resume(listener_thread_handle[i]); + for ( i = 0; i < NDUMMIES; i++ ) + cyg_thread_resume( dummy_thread_handle[i]); + + // and let them start up and start listening... + cyg_thread_set_priority( self, PRIO_MASTERLOW ); + CYG_TEST_INFO("All listeners should be go now"); + cyg_thread_set_priority( self, PRIO_MASTERHIGH ); + + for ( i = 0; i < NSENDERS; i++ ) { + cyg_thread_create( (0 == i) + ?PRIO_SENDER_MID + : PRIO_SENDER_LOW, // Priority + sender, // entry + i, // entry parameter + "sender", // Name + &stack_sender[i][0], // Stack + STACK_SIZE, // Size + &sender_thread_handle[i], // Handle + &sender_thread_data[i] // Thread data structure + ); + cyg_thread_resume(sender_thread_handle[i]); + } + + // Now we are still higher priority; so go low and let everyone else + // have their head. When we next run after this, it should all be + // over. + cyg_thread_set_priority( self, PRIO_MASTERLOW ); + + cyg_semaphore_peek( &recv_sema, &i ); + CYG_TEST_CHECK( NLISTENERS == i, "Not enough recvs occurred!" ); + + cyg_semaphore_peek( &send_sema, &i ); + CYG_TEST_CHECK( NLISTENERS == i, "Not enough sends occurred!" ); + + CYG_TEST_PASS_FINISH("Master returned OK"); +#endif + CYG_TEST_NA( "No loopback devs" ); +} + +void +cyg_user_start(void) +{ + CYG_TEST_INIT(); + + cyg_thread_create(PRIO_MASTERHIGH, // Priority + master, // entry + 0, // entry parameter + "master", // Name + &stack_master[0], // Stack + MASTER_STACK_SIZE, // Size + &master_thread_handle, // Handle + &master_thread_data // Thread data structure + ); + cyg_thread_resume(master_thread_handle); // Start it +} + +// EOF multi_lo_select.c diff --git a/packages/net/common/current/tests/nc6_test_master.c b/packages/net/common/current/tests/nc6_test_master.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/nc6_test_master.c @@ -0,0 +1,833 @@ +//========================================================================== +// +// tests/nc6_test_master.c +// +// Network characterizations test (master portion) IPv4+IPv6 aware +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Network characterization test code - master portion + +#include "nc_test_framework.h" + +#ifdef __ECOS +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; +#endif + +struct test_params { + int argc; + char **argv; +}; + +#define MAX_BUF 32*1024 +static unsigned char in_buf[MAX_BUF], out_buf[MAX_BUF]; + +static int test_seq = 1; +static long long idle_count; +static long idle_ticks; +#define IDLE_TEST_TIME 10 + +struct pause { + int pause_ticks; + int pause_threshold; +}; +#define LENGTH(x) (sizeof(x)/sizeof(x[0])) + +#ifdef __ECOS +extern void +cyg_test_exit(void); +#else +void +cyg_test_exit(void) +{ + test_printf("... Done\n"); + exit(1); +} +#endif + +#ifdef __ECOS +static void +test_delay(int ticks) +{ + cyg_thread_delay(ticks); +} + +#else + +static void +test_delay(int ticks) +{ + usleep(ticks * 10000); +} +#endif + +void +pexit(char *s) +{ + perror(s); + cyg_test_exit(); +} + +#ifdef __ECOS +#ifndef CYGPKG_SNMPLIB +int +gettimeofday(struct timeval *tv, struct timezone *tz) +{ + cyg_tick_count_t cur_time; + cur_time = cyg_current_time(); + tv->tv_sec = cur_time / 100; + tv->tv_usec = (cur_time % 100) * 10000; +} +#else +int +gettimeofday(struct timeval *tv, struct timezone *tz); +#endif +#endif +void +show_results(const char *msg, struct timeval *start, + struct timeval *end, int nbufs, int buflen, + int lost, int seq_errors) +{ + struct timeval tot_time; +#ifndef __ECOS + double real_time, thru; + long tot_bytes = nbufs * buflen; +#endif + timersub(end, start, &tot_time); + test_printf("%s - %d bufs of %d bytes in %d.%02d seconds", + msg, nbufs, buflen, + tot_time.tv_sec, tot_time.tv_usec / 10000); +#ifndef __ECOS + real_time = tot_time.tv_sec + ((tot_time.tv_usec / 10000) * .01); + // Compute bytes / second (rounded up) + thru = tot_bytes / real_time; + // Convert to Mb / second + test_printf(" - %.2f KB/S", thru / 1024.0); + test_printf(" - %.4f Mbit/S (M = 10^6)", thru * 8.0 / 1000000.0); +#endif + if (lost) { + test_printf(", %d lost", lost); + } + if (seq_errors) { + test_printf(", %d out of sequence", seq_errors); + } + test_printf("\n"); +} + +void +new_test(void) +{ + test_seq++; +} + +static int +sa_len(struct sockaddr *sa) +{ + switch (sa->sa_family) { + case AF_INET: + return sizeof(struct sockaddr_in); + case AF_INET6: + return sizeof(struct sockaddr_in6); + default: + printf("Unknown socket type: %d\n", sa->sa_family); + return sizeof(struct sockaddr_storage); + } +} + +int +nc_message(int s, struct nc_request *req, + struct nc_reply *reply, struct sockaddr *slave) +{ + fd_set fds; + struct timeval timeout; + + req->seq = htonl(test_seq); + if (sendto(s, req, sizeof(*req), 0, slave, sa_len(slave)) < 0) { + perror("sendto"); + return false; + } + FD_ZERO(&fds); + FD_SET(s, &fds); + timeout.tv_sec = NC_REPLY_TIMEOUT; + timeout.tv_usec = 0; + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + test_printf("No response to command\n"); + return false; + } + if (recvfrom(s, reply, sizeof(*reply), 0, 0, 0) < 0) { + perror("recvfrom"); + return false; + } + if (reply->seq != req->seq) { + test_printf("Response out of order - sent: %d, recvd: %d\n", + ntohl(req->seq), ntohl(reply->seq)); + return false; + } + return true; +} + +void +show_test_results(struct nc_test_results *results) +{ + if ((ntohl(results->key1) == NC_TEST_RESULT_KEY1) && + (ntohl(results->key2) == NC_TEST_RESULT_KEY2) && + (ntohl(results->seq) == test_seq)) { + test_printf(" slave sent %d, recvd %d\n", + ntohl(results->nsent), ntohl(results->nrecvd)); + } else { + test_printf(" ... invalid results - keys: %x/%x, seq: %d/%d\n", + ntohl(results->key1), ntohl(results->key2), + ntohl(results->seq), test_seq); + } +} + +void +do_udp_test(int s1, int type, struct sockaddr *slave, + int nbufs, int buflen, int pause_time, int pause_threshold) +{ + int i, s, td_len, seq, seq_errors, total_packets; + struct sockaddr_storage test_chan_master, test_chan_slave; + struct timeval start_time, end_time; + struct nc_request req; + struct nc_reply reply; + struct nc_test_results results; + struct nc_test_data *tdp; + fd_set fds; + struct timeval timeout; + int lost_packets = 0; + int need_send, need_recv; + const char *type_name; + int pkt_ctr = 0; + + need_recv = true; need_send = true; type_name = "UDP echo"; + switch (type) { + case NC_REQUEST_UDP_RECV: + need_recv = false; + need_send = true; + type_name = "UDP recv"; + break; + case NC_REQUEST_UDP_SEND: + need_recv = true; + need_send = false; + type_name = "UDP send"; + break; + case NC_REQUEST_UDP_ECHO: + break; + } + + new_test(); + req.type = htonl(type); + req.nbufs = htonl(nbufs); + req.buflen = htonl(buflen); + req.slave_port = htonl(NC_TESTING_SLAVE_PORT); + req.master_port = htonl(NC_TESTING_MASTER_PORT); + nc_message(s1, &req, &reply, slave); + if (reply.response != ntohl(NC_REPLY_ACK)) { + test_printf("Slave denied %s [%d,%d] test\n", type_name, nbufs, buflen); + return; + } + + s = socket(slave->sa_family, SOCK_DGRAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + memset(&test_chan_master, 0, sizeof(test_chan_master)); + ((struct sockaddr *)&test_chan_master)->sa_family = slave->sa_family; + memcpy(&test_chan_slave, slave, sa_len(slave)); +#ifndef __linux + ((struct sockaddr *)&test_chan_master)->sa_len = slave->sa_len; +#endif + switch (slave->sa_family) { + case AF_INET: + ((struct sockaddr_in *)&test_chan_master)->sin_addr.s_addr = htonl(INADDR_ANY); + ((struct sockaddr_in *)&test_chan_master)->sin_port = htons(ntohl(req.master_port)); + ((struct sockaddr_in *)&test_chan_slave)->sin_port = htons(ntohl(req.slave_port)); + break; + case AF_INET6: + ((struct sockaddr_in6 *)&test_chan_master)->sin6_addr = in6addr_any; + ((struct sockaddr_in6 *)&test_chan_master)->sin6_port = htons(ntohl(req.master_port)); + ((struct sockaddr_in6 *)&test_chan_slave)->sin6_port = htons(ntohl(req.slave_port)); + break; + default: + pexit("strange TCP sockaddr"); + } + + if (bind(s, (struct sockaddr *)&test_chan_master, + sa_len((struct sockaddr *)&test_chan_master)) < 0) { + perror("UDP bind "); + close(s); + return; + } + test_printf("Start %s [%d,%d]", type_name, nbufs, buflen); + if (pause_time) { + test_printf(" - %dms delay after %d packet%s\n", pause_time*10, + pause_threshold, pause_threshold > 1 ? "s" : ""); + } else { + test_printf(" - no delays\n"); + } + + gettimeofday(&start_time, 0); + seq = 0; seq_errors = 0; total_packets = 0; + for (i = 0; i < nbufs; i++) { + td_len = buflen + sizeof(struct nc_test_data); + if (need_send) { + tdp = (struct nc_test_data *)out_buf; + tdp->key1 = htonl(NC_TEST_DATA_KEY1); + tdp->key2 = htonl(NC_TEST_DATA_KEY2); + tdp->seq = htonl(i); + tdp->len = htonl(td_len); + if (sendto(s, tdp, td_len, 0, + (struct sockaddr *)&test_chan_slave, + sa_len((struct sockaddr *)&test_chan_slave)) < 0) { + perror("sendto"); + close(s); + return; + } + total_packets++; + } + if (need_recv) { + FD_ZERO(&fds); + FD_SET(s, &fds); + timeout.tv_sec = NC_TEST_TIMEOUT; + timeout.tv_usec = 0; + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + test_printf("Slave timed out after %d buffers\n", i); + lost_packets++; + } else { + tdp = (struct nc_test_data *)in_buf; + if (recvfrom(s, tdp, td_len, 0, 0, 0) < 0) { + perror("recvfrom"); + close(s); + return; + } + if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && + (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { + if (ntohl(tdp->seq) != seq) { + test_printf("Packets out of sequence - recvd: %d, expected: %d\n", + ntohl(tdp->seq), seq); + seq_errors++; + if (!need_send) { + // Reset sequence to what the slave wants + seq = ntohl(tdp->seq); + } + } + } else { + test_printf("Bad data packet - key: %x/%x, seq: %d\n", + ntohl(tdp->key1), ntohl(tdp->key2), + ntohl(tdp->seq)); + } + total_packets++; + } + seq++; + if (seq == nbufs) { + break; + } + if (pause_time && (++pkt_ctr == pause_threshold)) { + pkt_ctr = 0; + test_delay(pause_time); + } + } + } + gettimeofday(&end_time, 0); + show_results(type_name, &start_time, &end_time, total_packets, buflen, + lost_packets, seq_errors); + // Fetch results record + FD_ZERO(&fds); + FD_SET(s, &fds); + timeout.tv_sec = NC_RESULTS_TIMEOUT; + timeout.tv_usec = 0; + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + test_printf("No results record sent\n"); + } else { + if (recvfrom(s, &results, sizeof(results), 0, 0, 0) < 0) { + perror("recvfrom"); + } + show_test_results(&results); + } + close(s); +} + +// +// Read data from a stream, accounting for the fact that packet 'boundaries' +// are not preserved. This can also timeout (which would probably wreck the +// data boundaries). +// + +int +do_read(int fd, void *buf, int buflen) +{ + char *p = (char *)buf; + int len = buflen; + int res; + while (len) { + res = read(fd, p, len); + if (res < 0) { + perror("read"); + } else { + len -= res; + p += res; + if (res == 0) { + break; + } + } + } + return (buflen - len); +} + +void +do_tcp_test(int s1, int type, struct sockaddr *slave, + int nbufs, int buflen, int pause_time, int pause_threshold) +{ + int i, s, td_len, tot_len, wlen, len, seq, seq_errors, total_packets, res; + struct sockaddr_storage test_chan_slave; + struct timeval start_time, end_time; + struct nc_request req; + struct nc_reply reply; + struct nc_test_results results; + struct nc_test_data *tdp; + int lost_packets = 0; + int conn_failures = 0; + int need_send, need_recv; + const char *type_name; + int pkt_ctr = 0; + unsigned char *dp; + + need_recv = true; need_send = true; type_name = "TCP echo"; + switch (type) { + case NC_REQUEST_TCP_RECV: + need_recv = false; + need_send = true; + type_name = "TCP recv"; + break; + case NC_REQUEST_TCP_SEND: + need_recv = true; + need_send = false; + type_name = "TCP send"; + break; + case NC_REQUEST_TCP_ECHO: + break; + } + + new_test(); + req.type = htonl(type); + req.nbufs = htonl(nbufs); + req.buflen = htonl(buflen); + req.slave_port = htonl(NC_TESTING_SLAVE_PORT); + req.master_port = htonl(NC_TESTING_MASTER_PORT); + nc_message(s1, &req, &reply, slave); + if (reply.response != ntohl(NC_REPLY_ACK)) { + test_printf("Slave denied %s [%d,%d] test\n", type_name, nbufs, buflen); + return; + } + + s = socket(slave->sa_family, SOCK_STREAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + test_printf("Start %s [%d,%d]", type_name, nbufs, buflen); + if (pause_time) { + test_printf(" - %dms delay after %d packet%s\n", pause_time*10, + pause_threshold, pause_threshold > 1 ? "s" : ""); + } else { + test_printf(" - no delays\n"); + } + + test_delay(3*100); + memcpy(&test_chan_slave, slave, sa_len(slave)); + switch (slave->sa_family) { + case AF_INET: + ((struct sockaddr_in *)&test_chan_slave)->sin_port = htons(ntohl(req.slave_port)); + break; + case AF_INET6: + ((struct sockaddr_in6 *)&test_chan_slave)->sin6_port = htons(ntohl(req.slave_port)); + break; + default: + pexit("strange TCP sockaddr"); + } + while (connect(s, (struct sockaddr *)&test_chan_slave, sa_len(slave)) < 0) { + perror("Can't connect to slave"); + if (++conn_failures > MAX_ERRORS) { + test_printf("Too many connection failures - giving up\n"); + return; + } + if (errno == ECONNREFUSED) { + // Give the slave a little time + test_delay(100); // 1 second + } else { + return; + } + } + + gettimeofday(&start_time, 0); + seq = 0; seq_errors = 0; total_packets = 0; + for (i = 0; i < nbufs; i++) { + td_len = buflen + sizeof(struct nc_test_data); + if (need_send) { + tdp = (struct nc_test_data *)out_buf; + tdp->key1 = htonl(NC_TEST_DATA_KEY1); + tdp->key2 = htonl(NC_TEST_DATA_KEY2); + tdp->seq = htonl(i); + tdp->len = htonl(td_len); + tot_len = 0; + dp = (unsigned char *)tdp; + while (tot_len < td_len) { + len = td_len - tot_len; + if ((wlen = write(s, dp, len)) != len) { + if (wlen < 0) { + test_printf("Slave connection broken\n"); + perror("write"); + close(s); + return; + } else { + test_printf("block: %d, short write - only %d of %d\n", + total_packets, wlen, len); + } + } + tot_len += wlen; + dp += wlen; + } + total_packets++; + } + if (need_recv) { + tdp = (struct nc_test_data *)in_buf; + res = do_read(s, tdp, td_len); + if (res != td_len) { + lost_packets++; + if (res < 0) { + test_printf("Slave connection broken\n"); + perror("read"); + break; + } else { + test_printf("Slave timed out after %d buffers [read %d bytes]\n", i, res); + } + } else { + if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && + (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { + if (ntohl(tdp->seq) != seq) { + test_printf("Packets out of sequence - recvd: %d, expected: %d\n", + ntohl(tdp->seq), seq); + seq_errors++; + if (!need_send) { + // Reset sequence to what the slave wants + seq = ntohl(tdp->seq); + } + } + } else { + test_printf("Bad data packet - key: %x/%x, seq: %d\n", + ntohl(tdp->key1), ntohl(tdp->key2), + ntohl(tdp->seq)); + } + total_packets++; + } + seq++; + if (seq == nbufs) { + break; + } + if (pause_time && (++pkt_ctr == pause_threshold)) { + pkt_ctr = 0; + test_delay(pause_time); + } + } + } + gettimeofday(&end_time, 0); + show_results(type_name, &start_time, &end_time, total_packets, buflen, + lost_packets, seq_errors); + // Fetch results record + if (do_read(s, &results, sizeof(results)) != sizeof(results)) { + test_printf("No results record sent\n"); + } else { + show_test_results(&results); + } + close(s); +} + +int +do_set_load(int s, struct sockaddr *slave, int load_level) +{ + struct nc_request req; + struct nc_reply reply; + req.type = htonl(NC_REQUEST_SET_LOAD); + req.nbufs = htonl(load_level); + nc_message(s, &req, &reply, slave); + return (reply.response == ntohl(NC_REPLY_ACK)); +} + +int +do_start_idle(int s, struct sockaddr *slave) +{ + struct nc_request req; + struct nc_reply reply; + req.type = htonl(NC_REQUEST_START_IDLE); + nc_message(s, &req, &reply, slave); + return (reply.response == ntohl(NC_REPLY_ACK)); +} + +void +do_stop_idle(int s, struct sockaddr *slave, int calibrate) +{ + struct nc_request req; + struct nc_reply reply; + long long res_idle_count; + long long adj_count; + int idle, res_idle_ticks; + req.type = htonl(NC_REQUEST_STOP_IDLE); + nc_message(s, &req, &reply, slave); + if (reply.response == ntohl(NC_REPLY_ACK)) { + res_idle_ticks = ntohl(reply.misc.idle_results.elapsed_time); + res_idle_count = ((long long)ntohl(reply.misc.idle_results.count[0]) << 32) | + ntohl(reply.misc.idle_results.count[1]); + test_printf("IDLE - ticks: %d, count: %ld", + res_idle_ticks, res_idle_count); + if (calibrate) { + idle_count = res_idle_count; + idle_ticks = res_idle_ticks; + } else { + adj_count = res_idle_count / res_idle_ticks; + adj_count *= idle_ticks; + idle = (int) ((adj_count * 100) / idle_count); + test_printf(", %d%% idle", idle); + } + test_printf("\n"); + } else { + test_printf("Slave failed on IDLE\n"); + } +} + +void +do_disconnect(int s, struct sockaddr *slave) +{ + struct nc_request req; + struct nc_reply reply; + req.type = htonl(NC_REQUEST_DISCONNECT); + nc_message(s, &req, &reply, slave); +} + +static void +nc_master_test(struct sockaddr *slave, int test_tcp, int test_udp, + int test_slave_loads, int test_master_loads) +{ + int s, i; + struct sockaddr_storage my_addr; + struct pause pause_times[] = { + {0,0}, {1,10}, {5,10}, {10,10}, {1,1} }; + + + s = socket(slave->sa_family, SOCK_DGRAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + memset(&my_addr, 0, sizeof(my_addr)); + ((struct sockaddr *)&my_addr)->sa_family = slave->sa_family; +#ifndef __linux + ((struct sockaddr *)&my_addr)->sa_len = slave->sa_len; +#endif + switch (slave->sa_family) { + case AF_INET: + ((struct sockaddr_in *)&my_addr)->sin_addr.s_addr = htonl(INADDR_ANY); + ((struct sockaddr_in *)&my_addr)->sin_port = htons(NC_MASTER_PORT); + break; + case AF_INET6: + ((struct sockaddr_in6 *)&my_addr)->sin6_addr = in6addr_any; + ((struct sockaddr_in6 *)&my_addr)->sin6_port = htons(NC_MASTER_PORT); + break; + default: + pexit("strange sockaddr family"); + } + if (bind(s, (struct sockaddr *) &my_addr, sa_len((struct sockaddr *)&my_addr)) < 0) { + pexit("UDP bind
"); + } + + test_printf("================== No load, master at 100%% ========================\n"); + if (test_udp) { + do_udp_test(s, NC_REQUEST_UDP_ECHO, slave, 640, 1024, 0, 0); + do_udp_test(s, NC_REQUEST_UDP_SEND, slave, 640, 1024, 0, 0); + do_udp_test(s, NC_REQUEST_UDP_RECV, slave, 640, 1024, 0, 0); + } + if (test_tcp) { + do_tcp_test(s, NC_REQUEST_TCP_ECHO, slave, 640, 1024, 0, 0); + do_tcp_test(s, NC_REQUEST_TCP_SEND, slave, 640, 1024, 0, 0); + do_tcp_test(s, NC_REQUEST_TCP_RECV, slave, 640, 1024, 0, 0); + do_tcp_test(s, NC_REQUEST_TCP_ECHO, slave, 64, 10240, 0, 0); + } + + if (test_slave_loads) { + if (do_set_load(s, slave, 0)) { + test_printf("\n====================== Various slave compute loads ===================\n"); + for (i = 0; i < 60; i += 10) { + test_printf(">>>>>>>>>>>> slave processing load at %d%%\n", i); + do_set_load(s, slave, i); + if (test_udp) { + do_udp_test(s, NC_REQUEST_UDP_ECHO, slave, 2048, 1024, 0, 0); + } + if (test_tcp) { + do_tcp_test(s, NC_REQUEST_TCP_ECHO, slave, 2048, 1024, 0, 0); + } + } + } + } + + if (test_master_loads) { + if (do_start_idle(s, slave)) { + test_printf("\n====================== Various master loads ===================\n"); + test_printf("Testing IDLE for %d seconds\n", IDLE_TEST_TIME); + test_delay(IDLE_TEST_TIME*100); + do_stop_idle(s, slave, true); + for (i = 0; i < LENGTH(pause_times); i++) { + if (test_udp) { + do_start_idle(s, slave); + do_udp_test(s, NC_REQUEST_UDP_ECHO, slave, 2048, 1024, + pause_times[i].pause_ticks, pause_times[i].pause_threshold); + do_stop_idle(s, slave, false); + } + if (test_tcp) { + do_start_idle(s, slave); + do_tcp_test(s, NC_REQUEST_TCP_ECHO, slave, 2048, 1024, + pause_times[i].pause_ticks, pause_times[i].pause_threshold); + do_stop_idle(s, slave, false); + } + } + } + } + +// do_disconnect(s, slave); + close(s); +} + +static void +nc_master(struct test_params *p) +{ + struct sockaddr_storage slave, my_addr; + struct addrinfo *ai, *addrs, hints; + char *host = (char *)NULL; + int i; + int err = 0; + int test_tcp = true; + int test_udp = true; + int test_slave_loads = true; + int test_master_loads = true; + + for (i = 1; i < p->argc; i++) { + if (p->argv[i][0] == '-') { + switch (p->argv[i][1]) { + case 't': + test_tcp = false; + break; + case 'u': + test_udp = false; + break; + case 's': + test_slave_loads = false; + break; + case 'm': + test_master_loads = false; + break; + default: + test_printf("... invalid switch '%s'\n", p->argv[i]); + err++; + } + } else { + if (host != (char *)NULL) { + test_printf("... ignoring argument '%s'\n", p->argv[i]); + err++; + } else { + host = p->argv[i]; + } + } + } + if ((err != 0) || (p->argc < 2) || (host == (char *)NULL)) { + test_printf("usage: 'master [-t] [-u] [-s] [-m]'\n"); + test_printf(" -t - suppress TCP tests\n"); + test_printf(" -u - suppress UDP tests\n"); + test_printf(" -s - suppress slave load tests\n"); + test_printf(" -m - suppress master load tests\n"); + return; + } + bzero(&hints, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_PASSIVE; + if ((err = getaddrinfo(p->argv[1], _string(NC_SLAVE_PORT), &hints, &addrs)) != EAI_NONE) { + test_printf(" can't getaddrinfo(): %s\n", gai_strerror(err)); + pexit("getaddrinfo"); + } + // Prepare a socket for each connection type + ai = addrs; + while (ai) { + nc_master_test(ai->ai_addr, test_tcp, test_udp, test_slave_loads, test_master_loads); + ai = ai->ai_next; + } +} + +void +net_test(test_param_t p) +{ + test_printf("Start Network Characterization - MASTER\n"); +#ifdef __ECOS + init_all_network_interfaces(); +#endif + nc_master((struct test_params *)p); + cyg_test_exit(); +} + +#ifdef __ECOS +void +cyg_start(void) +{ + static struct test_params p; + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + (cyg_addrword_t)&p,// entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} + +#else + +int +main(int argc, char *argv[]) +{ + struct test_params p; + p.argc = argc; + p.argv = argv; + net_test(&p); +} +#endif diff --git a/packages/net/common/current/tests/nc6_test_slave.c b/packages/net/common/current/tests/nc6_test_slave.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/nc6_test_slave.c @@ -0,0 +1,908 @@ +//========================================================================== +// +// tests/nc6_test_slave.c +// +// Network characterizations test (slave portion) IPv4+IPv6 aware +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Network characterization test code - slave portion + +#include "nc_test_framework.h" +#include + +#ifdef __ECOS +#undef __linux +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +#define MAX_LOAD_THREAD_LEVEL 20 +#define MIN_LOAD_THREAD_LEVEL 0 +#define NUM_LOAD_THREADS 10 +#define IDLE_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY+3 +#define LOAD_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-1 +#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-2 +#define DESIRED_BACKGROUND_LOAD 20 +static char main_thread_stack[CYGHWR_NET_DRIVERS][STACK_SIZE]; +static cyg_thread main_thread_data[CYGHWR_NET_DRIVERS]; +static cyg_handle_t main_thread_handle[CYGHWR_NET_DRIVERS]; +static char idle_thread_stack[STACK_SIZE]; +static cyg_thread idle_thread_data; +static cyg_handle_t idle_thread_handle; +static cyg_sem_t idle_thread_sem; +volatile static long long idle_thread_count; +static cyg_tick_count_t idle_thread_start_time; +static cyg_tick_count_t idle_thread_stop_time; +static char load_thread_stack[NUM_LOAD_THREADS][STACK_SIZE]; +static cyg_thread load_thread_data[NUM_LOAD_THREADS]; +static cyg_handle_t load_thread_handle[NUM_LOAD_THREADS]; +static cyg_sem_t load_thread_sem[NUM_LOAD_THREADS]; +static long load_thread_level; +static void calibrate_load(int load); +static void start_load(int load); +static void do_some_random_computation(int p); +#define abs(n) ((n) < 0 ? -(n) : (n)) +#endif + +#ifdef __ECOS +#define test_param_t cyg_addrword_t +#ifdef CYGDBG_NET_TIMING_STATS +extern void show_net_times(void); +#endif +extern void cyg_kmem_print_stats(void); +#else +#define test_param_t int +#endif + +#ifdef __ECOS +#ifdef CYGPKG_NET_INET6 +#define __INET6 +#endif +#else +#define __INET6 +#endif + +#define MAX_BUF 8192 +static unsigned char in_buf[MAX_BUF], out_buf[MAX_BUF]; + +#ifdef __ECOS +extern void +cyg_test_exit(void); +#else +void +cyg_test_exit(void) +{ + test_printf("... Done\n"); + exit(1); +} + +static void +show_net_times(void) +{ +} +#endif + +#ifdef __ECOS +static void +test_delay(int ticks) +{ + cyg_thread_delay(ticks); +} + +#else + +static void +test_delay(int ticks) +{ + usleep(ticks * 10000); +} +#endif + +void +pexit(char *s) +{ + perror(s); +#ifdef CYGDBG_NET_TIMING_STATS + show_net_times(); +#endif +#ifdef __ECOS + cyg_kmem_print_stats(); +#endif + cyg_test_exit(); +} + +static int +sa_len(struct sockaddr *sa) +{ + switch (sa->sa_family) { + case AF_INET: + return sizeof(struct sockaddr_in); +#ifdef __INET6 + case AF_INET6: + return sizeof(struct sockaddr_in6); +#endif + default: + test_printf("Unknown socket type: %d\n", sa->sa_family); + return sizeof(struct sockaddr_storage); + } +} + +// +// Generic UDP test +// + +static void +do_udp_test(int s1, struct nc_request *req, struct sockaddr *master) +{ + int i, s, td_len, seq, seq_errors, lost; + struct sockaddr_storage test_chan_slave, test_chan_master; + fd_set fds; + struct timeval timeout; + struct nc_test_results results; + struct nc_test_data *tdp; + int nsent, nrecvd; + int need_recv, need_send; + + need_recv = true; need_send = true; + switch (ntohl(req->type)) { + case NC_REQUEST_UDP_SEND: + need_recv = false; + need_send = true; + break; + case NC_REQUEST_UDP_RECV: + need_recv = true; + need_send = false; + break; + case NC_REQUEST_UDP_ECHO: + break; + } + + s = socket(master->sa_family, SOCK_DGRAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + memset((char *)&test_chan_slave, 0, sizeof(test_chan_slave)); + memcpy(&test_chan_master, master, sizeof(*master)); +#ifndef __linux + ((struct sockaddr *)&test_chan_slave)->sa_len = master->sa_len; +#endif + ((struct sockaddr *)&test_chan_slave)->sa_family = master->sa_family; + switch (master->sa_family) { + case AF_INET: + ((struct sockaddr_in *)&test_chan_slave)->sin_addr.s_addr = htonl(INADDR_ANY); + ((struct sockaddr_in *)&test_chan_slave)->sin_port = htons(ntohl(req->slave_port)); + ((struct sockaddr_in *)&test_chan_master)->sin_port = htons(ntohl(req->master_port)); + break; +#ifdef __INET6 + case AF_INET6: + ((struct sockaddr_in6 *)&test_chan_slave)->sin6_addr = in6addr_any; + ((struct sockaddr_in6 *)&test_chan_slave)->sin6_port = htons(ntohl(req->slave_port)); + ((struct sockaddr_in6 *)&test_chan_master)->sin6_port = htons(ntohl(req->master_port)); + break; +#endif + default: + pexit("strange UDP sockaddr"); + } + + if (bind(s, (struct sockaddr *) &test_chan_slave, + sa_len((struct sockaddr *)&test_chan_slave)) < 0) { + perror("bind UDP slave"); + close(s); + } + + nsent = 0; nrecvd = 0; seq = 0; seq_errors = 0; lost = 0; + for (i = 0; i < ntohl(req->nbufs); i++) { + if (need_recv) { + FD_ZERO(&fds); + FD_SET(s, &fds); + timeout.tv_sec = NC_TEST_TIMEOUT; + timeout.tv_usec = 0; + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + test_printf("recvfrom timeout, expecting seq #%d\n", seq); + if (++lost > MAX_ERRORS) { + test_printf("... giving up\n"); + break; + } + } else { + nrecvd++; + tdp = (struct nc_test_data *)in_buf; + td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); + if (recvfrom(s, tdp, td_len, 0, 0, 0) < 0) { + perror("recvfrom UDP data"); + close(s); + return; + } + if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && + (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { + if (ntohl(tdp->seq) != seq) { + test_printf("Packets out of sequence - recvd: %d, expected: %d\n", + ntohl(tdp->seq), seq); + seq = ntohl(tdp->seq); + seq_errors++; + } + } else { + test_printf("Bad data packet - key: %x/%x, seq: %d\n", + ntohl(tdp->key1), ntohl(tdp->key2), + ntohl(tdp->seq)); + } + } + } + if (need_send) { + tdp = (struct nc_test_data *)out_buf; + tdp->key1 = htonl(NC_TEST_DATA_KEY1); + tdp->key2 = htonl(NC_TEST_DATA_KEY2); + tdp->seq = htonl(seq); + td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); + tdp->len = htonl(td_len); + if (sendto(s, tdp, td_len, 0, + (struct sockaddr *)&test_chan_master, sa_len(master)) < 0) { + perror("sendto UDP data"); + if (errno == ENOBUFS) { + // Saturated the system + test_delay(10); // Time for 200 500 byte 10-baseT packets + } else { + // What else to do? + close(s); + return; + } + } else { + nsent++; + } + } + seq++; + } + results.key1 = htonl(NC_TEST_RESULT_KEY1); + results.key2 = htonl(NC_TEST_RESULT_KEY2); + results.seq = req->seq; + results.nsent = htonl(nsent); + results.nrecvd = htonl(nrecvd); + if (sendto(s, &results, sizeof(results), 0, + (struct sockaddr *)&test_chan_master, sa_len(master)) < 0) { + perror("sendto UDP results"); + } + close(s); +} + +// +// Read data from a stream, accounting for the fact that packet 'boundaries' +// are not preserved. This can also timeout (which would probably wreck the +// data boundaries). +// + +int +do_read(int fd, void *buf, int buflen) +{ + char *p = (char *)buf; + int len = buflen; + int res; + while (len) { + res = read(fd, p, len); + if (res < 0) { + perror("read"); + } else { + len -= res; + p += res; + if (res == 0) { + break; + } + } + } + return (buflen - len); +} + +// +// Generic TCP test +// + +static void +do_tcp_test(int s1, struct nc_request *req, struct sockaddr *master) +{ + int i, s, len, td_len, seq, seq_errors, lost, test_chan, res; + struct sockaddr_storage test_chan_slave, test_chan_master; + struct nc_test_results results; + struct nc_test_data *tdp; + int nsent, nrecvd; + int need_recv, need_send; + int one = 1; + char addr_buf[256]; + static int slave_tcp_port[2] = {-1, -1}; + int which_port = 0; + + need_recv = true; need_send = true; + switch (ntohl(req->type)) { + case NC_REQUEST_TCP_SEND: + need_recv = false; + need_send = true; + break; + case NC_REQUEST_TCP_RECV: + need_recv = true; + need_send = false; + break; + case NC_REQUEST_TCP_ECHO: + break; + } + + switch (master->sa_family) { + case AF_INET: + which_port = 0; + break; +#ifdef __INET6 + case AF_INET6: + which_port = 1; + break; +#endif + default: + pexit("unknown TCP family"); + } + if (slave_tcp_port[which_port] < 0) { + test_printf("TCP - listen on %s/%d\n", which_port ? "IPv6" : "IPv4", + ntohl(req->slave_port)); + s = socket(master->sa_family, SOCK_STREAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + perror("setsockopt SO_REUSEADDR"); + return; + } +#ifdef SO_REUSEPORT + if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { + perror("setsockopt SO_REUSEPORT"); + return; + } +#endif + memset((char *)&test_chan_slave, 0, sizeof(test_chan_slave)); +#ifndef __linux + ((struct sockaddr *)&test_chan_slave)->sa_len = master->sa_len; +#endif + ((struct sockaddr *)&test_chan_slave)->sa_family = master->sa_family; + switch (master->sa_family) { + case AF_INET: + ((struct sockaddr_in *)&test_chan_slave)->sin_addr.s_addr = htonl(INADDR_ANY); + ((struct sockaddr_in *)&test_chan_slave)->sin_port = htons(ntohl(req->slave_port)); + break; +#ifdef __INET6 + case AF_INET6: + ((struct sockaddr_in6 *)&test_chan_slave)->sin6_addr = in6addr_any; + ((struct sockaddr_in6 *)&test_chan_slave)->sin6_port = htons(ntohl(req->slave_port)); + break; +#endif + default: + pexit("strange TCP sockaddr"); + } + + if (bind(s, (struct sockaddr *)&test_chan_slave, sa_len(master)) < 0) { + perror("bind"); + close(s); + } + listen(s, SOMAXCONN); + slave_tcp_port[which_port] = s; + } + + s = slave_tcp_port[which_port]; + len = sizeof(test_chan_master); + if ((test_chan = accept(s, (struct sockaddr *)&test_chan_master, &len)) < 0) { + pexit("accept"); + } + len = sizeof(test_chan_master); + getpeername(test_chan, (struct sockaddr *)&test_chan_master, &len); +#ifdef __ECOS + _inet_ntop((struct sockaddr *)&test_chan_master, addr_buf, sizeof(addr_buf)); + test_printf("connection from %s(%d)\n", addr_buf, + _inet_port((struct sockaddr *)&test_chan_master)); +#endif + + nsent = 0; nrecvd = 0; seq = 0; seq_errors = 0; lost = 0; + for (i = 0; i < ntohl(req->nbufs); i++) { + if (need_recv) { + tdp = (struct nc_test_data *)in_buf; + td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); + res = do_read(test_chan, tdp, td_len); + if (res != td_len) { + test_printf("recvfrom timeout, expecting seq #%d\n", seq); + if (++lost > MAX_ERRORS) { + test_printf("... giving up\n"); + break; + } + } else { + nrecvd++; + if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && + (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { + if (ntohl(tdp->seq) != seq) { + test_printf("Packets out of sequence - recvd: %d, expected: %d\n", + ntohl(tdp->seq), seq); + seq = ntohl(tdp->seq); + seq_errors++; + } + } else { + test_printf("Bad data packet - key: %x/%x, seq: %d\n", + ntohl(tdp->key1), ntohl(tdp->key2), + ntohl(tdp->seq)); + } + } + } + if (need_send) { + tdp = (struct nc_test_data *)out_buf; + tdp->key1 = htonl(NC_TEST_DATA_KEY1); + tdp->key2 = htonl(NC_TEST_DATA_KEY2); + tdp->seq = htonl(seq); + td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); + tdp->len = htonl(td_len); + if (write(test_chan, tdp, td_len) != td_len) { + perror("write"); + if (errno == ENOBUFS) { + // Saturated the system + test_delay(25); + } else { + // What else to do? + close(test_chan); + return; + } + } else { + nsent++; + } + } + seq++; + } + results.key1 = htonl(NC_TEST_RESULT_KEY1); + results.key2 = htonl(NC_TEST_RESULT_KEY2); + results.seq = req->seq; + results.nsent = htonl(nsent); + results.nrecvd = htonl(nrecvd); + if (write(test_chan, &results, sizeof(results)) != sizeof(results)) { + perror("write"); + } + close(test_chan); +} + +#define MAXSOCK 16 // Max # sockets to listen on + +static int +waitfor(int *socks, int len, int last_sock) +{ + fd_set src_fds; + int i, s, num; + + // Wait for some activity on one of the ports + FD_ZERO(&src_fds); + for (s = 0; s < len; s++) { + FD_SET(socks[s], &src_fds); + } + num = select(last_sock+1, &src_fds, 0, 0, 0); + if (num > 0) { + for (i = 0; i < len; i++) { + s = socks[i]; + if (FD_ISSET(s, &src_fds)) { + return s; // Return first available socket + } + } + pexit("select, but no socket!"); + } else { + pexit("select"); + } + return 0; +} + +// +// Protocol driver for testing slave. +// +// This function is the main routine running here, handling requests sent from +// the master and providing various responses. +// +static void +nc_slave(test_param_t param) +{ + int sock_indx, s, err, last_sock, socks[MAXSOCK], masterlen; + struct sockaddr_storage master; + struct nc_request req; + struct nc_reply reply; + int done = false; + struct addrinfo *ai, *addrs, hints; + char addr_buf[256]; + + test_printf("Start test for eth%d\n", param); + bzero(&hints, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_PASSIVE; + if ((err = getaddrinfo(NULL, _string(NC_SLAVE_PORT), &hints, &addrs)) != EAI_NONE) { + test_printf(" can't getaddrinfo(): %s\n", gai_strerror(err)); + pexit("getaddrinfo"); + } + // Prepare a socket for each connection type + sock_indx = 0; last_sock = -1; + ai = addrs; + while (ai) { +#ifdef __ECOS + _inet_ntop(ai->ai_addr, addr_buf, sizeof(addr_buf)); + test_printf("Family: %d, Socket: %d, Addr: %s\n", ai->ai_family, ai->ai_socktype, addr_buf); +#else + test_printf("Family: %d, Socket: %d\n", ai->ai_family, ai->ai_socktype); +#endif +#ifdef __linux +// This code is very sensitive on Linux + s = socket(ai->ai_family, ai->ai_socktype, 0); + if (s < 0) { + test_printf("Can't bind socket\n"); +// pexit("dgram socket"); + } else { + if(bind(s, ai->ai_addr, sa_len(ai->ai_addr)) < 0) { + test_printf("Failed to bind family: %d\n", ai->ai_family); +// pexit("bind server error"); + } else { + socks[sock_indx++] = s; + if (sock_indx >= MAXSOCK) { + pexit("Too many address types"); + } + } + } +#else + s = socket(ai->ai_family, ai->ai_socktype, 0); + if (s < 0) { + pexit("dgram socket"); + } + if(bind(s, ai->ai_addr, sa_len(ai->ai_addr)) < 0) { + test_printf("Failed to bind family: %d\n", ai->ai_family); + pexit("bind server error"); + } + socks[sock_indx++] = s; + if (sock_indx >= MAXSOCK) { + pexit("Too many address types"); + } +#endif + ai = ai->ai_next; + if (s > last_sock) last_sock = s; + } + while (!done && (s = waitfor(socks, sock_indx, last_sock))) { + // Data is available from socket 's' + masterlen = sizeof(master); + if (recvfrom(s, &req, sizeof(req), 0, (struct sockaddr *)&master, &masterlen) < 0) { + pexit("recvfrom service"); + } +#if 0 + _inet_ntop((struct sockaddr *)&master, addr_buf, sizeof(addr_buf)); + test_printf("Request %d %s(%d)\n", ntohl(req.type), addr_buf, + (struct sockaddr *)_inet_port(&master)); +#endif + reply.response = htonl(NC_REPLY_ACK); + reply.seq = req.seq; + switch (ntohl(req.type)) { + case NC_REQUEST_DISCONNECT: + done = true; + test_printf("Master has issued disconnect - I quit!\n"); + break; + case NC_REQUEST_UDP_SEND: + test_printf("UDP send - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; + case NC_REQUEST_UDP_RECV: + test_printf("UDP recv - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; + case NC_REQUEST_UDP_ECHO: + test_printf("UDP echo - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; + case NC_REQUEST_TCP_SEND: + test_printf("TCP send - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; + case NC_REQUEST_TCP_RECV: + test_printf("TCP recv - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; + case NC_REQUEST_TCP_ECHO: + test_printf("TCP echo - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; +#ifdef __ECOS + case NC_REQUEST_SET_LOAD: + start_load(ntohl(req.nbufs)); + break; + case NC_REQUEST_START_IDLE: + test_printf("Start IDLE thread\n"); + idle_thread_count = 0; + idle_thread_start_time = cyg_current_time(); + cyg_semaphore_post(&idle_thread_sem); + break; + case NC_REQUEST_STOP_IDLE: + cyg_semaphore_wait(&idle_thread_sem); + idle_thread_stop_time = cyg_current_time(); + test_printf("Stop IDLE thread\n"); + reply.misc.idle_results.elapsed_time = htonl(idle_thread_stop_time - idle_thread_start_time); + reply.misc.idle_results.count[0] = htonl(idle_thread_count >> 32); + reply.misc.idle_results.count[1] = htonl((long)idle_thread_count); + break; +#endif + default: + test_printf("Unrecognized request: %d\n", ntohl(req.type)); + reply.response = htonl(NC_REPLY_NAK); + reply.reason = htonl(NC_REPLY_NAK_UNKNOWN_REQUEST); + break; + } + if (sendto(s, &reply, sizeof(reply), 0, (struct sockaddr *)&master, masterlen) < 0) { + pexit("sendto"); + } + if (reply.response == ntohl(NC_REPLY_NAK)) { + continue; + } + switch (ntohl(req.type)) { + case NC_REQUEST_UDP_SEND: + case NC_REQUEST_UDP_RECV: + case NC_REQUEST_UDP_ECHO: + do_udp_test(s, &req, (struct sockaddr *)&master); + break; + case NC_REQUEST_TCP_SEND: + case NC_REQUEST_TCP_RECV: + case NC_REQUEST_TCP_ECHO: + do_tcp_test(s, &req, (struct sockaddr *)&master); + break; + case NC_REQUEST_START_IDLE: + case NC_REQUEST_STOP_IDLE: + case NC_REQUEST_SET_LOAD: + default: + break; + } +// cyg_kmem_print_stats(); + } +} + +void +net_test(test_param_t param) +{ +// int i; + if (param == 0) { + test_printf("Start Network Characterization - SLAVE\n"); +#ifdef __ECOS + init_all_network_interfaces(); + calibrate_load(DESIRED_BACKGROUND_LOAD); +#if 0 +// I can see what this is trying to do, but I get "bind: Address already in +// use" errors from the 2nd interface - and the parameter is not used +// anyway, so one thread does quite well enough (but only tests one i/f at +// once). + +// Comment in the 'int i' above too. + for (i = 1; i < CYGHWR_NET_DRIVERS; i++) { + cyg_thread_resume(main_thread_handle[i]); // Start other threads + } +#endif +#endif + } + nc_slave(param); +#ifdef CYGDBG_NET_TIMING_STATS + show_net_times(); +#endif + cyg_test_exit(); +} + +#ifdef __ECOS + +// +// This function is called to calibrate the "background load" which can be +// applied during testing. It will be called before any commands from the +// host are managed. +// +static void +calibrate_load(int desired_load) +{ + long long no_load_idle, load_idle; + int percent_load; + int high, low; + + // Set limits + high = MAX_LOAD_THREAD_LEVEL; + low = MIN_LOAD_THREAD_LEVEL; + + // Compute the "no load" idle value + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + no_load_idle = idle_thread_count; + diag_printf("No load = %d\n", (int)idle_thread_count); + + // First ensure that the HIGH level is indeed higher + while (true) { + load_thread_level = high; + start_load(desired_load); // Start up a given load + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + load_idle = idle_thread_count; + start_load(0); // Shut down background load + percent_load = 100 - ((load_idle * 100) / no_load_idle); + diag_printf("High Load[%d] = %d => %d%%\n", load_thread_level, + (int)idle_thread_count, percent_load); + if ( percent_load > desired_load ) + break; // HIGH level is indeed higher + low = load_thread_level; // known to be lower + high *= 2; // else double it and try again + } + + // Now chop down to the level required + while (true) { + load_thread_level = (high + low) / 2; + start_load(desired_load); // Start up a given load + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + load_idle = idle_thread_count; + start_load(0); // Shut down background load + percent_load = 100 - ((load_idle * 100) / no_load_idle); + diag_printf("Load[%d] = %d => %d%%\n", load_thread_level, + (int)idle_thread_count, percent_load); + if (((high-low) <= 1) || (abs(desired_load-percent_load) <= 2)) break; + if (percent_load < desired_load) { + low = load_thread_level; + } else { + high = load_thread_level; + } + } + + // Now we are within a few percent of the target; scale the load + // factor to get a better fit, and test it, print the answer. + load_thread_level *= desired_load; + load_thread_level /= percent_load; + start_load(desired_load); // Start up a given load + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + load_idle = idle_thread_count; + start_load(0); // Shut down background load + percent_load = 100 - ((load_idle * 100) / no_load_idle); + diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level, + (int)idle_thread_count, percent_load); +// no_load_idle_count_1_second = no_load_idle; +} + +// +// This function is called to set up a load level of 'load' percent (given +// as a whole number, e.g. start_load(20) would mean initiate a background +// load of 20%, leaving the cpu 80% idle). +// +static void +start_load(int load) +{ + static int prev_load = 0; + int i; + test_printf("Set background load = %d%%\n", load); + if (load == 0) { + if (prev_load == 0) return; // Nothing out there to stop + for (i = 0; i < prev_load/10; i++) { + cyg_semaphore_wait(&load_thread_sem[i]); + } + prev_load = 0; + } else { + for (i = 0; i < load/10; i++) { + cyg_semaphore_post(&load_thread_sem[i]); + } + prev_load = load; + } +} + +// +// These thread(s) do some amount of "background" computing. This is used +// to simulate a given load level. They need to be run at a higher priority +// than the network code itself. +// +// Like the "idle" thread, they run as long as their "switch" (aka semaphore) +// is enabled. +// +void +net_load(cyg_addrword_t who) +{ + int i; + while (true) { + cyg_semaphore_wait(&load_thread_sem[who]); + for (i = 0; i < load_thread_level; i++) { + do_some_random_computation(i); + } + cyg_thread_delay(1); // Wait until the next 'tick' + cyg_semaphore_post(&load_thread_sem[who]); + } +} + +// +// Some arbitrary computation, designed to use up the CPU and cause associated +// cache "thrash" behaviour - part of background load modelling. +// +static void +do_some_random_computation(int p) +{ + // Just something that might be "hard" + volatile double x; + x = ((p * 10) * 3.14159) / 180.0; // radians +} + +// +// This thread does nothing but count. It will be allowed to count +// as long as the semaphore is "free". +// +void +net_idle(cyg_addrword_t param) +{ + while (true) { + cyg_semaphore_wait(&idle_thread_sem); + idle_thread_count++; + cyg_semaphore_post(&idle_thread_sem); + } +} + +void +cyg_start(void) +{ + int i; + // Create processing threads + for (i = 0; i < CYGHWR_NET_DRIVERS; i++) { + cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority + net_test, // entry + i, // entry parameter + "Network test", // Name + &main_thread_stack[i][0], // Stack + STACK_SIZE, // Size + &main_thread_handle[i], // Handle + &main_thread_data[i] // Thread data structure + ); + } + cyg_thread_resume(main_thread_handle[0]); // Start first one + // Create the idle thread environment + cyg_semaphore_init(&idle_thread_sem, 0); + cyg_thread_create(IDLE_THREAD_PRIORITY, // Priority + net_idle, // entry + 0, // entry parameter + "Network idle", // Name + &idle_thread_stack[0], // Stack + STACK_SIZE, // Size + &idle_thread_handle, // Handle + &idle_thread_data // Thread data structure + ); + cyg_thread_resume(idle_thread_handle); // Start it + // Create the load threads and their environment(s) + for (i = 0; i < NUM_LOAD_THREADS; i++) { + cyg_semaphore_init(&load_thread_sem[i], 0); + cyg_thread_create(LOAD_THREAD_PRIORITY, // Priority + net_load, // entry + i, // entry parameter + "Background load", // Name + &load_thread_stack[i][0], // Stack + STACK_SIZE, // Size + &load_thread_handle[i], // Handle + &load_thread_data[i] // Thread data structure + ); + cyg_thread_resume(load_thread_handle[i]); // Start it + } + cyg_scheduler_start(); +} + +#else + +int +main(int argc, char *argv[]) +{ + net_test(0); +} +#endif diff --git a/packages/net/common/current/tests/nc_test_framework.h b/packages/net/common/current/tests/nc_test_framework.h new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/nc_test_framework.h @@ -0,0 +1,171 @@ +//========================================================================== +// +// tests/nc_test_framework.h +// +// Network characterization tests framework +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#ifndef _TESTS_NC_TEST_FRAMEWORK_H_ +#define _TESTS_NC_TEST_FRAMEWORK_H_ + +#ifdef __ECOS +#include +#else +#undef _KERNEL +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#ifndef EAI_NONE +#define EAI_NONE 0 +#endif +#endif + +#ifdef __ECOS +#define test_printf diag_printf +typedef cyg_addrword_t test_param_t; +#else +#define test_printf printf +typedef void *test_param_t; +#endif + +#ifndef true +#define false 0 +#define true 1 +#endif + +#define NC_SLAVE_PORT 7777 +#define NC_MASTER_PORT 7776 + +#define NC_TESTING_SLAVE_PORT 8770 +#define NC_TESTING_MASTER_PORT 8771 + +#define __string(s) #s +#define _string(s) __string(s) + +// +// The basic idea behind this test structure is that one end will run +// in "slave" mode and the other in "master" mode. Typically, the slave +// will run on a target platform with the master running on a host. +// +// The slave starts up by listening for a connection on the "SLAVE_PORT". +// In order for the testing to require the minimum stack support, this +// connection (and the protocol) will use UDP. +// +// The master will connect to the slave and send it a request over this +// connection. Once the slave accepts the request, then master and slave +// will execute the operation, typically a test. The control connection +// will remain active until the master sends a 'disconnect' request. The +// control connection will be broken after the reply to this request has +// been sent. +// + +#define MAX_ERRORS 5 // Give up after this many errors + +#define NC_REPLY_TIMEOUT 10 // The slave may be slow +#define NC_TEST_TIMEOUT 3 // More generous for tests +#define NC_RESULTS_TIMEOUT (MAX_ERRORS+2)*NC_TEST_TIMEOUT + +struct nc_request { + int type; // Description of request + int seq; // Sequence number, used to build response + int nbufs; // Number of "buffers" to send + int buflen; // Length of each buffer + int slave_port; // Network ports to use + int master_port; + int timeout; // Max time to wait for any packet +}; + +#define NC_REQUEST_DISCONNECT 0x0001 +#define NC_REQUEST_UDP_SEND 0x0010 // Slave to send UDP data +#define NC_REQUEST_UDP_RECV 0x0011 // Slave to receive UDP data +#define NC_REQUEST_UDP_ECHO 0x0012 // Master->slave->master +#define NC_REQUEST_TCP_SEND 0x0020 // Slave to send TCP data +#define NC_REQUEST_TCP_RECV 0x0021 // Slave to receive TCP data +#define NC_REQUEST_TCP_ECHO 0x0022 // Master->slave->master +#define NC_REQUEST_START_IDLE 0x0100 // Start some idle processing +#define NC_REQUEST_STOP_IDLE 0x0101 // Stop idle processing +#define NC_REQUEST_SET_LOAD 0x0200 // Set the background load level + +struct nc_reply { + int response; // ACK or NAK + int seq; // Must match request + int reason; // If NAK, why request turned down + union { // Miscellaneous data, depending on request + struct { + long elapsed_time; // In 10ms "ticks" + long count[2]; // Result + } idle_results; + } misc; +}; + +#define NC_REPLY_ACK 0x0001 // Request accepted +#define NC_REPLY_NAK 0x0000 // Request denied + +#define NC_REPLY_NAK_UNKNOWN_REQUEST 0x0001 +#define NC_REPLY_NAK_BAD_REQUEST 0x0002 // Slave can't handle +#define NC_REPLY_NAK_NO_BACKGROUND 0x0003 // Slave can't do background/idle + +// +// Test data 'packets' look like this + +struct nc_test_data { + long key1; + int seq; + int len; + long key2; + char data[0]; // Actual data +}; + +#define NC_TEST_DATA_KEY1 0xC0DEADC0 +#define NC_TEST_DATA_KEY2 0xC0DEADC1 + +struct nc_test_results { + long key1; // Identify uniquely as a response record + int seq; // Matches request + int nsent; + int nrecvd; + long key2; // Additional verification +}; + +#define NC_TEST_RESULT_KEY1 0xDEADC0DE +#define NC_TEST_RESULT_KEY2 0xDEADC1DE + +#endif // _TESTS_NC_TEST_FRAMEWORK_H_ + + + diff --git a/packages/net/common/current/tests/nc_test_master.c b/packages/net/common/current/tests/nc_test_master.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/nc_test_master.c @@ -0,0 +1,711 @@ +//========================================================================== +// +// tests/nc_test_master.c +// +// Network characterizations test (master portion) +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Network characterization test code - master portion + +#include "nc_test_framework.h" + +#ifdef __ECOS +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; +#endif + +struct test_params { + int argc; + char **argv; +}; + +#define MAX_BUF 32*1024 +static unsigned char in_buf[MAX_BUF], out_buf[MAX_BUF]; + +static int test_seq = 1; +static long long idle_count; +static long idle_ticks; +#define IDLE_TEST_TIME 10 + +struct pause { + int pause_ticks; + int pause_threshold; +}; +#define LENGTH(x) (sizeof(x)/sizeof(x[0])) + +#ifdef __ECOS +extern void +cyg_test_exit(void); +#else +void +cyg_test_exit(void) +{ + test_printf("... Done\n"); + exit(1); +} +#endif + +#ifdef __ECOS +static void +test_delay(int ticks) +{ + cyg_thread_delay(ticks); +} + +#else + +static void +test_delay(int ticks) +{ + usleep(ticks * 10000); +} +#endif + +void +pexit(char *s) +{ + perror(s); + cyg_test_exit(); +} + +#ifdef __ECOS +#ifndef CYGPKG_SNMPLIB +int +gettimeofday(struct timeval *tv, struct timezone *tz) +{ + cyg_tick_count_t cur_time; + cur_time = cyg_current_time(); + tv->tv_sec = cur_time / 100; + tv->tv_usec = (cur_time % 100) * 10000; +} +#else +int +gettimeofday(struct timeval *tv, struct timezone *tz); +#endif +#endif +void +show_results(const char *msg, struct timeval *start, + struct timeval *end, int nbufs, int buflen, + int lost, int seq_errors) +{ + struct timeval tot_time; +#ifndef __ECOS + double real_time, thru; + long tot_bytes = nbufs * buflen; +#endif + timersub(end, start, &tot_time); + test_printf("%s - %d bufs of %d bytes in %d.%02d seconds", + msg, nbufs, buflen, + tot_time.tv_sec, tot_time.tv_usec / 10000); +#ifndef __ECOS + real_time = tot_time.tv_sec + ((tot_time.tv_usec / 10000) * .01); + // Compute bytes / second (rounded up) + thru = tot_bytes / real_time; + // Convert to Mb / second + test_printf(" - %.2f KB/S", thru / 1024.0); + test_printf(" - %.4f Mbit/S (M = 10^6)", thru * 8.0 / 1000000.0); +#endif + if (lost) { + test_printf(", %d lost", lost); + } + if (seq_errors) { + test_printf(", %d out of sequence", seq_errors); + } + test_printf("\n"); +} + +void +new_test(void) +{ + test_seq++; +} + +int +nc_message(int s, struct nc_request *req, + struct nc_reply *reply, struct sockaddr_in *slave) +{ + int len; + fd_set fds; + struct timeval timeout; + len = sizeof(*slave); + req->seq = htonl(test_seq); + if (sendto(s, req, sizeof(*req), 0, (struct sockaddr *)slave, len) < 0) { + perror("sendto"); + return false; + } + FD_ZERO(&fds); + FD_SET(s, &fds); + timeout.tv_sec = NC_REPLY_TIMEOUT; + timeout.tv_usec = 0; + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + test_printf("No response to command\n"); + return false; + } + if (recvfrom(s, reply, sizeof(*reply), 0, 0, 0) < 0) { + perror("recvfrom"); + return false; + } + if (reply->seq != req->seq) { + test_printf("Response out of order - sent: %d, recvd: %d\n", + ntohl(req->seq), ntohl(reply->seq)); + return false; + } + return true; +} + +void +show_test_results(struct nc_test_results *results) +{ + if ((ntohl(results->key1) == NC_TEST_RESULT_KEY1) && + (ntohl(results->key2) == NC_TEST_RESULT_KEY2) && + (ntohl(results->seq) == test_seq)) { + test_printf(" slave sent %d, recvd %d\n", + ntohl(results->nsent), ntohl(results->nrecvd)); + } else { + test_printf(" ... invalid results - keys: %x/%x, seq: %d/%d\n", + ntohl(results->key1), ntohl(results->key2), + ntohl(results->seq), test_seq); + } +} + +void +do_udp_test(int s1, int type, struct sockaddr_in *slave, + int nbufs, int buflen, int pause_time, int pause_threshold) +{ + int i, s, td_len, seq, seq_errors, total_packets; + struct sockaddr_in test_chan_master, test_chan_slave; + struct timeval start_time, end_time; + struct nc_request req; + struct nc_reply reply; + struct nc_test_results results; + struct nc_test_data *tdp; + fd_set fds; + struct timeval timeout; + int lost_packets = 0; + int need_send, need_recv; + const char *type_name; + int pkt_ctr = 0; + + need_recv = true; need_send = true; type_name = "UDP echo"; + switch (type) { + case NC_REQUEST_UDP_RECV: + need_recv = false; + need_send = true; + type_name = "UDP recv"; + break; + case NC_REQUEST_UDP_SEND: + need_recv = true; + need_send = false; + type_name = "UDP send"; + break; + case NC_REQUEST_UDP_ECHO: + break; + } + + new_test(); + req.type = htonl(type); + req.nbufs = htonl(nbufs); + req.buflen = htonl(buflen); + req.slave_port = htonl(NC_TESTING_SLAVE_PORT); + req.master_port = htonl(NC_TESTING_MASTER_PORT); + nc_message(s1, &req, &reply, slave); + if (reply.response != ntohl(NC_REPLY_ACK)) { + test_printf("Slave denied %s [%d,%d] test\n", type_name, nbufs, buflen); + return; + } + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + memset(&test_chan_master, 0, sizeof(test_chan_master)); + test_chan_master.sin_family = AF_INET; +#ifdef __ECOS + test_chan_master.sin_len = sizeof(test_chan_master); +#endif + test_chan_master.sin_port = htons(ntohl(req.master_port)); + test_chan_master.sin_addr.s_addr = INADDR_ANY; + + if (bind(s, (struct sockaddr *) &test_chan_master, sizeof(test_chan_master)) < 0) { + perror("bind"); + close(s); + return; + } + test_printf("Start %s [%d,%d]", type_name, nbufs, buflen); + if (pause_time) { + test_printf(" - %dms delay after %d packet%s\n", pause_time*10, + pause_threshold, pause_threshold > 1 ? "s" : ""); + } else { + test_printf(" - no delays\n"); + } + + gettimeofday(&start_time, 0); + memcpy(&test_chan_slave, slave, sizeof(*slave)); + test_chan_slave.sin_port = htons(ntohl(req.slave_port)); + seq = 0; seq_errors = 0; total_packets = 0; + for (i = 0; i < nbufs; i++) { + td_len = buflen + sizeof(struct nc_test_data); + if (need_send) { + tdp = (struct nc_test_data *)out_buf; + tdp->key1 = htonl(NC_TEST_DATA_KEY1); + tdp->key2 = htonl(NC_TEST_DATA_KEY2); + tdp->seq = htonl(i); + tdp->len = htonl(td_len); + if (sendto(s, tdp, td_len, 0, + (struct sockaddr *)&test_chan_slave, sizeof(test_chan_slave)) < 0) { + perror("sendto"); + close(s); + return; + } + total_packets++; + } + if (need_recv) { + FD_ZERO(&fds); + FD_SET(s, &fds); + timeout.tv_sec = NC_TEST_TIMEOUT; + timeout.tv_usec = 0; + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + test_printf("Slave timed out after %d buffers\n", i); + lost_packets++; + } else { + tdp = (struct nc_test_data *)in_buf; + if (recvfrom(s, tdp, td_len, 0, 0, 0) < 0) { + perror("recvfrom"); + close(s); + return; + } + if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && + (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { + if (ntohl(tdp->seq) != seq) { + test_printf("Packets out of sequence - recvd: %d, expected: %d\n", + ntohl(tdp->seq), seq); + seq_errors++; + if (!need_send) { + // Reset sequence to what the slave wants + seq = ntohl(tdp->seq); + } + } + } else { + test_printf("Bad data packet - key: %x/%x, seq: %d\n", + ntohl(tdp->key1), ntohl(tdp->key2), + ntohl(tdp->seq)); + } + total_packets++; + } + seq++; + if (seq == nbufs) { + break; + } + if (pause_time && (++pkt_ctr == pause_threshold)) { + pkt_ctr = 0; + test_delay(pause_time); + } + } + } + gettimeofday(&end_time, 0); + show_results(type_name, &start_time, &end_time, total_packets, buflen, + lost_packets, seq_errors); + // Fetch results record + FD_ZERO(&fds); + FD_SET(s, &fds); + timeout.tv_sec = NC_RESULTS_TIMEOUT; + timeout.tv_usec = 0; + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + test_printf("No results record sent\n"); + } else { + if (recvfrom(s, &results, sizeof(results), 0, 0, 0) < 0) { + perror("recvfrom"); + } + show_test_results(&results); + } + close(s); +} + +// +// Read data from a stream, accounting for the fact that packet 'boundaries' +// are not preserved. This can also timeout (which would probably wreck the +// data boundaries). +// + +int +do_read(int fd, void *buf, int buflen) +{ + char *p = (char *)buf; + int len = buflen; + int res; + while (len) { + res = read(fd, p, len); + if (res < 0) { + perror("read"); + } else { + len -= res; + p += res; + if (res == 0) { + break; + } + } + } + return (buflen - len); +} + +void +do_tcp_test(int s1, int type, struct sockaddr_in *slave, + int nbufs, int buflen, int pause_time, int pause_threshold) +{ + int i, s, td_len, len, seq, seq_errors, total_packets, res; + struct sockaddr_in test_chan_slave; + struct timeval start_time, end_time; + struct nc_request req; + struct nc_reply reply; + struct nc_test_results results; + struct nc_test_data *tdp; + int lost_packets = 0; + int conn_failures = 0; + int need_send, need_recv; + const char *type_name; + int pkt_ctr = 0; + + need_recv = true; need_send = true; type_name = "TCP echo"; + switch (type) { + case NC_REQUEST_TCP_RECV: + need_recv = false; + need_send = true; + type_name = "TCP recv"; + break; + case NC_REQUEST_TCP_SEND: + need_recv = true; + need_send = false; + type_name = "TCP send"; + break; + case NC_REQUEST_TCP_ECHO: + break; + } + + new_test(); + req.type = htonl(type); + req.nbufs = htonl(nbufs); + req.buflen = htonl(buflen); + req.slave_port = htonl(NC_TESTING_SLAVE_PORT); + req.master_port = htonl(NC_TESTING_MASTER_PORT); + nc_message(s1, &req, &reply, slave); + if (reply.response != ntohl(NC_REPLY_ACK)) { + test_printf("Slave denied %s [%d,%d] test\n", type_name, nbufs, buflen); + return; + } + + s = socket(AF_INET, SOCK_STREAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + test_printf("Start %s [%d,%d]", type_name, nbufs, buflen); + if (pause_time) { + test_printf(" - %dms delay after %d packet%s\n", pause_time*10, + pause_threshold, pause_threshold > 1 ? "s" : ""); + } else { + test_printf(" - no delays\n"); + } + + test_delay(3*100); + memcpy(&test_chan_slave, slave, sizeof(*slave)); + test_chan_slave.sin_port = htons(ntohl(req.slave_port)); + while (connect(s, (struct sockaddr *)&test_chan_slave, sizeof(*slave)) < 0) { + perror("Can't connect to slave"); + if (++conn_failures > MAX_ERRORS) { + test_printf("Too many connection failures - giving up\n"); + return; + } + if (errno == ECONNREFUSED) { + // Give the slave a little time + test_delay(100); // 1 second + } else { + return; + } + } + + gettimeofday(&start_time, 0); + seq = 0; seq_errors = 0; total_packets = 0; + for (i = 0; i < nbufs; i++) { + td_len = buflen + sizeof(struct nc_test_data); + if (need_send) { + tdp = (struct nc_test_data *)out_buf; + tdp->key1 = htonl(NC_TEST_DATA_KEY1); + tdp->key2 = htonl(NC_TEST_DATA_KEY2); + tdp->seq = htonl(i); + tdp->len = htonl(td_len); + if ((len = write(s, tdp, td_len)) != td_len) { + if (len < 0) { + perror("write"); + } else { + test_printf("short write - only %d or %d bytes written\n", len, td_len); + } + close(s); + return; + } + total_packets++; + } + if (need_recv) { + tdp = (struct nc_test_data *)in_buf; + res = do_read(s, tdp, td_len); + if (res != td_len) { + test_printf("Slave timed out after %d buffers\n", i); + lost_packets++; + } else { + if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && + (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { + if (ntohl(tdp->seq) != seq) { + test_printf("Packets out of sequence - recvd: %d, expected: %d\n", + ntohl(tdp->seq), seq); + seq_errors++; + if (!need_send) { + // Reset sequence to what the slave wants + seq = ntohl(tdp->seq); + } + } + } else { + test_printf("Bad data packet - key: %x/%x, seq: %d\n", + ntohl(tdp->key1), ntohl(tdp->key2), + ntohl(tdp->seq)); + } + total_packets++; + } + seq++; + if (seq == nbufs) { + break; + } + if (pause_time && (++pkt_ctr == pause_threshold)) { + pkt_ctr = 0; + test_delay(pause_time); + } + } + } + gettimeofday(&end_time, 0); + show_results(type_name, &start_time, &end_time, total_packets, buflen, + lost_packets, seq_errors); + // Fetch results record + if (do_read(s, &results, sizeof(results)) != sizeof(results)) { + test_printf("No results record sent\n"); + } else { + show_test_results(&results); + } + close(s); +} + +int +do_set_load(int s, struct sockaddr_in *slave, int load_level) +{ + struct nc_request req; + struct nc_reply reply; + req.type = htonl(NC_REQUEST_SET_LOAD); + req.nbufs = htonl(load_level); + nc_message(s, &req, &reply, slave); + return (reply.response == ntohl(NC_REPLY_ACK)); +} + +int +do_start_idle(int s, struct sockaddr_in *slave) +{ + struct nc_request req; + struct nc_reply reply; + req.type = htonl(NC_REQUEST_START_IDLE); + nc_message(s, &req, &reply, slave); + return (reply.response == ntohl(NC_REPLY_ACK)); +} + +void +do_stop_idle(int s, struct sockaddr_in *slave, int calibrate) +{ + struct nc_request req; + struct nc_reply reply; + long long res_idle_count; + long long adj_count; + int idle, res_idle_ticks; + req.type = htonl(NC_REQUEST_STOP_IDLE); + nc_message(s, &req, &reply, slave); + if (reply.response == ntohl(NC_REPLY_ACK)) { + res_idle_ticks = ntohl(reply.misc.idle_results.elapsed_time); + res_idle_count = ((long long)ntohl(reply.misc.idle_results.count[0]) << 32) | + ntohl(reply.misc.idle_results.count[1]); + test_printf("IDLE - ticks: %d, count: %ld", + res_idle_ticks, res_idle_count); + if (calibrate) { + idle_count = res_idle_count; + idle_ticks = res_idle_ticks; + } else { + adj_count = res_idle_count / res_idle_ticks; + adj_count *= idle_ticks; + idle = (int) ((adj_count * 100) / idle_count); + test_printf(", %d%% idle", idle); + } + test_printf("\n"); + } else { + test_printf("Slave failed on IDLE\n"); + } +} + +void +do_disconnect(int s, struct sockaddr_in *slave) +{ + struct nc_request req; + struct nc_reply reply; + req.type = htonl(NC_REQUEST_DISCONNECT); + nc_message(s, &req, &reply, slave); +} + +static void +nc_master(struct test_params *p) +{ + int s, i; + struct sockaddr_in slave, my_addr; + struct hostent *host; + struct pause pause_times[] = { + {0,0}, {1,10}, {5,10}, {10,10}, {1,1} }; + + if (p->argc != 2) { + test_printf("Need exactly 'master '\n"); + return; + } + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + memset(&my_addr, 0, sizeof(my_addr)); + my_addr.sin_family = AF_INET; +#ifdef __ECOS + my_addr.sin_len = sizeof(my_addr); +#endif + my_addr.sin_port = htons(NC_MASTER_PORT); + my_addr.sin_addr.s_addr = INADDR_ANY; + + if (bind(s, (struct sockaddr *) &my_addr, sizeof(my_addr)) < 0) { + pexit("bind"); + } + + host = gethostbyname(p->argv[1]); + if (host == (struct hostent *)NULL) { + pexit("gethostbyname"); + } + + memset(&slave, 0, sizeof(slave)); + slave.sin_family = AF_INET; +#ifdef __ECOS + slave.sin_len = sizeof(slave); +#endif + slave.sin_port = htons(NC_SLAVE_PORT); + memcpy(&slave.sin_addr.s_addr, host->h_addr, host->h_length); + + test_printf("================== No load, master at 100%% ========================\n"); +#if 0 + do_udp_test(s, NC_REQUEST_UDP_ECHO, &slave, 640, 1024, 0, 0); + do_udp_test(s, NC_REQUEST_UDP_SEND, &slave, 640, 1024, 0, 0); + do_udp_test(s, NC_REQUEST_UDP_RECV, &slave, 640, 1024, 0, 0); + do_tcp_test(s, NC_REQUEST_TCP_ECHO, &slave, 640, 1024, 0, 0); + do_tcp_test(s, NC_REQUEST_TCP_SEND, &slave, 640, 1024, 0, 0); + do_tcp_test(s, NC_REQUEST_TCP_RECV, &slave, 640, 1024, 0, 0); +#endif + do_tcp_test(s, NC_REQUEST_TCP_ECHO, &slave, 64, 10240, 0, 0); + + if (do_set_load(s, &slave, 0)) { + test_printf("\n====================== Various slave compute loads ===================\n"); + for (i = 0; i < 60; i += 10) { + test_printf(">>>>>>>>>>>> slave processing load at %d%%\n", i); + do_set_load(s, &slave, i); + do_udp_test(s, NC_REQUEST_UDP_ECHO, &slave, 2048, 1024, 0, 0); + do_tcp_test(s, NC_REQUEST_TCP_ECHO, &slave, 2048, 1024, 0, 0); + } + } + + if (do_start_idle(s, &slave)) { + test_printf("\n====================== Various master loads ===================\n"); + test_printf("Testing IDLE for %d seconds\n", IDLE_TEST_TIME); + test_delay(IDLE_TEST_TIME*100); + do_stop_idle(s, &slave, true); + for (i = 0; i < LENGTH(pause_times); i++) { + do_start_idle(s, &slave); + do_udp_test(s, NC_REQUEST_UDP_ECHO, &slave, 2048, 1024, + pause_times[i].pause_ticks, pause_times[i].pause_threshold); + do_stop_idle(s, &slave, false); + do_start_idle(s, &slave); + do_tcp_test(s, NC_REQUEST_TCP_ECHO, &slave, 2048, 1024, + pause_times[i].pause_ticks, pause_times[i].pause_threshold); + do_stop_idle(s, &slave, false); + } + } + + do_disconnect(s, &slave); + close(s); +} + +void +net_test(test_param_t p) +{ + test_printf("Start Network Characterization - MASTER\n"); +#ifdef __ECOS + init_all_network_interfaces(); +#endif + nc_master((struct test_params *)p); + cyg_test_exit(); +} + +#ifdef __ECOS +void +cyg_start(void) +{ + static struct test_params p; + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + (cyg_addrword_t)&p,// entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} + +#else + +int +main(int argc, char *argv[]) +{ + struct test_params p; + p.argc = argc; + p.argv = argv; + net_test(&p); +} +#endif diff --git a/packages/net/common/current/tests/nc_test_slave.c b/packages/net/common/current/tests/nc_test_slave.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/nc_test_slave.c @@ -0,0 +1,767 @@ +//========================================================================== +// +// tests/nc_test_slave.c +// +// Network characterizations test (slave portion) +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Network characterization test code - slave portion + +#include "nc_test_framework.h" +#include + +#ifdef __ECOS +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +#define MAX_LOAD_THREAD_LEVEL 20 +#define MIN_LOAD_THREAD_LEVEL 0 +#define NUM_LOAD_THREADS 10 +#define IDLE_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY+3 +#define LOAD_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-1 +#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-2 +#define DESIRED_BACKGROUND_LOAD 20 +static char main_thread_stack[CYGHWR_NET_DRIVERS][STACK_SIZE]; +static cyg_thread main_thread_data[CYGHWR_NET_DRIVERS]; +static cyg_handle_t main_thread_handle[CYGHWR_NET_DRIVERS]; +static char idle_thread_stack[STACK_SIZE]; +static cyg_thread idle_thread_data; +static cyg_handle_t idle_thread_handle; +static cyg_sem_t idle_thread_sem; +volatile static long long idle_thread_count; +static cyg_tick_count_t idle_thread_start_time; +static cyg_tick_count_t idle_thread_stop_time; +static char load_thread_stack[NUM_LOAD_THREADS][STACK_SIZE]; +static cyg_thread load_thread_data[NUM_LOAD_THREADS]; +static cyg_handle_t load_thread_handle[NUM_LOAD_THREADS]; +static cyg_sem_t load_thread_sem[NUM_LOAD_THREADS]; +static long load_thread_level; +static void calibrate_load(int load); +static void start_load(int load); +static void do_some_random_computation(int p); +#define abs(n) ((n) < 0 ? -(n) : (n)) +#endif + +#ifdef __ECOS +#define test_param_t cyg_addrword_t +#ifdef CYGDBG_NET_TIMING_STATS +extern void show_net_times(void); +#endif +#else +#define test_param_t int +#endif + +#define MAX_BUF 8192 +static unsigned char in_buf[MAX_BUF], out_buf[MAX_BUF]; + +#ifdef __ECOS +extern void +cyg_test_exit(void); +#else +void +cyg_test_exit(void) +{ + test_printf("... Done\n"); + exit(1); +} + +static void +show_net_times(void) +{ +} +#endif + +#ifdef __ECOS +static void +test_delay(int ticks) +{ + cyg_thread_delay(ticks); +} + +#else + +static void +test_delay(int ticks) +{ + usleep(ticks * 10000); +} +#endif + +void +pexit(char *s) +{ + perror(s); +#ifdef CYGDBG_NET_TIMING_STATS + show_net_times(); +#endif + cyg_test_exit(); +} + +// +// Generic UDP test +// + +static void +do_udp_test(int s1, struct nc_request *req, struct sockaddr_in *master) +{ + int i, s, td_len, seq, seq_errors, lost; + struct sockaddr_in test_chan_slave, test_chan_master; + fd_set fds; + struct timeval timeout; + struct nc_test_results results; + struct nc_test_data *tdp; + int nsent, nrecvd; + int need_recv, need_send; + + need_recv = true; need_send = true; + switch (ntohl(req->type)) { + case NC_REQUEST_UDP_SEND: + need_recv = false; + need_send = true; + break; + case NC_REQUEST_UDP_RECV: + need_recv = true; + need_send = false; + break; + case NC_REQUEST_UDP_ECHO: + break; + } + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + memset((char *) &test_chan_slave, 0, sizeof(test_chan_slave)); + test_chan_slave.sin_family = AF_INET; +#ifdef __ECOS + test_chan_slave.sin_len = sizeof(test_chan_slave); +#endif + test_chan_slave.sin_addr.s_addr = htonl(INADDR_ANY); + test_chan_slave.sin_port = htons(ntohl(req->slave_port)); + + if (bind(s, (struct sockaddr *) &test_chan_slave, sizeof(test_chan_slave)) < 0) { + perror("bind"); + close(s); + } + + memcpy(&test_chan_master, master, sizeof(*master)); + test_chan_master.sin_port = htons(ntohl(req->master_port)); + nsent = 0; nrecvd = 0; seq = 0; seq_errors = 0; lost = 0; + for (i = 0; i < ntohl(req->nbufs); i++) { + if (need_recv) { + FD_ZERO(&fds); + FD_SET(s, &fds); + timeout.tv_sec = NC_TEST_TIMEOUT; + timeout.tv_usec = 0; + if (select(s+1, &fds, 0, 0, &timeout) <= 0) { + test_printf("recvfrom timeout, expecting seq #%d\n", seq); + if (++lost > MAX_ERRORS) { + test_printf("... giving up\n"); + break; + } + } else { + nrecvd++; + tdp = (struct nc_test_data *)in_buf; + td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); + if (recvfrom(s, tdp, td_len, 0, 0, 0) < 0) { + perror("recvfrom"); + close(s); + return; + } + if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && + (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { + if (ntohl(tdp->seq) != seq) { + test_printf("Packets out of sequence - recvd: %d, expected: %d\n", + ntohl(tdp->seq), seq); + seq = ntohl(tdp->seq); + seq_errors++; + } + } else { + test_printf("Bad data packet - key: %x/%x, seq: %d\n", + ntohl(tdp->key1), ntohl(tdp->key2), + ntohl(tdp->seq)); + } + } + } + if (need_send) { + tdp = (struct nc_test_data *)out_buf; + tdp->key1 = htonl(NC_TEST_DATA_KEY1); + tdp->key2 = htonl(NC_TEST_DATA_KEY2); + tdp->seq = htonl(seq); + td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); + tdp->len = htonl(td_len); + if (sendto(s, tdp, td_len, 0, + (struct sockaddr *)&test_chan_master, sizeof(test_chan_master)) < 0) { + perror("sendto"); + if (errno == ENOBUFS) { + // Saturated the system + test_delay(10); // Time for 200 500 byte 10-baseT packets + } else { + // What else to do? + close(s); + return; + } + } else { + nsent++; + } + } + seq++; + } + results.key1 = htonl(NC_TEST_RESULT_KEY1); + results.key2 = htonl(NC_TEST_RESULT_KEY2); + results.seq = req->seq; + results.nsent = htonl(nsent); + results.nrecvd = htonl(nrecvd); + if (sendto(s, &results, sizeof(results), 0, + (struct sockaddr *)&test_chan_master, sizeof(test_chan_master)) < 0) { + perror("sendto"); + } + close(s); +} + +// +// Read data from a stream, accounting for the fact that packet 'boundaries' +// are not preserved. This can also timeout (which would probably wreck the +// data boundaries). +// + +int +do_read(int fd, void *buf, int buflen) +{ + char *p = (char *)buf; + int len = buflen; + int res; + while (len) { + res = read(fd, p, len); + if (res < 0) { + perror("read"); + } else { + len -= res; + p += res; + if (res == 0) { + break; + } + } + } + return (buflen - len); +} + +// +// Generic TCP test +// + +static void +do_tcp_test(int s1, struct nc_request *req, struct sockaddr_in *master) +{ + int i, s, len, td_len, seq, seq_errors, lost, test_chan, res; + struct sockaddr_in test_chan_slave, test_chan_master; + struct nc_test_results results; + struct nc_test_data *tdp; + int nsent, nrecvd; + int need_recv, need_send; + int one = 1; + static int slave_tcp_port = -1; + + need_recv = true; need_send = true; + switch (ntohl(req->type)) { + case NC_REQUEST_TCP_SEND: + need_recv = false; + need_send = true; + break; + case NC_REQUEST_TCP_RECV: + need_recv = true; + need_send = false; + break; + case NC_REQUEST_TCP_ECHO: + break; + } + + if (slave_tcp_port < 0) { + s = socket(AF_INET, SOCK_STREAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + perror("setsockopt SO_REUSEADDR"); + return; + } +#ifdef SO_REUSEPORT + if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { + perror("setsockopt SO_REUSEPORT"); + return; + } +#endif + memset((char *) &test_chan_slave, 0, sizeof(test_chan_slave)); + test_chan_slave.sin_family = AF_INET; +#ifdef __ECOS + test_chan_slave.sin_len = sizeof(test_chan_slave); +#endif + test_chan_slave.sin_addr.s_addr = htonl(INADDR_ANY); + test_chan_slave.sin_port = htons(ntohl(req->slave_port)); + + if (bind(s, (struct sockaddr *) &test_chan_slave, sizeof(test_chan_slave)) < 0) { + perror("bind"); + close(s); + } + listen(s, SOMAXCONN); + slave_tcp_port = s; + } + + s = slave_tcp_port; + len = sizeof(test_chan_master); + if ((test_chan = accept(s, (struct sockaddr *)&test_chan_master, &len)) < 0) { + pexit("accept"); + } + len = sizeof(test_chan_master); + getpeername(test_chan, (struct sockaddr *)&test_chan_master, &len); + test_printf("connection from %s.%d\n", inet_ntoa(test_chan_master.sin_addr), + ntohs(test_chan_master.sin_port)); + + nsent = 0; nrecvd = 0; seq = 0; seq_errors = 0; lost = 0; + for (i = 0; i < ntohl(req->nbufs); i++) { + if (need_recv) { + tdp = (struct nc_test_data *)in_buf; + td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); + res = do_read(test_chan, tdp, td_len); + if (res != td_len) { + test_printf("recvfrom timeout, expecting seq #%d\n", seq); + if (++lost > MAX_ERRORS) { + test_printf("... giving up\n"); + break; + } + } else { + nrecvd++; + if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && + (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { + if (ntohl(tdp->seq) != seq) { + test_printf("Packets out of sequence - recvd: %d, expected: %d\n", + ntohl(tdp->seq), seq); + seq = ntohl(tdp->seq); + seq_errors++; + } + } else { + test_printf("Bad data packet - key: %x/%x, seq: %d\n", + ntohl(tdp->key1), ntohl(tdp->key2), + ntohl(tdp->seq)); + } + } + } + if (need_send) { + tdp = (struct nc_test_data *)out_buf; + tdp->key1 = htonl(NC_TEST_DATA_KEY1); + tdp->key2 = htonl(NC_TEST_DATA_KEY2); + tdp->seq = htonl(seq); + td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); + tdp->len = htonl(td_len); + if (write(test_chan, tdp, td_len) != td_len) { + perror("write"); + if (errno == ENOBUFS) { + // Saturated the system + test_delay(25); + } else { + // What else to do? + close(test_chan); + return; + } + } else { + nsent++; + } + } + seq++; + } + results.key1 = htonl(NC_TEST_RESULT_KEY1); + results.key2 = htonl(NC_TEST_RESULT_KEY2); + results.seq = req->seq; + results.nsent = htonl(nsent); + results.nrecvd = htonl(nrecvd); + if (write(test_chan, &results, sizeof(results)) != sizeof(results)) { + perror("write"); + } + close(test_chan); +} + +// +// Protocol driver for testing slave. +// +// This function is the main routine running here, handling requests sent from +// the master and providing various responses. +// +static void +nc_slave(test_param_t param) +{ + int s, masterlen; + struct sockaddr_in my_addr, master; + struct nc_request req; + struct nc_reply reply; + int done = false; + + test_printf("Start test for eth%d\n", param); + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + pexit("datagram socket"); + } + + memset((char *) &my_addr, 0, sizeof(my_addr)); + my_addr.sin_family = AF_INET; +#ifdef __ECOS + my_addr.sin_len = sizeof(my_addr); +#endif + my_addr.sin_addr.s_addr = htonl(INADDR_ANY); + my_addr.sin_port = htons(NC_SLAVE_PORT); + + if (bind(s, (struct sockaddr *) &my_addr, sizeof(my_addr)) < 0) { + pexit("bind"); + } + + while (!done) { + masterlen = sizeof(master); + if (recvfrom(s, &req, sizeof(req), 0, (struct sockaddr *)&master, &masterlen) < 0) { + pexit("recvfrom"); + } +#if 0 + test_printf("Request %d from %s:%d\n", ntohl(req.type), + inet_ntoa(master.sin_addr), ntohs(master.sin_port)); +#endif + reply.response = htonl(NC_REPLY_ACK); + reply.seq = req.seq; + switch (ntohl(req.type)) { + case NC_REQUEST_DISCONNECT: + done = true; + break; + case NC_REQUEST_UDP_SEND: + test_printf("UDP send - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; + case NC_REQUEST_UDP_RECV: + test_printf("UDP recv - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; + case NC_REQUEST_UDP_ECHO: + test_printf("UDP echo - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; + case NC_REQUEST_TCP_SEND: + test_printf("TCP send - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; + case NC_REQUEST_TCP_RECV: + test_printf("TCP recv - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; + case NC_REQUEST_TCP_ECHO: + test_printf("TCP echo - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); + break; +#ifdef __ECOS + case NC_REQUEST_SET_LOAD: + start_load(ntohl(req.nbufs)); + break; + case NC_REQUEST_START_IDLE: + test_printf("Start IDLE thread\n"); + idle_thread_count = 0; + idle_thread_start_time = cyg_current_time(); + cyg_semaphore_post(&idle_thread_sem); + break; + case NC_REQUEST_STOP_IDLE: + cyg_semaphore_wait(&idle_thread_sem); + idle_thread_stop_time = cyg_current_time(); + test_printf("Stop IDLE thread\n"); + reply.misc.idle_results.elapsed_time = htonl(idle_thread_stop_time - idle_thread_start_time); + reply.misc.idle_results.count[0] = htonl(idle_thread_count >> 32); + reply.misc.idle_results.count[1] = htonl((long)idle_thread_count); + break; +#endif + default: + test_printf("Unrecognized request: %d\n", ntohl(req.type)); + reply.response = htonl(NC_REPLY_NAK); + reply.reason = htonl(NC_REPLY_NAK_UNKNOWN_REQUEST); + break; + } + if (sendto(s, &reply, sizeof(reply), 0, (struct sockaddr *)&master, masterlen) < 0) { + pexit("sendto"); + } + if (reply.response == ntohl(NC_REPLY_NAK)) { + continue; + } + switch (ntohl(req.type)) { + case NC_REQUEST_UDP_SEND: + case NC_REQUEST_UDP_RECV: + case NC_REQUEST_UDP_ECHO: + do_udp_test(s, &req, &master); + break; + case NC_REQUEST_TCP_SEND: + case NC_REQUEST_TCP_RECV: + case NC_REQUEST_TCP_ECHO: + do_tcp_test(s, &req, &master); + break; + case NC_REQUEST_START_IDLE: + case NC_REQUEST_STOP_IDLE: + case NC_REQUEST_SET_LOAD: + default: + break; + } + } + close(s); +} + +void +net_test(test_param_t param) +{ +// int i; + if (param == 0) { + test_printf("Start Network Characterization - SLAVE\n"); +#ifdef __ECOS + init_all_network_interfaces(); + calibrate_load(DESIRED_BACKGROUND_LOAD); +#if 0 +// I can see what this is trying to do, but I get "bind: Address already in +// use" errors from the 2nd interface - and the parameter is not used +// anyway, so one thread does quite well enough (but only tests one i/f at +// once). + +// Comment in the 'int i' above too. + for (i = 1; i < CYGHWR_NET_DRIVERS; i++) { + cyg_thread_resume(main_thread_handle[i]); // Start other threads + } +#endif +#endif + } + nc_slave(param); +#ifdef CYGDBG_NET_TIMING_STATS + show_net_times(); +#endif + cyg_test_exit(); +} + +#ifdef __ECOS + +// +// This function is called to calibrate the "background load" which can be +// applied during testing. It will be called before any commands from the +// host are managed. +// +static void +calibrate_load(int desired_load) +{ + long long no_load_idle, load_idle; + int percent_load; + int high, low; + + // Set limits + high = MAX_LOAD_THREAD_LEVEL; + low = MIN_LOAD_THREAD_LEVEL; + + // Compute the "no load" idle value + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + no_load_idle = idle_thread_count; + diag_printf("No load = %d\n", (int)idle_thread_count); + + // First ensure that the HIGH level is indeed higher + while (true) { + load_thread_level = high; + start_load(desired_load); // Start up a given load + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + load_idle = idle_thread_count; + start_load(0); // Shut down background load + percent_load = 100 - ((load_idle * 100) / no_load_idle); + diag_printf("High Load[%d] = %d => %d%%\n", load_thread_level, + (int)idle_thread_count, percent_load); + if ( percent_load > desired_load ) + break; // HIGH level is indeed higher + low = load_thread_level; // known to be lower + high *= 2; // else double it and try again + } + + // Now chop down to the level required + while (true) { + load_thread_level = (high + low) / 2; + start_load(desired_load); // Start up a given load + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + load_idle = idle_thread_count; + start_load(0); // Shut down background load + percent_load = 100 - ((load_idle * 100) / no_load_idle); + diag_printf("Load[%d] = %d => %d%%\n", load_thread_level, + (int)idle_thread_count, percent_load); + if (((high-low) <= 1) || (abs(desired_load-percent_load) <= 2)) break; + if (percent_load < desired_load) { + low = load_thread_level; + } else { + high = load_thread_level; + } + } + + // Now we are within a few percent of the target; scale the load + // factor to get a better fit, and test it, print the answer. + load_thread_level *= desired_load; + load_thread_level /= percent_load; + start_load(desired_load); // Start up a given load + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + load_idle = idle_thread_count; + start_load(0); // Shut down background load + percent_load = 100 - ((load_idle * 100) / no_load_idle); + diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level, + (int)idle_thread_count, percent_load); +// no_load_idle_count_1_second = no_load_idle; +} + +// +// This function is called to set up a load level of 'load' percent (given +// as a whole number, e.g. start_load(20) would mean initiate a background +// load of 20%, leaving the cpu 80% idle). +// +static void +start_load(int load) +{ + static int prev_load = 0; + int i; + test_printf("Set background load = %d%%\n", load); + if (load == 0) { + if (prev_load == 0) return; // Nothing out there to stop + for (i = 0; i < prev_load/10; i++) { + cyg_semaphore_wait(&load_thread_sem[i]); + } + prev_load = 0; + } else { + for (i = 0; i < load/10; i++) { + cyg_semaphore_post(&load_thread_sem[i]); + } + prev_load = load; + } +} + +// +// These thread(s) do some amount of "background" computing. This is used +// to simulate a given load level. They need to be run at a higher priority +// than the network code itself. +// +// Like the "idle" thread, they run as long as their "switch" (aka semaphore) +// is enabled. +// +void +net_load(cyg_addrword_t who) +{ + int i; + while (true) { + cyg_semaphore_wait(&load_thread_sem[who]); + for (i = 0; i < load_thread_level; i++) { + do_some_random_computation(i); + } + cyg_thread_delay(1); // Wait until the next 'tick' + cyg_semaphore_post(&load_thread_sem[who]); + } +} + +// +// Some arbitrary computation, designed to use up the CPU and cause associated +// cache "thrash" behaviour - part of background load modelling. +// +static void +do_some_random_computation(int p) +{ + // Just something that might be "hard" + volatile double x; + x = ((p * 10) * 3.14159) / 180.0; // radians +} + +// +// This thread does nothing but count. It will be allowed to count +// as long as the semaphore is "free". +// +void +net_idle(cyg_addrword_t param) +{ + while (true) { + cyg_semaphore_wait(&idle_thread_sem); + idle_thread_count++; + cyg_semaphore_post(&idle_thread_sem); + } +} + +void +cyg_start(void) +{ + int i; + // Create processing threads + for (i = 0; i < CYGHWR_NET_DRIVERS; i++) { + cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority + net_test, // entry + i, // entry parameter + "Network test", // Name + &main_thread_stack[i][0], // Stack + STACK_SIZE, // Size + &main_thread_handle[i], // Handle + &main_thread_data[i] // Thread data structure + ); + } + cyg_thread_resume(main_thread_handle[0]); // Start first one + // Create the idle thread environment + cyg_semaphore_init(&idle_thread_sem, 0); + cyg_thread_create(IDLE_THREAD_PRIORITY, // Priority + net_idle, // entry + 0, // entry parameter + "Network idle", // Name + &idle_thread_stack[0], // Stack + STACK_SIZE, // Size + &idle_thread_handle, // Handle + &idle_thread_data // Thread data structure + ); + cyg_thread_resume(idle_thread_handle); // Start it + // Create the load threads and their environment(s) + for (i = 0; i < NUM_LOAD_THREADS; i++) { + cyg_semaphore_init(&load_thread_sem[i], 0); + cyg_thread_create(LOAD_THREAD_PRIORITY, // Priority + net_load, // entry + i, // entry parameter + "Background load", // Name + &load_thread_stack[i][0], // Stack + STACK_SIZE, // Size + &load_thread_handle[i], // Handle + &load_thread_data[i] // Thread data structure + ); + cyg_thread_resume(load_thread_handle[i]); // Start it + } + cyg_scheduler_start(); +} + +#else + +int +main(int argc, char *argv[]) +{ + net_test(0); +} +#endif diff --git a/packages/net/common/current/tests/ping_lo_test.c b/packages/net/common/current/tests/ping_lo_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/ping_lo_test.c @@ -0,0 +1,242 @@ +//========================================================================== +// +// tests/ping_lo_test.c +// +// Simple test of PING (ICMP) and networking support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas, sorin@netappi.com +// Contributors: gthomas, sorin@netappi.com +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// PING test code + +#include + +#include + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +#define NUM_PINGS 16 +#define MAX_PACKET 4096 +static unsigned char pkt1[MAX_PACKET], pkt2[MAX_PACKET]; + +#define UNIQUEID 0x1234 + +void +pexit(char *s) +{ + CYG_TEST_FAIL_FINISH( s ); +} + +// Compute INET checksum +int +inet_cksum(u_short *addr, int len) +{ + register int nleft = len; + register u_short *w = addr; + register u_short answer; + register u_int sum = 0; + u_short odd_byte = 0; + + /* + * Our algorithm is simple, using a 32 bit accumulator (sum), + * we add sequential 16 bit words to it, and at the end, fold + * back all the carry bits from the top 16 bits into the lower + * 16 bits. + */ + while( nleft > 1 ) { + sum += *w++; + nleft -= 2; + } + + /* mop up an odd byte, if necessary */ + if( nleft == 1 ) { + *(u_char *)(&odd_byte) = *(u_char *)w; + sum += odd_byte; + } + + /* + * add back carry outs from top 16 bits to low 16 bits + */ + sum = (sum >> 16) + (sum & 0x0000ffff); /* add hi 16 to low 16 */ + sum += (sum >> 16); /* add carry */ + answer = ~sum; /* truncate to 16 bits */ + return (answer); +} + +static int +show_icmp(unsigned char *pkt, int len, + struct sockaddr_in *from, struct sockaddr_in *to) +{ + cyg_tick_count_t *tp, tv; + struct ip *ip; + struct icmp *icmp; + tv = cyg_current_time(); + ip = (struct ip *)pkt; + if ((len < sizeof(*ip)) || ip->ip_v != IPVERSION) { + diag_printf("%s: Short packet or not IP! - Len: %d, Version: %d\n", + inet_ntoa(from->sin_addr), len, ip->ip_v); + return 0; + } + icmp = (struct icmp *)(pkt + sizeof(*ip)); + len -= (sizeof(*ip) + 8); + tp = (cyg_tick_count_t *)&icmp->icmp_data; + if (icmp->icmp_type != ICMP_ECHOREPLY) { + diag_printf("%s: Invalid ICMP - type: %d\n", + inet_ntoa(from->sin_addr), icmp->icmp_type); + return 0; + } + if (icmp->icmp_id != UNIQUEID) { + diag_printf("%s: ICMP received for wrong id - sent: %x, recvd: %x\n", + inet_ntoa(from->sin_addr), UNIQUEID, icmp->icmp_id); + } + diag_printf("%d bytes from %s: ", len, inet_ntoa(from->sin_addr)); + diag_printf("icmp_seq=%d", icmp->icmp_seq); + diag_printf(", time=%dms\n", (int)(tv - *tp)*10); + return (from->sin_addr.s_addr == to->sin_addr.s_addr); +} + +static void +ping_host(int s, struct sockaddr_in *host) +{ + struct icmp *icmp = (struct icmp *)pkt1; + int icmp_len = 64; + int seq, ok_recv, bogus_recv; + cyg_tick_count_t *tp; + long *dp; + struct sockaddr_in from; + int i, len, fromlen; + + ok_recv = 0; + bogus_recv = 0; + diag_printf("PING server %s\n", inet_ntoa(host->sin_addr)); + for (seq = 0; seq < NUM_PINGS; seq++) { + // Build ICMP packet + icmp->icmp_type = ICMP_ECHO; + icmp->icmp_code = 0; + icmp->icmp_cksum = 0; + icmp->icmp_seq = seq; + icmp->icmp_id = 0x1234; + // Set up ping data + tp = (cyg_tick_count_t *)&icmp->icmp_data; + *tp++ = cyg_current_time(); + dp = (long *)tp; + for (i = sizeof(*tp); i < icmp_len; i += sizeof(*dp)) { + *dp++ = i; + } + // Add checksum + icmp->icmp_cksum = inet_cksum( (u_short *)icmp, icmp_len+8); + // Send it off + if (sendto(s, icmp, icmp_len+8, 0, (struct sockaddr *)host, sizeof(*host)) < 0) { + perror("sendto"); + continue; + } + // Wait for a response + fromlen = sizeof(from); + len = recvfrom(s, pkt2, sizeof(pkt2), 0, (struct sockaddr *)&from, &fromlen); + if (len < 0) { + perror("recvfrom"); + } else { + if (show_icmp(pkt2, len, &from, host)) { + ok_recv++; + } else { + bogus_recv++; + } + } + } + diag_printf("Sent %d packets, received %d OK, %d bad\n", NUM_PINGS, ok_recv, bogus_recv); +} + +static void +ping_test_loopback( int lo ) +{ + struct protoent *p; + struct timeval tv; + struct sockaddr_in host; + int s; + + if ((p = getprotobyname("icmp")) == (struct protoent *)0) { + perror("getprotobyname"); + return; + } + s = socket(AF_INET, SOCK_RAW, p->p_proto); + if (s < 0) { + perror("socket"); + return; + } + tv.tv_sec = 1; + tv.tv_usec = 0; + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + // Set up host address + host.sin_family = AF_INET; + host.sin_len = sizeof(host); + host.sin_addr.s_addr = htonl(INADDR_LOOPBACK + (0x100 * lo)); + host.sin_port = 0; + ping_host(s, &host); + // Now try a bogus host + host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + 32); + ping_host(s, &host); +} + +void +net_test(cyg_addrword_t p) +{ + int i; + diag_printf("Start PING test\n"); + init_all_network_interfaces(); +#if NLOOP > 0 + for ( i = 0; i < NLOOP; i++ ) + ping_test_loopback( i ); + for ( i = 0; i < NLOOP; i++ ) + ping_test_loopback( i ); + CYG_TEST_PASS_FINISH( "Done pinging loopback" ); +#endif + CYG_TEST_NA( "No loopback devs" ); +} + +void +cyg_start(void) +{ + CYG_TEST_INIT(); + + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(CYGPKG_NET_THREAD_PRIORITY-4,// Priority - just a number + net_test, // entry + 0, // entry parameter + "Loopback ping test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} diff --git a/packages/net/common/current/tests/ping_test.c b/packages/net/common/current/tests/ping_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/ping_test.c @@ -0,0 +1,284 @@ +//========================================================================== +// +// tests/ping_test.c +// +// Simple test of PING (ICMP) and networking support +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// PING test code + +#include + +#include +#include + +#include + +#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists +#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME +#endif + +#ifdef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS // do we use the rt test? +# ifdef CYGTST_DEVS_ETH_TEST_NET_REALTIME // Get the test ancilla if it exists +# include CYGTST_DEVS_ETH_TEST_NET_REALTIME +# endif +#endif + +// Fill in the blanks if necessary +#ifndef TNR_OFF +# define TNR_OFF() +#endif +#ifndef TNR_ON +# define TNR_ON() +#endif +#ifndef TNR_INIT +# define TNR_INIT() +#endif +#ifndef TNR_PRINT_ACTIVITY +# define TNR_PRINT_ACTIVITY() +#endif + + + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +#define NUM_PINGS 16 +#define MAX_PACKET 4096 +#define MIN_PACKET 64 +#define MAX_SEND 4000 + +#define PACKET_ADD ((MAX_SEND - MIN_PACKET)/NUM_PINGS) +#define nPACKET_ADD 1 + +static unsigned char pkt1[MAX_PACKET], pkt2[MAX_PACKET]; + +#define UNIQUEID 0x1234 + +void +pexit(char *s) +{ + CYG_TEST_FAIL_FINISH(s); +} + +// Compute INET checksum +int +inet_cksum(u_short *addr, int len) +{ + register int nleft = len; + register u_short *w = addr; + register u_short answer; + register u_int sum = 0; + u_short odd_byte = 0; + + /* + * Our algorithm is simple, using a 32 bit accumulator (sum), + * we add sequential 16 bit words to it, and at the end, fold + * back all the carry bits from the top 16 bits into the lower + * 16 bits. + */ + while( nleft > 1 ) { + sum += *w++; + nleft -= 2; + } + + /* mop up an odd byte, if necessary */ + if( nleft == 1 ) { + *(u_char *)(&odd_byte) = *(u_char *)w; + sum += odd_byte; + } + + /* + * add back carry outs from top 16 bits to low 16 bits + */ + sum = (sum >> 16) + (sum & 0x0000ffff); /* add hi 16 to low 16 */ + sum += (sum >> 16); /* add carry */ + answer = ~sum; /* truncate to 16 bits */ + return (answer); +} + +static int +show_icmp(unsigned char *pkt, int len, + struct sockaddr_in *from, struct sockaddr_in *to) +{ + cyg_tick_count_t *tp, tv; + struct ip *ip; + struct icmp *icmp; + tv = cyg_current_time(); + ip = (struct ip *)pkt; + if ((len < sizeof(*ip)) || ip->ip_v != IPVERSION) { + diag_printf("%s: Short packet or not IP! - Len: %d, Version: %d\n", + inet_ntoa(from->sin_addr), len, ip->ip_v); + return 0; + } + icmp = (struct icmp *)(pkt + sizeof(*ip)); + len -= (sizeof(*ip) + 8); + tp = (cyg_tick_count_t *)&icmp->icmp_data; + if (icmp->icmp_type != ICMP_ECHOREPLY) { + diag_printf("%s: Invalid ICMP - type: %d\n", + inet_ntoa(from->sin_addr), icmp->icmp_type); + return 0; + } + if (icmp->icmp_id != UNIQUEID) { + diag_printf("%s: ICMP received for wrong id - sent: %x, recvd: %x\n", + inet_ntoa(from->sin_addr), UNIQUEID, icmp->icmp_id); + } + diag_printf("%d bytes from %s: ", len, inet_ntoa(from->sin_addr)); + diag_printf("icmp_seq=%d", icmp->icmp_seq); + diag_printf(", time=%dms\n", (int)(tv - *tp)*10); + return (from->sin_addr.s_addr == to->sin_addr.s_addr); +} + +static void +ping_host(int s, struct sockaddr_in *host) +{ + struct icmp *icmp = (struct icmp *)pkt1; + int icmp_len = MIN_PACKET; + int seq, ok_recv, bogus_recv; + cyg_tick_count_t *tp; + long *dp; + struct sockaddr_in from; + int i, len, fromlen; + + ok_recv = 0; + bogus_recv = 0; + diag_printf("PING server %s\n", inet_ntoa(host->sin_addr)); + for (seq = 0; seq < NUM_PINGS; seq++, icmp_len += PACKET_ADD ) { + TNR_ON(); + // Build ICMP packet + icmp->icmp_type = ICMP_ECHO; + icmp->icmp_code = 0; + icmp->icmp_cksum = 0; + icmp->icmp_seq = seq; + icmp->icmp_id = 0x1234; + // Set up ping data + tp = (cyg_tick_count_t *)&icmp->icmp_data; + *tp++ = cyg_current_time(); + dp = (long *)tp; + for (i = sizeof(*tp); i < icmp_len; i += sizeof(*dp)) { + *dp++ = i; + } + // Add checksum + icmp->icmp_cksum = inet_cksum( (u_short *)icmp, icmp_len+8); + // Send it off + if (sendto(s, icmp, icmp_len+8, 0, (struct sockaddr *)host, sizeof(*host)) < 0) { + TNR_OFF(); + perror("sendto"); + continue; + } + // Wait for a response + fromlen = sizeof(from); + len = recvfrom(s, pkt2, sizeof(pkt2), 0, (struct sockaddr *)&from, &fromlen); + TNR_OFF(); + if (len < 0) { + perror("recvfrom"); + icmp_len = MIN_PACKET - PACKET_ADD; // just in case - long routes + } else { + if (show_icmp(pkt2, len, &from, host)) { + ok_recv++; + } else { + bogus_recv++; + } + } + } + TNR_OFF(); + diag_printf("Sent %d packets, received %d OK, %d bad\n", NUM_PINGS, ok_recv, bogus_recv); +} + +static void +ping_test(struct bootp *bp) +{ + struct protoent *p; + struct timeval tv; + struct sockaddr_in host; + int s; + + if ((p = getprotobyname("icmp")) == (struct protoent *)0) { + pexit("getprotobyname"); + return; + } + s = socket(AF_INET, SOCK_RAW, p->p_proto); + if (s < 0) { + pexit("socket"); + return; + } + tv.tv_sec = 1; + tv.tv_usec = 0; + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + // Set up host address + host.sin_family = AF_INET; + host.sin_len = sizeof(host); + host.sin_addr = bp->bp_siaddr; + host.sin_port = 0; + ping_host(s, &host); + // Now try a bogus host + host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + 32); + ping_host(s, &host); +} + +void +net_test(cyg_addrword_t p) +{ + diag_printf("Start PING test\n"); + TNR_INIT(); + init_all_network_interfaces(); +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) { + ping_test(ð0_bootp_data); + } +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if (eth1_up) { + ping_test(ð1_bootp_data); + } +#endif + TNR_PRINT_ACTIVITY(); + CYG_TEST_PASS_FINISH("Ping test OK"); +} + +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} diff --git a/packages/net/common/current/tests/server_test.c b/packages/net/common/current/tests/server_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/server_test.c @@ -0,0 +1,152 @@ +//========================================================================== +// +// tests/server_test.c +// +// Simple TCP 'server' test +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== +// Network server test code +#include +#include +#include + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +extern void +cyg_test_exit(void); + +void +pexit(char *s) +{ + perror(s); + cyg_test_exit(); +} + +static void +server_test(struct bootp *bp) +{ + int s, client, client_len; + struct sockaddr_in client_addr, local; + char buf[256]; + int one = 1; + fd_set in_fds; + int num, len; + struct timeval tv; + + s = socket(AF_INET, SOCK_STREAM, 0); + if (s < 0) { + pexit("stream socket"); + } + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + pexit("setsockopt SO_REUSEADDR"); + } + if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { + pexit("setsockopt SO_REUSEPORT"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = htons(7734); + local.sin_addr.s_addr = INADDR_ANY; + if(bind(s, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind error"); + } + listen(s, SOMAXCONN); + while (true) { + client_len = sizeof(client_addr); + if ((client = accept(s, (struct sockaddr *)&client_addr, &client_len)) < 0) { + pexit("accept"); + } + client_len = sizeof(client_addr); + getpeername(client, (struct sockaddr *)&client_addr, &client_len); + diag_printf("connection from %s:%d\n", inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port)); + +#ifdef CYGPKG_LIBC_STDIO + sprintf(buf, "Hello %s:%d\n", inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port)); +#else + strcpy(buf, "Hello "); + strcat(buf, inet_ntoa(client_addr.sin_addr)); + strcat(buf,":"); + strcat(buf, atoi(ntohs(client_addr.sin_port))); + strcat(buf,"\n"); +#endif + + write(client, buf, strlen(buf)); + tv.tv_sec = 5; + tv.tv_usec = 0; + FD_ZERO(&in_fds); + FD_SET(client, &in_fds); + num = select(client+1, &in_fds, 0, 0, &tv); + if (num > 0) { + len = read(client, buf, sizeof(buf)-1); + buf[len] = '\0'; + diag_printf("buf = '%s'\n", buf); + } else if (num == 0) { + diag_printf("No reply - timed out\n"); + } else { + perror("select"); + } + close(client); + } + close(s); +} + +void +net_test(cyg_addrword_t param) +{ + diag_printf("Start SERVER test\n"); + init_all_network_interfaces(); +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) { + server_test(ð0_bootp_data); + } +#endif + cyg_test_exit(); +} + +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} diff --git a/packages/net/common/current/tests/set_mac_address.c b/packages/net/common/current/tests/set_mac_address.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/set_mac_address.c @@ -0,0 +1,172 @@ +//========================================================================== +// +// tests/set_mac_address.c +// +// Set_Mac_Address Utility - this carefully does NOTHING unless you +// edit this source file to confirm that you really want to do it. +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): hmt +// Contributors: +// Date: 2000-05-03 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists +#include CYGBLD_DEVS_ETH_DEVICE_H +#endif + + +// SET_MAC_ADDRESS test code + +#include + +#include + +#define NUMTHREADS 1 +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char thread_stack[NUMTHREADS][STACK_SIZE]; +static cyg_thread thread_data[NUMTHREADS]; +static cyg_handle_t thread_handle[NUMTHREADS]; + +extern void +cyg_test_exit(void); + +void +pexit(char *s) +{ + perror(s); + cyg_test_exit(); +} + +// ------------------------------------------------------------------------ +// remove NT to make this utility be useful ;-) +#define DONT_SET_ETH0 +#define DONT_SET_ETH1 + +// These are commented out to make sure you choose a value: +#ifdef DO_SET_ETH0 +//static cyg_uint8 new_eth0_addr[6]={ 0x0,0x90,0x27,0x8c,0x57,0xdd}; +//static cyg_uint8 new_eth0_addr[6]={ 0x0,0x90,0x27,0x8c,0x57,0xdb}; +#endif +#ifdef DO_SET_ETH1 +//static cyg_uint8 new_eth1_addr[6]={ 0x0,0x90,0x27,0x8c,0x57,0xde}; +//static cyg_uint8 new_eth1_addr[6]={ 0x0,0x90,0x27,0x8c,0x57,0xdc}; +#endif + +// ------------------------------------------------------------------------ + +int +set_mac_address( const char *interface, char *mac_address ) +{ + int s, i; + struct ifreq ifr; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + perror("socket"); + return false; + } + + diag_printf( "%s socket is %d:\n", interface, s ); + + strcpy(ifr.ifr_name, interface); + + for ( i = 0; i < ETHER_ADDR_LEN; i++ ) + ifr.ifr_hwaddr.sa_data[i] = mac_address[i]; + + diag_printf( "Mac addr %02x:%02x:%02x:%02x:%02x:%02x\n", + ifr.ifr_hwaddr.sa_data[0], + ifr.ifr_hwaddr.sa_data[1], + ifr.ifr_hwaddr.sa_data[2], + ifr.ifr_hwaddr.sa_data[3], + ifr.ifr_hwaddr.sa_data[4], + ifr.ifr_hwaddr.sa_data[5] ); + + if (ioctl(s, SIOCSIFHWADDR, &ifr)) { + perror("SIOCSIFHWADDR"); + close( s ); + return false; + } + + diag_printf( "%s ioctl(SIOCSIFHWADDR) succeeded\n", interface ); + + close( s ); + + return true; +} + +// ------------------------------------------------------------------------ +void +net_test(cyg_addrword_t param) +{ + int results = 0; + diag_printf("Start set_mac_address\n"); +#ifdef CYGHWR_NET_DRIVER_ETH0 +#ifdef DO_SET_ETH0 + diag_printf("Setting MAC of eth0 to %02x:%02x:%02x:%02x:%02x:%02x\n", + new_eth0_addr[0],new_eth0_addr[1], + new_eth0_addr[2],new_eth0_addr[3], + new_eth0_addr[4],new_eth0_addr[5] ); + results += set_mac_address( "eth0", new_eth0_addr ); +#endif +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 +#ifdef DO_SET_ETH1 + diag_printf("Setting MAC of eth1 to %02x:%02x:%02x:%02x:%02x:%02x\n", + new_eth1_addr[0],new_eth1_addr[1], + new_eth1_addr[2],new_eth1_addr[3], + new_eth1_addr[4],new_eth1_addr[5] ); + results += set_mac_address( "eth1", new_eth1_addr ); +#endif +#endif + + if ( 0 == results ) + diag_printf( "**** Did not set any MAC addresses ****\n" ); + + diag_printf("Init Network Interfaces\n"); + init_all_network_interfaces(); + diag_printf("After init.\n"); + + cyg_test_exit(); +} + +// ------------------------------------------------------------------------ +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &thread_stack[0][0], // Stack + STACK_SIZE, // Size + &thread_handle[0], // Handle + &thread_data[0] // Thread data structure + ); + cyg_thread_resume(thread_handle[0]); // Start it + + cyg_scheduler_start(); +} + +// EOF set_mac_address.c diff --git a/packages/net/common/current/tests/socket_test.c b/packages/net/common/current/tests/socket_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/socket_test.c @@ -0,0 +1,83 @@ +//========================================================================== +// +// tests/socket_test.c +// +// Test network socket functions +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: HLD +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// socket test code + +#include + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +extern void +cyg_test_exit(void); + +void +net_test(cyg_addrword_t param) +{ + int s; + int one = 1; + + diag_printf("Start socket test\n"); + + s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + diag_printf("socket() = %d\n", s); + s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + diag_printf("socket() = %d\n", s); + + if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one))) { + perror("setsockopt"); + } + + cyg_test_exit(); +} + +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} diff --git a/packages/net/common/current/tests/tcp_echo.c b/packages/net/common/current/tests/tcp_echo.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/tcp_echo.c @@ -0,0 +1,591 @@ +//========================================================================== +// +// tests/tcp_echo.c +// +// Simple TCP throughput test - echo component +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: This is the middle part of a three part test. The idea is +// to test the throughput of box in a configuration like this: +// +// +------+ port +----+ port +----+ +// |SOURCE|=========>|ECHO|============>|SINK| +// +------+ 9990 +----+ 9991 +----+ +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include +#include + +#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists +#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME +#endif + +#ifdef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS // do we use the rt test? +# ifdef CYGTST_DEVS_ETH_TEST_NET_REALTIME // Get the test ancilla if it exists +# include CYGTST_DEVS_ETH_TEST_NET_REALTIME +# endif +#endif + + +// Fill in the blanks if necessary +#ifndef TNR_OFF +# define TNR_OFF() +#endif +#ifndef TNR_ON +# define TNR_ON() +#endif +#ifndef TNR_INIT +# define TNR_INIT() +#endif +#ifndef TNR_PRINT_ACTIVITY +# define TNR_PRINT_ACTIVITY() +#endif + + +// Network throughput test code + +#include + +#include + +#define SOURCE_PORT 9990 +#define SINK_PORT 9991 + +#define MAX_BUF 8192 +static unsigned char data_buf[MAX_BUF]; + +struct test_params { + long nbufs; + long bufsize; + long load; +}; + +struct test_status { + long ok; +}; + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +// Background load stuff +#define NUM_LOAD_THREADS 20 // Get 5% granularity +#define IDLE_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY+3 +#define LOAD_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-3 +#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-4 +#define DESIRED_BACKGROUND_LOAD 50 // should be accurate enough over range + +// starting points for load calculation +#define MAX_LOAD_THREAD_LEVEL 100 +#define MIN_LOAD_THREAD_LEVEL 0 + +static char idle_thread_stack[STACK_SIZE]; +static cyg_thread idle_thread_data; +static cyg_handle_t idle_thread_handle; +static cyg_sem_t idle_thread_sem; +volatile static long long idle_thread_count; +static char load_thread_stack[NUM_LOAD_THREADS][STACK_SIZE]; +static cyg_thread load_thread_data[NUM_LOAD_THREADS]; +static cyg_handle_t load_thread_handle[NUM_LOAD_THREADS]; +static cyg_sem_t load_thread_sem[NUM_LOAD_THREADS]; +static long load_thread_level; +static void calibrate_load(int load); +static void start_load(int load); +static void do_some_random_computation(int p,int id); +#define abs(n) ((n) < 0 ? -(n) : (n)) + +static long long no_load_idle_count_1_second; + +extern void +cyg_test_exit(void); + +void +pexit(char *s) +{ + TNR_OFF(); + perror(s); + cyg_test_exit(); +} + +int +do_read(int s, void *_buf, int len) +{ + int total, slen, rlen; + unsigned char *buf = (unsigned char *)_buf; + total = 0; + rlen = len; + while (total < len) { + slen = read(s, buf, rlen); + if (slen != rlen) { + if (slen < 0) { + diag_printf("Error after reading %d bytes\n", total); + return -1; + } + rlen -= slen; + buf += slen; + } + total += slen; + } + return total; +} + +int +do_write(int s, void *_buf, int len) +{ + int total, slen, rlen; + unsigned char *buf = (unsigned char *)_buf; + total = 0; + rlen = len; + while (total < len) { + slen = write(s, buf, rlen); + if (slen != rlen) { + if (slen < 0) { + diag_printf("Error after writing %d bytes\n", total); + return -1; + } + rlen -= slen; + buf += slen; + } + total += slen; + } + return total; +} + +// +// This function is called to calibrate the "background load" which can be +// applied during testing. It will be called before any commands from the +// host are managed. +// +static void +calibrate_load(int desired_load) +{ + long long no_load_idle, load_idle; + int percent_load; + int high, low; + + // Set limits + high = MAX_LOAD_THREAD_LEVEL; + low = MIN_LOAD_THREAD_LEVEL; + + // Compute the "no load" idle value + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + no_load_idle = idle_thread_count; + diag_printf("No load = %d\n", (int)idle_thread_count); + + // First ensure that the HIGH level is indeed higher + while (true) { + load_thread_level = high; + start_load(desired_load); // Start up a given load + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + load_idle = idle_thread_count; + start_load(0); // Shut down background load + percent_load = 100 - ((load_idle * 100) / no_load_idle); + diag_printf("High Load[%d] = %d => %d%%\n", load_thread_level, + (int)idle_thread_count, percent_load); + if ( percent_load > desired_load ) + break; // HIGH level is indeed higher + low = load_thread_level; // known to be lower + high *= 2; // else double it and try again + } + + // Now chop down to the level required + while (true) { + load_thread_level = (high + low) / 2; + start_load(desired_load); // Start up a given load + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + load_idle = idle_thread_count; + start_load(0); // Shut down background load + percent_load = 100 - ((load_idle * 100) / no_load_idle); + diag_printf("Load[%d] = %d => %d%%\n", load_thread_level, + (int)idle_thread_count, percent_load); + if (((high-low) <= 1) || (abs(desired_load-percent_load) <= 2)) break; + if (percent_load < desired_load) { + low = load_thread_level; + } else { + high = load_thread_level; + } + } + + // Now we are within a few percent of the target; scale the load + // factor to get a better fit, and test it, print the answer. + load_thread_level *= desired_load; + load_thread_level /= percent_load; + start_load(desired_load); // Start up a given load + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + load_idle = idle_thread_count; + start_load(0); // Shut down background load + percent_load = 100 - ((load_idle * 100) / no_load_idle); + diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level, + (int)idle_thread_count, percent_load); + no_load_idle_count_1_second = no_load_idle; +} + +// +// This function is called to set up a load level of 'load' percent (given +// as a whole number, e.g. start_load(20) would mean initiate a background +// load of 20%, leaving the cpu 80% idle). +// +static void +start_load(int load) +{ + static int prev_load = 0; + int i; + if (load == 0) { + diag_printf("Set no background load\n"); + if (prev_load == 0) return; // Nothing out there to stop + for (i = 0; i < prev_load * NUM_LOAD_THREADS/100; i++) { + cyg_semaphore_wait(&load_thread_sem[i]); + } + prev_load = 0; + } else { + diag_printf("Set background load = %d%% starting %d threads\n", + load, load * NUM_LOAD_THREADS/100 ); + for (i = 0; i < load * NUM_LOAD_THREADS/100; i++) { + cyg_semaphore_post(&load_thread_sem[i]); + } + prev_load = load; + } +} + +// +// These thread(s) do some amount of "background" computing. This is used +// to simulate a given load level. They need to be run at a higher priority +// than the network code itself. +// +// Like the "idle" thread, they run as long as their "switch" (aka semaphore) +// is enabled. +// +void +net_load(cyg_addrword_t who) +{ + int i; + while (true) { + cyg_semaphore_wait(&load_thread_sem[who]); + for (i = 0; i < load_thread_level; i++) { + do_some_random_computation(i,who); + } + cyg_thread_delay(1); // Wait until the next 'tick' + cyg_semaphore_post(&load_thread_sem[who]); + } +} + +// +// Some arbitrary computation, designed to use up the CPU and cause associated +// cache "thrash" behaviour - part of background load modelling. +// +static void +do_some_random_computation(int p,int id) +{ + // Just something that might be "hard" +#if 0 + { + volatile double x; + x = ((p * 10) * 3.14159) / 180.0; // radians + } +#endif +#if 1 + { + static int footle[0x10001]; + static int counter = 0; + register int i; + + i = (p << 8) + id + counter++; + i &= 0xffff; + footle[ i+1 ] += footle[ i ] + 1; + } +#endif +} + +// +// This thread does nothing but count. It will be allowed to count +// as long as the semaphore is "free". +// +void +net_idle(cyg_addrword_t param) +{ + while (true) { + cyg_semaphore_wait(&idle_thread_sem); + idle_thread_count++; + cyg_semaphore_post(&idle_thread_sem); + } +} + +static void +echo_test(cyg_addrword_t p) +{ + int s_source, s_sink, e_source, e_sink; + struct sockaddr_in e_source_addr, e_sink_addr, local; + int one = 1; + fd_set in_fds; + int i, num, len; + struct test_params params,nparams; + struct test_status status,nstatus; + + cyg_tick_count_t starttime, stoptime; + + s_source = socket(AF_INET, SOCK_STREAM, 0); + if (s_source < 0) { + pexit("stream socket"); + } + if (setsockopt(s_source, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + pexit("setsockopt /source/ SO_REUSEADDR"); + } + if (setsockopt(s_source, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { + pexit("setsockopt /source/ SO_REUSEPORT"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = ntohs(SOURCE_PORT); + local.sin_addr.s_addr = INADDR_ANY; + if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind /source/ error"); + } + listen(s_source, SOMAXCONN); + + s_sink = socket(AF_INET, SOCK_STREAM, 0); + if (s_sink < 0) { + pexit("stream socket"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = ntohs(SINK_PORT); + local.sin_addr.s_addr = INADDR_ANY; + if(bind(s_sink, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind /sink/ error"); + } + if (setsockopt(s_sink, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + pexit("setsockopt /sink/ SO_REUSEADDR"); + } + if (setsockopt(s_sink, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { + pexit("setsockopt /sink/ SO_REUSEPORT"); + } + listen(s_sink, SOMAXCONN); + + e_source = 0; e_sink = 0; + while (true) { + // Wait for a connection on either of the ports + FD_ZERO(&in_fds); + FD_SET(s_source, &in_fds); + FD_SET(s_sink, &in_fds); + num = select(max(s_sink,s_source)+1, &in_fds, 0, 0, 0); + if (FD_ISSET(s_source, &in_fds)) { + len = sizeof(e_source_addr); + if ((e_source = accept(s_source, (struct sockaddr *)&e_source_addr, &len)) < 0) { + pexit("accept /source/"); + } + diag_printf("SOURCE connection from %s:%d\n", + inet_ntoa(e_source_addr.sin_addr), ntohs(e_source_addr.sin_port)); + } + if (FD_ISSET(s_sink, &in_fds)) { + len = sizeof(e_sink_addr); + if ((e_sink = accept(s_sink, (struct sockaddr *)&e_sink_addr, &len)) < 0) { + pexit("accept /sink/"); + } + diag_printf("SINK connection from %s:%d\n", + inet_ntoa(e_sink_addr.sin_addr), ntohs(e_sink_addr.sin_port)); + } + // Continue with test once a connection is established in both directions + if ((e_source != 0) && (e_sink != 0)) { + break; + } + } + + // Wait for "source" to tell us the testing paramters + if (do_read(e_source, &nparams, sizeof(nparams)) != sizeof(nparams)) { + pexit("Can't read initialization parameters"); + } + + params.nbufs = ntohl(nparams.nbufs); + params.bufsize = ntohl(nparams.bufsize); + params.load = ntohl(nparams.load); + + diag_printf("Using %d buffers of %d bytes each, %d%% background load\n", + params.nbufs, params.bufsize, params.load); + + // Tell the sink what the parameters are + if (do_write(e_sink, &nparams, sizeof(nparams)) != sizeof(nparams)) { + pexit("Can't write initialization parameters"); + } + + status.ok = 1; + nstatus.ok = htonl(status.ok); + + // Tell the "source" to start - we're all connected and ready to go! + if (do_write(e_source, &nstatus, sizeof(nstatus)) != sizeof(nstatus)) { + pexit("Can't send ACK to 'source' host"); + } + + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + starttime = cyg_current_time(); + start_load(params.load); + + TNR_ON(); + + // Echo the data from the source to the sink hosts + for (i = 0; i < params.nbufs; i++) { + if ((len = do_read(e_source, data_buf, params.bufsize)) != params.bufsize) { + TNR_OFF(); + diag_printf("Can't read buf #%d: ", i+1); + if (len < 0) { + perror("I/O error"); + } else { + diag_printf("short read - only %d bytes\n", len); + } + TNR_ON(); + } + if ((len = do_write(e_sink, data_buf, params.bufsize)) != params.bufsize) { + TNR_OFF(); + diag_printf("Can't write buf #%d: ", i+1); + if (len < 0) { + perror("I/O error"); + } else { + diag_printf("short write - only %d bytes\n", len); + } + TNR_ON(); + } + } + + TNR_OFF(); + + // Wait for the data to drain and the "sink" to tell us all is OK. + if (do_read(e_sink, &status, sizeof(status)) != sizeof(status)) { + pexit("Can't receive ACK from 'sink' host"); + } + + start_load(0); + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + stoptime = cyg_current_time(); + stoptime -= starttime; // time taken in cS + // expected idle loops in that time period for an idle system: + starttime = no_load_idle_count_1_second * stoptime / 100; + diag_printf( "%d ticks elapsed, %d kloops predicted for an idle system\n", + (int)stoptime, (int)(starttime/1000) ); + diag_printf( "actual kloops %d, CPU was %d%% idle during transfer\n", + (int)(idle_thread_count/1000), + (int)(idle_thread_count * 100 / starttime) ); + + // Now examine how close that loading actually was: + start_load(params.load); // Start up a given load + idle_thread_count = 0; + cyg_semaphore_post(&idle_thread_sem); // Start idle thread + cyg_thread_delay(1*100); // Pause for one second + cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread + start_load(0); // Shut down background load + i = 100 - ((idle_thread_count * 100) / no_load_idle_count_1_second ); + diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level, + (int)idle_thread_count, i); + +//#ifdef CYGDBG_USE_ASSERTS +#ifdef CYGDBG_NET_TIMING_STATS + { + extern void show_net_times(void); + show_net_times(); + } +#endif +//#endif +} + +void +net_test(cyg_addrword_t param) +{ + diag_printf("Start TCP test - ECHO mode\n"); + init_all_network_interfaces(); + calibrate_load(DESIRED_BACKGROUND_LOAD); + TNR_INIT(); +#ifdef CYGPKG_SNMPAGENT + { + extern void cyg_net_snmp_init(void); + cyg_net_snmp_init(); + } +#endif + echo_test(param); + TNR_PRINT_ACTIVITY(); + cyg_test_exit(); +} + +void +cyg_start(void) +{ + int i; + // Create a main thread which actually runs the test + cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + // Create the idle thread environment + cyg_semaphore_init(&idle_thread_sem, 0); + cyg_thread_create(IDLE_THREAD_PRIORITY, // Priority + net_idle, // entry + 0, // entry parameter + "Network idle", // Name + &idle_thread_stack[0], // Stack + STACK_SIZE, // Size + &idle_thread_handle, // Handle + &idle_thread_data // Thread data structure + ); + cyg_thread_resume(idle_thread_handle); // Start it + // Create the load threads and their environment(s) + for (i = 0; i < NUM_LOAD_THREADS; i++) { + cyg_semaphore_init(&load_thread_sem[i], 0); + cyg_thread_create(LOAD_THREAD_PRIORITY, // Priority + net_load, // entry + i, // entry parameter + "Background load", // Name + &load_thread_stack[i][0], // Stack + STACK_SIZE, // Size + &load_thread_handle[i], // Handle + &load_thread_data[i] // Thread data structure + ); + cyg_thread_resume(load_thread_handle[i]); // Start it + } + cyg_scheduler_start(); +} + +// EOF tcp_echo.c diff --git a/packages/net/common/current/tests/tcp_lo_select.c b/packages/net/common/current/tests/tcp_lo_select.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/tcp_lo_select.c @@ -0,0 +1,289 @@ +//========================================================================== +// +// tests/tcp_lo_test.c +// +// Simple TCP throughput test +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): sorin@netappi.com +// Contributors: gthomas,sorin@netappi.com +// Date: 2000-05-24 + + +// Network throughput test code + +#include + +#include + +#ifndef CYGPKG_LIBC_STDIO +#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) +#endif + +#define SOURCE_PORT1 9990 +#define SOURCE_PORT2 9991 + +#define NUM_BUF 1024 +#define MAX_BUF 8192 +static unsigned char data_buf1[MAX_BUF]; +static unsigned char data_buf2[MAX_BUF]; +static unsigned char data_buf_write1[MAX_BUF]="Client 1 is alive. You may continue ...."; +static unsigned char data_buf_write2[MAX_BUF]="Client 2 is alive. You may continue ...."; + + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x10000) + +static char stack_server[STACK_SIZE]; +static cyg_thread server_thread_data; +static cyg_handle_t server_thread_handle; + +static char stack_client1[STACK_SIZE]; +static cyg_thread client1_thread_data; +static cyg_handle_t client1_thread_handle; + +static char stack_client2[STACK_SIZE]; +static cyg_thread client2_thread_data; +static cyg_handle_t client2_thread_handle; + + +#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-4 + +void +pexit(char *s) +{ + CYG_TEST_FAIL_FINISH( s ); +} + + +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +void server(void) +{ + int s_s1, e_s1, s_s2, e_s2; + struct sockaddr_in e_s1_addr,e_s2_addr,local; + fd_set in_fds; + int len; + int num; + + char *hello_string=" Hello eCos network \n"; + diag_printf("TCP SERVER:"); + diag_printf(hello_string); + + s_s1 = socket(AF_INET, SOCK_STREAM, 0); + if (s_s1 < 0) { + pexit("stream socket"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = ntohs(SOURCE_PORT1); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if(bind(s_s1, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind /source_1/ error"); + } + listen(s_s1, SOMAXCONN); + + s_s2 = socket(AF_INET, SOCK_STREAM, 0); + if (s_s2 < 0) { + pexit("stream socket"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = ntohs(SOURCE_PORT2); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if(bind(s_s2, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind /source_2/ error"); + } + listen(s_s2, SOMAXCONN); + + + e_s1 = 0; e_s2 = 0; + + + while (true) { + FD_ZERO(&in_fds); + FD_SET(s_s1, &in_fds); + FD_SET(s_s2, &in_fds); + num = select ( max(s_s1,s_s2)+1, &in_fds,0,0,0); + if (FD_ISSET(s_s1,&in_fds)) { + len = sizeof(e_s1_addr); + if ((e_s1 = accept(s_s1,(struct sockaddr *)&e_s1_addr,&len))<0) + { + pexit("accept /source_1/"); + } + diag_printf("TCP SERVER connection from %s: %d\n", + inet_ntoa(e_s1_addr.sin_addr),ntohs(e_s1_addr.sin_port)); + } + if (FD_ISSET(s_s2,&in_fds)) { + len = sizeof(e_s2_addr); + if ((e_s2 = accept(s_s2,(struct sockaddr *)&e_s2_addr,&len))<0) + { + pexit("accept /source_2/"); + } + diag_printf("TCP SERVER connection from %s: %d\n", + inet_ntoa(e_s2_addr.sin_addr), ntohs(e_s2_addr.sin_port)); + } + + if ((e_s1 != 0) && ( e_s2 != 0)) { + break; + } + + } /* while (true) */ + + if ((len = read(e_s1, data_buf1, MAX_BUF)) < 0 ) + { + perror("I/O error"); + } + diag_printf("SERVER : %s\n",data_buf1); + + if ((len = read(e_s2, data_buf2, MAX_BUF)) < 0 ) + { + perror("I/O error"); + } + diag_printf("SERVER : %s\n",data_buf2); + +} + +void client1(void) +{ + int s_source; + struct sockaddr_in local; + int len; + + diag_printf("client 1 :started\n"); + + s_source = socket(AF_INET, SOCK_STREAM, 0); + if (s_source < 0) { + pexit("stream socket"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = htons(SOURCE_PORT1); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (connect(s_source, (struct sockaddr *)&local, sizeof(local)) < 0) { + pexit("Can't connect to target"); + } + + if ((len = write(s_source,data_buf_write1,40)) < 0) { + CYG_TEST_FAIL_FINISH("Error writing buffer"); + } +} + +void client2(void) +{ + int s_source; + struct sockaddr_in local; + int len; + + diag_printf("client 2 :started\n"); + + s_source = socket(AF_INET, SOCK_STREAM, 0); + if (s_source < 0) { + pexit("stream socket"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = htons(SOURCE_PORT2); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (connect(s_source, (struct sockaddr *)&local, sizeof(local)) < 0) { + pexit("Can't connect to target"); + } + + if ((len = write(s_source,data_buf_write2,40)) < 0) { + CYG_TEST_FAIL_FINISH("Error writing buffer"); + } +} + + +void +tcp_server(cyg_addrword_t param) +{ + init_all_network_interfaces(); + diag_printf("Start TCP server - test\n"); + cyg_thread_resume(client1_thread_handle); // Start it + cyg_thread_resume(client2_thread_handle); // Start it +#if NLOOP > 0 + server(); + CYG_TEST_PASS_FINISH("Server returned OK"); +#endif + CYG_TEST_NA( "No loopback devs" ); +} + +void +tcp_client_1(cyg_addrword_t param) +{ + diag_printf("Start TCP client 1 - test\n"); +#if NLOOP > 0 + client1(); +#endif +} + +void +tcp_client_2(cyg_addrword_t param) +{ + diag_printf("Start TCP client 2 - test\n"); +#if NLOOP > 0 + client2(); +#endif +} + + +void +cyg_start(void) +{ + CYG_TEST_INIT(); + + cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority + tcp_server, // entry + 0, // entry parameter + "TCP loopback server", // Name + &stack_server[0], // Stack + STACK_SIZE, // Size + &server_thread_handle, // Handle + &server_thread_data // Thread data structure + ); + cyg_thread_resume(server_thread_handle); // Start it + + cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority + tcp_client_1, // entry + 0, // entry parameter + "TCP loopback client1", // Name + &stack_client1[0], // Stack + STACK_SIZE, // Size + &client1_thread_handle, // Handle + &client1_thread_data // Thread data structure + ); + + cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority + tcp_client_2, // entry + 0, // entry parameter + "TCP llopback client2", // Name + &stack_client2[0], // Stack + STACK_SIZE, // Size + &client2_thread_handle, // Handle + &client2_thread_data // Thread data structure + ); + + cyg_scheduler_start(); +} + diff --git a/packages/net/common/current/tests/tcp_lo_test.c b/packages/net/common/current/tests/tcp_lo_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/tcp_lo_test.c @@ -0,0 +1,194 @@ +//========================================================================== +// +// tests/tcp_lo_test.c +// +// Simple TCP throughput test +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): sorin@netappi.com +// Contributors: gthomas,sorin@netappi.com, hmt +// Date: 2000-05-24 + + +// Network throughput test code + +#include + +#include + +#define SOURCE_PORT 9990 +#define SINK_PORT 9991 + +#define NUM_BUF 1024 +#define MAX_BUF 8192 +static unsigned char data_buf[MAX_BUF]; +static unsigned char data_buf_write[MAX_BUF]="Client is alive. You may continue ...."; + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x10000) +static char stack_server[STACK_SIZE]; +static cyg_thread server_thread_data; +static cyg_handle_t server_thread_handle; + +static char stack_client[STACK_SIZE]; +static cyg_thread client_thread_data; +static cyg_handle_t client_thread_handle; + + +#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-4 + +void +pexit(char *s) +{ + CYG_TEST_FAIL_FINISH( s ); +} + + +void server(void) +{ + int s_source, e_source; + struct sockaddr_in e_source_addr, local; + int one = 1; + fd_set in_fds; + int len; + + char *hello_string=" Hello eCos network \n"; + diag_printf("TCP SERVER:"); + diag_printf(hello_string); + + s_source = socket(AF_INET, SOCK_STREAM, 0); + if (s_source < 0) { + pexit("stream socket"); + } + if (setsockopt(s_source, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + pexit("setsockopt /source/ SO_REUSEADDR"); + } + if (setsockopt(s_source, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { + pexit("setsockopt /source/ SO_REUSEPORT"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = ntohs(SOURCE_PORT); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind /source/ error"); + } + listen(s_source, SOMAXCONN); + + e_source = 0; + while (true) { + FD_ZERO(&in_fds); + FD_SET(s_source, &in_fds); + len = sizeof(e_source_addr); + if ((e_source = accept(s_source,(struct sockaddr *)&e_source_addr,&len))<0) { + pexit("accept /source/"); + } + diag_printf("TCP SERVER connection from %s: %d\n", + inet_ntoa(e_source_addr.sin_addr),ntohs(e_source_addr.sin_port)); + + if (e_source != 0) { + break; + } + } /* while (true) */ + + if ((len = read(e_source, data_buf, MAX_BUF)) < 0 ) { + CYG_TEST_FAIL_FINISH( "I/O error" ); + } + diag_printf("SERVER : %s\n",data_buf); + +} + +void client(void) +{ + int s_source; + struct sockaddr_in local; + int len; + + diag_printf("client:started\n"); + + s_source = socket(AF_INET, SOCK_STREAM, 0); + if (s_source < 0) { + pexit("stream socket"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = htons(SOURCE_PORT); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (connect(s_source, (struct sockaddr *)&local, sizeof(local)) < 0) { + pexit("Can't connect to target"); + } + + if ((len = write(s_source,data_buf_write,40)) < 0){ + CYG_TEST_FAIL_FINISH( "Error writing buffer"); + } +} + +void +tcp_server(cyg_addrword_t param) +{ + init_all_network_interfaces(); + diag_printf("Start TCP server - test\n"); + cyg_thread_resume(client_thread_handle); // Start it +#if NLOOP > 0 + server(); + CYG_TEST_PASS_FINISH( "server returned OK" ); +#endif + CYG_TEST_NA( "No loopback devs" ); +} + +void +tcp_client(cyg_addrword_t param) +{ + diag_printf("Start TCP client - test\n"); +#if NLOOP > 0 + client(); +#endif +} + + + +void +cyg_start(void) +{ + CYG_TEST_INIT(); + + cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority + tcp_server, // entry + 0, // entry parameter + "TCP loopback server", // Name + &stack_server[0], // Stack + STACK_SIZE, // Size + &server_thread_handle, // Handle + &server_thread_data // Thread data structure + ); + cyg_thread_resume(server_thread_handle); // Start it + + cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority + tcp_client, // entry + 0, // entry parameter + "TCP loopback client", // Name + &stack_client[0], // Stack + STACK_SIZE, // Size + &client_thread_handle, // Handle + &client_thread_data // Thread data structure + ); + cyg_scheduler_start(); +} + + + diff --git a/packages/net/common/current/tests/tcp_sink.c b/packages/net/common/current/tests/tcp_sink.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/tcp_sink.c @@ -0,0 +1,238 @@ +//========================================================================== +// +// tests/tcp_sink.c +// +// Simple TCP throughput test - sink component +// * CAUTION: host, i.e. non eCos, only * +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: This is the middle part of a three part test. The idea is +// to test the throughput of box in a configuration like this: +// +// +------+ port +----+ port +----+ +// |SOURCE|=========>|ECHO|============>|SINK| +// +------+ 9990 +----+ 9991 +----+ +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Network throughput test code + +#undef _KERNEL +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define SOURCE_PORT 9990 +#define SINK_PORT 9991 + +struct test_params { + long nbufs; + long bufsize; + long load; +}; + +struct test_status { + long ok; +}; + +#define NUM_BUF 128 +#define MAX_BUF 32 * 8192 +static unsigned char data_buf[MAX_BUF]; + +void +pexit(char *s) +{ + perror(s); + exit(1); +} + +void +show_results(struct timeval *start, struct timeval *end, + int nbufs, int buflen) +{ + struct timeval tot_time; + long tot_bytes = nbufs * buflen; + double real_time, thru; + timersub(end, start, &tot_time); + printf("SINK complete - %d bufs of %d bytes in %ld.%02ld seconds", + nbufs, buflen, + tot_time.tv_sec, tot_time.tv_usec / 10000); + real_time = tot_time.tv_sec + ((tot_time.tv_usec / 10000) * .01); + // Compute bytes / second (rounded up) + thru = tot_bytes / real_time; + // Convert to Mb / second + printf(" - %.2f KB/S", thru / 1024.0); + printf(" - %.4f Mbit/S (M = 10^6)", thru * 8.0 / 1000000.0); + printf("\n"); +} + +int +do_read(int s, unsigned char *buf, int len) +{ + int total, slen, rlen; + total = 0; + rlen = len; + while (total < len) { + slen = read(s, buf, rlen); + if (slen != rlen) { + if (slen < 0) { + printf("Error after reading %d bytes\n", total); + return -1; + } + rlen -= slen; + buf += slen; + } + total += slen; + } + return total; +} + +int +do_write(int s, unsigned char *buf, int len) +{ + int total, slen, rlen; + total = 0; + rlen = len; + while (total < len) { + slen = write(s, buf, rlen); + if (slen != rlen) { + if (slen < 0) { + printf("Error after writing %d bytes\n", total); + return -1; + } + rlen -= slen; + buf += slen; + } + total += slen; + } + return total; +} + +static void +sink_test(char *echo_node) +{ + int s_sink; + struct sockaddr_in slave, local; + int one = 1; + int len; + struct hostent *host; + struct test_params params, nparams; + struct test_status status, nstatus; + struct timeval start_time, end_time; + int i; + + printf("Start TCP test - SINK mode to %s\n", echo_node); + + host = gethostbyname(echo_node); + if (host == (struct hostent *)NULL) { + pexit("gethostbyname"); + } + + memset(&slave, 0, sizeof(slave)); + slave.sin_family = AF_INET; +#ifdef __ECOS + slave.sin_len = sizeof(slave); +#endif + slave.sin_port = htons(SINK_PORT); + memcpy(&slave.sin_addr.s_addr, host->h_addr, host->h_length); + + s_sink = socket(AF_INET, SOCK_STREAM, 0); + if (s_sink < 0) { + pexit("stream socket"); + } + if (setsockopt(s_sink, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + pexit("setsockopt /sink/ SO_REUSEADDR"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; +#ifdef __ECOS + local.sin_len = sizeof(local); +#endif + local.sin_port = INADDR_ANY; + local.sin_addr.s_addr = INADDR_ANY; + if(bind(s_sink, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind /sink/ error"); + } + + if (connect(s_sink, (struct sockaddr *)&slave, sizeof(slave)) < 0) { + pexit("Can't connect to target"); + } + + // Get testing paramters from middleman + if (do_read(s_sink, (unsigned char *)&nparams, sizeof(nparams)) + != sizeof(nparams)) { + pexit("Can't read initialization parameters"); + } + + params.nbufs = ntohl(nparams.nbufs); + params.bufsize = ntohl(nparams.bufsize); + params.load = ntohl(nparams.load); + + printf("Using %ld buffers of %ld bytes each\n", params.nbufs, params.bufsize); + + // Actual test + gettimeofday(&start_time, 0); + for (i = 0; i < params.nbufs; i++) { + if ((len = do_read(s_sink, data_buf, params.bufsize)) != params.bufsize) { + printf("Error reading buffer #%d:", i+1); + if (len < 0) { + perror("can't read data"); + } else { + printf(" short data, only read %d bytes\n", len); + } + } + } + gettimeofday(&end_time, 0); + show_results(&start_time, &end_time, params.nbufs, params.bufsize); + + // Tell the middleman + + nstatus.ok = htonl(status.ok); + + if (do_write(s_sink, (unsigned char *)&nstatus, sizeof(nstatus)) + != sizeof(nstatus)) { + pexit("Can't send ACK to 'echo' host"); + } +} + +int +main(int argc, char *argv[]) +{ + sink_test(argv[1]); + return 0; +} + diff --git a/packages/net/common/current/tests/tcp_source.c b/packages/net/common/current/tests/tcp_source.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/tcp_source.c @@ -0,0 +1,242 @@ +//========================================================================== +// +// tests/tcp_source.c +// +// Simple TCP throughput test - source component +// * CAUTION: host, i.e. non eCos, only * +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-01-10 +// Purpose: +// Description: This is the middle part of a three part test. The idea is +// to test the throughput of box in a configuration like this: +// +// +------+ port +----+ port +----+ +// |SOURCE|=========>|ECHO|============>|SINK| +// +------+ 9990 +----+ 9991 +----+ +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +// Network throughput test code + +#undef _KERNEL +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define SOURCE_PORT 9990 +#define SINK_PORT 9991 + +struct test_params { + long nbufs; + long bufsize; + long load; +}; + +struct test_status { + long ok; +}; + +#define NUM_BUF 1024 +#define MAX_BUF 8192 +static unsigned char data_buf[MAX_BUF]; + +void +pexit(char *s) +{ + perror(s); + exit(1); +} + +void +show_results(struct timeval *start, struct timeval *end, + int nbufs, int buflen) +{ + struct timeval tot_time; + long tot_bytes = nbufs * buflen; + double real_time, thru; + timersub(end, start, &tot_time); + printf("SOURCE complete - %d bufs of %d bytes in %ld.%02ld seconds", + nbufs, buflen, + tot_time.tv_sec, tot_time.tv_usec / 10000); + real_time = tot_time.tv_sec + ((tot_time.tv_usec / 10000) * .01); + // Compute bytes / second (rounded up) + thru = tot_bytes / real_time; + // Convert to Mb / second + printf(" - %.2f KB/S", thru / 1024.0); + printf(" - %.4f Mbit/S (M = 10^6)", thru * 8.0 / 1000000.0); + printf("\n"); +} + +int +do_read(int s, unsigned char *buf, int len) +{ + int total, slen, rlen; + total = 0; + rlen = len; + while (total < len) { + slen = read(s, buf, rlen); + if (slen != rlen) { + if (slen < 0) { + printf("Error after reading %d bytes\n", total); + return -1; + } + rlen -= slen; + buf += slen; + } + total += slen; + } + return total; +} + +int +do_write(int s, unsigned char *buf, int len) +{ + int total, slen, rlen; + total = 0; + rlen = len; + while (total < len) { + slen = write(s, buf, rlen); + if (slen != rlen) { + if (slen < 0) { + printf("Error after writing %d bytes\n", total); + return -1; + } + rlen -= slen; + buf += slen; + } + total += slen; + } + return total; +} + +static void +source_test(char *echo_node, int load) +{ + int s_source; + struct sockaddr_in slave, local; + int one = 1; + int len; + struct hostent *host; + struct test_params params; + struct test_params nparams; + struct test_status status; + struct test_status nstatus; + struct timeval start_time, end_time; + int i; + + printf("Start TCP test - SOURCE mode to %s\n", echo_node); + + host = gethostbyname(echo_node); + if (host == (struct hostent *)NULL) { + pexit("gethostbyname"); + } + + memset(&slave, 0, sizeof(slave)); + slave.sin_family = AF_INET; +#ifdef __ECOS + slave.sin_len = sizeof(slave); +#endif + slave.sin_port = htons(SOURCE_PORT); + memcpy(&slave.sin_addr.s_addr, host->h_addr, host->h_length); + + s_source = socket(AF_INET, SOCK_STREAM, 0); + if (s_source < 0) { + pexit("stream socket"); + } + if (setsockopt(s_source, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { + pexit("setsockopt /source/ SO_REUSEADDR"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; +#ifdef __ECOS + local.sin_len = sizeof(local); +#endif + local.sin_port = INADDR_ANY; + local.sin_addr.s_addr = INADDR_ANY; + if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind /source/ error"); + } + + if (connect(s_source, (struct sockaddr *)&slave, sizeof(slave)) < 0) { + pexit("Can't connect to target"); + } + + params.nbufs = NUM_BUF; + params.bufsize = MAX_BUF; + params.load = load; + + nparams.nbufs = htonl(params.nbufs); + nparams.bufsize = htonl(params.bufsize); + nparams.load = htonl(params.load); + + if ( do_write(s_source, (unsigned char *)&nparams, sizeof(nparams)) + != sizeof(params)) { + pexit("Can't send initialization parameters"); + } + if (do_read(s_source, (unsigned char *)&nstatus, sizeof(nstatus)) + != sizeof(status)) { + pexit("Can't get status from 'echo' client"); + } + + status.ok = ntohl(nstatus.ok); + + // Actual test + gettimeofday(&start_time, 0); + for (i = 0; i < params.nbufs; i++) { + if ((len = do_write(s_source, data_buf, params.bufsize)) != params.bufsize) { + printf("Error writing buffer #%d:", i+1); + if (len < 0) { + perror("can't write data"); + } else { + printf(" short data, only wrote %d bytes\n", len); + } + } + } + gettimeofday(&end_time, 0); + show_results(&start_time, &end_time, params.nbufs, params.bufsize); +} + +int +main(int argc, char *argv[]) +{ + int load = 0; + if (argc > 2) { + load = atoi(argv[2]); + } + source_test(argv[1], load); + return 0; +} + diff --git a/packages/net/common/current/tests/tftp_client_test.c b/packages/net/common/current/tests/tftp_client_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/tftp_client_test.c @@ -0,0 +1,117 @@ +//========================================================================== +// +// tests/tftp_client_test.c +// +// Simple TFTP client test +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-04-07 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== +// TFTP test code + +#include +#include + +// Note: the TFTP client calls need at least (SEGSIZE==512)+4 +// additional bytes of workspace, thus the padding. +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL+0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +#define min(x,y) (xbp_siaddr; + host.sin_port = 0; + diag_printf("Trying tftp_get %s %16s...\n", GETFILE, inet_ntoa(host.sin_addr)); + res = tftp_get( GETFILE, &host, buf, sizeof(buf), TFTP_OCTET, &err); + diag_printf("res = %d, err = %d\n", res, err); + if (res > 0) { + diag_dump_buf(buf, min(res,1024)); + } + len = res; + diag_printf("Trying tftp_put %d %16s, length %d\n", + PUTFILE, inet_ntoa(host.sin_addr), len); + res = tftp_put( PUTFILE, &host, buf, len, TFTP_OCTET, &err); + diag_printf("put - res: %d\n", res); +} + +void +net_test(cyg_addrword_t param) +{ + diag_printf("Start TFTP test\n"); + init_all_network_interfaces(); +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) { + tftp_test(ð0_bootp_data); + } +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + if (eth1_up) { + tftp_test(ð1_bootp_data); + } +#endif + cyg_test_exit(); +} + +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} diff --git a/packages/net/common/current/tests/tftp_server_test.c b/packages/net/common/current/tests/tftp_server_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/tftp_server_test.c @@ -0,0 +1,140 @@ +//========================================================================== +// +// tests/tftp_server_test.c +// +// Simple TFTP server test +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources, +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): gthomas +// Contributors: gthomas +// Date: 2000-04-07 +// Purpose: +// Description: +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== +// TFTP test code + +#include +#include + +#ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists +#include CYGBLD_DEVS_ETH_DEVICE_H // May provide CYGTST_DEVS_ETH_TEST_NET_REALTIME +#endif + +#ifdef CYGPKG_NET_TESTS_USE_RT_TEST_HARNESS // do we use the rt test? +# ifdef CYGTST_DEVS_ETH_TEST_NET_REALTIME // Get the test ancilla if it exists +# include CYGTST_DEVS_ETH_TEST_NET_REALTIME +# endif +#endif + + +// Fill in the blanks if necessary +#ifndef TNR_OFF +# define TNR_OFF() +#endif +#ifndef TNR_ON +# define TNR_ON() +#endif +#ifndef TNR_INIT +# define TNR_INIT() +#endif +#ifndef TNR_PRINT_ACTIVITY +# define TNR_PRINT_ACTIVITY() +#endif + +// ------------------------------------------------------------------------ + +#include +#include + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) +static char stack[STACK_SIZE]; +static cyg_thread thread_data; +static cyg_handle_t thread_handle; + +extern void +cyg_test_exit(void); + +void +pexit(char *s) +{ + perror(s); + cyg_test_exit(); +} + +static void +tftp_test(struct bootp *bp) +{ + int server_id, res; + extern struct tftpd_fileops dummy_fileops; + server_id = tftpd_start(0, &dummy_fileops); + if (server_id > 0) { + diag_printf("TFTP server created - id: %x\n", server_id); + // Only let the server run for 5 minutes + cyg_thread_delay(2*100); // let the tftpd start up first + TNR_ON(); + cyg_thread_delay(5*60*100); + TNR_OFF(); + res = tftpd_stop(server_id); + diag_printf("TFTP server stopped - res: %d\n", res); + } else { + diag_printf("Couldn't create a server!\n"); + } +} + +void +net_test(cyg_addrword_t param) +{ + diag_printf("Start TFTP server test\n"); + init_all_network_interfaces(); + TNR_INIT(); +#ifdef CYGHWR_NET_DRIVER_ETH0 + if (eth0_up) { + tftp_test(ð0_bootp_data); + } +#else + if ( 0 ) ; +#endif +#ifdef CYGHWR_NET_DRIVER_ETH1 + else if (eth1_up) { + tftp_test(ð1_bootp_data); + } +#endif + TNR_PRINT_ACTIVITY(); + cyg_test_exit(); +} + +void +cyg_start(void) +{ + // Create a main thread, so we can run the scheduler and have time 'pass' + cyg_thread_create(10, // Priority - just a number + net_test, // entry + 0, // entry parameter + "Network test", // Name + &stack[0], // Stack + STACK_SIZE, // Size + &thread_handle, // Handle + &thread_data // Thread data structure + ); + cyg_thread_resume(thread_handle); // Start it + cyg_scheduler_start(); +} + +// EOF tftp_server_test.c diff --git a/packages/net/common/current/tests/udp_lo_test.c b/packages/net/common/current/tests/udp_lo_test.c new file mode 100644 --- /dev/null +++ b/packages/net/common/current/tests/udp_lo_test.c @@ -0,0 +1,168 @@ +//========================================================================== +// +// tests/udp_lo_test.c +// +// Simple UDP throughput test +// +//========================================================================== +//####BSDCOPYRIGHTBEGIN#### +// +// ------------------------------------------- +// +// Portions of this software may have been derived from OpenBSD or other sources +// and are covered by the appropriate copyright disclaimers included herein. +// +// ------------------------------------------- +// +//####BSDCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): sorin@netappi.com +// Contributors: gthomas,sorin@netappi.com, hmt +// Date: 2000-05-24 + + +// Network throughput test code + +#include + +#include + +#define SOURCE_PORT 9990 +#define SINK_PORT 9991 + +#define NUM_BUF 1024 +#define MAX_BUF 8192 +static unsigned char data_buf[MAX_BUF]; +static unsigned char data_buf_write[MAX_BUF]="Client UDP is alive. You may continue ...."; + +#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x10000) +static char stack_server[STACK_SIZE]; +static cyg_thread server_thread_data; +static cyg_handle_t server_thread_handle; + +static char stack_client[STACK_SIZE]; +static cyg_thread client_thread_data; +static cyg_handle_t client_thread_handle; + + +#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-4 + +void +pexit(char *s) +{ + CYG_TEST_FAIL_FINISH( s ); +} + + +void server(void) +{ + int s_source; + struct sockaddr_in local,c_addr; + int c_len; + int len; + + char *hello_string=" Hello eCos network \n"; + diag_printf("UDP SERVER:"); + diag_printf(hello_string); + + s_source = socket(AF_INET, SOCK_DGRAM, 0); + if (s_source < 0) { + pexit("stream socket"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = ntohs(SOURCE_PORT); + local.sin_addr.s_addr = htonl(INADDR_ANY); //accepts everyone... + if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) { + pexit("bind /source/ error"); + } + c_len = sizeof(c_addr); + + if ((len = recvfrom(s_source, data_buf, sizeof(data_buf),0, + (struct sockaddr *)&c_addr,&c_len)) < 0 ) { + CYG_TEST_FAIL_FINISH("I/O error"); + } + diag_printf("SERVER : message arrived from %s\n",inet_ntoa(c_addr.sin_addr)); + diag_printf("SERVER : Message : %s\n",data_buf); + close(s_source); +} + +void client(void) +{ + int s_source; + struct sockaddr_in local; + int len; + + diag_printf("client:started\n"); + + s_source = socket(AF_INET, SOCK_DGRAM, 0); + if (s_source < 0) { + pexit("stream socket"); + } + memset(&local, 0, sizeof(local)); + local.sin_family = AF_INET; + local.sin_len = sizeof(local); + local.sin_port = htons(SOURCE_PORT); + local.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if ( (len= sendto(s_source,data_buf_write,sizeof(data_buf_write), + 0,(struct sockaddr *)&local,sizeof(local))) < 0 ) { + CYG_TEST_FAIL_FINISH("Error writing buffer"); + } + close(s_source); +} + +void +udp_server(cyg_addrword_t param) +{ + init_all_network_interfaces(); + diag_printf("Start UDP server - test\n"); + cyg_thread_resume(client_thread_handle); // Start the other one +#if NLOOP > 0 + server(); + CYG_TEST_PASS_FINISH("Server returned OK"); +#endif + CYG_TEST_NA( "No loopback devs" ); +} + +void +udp_client(cyg_addrword_t param) +{ + diag_printf("Start UDP client - test\n"); +#if NLOOP > 0 + client(); +#endif +} + + + +void +cyg_start(void) +{ + CYG_TEST_INIT(); + + cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority + udp_server, // entry + 0, // entry parameter + "UDP loopback server", // Name + &stack_server[0], // Stack + STACK_SIZE, // Size + &server_thread_handle, // Handle + &server_thread_data // Thread data structure + ); + cyg_thread_resume(server_thread_handle); // Start it + + cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority + udp_client, // entry + 0, // entry parameter + "UDP loopback client", // Name + &stack_client[0], // Stack + STACK_SIZE, // Size + &client_thread_handle, // Handle + &client_thread_data // Thread data structure + ); + cyg_scheduler_start(); +} + diff --git a/packages/net/ftpclient/current/ChangeLog b/packages/net/ftpclient/current/ChangeLog --- a/packages/net/ftpclient/current/ChangeLog +++ b/packages/net/ftpclient/current/ChangeLog @@ -1,3 +1,7 @@ +2002-02-22 Hugo Tyson + + * doc/ftpclient.sgml: New file. Document it. + 2001-12-04 Andrew Lunn * src/ftpclient.c: Allow it to compile! @@ -8,28 +12,37 @@ 2001-11-04 Andrew Lunn +FTP Client for eCos TCP/IP Stack + + +The ftpclient package provides an FTP (File Transfer Protocol) client +for use with the TCP/IP stack in eCos. + + + +FTP Client Features + +FTP Client API + +This package implements an FTP client. The API is in include file +install/include/ftpclient.h and it can be used thus: + +#include <network.h> +#include <ftpclient.h> + +It looks like this: + + +ftp_get + +int ftp_get(char * hostname, + char * username, + char * passwd, + char * filename, + char * buf, + unsigned buf_size, + ftp_printf_t ftp_printf); + + +Use the FTP protocol to retrieve a file from a server. Only binary +mode is supported. The filename can include a directory name. Only +use unix style ‘/’ file separators, +not ‘\’. +The file is placed into buf. +buf has maximum size buf_size. +If the file is bigger than this, the +transfer fails and FTP_TOOBIG is returned. +Other error codes listed in the header can also be returned. +If the transfer is successful the number of bytes received is returned. + + + +ftp_put + +int ftp_put(char * hostname, + char * username, + char * passwd, + char * filename, + char * buf, + unsigned buf_size, + ftp_printf_t ftp_printf); + + +Use the FTP protocol to send a file to a server. +Only binary +mode is supported. The filename can include a directory name. Only +use unix style ‘/’ file separators, +not ‘\’. +The contents of buf are placed into the file on the +server. If an error occurs one of the codes listed will be returned. If the +transfer is successful zero is returned. + + + +ftpclient_printf + +void ftpclient_printf(unsigned error, const char *fmt, ...); + + +ftp_get() and ftp_put +take a pointer to a function to use for printing +out diagnostic and error messages. This is a sample implementation +which can be used if you don't want to implement the function +yourself. +error will be true when the message to print is an +error message. Otherwise the message is diagnostic, eg. the commands sent +and received from the server. + + + + + diff --git a/packages/net/ftpclient/current/include/ftpclient.h b/packages/net/ftpclient/current/include/ftpclient.h --- a/packages/net/ftpclient/current/include/ftpclient.h +++ b/packages/net/ftpclient/current/include/ftpclient.h @@ -8,29 +8,38 @@ // A simple FTP client // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/net/ftpclient/current/src/ftpclient.c b/packages/net/ftpclient/current/src/ftpclient.c --- a/packages/net/ftpclient/current/src/ftpclient.c +++ b/packages/net/ftpclient/current/src/ftpclient.c @@ -5,29 +5,38 @@ // A simple FTP client // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/net/ftpclient/current/tests/ftpclient1.c b/packages/net/ftpclient/current/tests/ftpclient1.c --- a/packages/net/ftpclient/current/tests/ftpclient1.c +++ b/packages/net/ftpclient/current/tests/ftpclient1.c @@ -5,29 +5,38 @@ // Simple test of DNS client support // //========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### //========================================================================== //#####DESCRIPTIONBEGIN#### // diff --git a/packages/net/ns/dns/current/ChangeLog b/packages/net/ns/dns/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/net/ns/dns/current/ChangeLog @@ -0,0 +1,160 @@ +2002-05-14 Jesper Skov + + * tests/dns2.c: Fix warning. + +2002-02-22 Hugo Tyson + + * doc/dns.sgml: New file. Documentation separated from monolithic + network component. + +2002-02-01 Gary Thomas + + * src/dns.c (cyg_dns_res_init): Need valid value for sin_len. + +2002-01-31 Jonathan Larmour + + * cdl/dns.cdl: Don't build tests if no DNS! + +2001-12-06 Andrew Lunn + + * src/dns.c (cyg_dns_res_init): Allow this to be called more than + once. The DHCP client will do this when interfaces YoYo. + Restarting requires closing the socket (if any) and freeing the + per-thread-data slot number. + + * include/dns_impl.inl (setdomainname): Allow the name to be + cleared. Check for NULL pointers variously before checking for + valid pointer asserts. + + * tests/dns2.c: New file: Test the DNS configuration via DHCP. + + * tests/dns1.c: Initially clear the domainname. + +2001-11-29 Jonathan Larmour + + * src/dns.c: Rename index -> ptdindex to avoid conflict with BSD + index() function. + * include/dns_impl.inl: Ditto. + +2001-09-28 Jesper Skov + + * tests/dns1.c (_DNS_IP): Changed to IP used in farm. + +2001-09-27 Jesper Skov + + * include/dns_priv.h: Added DNS_REPLY definitions. + + * include/dns_impl.inl: Handle NXDomain returns. + + * include/dns_impl.inl: Added tracing. + * src/dns.c: Same. + +2001-09-26 Jesper Skov + + * tests/dns1.c (dns_test): Use hstrerror instead of strerror. + + * include/dns.h: Added h_errno support. + * include/dns_impl.inl: Use h_errno instead of errno. Added + hstrerror(). Make hostname lookups before hostname.domainmain + lookups. + +2001-09-25 Jesper Skov + + * include/dns.h: Moved some more defs to.. + * include/dns_priv.h: ...here. + + * src/dns-priv.h: [deleted] + * include/dns_priv.h: [added] + + * tests/dns1.c: Include netdb.h instead of dns.h. + + * src/dns.c: Moved all DNS protocol functions into + dns_impl.inl. Allow for RedBoot to share the implementation with a + smaller overhead. + * include/dns_impl.inl: Added. + + * cdl/dns.cdl: Moved compile statement and requirements into + CYGPKG_NS_DNS_BUILD option which can be forced off by RedBoot. + Moved headers to cyg/ns/dns. + + * src/dns.c (alloc_hent, free_hent, alloc_string, free_string): + Added these wrapper functions for malloc/free calls - allow easier + maintaining of cloned function in RedBoot which uses static + variables for storage. Incidently removed a little code + duplication. + + * include/dns.h: Only include exported information. + * src/dns-priv.h: Everything else moved to this file. + + * cdl/dns.cdl: Added feature requirements and CYGINT_ISO_DNS + magic. + + * include/dns.h: Renamed res_init to cyg_dns_res_init. + * src/dns.c: Same. + * tests/dns1.c: Same. + + * src/dns.c: Use drv_api mutex, removed some include statements. + * include/dns.h: Provide hostent definition and function + declarations. + + * tests/dns1.c: Use cambridge.redhat.com addresses. Changed to + output PASS/FAIL. + + * src/dns.c (parse_answer): On PTR lookups, alloc space for + in_addr, so caller can copy data there. Fix gethostbyaddr() to + do so. + Note that error values do not match gethostbyaddr(3). + +2001-09-20 Jesper Skov + + * src/dns.c: More cosmetic changes, a few htons -> ntohs changes, + reducing size of critical section a few places, rely on + build_query setting errno, and set errno when getdomainname can't + copy domain name out due to size limitation. + +2001-09-19 Jesper Skov + + * tests/dns1.c (dns_test): Fix inet_aton check. + * src/dns.c: A few comment and cosmetic changes. + +2001-09-18 Jesper Skov + + * src/dns.c: Added DNS code contributed by Andrew Lunn + + * include/dns.h: Same. + * tests/dns1.c: Same. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/net/ns/dns/current/cdl/dns.cdl b/packages/net/ns/dns/current/cdl/dns.cdl new file mode 100644 --- /dev/null +++ b/packages/net/ns/dns/current/cdl/dns.cdl @@ -0,0 +1,109 @@ +# ==================================================================== +# +# dns.cdl +# +# DNS configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +# ------------------------------------------- +# This file is part of eCos, the Embedded Configurable Operating System. +# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +# +# eCos is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 or (at your option) any later version. +# +# eCos is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with eCos; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# +# As a special exception, if other files instantiate templates or use macros +# or inline functions from this file, or you compile this file and link it +# with other works to produce a work based on this file, this file does not +# by itself cause the resulting work to be covered by the GNU General Public +# License. However the source code for this file must still be made available +# in accordance with section (3) of the GNU General Public License. +# +# This exception does not invalidate any other reasons why a work based on +# this file might be covered by the GNU General Public License. +# +# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +# at http://sources.redhat.com/ecos/ecos-license +# ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: jskov +# Contributors: +# Date: 2001-09-18 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_NS_DNS { + display "DNS client" + include_dir cyg/ns/dns + implements CYGINT_ISO_DNS + requires { CYGBLD_ISO_DNS_HEADER == "" } + + cdl_option CYGPKG_NS_DNS_BUILD { + display "Build DNS NS client package" + default_value 1 + + requires CYGPKG_NET + requires CYGINT_ISO_CTYPE + requires CYGINT_ISO_MALLOC + requires CYGINT_ISO_STRING_STRFUNCS + + compile dns.c + } + + cdl_component CYGPKG_NS_DNS_OPTIONS { + display "DNS support build options" + flavor none + no_define + + cdl_option CYGPKG_NS_DNS_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "-D_KERNEL -D__ECOS" } + description " + This option modifies the set of compiler flags for + building the DNS package. + These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_NS_DNS_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the DNS package. These flags are removed from + the set of global flags if present." + } + } + + cdl_option CYGPKG_NS_DNS_TESTS { + display "Networking tests" + flavor data + active_if CYGPKG_NS_DNS_BUILD + no_define + calculated { "tests/dns1 tests/dns2" } + + description " + This option specifies the set of tests for the DNS package." + } +} diff --git a/packages/net/ns/dns/current/doc/dns.sgml b/packages/net/ns/dns/current/doc/dns.sgml new file mode 100644 --- /dev/null +++ b/packages/net/ns/dns/current/doc/dns.sgml @@ -0,0 +1,59 @@ + +DNS for eCos and RedBoot + + +eCos and +RedBoot +can both use the DNS package to perform network name lookups. + + + +DNS + +DNS API +The DNS client uses the normal BSD API for performing lookups: +gethostbyname() and +gethostbyaddr(). + +There are a few restrictions: + + +Only IPv4 is supported, ie IPv6 addresses cannot be looked +up. + + +If the DNS server returns multiple authoritive records +for a host name, the hostent will only contain a record for the +first entry. + + +The code has been made thread safe. ie multiple threads +may can +gethostbyname() + without causing problems to the hostent structure returned. What +is not safe is one thread using both +gethostbyname() + and +gethostbyaddr(). +A call to one will destroy the results from the previous call +to the other function. + + +To initialise the DNS client the following function must be +called: +#include <network.h> +int cyg_dns_res_init(struct in_addr *dns_server) +where dns_server is the address of the DNS server +the client should query. On Error this function returns -1, otherwise +0 for success. If lookups are attemped before this function has +been called, they will fail and return NULL. +The DNS client understands the concepts of the target being +in a domain. By default no domain will be used. Host name lookups +should be for fully qualified names. The domain name can be set +using the function setdomainname(). +Once set, the DNS client will first perform a lookup with the domain +name appended. If this fails it will then perform a second lookup +without the appended domain name. + + + diff --git a/packages/net/ns/dns/current/include/dns.h b/packages/net/ns/dns/current/include/dns.h new file mode 100644 --- /dev/null +++ b/packages/net/ns/dns/current/include/dns.h @@ -0,0 +1,88 @@ +#ifndef CYGONCE_NS_DNS_DNS_H +#define CYGONCE_NS_DNS_DNS_H +//============================================================================= +// +// dns.h +// +// DNS client code. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): andrew.lunn +// Contributors:andrew.lunn, jskov +// Date: 2001-09-18 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include +#include + +#ifndef _POSIX_SOURCE +/* Initialise the DNS client with the address of the server */ +externC int cyg_dns_res_init(struct in_addr *dns_server); +externC int getdomainname(char *name, size_t len); +externC int setdomainname(char *name, size_t len); +#endif + +// Host name / IP mapping +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses */ +}; +#define h_addr h_addr_list[0] /* for backward compatibility */ + +externC struct hostent *gethostbyname(const char *host); +externC struct hostent *gethostbyaddr(const char *addr, int len, int type); + +// Error reporting +externC int h_errno; +externC const char* hstrerror(int err); + +#define DNS_SUCCESS 0 +#define HOST_NOT_FOUND 1 +#define TRY_AGAIN 2 +#define NO_RECOVERY 3 +#define NO_DATA 4 + +//----------------------------------------------------------------------------- +#endif // CYGONCE_NS_DNS_DNS_H +// End of dns.h diff --git a/packages/net/ns/dns/current/include/dns_impl.inl b/packages/net/ns/dns/current/include/dns_impl.inl new file mode 100644 --- /dev/null +++ b/packages/net/ns/dns/current/include/dns_impl.inl @@ -0,0 +1,627 @@ +#ifndef CYGONCE_NS_DNS_DNS_IMPL_H +#define CYGONCE_NS_DNS_DNS_IMPL_H +//============================================================================= +// +// dns_impl.inl +// +// DNS client code implementation. +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): andrew.lunn +// Contributors:andrew.lunn, jskov +// Date: 2001-09-18 +// Description: The code is kept in this separate file to allow it to be +// used from RedBoot. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include + +/* Validate a hostname is legal as defined in RFC 1035 */ +static int +valid_hostname(const char *hostname) +{ + const char * label; + const char * label_end; + + if (!hostname) { + return false; + } + label = hostname; + while (*label) { + if (!isalpha(*label)) + return false; + label_end = strchr(label, (int)'.') - 1; + if (label_end == (char *)-1) { + label_end = strchr(label, (int)'\0') - 1; + } + while (label != label_end) { + if (!isalnum(*label) && (*label != '-')) { + return false; + } + label++; + } + label = label_end+1; /* Move onto the . or the null. */ + if (*label == '.') { /* Move over the . if there is one */ + label++; + } + } + return true; +} + +/* Build a qname structure. The structure consists of pairs of +

NEC uPD985xx USB Device Driver